@aplus-frontend/ui 0.0.39 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/index.mjs +149 -148
- package/es/src/ap-action/item/index.vue2.mjs +19 -20
- package/es/src/ap-action/item-modal/index.vue.mjs +7 -6
- package/es/src/ap-action/style/item.css +10 -25
- package/es/src/ap-field/checkbox/index.vue.mjs +32 -27
- package/es/src/ap-field/checkbox/style.css +7 -0
- package/es/src/ap-field/interface.d.ts +3 -1
- package/es/src/ap-field/radio/index.vue.d.ts +3 -0
- package/es/src/ap-field/radio/index.vue.mjs +44 -29
- package/es/src/ap-field/radio/style.css +4 -0
- package/es/src/ap-field/text-area/index.vue.mjs +9 -10
- package/es/src/ap-form/style/ap-form-item.css +6 -6
- package/es/src/ap-table/ap-table.vue.d.ts +6 -0
- package/es/src/ap-table/ap-table.vue.mjs +124 -124
- package/es/src/ap-table/constants.d.ts +15 -6
- package/es/src/ap-table/style/ap-table.css +1 -21
- package/es/src/business/ap-export-group/ApExportGroup.vue.d.ts +14 -0
- package/es/src/business/ap-export-group/ApExportGroup.vue.mjs +4 -0
- package/es/src/business/ap-export-group/ApExportGroup.vue2.mjs +117 -0
- package/es/src/business/ap-export-group/interface.d.ts +37 -0
- package/es/src/business/ap-export-group/interface.mjs +4 -0
- package/es/src/business/ap-status/ApStatusGroup.vue2.mjs +10 -9
- package/es/src/business/index.d.ts +105 -0
- package/es/src/business/index.mjs +12 -9
- package/es/src/check-card/index.vue2.mjs +44 -48
- package/es/src/check-card/style/index.css +10 -42
- package/es/src/config-provider/config-provider.mjs +22 -17
- package/es/src/design-token/index.mjs +4 -2
- package/es/src/editable-table/form-item.vue.d.ts +4 -0
- package/es/src/editable-table/form-item.vue.mjs +75 -68
- package/es/src/editable-table/index.vue.d.ts +4 -0
- package/es/src/editable-table/index.vue.mjs +79 -72
- package/es/src/editable-table/interface.d.ts +8 -0
- package/es/src/editable-table/style/index.css +1 -21
- package/es/src/editable-table/utils.d.ts +8 -0
- package/es/src/editable-table/utils.mjs +29 -18
- package/es/src/index.mjs +175 -174
- package/es/src/locale/lang/en.mjs +7 -1
- package/es/src/locale/lang/zh-cn.mjs +28 -22
- package/es/src/theme/ap-action/item.css +10 -25
- package/es/src/theme/ap-field/checkbox.css +7 -0
- package/es/src/theme/ap-field/radio.css +4 -0
- package/es/src/theme/ap-form/ap-form-item.css +6 -6
- package/es/src/theme/ap-table/ap-table.css +1 -21
- package/es/src/theme/check-card/index.css +10 -42
- package/es/src/theme/css-var/index.d.ts +7 -0
- package/es/src/theme/css-var/index.mjs +109 -0
- package/es/src/theme/editable-table/index.css +1 -21
- package/lib/index.js +1 -1
- package/lib/src/ap-action/item/index.vue2.js +1 -1
- package/lib/src/ap-action/item-modal/index.vue.js +1 -1
- package/lib/src/ap-action/style/item.css +10 -25
- package/lib/src/ap-field/checkbox/index.vue.js +1 -1
- package/lib/src/ap-field/checkbox/style.css +7 -0
- package/lib/src/ap-field/interface.d.ts +3 -1
- package/lib/src/ap-field/radio/index.vue.d.ts +3 -0
- package/lib/src/ap-field/radio/index.vue.js +1 -1
- package/lib/src/ap-field/radio/style.css +4 -0
- package/lib/src/ap-field/text-area/index.vue.js +1 -1
- package/lib/src/ap-form/style/ap-form-item.css +6 -6
- package/lib/src/ap-table/ap-table.vue.d.ts +6 -0
- package/lib/src/ap-table/ap-table.vue.js +1 -1
- package/lib/src/ap-table/constants.d.ts +15 -6
- package/lib/src/ap-table/style/ap-table.css +1 -21
- package/lib/src/business/ap-export-group/ApExportGroup.vue.d.ts +14 -0
- package/lib/src/business/ap-export-group/ApExportGroup.vue.js +1 -0
- package/lib/src/business/ap-export-group/ApExportGroup.vue2.js +1 -0
- package/lib/src/business/ap-export-group/interface.d.ts +37 -0
- package/lib/src/business/ap-export-group/interface.js +1 -0
- package/lib/src/business/ap-status/ApStatusGroup.vue2.js +1 -1
- package/lib/src/business/index.d.ts +105 -0
- package/lib/src/business/index.js +1 -1
- package/lib/src/check-card/index.vue2.js +1 -1
- package/lib/src/check-card/style/index.css +10 -42
- package/lib/src/config-provider/config-provider.js +1 -1
- package/lib/src/design-token/index.js +1 -1
- package/lib/src/editable-table/form-item.vue.d.ts +4 -0
- package/lib/src/editable-table/form-item.vue.js +1 -1
- package/lib/src/editable-table/index.vue.d.ts +4 -0
- package/lib/src/editable-table/index.vue.js +1 -1
- package/lib/src/editable-table/interface.d.ts +8 -0
- package/lib/src/editable-table/style/index.css +1 -21
- package/lib/src/editable-table/utils.d.ts +8 -0
- 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-action/item.css +10 -25
- package/lib/src/theme/ap-field/checkbox.css +7 -0
- package/lib/src/theme/ap-field/radio.css +4 -0
- package/lib/src/theme/ap-form/ap-form-item.css +6 -6
- package/lib/src/theme/ap-table/ap-table.css +1 -21
- package/lib/src/theme/check-card/index.css +10 -42
- package/lib/src/theme/css-var/index.d.ts +7 -0
- package/lib/src/theme/css-var/index.js +1 -0
- package/lib/src/theme/editable-table/index.css +1 -21
- package/package.json +6 -5
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Table as
|
|
3
|
-
import { ApForm as
|
|
4
|
-
import { isNumber as u, cloneDeep as
|
|
1
|
+
import { defineComponent as V, ref as x, unref as t, useSlots as A, watch as O, openBlock as C, createBlock as K, mergeProps as w, withCtx as m, createVNode as q, createSlots as H, createElementBlock as I, Fragment as W, createElementVNode as b, normalizeClass as $, toDisplayString as G, createCommentVNode as M, renderList as U, renderSlot as J, normalizeProps as Q, guardReactiveProps as X } from "vue";
|
|
2
|
+
import { Table as Y } from "ant-design-vue";
|
|
3
|
+
import { ApForm as y } from "../ap-form/index.mjs";
|
|
4
|
+
import { isNumber as u, cloneDeep as f, omit as Z } from "lodash-unified";
|
|
5
5
|
import "../config-provider/index.mjs";
|
|
6
|
-
import { useInjectForm as
|
|
6
|
+
import { useInjectForm as ee } from "../ap-form/context.mjs";
|
|
7
7
|
import "./style/index.css";
|
|
8
|
-
import { isDef as
|
|
9
|
-
import
|
|
10
|
-
import { getColumnIsRequired as
|
|
11
|
-
import { useNamespace as
|
|
12
|
-
|
|
13
|
-
const ge = /* @__PURE__ */ P({
|
|
8
|
+
import { isDef as c } from "../utils/index.mjs";
|
|
9
|
+
import oe from "./hooks/use-get-columns.mjs";
|
|
10
|
+
import { scrollToRowIndex as te, getColumnIsRequired as ae } from "./utils.mjs";
|
|
11
|
+
import { useNamespace as ne } from "../config-provider/hooks/use-namespace.mjs";
|
|
12
|
+
const ge = /* @__PURE__ */ V({
|
|
14
13
|
name: "EditableTableInner",
|
|
15
14
|
__name: "form-item",
|
|
16
15
|
props: {
|
|
@@ -110,88 +109,96 @@ const ge = /* @__PURE__ */ P({
|
|
|
110
109
|
default: () => ({})
|
|
111
110
|
}
|
|
112
111
|
},
|
|
113
|
-
setup(
|
|
114
|
-
expose:
|
|
112
|
+
setup(R, {
|
|
113
|
+
expose: B
|
|
115
114
|
}) {
|
|
116
|
-
var
|
|
117
|
-
const
|
|
115
|
+
var p;
|
|
116
|
+
const n = R, {
|
|
118
117
|
internalInstance: l,
|
|
119
|
-
model:
|
|
120
|
-
} =
|
|
118
|
+
model: D
|
|
119
|
+
} = ee(), r = x(((p = t(D)) == null ? void 0 : p[n.name]) || []), v = A(), F = y.useWatch(n.name);
|
|
121
120
|
O(() => F.value, (e) => {
|
|
122
|
-
var
|
|
123
|
-
r.value = e, (
|
|
121
|
+
var o;
|
|
122
|
+
r.value = e, (o = n.onChange) == null || o.call(n, e);
|
|
124
123
|
});
|
|
125
124
|
const {
|
|
126
|
-
b:
|
|
127
|
-
em:
|
|
128
|
-
} =
|
|
129
|
-
function
|
|
130
|
-
var
|
|
131
|
-
const
|
|
132
|
-
if (
|
|
125
|
+
b: E,
|
|
126
|
+
em: L
|
|
127
|
+
} = ne("editable-table"), i = x(), N = oe(n);
|
|
128
|
+
function k(e, o) {
|
|
129
|
+
var d;
|
|
130
|
+
const a = ((d = t(r)) == null ? void 0 : d.length) || 0;
|
|
131
|
+
if (c(n.maxLength) && a >= n.maxLength)
|
|
133
132
|
return;
|
|
134
|
-
const
|
|
135
|
-
|
|
133
|
+
const s = [...t(r) || []];
|
|
134
|
+
c(o) ? s.splice(o, 0, {
|
|
136
135
|
...e || {}
|
|
137
|
-
}) :
|
|
136
|
+
}) : s.push({
|
|
138
137
|
...e || {}
|
|
139
|
-
}), l == null || l.setFieldValue(
|
|
138
|
+
}), l == null || l.setFieldValue(n.name, [...t(r) || [], e || {}]);
|
|
140
139
|
}
|
|
141
|
-
function S(e,
|
|
140
|
+
function S(e, o = "suffix") {
|
|
142
141
|
var g;
|
|
143
|
-
const
|
|
144
|
-
if (
|
|
142
|
+
const a = ((g = t(r)) == null ? void 0 : g.length) || 0, s = u(e) ? e : e.length;
|
|
143
|
+
if (c(n.maxLength) && a + s > n.maxLength)
|
|
145
144
|
return;
|
|
146
|
-
const
|
|
147
|
-
|
|
145
|
+
const d = [...t(r) || []], h = u(e) ? new Array(e).fill({}) : f(e);
|
|
146
|
+
o === "suffix" ? d.push(...h) : d.unshift(...h), l == null || l.setFieldValue(n.name, d);
|
|
148
147
|
}
|
|
149
|
-
function
|
|
150
|
-
let
|
|
151
|
-
const
|
|
152
|
-
|
|
148
|
+
function _(e) {
|
|
149
|
+
let o = f(t(r) || []);
|
|
150
|
+
const a = u(e) ? [e] : e;
|
|
151
|
+
o = o.filter((s, d) => !a.includes(d)), l == null || l.setFieldValue(n.name, o);
|
|
153
152
|
}
|
|
154
|
-
function
|
|
155
|
-
return
|
|
153
|
+
function T() {
|
|
154
|
+
return t(r);
|
|
156
155
|
}
|
|
157
156
|
function j(e) {
|
|
158
|
-
var
|
|
159
|
-
return (
|
|
157
|
+
var o;
|
|
158
|
+
return (o = t(r)) == null ? void 0 : o[e];
|
|
159
|
+
}
|
|
160
|
+
function z(e, o) {
|
|
161
|
+
const a = f(t(r));
|
|
162
|
+
a[e] && (a[e] = {
|
|
163
|
+
...a[e],
|
|
164
|
+
...o
|
|
165
|
+
}, l == null || l.setFieldValue(n.name, [...a]));
|
|
160
166
|
}
|
|
161
|
-
function
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
...t
|
|
166
|
-
}, l == null || l.setFieldValue(a.name, [...n]));
|
|
167
|
+
function P(e, o) {
|
|
168
|
+
var s;
|
|
169
|
+
const a = e === "end" ? r.value.length - 1 : e;
|
|
170
|
+
te(a, (s = i.value) == null ? void 0 : s.$el, o);
|
|
167
171
|
}
|
|
168
|
-
return
|
|
169
|
-
add:
|
|
170
|
-
remove:
|
|
172
|
+
return B({
|
|
173
|
+
add: k,
|
|
174
|
+
remove: _,
|
|
171
175
|
getRowData: j,
|
|
172
|
-
getRowsData:
|
|
176
|
+
getRowsData: T,
|
|
173
177
|
setRowData: z,
|
|
174
|
-
addMultiple: S
|
|
175
|
-
|
|
178
|
+
addMultiple: S,
|
|
179
|
+
scrollTo: P
|
|
180
|
+
}), (e, o) => (C(), K(t(y).FormItem, w(e.formItem, {
|
|
176
181
|
name: e.name,
|
|
177
182
|
label: e.label
|
|
178
183
|
}), {
|
|
179
|
-
default: m(() => [
|
|
180
|
-
class:
|
|
181
|
-
columns:
|
|
182
|
-
"data-source": r.value
|
|
183
|
-
|
|
184
|
+
default: m(() => [q(t(Y), w(t(Z)(n, ["name", "maxLength", "onChange"]), {
|
|
185
|
+
class: t(E)(),
|
|
186
|
+
columns: t(N),
|
|
187
|
+
"data-source": r.value,
|
|
188
|
+
ref_key: "tableRef",
|
|
189
|
+
ref: i
|
|
190
|
+
}), H({
|
|
184
191
|
headerCell: m(({
|
|
185
|
-
column:
|
|
186
|
-
}) => [
|
|
192
|
+
column: a
|
|
193
|
+
}) => [t(ae)(a) ? (C(), I(W, {
|
|
187
194
|
key: 0
|
|
188
|
-
}, [
|
|
189
|
-
class:
|
|
190
|
-
}, "*", 2),
|
|
195
|
+
}, [b("span", {
|
|
196
|
+
class: $(t(L)("header-cell", "required"))
|
|
197
|
+
}, "*", 2), b("span", null, G(a.title), 1)], 64)) : M("", !0)]),
|
|
191
198
|
_: 2
|
|
192
|
-
}, [U(
|
|
193
|
-
name:
|
|
194
|
-
fn: m((
|
|
199
|
+
}, [U(v, (a, s) => ({
|
|
200
|
+
name: s,
|
|
201
|
+
fn: m((d) => [J(e.$slots, s, Q(X(d || {})))])
|
|
195
202
|
}))]), 1040, ["class", "columns", "data-source"])]),
|
|
196
203
|
_: 3
|
|
197
204
|
}, 16, ["name", "label"]));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { EditableColumnType } from './interface';
|
|
2
2
|
import { NamePath, ValidateOptions } from 'ant-design-vue/es/form/interface';
|
|
3
3
|
import { Recordable } from '../type';
|
|
4
|
+
import { StandardBehaviorOptions } from '../../node_modules/scroll-into-view-if-needed';
|
|
4
5
|
import { ExtractPropTypes, PropType, VNode, RendererNode, RendererElement, CSSProperties, VNodeProps, AllowedComponentProps, ComponentCustomProps, ShallowUnwrapRef } from 'vue';
|
|
5
6
|
import { SpinSize } from 'ant-design-vue/es/spin/Spin';
|
|
6
7
|
import { VueTypeValidableDef } from '../../node_modules/vue-types';
|
|
@@ -210,6 +211,7 @@ declare const _default: <RecordType extends Recordable = any>(__VLS_props: {
|
|
|
210
211
|
getRowsData: () => UnwrapRefSimple<RecordType>[];
|
|
211
212
|
setRowData: (index: number, payload: any) => void;
|
|
212
213
|
addMultiple: (list: number | Partial<RecordType>[], insetIn?: 'prefix' | 'suffix') => void;
|
|
214
|
+
scrollTo: (index: number | 'end', options?: StandardBehaviorOptions) => void;
|
|
213
215
|
}>) => void) | undefined, __VLS_setup?: Promise<{
|
|
214
216
|
props: {
|
|
215
217
|
loading?: boolean | Partial< ExtractPropTypes<{
|
|
@@ -371,6 +373,7 @@ declare const _default: <RecordType extends Recordable = any>(__VLS_props: {
|
|
|
371
373
|
getRowsData: () => UnwrapRefSimple<RecordType>[];
|
|
372
374
|
setRowData: (index: number, payload: any) => void;
|
|
373
375
|
addMultiple: (list: number | Partial<RecordType>[], insetIn?: 'prefix' | 'suffix') => void;
|
|
376
|
+
scrollTo: (index: number | 'end', options?: StandardBehaviorOptions) => void;
|
|
374
377
|
}>): void;
|
|
375
378
|
attrs: any;
|
|
376
379
|
slots: Readonly<{
|
|
@@ -569,6 +572,7 @@ declare const _default: <RecordType extends Recordable = any>(__VLS_props: {
|
|
|
569
572
|
getRowsData: () => UnwrapRefSimple<RecordType>[];
|
|
570
573
|
setRowData: (index: number, payload: any) => void;
|
|
571
574
|
addMultiple: (list: number | Partial<RecordType>[], insetIn?: 'prefix' | 'suffix') => void;
|
|
575
|
+
scrollTo: (index: number | 'end', options?: StandardBehaviorOptions) => void;
|
|
572
576
|
}>): void;
|
|
573
577
|
attrs: any;
|
|
574
578
|
slots: Readonly<{
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Table as
|
|
1
|
+
import { defineComponent as q, useSlots as H, ref as w, watch as U, unref as o, openBlock as y, createBlock as W, withCtx as c, createVNode as v, mergeProps as $, createSlots as G, createElementBlock as M, Fragment as J, createElementVNode as b, normalizeClass as Q, toDisplayString as X, createCommentVNode as Y, renderList as Z, renderSlot as ee, normalizeProps as te, guardReactiveProps as ae } from "vue";
|
|
2
|
+
import { Table as ne } from "ant-design-vue";
|
|
3
3
|
import { ApForm as f } from "../ap-form/index.mjs";
|
|
4
|
-
import { isNumber as p, cloneDeep as h, omit as
|
|
4
|
+
import { isNumber as p, cloneDeep as h, omit as oe } from "lodash-unified";
|
|
5
5
|
import "../config-provider/index.mjs";
|
|
6
6
|
import "../hooks/index.mjs";
|
|
7
7
|
import { isDef as x } from "../utils/index.mjs";
|
|
8
|
-
import { getColumnIsRequired as
|
|
9
|
-
import
|
|
8
|
+
import { scrollToRowIndex as le, getColumnIsRequired as re } from "./utils.mjs";
|
|
9
|
+
import se from "./hooks/use-get-columns.mjs";
|
|
10
10
|
import "./style/index.css";
|
|
11
|
-
import { useNamespace as
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
const be = /* @__PURE__ */ T({
|
|
11
|
+
import { useNamespace as ue } from "../config-provider/hooks/use-namespace.mjs";
|
|
12
|
+
import { useControllableValue as de } from "../hooks/useControllableValue.mjs";
|
|
13
|
+
const be = /* @__PURE__ */ q({
|
|
15
14
|
name: "EditableTable",
|
|
16
15
|
__name: "index",
|
|
17
16
|
props: {
|
|
@@ -110,108 +109,116 @@ const be = /* @__PURE__ */ T({
|
|
|
110
109
|
onFieldChange: {}
|
|
111
110
|
},
|
|
112
111
|
emits: ["update:value"],
|
|
113
|
-
setup(
|
|
114
|
-
expose:
|
|
115
|
-
emit:
|
|
112
|
+
setup(R, {
|
|
113
|
+
expose: B,
|
|
114
|
+
emit: F
|
|
116
115
|
}) {
|
|
117
|
-
const l =
|
|
118
|
-
b:
|
|
119
|
-
em:
|
|
120
|
-
} =
|
|
116
|
+
const l = R, {
|
|
117
|
+
b: D,
|
|
118
|
+
em: _
|
|
119
|
+
} = ue("editable-table"), k = H(), E = F, g = w(), {
|
|
121
120
|
value: s,
|
|
122
121
|
updateValue: L
|
|
123
|
-
} =
|
|
124
|
-
|
|
125
|
-
var
|
|
126
|
-
L(e), (
|
|
122
|
+
} = de(l, E), u = w(), N = f.useWatch(l.name, u);
|
|
123
|
+
U(() => N.value, (e) => {
|
|
124
|
+
var a;
|
|
125
|
+
L(e), (a = l.onChange) == null || a.call(l, e);
|
|
127
126
|
});
|
|
128
|
-
const
|
|
129
|
-
function
|
|
127
|
+
const S = se(l);
|
|
128
|
+
function V() {
|
|
130
129
|
var e;
|
|
131
130
|
(e = u.value) == null || e.resetFields();
|
|
132
131
|
}
|
|
133
|
-
async function
|
|
132
|
+
async function T(e, a) {
|
|
134
133
|
var t;
|
|
135
|
-
const
|
|
136
|
-
return
|
|
134
|
+
const n = await ((t = u.value) == null ? void 0 : t.validateFields(e, a));
|
|
135
|
+
return n == null ? void 0 : n[l.name];
|
|
137
136
|
}
|
|
138
|
-
function z(e,
|
|
137
|
+
function z(e, a) {
|
|
139
138
|
var r, d, i;
|
|
140
|
-
const
|
|
141
|
-
if (x(l.maxLength) &&
|
|
139
|
+
const n = ((r = o(s)) == null ? void 0 : r.length) || 0;
|
|
140
|
+
if (x(l.maxLength) && n >= l.maxLength)
|
|
142
141
|
return;
|
|
143
|
-
const t = [...
|
|
144
|
-
x(
|
|
142
|
+
const t = [...o(s) || []];
|
|
143
|
+
x(a) ? t.splice(a, 0, {
|
|
145
144
|
...e || {}
|
|
146
145
|
}) : t.push({
|
|
147
146
|
...e || {}
|
|
148
147
|
}), (i = (d = u.value) == null ? void 0 : d.setFieldValue) == null || i.call(d, l.name, t);
|
|
149
148
|
}
|
|
150
|
-
function
|
|
149
|
+
function I(e, a = "suffix") {
|
|
151
150
|
var i, m, C;
|
|
152
|
-
const
|
|
153
|
-
if (x(l.maxLength) &&
|
|
151
|
+
const n = ((i = o(s)) == null ? void 0 : i.length) || 0, t = p(e) ? e : e.length;
|
|
152
|
+
if (x(l.maxLength) && n + t > l.maxLength)
|
|
154
153
|
return;
|
|
155
|
-
const r = [...
|
|
156
|
-
|
|
154
|
+
const r = [...o(s) || []], d = p(e) ? new Array(e).fill({}) : h(e);
|
|
155
|
+
a === "suffix" ? r.push(...d) : r.unshift(...d), (C = (m = u.value) == null ? void 0 : m.setFieldValue) == null || C.call(m, l.name, r);
|
|
157
156
|
}
|
|
158
|
-
function
|
|
157
|
+
function P(e) {
|
|
159
158
|
var t, r;
|
|
160
|
-
let
|
|
161
|
-
const
|
|
162
|
-
|
|
159
|
+
let a = h(o(s) || []);
|
|
160
|
+
const n = p(e) ? [e] : e;
|
|
161
|
+
a = a.filter((d, i) => !n.includes(i)), (r = (t = u.value) == null ? void 0 : t.setFieldValue) == null || r.call(t, l.name, a);
|
|
163
162
|
}
|
|
164
|
-
function
|
|
165
|
-
return
|
|
163
|
+
function j() {
|
|
164
|
+
return o(s);
|
|
166
165
|
}
|
|
167
|
-
function
|
|
168
|
-
var
|
|
169
|
-
return (
|
|
166
|
+
function A(e) {
|
|
167
|
+
var a;
|
|
168
|
+
return (a = o(s)) == null ? void 0 : a[e];
|
|
170
169
|
}
|
|
171
|
-
function O(e,
|
|
170
|
+
function O(e, a) {
|
|
172
171
|
var t, r;
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
...
|
|
176
|
-
...
|
|
177
|
-
}, (r = (t = u.value) == null ? void 0 : t.setFieldValue) == null || r.call(t, l.name, [...
|
|
172
|
+
const n = h(o(s));
|
|
173
|
+
n[e] && (n[e] = {
|
|
174
|
+
...n[e],
|
|
175
|
+
...a
|
|
176
|
+
}, (r = (t = u.value) == null ? void 0 : t.setFieldValue) == null || r.call(t, l.name, [...n]));
|
|
178
177
|
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
178
|
+
function K(e, a) {
|
|
179
|
+
var t;
|
|
180
|
+
const n = e === "end" ? s.value.length - 1 : e;
|
|
181
|
+
le(n, (t = g.value) == null ? void 0 : t.$el, a);
|
|
182
|
+
}
|
|
183
|
+
return B({
|
|
184
|
+
resetFields: V,
|
|
185
|
+
validateFields: T,
|
|
182
186
|
add: z,
|
|
183
|
-
remove:
|
|
184
|
-
getRowData:
|
|
185
|
-
getRowsData:
|
|
187
|
+
remove: P,
|
|
188
|
+
getRowData: A,
|
|
189
|
+
getRowsData: j,
|
|
186
190
|
setRowData: O,
|
|
187
|
-
addMultiple:
|
|
188
|
-
|
|
191
|
+
addMultiple: I,
|
|
192
|
+
scrollTo: K
|
|
193
|
+
}), (e, a) => (y(), W(o(f), {
|
|
189
194
|
"initial-values": {
|
|
190
|
-
[l.name]:
|
|
195
|
+
[l.name]: o(s)
|
|
191
196
|
},
|
|
192
197
|
ref_key: "formRef",
|
|
193
198
|
ref: u
|
|
194
199
|
}, {
|
|
195
|
-
default: c(() => [
|
|
200
|
+
default: c(() => [v(o(f).FormItem, {
|
|
196
201
|
name: e.name,
|
|
197
202
|
"no-style": ""
|
|
198
203
|
}, {
|
|
199
|
-
default: c(() => [
|
|
200
|
-
class:
|
|
201
|
-
columns:
|
|
202
|
-
"data-source":
|
|
203
|
-
|
|
204
|
+
default: c(() => [v(o(ne), $(o(oe)(l, ["name", "value", "onUpdate:value", "maxLength", "onChange"]), {
|
|
205
|
+
class: o(D)(),
|
|
206
|
+
columns: o(S),
|
|
207
|
+
"data-source": o(s),
|
|
208
|
+
ref_key: "tableRef",
|
|
209
|
+
ref: g
|
|
210
|
+
}), G({
|
|
204
211
|
headerCell: c(({
|
|
205
|
-
column:
|
|
206
|
-
}) => [
|
|
212
|
+
column: n
|
|
213
|
+
}) => [o(re)(n) ? (y(), M(J, {
|
|
207
214
|
key: 0
|
|
208
|
-
}, [
|
|
209
|
-
class:
|
|
210
|
-
}, "*", 2),
|
|
215
|
+
}, [b("span", {
|
|
216
|
+
class: Q(o(_)("header-cell", "required"))
|
|
217
|
+
}, "*", 2), b("span", null, X(n.title), 1)], 64)) : Y("", !0)]),
|
|
211
218
|
_: 2
|
|
212
|
-
}, [
|
|
219
|
+
}, [Z(k, (n, t) => ({
|
|
213
220
|
name: t,
|
|
214
|
-
fn: c((r) => [
|
|
221
|
+
fn: c((r) => [ee(e.$slots, t, te(ae(r || {})))])
|
|
215
222
|
}))]), 1040, ["class", "columns", "data-source"])]),
|
|
216
223
|
_: 3
|
|
217
224
|
}, 8, ["name"])]),
|
|
@@ -5,6 +5,7 @@ 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
|
+
import { StandardBehaviorOptions } from '../../node_modules/scroll-into-view-if-needed';
|
|
8
9
|
|
|
9
10
|
export type EditableColumnType<RecordType = any, ValueType extends ApTableValueTypes = ApTableValueTypes> = ValueType extends ApTableValueTypes ? Omit<ColumnType<RecordType>, 'children' | 'customRender' | 'ellipsis'> & {
|
|
10
11
|
children?: EditableColumnType<RecordType, ValueType>;
|
|
@@ -158,6 +159,13 @@ export type EditableTableExpose<ModelType = any, RecordType = any> = {
|
|
|
158
159
|
* @returns
|
|
159
160
|
*/
|
|
160
161
|
setRowData: (index: number, data: Partial<RecordType>) => void;
|
|
162
|
+
/**
|
|
163
|
+
* 滚动到表格的某行
|
|
164
|
+
* @param index
|
|
165
|
+
* @param options
|
|
166
|
+
* @returns
|
|
167
|
+
*/
|
|
168
|
+
scrollTo: (index: number | 'end', options?: StandardBehaviorOptions) => void;
|
|
161
169
|
};
|
|
162
170
|
/**
|
|
163
171
|
* 可编辑表格作为表单项暴露的实例
|
|
@@ -12,31 +12,11 @@
|
|
|
12
12
|
flex: 1;
|
|
13
13
|
}
|
|
14
14
|
.aplus-editable-table tr > th.ant-table-cell {
|
|
15
|
-
background-color:
|
|
16
|
-
border-bottom-color: #E9EDF3;
|
|
15
|
+
background-color: var(--ap-table-header-bg);
|
|
17
16
|
}
|
|
18
17
|
.aplus-editable-table tr > th.ant-table-cell::before {
|
|
19
18
|
display: none;
|
|
20
19
|
}
|
|
21
|
-
.aplus-editable-table tr > td.ant-table-cell {
|
|
22
|
-
border-top-color: #E9EDF3;
|
|
23
|
-
}
|
|
24
|
-
.aplus-editable-table-admin .ant-pagination {
|
|
25
|
-
margin-bottom: 0 !important;
|
|
26
|
-
}
|
|
27
|
-
.aplus-editable-table-admin .ant-pagination .ant-pagination-total-text {
|
|
28
|
-
flex: 1;
|
|
29
|
-
}
|
|
30
|
-
.aplus-editable-table-admin tr > th.ant-table-cell {
|
|
31
|
-
background-color: #FAFAFA;
|
|
32
|
-
border-bottom-color: #E9E9E9;
|
|
33
|
-
}
|
|
34
|
-
.aplus-editable-table-admin tr > th.ant-table-cell::before {
|
|
35
|
-
display: none;
|
|
36
|
-
}
|
|
37
|
-
.aplus-editable-table-admin tr > td.ant-table-cell {
|
|
38
|
-
border-top-color: #E9E9E9;
|
|
39
|
-
}
|
|
40
20
|
.aplus-editable-table .ant-table.ant-table-middle .ant-table-row .ant-table-cell:has(.is-editable) {
|
|
41
21
|
padding: 20px 16px 0px;
|
|
42
22
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EditableColumnType } from './interface';
|
|
2
|
+
import { StandardBehaviorOptions } from '../../node_modules/scroll-into-view-if-needed';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* 获取编辑模式下默认映射的组件
|
|
@@ -20,3 +21,10 @@ export declare function getColumnIsRequired(column: EditableColumnType<any, 'tex
|
|
|
20
21
|
*/
|
|
21
22
|
export declare function getRawDisplayValue(column: EditableColumnType, value: any): any;
|
|
22
23
|
export declare function mergeClass(current: string, classNames?: string | string[]): string;
|
|
24
|
+
/**
|
|
25
|
+
* 滚动到表格的某行
|
|
26
|
+
* @param index
|
|
27
|
+
* @param container
|
|
28
|
+
* @param options
|
|
29
|
+
*/
|
|
30
|
+
export declare function scrollToRowIndex(index: number, container?: HTMLElement, options?: StandardBehaviorOptions): void;
|
|
@@ -1,39 +1,50 @@
|
|
|
1
|
-
import { isFunction as
|
|
1
|
+
import { isFunction as i, isArray as n } from "lodash-unified";
|
|
2
2
|
import { apTableFormItemMap as s } from "../ap-table/constants.mjs";
|
|
3
3
|
import { isDef as f } from "../utils/index.mjs";
|
|
4
|
-
import { getValueStr as
|
|
5
|
-
|
|
4
|
+
import { getValueStr as l } from "../ap-field/number/helper.mjs";
|
|
5
|
+
import d from "scroll-into-view-if-needed";
|
|
6
|
+
function m(r) {
|
|
6
7
|
const e = s[r];
|
|
7
8
|
return e || console.warn(
|
|
8
9
|
`${r} can not render because of no default renderer, use customRender instead.`
|
|
9
10
|
), e;
|
|
10
11
|
}
|
|
11
|
-
function
|
|
12
|
+
function b(r) {
|
|
12
13
|
if (!r.fieldProps)
|
|
13
14
|
return !1;
|
|
14
|
-
const e =
|
|
15
|
-
return f(e.required) ? e.required : (n(e.rules) ? e.rules : e.rules ? [e.rules] : []).some((
|
|
15
|
+
const e = i(r.fieldProps) ? r.fieldProps({}) : r.fieldProps;
|
|
16
|
+
return f(e.required) ? e.required : (n(e.rules) ? e.rules : e.rules ? [e.rules] : []).some((t) => t.required);
|
|
16
17
|
}
|
|
17
|
-
function
|
|
18
|
+
function g(r, e) {
|
|
18
19
|
if (r.valueType === "text" || r.valueType === "textArea")
|
|
19
20
|
return e || "--";
|
|
20
21
|
if (r.valueType === "number") {
|
|
21
|
-
const
|
|
22
|
-
return
|
|
22
|
+
const o = r.fieldProps ? i(r.fieldProps) ? r.fieldProps({}) : r.fieldProps : {};
|
|
23
|
+
return l(e, o) || "--";
|
|
23
24
|
}
|
|
24
25
|
return e;
|
|
25
26
|
}
|
|
26
|
-
function
|
|
27
|
-
const
|
|
27
|
+
function w(r, e) {
|
|
28
|
+
const o = [r];
|
|
28
29
|
if (e) {
|
|
29
|
-
const
|
|
30
|
-
|
|
30
|
+
const t = n(e) ? e : [e];
|
|
31
|
+
o.unshift(...t);
|
|
31
32
|
}
|
|
32
|
-
return
|
|
33
|
+
return o.join(" ");
|
|
34
|
+
}
|
|
35
|
+
function y(r, e = document.body, o = {}) {
|
|
36
|
+
const t = e.querySelectorAll("tr.ant-table-row")[r];
|
|
37
|
+
console.log(t), t && d(t, {
|
|
38
|
+
scrollMode: "if-needed",
|
|
39
|
+
block: "nearest",
|
|
40
|
+
behavior: "smooth",
|
|
41
|
+
...o
|
|
42
|
+
});
|
|
33
43
|
}
|
|
34
44
|
export {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
45
|
+
b as getColumnIsRequired,
|
|
46
|
+
m as getEditableComponent,
|
|
47
|
+
g as getRawDisplayValue,
|
|
48
|
+
w as mergeClass,
|
|
49
|
+
y as scrollToRowIndex
|
|
39
50
|
};
|