yuyeon 0.3.1 → 0.3.2-rc.10
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/yuyeon.js +4861 -4714
- package/dist/yuyeon.umd.cjs +3 -3
- package/lib/components/dialog/YDialog.js +6 -1
- package/lib/components/dialog/YDialog.js.map +1 -1
- package/lib/components/divider/YDivider.scss +21 -0
- package/lib/components/field-input/YFieldInput.js +4 -1
- package/lib/components/field-input/YFieldInput.js.map +1 -1
- package/lib/components/input/YInput.js +2 -1
- package/lib/components/input/YInput.js.map +1 -1
- package/lib/components/select/YSelect.js.map +1 -1
- package/lib/components/slider/YSlider.js +1 -0
- package/lib/components/slider/YSlider.js.map +1 -1
- package/lib/components/slider/YSlider.scss +3 -0
- package/lib/components/slider/index.js +1 -1
- package/lib/components/slider/index.js.map +1 -1
- package/lib/components/slider/slider.js +2 -0
- package/lib/components/slider/slider.js.map +1 -0
- package/lib/components/table/YDataTable.js +32 -16
- package/lib/components/table/YDataTable.js.map +1 -1
- package/lib/components/table/YDataTableBody.js +26 -8
- package/lib/components/table/YDataTableBody.js.map +1 -1
- package/lib/components/table/YDataTableControl.js +1 -1
- package/lib/components/table/YDataTableControl.js.map +1 -1
- package/lib/components/table/YDataTableHead.js +3 -3
- package/lib/components/table/YDataTableHead.js.map +1 -1
- package/lib/components/table/YDataTableLayer.js +11 -4
- package/lib/components/table/YDataTableLayer.js.map +1 -1
- package/lib/components/table/YDataTableLayerRow.vue +146 -0
- package/lib/components/table/YDataTableRow.js +14 -6
- package/lib/components/table/YDataTableRow.js.map +1 -1
- package/lib/components/table/YDataTableServer.js +34 -19
- package/lib/components/table/YDataTableServer.js.map +1 -1
- package/lib/components/table/YTable.js +8 -3
- package/lib/components/table/YTable.js.map +1 -1
- package/lib/components/table/composables/expand.js +49 -0
- package/lib/components/table/composables/expand.js.map +1 -0
- package/lib/components/table/composables/header.js +127 -0
- package/lib/components/table/composables/header.js.map +1 -0
- package/lib/components/table/composables/items.js +52 -0
- package/lib/components/table/composables/items.js.map +1 -0
- package/lib/components/table/composables/measure.js +55 -0
- package/lib/components/table/composables/measure.js.map +1 -0
- package/lib/components/table/composables/options.js +33 -0
- package/lib/components/table/composables/options.js.map +1 -0
- package/lib/components/table/composables/pagination.js +99 -0
- package/lib/components/table/composables/pagination.js.map +1 -0
- package/lib/components/table/composables/provides.js +3 -0
- package/lib/components/table/composables/provides.js.map +1 -0
- package/lib/components/table/composables/selection.js +196 -0
- package/lib/components/table/composables/selection.js.map +1 -0
- package/lib/components/table/composables/sorted-items.js +50 -0
- package/lib/components/table/composables/sorted-items.js.map +1 -0
- package/lib/components/table/composables/sorting.js +73 -0
- package/lib/components/table/composables/sorting.js.map +1 -0
- package/lib/components/table/composibles/measure.js +21 -5
- package/lib/components/table/composibles/measure.js.map +1 -1
- package/lib/components/table/types/index.js.map +1 -1
- package/lib/components/table/types/item.js.map +1 -1
- package/lib/components/tree-view/YTreeView.js +8 -4
- package/lib/components/tree-view/YTreeView.js.map +1 -1
- package/lib/components/tree-view/tree-view.js +34 -4
- package/lib/components/tree-view/tree-view.js.map +1 -1
- package/lib/components/tree-view/types.js.map +1 -1
- package/lib/composables/theme/setting.js +3 -2
- package/lib/composables/theme/setting.js.map +1 -1
- package/lib/util/color/index.js +1 -1
- package/lib/util/color/index.js.map +1 -1
- package/package.json +1 -1
- package/types/abstract/items.d.ts +4 -4
- package/types/components/badge/YBadge.d.ts +4 -4
- package/types/components/button/YButton.d.ts +8 -8
- package/types/components/chip/YChip.d.ts +1 -1
- package/types/components/date-picker/YDateCalendar.d.ts +1 -1
- package/types/components/date-picker/YDatePicker.d.ts +12 -12
- package/types/components/date-picker/YDatePickerControl.d.ts +10 -10
- package/types/components/dialog/YDialog.d.ts +72 -72
- package/types/components/dropdown/YDropdown.d.ts +55 -55
- package/types/components/field-input/YFieldInput.d.ts +13 -13
- package/types/components/hover/YHover.d.ts +3 -3
- package/types/components/icon/YIcon.d.ts +2 -2
- package/types/components/img/YImg.d.ts +5 -5
- package/types/components/input/YInput.d.ts +10 -9
- package/types/components/ip-field/YIpv4Field.d.ts +1 -1
- package/types/components/layer/YLayer.d.ts +26 -26
- package/types/components/layer/content.d.ts +1 -1
- package/types/components/layer/scroll-strategies.d.ts +1 -1
- package/types/components/list/YListItem.d.ts +1 -1
- package/types/components/menu/YMenu.d.ts +9 -9
- package/types/components/pagination/YPagination.d.ts +5 -5
- package/types/components/select/YSelect.d.ts +101 -101
- package/types/components/slider/index.d.ts +1 -0
- package/types/components/slider/slider.d.ts +0 -0
- package/types/components/snackbar/YSnackbar.d.ts +33 -33
- package/types/components/switch/YSwitch.d.ts +10 -10
- package/types/components/tab/YTab.d.ts +12 -12
- package/types/components/tab/YTabs.d.ts +4 -4
- package/types/components/table/YDataTable.d.ts +37 -15
- package/types/components/table/YDataTableBody.d.ts +5 -3
- package/types/components/table/YDataTableControl.d.ts +2 -2
- package/types/components/table/YDataTableHead.d.ts +2 -2
- package/types/components/table/YDataTableLayer.d.ts +4 -1
- package/types/components/table/YDataTableServer.d.ts +40 -18
- package/types/components/table/YTable.d.ts +4 -4
- package/types/components/table/composables/expand.d.ts +42 -0
- package/types/components/table/composables/header.d.ts +207 -0
- package/types/components/table/composables/items.d.ts +55 -0
- package/types/components/table/composables/measure.d.ts +8 -0
- package/types/components/table/composables/options.d.ts +11 -0
- package/types/components/table/composables/pagination.d.ts +81 -0
- package/types/components/table/composables/provides.d.ts +15 -0
- package/types/components/table/composables/selection.d.ts +82 -0
- package/types/components/table/composables/sorted-items.d.ts +7 -0
- package/types/components/table/composables/sorting.d.ts +62 -0
- package/types/components/table/types/index.d.ts +2 -1
- package/types/components/table/types/item.d.ts +2 -1
- package/types/components/textarea/YTextarea.d.ts +18 -18
- package/types/components/tooltip/YTooltip.d.ts +46 -46
- package/types/components/tree-view/YTreeView.d.ts +21 -9
- package/types/components/tree-view/YTreeViewNode.d.ts +8 -8
- package/types/components/tree-view/tree-view.d.ts +2 -1
- package/types/components/tree-view/types.d.ts +8 -6
- package/types/composables/choice.d.ts +1 -1
- package/types/composables/coordinate/index.d.ts +8 -8
- package/types/composables/form.d.ts +2 -2
- package/types/composables/icon.d.ts +2 -2
- package/types/composables/list-items.d.ts +10 -10
- package/types/composables/theme/setting.d.ts +1 -0
- package/types/composables/transition.d.ts +1 -1
- package/types/composables/validation.d.ts +3 -3
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { mergeProps as _mergeProps, createVNode as _createVNode } from "vue";
|
|
2
2
|
import { computed, getCurrentInstance } from 'vue';
|
|
3
|
-
import { YButton } from "
|
|
3
|
+
import { YButton } from "../button/YButton.js";
|
|
4
|
+
import { useExpand } from "./composables/expand.js";
|
|
5
|
+
import { useHeader } from "./composables/header.js";
|
|
6
|
+
import { useSelection } from "./composables/selection.js";
|
|
4
7
|
import { useRender } from "../../composables/component.js";
|
|
5
8
|
import { getPropertyFromItem } from "../../util/common.js";
|
|
6
9
|
import { defineComponent } from "../../util/component/index.js";
|
|
7
10
|
import { propsFactory } from "../../util/component/index.js";
|
|
8
11
|
import { YIconCheckbox } from "../icons/index.js";
|
|
9
12
|
import { YDataTableCell } from "./YDataTableCell.js";
|
|
10
|
-
import { useHeader } from "./composibles/header.js";
|
|
11
|
-
import { useSelection } from "./composibles/selection.js";
|
|
12
13
|
export const pressYDataTableRowProps = propsFactory({
|
|
13
14
|
index: Number,
|
|
14
15
|
onHover: Function,
|
|
@@ -32,13 +33,17 @@ export const YDataTableRow = defineComponent({
|
|
|
32
33
|
slots
|
|
33
34
|
} = _ref;
|
|
34
35
|
const vm = getCurrentInstance();
|
|
36
|
+
const {
|
|
37
|
+
columns
|
|
38
|
+
} = useHeader();
|
|
35
39
|
const {
|
|
36
40
|
isSelected,
|
|
37
41
|
toggleSelect
|
|
38
42
|
} = useSelection();
|
|
39
43
|
const {
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
isExpanded,
|
|
45
|
+
toggleExpand
|
|
46
|
+
} = useExpand();
|
|
42
47
|
const selected = computed(() => props.item && isSelected(props.item));
|
|
43
48
|
function arrayClasses(classes) {
|
|
44
49
|
const ret = [];
|
|
@@ -70,7 +75,8 @@ export const YDataTableRow = defineComponent({
|
|
|
70
75
|
useRender(() => {
|
|
71
76
|
return _createVNode("tr", {
|
|
72
77
|
"class": ['y-data-table__row', {
|
|
73
|
-
'y-data-table__row--selected': selected.value
|
|
78
|
+
'y-data-table__row--selected': selected.value,
|
|
79
|
+
'y-data-table__row--expanded': isExpanded(props.item)
|
|
74
80
|
}],
|
|
75
81
|
"onClick": props.onClick && onClick,
|
|
76
82
|
"onContextmenu": props.onContextmenu && onContextmenu,
|
|
@@ -87,6 +93,8 @@ export const YDataTableRow = defineComponent({
|
|
|
87
93
|
value: getPropertyFromItem(item.columns, column.key),
|
|
88
94
|
selected: selected.value,
|
|
89
95
|
toggleSelect,
|
|
96
|
+
isExpanded,
|
|
97
|
+
toggleExpand,
|
|
90
98
|
el: vm?.proxy?.$el
|
|
91
99
|
};
|
|
92
100
|
const classes = computed(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"YDataTableRow.js","names":["computed","getCurrentInstance","YButton","useRender","getPropertyFromItem","defineComponent","propsFactory","YIconCheckbox","YDataTableCell","useHeader","useSelection","pressYDataTableRowProps","index","Number","onHover","Function","onMousedown","onClick","onDblclick","onContextmenu","onKeydown","YDataTableRow","name","props","item","Object","cellProps","emits","setup","_ref","emit","slots","vm","isSelected","toggleSelect","columns","selected","arrayClasses","classes","ret","push","Array","isArray","forEach","c","event","proxy","$el","_createVNode","value","map","column","colIndex","slotProps","raw","internalItem","key","el","result","call","_mergeProps","align","fixed","lastFixed","undefined","fixedOffset","rightOffset","width","maxWidth","default","slotName","selectable","e","stopPropagation"],"sources":["../../../src/components/table/YDataTableRow.tsx"],"sourcesContent":["import { type PropType, computed, getCurrentInstance } from 'vue';\r\n\r\nimport { YButton } from '@/components';\r\nimport { useRender } from '@/composables/component';\r\nimport { getPropertyFromItem } from '@/util/common';\r\nimport { defineComponent } from '@/util/component';\r\nimport { propsFactory } from '@/util/component';\r\n\r\nimport { YIconCheckbox } from '../icons';\r\nimport { YDataTableCell } from './YDataTableCell';\r\nimport { useHeader } from './composibles/header';\r\nimport { useSelection } from './composibles/selection';\r\nimport { CellProps, DataTableItem, type FixedPropType } from './types';\r\n\r\nexport const pressYDataTableRowProps = propsFactory(\r\n {\r\n index: Number as PropType<number>,\r\n onHover: Function as PropType<(...args: any[]) => void>,\r\n onMousedown: Function as PropType<(...args: any[]) => void>,\r\n onClick: Function as PropType<(...args: any[]) => void>,\r\n onDblclick: Function as PropType<(...args: any[]) => void>,\r\n onContextmenu: Function as PropType<(...args: any[]) => void>,\r\n onKeydown: Function as PropType<(...args: any[]) => void>,\r\n },\r\n 'YDataTableRow',\r\n);\r\n\r\nexport const YDataTableRow = defineComponent({\r\n name: 'YDataTableRow',\r\n props: {\r\n item: Object as PropType<DataTableItem>,\r\n cellProps: [Object, Function] as PropType<CellProps>,\r\n ...pressYDataTableRowProps(),\r\n },\r\n emits: ['hover', 'mousedown', 'click', 'dblclick', 'contextmenu'],\r\n setup(props, { emit, slots }) {\r\n const vm = getCurrentInstance();\r\n const { isSelected, toggleSelect } = useSelection();\r\n const { columns } = useHeader();\r\n\r\n const selected = computed(() => props.item && isSelected(props.item));\r\n\r\n function arrayClasses(classes: string | string[]) {\r\n const ret: string[] = [];\r\n if (typeof classes === 'string') {\r\n ret.push(classes);\r\n }\r\n if (Array.isArray(classes)) {\r\n classes.forEach((c) => {\r\n if (typeof c === 'string') ret.push(c);\r\n });\r\n }\r\n return ret;\r\n }\r\n\r\n function onMousedown(event: MouseEvent) {\r\n props.onMousedown?.(event, vm?.proxy?.$el);\r\n }\r\n\r\n function onClick(event: MouseEvent) {\r\n props.onClick?.(event, vm?.proxy?.$el);\r\n }\r\n\r\n function onContextmenu(event: MouseEvent) {\r\n props.onContextmenu?.(event, vm?.proxy?.$el);\r\n }\r\n\r\n function onDblclick(event: MouseEvent) {\r\n props.onDblclick?.(event, vm?.proxy?.$el);\r\n }\r\n\r\n function onKeydown(event: KeyboardEvent) {\r\n props.onKeydown?.(event, vm?.proxy?.$el);\r\n }\r\n\r\n useRender(() => {\r\n return (\r\n <tr\r\n class={[\r\n 'y-data-table__row',\r\n { 'y-data-table__row--selected': selected.value },\r\n ]}\r\n onClick={props.onClick && onClick}\r\n onContextmenu={props.onContextmenu && onContextmenu}\r\n onDblclick={props.onDblclick && onDblclick}\r\n onMousedown={props.onMousedown && onMousedown}\r\n onKeydown={props.onKeydown && onKeydown}\r\n >\r\n {props.item &&\r\n columns.value.map((column, colIndex) => {\r\n const item = props.item!;\r\n const slotProps = {\r\n index: props.index!,\r\n item: props.item!.raw,\r\n internalItem: props.item!,\r\n columns: columns.value,\r\n value: getPropertyFromItem(item.columns, column.key),\r\n selected: selected.value,\r\n toggleSelect,\r\n el: vm?.proxy?.$el,\r\n };\r\n\r\n const classes = computed(() => {\r\n const ret: string[] = [];\r\n if (typeof column.classes === 'function') {\r\n const result = column.classes.call(\r\n null,\r\n slotProps.item,\r\n slotProps.index,\r\n column,\r\n );\r\n if (result) {\r\n ret.push(...arrayClasses(result));\r\n }\r\n } else if (column.classes) {\r\n ret.push(...arrayClasses(column.classes));\r\n }\r\n\r\n return ret;\r\n });\r\n\r\n const cellProps =\r\n typeof props.cellProps === 'function'\r\n ? props.cellProps({\r\n index: slotProps.index,\r\n column,\r\n internalItem: slotProps.internalItem,\r\n item: slotProps.item,\r\n value: slotProps.value,\r\n selected: slotProps.selected,\r\n })\r\n : props.cellProps;\r\n\r\n return (\r\n <YDataTableCell\r\n align={column.align}\r\n fixed={\r\n column.fixed\r\n ? (((column.fixed === 'right' ? 'trail' : 'lead') +\r\n (column.lastFixed ? '-last' : '')) as FixedPropType)\r\n : undefined\r\n }\r\n fixedOffset={column.fixedOffset}\r\n rightOffset={column.rightOffset}\r\n width={column.width}\r\n maxWidth={column.maxWidth}\r\n class={[\r\n 'y-data-table-data',\r\n {\r\n 'y-data-table-data--select':\r\n column.key === 'data-table-select',\r\n },\r\n ...classes.value,\r\n ]}\r\n {...cellProps}\r\n >\r\n {{\r\n default: () => {\r\n const slotName = `item.${column.key}`;\r\n\r\n if (slots[slotName]) {\r\n return slots[slotName]?.(slotProps);\r\n }\r\n\r\n if (column.key === 'data-table-select') {\r\n return (\r\n slots['item.data-table-select']?.(slotProps) ?? (\r\n <YButton\r\n variation={'text,small'}\r\n disabled={!item.selectable}\r\n onClick={(e: MouseEvent) => {\r\n e.stopPropagation();\r\n if (item.selectable) toggleSelect(item);\r\n }}\r\n >\r\n <YIconCheckbox\r\n checked={isSelected(item)}\r\n disabled={!item.selectable}\r\n ></YIconCheckbox>\r\n </YButton>\r\n )\r\n );\r\n }\r\n\r\n return slotProps.value;\r\n },\r\n }}\r\n </YDataTableCell>\r\n );\r\n })}\r\n </tr>\r\n );\r\n });\r\n },\r\n});\r\n\r\nexport type YDataTableRow = InstanceType<typeof YDataTableRow>;\r\n"],"mappings":";AAAA,SAAwBA,QAAQ,EAAEC,kBAAkB,QAAQ,KAAK;AAAC,SAEzDC,OAAO;AAAA,SACPC,SAAS;AAAA,SACTC,mBAAmB;AAAA,SACnBC,eAAe;AAAA,SACfC,YAAY;AAAA,SAEZC,aAAa;AAAA,SACbC,cAAc;AAAA,SACdC,SAAS;AAAA,SACTC,YAAY;AAGrB,OAAO,MAAMC,uBAAuB,GAAGL,YAAY,CACjD;EACEM,KAAK,EAAEC,MAA0B;EACjCC,OAAO,EAAEC,QAA8C;EACvDC,WAAW,EAAED,QAA8C;EAC3DE,OAAO,EAAEF,QAA8C;EACvDG,UAAU,EAAEH,QAA8C;EAC1DI,aAAa,EAAEJ,QAA8C;EAC7DK,SAAS,EAAEL;AACb,CAAC,EACD,eACF,CAAC;AAED,OAAO,MAAMM,aAAa,GAAGhB,eAAe,CAAC;EAC3CiB,IAAI,EAAE,eAAe;EACrBC,KAAK,EAAE;IACLC,IAAI,EAAEC,MAAiC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,CAAC,GACnCC,SAAS;UAAA,eAEFb,MAAM,CAACc,WAAW;UAAA,eAClBd,MAAM,CAACe,WAAW;UAAA,SACxBf,MAAM,CAACgB,KAAK;UAAA,YACThB,MAAM,CAACiB,QAAQ;UAAA,SAClB,CACL,mBAAmB,EACnB;YACE,2BAA2B,EACzBjB,MAAM,CAACK,GAAG,KAAK;UACnB,CAAC,EACD,GAAGlB,OAAO,CAACW,KAAK;QACjB,GACGvB,SAAS;UAGX2C,OAAO,EAAEA,CAAA,KAAM;YACb,MAAMC,QAAQ,GAAI,QAAOnB,MAAM,CAACK,GAAI,EAAC;YAErC,IAAIzB,KAAK,CAACuC,QAAQ,CAAC,EAAE;cACnB,OAAOvC,KAAK,CAACuC,QAAQ,CAAC,GAAGjB,SAAS,CAAC;YACrC;YAEA,IAAIF,MAAM,CAACK,GAAG,KAAK,mBAAmB,EAAE;cACtC,OACEzB,KAAK,CAAC,wBAAwB,CAAC,GAAGsB,SAAS,CAAC,IAAAL,YAAA,CAAA9C,OAAA;gBAAA,aAE7B,YAAY;gBAAA,YACb,CAACsB,IAAI,CAAC+C,UAAU;gBAAA,WAChBC,CAAa,IAAK;kBAC1BA,CAAC,CAACC,eAAe,CAAC,CAAC;kBACnB,IAAIjD,IAAI,CAAC+C,UAAU,EAAErC,YAAY,CAACV,IAAI,CAAC;gBACzC;cAAC;gBAAA6C,OAAA,EAAAA,CAAA,MAAArB,YAAA,CAAAzC,aAAA;kBAAA,WAGU0B,UAAU,CAACT,IAAI,CAAC;kBAAA,YACf,CAACA,IAAI,CAAC+C;gBAAU;cAAA,EAG/B;YAEL;YAEA,OAAOlB,SAAS,CAACJ,KAAK;UACxB;QAAC;MAIT,CAAC,CAAC;IAGV,CAAC,CAAC;EACJ;AACF,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"YDataTableRow.js","names":["computed","getCurrentInstance","YButton","useExpand","useHeader","useSelection","useRender","getPropertyFromItem","defineComponent","propsFactory","YIconCheckbox","YDataTableCell","pressYDataTableRowProps","index","Number","onHover","Function","onMousedown","onClick","onDblclick","onContextmenu","onKeydown","YDataTableRow","name","props","item","Object","cellProps","emits","setup","_ref","emit","slots","vm","columns","isSelected","toggleSelect","isExpanded","toggleExpand","selected","arrayClasses","classes","ret","push","Array","isArray","forEach","c","event","proxy","$el","_createVNode","value","map","column","colIndex","slotProps","raw","internalItem","key","el","result","call","_mergeProps","align","fixed","lastFixed","undefined","fixedOffset","rightOffset","width","maxWidth","default","slotName","selectable","e","stopPropagation"],"sources":["../../../src/components/table/YDataTableRow.tsx"],"sourcesContent":["import { type PropType, computed, getCurrentInstance } from 'vue';\n\nimport { YButton } from '@/components/button/YButton';\nimport { useExpand } from '@/components/table/composables/expand';\nimport { useHeader } from '@/components/table/composables/header';\nimport { useSelection } from '@/components/table/composables/selection';\nimport { useRender } from '@/composables/component';\nimport { getPropertyFromItem } from '@/util/common';\nimport { defineComponent } from '@/util/component';\nimport { propsFactory } from '@/util/component';\n\nimport { YIconCheckbox } from '../icons';\nimport { YDataTableCell } from './YDataTableCell';\nimport { CellProps, DataTableItem, type FixedPropType } from './types';\n\nexport const pressYDataTableRowProps = propsFactory(\n {\n index: Number as PropType<number>,\n onHover: Function as PropType<(...args: any[]) => void>,\n onMousedown: Function as PropType<(...args: any[]) => void>,\n onClick: Function as PropType<(...args: any[]) => void>,\n onDblclick: Function as PropType<(...args: any[]) => void>,\n onContextmenu: Function as PropType<(...args: any[]) => void>,\n onKeydown: Function as PropType<(...args: any[]) => void>,\n },\n 'YDataTableRow',\n);\n\nexport const YDataTableRow = defineComponent({\n name: 'YDataTableRow',\n props: {\n item: Object as PropType<DataTableItem>,\n cellProps: [Object, Function] as PropType<CellProps>,\n ...pressYDataTableRowProps(),\n },\n emits: ['hover', 'mousedown', 'click', 'dblclick', 'contextmenu'],\n setup(props, { emit, slots }) {\n const vm = getCurrentInstance();\n const { columns } = useHeader();\n const { isSelected, toggleSelect } = useSelection();\n const { isExpanded, toggleExpand } = useExpand();\n\n const selected = computed(() => props.item && isSelected(props.item));\n\n function arrayClasses(classes: string | string[]) {\n const ret: string[] = [];\n if (typeof classes === 'string') {\n ret.push(classes);\n }\n if (Array.isArray(classes)) {\n classes.forEach((c) => {\n if (typeof c === 'string') ret.push(c);\n });\n }\n return ret;\n }\n\n function onMousedown(event: MouseEvent) {\n props.onMousedown?.(event, vm?.proxy?.$el);\n }\n\n function onClick(event: MouseEvent) {\n props.onClick?.(event, vm?.proxy?.$el);\n }\n\n function onContextmenu(event: MouseEvent) {\n props.onContextmenu?.(event, vm?.proxy?.$el);\n }\n\n function onDblclick(event: MouseEvent) {\n props.onDblclick?.(event, vm?.proxy?.$el);\n }\n\n function onKeydown(event: KeyboardEvent) {\n props.onKeydown?.(event, vm?.proxy?.$el);\n }\n\n useRender(() => {\n return (\n <tr\n class={[\n 'y-data-table__row',\n {\n 'y-data-table__row--selected': selected.value,\n 'y-data-table__row--expanded': isExpanded(props.item!),\n },\n ]}\n onClick={props.onClick && onClick}\n onContextmenu={props.onContextmenu && onContextmenu}\n onDblclick={props.onDblclick && onDblclick}\n onMousedown={props.onMousedown && onMousedown}\n onKeydown={props.onKeydown && onKeydown}\n >\n {props.item &&\n columns.value.map((column, colIndex) => {\n const item = props.item!;\n const slotProps = {\n index: props.index!,\n item: props.item!.raw,\n internalItem: props.item!,\n columns: columns.value,\n value: getPropertyFromItem(item.columns, column.key),\n selected: selected.value,\n toggleSelect,\n isExpanded,\n toggleExpand,\n el: vm?.proxy?.$el,\n };\n\n const classes = computed(() => {\n const ret: string[] = [];\n if (typeof column.classes === 'function') {\n const result = column.classes.call(\n null,\n slotProps.item,\n slotProps.index,\n column,\n );\n if (result) {\n ret.push(...arrayClasses(result));\n }\n } else if (column.classes) {\n ret.push(...arrayClasses(column.classes));\n }\n\n return ret;\n });\n\n const cellProps =\n typeof props.cellProps === 'function'\n ? props.cellProps({\n index: slotProps.index,\n column,\n internalItem: slotProps.internalItem,\n item: slotProps.item,\n value: slotProps.value,\n selected: slotProps.selected,\n })\n : props.cellProps;\n\n return (\n <YDataTableCell\n align={column.align}\n fixed={\n column.fixed\n ? (((column.fixed === 'right' ? 'trail' : 'lead') +\n (column.lastFixed ? '-last' : '')) as FixedPropType)\n : undefined\n }\n fixedOffset={column.fixedOffset}\n rightOffset={column.rightOffset}\n width={column.width}\n maxWidth={column.maxWidth}\n class={[\n 'y-data-table-data',\n {\n 'y-data-table-data--select':\n column.key === 'data-table-select',\n },\n ...classes.value,\n ]}\n {...cellProps}\n >\n {{\n default: () => {\n const slotName = `item.${column.key}`;\n\n if (slots[slotName]) {\n return slots[slotName]?.(slotProps);\n }\n\n if (column.key === 'data-table-select') {\n return (\n slots['item.data-table-select']?.(slotProps) ?? (\n <YButton\n variation={'text,small'}\n disabled={!item.selectable}\n onClick={(e: MouseEvent) => {\n e.stopPropagation();\n if (item.selectable) toggleSelect(item);\n }}\n >\n <YIconCheckbox\n checked={isSelected(item)}\n disabled={!item.selectable}\n ></YIconCheckbox>\n </YButton>\n )\n );\n }\n\n return slotProps.value;\n },\n }}\n </YDataTableCell>\n );\n })}\n </tr>\n );\n });\n },\n});\n\nexport type YDataTableRow = InstanceType<typeof YDataTableRow>;\n"],"mappings":";AAAA,SAAwBA,QAAQ,EAAEC,kBAAkB,QAAQ,KAAK;AAAC,SAEzDC,OAAO;AAAA,SACPC,SAAS;AAAA,SACTC,SAAS;AAAA,SACTC,YAAY;AAAA,SACZC,SAAS;AAAA,SACTC,mBAAmB;AAAA,SACnBC,eAAe;AAAA,SACfC,YAAY;AAAA,SAEZC,aAAa;AAAA,SACbC,cAAc;AAGvB,OAAO,MAAMC,uBAAuB,GAAGH,YAAY,CACjD;EACEI,KAAK,EAAEC,MAA0B;EACjCC,OAAO,EAAEC,QAA8C;EACvDC,WAAW,EAAED,QAA8C;EAC3DE,OAAO,EAAEF,QAA8C;EACvDG,UAAU,EAAEH,QAA8C;EAC1DI,aAAa,EAAEJ,QAA8C;EAC7DK,SAAS,EAAEL;AACb,CAAC,E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A,YACf,CAACA,IAAI,CAACiD;gBAAU;cAAA,EAG/B;YAEL;YAEA,OAAOlB,SAAS,CAACJ,KAAK;UACxB;QAAC;MAIT,CAAC,CAAC;IAGV,CAAC,CAAC;EACJ;AACF,CAAC,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { mergeProps as _mergeProps,
|
|
2
|
-
import { computed, provide, ref, toRef } from 'vue';
|
|
1
|
+
import { mergeProps as _mergeProps, Fragment as _Fragment, createVNode as _createVNode, resolveDirective as _resolveDirective } from "vue";
|
|
2
|
+
import { computed, provide, ref, toRef, Fragment } from 'vue';
|
|
3
|
+
import { provideExpand } from "./composables/expand.js";
|
|
4
|
+
import { YDataTableInjectionKey } from "./composables/provides.js";
|
|
3
5
|
import { useRender } from "../../composables/component.js";
|
|
4
6
|
import { useResizeObserver } from "../../composables/resize-observer.js";
|
|
5
7
|
import { chooseProps, defineComponent, propsFactory } from "../../util/component/index.js";
|
|
@@ -11,12 +13,12 @@ import { YDataTableControl } from "./YDataTableControl.js";
|
|
|
11
13
|
import { YDataTableHead } from "./YDataTableHead.js";
|
|
12
14
|
import { YDataTableLayer } from "./YDataTableLayer.js";
|
|
13
15
|
import { YTable } from "./YTable.js";
|
|
14
|
-
import { createHeader } from "./
|
|
15
|
-
import { useItems } from "./
|
|
16
|
-
import { useOptions } from "./
|
|
17
|
-
import { createPagination, pressDataTablePaginationProps, providePagination } from "./
|
|
18
|
-
import { provideSelection } from "./
|
|
19
|
-
import { createSorting, provideSorting } from "./
|
|
16
|
+
import { createHeader } from "./composables/header.js";
|
|
17
|
+
import { useItems } from "./composables/items.js";
|
|
18
|
+
import { useOptions } from "./composables/options.js";
|
|
19
|
+
import { createPagination, pressDataTablePaginationProps, providePagination } from "./composables/pagination.js";
|
|
20
|
+
import { provideSelection } from "./composables/selection.js";
|
|
21
|
+
import { createSorting, provideSorting } from "./composables/sorting.js";
|
|
20
22
|
export const pressDataTableServerProps = propsFactory({
|
|
21
23
|
total: {
|
|
22
24
|
type: [Number, String],
|
|
@@ -43,6 +45,7 @@ export const YDataTableServer = defineComponent({
|
|
|
43
45
|
'update:pageSize': pageSize => true,
|
|
44
46
|
'update:sortBy': sortBy => true,
|
|
45
47
|
'update:options': options => true,
|
|
48
|
+
'update:expanded': expanded => true,
|
|
46
49
|
'click:row': (e, value) => true
|
|
47
50
|
},
|
|
48
51
|
setup(props, _ref) {
|
|
@@ -50,6 +53,7 @@ export const YDataTableServer = defineComponent({
|
|
|
50
53
|
slots,
|
|
51
54
|
emit
|
|
52
55
|
} = _ref;
|
|
56
|
+
const TableBodyRef = ref();
|
|
53
57
|
const {
|
|
54
58
|
page,
|
|
55
59
|
pageSize
|
|
@@ -95,6 +99,10 @@ export const YDataTableServer = defineComponent({
|
|
|
95
99
|
allItems: items,
|
|
96
100
|
pageItems: items
|
|
97
101
|
});
|
|
102
|
+
const {
|
|
103
|
+
isExpanded,
|
|
104
|
+
toggleExpand
|
|
105
|
+
} = provideExpand(props);
|
|
98
106
|
const headRect = ref();
|
|
99
107
|
const debounceMeasureHead = debounce(measureHead, 100);
|
|
100
108
|
const {
|
|
@@ -102,20 +110,12 @@ export const YDataTableServer = defineComponent({
|
|
|
102
110
|
} = useResizeObserver(entries => {
|
|
103
111
|
debounceMeasureHead(entries);
|
|
104
112
|
});
|
|
105
|
-
function measureHead(entries) {
|
|
106
|
-
headRect.value = entries?.[0].contentRect;
|
|
107
|
-
}
|
|
108
113
|
useOptions({
|
|
109
114
|
page,
|
|
110
115
|
pageSize,
|
|
111
116
|
search: toRef(props, 'search'),
|
|
112
117
|
sortBy
|
|
113
118
|
}, emit);
|
|
114
|
-
provide('y-data-table', {
|
|
115
|
-
toggleSort,
|
|
116
|
-
sortBy,
|
|
117
|
-
headRect
|
|
118
|
-
});
|
|
119
119
|
const slotProps = computed(() => {
|
|
120
120
|
return {
|
|
121
121
|
// pagination
|
|
@@ -127,6 +127,9 @@ export const YDataTableServer = defineComponent({
|
|
|
127
127
|
// sorting
|
|
128
128
|
sortBy: sortBy.value,
|
|
129
129
|
toggleSort,
|
|
130
|
+
// expand
|
|
131
|
+
isExpanded,
|
|
132
|
+
toggleExpand,
|
|
130
133
|
// selection
|
|
131
134
|
someSelected: someSelected.value,
|
|
132
135
|
allSelected: allSelected.value,
|
|
@@ -134,12 +137,22 @@ export const YDataTableServer = defineComponent({
|
|
|
134
137
|
select,
|
|
135
138
|
selectAll,
|
|
136
139
|
toggleSelect,
|
|
137
|
-
//
|
|
140
|
+
// matrix
|
|
138
141
|
items: items.value,
|
|
139
142
|
columns: columns.value,
|
|
140
|
-
headers: headers.value
|
|
143
|
+
headers: headers.value,
|
|
144
|
+
//
|
|
145
|
+
TableBodyRef
|
|
141
146
|
};
|
|
142
147
|
});
|
|
148
|
+
function measureHead(entries) {
|
|
149
|
+
headRect.value = entries?.[0].contentRect;
|
|
150
|
+
}
|
|
151
|
+
provide(YDataTableInjectionKey, {
|
|
152
|
+
toggleSort,
|
|
153
|
+
sortBy,
|
|
154
|
+
headRect
|
|
155
|
+
});
|
|
143
156
|
useRender(() => {
|
|
144
157
|
const yDataTableHeadProps = chooseProps(props, YDataTableHead.props);
|
|
145
158
|
const yDataTableBodyProps = chooseProps(props, YDataTableBody.props);
|
|
@@ -159,7 +172,9 @@ export const YDataTableServer = defineComponent({
|
|
|
159
172
|
}, slots)]),
|
|
160
173
|
default: () => slots.default ? slots.default(slotProps.value) : _createVNode(_Fragment, null, [_createVNode("thead", {
|
|
161
174
|
"ref": headObserveRef
|
|
162
|
-
}, [_createVNode(YDataTableHead, yDataTableHeadProps, slots)]), slots.thead?.(slotProps.value), _createVNode("tbody", null, [_createVNode(YDataTableBody, _mergeProps(
|
|
175
|
+
}, [_createVNode(YDataTableHead, yDataTableHeadProps, slots)]), slots.thead?.(slotProps.value), _createVNode("tbody", null, [_createVNode(YDataTableBody, _mergeProps({
|
|
176
|
+
"ref": TableBodyRef
|
|
177
|
+
}, yDataTableBodyProps, {
|
|
163
178
|
"items": items.value
|
|
164
179
|
}), slots)]), slots.tbody?.(slotProps.value), slots.tfoot?.(slotProps.value)]),
|
|
165
180
|
trailing: () => slots.trailing?.(slotProps.value),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"YDataTableServer.js","names":["computed","provide","ref","toRef","useRender","useResizeObserver","chooseProps","defineComponent","propsFactory","debounce","toStyleSizeValue","pressDataTableProps","YDataTableBody","YDataTableControl","YDataTableHead","YDataTableLayer","YTable","createHeader","useItems","useOptions","createPagination","pressDataTablePaginationProps","providePagination","provideSelection","createSorting","provideSorting","pressDataTableServerProps","total","type","Number","String","required","YDataTableServer","name","components","props","emits","value","page","pageSize","sortBy","options","click:row","e","setup","_ref","slots","emit","multiSort","parseInt","columns","headers","enableSelect","items","toggleSort","pageLength","setPageSize","setPage","isSelected","select","selectAll","toggleSelect","someSelected","allSelected","allItems","pageItems","headRect","debounceMeasureHead","measureHead","resizeObservedRef","headObserveRef","entries","contentRect","search","slotProps","yDataTableHeadProps","yDataTableBodyProps","yTableProps","_createVNode","_mergeProps","loading","length","hideNoData","height","top","leading","_Fragment","default","thead","tbody","tfoot","trailing","bottom","prepend"],"sources":["../../../src/components/table/YDataTableServer.tsx"],"sourcesContent":["import { type PropType, computed, provide, ref, toRef } from 'vue';\n\nimport { useRender } from '@/composables/component';\nimport { useResizeObserver } from '@/composables/resize-observer';\nimport { chooseProps, defineComponent, propsFactory } from '@/util/component';\nimport { debounce } from '@/util/debounce';\nimport { toStyleSizeValue } from '@/util/ui';\n\nimport { pressDataTableProps } from './YDataTable';\nimport { YDataTableBody } from './YDataTableBody';\nimport { YDataTableControl } from './YDataTableControl';\nimport { YDataTableHead } from './YDataTableHead';\nimport { YDataTableLayer } from './YDataTableLayer';\nimport { YTable } from './YTable';\nimport { createHeader } from './composibles/header';\nimport { useItems } from './composibles/items';\nimport { useOptions } from './composibles/options';\nimport {\n createPagination,\n pressDataTablePaginationProps,\n providePagination,\n} from './composibles/pagination';\nimport { provideSelection } from './composibles/selection';\nimport { createSorting, provideSorting } from './composibles/sorting';\nimport { YDataTableSlotProps } from './types';\n\nexport const pressDataTableServerProps = propsFactory(\n {\n total: {\n type: [Number, String] as PropType<number | string>,\n required: true,\n },\n ...pressDataTablePaginationProps(),\n ...pressDataTableProps(),\n },\n 'YDataTableServer',\n);\n\nexport const YDataTableServer = defineComponent({\n name: 'YDataTableServer',\n components: {\n YTable,\n YDataTableLayer,\n YDataTableHead,\n YDataTableBody,\n YDataTableControl,\n },\n props: {\n ...pressDataTableServerProps(),\n },\n emits: {\n 'update:modelValue': (value: any[]) => true,\n 'update:page': (page: number) => true,\n 'update:pageSize': (pageSize: number) => true,\n 'update:sortBy': (sortBy: any) => true,\n 'update:options': (options: any) => true,\n 'click:row': (e: Event, value: { row: any }) => true,\n },\n setup(props, { slots, emit }) {\n const { page, pageSize } = createPagination(props);\n const { sortBy, multiSort } = createSorting(props);\n const total = computed(() => parseInt(props.total as string));\n const { columns, headers } = createHeader(props, {\n enableSelect: toRef(props, 'enableSelect'),\n });\n const { items } = useItems(props, columns);\n\n const { toggleSort } = provideSorting({ sortBy, multiSort, page });\n const { pageLength, setPageSize, setPage } = providePagination({\n page,\n pageSize,\n total,\n });\n const {\n isSelected,\n select,\n selectAll,\n toggleSelect,\n someSelected,\n allSelected,\n } = provideSelection(props, { allItems: items, pageItems: items });\n\n const headRect = ref<DOMRectReadOnly>();\n const debounceMeasureHead = debounce(measureHead, 100);\n const { resizeObservedRef: headObserveRef } = useResizeObserver(\n (entries) => {\n debounceMeasureHead(entries);\n },\n );\n\n function measureHead(entries: ResizeObserverEntry[]) {\n headRect.value = entries?.[0].contentRect;\n }\n\n useOptions(\n {\n page,\n pageSize,\n search: toRef(props, 'search'),\n sortBy,\n },\n emit,\n );\n\n provide('y-data-table', {\n toggleSort,\n sortBy,\n headRect,\n });\n\n const slotProps = computed<YDataTableSlotProps>(() => {\n return {\n // pagination\n page: page.value,\n pageSize: pageSize.value,\n pageLength: pageLength.value,\n setPageSize,\n setPage,\n // sorting\n sortBy: sortBy.value,\n toggleSort,\n // selection\n someSelected: someSelected.value,\n allSelected: allSelected.value,\n isSelected,\n select,\n selectAll,\n toggleSelect,\n //\n items: items.value,\n columns: columns.value,\n headers: headers.value,\n };\n });\n\n useRender(() => {\n const yDataTableHeadProps = chooseProps(props, YDataTableHead.props);\n const yDataTableBodyProps = chooseProps(props, YDataTableBody.props);\n const yTableProps = chooseProps(props, YTable.props);\n return (\n <YTable\n class={[\n 'y-data-table',\n {\n 'y-data-table--no-data':\n !props.loading && props.items.length < 1 && !props.hideNoData,\n },\n ]}\n {...yTableProps}\n style={{\n '--y-table-head-height': toStyleSizeValue(headRect.value?.height),\n }}\n >\n {{\n top: () => slots.top?.(slotProps.value),\n leading: () =>\n slots.leading ? (\n slots.leading(slotProps.value)\n ) : (\n <>\n <YDataTableLayer\n v-slots={slots}\n slotProps={slotProps.value}\n ></YDataTableLayer>\n </>\n ),\n default: () =>\n slots.default ? (\n slots.default(slotProps.value)\n ) : (\n <>\n <thead ref={headObserveRef}>\n <YDataTableHead\n v-slots={slots}\n {...yDataTableHeadProps}\n ></YDataTableHead>\n </thead>\n {slots.thead?.(slotProps.value)}\n <tbody>\n <YDataTableBody\n v-slots={slots}\n {...yDataTableBodyProps}\n items={items.value}\n ></YDataTableBody>\n </tbody>\n {slots.tbody?.(slotProps.value)}\n {slots.tfoot?.(slotProps.value)}\n </>\n ),\n trailing: () => slots.trailing?.(slotProps.value),\n bottom: () =>\n slots.bottom ? (\n slots.bottom(slotProps.value)\n ) : (\n <YDataTableControl\n v-slots={{\n prepend: slots['control.prepend'],\n }}\n ></YDataTableControl>\n ),\n }}\n </YTable>\n );\n });\n },\n});\n\nexport type YDataTableServer = InstanceType<typeof YDataTableServer>;\n"],"mappings":";AAAA,SAAwBA,QAAQ,EAAEC,OAAO,EAAEC,GAAG,EAAEC,KAAK,QAAQ,KAAK;AAAC,SAE1DC,SAAS;AAAA,SACTC,iBAAiB;AAAA,SACjBC,WAAW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ACrC,KAAK,CAAC,GAAAyC,YAAA,CAAAjE,iBAAA,QAGlB;UACPgF,OAAO,EAAE/C,KAAK,CAAC,iBAAiB;QAClC,CAAC;MAEJ;IAIX,CAAC,CAAC;EACJ;AACF,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"YDataTableServer.js","names":["computed","provide","ref","toRef","Fragment","provideExpand","YDataTableInjectionKey","useRender","useResizeObserver","chooseProps","defineComponent","propsFactory","debounce","toStyleSizeValue","pressDataTableProps","YDataTableBody","YDataTableControl","YDataTableHead","YDataTableLayer","YTable","createHeader","useItems","useOptions","createPagination","pressDataTablePaginationProps","providePagination","provideSelection","createSorting","provideSorting","pressDataTableServerProps","total","type","Number","String","required","YDataTableServer","name","components","props","emits","value","page","pageSize","sortBy","options","expanded","click:row","e","setup","_ref","slots","emit","TableBodyRef","multiSort","parseInt","columns","headers","enableSelect","items","toggleSort","pageLength","setPageSize","setPage","isSelected","select","selectAll","toggleSelect","someSelected","allSelected","allItems","pageItems","isExpanded","toggleExpand","headRect","debounceMeasureHead","measureHead","resizeObservedRef","headObserveRef","entries","search","slotProps","contentRect","yDataTableHeadProps","yDataTableBodyProps","yTableProps","_createVNode","_mergeProps","loading","length","hideNoData","height","top","leading","_Fragment","default","thead","tbody","tfoot","trailing","bottom","prepend"],"sources":["../../../src/components/table/YDataTableServer.tsx"],"sourcesContent":["import { type PropType, computed, provide, ref, toRef, Fragment } from 'vue';\n\nimport { provideExpand } from '@/components/table/composables/expand';\nimport { YDataTableInjectionKey } from '@/components/table/composables/provides';\nimport { useRender } from '@/composables/component';\nimport { useResizeObserver } from '@/composables/resize-observer';\nimport { chooseProps, defineComponent, propsFactory } from '@/util/component';\nimport { debounce } from '@/util/debounce';\nimport { toStyleSizeValue } from '@/util/ui';\n\nimport { pressDataTableProps } from './YDataTable';\nimport { YDataTableBody } from './YDataTableBody';\nimport { YDataTableControl } from './YDataTableControl';\nimport { YDataTableHead } from './YDataTableHead';\nimport { YDataTableLayer } from './YDataTableLayer';\nimport { YTable } from './YTable';\nimport { createHeader } from './composables/header';\nimport { useItems } from './composables/items';\nimport { useOptions } from './composables/options';\nimport {\n createPagination,\n pressDataTablePaginationProps,\n providePagination,\n} from './composables/pagination';\nimport { provideSelection } from './composables/selection';\nimport { createSorting, provideSorting } from './composables/sorting';\nimport { YDataTableSlotProps } from './types';\n\nexport const pressDataTableServerProps = propsFactory(\n {\n total: {\n type: [Number, String] as PropType<number | string>,\n required: true,\n },\n ...pressDataTablePaginationProps(),\n ...pressDataTableProps(),\n },\n 'YDataTableServer',\n);\n\nexport const YDataTableServer = defineComponent({\n name: 'YDataTableServer',\n components: {\n YTable,\n YDataTableLayer,\n YDataTableHead,\n YDataTableBody,\n YDataTableControl,\n },\n props: {\n ...pressDataTableServerProps(),\n },\n emits: {\n 'update:modelValue': (value: any[]) => true,\n 'update:page': (page: number) => true,\n 'update:pageSize': (pageSize: number) => true,\n 'update:sortBy': (sortBy: any) => true,\n 'update:options': (options: any) => true,\n 'update:expanded': (expanded: any[]) => true,\n 'click:row': (e: Event, value: { row: any }) => true,\n },\n setup(props, { slots, emit }) {\n const TableBodyRef = ref();\n const { page, pageSize } = createPagination(props);\n const { sortBy, multiSort } = createSorting(props);\n const total = computed(() => parseInt(props.total as string));\n const { columns, headers } = createHeader(props, {\n enableSelect: toRef(props, 'enableSelect'),\n });\n const { items } = useItems(props, columns);\n\n const { toggleSort } = provideSorting({ sortBy, multiSort, page });\n const { pageLength, setPageSize, setPage } = providePagination({\n page,\n pageSize,\n total,\n });\n const {\n isSelected,\n select,\n selectAll,\n toggleSelect,\n someSelected,\n allSelected,\n } = provideSelection(props, { allItems: items, pageItems: items });\n const { isExpanded, toggleExpand } = provideExpand(props);\n\n const headRect = ref<DOMRectReadOnly>();\n const debounceMeasureHead = debounce(measureHead, 100);\n const { resizeObservedRef: headObserveRef } = useResizeObserver(\n (entries) => {\n debounceMeasureHead(entries);\n },\n );\n\n useOptions(\n {\n page,\n pageSize,\n search: toRef(props, 'search'),\n sortBy,\n },\n emit,\n );\n\n const slotProps = computed<YDataTableSlotProps>(() => {\n return {\n // pagination\n page: page.value,\n pageSize: pageSize.value,\n pageLength: pageLength.value,\n setPageSize,\n setPage,\n // sorting\n sortBy: sortBy.value,\n toggleSort,\n // expand\n isExpanded,\n toggleExpand,\n // selection\n someSelected: someSelected.value,\n allSelected: allSelected.value,\n isSelected,\n select,\n selectAll,\n toggleSelect,\n // matrix\n items: items.value,\n columns: columns.value,\n headers: headers.value,\n //\n TableBodyRef,\n };\n });\n\n function measureHead(entries: ResizeObserverEntry[]) {\n headRect.value = entries?.[0].contentRect;\n }\n\n provide(YDataTableInjectionKey, {\n toggleSort,\n sortBy,\n headRect,\n });\n\n useRender(() => {\n const yDataTableHeadProps = chooseProps(props, YDataTableHead.props);\n const yDataTableBodyProps = chooseProps(props, YDataTableBody.props);\n const yTableProps = chooseProps(props, YTable.props);\n return (\n <YTable\n class={[\n 'y-data-table',\n {\n 'y-data-table--no-data':\n !props.loading && props.items.length < 1 && !props.hideNoData,\n },\n ]}\n {...yTableProps}\n style={{\n '--y-table-head-height': toStyleSizeValue(headRect.value?.height),\n }}\n >\n {{\n top: () => slots.top?.(slotProps.value),\n leading: () =>\n slots.leading ? (\n slots.leading(slotProps.value)\n ) : (\n <Fragment>\n <YDataTableLayer\n v-slots={slots}\n slotProps={slotProps.value}\n ></YDataTableLayer>\n </Fragment>\n ),\n default: () =>\n slots.default ? (\n slots.default(slotProps.value)\n ) : (\n <Fragment>\n <thead ref={headObserveRef}>\n <YDataTableHead\n v-slots={slots}\n {...yDataTableHeadProps}\n ></YDataTableHead>\n </thead>\n {slots.thead?.(slotProps.value)}\n <tbody>\n <YDataTableBody\n ref={TableBodyRef}\n v-slots={slots}\n {...yDataTableBodyProps}\n items={items.value}\n ></YDataTableBody>\n </tbody>\n {slots.tbody?.(slotProps.value)}\n {slots.tfoot?.(slotProps.value)}\n </Fragment>\n ),\n trailing: () => slots.trailing?.(slotProps.value),\n bottom: () =>\n slots.bottom ? (\n slots.bottom(slotProps.value)\n ) : (\n <YDataTableControl\n v-slots={{\n prepend: slots['control.prepend'],\n }}\n ></YDataTableControl>\n ),\n }}\n </YTable>\n );\n });\n },\n});\n\nexport type YDataTableServer = InstanceType<typeof YDataTableServer>;\n"],"mappings":";AAAA,SAAwBA,QAAQ,EAAEC,OAAO,EAAEC,GAAG,EAAEC,KAAK,EAAEC,QAAQ,QAAQ,KAAK;AAAC,SAEpEC,aAAa;AAAA,SACbC,sBAAsB;AAAA,SACtBC,SAAS;AAAA,SACTC,iBAAiB;AAAA,SACjBC,WAAW,EAAEC,eAAe,EAAEC,YAAY;AAAA,SAC1CC,QAAQ;AAAA,SACRC,gBAAgB;AAAA,SAEhBC,mBAAmB;AAAA,SACnBC,cAAc;AAAA,SACdC,iBAAiB;AAAA,SACjBC,cAAc;AAAA,SACdC,eAAe;AAAA,SACfC,MAAM;AAAA,SACNC,YAAY;AAAA,SACZC,QAAQ;AAAA,SACRC,UAAU;AAAA,SAEjBC,gBAAgB,EAChBC,6BAA6B,EAC7BC,iBAAiB;AAAA,SAEVC,gBAAgB;AAAA,SAChBC,aAAa,EAAEC,cAAc;AAGtC,OAAO,MAAMC,yBAAyB,GAAGlB,YAAY,CACnD;EACEmB,KAAK,EAAE;IACLC,IAAI,EAAE,CAACC,MAAM,EAAEC,MAAM,CAA8B;IACnDC,QAAQ,EAAE;EACZ,CAAC;EACD,GAAGV,6BAA6B,CAAC,CAAC;EAClC,GAAGV,mBAAmB,CAAC;AACzB,CAAC,EACD,kBACF,CAAC;AAED,OAAO,MAAMqB,gBAAgB,GAAGzB,eAAe,CAAC;EAC9C0B,IAAI,EAAE,kBAAkB;EACxBC,UAAU,EAAE;IACVlB,MAAM;IACND,eAAe;IACfD,cAAc;IACdF,cAAc;IACdC;EACF,CAAC;EACDsB,KAAK,EAAE;IACL,GAAGT,yBAAyB,CAAC;EAC/B,CAAC;EACDU,KAAK,EAAE;IACL,mBAAmB,EAAGC,KAA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,SAAA,SAAAR,YAAA;UAAA,OAGhBR;QAAc,IAAAQ,YAAA,CAAApE,cAAA,EAGlBiE,mBAAmB,EADdhC,KAAK,KAIjBA,KAAK,CAAC6C,KAAK,GAAGf,SAAS,CAACxC,KAAK,CAAC,EAAA6C,YAAA,iBAAAA,YAAA,CAAAtE,cAAA,EAAAuE,WAAA;UAAA,OAGtBlC;QAAY,GAEb+B,mBAAmB;UAAA,SAChBzB,KAAK,CAAClB;QAAK,IAFTU,KAAK,KAKjBA,KAAK,CAAC8C,KAAK,GAAGhB,SAAS,CAACxC,KAAK,CAAC,EAC9BU,KAAK,CAAC+C,KAAK,GAAGjB,SAAS,CAACxC,KAAK,CAAC,EAElC;QACH0D,QAAQ,EAAEA,CAAA,KAAMhD,KAAK,CAACgD,QAAQ,GAAGlB,SAAS,CAACxC,KAAK,CAAC;QACjD2D,MAAM,EAAEA,CAAA,KACNjD,KAAK,CAACiD,MAAM,GACVjD,KAAK,CAACiD,MAAM,CAACnB,SAAS,CAACxC,KAAK,CAAC,GAAA6C,YAAA,CAAArE,iBAAA,QAGlB;UACPoF,OAAO,EAAElD,KAAK,CAAC,iBAAiB;QAClC,CAAC;MAEJ;IAIX,CAAC,CAAC;EACJ;AACF,CAAC,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { createVNode as _createVNode } from "vue";
|
|
2
2
|
import { provide } from 'vue';
|
|
3
|
-
import { useRectMeasure } from "./composibles/measure.js";
|
|
4
3
|
import { useRender } from "../../composables/component.js";
|
|
5
4
|
import { defineComponent, propsFactory } from "../../util/component/index.js";
|
|
6
5
|
import { toStyleSizeValue } from "../../util/ui.js";
|
|
6
|
+
import { useRectMeasure } from "./composables/measure.js";
|
|
7
7
|
import "./YTable.scss";
|
|
8
|
+
import { YTableInjectionKey } from "./composables/provides.js";
|
|
8
9
|
export const pressYTableProps = propsFactory({
|
|
9
10
|
tag: {
|
|
10
11
|
type: String,
|
|
@@ -36,10 +37,14 @@ export const YTable = defineComponent({
|
|
|
36
37
|
containerRef,
|
|
37
38
|
tableRef,
|
|
38
39
|
containerRect,
|
|
40
|
+
wrapperRef,
|
|
39
41
|
wrapperRect
|
|
40
42
|
} = useRectMeasure();
|
|
41
|
-
provide(
|
|
42
|
-
containerRect
|
|
43
|
+
provide(YTableInjectionKey, {
|
|
44
|
+
containerRect,
|
|
45
|
+
tableRef,
|
|
46
|
+
wrapperRef,
|
|
47
|
+
wrapperRect
|
|
43
48
|
});
|
|
44
49
|
function onScroll(e) {
|
|
45
50
|
emit('scroll', e);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"YTable.js","names":["provide","
|
|
1
|
+
{"version":3,"file":"YTable.js","names":["provide","useRender","defineComponent","propsFactory","toStyleSizeValue","useRectMeasure","YTableInjectionKey","pressYTableProps","tag","type","String","default","fixedHead","Boolean","height","Number","flexHeight","onScroll","Function","YTable","name","props","emits","setup","_ref","slots","emit","containerRef","tableRef","containerRect","wrapperRef","wrapperRect","e","ElTag","containerHeight","value","_createVNode","width","top","leading","trailing","container","bottom"],"sources":["../../../src/components/table/YTable.tsx"],"sourcesContent":["import { type PropType, provide } from 'vue';\n\nimport { useRender } from '@/composables/component';\nimport { defineComponent, propsFactory } from '@/util/component';\nimport { toStyleSizeValue } from '@/util/ui';\n\nimport { useRectMeasure } from './composables/measure';\n\nimport './YTable.scss';\nimport { YTableInjectionKey } from '@/components/table/composables/provides';\n\nexport const pressYTableProps = propsFactory(\n {\n tag: {\n type: String as PropType<string>,\n default: 'div',\n },\n fixedHead: {\n type: Boolean as PropType<boolean>,\n },\n height: {\n type: [Number, String] as PropType<number | string>,\n },\n flexHeight: {\n type: Boolean as PropType<boolean>,\n },\n onScroll: Function as PropType<(e: Event) => void>,\n },\n 'YTable',\n);\n\nexport const YTable = defineComponent({\n name: 'YTable',\n props: {\n ...pressYTableProps(),\n },\n emits: ['scroll'],\n setup(props, { slots, emit }) {\n const { containerRef, tableRef, containerRect, wrapperRef, wrapperRect } =\n useRectMeasure();\n\n provide(YTableInjectionKey, { containerRect, tableRef, wrapperRef, wrapperRect });\n\n function onScroll(e: Event) {\n emit('scroll', e);\n }\n\n useRender(() => {\n const ElTag = (props.tag as keyof HTMLElementTagNameMap) ?? 'div';\n const containerHeight = props.flexHeight\n ? containerRect.value?.height ?? props.height\n : props.height;\n return (\n <ElTag\n class={[\n 'y-table',\n {\n 'y-table--fixed-head': props.fixedHead,\n 'y-table--fixed-height': props.flexHeight || props.height,\n 'y-table--flex-height': props.flexHeight,\n },\n ]}\n style={{\n '--y-table-container-width': toStyleSizeValue(\n containerRect.value?.width,\n ),\n '--y-table-wrapper-width': toStyleSizeValue(\n wrapperRect.value?.width,\n ),\n }}\n >\n {slots.top?.()}\n {slots.default ? (\n <div ref={containerRef} class={['y-table__container']}>\n {slots.leading?.()}\n <div\n class={['y-table__wrapper']}\n style={{\n height: toStyleSizeValue(containerHeight),\n }}\n onScroll={onScroll}\n >\n <table ref={tableRef}>{slots.default()}</table>\n </div>\n {slots.trailing?.()}\n </div>\n ) : (\n slots.container?.(containerRef, containerRect)\n )}\n {slots.bottom?.()}\n </ElTag>\n );\n });\n },\n});\n\nexport type YTable = InstanceType<typeof YTable>;\n"],"mappings":";AAAA,SAAwBA,OAAO,QAAQ,KAAK;AAAC,SAEpCC,SAAS;AAAA,SACTC,eAAe,EAAEC,YAAY;AAAA,SAC7BC,gBAAgB;AAAA,SAEhBC,cAAc;AAEvB;AAAuB,SACdC,kBAAkB;AAE3B,OAAO,MAAMC,gBAAgB,GAAGJ,YAAY,CAC1C;EACEK,GAAG,EAAE;IACHC,IAAI,EAAEC,MAA0B;IAChCC,OAAO,EAAE;EACX,CAAC;EACDC,SAAS,EAAE;IACTH,IAAI,EAAEI;EACR,CAAC;EACDC,MAAM,EAAE;IACNL,IAAI,EAAE,CAACM,MAAM,EAAEL,MAAM;EACvB,CAAC;EACDM,UAAU,EAAE;IACVP,IAAI,EAAEI;EACR,CAAC;EACDI,QAAQ,EAAEC;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CAAA,MAEAc,KAAK,CAACa,GAAG,GAAG,CAAC,EACbb,KAAK,CAACd,OAAO,GAAAyB,YAAA;UAAA,OACFT,YAAY;UAAA,SAAS,CAAC,oBAAoB;QAAC,IAClDF,KAAK,CAACc,OAAO,GAAG,CAAC,EAAAH,YAAA;UAAA,SAET,CAAC,kBAAkB,CAAC;UAAA,SACpB;YACLtB,MAAM,EAAEV,gBAAgB,CAAC8B,eAAe;UAC1C,CAAC;UAAA,YACSjB;QAAQ,IAAAmB,YAAA;UAAA,OAENR;QAAQ,IAAGH,KAAK,CAACd,OAAO,CAAC,CAAC,MAEvCc,KAAK,CAACe,QAAQ,GAAG,CAAC,KAGrBf,KAAK,CAACgB,SAAS,GAAGd,YAAY,EAAEE,aAAa,CAC9C,EACAJ,KAAK,CAACiB,MAAM,GAAG,CAAC;MAAA;IAGvB,CAAC,CAAC;EACJ;AACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { inject, provide } from 'vue';
|
|
2
|
+
import { useModelDuplex } from "../../../composables/communication.js";
|
|
3
|
+
import { propsFactory } from "../../../util/component/props.js";
|
|
4
|
+
export const pressDataTableExpandProps = propsFactory({
|
|
5
|
+
enableExpand: Boolean,
|
|
6
|
+
expanded: {
|
|
7
|
+
type: Array,
|
|
8
|
+
default: () => []
|
|
9
|
+
}
|
|
10
|
+
}, 'YDataTable--expand');
|
|
11
|
+
const Y_DATA_TABLE_EXPAND_KEY = Symbol.for('yuyeon.data-table.expand');
|
|
12
|
+
export function provideExpand(props) {
|
|
13
|
+
const expands = useModelDuplex(props, 'expanded', props.expanded ?? [], v => new Set(v), v => [...v]);
|
|
14
|
+
function isExpanded(item) {
|
|
15
|
+
return expands.value.has(item.value);
|
|
16
|
+
}
|
|
17
|
+
function expand(item, value) {
|
|
18
|
+
const neo = new Set(expands.value);
|
|
19
|
+
if (value) {
|
|
20
|
+
neo.add(item.value);
|
|
21
|
+
} else {
|
|
22
|
+
neo.delete(item.value);
|
|
23
|
+
}
|
|
24
|
+
expands.value = neo;
|
|
25
|
+
}
|
|
26
|
+
function toggleExpand(item) {
|
|
27
|
+
expand(item, !isExpanded(item));
|
|
28
|
+
}
|
|
29
|
+
provide(Y_DATA_TABLE_EXPAND_KEY, {
|
|
30
|
+
expands,
|
|
31
|
+
isExpanded,
|
|
32
|
+
expand,
|
|
33
|
+
toggleExpand
|
|
34
|
+
});
|
|
35
|
+
return {
|
|
36
|
+
expands,
|
|
37
|
+
isExpanded,
|
|
38
|
+
expand,
|
|
39
|
+
toggleExpand
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export function useExpand() {
|
|
43
|
+
const instance = inject(Y_DATA_TABLE_EXPAND_KEY);
|
|
44
|
+
if (!instance) {
|
|
45
|
+
throw new Error(`Not provided: ${Y_DATA_TABLE_EXPAND_KEY.description}`);
|
|
46
|
+
}
|
|
47
|
+
return instance;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=expand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expand.js","names":["inject","provide","useModelDuplex","propsFactory","pressDataTableExpandProps","enableExpand","Boolean","expanded","type","Array","default","Y_DATA_TABLE_EXPAND_KEY","Symbol","for","provideExpand","props","expands","v","Set","isExpanded","item","value","has","expand","neo","add","delete","toggleExpand","useExpand","instance","Error","description"],"sources":["../../../../src/components/table/composables/expand.ts"],"sourcesContent":["import {\n type InjectionKey,\n type PropType,\n type Ref,\n inject,\n provide,\n} from 'vue';\n\nimport { useModelDuplex } from '@/composables/communication';\nimport { propsFactory } from '@/util/component/props';\n\nimport type { DataTableItem } from '../types/item';\n\nexport const pressDataTableExpandProps = propsFactory(\n {\n enableExpand: Boolean,\n expanded: {\n type: Array as PropType<readonly string[]>,\n default: () => [],\n },\n },\n 'YDataTable--expand',\n);\n\ntype DataTableExpandProps = {\n enableExpand: boolean;\n expanded: readonly string[];\n 'onUpdate:expanded': ((value: any[]) => void) | undefined;\n};\n\nconst Y_DATA_TABLE_EXPAND_KEY: InjectionKey<{\n expands: Ref<Set<string>>;\n isExpanded: (item: DataTableItem) => boolean;\n expand: (item: DataTableItem, value: boolean) => void;\n toggleExpand: (item: DataTableItem) => void;\n}> = Symbol.for('yuyeon.data-table.expand');\n\nexport function provideExpand(props: DataTableExpandProps) {\n const expands = useModelDuplex(\n props,\n 'expanded',\n props.expanded ?? [],\n (v) => new Set(v),\n (v) => [...v],\n );\n\n function isExpanded(item: DataTableItem) {\n return expands.value.has(item.value);\n }\n\n function expand(item: DataTableItem, value: boolean) {\n const neo = new Set(expands.value);\n if (value) {\n neo.add(item.value);\n } else {\n neo.delete(item.value);\n }\n\n expands.value = neo;\n }\n\n function toggleExpand(item: DataTableItem) {\n expand(item, !isExpanded(item));\n }\n\n provide(Y_DATA_TABLE_EXPAND_KEY, {\n expands,\n isExpanded,\n expand,\n toggleExpand,\n });\n\n return {\n expands,\n isExpanded,\n expand,\n toggleExpand,\n };\n}\n\nexport function useExpand() {\n const instance = inject(Y_DATA_TABLE_EXPAND_KEY);\n if (!instance) {\n throw new Error(`Not provided: ${Y_DATA_TABLE_EXPAND_KEY.description}`);\n }\n return instance;\n}\n"],"mappings":"AAAA,SAIEA,MAAM,EACNC,OAAO,QACF,KAAK;AAAC,SAEJC,cAAc;AAAA,SACdC,YAAY;AAIrB,OAAO,MAAMC,yBAAyB,GAAGD,YAAY,CACnD;EACEE,YAAY,EAAEC,OAAO;EACrBC,QAAQ,EAAE;IACRC,IAAI,EAAEC,KAAoC;IAC1CC,OAAO,EAAEA,CAAA,KAAM;EACjB;AACF,CAAC,EACD,oBACF,CAAC;AAQD,MAAMC,uBAKJ,GAAGC,MAAM,CAACC,GAAG,CAAC,0BAA0B,CAAC;AAE3C,OAAO,SAASC,aAAaA,CAACC,KAA2B,EAAE;EACzD,MAAMC,OAAO,GAAGd,cAAc,CAC5Ba,KAAK,EACL,UAAU,EACVA,KAAK,CAACR,QAAQ,IAAI,EAAE,EACnBU,CAAC,IAAK,IAAIC,GAAG,CAACD,CAAC,CAAC,EAChBA,CAAC,IAAK,CAAC,GAAGA,CAAC,CACd,CAAC;EAED,SAASE,UAAUA,CAACC,IAAmB,EAAE;IACvC,OAAOJ,OAAO,CAACK,KAAK,CAACC,GAAG,CAACF,IAAI,CAACC,KAAK,CAAC;EACtC;EAEA,SAASE,MAAMA,CAACH,IAAmB,EAAEC,KAAc,EAAE;IACnD,MAAMG,GAAG,GAAG,IAAIN,GAAG,CAACF,OAAO,CAACK,KAAK,CAAC;IAClC,IAAIA,KAAK,EAAE;MACTG,GAAG,CAACC,GAAG,CAACL,IAAI,CAACC,KAAK,CAAC;IACrB,CAAC,MAAM;MACLG,GAAG,CAACE,MAAM,CAACN,IAAI,CAACC,KAAK,CAAC;IACxB;IAEAL,OAAO,CAACK,KAAK,GAAGG,GAAG;EACrB;EAEA,SAASG,YAAYA,CAACP,IAAmB,EAAE;IACzCG,MAAM,CAACH,IAAI,EAAE,CAACD,UAAU,CAACC,IAAI,CAAC,CAAC;EACjC;EAEAnB,OAAO,CAACU,uBAAuB,EAAE;IAC/BK,OAAO;IACPG,UAAU;IACVI,MAAM;IACNI;EACF,CAAC,CAAC;EAEF,OAAO;IACLX,OAAO;IACPG,UAAU;IACVI,MAAM;IACNI;EACF,CAAC;AACH;AAEA,OAAO,SAASC,SAASA,CAAA,EAAG;EAC1B,MAAMC,QAAQ,GAAG7B,MAAM,CAACW,uBAAuB,CAAC;EAChD,IAAI,CAACkB,QAAQ,EAAE;IACb,MAAM,IAAIC,KAAK,CAAE,iBAAgBnB,uBAAuB,CAACoB,WAAY,EAAC,CAAC;EACzE;EACA,OAAOF,QAAQ;AACjB"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { inject, provide, ref, watchEffect } from 'vue';
|
|
2
|
+
import { getRangeArr } from "../../../util/common.js";
|
|
3
|
+
import { propsFactory } from "../../../util/component/index.js";
|
|
4
|
+
export const pressDataTableHeader = propsFactory({
|
|
5
|
+
headers: {
|
|
6
|
+
type: Array,
|
|
7
|
+
default: () => []
|
|
8
|
+
}
|
|
9
|
+
}, 'YDataTable--header');
|
|
10
|
+
export const Y_DATA_TABLE_HEADER_KEY = Symbol.for('yuyeon.data-table.header');
|
|
11
|
+
export function createHeader(props, options) {
|
|
12
|
+
const headers = ref([]);
|
|
13
|
+
const columns = ref([]);
|
|
14
|
+
watchEffect(() => {
|
|
15
|
+
const rows = props.headers?.length ? [props.headers] : [];
|
|
16
|
+
const flat = rows.flatMap((row, index) => row.map(column => ({
|
|
17
|
+
column,
|
|
18
|
+
rowIndex: index
|
|
19
|
+
})));
|
|
20
|
+
const rowCount = rows.length;
|
|
21
|
+
const defaultHeader = {
|
|
22
|
+
text: '',
|
|
23
|
+
sortable: false
|
|
24
|
+
};
|
|
25
|
+
const defaultActionHeader = {
|
|
26
|
+
...defaultHeader,
|
|
27
|
+
width: 48
|
|
28
|
+
};
|
|
29
|
+
if (options?.enableSelect?.value) {
|
|
30
|
+
const foundIndex = flat.findIndex(_ref => {
|
|
31
|
+
let {
|
|
32
|
+
column
|
|
33
|
+
} = _ref;
|
|
34
|
+
return column.key === 'data-table-select';
|
|
35
|
+
});
|
|
36
|
+
if (foundIndex < 0) {
|
|
37
|
+
const fixed = flat.some(_ref2 => {
|
|
38
|
+
let {
|
|
39
|
+
column
|
|
40
|
+
} = _ref2;
|
|
41
|
+
return column?.fixed === true || column?.fixed === 'left';
|
|
42
|
+
});
|
|
43
|
+
flat.unshift({
|
|
44
|
+
column: {
|
|
45
|
+
...defaultActionHeader,
|
|
46
|
+
key: 'data-table-select',
|
|
47
|
+
rowspan: rowCount,
|
|
48
|
+
fixed
|
|
49
|
+
},
|
|
50
|
+
rowIndex: 0
|
|
51
|
+
});
|
|
52
|
+
} else {
|
|
53
|
+
flat.splice(foundIndex, 1, {
|
|
54
|
+
column: {
|
|
55
|
+
...defaultActionHeader,
|
|
56
|
+
...flat[foundIndex].column
|
|
57
|
+
},
|
|
58
|
+
rowIndex: flat[foundIndex].rowIndex
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const fixedRows = getRangeArr(rowCount).map(() => []);
|
|
63
|
+
const fixedOffsets = getRangeArr(rowCount).fill(0);
|
|
64
|
+
flat.forEach(_ref3 => {
|
|
65
|
+
let {
|
|
66
|
+
column,
|
|
67
|
+
rowIndex
|
|
68
|
+
} = _ref3;
|
|
69
|
+
const {
|
|
70
|
+
key
|
|
71
|
+
} = column;
|
|
72
|
+
for (let i = rowIndex; i <= rowIndex + (column.rowspan ?? 1) - 1; i += 1) {
|
|
73
|
+
fixedRows[i].push({
|
|
74
|
+
...column,
|
|
75
|
+
key,
|
|
76
|
+
fixedOffset: fixedOffsets[i],
|
|
77
|
+
sortable: column.sortable ?? !!key
|
|
78
|
+
});
|
|
79
|
+
fixedOffsets[i] += Number(column.width ?? 0);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
fixedRows.forEach(row => {
|
|
83
|
+
for (let i = row.length - 1; i >= 0; i--) {
|
|
84
|
+
if (row[i].fixed === true || row[i].fixed === 'left') {
|
|
85
|
+
row[i].lastFixed = true;
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// fixed right
|
|
90
|
+
const rightFixed = row.filter(col => col.fixed === 'right');
|
|
91
|
+
let rightOffsets = 0;
|
|
92
|
+
for (let i = rightFixed.length - 1; i >= 0; i--) {
|
|
93
|
+
rightFixed[i].rightOffset = rightOffsets;
|
|
94
|
+
rightOffsets += Number(rightFixed[i].width ?? 0);
|
|
95
|
+
if (i === 0) {
|
|
96
|
+
rightFixed[i].lastFixed = true;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
const seen = new Set();
|
|
101
|
+
headers.value = fixedRows.map(row => {
|
|
102
|
+
const filtered = [];
|
|
103
|
+
for (const column of row) {
|
|
104
|
+
if (!seen.has(column.key)) {
|
|
105
|
+
seen.add(column.key);
|
|
106
|
+
filtered.push(column);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return filtered;
|
|
110
|
+
});
|
|
111
|
+
columns.value = fixedRows[fixedRows.length - 1] || [];
|
|
112
|
+
});
|
|
113
|
+
const data = {
|
|
114
|
+
headers,
|
|
115
|
+
columns
|
|
116
|
+
};
|
|
117
|
+
provide(Y_DATA_TABLE_HEADER_KEY, data);
|
|
118
|
+
return data;
|
|
119
|
+
}
|
|
120
|
+
export function useHeader() {
|
|
121
|
+
const data = inject(Y_DATA_TABLE_HEADER_KEY);
|
|
122
|
+
if (!data) {
|
|
123
|
+
throw new Error(`Not provided: ${Y_DATA_TABLE_HEADER_KEY.description}`);
|
|
124
|
+
}
|
|
125
|
+
return data;
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"header.js","names":["inject","provide","ref","watchEffect","getRangeArr","propsFactory","pressDataTableHeader","headers","type","Array","default","Y_DATA_TABLE_HEADER_KEY","Symbol","for","createHeader","props","options","columns","rows","length","flat","flatMap","row","index","map","column","rowIndex","rowCount","defaultHeader","text","sortable","defaultActionHeader","width","enableSelect","value","foundIndex","findIndex","_ref","key","fixed","some","_ref2","unshift","rowspan","splice","fixedRows","fixedOffsets","fill","forEach","_ref3","i","push","fixedOffset","Number","lastFixed","rightFixed","filter","col","rightOffsets","rightOffset","seen","Set","filtered","has","add","data","useHeader","Error","description"],"sources":["../../../../src/components/table/composables/header.ts"],"sourcesContent":["import {\r\n type DeepReadonly,\r\n type InjectionKey,\r\n type PropType,\r\n type Ref,\r\n inject,\r\n provide,\r\n ref,\r\n watchEffect,\r\n} from 'vue';\r\n\r\nimport { getRangeArr } from '@/util/common';\r\nimport { propsFactory } from '@/util/component';\r\n\r\nimport { type DataTableHeader, type InternalDataTableHeader } from '../types';\r\n\r\nexport const pressDataTableHeader = propsFactory(\r\n {\r\n headers: {\r\n type: Array as PropType<DeepReadonly<DataTableHeader[]>>,\r\n default: () => [],\r\n },\r\n },\r\n 'YDataTable--header',\r\n);\r\n\r\nexport const Y_DATA_TABLE_HEADER_KEY: InjectionKey<{\r\n headers: Ref<InternalDataTableHeader[][]>;\r\n columns: Ref<InternalDataTableHeader[]>;\r\n}> = Symbol.for('yuyeon.data-table.header');\r\n\r\ntype HeaderProps = {\r\n headers: DeepReadonly<DataTableHeader[]> | undefined;\r\n};\r\n\r\nexport function createHeader(\r\n props: HeaderProps,\r\n options?: {\r\n enableSelect?: Ref<boolean>;\r\n },\r\n) {\r\n const headers = ref<InternalDataTableHeader[][]>([]);\r\n const columns = ref<InternalDataTableHeader[]>([]);\r\n\r\n watchEffect(() => {\r\n const rows = props.headers?.length\r\n ? [props.headers as DataTableHeader[]]\r\n : [];\r\n const flat = rows.flatMap((row, index) =>\r\n row.map((column) => ({ column, rowIndex: index })),\r\n );\r\n const rowCount = rows.length;\r\n const defaultHeader = { text: '', sortable: false };\r\n const defaultActionHeader = { ...defaultHeader, width: 48 };\r\n\r\n if (options?.enableSelect?.value) {\r\n const foundIndex = flat.findIndex(\r\n ({ column }) => column.key === 'data-table-select',\r\n );\r\n if (foundIndex < 0) {\r\n const fixed = flat.some(\r\n ({ column }) => column?.fixed === true || column?.fixed === 'left',\r\n );\r\n flat.unshift({\r\n column: {\r\n ...defaultActionHeader,\r\n key: 'data-table-select',\r\n rowspan: rowCount,\r\n fixed,\r\n },\r\n rowIndex: 0,\r\n });\r\n } else {\r\n flat.splice(foundIndex, 1, {\r\n column: {\r\n ...defaultActionHeader,\r\n ...flat[foundIndex].column,\r\n },\r\n rowIndex: flat[foundIndex].rowIndex,\r\n });\r\n }\r\n }\r\n\r\n const fixedRows: InternalDataTableHeader[][] = getRangeArr(rowCount).map(\r\n () => [],\r\n );\r\n const fixedOffsets = getRangeArr(rowCount).fill(0);\r\n\r\n flat.forEach(({ column, rowIndex }) => {\r\n const { key } = column;\r\n for (\r\n let i = rowIndex;\r\n i <= rowIndex + (column.rowspan ?? 1) - 1;\r\n i += 1\r\n ) {\r\n fixedRows[i].push({\r\n ...column,\r\n key,\r\n fixedOffset: fixedOffsets[i],\r\n sortable: column.sortable ?? !!key,\r\n });\r\n fixedOffsets[i] += Number(column.width ?? 0);\r\n }\r\n });\r\n\r\n fixedRows.forEach((row) => {\r\n for (let i = row.length - 1; i >= 0; i--) {\r\n if (row[i].fixed === true || row[i].fixed === 'left') {\r\n row[i].lastFixed = true;\r\n break;\r\n }\r\n }\r\n // fixed right\r\n const rightFixed = row.filter((col) => col.fixed === 'right');\r\n let rightOffsets = 0;\r\n for (let i = rightFixed.length - 1; i >= 0; i--) {\r\n rightFixed[i].rightOffset = rightOffsets;\r\n rightOffsets += Number(rightFixed[i].width ?? 0);\r\n if (i === 0) {\r\n rightFixed[i].lastFixed = true;\r\n }\r\n }\r\n });\r\n\r\n const seen = new Set();\r\n headers.value = fixedRows.map((row) => {\r\n const filtered = [];\r\n for (const column of row) {\r\n if (!seen.has(column.key)) {\r\n seen.add(column.key);\r\n filtered.push(column);\r\n }\r\n }\r\n return filtered;\r\n });\r\n columns.value = (fixedRows[fixedRows.length - 1]) || [];\r\n });\r\n\r\n const data = { headers, columns };\r\n\r\n provide(Y_DATA_TABLE_HEADER_KEY, data);\r\n\r\n return data;\r\n}\r\n\r\nexport function useHeader() {\r\n const data = inject(Y_DATA_TABLE_HEADER_KEY);\r\n if (!data) {\r\n throw new Error(`Not provided: ${Y_DATA_TABLE_HEADER_KEY.description}`);\r\n }\r\n return data;\r\n}\r\n"],"mappings":"AAAA,SAKEA,MAAM,EACNC,OAAO,EACPC,GAAG,EACHC,WAAW,QACN,KAAK;AAAC,SAEJC,WAAW;AAAA,SACXC,YAAY;AAIrB,OAAO,MAAMC,oBAAoB,GAAGD,YAAY,CAC9C;EACEE,OAAO,EAAE;IACPC,IAAI,EAAEC,KAAkD;IACxDC,OAAO,EAAEA,CAAA,KAAM;EACjB;AACF,CAAC,EACD,oBACF,CAAC;AAED,OAAO,MAAMC,uBAGX,GAA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