yuyeon 0.0.44 → 0.0.46-rc.1
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/style.css +1 -1
- package/dist/yuyeon.js +2207 -2197
- package/dist/yuyeon.umd.cjs +6 -6
- package/lib/components/button/YButton.mjs +1 -1
- package/lib/components/button/YButton.mjs.map +1 -1
- package/lib/components/list/YListItem.mjs +1 -1
- package/lib/components/list/YListItem.mjs.map +1 -1
- package/lib/components/tab/YTab.mjs +3 -3
- package/lib/components/tab/YTab.mjs.map +1 -1
- package/lib/components/tree-view/YTreeView.mjs +6 -1
- package/lib/components/tree-view/YTreeView.mjs.map +1 -1
- package/lib/components/tree-view/YTreeViewNode.mjs +5 -4
- package/lib/components/tree-view/YTreeViewNode.mjs.map +1 -1
- package/lib/composables/date/index.mjs.map +1 -1
- package/lib/util/date/adapters/yuyeon-date-adapter.mjs +12 -0
- package/lib/util/date/adapters/yuyeon-date-adapter.mjs.map +1 -1
- package/lib/util/date/built-in.mjs +26 -0
- package/lib/util/date/built-in.mjs.map +1 -1
- package/lib/util/date/types.mjs.map +1 -1
- package/package.json +2 -2
- package/types/util/date/adapters/yuyeon-date-adapter.d.ts +4 -0
- package/types/util/date/built-in.d.ts +5 -0
- package/types/util/date/types.d.ts +4 -0
|
@@ -146,7 +146,7 @@ export const YButton = defineComponent({
|
|
|
146
146
|
"class": [`${NAME}`, choice?.selectedClass.value, {
|
|
147
147
|
...classes.value
|
|
148
148
|
}],
|
|
149
|
-
"href": link.href.value,
|
|
149
|
+
"href": props.disabled ? undefined : link.href.value,
|
|
150
150
|
"style": styles.value,
|
|
151
151
|
"onClick": onClick,
|
|
152
152
|
"disabled": props.disabled ? true : undefined
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"YButton.mjs","names":["computed","defineComponent","mergeProps","pressChoiceItemPropsOptions","useChoiceItem","useChoiceByLink","useRender","pressVueRouterPropsOptions","useLink","PlateWave","isColorValue","propsFactory","YSpinnerRing","Y_TOGGLE_BUTTON_KEY","NAME","pressYButtonProps","loading","Boolean","active","type","default","undefined","injectSymbol","variation","String","small","icon","outlined","rounded","filled","color","noWave","YButton","name","directives","props","emits","click","event","choice","setup","_ref","attrs","slots","emit","link","select","isActive","isLink","value","isSelected","variations","split","map","trim","classes","includes","disabled","styles","textColor","isDisabled","onClick","e","metaKey","altKey","ctrlKey","shiftKey","button","target","navigate","toggle","Tag","_withDirectives","_createVNode","selectedClass","href","width","height","append","_resolveDirective"],"sources":["../../../src/components/button/YButton.tsx"],"sourcesContent":["import type { PropType } from 'vue';\r\nimport { computed, defineComponent, mergeProps } from 'vue';\r\n\r\nimport {\r\n pressChoiceItemPropsOptions,\r\n useChoiceItem,\r\n} from '../../composables/choice';\r\nimport { useChoiceByLink } from '../../composables/choice-link';\r\nimport { useRender } from '../../composables/component';\r\nimport {\r\n pressVueRouterPropsOptions,\r\n useLink,\r\n} from '../../composables/vue-router';\r\nimport { PlateWave } from '../../directives/plate-wave';\r\nimport { isColorValue } from '../../util/color';\r\nimport { EventProp, propsFactory } from '../../util/vue-component';\r\nimport { YSpinnerRing } from '../loading/YSpinnerRing';\r\nimport { Y_TOGGLE_BUTTON_KEY } from '../toggle-button';\r\n\r\n/**\r\n * Style\r\n */\r\nimport './YButton.scss';\r\n\r\nconst NAME = 'y-button';\r\n\r\nexport const pressYButtonProps = propsFactory(\r\n {\r\n loading: Boolean,\r\n active: { type: Boolean, default: undefined },\r\n injectSymbol: { type: null, default: Y_TOGGLE_BUTTON_KEY },\r\n //\r\n variation: {\r\n type: String as PropType<string>,\r\n },\r\n small: Boolean,\r\n icon: Boolean,\r\n outlined: {\r\n type: Boolean,\r\n default: false,\r\n },\r\n rounded: {\r\n type: Boolean,\r\n default: false,\r\n },\r\n filled: {\r\n type: Boolean,\r\n default: false,\r\n },\r\n //\r\n color: {\r\n type: String,\r\n },\r\n noWave: {\r\n type: Boolean,\r\n default: false,\r\n },\r\n ...pressVueRouterPropsOptions(),\r\n ...pressChoiceItemPropsOptions(),\r\n },\r\n 'YButton',\r\n);\r\n\r\nexport const YButton = defineComponent({\r\n name: 'YButton',\r\n directives: {\r\n PlateWave,\r\n },\r\n props: pressYButtonProps(),\r\n emits: {\r\n click: (event: MouseEvent) => true,\r\n 'choice:selected': (choice: { value: boolean }) => true,\r\n },\r\n setup(props, { attrs, slots, emit }) {\r\n const choice = useChoiceItem(props, props.injectSymbol, false);\r\n const link = useLink(props, attrs);\r\n useChoiceByLink(link, choice?.select);\r\n\r\n const isActive = computed(() => {\r\n if (props.active !== undefined) {\r\n return props.active;\r\n }\r\n if (link.isLink.value) {\r\n return link.isActive?.value;\r\n }\r\n return choice?.isSelected.value;\r\n });\r\n\r\n const variations = computed(() => {\r\n const { variation } = props;\r\n if (typeof variation === 'string') {\r\n return variation.split(',').map((value) => {\r\n return value.trim();\r\n });\r\n }\r\n return [];\r\n });\r\n\r\n const classes = computed(() => {\r\n const { outlined, rounded, filled, small, icon } = props;\r\n return {\r\n [`${NAME}--outlined`]:\r\n variations.value.includes('outlined') || outlined,\r\n [`${NAME}--rounded`]: variations.value.includes('rounded') || rounded,\r\n [`${NAME}--filled`]: variations.value.includes('filled') || filled,\r\n [`${NAME}--text`]: variations.value.includes('text'),\r\n [`${NAME}--small`]: variations.value.includes('small') || small,\r\n [`${NAME}--icon`]: variations.value.includes('icon') || icon,\r\n [`${NAME}--color`]: props.color,\r\n [`${NAME}--loading`]: props.loading,\r\n [`${NAME}--disabled`]: props.disabled,\r\n [`${NAME}--active`]: isActive.value,\r\n };\r\n });\r\n\r\n const styles = computed(() => {\r\n let { color } = props;\r\n let textColor: string | undefined;\r\n if (color && !isColorValue(color)) {\r\n color = `var(--y-theme-${color})`;\r\n textColor = `var(--y-theme-on-${props.color})`;\r\n }\r\n return {\r\n [`--y-button__color`]: color,\r\n [`--y-button__text-color`]: textColor,\r\n };\r\n });\r\n\r\n const isDisabled = computed(() => {\r\n return choice?.disabled.value || props.disabled;\r\n });\r\n\r\n /// Events\r\n function onClick(e: MouseEvent) {\r\n if (\r\n isDisabled.value ||\r\n props.loading ||\r\n (link.isLink.value &&\r\n (e.metaKey ||\r\n e.altKey ||\r\n e.ctrlKey ||\r\n e.shiftKey ||\r\n e.button !== 0 ||\r\n attrs.target === '_blank'))\r\n ) {\r\n return;\r\n }\r\n emit('click', e);\r\n link.navigate?.(e);\r\n choice?.toggle();\r\n }\r\n\r\n useRender(() => {\r\n const Tag = link.isLink.value ? 'a' : 'button';\r\n return (\r\n <Tag\r\n class={[\r\n `${NAME}`,\r\n choice?.selectedClass.value,\r\n {\r\n ...classes.value,\r\n },\r\n ]}\r\n href={link.href.value}\r\n style={styles.value}\r\n onClick={onClick}\r\n disabled={props.disabled ? true : undefined}\r\n v-plate-wave={!props.noWave && !props.loading}\r\n >\r\n <span class={['y-button__content']}>\r\n {props.loading && (\r\n <YSpinnerRing\r\n {...mergeProps({ width: '24', height: '24' })}\r\n ></YSpinnerRing>\r\n )}\r\n {slots.default?.()}\r\n </span>\r\n {slots.append?.()}\r\n </Tag>\r\n );\r\n });\r\n\r\n return {\r\n link,\r\n };\r\n },\r\n});\r\n\r\nexport type YButton = InstanceType<typeof YButton>;\r\n"],"mappings":";AACA,SAASA,QAAQ,EAAEC,eAAe,EAAEC,UAAU,QAAQ,KAAK;AAAC,SAG1DC,2BAA2B,EAC3BC,aAAa;AAAA,SAENC,eAAe;AAAA,SACfC,SAAS;AAAA,SAEhBC,0BAA0B,EAC1BC,OAAO;AAAA,SAEAC,SAAS;AAAA,SACTC,YAAY;AAAA,SACDC,YAAY;AAAA,SACvBC,YAAY;AAAA,SACZC,mBAAmB;AAE5B;AACA;AACA;AACA;AAEA,MAAMC,IAAI,GAAG,UAAU;AAEvB,OAAO,MAAMC,iBAAiB,GAAGJ,YAAY,CAC3C;EACEK,OAAO,EAAEC,OAAO;EAChBC,MAAM,EAAE;IAAEC,IAAI,EAAEF,OAAO;IAAEG,OAAO,EAAEC;EAAU,C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KAAK,CAAC0B,MAAM,KAAK,QAAQ,CAAE,EAC/B;QACA;MACF;MACAxB,IAAI,CAAC,OAAO,EAAEkB,CAAC,CAAC;MAChBjB,IAAI,CAACwB,QAAQ,GAAGP,CAAC,CAAC;MAClBvB,MAAM,EAAE+B,MAAM,CAAC,CAAC;IAClB;IAEAhE,SAAS,CAAC,MAAM;MACd,MAAMiE,GAAG,GAAG1B,IAAI,CAACG,MAAM,CAACC,KAAK,GAAG,GAAG,GAAG,QAAQ;MAC9C,OAAAuB,eAAA,CAAAC,YAAA,CAAAF,GAAA;QAAA,SAEW,CACJ,GAAEzD,IAAK,EAAC,EACTyB,MAAM,EAAEmC,aAAa,CAACzB,KAAK,EAC3B;UACE,GAAGM,OAAO,CAACN;QACb,CAAC,CACF;QAAA,QACKJ,IAAI,CAAC8B,IAAI,CAAC1B,KAAK;QAAA,SACdS,MAAM,CAACT,KAAK;QAAA,WACVY,OAAO;QAAA,YACN1B,KAAK,CAACsB,QAAQ,GAAG,IAAI,GAAGpC;MAAS;QAAAD,OAAA,EAAAA,CAAA,MAAAqD,YAAA;UAAA,SAG9B,CAAC,mBAAmB;QAAC,IAC/BtC,KAAK,CAACnB,OAAO,IAAAyD,YAAA,CAAA7D,YAAA,EAENV,UAAU,CAAC;UAAE0E,KAAK,EAAE,IAAI;UAAEC,MAAM,EAAE;QAAK,CAAC,CAAC,OAEhD,EACAlC,KAAK,CAACvB,OAAO,GAAG,CAAC,IAEnBuB,KAAK,CAACmC,MAAM,GAAG,CAAC;MAAA,MAAAC,iBAAA,gBAVH,CAAC5C,KAAK,CAACJ,MAAM,IAAI,CAACI,KAAK,CAACnB,OAAO;IAanD,CAAC,CAAC;IAEF,OAAO;MACL6B;IACF,CAAC;EACH;AACF,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"YButton.mjs","names":["computed","defineComponent","mergeProps","pressChoiceItemPropsOptions","useChoiceItem","useChoiceByLink","useRender","pressVueRouterPropsOptions","useLink","PlateWave","isColorValue","propsFactory","YSpinnerRing","Y_TOGGLE_BUTTON_KEY","NAME","pressYButtonProps","loading","Boolean","active","type","default","undefined","injectSymbol","variation","String","small","icon","outlined","rounded","filled","color","noWave","YButton","name","directives","props","emits","click","event","choice","setup","_ref","attrs","slots","emit","link","select","isActive","isLink","value","isSelected","variations","split","map","trim","classes","includes","disabled","styles","textColor","isDisabled","onClick","e","metaKey","altKey","ctrlKey","shiftKey","button","target","navigate","toggle","Tag","_withDirectives","_createVNode","selectedClass","href","width","height","append","_resolveDirective"],"sources":["../../../src/components/button/YButton.tsx"],"sourcesContent":["import type { PropType } from 'vue';\r\nimport { computed, defineComponent, mergeProps } from 'vue';\r\n\r\nimport {\r\n pressChoiceItemPropsOptions,\r\n useChoiceItem,\r\n} from '../../composables/choice';\r\nimport { useChoiceByLink } from '../../composables/choice-link';\r\nimport { useRender } from '../../composables/component';\r\nimport {\r\n pressVueRouterPropsOptions,\r\n useLink,\r\n} from '../../composables/vue-router';\r\nimport { PlateWave } from '../../directives/plate-wave';\r\nimport { isColorValue } from '../../util/color';\r\nimport { EventProp, propsFactory } from '../../util/vue-component';\r\nimport { YSpinnerRing } from '../loading/YSpinnerRing';\r\nimport { Y_TOGGLE_BUTTON_KEY } from '../toggle-button';\r\n\r\n/**\r\n * Style\r\n */\r\nimport './YButton.scss';\r\n\r\nconst NAME = 'y-button';\r\n\r\nexport const pressYButtonProps = propsFactory(\r\n {\r\n loading: Boolean,\r\n active: { type: Boolean, default: undefined },\r\n injectSymbol: { type: null, default: Y_TOGGLE_BUTTON_KEY },\r\n //\r\n variation: {\r\n type: String as PropType<string>,\r\n },\r\n small: Boolean,\r\n icon: Boolean,\r\n outlined: {\r\n type: Boolean,\r\n default: false,\r\n },\r\n rounded: {\r\n type: Boolean,\r\n default: false,\r\n },\r\n filled: {\r\n type: Boolean,\r\n default: false,\r\n },\r\n //\r\n color: {\r\n type: String,\r\n },\r\n noWave: {\r\n type: Boolean,\r\n default: false,\r\n },\r\n ...pressVueRouterPropsOptions(),\r\n ...pressChoiceItemPropsOptions(),\r\n },\r\n 'YButton',\r\n);\r\n\r\nexport const YButton = defineComponent({\r\n name: 'YButton',\r\n directives: {\r\n PlateWave,\r\n },\r\n props: pressYButtonProps(),\r\n emits: {\r\n click: (event: MouseEvent) => true,\r\n 'choice:selected': (choice: { value: boolean }) => true,\r\n },\r\n setup(props, { attrs, slots, emit }) {\r\n const choice = useChoiceItem(props, props.injectSymbol, false);\r\n const link = useLink(props, attrs);\r\n useChoiceByLink(link, choice?.select);\r\n\r\n const isActive = computed(() => {\r\n if (props.active !== undefined) {\r\n return props.active;\r\n }\r\n if (link.isLink.value) {\r\n return link.isActive?.value;\r\n }\r\n return choice?.isSelected.value;\r\n });\r\n\r\n const variations = computed(() => {\r\n const { variation } = props;\r\n if (typeof variation === 'string') {\r\n return variation.split(',').map((value) => {\r\n return value.trim();\r\n });\r\n }\r\n return [];\r\n });\r\n\r\n const classes = computed(() => {\r\n const { outlined, rounded, filled, small, icon } = props;\r\n return {\r\n [`${NAME}--outlined`]:\r\n variations.value.includes('outlined') || outlined,\r\n [`${NAME}--rounded`]: variations.value.includes('rounded') || rounded,\r\n [`${NAME}--filled`]: variations.value.includes('filled') || filled,\r\n [`${NAME}--text`]: variations.value.includes('text'),\r\n [`${NAME}--small`]: variations.value.includes('small') || small,\r\n [`${NAME}--icon`]: variations.value.includes('icon') || icon,\r\n [`${NAME}--color`]: props.color,\r\n [`${NAME}--loading`]: props.loading,\r\n [`${NAME}--disabled`]: props.disabled,\r\n [`${NAME}--active`]: isActive.value,\r\n };\r\n });\r\n\r\n const styles = computed(() => {\r\n let { color } = props;\r\n let textColor: string | undefined;\r\n if (color && !isColorValue(color)) {\r\n color = `var(--y-theme-${color})`;\r\n textColor = `var(--y-theme-on-${props.color})`;\r\n }\r\n return {\r\n [`--y-button__color`]: color,\r\n [`--y-button__text-color`]: textColor,\r\n };\r\n });\r\n\r\n const isDisabled = computed(() => {\r\n return choice?.disabled.value || props.disabled;\r\n });\r\n\r\n /// Events\r\n function onClick(e: MouseEvent) {\r\n if (\r\n isDisabled.value ||\r\n props.loading ||\r\n (link.isLink.value &&\r\n (e.metaKey ||\r\n e.altKey ||\r\n e.ctrlKey ||\r\n e.shiftKey ||\r\n e.button !== 0 ||\r\n attrs.target === '_blank'))\r\n ) {\r\n return;\r\n }\r\n emit('click', e);\r\n link.navigate?.(e);\r\n choice?.toggle();\r\n }\r\n\r\n useRender(() => {\r\n const Tag = link.isLink.value ? 'a' : 'button';\r\n return (\r\n <Tag\r\n class={[\r\n `${NAME}`,\r\n choice?.selectedClass.value,\r\n {\r\n ...classes.value,\r\n },\r\n ]}\r\n href={props.disabled ? undefined : link.href.value}\r\n style={styles.value}\r\n onClick={onClick}\r\n disabled={props.disabled ? true : undefined}\r\n v-plate-wave={!props.noWave && !props.loading}\r\n >\r\n <span class={['y-button__content']}>\r\n {props.loading && (\r\n <YSpinnerRing\r\n {...mergeProps({ width: '24', height: '24' })}\r\n ></YSpinnerRing>\r\n )}\r\n {slots.default?.()}\r\n </span>\r\n {slots.append?.()}\r\n </Tag>\r\n );\r\n });\r\n\r\n return {\r\n link,\r\n };\r\n },\r\n});\r\n\r\nexport type YButton = InstanceType<typeof YButton>;\r\n"],"mappings":";AACA,SAASA,QAAQ,EAAEC,eAAe,EAAEC,UAAU,QAAQ,KAAK;AAAC,SAG1DC,2BAA2B,EAC3BC,aAAa;AAAA,SAENC,eAAe;AAAA,SACfC,SAAS;AAAA,SAEhBC,0BAA0B,EAC1BC,OAAO;AAAA,SAEAC,SAAS;AAAA,SACTC,YAAY;AAAA,SACDC,YAAY;AAAA,SACvBC,YAAY;AAAA,SACZC,mBAAmB;AAE5B;AACA;AACA;AACA;AAEA,MAAMC,IAAI,GAAG,UAAU;AAEvB,OAAO,MAAMC,iBAAiB,GAAGJ,YAAY,CAC3C;EACEK,OAAO,EAAEC,OAAO;EAChBC,MAAM,EAAE;IAAEC,IAAI,EAAEF,OAAO;IAAEG,OAAO,EAAEC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ropsOptions","useLocalTheme","propsFactory","pressYListItemProps","tag","type","String","default","onClick","Function","disabled","Boolean","YListItem","name","props","emits","click","e","setup","_ref","slots","emit","themeClasses","clickable","ElTag","_createVNode","value","leading","trailing"],"sources":["../../../src/components/list/YListItem.tsx"],"sourcesContent":["import { computed, defineComponent } from 'vue';\n\nimport { useRender } from '../../composables/component';\nimport { pressThemePropsOptions, useLocalTheme } from '../../composables/theme';\nimport { propsFactory } from '../../util/vue-component';\n\nimport './YListItem.scss';\n\nexport const pressYListItemProps = propsFactory(\n {\n tag: {\n type: String,\n default: 'div',\n },\n onClick: Function,\n disabled: Boolean,\n ...pressThemePropsOptions(),\n },\n 'YListItem',\n);\n\nexport const YListItem = defineComponent({\n name: 'YListItem',\n props: {\n ...pressYListItemProps(),\n },\n emits: {\n click: (e: MouseEvent) => true,\n },\n setup(props, { slots, emit }) {\n const { themeClasses } = useLocalTheme(props);\n\n function onClick(e: MouseEvent) {\n emit('click', e);\n }\n\n const clickable = computed(() => {\n return !props.disabled;\n });\n\n useRender(() => {\n const ElTag = props.tag as keyof HTMLElementTagNameMap;\n return (\n <ElTag\n class={[\n 'y-list-item',\n { 'y-list-item--pointer': clickable.value },\n themeClasses.value,\n ]}\n onClick={onClick}\n >\n {slots.leading && (\n <div class={'y-list-item__leading'}>{slots.leading()}</div>\n )}\n <div class={'y-list-item__content'}>{slots.default?.()}</div>\n {slots.trailing && (\n <div class={'y-list-item__trailing'}>{slots.trailing()}</div>\n )}\n </ElTag>\n );\n });\n },\n});\n\nexport type YListItem = InstanceType<typeof YListItem>;\n"],"mappings":";AAAA,SAASA,QAAQ,EAAEC,eAAe,QAAQ,KAAK;AAAC,SAEvCC,SAAS;AAAA,SACTC,sBAAsB,EAAEC,aAAa;AAAA,SACrCC,YAAY;AAErB;AAEA,OAAO,MAAMC,mBAAmB,GAAGD,YAAY,CAC7C;EACEE,GAAG,EAAE;IACHC,IAAI,EAAEC,MAAM;IACZC,OAAO,EAAE;EACX,CAAC;EACDC,OAAO,EAAEC,QAAQ;EACjBC,QAAQ,EAAEC,OAAO;EACjB,GAAGX,sBAAsB,CAAC;AAC5B,CAAC,EACD,WACF,CAAC;AAED,OAAO,MAAMY,SAAS,GAAGd,eAAe,CAAC;EACvCe,IAAI,EAAE,WAAW;EACjBC,KAAK,EAAE;IACL,GAAGX,mBAAmB,CAAC;EACzB,CAAC;EACDY,KAAK,EAAE;IACLC,KAAK,EAAGC,CAAa,IAAK;EAC5B,CAAC;EACDC,KAAKA,CAACJ,KAAK,EAAAK,IAAA,EAAmB;IAAA,IAAjB;MAAEC,KAAK;MAAEC;IAAK,CAAC,GAAAF,IAAA;IAC1B,MAAM;MAAEG;IAAa,CAAC,GAAGrB,aAAa,CAACa,KAAK,CAAC;IAE7C,SAASN,OAAOA,CAACS,CAAa,EAAE;MAC9BI,IAAI,CAAC,OAAO,EAAEJ,CAAC,CAAC;IAClB;IAEA,MAAMM,SAAS,GAAG1B,QAAQ,CAAC,MAAM;MAC/B,OAAO,CAACiB,KAAK,CAACJ,QAAQ;
|
|
1
|
+
{"version":3,"file":"YListItem.mjs","names":["computed","defineComponent","useRender","pressThemePropsOptions","useLocalTheme","propsFactory","pressYListItemProps","tag","type","String","default","onClick","Function","disabled","Boolean","YListItem","name","props","emits","click","e","setup","_ref","slots","emit","themeClasses","clickable","ElTag","_createVNode","value","leading","trailing"],"sources":["../../../src/components/list/YListItem.tsx"],"sourcesContent":["import { computed, defineComponent } from 'vue';\n\nimport { useRender } from '../../composables/component';\nimport { pressThemePropsOptions, useLocalTheme } from '../../composables/theme';\nimport { propsFactory } from '../../util/vue-component';\n\nimport './YListItem.scss';\n\nexport const pressYListItemProps = propsFactory(\n {\n tag: {\n type: String,\n default: 'div',\n },\n onClick: Function,\n disabled: Boolean,\n ...pressThemePropsOptions(),\n },\n 'YListItem',\n);\n\nexport const YListItem = defineComponent({\n name: 'YListItem',\n props: {\n ...pressYListItemProps(),\n },\n emits: {\n click: (e: MouseEvent) => true,\n },\n setup(props, { slots, emit }) {\n const { themeClasses } = useLocalTheme(props);\n\n function onClick(e: MouseEvent) {\n emit('click', e);\n }\n\n const clickable = computed(() => {\n return !props.disabled && !!props.onClick;\n });\n\n useRender(() => {\n const ElTag = props.tag as keyof HTMLElementTagNameMap;\n return (\n <ElTag\n class={[\n 'y-list-item',\n { 'y-list-item--pointer': clickable.value },\n themeClasses.value,\n ]}\n onClick={onClick}\n >\n {slots.leading && (\n <div class={'y-list-item__leading'}>{slots.leading()}</div>\n )}\n <div class={'y-list-item__content'}>{slots.default?.()}</div>\n {slots.trailing && (\n <div class={'y-list-item__trailing'}>{slots.trailing()}</div>\n )}\n </ElTag>\n );\n });\n },\n});\n\nexport type YListItem = InstanceType<typeof YListItem>;\n"],"mappings":";AAAA,SAASA,QAAQ,EAAEC,eAAe,QAAQ,KAAK;AAAC,SAEvCC,SAAS;AAAA,SACTC,sBAAsB,EAAEC,aAAa;AAAA,SACrCC,YAAY;AAErB;AAEA,OAAO,MAAMC,mBAAmB,GAAGD,YAAY,CAC7C;EACEE,GAAG,EAAE;IACHC,IAAI,EAAEC,MAAM;IACZC,OAAO,EAAE;EACX,CAAC;EACDC,OAAO,EAAEC,QAAQ;EACjBC,QAAQ,EAAEC,OAAO;EACjB,GAAGX,sBAAsB,CAAC;AAC5B,CAAC,EACD,WACF,CAAC;AAED,OAAO,MAAMY,SAAS,GAAGd,eAAe,CAAC;EACvCe,IAAI,EAAE,WAAW;EACjBC,KAAK,EAAE;IACL,GAAGX,mBAAmB,CAAC;EACzB,CAAC;EACDY,KAAK,EAAE;IACLC,KAAK,EAAGC,CAAa,IAAK;EAC5B,CAAC;EACDC,KAAKA,CAACJ,KAAK,EAAAK,IAAA,EAAmB;IAAA,IAAjB;MAAEC,KAAK;MAAEC;IAAK,CAAC,GAAAF,IAAA;IAC1B,MAAM;MAAEG;IAAa,CAAC,GAAGrB,aAAa,CAACa,KAAK,CAAC;IAE7C,SAASN,OAAOA,CAACS,CAAa,EAAE;MAC9BI,IAAI,CAAC,OAAO,EAAEJ,CAAC,CAAC;IAClB;IAEA,MAAMM,SAAS,GAAG1B,QAAQ,CAAC,MAAM;MAC/B,OAAO,CAACiB,KAAK,CAACJ,QAAQ,IAAI,CAAC,CAACI,KAAK,CAACN,OAAO;IAC3C,CAAC,CAAC;IAEFT,SAAS,CAAC,MAAM;MACd,MAAMyB,KAAK,GAAGV,KAAK,CAACV,GAAkC;MACtD,OAAAqB,YAAA,CAAAD,KAAA;QAAA,SAEW,CACL,aAAa,EACb;UAAE,sBAAsB,EAAED,SAAS,CAACG;QAAM,CAAC,EAC3CJ,YAAY,CAACI,KAAK,CACnB;QAAA,WACQlB;MAAO;QAAAD,OAAA,EAAAA,CAAA,MAEfa,KAAK,CAACO,OAAO,IAAAF,YAAA;UAAA,SACA;QAAsB,IAAGL,KAAK,CAACO,OAAO,CAAC,CAAC,EACrD,EAAAF,YAAA;UAAA,SACW;QAAsB,IAAGL,KAAK,CAACb,OAAO,GAAG,CAAC,IACrDa,KAAK,CAACQ,QAAQ,IAAAH,YAAA;UAAA,SACD;QAAuB,IAAGL,KAAK,CAACQ,QAAQ,CAAC,CAAC,EACvD;MAAA;IAGP,CAAC,CAAC;EACJ;AACF,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mergeProps as _mergeProps, createVNode as _createVNode
|
|
1
|
+
import { mergeProps as _mergeProps, createVNode as _createVNode } from "vue";
|
|
2
2
|
import { shallowRef } from '@vue/runtime-core';
|
|
3
3
|
import { computed, defineComponent, ref } from 'vue';
|
|
4
4
|
import { useRender } from "../../composables/component.mjs";
|
|
@@ -44,7 +44,7 @@ export const YTab = defineComponent({
|
|
|
44
44
|
}
|
|
45
45
|
useRender(() => {
|
|
46
46
|
const yButtonProps = chooseProps(props, YButton.props);
|
|
47
|
-
return _createVNode(
|
|
47
|
+
return _createVNode(YButton, _mergeProps({
|
|
48
48
|
"class": ['y-tab'],
|
|
49
49
|
"active": false
|
|
50
50
|
}, attrsProps.value, attrs, yButtonProps, {
|
|
@@ -57,7 +57,7 @@ export const YTab = defineComponent({
|
|
|
57
57
|
"class": ['y-tab__indicator'],
|
|
58
58
|
"style": indicatorStyles.value
|
|
59
59
|
}, null)
|
|
60
|
-
})
|
|
60
|
+
});
|
|
61
61
|
});
|
|
62
62
|
return {};
|
|
63
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"YTab.mjs","names":["shallowRef","computed","defineComponent","ref","useRender","chooseProps","propsFactory","YButton","pressYButtonProps","Y_TABS_KEY","pressYTabPropsOptions","text","String","hideIndicator","Boolean","indicatorColor","selectedClass","noWave","YTab","name","props","slots","Object","setup","_ref","attrs","selected","indicator$","indicatorStyles","attrsProps","role","value","tabindex","onChoice","_ref2","yButtonProps","_createVNode","
|
|
1
|
+
{"version":3,"file":"YTab.mjs","names":["shallowRef","computed","defineComponent","ref","useRender","chooseProps","propsFactory","YButton","pressYButtonProps","Y_TABS_KEY","pressYTabPropsOptions","text","String","hideIndicator","Boolean","indicatorColor","selectedClass","noWave","YTab","name","props","slots","Object","setup","_ref","attrs","selected","indicator$","indicatorStyles","attrsProps","role","value","tabindex","onChoice","_ref2","yButtonProps","_createVNode","_mergeProps","default","append"],"sources":["../../../src/components/tab/YTab.tsx"],"sourcesContent":["import { shallowRef } from '@vue/runtime-core';\r\nimport { PropType, SlotsType, computed, defineComponent, ref } from 'vue';\r\n\r\nimport { useRender } from '../../composables/component';\r\nimport { chooseProps, propsFactory } from '../../util';\r\nimport { YButton, pressYButtonProps } from '../button';\r\nimport { Y_TABS_KEY } from './shared';\r\n\r\nimport './YTab.scss';\r\n\r\nexport const pressYTabPropsOptions = propsFactory(\r\n {\r\n text: String as PropType<string>,\r\n hideIndicator: Boolean as PropType<boolean>,\r\n indicatorColor: String as PropType<string>,\r\n ...pressYButtonProps({\r\n selectedClass: 'y-tab--selected',\r\n noWave: true,\r\n }),\r\n },\r\n 'YTab',\r\n);\r\n\r\nexport const YTab = defineComponent({\r\n name: 'YTab',\r\n props: pressYTabPropsOptions(),\r\n slots: Object as SlotsType<{\r\n default?: any;\r\n }>,\r\n setup(props, { slots, attrs }) {\r\n const selected = shallowRef(false);\r\n\r\n const indicator$ = ref();\r\n const indicatorStyles = computed(() => {\r\n return {};\r\n });\r\n const attrsProps = computed(() => {\r\n return {\r\n role: 'tab',\r\n 'aria-selected': `${String(selected.value)}`,\r\n tabindex: selected.value ? 0 : -1,\r\n };\r\n });\r\n\r\n function onChoice({ value }: { value: boolean }) {\r\n selected.value = value;\r\n }\r\n\r\n useRender(() => {\r\n const yButtonProps = chooseProps(props, YButton.props);\r\n return (\r\n <YButton\r\n class={['y-tab']}\r\n active={false}\r\n {...attrsProps.value}\r\n {...attrs}\r\n {...yButtonProps}\r\n injectSymbol={Y_TABS_KEY}\r\n onChoice:selected={onChoice}\r\n >\r\n {{\r\n default: () => slots.default?.() ?? props.text,\r\n append: () =>\r\n !props.hideIndicator && (\r\n <div\r\n ref={indicator$}\r\n class={['y-tab__indicator']}\r\n style={indicatorStyles.value}\r\n ></div>\r\n ),\r\n }}\r\n </YButton>\r\n );\r\n });\r\n\r\n return {};\r\n },\r\n});\r\n\r\nexport type YTab = InstanceType<typeof YTab>;\r\n"],"mappings":";AAAA,SAASA,UAAU,QAAQ,mBAAmB;AAC9C,SAA8BC,QAAQ,EAAEC,eAAe,EAAEC,GAAG,QAAQ,KAAK;AAAC,SAEjEC,SAAS;AAAA,SACTC,WAAW,EAAEC,YAAY;AAAA,SACzBC,OAAO,EAAEC,iBAAiB;AAAA,SAC1BC,UAAU;AAEnB;AAEA,OAAO,MAAMC,qBAAqB,GAAGJ,YAAY,CAC/C;EACEK,IAAI,EAAEC,MAA0B;EAChCC,aAAa,EAAEC,OAA4B;EAC3CC,cAAc,EAAEH,MAA0B;EAC1C,GAAGJ,iBAAiB,CAAC;IACnBQ,aAAa,EAAE,iBAAiB;IAChCC,MAAM,EAAE;EACV,CAAC;AACH,CAAC,EACD,MACF,CAAC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CAACnB,KAAK,CAACP,aAAa,IAAAuB,YAAA;UAAA,OAEXT,UAAU;UAAA,SACR,CAAC,kBAAkB,CAAC;UAAA,SACpBC,eAAe,CAACG;QAAK;MAE/B;IAIX,CAAC,CAAC;IAEF,OAAO,CAAC,CAAC;EACX;AACF,CAAC,CAAC"}
|
|
@@ -187,6 +187,7 @@ export const YTreeView = defineComponent({
|
|
|
187
187
|
if (to) {
|
|
188
188
|
activeSet.value.add(key);
|
|
189
189
|
node.active = true;
|
|
190
|
+
issueVnodeState(key);
|
|
190
191
|
} else {
|
|
191
192
|
if (props.requiredActive && activeSet.value.size === 1 && key === inactiveKey) {
|
|
192
193
|
issueVnodeState(key);
|
|
@@ -275,6 +276,7 @@ export const YTreeView = defineComponent({
|
|
|
275
276
|
|
|
276
277
|
// init
|
|
277
278
|
const oldSelected = [...selectedSet.value];
|
|
279
|
+
const oldActive = [...activeSet.value];
|
|
278
280
|
selectedSet.value.clear();
|
|
279
281
|
expandedSet.value.clear();
|
|
280
282
|
activeSet.value.clear();
|
|
@@ -282,6 +284,9 @@ export const YTreeView = defineComponent({
|
|
|
282
284
|
if (!deepEqual(oldSelected, [...selectedSet.value])) {
|
|
283
285
|
emitSelected();
|
|
284
286
|
}
|
|
287
|
+
if (!deepEqual(oldActive, [...activeSet.value])) {
|
|
288
|
+
emitActive();
|
|
289
|
+
}
|
|
285
290
|
}, {
|
|
286
291
|
deep: true
|
|
287
292
|
});
|
|
@@ -345,7 +350,7 @@ export const YTreeView = defineComponent({
|
|
|
345
350
|
};
|
|
346
351
|
});
|
|
347
352
|
onMounted(() => {
|
|
348
|
-
if (props.defaultExpand !==
|
|
353
|
+
if (props.defaultExpand != null && props.defaultExpand !== false) {
|
|
349
354
|
expandedCache.value = [...expand(props.defaultExpand)];
|
|
350
355
|
} else {
|
|
351
356
|
expanded.value.forEach(v => updateExpanded(getNodeKey(v), true));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"YTreeView.mjs","names":["computed","defineComponent","onMounted","provide","ref","shallowRef","watch","watchEffect","useModelDuplex","useRender","differenceBetween","isColorValue","deepEqual","getObjectValueByPath","hasOwnProperty","debounce","chooseProps","YProgressBar","YTreeViewNode","pressYTreeViewNodeProps","filterTreeItem","filterTreeItems","getKeys","treeViewNodeProps","YTreeView","name","props","expanded","type","Array","default","active","multipleActive","Boolean","activeStrategy","String","selected","selectStrategy","returnItem","defaultExpand","Number","filter","Function","searchDebounceWait","emits","setup","_ref","slots","emit","expose","nodes","expandedSet","Set","selectedSet","activeSet","excludedSet","filterItemsFn","excludeItem","expandedCache","searchLoading","items","search","arguments","length","undefined","excluded","value","diff","forEach","key","updateExpanded","item","itemKey","itemText","itemChildren","expand","getDescendants","descendants","childKeys","push","childKey","getNodeKey","itemOrKey","updateNodes","parentKey","level","children","exist","existNode","vnode","indeterminate","node","map","child","add","issueVnodeState","to","isArray","delete","neo","deep","until","Object","entries","_ref2","emitExpanded","updateActive","event","inactiveKey","keys","requiredActive","size","activeSingleModifier","getModifierState","descendant","updateSelected","arr","emitActive","emitSelected","stateWatcher","stateSet","updater","emitter","valuesOfKey","v","old","oldKeys","nodeKey","neoKeys","k","oldSelected","clear","isExcluded","has","register","activeValue","selectedValue","renderLeaves","leaf","classes","styles","color","activeColor","_createVNode","_Fragment","_mergeProps","_createTextVNode"],"sources":["../../../src/components/tree-view/YTreeView.tsx"],"sourcesContent":["import {\r\n PropType,\r\n Ref,\r\n VNode,\r\n computed,\r\n defineComponent,\r\n onMounted,\r\n provide,\r\n ref,\r\n shallowRef,\r\n watch,\r\n watchEffect,\r\n} from 'vue';\r\n\r\nimport { useModelDuplex } from '../../composables/communication';\r\nimport { useRender } from '../../composables/component';\r\nimport { CandidateKey } from '../../types';\r\nimport { differenceBetween } from '../../util/array';\r\nimport { isColorValue } from '../../util/color';\r\nimport {\r\n deepEqual,\r\n getObjectValueByPath,\r\n hasOwnProperty,\r\n} from '../../util/common';\r\nimport { debounce } from '../../util/debounce';\r\nimport { chooseProps } from '../../util/vue-component';\r\nimport { YProgressBar } from '../progress-bar';\r\nimport { YTreeViewNode, pressYTreeViewNodeProps } from './YTreeViewNode';\r\nimport { NodeState, TreeviewFilterFn } from './types';\r\nimport { filterTreeItem, filterTreeItems, getKeys } from './util';\r\n\r\nimport './YTreeView.scss';\r\n\r\nconst treeViewNodeProps = pressYTreeViewNodeProps();\r\n\r\nexport const YTreeView = defineComponent({\r\n name: 'YTreeView',\r\n props: {\r\n expanded: {\r\n type: [Array] as PropType<CandidateKey[]>,\r\n default: () => [],\r\n },\r\n active: {\r\n type: [Array] as PropType<CandidateKey[]>,\r\n default: () => [],\r\n },\r\n multipleActive: Boolean,\r\n activeStrategy: {\r\n type: String as PropType<'independent' | 'cascade'>, // TODO: 'leaf'\r\n default: 'independent',\r\n },\r\n selected: {\r\n type: [Array] as PropType<CandidateKey[]>,\r\n default: () => [],\r\n },\r\n selectStrategy: {\r\n type: String as PropType<'independent' | 'cascade'>, // TODO: 'leaf'\r\n default: 'leaf',\r\n },\r\n returnItem: Boolean,\r\n defaultExpand: [Boolean, String, Number],\r\n filter: Function as PropType<TreeviewFilterFn>,\r\n searchDebounceWait: {\r\n type: Number as PropType<number>,\r\n default: 700,\r\n },\r\n ...treeViewNodeProps,\r\n },\r\n emits: ['update:expanded', 'update:active', 'update:selected'],\r\n setup(props, { slots, emit, expose }) {\r\n const nodes = ref<Record<CandidateKey, any>>({});\r\n\r\n const expanded = useModelDuplex(props, 'expanded');\r\n const active = useModelDuplex(props, 'active');\r\n const selected = useModelDuplex(props, 'selected');\r\n\r\n const expandedSet = ref(new Set<CandidateKey>());\r\n const selectedSet = ref(new Set<CandidateKey>());\r\n const activeSet = ref(new Set<CandidateKey>());\r\n const excludedSet = ref(new Set<CandidateKey>());\r\n const filterItemsFn = shallowRef(\r\n debounce(excludeItem, props.searchDebounceWait),\r\n );\r\n const expandedCache = ref<CandidateKey[]>([]);\r\n const searchLoading = shallowRef(false);\r\n\r\n function excludeItem(items: any[], search = '', filter = filterTreeItem) {\r\n const excluded = new Set<CandidateKey>();\r\n if (!search) {\r\n searchLoading.value = false;\r\n excludedSet.value = excluded;\r\n const diff = differenceBetween(expandedCache.value, [\r\n ...expandedSet.value,\r\n ]);\r\n diff.forEach((key) => {\r\n updateExpanded(key, false);\r\n });\r\n expandedCache.value.forEach((key) => {\r\n updateExpanded(key, true);\r\n });\r\n return;\r\n }\r\n for (const item of items) {\r\n filterTreeItems(\r\n filter,\r\n item,\r\n search ?? '',\r\n props.itemKey,\r\n props.itemText,\r\n props.itemChildren as string,\r\n excluded,\r\n );\r\n }\r\n excludedSet.value = excluded;\r\n searchLoading.value = false;\r\n expand();\r\n }\r\n\r\n watchEffect(() => {\r\n searchLoading.value = true;\r\n filterItemsFn.value(props.items, props.search, props.filter);\r\n });\r\n\r\n // Util Methods\r\n function getDescendants(\r\n key: CandidateKey,\r\n descendants: CandidateKey[] = [],\r\n ) {\r\n const { childKeys } = nodes.value[key];\r\n descendants.push(...childKeys);\r\n for (const childKey of childKeys) {\r\n descendants = getDescendants(childKey, descendants);\r\n }\r\n return descendants;\r\n }\r\n\r\n function getNodeKey(itemOrKey: any) {\r\n return props.returnItem\r\n ? getObjectValueByPath(itemOrKey, props.itemKey)\r\n : itemOrKey;\r\n }\r\n\r\n // State Methods\r\n function updateNodes(\r\n items: any[],\r\n parentKey: CandidateKey | null = null,\r\n level = 0,\r\n ) {\r\n for (const item of items) {\r\n const key = getObjectValueByPath(item, props.itemKey);\r\n const children =\r\n getObjectValueByPath(item, props.itemChildren as string) ?? [];\r\n const exist = hasOwnProperty(nodes.value, key);\r\n const existNode = exist\r\n ? nodes.value[key]\r\n : {\r\n vnode: null,\r\n selected: false,\r\n indeterminate: false,\r\n active: false,\r\n expanded: false,\r\n };\r\n const node: NodeState = {\r\n vnode: existNode.vnode,\r\n item,\r\n level,\r\n parentKey,\r\n childKeys: children.map((child: any) =>\r\n getObjectValueByPath(child, props.itemKey),\r\n ),\r\n expanded: children.length > 0 && existNode.expanded,\r\n active: existNode.active,\r\n indeterminate: existNode.indeterminate,\r\n selected: existNode.selected,\r\n };\r\n\r\n updateNodes(children, key, level + 1);\r\n\r\n nodes.value[key] = node;\r\n if (nodes.value[key].expanded) {\r\n expandedSet.value.add(key);\r\n }\r\n if (nodes.value[key].selected) {\r\n expandedSet.value.add(key);\r\n }\r\n if (nodes.value[key].active) {\r\n activeSet.value.add(key);\r\n }\r\n\r\n issueVnodeState(key);\r\n }\r\n }\r\n\r\n function updateExpanded(key: CandidateKey, to: boolean) {\r\n if (!(key in nodes.value)) return;\r\n const node = nodes.value[key];\r\n const children = getObjectValueByPath(\r\n node.item,\r\n props.itemChildren as string,\r\n );\r\n if (Array.isArray(children) && children.length > 0) {\r\n to ? expandedSet.value.add(key) : expandedSet.value.delete(key);\r\n node.expanded = to;\r\n issueVnodeState(key);\r\n }\r\n }\r\n\r\n watch(\r\n expandedSet,\r\n (neo) => {\r\n if (!props.search) {\r\n expandedCache.value = [...neo];\r\n }\r\n },\r\n { deep: true },\r\n );\r\n\r\n function expand(until: boolean | string | number = true) {\r\n Object.entries(nodes.value).forEach(([key, node]) => {\r\n if (until === true || until >= node.level) {\r\n updateExpanded(key, true);\r\n }\r\n });\r\n emitExpanded();\r\n return expandedSet.value;\r\n }\r\n\r\n function updateActive(key: CandidateKey, to: boolean, event?: MouseEvent) {\r\n if (!(key in nodes.value)) return;\r\n const node = nodes.value[key];\r\n let inactiveKey = !to ? key : '';\r\n if (!props.multipleActive) {\r\n [inactiveKey] = activeSet.value.keys();\r\n }\r\n if (to) {\r\n activeSet.value.add(key);\r\n node.active = true;\r\n } else {\r\n if (\r\n props.requiredActive &&\r\n activeSet.value.size === 1 &&\r\n key === inactiveKey\r\n ) {\r\n issueVnodeState(key);\r\n return;\r\n }\r\n }\r\n if (inactiveKey && inactiveKey in nodes.value) {\r\n activeSet.value.delete(inactiveKey);\r\n nodes.value[inactiveKey].active = false;\r\n issueVnodeState(inactiveKey);\r\n }\r\n\r\n if (\r\n props.activeSingleModifier &&\r\n event?.getModifierState(props.activeSingleModifier)\r\n ) {\r\n return;\r\n }\r\n\r\n if (props.multipleActive && props.activeStrategy === 'cascade') {\r\n for (const descendant of getDescendants(key)) {\r\n if (descendant in nodes.value) {\r\n to\r\n ? activeSet.value.add(descendant)\r\n : activeSet.value.delete(descendant);\r\n nodes.value[descendant].active = to;\r\n issueVnodeState(descendant);\r\n }\r\n }\r\n }\r\n }\r\n\r\n function updateSelected(key: CandidateKey, to: boolean) {\r\n if (!(key in nodes.value)) return;\r\n const node = nodes.value[key];\r\n\r\n if (to) {\r\n selectedSet.value.add(key);\r\n node.selected = true;\r\n }\r\n\r\n if (!to && key in nodes.value) {\r\n selectedSet.value.delete(key);\r\n nodes.value[key].selected = false;\r\n issueVnodeState(key);\r\n }\r\n\r\n if (props.selectStrategy === 'cascade') {\r\n for (const descendant of getDescendants(key)) {\r\n if (descendant in nodes.value) {\r\n to\r\n ? selectedSet.value.add(descendant)\r\n : selectedSet.value.delete(descendant);\r\n nodes.value[descendant].selected = to;\r\n issueVnodeState(descendant);\r\n }\r\n }\r\n }\r\n }\r\n\r\n function emitExpanded() {\r\n const arr = [...expandedSet.value];\r\n expanded.value = props.returnItem\r\n ? arr.map((key) => nodes.value[key].item)\r\n : arr;\r\n }\r\n\r\n function emitActive() {\r\n const arr = [...activeSet.value];\r\n active.value = props.returnItem\r\n ? arr.map((key) => nodes.value[key].item)\r\n : arr;\r\n }\r\n\r\n function emitSelected() {\r\n const arr = [...selectedSet.value];\r\n selected.value = props.returnItem\r\n ? arr.map((key) => nodes.value[key].item)\r\n : arr;\r\n }\r\n\r\n function stateWatcher(\r\n value: any[],\r\n stateSet: Ref<Set<CandidateKey>>,\r\n updater: (key: CandidateKey, to: boolean) => void,\r\n emitter: () => void,\r\n ) {\r\n const valuesOfKey = props.returnItem\r\n ? value.map((v) => getObjectValueByPath(v, props.itemKey))\r\n : value;\r\n const old = [...stateSet.value];\r\n if (deepEqual(old, valuesOfKey)) {\r\n return;\r\n }\r\n old.forEach((key) => updater(key, false));\r\n valuesOfKey.forEach((key) => updater(key, true));\r\n emitter();\r\n }\r\n\r\n watch(expanded, (neo) => {\r\n stateWatcher(neo, expandedSet, updateExpanded, emitExpanded);\r\n });\r\n\r\n watch(active, (neo) => {\r\n stateWatcher(neo, activeSet, updateActive, emitActive);\r\n });\r\n\r\n watch(selected, (neo) => {\r\n stateWatcher(neo, selectedSet, updateSelected, emitSelected);\r\n });\r\n\r\n watch(\r\n () => props.items,\r\n (neo: any[]) => {\r\n const oldKeys = Object.keys(nodes.value).map((nodeKey) =>\r\n getObjectValueByPath(nodes.value[nodeKey].item, props.itemKey),\r\n );\r\n const neoKeys = getKeys(\r\n neo,\r\n props.itemKey,\r\n props.itemChildren as string,\r\n );\r\n const diff = differenceBetween(oldKeys, neoKeys);\r\n if (diff.length < 1 && neoKeys.length < oldKeys.length) {\r\n return;\r\n }\r\n diff.forEach((k) => delete nodes.value[k]);\r\n\r\n // init\r\n const oldSelected = [...selectedSet.value];\r\n selectedSet.value.clear();\r\n expandedSet.value.clear();\r\n activeSet.value.clear();\r\n updateNodes(neo);\r\n if (!deepEqual(oldSelected, [...selectedSet.value])) {\r\n emitSelected();\r\n }\r\n },\r\n { deep: true },\r\n );\r\n\r\n // Search\r\n function isExcluded(key: CandidateKey) {\r\n return !!props.search && excludedSet.value.has(key);\r\n }\r\n\r\n // Provide & Issue\r\n function issueVnodeState(key: CandidateKey) {\r\n const node = nodes.value[key];\r\n if (node && node.vnode) {\r\n node.vnode.active = node.active;\r\n node.vnode.selected = node.selected;\r\n node.vnode.indeterminate = node.indeterminate;\r\n node.vnode.expanded = node.expanded;\r\n }\r\n }\r\n\r\n function register(key: CandidateKey, vnode: VNode) {\r\n if (nodes.value[key]) {\r\n nodes.value[key].vnode = vnode;\r\n }\r\n\r\n issueVnodeState(key);\r\n }\r\n\r\n updateNodes(props.items);\r\n\r\n for (const activeValue of props.active.map(getNodeKey)) {\r\n updateActive(activeValue, true);\r\n }\r\n\r\n for (const selectedValue of props.selected.map(getNodeKey)) {\r\n updateSelected(selectedValue, true);\r\n }\r\n\r\n provide('tree-view', {\r\n register,\r\n updateExpanded,\r\n updateActive,\r\n updateSelected,\r\n emitExpanded,\r\n emitActive,\r\n emitSelected,\r\n isExcluded,\r\n searchLoading,\r\n });\r\n\r\n const renderLeaves = computed(() => {\r\n return props.items.filter((leaf) => {\r\n return !isExcluded(getObjectValueByPath(leaf, props.itemKey));\r\n });\r\n });\r\n\r\n const classes = computed(() => {\r\n return {\r\n 'y-tree-view': true,\r\n };\r\n });\r\n\r\n const styles = computed(() => {\r\n let color = props.activeColor;\r\n if (props.activeColor && !isColorValue(props.activeColor)) {\r\n color = `var(--y-theme-${props.activeColor})`;\r\n }\r\n return {\r\n [`--y-tree-view__active-color`]: color,\r\n };\r\n });\r\n\r\n onMounted(() => {\r\n if (props.defaultExpand !== undefined) {\r\n expandedCache.value = [...expand(props.defaultExpand)];\r\n } else {\r\n expanded.value.forEach((v: any) => updateExpanded(getNodeKey(v), true));\r\n emitExpanded();\r\n }\r\n });\r\n\r\n expose({\r\n expand,\r\n });\r\n\r\n useRender(() => {\r\n return (\r\n <>\r\n <div class={classes.value} style={styles.value} role=\"tree\">\r\n {searchLoading.value && <YProgressBar indeterminate />}\r\n {renderLeaves.value.length > 0 ? (\r\n renderLeaves.value.map((leaf) => {\r\n return (\r\n <YTreeViewNode\r\n v-slots={slots}\r\n key={getObjectValueByPath(leaf, props.itemKey)}\r\n {...{\r\n ...chooseProps(props, treeViewNodeProps),\r\n item: leaf,\r\n level: 0,\r\n }}\r\n ></YTreeViewNode>\r\n );\r\n })\r\n ) : (\r\n <div class=\"y-tree-view__no-data\">\r\n {slots['no-data'] ? slots['no-data']() : <span>No Data</span>}\r\n </div>\r\n )}\r\n </div>\r\n </>\r\n );\r\n });\r\n\r\n return {\r\n nodes,\r\n expandedSet,\r\n selectedSet,\r\n activeSet,\r\n excludedSet,\r\n searchLoading,\r\n expandedC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;IACF,CAAC;EACH;AACF,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"YTreeView.mjs","names":["computed","defineComponent","onMounted","provide","ref","shallowRef","watch","watchEffect","useModelDuplex","useRender","differenceBetween","isColorValue","deepEqual","getObjectValueByPath","hasOwnProperty","debounce","chooseProps","YProgressBar","YTreeViewNode","pressYTreeViewNodeProps","filterTreeItem","filterTreeItems","getKeys","treeViewNodeProps","YTreeView","name","props","expanded","type","Array","default","active","multipleActive","Boolean","activeStrategy","String","selected","selectStrategy","returnItem","defaultExpand","Number","filter","Function","searchDebounceWait","emits","setup","_ref","slots","emit","expose","nodes","expandedSet","Set","selectedSet","activeSet","excludedSet","filterItemsFn","excludeItem","expandedCache","searchLoading","items","search","arguments","length","undefined","excluded","value","diff","forEach","key","updateExpanded","item","itemKey","itemText","itemChildren","expand","getDescendants","descendants","childKeys","push","childKey","getNodeKey","itemOrKey","updateNodes","parentKey","level","children","exist","existNode","vnode","indeterminate","node","map","child","add","issueVnodeState","to","isArray","delete","neo","deep","until","Object","entries","_ref2","emitExpanded","updateActive","event","inactiveKey","keys","requiredActive","size","activeSingleModifier","getModifierState","descendant","updateSelected","arr","emitActive","emitSelected","stateWatcher","stateSet","updater","emitter","valuesOfKey","v","old","oldKeys","nodeKey","neoKeys","k","oldSelected","oldActive","clear","isExcluded","has","register","activeValue","selectedValue","renderLeaves","leaf","classes","styles","color","activeColor","_createVNode","_Fragment","_mergeProps","_createTextVNode"],"sources":["../../../src/components/tree-view/YTreeView.tsx"],"sourcesContent":["import {\r\n PropType,\r\n Ref,\r\n VNode,\r\n computed,\r\n defineComponent,\r\n onMounted,\r\n provide,\r\n ref,\r\n shallowRef,\r\n watch,\r\n watchEffect,\r\n} from 'vue';\r\n\r\nimport { useModelDuplex } from '../../composables/communication';\r\nimport { useRender } from '../../composables/component';\r\nimport { CandidateKey } from '../../types';\r\nimport { differenceBetween } from '../../util/array';\r\nimport { isColorValue } from '../../util/color';\r\nimport {\r\n deepEqual,\r\n getObjectValueByPath,\r\n hasOwnProperty,\r\n} from '../../util/common';\r\nimport { debounce } from '../../util/debounce';\r\nimport { chooseProps } from '../../util/vue-component';\r\nimport { YProgressBar } from '../progress-bar';\r\nimport { YTreeViewNode, pressYTreeViewNodeProps } from './YTreeViewNode';\r\nimport { NodeState, TreeviewFilterFn } from './types';\r\nimport { filterTreeItem, filterTreeItems, getKeys } from './util';\r\n\r\nimport './YTreeView.scss';\r\n\r\nconst treeViewNodeProps = pressYTreeViewNodeProps();\r\n\r\nexport const YTreeView = defineComponent({\r\n name: 'YTreeView',\r\n props: {\r\n expanded: {\r\n type: [Array] as PropType<CandidateKey[]>,\r\n default: () => [],\r\n },\r\n active: {\r\n type: [Array] as PropType<CandidateKey[]>,\r\n default: () => [],\r\n },\r\n multipleActive: Boolean,\r\n activeStrategy: {\r\n type: String as PropType<'independent' | 'cascade'>, // TODO: 'leaf'\r\n default: 'independent',\r\n },\r\n selected: {\r\n type: [Array] as PropType<CandidateKey[]>,\r\n default: () => [],\r\n },\r\n selectStrategy: {\r\n type: String as PropType<'independent' | 'cascade'>, // TODO: 'leaf'\r\n default: 'leaf',\r\n },\r\n returnItem: Boolean,\r\n defaultExpand: [Boolean, String, Number],\r\n filter: Function as PropType<TreeviewFilterFn>,\r\n searchDebounceWait: {\r\n type: Number as PropType<number>,\r\n default: 700,\r\n },\r\n ...treeViewNodeProps,\r\n },\r\n emits: ['update:expanded', 'update:active', 'update:selected'],\r\n setup(props, { slots, emit, expose }) {\r\n const nodes = ref<Record<CandidateKey, any>>({});\r\n\r\n const expanded = useModelDuplex(props, 'expanded');\r\n const active = useModelDuplex(props, 'active');\r\n const selected = useModelDuplex(props, 'selected');\r\n\r\n const expandedSet = ref(new Set<CandidateKey>());\r\n const selectedSet = ref(new Set<CandidateKey>());\r\n const activeSet = ref(new Set<CandidateKey>());\r\n const excludedSet = ref(new Set<CandidateKey>());\r\n const filterItemsFn = shallowRef(\r\n debounce(excludeItem, props.searchDebounceWait),\r\n );\r\n const expandedCache = ref<CandidateKey[]>([]);\r\n const searchLoading = shallowRef(false);\r\n\r\n function excludeItem(items: any[], search = '', filter = filterTreeItem) {\r\n const excluded = new Set<CandidateKey>();\r\n if (!search) {\r\n searchLoading.value = false;\r\n excludedSet.value = excluded;\r\n const diff = differenceBetween(expandedCache.value, [\r\n ...expandedSet.value,\r\n ]);\r\n diff.forEach((key) => {\r\n updateExpanded(key, false);\r\n });\r\n expandedCache.value.forEach((key) => {\r\n updateExpanded(key, true);\r\n });\r\n return;\r\n }\r\n for (const item of items) {\r\n filterTreeItems(\r\n filter,\r\n item,\r\n search ?? '',\r\n props.itemKey,\r\n props.itemText,\r\n props.itemChildren as string,\r\n excluded,\r\n );\r\n }\r\n excludedSet.value = excluded;\r\n searchLoading.value = false;\r\n expand();\r\n }\r\n\r\n watchEffect(() => {\r\n searchLoading.value = true;\r\n filterItemsFn.value(props.items, props.search, props.filter);\r\n });\r\n\r\n // Util Methods\r\n function getDescendants(\r\n key: CandidateKey,\r\n descendants: CandidateKey[] = [],\r\n ) {\r\n const { childKeys } = nodes.value[key];\r\n descendants.push(...childKeys);\r\n for (const childKey of childKeys) {\r\n descendants = getDescendants(childKey, descendants);\r\n }\r\n return descendants;\r\n }\r\n\r\n function getNodeKey(itemOrKey: any) {\r\n return props.returnItem\r\n ? getObjectValueByPath(itemOrKey, props.itemKey)\r\n : itemOrKey;\r\n }\r\n\r\n // State Methods\r\n function updateNodes(\r\n items: any[],\r\n parentKey: CandidateKey | null = null,\r\n level = 0,\r\n ) {\r\n for (const item of items) {\r\n const key = getObjectValueByPath(item, props.itemKey);\r\n const children =\r\n getObjectValueByPath(item, props.itemChildren as string) ?? [];\r\n const exist = hasOwnProperty(nodes.value, key);\r\n const existNode = exist\r\n ? nodes.value[key]\r\n : {\r\n vnode: null,\r\n selected: false,\r\n indeterminate: false,\r\n active: false,\r\n expanded: false,\r\n };\r\n const node: NodeState = {\r\n vnode: existNode.vnode,\r\n item,\r\n level,\r\n parentKey,\r\n childKeys: children.map((child: any) =>\r\n getObjectValueByPath(child, props.itemKey),\r\n ),\r\n expanded: children.length > 0 && existNode.expanded,\r\n active: existNode.active,\r\n indeterminate: existNode.indeterminate,\r\n selected: existNode.selected,\r\n };\r\n\r\n updateNodes(children, key, level + 1);\r\n\r\n nodes.value[key] = node;\r\n if (nodes.value[key].expanded) {\r\n expandedSet.value.add(key);\r\n }\r\n if (nodes.value[key].selected) {\r\n expandedSet.value.add(key);\r\n }\r\n if (nodes.value[key].active) {\r\n activeSet.value.add(key);\r\n }\r\n\r\n issueVnodeState(key);\r\n }\r\n }\r\n\r\n function updateExpanded(key: CandidateKey, to: boolean) {\r\n if (!(key in nodes.value)) return;\r\n const node = nodes.value[key];\r\n const children = getObjectValueByPath(\r\n node.item,\r\n props.itemChildren as string,\r\n );\r\n if (Array.isArray(children) && children.length > 0) {\r\n to ? expandedSet.value.add(key) : expandedSet.value.delete(key);\r\n node.expanded = to;\r\n issueVnodeState(key);\r\n }\r\n }\r\n\r\n watch(\r\n expandedSet,\r\n (neo) => {\r\n if (!props.search) {\r\n expandedCache.value = [...neo];\r\n }\r\n },\r\n { deep: true },\r\n );\r\n\r\n function expand(until: boolean | string | number = true) {\r\n Object.entries(nodes.value).forEach(([key, node]) => {\r\n if (until === true || until >= node.level) {\r\n updateExpanded(key, true);\r\n }\r\n });\r\n emitExpanded();\r\n return expandedSet.value;\r\n }\r\n\r\n function updateActive(key: CandidateKey, to: boolean, event?: MouseEvent) {\r\n if (!(key in nodes.value)) return;\r\n const node = nodes.value[key];\r\n let inactiveKey = !to ? key : '';\r\n if (!props.multipleActive) {\r\n [inactiveKey] = activeSet.value.keys();\r\n }\r\n if (to) {\r\n activeSet.value.add(key);\r\n node.active = true;\r\n issueVnodeState(key);\r\n } else {\r\n if (\r\n props.requiredActive &&\r\n activeSet.value.size === 1 &&\r\n key === inactiveKey\r\n ) {\r\n issueVnodeState(key);\r\n return;\r\n }\r\n }\r\n if (inactiveKey && inactiveKey in nodes.value) {\r\n activeSet.value.delete(inactiveKey);\r\n nodes.value[inactiveKey].active = false;\r\n issueVnodeState(inactiveKey);\r\n }\r\n\r\n if (\r\n props.activeSingleModifier &&\r\n event?.getModifierState(props.activeSingleModifier)\r\n ) {\r\n return;\r\n }\r\n\r\n if (props.multipleActive && props.activeStrategy === 'cascade') {\r\n for (const descendant of getDescendants(key)) {\r\n if (descendant in nodes.value) {\r\n to\r\n ? activeSet.value.add(descendant)\r\n : activeSet.value.delete(descendant);\r\n nodes.value[descendant].active = to;\r\n issueVnodeState(descendant);\r\n }\r\n }\r\n }\r\n }\r\n\r\n function updateSelected(key: CandidateKey, to: boolean) {\r\n if (!(key in nodes.value)) return;\r\n const node = nodes.value[key];\r\n\r\n if (to) {\r\n selectedSet.value.add(key);\r\n node.selected = true;\r\n }\r\n\r\n if (!to && key in nodes.value) {\r\n selectedSet.value.delete(key);\r\n nodes.value[key].selected = false;\r\n issueVnodeState(key);\r\n }\r\n\r\n if (props.selectStrategy === 'cascade') {\r\n for (const descendant of getDescendants(key)) {\r\n if (descendant in nodes.value) {\r\n to\r\n ? selectedSet.value.add(descendant)\r\n : selectedSet.value.delete(descendant);\r\n nodes.value[descendant].selected = to;\r\n issueVnodeState(descendant);\r\n }\r\n }\r\n }\r\n }\r\n\r\n function emitExpanded() {\r\n const arr = [...expandedSet.value];\r\n expanded.value = props.returnItem\r\n ? arr.map((key) => nodes.value[key].item)\r\n : arr;\r\n }\r\n\r\n function emitActive() {\r\n const arr = [...activeSet.value];\r\n active.value = props.returnItem\r\n ? arr.map((key) => nodes.value[key].item)\r\n : arr;\r\n }\r\n\r\n function emitSelected() {\r\n const arr = [...selectedSet.value];\r\n selected.value = props.returnItem\r\n ? arr.map((key) => nodes.value[key].item)\r\n : arr;\r\n }\r\n\r\n function stateWatcher(\r\n value: any[],\r\n stateSet: Ref<Set<CandidateKey>>,\r\n updater: (key: CandidateKey, to: boolean) => void,\r\n emitter: () => void,\r\n ) {\r\n const valuesOfKey = props.returnItem\r\n ? value.map((v) => getObjectValueByPath(v, props.itemKey))\r\n : value;\r\n const old = [...stateSet.value];\r\n if (deepEqual(old, valuesOfKey)) {\r\n return;\r\n }\r\n old.forEach((key) => updater(key, false));\r\n valuesOfKey.forEach((key) => updater(key, true));\r\n emitter();\r\n }\r\n\r\n watch(expanded, (neo) => {\r\n stateWatcher(neo, expandedSet, updateExpanded, emitExpanded);\r\n });\r\n\r\n watch(active, (neo) => {\r\n stateWatcher(neo, activeSet, updateActive, emitActive);\r\n });\r\n\r\n watch(selected, (neo) => {\r\n stateWatcher(neo, selectedSet, updateSelected, emitSelected);\r\n });\r\n\r\n watch(\r\n () => props.items,\r\n (neo: any[]) => {\r\n const oldKeys = Object.keys(nodes.value).map((nodeKey) =>\r\n getObjectValueByPath(nodes.value[nodeKey].item, props.itemKey),\r\n );\r\n const neoKeys = getKeys(\r\n neo,\r\n props.itemKey,\r\n props.itemChildren as string,\r\n );\r\n const diff = differenceBetween(oldKeys, neoKeys);\r\n if (diff.length < 1 && neoKeys.length < oldKeys.length) {\r\n return;\r\n }\r\n diff.forEach((k) => delete nodes.value[k]);\r\n\r\n // init\r\n const oldSelected = [...selectedSet.value];\r\n const oldActive = [...activeSet.value];\r\n selectedSet.value.clear();\r\n expandedSet.value.clear();\r\n activeSet.value.clear();\r\n updateNodes(neo);\r\n if (!deepEqual(oldSelected, [...selectedSet.value])) {\r\n emitSelected();\r\n }\r\n if (!deepEqual(oldActive, [...activeSet.value])) {\r\n emitActive();\r\n }\r\n },\r\n { deep: true },\r\n );\r\n\r\n // Search\r\n function isExcluded(key: CandidateKey) {\r\n return !!props.search && excludedSet.value.has(key);\r\n }\r\n\r\n // Provide & Issue\r\n function issueVnodeState(key: CandidateKey) {\r\n const node = nodes.value[key];\r\n if (node && node.vnode) {\r\n node.vnode.active = node.active;\r\n node.vnode.selected = node.selected;\r\n node.vnode.indeterminate = node.indeterminate;\r\n node.vnode.expanded = node.expanded;\r\n }\r\n }\r\n\r\n function register(key: CandidateKey, vnode: VNode) {\r\n if (nodes.value[key]) {\r\n nodes.value[key].vnode = vnode;\r\n }\r\n\r\n issueVnodeState(key);\r\n }\r\n\r\n updateNodes(props.items);\r\n\r\n for (const activeValue of props.active.map(getNodeKey)) {\r\n updateActive(activeValue, true);\r\n }\r\n\r\n for (const selectedValue of props.selected.map(getNodeKey)) {\r\n updateSelected(selectedValue, true);\r\n }\r\n\r\n provide('tree-view', {\r\n register,\r\n updateExpanded,\r\n updateActive,\r\n updateSelected,\r\n emitExpanded,\r\n emitActive,\r\n emitSelected,\r\n isExcluded,\r\n searchLoading,\r\n });\r\n\r\n const renderLeaves = computed(() => {\r\n return props.items.filter((leaf) => {\r\n return !isExcluded(getObjectValueByPath(leaf, props.itemKey));\r\n });\r\n });\r\n\r\n const classes = computed(() => {\r\n return {\r\n 'y-tree-view': true,\r\n };\r\n });\r\n\r\n const styles = computed(() => {\r\n let color = props.activeColor;\r\n if (props.activeColor && !isColorValue(props.activeColor)) {\r\n color = `var(--y-theme-${props.activeColor})`;\r\n }\r\n return {\r\n [`--y-tree-view__active-color`]: color,\r\n };\r\n });\r\n\r\n onMounted(() => {\r\n if (props.defaultExpand != null && props.defaultExpand !== false) {\r\n expandedCache.value = [...expand(props.defaultExpand)];\r\n } else {\r\n expanded.value.forEach((v: any) => updateExpanded(getNodeKey(v), true));\r\n emitExpanded();\r\n }\r\n });\r\n\r\n expose({\r\n expand,\r\n });\r\n\r\n useRender(() => {\r\n return (\r\n <>\r\n <div class={classes.value} style={styles.value} role=\"tree\">\r\n {searchLoading.value && <YProgressBar indeterminate />}\r\n {renderLeaves.value.length > 0 ? (\r\n renderLeaves.value.map((leaf) => {\r\n return (\r\n <YTreeViewNode\r\n v-slots={slots}\r\n key={getObjectValueByPath(leaf, props.itemKey)}\r\n {...{\r\n ...chooseProps(props, treeViewNodeProps),\r\n item: leaf,\r\n level: 0,\r\n }}\r\n ></YTreeViewNode>\r\n );\r\n })\r\n ) : (\r\n <div class=\"y-tree-view__no-data\">\r\n {slots['no-data'] ? slots['no-data']() : <span>No Data</span>}\r\n </div>\r\n )}\r\n </div>\r\n </>\r\n );\r\n });\r\n\r\n return {\r\n nodes,\r\n expandedSet,\r\n selectedSet,\r\n activeSet,\r\n excludedSet,\r\n searchLoading,\r\n expandedCache,\r\n };\r\n },\r\n});\r\n\r\nexport type YTreeView = InstanceType<typeof YTreeView>;\r\n"],"mappings":";AAAA,SAIEA,QAAQ,EACRC,eAAe,EACfC,SAAS,EACTC,OAAO,EACPC,GAAG,EACHC,UAAU,EACVC,KAAK,EACLC,WAAW,QACN,KAAK;AAAC,SAEJC,cAAc;AAAA,SACdC,SAAS;AAAA,SAETC,iBAAiB;AAAA,SACjBC,YAAY;AAAA,SAEnBC,SAAS,EACTC,oBAAoB,EACpBC,cAAc;AAAA,SAEPC,QAAQ;AAAA,SACRC,WAAW;AAAA,SACXC,YAAY;AAAA,SACZC,aAAa,EAAEC,uBAAuB;AAAA,SAEtCC,cAAc,EAAEC,eAAe,EAAEC,OAAO;AAEjD;AAEA,MAAMC,iBAAiB,GAAGJ,uBAAuB,CAAC,CAAC;AAEnD,OAAO,MAAMK,SAAS,GAAGvB,eAAe,CAAC;EACvCwB,IAAI,EAAE,WAAW;EACjBC,KAAK,EAAE;IACLC,QAAQ,EAAE;MACRC,IAAI,EAAE,CAACC,KAAK,CAA6B;MACzCC,OAAO,EAAEA,CAAA,KAAM;IACjB,CAAC;IACDC,MAAM,EAAE;MACNH,IAAI,EAAE,CAACC,KAAK,CAA6B;MACzCC,OAAO,EAAEA,CAAA,KAAM;IACjB,CAAC;IACDE,cAAc,EAAEC,OAAO;IACvBC,cAAc,EAAE;MACdN,IAAI,EAAEO,MAA6C;MAAE;MACrDL,OAAO,EAAE;IACX,CAAC;IACDM,QAAQ,EAAE;MACRR,IAAI,EAAE,CAACC,KAAK,CAA6B;MACzCC,OAAO,EAAEA,CAAA,KAAM;IACjB,CAAC;IACDO,cAAc,EAAE;MACdT,IAAI,EAA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CAAC8H,IAAI,EAAEjH,KAAK,CAAC8C,OAAO;QAAC;UAE5C,GAAGxD,WAAW,CAACU,KAAK,EAAEH,iBAAiB,CAAC;UACxCgD,IAAI,EAAEoE,IAAI;UACVtD,KAAK,EAAE;QAAC,IALDtC,KAAK;MASpB,CAAC,CAAC,GAAAiG,YAAA;QAAA,SAES;MAAsB,IAC9BjG,KAAK,CAAC,SAAS,CAAC,GAAGA,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,GAAAiG,YAAA,gBAAAG,gBAAA,aAAuB,EAEhE;IAIT,CAAC,CAAC;IAEF,OAAO;MACLjG,KAAK;MACLC,WAAW;MACXE,WAAW;MACXC,SAAS;MACTC,WAAW;MACXI,aAAa;MACbD;IACF,CAAC;EACH;AACF,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { computed, defineComponent, h, inject, ref } from 'vue';
|
|
1
|
+
import { computed, defineComponent, h, inject, ref, onBeforeMount, getCurrentInstance } from 'vue';
|
|
2
2
|
import { pressItemsPropsOptions } from "../../abstract/items.mjs";
|
|
3
3
|
import { useRender } from "../../composables/component.mjs";
|
|
4
4
|
import { getObjectValueByPath } from "../../util/common.mjs";
|
|
@@ -47,6 +47,7 @@ export const YTreeViewNode = defineComponent({
|
|
|
47
47
|
slots,
|
|
48
48
|
expose
|
|
49
49
|
} = _ref;
|
|
50
|
+
const vm = getCurrentInstance();
|
|
50
51
|
const treeView = inject('tree-view');
|
|
51
52
|
const expanded = ref(false);
|
|
52
53
|
const active = ref(false);
|
|
@@ -176,6 +177,9 @@ export const YTreeViewNode = defineComponent({
|
|
|
176
177
|
selected,
|
|
177
178
|
immediate
|
|
178
179
|
});
|
|
180
|
+
onBeforeMount(() => {
|
|
181
|
+
treeView?.register?.(myKey.value, vm.exposed);
|
|
182
|
+
});
|
|
179
183
|
return {
|
|
180
184
|
treeView,
|
|
181
185
|
myKey,
|
|
@@ -184,9 +188,6 @@ export const YTreeViewNode = defineComponent({
|
|
|
184
188
|
selected,
|
|
185
189
|
immediate
|
|
186
190
|
};
|
|
187
|
-
},
|
|
188
|
-
created() {
|
|
189
|
-
this.treeView?.register?.(this.myKey, this);
|
|
190
191
|
}
|
|
191
192
|
});
|
|
192
193
|
//# sourceMappingURL=YTreeViewNode.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"YTreeViewNode.mjs","names":["computed","defineComponent","h","inject","ref","pressItemsPropsOptions","useRender","getObjectValueByPath","propsFactory","YButton","YIconCheckbox","YIconExpand","YPlate","YTextHighlighter","YExpandVTransition","pressYTreeViewNodeProps","search","String","disableTransition","Boolean","enableActive","activeClass","Array","activeSingleModifier","requiredActive","activeColor","type","default","enableSelect","itemKey","YTreeViewNode","name","components","props","item","Object","level","Number","setup","_ref","slots","expose","treeView","expanded","active","selected","immediate","onClick","e","to","value","updateActive","myKey","emitActive","onClickExpand","stopPropagation","updateExpanded","emitExpanded","onClickSelect","updateSelected","emitSelected","children","itemChildren","imLeaf","length","classes","styles","contentText","itemText","slotProps","searchLoading","leaves","filter","leaf","isExcluded","map","key","indentSpacer","i","push","class","style","variation","checked","leading","text","keyword","trailing","disabled","role","undefined","created","register"],"sources":["../../../src/components/tree-view/YTreeViewNode.ts"],"sourcesContent":["import {\n PropType,\n VNodeArrayChildren,\n computed,\n defineComponent,\n h,\n inject,\n ref,\n} from 'vue';\n\nimport { pressItemsPropsOptions } from '../../abstract/items';\nimport { useRender } from '../../composables/component';\nimport { getObjectValueByPath } from '../../util/common';\nimport { propsFactory } from '../../util/vue-component';\nimport { YButton } from '../button';\nimport { YIconCheckbox, YIconExpand } from '../icons';\nimport { YPlate } from '../plate';\nimport { YTextHighlighter } from '../text-highlighter/YTextHighlighter';\nimport { YExpandVTransition } from '../transitions';\n\nexport const pressYTreeViewNodeProps = propsFactory(\n {\n search: String,\n disableTransition: Boolean,\n enableActive: Boolean,\n activeClass: [String, Array],\n activeSingleModifier: String,\n requiredActive: Boolean,\n activeColor: {\n type: String,\n default: 'primary',\n },\n enableSelect: Boolean,\n ...pressItemsPropsOptions({\n itemKey: 'id',\n }),\n },\n 'YTreeViewNode',\n);\n\nexport const YTreeViewNode = defineComponent({\n name: 'YTreeNode',\n components: {\n YButton,\n YIconExpand,\n YPlate,\n YIconCheckbox,\n },\n props: {\n item: {\n type: Object as PropType<any>,\n },\n level: {\n type: Number as PropType<number>,\n default: 0,\n },\n ...pressYTreeViewNodeProps(),\n },\n setup(props, { slots, expose }) {\n const treeView = inject<any>('tree-view');\n\n const expanded = ref(false);\n const active = ref(false);\n const selected = ref(false);\n const immediate = ref(false);\n\n function onClick(e: MouseEvent) {\n const to = !active.value;\n active.value = to;\n treeView.updateActive(myKey.value, to, e);\n treeView.emitActive();\n }\n\n function onClickExpand(e: MouseEvent) {\n e.stopPropagation();\n const to = !expanded.value;\n expanded.value = to;\n treeView.updateExpanded(myKey.value, to);\n treeView.emitExpanded();\n }\n\n function onClickSelect(e: MouseEvent) {\n e.stopPropagation();\n const to = !selected.value;\n selected.value = to;\n treeView.updateSelected(myKey.value, to);\n treeView.emitSelected();\n }\n\n const children = computed(() => {\n return props.item?.[props.itemChildren as string] ?? [];\n });\n\n const imLeaf = computed(() => children.value.length < 1);\n\n const classes = computed(() => {\n return {\n 'y-tree-view-node': true,\n 'y-tree-view-node--leaf': imLeaf.value,\n 'y-tree-view-node--expanded': expanded.value,\n 'y-tree-view-node--active': active.value,\n };\n });\n\n const styles = computed(() => {\n return {\n '--tree-view-node--level': props.level,\n };\n });\n\n const contentText = computed(() => {\n return getObjectValueByPath(props.item, props.itemText) ?? '';\n });\n\n const slotProps = computed(() => {\n return {\n level: props.level,\n imLeaf: imLeaf.value,\n };\n });\n\n const searchLoading = computed(() => {\n return treeView.searchLoading.value;\n });\n\n useRender(() => {\n const leaves = children.value\n .filter((leaf: any) => {\n return !treeView.isExcluded(\n getObjectValueByPath(leaf, props.itemKey),\n );\n })\n .map((item: any) => {\n return h(\n YTreeViewNode,\n {\n ...props,\n level: (props.level ?? 0) + 1,\n item,\n key: getObjectValueByPath(item, props.itemKey),\n },\n slots,\n );\n });\n const indentSpacer: VNodeArrayChildren = [];\n for (let i = 0; i < props.level; i += 1) {\n indentSpacer.push(\n h('div', { class: 'y-tree-view-node__indent-spacer' }),\n );\n }\n return h(\n 'div',\n {\n class: classes.value,\n style: styles.value,\n '.role': 'treeitem',\n 'data-level': props.level,\n },\n [\n h(\n 'div',\n {\n class: 'y-tree-view-node__container',\n onClick: (e: MouseEvent) =>\n props.enableActive ? onClick(e) : void 0,\n },\n [\n h(YPlate),\n h('div', { class: 'y-tree-view-node__indents' }, indentSpacer),\n /* EXPAND */\n !imLeaf.value && leaves.length > 0\n ? h(\n YButton,\n {\n class: 'y-tree-view-node__expand-icon',\n variation: 'icon',\n onClick: (e: MouseEvent) => onClickExpand(e),\n },\n () => [\n slots['expand-icon']\n ? slots['expand-icon']()\n : h(YIconExpand),\n ],\n )\n : h('i', { class: 'y-tree-view-node__no-expand-icon' }),\n props.enableSelect &&\n h(\n 'div',\n {\n class: ['y-tree-view-node__select'],\n onClick: (e: MouseEvent) => onClickSelect(e),\n },\n [h(YIconCheckbox, { checked: selected.value })],\n ),\n /* CONTENT */\n h('div', { class: 'y-tree-view-node__content' }, [\n slots.leading &&\n h(\n 'div',\n { class: 'y-tree-view-node__leading' },\n slots.leading(slotProps.value),\n ),\n h(\n 'div',\n { class: 'y-tree-view-node__text' },\n slots.default\n ? slots.default?.({\n text: contentText.value,\n item: props.item,\n ...slotProps.value,\n })\n : props.search && !searchLoading.value\n ? h(YTextHighlighter, {\n text: contentText.value,\n keyword: props.search,\n })\n : contentText.value,\n ),\n slots.trailing &&\n h(\n 'div',\n { class: 'y-tree-view-node__trailing' },\n slots.trailing(),\n ),\n ]),\n ],\n ),\n /* CHILDREN */\n children.value.length > 0\n ? h(\n YExpandVTransition,\n { disabled: props.disableTransition },\n expanded.value\n ? () =>\n h(\n 'div',\n {\n class: { 'y-tree-view-node__leaves': true },\n role: 'tree',\n },\n leaves,\n )\n : undefined,\n )\n : undefined,\n ],\n );\n });\n\n const myKey = computed(() => {\n return getObjectValueByPath(props.item, props.itemKey);\n });\n\n expose({\n myKey,\n expanded,\n active,\n selected,\n immediate,\n });\n\n return {\n treeView,\n myKey,\n expanded,\n active,\n selected,\n immediate,\n };\n },\n created() {\n this.treeView?.register?.(this.myKey, this);\n },\n});\n\nexport type YTreeNode = InstanceType<typeof YTreeViewNode>;\n"],"mappings":"AAAA,SAGEA,QAAQ,EACRC,eAAe,EACfC,CAAC,EACDC,MAAM,EACNC,GAAG,QACE,KAAK;AAAC,SAEJC,sBAAsB;AAAA,SACtBC,SAAS;AAAA,SACTC,oBAAoB;AAAA,SACpBC,YAAY;AAAA,SACZC,OAAO;AAAA,SACPC,aAAa,EAAEC,WAAW;AAAA,SAC1BC,MAAM;AAAA,SACNC,gBAAgB;AAAA,SAChBC,kBAAkB;AAE3B,OAAO,MAAMC,uBAAuB,GAAGP,YAAY,CACjD;EACEQ,MAAM,EAAEC,MAAM;EACdC,iBAAiB,EAAEC,OAAO;EAC1BC,YAAY,EAAED,OAAO;EACrBE,WAAW,EAAE,CAACJ,MAAM,EAAEK,KAAK,CAAC;EAC5BC,oBAAoB,EAAEN,MAAM;EAC5BO,cAAc,EAAEL,OAAO;EACvBM,WAAW,EAAE;IACXC,IAAI,EAAET,MAAM;IACZU,OAAO,EAAE;EACX,CAAC;EACDC,YAAY,EAAET,OAAO;EACrB,GAAGd,sBAAsB,CAAC;IACxBwB,OAAO,EAAE;EACX,CAAC;AACH,CAAC,EACD,eACF,CAAC;AAED,OAAO,MAAMC,aAAa,GAAG7B,eAAe,CAAC;EAC3C8B,IAAI,EAAE,WAAW;EACjBC,UAAU,EAAE;IACVvB,OAAO;IACPE,WAAW;IACXC,MAAM;IACNF;EACF,CAAC;EACDuB,KAAK,EAAE;IACLC,IAAI,EAAE;MACJR,IAAI,EAAES;IACR,CAAC;IACDC,KAAK,EAAE;MACLV,IAAI,EAAEW,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AACjB,KAClB,CAAC,EACDV,KAAK,CAAC+C,QAAQ,IACZrF,CAAC,CACC,KAAK,EACL;QAAE8E,KAAK,EAAE;MAA6B,CAAC,EACvCxC,KAAK,CAAC+C,QAAQ,CAAC,CACjB,CAAC,CACJ,CAAC,CAEN,CAAC,EACD;MACA1B,QAAQ,CAACX,KAAK,CAACc,MAAM,GAAG,CAAC,GACrB9D,CAAC,CACCY,kBAAkB,EAClB;QAAE0E,QAAQ,EAAEvD,KAAK,CAACf;MAAkB,CAAC,EACrCyB,QAAQ,CAACO,KAAK,GACV,MACEhD,CAAC,CACC,KAAK,EACL;QACE8E,KAAK,EAAE;UAAE,0BAA0B,EAAE;QAAK,CAAC;QAC3CS,IAAI,EAAE;MACR,CAAC,EACDlB,MACF,CAAC,GACHmB,SACN,CAAC,GACDA,SAAS,CAEjB,CAAC;IACH,CAAC,CAAC;IAEF,MAAMtC,KAAK,GAAGpD,QAAQ,CAAC,MAAM;MAC3B,OAAOO,oBAAoB,CAAC0B,KAAK,CAACC,IAAI,EAAED,KAAK,CAACJ,OAAO,CAAC;IACxD,CAAC,CAAC;IAEFY,MAAM,CAAC;MACLW,KAAK;MACLT,QAAQ;MACRC,MAAM;MACNC,QAAQ;MACRC;IACF,CAAC,CAAC;IAEF,OAAO;MACLJ,QAAQ;MACRU,KAAK;MACLT,QAAQ;MACRC,MAAM;MACNC,QAAQ;MACRC;IACF,CAAC;EACH,CAAC;EACD6C,OAAOA,CAAA,EAAG;IACR,IAAI,CAACjD,QAAQ,EAAEkD,QAAQ,GAAG,IAAI,CAACxC,KAAK,EAAE,IAAI,CAAC;EAC7C;AACF,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"YTreeViewNode.mjs","names":["computed","defineComponent","h","inject","ref","onBeforeMount","getCurrentInstance","pressItemsPropsOptions","useRender","getObjectValueByPath","propsFactory","YButton","YIconCheckbox","YIconExpand","YPlate","YTextHighlighter","YExpandVTransition","pressYTreeViewNodeProps","search","String","disableTransition","Boolean","enableActive","activeClass","Array","activeSingleModifier","requiredActive","activeColor","type","default","enableSelect","itemKey","YTreeViewNode","name","components","props","item","Object","level","Number","setup","_ref","slots","expose","vm","treeView","expanded","active","selected","immediate","onClick","e","to","value","updateActive","myKey","emitActive","onClickExpand","stopPropagation","updateExpanded","emitExpanded","onClickSelect","updateSelected","emitSelected","children","itemChildren","imLeaf","length","classes","styles","contentText","itemText","slotProps","searchLoading","leaves","filter","leaf","isExcluded","map","key","indentSpacer","i","push","class","style","variation","checked","leading","text","keyword","trailing","disabled","role","undefined","register","exposed"],"sources":["../../../src/components/tree-view/YTreeViewNode.ts"],"sourcesContent":["import {\n PropType,\n VNodeArrayChildren,\n computed,\n defineComponent,\n h,\n inject,\n ref, onBeforeMount, getCurrentInstance,\n} from 'vue';\n\nimport { pressItemsPropsOptions } from '../../abstract/items';\nimport { useRender } from '../../composables/component';\nimport { getObjectValueByPath } from '../../util/common';\nimport { propsFactory } from '../../util/vue-component';\nimport { YButton } from '../button';\nimport { YIconCheckbox, YIconExpand } from '../icons';\nimport { YPlate } from '../plate';\nimport { YTextHighlighter } from '../text-highlighter/YTextHighlighter';\nimport { YExpandVTransition } from '../transitions';\n\nexport const pressYTreeViewNodeProps = propsFactory(\n {\n search: String,\n disableTransition: Boolean,\n enableActive: Boolean,\n activeClass: [String, Array],\n activeSingleModifier: String,\n requiredActive: Boolean,\n activeColor: {\n type: String,\n default: 'primary',\n },\n enableSelect: Boolean,\n ...pressItemsPropsOptions({\n itemKey: 'id',\n }),\n },\n 'YTreeViewNode',\n);\n\nexport const YTreeViewNode = defineComponent({\n name: 'YTreeNode',\n components: {\n YButton,\n YIconExpand,\n YPlate,\n YIconCheckbox,\n },\n props: {\n item: {\n type: Object as PropType<any>,\n },\n level: {\n type: Number as PropType<number>,\n default: 0,\n },\n ...pressYTreeViewNodeProps(),\n },\n setup(props, { slots, expose }) {\n const vm = getCurrentInstance();\n const treeView = inject<any>('tree-view');\n\n const expanded = ref(false);\n const active = ref(false);\n const selected = ref(false);\n const immediate = ref(false);\n\n function onClick(e: MouseEvent) {\n const to = !active.value;\n active.value = to;\n treeView.updateActive(myKey.value, to, e);\n treeView.emitActive();\n }\n\n function onClickExpand(e: MouseEvent) {\n e.stopPropagation();\n const to = !expanded.value;\n expanded.value = to;\n treeView.updateExpanded(myKey.value, to);\n treeView.emitExpanded();\n }\n\n function onClickSelect(e: MouseEvent) {\n e.stopPropagation();\n const to = !selected.value;\n selected.value = to;\n treeView.updateSelected(myKey.value, to);\n treeView.emitSelected();\n }\n\n const children = computed(() => {\n return props.item?.[props.itemChildren as string] ?? [];\n });\n\n const imLeaf = computed(() => children.value.length < 1);\n\n const classes = computed(() => {\n return {\n 'y-tree-view-node': true,\n 'y-tree-view-node--leaf': imLeaf.value,\n 'y-tree-view-node--expanded': expanded.value,\n 'y-tree-view-node--active': active.value,\n };\n });\n\n const styles = computed(() => {\n return {\n '--tree-view-node--level': props.level,\n };\n });\n\n const contentText = computed(() => {\n return getObjectValueByPath(props.item, props.itemText) ?? '';\n });\n\n const slotProps = computed(() => {\n return {\n level: props.level,\n imLeaf: imLeaf.value,\n };\n });\n\n const searchLoading = computed(() => {\n return treeView.searchLoading.value;\n });\n\n useRender(() => {\n const leaves = children.value\n .filter((leaf: any) => {\n return !treeView.isExcluded(\n getObjectValueByPath(leaf, props.itemKey),\n );\n })\n .map((item: any) => {\n return h(\n YTreeViewNode,\n {\n ...props,\n level: (props.level ?? 0) + 1,\n item,\n key: getObjectValueByPath(item, props.itemKey),\n },\n slots,\n );\n });\n const indentSpacer: VNodeArrayChildren = [];\n for (let i = 0; i < props.level; i += 1) {\n indentSpacer.push(\n h('div', { class: 'y-tree-view-node__indent-spacer' }),\n );\n }\n return h(\n 'div',\n {\n class: classes.value,\n style: styles.value,\n '.role': 'treeitem',\n 'data-level': props.level,\n },\n [\n h(\n 'div',\n {\n class: 'y-tree-view-node__container',\n onClick: (e: MouseEvent) =>\n props.enableActive ? onClick(e) : void 0,\n },\n [\n h(YPlate),\n h('div', { class: 'y-tree-view-node__indents' }, indentSpacer),\n /* EXPAND */\n !imLeaf.value && leaves.length > 0\n ? h(\n YButton,\n {\n class: 'y-tree-view-node__expand-icon',\n variation: 'icon',\n onClick: (e: MouseEvent) => onClickExpand(e),\n },\n () => [\n slots['expand-icon']\n ? slots['expand-icon']()\n : h(YIconExpand),\n ],\n )\n : h('i', { class: 'y-tree-view-node__no-expand-icon' }),\n props.enableSelect &&\n h(\n 'div',\n {\n class: ['y-tree-view-node__select'],\n onClick: (e: MouseEvent) => onClickSelect(e),\n },\n [h(YIconCheckbox, { checked: selected.value })],\n ),\n /* CONTENT */\n h('div', { class: 'y-tree-view-node__content' }, [\n slots.leading &&\n h(\n 'div',\n { class: 'y-tree-view-node__leading' },\n slots.leading(slotProps.value),\n ),\n h(\n 'div',\n { class: 'y-tree-view-node__text' },\n slots.default\n ? slots.default?.({\n text: contentText.value,\n item: props.item,\n ...slotProps.value,\n })\n : props.search && !searchLoading.value\n ? h(YTextHighlighter, {\n text: contentText.value,\n keyword: props.search,\n })\n : contentText.value,\n ),\n slots.trailing &&\n h(\n 'div',\n { class: 'y-tree-view-node__trailing' },\n slots.trailing(),\n ),\n ]),\n ],\n ),\n /* CHILDREN */\n children.value.length > 0\n ? h(\n YExpandVTransition,\n { disabled: props.disableTransition },\n expanded.value\n ? () =>\n h(\n 'div',\n {\n class: { 'y-tree-view-node__leaves': true },\n role: 'tree',\n },\n leaves,\n )\n : undefined,\n )\n : undefined,\n ],\n );\n });\n\n const myKey = computed(() => {\n return getObjectValueByPath(props.item, props.itemKey);\n });\n\n expose({\n myKey,\n expanded,\n active,\n selected,\n immediate,\n });\n\n onBeforeMount(() => {\n treeView?.register?.(myKey.value, vm!.exposed);\n });\n\n return {\n treeView,\n myKey,\n expanded,\n active,\n selected,\n immediate,\n };\n },\n});\n\nexport type YTreeNode = InstanceType<typeof YTreeViewNode>;\n"],"mappings":"AAAA,SAGEA,QAAQ,EACRC,eAAe,EACfC,CAAC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Cc,kBAAkB,EAClB;QAAE2E,QAAQ,EAAExD,KAAK,CAACf;MAAkB,CAAC,EACrC0B,QAAQ,CAACO,KAAK,GACV,MACEnD,CAAC,CACC,KAAK,EACL;QACEiF,KAAK,EAAE;UAAE,0BAA0B,EAAE;QAAK,CAAC;QAC3CS,IAAI,EAAE;MACR,CAAC,EACDlB,MACF,CAAC,GACHmB,SACN,CAAC,GACDA,SAAS,CAEjB,CAAC;IACH,CAAC,CAAC;IAEF,MAAMtC,KAAK,GAAGvD,QAAQ,CAAC,MAAM;MAC3B,OAAOS,oBAAoB,CAAC0B,KAAK,CAACC,IAAI,EAAED,KAAK,CAACJ,OAAO,CAAC;IACxD,CAAC,CAAC;IAEFY,MAAM,CAAC;MACLY,KAAK;MACLT,QAAQ;MACRC,MAAM;MACNC,QAAQ;MACRC;IACF,CAAC,CAAC;IAEF5C,aAAa,CAAC,MAAM;MAClBwC,QAAQ,EAAEiD,QAAQ,GAAGvC,KAAK,CAACF,KAAK,EAAET,EAAE,CAAEmD,OAAO,CAAC;IAChD,CAAC,CAAC;IAEF,OAAO;MACLlD,QAAQ;MACRU,KAAK;MACLT,QAAQ;MACRC,MAAM;MACNC,QAAQ;MACRC;IACF,CAAC;EACH;AACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["inject","useI18n","constructAdapter","configureOptions","YUYEON_DATE_KEY","Symbol","for","YUYEON_DATE_OPTIONS_KEY","createDateModule","options","locale","_options","instance","useDate","Error","i18n"],"sources":["../../../src/composables/date/index.ts"],"sourcesContent":["import { inject } from '@vue/runtime-core';\
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["inject","useI18n","constructAdapter","configureOptions","YUYEON_DATE_KEY","Symbol","for","YUYEON_DATE_OPTIONS_KEY","createDateModule","options","locale","_options","instance","useDate","Error","i18n"],"sources":["../../../src/composables/date/index.ts"],"sourcesContent":["import { inject } from '@vue/runtime-core';\n\nimport { LocaleModule } from '../../i18n/types';\nimport { useI18n } from '../i18n';\nimport { constructAdapter } from './factory';\nimport { configureOptions } from './setting';\nimport { DateInstance, DateOptions } from './types';\n\nexport const YUYEON_DATE_KEY = Symbol.for('yuyeon.date');\nexport const YUYEON_DATE_OPTIONS_KEY = Symbol.for('yuyeon.date-options');\n\nexport function createDateModule(options: DateOptions, locale: LocaleModule) {\n const _options = configureOptions(options);\n return {\n options: _options,\n instance: constructAdapter(_options, locale),\n };\n}\n\nexport function useDate(): DateInstance {\n const options = inject<any>(YUYEON_DATE_OPTIONS_KEY);\n if (!options) throw new Error('Not found provided \"DateModule\" for options');\n\n const i18n = useI18n();\n\n return constructAdapter(options, i18n);\n}\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,mBAAmB;AAAC,SAGlCC,OAAO;AAAA,SACPC,gBAAgB;AAAA,SAChBC,gBAAgB;AAGzB,OAAO,MAAMC,eAAe,GAAGC,MAAM,CAACC,GAAG,CAAC,aAAa,CAAC;AACxD,OAAO,MAAMC,uBAAuB,GAAGF,MAAM,CAACC,GAAG,CAAC,qBAAqB,CAAC;AAExE,OAAO,SAASE,gBAAgBA,CAACC,OAAoB,EAAEC,MAAoB,EAAE;EAC3E,MAAMC,QAAQ,GAAGR,gBAAgB,CAACM,OAAO,CAAC;EAC1C,OAAO;IACLA,OAAO,EAAEE,QAAQ;IACjBC,QAAQ,EAAEV,gBAAgB,CAACS,QAAQ,EAAED,MAAM;EAC7C,CAAC;AACH;AAEA,OAAO,SAASG,OAAOA,CAAA,EAAiB;EACtC,MAAMJ,OAAO,GAAGT,MAAM,CAAMO,uBAAuB,CAAC;EACpD,IAAI,CAACE,OAAO,EAAE,MAAM,IAAIK,KAAK,CAAC,6CAA6C,CAAC;EAE5E,MAAMC,IAAI,GAAGd,OAAO,CAAC,CAAC;EAEtB,OAAOC,gBAAgB,CAACO,OAAO,EAAEM,IAAI,CAAC;AACxC"}
|
|
@@ -95,5 +95,17 @@ export class YuyeonDateAdapter {
|
|
|
95
95
|
toJsDate(date) {
|
|
96
96
|
return date;
|
|
97
97
|
}
|
|
98
|
+
getHour(date) {
|
|
99
|
+
return DateUtil.getHour(date);
|
|
100
|
+
}
|
|
101
|
+
getMinute(date) {
|
|
102
|
+
return DateUtil.getMinute(date);
|
|
103
|
+
}
|
|
104
|
+
setHour(date, hour) {
|
|
105
|
+
return DateUtil.setHour(date, hour);
|
|
106
|
+
}
|
|
107
|
+
setMinute(date, minute) {
|
|
108
|
+
return DateUtil.setMinute(date, minute);
|
|
109
|
+
}
|
|
98
110
|
}
|
|
99
111
|
//# sourceMappingURL=yuyeon-date-adapter.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yuyeon-date-adapter.mjs","names":["DateUtil","YuyeonDateAdapter","constructor","options","_defineProperty","locale","formats","getWeekArray","date","startOfMonth","endOfMonth","addDays","amount","addMonths","value","endOfDay","endOfYear","format","formatString","getDiff","comparing","unit","getYear","getMonth","getDay","getNextMonth","getWeekdays","isAfter","isBefore","isEqual","isSameDay","isSameMonth","isValid","isWithinRange","range","parseISO","setMonth","month","setYear","year","startOfDay","startOfYear","toISO","toJsDate"],"sources":["../../../../src/util/date/adapters/yuyeon-date-adapter.ts"],"sourcesContent":["import { DateUtil } from '../built-in';\
|
|
1
|
+
{"version":3,"file":"yuyeon-date-adapter.mjs","names":["DateUtil","YuyeonDateAdapter","constructor","options","_defineProperty","locale","formats","getWeekArray","date","startOfMonth","endOfMonth","addDays","amount","addMonths","value","endOfDay","endOfYear","format","formatString","getDiff","comparing","unit","getYear","getMonth","getDay","getNextMonth","getWeekdays","isAfter","isBefore","isEqual","isSameDay","isSameMonth","isValid","isWithinRange","range","parseISO","setMonth","month","setYear","year","startOfDay","startOfYear","toISO","toJsDate","getHour","getMinute","setHour","hour","setMinute","minute"],"sources":["../../../../src/util/date/adapters/yuyeon-date-adapter.ts"],"sourcesContent":["import { DateUtil } from '../built-in';\nimport { DateAdapter, DateFormatOptions } from '../types';\n\nexport class YuyeonDateAdapter implements DateAdapter<Date> {\n public locale = 'ko-kr';\n\n public formats?: Record<string, DateFormatOptions>;\n\n constructor(options: {\n locale: string;\n formats?: Record<string, DateFormatOptions>;\n }) {\n this.locale = options.locale;\n this.formats = options.formats;\n }\n\n public getWeekArray(date: Date) {\n return DateUtil.getWeekArray(date, this.locale);\n }\n\n public startOfMonth(date: Date) {\n return DateUtil.startOfMonth(date);\n }\n\n public endOfMonth(date: Date) {\n return DateUtil.endOfMonth(date);\n }\n\n public addDays(date: Date, amount: number): Date {\n return DateUtil.addDays(date, amount);\n }\n\n public addMonths(date: Date, amount: number): Date {\n return DateUtil.addMonths(date, amount);\n }\n\n public date(value?: any): Date | null {\n return DateUtil.date(value);\n }\n\n public endOfDay(date: Date): Date {\n return DateUtil.endOfDay(date);\n }\n\n public endOfYear(date: Date): Date {\n return DateUtil.endOfYear(date);\n }\n\n public format(date: Date, formatString: string): string {\n return DateUtil.format(date, formatString, this.locale, this.formats);\n }\n\n public getDiff(date: Date, comparing: string | Date, unit?: string): number {\n return DateUtil.getDiff(date, comparing, unit);\n }\n\n public getYear(date: Date): number {\n return DateUtil.getYear(date);\n }\n\n public getMonth(date: Date): number {\n return DateUtil.getMonth(date);\n }\n\n public getDay(date: Date): number {\n return DateUtil.getDay(date);\n }\n\n public getNextMonth(date: Date): Date {\n return DateUtil.getNextMonth(date);\n }\n\n public getWeekdays(): string[] {\n return DateUtil.getWeekdays(this.locale);\n }\n\n public isAfter(date: Date, comparing: Date): boolean {\n return DateUtil.isAfter(date, comparing);\n }\n\n public isBefore(date: Date, comparing: Date): boolean {\n return DateUtil.isBefore(date, comparing);\n }\n\n public isEqual(date: Date, comparing: Date): boolean {\n return DateUtil.isEqual(date, comparing);\n }\n\n public isSameDay(date: Date, comparing: Date): boolean {\n return DateUtil.isSameDay(date, comparing);\n }\n\n public isSameMonth(date: Date, comparing: Date): boolean {\n return DateUtil.isSameMonth(date, comparing);\n }\n\n public isValid(date: any): boolean {\n return DateUtil.isValid(date);\n }\n\n public isWithinRange(date: Date, range: [Date, Date]): boolean {\n return DateUtil.isWithinRange(date, range);\n }\n\n public parseISO(date: string): Date {\n return DateUtil.parseISO(date);\n }\n\n public setMonth(date: Date, month: number): Date {\n return DateUtil.setMonth(date, month);\n }\n\n public setYear(date: Date, year: number): Date {\n return DateUtil.setYear(date, year);\n }\n\n public startOfDay(date: Date): Date {\n return DateUtil.startOfDay(date);\n }\n\n public startOfYear(date: Date): Date {\n return DateUtil.startOfYear(date);\n }\n\n public toISO(date: Date): string {\n return DateUtil.toISO(this, date);\n }\n\n public toJsDate(date: Date): Date {\n return date;\n }\n\n getHour(date: Date): number {\n return DateUtil.getHour(date);\n }\n\n getMinute(date: Date): number {\n return DateUtil.getMinute(date);\n }\n\n setHour(date: Date, hour: number): Date {\n return DateUtil.setHour(date, hour);\n }\n\n setMinute(date: Date, minute: number): Date {\n return DateUtil.setMinute(date, minute);\n }\n}\n"],"mappings":";;;SAASA,QAAQ;AAGjB,OAAO,MAAMC,iBAAiB,CAA8B;EAK1DC,WAAWA,CAACC,OAGX,EAAE;IAAAC,eAAA,iBAPa,OAAO;IAQrB,IAAI,CAACC,MAAM,GAAGF,OAAO,CAACE,MAAM;IAC5B,IAAI,CAACC,OAAO,GAAGH,OAAO,CAACG,OAAO;EAChC;EAEOC,YAAYA,CAACC,IAAU,EAAE;IAC9B,OAAOR,QAAQ,CAACO,YAAY,CAACC,IAAI,EAAE,IAAI,CAACH,MAAM,CAAC;EACjD;EAEOI,YAAYA,CAACD,IAAU,EAAE;IAC9B,OAAOR,QAAQ,CAACS,YAAY,CAACD,IAAI,CAAC;EACpC;EAEOE,UAAUA,CAACF,IAAU,EAAE;IAC5B,OAAOR,QAAQ,CAACU,UAAU,CAACF,IAAI,CAAC;EAClC;EAEOG,OAAOA,CAACH,IAAU,EAAEI,MAAc,EAAQ;IAC/C,OAAOZ,QAAQ,CAACW,OAAO,CAACH,IAAI,EAAEI,MAAM,CAAC;EACvC;EAEOC,SAASA,CA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AWA,CAACjC,IAAU,EAAQ;IACnC,OAAOR,QAAQ,CAACyC,WAAW,CAACjC,IAAI,CAAC;EACnC;EAEOkC,KAAKA,CAAClC,IAAU,EAAU;IAC/B,OAAOR,QAAQ,CAAC0C,KAAK,CAAC,IAAI,EAAElC,IAAI,CAAC;EACnC;EAEOmC,QAAQA,CAACnC,IAAU,EAAQ;IAChC,OAAOA,IAAI;EACb;EAEAoC,OAAOA,CAACpC,IAAU,EAAU;IAC1B,OAAOR,QAAQ,CAAC4C,OAAO,CAACpC,IAAI,CAAC;EAC/B;EAEAqC,SAASA,CAACrC,IAAU,EAAU;IAC5B,OAAOR,QAAQ,CAAC6C,SAAS,CAACrC,IAAI,CAAC;EACjC;EAEAsC,OAAOA,CAACtC,IAAU,EAAEuC,IAAY,EAAQ;IACtC,OAAO/C,QAAQ,CAAC8C,OAAO,CAACtC,IAAI,EAAEuC,IAAI,CAAC;EACrC;EAEAC,SAASA,CAACxC,IAAU,EAAEyC,MAAc,EAAQ;IAC1C,OAAOjD,QAAQ,CAACgD,SAAS,CAACxC,IAAI,EAAEyC,MAAM,CAAC;EACzC;AACF"}
|
|
@@ -336,6 +336,16 @@ export class DateUtil {
|
|
|
336
336
|
}).format(weekday);
|
|
337
337
|
});
|
|
338
338
|
}
|
|
339
|
+
static getMeridians(locale) {
|
|
340
|
+
const amDate = new Date(FIRST_SUNDAY).setHours(11);
|
|
341
|
+
const pmDate = new Date(FIRST_SUNDAY).setHours(13);
|
|
342
|
+
const formatter = Intl.DateTimeFormat(locale, {
|
|
343
|
+
minute: 'numeric',
|
|
344
|
+
hour: 'numeric',
|
|
345
|
+
hour12: true
|
|
346
|
+
});
|
|
347
|
+
return [formatter.format(amDate).replace(/\d+:\d+/, '').trim(), formatter.format(pmDate).replace(/\d+:\d+/, '').trim()];
|
|
348
|
+
}
|
|
339
349
|
static isAfter(date, comparing) {
|
|
340
350
|
return date.getTime() > comparing.getTime();
|
|
341
351
|
}
|
|
@@ -386,5 +396,21 @@ export class DateUtil {
|
|
|
386
396
|
d.setFullYear(year);
|
|
387
397
|
return d;
|
|
388
398
|
}
|
|
399
|
+
static getHour(date) {
|
|
400
|
+
return date.getHours();
|
|
401
|
+
}
|
|
402
|
+
static setHour(date, hour) {
|
|
403
|
+
const d = new Date(date);
|
|
404
|
+
d.setHours(hour);
|
|
405
|
+
return d;
|
|
406
|
+
}
|
|
407
|
+
static getMinute(date) {
|
|
408
|
+
return date.getMinutes();
|
|
409
|
+
}
|
|
410
|
+
static setMinute(date, minute) {
|
|
411
|
+
const d = new Date(date);
|
|
412
|
+
d.setMinutes(minute);
|
|
413
|
+
return d;
|
|
414
|
+
}
|
|
389
415
|
}
|
|
390
416
|
//# sourceMappingURL=built-in.mjs.map
|