@aplus-frontend/ui 0.0.22 → 0.0.24

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 (41) hide show
  1. package/es/src/ap-field/date/index.vue.mjs +26 -26
  2. package/es/src/ap-field/number/helper.d.ts +9 -0
  3. package/es/src/ap-field/number/helper.mjs +20 -11
  4. package/es/src/ap-table/ap-table.vue.d.ts +2137 -112
  5. package/es/src/ap-table/ap-table.vue.mjs +31 -30
  6. package/es/src/check-card/group.vue.d.ts +1 -1
  7. package/es/src/check-card/group.vue.mjs +1 -1
  8. package/es/src/check-card/index.vue.d.ts +1 -1
  9. package/es/src/check-card/index.vue2.mjs +40 -36
  10. package/es/src/check-card/interface.d.ts +1 -1
  11. package/es/src/check-card/style/index.css +1 -0
  12. package/es/src/editable-table/form-item.vue.d.ts +755 -105
  13. package/es/src/editable-table/form-item.vue.mjs +80 -65
  14. package/es/src/editable-table/hooks/use-get-columns.mjs +27 -27
  15. package/es/src/editable-table/index.vue.d.ts +527 -112
  16. package/es/src/editable-table/index.vue.mjs +93 -78
  17. package/es/src/editable-table/interface.d.ts +11 -5
  18. package/es/src/editable-table/utils.d.ts +13 -0
  19. package/es/src/editable-table/utils.mjs +26 -6
  20. package/es/src/theme/check-card/index.css +1 -0
  21. package/lib/src/ap-field/date/index.vue.js +1 -1
  22. package/lib/src/ap-field/number/helper.d.ts +9 -0
  23. package/lib/src/ap-field/number/helper.js +1 -1
  24. package/lib/src/ap-table/ap-table.vue.d.ts +2137 -112
  25. package/lib/src/ap-table/ap-table.vue.js +1 -1
  26. package/lib/src/check-card/group.vue.d.ts +1 -1
  27. package/lib/src/check-card/group.vue.js +1 -1
  28. package/lib/src/check-card/index.vue.d.ts +1 -1
  29. package/lib/src/check-card/index.vue2.js +1 -1
  30. package/lib/src/check-card/interface.d.ts +1 -1
  31. package/lib/src/check-card/style/index.css +1 -0
  32. package/lib/src/editable-table/form-item.vue.d.ts +755 -105
  33. package/lib/src/editable-table/form-item.vue.js +1 -1
  34. package/lib/src/editable-table/hooks/use-get-columns.js +1 -1
  35. package/lib/src/editable-table/index.vue.d.ts +527 -112
  36. package/lib/src/editable-table/index.vue.js +1 -1
  37. package/lib/src/editable-table/interface.d.ts +11 -5
  38. package/lib/src/editable-table/utils.d.ts +13 -0
  39. package/lib/src/editable-table/utils.js +1 -1
  40. package/lib/src/theme/check-card/index.css +1 -0
  41. package/package.json +5 -5
@@ -1,15 +1,16 @@
1
- import { defineComponent as P, ref as L, unref as o, useSlots as V, watch as j, openBlock as f, createBlock as z, mergeProps as c, withCtx as i, createVNode as _, createSlots as O, createElementBlock as T, Fragment as K, createElementVNode as x, normalizeClass as q, toDisplayString as A, createCommentVNode as G, renderList as H, renderSlot as M, normalizeProps as W, guardReactiveProps as U } from "vue";
2
- import { Table as $ } from "ant-design-vue";
3
- import { ApForm as C } from "../ap-form/index.mjs";
4
- import { cloneDeep as g, omit as J } from "lodash-unified";
1
+ import { defineComponent as V, ref as A, unref as o, useSlots as O, watch as T, openBlock as C, createBlock as K, mergeProps as w, withCtx as i, createVNode as M, createSlots as q, createElementBlock as G, Fragment as H, createElementVNode as b, normalizeClass as W, toDisplayString as U, createCommentVNode as $, renderList as J, renderSlot as Q, normalizeProps as X, guardReactiveProps as Y } from "vue";
2
+ import { Table as Z } from "ant-design-vue";
3
+ import { ApForm as y } from "../ap-form/index.mjs";
4
+ import { isNumber as m, cloneDeep as p, omit as I } from "lodash-unified";
5
5
  import "../config-provider/index.mjs";
