@aplus-frontend/ui 0.1.15 → 0.1.17

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 (117) hide show
  1. package/es/index.mjs +99 -95
  2. package/es/src/ap-form/ap-form-item-group/index.vue.mjs +26 -24
  3. package/es/src/ap-modal/index.d.ts +2 -2
  4. package/es/src/ap-modal/index.mjs +1 -1
  5. package/es/src/ap-modal/{type.d.ts → interface.d.ts} +3 -3
  6. package/es/src/ap-modal/utils/createModal.d.ts +1 -1
  7. package/es/src/ap-table/ap-table.vue.mjs +132 -129
  8. package/es/src/ap-table/interface.d.ts +19 -13
  9. package/es/src/ap-table/utils.d.ts +8340 -1
  10. package/es/src/ap-table/utils.mjs +134 -78
  11. package/es/src/business/ap-batch-action/index.css +2 -0
  12. package/es/src/business/ap-batch-action-group/ApBatchActionGroup.vue.d.ts +13 -0
  13. package/es/src/business/ap-batch-action-group/ApBatchActionGroup.vue.mjs +4 -0
  14. package/es/src/business/ap-batch-action-group/ApBatchActionGroup.vue2.mjs +110 -0
  15. package/es/src/business/ap-batch-action-group/MenuItemGroup.vue.d.ts +17 -0
  16. package/es/src/business/ap-batch-action-group/MenuItemGroup.vue.mjs +4 -0
  17. package/es/src/business/ap-batch-action-group/MenuItemGroup.vue2.mjs +50 -0
  18. package/es/src/business/ap-batch-action-group/interface.d.ts +41 -0
  19. package/es/src/business/ap-batch-action-group/interface.mjs +1 -0
  20. package/es/src/business/ap-image/ApImage.vue.d.ts +65 -0
  21. package/es/src/business/ap-image/ApImage.vue.mjs +4 -0
  22. package/es/src/business/ap-image/ApImage.vue2.mjs +56 -0
  23. package/es/src/business/ap-image/hooks/useOss.d.ts +11 -0
  24. package/es/src/business/ap-image/hooks/useOss.mjs +37 -0
  25. package/es/src/business/ap-image/imgs/admin-fallback.jpg.mjs +4 -0
  26. package/es/src/business/ap-image/imgs/aplus-fallback.jpg.mjs +4 -0
  27. package/es/src/business/index.d.ts +662 -1
  28. package/es/src/business/index.mjs +25 -16
  29. package/es/src/config-provider/config-provider-props.d.ts +5 -1
  30. package/es/src/config-provider/config-provider-props.mjs +4 -0
  31. package/es/src/config-provider/config-provider.d.ts +10 -1
  32. package/es/src/config-provider/config-provider.mjs +18 -17
  33. package/es/src/config-provider/constants.d.ts +6 -2
  34. package/es/src/config-provider/hooks/use-global-config.d.ts +5 -1
  35. package/es/src/config-provider/index.d.ts +20 -1
  36. package/es/src/editable-table/form-item.vue.mjs +85 -71
  37. package/es/src/editable-table/hooks/use-get-columns.d.ts +3 -2
  38. package/es/src/editable-table/hooks/use-get-columns.mjs +32 -32
  39. package/es/src/editable-table/index.vue.mjs +106 -92
  40. package/es/src/editable-table/interface.d.ts +7 -13
  41. package/es/src/editable-table/utils.d.ts +14 -2
  42. package/es/src/editable-table/utils.mjs +67 -57
  43. package/es/src/index.mjs +211 -207
  44. package/es/src/locale/lang/en.mjs +10 -7
  45. package/es/src/locale/lang/zh-cn.mjs +3 -0
  46. package/es/src/pro-form/hooks/use-label-width.d.ts +1 -1
  47. package/es/src/theme/antd-global-overwrite/admin/form.css +10 -5
  48. package/es/src/theme/antd-global-overwrite/admin/index.css +117 -38
  49. package/es/src/theme/antd-global-overwrite/admin/pagination.css +54 -16
  50. package/es/src/theme/antd-global-overwrite/admin/table.css +53 -17
  51. package/es/src/theme/antd-global-overwrite/aplus/form.css +28 -14
  52. package/es/src/theme/antd-global-overwrite/aplus/index.css +159 -67
  53. package/es/src/theme/antd-global-overwrite/aplus/pagination.css +66 -20
  54. package/es/src/theme/antd-global-overwrite/aplus/table.css +65 -33
  55. package/es/src/theme/ap-batch-action/ap-batch-action.css +2 -0
  56. package/es/src/utils/ap-trans-data/index.d.ts +9 -10
  57. package/es/src/utils/ap-trans-data/index.mjs +20 -0
  58. package/lib/index.js +1 -1
  59. package/lib/src/ap-form/ap-form-item-group/index.vue.js +1 -1
  60. package/lib/src/ap-modal/index.d.ts +2 -2
  61. package/lib/src/ap-modal/index.js +1 -1
  62. package/lib/src/ap-modal/{type.d.ts → interface.d.ts} +3 -3
  63. package/lib/src/ap-modal/utils/createModal.d.ts +1 -1
  64. package/lib/src/ap-table/ap-table.vue.js +1 -1
  65. package/lib/src/ap-table/interface.d.ts +19 -13
  66. package/lib/src/ap-table/utils.d.ts +8340 -1
  67. package/lib/src/ap-table/utils.js +1 -1
  68. package/lib/src/business/ap-batch-action/index.css +2 -0
  69. package/lib/src/business/ap-batch-action-group/ApBatchActionGroup.vue.d.ts +13 -0
  70. package/lib/src/business/ap-batch-action-group/ApBatchActionGroup.vue.js +1 -0
  71. package/lib/src/business/ap-batch-action-group/ApBatchActionGroup.vue2.js +1 -0
  72. package/lib/src/business/ap-batch-action-group/MenuItemGroup.vue.d.ts +17 -0
  73. package/lib/src/business/ap-batch-action-group/MenuItemGroup.vue.js +1 -0
  74. package/lib/src/business/ap-batch-action-group/MenuItemGroup.vue2.js +1 -0
  75. package/lib/src/business/ap-batch-action-group/interface.d.ts +41 -0
  76. package/lib/src/business/ap-batch-action-group/interface.js +1 -0
  77. package/lib/src/business/ap-image/ApImage.vue.d.ts +65 -0
  78. package/lib/src/business/ap-image/ApImage.vue.js +1 -0
  79. package/lib/src/business/ap-image/ApImage.vue2.js +1 -0
  80. package/lib/src/business/ap-image/hooks/useOss.d.ts +11 -0
  81. package/lib/src/business/ap-image/hooks/useOss.js +1 -0
  82. package/lib/src/business/ap-image/imgs/admin-fallback.jpg.js +1 -0
  83. package/lib/src/business/ap-image/imgs/aplus-fallback.jpg.js +1 -0
  84. package/lib/src/business/index.d.ts +662 -1
  85. package/lib/src/business/index.js +1 -1
  86. package/lib/src/config-provider/config-provider-props.d.ts +5 -1
  87. package/lib/src/config-provider/config-provider-props.js +1 -1
  88. package/lib/src/config-provider/config-provider.d.ts +10 -1
  89. package/lib/src/config-provider/config-provider.js +1 -1
  90. package/lib/src/config-provider/constants.d.ts +6 -2
  91. package/lib/src/config-provider/hooks/use-global-config.d.ts +5 -1
  92. package/lib/src/config-provider/index.d.ts +20 -1
  93. package/lib/src/editable-table/form-item.vue.js +1 -1
  94. package/lib/src/editable-table/hooks/use-get-columns.d.ts +3 -2
  95. package/lib/src/editable-table/hooks/use-get-columns.js +1 -1
  96. package/lib/src/editable-table/index.vue.js +1 -1
  97. package/lib/src/editable-table/interface.d.ts +7 -13
  98. package/lib/src/editable-table/utils.d.ts +14 -2
  99. package/lib/src/editable-table/utils.js +1 -1
  100. package/lib/src/index.js +1 -1
  101. package/lib/src/locale/lang/en.js +1 -1
  102. package/lib/src/locale/lang/zh-cn.js +1 -1
  103. package/lib/src/pro-form/hooks/use-label-width.d.ts +1 -1
  104. package/lib/src/theme/antd-global-overwrite/admin/form.css +10 -5
  105. package/lib/src/theme/antd-global-overwrite/admin/index.css +117 -38
  106. package/lib/src/theme/antd-global-overwrite/admin/pagination.css +54 -16
  107. package/lib/src/theme/antd-global-overwrite/admin/table.css +53 -17
  108. package/lib/src/theme/antd-global-overwrite/aplus/form.css +28 -14
  109. package/lib/src/theme/antd-global-overwrite/aplus/index.css +159 -67
  110. package/lib/src/theme/antd-global-overwrite/aplus/pagination.css +66 -20
  111. package/lib/src/theme/antd-global-overwrite/aplus/table.css +65 -33
  112. package/lib/src/theme/ap-batch-action/ap-batch-action.css +2 -0
  113. package/lib/src/utils/ap-trans-data/index.d.ts +9 -10
  114. package/lib/src/utils/ap-trans-data/index.js +1 -0
  115. package/package.json +2 -2
  116. /package/es/src/ap-modal/{type.mjs → interface.mjs} +0 -0
  117. /package/lib/src/ap-modal/{type.js → interface.js} +0 -0
