@vtable-guild/vtable-guild 2.2.1 → 2.3.0
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/core/src/components/Button.mjs +108 -0
- package/dist/core/src/components/Checkbox.mjs +84 -0
- package/dist/core/src/components/Input.mjs +82 -0
- package/dist/core/src/components/Radio.mjs +69 -0
- package/dist/core/src/components/Scrollbar.mjs +179 -0
- package/dist/core/src/components/ScrollbarBar.mjs +103 -0
- package/dist/core/src/components/Tooltip.mjs +321 -0
- package/dist/core/src/components/VTableGuildConfigProvider.mjs +77 -0
- package/dist/core/src/components/VirtualList/Filler.mjs +55 -0
- package/dist/core/src/components/VirtualList/Item.mjs +29 -0
- package/dist/core/src/components/VirtualList/VirtualList.d.ts +12 -0
- package/dist/core/src/components/VirtualList/VirtualList.d.ts.map +1 -1
- package/dist/core/src/components/VirtualList/VirtualList.mjs +373 -0
- package/dist/core/src/components/VirtualList/VirtualList.test.d.ts +2 -0
- package/dist/core/src/components/VirtualList/VirtualList.test.d.ts.map +1 -0
- package/dist/core/src/components/VirtualList/VirtualScrollBar.mjs +216 -0
- package/dist/core/src/components/VirtualList/hooks/useChildren.mjs +21 -0
- package/dist/core/src/components/VirtualList/hooks/useDiffItem.mjs +16 -0
- package/dist/core/src/components/VirtualList/hooks/useFrameWheel.mjs +48 -0
- package/dist/core/src/components/VirtualList/hooks/useGetSize.mjs +25 -0
- package/dist/core/src/components/VirtualList/hooks/useHeights.mjs +56 -0
- package/dist/core/src/components/VirtualList/hooks/useMobileTouchMove.mjs +40 -0
- package/dist/core/src/components/VirtualList/hooks/useOriginScroll.mjs +17 -0
- package/dist/core/src/components/VirtualList/hooks/useScrollDrag.mjs +41 -0
- package/dist/core/src/components/VirtualList/hooks/useScrollTo.mjs +88 -0
- package/dist/core/src/components/VirtualList/utils/CacheMap.mjs +24 -0
- package/dist/core/src/components/VirtualList/utils/algorithmUtil.mjs +22 -0
- package/dist/core/src/components/VirtualList/utils/isFirefox.mjs +4 -0
- package/dist/core/src/components/VirtualList/utils/scrollbarUtil.mjs +7 -0
- package/dist/core/src/composables/useScrollbar.mjs +55 -0
- package/dist/core/src/composables/useTheme.mjs +92 -0
- package/dist/core/src/index.d.ts +1 -0
- package/dist/core/src/index.d.ts.map +1 -1
- package/dist/core/src/plugin/index.mjs +27 -0
- package/dist/core/src/utils/classPrefix.mjs +100 -0
- package/dist/core/src/utils/devWarn.d.ts +4 -0
- package/dist/core/src/utils/devWarn.d.ts.map +1 -0
- package/dist/core/src/utils/devWarn.mjs +5 -0
- package/dist/core/src/utils/mergeDeep.mjs +20 -0
- package/dist/core/src/utils/props.mjs +33 -0
- package/dist/core/src/utils/tv.mjs +19 -0
- package/dist/icons/src/AntdvEmptyIcon.mjs +37 -0
- package/dist/icons/src/AntdvSpinIndicator.mjs +23 -0
- package/dist/icons/src/CaretDownIcon.d.ts.map +1 -1
- package/dist/icons/src/CaretDownIcon.mjs +9 -0
- package/dist/icons/src/CaretRightIcon.d.ts.map +1 -1
- package/dist/icons/src/CaretUpIcon.d.ts.map +1 -1
- package/dist/icons/src/CaretUpIcon.mjs +9 -0
- package/dist/icons/src/DownOutlinedIcon.d.ts.map +1 -1
- package/dist/icons/src/DownOutlinedIcon.mjs +9 -0
- package/dist/icons/src/ElArrowDownIcon.d.ts.map +1 -1
- package/dist/icons/src/ElArrowDownIcon.mjs +9 -0
- package/dist/icons/src/ElCaretBottomIcon.d.ts.map +1 -1
- package/dist/icons/src/ElCaretBottomIcon.mjs +9 -0
- package/dist/icons/src/ElCaretTopIcon.d.ts.map +1 -1
- package/dist/icons/src/ElCaretTopIcon.mjs +9 -0
- package/dist/icons/src/ElFilterIcon.d.ts.map +1 -1
- package/dist/icons/src/ElLoadingIcon.mjs +28 -0
- package/dist/icons/src/FilterFilledIcon.d.ts.map +1 -1
- package/dist/icons/src/FilterFilledIcon.mjs +9 -0
- package/dist/icons/src/SearchIcon.d.ts.map +1 -1
- package/dist/icons/src/SearchIcon.mjs +9 -0
- package/dist/icons/src/createSvgIcon.d.ts +13 -0
- package/dist/icons/src/createSvgIcon.d.ts.map +1 -0
- package/dist/icons/src/createSvgIcon.mjs +23 -0
- package/dist/index.mjs +82 -10141
- package/dist/table/src/components/ColGroup.mjs +25 -0
- package/dist/table/src/components/ExpandIcon.mjs +60 -0
- package/dist/table/src/components/FilterDropdown.d.ts.map +1 -1
- package/dist/table/src/components/FilterDropdown.mjs +324 -0
- package/dist/table/src/components/FilterIcon.mjs +30 -0
- package/dist/table/src/components/ResizeHandle.mjs +28 -0
- package/dist/table/src/components/SelectionCheckbox.mjs +33 -0
- package/dist/table/src/components/SelectionDropdown.d.ts.map +1 -1
- package/dist/table/src/components/SelectionDropdown.mjs +73 -0
- package/dist/table/src/components/SelectionRadio.mjs +28 -0
- package/dist/table/src/components/SortButton.mjs +30 -0
- package/dist/table/src/components/Table.d.ts.map +1 -1
- package/dist/table/src/components/Table.mjs +781 -0
- package/dist/table/src/components/TableBody.mjs +124 -0
- package/dist/table/src/components/TableCell.d.ts.map +1 -1
- package/dist/table/src/components/TableCell.mjs +222 -0
- package/dist/table/src/components/TableEmpty.mjs +38 -0
- package/dist/table/src/components/TableHeader.mjs +51 -0
- package/dist/table/src/components/TableHeaderCell.d.ts.map +1 -1
- package/dist/table/src/components/TableHeaderCell.mjs +391 -0
- package/dist/table/src/components/TableLoading.mjs +46 -0
- package/dist/table/src/components/TableRow.mjs +34 -0
- package/dist/table/src/components/VTable.vue.d.ts.map +1 -1
- package/dist/table/src/components/VTable.vue.mjs +155 -0
- package/dist/table/src/components/VTable.vue2.mjs +4 -0
- package/dist/table/src/components/VTableSummary.mjs +29 -0
- package/dist/table/src/components/VTableSummaryCell.d.ts.map +1 -1
- package/dist/table/src/components/VTableSummaryCell.mjs +68 -0
- package/dist/table/src/components/VTableSummaryRow.mjs +19 -0
- package/dist/table/src/components/VirtualTableBody.d.ts.map +1 -1
- package/dist/table/src/components/VirtualTableBody.mjs +172 -0
- package/dist/table/src/composables/bench-fixtures.d.ts +28 -0
- package/dist/table/src/composables/bench-fixtures.d.ts.map +1 -0
- package/dist/table/src/composables/index.d.ts +2 -1
- package/dist/table/src/composables/index.d.ts.map +1 -1
- package/dist/table/src/composables/useColumns.d.ts +6 -1
- package/dist/table/src/composables/useColumns.d.ts.map +1 -1
- package/dist/table/src/composables/useColumns.mjs +81 -0
- package/dist/table/src/composables/useControlledColumnState.d.ts +24 -0
- package/dist/table/src/composables/useControlledColumnState.d.ts.map +1 -0
- package/dist/table/src/composables/useControlledColumnState.mjs +23 -0
- package/dist/table/src/composables/useExpand.mjs +37 -0
- package/dist/table/src/composables/useFilter.bench.d.ts +2 -0
- package/dist/table/src/composables/useFilter.bench.d.ts.map +1 -0
- package/dist/table/src/composables/useFilter.d.ts.map +1 -1
- package/dist/table/src/composables/useFilter.mjs +68 -0
- package/dist/table/src/composables/useFixedColumnStyle.d.ts +18 -0
- package/dist/table/src/composables/useFixedColumnStyle.d.ts.map +1 -0
- package/dist/table/src/composables/useFixedColumnStyle.mjs +21 -0
- package/dist/table/src/composables/useHoverState.mjs +26 -0
- package/dist/table/src/composables/useResize.mjs +42 -0
- package/dist/table/src/composables/useScroll.d.ts +5 -4
- package/dist/table/src/composables/useScroll.d.ts.map +1 -1
- package/dist/table/src/composables/useScroll.mjs +68 -0
- package/dist/table/src/composables/useSelection.bench.d.ts +2 -0
- package/dist/table/src/composables/useSelection.bench.d.ts.map +1 -0
- package/dist/table/src/composables/useSelection.d.ts.map +1 -1
- package/dist/table/src/composables/useSelection.mjs +246 -0
- package/dist/table/src/composables/useSorter.bench.d.ts +2 -0
- package/dist/table/src/composables/useSorter.bench.d.ts.map +1 -0
- package/dist/table/src/composables/useSorter.d.ts +1 -5
- package/dist/table/src/composables/useSorter.d.ts.map +1 -1
- package/dist/table/src/composables/useSorter.mjs +161 -0
- package/dist/table/src/composables/useTreeData.bench.d.ts +2 -0
- package/dist/table/src/composables/useTreeData.bench.d.ts.map +1 -0
- package/dist/table/src/composables/useTreeData.d.ts +2 -0
- package/dist/table/src/composables/useTreeData.d.ts.map +1 -1
- package/dist/table/src/composables/useTreeData.mjs +92 -0
- package/dist/table/src/composables/useVirtual.mjs +19 -0
- package/dist/table/src/constants.mjs +8 -0
- package/dist/table/src/context.d.ts +90 -85
- package/dist/table/src/context.d.ts.map +1 -1
- package/dist/table/src/context.mjs +4 -0
- package/dist/table/src/index.d.ts.map +1 -1
- package/dist/table/src/index.mjs +23 -0
- package/dist/table/src/preset-config.mjs +35 -0
- package/dist/table/src/utils/cell.mjs +79 -0
- package/dist/table/src/utils/popupPosition.d.ts +20 -0
- package/dist/table/src/utils/popupPosition.d.ts.map +1 -0
- package/dist/table/src/utils/popupPosition.mjs +24 -0
- package/dist/table/src/utils/popupPosition.test.d.ts +2 -0
- package/dist/table/src/utils/popupPosition.test.d.ts.map +1 -0
- package/dist/table/src/utils/vnode.mjs +10 -0
- package/dist/theme/src/presets/antdv/button.mjs +70 -0
- package/dist/theme/src/presets/antdv/checkbox.mjs +51 -0
- package/dist/theme/src/presets/antdv/input.mjs +40 -0
- package/dist/theme/src/presets/antdv/radio.mjs +34 -0
- package/dist/theme/src/presets/antdv/scrollbar.mjs +22 -0
- package/dist/theme/src/presets/antdv/table-locale.mjs +55 -0
- package/dist/theme/src/presets/antdv/table.mjs +285 -0
- package/dist/theme/src/presets/antdv/tooltip.mjs +20 -0
- package/dist/theme/src/presets/element-plus/button.mjs +70 -0
- package/dist/theme/src/presets/element-plus/checkbox.mjs +65 -0
- package/dist/theme/src/presets/element-plus/input.mjs +39 -0
- package/dist/theme/src/presets/element-plus/radio.mjs +34 -0
- package/dist/theme/src/presets/element-plus/scrollbar.mjs +22 -0
- package/dist/theme/src/presets/element-plus/table-locale.mjs +56 -0
- package/dist/theme/src/presets/element-plus/table.mjs +235 -0
- package/dist/theme/src/presets/element-plus/tooltip.mjs +21 -0
- package/dist/theme/src/presets/index.mjs +92 -0
- package/package.json +5 -2
- package/dist/index.cjs +0 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { defineComponent as c, inject as f, computed as u, createVNode as S } from "vue";
|
|
2
|
+
import "../../../core/src/utils/tv.mjs";
|
|
3
|
+
import { TABLE_CONTEXT_KEY as y } from "../context.mjs";
|
|
4
|
+
import { getColumnKey as p } from "../composables/useColumns.mjs";
|
|
5
|
+
import { useFixedColumnStyle as x } from "../composables/useFixedColumnStyle.mjs";
|
|
6
|
+
import { TABLE_ALIGN_CLASSES as C } from "../../../theme/src/presets/antdv/table.mjs";
|
|
7
|
+
import { cn as b } from "tailwind-variants";
|
|
8
|
+
const _ = /* @__PURE__ */ c({
|
|
9
|
+
name: "VTableSummaryCell",
|
|
10
|
+
props: {
|
|
11
|
+
index: {
|
|
12
|
+
type: Number,
|
|
13
|
+
required: !0
|
|
14
|
+
},
|
|
15
|
+
colSpan: {
|
|
16
|
+
type: Number,
|
|
17
|
+
default: 1
|
|
18
|
+
},
|
|
19
|
+
rowSpan: {
|
|
20
|
+
type: Number,
|
|
21
|
+
default: void 0
|
|
22
|
+
},
|
|
23
|
+
align: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: void 0
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
setup(n, {
|
|
29
|
+
slots: i
|
|
30
|
+
}) {
|
|
31
|
+
const l = f(y, {}), r = u(() => {
|
|
32
|
+
const t = l.displayColumns?.value;
|
|
33
|
+
if (!t) return null;
|
|
34
|
+
const e = t[n.index];
|
|
35
|
+
if (!e?.fixed) return null;
|
|
36
|
+
const o = p(e) ?? n.index;
|
|
37
|
+
return l.fixedOffsets?.value?.get(o) ?? null;
|
|
38
|
+
}), {
|
|
39
|
+
fixedStyle: a,
|
|
40
|
+
fixedClass: d
|
|
41
|
+
} = x({
|
|
42
|
+
fixedInfo: () => r.value
|
|
43
|
+
}), s = u(() => {
|
|
44
|
+
const t = l.subThemeSlots, e = n.align ? C[n.align] : "";
|
|
45
|
+
return b(t?.summaryCell() ?? "", e, d.value);
|
|
46
|
+
}), m = u(() => {
|
|
47
|
+
const t = l.displayColumns?.value;
|
|
48
|
+
if (!t) return a.value;
|
|
49
|
+
const e = t[n.index], o = {};
|
|
50
|
+
return e?.width && (o.width = typeof e.width == "number" ? `${e.width}px` : String(e.width)), {
|
|
51
|
+
...o,
|
|
52
|
+
...a.value ?? {}
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
return () => {
|
|
56
|
+
const t = n.colSpan !== 1 ? n.colSpan : void 0, e = n.rowSpan !== 1 ? n.rowSpan : void 0;
|
|
57
|
+
return S("td", {
|
|
58
|
+
class: s.value,
|
|
59
|
+
style: m.value,
|
|
60
|
+
colspan: t,
|
|
61
|
+
rowspan: e
|
|
62
|
+
}, [i.default?.()]);
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
export {
|
|
67
|
+
_ as default
|
|
68
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { defineComponent as r, inject as m, createVNode as a } from "vue";
|
|
2
|
+
import { TABLE_CONTEXT_KEY as s } from "../context.mjs";
|
|
3
|
+
const p = /* @__PURE__ */ r({
|
|
4
|
+
name: "VTableSummaryRow",
|
|
5
|
+
setup(n, {
|
|
6
|
+
slots: e
|
|
7
|
+
}) {
|
|
8
|
+
const t = m(s, {});
|
|
9
|
+
return () => {
|
|
10
|
+
const o = t.subThemeSlots;
|
|
11
|
+
return a("tr", {
|
|
12
|
+
class: o?.summaryRow() ?? ""
|
|
13
|
+
}, [e.default?.()]);
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
export {
|
|
18
|
+
p as default
|
|
19
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualTableBody.d.ts","sourceRoot":"","sources":["../../../../../table/src/components/VirtualTableBody.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAiB,QAAQ,EAAE,MAAM,KAAK,CAAA;AAElD,OAAO,KAAK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AAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;;;;cAEhC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,GAAG,CAAC,CAAC;;;;;;;;;;;IAK3F,gEAAgE;;cAE5C,QAAQ,CAAC,CAAC,IAAI,EAAE,sBAAsB,KAAK,IAAI,CAAC;;;;cAIvC,QAAQ,CAAC,OAAO,GAAG,UAAU,GAAG,OAAO,CAAC;;;;;4BAJjC,sBAAsB,KAAK,IAAI;+BAPT,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,GAAG;;;AAb7F,wBAqME"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { defineComponent as q, inject as T, ref as k, computed as B, watch as V, createVNode as l, isVNode as v } from "vue";
|
|
2
|
+
import "../../../core/src/utils/tv.mjs";
|
|
3
|
+
import I from "./TableRow.mjs";
|
|
4
|
+
import j from "./TableCell.mjs";
|
|
5
|
+
import H from "./TableEmpty.mjs";
|
|
6
|
+
import C from "./ColGroup.mjs";
|
|
7
|
+
import { TABLE_CONTEXT_KEY as O } from "../context.mjs";
|
|
8
|
+
import L from "../../../core/src/components/VirtualList/VirtualList.mjs";
|
|
9
|
+
import { cn as c } from "tailwind-variants";
|
|
10
|
+
function _(e) {
|
|
11
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !v(e);
|
|
12
|
+
}
|
|
13
|
+
const D = /* @__PURE__ */ q({
|
|
14
|
+
name: "VirtualTableBody",
|
|
15
|
+
props: {
|
|
16
|
+
dataSource: {
|
|
17
|
+
type: Array,
|
|
18
|
+
required: !0
|
|
19
|
+
},
|
|
20
|
+
columns: {
|
|
21
|
+
type: Array,
|
|
22
|
+
required: !0
|
|
23
|
+
},
|
|
24
|
+
tbodyClass: {
|
|
25
|
+
type: String,
|
|
26
|
+
required: !0
|
|
27
|
+
},
|
|
28
|
+
rowClass: {
|
|
29
|
+
type: String,
|
|
30
|
+
required: !0
|
|
31
|
+
},
|
|
32
|
+
tdClass: {
|
|
33
|
+
type: String,
|
|
34
|
+
required: !0
|
|
35
|
+
},
|
|
36
|
+
emptyClass: {
|
|
37
|
+
type: String,
|
|
38
|
+
required: !0
|
|
39
|
+
},
|
|
40
|
+
bodyCellEllipsisClass: {
|
|
41
|
+
type: String,
|
|
42
|
+
required: !0
|
|
43
|
+
},
|
|
44
|
+
tableClass: {
|
|
45
|
+
type: String,
|
|
46
|
+
required: !0
|
|
47
|
+
},
|
|
48
|
+
tableStyle: {
|
|
49
|
+
type: Object,
|
|
50
|
+
default: void 0
|
|
51
|
+
},
|
|
52
|
+
rowKey: {
|
|
53
|
+
type: [String, Function],
|
|
54
|
+
default: void 0
|
|
55
|
+
},
|
|
56
|
+
height: {
|
|
57
|
+
type: Number,
|
|
58
|
+
required: !0
|
|
59
|
+
},
|
|
60
|
+
itemHeight: {
|
|
61
|
+
type: Number,
|
|
62
|
+
required: !0
|
|
63
|
+
},
|
|
64
|
+
/** Sync header scroll when virtual body scrolls horizontally */
|
|
65
|
+
onVirtualScroll: {
|
|
66
|
+
type: Function,
|
|
67
|
+
default: void 0
|
|
68
|
+
},
|
|
69
|
+
showScrollBar: {
|
|
70
|
+
type: [Boolean, String],
|
|
71
|
+
default: "hover"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
setup(e) {
|
|
75
|
+
const n = T(O, {}), d = k();
|
|
76
|
+
function y(t) {
|
|
77
|
+
e.onVirtualScroll?.({
|
|
78
|
+
...t,
|
|
79
|
+
maxX: d.value?.getHorizontalRange() ?? 0
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function m(t, o) {
|
|
83
|
+
return typeof e.rowKey == "function" ? e.rowKey(t) : typeof e.rowKey == "string" && e.rowKey in t ? t[e.rowKey] : o;
|
|
84
|
+
}
|
|
85
|
+
function b(t) {
|
|
86
|
+
return typeof e.rowKey == "function" ? e.rowKey(t) : typeof e.rowKey == "string" && e.rowKey in t ? t[e.rowKey] : e.dataSource.indexOf(t);
|
|
87
|
+
}
|
|
88
|
+
const g = B(() => {
|
|
89
|
+
let t = 0;
|
|
90
|
+
for (const o of e.columns) {
|
|
91
|
+
const s = typeof o.width == "number" ? o.width : parseInt(String(o.width || "0"), 10);
|
|
92
|
+
t += s || 0;
|
|
93
|
+
}
|
|
94
|
+
return t;
|
|
95
|
+
});
|
|
96
|
+
return V(() => d.value, (t) => {
|
|
97
|
+
if (t) {
|
|
98
|
+
const o = t.getScrollInfo();
|
|
99
|
+
y(o);
|
|
100
|
+
}
|
|
101
|
+
}), () => e.dataSource.length === 0 ? l("table", {
|
|
102
|
+
class: e.tableClass,
|
|
103
|
+
style: e.tableStyle
|
|
104
|
+
}, [l(C, {
|
|
105
|
+
columns: e.columns
|
|
106
|
+
}, null), l("tbody", {
|
|
107
|
+
class: e.tbodyClass
|
|
108
|
+
}, [l(H, {
|
|
109
|
+
colSpan: e.columns.length || 1,
|
|
110
|
+
emptyClass: e.emptyClass,
|
|
111
|
+
tdClass: e.tdClass
|
|
112
|
+
}, null)])]) : l(L, {
|
|
113
|
+
ref: d,
|
|
114
|
+
data: e.dataSource,
|
|
115
|
+
height: e.height,
|
|
116
|
+
itemHeight: e.itemHeight,
|
|
117
|
+
itemKey: b,
|
|
118
|
+
scrollWidth: g.value || void 0,
|
|
119
|
+
fullHeight: !1,
|
|
120
|
+
onVirtualScroll: y,
|
|
121
|
+
showScrollBar: e.showScrollBar,
|
|
122
|
+
style: {
|
|
123
|
+
overflow: "hidden"
|
|
124
|
+
}
|
|
125
|
+
}, {
|
|
126
|
+
default: ({
|
|
127
|
+
item: t,
|
|
128
|
+
index: o
|
|
129
|
+
}) => {
|
|
130
|
+
let s;
|
|
131
|
+
const a = o, i = m(t, a), r = n.expandable?.(), S = n.isExpanded?.(i) ?? !1, h = r?.expandRowByClick ?? !1, x = n.isRowExpandable?.(t) ?? !1, f = n.getRowClassName?.(t, a), R = n.getRowProps?.(t, a), K = n.getFlattenRow?.(t)?.level ?? 0, E = typeof r?.expandedRowClassName == "function" ? r.expandedRowClassName(t, a, K) : r?.expandedRowClassName, N = h ? () => {
|
|
132
|
+
x && n.toggleExpand?.(t, a);
|
|
133
|
+
} : void 0;
|
|
134
|
+
return l("table", {
|
|
135
|
+
class: e.tableClass,
|
|
136
|
+
style: {
|
|
137
|
+
...e.tableStyle,
|
|
138
|
+
tableLayout: "fixed"
|
|
139
|
+
}
|
|
140
|
+
}, [l(C, {
|
|
141
|
+
columns: e.columns
|
|
142
|
+
}, null), l("tbody", {
|
|
143
|
+
class: e.tbodyClass
|
|
144
|
+
}, [l(I, {
|
|
145
|
+
key: i,
|
|
146
|
+
rowClass: c(e.rowClass, f) ?? "",
|
|
147
|
+
rowProps: R,
|
|
148
|
+
onClick: N
|
|
149
|
+
}, _(s = e.columns.map((u, w) => l(j, {
|
|
150
|
+
key: u.key ?? String(u.dataIndex ?? w),
|
|
151
|
+
record: t,
|
|
152
|
+
rowIndex: a,
|
|
153
|
+
column: u,
|
|
154
|
+
colIndex: w,
|
|
155
|
+
tdClass: e.tdClass,
|
|
156
|
+
bodyCellEllipsisClass: e.bodyCellEllipsisClass
|
|
157
|
+
}, null))) ? s : {
|
|
158
|
+
default: () => [s]
|
|
159
|
+
}), S && r?.expandedRowRender && l("tr", {
|
|
160
|
+
key: `${i}-expanded`,
|
|
161
|
+
class: c(e.rowClass, f, n.subThemeSlots?.expandedRow(), E)
|
|
162
|
+
}, [l("td", {
|
|
163
|
+
colspan: e.columns.length,
|
|
164
|
+
class: c(e.tdClass, n.subThemeSlots?.expandedRowCell())
|
|
165
|
+
}, [r.expandedRowRender(t, a, 0, !0)])])])]);
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
export {
|
|
171
|
+
D as default
|
|
172
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Key } from '../types';
|
|
2
|
+
export interface BenchRow extends Record<string, unknown> {
|
|
3
|
+
key: number;
|
|
4
|
+
name: string;
|
|
5
|
+
age: number;
|
|
6
|
+
score: number;
|
|
7
|
+
status: 'active' | 'paused' | 'archived';
|
|
8
|
+
city: string;
|
|
9
|
+
}
|
|
10
|
+
export interface BenchTreeRow extends Record<string, unknown> {
|
|
11
|
+
key: string;
|
|
12
|
+
name: string;
|
|
13
|
+
age: number;
|
|
14
|
+
status: 'active' | 'paused';
|
|
15
|
+
children?: BenchTreeRow[];
|
|
16
|
+
}
|
|
17
|
+
/** 生成平铺行数据,age/score/status/city 经散列打散。 */
|
|
18
|
+
export declare function makeRows(count: number): BenchRow[];
|
|
19
|
+
/**
|
|
20
|
+
* 生成两层树形数据:roots 个根,每根 childrenPer 个子节点。
|
|
21
|
+
* 总节点数 = roots * (1 + childrenPer),所有 key 全局唯一。
|
|
22
|
+
*/
|
|
23
|
+
export declare function makeTree(roots: number, childrenPer: number): BenchTreeRow[];
|
|
24
|
+
/** 收集树中所有节点的 key(DFS 顺序)。 */
|
|
25
|
+
export declare function collectKeys(tree: BenchTreeRow[]): Key[];
|
|
26
|
+
/** 把树展平成记录列表(DFS 顺序),用于逐行调用基准。 */
|
|
27
|
+
export declare function flattenRecords(tree: BenchTreeRow[]): BenchTreeRow[];
|
|
28
|
+
//# sourceMappingURL=bench-fixtures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bench-fixtures.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/bench-fixtures.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAEnC,MAAM,WAAW,QAAS,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACvD,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAA;IACxC,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,YAAa,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC3D,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,QAAQ,GAAG,QAAQ,CAAA;IAC3B,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAA;CAC1B;AAaD,2CAA2C;AAC3C,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,EAAE,CAalD;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,YAAY,EAAE,CAqB3E;AAED,6BAA6B;AAC7B,wBAAgB,WAAW,CAAC,IAAI,EAAE,YAAY,EAAE,GAAG,GAAG,EAAE,CAUvD;AAED,kCAAkC;AAClC,wBAAgB,cAAc,CAAC,IAAI,EAAE,YAAY,EAAE,GAAG,YAAY,EAAE,CAUnE"}
|
|
@@ -6,7 +6,8 @@ export type { FiltersRecord } from './useFilter';
|
|
|
6
6
|
export { useSelection } from './useSelection';
|
|
7
7
|
export type { SelectionState } from './useSelection';
|
|
8
8
|
export { useScroll } from './useScroll';
|
|
9
|
-
export type { ScrollConfig, FixedOffset } from './useScroll';
|
|
9
|
+
export type { ScrollConfig, FixedOffset, ScrollEdgeState } from './useScroll';
|
|
10
|
+
export { useFixedColumnStyle } from './useFixedColumnStyle';
|
|
10
11
|
export { useExpand } from './useExpand';
|
|
11
12
|
export { useResize } from './useResize';
|
|
12
13
|
export { useHoverState, isInHoverRange } from './useHoverState';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAEzD,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C/D,YAAY,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ColumnGroupType, ColumnType, ColumnsType, DataIndex } from '../types';
|
|
1
|
+
import { ColumnGroupType, ColumnType, ColumnsType, DataIndex, Key } from '../types';
|
|
2
2
|
export type ColumnNode<TRecord extends Record<string, unknown>> = ColumnType<TRecord> | ColumnGroupType<TRecord>;
|
|
3
3
|
export interface HeaderCellMeta<TRecord extends Record<string, unknown>> {
|
|
4
4
|
column: ColumnNode<TRecord>;
|
|
@@ -12,6 +12,11 @@ export interface HeaderCellMeta<TRecord extends Record<string, unknown>> {
|
|
|
12
12
|
}
|
|
13
13
|
export type HeaderRowMeta<TRecord extends Record<string, unknown>> = HeaderCellMeta<TRecord>[];
|
|
14
14
|
export declare function isColumnGroup<TRecord extends Record<string, unknown>>(column: ColumnNode<TRecord>): column is ColumnGroupType<TRecord>;
|
|
15
|
+
/**
|
|
16
|
+
* 获取列的唯一标识。
|
|
17
|
+
* 优先使用 key,其次 dataIndex 转字符串。
|
|
18
|
+
*/
|
|
19
|
+
export declare function getColumnKey<TRecord extends Record<string, unknown>>(column: ColumnType<TRecord>): Key | undefined;
|
|
15
20
|
/**
|
|
16
21
|
* 根据 dataIndex 路径从 record 中取值。
|
|
17
22
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useColumns.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useColumns.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"useColumns.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useColumns.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAExF,MAAM,MA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EASpC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { computed as d } from "vue";
|
|
2
|
+
function h(r) {
|
|
3
|
+
return !!r && typeof r == "object" && "children" in r && Array.isArray(r.children);
|
|
4
|
+
}
|
|
5
|
+
function A(r) {
|
|
6
|
+
if (r.key !== void 0) return r.key;
|
|
7
|
+
if (r.dataIndex !== void 0)
|
|
8
|
+
return Array.isArray(r.dataIndex) ? r.dataIndex.join(".") : String(r.dataIndex);
|
|
9
|
+
}
|
|
10
|
+
function C(r) {
|
|
11
|
+
const n = [];
|
|
12
|
+
for (const t of r)
|
|
13
|
+
if (typeof t != "symbol") {
|
|
14
|
+
if (h(t)) {
|
|
15
|
+
n.push(...C(t.children));
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
n.push(t);
|
|
19
|
+
}
|
|
20
|
+
return n;
|
|
21
|
+
}
|
|
22
|
+
function g(r) {
|
|
23
|
+
const n = [];
|
|
24
|
+
function t(s, l, e = 0) {
|
|
25
|
+
n[e] = n[e] || [];
|
|
26
|
+
let a = l;
|
|
27
|
+
return s.filter(
|
|
28
|
+
(o) => !!o && typeof o != "symbol"
|
|
29
|
+
).map((o) => {
|
|
30
|
+
const u = !h(o) || o.children.length === 0;
|
|
31
|
+
let c = u ? [o] : [], f = 1;
|
|
32
|
+
if (!u) {
|
|
33
|
+
const y = t(o.children, a, e + 1);
|
|
34
|
+
c = y.flatMap((p) => p.leafColumns), f = y.reduce((p, S) => p + S.colSpan, 0);
|
|
35
|
+
}
|
|
36
|
+
return "colSpan" in o && typeof o.colSpan == "number" && (f = o.colSpan), n[e].push({
|
|
37
|
+
column: o,
|
|
38
|
+
colSpan: f,
|
|
39
|
+
rowSpan: 1,
|
|
40
|
+
colStart: a,
|
|
41
|
+
colEnd: a + Math.max(f, 1) - 1,
|
|
42
|
+
depth: e,
|
|
43
|
+
isLeaf: u,
|
|
44
|
+
leafColumns: c
|
|
45
|
+
}), a += f, {
|
|
46
|
+
colSpan: f,
|
|
47
|
+
leafColumns: c
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
t(r, 0);
|
|
52
|
+
const i = n.length;
|
|
53
|
+
return n.forEach((s, l) => {
|
|
54
|
+
s.forEach((e) => {
|
|
55
|
+
e.isLeaf && (e.rowSpan = i - l);
|
|
56
|
+
});
|
|
57
|
+
}), n;
|
|
58
|
+
}
|
|
59
|
+
function b(r, n) {
|
|
60
|
+
if (n == null || n === "") return;
|
|
61
|
+
const t = Array.isArray(n) ? n : [n];
|
|
62
|
+
let i = r;
|
|
63
|
+
for (const s of t) {
|
|
64
|
+
if (i == null) return;
|
|
65
|
+
i = i[String(s)];
|
|
66
|
+
}
|
|
67
|
+
return i;
|
|
68
|
+
}
|
|
69
|
+
function E(r) {
|
|
70
|
+
const n = d(() => C(r())), t = d(() => g(r()));
|
|
71
|
+
return {
|
|
72
|
+
leafColumns: n,
|
|
73
|
+
headerRows: t
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
export {
|
|
77
|
+
b as getByDataIndex,
|
|
78
|
+
A as getColumnKey,
|
|
79
|
+
h as isColumnGroup,
|
|
80
|
+
E as useColumns
|
|
81
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ColumnType } from '../types';
|
|
2
|
+
export interface UseControlledColumnStateOptions<TValue, TRecord extends Record<string, unknown>> {
|
|
3
|
+
/**
|
|
4
|
+
* 从列配置读取受控值;返回 undefined 表示该列处于非受控模式。
|
|
5
|
+
* 返回 null 表示"受控但为空"(如 filteredValue: null),读取时落到 fallback。
|
|
6
|
+
*/
|
|
7
|
+
controlledValue: (column: ColumnType<TRecord>) => TValue | null | undefined;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 按列 keyed 的受控/非受控状态原语(useSorter / useFilter 共享)。
|
|
11
|
+
*
|
|
12
|
+
* - 受控列(列配置上的受控字段 !== undefined):读列配置,写入被忽略
|
|
13
|
+
* - 非受控列:读写内部 reactive record(columnKey → value)
|
|
14
|
+
*
|
|
15
|
+
* 各消费方保留自己的初始化(defaultSortOrder / defaultFilteredValue)
|
|
16
|
+
* 与批量清理逻辑,直接操作暴露出的 innerState。
|
|
17
|
+
*/
|
|
18
|
+
export declare function useControlledColumnState<TValue, TRecord extends Record<string, unknown> = Record<string, unknown>>(options: UseControlledColumnStateOptions<TValue, TRecord>): {
|
|
19
|
+
innerState: Record<string, TValue>;
|
|
20
|
+
isControlled: (column: ColumnType<TRecord>) => boolean;
|
|
21
|
+
readValue: <F extends TValue | null>(column: ColumnType<TRecord>, fallback: F) => TValue | F;
|
|
22
|
+
writeValue: (column: ColumnType<TRecord>, value: TValue | undefined) => void;
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=useControlledColumnState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useControlledColumnState.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useControlledColumnState.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAG1C,MAAM,WAAW,+BAA+B,CAAC,MAAM,EAAE,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC9F;;;OAGG;IACH,eAAe,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,KAAK,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;CAC5E;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EACN,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjE,OAAO,EAAE,+BAA+B,CAAC,MAAM,EAAE,OAAO,CAAC;;2BAG3B,UAAU,CAAC,OAAO,CAAC,KAAG,OAAO;gBAIxC,CAAC,SAAS,MAAM,GAAG,IAAI,UAChC,UAAU,CAAC,OAAO,CAAC,YACjB,CAAC,KACV,MAAM,GAAG,CAAC;yBAUe,UAAU,CAAC,OAAO,CAAC,SAAS,MAAM,GAAG,SAAS,KAAG,IAAI;EAYlF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { reactive as l } from "vue";
|
|
2
|
+
import { getColumnKey as u } from "./useColumns.mjs";
|
|
3
|
+
function S(o) {
|
|
4
|
+
const n = l({});
|
|
5
|
+
function i(e) {
|
|
6
|
+
return o.controlledValue(e) !== void 0;
|
|
7
|
+
}
|
|
8
|
+
function d(e, t) {
|
|
9
|
+
if (i(e))
|
|
10
|
+
return o.controlledValue(e) ?? t;
|
|
11
|
+
const r = u(e);
|
|
12
|
+
return r === void 0 ? t : n[String(r)] ?? t;
|
|
13
|
+
}
|
|
14
|
+
function f(e, t) {
|
|
15
|
+
if (i(e)) return;
|
|
16
|
+
const r = u(e);
|
|
17
|
+
r !== void 0 && (t === void 0 ? delete n[String(r)] : n[String(r)] = t);
|
|
18
|
+
}
|
|
19
|
+
return { innerState: n, isControlled: i, readValue: d, writeValue: f };
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
S as useControlledColumnState
|
|
23
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ref as v, watch as w, computed as i } from "vue";
|
|
2
|
+
function K(a) {
|
|
3
|
+
const n = v([]);
|
|
4
|
+
let f = !1;
|
|
5
|
+
w(
|
|
6
|
+
() => a.expandable(),
|
|
7
|
+
(e) => {
|
|
8
|
+
f || !e || (f = !0, e.defaultExpandAllRows ? n.value = a.data().map((t, d) => a.getRowKey(t, d)) : e.defaultExpandedRowKeys && (n.value = [...e.defaultExpandedRowKeys]));
|
|
9
|
+
},
|
|
10
|
+
{ immediate: !0 }
|
|
11
|
+
);
|
|
12
|
+
const o = i(() => a.expandable()?.expandedRowKeys !== void 0), u = i(() => {
|
|
13
|
+
const e = a.expandable();
|
|
14
|
+
if (!e) return /* @__PURE__ */ new Set();
|
|
15
|
+
const t = o.value ? e.expandedRowKeys : n.value;
|
|
16
|
+
return new Set(t);
|
|
17
|
+
});
|
|
18
|
+
function x(e) {
|
|
19
|
+
return u.value.has(e);
|
|
20
|
+
}
|
|
21
|
+
function p(e, t) {
|
|
22
|
+
const d = a.expandable();
|
|
23
|
+
if (!d) return;
|
|
24
|
+
const l = a.getRowKey(e, t), r = !x(l);
|
|
25
|
+
o.value || (r ? n.value = [...n.value, l] : n.value = n.value.filter((s) => s !== l)), d.onExpand?.(r, e);
|
|
26
|
+
const c = r ? [...u.value, l] : [...u.value].filter((s) => s !== l);
|
|
27
|
+
d.onExpandedRowsChange?.(c);
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
isExpanded: x,
|
|
31
|
+
toggleExpand: p,
|
|
32
|
+
expandedKeySet: u
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
K as useExpand
|
|
37
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFilter.bench.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useFilter.bench.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFilter.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useFilter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"useFilter.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useFilter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAI1C,kCAAkC;AAClC,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC,CAAA;AAEhF,MAAM,WAAW,gBAAgB;IAC/B,oBAAoB;IACpB,OAAO,EAAE,MAAM,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,CAAA;IACpD,aAAa;IACb,cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAA;CAClD;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,gBAAgB;+BAwBvC,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,KAC1C,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE;4BA4DtB,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,UACnC,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,KACpC,IAAI;0BAcsB,UAAU,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,KAAG,IAAI;yBAW7C,aAAa;iBAUnB,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,QAAQ,OAAO,EAAE,KAAG,OAAO,EAAE;EAmBzF"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { computed as k } from "vue";
|
|
2
|
+
import { getColumnKey as l } from "./useColumns.mjs";
|
|
3
|
+
import { useControlledColumnState as C } from "./useControlledColumnState.mjs";
|
|
4
|
+
function w(d) {
|
|
5
|
+
const { columns: u, onFilterChange: F } = d, {
|
|
6
|
+
innerState: g,
|
|
7
|
+
readValue: V,
|
|
8
|
+
writeValue: v
|
|
9
|
+
} = C({
|
|
10
|
+
controlledValue: (e) => e.filteredValue
|
|
11
|
+
});
|
|
12
|
+
for (const e of u()) {
|
|
13
|
+
const t = l(e);
|
|
14
|
+
t !== void 0 && e.defaultFilteredValue && (g[String(t)] = [...e.defaultFilteredValue]);
|
|
15
|
+
}
|
|
16
|
+
function f(e) {
|
|
17
|
+
return V(e, []);
|
|
18
|
+
}
|
|
19
|
+
function S(e) {
|
|
20
|
+
return [...e];
|
|
21
|
+
}
|
|
22
|
+
const h = k(() => {
|
|
23
|
+
const e = [];
|
|
24
|
+
for (const t of u()) {
|
|
25
|
+
if (!t.onFilter) continue;
|
|
26
|
+
const r = f(t);
|
|
27
|
+
r.length > 0 && e.push({ column: t, values: r });
|
|
28
|
+
}
|
|
29
|
+
return e;
|
|
30
|
+
});
|
|
31
|
+
function c(e, t) {
|
|
32
|
+
const r = {}, i = e ? l(e) : void 0;
|
|
33
|
+
for (const o of u()) {
|
|
34
|
+
const n = l(o);
|
|
35
|
+
if (n === void 0) continue;
|
|
36
|
+
const a = i !== void 0 && String(n) === String(i) && t !== void 0 ? S(t) : f(o);
|
|
37
|
+
r[String(n)] = a.length > 0 ? a : null;
|
|
38
|
+
}
|
|
39
|
+
return r;
|
|
40
|
+
}
|
|
41
|
+
function s(e, t) {
|
|
42
|
+
l(e) !== void 0 && (v(e, t.length === 0 ? void 0 : [...t]), F?.(c(e, t)));
|
|
43
|
+
}
|
|
44
|
+
function m(e) {
|
|
45
|
+
e.filterResetToDefaultFilteredValue && e.defaultFilteredValue ? s(e, [...e.defaultFilteredValue]) : s(e, []);
|
|
46
|
+
}
|
|
47
|
+
function p() {
|
|
48
|
+
return c();
|
|
49
|
+
}
|
|
50
|
+
function y(e) {
|
|
51
|
+
const t = h.value;
|
|
52
|
+
return t.length === 0 ? e : e.filter(
|
|
53
|
+
(r) => t.every(
|
|
54
|
+
({ column: i, values: o }) => o.some((n) => i.onFilter(n, r))
|
|
55
|
+
)
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
getFilteredValue: f,
|
|
60
|
+
confirmFilter: s,
|
|
61
|
+
resetFilter: m,
|
|
62
|
+
getAllFilters: p,
|
|
63
|
+
filterData: y
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
export {
|
|
67
|
+
w as useFilter
|
|
68
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ComputedRef } from 'vue';
|
|
2
|
+
import { FixedOffset } from './useScroll';
|
|
3
|
+
export interface UseFixedColumnStyleReturn {
|
|
4
|
+
/** sticky 定位样式,非固定列返回 undefined */
|
|
5
|
+
fixedStyle: ComputedRef<Record<string, string> | undefined>;
|
|
6
|
+
/** 固定列阴影 class(滚动到边界时隐藏对应侧阴影) */
|
|
7
|
+
fixedClass: ComputedRef<string>;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 固定列 sticky 样式与阴影 class 的共享实现。
|
|
11
|
+
*
|
|
12
|
+
* fixedInfo 的取得方式因场景而异(单列 / 分组表头叶子列 / summary 按 index),
|
|
13
|
+
* 由调用方以 getter 传入;fixedStyle/fixedClass 的推导三处完全一致,收敛于此。
|
|
14
|
+
*/
|
|
15
|
+
export declare function useFixedColumnStyle(options: {
|
|
16
|
+
fixedInfo: () => FixedOffset | null;
|
|
17
|
+
}): UseFixedColumnStyleReturn;
|
|
18
|
+
//# sourceMappingURL=useFixedColumnStyle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFixedColumnStyle.d.ts","sourceRoot":"","sources":["../../../../../table/src/composables/useFixedColumnStyle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,WAAW,EAAE,MAAM,KAAK,CAAA;AAExD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,MAAM,WAAW,yBAAyB;IACxC,mCAAmC;IACnC,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC,CAAA;IAC3D,iCAAiC;IACjC,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;CAChC;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE;IAC3C,SAAS,EAAE,MAAM,WAAW,GAAG,IAAI,CAAA;CACpC,GAAG,yBAAyB,CA8B5B"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { inject as l, computed as s } from "vue";
|
|
2
|
+
import { TABLE_CONTEXT_KEY as a } from "../context.mjs";
|
|
3
|
+
function h(n) {
|
|
4
|
+
const i = l(a, {}), r = s(() => {
|
|
5
|
+
const t = n.fixedInfo();
|
|
6
|
+
if (!t) return;
|
|
7
|
+
const e = { position: "sticky", zIndex: "2" };
|
|
8
|
+
return t.left !== void 0 && (e.left = `${t.left}px`), t.right !== void 0 && (e.right = `${t.right}px`), e;
|
|
9
|
+
}), f = s(() => {
|
|
10
|
+
const t = n.fixedInfo();
|
|
11
|
+
if (!t) return "";
|
|
12
|
+
const e = i.subThemeSlots;
|
|
13
|
+
if (!e) return "";
|
|
14
|
+
const o = [], u = i.scrollState?.atStart.value ?? !0, c = i.scrollState?.atEnd.value ?? !0;
|
|
15
|
+
return t.isLastLeft && !u && o.push(e.fixedShadowLeft()), t.isFirstRight && !c && o.push(e.fixedShadowRight()), o.join(" ");
|
|
16
|
+
});
|
|
17
|
+
return { fixedStyle: r, fixedClass: f };
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
h as useFixedColumnStyle
|
|
21
|
+
};
|