@aplus-frontend/ui 0.0.19 → 0.0.21

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 (79) hide show
  1. package/es/src/ap-form/ap-form-item.vue.d.ts +2 -8
  2. package/es/src/ap-form/constant.d.ts +4 -0
  3. package/es/src/ap-form/constant.mjs +4 -3
  4. package/es/src/ap-form/hooks/use-watch.d.ts +2 -2
  5. package/es/src/ap-form/interface.d.ts +10 -0
  6. package/es/src/ap-form/items/checkbox/index.vue.d.ts +9 -2
  7. package/es/src/ap-form/items/checkbox/index.vue.mjs +20 -13
  8. package/es/src/ap-form/items/date/index.vue.d.ts +26 -14
  9. package/es/src/ap-form/items/date/index.vue.mjs +26 -18
  10. package/es/src/ap-form/items/date-range/index.vue.d.ts +24 -13
  11. package/es/src/ap-form/items/date-range/index.vue.mjs +27 -19
  12. package/es/src/ap-form/items/number/index.vue.d.ts +16 -9
  13. package/es/src/ap-form/items/number/index.vue.mjs +30 -22
  14. package/es/src/ap-form/items/radio/index.vue.d.ts +9 -2
  15. package/es/src/ap-form/items/radio/index.vue.mjs +21 -14
  16. package/es/src/ap-form/items/select/index.vue.d.ts +28 -15
  17. package/es/src/ap-form/items/select/index.vue.mjs +30 -22
  18. package/es/src/ap-form/items/switch/index.vue.d.ts +10 -6
  19. package/es/src/ap-form/items/switch/index.vue.mjs +25 -17
  20. package/es/src/ap-form/items/text/index.vue.d.ts +14 -8
  21. package/es/src/ap-form/items/text/index.vue2.mjs +32 -24
  22. package/es/src/ap-form/items/text/password.vue.d.ts +16 -9
  23. package/es/src/ap-form/items/text/password.vue.mjs +29 -21
  24. package/es/src/ap-form/items/text-area/index.vue.d.ts +9 -2
  25. package/es/src/ap-form/items/text-area/index.vue.mjs +24 -17
  26. package/es/src/ap-list/interface.d.ts +67 -0
  27. package/es/src/ap-list/style/index.css +6 -0
  28. package/es/src/ap-table/ap-table.vue.mjs +131 -123
  29. package/es/src/ap-table/constants.d.ts +2692 -1453
  30. package/es/src/ap-table/interface.d.ts +6 -4
  31. package/es/src/ap-table/style/ap-table.css +19 -0
  32. package/es/src/ap-table/utils.d.ts +826 -670
  33. package/es/src/editable-table/hooks/use-get-columns.d.ts +3 -25
  34. package/es/src/editable-table/hooks/use-get-columns.mjs +47 -45
  35. package/es/src/editable-table/interface.d.ts +6 -1
  36. package/es/src/editable-table/style/index.css +3 -0
  37. package/es/src/theme/ap-list/index.css +6 -0
  38. package/es/src/theme/ap-table/ap-table.css +19 -0
  39. package/es/src/theme/editable-table/index.css +3 -0
  40. package/lib/src/ap-form/ap-form-item.vue.d.ts +2 -8
  41. package/lib/src/ap-form/constant.d.ts +4 -0
  42. package/lib/src/ap-form/constant.js +1 -1
  43. package/lib/src/ap-form/hooks/use-watch.d.ts +2 -2
  44. package/lib/src/ap-form/interface.d.ts +10 -0
  45. package/lib/src/ap-form/items/checkbox/index.vue.d.ts +9 -2
  46. package/lib/src/ap-form/items/checkbox/index.vue.js +1 -1
  47. package/lib/src/ap-form/items/date/index.vue.d.ts +26 -14
  48. package/lib/src/ap-form/items/date/index.vue.js +1 -1
  49. package/lib/src/ap-form/items/date-range/index.vue.d.ts +24 -13
  50. package/lib/src/ap-form/items/date-range/index.vue.js +1 -1
  51. package/lib/src/ap-form/items/number/index.vue.d.ts +16 -9
  52. package/lib/src/ap-form/items/number/index.vue.js +1 -1
  53. package/lib/src/ap-form/items/radio/index.vue.d.ts +9 -2
  54. package/lib/src/ap-form/items/radio/index.vue.js +1 -1
  55. package/lib/src/ap-form/items/select/index.vue.d.ts +28 -15
  56. package/lib/src/ap-form/items/select/index.vue.js +1 -1
  57. package/lib/src/ap-form/items/switch/index.vue.d.ts +10 -6
  58. package/lib/src/ap-form/items/switch/index.vue.js +1 -1
  59. package/lib/src/ap-form/items/text/index.vue.d.ts +14 -8
  60. package/lib/src/ap-form/items/text/index.vue2.js +1 -1
  61. package/lib/src/ap-form/items/text/password.vue.d.ts +16 -9
  62. package/lib/src/ap-form/items/text/password.vue.js +1 -1
  63. package/lib/src/ap-form/items/text-area/index.vue.d.ts +9 -2
  64. package/lib/src/ap-form/items/text-area/index.vue.js +1 -1
  65. package/lib/src/ap-list/interface.d.ts +67 -0
  66. package/lib/src/ap-list/style/index.css +6 -0
  67. package/lib/src/ap-table/ap-table.vue.js +1 -1
  68. package/lib/src/ap-table/constants.d.ts +2692 -1453
  69. package/lib/src/ap-table/interface.d.ts +6 -4
  70. package/lib/src/ap-table/style/ap-table.css +19 -0
  71. package/lib/src/ap-table/utils.d.ts +826 -670
  72. package/lib/src/editable-table/hooks/use-get-columns.d.ts +3 -25
  73. package/lib/src/editable-table/hooks/use-get-columns.js +1 -1
  74. package/lib/src/editable-table/interface.d.ts +6 -1
  75. package/lib/src/editable-table/style/index.css +3 -0
  76. package/lib/src/theme/ap-list/index.css +6 -0
  77. package/lib/src/theme/ap-table/ap-table.css +19 -0
  78. package/lib/src/theme/editable-table/index.css +3 -0
  79. package/package.json +3 -3
