@aplus-frontend/ui 7.20.1 → 7.20.3

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 (33) hide show
  1. package/es/src/ag-grid/editable/form-item.vue.mjs +72 -70
  2. package/es/src/ag-grid/editable/index.vue.mjs +59 -57
  3. package/es/src/ag-grid/editable/interface.d.ts +7 -0
  4. package/es/src/ag-grid/hooks/use-columns.mjs +18 -18
  5. package/es/src/ag-grid/hooks/use-editable-api.d.ts +1 -0
  6. package/es/src/ag-grid/hooks/use-editable-api.mjs +107 -88
  7. package/es/src/ag-grid/hooks/use-editable-form-item-api.d.ts +1 -0
  8. package/es/src/ag-grid/hooks/use-editable-form-item-api.mjs +105 -86
  9. package/es/src/ag-grid/index.vue.mjs +169 -166
  10. package/es/src/ap-action/item-popconfirm/index.vue.mjs +14 -14
  11. package/es/src/ap-field/select/index.vue.mjs +125 -122
  12. package/es/src/ap-list/hooks/use-offline-list.mjs +31 -18
  13. package/es/src/check-card/index.vue.d.ts +0 -1
  14. package/es/src/check-card/index.vue2.mjs +3 -5
  15. package/es/src/version.d.ts +1 -1
  16. package/es/src/version.mjs +1 -1
  17. package/lib/src/ag-grid/editable/form-item.vue.js +1 -1
  18. package/lib/src/ag-grid/editable/index.vue.js +1 -1
  19. package/lib/src/ag-grid/editable/interface.d.ts +7 -0
  20. package/lib/src/ag-grid/hooks/use-columns.js +1 -1
  21. package/lib/src/ag-grid/hooks/use-editable-api.d.ts +1 -0
  22. package/lib/src/ag-grid/hooks/use-editable-api.js +1 -1
  23. package/lib/src/ag-grid/hooks/use-editable-form-item-api.d.ts +1 -0
  24. package/lib/src/ag-grid/hooks/use-editable-form-item-api.js +1 -1
  25. package/lib/src/ag-grid/index.vue.js +1 -1
  26. package/lib/src/ap-action/item-popconfirm/index.vue.js +1 -1
  27. package/lib/src/ap-field/select/index.vue.js +1 -1
  28. package/lib/src/ap-list/hooks/use-offline-list.js +1 -1
  29. package/lib/src/check-card/index.vue.d.ts +0 -1
  30. package/lib/src/check-card/index.vue2.js +1 -1
  31. package/lib/src/version.d.ts +1 -1
  32. package/lib/src/version.js +1 -1
  33. package/package.json +1 -1
@@ -1,9 +1,9 @@
1
- import { defineComponent as f, useSlots as m, createBlock as d, openBlock as u, unref as r, mergeProps as P, withCtx as t, createVNode as _, normalizeProps as i, guardReactiveProps as p, createSlots as y, renderList as B, renderSlot as C } from "vue";
2
- import { Popconfirm as x } from "@aplus-frontend/antdv";
3
- import { omit as A } from "lodash-unified";
1
+ import { defineComponent as m, useSlots as d, createBlock as u, openBlock as P, unref as n, mergeProps as _, withCtx as t, createVNode as y, normalizeProps as i, guardReactiveProps as p, createSlots as C, renderList as B, renderSlot as x } from "vue";
2
+ import { Popconfirm as A } from "@aplus-frontend/antdv";
3
+ import { omit as a } from "lodash-unified";
4
4
  import "../item/index.vue.mjs";
5
5
  import b from "../item/index.vue2.mjs";
