@fewangsit/wangsvue-fats 1.0.1-alpha.40 → 1.0.1-alpha.41
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/dropdown/index.d.ts +1 -0
- package/dropdown/index.es.js +82 -72
- package/package.json +1 -1
- package/stats.html +1 -1
- package/wangsvue-fats.esm.browser.js +10 -0
- package/wangsvue-fats.system.js +1 -1
package/dropdown/index.d.ts
CHANGED
|
@@ -237,6 +237,7 @@ export interface DropdownProps {
|
|
|
237
237
|
export interface DropdownSlots {
|
|
238
238
|
'value': Slot<{ value: string; originalValue: any }>;
|
|
239
239
|
'option': Slot<{ option: Option }>;
|
|
240
|
+
'footer': Slot<{ options: Option[]; value: OptionValue }>;
|
|
240
241
|
'addon-left': Slot;
|
|
241
242
|
'addon-right': Slot;
|
|
242
243
|
}
|
package/dropdown/index.es.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { u as
|
|
3
|
-
import { u as
|
|
4
|
-
import { f as
|
|
5
|
-
import { m as
|
|
6
|
-
import { a as
|
|
7
|
-
import { s as
|
|
1
|
+
import { defineComponent as ee, onMounted as le, computed as u, inject as N, ref as oe, shallowRef as I, reactive as ae, watch as $, createBlock as m, openBlock as s, withCtx as r, createVNode as d, normalizeClass as te, createCommentVNode as T, unref as i, renderSlot as p, mergeProps as j, createSlots as ie, normalizeProps as v, guardReactiveProps as c, createElementVNode as re, toDisplayString as k, createElementBlock as D, Fragment as E, createTextVNode as R, nextTick as ne } from "vue";
|
|
2
|
+
import { u as se } from "../vendor/vee-validate/dist/vee-validate.esm.es.js";
|
|
3
|
+
import { u as de } from "../plugins/WangsVue.es.js";
|
|
4
|
+
import { f as ue } from "../utils/filterOptions.util.es.js";
|
|
5
|
+
import { m as pe } from "../utils/mergePropsWithDefaults.util.es.js";
|
|
6
|
+
import { a as fe } from "../utils/textFormatter.util.es.js";
|
|
7
|
+
import { s as me } from "../vendor/primevue/dropdown/dropdown.esm.es.js";
|
|
8
8
|
import { s as K } from "../vendor/primevue/inputgroupaddon/inputgroupaddon.esm.es.js";
|
|
9
|
-
import { _ as
|
|
10
|
-
import { _ as
|
|
9
|
+
import { _ as ve } from "../badge/index.es.js";
|
|
10
|
+
import { _ as ce } from "../fieldwrapper/index.es.js";
|
|
11
11
|
import { _ as B } from "../icon/index.es.js";
|
|
12
|
-
import { _ as
|
|
13
|
-
import { _ as
|
|
12
|
+
import { _ as ge } from "../inputgroup/index.es.js";
|
|
13
|
+
import { _ as ye } from "../validatormessage/index.es.js";
|
|
14
14
|
import { i as z } from "../vendor/lodash-es/isEqual.es.js";
|
|
15
15
|
import { c as F } from "../vendor/lodash-es/cloneDeep.es.js";
|
|
16
|
-
const
|
|
16
|
+
const Te = /* @__PURE__ */ ee({
|
|
17
17
|
__name: "Dropdown",
|
|
18
18
|
props: {
|
|
19
19
|
modelValue: { type: [String, Number, Boolean, Object], default: void 0 },
|
|
@@ -46,78 +46,78 @@ const Ie = /* @__PURE__ */ x({
|
|
|
46
46
|
emits: ["update:modelValue", "show", "fieldInfoClick"],
|
|
47
47
|
setup(W, { expose: q, emit: A }) {
|
|
48
48
|
const e = W, O = A;
|
|
49
|
-
|
|
49
|
+
le(() => {
|
|
50
50
|
X();
|
|
51
51
|
});
|
|
52
|
-
const { locale:
|
|
52
|
+
const { locale: f, defaultProps: G } = de("Dropdown"), H = u(() => pe(e, G)), n = N("preset", {}).dropdown, U = N(
|
|
53
53
|
"preset",
|
|
54
54
|
{}
|
|
55
|
-
).inputgroupaddon, g =
|
|
55
|
+
).inputgroupaddon, g = oe(), y = I(!1), b = I(!1), M = u(() => e.invalid || !!o.errorMessage), o = ae({
|
|
56
56
|
value: e.initialValue !== void 0 ? e.initialValue : e.modelValue
|
|
57
57
|
}), J = u(() => {
|
|
58
58
|
var l;
|
|
59
|
-
return
|
|
59
|
+
return f.emptySelectionErrorMessage.replace("{label}", e.label).replace(
|
|
60
60
|
"{formattedLabel}",
|
|
61
|
-
(l =
|
|
61
|
+
(l = fe(e.label)) == null ? void 0 : l.toLowerCase()
|
|
62
62
|
);
|
|
63
|
-
}), V = u(() =>
|
|
63
|
+
}), V = u(() => ue(e.options)), Q = u(() => {
|
|
64
64
|
var l;
|
|
65
|
-
return e.loading ?
|
|
65
|
+
return e.loading ? f.loadingPlaceholder : e.placeholder ?? ((l = f.inputPlaceholder) == null ? void 0 : l.replace("{label}", e.label ?? "").replace("{lowercaseLabel}", (e.label ?? "").toLowerCase()));
|
|
66
66
|
}), X = () => {
|
|
67
67
|
e.useValidator && (Object.assign(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
), e.initialValue !== void 0 && (
|
|
68
|
+
o,
|
|
69
|
+
se(e.fieldName ?? "dropdown", (l) => !(l != null && l !== "") && e.mandatory ? typeof e.validatorMessage == "object" && "empty" in e.validatorMessage ? e.validatorMessage.empty : e.validatorMessage ?? J.value : ne(Y))
|
|
70
|
+
), e.initialValue !== void 0 && (o.value = e.initialValue), e.invalid && o.validate());
|
|
71
71
|
}, Y = () => e.validatorMessage && e.invalid ? e.validatorMessage : !0, Z = (l) => {
|
|
72
|
-
const { value:
|
|
73
|
-
e.unselectOnReselect ? b.value = !0 : O("update:modelValue",
|
|
72
|
+
const { value: a } = l;
|
|
73
|
+
e.unselectOnReselect ? b.value = !0 : O("update:modelValue", a);
|
|
74
74
|
}, h = () => {
|
|
75
75
|
if (e.optionValue) {
|
|
76
|
-
const l = V.value.find((
|
|
77
|
-
if (typeof
|
|
78
|
-
return e.dataKey ?
|
|
79
|
-
F(
|
|
80
|
-
F(
|
|
76
|
+
const l = V.value.find((a) => {
|
|
77
|
+
if (typeof a != "string")
|
|
78
|
+
return e.dataKey ? o.value[e.dataKey] === a[e.optionValue ?? ""][e.dataKey] : z(
|
|
79
|
+
F(a[e.optionValue ?? ""]),
|
|
80
|
+
F(o.value)
|
|
81
81
|
);
|
|
82
82
|
});
|
|
83
83
|
if (l && typeof l != "string")
|
|
84
84
|
return l[e.optionLabel ?? ""];
|
|
85
|
-
} else if (
|
|
86
|
-
return
|
|
87
|
-
return
|
|
85
|
+
} else if (o.value && typeof o.value == "object" && e.optionLabel && e.optionLabel in o.value)
|
|
86
|
+
return o.value[e.optionLabel];
|
|
87
|
+
return o.value;
|
|
88
88
|
}, _ = () => {
|
|
89
89
|
g.value && g.value.show();
|
|
90
90
|
};
|
|
91
91
|
return $(
|
|
92
92
|
() => e.initialValue,
|
|
93
93
|
(l) => {
|
|
94
|
-
|
|
94
|
+
o.value = l;
|
|
95
95
|
},
|
|
96
96
|
{ once: !0 }
|
|
97
97
|
), $(
|
|
98
98
|
() => e.modelValue,
|
|
99
99
|
(l) => {
|
|
100
|
-
|
|
100
|
+
o.value = l;
|
|
101
101
|
}
|
|
102
102
|
), $(
|
|
103
|
-
() =>
|
|
104
|
-
(l,
|
|
103
|
+
() => o.value,
|
|
104
|
+
(l, a) => {
|
|
105
105
|
setTimeout(() => {
|
|
106
|
-
e.unselectOnReselect && b.value && (z(l,
|
|
106
|
+
e.unselectOnReselect && b.value && (z(l, a) && l !== void 0 && (o.value = void 0), b.value = !1, O("update:modelValue", o.value));
|
|
107
107
|
}, 0);
|
|
108
108
|
}
|
|
109
109
|
), q({
|
|
110
110
|
showOverlay: _
|
|
111
|
-
}), (l,
|
|
111
|
+
}), (l, a) => (s(), m(ce, {
|
|
112
112
|
info: l.fieldInfo,
|
|
113
113
|
label: e.label,
|
|
114
114
|
mandatory: e.mandatory,
|
|
115
115
|
"show-optional-text": l.showOptionalText,
|
|
116
|
-
onInfoClick:
|
|
116
|
+
onInfoClick: a[3] || (a[3] = (w) => l.$emit("fieldInfoClick"))
|
|
117
117
|
}, {
|
|
118
118
|
default: r(() => [
|
|
119
|
-
d(
|
|
120
|
-
class:
|
|
119
|
+
d(ge, {
|
|
120
|
+
class: te([
|
|
121
121
|
{
|
|
122
122
|
"grid grid-cols-[max-content,1fr,max-content]": l.$slots["addon-left"] && l.$slots["addon-right"],
|
|
123
123
|
"grid grid-cols-[1fr,max-content]": !l.$slots["addon-left"] && l.$slots["addon-right"],
|
|
@@ -131,85 +131,95 @@ const Ie = /* @__PURE__ */ x({
|
|
|
131
131
|
default: r(() => {
|
|
132
132
|
var w, C, S, P, L;
|
|
133
133
|
return [
|
|
134
|
-
l.$slots["addon-left"] ? (s(),
|
|
134
|
+
l.$slots["addon-left"] ? (s(), m(i(K), {
|
|
135
135
|
key: 0,
|
|
136
136
|
disabled: e.disabled
|
|
137
137
|
}, {
|
|
138
138
|
default: r(() => [
|
|
139
|
-
|
|
139
|
+
p(l.$slots, "addon-left")
|
|
140
140
|
]),
|
|
141
141
|
_: 3
|
|
142
142
|
}, 8, ["disabled"])) : T("", !0),
|
|
143
|
-
d(
|
|
143
|
+
d(i(me), j({
|
|
144
144
|
ref_key: "dropdown",
|
|
145
145
|
ref: g
|
|
146
146
|
}, e, {
|
|
147
|
-
modelValue:
|
|
148
|
-
"onUpdate:modelValue":
|
|
147
|
+
modelValue: o.value,
|
|
148
|
+
"onUpdate:modelValue": a[0] || (a[0] = (t) => o.value = t),
|
|
149
149
|
"aria-describedby": e.label + "error",
|
|
150
|
-
"filter-placeholder": e.filterPlaceholder ||
|
|
150
|
+
"filter-placeholder": e.filterPlaceholder || i(f).filterPlaceholder,
|
|
151
151
|
invalid: M.value,
|
|
152
152
|
options: V.value,
|
|
153
153
|
placeholder: Q.value,
|
|
154
154
|
pt: {
|
|
155
|
-
list: (w =
|
|
156
|
-
panel: (C =
|
|
157
|
-
virtualScroller: (S =
|
|
158
|
-
wrapper: (P =
|
|
155
|
+
list: (w = i(n)) == null ? void 0 : w.list({ props: e }),
|
|
156
|
+
panel: (C = i(n)) == null ? void 0 : C.panel({ props: e }),
|
|
157
|
+
virtualScroller: (S = i(n)) == null ? void 0 : S.virtualScroller({ props: e }),
|
|
158
|
+
wrapper: (P = i(n)) == null ? void 0 : P.wrapper({ props: e })
|
|
159
159
|
},
|
|
160
160
|
"virtual-scroller-options": ((L = V.value) == null ? void 0 : L.length) > 10 ? { itemSize: 32 } : void 0,
|
|
161
161
|
onChange: Z,
|
|
162
|
-
onHide:
|
|
163
|
-
onShow:
|
|
164
|
-
}),
|
|
162
|
+
onHide: a[1] || (a[1] = (t) => y.value = !1),
|
|
163
|
+
onShow: a[2] || (a[2] = (t) => (l.$emit("show"), y.value = !0))
|
|
164
|
+
}), ie({
|
|
165
165
|
dropdownicon: r(() => [
|
|
166
|
-
d(B, v(c(
|
|
166
|
+
d(B, v(c(i(n).dropdownicon({ state: { isShowOverlay: y.value } }))), null, 16)
|
|
167
167
|
]),
|
|
168
168
|
loadingicon: r(() => [
|
|
169
|
-
d(B, v(c(
|
|
169
|
+
d(B, v(c(i(n).loadingicon)), null, 16)
|
|
170
170
|
]),
|
|
171
171
|
filtericon: r(() => [
|
|
172
|
-
d(B, v(c(
|
|
172
|
+
d(B, v(c(i(n).filtericon)), null, 16)
|
|
173
173
|
]),
|
|
174
174
|
_: 2
|
|
175
175
|
}, [
|
|
176
176
|
l.loading ? {
|
|
177
177
|
name: "value",
|
|
178
|
-
fn: r(({ placeholder:
|
|
179
|
-
|
|
178
|
+
fn: r(({ placeholder: t }) => [
|
|
179
|
+
re("span", v(c(i(n).loadingplaceholder)), k(t), 17)
|
|
180
180
|
]),
|
|
181
181
|
key: "0"
|
|
182
182
|
} : {
|
|
183
183
|
name: "value",
|
|
184
|
-
fn: r((
|
|
185
|
-
(H.value.allowNullOption ?
|
|
184
|
+
fn: r((t) => [
|
|
185
|
+
(H.value.allowNullOption ? t.value !== void 0 : t.value != null) ? p(l.$slots, "value", {
|
|
186
186
|
key: 0,
|
|
187
|
-
originalValue:
|
|
187
|
+
originalValue: t.value,
|
|
188
188
|
value: h()
|
|
189
189
|
}, () => [
|
|
190
|
-
l.valueType === "badge" ? (s(),
|
|
190
|
+
l.valueType === "badge" ? (s(), m(ve, j({ key: 0 }, l.badgeValueProps, {
|
|
191
191
|
label: h()
|
|
192
192
|
}), null, 16, ["label"])) : (s(), D(E, { key: 1 }, [
|
|
193
193
|
R(k(h()), 1)
|
|
194
194
|
], 64))
|
|
195
195
|
]) : (s(), D(E, { key: 1 }, [
|
|
196
|
-
R(k(
|
|
196
|
+
R(k(t.placeholder), 1)
|
|
197
197
|
], 64))
|
|
198
198
|
]),
|
|
199
199
|
key: "1"
|
|
200
200
|
},
|
|
201
201
|
l.$slots.option ? {
|
|
202
202
|
name: "option",
|
|
203
|
-
fn: r(({ option:
|
|
204
|
-
|
|
203
|
+
fn: r(({ option: t }) => [
|
|
204
|
+
p(l.$slots, "option", { option: t })
|
|
205
205
|
]),
|
|
206
206
|
key: "2"
|
|
207
|
+
} : void 0,
|
|
208
|
+
l.$slots.footer ? {
|
|
209
|
+
name: "footer",
|
|
210
|
+
fn: r(({ value: t, options: x }) => [
|
|
211
|
+
p(l.$slots, "footer", {
|
|
212
|
+
options: x,
|
|
213
|
+
value: t
|
|
214
|
+
})
|
|
215
|
+
]),
|
|
216
|
+
key: "3"
|
|
207
217
|
} : void 0
|
|
208
218
|
]), 1040, ["modelValue", "aria-describedby", "filter-placeholder", "invalid", "options", "placeholder", "pt", "virtual-scroller-options"]),
|
|
209
|
-
l.$slots["addon-right"] ? (s(),
|
|
219
|
+
l.$slots["addon-right"] ? (s(), m(i(K), {
|
|
210
220
|
key: 1,
|
|
211
221
|
pt: {
|
|
212
|
-
root:
|
|
222
|
+
root: i(U).root({
|
|
213
223
|
props: {
|
|
214
224
|
class: [
|
|
215
225
|
{
|
|
@@ -221,7 +231,7 @@ const Ie = /* @__PURE__ */ x({
|
|
|
221
231
|
}
|
|
222
232
|
}, {
|
|
223
233
|
default: r(() => [
|
|
224
|
-
|
|
234
|
+
p(l.$slots, "addon-right")
|
|
225
235
|
]),
|
|
226
236
|
_: 3
|
|
227
237
|
}, 8, ["pt"])) : T("", !0)
|
|
@@ -229,9 +239,9 @@ const Ie = /* @__PURE__ */ x({
|
|
|
229
239
|
}),
|
|
230
240
|
_: 3
|
|
231
241
|
}, 8, ["class", "disabled", "invalid", "ring"]),
|
|
232
|
-
d(
|
|
242
|
+
d(ye, {
|
|
233
243
|
id: e.label + "error",
|
|
234
|
-
message:
|
|
244
|
+
message: o.errorMessage
|
|
235
245
|
}, null, 8, ["id", "message"])
|
|
236
246
|
]),
|
|
237
247
|
_: 3
|
|
@@ -239,5 +249,5 @@ const Ie = /* @__PURE__ */ x({
|
|
|
239
249
|
}
|
|
240
250
|
});
|
|
241
251
|
export {
|
|
242
|
-
|
|
252
|
+
Te as _
|
|
243
253
|
};
|