VDateRangePickerHeader.mjs.map 7.5 KB

1
  1. {"version":3,"file":"VDateRangePickerHeader.mjs","names":["VBtn","useBackgroundColor","useLocale","useDate","makeDateProps","computed","genericComponent","omit","propsFactory","useRender","makeVDateRangePickerHeaderProps","color","String","title","header","keyboardIcon","type","default","calendarIcon","closeIcon","showInputSwitch","Boolean","range","VDateRangePickerHeader","name","props","emits","cancel","save","input","date","setup","_ref","emit","t","adapter","backgroundColorClasses","backgroundColorStyles","headerText","modelValue","length","format","map","join","titleText","handleHeaderClick","_createVNode","value","inputMode","onClick","_createTextVNode"],"sources":["../../../src/labs/VDateRangePicker/VDateRangePickerHeader.tsx"],"sourcesContent":["// Styles\nimport './VDateRangePickerHeader.sass'\n\n// Components\nimport { VBtn } from '../../components/VBtn'\n\n// Composables\nimport { useBackgroundColor } from '@/composables/color'\nimport { useLocale } from '@/composables/locale'\nimport { useDate } from '@/labs/date'\nimport { makeDateProps } from '@/labs/VDateInput/composables'\n\n// Utilities\nimport { computed } from 'vue'\nimport { genericComponent, omit, propsFactory, useRender } from '@/util'\n\nexport const makeVDateRangePickerHeaderProps = propsFactory({\n color: String,\n title: String,\n header: String,\n keyboardIcon: {\n type: String,\n default: '$edit',\n },\n calendarIcon: {\n type: String,\n default: '$calendar',\n },\n closeIcon: {\n type: String,\n default: '$close',\n },\n showInputSwitch: Boolean,\n range: null,\n ...omit(makeDateProps(), ['viewMode', 'format']),\n}, 'VDateRangePickerHeader')\n\nexport const VDateRangePickerHeader = genericComponent()({\n name: 'VDateRangePickerHeader',\n\n props: makeVDateRangePickerHeaderProps(),\n\n emits: {\n cancel: () => true,\n save: () => true,\n 'update:inputMode': (input: string) => true,\n 'update:displayDate': (date: any) => true,\n },\n\n setup (props, { emit }) {\n const { t } = useLocale()\n const adapter = useDate()\n const { backgroundColorClasses, backgroundColorStyles } = useBackgroundColor(props, 'color')\n\n const headerText = computed(() => {\n if (props.header) return props.header\n\n if (!props.modelValue.length) return t(`$vuetify.datePicker.${props.range ? 'range.' : ''}header.placeholder`)\n\n if (props.modelValue.length === 1) return adapter.format(props.modelValue[0], 'normalDateWithWeekday')\n\n return props.modelValue.map((date: any) => adapter.format(date, 'shortDate')).join(' - ')\n })\n\n const titleText = computed(() => {\n if (props.title) return props.title\n\n if (!props.modelValue.length) return t(`$vuetify.datePicker.${props.range ? 'range.' : ''}title.placeholder`)\n\n return t(`$vuetify.datePicker.${props.range ? 'range.' : ''}title.selected`)\n })\n\n function handleHeaderClick () {\n if (!props.modelValue.length) return\n\n const date = props.modelValue[0]\n\n emit('update:displayDate', date)\n }\n\n useRender(() => (\n <div\n class={[\n 'v-date-range-picker-header',\n backgroundColorClasses.value,\n `v-date-range-picker-header--${props.inputMode}`,\n ]}\n style={ backgroundColorStyles.value }\n >\n { props.inputMode === 'calendar' && (\n <div key=\"calendar-buttons\" class=\"v-date-range-picker-header__buttons\">\n <VBtn\n variant=\"text\"\n icon={ props.closeIcon }\n onClick={ () => emit('cancel') }\n />\n <VBtn\n variant=\"text\"\n onClick={ () => emit('save') }\n >\n Save\n </VBtn>\n </div>\n )}\n <div class=\"v-date-range-picker-header__wrapper\">\n <div class=\"v-date-range-picker-header__title\">\n { titleText.value }\n </div>\n <div class=\"v-date-range-picker-header__text\">\n <div\n class=\"v-date-range-picker-header__date\"\n onClick={ handleHeaderClick }\n >\n { headerText.value }\n </div>\n <VBtn\n variant=\"text\"\n icon={ props.inputMode === 'keyboard' ? props.calendarIcon : props.keyboardIcon }\n onClick={ () => emit('update:inputMode', props.inputMode === 'keyboard' ? 'calendar' : 'keyboard') }\n />\n </div>\n </div>\n </div>\n ))\n\n return {}\n },\n})\n\nexport type VDateRangePickerHeader = InstanceType<typeof VDateRangePickerHeader>\n"],"mappings":";AAAA;AACA;;AAEA;AAAA,SACSA,IAAI,2CAEb;AAAA,SACSC,kBAAkB;AAAA,SAClBC,SAAS;AAAA,SACTC,OAAO;AAAA,SACPC,aAAa,yCAEtB;AACA,SAASC,QAAQ,QAAQ,KAAK;AAAA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