@aplus-frontend/ui 7.20.2 → 7.20.4
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/index.mjs +73 -71
- 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 +230 -227
- package/es/src/ap-action/item-popconfirm/index.vue.mjs +14 -14
- package/es/src/ap-list/hooks/use-offline-list.mjs +31 -18
- package/es/src/business/ag-grid-container/index.d.ts +3 -0
- package/es/src/business/ag-grid-container/index.mjs +2 -0
- package/es/src/business/ag-grid-container/index.vue.d.ts +33 -0
- package/es/src/business/ag-grid-container/index.vue.mjs +64 -0
- package/es/src/business/ag-grid-container/index.vue2.mjs +4 -0
- package/es/src/business/ag-grid-container/interface.d.ts +4 -0
- package/es/src/business/ag-grid-container/interface.mjs +1 -0
- package/es/src/business/index.d.ts +1 -0
- package/es/src/business/index.mjs +55 -54
- package/es/src/check-card/index.vue.d.ts +0 -1
- package/es/src/check-card/index.vue2.mjs +3 -5
- package/es/src/config-provider/config-provider-props.d.ts +1 -1
- package/es/src/config-provider/config-provider.d.ts +3 -0
- package/es/src/config-provider/config-provider.mjs +1 -1
- package/es/src/config-provider/hooks/use-global-config.d.ts +2 -0
- package/es/src/config-provider/index.d.ts +4 -0
- package/es/src/highlight/index.vue.mjs +9 -9
- package/es/src/index.mjs +82 -80
- package/es/src/version.d.ts +1 -1
- package/es/src/version.mjs +1 -1
- package/lib/index.js +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-list/hooks/use-offline-list.js +1 -1
- package/lib/src/business/ag-grid-container/index.d.ts +3 -0
- package/lib/src/business/ag-grid-container/index.js +1 -0
- package/lib/src/business/ag-grid-container/index.vue.d.ts +33 -0
- package/lib/src/business/ag-grid-container/index.vue.js +1 -0
- package/lib/src/business/ag-grid-container/index.vue2.js +1 -0
- package/lib/src/business/ag-grid-container/interface.d.ts +4 -0
- package/lib/src/business/ag-grid-container/interface.js +1 -0
- package/lib/src/business/index.d.ts +1 -0
- package/lib/src/business/index.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/config-provider/config-provider-props.d.ts +1 -1
- package/lib/src/config-provider/config-provider.d.ts +3 -0
- package/lib/src/config-provider/config-provider.js +1 -1
- package/lib/src/config-provider/hooks/use-global-config.d.ts +2 -0
- package/lib/src/config-provider/index.d.ts +4 -0
- package/lib/src/index.js +1 -1
- package/lib/src/version.d.ts +1 -1
- package/lib/src/version.js +1 -1
- package/package.json +4 -4
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { isEqual as
|
|
1
|
+
import { defineComponent as X, useSlots as Y, ref as h, watch as Z, unref as r, createBlock as ee, openBlock as oe, withCtx as c, createVNode as C, mergeProps as ae, createSlots as te, renderList as ne, renderSlot as re, normalizeProps as le, guardReactiveProps as se } from "vue";
|
|
2
|
+
import { isEqual as ie, isArray as b, omit as de } from "lodash-unified";
|
|
3
3
|
import { ApForm as f } from "../../ap-form/index.mjs";
|
|
4
4
|
import "../../config-provider/index.mjs";
|
|
5
5
|
import "../../hooks/index.mjs";
|
|
6
|
-
import { useEditableApi as
|
|
7
|
-
import { useGetEditableColumns as
|
|
6
|
+
import { useEditableApi as ue } from "../hooks/use-editable-api.mjs";
|
|
7
|
+
import { useGetEditableColumns as pe } from "../hooks/use-editable-columns.mjs";
|
|
8
8
|
import "../index.vue2.mjs";
|
|
9
|
-
import
|
|
10
|
-
import { arrayToObject as v, getRowKey as
|
|
11
|
-
import { useNamespace as
|
|
12
|
-
import { useControllableValue as
|
|
13
|
-
import { useGlobalConfig as
|
|
14
|
-
import
|
|
15
|
-
const
|
|
9
|
+
import me from "../style/editable.mjs";
|
|
10
|
+
import { arrayToObject as v, getRowKey as ce } from "./utils.mjs";
|
|
11
|
+
import { useNamespace as fe } from "../../config-provider/hooks/use-namespace.mjs";
|
|
12
|
+
import { useControllableValue as ye } from "../../hooks/useControllableValue.mjs";
|
|
13
|
+
import { useGlobalConfig as we } from "../../config-provider/hooks/use-global-config.mjs";
|
|
14
|
+
import ge from "../index.vue.mjs";
|
|
15
|
+
const ke = /* @__PURE__ */ X({
|
|
16
16
|
name: "EditableGrid",
|
|
17
17
|
__name: "index",
|
|
18
18
|
props: {
|
|
@@ -147,35 +147,36 @@ const Ke = /* @__PURE__ */ Q({
|
|
|
147
147
|
expose: B,
|
|
148
148
|
emit: S
|
|
149
149
|
}) {
|
|
150
|
-
const T =
|
|
150
|
+
const T = Y(), t = x, {
|
|
151
151
|
b: F
|
|
152
|
-
} =
|
|
152
|
+
} = fe("editable-aggrid"), _ = me("editable-aggrid"), A = S, s = h(), {
|
|
153
153
|
value: i,
|
|
154
154
|
updateValue: y
|
|
155
|
-
} =
|
|
155
|
+
} = ye(t, A), l = h(), E = f.useWatch(t.name, l);
|
|
156
156
|
let d;
|
|
157
|
-
|
|
157
|
+
Z(i, (e) => {
|
|
158
158
|
const o = v(e, t.rowKey);
|
|
159
|
-
|
|
159
|
+
ie(o, r(E)) || (d = () => {
|
|
160
160
|
l.value?.setFieldValue(t.name, o);
|
|
161
161
|
});
|
|
162
162
|
}, {
|
|
163
163
|
deep: !0
|
|
164
164
|
});
|
|
165
|
-
const K =
|
|
165
|
+
const K = we("valueTypeMap"), k = pe(t, K), {
|
|
166
166
|
add: D,
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
167
|
+
addByKey: N,
|
|
168
|
+
addMultiple: U,
|
|
169
|
+
remove: I,
|
|
170
|
+
removeByKey: j,
|
|
171
|
+
getRowData: z,
|
|
172
|
+
getRowsData: V,
|
|
173
|
+
getRowDataByKey: H,
|
|
174
|
+
setRowData: O,
|
|
175
|
+
setRowDataByKey: G,
|
|
176
|
+
clear: L,
|
|
176
177
|
refreshRowIds: u
|
|
177
|
-
} =
|
|
178
|
-
function
|
|
178
|
+
} = ue(t, l, i, y);
|
|
179
|
+
function P() {
|
|
179
180
|
if (t.onUpdate?.(), d && (d(), d = void 0), t.supressForceRowUpdate)
|
|
180
181
|
return;
|
|
181
182
|
const e = s.value?._internalGridApi;
|
|
@@ -187,7 +188,7 @@ const Ke = /* @__PURE__ */ Q({
|
|
|
187
188
|
force: !0
|
|
188
189
|
}), u.value = [];
|
|
189
190
|
}
|
|
190
|
-
function
|
|
191
|
+
function M() {
|
|
191
192
|
l.value?.resetFields();
|
|
192
193
|
}
|
|
193
194
|
function w(e) {
|
|
@@ -195,31 +196,31 @@ const Ke = /* @__PURE__ */ Q({
|
|
|
195
196
|
}
|
|
196
197
|
function g(e) {
|
|
197
198
|
try {
|
|
198
|
-
const o = Object.keys(e), a = i.value.map((n) =>
|
|
199
|
+
const o = Object.keys(e), a = i.value.map((n) => ce(n, void 0, t.rowKey));
|
|
199
200
|
return o.sort((n, p) => a.findIndex((m) => String(m) === n) - a.findIndex((m) => String(m) === p)), o.map((n) => e[n]);
|
|
200
201
|
} catch {
|
|
201
202
|
return e;
|
|
202
203
|
}
|
|
203
204
|
}
|
|
204
|
-
async function
|
|
205
|
+
async function W(e, o) {
|
|
205
206
|
const n = (await l.value?.validateFields(w(e), o))?.[t.name];
|
|
206
207
|
return g(n);
|
|
207
208
|
}
|
|
208
|
-
async function
|
|
209
|
+
async function $(e, o) {
|
|
209
210
|
const n = (await l.value?.validateFieldsReturnTransformed(w(e), o))?.[t.name];
|
|
210
211
|
return g(n);
|
|
211
212
|
}
|
|
212
|
-
function
|
|
213
|
+
function q(e) {
|
|
213
214
|
y(e);
|
|
214
215
|
}
|
|
215
216
|
function R(e, o) {
|
|
216
217
|
const a = e === "end" ? i.value.length - 1 : e;
|
|
217
218
|
s.value?.scrollToRow(a, o);
|
|
218
219
|
}
|
|
219
|
-
function
|
|
220
|
+
function J(e, o) {
|
|
220
221
|
s.value?.scrollToColumn(e, o);
|
|
221
222
|
}
|
|
222
|
-
function
|
|
223
|
+
function Q(e, o = !0) {
|
|
223
224
|
const a = Array.isArray(e) ? e : [e];
|
|
224
225
|
s.value?._internalGridApi?.refreshCells({
|
|
225
226
|
columns: a,
|
|
@@ -227,26 +228,27 @@ const Ke = /* @__PURE__ */ Q({
|
|
|
227
228
|
});
|
|
228
229
|
}
|
|
229
230
|
return B({
|
|
230
|
-
resetFields:
|
|
231
|
-
validateFields:
|
|
232
|
-
validateFieldsReturnTransformed:
|
|
231
|
+
resetFields: M,
|
|
232
|
+
validateFields: W,
|
|
233
|
+
validateFieldsReturnTransformed: $,
|
|
233
234
|
add: D,
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
235
|
+
addByKey: N,
|
|
236
|
+
addMultiple: U,
|
|
237
|
+
remove: I,
|
|
238
|
+
removeByKey: j,
|
|
239
|
+
getRowData: z,
|
|
240
|
+
getRowsData: V,
|
|
241
|
+
setRowData: O,
|
|
242
|
+
clear: L,
|
|
243
|
+
setTableData: q,
|
|
242
244
|
scrollTo: R,
|
|
243
245
|
scrollToRow: R,
|
|
244
|
-
scrollToColumn:
|
|
246
|
+
scrollToColumn: J,
|
|
245
247
|
table: s,
|
|
246
|
-
getRowDataByKey:
|
|
247
|
-
setRowDataByKey:
|
|
248
|
-
refreshColumns:
|
|
249
|
-
}), (e, o) => (
|
|
248
|
+
getRowDataByKey: H,
|
|
249
|
+
setRowDataByKey: G,
|
|
250
|
+
refreshColumns: Q
|
|
251
|
+
}), (e, o) => (oe(), ee(r(f), {
|
|
250
252
|
ref_key: "formRef",
|
|
251
253
|
ref: l,
|
|
252
254
|
"initial-values": {
|
|
@@ -260,7 +262,7 @@ const Ke = /* @__PURE__ */ Q({
|
|
|
260
262
|
name: e.name,
|
|
261
263
|
"no-style": ""
|
|
262
264
|
}, {
|
|
263
|
-
default: c(() => [C(
|
|
265
|
+
default: c(() => [C(ge, ae(r(de)(t, ["name", "value", "onUpdate:value", "maxLength", "onChange", "defaultValue", "onUpdate"]), {
|
|
264
266
|
ref_key: "tableRef",
|
|
265
267
|
ref: s,
|
|
266
268
|
class: [r(F)(), r(_)],
|
|
@@ -268,12 +270,12 @@ const Ke = /* @__PURE__ */ Q({
|
|
|
268
270
|
columns: r(k),
|
|
269
271
|
"data-source": r(i),
|
|
270
272
|
"search-form": !1,
|
|
271
|
-
onUpdate:
|
|
272
|
-
}),
|
|
273
|
+
onUpdate: P
|
|
274
|
+
}), te({
|
|
273
275
|
_: 2
|
|
274
|
-
}, [
|
|
276
|
+
}, [ne(T, (a, n) => ({
|
|
275
277
|
name: n,
|
|
276
|
-
fn: c((p) => [
|
|
278
|
+
fn: c((p) => [re(e.$slots, n, le(se(p || {})))])
|
|
277
279
|
}))]), 1040, ["class", "columns", "data-source"])]),
|
|
278
280
|
_: 3
|
|
279
281
|
}, 8, ["name"])]),
|
|
@@ -282,5 +284,5 @@ const Ke = /* @__PURE__ */ Q({
|
|
|
282
284
|
}
|
|
283
285
|
});
|
|
284
286
|
export {
|
|
285
|
-
|
|
287
|
+
ke as default
|
|
286
288
|
};
|
|
@@ -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,11 +1,11 @@
|
|
|
1
|
-
import { ref as
|
|
1
|
+
import { ref as c, computed as s, watch as y } from "vue";
|
|
2
2
|
import { getStringKey as a, runPipelineHooks as C } from "../utils.mjs";
|
|
3
|
-
const w = (
|
|
4
|
-
const
|
|
5
|
-
function
|
|
3
|
+
const w = (r) => {
|
|
4
|
+
const o = c([]), l = c([]);
|
|
5
|
+
function u(n = []) {
|
|
6
6
|
return n.filter((e) => !e.hideInTable).map((e) => {
|
|
7
7
|
if (e.children?.length) {
|
|
8
|
-
const t =
|
|
8
|
+
const t = u(e.children);
|
|
9
9
|
return t?.length ? {
|
|
10
10
|
...e,
|
|
11
11
|
children: t
|
|
@@ -14,25 +14,25 @@ const w = (o) => {
|
|
|
14
14
|
return e;
|
|
15
15
|
}).filter(Boolean);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
return
|
|
17
|
+
function m(n) {
|
|
18
|
+
return o.value.find((e) => a(e.key) === n);
|
|
19
19
|
}
|
|
20
|
-
const
|
|
21
|
-
() =>
|
|
20
|
+
const f = s(
|
|
21
|
+
() => o.value.map((n) => a(n.key)).filter(Boolean)
|
|
22
22
|
);
|
|
23
23
|
async function d(n, e) {
|
|
24
24
|
return await C(
|
|
25
|
-
|
|
25
|
+
r.plugins,
|
|
26
26
|
n,
|
|
27
27
|
(t) => t.beforeColumnsChange?.bind(t),
|
|
28
28
|
e
|
|
29
29
|
);
|
|
30
30
|
}
|
|
31
31
|
y(
|
|
32
|
-
() =>
|
|
32
|
+
() => r.columns,
|
|
33
33
|
async () => {
|
|
34
|
-
const n =
|
|
35
|
-
|
|
34
|
+
const n = u(r.columns), e = await d(n, o.value);
|
|
35
|
+
o.value = e, l.value = e, r.onShownColumnsChange?.(e);
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
38
|
deep: !0,
|
|
@@ -54,12 +54,12 @@ const w = (o) => {
|
|
|
54
54
|
};
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
const h =
|
|
57
|
+
const h = s(() => i(u(r.columns)));
|
|
58
58
|
return {
|
|
59
|
-
columns:
|
|
60
|
-
shownColumns:
|
|
61
|
-
columnKeys:
|
|
62
|
-
getTargetColumnByKey:
|
|
59
|
+
columns: o,
|
|
60
|
+
shownColumns: l,
|
|
61
|
+
columnKeys: f,
|
|
62
|
+
getTargetColumnByKey: m,
|
|
63
63
|
defaultSortOrder: h
|
|
64
64
|
};
|
|
65
65
|
};
|
|
@@ -4,6 +4,7 @@ import { ApFormInternalInstance, ApFormExpose } from '../../ap-form';
|
|
|
4
4
|
import { EditableAgGridProps } from '../editable/interface';
|
|
5
5
|
export declare const useEditableApi: <RecordType>(props: EditableAgGridProps<RecordType>, formApi: Ref<ApFormExpose | undefined> | ApFormInternalInstance | undefined, tableData: Ref<RecordType[]>, updateTableData?: (newData: RecordType[]) => void) => {
|
|
6
6
|
add: (defaultValue?: Partial<RecordType>, insertIndex?: number) => void;
|
|
7
|
+
addByKey: (defaultValue?: Partial<RecordType>, key?: number) => void;
|
|
7
8
|
addMultiple: (list: number | Partial<RecordType>[], insetIn?: "prefix" | "suffix") => void;
|
|
8
9
|
remove: (data: RecordType | RecordType[]) => void;
|
|
9
10
|
removeByKey: (key: Key | Key[]) => void;
|
|
@@ -1,149 +1,168 @@
|
|
|
1
|
-
import { isFunction as
|
|
2
|
-
import { shallowRef as
|
|
1
|
+
import { isFunction as h, isUndefined as m, isNumber as K, cloneDeep as G, isArray as F, isString as N } from "lodash-unified";
|
|
2
|
+
import { shallowRef as W, computed as $, unref as w, isRef as q } from "vue";
|
|
3
3
|
import "../../utils/index.mjs";
|
|
4
|
-
import { useDevWarning as
|
|
5
|
-
import { isDef as
|
|
6
|
-
let
|
|
7
|
-
function
|
|
8
|
-
return `_ag_grid${
|
|
4
|
+
import { useDevWarning as C } from "../../utils/warning.mjs";
|
|
5
|
+
import { isDef as R } from "../../utils/is.mjs";
|
|
6
|
+
let H = 0;
|
|
7
|
+
function x() {
|
|
8
|
+
return `_ag_grid${H++}`;
|
|
9
9
|
}
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
function
|
|
13
|
-
const
|
|
14
|
-
if (
|
|
10
|
+
const Y = (u, y, i, d) => {
|
|
11
|
+
const I = C("EditableAgGrid"), v = W([]), B = $(() => q(y) ? w(y) : y);
|
|
12
|
+
function L(e, r) {
|
|
13
|
+
const f = w(i)?.length || 0;
|
|
14
|
+
if (R(u.maxLength) && f >= u.maxLength || !e && h(u.rowKey))
|
|
15
15
|
return;
|
|
16
|
-
const
|
|
17
|
-
...e || { [u.rowKey]:
|
|
16
|
+
const o = {
|
|
17
|
+
...e || { [u.rowKey]: x() }
|
|
18
18
|
};
|
|
19
19
|
if (!i.value) {
|
|
20
|
-
i.value = [
|
|
20
|
+
i.value = [o];
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
(n,
|
|
25
|
-
).filter(Boolean), i.value.splice(
|
|
23
|
+
m(r) ? i.value.push(o) : (v.value = i.value.map(
|
|
24
|
+
(n, t) => t < r ? null : c(n, t, u.rowKey)
|
|
25
|
+
).filter(Boolean), i.value.splice(r, 0, o));
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
const
|
|
29
|
-
if (
|
|
27
|
+
function U(e, r) {
|
|
28
|
+
const f = w(i)?.length || 0;
|
|
29
|
+
if (R(u.maxLength) && f >= u.maxLength || !e && h(u.rowKey))
|
|
30
30
|
return;
|
|
31
|
-
const
|
|
31
|
+
const o = {
|
|
32
|
+
...e || { [u.rowKey]: x() }
|
|
33
|
+
};
|
|
34
|
+
if (!i.value) {
|
|
35
|
+
i.value = [o];
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const n = i.value.findIndex(
|
|
39
|
+
(s, l) => c(s, l, u.rowKey) === r
|
|
40
|
+
), t = m(r) || n === -1 || n === i.value?.length - 1 ? void 0 : n + 1;
|
|
41
|
+
m(t) ? i.value.push(o) : (v.value = i.value.map(
|
|
42
|
+
(s, l) => l < t ? null : c(s, l, u.rowKey)
|
|
43
|
+
).filter(Boolean), i.value.splice(t, 0, o));
|
|
44
|
+
}
|
|
45
|
+
function j(e, r = "suffix") {
|
|
46
|
+
const f = w(i)?.length || 0, o = K(e) ? e : e.length;
|
|
47
|
+
if (R(u.maxLength) && f + o > u.maxLength || K(e) && h(u.rowKey))
|
|
48
|
+
return;
|
|
49
|
+
const n = K(e) ? new Array(e).fill(0).map(() => ({ [u.rowKey]: x() })) : G(e);
|
|
32
50
|
if (!i.value) {
|
|
33
51
|
i.value = [...n];
|
|
34
52
|
return;
|
|
35
53
|
}
|
|
36
|
-
|
|
37
|
-
(
|
|
54
|
+
r === "suffix" ? i.value.push(...n) : (v.value = i.value.map(
|
|
55
|
+
(t, s) => c(t, s, u.rowKey)
|
|
38
56
|
), i.value.unshift(...n));
|
|
39
57
|
}
|
|
40
|
-
function
|
|
41
|
-
const
|
|
42
|
-
(n) => !
|
|
43
|
-
),
|
|
44
|
-
(n) =>
|
|
58
|
+
function A(e) {
|
|
59
|
+
const r = F(e) ? e : [e], f = i.value.filter(
|
|
60
|
+
(n) => !r.includes(n)
|
|
61
|
+
), o = i.value.findIndex(
|
|
62
|
+
(n) => r.includes(n)
|
|
45
63
|
);
|
|
46
|
-
|
|
47
|
-
(n,
|
|
48
|
-
).filter(Boolean),
|
|
64
|
+
v.value = i.value.map(
|
|
65
|
+
(n, t) => t <= o ? null : c(n, t, u.rowKey)
|
|
66
|
+
).filter(Boolean), d?.(f);
|
|
49
67
|
}
|
|
50
|
-
function c(e,
|
|
51
|
-
if (
|
|
52
|
-
return
|
|
68
|
+
function c(e, r, f) {
|
|
69
|
+
if (f)
|
|
70
|
+
return N(f) ? e[f] : f(e, r);
|
|
53
71
|
}
|
|
54
|
-
function
|
|
55
|
-
const
|
|
56
|
-
if (
|
|
72
|
+
function O(e) {
|
|
73
|
+
const r = new Set(F(e) ? e : [e]);
|
|
74
|
+
if (r.size === 0)
|
|
57
75
|
return;
|
|
58
|
-
const
|
|
59
|
-
(n,
|
|
60
|
-
),
|
|
61
|
-
(n,
|
|
76
|
+
const f = i.value.filter(
|
|
77
|
+
(n, t) => !r.has(c(n, t, u.rowKey))
|
|
78
|
+
), o = i.value.findIndex(
|
|
79
|
+
(n, t) => r.has(c(n, t, u.rowKey))
|
|
62
80
|
);
|
|
63
|
-
|
|
64
|
-
(n,
|
|
65
|
-
).filter(Boolean),
|
|
81
|
+
v.value = i.value.map(
|
|
82
|
+
(n, t) => t <= o ? null : c(n, t, u.rowKey)
|
|
83
|
+
).filter(Boolean), d?.(f);
|
|
66
84
|
}
|
|
67
|
-
function
|
|
68
|
-
return
|
|
85
|
+
function k(e) {
|
|
86
|
+
return I(
|
|
69
87
|
!u.supressForceRowUpdate,
|
|
70
88
|
"usage",
|
|
71
89
|
'Avoid using getRowData/setRowData methods while suppressForceRowUpdate is enabled."'
|
|
72
90
|
), w(i)?.[e];
|
|
73
91
|
}
|
|
74
|
-
function
|
|
92
|
+
function _(e) {
|
|
75
93
|
return i.value?.find(
|
|
76
|
-
(
|
|
94
|
+
(r, f) => c(r, f, u.rowKey) === e
|
|
77
95
|
);
|
|
78
96
|
}
|
|
79
|
-
function
|
|
97
|
+
function E() {
|
|
80
98
|
return w(i);
|
|
81
99
|
}
|
|
82
|
-
function
|
|
83
|
-
|
|
100
|
+
function S(e, r, f = !0) {
|
|
101
|
+
I(
|
|
84
102
|
!u.supressForceRowUpdate,
|
|
85
103
|
"usage",
|
|
86
104
|
'Avoid using getRowData/setRowData methods while suppressForceRowUpdate is enabled."'
|
|
87
|
-
),
|
|
105
|
+
), B.value?.setFieldValue?.(
|
|
88
106
|
u.name,
|
|
89
107
|
void 0,
|
|
90
108
|
!0,
|
|
91
|
-
(
|
|
92
|
-
const
|
|
93
|
-
(
|
|
109
|
+
(o, n) => {
|
|
110
|
+
const t = i.value.findIndex(
|
|
111
|
+
(l, g) => e === g
|
|
94
112
|
);
|
|
95
|
-
if (!~
|
|
113
|
+
if (!~t)
|
|
96
114
|
return;
|
|
97
115
|
const s = c(
|
|
98
|
-
i.value[
|
|
99
|
-
|
|
116
|
+
i.value[t],
|
|
117
|
+
t,
|
|
100
118
|
u.rowKey
|
|
101
119
|
);
|
|
102
|
-
if (s && !(!
|
|
103
|
-
if (!
|
|
104
|
-
const
|
|
105
|
-
for (const
|
|
106
|
-
|
|
120
|
+
if (s && !(!o[n] || !o[n][s])) {
|
|
121
|
+
if (!f) {
|
|
122
|
+
const l = Object.keys(o[n][s]);
|
|
123
|
+
for (const g of l)
|
|
124
|
+
g !== u.rowKey && delete o[n][s][g];
|
|
107
125
|
}
|
|
108
|
-
Object.assign(
|
|
126
|
+
Object.assign(o[n][s], { ...r });
|
|
109
127
|
}
|
|
110
128
|
}
|
|
111
129
|
);
|
|
112
130
|
}
|
|
113
|
-
function
|
|
114
|
-
|
|
131
|
+
function T(e, r, f = !0) {
|
|
132
|
+
B.value?.setFieldValue?.(
|
|
115
133
|
u.name,
|
|
116
134
|
void 0,
|
|
117
135
|
!0,
|
|
118
|
-
(
|
|
119
|
-
if (!(!
|
|
120
|
-
if (!
|
|
121
|
-
const
|
|
122
|
-
for (const s of
|
|
123
|
-
s !== u.rowKey && delete
|
|
136
|
+
(o, n) => {
|
|
137
|
+
if (!(!o[n] || !o[n][e])) {
|
|
138
|
+
if (!f) {
|
|
139
|
+
const t = Object.keys(o[n][e]);
|
|
140
|
+
for (const s of t)
|
|
141
|
+
s !== u.rowKey && delete o[n][s][s];
|
|
124
142
|
}
|
|
125
|
-
Object.assign(
|
|
143
|
+
Object.assign(o[n][e], { ...r });
|
|
126
144
|
}
|
|
127
145
|
}
|
|
128
146
|
);
|
|
129
147
|
}
|
|
130
|
-
function
|
|
131
|
-
|
|
148
|
+
function z() {
|
|
149
|
+
d?.([]);
|
|
132
150
|
}
|
|
133
151
|
return {
|
|
134
|
-
add:
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
152
|
+
add: L,
|
|
153
|
+
addByKey: U,
|
|
154
|
+
addMultiple: j,
|
|
155
|
+
remove: A,
|
|
156
|
+
removeByKey: O,
|
|
157
|
+
getRowData: k,
|
|
158
|
+
getRowsData: E,
|
|
159
|
+
setRowDataByKey: T,
|
|
160
|
+
setRowData: S,
|
|
161
|
+
clear: z,
|
|
162
|
+
refreshRowIds: v,
|
|
163
|
+
getRowDataByKey: _
|
|
145
164
|
};
|
|
146
165
|
};
|
|
147
166
|
export {
|
|
148
|
-
|
|
167
|
+
Y as useEditableApi
|
|
149
168
|
};
|
|
@@ -4,6 +4,7 @@ import { ApFormInternalInstance } from '../../ap-form';
|
|
|
4
4
|
import { EditableAgGridProps } from '../editable/interface';
|
|
5
5
|
export declare const useEditableFormItemApi: <RecordType>(props: EditableAgGridProps<RecordType>, formApi: ApFormInternalInstance | undefined, tableData: Ref<RecordType[]>, shadowName: string) => {
|
|
6
6
|
add: (defaultValue?: Partial<RecordType>, insertIndex?: number) => void;
|
|
7
|
+
addByKey: (defaultValue?: Partial<RecordType>, key?: number) => void;
|
|
7
8
|
addMultiple: (list: number | Partial<RecordType>[], insetIn?: "prefix" | "suffix") => void;
|
|
8
9
|
remove: (data: RecordType | RecordType[]) => void;
|
|
9
10
|
removeByKey: (key: Key | Key[]) => void;
|