@kp-ui/lowcode 2.15.0-alpha.12 → 2.15.0-alpha.13
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/form-designer/form-widget/field-widget/hooks/useSelect.js +54 -52
- package/src/components/form-designer/form-widget/field-widget/select-widget.vue2.js +1 -1
- package/src/components/form-designer/form-widget/field-widget/time-widget.vue2.js +16 -16
- package/stats.html +1 -1
package/package.json
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { debounce as
|
|
3
|
-
import { translateOptionItems as
|
|
4
|
-
import { useExecFunction as
|
|
5
|
-
function
|
|
1
|
+
import { ref as m, computed as p, unref as F } from "vue";
|
|
2
|
+
import { debounce as N, isArray as O } from "lodash-es";
|
|
3
|
+
import { translateOptionItems as R } from "../../../../../utils/util.js";
|
|
4
|
+
import { useExecFunction as q } from "tmgc2-share";
|
|
5
|
+
function D(t, g) {
|
|
6
6
|
if (!Array.isArray(t))
|
|
7
7
|
return -1;
|
|
8
8
|
let l = -1;
|
|
9
9
|
return t.forEach((i, r) => {
|
|
10
|
-
i ===
|
|
10
|
+
i === g && (l = r);
|
|
11
11
|
}), l;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
const i =
|
|
13
|
+
function U({ field: t, designState: g, fieldModel: l }) {
|
|
14
|
+
const i = m({
|
|
15
15
|
val: ""
|
|
16
|
-
}), r =
|
|
16
|
+
}), r = m(!1), s = m({
|
|
17
17
|
page: 1,
|
|
18
18
|
pageSize: 20,
|
|
19
19
|
totalPage: 0,
|
|
20
20
|
total: 0
|
|
21
|
-
}), { execHttpFunction:
|
|
21
|
+
}), { execHttpFunction: P } = q(), h = async () => {
|
|
22
22
|
var e;
|
|
23
23
|
if (console.log(32321321), !r.value) {
|
|
24
24
|
if (r.value = !0, t.options.dsEnabled && ((e = t.options.http) != null && e.url))
|
|
25
25
|
try {
|
|
26
|
-
const { http: o, dataHandlerCode: n, dataReqHandlerCode: u } = t.options,
|
|
26
|
+
const { http: o, dataHandlerCode: n, dataReqHandlerCode: u } = t.options, a = await P(
|
|
27
27
|
{
|
|
28
28
|
http: o,
|
|
29
29
|
dataHandlerCode: n,
|
|
@@ -31,72 +31,72 @@ function J({ field: t, designState: v, fieldModel: l }) {
|
|
|
31
31
|
},
|
|
32
32
|
{}
|
|
33
33
|
);
|
|
34
|
-
if (!
|
|
34
|
+
if (!a) {
|
|
35
35
|
r.value = !1;
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
|
-
if (
|
|
39
|
-
|
|
38
|
+
if (O(a)) {
|
|
39
|
+
c(a);
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
|
-
|
|
42
|
+
O(a.list) && (t.options.loadingPage ? (s.value.total = a.total || 0, s.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
|
r.value = !1;
|
|
49
49
|
}
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
}, 500),
|
|
50
|
+
}, w = N(function() {
|
|
51
|
+
s.value.page += 1, h();
|
|
52
|
+
}, 500), E = (e) => {
|
|
53
53
|
if (!t.options.loadingPage) return;
|
|
54
|
-
const { target: o } = e, { scrollTop: n, scrollHeight: u, clientHeight:
|
|
55
|
-
if (u - (n +
|
|
56
|
-
if (
|
|
54
|
+
const { target: o } = e, { scrollTop: n, scrollHeight: u, clientHeight: a } = o;
|
|
55
|
+
if (u - (n + a) <= 30 && s.value.totalPage > s.value.page) {
|
|
56
|
+
if (s.value.totalPage === s.value.page)
|
|
57
57
|
return;
|
|
58
|
-
|
|
58
|
+
w();
|
|
59
59
|
}
|
|
60
|
-
},
|
|
60
|
+
}, x = p(() => (t == null ? void 0 : t.options.labelKey) || "label"), b = p(() => (t == null ? void 0 : t.options.valueKey) || "value"), H = p(() => (t == null ? void 0 : t.options.childrenKey) || "children"), y = p(() => ({
|
|
61
61
|
label: (t == null ? void 0 : t.options.labelKey) || "label",
|
|
62
62
|
value: (t == null ? void 0 : t.options.valueKey) || "value",
|
|
63
63
|
options: "options"
|
|
64
|
-
})),
|
|
65
|
-
|
|
64
|
+
})), K = (e, o) => o[y.value.label].toLowerCase().indexOf(e.toLowerCase()) >= 0, C = () => {
|
|
65
|
+
s.value = { page: 1, pageSize: 20, total: 0, totalPage: 0 }, c([]);
|
|
66
66
|
}, L = (e) => {
|
|
67
|
-
t.options.showSearch && (
|
|
68
|
-
}, A =
|
|
67
|
+
t.options.showSearch && (g || (C(), i.value.val = e, h()));
|
|
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
72
|
loading: r.value,
|
|
73
|
-
fieldNames:
|
|
73
|
+
fieldNames: y.value,
|
|
74
74
|
showSearch: !0,
|
|
75
|
-
onPopupScroll:
|
|
75
|
+
onPopupScroll: E,
|
|
76
76
|
onSearch: L,
|
|
77
|
-
filterOption: !o &&
|
|
77
|
+
filterOption: !o && K,
|
|
78
78
|
listHeight: 240
|
|
79
79
|
};
|
|
80
|
-
}),
|
|
81
|
-
t.options.optionItems =
|
|
80
|
+
}), c = async (e) => {
|
|
81
|
+
t.options.optionItems = R(
|
|
82
82
|
e,
|
|
83
83
|
t.type,
|
|
84
84
|
t.options.labelKey || "label",
|
|
85
85
|
t.options.valueKey || "value"
|
|
86
86
|
);
|
|
87
|
-
},
|
|
87
|
+
}, v = () => t.options.optionItems, k = () => v().find((o) => o[b.value] === l.value), z = p(() => {
|
|
88
88
|
if (l.value === null)
|
|
89
89
|
return "";
|
|
90
90
|
{
|
|
91
91
|
let e = "";
|
|
92
92
|
const { valueKey: o, labelKey: n } = t.options;
|
|
93
93
|
return t.options.optionItems.forEach((u) => {
|
|
94
|
-
(u[o] === l.value ||
|
|
94
|
+
(u[o] === l.value || D(l.value, u[o]) !== -1) && (e = e === "" ? u[n] : e + " " + u[n]);
|
|
95
95
|
}), e;
|
|
96
96
|
}
|
|
97
|
-
}),
|
|
97
|
+
}), S = () => {
|
|
98
98
|
t.options.dsEnabled && t.options.optionItems.splice(0, t.options.optionItems.length);
|
|
99
|
-
},
|
|
99
|
+
}, I = (e) => {
|
|
100
100
|
const o = t.options.optionItems;
|
|
101
101
|
o && o.length > 0 && o.forEach((n) => {
|
|
102
102
|
n.value === e && (n.disabled = !0);
|
|
@@ -104,33 +104,35 @@ function J({ field: t, designState: v, fieldModel: l }) {
|
|
|
104
104
|
};
|
|
105
105
|
return {
|
|
106
106
|
selectDefineExpose: {
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
getSelectedItem: k,
|
|
108
|
+
disableOption: I,
|
|
109
|
+
clearOptionItems: S,
|
|
109
110
|
enableOption: (e) => {
|
|
110
111
|
const o = t.options.optionItems;
|
|
111
112
|
o && o.length > 0 && o.forEach((n) => {
|
|
112
113
|
n.value === e && (n.disabled = !1);
|
|
113
114
|
});
|
|
114
115
|
},
|
|
115
|
-
|
|
116
|
+
getOptionItems: v,
|
|
117
|
+
keyword: F(i)
|
|
116
118
|
},
|
|
117
|
-
disableOption:
|
|
118
|
-
clearOptionItems:
|
|
119
|
+
disableOption: I,
|
|
120
|
+
clearOptionItems: S,
|
|
119
121
|
childrenKey: H,
|
|
120
|
-
valueKey:
|
|
121
|
-
labelKey:
|
|
122
|
-
optionLabel:
|
|
123
|
-
loadOptions:
|
|
124
|
-
filterOption:
|
|
122
|
+
valueKey: b,
|
|
123
|
+
labelKey: x,
|
|
124
|
+
optionLabel: z,
|
|
125
|
+
loadOptions: c,
|
|
126
|
+
filterOption: K,
|
|
125
127
|
keyword: i,
|
|
126
|
-
pager:
|
|
128
|
+
pager: s,
|
|
127
129
|
loading: r,
|
|
128
|
-
fieldNames:
|
|
130
|
+
fieldNames: y,
|
|
129
131
|
selectOps: A,
|
|
130
|
-
initOptionItems:
|
|
131
|
-
getOptionItems:
|
|
132
|
+
initOptionItems: h,
|
|
133
|
+
getOptionItems: v
|
|
132
134
|
};
|
|
133
135
|
}
|
|
134
136
|
export {
|
|
135
|
-
|
|
137
|
+
U as useSelect
|
|
136
138
|
};
|
|
@@ -41,7 +41,7 @@ const R = /* @__PURE__ */ S({
|
|
|
41
41
|
F(() => {
|
|
42
42
|
o();
|
|
43
43
|
}), u({
|
|
44
|
-
|
|
44
|
+
...s,
|
|
45
45
|
...i
|
|
46
46
|
});
|
|
47
47
|
const d = { props: e, rules: p, i18nt: a, field: t, fieldModel: r, isReadMode: m, size: f, designState: n, fieldEditor: c, handleHidden: b, handleDisabled: y, handleClickIcon: g, handleFocusCustomEvent: _, handleBlurCustomEvent: q, defineExposed: i, selectOps: I, optionLabel: x, initOptionItems: o, selectDefineExpose: s, FormItemWrapper: h, get SvgIcon() {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
1
|
+
import { defineComponent as c } from "vue";
|
|
2
|
+
import y from "./form-item-wrapper.vue.js";
|
|
3
3
|
import { useField as _ } from "./useField.js";
|
|
4
4
|
import { ComponentNameEnum as q, WidgetTypeEnum as g } from "../../../../constants/WidgetTypeEnum.js";
|
|
5
|
-
const N = /* @__PURE__ */
|
|
5
|
+
const N = /* @__PURE__ */ c({
|
|
6
6
|
name: g.time,
|
|
7
7
|
componentName: q.FieldWidget,
|
|
8
8
|
__name: "time-widget",
|
|
9
9
|
props: {
|
|
10
|
-
widget: { type:
|
|
11
|
-
field: { type:
|
|
10
|
+
widget: { type: Object, required: !0 },
|
|
11
|
+
field: { type: Object, required: !0 },
|
|
12
12
|
designer: { type: null, required: !1 },
|
|
13
13
|
parentWidget: { type: [Object, null], required: !1 },
|
|
14
14
|
parentList: { type: [Array, null], required: !1 },
|
|
@@ -17,24 +17,24 @@ const N = /* @__PURE__ */ b({
|
|
|
17
17
|
subFormRowId: { type: String, required: !1 },
|
|
18
18
|
subFormColIndex: { type: Number, required: !1 }
|
|
19
19
|
},
|
|
20
|
-
setup(
|
|
21
|
-
const e =
|
|
22
|
-
rules:
|
|
23
|
-
i18nt:
|
|
24
|
-
field:
|
|
25
|
-
fieldModel:
|
|
26
|
-
isReadMode:
|
|
27
|
-
size:
|
|
20
|
+
setup(i, { expose: d }) {
|
|
21
|
+
const e = i, {
|
|
22
|
+
rules: n,
|
|
23
|
+
i18nt: o,
|
|
24
|
+
field: u,
|
|
25
|
+
fieldModel: s,
|
|
26
|
+
isReadMode: p,
|
|
27
|
+
size: l,
|
|
28
28
|
handleHidden: m,
|
|
29
29
|
handleDisabled: a,
|
|
30
30
|
handleFocusCustomEvent: f,
|
|
31
|
-
handleBlurCustomEvent:
|
|
31
|
+
handleBlurCustomEvent: b,
|
|
32
32
|
defineExposed: r
|
|
33
33
|
} = _(e);
|
|
34
|
-
|
|
34
|
+
d({
|
|
35
35
|
...r
|
|
36
36
|
});
|
|
37
|
-
const t = { props: e, rules:
|
|
37
|
+
const t = { props: e, rules: n, i18nt: o, field: u, fieldModel: s, isReadMode: p, size: l, handleHidden: m, handleDisabled: a, handleFocusCustomEvent: f, handleBlurCustomEvent: b, defineExposed: r, FormItemWrapper: y };
|
|
38
38
|
return Object.defineProperty(t, "__isScriptSetup", { enumerable: !1, value: !0 }), t;
|
|
39
39
|
}
|
|
40
40
|
});
|