@aplus-frontend/ui 0.1.16 → 0.1.18

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 (104) hide show
  1. package/es/index.mjs +60 -58
  2. package/es/src/ap-download/ap-download.vue.mjs +26 -26
  3. package/es/src/ap-form/ap-form-item-group/index.vue.mjs +26 -24
  4. package/es/src/ap-modal/index.d.ts +2 -2
  5. package/es/src/ap-modal/index.mjs +1 -1
  6. package/es/src/ap-modal/{type.d.ts → interface.d.ts} +3 -3
  7. package/es/src/ap-modal/utils/createModal.d.ts +1 -1
  8. package/es/src/ap-table/ap-table.vue.mjs +40 -40
  9. package/es/src/ap-table/interface.d.ts +2 -3
  10. package/es/src/ap-table/utils.d.ts +1 -1
  11. package/es/src/ap-table/utils.mjs +20 -20
  12. package/es/src/business/ap-batch-action/index.css +2 -0
  13. package/es/src/business/ap-batch-action-group/ApBatchActionGroup.vue.d.ts +13 -0
  14. package/es/src/business/ap-batch-action-group/ApBatchActionGroup.vue.mjs +4 -0
  15. package/es/src/business/ap-batch-action-group/ApBatchActionGroup.vue2.mjs +110 -0
  16. package/es/src/business/ap-batch-action-group/MenuItemGroup.vue.d.ts +17 -0
  17. package/es/src/business/ap-batch-action-group/MenuItemGroup.vue.mjs +4 -0
  18. package/es/src/business/ap-batch-action-group/MenuItemGroup.vue2.mjs +50 -0
  19. package/es/src/business/ap-batch-action-group/interface.d.ts +41 -0
  20. package/es/src/business/ap-batch-action-group/interface.mjs +1 -0
  21. package/es/src/business/ap-image/ApImage.vue.d.ts +65 -0
  22. package/es/src/business/ap-image/ApImage.vue.mjs +4 -0
  23. package/es/src/business/ap-image/ApImage.vue2.mjs +56 -0
  24. package/es/src/business/ap-image/hooks/useOss.d.ts +11 -0
  25. package/es/src/business/ap-image/hooks/useOss.mjs +37 -0
  26. package/es/src/business/ap-image/imgs/admin-fallback.jpg.mjs +4 -0
  27. package/es/src/business/ap-image/imgs/aplus-fallback.jpg.mjs +4 -0
  28. package/es/src/business/ap-label/ApLabel.d.ts +141 -0
  29. package/es/src/business/ap-label/ApLabel.mjs +49 -0
  30. package/es/src/business/ap-label/ApLabelGroup.mjs +11 -12
  31. package/es/src/business/ap-label/constans.d.ts +65 -1
  32. package/es/src/business/ap-label/constans.mjs +33 -2
  33. package/es/src/business/ap-label/index.d.ts +1 -1
  34. package/es/src/business/ap-label/interface.d.ts +2 -1
  35. package/es/src/business/index.d.ts +815 -164
  36. package/es/src/business/index.mjs +26 -20
  37. package/es/src/config-provider/constants.d.ts +1 -1
  38. package/es/src/editable-table/form-item.vue.mjs +47 -46
  39. package/es/src/editable-table/hooks/use-get-columns.d.ts +3 -2
  40. package/es/src/editable-table/hooks/use-get-columns.mjs +32 -32
  41. package/es/src/editable-table/index.vue.mjs +81 -80
  42. package/es/src/editable-table/interface.d.ts +7 -13
  43. package/es/src/editable-table/utils.d.ts +14 -2
  44. package/es/src/editable-table/utils.mjs +67 -58
  45. package/es/src/index.mjs +202 -200
  46. package/es/src/locale/lang/en.mjs +10 -7
  47. package/es/src/locale/lang/zh-cn.mjs +3 -0
  48. package/es/src/theme/ap-batch-action/ap-batch-action.css +2 -0
  49. package/lib/index.js +1 -1
  50. package/lib/src/ap-download/ap-download.vue.js +1 -1
  51. package/lib/src/ap-form/ap-form-item-group/index.vue.js +1 -1
  52. package/lib/src/ap-modal/index.d.ts +2 -2
  53. package/lib/src/ap-modal/index.js +1 -1
  54. package/lib/src/ap-modal/{type.d.ts → interface.d.ts} +3 -3
  55. package/lib/src/ap-modal/utils/createModal.d.ts +1 -1
  56. package/lib/src/ap-table/ap-table.vue.js +1 -1
  57. package/lib/src/ap-table/interface.d.ts +2 -3
  58. package/lib/src/ap-table/utils.d.ts +1 -1
  59. package/lib/src/ap-table/utils.js +1 -1
  60. package/lib/src/business/ap-batch-action/index.css +2 -0
  61. package/lib/src/business/ap-batch-action-group/ApBatchActionGroup.vue.d.ts +13 -0
  62. package/lib/src/business/ap-batch-action-group/ApBatchActionGroup.vue.js +1 -0
  63. package/lib/src/business/ap-batch-action-group/ApBatchActionGroup.vue2.js +1 -0
  64. package/lib/src/business/ap-batch-action-group/MenuItemGroup.vue.d.ts +17 -0
  65. package/lib/src/business/ap-batch-action-group/MenuItemGroup.vue.js +1 -0
  66. package/lib/src/business/ap-batch-action-group/MenuItemGroup.vue2.js +1 -0
  67. package/lib/src/business/ap-batch-action-group/interface.d.ts +41 -0
  68. package/lib/src/business/ap-batch-action-group/interface.js +1 -0
  69. package/lib/src/business/ap-image/ApImage.vue.d.ts +65 -0
  70. package/lib/src/business/{ap-label/ApLabel.vue.js → ap-image/ApImage.vue.js} +1 -1
  71. package/lib/src/business/ap-image/ApImage.vue2.js +1 -0
  72. package/lib/src/business/ap-image/hooks/useOss.d.ts +11 -0
  73. package/lib/src/business/ap-image/hooks/useOss.js +1 -0
  74. package/lib/src/business/ap-image/imgs/admin-fallback.jpg.js +1 -0
  75. package/lib/src/business/ap-image/imgs/aplus-fallback.jpg.js +1 -0
  76. package/lib/src/business/ap-label/ApLabel.d.ts +141 -0
  77. package/lib/src/business/ap-label/ApLabel.js +1 -0
  78. package/lib/src/business/ap-label/ApLabelGroup.js +1 -1
  79. package/lib/src/business/ap-label/constans.d.ts +65 -1
  80. package/lib/src/business/ap-label/constans.js +1 -1
  81. package/lib/src/business/ap-label/index.d.ts +1 -1
  82. package/lib/src/business/ap-label/interface.d.ts +2 -1
  83. package/lib/src/business/index.d.ts +815 -164
  84. package/lib/src/business/index.js +1 -1
  85. package/lib/src/config-provider/constants.d.ts +1 -1
  86. package/lib/src/editable-table/form-item.vue.js +1 -1
  87. package/lib/src/editable-table/hooks/use-get-columns.d.ts +3 -2
  88. package/lib/src/editable-table/hooks/use-get-columns.js +1 -1
  89. package/lib/src/editable-table/index.vue.js +1 -1
  90. package/lib/src/editable-table/interface.d.ts +7 -13
  91. package/lib/src/editable-table/utils.d.ts +14 -2
  92. package/lib/src/editable-table/utils.js +1 -1
  93. package/lib/src/index.js +1 -1
  94. package/lib/src/locale/lang/en.js +1 -1
  95. package/lib/src/locale/lang/zh-cn.js +1 -1
  96. package/lib/src/theme/ap-batch-action/ap-batch-action.css +2 -0
  97. package/package.json +3 -3
  98. package/es/src/business/ap-label/ApLabel.vue.d.ts +0 -56
  99. package/es/src/business/ap-label/ApLabel.vue.mjs +0 -4
  100. package/es/src/business/ap-label/ApLabel.vue2.mjs +0 -85
  101. package/lib/src/business/ap-label/ApLabel.vue.d.ts +0 -56
  102. package/lib/src/business/ap-label/ApLabel.vue2.js +0 -1
  103. /package/es/src/ap-modal/{type.mjs → interface.mjs} +0 -0
  104. /package/lib/src/ap-modal/{type.js → interface.js} +0 -0
