init component

This commit is contained in:
Robin COuret
2026-02-16 17:28:37 +01:00
parent 460c7a25e0
commit e0e50af706
4557 changed files with 666911 additions and 8 deletions

View File

@@ -0,0 +1,230 @@
import '../sass/form.sass';
import '../../dropdown/dropdown.sass';
import './autocomplete.sass';
import { Eq } from 'fp-ts/lib/Eq';
import { FunctionN, Predicate } from 'fp-ts/lib/function';
import { PropType, VNode } from 'vue';
export interface AutocompleteItem<T> {
id: string;
isSelected: boolean;
isHovered: boolean;
text: string;
value: T;
index: number;
}
export declare const BAutocomplete: import("vue").DefineComponent<{
selectedItems: {
type: PropType<unknown[]>;
required: true;
};
items: {
type: PropType<unknown[]>;
default: import("fp-ts/lib/function").Lazy<never[]>;
};
itemFilter: {
type: PropType<FunctionN<[string], Predicate<unknown>>>;
required: false;
};
itemId: {
type: PropType<(item: unknown) => any>;
default: string;
};
itemText: {
type: PropType<(item: unknown) => any>;
default: string;
};
closeOnSelect: {
type: PropType<boolean>;
default: boolean;
};
clearOnSelect: {
type: PropType<boolean>;
default: boolean;
};
openOnFocus: {
type: PropType<boolean>;
default: boolean;
};
onSelected: {
type: PropType<FunctionN<[unknown], void>>;
required: false;
};
"onUpdate:selectedItems": {
type: PropType<FunctionN<[unknown[]], void>>;
default: import("fp-ts/lib/function").Lazy<FunctionN<[unknown[]], void>>;
};
modelValue: {
type: PropType<string>;
required: false;
};
'onUpdate:modelValue': {
type: PropType<FunctionN<[string], void>>;
default: import("fp-ts/lib/function").Lazy<FunctionN<[string], void>>;
};
themeMap: {
type: PropType<import("../../..").ThemeColorMap>;
required: boolean;
default: import("fp-ts/lib/function").Lazy<import("../../..").ThemeColorMap>;
};
isThemeable: {
type: PropType<boolean>;
required: boolean;
default: boolean;
};
eq: {
type: PropType<Eq<unknown>>;
default: import("fp-ts/lib/function").Lazy<Eq<unknown>>;
};
isFocused: {
type: PropType<boolean>;
default: boolean;
};
onFocus: {
type: PropType<(e?: Event | undefined) => void>;
required: false;
};
onBlur: {
type: PropType<(e?: Event | undefined) => void>;
required: false;
};
focusOnMount: {
type: PropType<boolean>;
default: boolean;
};
isDisabled: {
type: PropType<boolean>;
required: boolean;
default: boolean;
};
isReadonly: {
type: PropType<boolean>;
required: boolean;
default: boolean;
};
disableIfReadonly: {
type: PropType<boolean>;
required: boolean;
default: boolean;
};
useNativeValidation: {
type: PropType<boolean>;
default: boolean;
};
isValid: {
type: PropType<boolean>;
default: boolean;
};
'onUpdate:isValid': {
type: PropType<FunctionN<[boolean], void>>;
default: import("fp-ts/lib/function").Lazy<() => void>;
};
variant: {
type: PropType<import("../../..").ColorVariant>;
default: "";
};
type: {
type: PropType<string>;
};
autocomplete: {
type: PropType<string>;
};
placeholder: {
type: PropType<string>;
};
size: {
type: PropType<import("../../..").SizeVariant>;
default: import("../../..").SizeVariant;
};
isRequired: {
type: BooleanConstructor;
default: boolean;
};
isExpanded: {
type: PropType<boolean>;
default: boolean;
};
isLoading: {
type: PropType<boolean>;
default: boolean;
};
isRounded: {
type: PropType<boolean>;
default: boolean;
};
maxlength: {
type: PropType<string | number>;
};
icon: null;
usePasswordReveal: {
type: PropType<boolean>;
default: undefined;
};
}, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
[key: string]: any;
}>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
isThemeable: boolean;
themeMap: import("../../..").ThemeColorMap;
variant: import("../../..").ColorVariant;
size: import("../../..").SizeVariant;
isExpanded: boolean;
isRounded: boolean;
isLoading: boolean;
isFocused: boolean;
isDisabled: boolean;
focusOnMount: boolean;
"onUpdate:modelValue": FunctionN<[string], void>;
isReadonly: boolean;
disableIfReadonly: boolean;
useNativeValidation: boolean;
isValid: boolean;
"onUpdate:isValid": FunctionN<[boolean], void>;
isRequired: boolean;
usePasswordReveal: boolean;
selectedItems: unknown[];
"onUpdate:selectedItems": FunctionN<[unknown[]], void>;
items: unknown[];
itemId: (item: unknown) => any;
itemText: (item: unknown) => any;
closeOnSelect: boolean;
clearOnSelect: boolean;
openOnFocus: boolean;
eq: Eq<unknown>;
} & {
icon?: any;
type?: string | undefined;
onFocus?: ((e?: Event | undefined) => void) | undefined;
onBlur?: ((e?: Event | undefined) => void) | undefined;
modelValue?: string | undefined;
autocomplete?: string | undefined;
placeholder?: string | undefined;
maxlength?: string | number | undefined;
itemFilter?: FunctionN<[string], Predicate<unknown>> | undefined;
onSelected?: FunctionN<[unknown], void> | undefined;
}>, {
isThemeable: boolean;
themeMap: import("../../..").ThemeColorMap;
variant: import("../../..").ColorVariant;
size: import("../../..").SizeVariant;
isExpanded: boolean;
isRounded: boolean;
isLoading: boolean;
isFocused: boolean;
isDisabled: boolean;
focusOnMount: boolean;
"onUpdate:modelValue": FunctionN<[string], void>;
isReadonly: boolean;
disableIfReadonly: boolean;
useNativeValidation: boolean;
isValid: boolean;
"onUpdate:isValid": FunctionN<[boolean], void>;
isRequired: boolean;
usePasswordReveal: boolean;
"onUpdate:selectedItems": FunctionN<[unknown[]], void>;
items: unknown[];
itemId: (item: unknown) => any;
itemText: (item: unknown) => any;
closeOnSelect: boolean;
clearOnSelect: boolean;
openOnFocus: boolean;
eq: Eq<unknown>;
}>;

View File

@@ -0,0 +1,317 @@
import "../../../../src/components/form/sass/form.sass";
import "../../../../src/components/dropdown/dropdown.sass";
import "../../../../src/components/form/autocomplete/autocomplete.sass";
import { StaticUseInputProps } from '../../../composables/input/useInput';
import { getUseModelPropsDefinition } from '../../../composables/model/useModel';
import { useProxy } from '../../../composables/proxy';
import { getEqPropsDefinition } from '../../../composables/shared';
import { useThemePropsDefinition } from '../../../composables/theme';
import { constEmptyArray, extractProp, isFunction, isHTMLElement, isObject, isString, toggleListItem } from '../../../utils/helpers';
import { DropdownThemeMap } from '../../dropdown';
import BDropdown from '../../dropdown/BDropdown';
import { isArrowDownEvent, isArrowUpEvent, isEnterEvent, isEscEvent, isTabEvent } from '../../../utils/eventHelpers';
import { constant, constVoid } from 'fp-ts/lib/function';
import BDropdownDivider from '../../dropdown/BDropdownDivider';
import BDropdownItem from '../../dropdown/BDropdownItem';
import { head, isEmpty, lookup } from 'fp-ts/lib/Array';
import { alt, chain, fold, fromNullable, isSome, map, none, some, toUndefined } from 'fp-ts/lib/Option';
import { pipe } from 'fp-ts/lib/pipeable';
import { defineComponent, shallowRef, computed, onBeforeUpdate, nextTick, toRef, h } from 'vue';
import { BInput } from '../input';
function getActiveDescendentId(selectedItems, itemId) {
return pipe(selectedItems, head, chain(item => {
if (isString(item) && isFunction(itemId)) {
const id = extractProp(itemId, item);
return isString(id) ? some(id) : none;
}
if (isString(item)) {
return some(item);
}
if (isString(itemId) && isObject(item) && Object.hasOwnProperty.call(item, itemId)) {
const id = item[itemId];
return isString(id) ? some(id) : none;
}
const id = extractProp(itemId, item);
return isString(id) ? some(id) : none;
}), toUndefined);
}
function getAutocompleteItems(items, selectedItems, itemId, itemText, eq, hoveredItem) {
return items.map((item, index) => {
const id = extractProp(itemId, item);
const nid = isString(id) ? id : String(id);
const text = extractProp(itemText, item);
return {
id: nid,
isSelected: selectedItems.some(i => eq.equals(i, item)),
isHovered: isSome(hoveredItem) ? hoveredItem.value.id === nid : false,
text: isString(text) ? text : String(text),
value: item,
index
};
});
}
function getSetSelected(props, closeDropdown, inputModel, selectedItemsModel) {
const toggle = toggleListItem(props.eq);
return item => {
const text = extractProp(props.itemText, item.value);
inputModel.value = props.clearOnSelect ? '' : isString(text) ? text : String(text);
selectedItemsModel.value = toggle(item.value, selectedItemsModel.value || []);
if (props.closeOnSelect) {
closeDropdown();
}
};
}
function getSetHovered(hoveredItem, templateItems) {
return item => {
const newItem = fromNullable(item);
if (isSome(newItem)) {
hoveredItem.value = newItem;
pipe(newItem, map(item => item.index), chain(index => lookup(index, templateItems.value)), fold(constant(constVoid), li => () => li.focus && li.focus()))();
}
};
}
function getOnKeydown(autocompleteItems, hoveredItem, closeDropdown, setSelected, setHovered) {
function onArrowPress(isUp) {
pipe(hoveredItem.value, map(item => item.index), alt(() => some(0)), chain(index => lookup(isUp ? Math.max(index - 1, 0) : Math.min(index + 1, autocompleteItems.value.length - 1), autocompleteItems.value)), fold(constant(constVoid), newItem => () => setHovered(newItem)))();
}
return function onKeydown(event) {
if (isEnterEvent(event)) {
event.preventDefault();
if (isSome(hoveredItem.value)) {
setSelected(hoveredItem.value.value);
}
} else if (isTabEvent(event)) {
event.preventDefault();
if (isSome(hoveredItem.value)) {
setSelected(hoveredItem.value.value);
} else {
nextTick(closeDropdown);
}
} else if (isArrowUpEvent(event)) {
event.preventDefault();
onArrowPress(true);
} else if (isArrowDownEvent(event)) {
event.preventDefault();
onArrowPress(false);
} else if (isEscEvent(event)) {
event.preventDefault();
nextTick(closeDropdown);
}
};
}
function getGenerateItem(itemsRef, length, onKeydown, setSelected, setHovered, slots) {
return function generateItem(item, index) {
return h(BDropdownItem, {
key: item.id,
ref: el => {
if (isHTMLElement(el)) {
itemsRef.value[index] = el;
}
},
id: item.id,
isActive: item.isSelected,
tabindex: item.isSelected ? -1 : 0,
'aria-selected': item.isSelected,
'aria-label': `Option ${index + 1} of ${length.value}`,
class: {
'is-hovered': item.isHovered
},
onClick: () => setSelected(item),
onMouseenter: () => setHovered(item),
onKeydown
}, () => slots.default ? slots.default({
option: item,
index
}) : item.text);
};
}
function generateHeaderItem(slots) {
return h('li', {
class: 'dropdown-item',
tabindex: -1
}, slots.header && slots.header());
}
function generateFooterItem(slots) {
return h('li', {
class: 'dropdown-item',
tabindex: -1
}, slots.footer && slots.footer());
}
function generateLoadingItem(slots) {
return h('li', {
tabindex: -1
}, [h(BDropdownItem, {
tag: 'div'
}, () => slots.loading ? slots.loading() : 'Loading results...')]);
}
function generateEmptyItem(modelValue, slots) {
return h(BDropdownItem, {
class: 'is-disabled'
}, () => slots.empty ? slots.empty({
searchValue: modelValue
}) : modelValue ? `No results` : `No results for ${modelValue}`);
}
function defineAutocomplete() {
return defineComponent({
name: 'b-autocomplete',
props: { ...StaticUseInputProps,
...getEqPropsDefinition(),
...useThemePropsDefinition(DropdownThemeMap),
...getUseModelPropsDefinition(),
...getUseModelPropsDefinition('selectedItems', 'onUpdate:selectedItems'),
selectedItems: {
type: Array,
required: true
},
items: {
type: Array,
default: constEmptyArray
},
itemFilter: {
type: Function,
required: false
},
itemId: {
type: [String, Function],
default: 'id'
},
itemText: {
type: [String, Function],
default: 'text'
},
closeOnSelect: {
type: Boolean,
default: true
},
clearOnSelect: {
type: Boolean,
default: true
},
openOnFocus: {
type: Boolean,
default: true
},
onSelected: {
type: Function,
required: false
}
},
setup(props, {
slots
}) {
const {
value: searchValue
} = useProxy(computed(() => props.modelValue ?? ''), toRef(props, 'onUpdate:modelValue'));
const {
value: selectedItems
} = useProxy(toRef(props, 'selectedItems'), toRef(props, 'onUpdate:selectedItems'));
const itemsRef = shallowRef([]);
const filteredItems = computed(() => {
if (props.itemFilter) {
return props.items.filter(props.itemFilter(searchValue.value));
} else {
const sv = searchValue.value.toLowerCase();
const extract = props.itemText;
return props.items.filter(i => extractProp(extract, i).toLowerCase().includes(sv));
}
});
onBeforeUpdate(() => {
itemsRef.value = [];
});
const dropdown = shallowRef(null);
function close() {
dropdown.value && dropdown.value.toggle.setOff();
}
const hoveredItem = shallowRef(none);
const activeDescendentId = computed(() => getActiveDescendentId(props.selectedItems, props.itemId));
const autocompleteItems = computed(() => getAutocompleteItems(filteredItems.value, selectedItems.value, props.itemId, props.itemText, props.eq, hoveredItem.value));
const numberOfItems = computed(() => autocompleteItems.value.length);
const setSelected = getSetSelected(props, close, searchValue, selectedItems);
const setHovered = getSetHovered(hoveredItem, itemsRef);
const onKeydown = getOnKeydown(autocompleteItems, hoveredItem, close, setSelected, setHovered);
const generateItem = getGenerateItem(itemsRef, numberOfItems, onKeydown, setSelected, setHovered, slots);
return () => {
return h(BDropdown, {
ref: dropdown,
isMobileModal: false,
class: ['b-autocomplete', {
'is-expanded': props.isExpanded
}]
}, {
trigger: () => {
return h(BInput, {
modelValue: searchValue.value,
type: 'text',
size: props.size,
isLoading: props.isLoading,
isRounded: props.isRounded,
icon: props.icon,
maxlength: props.maxlength,
autocomplete: 'off',
placeholder: props.placeholder,
role: 'searchbox',
'aria-activedescendant': activeDescendentId.value,
'onUpdate:modelValue': val => {
searchValue.value = val;
},
// onFocus: () => {
// nextTick().then(() => {
// if (props.openOnFocus && toggle.isOff.value) {
// toggle.setOn();
// }
// });
// },
onBlur: props.onBlur,
onKeydown
});
},
default: () => {
let nodes;
if (props.isLoading) {
nodes = [generateLoadingItem(slots)];
} else {
nodes = isEmpty(autocompleteItems.value) ? [generateEmptyItem(searchValue.value, slots)] : autocompleteItems.value.map(generateItem);
if (slots.header) {
nodes.unshift(generateHeaderItem(slots), h(BDropdownDivider));
}
if (slots.footer) {
nodes.push(h(BDropdownDivider), generateFooterItem(slots));
}
}
return nodes;
}
});
};
}
});
}
export const BAutocomplete = defineAutocomplete();
//# sourceMappingURL=BAutocomplete.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
export * from './BAutocomplete';

View File

@@ -0,0 +1,2 @@
export * from './BAutocomplete';
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/components/form/autocomplete/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAd","sourcesContent":["export * from './BAutocomplete';\n"],"sourceRoot":"","file":"index.js"}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,6 @@
import "../../../../src/components/form/checkbox/checkbox.sass";
import "../../../../src/components/form/sass/form.sass";
import { useSelectionControl } from '../shared/useSelectionControl';
export const defineCheckbox = useSelectionControl('checkbox', 'checkbox', 'b-checkbox', 'b-checkbox checkbox');
export const BCheckbox = defineCheckbox();
//# sourceMappingURL=BCheckbox.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/components/form/checkbox/BCheckbox.ts"],"names":[],"mappings":"AAAA,OAAO,wDAAP;AACA,OAAO,gDAAP;AACA,SAAS,mBAAT,QAAoC,+BAApC;AAEA,OAAO,MAAM,cAAc,GAAG,mBAAmB,CAAC,UAAD,EAAa,UAAb,EAAyB,YAAzB,EAAuC,qBAAvC,CAA1C;AAEP,OAAO,MAAM,SAAS,GAAG,cAAc,EAAhC","sourcesContent":["import './checkbox.sass';\nimport '../sass/form.sass';\nimport { useSelectionControl } from '../shared/useSelectionControl';\n\nexport const defineCheckbox = useSelectionControl('checkbox', 'checkbox', 'b-checkbox', 'b-checkbox checkbox');\n\nexport const BCheckbox = defineCheckbox<unknown>();\n"],"sourceRoot":"","file":"BCheckbox.js"}

