bitboss-ui 2.0.22 → 2.0.23
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/dist/index107.js +5 -5
- package/dist/index115.js +1 -1
- package/dist/index117.js +5 -5
- package/dist/index119.js +1 -1
- package/dist/index123.js +1 -1
- package/dist/index124.js +1 -1
- package/dist/index125.js +1 -1
- package/dist/index127.js +1 -1
- package/dist/index129.js +2 -2
- package/dist/index130.js +1 -1
- package/dist/index14.js +1 -1
- package/dist/index16.js +3 -3
- package/dist/index18.js +2 -2
- package/dist/index199.js +2 -81
- package/dist/index199.js.map +1 -1
- package/dist/index20.js +12 -12
- package/dist/index200.js +80 -7
- package/dist/index200.js.map +1 -1
- package/dist/index201.js +44 -3
- package/dist/index201.js.map +1 -1
- package/dist/index203.js +12 -43
- package/dist/index203.js.map +1 -1
- package/dist/index204.js +6 -0
- package/dist/index204.js.map +1 -0
- package/dist/index205.js +3 -13
- package/dist/index205.js.map +1 -1
- package/dist/index206.js +33 -156
- package/dist/index206.js.map +1 -1
- package/dist/index207.js +5 -83
- package/dist/index207.js.map +1 -1
- package/dist/index208.js +10 -0
- package/dist/index208.js.map +1 -0
- package/dist/index209.js +8 -3
- package/dist/index209.js.map +1 -1
- package/dist/index210.js +123 -32
- package/dist/index210.js.map +1 -1
- package/dist/index211.js +5 -6
- package/dist/index211.js.map +1 -1
- package/dist/index212.js +123 -7
- package/dist/index212.js.map +1 -1
- package/dist/index213.js +18 -280
- package/dist/index213.js.map +1 -1
- package/dist/index214.js +2 -2
- package/dist/index215.js +2 -2
- package/dist/index216.js +2 -19
- package/dist/index216.js.map +1 -1
- package/dist/index217.js +2 -19
- package/dist/index217.js.map +1 -1
- package/dist/index218.js +172 -25
- package/dist/index218.js.map +1 -1
- package/dist/index219.js +5 -3
- package/dist/index219.js.map +1 -1
- package/dist/index22.js +13 -13
- package/dist/index220.js +369 -2
- package/dist/index220.js.map +1 -1
- package/dist/index221.js +17 -247
- package/dist/index221.js.map +1 -1
- package/dist/index222.js +26 -51
- package/dist/index222.js.map +1 -1
- package/dist/index223.js +3 -44
- package/dist/index223.js.map +1 -1
- package/dist/index224.js +249 -5
- package/dist/index224.js.map +1 -1
- package/dist/index225.js +43 -40
- package/dist/index225.js.map +1 -1
- package/dist/index226.js +44 -2
- package/dist/index226.js.map +1 -1
- package/dist/index227.js +5 -4
- package/dist/index227.js.map +1 -1
- package/dist/index228.js +49 -2
- package/dist/index228.js.map +1 -1
- package/dist/index229.js +151 -119
- package/dist/index229.js.map +1 -1
- package/dist/index230.js +84 -123
- package/dist/index230.js.map +1 -1
- package/dist/index232.js +2 -174
- package/dist/index232.js.map +1 -1
- package/dist/index233.js +4 -5
- package/dist/index233.js.map +1 -1
- package/dist/index234.js +2 -369
- package/dist/index234.js.map +1 -1
- package/dist/index235.js +2 -2
- package/dist/index235.js.map +1 -1
- package/dist/index236.js +18 -2
- package/dist/index236.js.map +1 -1
- package/dist/index237.js +105 -17
- package/dist/index237.js.map +1 -1
- package/dist/{index240.js → index239.js} +2 -2
- package/dist/{index240.js.map → index239.js.map} +1 -1
- package/dist/index24.js +5 -5
- package/dist/index241.js +5 -0
- package/dist/index241.js.map +1 -0
- package/dist/index244.js +3 -6
- package/dist/index244.js.map +1 -1
- package/dist/index245.js +8 -15
- package/dist/index245.js.map +1 -1
- package/dist/index246.js +23 -9
- package/dist/index246.js.map +1 -1
- package/dist/index247.js +9 -3
- package/dist/index247.js.map +1 -1
- package/dist/index248.js +6 -9
- package/dist/index248.js.map +1 -1
- package/dist/index249.js +16 -23
- package/dist/index249.js.map +1 -1
- package/dist/index250.js +1 -1
- package/dist/index251.js +1 -1
- package/dist/index254.js +431 -3
- package/dist/index254.js.map +1 -1
- package/dist/index255.js +88 -11
- package/dist/index255.js.map +1 -1
- package/dist/index256.js +280 -8
- package/dist/index256.js.map +1 -1
- package/dist/index257.js +6 -9
- package/dist/index257.js.map +1 -1
- package/dist/index258.js +2 -17
- package/dist/index258.js.map +1 -1
- package/dist/index259.js +2 -2
- package/dist/index259.js.map +1 -1
- package/dist/index26.js +1 -1
- package/dist/index260.js +2 -66
- package/dist/index260.js.map +1 -1
- package/dist/index261.js +2 -5
- package/dist/index261.js.map +1 -1
- package/dist/index262.js +2 -431
- package/dist/index262.js.map +1 -1
- package/dist/index263.js +119 -82
- package/dist/index263.js.map +1 -1
- package/dist/index264.js +22 -6
- package/dist/index264.js.map +1 -1
- package/dist/index266.js +200 -2
- package/dist/index266.js.map +1 -1
- package/dist/index269.js +2 -2
- package/dist/index270.js +2 -2
- package/dist/index271.js +1 -1
- package/dist/index272.js +1 -1
- package/dist/index273.js +28 -2
- package/dist/index273.js.map +1 -1
- package/dist/index274.js +21 -1
- package/dist/index274.js.map +1 -1
- package/dist/index276.js +435 -21
- package/dist/index276.js.map +1 -1
- package/dist/index277.js +130 -0
- package/dist/index277.js.map +1 -0
- package/dist/index278.js +2 -200
- package/dist/index278.js.map +1 -1
- package/dist/index279.js +9 -4
- package/dist/index279.js.map +1 -1
- package/dist/index28.js +3 -3
- package/dist/index280.js +3 -2
- package/dist/index280.js.map +1 -1
- package/dist/index281.js +12 -126
- package/dist/index281.js.map +1 -1
- package/dist/index282.js +8 -21
- package/dist/index282.js.map +1 -1
- package/dist/index283.js +20 -0
- package/dist/index283.js.map +1 -0
- package/dist/index284.js +64 -434
- package/dist/index284.js.map +1 -1
- package/dist/index285.js +5 -127
- package/dist/index285.js.map +1 -1
- package/dist/index286.js +4 -3
- package/dist/index286.js.map +1 -1
- package/dist/index287.js +1 -1
- package/dist/index288.js +3 -211
- package/dist/index288.js.map +1 -1
- package/dist/index289.js +211 -15
- package/dist/index289.js.map +1 -1
- package/dist/index290.js +15 -4
- package/dist/index290.js.map +1 -1
- package/dist/index291.js +79 -4
- package/dist/index291.js.map +1 -1
- package/dist/index293.js +4 -79
- package/dist/index293.js.map +1 -1
- package/dist/index294.js +7 -0
- package/dist/index294.js.map +1 -0
- package/dist/index295.js +59 -2
- package/dist/index295.js.map +1 -1
- package/dist/index296.js +34 -10
- package/dist/index296.js.map +1 -1
- package/dist/index297.js +2 -35
- package/dist/index297.js.map +1 -1
- package/dist/index298.js +10 -6
- package/dist/index298.js.map +1 -1
- package/dist/index299.js +5 -17
- package/dist/index299.js.map +1 -1
- package/dist/index30.js +2 -2
- package/dist/index300.js +6 -46
- package/dist/index300.js.map +1 -1
- package/dist/index301.js +17 -5
- package/dist/index301.js.map +1 -1
- package/dist/index302.js +47 -480
- package/dist/index302.js.map +1 -1
- package/dist/index303.js +483 -0
- package/dist/index303.js.map +1 -0
- package/dist/index305.js +416 -42
- package/dist/index305.js.map +1 -1
- package/dist/index306.js +47 -2
- package/dist/index306.js.map +1 -1
- package/dist/index307.js +5 -0
- package/dist/index307.js.map +1 -0
- package/dist/index32.js +2 -2
- package/dist/index34.js +3 -3
- package/dist/index36.js +13 -13
- package/dist/index38.js +4 -4
- package/dist/index40.js +2 -2
- package/dist/index42.js +2 -2
- package/dist/index44.js +6 -6
- package/dist/index46.js +2 -2
- package/dist/index48.js +2 -2
- package/dist/index54.js +1 -1
- package/dist/index56.js +1 -1
- package/dist/index72.js +3 -3
- package/dist/index76.js +2 -2
- package/dist/index78.js +1 -1
- package/dist/index81.js +2 -2
- package/dist/index83.js +1 -1
- package/dist/index85.js +3 -3
- package/dist/index87.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/dist/index202.js +0 -5
- package/dist/index202.js.map +0 -1
- package/dist/index231.js +0 -5
- package/dist/index231.js.map +0 -1
- package/dist/index238.js +0 -109
- package/dist/index238.js.map +0 -1
- package/dist/index265.js +0 -5
- package/dist/index265.js.map +0 -1
- package/dist/index275.js +0 -31
- package/dist/index275.js.map +0 -1
- package/dist/index292.js +0 -62
- package/dist/index292.js.map +0 -1
- package/dist/index304.js +0 -424
- package/dist/index304.js.map +0 -1
package/dist/index229.js
CHANGED
@@ -1,129 +1,161 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
|
7
|
-
|
8
|
-
}
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
return Math.round(l * t) / t;
|
38
|
-
}
|
39
|
-
function L(e, l, t) {
|
40
|
-
t === void 0 && (t = {});
|
41
|
-
const x = t.whileElementsMounted, V = a(() => {
|
42
|
-
var n;
|
43
|
-
return (n = o(t.open)) != null ? n : !0;
|
44
|
-
}), D = a(() => o(t.middleware)), d = a(() => {
|
45
|
-
var n;
|
46
|
-
return (n = o(t.placement)) != null ? n : "bottom";
|
47
|
-
}), v = a(() => {
|
48
|
-
var n;
|
49
|
-
return (n = o(t.strategy)) != null ? n : "absolute";
|
50
|
-
}), S = a(() => {
|
51
|
-
var n;
|
52
|
-
return (n = o(t.transform)) != null ? n : !0;
|
53
|
-
}), i = a(() => g(e.value)), u = a(() => g(l.value)), p = f(0), w = f(0), c = f(v.value), O = f(d.value), P = I({}), y = f(!1), _ = a(() => {
|
54
|
-
const n = {
|
55
|
-
position: c.value,
|
56
|
-
left: "0",
|
57
|
-
top: "0"
|
1
|
+
import { ref as a, computed as r, onBeforeMount as Y, onBeforeUnmount as Z, watch as H, nextTick as N } from "vue";
|
2
|
+
import { last as _ } from "./index217.js";
|
3
|
+
import { useArray as Q } from "./index281.js";
|
4
|
+
import { uniqBy as $ } from "./index282.js";
|
5
|
+
import { useItemValue as ee } from "./index279.js";
|
6
|
+
import { useItemText as te } from "./index283.js";
|
7
|
+
import { hash as v } from "./index223.js";
|
8
|
+
import { isNotNil as q } from "./index131.js";
|
9
|
+
import { waitFor as le } from "./index207.js";
|
10
|
+
import { isNil as oe } from "./index126.js";
|
11
|
+
const he = (l) => {
|
12
|
+
const i = a(""), F = a(), u = (e) => {
|
13
|
+
F.value = e, l.emit("update:modelValue", e);
|
14
|
+
}, d = a([]), {
|
15
|
+
array: k,
|
16
|
+
add: E,
|
17
|
+
remove: P,
|
18
|
+
set: y
|
19
|
+
} = Q(), {
|
20
|
+
array: S,
|
21
|
+
add: j,
|
22
|
+
remove: J
|
23
|
+
} = Q(), { getItemText: L } = te(), { getItemValue: U } = ee(), O = (e) => {
|
24
|
+
const t = !!(l.disabled.value || e.disabled), o = L(e, l.itemText), n = U(e, l.itemValue);
|
25
|
+
if (n === void 0)
|
26
|
+
throw new Error(
|
27
|
+
'The result of extracting "value" from option was undefined. Affected item is ' + JSON.stringify(e) + " please check itemValue property is correct."
|
28
|
+
);
|
29
|
+
const X = v(n);
|
30
|
+
return {
|
31
|
+
item: e,
|
32
|
+
text: o,
|
33
|
+
value: n,
|
34
|
+
valueHash: X,
|
35
|
+
disabled: t,
|
36
|
+
selected: !1
|
58
37
|
};
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
38
|
+
}, T = (e) => (e.selected = q(b.value[e.valueHash]), e), V = r(() => {
|
39
|
+
const e = [].concat(
|
40
|
+
d.value.map((t) => T(O(t))),
|
41
|
+
S.value.map(T),
|
42
|
+
k.value.map(T)
|
43
|
+
);
|
44
|
+
return $(e, (t) => t.valueHash);
|
45
|
+
}), z = (e) => {
|
46
|
+
l.multiple ? (u(l.modelValue.value.concat(e.value)), l.stash && E(e), l.resetQueryOnOptionSelected && s()) : (l.stash && y(e), u(e.value), N(() => s()));
|
47
|
+
}, G = async (e) => {
|
48
|
+
if (J((t) => t.valueHash !== e.valueHash), P((t) => t.valueHash !== e.valueHash), l.multiple) {
|
49
|
+
const t = { ...b.value };
|
50
|
+
delete t[e.valueHash], u(Object.values(t));
|
51
|
+
} else
|
52
|
+
u(null), await N(), s();
|
53
|
+
}, b = r(() => {
|
54
|
+
const e = {}, t = [].concat(l.modelValue.value);
|
55
|
+
for (let o = 0; o < t.length; o++) {
|
56
|
+
const n = t[o];
|
57
|
+
e[v(n)] = n;
|
58
|
+
}
|
59
|
+
return e;
|
60
|
+
}), g = async ({ prefill: e = !1 }) => {
|
61
|
+
let t = [];
|
62
|
+
if (Array.isArray(l.items.value))
|
63
|
+
t = l.items.value;
|
64
|
+
else if (typeof l.items.value == "function") {
|
65
|
+
const o = ++c.value;
|
66
|
+
try {
|
67
|
+
t = await l.items.value(
|
68
|
+
i.value,
|
69
|
+
e,
|
70
|
+
l.modelValue.value
|
71
|
+
), o < c.value && (await le(() => o === c.value), t = d.value);
|
72
|
+
} catch (n) {
|
73
|
+
console.error(n);
|
67
74
|
}
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
75
|
+
c.value--;
|
76
|
+
}
|
77
|
+
d.value = t;
|
78
|
+
}, B = r(() => {
|
79
|
+
const e = {};
|
80
|
+
for (let t = 0; t < V.value.length; t++) {
|
81
|
+
const o = V.value[t], { valueHash: n } = o;
|
82
|
+
e[n] = o;
|
83
|
+
}
|
84
|
+
return {
|
85
|
+
get: (t) => e[v(t)]
|
72
86
|
};
|
73
|
-
})
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
strategy: v.value
|
80
|
-
}).then((n) => {
|
81
|
-
p.value = n.x, w.value = n.y, c.value = n.strategy, O.value = n.placement, P.value = n.middlewareData, y.value = !0;
|
82
|
-
});
|
83
|
-
}
|
84
|
-
function E() {
|
85
|
-
typeof s == "function" && (s(), s = void 0);
|
86
|
-
}
|
87
|
-
function N() {
|
88
|
-
if (E(), x === void 0) {
|
89
|
-
m();
|
87
|
+
}), f = r(() => [].concat(l.modelValue.value).reduce((e, t) => {
|
88
|
+
const o = B.value.get(t);
|
89
|
+
return o && e.push(o), e;
|
90
|
+
}, [])), C = (e) => q(B.value.get(e)), s = () => {
|
91
|
+
if (l.multiple) {
|
92
|
+
i.value = "";
|
90
93
|
return;
|
91
94
|
}
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
+
let e;
|
96
|
+
f.value && (e = _(f.value)), i.value = (e == null ? void 0 : e.text) || "";
|
97
|
+
}, K = () => {
|
98
|
+
const e = i.value.trim(), t = O(e);
|
99
|
+
j(t), s();
|
100
|
+
}, c = a(0), M = r(() => [].concat(l.modelValue.value).reduce(
|
101
|
+
(e, t) => (C(t) ? e.coherent.push(t) : e.incoherent.push(t), e),
|
102
|
+
{ coherent: [], incoherent: [] }
|
103
|
+
)), A = r(() => l.multiple && !l.modelValue.value.length || !l.multiple && oe(l.modelValue.value) ? !0 : !M.value.incoherent.length), R = () => {
|
104
|
+
l.enforceCoherence && !A.value && (l.multiple ? u(M.value.coherent) : u(null));
|
105
|
+
}, p = a(!1), I = a(!1), m = async () => {
|
106
|
+
I.value = !0, await g({ prefill: !0 }), R(), s(), p.value = !0, I.value = !1;
|
107
|
+
};
|
108
|
+
Y(async () => {
|
109
|
+
l.prefill && (await m(), l.stash && y(...f.value));
|
110
|
+
});
|
111
|
+
let h;
|
112
|
+
const W = () => {
|
113
|
+
h && clearTimeout(h), h = setTimeout(async () => {
|
114
|
+
try {
|
115
|
+
await g({ prefill: !1 });
|
116
|
+
} catch (e) {
|
117
|
+
console.error(e);
|
118
|
+
}
|
119
|
+
}, l.queryDebounceTime);
|
120
|
+
};
|
121
|
+
Z(() => clearTimeout(h));
|
122
|
+
let x;
|
123
|
+
H(
|
124
|
+
() => l.modelValue.value,
|
125
|
+
() => {
|
126
|
+
A.value || (x && clearTimeout(x), x = setTimeout(async () => {
|
127
|
+
m();
|
128
|
+
}, l.modelValueDebounceTime));
|
95
129
|
}
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
}
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
130
|
+
);
|
131
|
+
let w;
|
132
|
+
const D = async (e, t) => {
|
133
|
+
v(t) !== v(e) && p.value && (w && clearTimeout(w), w = setTimeout(async () => {
|
134
|
+
await m();
|
135
|
+
}, l.depsDebounceTime));
|
136
|
+
};
|
137
|
+
return H(() => l.items.value, D), H(() => l.dependencies.value, D), {
|
138
|
+
addCurrentQueryToManualItems: K,
|
139
|
+
alignQueryToState: s,
|
140
|
+
getOptions: g,
|
141
|
+
hasPrefilled: p,
|
142
|
+
innerLoading: c,
|
143
|
+
isPrefilling: I,
|
144
|
+
manualItems: S,
|
145
|
+
options: V,
|
146
|
+
prefillItems: m,
|
147
|
+
query: i,
|
148
|
+
searchByQuery: W,
|
149
|
+
selectedOptions: f,
|
150
|
+
selectOption: z,
|
151
|
+
setStash: y,
|
152
|
+
unselectOption: G,
|
153
|
+
updateModelValue: u,
|
154
|
+
valueIsSelected: C,
|
155
|
+
internalItems: d
|
115
156
|
};
|
116
|
-
}
|
157
|
+
};
|
117
158
|
export {
|
118
|
-
|
119
|
-
W as autoUpdate,
|
120
|
-
A as computePosition,
|
121
|
-
X as flip,
|
122
|
-
le as getOverflowAncestors,
|
123
|
-
Y as hide,
|
124
|
-
Z as offset,
|
125
|
-
ee as platform,
|
126
|
-
ne as shift,
|
127
|
-
L as useFloating
|
159
|
+
he as useOptions
|
128
160
|
};
|
129
161
|
//# sourceMappingURL=index229.js.map
|
package/dist/index229.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index229.js","sources":["../node_modules/@floating-ui/vue/dist/floating-ui.vue.mjs"],"sourcesContent":["import { arrow as arrow$1, computePosition } from '@floating-ui/dom';\nexport { autoPlacement, autoUpdate, computePosition, detectOverflow, flip, getOverflowAncestors, hide, inline, limitShift, offset, platform, shift, size } from '@floating-ui/dom';\nimport { isNode, getNodeName } from '@floating-ui/utils/dom';\nimport { unref, computed, ref, shallowRef, watch, getCurrentScope, onScopeDispose, shallowReadonly } from 'vue-demi';\n\nfunction isComponentPublicInstance(target) {\n return target != null && typeof target === 'object' && '$el' in target;\n}\nfunction unwrapElement(target) {\n if (isComponentPublicInstance(target)) {\n const element = target.$el;\n return isNode(element) && getNodeName(element) === '#comment' ? null : element;\n }\n return target;\n}\n\nfunction toValue(source) {\n return typeof source === 'function' ? source() : unref(source);\n}\n\n/**\n * Positions an inner element of the floating element such that it is centered to the reference element.\n * @param options The arrow options.\n * @see https://floating-ui.com/docs/arrow\n */\nfunction arrow(options) {\n return {\n name: 'arrow',\n options,\n fn(args) {\n const element = unwrapElement(toValue(options.element));\n if (element == null) {\n return {};\n }\n return arrow$1({\n element,\n padding: options.padding\n }).fn(args);\n }\n };\n}\n\nfunction getDPR(element) {\n if (typeof window === 'undefined') {\n return 1;\n }\n const win = element.ownerDocument.defaultView || window;\n return win.devicePixelRatio || 1;\n}\n\nfunction roundByDPR(element, value) {\n const dpr = getDPR(element);\n return Math.round(value * dpr) / dpr;\n}\n\n/**\n * Computes the `x` and `y` coordinates that will place the floating element next to a reference element when it is given a certain CSS positioning strategy.\n * @param reference The reference template ref.\n * @param floating The floating template ref.\n * @param options The floating options.\n * @see https://floating-ui.com/docs/vue\n */\nfunction useFloating(reference, floating, options) {\n if (options === void 0) {\n options = {};\n }\n const whileElementsMountedOption = options.whileElementsMounted;\n const openOption = computed(() => {\n var _toValue;\n return (_toValue = toValue(options.open)) != null ? _toValue : true;\n });\n const middlewareOption = computed(() => toValue(options.middleware));\n const placementOption = computed(() => {\n var _toValue2;\n return (_toValue2 = toValue(options.placement)) != null ? _toValue2 : 'bottom';\n });\n const strategyOption = computed(() => {\n var _toValue3;\n return (_toValue3 = toValue(options.strategy)) != null ? _toValue3 : 'absolute';\n });\n const transformOption = computed(() => {\n var _toValue4;\n return (_toValue4 = toValue(options.transform)) != null ? _toValue4 : true;\n });\n const referenceElement = computed(() => unwrapElement(reference.value));\n const floatingElement = computed(() => unwrapElement(floating.value));\n const x = ref(0);\n const y = ref(0);\n const strategy = ref(strategyOption.value);\n const placement = ref(placementOption.value);\n const middlewareData = shallowRef({});\n const isPositioned = ref(false);\n const floatingStyles = computed(() => {\n const initialStyles = {\n position: strategy.value,\n left: '0',\n top: '0'\n };\n if (!floatingElement.value) {\n return initialStyles;\n }\n const xVal = roundByDPR(floatingElement.value, x.value);\n const yVal = roundByDPR(floatingElement.value, y.value);\n if (transformOption.value) {\n return {\n ...initialStyles,\n transform: \"translate(\" + xVal + \"px, \" + yVal + \"px)\",\n ...(getDPR(floatingElement.value) >= 1.5 && {\n willChange: 'transform'\n })\n };\n }\n return {\n position: strategy.value,\n left: xVal + \"px\",\n top: yVal + \"px\"\n };\n });\n let whileElementsMountedCleanup;\n function update() {\n if (referenceElement.value == null || floatingElement.value == null) {\n return;\n }\n computePosition(referenceElement.value, floatingElement.value, {\n middleware: middlewareOption.value,\n placement: placementOption.value,\n strategy: strategyOption.value\n }).then(position => {\n x.value = position.x;\n y.value = position.y;\n strategy.value = position.strategy;\n placement.value = position.placement;\n middlewareData.value = position.middlewareData;\n isPositioned.value = true;\n });\n }\n function cleanup() {\n if (typeof whileElementsMountedCleanup === 'function') {\n whileElementsMountedCleanup();\n whileElementsMountedCleanup = undefined;\n }\n }\n function attach() {\n cleanup();\n if (whileElementsMountedOption === undefined) {\n update();\n return;\n }\n if (referenceElement.value != null && floatingElement.value != null) {\n whileElementsMountedCleanup = whileElementsMountedOption(referenceElement.value, floatingElement.value, update);\n return;\n }\n }\n function reset() {\n if (!openOption.value) {\n isPositioned.value = false;\n }\n }\n watch([middlewareOption, placementOption, strategyOption], update, {\n flush: 'sync'\n });\n watch([referenceElement, floatingElement], attach, {\n flush: 'sync'\n });\n watch(openOption, reset, {\n flush: 'sync'\n });\n if (getCurrentScope()) {\n onScopeDispose(cleanup);\n }\n return {\n x: shallowReadonly(x),\n y: shallowReadonly(y),\n strategy: shallowReadonly(strategy),\n placement: shallowReadonly(placement),\n middlewareData: shallowReadonly(middlewareData),\n isPositioned: shallowReadonly(isPositioned),\n floatingStyles,\n update\n };\n}\n\nexport { arrow, useFloating };\n"],"names":["isComponentPublicInstance","target","unwrapElement","element","isNode","getNodeName","toValue","source","unref","arrow","options","args","arrow$1","getDPR","roundByDPR","value","dpr","useFloating","reference","floating","whileElementsMountedOption","openOption","computed","_toValue","middlewareOption","placementOption","_toValue2","strategyOption","_toValue3","transformOption","_toValue4","referenceElement","floatingElement","x","ref","y","strategy","placement","middlewareData","shallowRef","isPositioned","floatingStyles","initialStyles","xVal","yVal","whileElementsMountedCleanup","update","computePosition","position","cleanup","attach","reset","watch","getCurrentScope","onScopeDispose","shallowReadonly"],"mappings":";;;;;AAKA,SAASA,EAA0BC,GAAQ;AACzC,SAAOA,KAAU,QAAQ,OAAOA,KAAW,YAAY,SAASA;AAClE;AACA,SAASC,EAAcD,GAAQ;AAC7B,MAAID,EAA0BC,CAAM,GAAG;AACrC,UAAME,IAAUF,EAAO;AACvB,WAAOG,EAAOD,CAAO,KAAKE,EAAYF,CAAO,MAAM,aAAa,OAAOA;AAAA,EACxE;AACD,SAAOF;AACT;AAEA,SAASK,EAAQC,GAAQ;AACvB,SAAO,OAAOA,KAAW,aAAaA,EAAM,IAAKC,EAAMD,CAAM;AAC/D;AAOA,SAASE,EAAMC,GAAS;AACtB,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAAA;AAAA,IACA,GAAGC,GAAM;AACP,YAAMR,IAAUD,EAAcI,EAAQI,EAAQ,OAAO,CAAC;AACtD,aAAIP,KAAW,OACN,KAEFS,EAAQ;AAAA,QACb,SAAAT;AAAA,QACA,SAASO,EAAQ;AAAA,MACzB,CAAO,EAAE,GAAGC,CAAI;AAAA,IACX;AAAA,EACL;AACA;AAEA,SAASE,EAAOV,GAAS;AACvB,SAAI,OAAO,SAAW,MACb,KAEGA,EAAQ,cAAc,eAAe,QACtC,oBAAoB;AACjC;AAEA,SAASW,EAAWX,GAASY,GAAO;AAClC,QAAMC,IAAMH,EAA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A,EACX,CAAG,GACDM,EAAM,CAACrB,GAAkBC,CAAe,GAAGkB,GAAQ;AAAA,IACjD,OAAO;AAAA,EACX,CAAG,GACDE,EAAM/B,GAAY8B,GAAO;AAAA,IACvB,OAAO;AAAA,EACX,CAAG,GACGE,EAAe,KACjBC,EAAeL,CAAO,GAEjB;AAAA,IACL,GAAGM,EAAgBtB,CAAC;AAAA,IACpB,GAAGsB,EAAgBpB,CAAC;AAAA,IACpB,UAAUoB,EAAgBnB,CAAQ;AAAA,IAClC,WAAWmB,EAAgBlB,CAAS;AAAA,IACpC,gBAAgBkB,EAAgBjB,CAAc;AAAA,IAC9C,cAAciB,EAAgBf,CAAY;AAAA,IAC1C,gBAAAC;AAAA,IACA,QAAAK;AAAA,EACJ;AACA;","x_google_ignoreList":[0]}
|
1
|
+
{"version":3,"file":"index229.js","sources":["../src/composables/useOptions.ts"],"sourcesContent":["import {\n\tcomputed,\n\tnextTick,\n\tonBeforeMount,\n\tonBeforeUnmount,\n\tref,\n\twatch,\n\ttype Ref,\n} from 'vue';\nimport type { Option as BaseOption } from '@/types/Option';\nimport { last } from '@/utilities/functions/last';\nimport { useArray } from './useArray';\nimport { uniqBy } from '@/utilities/functions/uniqBy';\nimport { useItemValue } from './useItemValue';\nimport { useItemText } from './useItemText';\nimport { hash } from '@/utilities/functions/hash';\nimport { isNotNil } from '@/utilities/functions/isNotNil';\nimport { waitFor } from '@/utilities/functions/waitFor';\nimport { isNil } from '@/utilities/functions/isNil';\n\ntype Options = {\n\tmultiple: boolean;\n\tstash: boolean;\n\titemText: string | ((item: any) => string) | undefined;\n\titemValue: string | ((item: any) => string) | undefined;\n\tmodelValue: Ref<any>;\n\tresetQueryOnOptionSelected: boolean;\n\temit: any;\n\titems: Ref<any>;\n\tenforceCoherence: boolean;\n\tprefill: boolean;\n\tmodelValueDebounceTime: number;\n\tdepsDebounceTime: number;\n\tdependencies: Ref<any[]>;\n\tqueryDebounceTime: number;\n\tdisabled: Ref<boolean>;\n};\n\nexport const useOptions = (params: Options) => {\n\tconst query = ref<string>('');\n\n\tconst lastEmittedValue = ref();\n\tconst updateModelValue = (value: any) => {\n\t\tlastEmittedValue.value = value;\n\t\tparams.emit('update:modelValue', value);\n\t};\n\n\tconst internalItems = ref<any[]>([]);\n\tconst {\n\t\tarray: innerStash,\n\t\tadd: addToStash,\n\t\tremove: removeFromStash,\n\t\tset: setStash,\n\t} = useArray<BaseOption>();\n\n\tconst {\n\t\tarray: manualItems,\n\t\tadd: addToManualItems,\n\t\tremove: removeFromManualItems,\n\t} = useArray<BaseOption>();\n\n\tconst { getItemText } = useItemText();\n\tconst { getItemValue } = useItemValue();\n\tconst createOption = (item: any): BaseOption => {\n\t\tconst disabled = !!(params.disabled.value || item.disabled);\n\t\tconst text = getItemText(item, params.itemText);\n\t\tconst value = getItemValue(item, params.itemValue);\n\n\t\t// Undefined is not supported\n\t\tif (value === undefined)\n\t\t\tthrow new Error(\n\t\t\t\t'The result of extracting \"value\" from option was undefined. Affected item is ' +\n\t\t\t\t\tJSON.stringify(item) +\n\t\t\t\t\t' please check itemValue property is correct.'\n\t\t\t);\n\t\tconst valueHash = hash(value);\n\t\tconst selected = false;\n\t\treturn {\n\t\t\titem,\n\t\t\ttext,\n\t\t\tvalue,\n\t\t\tvalueHash,\n\t\t\tdisabled,\n\t\t\tselected,\n\t\t};\n\t};\n\n\tconst setSelected = (o: BaseOption) => {\n\t\to.selected = isNotNil(modelValueIndexedByHash.value[o.valueHash]);\n\t\treturn o;\n\t};\n\tconst options = computed<BaseOption[]>(() => {\n\t\tconst base = ([] as BaseOption[]).concat(\n\t\t\tinternalItems.value.map((item) => {\n\t\t\t\treturn setSelected(createOption(item));\n\t\t\t}),\n\t\t\tmanualItems.value.map(setSelected),\n\t\t\tinnerStash.value.map(setSelected)\n\t\t);\n\t\treturn uniqBy(base, (o) => o.valueHash);\n\t});\n\n\tconst selectOption = (option: BaseOption) => {\n\t\tif (params.multiple) {\n\t\t\tupdateModelValue(params.modelValue.value.concat(option.value));\n\t\t\tif (params.stash) {\n\t\t\t\taddToStash(option);\n\t\t\t}\n\n\t\t\tif (params.resetQueryOnOptionSelected) {\n\t\t\t\talignQueryToState();\n\t\t\t}\n\t\t} else {\n\t\t\tif (params.stash) {\n\t\t\t\tsetStash(option);\n\t\t\t}\n\t\t\tupdateModelValue(option.value);\n\t\t\tnextTick(() => alignQueryToState());\n\t\t}\n\t};\n\tconst unselectOption = async (option: BaseOption) => {\n\t\tremoveFromManualItems((o) => o.valueHash !== option.valueHash);\n\t\tremoveFromStash((o) => o.valueHash !== option.valueHash);\n\t\tif (params.multiple) {\n\t\t\tconst copy = { ...modelValueIndexedByHash.value };\n\t\t\tdelete copy[option.valueHash];\n\t\t\tupdateModelValue(Object.values(copy));\n\t\t} else {\n\t\t\tupdateModelValue(null);\n\t\t\tawait nextTick();\n\t\t\talignQueryToState();\n\t\t}\n\t};\n\n\t/**\n\t * Indexes modelValue to a map of hash - value pairs so we can easily track which values are selected\n\t */\n\tconst modelValueIndexedByHash = computed(() => {\n\t\tconst map: Record<string, any> = {};\n\t\tconst arr = [].concat(params.modelValue.value);\n\t\tfor (let index = 0; index < arr.length; index++) {\n\t\t\tconst element = arr[index];\n\t\t\tmap[hash(element)] = element;\n\t\t}\n\t\treturn map;\n\t});\n\n\tconst getOptions = async ({ prefill = false }) => {\n\t\tlet items: any[] = [];\n\t\tif (Array.isArray(params.items.value)) {\n\t\t\titems = params.items.value;\n\t\t} else {\n\t\t\tif (typeof params.items.value === 'function') {\n\t\t\t\tconst order = ++innerLoading.value;\n\t\t\t\ttry {\n\t\t\t\t\titems = await params.items.value(\n\t\t\t\t\t\tquery.value,\n\t\t\t\t\t\tprefill,\n\t\t\t\t\t\tparams.modelValue.value\n\t\t\t\t\t);\n\t\t\t\t\t// If by the time this resolves another call has already been made discard this result\n\t\t\t\t\tif (order < innerLoading.value) {\n\t\t\t\t\t\tawait waitFor(() => order === innerLoading.value);\n\t\t\t\t\t\titems = internalItems.value;\n\t\t\t\t\t}\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconsole.error(error);\n\t\t\t\t}\n\t\t\t\tinnerLoading.value--;\n\t\t\t}\n\t\t}\n\t\tinternalItems.value = items as any;\n\t};\n\n\t/**\n\t * Indexes options by their hash so they can be retrieved\n\t */\n\tconst optionsIndexedByHash = computed(() => {\n\t\tconst map: Record<string, BaseOption> = {};\n\t\tfor (let index = 0; index < options.value.length; index++) {\n\t\t\tconst element = options.value[index];\n\t\t\tconst { valueHash } = element;\n\t\t\tmap[valueHash] = element;\n\t\t}\n\t\treturn {\n\t\t\tget: (value: any) => {\n\t\t\t\treturn map[hash(value)];\n\t\t\t},\n\t\t};\n\t});\n\n\t/**\n\t * For every item in modelValue find the linked option if it exists.\n\t * This is used to display chips.\n\t */\n\tconst selectedOptions = computed(() => {\n\t\treturn [].concat(params.modelValue.value).reduce((acc, h) => {\n\t\t\tconst found = optionsIndexedByHash.value.get(h);\n\t\t\tif (found) {\n\t\t\t\tacc.push(found);\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, [] as BaseOption[]);\n\t});\n\n\tconst valueIsSelected = (value: any) =>\n\t\tisNotNil(optionsIndexedByHash.value.get(value));\n\n\tconst alignQueryToState = () => {\n\t\tif (params.multiple) {\n\t\t\tquery.value = '';\n\t\t\treturn;\n\t\t}\n\t\tlet option: BaseOption | undefined;\n\t\tif (selectedOptions.value) {\n\t\t\toption = last(selectedOptions.value);\n\t\t}\n\t\tquery.value = option?.text || '';\n\t};\n\n\t/**\n\t * Add an option to the manual items and then reset the query\n\t */\n\tconst addCurrentQueryToManualItems = () => {\n\t\tconst text = query.value.trim();\n\t\tconst option = createOption(text);\n\t\taddToManualItems(option);\n\t\talignQueryToState();\n\t};\n\n\t/**\n\t * Use a number accumulator because if the fn takes 5 seconds\n\t * and after 2 seconds another search is run\n\t * When the first returns the second is still out for 2 seconds\n\t * and we want to track them both.\n\t * Debounce will not be enough.\n\t */\n\tconst innerLoading = ref(0);\n\n\t/**\n\t * Coherent values are values that have an option they can be linked to.\n\t * Divide coherent and incoherent values.\n\t */\n\n\tconst coherenceStatus = computed(() => {\n\t\treturn [].concat(params.modelValue.value).reduce(\n\t\t\t(acc, curr) => {\n\t\t\t\tif (valueIsSelected(curr)) {\n\t\t\t\t\tacc.coherent.push(curr);\n\t\t\t\t} else {\n\t\t\t\t\tacc.incoherent.push(curr);\n\t\t\t\t}\n\t\t\t\treturn acc;\n\t\t\t},\n\t\t\t{ coherent: [], incoherent: [] }\n\t\t);\n\t});\n\n\t/**\n\t * Model value is considered coherent when:\n\t * - multiple mode is empty\n\t * - single mode is null\n\t */\n\tconst modelValueIsCoherent = computed(() => {\n\t\tif (params.multiple && !params.modelValue.value.length) return true;\n\t\telse if (!params.multiple && isNil(params.modelValue.value)) return true;\n\t\treturn !coherenceStatus.value.incoherent.length;\n\t});\n\n\t/**\n\t * Realign selection state to the passed settings.\n\t * If modelValue has any value that is not coherent while\n\t * coherence is enforced the value should be removed\n\t */\n\tconst alignToCoherenceSettings = () => {\n\t\tif (params.enforceCoherence && !modelValueIsCoherent.value) {\n\t\t\tif (!params.multiple) updateModelValue(null);\n\t\t\telse updateModelValue(coherenceStatus.value.coherent);\n\t\t}\n\t};\n\n\t/**\n\t * Prefilling is the phase where the component understands it needs\n\t * to update its inner items due to a change in state, whether dependencies have changed, items or modelValue have changed.\n\t * It can be intended as the component aligning itself to what state is passed to it.\n\t */\n\tconst hasPrefilled = ref(false);\n\tconst isPrefilling = ref(false);\n\tconst prefillItems = async () => {\n\t\tisPrefilling.value = true;\n\t\tawait getOptions({ prefill: true });\n\t\talignToCoherenceSettings();\n\t\talignQueryToState();\n\t\thasPrefilled.value = true;\n\t\tisPrefilling.value = false;\n\t};\n\n\tonBeforeMount(async () => {\n\t\tif (params.prefill) {\n\t\t\tawait prefillItems();\n\t\t\tif (params.stash) {\n\t\t\t\tsetStash(...selectedOptions.value);\n\t\t\t}\n\t\t}\n\t});\n\n\t/**\n\t * Triggered on input when items is a function.\n\t */\n\n\tlet timeout: ReturnType<typeof setTimeout>;\n\tconst searchByQuery = () => {\n\t\tif (timeout) clearTimeout(timeout);\n\t\ttimeout = setTimeout(async () => {\n\t\t\ttry {\n\t\t\t\tawait getOptions({ prefill: false });\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error(error);\n\t\t\t}\n\t\t}, params.queryDebounceTime);\n\t};\n\tonBeforeUnmount(() => clearTimeout(timeout));\n\n\t/**\n\t * When modelValue changes split behavior for single and multiple selection:\n\t */\n\tlet modelValueTimeout: ReturnType<typeof setTimeout>;\n\twatch(\n\t\t() => params.modelValue.value,\n\t\t() => {\n\t\t\tif (modelValueIsCoherent.value) return;\n\t\t\tif (modelValueTimeout) clearTimeout(modelValueTimeout);\n\t\t\tmodelValueTimeout = setTimeout(async () => {\n\t\t\t\tprefillItems();\n\t\t\t}, params.modelValueDebounceTime);\n\t\t}\n\t);\n\n\t/**\n\t * START DEPENDENCY HANDLING\n\t * Explicit dependencies (props.dependencies) and implicit dependencies (props.items)\n\t * need to trigger a pipeline of realignment whenever they change\n\t */\n\tlet depsTimeout: ReturnType<typeof setTimeout>;\n\n\tconst handleDependencyChange = async (current: any, previous: any) => {\n\t\t// Circumvent arrays defined in the template by the parent triggering the watcher\n\t\tif (hash(previous) === hash(current)) return;\n\t\t// Do not track until prefill completes\n\t\tif (!hasPrefilled.value) return;\n\t\tif (depsTimeout) clearTimeout(depsTimeout);\n\t\tdepsTimeout = setTimeout(async () => {\n\t\t\tawait prefillItems();\n\t\t}, params.depsDebounceTime);\n\t};\n\n\t/**\n\t * This is triggered to refresh static items whenever the passed array changes.\n\t * If the parent defines an array in the template this is triggered\n\t * at every render so we take counter measures\n\t * Even if the entire array changes all the previously selected values are still in the stash.\n\t */\n\twatch(() => params.items.value, handleDependencyChange);\n\n\t/**\n\t * When dependencies change\n\t * If the input has not been prefilled yet just return\n\t * Check dependencies are the same by value and not reference\n\t * Otherwise we search again for options as they might be different base on dependencies.\n\t * If coherence is enforced we set the state accordingly\n\t */\n\twatch(() => params.dependencies.value, handleDependencyChange);\n\n\t/**\n\t * END DEPENDENCIES HANDLING\n\t */\n\n\treturn {\n\t\taddCurrentQueryToManualItems,\n\t\talignQueryToState,\n\t\tgetOptions,\n\t\thasPrefilled,\n\t\tinnerLoading,\n\t\tisPrefilling,\n\t\tmanualItems,\n\t\toptions,\n\t\tprefillItems,\n\t\tquery,\n\t\tsearchByQuery,\n\t\tselectedOptions,\n\t\tselectOption,\n\t\tsetStash,\n\t\tunselectOption,\n\t\tupdateModelValue,\n\t\tvalueIsSelected,\n\t\tinternalItems,\n\t};\n};\n"],"names":["useOptions","params","query","ref","lastEmittedValue","updateModelValue","value","internalItems","innerStash","addToStash","removeFromStash","setStash","useArray","manualItems","addToManualItems","removeFromManualItems","getItemText","useItemText","getItemValue","useItemValue","createOption","item","disabled","text","valueHash","hash","setSelected","o","isNotNil","modelValueIndexedByHash","options","computed","base","uniqBy","selectOption","option","alignQueryToState","nextTick","unselectOption","copy","map","arr","index","element","getOptions","prefill","items","order","innerLoading","waitFor","error","optionsIndexedByHash","selectedOptions","acc","h","found","valueIsSelected","last","addCurrentQueryToManualItems","coherenceStatus","curr","modelValueIsCoherent","isNil","alignToCoherenceSettings","hasPrefilled","isPrefilling","prefillItems","onBeforeMount","timeout","searchByQuery","onBeforeUnmount","modelValueTimeout","watch","depsTimeout","handleDependencyChange","current","previous"],"mappings":";;;;;;;;;;AAsCa,MAAAA,KAAa,CAACC,MAAoB;AACxC,QAAAC,IAAQC,EAAY,EAAE,GAEtBC,IAAmBD,KACnBE,IAAmB,CAACC,MAAe;AACxC,IAAAF,EAAiB,QAAQE,GAClBL,EAAA,KAAK,qBAAqBK,CAAK;AAAA,EAAA,GAGjCC,IAAgBJ,EAAW,CAAA,CAAE,GAC7B;AAAA,IACL,OAAOK;AAAA,IACP,KAAKC;AAAA,IACL,QAAQC;AAAA,IACR,KAAKC;AAAA,MACFC,EAAqB,GAEnB;AAAA,IACL,OAAOC;AAAA,IAC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
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
}(l), l;
|
85
|
-
};
|
86
|
-
}
|
87
|
-
return function(t, r, n) {
|
88
|
-
n.p.customParseFormat = !0, t && t.parseTwoDigitYear && (U = t.parseTwoDigitYear);
|
89
|
-
var e = r.prototype, c = e.parse;
|
90
|
-
e.parse = function(h) {
|
91
|
-
var w = h.date, p = h.utc, u = h.args;
|
92
|
-
this.$u = p;
|
93
|
-
var d = u[1];
|
94
|
-
if (typeof d == "string") {
|
95
|
-
var v = u[2] === !0, l = u[3] === !0, f = v || l, a = u[2];
|
96
|
-
l && (a = u[2]), m = this.$locale(), !v && a && (m = n.Ls[a]), this.$d = function(S, g, L) {
|
97
|
-
try {
|
98
|
-
if (["x", "X"].indexOf(g) > -1) return new Date((g === "X" ? 1e3 : 1) * S);
|
99
|
-
var s = B(g)(S), x = s.year, A = s.month, I = s.day, J = s.hours, K = s.minutes, N = s.seconds, Q = s.milliseconds, X = s.zone, H = /* @__PURE__ */ new Date(), O = I || (x || A ? 1 : H.getDate()), P = x || H.getFullYear(), T = 0;
|
100
|
-
x && !A || (T = A > 0 ? A - 1 : H.getMonth());
|
101
|
-
var z = J || 0, C = K || 0, E = N || 0, _ = Q || 0;
|
102
|
-
return X ? new Date(Date.UTC(P, T, O, z, C, E, _ + 60 * X.offset * 1e3)) : L ? new Date(Date.UTC(P, T, O, z, C, E, _)) : new Date(P, T, O, z, C, E, _);
|
103
|
-
} catch {
|
104
|
-
return /* @__PURE__ */ new Date("");
|
105
|
-
}
|
106
|
-
}(w, d, p), this.init(), a && a !== !0 && (this.$L = this.locale(a).$L), f && w != this.format(d) && (this.$d = /* @__PURE__ */ new Date("")), m = {};
|
107
|
-
} else if (d instanceof Array) for (var M = d.length, Y = 1; Y <= M; Y += 1) {
|
108
|
-
u[1] = d[Y - 1];
|
109
|
-
var D = n.apply(this, u);
|
110
|
-
if (D.isValid()) {
|
111
|
-
this.$d = D.$d, this.$L = D.$L, this.init();
|
112
|
-
break;
|
113
|
-
}
|
114
|
-
Y === M && (this.$d = /* @__PURE__ */ new Date(""));
|
115
|
-
}
|
116
|
-
else c.call(this, h);
|
117
|
-
};
|
118
|
-
};
|
119
|
-
});
|
120
|
-
})(G);
|
121
|
-
var tt = G.exports;
|
122
|
-
const at = /* @__PURE__ */ R(tt);
|
1
|
+
import { defineComponent as b, openBlock as n, createElementBlock as s, normalizeClass as r, createElementVNode as l, renderSlot as t, createTextVNode as o, toDisplayString as d, createCommentVNode as h, Fragment as c, renderList as m } from "vue";
|
2
|
+
const p = { class: "bb-cr-container__container" }, u = {
|
3
|
+
key: 0,
|
4
|
+
class: "bb-cr-container__loading-container"
|
5
|
+
}, g = {
|
6
|
+
key: 1,
|
7
|
+
class: "bb-cr-container__no-data-container"
|
8
|
+
}, _ = /* @__PURE__ */ b({
|
9
|
+
__name: "OptionsContainer",
|
10
|
+
props: {
|
11
|
+
direction: {},
|
12
|
+
hasErrors: { type: Boolean },
|
13
|
+
hideLabel: { type: Boolean },
|
14
|
+
loadingText: {},
|
15
|
+
loading: { type: Boolean },
|
16
|
+
noDataText: {},
|
17
|
+
options: {}
|
18
|
+
},
|
19
|
+
setup(k) {
|
20
|
+
return (a, $) => (n(), s("span", {
|
21
|
+
ref: "container",
|
22
|
+
class: r(["bb-cr-container", {
|
23
|
+
"bb-cr-container--errors": a.hasErrors,
|
24
|
+
"bb-cr-container--horizontal": a.direction === "horizontal",
|
25
|
+
"bb-cr-container--vertical": a.direction === "vertical"
|
26
|
+
}])
|
27
|
+
}, [
|
28
|
+
l("span", p, [
|
29
|
+
t(a.$slots, "prepend"),
|
30
|
+
!a.options.length && a.loading ? (n(), s("span", u, [
|
31
|
+
t(a.$slots, "loading", {}, () => [
|
32
|
+
o(d(a.loadingText), 1)
|
33
|
+
])
|
34
|
+
])) : a.options.length ? h("", !0) : (n(), s("span", g, [
|
35
|
+
t(a.$slots, "no-data", {}, () => [
|
36
|
+
o(d(a.noDataText), 1)
|
37
|
+
])
|
38
|
+
])),
|
39
|
+
(n(!0), s(c, null, m(a.options, (e, i) => (n(), s(c, {
|
40
|
+
key: (e == null ? void 0 : e.id) || i
|
41
|
+
}, [
|
42
|
+
t(a.$slots, "option:prepend", {
|
43
|
+
id: e.valueHash,
|
44
|
+
checked: !!e.selected,
|
45
|
+
disabled: !!e.disabled,
|
46
|
+
item: e.item,
|
47
|
+
text: e.text
|
48
|
+
}),
|
49
|
+
l("label", {
|
50
|
+
class: r(["bb-cr-container-option", { "bb-base-radio-selected": e.selected }])
|
51
|
+
}, [
|
52
|
+
t(a.$slots, "input", {
|
53
|
+
index: i,
|
54
|
+
option: e
|
55
|
+
}),
|
56
|
+
l("span", {
|
57
|
+
class: r({
|
58
|
+
"bb-cr-container-option__text": !0,
|
59
|
+
"bb-cr-container-option__text--hidden": a.hideLabel
|
60
|
+
})
|
61
|
+
}, [
|
62
|
+
t(a.$slots, "label", {
|
63
|
+
checked: !!e.selected,
|
64
|
+
item: e.item,
|
65
|
+
text: e.text
|
66
|
+
}, () => [
|
67
|
+
o(d(e.text), 1)
|
68
|
+
])
|
69
|
+
], 2)
|
70
|
+
], 2),
|
71
|
+
t(a.$slots, "option:append", {
|
72
|
+
id: e.valueHash,
|
73
|
+
checked: !!e.selected,
|
74
|
+
disabled: !!e.disabled,
|
75
|
+
item: e.item,
|
76
|
+
text: e.text
|
77
|
+
})
|
78
|
+
], 64))), 128)),
|
79
|
+
t(a.$slots, "append")
|
80
|
+
])
|
81
|
+
], 2));
|
82
|
+
}
|
83
|
+
});
|
123
84
|
export {
|
124
|
-
|
85
|
+
_ as default
|
125
86
|
};
|
126
87
|
//# sourceMappingURL=index230.js.map
|
package/dist/index230.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index230.js","sources":[
|
1
|
+
{"version":3,"file":"index230.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|