@leaflink/stash 42.4.4 → 42.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -3
- package/dist/ActionsDropdown.js +15 -20
- package/dist/ActionsDropdown.js.map +1 -1
- package/dist/AddressSelect.js +34 -45
- package/dist/AddressSelect.js.map +1 -1
- package/dist/Alert.js +58 -57
- package/dist/Alert.js.map +1 -1
- package/dist/AppNavigationItem.js +4 -6
- package/dist/AppNavigationItem.js.map +1 -1
- package/dist/AppTopbar.js +13 -15
- package/dist/AppTopbar.js.map +1 -1
- package/dist/ButtonGroup.js +12 -14
- package/dist/ButtonGroup.js.map +1 -1
- package/dist/CardMedia.js +9 -11
- package/dist/CardMedia.js.map +1 -1
- package/dist/Carousel.js +41 -44
- package/dist/Carousel.js.map +1 -1
- package/dist/Checkbox.js +9 -11
- package/dist/Checkbox.js.map +1 -1
- package/dist/ChevronToggle.js +2 -4
- package/dist/ChevronToggle.js.map +1 -1
- package/dist/Chip.js +4 -6
- package/dist/Chip.js.map +1 -1
- package/dist/ContextSwitcher.js +12 -17
- package/dist/ContextSwitcher.js.map +1 -1
- package/dist/Copy.js +19 -24
- package/dist/Copy.js.map +1 -1
- package/dist/CurrencyInput.js +8 -13
- package/dist/CurrencyInput.js.map +1 -1
- package/dist/DataView.js +48 -59
- package/dist/DataView.js.map +1 -1
- package/dist/DataViewFilters.js +87 -97
- package/dist/DataViewFilters.js.map +1 -1
- package/dist/DataViewSortButton.js +14 -18
- package/dist/DataViewSortButton.js.map +1 -1
- package/dist/DataViewToolbar.js +12 -14
- package/dist/DataViewToolbar.js.map +1 -1
- package/dist/DatePicker.js +2624 -2581
- package/dist/DatePicker.js.map +1 -1
- package/dist/DatePicker.vue.d.ts +19 -0
- package/dist/Dialog.js +6 -9
- package/dist/Dialog.js.map +1 -1
- package/dist/Dropdown.js +15 -20
- package/dist/Dropdown.js.map +1 -1
- package/dist/EmptyState.js +10 -13
- package/dist/EmptyState.js.map +1 -1
- package/dist/Field.js +3 -6
- package/dist/Field.js.map +1 -1
- package/dist/{Field.vue_vue_type_script_setup_true_lang-c864abd3.js → Field.vue_vue_type_script_setup_true_lang-475832fe.js} +2 -2
- package/dist/{Field.vue_vue_type_script_setup_true_lang-c864abd3.js.map → Field.vue_vue_type_script_setup_true_lang-475832fe.js.map} +1 -1
- package/dist/FileUpload.js +27 -30
- package/dist/FileUpload.js.map +1 -1
- package/dist/FilterChip.js +10 -13
- package/dist/FilterChip.js.map +1 -1
- package/dist/FilterDrawerItem.js +5 -8
- package/dist/FilterDrawerItem.js.map +1 -1
- package/dist/FilterDropdown.js +73 -88
- package/dist/FilterDropdown.js.map +1 -1
- package/dist/FilterSelect.js +15 -18
- package/dist/FilterSelect.js.map +1 -1
- package/dist/Filters.js +67 -78
- package/dist/Filters.js.map +1 -1
- package/dist/HttpError.js +4 -7
- package/dist/HttpError.js.map +1 -1
- package/dist/Icon.js +236 -14
- package/dist/Icon.js.map +1 -1
- package/dist/Icon.vue.d.ts +2 -2
- package/dist/Icon.vue_used_vue_type_style_index_0_lang.module-eb359559.js +11 -0
- package/dist/Icon.vue_used_vue_type_style_index_0_lang.module-eb359559.js.map +1 -0
- package/dist/IconLabel.js +4 -6
- package/dist/IconLabel.js.map +1 -1
- package/dist/Illustration.js +6 -8
- package/dist/Illustration.js.map +1 -1
- package/dist/Image.js +39 -49
- package/dist/Image.js.map +1 -1
- package/dist/InlineEdit.js +10 -12
- package/dist/InlineEdit.js.map +1 -1
- package/dist/Input.js +50 -55
- package/dist/Input.js.map +1 -1
- package/dist/InputOptions.js +20 -29
- package/dist/InputOptions.js.map +1 -1
- package/dist/Label.js +1 -4
- package/dist/Label.js.map +1 -1
- package/dist/LicenseChip.js +7 -9
- package/dist/LicenseChip.js.map +1 -1
- package/dist/ListItem.js +11 -13
- package/dist/ListItem.js.map +1 -1
- package/dist/ListView.js +47 -58
- package/dist/ListView.js.map +1 -1
- package/dist/Metric.js +43 -45
- package/dist/Metric.js.map +1 -1
- package/dist/Metric.vue.d.ts +24 -15
- package/dist/Modal.js +16 -19
- package/dist/Modal.js.map +1 -1
- package/dist/Modals.js +16 -26
- package/dist/Modals.js.map +1 -1
- package/dist/ModalsPlugin.js +12 -22
- package/dist/ModalsPlugin.js.map +1 -1
- package/dist/ObfuscateText.js +7 -9
- package/dist/ObfuscateText.js.map +1 -1
- package/dist/PageNavigation.js +25 -29
- package/dist/PageNavigation.js.map +1 -1
- package/dist/Paginate.js +29 -31
- package/dist/Paginate.js.map +1 -1
- package/dist/QuickAction.js +13 -15
- package/dist/QuickAction.js.map +1 -1
- package/dist/RadioGroup.js +86 -89
- package/dist/RadioGroup.js.map +1 -1
- package/dist/SearchBar.js +18 -20
- package/dist/SearchBar.js.map +1 -1
- package/dist/Select.js +13 -23
- package/dist/Select.js.map +1 -1
- package/dist/SelectStatus.js +26 -36
- package/dist/SelectStatus.js.map +1 -1
- package/dist/Step.js +19 -21
- package/dist/Step.js.map +1 -1
- package/dist/Switch.js +8 -10
- package/dist/Switch.js.map +1 -1
- package/dist/Tab.js +25 -30
- package/dist/Tab.js.map +1 -1
- package/dist/Table.js +19 -21
- package/dist/Table.js.map +1 -1
- package/dist/TableCell.js +21 -22
- package/dist/TableCell.js.map +1 -1
- package/dist/TableHeaderCell.js +4 -4
- package/dist/TableHeaderRow.js +7 -9
- package/dist/TableHeaderRow.js.map +1 -1
- package/dist/TableRow.js +22 -24
- package/dist/TableRow.js.map +1 -1
- package/dist/Tabs.js +11 -16
- package/dist/Tabs.js.map +1 -1
- package/dist/{Tabs.vue_vue_type_script_setup_true_lang-ba383fda.js → Tabs.vue_vue_type_script_setup_true_lang-aca4f8b8.js} +3 -3
- package/dist/{Tabs.vue_vue_type_script_setup_true_lang-ba383fda.js.map → Tabs.vue_vue_type_script_setup_true_lang-aca4f8b8.js.map} +1 -1
- package/dist/Textarea.js +10 -13
- package/dist/Textarea.js.map +1 -1
- package/dist/Toast.js +8 -10
- package/dist/Toast.js.map +1 -1
- package/dist/Toasts.js +14 -25
- package/dist/Toasts.js.map +1 -1
- package/dist/ToastsPlugin.js +14 -25
- package/dist/ToastsPlugin.js.map +1 -1
- package/dist/components.css +1 -1
- package/dist/index.js +53 -62
- package/dist/index.js.map +1 -1
- package/dist/locale.js +12 -15
- package/dist/locale.js.map +1 -1
- package/dist/{searchFuzzy-13c124f8.js → searchFuzzy-74a7de1c.js} +2 -2
- package/dist/{searchFuzzy-13c124f8.js.map → searchFuzzy-74a7de1c.js.map} +1 -1
- package/dist/storage.js +6 -11
- package/dist/storage.js.map +1 -1
- package/dist/tooltip.js +21 -26
- package/dist/tooltip.js.map +1 -1
- package/dist/useGoogleMaps.js +91 -226
- package/dist/useGoogleMaps.js.map +1 -1
- package/dist/useModals.js +21 -31
- package/dist/useModals.js.map +1 -1
- package/dist/useSearch.js +17 -22
- package/dist/useSearch.js.map +1 -1
- package/dist/useToasts.js +25 -36
- package/dist/useToasts.js.map +1 -1
- package/dist/useValidation.js +79 -108
- package/dist/useValidation.js.map +1 -1
- package/dist/utils/calculateElementOverflow.js +9 -14
- package/dist/utils/calculateElementOverflow.js.map +1 -1
- package/dist/utils/createQueryString.js +9 -15
- package/dist/utils/createQueryString.js.map +1 -1
- package/dist/utils/helpers.js +46 -59
- package/dist/utils/helpers.js.map +1 -1
- package/dist/utils/i18n.js +17 -20
- package/dist/utils/i18n.js.map +1 -1
- package/dist/utils/searchFuzzy.js +7 -12
- package/dist/utils/searchFuzzy.js.map +1 -1
- package/dist/utils/storage.js +10 -15
- package/dist/utils/storage.js.map +1 -1
- package/dist/viewable.js +26 -34
- package/dist/viewable.js.map +1 -1
- package/package.json +4 -6
- package/dist/Icon.vue_used_vue_type_style_index_0_lang.module-d2507af3.js +0 -243
- package/dist/Icon.vue_used_vue_type_style_index_0_lang.module-d2507af3.js.map +0 -1
- package/dist/_MapCache-65811284.js +0 -188
- package/dist/_MapCache-65811284.js.map +0 -1
- package/dist/_Uint8Array-06e4d083.js +0 -66
- package/dist/_Uint8Array-06e4d083.js.map +0 -1
- package/dist/_baseAssignValue-dd1499b4.js +0 -22
- package/dist/_baseAssignValue-dd1499b4.js.map +0 -1
- package/dist/_baseIsEqual-d594c87f.js +0 -171
- package/dist/_baseIsEqual-d594c87f.js.map +0 -1
- package/dist/_createCompounder-ae01a723.js +0 -245
- package/dist/_createCompounder-ae01a723.js.map +0 -1
- package/dist/_getAllKeys-5e735d41.js +0 -44
- package/dist/_getAllKeys-5e735d41.js.map +0 -1
- package/dist/_getPrototype-3e6fccd6.js +0 -7
- package/dist/_getPrototype-3e6fccd6.js.map +0 -1
- package/dist/_getTag-4db47fa6.js +0 -47
- package/dist/_getTag-4db47fa6.js.map +0 -1
- package/dist/_initCloneObject-161353b9.js +0 -88
- package/dist/_initCloneObject-161353b9.js.map +0 -1
- package/dist/_overArg-6d920d99.js +0 -9
- package/dist/_overArg-6d920d99.js.map +0 -1
- package/dist/capitalize-667d9f60.js +0 -42
- package/dist/capitalize-667d9f60.js.map +0 -1
- package/dist/cloneDeep-5bc375b0.js +0 -146
- package/dist/cloneDeep-5bc375b0.js.map +0 -1
- package/dist/debounce-6aca1ca9.js +0 -86
- package/dist/debounce-6aca1ca9.js.map +0 -1
- package/dist/get-27d90892.js +0 -66
- package/dist/get-27d90892.js.map +0 -1
- package/dist/identity-452d03fd.js +0 -20
- package/dist/identity-452d03fd.js.map +0 -1
- package/dist/isArrayLike-09233e52.js +0 -61
- package/dist/isArrayLike-09233e52.js.map +0 -1
- package/dist/isEmpty-2fbad344.js +0 -23
- package/dist/isEmpty-2fbad344.js.map +0 -1
- package/dist/isEqual-fca467fb.js +0 -8
- package/dist/isEqual-fca467fb.js.map +0 -1
- package/dist/isObjectLike-54341556.js +0 -39
- package/dist/isObjectLike-54341556.js.map +0 -1
- package/dist/isPlainObject-55c7f916.js +0 -16
- package/dist/isPlainObject-55c7f916.js.map +0 -1
- package/dist/merge-b14fad9d.js +0 -124
- package/dist/merge-b14fad9d.js.map +0 -1
- package/dist/toString-7d5bf363.js +0 -29
- package/dist/toString-7d5bf363.js.map +0 -1
- package/dist/uniqueId-847efe53.js +0 -10
- package/dist/uniqueId-847efe53.js.map +0 -1
package/dist/useModals.js
CHANGED
|
@@ -1,49 +1,39 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ref as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import "./isObjectLike-54341556.js";
|
|
6
|
-
import "./_MapCache-65811284.js";
|
|
7
|
-
import "./_baseAssignValue-dd1499b4.js";
|
|
8
|
-
import "./identity-452d03fd.js";
|
|
9
|
-
import "./_initCloneObject-161353b9.js";
|
|
10
|
-
import "./_getPrototype-3e6fccd6.js";
|
|
11
|
-
import "./_overArg-6d920d99.js";
|
|
12
|
-
import "./isPlainObject-55c7f916.js";
|
|
13
|
-
const t = c([]);
|
|
14
|
-
function L() {
|
|
1
|
+
import c from "lodash-es/merge";
|
|
2
|
+
import { ref as f, reactive as p, readonly as a, markRaw as l } from "vue";
|
|
3
|
+
const n = f([]);
|
|
4
|
+
function D() {
|
|
15
5
|
function i(e) {
|
|
16
|
-
!e.name && e.component.name && (e.name = e.component.name), e.component =
|
|
17
|
-
const
|
|
6
|
+
!e.name && e.component.name && (e.name = e.component.name), e.component = l(e.component);
|
|
7
|
+
const t = {
|
|
18
8
|
disableDefaultListeners: !1
|
|
19
9
|
};
|
|
20
|
-
e.options =
|
|
10
|
+
e.options = c({}, t, e.options), n.value.push(e);
|
|
21
11
|
}
|
|
22
|
-
function r({ index: e, name:
|
|
23
|
-
if (e === void 0 && !
|
|
24
|
-
|
|
12
|
+
function r({ index: e, name: t } = {}) {
|
|
13
|
+
if (e === void 0 && !t) {
|
|
14
|
+
n.value.pop();
|
|
25
15
|
return;
|
|
26
16
|
}
|
|
27
17
|
if (e !== void 0) {
|
|
28
|
-
|
|
18
|
+
n.value.splice(e, 1);
|
|
29
19
|
return;
|
|
30
20
|
}
|
|
31
|
-
if (
|
|
32
|
-
const
|
|
33
|
-
if (
|
|
21
|
+
if (t) {
|
|
22
|
+
const o = n.value.findIndex((s) => s.name === t);
|
|
23
|
+
if (o === -1)
|
|
34
24
|
return;
|
|
35
|
-
|
|
25
|
+
n.value.splice(o, 1);
|
|
36
26
|
return;
|
|
37
27
|
}
|
|
38
28
|
}
|
|
39
|
-
function
|
|
40
|
-
|
|
29
|
+
function u() {
|
|
30
|
+
n.value = [];
|
|
41
31
|
}
|
|
42
|
-
return
|
|
32
|
+
return p({
|
|
43
33
|
/**
|
|
44
34
|
* The list of modals that are currently open.
|
|
45
35
|
*/
|
|
46
|
-
active:
|
|
36
|
+
active: a(n),
|
|
47
37
|
/**
|
|
48
38
|
* Opens the given modal.
|
|
49
39
|
*/
|
|
@@ -58,10 +48,10 @@ function L() {
|
|
|
58
48
|
/**
|
|
59
49
|
* Closes all active/open modals.
|
|
60
50
|
*/
|
|
61
|
-
closeAll:
|
|
51
|
+
closeAll: u
|
|
62
52
|
});
|
|
63
53
|
}
|
|
64
54
|
export {
|
|
65
|
-
|
|
55
|
+
D as default
|
|
66
56
|
};
|
|
67
57
|
//# sourceMappingURL=useModals.js.map
|
package/dist/useModals.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useModals.js","sources":["../src/composables/useModals/useModals.ts"],"sourcesContent":["import merge from 'lodash-es/merge';\nimport { Component, markRaw, reactive, readonly, ref } from 'vue';\n\n// Utility type that maps each property of T to unknown, making it compatible with Record<string, unknown>\n// this ensures that the attributes property of the Modal interface can be used with custom types defined downstream\n// while still being compatible with the Record<string, unknown> type\ntype ToRecord<T> = {\n [P in keyof T]: T[P];\n};\n\n// #region modal-interface\nexport interface Modal<TAttributes = Record<string, unknown>> {\n /**\n * Import the modal that you want to use in your component,\n * then pass that to the composable\n */\n component: Component;\n\n /**\n * Optional identifier used to close a modal. The default value is `component.name` (if defined).\n */\n name?: string;\n\n /**\n * Props and listeners to passed through.\n *\n * Listeners need to be formatted as `onEventName`\n */\n attributes?: ToRecord<TAttributes>;\n\n /**\n * Dyanmic slots that you want rendered in the format of\n * { default: 'my slot content' }\n *\n * The Modals component which renders this list passes the value for slots through\n * a html sanitizer to avoid XSS attacks\n */\n slots?: Record<string, string>;\n\n /**\n * Custom options to use for the given modal.\n *\n * If options are not passed in, then useModals will set the following values as defaults\n *\n * {\n * disableDefaultListeners: false\n * }\n */\n options?: {\n disableDefaultListeners?: boolean;\n };\n}\n// #endregion modal-interface\n\ninterface CloseArgs {\n index?: number;\n name?: string;\n}\n\nconst active = ref<Modal[]>([]);\n\nexport default function useModals() {\n // T is the custom interface of the attributes that are passed to the modal\n function open<T>(modal: Modal<T>) {\n if (!modal.name && modal.component.name) {\n modal.name = modal.component.name;\n }\n\n //Prevent vue from making the entire component passed in reactive to avoid unnecessary performance overhead\n modal.component = markRaw(modal.component);\n\n const optionsDefaults: Modal['options'] = {\n disableDefaultListeners: false,\n };\n\n modal.options = merge({}, optionsDefaults, modal.options);\n\n active.value.push(modal);\n }\n\n function close({ index, name }: CloseArgs = {}) {\n if (index === undefined && !name) {\n active.value.pop();\n return;\n }\n\n if (index !== undefined) {\n active.value.splice(index, 1);\n return;\n }\n\n if (name) {\n const index = active.value.findIndex((modal) => modal.name === name);\n\n if (index === -1) return;\n\n active.value.splice(index, 1);\n return;\n }\n }\n\n function closeAll() {\n active.value = [];\n }\n\n return reactive({\n /**\n * The list of modals that are currently open.\n */\n active: readonly(active),\n\n /**\n * Opens the given modal.\n */\n open,\n\n /**\n * Closes a modal.\n * If no arguments are passed, then the top-most modal is closed.\n * If an index is passed, then the modal at that index is closed.\n * If a name is passed, then the modal with that name is closed.\n */\n close,\n\n /**\n * Closes all active/open modals.\n */\n closeAll,\n });\n}\n"],"names":["active","ref","useModals","open","modal","markRaw","optionsDefaults","merge","close","index","name","closeAll","reactive","readonly"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useModals.js","sources":["../src/composables/useModals/useModals.ts"],"sourcesContent":["import merge from 'lodash-es/merge';\nimport { Component, markRaw, reactive, readonly, ref } from 'vue';\n\n// Utility type that maps each property of T to unknown, making it compatible with Record<string, unknown>\n// this ensures that the attributes property of the Modal interface can be used with custom types defined downstream\n// while still being compatible with the Record<string, unknown> type\ntype ToRecord<T> = {\n [P in keyof T]: T[P];\n};\n\n// #region modal-interface\nexport interface Modal<TAttributes = Record<string, unknown>> {\n /**\n * Import the modal that you want to use in your component,\n * then pass that to the composable\n */\n component: Component;\n\n /**\n * Optional identifier used to close a modal. The default value is `component.name` (if defined).\n */\n name?: string;\n\n /**\n * Props and listeners to passed through.\n *\n * Listeners need to be formatted as `onEventName`\n */\n attributes?: ToRecord<TAttributes>;\n\n /**\n * Dyanmic slots that you want rendered in the format of\n * { default: 'my slot content' }\n *\n * The Modals component which renders this list passes the value for slots through\n * a html sanitizer to avoid XSS attacks\n */\n slots?: Record<string, string>;\n\n /**\n * Custom options to use for the given modal.\n *\n * If options are not passed in, then useModals will set the following values as defaults\n *\n * {\n * disableDefaultListeners: false\n * }\n */\n options?: {\n disableDefaultListeners?: boolean;\n };\n}\n// #endregion modal-interface\n\ninterface CloseArgs {\n index?: number;\n name?: string;\n}\n\nconst active = ref<Modal[]>([]);\n\nexport default function useModals() {\n // T is the custom interface of the attributes that are passed to the modal\n function open<T>(modal: Modal<T>) {\n if (!modal.name && modal.component.name) {\n modal.name = modal.component.name;\n }\n\n //Prevent vue from making the entire component passed in reactive to avoid unnecessary performance overhead\n modal.component = markRaw(modal.component);\n\n const optionsDefaults: Modal['options'] = {\n disableDefaultListeners: false,\n };\n\n modal.options = merge({}, optionsDefaults, modal.options);\n\n active.value.push(modal);\n }\n\n function close({ index, name }: CloseArgs = {}) {\n if (index === undefined && !name) {\n active.value.pop();\n return;\n }\n\n if (index !== undefined) {\n active.value.splice(index, 1);\n return;\n }\n\n if (name) {\n const index = active.value.findIndex((modal) => modal.name === name);\n\n if (index === -1) return;\n\n active.value.splice(index, 1);\n return;\n }\n }\n\n function closeAll() {\n active.value = [];\n }\n\n return reactive({\n /**\n * The list of modals that are currently open.\n */\n active: readonly(active),\n\n /**\n * Opens the given modal.\n */\n open,\n\n /**\n * Closes a modal.\n * If no arguments are passed, then the top-most modal is closed.\n * If an index is passed, then the modal at that index is closed.\n * If a name is passed, then the modal with that name is closed.\n */\n close,\n\n /**\n * Closes all active/open modals.\n */\n closeAll,\n });\n}\n"],"names":["active","ref","useModals","open","modal","markRaw","optionsDefaults","merge","close","index","name","closeAll","reactive","readonly"],"mappings":";;AA2DA,MAAMA,IAASC,EAAa,CAAA,CAAE;AAE9B,SAAwBC,IAAY;AAElC,WAASC,EAAQC,GAAiB;AAChC,IAAI,CAACA,EAAM,QAAQA,EAAM,UAAU,SAC3BA,EAAA,OAAOA,EAAM,UAAU,OAIzBA,EAAA,YAAYC,EAAQD,EAAM,SAAS;AAEzC,UAAME,IAAoC;AAAA,MACxC,yBAAyB;AAAA,IAAA;AAG3B,IAAAF,EAAM,UAAUG,EAAM,CAAA,GAAID,GAAiBF,EAAM,OAAO,GAEjDJ,EAAA,MAAM,KAAKI,CAAK;AAAA,EACzB;AAEA,WAASI,EAAM,EAAE,OAAAC,GAAO,MAAAC,EAAK,IAAe,CAAA,GAAI;AAC1C,QAAAD,MAAU,UAAa,CAACC,GAAM;AAChC,MAAAV,EAAO,MAAM;AACb;AAAA,IACF;AAEA,QAAIS,MAAU,QAAW;AAChB,MAAAT,EAAA,MAAM,OAAOS,GAAO,CAAC;AAC5B;AAAA,IACF;AAEA,QAAIC,GAAM;AACFD,YAAAA,IAAQT,EAAO,MAAM,UAAU,CAACI,MAAUA,EAAM,SAASM,CAAI;AAEnE,UAAID,MAAU;AAAI;AAEX,MAAAT,EAAA,MAAM,OAAOS,GAAO,CAAC;AAC5B;AAAA,IACF;AAAA,EACF;AAEA,WAASE,IAAW;AAClB,IAAAX,EAAO,QAAQ;EACjB;AAEA,SAAOY,EAAS;AAAA;AAAA;AAAA;AAAA,IAId,QAAQC,EAASb,CAAM;AAAA;AAAA;AAAA;AAAA,IAKvB,MAAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQA,OAAAK;AAAA;AAAA;AAAA;AAAA,IAKA,UAAAG;AAAA,EAAA,CACD;AACH;"}
|
package/dist/useSearch.js
CHANGED
|
@@ -1,36 +1,31 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { computed as
|
|
3
|
-
import { i as
|
|
1
|
+
import f from "lodash-es/get";
|
|
2
|
+
import { computed as m } from "vue";
|
|
3
|
+
import { i as p, s as l } from "./searchFuzzy-74a7de1c.js";
|
|
4
4
|
import { normalizeText as s } from "./utils/helpers.js";
|
|
5
|
-
import "./isObjectLike-54341556.js";
|
|
6
|
-
import "./toString-7d5bf363.js";
|
|
7
|
-
import "./_MapCache-65811284.js";
|
|
8
5
|
import "./_commonjsHelpers-10dfc225.js";
|
|
9
|
-
import "
|
|
10
|
-
import "
|
|
11
|
-
import "
|
|
12
|
-
import "./capitalize-667d9f60.js";
|
|
13
|
-
import "./_createCompounder-ae01a723.js";
|
|
6
|
+
import "lodash-es/isPlainObject";
|
|
7
|
+
import "lodash-es/camelCase";
|
|
8
|
+
import "lodash-es/isFinite";
|
|
14
9
|
import "./constants.js";
|
|
15
|
-
function
|
|
16
|
-
const a =
|
|
10
|
+
function F({ items: e, fieldNames: o, trackBy: i = "id" }) {
|
|
11
|
+
const a = m(() => {
|
|
17
12
|
const r = {};
|
|
18
|
-
return !
|
|
19
|
-
const
|
|
20
|
-
r[
|
|
13
|
+
return !o || !o.length || e.value.forEach((t) => {
|
|
14
|
+
const u = String(t[i]);
|
|
15
|
+
r[u] = o.map((n) => s(f(t, n.split(".")))).filter(Boolean).join(" ");
|
|
21
16
|
}), r;
|
|
22
17
|
});
|
|
23
|
-
function
|
|
24
|
-
return t != null && t.fuzzy &&
|
|
25
|
-
const
|
|
26
|
-
return a.value[
|
|
18
|
+
function c(r, t) {
|
|
19
|
+
return t != null && t.fuzzy && p(e.value) ? l(r, e.value, { fieldNames: o }) : e.value.filter((u) => {
|
|
20
|
+
const n = String(u[i]);
|
|
21
|
+
return a.value[n].includes(r.trim().toLowerCase());
|
|
27
22
|
});
|
|
28
23
|
}
|
|
29
24
|
return {
|
|
30
|
-
searchFor:
|
|
25
|
+
searchFor: c
|
|
31
26
|
};
|
|
32
27
|
}
|
|
33
28
|
export {
|
|
34
|
-
|
|
29
|
+
F as default
|
|
35
30
|
};
|
|
36
31
|
//# sourceMappingURL=useSearch.js.map
|
package/dist/useSearch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSearch.js","sources":["../src/composables/useSearch/useSearch.ts"],"sourcesContent":["import get from 'lodash-es/get';\nimport { computed } from 'vue';\n\nimport { isListOfObjects } from '../../../types/utils';\nimport { normalizeText } from '../../utils/helpers';\nimport searchFuzzy from '../../utils/searchFuzzy';\nimport { SearchMap, UseSearchArgs } from './useSearch.types';\n\nexport default function useSearch<Item = unknown>({ items, fieldNames, trackBy = 'id' }: UseSearchArgs<Item>) {\n const searchMap = computed<SearchMap>(() => {\n const newSearchMap = {};\n\n if (!fieldNames || !fieldNames.length) {\n return newSearchMap;\n }\n\n items.value.forEach((item) => {\n const itemKey = String(item[trackBy]);\n\n newSearchMap[itemKey] = fieldNames\n .map((fieldName) => {\n return normalizeText(get(item, fieldName.split('.'))); // get the field's value\n })\n .filter(Boolean)\n .join(' ');\n });\n\n return newSearchMap;\n });\n\n /**\n * Filter `items` by the `fieldNames`'s values.\n * @param options.fuzzy - will use fuzzy search if true\n */\n function searchFor(\n searchTerm: string,\n options?: {\n fuzzy?: boolean;\n },\n ): Item[] {\n if (options?.fuzzy && isListOfObjects(items.value)) {\n return searchFuzzy<Item>(searchTerm, items.value, { fieldNames });\n }\n\n return items.value.filter((item) => {\n const itemKey = String(item[trackBy]);\n\n return searchMap.value[itemKey].includes(searchTerm.trim().toLowerCase());\n });\n }\n\n return {\n searchFor,\n };\n}\n\nexport * from './useSearch.types';\n"],"names":["useSearch","items","fieldNames","trackBy","searchMap","computed","newSearchMap","item","itemKey","fieldName","normalizeText","get","searchFor","searchTerm","options","isListOfObjects","searchFuzzy"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useSearch.js","sources":["../src/composables/useSearch/useSearch.ts"],"sourcesContent":["import get from 'lodash-es/get';\nimport { computed } from 'vue';\n\nimport { isListOfObjects } from '../../../types/utils';\nimport { normalizeText } from '../../utils/helpers';\nimport searchFuzzy from '../../utils/searchFuzzy';\nimport { SearchMap, UseSearchArgs } from './useSearch.types';\n\nexport default function useSearch<Item = unknown>({ items, fieldNames, trackBy = 'id' }: UseSearchArgs<Item>) {\n const searchMap = computed<SearchMap>(() => {\n const newSearchMap = {};\n\n if (!fieldNames || !fieldNames.length) {\n return newSearchMap;\n }\n\n items.value.forEach((item) => {\n const itemKey = String(item[trackBy]);\n\n newSearchMap[itemKey] = fieldNames\n .map((fieldName) => {\n return normalizeText(get(item, fieldName.split('.'))); // get the field's value\n })\n .filter(Boolean)\n .join(' ');\n });\n\n return newSearchMap;\n });\n\n /**\n * Filter `items` by the `fieldNames`'s values.\n * @param options.fuzzy - will use fuzzy search if true\n */\n function searchFor(\n searchTerm: string,\n options?: {\n fuzzy?: boolean;\n },\n ): Item[] {\n if (options?.fuzzy && isListOfObjects(items.value)) {\n return searchFuzzy<Item>(searchTerm, items.value, { fieldNames });\n }\n\n return items.value.filter((item) => {\n const itemKey = String(item[trackBy]);\n\n return searchMap.value[itemKey].includes(searchTerm.trim().toLowerCase());\n });\n }\n\n return {\n searchFor,\n };\n}\n\nexport * from './useSearch.types';\n"],"names":["useSearch","items","fieldNames","trackBy","searchMap","computed","newSearchMap","item","itemKey","fieldName","normalizeText","get","searchFor","searchTerm","options","isListOfObjects","searchFuzzy"],"mappings":";;;;;;;;;AAQA,SAAwBA,EAA0B,EAAE,OAAAC,GAAO,YAAAC,GAAY,SAAAC,IAAU,QAA6B;AACtG,QAAAC,IAAYC,EAAoB,MAAM;AAC1C,UAAMC,IAAe,CAAA;AAErB,WAAI,CAACJ,KAAc,CAACA,EAAW,UAIzBD,EAAA,MAAM,QAAQ,CAACM,MAAS;AAC5B,YAAMC,IAAU,OAAOD,EAAKJ,CAAO,CAAC;AAEpC,MAAAG,EAAaE,CAAO,IAAIN,EACrB,IAAI,CAACO,MACGC,EAAcC,EAAIJ,GAAME,EAAU,MAAM,GAAG,CAAC,CAAC,CACrD,EACA,OAAO,OAAO,EACd,KAAK,GAAG;AAAA,IAAA,CACZ,GAEMH;AAAA,EAAA,CACR;AAMQ,WAAAM,EACPC,GACAC,GAGQ;AACR,WAAIA,KAAA,QAAAA,EAAS,SAASC,EAAgBd,EAAM,KAAK,IACxCe,EAAkBH,GAAYZ,EAAM,OAAO,EAAE,YAAAC,GAAY,IAG3DD,EAAM,MAAM,OAAO,CAACM,MAAS;AAClC,YAAMC,IAAU,OAAOD,EAAKJ,CAAO,CAAC;AAE7B,aAAAC,EAAU,MAAMI,CAAO,EAAE,SAASK,EAAW,KAAA,EAAO,YAAA,CAAa;AAAA,IAAA,CACzE;AAAA,EACH;AAEO,SAAA;AAAA,IACL,WAAAD;AAAA,EAAA;AAEJ;"}
|
package/dist/useToasts.js
CHANGED
|
@@ -1,54 +1,43 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import p from "lodash-es/merge";
|
|
2
|
+
import T from "lodash-es/uniqueId";
|
|
3
3
|
import { ref as d, reactive as g, readonly as b } from "vue";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import "./_baseAssignValue-dd1499b4.js";
|
|
9
|
-
import "./identity-452d03fd.js";
|
|
10
|
-
import "./_initCloneObject-161353b9.js";
|
|
11
|
-
import "./_getPrototype-3e6fccd6.js";
|
|
12
|
-
import "./_overArg-6d920d99.js";
|
|
13
|
-
import "./isPlainObject-55c7f916.js";
|
|
14
|
-
import "./toString-7d5bf363.js";
|
|
15
|
-
const h = 5e3, e = d([]);
|
|
16
|
-
function j(m = { timeout: h }) {
|
|
17
|
-
function n(t) {
|
|
18
|
-
e.value = e.value.filter(({ id: r }) => r !== t);
|
|
4
|
+
const h = 5e3, r = d([]);
|
|
5
|
+
function E(c = { timeout: h }) {
|
|
6
|
+
function u(t) {
|
|
7
|
+
r.value = r.value.filter(({ id: e }) => e !== t);
|
|
19
8
|
}
|
|
20
|
-
function
|
|
21
|
-
const
|
|
22
|
-
return
|
|
9
|
+
function n(t, e, v) {
|
|
10
|
+
const i = p({}, c, v), o = T("toast-");
|
|
11
|
+
return r.value.push({ text: t, id: o, status: e }), typeof i.timeout == "number" && setTimeout(() => u(o), Math.abs(i.timeout)), o;
|
|
23
12
|
}
|
|
24
13
|
function s() {
|
|
25
|
-
|
|
14
|
+
r.value = [];
|
|
26
15
|
}
|
|
27
|
-
function
|
|
28
|
-
return
|
|
16
|
+
function f(t, e) {
|
|
17
|
+
return n(t, "error", e);
|
|
29
18
|
}
|
|
30
|
-
function a(t,
|
|
31
|
-
return
|
|
19
|
+
function a(t, e) {
|
|
20
|
+
return n(t, "info", e);
|
|
32
21
|
}
|
|
33
|
-
function
|
|
34
|
-
return
|
|
22
|
+
function m(t, e) {
|
|
23
|
+
return n(t, "success", e);
|
|
35
24
|
}
|
|
36
|
-
function
|
|
37
|
-
return
|
|
25
|
+
function l(t, e) {
|
|
26
|
+
return n(t, "warning", e);
|
|
38
27
|
}
|
|
39
28
|
return g({
|
|
40
29
|
/**
|
|
41
30
|
* The list of toasts that are currently visible.
|
|
42
31
|
*/
|
|
43
|
-
active: b(
|
|
32
|
+
active: b(r),
|
|
44
33
|
/**
|
|
45
34
|
* Removes an active/visible toast.
|
|
46
35
|
*/
|
|
47
|
-
remove:
|
|
36
|
+
remove: u,
|
|
48
37
|
/**
|
|
49
38
|
* Creates a new toast and makes it active/visible.
|
|
50
39
|
*/
|
|
51
|
-
create:
|
|
40
|
+
create: n,
|
|
52
41
|
/**
|
|
53
42
|
* Removes all active/visible toasts.
|
|
54
43
|
*/
|
|
@@ -56,7 +45,7 @@ function j(m = { timeout: h }) {
|
|
|
56
45
|
/**
|
|
57
46
|
* Creates a new "error" toast.
|
|
58
47
|
*/
|
|
59
|
-
error:
|
|
48
|
+
error: f,
|
|
60
49
|
/**
|
|
61
50
|
* Creates a new "info" toast.
|
|
62
51
|
*/
|
|
@@ -64,15 +53,15 @@ function j(m = { timeout: h }) {
|
|
|
64
53
|
/**
|
|
65
54
|
* Creates a new "success" toast.
|
|
66
55
|
*/
|
|
67
|
-
success:
|
|
56
|
+
success: m,
|
|
68
57
|
/**
|
|
69
58
|
* Creates a new "warning" toast.
|
|
70
59
|
*/
|
|
71
|
-
warning:
|
|
60
|
+
warning: l
|
|
72
61
|
});
|
|
73
62
|
}
|
|
74
63
|
export {
|
|
75
64
|
h as DEFAULT_TIMEOUT,
|
|
76
|
-
|
|
65
|
+
E as default
|
|
77
66
|
};
|
|
78
67
|
//# sourceMappingURL=useToasts.js.map
|
package/dist/useToasts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useToasts.js","sources":["../src/composables/useToasts/useToasts.ts"],"sourcesContent":["import merge from 'lodash-es/merge';\nimport uniqueId from 'lodash-es/uniqueId';\nimport { reactive, readonly, ref } from 'vue';\n\nimport { StatusSeverity } from '../../../types/statusLevels';\n\nexport const DEFAULT_TIMEOUT = 5000;\n\nexport type Toast = {\n id: string;\n text: string;\n status: StatusSeverity;\n};\n\nexport type ToastOptions = {\n timeout?: number | boolean;\n};\n\nconst active = ref<Toast[]>([]);\n\nexport default function useToasts(globalOptions: ToastOptions = { timeout: DEFAULT_TIMEOUT }) {\n function remove(toastId: Toast['id']) {\n active.value = active.value.filter(({ id }) => id !== toastId);\n }\n\n function create(text: Toast['text'], status: StatusSeverity, localOptions?: ToastOptions): Toast['id'] {\n const options = merge({}, globalOptions, localOptions);\n\n const id = uniqueId('toast-');\n\n active.value.push({ text, id, status });\n\n if (typeof options.timeout === 'number') {\n setTimeout(() => remove(id), Math.abs(options.timeout));\n }\n\n return id;\n }\n\n function removeAll() {\n active.value = [];\n }\n\n function error(text: string, options?: ToastOptions) {\n return create(text, 'error', options);\n }\n\n function info(text: string, options?: ToastOptions) {\n return create(text, 'info', options);\n }\n\n function success(text: string, options?: ToastOptions) {\n return create(text, 'success', options);\n }\n\n function warning(text: string, options?: ToastOptions) {\n return create(text, 'warning', options);\n }\n\n return reactive({\n /**\n * The list of toasts that are currently visible.\n */\n active: readonly(active),\n\n /**\n * Removes an active/visible toast.\n */\n remove,\n\n /**\n * Creates a new toast and makes it active/visible.\n */\n create,\n\n /**\n * Removes all active/visible toasts.\n */\n removeAll,\n\n /**\n * Creates a new \"error\" toast.\n */\n error,\n\n /**\n * Creates a new \"info\" toast.\n */\n info,\n\n /**\n * Creates a new \"success\" toast.\n */\n success,\n\n /**\n * Creates a new \"warning\" toast.\n */\n warning,\n });\n}\n"],"names":["DEFAULT_TIMEOUT","active","ref","useToasts","globalOptions","remove","toastId","id","create","text","status","localOptions","options","merge","uniqueId","removeAll","error","info","success","warning","reactive","readonly"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useToasts.js","sources":["../src/composables/useToasts/useToasts.ts"],"sourcesContent":["import merge from 'lodash-es/merge';\nimport uniqueId from 'lodash-es/uniqueId';\nimport { reactive, readonly, ref } from 'vue';\n\nimport { StatusSeverity } from '../../../types/statusLevels';\n\nexport const DEFAULT_TIMEOUT = 5000;\n\nexport type Toast = {\n id: string;\n text: string;\n status: StatusSeverity;\n};\n\nexport type ToastOptions = {\n timeout?: number | boolean;\n};\n\nconst active = ref<Toast[]>([]);\n\nexport default function useToasts(globalOptions: ToastOptions = { timeout: DEFAULT_TIMEOUT }) {\n function remove(toastId: Toast['id']) {\n active.value = active.value.filter(({ id }) => id !== toastId);\n }\n\n function create(text: Toast['text'], status: StatusSeverity, localOptions?: ToastOptions): Toast['id'] {\n const options = merge({}, globalOptions, localOptions);\n\n const id = uniqueId('toast-');\n\n active.value.push({ text, id, status });\n\n if (typeof options.timeout === 'number') {\n setTimeout(() => remove(id), Math.abs(options.timeout));\n }\n\n return id;\n }\n\n function removeAll() {\n active.value = [];\n }\n\n function error(text: string, options?: ToastOptions) {\n return create(text, 'error', options);\n }\n\n function info(text: string, options?: ToastOptions) {\n return create(text, 'info', options);\n }\n\n function success(text: string, options?: ToastOptions) {\n return create(text, 'success', options);\n }\n\n function warning(text: string, options?: ToastOptions) {\n return create(text, 'warning', options);\n }\n\n return reactive({\n /**\n * The list of toasts that are currently visible.\n */\n active: readonly(active),\n\n /**\n * Removes an active/visible toast.\n */\n remove,\n\n /**\n * Creates a new toast and makes it active/visible.\n */\n create,\n\n /**\n * Removes all active/visible toasts.\n */\n removeAll,\n\n /**\n * Creates a new \"error\" toast.\n */\n error,\n\n /**\n * Creates a new \"info\" toast.\n */\n info,\n\n /**\n * Creates a new \"success\" toast.\n */\n success,\n\n /**\n * Creates a new \"warning\" toast.\n */\n warning,\n });\n}\n"],"names":["DEFAULT_TIMEOUT","active","ref","useToasts","globalOptions","remove","toastId","id","create","text","status","localOptions","options","merge","uniqueId","removeAll","error","info","success","warning","reactive","readonly"],"mappings":";;;AAMO,MAAMA,IAAkB,KAYzBC,IAASC,EAAa,CAAA,CAAE;AAE9B,SAAwBC,EAAUC,IAA8B,EAAE,SAASJ,KAAmB;AAC5F,WAASK,EAAOC,GAAsB;AAC7B,IAAAL,EAAA,QAAQA,EAAO,MAAM,OAAO,CAAC,EAAE,IAAAM,EAAS,MAAAA,MAAOD,CAAO;AAAA,EAC/D;AAES,WAAAE,EAAOC,GAAqBC,GAAwBC,GAA0C;AACrG,UAAMC,IAAUC,EAAM,CAAC,GAAGT,GAAeO,CAAY,GAE/CJ,IAAKO,EAAS,QAAQ;AAE5B,WAAAb,EAAO,MAAM,KAAK,EAAE,MAAAQ,GAAM,IAAAF,GAAI,QAAAG,GAAQ,GAElC,OAAOE,EAAQ,WAAY,YAClB,WAAA,MAAMP,EAAOE,CAAE,GAAG,KAAK,IAAIK,EAAQ,OAAO,CAAC,GAGjDL;AAAA,EACT;AAEA,WAASQ,IAAY;AACnB,IAAAd,EAAO,QAAQ;EACjB;AAES,WAAAe,EAAMP,GAAcG,GAAwB;AAC5C,WAAAJ,EAAOC,GAAM,SAASG,CAAO;AAAA,EACtC;AAES,WAAAK,EAAKR,GAAcG,GAAwB;AAC3C,WAAAJ,EAAOC,GAAM,QAAQG,CAAO;AAAA,EACrC;AAES,WAAAM,EAAQT,GAAcG,GAAwB;AAC9C,WAAAJ,EAAOC,GAAM,WAAWG,CAAO;AAAA,EACxC;AAES,WAAAO,EAAQV,GAAcG,GAAwB;AAC9C,WAAAJ,EAAOC,GAAM,WAAWG,CAAO;AAAA,EACxC;AAEA,SAAOQ,EAAS;AAAA;AAAA;AAAA;AAAA,IAId,QAAQC,EAASpB,CAAM;AAAA;AAAA;AAAA;AAAA,IAKvB,QAAAI;AAAA;AAAA;AAAA;AAAA,IAKA,QAAAG;AAAA;AAAA;AAAA;AAAA,IAKA,WAAAO;AAAA;AAAA;AAAA;AAAA,IAKA,OAAAC;AAAA;AAAA;AAAA;AAAA,IAKA,MAAAC;AAAA;AAAA;AAAA;AAAA,IAKA,SAAAC;AAAA;AAAA;AAAA;AAAA,IAKA,SAAAC;AAAA,EAAA,CACD;AACH;"}
|
package/dist/useValidation.js
CHANGED
|
@@ -1,155 +1,126 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { toValue as f, computed as c, ref as T, watch as
|
|
4
|
-
import { DECIMAL_PRECISION as
|
|
1
|
+
import O from "lodash-es/debounce";
|
|
2
|
+
import E from "lodash-es/get";
|
|
3
|
+
import { toValue as f, computed as c, ref as T, watch as A, reactive as S, nextTick as w, readonly as N } from "vue";
|
|
4
|
+
import { DECIMAL_PRECISION as D, DEBOUNCE as j } from "./constants.js";
|
|
5
5
|
import { t as d } from "./locale.js";
|
|
6
|
-
import { i as
|
|
7
|
-
import
|
|
8
|
-
import { t as w } from "./toString-7d5bf363.js";
|
|
9
|
-
import "./_MapCache-65811284.js";
|
|
6
|
+
import { i as v } from "./isDefined-2ce6cde4.js";
|
|
7
|
+
import C from "lodash-es/round";
|
|
10
8
|
function q(t) {
|
|
11
9
|
return t && t.constructor && typeof t.constructor.isBuffer == "function" && t.constructor.isBuffer(t);
|
|
12
10
|
}
|
|
13
11
|
function B(t) {
|
|
14
12
|
return t;
|
|
15
13
|
}
|
|
16
|
-
function
|
|
14
|
+
function F(t, e) {
|
|
17
15
|
e = e || {};
|
|
18
|
-
const
|
|
19
|
-
function h
|
|
20
|
-
|
|
21
|
-
const r =
|
|
22
|
-
if (!
|
|
23
|
-
return
|
|
24
|
-
u[
|
|
16
|
+
const a = e.delimiter || ".", i = e.maxDepth, o = e.transformKey || B, u = {};
|
|
17
|
+
function g(h, y, m) {
|
|
18
|
+
m = m || 1, Object.keys(h).forEach(function(b) {
|
|
19
|
+
const r = h[b], V = e.safe && Array.isArray(r), n = Object.prototype.toString.call(r), s = q(r), p = n === "[object Object]" || n === "[object Array]", l = y ? y + a + o(b) : o(b);
|
|
20
|
+
if (!V && !s && p && Object.keys(r).length && (!e.maxDepth || m < i))
|
|
21
|
+
return g(r, l, m + 1);
|
|
22
|
+
u[l] = r;
|
|
25
23
|
});
|
|
26
24
|
}
|
|
27
|
-
return
|
|
25
|
+
return g(t), u;
|
|
28
26
|
}
|
|
29
|
-
function
|
|
27
|
+
function P(t = {}) {
|
|
30
28
|
return {
|
|
31
29
|
name: "email",
|
|
32
30
|
validator(e) {
|
|
33
|
-
return !
|
|
31
|
+
return !v(e) || typeof e == "string" && /^\S+@\S+\.\S+$/.test(e);
|
|
34
32
|
},
|
|
35
33
|
message: t.message || d("ll.validation.email")
|
|
36
34
|
};
|
|
37
35
|
}
|
|
38
|
-
function
|
|
36
|
+
function Y(t) {
|
|
39
37
|
return {
|
|
40
38
|
name: "maxValue",
|
|
41
39
|
validator(e) {
|
|
42
|
-
const
|
|
43
|
-
return !
|
|
40
|
+
const a = f(t.max);
|
|
41
|
+
return !v(e) || Number(e) <= a;
|
|
44
42
|
},
|
|
45
43
|
message: t.message || (() => d("ll.validation.maxValue", { max: String(f(t.max)) }))
|
|
46
44
|
};
|
|
47
45
|
}
|
|
48
|
-
function
|
|
46
|
+
function z(t) {
|
|
49
47
|
return {
|
|
50
48
|
name: "minValue",
|
|
51
49
|
validator(e) {
|
|
52
|
-
const
|
|
53
|
-
return !
|
|
50
|
+
const a = f(t.min);
|
|
51
|
+
return !v(e) || Number(e) >= a;
|
|
54
52
|
},
|
|
55
53
|
message: t.message || (() => d("ll.validation.minValue", { min: String(f(t.min)) }))
|
|
56
54
|
};
|
|
57
55
|
}
|
|
58
|
-
function
|
|
56
|
+
function G(t = {}) {
|
|
59
57
|
return {
|
|
60
58
|
name: "positiveNumber",
|
|
61
59
|
validator(e) {
|
|
62
|
-
return !
|
|
60
|
+
return !v(e) || Number(e) > 0;
|
|
63
61
|
},
|
|
64
62
|
message: t.message || d("ll.validation.positiveNumber")
|
|
65
63
|
};
|
|
66
64
|
}
|
|
67
|
-
|
|
68
|
-
function k(t) {
|
|
69
|
-
if (!t)
|
|
70
|
-
return t === 0 ? t : 0;
|
|
71
|
-
if (t = A(t), t === O || t === -O) {
|
|
72
|
-
var e = t < 0 ? -1 : 1;
|
|
73
|
-
return e * $;
|
|
74
|
-
}
|
|
75
|
-
return t === t ? t : 0;
|
|
76
|
-
}
|
|
77
|
-
function K(t) {
|
|
78
|
-
var e = k(t), o = e % 1;
|
|
79
|
-
return e === e ? o ? e - o : e : 0;
|
|
80
|
-
}
|
|
81
|
-
var _ = R.isFinite, L = Math.min;
|
|
82
|
-
function Y(t) {
|
|
83
|
-
var e = Math[t];
|
|
84
|
-
return function(o, i) {
|
|
85
|
-
if (o = A(o), i = i == null ? 0 : L(K(i), 292), i && _(o)) {
|
|
86
|
-
var a = (w(o) + "e").split("e"), u = e(a[0] + "e" + (+a[1] + i));
|
|
87
|
-
return a = (w(u) + "e").split("e"), +(a[0] + "e" + (+a[1] - i));
|
|
88
|
-
}
|
|
89
|
-
return e(o);
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
var G = Y("round");
|
|
93
|
-
const P = G;
|
|
94
|
-
function ie(t = {}) {
|
|
65
|
+
function H(t = {}) {
|
|
95
66
|
return {
|
|
96
67
|
name: "price",
|
|
97
68
|
validator(e) {
|
|
98
|
-
const
|
|
99
|
-
return !
|
|
69
|
+
const a = Number(e);
|
|
70
|
+
return !v(e) || a !== 1 / 0 && a >= 0 && a === C(a, D.CURRENCY);
|
|
100
71
|
},
|
|
101
72
|
message: t.message || d("ll.validation.price")
|
|
102
73
|
};
|
|
103
74
|
}
|
|
104
|
-
function
|
|
75
|
+
function J(t = {}) {
|
|
105
76
|
return {
|
|
106
77
|
name: "required",
|
|
107
78
|
validator(e) {
|
|
108
|
-
return
|
|
79
|
+
return v(typeof e == "string" ? e.trim() : e);
|
|
109
80
|
},
|
|
110
81
|
message: t.message || d("ll.validation.required")
|
|
111
82
|
};
|
|
112
83
|
}
|
|
113
|
-
function
|
|
84
|
+
function Q(t = {}) {
|
|
114
85
|
return {
|
|
115
86
|
name: "wholeNumber",
|
|
116
87
|
validator(e) {
|
|
117
|
-
return !
|
|
88
|
+
return !v(e) || Number.isInteger(Number(e)) && Number(e) >= 0;
|
|
118
89
|
},
|
|
119
90
|
message: t.message || d("ll.validation.wholeNumber")
|
|
120
91
|
};
|
|
121
92
|
}
|
|
122
|
-
function
|
|
93
|
+
function X({
|
|
123
94
|
rules: t,
|
|
124
95
|
values: e
|
|
125
96
|
}) {
|
|
126
|
-
const i = c(() => Object.keys(
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
},
|
|
130
|
-
|
|
131
|
-
},
|
|
132
|
-
return
|
|
133
|
-
() =>
|
|
97
|
+
const i = c(() => Object.keys(F(t, { safe: !0 }))).value.reduce((n, s) => {
|
|
98
|
+
const p = T(E(f(e), s)), l = (I) => {
|
|
99
|
+
p.value = E(f(e), I);
|
|
100
|
+
}, x = O(() => {
|
|
101
|
+
l(s);
|
|
102
|
+
}, j.FAST);
|
|
103
|
+
return A(
|
|
104
|
+
() => E(f(e), s),
|
|
134
105
|
() => {
|
|
135
|
-
|
|
106
|
+
x();
|
|
136
107
|
}
|
|
137
|
-
), n[s] =
|
|
108
|
+
), n[s] = M({
|
|
138
109
|
fieldName: s,
|
|
139
|
-
fieldValue:
|
|
110
|
+
fieldValue: p,
|
|
140
111
|
flush: () => {
|
|
141
|
-
|
|
112
|
+
x.cancel(), l(s);
|
|
142
113
|
},
|
|
143
|
-
rules:
|
|
114
|
+
rules: E(t, s)
|
|
144
115
|
}), n;
|
|
145
|
-
}, {}),
|
|
146
|
-
return
|
|
116
|
+
}, {}), o = c(() => Object.values(i)), u = c(() => o.value.some((n) => n.errors.length > 0)), g = c(() => o.value.some((n) => n.isTouched)), h = c(() => o.value.filter((n) => n.isDirty));
|
|
117
|
+
return S({
|
|
147
118
|
validate: async function({ preventScroll: n } = {}) {
|
|
148
|
-
if (
|
|
119
|
+
if (o.value.forEach((s) => {
|
|
149
120
|
s.setTouched(!1), s.setTouched(!0);
|
|
150
|
-
}), await
|
|
151
|
-
const s = Object.entries(i).find(([
|
|
152
|
-
|
|
121
|
+
}), await w(), u.value && !n) {
|
|
122
|
+
const s = Object.entries(i).find(([x, I]) => I.errorMessage), p = (s == null ? void 0 : s[0]) || "", l = document == null ? void 0 : document.querySelector(`[name=${p}]`);
|
|
123
|
+
l && l.scrollIntoView({ behavior: "smooth" });
|
|
153
124
|
}
|
|
154
125
|
return !u.value;
|
|
155
126
|
},
|
|
@@ -163,68 +134,68 @@ function me({
|
|
|
163
134
|
i[n].setTouched();
|
|
164
135
|
},
|
|
165
136
|
setAllUntouched: async function() {
|
|
166
|
-
await
|
|
137
|
+
await w(), o.value.forEach((n) => {
|
|
167
138
|
n.setTouched(!1);
|
|
168
139
|
});
|
|
169
140
|
},
|
|
170
141
|
setInitialValues: function(n) {
|
|
171
|
-
|
|
142
|
+
o.value.forEach((s) => {
|
|
172
143
|
s.setInitialValue(n[s.name]);
|
|
173
144
|
});
|
|
174
145
|
},
|
|
175
146
|
fields: i,
|
|
176
|
-
dirtyFields:
|
|
147
|
+
dirtyFields: h,
|
|
177
148
|
hasErrors: u,
|
|
178
|
-
someTouched:
|
|
149
|
+
someTouched: g
|
|
179
150
|
});
|
|
180
151
|
}
|
|
181
|
-
function
|
|
152
|
+
function M({
|
|
182
153
|
fieldName: t,
|
|
183
154
|
fieldValue: e,
|
|
184
|
-
rules:
|
|
155
|
+
rules: a,
|
|
185
156
|
flush: i
|
|
186
157
|
}) {
|
|
187
|
-
const
|
|
158
|
+
const o = T(e.value), u = T(!1), g = c(() => (e.value ?? "") !== (o.value ?? "")), h = c(() => u.value ? a.map((r) => ({
|
|
188
159
|
fieldName: t,
|
|
189
160
|
ruleName: r.name,
|
|
190
161
|
isValid: r.validator(e.value),
|
|
191
162
|
message: typeof r.message == "function" ? r.message(e.value) : r.message
|
|
192
163
|
})) : []), y = c(
|
|
193
|
-
() =>
|
|
164
|
+
() => h.value.filter((r) => !r.isValid).map((r) => ({
|
|
194
165
|
ruleName: r.ruleName,
|
|
195
166
|
message: r.message
|
|
196
167
|
}))
|
|
197
168
|
);
|
|
198
|
-
function
|
|
169
|
+
function m(r = !0) {
|
|
199
170
|
i(), u.value = r;
|
|
200
171
|
}
|
|
201
172
|
function b(r) {
|
|
202
|
-
|
|
173
|
+
o.value = r;
|
|
203
174
|
}
|
|
204
|
-
return
|
|
175
|
+
return S({
|
|
205
176
|
name: t,
|
|
206
|
-
currentValue:
|
|
207
|
-
initialValue:
|
|
208
|
-
isTouched:
|
|
209
|
-
isDirty:
|
|
177
|
+
currentValue: N(e),
|
|
178
|
+
initialValue: N(o),
|
|
179
|
+
isTouched: N(u),
|
|
180
|
+
isDirty: N(g),
|
|
210
181
|
errorMessage: c(() => {
|
|
211
|
-
var r,
|
|
212
|
-
return ((
|
|
182
|
+
var r, V;
|
|
183
|
+
return ((V = (r = y.value) == null ? void 0 : r[0]) == null ? void 0 : V.message) || "";
|
|
213
184
|
}),
|
|
214
185
|
errors: y,
|
|
215
186
|
setInitialValue: b,
|
|
216
|
-
setTouched:
|
|
187
|
+
setTouched: m
|
|
217
188
|
});
|
|
218
189
|
}
|
|
219
190
|
export {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
191
|
+
X as default,
|
|
192
|
+
P as email,
|
|
193
|
+
v as isDefined,
|
|
194
|
+
Y as maxValue,
|
|
195
|
+
z as minValue,
|
|
196
|
+
G as positiveNumber,
|
|
197
|
+
H as price,
|
|
198
|
+
J as required,
|
|
199
|
+
Q as wholeNumber
|
|
229
200
|
};
|
|
230
201
|
//# sourceMappingURL=useValidation.js.map
|