View File

@@ -0,0 +1,3 @@
import { BCheckbox, defineCheckbox } from './BCheckbox';
export { BCheckbox, defineCheckbox };
export default BCheckbox;

4
node_modules/buetify/lib/components/form/checkbox/index.js generated vendored Executable file
View File

@@ -0,0 +1,4 @@
import { BCheckbox, defineCheckbox } from './BCheckbox';
export { BCheckbox, defineCheckbox };
export default BCheckbox;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/components/form/checkbox/index.ts"],"names":[],"mappings":"AAAA,SAAS,SAAT,EAAoB,cAApB,QAA0C,aAA1C;AAEA,SAAS,SAAT,EAAoB,cAApB;AAEA,eAAe,SAAf","sourcesContent":["import { BCheckbox, defineCheckbox } from './BCheckbox';\n\nexport { BCheckbox, defineCheckbox };\n\nexport default BCheckbox;\n"],"sourceRoot":"","file":"index.js"}

View File

@@ -0,0 +1,557 @@
import '../../pagination/pagination.sass';
import '../../dropdown/dropdown.sass';
import './datepicker.sass';
import { DateEvent, EventIndicator, MonthNumber } from './shared';
import { WeekdayNumber } from './utils';
import { FunctionN } from 'fp-ts/lib/function';
import { PropType, VNode, ComponentOptions, FunctionalComponent, ExtractPropTypes } from 'vue';
declare type Component = ComponentOptions | FunctionalComponent;
export declare type DatepickerPosition = 'is-top-right' | 'is-top-left' | 'is-bottom-left';
export interface DatepickerIcons {
next: Component;
previous: Component;
calendar: Component;
}
export declare function getDatepickerIcons(icons: Partial<DatepickerIcons>): DatepickerIcons;
declare const BDatepickerPropsDefinition: {
modelValue: {
type: PropType<Date | Date[]>;
};
'onUpdate:modelValue': {
type: PropType<FunctionN<[Date | Date[]], void>>;
required: true;
};
year: {
type: NumberConstructor;
default: number;
};
'onUpdate:year': {
type: PropType<FunctionN<[number], void>>;
required: boolean;
};
month: {
type: PropType<MonthNumber>;
default: MonthNumber;
};
'onUpdate:month': {
type: PropType<FunctionN<[MonthNumber], void>>;
required: boolean;
};
dayNames: {
type: PropType<string[]>;
default: import("fp-ts/lib/function").Lazy<string[]>;
};
monthNames: {
type: PropType<string[]>;
default: import("fp-ts/lib/function").Lazy<string[]>;
};
firstDayOfWeek: {
type: PropType<WeekdayNumber>;
default: 0;
};
events: {
type: PropType<DateEvent[]>;
default: import("fp-ts/lib/function").Lazy<never[]>;
};
minDate: {
type: PropType<Date>;
required: boolean;
};
maxDate: {
type: PropType<Date>;
required: boolean;
};
isDisabled: {
type: BooleanConstructor;
default: boolean;
};
unselectableDates: {
type: PropType<Date[]>;
default: import("fp-ts/lib/function").Lazy<never[]>;
};
unselectableDaysOfWeek: {
type: PropType<number[]>;
default: import("fp-ts/lib/function").Lazy<never[]>;
};
selectableDates: {
type: PropType<Date[]>;
};
showWeekNumber: {
type: PropType<boolean>;
default: false;
};
isMultiple: {
type: PropType<boolean>;
default: boolean;
};
placeholder: {
type: PropType<string>;
};
useMobileNative: {
type: PropType<boolean>;
default: boolean;
};
position: {
type: PropType<import("../../dropdown/BDropdown").DropdownPosition>;
};
indicators: {
type: PropType<EventIndicator>;
default: "bars";
};
yearsRange: {
type: PropType<[number, number]>;
default: import("fp-ts/lib/function").Lazy<readonly [-5, 3]>;
};
closeOnSelect: {
type: PropType<boolean>;
default: boolean;
};
isReadonly: {
type: PropType<boolean>;
default: boolean;
};
useNativeValidation: {
type: PropType<boolean>;
default: boolean;
};
icons: {
type: PropType<DatepickerIcons>;
default: import("fp-ts/lib/function").Lazy<DatepickerIcons>;
};
isFocused: {
type: PropType<boolean>;
default: boolean;
};
onFocus: {
type: PropType<(e?: Event | undefined) => void>;
required: false;
};
onBlur: {
type: PropType<(e?: Event | undefined) => void>;
required: false;
};
focusOnMount: {
type: PropType<boolean>;
default: boolean;
};
disableIfReadonly: {
type: PropType<boolean>;
required: boolean;
default: boolean;
};
isValid: {
type: PropType<boolean>;
default: boolean;
};
'onUpdate:isValid': {
type: PropType<FunctionN<[boolean], void>>;
default: import("fp-ts/lib/function").Lazy<() => void>;
};
variant: {
type: PropType<import("../../..").ColorVariant>;
default: "";
};
type: {
type: PropType<string>;
};
autocomplete: {
type: PropType<string>;
};
size: {
type: PropType<import("../../..").SizeVariant>;
default: import("../../..").SizeVariant;
};
isRequired: {
type: BooleanConstructor;
default: boolean;
};
isExpanded: {
type: PropType<boolean>;
default: boolean;
};
isLoading: {
type: PropType<boolean>;
default: boolean;
};
isRounded: {
type: PropType<boolean>;
default: boolean;
};
maxlength: {
type: PropType<string | number>;
};
icon: null;
usePasswordReveal: {
type: PropType<boolean>;
default: undefined;
};
id: PropType<string>;
isHoverable: {
type: PropType<boolean>;
default: boolean;
};
isInline: {
type: PropType<boolean>;
default: boolean;
};
isMobileModal: {
type: PropType<boolean>;
default: boolean;
};
menuTag: {
type: PropType<string>;
default: string;
};
transition: {
type: PropType<import("../../..").Transition>;
default: import("fp-ts/lib/function").Lazy<import("../../..").Transition>;
};
onToggle: {
type: PropType<FunctionN<[boolean], void>>;
required: false;
};
onSetOn: {
type: PropType<import("fp-ts/lib/IO").IO<void>>;
required: false;
};
onSetOff: {
type: PropType<import("fp-ts/lib/IO").IO<void>>;
required: false;
};
hasPopup: {
type: PropType<boolean>;
default: boolean;
};
themeMap: {
type: PropType<import("../../..").ThemeColorMap>;
required: boolean;
default: import("fp-ts/lib/function").Lazy<import("../../..").ThemeColorMap>;
};
isThemeable: {
type: PropType<boolean>;
required: boolean;
default: boolean;
};
};
export declare type BDatepickerProps = ExtractPropTypes<typeof BDatepickerPropsDefinition>;
declare const _default: import("vue").DefineComponent<{
modelValue: {
type: PropType<Date | Date[]>;
};
'onUpdate:modelValue': {
type: PropType<FunctionN<[Date | Date[]], void>>;
required: true;
};
year: {
type: NumberConstructor;
default: number;
};
'onUpdate:year': {
type: PropType<FunctionN<[number], void>>;
required: boolean;
};
month: {
type: PropType<MonthNumber>;
default: MonthNumber;
};
'onUpdate:month': {
type: PropType<FunctionN<[MonthNumber], void>>;
required: boolean;
};
dayNames: {
type: PropType<string[]>;
default: import("fp-ts/lib/function").Lazy<string[]>;
};
monthNames: {
type: PropType<string[]>;
default: import("fp-ts/lib/function").Lazy<string[]>;
};
firstDayOfWeek: {
type: PropType<WeekdayNumber>;
default: 0;
};
events: {
type: PropType<DateEvent[]>;
default: import("fp-ts/lib/function").Lazy<never[]>;
};
minDate: {
type: PropType<Date>;
required: boolean;
};
maxDate: {
type: PropType<Date>;
required: boolean;
};
isDisabled: {
type: BooleanConstructor;
default: boolean;
};
unselectableDates: {
type: PropType<Date[]>;
default: import("fp-ts/lib/function").Lazy<never[]>;
};
unselectableDaysOfWeek: {
type: PropType<number[]>;
default: import("fp-ts/lib/function").Lazy<never[]>;
};
selectableDates: {
type: PropType<Date[]>;
};
showWeekNumber: {
type: PropType<boolean>;
default: false;
};
isMultiple: {
type: PropType<boolean>;
default: boolean;
};
placeholder: {
type: PropType<string>;
};
useMobileNative: {
type: PropType<boolean>;
default: boolean;
};
position: {
type: PropType<import("../../dropdown/BDropdown").DropdownPosition>;
};
indicators: {
type: PropType<EventIndicator>;
default: "bars";
};
yearsRange: {
type: PropType<[number, number]>;
default: import("fp-ts/lib/function").Lazy<readonly [-5, 3]>;
};
closeOnSelect: {
type: PropType<boolean>;
default: boolean;
};
isReadonly: {
type: PropType<boolean>;
default: boolean;
};
useNativeValidation: {
type: PropType<boolean>;
default: boolean;
};
icons: {
type: PropType<DatepickerIcons>;
default: import("fp-ts/lib/function").Lazy<DatepickerIcons>;
};
isFocused: {
type: PropType<boolean>;
default: boolean;
};
onFocus: {
type: PropType<(e?: Event | undefined) => void>;
required: false;
};
onBlur: {
type: PropType<(e?: Event | undefined) => void>;
required: false;
};
focusOnMount: {
type: PropType<boolean>;
default: boolean;
};
disableIfReadonly: {
type: PropType<boolean>;
required: boolean;
default: boolean;
};
isValid: {
type: PropType<boolean>;
default: boolean;
};
'onUpdate:isValid': {
type: PropType<FunctionN<[boolean], void>>;
default: import("fp-ts/lib/function").Lazy<() => void>;
};
variant: {
type: PropType<import("../../..").ColorVariant>;
default: "";
};
type: {
type: PropType<string>;
};
autocomplete: {
type: PropType<string>;
};
size: {
type: PropType<import("../../..").SizeVariant>;
default: import("../../..").SizeVariant;
};
isRequired: {
type: BooleanConstructor;
default: boolean;
};
isExpanded: {
type: PropType<boolean>;
default: boolean;
};
isLoading: {
type: PropType<boolean>;
default: boolean;
};
isRounded: {
type: PropType<boolean>;
default: boolean;
};
maxlength: {
type: PropType<string | number>;
};
icon: null;
usePasswordReveal: {
type: PropType<boolean>;
default: undefined;
};
id: PropType<string>;
isHoverable: {
type: PropType<boolean>;
default: boolean;
};
isInline: {
type: PropType<boolean>;
default: boolean;
};
isMobileModal: {
type: PropType<boolean>;
default: boolean;
};
menuTag: {
type: PropType<string>;
default: string;
};
transition: {
type: PropType<import("../../..").Transition>;
default: import("fp-ts/lib/function").Lazy<import("../../..").Transition>;
};
onToggle: {
type: PropType<FunctionN<[boolean], void>>;
required: false;
};
onSetOn: {
type: PropType<import("fp-ts/lib/IO").IO<void>>;
required: false;
};
onSetOff: {
type: PropType<import("fp-ts/lib/IO").IO<void>>;
required: false;
};
hasPopup: {
type: PropType<boolean>;
default: boolean;
};
themeMap: {
type: PropType<import("../../..").ThemeColorMap>;
required: boolean;
default: import("fp-ts/lib/function").Lazy<import("../../..").ThemeColorMap>;
};
isThemeable: {
type: PropType<boolean>;
required: boolean;
default: boolean;
};
}, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
[key: string]: any;
}>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
isThemeable: boolean;
themeMap: import("../../..").ThemeColorMap;
hasPopup: boolean;
transition: import("../../..").Transition;
variant: import("../../..").ColorVariant;
size: import("../../..").SizeVariant;
icons: DatepickerIcons;
isExpanded: boolean;
isRounded: boolean;
isLoading: boolean;
isFocused: boolean;
isDisabled: boolean;
isHoverable: boolean;
isInline: boolean;
isMobileModal: boolean;
menuTag: string;
focusOnMount: boolean;
"onUpdate:modelValue": FunctionN<[Date | Date[]], void>;
isReadonly: boolean;
disableIfReadonly: boolean;
useNativeValidation: boolean;
isValid: boolean;
"onUpdate:isValid": FunctionN<[boolean], void>;
isRequired: boolean;
usePasswordReveal: boolean;
closeOnSelect: boolean;
isMultiple: boolean;
events: DateEvent[];
indicators: EventIndicator;
showWeekNumber: boolean;
month: MonthNumber;
unselectableDates: Date[];
unselectableDaysOfWeek: number[];
year: number;
dayNames: string[];
monthNames: string[];
firstDayOfWeek: WeekdayNumber;
useMobileNative: boolean;
yearsRange: [number, number];
} & {
onToggle?: FunctionN<[boolean], void> | undefined;
onSetOn?: import("fp-ts/lib/IO").IO<void> | undefined;
onSetOff?: import("fp-ts/lib/IO").IO<void> | undefined;
icon?: any;
type?: string | undefined;
position?: "is-top-right" | "is-top-left" | "is-bottom-left" | undefined;
id?: string | undefined;
onFocus?: ((e?: Event | undefined) => void) | undefined;
onBlur?: ((e?: Event | undefined) => void) | undefined;
modelValue?: Date | Date[] | undefined;
autocomplete?: string | undefined;
placeholder?: string | undefined;
maxlength?: string | number | undefined;
minDate?: Date | undefined;
maxDate?: Date | undefined;
selectableDates?: Date[] | undefined;
"onUpdate:year"?: FunctionN<[number], void> | undefined;
"onUpdate:month"?: FunctionN<[MonthNumber], void> | undefined;
}>, {
isThemeable: boolean;
themeMap: import("../../..").ThemeColorMap;
hasPopup: boolean;
transition: import("../../..").Transition;
variant: import("../../..").ColorVariant;
size: import("../../..").SizeVariant;
icons: DatepickerIcons;
isExpanded: boolean;
isRounded: boolean;
isLoading: boolean;
isFocused: boolean;
isDisabled: boolean;
isHoverable: boolean;
isInline: boolean;
isMobileModal: boolean;
menuTag: string;
focusOnMount: boolean;
isReadonly: boolean;
disableIfReadonly: boolean;
useNativeValidation: boolean;
isValid: boolean;
"onUpdate:isValid": FunctionN<[boolean], void>;
isRequired: boolean;
usePasswordReveal: boolean;
closeOnSelect: boolean;
isMultiple: boolean;
events: DateEvent[];
indicators: EventIndicator;
showWeekNumber: boolean;
month: MonthNumber;
unselectableDates: Date[];
unselectableDaysOfWeek: number[];
year: number;
dayNames: string[];
monthNames: string[];
firstDayOfWeek: WeekdayNumber;
useMobileNative: boolean;
yearsRange: [number, number];
}>;
export default _default;

View File

