@aplus-frontend/ui 7.19.0-beta.2 → 7.19.1
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 +87 -77
- package/es/src/ag-grid/editable/interface.d.ts +15 -1
- package/es/src/ag-grid/index.vue.mjs +119 -120
- package/es/src/ap-form/ap-form.vue2.mjs +63 -61
- package/es/src/ap-form/interface.d.ts +4 -0
- package/es/src/ap-table/components/setting/modal/index.vue.mjs +59 -59
- package/es/src/ap-table/hooks/use-table-template-storage.mjs +41 -40
- package/es/src/business/ap-upload/components/MultipleFile.vue2.mjs +128 -112
- 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/interface.d.ts +15 -1
- package/lib/src/ag-grid/index.vue.js +1 -1
- package/lib/src/ap-form/ap-form.vue2.js +1 -1
- package/lib/src/ap-form/interface.d.ts +4 -0
- package/lib/src/ap-table/components/setting/modal/index.vue.js +1 -1
- package/lib/src/ap-table/hooks/use-table-template-storage.js +1 -1
- package/lib/src/business/ap-upload/components/MultipleFile.vue2.js +1 -1
- package/lib/src/version.d.ts +1 -1
- package/lib/src/version.js +1 -1
- package/package.json +3 -3
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { cloneDeep as u, isEqual as
|
|
3
|
-
import { ApForm as
|
|
4
|
-
import { useInjectForm as
|
|
5
|
-
import { useWatch as
|
|
6
|
-
import { getModelValue as
|
|
7
|
-
import { transformValues as
|
|
1
|
+
import { defineComponent as G, useSlots as W, ref as y, onMounted as U, watch as $, unref as r, createElementBlock as q, openBlock as J, Fragment as Q, createVNode as f, mergeProps as h, withCtx as C, createSlots as X, renderList as Y, renderSlot as Z, normalizeProps as ee, guardReactiveProps as oe } from "vue";
|
|
2
|
+
import { cloneDeep as u, isEqual as te, omit as ae } from "lodash-unified";
|
|
3
|
+
import { ApForm as b } from "../../ap-form/index.mjs";
|
|
4
|
+
import { useInjectForm as ne } from "../../ap-form/context.mjs";
|
|
5
|
+
import { useWatch as le } from "../../ap-form/hooks/use-watch.mjs";
|
|
6
|
+
import { getModelValue as re } from "../../ap-form/utils/get.mjs";
|
|
7
|
+
import { transformValues as ie } 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 se } from "../hooks/use-editable-columns.mjs";
|
|
10
|
+
import { useEditableFormItemApi as me } from "../hooks/use-editable-form-item-api.mjs";
|
|
11
11
|
import "../index.vue2.mjs";
|
|
12
|
-
import
|
|
13
|
-
import { getShadowName as
|
|
14
|
-
import { getColumnTransformOptions as
|
|
15
|
-
import { useNamespace as
|
|
16
|
-
import { useGlobalConfig as
|
|
17
|
-
import
|
|
18
|
-
const
|
|
12
|
+
import ue from "../style/editable.mjs";
|
|
13
|
+
import { getShadowName as de } from "../utils.mjs";
|
|
14
|
+
import { getColumnTransformOptions as pe, arrayToObject as R, getRowKey as fe } from "./utils.mjs";
|
|
15
|
+
import { useNamespace as ce } from "../../config-provider/hooks/use-namespace.mjs";
|
|
16
|
+
import { useGlobalConfig as we } from "../../config-provider/hooks/use-global-config.mjs";
|
|
17
|
+
import ge from "../index.vue.mjs";
|
|
18
|
+
const Ke = /* @__PURE__ */ G({
|
|
19
19
|
name: "EditableGrid",
|
|
20
20
|
__name: "form-item",
|
|
21
21
|
props: {
|
|
@@ -138,112 +138,122 @@ const Ne = /* @__PURE__ */ L({
|
|
|
138
138
|
name: {},
|
|
139
139
|
formItem: {}
|
|
140
140
|
},
|
|
141
|
-
setup(
|
|
141
|
+
setup(v, {
|
|
142
142
|
expose: B
|
|
143
143
|
}) {
|
|
144
|
-
const
|
|
145
|
-
b:
|
|
146
|
-
} =
|
|
147
|
-
internalInstance:
|
|
148
|
-
} =
|
|
149
|
-
function
|
|
150
|
-
const
|
|
151
|
-
if (!Object.keys(
|
|
144
|
+
const x = W(), a = v, {
|
|
145
|
+
b: S
|
|
146
|
+
} = ce("editable-aggrid"), I = ue("editable-aggrid"), m = y(), {
|
|
147
|
+
internalInstance: n
|
|
148
|
+
} = ne();
|
|
149
|
+
function F(e) {
|
|
150
|
+
const o = pe(a.columns || []);
|
|
151
|
+
if (!Object.keys(o).length || !e?.length)
|
|
152
152
|
return e;
|
|
153
|
-
let
|
|
154
|
-
for (const
|
|
155
|
-
|
|
156
|
-
return
|
|
153
|
+
let t = [];
|
|
154
|
+
for (const s of e)
|
|
155
|
+
t.push(ie(s, o));
|
|
156
|
+
return t;
|
|
157
157
|
}
|
|
158
|
-
const i =
|
|
159
|
-
let
|
|
160
|
-
|
|
161
|
-
const e =
|
|
162
|
-
e && (
|
|
158
|
+
const i = de(a.name);
|
|
159
|
+
let c = [];
|
|
160
|
+
U(() => {
|
|
161
|
+
const e = a.formItem?.initialValue ?? re(n?.getInitialValues() ?? {}, a.name);
|
|
162
|
+
e && (n?.updateInitialModel(i, R(u(e), a.rowKey)), c = u(e), l.value || j(u(e), "suffix", !0));
|
|
163
163
|
});
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
|
|
164
|
+
const l = y([]), T = le(a.name);
|
|
165
|
+
$(() => T.value, (e) => {
|
|
166
|
+
te(e, l.value) || w(e ?? u(c));
|
|
167
167
|
}, {
|
|
168
168
|
deep: !0,
|
|
169
169
|
flush: "post",
|
|
170
170
|
immediate: !0
|
|
171
171
|
});
|
|
172
|
-
const E =
|
|
173
|
-
add:
|
|
174
|
-
addMultiple:
|
|
175
|
-
__addMultiple:
|
|
176
|
-
remove:
|
|
172
|
+
const E = we("valueTypeMap"), V = se(a, E, i), {
|
|
173
|
+
add: N,
|
|
174
|
+
addMultiple: _,
|
|
175
|
+
__addMultiple: j,
|
|
176
|
+
remove: K,
|
|
177
177
|
removeByKey: k,
|
|
178
178
|
getRowData: D,
|
|
179
179
|
getRowsData: O,
|
|
180
180
|
setRowData: z,
|
|
181
181
|
clear: H,
|
|
182
182
|
refreshRowIds: d
|
|
183
|
-
} =
|
|
184
|
-
function
|
|
185
|
-
const e =
|
|
183
|
+
} = me(a, n, l, i);
|
|
184
|
+
function L() {
|
|
185
|
+
const e = m.value?._internalGridApi;
|
|
186
186
|
if (!d.value?.length || !e)
|
|
187
187
|
return;
|
|
188
|
-
const
|
|
188
|
+
const o = d.value.map((t) => e.getRowNode(t)).filter((t) => !!t);
|
|
189
189
|
e.refreshCells({
|
|
190
|
-
rowNodes:
|
|
190
|
+
rowNodes: o,
|
|
191
191
|
force: !0
|
|
192
192
|
}), d.value = [];
|
|
193
193
|
}
|
|
194
|
-
function
|
|
195
|
-
|
|
196
|
-
const
|
|
197
|
-
|
|
194
|
+
function w(e) {
|
|
195
|
+
l.value = [...e];
|
|
196
|
+
const o = R(e, a.rowKey);
|
|
197
|
+
n?.setFieldValue(a.name, [...e]), n?.setFieldValue(i, o);
|
|
198
198
|
}
|
|
199
|
-
function
|
|
200
|
-
const
|
|
201
|
-
|
|
199
|
+
function g(e, o) {
|
|
200
|
+
const t = e === "end" ? l.value.length - 1 : e;
|
|
201
|
+
m.value?.scrollToRow(t, o);
|
|
202
202
|
}
|
|
203
|
-
function M(e,
|
|
204
|
-
|
|
203
|
+
function M(e, o) {
|
|
204
|
+
m.value?.scrollToColumn(e, o);
|
|
205
|
+
}
|
|
206
|
+
function P(e, o) {
|
|
207
|
+
const t = [i, String(e), o].flat();
|
|
208
|
+
return n?.validateFields([t]);
|
|
209
|
+
}
|
|
210
|
+
function A(e) {
|
|
211
|
+
const t = r(l).map((s, p) => [i, String(fe(s, p, a.rowKey)), e].flat());
|
|
212
|
+
return n?.validateFields(t);
|
|
205
213
|
}
|
|
206
214
|
return B({
|
|
207
|
-
add:
|
|
208
|
-
addMultiple:
|
|
209
|
-
remove:
|
|
215
|
+
add: N,
|
|
216
|
+
addMultiple: _,
|
|
217
|
+
remove: K,
|
|
210
218
|
removeByKey: k,
|
|
211
219
|
getRowData: D,
|
|
212
220
|
getRowsData: O,
|
|
213
221
|
setRowData: z,
|
|
214
222
|
clear: H,
|
|
215
|
-
setTableData:
|
|
216
|
-
scrollTo:
|
|
217
|
-
scrollToRow:
|
|
223
|
+
setTableData: w,
|
|
224
|
+
scrollTo: g,
|
|
225
|
+
scrollToRow: g,
|
|
218
226
|
scrollToColumn: M,
|
|
219
|
-
|
|
220
|
-
|
|
227
|
+
validateCell: P,
|
|
228
|
+
validateColumn: A,
|
|
229
|
+
table: m
|
|
230
|
+
}), (e, o) => (J(), q(Q, null, [f(r(b).FormItem, {
|
|
221
231
|
hidden: "",
|
|
222
232
|
name: e.name,
|
|
223
233
|
"initial-value": e.formItem?.initialValue,
|
|
224
|
-
transform:
|
|
225
|
-
}, null, 8, ["name", "initial-value"]),
|
|
234
|
+
transform: F
|
|
235
|
+
}, null, 8, ["name", "initial-value"]), f(r(b).FormItem, h({
|
|
226
236
|
label: e.label
|
|
227
237
|
}, e.formItem), {
|
|
228
|
-
default:
|
|
238
|
+
default: C(() => [f(ge, h(r(ae)(a, ["name", "maxLength", "onChange", "defaultValue", "formItem"]), {
|
|
229
239
|
ref_key: "tableRef",
|
|
230
|
-
ref:
|
|
231
|
-
class: [
|
|
240
|
+
ref: m,
|
|
241
|
+
class: [r(S)(), r(I)],
|
|
232
242
|
size: "mini",
|
|
233
|
-
columns:
|
|
234
|
-
"data-source":
|
|
243
|
+
columns: r(V),
|
|
244
|
+
"data-source": l.value,
|
|
235
245
|
"search-form": !1,
|
|
236
|
-
onUpdate:
|
|
237
|
-
}),
|
|
246
|
+
onUpdate: L
|
|
247
|
+
}), X({
|
|
238
248
|
_: 2
|
|
239
|
-
}, [
|
|
240
|
-
name:
|
|
241
|
-
fn:
|
|
249
|
+
}, [Y(x, (t, s) => ({
|
|
250
|
+
name: s,
|
|
251
|
+
fn: C((p) => [Z(e.$slots, s, ee(oe(p || {})))])
|
|
242
252
|
}))]), 1040, ["class", "columns", "data-source"])]),
|
|
243
253
|
_: 3
|
|
244
254
|
}, 16, ["label"])], 64));
|
|
245
255
|
}
|
|
246
256
|
});
|
|
247
257
|
export {
|
|
248
|
-
|
|
258
|
+
Ke as default
|
|
249
259
|
};
|
|
@@ -87,7 +87,21 @@ export type EditableAgGridExpose<RecordType = any, ModelType = RecordType[]> = O
|
|
|
87
87
|
validateFieldsReturnTransformed: EditableTableExpose<ModelType, RecordType>['validateFields'];
|
|
88
88
|
table: AgGridExpose;
|
|
89
89
|
};
|
|
90
|
-
export type EditableAgGridFormItemExpose<RecordType = any, ModelType = RecordType[]> = Omit<EditableAgGridExpose<RecordType, ModelType>, 'resetFields' | 'validateFields' | 'validateFieldsReturnTransformed'
|
|
90
|
+
export type EditableAgGridFormItemExpose<RecordType = any, ModelType = RecordType[]> = Omit<EditableAgGridExpose<RecordType, ModelType>, 'resetFields' | 'validateFields' | 'validateFieldsReturnTransformed'> & {
|
|
91
|
+
/**
|
|
92
|
+
* 校验单元格
|
|
93
|
+
* @param rowId 行唯一标识
|
|
94
|
+
* @param field 字段
|
|
95
|
+
* @returns
|
|
96
|
+
*/
|
|
97
|
+
validateCell: (rowId: any, field: NamePath) => any;
|
|
98
|
+
/**
|
|
99
|
+
* 校验列
|
|
100
|
+
* @param colKey 列唯一标识
|
|
101
|
+
* @returns
|
|
102
|
+
*/
|
|
103
|
+
validateColumn: (colKey: string | number) => any;
|
|
104
|
+
};
|
|
91
105
|
export type EditableAgGridFormItemProps<RecordType = any> = Omit<EditableAgGridProps<RecordType>, 'name' | 'value' | 'onUpdate:value'> & {
|
|
92
106
|
label?: string;
|
|
93
107
|
/**
|