@aplus-frontend/ui 7.10.6 → 7.11.1

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 (113) hide show
  1. package/es/index.mjs +93 -91
  2. package/es/src/ag-grid/editable/form-item.vue.mjs +75 -63
  3. package/es/src/ag-grid/editable/index.vue.mjs +80 -72
  4. package/es/src/ag-grid/editable/interface.d.ts +2 -1
  5. package/es/src/ag-grid/editable/utils.d.ts +7 -0
  6. package/es/src/ag-grid/editable/utils.mjs +32 -17
  7. package/es/src/ap-form/ap-form.vue2.mjs +144 -153
  8. package/es/src/ap-form/utils/transform.d.ts +6 -0
  9. package/es/src/ap-form/utils/transform.mjs +30 -0
  10. package/es/src/ap-pro-card/components/card/index.vue.d.ts +1 -1
  11. package/es/src/business/ap-appendix/ap-appendix.vue2.mjs +129 -93
  12. package/es/src/business/ap-appendix/interface.d.ts +4 -0
  13. package/es/src/business/ap-appendix/style/index.mjs +56 -34
  14. package/es/src/business/ap-attachment/ApAttachment.mjs +112 -89
  15. package/es/src/business/ap-attachment/style/index.mjs +21 -7
  16. package/es/src/business/ap-download/ap-download.vue.d.ts +1 -0
  17. package/es/src/business/ap-download/ap-download.vue.mjs +86 -45
  18. package/es/src/business/ap-download/interface.d.ts +4 -0
  19. package/es/src/business/ap-download/style/index.mjs +8 -4
  20. package/es/src/business/ap-file-preview/ap-file-preview.vue.d.ts +4 -0
  21. package/es/src/business/ap-file-preview/ap-file-preview.vue.mjs +4 -0
  22. package/es/src/business/ap-file-preview/ap-file-preview.vue2.mjs +104 -0
  23. package/es/src/business/ap-file-preview/components/error-result/index.vue.d.ts +6 -0
  24. package/es/src/business/ap-file-preview/components/error-result/index.vue.mjs +4 -0
  25. package/es/src/business/ap-file-preview/components/error-result/index.vue2.mjs +40 -0
  26. package/es/src/business/ap-file-preview/icons/not-exist-icon.vue.d.ts +3 -0
  27. package/es/src/business/ap-file-preview/icons/not-exist-icon.vue.mjs +20 -0
  28. package/es/src/business/ap-file-preview/icons/not-preview-icon.vue.d.ts +3 -0
  29. package/es/src/business/ap-file-preview/icons/not-preview-icon.vue.mjs +20 -0
  30. package/es/src/business/ap-file-preview/index.d.ts +7 -0
  31. package/es/src/business/ap-file-preview/index.mjs +8 -0
  32. package/es/src/business/ap-file-preview/interface.d.ts +45 -0
  33. package/es/src/business/ap-file-preview/style/index.d.ts +5 -0
  34. package/es/src/business/ap-file-preview/style/index.mjs +46 -0
  35. package/es/src/business/ap-file-preview/utils/create-file-preview-modal.d.ts +2 -0
  36. package/es/src/business/ap-file-preview/utils/create-file-preview-modal.mjs +18 -0
  37. package/es/src/business/ap-file-preview/utils/default-parser-plugin.d.ts +4 -0
  38. package/es/src/business/ap-file-preview/utils/default-parser-plugin.mjs +48 -0
  39. package/es/src/business/ap-image/ApImage.vue2.mjs +16 -16
  40. package/es/src/business/ap-upload/apUpload.vue.d.ts +1 -1
  41. package/es/src/business/ap-upload/apUploadTypes.d.ts +2 -2
  42. package/es/src/business/ap-upload/components/MultipleFile.vue2.mjs +94 -82
  43. package/es/src/business/ap-upload/style/multiple-file.mjs +6 -3
  44. package/es/src/business/index.d.ts +1 -0
  45. package/es/src/business/index.mjs +16 -14
  46. package/es/src/config-provider/config-provider-props.d.ts +6 -0
  47. package/es/src/config-provider/config-provider-props.mjs +6 -2
  48. package/es/src/config-provider/config-provider.d.ts +17 -1
  49. package/es/src/config-provider/config-provider.mjs +24 -23
  50. package/es/src/config-provider/hooks/use-global-config.d.ts +7 -0
  51. package/es/src/config-provider/index.d.ts +31 -3
  52. package/es/src/index.mjs +74 -72
  53. package/es/src/locale/lang/en.mjs +5 -0
  54. package/es/src/locale/lang/zh-cn.mjs +5 -0
  55. package/es/src/version.d.ts +1 -1
  56. package/es/src/version.mjs +1 -1
  57. package/lib/index.js +1 -1
  58. package/lib/src/ag-grid/editable/form-item.vue.js +1 -1
  59. package/lib/src/ag-grid/editable/index.vue.js +1 -1
  60. package/lib/src/ag-grid/editable/interface.d.ts +2 -1
  61. package/lib/src/ag-grid/editable/utils.d.ts +7 -0
  62. package/lib/src/ag-grid/editable/utils.js +1 -1
  63. package/lib/src/ap-form/ap-form.vue2.js +1 -1
  64. package/lib/src/ap-form/utils/transform.d.ts +6 -0
  65. package/lib/src/ap-form/utils/transform.js +1 -0
  66. package/lib/src/ap-pro-card/components/card/index.vue.d.ts +1 -1
  67. package/lib/src/business/ap-appendix/ap-appendix.vue2.js +1 -1
  68. package/lib/src/business/ap-appendix/interface.d.ts +4 -0
  69. package/lib/src/business/ap-appendix/style/index.js +1 -1
  70. package/lib/src/business/ap-attachment/ApAttachment.js +1 -1
  71. package/lib/src/business/ap-attachment/style/index.js +1 -1
  72. package/lib/src/business/ap-download/ap-download.vue.d.ts +1 -0
  73. package/lib/src/business/ap-download/ap-download.vue.js +1 -1
  74. package/lib/src/business/ap-download/interface.d.ts +4 -0
  75. package/lib/src/business/ap-download/style/index.js +1 -1
  76. package/lib/src/business/ap-file-preview/ap-file-preview.vue.d.ts +4 -0
  77. package/lib/src/business/ap-file-preview/ap-file-preview.vue.js +1 -0
  78. package/lib/src/business/ap-file-preview/ap-file-preview.vue2.js +1 -0
  79. package/lib/src/business/ap-file-preview/components/error-result/index.vue.d.ts +6 -0
  80. package/lib/src/business/ap-file-preview/components/error-result/index.vue.js +1 -0
  81. package/lib/src/business/ap-file-preview/components/error-result/index.vue2.js +1 -0
  82. package/lib/src/business/ap-file-preview/icons/not-exist-icon.vue.d.ts +3 -0
  83. package/lib/src/business/ap-file-preview/icons/not-exist-icon.vue.js +1 -0
  84. package/lib/src/business/ap-file-preview/icons/not-preview-icon.vue.d.ts +3 -0
  85. package/lib/src/business/ap-file-preview/icons/not-preview-icon.vue.js +1 -0
  86. package/lib/src/business/ap-file-preview/index.d.ts +7 -0
  87. package/lib/src/business/ap-file-preview/index.js +1 -0
  88. package/lib/src/business/ap-file-preview/interface.d.ts +45 -0
  89. package/lib/src/business/ap-file-preview/style/index.d.ts +5 -0
  90. package/lib/src/business/ap-file-preview/style/index.js +1 -0
  91. package/lib/src/business/ap-file-preview/utils/create-file-preview-modal.d.ts +2 -0
  92. package/lib/src/business/ap-file-preview/utils/create-file-preview-modal.js +1 -0
  93. package/lib/src/business/ap-file-preview/utils/default-parser-plugin.d.ts +4 -0
  94. package/lib/src/business/ap-file-preview/utils/default-parser-plugin.js +1 -0
  95. package/lib/src/business/ap-image/ApImage.vue2.js +1 -1
  96. package/lib/src/business/ap-upload/apUpload.vue.d.ts +1 -1
  97. package/lib/src/business/ap-upload/apUploadTypes.d.ts +2 -2
  98. package/lib/src/business/ap-upload/components/MultipleFile.vue2.js +1 -1
  99. package/lib/src/business/ap-upload/style/multiple-file.js +1 -1
  100. package/lib/src/business/index.d.ts +1 -0
  101. package/lib/src/business/index.js +1 -1
  102. package/lib/src/config-provider/config-provider-props.d.ts +6 -0
  103. package/lib/src/config-provider/config-provider-props.js +1 -1
  104. package/lib/src/config-provider/config-provider.d.ts +17 -1
  105. package/lib/src/config-provider/config-provider.js +1 -1
  106. package/lib/src/config-provider/hooks/use-global-config.d.ts +7 -0
  107. package/lib/src/config-provider/index.d.ts +31 -3
  108. package/lib/src/index.js +1 -1
  109. package/lib/src/locale/lang/en.js +1 -1
  110. package/lib/src/locale/lang/zh-cn.js +1 -1
  111. package/lib/src/version.d.ts +1 -1
  112. package/lib/src/version.js +1 -1
  113. package/package.json +1 -1
