@aplus-frontend/ui 7.20.2 → 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-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-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,21 +1,21 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { isEqual as C, cloneDeep as
|
|
1
|
+
import { defineComponent as X, useSlots as Y, ref as y, watch as w, unref as l, createElementBlock as Z, openBlock as ee, Fragment as oe, createVNode as c, mergeProps as g, withCtx as h, createSlots as te, renderList as ae, renderSlot as ne, normalizeProps as le, guardReactiveProps as re } from "vue";
|
|
2
|
+
import { isEqual as C, cloneDeep as se, omit as ie } from "lodash-unified";
|
|
3
3
|
import { ApForm as b } from "../../ap-form/index.mjs";
|
|
4
|
-
import { useInjectForm as
|
|
4
|
+
import { useInjectForm as me } from "../../ap-form/context.mjs";
|
|
5
5
|
import { useWatch as R } from "../../ap-form/hooks/use-watch.mjs";
|
|
6
|
-
import { getModelValue as
|
|
7
|
-
import { transformValues as
|
|
6
|
+
import { getModelValue as ue } from "../../ap-form/utils/get.mjs";
|
|
7
|
+
import { transformValues as de } from "../../ap-form/utils/transform.mjs";
|
|
8
8
|
import "../../config-provider/index.mjs";
|
|
9
|
-
import { useGetEditableColumns as
|
|
10
|
-
import { useEditableFormItemApi as
|
|
9
|
+
import { useGetEditableColumns as pe } from "../hooks/use-editable-columns.mjs";
|
|
10
|
+
import { useEditableFormItemApi as ce } from "../hooks/use-editable-form-item-api.mjs";
|
|
11
11
|
import "../index.vue2.mjs";
|
|
12
|
-
import
|
|
13
|
-
import { getShadowName as
|
|
14
|
-
import { getColumnTransformOptions as we, arrayToObject as
|
|
15
|
-
import { useNamespace as
|
|
16
|
-
import { useGlobalConfig as
|
|
17
|
-
import
|
|
18
|
-
const
|
|
12
|
+
import fe from "../style/editable.mjs";
|
|
13
|
+
import { getShadowName as ye } from "../utils.mjs";
|
|
14
|
+
import { getColumnTransformOptions as we, arrayToObject as ge, getRowKey as he } from "./utils.mjs";
|
|
15
|
+
import { useNamespace as Ce } from "../../config-provider/hooks/use-namespace.mjs";
|
|
16
|
+
import { useGlobalConfig as be } from "../../config-provider/hooks/use-global-config.mjs";
|
|
17
|
+
import Re from "../index.vue.mjs";
|
|
18
|
+
const Oe = /* @__PURE__ */ X({
|
|
19
19
|
name: "EditableGrid",
|
|
20
20
|
__name: "form-item",
|
|
21
21
|
props: {
|
|
@@ -143,33 +143,33 @@ const ze = /* @__PURE__ */ Q({
|
|
|
143
143
|
name: {},
|
|
144
144
|
formItem: {}
|
|
145
145
|
},
|
|
146
|
-
setup(
|
|
147
|
-
expose:
|
|
146
|
+
setup(B, {
|
|
147
|
+
expose: v
|
|
148
148
|
}) {
|
|
149
|
-
const x =
|
|
149
|
+
const x = Y(), a = B, {
|
|
150
150
|
b: T
|
|
151
|
-
} =
|
|
151
|
+
} = Ce("editable-aggrid"), S = fe("editable-aggrid"), r = y(), {
|
|
152
152
|
internalInstance: s
|
|
153
|
-
} =
|
|
153
|
+
} = me();
|
|
154
154
|
function I(e) {
|
|
155
155
|
const o = we(a.columns || []);
|
|
156
156
|
if (!Object.keys(o).length || !e?.length)
|
|
157
157
|
return e;
|
|
158
158
|
let t = [];
|
|
159
159
|
for (const m of e)
|
|
160
|
-
t.push(
|
|
160
|
+
t.push(de(m, o));
|
|
161
161
|
return t;
|
|
162
162
|
}
|
|
163
|
-
const i =
|
|
163
|
+
const i = ye(a.name);
|
|
164
164
|
function F() {
|
|
165
|
-
return a.formItem?.initialValue ??
|
|
165
|
+
return a.formItem?.initialValue ?? ue(s?.getInitialValues() ?? {}, a.name) ?? [];
|
|
166
166
|
}
|
|
167
167
|
let V = F();
|
|
168
|
-
const n =
|
|
169
|
-
|
|
168
|
+
const n = y([]), E = R(a.name), D = R(i);
|
|
169
|
+
w(() => E.value, (e) => {
|
|
170
170
|
if (C(e, n.value))
|
|
171
171
|
return;
|
|
172
|
-
const o = e ??
|
|
172
|
+
const o = e ?? se(V);
|
|
173
173
|
n.value = [...o];
|
|
174
174
|
}, {
|
|
175
175
|
deep: !0,
|
|
@@ -177,8 +177,8 @@ const ze = /* @__PURE__ */ Q({
|
|
|
177
177
|
immediate: !0
|
|
178
178
|
});
|
|
179
179
|
let u;
|
|
180
|
-
|
|
181
|
-
const o =
|
|
180
|
+
w(n, (e) => {
|
|
181
|
+
const o = ge(e, a.rowKey);
|
|
182
182
|
C(o, l(D)) || (u = () => {
|
|
183
183
|
s?.setFieldValue(a.name, [...e]), s?.setFieldValue(i, o);
|
|
184
184
|
});
|
|
@@ -186,20 +186,21 @@ const ze = /* @__PURE__ */ Q({
|
|
|
186
186
|
deep: !0,
|
|
187
187
|
immediate: !0
|
|
188
188
|
});
|
|
189
|
-
const
|
|
190
|
-
add:
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
189
|
+
const K = be("valueTypeMap"), N = pe(a, K, i), {
|
|
190
|
+
add: A,
|
|
191
|
+
addByKey: j,
|
|
192
|
+
addMultiple: _,
|
|
193
|
+
remove: k,
|
|
194
|
+
removeByKey: z,
|
|
195
|
+
getRowData: O,
|
|
196
|
+
getRowsData: U,
|
|
197
|
+
getRowDataByKey: H,
|
|
198
|
+
setRowData: L,
|
|
199
|
+
setRowDataByKey: P,
|
|
200
|
+
clear: G,
|
|
200
201
|
refreshRowIds: d
|
|
201
|
-
} =
|
|
202
|
-
function
|
|
202
|
+
} = ce(a, s, n, i);
|
|
203
|
+
function M() {
|
|
203
204
|
if (a.onUpdate?.(), u && (u(), u = void 0), a.supressForceRowUpdate)
|
|
204
205
|
return;
|
|
205
206
|
const e = r.value?._internalGridApi;
|
|
@@ -211,51 +212,52 @@ const ze = /* @__PURE__ */ Q({
|
|
|
211
212
|
force: !0
|
|
212
213
|
}), d.value = [];
|
|
213
214
|
}
|
|
214
|
-
function
|
|
215
|
+
function W(e) {
|
|
215
216
|
n.value = [...e];
|
|
216
217
|
}
|
|
217
218
|
function f(e, o) {
|
|
218
219
|
const t = e === "end" ? n.value.length - 1 : e;
|
|
219
220
|
r.value?.scrollToRow(t, o);
|
|
220
221
|
}
|
|
221
|
-
function
|
|
222
|
+
function $(e, o) {
|
|
222
223
|
r.value?.scrollToColumn(e, o);
|
|
223
224
|
}
|
|
224
|
-
function
|
|
225
|
+
function q(e, o) {
|
|
225
226
|
const t = [i, String(e), o].flat();
|
|
226
227
|
return s?.validateFields([t]);
|
|
227
228
|
}
|
|
228
|
-
function
|
|
229
|
-
const t = l(n).map((m, p) => [i, String(
|
|
229
|
+
function J(e) {
|
|
230
|
+
const t = l(n).map((m, p) => [i, String(he(m, p, a.rowKey)), e].flat());
|
|
230
231
|
return s?.validateFields(t);
|
|
231
232
|
}
|
|
232
|
-
function
|
|
233
|
+
function Q(e, o = !0) {
|
|
233
234
|
const t = Array.isArray(e) ? e : [e];
|
|
234
235
|
r.value?._internalGridApi?.refreshCells({
|
|
235
236
|
columns: t,
|
|
236
237
|
force: o
|
|
237
238
|
});
|
|
238
239
|
}
|
|
239
|
-
return
|
|
240
|
-
add:
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
240
|
+
return v({
|
|
241
|
+
add: A,
|
|
242
|
+
addByKey: j,
|
|
243
|
+
addMultiple: _,
|
|
244
|
+
remove: k,
|
|
245
|
+
removeByKey: z,
|
|
246
|
+
getRowData: O,
|
|
247
|
+
getRowsData: U,
|
|
248
|
+
getRowDataByKey: H,
|
|
249
|
+
setRowData: L,
|
|
250
|
+
clear: G,
|
|
251
|
+
setTableData: W,
|
|
250
252
|
scrollTo: f,
|
|
251
253
|
scrollToRow: f,
|
|
252
|
-
scrollToColumn:
|
|
253
|
-
validateCell:
|
|
254
|
-
validateColumn:
|
|
255
|
-
setRowDataByKey:
|
|
254
|
+
scrollToColumn: $,
|
|
255
|
+
validateCell: q,
|
|
256
|
+
validateColumn: J,
|
|
257
|
+
setRowDataByKey: P,
|
|
256
258
|
table: r,
|
|
257
|
-
refreshColumns:
|
|
258
|
-
}), (e, o) => (
|
|
259
|
+
refreshColumns: Q
|
|
260
|
+
}), (e, o) => (ee(), Z(oe, null, [c(l(b).FormItem, {
|
|
259
261
|
hidden: "",
|
|
260
262
|
name: e.name,
|
|
261
263
|
"initial-value": e.formItem?.initialValue,
|
|
@@ -263,25 +265,25 @@ const ze = /* @__PURE__ */ Q({
|
|
|
263
265
|
}, null, 8, ["name", "initial-value"]), c(l(b).FormItem, g({
|
|
264
266
|
label: e.label
|
|
265
267
|
}, e.formItem), {
|
|
266
|
-
default: h(() => [c(
|
|
268
|
+
default: h(() => [c(Re, g(l(ie)(a, ["name", "maxLength", "onChange", "defaultValue", "formItem", "onUpdate"]), {
|
|
267
269
|
ref_key: "tableRef",
|
|
268
270
|
ref: r,
|
|
269
271
|
class: [l(T)(), l(S)],
|
|
270
272
|
size: "mini",
|
|
271
|
-
columns: l(
|
|
273
|
+
columns: l(N),
|
|
272
274
|
"data-source": n.value,
|
|
273
275
|
"search-form": !1,
|
|
274
|
-
onUpdate:
|
|
275
|
-
}),
|
|
276
|
+
onUpdate: M
|
|
277
|
+
}), te({
|
|
276
278
|
_: 2
|
|
277
|
-
}, [
|
|
279
|
+
}, [ae(x, (t, m) => ({
|
|
278
280
|
name: m,
|
|
279
|
-
fn: h((p) => [
|
|
281
|
+
fn: h((p) => [ne(e.$slots, m, le(re(p || {})))])
|
|
280
282
|
}))]), 1040, ["class", "columns", "data-source"])]),
|
|
281
283
|
_: 3
|
|
282
284
|
}, 16, ["label"])], 64));
|
|
283
285
|
}
|
|
284
286
|
});
|
|
285
287
|
export {
|
|
286
|
-
|
|
288
|
+
Oe as default
|
|
287
289
|
};
|
|
@@ -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;
|