@aplus-frontend/ui 6.33.0 → 6.35.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/src/ag-grid/components/tooltip/index.vue.d.ts +6 -0
- package/es/src/ag-grid/components/tooltip/index.vue.mjs +4 -0
- package/es/src/ag-grid/components/tooltip/index.vue2.mjs +29 -0
- package/es/src/ag-grid/hooks/use-columns-def.d.ts +1 -0
- package/es/src/ag-grid/hooks/use-columns-def.mjs +94 -87
- package/es/src/ag-grid/hooks/use-selection-col-def.mjs +28 -22
- package/es/src/ag-grid/index.vue.mjs +164 -161
- package/es/src/ag-grid/interface.d.ts +5 -1
- package/es/src/ap-download/ap-download.vue.mjs +31 -25
- package/es/src/ap-form/ap-form.vue.d.ts +2 -6
- package/es/src/ap-form/ap-form.vue2.mjs +71 -69
- package/es/src/ap-grid/editable/form-item.vue.mjs +74 -71
- package/es/src/ap-grid/editable/index.vue.mjs +94 -91
- package/es/src/ap-grid/index.vue.mjs +74 -69
- package/es/src/ap-pro-card/components/statistic/index.vue.d.ts +1 -1
- package/es/src/ap-table/ap-table.vue2.mjs +72 -69
- package/es/src/ap-tag/ap-tag-group.vue.mjs +33 -30
- package/es/src/ap-upload/components/SingleFile.vue2.mjs +103 -103
- package/es/src/business/ap-appendix/ap-appendix.vue2.mjs +21 -18
- package/es/src/business/ap-attachment/ApAttachment.mjs +16 -15
- package/es/src/business/ap-copy/ApCopy.mjs +5 -6
- package/es/src/business/ap-draggable-grid/ApDraggableGrid.vue2.mjs +176 -175
- package/es/src/business/ap-keep-alive/keeper/ap-view-keeper.mjs +4 -4
- package/es/src/business/ap-label/ApLabel.d.ts +1 -1
- package/es/src/business/ap-label/index.d.ts +3 -3
- package/es/src/business/hooks/usePageListApTable.mjs +10 -9
- package/es/src/editable-table/form-item.vue.mjs +75 -72
- package/es/src/editable-table/hooks/use-get-columns.mjs +35 -34
- package/es/src/editable-table/index.vue.mjs +68 -65
- package/es/src/utils/warning.d.ts +25 -0
- package/es/src/utils/warning.mjs +74 -0
- package/es/src/version.d.ts +1 -1
- package/es/src/version.mjs +1 -1
- package/lib/src/ag-grid/components/tooltip/index.vue.d.ts +6 -0
- package/lib/src/ag-grid/components/tooltip/index.vue.js +1 -0
- package/lib/src/ag-grid/components/tooltip/index.vue2.js +1 -0
- package/lib/src/ag-grid/hooks/use-columns-def.d.ts +1 -0
- package/lib/src/ag-grid/hooks/use-columns-def.js +1 -1
- package/lib/src/ag-grid/hooks/use-selection-col-def.js +1 -1
- package/lib/src/ag-grid/index.vue.js +1 -1
- package/lib/src/ag-grid/interface.d.ts +5 -1
- package/lib/src/ap-download/ap-download.vue.js +1 -1
- package/lib/src/ap-form/ap-form.vue.d.ts +2 -6
- package/lib/src/ap-form/ap-form.vue2.js +1 -1
- package/lib/src/ap-grid/editable/form-item.vue.js +1 -1
- package/lib/src/ap-grid/editable/index.vue.js +1 -1
- package/lib/src/ap-grid/index.vue.js +1 -1
- package/lib/src/ap-pro-card/components/statistic/index.vue.d.ts +1 -1
- package/lib/src/ap-table/ap-table.vue2.js +1 -1
- package/lib/src/ap-tag/ap-tag-group.vue.js +1 -1
- package/lib/src/ap-upload/components/SingleFile.vue2.js +1 -1
- package/lib/src/business/ap-appendix/ap-appendix.vue2.js +1 -1
- package/lib/src/business/ap-attachment/ApAttachment.js +1 -1
- package/lib/src/business/ap-copy/ApCopy.js +1 -1
- package/lib/src/business/ap-draggable-grid/ApDraggableGrid.vue2.js +1 -1
- package/lib/src/business/ap-keep-alive/keeper/ap-view-keeper.js +1 -1
- package/lib/src/business/ap-label/ApLabel.d.ts +1 -1
- package/lib/src/business/ap-label/index.d.ts +3 -3
- package/lib/src/business/hooks/usePageListApTable.js +1 -1
- package/lib/src/editable-table/form-item.vue.js +1 -1
- package/lib/src/editable-table/hooks/use-get-columns.js +1 -1
- package/lib/src/editable-table/index.vue.js +1 -1
- package/lib/src/utils/warning.d.ts +25 -0
- package/lib/src/utils/warning.js +1 -0
- package/lib/src/version.d.ts +1 -1
- package/lib/src/version.js +1 -1
- package/package.json +1 -1
- package/theme/ag-grid/index.css +5 -1
- package/theme/ag-grid/index.less +5 -1
- package/theme/index.css +5 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { defineComponent as F, ref as L, useSlots as S, computed as t, unref as
|
|
1
|
+
import { defineComponent as F, ref as L, useSlots as S, computed as t, unref as a, createBlock as x, openBlock as i, mergeProps as A, withCtx as j, createElementVNode as m, normalizeClass as I, createElementBlock as u, createCommentVNode as f, createVNode as M, renderSlot as T, toDisplayString as U } from "vue";
|
|
2
2
|
import { Button as V } from "@aplus-frontend/antdv";
|
|
3
3
|
import { LoadingOutlined as D } from "@ant-design/icons-vue";
|
|
4
4
|
import "../config-provider/index.mjs";
|
|
5
5
|
import { useOssInit as E } from "./hooks/index.mjs";
|
|
6
|
-
import { getFileInfo as
|
|
6
|
+
import { getFileInfo as g } from "./utils/getFileInfo.mjs";
|
|
7
7
|
import { useStyle as P } from "./hooks/useStyle.mjs";
|
|
8
8
|
import { useLocale as G } from "../config-provider/hooks/use-locale.mjs";
|
|
9
|
-
import { useGlobalConfig as
|
|
9
|
+
import { useGlobalConfig as r } from "../config-provider/hooks/use-global-config.mjs";
|
|
10
10
|
const R = {
|
|
11
11
|
key: 0,
|
|
12
12
|
class: "spin"
|
|
@@ -43,27 +43,33 @@ const R = {
|
|
|
43
43
|
getOssAccess: {}
|
|
44
44
|
},
|
|
45
45
|
emits: ["downloadCallback"],
|
|
46
|
-
setup(
|
|
47
|
-
const
|
|
46
|
+
setup(y, { emit: C }) {
|
|
47
|
+
const N = C, n = L(!1), { lang: b } = G(), v = S(), h = t(() => b.value === "zh-cn" ? "zh_CN" : "en_US"), w = r("uiMode"), e = y, l = r("apUpload"), c = r(
|
|
48
48
|
"downloadCenterTriggerConfig"
|
|
49
|
-
),
|
|
49
|
+
), d = t(() => e.disabled), _ = t(() => e.color ? e.color : w.value === "aplus" ? "#0070FF" : "#1890FF"), k = t(() => e.size), { getInnerWrapperClass: B } = P(_, k, d), z = t(() => e.getOssAccess || l.value?.getOssAccess), O = async () => {
|
|
50
50
|
if (!e.disabled) {
|
|
51
51
|
n.value = !0;
|
|
52
52
|
try {
|
|
53
|
-
if (
|
|
54
|
-
let
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
if (c.value?.trigger) {
|
|
54
|
+
let s = g(
|
|
55
|
+
e.needName ?? l?.value?.needName,
|
|
56
|
+
e.fileName
|
|
57
|
+
).map((p) => ({
|
|
58
|
+
objectName: p.path,
|
|
59
|
+
fileName: p.fileName
|
|
57
60
|
}));
|
|
58
|
-
await
|
|
61
|
+
await c.value?.trigger(s);
|
|
59
62
|
} else {
|
|
60
|
-
const
|
|
63
|
+
const s = await (await E(
|
|
61
64
|
z.value,
|
|
62
|
-
|
|
65
|
+
a(h)
|
|
63
66
|
)).downloadFile(
|
|
64
|
-
|
|
67
|
+
g(
|
|
68
|
+
e.needName ?? l?.value?.needName,
|
|
69
|
+
e.fileName
|
|
70
|
+
)
|
|
65
71
|
);
|
|
66
|
-
|
|
72
|
+
N("downloadCallback", s);
|
|
67
73
|
}
|
|
68
74
|
} catch (o) {
|
|
69
75
|
console.error(o);
|
|
@@ -72,23 +78,23 @@ const R = {
|
|
|
72
78
|
}
|
|
73
79
|
}
|
|
74
80
|
};
|
|
75
|
-
return (o,
|
|
81
|
+
return (o, s) => (i(), x(a(V), A(e, {
|
|
76
82
|
type: e.type,
|
|
77
83
|
size: e.size,
|
|
78
|
-
disabled:
|
|
84
|
+
disabled: d.value,
|
|
79
85
|
onClick: O
|
|
80
86
|
}), {
|
|
81
87
|
default: j(() => [
|
|
82
|
-
|
|
83
|
-
class: I(
|
|
88
|
+
m("div", {
|
|
89
|
+
class: I(a(B))
|
|
84
90
|
}, [
|
|
85
|
-
n.value ? (
|
|
86
|
-
M(
|
|
87
|
-
])) :
|
|
88
|
-
|
|
91
|
+
n.value ? (i(), u("span", R, [
|
|
92
|
+
M(a(D), { spin: !0 })
|
|
93
|
+
])) : f("", !0),
|
|
94
|
+
a(v).icon ? (i(), u("span", W, [
|
|
89
95
|
T(o.$slots, "icon")
|
|
90
|
-
])) :
|
|
91
|
-
|
|
96
|
+
])) : f("", !0),
|
|
97
|
+
m("span", $, U(o.text), 1)
|
|
92
98
|
], 2)
|
|
93
99
|
]),
|
|
94
100
|
_: 3
|
|
@@ -370,9 +370,7 @@ declare function __VLS_template(): {
|
|
|
370
370
|
default: string | number | ColSize;
|
|
371
371
|
};
|
|
372
372
|
xxl: {
|
|
373
|
-
type:
|
|
374
|
-
* 执行Watch回调
|
|
375
|
-
*/).PropType<string | number | ColSize>;
|
|
373
|
+
type: PropType<string | number | ColSize>;
|
|
376
374
|
default: string | number | ColSize;
|
|
377
375
|
};
|
|
378
376
|
prefixCls: StringConstructor;
|
|
@@ -1042,9 +1040,7 @@ declare const __VLS_component: DefineComponent<ApFormProps, {
|
|
|
1042
1040
|
default: string | number | ColSize;
|
|
1043
1041
|
};
|
|
1044
1042
|
xxl: {
|
|
1045
|
-
type:
|
|
1046
|
-
* 执行Watch回调
|
|
1047
|
-
*/).PropType<string | number | ColSize>;
|
|
1043
|
+
type: PropType<string | number | ColSize>;
|
|
1048
1044
|
default: string | number | ColSize;
|
|
1049
1045
|
};
|
|
1050
1046
|
prefixCls: StringConstructor;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Form as
|
|
3
|
-
import { useProvideForm as
|
|
4
|
-
import { isArray as f, cloneDeep as
|
|
5
|
-
import { useUrlSearchParams as
|
|
6
|
-
import { INTERNAL_FORM_INSTANCE_MARK as
|
|
7
|
-
import { getRouteType as
|
|
8
|
-
import
|
|
9
|
-
import { genParams as B, setToParams as
|
|
10
|
-
import { useInjectFormProvider as
|
|
11
|
-
import { getModelValue as
|
|
12
|
-
|
|
1
|
+
import { defineComponent as te, reactive as re, ref as O, unref as h, nextTick as oe, toRaw as P, watch as ne, onWatcherCleanup as ie, computed as le, createBlock as se, openBlock as ae, mergeProps as ue, withCtx as ce, renderSlot as fe } from "vue";
|
|
2
|
+
import { Form as de } from "@aplus-frontend/antdv";
|
|
3
|
+
import { useProvideForm as ge } from "./context.mjs";
|
|
4
|
+
import { isArray as f, cloneDeep as pe, isEqual as me, isFunction as M, isPlainObject as R, omit as he } from "lodash-unified";
|
|
5
|
+
import { useUrlSearchParams as Fe } from "@vueuse/core";
|
|
6
|
+
import { INTERNAL_FORM_INSTANCE_MARK as j } from "./constant.mjs";
|
|
7
|
+
import { getRouteType as ye, isDef as T } from "../utils/index.mjs";
|
|
8
|
+
import Te from "./utils/set.mjs";
|
|
9
|
+
import { genParams as B, setToParams as x } from "./utils/params.mjs";
|
|
10
|
+
import { useInjectFormProvider as Ve } from "./provider/context.mjs";
|
|
11
|
+
import { getModelValue as W } from "./utils/get.mjs";
|
|
12
|
+
import { useDevWarning as ve } from "../utils/warning.mjs";
|
|
13
|
+
const Oe = /* @__PURE__ */ te({
|
|
13
14
|
name: "ApForm",
|
|
14
15
|
__name: "ap-form",
|
|
15
16
|
props: {
|
|
@@ -58,11 +59,11 @@ const we = /* @__PURE__ */ z({
|
|
|
58
59
|
}
|
|
59
60
|
y();
|
|
60
61
|
}
|
|
61
|
-
const s =
|
|
62
|
+
const s = O(), v = Fe(ye()), F = Ve(), q = ve("ApForm"), C = O(
|
|
62
63
|
n.syncToUrl ? B(n.syncToUrl, v, "get") : {}
|
|
63
64
|
);
|
|
64
|
-
let d =
|
|
65
|
-
const l =
|
|
65
|
+
let d = pe(_()), g = {};
|
|
66
|
+
const l = re(_());
|
|
66
67
|
let p = [];
|
|
67
68
|
function _() {
|
|
68
69
|
const e = n.initialValues || {};
|
|
@@ -74,13 +75,13 @@ const we = /* @__PURE__ */ z({
|
|
|
74
75
|
...e
|
|
75
76
|
};
|
|
76
77
|
}
|
|
77
|
-
function
|
|
78
|
+
function D(e) {
|
|
78
79
|
const t = m(e, g);
|
|
79
|
-
F.triggerFormFinish(n.name, e), n.syncToUrl &&
|
|
80
|
+
F.triggerFormFinish(n.name, e), n.syncToUrl && x(v, B(n.syncToUrl, t, "set")), n.onFinish?.(t);
|
|
80
81
|
}
|
|
81
|
-
const
|
|
82
|
-
s.value?.resetFields(), await
|
|
83
|
-
Object.keys(l).forEach((e) => delete l[e]), Object.assign(l, d), y(), n.syncToUrl &&
|
|
82
|
+
const K = async () => {
|
|
83
|
+
s.value?.resetFields(), await oe(() => {
|
|
84
|
+
Object.keys(l).forEach((e) => delete l[e]), Object.assign(l, d), y(), n.syncToUrl && x(
|
|
84
85
|
v,
|
|
85
86
|
B(
|
|
86
87
|
n.syncToUrl,
|
|
@@ -89,20 +90,20 @@ const we = /* @__PURE__ */ z({
|
|
|
89
90
|
)
|
|
90
91
|
);
|
|
91
92
|
});
|
|
92
|
-
},
|
|
93
|
+
}, L = (e) => {
|
|
93
94
|
s.value?.clearValidate(e);
|
|
94
|
-
},
|
|
95
|
+
}, $ = (e, t) => s.value?.validateFields(e, t), k = async (e, t) => {
|
|
95
96
|
const r = await s.value?.validateFields(
|
|
96
97
|
e,
|
|
97
98
|
t
|
|
98
99
|
);
|
|
99
100
|
return m(r, g);
|
|
100
|
-
}, b = (e) => e === !0 ? P(l) : s.value?.getFieldsValue(e),
|
|
101
|
+
}, b = (e) => e === !0 ? P(l) : s.value?.getFieldsValue(e), G = (e) => {
|
|
101
102
|
const t = b(e);
|
|
102
103
|
return m(t, g);
|
|
103
|
-
},
|
|
104
|
+
}, H = (e, t) => s.value?.validate(e, t), J = (e, t = {}) => {
|
|
104
105
|
s.value?.scrollToField(e, t);
|
|
105
|
-
},
|
|
106
|
+
}, Q = (e) => {
|
|
106
107
|
Object.assign(l, e), y();
|
|
107
108
|
}, I = (e, t, r = !0, o) => {
|
|
108
109
|
V(e, t, r, o), y();
|
|
@@ -112,7 +113,7 @@ const we = /* @__PURE__ */ z({
|
|
|
112
113
|
p = p.filter((t) => t !== e);
|
|
113
114
|
};
|
|
114
115
|
}
|
|
115
|
-
function
|
|
116
|
+
function X(e, t) {
|
|
116
117
|
if (f(e)) {
|
|
117
118
|
let r = d;
|
|
118
119
|
for (let o = 0; o < e.length - 1; o++)
|
|
@@ -121,17 +122,17 @@ const we = /* @__PURE__ */ z({
|
|
|
121
122
|
} else
|
|
122
123
|
d[e] = t;
|
|
123
124
|
}
|
|
124
|
-
function
|
|
125
|
+
function Y(e, t) {
|
|
125
126
|
if (!T(e) || !T(t))
|
|
126
127
|
return;
|
|
127
|
-
const r =
|
|
128
|
-
if (
|
|
128
|
+
const r = W(d, t);
|
|
129
|
+
if (me(r, e))
|
|
129
130
|
return;
|
|
130
|
-
const o =
|
|
131
|
-
T(o) && n.syncToUrlPriority || (V(t, e, !1),
|
|
131
|
+
const o = W(h(C), t);
|
|
132
|
+
T(o) && n.syncToUrlPriority || (V(t, e, !1), X(t, e));
|
|
132
133
|
}
|
|
133
|
-
function
|
|
134
|
-
t && (g =
|
|
134
|
+
function Z(e, t) {
|
|
135
|
+
t && (g = Te(
|
|
135
136
|
g,
|
|
136
137
|
[e].flat(1),
|
|
137
138
|
t,
|
|
@@ -139,22 +140,23 @@ const we = /* @__PURE__ */ z({
|
|
|
139
140
|
));
|
|
140
141
|
}
|
|
141
142
|
function w({ initialValue: e, name: t, transform: r }) {
|
|
142
|
-
|
|
143
|
+
Y(e, t), Z(t, r);
|
|
143
144
|
}
|
|
144
|
-
function
|
|
145
|
+
function A() {
|
|
145
146
|
return d;
|
|
146
147
|
}
|
|
147
|
-
function
|
|
148
|
-
if (
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
148
|
+
function z(e) {
|
|
149
|
+
if (q(
|
|
150
|
+
e === j,
|
|
151
|
+
"usage",
|
|
152
|
+
"getInternalInstance should only used at internal"
|
|
153
|
+
), e === j)
|
|
154
|
+
return {
|
|
155
|
+
registerField: w,
|
|
156
|
+
registerWatch: U,
|
|
157
|
+
setFieldValue: I,
|
|
158
|
+
getInitialValues: A
|
|
159
|
+
};
|
|
158
160
|
}
|
|
159
161
|
function y() {
|
|
160
162
|
if (p.length) {
|
|
@@ -169,10 +171,10 @@ const we = /* @__PURE__ */ z({
|
|
|
169
171
|
return;
|
|
170
172
|
let r = f(e) ? [] : {};
|
|
171
173
|
return Object.keys(e).forEach((o) => {
|
|
172
|
-
const a = e[o], i = t?.[o], u = M(i) ? i : i?.transformer,
|
|
174
|
+
const a = e[o], i = t?.[o], u = M(i) ? i : i?.transformer, ee = M(i) ? !0 : i?.flat;
|
|
173
175
|
if (M(u)) {
|
|
174
176
|
const c = u(a);
|
|
175
|
-
|
|
177
|
+
ee ? f(c) && f(r) ? r = [...r, ...c] : R(c) && R(r) ? r = {
|
|
176
178
|
...r,
|
|
177
179
|
...c
|
|
178
180
|
} : r[o] = c : r[o] = c;
|
|
@@ -186,45 +188,45 @@ const we = /* @__PURE__ */ z({
|
|
|
186
188
|
r[o] = a;
|
|
187
189
|
}), r;
|
|
188
190
|
}
|
|
189
|
-
const
|
|
190
|
-
resetFields:
|
|
191
|
-
clearValidate:
|
|
192
|
-
validateFields:
|
|
191
|
+
const E = {
|
|
192
|
+
resetFields: K,
|
|
193
|
+
clearValidate: L,
|
|
194
|
+
validateFields: $,
|
|
193
195
|
getFieldsValue: b,
|
|
194
|
-
validate:
|
|
195
|
-
scrollToField:
|
|
196
|
-
setFieldsValue:
|
|
196
|
+
validate: H,
|
|
197
|
+
scrollToField: J,
|
|
198
|
+
setFieldsValue: Q,
|
|
197
199
|
setFieldValue: I,
|
|
198
200
|
registerWatch: U,
|
|
199
|
-
validateFieldsReturnTransformed:
|
|
200
|
-
getFieldsValueTransformed:
|
|
201
|
-
getInternalInstance:
|
|
201
|
+
validateFieldsReturnTransformed: k,
|
|
202
|
+
getFieldsValueTransformed: G,
|
|
203
|
+
getInternalInstance: z
|
|
202
204
|
};
|
|
203
|
-
return
|
|
205
|
+
return ne(
|
|
204
206
|
() => n.name,
|
|
205
207
|
(e) => {
|
|
206
|
-
e && (F.registerForm(e,
|
|
208
|
+
e && (F.registerForm(e, E), ie(() => {
|
|
207
209
|
F.unregisterForm(n.name);
|
|
208
210
|
}));
|
|
209
211
|
},
|
|
210
212
|
{
|
|
211
213
|
immediate: !0
|
|
212
214
|
}
|
|
213
|
-
),
|
|
214
|
-
model:
|
|
215
|
+
), ge({
|
|
216
|
+
model: le(() => l),
|
|
215
217
|
updateModel: V,
|
|
216
218
|
internalInstance: {
|
|
217
219
|
registerWatch: U,
|
|
218
220
|
registerField: w,
|
|
219
221
|
setFieldValue: I,
|
|
220
|
-
getInitialValues:
|
|
222
|
+
getInitialValues: A
|
|
221
223
|
}
|
|
222
|
-
}), S(
|
|
224
|
+
}), S(E), (e, t) => (ae(), se(h(de), ue(
|
|
223
225
|
{
|
|
224
226
|
ref_key: "formRef",
|
|
225
227
|
ref: s
|
|
226
228
|
},
|
|
227
|
-
h(
|
|
229
|
+
h(he)(n, [
|
|
228
230
|
"initialValues",
|
|
229
231
|
"onValuesChange",
|
|
230
232
|
"onFinish",
|
|
@@ -234,16 +236,16 @@ const we = /* @__PURE__ */ z({
|
|
|
234
236
|
{
|
|
235
237
|
model: l,
|
|
236
238
|
"data-form-name": e.name,
|
|
237
|
-
onFinish:
|
|
239
|
+
onFinish: D
|
|
238
240
|
}
|
|
239
241
|
), {
|
|
240
|
-
default:
|
|
241
|
-
|
|
242
|
+
default: ce(() => [
|
|
243
|
+
fe(e.$slots, "default")
|
|
242
244
|
]),
|
|
243
245
|
_: 3
|
|
244
246
|
}, 16, ["model", "data-form-name"]));
|
|
245
247
|
}
|
|
246
248
|
});
|
|
247
249
|
export {
|
|
248
|
-
|
|
250
|
+
Oe as default
|
|
249
251
|
};
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { defineComponent as O, useSlots as z, toRef as
|
|
2
|
-
import { ApForm as
|
|
1
|
+
import { defineComponent as O, useSlots as z, toRef as G, ref as c, unref as s, watch as K, nextTick as P, createBlock as A, openBlock as H, mergeProps as g, withCtx as h, createVNode as W, createSlots as U, renderList as $, renderSlot as q, normalizeProps as J, guardReactiveProps as Q } from "vue";
|
|
2
|
+
import { ApForm as y } from "../../ap-form/index.mjs";
|
|
3
3
|
import { isUndefined as X, isNumber as d, cloneDeep as Y, isArray as Z, omit as M } from "lodash-unified";
|
|
4
4
|
import "../../config-provider/index.mjs";
|
|
5
5
|
import { isDef as C } from "../../utils/index.mjs";
|
|
6
6
|
import { useGetEditableColumns as ee } from "../hooks/use-editable-columns.mjs";
|
|
7
7
|
import "../index.vue2.mjs";
|
|
8
8
|
import { useInjectForm as te } from "../../ap-form/context.mjs";
|
|
9
|
-
import { getModelValue as
|
|
10
|
-
import {
|
|
9
|
+
import { getModelValue as ae } from "../../ap-form/utils/get.mjs";
|
|
10
|
+
import { useDevWarning as oe } from "../../utils/warning.mjs";
|
|
11
|
+
import { useNamespace as ne } from "../../config-provider/hooks/use-namespace.mjs";
|
|
11
12
|
import { useGlobalConfig as le } from "../../config-provider/hooks/use-global-config.mjs";
|
|
12
|
-
import
|
|
13
|
-
const
|
|
13
|
+
import re from "../index.vue.mjs";
|
|
14
|
+
const xe = /* @__PURE__ */ O({
|
|
14
15
|
name: "EditableGridFormItem",
|
|
15
16
|
__name: "form-item",
|
|
16
17
|
props: {
|
|
@@ -166,120 +167,122 @@ const Ce = /* @__PURE__ */ O({
|
|
|
166
167
|
setup(w, {
|
|
167
168
|
expose: b
|
|
168
169
|
}) {
|
|
169
|
-
const x = z(),
|
|
170
|
+
const x = z(), o = w;
|
|
171
|
+
oe("EditableGridFormItem")(!1, "breaking", "EditableGridFormItem has been EOL, Please use EditableAgGridFormItem(https://aplus.aplnk.com/aplus-ui/components/ag-grid/editable/) instead.");
|
|
172
|
+
const {
|
|
170
173
|
b: R
|
|
171
|
-
} =
|
|
172
|
-
internalInstance:
|
|
174
|
+
} = ne("editable-grid"), {
|
|
175
|
+
internalInstance: i,
|
|
173
176
|
model: B
|
|
174
|
-
} = te(), m =
|
|
175
|
-
|
|
176
|
-
await P(),
|
|
177
|
+
} = te(), m = G(o.name), f = c(ae(s(B), m.value) || []), F = y.useWatch(m);
|
|
178
|
+
K(() => F.value, async (e) => {
|
|
179
|
+
await P(), f.value = e, o.onChange?.(e);
|
|
177
180
|
}, {
|
|
178
181
|
deep: !0
|
|
179
182
|
});
|
|
180
|
-
const p = c(),
|
|
181
|
-
function
|
|
182
|
-
const r = s(
|
|
183
|
-
if (C(
|
|
183
|
+
const p = c(), S = le("valueTypeMap"), v = ee(o, S);
|
|
184
|
+
function I(e, n) {
|
|
185
|
+
const r = s(f)?.length || 0;
|
|
186
|
+
if (C(o.maxLength) && r >= o.maxLength)
|
|
184
187
|
return;
|
|
185
188
|
const t = {
|
|
186
189
|
...e || {}
|
|
187
190
|
};
|
|
188
|
-
|
|
189
|
-
if (!
|
|
190
|
-
|
|
191
|
+
i?.setFieldValue(o.name, t, !0, (a, l) => {
|
|
192
|
+
if (!a[l]) {
|
|
193
|
+
a[l] = [t];
|
|
191
194
|
return;
|
|
192
195
|
}
|
|
193
|
-
X(
|
|
196
|
+
X(n) ? a[l].push(t) : a[l].splice(n, 0, t);
|
|
194
197
|
});
|
|
195
198
|
}
|
|
196
|
-
function
|
|
197
|
-
const r = s(
|
|
198
|
-
if (C(
|
|
199
|
+
function N(e, n = "suffix") {
|
|
200
|
+
const r = s(f)?.length || 0, t = d(e) ? e : e.length;
|
|
201
|
+
if (C(o.maxLength) && r + t > o.maxLength)
|
|
199
202
|
return;
|
|
200
|
-
const
|
|
201
|
-
|
|
202
|
-
if (!
|
|
203
|
-
|
|
203
|
+
const a = d(e) ? new Array(e).fill(0).map(() => ({})) : Y(e);
|
|
204
|
+
i?.setFieldValue(o.name, a, !0, (l, u) => {
|
|
205
|
+
if (!l[u]) {
|
|
206
|
+
l[u] = [...a];
|
|
204
207
|
return;
|
|
205
208
|
}
|
|
206
|
-
|
|
209
|
+
n === "suffix" ? l[u].push(...a) : l[u].unshift(...a);
|
|
207
210
|
});
|
|
208
211
|
}
|
|
209
|
-
function
|
|
210
|
-
const
|
|
211
|
-
|
|
212
|
-
r[t] = r[t].filter((
|
|
212
|
+
function D(e) {
|
|
213
|
+
const n = new Set(d(e) ? [e] : e);
|
|
214
|
+
i?.setFieldValue(o.name, void 0, !0, (r, t) => {
|
|
215
|
+
r[t] = r[t].filter((a, l) => !n.has(l));
|
|
213
216
|
});
|
|
214
217
|
}
|
|
215
|
-
function
|
|
216
|
-
const
|
|
217
|
-
|
|
218
|
-
r[t] = r[t].filter((
|
|
218
|
+
function E(e) {
|
|
219
|
+
const n = new Set(Z(e) ? e : [e]);
|
|
220
|
+
n.size !== 0 && i?.setFieldValue?.(o.name, void 0, !0, (r, t) => {
|
|
221
|
+
r[t] = r[t].filter((a) => !n.has(a[o.rowKey]));
|
|
219
222
|
});
|
|
220
223
|
}
|
|
221
|
-
function
|
|
222
|
-
return s(
|
|
224
|
+
function k() {
|
|
225
|
+
return s(f);
|
|
223
226
|
}
|
|
224
|
-
function
|
|
225
|
-
return s(
|
|
227
|
+
function L(e) {
|
|
228
|
+
return s(f)?.[e];
|
|
226
229
|
}
|
|
227
|
-
function
|
|
228
|
-
|
|
229
|
-
if (!(!t[
|
|
230
|
+
function V(e, n, r = !0) {
|
|
231
|
+
i?.setFieldValue(o.name, void 0, !0, (t, a) => {
|
|
232
|
+
if (!(!t[a] || !t[a][e])) {
|
|
230
233
|
if (!r) {
|
|
231
|
-
const
|
|
232
|
-
for (const u of
|
|
233
|
-
u !==
|
|
234
|
+
const l = Object.keys(t[a][e]);
|
|
235
|
+
for (const u of l)
|
|
236
|
+
u !== o.rowKey && delete t[a][e][u];
|
|
234
237
|
}
|
|
235
|
-
Object.assign(t[
|
|
236
|
-
...
|
|
238
|
+
Object.assign(t[a][e], {
|
|
239
|
+
...n
|
|
237
240
|
});
|
|
238
241
|
}
|
|
239
242
|
});
|
|
240
243
|
}
|
|
241
|
-
function
|
|
242
|
-
|
|
244
|
+
function T(e) {
|
|
245
|
+
i?.setFieldValue(o.name, e);
|
|
243
246
|
}
|
|
244
|
-
function
|
|
245
|
-
const
|
|
246
|
-
p.value?.scrollToRow(
|
|
247
|
+
function _(e) {
|
|
248
|
+
const n = e === "end" ? f.value.length - 1 : e;
|
|
249
|
+
p.value?.scrollToRow(n);
|
|
247
250
|
}
|
|
248
|
-
function
|
|
249
|
-
|
|
251
|
+
function j() {
|
|
252
|
+
i?.setFieldValue?.(o.name, []);
|
|
250
253
|
}
|
|
251
254
|
return b({
|
|
252
|
-
add:
|
|
253
|
-
remove:
|
|
254
|
-
getRowData:
|
|
255
|
-
getRowsData:
|
|
256
|
-
setRowData:
|
|
257
|
-
addMultiple:
|
|
258
|
-
scrollTo:
|
|
259
|
-
setTableData:
|
|
260
|
-
clear:
|
|
261
|
-
removeByKey:
|
|
262
|
-
}), (e,
|
|
255
|
+
add: I,
|
|
256
|
+
remove: D,
|
|
257
|
+
getRowData: L,
|
|
258
|
+
getRowsData: k,
|
|
259
|
+
setRowData: V,
|
|
260
|
+
addMultiple: N,
|
|
261
|
+
scrollTo: _,
|
|
262
|
+
setTableData: T,
|
|
263
|
+
clear: j,
|
|
264
|
+
removeByKey: E
|
|
265
|
+
}), (e, n) => (H(), A(s(y).FormItem, g(e.formItem, {
|
|
263
266
|
name: e.name,
|
|
264
267
|
label: e.label
|
|
265
268
|
}), {
|
|
266
|
-
default:
|
|
269
|
+
default: h(() => [W(re, g(s(M)(o, ["name", "value", "onUpdate:value", "maxLength", "onChange", "defaultValue", "formItem"]), {
|
|
267
270
|
ref_key: "tableRef",
|
|
268
271
|
ref: p,
|
|
269
272
|
class: s(R)(),
|
|
270
|
-
columns: s(
|
|
271
|
-
"data-source":
|
|
273
|
+
columns: s(v),
|
|
274
|
+
"data-source": f.value,
|
|
272
275
|
"search-form": !1
|
|
273
276
|
}), U({
|
|
274
277
|
_: 2
|
|
275
278
|
}, [$(x, (r, t) => ({
|
|
276
279
|
name: t,
|
|
277
|
-
fn:
|
|
280
|
+
fn: h((a) => [q(e.$slots, t, J(Q(a || {})))])
|
|
278
281
|
}))]), 1040, ["class", "columns", "data-source"])]),
|
|
279
282
|
_: 3
|
|
280
283
|
}, 16, ["name", "label"]));
|
|
281
284
|
}
|
|
282
285
|
});
|
|
283
286
|
export {
|
|
284
|
-
|
|
287
|
+
xe as default
|
|
285
288
|
};
|