@@ -0,0 +1,541 @@
import "../../../../src/components/pagination/pagination.sass";
import "../../../../src/components/dropdown/dropdown.sass";
import "../../../../src/components/form/datepicker/datepicker.sass";
import { useDisable, UseDisablePropsDefinition } from '../../../composables/disable';
import { useEqRef } from '../../../composables/eqRef';
import { useFieldData } from '../../../composables/fieldData';
import { getUseInputPropsDefinition } from '../../../composables/input/useInput';
import { useProxy } from '../../../composables/proxy/useProxy';
import { DEFAULT_DAY_NAMES, DEFAULT_MONTH_NAMES } from './shared';
import { addDays, eqSerialDate, isDate } from './utils';
import { BInput } from '../input/BInput';
import { isArrowDownEvent, isArrowLeftEvent, isArrowRightEvent, isArrowUpEvent, isEnterEvent, isEscEvent, isSpaceEvent } from '../../../utils/eventHelpers';
import { head, isNonEmpty, range } from 'fp-ts/lib/Array';
import { constant } from 'fp-ts/lib/function';
import { alt, chain, fromNullable, getEq, isNone, isSome, some } from 'fp-ts/lib/Option';
import { pipe } from 'fp-ts/lib/pipeable';
import BDropdown, { BDropdownPropsDefinition } from '../../dropdown/BDropdown';
import BDatepickerTable from './BDatepickerTable';
import BField from '../field/BField';
import { BSelect } from '../select/BSelect';
import { computed, onUnmounted, onMounted, defineAsyncComponent, defineComponent, h, shallowRef, watch, toRef } from 'vue';
import { constEmptyArray, isString, toggleListItem } from '../../../utils/helpers';
const DEFAULT_DATEPICKER_ICONS = {
previous: defineAsyncComponent(() => import('../../icons/angleLeft')),
next: defineAsyncComponent(() => import('../../icons/angleRight')),
calendar: defineAsyncComponent(() => import('../../icons/calendar'))
};
export function getDatepickerIcons(icons) {
return { ...DEFAULT_DATEPICKER_ICONS,
...icons
};
}
const BDatepickerPropsDefinition = { ...BDropdownPropsDefinition,
...UseDisablePropsDefinition,
...getUseInputPropsDefinition(),
modelValue: {
type: [Array, Date]
},
'onUpdate:modelValue': {
type: Function,
required: true
},
year: {
type: Number,
default: new Date().getFullYear()
},
'onUpdate:year': {
type: Function,
required: false
},
month: {
type: Number,
default: new Date().getMonth()
},
'onUpdate:month': {
type: Function,
required: false
},
dayNames: {
type: Array,
default: constant(DEFAULT_DAY_NAMES)
},
monthNames: {
type: Array,
default: constant(DEFAULT_MONTH_NAMES)
},
firstDayOfWeek: {
type: Number,
default: 0
},
events: {
type: Array,
default: constEmptyArray
},
minDate: {
type: Date,
required: false
},
maxDate: {
type: Date,
required: false
},
isDisabled: {
type: Boolean,
default: false
},
unselectableDates: {
type: Array,
default: constEmptyArray
},
unselectableDaysOfWeek: {
type: Array,
default: constEmptyArray
},
selectableDates: {
type: Object
},
showWeekNumber: {
type: Boolean,
default: false
},
isMultiple: {
type: Boolean,
default: false
},
placeholder: {
type: String
},
useMobileNative: {
type: Boolean,
default: false
},
position: {
type: String
},
indicators: {
type: String,
default: 'bars'
},
yearsRange: {
type: Array,
default: constant([-5, 3])
},
closeOnSelect: {
type: Boolean,
default: true
},
isReadonly: {
type: Boolean,
default: true
},
useNativeValidation: {
type: Boolean,
default: false
},
// openOnFocus: {
// type: Boolean as PropType<boolean>,
// default: true
// },
icons: {
type: Object,
default: constant(DEFAULT_DATEPICKER_ICONS)
}
};
function useNative(props) {
return props.useMobileNative && !props.isInline;
}
const useFormattedDate = Intl.DateTimeFormat('default', {
year: 'numeric',
month: 'numeric',
day: 'numeric'
}).format;
function useFormattedModelValue(modelValue) {
return Array.isArray(modelValue) ? modelValue.map(useFormattedDate).join(', ') : modelValue ? useFormattedDate(modelValue) : null;
}
function parseInputString(str) {
const splits = str.split(',').map(s => s.trim());
return splits.map(s => new Date(s)).filter(d => isDate(d) && !isNaN(d.getTime()));
}
function generateInput(props, context, data) {
const isMobile = useNative(props);
return h(BInput, {
max: props.maxDate ? useFormattedDate(props.maxDate) : null,
min: props.minDate ? useFormattedDate(props.minDate) : null,
autocomplete: 'off',
type: isMobile ? 'date' : 'text',
modelValue: useFormattedModelValue(data.modelValue.value),
'onUpdate:modelValue': val => {
data.modelValue.value = parseInputString(val);
},
placeholder: props.placeholder,
size: props.size,
icon: props.icons.calendar,
isRounded: props.isRounded,
isDisabled: props.isDisabled,
isReadonly: props.isReadonly,
isLoading: props.isLoading,
useNativeValidation: props.useNativeValidation // onFocus: () => {
// if (!isMobile && props.openOnFocus && toggle) {
// if (toggle.isOff.value) {
// console.log('focus-set-on')
// toggle.setOn();
// Date.now()
// }
// }
// }
});
}
function generateButton(props, data, isNext) {
return h('button', {
class: isNext ? 'pagination-next datepicker-next' : 'pagination-previous datepicker-previous',
disabled: data.isDisabled,
onClick: isNext ? data.nextMonth : data.previousMonth,
onKeydown: e => {
if (isEnterEvent(e) || isSpaceEvent(e)) {
e.preventDefault();
isNext ? data.nextMonth() : data.previousMonth();
}
}
}, [h(isNext ? props.icons.next : props.icons.previous, {
variant: 'is-link',
isThemeable: false
})]);
}
function generateYearSelect(props, data) {
return h(BSelect, {
items: data.years,
modelValue: data.year.value,
isDisabled: data.isDisabled,
size: props.size,
'onUpdate:modelValue': data.setYear
});
}
function generateMonthSelect(props, data) {
return h(BSelect, {
items: data.months,
isDisabled: data.isDisabled,
size: props.size,
modelValue: data.month.value,
'onUpdate:modelValue': data.setMonth
});
}
function generateSelects(props, data) {
return h('div', {
class: 'pagination-list'
}, [h(BField, {
class: 'is-marginless'
}, () => [generateMonthSelect(props, data), generateYearSelect(props, data)])]);
}
function generateDefaultHeaderContents(props, data) {
return h('div', {
class: ['pagination field is-centered', props.size]
}, [generateButton(props, data, false), generateSelects(props, data), generateButton(props, data, true)]);
}
function generateHeader(props, context, data) {
return h('header', {
class: 'datepicker-header'
}, context.slots.header ? context.slots.header(data) : [generateDefaultHeaderContents(props, data)]);
}
function generateDatepickerTable(props, context, data) {
return h(BDatepickerTable, {
modelValue: data.modelValue.value,
'onUpdate:modelValue': val => {
data.modelValue.value = val;
},
focusedDate: data.focusedDate.value,
'onUpdate:focusedDate': val => {
data.focusedDate.value = val;
},
dayNames: props.dayNames,
monthNames: props.monthNames,
firstDayOfWeek: props.firstDayOfWeek,
minDate: props.minDate,
maxDate: props.maxDate,
month: data.month.value,
year: data.year.value,
isDisabled: data.isDisabled,
unselectableDates: props.unselectableDates,
unselectableDaysOfWeek: props.unselectableDaysOfWeek,
selectableDates: props.selectableDates,
events: props.events,
indicators: props.indicators,
showWeekNumber: props.showWeekNumber
});
}
function generateFooter(context) {
return h('footer', {
class: 'datepicker-footer'
}, context.slots.footer && context.slots.footer());
}
function generateCalendar(props, context, data) {
return h('section', {
class: 'datepicker-content',
'aria-label': 'Datepicker calendar'
}, [generateDatepickerTable(props, context, data)]);
}
function generateDatepickerBody(props, context, data) {
const nodes = [generateHeader(props, context, data), generateCalendar(props, context, data)];
if (context.slots.footer) {
nodes.push(generateFooter(context));
}
return h('div', nodes);
}
function generateDropdown(props, context, data, dropdown) {
return h(BDropdown, {
ref: dropdown,
position: props.position,
isDisabled: props.isDisabled,
isInline: props.isInline
}, {
trigger: () => {
return generateInput(props, context, data);
},
default: () => generateDatepickerBody(props, context, data)
});
}
function getMonths(props, focusedMonth) {
return props.monthNames.map((month, index) => ({
value: index,
text: month,
isDisabled: false,
isSelected: focusedMonth === index
}));
}
function getYears(props, focusedYear) {
const currentYear = new Date().getFullYear();
return range(props.yearsRange[0], props.yearsRange[1]).map(inc => currentYear + inc).map(year => ({
value: year,
text: year.toString(),
isDisabled: false,
isSelected: focusedYear === year
}));
}
function getSetPreviousMonth(props, month, year) {
return e => {
if (e) {
e.preventDefault();
}
if (!props.isDisabled) {
if (month.value > 0) {
month.value = month.value - 1;
} else {
month.value = 11;
year.value = year.value - 1;
}
}
};
}
function getSetNextMonth(props, month, year) {
return e => {
if (e) {
e.preventDefault();
}
if (!props.isDisabled) {
const mv = month.value;
if (mv < 11) {
month.value = mv + 1;
} else {
month.value = 0;
year.value = year.value + 1;
}
}
};
}
function getSetMonth(monthRef) {
return month => {
if (isString(month)) {
const newVal = fromNullable(parseInt(month, 10));
if (isSome(newVal)) {
monthRef.value = newVal.value;
}
} else {
monthRef.value = month;
}
};
}
function getSetYear(yearRef) {
return year => {
if (isString(year)) {
const newVal = fromNullable(parseInt(year, 10));
if (isSome(newVal)) {
yearRef.value = newVal.value;
}
} else {
yearRef.value = year;
}
};
}
const toggleSerialDate = toggleListItem(eqSerialDate);
export default defineComponent({
name: 'b-datepicker',
props: BDatepickerPropsDefinition,
setup(props, context) {
const fieldData = useFieldData();
const isDisabled = useDisable(props);
const dropdown = shallowRef(null);
const internalValue = shallowRef(props.modelValue);
watch(() => props.modelValue, newVal => {
internalValue.value = newVal;
});
const modelValue = computed({
get() {
return internalValue.value;
},
set(val) {
if (!val) {
return;
}
if (Array.isArray(val) && props.isMultiple || isDate(val)) {
props['onUpdate:modelValue'](val);
internalValue.value = val;
} else if (props.isMultiple && isDate(val)) {
const newVal = toggleSerialDate(val, internalValue.value == undefined ? [] : Array.isArray(internalValue.value) ? internalValue.value : [internalValue.value]);
props['onUpdate:modelValue'](newVal);
internalValue.value = newVal;
} else if (Array.isArray(val) && isNonEmpty(val)) {
props['onUpdate:modelValue'](val[0]);
internalValue.value = val[0];
}
if (props.closeOnSelect) {
dropdown.value && dropdown.value.toggle.setOff();
}
}
});
const focusedDate = useEqRef(getEq(eqSerialDate))(pipe(fromNullable(props.modelValue), chain(v => Array.isArray(v) ? head(v) : some(v)), alt(() => some(new Date()))));
const {
value: month
} = useProxy(toRef(props, 'month'), toRef(props, 'onUpdate:month'));
const {
value: year
} = useProxy(toRef(props, 'year'), toRef(props, 'onUpdate:year'));
const nextMonth = getSetNextMonth(props, month, year);
const previousMonth = getSetPreviousMonth(props, month, year);
const setMonth = getSetMonth(month);
const setYear = getSetYear(year);
function onKeydown(e) {
if (dropdown.value === undefined || dropdown.value?.$el === undefined || !dropdown.value.$el.contains(e.target)) {
return;
}
if (isEscEvent(e)) {
dropdown.value && dropdown.value.toggle.setOff();
return;
}
const fd = pipe(focusedDate.value, alt(() => pipe(fromNullable(modelValue.value), chain(v => Array.isArray(v) ? head(v) : some(v)))));
if (isNone(fd)) {
return;
}
if (isEnterEvent(e) || isSpaceEvent(e)) {
e.preventDefault();
modelValue.value = fd.value;
} else if (isArrowUpEvent(e)) {
e.preventDefault();
focusedDate.value = some(addDays(fd.value, -7));
} else if (isArrowRightEvent(e)) {
e.preventDefault();
focusedDate.value = some(addDays(fd.value, 1));
} else if (isArrowDownEvent(e)) {
e.preventDefault();
focusedDate.value = some(addDays(fd.value, 7));
} else if (isArrowLeftEvent(e)) {
e.preventDefault();
focusedDate.value = some(addDays(fd.value, -1));
}
}
onMounted(() => {
if (typeof window !== 'undefined') {
document.addEventListener('keyup', onKeydown);
}
});
onUnmounted(() => {
if (typeof window !== 'undefined') {
document.removeEventListener('keyup', onKeydown);
}
});
watch(focusedDate, fd => {
const m = month.value;
const y = year.value;
if (isSome(fd)) {
const fdValue = fd.value;
const nMonth = fdValue.getMonth();
if (nMonth !== m) {
month.value = nMonth;
}
const nYear = fdValue.getFullYear();
if (nYear !== y) {
year.value = nYear;
}
}
}, {
immediate: true
});
return () => {
const data = {
modelValue,
month,
year,
isDisabled: isDisabled.value,
focusedDate: focusedDate,
nextMonth,
previousMonth,
setMonth,
setYear,
months: getMonths(props, month.value),
years: getYears(props, year.value)
};
return h('article', {
class: ['b-datepicker control', props.size, {
'is-expanded': props.isExpanded || fieldData.attrs.isExpanded.value
}]
}, [useNative(props) ? generateInput(props, context, data) : generateDropdown(props, context, data, dropdown)]);
};
}
});
//# sourceMappingURL=BDatepicker.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,183 @@
import './datepicker.sass';
import { DateEvent, MonthNumber } from './shared';
import { WeekdayNumber } from './utils';
import { FunctionN } from 'fp-ts/lib/function';
import { Option } from 'fp-ts/lib/Option';
import { PropType, VNode, ExtractPropTypes } from 'vue';
export declare const BDatepickerTablePropsDefinition: {
modelValue: {
type: PropType<Date | Date[]>;
};
'onUpdate:modelValue': {
type: PropType<FunctionN<[Date | Date[]], void>>;
required: true;
};
focusedDate: {
type: PropType<Option<Date>>;
required: true;
};
'onUpdate:focusedDate': {
type: PropType<FunctionN<[Option<Date>], unknown>>;
required: true;
};
month: {
type: PropType<MonthNumber>;
required: true;
};
year: {
type: NumberConstructor;
required: true;
};
dayNames: {
type: PropType<string[]>;
default: import("fp-ts/lib/function").Lazy<string[]>;
};
monthNames: {
type: PropType<string[]>;
default: import("fp-ts/lib/function").Lazy<string[]>;
};
firstDayOfWeek: {
type: PropType<WeekdayNumber>;
default: 0;
};
events: {
type: PropType<DateEvent[]>;
default: import("fp-ts/lib/function").Lazy<never[]>;
};
indicators: {
type: PropType<import("./shared").EventIndicator>;
required: true;
};
minDate: {
type: PropType<Date>;
required: boolean;
};
maxDate: {
type: PropType<Date>;
required: boolean;
};
isDisabled: {
type: BooleanConstructor;
default: boolean;
};
unselectableDates: {
type: PropType<Date[]>;
default: import("fp-ts/lib/function").Lazy<never[]>;
};
unselectableDaysOfWeek: {
type: PropType<number[]>;
default: import("fp-ts/lib/function").Lazy<never[]>;
};
selectableDates: {
type: PropType<Date[]>;
};
showWeekNumber: {
type: PropType<boolean>;
default: false;
};
};
export declare type BDatepickerTableProps = ExtractPropTypes<typeof BDatepickerTablePropsDefinition>;
declare const _default: import("vue").DefineComponent<{
modelValue: {
type: PropType<Date | Date[]>;
};
'onUpdate:modelValue': {
type: PropType<FunctionN<[Date | Date[]], void>>;
required: true;
};
focusedDate: {
type: PropType<Option<Date>>;
required: true;
};
'onUpdate:focusedDate': {
type: PropType<FunctionN<[Option<Date>], unknown>>;
required: true;
};
month: {
type: PropType<MonthNumber>;
required: true;
};
year: {
type: NumberConstructor;
required: true;
};
dayNames: {
type: PropType<string[]>;
default: import("fp-ts/lib/function").Lazy<string[]>;
};
monthNames: {
type: PropType<string[]>;
default: import("fp-ts/lib/function").Lazy<string[]>;
};
firstDayOfWeek: {
type: PropType<WeekdayNumber>;
default: 0;
};
events: {
type: PropType<DateEvent[]>;
default: import("fp-ts/lib/function").Lazy<never[]>;
};
indicators: {
type: PropType<import("./shared").EventIndicator>;
required: true;
};
minDate: {
type: PropType<Date>;
required: boolean;
};
maxDate: {
type: PropType<Date>;
required: boolean;
};
isDisabled: {
type: BooleanConstructor;
default: boolean;
};
unselectableDates: {
type: PropType<Date[]>;
default: import("fp-ts/lib/function").Lazy<never[]>;
};
unselectableDaysOfWeek: {
type: PropType<number[]>;
default: import("fp-ts/lib/function").Lazy<never[]>;
};
selectableDates: {
type: PropType<Date[]>;
};
showWeekNumber: {
type: PropType<boolean>;
default: false;
};
}, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
[key: string]: any;
}>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
isDisabled: boolean;
"onUpdate:modelValue": FunctionN<[Date | Date[]], void>;
events: DateEvent[];
focusedDate: Option<Date>;
"onUpdate:focusedDate": FunctionN<[Option<Date>], unknown>;
indicators: import("./shared").EventIndicator;
showWeekNumber: boolean;
month: MonthNumber;
unselectableDates: Date[];
unselectableDaysOfWeek: number[];
year: number;
dayNames: string[];
monthNames: string[];
firstDayOfWeek: WeekdayNumber;
} & {
modelValue?: Date | Date[] | undefined;
minDate?: Date | undefined;
maxDate?: Date | undefined;
selectableDates?: Date[] | undefined;
}>, {
isDisabled: boolean;
events: DateEvent[];
showWeekNumber: boolean;
unselectableDates: Date[];
unselectableDaysOfWeek: number[];
dayNames: string[];
monthNames: string[];
firstDayOfWeek: WeekdayNumber;
}>;
export default _default;

