@aplus-frontend/ui 0.1.15 → 0.1.17
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 +99 -95
- 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 +132 -129
- package/es/src/ap-table/interface.d.ts +19 -13
- package/es/src/ap-table/utils.d.ts +8340 -1
- package/es/src/ap-table/utils.mjs +134 -78
- 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/index.d.ts +662 -1
- package/es/src/business/index.mjs +25 -16
- 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 -71
- 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 +106 -92
- 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 -57
- package/es/src/index.mjs +211 -207
- package/es/src/locale/lang/en.mjs +10 -7
- package/es/src/locale/lang/zh-cn.mjs +3 -0
- package/es/src/pro-form/hooks/use-label-width.d.ts +1 -1
- package/es/src/theme/antd-global-overwrite/admin/form.css +10 -5
- package/es/src/theme/antd-global-overwrite/admin/index.css +117 -38
- 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 -14
- package/es/src/theme/antd-global-overwrite/aplus/index.css +159 -67
- 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-batch-action/ap-batch-action.css +2 -0
- package/es/src/utils/ap-trans-data/index.d.ts +9 -10
- package/es/src/utils/ap-trans-data/index.mjs +20 -0
- package/lib/index.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 +19 -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-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-image/ApImage.vue.js +1 -0
- 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/index.d.ts +662 -1
- 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/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/pro-form/hooks/use-label-width.d.ts +1 -1
- package/lib/src/theme/antd-global-overwrite/admin/form.css +10 -5
- package/lib/src/theme/antd-global-overwrite/admin/index.css +117 -38
- 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 -14
- package/lib/src/theme/antd-global-overwrite/aplus/index.css +159 -67
- 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-batch-action/ap-batch-action.css +2 -0
- package/lib/src/utils/ap-trans-data/index.d.ts +9 -10
- package/lib/src/utils/ap-trans-data/index.js +1 -0
- package/package.json +2 -2
- /package/es/src/ap-modal/{type.mjs → interface.mjs} +0 -0
- /package/lib/src/ap-modal/{type.js → interface.js} +0 -0
|
@@ -1,16 +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
|
-
import { isDef as
|
|
8
|
-
import { scrollToRowIndex as
|
|
9
|
-
import
|
|
7
|
+
import { isDef as C } from "../utils/index.mjs";
|
|
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 {
|
|
12
|
-
import {
|
|
13
|
-
|
|
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({
|
|
14
17
|
name: "EditableTable",
|
|
15
18
|
__name: "index",
|
|
16
19
|
props: {
|
|
@@ -109,131 +112,142 @@ const Ee = /* @__PURE__ */ W({
|
|
|
109
112
|
onFieldChange: {}
|
|
110
113
|
},
|
|
111
114
|
emits: ["update:value"],
|
|
112
|
-
setup(
|
|
113
|
-
expose:
|
|
114
|
-
emit:
|
|
115
|
+
setup(V, {
|
|
116
|
+
expose: E,
|
|
117
|
+
emit: L
|
|
115
118
|
}) {
|
|
116
|
-
const
|
|
117
|
-
b:
|
|
118
|
-
em:
|
|
119
|
-
} =
|
|
119
|
+
const l = V, {
|
|
120
|
+
b: N,
|
|
121
|
+
em: T
|
|
122
|
+
} = ge("editable-table"), _ = J(), D = L, v = b(), {
|
|
120
123
|
value: s,
|
|
121
124
|
updateValue: S
|
|
122
|
-
} =
|
|
123
|
-
|
|
125
|
+
} = he(l, D), u = b(), [, A] = xe(), z = Ce("valueTypeMap"), c = y.useWatch(l.name, u);
|
|
126
|
+
R(() => c.value, (e) => {
|
|
124
127
|
var t;
|
|
125
|
-
S(e), (t =
|
|
128
|
+
S(e), (t = l.onChange) == null || t.call(l, e);
|
|
126
129
|
}, {
|
|
127
130
|
deep: !0
|
|
128
|
-
}),
|
|
131
|
+
}), R(s, (e) => {
|
|
129
132
|
var t;
|
|
130
|
-
e !==
|
|
133
|
+
e !== n(c) && (de(e, n(c)) || (t = u.value) == null || t.setFieldValue(l.name, e));
|
|
131
134
|
}, {
|
|
132
135
|
deep: !0
|
|
133
136
|
});
|
|
134
|
-
const
|
|
135
|
-
function
|
|
137
|
+
const P = pe(l, z);
|
|
138
|
+
function I() {
|
|
136
139
|
var e;
|
|
137
140
|
(e = u.value) == null || e.resetFields();
|
|
138
141
|
}
|
|
139
|
-
function
|
|
140
|
-
return e ? (
|
|
142
|
+
function O(e) {
|
|
143
|
+
return e ? (k(e) ? e : [e]).map((a) => k(a) ? [l.name, ...a] : [l.name, a]) : void 0;
|
|
141
144
|
}
|
|
142
|
-
async function
|
|
143
|
-
var
|
|
144
|
-
const a = await ((
|
|
145
|
-
return a == null ? void 0 : a[
|
|
145
|
+
async function j(e, t) {
|
|
146
|
+
var o;
|
|
147
|
+
const a = await ((o = u.value) == null ? void 0 : o.validateFields(O(e), t));
|
|
148
|
+
return a == null ? void 0 : a[l.name];
|
|
146
149
|
}
|
|
147
|
-
function
|
|
148
|
-
var r,
|
|
149
|
-
const a = ((r =
|
|
150
|
-
if (
|
|
150
|
+
function q(e, t) {
|
|
151
|
+
var r, i, d;
|
|
152
|
+
const a = ((r = n(s)) == null ? void 0 : r.length) || 0;
|
|
153
|
+
if (C(l.maxLength) && a >= l.maxLength)
|
|
151
154
|
return;
|
|
152
|
-
const
|
|
153
|
-
|
|
155
|
+
const o = [...n(s) || []];
|
|
156
|
+
C(t) ? o.splice(t, 0, {
|
|
154
157
|
...e || {}
|
|
155
|
-
}) :
|
|
158
|
+
}) : o.push({
|
|
156
159
|
...e || {}
|
|
157
|
-
}), (
|
|
160
|
+
}), (d = (i = u.value) == null ? void 0 : i.setFieldValue) == null || d.call(i, l.name, o);
|
|
158
161
|
}
|
|
159
|
-
function
|
|
160
|
-
var
|
|
161
|
-
const a = ((
|
|
162
|
-
if (
|
|
162
|
+
function K(e, t = "suffix") {
|
|
163
|
+
var d, f, w;
|
|
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)
|
|
163
166
|
return;
|
|
164
|
-
const r = [...
|
|
165
|
-
t === "suffix" ? r.push(...
|
|
167
|
+
const r = [...n(s) || []], i = g(e) ? new Array(e).fill({}) : h(e);
|
|
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);
|
|
166
169
|
}
|
|
167
|
-
function
|
|
168
|
-
var
|
|
169
|
-
let t =
|
|
170
|
-
const a =
|
|
171
|
-
t = t.filter((
|
|
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);
|
|
172
175
|
}
|
|
173
|
-
function
|
|
174
|
-
return
|
|
176
|
+
function G() {
|
|
177
|
+
return n(s);
|
|
175
178
|
}
|
|
176
|
-
function
|
|
179
|
+
function H(e) {
|
|
177
180
|
var t;
|
|
178
|
-
return (t =
|
|
181
|
+
return (t = n(s)) == null ? void 0 : t[e];
|
|
179
182
|
}
|
|
180
|
-
function
|
|
181
|
-
var
|
|
182
|
-
const a =
|
|
183
|
+
function U(e, t) {
|
|
184
|
+
var o, r;
|
|
185
|
+
const a = h(n(s));
|
|
183
186
|
a[e] && (a[e] = {
|
|
184
187
|
...a[e],
|
|
185
188
|
...t
|
|
186
|
-
}, (r = (
|
|
189
|
+
}, (r = (o = u.value) == null ? void 0 : o.setFieldValue) == null || r.call(o, l.name, [...a]));
|
|
187
190
|
}
|
|
188
|
-
function
|
|
189
|
-
var
|
|
191
|
+
function W(e, t) {
|
|
192
|
+
var o;
|
|
190
193
|
const a = e === "end" ? s.value.length - 1 : e;
|
|
191
|
-
|
|
194
|
+
fe(a, (o = v.value) == null ? void 0 : o.$el, t);
|
|
192
195
|
}
|
|
193
|
-
function
|
|
196
|
+
function $() {
|
|
194
197
|
var e, t;
|
|
195
|
-
(t = (e = u.value) == null ? void 0 : e.setFieldValue) == null || t.call(e,
|
|
198
|
+
(t = (e = u.value) == null ? void 0 : e.setFieldValue) == null || t.call(e, l.name, []);
|
|
196
199
|
}
|
|
197
|
-
return
|
|
198
|
-
resetFields:
|
|
199
|
-
validateFields:
|
|
200
|
-
add:
|
|
201
|
-
remove:
|
|
202
|
-
getRowData:
|
|
203
|
-
getRowsData:
|
|
204
|
-
setRowData:
|
|
205
|
-
addMultiple:
|
|
206
|
-
scrollTo:
|
|
207
|
-
clear:
|
|
208
|
-
}), (e, t) => (
|
|
200
|
+
return E({
|
|
201
|
+
resetFields: I,
|
|
202
|
+
validateFields: j,
|
|
203
|
+
add: q,
|
|
204
|
+
remove: M,
|
|
205
|
+
getRowData: H,
|
|
206
|
+
getRowsData: G,
|
|
207
|
+
setRowData: U,
|
|
208
|
+
addMultiple: K,
|
|
209
|
+
scrollTo: W,
|
|
210
|
+
clear: $
|
|
211
|
+
}), (e, t) => (p(), B(n(y), {
|
|
209
212
|
"initial-values": {
|
|
210
|
-
[
|
|
213
|
+
[l.name]: n(s)
|
|
211
214
|
},
|
|
212
215
|
ref_key: "formRef",
|
|
213
216
|
ref: u
|
|
214
217
|
}, {
|
|
215
|
-
default:
|
|
218
|
+
default: m(() => [x(n(y).FormItem, {
|
|
216
219
|
name: e.name,
|
|
217
220
|
"no-style": ""
|
|
218
221
|
}, {
|
|
219
|
-
default:
|
|
220
|
-
class:
|
|
221
|
-
columns:
|
|
222
|
-
"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),
|
|
223
226
|
ref_key: "tableRef",
|
|
224
|
-
ref:
|
|
225
|
-
}),
|
|
226
|
-
headerCell:
|
|
227
|
+
ref: v
|
|
228
|
+
}), Y({
|
|
229
|
+
headerCell: m(({
|
|
227
230
|
column: a
|
|
228
|
-
}) => [
|
|
229
|
-
key: 0
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
231
|
+
}) => [n(ce)(a) ? (p(), Z("span", {
|
|
232
|
+
key: 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), {
|
|
235
|
+
key: 1,
|
|
236
|
+
title: a.tooltip,
|
|
237
|
+
placement: "bottom"
|
|
238
|
+
}, {
|
|
239
|
+
default: m(() => [x(n(ye), {
|
|
240
|
+
style: oe({
|
|
241
|
+
paddingLeft: "4px",
|
|
242
|
+
color: n(A).colorPrimary
|
|
243
|
+
})
|
|
244
|
+
}, null, 8, ["style"])]),
|
|
245
|
+
_: 2
|
|
246
|
+
}, 1032, ["title"])) : F("", !0)]),
|
|
233
247
|
_: 2
|
|
234
|
-
}, [
|
|
235
|
-
name:
|
|
236
|
-
fn:
|
|
248
|
+
}, [ne(_, (a, o) => ({
|
|
249
|
+
name: o,
|
|
250
|
+
fn: m((r) => [le(e.$slots, o, re(se(r || {})))])
|
|
237
251
|
}))]), 1040, ["class", "columns", "data-source"])]),
|
|
238
252
|
_: 3
|
|
239
253
|
}, 8, ["name"])]),
|
|
@@ -242,5 +256,5 @@ const Ee = /* @__PURE__ */ W({
|
|
|
242
256
|
}
|
|
243
257
|
});
|
|
244
258
|
export {
|
|
245
|
-
|
|
259
|
+
Ae as default
|
|
246
260
|
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { ColumnType, TableProps } from 'ant-design-vue/es/table';
|
|
2
|
-
import { ApTableValueFields, ApTableValueTypes, ValueEnum } from '../ap-table';
|
|
2
|
+
import { ApTableValueFields, ApTableValueTypes, CommonFieldReturnType, FieldPropsType, ValueEnum } from '../ap-table';
|
|
3
3
|
import { NamePath, ValidateOptions } from 'ant-design-vue/es/form/interface';
|
|
4
4
|
import { DataIndex } from 'ant-design-vue/es/vc-table/interface';
|
|
5
5
|
import { FormItemProps } from 'ant-design-vue';
|
|
6
6
|
import { VNode } from 'vue';
|
|
7
7
|
import { EllipsisConfig } from 'ant-design-vue/es/typography/Base';
|
|
8
8
|
import { StandardBehaviorOptions } from '../../node_modules/scroll-into-view-if-needed';
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
import { Recordable } from '../type';
|
|
10
|
+
export type EditableColumnType<RecordType = any, ExtraValueType = 'text', ValueType extends ApTableValueTypes = ApTableValueTypes, MergedValueType extends ExtraValueType | ValueType = ExtraValueType | ValueType> = MergedValueType extends ExtraValueType | ValueType ? Omit<ColumnType<RecordType>, 'children' | 'customRender' | 'ellipsis'> & {
|
|
11
|
+
children?: EditableColumnType<RecordType, ExtraValueType, ValueType, MergedValueType>;
|
|
11
12
|
/**
|
|
12
13
|
* 在title之后展示一个icon并触发tooltip
|
|
13
14
|
*/
|
|
@@ -31,22 +32,15 @@ export type EditableColumnType<RecordType = any, ValueType extends ApTableValueT
|
|
|
31
32
|
/**
|
|
32
33
|
* 自定义表单,适用于内置`valueType`不满足的情况下使用
|
|
33
34
|
*/
|
|
34
|
-
customRenderFormItem?: (config: EditableColumnType<RecordType
|
|
35
|
+
customRenderFormItem?: (config: EditableColumnType<RecordType>, fieldProps: Recordable, editable: boolean) => any;
|
|
35
36
|
/**
|
|
36
37
|
* 指定值类型(将会用于普通列和可编辑表格的渲染)
|
|
37
38
|
*/
|
|
38
|
-
valueType?:
|
|
39
|
+
valueType?: MergedValueType;
|
|
39
40
|
/**
|
|
40
41
|
* 值类型额外配置的参数(支持函数)
|
|
41
42
|
*/
|
|
42
|
-
fieldProps?: ApTableValueFields[ValueType]
|
|
43
|
-
value: any;
|
|
44
|
-
text: any;
|
|
45
|
-
record: RecordType;
|
|
46
|
-
index: number;
|
|
47
|
-
renderIndex: number;
|
|
48
|
-
column: EditableColumnType<RecordType, ValueType>;
|
|
49
|
-
}) => ApTableValueFields[ValueType]);
|
|
43
|
+
fieldProps?: FieldPropsType<Extract<MergedValueType, ValueType> extends never ? CommonFieldReturnType : ApTableValueFields[Extract<MergedValueType, ValueType>], RecordType, ExtraValueType, ValueType, MergedValueType>;
|
|
50
44
|
/**
|
|
51
45
|
* 自定义渲染,添加了`editable`以及`originalNode`
|
|
52
46
|
* @param opt
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EditableColumnType } from './interface';
|
|
2
2
|
import { StandardBehaviorOptions } from '../../node_modules/scroll-into-view-if-needed';
|
|
3
|
+
import { ValueTypeRenderConfig } from '../config-provider';
|
|
3
4
|
/**
|
|
4
5
|
* 获取编辑模式下默认映射的组件
|
|
5
6
|
* @param valueType
|
|
@@ -8,10 +9,11 @@ import { StandardBehaviorOptions } from '../../node_modules/scroll-into-view-if-
|
|
|
8
9
|
export declare function getEditableComponent(valueType: EditableColumnType['valueType']): any;
|
|
9
10
|
/**
|
|
10
11
|
* 获取可编辑表格的某列字段是否是required
|
|
12
|
+
* @description 请注意,此方法只根据`fieldProps.required`和`fieldProps.rules`来判断,并不会关注当前列是否可以渲染编辑节点
|
|
11
13
|
* @param column
|
|
12
14
|
* @returns
|
|
13
15
|
*/
|
|
14
|
-
export declare function getColumnIsRequired(column: EditableColumnType<any, 'text'>): boolean;
|
|
16
|
+
export declare function getColumnIsRequired(column: EditableColumnType<any, 'tex', 'text'>): boolean;
|
|
15
17
|
/**
|
|
16
18
|
* 获取ellipsis模式下最终需要渲染的字符串
|
|
17
19
|
* @param column
|
|
@@ -27,4 +29,14 @@ export declare function mergeClass(current: string, classNames?: string | string
|
|
|
27
29
|
* @param options
|
|
28
30
|
*/
|
|
29
31
|
export declare function scrollToRowIndex(index: number, container?: HTMLElement, options?: StandardBehaviorOptions): void;
|
|
30
|
-
|
|
32
|
+
/**
|
|
33
|
+
* 获取最终需要渲染到单元格的节点
|
|
34
|
+
* @param column 表格列配置
|
|
35
|
+
* @param editable 是否可编辑
|
|
36
|
+
* @param innerProps props
|
|
37
|
+
* @param value 当前表格映射的值
|
|
38
|
+
* @param record 当前行数据
|
|
39
|
+
* @param extraValueTypes 自定义valueType映射
|
|
40
|
+
* @returns
|
|
41
|
+
*/
|
|
42
|
+
export declare function getFinalNode(column: EditableColumnType, editable: boolean, innerProps: Record<string, any>, value: any, record: any, extraRenderMap?: Record<string, ValueTypeRenderConfig>): any;
|
|
@@ -1,90 +1,100 @@
|
|
|
1
|
-
import { isVNode as
|
|
2
|
-
import { isFunction as
|
|
3
|
-
import { apTableFormItemMap as
|
|
4
|
-
import { isDef as
|
|
5
|
-
import { getValueStr as
|
|
6
|
-
import
|
|
7
|
-
import { Typography as
|
|
1
|
+
import { isVNode as F, createVNode as f, mergeProps as g } from "vue";
|
|
2
|
+
import { isFunction as b, isArray as T, isBoolean as h, omit as P } from "lodash-unified";
|
|
3
|
+
import { apTableFormItemMap as V, noRenderAsFormItemValueList as j, apTableRenderItemMap as q } from "../ap-table/constants.mjs";
|
|
4
|
+
import { isDef as w } from "../utils/index.mjs";
|
|
5
|
+
import { getValueStr as S } from "../ap-field/number/helper.mjs";
|
|
6
|
+
import A from "scroll-into-view-if-needed";
|
|
7
|
+
import { Typography as v } from "ant-design-vue";
|
|
8
8
|
import "../ap-form/index.mjs";
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
import { objectToString as C } from "../ap-table/utils.mjs";
|
|
10
|
+
import m from "../ap-form/ap-form-item.vue.mjs";
|
|
11
|
+
function y(e) {
|
|
12
|
+
return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !F(e);
|
|
12
13
|
}
|
|
13
|
-
function
|
|
14
|
-
return
|
|
14
|
+
function N(e) {
|
|
15
|
+
return V[e];
|
|
15
16
|
}
|
|
16
|
-
function
|
|
17
|
+
function Q(e) {
|
|
17
18
|
if (!e.fieldProps)
|
|
18
19
|
return !1;
|
|
19
|
-
const
|
|
20
|
-
return
|
|
20
|
+
const t = b(e.fieldProps) ? e.fieldProps({}) : e.fieldProps;
|
|
21
|
+
return w(t.required) ? t.required : (T(t.rules) ? t.rules : t.rules ? [t.rules] : []).some((r) => r.required);
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
+
function _(e, t) {
|
|
23
24
|
if (e.valueType === "text" || e.valueType === "textArea")
|
|
24
|
-
return
|
|
25
|
+
return t || "--";
|
|
25
26
|
if (e.valueType === "number") {
|
|
26
|
-
const o = e.fieldProps ?
|
|
27
|
-
return
|
|
27
|
+
const o = e.fieldProps ? b(e.fieldProps) ? e.fieldProps({}) : e.fieldProps : {};
|
|
28
|
+
return S(t, o) || "--";
|
|
28
29
|
}
|
|
29
|
-
return
|
|
30
|
+
return C(t);
|
|
30
31
|
}
|
|
31
|
-
function
|
|
32
|
+
function R(e, t) {
|
|
32
33
|
const o = [e];
|
|
33
|
-
if (
|
|
34
|
-
const
|
|
35
|
-
o.unshift(...
|
|
34
|
+
if (t) {
|
|
35
|
+
const r = T(t) ? t : [t];
|
|
36
|
+
o.unshift(...r);
|
|
36
37
|
}
|
|
37
38
|
return o.join(" ");
|
|
38
39
|
}
|
|
39
|
-
function
|
|
40
|
-
const
|
|
41
|
-
|
|
40
|
+
function U(e, t = document.body, o = {}) {
|
|
41
|
+
const r = t.querySelectorAll("tr.ant-table-row")[e];
|
|
42
|
+
r && A(r, {
|
|
42
43
|
scrollMode: "if-needed",
|
|
43
44
|
block: "nearest",
|
|
44
45
|
behavior: "smooth",
|
|
45
46
|
...o
|
|
46
47
|
});
|
|
47
48
|
}
|
|
48
|
-
function
|
|
49
|
-
return
|
|
49
|
+
function D(e, t, o) {
|
|
50
|
+
return j.includes(e.valueType) ? o : e.copyable || e.ellipsis ? f(v.Paragraph, {
|
|
50
51
|
copyable: e.copyable ? {
|
|
51
|
-
text:
|
|
52
|
+
text: t,
|
|
52
53
|
tooltip: !1
|
|
53
54
|
} : !1,
|
|
54
|
-
ellipsis: e.ellipsis ?
|
|
55
|
-
tooltip:
|
|
55
|
+
ellipsis: e.ellipsis ? h(e.ellipsis) ? {
|
|
56
|
+
tooltip: t
|
|
56
57
|
} : {
|
|
57
58
|
...e.ellipsis,
|
|
58
|
-
tooltip:
|
|
59
|
+
tooltip: t
|
|
59
60
|
} : !1,
|
|
60
|
-
content: e.ellipsis ?
|
|
61
|
+
content: e.ellipsis ? _(e, t) : o
|
|
61
62
|
}, null) : o;
|
|
62
63
|
}
|
|
63
|
-
function
|
|
64
|
-
|
|
65
|
-
if (
|
|
66
|
-
if (
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
l = V(e, t, s(i, d(o.field, {
|
|
72
|
-
mode: "read"
|
|
73
|
-
}), null));
|
|
64
|
+
function W(e, t, o, r, I, i) {
|
|
65
|
+
var c, a;
|
|
66
|
+
if (t) {
|
|
67
|
+
if (e.customRenderFormItem) {
|
|
68
|
+
const n = e.customRenderFormItem(e, o.field, t);
|
|
69
|
+
return f(m, P(o, ["field"]), y(n) ? n : {
|
|
70
|
+
default: () => [n]
|
|
71
|
+
});
|
|
74
72
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
73
|
+
const l = N(e.valueType);
|
|
74
|
+
if (l)
|
|
75
|
+
return f(l, o, null);
|
|
76
|
+
const s = i == null ? void 0 : i[e.valueType], u = (c = s == null ? void 0 : s.renderFormItem) == null ? void 0 : c.call(s, o.field);
|
|
77
|
+
return u ? f(m, o, y(u) ? u : {
|
|
78
|
+
default: () => [u]
|
|
79
|
+
}) : null;
|
|
80
80
|
}
|
|
81
|
-
|
|
81
|
+
let p;
|
|
82
|
+
const d = q[e.valueType];
|
|
83
|
+
if (d)
|
|
84
|
+
p = f(d, g(o.field, {
|
|
85
|
+
mode: "read"
|
|
86
|
+
}), null);
|
|
87
|
+
else {
|
|
88
|
+
const l = i == null ? void 0 : i[e.valueType];
|
|
89
|
+
p = (a = l == null ? void 0 : l.render) == null ? void 0 : a.call(l, r, I, o.field);
|
|
90
|
+
}
|
|
91
|
+
return p ? D(e, r, p) : null;
|
|
82
92
|
}
|
|
83
93
|
export {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
94
|
+
Q as getColumnIsRequired,
|
|
95
|
+
N as getEditableComponent,
|
|
96
|
+
W as getFinalNode,
|
|
97
|
+
_ as getRawDisplayValue,
|
|
98
|
+
R as mergeClass,
|
|
99
|
+
U as scrollToRowIndex
|
|
90
100
|
};
|