@oruga-ui/oruga-next
Version:
UI components for Vue.js and CSS framework agnostic
1 lines • 24.7 kB
Source Map (JSON)
{"version":3,"file":"utils-B_lFH_3d.cjs","sources":["../../src/components/utils/PickerWrapper.vue","../../src/components/datepicker/utils.ts"],"sourcesContent":["<script setup lang=\"ts\">\nimport {\n computed,\n useAttrs,\n ref,\n watch,\n nextTick,\n useTemplateRef,\n type PropType,\n} from \"vue\";\n\nimport ODropdown from \"../dropdown/Dropdown.vue\";\nimport ODropdownItem from \"../dropdown/DropdownItem.vue\";\nimport OInput from \"../input/Input.vue\";\n\nimport { isDate, isDefined, isMobileAgent, isTrueish } from \"@/utils/helpers\";\nimport { isClient } from \"@/utils/ssr\";\nimport {\n getActiveClasses,\n useEventListener,\n useInputHandler,\n} from \"@/composables\";\n\nimport { injectField } from \"../field/fieldInjection\";\n\nimport type { ClassBind, ComponentClass } from \"@/types\";\n\n/**\n * This is a internal used component.\n * Used by Datepicker and Timepicker.\n */\ndefineOptions({\n name: \"OPickerWrapper\",\n});\n\nconst props = defineProps({\n /** the internal input value */\n value: {\n type: [Date, Array] as PropType<Date | Date[] | undefined>,\n default: undefined,\n },\n /** the active state of the dropdown */\n active: { type: Boolean, default: false },\n /** parent picker component props */\n pickerProps: { type: Object, required: true },\n /** data-oruga attribute value */\n dataOruga: { type: String, required: true },\n /** format props value to input value */\n formatter: {\n type: Function as PropType<\n (value: Date | Date[] | undefined, isNative: boolean) => string\n >,\n required: true,\n },\n /** parse input value to props value */\n parser: {\n type: Function as PropType<\n (value: string, isNative: boolean) => Date | Date[] | undefined\n >,\n required: true,\n },\n type: { type: String, required: true },\n step: { type: String, default: undefined },\n min: { type: Date, default: undefined },\n max: { type: Date, default: undefined },\n stayOpen: { type: Boolean, default: false },\n /** the DateTimeFormat object to watch for to update the parsed input value */\n dtf: { type: Object, default: undefined },\n rootClasses: { type: Array as PropType<ClassBind[]>, required: true },\n dropdownClasses: { type: Array as PropType<ClassBind[]>, required: true },\n boxClass: { type: Array as PropType<ComponentClass>, required: true },\n});\n\nconst emits = defineEmits<{\n /**\n * active prop two-way binding\n * @param value {Date, Date[]} updated active prop\n */\n \"update:value\": [value: Date | Date[] | undefined];\n /**\n * active prop two-way binding\n * @param value {boolean} updated active prop\n */\n \"update:active\": [value: boolean];\n /** on input focus event */\n focus: [event: Event];\n /** on input blur event */\n blur: [event: Event];\n /** on input invalid event */\n invalid: [event: Event];\n /** on icon click event */\n \"icon-click\": [event: Event];\n /** on icon right click event */\n \"icon-right-click\": [event: Event];\n /** on dropdown left button press event */\n left: [event: Event];\n /** on dropdown right button press event */\n right: [event: Event];\n}>();\n\nconst isMobileNative = computed(\n () =>\n !isTrueish(props.pickerProps.inline) &&\n isTrueish(props.pickerProps.mobileNative) &&\n isMobileAgent.any(),\n);\n\n// inject parent field component if used inside one\nconst { parentField } = injectField();\n\nconst dropdownRef = useTemplateRef(\"dropdownComponent\");\nconst inputRef = useTemplateRef(\"inputComponent\");\nconst nativeInputRef = useTemplateRef(\"nativeInputComponent\");\n\nconst elementRef = computed(() =>\n isMobileNative.value ? nativeInputRef.value : inputRef.value,\n);\n\n// use form input functionality for native input\nconst {\n input,\n checkHtml5Validity,\n setFocus,\n onBlur,\n onFocus,\n onInvalid,\n isValid,\n} = useInputHandler<HTMLInputElement>(elementRef, emits, props.pickerProps);\n\n/**\n * Show input as text for placeholder,\n * when placeholder and no native value is given.\n */\nconst initialNativeType =\n !isDefined(props.pickerProps.placeholder) || isTrueish(props.value)\n ? props.type\n : \"text\";\n\n/** the v-model value of the input */\nconst inputValue = ref(\"\");\n\n/**\n * When v-model is changed:\n * 1. Update internal value.\n * 2. Close picker.\n * 3. If it's invalid, validate again.\n */\nwatch(\n () => props.value,\n (value) => {\n // update internal value\n inputValue.value = props.formatter(value, isMobileNative.value);\n\n // toggle picker if not stay open\n if (!isMobileNative.value && !props.stayOpen) togglePicker(false);\n // validate if its invalid\n if (!isValid.value) checkHtml5Validity();\n },\n { immediate: true },\n);\n\n// update the parsed input value when the dtf change\nwatch(\n () => props.dtf,\n () => setValue(inputValue.value),\n);\n\n/** Set the vmodel value and update the prop value */\nfunction setValue(value: string): void {\n // parse to date\n let date = props.parser(value, isMobileNative.value);\n\n // check min/max dates\n if (Array.isArray(date)) date = date.map(checkMinMaxDate);\n else if (isDefined(date)) date = checkMinMaxDate(date);\n\n nextTick(\n () =>\n // reparse to string for internal value\n (inputValue.value = props.formatter(date, isMobileNative.value)),\n );\n\n // update the prop value\n emits(\"update:value\", date);\n}\n\nfunction checkMinMaxDate(date: Date): Date {\n if (!isDate(date)) return date;\n if (props.min && date < props.min) date = props.min;\n else if (props.max && date > props.max) date = props.max;\n return date;\n}\n\nconst isActive = defineModel<boolean>(\"active\", { default: false });\n\nwatch(isActive, onActiveChange);\n\nconst triggers = computed(() =>\n isTrueish(props.pickerProps.openOnFocus) ? [\"click\"] : [],\n);\n\nif (isClient) useEventListener(document, \"keyup\", onKeyPress);\n\n/** Keypress event that is bound to the document. */\nfunction onKeyPress(event: KeyboardEvent): void {\n if (isActive.value && (event.key === \"Escape\" || event.key === \"Esc\"))\n togglePicker(false);\n}\n\n// --- PICKER EVENT HANDLER ---\n\n/** Toggle picker */\nfunction togglePicker(active: boolean): void {\n if (!dropdownRef.value) return;\n if (active || isTrueish(props.pickerProps.closeOnClick))\n nextTick(() => (isActive.value = active));\n}\n\n/** Avoid dropdown toggle when is already visible */\nfunction onInputClick(event): void {\n if (isActive.value) event.stopPropagation();\n}\n\n/** Emit 'blur' event on dropdown is not active (closed) */\nfunction onActiveChange(value: boolean): void {\n if (value) onFocus(new Event(\"focus\"));\n else if (!value) onBlur(new Event(\"blur\"));\n}\n\n// --- NATIVE EVENT HANDLER ---\n\nfunction onChange(event: Event): void {\n setValue((event.target as HTMLInputElement).value);\n}\n\nfunction onNativeClick(event: Event): void {\n // do nothing if client is not mobile\n if (!isMobileNative.value || !input.value) return;\n\n // when input is not editable jet\n if (input.value.type === \"text\") {\n event.preventDefault();\n event.stopPropagation();\n\n // blur the current state to remove active native keyboards for type 'text'\n input.value.blur();\n\n setTimeout(() => {\n if (!input.value) return;\n // make the input editable\n input.value.readOnly = false;\n input.value.type = props.type;\n\n // focus the underlaying input element again to open native keyboards for type 'date'\n setFocus();\n }, 50);\n }\n}\n\nfunction onNativeFocus(event: Event): void {\n // do nothing if client is not mobile\n if (!isMobileNative.value || !input.value) return;\n\n // when input is not editable jet\n if (input.value.type === \"text\") {\n // prevent focus\n event.preventDefault();\n event.stopPropagation();\n }\n // only emit focus event if editable\n else onFocus(event);\n}\n\nfunction onNativeBlur(event: Event): void {\n // do nothing if client is not mobile\n if (!isMobileNative.value || !input.value) return;\n\n // when the input does not have any value\n if (!input.value.value) {\n // make the input uneditable\n input.value.readOnly = true;\n input.value.type = \"text\";\n }\n // emit blur event\n onBlur(event);\n}\n\nfunction onNativeChange(event: Event): void {\n const value = (event.target as HTMLInputElement).value\n ? (event.target as HTMLInputElement).value\n : \"\";\n\n // when the input does not have any value\n if (!value && input.value) {\n input.value.value = value;\n input.value.blur();\n }\n\n setValue(value);\n}\n\n// --- Computed Component Classes ---\n\nconst attrs = useAttrs();\n\nconst inputBind = computed(() => ({\n ...parentField?.value?.inputAttrs,\n ...attrs,\n inputClass: props.pickerProps.inputClass,\n ...props.pickerProps.inputClasses,\n}));\n\nconst dropdownBind = computed(() => ({\n \"root-class\": getActiveClasses(props.dropdownClasses),\n \"teleport-class\": getActiveClasses(props.rootClasses),\n ...props.pickerProps.dropdownClasses,\n}));\n\n// --- Expose Public Functionalities ---\n\n/** expose functionalities for programmatic usage */\ndefineExpose({ checkHtml5Validity, focus: setFocus });\n</script>\n\n<template>\n <div :data-oruga=\"dataOruga\" :class=\"rootClasses\" @click=\"onNativeClick\">\n <o-dropdown\n v-if=\"!isMobileNative\"\n ref=\"dropdownComponent\"\n v-bind=\"dropdownBind\"\n v-model:active=\"isActive\"\n :triggers=\"triggers\"\n :position=\"pickerProps.position\"\n :disabled=\"pickerProps.disabled\"\n :inline=\"pickerProps.inline\"\n :mobile-modal=\"pickerProps.mobileModal\"\n :desktop-modal=\"pickerProps.desktopModal\"\n :mobile-breakpoint=\"pickerProps.mobileBreakpoint\"\n :teleport=\"pickerProps.teleport\">\n <template v-if=\"!pickerProps.inline\" #trigger>\n <slot name=\"trigger\">\n <o-input\n ref=\"inputComponent\"\n v-bind=\"inputBind\"\n v-model=\"inputValue\"\n :placeholder=\"pickerProps.placeholder\"\n :size=\"pickerProps.size\"\n :icon-pack=\"pickerProps.iconPack\"\n :icon=\"pickerProps.icon\"\n :icon-right=\"pickerProps.iconRight\"\n :icon-right-clickable=\"pickerProps.iconRightClickable\"\n :expanded=\"pickerProps.expanded\"\n :rounded=\"pickerProps.rounded\"\n :disabled=\"pickerProps.disabled\"\n :readonly=\"pickerProps.readonly\"\n autocomplete=\"off\"\n :use-html5-validation=\"false\"\n @invalid=\"onInvalid\"\n @click=\"onInputClick\"\n @keyup.enter=\"togglePicker(true)\"\n @change=\"onChange\"\n @focus=\"onFocus\"\n @blur=\"onBlur\"\n @icon-click=\"$emit('icon-click', $event)\"\n @icon-right-click=\"$emit('icon-right-click', $event)\" />\n </slot>\n </template>\n\n <o-dropdown-item\n override\n tag=\"div\"\n :item-class=\"boxClass\"\n :disabled=\"pickerProps.disabled\"\n :clickable=\"false\"\n @keydown.left=\"$emit('left', $event)\"\n @keydown.right=\"$emit('right', $event)\">\n <slot />\n </o-dropdown-item>\n </o-dropdown>\n\n <!-- Native Picker -->\n <template v-else>\n <slot name=\"trigger\">\n <o-input\n ref=\"nativeInputComponent\"\n v-bind=\"inputBind\"\n v-model=\"inputValue\"\n :type=\"initialNativeType\"\n :min=\"formatter(min, true)\"\n :max=\"formatter(max, true)\"\n :step=\"step\"\n :placeholder=\"pickerProps.placeholder\"\n :size=\"pickerProps.size\"\n :icon-pack=\"pickerProps.iconPack\"\n :icon=\"pickerProps.icon\"\n :icon-right=\"pickerProps.iconRight\"\n :icon-right-clickable=\"pickerProps.iconRightClickable\"\n :rounded=\"pickerProps.rounded\"\n :disabled=\"pickerProps.disabled\"\n :readonly=\"initialNativeType == 'text'\"\n autocomplete=\"off\"\n :use-html5-validation=\"false\"\n @change=\"onNativeChange\"\n @focus=\"onNativeFocus\"\n @blur=\"onNativeBlur\"\n @invalid=\"onInvalid\"\n @icon-click=\"$emit('icon-click', $event)\"\n @icon-right-click=\"$emit('icon-right-click', $event)\" />\n </slot>\n </template>\n </div>\n</template>\n","type MonthType =\n | \"numeric\"\n | \"2-digit\"\n | \"long\"\n | \"short\"\n | \"narrow\"\n | undefined;\n\n/**\n * Return month names according to a specified locale\n * @param {String} locale A bcp47 localerouter. undefined will use the user browser locale\n * @param {String} format long (ex. March), short (ex. Mar) or narrow (M)\n * @return {Array<String>} An array of month names\n */\nexport function getMonthNames(\n locale?: string,\n format: MonthType = \"long\",\n): string[] {\n const dates: Date[] = [];\n for (let i = 0; i < 12; i++) {\n dates.push(new Date(2000, i, 15));\n }\n const dtf = new Intl.DateTimeFormat(locale, {\n month: format,\n });\n return dates.map((d) => dtf.format(d));\n}\n\ntype WeekdayType = \"long\" | \"short\" | \"narrow\" | undefined;\n\n/**\n * Return weekday names according to a specified locale\n * @param {String} locale A bcp47 localerouter. undefined will use the user browser locale\n * @param {Number} first day of week index\n * @param {String} format long (ex. Thursday), short (ex. Thu) or narrow (T)\n * @return {Array<String>} An array of weekday names\n */\nexport function getWeekdayNames(\n locale?: string,\n firstDayOfWeek: number = 0,\n format: WeekdayType = \"narrow\",\n): string[] {\n const dates: Date[] = [];\n for (let i = 1, j = 0; j < 7; i++) {\n const d = new Date(2000, 0, i);\n const day = d.getDay();\n if (day === firstDayOfWeek || j > 0) {\n dates.push(d);\n j++;\n }\n }\n const dtf = new Intl.DateTimeFormat(locale, {\n weekday: format,\n });\n return dates.map((d) => dtf.format(d));\n}\n\n/**\n * Accept a regex with group names and return an object\n * ex. matchWithGroups(/((?!=<year>)\\d+)\\/((?!=<month>)\\d+)\\/((?!=<day>)\\d+)/, '2000/12/25')\n * will return { year: 2000, month: 12, day: 25 }\n * @param {String} includes injections of (?!={groupname}) for each group\n * @param {String} the string to run regex\n * @return {Object} an object with a property for each group having the group's match as the value\n */\nexport function matchWithGroups(pattern: string, str: string): any {\n const matches = str.match(pattern);\n return (\n // get the pattern as a string\n pattern\n .toString()\n // suss out the groups\n .match(/<(.+?)>/g)\n // remove the braces\n ?.map((group) => {\n const groupMatches = group.match(/<(.+)>/);\n if (!groupMatches || groupMatches.length <= 0) {\n return null;\n }\n const match = group.match(/<(.+)>/);\n return match && match?.length > 1 ? match[1] : null;\n })\n // create an object with a property for each group having the group's match as the value\n .reduce((acc, curr, index) => {\n if (curr === null) return acc;\n if (matches && matches.length > index) {\n acc[curr] = matches[index + 1];\n } else {\n acc[curr] = null;\n }\n return acc;\n }, {} as any)\n );\n}\n\n/** Return array of all days in the week that the startingDate is within */\nexport function weekBuilder(\n startingDate: number,\n month: number,\n year: number,\n firstDayOfWeek: number,\n): Date[] {\n const thisMonth = new Date(year, month);\n\n const thisWeek: Date[] = [];\n\n const dayOfWeek = new Date(year, month, startingDate).getDay();\n\n const end =\n dayOfWeek >= firstDayOfWeek\n ? dayOfWeek - firstDayOfWeek\n : 7 - firstDayOfWeek + dayOfWeek;\n\n let daysAgo = 1;\n for (let i = 0; i < end; i++) {\n thisWeek.unshift(\n new Date(\n thisMonth.getFullYear(),\n thisMonth.getMonth(),\n startingDate - daysAgo,\n ),\n );\n daysAgo++;\n }\n\n thisWeek.push(new Date(year, month, startingDate));\n\n let daysForward = 1;\n while (thisWeek.length < 7) {\n thisWeek.push(new Date(year, month, startingDate + daysForward));\n daysForward++;\n }\n\n return thisWeek;\n}\n\nexport function firstWeekOffset(year, dow, doy): number {\n // first-week day -- which january is always in the first week (4 for iso, 1 for other)\n const fwd = 7 + dow - doy;\n // first-week day local weekday -- which local weekday is fwd\n const firstJanuary = new Date(year, 0, fwd);\n const fwdlw = (7 + firstJanuary.getDay() - dow) % 7;\n return -fwdlw + fwd - 1;\n}\n\n/** Return the number of days in a specific year */\nexport function daysInYear(year): number {\n return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0 ? 366 : 365;\n}\n\n/** Return the number of weeks in a specific year */\nexport function weeksInYear(year, dow, doy): number {\n const weekOffset = firstWeekOffset(year, dow, doy);\n const weekOffsetNext = firstWeekOffset(year + 1, dow, doy);\n return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;\n}\n"],"names":["computed","isTrueish","isMobileAgent","injectField","useTemplateRef","useInputHandler","isDefined","ref","watch","nextTick","isDate","_useModel","isClient","useEventListener","useAttrs","getActiveClasses"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,UAAM,QAAQ;AAsCd,UAAM,QAAQ;AA2Bd,UAAM,iBAAiBA,IAAA;AAAA,MACnB,MACI,CAACC,QAAU,UAAA,MAAM,YAAY,MAAM,KACnCA,kBAAU,MAAM,YAAY,YAAY,KACxCC,sBAAc,IAAI;AAAA,IAC1B;AAGM,UAAA,EAAE,YAAY,IAAIC,2BAAY;AAE9B,UAAA,cAAcC,mBAAe,mBAAmB;AAChD,UAAA,WAAWA,mBAAe,gBAAgB;AAC1C,UAAA,iBAAiBA,mBAAe,sBAAsB;AAE5D,UAAM,aAAaJ,IAAA;AAAA,MAAS,MACxB,eAAe,QAAQ,eAAe,QAAQ,SAAS;AAAA,IAC3D;AAGM,UAAA;AAAA,MACF;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACA,IAAAK,gBAAA,gBAAkC,YAAY,OAAO,MAAM,WAAW;AAM1E,UAAM,oBACF,CAACC,QAAAA,UAAU,MAAM,YAAY,WAAW,KAAKL,QAAA,UAAU,MAAM,KAAK,IAC5D,MAAM,OACN;AAGJ,UAAA,aAAaM,QAAI,EAAE;AAQzBC,QAAA;AAAA,MACI,MAAM,MAAM;AAAA,MACZ,CAAC,UAAU;AAEP,mBAAW,QAAQ,MA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