View File

@@ -0,0 +1,186 @@
import "../../../../src/components/form/datepicker/datepicker.sass";
import { DEFAULT_DAY_NAMES, DEFAULT_MONTH_NAMES } from './shared';
import { addDays, getDatesInWeek, getEndOfMonth, getEndOfWeek, getStartOfMonth, getStartOfWeek, isDate, isOnOrAfterDate, isOnOrBeforeDate, isWithinWeek } from './utils';
import { constEmptyArray } from '../../../utils/helpers';
import { isEmpty, rotate } from 'fp-ts/lib/Array';
import { constant } from 'fp-ts/lib/function';
import { fromNullable, isNone, none } from 'fp-ts/lib/Option';
import { defineComponent, h, computed } from 'vue';
import BDatepickerTableRow from './BDatepickerTableRow';
export const BDatepickerTablePropsDefinition = {
modelValue: {
type: [Array, Date]
},
'onUpdate:modelValue': {
type: Function,
required: true
},
focusedDate: {
type: Object,
required: true
},
'onUpdate:focusedDate': {
type: Function,
required: true
},
month: {
type: Number,
required: true
},
year: {
type: Number,
required: true
},
dayNames: {
type: Array,
default: constant(DEFAULT_DAY_NAMES)
},
monthNames: {
type: Array,
default: constant(DEFAULT_MONTH_NAMES)
},
firstDayOfWeek: {
type: Number,
default: 0
},
events: {
type: Array,
default: constEmptyArray
},
indicators: {
type: String,
required: true
},
minDate: {
type: Date,
required: false
},
maxDate: {
type: Date,
required: false
},
isDisabled: {
type: Boolean,
default: false
},
unselectableDates: {
type: Array,
default: constEmptyArray
},
unselectableDaysOfWeek: {
type: Array,
default: constEmptyArray
},
selectableDates: {
type: Object
},
showWeekNumber: {
type: Boolean,
default: false
}
};
function getWeeksWithinMonth(props) {
const startOfMonth = getStartOfMonth(new Date(props.year, props.month + 1, 0));
const endOfCalendar = getEndOfWeek(getEndOfMonth(startOfMonth), props.firstDayOfWeek);
const weeks = [];
let date = getStartOfWeek(startOfMonth, props.firstDayOfWeek);
while (isOnOrBeforeDate(date, endOfCalendar)) {
weeks.push(getDatesInWeek(date, props.firstDayOfWeek));
date = addDays(date, 7);
}
return weeks;
}
function getEventsWithinWeek(props, week) {
return props.events.filter(event => {
const eventDate = isDate(event) ? event : event.date;
return isWithinWeek(week[0], eventDate, props.firstDayOfWeek);
});
}
function getWeeks(props) {
return getWeeksWithinMonth(props).map((week, weekNumber) => ({
week,
weekNumber,
events: getEventsWithinWeek(props, week)
}));
}
function generateTableHeader(dayNames) {
return h('thead', {
class: 'datepicker-header'
}, [h('tr', dayNames.map(day => h('th', {
key: day,
class: 'datepicker-cell'
}, day)))]);
}
function getGenerateTableRow(props, focusedDate) {
return function generateTableRow(weekData) {
return h(BDatepickerTableRow, {
key: weekData.weekNumber,
modelValue: props.modelValue,
'onUpdate:modelValue': props['onUpdate:modelValue'],
focusedDate: focusedDate.value,
'onUpdate:focusedDate': val => {
focusedDate.value = val;
},
week: weekData.week,
weekNumber: weekData.weekNumber,
month: props.month,
minDate: fromNullable(props.minDate),
maxDate: fromNullable(props.maxDate),
unselectableDates: props.unselectableDates,
unselectableDaysOfWeek: props.unselectableDaysOfWeek,
selectableDates: fromNullable(props.selectableDates),
events: weekData.events,
indicators: props.indicators
});
};
}
function generateTableBody(props, focusedDate) {
return h('tbody', {
class: ['datepicker-body', {
'has-events': !isEmpty(props.events)
}]
}, getWeeks(props).map(getGenerateTableRow(props, focusedDate)));
}
export default defineComponent({
name: 'b-datepicker-table',
props: BDatepickerTablePropsDefinition,
setup(props) {
const focusedDate = computed({
get() {
return props.focusedDate;
},
set(date) {
if (isNone(date)) {
props['onUpdate:focusedDate'](date);
} else if (props.minDate && props.maxDate) {
props['onUpdate:focusedDate'](isOnOrAfterDate(date.value, props.minDate) && isOnOrBeforeDate(date.value, props.maxDate) ? date : none);
} else if (props.minDate) {
props['onUpdate:focusedDate'](isOnOrAfterDate(date.value, props.minDate) ? date : none);
} else if (props.maxDate) {
props['onUpdate:focusedDate'](isOnOrBeforeDate(date.value, props.maxDate) ? date : none);
} else {
props['onUpdate:focusedDate'](date);
}
}
});
return () => {
return h('table', {
class: 'datepicker-table'
}, [generateTableHeader(rotate(-props.firstDayOfWeek)(props.dayNames)), generateTableBody(props, focusedDate)]);
};
}
});
//# sourceMappingURL=BDatepickerTable.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,41 @@
import './datepicker.sass';
import { FunctionN } from 'fp-ts/lib/function';
import { DateCell, EventIndicator } from './shared';
import { Option } from 'fp-ts/lib/Option';
import { PropType, VNode } from 'vue';
declare const _default: import("vue").DefineComponent<{
modelValue: {
type: PropType<Date | Date[]>;
};
'onUpdate:modelValue': {
type: PropType<FunctionN<[Date | Date[]], void>>;
required: true;
};
focusedDate: {
type: PropType<Option<Date>>;
required: true;
};
'onUpdate:focusedDate': {
type: PropType<FunctionN<[Option<Date>], void>>;
required: true;
};
indicators: {
type: PropType<EventIndicator>;
required: true;
};
cell: {
type: PropType<DateCell>;
required: true;
};
}, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
[key: string]: any;
}>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
"onUpdate:modelValue": FunctionN<[Date | Date[]], void>;
focusedDate: Option<Date>;
"onUpdate:focusedDate": FunctionN<[Option<Date>], void>;
indicators: EventIndicator;
cell: DateCell;
} & {
modelValue?: Date | Date[] | undefined;
}>, {}>;
export default _default;

View File

@@ -0,0 +1,84 @@
import "../../../../src/components/form/datepicker/datepicker.sass";
import { toggleListItem } from '../../../utils/helpers';
import { eqSerialDate, isSameDay } from './utils';
import { exists, getEq, some } from 'fp-ts/lib/Option';
import { pipe } from 'fp-ts/lib/pipeable';
import { defineComponent, shallowRef, h, watch, onMounted } from 'vue';
function generateEvents(events) {
return h('div', {
class: 'events'
}, events.map((event, index) => h('div', {
key: index,
class: ['event', event.variant]
})));
}
const toggleSerialDate = toggleListItem(eqSerialDate);
const eqOptionSerialDate = getEq(eqSerialDate);
export default defineComponent({
name: 'b-datepicker-table-cell',
props: {
modelValue: {
type: [Date, Array]
},
'onUpdate:modelValue': {
type: Function,
required: true
},
focusedDate: {
type: Object,
required: true
},
'onUpdate:focusedDate': {
type: Function,
required: true
},
indicators: {
type: String,
required: true
},
cell: {
type: Object,
required: true
}
},
setup(props) {
const buttonRef = shallowRef(null);
function onClick(e) {
e && e.preventDefault();
const currentValue = props.modelValue;
props['onUpdate:modelValue'](Array.isArray(currentValue) ? toggleSerialDate(props.cell.date, currentValue) : props.cell.date);
}
const onFocus = () => {
props['onUpdate:focusedDate'](some(props.cell.date));
};
onMounted(() => watch(() => props.focusedDate, (newVal, oldVal) => {
if ((oldVal && !eqOptionSerialDate.equals(newVal, oldVal) || oldVal === undefined) && buttonRef.value && pipe(newVal, exists(d => isSameDay(d, props.cell.date))) && document.activeElement !== buttonRef.value) {
buttonRef.value.focus({
preventScroll: true
});
}
}, {
immediate: true
}));
return () => {
return h('td', [h('button', {
ref: buttonRef,
class: ['datepicker-cell', props.cell.classes, props.indicators],
disabled: props.cell.isDisabled,
tabindex: props.cell.isDisabled || props.cell.isSelected ? -1 : 0,
'aria-label': props.cell.ariaLabel,
onClick,
onFocus,
onMouseenter: onFocus
}, [props.cell.date.getDate(), props.cell.hasEvents ? generateEvents(props.cell.events) : undefined])]);
};
}
});
//# sourceMappingURL=BDatepickerTableCell.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,164 @@
import './datepicker.sass';
import { DateEvent } from './shared';
import { FunctionN } from 'fp-ts/lib/function';
import { Option } from 'fp-ts/lib/Option';
import { PropType, VNode, ExtractPropTypes } from 'vue';
export declare const BDatepickerTableRowPropsDefinition: {
modelValue: {
type: PropType<Date | Date[]>;
};
'onUpdate:modelValue': {
type: PropType<FunctionN<[Date | Date[]], void>>;
required: true;
};
focusedDate: {
type: PropType<Option<Date>>;
required: true;
};
'onUpdate:focusedDate': {
type: PropType<FunctionN<[Option<Date>], unknown>>;
required: true;
};
showWeekNumber: {
type: PropType<boolean>;
default: false;
};
weekNumber: {
type: PropType<number>;
required: true;
};
week: {
type: PropType<Date[]>;
required: true;
};
month: {
type: PropType<number>;
required: true;
};
minDate: {
type: PropType<Option<Date>>;
required: true;
};
maxDate: {
type: PropType<Option<Date>>;
required: true;
};
isDisabled: {
type: PropType<boolean>;
default: false;
};
unselectableDates: {
type: PropType<Date[]>;
default: import("fp-ts/lib/function").Lazy<never[]>;
};
unselectableDaysOfWeek: {
type: PropType<number[]>;
default: import("fp-ts/lib/function").Lazy<never[]>;
};
selectableDates: {
type: PropType<Option<Date[]>>;
default: import("fp-ts/lib/function").Lazy<Option<never>>;
};
events: {
type: PropType<DateEvent[]>;
default: import("fp-ts/lib/function").Lazy<never[]>;
};
indicators: {
type: PropType<import("./shared").EventIndicator>;
required: true;
};
};
export declare type BDatePickerTableRowProps = ExtractPropTypes<typeof BDatepickerTableRowPropsDefinition>;
declare const _default: import("vue").DefineComponent<{
modelValue: {
type: PropType<Date | Date[]>;
};
'onUpdate:modelValue': {
type: PropType<FunctionN<[Date | Date[]], void>>;
required: true;
};
focusedDate: {
type: PropType<Option<Date>>;
required: true;
};
'onUpdate:focusedDate': {
type: PropType<FunctionN<[Option<Date>], unknown>>;
required: true;
};
showWeekNumber: {
type: PropType<boolean>;
default: false;
};
weekNumber: {
type: PropType<number>;
required: true;
};
week: {
type: PropType<Date[]>;
required: true;
};
month: {
type: PropType<number>;
required: true;
};
minDate: {
type: PropType<Option<Date>>;
required: true;
};
maxDate: {
type: PropType<Option<Date>>;
required: true;
};
isDisabled: {
type: PropType<boolean>;
default: false;
};
unselectableDates: {
type: PropType<Date[]>;
default: import("fp-ts/lib/function").Lazy<never[]>;
};
unselectableDaysOfWeek: {
type: PropType<number[]>;
default: import("fp-ts/lib/function").Lazy<never[]>;
};
selectableDates: {
type: PropType<Option<Date[]>>;
default: import("fp-ts/lib/function").Lazy<Option<never>>;
};
events: {
type: PropType<DateEvent[]>;
default: import("fp-ts/lib/function").Lazy<never[]>;
};
indicators: {
type: PropType<import("./shared").EventIndicator>;
required: true;
};
}, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
[key: string]: any;
}>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
isDisabled: boolean;
"onUpdate:modelValue": FunctionN<[Date | Date[]], void>;
events: DateEvent[];
focusedDate: Option<Date>;
"onUpdate:focusedDate": FunctionN<[Option<Date>], unknown>;
indicators: import("./shared").EventIndicator;
showWeekNumber: boolean;
weekNumber: number;
week: Date[];
month: number;
minDate: Option<Date>;
maxDate: Option<Date>;
unselectableDates: Date[];
unselectableDaysOfWeek: number[];
selectableDates: Option<Date[]>;
} & {
modelValue?: Date | Date[] | undefined;
}>, {
isDisabled: boolean;
events: DateEvent[];
showWeekNumber: boolean;
unselectableDates: Date[];
unselectableDaysOfWeek: number[];
selectableDates: Option<Date[]>;
}>;
export default _default;

View File

@@ -0,0 +1,202 @@
import "../../../../src/components/form/datepicker/datepicker.sass";
import BDatepickerTableCell from './BDatepickerTableCell';
import { elemSerialDate, isDate, isOnOrAfterDate, isOnOrBeforeDate, isSameDay } from './utils';
import { constEmptyArray, constNone } from '../../../utils/helpers';
import { isNonEmpty } from 'fp-ts/lib/Array';
import { constTrue, identity } from 'fp-ts/lib/function';
import { fold } from 'fp-ts/lib/Option';
import { pipe } from 'fp-ts/lib/pipeable';
import { defineComponent, computed, h } from 'vue';
export const BDatepickerTableRowPropsDefinition = {
modelValue: {
type: [Date, Array]
},
'onUpdate:modelValue': {
type: Function,
required: true
},
focusedDate: {
type: Object,
required: true
},
'onUpdate:focusedDate': {
type: Function,
required: true
},
showWeekNumber: {
type: Boolean,
default: false
},
weekNumber: {
type: Number,
required: true
},
week: {
type: Array,
required: true
},
month: {
type: Number,
required: true
},
minDate: {
type: Object,
required: true
},
maxDate: {
type: Object,
required: true
},
isDisabled: {
type: Boolean,
default: false
},
unselectableDates: {
type: Array,
default: constEmptyArray
},
unselectableDaysOfWeek: {
type: Array,
default: constEmptyArray
},
selectableDates: {
type: Object,
default: constNone
},
events: {
type: Array,
default: constEmptyArray
},
indicators: {
type: String,
required: true
}
};
function getIsAfterMinDate(props) {
return function isAfterMinDate(date) {
return pipe(props.minDate, fold(constTrue, d => isOnOrAfterDate(date, d)));
};
}
function getIsBeforeMaxDate(props) {
return function isBeforeMaxDate(date) {
return pipe(props.maxDate, fold(constTrue, d => isOnOrBeforeDate(date, d)));
};
}
function getIsWithinMonth(props) {
return function isWithinMonth(date) {
return date.getMonth() === props.month;
};
}
function getIsEnabled(props) {
return function isEnabled(date) {
return !elemSerialDate(date, props.unselectableDates) && pipe(props.selectableDates, fold(constTrue, dates => elemSerialDate(date, dates)));
};
}
function getIsOnSelectableDayOfWeek(props) {
return function isOnSelectableDayOfWeek(date) {
return !props.unselectableDaysOfWeek.includes(date.getDay());
};
}
function getDatePredicates(props) {
const isAfterMinDate = getIsAfterMinDate(props);
const isBeforeMaxDate = getIsBeforeMaxDate(props);
const isWithinMonth = getIsWithinMonth(props);
const isEnabled = getIsEnabled(props);
const isOnSelectableDayOfWeek = getIsOnSelectableDayOfWeek(props);
function isSelectedDate(date) {
return Array.isArray(props.modelValue) ? props.modelValue.some(d => isSameDay(d, date)) : props.modelValue ? isSameDay(props.modelValue, date) : false;
}
function isSelectableDate(date) {
return [isAfterMinDate(date), isBeforeMaxDate(date), isWithinMonth(date), isEnabled(date), isOnSelectableDayOfWeek(date)].every(identity);
}
return {
isAfterMinDate,
isBeforeMaxDate,
isWithinMonth,
isEnabled,
isOnSelectableDayOfWeek,
isSelectableDate,
isSelectedDate
};
}
function getDateClassesGenerator(props, predicates) {
const today = new Date();
return function getDateClasses(date, hasEvents = false) {
if (isDate(date)) {
const isSelectable = predicates.isSelectableDate(date);
return {
'is-selected': predicates.isSelectedDate(date),
'is-today': isSameDay(date, today),
'is-selectable': isSelectable && !props.isDisabled,
'is-unselectable': !isSelectable || props.isDisabled,
'has-event': hasEvents
};
} else {
return {};
}
};
}
function generateWeekNumber(weekNumber) {
return h('td', [`${weekNumber}`]);
}
function getGenerateCell(props) {
return function generateCell(cell) {
return h(BDatepickerTableCell, {
key: cell.date.toLocaleDateString(),
cell,
modelValue: props.modelValue,
'onUpdate:modelValue': props['onUpdate:modelValue'],
focusedDate: props.focusedDate,
'onUpdate:focusedDate': props['onUpdate:focusedDate'],
indicators: props.indicators
});
};
}
export default defineComponent({
name: 'b-datepicker-table-row',
props: BDatepickerTableRowPropsDefinition,
setup(props) {
const formattedEvents = computed(() => props.events.map(event => isDate(event) ? {
date: event,
variant: 'is-primary'
} : event));
const predicates = getDatePredicates(props);
const getDateClasses = getDateClassesGenerator(props, predicates);
const cells = computed(() => props.week.map(date => {
const events = formattedEvents.value.filter(event => isSameDay(date, event.date));
const hasEvents = isNonEmpty(events);
return {
date,
events,
hasEvents,
isSelected: predicates.isSelectedDate(date),
isDisabled: props.isDisabled || !predicates.isSelectableDate(date),
number: date.getDate(),
ariaLabel: date.toLocaleDateString(),
classes: getDateClasses(date, hasEvents)
};
}));
const generateCell = getGenerateCell(props);
return () => {
return h('tr', {
class: 'datepicker-row'
}, props.showWeekNumber ? [generateWeekNumber(props.weekNumber), ...cells.value.map(generateCell)] : cells.value.map(generateCell));
};
}
});
//# sourceMappingURL=BDatepickerTableRow.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,3 @@
import BDatepicker from './BDatepicker';
export default BDatepicker;
export { BDatepicker };