@@ -1,21 +1,21 @@
1
- import { defineComponent as Z, useSlots as ee, computed as d, createVNode as s, mergeProps as m, unref as r, watch as ae, openBlock as i, createElementBlock as f, normalizeClass as F, normalizeStyle as x, createSlots as E, withCtx as p, Fragment as te, renderList as O, createBlock as oe, resolveDynamicComponent as re, renderSlot as R, createCommentVNode as L, createElementVNode as z, toDisplayString as ne, normalizeProps as le, guardReactiveProps as de } from "vue";
2
- import { Typography as se, Table as ue, Tooltip as ie } from "ant-design-vue";
3
- import { useToken as pe } from "ant-design-vue/es/theme/internal";
4
- import { ApForm as ce } from "../ap-form/index.mjs";
5
- import { apTableRenderItemMap as me, noRenderAsFormItemValueList as N, apTableFormItemMap as fe } from "./constants.mjs";
1
+ import { defineComponent as ae, useSlots as te, computed as s, createVNode as d, mergeProps as f, unref as l, watch as oe, openBlock as i, createElementBlock as m, normalizeClass as F, normalizeStyle as R, createSlots as k, withCtx as p, Fragment as re, renderList as L, createBlock as le, resolveDynamicComponent as ne, renderSlot as x, createCommentVNode as E, createElementVNode as O, toDisplayString as se, normalizeProps as de, guardReactiveProps as ue } from "vue";
2
+ import { Typography as ie, Table as pe, Tooltip as ce } from "ant-design-vue";
3
+ import { useToken as fe } from "ant-design-vue/es/theme/internal";
4
+ import { ApForm as me } from "../ap-form/index.mjs";
5
+ import { apTableRenderItemMap as ge, noRenderAsFormItemValueList as z, apTableFormItemMap as ye } from "./constants.mjs";
6
6
  import "../config-provider/index.mjs";
7
- import { useTablePaging as ge } from "./hooks/use-table-paging.mjs";
8
- import { isUndefined as T, omit as ye } from "lodash-unified";
7
+ import { useTablePaging as be } from "./hooks/use-table-paging.mjs";
8
+ import { omit as N, isUndefined as T, isBoolean as he } from "lodash-unified";
9
9
  import "./style/ap-table.css";