@@ -1,18 +1,18 @@
1
- import { defineComponent as $, useSlots as q, ref as b, watch as J, unref as n, createBlock as Q, openBlock as X, withCtx as c, createVNode as R, mergeProps as Y, createSlots as Z, renderList as ee, renderSlot as oe, normalizeProps as ae, guardReactiveProps as te } from "vue";
2
- import { isEqual as ne, isArray as v, omit as le } from "lodash-unified";
3
- import { ApForm as f } from "../../ap-form/index.mjs";
1
+ import { defineComponent as M, useSlots as $, ref as v, watch as q, unref as l, createBlock as J, openBlock as Q, withCtx as m, createVNode as R, mergeProps as X, createSlots as Y, renderList as Z, renderSlot as ee, normalizeProps as oe, guardReactiveProps as ae } from "vue";
2
+ import { isEqual as te, isArray as b, omit as ne } from "lodash-unified";
3
+ import { ApForm as c } from "../../ap-form/index.mjs";
4
4
  import "../../config-provider/index.mjs";
5
5
  import "../../hooks/index.mjs";
6
- import { useEditableApi as re } from "../hooks/use-editable-api.mjs";
7
- import { useGetEditableColumns as se } from "../hooks/use-editable-columns.mjs";
6
+ import { useEditableApi as le } from "../hooks/use-editable-api.mjs";
7
+ import { useGetEditableColumns as re } from "../hooks/use-editable-columns.mjs";
8
8
  import "../index.vue2.mjs";