View File

@@ -0,0 +1,4 @@
import BDatepicker from './BDatepicker';
export default BDatepicker;
export { BDatepicker };
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/components/form/datepicker/index.ts"],"names":[],"mappings":"AAAA,OAAO,WAAP,MAAwB,eAAxB;AAEA,eAAe,WAAf;AAEA,SAAS,WAAT","sourcesContent":["import BDatepicker from './BDatepicker';\n\nexport default BDatepicker;\n\nexport { BDatepicker };\n"],"sourceRoot":"","file":"index.js"}

View File

@@ -0,0 +1,20 @@
import { ColorVariant } from '../../../types/ColorVariants';
export declare type DateEvent = Date | DetailedDateEvent;
export interface DetailedDateEvent {
date: Date;
variant: ColorVariant;
}
export declare type EventIndicator = 'dots' | 'bars';
export declare const DEFAULT_DAY_NAMES: string[];
export declare const DEFAULT_MONTH_NAMES: string[];
export declare type MonthNumber = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11;
export interface DateCell {
date: Date;
number: number;
ariaLabel: string;
isDisabled: boolean;
isSelected: boolean;
events: DetailedDateEvent[];
hasEvents: boolean;
classes: object;
}

View File

@@ -0,0 +1,3 @@
export const DEFAULT_DAY_NAMES = ['Su', 'M', 'Tu', 'W', 'Th', 'F', 'S'];
export const DEFAULT_MONTH_NAMES = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
//# sourceMappingURL=shared.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/components/form/datepicker/shared.ts"],"names":[],"mappings":"AAWA,OAAO,MAAM,iBAAiB,GAAG,CAAC,IAAD,EAAO,GAAP,EAAY,IAAZ,EAAkB,GAAlB,EAAuB,IAAvB,EAA6B,GAA7B,EAAkC,GAAlC,CAA1B;AAEP,OAAO,MAAM,mBAAmB,GAAG,CACjC,SADiC,EAEjC,UAFiC,EAGjC,OAHiC,EAIjC,OAJiC,EAKjC,KALiC,EAMjC,MANiC,EAOjC,MAPiC,EAQjC,QARiC,EASjC,WATiC,EAUjC,SAViC,EAWjC,UAXiC,EAYjC,UAZiC,CAA5B","sourcesContent":["import { ColorVariant } from '../../../types/ColorVariants';\n\nexport type DateEvent = Date | DetailedDateEvent;\n\nexport interface DetailedDateEvent {\n date: Date;\n variant: ColorVariant;\n}\n\nexport type EventIndicator = 'dots' | 'bars';\n\nexport const DEFAULT_DAY_NAMES = ['Su', 'M', 'Tu', 'W', 'Th', 'F', 'S'];\n\nexport const DEFAULT_MONTH_NAMES = [\n 'January',\n 'February',\n 'March',\n 'April',\n 'May',\n 'June',\n 'July',\n 'August',\n 'September',\n 'October',\n 'November',\n 'December'\n];\n\nexport type MonthNumber = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11;\n\nexport interface DateCell {\n date: Date;\n number: number;\n ariaLabel: string;\n isDisabled: boolean;\n isSelected: boolean;\n events: DetailedDateEvent[];\n hasEvents: boolean;\n classes: object;\n}\n"],"sourceRoot":"","file":"shared.js"}

View File

@@ -0,0 +1,27 @@
import { Eq } from 'fp-ts/lib/Eq';
import { Ord } from 'fp-ts/lib/Ord';
export declare function isDate(value: unknown): value is Date;
export declare function getStartOfDay(date: Date): Date;
export declare function getEndOfDay(date: Date): Date;
export declare function isSameDay(x: Date, y: Date): boolean;
export declare function isBeforeDay(date: Date, isBefore: Date): boolean;
export declare function isAfterDay(date: Date, isAfter: Date): boolean;
export declare function isSameMonth(x: Date, y: Date): boolean;
export declare const eqSerialDate: Eq<Date>;
export declare const ordSerialDate: Ord<Date>;
export declare const isOnOrAfterDate: (x: Date, y: Date) => boolean;
export declare const isOnOrBeforeDate: (x: Date, y: Date) => boolean;
export declare const elemSerialDate: {
(a: Date): (as: Date[]) => boolean;
(a: Date, as: Date[]): boolean;
};
export declare type WeekdayNumber = 0 | 1 | 2 | 3 | 4 | 5 | 6;
export declare function getStartOfMonth(date: Date): Date;
export declare function getEndOfMonth(date: Date): Date;
export declare function getStartOfWeek(date: Date, weekStartsOn?: WeekdayNumber): Date;
export declare function getEndOfWeek(date: Date, weekStartsOn?: WeekdayNumber): Date;
export declare function isWithinWeek(date: Date, secondDate: Date, weekStartsOn?: WeekdayNumber): boolean;
export declare function getDaysInMonth(date: Date): number;
export declare function addDays(date: Date, days: number): Date;
export declare function getDatesInWeek(date: Date, weekStartsOn?: WeekdayNumber): Date[];
export declare function addMonths(date: Date, months: number): Date;

108
node_modules/buetify/lib/components/form/datepicker/utils.js generated vendored Executable file
View File

@@ -0,0 +1,108 @@
import { elem } from 'fp-ts/lib/Array';
import { fromEquals } from 'fp-ts/lib/Eq';
import { fromCompare, geq, leq } from 'fp-ts/lib/Ord';
export function isDate(value) {
// from date-fns
return value instanceof Date || typeof value === 'object' && Object.prototype.toString.call(value) === '[object Date]';
}
export function getStartOfDay(date) {
const clone = new Date(date.getTime());
clone.setHours(0, 0, 0, 0);
return clone;
}
export function getEndOfDay(date) {
const clone = new Date(date.getTime());
clone.setHours(23, 59, 59, 999);
return clone;
}
export function isSameDay(x, y) {
return getStartOfDay(x).getTime() === getStartOfDay(y).getTime();
}
export function isBeforeDay(date, isBefore) {
return date.getTime() < getStartOfDay(isBefore).getTime();
}
export function isAfterDay(date, isAfter) {
return date.getTime() > getEndOfDay(isAfter).getTime();
}
function compareSerialDate(x, y) {
return isBeforeDay(x, y) ? -1 : isAfterDay(x, y) ? 1 : 0;
}
export function isSameMonth(x, y) {
return x.getFullYear() === y.getFullYear() && x.getMonth() === y.getMonth();
}
export const eqSerialDate = fromEquals(isSameDay);
export const ordSerialDate = fromCompare(compareSerialDate);
export const isOnOrAfterDate = geq(ordSerialDate);
export const isOnOrBeforeDate = leq(ordSerialDate);
export const elemSerialDate = elem(ordSerialDate);
export function getStartOfMonth(date) {
const clone = new Date(date.getTime());
clone.setDate(1);
clone.setHours(0, 0, 0, 0);
return clone;
}
export function getEndOfMonth(date) {
const clone = new Date(date.getTime());
const month = clone.getMonth();
clone.setFullYear(clone.getFullYear(), month + 1, 0);
clone.setHours(23, 59, 59, 999);
return clone;
}
export function getStartOfWeek(date, weekStartsOn = 0) {
const clone = new Date(date.getTime());
const day = clone.getDay();
const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
clone.setDate(clone.getDate() - diff);
clone.setHours(0, 0, 0, 0);
return clone;
}
export function getEndOfWeek(date, weekStartsOn = 0) {
const clone = new Date(date.getTime());
const day = clone.getDay();
const diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn);
clone.setDate(clone.getDate() + diff);
clone.setHours(23, 59, 59, 999);
return clone;
}
export function isWithinWeek(date, secondDate, weekStartsOn = 0) {
return isOnOrAfterDate(date, getStartOfWeek(secondDate, weekStartsOn)) && isOnOrBeforeDate(date, getEndOfWeek(secondDate, weekStartsOn));
}
export function getDaysInMonth(date) {
const clone = new Date(date.getTime());
const year = clone.getFullYear();
const monthIndex = clone.getMonth();
const lastDayOfMonth = new Date(0);
lastDayOfMonth.setFullYear(year, monthIndex + 1, 0);
lastDayOfMonth.setHours(0, 0, 0, 0);
return lastDayOfMonth.getDate();
}
export function addDays(date, days) {
const clone = new Date(date.getTime());
clone.setDate(clone.getDate() + days);
return clone;
}
export function getDatesInWeek(date, weekStartsOn = 0) {
const dates = [];
let day = getStartOfWeek(date, weekStartsOn);
const end = getEndOfWeek(date, weekStartsOn);
while (isOnOrBeforeDate(day, end)) {
dates.push(day);
day = addDays(day, 1);
}
return dates;
}
export function addMonths(date, months) {
const clone = new Date(date.getTime());
const newMonth = clone.getMonth() + months;
const dateWithDesiredMonth = new Date(0);
dateWithDesiredMonth.setFullYear(clone.getFullYear(), newMonth, 1);
dateWithDesiredMonth.setHours(0, 0, 0, 0);
const daysInMonth = getDaysInMonth(dateWithDesiredMonth);
clone.setMonth(newMonth, Math.min(daysInMonth, clone.getDate()));
return clone;
}
//# sourceMappingURL=utils.js.map

File diff suppressed because one or more lines are too long

157
node_modules/buetify/lib/components/form/field/BField.d.ts generated vendored Executable file
View File

@@ -0,0 +1,157 @@
import '../sass/tools.sass';
import { PropType, VNode, ExtractPropTypes } from 'vue';
import { AllColorsVariant } from '../../../types/ColorVariants';
export declare type FieldPosition = 'is-left' | 'is-centered' | 'is-right';
export declare const BFieldPropsDefinition: {
isGrouped: {
type: PropType<boolean>;
default: boolean;
};
isGroupedMultiline: {
type: PropType<boolean>;
default: boolean;
};
position: {
type: PropType<"is-left" | "is-right" | "is-centered">;
default: string;
};
isHorizontal: {
type: PropType<boolean>;
default: boolean;
};
hasAddons: {
type: PropType<boolean>;
default: boolean;
};
customLabelClass: {
type: PropType<string>;
default: string;
};
variant: {
type: PropType<AllColorsVariant>;
required: boolean;
};
message: {
type: PropType<string | {
[K: string]: boolean;
} | (string | {
[K: string]: boolean;
})[]>;
required: boolean;
};
isExpanded: {
type: PropType<boolean>;
default: boolean;
};
labelFor: PropType<string>;
label: {
type: PropType<string>;
default: string;
};
themeMap: {
type: PropType<import("../../..").ThemeColorMap>;
required: boolean;
default: import("fp-ts/lib/function").Lazy<import("../../..").ThemeColorMap>;
};
isThemeable: {
type: PropType<boolean>;
required: boolean;
default: boolean;
};
};
export declare type BFieldProps = ExtractPropTypes<typeof BFieldPropsDefinition>;
declare const BField: import("vue").DefineComponent<{
isGrouped: {
type: PropType<boolean>;
default: boolean;
};
isGroupedMultiline: {
type: PropType<boolean>;
default: boolean;
};
position: {
type: PropType<"is-left" | "is-right" | "is-centered">;
default: string;
};
isHorizontal: {
type: PropType<boolean>;
default: boolean;
};
hasAddons: {
type: PropType<boolean>;
default: boolean;
};
customLabelClass: {
type: PropType<string>;
default: string;
};
variant: {
type: PropType<AllColorsVariant>;
required: boolean;
};
message: {
type: PropType<string | {
[K: string]: boolean;
} | (string | {
[K: string]: boolean;
})[]>;
required: boolean;
};
isExpanded: {
type: PropType<boolean>;
default: boolean;
};
labelFor: PropType<string>;
label: {
type: PropType<string>;
default: string;
};
themeMap: {
type: PropType<import("../../..").ThemeColorMap>;
required: boolean;
default: import("fp-ts/lib/function").Lazy<import("../../..").ThemeColorMap>;
};
isThemeable: {
type: PropType<boolean>;
required: boolean;
default: boolean;
};
}, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
[key: string]: any;
}>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
isThemeable: boolean;
themeMap: import("../../..").ThemeColorMap;
isExpanded: boolean;
position: "is-left" | "is-right" | "is-centered";
label: string;
isGrouped: boolean;
isGroupedMultiline: boolean;
isHorizontal: boolean;
hasAddons: boolean;
customLabelClass: string;
} & {
variant?: "" | "is-black-ter" | "is-orange" | "is-primary" | "is-info" | "is-link" | "is-success" | "is-warning" | "is-danger" | "is-white" | "is-black" | "is-light" | "is-dark" | "is-black-bis" | "is-grey-darker" | "is-grey-dark" | "is-grey" | "is-grey-light" | "is-grey-lighter" | "is-white-ter" | "is-white-bis" | undefined;
message?: string | {
[K: string]: boolean;
} | (string | {
[K: string]: boolean;
})[] | undefined;
labelFor?: string | undefined;
}>, {
isThemeable: boolean;
themeMap: import("../../..").ThemeColorMap;
isExpanded: boolean;
position: "is-left" | "is-right" | "is-centered";
label: string;
isGrouped: boolean;
isGroupedMultiline: boolean;
isHorizontal: boolean;
hasAddons: boolean;
customLabelClass: string;
}>;
export interface BFieldBodyProps {
message?: string;
variant?: AllColorsVariant;
tag?: string;
}
export default BField;

164
node_modules/buetify/lib/components/form/field/BField.js generated vendored Executable file
View File