6
- const I = /* @__PURE__ */ f({
6
+ const I = /* @__PURE__ */ m({
7
7
  name: "ApActionItemPopconfirm",
8
8
  __name: "index",
9
9
  props: {
@@ -19,22 +19,22 @@ const I = /* @__PURE__ */ f({
19
19
  tooltip: {},
20
20
  popconfirmProps: { default: () => ({}) }
21
21
  },
22
- setup(a) {
23
- const s = m(), o = a;
24
- async function l(e) {
22
+ setup(s) {
23
+ const l = d(), o = s;
24
+ async function c(e) {
25
25
  o.popconfirmProps.onConfirm?.(e), await o.onAction?.(e);
26
26
  }
27
- return (e, g) => (u(), d(r(x), P(o.popconfirmProps, {
27
+ return (e, g) => (P(), u(n(A), _(n(a)(o.popconfirmProps, ["onConfirm"]), {
28
28
  disabled: !o.popconfirmProps,
29
29
  "overlay-style": { zIndex: 1060 },
30
- onConfirm: l
30
+ onConfirm: c
31
31
  }), {
32
32
  default: t(() => [
33
- _(b, i(p(r(A)(o, ["popconfirmProps", "onAction"]))), y({ _: 2 }, [
34
- B(s, (h, n) => ({
35
- name: n,
36
- fn: t((c) => [
37
- C(e.$slots, n, i(p(c || {})))
33
+ y(b, i(p(n(a)(o, ["popconfirmProps", "onAction"]))), C({ _: 2 }, [
34
+ B(l, (h, r) => ({
35
+ name: r,
36
+ fn: t((f) => [
37
+ x(e.$slots, r, i(p(f || {})))
38
38
  ])
39
39
  }))
40
40
  ]), 1040)
@@ -1,20 +1,20 @@
1
- import { defineComponent as Oe, useSlots as Se, ref as N, shallowRef as Fe, computed as s, onMounted as Ve, watch as ke, unref as o, createVNode as v, createElementBlock as T, createBlock as O, openBlock as y, toDisplayString as A, mergeProps as xe, h as Be, createSlots as Ne, withCtx as g, createElementVNode as I, normalizeClass as b, createCommentVNode as R, resolveDynamicComponent as z, withModifiers as Ae, renderList as Ie, renderSlot as _e, normalizeProps as De, guardReactiveProps as Me } from "vue";
2
- import { Select as Le, Flex as E, Checkbox as U, Spin as Pe } from "@aplus-frontend/antdv";
3
- import { debounce as qe, isFunction as K, isNil as $, isArray as j, omit as H, isNumber as Te } from "lodash-unified";
1
+ import { defineComponent as Se, useSlots as xe, ref as N, shallowRef as Ve, computed as s, onMounted as ke, watch as Be, unref as l, createVNode as v, createElementBlock as T, createBlock as F, openBlock as y, toDisplayString as I, mergeProps as Ne, h as Ie, createSlots as Ae, withCtx as g, createElementVNode as A, normalizeClass as C, createCommentVNode as R, resolveDynamicComponent as z, withModifiers as _e, renderList as De, renderSlot as Me, normalizeProps as Le, guardReactiveProps as Pe } from "vue";
2
+ import { Form as qe, Select as Te, Flex as E, Checkbox as U, Spin as Re } from "@aplus-frontend/antdv";
3
+ import { debounce as ze, isFunction as j, isNil as K, isArray as $, omit as H, isNumber as Ee } from "lodash-unified";
4
4
  import "../../config-provider/index.mjs";
5
5
  import "../../utils/index.mjs";
6
- import { useDevWarning as Re } from "../../utils/warning.mjs";
6
+ import { useDevWarning as Ue } from "../../utils/warning.mjs";
7
7
  import "../../hooks/index.mjs";
8
- import { useDefaultPlaceholder as ze } from "../hooks/use-default-placeholder.mjs";
9
- import Ee from "../style/index.mjs";
10
- import { useSelectOptions as Ue } from "./use-select-options.mjs";
8
+ import { useDefaultPlaceholder as je } from "../hooks/use-default-placeholder.mjs";
9
+ import Ke from "../style/index.mjs";
10
+ import { useSelectOptions as $e } from "./use-select-options.mjs";
11
11
  import { isDef as _ } from "../../utils/is.mjs";
12
12
  import { useNamespace as W } from "../../config-provider/hooks/use-namespace.mjs";
13
- import { useLocale as Ke } from "../../config-provider/hooks/use-locale.mjs";
14
- import { useControllableValue as $e } from "../../hooks/useControllableValue.mjs";
15
- const je = {
13
+ import { useLocale as He } from "../../config-provider/hooks/use-locale.mjs";
14
+ import { useControllableValue as We } from "../../hooks/useControllableValue.mjs";
15
+ const Ge = {
16
16
  key: 0
17
- }, He = ["onClick"], st = /* @__PURE__ */ Oe({
17
+ }, Je = ["onClick"], ct = /* @__PURE__ */ Se({
18
18
  name: "ApFieldSelect",
19
19
  __name: "index",
20
20
  props: {
@@ -186,232 +186,235 @@ const je = {
186
186
  emit: Q
187
187
  }) {
188
188
  let i = 0;
189
- const S = Se(), t = G, {
189
+ const O = xe(), t = G, {
190
190
  deprecated: X
191
- } = Re("ApFieldSelect");
191
+ } = Ue("ApFieldSelect");
192
192
  X(!_(t.refetchOnFocus), "refetchOnFocus", "fetchOnFocus");
193
193
  const {
194
- b: F
194
+ b: S
195
195
  } = W("field-select"), {
196
196
  b: f
197
- } = W("field-select-popup-option"), Y = Ee("field"), D = N(!1), M = N(!1), {
197
+ } = W("field-select-popup-option"), Y = Ke("field"), Z = qe.useInjectFormItemContext(), D = N(!1), M = N(!1), {
198
198
  t: L
199
- } = Ke(), Z = qe((e) => {
200
- if (!K(t.request))
199
+ } = He(), ee = ze((e) => {
200
+ if (!j(t.request))
201
201
  return;
202
202
  i += 1;
203
203
  const n = i;
204
- w([]), r.value = !0, t.request(e).then((l) => {
205
- i === n && (w(l), r.value = !1);
204
+ w([]), r.value = !0, t.request(e).then((o) => {
205
+ i === n && (w(o), r.value = !1);
206
206
  });
207
- }, t.searchDelay), ee = (e, n) => {
208
- const l = t.fieldNames?.label || "label";
209
- return typeof n?.[l] == "string" && n[l].toLowerCase().indexOf(e.toLowerCase()) > -1;
207
+ }, t.searchDelay), te = (e, n) => {
208
+ const o = t.fieldNames?.label || "label";
209
+ return typeof n?.[o] == "string" && n[o].toLowerCase().indexOf(e.toLowerCase()) > -1;
210
210
  }, {
211
211
  options: c,
212
212
  updateOptions: w
213
- } = Ue(t), V = Fe(), r = N(t?.loading || !1), te = Q, ne = s(() => t.fetchOnFocus ?? t.refetchOnFocus), le = s(() => {
213
+ } = $e(t), x = Ve(), r = N(t?.loading || !1), ne = Q, oe = s(() => t.fetchOnFocus ?? t.refetchOnFocus), le = s(() => {
214
214
  if (t.multiple)
215
215
  return t.tokenSeparators ? "tags" : "multiple";
216
216
  });
217
217
  async function d(e = !0) {
218
- if (!K(t.request))
218
+ if (!j(t.request))
219
219
  return;
220
220
  r.value = !0, i += 1;
221
221
  const n = i;
222
222
  try {
223
223
  e && w([]);
224
- const l = await t.request(void 0, t.params);
224
+ const o = await t.request(void 0, t.params);
225
225
  if (n !== i)
226
226
  return;
227
- w(l);
227
+ w(o);
228
228
  } finally {
229
229
  r.value = !1;
230
230
  }
231
231
  }
232
- function oe(e) {
233
- !D.value && i === 0 && t.lazy === "first-focus" ? d() : ne.value && !r.value && d(!0), t.onFocus?.(e), D.value = !0;
234
- }
235
232
  function ae(e) {
233
+ !D.value && i === 0 && t.lazy === "first-focus" ? d() : oe.value && !r.value && d(!0), t.onFocus?.(e), D.value = !0;
234
+ }
235
+ function ue(e) {
236
236
  if (!e) {
237
237
  t.onDropdownVisibleChange?.(e);
238
238
  return;
239
239
  }
240
240
  !M.value && i === 0 && t.lazy === "first-open" ? d() : t.fetchOnOpen && !r.value && d(!0), t.onDropdownVisibleChange?.(e), M.value = !0;
241
241
  }
242
- Ve(() => {
242
+ function V(e) {
243
+ se(e), Z?.onFieldChange();
244
+ }
245
+ ke(() => {
243
246
  if (!t.lazy) {
244
247
  d();
245
248
  return;
246
249
  }
247
- }), ke(() => t.params, () => {
250
+ }), Be(() => t.params, () => {
248
251
  d();
249
252
  }, {
250
253
  deep: !0
251
254
  });
252
255
  const {
253
256
  value: p,
254
- updateValue: k
255
- } = $e(t, te), ue = ze("Select", t), se = s(() => {
256
- const e = o(p);
257
- if ($(e))
257
+ updateValue: se
258
+ } = We(t, ne), re = je("Select", t), ie = s(() => {
259
+ const e = l(p);
260
+ if (K(e))
258
261
  return t.emptyText;
259
- const n = t.fieldNames?.label || "label", l = t.fieldNames?.value || "value";
260
- return j(e) ? e.map((a) => o(c).find((h) => h[l] === a)?.[n]).filter(Boolean).join("、") || t.emptyText : o(c).find((a) => a[l] === e)?.[n] || t.emptyText;
261
- }), re = s(() => {
262
+ const n = t.fieldNames?.label || "label", o = t.fieldNames?.value || "value";
263
+ return $(e) ? e.map((a) => l(c).find((h) => h[o] === a)?.[n]).filter(Boolean).join("、") || t.emptyText : l(c).find((a) => a[o] === e)?.[n] || t.emptyText;
264
+ }), ce = s(() => {
262
265
  const e = !!t?.showSearch, n = t.searchMode;
263
- let l = {};
264
- return e && (l = n === "request" ? {
266
+ let o = {};
267
+ return e && (o = n === "request" ? {
265
268
  defaultActiveFirstOption: !1,
266
- onSearch: Z,
269
+ onSearch: ee,
267
270
  notFoundContent: r.value ? void 0 : null,
268
271
  filterOption: !1,
269
272
  suffixIcon: null
270
273
  } : {
271
- filterOption: $(t?.filterOption) ? ee : t?.filterOption
274
+ filterOption: K(t?.filterOption) ? te : t?.filterOption
272
275
  }), {
273
276
  ...H(t, ["mode", "value", "onUpdate:value", "onSearch", "request", "searchMode", "onFocus", "onBeforeSelect", "onDropdownVisibleChange"]),
274
- placeholder: o(ue),
275
- ...l
277
+ placeholder: l(re),
278
+ ...o
276
279
  };
277
- }), ie = s(() => c.value.map((e) => e[t.fieldNames?.value || "value"])), x = s(() => c.value.filter((e) => !e.disabled).map((e) => e[t.fieldNames?.value || "value"])), P = s(() => !t.multiple || _(t.maxCount) ? !1 : Te(t.addAll) ? ie.value.length >= t.addAll : !!t.addAll), ce = s(() => t.multiple && t.allowOnlySelect && (!_(t.maxCount) || t.maxCount >= 1));
278
- function de() {
279
- V.value?.focus();
280
+ }), de = s(() => c.value.map((e) => e[t.fieldNames?.value || "value"])), k = s(() => c.value.filter((e) => !e.disabled).map((e) => e[t.fieldNames?.value || "value"])), P = s(() => !t.multiple || _(t.maxCount) ? !1 : Ee(t.addAll) ? de.value.length >= t.addAll : !!t.addAll), fe = s(() => t.multiple && t.allowOnlySelect && (!_(t.maxCount) || t.maxCount >= 1));
281
+ function pe() {
282
+ x.value?.focus();
280
283
  }
281
- function fe() {
282
- V.value?.blur();
284
+ function me() {
285
+ x.value?.blur();
283
286
  }
284
287
  function m(e, n) {
285
- const l = t.fieldNames?.[n] ?? n;
286
- return l === "groupLabel" ? e[l] ?? e.label : e[l];
288
+ const o = t.fieldNames?.[n] ?? n;
289
+ return o === "groupLabel" ? e[o] ?? e.label : e[o];
287
290
  }
288
- function pe(e) {
291
+ function he(e) {
289
292
  const n = q(e);
290
- k(t.multiple ? [n] : n), t.onChange?.([n], [e]);
293
+ V(t.multiple ? [n] : n), t.onChange?.([n], [e]);
291
294
  }
292
- function me(e) {
293
- return S.option ? v("div", {
295
+ function ve(e) {
296
+ return O.option ? v("div", {
294
297
  class: f("custom")
295
- }, [S.option(e)]) : v("span", {
298
+ }, [O.option(e)]) : v("span", {
296
299
  class: f("label")
297
300
  }, [m(e, e.options?.length ? "groupLabel" : "label")]);
298
301
  }
299
- const he = s(() => {
300
- const e = o(p) || [], n = x.value;
301
- return n.length > 0 && n.every((l) => C(e, l));
302
- }), ve = s(() => {
303
- const e = o(p) || [], n = x.value, l = n.filter((u) => C(e, u)).length;
304
- return l > 0 && l < n.length;
302
+ const ye = s(() => {
303
+ const e = l(p) || [], n = k.value;
304
+ return n.length > 0 && n.every((o) => b(e, o));
305
+ }), ge = s(() => {
306
+ const e = l(p) || [], n = k.value, o = n.filter((u) => b(e, u)).length;
307
+ return o > 0 && o < n.length;
305
308
  });
306
309
  function B(e, n) {
307
310
  return (e.value ?? e) === n;
308
311
  }
309
- const ye = (e) => {
310
- const n = o(p), l = m(e, "value");
311
- return j(n) ? !!n.find((u) => B(u, l)) : !1;
312
+ const Ce = (e) => {
313
+ const n = l(p), o = m(e, "value");
314
+ return $(n) ? !!n.find((u) => B(u, o)) : !1;
312
315
  };
313
- function C(e, n) {
314
- return e.find((l) => B(l, n)) != null;
316
+ function b(e, n) {
317
+ return e.find((o) => B(o, n)) != null;
315
318
  }
316
- function ge(e, n) {
317
- return e.findIndex((l) => B(l, n));
319
+ function be(e, n) {
320
+ return e.findIndex((o) => B(o, n));
318
321
  }
319
322
  function q(e, n) {
320
- const l = m(e, "label"), u = n ?? m(e, "value");
323
+ const o = m(e, "label"), u = n ?? m(e, "value");
321
324
  return t.labelInValue ? {
322
- label: typeof l == "function" ? l() : l,
323
- originLabel: l,
325
+ label: typeof o == "function" ? o() : o,
326
+ originLabel: o,
324
327
  value: u,
325
328
  key: e?.key ?? u
326
329
  } : u;
327
330
  }
328
- function be() {
329
- const e = [...o(p) || []], n = x.value;
330
- n.length > 0 && n.every((a) => C(e, a)) ? n.forEach((a) => {
331
- const h = ge(e, a);
331
+ function we() {
332
+ const e = [...l(p) || []], n = k.value;
333
+ n.length > 0 && n.every((a) => b(e, a)) ? n.forEach((a) => {
334
+ const h = be(e, a);
332
335
  ~h && e.splice(h, 1);
333
336
  }) : n.forEach((a) => {
334
- if (C(e, a))
337
+ if (b(e, a))
335
338
  return;
336
- const h = c.value.find((we) => m(we, "value") === a), Ce = q(h, a);
337
- e.push(Ce);
339
+ const h = c.value.find((Oe) => m(Oe, "value") === a), Fe = q(h, a);
340
+ e.push(Fe);
338
341
  });
339
- const u = c.value.filter((a) => C(e, m(a, "value")));
340
- k([...e]), t.onChange?.([...e], u);
342
+ const u = c.value.filter((a) => b(e, m(a, "value")));
343
+ V([...e]), t.onChange?.([...e], u);
341
344
  }
342
345
  return J({
343
- focus: de,
344
- blur: fe,
346
+ focus: pe,
347
+ blur: me,
345
348
  request: d
346
- }), (e, n) => e.mode === "read" ? (y(), T("span", je, A(se.value), 1)) : (y(), O(o(Le), xe({
349
+ }), (e, n) => e.mode === "read" ? (y(), T("span", Ge, I(ie.value), 1)) : (y(), F(l(Te), Ne({
347
350
  key: 1,
348
351
  ref_key: "selectRef",
349
- ref: V,
352
+ ref: x,
350
353
  "allow-clear": ""
351
- }, re.value, {
354
+ }, ce.value, {
352
355
  mode: le.value,
353
- value: o(p),
354
- options: o(c),
356
+ value: l(p),
357
+ options: l(c),
355
358
  loading: r.value,
356
- "menu-item-selected-icon": Be("span"),
357
- "popup-class-name": `${o(F)("popup")} ${o(Y)}`,
358
- "onUpdate:value": o(k),
359
- onFocus: oe,
360
- onDropdownVisibleChange: ae
361
- }), Ne({
362
- option: g((l) => [I("div", {
363
- class: b(o(f)("outter"))
364
- }, [v(o(E), {
359
+ "menu-item-selected-icon": Ie("span"),
360
+ "popup-class-name": `${l(S)("popup")} ${l(Y)}`,
361
+ "onUpdate:value": V,
362
+ onFocus: ae,
363
+ onDropdownVisibleChange: ue
364
+ }), Ae({
365
+ option: g((o) => [A("div", {
366
+ class: C(l(f)("outter"))
367
+ }, [v(l(E), {
365
368
  justify: "space-between",
366
369
  align: "center",
367
- class: b(o(f)("wrapper")),
370
+ class: C(l(f)("wrapper")),
368
371
  gap: 8
369
372
  }, {
370
- default: g(() => [v(o(E), {
373
+ default: g(() => [v(l(E), {
371
374
  gap: 8,
372
375
  align: "center",
373
- class: b(o(f)("content-wrapper"))
376
+ class: C(l(f)("content-wrapper"))
374
377
  }, {
375
- default: g(() => [P.value ? (y(), O(o(U), {
378
+ default: g(() => [P.value ? (y(), F(l(U), {
376
379
  key: 0,
377
- checked: ye(l)
378
- }, null, 8, ["checked"])) : R("", !0), (y(), O(z(me(l))))]),
380
+ checked: Ce(o)
381
+ }, null, 8, ["checked"])) : R("", !0), (y(), F(z(ve(o))))]),
379
382
  _: 2
380
- }, 1032, ["class"]), ce.value && !l?.disabled ? (y(), T("span", {
383
+ }, 1032, ["class"]), fe.value && !o?.disabled ? (y(), T("span", {
381
384
  key: 0,
382
- class: b(o(f)("action")),
383
- onClick: Ae(() => pe(l), ["stop"])
384
- }, A(o(L)("ap.field.chooseOnly")), 11, He)) : R("", !0)]),
385
+ class: C(l(f)("action")),
386
+ onClick: _e(() => he(o), ["stop"])
387
+ }, I(l(L)("ap.field.chooseOnly")), 11, Je)) : R("", !0)]),
385
388
  _: 2
386
389
  }, 1032, ["class"])], 2)]),
387
390
  _: 2
388
- }, [Ie(o(H)(S, ["option"]), (l, u) => ({
391
+ }, [De(l(H)(O, ["option"]), (o, u) => ({
389
392
  name: u,
390
- fn: g((a) => [_e(e.$slots, u, De(Me(a || {})))])
393
+ fn: g((a) => [Me(e.$slots, u, Le(Pe(a || {})))])
391
394
  })), r.value ? {
392
395
  name: "notFoundContent",
393
- fn: g(() => [v(o(Pe), {
396
+ fn: g(() => [v(l(Re), {
394
397
  size: "small"
395
398
  })]),
396
399
  key: "0"
397
400
  } : void 0, P.value ? {
398
401
  name: "dropdownRender",
399
402
  fn: g(({
400
- menuNode: l
401
- }) => [I("div", {
403
+ menuNode: o
404
+ }) => [A("div", {
402
405
  tabindex: -1,
403
- class: b(o(F)("popup-all-option")),
404
- onClick: be
405
- }, [v(o(U), {
406
- checked: he.value,
407
- indeterminate: ve.value
408
- }, null, 8, ["checked", "indeterminate"]), I("span", {
409
- class: b(o(F)("popup-all-option-label"))
410
- }, A(o(L)("ap.field.selectAll")), 3)], 2), (y(), O(z(l)))]),
406
+ class: C(l(S)("popup-all-option")),
407
+ onClick: we
408
+ }, [v(l(U), {
409
+ checked: ye.value,
410
+ indeterminate: ge.value
411
+ }, null, 8, ["checked", "indeterminate"]), A("span", {
412
+ class: C(l(S)("popup-all-option-label"))
413
+ }, I(l(L)("ap.field.selectAll")), 3)], 2), (y(), F(z(o)))]),
411
414
  key: "1"
412
- } : void 0]), 1040, ["mode", "value", "options", "loading", "menu-item-selected-icon", "popup-class-name", "onUpdate:value"]));
415
+ } : void 0]), 1040, ["mode", "value", "options", "loading", "menu-item-selected-icon", "popup-class-name"]));
413
416
  }
414
417
  });
415
418
  export {
416
- st as default
419
+ ct as default
417
420
  };
@@ -1,36 +1,49 @@
1
- import { isUndefined as d } from "lodash-unified";
2
- import { ref as c, computed as g, unref as n } from "vue";
1
+ import { isUndefined as s } from "lodash-unified";
2
+ import { ref as g, watch as d, computed as l, unref as a } from "vue";
3
3
  import "../../utils/index.mjs";
4
4
  import { isDef as f } from "../../utils/is.mjs";
5
5
  const C = (e) => {
6
- const i = c(
6
+ const i = g(
7
7
  e.pagination && e.pagination.defaultCurrent || 1
8
- ), o = c(
8
+ ), o = g(
9
9
  e.pagination && e.pagination.defaultPageSize || 10
10
10
  );
11
- function s(t, r) {
12
- i.value = t, o.value = r;
11
+ function u(t, n) {
12
+ i.value = t, o.value = n;
13
13
  }
14
- const p = g(() => e.dataSource ? e.pagination === !1 ? [...e.dataSource] : e.dataSource.slice(
15
- (n(i) - 1) * n(o),
16
- n(i) * n(o)
14
+ d(
15
+ () => e.dataSource,
16
+ (t) => {
17
+ if (!t?.length)
18
+ return;
19
+ const n = Math.max(
20
+ Math.ceil(t.length / o.value),
21
+ 1
22
+ );
23
+ console.log(n, i.value), n < i.value && u(n, o.value);
24
+ },
25
+ { deep: 1 }
26
+ );
27
+ const h = l(() => e.dataSource ? e.pagination === !1 ? [...e.dataSource] : e.dataSource.slice(
28
+ (a(i) - 1) * a(o),
29
+ a(i) * a(o)
17
30
  ) : []);
18
31
  return {
19
- pagination: g(() => {
20
- const { showLessItems: t, showSizeChanger: r, showQuickJumper: a, pageSizeOptions: u } = e.pagination || {};
32
+ pagination: l(() => {
33
+ const { showLessItems: t, showSizeChanger: n, showQuickJumper: r, pageSizeOptions: c } = e.pagination || {};
21
34
  return {
22
- current: n(i),
23
- pageSize: n(o),
35
+ current: a(i),
36
+ pageSize: a(o),
24
37
  total: e.dataSource?.length || 0,
25
- showSizeChanger: f(r) ? r : !t,
26
- showQuickJumper: f(a) ? a : !t,
38
+ showSizeChanger: f(n) ? n : !t,
39
+ showQuickJumper: f(r) ? r : !t,
27
40
  showLessItems: t,
28
41
  size: "default",
29
- pageSizeOptions: d(u) ? ["10", "20", "50", "100"] : u
42
+ pageSizeOptions: s(c) ? ["10", "20", "50", "100"] : c
30
43
  };
31
44
  }),
32
- dataSource: p,
33
- onChange: s
45
+ dataSource: h,
46
+ onChange: u
34
47
  };
35
48
  };
36
49
  export {
@@ -17,7 +17,6 @@ declare const __VLS_component: DefineComponent<CheckCardProps, {}, {}, {}, {}, C
17
17
  }, string, PublicProps, Readonly<CheckCardProps> & Readonly<{
18
18
  "onUpdate:checked"?: ((...args: any[]) => any) | undefined;
19
19
  }>, {
20
- size: "middle" | "small";
21
20
  style: CSSProperties;
22
21
  bordered: boolean;
23
22
  checked: boolean;
@@ -24,9 +24,7 @@ const J = ["src"], ne = /* @__PURE__ */ T({
24
24
  loading: {
25
25
  type: Boolean
26
26
  },
27
- size: {
28
- default: "middle"
29
- },
27
+ size: {},
30
28
  stopPropagation: {
31
29
  type: [Boolean, Function],
32
30
  default: !1
@@ -69,8 +67,8 @@ const J = ["src"], ne = /* @__PURE__ */ T({
69
67
  }), a = i(() => {
70
68
  const e = {
71
69
  ...l
72
- }, o = t(n);
73
- return o && (e.disabled = e.disabled || o.disabled, e.bordered = e.bordered || o.bordered, e.loading = e.loading || o.loading, e.size = e.size || o.size, e.indicatorSize = e.indicatorSize || o.indicatorSize, e.stopPropagation = e.stopPropagation || o.stopPropagation, e.style = e.style ? e.style : o.style), e;
70
+ }, o = t(n) || {};
71
+ return o && (e.disabled = e.disabled ?? o.disabled, e.bordered = e.bordered ?? o.bordered, e.loading = e.loading ?? o.loading, e.size = e.size ?? o.size ?? "middle", e.indicatorSize = e.indicatorSize ?? o.indicatorSize, e.stopPropagation = e.stopPropagation ?? o.stopPropagation, e.style = e.style ? e.style : o.style), e;
74
72
  }), V = i(() => {
75
73
  const e = t(a);
76
74
  return [S(), c(e.size), t(r) ? c("checked") : null, e.bordered ? c("bordered") : null, e.disabled ? c("disabled") : null, B.value];
@@ -1,2 +1,2 @@
1
- declare const _default: "7.20.1";
1
+ declare const _default: "7.20.3";
2
2
  export default _default;
@@ -1,4 +1,4 @@
1
- const e = "7.20.1";
1
+ const e = "7.20.3";
2
2
  export {
3
3
  e as default
4
4
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),c=require("lodash-unified"),g=require("../../ap-form/index.js"),M=require("../../ap-form/context.js"),y=require("../../ap-form/hooks/use-watch.js"),W=require("../../ap-form/utils/get.js"),$=require("../../ap-form/utils/transform.js");require("../../config-provider/index.js");const J=require("../hooks/use-editable-columns.js"),Q=require("../hooks/use-editable-form-item-api.js");require("../index.vue2.js");const X=require("../style/editable.js"),Y=require("../utils.js"),f=require("./utils.js"),Z=require("../../config-provider/hooks/use-namespace.js"),ee=require("../../config-provider/hooks/use-global-config.js"),te=require("../index.vue.js"),oe=t.defineComponent({name:"EditableGrid",__name:"form-item",props:{dropdownPrefixCls:{},bordered:{type:Boolean},locale:{},onResizeColumn:{},getPopupContainer:{},scroll:{},sortDirections:{},showSorterTooltip:{type:[Boolean,Object]},prefixCls:{},rowKey:{type:[String,Function],default:"key"},tableLayout:{},title:{},id:{},showHeader:{type:Boolean},components:{},customHeaderRow:{},direction:{},expandFixed:{type:[String,Boolean]},expandColumnWidth:{},expandedRowKeys:{},defaultExpandedRowKeys:{},expandedRowRender:{},expandRowByClick:{type:Boolean},expandIcon:{},onExpand:{},onExpandedRowsChange:{},defaultExpandAllRows:{type:Boolean},indentSize:{},expandIconColumnIndex:{},showExpandColumn:{type:Boolean},expandedRowClassName:{},childrenColumnName:{},rowExpandable:{},transformCellText:{},rowHoverable:{type:Boolean},rowSelection:{type:[Boolean,Object]},onLoadingChange:{},onShownColumnsChange:{},pagination:{type:[Boolean,Object],default:!1},searchFormWrapperStyle:{},tableWrapperStyle:{},wrapperStyle:{},tableStyle:{},adaptive:{type:Boolean},columnResizable:{type:Boolean,default:!1},loading:{type:Boolean,default:void 0},summary:{},rowHeight:{default:66},getRowHeight:{},advanceRenderer:{type:Boolean},browserTooltips:{type:Boolean},virtual:{type:[Boolean,Object],default:void 0},onRowClicked:{},onScrollEnd:{},rowClassName:{},rowClassRules:{},autoHeight:{type:Boolean},onUpdate:{},onModelUpdated:{},customRow:{},theme:{},emptyComponent:{},emptyText:{},onColumnResized:{},animateRows:{type:Boolean},plugins:{},columns:{},defaultValue:{},onChange:{},maxLength:{},onFieldChange:{},supressForceRowUpdate:{type:Boolean,default:!1},label:{},name:{},formItem:{}},setup(h,{expose:b}){const C=t.useSlots(),n=h,{b:R}=Z.useNamespace("editable-aggrid"),v=X.default("editable-aggrid"),r=t.ref(),{internalInstance:s}=M.useInjectForm();function x(e){const o=f.getColumnTransformOptions(n.columns||[]);if(!Object.keys(o).length||!e?.length)return e;let a=[];for(const i of e)a.push($.transformValues(i,o));return a}const u=Y.getShadowName(n.name);function B(){return n.formItem?.initialValue??W.getModelValue(s?.getInitialValues()??{},n.name)??[]}let T=B();const l=t.ref([]),q=y.useWatch(n.name),S=y.useWatch(u);t.watch(()=>q.value,e=>{if(c.isEqual(e,l.value))return;const o=e??c.cloneDeep(T);l.value=[...o]},{deep:!0,flush:"post",immediate:!0});let d;t.watch(l,e=>{const o=f.arrayToObject(e,n.rowKey);c.isEqual(o,t.unref(S))||(d=()=>{s?.setFieldValue(n.name,[...e]),s?.setFieldValue(u,o)})},{deep:!0,immediate:!0});const F=ee.useGlobalConfig("valueTypeMap"),I=J.useGetEditableColumns(n,F,u),{add:E,addMultiple:V,remove:_,removeByKey:N,getRowData:A,getRowsData:D,getRowDataByKey:j,setRowData:K,setRowDataByKey:O,clear:P,refreshRowIds:m}=Q.useEditableFormItemApi(n,s,l,u);function U(){if(n.onUpdate?.(),d&&(d(),d=void 0),n.supressForceRowUpdate)return;const e=r.value?._internalGridApi;if(!m.value?.length||!e)return;const o=m.value.map(a=>e.getRowNode(a)).filter(a=>!!a);e.refreshCells({rowNodes:o,force:!0}),m.value=[]}function k(e){l.value=[...e]}function w(e,o){const a=e==="end"?l.value.length-1:e;r.value?.scrollToRow(a,o)}function z(e,o){r.value?.scrollToColumn(e,o)}function G(e,o){const a=[u,String(e),o].flat();return s?.validateFields([a])}function H(e){const a=t.unref(l).map((i,p)=>[u,String(f.getRowKey(i,p,n.rowKey)),e].flat());return s?.validateFields(a)}function L(e,o=!0){const a=Array.isArray(e)?e:[e];r.value?._internalGridApi?.refreshCells({columns:a,force:o})}return b({add:E,addMultiple:V,remove:_,removeByKey:N,getRowData:A,getRowsData:D,getRowDataByKey:j,setRowData:K,clear:P,setTableData:k,scrollTo:w,scrollToRow:w,scrollToColumn:z,validateCell:G,validateColumn:H,setRowDataByKey:O,table:r,refreshColumns:L}),(e,o)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(t.unref(g.ApForm).FormItem,{hidden:"",name:e.name,"initial-value":e.formItem?.initialValue,transform:x},null,8,["name","initial-value"]),t.createVNode(t.unref(g.ApForm).FormItem,t.mergeProps({label:e.label},e.formItem),{default:t.withCtx(()=>[t.createVNode(te.default,t.mergeProps(t.unref(c.omit)(n,["name","maxLength","onChange","defaultValue","formItem","onUpdate"]),{ref_key:"tableRef",ref:r,class:[t.unref(R)(),t.unref(v)],size:"mini",columns:t.unref(I),"data-source":l.value,"search-form":!1,onUpdate:U}),t.createSlots({_:2},[t.renderList(C,(a,i)=>({name:i,fn:t.withCtx(p=>[t.renderSlot(e.$slots,i,t.normalizeProps(t.guardReactiveProps(p||{})))])}))]),1040,["class","columns","data-source"])]),_:3},16,["label"])],64))}});exports.default=oe;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),c=require("lodash-unified"),y=require("../../ap-form/index.js"),W=require("../../ap-form/context.js"),g=require("../../ap-form/hooks/use-watch.js"),$=require("../../ap-form/utils/get.js"),J=require("../../ap-form/utils/transform.js");require("../../config-provider/index.js");const Q=require("../hooks/use-editable-columns.js"),X=require("../hooks/use-editable-form-item-api.js");require("../index.vue2.js");const Y=require("../style/editable.js"),Z=require("../utils.js"),f=require("./utils.js"),ee=require("../../config-provider/hooks/use-namespace.js"),te=require("../../config-provider/hooks/use-global-config.js"),oe=require("../index.vue.js"),ae=t.defineComponent({name:"EditableGrid",__name:"form-item",props:{dropdownPrefixCls:{},bordered:{type:Boolean},locale:{},onResizeColumn:{},getPopupContainer:{},scroll:{},sortDirections:{},showSorterTooltip:{type:[Boolean,Object]},prefixCls:{},rowKey:{type:[String,Function],default:"key"},tableLayout:{},title:{},id:{},showHeader:{type:Boolean},components:{},customHeaderRow:{},direction:{},expandFixed:{type:[String,Boolean]},expandColumnWidth:{},expandedRowKeys:{},defaultExpandedRowKeys:{},expandedRowRender:{},expandRowByClick:{type:Boolean},expandIcon:{},onExpand:{},onExpandedRowsChange:{},defaultExpandAllRows:{type:Boolean},indentSize:{},expandIconColumnIndex:{},showExpandColumn:{type:Boolean},expandedRowClassName:{},childrenColumnName:{},rowExpandable:{},transformCellText:{},rowHoverable:{type:Boolean},rowSelection:{type:[Boolean,Object]},onLoadingChange:{},onShownColumnsChange:{},pagination:{type:[Boolean,Object],default:!1},searchFormWrapperStyle:{},tableWrapperStyle:{},wrapperStyle:{},tableStyle:{},adaptive:{type:Boolean},columnResizable:{type:Boolean,default:!1},loading:{type:Boolean,default:void 0},summary:{},rowHeight:{default:66},getRowHeight:{},advanceRenderer:{type:Boolean},browserTooltips:{type:Boolean},virtual:{type:[Boolean,Object],default:void 0},onRowClicked:{},onScrollEnd:{},rowClassName:{},rowClassRules:{},autoHeight:{type:Boolean},onUpdate:{},onModelUpdated:{},customRow:{},theme:{},emptyComponent:{},emptyText:{},onColumnResized:{},animateRows:{type:Boolean},plugins:{},columns:{},defaultValue:{},onChange:{},maxLength:{},onFieldChange:{},supressForceRowUpdate:{type:Boolean,default:!1},label:{},name:{},formItem:{}},setup(h,{expose:b}){const C=t.useSlots(),n=h,{b:R}=ee.useNamespace("editable-aggrid"),v=Y.default("editable-aggrid"),r=t.ref(),{internalInstance:s}=W.useInjectForm();function B(e){const o=f.getColumnTransformOptions(n.columns||[]);if(!Object.keys(o).length||!e?.length)return e;let a=[];for(const i of e)a.push(J.transformValues(i,o));return a}const u=Z.getShadowName(n.name);function x(){return n.formItem?.initialValue??$.getModelValue(s?.getInitialValues()??{},n.name)??[]}let T=x();const l=t.ref([]),q=g.useWatch(n.name),S=g.useWatch(u);t.watch(()=>q.value,e=>{if(c.isEqual(e,l.value))return;const o=e??c.cloneDeep(T);l.value=[...o]},{deep:!0,flush:"post",immediate:!0});let d;t.watch(l,e=>{const o=f.arrayToObject(e,n.rowKey);c.isEqual(o,t.unref(S))||(d=()=>{s?.setFieldValue(n.name,[...e]),s?.setFieldValue(u,o)})},{deep:!0,immediate:!0});const F=te.useGlobalConfig("valueTypeMap"),I=Q.useGetEditableColumns(n,F,u),{add:E,addByKey:V,addMultiple:_,remove:N,removeByKey:A,getRowData:D,getRowsData:K,getRowDataByKey:j,setRowData:O,setRowDataByKey:P,clear:U,refreshRowIds:m}=X.useEditableFormItemApi(n,s,l,u);function k(){if(n.onUpdate?.(),d&&(d(),d=void 0),n.supressForceRowUpdate)return;const e=r.value?._internalGridApi;if(!m.value?.length||!e)return;const o=m.value.map(a=>e.getRowNode(a)).filter(a=>!!a);e.refreshCells({rowNodes:o,force:!0}),m.value=[]}function z(e){l.value=[...e]}function w(e,o){const a=e==="end"?l.value.length-1:e;r.value?.scrollToRow(a,o)}function G(e,o){r.value?.scrollToColumn(e,o)}function H(e,o){const a=[u,String(e),o].flat();return s?.validateFields([a])}function L(e){const a=t.unref(l).map((i,p)=>[u,String(f.getRowKey(i,p,n.rowKey)),e].flat());return s?.validateFields(a)}function M(e,o=!0){const a=Array.isArray(e)?e:[e];r.value?._internalGridApi?.refreshCells({columns:a,force:o})}return b({add:E,addByKey:V,addMultiple:_,remove:N,removeByKey:A,getRowData:D,getRowsData:K,getRowDataByKey:j,setRowData:O,clear:U,setTableData:z,scrollTo:w,scrollToRow:w,scrollToColumn:G,validateCell:H,validateColumn:L,setRowDataByKey:P,table:r,refreshColumns:M}),(e,o)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createVNode(t.unref(y.ApForm).FormItem,{hidden:"",name:e.name,"initial-value":e.formItem?.initialValue,transform:B},null,8,["name","initial-value"]),t.createVNode(t.unref(y.ApForm).FormItem,t.mergeProps({label:e.label},e.formItem),{default:t.withCtx(()=>[t.createVNode(oe.default,t.mergeProps(t.unref(c.omit)(n,["name","maxLength","onChange","defaultValue","formItem","onUpdate"]),{ref_key:"tableRef",ref:r,class:[t.unref(R)(),t.unref(v)],size:"mini",columns:t.unref(I),"data-source":l.value,"search-form":!1,onUpdate:k}),t.createSlots({_:2},[t.renderList(C,(a,i)=>({name:i,fn:t.withCtx(p=>[t.renderSlot(e.$slots,i,t.normalizeProps(t.guardReactiveProps(p||{})))])}))]),1040,["class","columns","data-source"])]),_:3},16,["label"])],64))}});exports.default=ae;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),d=require("lodash-unified"),m=require("../../ap-form/index.js");require("../../config-provider/index.js");require("../../hooks/index.js");const W=require("../hooks/use-editable-api.js"),$=require("../hooks/use-editable-columns.js");require("../index.vue2.js");const J=require("../style/editable.js"),y=require("./utils.js"),Q=require("../../config-provider/hooks/use-namespace.js"),X=require("../../hooks/useControllableValue.js"),Y=require("../../config-provider/hooks/use-global-config.js"),Z=require("../index.vue.js"),ee=a.defineComponent({name:"EditableGrid",__name:"index",props:{dropdownPrefixCls:{},bordered:{type:Boolean},locale:{},onResizeColumn:{},getPopupContainer:{},scroll:{},sortDirections:{},showSorterTooltip:{type:[Boolean,Object]},prefixCls:{},rowKey:{type:[String,Function],default:"key"},tableLayout:{},title:{},id:{},showHeader:{type:Boolean},components:{},customHeaderRow:{},direction:{},expandFixed:{type:[String,Boolean]},expandColumnWidth:{},expandedRowKeys:{},defaultExpandedRowKeys:{},expandedRowRender:{},expandRowByClick:{type:Boolean},expandIcon:{},onExpand:{},onExpandedRowsChange:{},defaultExpandAllRows:{type:Boolean},indentSize:{},expandIconColumnIndex:{},showExpandColumn:{type:Boolean},expandedRowClassName:{},childrenColumnName:{},rowExpandable:{},transformCellText:{},rowHoverable:{type:Boolean},rowSelection:{type:[Boolean,Object]},onLoadingChange:{},onShownColumnsChange:{},pagination:{type:[Boolean,Object],default:!1},searchFormWrapperStyle:{},tableWrapperStyle:{},wrapperStyle:{},tableStyle:{},adaptive:{type:Boolean},columnResizable:{type:Boolean,default:!1},loading:{type:Boolean,default:void 0},summary:{},rowHeight:{default:66},getRowHeight:{},advanceRenderer:{type:Boolean},browserTooltips:{type:Boolean},virtual:{type:[Boolean,Object],default:void 0},onRowClicked:{},onScrollEnd:{},rowClassName:{},rowClassRules:{},autoHeight:{type:Boolean},onUpdate:{},onModelUpdated:{},customRow:{},theme:{},emptyComponent:{},emptyText:{},onColumnResized:{},animateRows:{type:Boolean},plugins:{},columns:{},value:{},defaultValue:{},"onUpdate:value":{},onChange:{},maxLength:{},name:{default:"ap-editable-table-inner-name"},onFieldChange:{},supressForceRowUpdate:{type:Boolean,default:!1}},emits:["update:value"],setup(C,{expose:R,emit:v}){const x=a.useSlots(),n=C,{b:B}=Q.useNamespace("editable-aggrid"),_=J.default("editable-aggrid"),T=v,s=a.ref(),{value:u,updateValue:w}=X.useControllableValue(n,T),l=a.ref(),S=m.ApForm.useWatch(n.name,l);let i;a.watch(u,e=>{const t=y.arrayToObject(e,n.rowKey);d.isEqual(t,a.unref(S))||(i=()=>{l.value?.setFieldValue(n.name,t)})},{deep:!0});const A=Y.useGlobalConfig("valueTypeMap"),F=$.useGetEditableColumns(n,A),{add:q,addMultiple:E,remove:K,removeByKey:N,getRowData:U,getRowsData:j,getRowDataByKey:k,setRowData:D,setRowDataByKey:V,clear:I,refreshRowIds:c}=W.useEditableApi(n,l,u,w);function O(){if(n.onUpdate?.(),i&&(i(),i=void 0),n.supressForceRowUpdate)return;const e=s.value?._internalGridApi;if(!c.value?.length||!e)return;const t=c.value.map(o=>e.getRowNode(o)).filter(o=>!!o);e.refreshCells({rowNodes:t,force:!0}),c.value=[]}function z(){l.value?.resetFields()}function g(e){return e?(d.isArray(e)?e:[e]).map(o=>d.isArray(o)?[n.name,...o]:[n.name,o]):void 0}function b(e){try{const t=Object.keys(e),o=u.value.map(r=>y.getRowKey(r,void 0,n.rowKey));return t.sort((r,p)=>o.findIndex(f=>String(f)===r)-o.findIndex(f=>String(f)===p)),t.map(r=>e[r])}catch{return e}}async function G(e,t){const r=(await l.value?.validateFields(g(e),t))?.[n.name];return b(r)}async function H(e,t){const r=(await l.value?.validateFieldsReturnTransformed(g(e),t))?.[n.name];return b(r)}function M(e){w(e)}function h(e,t){const o=e==="end"?u.value.length-1:e;s.value?.scrollToRow(o,t)}function P(e,t){s.value?.scrollToColumn(e,t)}function L(e,t=!0){const o=Array.isArray(e)?e:[e];s.value?._internalGridApi?.refreshCells({columns:o,force:t})}return R({resetFields:z,validateFields:G,validateFieldsReturnTransformed:H,add:q,addMultiple:E,remove:K,removeByKey:N,getRowData:U,getRowsData:j,setRowData:D,clear:I,setTableData:M,scrollTo:h,scrollToRow:h,scrollToColumn:P,table:s,getRowDataByKey:k,setRowDataByKey:V,refreshColumns:L}),(e,t)=>(a.openBlock(),a.createBlock(a.unref(m.ApForm),{ref_key:"formRef",ref:l,"initial-values":{[n.name]:a.unref(y.arrayToObject)(a.unref(u),n.rowKey)},style:{height:"100%"}},{default:a.withCtx(()=>[a.createVNode(a.unref(m.ApForm).FormItem,{name:e.name,"no-style":""},{default:a.withCtx(()=>[a.createVNode(Z.default,a.mergeProps(a.unref(d.omit)(n,["name","value","onUpdate:value","maxLength","onChange","defaultValue","onUpdate"]),{ref_key:"tableRef",ref:s,class:[a.unref(B)(),a.unref(_)],size:"mini",columns:a.unref(F),"data-source":a.unref(u),"search-form":!1,onUpdate:O}),a.createSlots({_:2},[a.renderList(x,(o,r)=>({name:r,fn:a.withCtx(p=>[a.renderSlot(e.$slots,r,a.normalizeProps(a.guardReactiveProps(p||{})))])}))]),1040,["class","columns","data-source"])]),_:3},8,["name"])]),_:3},8,["initial-values"]))}});exports.default=ee;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("vue"),d=require("lodash-unified"),m=require("../../ap-form/index.js");require("../../config-provider/index.js");require("../../hooks/index.js");const $=require("../hooks/use-editable-api.js"),J=require("../hooks/use-editable-columns.js");require("../index.vue2.js");const Q=require("../style/editable.js"),y=require("./utils.js"),X=require("../../config-provider/hooks/use-namespace.js"),Y=require("../../hooks/useControllableValue.js"),Z=require("../../config-provider/hooks/use-global-config.js"),ee=require("../index.vue.js"),ae=a.defineComponent({name:"EditableGrid",__name:"index",props:{dropdownPrefixCls:{},bordered:{type:Boolean},locale:{},onResizeColumn:{},getPopupContainer:{},scroll:{},sortDirections:{},showSorterTooltip:{type:[Boolean,Object]},prefixCls:{},rowKey:{type:[String,Function],default:"key"},tableLayout:{},title:{},id:{},showHeader:{type:Boolean},components:{},customHeaderRow:{},direction:{},expandFixed:{type:[String,Boolean]},expandColumnWidth:{},expandedRowKeys:{},defaultExpandedRowKeys:{},expandedRowRender:{},expandRowByClick:{type:Boolean},expandIcon:{},onExpand:{},onExpandedRowsChange:{},defaultExpandAllRows:{type:Boolean},indentSize:{},expandIconColumnIndex:{},showExpandColumn:{type:Boolean},expandedRowClassName:{},childrenColumnName:{},rowExpandable:{},transformCellText:{},rowHoverable:{type:Boolean},rowSelection:{type:[Boolean,Object]},onLoadingChange:{},onShownColumnsChange:{},pagination:{type:[Boolean,Object],default:!1},searchFormWrapperStyle:{},tableWrapperStyle:{},wrapperStyle:{},tableStyle:{},adaptive:{type:Boolean},columnResizable:{type:Boolean,default:!1},loading:{type:Boolean,default:void 0},summary:{},rowHeight:{default:66},getRowHeight:{},advanceRenderer:{type:Boolean},browserTooltips:{type:Boolean},virtual:{type:[Boolean,Object],default:void 0},onRowClicked:{},onScrollEnd:{},rowClassName:{},rowClassRules:{},autoHeight:{type:Boolean},onUpdate:{},onModelUpdated:{},customRow:{},theme:{},emptyComponent:{},emptyText:{},onColumnResized:{},animateRows:{type:Boolean},plugins:{},columns:{},value:{},defaultValue:{},"onUpdate:value":{},onChange:{},maxLength:{},name:{default:"ap-editable-table-inner-name"},onFieldChange:{},supressForceRowUpdate:{type:Boolean,default:!1}},emits:["update:value"],setup(C,{expose:R,emit:v}){const x=a.useSlots(),n=C,{b:B}=X.useNamespace("editable-aggrid"),_=Q.default("editable-aggrid"),T=v,s=a.ref(),{value:u,updateValue:w}=Y.useControllableValue(n,T),l=a.ref(),S=m.ApForm.useWatch(n.name,l);let i;a.watch(u,e=>{const t=y.arrayToObject(e,n.rowKey);d.isEqual(t,a.unref(S))||(i=()=>{l.value?.setFieldValue(n.name,t)})},{deep:!0});const A=Z.useGlobalConfig("valueTypeMap"),F=J.useGetEditableColumns(n,A),{add:q,addByKey:E,addMultiple:K,remove:N,removeByKey:U,getRowData:j,getRowsData:k,getRowDataByKey:D,setRowData:V,setRowDataByKey:I,clear:O,refreshRowIds:c}=$.useEditableApi(n,l,u,w);function z(){if(n.onUpdate?.(),i&&(i(),i=void 0),n.supressForceRowUpdate)return;const e=s.value?._internalGridApi;if(!c.value?.length||!e)return;const t=c.value.map(o=>e.getRowNode(o)).filter(o=>!!o);e.refreshCells({rowNodes:t,force:!0}),c.value=[]}function G(){l.value?.resetFields()}function g(e){return e?(d.isArray(e)?e:[e]).map(o=>d.isArray(o)?[n.name,...o]:[n.name,o]):void 0}function b(e){try{const t=Object.keys(e),o=u.value.map(r=>y.getRowKey(r,void 0,n.rowKey));return t.sort((r,p)=>o.findIndex(f=>String(f)===r)-o.findIndex(f=>String(f)===p)),t.map(r=>e[r])}catch{return e}}async function H(e,t){const r=(await l.value?.validateFields(g(e),t))?.[n.name];return b(r)}async function M(e,t){const r=(await l.value?.validateFieldsReturnTransformed(g(e),t))?.[n.name];return b(r)}function P(e){w(e)}function h(e,t){const o=e==="end"?u.value.length-1:e;s.value?.scrollToRow(o,t)}function L(e,t){s.value?.scrollToColumn(e,t)}function W(e,t=!0){const o=Array.isArray(e)?e:[e];s.value?._internalGridApi?.refreshCells({columns:o,force:t})}return R({resetFields:G,validateFields:H,validateFieldsReturnTransformed:M,add:q,addByKey:E,addMultiple:K,remove:N,removeByKey:U,getRowData:j,getRowsData:k,setRowData:V,clear:O,setTableData:P,scrollTo:h,scrollToRow:h,scrollToColumn:L,table:s,getRowDataByKey:D,setRowDataByKey:I,refreshColumns:W}),(e,t)=>(a.openBlock(),a.createBlock(a.unref(m.ApForm),{ref_key:"formRef",ref:l,"initial-values":{[n.name]:a.unref(y.arrayToObject)(a.unref(u),n.rowKey)},style:{height:"100%"}},{default:a.withCtx(()=>[a.createVNode(a.unref(m.ApForm).FormItem,{name:e.name,"no-style":""},{default:a.withCtx(()=>[a.createVNode(ee.default,a.mergeProps(a.unref(d.omit)(n,["name","value","onUpdate:value","maxLength","onChange","defaultValue","onUpdate"]),{ref_key:"tableRef",ref:s,class:[a.unref(B)(),a.unref(_)],size:"mini",columns:a.unref(F),"data-source":a.unref(u),"search-form":!1,onUpdate:z}),a.createSlots({_:2},[a.renderList(x,(o,r)=>({name:r,fn:a.withCtx(p=>[a.renderSlot(e.$slots,r,a.normalizeProps(a.guardReactiveProps(p||{})))])}))]),1040,["class","columns","data-source"])]),_:3},8,["name"])]),_:3},8,["initial-values"]))}});exports.default=ae;
@@ -111,6 +111,13 @@ export type EditableAgGridExpose<RecordType = any, ModelType = RecordType[]> = O
111
111
  * @returns
112
112
  */
113
113
  refreshColumns: (columnKey: string | string[], force?: boolean) => void;
114
+ /**
115
+ * 添加一条数据(通过行key)
116
+ * @param defaultValue
117
+ * @param key
118
+ * @returns
119
+ */
120
+ addByKey: (defaultValue?: Partial<RecordType> | undefined, key?: number) => void;
114
121
  };
115
122
  export type EditableAgGridFormItemExpose<RecordType = any, ModelType = RecordType[]> = Omit<EditableAgGridExpose<RecordType, ModelType>, 'resetFields' | 'validateFields' | 'validateFieldsReturnTransformed'> & {
116
123
  /**
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("vue"),l=require("../utils.js"),g=o=>{const r=u.ref([]),i=u.ref([]);function s(n=[]){return n.filter(e=>!e.hideInTable).map(e=>{if(e.children?.length){const t=s(e.children);return t?.length?{...e,children:t}:null}return e}).filter(Boolean)}function a(n){return r.value.find(e=>l.getStringKey(e.key)===n)}const d=u.computed(()=>r.value.map(n=>l.getStringKey(n.key)).filter(Boolean));async function f(n,e){return await l.runPipelineHooks(o.plugins,n,t=>t.beforeColumnsChange?.bind(t),e)}u.watch(()=>o.columns,async()=>{const n=s(o.columns),e=await f(n,r.value);r.value=e,i.value=e,o.onShownColumnsChange?.(e)},{deep:!0,immediate:!0});function c(n){for(const e of n)if(e.children){const t=c(e.children);if(t)return t}else if(e.defaultSortOrder){const t=e.field??e.dataIndex??e.key;return{colKey:e.key,field:t,order:e.defaultSortOrder}}}const m=u.computed(()=>c(r.value));return{columns:r,shownColumns:i,columnKeys:d,getTargetColumnByKey:a,defaultSortOrder:m}};exports.useColumns=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),i=require("../utils.js"),g=r=>{const u=o.ref([]),s=o.ref([]);function l(n=[]){return n.filter(e=>!e.hideInTable).map(e=>{if(e.children?.length){const t=l(e.children);return t?.length?{...e,children:t}:null}return e}).filter(Boolean)}function a(n){return u.value.find(e=>i.getStringKey(e.key)===n)}const d=o.computed(()=>u.value.map(n=>i.getStringKey(n.key)).filter(Boolean));async function f(n,e){return await i.runPipelineHooks(r.plugins,n,t=>t.beforeColumnsChange?.bind(t),e)}o.watch(()=>r.columns,async()=>{const n=l(r.columns),e=await f(n,u.value);u.value=e,s.value=e,r.onShownColumnsChange?.(e)},{deep:!0,immediate:!0});function c(n){for(const e of n)if(e.children){const t=c(e.children);if(t)return t}else if(e.defaultSortOrder){const t=e.field??e.dataIndex??e.key;return{colKey:e.key,field:t,order:e.defaultSortOrder}}}const m=o.computed(()=>c(l(r.columns)));return{columns:u,shownColumns:s,columnKeys:d,getTargetColumnByKey:a,defaultSortOrder:m}};exports.useColumns=g;