@vtable-guild/vtable-guild 2.9.0-alpha.9 → 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.
Files changed (124) hide show
  1. package/css/index.css +114 -9
  2. package/css/presets/antdv.css +3 -0
  3. package/css/presets/element-plus.css +3 -0
  4. package/css/style.css +363 -17
  5. package/css/tailwind3-utilities.css +190 -6
  6. package/css/tailwind3.css +173 -11
  7. package/css/tailwind4.css +173 -11
  8. package/css/transitions.css +53 -2
  9. package/dist/core/src/utils/types.d.ts +3 -0
  10. package/dist/core/src/utils/types.d.ts.map +1 -1
  11. package/dist/css/index.css +114 -9
  12. package/dist/css/presets/antdv.css +3 -0
  13. package/dist/css/presets/element-plus.css +3 -0
  14. package/dist/css/style.css +363 -17
  15. package/dist/css/tailwind3-utilities.css +190 -6
  16. package/dist/css/tailwind3.css +173 -11
  17. package/dist/css/tailwind4.css +173 -11
  18. package/dist/css/transitions.css +53 -2
  19. package/dist/icons/src/EditOutlinedIcon.d.ts +3 -0
  20. package/dist/icons/src/EditOutlinedIcon.d.ts.map +1 -0
  21. package/dist/icons/src/EditOutlinedIcon.mjs +9 -0
  22. package/dist/icons/src/index.d.ts +1 -0
  23. package/dist/icons/src/index.d.ts.map +1 -1
  24. package/dist/index.full.mjs +8812 -7126
  25. package/dist/index.mjs +112 -106
  26. package/dist/table/src/components/Table.d.ts +1 -1
  27. package/dist/table/src/components/TableCell.d.ts.map +1 -1
  28. package/dist/table/src/components/TableCell.mjs +118 -147
  29. package/dist/table/src/components/TableEditFrame.d.ts +58 -0
  30. package/dist/table/src/components/TableEditFrame.d.ts.map +1 -0
  31. package/dist/table/src/components/TableEditFrame.mjs +127 -0
  32. package/dist/table/src/components/TableEditLayout.test.d.ts +2 -0
  33. package/dist/table/src/components/TableEditLayout.test.d.ts.map +1 -0
  34. package/dist/table/src/components/TableEditableCell.d.ts +46 -9
  35. package/dist/table/src/components/TableEditableCell.d.ts.map +1 -1
  36. package/dist/table/src/components/TableEditableCell.mjs +99 -22
  37. package/dist/table/src/components/TableLightFilter.d.ts.map +1 -1
  38. package/dist/table/src/components/TableLightFilter.mjs +53 -51
  39. package/dist/table/src/components/TableQuery.d.ts +6 -0
  40. package/dist/table/src/components/TableQuery.d.ts.map +1 -1
  41. package/dist/table/src/components/TableQuery.mjs +396 -225
  42. package/dist/table/src/components/TableQueryNative.test.d.ts +2 -0
  43. package/dist/table/src/components/TableQueryNative.test.d.ts.map +1 -0
  44. package/dist/table/src/components/TableSelectionAlert.d.ts +1 -1
  45. package/dist/table/src/components/TableSelectionAlert.d.ts.map +1 -1
  46. package/dist/table/src/components/TableSelectionAlert.mjs +109 -55
  47. package/dist/table/src/components/VTableEditCell.test.d.ts +2 -0
  48. package/dist/table/src/components/VTableEditCell.test.d.ts.map +1 -0
  49. package/dist/table/src/components/VTableEditCell.vue.d.ts +18 -3
  50. package/dist/table/src/components/VTableEditCell.vue.d.ts.map +1 -1
  51. package/dist/table/src/components/VTableEditCell.vue.mjs +172 -10
  52. package/dist/table/src/components/VTableEditShell.vue.d.ts +38 -0
  53. package/dist/table/src/components/VTableEditShell.vue.d.ts.map +1 -0
  54. package/dist/table/src/components/VTableEditShell.vue.mjs +37 -0
  55. package/dist/table/src/components/VTableEditShell.vue2.mjs +4 -0
  56. package/dist/table/src/components/VTableQuery.vue.mjs +12 -9
  57. package/dist/table/src/components/VirtualTableBody.mjs +24 -23
  58. package/dist/table/src/components/renderCellDisplay.d.ts +6 -0
  59. package/dist/table/src/components/renderCellDisplay.d.ts.map +1 -0
  60. package/dist/table/src/components/renderCellDisplay.mjs +37 -0
  61. package/dist/table/src/composables/useQueryCollapseMotion.d.ts +4 -0
  62. package/dist/table/src/composables/useQueryCollapseMotion.d.ts.map +1 -0
  63. package/dist/table/src/composables/useQueryCollapseMotion.mjs +48 -0
  64. package/dist/table/src/composables/useQueryCollapseMotion.test.d.ts +2 -0
  65. package/dist/table/src/composables/useQueryCollapseMotion.test.d.ts.map +1 -0
  66. package/dist/table/src/composables/useSelection.d.ts.map +1 -1
  67. package/dist/table/src/composables/useSelection.mjs +157 -148
  68. package/dist/table/src/composables/useTableEdit.d.ts +17 -0
  69. package/dist/table/src/composables/useTableEdit.d.ts.map +1 -1
  70. package/dist/table/src/composables/useTableEdit.mjs +326 -266
  71. package/dist/table/src/composables/useTableEditable.d.ts.map +1 -1
  72. package/dist/table/src/composables/useTableEditable.mjs +321 -89
  73. package/dist/table/src/controls.d.ts.map +1 -1
  74. package/dist/table/src/controls.mjs +161 -69
  75. package/dist/table/src/index.d.ts +2 -0
  76. package/dist/table/src/index.d.ts.map +1 -1
  77. package/dist/table/src/types/controls.d.ts +45 -2
  78. package/dist/table/src/types/controls.d.ts.map +1 -1
  79. package/dist/table/src/types/controls.mjs +4 -0
  80. package/dist/table/src/types/editable.d.ts +78 -4
  81. package/dist/table/src/types/editable.d.ts.map +1 -1
  82. package/dist/table/src/types/editable.typecheck.d.ts.map +1 -1
  83. package/dist/table/src/types/editing.d.ts +5 -2
  84. package/dist/table/src/types/editing.d.ts.map +1 -1
  85. package/dist/table/src/types/query-form.d.ts +11 -3
  86. package/dist/table/src/types/query-form.d.ts.map +1 -1
  87. package/dist/table/src/types/query-form.typecheck.d.ts +4 -0
  88. package/dist/table/src/types/query-form.typecheck.d.ts.map +1 -1
  89. package/dist/table/src/types/table.d.ts +1 -0
  90. package/dist/table/src/types/table.d.ts.map +1 -1
  91. package/dist/table/src/utils/cell.d.ts +18 -12
  92. package/dist/table/src/utils/cell.d.ts.map +1 -1
  93. package/dist/table/src/utils/cell.mjs +95 -94
  94. package/dist/table/src/utils/draftEqual.d.ts +2 -0
  95. package/dist/table/src/utils/draftEqual.d.ts.map +1 -0
  96. package/dist/table/src/utils/draftEqual.mjs +22 -0
  97. package/dist/table/src/utils/queryInlineLayout.d.ts +22 -0
  98. package/dist/table/src/utils/queryInlineLayout.d.ts.map +1 -0
  99. package/dist/table/src/utils/queryInlineLayout.mjs +92 -0
  100. package/dist/table/src/utils/queryInlineLayout.test.d.ts +2 -0
  101. package/dist/table/src/utils/queryInlineLayout.test.d.ts.map +1 -0
  102. package/dist/table/src/utils/snapshot.d.ts +2 -0
  103. package/dist/table/src/utils/snapshot.d.ts.map +1 -1
  104. package/dist/table/src/utils/snapshot.mjs +18 -13
  105. package/dist/theme/src/presets/antdv/table-locale.d.ts +6 -0
  106. package/dist/theme/src/presets/antdv/table-locale.d.ts.map +1 -1
  107. package/dist/theme/src/presets/antdv/table-locale.mjs +16 -2
  108. package/dist/theme/src/presets/antdv/table.d.ts +18 -8
  109. package/dist/theme/src/presets/antdv/table.d.ts.map +1 -1
  110. package/dist/theme/src/presets/antdv/table.mjs +56 -12
  111. package/dist/theme/src/presets/element-plus/table-locale.d.ts +6 -0
  112. package/dist/theme/src/presets/element-plus/table-locale.d.ts.map +1 -1
  113. package/dist/theme/src/presets/element-plus/table-locale.mjs +16 -2
  114. package/dist/theme/src/presets/element-plus/table.d.ts +18 -8
  115. package/dist/theme/src/presets/element-plus/table.d.ts.map +1 -1
  116. package/dist/theme/src/presets/element-plus/table.mjs +57 -10
  117. package/dist/theme/src/query.d.ts +4 -4
  118. package/dist/theme/src/query.mjs +1 -1
  119. package/dist/theme/src/selection-alert.d.ts +8 -0
  120. package/dist/theme/src/selection-alert.d.ts.map +1 -1
  121. package/dist/theme/src/selection-alert.mjs +2 -0
  122. package/dist/vtable-guild/src/index.d.ts +1 -1
  123. package/dist/vtable-guild/src/index.d.ts.map +1 -1
  124. package/package.json +2 -1
