@vuetify/nightly 3.7.5-dev.2024-12-03 → 3.7.5-dev.2024-12-16
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 +3779 -3779
- package/dist/json/importMap-labs.json +20 -20
- package/dist/json/importMap.json +136 -136
- package/dist/json/web-types.json +7026 -7026
- package/dist/vuetify-labs.css +4372 -4372
- package/dist/vuetify-labs.d.ts +40 -40
- package/dist/vuetify-labs.esm.js +21 -38
- package/dist/vuetify-labs.esm.js.map +1 -1
- package/dist/vuetify-labs.js +20 -37
- package/dist/vuetify-labs.min.css +2 -2
- package/dist/vuetify.css +4189 -4189
- package/dist/vuetify.d.ts +92 -92
- package/dist/vuetify.esm.js +21 -38
- package/dist/vuetify.esm.js.map +1 -1
- package/dist/vuetify.js +20 -37
- package/dist/vuetify.js.map +1 -1
- package/dist/vuetify.min.css +2 -2
- package/dist/vuetify.min.js +876 -881
- package/dist/vuetify.min.js.map +1 -1
- package/lib/components/VAppBar/index.d.mts +6 -6
- package/lib/components/VAutocomplete/index.d.mts +6 -6
- package/lib/components/VBtn/index.d.mts +7 -7
- package/lib/components/VBtnToggle/index.d.mts +9 -9
- package/lib/components/VCarousel/VCarousel.mjs.map +1 -1
- package/lib/components/VCarousel/index.d.mts +9 -9
- package/lib/components/VCheckbox/VCheckbox.mjs +3 -3
- package/lib/components/VCheckbox/VCheckbox.mjs.map +1 -1
- package/lib/components/VChipGroup/VChipGroup.mjs.map +1 -1
- package/lib/components/VChipGroup/index.d.mts +15 -15
- package/lib/components/VCombobox/index.d.mts +6 -6
- package/lib/components/VExpansionPanel/index.d.mts +7 -7
- package/lib/components/VFab/index.d.mts +6 -6
- package/lib/components/VField/VField.mjs +3 -3
- package/lib/components/VField/VField.mjs.map +1 -1
- package/lib/components/VInput/VInput.mjs +3 -3
- package/lib/components/VInput/VInput.mjs.map +1 -1
- package/lib/components/VItemGroup/VItemGroup.mjs.map +1 -1
- package/lib/components/VItemGroup/index.d.mts +9 -9
- package/lib/components/VMenu/VMenu.mjs +3 -3
- package/lib/components/VMenu/VMenu.mjs.map +1 -1
- package/lib/components/VMenu/index.d.mts +6 -6
- package/lib/components/VRadioGroup/VRadioGroup.mjs +3 -3
- package/lib/components/VRadioGroup/VRadioGroup.mjs.map +1 -1
- package/lib/components/VRating/VRating.mjs +4 -3
- package/lib/components/VRating/VRating.mjs.map +1 -1
- package/lib/components/VSelect/index.d.mts +6 -6
- package/lib/components/VSelectionControl/VSelectionControl.mjs +3 -3
- package/lib/components/VSelectionControl/VSelectionControl.mjs.map +1 -1
- package/lib/components/VSelectionControlGroup/VSelectionControlGroup.mjs +3 -3
- package/lib/components/VSelectionControlGroup/VSelectionControlGroup.mjs.map +1 -1
- package/lib/components/VSlideGroup/index.d.mts +10 -10
- package/lib/components/VSparkline/VBarline.mjs +3 -3
- package/lib/components/VSparkline/VBarline.mjs.map +1 -1
- package/lib/components/VSparkline/VTrendline.mjs +3 -3
- package/lib/components/VSparkline/VTrendline.mjs.map +1 -1
- package/lib/components/VSwitch/VSwitch.mjs +3 -3
- package/lib/components/VSwitch/VSwitch.mjs.map +1 -1
- package/lib/components/VTabs/index.d.mts +7 -7
- package/lib/components/VTooltip/VTooltip.mjs +3 -3
- package/lib/components/VTooltip/VTooltip.mjs.map +1 -1
- package/lib/components/VWindow/index.d.mts +7 -7
- package/lib/components/index.d.mts +40 -40
- package/lib/composables/group.mjs +3 -3
- package/lib/composables/group.mjs.map +1 -1
- package/lib/composables/layout.mjs +3 -3
- package/lib/composables/layout.mjs.map +1 -1
- package/lib/composables/nested/nested.mjs +2 -2
- package/lib/composables/nested/nested.mjs.map +1 -1
- package/lib/composables/validation.mjs +3 -3
- package/lib/composables/validation.mjs.map +1 -1
- package/lib/entry-bundler.mjs +1 -1
- package/lib/framework.mjs +2 -3
- package/lib/framework.mjs.map +1 -1
- package/lib/index.d.mts +52 -52
- package/lib/util/getCurrentInstance.mjs +1 -15
- package/lib/util/getCurrentInstance.mjs.map +1 -1
- package/package.json +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"layout.mjs","names":["useResizeObserver","computed","inject","onActivated","onBeforeUnmount","onDeactivated","onMounted","provide","reactive","ref","shallowRef","convertToUnit","findChildrenWithProvide","getCurrentInstance","getUid","propsFactory","VuetifyLayoutKey","Symbol","for","VuetifyLayoutItemKey","ROOT_ZINDEX","makeLayoutProps","overlaps","type","Array","default","fullHeight","Boolean","makeLayoutItemProps","name","String","order","Number","absolute","useLayout","layout","Error","getLayoutItem","mainRect","mainStyles","useLayoutItem","options","id","vm","isKeptAlive","value","layoutItemStyles","layoutItemScrimStyles","register","active","unregister","layoutRect","generateLayers","positions","layoutSizes","activeItems","previousLayer","top","left","right","bottom","layers","layer","position","get","amount","parseInt","push","createLayout","props","parentLayout","rootZIndex","registered","Map","priorities","disabledTransitions","resizeRef","contentRect","computedOverlaps","map","overlap","filter","item","includes","split","topPosition","bottomPosition","topAmount","bottomAmount","set","uniquePriorities","Set","values","p","sort","a","b","items","transitionsEnabled","from","some","length","undefined","transition","slice","_ref","index","size","find","rootVm","isMounted","_ref2","layoutSize","elementSize","disableTransitions","instances","vnode","instanceIndex","indexOf","splice","findIndex","i","zIndex","isHorizontal","isOppositeHorizontal","isOppositeVertical","unit","styles","transform","height","width","delete","v","layoutClasses","layoutStyles","overflow","layoutRef"],"sources":["../../src/composables/layout.ts"],"sourcesContent":["// Composables\nimport { useResizeObserver } from '@/composables/resizeObserver'\n\n// Utilities\nimport {\n computed,\n inject,\n onActivated,\n onBeforeUnmount,\n onDeactivated,\n onMounted,\n provide,\n reactive,\n ref,\n shallowRef,\n} from 'vue'\nimport { convertToUnit, findChildrenWithProvide, getCurrentInstance, getUid, propsFactory } from '@/util'\n\n// Types\nimport type { ComponentInternalInstance, CSSProperties, InjectionKey, Prop, Ref } from 'vue'\n\nexport type Position = 'top' | 'left' | 'right' | 'bottom'\n\ninterface Layer {\n top: number\n bottom: number\n left: number\n right: number\n}\n\ninterface LayoutItem extends Layer {\n id: string\n size: number\n position: Position\n}\n\ninterface LayoutProvide {\n register: (\n vm: ComponentInternalInstance,\n options: {\n id: string\n order: Ref<number>\n position: Ref<Position>\n layoutSize: Ref<number | string>\n elementSize: Ref<number | string | undefined>\n active: Ref<boolean>\n disableTransitions?: Ref<boolean>\n absolute: Ref<boolean | undefined>\n }\n ) => {\n layoutItemStyles: Ref<CSSProperties>\n layoutItemScrimStyles: Ref<CSSProperties>\n zIndex: Ref<number>\n }\n unregister: (id: string) => void\n mainRect: Ref<Layer>\n mainStyles: Ref<CSSProperties>\n getLayoutItem: (id: string) => LayoutItem | undefined\n items: Ref<LayoutItem[]>\n layoutRect: Ref<DOMRectReadOnly | undefined>\n rootZIndex: Ref<number>\n}\n\nexport const VuetifyLayoutKey: InjectionKey<LayoutProvide> = Symbol.for('vuetify:layout')\nexport const VuetifyLayoutItemKey: InjectionKey<{ id: string }> = Symbol.for('vuetify:layout-item')\n\nconst ROOT_ZINDEX = 1000\n\nexport const makeLayoutProps = propsFactory({\n overlaps: {\n type: Array,\n default: () => ([]),\n } as Prop<string[]>,\n fullHeight: Boolean,\n}, 'layout')\n\n// Composables\nexport const makeLayoutItemProps = propsFactory({\n name: {\n type: String,\n },\n order: {\n type: [Number, String],\n default: 0,\n },\n absolute: Boolean,\n}, 'layout-item')\n\nexport function useLayout () {\n const layout = inject(VuetifyLayoutKey)\n\n if (!layout) throw new Error('[Vuetify] Could not find injected layout')\n\n return {\n getLayoutItem: layout.getLayoutItem,\n mainRect: layout.mainRect,\n mainStyles: layout.mainStyles,\n }\n}\n\nexport function useLayoutItem (options: {\n id: string | undefined\n order: Ref<number>\n position: Ref<Position>\n layoutSize: Ref<number | string>\n elementSize: Ref<number | string | undefined>\n active: Ref<boolean>\n disableTransitions?: Ref<boolean>\n absolute: Ref<boolean | undefined>\n}) {\n const layout = inject(VuetifyLayoutKey)\n\n if (!layout) throw new Error('[Vuetify] Could not find injected layout')\n\n const id = options.id ?? `layout-item-${getUid()}`\n\n const vm = getCurrentInstance('useLayoutItem')\n\n provide(VuetifyLayoutItemKey, { id })\n\n const isKeptAlive = shallowRef(false)\n onDeactivated(() => isKeptAlive.value = true)\n onActivated(() => isKeptAlive.value = false)\n\n const {\n layoutItemStyles,\n layoutItemScrimStyles,\n } = layout.register(vm, {\n ...options,\n active: computed(() => isKeptAlive.value ? false : options.active.value),\n id,\n })\n\n onBeforeUnmount(() => layout.unregister(id))\n\n return { layoutItemStyles, layoutRect: layout.layoutRect, layoutItemScrimStyles }\n}\n\nconst generateLayers = (\n layout: string[],\n positions: Map<string, Ref<Position>>,\n layoutSizes: Map<string, Ref<number | string>>,\n activeItems: Map<string, Ref<boolean>>,\n): { id: string, layer: Layer }[] => {\n let previousLayer: Layer = { top: 0, left: 0, right: 0, bottom: 0 }\n const layers = [{ id: '', layer: { ...previousLayer } }]\n for (const id of layout) {\n const position = positions.get(id)\n const amount = layoutSizes.get(id)\n const active = activeItems.get(id)\n if (!position || !amount || !active) continue\n\n const layer = {\n ...previousLayer,\n [position.value]: parseInt(previousLayer[position.value], 10) + (active.value ? parseInt(amount.value, 10) : 0),\n }\n\n layers.push({\n id,\n layer,\n })\n\n previousLayer = layer\n }\n\n return layers\n}\n\nexport function createLayout (props: { overlaps?: string[], fullHeight?: boolean }) {\n const parentLayout = inject(VuetifyLayoutKey, null)\n const rootZIndex = computed(() => parentLayout ? parentLayout.rootZIndex.value - 100 : ROOT_ZINDEX)\n const registered = ref<string[]>([])\n const positions = reactive(new Map<string, Ref<Position>>())\n const layoutSizes = reactive(new Map<string, Ref<number | string>>())\n const priorities = reactive(new Map<string, Ref<number>>())\n const activeItems = reactive(new Map<string, Ref<boolean>>())\n const disabledTransitions = reactive(new Map<string, Ref<boolean>>())\n const { resizeRef, contentRect: layoutRect } = useResizeObserver()\n\n const computedOverlaps = computed(() => {\n const map = new Map<string, { position: Position, amount: number }>()\n const overlaps = props.overlaps ?? []\n for (const overlap of overlaps.filter(item => item.includes(':'))) {\n const [top, bottom] = overlap.split(':')\n if (!registered.value.includes(top) || !registered.value.includes(bottom)) continue\n\n const topPosition = positions.get(top)\n const bottomPosition = positions.get(bottom)\n const topAmount = layoutSizes.get(top)\n const bottomAmount = layoutSizes.get(bottom)\n\n if (!topPosition || !bottomPosition || !topAmount || !bottomAmount) continue\n\n map.set(bottom, { position: topPosition.value, amount: parseInt(topAmount.value, 10) })\n map.set(top, { position: bottomPosition.value, amount: -parseInt(bottomAmount.value, 10) })\n }\n\n return map\n })\n\n const layers = computed(() => {\n const uniquePriorities = [...new Set([...priorities.values()].map(p => p.value))].sort((a, b) => a - b)\n const layout = []\n for (const p of uniquePriorities) {\n const items = registered.value.filter(id => priorities.get(id)?.value === p)\n layout.push(...items)\n }\n return generateLayers(layout, positions, layoutSizes, activeItems)\n })\n\n const transitionsEnabled = computed(() => {\n return !Array.from(disabledTransitions.values()).some(ref => ref.value)\n })\n\n const mainRect = computed(() => {\n return layers.value[layers.value.length - 1].layer\n })\n\n const mainStyles = computed<CSSProperties>(() => {\n return {\n '--v-layout-left': convertToUnit(mainRect.value.left),\n '--v-layout-right': convertToUnit(mainRect.value.right),\n '--v-layout-top': convertToUnit(mainRect.value.top),\n '--v-layout-bottom': convertToUnit(mainRect.value.bottom),\n ...(transitionsEnabled.value ? undefined : { transition: 'none' }),\n }\n })\n\n const items = computed(() => {\n return layers.value.slice(1).map(({ id }, index) => {\n const { layer } = layers.value[index]\n const size = layoutSizes.get(id)\n const position = positions.get(id)\n\n return {\n id,\n ...layer,\n size: Number(size!.value),\n position: position!.value,\n }\n })\n })\n\n const getLayoutItem = (id: string) => {\n return items.value.find(item => item.id === id)\n }\n\n const rootVm = getCurrentInstance('createLayout')\n\n const isMounted = shallowRef(false)\n onMounted(() => {\n isMounted.value = true\n })\n\n provide(VuetifyLayoutKey, {\n register: (\n vm: ComponentInternalInstance,\n {\n id,\n order,\n position,\n layoutSize,\n elementSize,\n active,\n disableTransitions,\n absolute,\n }\n ) => {\n priorities.set(id, order)\n positions.set(id, position)\n layoutSizes.set(id, layoutSize)\n activeItems.set(id, active)\n disableTransitions && disabledTransitions.set(id, disableTransitions)\n\n const instances = findChildrenWithProvide(VuetifyLayoutItemKey, rootVm?.vnode)\n const instanceIndex = instances.indexOf(vm)\n\n if (instanceIndex > -1) registered.value.splice(instanceIndex, 0, id)\n else registered.value.push(id)\n\n const index = computed(() => items.value.findIndex(i => i.id === id))\n const zIndex = computed(() => rootZIndex.value + (layers.value.length * 2) - (index.value * 2))\n\n const layoutItemStyles = computed<CSSProperties>(() => {\n const isHorizontal = position.value === 'left' || position.value === 'right'\n const isOppositeHorizontal = position.value === 'right'\n const isOppositeVertical = position.value === 'bottom'\n const size = elementSize.value ?? layoutSize.value\n const unit = size === 0 ? '%' : 'px'\n\n const styles = {\n [position.value]: 0,\n zIndex: zIndex.value,\n transform: `translate${isHorizontal ? 'X' : 'Y'}(${(active.value ? 0 : -(size === 0 ? 100 : size)) * (isOppositeHorizontal || isOppositeVertical ? -1 : 1)}${unit})`,\n position: absolute.value || rootZIndex.value !== ROOT_ZINDEX ? 'absolute' : 'fixed',\n ...(transitionsEnabled.value ? undefined : { transition: 'none' }),\n } as const\n\n if (!isMounted.value) return styles\n\n const item = items.value[index.value]\n\n if (!item) throw new Error(`[Vuetify] Could not find layout item \"${id}\"`)\n\n const overlap = computedOverlaps.value.get(id)\n if (overlap) {\n item[overlap.position] += overlap.amount\n }\n\n return {\n ...styles,\n height:\n isHorizontal ? `calc(100% - ${item.top}px - ${item.bottom}px)`\n : elementSize.value ? `${elementSize.value}px`\n : undefined,\n left: isOppositeHorizontal ? undefined : `${item.left}px`,\n right: isOppositeHorizontal ? `${item.right}px` : undefined,\n top: position.value !== 'bottom' ? `${item.top}px` : undefined,\n bottom: position.value !== 'top' ? `${item.bottom}px` : undefined,\n width:\n !isHorizontal ? `calc(100% - ${item.left}px - ${item.right}px)`\n : elementSize.value ? `${elementSize.value}px`\n : undefined,\n }\n })\n\n const layoutItemScrimStyles = computed<CSSProperties>(() => ({\n zIndex: zIndex.value - 1,\n }))\n\n return { layoutItemStyles, layoutItemScrimStyles, zIndex }\n },\n unregister: (id: string) => {\n priorities.delete(id)\n positions.delete(id)\n layoutSizes.delete(id)\n activeItems.delete(id)\n disabledTransitions.delete(id)\n registered.value = registered.value.filter(v => v !== id)\n },\n mainRect,\n mainStyles,\n getLayoutItem,\n items,\n layoutRect,\n rootZIndex,\n })\n\n const layoutClasses = computed(() => [\n 'v-layout',\n { 'v-layout--full-height': props.fullHeight },\n ])\n\n const layoutStyles = computed(() => ({\n zIndex: parentLayout ? rootZIndex.value : undefined,\n position: parentLayout ? 'relative' as const : undefined,\n overflow: parentLayout ? 'hidden' : undefined,\n }))\n\n return {\n layoutClasses,\n layoutStyles,\n getLayoutItem,\n items,\n layoutRect,\n layoutRef: resizeRef,\n }\n}\n"],"mappings":"AAAA;AAAA,SACSA,iBAAiB,gCAE1B;AACA,SACEC,QAAQ,EACRC,MAAM,EACNC,WAAW,EACXC,eAAe,EACfC,aAAa,EACbC,SAAS,EACTC,OAAO,EACPC,QAAQ,EACRC,GAAG,EACHC,UAAU,QACL,KAAK;AAAA,SACHC,aAAa,EAAEC,uBAAuB,EAAEC,kBAAkB,EAAEC,MAAM,EAAEC,YAAY,6BAEzF;AA6CA,OAAO,MAAMC,gBAA6C,GAAGC,MAAM,CAACC,GAAG,CAAC,gBAAgB,CAAC;AACzF,OAAO,MAAMC,oBAAkD,GAAGF,MAAM,CAACC,GAAG,CAAC,qBAAqB,CAAC;AAEnG,MAAME,WAAW,GAAG,IAAI;AAExB,OAAO,MAAMC,eAAe,GAAGN,YAAY,CAAC;EAC1CO,QAAQ,EAAE;IACRC,IAAI,EAAEC,KAAK;IACXC,OAAO,EAAEA,CAAA,KAAO;EAClB,CAAmB;EACnBC,UAAU,EAAEC;AACd,CAAC,EAAE,QAAQ,CAAC;;AAEZ;AACA,OAAO,MAAMC,mBAAmB,GAAGb,YAAY,CAAC;EAC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D,CAAC,IAAIA,CAAC,KAAK1F,EAAE,CAAC;IAC3D,CAAC;IACDJ,QAAQ;IACRC,UAAU;IACVF,aAAa;IACb4D,KAAK;IACL9C,UAAU;IACVoB;EACF,CAAC,CAAC;EAEF,MAAM8D,aAAa,GAAGpI,QAAQ,CAAC,MAAM,CACnC,UAAU,EACV;IAAE,uBAAuB,EAAEoE,KAAK,CAAC3C;EAAW,CAAC,CAC9C,CAAC;EAEF,MAAM4G,YAAY,GAAGrI,QAAQ,CAAC,OAAO;IACnCyH,MAAM,EAAEpD,YAAY,GAAGC,UAAU,CAAC1B,KAAK,GAAGyD,SAAS;IACnDvC,QAAQ,EAAEO,YAAY,GAAG,UAAU,GAAYgC,SAAS;IACxDiC,QAAQ,EAAEjE,YAAY,GAAG,QAAQ,GAAGgC;EACtC,CAAC,CAAC,CAAC;EAEH,OAAO;IACL+B,aAAa;IACbC,YAAY;IACZjG,aAAa;IACb4D,KAAK;IACL9C,UAAU;IACVqF,SAAS,EAAE5D;EACb,CAAC;AACH","ignoreList":[]}
|
1
|
+
{"version":3,"file":"layout.mjs","names":["useResizeObserver","computed","inject","onActivated","onBeforeUnmount","onDeactivated","onMounted","provide","reactive","ref","shallowRef","useId","convertToUnit","findChildrenWithProvide","getCurrentInstance","propsFactory","VuetifyLayoutKey","Symbol","for","VuetifyLayoutItemKey","ROOT_ZINDEX","makeLayoutProps","overlaps","type","Array","default","fullHeight","Boolean","makeLayoutItemProps","name","String","order","Number","absolute","useLayout","layout","Error","getLayoutItem","mainRect","mainStyles","useLayoutItem","options","id","vm","isKeptAlive","value","layoutItemStyles","layoutItemScrimStyles","register","active","unregister","layoutRect","generateLayers","positions","layoutSizes","activeItems","previousLayer","top","left","right","bottom","layers","layer","position","get","amount","parseInt","push","createLayout","props","parentLayout","rootZIndex","registered","Map","priorities","disabledTransitions","resizeRef","contentRect","computedOverlaps","map","overlap","filter","item","includes","split","topPosition","bottomPosition","topAmount","bottomAmount","set","uniquePriorities","Set","values","p","sort","a","b","items","transitionsEnabled","from","some","length","undefined","transition","slice","_ref","index","size","find","rootVm","isMounted","_ref2","layoutSize","elementSize","disableTransitions","instances","vnode","instanceIndex","indexOf","splice","findIndex","i","zIndex","isHorizontal","isOppositeHorizontal","isOppositeVertical","unit","styles","transform","height","width","delete","v","layoutClasses","layoutStyles","overflow","layoutRef"],"sources":["../../src/composables/layout.ts"],"sourcesContent":["// Composables\nimport { useResizeObserver } from '@/composables/resizeObserver'\n\n// Utilities\nimport {\n computed,\n inject,\n onActivated,\n onBeforeUnmount,\n onDeactivated,\n onMounted,\n provide,\n reactive,\n ref,\n shallowRef,\n useId,\n} from 'vue'\nimport { convertToUnit, findChildrenWithProvide, getCurrentInstance, propsFactory } from '@/util'\n\n// Types\nimport type { ComponentInternalInstance, CSSProperties, InjectionKey, Prop, Ref } from 'vue'\n\nexport type Position = 'top' | 'left' | 'right' | 'bottom'\n\ninterface Layer {\n top: number\n bottom: number\n left: number\n right: number\n}\n\ninterface LayoutItem extends Layer {\n id: string\n size: number\n position: Position\n}\n\ninterface LayoutProvide {\n register: (\n vm: ComponentInternalInstance,\n options: {\n id: string\n order: Ref<number>\n position: Ref<Position>\n layoutSize: Ref<number | string>\n elementSize: Ref<number | string | undefined>\n active: Ref<boolean>\n disableTransitions?: Ref<boolean>\n absolute: Ref<boolean | undefined>\n }\n ) => {\n layoutItemStyles: Ref<CSSProperties>\n layoutItemScrimStyles: Ref<CSSProperties>\n zIndex: Ref<number>\n }\n unregister: (id: string) => void\n mainRect: Ref<Layer>\n mainStyles: Ref<CSSProperties>\n getLayoutItem: (id: string) => LayoutItem | undefined\n items: Ref<LayoutItem[]>\n layoutRect: Ref<DOMRectReadOnly | undefined>\n rootZIndex: Ref<number>\n}\n\nexport const VuetifyLayoutKey: InjectionKey<LayoutProvide> = Symbol.for('vuetify:layout')\nexport const VuetifyLayoutItemKey: InjectionKey<{ id: string }> = Symbol.for('vuetify:layout-item')\n\nconst ROOT_ZINDEX = 1000\n\nexport const makeLayoutProps = propsFactory({\n overlaps: {\n type: Array,\n default: () => ([]),\n } as Prop<string[]>,\n fullHeight: Boolean,\n}, 'layout')\n\n// Composables\nexport const makeLayoutItemProps = propsFactory({\n name: {\n type: String,\n },\n order: {\n type: [Number, String],\n default: 0,\n },\n absolute: Boolean,\n}, 'layout-item')\n\nexport function useLayout () {\n const layout = inject(VuetifyLayoutKey)\n\n if (!layout) throw new Error('[Vuetify] Could not find injected layout')\n\n return {\n getLayoutItem: layout.getLayoutItem,\n mainRect: layout.mainRect,\n mainStyles: layout.mainStyles,\n }\n}\n\nexport function useLayoutItem (options: {\n id: string | undefined\n order: Ref<number>\n position: Ref<Position>\n layoutSize: Ref<number | string>\n elementSize: Ref<number | string | undefined>\n active: Ref<boolean>\n disableTransitions?: Ref<boolean>\n absolute: Ref<boolean | undefined>\n}) {\n const layout = inject(VuetifyLayoutKey)\n\n if (!layout) throw new Error('[Vuetify] Could not find injected layout')\n\n const id = options.id ?? `layout-item-${useId()}`\n\n const vm = getCurrentInstance('useLayoutItem')\n\n provide(VuetifyLayoutItemKey, { id })\n\n const isKeptAlive = shallowRef(false)\n onDeactivated(() => isKeptAlive.value = true)\n onActivated(() => isKeptAlive.value = false)\n\n const {\n layoutItemStyles,\n layoutItemScrimStyles,\n } = layout.register(vm, {\n ...options,\n active: computed(() => isKeptAlive.value ? false : options.active.value),\n id,\n })\n\n onBeforeUnmount(() => layout.unregister(id))\n\n return { layoutItemStyles, layoutRect: layout.layoutRect, layoutItemScrimStyles }\n}\n\nconst generateLayers = (\n layout: string[],\n positions: Map<string, Ref<Position>>,\n layoutSizes: Map<string, Ref<number | string>>,\n activeItems: Map<string, Ref<boolean>>,\n): { id: string, layer: Layer }[] => {\n let previousLayer: Layer = { top: 0, left: 0, right: 0, bottom: 0 }\n const layers = [{ id: '', layer: { ...previousLayer } }]\n for (const id of layout) {\n const position = positions.get(id)\n const amount = layoutSizes.get(id)\n const active = activeItems.get(id)\n if (!position || !amount || !active) continue\n\n const layer = {\n ...previousLayer,\n [position.value]: parseInt(previousLayer[position.value], 10) + (active.value ? parseInt(amount.value, 10) : 0),\n }\n\n layers.push({\n id,\n layer,\n })\n\n previousLayer = layer\n }\n\n return layers\n}\n\nexport function createLayout (props: { overlaps?: string[], fullHeight?: boolean }) {\n const parentLayout = inject(VuetifyLayoutKey, null)\n const rootZIndex = computed(() => parentLayout ? parentLayout.rootZIndex.value - 100 : ROOT_ZINDEX)\n const registered = ref<string[]>([])\n const positions = reactive(new Map<string, Ref<Position>>())\n const layoutSizes = reactive(new Map<string, Ref<number | string>>())\n const priorities = reactive(new Map<string, Ref<number>>())\n const activeItems = reactive(new Map<string, Ref<boolean>>())\n const disabledTransitions = reactive(new Map<string, Ref<boolean>>())\n const { resizeRef, contentRect: layoutRect } = useResizeObserver()\n\n const computedOverlaps = computed(() => {\n const map = new Map<string, { position: Position, amount: number }>()\n const overlaps = props.overlaps ?? []\n for (const overlap of overlaps.filter(item => item.includes(':'))) {\n const [top, bottom] = overlap.split(':')\n if (!registered.value.includes(top) || !registered.value.includes(bottom)) continue\n\n const topPosition = positions.get(top)\n const bottomPosition = positions.get(bottom)\n const topAmount = layoutSizes.get(top)\n const bottomAmount = layoutSizes.get(bottom)\n\n if (!topPosition || !bottomPosition || !topAmount || !bottomAmount) continue\n\n map.set(bottom, { position: topPosition.value, amount: parseInt(topAmount.value, 10) })\n map.set(top, { position: bottomPosition.value, amount: -parseInt(bottomAmount.value, 10) })\n }\n\n return map\n })\n\n const layers = computed(() => {\n const uniquePriorities = [...new Set([...priorities.values()].map(p => p.value))].sort((a, b) => a - b)\n const layout = []\n for (const p of uniquePriorities) {\n const items = registered.value.filter(id => priorities.get(id)?.value === p)\n layout.push(...items)\n }\n return generateLayers(layout, positions, layoutSizes, activeItems)\n })\n\n const transitionsEnabled = computed(() => {\n return !Array.from(disabledTransitions.values()).some(ref => ref.value)\n })\n\n const mainRect = computed(() => {\n return layers.value[layers.value.length - 1].layer\n })\n\n const mainStyles = computed<CSSProperties>(() => {\n return {\n '--v-layout-left': convertToUnit(mainRect.value.left),\n '--v-layout-right': convertToUnit(mainRect.value.right),\n '--v-layout-top': convertToUnit(mainRect.value.top),\n '--v-layout-bottom': convertToUnit(mainRect.value.bottom),\n ...(transitionsEnabled.value ? undefined : { transition: 'none' }),\n }\n })\n\n const items = computed(() => {\n return layers.value.slice(1).map(({ id }, index) => {\n const { layer } = layers.value[index]\n const size = layoutSizes.get(id)\n const position = positions.get(id)\n\n return {\n id,\n ...layer,\n size: Number(size!.value),\n position: position!.value,\n }\n })\n })\n\n const getLayoutItem = (id: string) => {\n return items.value.find(item => item.id === id)\n }\n\n const rootVm = getCurrentInstance('createLayout')\n\n const isMounted = shallowRef(false)\n onMounted(() => {\n isMounted.value = true\n })\n\n provide(VuetifyLayoutKey, {\n register: (\n vm: ComponentInternalInstance,\n {\n id,\n order,\n position,\n layoutSize,\n elementSize,\n active,\n disableTransitions,\n absolute,\n }\n ) => {\n priorities.set(id, order)\n positions.set(id, position)\n layoutSizes.set(id, layoutSize)\n activeItems.set(id, active)\n disableTransitions && disabledTransitions.set(id, disableTransitions)\n\n const instances = findChildrenWithProvide(VuetifyLayoutItemKey, rootVm?.vnode)\n const instanceIndex = instances.indexOf(vm)\n\n if (instanceIndex > -1) registered.value.splice(instanceIndex, 0, id)\n else registered.value.push(id)\n\n const index = computed(() => items.value.findIndex(i => i.id === id))\n const zIndex = computed(() => rootZIndex.value + (layers.value.length * 2) - (index.value * 2))\n\n const layoutItemStyles = computed<CSSProperties>(() => {\n const isHorizontal = position.value === 'left' || position.value === 'right'\n const isOppositeHorizontal = position.value === 'right'\n const isOppositeVertical = position.value === 'bottom'\n const size = elementSize.value ?? layoutSize.value\n const unit = size === 0 ? '%' : 'px'\n\n const styles = {\n [position.value]: 0,\n zIndex: zIndex.value,\n transform: `translate${isHorizontal ? 'X' : 'Y'}(${(active.value ? 0 : -(size === 0 ? 100 : size)) * (isOppositeHorizontal || isOppositeVertical ? -1 : 1)}${unit})`,\n position: absolute.value || rootZIndex.value !== ROOT_ZINDEX ? 'absolute' : 'fixed',\n ...(transitionsEnabled.value ? undefined : { transition: 'none' }),\n } as const\n\n if (!isMounted.value) return styles\n\n const item = items.value[index.value]\n\n if (!item) throw new Error(`[Vuetify] Could not find layout item \"${id}\"`)\n\n const overlap = computedOverlaps.value.get(id)\n if (overlap) {\n item[overlap.position] += overlap.amount\n }\n\n return {\n ...styles,\n height:\n isHorizontal ? `calc(100% - ${item.top}px - ${item.bottom}px)`\n : elementSize.value ? `${elementSize.value}px`\n : undefined,\n left: isOppositeHorizontal ? undefined : `${item.left}px`,\n right: isOppositeHorizontal ? `${item.right}px` : undefined,\n top: position.value !== 'bottom' ? `${item.top}px` : undefined,\n bottom: position.value !== 'top' ? `${item.bottom}px` : undefined,\n width:\n !isHorizontal ? `calc(100% - ${item.left}px - ${item.right}px)`\n : elementSize.value ? `${elementSize.value}px`\n : undefined,\n }\n })\n\n const layoutItemScrimStyles = computed<CSSProperties>(() => ({\n zIndex: zIndex.value - 1,\n }))\n\n return { layoutItemStyles, layoutItemScrimStyles, zIndex }\n },\n unregister: (id: string) => {\n priorities.delete(id)\n positions.delete(id)\n layoutSizes.delete(id)\n activeItems.delete(id)\n disabledTransitions.delete(id)\n registered.value = registered.value.filter(v => v !== id)\n },\n mainRect,\n mainStyles,\n getLayoutItem,\n items,\n layoutRect,\n rootZIndex,\n })\n\n const layoutClasses = computed(() => [\n 'v-layout',\n { 'v-layout--full-height': props.fullHeight },\n ])\n\n const layoutStyles = computed(() => ({\n zIndex: parentLayout ? rootZIndex.value : undefined,\n position: parentLayout ? 'relative' as const : undefined,\n overflow: parentLayout ? 'hidden' : undefined,\n }))\n\n return {\n layoutClasses,\n layoutStyles,\n getLayoutItem,\n items,\n layoutRect,\n layoutRef: resizeRef,\n }\n}\n"],"mappings":"AAAA;AAAA,SACSA,iBAAiB,gCAE1B;AACA,SACEC,QAAQ,EACRC,MAAM,EACNC,WAAW,EACXC,eAAe,EACf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[]}
|
@@ -4,7 +4,7 @@ import { computed, inject, onBeforeUnmount, provide, ref, shallowRef, toRaw, toR
|
|
4
4
|
import { independentActiveStrategy, independentSingleActiveStrategy, leafActiveStrategy, leafSingleActiveStrategy } from "./activeStrategies.mjs";
|
5
5
|
import { listOpenStrategy, multipleOpenStrategy, singleOpenStrategy } from "./openStrategies.mjs";
|
6
6
|
import { classicSelectStrategy, independentSelectStrategy, independentSingleSelectStrategy, leafSelectStrategy, leafSingleSelectStrategy } from "./selectStrategies.mjs";
|
7
|
-
import { consoleError, getCurrentInstance,
|
7
|
+
import { consoleError, getCurrentInstance, propsFactory } from "../../util/index.mjs"; // Types
|
8
8
|
export const VNestedSymbol = Symbol.for('vuetify:nested');
|
9
9
|
export const emptyNested = {
|
10
10
|
id: shallowRef(),
|
@@ -220,7 +220,7 @@ export const useNested = props => {
|
|
220
220
|
};
|
221
221
|
export const useNestedItem = (id, isGroup) => {
|
222
222
|
const parent = inject(VNestedSymbol, emptyNested);
|
223
|
-
const uidSymbol = Symbol(
|
223
|
+
const uidSymbol = Symbol('nested item');
|
224
224
|
const computedId = computed(() => id.value !== undefined ? id.value : uidSymbol);
|
225
225
|
const item = {
|
226
226
|
...parent,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nested.mjs","names":["useProxiedModel","computed","inject","onBeforeUnmount","provide","ref","shallowRef","toRaw","toRef","independentActiveStrategy","independentSingleActiveStrategy","leafActiveStrategy","leafSingleActiveStrategy","listOpenStrategy","multipleOpenStrategy","singleOpenStrategy","classicSelectStrategy","independentSelectStrategy","independentSingleSelectStrategy","leafSelectStrategy","leafSingleSelectStrategy","consoleError","getCurrentInstance","getUid","propsFactory","VNestedSymbol","Symbol","for","emptyNested","id","root","register","unregister","parents","Map","children","open","openOnSelect","activate","select","activatable","selectable","opened","Set","activated","selected","selectedValues","getPath","makeNestedProps","Boolean","activeStrategy","String","Function","Object","selectStrategy","openStrategy","mandatory","useNested","props","isUnmounted","v","values","value","in","out","path","parent","unshift","get","vm","nodeIds","nested","arr","key","entries","push","parentId","isGroup","has","map","join","newPath","concat","add","set","delete","list","filter","child","event","emit","newOpened","newSelected","newActivated","useNestedItem","uidSymbol","computedId","undefined","item","e","isOpen","isActivated","isSelected","isIndeterminate","isLeaf","isGroupActivator","useNestedGroupActivator"],"sources":["../../../src/composables/nested/nested.ts"],"sourcesContent":["// Composables\nimport { useProxiedModel } from '@/composables/proxiedModel'\n\n// Utilities\nimport { computed, inject, onBeforeUnmount, provide, ref, shallowRef, toRaw, toRef } from 'vue'\nimport {\n independentActiveStrategy,\n independentSingleActiveStrategy,\n leafActiveStrategy,\n leafSingleActiveStrategy,\n} from './activeStrategies'\nimport { listOpenStrategy, multipleOpenStrategy, singleOpenStrategy } from './openStrategies'\nimport {\n classicSelectStrategy,\n independentSelectStrategy,\n independentSingleSelectStrategy,\n leafSelectStrategy,\n leafSingleSelectStrategy,\n} from './selectStrategies'\nimport { consoleError, getCurrentInstance, getUid, propsFactory } from '@/util'\n\n// Types\nimport type { InjectionKey, PropType, Ref } from 'vue'\nimport type { ActiveStrategy } from './activeStrategies'\nimport type { OpenStrategy } from './openStrategies'\nimport type { SelectStrategy } from './selectStrategies'\nimport type { EventProp } from '@/util'\n\nexport type ActiveStrategyProp =\n | 'single-leaf'\n | 'leaf'\n | 'independent'\n | 'single-independent'\n | ActiveStrategy\n | ((mandatory: boolean) => ActiveStrategy)\nexport type SelectStrategyProp =\n | 'single-leaf'\n | 'leaf'\n | 'independent'\n | 'single-independent'\n | 'classic'\n | SelectStrategy\n | ((mandatory: boolean) => SelectStrategy)\nexport type OpenStrategyProp = 'single' | 'multiple' | 'list' | OpenStrategy\n\nexport interface NestedProps {\n activatable: boolean\n selectable: boolean\n activeStrategy: ActiveStrategyProp | undefined\n selectStrategy: SelectStrategyProp | undefined\n openStrategy: OpenStrategyProp | undefined\n activated: any\n selected: any\n opened: any\n mandatory: boolean\n 'onUpdate:activated': EventProp<[any]> | undefined\n 'onUpdate:selected': EventProp<[any]> | undefined\n 'onUpdate:opened': EventProp<[any]> | undefined\n}\n\ntype NestedProvide = {\n id: Ref<unknown>\n isGroupActivator?: boolean\n root: {\n children: Ref<Map<unknown, unknown[]>>\n parents: Ref<Map<unknown, unknown>>\n activatable: Ref<boolean>\n selectable: Ref<boolean>\n opened: Ref<Set<unknown>>\n activated: Ref<Set<unknown>>\n selected: Ref<Map<unknown, 'on' | 'off' | 'indeterminate'>>\n selectedValues: Ref<unknown[]>\n register: (id: unknown, parentId: unknown, isGroup?: boolean) => void\n unregister: (id: unknown) => void\n open: (id: unknown, value: boolean, event?: Event) => void\n activate: (id: unknown, value: boolean, event?: Event) => void\n select: (id: unknown, value: boolean, event?: Event) => void\n openOnSelect: (id: unknown, value: boolean, event?: Event) => void\n getPath: (id: unknown) => unknown[]\n }\n}\n\nexport const VNestedSymbol: InjectionKey<NestedProvide> = Symbol.for('vuetify:nested')\n\nexport const emptyNested: NestedProvide = {\n id: shallowRef(),\n root: {\n register: () => null,\n unregister: () => null,\n parents: ref(new Map()),\n children: ref(new Map()),\n open: () => null,\n openOnSelect: () => null,\n activate: () => null,\n select: () => null,\n activatable: ref(false),\n selectable: ref(false),\n opened: ref(new Set()),\n activated: ref(new Set()),\n selected: ref(new Map()),\n selectedValues: ref([]),\n getPath: () => [],\n },\n}\n\nexport const makeNestedProps = propsFactory({\n activatable: Boolean,\n selectable: Boolean,\n activeStrategy: [String, Function, Object] as PropType<ActiveStrategyProp>,\n selectStrategy: [String, Function, Object] as PropType<SelectStrategyProp>,\n openStrategy: [String, Object] as PropType<OpenStrategyProp>,\n opened: null,\n activated: null,\n selected: null,\n mandatory: Boolean,\n}, 'nested')\n\nexport const useNested = (props: NestedProps) => {\n let isUnmounted = false\n const children = ref(new Map<unknown, unknown[]>())\n const parents = ref(new Map<unknown, unknown>())\n\n const opened = useProxiedModel(props, 'opened', props.opened, v => new Set(v), v => [...v.values()])\n\n const activeStrategy = computed(() => {\n if (typeof props.activeStrategy === 'object') return props.activeStrategy\n if (typeof props.activeStrategy === 'function') return props.activeStrategy(props.mandatory)\n\n switch (props.activeStrategy) {\n case 'leaf': return leafActiveStrategy(props.mandatory)\n case 'single-leaf': return leafSingleActiveStrategy(props.mandatory)\n case 'independent': return independentActiveStrategy(props.mandatory)\n case 'single-independent':\n default: return independentSingleActiveStrategy(props.mandatory)\n }\n })\n\n const selectStrategy = computed(() => {\n if (typeof props.selectStrategy === 'object') return props.selectStrategy\n if (typeof props.selectStrategy === 'function') return props.selectStrategy(props.mandatory)\n\n switch (props.selectStrategy) {\n case 'single-leaf': return leafSingleSelectStrategy(props.mandatory)\n case 'leaf': return leafSelectStrategy(props.mandatory)\n case 'independent': return independentSelectStrategy(props.mandatory)\n case 'single-independent': return independentSingleSelectStrategy(props.mandatory)\n case 'classic':\n default: return classicSelectStrategy(props.mandatory)\n }\n })\n\n const openStrategy = computed(() => {\n if (typeof props.openStrategy === 'object') return props.openStrategy\n\n switch (props.openStrategy) {\n case 'list': return listOpenStrategy\n case 'single': return singleOpenStrategy\n case 'multiple':\n default: return multipleOpenStrategy\n }\n })\n\n const activated = useProxiedModel(\n props,\n 'activated',\n props.activated,\n v => activeStrategy.value.in(v, children.value, parents.value),\n v => activeStrategy.value.out(v, children.value, parents.value),\n )\n const selected = useProxiedModel(\n props,\n 'selected',\n props.selected,\n v => selectStrategy.value.in(v, children.value, parents.value),\n v => selectStrategy.value.out(v, children.value, parents.value),\n )\n\n onBeforeUnmount(() => {\n isUnmounted = true\n })\n\n function getPath (id: unknown) {\n const path: unknown[] = []\n let parent: unknown = id\n\n while (parent != null) {\n path.unshift(parent)\n parent = parents.value.get(parent)\n }\n\n return path\n }\n\n const vm = getCurrentInstance('nested')\n\n const nodeIds = new Set<unknown>()\n\n const nested: NestedProvide = {\n id: shallowRef(),\n root: {\n opened,\n activatable: toRef(props, 'activatable'),\n selectable: toRef(props, 'selectable'),\n activated,\n selected,\n selectedValues: computed(() => {\n const arr = []\n\n for (const [key, value] of selected.value.entries()) {\n if (value === 'on') arr.push(key)\n }\n\n return arr\n }),\n register: (id, parentId, isGroup) => {\n if (nodeIds.has(id)) {\n const path = getPath(id).map(String).join(' -> ')\n const newPath = getPath(parentId).concat(id).map(String).join(' -> ')\n consoleError(`Multiple nodes with the same ID\\n\\t${path}\\n\\t${newPath}`)\n return\n } else {\n nodeIds.add(id)\n }\n\n parentId && id !== parentId && parents.value.set(id, parentId)\n\n isGroup && children.value.set(id, [])\n\n if (parentId != null) {\n children.value.set(parentId, [...children.value.get(parentId) || [], id])\n }\n },\n unregister: id => {\n if (isUnmounted) return\n\n nodeIds.delete(id)\n children.value.delete(id)\n const parent = parents.value.get(id)\n if (parent) {\n const list = children.value.get(parent) ?? []\n children.value.set(parent, list.filter(child => child !== id))\n }\n parents.value.delete(id)\n },\n open: (id, value, event) => {\n vm.emit('click:open', { id, value, path: getPath(id), event })\n\n const newOpened = openStrategy.value.open({\n id,\n value,\n opened: new Set(opened.value),\n children: children.value,\n parents: parents.value,\n event,\n })\n\n newOpened && (opened.value = newOpened)\n },\n openOnSelect: (id, value, event) => {\n const newOpened = openStrategy.value.select({\n id,\n value,\n selected: new Map(selected.value),\n opened: new Set(opened.value),\n children: children.value,\n parents: parents.value,\n event,\n })\n newOpened && (opened.value = newOpened)\n },\n select: (id, value, event) => {\n vm.emit('click:select', { id, value, path: getPath(id), event })\n\n const newSelected = selectStrategy.value.select({\n id,\n value,\n selected: new Map(selected.value),\n children: children.value,\n parents: parents.value,\n event,\n })\n newSelected && (selected.value = newSelected)\n\n nested.root.openOnSelect(id, value, event)\n },\n activate: (id, value, event) => {\n if (!props.activatable) {\n return nested.root.select(id, true, event)\n }\n\n vm.emit('click:activate', { id, value, path: getPath(id), event })\n\n const newActivated = activeStrategy.value.activate({\n id,\n value,\n activated: new Set(activated.value),\n children: children.value,\n parents: parents.value,\n event,\n })\n\n newActivated && (activated.value = newActivated)\n },\n children,\n parents,\n getPath,\n },\n }\n\n provide(VNestedSymbol, nested)\n\n return nested.root\n}\n\nexport const useNestedItem = (id: Ref<unknown>, isGroup: boolean) => {\n const parent = inject(VNestedSymbol, emptyNested)\n\n const uidSymbol = Symbol(getUid())\n const computedId = computed(() => id.value !== undefined ? id.value : uidSymbol)\n\n const item = {\n ...parent,\n id: computedId,\n open: (open: boolean, e: Event) => parent.root.open(computedId.value, open, e),\n openOnSelect: (open: boolean, e?: Event) => parent.root.openOnSelect(computedId.value, open, e),\n isOpen: computed(() => parent.root.opened.value.has(computedId.value)),\n parent: computed(() => parent.root.parents.value.get(computedId.value)),\n activate: (activated: boolean, e?: Event) => parent.root.activate(computedId.value, activated, e),\n isActivated: computed(() => parent.root.activated.value.has(toRaw(computedId.value))),\n select: (selected: boolean, e?: Event) => parent.root.select(computedId.value, selected, e),\n isSelected: computed(() => parent.root.selected.value.get(toRaw(computedId.value)) === 'on'),\n isIndeterminate: computed(() => parent.root.selected.value.get(computedId.value) === 'indeterminate'),\n isLeaf: computed(() => !parent.root.children.value.get(computedId.value)),\n isGroupActivator: parent.isGroupActivator,\n }\n\n !parent.isGroupActivator && parent.root.register(computedId.value, parent.id.value, isGroup)\n\n onBeforeUnmount(() => {\n !parent.isGroupActivator && parent.root.unregister(computedId.value)\n })\n\n isGroup && provide(VNestedSymbol, item)\n\n return item\n}\n\nexport const useNestedGroupActivator = () => {\n const parent = inject(VNestedSymbol, emptyNested)\n\n provide(VNestedSymbol, { ...parent, isGroupActivator: true })\n}\n"],"mappings":"AAAA;AAAA,SACSA,eAAe,+BAExB;AACA,SAASC,QAAQ,EAAEC,MAAM,EAAEC,eAAe,EAAEC,OAAO,EAAEC,GAAG,EAAEC,UAAU,EAAEC,KAAK,EAAEC,KAAK,QAAQ,KAAK;AAAA,SAE7FC,yBAAyB,EACzBC,+BAA+B,EAC/BC,kBAAkB,EAClBC,wBAAwB;AAAA,SAEjBC,gBAAgB,EAAEC,oBAAoB,EAAEC,kBAAkB;AAAA,SAEjEC,qBAAqB,EACrBC,yBAAyB,EACzBC,+BAA+B,E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CAACiE,MAAM,CAACpC,IAAI,CAACK,QAAQ,CAAC2B,KAAK,CAACM,GAAG,CAAC4B,UAAU,CAAClC,KAAK,CAAC,CAAC;IACzE2C,gBAAgB,EAAEvC,MAAM,CAACuC;EAC3B,CAAC;EAED,CAACvC,MAAM,CAACuC,gBAAgB,IAAIvC,MAAM,CAACpC,IAAI,CAACC,QAAQ,CAACiE,UAAU,CAAClC,KAAK,EAAEI,MAAM,CAACrC,EAAE,CAACiC,KAAK,EAAEe,OAAO,CAAC;EAE5F1E,eAAe,CAAC,MAAM;IACpB,CAAC+D,MAAM,CAACuC,gBAAgB,IAAIvC,MAAM,CAACpC,IAAI,CAACE,UAAU,CAACgE,UAAU,CAAClC,KAAK,CAAC;EACtE,CAAC,CAAC;EAEFe,OAAO,IAAIzE,OAAO,CAACqB,aAAa,EAAEyE,IAAI,CAAC;EAEvC,OAAOA,IAAI;AACb,CAAC;AAED,OAAO,MAAMQ,uBAAuB,GAAGA,CAAA,KAAM;EAC3C,MAAMxC,MAAM,GAAGhE,MAAM,CAACuB,aAAa,EAAEG,WAAW,CAAC;EAEjDxB,OAAO,CAACqB,aAAa,EAAE;IAAE,GAAGyC,MAAM;IAAEuC,gBAAgB,EAAE;EAAK,CAAC,CAAC;AAC/D,CAAC","ignoreList":[]}
|
1
|
+
{"version":3,"file":"nested.mjs","names":["useProxiedModel","computed","inject","onBeforeUnmount","provide","ref","shallowRef","toRaw","toRef","independentActiveStrategy","independentSingleActiveStrategy","leafActiveStrategy","leafSingleActiveStrategy","listOpenStrategy","multipleOpenStrategy","singleOpenStrategy","classicSelectStrategy","independentSelectStrategy","independentSingleSelectStrategy","leafSelectStrategy","leafSingleSelectStrategy","consoleError","getCurrentInstance","propsFactory","VNestedSymbol","Symbol","for","emptyNested","id","root","register","unregister","parents","Map","children","open","openOnSelect","activate","select","activatable","selectable","opened","Set","activated","selected","selectedValues","getPath","makeNestedProps","Boolean","activeStrategy","String","Function","Object","selectStrategy","openStrategy","mandatory","useNested","props","isUnmounted","v","values","value","in","out","path","parent","unshift","get","vm","nodeIds","nested","arr","key","entries","push","parentId","isGroup","has","map","join","newPath","concat","add","set","delete","list","filter","child","event","emit","newOpened","newSelected","newActivated","useNestedItem","uidSymbol","computedId","undefined","item","e","isOpen","isActivated","isSelected","isIndeterminate","isLeaf","isGroupActivator","useNestedGroupActivator"],"sources":["../../../src/composables/nested/nested.ts"],"sourcesContent":["// Composables\nimport { useProxiedModel } from '@/composables/proxiedModel'\n\n// Utilities\nimport { computed, inject, onBeforeUnmount, provide, ref, shallowRef, toRaw, toRef } from 'vue'\nimport {\n independentActiveStrategy,\n independentSingleActiveStrategy,\n leafActiveStrategy,\n leafSingleActiveStrategy,\n} from './activeStrategies'\nimport { listOpenStrategy, multipleOpenStrategy, singleOpenStrategy } from './openStrategies'\nimport {\n classicSelectStrategy,\n independentSelectStrategy,\n independentSingleSelectStrategy,\n leafSelectStrategy,\n leafSingleSelectStrategy,\n} from './selectStrategies'\nimport { consoleError, getCurrentInstance, propsFactory } from '@/util'\n\n// Types\nimport type { InjectionKey, PropType, Ref } from 'vue'\nimport type { ActiveStrategy } from './activeStrategies'\nimport type { OpenStrategy } from './openStrategies'\nimport type { SelectStrategy } from './selectStrategies'\nimport type { EventProp } from '@/util'\n\nexport type ActiveStrategyProp =\n | 'single-leaf'\n | 'leaf'\n | 'independent'\n | 'single-independent'\n | ActiveStrategy\n | ((mandatory: boolean) => ActiveStrategy)\nexport type SelectStrategyProp =\n | 'single-leaf'\n | 'leaf'\n | 'independent'\n | 'single-independent'\n | 'classic'\n | SelectStrategy\n | ((mandatory: boolean) => SelectStrategy)\nexport type OpenStrategyProp = 'single' | 'multiple' | 'list' | OpenStrategy\n\nexport interface NestedProps {\n activatable: boolean\n selectable: boolean\n activeStrategy: ActiveStrategyProp | undefined\n selectStrategy: SelectStrategyProp | undefined\n openStrategy: OpenStrategyProp | undefined\n activated: any\n selected: any\n opened: any\n mandatory: boolean\n 'onUpdate:activated': EventProp<[any]> | undefined\n 'onUpdate:selected': EventProp<[any]> | undefined\n 'onUpdate:opened': EventProp<[any]> | undefined\n}\n\ntype NestedProvide = {\n id: Ref<unknown>\n isGroupActivator?: boolean\n root: {\n children: Ref<Map<unknown, unknown[]>>\n parents: Ref<Map<unknown, unknown>>\n activatable: Ref<boolean>\n selectable: Ref<boolean>\n opened: Ref<Set<unknown>>\n activated: Ref<Set<unknown>>\n selected: Ref<Map<unknown, 'on' | 'off' | 'indeterminate'>>\n selectedValues: Ref<unknown[]>\n register: (id: unknown, parentId: unknown, isGroup?: boolean) => void\n unregister: (id: unknown) => void\n open: (id: unknown, value: boolean, event?: Event) => void\n activate: (id: unknown, value: boolean, event?: Event) => void\n select: (id: unknown, value: boolean, event?: Event) => void\n openOnSelect: (id: unknown, value: boolean, event?: Event) => void\n getPath: (id: unknown) => unknown[]\n }\n}\n\nexport const VNestedSymbol: InjectionKey<NestedProvide> = Symbol.for('vuetify:nested')\n\nexport const emptyNested: NestedProvide = {\n id: shallowRef(),\n root: {\n register: () => null,\n unregister: () => null,\n parents: ref(new Map()),\n children: ref(new Map()),\n open: () => null,\n openOnSelect: () => null,\n activate: () => null,\n select: () => null,\n activatable: ref(false),\n selectable: ref(false),\n opened: ref(new Set()),\n activated: ref(new Set()),\n selected: ref(new Map()),\n selectedValues: ref([]),\n getPath: () => [],\n },\n}\n\nexport const makeNestedProps = propsFactory({\n activatable: Boolean,\n selectable: Boolean,\n activeStrategy: [String, Function, Object] as PropType<ActiveStrategyProp>,\n selectStrategy: [String, Function, Object] as PropType<SelectStrategyProp>,\n openStrategy: [String, Object] as PropType<OpenStrategyProp>,\n opened: null,\n activated: null,\n selected: null,\n mandatory: Boolean,\n}, 'nested')\n\nexport const useNested = (props: NestedProps) => {\n let isUnmounted = false\n const children = ref(new Map<unknown, unknown[]>())\n const parents = ref(new Map<unknown, unknown>())\n\n const opened = useProxiedModel(props, 'opened', props.opened, v => new Set(v), v => [...v.values()])\n\n const activeStrategy = computed(() => {\n if (typeof props.activeStrategy === 'object') return props.activeStrategy\n if (typeof props.activeStrategy === 'function') return props.activeStrategy(props.mandatory)\n\n switch (props.activeStrategy) {\n case 'leaf': return leafActiveStrategy(props.mandatory)\n case 'single-leaf': return leafSingleActiveStrategy(props.mandatory)\n case 'independent': return independentActiveStrategy(props.mandatory)\n case 'single-independent':\n default: return independentSingleActiveStrategy(props.mandatory)\n }\n })\n\n const selectStrategy = computed(() => {\n if (typeof props.selectStrategy === 'object') return props.selectStrategy\n if (typeof props.selectStrategy === 'function') return props.selectStrategy(props.mandatory)\n\n switch (props.selectStrategy) {\n case 'single-leaf': return leafSingleSelectStrategy(props.mandatory)\n case 'leaf': return leafSelectStrategy(props.mandatory)\n case 'independent': return independentSelectStrategy(props.mandatory)\n case 'single-independent': return independentSingleSelectStrategy(props.mandatory)\n case 'classic':\n default: return classicSelectStrategy(props.mandatory)\n }\n })\n\n const openStrategy = computed(() => {\n if (typeof props.openStrategy === 'object') return props.openStrategy\n\n switch (props.openStrategy) {\n case 'list': return listOpenStrategy\n case 'single': return singleOpenStrategy\n case 'multiple':\n default: return multipleOpenStrategy\n }\n })\n\n const activated = useProxiedModel(\n props,\n 'activated',\n props.activated,\n v => activeStrategy.value.in(v, children.value, parents.value),\n v => activeStrategy.value.out(v, children.value, parents.value),\n )\n const selected = useProxiedModel(\n props,\n 'selected',\n props.selected,\n v => selectStrategy.value.in(v, children.value, parents.value),\n v => selectStrategy.value.out(v, children.value, parents.value),\n )\n\n onBeforeUnmount(() => {\n isUnmounted = true\n })\n\n function getPath (id: unknown) {\n const path: unknown[] = []\n let parent: unknown = id\n\n while (parent != null) {\n path.unshift(parent)\n parent = parents.value.get(parent)\n }\n\n return path\n }\n\n const vm = getCurrentInstance('nested')\n\n const nodeIds = new Set<unknown>()\n\n const nested: NestedProvide = {\n id: shallowRef(),\n root: {\n opened,\n activatable: toRef(props, 'activatable'),\n selectable: toRef(props, 'selectable'),\n activated,\n selected,\n selectedValues: computed(() => {\n const arr = []\n\n for (const [key, value] of selected.value.entries()) {\n if (value === 'on') arr.push(key)\n }\n\n return arr\n }),\n register: (id, parentId, isGroup) => {\n if (nodeIds.has(id)) {\n const path = getPath(id).map(String).join(' -> ')\n const newPath = getPath(parentId).concat(id).map(String).join(' -> ')\n consoleError(`Multiple nodes with the same ID\\n\\t${path}\\n\\t${newPath}`)\n return\n } else {\n nodeIds.add(id)\n }\n\n parentId && id !== parentId && parents.value.set(id, parentId)\n\n isGroup && children.value.set(id, [])\n\n if (parentId != null) {\n children.value.set(parentId, [...children.value.get(parentId) || [], id])\n }\n },\n unregister: id => {\n if (isUnmounted) return\n\n nodeIds.delete(id)\n children.value.delete(id)\n const parent = parents.value.get(id)\n if (parent) {\n const list = children.value.get(parent) ?? []\n children.value.set(parent, list.filter(child => child !== id))\n }\n parents.value.delete(id)\n },\n open: (id, value, event) => {\n vm.emit('click:open', { id, value, path: getPath(id), event })\n\n const newOpened = openStrategy.value.open({\n id,\n value,\n opened: new Set(opened.value),\n children: children.value,\n parents: parents.value,\n event,\n })\n\n newOpened && (opened.value = newOpened)\n },\n openOnSelect: (id, value, event) => {\n const newOpened = openStrategy.value.select({\n id,\n value,\n selected: new Map(selected.value),\n opened: new Set(opened.value),\n children: children.value,\n parents: parents.value,\n event,\n })\n newOpened && (opened.value = newOpened)\n },\n select: (id, value, event) => {\n vm.emit('click:select', { id, value, path: getPath(id), event })\n\n const newSelected = selectStrategy.value.select({\n id,\n value,\n selected: new Map(selected.value),\n children: children.value,\n parents: parents.value,\n event,\n })\n newSelected && (selected.value = newSelected)\n\n nested.root.openOnSelect(id, value, event)\n },\n activate: (id, value, event) => {\n if (!props.activatable) {\n return nested.root.select(id, true, event)\n }\n\n vm.emit('click:activate', { id, value, path: getPath(id), event })\n\n const newActivated = activeStrategy.value.activate({\n id,\n value,\n activated: new Set(activated.value),\n children: children.value,\n parents: parents.value,\n event,\n })\n\n newActivated && (activated.value = newActivated)\n },\n children,\n parents,\n getPath,\n },\n }\n\n provide(VNestedSymbol, nested)\n\n return nested.root\n}\n\nexport const useNestedItem = (id: Ref<unknown>, isGroup: boolean) => {\n const parent = inject(VNestedSymbol, emptyNested)\n\n const uidSymbol = Symbol('nested item')\n const computedId = computed(() => id.value !== undefined ? id.value : uidSymbol)\n\n const item = {\n ...parent,\n id: computedId,\n open: (open: boolean, e: Event) => parent.root.open(computedId.value, open, e),\n openOnSelect: (open: boolean, e?: Event) => parent.root.openOnSelect(computedId.value, open, e),\n isOpen: computed(() => parent.root.opened.value.has(computedId.value)),\n parent: computed(() => parent.root.parents.value.get(computedId.value)),\n activate: (activated: boolean, e?: Event) => parent.root.activate(computedId.value, activated, e),\n isActivated: computed(() => parent.root.activated.value.has(toRaw(computedId.value))),\n select: (selected: boolean, e?: Event) => parent.root.select(computedId.value, selected, e),\n isSelected: computed(() => parent.root.selected.value.get(toRaw(computedId.value)) === 'on'),\n isIndeterminate: computed(() => parent.root.selected.value.get(computedId.value) === 'indeterminate'),\n isLeaf: computed(() => !parent.root.children.value.get(computedId.value)),\n isGroupActivator: parent.isGroupActivator,\n }\n\n !parent.isGroupActivator && parent.root.register(computedId.value, parent.id.value, isGroup)\n\n onBeforeUnmount(() => {\n !parent.isGroupActivator && parent.root.unregister(computedId.value)\n })\n\n isGroup && provide(VNestedSymbol, item)\n\n return item\n}\n\nexport const useNestedGroupActivator = () => {\n const parent = inject(VNestedSymbol, emptyNested)\n\n provide(VNestedSymbol, { ...parent, isGroupActivator: true })\n}\n"],"mappings":"AAAA;AAAA,SACSA,eAAe,+BAExB;AACA,SAASC,QAAQ,EAAEC,MAAM,EAAEC,eAAe,EAAEC,OAAO,EAAEC,GAAG,EAAEC,UAAU,EAAEC,KAAK,EAAEC,KAAK,QAAQ,KAAK;AAAA,SAE7FC,yBAAyB,EACzBC,+BAA+B,EAC/BC,kBAAkB,EAClBC,wBAAwB;AAAA,SAEjBC,gBAAgB,EAAEC,oBAAoB,EAAEC,kBAAkB;AAAA,SAEjEC,qBAAqB,EACrBC,yBA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MAAM,CAACpC,IAAI,CAACK,QAAQ,CAAC2B,KAAK,CAACM,GAAG,CAAC4B,UAAU,CAAClC,KAAK,CAAC,CAAC;IACzE2C,gBAAgB,EAAEvC,MAAM,CAACuC;EAC3B,CAAC;EAED,CAACvC,MAAM,CAACuC,gBAAgB,IAAIvC,MAAM,CAACpC,IAAI,CAACC,QAAQ,CAACiE,UAAU,CAAClC,KAAK,EAAEI,MAAM,CAACrC,EAAE,CAACiC,KAAK,EAAEe,OAAO,CAAC;EAE5FzE,eAAe,CAAC,MAAM;IACpB,CAAC8D,MAAM,CAACuC,gBAAgB,IAAIvC,MAAM,CAACpC,IAAI,CAACE,UAAU,CAACgE,UAAU,CAAClC,KAAK,CAAC;EACtE,CAAC,CAAC;EAEFe,OAAO,IAAIxE,OAAO,CAACoB,aAAa,EAAEyE,IAAI,CAAC;EAEvC,OAAOA,IAAI;AACb,CAAC;AAED,OAAO,MAAMQ,uBAAuB,GAAGA,CAAA,KAAM;EAC3C,MAAMxC,MAAM,GAAG/D,MAAM,CAACsB,aAAa,EAAEG,WAAW,CAAC;EAEjDvB,OAAO,CAACoB,aAAa,EAAE;IAAE,GAAGyC,MAAM;IAAEuC,gBAAgB,EAAE;EAAK,CAAC,CAAC;AAC/D,CAAC","ignoreList":[]}
|
@@ -3,8 +3,8 @@ import { makeFocusProps } from "./focus.mjs";
|
|
3
3
|
import { useForm } from "./form.mjs";
|
4
4
|
import { useProxiedModel } from "./proxiedModel.mjs";
|
5
5
|
import { useToggleScope } from "./toggleScope.mjs"; // Utilities
|
6
|
-
import { computed, nextTick, onBeforeMount, onBeforeUnmount, onMounted, ref, shallowRef, unref, watch } from 'vue';
|
7
|
-
import { getCurrentInstance, getCurrentInstanceName,
|
6
|
+
import { computed, nextTick, onBeforeMount, onBeforeUnmount, onMounted, ref, shallowRef, unref, useId, watch } from 'vue';
|
7
|
+
import { getCurrentInstance, getCurrentInstanceName, propsFactory, wrapInArray } from "../util/index.mjs"; // Types
|
8
8
|
export const makeValidationProps = propsFactory({
|
9
9
|
disabled: {
|
10
10
|
type: Boolean,
|
@@ -36,7 +36,7 @@ export const makeValidationProps = propsFactory({
|
|
36
36
|
}, 'validation');
|
37
37
|
export function useValidation(props) {
|
38
38
|
let name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getCurrentInstanceName();
|
39
|
-
let id = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] :
|
39
|
+
let id = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : useId();
|
40
40
|
const model = useProxiedModel(props, 'modelValue');
|
41
41
|
const validationModel = computed(() => props.validationValue === undefined ? model.value : props.validationValue);
|
42
42
|
const form = useForm(props);
|
@@ -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","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,EAAEC,KAAK,QAAQ,KAAK;AAAA,SACzGC,kBAAkB,EAAEC,sBAAsB,EAAEC,MAAM,EAAEC,YAAY,EAAEC,WAAW,6BAEtF;AAqCA,OAAO,MAAMC,mBAAmB,GAAGF,YAAY,CAAC;EAC9CG,QAAQ,EAAE;IACRC,IAAI,EAAEC,OAAmC;IACzCC,OAAO,EAAE;EACX,CAAC;EACDC,KAAK,EAAEF,OAAO;EACdG,aAAa,EAAE;IACbJ,IAAI,EAAE,CAACK,KAAK,EAAEC,MAAM,CAAgD;IACpEJ,OAAO,EAAEA,CAAA,KAAO;EAClB,CAAC;EACDK,SAAS,EAAE;IACTP,IAAI,EAAE,CAACQ,MAAM,EAAEF,MAAM,CAAC;IACtBJ,OAAO,EAAE;E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,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":[]}
|
1
|
+
{"version":3,"file":"validation.mjs","names":["makeFocusProps","useForm","useProxiedModel","useToggleScope","computed","nextTick","onBeforeMount","onBeforeUnmount","onMounted","ref","shallowRef","unref","useId","watch","getCurrentInstance","getCurrentInstanceName","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, useId, watch } from 'vue'\nimport { getCurrentInstance, getCurrentInstanceName, 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> = useId(),\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,EAAEC,KAAK,EAAEC,KAAK,QAAQ,KAAK;AAAA,SAChHC,kBAAkB,EAAEC,sBAAsB,EAAEC,YAAY,EAAEC,WAAW,6BAE9E;AAqCA,OAAO,MAAMC,mBAAmB,GAAGF,YAAY,CAAC;EAC9CG,QAAQ,EAAE;IACRC,IAAI,EAAEC,OAAmC;IACzCC,OAAO,EAAE;EACX,CAAC;EACDC,KAAK,EAAEF,OAAO;EACdG,aAAa,EAAE;IACbJ,IAAI,EAAE,CAACK,KAAK,EAAEC,MAAM,CAAgD;IACpEJ,OAAO,EAAEA,CAAA,KAAO;EAClB,CAAC;EACDK,SAAS,EAAE;IACTP,IAAI,EAAE,CAACQ,MAAM,EAAEF,MAAM,CAAC;IACtBJ,OAAO,EAAE;EACX,CAAC;EACDO,IAAI,EAAEH,MAAM;EACZI,KAAK,EAA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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.5-dev.2024-12-
|
19
|
+
export const version = "3.7.5-dev.2024-12-16";
|
20
20
|
createVuetify.version = version;
|
21
21
|
export { blueprints, components, directives };
|
22
22
|
export * from "./composables/index.mjs";
|
package/lib/framework.mjs
CHANGED
@@ -7,7 +7,7 @@ import { createIcons, IconSymbol } from "./composables/icons.mjs";
|
|
7
7
|
import { createLocale, LocaleSymbol } from "./composables/locale.mjs";
|
8
8
|
import { createTheme, ThemeSymbol } from "./composables/theme.mjs"; // Utilities
|
9
9
|
import { nextTick, reactive } from 'vue';
|
10
|
-
import { defineComponent,
|
10
|
+
import { defineComponent, IN_BROWSER, mergeDeep } from "./util/index.mjs"; // Types
|
11
11
|
export * from "./composables/index.mjs";
|
12
12
|
export function createVuetify() {
|
13
13
|
let vuetify = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
@@ -68,7 +68,6 @@ export function createVuetify() {
|
|
68
68
|
};
|
69
69
|
}
|
70
70
|
}
|
71
|
-
getUid.reset();
|
72
71
|
if (typeof __VUE_OPTIONS_API__ !== 'boolean' || __VUE_OPTIONS_API__) {
|
73
72
|
app.mixin({
|
74
73
|
computed: {
|
@@ -97,7 +96,7 @@ export function createVuetify() {
|
|
97
96
|
goTo
|
98
97
|
};
|
99
98
|
}
|
100
|
-
export const version = "3.7.5-dev.2024-12-
|
99
|
+
export const version = "3.7.5-dev.2024-12-16";
|
101
100
|
createVuetify.version = version;
|
102
101
|
|
103
102
|
// Vue's inject() can only be used in setup
|
package/lib/framework.mjs.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"framework.mjs","names":["createDate","DateAdapterSymbol","DateOptionsSymbol","createDefaults","DefaultsSymbol","createDisplay","DisplaySymbol","createGoTo","GoToSymbol","createIcons","IconSymbol","createLocale","LocaleSymbol","createTheme","ThemeSymbol","nextTick","reactive","defineComponent","
|
1
|
+
{"version":3,"file":"framework.mjs","names":["createDate","DateAdapterSymbol","DateOptionsSymbol","createDefaults","DefaultsSymbol","createDisplay","DisplaySymbol","createGoTo","GoToSymbol","createIcons","IconSymbol","createLocale","LocaleSymbol","createTheme","ThemeSymbol","nextTick","reactive","defineComponent","IN_BROWSER","mergeDeep","createVuetify","vuetify","arguments","length","undefined","blueprint","rest","options","aliases","components","directives","defaults","display","ssr","theme","icons","locale","date","goTo","install","app","key","directive","component","name","aliasName","provide","instance","$nuxt","hook","update","mount","vm","__VUE_OPTIONS_API__","mixin","computed","$vuetify","inject","call","version","$","provides","parent","vnode","appContext"],"sources":["../src/framework.ts"],"sourcesContent":["// Composables\nimport { createDate, DateAdapterSymbol, DateOptionsSymbol } from '@/composables/date/date'\nimport { createDefaults, DefaultsSymbol } from '@/composables/defaults'\nimport { createDisplay, DisplaySymbol } from '@/composables/display'\nimport { createGoTo, GoToSymbol } from '@/composables/goto'\nimport { createIcons, IconSymbol } from '@/composables/icons'\nimport { createLocale, LocaleSymbol } from '@/composables/locale'\nimport { createTheme, ThemeSymbol } from '@/composables/theme'\n\n// Utilities\nimport { nextTick, reactive } from 'vue'\nimport { defineComponent, IN_BROWSER, mergeDeep } from '@/util'\n\n// Types\nimport type { App, ComponentPublicInstance, InjectionKey } from 'vue'\nimport type { DateOptions } from '@/composables/date'\nimport type { DefaultsOptions } from '@/composables/defaults'\nimport type { DisplayOptions, SSROptions } from '@/composables/display'\nimport type { GoToOptions } from '@/composables/goto'\nimport type { IconOptions } from '@/composables/icons'\nimport type { LocaleOptions, RtlOptions } from '@/composables/locale'\nimport type { ThemeOptions } from '@/composables/theme'\nexport * from './composables'\nexport type { DateOptions, DateInstance, DateModule } from '@/composables/date'\n\nexport interface VuetifyOptions {\n aliases?: Record<string, any>\n blueprint?: Blueprint\n components?: Record<string, any>\n date?: DateOptions\n directives?: Record<string, any>\n defaults?: DefaultsOptions\n display?: DisplayOptions\n goTo?: GoToOptions\n theme?: ThemeOptions\n icons?: IconOptions\n locale?: LocaleOptions & RtlOptions\n ssr?: SSROptions\n}\n\nexport interface Blueprint extends Omit<VuetifyOptions, 'blueprint'> {}\n\nexport function createVuetify (vuetify: VuetifyOptions = {}) {\n const { blueprint, ...rest } = vuetify\n const options: VuetifyOptions = mergeDeep(blueprint, rest)\n const {\n aliases = {},\n components = {},\n directives = {},\n } = options\n\n const defaults = createDefaults(options.defaults)\n const display = createDisplay(options.display, options.ssr)\n const theme = createTheme(options.theme)\n const icons = createIcons(options.icons)\n const locale = createLocale(options.locale)\n const date = createDate(options.date, locale)\n const goTo = createGoTo(options.goTo, locale)\n\n const install = (app: App) => {\n for (const key in directives) {\n app.directive(key, directives[key])\n }\n\n for (const key in components) {\n app.component(key, components[key])\n }\n\n for (const key in aliases) {\n app.component(key, defineComponent({\n ...aliases[key],\n name: key,\n aliasName: aliases[key].name,\n }))\n }\n\n theme.install(app)\n\n app.provide(DefaultsSymbol, defaults)\n app.provide(DisplaySymbol, display)\n app.provide(ThemeSymbol, theme)\n app.provide(IconSymbol, icons)\n app.provide(LocaleSymbol, locale)\n app.provide(DateOptionsSymbol, date.options)\n app.provide(DateAdapterSymbol, date.instance)\n app.provide(GoToSymbol, goTo)\n\n if (IN_BROWSER && options.ssr) {\n if (app.$nuxt) {\n app.$nuxt.hook('app:suspense:resolve', () => {\n display.update()\n })\n } else {\n const { mount } = app\n app.mount = (...args) => {\n const vm = mount(...args)\n nextTick(() => display.update())\n app.mount = mount\n return vm\n }\n }\n }\n\n if (typeof __VUE_OPTIONS_API__ !== 'boolean' || __VUE_OPTIONS_API__) {\n app.mixin({\n computed: {\n $vuetify () {\n return reactive({\n defaults: inject.call(this, DefaultsSymbol),\n display: inject.call(this, DisplaySymbol),\n theme: inject.call(this, ThemeSymbol),\n icons: inject.call(this, IconSymbol),\n locale: inject.call(this, LocaleSymbol),\n date: inject.call(this, DateAdapterSymbol),\n })\n },\n },\n })\n }\n }\n\n return {\n install,\n defaults,\n display,\n theme,\n icons,\n locale,\n date,\n goTo,\n }\n}\n\nexport const version = __VUETIFY_VERSION__\ncreateVuetify.version = version\n\n// Vue's inject() can only be used in setup\nfunction inject (this: ComponentPublicInstance, key: InjectionKey<any> | string) {\n const vm = this.$\n\n const provides = vm.parent?.provides ?? vm.vnode.appContext?.provides\n\n if (provides && (key as any) in provides) {\n return provides[(key as string)]\n }\n}\n"],"mappings":"AAAA;AAAA,SACSA,UAAU,EAAEC,iBAAiB,EAAEC,iBAAiB;AAAA,SAChDC,cAAc,EAAEC,cAAc;AAAA,SAC9BC,aAAa,EAAEC,aAAa;AAAA,SAC5BC,UAAU,EAAEC,UAAU;AAAA,SACtBC,WAAW,EAAEC,UAAU;AAAA,SACvBC,YAAY,EAAEC,YAAY;AAAA,SAC1BC,WAAW,EAAEC,WAAW,mCAEjC;AACA,SAASC,QAAQ,EAAEC,QAAQ,QAAQ,KAAK;AAAA,SAC/BC,eAAe,EAAEC,UAAU,EAAEC,SAAS,4BAE/C;AAAA;AA6BA,OAAO,SAASC,aAAaA,CAAA,EAAgC;EAAA,IAA9BC,OAAuB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EACzD,MAAM;IAAEG,SAAS;IAAE,GAAGC;EAAK,CAAC,GAAGL,OAAO;EACtC,MAAMM,OAAuB,GAAGR,SAAS,C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