@aplus-frontend/ui 7.19.6 → 7.19.8

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 (39) hide show
  1. package/es/src/ag-grid/editable/form-item.vue.mjs +66 -62
  2. package/es/src/ag-grid/editable/index.vue.mjs +56 -52
  3. package/es/src/ag-grid/editable/interface.d.ts +9 -0
  4. package/es/src/ag-grid/hooks/use-editable-api.d.ts +1 -0
  5. package/es/src/ag-grid/hooks/use-editable-api.mjs +117 -99
  6. package/es/src/ag-grid/hooks/use-editable-form-item-api.d.ts +1 -0
  7. package/es/src/ag-grid/hooks/use-editable-form-item-api.mjs +125 -107
  8. package/es/src/ap-button/ap-button.vue.mjs +23 -23
  9. package/es/src/ap-button/interface.d.ts +1 -1
  10. package/es/src/ap-button/utils/index.d.ts +1 -1
  11. package/es/src/ap-button/utils/index.mjs +7 -7
  12. package/es/src/business/ag-grid-modal/hooks/use-ag-grid-modal.mjs +24 -22
  13. package/es/src/business/ag-grid-modal/hooks/use-ag-grid-select-modal.mjs +49 -47
  14. package/es/src/business/ag-grid-modal/interface.d.ts +2 -0
  15. package/es/src/business/ag-grid-modal/wrapper/index.vue.d.ts +4 -0
  16. package/es/src/business/ag-grid-modal/wrapper/index.vue2.mjs +24 -22
  17. package/es/src/business/ap-batch-action-group/index.d.ts +3 -3
  18. package/es/src/version.d.ts +1 -1
  19. package/es/src/version.mjs +1 -1
  20. package/lib/src/ag-grid/editable/form-item.vue.js +1 -1
  21. package/lib/src/ag-grid/editable/index.vue.js +1 -1
  22. package/lib/src/ag-grid/editable/interface.d.ts +9 -0
  23. package/lib/src/ag-grid/hooks/use-editable-api.d.ts +1 -0
  24. package/lib/src/ag-grid/hooks/use-editable-api.js +1 -1
  25. package/lib/src/ag-grid/hooks/use-editable-form-item-api.d.ts +1 -0
  26. package/lib/src/ag-grid/hooks/use-editable-form-item-api.js +1 -1
  27. package/lib/src/ap-button/ap-button.vue.js +1 -1
  28. package/lib/src/ap-button/interface.d.ts +1 -1
  29. package/lib/src/ap-button/utils/index.d.ts +1 -1
  30. package/lib/src/ap-button/utils/index.js +1 -1
  31. package/lib/src/business/ag-grid-modal/hooks/use-ag-grid-modal.js +1 -1
  32. package/lib/src/business/ag-grid-modal/hooks/use-ag-grid-select-modal.js +1 -1
  33. package/lib/src/business/ag-grid-modal/interface.d.ts +2 -0
  34. package/lib/src/business/ag-grid-modal/wrapper/index.vue.d.ts +4 -0
  35. package/lib/src/business/ag-grid-modal/wrapper/index.vue2.js +1 -1
  36. package/lib/src/business/ap-batch-action-group/index.d.ts +3 -3
  37. package/lib/src/version.d.ts +1 -1
  38. package/lib/src/version.js +1 -1
  39. package/package.json +3 -3
@@ -1,21 +1,21 @@
1
- import { defineComponent as G, useSlots as U, ref as g, onMounted as W, watch as $, unref as r, createElementBlock as q, openBlock as J, Fragment as Q, createVNode as f, mergeProps as h, withCtx as C, createSlots as X, renderList as Y, renderSlot as Z, normalizeProps as ee, guardReactiveProps as oe } from "vue";
2
- import { cloneDeep as u, isEqual as te, omit as ae } from "lodash-unified";
1
+ import { defineComponent as W, useSlots as $, ref as g, onMounted as q, watch as J, unref as r, createElementBlock as Q, openBlock as X, Fragment as Y, createVNode as f, mergeProps as h, withCtx as C, createSlots as Z, renderList as ee, renderSlot as oe, normalizeProps as te, guardReactiveProps as ae } from "vue";
2
+ import { cloneDeep as u, isEqual as ne, omit as le } from "lodash-unified";
3
3
  import { ApForm as R } from "../../ap-form/index.mjs";