10
- import { QuestionCircleOutlined as he } from "@ant-design/icons-vue";
11
- import { apColumnToColumn as be, getTableRenderType as Ce, getTableRenderProps as Se, getColumnOrder as V, updateFormProps as Fe, getFieldProps as xe, getPlaceholder as Re } from "./utils.mjs";
12
- import Te from "./hooks/use-table-content-height.mjs";
13
- import { useLocale as we } from "../config-provider/hooks/use-locale.mjs";
14
- import { useNamespace as Be } from "../config-provider/hooks/use-namespace.mjs";
15
- import { useGlobalConfig as Pe } from "../config-provider/hooks/use-global-config.mjs";
16
- const ve = {
10
+ import { QuestionCircleOutlined as Ce } from "@ant-design/icons-vue";
11
+ import { apColumnToColumn as Se, getTableRenderType as Fe, getTableRenderProps as Re, getColumnOrder as V, updateFormProps as xe, getFieldProps as Te, getPlaceholder as we } from "./utils.mjs";
12
+ import Be from "./hooks/use-table-content-height.mjs";
13
+ import { useLocale as Pe } from "../config-provider/hooks/use-locale.mjs";
14
+ import { useNamespace as ve } from "../config-provider/hooks/use-namespace.mjs";
15
+ import { useGlobalConfig as Ie } from "../config-provider/hooks/use-global-config.mjs";
16
+ const ke = {
17
17
  key: 0
18
- }, He = /* @__PURE__ */ Z({
18
+ }, $e = /* @__PURE__ */ ae({
19
19
  name: "ApTable",
20
20
  __name: "ap-table",
21
21
  props: {
@@ -132,149 +132,156 @@ const ve = {
132
132
  setup(D, {
133
133
  expose: W
134
134
  }) {
135
- const t = D, w = ee(), [, j] = pe(), {
135
+ const o = D, w = te(), [, j] = fe(), {
136
136
  t: _
137
- } = we(), {
137
+ } = Pe(), {
138
138
  e: g,
139
139
  b: u
140
- } = Be("ap-table"), A = Pe("uiMode", "aplus"), {
140
+ } = ve("ap-table"), A = Ie("uiMode", "aplus"), {
141
141
  height: M,
142
142
  contentRef: q
143
- } = Te(), y = d(() => {
144
- var o;
145
- let e = ((o = t.columns) == null ? void 0 : o.filter((a) => !a.hideInTable)) || [];
143
+ } = Be(), y = s(() => {
144
+ var t;
145
+ let e = ((t = o.columns) == null ? void 0 : t.filter((a) => !a.hideInTable)) || [];
146
146
  return e = e.map((a) => ({
147
- ...be(a),
147
+ ...N(Se(a), ["ellipsis"]),
148
148
  customRender({
149
- value: n,
150
- ...l
149
+ value: r,
150
+ ...n
151
151
  }) {
152
- const C = Ce(a), k = me[C], Y = Se(a, {
153
- value: n,
154
- ...l
152
+ const C = Fe(a), I = ge[C], ee = Re(a, {
153
+ value: r,
154
+ ...n
155
155
  });
156
- let S = U(a, n, s(k, m(Y, {
156
+ let S = X(a, r, d(I, f(ee, {
157
157
  mode: "read"
158
158
  }), null));
159
159
  return a.customRender && (S = a.customRender({
160
- value: n,
161
- ...l,
160
+ value: r,
161
+ ...n,
162
162
  column: a,
163
163
  originalNode: S
164
164
  })), S;
165
165
  }
166
166
  })), e;
167
- }), B = d(() => {
168
- var e, o, a;
169
- return ((a = (o = (e = t.columns) == null ? void 0 : e.filter((n) => !n.hideInSearch && n.dataIndex && (n.valueType || n.customRenderFormItem) && !N.includes(n.valueType))) == null ? void 0 : o.sort((n, l) => {
170
- let C = V(n.order);
171
- return V(l.order) - C;
172
- })) == null ? void 0 : a.map((n) => {
173
- const l = Fe(n, xe(n.fieldProps, {}));
167
+ }), B = s(() => {
168
+ var e, t, a;
169
+ return ((a = (t = (e = o.columns) == null ? void 0 : e.filter((r) => !r.hideInSearch && r.dataIndex && (r.valueType || r.customRenderFormItem) && !z.includes(r.valueType))) == null ? void 0 : t.sort((r, n) => {
170
+ let C = V(r.order);
171
+ return V(n.order) - C;
172
+ })) == null ? void 0 : a.map((r) => {
173
+ const n = xe(r, Te(r.fieldProps, {}));
174
174
  return {
175
- ...n,
175
+ ...r,
176
176
  fieldProps: {
177
- label: n.title,
178
- name: n.dataIndex,
179
- ...l || {},
177
+ label: r.title,
178
+ name: r.dataIndex,
179
+ ...n || {},
180
180
  // 格式化placeholder
181
- placeholder: Re(_, n.valueType, l == null ? void 0 : l.placeholder)
181
+ placeholder: we(_, r.valueType, n == null ? void 0 : n.placeholder)
182
182
  }
183
183
  };
184
184
  })) || [];
185
- }), H = d(() => r(y).filter((e) => e.sorter === !0).map((e) => e.dataIndex)), K = d(() => r(y).filter((e) => e.filters && !e.onFilter).map((e) => e.dataIndex)), {
186
- formRef: h,
185
+ }), H = s(() => l(y).filter((e) => e.sorter === !0).map((e) => e.dataIndex)), K = s(() => l(y).filter((e) => e.filters && !e.onFilter).map((e) => e.dataIndex)), {
186
+ formRef: b,
187
187
  submit: P,
188
188
  reset: v,
189
189
  tableProps: c,
190
190
  handleTableChange: $,
191
- data: b
192
- } = ge({
191
+ data: h
192
+ } = be({
193
193
  async request(e) {
194
- var a, n;
195
- const o = await ((a = t.request) == null ? void 0 : a.call(t, e));
196
- return (n = t.onLoad) == null || n.call(t, (o == null ? void 0 : o.data) || []), {
197
- data: (o == null ? void 0 : o.data) || [],
198
- total: (o == null ? void 0 : o.total) || 0
194
+ var a, r;
195
+ const t = await ((a = o.request) == null ? void 0 : a.call(o, e));
196
+ return (r = o.onLoad) == null || r.call(o, (t == null ? void 0 : t.data) || []), {
197
+ data: (t == null ? void 0 : t.data) || [],
198
+ total: (t == null ? void 0 : t.total) || 0
199
199
  };
200
200
  },
201
- filterFields: r(K),
202
- sortFields: r(H),
203
- defaultParams: t.params,
204
- defaultData: t.defaultData,
205
- manual: t.manual,
206
- defaultCurrent: t.pagination ? t.pagination.defaultCurrent : void 0,
207
- defaultPageSize: t.pagination ? t.pagination.defaultPageSize : void 0,
208
- formatParams: t.beforeSearchSubmit
209
- }), I = d(() => {
201
+ filterFields: l(K),
202
+ sortFields: l(H),
203
+ defaultParams: o.params,
204
+ defaultData: o.defaultData,
205
+ manual: o.manual,
206
+ defaultCurrent: o.pagination ? o.pagination.defaultCurrent : void 0,
207
+ defaultPageSize: o.pagination ? o.pagination.defaultPageSize : void 0,
208
+ formatParams: o.beforeSearchSubmit
209
+ }), G = s(() => {
210
210
  var e;
211
- return t.scroll ? t.scroll : t.adaptive && (b.value.total > 0 || (e = t.dataSource) != null && e.length) ? {
212
- y: r(M),
211
+ return o.scroll ? o.scroll : o.adaptive && (h.value.total > 0 || (e = o.dataSource) != null && e.length) ? {
212
+ y: l(M),
213
213
  x: "100%"
214
214
  } : {
215
215
  x: !0
216
216
  };
217
- }), G = d(() => {
218
- const e = r(c);
219
- console.log("xxx", r(I));
220
- const o = T(t.dataSource) ? e : {
217
+ }), Q = s(() => {
218
+ var e;
219
+ if (o.tableLayout)
220
+ return o.tableLayout;
221
+ if ((e = o.columns) != null && e.some((t) => t.ellipsis))
222
+ return "fixed";
223
+ }), U = s(() => {
224
+ const e = l(c), t = T(o.dataSource) ? e : {
221
225
  ...e,
222
- dataSource: t.dataSource,
223
- onChange: t.onChange
226
+ dataSource: o.dataSource,
227
+ onChange: o.onChange
224
228
  };
225
229
  return {
226
- ...t,
227
230
  ...o,
228
- loading: T(t.loading) ? r(c).loading : t.loading,
229
- pagination: t.pagination === !1 ? !1 : r(c).pagination,
230
- scroll: r(I)
231
+ ...t,
232
+ loading: T(o.loading) ? l(c).loading : o.loading,
233
+ pagination: o.pagination === !1 ? !1 : l(c).pagination,
234
+ scroll: l(G)
231
235
  };
232
- }), Q = d(() => [u(), t.card ? null : u("wrapper"), t.adaptive ? u("adaptive") : null].filter(Boolean));
233
- function U(e, o, a) {
234
- return N.includes(e.valueType) ? a : e.copyable || e.ellipsis ? s(se.Text, {
236
+ }), J = s(() => [u(), o.card ? null : u("wrapper"), o.adaptive ? u("adaptive") : null].filter(Boolean));
237
+ function X(e, t, a) {
238
+ return z.includes(e.valueType) ? a : e.copyable || e.ellipsis ? d(ie.Paragraph, {
235
239
  copyable: e.copyable ? {
236
- text: o,
240
+ text: t,
237
241
  tooltip: !1
238
242
  } : !1,
239
- ellipsis: e.ellipsis ? {
240
- tooltip: o
243
+ ellipsis: e.ellipsis ? he(e.ellipsis) ? {
244
+ tooltip: t
245
+ } : {
246
+ ...e.ellipsis,
247
+ tooltip: t
241
248
  } : !1,
242
- content: a
249
+ content: e.ellipsis ? t : a
243
250
  }, null) : a;
244
251
  }
245
- ae(() => r(b).loading, (e) => {
246
- var o;
247
- (o = t.onLoadingChange) == null || o.call(t, e);
252
+ oe(() => l(h).loading, (e) => {
253
+ var t;
254
+ (t = o.onLoadingChange) == null || t.call(o, e);
248
255
  });
249
- function J(e) {
250
- var o, a, n;
251
- (n = (a = (o = h.value) == null ? void 0 : o.apForm) == null ? void 0 : a.setFieldsValue) == null || n.call(a, e);
256
+ function Y(e) {
257
+ var t, a, r;
258
+ (r = (a = (t = b.value) == null ? void 0 : t.apForm) == null ? void 0 : a.setFieldsValue) == null || r.call(a, e);
252
259
  }
253
- function X() {
254
- var e, o, a;
255
- return (a = (o = (e = h.value) == null ? void 0 : e.apForm) == null ? void 0 : o.getFieldsValue) == null ? void 0 : a.call(o, !0);
260
+ function Z() {
261
+ var e, t, a;
262
+ return (a = (t = (e = b.value) == null ? void 0 : e.apForm) == null ? void 0 : t.getFieldsValue) == null ? void 0 : a.call(t, !0);
256
263
  }
257
264
  return W({
258
265
  submit: () => P(),
259
266
  reset: () => v(),
260
- setSearchFormValues: J,
261
- getSearchFormValues: X,
262
- dataSource: d(() => r(b).records)
263
- }), (e, o) => (i(), f("div", {
264
- class: F(Q.value)
265
- }, [r(T)(e.dataSource) && e.searchForm !== !1 && B.value.length > 0 ? (i(), f("div", {
267
+ setSearchFormValues: Y,
268
+ getSearchFormValues: Z,
269
+ dataSource: s(() => l(h).records)
270
+ }), (e, t) => (i(), m("div", {
271
+ class: F(J.value)
272
+ }, [l(T)(e.dataSource) && e.searchForm !== !1 && B.value.length > 0 ? (i(), m("div", {
266
273
  key: 0,
267
- class: F(e.card ? r(g)("search-wrapper") : null),
268
- style: x(e.searchFormWrapperStyle)
269
- }, [s(r(ce).SearchForm, m(e.searchForm || {}, {
274
+ class: F(e.card ? l(g)("search-wrapper") : null),
275
+ style: R(e.searchFormWrapperStyle)
276
+ }, [d(l(me).SearchForm, f(e.searchForm || {}, {
270
277
  ref_key: "formRef",
271
- ref: h,
278
+ ref: b,
272
279
  "custom-reset": "",
273
- onSubmit: r(P),
274
- onReset: r(v),
275
- "submit-loading": r(c).loading
276
- }), E({
277
- default: p(() => [(i(!0), f(te, null, O(B.value, (a) => (i(), oe(re(a.customRenderFormItem ? a.customRenderFormItem(a) : r(fe)[a.valueType || "text"]), m({
280
+ onSubmit: l(P),
281
+ onReset: l(v),
282
+ "submit-loading": l(c).loading
283
+ }), k({
284
+ default: p(() => [(i(!0), m(re, null, L(B.value, (a) => (i(), le(ne(a.customRenderFormItem ? a.customRenderFormItem(a) : l(ye)[a.valueType || "text"]), f({
278
285
  key: a.dataIndex,
279
286
  ref_for: !0
280
287
  }, a.fieldProps || {}, {
@@ -283,41 +290,42 @@ const ve = {
283
290
  _: 2
284
291
  }, [w.searchFormExtra ? {
285
292
  name: "extra",
286
- fn: p(() => [R(e.$slots, "searchFormExtra")]),
293
+ fn: p(() => [x(e.$slots, "searchFormExtra")]),
287
294
  key: "0"
288
- } : void 0]), 1040, ["onSubmit", "onReset", "submit-loading"])], 6)) : L("", !0), z("div", {
295
+ } : void 0]), 1040, ["onSubmit", "onReset", "submit-loading"])], 6)) : E("", !0), O("div", {
289
296
  ref_key: "contentRef",
290
297
  ref: q,
291
- class: F([r(g)("table-wrapper"), e.card ? r(g)("table-wrapper-card") : null]),
292
- style: x(e.tableWrapperStyle)
293
- }, [R(e.$slots, "title"), s(r(ue), m({
294
- class: r(A) === "admin" ? r(u)("table-admin") : r(u)("table")
295
- }, G.value, {
296
- onChange: r($),
298
+ class: F([l(g)("table-wrapper"), e.card ? l(g)("table-wrapper-card") : null]),
299
+ style: R(e.tableWrapperStyle)
300
+ }, [x(e.$slots, "title"), d(l(pe), f({
301
+ class: l(A) === "admin" ? l(u)("table-admin") : l(u)("table")
302
+ }, U.value, {
303
+ "table-layout": Q.value,
304
+ onChange: l($),
297
305
  columns: y.value
298
- }), E({
306
+ }), k({
299
307
  headerCell: p(({
300
308
  column: a,
301
- title: n
302
- }) => [a.tooltip ? (i(), f("span", ve, [z("span", null, ne(n), 1), s(r(ie), {
309
+ title: r
310
+ }) => [a.tooltip ? (i(), m("span", ke, [O("span", null, se(r), 1), d(l(ce), {
303
311
  title: a.tooltip,
304
312
  placement: "bottom"
305
313
  }, {
306
- default: p(() => [s(r(he), {
307
- style: x({
314
+ default: p(() => [d(l(Ce), {
315
+ style: R({
308
316
  paddingLeft: "4px",
309
- color: r(j).colorPrimary
317
+ color: l(j).colorPrimary
310
318
  })
311
319
  }, null, 8, ["style"])]),
312
320
  _: 2
313
- }, 1032, ["title"])])) : L("", !0)]),
321
+ }, 1032, ["title"])])) : E("", !0)]),
314
322
  _: 2
315
- }, [O(r(ye)(w, ["title", "searchFormExtra"]), (a, n) => ({
316
- name: n,
317
- fn: p((l) => [R(e.$slots, n, le(de(l || {})))])
318
- }))]), 1040, ["class", "onChange", "columns"])], 6)], 2));
323
+ }, [L(l(N)(w, ["title", "searchFormExtra"]), (a, r) => ({
324
+ name: r,
325
+ fn: p((n) => [x(e.$slots, r, de(ue(n || {})))])
326
+ }))]), 1040, ["class", "table-layout", "onChange", "columns"])], 6)], 2));
319
327
  }
320
328
  });
321
329
  export {
322
- He as default
330
+ $e as default
323
331
  };