@aplus-frontend/ui 0.1.14 → 0.1.16
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 +56 -54
- package/es/src/ap-table/ap-table.vue.mjs +132 -129
- package/es/src/ap-table/interface.d.ts +20 -13
- package/es/src/ap-table/utils.d.ts +8340 -1
- package/es/src/ap-table/utils.mjs +135 -79
- package/es/src/business/ap-input-radio/ApInputRadio.vue2.mjs +31 -28
- package/es/src/business/ap-input-radio/interface.d.ts +1 -1
- package/es/src/business/ap-label/style.css +3 -0
- package/es/src/business/ap-status/ApStatusGroup.vue2.mjs +12 -14
- package/es/src/business/index.d.ts +2 -2
- package/es/src/business/index.mjs +20 -18
- package/es/src/config-provider/config-provider-props.d.ts +5 -1
- package/es/src/config-provider/config-provider-props.mjs +4 -0
- package/es/src/config-provider/config-provider.d.ts +10 -1
- package/es/src/config-provider/config-provider.mjs +18 -17
- package/es/src/config-provider/constants.d.ts +6 -2
- package/es/src/config-provider/hooks/use-global-config.d.ts +5 -1
- package/es/src/config-provider/index.d.ts +20 -1
- package/es/src/editable-table/form-item.vue.mjs +85 -72
- package/es/src/editable-table/index.vue.d.ts +1 -0
- package/es/src/editable-table/index.vue.mjs +118 -95
- package/es/src/editable-table/interface.d.ts +6 -1
- package/es/src/editable-table/utils.mjs +31 -30
- package/es/src/hooks/useControllableValue.mjs +3 -0
- package/es/src/index.mjs +45 -43
- package/es/src/theme/antd-global-overwrite/admin/form.css +10 -12
- package/es/src/theme/antd-global-overwrite/admin/index.css +117 -45
- package/es/src/theme/antd-global-overwrite/admin/pagination.css +54 -16
- package/es/src/theme/antd-global-overwrite/admin/table.css +53 -17
- package/es/src/theme/antd-global-overwrite/aplus/form.css +28 -21
- package/es/src/theme/antd-global-overwrite/aplus/index.css +159 -74
- package/es/src/theme/antd-global-overwrite/aplus/pagination.css +66 -20
- package/es/src/theme/antd-global-overwrite/aplus/table.css +65 -33
- package/es/src/theme/ap-label/ap-label.css +3 -0
- package/es/src/utils/ap-trans-data/index.d.ts +11 -0
- package/es/src/utils/ap-trans-data/index.mjs +20 -0
- package/lib/index.js +1 -1
- package/lib/src/ap-table/ap-table.vue.js +1 -1
- package/lib/src/ap-table/interface.d.ts +20 -13
- package/lib/src/ap-table/utils.d.ts +8340 -1
- package/lib/src/ap-table/utils.js +1 -1
- package/lib/src/business/ap-input-radio/ApInputRadio.vue2.js +1 -1
- package/lib/src/business/ap-input-radio/interface.d.ts +1 -1
- package/lib/src/business/ap-label/style.css +3 -0
- package/lib/src/business/ap-status/ApStatusGroup.vue2.js +1 -1
- package/lib/src/business/index.d.ts +2 -2
- package/lib/src/business/index.js +1 -1
- package/lib/src/config-provider/config-provider-props.d.ts +5 -1
- package/lib/src/config-provider/config-provider-props.js +1 -1
- package/lib/src/config-provider/config-provider.d.ts +10 -1
- package/lib/src/config-provider/config-provider.js +1 -1
- package/lib/src/config-provider/constants.d.ts +6 -2
- package/lib/src/config-provider/hooks/use-global-config.d.ts +5 -1
- package/lib/src/config-provider/index.d.ts +20 -1
- package/lib/src/editable-table/form-item.vue.js +1 -1
- package/lib/src/editable-table/index.vue.d.ts +1 -0
- package/lib/src/editable-table/index.vue.js +1 -1
- package/lib/src/editable-table/interface.d.ts +6 -1
- package/lib/src/editable-table/utils.js +1 -1
- package/lib/src/hooks/useControllableValue.js +1 -1
- package/lib/src/index.js +1 -1
- package/lib/src/theme/antd-global-overwrite/admin/form.css +10 -12
- package/lib/src/theme/antd-global-overwrite/admin/index.css +117 -45
- package/lib/src/theme/antd-global-overwrite/admin/pagination.css +54 -16
- package/lib/src/theme/antd-global-overwrite/admin/table.css +53 -17
- package/lib/src/theme/antd-global-overwrite/aplus/form.css +28 -21
- package/lib/src/theme/antd-global-overwrite/aplus/index.css +159 -74
- package/lib/src/theme/antd-global-overwrite/aplus/pagination.css +66 -20
- package/lib/src/theme/antd-global-overwrite/aplus/table.css +65 -33
- package/lib/src/theme/ap-label/ap-label.css +3 -0
- package/lib/src/utils/ap-trans-data/index.d.ts +11 -0
- package/lib/src/utils/ap-trans-data/index.js +1 -0
- package/package.json +3 -3
|
@@ -8,7 +8,7 @@ import { ValidateMessages } from 'ant-design-vue/es/form/interface';
|
|
|
8
8
|
import { RequiredMark } from 'ant-design-vue/es/form/Form';
|
|
9
9
|
import { ThemeConfig } from 'ant-design-vue/es/config-provider/context';
|
|
10
10
|
import { LocaleType } from '..';
|
|
11
|
-
import { ApiType, TableDefaultConfig, ScrollbarGlobalConfig, ApUploadConfig, ApDescriptionsConfig } from './constants';
|
|
11
|
+
import { ApiType, TableDefaultConfig, ScrollbarGlobalConfig, ApUploadConfig, ApDescriptionsConfig, ValueTypeRenderConfig } from './constants';
|
|
12
12
|
export * from './config-provider-props';
|
|
13
13
|
export * from './constants';
|
|
14
14
|
export * from './hooks/use-global-config';
|
|
@@ -161,6 +161,10 @@ export declare const APConfigProvider: {
|
|
|
161
161
|
type: PropType<ApDescriptionsConfig>;
|
|
162
162
|
default: () => {};
|
|
163
163
|
};
|
|
164
|
+
valueTypeMap: {
|
|
165
|
+
type: PropType<Record<string, ValueTypeRenderConfig>>;
|
|
166
|
+
default: () => {};
|
|
167
|
+
};
|
|
164
168
|
}>>, () => import("vue/jsx-runtime").JSX.Element, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, VNodeProps & AllowedComponentProps & ComponentCustomProps & Readonly< ExtractPropTypes<{
|
|
165
169
|
iconPrefixCls: StringConstructor;
|
|
166
170
|
getTargetContainer: {
|
|
@@ -306,6 +310,10 @@ export declare const APConfigProvider: {
|
|
|
306
310
|
type: PropType<ApDescriptionsConfig>;
|
|
307
311
|
default: () => {};
|
|
308
312
|
};
|
|
313
|
+
valueTypeMap: {
|
|
314
|
+
type: PropType<Record<string, ValueTypeRenderConfig>>;
|
|
315
|
+
default: () => {};
|
|
316
|
+
};
|
|
309
317
|
}>>, {
|
|
310
318
|
input: {
|
|
311
319
|
autocomplete?: string;
|
|
@@ -344,6 +352,7 @@ export declare const APConfigProvider: {
|
|
|
344
352
|
uiMode: "aplus" | "admin";
|
|
345
353
|
apUpload: ApUploadConfig;
|
|
346
354
|
apDescriptions: ApDescriptionsConfig;
|
|
355
|
+
valueTypeMap: Record<string, ValueTypeRenderConfig>;
|
|
347
356
|
}, true, {}, {}, {
|
|
348
357
|
P: {};
|
|
349
358
|
B: {};
|
|
@@ -496,6 +505,10 @@ export declare const APConfigProvider: {
|
|
|
496
505
|
type: PropType<ApDescriptionsConfig>;
|
|
497
506
|
default: () => {};
|
|
498
507
|
};
|
|
508
|
+
valueTypeMap: {
|
|
509
|
+
type: PropType<Record<string, ValueTypeRenderConfig>>;
|
|
510
|
+
default: () => {};
|
|
511
|
+
};
|
|
499
512
|
}>>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, {
|
|
500
513
|
input: {
|
|
501
514
|
autocomplete?: string;
|
|
@@ -534,6 +547,7 @@ export declare const APConfigProvider: {
|
|
|
534
547
|
uiMode: "aplus" | "admin";
|
|
535
548
|
apUpload: ApUploadConfig;
|
|
536
549
|
apDescriptions: ApDescriptionsConfig;
|
|
550
|
+
valueTypeMap: Record<string, ValueTypeRenderConfig>;
|
|
537
551
|
}>;
|
|
538
552
|
__isFragment?: never;
|
|
539
553
|
__isTeleport?: never;
|
|
@@ -683,6 +697,10 @@ export declare const APConfigProvider: {
|
|
|
683
697
|
type: PropType<ApDescriptionsConfig>;
|
|
684
698
|
default: () => {};
|
|
685
699
|
};
|
|
700
|
+
valueTypeMap: {
|
|
701
|
+
type: PropType<Record<string, ValueTypeRenderConfig>>;
|
|
702
|
+
default: () => {};
|
|
703
|
+
};
|
|
686
704
|
}>>, () => import("vue/jsx-runtime").JSX.Element, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, {
|
|
687
705
|
input: {
|
|
688
706
|
autocomplete?: string;
|
|
@@ -721,6 +739,7 @@ export declare const APConfigProvider: {
|
|
|
721
739
|
uiMode: "aplus" | "admin";
|
|
722
740
|
apUpload: ApUploadConfig;
|
|
723
741
|
apDescriptions: ApDescriptionsConfig;
|
|
742
|
+
valueTypeMap: Record<string, ValueTypeRenderConfig>;
|
|
724
743
|
}, {}, string, {}> & ( VNodeProps & ( AllowedComponentProps & ComponentCustomProps & ( Plugin & (new (...args: any[]) => {
|
|
725
744
|
$props: {
|
|
726
745
|
onClick?: () => void;
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Table as
|
|
3
|
-
import { ApForm as
|
|
4
|
-
import { isNumber as
|
|
1
|
+
import { defineComponent as K, ref as y, unref as o, useSlots as q, watch as H, openBlock as u, createBlock as C, mergeProps as b, withCtx as m, createVNode as w, createSlots as I, createElementBlock as W, normalizeClass as $, createCommentVNode as R, createElementVNode as G, toDisplayString as M, normalizeStyle as Q, renderList as U, renderSlot as J, normalizeProps as X, guardReactiveProps as Y } from "vue";
|
|
2
|
+
import { Table as Z, Tooltip as ee } from "ant-design-vue";
|
|
3
|
+
import { ApForm as B } from "../ap-form/index.mjs";
|
|
4
|
+
import { isNumber as i, cloneDeep as f, omit as oe } from "lodash-unified";
|
|
5
5
|
import "../config-provider/index.mjs";
|
|
6
|
-
import { useInjectForm as
|
|
6
|
+
import { useInjectForm as te } from "../ap-form/context.mjs";
|
|
7
7
|
import "./style/index.css";
|
|
8
|
-
import { isDef as
|
|
9
|
-
import
|
|
10
|
-
import { scrollToRowIndex as
|
|
11
|
-
import {
|
|
12
|
-
|
|
8
|
+
import { isDef as p } from "../utils/index.mjs";
|
|
9
|
+
import ae from "./hooks/use-get-columns.mjs";
|
|
10
|
+
import { scrollToRowIndex as le, getColumnIsRequired as ne } from "./utils.mjs";
|
|
11
|
+
import { QuestionCircleOutlined as re } from "@ant-design/icons-vue";
|
|
12
|
+
import { useToken as se } from "ant-design-vue/es/theme/internal";
|
|
13
|
+
import { useNamespace as de } from "../config-provider/hooks/use-namespace.mjs";
|
|
14
|
+
const Re = /* @__PURE__ */ K({
|
|
13
15
|
name: "EditableTableInner",
|
|
14
16
|
__name: "form-item",
|
|
15
17
|
props: {
|
|
@@ -109,103 +111,114 @@ const ge = /* @__PURE__ */ V({
|
|
|
109
111
|
default: () => ({})
|
|
110
112
|
}
|
|
111
113
|
},
|
|
112
|
-
setup(
|
|
113
|
-
expose:
|
|
114
|
+
setup(k, {
|
|
115
|
+
expose: D
|
|
114
116
|
}) {
|
|
115
|
-
var
|
|
116
|
-
const
|
|
117
|
-
internalInstance:
|
|
118
|
-
model:
|
|
119
|
-
} =
|
|
120
|
-
|
|
121
|
-
var
|
|
122
|
-
r.value = e, (
|
|
117
|
+
var h;
|
|
118
|
+
const l = k, {
|
|
119
|
+
internalInstance: n,
|
|
120
|
+
model: v
|
|
121
|
+
} = te(), r = y(((h = o(v)) == null ? void 0 : h[l.name]) || []), L = q(), E = B.useWatch(l.name);
|
|
122
|
+
H(() => E.value, (e) => {
|
|
123
|
+
var t;
|
|
124
|
+
r.value = e, (t = l.onChange) == null || t.call(l, e);
|
|
123
125
|
}, {
|
|
124
126
|
deep: !0
|
|
125
127
|
});
|
|
126
128
|
const {
|
|
127
|
-
b:
|
|
128
|
-
em:
|
|
129
|
-
} =
|
|
130
|
-
function
|
|
129
|
+
b: F,
|
|
130
|
+
em: N
|
|
131
|
+
} = de("editable-table"), c = y(), [, S] = se(), T = ae(l);
|
|
132
|
+
function _(e, t) {
|
|
131
133
|
var d;
|
|
132
|
-
const a = ((d =
|
|
133
|
-
if (
|
|
134
|
+
const a = ((d = o(r)) == null ? void 0 : d.length) || 0;
|
|
135
|
+
if (p(l.maxLength) && a >= l.maxLength)
|
|
134
136
|
return;
|
|
135
|
-
const s = [...
|
|
136
|
-
|
|
137
|
+
const s = [...o(r) || []];
|
|
138
|
+
p(t) ? s.splice(t, 0, {
|
|
137
139
|
...e || {}
|
|
138
140
|
}) : s.push({
|
|
139
141
|
...e || {}
|
|
140
|
-
}),
|
|
142
|
+
}), n == null || n.setFieldValue(l.name, [...o(r) || [], e || {}]);
|
|
141
143
|
}
|
|
142
|
-
function
|
|
144
|
+
function z(e, t = "suffix") {
|
|
143
145
|
var g;
|
|
144
|
-
const a = ((g =
|
|
145
|
-
if (
|
|
146
|
+
const a = ((g = o(r)) == null ? void 0 : g.length) || 0, s = i(e) ? e : e.length;
|
|
147
|
+
if (p(l.maxLength) && a + s > l.maxLength)
|
|
146
148
|
return;
|
|
147
|
-
const d = [...
|
|
148
|
-
|
|
149
|
+
const d = [...o(r) || []], x = i(e) ? new Array(e).fill({}) : f(e);
|
|
150
|
+
t === "suffix" ? d.push(...x) : d.unshift(...x), n == null || n.setFieldValue(l.name, d);
|
|
149
151
|
}
|
|
150
|
-
function
|
|
151
|
-
let
|
|
152
|
-
const a =
|
|
153
|
-
|
|
152
|
+
function P(e) {
|
|
153
|
+
let t = f(o(r) || []);
|
|
154
|
+
const a = i(e) ? [e] : e;
|
|
155
|
+
t = t.filter((s, d) => !a.includes(d)), n == null || n.setFieldValue(l.name, t);
|
|
154
156
|
}
|
|
155
|
-
function
|
|
156
|
-
return
|
|
157
|
+
function j() {
|
|
158
|
+
return o(r);
|
|
157
159
|
}
|
|
158
|
-
function
|
|
159
|
-
var
|
|
160
|
-
return (
|
|
160
|
+
function O(e) {
|
|
161
|
+
var t;
|
|
162
|
+
return (t = o(r)) == null ? void 0 : t[e];
|
|
161
163
|
}
|
|
162
|
-
function
|
|
163
|
-
const a = f(
|
|
164
|
+
function V(e, t) {
|
|
165
|
+
const a = f(o(r));
|
|
164
166
|
a[e] && (a[e] = {
|
|
165
167
|
...a[e],
|
|
166
|
-
...
|
|
167
|
-
},
|
|
168
|
+
...t
|
|
169
|
+
}, n == null || n.setFieldValue(l.name, [...a]));
|
|
168
170
|
}
|
|
169
|
-
function
|
|
171
|
+
function A(e, t) {
|
|
170
172
|
var s;
|
|
171
173
|
const a = e === "end" ? r.value.length - 1 : e;
|
|
172
|
-
|
|
174
|
+
le(a, (s = c.value) == null ? void 0 : s.$el, t);
|
|
173
175
|
}
|
|
174
|
-
return
|
|
175
|
-
add:
|
|
176
|
-
remove:
|
|
177
|
-
getRowData:
|
|
178
|
-
getRowsData:
|
|
179
|
-
setRowData:
|
|
180
|
-
addMultiple:
|
|
181
|
-
scrollTo:
|
|
182
|
-
}), (e,
|
|
176
|
+
return D({
|
|
177
|
+
add: _,
|
|
178
|
+
remove: P,
|
|
179
|
+
getRowData: O,
|
|
180
|
+
getRowsData: j,
|
|
181
|
+
setRowData: V,
|
|
182
|
+
addMultiple: z,
|
|
183
|
+
scrollTo: A
|
|
184
|
+
}), (e, t) => (u(), C(o(B).FormItem, b(e.formItem, {
|
|
183
185
|
name: e.name,
|
|
184
186
|
label: e.label
|
|
185
187
|
}), {
|
|
186
|
-
default:
|
|
187
|
-
class:
|
|
188
|
-
columns:
|
|
188
|
+
default: m(() => [w(o(Z), b(o(oe)(l, ["name", "maxLength", "onChange"]), {
|
|
189
|
+
class: o(F)(),
|
|
190
|
+
columns: o(T),
|
|
189
191
|
"data-source": r.value,
|
|
190
192
|
ref_key: "tableRef",
|
|
191
|
-
ref:
|
|
192
|
-
}),
|
|
193
|
-
headerCell:
|
|
193
|
+
ref: c
|
|
194
|
+
}), I({
|
|
195
|
+
headerCell: m(({
|
|
194
196
|
column: a
|
|
195
|
-
}) => [
|
|
196
|
-
key: 0
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
197
|
+
}) => [o(ne)(a) ? (u(), W("span", {
|
|
198
|
+
key: 0,
|
|
199
|
+
class: $(o(N)("header-cell", "required"))
|
|
200
|
+
}, "*", 2)) : R("", !0), G("span", null, M(a.title), 1), a.tooltip ? (u(), C(o(ee), {
|
|
201
|
+
key: 1,
|
|
202
|
+
title: a.tooltip,
|
|
203
|
+
placement: "bottom"
|
|
204
|
+
}, {
|
|
205
|
+
default: m(() => [w(o(re), {
|
|
206
|
+
style: Q({
|
|
207
|
+
paddingLeft: "4px",
|
|
208
|
+
color: o(S).colorPrimary
|
|
209
|
+
})
|
|
210
|
+
}, null, 8, ["style"])]),
|
|
211
|
+
_: 2
|
|
212
|
+
}, 1032, ["title"])) : R("", !0)]),
|
|
200
213
|
_: 2
|
|
201
|
-
}, [U(
|
|
214
|
+
}, [U(L, (a, s) => ({
|
|
202
215
|
name: s,
|
|
203
|
-
fn:
|
|
216
|
+
fn: m((d) => [J(e.$slots, s, X(Y(d || {})))])
|
|
204
217
|
}))]), 1040, ["class", "columns", "data-source"])]),
|
|
205
218
|
_: 3
|
|
206
219
|
}, 16, ["name", "label"]));
|
|
207
220
|
}
|
|
208
221
|
});
|
|
209
222
|
export {
|
|
210
|
-
|
|
223
|
+
Re as default
|
|
211
224
|
};
|
|
@@ -19,6 +19,7 @@ declare const _default: <RecordType extends Recordable = any>(__VLS_props: NonNu
|
|
|
19
19
|
setRowData: (index: number, payload: any) => void;
|
|
20
20
|
addMultiple: (list: number | Partial<RecordType>[], insetIn?: "prefix" | "suffix") => void;
|
|
21
21
|
scrollTo: (index: number | "end", options?: StandardBehaviorOptions) => void;
|
|
22
|
+
clear: () => void;
|
|
22
23
|
}>): void;
|
|
23
24
|
attrs: any;
|
|
24
25
|
slots: ReturnType<() => Readonly<{
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Table as
|
|
3
|
-
import { ApForm as
|
|
4
|
-
import { isArray as
|
|
1
|
+
import { defineComponent as G, useSlots as Q, ref as R, watch as b, unref as o, openBlock as p, createBlock as B, withCtx as m, createVNode as x, mergeProps as J, createSlots as X, createElementBlock as Y, normalizeClass as Z, createCommentVNode as F, createElementVNode as ee, toDisplayString as te, normalizeStyle as ae, renderList as ne, renderSlot as oe, normalizeProps as le, guardReactiveProps as re } from "vue";
|
|
2
|
+
import { Table as se, Tooltip as ue } from "ant-design-vue";
|
|
3
|
+
import { ApForm as h } from "../ap-form/index.mjs";
|
|
4
|
+
import { isEqual as ie, isArray as k, isNumber as y, cloneDeep as g, omit as de } from "lodash-unified";
|
|
5
5
|
import "../config-provider/index.mjs";
|
|
6
6
|
import "../hooks/index.mjs";
|
|
7
|
-
import { isDef as
|
|
8
|
-
import { scrollToRowIndex as
|
|
9
|
-
import
|
|
7
|
+
import { isDef as C } from "../utils/index.mjs";
|
|
8
|
+
import { scrollToRowIndex as me, getColumnIsRequired as fe } from "./utils.mjs";
|
|
9
|
+
import ce from "./hooks/use-get-columns.mjs";
|
|
10
10
|
import "./style/index.css";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
11
|
+
import { useToken as pe } from "ant-design-vue/es/theme/internal";
|
|
12
|
+
import { QuestionCircleOutlined as xe } from "@ant-design/icons-vue";
|
|
13
|
+
import { useNamespace as he } from "../config-provider/hooks/use-namespace.mjs";
|
|
14
|
+
import { useControllableValue as ye } from "../hooks/useControllableValue.mjs";
|
|
15
|
+
const De = /* @__PURE__ */ G({
|
|
14
16
|
name: "EditableTable",
|
|
15
17
|
__name: "index",
|
|
16
18
|
props: {
|
|
@@ -109,121 +111,142 @@ const Be = /* @__PURE__ */ M({
|
|
|
109
111
|
onFieldChange: {}
|
|
110
112
|
},
|
|
111
113
|
emits: ["update:value"],
|
|
112
|
-
setup(
|
|
113
|
-
expose:
|
|
114
|
-
emit:
|
|
114
|
+
setup(E, {
|
|
115
|
+
expose: L,
|
|
116
|
+
emit: N
|
|
115
117
|
}) {
|
|
116
|
-
const
|
|
117
|
-
b:
|
|
118
|
-
em:
|
|
119
|
-
} =
|
|
118
|
+
const l = E, {
|
|
119
|
+
b: V,
|
|
120
|
+
em: _
|
|
121
|
+
} = he("editable-table"), D = Q(), S = N, v = R(), {
|
|
120
122
|
value: s,
|
|
121
|
-
updateValue:
|
|
122
|
-
} =
|
|
123
|
-
|
|
124
|
-
var
|
|
125
|
-
|
|
123
|
+
updateValue: T
|
|
124
|
+
} = ye(l, S), u = R(), [, A] = pe(), c = h.useWatch(l.name, u);
|
|
125
|
+
b(() => c.value, (e) => {
|
|
126
|
+
var t;
|
|
127
|
+
T(e), (t = l.onChange) == null || t.call(l, e);
|
|
128
|
+
}, {
|
|
129
|
+
deep: !0
|
|
130
|
+
}), b(s, (e) => {
|
|
131
|
+
var t;
|
|
132
|
+
e !== o(c) && (ie(e, o(c)) || (t = u.value) == null || t.setFieldValue(l.name, e));
|
|
126
133
|
}, {
|
|
127
134
|
deep: !0
|
|
128
135
|
});
|
|
129
|
-
const
|
|
130
|
-
function
|
|
136
|
+
const z = ce(l);
|
|
137
|
+
function P() {
|
|
131
138
|
var e;
|
|
132
139
|
(e = u.value) == null || e.resetFields();
|
|
133
140
|
}
|
|
134
|
-
function
|
|
135
|
-
return e ? (
|
|
141
|
+
function I(e) {
|
|
142
|
+
return e ? (k(e) ? e : [e]).map((a) => k(a) ? [l.name, ...a] : [l.name, a]) : void 0;
|
|
136
143
|
}
|
|
137
|
-
async function
|
|
138
|
-
var
|
|
139
|
-
const
|
|
140
|
-
return
|
|
144
|
+
async function O(e, t) {
|
|
145
|
+
var n;
|
|
146
|
+
const a = await ((n = u.value) == null ? void 0 : n.validateFields(I(e), t));
|
|
147
|
+
return a == null ? void 0 : a[l.name];
|
|
141
148
|
}
|
|
142
|
-
function
|
|
143
|
-
var r,
|
|
144
|
-
const
|
|
145
|
-
if (
|
|
149
|
+
function j(e, t) {
|
|
150
|
+
var r, i, d;
|
|
151
|
+
const a = ((r = o(s)) == null ? void 0 : r.length) || 0;
|
|
152
|
+
if (C(l.maxLength) && a >= l.maxLength)
|
|
146
153
|
return;
|
|
147
|
-
const
|
|
148
|
-
|
|
154
|
+
const n = [...o(s) || []];
|
|
155
|
+
C(t) ? n.splice(t, 0, {
|
|
149
156
|
...e || {}
|
|
150
|
-
}) :
|
|
157
|
+
}) : n.push({
|
|
151
158
|
...e || {}
|
|
152
|
-
}), (
|
|
159
|
+
}), (d = (i = u.value) == null ? void 0 : i.setFieldValue) == null || d.call(i, l.name, n);
|
|
153
160
|
}
|
|
154
|
-
function
|
|
155
|
-
var
|
|
156
|
-
const
|
|
157
|
-
if (
|
|
161
|
+
function q(e, t = "suffix") {
|
|
162
|
+
var d, f, w;
|
|
163
|
+
const a = ((d = o(s)) == null ? void 0 : d.length) || 0, n = y(e) ? e : e.length;
|
|
164
|
+
if (C(l.maxLength) && a + n > l.maxLength)
|
|
158
165
|
return;
|
|
159
|
-
const r = [...
|
|
160
|
-
|
|
166
|
+
const r = [...o(s) || []], i = y(e) ? new Array(e).fill({}) : g(e);
|
|
167
|
+
t === "suffix" ? r.push(...i) : r.unshift(...i), (w = (f = u.value) == null ? void 0 : f.setFieldValue) == null || w.call(f, l.name, r);
|
|
161
168
|
}
|
|
162
|
-
function
|
|
163
|
-
var
|
|
164
|
-
let
|
|
165
|
-
const
|
|
166
|
-
|
|
169
|
+
function K(e) {
|
|
170
|
+
var n, r;
|
|
171
|
+
let t = g(o(s) || []);
|
|
172
|
+
const a = y(e) ? [e] : e;
|
|
173
|
+
t = t.filter((i, d) => !a.includes(d)), (r = (n = u.value) == null ? void 0 : n.setFieldValue) == null || r.call(n, l.name, t);
|
|
167
174
|
}
|
|
168
|
-
function
|
|
169
|
-
return
|
|
175
|
+
function H() {
|
|
176
|
+
return o(s);
|
|
170
177
|
}
|
|
171
|
-
function
|
|
172
|
-
var
|
|
173
|
-
return (
|
|
178
|
+
function M(e) {
|
|
179
|
+
var t;
|
|
180
|
+
return (t = o(s)) == null ? void 0 : t[e];
|
|
174
181
|
}
|
|
175
|
-
function
|
|
176
|
-
var
|
|
177
|
-
const
|
|
178
|
-
|
|
179
|
-
...
|
|
180
|
-
...
|
|
181
|
-
}, (r = (
|
|
182
|
+
function U(e, t) {
|
|
183
|
+
var n, r;
|
|
184
|
+
const a = g(o(s));
|
|
185
|
+
a[e] && (a[e] = {
|
|
186
|
+
...a[e],
|
|
187
|
+
...t
|
|
188
|
+
}, (r = (n = u.value) == null ? void 0 : n.setFieldValue) == null || r.call(n, l.name, [...a]));
|
|
189
|
+
}
|
|
190
|
+
function W(e, t) {
|
|
191
|
+
var n;
|
|
192
|
+
const a = e === "end" ? s.value.length - 1 : e;
|
|
193
|
+
me(a, (n = v.value) == null ? void 0 : n.$el, t);
|
|
182
194
|
}
|
|
183
|
-
function
|
|
184
|
-
var
|
|
185
|
-
|
|
186
|
-
se(t, (a = g.value) == null ? void 0 : a.$el, n);
|
|
195
|
+
function $() {
|
|
196
|
+
var e, t;
|
|
197
|
+
(t = (e = u.value) == null ? void 0 : e.setFieldValue) == null || t.call(e, l.name, []);
|
|
187
198
|
}
|
|
188
|
-
return
|
|
189
|
-
resetFields:
|
|
190
|
-
validateFields:
|
|
191
|
-
add:
|
|
192
|
-
remove:
|
|
193
|
-
getRowData:
|
|
194
|
-
getRowsData:
|
|
195
|
-
setRowData:
|
|
196
|
-
addMultiple:
|
|
197
|
-
scrollTo:
|
|
198
|
-
|
|
199
|
+
return L({
|
|
200
|
+
resetFields: P,
|
|
201
|
+
validateFields: O,
|
|
202
|
+
add: j,
|
|
203
|
+
remove: K,
|
|
204
|
+
getRowData: M,
|
|
205
|
+
getRowsData: H,
|
|
206
|
+
setRowData: U,
|
|
207
|
+
addMultiple: q,
|
|
208
|
+
scrollTo: W,
|
|
209
|
+
clear: $
|
|
210
|
+
}), (e, t) => (p(), B(o(h), {
|
|
199
211
|
"initial-values": {
|
|
200
|
-
[
|
|
212
|
+
[l.name]: o(s)
|
|
201
213
|
},
|
|
202
214
|
ref_key: "formRef",
|
|
203
215
|
ref: u
|
|
204
216
|
}, {
|
|
205
|
-
default:
|
|
217
|
+
default: m(() => [x(o(h).FormItem, {
|
|
206
218
|
name: e.name,
|
|
207
219
|
"no-style": ""
|
|
208
220
|
}, {
|
|
209
|
-
default:
|
|
210
|
-
class:
|
|
211
|
-
columns:
|
|
212
|
-
"data-source":
|
|
221
|
+
default: m(() => [x(o(se), J(o(de)(l, ["name", "value", "onUpdate:value", "maxLength", "onChange"]), {
|
|
222
|
+
class: o(V)(),
|
|
223
|
+
columns: o(z),
|
|
224
|
+
"data-source": o(s),
|
|
213
225
|
ref_key: "tableRef",
|
|
214
|
-
ref:
|
|
215
|
-
}),
|
|
216
|
-
headerCell:
|
|
217
|
-
column:
|
|
218
|
-
}) => [
|
|
219
|
-
key: 0
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
226
|
+
ref: v
|
|
227
|
+
}), X({
|
|
228
|
+
headerCell: m(({
|
|
229
|
+
column: a
|
|
230
|
+
}) => [o(fe)(a) ? (p(), Y("span", {
|
|
231
|
+
key: 0,
|
|
232
|
+
class: Z(o(_)("header-cell", "required"))
|
|
233
|
+
}, "*", 2)) : F("", !0), ee("span", null, te(a.title), 1), a.tooltip ? (p(), B(o(ue), {
|
|
234
|
+
key: 1,
|
|
235
|
+
title: a.tooltip,
|
|
236
|
+
placement: "bottom"
|
|
237
|
+
}, {
|
|
238
|
+
default: m(() => [x(o(xe), {
|
|
239
|
+
style: ae({
|
|
240
|
+
paddingLeft: "4px",
|
|
241
|
+
color: o(A).colorPrimary
|
|
242
|
+
})
|
|
243
|
+
}, null, 8, ["style"])]),
|
|
244
|
+
_: 2
|
|
245
|
+
}, 1032, ["title"])) : F("", !0)]),
|
|
223
246
|
_: 2
|
|
224
|
-
}, [
|
|
225
|
-
name:
|
|
226
|
-
fn:
|
|
247
|
+
}, [ne(D, (a, n) => ({
|
|
248
|
+
name: n,
|
|
249
|
+
fn: m((r) => [oe(e.$slots, n, le(re(r || {})))])
|
|
227
250
|
}))]), 1040, ["class", "columns", "data-source"])]),
|
|
228
251
|
_: 3
|
|
229
252
|
}, 8, ["name"])]),
|
|
@@ -232,5 +255,5 @@ const Be = /* @__PURE__ */ M({
|
|
|
232
255
|
}
|
|
233
256
|
});
|
|
234
257
|
export {
|
|
235
|
-
|
|
258
|
+
De as default
|
|
236
259
|
};
|
|
@@ -140,6 +140,11 @@ export type EditableTableExpose<ModelType = any, RecordType = any> = {
|
|
|
140
140
|
* @returns
|
|
141
141
|
*/
|
|
142
142
|
remove: (index: number | number[]) => void;
|
|
143
|
+
/**
|
|
144
|
+
* 清空所有数据
|
|
145
|
+
* @returns
|
|
146
|
+
*/
|
|
147
|
+
clear: () => void;
|
|
143
148
|
/**
|
|
144
149
|
* 获取所有行的数据
|
|
145
150
|
* @returns
|
|
@@ -169,4 +174,4 @@ export type EditableTableExpose<ModelType = any, RecordType = any> = {
|
|
|
169
174
|
* 可编辑表格作为表单项暴露的实例
|
|
170
175
|
* @description 作为Form表单使用时不再暴露表单相关的API
|
|
171
176
|
*/
|
|
172
|
-
export type EditableTableFormItemExpose<ModelType = any, RecordType = any> = Omit<EditableTableExpose<ModelType, RecordType>, 'resetFields' | 'validateFields'>;
|
|
177
|
+
export type EditableTableFormItemExpose<ModelType = any, RecordType = any> = Omit<EditableTableExpose<ModelType, RecordType>, 'resetFields' | 'validateFields' | 'clear'>;
|