4
- import { useInjectForm as ne } from "../../ap-form/context.mjs";
5
- import { useWatch as le } from "../../ap-form/hooks/use-watch.mjs";
6
- import { getModelValue as re } from "../../ap-form/utils/get.mjs";
7
- import { transformValues as se } from "../../ap-form/utils/transform.mjs";
4
+ import { useInjectForm as re } from "../../ap-form/context.mjs";
5
+ import { useWatch as se } from "../../ap-form/hooks/use-watch.mjs";
6
+ import { getModelValue as ie } from "../../ap-form/utils/get.mjs";
7
+ import { transformValues as me } from "../../ap-form/utils/transform.mjs";
8
8
  import "../../config-provider/index.mjs";
9
- import { useGetEditableColumns as ie } from "../hooks/use-editable-columns.mjs";
10
- import { useEditableFormItemApi as me } from "../hooks/use-editable-form-item-api.mjs";
9
+ import { useGetEditableColumns as ue } from "../hooks/use-editable-columns.mjs";
10
+ import { useEditableFormItemApi as de } from "../hooks/use-editable-form-item-api.mjs";
11
11
  import "../index.vue2.mjs";
12
- import ue from "../style/editable.mjs";
13
- import { getShadowName as de } from "../utils.mjs";
14
- import { getColumnTransformOptions as pe, arrayToObject as b, getRowKey as fe } from "./utils.mjs";
15
- import { useNamespace as ce } from "../../config-provider/hooks/use-namespace.mjs";
16
- import { useGlobalConfig as we } from "../../config-provider/hooks/use-global-config.mjs";
17
- import ye from "../index.vue.mjs";
18
- const Ke = /* @__PURE__ */ G({
12
+ import pe from "../style/editable.mjs";
13
+ import { getShadowName as fe } from "../utils.mjs";
14
+ import { getColumnTransformOptions as ce, arrayToObject as b, getRowKey as we } from "./utils.mjs";
15
+ import { useNamespace as ye } from "../../config-provider/hooks/use-namespace.mjs";
16
+ import { useGlobalConfig as ge } from "../../config-provider/hooks/use-global-config.mjs";
17
+ import he from "../index.vue.mjs";
18
+ const ke = /* @__PURE__ */ W({
19
19
  name: "EditableGrid",
20
20
  __name: "form-item",
21
21
  props: {
@@ -142,50 +142,52 @@ const Ke = /* @__PURE__ */ G({
142
142
  name: {},
143
143
  formItem: {}
144
144
  },
145
- setup(v, {
146
- expose: B
145
+ setup(B, {
146
+ expose: v
147
147
  }) {
148
- const x = U(), t = v, {
148
+ const x = $(), t = B, {
149
149
  b: S
150
- } = ce("editable-aggrid"), I = ue("editable-aggrid"), m = g(), {
150
+ } = ye("editable-aggrid"), I = pe("editable-aggrid"), m = g(), {
151
151
  internalInstance: n
152
- } = ne();
152
+ } = re();
153
153
  function F(e) {
154
- const o = pe(t.columns || []);
154
+ const o = ce(t.columns || []);
155
155
  if (!Object.keys(o).length || !e?.length)
156
156
  return e;
157
157
  let a = [];
158
158
  for (const i of e)
159
- a.push(se(i, o));
159
+ a.push(me(i, o));
160
160
  return a;
161
161
  }
162
- const s = de(t.name);
162
+ const s = fe(t.name);
163
163
  let c = [];
164
- W(() => {
165
- const e = t.formItem?.initialValue ?? re(n?.getInitialValues() ?? {}, t.name);
166
- e && (n?.updateInitialModel(s, b(u(e), t.rowKey)), c = u(e), l.value || j(u(e), "suffix", !0));
164
+ q(() => {
165
+ const e = t.formItem?.initialValue ?? ie(n?.getInitialValues() ?? {}, t.name);
166
+ e && (n?.updateInitialModel(s, b(u(e), t.rowKey)), c = u(e), l.value || _(u(e), "suffix", !0));
167
167
  });
168
- const l = g([]), T = le(t.name);
169
- $(() => T.value, (e) => {
170
- te(e, l.value) || w(e ?? u(c));
168
+ const l = g([]), T = se(t.name);
169
+ J(() => T.value, (e) => {
170
+ ne(e, l.value) || w(e ?? u(c));
171
171
  }, {
172
172
  deep: !0,
173
173
  flush: "post",
174
174
  immediate: !0
175
175
  });
176
- const E = we("valueTypeMap"), V = ie(t, E, s), {
177
- add: N,
178
- addMultiple: _,
179
- __addMultiple: j,
180
- remove: K,
181
- removeByKey: k,
182
- getRowData: D,
176
+ const E = ge("valueTypeMap"), V = ue(t, E, s), {
177
+ add: K,
178
+ addMultiple: N,
179
+ __addMultiple: _,
180
+ remove: D,
181
+ removeByKey: j,
182
+ getRowData: k,
183
183
  getRowsData: O,
184
- setRowData: z,
185
- clear: H,
184
+ getRowDataByKey: z,
185
+ setRowData: H,
186
+ setRowDataByKey: L,
187
+ clear: M,
186
188
  refreshRowIds: d
187
- } = me(t, n, l, s);
188
- function L() {
189
+ } = de(t, n, l, s);
190
+ function P() {
189
191
  const e = m.value?._internalGridApi;
190
192
  if (!d.value?.length || !e)
191
193
  return;
@@ -204,34 +206,36 @@ const Ke = /* @__PURE__ */ G({
204
206
  const a = e === "end" ? l.value.length - 1 : e;
205
207
  m.value?.scrollToRow(a, o);
206
208
  }
207
- function M(e, o) {
209
+ function A(e, o) {
208
210
  m.value?.scrollToColumn(e, o);
209
211
  }
210
- function P(e, o) {
212
+ function G(e, o) {
211
213
  const a = [s, String(e), o].flat();
212
214
  return n?.validateFields([a]);
213
215
  }
214
- function A(e) {
215
- const a = r(l).map((i, p) => [s, String(fe(i, p, t.rowKey)), e].flat());
216
+ function U(e) {
217
+ const a = r(l).map((i, p) => [s, String(we(i, p, t.rowKey)), e].flat());
216
218
  return n?.validateFields(a);
217
219
  }
218
- return B({
219
- add: N,
220
- addMultiple: _,
221
- remove: K,
222
- removeByKey: k,
223
- getRowData: D,
220
+ return v({
221
+ add: K,
222
+ addMultiple: N,
223
+ remove: D,
224
+ removeByKey: j,
225
+ getRowData: k,
224
226
  getRowsData: O,
225
- setRowData: z,
226
- clear: H,
227
+ getRowDataByKey: z,
228
+ setRowData: H,
229
+ clear: M,
227
230
  setTableData: w,
228
231
  scrollTo: y,
229
232
  scrollToRow: y,
230
- scrollToColumn: M,
231
- validateCell: P,
232
- validateColumn: A,
233
+ scrollToColumn: A,
234
+ validateCell: G,
235
+ validateColumn: U,
236
+ setRowDataByKey: L,
233
237
  table: m
234
- }), (e, o) => (J(), q(Q, null, [f(r(R).FormItem, {
238
+ }), (e, o) => (X(), Q(Y, null, [f(r(R).FormItem, {
235
239
  hidden: "",
236
240
  name: e.name,
237
241
  "initial-value": e.formItem?.initialValue,
@@ -239,7 +243,7 @@ const Ke = /* @__PURE__ */ G({
239
243
  }, null, 8, ["name", "initial-value"]), f(r(R).FormItem, h({
240
244
  label: e.label
241
245
  }, e.formItem), {
242
- default: C(() => [f(ye, h(r(ae)(t, ["name", "maxLength", "onChange", "defaultValue", "formItem"]), {
246
+ default: C(() => [f(he, h(r(le)(t, ["name", "maxLength", "onChange", "defaultValue", "formItem"]), {
243
247
  ref_key: "tableRef",
244
248
  ref: m,
245
249
  class: [r(S)(), r(I)],
@@ -247,17 +251,17 @@ const Ke = /* @__PURE__ */ G({
247
251
  columns: r(V),
248
252
  "data-source": l.value,
249
253
  "search-form": !1,
250
- onUpdate: L
251
- }), X({
254
+ onUpdate: P
255
+ }), Z({
252
256
  _: 2
253
- }, [Y(x, (a, i) => ({
257
+ }, [ee(x, (a, i) => ({
254
258
  name: i,
255
- fn: C((p) => [Z(e.$slots, i, ee(oe(p || {})))])
259
+ fn: C((p) => [oe(e.$slots, i, te(ae(p || {})))])
256
260
  }))]), 1040, ["class", "columns", "data-source"])]),
257
261
  _: 3
258
262
  }, 16, ["label"])], 64));
259
263
  }
260
264
  });
261
265
  export {
262
- Ke as default
266
+ ke as default
263
267
  };
@@ -1,18 +1,18 @@
1
- import { defineComponent as M, useSlots as $, ref as h, watch as q, unref as l, createBlock as J, openBlock as Q, withCtx as m, createVNode as b, 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 v, omit as ne } from "lodash-unified";
1
+ import { defineComponent as q, useSlots as J, ref as h, watch as Q, unref as l, createBlock as X, openBlock as Y, withCtx as m, createVNode as b, mergeProps as Z, createSlots as ee, renderList as oe, renderSlot as ae, normalizeProps as te, guardReactiveProps as ne } from "vue";
2
+ import { isEqual as le, isArray as v, omit as re } from "lodash-unified";
3
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 le } from "../hooks/use-editable-api.mjs";
7
- import { useGetEditableColumns as re } from "../hooks/use-editable-columns.mjs";
6
+ import { useEditableApi as se } from "../hooks/use-editable-api.mjs";
7
+ import { useGetEditableColumns as ie } from "../hooks/use-editable-columns.mjs";
8
8
  import "../index.vue2.mjs";
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({
9
+ import de from "../style/editable.mjs";
10
+ import { arrayToObject as f, getRowKey as ue } from "./utils.mjs";
11
+ import { useNamespace as pe } from "../../config-provider/hooks/use-namespace.mjs";
12
+ import { useControllableValue as me } from "../../hooks/useControllableValue.mjs";
13
+ import { useGlobalConfig as ce } from "../../config-provider/hooks/use-global-config.mjs";
14
+ import fe from "../index.vue.mjs";
15
+ const Ke = /* @__PURE__ */ q({
16
16
  name: "EditableGrid",
17
17
  __name: "index",
18
18
  props: {
@@ -146,30 +146,32 @@ const Fe = /* @__PURE__ */ M({
146
146
  expose: x,
147
147
  emit: B
148
148
  }) {
149
- const S = $(), a = C, {
149
+ const S = J(), a = C, {
150
150
  b: T
151
- } = de("editable-aggrid"), F = se("editable-aggrid"), _ = B, i = h(), {
151
+ } = pe("editable-aggrid"), F = de("editable-aggrid"), _ = B, i = h(), {
152
152
  value: s,
153
153
  updateValue: y
154
- } = ue(a, _), r = h(), E = c.useWatch(a.name, r);
155
- q(s, (e) => {
154
+ } = me(a, _), r = h(), K = c.useWatch(a.name, r);
155
+ Q(s, (e) => {
156
156
  const o = f(e, a.rowKey);
157
- te(o, l(E)) || r.value?.setFieldValue(a.name, o);
157
+ le(o, l(K)) || r.value?.setFieldValue(a.name, o);
158
158
  }, {
159
159
  deep: !0
160
160
  });
161
- const K = pe("valueTypeMap"), k = re(a, K), {
161
+ const E = ce("valueTypeMap"), k = ie(a, E), {
162
162
  add: A,
163
- addMultiple: N,
164
- remove: j,
165
- removeByKey: I,
166
- getRowData: V,
167
- getRowsData: D,
168
- setRowData: z,
169
- clear: H,
163
+ addMultiple: D,
164
+ remove: N,
165
+ removeByKey: j,
166
+ getRowData: I,
167
+ getRowsData: V,
168
+ getRowDataByKey: z,
169
+ setRowData: H,
170
+ setRowDataByKey: O,
171
+ clear: U,
170
172
  refreshRowIds: d
171
- } = le(a, r, s, y);
172
- function O() {
173
+ } = se(a, r, s, y);
174
+ function L() {
173
175
  const e = i.value?._internalGridApi;
174
176
  if (!d.value?.length || !e)
175
177
  return;
@@ -179,7 +181,7 @@ const Fe = /* @__PURE__ */ M({
179
181
  force: !0
180
182
  }), d.value = [];
181
183
  }
182
- function U() {
184
+ function P() {
183
185
  r.value?.resetFields();
184
186
  }
185
187
  function w(e) {
@@ -187,21 +189,21 @@ const Fe = /* @__PURE__ */ M({
187
189
  }
188
190
  function g(e) {
189
191
  try {
190
- const o = Object.keys(e), t = s.value.map((n) => ie(n, void 0, a.rowKey));
192
+ const o = Object.keys(e), t = s.value.map((n) => ue(n, void 0, a.rowKey));
191
193
  return o.sort((n, u) => t.findIndex((p) => String(p) === n) - t.findIndex((p) => String(p) === u)), o.map((n) => e[n]);
192
194
  } catch {
193
195
  return e;
194
196
  }
195
197
  }
196
- async function L(e, o) {
198
+ async function G(e, o) {
197
199
  const n = (await r.value?.validateFields(w(e), o))?.[a.name];
198
200
  return g(n);
199
201
  }
200
- async function P(e, o) {
202
+ async function W(e, o) {
201
203
  const n = (await r.value?.validateFieldsReturnTransformed(w(e), o))?.[a.name];
202
204
  return g(n);
203
205
  }
204
- function G(e) {
206
+ function M(e) {
205
207
  y(e);
206
208
  const o = f(e, a.rowKey);
207
209
  r.value?.setFieldValue(a.name, o);
@@ -210,27 +212,29 @@ const Fe = /* @__PURE__ */ M({
210
212
  const t = e === "end" ? s.value.length - 1 : e;
211
213
  i.value?.scrollToRow(t, o);
212
214
  }
213
- function W(e, o) {
215
+ function $(e, o) {
214
216
  i.value?.scrollToColumn(e, o);
215
217
  }
216
218
  return x({
217
- resetFields: U,
218
- validateFields: L,
219
- validateFieldsReturnTransformed: P,
219
+ resetFields: P,
220
+ validateFields: G,
221
+ validateFieldsReturnTransformed: W,
220
222
  add: A,
221
- addMultiple: N,
222
- remove: j,
223
- removeByKey: I,
224
- getRowData: V,
225
- getRowsData: D,
226
- setRowData: z,
227
- clear: H,
228
- setTableData: G,
223
+ addMultiple: D,
224
+ remove: N,
225
+ removeByKey: j,
226
+ getRowData: I,
227
+ getRowsData: V,
228
+ setRowData: H,
229
+ clear: U,
230
+ setTableData: M,
229
231
  scrollTo: R,
230
232
  scrollToRow: R,
231
- scrollToColumn: W,
232
- table: i
233
- }), (e, o) => (Q(), J(l(c), {
233
+ scrollToColumn: $,
234
+ table: i,
235
+ getRowDataByKey: z,
236
+ setRowDataByKey: O
237
+ }), (e, o) => (Y(), X(l(c), {
234
238
  ref_key: "formRef",
235
239
  ref: r,
236
240
  "initial-values": {
@@ -244,7 +248,7 @@ const Fe = /* @__PURE__ */ M({
244
248
  name: e.name,
245
249
  "no-style": ""
246
250
  }, {
247
- default: m(() => [b(me, X(l(ne)(a, ["name", "value", "onUpdate:value", "maxLength", "onChange", "defaultValue"]), {
251
+ default: m(() => [b(fe, Z(l(re)(a, ["name", "value", "onUpdate:value", "maxLength", "onChange", "defaultValue"]), {
248
252
  ref_key: "tableRef",
249
253
  ref: i,
250
254
  class: [l(T)(), l(F)],
@@ -252,12 +256,12 @@ const Fe = /* @__PURE__ */ M({
252
256
  columns: l(k),
253
257
  "data-source": l(s),
254
258
  "search-form": !1,
255
- onUpdate: O
256
- }), Y({
259
+ onUpdate: L
260
+ }), ee({
257
261
  _: 2
258
- }, [Z(S, (t, n) => ({
262
+ }, [oe(S, (t, n) => ({
259
263
  name: n,
260
- fn: m((u) => [ee(e.$slots, n, oe(ae(u || {})))])
264
+ fn: m((u) => [ae(e.$slots, n, te(ne(u || {})))])
261
265
  }))]), 1040, ["class", "columns", "data-source"])]),
262
266
  _: 3
263
267
  }, 8, ["name"])]),
@@ -266,5 +270,5 @@ const Fe = /* @__PURE__ */ M({
266
270
  }
267
271
  });
268
272
  export {
269
- Fe as default
273
+ Ke as default
270
274
  };
@@ -95,6 +95,15 @@ export type EditableAgGridExpose<RecordType = any, ModelType = RecordType[]> = O
95
95
  remove: (data: RecordType | RecordType[]) => void;
96
96
  validateFieldsReturnTransformed: EditableTableExpose<ModelType, RecordType>['validateFields'];
97
97
  table: AgGridExpose;
98
+ getRowDataByKey: (key: string | number) => RecordType | undefined;
99
+ /**
100
+ * 设置表格行数据(通过行key)
101
+ * @param key
102
+ * @param data
103
+ * @param merge 是否进行数据的浅层合并(默认为true)
104
+ * @returns
105
+ */
106
+ setRowDataByKey: (key: any, data: Partial<RecordType>, merge?: boolean) => void;
98
107
  };
99
108
  export type EditableAgGridFormItemExpose<RecordType = any, ModelType = RecordType[]> = Omit<EditableAgGridExpose<RecordType, ModelType>, 'resetFields' | 'validateFields' | 'validateFieldsReturnTransformed'> & {
100
109
  /**
@@ -9,6 +9,7 @@ export declare const useEditableApi: <RecordType>(props: EditableAgGridProps<Rec
9
9
  removeByKey: (key: Key | Key[]) => void;
10
10
  getRowData: (index: number) => RecordType;
11
11
  getRowsData: () => RecordType[];
12
+ setRowDataByKey: (key: any, payload: any, merge?: boolean) => void;
12
13
  setRowData: (index: string | number, payload: any, merge?: boolean) => void;
13
14
  clear: () => void;
14
15
  refreshRowIds: ShallowRef<string[], string[]>;