@vtable-guild/vtable-guild 2.9.0-alpha.8 → 3.0.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/css/index.css +296 -9
- package/css/presets/antdv.css +3 -0
- package/css/presets/element-plus.css +3 -0
- package/css/style.css +544 -43
- package/css/tailwind3-utilities.css +189 -32
- package/css/tailwind3.css +355 -11
- package/css/tailwind4.css +355 -11
- package/css/transitions.css +53 -2
- package/dist/core/src/utils/types.d.ts +3 -0
- package/dist/core/src/utils/types.d.ts.map +1 -1
- package/dist/css/index.css +296 -9
- package/dist/css/presets/antdv.css +3 -0
- package/dist/css/presets/element-plus.css +3 -0
- package/dist/css/style.css +544 -43
- package/dist/css/tailwind3-utilities.css +189 -32
- package/dist/css/tailwind3.css +355 -11
- package/dist/css/tailwind4.css +355 -11
- package/dist/css/transitions.css +53 -2
- package/dist/icons/src/EditOutlinedIcon.d.ts +3 -0
- package/dist/icons/src/EditOutlinedIcon.d.ts.map +1 -0
- package/dist/icons/src/EditOutlinedIcon.mjs +9 -0
- package/dist/icons/src/ElFilterIcon.mjs +9 -0
- package/dist/icons/src/index.d.ts +1 -0
- package/dist/icons/src/index.d.ts.map +1 -1
- package/dist/index.full.mjs +9349 -7117
- package/dist/index.mjs +112 -106
- package/dist/table/src/components/Table.d.ts +1 -1
- package/dist/table/src/components/TableCell.d.ts.map +1 -1
- package/dist/table/src/components/TableCell.mjs +118 -147
- package/dist/table/src/components/TableEditFrame.d.ts +58 -0
- package/dist/table/src/components/TableEditFrame.d.ts.map +1 -0
- package/dist/table/src/components/TableEditFrame.mjs +127 -0
- package/dist/table/src/components/TableEditLayout.test.d.ts +2 -0
- package/dist/table/src/components/TableEditLayout.test.d.ts.map +1 -0
- package/dist/table/src/components/TableEditableCell.d.ts +46 -9
- package/dist/table/src/components/TableEditableCell.d.ts.map +1 -1
- package/dist/table/src/components/TableEditableCell.mjs +99 -22
- package/dist/table/src/components/TableLightFilter.d.ts +76 -0
- package/dist/table/src/components/TableLightFilter.d.ts.map +1 -0
- package/dist/table/src/components/TableLightFilter.mjs +320 -0
- package/dist/table/src/components/TableLightFilter.test.d.ts +2 -0
- package/dist/table/src/components/TableLightFilter.test.d.ts.map +1 -0
- package/dist/table/src/components/TableQuery.d.ts +107 -46
- package/dist/table/src/components/TableQuery.d.ts.map +1 -1
- package/dist/table/src/components/TableQuery.mjs +481 -184
- package/dist/table/src/components/TableQueryNative.test.d.ts +2 -0
- package/dist/table/src/components/TableQueryNative.test.d.ts.map +1 -0
- package/dist/table/src/components/TableSelectionAlert.d.ts +1 -1
- package/dist/table/src/components/TableSelectionAlert.d.ts.map +1 -1
- package/dist/table/src/components/TableSelectionAlert.mjs +109 -55
- package/dist/table/src/components/VTableEditCell.test.d.ts +2 -0
- package/dist/table/src/components/VTableEditCell.test.d.ts.map +1 -0
- package/dist/table/src/components/VTableEditCell.vue.d.ts +18 -3
- package/dist/table/src/components/VTableEditCell.vue.d.ts.map +1 -1
- package/dist/table/src/components/VTableEditCell.vue.mjs +172 -10
- package/dist/table/src/components/VTableEditShell.vue.d.ts +38 -0
- package/dist/table/src/components/VTableEditShell.vue.d.ts.map +1 -0
- package/dist/table/src/components/VTableEditShell.vue.mjs +37 -0
- package/dist/table/src/components/VTableEditShell.vue2.mjs +4 -0
- package/dist/table/src/components/VTableQuery.vue.d.ts +4 -3
- package/dist/table/src/components/VTableQuery.vue.d.ts.map +1 -1
- package/dist/table/src/components/VTableQuery.vue.mjs +53 -31
- package/dist/table/src/components/VirtualTableBody.mjs +24 -23
- package/dist/table/src/components/renderCellDisplay.d.ts +6 -0
- package/dist/table/src/components/renderCellDisplay.d.ts.map +1 -0
- package/dist/table/src/components/renderCellDisplay.mjs +37 -0
- package/dist/table/src/composables/useQueryCollapseMotion.d.ts +4 -0
- package/dist/table/src/composables/useQueryCollapseMotion.d.ts.map +1 -0
- package/dist/table/src/composables/useQueryCollapseMotion.mjs +48 -0
- package/dist/table/src/composables/useQueryCollapseMotion.test.d.ts +2 -0
- package/dist/table/src/composables/useQueryCollapseMotion.test.d.ts.map +1 -0
- package/dist/table/src/composables/useSelection.d.ts.map +1 -1
- package/dist/table/src/composables/useSelection.mjs +157 -148
- package/dist/table/src/composables/useTableEdit.d.ts +17 -0
- package/dist/table/src/composables/useTableEdit.d.ts.map +1 -1
- package/dist/table/src/composables/useTableEdit.mjs +326 -266
- package/dist/table/src/composables/useTableEditable.d.ts.map +1 -1
- package/dist/table/src/composables/useTableEditable.mjs +321 -89
- package/dist/table/src/controls.d.ts.map +1 -1
- package/dist/table/src/controls.mjs +198 -79
- package/dist/table/src/index.d.ts +2 -0
- package/dist/table/src/index.d.ts.map +1 -1
- package/dist/table/src/types/controls.d.ts +61 -3
- package/dist/table/src/types/controls.d.ts.map +1 -1
- package/dist/table/src/types/controls.mjs +4 -0
- package/dist/table/src/types/editable.d.ts +78 -4
- package/dist/table/src/types/editable.d.ts.map +1 -1
- package/dist/table/src/types/editable.typecheck.d.ts.map +1 -1
- package/dist/table/src/types/editing.d.ts +5 -2
- package/dist/table/src/types/editing.d.ts.map +1 -1
- package/dist/table/src/types/query-form.d.ts +76 -15
- package/dist/table/src/types/query-form.d.ts.map +1 -1
- package/dist/table/src/types/query-form.typecheck.d.ts +4 -0
- package/dist/table/src/types/query-form.typecheck.d.ts.map +1 -1
- package/dist/table/src/types/table.d.ts +1 -0
- package/dist/table/src/types/table.d.ts.map +1 -1
- package/dist/table/src/utils/cell.d.ts +18 -12
- package/dist/table/src/utils/cell.d.ts.map +1 -1
- package/dist/table/src/utils/cell.mjs +95 -94
- package/dist/table/src/utils/draftEqual.d.ts +2 -0
- package/dist/table/src/utils/draftEqual.d.ts.map +1 -0
- package/dist/table/src/utils/draftEqual.mjs +22 -0
- package/dist/table/src/utils/queryFields.mjs +11 -11
- package/dist/table/src/utils/queryFilterLayout.d.ts +29 -0
- package/dist/table/src/utils/queryFilterLayout.d.ts.map +1 -0
- package/dist/table/src/utils/queryFilterLayout.mjs +74 -0
- package/dist/table/src/utils/queryFilterLayout.test.d.ts +2 -0
- package/dist/table/src/utils/queryFilterLayout.test.d.ts.map +1 -0
- package/dist/table/src/utils/queryInlineLayout.d.ts +22 -0
- package/dist/table/src/utils/queryInlineLayout.d.ts.map +1 -0
- package/dist/table/src/utils/queryInlineLayout.mjs +92 -0
- package/dist/table/src/utils/queryInlineLayout.test.d.ts +2 -0
- package/dist/table/src/utils/queryInlineLayout.test.d.ts.map +1 -0
- package/dist/table/src/utils/snapshot.d.ts +2 -0
- package/dist/table/src/utils/snapshot.d.ts.map +1 -1
- package/dist/table/src/utils/snapshot.mjs +18 -13
- package/dist/theme/src/presets/antdv/table-locale.d.ts +6 -0
- package/dist/theme/src/presets/antdv/table-locale.d.ts.map +1 -1
- package/dist/theme/src/presets/antdv/table-locale.mjs +16 -2
- package/dist/theme/src/presets/antdv/table.d.ts +18 -8
- package/dist/theme/src/presets/antdv/table.d.ts.map +1 -1
- package/dist/theme/src/presets/antdv/table.mjs +56 -12
- package/dist/theme/src/presets/element-plus/table-locale.d.ts +6 -0
- package/dist/theme/src/presets/element-plus/table-locale.d.ts.map +1 -1
- package/dist/theme/src/presets/element-plus/table-locale.mjs +16 -2
- package/dist/theme/src/presets/element-plus/table.d.ts +18 -8
- package/dist/theme/src/presets/element-plus/table.d.ts.map +1 -1
- package/dist/theme/src/presets/element-plus/table.mjs +57 -10
- package/dist/theme/src/query.d.ts +34 -57
- package/dist/theme/src/query.d.ts.map +1 -1
- package/dist/theme/src/query.mjs +23 -24
- package/dist/theme/src/selection-alert.d.ts +8 -0
- package/dist/theme/src/selection-alert.d.ts.map +1 -1
- package/dist/theme/src/selection-alert.mjs +2 -0
- package/dist/vtable-guild/src/index.d.ts +1 -1
- package/dist/vtable-guild/src/index.d.ts.map +1 -1
- package/package.json +2 -1
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as ne, inject as te, ref as D, computed as s, createVNode as c, mergeProps as A } from "vue";
|
|
2
2
|
import "../../../core/src/utils/tv.mjs";
|
|
3
3
|
import oe from "../../../core/src/components/Tooltip.mjs";
|
|
4
|
-
import ae from "
|
|
5
|
-
import se from "../../../icons/src/CloseCircleFilledIcon.mjs";
|
|
6
|
-
import { TABLE_CONTEXT_KEY as re } from "../context.mjs";
|
|
4
|
+
import { TABLE_CONTEXT_KEY as ae } from "../context.mjs";
|
|
7
5
|
import { getByDataIndex as ce, getColumnKey as K } from "../composables/useColumns.mjs";
|
|
8
|
-
import { useFixedColumnStyle as
|
|
9
|
-
import { resolveBodyCell as
|
|
10
|
-
import
|
|
11
|
-
import
|
|
6
|
+
import { useFixedColumnStyle as de } from "../composables/useFixedColumnStyle.mjs";
|
|
7
|
+
import { resolveBodyCell as se, getEllipsisConfig as j, omitCellProps as H, isRenderedCell as re } from "../utils/cell.mjs";
|
|
8
|
+
import ue from "./SelectionCheckbox.mjs";
|
|
9
|
+
import ie from "./SelectionRadio.mjs";
|
|
12
10
|
import L from "./ExpandIcon.mjs";
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
11
|
+
import ve from "./TableCopyButton.mjs";
|
|
12
|
+
import { renderCellDisplay as me } from "./renderCellDisplay.mjs";
|
|
13
|
+
import { isInHoverRange as Ce } from "../composables/useHoverState.mjs";
|
|
15
14
|
import { TABLE_ALIGN_CLASSES as xe } from "../../../theme/src/presets/antdv/table.mjs";
|
|
16
15
|
import { cn as C } from "tailwind-variants";
|
|
17
|
-
const
|
|
16
|
+
const Pe = /* @__PURE__ */ ne({
|
|
18
17
|
name: "TableCell",
|
|
19
18
|
props: {
|
|
20
19
|
record: {
|
|
@@ -58,7 +57,7 @@ const Le = /* @__PURE__ */ te({
|
|
|
58
57
|
}
|
|
59
58
|
},
|
|
60
59
|
setup(e) {
|
|
61
|
-
const l =
|
|
60
|
+
const l = te(ae, {}), O = D(null), E = D(!1), o = s(() => e.resolvedCell ?? se({
|
|
62
61
|
text: ce(e.record, e.column.dataIndex),
|
|
63
62
|
record: e.record,
|
|
64
63
|
rowIndex: e.rowIndex,
|
|
@@ -68,231 +67,203 @@ const Le = /* @__PURE__ */ te({
|
|
|
68
67
|
columnEmptyText: l.columnEmptyText?.value,
|
|
69
68
|
renderers: l.renderers?.value,
|
|
70
69
|
locale: l.localeName?.value
|
|
71
|
-
})),
|
|
70
|
+
})), W = s(() => {
|
|
72
71
|
if (!e.column.fixed) return null;
|
|
73
72
|
const n = K(e.column) ?? e.colIndex;
|
|
74
73
|
return l.fixedOffsets?.value?.get(n) ?? null;
|
|
75
74
|
}), {
|
|
76
|
-
fixedStyle:
|
|
77
|
-
fixedClass:
|
|
78
|
-
} =
|
|
79
|
-
fixedInfo: () =>
|
|
80
|
-
}),
|
|
75
|
+
fixedStyle: $,
|
|
76
|
+
fixedClass: _
|
|
77
|
+
} = de({
|
|
78
|
+
fixedInfo: () => W.value
|
|
79
|
+
}), z = s(() => j(e.column).enabled ? l.compatClass?.("cell-ellipsis") ?? "" : ""), i = s(() => l.getSelectionState?.(e.record, e.rowIndex) ?? {
|
|
81
80
|
checked: !1,
|
|
82
81
|
indeterminate: !1,
|
|
83
82
|
disabled: !1
|
|
84
|
-
}),
|
|
85
|
-
function
|
|
83
|
+
}), f = s(() => i.value.checked), S = s(() => Ce(e.rowIndex, o.value.rowSpan ?? 1, l.hoverRange?.value ?? null)), R = s(() => S.value && l.hoverable?.value ? l.compatClass?.("cell-row-hover") ?? "" : "");
|
|
84
|
+
function h() {
|
|
86
85
|
if (!l.hoverable?.value) return;
|
|
87
|
-
const n = Math.max(1,
|
|
86
|
+
const n = Math.max(1, o.value.rowSpan ?? 1);
|
|
88
87
|
l.setHoverRange?.(e.rowIndex, e.rowIndex + n - 1);
|
|
89
88
|
}
|
|
90
|
-
function
|
|
89
|
+
function g() {
|
|
91
90
|
l.hoverable?.value && l.clearHoverRange?.();
|
|
92
91
|
}
|
|
93
|
-
function
|
|
94
|
-
return (
|
|
95
|
-
|
|
92
|
+
function F(n) {
|
|
93
|
+
return (t) => {
|
|
94
|
+
h(), typeof n == "function" && n(t);
|
|
96
95
|
};
|
|
97
96
|
}
|
|
98
|
-
function
|
|
99
|
-
return (
|
|
100
|
-
|
|
97
|
+
function G(n) {
|
|
98
|
+
return (t) => {
|
|
99
|
+
g(), typeof n == "function" && n(t);
|
|
101
100
|
};
|
|
102
101
|
}
|
|
103
|
-
const
|
|
104
|
-
...H(
|
|
105
|
-
...H(
|
|
106
|
-
})),
|
|
107
|
-
const n = e.column.align ? l.vtgClass?.(xe[e.column.align]) ?? "" : "",
|
|
102
|
+
const k = s(() => ({
|
|
103
|
+
...H(o.value.renderCellProps),
|
|
104
|
+
...H(o.value.customCellProps)
|
|
105
|
+
})), V = s(() => {
|
|
106
|
+
const n = e.column.align ? l.vtgClass?.(xe[e.column.align]) ?? "" : "", t = l.subThemeSlots, a = S.value && l.hoverable?.value, v = l.isColumnSorted?.(e.column) && t ? t.tdSorted() : "", x = f.value && t ? C(t.tdSelected(), a ? t.tdRowSelectedHover() : "") : "", p = a && t && !f.value ? t.tdRowHover() : "";
|
|
108
107
|
return C(
|
|
109
108
|
e.tdClass,
|
|
110
109
|
n,
|
|
111
110
|
e.column.className,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
111
|
+
o.value.customCellProps?.class,
|
|
112
|
+
o.value.customCellProps?.className,
|
|
113
|
+
o.value.renderCellProps?.class,
|
|
114
|
+
o.value.renderCellProps?.className,
|
|
116
115
|
v,
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
E.value,
|
|
116
|
+
x,
|
|
117
|
+
p,
|
|
120
118
|
_.value,
|
|
119
|
+
R.value,
|
|
121
120
|
// antdv 把 ellipsis 类放在 td 上,我们的 slot 落在内层 span,故在此补
|
|
122
|
-
|
|
121
|
+
z.value
|
|
123
122
|
);
|
|
124
|
-
}),
|
|
125
|
-
const n = {},
|
|
126
|
-
return
|
|
123
|
+
}), y = s(() => {
|
|
124
|
+
const n = {}, t = l.columnWidths?.[String(K(e.column) ?? e.colIndex)], a = e.widthOverride ?? t ?? e.column.width;
|
|
125
|
+
return a && (n.width = typeof a == "number" ? `${a}px` : a), {
|
|
127
126
|
...n,
|
|
128
|
-
|
|
129
|
-
...
|
|
130
|
-
...
|
|
131
|
-
...l.columnLayout?.columnStyle(e.colIndex,
|
|
127
|
+
...$.value ?? {},
|
|
128
|
+
...o.value.customCellProps?.style ?? {},
|
|
129
|
+
...o.value.renderCellProps?.style ?? {},
|
|
130
|
+
...l.columnLayout?.columnStyle(e.colIndex, o.value.colSpan || 1)
|
|
132
131
|
};
|
|
133
|
-
}), X =
|
|
134
|
-
const n = l.rowSelection?.(),
|
|
135
|
-
let
|
|
136
|
-
return n && (
|
|
132
|
+
}), X = s(() => l.isTreeData?.value ? l.getFlattenRow?.(e.record) ?? null : null), Y = s(() => l.isTreeData?.value ? l.treeIndentColumnIndex ? e.colIndex === l.treeIndentColumnIndex.value : e.column.key !== "__vtg_selection__" && e.column.key !== "__vtg_expand__" && e.colIndex <= 2 ? (() => {
|
|
133
|
+
const n = l.rowSelection?.(), t = l.expandable?.();
|
|
134
|
+
let a = 0;
|
|
135
|
+
return n && (a += 1), t && t.showExpandColumn !== !1 && (a += 1), e.colIndex === a;
|
|
137
136
|
})() : !1 : !1);
|
|
138
137
|
function J(n) {
|
|
139
138
|
return {
|
|
140
|
-
...
|
|
139
|
+
...y.value,
|
|
141
140
|
...n ?? {},
|
|
142
|
-
...l.columnLayout?.columnStyle(e.colIndex,
|
|
141
|
+
...l.columnLayout?.columnStyle(e.colIndex, o.value.colSpan || 1)
|
|
143
142
|
};
|
|
144
143
|
}
|
|
145
144
|
function Q() {
|
|
146
|
-
const n =
|
|
147
|
-
|
|
145
|
+
const n = O.value, t = o.value.tooltipText;
|
|
146
|
+
E.value = !!(n && t && (n.scrollWidth > n.clientWidth || n.scrollHeight > n.clientHeight));
|
|
148
147
|
}
|
|
149
148
|
function U() {
|
|
150
|
-
|
|
149
|
+
E.value = !1;
|
|
151
150
|
}
|
|
152
151
|
return () => {
|
|
153
|
-
if (
|
|
152
|
+
if (o.value.colSpan === 0 || o.value.rowSpan === 0)
|
|
154
153
|
return null;
|
|
155
|
-
const n =
|
|
154
|
+
const n = o.value.colSpan !== 1 ? o.value.colSpan : void 0, t = o.value.rowSpan !== 1 ? o.value.rowSpan : void 0;
|
|
156
155
|
if (e.column.key === "__vtg_selection__") {
|
|
157
|
-
const m = l.rowSelection?.(),
|
|
156
|
+
const m = l.rowSelection?.(), w = m?.type === "radio" ? c(ie, {
|
|
158
157
|
checked: i.value.checked,
|
|
159
158
|
disabled: i.value.disabled,
|
|
160
|
-
onChange: (
|
|
161
|
-
}, null) :
|
|
159
|
+
onChange: (r) => l.toggleRow?.(e.record, e.rowIndex, r)
|
|
160
|
+
}, null) : c(ue, {
|
|
162
161
|
checked: i.value.checked,
|
|
163
162
|
indeterminate: i.value.indeterminate,
|
|
164
163
|
disabled: i.value.disabled,
|
|
165
|
-
onChange: (
|
|
164
|
+
onChange: (r, T) => l.toggleRow?.(e.record, e.rowIndex, T)
|
|
166
165
|
}, null);
|
|
167
|
-
let
|
|
166
|
+
let u = w, d;
|
|
168
167
|
if (m?.renderCell) {
|
|
169
|
-
const
|
|
170
|
-
|
|
168
|
+
const r = m.renderCell(i.value.checked, e.record, e.rowIndex, w);
|
|
169
|
+
re(r) ? (u = r.children, d = r.props) : u = r;
|
|
171
170
|
}
|
|
172
|
-
const
|
|
173
|
-
return
|
|
174
|
-
class:
|
|
175
|
-
style: J(
|
|
171
|
+
const b = !!m?.renderCell, I = S.value && l.hoverable?.value, P = C(e.tdClass, l.vtgClass?.(b ? "text-center" : "text-center leading-[0]"), e.column.className, d?.class, d?.className, f.value && l.subThemeSlots ? C(l.subThemeSlots.tdSelected(), I ? l.subThemeSlots.tdRowSelectedHover() : "") : I && l.subThemeSlots ? l.subThemeSlots.tdRowHover() : "", _.value, R.value, l.compatClass?.("selection-column"));
|
|
172
|
+
return c("td", A(H(d), {
|
|
173
|
+
class: P,
|
|
174
|
+
style: J(d?.style),
|
|
176
175
|
"data-vtg-col": e.colIndex,
|
|
177
176
|
colspan: n,
|
|
178
|
-
rowspan:
|
|
179
|
-
onMouseenter:
|
|
180
|
-
onMouseleave:
|
|
181
|
-
}), [
|
|
177
|
+
rowspan: t,
|
|
178
|
+
onMouseenter: h,
|
|
179
|
+
onMouseleave: g
|
|
180
|
+
}), [u]);
|
|
182
181
|
}
|
|
183
182
|
if (e.column.key === "__vtg_expand__") {
|
|
184
|
-
const m = l.expandable?.(),
|
|
185
|
-
return m?.expandIcon ?
|
|
183
|
+
const m = l.expandable?.(), M = l.getRowKey?.(e.record, e.rowIndex), w = M !== void 0 && (l.isExpanded?.(M) ?? !1), u = l.isRowExpandable?.(e.record) ?? !1, d = l.subThemeSlots, b = S.value && l.hoverable?.value, I = l.isColumnSorted?.(e.column) && d ? d.tdSorted() : "", P = f.value && d ? C(d.tdSelected(), b ? d.tdRowSelectedHover() : "") : "", r = b && d && !f.value ? d.tdRowHover() : "", T = C(e.tdClass, l.vtgClass?.("text-center"), e.column.className, I, P, r, _.value, R.value, l.compatClass?.("row-expand-icon-cell"));
|
|
184
|
+
return m?.expandIcon ? c("td", {
|
|
186
185
|
class: T,
|
|
187
|
-
style:
|
|
186
|
+
style: y.value,
|
|
188
187
|
"data-vtg-col": e.colIndex,
|
|
189
188
|
colspan: n,
|
|
190
|
-
rowspan:
|
|
191
|
-
onMouseenter:
|
|
192
|
-
onMouseleave:
|
|
189
|
+
rowspan: t,
|
|
190
|
+
onMouseenter: h,
|
|
191
|
+
onMouseleave: g
|
|
193
192
|
}, [m.expandIcon({
|
|
194
|
-
expanded:
|
|
193
|
+
expanded: w,
|
|
195
194
|
record: e.record,
|
|
196
|
-
expandable:
|
|
197
|
-
onExpand: (
|
|
198
|
-
le.stopPropagation(),
|
|
195
|
+
expandable: u,
|
|
196
|
+
onExpand: (fe, le) => {
|
|
197
|
+
le.stopPropagation(), u && l.toggleExpand?.(e.record, e.rowIndex);
|
|
199
198
|
}
|
|
200
|
-
})]) :
|
|
199
|
+
})]) : c("td", {
|
|
201
200
|
class: T,
|
|
202
|
-
style:
|
|
201
|
+
style: y.value,
|
|
203
202
|
"data-vtg-col": e.colIndex,
|
|
204
203
|
colspan: n,
|
|
205
|
-
rowspan:
|
|
206
|
-
onMouseenter:
|
|
207
|
-
onMouseleave:
|
|
208
|
-
}, [
|
|
209
|
-
expanded:
|
|
210
|
-
expandable:
|
|
204
|
+
rowspan: t,
|
|
205
|
+
onMouseenter: h,
|
|
206
|
+
onMouseleave: g
|
|
207
|
+
}, [c(L, {
|
|
208
|
+
expanded: w,
|
|
209
|
+
expandable: u,
|
|
211
210
|
variant: "row",
|
|
212
211
|
onClick: () => {
|
|
213
|
-
|
|
212
|
+
u && l.toggleExpand?.(e.record, e.rowIndex);
|
|
214
213
|
}
|
|
215
214
|
}, null)]);
|
|
216
215
|
}
|
|
217
|
-
const
|
|
218
|
-
class: l.compatClass ? `${l.compatClass("row-indent")} indent-level-${
|
|
216
|
+
const a = X.value, v = Y.value && a, x = v ? l.getRowKey?.(e.record, e.rowIndex) : void 0, p = v ? c("span", {
|
|
217
|
+
class: l.compatClass ? `${l.compatClass("row-indent")} indent-level-${a.level}` : void 0,
|
|
219
218
|
style: {
|
|
220
219
|
display: "inline-block",
|
|
221
|
-
width: `${
|
|
220
|
+
width: `${a.level * (l.treeIndentSize?.value ?? 15)}px`
|
|
222
221
|
}
|
|
223
|
-
}, null) : null, Z = v &&
|
|
224
|
-
expanded:
|
|
222
|
+
}, null) : null, Z = v && a.hasChildren ? c(L, {
|
|
223
|
+
expanded: a.expanded,
|
|
225
224
|
expandable: !0,
|
|
226
225
|
variant: "tree",
|
|
227
|
-
loading:
|
|
228
|
-
error:
|
|
226
|
+
loading: x !== void 0 && l.isTreeLoading?.(x),
|
|
227
|
+
error: x !== void 0 && !!l.getTreeLoadError?.(x),
|
|
229
228
|
onClick: () => l.toggleTreeExpand?.(e.record, e.rowIndex)
|
|
230
|
-
}, null) : v ?
|
|
229
|
+
}, null) : v ? c(L, {
|
|
231
230
|
expanded: !1,
|
|
232
231
|
expandable: !1,
|
|
233
232
|
variant: "tree"
|
|
234
|
-
}, null) : null,
|
|
235
|
-
class: l.subThemeSlots?.cellProgress(),
|
|
236
|
-
"data-vtg-field": "progress",
|
|
237
|
-
role: "progressbar",
|
|
238
|
-
"aria-label": t.value.tooltipText,
|
|
239
|
-
"aria-valuemin": 0,
|
|
240
|
-
"aria-valuemax": 100,
|
|
241
|
-
"aria-valuenow": t.value.progress.percent
|
|
242
|
-
}, [a("span", {
|
|
243
|
-
class: l.subThemeSlots?.cellProgressTrack()
|
|
244
|
-
}, [a("span", {
|
|
245
|
-
class: l.subThemeSlots?.cellProgressBar(),
|
|
246
|
-
"data-status": t.value.status ?? "processing",
|
|
247
|
-
style: {
|
|
248
|
-
width: `${t.value.progress.percent}%`
|
|
249
|
-
}
|
|
250
|
-
}, null)]), t.value.progress.showValue ? a("span", {
|
|
251
|
-
class: l.subThemeSlots?.cellProgressText(),
|
|
252
|
-
"data-status": t.value.status
|
|
253
|
-
}, [t.value.status === "success" ? a(ae, null, null) : t.value.status === "error" ? a(se, {
|
|
254
|
-
"fill-rule": "evenodd"
|
|
255
|
-
}, null) : t.value.content]) : null]) : t.value.presentation === "tag" ? a("span", {
|
|
256
|
-
class: l.subThemeSlots?.cellTag(),
|
|
257
|
-
"data-status": t.value.status ?? "default",
|
|
258
|
-
"data-vtg-field": "tag"
|
|
259
|
-
}, [t.value.content]) : t.value.status ? a("span", {
|
|
260
|
-
class: l.subThemeSlots?.cellStatus(),
|
|
261
|
-
"data-status": t.value.status
|
|
262
|
-
}, [t.value.content]) : t.value.content, q = O.enabled ? O.showTitle ? a(oe, {
|
|
233
|
+
}, null) : null, B = j(e.column), ee = v ? l.compatClass?.("cell-with-append") ?? "" : "", N = me(o.value, l.subThemeSlots), q = B.enabled ? B.showTitle ? c(oe, {
|
|
263
234
|
block: !0,
|
|
264
|
-
title:
|
|
235
|
+
title: o.value.tooltipText,
|
|
265
236
|
placement: "top",
|
|
266
|
-
open:
|
|
237
|
+
open: E.value
|
|
267
238
|
}, {
|
|
268
|
-
default: () => [
|
|
269
|
-
ref:
|
|
239
|
+
default: () => [c("div", {
|
|
240
|
+
ref: O,
|
|
270
241
|
class: e.bodyCellEllipsisClass,
|
|
271
242
|
onMouseenter: Q,
|
|
272
243
|
onMouseleave: U
|
|
273
|
-
}, [
|
|
274
|
-
}) :
|
|
244
|
+
}, [N])]
|
|
245
|
+
}) : c("div", {
|
|
275
246
|
class: e.bodyCellEllipsisClass
|
|
276
|
-
}, [
|
|
277
|
-
return
|
|
278
|
-
class: C(
|
|
279
|
-
style:
|
|
247
|
+
}, [N]) : N;
|
|
248
|
+
return c("td", A(k.value, {
|
|
249
|
+
class: C(V.value, ee),
|
|
250
|
+
style: y.value,
|
|
280
251
|
"data-vtg-col": e.colIndex,
|
|
281
252
|
colspan: n,
|
|
282
|
-
rowspan:
|
|
283
|
-
onMouseenter:
|
|
284
|
-
onMouseleave:
|
|
285
|
-
}), [
|
|
253
|
+
rowspan: t,
|
|
254
|
+
onMouseenter: F(k.value.onMouseenter),
|
|
255
|
+
onMouseleave: G(k.value.onMouseleave)
|
|
256
|
+
}), [p, Z, e.column.copyable ? c("span", {
|
|
286
257
|
class: l.subThemeSlots?.cellContent()
|
|
287
|
-
}, [q,
|
|
258
|
+
}, [q, c(ve, {
|
|
288
259
|
column: e.column,
|
|
289
260
|
record: e.record,
|
|
290
261
|
rowIndex: e.rowIndex,
|
|
291
|
-
defaultText:
|
|
262
|
+
defaultText: o.value.copyText
|
|
292
263
|
}, null)]) : q]);
|
|
293
264
|
};
|
|
294
265
|
}
|
|
295
266
|
});
|
|
296
267
|
export {
|
|
297
|
-
|
|
268
|
+
Pe as default
|
|
298
269
|
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { PropType, VNodeChild } from 'vue';
|
|
2
|
+
import { TableEditErrorPlacement, TableEditLayout } from '../types/editable';
|
|
3
|
+
import { TableBodyCellSlotProps } from '../types/table';
|
|
4
|
+
type DisplayCell = TableBodyCellSlotProps<Record<string, unknown>>;
|
|
5
|
+
/**
|
|
6
|
+
* Layout of an editing cell, shared by the registered editors and VTableEditShell:
|
|
7
|
+
* a hidden copy of the display state, the control stacked over it, and the error.
|
|
8
|
+
*/
|
|
9
|
+
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
|
|
10
|
+
ui: PropType<Record<string, string>>;
|
|
11
|
+
/** 'flow' keeps the DOM of a control that sizes its own cell. */
|
|
12
|
+
layout: {
|
|
13
|
+
type: PropType<TableEditLayout>;
|
|
14
|
+
default: string;
|
|
15
|
+
};
|
|
16
|
+
/** The live bodyCell slot context, when there is a display state to copy. */
|
|
17
|
+
displayCell: PropType<DisplayCell>;
|
|
18
|
+
original: PropType<Record<string, unknown>>;
|
|
19
|
+
sizer: PropType<(cell: DisplayCell) => VNodeChild>;
|
|
20
|
+
/** Reserve one line of text when the hidden layer may be empty; implied without displayCell. */
|
|
21
|
+
strut: BooleanConstructor;
|
|
22
|
+
/** Stretch the control to the height of the cell; for multi-line controls. Implies strut. */
|
|
23
|
+
fill: BooleanConstructor;
|
|
24
|
+
error: StringConstructor;
|
|
25
|
+
errorPlacement: {
|
|
26
|
+
type: PropType<TableEditErrorPlacement>;
|
|
27
|
+
default: string;
|
|
28
|
+
};
|
|
29
|
+
onFocusout: PropType<(event: FocusEvent) => void>;
|
|
30
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
|
|
31
|
+
ui: PropType<Record<string, string>>;
|
|
32
|
+
/** 'flow' keeps the DOM of a control that sizes its own cell. */
|
|
33
|
+
layout: {
|
|
34
|
+
type: PropType<TableEditLayout>;
|
|
35
|
+
default: string;
|
|
36
|
+
};
|
|
37
|
+
/** The live bodyCell slot context, when there is a display state to copy. */
|
|
38
|
+
displayCell: PropType<DisplayCell>;
|
|
39
|
+
original: PropType<Record<string, unknown>>;
|
|
40
|
+
sizer: PropType<(cell: DisplayCell) => VNodeChild>;
|
|
41
|
+
/** Reserve one line of text when the hidden layer may be empty; implied without displayCell. */
|
|
42
|
+
strut: BooleanConstructor;
|
|
43
|
+
/** Stretch the control to the height of the cell; for multi-line controls. Implies strut. */
|
|
44
|
+
fill: BooleanConstructor;
|
|
45
|
+
error: StringConstructor;
|
|
46
|
+
errorPlacement: {
|
|
47
|
+
type: PropType<TableEditErrorPlacement>;
|
|
48
|
+
default: string;
|
|
49
|
+
};
|
|
50
|
+
onFocusout: PropType<(event: FocusEvent) => void>;
|
|
51
|
+
}>> & Readonly<{}>, {
|
|
52
|
+
fill: boolean;
|
|
53
|
+
layout: TableEditLayout;
|
|
54
|
+
strut: boolean;
|
|
55
|
+
errorPlacement: TableEditErrorPlacement;
|
|
56
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
57
|
+
export default _default;
|
|
58
|
+
//# sourceMappingURL=TableEditFrame.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableEditFrame.d.ts","sourceRoot":"","sources":["../../../../../table/src/components/TableEditFrame.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiD,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,KAAK,CAAA;AAGnG,OAAO,KAAK,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEjF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AAM5D,KAAK,WAAW,GAAG,sBAAsB,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;AAElE;;;GAGG;;QAIe,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9C,iEAAiE;;cACvC,QAAQ,CAAC,eAAe,CAAC;;;IACnD,6EAA6E;iBACtD,QAAQ,CAAC,WAAW,CAAC;cACxB,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;WAClC,QAAQ,CAAC,CAAC,IAAI,EAAE,WAAW,KAAK,UAAU,CAAC;IAC9D,gGAAgG;;IAEhG,6FAA6F;;;;cAG3D,QAAQ,CAAC,uBAAuB,CAAC;;;gBAC3C,QAAQ,CAAC,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;;QAb/C,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9C,iEAAiE;;cACvC,QAAQ,CAAC,eAAe,CAAC;;;IACnD,6EAA6E;iBACtD,QAAQ,CAAC,WAAW,CAAC;cACxB,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;WAClC,QAAQ,CAAC,CAAC,IAAI,EAAE,WAAW,KAAK,UAAU,CAAC;IAC9D,gGAAgG;;IAEhG,6FAA6F;;;;cAG3D,QAAQ,CAAC,uBAAuB,CAAC;;;gBAC3C,QAAQ,CAAC,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;;;;;;;AAhBjE,wBAgJE"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { defineComponent as E, inject as g, computed as y, shallowRef as u, createVNode as n } from "vue";
|
|
2
|
+
import { useTheme as x } from "../../../core/src/composables/useTheme.mjs";
|
|
3
|
+
import h from "../../../core/src/components/Tooltip.mjs";
|
|
4
|
+
import { VTABLE_GUILD_INJECTION_KEY as F } from "../../../core/src/plugin/index.mjs";
|
|
5
|
+
import { resolveTableThemePreset as B } from "../../../theme/src/presets/index.mjs";
|
|
6
|
+
import { TABLE_CONTEXT_KEY as S } from "../context.mjs";
|
|
7
|
+
import { getByDataIndex as z } from "../composables/useColumns.mjs";
|
|
8
|
+
import { transformBodyCellText as I, resolveCellDisplay as N, getEllipsisConfig as O } from "../utils/cell.mjs";
|
|
9
|
+
import { renderCellDisplay as _ } from "./renderCellDisplay.mjs";
|
|
10
|
+
const V = /* @__PURE__ */ E({
|
|
11
|
+
name: "TableEditFrame",
|
|
12
|
+
props: {
|
|
13
|
+
ui: Object,
|
|
14
|
+
/** 'flow' keeps the DOM of a control that sizes its own cell. */
|
|
15
|
+
layout: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: "flow"
|
|
18
|
+
},
|
|
19
|
+
/** The live bodyCell slot context, when there is a display state to copy. */
|
|
20
|
+
displayCell: Object,
|
|
21
|
+
original: Object,
|
|
22
|
+
sizer: Function,
|
|
23
|
+
/** Reserve one line of text when the hidden layer may be empty; implied without displayCell. */
|
|
24
|
+
strut: Boolean,
|
|
25
|
+
/** Stretch the control to the height of the cell; for multi-line controls. Implies strut. */
|
|
26
|
+
fill: Boolean,
|
|
27
|
+
error: String,
|
|
28
|
+
errorPlacement: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: "inline"
|
|
31
|
+
},
|
|
32
|
+
onFocusout: Function
|
|
33
|
+
},
|
|
34
|
+
setup(t, {
|
|
35
|
+
slots: f,
|
|
36
|
+
expose: b
|
|
37
|
+
}) {
|
|
38
|
+
const T = g(F, null), a = g(S, {}), {
|
|
39
|
+
slots: r
|
|
40
|
+
} = x("table", y(() => B(T?.themePreset ?? "antdv")), t), m = u(null), v = u(null), s = u(!1), c = u(!1);
|
|
41
|
+
b({
|
|
42
|
+
control: v
|
|
43
|
+
});
|
|
44
|
+
const p = y(() => {
|
|
45
|
+
const {
|
|
46
|
+
displayCell: e,
|
|
47
|
+
original: l
|
|
48
|
+
} = t;
|
|
49
|
+
if (!e || !l || l === e.record) return e;
|
|
50
|
+
const {
|
|
51
|
+
column: o,
|
|
52
|
+
index: d
|
|
53
|
+
} = e, i = a.transformCellText;
|
|
54
|
+
return o.dataIndex === void 0 && !i ? {
|
|
55
|
+
...e,
|
|
56
|
+
record: l
|
|
57
|
+
} : I({
|
|
58
|
+
text: z(l, o.dataIndex),
|
|
59
|
+
record: l,
|
|
60
|
+
column: o,
|
|
61
|
+
index: d
|
|
62
|
+
}, i);
|
|
63
|
+
});
|
|
64
|
+
function C() {
|
|
65
|
+
const e = p.value, l = e ? t.sizer ? t.sizer(e) : _(N(e, {
|
|
66
|
+
renderers: a.renderers?.value,
|
|
67
|
+
locale: a.localeName?.value,
|
|
68
|
+
columnEmptyText: a.columnEmptyText?.value
|
|
69
|
+
}), a.subThemeSlots ?? r) : null;
|
|
70
|
+
return n("div", {
|
|
71
|
+
class: [
|
|
72
|
+
r.editSizer(),
|
|
73
|
+
// The ellipsis wrapper stops clipping while editing; the copy clips itself instead.
|
|
74
|
+
e && O(e.column).enabled && r.bodyCellEllipsis()
|
|
75
|
+
],
|
|
76
|
+
"aria-hidden": "true"
|
|
77
|
+
}, [l]);
|
|
78
|
+
}
|
|
79
|
+
return () => {
|
|
80
|
+
const e = t.layout === "stable", l = t.errorPlacement === "tooltip", o = t.error || void 0;
|
|
81
|
+
return n("div", {
|
|
82
|
+
ref: m,
|
|
83
|
+
class: r.editCell(),
|
|
84
|
+
"data-vtg-edit-layout": e ? "stable" : void 0,
|
|
85
|
+
onMouseenter: () => s.value = !0,
|
|
86
|
+
onMouseleave: () => s.value = !1,
|
|
87
|
+
onFocusin: () => c.value = !0,
|
|
88
|
+
onFocusout: (d) => {
|
|
89
|
+
const i = d.relatedTarget;
|
|
90
|
+
(!i || !m.value?.contains(i)) && (c.value = !1), t.onFocusout?.(d);
|
|
91
|
+
}
|
|
92
|
+
}, [e ? C() : null, e && (t.strut || t.fill || !t.displayCell) ? n("span", {
|
|
93
|
+
class: r.editSizer(),
|
|
94
|
+
"data-vtg-edit-strut": "true",
|
|
95
|
+
"aria-hidden": "true"
|
|
96
|
+
}, [""]) : null, n("div", {
|
|
97
|
+
ref: v,
|
|
98
|
+
class: r.editControl(),
|
|
99
|
+
"data-invalid": o ? !0 : void 0,
|
|
100
|
+
"data-vtg-edit-layout": e ? "stable" : void 0,
|
|
101
|
+
"data-vtg-edit-bleed": e && (!o || l) ? "true" : void 0,
|
|
102
|
+
"data-vtg-edit-fill": e && t.fill ? "true" : void 0,
|
|
103
|
+
"data-vtg-edit-error": l ? "tooltip" : void 0
|
|
104
|
+
}, [l ? (
|
|
105
|
+
// The title is never null: Tooltip drops its wrapper without one, which would
|
|
106
|
+
// remount the control and lose focus whenever the error comes or goes.
|
|
107
|
+
n(h, {
|
|
108
|
+
block: !0,
|
|
109
|
+
title: o ?? "",
|
|
110
|
+
placement: "top",
|
|
111
|
+
color: "var(--vtg-cell-error)",
|
|
112
|
+
open: !!o && (s.value || c.value)
|
|
113
|
+
}, {
|
|
114
|
+
default: () => [f.default?.()]
|
|
115
|
+
})
|
|
116
|
+
) : f.default?.()]), o ? n("span", {
|
|
117
|
+
class: r.editError(),
|
|
118
|
+
"data-vtg-edit-layout": e ? "stable" : void 0,
|
|
119
|
+
"data-vtg-edit-error": l ? "tooltip" : void 0,
|
|
120
|
+
role: "alert"
|
|
121
|
+
}, [o]) : null]);
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
export {
|
|
126
|
+
V as default
|
|
127
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableEditLayout.test.d.ts","sourceRoot":"","sources":["../../../../../table/src/components/TableEditLayout.test.ts"],"names":[],"mappings":""}
|