6
- import { useInjectForm as Q } from "../ap-form/context.mjs";
6
+ import { useInjectForm as ee } from "../ap-form/context.mjs";
7
7
  import "./style/index.css";
8
- import { isDef as X } from "../utils/index.mjs";
9
- import Y from "./hooks/use-get-columns.mjs";
10
- import { useNamespace as Z } from "../config-provider/hooks/use-namespace.mjs";
11
- import { useGlobalConfig as I } from "../config-provider/hooks/use-global-config.mjs";
12
- const pe = /* @__PURE__ */ P({
8
+ import { isDef as c } from "../utils/index.mjs";
9
+ import te from "./hooks/use-get-columns.mjs";
10
+ import { getColumnIsRequired as oe } from "./utils.mjs";
11
+ import { useNamespace as ae } from "../config-provider/hooks/use-namespace.mjs";
12
+ import { useGlobalConfig as le } from "../config-provider/hooks/use-global-config.mjs";
13
+ const xe = /* @__PURE__ */ V({
13
14
  name: "EditableTableInner",
14
15
  __name: "form-item",
15
16
  props: {
@@ -109,81 +110,95 @@ const pe = /* @__PURE__ */ P({
109
110
  default: () => ({})
110
111
  }
111
112
  },
112
- setup(h, {
113
- expose: w
113
+ setup(R, {
114
+ expose: B
114
115
  }) {
115
- var p;
116
- const n = h, {
116
+ var h;
117
+ const l = R, {
117
118
  formInstance: t,
118
- model: b
119
- } = Q(), d = L(((p = o(b)) == null ? void 0 : p[n.name]) || []), y = V(), R = C.useWatch(n.name);
120
- j(() => R.value, (a) => {
121
- var l;
122
- d.value = a, (l = n.onChange) == null || l.call(n, a);
119
+ model: D
120
+ } = ee(), d = A(((h = o(D)) == null ? void 0 : h[l.name]) || []), F = O(), E = y.useWatch(l.name);
121
+ T(() => E.value, (e) => {
122
+ var a;
123
+ d.value = e, (a = l.onChange) == null || a.call(l, e);
123
124
  });
124
125
  const {
125
- b: u,
126
- em: B
127
- } = Z("editable-table"), D = I("uiMode", "aplus"), E = Y(n);
128
- function F(a) {
129
- var e, r;
130
- const l = ((e = o(d)) == null ? void 0 : e.length) || 0;
131
- X(n.maxLength) && l >= n.maxLength || (r = t == null ? void 0 : t.setFieldValue) == null || r.call(t, n.name, [...o(d) || [], a || {}]);
126
+ b: f,
127
+ em: L
128
+ } = ae("editable-table"), v = le("uiMode", "aplus"), N = te(l);
129
+ function S(e, a) {
130
+ var u, s;
131
+ const n = ((u = o(d)) == null ? void 0 : u.length) || 0;
132
+ if (c(l.maxLength) && n >= l.maxLength)
133
+ return;
134
+ const r = [...o(d) || []];
135
+ c(a) ? r.splice(a, 0, {
136
+ ...e || {}
137
+ }) : r.push({
138
+ ...e || {}
139
+ }), (s = t == null ? void 0 : t.setFieldValue) == null || s.call(t, l.name, [...o(d) || [], e || {}]);
132
140
  }
133
- function v(a) {
134
- var e;
135
- const l = g(o(d) || []);
136
- l.splice(a, 1), (e = t == null ? void 0 : t.setFieldValue) == null || e.call(t, n.name, [...l]);
141
+ function k(e, a = "suffix") {
142
+ var g, x;
143
+ const n = ((g = o(d)) == null ? void 0 : g.length) || 0, r = m(e) ? e : e.length;
144
+ if (c(l.maxLength) && n + r > l.maxLength)
145
+ return;
146
+ const u = [...o(d) || []], s = m(e) ? new Array(e).fill({}) : p(e);
147
+ a === "suffix" ? u.push(...s) : u.unshift(...s), (x = t == null ? void 0 : t.setFieldValue) == null || x.call(t, l.name, u);
137
148
  }
138
- function S() {
149
+ function _(e) {
150
+ var r;
151
+ let a = p(o(d) || []);
152
+ const n = m(e) ? [e] : e;
153
+ a = a.filter((u, s) => !n.includes(s)), (r = t == null ? void 0 : t.setFieldValue) == null || r.call(t, l.name, a);
154
+ }
155
+ function j() {
139
156
  return o(d);
140
157
  }
141
- function k(a) {
142
- var l;
143
- return (l = o(d)) == null ? void 0 : l[a];
158
+ function z(e) {
159
+ var a;
160
+ return (a = o(d)) == null ? void 0 : a[e];
144
161
  }
145
- function N(a, l) {
162
+ function P(e, a) {
146
163
  var r;
147
- const e = g(o(d));
148
- e[a] && (e[a] = {
149
- ...e[a],
150
- ...l
151
- }, (r = t == null ? void 0 : t.setFieldValue) == null || r.call(t, n.name, [...e]));
164
+ const n = p(o(d));
165
+ n[e] && (n[e] = {
166
+ ...n[e],
167
+ ...a
168
+ }, (r = t == null ? void 0 : t.setFieldValue) == null || r.call(t, l.name, [...n]));
152
169
  }
153
- return w({
154
- add: F,
155
- remove: v,
156
- getRowData: k,
157
- getRowsData: S,
158
- setRowData: N
159
- }), (a, l) => (f(), z(o(C).FormItem, c(a.formItem, {
160
- name: a.name,
161
- label: a.label
170
+ return B({
171
+ add: S,
172
+ remove: _,
173
+ getRowData: z,
174
+ getRowsData: j,
175
+ setRowData: P,
176
+ addMultiple: k
177
+ }), (e, a) => (C(), K(o(y).FormItem, w(e.formItem, {
178
+ name: e.name,
179
+ label: e.label
162
180
  }), {
163
- default: i(() => [_(o($), c(o(J)(n, ["name", "maxLength"]), {
164
- class: [o(u)(), o(D) === "admin" ? o(u)("admin") : null],
165
- columns: o(E),
181
+ default: i(() => [M(o(Z), w(o(I)(l, ["name", "maxLength"]), {
182
+ class: [o(f)(), o(v) === "admin" ? o(f)("admin") : null],
183
+ columns: o(N),
166
184
  "data-source": d.value
167
- }), O({
185
+ }), q({
168
186
  headerCell: i(({
169
- column: e
170
- }) => {
171
- var r, s, m;
172
- return [(r = e == null ? void 0 : e.fieldProps) != null && r.required || (m = (s = e == null ? void 0 : e.fieldProps) == null ? void 0 : s.rules) != null && m.length ? (f(), T(K, {
173
- key: 0
174
- }, [x("span", {
175
- class: q(o(B)("header-cell", "required"))
176
- }, "*", 2), x("span", null, A(e.title), 1)], 64)) : G("", !0)];
177
- }),
187
+ column: n
188
+ }) => [o(oe)(n) ? (C(), G(H, {
189
+ key: 0
190
+ }, [b("span", {
191
+ class: W(o(L)("header-cell", "required"))
192
+ }, "*", 2), b("span", null, U(n.title), 1)], 64)) : $("", !0)]),
178
193
  _: 2
179
- }, [H(y, (e, r) => ({
194
+ }, [J(F, (n, r) => ({
180
195
  name: r,
181
- fn: i((s) => [M(a.$slots, r, W(U(s || {})))])
196
+ fn: i((u) => [Q(e.$slots, r, X(Y(u || {})))])
182
197
  }))]), 1040, ["class", "columns", "data-source"])]),
183
198
  _: 3
184
199
  }, 16, ["name", "label"]));
185
200
  }
186
201
  });
187
202
  export {
188
- pe as default
203
+ xe as default
189
204
  };
@@ -1,17 +1,17 @@
1
- import { computed as y, createVNode as i, mergeProps as x } from "vue";
2
- import { omit as h, isFunction as C, isBoolean as F } from "lodash-unified";
3
- import { getEditableComponent as R } from "../utils.mjs";
4
- import { updateFormProps as T, getFieldProps as I, getPlaceholder as N, getTableRenderProps as L } from "../../ap-table/utils.mjs";
1
+ import { computed as b, createVNode as i, mergeProps as x } from "vue";
2
+ import { omit as h, isFunction as C, isBoolean as R } from "lodash-unified";
3
+ import { getEditableComponent as F, getRawDisplayValue as T } from "../utils.mjs";
4
+ import { updateFormProps as I, getFieldProps as N, getPlaceholder as V, getTableRenderProps as w } from "../../ap-table/utils.mjs";
5
5
  import "../../config-provider/index.mjs";
6
- import { apTableRenderItemMap as M, noRenderAsFormItemValueList as V } from "../../ap-table/constants.mjs";
7
- import { Typography as w } from "ant-design-vue";
8
- import { useLocale as A } from "../../config-provider/hooks/use-locale.mjs";
6
+ import { apTableRenderItemMap as L, noRenderAsFormItemValueList as M } from "../../ap-table/constants.mjs";
7
+ import { Typography as A } from "ant-design-vue";
8
+ import { useLocale as B } from "../../config-provider/hooks/use-locale.mjs";
9
9
  const q = (t) => {
10
10
  const {
11
11
  t: u
12
- } = A(), f = y(() => {
13
- let o = t.columns;
14
- return o ? (o = o.map((e) => ({
12
+ } = B(), f = b(() => {
13
+ let l = t.columns;
14
+ return l ? (l = l.map((e) => ({
15
15
  ...h(e, ["ellipsis"]),
16
16
  customRender({
17
17
  value: n,
@@ -20,32 +20,32 @@ const q = (t) => {
20
20
  const c = C(e.editable) ? e.editable(a.text, a.record, a.index) : !!e.editable;
21
21
  let r;
22
22
  if (c) {
23
- const d = R(e.valueType), l = T(e, I(e.fieldProps, {
23
+ const d = F(e.valueType), o = I(e, N(e.fieldProps, {
24
24
  value: n,
25
25
  ...a
26
26
  })), s = {};
27
- t.onFieldChange && (s[`onUpdate:${l.valuePropName || "value"}`] = (g) => {
27
+ t.onFieldChange && (s[`onUpdate:${o.valuePropName || "value"}`] = (y) => {
28
28
  var p;
29
- return (p = t.onFieldChange) == null ? void 0 : p.call(t, a.index, e.dataIndex, g);
29
+ return (p = t.onFieldChange) == null ? void 0 : p.call(t, a.index, e.dataIndex, y);
30
30
  });
31
- const b = {
31
+ const g = {
32
32
  name: [t.name, a.index, e.dataIndex],
33
- ...l || {},
33
+ ...o || {},
34
34
  // 格式化placeholder
35
- placeholder: N(u, e.valueType, l == null ? void 0 : l.placeholder),
35
+ placeholder: V(u, e.valueType, o == null ? void 0 : o.placeholder),
36
36
  field: {
37
37
  style: "width: 100%",
38
- ...(l == null ? void 0 : l.field) || {},
38
+ ...(o == null ? void 0 : o.field) || {},
39
39
  ...s
40
40
  }
41
41
  };
42
- r = i(d, b, null);
42
+ r = i(d, g, null);
43
43
  } else {
44
- const d = M[e.valueType], l = L(e, {
44
+ const d = L[e.valueType], o = w(e, {
45
45
  value: n,
46
46
  ...a
47
47
  });
48
- r = m(e, n, i(d, x(l, {
48
+ r = m(e, n, i(d, x(o, {
49
49
  mode: "read"
50
50
  }), null));
51
51
  }
@@ -56,21 +56,21 @@ const q = (t) => {
56
56
  originalNode: r
57
57
  }) : r;
58
58
  }
59
- })), o) : [];
59
+ })), l) : [];
60
60
  });
61
- function m(o, e, n) {
62
- return V.includes(o.valueType) ? n : o.copyable || o.ellipsis ? i(w.Paragraph, {
63
- copyable: o.copyable ? {
61
+ function m(l, e, n) {
62
+ return M.includes(l.valueType) ? n : l.copyable || l.ellipsis ? i(A.Paragraph, {
63
+ copyable: l.copyable ? {
64
64
  text: e,
65
65
  tooltip: !1
66
66
  } : !1,
67
- ellipsis: o.ellipsis ? F(o.ellipsis) ? {
67
+ ellipsis: l.ellipsis ? R(l.ellipsis) ? {
68
68
  tooltip: e
69
69
  } : {
70
- ...o.ellipsis,
70
+ ...l.ellipsis,
71
71
  tooltip: e
72
72
  } : !1,
73
- content: o.ellipsis ? e : n
73
+ content: l.ellipsis ? T(l, e) : n
74
74
  }, null) : n;
75
75
  }
76
76
  return f;