@@ -1,20 +1,19 @@
1
- import { defineComponent as te, inject as ne, ref as A, computed as c, createVNode as a, mergeProps as D } from "vue";
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 "../../../icons/src/CheckCircleFilledIcon.mjs";
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 ue } from "../composables/useFixedColumnStyle.mjs";
9
- import { resolveBodyCell as de, getEllipsisConfig as $, omitCellProps as H, isRenderedCell as ie } from "../utils/cell.mjs";
10
- import ve from "./SelectionCheckbox.mjs";
11
- import me from "./SelectionRadio.mjs";
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 Ce from "./TableCopyButton.mjs";
14
- import { isInHoverRange as fe } from "../composables/useHoverState.mjs";
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 Le = /* @__PURE__ */ te({
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 = ne(re, {}), B = A(null), p = A(!1), t = c(() => e.resolvedCell ?? de({
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
- })), j = c(() => {
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: F,
77
- fixedClass: E
78
- } = ue({
79
- fixedInfo: () => j.value
80
- }), W = c(() => $(e.column).enabled ? l.compatClass?.("cell-ellipsis") ?? "" : ""), i = c(() => l.getSelectionState?.(e.record, e.rowIndex) ?? {
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
- }), x = c(() => i.value.checked), h = c(() => fe(e.rowIndex, t.value.rowSpan ?? 1, l.hoverRange?.value ?? null)), _ = c(() => h.value && l.hoverable?.value ? l.compatClass?.("cell-row-hover") ?? "" : "");
85
- function S() {
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, t.value.rowSpan ?? 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 w() {
89
+ function g() {
91
90
  l.hoverable?.value && l.clearHoverRange?.();
92
91
  }
93
- function z(n) {
94
- return (o) => {
95
- S(), typeof n == "function" && n(o);
92
+ function F(n) {
93
+ return (t) => {
94
+ h(), typeof n == "function" && n(t);
96
95
  };
97
96
  }
98
- function V(n) {
99
- return (o) => {
100
- w(), typeof n == "function" && n(o);
97
+ function G(n) {
98
+ return (t) => {
99
+ g(), typeof n == "function" && n(t);
101
100
  };
102
101
  }
103
- const R = c(() => ({
104
- ...H(t.value.renderCellProps),
105
- ...H(t.value.customCellProps)
106
- })), G = c(() => {
107
- const n = e.column.align ? l.vtgClass?.(xe[e.column.align]) ?? "" : "", o = l.subThemeSlots, s = h.value && l.hoverable?.value, v = l.isColumnSorted?.(e.column) && o ? o.tdSorted() : "", f = x.value && o ? C(o.tdSelected(), s ? o.tdRowSelectedHover() : "") : "", k = s && o && !x.value ? o.tdRowHover() : "";
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
- t.value.customCellProps?.class,
113
- t.value.customCellProps?.className,
114
- t.value.renderCellProps?.class,
115
- t.value.renderCellProps?.className,
111
+ o.value.customCellProps?.class,
112
+ o.value.customCellProps?.className,
113
+ o.value.renderCellProps?.class,
114
+ o.value.renderCellProps?.className,
116
115
  v,
117
- f,
118
- k,
119
- E.value,
116
+ x,
117
+ p,
120
118
  _.value,
119
+ R.value,
121
120
  // antdv 把 ellipsis 类放在 td 上,我们的 slot 落在内层 span,故在此补
122
- W.value
121
+ z.value
123
122
  );
124
- }), b = c(() => {
125
- const n = {}, o = l.columnWidths?.[String(K(e.column) ?? e.colIndex)], s = e.widthOverride ?? o ?? e.column.width;
126
- return s && (n.width = typeof s == "number" ? `${s}px` : s), {
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
- ...F.value ?? {},
129
- ...t.value.customCellProps?.style ?? {},
130
- ...t.value.renderCellProps?.style ?? {},
131
- ...l.columnLayout?.columnStyle(e.colIndex, t.value.colSpan || 1)
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 = c(() => l.isTreeData?.value ? l.getFlattenRow?.(e.record) ?? null : null), Y = c(() => l.isTreeData?.value ? l.treeIndentColumnIndex ? e.colIndex === l.treeIndentColumnIndex.value : e.column.key !== "__vtg_selection__" && e.column.key !== "__vtg_expand__" && e.colIndex <= 2 ? (() => {
134
- const n = l.rowSelection?.(), o = l.expandable?.();
135
- let s = 0;
136
- return n && (s += 1), o && o.showExpandColumn !== !1 && (s += 1), e.colIndex === s;
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
- ...b.value,
139
+ ...y.value,
141
140
  ...n ?? {},
142
- ...l.columnLayout?.columnStyle(e.colIndex, t.value.colSpan || 1)
141
+ ...l.columnLayout?.columnStyle(e.colIndex, o.value.colSpan || 1)
143
142
  };
144
143
  }
145
144
  function Q() {
146
- const n = B.value, o = t.value.tooltipText;
147
- p.value = !!(n && o && (n.scrollWidth > n.clientWidth || n.scrollHeight > n.clientHeight));
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
- p.value = !1;
149
+ E.value = !1;
151
150
  }
152
151
  return () => {
153
- if (t.value.colSpan === 0 || t.value.rowSpan === 0)
152
+ if (o.value.colSpan === 0 || o.value.rowSpan === 0)
154
153
  return null;
155
- const n = t.value.colSpan !== 1 ? t.value.colSpan : void 0, o = t.value.rowSpan !== 1 ? t.value.rowSpan : void 0;
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?.(), g = m?.type === "radio" ? a(me, {
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: (u) => l.toggleRow?.(e.record, e.rowIndex, u)
161
- }, null) : a(ve, {
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: (u, T) => l.toggleRow?.(e.record, e.rowIndex, T)
164
+ onChange: (r, T) => l.toggleRow?.(e.record, e.rowIndex, T)
166
165
  }, null);
167
- let d = g, r;
166
+ let u = w, d;
168
167
  if (m?.renderCell) {
169
- const u = m.renderCell(i.value.checked, e.record, e.rowIndex, g);
170
- ie(u) ? (d = u.children, r = u.props) : d = u;
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 y = !!m?.renderCell, I = h.value && l.hoverable?.value, M = C(e.tdClass, l.vtgClass?.(y ? "text-center" : "text-center leading-[0]"), e.column.className, r?.class, r?.className, x.value && l.subThemeSlots ? C(l.subThemeSlots.tdSelected(), I ? l.subThemeSlots.tdRowSelectedHover() : "") : I && l.subThemeSlots ? l.subThemeSlots.tdRowHover() : "", E.value, _.value, l.compatClass?.("selection-column"));
173
- return a("td", D(H(r), {
174
- class: M,
175
- style: J(r?.style),
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: o,
179
- onMouseenter: S,
180
- onMouseleave: w
181
- }), [d]);
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?.(), N = l.getRowKey?.(e.record, e.rowIndex), g = N !== void 0 && (l.isExpanded?.(N) ?? !1), d = l.isRowExpandable?.(e.record) ?? !1, r = l.subThemeSlots, y = h.value && l.hoverable?.value, I = l.isColumnSorted?.(e.column) && r ? r.tdSorted() : "", M = x.value && r ? C(r.tdSelected(), y ? r.tdRowSelectedHover() : "") : "", u = y && r && !x.value ? r.tdRowHover() : "", T = C(e.tdClass, l.vtgClass?.("text-center"), e.column.className, I, M, u, E.value, _.value, l.compatClass?.("row-expand-icon-cell"));
185
- return m?.expandIcon ? a("td", {
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: b.value,
186
+ style: y.value,
188
187
  "data-vtg-col": e.colIndex,
189
188
  colspan: n,
190
- rowspan: o,
191
- onMouseenter: S,
192
- onMouseleave: w
189
+ rowspan: t,
190
+ onMouseenter: h,
191
+ onMouseleave: g
193
192
  }, [m.expandIcon({
194
- expanded: g,
193
+ expanded: w,
195
194
  record: e.record,
196
- expandable: d,
197
- onExpand: (ge, le) => {
198
- le.stopPropagation(), d && l.toggleExpand?.(e.record, e.rowIndex);
195
+ expandable: u,
196
+ onExpand: (fe, le) => {
197
+ le.stopPropagation(), u && l.toggleExpand?.(e.record, e.rowIndex);
199
198
  }
200
- })]) : a("td", {
199
+ })]) : c("td", {
201
200
  class: T,
202
- style: b.value,
201
+ style: y.value,
203
202
  "data-vtg-col": e.colIndex,
204
203
  colspan: n,
205
- rowspan: o,
206
- onMouseenter: S,
207
- onMouseleave: w
208
- }, [a(L, {
209
- expanded: g,
210
- expandable: d,
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
- d && l.toggleExpand?.(e.record, e.rowIndex);
212
+ u && l.toggleExpand?.(e.record, e.rowIndex);
214
213
  }
215
214
  }, null)]);
216
215
  }
217
- const s = X.value, v = Y.value && s, f = v ? l.getRowKey?.(e.record, e.rowIndex) : void 0, k = v ? a("span", {
218
- class: l.compatClass ? `${l.compatClass("row-indent")} indent-level-${s.level}` : void 0,
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: `${s.level * (l.treeIndentSize?.value ?? 15)}px`
220
+ width: `${a.level * (l.treeIndentSize?.value ?? 15)}px`
222
221
  }
223
- }, null) : null, Z = v && s.hasChildren ? a(L, {
224
- expanded: s.expanded,
222
+ }, null) : null, Z = v && a.hasChildren ? c(L, {
223
+ expanded: a.expanded,
225
224
  expandable: !0,
226
225
  variant: "tree",
227
- loading: f !== void 0 && l.isTreeLoading?.(f),
228
- error: f !== void 0 && !!l.getTreeLoadError?.(f),
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 ? a(L, {
229
+ }, null) : v ? c(L, {
231
230
  expanded: !1,
232
231
  expandable: !1,
233
232
  variant: "tree"
234
- }, null) : null, O = $(e.column), ee = v ? l.compatClass?.("cell-with-append") ?? "" : "", P = t.value.presentation === "progress" && t.value.progress ? a("span", {
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: t.value.tooltipText,
235
+ title: o.value.tooltipText,
265
236
  placement: "top",
266
- open: p.value
237
+ open: E.value
267
238
  }, {
268
- default: () => [a("div", {
269
- ref: B,
239
+ default: () => [c("div", {
240
+ ref: O,
270
241
  class: e.bodyCellEllipsisClass,
271
242
  onMouseenter: Q,
272
243
  onMouseleave: U
273
- }, [P])]
274
- }) : a("div", {
244
+ }, [N])]
245
+ }) : c("div", {
275
246
  class: e.bodyCellEllipsisClass
276
- }, [P]) : P;
277
- return a("td", D(R.value, {
278
- class: C(G.value, ee),
279
- style: b.value,
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: o,
283
- onMouseenter: z(R.value.onMouseenter),
284
- onMouseleave: V(R.value.onMouseleave)
285
- }), [k, Z, e.column.copyable ? a("span", {
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, a(Ce, {
258
+ }, [q, c(ve, {
288
259
  column: e.column,
289
260
  record: e.record,
290
261
  rowIndex: e.rowIndex,
291
- defaultText: t.value.copyText
262
+ defaultText: o.value.copyText
292
263
  }, null)]) : q]);
293
264
  };
294
265
  }
295
266
  });
296
267
  export {
297
- Le as default
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,2 @@
1
+ export {};
2
+ //# sourceMappingURL=TableEditLayout.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableEditLayout.test.d.ts","sourceRoot":"","sources":["../../../../../table/src/components/TableEditLayout.test.ts"],"names":[],"mappings":""}