@@ -1,35 +1,41 @@
1
1
  import { withInstall as o } from "@aplus-frontend/utils";
2
2
  import "./title/ApTitle.vue.mjs";
3
3
  import "./expandAlert/ApExpandAlert.vue.mjs";
4
- import "./ap-label/ApLabel.vue.mjs";
5
- import t from "./ap-label/ApLabelGroup.mjs";
4
+ import t from "./ap-label/ApLabel.mjs";
5
+ import m from "./ap-label/ApLabelGroup.mjs";
6
6
  import "./ap-status/ApStatus.vue.mjs";
7
7
  import "./ap-status/ApStatusGroup.vue.mjs";
8
8
  import "./ap-select-layout/select-layout.vue.mjs";
9
9
  import "./ap-export-group/ApExportGroup.vue.mjs";
10
10
  import "./ap-input-radio/ApInputRadio.vue.mjs";
11
11
  import "./ap-batch-action/ApBatchAction.vue.mjs";
12
- import { ApTransformDataHelper as M } from "../utils/ap-trans-data/index.mjs";
13
- import r from "./title/ApTitle.vue2.mjs";
14
- import m from "./expandAlert/ApExpandAlert.vue2.mjs";
15
- import p from "./ap-label/ApLabel.vue2.mjs";
12
+ import "./ap-batch-action-group/ApBatchActionGroup.vue.mjs";
13
+ import "./ap-image/ApImage.vue.mjs";
14
+ import { ApTransformDataHelper as X } from "../utils/ap-trans-data/index.mjs";
15
+ import "./ap-batch-action-group/interface.mjs";
16
+ import p from "./title/ApTitle.vue2.mjs";
17
+ import r from "./expandAlert/ApExpandAlert.vue2.mjs";
16
18
  import i from "./ap-status/ApStatus.vue2.mjs";