@@ -1,16 +1,19 @@
1
- import { defineComponent as W, useSlots as $, ref as v, watch as w, unref as l, openBlock as R, createBlock as G, withCtx as c, createVNode as b, mergeProps as J, createSlots as Q, createElementBlock as X, Fragment as Y, createElementVNode as F, normalizeClass as Z, toDisplayString as ee, createCommentVNode as te, renderList as ae, renderSlot as ne, normalizeProps as oe, guardReactiveProps as le } from "vue";
2
- import { Table as re } from "ant-design-vue";
3
- import { ApForm as p } from "../ap-form/index.mjs";
4
- import { isEqual as se, isArray as B, isNumber as h, cloneDeep as x, omit as ue } from "lodash-unified";
1
+ import { defineComponent as Q, useSlots as J, ref as b, watch as R, unref as n, openBlock as p, createBlock as B, withCtx as m, createVNode as x, mergeProps as X, createSlots as Y, createElementBlock as Z, normalizeClass as ee, createCommentVNode as F, createElementVNode as te, toDisplayString as ae, normalizeStyle as oe, renderList as ne, renderSlot as le, normalizeProps as re, guardReactiveProps as se } from "vue";
2
+ import { Table as ue, Tooltip as ie } from "ant-design-vue";
3
+ import { ApForm as y } from "../ap-form/index.mjs";
4
+ import { isEqual as de, isArray as k, isNumber as g, cloneDeep as h, omit as me } from "lodash-unified";
5
5
  import "../config-provider/index.mjs";
