Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
package.lib.labs.VDateInput.VDateInput.mjs.map Maven / Gradle / Ivy
{"version":3,"file":"VDateInput.mjs","names":["makeVConfirmEditProps","VConfirmEdit","makeVDatePickerProps","VDatePicker","VMenu","makeVTextFieldProps","VTextField","useDate","makeFocusProps","useFocus","useLocale","useProxiedModel","computed","shallowRef","genericComponent","omit","propsFactory","useRender","wrapInArray","makeVDateInputProps","hideActions","Boolean","placeholder","prependIcon","weeksInMonth","hideHeader","VDateInput","name","props","emits","val","setup","_ref","slots","t","adapter","isFocused","focus","blur","model","multiple","menu","display","value","length","start","end","isValid","format","isInteractive","disabled","readonly","onKeydown","e","key","target","date","onClick","preventDefault","stopPropagation","onSave","confirmEditProps","filterProps","datePickerProps","textFieldProps","_createVNode","_mergeProps","class","style","undefined","default","$event","_ref2","actions","proxyModel"],"sources":["../../../src/labs/VDateInput/VDateInput.tsx"],"sourcesContent":["// Components\nimport { makeVConfirmEditProps, VConfirmEdit } from '@/components/VConfirmEdit/VConfirmEdit'\nimport { makeVDatePickerProps, VDatePicker } from '@/components/VDatePicker/VDatePicker'\nimport { VMenu } from '@/components/VMenu/VMenu'\nimport { makeVTextFieldProps, VTextField } from '@/components/VTextField/VTextField'\n\n// Composables\nimport { useDate } from '@/composables/date'\nimport { makeFocusProps, useFocus } from '@/composables/focus'\nimport { useLocale } from '@/composables/locale'\nimport { useProxiedModel } from '@/composables/proxiedModel'\n\n// Utilities\nimport { computed, shallowRef } from 'vue'\nimport { genericComponent, omit, propsFactory, useRender, wrapInArray } from '@/util'\n\n// Types\nexport interface VDateInputSlots {\n default: never\n}\n\nexport const makeVDateInputProps = propsFactory({\n hideActions: Boolean,\n\n ...makeFocusProps(),\n ...makeVConfirmEditProps(),\n ...makeVTextFieldProps({\n placeholder: 'mm/dd/yyyy',\n prependIcon: '$calendar',\n }),\n ...omit(makeVDatePickerProps({\n weeksInMonth: 'dynamic' as const,\n hideHeader: true,\n }), ['active']),\n}, 'VDateInput')\n\nexport const VDateInput = genericComponent()({\n name: 'VDateInput',\n\n props: makeVDateInputProps(),\n\n emits: {\n 'update:modelValue': (val: string) => true,\n },\n\n setup (props, { slots }) {\n const { t } = useLocale()\n const adapter = useDate()\n const { isFocused, focus, blur } = useFocus(props)\n const model = useProxiedModel(props, 'modelValue', props.multiple ? [] : null)\n const menu = shallowRef(false)\n\n const display = computed(() => {\n const value = wrapInArray(model.value)\n\n if (!value.length) return null\n\n if (props.multiple === true) {\n return t('$vuetify.datePicker.itemsSelected', value.length)\n }\n\n if (props.multiple === 'range') {\n const start = value[0]\n const end = value[value.length - 1]\n\n return adapter.isValid(start) && adapter.isValid(end)\n ? `${adapter.format(start, 'keyboardDate')} - ${adapter.format(end, 'keyboardDate')}`\n : ''\n }\n\n return adapter.isValid(model.value) ? adapter.format(model.value, 'keyboardDate') : ''\n })\n\n const isInteractive = computed(() => !props.disabled && !props.readonly)\n\n function onKeydown (e: KeyboardEvent) {\n if (e.key !== 'Enter') return\n\n if (!menu.value || !isFocused.value) {\n menu.value = true\n\n return\n }\n\n const target = e.target as HTMLInputElement\n\n model.value = adapter.date(target.value)\n }\n\n function onClick (e: MouseEvent) {\n e.preventDefault()\n e.stopPropagation()\n\n menu.value = true\n }\n\n function onSave () {\n menu.value = false\n }\n\n useRender(() => {\n const confirmEditProps = VConfirmEdit.filterProps(props)\n const datePickerProps = VDatePicker.filterProps(omit(props, ['active']))\n const textFieldProps = VTextField.filterProps(props)\n\n return (\n \n \n \n {{\n default: ({ actions, model: proxyModel }) => {\n return (\n {\n if (!props.hideActions) {\n proxyModel.value = val\n } else {\n model.value = val\n\n if (!props.multiple) menu.value = false\n }\n }}\n onMousedown={ (e: MouseEvent) => e.preventDefault() }\n >\n {{\n actions: !props.hideActions ? () => actions : undefined,\n }}\n \n )\n },\n }}\n \n \n\n { slots.default?.() }\n \n )\n })\n },\n})\n\nexport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