17
19
  import n from "./ap-status/ApStatusGroup.vue2.mjs";
18
- import s from "./ap-select-layout/select-layout.vue2.mjs";
20
+ import c from "./ap-select-layout/select-layout.vue2.mjs";
19
21
  import a from "./ap-export-group/ApExportGroup.vue2.mjs";
20
- import c from "./ap-input-radio/ApInputRadio.vue2.mjs";
22
+ import s from "./ap-input-radio/ApInputRadio.vue2.mjs";
21
23
  import f from "./ap-batch-action/ApBatchAction.vue2.mjs";
22
- const H = o(r), R = m, g = o(p), j = o(i), k = o(n), q = o(s), v = o(a), z = c, C = f, F = t;
24
+ import _ from "./ap-batch-action-group/ApBatchActionGroup.vue2.mjs";
25
+ import A from "./ap-image/ApImage.vue2.mjs";
26
+ const v = o(p), z = r, C = o(t), F = o(i), J = o(n), K = o(c), M = o(a), N = s, O = f, P = m, Q = _, U = A;
23
27
  export {
24
- C as ApBatchAction,
25
- R as ApExpandAlert,
26
- v as ApExportGroup,
27
- z as ApInputRadio,
28
- g as ApLabel,
29
- F as ApLabelGroup,
30
- q as ApSelectLayout,
31
- j as ApStatus,
32
- k as ApStatusGroup,
33
- H as ApTitle,
34
- M as ApTransformDataHelper
28
+ O as ApBatchAction,
29
+ Q as ApBatchActionGroup,
30
+ z as ApExpandAlert,
31
+ M as ApExportGroup,
32
+ U as ApImage,
33
+ N as ApInputRadio,
34
+ C as ApLabel,
35
+ P as ApLabelGroup,
36
+ K as ApSelectLayout,
37
+ F as ApStatus,
38
+ J as ApStatusGroup,
39
+ v as ApTitle,
40
+ X as ApTransformDataHelper
35
41
  };
@@ -39,7 +39,7 @@ export type ApUploadConfig = {
39
39
  accept?: string;
40
40
  };
41
41
  export type ValueTypeRenderConfig = {
42
- render?: (text: any, renderProps: Recordable) => VNode;
42
+ render?: (text: any, record: Recordable, renderProps: Recordable) => VNode;
43
43
  renderFormItem?: (fieldProps: Recordable) => VNode;
44
44
  };
