@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.
- package/es/src/ag-grid/editable/form-item.vue.mjs +72 -70
- package/es/src/ag-grid/editable/index.vue.mjs +59 -57
- package/es/src/ag-grid/editable/interface.d.ts +7 -0
- package/es/src/ag-grid/hooks/use-columns.mjs +18 -18
- package/es/src/ag-grid/hooks/use-editable-api.d.ts +1 -0
- package/es/src/ag-grid/hooks/use-editable-api.mjs +107 -88
- package/es/src/ag-grid/hooks/use-editable-form-item-api.d.ts +1 -0
- package/es/src/ag-grid/hooks/use-editable-form-item-api.mjs +105 -86
- package/es/src/ag-grid/index.vue.mjs +169 -166
- package/es/src/ap-action/item-popconfirm/index.vue.mjs +14 -14
- package/es/src/ap-field/select/index.vue.mjs +125 -122
- package/es/src/ap-list/hooks/use-offline-list.mjs +31 -18
- package/es/src/check-card/index.vue.d.ts +0 -1
- package/es/src/check-card/index.vue2.mjs +3 -5
- package/es/src/version.d.ts +1 -1
- package/es/src/version.mjs +1 -1
- package/lib/src/ag-grid/editable/form-item.vue.js +1 -1
- package/lib/src/ag-grid/editable/index.vue.js +1 -1
- package/lib/src/ag-grid/editable/interface.d.ts +7 -0
- package/lib/src/ag-grid/hooks/use-columns.js +1 -1
- package/lib/src/ag-grid/hooks/use-editable-api.d.ts +1 -0
- package/lib/src/ag-grid/hooks/use-editable-api.js +1 -1
- package/lib/src/ag-grid/hooks/use-editable-form-item-api.d.ts +1 -0
- package/lib/src/ag-grid/hooks/use-editable-form-item-api.js +1 -1
- package/lib/src/ag-grid/index.vue.js +1 -1
- package/lib/src/ap-action/item-popconfirm/index.vue.js +1 -1
- package/lib/src/ap-field/select/index.vue.js +1 -1
- package/lib/src/ap-list/hooks/use-offline-list.js +1 -1
- package/lib/src/check-card/index.vue.d.ts +0 -1
- package/lib/src/check-card/index.vue2.js +1 -1
- package/lib/src/version.d.ts +1 -1
- package/lib/src/version.js +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Popconfirm as
|
|
3
|
-
import { omit as
|
|
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__ */
|
|
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(
|
|
23
|
-
const
|
|
24
|
-
async function
|
|
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) => (
|
|
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:
|
|
30
|
+
onConfirm: c
|
|
31
31
|
}), {
|
|
32
32
|
default: t(() => [
|
|
33
|
-
|
|
34
|
-
B(
|
|
35
|
-
name:
|
|
36
|
-
fn: t((
|
|
37
|
-
|
|
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
|
|
2
|
-
import { Select as
|
|
3
|
-
import { debounce as
|
|
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
|
|
6
|
+
import { useDevWarning as Ue } from "../../utils/warning.mjs";
|
|
7
7
|
import "../../hooks/index.mjs";
|
|
8
|
-
import { useDefaultPlaceholder as
|
|
9
|
-
import
|
|
10
|
-
import { useSelectOptions as
|
|
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
|
|
14
|
-
import { useControllableValue as
|
|
15
|
-
const
|
|
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
|
-
},
|
|
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
|
|
189
|
+
const O = xe(), t = G, {
|
|
190
190
|
deprecated: X
|
|
191
|
-
} =
|
|
191
|
+
} = Ue("ApFieldSelect");
|
|
192
192
|
X(!_(t.refetchOnFocus), "refetchOnFocus", "fetchOnFocus");
|
|
193
193
|
const {
|
|
194
|
-
b:
|
|
194
|
+
b: S
|
|
195
195
|
} = W("field-select"), {
|
|
196
196
|
b: f
|
|
197
|
-
} = W("field-select-popup-option"), Y =
|
|
197
|
+
} = W("field-select-popup-option"), Y = Ke("field"), Z = qe.useInjectFormItemContext(), D = N(!1), M = N(!1), {
|
|
198
198
|
t: L
|
|
199
|
-
} =
|
|
200
|
-
if (!
|
|
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((
|
|
205
|
-
i === n && (w(
|
|
204
|
+
w([]), r.value = !0, t.request(e).then((o) => {
|
|
205
|
+
i === n && (w(o), r.value = !1);
|
|
206
206
|
});
|
|
207
|
-
}, t.searchDelay),
|
|
208
|
-
const
|
|
209
|
-
return typeof n?.[
|
|
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
|
-
} =
|
|
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 (!
|
|
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
|
|
224
|
+
const o = await t.request(void 0, t.params);
|
|
225
225
|
if (n !== i)
|
|
226
226
|
return;
|
|
227
|
-
w(
|
|
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
|
-
|
|
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
|
-
}),
|
|
250
|
+
}), Be(() => t.params, () => {
|
|
248
251
|
d();
|
|
249
252
|
}, {
|
|
250
253
|
deep: !0
|
|
251
254
|
});
|
|
252
255
|
const {
|
|
253
256
|
value: p,
|
|
254
|
-
updateValue:
|
|
255
|
-
} =
|
|
256
|
-
const e =
|
|
257
|
-
if (
|
|
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",
|
|
260
|
-
return
|
|
261
|
-
}),
|
|
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
|
|
264
|
-
return e && (
|
|
266
|
+
let o = {};
|
|
267
|
+
return e && (o = n === "request" ? {
|
|
265
268
|
defaultActiveFirstOption: !1,
|
|
266
|
-
onSearch:
|
|
269
|
+
onSearch: ee,
|
|
267
270
|
notFoundContent: r.value ? void 0 : null,
|
|
268
271
|
filterOption: !1,
|
|
269
272
|
suffixIcon: null
|
|
270
273
|
} : {
|
|
271
|
-
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:
|
|
275
|
-
...
|
|
277
|
+
placeholder: l(re),
|
|
278
|
+
...o
|
|
276
279
|
};
|
|
277
|
-
}),
|
|
278
|
-
function
|
|
279
|
-
|
|
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
|
|
282
|
-
|
|
284
|
+
function me() {
|
|
285
|
+
x.value?.blur();
|
|
283
286
|
}
|
|
284
287
|
function m(e, n) {
|
|
285
|
-
const
|
|
286
|
-
return
|
|
288
|
+
const o = t.fieldNames?.[n] ?? n;
|
|
289
|
+
return o === "groupLabel" ? e[o] ?? e.label : e[o];
|
|
287
290
|
}
|
|
288
|
-
function
|
|
291
|
+
function he(e) {
|
|
289
292
|
const n = q(e);
|
|
290
|
-
|
|
293
|
+
V(t.multiple ? [n] : n), t.onChange?.([n], [e]);
|
|
291
294
|
}
|
|
292
|
-
function
|
|
293
|
-
return
|
|
295
|
+
function ve(e) {
|
|
296
|
+
return O.option ? v("div", {
|
|
294
297
|
class: f("custom")
|
|
295
|
-
}, [
|
|
298
|
+
}, [O.option(e)]) : v("span", {
|
|
296
299
|
class: f("label")
|
|
297
300
|
}, [m(e, e.options?.length ? "groupLabel" : "label")]);
|
|
298
301
|
}
|
|
299
|
-
const
|
|
300
|
-
const e =
|
|
301
|
-
return n.length > 0 && n.every((
|
|
302
|
-
}),
|
|
303
|
-
const e =
|
|
304
|
-
return
|
|
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
|
|
310
|
-
const n =
|
|
311
|
-
return
|
|
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
|
|
314
|
-
return e.find((
|
|
316
|
+
function b(e, n) {
|
|
317
|
+
return e.find((o) => B(o, n)) != null;
|
|
315
318
|
}
|
|
316
|
-
function
|
|
317
|
-
return e.findIndex((
|
|
319
|
+
function be(e, n) {
|
|
320
|
+
return e.findIndex((o) => B(o, n));
|
|
318
321
|
}
|
|
319
322
|
function q(e, n) {
|
|
320
|
-
const
|
|
323
|
+
const o = m(e, "label"), u = n ?? m(e, "value");
|
|
321
324
|
return t.labelInValue ? {
|
|
322
|
-
label: typeof
|
|
323
|
-
originLabel:
|
|
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
|
|
329
|
-
const e = [...
|
|
330
|
-
n.length > 0 && n.every((a) =>
|
|
331
|
-
const h =
|
|
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 (
|
|
337
|
+
if (b(e, a))
|
|
335
338
|
return;
|
|
336
|
-
const h = c.value.find((
|
|
337
|
-
e.push(
|
|
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) =>
|
|
340
|
-
|
|
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:
|
|
344
|
-
blur:
|
|
346
|
+
focus: pe,
|
|
347
|
+
blur: me,
|
|
345
348
|
request: d
|
|
346
|
-
}), (e, n) => e.mode === "read" ? (y(), T("span",
|
|
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:
|
|
352
|
+
ref: x,
|
|
350
353
|
"allow-clear": ""
|
|
351
|
-
},
|
|
354
|
+
}, ce.value, {
|
|
352
355
|
mode: le.value,
|
|
353
|
-
value:
|
|
354
|
-
options:
|
|
356
|
+
value: l(p),
|
|
357
|
+
options: l(c),
|
|
355
358
|
loading: r.value,
|
|
356
|
-
"menu-item-selected-icon":
|
|
357
|
-
"popup-class-name": `${
|
|
358
|
-
"onUpdate:value":
|
|
359
|
-
onFocus:
|
|
360
|
-
onDropdownVisibleChange:
|
|
361
|
-
}),
|
|
362
|
-
option: g((
|
|
363
|
-
class:
|
|
364
|
-
}, [v(
|
|
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:
|
|
370
|
+
class: C(l(f)("wrapper")),
|
|
368
371
|
gap: 8
|
|
369
372
|
}, {
|
|
370
|
-
default: g(() => [v(
|
|
373
|
+
default: g(() => [v(l(E), {
|
|
371
374
|
gap: 8,
|
|
372
375
|
align: "center",
|
|
373
|
-
class:
|
|
376
|
+
class: C(l(f)("content-wrapper"))
|
|
374
377
|
}, {
|
|
375
|
-
default: g(() => [P.value ? (y(),
|
|
378
|
+
default: g(() => [P.value ? (y(), F(l(U), {
|
|
376
379
|
key: 0,
|
|
377
|
-
checked:
|
|
378
|
-
}, null, 8, ["checked"])) : R("", !0), (y(),
|
|
380
|
+
checked: Ce(o)
|
|
381
|
+
}, null, 8, ["checked"])) : R("", !0), (y(), F(z(ve(o))))]),
|
|
379
382
|
_: 2
|
|
380
|
-
}, 1032, ["class"]),
|
|
383
|
+
}, 1032, ["class"]), fe.value && !o?.disabled ? (y(), T("span", {
|
|
381
384
|
key: 0,
|
|
382
|
-
class:
|
|
383
|
-
onClick:
|
|
384
|
-
},
|
|
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
|
-
}, [
|
|
391
|
+
}, [De(l(H)(O, ["option"]), (o, u) => ({
|
|
389
392
|
name: u,
|
|
390
|
-
fn: g((a) => [
|
|
393
|
+
fn: g((a) => [Me(e.$slots, u, Le(Pe(a || {})))])
|
|
391
394
|
})), r.value ? {
|
|
392
395
|
name: "notFoundContent",
|
|
393
|
-
fn: g(() => [v(
|
|
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:
|
|
401
|
-
}) => [
|
|
403
|
+
menuNode: o
|
|
404
|
+
}) => [A("div", {
|
|
402
405
|
tabindex: -1,
|
|
403
|
-
class:
|
|
404
|
-
onClick:
|
|
405
|
-
}, [v(
|
|
406
|
-
checked:
|
|
407
|
-
indeterminate:
|
|
408
|
-
}, null, 8, ["checked", "indeterminate"]),
|
|
409
|
-
class:
|
|
410
|
-
},
|
|
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"
|
|
415
|
+
} : void 0]), 1040, ["mode", "value", "options", "loading", "menu-item-selected-icon", "popup-class-name"]));
|
|
413
416
|
}
|
|
414
417
|
});
|
|
415
418
|
export {
|
|
416
|
-
|
|
419
|
+
ct as default
|
|
417
420
|
};
|
|
@@ -1,36 +1,49 @@
|
|
|
1
|
-
import { isUndefined as
|
|
2
|
-
import { ref as
|
|
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 =
|
|
6
|
+
const i = g(
|
|
7
7
|
e.pagination && e.pagination.defaultCurrent || 1
|
|
8
|
-
), o =
|
|
8
|
+
), o = g(
|
|
9
9
|
e.pagination && e.pagination.defaultPageSize || 10
|
|
10
10
|
);
|
|
11
|
-
function
|
|
12
|
-
i.value = t, o.value =
|
|
11
|
+
function u(t, n) {
|
|
12
|
+
i.value = t, o.value = n;
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
(
|
|
16
|
-
|
|
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:
|
|
20
|
-
const { showLessItems: t, showSizeChanger:
|
|
32
|
+
pagination: l(() => {
|
|
33
|
+
const { showLessItems: t, showSizeChanger: n, showQuickJumper: r, pageSizeOptions: c } = e.pagination || {};
|
|
21
34
|
return {
|
|
22
|
-
current:
|
|
23
|
-
pageSize:
|
|
35
|
+
current: a(i),
|
|
36
|
+
pageSize: a(o),
|
|
24
37
|
total: e.dataSource?.length || 0,
|
|
25
|
-
showSizeChanger: f(
|
|
26
|
-
showQuickJumper: f(
|
|
38
|
+
showSizeChanger: f(n) ? n : !t,
|
|
39
|
+
showQuickJumper: f(r) ? r : !t,
|
|
27
40
|
showLessItems: t,
|
|
28
41
|
size: "default",
|
|
29
|
-
pageSizeOptions:
|
|
42
|
+
pageSizeOptions: s(c) ? ["10", "20", "50", "100"] : c
|
|
30
43
|
};
|
|
31
44
|
}),
|
|
32
|
-
dataSource:
|
|
33
|
-
onChange:
|
|
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
|
|
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];
|
package/es/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "7.20.
|
|
1
|
+
declare const _default: "7.20.3";
|
|
2
2
|
export default _default;
|
package/es/src/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),c=require("lodash-unified"),
|
|
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
|
|
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
|
|
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;
|