@@ -0,0 +1,164 @@
import "../../../../src/components/form/sass/tools.sass";
import { constant } from 'fp-ts/lib/function';
import { provideFieldData, ProvideFieldDataPropsDefinition } from '../../../composables/fieldData';
import { DefaultThemePropsDefinition } from '../../../composables/theme';
import { h, defineComponent, computed, shallowRef, watch } from 'vue';
function useRootClasses(props) {
return {
'is-expanded': props.isExpanded,
'is-horizontal': props.isHorizontal
};
}
function useFieldType(isGrouped, hasAddons) {
return isGrouped ? 'is-grouped' : hasAddons ? 'has-addons' : '';
}
function useInnerFieldClasses(props, fieldType) {
const isGrouped = props.isGrouped;
const position = props.position;
return [fieldType, {
'flex-grow-1': props.isExpanded,
'is-grouped-multiline': props.isGroupedMultiline,
'is-horizontal': props.isHorizontal,
'is-grouped-centered': isGrouped && position === 'is-centered',
'is-grouped-right': isGrouped && position === 'is-right',
'has-addons-centered': !isGrouped && position === 'is-centered',
'has-addons-right': !isGrouped && position === 'is-right'
}];
}
export const BFieldPropsDefinition = { ...DefaultThemePropsDefinition,
...ProvideFieldDataPropsDefinition,
isGrouped: {
type: Boolean,
default: false
},
isGroupedMultiline: {
type: Boolean,
default: false
},
position: {
type: String,
default: 'is-left'
},
isHorizontal: {
type: Boolean,
default: false
},
hasAddons: {
type: Boolean,
default: true
},
customLabelClass: {
type: String,
default: ''
}
};
function generateInnerLabel(fieldData, customClass) {
return h('label', {
class: ['label', customClass],
id: fieldData.labelId.value,
for: fieldData.id.value
}, fieldData.label.value);
}
function generateHorizontalLabel(fieldData, customClass, size) {
return h('div', {
class: ['field-label', size]
}, [generateInnerLabel(fieldData, customClass)]);
}
function generateLabel(isHorizontal, fieldData, customClass, size) {
const label = fieldData.label.value;
if (isHorizontal && !!label) {
return [generateHorizontalLabel(fieldData, customClass, size)];
} else if (!isHorizontal && !!label) {
return [generateInnerLabel(fieldData, customClass)];
} else {
return [];
}
}
function generateHelpMessage(isHorizontal, fieldDataAttrs) {
return !isHorizontal && !!fieldDataAttrs.message.value ? h('p', {
class: ['help', fieldDataAttrs.messageVariant.value],
innerHTML: fieldDataAttrs.message.value
}) : undefined;
}
function generateBody(props, fieldData, role, hasInnerField, fieldType, slots) {
if (props.isHorizontal) {
return [h(BFieldBody, // eslint-disable-line
{
class: {
'is-expanded': fieldData.isExpanded.value
},
message: fieldData.message.value,
variant: fieldData.messageVariant.value,
role
}, slots.default)];
} else if (hasInnerField) {
return [h('div', {
class: 'field-body'
}, [h(BField, // eslint-disable-line
{
hasAddons: false,
variant: fieldData.messageVariant.value,
class: useInnerFieldClasses(props, fieldType)
}, slots.default)])];
} else {
return slots.default ? slots.default() : [];
}
}
const BField = defineComponent({
name: 'b-field',
props: BFieldPropsDefinition,
setup(props, {
slots
}) {
const field = shallowRef(null);
const fieldData = provideFieldData(props);
const role = computed(() => props.isGrouped ? 'group' : '');
const size = shallowRef('');
watch(field, newVal => {
if (props.isHorizontal && newVal) {
// Bulma docs: .is-normal for any .input or .button
const elements = newVal.querySelectorAll('.input, .select, .button, .textarea');
if (elements.length > 0) {
size.value = 'is-normal';
}
}
});
return () => {
const hasAddons = !!(props.hasAddons && !props.isHorizontal && slots.default && slots.default().length > 1);
const hasInnerField = props.isGrouped || props.isGroupedMultiline || hasAddons;
const nodes = [...generateLabel(props.isHorizontal, fieldData.attrs, props.customLabelClass, size.value), ...generateBody(props, fieldData.attrs, role.value, hasInnerField, useFieldType(props.isGrouped, hasAddons), slots), generateHelpMessage(props.isHorizontal, fieldData.attrs)];
return h('div', {
ref: field,
class: ['field', useRootClasses(props)],
role: role.value
}, nodes);
};
}
}); // eslint-disable-next-line
function BFieldBody(props, {
attrs,
slots
}) {
const nodes = slots.default ? slots.default() : [];
return h(props.tag ?? 'div', {
class: 'field-body'
}, nodes.map(element => element.el ? element : h(BField, props, constant(element))));
}
export default BField;
//# sourceMappingURL=BField.js.map

File diff suppressed because one or more lines are too long

3
node_modules/buetify/lib/components/form/field/index.d.ts generated vendored Executable file
View File

@@ -0,0 +1,3 @@
import BField from './BField';
export default BField;
export { BField };

4
node_modules/buetify/lib/components/form/field/index.js generated vendored Executable file
View File

@@ -0,0 +1,4 @@
import BField from './BField';
export default BField;
export { BField };
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/components/form/field/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAP,MAAmB,UAAnB;AAEA,eAAe,MAAf;AAEA,SAAS,MAAT","sourcesContent":["import BField from './BField';\n\nexport default BField;\n\nexport { BField };\n"],"sourceRoot":"","file":"index.js"}

9
node_modules/buetify/lib/components/form/index.d.ts generated vendored Executable file
View File

@@ -0,0 +1,9 @@
export * from './autocomplete';
export * from './checkbox';
export * from './datepicker';
export * from './field';
export * from './input';
export * from './numberInput';
export * from './radio';
export * from './select';
export * from './switch';

10
node_modules/buetify/lib/components/form/index.js generated vendored Executable file
View File

@@ -0,0 +1,10 @@
export * from './autocomplete';
export * from './checkbox';
export * from './datepicker';
export * from './field';
export * from './input';
export * from './numberInput';
export * from './radio';
export * from './select';
export * from './switch';
//# sourceMappingURL=index.js.map

1
node_modules/buetify/lib/components/form/index.js.map generated vendored Executable file
View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/components/form/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAd;AACA,cAAc,YAAd;AACA,cAAc,cAAd;AACA,cAAc,SAAd;AACA,cAAc,SAAd;AACA,cAAc,eAAd;AACA,cAAc,SAAd;AACA,cAAc,UAAd;AACA,cAAc,UAAd","sourcesContent":["export * from './autocomplete';\nexport * from './checkbox';\nexport * from './datepicker';\nexport * from './field';\nexport * from './input';\nexport * from './numberInput';\nexport * from './radio';\nexport * from './select';\nexport * from './switch';\n"],"sourceRoot":"","file":"index.js"}

2797
node_modules/buetify/lib/components/form/input/BInput.d.ts generated vendored Executable file

File diff suppressed because it is too large Load Diff

221
node_modules/buetify/lib/components/form/input/BInput.js generated vendored Executable file
View File

@@ -0,0 +1,221 @@
import "../../../../src/components/form/sass/form.sass";
import { getUseInputPropsDefinition, useInput } from '../../../composables/input/useInput';
import { DefaultThemePropsDefinition, useTheme } from '../../../composables/theme/useTheme';
import { isNumber, isString } from '../../../utils/helpers';
import { constant } from 'fp-ts/lib/function';
import { DEFAULT_INPUT_ICONS } from '../shared/types';
import { defineComponent, shallowRef, h, computed } from 'vue';
export function getBInputPropsDefinition() {
return { ...getUseInputPropsDefinition(),
...DefaultThemePropsDefinition,
isLoading: {
type: Boolean,
default: false
},
hasCounter: {
type: Boolean,
default: true
},
customInputClass: {
type: String,
default: ''
},
inputIcons: {
type: Object,
required: false,
default: constant(DEFAULT_INPUT_ICONS)
}
};
}
function getIconPosition(leftIcon, rightIcon) {
if (leftIcon && rightIcon) {
return 'has-icons-left has-icons-right';
} else if (rightIcon) {
return 'has-icons-right';
} else if (leftIcon) {
return 'has-icons-left';
} else {
return '';
}
}
function getRightIcon(icons, variant, usePasswordReveal, passwordIsVisible) {
if (usePasswordReveal) {
return passwordIsVisible ? icons.passwordVisible : icons.passwordInvisible;
} else {
switch (variant) {
case 'is-danger':
return icons.isDanger;
case 'is-info':
return icons.isInfo;
case 'is-success':
return icons.isSuccess;
case 'is-warning':
return icons.isWarning;
default:
return undefined;
}
}
}
function generateLeftIcon(icon, size) {
// eslint-disable-next-line
return h(icon, {
class: 'is-left',
size
});
}
function generateRightIcon(icon, size, variant, usePasswordReveal, passwordToggle) {
// eslint-disable-next-line
return h(icon, {
class: ['is-right', {
'is-clickable': usePasswordReveal
}],
variant,
size,
...passwordToggle.attrs.value,
...passwordToggle.listeners
});
}
function generateCounter(isFocused, valueLength, maxLength) {
return h('small', {
class: ['help counter', {
'is-invisible': !isFocused
}]
}, `${valueLength} / ${maxLength}`);
}
function getAutocomplete(autocomplete, type) {
if (autocomplete && autocomplete.value) {
return autocomplete.value;
} else {
switch (type) {
case 'email':
return 'email';
case 'password':
return 'password';
default:
return undefined;
}
}
}
function generateNonTextInput(inputRef, inputData, isLoading, context, themeClasses) {
const hasMessage = !!inputData.message.value;
const type = inputData.type ? inputData.type.value : inputData.usePasswordReveal.value ? 'password' : undefined;
return h('input', { ...context.attrs,
ref: inputRef,
class: ['input', inputData.messageVariant.value, inputData.size.value, {
'is-rounded': inputData.isRounded.value,
// 'is-expanded': inputData.isExpanded.value,
'is-loading': isLoading,
'is-clearfix': !hasMessage
}, ...themeClasses],
value: inputData.modelValue.value,
onInput: inputData.onNativeInput,
type: inputData.type ? inputData.type.value : undefined,
autocomplete: getAutocomplete(inputData.autocomplete, type),
maxlength: inputData.maxlength && inputData.maxlength.value,
placeholder: inputData.placeholder && inputData.placeholder.value,
onBlur: inputData.onBlur,
onFocus: inputData.onFocus,
required: inputData.isRequired.value,
readonly: inputData.isReadonly.value,
disabled: inputData.isDisabled.value,
tabindex: inputData.isDisabled.value ? -1 : 0,
id: inputData.id.value
});
}
function generateTextarea(inputRef, inputData, isLoading, context, themeClasses) {
const hasMessage = !!inputData.message.value;
return h('textarea', { ...context.attrs,
ref: inputRef,
class: ['textarea', inputData.messageVariant.value, inputData.size.value, {
'is-rounded': inputData.isRounded.value,
'is-expanded': inputData.isExpanded.value,
'is-loading': isLoading,
'is-clearfix': !hasMessage
}, ...themeClasses],
value: inputData.modelValue.value,
onInput: inputData.onNativeInput,
maxlength: inputData.maxlength && inputData.maxlength.value,
placeholder: inputData.placeholder && inputData.placeholder.value,
onBlur: inputData.onBlur,
onFocus: inputData.onFocus,
required: inputData.isRequired.value,
readonly: inputData.isReadonly.value,
disabled: inputData.isDisabled.value,
tabindex: inputData.isDisabled.value ? -1 : 0,
id: inputData.id.value
});
}
function generateInput(inputRef, inputData, isLoading, context, themeClasses) {
const type = inputData.type && inputData.type.value;
return type === 'textarea' ? generateTextarea(inputRef, inputData, isLoading, context, themeClasses) : generateNonTextInput(inputRef, inputData, isLoading, context, themeClasses);
}
function getValueLength(modelValue) {
if (isString(modelValue)) {
return modelValue.length;
} else if (isNumber(modelValue)) {
return modelValue.toString().length;
}
return 0;
}
export function defineInput() {
return defineComponent({
name: 'b-input',
inheritAttrs: false,
props: getBInputPropsDefinition(),
setup(props, context) {
const inputRef = shallowRef(null);
const inputData = useInput(props, inputRef);
const rightIcon = computed(() => getRightIcon(props.inputIcons, inputData.messageVariant.value, inputData.usePasswordReveal.value, inputData.passwordToggle.isOn.value));
const useCounter = computed(() => (inputData.type === undefined || inputData.modelValue && typeof inputData.modelValue.value !== 'number') && !!inputData.maxlength && props.hasCounter);
const {
themeClasses
} = useTheme(props);
return () => {
const nodes = [generateInput(inputRef, inputData, props.isLoading, context, themeClasses.value)];
if (inputData.icon && inputData.icon.value) {
nodes.push(generateLeftIcon(inputData.icon.value, inputData.iconSize.value));
}
if (rightIcon.value) {
nodes.push(generateRightIcon(rightIcon.value, inputData.iconSize.value, inputData.messageVariant.value, inputData.usePasswordReveal.value, inputData.passwordToggle));
}
if (useCounter.value && inputData.maxlength && inputData.maxlength.value !== undefined) {
nodes.push(generateCounter(inputData.isFocused.value, getValueLength(inputData.modelValue.value), inputData.maxlength.value));
}
return h('div', {
class: ['control', inputData.size.value, getIconPosition(inputData.icon?.value, rightIcon.value), {
'is-expanded': inputData.isExpanded.value,
'is-loading': props.isLoading,
'is-clearfix': !inputData.message.value
}]
}, nodes);
};
}
});
} // eslint-disable-next-line
export const BInput = defineInput();
//# sourceMappingURL=BInput.js.map

File diff suppressed because one or more lines are too long

1
node_modules/buetify/lib/components/form/input/index.d.ts generated vendored Executable file
View File

@@ -0,0 +1 @@
export * from './BInput';

2
node_modules/buetify/lib/components/form/input/index.js generated vendored Executable file
View File

@@ -0,0 +1,2 @@
export * from './BInput';
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/components/form/input/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAd","sourcesContent":["export * from './BInput';\n"],"sourceRoot":"","file":"index.js"}

View File

@@ -0,0 +1,321 @@
import './number-input.sass';
import { FunctionN } from 'fp-ts/lib/function';
import { VNode, PropType, ExtractPropTypes } from 'vue';
import { InputIcons, NumberInputIcons } from '../shared/types';
export declare type BNumberInputControlsPosition = 'compact' | '';
declare const BNumberInputPropsDefinition: {
min: {
type: PropType<number>;
default: number;
};
max: {
type: PropType<number>;
default: number;
};
step: {
type: PropType<number>;
default: number;
};
displayControls: {
type: PropType<boolean>;
default: boolean;
};
controlsRounded: {
type: PropType<boolean>;
default: boolean;
};
controlsPosition: {
type: PropType<BNumberInputControlsPosition>;
default: "";
};
inputIcons: {
type: PropType<InputIcons>;
default: import("fp-ts/lib/function").Lazy<InputIcons>;
};
numberInputIcons: {
type: PropType<NumberInputIcons>;
default: import("fp-ts/lib/function").Lazy<NumberInputIcons>;
};
isFocused: {
type: PropType<boolean>;
default: boolean;
};
onFocus: {
type: PropType<(e?: Event | undefined) => void>;
required: false;
};
onBlur: {
type: PropType<(e?: Event | undefined) => void>;
required: false;
};
focusOnMount: {
type: PropType<boolean>;
default: boolean;
};
isDisabled: {
type: PropType<boolean>;
required: boolean;
default: boolean;
};
isReadonly: {
type: PropType<boolean>;
required: boolean;
default: boolean;
};
disableIfReadonly: {
type: PropType<boolean>;
required: boolean;
default: boolean;
};
useNativeValidation: {
type: PropType<boolean>;
default: boolean;
};
isValid: {
type: PropType<boolean>;
default: boolean;
};
'onUpdate:isValid': {
type: PropType<FunctionN<[boolean], void>>;
default: import("fp-ts/lib/function").Lazy<() => void>;
};
variant: {
type: PropType<import("../../..").ColorVariant>;
default: "";
};
type: {
type: PropType<string>;
};
autocomplete: {
type: PropType<string>;
};
placeholder: {
type: PropType<string>;
};
size: {
type: PropType<import("../../..").SizeVariant>;
default: import("../../..").SizeVariant;
};
isRequired: {
type: BooleanConstructor;
default: boolean;
};
isExpanded: {
type: PropType<boolean>;
default: boolean;
};
isLoading: {
type: PropType<boolean>;
default: boolean;
};
isRounded: {
type: PropType<boolean>;
default: boolean;
};
maxlength: {
type: PropType<string | number>;
};
icon: null;
usePasswordReveal: {
type: PropType<boolean>;
default: undefined;
};
modelValue: {
type: PropType<number>;
required: false;
};
'onUpdate:modelValue': {
type: PropType<FunctionN<[number], void>>;
default: import("fp-ts/lib/function").Lazy<FunctionN<[number], void>>;
};
};
export declare type BNumberInputProps = ExtractPropTypes<typeof BNumberInputPropsDefinition>;
export declare function getNumberInputIcons(icons: Partial<NumberInputIcons>): NumberInputIcons;
declare const _default: import("vue").DefineComponent<{
min: {
type: PropType<number>;
default: number;
};
max: {
type: PropType<number>;
default: number;
};
step: {
type: PropType<number>;
default: number;
};
displayControls: {
type: PropType<boolean>;
default: boolean;
};
controlsRounded: {
type: PropType<boolean>;
default: boolean;
};
controlsPosition: {
type: PropType<BNumberInputControlsPosition>;
default: "";
};
inputIcons: {
type: PropType<InputIcons>;
default: import("fp-ts/lib/function").Lazy<InputIcons>;
};
numberInputIcons: {
type: PropType<NumberInputIcons>;
default: import("fp-ts/lib/function").Lazy<NumberInputIcons>;
};
isFocused: {
type: PropType<boolean>;
default: boolean;
};
onFocus: {
type: PropType<(e?: Event | undefined) => void>;
required: false;
};
onBlur: {
type: PropType<(e?: Event | undefined) => void>;
required: false;
};
focusOnMount: {
type: PropType<boolean>;
default: boolean;
};
isDisabled: {
type: PropType<boolean>;
required: boolean;
default: boolean;
};
isReadonly: {
type: PropType<boolean>;
required: boolean;
default: boolean;
};
disableIfReadonly: {
type: PropType<boolean>;
required: boolean;
default: boolean;
};
useNativeValidation: {
type: PropType<boolean>;
default: boolean;
};
isValid: {
type: PropType<boolean>;
default: boolean;
};
'onUpdate:isValid': {
type: PropType<FunctionN<[boolean], void>>;
default: import("fp-ts/lib/function").Lazy<() => void>;
};
variant: {
type: PropType<import("../../..").ColorVariant>;
default: "";
};
type: {
type: PropType<string>;
};
autocomplete: {
type: PropType<string>;
};
placeholder: {
type: PropType<string>;
};
size: {
type: PropType<import("../../..").SizeVariant>;
default: import("../../..").SizeVariant;
};
isRequired: {
type: BooleanConstructor;
default: boolean;
};
isExpanded: {
type: PropType<boolean>;
default: boolean;
};
isLoading: {
type: PropType<boolean>;
default: boolean;
};
isRounded: {
type: PropType<boolean>;
default: boolean;
};
maxlength: {
type: PropType<string | number>;
};
icon: null;
usePasswordReveal: {
type: PropType<boolean>;
default: undefined;
};
modelValue: {
type: PropType<number>;
required: false;
};
'onUpdate:modelValue': {
type: PropType<FunctionN<[number], void>>;
default: import("fp-ts/lib/function").Lazy<FunctionN<[number], void>>;
};
}, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
[key: string]: any;
}>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
variant: import("../../..").ColorVariant;
size: import("../../..").SizeVariant;
isExpanded: boolean;
isRounded: boolean;
isLoading: boolean;
isFocused: boolean;
isDisabled: boolean;
focusOnMount: boolean;
"onUpdate:modelValue": FunctionN<[number], void>;
isReadonly: boolean;
disableIfReadonly: boolean;
useNativeValidation: boolean;
isValid: boolean;
"onUpdate:isValid": FunctionN<[boolean], void>;
isRequired: boolean;
usePasswordReveal: boolean;
inputIcons: InputIcons;
min: number;
max: number;
step: number;
displayControls: boolean;
controlsRounded: boolean;
controlsPosition: BNumberInputControlsPosition;
numberInputIcons: NumberInputIcons;
} & {
icon?: any;
type?: string | undefined;
onFocus?: ((e?: Event | undefined) => void) | undefined;
onBlur?: ((e?: Event | undefined) => void) | undefined;
modelValue?: number | undefined;
autocomplete?: string | undefined;
placeholder?: string | undefined;
maxlength?: string | number | undefined;
}>, {
variant: import("../../..").ColorVariant;
size: import("../../..").SizeVariant;
isExpanded: boolean;
isRounded: boolean;
isLoading: boolean;
isFocused: boolean;
isDisabled: boolean;
focusOnMount: boolean;
"onUpdate:modelValue": FunctionN<[number], void>;
isReadonly: boolean;
disableIfReadonly: boolean;
useNativeValidation: boolean;
isValid: boolean;
"onUpdate:isValid": FunctionN<[boolean], void>;
isRequired: boolean;
usePasswordReveal: boolean;
inputIcons: InputIcons;
min: number;
max: number;
step: number;
displayControls: boolean;
controlsRounded: boolean;
controlsPosition: BNumberInputControlsPosition;
numberInputIcons: NumberInputIcons;
}>;
export default _default;

