@aplus-frontend/ui 7.10.5 → 7.11.0
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 +93 -91
- package/es/src/ag-grid/editable/form-item.vue.mjs +75 -63
- package/es/src/ag-grid/editable/index.vue.mjs +80 -72
- package/es/src/ag-grid/editable/interface.d.ts +2 -1
- package/es/src/ag-grid/editable/utils.d.ts +7 -0
- package/es/src/ag-grid/editable/utils.mjs +32 -17
- package/es/src/ap-form/ap-form.vue2.mjs +144 -153
- package/es/src/ap-form/utils/transform.d.ts +6 -0
- package/es/src/ap-form/utils/transform.mjs +30 -0
- package/es/src/ap-pro-card/components/card/index.vue.d.ts +1 -1
- package/es/src/business/ap-appendix/ap-appendix.vue2.mjs +147 -110
- package/es/src/business/ap-appendix/interface.d.ts +4 -0
- package/es/src/business/ap-appendix/style/index.mjs +56 -34
- package/es/src/business/ap-attachment/ApAttachment.mjs +112 -89
- package/es/src/business/ap-attachment/style/index.mjs +21 -7
- package/es/src/business/ap-file-preview/ap-file-preview.vue.d.ts +4 -0
- package/es/src/business/ap-file-preview/ap-file-preview.vue.mjs +4 -0
- package/es/src/business/ap-file-preview/ap-file-preview.vue2.mjs +103 -0
- package/es/src/business/ap-file-preview/components/error-result/index.vue.d.ts +6 -0
- package/es/src/business/ap-file-preview/components/error-result/index.vue.mjs +4 -0
- package/es/src/business/ap-file-preview/components/error-result/index.vue2.mjs +40 -0
- package/es/src/business/ap-file-preview/icons/not-exist-icon.vue.d.ts +3 -0
- package/es/src/business/ap-file-preview/icons/not-exist-icon.vue.mjs +20 -0
- package/es/src/business/ap-file-preview/icons/not-preview-icon.vue.d.ts +3 -0
- package/es/src/business/ap-file-preview/icons/not-preview-icon.vue.mjs +20 -0
- package/es/src/business/ap-file-preview/index.d.ts +7 -0
- package/es/src/business/ap-file-preview/index.mjs +8 -0
- package/es/src/business/ap-file-preview/interface.d.ts +43 -0
- package/es/src/business/ap-file-preview/style/index.d.ts +5 -0
- package/es/src/business/ap-file-preview/style/index.mjs +46 -0
- package/es/src/business/ap-file-preview/utils/create-file-preview-modal.d.ts +2 -0
- package/es/src/business/ap-file-preview/utils/create-file-preview-modal.mjs +18 -0
- package/es/src/business/ap-file-preview/utils/default-parser-plugin.d.ts +4 -0
- package/es/src/business/ap-file-preview/utils/default-parser-plugin.mjs +48 -0
- package/es/src/business/ap-image/ApImage.vue2.mjs +16 -16
- package/es/src/business/ap-upload/apUpload.vue.d.ts +1 -1
- package/es/src/business/ap-upload/apUploadTypes.d.ts +2 -2
- package/es/src/business/ap-upload/components/MultipleFile.vue2.mjs +94 -82
- package/es/src/business/ap-upload/style/multiple-file.mjs +6 -3
- package/es/src/business/index.d.ts +1 -0
- package/es/src/business/index.mjs +16 -14
- package/es/src/config-provider/config-provider-props.d.ts +6 -0
- package/es/src/config-provider/config-provider-props.mjs +6 -2
- package/es/src/config-provider/config-provider.d.ts +17 -1
- package/es/src/config-provider/config-provider.mjs +24 -23
- package/es/src/config-provider/hooks/use-global-config.d.ts +7 -0
- package/es/src/config-provider/index.d.ts +31 -3
- package/es/src/index.mjs +74 -72
- package/es/src/locale/lang/en.mjs +5 -0
- package/es/src/locale/lang/zh-cn.mjs +5 -0
- 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 +2 -1
- package/lib/src/ag-grid/editable/utils.d.ts +7 -0
- package/lib/src/ag-grid/editable/utils.js +1 -1
- package/lib/src/ap-form/ap-form.vue2.js +1 -1
- package/lib/src/ap-form/utils/transform.d.ts +6 -0
- package/lib/src/ap-form/utils/transform.js +1 -0
- package/lib/src/ap-pro-card/components/card/index.vue.d.ts +1 -1
- package/lib/src/business/ap-appendix/ap-appendix.vue2.js +1 -1
- package/lib/src/business/ap-appendix/interface.d.ts +4 -0
- package/lib/src/business/ap-appendix/style/index.js +1 -1
- package/lib/src/business/ap-attachment/ApAttachment.js +1 -1
- package/lib/src/business/ap-attachment/style/index.js +1 -1
- package/lib/src/business/ap-file-preview/ap-file-preview.vue.d.ts +4 -0
- package/lib/src/business/ap-file-preview/ap-file-preview.vue.js +1 -0
- package/lib/src/business/ap-file-preview/ap-file-preview.vue2.js +1 -0
- package/lib/src/business/ap-file-preview/components/error-result/index.vue.d.ts +6 -0
- package/lib/src/business/ap-file-preview/components/error-result/index.vue.js +1 -0
- package/lib/src/business/ap-file-preview/components/error-result/index.vue2.js +1 -0
- package/lib/src/business/ap-file-preview/icons/not-exist-icon.vue.d.ts +3 -0
- package/lib/src/business/ap-file-preview/icons/not-exist-icon.vue.js +1 -0
- package/lib/src/business/ap-file-preview/icons/not-preview-icon.vue.d.ts +3 -0
- package/lib/src/business/ap-file-preview/icons/not-preview-icon.vue.js +1 -0
- package/lib/src/business/ap-file-preview/index.d.ts +7 -0
- package/lib/src/business/ap-file-preview/index.js +1 -0
- package/lib/src/business/ap-file-preview/interface.d.ts +43 -0
- package/lib/src/business/ap-file-preview/style/index.d.ts +5 -0
- package/lib/src/business/ap-file-preview/style/index.js +1 -0
- package/lib/src/business/ap-file-preview/utils/create-file-preview-modal.d.ts +2 -0
- package/lib/src/business/ap-file-preview/utils/create-file-preview-modal.js +1 -0
- package/lib/src/business/ap-file-preview/utils/default-parser-plugin.d.ts +4 -0
- package/lib/src/business/ap-file-preview/utils/default-parser-plugin.js +1 -0
- package/lib/src/business/ap-image/ApImage.vue2.js +1 -1
- package/lib/src/business/ap-upload/apUpload.vue.d.ts +1 -1
- package/lib/src/business/ap-upload/apUploadTypes.d.ts +2 -2
- package/lib/src/business/ap-upload/components/MultipleFile.vue2.js +1 -1
- package/lib/src/business/ap-upload/style/multiple-file.js +1 -1
- package/lib/src/business/index.d.ts +1 -0
- package/lib/src/business/index.js +1 -1
- package/lib/src/config-provider/config-provider-props.d.ts +6 -0
- package/lib/src/config-provider/config-provider-props.js +1 -1
- package/lib/src/config-provider/config-provider.d.ts +17 -1
- package/lib/src/config-provider/config-provider.js +1 -1
- package/lib/src/config-provider/hooks/use-global-config.d.ts +7 -0
- package/lib/src/config-provider/index.d.ts +31 -3
- package/lib/src/index.js +1 -1
- package/lib/src/locale/lang/en.js +1 -1
- package/lib/src/locale/lang/zh-cn.js +1 -1
- package/lib/src/version.d.ts +1 -1
- package/lib/src/version.js +1 -1
- package/package.json +1 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { isEqual as
|
|
3
|
-
import { ApForm as
|
|
1
|
+
import { defineComponent as M, useSlots as $, ref as v, watch as q, unref as l, createBlock as J, openBlock as Q, withCtx as m, createVNode as R, mergeProps as X, createSlots as Y, renderList as Z, renderSlot as ee, normalizeProps as oe, guardReactiveProps as ae } from "vue";
|
|
2
|
+
import { isEqual as te, isArray as b, omit as ne } from "lodash-unified";
|
|
3
|
+
import { ApForm as c } 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 le } from "../hooks/use-editable-api.mjs";
|
|
7
|
+
import { useGetEditableColumns as re } from "../hooks/use-editable-columns.mjs";
|
|
8
8
|
import "../index.vue2.mjs";
|
|
9
|
-
import
|
|
10
|
-
import { arrayToObject as
|
|
11
|
-
import { useNamespace as
|
|
12
|
-
import { useControllableValue as
|
|
13
|
-
import { useGlobalConfig as
|
|
14
|
-
import
|
|
15
|
-
const Fe = /* @__PURE__ */
|
|
9
|
+
import se from "../style/editable.mjs";
|
|
10
|
+
import { arrayToObject as f, getRowKey as ie } from "./utils.mjs";
|
|
11
|
+
import { useNamespace as de } from "../../config-provider/hooks/use-namespace.mjs";
|
|
12
|
+
import { useControllableValue as ue } from "../../hooks/useControllableValue.mjs";
|
|
13
|
+
import { useGlobalConfig as pe } from "../../config-provider/hooks/use-global-config.mjs";
|
|
14
|
+
import me from "../index.vue.mjs";
|
|
15
|
+
const Fe = /* @__PURE__ */ M({
|
|
16
16
|
name: "EditableGrid",
|
|
17
17
|
__name: "index",
|
|
18
18
|
props: {
|
|
@@ -135,109 +135,117 @@ const Fe = /* @__PURE__ */ $({
|
|
|
135
135
|
expose: x,
|
|
136
136
|
emit: B
|
|
137
137
|
}) {
|
|
138
|
-
const S =
|
|
138
|
+
const S = $(), a = C, {
|
|
139
139
|
b: T
|
|
140
|
-
} =
|
|
141
|
-
value:
|
|
142
|
-
updateValue:
|
|
143
|
-
} =
|
|
144
|
-
|
|
145
|
-
const
|
|
146
|
-
|
|
140
|
+
} = de("editable-aggrid"), F = se("editable-aggrid"), _ = B, i = v(), {
|
|
141
|
+
value: s,
|
|
142
|
+
updateValue: y
|
|
143
|
+
} = ue(a, _), r = v(), E = c.useWatch(a.name, r);
|
|
144
|
+
q(s, (e) => {
|
|
145
|
+
const o = f(e, a.rowKey);
|
|
146
|
+
te(o, l(E)) || r.value?.setFieldValue(a.name, o);
|
|
147
147
|
}, {
|
|
148
148
|
deep: !0
|
|
149
149
|
});
|
|
150
|
-
const K =
|
|
151
|
-
add:
|
|
152
|
-
addMultiple:
|
|
153
|
-
remove:
|
|
154
|
-
removeByKey:
|
|
155
|
-
getRowData:
|
|
156
|
-
getRowsData:
|
|
150
|
+
const K = pe("valueTypeMap"), k = re(a, K), {
|
|
151
|
+
add: A,
|
|
152
|
+
addMultiple: N,
|
|
153
|
+
remove: j,
|
|
154
|
+
removeByKey: I,
|
|
155
|
+
getRowData: V,
|
|
156
|
+
getRowsData: D,
|
|
157
157
|
setRowData: H,
|
|
158
158
|
clear: O,
|
|
159
|
-
refreshRowIds:
|
|
160
|
-
} =
|
|
159
|
+
refreshRowIds: d
|
|
160
|
+
} = le(a, r, s, y);
|
|
161
161
|
function z() {
|
|
162
|
-
const e =
|
|
163
|
-
if (!
|
|
162
|
+
const e = i.value?._internalGridApi;
|
|
163
|
+
if (!d.value?.length || !e)
|
|
164
164
|
return;
|
|
165
|
-
const
|
|
165
|
+
const o = d.value.map((t) => e.getRowNode(t)).filter((t) => !!t);
|
|
166
166
|
e.refreshCells({
|
|
167
|
-
rowNodes:
|
|
167
|
+
rowNodes: o,
|
|
168
168
|
force: !0
|
|
169
|
-
}),
|
|
169
|
+
}), d.value = [];
|
|
170
170
|
}
|
|
171
171
|
function L() {
|
|
172
|
-
|
|
172
|
+
r.value?.resetFields();
|
|
173
173
|
}
|
|
174
|
-
function
|
|
175
|
-
return e ? (
|
|
174
|
+
function w(e) {
|
|
175
|
+
return e ? (b(e) ? e : [e]).map((t) => b(t) ? [a.name, ...t] : [a.name, t]) : void 0;
|
|
176
176
|
}
|
|
177
|
-
|
|
178
|
-
const s = (await l.value?.validateFields(P(e), a))?.[o.name];
|
|
177
|
+
function g(e) {
|
|
179
178
|
try {
|
|
180
|
-
const
|
|
181
|
-
return
|
|
179
|
+
const o = Object.keys(e), t = s.value.map((n) => ie(n, void 0, a.rowKey));
|
|
180
|
+
return o.sort((n, u) => t.findIndex((p) => String(p) === n) - t.findIndex((p) => String(p) === u)), o.map((n) => e[n]);
|
|
182
181
|
} catch {
|
|
183
|
-
return
|
|
182
|
+
return e;
|
|
184
183
|
}
|
|
185
184
|
}
|
|
185
|
+
async function P(e, o) {
|
|
186
|
+
const n = (await r.value?.validateFields(w(e), o))?.[a.name];
|
|
187
|
+
return g(n);
|
|
188
|
+
}
|
|
189
|
+
async function G(e, o) {
|
|
190
|
+
const n = (await r.value?.validateFieldsReturnTransformed(w(e), o))?.[a.name];
|
|
191
|
+
return g(n);
|
|
192
|
+
}
|
|
186
193
|
function U(e) {
|
|
187
|
-
|
|
188
|
-
const
|
|
189
|
-
|
|
194
|
+
y(e);
|
|
195
|
+
const o = f(e, a.rowKey);
|
|
196
|
+
r.value?.setFieldValue(a.name, o);
|
|
190
197
|
}
|
|
191
|
-
function
|
|
192
|
-
const t = e === "end" ?
|
|
193
|
-
|
|
198
|
+
function h(e, o) {
|
|
199
|
+
const t = e === "end" ? s.value.length - 1 : e;
|
|
200
|
+
i.value?.scrollToRow(t, o);
|
|
194
201
|
}
|
|
195
|
-
function W(e,
|
|
196
|
-
|
|
202
|
+
function W(e, o) {
|
|
203
|
+
i.value?.scrollToColumn(e, o);
|
|
197
204
|
}
|
|
198
205
|
return x({
|
|
199
206
|
resetFields: L,
|
|
200
|
-
validateFields:
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
+
validateFields: P,
|
|
208
|
+
validateFieldsReturnTransformed: G,
|
|
209
|
+
add: A,
|
|
210
|
+
addMultiple: N,
|
|
211
|
+
remove: j,
|
|
212
|
+
removeByKey: I,
|
|
213
|
+
getRowData: V,
|
|
214
|
+
getRowsData: D,
|
|
207
215
|
setRowData: H,
|
|
208
216
|
clear: O,
|
|
209
217
|
setTableData: U,
|
|
210
|
-
scrollTo:
|
|
211
|
-
scrollToRow:
|
|
218
|
+
scrollTo: h,
|
|
219
|
+
scrollToRow: h,
|
|
212
220
|
scrollToColumn: W
|
|
213
|
-
}), (e,
|
|
221
|
+
}), (e, o) => (Q(), J(l(c), {
|
|
214
222
|
ref_key: "formRef",
|
|
215
|
-
ref:
|
|
223
|
+
ref: r,
|
|
216
224
|
"initial-values": {
|
|
217
|
-
[
|
|
225
|
+
[a.name]: l(f)(l(s), a.rowKey)
|
|
218
226
|
},
|
|
219
227
|
style: {
|
|
220
228
|
height: "100%"
|
|
221
229
|
}
|
|
222
230
|
}, {
|
|
223
|
-
default:
|
|
231
|
+
default: m(() => [R(l(c).FormItem, {
|
|
224
232
|
name: e.name,
|
|
225
233
|
"no-style": ""
|
|
226
234
|
}, {
|
|
227
|
-
default:
|
|
235
|
+
default: m(() => [R(me, X(l(ne)(a, ["name", "value", "onUpdate:value", "maxLength", "onChange", "defaultValue"]), {
|
|
228
236
|
ref_key: "tableRef",
|
|
229
|
-
ref:
|
|
230
|
-
class: [
|
|
237
|
+
ref: i,
|
|
238
|
+
class: [l(T)(), l(F)],
|
|
231
239
|
size: "mini",
|
|
232
|
-
columns:
|
|
233
|
-
"data-source":
|
|
240
|
+
columns: l(k),
|
|
241
|
+
"data-source": l(s),
|
|
234
242
|
"search-form": !1,
|
|
235
243
|
onUpdate: z
|
|
236
|
-
}),
|
|
244
|
+
}), Y({
|
|
237
245
|
_: 2
|
|
238
|
-
}, [
|
|
239
|
-
name:
|
|
240
|
-
fn:
|
|
246
|
+
}, [Z(S, (t, n) => ({
|
|
247
|
+
name: n,
|
|
248
|
+
fn: m((u) => [ee(e.$slots, n, oe(ae(u || {})))])
|
|
241
249
|
}))]), 1040, ["class", "columns", "data-source"])]),
|
|
242
250
|
_: 3
|
|
243
251
|
}, 8, ["name"])]),
|
|
@@ -84,8 +84,9 @@ export type EditableAgGridExpose<RecordType = any, ModelType = RecordType[]> = O
|
|
|
84
84
|
scrollToRow: (index: number | 'end', position?: 'top' | 'bottom' | 'middle') => void;
|
|
85
85
|
scrollToColumn: (key: string, position?: 'auto' | 'start' | 'middle' | 'end') => void;
|
|
86
86
|
remove: (data: RecordType | RecordType[]) => void;
|
|
87
|
+
validateFieldsReturnTransformed: EditableTableExpose<ModelType, RecordType>['validateFields'];
|
|
87
88
|
};
|
|
88
|
-
export type EditableAgGridFormItemExpose<RecordType = any, ModelType = RecordType[]> = Omit<EditableAgGridExpose<RecordType, ModelType>, 'resetFields' | 'validateFields'>;
|
|
89
|
+
export type EditableAgGridFormItemExpose<RecordType = any, ModelType = RecordType[]> = Omit<EditableAgGridExpose<RecordType, ModelType>, 'resetFields' | 'validateFields' | 'validateFieldsReturnTransformed'>;
|
|
89
90
|
export type EditableAgGridFormItemProps<RecordType = any> = Omit<EditableAgGridProps<RecordType>, 'name' | 'value' | 'onUpdate:value'> & {
|
|
90
91
|
label?: string;
|
|
91
92
|
/**
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
import { ApFormItemTransformType } from '../../ap-form';
|
|
1
2
|
import { Recordable } from '../../type';
|
|
2
3
|
import { AgGridProps } from '../interface';
|
|
4
|
+
import { EditableAgGridColumnType } from './interface';
|
|
3
5
|
export declare function getRowKey(record: any, index: number | undefined, rowKey: AgGridProps['rowKey']): any;
|
|
4
6
|
export declare function arrayToObject(array: any[], rowKey: AgGridProps['rowKey']): Recordable;
|
|
5
7
|
export declare function updateArrItem(arr: any[], rowKey: AgGridProps['rowKey'], obj: Recordable): any[];
|
|
8
|
+
interface TransformFnMapType {
|
|
9
|
+
[key: string]: ApFormItemTransformType | TransformFnMapType;
|
|
10
|
+
}
|
|
11
|
+
export declare function getColumnTransformOptions(columns: EditableAgGridColumnType[]): TransformFnMapType;
|
|
12
|
+
export {};
|
|
@@ -1,23 +1,38 @@
|
|
|
1
|
-
import { isString as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { isString as u } from "lodash-unified";
|
|
2
|
+
import s from "../../ap-form/utils/set.mjs";
|
|
3
|
+
function i(o, t, r) {
|
|
4
|
+
if (r)
|
|
5
|
+
return u(r) ? o[r] : r(o, t);
|
|
5
6
|
}
|
|
6
|
-
function
|
|
7
|
-
const
|
|
8
|
-
return
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
}),
|
|
7
|
+
function m(o, t) {
|
|
8
|
+
const r = {};
|
|
9
|
+
return o.forEach((e, n) => {
|
|
10
|
+
const f = i(e, n, t);
|
|
11
|
+
r[f] = e;
|
|
12
|
+
}), r;
|
|
12
13
|
}
|
|
13
|
-
function
|
|
14
|
-
return
|
|
15
|
-
const
|
|
16
|
-
return
|
|
14
|
+
function p(o, t, r) {
|
|
15
|
+
return o.map((e, n) => {
|
|
16
|
+
const f = i(e, n, t);
|
|
17
|
+
return r[f] ?? e;
|
|
17
18
|
});
|
|
18
19
|
}
|
|
20
|
+
function d(o) {
|
|
21
|
+
let t = {};
|
|
22
|
+
function r(e) {
|
|
23
|
+
for (const n of e)
|
|
24
|
+
n.children?.length ? r(n.children) : n.fieldProps?.transform && (t = s(
|
|
25
|
+
t,
|
|
26
|
+
[n.dataIndex].flat(1),
|
|
27
|
+
n.fieldProps.transform,
|
|
28
|
+
!0
|
|
29
|
+
));
|
|
30
|
+
}
|
|
31
|
+
return r(o), t;
|
|
32
|
+
}
|
|
19
33
|
export {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
34
|
+
m as arrayToObject,
|
|
35
|
+
d as getColumnTransformOptions,
|
|
36
|
+
i as getRowKey,
|
|
37
|
+
p as updateArrItem
|
|
23
38
|
};
|