@vuetify/nightly 3.7.4-master.2024-11-20 → 3.7.4-master.2024-11-28
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/dist/json/attributes.json +3082 -3082
- package/dist/json/importMap-labs.json +12 -12
- package/dist/json/importMap.json +180 -180
- package/dist/json/web-types.json +5654 -5654
- package/dist/vuetify-labs.css +3265 -3265
- package/dist/vuetify-labs.d.ts +199 -199
- package/dist/vuetify-labs.esm.js +45 -42
- package/dist/vuetify-labs.esm.js.map +1 -1
- package/dist/vuetify-labs.js +45 -42
- package/dist/vuetify-labs.min.css +2 -2
- package/dist/vuetify.css +919 -919
- package/dist/vuetify.d.ts +188 -188
- package/dist/vuetify.esm.js +42 -39
- package/dist/vuetify.esm.js.map +1 -1
- package/dist/vuetify.js +42 -39
- package/dist/vuetify.js.map +1 -1
- package/dist/vuetify.min.css +2 -2
- package/dist/vuetify.min.js +26 -25
- package/dist/vuetify.min.js.map +1 -1
- package/lib/components/VAutocomplete/VAutocomplete.mjs +4 -4
- package/lib/components/VAutocomplete/VAutocomplete.mjs.map +1 -1
- package/lib/components/VAutocomplete/index.d.mts +28 -28
- package/lib/components/VChip/VChip.mjs +1 -1
- package/lib/components/VChip/VChip.mjs.map +1 -1
- package/lib/components/VChip/index.d.mts +9 -9
- package/lib/components/VCombobox/VCombobox.mjs +4 -4
- package/lib/components/VCombobox/VCombobox.mjs.map +1 -1
- package/lib/components/VCombobox/index.d.mts +28 -28
- package/lib/components/VDatePicker/VDatePickerHeader.mjs +2 -1
- package/lib/components/VDatePicker/VDatePickerHeader.mjs.map +1 -1
- package/lib/components/VDatePicker/index.d.mts +6 -6
- package/lib/components/VList/VList.mjs +3 -2
- package/lib/components/VList/VList.mjs.map +1 -1
- package/lib/components/VList/index.d.mts +12 -12
- package/lib/components/VSelect/VSelect.mjs +3 -3
- package/lib/components/VSelect/VSelect.mjs.map +1 -1
- package/lib/components/VSelect/index.d.mts +28 -28
- package/lib/components/VStepper/VStepper.mjs +5 -4
- package/lib/components/VStepper/VStepper.mjs.map +1 -1
- package/lib/components/VStepper/VStepperItem.mjs +5 -4
- package/lib/components/VStepper/VStepperItem.mjs.map +1 -1
- package/lib/components/VStepper/index.d.mts +58 -52
- package/lib/components/index.d.mts +126 -126
- package/lib/composables/form.mjs +7 -2
- package/lib/composables/form.mjs.map +1 -1
- package/lib/composables/validation.mjs +10 -12
- package/lib/composables/validation.mjs.map +1 -1
- package/lib/entry-bundler.mjs +1 -1
- package/lib/framework.mjs +1 -1
- package/lib/index.d.mts +62 -62
- package/lib/labs/VNumberInput/VNumberInput.mjs +3 -3
- package/lib/labs/VNumberInput/VNumberInput.mjs.map +1 -1
- package/lib/labs/VStepperVertical/index.d.mts +51 -51
- package/lib/labs/VTreeview/index.d.mts +22 -22
- package/lib/labs/components.d.mts +73 -73
- package/package.json +1 -1
package/lib/composables/form.mjs
CHANGED
@@ -123,7 +123,12 @@ export function createForm(props) {
|
|
123
123
|
resetValidation
|
124
124
|
};
|
125
125
|
}
|
126
|
-
export function useForm() {
|
127
|
-
|
126
|
+
export function useForm(props) {
|
127
|
+
const form = inject(FormKey, null);
|
128
|
+
return {
|
129
|
+
...form,
|
130
|
+
isReadonly: computed(() => !!(props?.readonly ?? form?.isReadonly.value)),
|
131
|
+
isDisabled: computed(() => !!(props?.disabled ?? form?.isDisabled.value))
|
132
|
+
};
|
128
133
|
}
|
129
134
|
//# sourceMappingURL=form.mjs.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"form.mjs","names":["useProxiedModel","computed","inject","markRaw","provide","ref","shallowRef","toRef","watch","consoleWarn","propsFactory","FormKey","Symbol","for","makeFormProps","disabled","Boolean","fastFail","readonly","modelValue","type","default","validateOn","String","createForm","props","model","isDisabled","isReadonly","isValidating","items","errors","validate","results","valid","value","item","itemErrorMessages","length","push","id","errorMessages","reset","forEach","resetValidation","invalid","isValid","deep","flush","register","_ref","vm","some","unregister","filter","update","found","find","useForm"],"sources":["../../src/composables/form.ts"],"sourcesContent":["// Composables\nimport { useProxiedModel } from '@/composables/proxiedModel'\n\n// Utilities\nimport { computed, inject, markRaw, provide, ref, shallowRef, toRef, watch } from 'vue'\nimport { consoleWarn, propsFactory } from '@/util'\n\n// Types\nimport type { ComponentInternalInstance, ComputedRef, InjectionKey, PropType, Raw, Ref } from 'vue'\nimport type { ValidationProps } from './validation'\nimport type { EventProp } from '@/util'\n\nexport interface FormProvide {\n register: (item: {\n id: number | string\n vm: ComponentInternalInstance\n validate: () => Promise<string[]>\n reset: () => Promise<void>\n resetValidation: () => Promise<void>\n }) => void\n unregister: (id: number | string) => void\n update: (id: number | string, isValid: boolean | null, errorMessages: string[]) => void\n items: Ref<FormField[]>\n isDisabled: ComputedRef<boolean>\n isReadonly: ComputedRef<boolean>\n isValidating: Ref<boolean>\n isValid: Ref<boolean | null>\n validateOn: Ref<FormProps['validateOn']>\n}\n\nexport interface FormField {\n id: number | string\n validate: () => Promise<string[]>\n reset: () => Promise<void>\n resetValidation: () => Promise<void>\n vm: Raw<ComponentInternalInstance>\n isValid: boolean | null\n errorMessages: string[]\n}\n\nexport interface FieldValidationResult {\n id: number | string\n errorMessages: string[]\n}\n\nexport interface FormValidationResult {\n valid: boolean\n errors: FieldValidationResult[]\n}\n\nexport interface SubmitEventPromise extends SubmitEvent, Promise<FormValidationResult> {}\n\nexport const FormKey: InjectionKey<FormProvide> = Symbol.for('vuetify:form')\n\nexport interface FormProps {\n disabled: boolean\n fastFail: boolean\n readonly: boolean\n modelValue: boolean | null\n 'onUpdate:modelValue': EventProp<[boolean | null]> | undefined\n validateOn: ValidationProps['validateOn']\n}\n\nexport const makeFormProps = propsFactory({\n disabled: Boolean,\n fastFail: Boolean,\n readonly: Boolean,\n modelValue: {\n type: Boolean as PropType<boolean | null>,\n default: null,\n },\n validateOn: {\n type: String as PropType<FormProps['validateOn']>,\n default: 'input',\n },\n}, 'form')\n\nexport function createForm (props: FormProps) {\n const model = useProxiedModel(props, 'modelValue')\n\n const isDisabled = computed(() => props.disabled)\n const isReadonly = computed(() => props.readonly)\n const isValidating = shallowRef(false)\n const items = ref<FormField[]>([])\n const errors = ref<FieldValidationResult[]>([])\n\n async function validate () {\n const results = []\n let valid = true\n\n errors.value = []\n isValidating.value = true\n\n for (const item of items.value) {\n const itemErrorMessages = await item.validate()\n\n if (itemErrorMessages.length > 0) {\n valid = false\n\n results.push({\n id: item.id,\n errorMessages: itemErrorMessages,\n })\n }\n\n if (!valid && props.fastFail) break\n }\n\n errors.value = results\n isValidating.value = false\n\n return { valid, errors: errors.value }\n }\n\n function reset () {\n items.value.forEach(item => item.reset())\n }\n\n function resetValidation () {\n items.value.forEach(item => item.resetValidation())\n }\n\n watch(items, () => {\n let valid = 0\n let invalid = 0\n const results = []\n\n for (const item of items.value) {\n if (item.isValid === false) {\n invalid++\n results.push({\n id: item.id,\n errorMessages: item.errorMessages,\n })\n } else if (item.isValid === true) valid++\n }\n\n errors.value = results\n model.value =\n invalid > 0 ? false\n : valid === items.value.length ? true\n : null\n }, { deep: true, flush: 'post' })\n\n provide(FormKey, {\n register: ({ id, vm, validate, reset, resetValidation }) => {\n if (items.value.some(item => item.id === id)) {\n consoleWarn(`Duplicate input name \"${id}\"`)\n }\n\n items.value.push({\n id,\n validate,\n reset,\n resetValidation,\n vm: markRaw(vm),\n isValid: null,\n errorMessages: [],\n })\n },\n unregister: id => {\n items.value = items.value.filter(item => {\n return item.id !== id\n })\n },\n update: (id, isValid, errorMessages) => {\n const found = items.value.find(item => item.id === id)\n\n if (!found) return\n\n found.isValid = isValid\n found.errorMessages = errorMessages\n },\n isDisabled,\n isReadonly,\n isValidating,\n isValid: model,\n items,\n validateOn: toRef(props, 'validateOn'),\n })\n\n return {\n errors,\n isDisabled,\n isReadonly,\n isValidating,\n isValid: model,\n items,\n validate,\n reset,\n resetValidation,\n }\n}\n\nexport function useForm () {\n
|
1
|
+
{"version":3,"file":"form.mjs","names":["useProxiedModel","computed","inject","markRaw","provide","ref","shallowRef","toRef","watch","consoleWarn","propsFactory","FormKey","Symbol","for","makeFormProps","disabled","Boolean","fastFail","readonly","modelValue","type","default","validateOn","String","createForm","props","model","isDisabled","isReadonly","isValidating","items","errors","validate","results","valid","value","item","itemErrorMessages","length","push","id","errorMessages","reset","forEach","resetValidation","invalid","isValid","deep","flush","register","_ref","vm","some","unregister","filter","update","found","find","useForm","form"],"sources":["../../src/composables/form.ts"],"sourcesContent":["// Composables\nimport { useProxiedModel } from '@/composables/proxiedModel'\n\n// Utilities\nimport { computed, inject, markRaw, provide, ref, shallowRef, toRef, watch } from 'vue'\nimport { consoleWarn, propsFactory } from '@/util'\n\n// Types\nimport type { ComponentInternalInstance, ComputedRef, InjectionKey, PropType, Raw, Ref } from 'vue'\nimport type { ValidationProps } from './validation'\nimport type { EventProp } from '@/util'\n\nexport interface FormProvide {\n register: (item: {\n id: number | string\n vm: ComponentInternalInstance\n validate: () => Promise<string[]>\n reset: () => Promise<void>\n resetValidation: () => Promise<void>\n }) => void\n unregister: (id: number | string) => void\n update: (id: number | string, isValid: boolean | null, errorMessages: string[]) => void\n items: Ref<FormField[]>\n isDisabled: ComputedRef<boolean>\n isReadonly: ComputedRef<boolean>\n isValidating: Ref<boolean>\n isValid: Ref<boolean | null>\n validateOn: Ref<FormProps['validateOn']>\n}\n\nexport interface FormField {\n id: number | string\n validate: () => Promise<string[]>\n reset: () => Promise<void>\n resetValidation: () => Promise<void>\n vm: Raw<ComponentInternalInstance>\n isValid: boolean | null\n errorMessages: string[]\n}\n\nexport interface FieldValidationResult {\n id: number | string\n errorMessages: string[]\n}\n\nexport interface FormValidationResult {\n valid: boolean\n errors: FieldValidationResult[]\n}\n\nexport interface SubmitEventPromise extends SubmitEvent, Promise<FormValidationResult> {}\n\nexport const FormKey: InjectionKey<FormProvide> = Symbol.for('vuetify:form')\n\nexport interface FormProps {\n disabled: boolean\n fastFail: boolean\n readonly: boolean\n modelValue: boolean | null\n 'onUpdate:modelValue': EventProp<[boolean | null]> | undefined\n validateOn: ValidationProps['validateOn']\n}\n\nexport const makeFormProps = propsFactory({\n disabled: Boolean,\n fastFail: Boolean,\n readonly: Boolean,\n modelValue: {\n type: Boolean as PropType<boolean | null>,\n default: null,\n },\n validateOn: {\n type: String as PropType<FormProps['validateOn']>,\n default: 'input',\n },\n}, 'form')\n\nexport function createForm (props: FormProps) {\n const model = useProxiedModel(props, 'modelValue')\n\n const isDisabled = computed(() => props.disabled)\n const isReadonly = computed(() => props.readonly)\n const isValidating = shallowRef(false)\n const items = ref<FormField[]>([])\n const errors = ref<FieldValidationResult[]>([])\n\n async function validate () {\n const results = []\n let valid = true\n\n errors.value = []\n isValidating.value = true\n\n for (const item of items.value) {\n const itemErrorMessages = await item.validate()\n\n if (itemErrorMessages.length > 0) {\n valid = false\n\n results.push({\n id: item.id,\n errorMessages: itemErrorMessages,\n })\n }\n\n if (!valid && props.fastFail) break\n }\n\n errors.value = results\n isValidating.value = false\n\n return { valid, errors: errors.value }\n }\n\n function reset () {\n items.value.forEach(item => item.reset())\n }\n\n function resetValidation () {\n items.value.forEach(item => item.resetValidation())\n }\n\n watch(items, () => {\n let valid = 0\n let invalid = 0\n const results = []\n\n for (const item of items.value) {\n if (item.isValid === false) {\n invalid++\n results.push({\n id: item.id,\n errorMessages: item.errorMessages,\n })\n } else if (item.isValid === true) valid++\n }\n\n errors.value = results\n model.value =\n invalid > 0 ? false\n : valid === items.value.length ? true\n : null\n }, { deep: true, flush: 'post' })\n\n provide(FormKey, {\n register: ({ id, vm, validate, reset, resetValidation }) => {\n if (items.value.some(item => item.id === id)) {\n consoleWarn(`Duplicate input name \"${id}\"`)\n }\n\n items.value.push({\n id,\n validate,\n reset,\n resetValidation,\n vm: markRaw(vm),\n isValid: null,\n errorMessages: [],\n })\n },\n unregister: id => {\n items.value = items.value.filter(item => {\n return item.id !== id\n })\n },\n update: (id, isValid, errorMessages) => {\n const found = items.value.find(item => item.id === id)\n\n if (!found) return\n\n found.isValid = isValid\n found.errorMessages = errorMessages\n },\n isDisabled,\n isReadonly,\n isValidating,\n isValid: model,\n items,\n validateOn: toRef(props, 'validateOn'),\n })\n\n return {\n errors,\n isDisabled,\n isReadonly,\n isValidating,\n isValid: model,\n items,\n validate,\n reset,\n resetValidation,\n }\n}\n\nexport function useForm (props?: { readonly: boolean | null, disabled: boolean | null }) {\n const form = inject(FormKey, null)\n return {\n ...form,\n isReadonly: computed(() => !!(props?.readonly ?? form?.isReadonly.value)),\n isDisabled: computed(() => !!(props?.disabled ?? form?.isDisabled.value)),\n }\n}\n"],"mappings":"AAAA;AAAA,SACSA,eAAe,8BAExB;AACA,SAASC,QAAQ,EAAEC,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAEC,GAAG,EAAEC,UAAU,EAAEC,KAAK,EAAEC,KAAK,QAAQ,KAAK;AAAA,SAC9EC,WAAW,EAAEC,YAAY,6BAElC;AA6CA,OAAO,MAAMC,OAAkC,GAAGC,MAAM,CAACC,GAAG,CAAC,cAAc,CAAC;AAW5E,OAAO,MAAMC,aAAa,GAAGJ,YAAY,CAAC;EACxCK,QAAQ,EAAEC,OAAO;EACjBC,QAAQ,EAAED,OAAO;EACjBE,QAAQ,EAAEF,OAAO;EACjBG,UAAU,EAAE;IACVC,IAAI,EAAEJ,OAAmC;IACzCK,OAAO,EAAE;EACX,CAAC;EACDC,UAAU,EAAE;IACVF,IAAI,EAAEG,MAA2C;IACjDF,OAAO,EAAE;EACX;AACF,CAAC,EAAE,MAAM,CAAC;AAEV,OAAO,SAASG,UAAUA,CAAEC,KAAgB,EAAE;EAC5C,MAAMC,KAAK,GAAG1B,eAAe,CAACyB,KAAK,EAAE,YAAY,CAAC;EAElD,MAAME,UAAU,GAAG1B,QAAQ,CAAC,MAAMwB,KAAK,CAACV,QAAQ,CAAC;EACjD,MAAMa,UAAU,GAAG3B,QAAQ,CAAC,MAAMwB,KAAK,CAACP,QAAQ,CAAC;EACjD,MAAMW,YAAY,GAAGvB,UAAU,CAAC,KAAK,C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QACvC,OAAOA,IAAI,CAACI,EAAE,KAAKA,EAAE;MACvB,CAAC,CAAC;IACJ,CAAC;IACDe,MAAM,EAAEA,CAACf,EAAE,EAAEM,OAAO,EAAEL,aAAa,KAAK;MACtC,MAAMe,KAAK,GAAG1B,KAAK,CAACK,KAAK,CAACsB,IAAI,CAACrB,IAAI,IAAIA,IAAI,CAACI,EAAE,KAAKA,EAAE,CAAC;MAEtD,IAAI,CAACgB,KAAK,EAAE;MAEZA,KAAK,CAACV,OAAO,GAAGA,OAAO;MACvBU,KAAK,CAACf,aAAa,GAAGA,aAAa;IACrC,CAAC;IACDd,UAAU;IACVC,UAAU;IACVC,YAAY;IACZiB,OAAO,EAAEpB,KAAK;IACdI,KAAK;IACLR,UAAU,EAAEf,KAAK,CAACkB,KAAK,EAAE,YAAY;EACvC,CAAC,CAAC;EAEF,OAAO;IACLM,MAAM;IACNJ,UAAU;IACVC,UAAU;IACVC,YAAY;IACZiB,OAAO,EAAEpB,KAAK;IACdI,KAAK;IACLE,QAAQ;IACRU,KAAK;IACLE;EACF,CAAC;AACH;AAEA,OAAO,SAASc,OAAOA,CAAEjC,KAA8D,EAAE;EACvF,MAAMkC,IAAI,GAAGzD,MAAM,CAACS,OAAO,EAAE,IAAI,CAAC;EAClC,OAAO;IACL,GAAGgD,IAAI;IACP/B,UAAU,EAAE3B,QAAQ,CAAC,MAAM,CAAC,EAAEwB,KAAK,EAAEP,QAAQ,IAAIyC,IAAI,EAAE/B,UAAU,CAACO,KAAK,CAAC,CAAC;IACzER,UAAU,EAAE1B,QAAQ,CAAC,MAAM,CAAC,EAAEwB,KAAK,EAAEV,QAAQ,IAAI4C,IAAI,EAAEhC,UAAU,CAACQ,KAAK,CAAC;EAC1E,CAAC;AACH","ignoreList":[]}
|
@@ -39,17 +39,15 @@ export function useValidation(props) {
|
|
39
39
|
let id = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : getUid();
|
40
40
|
const model = useProxiedModel(props, 'modelValue');
|
41
41
|
const validationModel = computed(() => props.validationValue === undefined ? model.value : props.validationValue);
|
42
|
-
const form = useForm();
|
42
|
+
const form = useForm(props);
|
43
43
|
const internalErrorMessages = ref([]);
|
44
44
|
const isPristine = shallowRef(true);
|
45
45
|
const isDirty = computed(() => !!(wrapInArray(model.value === '' ? null : model.value).length || wrapInArray(validationModel.value === '' ? null : validationModel.value).length));
|
46
|
-
const isDisabled = computed(() => !!(props.disabled ?? form?.isDisabled.value));
|
47
|
-
const isReadonly = computed(() => !!(props.readonly ?? form?.isReadonly.value));
|
48
46
|
const errorMessages = computed(() => {
|
49
47
|
return props.errorMessages?.length ? wrapInArray(props.errorMessages).concat(internalErrorMessages.value).slice(0, Math.max(0, +props.maxErrors)) : internalErrorMessages.value;
|
50
48
|
});
|
51
49
|
const validateOn = computed(() => {
|
52
|
-
let value = (props.validateOn ?? form?.
|
50
|
+
let value = (props.validateOn ?? form.validateOn?.value) || 'input';
|
53
51
|
if (value === 'lazy') value = 'input lazy';
|
54
52
|
if (value === 'eager') value = 'input eager';
|
55
53
|
const set = new Set(value?.split(' ') ?? []);
|
@@ -75,14 +73,14 @@ export function useValidation(props) {
|
|
75
73
|
return {
|
76
74
|
[`${name}--error`]: isValid.value === false,
|
77
75
|
[`${name}--dirty`]: isDirty.value,
|
78
|
-
[`${name}--disabled`]: isDisabled.value,
|
79
|
-
[`${name}--readonly`]: isReadonly.value
|
76
|
+
[`${name}--disabled`]: form.isDisabled.value,
|
77
|
+
[`${name}--readonly`]: form.isReadonly.value
|
80
78
|
};
|
81
79
|
});
|
82
80
|
const vm = getCurrentInstance('validation');
|
83
81
|
const uid = computed(() => props.name ?? unref(id));
|
84
82
|
onBeforeMount(() => {
|
85
|
-
form?.
|
83
|
+
form.register?.({
|
86
84
|
id: uid.value,
|
87
85
|
vm,
|
88
86
|
validate,
|
@@ -91,13 +89,13 @@ export function useValidation(props) {
|
|
91
89
|
});
|
92
90
|
});
|
93
91
|
onBeforeUnmount(() => {
|
94
|
-
form?.
|
92
|
+
form.unregister?.(uid.value);
|
95
93
|
});
|
96
94
|
onMounted(async () => {
|
97
95
|
if (!validateOn.value.lazy) {
|
98
96
|
await validate(!validateOn.value.eager);
|
99
97
|
}
|
100
|
-
form?.
|
98
|
+
form.update?.(uid.value, isValid.value, errorMessages.value);
|
101
99
|
});
|
102
100
|
useToggleScope(() => validateOn.value.input || validateOn.value.invalidInput && isValid.value === false, () => {
|
103
101
|
watch(validationModel, () => {
|
@@ -117,7 +115,7 @@ export function useValidation(props) {
|
|
117
115
|
});
|
118
116
|
});
|
119
117
|
watch([isValid, errorMessages], () => {
|
120
|
-
form?.
|
118
|
+
form.update?.(uid.value, isValid.value, errorMessages.value);
|
121
119
|
});
|
122
120
|
async function reset() {
|
123
121
|
model.value = null;
|
@@ -158,8 +156,8 @@ export function useValidation(props) {
|
|
158
156
|
return {
|
159
157
|
errorMessages,
|
160
158
|
isDirty,
|
161
|
-
isDisabled,
|
162
|
-
isReadonly,
|
159
|
+
isDisabled: form.isDisabled,
|
160
|
+
isReadonly: form.isReadonly,
|
163
161
|
isPristine,
|
164
162
|
isValid,
|
165
163
|
isValidating,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"validation.mjs","names":["makeFocusProps","useForm","useProxiedModel","useToggleScope","computed","nextTick","onBeforeMount","onBeforeUnmount","onMounted","ref","shallowRef","unref","watch","getCurrentInstance","getCurrentInstanceName","getUid","propsFactory","wrapInArray","makeValidationProps","disabled","type","Boolean","default","error","errorMessages","Array","String","maxErrors","Number","name","label","readonly","rules","modelValue","validateOn","validationValue","useValidation","props","arguments","length","undefined","id","model","validationModel","value","form","internalErrorMessages","isPristine","isDirty","isDisabled","isReadonly","concat","slice","Math","max","set","Set","split","input","has","blur","invalidInput","lazy","eager","isValid","isValidating","validationClasses","vm","uid","register","validate","reset","resetValidation","unregister","update","focused","unwatch","val","silent","results","rule","handler","result","console","warn","push"],"sources":["../../src/composables/validation.ts"],"sourcesContent":["// Composables\nimport { makeFocusProps } from '@/composables/focus'\nimport { useForm } from '@/composables/form'\nimport { useProxiedModel } from '@/composables/proxiedModel'\nimport { useToggleScope } from '@/composables/toggleScope'\n\n// Utilities\nimport { computed, nextTick, onBeforeMount, onBeforeUnmount, onMounted, ref, shallowRef, unref, watch } from 'vue'\nimport { getCurrentInstance, getCurrentInstanceName, getUid, propsFactory, wrapInArray } from '@/util'\n\n// Types\nimport type { PropType } from 'vue'\nimport type { EventProp, MaybeRef } from '@/util'\n\nexport type ValidationResult = string | boolean\nexport type ValidationRule =\n | ValidationResult\n | PromiseLike<ValidationResult>\n | ((value: any) => ValidationResult)\n | ((value: any) => PromiseLike<ValidationResult>)\n\ntype ValidateOnValue = 'blur' | 'input' | 'submit' | 'invalid-input'\ntype ValidateOn =\n | ValidateOnValue\n | `${ValidateOnValue} lazy`\n | `${ValidateOnValue} eager`\n | `lazy ${ValidateOnValue}`\n | `eager ${ValidateOnValue}`\n | 'lazy'\n | 'eager'\n\nexport interface ValidationProps {\n disabled: boolean | null\n error: boolean\n errorMessages: string | readonly string[] | null\n focused: boolean\n maxErrors: string | number\n name: string | undefined\n label: string | undefined\n readonly: boolean | null\n rules: readonly ValidationRule[]\n modelValue: any\n 'onUpdate:modelValue': EventProp | undefined\n validateOn?: ValidateOn\n validationValue: any\n}\n\nexport const makeValidationProps = propsFactory({\n disabled: {\n type: Boolean as PropType<boolean | null>,\n default: null,\n },\n error: Boolean,\n errorMessages: {\n type: [Array, String] as PropType<string | readonly string[] | null>,\n default: () => ([]),\n },\n maxErrors: {\n type: [Number, String],\n default: 1,\n },\n name: String,\n label: String,\n readonly: {\n type: Boolean as PropType<boolean | null>,\n default: null,\n },\n rules: {\n type: Array as PropType<readonly ValidationRule[]>,\n default: () => ([]),\n },\n modelValue: null,\n validateOn: String as PropType<ValidationProps['validateOn']>,\n validationValue: null,\n\n ...makeFocusProps(),\n}, 'validation')\n\nexport function useValidation (\n props: ValidationProps,\n name = getCurrentInstanceName(),\n id: MaybeRef<string | number> = getUid(),\n) {\n const model = useProxiedModel(props, 'modelValue')\n const validationModel = computed(() => props.validationValue === undefined ? model.value : props.validationValue)\n const form = useForm()\n const internalErrorMessages = ref<string[]>([])\n const isPristine = shallowRef(true)\n const isDirty = computed(() => !!(\n wrapInArray(model.value === '' ? null : model.value).length ||\n wrapInArray(validationModel.value === '' ? null : validationModel.value).length\n ))\n const isDisabled = computed(() => !!(props.disabled ?? form?.isDisabled.value))\n const isReadonly = computed(() => !!(props.readonly ?? form?.isReadonly.value))\n const errorMessages = computed(() => {\n return props.errorMessages?.length\n ? wrapInArray(props.errorMessages).concat(internalErrorMessages.value).slice(0, Math.max(0, +props.maxErrors))\n : internalErrorMessages.value\n })\n const validateOn = computed(() => {\n let value = (props.validateOn ?? form?.validateOn.value) || 'input'\n if (value === 'lazy') value = 'input lazy'\n if (value === 'eager') value = 'input eager'\n const set = new Set(value?.split(' ') ?? [])\n\n return {\n input: set.has('input'),\n blur: set.has('blur') || set.has('input') || set.has('invalid-input'),\n invalidInput: set.has('invalid-input'),\n lazy: set.has('lazy'),\n eager: set.has('eager'),\n }\n })\n const isValid = computed(() => {\n if (props.error || props.errorMessages?.length) return false\n if (!props.rules.length) return true\n if (isPristine.value) {\n return internalErrorMessages.value.length || validateOn.value.lazy ? null : true\n } else {\n return !internalErrorMessages.value.length\n }\n })\n const isValidating = shallowRef(false)\n const validationClasses = computed(() => {\n return {\n [`${name}--error`]: isValid.value === false,\n [`${name}--dirty`]: isDirty.value,\n [`${name}--disabled`]: isDisabled.value,\n [`${name}--readonly`]: isReadonly.value,\n }\n })\n\n const vm = getCurrentInstance('validation')\n const uid = computed(() => props.name ?? unref(id))\n\n onBeforeMount(() => {\n form?.register({\n id: uid.value,\n vm,\n validate,\n reset,\n resetValidation,\n })\n })\n\n onBeforeUnmount(() => {\n form?.unregister(uid.value)\n })\n\n onMounted(async () => {\n if (!validateOn.value.lazy) {\n await validate(!validateOn.value.eager)\n }\n form?.update(uid.value, isValid.value, errorMessages.value)\n })\n\n useToggleScope(() => validateOn.value.input || (validateOn.value.invalidInput && isValid.value === false), () => {\n watch(validationModel, () => {\n if (validationModel.value != null) {\n validate()\n } else if (props.focused) {\n const unwatch = watch(() => props.focused, val => {\n if (!val) validate()\n\n unwatch()\n })\n }\n })\n })\n\n useToggleScope(() => validateOn.value.blur, () => {\n watch(() => props.focused, val => {\n if (!val) validate()\n })\n })\n\n watch([isValid, errorMessages], () => {\n form?.update(uid.value, isValid.value, errorMessages.value)\n })\n\n async function reset () {\n model.value = null\n await nextTick()\n await resetValidation()\n }\n\n async function resetValidation () {\n isPristine.value = true\n if (!validateOn.value.lazy) {\n await validate(!validateOn.value.eager)\n } else {\n internalErrorMessages.value = []\n }\n }\n\n async function validate (silent = false) {\n const results = []\n\n isValidating.value = true\n\n for (const rule of props.rules) {\n if (results.length >= +(props.maxErrors ?? 1)) {\n break\n }\n\n const handler = typeof rule === 'function' ? rule : () => rule\n const result = await handler(validationModel.value)\n\n if (result === true) continue\n\n if (result !== false && typeof result !== 'string') {\n // eslint-disable-next-line no-console\n console.warn(`${result} is not a valid value. Rule functions must return boolean true or a string.`)\n\n continue\n }\n\n results.push(result || '')\n }\n\n internalErrorMessages.value = results\n isValidating.value = false\n isPristine.value = silent\n\n return internalErrorMessages.value\n }\n\n return {\n errorMessages,\n isDirty,\n isDisabled,\n isReadonly,\n isPristine,\n isValid,\n isValidating,\n reset,\n resetValidation,\n validate,\n validationClasses,\n }\n}\n"],"mappings":"AAAA;AAAA,SACSA,cAAc;AAAA,SACdC,OAAO;AAAA,SACPC,eAAe;AAAA,SACfC,cAAc,6BAEvB;AACA,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,aAAa,EAAEC,eAAe,EAAEC,SAAS,EAAEC,GAAG,EAAEC,UAAU,EAAEC,KAAK,EAAEC,KAAK,QAAQ,KAAK;AAAA,SACzGC,kBAAkB,EAAEC,sBAAsB,EAAEC,MAAM,EAAEC,YAAY,EAAEC,WAAW,6BAEtF;AAqCA,OAAO,MAAMC,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AAI;IAEzB,KAAK,MAAMoC,IAAI,IAAI3C,KAAK,CAACL,KAAK,EAAE;MAC9B,IAAI+C,OAAO,CAACxC,MAAM,IAAI,EAAEF,KAAK,CAACV,SAAS,IAAI,CAAC,CAAC,EAAE;QAC7C;MACF;MAEA,MAAMsD,OAAO,GAAG,OAAOD,IAAI,KAAK,UAAU,GAAGA,IAAI,GAAG,MAAMA,IAAI;MAC9D,MAAME,MAAM,GAAG,MAAMD,OAAO,CAACtC,eAAe,CAACC,KAAK,CAAC;MAEnD,IAAIsC,MAAM,KAAK,IAAI,EAAE;MAErB,IAAIA,MAAM,KAAK,KAAK,IAAI,OAAOA,MAAM,KAAK,QAAQ,EAAE;QAClD;QACAC,OAAO,CAACC,IAAI,CAAC,GAAGF,MAAM,6EAA6E,CAAC;QAEpG;MACF;MAEAH,OAAO,CAACM,IAAI,CAACH,MAAM,IAAI,EAAE,CAAC;IAC5B;IAEApC,qBAAqB,CAACF,KAAK,GAAGmC,OAAO;IACrCd,YAAY,CAACrB,KAAK,GAAG,KAAK;IAC1BG,UAAU,CAACH,KAAK,GAAGkC,MAAM;IAEzB,OAAOhC,qBAAqB,CAACF,KAAK;EACpC;EAEA,OAAO;IACLpB,aAAa;IACbwB,OAAO;IACPC,UAAU;IACVC,UAAU;IACVH,UAAU;IACViB,OAAO;IACPC,YAAY;IACZM,KAAK;IACLC,eAAe;IACfF,QAAQ;IACRJ;EACF,CAAC;AACH","ignoreList":[]}
|
1
|
+
{"version":3,"file":"validation.mjs","names":["makeFocusProps","useForm","useProxiedModel","useToggleScope","computed","nextTick","onBeforeMount","onBeforeUnmount","onMounted","ref","shallowRef","unref","watch","getCurrentInstance","getCurrentInstanceName","getUid","propsFactory","wrapInArray","makeValidationProps","disabled","type","Boolean","default","error","errorMessages","Array","String","maxErrors","Number","name","label","readonly","rules","modelValue","validateOn","validationValue","useValidation","props","arguments","length","undefined","id","model","validationModel","value","form","internalErrorMessages","isPristine","isDirty","concat","slice","Math","max","set","Set","split","input","has","blur","invalidInput","lazy","eager","isValid","isValidating","validationClasses","isDisabled","isReadonly","vm","uid","register","validate","reset","resetValidation","unregister","update","focused","unwatch","val","silent","results","rule","handler","result","console","warn","push"],"sources":["../../src/composables/validation.ts"],"sourcesContent":["// Composables\nimport { makeFocusProps } from '@/composables/focus'\nimport { useForm } from '@/composables/form'\nimport { useProxiedModel } from '@/composables/proxiedModel'\nimport { useToggleScope } from '@/composables/toggleScope'\n\n// Utilities\nimport { computed, nextTick, onBeforeMount, onBeforeUnmount, onMounted, ref, shallowRef, unref, watch } from 'vue'\nimport { getCurrentInstance, getCurrentInstanceName, getUid, propsFactory, wrapInArray } from '@/util'\n\n// Types\nimport type { PropType } from 'vue'\nimport type { EventProp, MaybeRef } from '@/util'\n\nexport type ValidationResult = string | boolean\nexport type ValidationRule =\n | ValidationResult\n | PromiseLike<ValidationResult>\n | ((value: any) => ValidationResult)\n | ((value: any) => PromiseLike<ValidationResult>)\n\ntype ValidateOnValue = 'blur' | 'input' | 'submit' | 'invalid-input'\ntype ValidateOn =\n | ValidateOnValue\n | `${ValidateOnValue} lazy`\n | `${ValidateOnValue} eager`\n | `lazy ${ValidateOnValue}`\n | `eager ${ValidateOnValue}`\n | 'lazy'\n | 'eager'\n\nexport interface ValidationProps {\n disabled: boolean | null\n error: boolean\n errorMessages: string | readonly string[] | null\n focused: boolean\n maxErrors: string | number\n name: string | undefined\n label: string | undefined\n readonly: boolean | null\n rules: readonly ValidationRule[]\n modelValue: any\n 'onUpdate:modelValue': EventProp | undefined\n validateOn?: ValidateOn\n validationValue: any\n}\n\nexport const makeValidationProps = propsFactory({\n disabled: {\n type: Boolean as PropType<boolean | null>,\n default: null,\n },\n error: Boolean,\n errorMessages: {\n type: [Array, String] as PropType<string | readonly string[] | null>,\n default: () => ([]),\n },\n maxErrors: {\n type: [Number, String],\n default: 1,\n },\n name: String,\n label: String,\n readonly: {\n type: Boolean as PropType<boolean | null>,\n default: null,\n },\n rules: {\n type: Array as PropType<readonly ValidationRule[]>,\n default: () => ([]),\n },\n modelValue: null,\n validateOn: String as PropType<ValidationProps['validateOn']>,\n validationValue: null,\n\n ...makeFocusProps(),\n}, 'validation')\n\nexport function useValidation (\n props: ValidationProps,\n name = getCurrentInstanceName(),\n id: MaybeRef<string | number> = getUid(),\n) {\n const model = useProxiedModel(props, 'modelValue')\n const validationModel = computed(() => props.validationValue === undefined ? model.value : props.validationValue)\n const form = useForm(props)\n const internalErrorMessages = ref<string[]>([])\n const isPristine = shallowRef(true)\n const isDirty = computed(() => !!(\n wrapInArray(model.value === '' ? null : model.value).length ||\n wrapInArray(validationModel.value === '' ? null : validationModel.value).length\n ))\n const errorMessages = computed(() => {\n return props.errorMessages?.length\n ? wrapInArray(props.errorMessages).concat(internalErrorMessages.value).slice(0, Math.max(0, +props.maxErrors))\n : internalErrorMessages.value\n })\n const validateOn = computed(() => {\n let value = (props.validateOn ?? form.validateOn?.value) || 'input'\n if (value === 'lazy') value = 'input lazy'\n if (value === 'eager') value = 'input eager'\n const set = new Set(value?.split(' ') ?? [])\n\n return {\n input: set.has('input'),\n blur: set.has('blur') || set.has('input') || set.has('invalid-input'),\n invalidInput: set.has('invalid-input'),\n lazy: set.has('lazy'),\n eager: set.has('eager'),\n }\n })\n const isValid = computed(() => {\n if (props.error || props.errorMessages?.length) return false\n if (!props.rules.length) return true\n if (isPristine.value) {\n return internalErrorMessages.value.length || validateOn.value.lazy ? null : true\n } else {\n return !internalErrorMessages.value.length\n }\n })\n const isValidating = shallowRef(false)\n const validationClasses = computed(() => {\n return {\n [`${name}--error`]: isValid.value === false,\n [`${name}--dirty`]: isDirty.value,\n [`${name}--disabled`]: form.isDisabled.value,\n [`${name}--readonly`]: form.isReadonly.value,\n }\n })\n\n const vm = getCurrentInstance('validation')\n const uid = computed(() => props.name ?? unref(id))\n\n onBeforeMount(() => {\n form.register?.({\n id: uid.value,\n vm,\n validate,\n reset,\n resetValidation,\n })\n })\n\n onBeforeUnmount(() => {\n form.unregister?.(uid.value)\n })\n\n onMounted(async () => {\n if (!validateOn.value.lazy) {\n await validate(!validateOn.value.eager)\n }\n form.update?.(uid.value, isValid.value, errorMessages.value)\n })\n\n useToggleScope(() => validateOn.value.input || (validateOn.value.invalidInput && isValid.value === false), () => {\n watch(validationModel, () => {\n if (validationModel.value != null) {\n validate()\n } else if (props.focused) {\n const unwatch = watch(() => props.focused, val => {\n if (!val) validate()\n\n unwatch()\n })\n }\n })\n })\n\n useToggleScope(() => validateOn.value.blur, () => {\n watch(() => props.focused, val => {\n if (!val) validate()\n })\n })\n\n watch([isValid, errorMessages], () => {\n form.update?.(uid.value, isValid.value, errorMessages.value)\n })\n\n async function reset () {\n model.value = null\n await nextTick()\n await resetValidation()\n }\n\n async function resetValidation () {\n isPristine.value = true\n if (!validateOn.value.lazy) {\n await validate(!validateOn.value.eager)\n } else {\n internalErrorMessages.value = []\n }\n }\n\n async function validate (silent = false) {\n const results = []\n\n isValidating.value = true\n\n for (const rule of props.rules) {\n if (results.length >= +(props.maxErrors ?? 1)) {\n break\n }\n\n const handler = typeof rule === 'function' ? rule : () => rule\n const result = await handler(validationModel.value)\n\n if (result === true) continue\n\n if (result !== false && typeof result !== 'string') {\n // eslint-disable-next-line no-console\n console.warn(`${result} is not a valid value. Rule functions must return boolean true or a string.`)\n\n continue\n }\n\n results.push(result || '')\n }\n\n internalErrorMessages.value = results\n isValidating.value = false\n isPristine.value = silent\n\n return internalErrorMessages.value\n }\n\n return {\n errorMessages,\n isDirty,\n isDisabled: form.isDisabled,\n isReadonly: form.isReadonly,\n isPristine,\n isValid,\n isValidating,\n reset,\n resetValidation,\n validate,\n validationClasses,\n }\n}\n"],"mappings":"AAAA;AAAA,SACSA,cAAc;AAAA,SACdC,OAAO;AAAA,SACPC,eAAe;AAAA,SACfC,cAAc,6BAEvB;AACA,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,aAAa,EAAEC,eAAe,EAAEC,SAAS,EAAEC,GAAG,EAAEC,UAAU,EAAEC,KAAK,EA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AEF,KAAK,CAACV,SAAS,IAAI,CAAC,CAAC,EAAE;QAC7C;MACF;MAEA,MAAMsD,OAAO,GAAG,OAAOD,IAAI,KAAK,UAAU,GAAGA,IAAI,GAAG,MAAMA,IAAI;MAC9D,MAAME,MAAM,GAAG,MAAMD,OAAO,CAACtC,eAAe,CAACC,KAAK,CAAC;MAEnD,IAAIsC,MAAM,KAAK,IAAI,EAAE;MAErB,IAAIA,MAAM,KAAK,KAAK,IAAI,OAAOA,MAAM,KAAK,QAAQ,EAAE;QAClD;QACAC,OAAO,CAACC,IAAI,CAAC,GAAGF,MAAM,6EAA6E,CAAC;QAEpG;MACF;MAEAH,OAAO,CAACM,IAAI,CAACH,MAAM,IAAI,EAAE,CAAC;IAC5B;IAEApC,qBAAqB,CAACF,KAAK,GAAGmC,OAAO;IACrChB,YAAY,CAACnB,KAAK,GAAG,KAAK;IAC1BG,UAAU,CAACH,KAAK,GAAGkC,MAAM;IAEzB,OAAOhC,qBAAqB,CAACF,KAAK;EACpC;EAEA,OAAO;IACLpB,aAAa;IACbwB,OAAO;IACPiB,UAAU,EAAEpB,IAAI,CAACoB,UAAU;IAC3BC,UAAU,EAAErB,IAAI,CAACqB,UAAU;IAC3BnB,UAAU;IACVe,OAAO;IACPC,YAAY;IACZQ,KAAK;IACLC,eAAe;IACfF,QAAQ;IACRN;EACF,CAAC;AACH","ignoreList":[]}
|
package/lib/entry-bundler.mjs
CHANGED
@@ -16,7 +16,7 @@ export const createVuetify = function () {
|
|
16
16
|
...options
|
17
17
|
});
|
18
18
|
};
|
19
|
-
export const version = "3.7.4-master.2024-11-
|
19
|
+
export const version = "3.7.4-master.2024-11-28";
|
20
20
|
createVuetify.version = version;
|
21
21
|
export { blueprints, components, directives };
|
22
22
|
export * from "./composables/index.mjs";
|
package/lib/framework.mjs
CHANGED
package/lib/index.d.mts
CHANGED
@@ -486,38 +486,48 @@ declare module 'vue' {
|
|
486
486
|
$children?: VNodeChild
|
487
487
|
}
|
488
488
|
export interface GlobalComponents {
|
489
|
-
|
490
|
-
VAppBarNavIcon: typeof import('vuetify/components')['VAppBarNavIcon']
|
491
|
-
VAppBarTitle: typeof import('vuetify/components')['VAppBarTitle']
|
489
|
+
VApp: typeof import('vuetify/components')['VApp']
|
492
490
|
VAlert: typeof import('vuetify/components')['VAlert']
|
493
491
|
VAlertTitle: typeof import('vuetify/components')['VAlertTitle']
|
494
|
-
VApp: typeof import('vuetify/components')['VApp']
|
495
492
|
VAutocomplete: typeof import('vuetify/components')['VAutocomplete']
|
496
|
-
VBanner: typeof import('vuetify/components')['VBanner']
|
497
|
-
VBannerActions: typeof import('vuetify/components')['VBannerActions']
|
498
|
-
VBannerText: typeof import('vuetify/components')['VBannerText']
|
499
|
-
VBadge: typeof import('vuetify/components')['VBadge']
|
500
493
|
VAvatar: typeof import('vuetify/components')['VAvatar']
|
494
|
+
VAppBar: typeof import('vuetify/components')['VAppBar']
|
495
|
+
VAppBarNavIcon: typeof import('vuetify/components')['VAppBarNavIcon']
|
496
|
+
VAppBarTitle: typeof import('vuetify/components')['VAppBarTitle']
|
497
|
+
VBottomSheet: typeof import('vuetify/components')['VBottomSheet']
|
498
|
+
VBadge: typeof import('vuetify/components')['VBadge']
|
499
|
+
VBtnToggle: typeof import('vuetify/components')['VBtnToggle']
|
500
|
+
VBottomNavigation: typeof import('vuetify/components')['VBottomNavigation']
|
501
501
|
VBreadcrumbs: typeof import('vuetify/components')['VBreadcrumbs']
|
502
502
|
VBreadcrumbsItem: typeof import('vuetify/components')['VBreadcrumbsItem']
|
503
503
|
VBreadcrumbsDivider: typeof import('vuetify/components')['VBreadcrumbsDivider']
|
504
|
-
|
504
|
+
VBanner: typeof import('vuetify/components')['VBanner']
|
505
|
+
VBannerActions: typeof import('vuetify/components')['VBannerActions']
|
506
|
+
VBannerText: typeof import('vuetify/components')['VBannerText']
|
505
507
|
VBtn: typeof import('vuetify/components')['VBtn']
|
506
|
-
|
508
|
+
VBtnGroup: typeof import('vuetify/components')['VBtnGroup']
|
509
|
+
VCheckbox: typeof import('vuetify/components')['VCheckbox']
|
510
|
+
VCheckboxBtn: typeof import('vuetify/components')['VCheckboxBtn']
|
511
|
+
VCarousel: typeof import('vuetify/components')['VCarousel']
|
512
|
+
VCarouselItem: typeof import('vuetify/components')['VCarouselItem']
|
513
|
+
VCombobox: typeof import('vuetify/components')['VCombobox']
|
507
514
|
VCard: typeof import('vuetify/components')['VCard']
|
508
515
|
VCardActions: typeof import('vuetify/components')['VCardActions']
|
509
516
|
VCardItem: typeof import('vuetify/components')['VCardItem']
|
510
517
|
VCardSubtitle: typeof import('vuetify/components')['VCardSubtitle']
|
511
518
|
VCardText: typeof import('vuetify/components')['VCardText']
|
512
519
|
VCardTitle: typeof import('vuetify/components')['VCardTitle']
|
513
|
-
|
514
|
-
VCheckboxBtn: typeof import('vuetify/components')['VCheckboxBtn']
|
515
|
-
VBtnGroup: typeof import('vuetify/components')['VBtnGroup']
|
520
|
+
VChipGroup: typeof import('vuetify/components')['VChipGroup']
|
516
521
|
VChip: typeof import('vuetify/components')['VChip']
|
517
|
-
|
518
|
-
VCarouselItem: typeof import('vuetify/components')['VCarouselItem']
|
519
|
-
VBtnToggle: typeof import('vuetify/components')['VBtnToggle']
|
522
|
+
VColorPicker: typeof import('vuetify/components')['VColorPicker']
|
520
523
|
VCode: typeof import('vuetify/components')['VCode']
|
524
|
+
VDatePicker: typeof import('vuetify/components')['VDatePicker']
|
525
|
+
VDatePickerControls: typeof import('vuetify/components')['VDatePickerControls']
|
526
|
+
VDatePickerHeader: typeof import('vuetify/components')['VDatePickerHeader']
|
527
|
+
VDatePickerMonth: typeof import('vuetify/components')['VDatePickerMonth']
|
528
|
+
VDatePickerMonths: typeof import('vuetify/components')['VDatePickerMonths']
|
529
|
+
VDatePickerYears: typeof import('vuetify/components')['VDatePickerYears']
|
530
|
+
VCounter: typeof import('vuetify/components')['VCounter']
|
521
531
|
VDataTable: typeof import('vuetify/components')['VDataTable']
|
522
532
|
VDataTableHeaders: typeof import('vuetify/components')['VDataTableHeaders']
|
523
533
|
VDataTableFooter: typeof import('vuetify/components')['VDataTableFooter']
|
@@ -525,39 +535,30 @@ declare module 'vue' {
|
|
525
535
|
VDataTableRow: typeof import('vuetify/components')['VDataTableRow']
|
526
536
|
VDataTableVirtual: typeof import('vuetify/components')['VDataTableVirtual']
|
527
537
|
VDataTableServer: typeof import('vuetify/components')['VDataTableServer']
|
528
|
-
VColorPicker: typeof import('vuetify/components')['VColorPicker']
|
529
|
-
VChipGroup: typeof import('vuetify/components')['VChipGroup']
|
530
|
-
VCombobox: typeof import('vuetify/components')['VCombobox']
|
531
|
-
VCounter: typeof import('vuetify/components')['VCounter']
|
532
|
-
VEmptyState: typeof import('vuetify/components')['VEmptyState']
|
533
|
-
VDatePicker: typeof import('vuetify/components')['VDatePicker']
|
534
|
-
VDatePickerControls: typeof import('vuetify/components')['VDatePickerControls']
|
535
|
-
VDatePickerHeader: typeof import('vuetify/components')['VDatePickerHeader']
|
536
|
-
VDatePickerMonth: typeof import('vuetify/components')['VDatePickerMonth']
|
537
|
-
VDatePickerMonths: typeof import('vuetify/components')['VDatePickerMonths']
|
538
|
-
VDatePickerYears: typeof import('vuetify/components')['VDatePickerYears']
|
539
538
|
VDialog: typeof import('vuetify/components')['VDialog']
|
540
|
-
|
541
|
-
VField: typeof import('vuetify/components')['VField']
|
542
|
-
VFieldLabel: typeof import('vuetify/components')['VFieldLabel']
|
539
|
+
VEmptyState: typeof import('vuetify/components')['VEmptyState']
|
543
540
|
VExpansionPanels: typeof import('vuetify/components')['VExpansionPanels']
|
544
541
|
VExpansionPanel: typeof import('vuetify/components')['VExpansionPanel']
|
545
542
|
VExpansionPanelText: typeof import('vuetify/components')['VExpansionPanelText']
|
546
543
|
VExpansionPanelTitle: typeof import('vuetify/components')['VExpansionPanelTitle']
|
544
|
+
VDivider: typeof import('vuetify/components')['VDivider']
|
545
|
+
VFooter: typeof import('vuetify/components')['VFooter']
|
547
546
|
VFab: typeof import('vuetify/components')['VFab']
|
547
|
+
VField: typeof import('vuetify/components')['VField']
|
548
|
+
VFieldLabel: typeof import('vuetify/components')['VFieldLabel']
|
548
549
|
VFileInput: typeof import('vuetify/components')['VFileInput']
|
549
|
-
VFooter: typeof import('vuetify/components')['VFooter']
|
550
|
-
VImg: typeof import('vuetify/components')['VImg']
|
551
|
-
VInfiniteScroll: typeof import('vuetify/components')['VInfiniteScroll']
|
552
|
-
VKbd: typeof import('vuetify/components')['VKbd']
|
553
|
-
VInput: typeof import('vuetify/components')['VInput']
|
554
|
-
VItemGroup: typeof import('vuetify/components')['VItemGroup']
|
555
|
-
VItem: typeof import('vuetify/components')['VItem']
|
556
550
|
VIcon: typeof import('vuetify/components')['VIcon']
|
557
551
|
VComponentIcon: typeof import('vuetify/components')['VComponentIcon']
|
558
552
|
VSvgIcon: typeof import('vuetify/components')['VSvgIcon']
|
559
553
|
VLigatureIcon: typeof import('vuetify/components')['VLigatureIcon']
|
560
554
|
VClassIcon: typeof import('vuetify/components')['VClassIcon']
|
555
|
+
VInfiniteScroll: typeof import('vuetify/components')['VInfiniteScroll']
|
556
|
+
VKbd: typeof import('vuetify/components')['VKbd']
|
557
|
+
VImg: typeof import('vuetify/components')['VImg']
|
558
|
+
VItemGroup: typeof import('vuetify/components')['VItemGroup']
|
559
|
+
VItem: typeof import('vuetify/components')['VItem']
|
560
|
+
VInput: typeof import('vuetify/components')['VInput']
|
561
|
+
VLabel: typeof import('vuetify/components')['VLabel']
|
561
562
|
VList: typeof import('vuetify/components')['VList']
|
562
563
|
VListGroup: typeof import('vuetify/components')['VListGroup']
|
563
564
|
VListImg: typeof import('vuetify/components')['VListImg']
|
@@ -567,72 +568,72 @@ declare module 'vue' {
|
|
567
568
|
VListItemSubtitle: typeof import('vuetify/components')['VListItemSubtitle']
|
568
569
|
VListItemTitle: typeof import('vuetify/components')['VListItemTitle']
|
569
570
|
VListSubheader: typeof import('vuetify/components')['VListSubheader']
|
570
|
-
|
571
|
+
VMessages: typeof import('vuetify/components')['VMessages']
|
571
572
|
VNavigationDrawer: typeof import('vuetify/components')['VNavigationDrawer']
|
572
573
|
VMain: typeof import('vuetify/components')['VMain']
|
573
574
|
VMenu: typeof import('vuetify/components')['VMenu']
|
574
|
-
VMessages: typeof import('vuetify/components')['VMessages']
|
575
575
|
VOtpInput: typeof import('vuetify/components')['VOtpInput']
|
576
576
|
VOverlay: typeof import('vuetify/components')['VOverlay']
|
577
|
-
|
577
|
+
VProgressCircular: typeof import('vuetify/components')['VProgressCircular']
|
578
578
|
VProgressLinear: typeof import('vuetify/components')['VProgressLinear']
|
579
|
+
VPagination: typeof import('vuetify/components')['VPagination']
|
580
|
+
VRating: typeof import('vuetify/components')['VRating']
|
579
581
|
VRadioGroup: typeof import('vuetify/components')['VRadioGroup']
|
580
|
-
VSelect: typeof import('vuetify/components')['VSelect']
|
581
|
-
VProgressCircular: typeof import('vuetify/components')['VProgressCircular']
|
582
582
|
VSelectionControl: typeof import('vuetify/components')['VSelectionControl']
|
583
|
-
VRating: typeof import('vuetify/components')['VRating']
|
584
|
-
VSkeletonLoader: typeof import('vuetify/components')['VSkeletonLoader']
|
585
583
|
VSelectionControlGroup: typeof import('vuetify/components')['VSelectionControlGroup']
|
586
|
-
VSlider: typeof import('vuetify/components')['VSlider']
|
587
584
|
VSheet: typeof import('vuetify/components')['VSheet']
|
588
|
-
|
585
|
+
VSelect: typeof import('vuetify/components')['VSelect']
|
586
|
+
VSlider: typeof import('vuetify/components')['VSlider']
|
589
587
|
VSlideGroup: typeof import('vuetify/components')['VSlideGroup']
|
590
588
|
VSlideGroupItem: typeof import('vuetify/components')['VSlideGroupItem']
|
589
|
+
VSnackbar: typeof import('vuetify/components')['VSnackbar']
|
591
590
|
VStepper: typeof import('vuetify/components')['VStepper']
|
592
591
|
VStepperActions: typeof import('vuetify/components')['VStepperActions']
|
593
592
|
VStepperHeader: typeof import('vuetify/components')['VStepperHeader']
|
594
593
|
VStepperItem: typeof import('vuetify/components')['VStepperItem']
|
595
594
|
VStepperWindow: typeof import('vuetify/components')['VStepperWindow']
|
596
595
|
VStepperWindowItem: typeof import('vuetify/components')['VStepperWindowItem']
|
596
|
+
VSkeletonLoader: typeof import('vuetify/components')['VSkeletonLoader']
|
597
|
+
VSwitch: typeof import('vuetify/components')['VSwitch']
|
597
598
|
VSystemBar: typeof import('vuetify/components')['VSystemBar']
|
598
599
|
VTable: typeof import('vuetify/components')['VTable']
|
599
|
-
|
600
|
+
VTextField: typeof import('vuetify/components')['VTextField']
|
600
601
|
VTab: typeof import('vuetify/components')['VTab']
|
601
602
|
VTabs: typeof import('vuetify/components')['VTabs']
|
602
603
|
VTabsWindow: typeof import('vuetify/components')['VTabsWindow']
|
603
604
|
VTabsWindowItem: typeof import('vuetify/components')['VTabsWindowItem']
|
604
|
-
VTextarea: typeof import('vuetify/components')['VTextarea']
|
605
605
|
VTimeline: typeof import('vuetify/components')['VTimeline']
|
606
606
|
VTimelineItem: typeof import('vuetify/components')['VTimelineItem']
|
607
|
-
|
608
|
-
VWindow: typeof import('vuetify/components')['VWindow']
|
609
|
-
VWindowItem: typeof import('vuetify/components')['VWindowItem']
|
607
|
+
VTextarea: typeof import('vuetify/components')['VTextarea']
|
610
608
|
VToolbar: typeof import('vuetify/components')['VToolbar']
|
611
609
|
VToolbarTitle: typeof import('vuetify/components')['VToolbarTitle']
|
612
610
|
VToolbarItems: typeof import('vuetify/components')['VToolbarItems']
|
613
|
-
|
614
|
-
|
611
|
+
VTooltip: typeof import('vuetify/components')['VTooltip']
|
612
|
+
VWindow: typeof import('vuetify/components')['VWindow']
|
613
|
+
VWindowItem: typeof import('vuetify/components')['VWindowItem']
|
615
614
|
VDataIterator: typeof import('vuetify/components')['VDataIterator']
|
615
|
+
VConfirmEdit: typeof import('vuetify/components')['VConfirmEdit']
|
616
616
|
VDefaultsProvider: typeof import('vuetify/components')['VDefaultsProvider']
|
617
617
|
VContainer: typeof import('vuetify/components')['VContainer']
|
618
618
|
VCol: typeof import('vuetify/components')['VCol']
|
619
619
|
VRow: typeof import('vuetify/components')['VRow']
|
620
620
|
VSpacer: typeof import('vuetify/components')['VSpacer']
|
621
|
-
VForm: typeof import('vuetify/components')['VForm']
|
622
621
|
VHover: typeof import('vuetify/components')['VHover']
|
623
|
-
|
622
|
+
VForm: typeof import('vuetify/components')['VForm']
|
624
623
|
VLayout: typeof import('vuetify/components')['VLayout']
|
625
624
|
VLayoutItem: typeof import('vuetify/components')['VLayoutItem']
|
625
|
+
VLazy: typeof import('vuetify/components')['VLazy']
|
626
626
|
VLocaleProvider: typeof import('vuetify/components')['VLocaleProvider']
|
627
627
|
VNoSsr: typeof import('vuetify/components')['VNoSsr']
|
628
|
-
VRadio: typeof import('vuetify/components')['VRadio']
|
629
628
|
VParallax: typeof import('vuetify/components')['VParallax']
|
630
|
-
VResponsive: typeof import('vuetify/components')['VResponsive']
|
631
|
-
VSpeedDial: typeof import('vuetify/components')['VSpeedDial']
|
632
629
|
VRangeSlider: typeof import('vuetify/components')['VRangeSlider']
|
630
|
+
VRadio: typeof import('vuetify/components')['VRadio']
|
631
|
+
VResponsive: typeof import('vuetify/components')['VResponsive']
|
633
632
|
VSparkline: typeof import('vuetify/components')['VSparkline']
|
633
|
+
VSpeedDial: typeof import('vuetify/components')['VSpeedDial']
|
634
634
|
VThemeProvider: typeof import('vuetify/components')['VThemeProvider']
|
635
635
|
VValidation: typeof import('vuetify/components')['VValidation']
|
636
|
+
VVirtualScroll: typeof import('vuetify/components')['VVirtualScroll']
|
636
637
|
VFabTransition: typeof import('vuetify/components')['VFabTransition']
|
637
638
|
VDialogBottomTransition: typeof import('vuetify/components')['VDialogBottomTransition']
|
638
639
|
VDialogTopTransition: typeof import('vuetify/components')['VDialogTopTransition']
|
@@ -649,7 +650,6 @@ declare module 'vue' {
|
|
649
650
|
VExpandTransition: typeof import('vuetify/components')['VExpandTransition']
|
650
651
|
VExpandXTransition: typeof import('vuetify/components')['VExpandXTransition']
|
651
652
|
VDialogTransition: typeof import('vuetify/components')['VDialogTransition']
|
652
|
-
VVirtualScroll: typeof import('vuetify/components')['VVirtualScroll']
|
653
653
|
VCalendar: typeof import('vuetify/labs/components')['VCalendar']
|
654
654
|
VCalendarDay: typeof import('vuetify/labs/components')['VCalendarDay']
|
655
655
|
VCalendarHeader: typeof import('vuetify/labs/components')['VCalendarHeader']
|
@@ -658,13 +658,13 @@ declare module 'vue' {
|
|
658
658
|
VCalendarMonthDay: typeof import('vuetify/labs/components')['VCalendarMonthDay']
|
659
659
|
VPicker: typeof import('vuetify/labs/components')['VPicker']
|
660
660
|
VPickerTitle: typeof import('vuetify/labs/components')['VPickerTitle']
|
661
|
-
VTreeview: typeof import('vuetify/labs/components')['VTreeview']
|
662
|
-
VTreeviewItem: typeof import('vuetify/labs/components')['VTreeviewItem']
|
663
|
-
VTreeviewGroup: typeof import('vuetify/labs/components')['VTreeviewGroup']
|
664
661
|
VNumberInput: typeof import('vuetify/labs/components')['VNumberInput']
|
665
662
|
VStepperVertical: typeof import('vuetify/labs/components')['VStepperVertical']
|
666
663
|
VStepperVerticalItem: typeof import('vuetify/labs/components')['VStepperVerticalItem']
|
667
664
|
VStepperVerticalActions: typeof import('vuetify/labs/components')['VStepperVerticalActions']
|
665
|
+
VTreeview: typeof import('vuetify/labs/components')['VTreeview']
|
666
|
+
VTreeviewItem: typeof import('vuetify/labs/components')['VTreeviewItem']
|
667
|
+
VTreeviewGroup: typeof import('vuetify/labs/components')['VTreeviewGroup']
|
668
668
|
VTimePicker: typeof import('vuetify/labs/components')['VTimePicker']
|
669
669
|
VTimePickerClock: typeof import('vuetify/labs/components')['VTimePickerClock']
|
670
670
|
VTimePickerControls: typeof import('vuetify/labs/components')['VTimePickerControls']
|
@@ -65,8 +65,8 @@ export const VNumberInput = genericComponent()({
|
|
65
65
|
const vTextFieldRef = ref();
|
66
66
|
const stepDecimals = computed(() => getDecimals(props.step));
|
67
67
|
const modelDecimals = computed(() => typeof model.value === 'number' ? getDecimals(model.value) : 0);
|
68
|
-
const form = useForm();
|
69
|
-
const controlsDisabled = computed(() =>
|
68
|
+
const form = useForm(props);
|
69
|
+
const controlsDisabled = computed(() => form.isDisabled.value || form.isReadonly.value);
|
70
70
|
const canIncrease = computed(() => {
|
71
71
|
if (controlsDisabled.value) return false;
|
72
72
|
return (model.value ?? 0) + props.step <= props.max;
|
@@ -89,7 +89,7 @@ export const VNumberInput = genericComponent()({
|
|
89
89
|
click: onClickDown
|
90
90
|
}));
|
91
91
|
onMounted(() => {
|
92
|
-
if (!
|
92
|
+
if (!controlsDisabled.value) {
|
93
93
|
clampModel();
|
94
94
|
}
|
95
95
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"VNumberInput.mjs","names":["VBtn","VDefaultsProvider","VDivider","makeVTextFieldProps","VTextField","useForm","forwardRefs","useProxiedModel","computed","nextTick","onMounted","ref","clamp","genericComponent","getDecimals","omit","propsFactory","useRender","makeVNumberInputProps","controlVariant","type","String","default","inset","Boolean","hideInput","modelValue","Number","min","MIN_SAFE_INTEGER","max","MAX_SAFE_INTEGER","step","VNumberInput","name","props","emits","val","setup","_ref","slots","_model","model","get","value","set","isNaN","vTextFieldRef","stepDecimals","modelDecimals","form","controlsDisabled","disabled","readonly","isReadonly","canIncrease","canDecrease","incrementIcon","decrementIcon","controlNodeSize","controlNodeDefaultHeight","incrementSlotProps","click","onClickUp","decrementSlotProps","onClickDown","clampModel","toggleUpDown","increment","arguments","length","undefined","decimals","Math","toFixed","e","stopPropagation","onBeforeinput","data","existingTxt","target","selectionStart","selectionEnd","potentialNewInputVal","slice","test","preventDefault","onKeydown","includes","key","ctrlKey","onControlMousedown","inputText","_","textFieldProps","filterProps","incrementControlNode","_createVNode","flat","height","size","icon","decrementControlNode","decrement","controlNode","dividerNode","appendInnerControl","reverse","_Fragment","hasAppendInner","prependInnerControl","hasPrependInner","_mergeProps","$event","class","style","_len","args","Array","_key","_len2","_key2"],"sources":["../../../src/labs/VNumberInput/VNumberInput.tsx"],"sourcesContent":["// Styles\nimport './VNumberInput.sass'\n\n// Components\nimport { VBtn } from '../../components/VBtn'\nimport { VDefaultsProvider } from '../../components/VDefaultsProvider'\nimport { VDivider } from '../../components/VDivider'\nimport { makeVTextFieldProps, VTextField } from '@/components/VTextField/VTextField'\n\n// Composables\nimport { useForm } from '@/composables/form'\nimport { forwardRefs } from '@/composables/forwardRefs'\nimport { useProxiedModel } from '@/composables/proxiedModel'\n\n// Utilities\nimport { computed, nextTick, onMounted, ref } from 'vue'\nimport { clamp, genericComponent, getDecimals, omit, propsFactory, useRender } from '@/util'\n\n// Types\nimport type { PropType } from 'vue'\nimport type { VTextFieldSlots } from '@/components/VTextField/VTextField'\n\ntype ControlSlot = {\n click: (e: MouseEvent) => void\n}\n\ntype VNumberInputSlots = Omit<VTextFieldSlots, 'default'> & {\n increment: ControlSlot\n decrement: ControlSlot\n}\n\ntype ControlVariant = 'default' | 'stacked' | 'split'\n\nconst makeVNumberInputProps = propsFactory({\n controlVariant: {\n type: String as PropType<ControlVariant>,\n default: 'default',\n },\n inset: Boolean,\n hideInput: Boolean,\n modelValue: {\n type: Number as PropType<Number | null>,\n default: null,\n },\n min: {\n type: Number,\n default: Number.MIN_SAFE_INTEGER,\n },\n max: {\n type: Number,\n default: Number.MAX_SAFE_INTEGER,\n },\n step: {\n type: Number,\n default: 1,\n },\n\n ...omit(makeVTextFieldProps({}), ['appendInnerIcon', 'modelValue', 'prependInnerIcon']),\n}, 'VNumberInput')\n\nexport const VNumberInput = genericComponent<VNumberInputSlots>()({\n name: 'VNumberInput',\n\n props: {\n ...makeVNumberInputProps(),\n },\n\n emits: {\n 'update:modelValue': (val: number) => true,\n },\n\n setup (props, { slots }) {\n const _model = useProxiedModel(props, 'modelValue')\n\n const model = computed({\n get: () => _model.value,\n set (val) {\n if (val === null) {\n _model.value = null\n return\n }\n\n if (!isNaN(+val) && +val <= props.max && +val >= props.min) {\n _model.value = +val\n }\n },\n })\n\n const vTextFieldRef = ref<VTextField | undefined>()\n\n const stepDecimals = computed(() => getDecimals(props.step))\n const modelDecimals = computed(() => typeof model.value === 'number' ? getDecimals(model.value) : 0)\n\n const form = useForm()\n const controlsDisabled = computed(() => (\n props.disabled || props.readonly || form?.isReadonly.value\n ))\n\n const canIncrease = computed(() => {\n if (controlsDisabled.value) return false\n return (model.value ?? 0) as number + props.step <= props.max\n })\n const canDecrease = computed(() => {\n if (controlsDisabled.value) return false\n return (model.value ?? 0) as number - props.step >= props.min\n })\n\n const controlVariant = computed(() => {\n return props.hideInput ? 'stacked' : props.controlVariant\n })\n\n const incrementIcon = computed(() => controlVariant.value === 'split' ? '$plus' : '$collapse')\n const decrementIcon = computed(() => controlVariant.value === 'split' ? '$minus' : '$expand')\n const controlNodeSize = computed(() => controlVariant.value === 'split' ? 'default' : 'small')\n const controlNodeDefaultHeight = computed(() => controlVariant.value === 'stacked' ? 'auto' : '100%')\n\n const incrementSlotProps = computed(() => ({ click: onClickUp }))\n\n const decrementSlotProps = computed(() => ({ click: onClickDown }))\n\n onMounted(() => {\n if (!props.readonly && !props.disabled) {\n clampModel()\n }\n })\n\n function toggleUpDown (increment = true) {\n if (controlsDisabled.value) return\n if (model.value == null) {\n model.value = clamp(0, props.min, props.max)\n return\n }\n\n const decimals = Math.max(modelDecimals.value, stepDecimals.value)\n if (increment) {\n if (canIncrease.value) model.value = +((((model.value as number) + props.step).toFixed(decimals)))\n } else {\n if (canDecrease.value) model.value = +((((model.value as number) - props.step).toFixed(decimals)))\n }\n }\n\n function onClickUp (e: MouseEvent) {\n e.stopPropagation()\n toggleUpDown()\n }\n\n function onClickDown (e: MouseEvent) {\n e.stopPropagation()\n toggleUpDown(false)\n }\n\n function onBeforeinput (e: InputEvent) {\n if (!e.data) return\n const existingTxt = (e.target as HTMLInputElement)?.value\n const selectionStart = (e.target as HTMLInputElement)?.selectionStart\n const selectionEnd = (e.target as HTMLInputElement)?.selectionEnd\n const potentialNewInputVal =\n existingTxt\n ? existingTxt.slice(0, selectionStart as number | undefined) + e.data + existingTxt.slice(selectionEnd as number | undefined)\n : e.data\n // Only numbers, \"-\", \".\" are allowed\n // AND \"-\", \".\" are allowed only once\n // AND \"-\" is only allowed at the start\n if (!/^-?(\\d+(\\.\\d*)?|(\\.\\d+)|\\d*|\\.)$/.test(potentialNewInputVal)) {\n e.preventDefault()\n }\n }\n\n async function onKeydown (e: KeyboardEvent) {\n if (\n ['Enter', 'ArrowLeft', 'ArrowRight', 'Backspace', 'Delete', 'Tab'].includes(e.key) ||\n e.ctrlKey\n ) return\n\n if (['ArrowDown', 'ArrowUp'].includes(e.key)) {\n e.preventDefault()\n clampModel()\n // _model is controlled, so need to wait until props['modelValue'] is updated\n await nextTick()\n if (e.key === 'ArrowDown') {\n toggleUpDown(false)\n } else {\n toggleUpDown()\n }\n }\n }\n\n function onControlMousedown (e: MouseEvent) {\n e.stopPropagation()\n }\n\n function clampModel () {\n if (!vTextFieldRef.value) return\n const inputText = vTextFieldRef.value.value\n if (inputText && !isNaN(+inputText)) {\n model.value = clamp(+(inputText), props.min, props.max)\n } else {\n model.value = null\n }\n }\n\n useRender(() => {\n const { modelValue: _, ...textFieldProps } = VTextField.filterProps(props)\n\n function incrementControlNode () {\n return !slots.increment ? (\n <VBtn\n disabled={ !canIncrease.value }\n flat\n key=\"increment-btn\"\n height={ controlNodeDefaultHeight.value }\n data-testid=\"increment\"\n aria-hidden=\"true\"\n icon={ incrementIcon.value }\n onClick={ onClickUp }\n onMousedown={ onControlMousedown }\n size={ controlNodeSize.value }\n tabindex=\"-1\"\n />\n ) : (\n <VDefaultsProvider\n key=\"increment-defaults\"\n defaults={{\n VBtn: {\n disabled: !canIncrease.value,\n flat: true,\n height: controlNodeDefaultHeight.value,\n size: controlNodeSize.value,\n icon: incrementIcon.value,\n },\n }}\n >\n { slots.increment(incrementSlotProps.value) }\n </VDefaultsProvider>\n )\n }\n\n function decrementControlNode () {\n return !slots.decrement ? (\n <VBtn\n disabled={ !canDecrease.value }\n flat\n key=\"decrement-btn\"\n height={ controlNodeDefaultHeight.value }\n data-testid=\"decrement\"\n aria-hidden=\"true\"\n icon={ decrementIcon.value }\n size={ controlNodeSize.value }\n tabindex=\"-1\"\n onClick={ onClickDown }\n onMousedown={ onControlMousedown }\n />\n ) : (\n <VDefaultsProvider\n key=\"decrement-defaults\"\n defaults={{\n VBtn: {\n disabled: !canDecrease.value,\n flat: true,\n height: controlNodeDefaultHeight.value,\n size: controlNodeSize.value,\n icon: decrementIcon.value,\n },\n }}\n >\n { slots.decrement(decrementSlotProps.value) }\n </VDefaultsProvider>\n )\n }\n\n function controlNode () {\n return (\n <div class=\"v-number-input__control\">\n { decrementControlNode() }\n\n <VDivider\n vertical={ controlVariant.value !== 'stacked' }\n />\n\n { incrementControlNode() }\n </div>\n )\n }\n\n function dividerNode () {\n return !props.hideInput && !props.inset ? <VDivider vertical /> : undefined\n }\n\n const appendInnerControl =\n controlVariant.value === 'split'\n ? (\n <div class=\"v-number-input__control\">\n <VDivider vertical />\n\n { incrementControlNode() }\n </div>\n ) : (!props.reverse\n ? <>{ dividerNode() }{ controlNode() }</>\n : undefined)\n\n const hasAppendInner = slots['append-inner'] || appendInnerControl\n\n const prependInnerControl =\n controlVariant.value === 'split'\n ? (\n <div class=\"v-number-input__control\">\n { decrementControlNode() }\n\n <VDivider vertical />\n </div>\n ) : (props.reverse\n ? <>{ controlNode() }{ dividerNode() }</>\n : undefined)\n\n const hasPrependInner = slots['prepend-inner'] || prependInnerControl\n\n return (\n <VTextField\n ref={ vTextFieldRef }\n v-model={ model.value }\n onBeforeinput={ onBeforeinput }\n onChange={ clampModel }\n onKeydown={ onKeydown }\n class={[\n 'v-number-input',\n {\n 'v-number-input--default': controlVariant.value === 'default',\n 'v-number-input--hide-input': props.hideInput,\n 'v-number-input--inset': props.inset,\n 'v-number-input--reverse': props.reverse,\n 'v-number-input--split': controlVariant.value === 'split',\n 'v-number-input--stacked': controlVariant.value === 'stacked',\n },\n props.class,\n ]}\n { ...textFieldProps }\n style={ props.style }\n inputmode=\"decimal\"\n >\n {{\n ...slots,\n 'append-inner': hasAppendInner ? (...args) => (\n <>\n { slots['append-inner']?.(...args) }\n { appendInnerControl }\n </>\n ) : undefined,\n 'prepend-inner': hasPrependInner ? (...args) => (\n <>\n { prependInnerControl }\n { slots['prepend-inner']?.(...args) }\n </>\n ) : undefined,\n }}\n </VTextField>\n )\n })\n\n return forwardRefs({}, vTextFieldRef)\n },\n})\n\nexport type VNumberInput = InstanceType<typeof VNumberInput>\n"],"mappings":";AAAA;AACA;;AAEA;AAAA,SACSA,IAAI;AAAA,SACJC,iBAAiB;AAAA,SACjBC,QAAQ;AAAA,SACRC,mBAAmB,EAAEC,UAAU,sDAExC;AAAA,SACSC,OAAO;AAAA,SACPC,WAAW;AAAA,SACXC,eAAe,8CAExB;AACA,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,GAAG,QAAQ,KAAK;AAAA,SAC/CC,KAAK,EAAEC,gBAAgB,EAAEC,WAAW,EAAEC,IAAI,EAAEC,YAAY,EAAEC,SAAS,gCAE5E;AAeA,MAAMC,qBAAqB,GAAGF,YAAY,CAAC;EACzCG,cAAc,EAAE;IACdC,IAAI,EAAEC,MAAkC;IACxCC,OAAO,EAAE;EACX,CAAC;EACDC,KAAK,EAAEC,OAAO;EACdC,SAAS,EAAED,OAAO;EAClBE,UAAU,EAAE;IACVN,IAAI,EAAEO,MAAiC;IACvCL,OAAO,EAAE;EACX,CAAC;EACDM,GAAG,EAAE;IACHR,IAAI,EAAEO,MAAM;IACZL,OAAO,EAAEK,MAAM,CAACE;EAClB,CAAC;EACDC,GAAG,EAAE;IACHV,IAAI,EAAEO,MAAM;IACZL,OAAO,EAAEK,MAAM,CAACI;EAClB,CAAC;EACDC,IAAI,EAAE;IACJZ,IAAI,EAAEO,MAAM;IACZL,OAAO,EAAE;EACX,CAAC;EAED,GAAGP,IAAI,CAACZ,mBAAmB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,iBAAiB,EAAE,YAAY,EAAE,kBAAkB,C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AAA/C,SAAA,CAAAC,MAAA,EAAI+C,IAAI,OAAAC,KAAA,CAAAF,IAAA,GAAAG,IAAA,MAAAA,IAAA,GAAAH,IAAA,EAAAG,IAAA;YAAJF,IAAI,CAAAE,IAAA,IAAAlD,SAAA,CAAAkD,IAAA;UAAA;UAAA,OAAAtB,YAAA,CAAAW,SAAA,SAEnCpE,KAAK,CAAC,cAAc,CAAC,GAAG,GAAG6E,IAAI,CAAC,EAChCX,kBAAkB;QAAA,CAEvB,GAAGnC,SAAS;QACb,eAAe,EAAEwC,eAAe,GAAG;UAAA,SAAAS,KAAA,GAAAnD,SAAA,CAAAC,MAAA,EAAI+C,IAAI,OAAAC,KAAA,CAAAE,KAAA,GAAAC,KAAA,MAAAA,KAAA,GAAAD,KAAA,EAAAC,KAAA;YAAJJ,IAAI,CAAAI,KAAA,IAAApD,SAAA,CAAAoD,KAAA;UAAA;UAAA,OAAAxB,YAAA,CAAAW,SAAA,SAErCE,mBAAmB,EACnBtE,KAAK,CAAC,eAAe,CAAC,GAAG,GAAG6E,IAAI,CAAC;QAAA,CAEtC,GAAG9C;MAAS;IAIrB,CAAC,CAAC;IAEF,OAAOjE,WAAW,CAAC,CAAC,CAAC,EAAEyC,aAAa,CAAC;EACvC;AACF,CAAC,CAAC","ignoreList":[]}
|
1
|
+
{"version":3,"file":"VNumberInput.mjs","names":["VBtn","VDefaultsProvider","VDivider","makeVTextFieldProps","VTextField","useForm","forwardRefs","useProxiedModel","computed","nextTick","onMounted","ref","clamp","genericComponent","getDecimals","omit","propsFactory","useRender","makeVNumberInputProps","controlVariant","type","String","default","inset","Boolean","hideInput","modelValue","Number","min","MIN_SAFE_INTEGER","max","MAX_SAFE_INTEGER","step","VNumberInput","name","props","emits","val","setup","_ref","slots","_model","model","get","value","set","isNaN","vTextFieldRef","stepDecimals","modelDecimals","form","controlsDisabled","isDisabled","isReadonly","canIncrease","canDecrease","incrementIcon","decrementIcon","controlNodeSize","controlNodeDefaultHeight","incrementSlotProps","click","onClickUp","decrementSlotProps","onClickDown","clampModel","toggleUpDown","increment","arguments","length","undefined","decimals","Math","toFixed","e","stopPropagation","onBeforeinput","data","existingTxt","target","selectionStart","selectionEnd","potentialNewInputVal","slice","test","preventDefault","onKeydown","includes","key","ctrlKey","onControlMousedown","inputText","_","textFieldProps","filterProps","incrementControlNode","_createVNode","disabled","flat","height","size","icon","decrementControlNode","decrement","controlNode","dividerNode","appendInnerControl","reverse","_Fragment","hasAppendInner","prependInnerControl","hasPrependInner","_mergeProps","$event","class","style","_len","args","Array","_key","_len2","_key2"],"sources":["../../../src/labs/VNumberInput/VNumberInput.tsx"],"sourcesContent":["// Styles\nimport './VNumberInput.sass'\n\n// Components\nimport { VBtn } from '../../components/VBtn'\nimport { VDefaultsProvider } from '../../components/VDefaultsProvider'\nimport { VDivider } from '../../components/VDivider'\nimport { makeVTextFieldProps, VTextField } from '@/components/VTextField/VTextField'\n\n// Composables\nimport { useForm } from '@/composables/form'\nimport { forwardRefs } from '@/composables/forwardRefs'\nimport { useProxiedModel } from '@/composables/proxiedModel'\n\n// Utilities\nimport { computed, nextTick, onMounted, ref } from 'vue'\nimport { clamp, genericComponent, getDecimals, omit, propsFactory, useRender } from '@/util'\n\n// Types\nimport type { PropType } from 'vue'\nimport type { VTextFieldSlots } from '@/components/VTextField/VTextField'\n\ntype ControlSlot = {\n click: (e: MouseEvent) => void\n}\n\ntype VNumberInputSlots = Omit<VTextFieldSlots, 'default'> & {\n increment: ControlSlot\n decrement: ControlSlot\n}\n\ntype ControlVariant = 'default' | 'stacked' | 'split'\n\nconst makeVNumberInputProps = propsFactory({\n controlVariant: {\n type: String as PropType<ControlVariant>,\n default: 'default',\n },\n inset: Boolean,\n hideInput: Boolean,\n modelValue: {\n type: Number as PropType<Number | null>,\n default: null,\n },\n min: {\n type: Number,\n default: Number.MIN_SAFE_INTEGER,\n },\n max: {\n type: Number,\n default: Number.MAX_SAFE_INTEGER,\n },\n step: {\n type: Number,\n default: 1,\n },\n\n ...omit(makeVTextFieldProps({}), ['appendInnerIcon', 'modelValue', 'prependInnerIcon']),\n}, 'VNumberInput')\n\nexport const VNumberInput = genericComponent<VNumberInputSlots>()({\n name: 'VNumberInput',\n\n props: {\n ...makeVNumberInputProps(),\n },\n\n emits: {\n 'update:modelValue': (val: number) => true,\n },\n\n setup (props, { slots }) {\n const _model = useProxiedModel(props, 'modelValue')\n\n const model = computed({\n get: () => _model.value,\n set (val) {\n if (val === null) {\n _model.value = null\n return\n }\n\n if (!isNaN(+val) && +val <= props.max && +val >= props.min) {\n _model.value = +val\n }\n },\n })\n\n const vTextFieldRef = ref<VTextField | undefined>()\n\n const stepDecimals = computed(() => getDecimals(props.step))\n const modelDecimals = computed(() => typeof model.value === 'number' ? getDecimals(model.value) : 0)\n\n const form = useForm(props)\n const controlsDisabled = computed(() => (\n form.isDisabled.value || form.isReadonly.value\n ))\n\n const canIncrease = computed(() => {\n if (controlsDisabled.value) return false\n return (model.value ?? 0) as number + props.step <= props.max\n })\n const canDecrease = computed(() => {\n if (controlsDisabled.value) return false\n return (model.value ?? 0) as number - props.step >= props.min\n })\n\n const controlVariant = computed(() => {\n return props.hideInput ? 'stacked' : props.controlVariant\n })\n\n const incrementIcon = computed(() => controlVariant.value === 'split' ? '$plus' : '$collapse')\n const decrementIcon = computed(() => controlVariant.value === 'split' ? '$minus' : '$expand')\n const controlNodeSize = computed(() => controlVariant.value === 'split' ? 'default' : 'small')\n const controlNodeDefaultHeight = computed(() => controlVariant.value === 'stacked' ? 'auto' : '100%')\n\n const incrementSlotProps = computed(() => ({ click: onClickUp }))\n\n const decrementSlotProps = computed(() => ({ click: onClickDown }))\n\n onMounted(() => {\n if (!controlsDisabled.value) {\n clampModel()\n }\n })\n\n function toggleUpDown (increment = true) {\n if (controlsDisabled.value) return\n if (model.value == null) {\n model.value = clamp(0, props.min, props.max)\n return\n }\n\n const decimals = Math.max(modelDecimals.value, stepDecimals.value)\n if (increment) {\n if (canIncrease.value) model.value = +((((model.value as number) + props.step).toFixed(decimals)))\n } else {\n if (canDecrease.value) model.value = +((((model.value as number) - props.step).toFixed(decimals)))\n }\n }\n\n function onClickUp (e: MouseEvent) {\n e.stopPropagation()\n toggleUpDown()\n }\n\n function onClickDown (e: MouseEvent) {\n e.stopPropagation()\n toggleUpDown(false)\n }\n\n function onBeforeinput (e: InputEvent) {\n if (!e.data) return\n const existingTxt = (e.target as HTMLInputElement)?.value\n const selectionStart = (e.target as HTMLInputElement)?.selectionStart\n const selectionEnd = (e.target as HTMLInputElement)?.selectionEnd\n const potentialNewInputVal =\n existingTxt\n ? existingTxt.slice(0, selectionStart as number | undefined) + e.data + existingTxt.slice(selectionEnd as number | undefined)\n : e.data\n // Only numbers, \"-\", \".\" are allowed\n // AND \"-\", \".\" are allowed only once\n // AND \"-\" is only allowed at the start\n if (!/^-?(\\d+(\\.\\d*)?|(\\.\\d+)|\\d*|\\.)$/.test(potentialNewInputVal)) {\n e.preventDefault()\n }\n }\n\n async function onKeydown (e: KeyboardEvent) {\n if (\n ['Enter', 'ArrowLeft', 'ArrowRight', 'Backspace', 'Delete', 'Tab'].includes(e.key) ||\n e.ctrlKey\n ) return\n\n if (['ArrowDown', 'ArrowUp'].includes(e.key)) {\n e.preventDefault()\n clampModel()\n // _model is controlled, so need to wait until props['modelValue'] is updated\n await nextTick()\n if (e.key === 'ArrowDown') {\n toggleUpDown(false)\n } else {\n toggleUpDown()\n }\n }\n }\n\n function onControlMousedown (e: MouseEvent) {\n e.stopPropagation()\n }\n\n function clampModel () {\n if (!vTextFieldRef.value) return\n const inputText = vTextFieldRef.value.value\n if (inputText && !isNaN(+inputText)) {\n model.value = clamp(+(inputText), props.min, props.max)\n } else {\n model.value = null\n }\n }\n\n useRender(() => {\n const { modelValue: _, ...textFieldProps } = VTextField.filterProps(props)\n\n function incrementControlNode () {\n return !slots.increment ? (\n <VBtn\n disabled={ !canIncrease.value }\n flat\n key=\"increment-btn\"\n height={ controlNodeDefaultHeight.value }\n data-testid=\"increment\"\n aria-hidden=\"true\"\n icon={ incrementIcon.value }\n onClick={ onClickUp }\n onMousedown={ onControlMousedown }\n size={ controlNodeSize.value }\n tabindex=\"-1\"\n />\n ) : (\n <VDefaultsProvider\n key=\"increment-defaults\"\n defaults={{\n VBtn: {\n disabled: !canIncrease.value,\n flat: true,\n height: controlNodeDefaultHeight.value,\n size: controlNodeSize.value,\n icon: incrementIcon.value,\n },\n }}\n >\n { slots.increment(incrementSlotProps.value) }\n </VDefaultsProvider>\n )\n }\n\n function decrementControlNode () {\n return !slots.decrement ? (\n <VBtn\n disabled={ !canDecrease.value }\n flat\n key=\"decrement-btn\"\n height={ controlNodeDefaultHeight.value }\n data-testid=\"decrement\"\n aria-hidden=\"true\"\n icon={ decrementIcon.value }\n size={ controlNodeSize.value }\n tabindex=\"-1\"\n onClick={ onClickDown }\n onMousedown={ onControlMousedown }\n />\n ) : (\n <VDefaultsProvider\n key=\"decrement-defaults\"\n defaults={{\n VBtn: {\n disabled: !canDecrease.value,\n flat: true,\n height: controlNodeDefaultHeight.value,\n size: controlNodeSize.value,\n icon: decrementIcon.value,\n },\n }}\n >\n { slots.decrement(decrementSlotProps.value) }\n </VDefaultsProvider>\n )\n }\n\n function controlNode () {\n return (\n <div class=\"v-number-input__control\">\n { decrementControlNode() }\n\n <VDivider\n vertical={ controlVariant.value !== 'stacked' }\n />\n\n { incrementControlNode() }\n </div>\n )\n }\n\n function dividerNode () {\n return !props.hideInput && !props.inset ? <VDivider vertical /> : undefined\n }\n\n const appendInnerControl =\n controlVariant.value === 'split'\n ? (\n <div class=\"v-number-input__control\">\n <VDivider vertical />\n\n { incrementControlNode() }\n </div>\n ) : (!props.reverse\n ? <>{ dividerNode() }{ controlNode() }</>\n : undefined)\n\n const hasAppendInner = slots['append-inner'] || appendInnerControl\n\n const prependInnerControl =\n controlVariant.value === 'split'\n ? (\n <div class=\"v-number-input__control\">\n { decrementControlNode() }\n\n <VDivider vertical />\n </div>\n ) : (props.reverse\n ? <>{ controlNode() }{ dividerNode() }</>\n : undefined)\n\n const hasPrependInner = slots['prepend-inner'] || prependInnerControl\n\n return (\n <VTextField\n ref={ vTextFieldRef }\n v-model={ model.value }\n onBeforeinput={ onBeforeinput }\n onChange={ clampModel }\n onKeydown={ onKeydown }\n class={[\n 'v-number-input',\n {\n 'v-number-input--default': controlVariant.value === 'default',\n 'v-number-input--hide-input': props.hideInput,\n 'v-number-input--inset': props.inset,\n 'v-number-input--reverse': props.reverse,\n 'v-number-input--split': controlVariant.value === 'split',\n 'v-number-input--stacked': controlVariant.value === 'stacked',\n },\n props.class,\n ]}\n { ...textFieldProps }\n style={ props.style }\n inputmode=\"decimal\"\n >\n {{\n ...slots,\n 'append-inner': hasAppendInner ? (...args) => (\n <>\n { slots['append-inner']?.(...args) }\n { appendInnerControl }\n </>\n ) : undefined,\n 'prepend-inner': hasPrependInner ? (...args) => (\n <>\n { prependInnerControl }\n { slots['prepend-inner']?.(...args) }\n </>\n ) : undefined,\n }}\n </VTextField>\n )\n })\n\n return forwardRefs({}, vTextFieldRef)\n },\n})\n\nexport type VNumberInput = InstanceType<typeof VNumberInput>\n"],"mappings":";AAAA;AACA;;AAEA;AAAA,SACSA,IAAI;AAAA,SACJC,iBAAiB;AAAA,SACjBC,QAAQ;AAAA,SACRC,mBAAmB,EAAEC,UAAU,sDAExC;AAAA,SACSC,OAAO;AAAA,SACPC,WAAW;AAAA,SACXC,eAAe,8CAExB;AACA,SAASC,QAAQ,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,GAAG,QAAQ,KAAK;AAAA,SAC/CC,KAAK,EAAEC,gBAAgB,EAAEC,WAAW,EAAEC,IAAI,EAAEC,YAAY,EAAEC,SAAS,gCAE5E;AAeA,MAAMC,qBAAqB,GAAGF,YAAY,CAAC;EACzCG,cAAc,EAAE;IACdC,IAAI,EAAEC,MAAkC;IACxCC,OAAO,EAAE;EACX,CAAC;EACDC,KAAK,EAAEC,OAAO;EACdC,SAAS,EAAED,OAAO;EAClBE,UAAU,EAAE;IACV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