View File

@@ -0,0 +1,152 @@
import "../../../../src/components/form/numberInput/number-input.sass";
import { getUseInputPropsDefinition } from '../../../composables/input/useInput';
import { constant } from 'fp-ts/lib/function';
import { h, defineComponent, defineAsyncComponent, computed, toRef } from 'vue';
import { useProxy } from '../../../composables/proxy';
import { isNumber, isString } from '../../../utils/helpers';
import BButton from '../../button/BButton';
import { BInput } from '../input/BInput';
import { DEFAULT_INPUT_ICONS } from '../shared/types';
const DEFAULT_NUMBER_INPUT_ICONS = {
minus: defineAsyncComponent(() => import('../../icons/minus')),
plus: defineAsyncComponent(() => import('../../icons/plus'))
};
const BNumberInputPropsDefinition = { ...getUseInputPropsDefinition(),
min: {
type: Number,
default: Number.MIN_SAFE_INTEGER
},
max: {
type: Number,
default: Number.MAX_SAFE_INTEGER
},
step: {
type: Number,
default: 1
},
displayControls: {
type: Boolean,
default: true
},
controlsRounded: {
type: Boolean,
default: false
},
controlsPosition: {
type: String,
default: ''
},
inputIcons: {
type: Object,
default: constant(DEFAULT_INPUT_ICONS)
},
numberInputIcons: {
type: Object,
default: constant(DEFAULT_NUMBER_INPUT_ICONS)
}
};
export function getNumberInputIcons(icons) {
return { ...DEFAULT_NUMBER_INPUT_ICONS,
...icons
};
}
function getFieldClasses(controlsPosition, isExpanded) {
const isCompact = controlsPosition === 'compact';
return {
'is-expanded': isExpanded,
'has-addons': isCompact,
'is-grouped': !isCompact
};
}
function generateControl(props, data, isDecrement) {
return h('p', {
class: 'control'
}, [h(BButton, {
variant: props.variant || 'is-primary',
size: props.size,
isRounded: props.controlsRounded,
isDisabled: isDecrement ? !data.canDecrement.value : !data.canIncrement.value,
onClick: isDecrement ? data.onDecrement : data.onIncrement
}, () => h(isDecrement ? props.numberInputIcons.minus : props.numberInputIcons.plus, {
size: props.size
}))]);
}
function generateInput(props, data, context) {
return h(BInput, { ...context.attrs,
modelValue: data.number.value,
'onUpdate:modelValue': data.set,
type: 'number',
size: props.size,
placeholder: props.placeholder ? `${props.placeholder}` : '',
isDisabled: props.isDisabled,
inputIcons: props.inputIcons,
isReadonly: props.isReadonly,
isLoading: props.isLoading,
isRounded: props.isRounded,
icon: props.icon,
isExpanded: props.isExpanded,
step: props.step,
max: props.max,
min: props.min
});
}
export default defineComponent({
name: 'b-number-input',
props: BNumberInputPropsDefinition,
setup(props, context) {
const {
value: number
} = useProxy(toRef(props, 'modelValue'), toRef(props, 'onUpdate:modelValue'));
const defaultMin = computed(() => props.min === Number.MIN_SAFE_INTEGER ? 0 : props.min);
const defaultMax = computed(() => props.max === Number.MAX_SAFE_INTEGER ? 0 : props.max);
const canDecrement = computed(() => (number.value ?? defaultMax.value) - props.step >= props.min);
function onDecrement() {
if (canDecrement.value) {
number.value = (number.value ?? 0) - props.step;
}
}
const canIncrement = computed(() => (props.modelValue ?? defaultMin.value) + props.step <= props.max);
function onIncrement() {
if (canIncrement.value) {
number.value = (number.value ?? 0) + props.step;
}
}
function set(val) {
if (isString(val)) {
const x = Number.parseFloat(val);
if (Number.isNaN(x)) return;
number.value = x;
}
if (isNumber(val)) {
number.value = val;
}
}
const data = {
set,
number,
canDecrement,
canIncrement,
onDecrement,
onIncrement
};
return () => {
const nodes = props.displayControls ? [generateControl(props, data, true), generateInput(props, data, context), generateControl(props, data, false)] : [generateInput(props, data, context)];
return h('div', {
class: ['b-number-input field', getFieldClasses(props.controlsPosition, props.isExpanded)]
}, nodes);
};
}
});
//# sourceMappingURL=BNumberInput.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,3 @@
import BNumberInput from './BNumberInput';
export { BNumberInput };
export default BNumberInput;

View File

@@ -0,0 +1,4 @@
import BNumberInput from './BNumberInput';
export { BNumberInput };
export default BNumberInput;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/components/form/numberInput/index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAP,MAAyB,gBAAzB;AAEA,SAAS,YAAT;AAEA,eAAe,YAAf","sourcesContent":["import BNumberInput from './BNumberInput';\n\nexport { BNumberInput };\n\nexport default BNumberInput;\n"],"sourceRoot":"","file":"index.js"}

1991
node_modules/buetify/lib/components/form/radio/BRadio.d.ts generated vendored Executable file

File diff suppressed because it is too large Load Diff

6
node_modules/buetify/lib/components/form/radio/BRadio.js generated vendored Executable file
View File

@@ -0,0 +1,6 @@
import "../../../../src/components/form/sass/form.sass";
import "../../../../src/components/form/radio/radio.sass";
import { useSelectionControl } from '../shared/useSelectionControl';
export const defineRadio = useSelectionControl('radio', 'radio', 'b-radio', 'b-radio radio');
export const BRadio = defineRadio();
//# sourceMappingURL=BRadio.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/components/form/radio/BRadio.ts"],"names":[],"mappings":"AAAA,OAAO,gDAAP;AACA,OAAO,kDAAP;AACA,SAAS,mBAAT,QAAoC,+BAApC;AAEA,OAAO,MAAM,WAAW,GAAG,mBAAmB,CAAC,OAAD,EAAU,OAAV,EAAmB,SAAnB,EAA8B,eAA9B,CAAvC;AAEP,OAAO,MAAM,MAAM,GAAG,WAAW,EAA1B","sourcesContent":["import '../sass/form.sass';\nimport './radio.sass';\nimport { useSelectionControl } from '../shared/useSelectionControl';\n\nexport const defineRadio = useSelectionControl('radio', 'radio', 'b-radio', 'b-radio radio');\n\nexport const BRadio = defineRadio<unknown>();\n"],"sourceRoot":"","file":"BRadio.js"}

3
node_modules/buetify/lib/components/form/radio/index.d.ts generated vendored Executable file
View File

@@ -0,0 +1,3 @@
import { BRadio, defineRadio } from './BRadio';
export { BRadio, defineRadio };
export default BRadio;

4
node_modules/buetify/lib/components/form/radio/index.js generated vendored Executable file
View File

@@ -0,0 +1,4 @@
import { BRadio, defineRadio } from './BRadio';
export { BRadio, defineRadio };
export default BRadio;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/components/form/radio/index.ts"],"names":[],"mappings":"AAAA,SAAS,MAAT,EAAiB,WAAjB,QAAoC,UAApC;AAEA,SAAS,MAAT,EAAiB,WAAjB;AAEA,eAAe,MAAf","sourcesContent":["import { BRadio, defineRadio } from './BRadio';\n\nexport { BRadio, defineRadio };\n\nexport default BRadio;\n"],"sourceRoot":"","file":"index.js"}

3508
node_modules/buetify/lib/components/form/select/BSelect.d.ts generated vendored Executable file

File diff suppressed because it is too large Load Diff

158
node_modules/buetify/lib/components/form/select/BSelect.js generated vendored Executable file
View File

@@ -0,0 +1,158 @@
import "../../../../src/components/form/sass/form.sass";
import "../../../../src/components/form/select/select.sass";
import { getUseInputPropsDefinition, useInput } from '../../../composables/input/useInput';
import { getEqPropsDefinition } from '../../../composables/shared';
import { DefaultThemePropsDefinition, useTheme } from '../../../composables/theme';
import { extractProp, isBoolean } from '../../../utils/helpers';
import { defineComponent, h, shallowRef, vModelSelect, withDirectives } from 'vue';
export function getBSelectPropsDefinition(eq) {
return { ...getEqPropsDefinition(eq),
...getUseInputPropsDefinition(),
...DefaultThemePropsDefinition,
items: {
type: Array,
required: true
},
isMultiple: {
type: Boolean,
default: false
},
itemKey: {
type: [String, Function]
},
itemText: {
type: [String, Function],
default: 'text'
},
itemValue: {
type: [String, Function],
default: 'value'
},
itemDisabled: {
type: [String, Function],
default: 'isDisabled'
},
displayCount: {
type: [String, Number]
}
};
}
function getControlClasses(isExpanded, hasIcon) {
return {
'is-expanded': isExpanded,
'has-icons-left': hasIcon
};
}
function isMultiple(props, input) {
return props.isMultiple || props.isMultiple === undefined && Array.isArray(input.modelValue.value);
}
function isEmpty(val) {
return val === null || val === undefined || Array.isArray(val) && val.length === 0;
}
function getSelectClasses(props, input) {
return [input.size.value, input.messageVariant.value, {
'is-fullwidth': input.isFullwidth.value,
'is-loading': props.isLoading,
'is-multiple': isMultiple(props, input),
'is-rounded': props.isRounded,
'is-empty': isEmpty(input.modelValue.value)
}];
}
function generatePlaceholder(props, context) {
return h('option', {
value: null,
hidden: true,
disabled: true,
selected: true
}, context.slots.placeholder ? context.slots.placeholder() : props.placeholder);
}
function getIsSelected(props, input) {
return val => {
const equals = props.eq.equals;
const value = input.modelValue.value;
if (value === null || value === undefined) {
return false;
} else if (isMultiple(props, input)) {
return Array.isArray(value) ? value.some(v => equals(v, val)) : false;
} else {
return equals(val, value);
}
};
}
function generateOptions(props, context, input) {
const isSelected = getIsSelected(props, input);
return props.items.map((item, index) => {
const isDisabled = extractProp(props.itemDisabled, item);
return context.slots.option ? context.slots.option({
item,
index
}) : h('option', {
key: props.itemKey ? extractProp(props.itemKey, item) : String(index),
value: extractProp(props.itemValue, item),
disabled: isBoolean(isDisabled) ? isDisabled : !isDisabled,
selected: isSelected(item)
}, context.slots.default ? context.slots.default({
item,
index
}) : extractProp(props.itemText, item));
});
}
function generateSelect(props, context, ref, input, themeClasses) {
const value = input.modelValue.value;
const usePlaceholder = isEmpty(value) && (!!props.placeholder || !!context.slots.placeholder);
return withDirectives(h('select', { ...context.attrs,
ref,
required: props.isRequired,
disabled: props.isDisabled,
size: props.displayCount || null,
multiple: isMultiple(props, input),
class: themeClasses,
onBlur: input.onBlur,
onFocus: input.onFocus,
'onUpdate:modelValue': input.set
}, usePlaceholder ? [generatePlaceholder(props, context), ...generateOptions(props, context, input)] : generateOptions(props, context, input)), [[vModelSelect, value ?? null]]);
}
export function defineSelect(eq) {
return defineComponent({
name: 'b-select',
props: getBSelectPropsDefinition(eq),
setup(props, context) {
const selectRef = shallowRef(null);
const input = useInput(props, selectRef);
const {
themeClasses
} = useTheme(props);
return () => {
const nodes = [h('span', {
class: ['select', ...getSelectClasses(props, input)]
}, [generateSelect(props, context, selectRef, input, themeClasses.value)])];
if (input.icon && input.icon.value) {
nodes.push(h(input.icon.value, {
class: 'is-left',
size: input.size.value
}));
}
return h('div', {
class: ['control', getControlClasses(input.isExpanded.value, !!input.icon)]
}, nodes);
};
}
});
} // eslint-disable-next-line
export const BSelect = defineSelect();
//# sourceMappingURL=BSelect.js.map

File diff suppressed because one or more lines are too long

1
node_modules/buetify/lib/components/form/select/index.d.ts generated vendored Executable file
View File

@@ -0,0 +1 @@
export * from './BSelect';

2
node_modules/buetify/lib/components/form/select/index.js generated vendored Executable file
View File

@@ -0,0 +1,2 @@
export * from './BSelect';
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/components/form/select/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAd","sourcesContent":["export * from './BSelect';\n"],"sourceRoot":"","file":"index.js"}

2
node_modules/buetify/lib/components/form/shared/index.d.ts generated vendored Executable file
View File

@@ -0,0 +1,2 @@
export * from './useSelectionControl';
export * from './types';

3
node_modules/buetify/lib/components/form/shared/index.js generated vendored Executable file
View File

@@ -0,0 +1,3 @@
export * from './useSelectionControl';
export * from './types';
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/components/form/shared/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAd;AACA,cAAc,SAAd","sourcesContent":["export * from './useSelectionControl';\nexport * from './types';\n"],"sourceRoot":"","file":"index.js"}

19
node_modules/buetify/lib/components/form/shared/types.d.ts generated vendored Executable file
View File