9
- import ie from "../style/editable.mjs";
10
- import { arrayToObject as y, getRowKey as de } from "./utils.mjs";
11
- import { useNamespace as ue } from "../../config-provider/hooks/use-namespace.mjs";
12
- import { useControllableValue as pe } from "../../hooks/useControllableValue.mjs";
13
- import { useGlobalConfig as me } from "../../config-provider/hooks/use-global-config.mjs";
14
- import ce from "../index.vue.mjs";
15
- const Fe = /* @__PURE__ */ $({
9
+ import se from "../style/editable.mjs";
10
+ import { arrayToObject as f, getRowKey as ie } from "./utils.mjs";
11
+ import { useNamespace as de } from "../../config-provider/hooks/use-namespace.mjs";
12
+ import { useControllableValue as ue } from "../../hooks/useControllableValue.mjs";
13
+ import { useGlobalConfig as pe } from "../../config-provider/hooks/use-global-config.mjs";
14
+ import me from "../index.vue.mjs";
15
+ const Fe = /* @__PURE__ */ M({
16
16
  name: "EditableGrid",
17
17
  __name: "index",
18
18
  props: {
@@ -135,109 +135,117 @@ const Fe = /* @__PURE__ */ $({
135
135
  expose: x,
136
136
  emit: B
137
137
  }) {
138
- const S = q(), o = C, {
138
+ const S = $(), a = C, {
139
139
  b: T
140
- } = ue("editable-aggrid"), _ = ie("editable-aggrid"), F = B, d = b(), {
141
- value: r,
142
- updateValue: w
143
- } = pe(o, F), l = b(), E = f.useWatch(o.name, l);
144
- J(r, (e) => {
145
- const a = y(e, o.rowKey);
146
- ne(a, n(E)) || l.value?.setFieldValue(o.name, a);
140
+ } = de("editable-aggrid"), F = se("editable-aggrid"), _ = B, i = v(), {
141
+ value: s,
142
+ updateValue: y
143
+ } = ue(a, _), r = v(), E = c.useWatch(a.name, r);
144
+ q(s, (e) => {
145
+ const o = f(e, a.rowKey);
146
+ te(o, l(E)) || r.value?.setFieldValue(a.name, o);
147
147
  }, {
148
148
  deep: !0
149
149
  });
150
- const K = me("valueTypeMap"), k = se(o, K), {
151
- add: N,
152
- addMultiple: j,
153
- remove: A,
154
- removeByKey: D,
155
- getRowData: I,
156
- getRowsData: V,
150
+ const K = pe("valueTypeMap"), k = re(a, K), {
151
+ add: A,
152
+ addMultiple: N,
153
+ remove: j,
154
+ removeByKey: I,
155
+ getRowData: V,
156
+ getRowsData: D,
157
157
  setRowData: H,
158
158
  clear: O,
159
- refreshRowIds: p
160
- } = re(o, l, r, w);
159
+ refreshRowIds: d
160
+ } = le(a, r, s, y);
161
161
  function z() {
162
- const e = d.value?._internalGridApi;
163
- if (!p.value?.length || !e)
162
+ const e = i.value?._internalGridApi;
163
+ if (!d.value?.length || !e)
164
164
  return;
165
- const a = p.value.map((t) => e.getRowNode(t)).filter((t) => !!t);
165
+ const o = d.value.map((t) => e.getRowNode(t)).filter((t) => !!t);
166
166
  e.refreshCells({
167
- rowNodes: a,
167
+ rowNodes: o,
168
168
  force: !0
169
- }), p.value = [];
169
+ }), d.value = [];
170
170
  }
171
171
  function L() {
172
- l.value?.resetFields();
172
+ r.value?.resetFields();
173
173
  }
174
- function P(e) {
175
- return e ? (v(e) ? e : [e]).map((t) => v(t) ? [o.name, ...t] : [o.name, t]) : void 0;
174
+ function w(e) {
175
+ return e ? (b(e) ? e : [e]).map((t) => b(t) ? [a.name, ...t] : [a.name, t]) : void 0;
176
176
  }
177
- async function G(e, a) {
178
- const s = (await l.value?.validateFields(P(e), a))?.[o.name];
177
+ function g(e) {
179
178
  try {
180
- const u = Object.keys(s), h = r.value.map((i) => de(i, void 0, o.rowKey));
181
- return u.sort((i, M) => h.findIndex((m) => String(m) === i) - h.findIndex((m) => String(m) === M)), u.map((i) => s[i]);
179
+ const o = Object.keys(e), t = s.value.map((n) => ie(n, void 0, a.rowKey));
180
+ return o.sort((n, u) => t.findIndex((p) => String(p) === n) - t.findIndex((p) => String(p) === u)), o.map((n) => e[n]);
182
181
  } catch {
183
- return s;
182
+ return e;
184
183
  }
185
184
  }
185
+ async function P(e, o) {
186
+ const n = (await r.value?.validateFields(w(e), o))?.[a.name];
187
+ return g(n);
188
+ }
189
+ async function G(e, o) {
190
+ const n = (await r.value?.validateFieldsReturnTransformed(w(e), o))?.[a.name];
191
+ return g(n);
192
+ }
186
193
  function U(e) {
187
- w(e);
188
- const a = y(e, o.rowKey);
189
- l.value?.setFieldValue(o.name, a);
194
+ y(e);
195
+ const o = f(e, a.rowKey);
196
+ r.value?.setFieldValue(a.name, o);
190
197
  }
191
- function g(e, a) {
192
- const t = e === "end" ? r.value.length - 1 : e;
193
- d.value?.scrollToRow(t, a);
198
+ function h(e, o) {
199
+ const t = e === "end" ? s.value.length - 1 : e;
200
+ i.value?.scrollToRow(t, o);
194
201
  }
195
- function W(e, a) {
196
- d.value?.scrollToColumn(e, a);
202
+ function W(e, o) {
203
+ i.value?.scrollToColumn(e, o);
197
204
  }
198
205
  return x({
199
206
  resetFields: L,
200
- validateFields: G,
201
- add: N,
202
- addMultiple: j,
203
- remove: A,
204
- removeByKey: D,
205
- getRowData: I,
206
- getRowsData: V,
207
+ validateFields: P,
208
+ validateFieldsReturnTransformed: G,
209
+ add: A,
210
+ addMultiple: N,
211
+ remove: j,
212
+ removeByKey: I,
213
+ getRowData: V,
214
+ getRowsData: D,
207
215
  setRowData: H,
208
216
  clear: O,
209
217
  setTableData: U,
210
- scrollTo: g,
211
- scrollToRow: g,
218
+ scrollTo: h,
219
+ scrollToRow: h,
212
220
  scrollToColumn: W
213
- }), (e, a) => (X(), Q(n(f), {
221
+ }), (e, o) => (Q(), J(l(c), {
214
222
  ref_key: "formRef",
215
- ref: l,
223
+ ref: r,
216
224
  "initial-values": {
217
- [o.name]: n(y)(n(r), o.rowKey)
225
+ [a.name]: l(f)(l(s), a.rowKey)
218
226
  },
219
227
  style: {
220
228
  height: "100%"
221
229
  }
222
230
  }, {
223
- default: c(() => [R(n(f).FormItem, {
231
+ default: m(() => [R(l(c).FormItem, {
224
232
  name: e.name,
225
233
  "no-style": ""
226
234
  }, {
227
- default: c(() => [R(ce, Y(n(le)(o, ["name", "value", "onUpdate:value", "maxLength", "onChange", "defaultValue"]), {
235
+ default: m(() => [R(me, X(l(ne)(a, ["name", "value", "onUpdate:value", "maxLength", "onChange", "defaultValue"]), {
228
236
  ref_key: "tableRef",
229
- ref: d,
230
- class: [n(T)(), n(_)],
237
+ ref: i,
238
+ class: [l(T)(), l(F)],
231
239
  size: "mini",
232
- columns: n(k),
233
- "data-source": n(r),
240
+ columns: l(k),
241
+ "data-source": l(s),
234
242
  "search-form": !1,
235
243
  onUpdate: z
236
- }), Z({
244
+ }), Y({
237
245
  _: 2
238
- }, [ee(S, (t, s) => ({
239
- name: s,
240
- fn: c((u) => [oe(e.$slots, s, ae(te(u || {})))])
246
+ }, [Z(S, (t, n) => ({
247
+ name: n,
248
+ fn: m((u) => [ee(e.$slots, n, oe(ae(u || {})))])
241
249
  }))]), 1040, ["class", "columns", "data-source"])]),
242
250
  _: 3
243
251
  }, 8, ["name"])]),
@@ -84,8 +84,9 @@ export type EditableAgGridExpose<RecordType = any, ModelType = RecordType[]> = O
84
84
  scrollToRow: (index: number | 'end', position?: 'top' | 'bottom' | 'middle') => void;
85
85
  scrollToColumn: (key: string, position?: 'auto' | 'start' | 'middle' | 'end') => void;
86
86
  remove: (data: RecordType | RecordType[]) => void;
87
+ validateFieldsReturnTransformed: EditableTableExpose<ModelType, RecordType>['validateFields'];
87
88
  };
88
- export type EditableAgGridFormItemExpose<RecordType = any, ModelType = RecordType[]> = Omit<EditableAgGridExpose<RecordType, ModelType>, 'resetFields' | 'validateFields'>;
89
+ export type EditableAgGridFormItemExpose<RecordType = any, ModelType = RecordType[]> = Omit<EditableAgGridExpose<RecordType, ModelType>, 'resetFields' | 'validateFields' | 'validateFieldsReturnTransformed'>;
89
90
  export type EditableAgGridFormItemProps<RecordType = any> = Omit<EditableAgGridProps<RecordType>, 'name' | 'value' | 'onUpdate:value'> & {
90
91
  label?: string;
91
92
  /**
@@ -1,5 +1,12 @@
1
+ import { ApFormItemTransformType } from '../../ap-form';
1
2
  import { Recordable } from '../../type';
2
3
  import { AgGridProps } from '../interface';
4
+ import { EditableAgGridColumnType } from './interface';
3
5
  export declare function getRowKey(record: any, index: number | undefined, rowKey: AgGridProps['rowKey']): any;
4
6
  export declare function arrayToObject(array: any[], rowKey: AgGridProps['rowKey']): Recordable;
5
7
  export declare function updateArrItem(arr: any[], rowKey: AgGridProps['rowKey'], obj: Recordable): any[];
8
+ interface TransformFnMapType {
9
+ [key: string]: ApFormItemTransformType | TransformFnMapType;
10
+ }
11
+ export declare function getColumnTransformOptions(columns: EditableAgGridColumnType[]): TransformFnMapType;
12
+ export {};
@@ -1,23 +1,38 @@
1
- import { isString as a } from "lodash-unified";
2
- function c(r, n, t) {
3
- if (t)
4
- return a(t) ? r[t] : t(r, n);
1
+ import { isString as u } from "lodash-unified";
2
+ import s from "../../ap-form/utils/set.mjs";
3
+ function i(o, t, r) {
4
+ if (r)
5
+ return u(r) ? o[r] : r(o, t);
5
6
  }
6
- function s(r, n) {
7
- const t = {};
8
- return r.forEach((e, u) => {
9
- const o = c(e, u, n);
10
- t[o] = e;
11
- }), t;
7
+ function m(o, t) {
8
+ const r = {};
9
+ return o.forEach((e, n) => {
10
+ const f = i(e, n, t);
11
+ r[f] = e;
12
+ }), r;
12
13
  }
13
- function g(r, n, t) {
14
- return r.map((e, u) => {
15
- const o = c(e, u, n);
16
- return t[o] ?? e;
14
+ function p(o, t, r) {
15
+ return o.map((e, n) => {
16
+ const f = i(e, n, t);
17
+ return r[f] ?? e;
17
18
  });
18
19
  }
20
+ function d(o) {
21
+ let t = {};
22
+ function r(e) {
23
+ for (const n of e)
24
+ n.children?.length ? r(n.children) : n.fieldProps?.transform && (t = s(
25
+ t,
26
+ [n.dataIndex].flat(1),
27
+ n.fieldProps.transform,
28
+ !0
29
+ ));
30
+ }
31
+ return r(o), t;
32
+ }
19
33
  export {
20
- s as arrayToObject,
21
- c as getRowKey,
22
- g as updateArrItem
34
+ m as arrayToObject,
35
+ d as getColumnTransformOptions,
36
+ i as getRowKey,
37
+ p as updateArrItem
23
38
  };