45
45
  export type ApDescriptionsConfig = {
@@ -1,17 +1,18 @@
1
- import { defineComponent as K, ref as y, unref as o, useSlots as q, watch as H, openBlock as u, createBlock as C, mergeProps as b, withCtx as m, createVNode as w, createSlots as I, createElementBlock as W, normalizeClass as $, createCommentVNode as R, createElementVNode as G, toDisplayString as M, normalizeStyle as Q, renderList as U, renderSlot as J, normalizeProps as X, guardReactiveProps as Y } from "vue";
2
- import { Table as Z, Tooltip as ee } from "ant-design-vue";
1
+ import { defineComponent as q, ref as y, unref as o, useSlots as G, watch as H, openBlock as d, createBlock as C, mergeProps as b, withCtx as m, createVNode as w, createSlots as I, createElementBlock as M, normalizeClass as W, createCommentVNode as R, createElementVNode as $, toDisplayString as Q, normalizeStyle as U, renderList as J, renderSlot as X, normalizeProps as Y, guardReactiveProps as Z } from "vue";
2
+ import { Table as ee, Tooltip as oe } from "ant-design-vue";
3
3
  import { ApForm as B } from "../ap-form/index.mjs";
4
- import { isNumber as i, cloneDeep as f, omit as oe } from "lodash-unified";
4
+ import { isNumber as i, cloneDeep as f, omit as te } from "lodash-unified";
5
5
  import "../config-provider/index.mjs";
6
- import { useInjectForm as te } from "../ap-form/context.mjs";
6
+ import { useInjectForm as ae } from "../ap-form/context.mjs";
7
7
  import "./style/index.css";
8
8
  import { isDef as p } from "../utils/index.mjs";
9
- import ae from "./hooks/use-get-columns.mjs";
10
- import { scrollToRowIndex as le, getColumnIsRequired as ne } from "./utils.mjs";
11
- import { QuestionCircleOutlined as re } from "@ant-design/icons-vue";
12
- import { useToken as se } from "ant-design-vue/es/theme/internal";
13
- import { useNamespace as de } from "../config-provider/hooks/use-namespace.mjs";
14
- const Re = /* @__PURE__ */ K({
9
+ import le from "./hooks/use-get-columns.mjs";
10
+ import { scrollToRowIndex as ne, getColumnIsRequired as re } from "./utils.mjs";
11
+ import { QuestionCircleOutlined as se } from "@ant-design/icons-vue";
12
+ import { useToken as ue } from "ant-design-vue/es/theme/internal";
13
+ import { useNamespace as me } from "../config-provider/hooks/use-namespace.mjs";
14
+ import { useGlobalConfig as de } from "../config-provider/hooks/use-global-config.mjs";
15
+ const ve = /* @__PURE__ */ q({
15
16
  name: "EditableTableInner",
16
17
  __name: "form-item",
17
18
  props: {
@@ -112,26 +113,26 @@ const Re = /* @__PURE__ */ K({
112
113
  }
113
114
  },
114
115
  setup(k, {
115
- expose: D
116
+ expose: v
116
117
  }) {
117
118
  var h;
118
119
  const l = k, {
119
120
  internalInstance: n,
120
- model: v
121
- } = te(), r = y(((h = o(v)) == null ? void 0 : h[l.name]) || []), L = q(), E = B.useWatch(l.name);
122
- H(() => E.value, (e) => {
121
+ model: D
122
+ } = ae(), r = y(((h = o(D)) == null ? void 0 : h[l.name]) || []), L = G(), T = B.useWatch(l.name);
123
+ H(() => T.value, (e) => {
123
124
  var t;
124
125
  r.value = e, (t = l.onChange) == null || t.call(l, e);
125
126
  }, {
126
127
  deep: !0
127
128
  });
128
129
  const {
129
- b: F,
130
- em: N
131
- } = de("editable-table"), c = y(), [, S] = se(), T = ae(l);
132
- function _(e, t) {
133
- var d;
134
- const a = ((d = o(r)) == null ? void 0 : d.length) || 0;
130
+ b: E,
131
+ em: F
132
+ } = me("editable-table"), c = y(), N = de("valueTypeMap"), [, S] = ue(), _ = le(l, N);
133
+ function z(e, t) {
134
+ var u;
135
+ const a = ((u = o(r)) == null ? void 0 : u.length) || 0;
135
136
  if (p(l.maxLength) && a >= l.maxLength)
136
137
  return;
137
138
  const s = [...o(r) || []];
@@ -141,18 +142,18 @@ const Re = /* @__PURE__ */ K({
141
142
  ...e || {}
142
143
  }), n == null || n.setFieldValue(l.name, [...o(r) || [], e || {}]);
143
144
  }
144
- function z(e, t = "suffix") {
145
+ function P(e, t = "suffix") {
145
146
  var g;
146
147
  const a = ((g = o(r)) == null ? void 0 : g.length) || 0, s = i(e) ? e : e.length;
147
148
  if (p(l.maxLength) && a + s > l.maxLength)
148
149
  return;
149
- const d = [...o(r) || []], x = i(e) ? new Array(e).fill({}) : f(e);
150
- t === "suffix" ? d.push(...x) : d.unshift(...x), n == null || n.setFieldValue(l.name, d);
150
+ const u = [...o(r) || []], x = i(e) ? new Array(e).fill({}) : f(e);
151
+ t === "suffix" ? u.push(...x) : u.unshift(...x), n == null || n.setFieldValue(l.name, u);
151
152
  }
152
- function P(e) {
153
+ function V(e) {
153
154
  let t = f(o(r) || []);
154
155
  const a = i(e) ? [e] : e;
155
- t = t.filter((s, d) => !a.includes(d)), n == null || n.setFieldValue(l.name, t);
156
+ t = t.filter((s, u) => !a.includes(u)), n == null || n.setFieldValue(l.name, t);
156
157
  }
157
158
  function j() {
158
159
  return o(r);
@@ -161,49 +162,49 @@ const Re = /* @__PURE__ */ K({
161
162
  var t;
162
163
  return (t = o(r)) == null ? void 0 : t[e];
163
164
  }
164
- function V(e, t) {
165
+ function A(e, t) {
165
166
  const a = f(o(r));
166
167
  a[e] && (a[e] = {
167
168
  ...a[e],
168
169
  ...t
169
170
  }, n == null || n.setFieldValue(l.name, [...a]));
170
171
  }
171
- function A(e, t) {
172
+ function K(e, t) {
172
173
  var s;
173
174
  const a = e === "end" ? r.value.length - 1 : e;
174
- le(a, (s = c.value) == null ? void 0 : s.$el, t);
175
+ ne(a, (s = c.value) == null ? void 0 : s.$el, t);
175
176
  }
176
- return D({
177
- add: _,
178
- remove: P,
177
+ return v({
178
+ add: z,
179
+ remove: V,
179
180
  getRowData: O,
180
181
  getRowsData: j,
181
- setRowData: V,
182
- addMultiple: z,
183
- scrollTo: A
184
- }), (e, t) => (u(), C(o(B).FormItem, b(e.formItem, {
182
+ setRowData: A,
183
+ addMultiple: P,
184
+ scrollTo: K
185
+ }), (e, t) => (d(), C(o(B).FormItem, b(e.formItem, {
185
186
  name: e.name,
186
187
  label: e.label
187
188
  }), {
188
- default: m(() => [w(o(Z), b(o(oe)(l, ["name", "maxLength", "onChange"]), {
189
- class: o(F)(),
190
- columns: o(T),
189
+ default: m(() => [w(o(ee), b(o(te)(l, ["name", "maxLength", "onChange"]), {
190
+ class: o(E)(),
191
+ columns: o(_),
191
192
  "data-source": r.value,
192
193
  ref_key: "tableRef",
193
194
  ref: c
194
195
  }), I({
195
196
  headerCell: m(({
196
197
  column: a
197
- }) => [o(ne)(a) ? (u(), W("span", {
198
+ }) => [o(re)(a) ? (d(), M("span", {
198
199
  key: 0,
199
- class: $(o(N)("header-cell", "required"))
200
- }, "*", 2)) : R("", !0), G("span", null, M(a.title), 1), a.tooltip ? (u(), C(o(ee), {
200
+ class: W(o(F)("header-cell", "required"))
201
+ }, "*", 2)) : R("", !0), $("span", null, Q(a.title), 1), a.tooltip ? (d(), C(o(oe), {
201
202
  key: 1,
202
203
  title: a.tooltip,
203
204
  placement: "bottom"
204
205
  }, {
205
- default: m(() => [w(o(re), {
206
- style: Q({
206
+ default: m(() => [w(o(se), {
207
+ style: U({
207
208
  paddingLeft: "4px",
208
209
  color: o(S).colorPrimary
209
210
  })
@@ -211,14 +212,14 @@ const Re = /* @__PURE__ */ K({
211
212
  _: 2
212
213
  }, 1032, ["title"])) : R("", !0)]),
213
214
  _: 2
214
- }, [U(L, (a, s) => ({
215
+ }, [J(L, (a, s) => ({
215
216
  name: s,
216
- fn: m((d) => [J(e.$slots, s, X(Y(d || {})))])
217
+ fn: m((u) => [X(e.$slots, s, Y(Z(u || {})))])
217
218
  }))]), 1040, ["class", "columns", "data-source"])]),
218
219
  _: 3
219
220
  }, 16, ["name", "label"]));
220
221
  }
221
222
  });
222
223
  export {
223
- Re as default
224
+ ve as default
224
225
  };
@@ -1,5 +1,6 @@
1
- import { ComputedRef } from 'vue';
1
+ import { ComputedRef, Ref } from 'vue';
2
2
  import { EditableTableFormItemProps, EditableTableProps } from '../interface';
3
+ import { ValueTypeRenderConfig } from '../../config-provider';
3
4
  import { ColumnType } from 'ant-design-vue/es/table';
4
- declare const useGetColumns: (props: EditableTableProps | EditableTableFormItemProps) => ComputedRef<ColumnType<any>[]>;
5
+ declare const useGetColumns: (props: EditableTableProps | EditableTableFormItemProps, extraValueTypes: Ref<Record<string, ValueTypeRenderConfig> | undefined>) => ComputedRef<ColumnType<any>[]>;
5
6
  export default useGetColumns;
@@ -1,57 +1,57 @@
1
- import { computed as f } from "vue";
2
- import { omit as g, isFunction as F } from "lodash-unified";
3
- import { mergeClass as b, getFinalNode as x } from "../utils.mjs";
4
- import { updateFormProps as R, getFieldProps as h, getPlaceholder as C, getTableRenderProps as I } from "../../ap-table/utils.mjs";
1
+ import { computed as g, unref as F } from "vue";
2
+ import { omit as b, isFunction as x } from "lodash-unified";
3
+ import { mergeClass as R, getFinalNode as h } from "../utils.mjs";
4
+ import { updateFormProps as C, getFieldProps as I, getPlaceholder as y, getTableRenderProps as T } from "../../ap-table/utils.mjs";
5
5
  import "../../config-provider/index.mjs";
6
- import { useLocale as y } from "../../config-provider/hooks/use-locale.mjs";
7
- const $ = (o) => {
6
+ import { useLocale as N } from "../../config-provider/hooks/use-locale.mjs";
7
+ const k = (o, i) => {
8
8
  const {
9
- t: i
10
- } = y();
11
- return f(() => {
9
+ t: s
10
+ } = N();
11
+ return g(() => {
12
12
  let d = o.columns;
13
13
  return d ? (d = d.map((e) => ({
14
- ...g(e, ["ellipsis"]),
14
+ ...b(e, ["ellipsis"]),
15
15
  customRender({
16
- value: t,
17
- ...l
16
+ value: a,
17
+ ...n
18
18
  }) {
19
- const a = F(e.editable) ? e.editable(l.text, l.record, l.index) : !!e.editable;
19
+ const t = x(e.editable) ? e.editable(n.text, n.record, n.index) : !!e.editable;
20
20
  if (!e.valueType && !e.customRender && !e.customRenderFormItem)
21
21
  return console.warn("can not render table cell because no `valueType` / `customRender` / `customRenderFormItem`"), null;
22
22
  let c;
23
- if (a) {
24
- const n = R(e, h(e.fieldProps, {
25
- value: t,
26
- ...l
23
+ if (t) {
24
+ const l = C(e, I(e.fieldProps, {
25
+ value: a,
26
+ ...n
27
27
  })), u = {};
28
- o.onFieldChange && (u[`onUpdate:${n.valuePropName || "value"}`] = (s) => {
28
+ o.onFieldChange && (u[`onUpdate:${l.valuePropName || "value"}`] = (f) => {
29
29
  var m;
30
- return (m = o.onFieldChange) == null ? void 0 : m.call(o, l.index, e.dataIndex, s);
30
+ return (m = o.onFieldChange) == null ? void 0 : m.call(o, n.index, e.dataIndex, f);
31
31
  }), c = {
32
- name: [o.name, l.index, e.dataIndex],
33
- ...n || {},
32
+ name: [o.name, n.index, e.dataIndex],
33
+ ...l || {},
34
34
  // 格式化placeholder
35
- placeholder: C(i, e.valueType, n == null ? void 0 : n.placeholder),
35
+ placeholder: y(s, e.valueType, l == null ? void 0 : l.placeholder),
36
36
  field: {
37
37
  style: "width: 100%",
38
- ...(n == null ? void 0 : n.field) || {},
38
+ ...(l == null ? void 0 : l.field) || {},
39
39
  ...u,
40
- class: b("is-editable", n.class)
40
+ class: R("is-editable", l.class)
41
41
  }
42
42
  };
43
43
  } else
44
44
  c = {
45
- field: I(e, {
46
- value: t,
47
- ...l
45
+ field: T(e, {
46
+ value: a,
47
+ ...n
48
48
  })
49
49
  };
50
- const r = x(e, a, c, t);
50
+ const r = h(e, t, c, a, n.record, F(i));
51
51
  return e.customRender ? e.customRender({
52
- value: t,
53
- ...l,
54
- editable: a,
52
+ value: a,
53
+ ...n,
54
+ editable: t,
55
55
  originalNode: r
56
56
  }) : r;
57
57
  }
@@ -59,5 +59,5 @@ const $ = (o) => {
59
59
  });
60
60
  };
61
61
  export {
62
- $ as default
62
+ k as default
63
63
  };
@@ -1,18 +1,19 @@
1
- import { defineComponent as G, useSlots as Q, ref as R, watch as b, unref as o, openBlock as p, createBlock as B, withCtx as m, createVNode as x, mergeProps as J, createSlots as X, createElementBlock as Y, normalizeClass as Z, createCommentVNode as F, createElementVNode as ee, toDisplayString as te, normalizeStyle as ae, renderList as ne, renderSlot as oe, normalizeProps as le, guardReactiveProps as re } from "vue";
2
- import { Table as se, Tooltip as ue } from "ant-design-vue";
3
- import { ApForm as h } from "../ap-form/index.mjs";
4
- import { isEqual as ie, isArray as k, isNumber as y, cloneDeep as g, omit as de } 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
7
  import { isDef as C } from "../utils/index.mjs";
8
- import { scrollToRowIndex as me, getColumnIsRequired as fe } from "./utils.mjs";
9
- import ce from "./hooks/use-get-columns.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 { useToken as pe } from "ant-design-vue/es/theme/internal";
12
- import { QuestionCircleOutlined as xe } from "@ant-design/icons-vue";
13
- import { useNamespace as he } from "../config-provider/hooks/use-namespace.mjs";
14
- import { useControllableValue as ye } from "../hooks/useControllableValue.mjs";
15
- const De = /* @__PURE__ */ G({
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({
16
17
  name: "EditableTable",
17
18
  __name: "index",
18
19
  props: {
@@ -111,142 +112,142 @@ const De = /* @__PURE__ */ G({
111
112
  onFieldChange: {}
112
113
  },
113
114
  emits: ["update:value"],
114
- setup(E, {
115
- expose: L,
116
- emit: N
115
+ setup(V, {
116
+ expose: E,
117
+ emit: L
117
118
  }) {
118
- const l = E, {
119
- b: V,
120
- em: _
121
- } = he("editable-table"), D = Q(), S = N, v = R(), {
119
+ const l = V, {
120
+ b: N,
121
+ em: T
122
+ } = ge("editable-table"), _ = J(), D = L, v = b(), {
122
123
  value: s,
123
- updateValue: T
124
- } = ye(l, S), u = R(), [, A] = pe(), c = h.useWatch(l.name, u);
125
- b(() => c.value, (e) => {
124
+ updateValue: S
125
+ } = he(l, D), u = b(), [, A] = xe(), z = Ce("valueTypeMap"), c = y.useWatch(l.name, u);
126
+ R(() => c.value, (e) => {
126
127
  var t;
127
- T(e), (t = l.onChange) == null || t.call(l, e);
128
+ S(e), (t = l.onChange) == null || t.call(l, e);
128
129
  }, {
129
130
  deep: !0
130
- }), b(s, (e) => {
131
+ }), R(s, (e) => {
131
132
  var t;
132
- e !== o(c) && (ie(e, o(c)) || (t = u.value) == null || t.setFieldValue(l.name, e));
133
+ e !== n(c) && (de(e, n(c)) || (t = u.value) == null || t.setFieldValue(l.name, e));
133
134
  }, {
134
135
  deep: !0
135
136
  });
136
- const z = ce(l);
137
- function P() {
137
+ const P = pe(l, z);
138
+ function I() {
138
139
  var e;
139
140
  (e = u.value) == null || e.resetFields();
140
141
  }
141
- function I(e) {
142
+ function O(e) {
142
143
  return e ? (k(e) ? e : [e]).map((a) => k(a) ? [l.name, ...a] : [l.name, a]) : void 0;
143
144
  }
144
- async function O(e, t) {
145
- var n;
146
- const a = await ((n = u.value) == null ? void 0 : n.validateFields(I(e), t));
145
+ async function j(e, t) {
146
+ var o;
147
+ const a = await ((o = u.value) == null ? void 0 : o.validateFields(O(e), t));
147
148
  return a == null ? void 0 : a[l.name];
148
149
  }
149
- function j(e, t) {
150
+ function q(e, t) {
150
151
  var r, i, d;
151
- const a = ((r = o(s)) == null ? void 0 : r.length) || 0;
152
+ const a = ((r = n(s)) == null ? void 0 : r.length) || 0;
152
153
  if (C(l.maxLength) && a >= l.maxLength)
153
154
  return;
154
- const n = [...o(s) || []];
155
- C(t) ? n.splice(t, 0, {
155
+ const o = [...n(s) || []];
156
+ C(t) ? o.splice(t, 0, {
156
157
  ...e || {}
157
- }) : n.push({
158
+ }) : o.push({
158
159
  ...e || {}
159
- }), (d = (i = u.value) == null ? void 0 : i.setFieldValue) == null || d.call(i, l.name, n);
160
+ }), (d = (i = u.value) == null ? void 0 : i.setFieldValue) == null || d.call(i, l.name, o);
160
161
  }
161
- function q(e, t = "suffix") {
162
+ function K(e, t = "suffix") {
162
163
  var d, f, w;
163
- const a = ((d = o(s)) == null ? void 0 : d.length) || 0, n = y(e) ? e : e.length;
164
- if (C(l.maxLength) && a + n > l.maxLength)
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)
165
166
  return;
166
- const r = [...o(s) || []], i = y(e) ? new Array(e).fill({}) : g(e);
167
+ const r = [...n(s) || []], i = g(e) ? new Array(e).fill({}) : h(e);
167
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);
168
169
  }
169
- function K(e) {
170
- var n, r;
171
- let t = g(o(s) || []);
172
- const a = y(e) ? [e] : e;
173
- t = t.filter((i, d) => !a.includes(d)), (r = (n = u.value) == null ? void 0 : n.setFieldValue) == null || r.call(n, l.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);
174
175
  }
175
- function H() {
176
- return o(s);
176
+ function G() {
177
+ return n(s);
177
178
  }
178
- function M(e) {
179
+ function H(e) {
179
180
  var t;
180
- return (t = o(s)) == null ? void 0 : t[e];
181
+ return (t = n(s)) == null ? void 0 : t[e];
181
182
  }
182
183
  function U(e, t) {
183
- var n, r;
184
- const a = g(o(s));
184
+ var o, r;
185
+ const a = h(n(s));
185
186
  a[e] && (a[e] = {
186
187
  ...a[e],
187
188
  ...t
188
- }, (r = (n = u.value) == null ? void 0 : n.setFieldValue) == null || r.call(n, l.name, [...a]));
189
+ }, (r = (o = u.value) == null ? void 0 : o.setFieldValue) == null || r.call(o, l.name, [...a]));
189
190
  }
190
191
  function W(e, t) {
191
- var n;
192
+ var o;
192
193
  const a = e === "end" ? s.value.length - 1 : e;
193
- me(a, (n = v.value) == null ? void 0 : n.$el, t);
194
+ fe(a, (o = v.value) == null ? void 0 : o.$el, t);
194
195
  }
195
196
  function $() {
196
197
  var e, t;
197
198
  (t = (e = u.value) == null ? void 0 : e.setFieldValue) == null || t.call(e, l.name, []);
198
199
  }
199
- return L({
200
- resetFields: P,
201
- validateFields: O,
202
- add: j,
203
- remove: K,
204
- getRowData: M,
205
- getRowsData: H,
200
+ return E({
201
+ resetFields: I,
202
+ validateFields: j,
203
+ add: q,
204
+ remove: M,
205
+ getRowData: H,
206
+ getRowsData: G,
206
207
  setRowData: U,
207
- addMultiple: q,
208
+ addMultiple: K,
208
209
  scrollTo: W,
209
210
  clear: $
210
- }), (e, t) => (p(), B(o(h), {
211
+ }), (e, t) => (p(), B(n(y), {
211
212
  "initial-values": {
212
- [l.name]: o(s)
213
+ [l.name]: n(s)
213
214
  },
214
215
  ref_key: "formRef",
215
216
  ref: u
216
217
  }, {
217
- default: m(() => [x(o(h).FormItem, {
218
+ default: m(() => [x(n(y).FormItem, {
218
219
  name: e.name,
219
220
  "no-style": ""
220
221
  }, {
221
- default: m(() => [x(o(se), J(o(de)(l, ["name", "value", "onUpdate:value", "maxLength", "onChange"]), {
222
- class: o(V)(),
223
- columns: o(z),
224
- "data-source": o(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),
225
226
  ref_key: "tableRef",
226
227
  ref: v
227
- }), X({
228
+ }), Y({
228
229
  headerCell: m(({
229
230
  column: a
230
- }) => [o(fe)(a) ? (p(), Y("span", {
231
+ }) => [n(ce)(a) ? (p(), Z("span", {
231
232
  key: 0,
232
- class: Z(o(_)("header-cell", "required"))
233
- }, "*", 2)) : F("", !0), ee("span", null, te(a.title), 1), a.tooltip ? (p(), B(o(ue), {
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), {
234
235
  key: 1,
235
236
  title: a.tooltip,
236
237
  placement: "bottom"
237
238
  }, {
238
- default: m(() => [x(o(xe), {
239
- style: ae({
239
+ default: m(() => [x(n(ye), {
240
+ style: oe({
240
241
  paddingLeft: "4px",
241
- color: o(A).colorPrimary
242
+ color: n(A).colorPrimary
242
243
  })
243
244
  }, null, 8, ["style"])]),
244
245
  _: 2
245
246
  }, 1032, ["title"])) : F("", !0)]),
246
247
  _: 2
247
- }, [ne(D, (a, n) => ({
248
- name: n,
249
- fn: m((r) => [oe(e.$slots, n, le(re(r || {})))])
248
+ }, [ne(_, (a, o) => ({
249
+ name: o,
250
+ fn: m((r) => [le(e.$slots, o, re(se(r || {})))])
250
251
  }))]), 1040, ["class", "columns", "data-source"])]),
251
252
  _: 3
252
253
  }, 8, ["name"])]),
@@ -255,5 +256,5 @@ const De = /* @__PURE__ */ G({
255
256
  }
256
257
  });
257
258
  export {
258
- De as default
259
+ Ae as default
259
260
  };