@@ -0,0 +1,19 @@
import { FunctionalComponent, ComponentOptions } from 'vue';
declare type Component = FunctionalComponent | ComponentOptions;
export interface InputIcons {
isSuccess: Component;
isDanger: Component;
isWarning: Component;
isInfo: Component;
passwordVisible: Component;
passwordInvisible: Component;
}
export declare const DEFAULT_INPUT_ICONS: InputIcons;
export declare function getInputIcons(icons: Partial<InputIcons>): InputIcons;
export interface NumberInputIcons {
minus: Component;
plus: Component;
}
export declare const DEFAULT_NUMBER_INPUT_ICONS: NumberInputIcons;
export declare function getNumberInputIcons(icons: Partial<NumberInputIcons>): NumberInputIcons;
export {};

24
node_modules/buetify/lib/components/form/shared/types.js generated vendored Executable file
View File

@@ -0,0 +1,24 @@
import { defineAsyncComponent } from 'vue';
export const DEFAULT_INPUT_ICONS = {
isSuccess: defineAsyncComponent(() => import('../../icons/check')),
isDanger: defineAsyncComponent(() => import('../../icons/exclamationCircle')),
isInfo: defineAsyncComponent(() => import('../../icons/infoCircle')),
isWarning: defineAsyncComponent(() => import('../../icons/exclamationTriangle')),
passwordInvisible: defineAsyncComponent(() => import('../../icons/eye')),
passwordVisible: defineAsyncComponent(() => import('../../icons/eyeSlash'))
};
export function getInputIcons(icons) {
return { ...DEFAULT_INPUT_ICONS,
...icons
};
}
export const DEFAULT_NUMBER_INPUT_ICONS = {
minus: defineAsyncComponent(() => import('../../icons/minus')),
plus: defineAsyncComponent(() => import('../../icons/plus'))
};
export function getNumberInputIcons(icons) {
return { ...DEFAULT_NUMBER_INPUT_ICONS,
...icons
};
}
//# sourceMappingURL=types.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/components/form/shared/types.ts"],"names":[],"mappings":"AAAA,SAAgD,oBAAhD,QAA4E,KAA5E;AAaA,OAAO,MAAM,mBAAmB,GAAe;AAC7C,EAAA,SAAS,EAAE,oBAAoB,CAAC,MAAM,OAAO,mBAAP,CAAP,CADc;AAE7C,EAAA,QAAQ,EAAE,oBAAoB,CAAC,MAAM,OAAO,+BAAP,CAAP,CAFe;AAG7C,EAAA,MAAM,EAAE,oBAAoB,CAAC,MAAM,OAAO,wBAAP,CAAP,CAHiB;AAI7C,EAAA,SAAS,EAAE,oBAAoB,CAAC,MAAM,OAAO,iCAAP,CAAP,CAJc;AAK7C,EAAA,iBAAiB,EAAE,oBAAoB,CAAC,MAAM,OAAO,iBAAP,CAAP,CALM;AAM7C,EAAA,eAAe,EAAE,oBAAoB,CAAC,MAAM,OAAO,sBAAP,CAAP;AANQ,CAAxC;AASP,OAAM,SAAU,aAAV,CAAwB,KAAxB,EAAkD;AACtD,SAAO,EACL,GAAG,mBADE;AAEL,OAAG;AAFE,GAAP;AAID;AAOD,OAAO,MAAM,0BAA0B,GAAqB;AAC1D,EAAA,KAAK,EAAE,oBAAoB,CAAC,MAAM,OAAO,mBAAP,CAAP,CAD+B;AAE1D,EAAA,IAAI,EAAE,oBAAoB,CAAC,MAAM,OAAO,kBAAP,CAAP;AAFgC,CAArD;AAKP,OAAM,SAAU,mBAAV,CAA8B,KAA9B,EAA8D;AAClE,SAAO,EACL,GAAG,0BADE;AAEL,OAAG;AAFE,GAAP;AAID","sourcesContent":["import { FunctionalComponent, ComponentOptions, defineAsyncComponent } from 'vue';\n\ntype Component = FunctionalComponent | ComponentOptions;\n\nexport interface InputIcons {\n isSuccess: Component;\n isDanger: Component;\n isWarning: Component;\n isInfo: Component;\n passwordVisible: Component;\n passwordInvisible: Component;\n}\n\nexport const DEFAULT_INPUT_ICONS: InputIcons = {\n isSuccess: defineAsyncComponent(() => import('../../icons/check')),\n isDanger: defineAsyncComponent(() => import('../../icons/exclamationCircle')),\n isInfo: defineAsyncComponent(() => import('../../icons/infoCircle')),\n isWarning: defineAsyncComponent(() => import('../../icons/exclamationTriangle')),\n passwordInvisible: defineAsyncComponent(() => import('../../icons/eye')),\n passwordVisible: defineAsyncComponent(() => import('../../icons/eyeSlash'))\n};\n\nexport function getInputIcons(icons: Partial<InputIcons>): InputIcons {\n return {\n ...DEFAULT_INPUT_ICONS,\n ...icons\n };\n}\n\nexport interface NumberInputIcons {\n minus: Component;\n plus: Component;\n}\n\nexport const DEFAULT_NUMBER_INPUT_ICONS: NumberInputIcons = {\n minus: defineAsyncComponent(() => import('../../icons/minus')),\n plus: defineAsyncComponent(() => import('../../icons/plus'))\n};\n\nexport function getNumberInputIcons(icons: Partial<NumberInputIcons>): NumberInputIcons {\n return {\n ...DEFAULT_NUMBER_INPUT_ICONS,\n ...icons\n };\n}\n"],"sourceRoot":"","file":"types.js"}

View File

@@ -0,0 +1,9 @@
import { PropType } from 'vue';
export declare function useCheckRadioPropsDefinition<T>(): {
value: PropType<T>;
nativeValue: PropType<unknown>;
type: {
type: PropType<string>;
};
};
export declare function useCheckRadio<T>(): void;

View File

@@ -0,0 +1,11 @@
export function useCheckRadioPropsDefinition() {
return {
value: null,
nativeValue: null,
type: {
type: String
}
};
}
export function useCheckRadio() {}
//# sourceMappingURL=useCheckRadio.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/components/form/shared/useCheckRadio.ts"],"names":[],"mappings":"AAEA,OAAM,SAAU,4BAAV,GAAsC;AAC1C,SAAO;AACL,IAAA,KAAK,EAAG,IADH;AAEL,IAAA,WAAW,EAAG,IAFT;AAGL,IAAA,IAAI,EAAE;AACJ,MAAA,IAAI,EAAE;AADF;AAHD,GAAP;AAOD;AAED,OAAM,SAAU,aAAV,GAAuB,CAAQ","sourcesContent":["import { PropType } from 'vue';\r\n\r\nexport function useCheckRadioPropsDefinition<T>() {\r\n return {\r\n value: (null as unknown) as PropType<T>,\r\n nativeValue: (null as unknown) as PropType<unknown>,\r\n type: {\r\n type: String as PropType<string>\r\n }\r\n };\r\n}\r\n\r\nexport function useCheckRadio<T>() {}\r\n"],"sourceRoot":"","file":"useCheckRadio.js"}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,54 @@
import { getUseSelectablePropsDefinition, useSelectionControl as useControl } from '../../../composables/selectionControl/useSelectionControl';
import { defineComponent, shallowRef, h } from 'vue';
function generateCheck(variant) {
return h('span', {
class: [variant, 'check']
});
}
function generateInput(selectionControl) {
return h('input', {
onChange: selectionControl.onChange,
onBlur: selectionControl.onBlur,
onFocus: selectionControl.onFocus,
...selectionControl.attrs.value
});
}
function generateLabelText(selectionControl, slots) {
return h('span', {
class: 'control-label'
}, slots.default && slots.default());
}
export function useSelectionControl(role, type, name, staticClass) {
return () => defineComponent({
name,
props: getUseSelectablePropsDefinition(),
setup(props, {
slots
}) {
const label = shallowRef(null);
const selection = useControl(props, label, role, type);
return () => {
return h('label', {
class: [staticClass, props.size, {
'is-disabled': selection.isDisabled.value
}],
ref: label,
id: selection.label.labelId.value,
for: selection.label.id.value,
disabled: selection.isDisabled.value || null,
tabindex: selection.isDisabled.value ? -1 : 0,
onKeydown: selection.onKeydown,
onBlur: selection.onBlur,
onClick: selection.onClick
}, [generateInput(selection), generateCheck(props.variant), generateLabelText(selection, slots)]);
};
}
});
}
//# sourceMappingURL=useSelectionControl.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/components/form/shared/useSelectionControl.ts"],"names":[],"mappings":"AAAA,SACE,+BADF,EAIE,mBAAmB,IAAI,UAJzB,QAKO,2DALP;AAOA,SAAS,eAAT,EAA0B,UAA1B,EAA6C,CAA7C,QAAsD,KAAtD;;AAEA,SAAS,aAAT,CAAuB,OAAvB,EAA4C;AAC1C,SAAO,CAAC,CAAC,MAAD,EAAS;AAAE,IAAA,KAAK,EAAE,CAAC,OAAD,EAAU,OAAV;AAAT,GAAT,CAAR;AACD;;AAED,SAAS,aAAT,CAAuB,gBAAvB,EAAyD;AACvD,SAAO,CAAC,CAAC,OAAD,EAAU;AAChB,IAAA,QAAQ,EAAE,gBAAgB,CAAC,QADX;AAEhB,IAAA,MAAM,EAAE,gBAAgB,CAAC,MAFT;AAGhB,IAAA,OAAO,EAAE,gBAAgB,CAAC,OAHV;AAIhB,OAAG,gBAAgB,CAAC,KAAjB,CAAuB;AAJV,GAAV,CAAR;AAMD;;AAED,SAAS,iBAAT,CAA2B,gBAA3B,EAA+D,KAA/D,EAA2E;AACzE,SAAO,CAAC,CACN,MADM,EAEN;AACE,IAAA,KAAK,EAAE;AADT,GAFM,EAKN,KAAK,CAAC,OAAN,IAAiB,KAAK,CAAC,OAAN,EALX,CAAR;AAOD;;AAED,OAAM,SAAU,mBAAV,CAA8B,IAA9B,EAA4C,IAA5C,EAA0D,IAA1D,EAAwE,WAAxE,EAA2F;AAC/F,SAAO,MACL,eAAe,CAAC;AACd,IAAA,IADc;AAEd,IAAA,KAAK,EAAE,+BAA+B,EAFxB;;AAGd,IAAA,KAAK,CAAC,KAAD,EAAQ;AAAE,MAAA;AAAF,KAAR,EAAiB;AACpB,YAAM,KAAK,GAAG,UAAU,CAAE,IAAF,CAAxB;AACA,YAAM,SAAS,GAAG,UAAU,CAAC,KAAD,EAAiC,KAAjC,EAAwC,IAAxC,EAA8C,IAA9C,CAA5B;AACA,aAAO,MAAK;AACV,eAAO,CAAC,CACN,OADM,EAEN;AACE,UAAA,KAAK,EAAE,CAAC,WAAD,EAAc,KAAK,CAAC,IAApB,EAA0B;AAAE,2BAAe,SAAS,CAAC,UAAV,CAAqB;AAAtC,WAA1B,CADT;AAEE,UAAA,GAAG,EAAE,KAFP;AAGE,UAAA,EAAE,EAAE,SAAS,CAAC,KAAV,CAAgB,OAAhB,CAAwB,KAH9B;AAIE,UAAA,GAAG,EAAE,SAAS,CAAC,KAAV,CAAgB,EAAhB,CAAmB,KAJ1B;AAKE,UAAA,QAAQ,EAAE,SAAS,CAAC,UAAV,CAAqB,KAArB,IAA8B,IAL1C;AAME,UAAA,QAAQ,EAAE,SAAS,CAAC,UAAV,CAAqB,KAArB,GAA6B,CAAC,CAA9B,GAAkC,CAN9C;AAOE,UAAA,SAAS,EAAE,SAAS,CAAC,SAPvB;AAQE,UAAA,MAAM,EAAE,SAAS,CAAC,MARpB;AASE,UAAA,OAAO,EAAE,SAAS,CAAC;AATrB,SAFM,EAaN,CAAC,aAAa,CAAC,SAAD,CAAd,EAA2B,aAAa,CAAC,KAAK,CAAC,OAAP,CAAxC,EAAyD,iBAAiB,CAAC,SAAD,EAAY,KAAZ,CAA1E,CAbM,CAAR;AAeD,OAhBD;AAiBD;;AAvBa,GAAD,CADjB;AA0BD","sourcesContent":["import {\n getUseSelectablePropsDefinition,\n SelectionControl,\n UseSelectableProps,\n useSelectionControl as useControl\n} from '../../../composables/selectionControl/useSelectionControl';\nimport { ColorVariant } from '../../../types/ColorVariants';\nimport { defineComponent, shallowRef, Slots, h } from 'vue';\n\nfunction generateCheck(variant: ColorVariant) {\n return h('span', { class: [variant, 'check'] });\n}\n\nfunction generateInput(selectionControl: SelectionControl) {\n return h('input', {\n onChange: selectionControl.onChange,\n onBlur: selectionControl.onBlur,\n onFocus: selectionControl.onFocus,\n ...selectionControl.attrs.value\n });\n}\n\nfunction generateLabelText(selectionControl: SelectionControl, slots: Slots) {\n return h(\n 'span',\n {\n class: 'control-label'\n },\n slots.default && slots.default()\n );\n}\n\nexport function useSelectionControl(role: string, type: string, name: string, staticClass: string) {\n return <T>() =>\n defineComponent({\n name,\n props: getUseSelectablePropsDefinition<T>(),\n setup(props, { slots }) {\n const label = shallowRef((null as unknown) as HTMLElement);\n const selection = useControl(props as UseSelectableProps<T>, label, role, type);\n return () => {\n return h(\n 'label',\n {\n class: [staticClass, props.size, { 'is-disabled': selection.isDisabled.value }],\n ref: label,\n id: selection.label.labelId.value,\n for: selection.label.id.value,\n disabled: selection.isDisabled.value || null,\n tabindex: selection.isDisabled.value ? -1 : 0,\n onKeydown: selection.onKeydown,\n onBlur: selection.onBlur,\n onClick: selection.onClick\n },\n [generateInput(selection), generateCheck(props.variant), generateLabelText(selection, slots)]\n );\n };\n }\n });\n}\n"],"sourceRoot":"","file":"useSelectionControl.js"}

1992
node_modules/buetify/lib/components/form/switch/BSwitch.d.ts generated vendored Executable file

File diff suppressed because it is too large Load Diff

7
node_modules/buetify/lib/components/form/switch/BSwitch.js generated vendored Executable file
View File

@@ -0,0 +1,7 @@
import "../../../../src/sass/helpers/animations.sass";
import "../../../../src/components/form/sass/form.sass";
import "../../../../src/components/form/switch/switch.sass";
import { useSelectionControl } from '../shared/useSelectionControl';
export const defineSwitch = useSelectionControl('switch', 'checkbox', 'b-switch', 'switch');
export const BSwitch = defineSwitch();
//# sourceMappingURL=BSwitch.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/components/form/switch/BSwitch.ts"],"names":[],"mappings":"AAAA,OAAO,8CAAP;AACA,OAAO,gDAAP;AACA,OAAO,oDAAP;AACA,SAAS,mBAAT,QAAoC,+BAApC;AAEA,OAAO,MAAM,YAAY,GAAG,mBAAmB,CAAC,QAAD,EAAW,UAAX,EAAuB,UAAvB,EAAmC,QAAnC,CAAxC;AAEP,OAAO,MAAM,OAAO,GAAG,YAAY,EAA5B","sourcesContent":["import '../../../sass/helpers/animations.sass';\nimport '../sass/form.sass';\nimport './switch.sass';\nimport { useSelectionControl } from '../shared/useSelectionControl';\n\nexport const defineSwitch = useSelectionControl('switch', 'checkbox', 'b-switch', 'switch');\n\nexport const BSwitch = defineSwitch<unknown>();\n"],"sourceRoot":"","file":"BSwitch.js"}

3
node_modules/buetify/lib/components/form/switch/index.d.ts generated vendored Executable file
View File

@@ -0,0 +1,3 @@
import { BSwitch, defineSwitch } from './BSwitch';
export default BSwitch;
export { BSwitch, defineSwitch };

4
node_modules/buetify/lib/components/form/switch/index.js generated vendored Executable file
View File

@@ -0,0 +1,4 @@
import { BSwitch, defineSwitch } from './BSwitch';
export default BSwitch;
export { BSwitch, defineSwitch };
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../../src/components/form/switch/index.ts"],"names":[],"mappings":"AAAA,SAAS,OAAT,EAAkB,YAAlB,QAAsC,WAAtC;AAEA,eAAe,OAAf;AAEA,SAAS,OAAT,EAAkB,YAAlB","sourcesContent":["import { BSwitch, defineSwitch } from './BSwitch';\n\nexport default BSwitch;\n\nexport { BSwitch, defineSwitch };\n"],"sourceRoot":"","file":"index.js"}