@aplus-frontend/ui 0.1.16 → 0.1.18
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 +60 -58
- package/es/src/ap-download/ap-download.vue.mjs +26 -26
- package/es/src/ap-form/ap-form-item-group/index.vue.mjs +26 -24
- package/es/src/ap-modal/index.d.ts +2 -2
- package/es/src/ap-modal/index.mjs +1 -1
- package/es/src/ap-modal/{type.d.ts → interface.d.ts} +3 -3
- package/es/src/ap-modal/utils/createModal.d.ts +1 -1
- package/es/src/ap-table/ap-table.vue.mjs +40 -40
- package/es/src/ap-table/interface.d.ts +2 -3
- package/es/src/ap-table/utils.d.ts +1 -1
- package/es/src/ap-table/utils.mjs +20 -20
- package/es/src/business/ap-batch-action/index.css +2 -0
- package/es/src/business/ap-batch-action-group/ApBatchActionGroup.vue.d.ts +13 -0
- package/es/src/business/ap-batch-action-group/ApBatchActionGroup.vue.mjs +4 -0
- package/es/src/business/ap-batch-action-group/ApBatchActionGroup.vue2.mjs +110 -0
- package/es/src/business/ap-batch-action-group/MenuItemGroup.vue.d.ts +17 -0
- package/es/src/business/ap-batch-action-group/MenuItemGroup.vue.mjs +4 -0
- package/es/src/business/ap-batch-action-group/MenuItemGroup.vue2.mjs +50 -0
- package/es/src/business/ap-batch-action-group/interface.d.ts +41 -0
- package/es/src/business/ap-batch-action-group/interface.mjs +1 -0
- package/es/src/business/ap-image/ApImage.vue.d.ts +65 -0
- package/es/src/business/ap-image/ApImage.vue.mjs +4 -0
- package/es/src/business/ap-image/ApImage.vue2.mjs +56 -0
- package/es/src/business/ap-image/hooks/useOss.d.ts +11 -0
- package/es/src/business/ap-image/hooks/useOss.mjs +37 -0
- package/es/src/business/ap-image/imgs/admin-fallback.jpg.mjs +4 -0
- package/es/src/business/ap-image/imgs/aplus-fallback.jpg.mjs +4 -0
- package/es/src/business/ap-label/ApLabel.d.ts +141 -0
- package/es/src/business/ap-label/ApLabel.mjs +49 -0
- package/es/src/business/ap-label/ApLabelGroup.mjs +11 -12
- package/es/src/business/ap-label/constans.d.ts +65 -1
- package/es/src/business/ap-label/constans.mjs +33 -2
- package/es/src/business/ap-label/index.d.ts +1 -1
- package/es/src/business/ap-label/interface.d.ts +2 -1
- package/es/src/business/index.d.ts +815 -164
- package/es/src/business/index.mjs +26 -20
- package/es/src/config-provider/constants.d.ts +1 -1
- package/es/src/editable-table/form-item.vue.mjs +47 -46
- package/es/src/editable-table/hooks/use-get-columns.d.ts +3 -2
- package/es/src/editable-table/hooks/use-get-columns.mjs +32 -32
- package/es/src/editable-table/index.vue.mjs +81 -80
- package/es/src/editable-table/interface.d.ts +7 -13
- package/es/src/editable-table/utils.d.ts +14 -2
- package/es/src/editable-table/utils.mjs +67 -58
- package/es/src/index.mjs +202 -200
- package/es/src/locale/lang/en.mjs +10 -7
- package/es/src/locale/lang/zh-cn.mjs +3 -0
- package/es/src/theme/ap-batch-action/ap-batch-action.css +2 -0
- package/lib/index.js +1 -1
- package/lib/src/ap-download/ap-download.vue.js +1 -1
- package/lib/src/ap-form/ap-form-item-group/index.vue.js +1 -1
- package/lib/src/ap-modal/index.d.ts +2 -2
- package/lib/src/ap-modal/index.js +1 -1
- package/lib/src/ap-modal/{type.d.ts → interface.d.ts} +3 -3
- package/lib/src/ap-modal/utils/createModal.d.ts +1 -1
- package/lib/src/ap-table/ap-table.vue.js +1 -1
- package/lib/src/ap-table/interface.d.ts +2 -3
- package/lib/src/ap-table/utils.d.ts +1 -1
- package/lib/src/ap-table/utils.js +1 -1
- package/lib/src/business/ap-batch-action/index.css +2 -0
- package/lib/src/business/ap-batch-action-group/ApBatchActionGroup.vue.d.ts +13 -0
- package/lib/src/business/ap-batch-action-group/ApBatchActionGroup.vue.js +1 -0
- package/lib/src/business/ap-batch-action-group/ApBatchActionGroup.vue2.js +1 -0
- package/lib/src/business/ap-batch-action-group/MenuItemGroup.vue.d.ts +17 -0
- package/lib/src/business/ap-batch-action-group/MenuItemGroup.vue.js +1 -0
- package/lib/src/business/ap-batch-action-group/MenuItemGroup.vue2.js +1 -0
- package/lib/src/business/ap-batch-action-group/interface.d.ts +41 -0
- package/lib/src/business/ap-batch-action-group/interface.js +1 -0
- package/lib/src/business/ap-image/ApImage.vue.d.ts +65 -0
- package/lib/src/business/{ap-label/ApLabel.vue.js → ap-image/ApImage.vue.js} +1 -1
- package/lib/src/business/ap-image/ApImage.vue2.js +1 -0
- package/lib/src/business/ap-image/hooks/useOss.d.ts +11 -0
- package/lib/src/business/ap-image/hooks/useOss.js +1 -0
- package/lib/src/business/ap-image/imgs/admin-fallback.jpg.js +1 -0
- package/lib/src/business/ap-image/imgs/aplus-fallback.jpg.js +1 -0
- package/lib/src/business/ap-label/ApLabel.d.ts +141 -0
- package/lib/src/business/ap-label/ApLabel.js +1 -0
- package/lib/src/business/ap-label/ApLabelGroup.js +1 -1
- package/lib/src/business/ap-label/constans.d.ts +65 -1
- package/lib/src/business/ap-label/constans.js +1 -1
- package/lib/src/business/ap-label/index.d.ts +1 -1
- package/lib/src/business/ap-label/interface.d.ts +2 -1
- package/lib/src/business/index.d.ts +815 -164
- package/lib/src/business/index.js +1 -1
- package/lib/src/config-provider/constants.d.ts +1 -1
- package/lib/src/editable-table/form-item.vue.js +1 -1
- package/lib/src/editable-table/hooks/use-get-columns.d.ts +3 -2
- 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/editable-table/interface.d.ts +7 -13
- package/lib/src/editable-table/utils.d.ts +14 -2
- package/lib/src/editable-table/utils.js +1 -1
- 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/theme/ap-batch-action/ap-batch-action.css +2 -0
- package/package.json +3 -3
- package/es/src/business/ap-label/ApLabel.vue.d.ts +0 -56
- package/es/src/business/ap-label/ApLabel.vue.mjs +0 -4
- package/es/src/business/ap-label/ApLabel.vue2.mjs +0 -85
- package/lib/src/business/ap-label/ApLabel.vue.d.ts +0 -56
- package/lib/src/business/ap-label/ApLabel.vue2.js +0 -1
- /package/es/src/ap-modal/{type.mjs → interface.mjs} +0 -0
- /package/lib/src/ap-modal/{type.js → interface.js} +0 -0
|
@@ -1,35 +1,41 @@
|
|
|
1
1
|
import { withInstall as o } from "@aplus-frontend/utils";
|
|
2
2
|
import "./title/ApTitle.vue.mjs";
|
|
3
3
|
import "./expandAlert/ApExpandAlert.vue.mjs";
|
|
4
|
-
import "./ap-label/ApLabel.
|
|
5
|
-
import
|
|
4
|
+
import t from "./ap-label/ApLabel.mjs";
|
|
5
|
+
import m from "./ap-label/ApLabelGroup.mjs";
|
|
6
6
|
import "./ap-status/ApStatus.vue.mjs";
|
|
7
7
|
import "./ap-status/ApStatusGroup.vue.mjs";
|
|
8
8
|
import "./ap-select-layout/select-layout.vue.mjs";
|
|
9
9
|
import "./ap-export-group/ApExportGroup.vue.mjs";
|
|
10
10
|
import "./ap-input-radio/ApInputRadio.vue.mjs";
|
|
11
11
|
import "./ap-batch-action/ApBatchAction.vue.mjs";
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
12
|
+
import "./ap-batch-action-group/ApBatchActionGroup.vue.mjs";
|
|
13
|
+
import "./ap-image/ApImage.vue.mjs";
|
|
14
|
+
import { ApTransformDataHelper as X } from "../utils/ap-trans-data/index.mjs";
|
|
15
|
+
import "./ap-batch-action-group/interface.mjs";
|
|
16
|
+
import p from "./title/ApTitle.vue2.mjs";
|
|
17
|
+
import r from "./expandAlert/ApExpandAlert.vue2.mjs";
|
|
16
18
|
import i from "./ap-status/ApStatus.vue2.mjs";
|
|
17
19
|
import n from "./ap-status/ApStatusGroup.vue2.mjs";
|
|
18
|
-
import
|
|
20
|
+
import c from "./ap-select-layout/select-layout.vue2.mjs";
|
|
19
21
|
import a from "./ap-export-group/ApExportGroup.vue2.mjs";
|
|
20
|
-
import
|
|
22
|
+
import s from "./ap-input-radio/ApInputRadio.vue2.mjs";
|
|
21
23
|
import f from "./ap-batch-action/ApBatchAction.vue2.mjs";
|
|
22
|
-
|
|
24
|
+
import _ from "./ap-batch-action-group/ApBatchActionGroup.vue2.mjs";
|
|
25
|
+
import A from "./ap-image/ApImage.vue2.mjs";
|
|
26
|
+
const v = o(p), z = r, C = o(t), F = o(i), J = o(n), K = o(c), M = o(a), N = s, O = f, P = m, Q = _, U = A;
|
|
23
27
|
export {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
O as ApBatchAction,
|
|
29
|
+
Q as ApBatchActionGroup,
|
|
30
|
+
z as ApExpandAlert,
|
|
31
|
+
M as ApExportGroup,
|
|
32
|
+
U as ApImage,
|
|
33
|
+
N as ApInputRadio,
|
|
34
|
+
C as ApLabel,
|
|
35
|
+
P as ApLabelGroup,
|
|
36
|
+
K as ApSelectLayout,
|
|
37
|
+
F as ApStatus,
|
|
38
|
+
J as ApStatusGroup,
|
|
39
|
+
v as ApTitle,
|
|
40
|
+
X as ApTransformDataHelper
|
|
35
41
|
};
|
|
@@ -39,7 +39,7 @@ export type ApUploadConfig = {
|
|
|
39
39
|
accept?: string;
|
|
40
40
|
};
|
|
41
41
|
export type ValueTypeRenderConfig = {
|
|
42
|
-
render?: (text: any, renderProps: Recordable) => VNode;
|
|
42
|
+
render?: (text: any, record: Recordable, renderProps: Recordable) => VNode;
|
|
43
43
|
renderFormItem?: (fieldProps: Recordable) => VNode;
|
|
44
44
|
};
|
|
45
45
|
export type ApDescriptionsConfig = {
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Table as
|
|
1
|
+
import { defineComponent as q, ref as y, unref as o, useSlots as G, watch as H, openBlock as d, createBlock as C, mergeProps as b, withCtx as m, createVNode as w, createSlots as I, createElementBlock as M, normalizeClass as W, createCommentVNode as R, createElementVNode as $, toDisplayString as Q, normalizeStyle as U, renderList as J, renderSlot as X, normalizeProps as Y, guardReactiveProps as Z } from "vue";
|
|
2
|
+
import { Table as ee, Tooltip as oe } from "ant-design-vue";
|
|
3
3
|
import { ApForm as B } from "../ap-form/index.mjs";
|
|
4
|
-
import { isNumber as i, cloneDeep as f, omit as
|
|
4
|
+
import { isNumber as i, cloneDeep as f, omit as te } from "lodash-unified";
|
|
5
5
|
import "../config-provider/index.mjs";
|
|
6
|
-
import { useInjectForm as
|
|
6
|
+
import { useInjectForm as ae } from "../ap-form/context.mjs";
|
|
7
7
|
import "./style/index.css";
|
|
8
8
|
import { isDef as p } from "../utils/index.mjs";
|
|
9
|
-
import
|
|
10
|
-
import { scrollToRowIndex as
|
|
11
|
-
import { QuestionCircleOutlined as
|
|
12
|
-
import { useToken as
|
|
13
|
-
import { useNamespace as
|
|
14
|
-
|
|
9
|
+
import le from "./hooks/use-get-columns.mjs";
|
|
10
|
+
import { scrollToRowIndex as ne, getColumnIsRequired as re } from "./utils.mjs";
|
|
11
|
+
import { QuestionCircleOutlined as se } from "@ant-design/icons-vue";
|
|
12
|
+
import { useToken as ue } from "ant-design-vue/es/theme/internal";
|
|
13
|
+
import { useNamespace as me } from "../config-provider/hooks/use-namespace.mjs";
|
|
14
|
+
import { useGlobalConfig as de } from "../config-provider/hooks/use-global-config.mjs";
|
|
15
|
+
const ve = /* @__PURE__ */ q({
|
|
15
16
|
name: "EditableTableInner",
|
|
16
17
|
__name: "form-item",
|
|
17
18
|
props: {
|
|
@@ -112,26 +113,26 @@ const Re = /* @__PURE__ */ K({
|
|
|
112
113
|
}
|
|
113
114
|
},
|
|
114
115
|
setup(k, {
|
|
115
|
-
expose:
|
|
116
|
+
expose: v
|
|
116
117
|
}) {
|
|
117
118
|
var h;
|
|
118
119
|
const l = k, {
|
|
119
120
|
internalInstance: n,
|
|
120
|
-
model:
|
|
121
|
-
} =
|
|
122
|
-
H(() =>
|
|
121
|
+
model: D
|
|
122
|
+
} = ae(), r = y(((h = o(D)) == null ? void 0 : h[l.name]) || []), L = G(), T = B.useWatch(l.name);
|
|
123
|
+
H(() => T.value, (e) => {
|
|
123
124
|
var t;
|
|
124
125
|
r.value = e, (t = l.onChange) == null || t.call(l, e);
|
|
125
126
|
}, {
|
|
126
127
|
deep: !0
|
|
127
128
|
});
|
|
128
129
|
const {
|
|
129
|
-
b:
|
|
130
|
-
em:
|
|
131
|
-
} =
|
|
132
|
-
function
|
|
133
|
-
var
|
|
134
|
-
const a = ((
|
|
130
|
+
b: E,
|
|
131
|
+
em: F
|
|
132
|
+
} = me("editable-table"), c = y(), N = de("valueTypeMap"), [, S] = ue(), _ = le(l, N);
|
|
133
|
+
function z(e, t) {
|
|
134
|
+
var u;
|
|
135
|
+
const a = ((u = o(r)) == null ? void 0 : u.length) || 0;
|
|
135
136
|
if (p(l.maxLength) && a >= l.maxLength)
|
|
136
137
|
return;
|
|
137
138
|
const s = [...o(r) || []];
|
|
@@ -141,18 +142,18 @@ const Re = /* @__PURE__ */ K({
|
|
|
141
142
|
...e || {}
|
|
142
143
|
}), n == null || n.setFieldValue(l.name, [...o(r) || [], e || {}]);
|
|
143
144
|
}
|
|
144
|
-
function
|
|
145
|
+
function P(e, t = "suffix") {
|
|
145
146
|
var g;
|
|
146
147
|
const a = ((g = o(r)) == null ? void 0 : g.length) || 0, s = i(e) ? e : e.length;
|
|
147
148
|
if (p(l.maxLength) && a + s > l.maxLength)
|
|
148
149
|
return;
|
|
149
|
-
const
|
|
150
|
-
t === "suffix" ?
|
|
150
|
+
const u = [...o(r) || []], x = i(e) ? new Array(e).fill({}) : f(e);
|
|
151
|
+
t === "suffix" ? u.push(...x) : u.unshift(...x), n == null || n.setFieldValue(l.name, u);
|
|
151
152
|
}
|
|
152
|
-
function
|
|
153
|
+
function V(e) {
|
|
153
154
|
let t = f(o(r) || []);
|
|
154
155
|
const a = i(e) ? [e] : e;
|
|
155
|
-
t = t.filter((s,
|
|
156
|
+
t = t.filter((s, u) => !a.includes(u)), n == null || n.setFieldValue(l.name, t);
|
|
156
157
|
}
|
|
157
158
|
function j() {
|
|
158
159
|
return o(r);
|
|
@@ -161,49 +162,49 @@ const Re = /* @__PURE__ */ K({
|
|
|
161
162
|
var t;
|
|
162
163
|
return (t = o(r)) == null ? void 0 : t[e];
|
|
163
164
|
}
|
|
164
|
-
function
|
|
165
|
+
function A(e, t) {
|
|
165
166
|
const a = f(o(r));
|
|
166
167
|
a[e] && (a[e] = {
|
|
167
168
|
...a[e],
|
|
168
169
|
...t
|
|
169
170
|
}, n == null || n.setFieldValue(l.name, [...a]));
|
|
170
171
|
}
|
|
171
|
-
function
|
|
172
|
+
function K(e, t) {
|
|
172
173
|
var s;
|
|
173
174
|
const a = e === "end" ? r.value.length - 1 : e;
|
|
174
|
-
|
|
175
|
+
ne(a, (s = c.value) == null ? void 0 : s.$el, t);
|
|
175
176
|
}
|
|
176
|
-
return
|
|
177
|
-
add:
|
|
178
|
-
remove:
|
|
177
|
+
return v({
|
|
178
|
+
add: z,
|
|
179
|
+
remove: V,
|
|
179
180
|
getRowData: O,
|
|
180
181
|
getRowsData: j,
|
|
181
|
-
setRowData:
|
|
182
|
-
addMultiple:
|
|
183
|
-
scrollTo:
|
|
184
|
-
}), (e, t) => (
|
|
182
|
+
setRowData: A,
|
|
183
|
+
addMultiple: P,
|
|
184
|
+
scrollTo: K
|
|
185
|
+
}), (e, t) => (d(), C(o(B).FormItem, b(e.formItem, {
|
|
185
186
|
name: e.name,
|
|
186
187
|
label: e.label
|
|
187
188
|
}), {
|
|
188
|
-
default: m(() => [w(o(
|
|
189
|
-
class: o(
|
|
190
|
-
columns: o(
|
|
189
|
+
default: m(() => [w(o(ee), b(o(te)(l, ["name", "maxLength", "onChange"]), {
|
|
190
|
+
class: o(E)(),
|
|
191
|
+
columns: o(_),
|
|
191
192
|
"data-source": r.value,
|
|
192
193
|
ref_key: "tableRef",
|
|
193
194
|
ref: c
|
|
194
195
|
}), I({
|
|
195
196
|
headerCell: m(({
|
|
196
197
|
column: a
|
|
197
|
-
}) => [o(
|
|
198
|
+
}) => [o(re)(a) ? (d(), M("span", {
|
|
198
199
|
key: 0,
|
|
199
|
-
class:
|
|
200
|
-
}, "*", 2)) : R("", !0),
|
|
200
|
+
class: W(o(F)("header-cell", "required"))
|
|
201
|
+
}, "*", 2)) : R("", !0), $("span", null, Q(a.title), 1), a.tooltip ? (d(), C(o(oe), {
|
|
201
202
|
key: 1,
|
|
202
203
|
title: a.tooltip,
|
|
203
204
|
placement: "bottom"
|
|
204
205
|
}, {
|
|
205
|
-
default: m(() => [w(o(
|
|
206
|
-
style:
|
|
206
|
+
default: m(() => [w(o(se), {
|
|
207
|
+
style: U({
|
|
207
208
|
paddingLeft: "4px",
|
|
208
209
|
color: o(S).colorPrimary
|
|
209
210
|
})
|
|
@@ -211,14 +212,14 @@ const Re = /* @__PURE__ */ K({
|
|
|
211
212
|
_: 2
|
|
212
213
|
}, 1032, ["title"])) : R("", !0)]),
|
|
213
214
|
_: 2
|
|
214
|
-
}, [
|
|
215
|
+
}, [J(L, (a, s) => ({
|
|
215
216
|
name: s,
|
|
216
|
-
fn: m((
|
|
217
|
+
fn: m((u) => [X(e.$slots, s, Y(Z(u || {})))])
|
|
217
218
|
}))]), 1040, ["class", "columns", "data-source"])]),
|
|
218
219
|
_: 3
|
|
219
220
|
}, 16, ["name", "label"]));
|
|
220
221
|
}
|
|
221
222
|
});
|
|
222
223
|
export {
|
|
223
|
-
|
|
224
|
+
ve as default
|
|
224
225
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { ComputedRef } from 'vue';
|
|
1
|
+
import { ComputedRef, Ref } from 'vue';
|
|
2
2
|
import { EditableTableFormItemProps, EditableTableProps } from '../interface';
|
|
3
|
+
import { ValueTypeRenderConfig } from '../../config-provider';
|
|
3
4
|
import { ColumnType } from 'ant-design-vue/es/table';
|
|
4
|
-
declare const useGetColumns: (props: EditableTableProps | EditableTableFormItemProps) => ComputedRef<ColumnType<any>[]>;
|
|
5
|
+
declare const useGetColumns: (props: EditableTableProps | EditableTableFormItemProps, extraValueTypes: Ref<Record<string, ValueTypeRenderConfig> | undefined>) => ComputedRef<ColumnType<any>[]>;
|
|
5
6
|
export default useGetColumns;
|
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
import { computed as
|
|
2
|
-
import { omit as
|
|
3
|
-
import { mergeClass as
|
|
4
|
-
import { updateFormProps as
|
|
1
|
+
import { computed as g, unref as F } from "vue";
|
|
2
|
+
import { omit as b, isFunction as x } from "lodash-unified";
|
|
3
|
+
import { mergeClass as R, getFinalNode as h } from "../utils.mjs";
|
|
4
|
+
import { updateFormProps as C, getFieldProps as I, getPlaceholder as y, getTableRenderProps as T } from "../../ap-table/utils.mjs";
|
|
5
5
|
import "../../config-provider/index.mjs";
|
|
6
|
-
import { useLocale as
|
|
7
|
-
const
|
|
6
|
+
import { useLocale as N } from "../../config-provider/hooks/use-locale.mjs";
|
|
7
|
+
const k = (o, i) => {
|
|
8
8
|
const {
|
|
9
|
-
t:
|
|
10
|
-
} =
|
|
11
|
-
return
|
|
9
|
+
t: s
|
|
10
|
+
} = N();
|
|
11
|
+
return g(() => {
|
|
12
12
|
let d = o.columns;
|
|
13
13
|
return d ? (d = d.map((e) => ({
|
|
14
|
-
...
|
|
14
|
+
...b(e, ["ellipsis"]),
|
|
15
15
|
customRender({
|
|
16
|
-
value:
|
|
17
|
-
...
|
|
16
|
+
value: a,
|
|
17
|
+
...n
|
|
18
18
|
}) {
|
|
19
|
-
const
|
|
19
|
+
const t = x(e.editable) ? e.editable(n.text, n.record, n.index) : !!e.editable;
|
|
20
20
|
if (!e.valueType && !e.customRender && !e.customRenderFormItem)
|
|
21
21
|
return console.warn("can not render table cell because no `valueType` / `customRender` / `customRenderFormItem`"), null;
|
|
22
22
|
let c;
|
|
23
|
-
if (
|
|
24
|
-
const
|
|
25
|
-
value:
|
|
26
|
-
...
|
|
23
|
+
if (t) {
|
|
24
|
+
const l = C(e, I(e.fieldProps, {
|
|
25
|
+
value: a,
|
|
26
|
+
...n
|
|
27
27
|
})), u = {};
|
|
28
|
-
o.onFieldChange && (u[`onUpdate:${
|
|
28
|
+
o.onFieldChange && (u[`onUpdate:${l.valuePropName || "value"}`] = (f) => {
|
|
29
29
|
var m;
|
|
30
|
-
return (m = o.onFieldChange) == null ? void 0 : m.call(o,
|
|
30
|
+
return (m = o.onFieldChange) == null ? void 0 : m.call(o, n.index, e.dataIndex, f);
|
|
31
31
|
}), c = {
|
|
32
|
-
name: [o.name,
|
|
33
|
-
...
|
|
32
|
+
name: [o.name, n.index, e.dataIndex],
|
|
33
|
+
...l || {},
|
|
34
34
|
// 格式化placeholder
|
|
35
|
-
placeholder:
|
|
35
|
+
placeholder: y(s, e.valueType, l == null ? void 0 : l.placeholder),
|
|
36
36
|
field: {
|
|
37
37
|
style: "width: 100%",
|
|
38
|
-
...(
|
|
38
|
+
...(l == null ? void 0 : l.field) || {},
|
|
39
39
|
...u,
|
|
40
|
-
class:
|
|
40
|
+
class: R("is-editable", l.class)
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
} else
|
|
44
44
|
c = {
|
|
45
|
-
field:
|
|
46
|
-
value:
|
|
47
|
-
...
|
|
45
|
+
field: T(e, {
|
|
46
|
+
value: a,
|
|
47
|
+
...n
|
|
48
48
|
})
|
|
49
49
|
};
|
|
50
|
-
const r =
|
|
50
|
+
const r = h(e, t, c, a, n.record, F(i));
|
|
51
51
|
return e.customRender ? e.customRender({
|
|
52
|
-
value:
|
|
53
|
-
...
|
|
54
|
-
editable:
|
|
52
|
+
value: a,
|
|
53
|
+
...n,
|
|
54
|
+
editable: t,
|
|
55
55
|
originalNode: r
|
|
56
56
|
}) : r;
|
|
57
57
|
}
|
|
@@ -59,5 +59,5 @@ const $ = (o) => {
|
|
|
59
59
|
});
|
|
60
60
|
};
|
|
61
61
|
export {
|
|
62
|
-
|
|
62
|
+
k as default
|
|
63
63
|
};
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Table as
|
|
3
|
-
import { ApForm as
|
|
4
|
-
import { isEqual as
|
|
1
|
+
import { defineComponent as Q, useSlots as J, ref as b, watch as R, unref as n, openBlock as p, createBlock as B, withCtx as m, createVNode as x, mergeProps as X, createSlots as Y, createElementBlock as Z, normalizeClass as ee, createCommentVNode as F, createElementVNode as te, toDisplayString as ae, normalizeStyle as oe, renderList as ne, renderSlot as le, normalizeProps as re, guardReactiveProps as se } from "vue";
|
|
2
|
+
import { Table as ue, Tooltip as ie } from "ant-design-vue";
|
|
3
|
+
import { ApForm as y } from "../ap-form/index.mjs";
|
|
4
|
+
import { isEqual as de, isArray as k, isNumber as g, cloneDeep as h, omit as me } from "lodash-unified";
|
|
5
5
|
import "../config-provider/index.mjs";
|
|
6
6
|
import "../hooks/index.mjs";
|
|
7
7
|
import { isDef as C } from "../utils/index.mjs";
|
|
8
|
-
import { scrollToRowIndex as
|
|
9
|
-
import
|
|
8
|
+
import { scrollToRowIndex as fe, getColumnIsRequired as ce } from "./utils.mjs";
|
|
9
|
+
import pe from "./hooks/use-get-columns.mjs";
|
|
10
10
|
import "./style/index.css";
|
|
11
|
-
import { useToken as
|
|
12
|
-
import { QuestionCircleOutlined as
|
|
13
|
-
import { useNamespace as
|
|
14
|
-
import { useControllableValue as
|
|
15
|
-
|
|
11
|
+
import { useToken as xe } from "ant-design-vue/es/theme/internal";
|
|
12
|
+
import { QuestionCircleOutlined as ye } from "@ant-design/icons-vue";
|
|
13
|
+
import { useNamespace as ge } from "../config-provider/hooks/use-namespace.mjs";
|
|
14
|
+
import { useControllableValue as he } from "../hooks/useControllableValue.mjs";
|
|
15
|
+
import { useGlobalConfig as Ce } from "../config-provider/hooks/use-global-config.mjs";
|
|
16
|
+
const Ae = /* @__PURE__ */ Q({
|
|
16
17
|
name: "EditableTable",
|
|
17
18
|
__name: "index",
|
|
18
19
|
props: {
|
|
@@ -111,142 +112,142 @@ const De = /* @__PURE__ */ G({
|
|
|
111
112
|
onFieldChange: {}
|
|
112
113
|
},
|
|
113
114
|
emits: ["update:value"],
|
|
114
|
-
setup(
|
|
115
|
-
expose:
|
|
116
|
-
emit:
|
|
115
|
+
setup(V, {
|
|
116
|
+
expose: E,
|
|
117
|
+
emit: L
|
|
117
118
|
}) {
|
|
118
|
-
const l =
|
|
119
|
-
b:
|
|
120
|
-
em:
|
|
121
|
-
} =
|
|
119
|
+
const l = V, {
|
|
120
|
+
b: N,
|
|
121
|
+
em: T
|
|
122
|
+
} = ge("editable-table"), _ = J(), D = L, v = b(), {
|
|
122
123
|
value: s,
|
|
123
|
-
updateValue:
|
|
124
|
-
} =
|
|
125
|
-
|
|
124
|
+
updateValue: S
|
|
125
|
+
} = he(l, D), u = b(), [, A] = xe(), z = Ce("valueTypeMap"), c = y.useWatch(l.name, u);
|
|
126
|
+
R(() => c.value, (e) => {
|
|
126
127
|
var t;
|
|
127
|
-
|
|
128
|
+
S(e), (t = l.onChange) == null || t.call(l, e);
|
|
128
129
|
}, {
|
|
129
130
|
deep: !0
|
|
130
|
-
}),
|
|
131
|
+
}), R(s, (e) => {
|
|
131
132
|
var t;
|
|
132
|
-
e !==
|
|
133
|
+
e !== n(c) && (de(e, n(c)) || (t = u.value) == null || t.setFieldValue(l.name, e));
|
|
133
134
|
}, {
|
|
134
135
|
deep: !0
|
|
135
136
|
});
|
|
136
|
-
const
|
|
137
|
-
function
|
|
137
|
+
const P = pe(l, z);
|
|
138
|
+
function I() {
|
|
138
139
|
var e;
|
|
139
140
|
(e = u.value) == null || e.resetFields();
|
|
140
141
|
}
|
|
141
|
-
function
|
|
142
|
+
function O(e) {
|
|
142
143
|
return e ? (k(e) ? e : [e]).map((a) => k(a) ? [l.name, ...a] : [l.name, a]) : void 0;
|
|
143
144
|
}
|
|
144
|
-
async function
|
|
145
|
-
var
|
|
146
|
-
const a = await ((
|
|
145
|
+
async function j(e, t) {
|
|
146
|
+
var o;
|
|
147
|
+
const a = await ((o = u.value) == null ? void 0 : o.validateFields(O(e), t));
|
|
147
148
|
return a == null ? void 0 : a[l.name];
|
|
148
149
|
}
|
|
149
|
-
function
|
|
150
|
+
function q(e, t) {
|
|
150
151
|
var r, i, d;
|
|
151
|
-
const a = ((r =
|
|
152
|
+
const a = ((r = n(s)) == null ? void 0 : r.length) || 0;
|
|
152
153
|
if (C(l.maxLength) && a >= l.maxLength)
|
|
153
154
|
return;
|
|
154
|
-
const
|
|
155
|
-
C(t) ?
|
|
155
|
+
const o = [...n(s) || []];
|
|
156
|
+
C(t) ? o.splice(t, 0, {
|
|
156
157
|
...e || {}
|
|
157
|
-
}) :
|
|
158
|
+
}) : o.push({
|
|
158
159
|
...e || {}
|
|
159
|
-
}), (d = (i = u.value) == null ? void 0 : i.setFieldValue) == null || d.call(i, l.name,
|
|
160
|
+
}), (d = (i = u.value) == null ? void 0 : i.setFieldValue) == null || d.call(i, l.name, o);
|
|
160
161
|
}
|
|
161
|
-
function
|
|
162
|
+
function K(e, t = "suffix") {
|
|
162
163
|
var d, f, w;
|
|
163
|
-
const a = ((d =
|
|
164
|
-
if (C(l.maxLength) && a +
|
|
164
|
+
const a = ((d = n(s)) == null ? void 0 : d.length) || 0, o = g(e) ? e : e.length;
|
|
165
|
+
if (C(l.maxLength) && a + o > l.maxLength)
|
|
165
166
|
return;
|
|
166
|
-
const r = [...
|
|
167
|
+
const r = [...n(s) || []], i = g(e) ? new Array(e).fill({}) : h(e);
|
|
167
168
|
t === "suffix" ? r.push(...i) : r.unshift(...i), (w = (f = u.value) == null ? void 0 : f.setFieldValue) == null || w.call(f, l.name, r);
|
|
168
169
|
}
|
|
169
|
-
function
|
|
170
|
-
var
|
|
171
|
-
let t =
|
|
172
|
-
const a =
|
|
173
|
-
t = t.filter((i, d) => !a.includes(d)), (r = (
|
|
170
|
+
function M(e) {
|
|
171
|
+
var o, r;
|
|
172
|
+
let t = h(n(s) || []);
|
|
173
|
+
const a = g(e) ? [e] : e;
|
|
174
|
+
t = t.filter((i, d) => !a.includes(d)), (r = (o = u.value) == null ? void 0 : o.setFieldValue) == null || r.call(o, l.name, t);
|
|
174
175
|
}
|
|
175
|
-
function
|
|
176
|
-
return
|
|
176
|
+
function G() {
|
|
177
|
+
return n(s);
|
|
177
178
|
}
|
|
178
|
-
function
|
|
179
|
+
function H(e) {
|
|
179
180
|
var t;
|
|
180
|
-
return (t =
|
|
181
|
+
return (t = n(s)) == null ? void 0 : t[e];
|
|
181
182
|
}
|
|
182
183
|
function U(e, t) {
|
|
183
|
-
var
|
|
184
|
-
const a =
|
|
184
|
+
var o, r;
|
|
185
|
+
const a = h(n(s));
|
|
185
186
|
a[e] && (a[e] = {
|
|
186
187
|
...a[e],
|
|
187
188
|
...t
|
|
188
|
-
}, (r = (
|
|
189
|
+
}, (r = (o = u.value) == null ? void 0 : o.setFieldValue) == null || r.call(o, l.name, [...a]));
|
|
189
190
|
}
|
|
190
191
|
function W(e, t) {
|
|
191
|
-
var
|
|
192
|
+
var o;
|
|
192
193
|
const a = e === "end" ? s.value.length - 1 : e;
|
|
193
|
-
|
|
194
|
+
fe(a, (o = v.value) == null ? void 0 : o.$el, t);
|
|
194
195
|
}
|
|
195
196
|
function $() {
|
|
196
197
|
var e, t;
|
|
197
198
|
(t = (e = u.value) == null ? void 0 : e.setFieldValue) == null || t.call(e, l.name, []);
|
|
198
199
|
}
|
|
199
|
-
return
|
|
200
|
-
resetFields:
|
|
201
|
-
validateFields:
|
|
202
|
-
add:
|
|
203
|
-
remove:
|
|
204
|
-
getRowData:
|
|
205
|
-
getRowsData:
|
|
200
|
+
return E({
|
|
201
|
+
resetFields: I,
|
|
202
|
+
validateFields: j,
|
|
203
|
+
add: q,
|
|
204
|
+
remove: M,
|
|
205
|
+
getRowData: H,
|
|
206
|
+
getRowsData: G,
|
|
206
207
|
setRowData: U,
|
|
207
|
-
addMultiple:
|
|
208
|
+
addMultiple: K,
|
|
208
209
|
scrollTo: W,
|
|
209
210
|
clear: $
|
|
210
|
-
}), (e, t) => (p(), B(
|
|
211
|
+
}), (e, t) => (p(), B(n(y), {
|
|
211
212
|
"initial-values": {
|
|
212
|
-
[l.name]:
|
|
213
|
+
[l.name]: n(s)
|
|
213
214
|
},
|
|
214
215
|
ref_key: "formRef",
|
|
215
216
|
ref: u
|
|
216
217
|
}, {
|
|
217
|
-
default: m(() => [x(
|
|
218
|
+
default: m(() => [x(n(y).FormItem, {
|
|
218
219
|
name: e.name,
|
|
219
220
|
"no-style": ""
|
|
220
221
|
}, {
|
|
221
|
-
default: m(() => [x(
|
|
222
|
-
class:
|
|
223
|
-
columns:
|
|
224
|
-
"data-source":
|
|
222
|
+
default: m(() => [x(n(ue), X(n(me)(l, ["name", "value", "onUpdate:value", "maxLength", "onChange"]), {
|
|
223
|
+
class: n(N)(),
|
|
224
|
+
columns: n(P),
|
|
225
|
+
"data-source": n(s),
|
|
225
226
|
ref_key: "tableRef",
|
|
226
227
|
ref: v
|
|
227
|
-
}),
|
|
228
|
+
}), Y({
|
|
228
229
|
headerCell: m(({
|
|
229
230
|
column: a
|
|
230
|
-
}) => [
|
|
231
|
+
}) => [n(ce)(a) ? (p(), Z("span", {
|
|
231
232
|
key: 0,
|
|
232
|
-
class:
|
|
233
|
-
}, "*", 2)) : F("", !0),
|
|
233
|
+
class: ee(n(T)("header-cell", "required"))
|
|
234
|
+
}, "*", 2)) : F("", !0), te("span", null, ae(a.title), 1), a.tooltip ? (p(), B(n(ie), {
|
|
234
235
|
key: 1,
|
|
235
236
|
title: a.tooltip,
|
|
236
237
|
placement: "bottom"
|
|
237
238
|
}, {
|
|
238
|
-
default: m(() => [x(
|
|
239
|
-
style:
|
|
239
|
+
default: m(() => [x(n(ye), {
|
|
240
|
+
style: oe({
|
|
240
241
|
paddingLeft: "4px",
|
|
241
|
-
color:
|
|
242
|
+
color: n(A).colorPrimary
|
|
242
243
|
})
|
|
243
244
|
}, null, 8, ["style"])]),
|
|
244
245
|
_: 2
|
|
245
246
|
}, 1032, ["title"])) : F("", !0)]),
|
|
246
247
|
_: 2
|
|
247
|
-
}, [ne(
|
|
248
|
-
name:
|
|
249
|
-
fn: m((r) => [
|
|
248
|
+
}, [ne(_, (a, o) => ({
|
|
249
|
+
name: o,
|
|
250
|
+
fn: m((r) => [le(e.$slots, o, re(se(r || {})))])
|
|
250
251
|
}))]), 1040, ["class", "columns", "data-source"])]),
|
|
251
252
|
_: 3
|
|
252
253
|
}, 8, ["name"])]),
|
|
@@ -255,5 +256,5 @@ const De = /* @__PURE__ */ G({
|
|
|
255
256
|
}
|
|
256
257
|
});
|
|
257
258
|
export {
|
|
258
|
-
|
|
259
|
+
Ae as default
|
|
259
260
|
};
|