6
6
  import "../hooks/index.mjs";
7
- import { isDef as g } from "../utils/index.mjs";
8
- import { scrollToRowIndex as de, getColumnIsRequired as ie } from "./utils.mjs";
9
- import me from "./hooks/use-get-columns.mjs";
7
+ import { isDef as C } from "../utils/index.mjs";
8
+ import { scrollToRowIndex as fe, getColumnIsRequired as ce } from "./utils.mjs";
9
+ import pe from "./hooks/use-get-columns.mjs";
10
10
  import "./style/index.css";
11
- import { useNamespace as ce } from "../config-provider/hooks/use-namespace.mjs";
12
- import { useControllableValue as fe } from "../hooks/useControllableValue.mjs";
13
- const Ee = /* @__PURE__ */ W({
11
+ import { useToken as xe } from "ant-design-vue/es/theme/internal";
12
+ import { QuestionCircleOutlined as ye } from "@ant-design/icons-vue";
13
+ import { useNamespace as ge } from "../config-provider/hooks/use-namespace.mjs";
14
+ import { useControllableValue as he } from "../hooks/useControllableValue.mjs";
15
+ import { useGlobalConfig as Ce } from "../config-provider/hooks/use-global-config.mjs";
16
+ const Ae = /* @__PURE__ */ Q({
14
17
  name: "EditableTable",
15
18
  __name: "index",
16
19
  props: {
@@ -109,131 +112,142 @@ const Ee = /* @__PURE__ */ W({
109
112
  onFieldChange: {}
110
113
  },
111
114
  emits: ["update:value"],
112
- setup(E, {
113
- expose: N,
114
- emit: V
115
+ setup(V, {
116
+ expose: E,
117
+ emit: L
115
118
  }) {
116
- const o = E, {
117
- b: k,
118
- em: D
119
- } = ce("editable-table"), L = $(), _ = V, C = v(), {
119
+ const l = V, {
120
+ b: N,
121
+ em: T
122
+ } = ge("editable-table"), _ = J(), D = L, v = b(), {
120
123
  value: s,
121
124
  updateValue: S
122
- } = fe(o, _), u = v(), f = p.useWatch(o.name, u);
123
- w(() => f.value, (e) => {
125
+ } = he(l, D), u = b(), [, A] = xe(), z = Ce("valueTypeMap"), c = y.useWatch(l.name, u);
126
+ R(() => c.value, (e) => {
124
127
  var t;
125
- S(e), (t = o.onChange) == null || t.call(o, e);
128
+ S(e), (t = l.onChange) == null || t.call(l, e);
126
129
  }, {
127
130
  deep: !0
128
- }), w(s, (e) => {
131
+ }), R(s, (e) => {
129
132
  var t;
130
- e !== l(f) && (se(e, l(f)) || (t = u.value) == null || t.setFieldValue(o.name, e));
133
+ e !== n(c) && (de(e, n(c)) || (t = u.value) == null || t.setFieldValue(l.name, e));
131
134
  }, {
132
135
  deep: !0
133
136
  });
134
- const A = me(o);
135
- function T() {
137
+ const P = pe(l, z);
138
+ function I() {
136
139
  var e;
137
140
  (e = u.value) == null || e.resetFields();
138
141
  }
139
- function z(e) {
140
- return e ? (B(e) ? e : [e]).map((a) => B(a) ? [o.name, ...a] : [o.name, a]) : void 0;
142
+ function O(e) {
143
+ return e ? (k(e) ? e : [e]).map((a) => k(a) ? [l.name, ...a] : [l.name, a]) : void 0;
141
144
  }
142
- async function I(e, t) {
143
- var n;
144
- const a = await ((n = u.value) == null ? void 0 : n.validateFields(z(e), t));
145
- return a == null ? void 0 : a[o.name];
145
+ async function j(e, t) {
146
+ var o;
147
+ const a = await ((o = u.value) == null ? void 0 : o.validateFields(O(e), t));
148
+ return a == null ? void 0 : a[l.name];
146
149
  }
147
- function P(e, t) {
148
- var r, d, i;
149
- const a = ((r = l(s)) == null ? void 0 : r.length) || 0;
150
- if (g(o.maxLength) && a >= o.maxLength)
150
+ function q(e, t) {
151
+ var r, i, d;
152
+ const a = ((r = n(s)) == null ? void 0 : r.length) || 0;
153
+ if (C(l.maxLength) && a >= l.maxLength)
151
154
  return;
152
- const n = [...l(s) || []];
153
- g(t) ? n.splice(t, 0, {
155
+ const o = [...n(s) || []];
156
+ C(t) ? o.splice(t, 0, {
154
157
  ...e || {}
155
- }) : n.push({
158
+ }) : o.push({
156
159
  ...e || {}
157
- }), (i = (d = u.value) == null ? void 0 : d.setFieldValue) == null || i.call(d, o.name, n);
160
+ }), (d = (i = u.value) == null ? void 0 : i.setFieldValue) == null || d.call(i, l.name, o);
158
161
  }
159
- function j(e, t = "suffix") {
160
- var i, m, y;
161
- const a = ((i = l(s)) == null ? void 0 : i.length) || 0, n = h(e) ? e : e.length;
162
- if (g(o.maxLength) && a + n > o.maxLength)
162
+ function K(e, t = "suffix") {
163
+ var d, f, w;
164
+ const a = ((d = n(s)) == null ? void 0 : d.length) || 0, o = g(e) ? e : e.length;
165
+ if (C(l.maxLength) && a + o > l.maxLength)
163
166
  return;
164
- const r = [...l(s) || []], d = h(e) ? new Array(e).fill({}) : x(e);
165
- t === "suffix" ? r.push(...d) : r.unshift(...d), (y = (m = u.value) == null ? void 0 : m.setFieldValue) == null || y.call(m, o.name, r);
167
+ const r = [...n(s) || []], i = g(e) ? new Array(e).fill({}) : h(e);
168
+ t === "suffix" ? r.push(...i) : r.unshift(...i), (w = (f = u.value) == null ? void 0 : f.setFieldValue) == null || w.call(f, l.name, r);
166
169
  }
167
- function O(e) {
168
- var n, r;
169
- let t = x(l(s) || []);
170
- const a = h(e) ? [e] : e;
171
- t = t.filter((d, i) => !a.includes(i)), (r = (n = u.value) == null ? void 0 : n.setFieldValue) == null || r.call(n, o.name, t);
170
+ function M(e) {
171
+ var o, r;
172
+ let t = h(n(s) || []);
173
+ const a = g(e) ? [e] : e;
174
+ t = t.filter((i, d) => !a.includes(d)), (r = (o = u.value) == null ? void 0 : o.setFieldValue) == null || r.call(o, l.name, t);
172
175
  }
173
- function q() {
174
- return l(s);
176
+ function G() {
177
+ return n(s);
175
178
  }
176
- function K(e) {
179
+ function H(e) {
177
180
  var t;
178
- return (t = l(s)) == null ? void 0 : t[e];
181
+ return (t = n(s)) == null ? void 0 : t[e];
179
182
  }
180
- function H(e, t) {
181
- var n, r;
182
- const a = x(l(s));
183
+ function U(e, t) {
184
+ var o, r;
185
+ const a = h(n(s));
183
186
  a[e] && (a[e] = {
184
187
  ...a[e],
185
188
  ...t
186
- }, (r = (n = u.value) == null ? void 0 : n.setFieldValue) == null || r.call(n, o.name, [...a]));
189
+ }, (r = (o = u.value) == null ? void 0 : o.setFieldValue) == null || r.call(o, l.name, [...a]));
187
190
  }
188
- function M(e, t) {
189
- var n;
191
+ function W(e, t) {
192
+ var o;
190
193
  const a = e === "end" ? s.value.length - 1 : e;
191
- de(a, (n = C.value) == null ? void 0 : n.$el, t);
194
+ fe(a, (o = v.value) == null ? void 0 : o.$el, t);
192
195
  }
193
- function U() {
196
+ function $() {
194
197
  var e, t;
195
- (t = (e = u.value) == null ? void 0 : e.setFieldValue) == null || t.call(e, o.name, []);
198
+ (t = (e = u.value) == null ? void 0 : e.setFieldValue) == null || t.call(e, l.name, []);
196
199
  }
197
- return N({
198
- resetFields: T,
199
- validateFields: I,
200
- add: P,
201
- remove: O,
202
- getRowData: K,
203
- getRowsData: q,
204
- setRowData: H,
205
- addMultiple: j,
206
- scrollTo: M,
207
- clear: U
208
- }), (e, t) => (R(), G(l(p), {
200
+ return E({
201
+ resetFields: I,
202
+ validateFields: j,
203
+ add: q,
204
+ remove: M,
205
+ getRowData: H,
206
+ getRowsData: G,
207
+ setRowData: U,
208
+ addMultiple: K,
209
+ scrollTo: W,
210
+ clear: $
211
+ }), (e, t) => (p(), B(n(y), {
209
212
  "initial-values": {
210
- [o.name]: l(s)
213
+ [l.name]: n(s)
211
214
  },
212
215
  ref_key: "formRef",
213
216
  ref: u
214
217
  }, {
215
- default: c(() => [b(l(p).FormItem, {
218
+ default: m(() => [x(n(y).FormItem, {
216
219
  name: e.name,
217
220
  "no-style": ""
218
221
  }, {
219
- default: c(() => [b(l(re), J(l(ue)(o, ["name", "value", "onUpdate:value", "maxLength", "onChange"]), {
220
- class: l(k)(),
221
- columns: l(A),
222
- "data-source": l(s),
222
+ default: m(() => [x(n(ue), X(n(me)(l, ["name", "value", "onUpdate:value", "maxLength", "onChange"]), {
223
+ class: n(N)(),
224
+ columns: n(P),
225
+ "data-source": n(s),
223
226
  ref_key: "tableRef",
224
- ref: C
225
- }), Q({
226
- headerCell: c(({
227
+ ref: v
228
+ }), Y({
229
+ headerCell: m(({
227
230
  column: a
228
- }) => [l(ie)(a) ? (R(), X(Y, {
229
- key: 0
230
- }, [F("span", {
231
- class: Z(l(D)("header-cell", "required"))
232
- }, "*", 2), F("span", null, ee(a.title), 1)], 64)) : te("", !0)]),
231
+ }) => [n(ce)(a) ? (p(), Z("span", {
232
+ key: 0,
233
+ class: ee(n(T)("header-cell", "required"))
234
+ }, "*", 2)) : F("", !0), te("span", null, ae(a.title), 1), a.tooltip ? (p(), B(n(ie), {
235
+ key: 1,
236
+ title: a.tooltip,
237
+ placement: "bottom"
238
+ }, {
239
+ default: m(() => [x(n(ye), {
240
+ style: oe({
241
+ paddingLeft: "4px",
242
+ color: n(A).colorPrimary
243
+ })
244
+ }, null, 8, ["style"])]),
245
+ _: 2
246
+ }, 1032, ["title"])) : F("", !0)]),
233
247
  _: 2
234
- }, [ae(L, (a, n) => ({
235
- name: n,
236
- fn: c((r) => [ne(e.$slots, n, oe(le(r || {})))])
248
+ }, [ne(_, (a, o) => ({
249
+ name: o,
250
+ fn: m((r) => [le(e.$slots, o, re(se(r || {})))])
237
251
  }))]), 1040, ["class", "columns", "data-source"])]),
238
252
  _: 3
239
253
  }, 8, ["name"])]),
@@ -242,5 +256,5 @@ const Ee = /* @__PURE__ */ W({
242
256
  }
243
257
  });
244
258
  export {
245
- Ee as default
259
+ Ae as default
246
260
  };
@@ -1,13 +1,14 @@
1
1
  import { ColumnType, TableProps } from 'ant-design-vue/es/table';
2
- import { ApTableValueFields, ApTableValueTypes, ValueEnum } from '../ap-table';
2
+ import { ApTableValueFields, ApTableValueTypes, CommonFieldReturnType, FieldPropsType, ValueEnum } from '../ap-table';
3
3
  import { NamePath, ValidateOptions } from 'ant-design-vue/es/form/interface';
4
4
  import { DataIndex } from 'ant-design-vue/es/vc-table/interface';
5
5
  import { FormItemProps } from 'ant-design-vue';
6
6
  import { VNode } from 'vue';
7
7
  import { EllipsisConfig } from 'ant-design-vue/es/typography/Base';
8
8
  import { StandardBehaviorOptions } from '../../node_modules/scroll-into-view-if-needed';
9
- export type EditableColumnType<RecordType = any, ValueType extends ApTableValueTypes = ApTableValueTypes> = ValueType extends ApTableValueTypes ? Omit<ColumnType<RecordType>, 'children' | 'customRender' | 'ellipsis'> & {
10
- children?: EditableColumnType<RecordType, ValueType>;
9
+ import { Recordable } from '../type';
10
+ export type EditableColumnType<RecordType = any, ExtraValueType = 'text', ValueType extends ApTableValueTypes = ApTableValueTypes, MergedValueType extends ExtraValueType | ValueType = ExtraValueType | ValueType> = MergedValueType extends ExtraValueType | ValueType ? Omit<ColumnType<RecordType>, 'children' | 'customRender' | 'ellipsis'> & {
11
+ children?: EditableColumnType<RecordType, ExtraValueType, ValueType, MergedValueType>;
11
12
  /**
12
13
  * 在title之后展示一个icon并触发tooltip
13
14
  */
@@ -31,22 +32,15 @@ export type EditableColumnType<RecordType = any, ValueType extends ApTableValueT
31
32
  /**
32
33
  * 自定义表单,适用于内置`valueType`不满足的情况下使用
33
34
  */
34
- customRenderFormItem?: (config: EditableColumnType<RecordType, ValueType>, fieldProps: Record<string, any>, editable: boolean) => any;
35
+ customRenderFormItem?: (config: EditableColumnType<RecordType>, fieldProps: Recordable, editable: boolean) => any;
35
36
  /**
36
37
  * 指定值类型(将会用于普通列和可编辑表格的渲染)
37
38
  */
38
- valueType?: ValueType;
39
+ valueType?: MergedValueType;
39
40
  /**
40
41
  * 值类型额外配置的参数(支持函数)
41
42
  */
42
- fieldProps?: ApTableValueFields[ValueType] | ((opt: {
43
- value: any;
44
- text: any;
45
- record: RecordType;
46
- index: number;
47
- renderIndex: number;
48
- column: EditableColumnType<RecordType, ValueType>;
49
- }) => ApTableValueFields[ValueType]);
43
+ fieldProps?: FieldPropsType<Extract<MergedValueType, ValueType> extends never ? CommonFieldReturnType : ApTableValueFields[Extract<MergedValueType, ValueType>], RecordType, ExtraValueType, ValueType, MergedValueType>;
50
44
  /**
51
45
  * 自定义渲染,添加了`editable`以及`originalNode`
52
46
  * @param opt
@@ -1,5 +1,6 @@
1
1
  import { EditableColumnType } from './interface';
2
2
  import { StandardBehaviorOptions } from '../../node_modules/scroll-into-view-if-needed';
3
+ import { ValueTypeRenderConfig } from '../config-provider';
3
4
  /**
4
5
  * 获取编辑模式下默认映射的组件
5
6
  * @param valueType
@@ -8,10 +9,11 @@ import { StandardBehaviorOptions } from '../../node_modules/scroll-into-view-if-
8
9
  export declare function getEditableComponent(valueType: EditableColumnType['valueType']): any;
9
10
  /**
10
11
  * 获取可编辑表格的某列字段是否是required
12
+ * @description 请注意,此方法只根据`fieldProps.required`和`fieldProps.rules`来判断,并不会关注当前列是否可以渲染编辑节点
11
13
  * @param column
12
14
  * @returns
13
15
  */
14
- export declare function getColumnIsRequired(column: EditableColumnType<any, 'text'>): boolean;
16
+ export declare function getColumnIsRequired(column: EditableColumnType<any, 'tex', 'text'>): boolean;
15
17
  /**
16
18
  * 获取ellipsis模式下最终需要渲染的字符串
17
19
  * @param column
@@ -27,4 +29,14 @@ export declare function mergeClass(current: string, classNames?: string | string
27
29
  * @param options
28
30
  */
29
31
  export declare function scrollToRowIndex(index: number, container?: HTMLElement, options?: StandardBehaviorOptions): void;
30
- export declare function getFinalNode(column: EditableColumnType, editable: boolean, innerProps: Record<string, any>, value: any): any;
32
+ /**
33
+ * 获取最终需要渲染到单元格的节点
34
+ * @param column 表格列配置
35
+ * @param editable 是否可编辑
36
+ * @param innerProps props
37
+ * @param value 当前表格映射的值
38
+ * @param record 当前行数据
39
+ * @param extraValueTypes 自定义valueType映射
40
+ * @returns
41
+ */
42
+ export declare function getFinalNode(column: EditableColumnType, editable: boolean, innerProps: Record<string, any>, value: any, record: any, extraRenderMap?: Record<string, ValueTypeRenderConfig>): any;
@@ -1,90 +1,100 @@
1
- import { isVNode as f, createVNode as s, mergeProps as d } from "vue";
2
- import { isFunction as n, isArray as p, isBoolean as a, omit as u } from "lodash-unified";
3
- import { apTableFormItemMap as c, noRenderAsFormItemValueList as y, apTableRenderItemMap as m } from "../ap-table/constants.mjs";
4
- import { isDef as b } from "../utils/index.mjs";
5
- import { getValueStr as g } from "../ap-field/number/helper.mjs";
6
- import T from "scroll-into-view-if-needed";
7
- import { Typography as C } from "ant-design-vue";
1
+ import { isVNode as F, createVNode as f, mergeProps as g } from "vue";
2
+ import { isFunction as b, isArray as T, isBoolean as h, omit as P } from "lodash-unified";
3
+ import { apTableFormItemMap as V, noRenderAsFormItemValueList as j, apTableRenderItemMap as q } from "../ap-table/constants.mjs";
4
+ import { isDef as w } from "../utils/index.mjs";
5
+ import { getValueStr as S } from "../ap-field/number/helper.mjs";
6
+ import A from "scroll-into-view-if-needed";
7
+ import { Typography as v } from "ant-design-vue";
8
8
  import "../ap-form/index.mjs";
9
- import I from "../ap-form/ap-form-item.vue.mjs";
10
- function P(e) {
11
- return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !f(e);
9
+ import { objectToString as C } from "../ap-table/utils.mjs";
10
+ import m from "../ap-form/ap-form-item.vue.mjs";
11
+ function y(e) {
12
+ return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !F(e);
12
13
  }
13
- function R(e) {
14
- return c[e];
14
+ function N(e) {
15
+ return V[e];
15
16
  }
16
- function _(e) {
17
+ function Q(e) {
17
18
  if (!e.fieldProps)
18
19
  return !1;
19
- const r = n(e.fieldProps) ? e.fieldProps({}) : e.fieldProps;
20
- return b(r.required) ? r.required : (p(r.rules) ? r.rules : r.rules ? [r.rules] : []).some((t) => t.required);
20
+ const t = b(e.fieldProps) ? e.fieldProps({}) : e.fieldProps;
21
+ return w(t.required) ? t.required : (T(t.rules) ? t.rules : t.rules ? [t.rules] : []).some((r) => r.required);
21
22
  }
22
- function F(e, r) {
23
+ function _(e, t) {
23
24
  if (e.valueType === "text" || e.valueType === "textArea")
24
- return r || "--";
25
+ return t || "--";
25
26
  if (e.valueType === "number") {
26
- const o = e.fieldProps ? n(e.fieldProps) ? e.fieldProps({}) : e.fieldProps : {};
27
- return g(r, o) || "--";
27
+ const o = e.fieldProps ? b(e.fieldProps) ? e.fieldProps({}) : e.fieldProps : {};
28
+ return S(t, o) || "--";
28
29
  }
29
- return r;
30
+ return C(t);
30
31
  }
31
- function D(e, r) {
32
+ function R(e, t) {
32
33
  const o = [e];
33
- if (r) {
34
- const t = p(r) ? r : [r];
35
- o.unshift(...t);
34
+ if (t) {
35
+ const r = T(t) ? t : [t];
36
+ o.unshift(...r);
36
37
  }
37
38
  return o.join(" ");
38
39
  }
39
- function N(e, r = document.body, o = {}) {
40
- const t = r.querySelectorAll("tr.ant-table-row")[e];
41
- t && T(t, {
40
+ function U(e, t = document.body, o = {}) {
41
+ const r = t.querySelectorAll("tr.ant-table-row")[e];
42
+ r && A(r, {
42
43
  scrollMode: "if-needed",
43
44
  block: "nearest",
44
45
  behavior: "smooth",
45
46
  ...o
46
47
  });
47
48
  }
48
- function V(e, r, o) {
49
- return y.includes(e.valueType) ? o : e.copyable || e.ellipsis ? s(C.Paragraph, {
49
+ function D(e, t, o) {
50
+ return j.includes(e.valueType) ? o : e.copyable || e.ellipsis ? f(v.Paragraph, {
50
51
  copyable: e.copyable ? {
51
- text: r,
52
+ text: t,
52
53
  tooltip: !1
53
54
  } : !1,
54
- ellipsis: e.ellipsis ? a(e.ellipsis) ? {
55
- tooltip: r
55
+ ellipsis: e.ellipsis ? h(e.ellipsis) ? {
56
+ tooltip: t
56
57
  } : {
57
58
  ...e.ellipsis,
58
- tooltip: r
59
+ tooltip: t
59
60
  } : !1,
60
- content: e.ellipsis ? F(e, r) : o
61
+ content: e.ellipsis ? _(e, t) : o
61
62
  }, null) : o;
62
63
  }
63
- function O(e, r, o, t) {
64
- let l;
65
- if (e.valueType)
66
- if (r) {
67
- const i = R(e.valueType);
68
- l = s(i, o, null);
69
- } else {
70
- const i = m[e.valueType];
71
- l = V(e, t, s(i, d(o.field, {
72
- mode: "read"
73
- }), null));
64
+ function W(e, t, o, r, I, i) {
65
+ var c, a;
66
+ if (t) {
67
+ if (e.customRenderFormItem) {
68
+ const n = e.customRenderFormItem(e, o.field, t);
69
+ return f(m, P(o, ["field"]), y(n) ? n : {
70
+ default: () => [n]
71
+ });
74
72
  }
75
- if (e.customRenderFormItem) {
76
- const i = e.customRenderFormItem(e, o.field, r);
77
- l = s(I, u(o, ["field"]), P(i) ? i : {
78
- default: () => [i]
79
- });
73
+ const l = N(e.valueType);
74
+ if (l)
75
+ return f(l, o, null);
76
+ const s = i == null ? void 0 : i[e.valueType], u = (c = s == null ? void 0 : s.renderFormItem) == null ? void 0 : c.call(s, o.field);
77
+ return u ? f(m, o, y(u) ? u : {
78
+ default: () => [u]
79
+ }) : null;
80
80
  }
81
- return l;
81
+ let p;
82
+ const d = q[e.valueType];
83
+ if (d)
84
+ p = f(d, g(o.field, {
85
+ mode: "read"
86
+ }), null);
87
+ else {
88
+ const l = i == null ? void 0 : i[e.valueType];
89
+ p = (a = l == null ? void 0 : l.render) == null ? void 0 : a.call(l, r, I, o.field);
90
+ }
91
+ return p ? D(e, r, p) : null;
82
92
  }
83
93
  export {
84
- _ as getColumnIsRequired,
85
- R as getEditableComponent,
86
- O as getFinalNode,
87
- F as getRawDisplayValue,
88
- D as mergeClass,
89
- N as scrollToRowIndex
94
+ Q as getColumnIsRequired,
95
+ N as getEditableComponent,
96
+ W as getFinalNode,
97
+ _ as getRawDisplayValue,
98
+ R as mergeClass,
99
+ U as scrollToRowIndex
90
100
  };