@kp-ui/lowcode 2.15.0-alpha.14 → 2.15.0-alpha.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/package.json +1 -1
- package/src/components/FormRender/index.vue.js +5 -79
- package/src/components/FormRender/index.vue2.js +85 -2
- package/src/components/form-designer/form-widget/container-widget/data-table-widget.vue.js +3 -3
- package/src/components/form-designer/form-widget/container-widget/data-table-widget.vue2.js +36 -30
- package/src/components/form-designer/form-widget/container-widget/useTableWidget.js +58 -54
- package/src/components/form-designer/form-widget/field-widget/hooks/useSelect.js +16 -16
- package/src/components/form-designer/form-widget/field-widget/useField.js +117 -108
- package/src/components/form-designer/index.vue.js +60 -62
- package/src/components/form-designer/setting-panel/property-editor/container-data-table/data-table-tableColumns-editor.vue.js +3 -3
- package/src/components/form-designer/setting-panel/property-editor/container-data-table/data-table-tableColumns-editor.vue2.js +49 -47
- package/src/components/form-designer/toolbar-panel/PreviewDialog.vue.js +1 -1
- package/src/components/form-designer/widget-panel/advanced/data-table.js +7 -19
- package/src/components/form-render/container-items/data-table-widget.vue.js +1 -1
- package/src/components/form-render/container-items/data-table-widget.vue2.js +57 -49
- package/src/components/form-render/dynamic-dialog.vue.js +91 -94
- package/src/components/public/CustomerModal/CustomerModal.vue2.js +16 -16
- package/src/hooks/useDataHttp.js +15 -12
- package/src/lang/zh-CN.js +4 -3
- package/stats.html +1 -1
- package/styles/style.css +1 -1
package/package.json
CHANGED
|
@@ -1,81 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { useFormContext as z } from "./useFormContext.js";
|
|
6
|
-
import { useI18n as U } from "../../utils/i18n.js";
|
|
7
|
-
import { storeToRefs as $ } from "pinia";
|
|
8
|
-
import { useLocaleStore as j } from "@kp-ui/i18n";
|
|
9
|
-
import { getLocat as q } from "@kp-ui/tool";
|
|
10
|
-
import A from "./Debugger.vue.js";
|
|
11
|
-
import { useComRef as G } from "tmgc2-share";
|
|
12
|
-
const H = { class: "form-render-wrapper" }, ne = /* @__PURE__ */ D({
|
|
13
|
-
name: "VFormRender",
|
|
14
|
-
componentName: "VFormRender",
|
|
15
|
-
__name: "index",
|
|
16
|
-
props: {
|
|
17
|
-
vfCtx: { default: () => ({}) },
|
|
18
|
-
formJson: { default: () => ({ widgetList: [], formConfig: {} }) },
|
|
19
|
-
formData: { default: () => ({}) },
|
|
20
|
-
optionData: { default: () => ({}) },
|
|
21
|
-
disabledMode: { type: Boolean, default: !1 },
|
|
22
|
-
renderConfig: { default: () => ({ languageName: "zh-CN" }) },
|
|
23
|
-
globalDsv: { default: () => ({}) },
|
|
24
|
-
parentForm: { default: null },
|
|
25
|
-
dynamicCreation: { type: Boolean, default: !1 },
|
|
26
|
-
debug: { type: Boolean }
|
|
27
|
-
},
|
|
28
|
-
emits: ["form-submit", "form-cancel"],
|
|
29
|
-
setup(d, { expose: p, emit: g }) {
|
|
30
|
-
const { initLocale: b } = U(), v = j(), { locale: r } = $(v), C = L(() => q().debug === "1"), n = s(!1);
|
|
31
|
-
V();
|
|
32
|
-
const m = d, a = s(), o = G(c), _ = g, e = z({
|
|
33
|
-
props: m,
|
|
34
|
-
renderForm: a
|
|
35
|
-
}), F = (l) => {
|
|
36
|
-
_("form-submit", l);
|
|
37
|
-
}, x = () => (console.log(o.value), o.value);
|
|
38
|
-
S(() => {
|
|
39
|
-
e.registerToRefList("v_form_ref");
|
|
40
|
-
}), h(
|
|
41
|
-
r,
|
|
42
|
-
() => {
|
|
43
|
-
b(r.value);
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
immediate: !0
|
|
47
|
-
}
|
|
48
|
-
);
|
|
49
|
-
const y = () => {
|
|
50
|
-
}, { dynamicDialgRef: N, dialogProps: R, emitter: k } = e;
|
|
51
|
-
return p({
|
|
52
|
-
...k,
|
|
53
|
-
...e,
|
|
54
|
-
getNativeForm: x,
|
|
55
|
-
setLoading: y,
|
|
56
|
-
formJson: m.formJson,
|
|
57
|
-
renderForm: a
|
|
58
|
-
}), (l, i) => (f(), w(J, null, [
|
|
59
|
-
E("div", H, [
|
|
60
|
-
u(t(c), {
|
|
61
|
-
ref_key: "formContainer",
|
|
62
|
-
ref: o,
|
|
63
|
-
context: t(e),
|
|
64
|
-
onFormSubmit: F
|
|
65
|
-
}, null, 8, ["context"]),
|
|
66
|
-
u(T, P(t(R), {
|
|
67
|
-
ref_key: "dynamicDialgRef",
|
|
68
|
-
ref: N
|
|
69
|
-
}), null, 16)
|
|
70
|
-
]),
|
|
71
|
-
C.value ? (f(), I(A, {
|
|
72
|
-
key: 0,
|
|
73
|
-
visible: n.value,
|
|
74
|
-
"onUpdate:visible": i[0] || (i[0] = (B) => n.value = B)
|
|
75
|
-
}, null, 8, ["visible"])) : M("", !0)
|
|
76
|
-
], 64));
|
|
77
|
-
}
|
|
78
|
-
});
|
|
1
|
+
import o from "./index.vue2.js";
|
|
2
|
+
/* empty css */
|
|
3
|
+
import r from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const p = /* @__PURE__ */ r(o, [["__scopeId", "data-v-74715541"]]);
|
|
79
5
|
export {
|
|
80
|
-
|
|
6
|
+
p as default
|
|
81
7
|
};
|
|
@@ -1,4 +1,87 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { defineComponent as S, computed as h, ref as d, onMounted as w, watch as J, createElementBlock as p, openBlock as t, Fragment as E, createElementVNode as M, createBlock as P, createCommentVNode as g, createVNode as r, unref as e, mergeProps as T } from "vue";
|
|
2
|
+
import { Skeleton as z } from "ant-design-vue";
|
|
3
|
+
import I from "../form-render/dynamic-dialog.vue.js";
|
|
4
|
+
/* empty css */
|
|
5
|
+
import v from "./FormContainer.js";
|
|
6
|
+
import { useFormContext as U } from "./useFormContext.js";
|
|
7
|
+
import { useI18n as $ } from "../../utils/i18n.js";
|
|
8
|
+
import { storeToRefs as j } from "pinia";
|
|
9
|
+
import { useLocaleStore as q } from "@kp-ui/i18n";
|
|
10
|
+
import { getLocat as b } from "@kp-ui/tool";
|
|
11
|
+
import A from "./Debugger.vue.js";
|
|
12
|
+
import { useComRef as G } from "tmgc2-share";
|
|
13
|
+
const H = { class: "form-render-wrapper" }, K = {
|
|
14
|
+
key: 0,
|
|
15
|
+
class: "loading-wrapper"
|
|
16
|
+
}, ae = /* @__PURE__ */ S({
|
|
17
|
+
name: "VFormRender",
|
|
18
|
+
componentName: "VFormRender",
|
|
19
|
+
__name: "index",
|
|
20
|
+
props: {
|
|
21
|
+
vfCtx: { default: () => ({}) },
|
|
22
|
+
formJson: { default: () => ({ widgetList: [], formConfig: {} }) },
|
|
23
|
+
formData: { default: () => ({}) },
|
|
24
|
+
optionData: { default: () => ({}) },
|
|
25
|
+
disabledMode: { type: Boolean, default: !1 },
|
|
26
|
+
renderConfig: { default: () => ({ languageName: "zh-CN" }) },
|
|
27
|
+
globalDsv: { default: () => ({}) },
|
|
28
|
+
parentForm: { default: null },
|
|
29
|
+
dynamicCreation: { type: Boolean, default: !1 },
|
|
30
|
+
debug: { type: Boolean }
|
|
31
|
+
},
|
|
32
|
+
emits: ["form-submit", "form-cancel"],
|
|
33
|
+
setup(_, { expose: C, emit: y }) {
|
|
34
|
+
const { initLocale: F } = $(), x = q(), { locale: n } = j(x);
|
|
35
|
+
console.log(b());
|
|
36
|
+
const k = h(() => b().debug === "1"), m = d(!1), a = _, i = d(), l = G(v), N = y, o = U({
|
|
37
|
+
props: a,
|
|
38
|
+
renderForm: i
|
|
39
|
+
}), R = (c) => {
|
|
40
|
+
N("form-submit", c);
|
|
41
|
+
}, B = () => l.value;
|
|
42
|
+
w(() => {
|
|
43
|
+
o.registerToRefList("v_form_ref");
|
|
44
|
+
}), J(
|
|
45
|
+
n,
|
|
46
|
+
() => {
|
|
47
|
+
F(n.value);
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
immediate: !0
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
const { dynamicDialgRef: s, dialogProps: D, emitter: L, isLoading: f } = o;
|
|
54
|
+
return C({
|
|
55
|
+
...L,
|
|
56
|
+
...o,
|
|
57
|
+
dynamicDialgRef: s,
|
|
58
|
+
getNativeForm: B,
|
|
59
|
+
formJson: a.formJson,
|
|
60
|
+
renderForm: i
|
|
61
|
+
}), (c, u) => (t(), p(E, null, [
|
|
62
|
+
M("div", H, [
|
|
63
|
+
e(f) ? (t(), p("div", K, [
|
|
64
|
+
r(e(z), { active: e(f) }, null, 8, ["active"])
|
|
65
|
+
])) : g("", !0),
|
|
66
|
+
r(e(v), {
|
|
67
|
+
ref_key: "formContainer",
|
|
68
|
+
ref: l,
|
|
69
|
+
context: e(o),
|
|
70
|
+
onFormSubmit: R
|
|
71
|
+
}, null, 8, ["context"]),
|
|
72
|
+
r(I, T(e(D), {
|
|
73
|
+
ref_key: "dynamicDialgRef",
|
|
74
|
+
ref: s
|
|
75
|
+
}), null, 16)
|
|
76
|
+
]),
|
|
77
|
+
k.value ? (t(), P(A, {
|
|
78
|
+
key: 0,
|
|
79
|
+
visible: m.value,
|
|
80
|
+
"onUpdate:visible": u[0] || (u[0] = (V) => m.value = V)
|
|
81
|
+
}, null, 8, ["visible"])) : g("", !0)
|
|
82
|
+
], 64));
|
|
83
|
+
}
|
|
84
|
+
});
|
|
2
85
|
export {
|
|
3
|
-
|
|
86
|
+
ae as default
|
|
4
87
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import t from "./data-table-widget.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import
|
|
4
|
-
const
|
|
3
|
+
import a from "../../../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const m = /* @__PURE__ */ a(t, [["__scopeId", "data-v-e075ecba"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
m as default
|
|
7
7
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as R, watchEffect as
|
|
1
|
+
import { defineComponent as R, watchEffect as l, onMounted as _, createBlock as E, createCommentVNode as W, unref as e, openBlock as z, normalizeProps as N, mergeProps as y, withCtx as F, createElementVNode as V, normalizeStyle as k, createVNode as D } from "vue";
|
|
2
2
|
import I from "./container-wrapper.vue.js";
|
|
3
3
|
import { ComponentNameEnum as L, ContainerTypeEnum as B } from "../../../../constants/WidgetTypeEnum.js";
|
|
4
4
|
import { useTableWidget as M } from "./useTableWidget.js";
|
|
@@ -17,52 +17,58 @@ const Q = /* @__PURE__ */ R({
|
|
|
17
17
|
subFormRowIndex: {},
|
|
18
18
|
subFormRowId: {}
|
|
19
19
|
},
|
|
20
|
-
setup(
|
|
21
|
-
const t =
|
|
22
|
-
isLoading:
|
|
20
|
+
setup(d, { expose: s }) {
|
|
21
|
+
const t = d, { fieldModel: p, handleHidden: m, defineExposed: f } = S(t), {
|
|
22
|
+
isLoading: u,
|
|
23
23
|
tableProps: n,
|
|
24
|
-
pagintion:
|
|
25
|
-
tableWidth:
|
|
26
|
-
setPagination:
|
|
27
|
-
handleTableChange:
|
|
28
|
-
setTableRef:
|
|
29
|
-
loadDataTableDataSource:
|
|
24
|
+
pagintion: c,
|
|
25
|
+
tableWidth: g,
|
|
26
|
+
setPagination: i,
|
|
27
|
+
handleTableChange: b,
|
|
28
|
+
setTableRef: h,
|
|
29
|
+
loadDataTableDataSource: C
|
|
30
30
|
} = M({
|
|
31
|
-
fieldModel:
|
|
31
|
+
fieldModel: p,
|
|
32
32
|
props: t
|
|
33
|
-
})
|
|
33
|
+
});
|
|
34
|
+
l(() => {
|
|
35
|
+
i({
|
|
36
|
+
total: t.field.options.showPagination ? 1 : 0
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
const { tableRef: o, setTableProps: w, register: x } = H({
|
|
34
40
|
props: n.value,
|
|
35
41
|
events: {
|
|
36
|
-
columnResizableChange: (
|
|
37
|
-
const { field: a, resizeWidth:
|
|
42
|
+
columnResizableChange: (r) => {
|
|
43
|
+
const { field: a, resizeWidth: T } = r.resizeColumn;
|
|
38
44
|
if (a) {
|
|
39
|
-
const
|
|
40
|
-
(
|
|
45
|
+
const v = t.field.options.tableColumns.find(
|
|
46
|
+
(P) => P.dataIndex === a
|
|
41
47
|
);
|
|
42
|
-
|
|
48
|
+
v.width = T;
|
|
43
49
|
}
|
|
44
50
|
}
|
|
45
51
|
}
|
|
46
52
|
});
|
|
47
|
-
return
|
|
48
|
-
|
|
49
|
-
}),
|
|
50
|
-
}),
|
|
51
|
-
...
|
|
52
|
-
setPagination:
|
|
53
|
-
loadDataTableDataSource:
|
|
53
|
+
return l(() => {
|
|
54
|
+
w(n.value), o.value && h(o.value);
|
|
55
|
+
}), _(() => {
|
|
56
|
+
}), s({
|
|
57
|
+
...f,
|
|
58
|
+
setPagination: i,
|
|
59
|
+
loadDataTableDataSource: C,
|
|
54
60
|
fieldEditor: o.value
|
|
55
|
-
}), (
|
|
61
|
+
}), (r, a) => e(m) ? W("", !0) : (z(), E(I, N(y({ key: 0 }, t)), {
|
|
56
62
|
default: F(() => [
|
|
57
63
|
V("div", {
|
|
58
64
|
class: "talbe-wrapper",
|
|
59
|
-
style: k({ width: e(
|
|
65
|
+
style: k({ width: e(g) })
|
|
60
66
|
}, [
|
|
61
67
|
D(e(O), {
|
|
62
|
-
onRegister: e(
|
|
63
|
-
loading: e(
|
|
64
|
-
pagination: e(
|
|
65
|
-
onChange: e(
|
|
68
|
+
onRegister: e(x),
|
|
69
|
+
loading: e(u),
|
|
70
|
+
pagination: e(c),
|
|
71
|
+
onChange: e(b)
|
|
66
72
|
}, null, 8, ["onRegister", "loading", "pagination", "onChange"])
|
|
67
73
|
], 4)
|
|
68
74
|
]),
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { inject as
|
|
2
|
-
import { omit as
|
|
3
|
-
import
|
|
4
|
-
import { useI18n as
|
|
5
|
-
import { useExecFunction as
|
|
6
|
-
import { useDataHttp as
|
|
7
|
-
function
|
|
8
|
-
const
|
|
9
|
-
props:
|
|
10
|
-
}),
|
|
11
|
-
const t = [], e = (n == null ? void 0 : n.options) || {}, { rowSelection: o, showIndex: a, tableColumns:
|
|
1
|
+
import { inject as E, ref as x, computed as l, h as K } from "vue";
|
|
2
|
+
import { omit as H, cloneDeep as g, isArray as N } from "lodash-es";
|
|
3
|
+
import q from "../../../public/ActionButtonListRender.vue.js";
|
|
4
|
+
import { useI18n as L } from "../../../../utils/i18n.js";
|
|
5
|
+
import { useExecFunction as j, tranformAntTableColumnToVxetableColumn as _, tranformAntSizzVxetableSize as G } from "tmgc2-share";
|
|
6
|
+
import { useDataHttp as J } from "../../../../hooks/useDataHttp.js";
|
|
7
|
+
function rt({ props: c, fieldModel: s }) {
|
|
8
|
+
const C = E("designState", !1), d = x(), h = x(!1), { widget: n } = c, { i18nt: y } = L(), { executeFunction: u, context: S } = j(), { loadataSource: v, setPagination: f, getPagination: p, pagintion: D } = J({
|
|
9
|
+
props: c
|
|
10
|
+
}), T = l(() => {
|
|
11
|
+
const t = [], e = (n == null ? void 0 : n.options) || {}, { rowSelection: o, showIndex: a, tableColumns: r = [] } = (n == null ? void 0 : n.options) ?? {};
|
|
12
12
|
o != null && o.hasRowSelection && t.push({
|
|
13
13
|
title: o.columnTitle,
|
|
14
14
|
width: o.columnWidth,
|
|
@@ -17,7 +17,7 @@ function nt({ props: l, fieldModel: i }) {
|
|
|
17
17
|
dataIndex: "checkbox",
|
|
18
18
|
type: "checkbox"
|
|
19
19
|
}), a && t.push({
|
|
20
|
-
title:
|
|
20
|
+
title: y("designer.setting.seq"),
|
|
21
21
|
align: "left",
|
|
22
22
|
width: 90,
|
|
23
23
|
fixed: "left",
|
|
@@ -26,69 +26,68 @@ function nt({ props: l, fieldModel: i }) {
|
|
|
26
26
|
resizable: !0,
|
|
27
27
|
type: "seq"
|
|
28
28
|
});
|
|
29
|
-
const m =
|
|
30
|
-
...
|
|
31
|
-
...R(
|
|
32
|
-
})),
|
|
29
|
+
const m = r.filter((i) => i.show).map((i) => ({
|
|
30
|
+
...i,
|
|
31
|
+
...R(i)
|
|
32
|
+
})), w = [];
|
|
33
33
|
if (e.showButtonsColumn) {
|
|
34
|
-
const
|
|
35
|
-
|
|
34
|
+
const i = e.operationButtons ?? [];
|
|
35
|
+
w.push({
|
|
36
36
|
fixed: "right",
|
|
37
37
|
align: "center",
|
|
38
38
|
title: e.buttonsColumnTitle,
|
|
39
39
|
width: e.buttonsColumnWidth,
|
|
40
40
|
slots: {
|
|
41
|
-
default: (
|
|
42
|
-
buttonList:
|
|
41
|
+
default: (A) => K(q, {
|
|
42
|
+
buttonList: i,
|
|
43
43
|
flex: "center",
|
|
44
|
-
scope:
|
|
45
|
-
ctx:
|
|
44
|
+
scope: A,
|
|
45
|
+
ctx: S.value
|
|
46
46
|
})
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
-
|
|
51
|
-
return
|
|
50
|
+
const V = [...t, ...m, ...w];
|
|
51
|
+
return _(V);
|
|
52
52
|
}), R = (t) => {
|
|
53
|
-
const e =
|
|
53
|
+
const e = H(t, ["customRender"]), o = t.customRender;
|
|
54
54
|
return t.minWidth = 50, t.maxWidth = 1200, t.isAutoWidth ? (t.width = null, delete t.width) : t.width = isNaN(Number(t.width)) ? t.width : Number(t.width), o ? {
|
|
55
55
|
...e,
|
|
56
56
|
slots: {
|
|
57
57
|
default(a) {
|
|
58
58
|
return u({
|
|
59
|
-
source:
|
|
59
|
+
source: c.field.options.name,
|
|
60
60
|
functionBody: o,
|
|
61
61
|
params: {
|
|
62
62
|
index: a.rowIndex,
|
|
63
63
|
record: a.row,
|
|
64
64
|
...a
|
|
65
65
|
},
|
|
66
|
-
errorCallback: (
|
|
67
|
-
console.error("Custom render error:",
|
|
66
|
+
errorCallback: (r) => {
|
|
67
|
+
console.error("Custom render error:", r);
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
} : t;
|
|
73
|
-
}, k =
|
|
73
|
+
}, k = l(() => n.options.tableWidth), z = l(() => n.options.tableSize), W = () => {
|
|
74
74
|
b();
|
|
75
|
-
}, B =
|
|
75
|
+
}, B = l(() => n.options.rowKey), P = l(() => {
|
|
76
76
|
const {
|
|
77
77
|
tableSize: t,
|
|
78
78
|
rowKey: e,
|
|
79
79
|
tableHeight: o = 300,
|
|
80
80
|
border: a = !1,
|
|
81
|
-
lineHeight:
|
|
81
|
+
lineHeight: r = 50,
|
|
82
82
|
colorRow: m = !1
|
|
83
83
|
} = n.options;
|
|
84
84
|
return {
|
|
85
|
-
id: n.id,
|
|
86
85
|
showPagination: n.options.showPagination,
|
|
87
|
-
size:
|
|
86
|
+
size: G(t),
|
|
88
87
|
height: o,
|
|
89
88
|
border: a ?? !1,
|
|
90
|
-
data:
|
|
91
|
-
columns:
|
|
89
|
+
data: s.value || [],
|
|
90
|
+
columns: T.value,
|
|
92
91
|
sortConfig: {
|
|
93
92
|
trigger: "cell",
|
|
94
93
|
remote: !0,
|
|
@@ -100,25 +99,25 @@ function nt({ props: l, fieldModel: i }) {
|
|
|
100
99
|
isHover: !0
|
|
101
100
|
},
|
|
102
101
|
cellConfig: {
|
|
103
|
-
height:
|
|
102
|
+
height: r
|
|
104
103
|
}
|
|
105
104
|
};
|
|
106
|
-
}),
|
|
105
|
+
}), F = (t) => {
|
|
107
106
|
d.value = t;
|
|
108
107
|
}, b = async () => {
|
|
109
108
|
var t;
|
|
110
|
-
if (
|
|
109
|
+
if (c.field.options.dsEnabled) {
|
|
111
110
|
h.value = !0;
|
|
112
111
|
try {
|
|
113
|
-
const e = await
|
|
114
|
-
|
|
112
|
+
const e = await v(), o = e.list || [];
|
|
113
|
+
C ? await ((t = d.value) == null ? void 0 : t.loadData(o)) : s.value = g(o || []), f(e);
|
|
115
114
|
} catch (e) {
|
|
116
115
|
console.error(e);
|
|
117
116
|
}
|
|
118
117
|
} else
|
|
119
|
-
|
|
118
|
+
s.value = n.options.dataSource || [];
|
|
120
119
|
h.value = !1;
|
|
121
|
-
},
|
|
120
|
+
}, I = ({ row: t, $event: e }, o) => {
|
|
122
121
|
u({
|
|
123
122
|
functionBody: n.options.customRow[o],
|
|
124
123
|
params: [t, e],
|
|
@@ -126,6 +125,7 @@ function nt({ props: l, fieldModel: i }) {
|
|
|
126
125
|
});
|
|
127
126
|
};
|
|
128
127
|
return {
|
|
128
|
+
rowKey: B,
|
|
129
129
|
onCheckboxChange: (t) => {
|
|
130
130
|
u({
|
|
131
131
|
functionBody: n.options.rowSelection.onChange,
|
|
@@ -134,21 +134,25 @@ function nt({ props: l, fieldModel: i }) {
|
|
|
134
134
|
});
|
|
135
135
|
},
|
|
136
136
|
tableDefinExpoed: {
|
|
137
|
+
setValue: (t) => {
|
|
138
|
+
if (!N(t))
|
|
139
|
+
return console.error("表格数据类型错误");
|
|
140
|
+
},
|
|
137
141
|
insertTableValue: (t) => {
|
|
138
|
-
|
|
142
|
+
s.value || (s.value = []), s.value.push(g(t));
|
|
139
143
|
},
|
|
140
144
|
setPagination: f,
|
|
141
|
-
getDataSource: () =>
|
|
145
|
+
getDataSource: () => s.value,
|
|
142
146
|
getPagination: p
|
|
143
147
|
},
|
|
144
148
|
onSortChange: W,
|
|
145
|
-
pagintion:
|
|
149
|
+
pagintion: D,
|
|
146
150
|
setPagination: f,
|
|
147
151
|
getPagination: p,
|
|
148
152
|
handleTableChange: (t, e, o, a) => {
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
functionBody:
|
|
153
|
+
const r = n.options.onTableChange;
|
|
154
|
+
r && u({
|
|
155
|
+
functionBody: r,
|
|
152
156
|
params: {
|
|
153
157
|
pagination: t,
|
|
154
158
|
filters: e,
|
|
@@ -159,22 +163,22 @@ function nt({ props: l, fieldModel: i }) {
|
|
|
159
163
|
});
|
|
160
164
|
},
|
|
161
165
|
setTableData: (t) => {
|
|
162
|
-
|
|
166
|
+
s.value = g(t);
|
|
163
167
|
},
|
|
164
168
|
loadDataTableDataSource: () => {
|
|
165
169
|
b();
|
|
166
170
|
},
|
|
167
|
-
showPagination:
|
|
168
|
-
onRunEvent:
|
|
171
|
+
showPagination: l(() => !!c.field.options.showPagination),
|
|
172
|
+
onRunEvent: I,
|
|
169
173
|
isLoading: h,
|
|
170
174
|
initTableSoureData: b,
|
|
171
|
-
setTableRef:
|
|
175
|
+
setTableRef: F,
|
|
172
176
|
tableSize: z,
|
|
173
177
|
tableWidth: k,
|
|
174
|
-
tableProps:
|
|
178
|
+
tableProps: P,
|
|
175
179
|
tableRef: d
|
|
176
180
|
};
|
|
177
181
|
}
|
|
178
182
|
export {
|
|
179
|
-
|
|
183
|
+
rt as useTableWidget
|
|
180
184
|
};
|
|
@@ -6,22 +6,22 @@ function D(t, g) {
|
|
|
6
6
|
if (!Array.isArray(t))
|
|
7
7
|
return -1;
|
|
8
8
|
let l = -1;
|
|
9
|
-
return t.forEach((i,
|
|
10
|
-
i === g && (l =
|
|
9
|
+
return t.forEach((i, s) => {
|
|
10
|
+
i === g && (l = s);
|
|
11
11
|
}), l;
|
|
12
12
|
}
|
|
13
13
|
function U({ field: t, designState: g, fieldModel: l }) {
|
|
14
14
|
const i = m({
|
|
15
15
|
val: ""
|
|
16
|
-
}),
|
|
16
|
+
}), s = m(!1), r = m({
|
|
17
17
|
page: 1,
|
|
18
18
|
pageSize: 20,
|
|
19
19
|
totalPage: 0,
|
|
20
20
|
total: 0
|
|
21
21
|
}), { execHttpFunction: P } = q(), h = async () => {
|
|
22
22
|
var e;
|
|
23
|
-
if (
|
|
24
|
-
if (
|
|
23
|
+
if (!s.value) {
|
|
24
|
+
if (s.value = !0, t.options.dsEnabled && ((e = t.options.http) != null && e.url))
|
|
25
25
|
try {
|
|
26
26
|
const { http: o, dataHandlerCode: n, dataReqHandlerCode: u } = t.options, a = await P(
|
|
27
27
|
{
|
|
@@ -32,28 +32,28 @@ function U({ field: t, designState: g, fieldModel: l }) {
|
|
|
32
32
|
{}
|
|
33
33
|
);
|
|
34
34
|
if (!a) {
|
|
35
|
-
|
|
35
|
+
s.value = !1;
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
38
|
if (O(a)) {
|
|
39
|
-
c(a);
|
|
39
|
+
c(a), s.value = !1;
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
|
-
O(a.list) && (t.options.loadingPage ? (
|
|
42
|
+
O(a.list) && (t.options.loadingPage ? (r.value.total = a.total || 0, r.value.totalPage = a.totalPage || 0, c([...v(), ...a.list])) : c(a.list));
|
|
43
43
|
} catch (o) {
|
|
44
44
|
console.error("err: ", o);
|
|
45
45
|
}
|
|
46
46
|
else
|
|
47
47
|
c([...v()]);
|
|
48
|
-
|
|
48
|
+
s.value = !1;
|
|
49
49
|
}
|
|
50
50
|
}, w = N(function() {
|
|
51
|
-
|
|
51
|
+
r.value.page += 1, h();
|
|
52
52
|
}, 500), E = (e) => {
|
|
53
53
|
if (!t.options.loadingPage) return;
|
|
54
54
|
const { target: o } = e, { scrollTop: n, scrollHeight: u, clientHeight: a } = o;
|
|
55
|
-
if (u - (n + a) <= 30 &&
|
|
56
|
-
if (
|
|
55
|
+
if (u - (n + a) <= 30 && r.value.totalPage > r.value.page) {
|
|
56
|
+
if (r.value.totalPage === r.value.page)
|
|
57
57
|
return;
|
|
58
58
|
w();
|
|
59
59
|
}
|
|
@@ -62,14 +62,14 @@ function U({ field: t, designState: g, fieldModel: l }) {
|
|
|
62
62
|
value: (t == null ? void 0 : t.options.valueKey) || "value",
|
|
63
63
|
options: "options"
|
|
64
64
|
})), K = (e, o) => o[y.value.label].toLowerCase().indexOf(e.toLowerCase()) >= 0, C = () => {
|
|
65
|
-
|
|
65
|
+
r.value = { page: 1, pageSize: 20, total: 0, totalPage: 0 }, c([]);
|
|
66
66
|
}, L = (e) => {
|
|
67
67
|
t.options.showSearch && (g || (C(), i.value.val = e, h()));
|
|
68
68
|
}, A = p(() => {
|
|
69
69
|
var n;
|
|
70
70
|
const o = (n = t == null ? void 0 : t.options) == null ? void 0 : n.showSearch;
|
|
71
71
|
return {
|
|
72
|
-
loading:
|
|
72
|
+
loading: s.value,
|
|
73
73
|
fieldNames: y.value,
|
|
74
74
|
showSearch: !0,
|
|
75
75
|
onPopupScroll: E,
|
|
@@ -125,8 +125,8 @@ function U({ field: t, designState: g, fieldModel: l }) {
|
|
|
125
125
|
loadOptions: c,
|
|
126
126
|
filterOption: K,
|
|
127
127
|
keyword: i,
|
|
128
|
-
pager:
|
|
129
|
-
loading:
|
|
128
|
+
pager: r,
|
|
129
|
+
loading: s,
|
|
130
130
|
fieldNames: y,
|
|
131
131
|
selectOps: A,
|
|
132
132
|
initOptionItems: h,
|