@7pmlabs/design-system 0.6.2 → 0.6.3
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/README.md +1 -0
- package/dist/design-system104.mjs +1 -1
- package/dist/design-system107.mjs +1 -1
- package/dist/design-system110.mjs +1 -1
- package/dist/design-system111.mjs +1 -1
- package/dist/design-system112.mjs +1 -1
- package/dist/design-system115.mjs +1 -1
- package/dist/design-system27.mjs +3 -3
- package/dist/design-system28.mjs +4 -4
- package/dist/design-system29.mjs +3 -3
- package/dist/design-system30.mjs +1 -1
- package/dist/design-system31.mjs +3 -3
- package/dist/design-system32.mjs +3 -3
- package/dist/design-system33.mjs +1 -1
- package/dist/design-system34.mjs +1 -1
- package/dist/design-system35.mjs +1 -1
- package/dist/design-system36.mjs +1 -1
- package/dist/design-system37.mjs +3 -3
- package/dist/design-system38.mjs +2 -2
- package/dist/design-system39.mjs +3 -3
- package/dist/design-system40.mjs +3 -3
- package/dist/design-system42.mjs +3 -3
- package/dist/design-system43.mjs +1 -1
- package/dist/design-system44.mjs +1 -1
- package/dist/design-system45.mjs +3 -3
- package/dist/design-system47.mjs +3 -3
- package/dist/design-system48.mjs +3 -3
- package/dist/design-system50.mjs +3 -3
- package/dist/design-system51.mjs +140 -2
- package/dist/design-system51.mjs.map +1 -1
- package/dist/design-system52.mjs +1090 -126
- package/dist/design-system52.mjs.map +1 -1
- package/dist/design-system53.mjs +1002 -2
- package/dist/design-system53.mjs.map +1 -1
- package/dist/design-system54.mjs +2 -7
- package/dist/design-system54.mjs.map +1 -1
- package/dist/design-system55.mjs +124 -20
- package/dist/design-system55.mjs.map +1 -1
- package/dist/design-system57.mjs +7 -2
- package/dist/design-system57.mjs.map +1 -1
- package/dist/design-system58.mjs +19 -61
- package/dist/design-system58.mjs.map +1 -1
- package/dist/design-system60.mjs +2 -2
- package/dist/design-system61.mjs +65 -2
- package/dist/design-system61.mjs.map +1 -1
- package/dist/design-system62.mjs +2 -2
- package/dist/design-system63.mjs +1 -1
- package/dist/design-system64.mjs +1 -1
- package/dist/design-system65.mjs +2 -28
- package/dist/design-system65.mjs.map +1 -1
- package/dist/design-system66.mjs +2 -2
- package/dist/design-system67.mjs +2 -58
- package/dist/design-system67.mjs.map +1 -1
- package/dist/design-system68.mjs +28 -2
- package/dist/design-system68.mjs.map +1 -1
- package/dist/design-system69.mjs +2 -2
- package/dist/design-system70.mjs +58 -2
- package/dist/design-system70.mjs.map +1 -1
- package/dist/design-system71.mjs +2 -2
- package/dist/design-system72.mjs +1 -1
- package/dist/design-system73.mjs +2 -79
- package/dist/design-system73.mjs.map +1 -1
- package/dist/design-system74.mjs +2 -2
- package/dist/design-system75.mjs +1 -1
- package/dist/design-system76.mjs +79 -2
- package/dist/design-system76.mjs.map +1 -1
- package/dist/design-system77.mjs +2 -81
- package/dist/design-system77.mjs.map +1 -1
- package/dist/design-system78.mjs +2 -2
- package/dist/design-system79.mjs +2 -2
- package/dist/design-system80.mjs +71 -109
- package/dist/design-system80.mjs.map +1 -1
- package/dist/design-system82.mjs +1 -1
- package/dist/design-system83.mjs +119 -2
- package/dist/design-system83.mjs.map +1 -1
- package/dist/design-system84.mjs +2 -102
- package/dist/design-system84.mjs.map +1 -1
- package/dist/design-system85.mjs +2 -2
- package/dist/design-system86.mjs +2 -190
- package/dist/design-system86.mjs.map +1 -1
- package/dist/design-system87.mjs +102 -2
- package/dist/design-system87.mjs.map +1 -1
- package/dist/design-system88.mjs +2 -2
- package/dist/design-system89.mjs +170 -122
- package/dist/design-system89.mjs.map +1 -1
- package/dist/design-system91.mjs +2 -49
- package/dist/design-system91.mjs.map +1 -1
- package/dist/design-system92.mjs +142 -2
- package/dist/design-system92.mjs.map +1 -1
- package/dist/design-system93.mjs +2 -2
- package/dist/design-system94.mjs +49 -2
- package/dist/design-system94.mjs.map +1 -1
- package/dist/design-system95.mjs +2 -2
- package/dist/design-system96.mjs +2 -140
- package/dist/design-system96.mjs.map +1 -1
- package/dist/design-system97.mjs +2 -1091
- package/dist/design-system97.mjs.map +1 -1
- package/dist/design-system98.mjs +2 -1002
- package/dist/design-system98.mjs.map +1 -1
- package/package.json +14 -13
package/dist/design-system89.mjs
CHANGED
|
@@ -1,145 +1,193 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
1
|
+
import { defineComponent as W, ref as p, computed as _, openBlock as n, createElementBlock as m, createVNode as v, createElementVNode as i, unref as D, Fragment as X, renderList as Y, withModifiers as I, createCommentVNode as V, withCtx as x, createTextVNode as Z, toDisplayString as ee, createBlock as te, pushScopeId as ae, popScopeId as le } from "vue";
|
|
2
|
+
import { FileImageTypes as S } from "./design-system4.mjs";
|
|
3
|
+
import { useI18n as se } from "./design-system50.mjs";
|
|
4
|
+
import F from "./design-system104.mjs";
|
|
5
|
+
import re from "./design-system46.mjs";
|
|
6
|
+
import { useValidationField as oe } from "./design-system3.mjs";
|
|
7
|
+
import ie from "./design-system16.mjs";
|
|
8
|
+
import de from "./design-system11.mjs";
|
|
9
|
+
import ne from "./design-system15.mjs";
|
|
10
|
+
import ue from "./design-system100.mjs";
|
|
11
|
+
import ce from "./design-system105.mjs";
|
|
12
|
+
const ge = (u) => (ae("data-v-8033e228"), u = u(), le(), u), pe = { class: "b-image-picker ds-w-full" }, me = { class: "ds-gap-2 ds-space-y-4 ds-rounded-lg ds-bg-white ds-p-4 ds-drop-shadow" }, ve = {
|
|
10
13
|
key: 0,
|
|
11
|
-
class: "
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
class: "ds-flex ds-flex-wrap ds-justify-center ds-gap-1"
|
|
15
|
+
}, fe = ["onClick", "onDragenter", "onDragstart", "onDrop"], he = ["src"], _e = ["src"], ye = { class: "ds-flex ds-flex-wrap ds-justify-center" }, ke = /* @__PURE__ */ ge(() => /* @__PURE__ */ i("svg", {
|
|
16
|
+
class: "ds-h-4 ds-w-4 ds-fill-primary-t",
|
|
17
|
+
viewBox: "0 0 512 512",
|
|
18
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
19
|
+
}, [
|
|
20
|
+
/* @__PURE__ */ i("path", { d: "M447.1 32h-384C28.64 32-.0091 60.65-.0091 96v320c0 35.35 28.65 64 63.1 64h384c35.35 0 64-28.65 64-64V96C511.1 60.65 483.3 32 447.1 32zM111.1 96c26.51 0 48 21.49 48 48S138.5 192 111.1 192s-48-21.49-48-48S85.48 96 111.1 96zM446.1 407.6C443.3 412.8 437.9 416 432 416H82.01c-6.021 0-11.53-3.379-14.26-8.75c-2.73-5.367-2.215-11.81 1.334-16.68l70-96C142.1 290.4 146.9 288 152 288s9.916 2.441 12.93 6.574l32.46 44.51l93.3-139.1C293.7 194.7 298.7 192 304 192s10.35 2.672 13.31 7.125l128 192C448.6 396 448.9 402.3 446.1 407.6z" })
|
|
21
|
+
], -1)), De = ["accept", "multiple"], Me = /* @__PURE__ */ W({
|
|
22
|
+
__name: "BImagePicker",
|
|
17
23
|
props: {
|
|
18
24
|
inputId: { default: "" },
|
|
19
|
-
inputCssClass: { default: "" },
|
|
20
25
|
modelValue: {},
|
|
21
26
|
label: { default: "" },
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
multiple: { type: Boolean, default: !1 },
|
|
28
|
+
maxFileSize: { default: 20 },
|
|
29
|
+
hideDetails: { type: Boolean, default: !1 },
|
|
25
30
|
required: { type: Boolean, default: !1 },
|
|
26
31
|
requiredErrorMessage: { default: "" },
|
|
27
|
-
|
|
28
|
-
readonly: { type: Boolean, default: !1 },
|
|
29
|
-
hideDetails: { type: Boolean, default: !1 },
|
|
30
|
-
locale: { default: A["vi-VN"] }
|
|
32
|
+
validationRules: { default: void 0 }
|
|
31
33
|
},
|
|
32
|
-
emits: ["
|
|
33
|
-
setup(
|
|
34
|
-
const
|
|
35
|
-
let o;
|
|
36
|
-
const { t: h } = U(), c = $(null), y = {
|
|
37
|
-
validateRule: (e) => !!(e && (e != null && e.trim())),
|
|
38
|
-
errorMessage: () => s.requiredErrorMessage || h("ds.global.field_required")
|
|
39
|
-
}, a = l(() => s.inputId || `id-${L()}`), t = l({
|
|
34
|
+
emits: ["change", "update:modelValue"],
|
|
35
|
+
setup(u, { expose: R, emit: z }) {
|
|
36
|
+
const a = u, c = z, { t: f } = se(), h = p(null), w = p(0), s = _({
|
|
40
37
|
get() {
|
|
41
|
-
return
|
|
38
|
+
return a.modelValue;
|
|
42
39
|
},
|
|
43
40
|
set(e) {
|
|
44
|
-
|
|
41
|
+
c("update:modelValue", e);
|
|
45
42
|
}
|
|
46
|
-
}),
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
43
|
+
}), y = p(!0), k = p(!0), g = p({
|
|
44
|
+
visible: !1,
|
|
45
|
+
url: ""
|
|
46
|
+
}), b = _(() => S.join(", ")), B = _(() => a.inputId || `id-${ue()}`), M = {
|
|
47
|
+
validateRule: (e) => !!e && e.length > 0,
|
|
48
|
+
errorMessage: () => a.requiredErrorMessage || f("ds.global.field_required")
|
|
49
|
+
}, T = {
|
|
50
|
+
validateRule: () => y.value,
|
|
51
|
+
errorMessage: () => f("ds.components.base.image_picker.file_types_valid", {
|
|
52
|
+
types: b.value
|
|
53
|
+
})
|
|
54
|
+
}, E = {
|
|
55
|
+
validateRule: () => k.value,
|
|
56
|
+
errorMessage: () => f("ds.components.base.image_picker.file_size_valid", {
|
|
57
|
+
size: a.maxFileSize
|
|
58
|
+
})
|
|
59
|
+
}, L = _(() => {
|
|
55
60
|
let e = [];
|
|
56
|
-
return
|
|
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
|
-
t,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
61
|
+
return a.required && e.push(M), a.validationRules && (e = e.concat(a.validationRules)), e.push(T), e.push(E), e.length ? e : void 0;
|
|
62
|
+
}), { validate: d, validationResult: $ } = oe(
|
|
63
|
+
B.value,
|
|
64
|
+
s,
|
|
65
|
+
L.value
|
|
66
|
+
), q = (e, t) => {
|
|
67
|
+
w.value = e, t.target.classList.add("dragging"), t.dataTransfer.effectAllowed = "move", t.dataTransfer.setData("index", e.toString());
|
|
68
|
+
}, N = (e) => {
|
|
69
|
+
e.target.classList.remove("dragging");
|
|
70
|
+
}, j = (e, t) => {
|
|
71
|
+
const l = t.target;
|
|
72
|
+
w.value !== e && l.classList.add("dropped-target");
|
|
73
|
+
}, A = (e) => {
|
|
74
|
+
e.preventDefault(), e.dataTransfer.dropEffect = "move";
|
|
75
|
+
}, P = (e) => {
|
|
76
|
+
e.target.classList.remove("dropped-target");
|
|
77
|
+
}, U = (e, t) => {
|
|
78
|
+
t.preventDefault(), t.target.classList.remove("dropped-target");
|
|
79
|
+
const r = parseInt(t.dataTransfer.getData("index")), o = s.value[r];
|
|
80
|
+
s.value.splice(r, 1), s.value.splice(e, 0, o), c("change"), d();
|
|
81
|
+
}, H = () => {
|
|
82
|
+
var e;
|
|
83
|
+
(e = h.value) == null || e.click();
|
|
84
|
+
}, O = (e) => {
|
|
85
|
+
let t = e.target.files || e.dataTransfer.files;
|
|
86
|
+
t.length && (G(t), h.value && (h.value.value = null));
|
|
87
|
+
}, G = (e) => {
|
|
88
|
+
Array.from(e).forEach((t) => {
|
|
89
|
+
if (y.value = S.includes(t.type), k.value = Q(t.size) <= a.maxFileSize, y.value && k.value) {
|
|
90
|
+
let l = new FileReader();
|
|
91
|
+
l.onload = (r) => {
|
|
92
|
+
a.multiple ? s.value.push({
|
|
93
|
+
url: r.target.result,
|
|
94
|
+
file: t,
|
|
95
|
+
type: t.type
|
|
96
|
+
}) : s.value = {
|
|
97
|
+
url: r.target.result,
|
|
98
|
+
file: t,
|
|
99
|
+
type: t.type
|
|
100
|
+
}, c("change"), d();
|
|
101
|
+
}, l.readAsDataURL(t);
|
|
102
|
+
} else
|
|
103
|
+
d();
|
|
104
|
+
});
|
|
105
|
+
}, J = (e) => {
|
|
106
|
+
s.value.splice(e, 1), c("change"), d();
|
|
107
|
+
}, K = () => {
|
|
108
|
+
s.value = {}, c("change"), d();
|
|
109
|
+
}, Q = (e) => e / 1024 ** 2, C = (e) => {
|
|
110
|
+
g.value.url = e.url || "", g.value.visible = !0;
|
|
103
111
|
};
|
|
104
|
-
return
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
112
|
+
return R({ validate: d }), (e, t) => (n(), m("div", pe, [
|
|
113
|
+
v(ie, {
|
|
114
|
+
label: a.label
|
|
115
|
+
}, null, 8, ["label"]),
|
|
116
|
+
i("div", me, [
|
|
117
|
+
D(ce)(s.value) ? V("", !0) : (n(), m("div", ve, [
|
|
118
|
+
a.multiple ? (n(!0), m(X, { key: 0 }, Y(s.value, (l, r) => (n(), m("div", {
|
|
119
|
+
key: l.url,
|
|
120
|
+
class: "b-image-picker__draggable ds-h-full ds-cursor-pointer ds-rounded-lg ds-transition-all hover:ds-ring-2 hover:ds-ring-primary-t",
|
|
121
|
+
draggable: "true",
|
|
122
|
+
onClick: (o) => C(l),
|
|
123
|
+
onDragend: N,
|
|
124
|
+
onDragenter: (o) => j(r, o),
|
|
125
|
+
onDragleave: P,
|
|
126
|
+
onDragover: A,
|
|
127
|
+
onDragstart: (o) => q(r, o),
|
|
128
|
+
onDrop: (o) => U(r, o)
|
|
129
|
+
}, [
|
|
130
|
+
i("img", {
|
|
131
|
+
src: l.url,
|
|
132
|
+
alt: "image",
|
|
133
|
+
class: "ds-h-full ds-w-full ds-rounded-lg"
|
|
134
|
+
}, null, 8, he),
|
|
135
|
+
v(F, {
|
|
136
|
+
class: "ds-right-1 ds-top-1 ds-h-8 ds-w-8",
|
|
137
|
+
onClick: I((o) => J(r), ["stop"])
|
|
138
|
+
}, null, 8, ["onClick"])
|
|
139
|
+
], 40, fe))), 128)) : (n(), m("div", {
|
|
140
|
+
key: 1,
|
|
141
|
+
class: "b-image-picker__draggable ds-h-full ds-cursor-pointer ds-rounded-lg ds-transition-all hover:ds-ring-2 hover:ds-ring-primary-t",
|
|
142
|
+
draggable: "true",
|
|
143
|
+
onClick: t[0] || (t[0] = (l) => C(s.value))
|
|
144
|
+
}, [
|
|
145
|
+
i("img", {
|
|
146
|
+
src: s.value.url,
|
|
147
|
+
alt: "image",
|
|
148
|
+
class: "ds-h-full ds-w-full ds-rounded-lg"
|
|
149
|
+
}, null, 8, _e),
|
|
150
|
+
v(F, {
|
|
151
|
+
class: "ds-right-1 ds-top-1 ds-h-8 ds-w-8",
|
|
152
|
+
onClick: I(K, ["stop"])
|
|
153
|
+
})
|
|
154
|
+
]))
|
|
155
|
+
])),
|
|
156
|
+
i("div", ye, [
|
|
157
|
+
v(de, { onClick: H }, {
|
|
158
|
+
default: x(() => [
|
|
159
|
+
Z(ee(D(f)("ds.components.base.image_picker.select_image")), 1)
|
|
160
|
+
]),
|
|
161
|
+
appendIcon: x(() => [
|
|
162
|
+
ke
|
|
163
|
+
]),
|
|
164
|
+
_: 1
|
|
165
|
+
}),
|
|
166
|
+
i("input", {
|
|
167
|
+
ref_key: "inputRef",
|
|
168
|
+
ref: h,
|
|
169
|
+
accept: b.value,
|
|
170
|
+
multiple: a.multiple,
|
|
171
|
+
class: "ds-hidden",
|
|
172
|
+
type: "file",
|
|
173
|
+
onChange: O
|
|
174
|
+
}, null, 40, De)
|
|
175
|
+
])
|
|
133
176
|
]),
|
|
134
|
-
|
|
177
|
+
a.hideDetails ? V("", !0) : (n(), te(ne, {
|
|
135
178
|
key: 0,
|
|
136
|
-
"error-message":
|
|
179
|
+
"error-message": D($).errorMessage(),
|
|
137
180
|
class: "ds-mt-1"
|
|
138
|
-
}, null, 8, ["error-message"]))
|
|
181
|
+
}, null, 8, ["error-message"])),
|
|
182
|
+
v(re, {
|
|
183
|
+
modelValue: g.value.visible,
|
|
184
|
+
"onUpdate:modelValue": t[1] || (t[1] = (l) => g.value.visible = l),
|
|
185
|
+
url: g.value.url
|
|
186
|
+
}, null, 8, ["modelValue", "url"])
|
|
139
187
|
]));
|
|
140
188
|
}
|
|
141
189
|
});
|
|
142
190
|
export {
|
|
143
|
-
|
|
191
|
+
Me as default
|
|
144
192
|
};
|
|
145
193
|
//# sourceMappingURL=design-system89.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"design-system89.mjs","sources":["../src/components/BCurrencyField.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { createVNode as _createVNode, renderSlot as _renderSlot, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, withKeys as _withKeys, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, unref as _unref, createBlock as _createBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from \"vue\"\n\nconst _withScopeId = n => (_pushScopeId(\"data-v-5cbc4bba\"),n=n(),_popScopeId(),n)\nconst _hoisted_1 = { class: \"b-currency-field\" }\nconst _hoisted_2 = { class: \"ds-relative\" }\nconst _hoisted_3 = {\n key: 0,\n class: \"b-currency-field__prepend-icon ds-absolute ds-left-3 ds-top-0 ds-z-[1] ds-flex ds-h-full ds-cursor-pointer ds-items-center hover:ds-text-primary-t\"\n}\nconst _hoisted_4 = [\"id\", \"autocomplete\", \"disabled\", \"placeholder\", \"readonly\"]\nconst _hoisted_5 = {\n key: 1,\n class: \"b-currency-field__append-icon ds-absolute ds-right-3 ds-top-0 ds-z-[1] ds-flex ds-h-full ds-cursor-pointer ds-items-center hover:ds-text-primary-t\"\n}\n\nimport BLabel from '@/components/BLabel.vue';\nimport type { ValidationRule } from '@/composables/Validation';\nimport { useValidationField } from '@/composables/Validation';\nimport { computed, onMounted, ref, watch } from 'vue';\nimport { v4 as uuid } from 'uuid';\nimport BErrorMessage from '@/components/BErrorMessage.vue';\nimport { useI18n } from 'vue-i18n';\nimport IMask from '@/vendor/imask-7.1.3.js';\nimport { SupportedLocale } from '@/constants/Enums';\n\n//#region Props\nexport interface BCurrencyFieldProps {\n inputId?: string;\n inputCssClass?: string;\n /**\n * Value can be number or string\n */\n modelValue: number | string;\n label?: string;\n validationRules?: ValidationRule[];\n placeholder?: string;\n autocomplete?: boolean;\n /**\n * Validate if the field is left empty.\n */\n required?: boolean;\n requiredErrorMessage?: string;\n disabled?: boolean;\n readonly?: boolean;\n /**\n * Hide the validation error message.\n */\n hideDetails?: boolean;\n /**\n * Locale of the currency\n */\n locale?: `${SupportedLocale}`;\n}\n\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'BCurrencyField',\n props: {\n inputId: { default: '' },\n inputCssClass: { default: '' },\n modelValue: {},\n label: { default: '' },\n validationRules: { default: undefined },\n placeholder: { default: '' },\n autocomplete: { type: Boolean, default: false },\n required: { type: Boolean, default: false },\n requiredErrorMessage: { default: '' },\n disabled: { type: Boolean, default: false },\n readonly: { type: Boolean, default: false },\n hideDetails: { type: Boolean, default: false },\n locale: { default: SupportedLocale['vi-VN'] }\n },\n emits: [\"press:enter\", \"update:modelValue\"],\n setup(__props: any, { emit: __emit }) {\n\nconst props = __props;\n//#endregion\n\n//#region Events\nconst emit = __emit;\n//#endregion\n\n//#region Data\nlet mask: any;\nconst { t } = useI18n();\nconst inputRef = ref<HTMLInputElement | null>(null);\nconst validateRequired: ValidationRule = {\n validateRule: (val: string) => !!(val && val?.trim()),\n errorMessage: () =>\n props.requiredErrorMessage || t('ds.global.field_required'),\n};\nconst id = computed(() => props.inputId || `id-${uuid()}`);\nconst value = computed({\n get() {\n return props.modelValue;\n },\n set(val) {\n emit('update:modelValue', val);\n },\n});\nconst inputCssClassValue = computed(() => [\n {\n 'ds-cursor-not-allowed ds-bg-[#f2f2f2] ds-text-black/[0.4]': props.disabled,\n 'ds-text-black/[0.85]': !props.disabled,\n 'ds-border-error focus:ds-ring-1 focus:ds-ring-error':\n !validationResult.value.valid,\n 'ds-border-black/[0.1] focus:ds-border-focus focus:ds-ring-1 focus:ds-ring-focus':\n validationResult.value.valid,\n },\n props.inputCssClass,\n]);\nconst vRules = computed(() => {\n let result: ValidationRule[] = [];\n\n if (props.required) {\n result.push(validateRequired);\n }\n if (props.validationRules) {\n result = result.concat(props.validationRules);\n }\n\n return result.length ? result : undefined;\n});\nconst maskOptions = computed(() =>\n props.locale === 'en-US'\n ? {\n mask: '$num',\n blocks: {\n num: {\n mask: Number,\n thousandsSeparator: ' ',\n },\n },\n }\n : [\n { mask: '' },\n {\n mask: 'num VND',\n lazy: false,\n blocks: {\n num: {\n mask: Number,\n thousandsSeparator: ' ',\n },\n },\n },\n ],\n);\n\nconst { validate, validationResult } = useValidationField(\n id.value,\n value,\n vRules.value,\n);\n//#endregion\n\n//#region Watchers\nwatch(\n () => props.locale,\n () => {\n initMask();\n },\n);\nwatch(\n () => props.modelValue,\n (val) => {\n if (val != mask.unmaskedValue) {\n mask.unmaskedValue = val.toString();\n }\n },\n);\n//#endregion\n\n//#region Methods\nconst onKeyUp = () => {\n validate();\n};\nconst onKeyUpEnter = () => {\n emit('press:enter');\n};\nconst onAccept = () => {\n value.value =\n typeof value.value === 'number' ? +mask.unmaskedValue : mask.unmaskedValue;\n};\nconst initMask = () => {\n if (mask) {\n mask.destroy();\n }\n mask = IMask(inputRef.value!, maskOptions.value);\n mask.on('accept', onAccept);\n};\n//#endregion\n\n//#region Lifecycle Hooks\nonMounted(() => {\n initMask();\n mask.unmaskedValue = value.value.toString();\n});\n//#endregion\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(\"div\", _hoisted_1, [\n _createVNode(BLabel, {\n id: id.value,\n label: _ctx.label,\n required: _ctx.required\n }, null, 8, [\"id\", \"label\", \"required\"]),\n _createElementVNode(\"div\", _hoisted_2, [\n (_ctx.$slots.prependIcon)\n ? (_openBlock(), _createElementBlock(\"div\", _hoisted_3, [\n _renderSlot(_ctx.$slots, \"prependIcon\", {}, undefined, true)\n ]))\n : _createCommentVNode(\"\", true),\n _createElementVNode(\"input\", {\n id: id.value,\n ref_key: \"inputRef\",\n ref: inputRef,\n autocomplete: props.autocomplete ? 'on' : 'off',\n class: _normalizeClass([inputCssClassValue.value, \"ds-block ds-h-[40px] ds-w-full ds-rounded-lg ds-border ds-px-3 ds-text-sm ds-drop-shadow-light\"]),\n disabled: props.disabled,\n placeholder: props.placeholder,\n readonly: props.readonly,\n onKeyup: [\n onKeyUp,\n _withKeys(onKeyUpEnter, [\"enter\"])\n ]\n }, null, 42, _hoisted_4),\n (_ctx.$slots.appendIcon)\n ? (_openBlock(), _createElementBlock(\"div\", _hoisted_5, [\n _renderSlot(_ctx.$slots, \"appendIcon\", {}, undefined, true)\n ]))\n : _createCommentVNode(\"\", true)\n ]),\n (!_ctx.hideDetails)\n ? (_openBlock(), _createBlock(BErrorMessage, {\n key: 0,\n \"error-message\": _unref(validationResult).errorMessage(),\n class: \"ds-mt-1\"\n }, null, 8, [\"error-message\"]))\n : _createCommentVNode(\"\", true)\n ]))\n}\n}\n\n})"],"names":["_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_sfc_main","_defineComponent","SupportedLocale","__props","__emit","props","emit","mask","t","useI18n","inputRef","ref","validateRequired","val","id","computed","uuid","value","inputCssClassValue","validationResult","vRules","result","maskOptions","validate","useValidationField","watch","initMask","onKeyUp","onKeyUpEnter","onAccept","IMask","onMounted","_ctx","_cache","_openBlock","_createElementBlock","_createVNode","BLabel","_createElementVNode","_renderSlot","_createCommentVNode","_normalizeClass","_withKeys","_createBlock","BErrorMessage","_unref"],"mappings":";;;;;;;;AAIA,MAAMA,IAAa,EAAE,OAAO,sBACtBC,IAAa,EAAE,OAAO,iBACtBC,IAAa;AAAA,EACjB,KAAK;AAAA,EACL,OAAO;AACT,GACMC,IAAa,CAAC,MAAM,gBAAgB,YAAY,eAAe,UAAU,GACzEC,IAAa;AAAA,EACjB,KAAK;AAAA,EACL,OAAO;AACT,GA0C4BC,KAAiBC,gBAAAA,EAAA;AAAA,EAC3C,QAAQ;AAAA,EACR,OAAO;AAAA,IACL,SAAS,EAAE,SAAS,GAAG;AAAA,IACvB,eAAe,EAAE,SAAS,GAAG;AAAA,IAC7B,YAAY,CAAC;AAAA,IACb,OAAO,EAAE,SAAS,GAAG;AAAA,IACrB,iBAAiB,EAAE,SAAS,OAAU;AAAA,IACtC,aAAa,EAAE,SAAS,GAAG;AAAA,IAC3B,cAAc,EAAE,MAAM,SAAS,SAAS,GAAM;AAAA,IAC9C,UAAU,EAAE,MAAM,SAAS,SAAS,GAAM;AAAA,IAC1C,sBAAsB,EAAE,SAAS,GAAG;AAAA,IACpC,UAAU,EAAE,MAAM,SAAS,SAAS,GAAM;AAAA,IAC1C,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EAAK;AAAA,MAAA,GACd,MAAM,GAAG,CAAC,MAAM,SAAS,UAAU,CAAC;AAAA,MACvCM,EAAoB,OAAO1C,GAAY;AAAA,QACpCoC,EAAK,OAAO,eACRE,EAAc,GAAAC,EAAoB,OAAOtC,GAAY;AAAA,UACpD0C,EAAYP,EAAK,QAAQ,eAAe,CAAA,GAAI,QAAW,EAAI;AAAA,QAAA,CAC5D,KACDQ,EAAoB,IAAI,EAAI;AAAA,QAChCF,EAAoB,SAAS;AAAA,UAC3B,IAAIxB,EAAG;AAAA,UACP,SAAS;AAAA,UACT,KAAKJ;AAAA,UACL,cAAcL,EAAM,eAAe,OAAO;AAAA,UAC1C,OAAOoC,EAAgB,CAACvB,EAAmB,OAAO,gGAAgG,CAAC;AAAA,UACnJ,UAAUb,EAAM;AAAA,UAChB,aAAaA,EAAM;AAAA,UACnB,UAAUA,EAAM;AAAA,UAChB,SAAS;AAAA,YACPsB;AAAA,YACAe,EAAUd,GAAc,CAAC,OAAO,CAAC;AAAA,UACnC;AAAA,QAAA,GACC,MAAM,IAAI9B,CAAU;AAAA,QACtBkC,EAAK,OAAO,cACRE,EAAc,GAAAC,EAAoB,OAAOpC,GAAY;AAAA,UACpDwC,EAAYP,EAAK,QAAQ,cAAc,CAAA,GAAI,QAAW,EAAI;AAAA,QAAA,CAC3D,KACDQ,EAAoB,IAAI,EAAI;AAAA,MAAA,CACjC;AAAA,MACCR,EAAK,cAMHQ,EAAoB,IAAI,EAAI,KAL3BN,EAAW,GAAGS,EAAaC,GAAe;AAAA,QACzC,KAAK;AAAA,QACL,iBAAiBC,EAAO1B,CAAgB,EAAE,aAAa;AAAA,QACvD,OAAO;AAAA,MAAA,GACN,MAAM,GAAG,CAAC,eAAe,CAAC;AAAA,IACD,CACjC;AAAA,EAEH;AAEA,CAAC;"}
|
|
1
|
+
{"version":3,"file":"design-system89.mjs","sources":["../src/components/BImagePicker/BImagePicker.vue?vue&type=script&setup=true&lang.ts"],"sourcesContent":["import { defineComponent as _defineComponent } from 'vue'\nimport { createVNode as _createVNode, unref as _unref, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, createElementVNode as _createElementVNode, withModifiers as _withModifiers, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, withCtx as _withCtx, createBlock as _createBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from \"vue\"\n\nconst _withScopeId = n => (_pushScopeId(\"data-v-8033e228\"),n=n(),_popScopeId(),n)\nconst _hoisted_1 = { class: \"b-image-picker ds-w-full\" }\nconst _hoisted_2 = { class: \"ds-gap-2 ds-space-y-4 ds-rounded-lg ds-bg-white ds-p-4 ds-drop-shadow\" }\nconst _hoisted_3 = {\n key: 0,\n class: \"ds-flex ds-flex-wrap ds-justify-center ds-gap-1\"\n}\nconst _hoisted_4 = [\"onClick\", \"onDragenter\", \"onDragstart\", \"onDrop\"]\nconst _hoisted_5 = [\"src\"]\nconst _hoisted_6 = [\"src\"]\nconst _hoisted_7 = { class: \"ds-flex ds-flex-wrap ds-justify-center\" }\nconst _hoisted_8 = /*#__PURE__*/ _withScopeId(() => /*#__PURE__*/_createElementVNode(\"svg\", {\n class: \"ds-h-4 ds-w-4 ds-fill-primary-t\",\n viewBox: \"0 0 512 512\",\n xmlns: \"http://www.w3.org/2000/svg\"\n}, [\n /*#__PURE__*/_createElementVNode(\"path\", { d: \"M447.1 32h-384C28.64 32-.0091 60.65-.0091 96v320c0 35.35 28.65 64 63.1 64h384c35.35 0 64-28.65 64-64V96C511.1 60.65 483.3 32 447.1 32zM111.1 96c26.51 0 48 21.49 48 48S138.5 192 111.1 192s-48-21.49-48-48S85.48 96 111.1 96zM446.1 407.6C443.3 412.8 437.9 416 432 416H82.01c-6.021 0-11.53-3.379-14.26-8.75c-2.73-5.367-2.215-11.81 1.334-16.68l70-96C142.1 290.4 146.9 288 152 288s9.916 2.441 12.93 6.574l32.46 44.51l93.3-139.1C293.7 194.7 298.7 192 304 192s10.35 2.672 13.31 7.125l128 192C448.6 396 448.9 402.3 446.1 407.6z\" })\n], -1))\nconst _hoisted_9 = [\"accept\", \"multiple\"]\n\nimport { FileImageTypes } from '@/constants/Common';\nimport type { FileItemRead } from '@/types';\nimport { isEmpty } from 'lodash-es';\nimport { v4 as uuid } from 'uuid';\nimport { computed, ref } from 'vue';\nimport { useI18n } from 'vue-i18n';\nimport BImagePickerCloseButton from './BImagePickerCloseButton.vue';\nimport ImagePreview from './BImagePreview.vue';\nimport type { ValidationRule } from '@/composables/Validation';\nimport { useValidationField } from '@/composables/Validation';\nimport BLabel from '../BLabel.vue';\nimport BButton from '../BButton.vue';\nimport BErrorMessage from '../BErrorMessage.vue';\n\n//#region Props\nexport interface Props {\n inputId?: string;\n /**\n * Empty object <code>multiple: false</code> or empty array <code>multiple: true</code>.\n */\n modelValue: FileItemRead | FileItemRead[];\n label?: string;\n /**\n * Allow to pick multiple images, v-model expects an array.\n */\n multiple?: boolean;\n /**\n * Maximum file size in MB.\n */\n maxFileSize?: number;\n hideDetails?: boolean;\n required?: boolean;\n requiredErrorMessage?: string;\n validationRules?: ValidationRule[];\n}\n\n\nexport default /*#__PURE__*/_defineComponent({\n __name: 'BImagePicker',\n props: {\n inputId: { default: '' },\n modelValue: {},\n label: { default: '' },\n multiple: { type: Boolean, default: false },\n maxFileSize: { default: 20 },\n hideDetails: { type: Boolean, default: false },\n required: { type: Boolean, default: false },\n requiredErrorMessage: { default: '' },\n validationRules: { default: undefined }\n },\n emits: [\"change\", \"update:modelValue\"],\n setup(__props: any, { expose: __expose, emit: __emit }) {\n\n// Drag & Drop: https://www.w3schools.com/jsref/event_ondragover.asp\nconst props = __props;\n//#endregion\n\n//#region Events\nconst emit = __emit;\n//#endregion\n\n//#region Data\nconst { t } = useI18n();\nconst inputRef = ref<HTMLInputElement | null>(null);\nconst draggedIndex = ref(0);\nconst value = computed({\n get() {\n return props.modelValue;\n },\n set(val) {\n emit('update:modelValue', val);\n },\n});\nconst fileTypesValid = ref(true);\nconst fileSizeValid = ref(true);\nconst previewImage = ref({\n visible: false,\n url: '',\n});\nconst allowedTypes = computed(() => FileImageTypes.join(', '));\nconst id = computed(() => props.inputId || `id-${uuid()}`);\nconst validateRequired: ValidationRule = {\n validateRule: (val: FileItemRead[]) => !!val && val.length > 0,\n errorMessage: () =>\n props.requiredErrorMessage || t('ds.global.field_required'),\n};\nconst validateFileTypesValid: ValidationRule = {\n validateRule: () => fileTypesValid.value,\n errorMessage: () =>\n t('ds.components.base.image_picker.file_types_valid', {\n types: allowedTypes.value,\n }),\n};\nconst validateFileSizeValid: ValidationRule = {\n validateRule: () => fileSizeValid.value,\n errorMessage: () =>\n t('ds.components.base.image_picker.file_size_valid', {\n size: props.maxFileSize,\n }),\n};\nconst vRules = computed(() => {\n let result: ValidationRule[] = [];\n\n if (props.required) {\n result.push(validateRequired);\n }\n if (props.validationRules) {\n result = result.concat(props.validationRules);\n }\n result.push(validateFileTypesValid);\n result.push(validateFileSizeValid);\n\n return result.length ? result : undefined;\n});\nconst { validate, validationResult } = useValidationField(\n id.value,\n value,\n vRules.value,\n);\n//#endregion\n\n//#region Methods\n/* Events fired on the drag target */\nconst handleDragStart = (index: number, e: DragEvent) => {\n draggedIndex.value = index;\n const target = e.target as HTMLDivElement;\n target.classList.add('dragging');\n e.dataTransfer!.effectAllowed = 'move';\n e.dataTransfer!.setData('index', index.toString());\n};\nconst handleDragEnd = (e: DragEvent) => {\n const target = e.target as HTMLDivElement;\n target.classList.remove('dragging');\n};\n/* Events fired on the drop target */\nconst handleDragEnter = (index: number, e: DragEvent) => {\n const target = e.target as HTMLDivElement;\n if (draggedIndex.value !== index) {\n target.classList.add('dropped-target');\n }\n};\nconst handleDragOver = (e: DragEvent) => {\n // By default, data/elements cannot be dropped in other elements. To allow a drop, we must prevent the default handling of the element\n e.preventDefault();\n e.dataTransfer!.dropEffect = 'move';\n};\nconst handleDragLeave = (e: DragEvent) => {\n // When the draggable p element leaves the droptarget, reset the style\n const target = e.target as HTMLDivElement;\n target.classList.remove('dropped-target');\n};\nconst handleDrop = (index: number, e: DragEvent) => {\n e.preventDefault();\n const target = e.target as HTMLDivElement;\n target.classList.remove('dropped-target');\n const draggedIndex = parseInt(e.dataTransfer!.getData('index'));\n const draggedImg = (value.value as FileItemRead[])[draggedIndex];\n (value.value as FileItemRead[]).splice(draggedIndex, 1);\n (value.value as FileItemRead[]).splice(index, 0, draggedImg);\n\n emit('change');\n validate();\n};\nconst openFileDialog = () => {\n inputRef.value?.click();\n};\nconst handleChangeInput = (e: any) => {\n let fileList: FileList = e.target.files || e.dataTransfer.files;\n if (!fileList.length) {\n return;\n }\n createFileImages(fileList);\n\n // Clear input's value so onChange event can work for the same files next picks\n if (inputRef.value) {\n inputRef.value.value = null as any;\n }\n};\nconst createFileImages = (fileList: FileList) => {\n Array.from(fileList).forEach((file) => {\n fileTypesValid.value = FileImageTypes.includes(file.type);\n fileSizeValid.value = convertToMB(file.size) <= props.maxFileSize;\n\n if (fileTypesValid.value && fileSizeValid.value) {\n let reader: any = new FileReader();\n\n reader.onload = (f: any) => {\n if (props.multiple) {\n (value.value as FileItemRead[]).push({\n url: f.target.result,\n file,\n type: file.type,\n });\n } else {\n // splice(index, how-many, item1, item2,...);\n value.value = {\n url: f.target.result,\n file,\n type: file.type,\n };\n }\n\n emit('change');\n validate();\n };\n\n reader.readAsDataURL(file);\n } else {\n validate();\n }\n });\n};\nconst removeFileImage = (index: number) => {\n (value.value as FileItemRead[]).splice(index, 1);\n emit('change');\n validate();\n};\nconst removeFileImageSingle = () => {\n value.value = {};\n emit('change');\n validate();\n};\nconst convertToMB = (numberOfBytes: number) => numberOfBytes / 1024 ** 2;\nconst preview = (item: FileItemRead) => {\n previewImage.value.url = item.url || '';\n previewImage.value.visible = true;\n};\n//#endregion\n\n__expose({ validate });\n\nreturn (_ctx: any,_cache: any) => {\n return (_openBlock(), _createElementBlock(\"div\", _hoisted_1, [\n _createVNode(BLabel, {\n label: props.label\n }, null, 8, [\"label\"]),\n _createElementVNode(\"div\", _hoisted_2, [\n (!_unref(isEmpty)(value.value))\n ? (_openBlock(), _createElementBlock(\"div\", _hoisted_3, [\n (props.multiple)\n ? (_openBlock(true), _createElementBlock(_Fragment, { key: 0 }, _renderList(value.value as FileItemRead[], (item, index) => {\n return (_openBlock(), _createElementBlock(\"div\", {\n key: item.url,\n class: \"b-image-picker__draggable ds-h-full ds-cursor-pointer ds-rounded-lg ds-transition-all hover:ds-ring-2 hover:ds-ring-primary-t\",\n draggable: \"true\",\n onClick: ($event: any) => (preview(item)),\n onDragend: handleDragEnd,\n onDragenter: ($event: any) => (handleDragEnter(index, $event)),\n onDragleave: handleDragLeave,\n onDragover: handleDragOver,\n onDragstart: ($event: any) => (handleDragStart(index, $event)),\n onDrop: ($event: any) => (handleDrop(index, $event))\n }, [\n _createElementVNode(\"img\", {\n src: item.url,\n alt: \"image\",\n class: \"ds-h-full ds-w-full ds-rounded-lg\"\n }, null, 8, _hoisted_5),\n _createVNode(BImagePickerCloseButton, {\n class: \"ds-right-1 ds-top-1 ds-h-8 ds-w-8\",\n onClick: _withModifiers(($event: any) => (removeFileImage(index)), [\"stop\"])\n }, null, 8, [\"onClick\"])\n ], 40, _hoisted_4))\n }), 128))\n : (_openBlock(), _createElementBlock(\"div\", {\n key: 1,\n class: \"b-image-picker__draggable ds-h-full ds-cursor-pointer ds-rounded-lg ds-transition-all hover:ds-ring-2 hover:ds-ring-primary-t\",\n draggable: \"true\",\n onClick: _cache[0] || (_cache[0] = ($event: any) => (preview(value.value as FileItemRead)))\n }, [\n _createElementVNode(\"img\", {\n src: (value.value as FileItemRead).url,\n alt: \"image\",\n class: \"ds-h-full ds-w-full ds-rounded-lg\"\n }, null, 8, _hoisted_6),\n _createVNode(BImagePickerCloseButton, {\n class: \"ds-right-1 ds-top-1 ds-h-8 ds-w-8\",\n onClick: _withModifiers(removeFileImageSingle, [\"stop\"])\n })\n ]))\n ]))\n : _createCommentVNode(\"\", true),\n _createElementVNode(\"div\", _hoisted_7, [\n _createVNode(BButton, { onClick: openFileDialog }, {\n default: _withCtx(() => [\n _createTextVNode(_toDisplayString(_unref(t)('ds.components.base.image_picker.select_image')), 1)\n ]),\n appendIcon: _withCtx(() => [\n _hoisted_8\n ]),\n _: 1\n }),\n _createElementVNode(\"input\", {\n ref_key: \"inputRef\",\n ref: inputRef,\n accept: allowedTypes.value,\n multiple: props.multiple,\n class: \"ds-hidden\",\n type: \"file\",\n onChange: handleChangeInput\n }, null, 40, _hoisted_9)\n ])\n ]),\n (!props.hideDetails)\n ? (_openBlock(), _createBlock(BErrorMessage, {\n key: 0,\n \"error-message\": _unref(validationResult).errorMessage(),\n class: \"ds-mt-1\"\n }, null, 8, [\"error-message\"]))\n : _createCommentVNode(\"\", true),\n _createVNode(ImagePreview, {\n modelValue: previewImage.value.visible,\n \"onUpdate:modelValue\": _cache[1] || (_cache[1] = ($event: any) => ((previewImage.value.visible) = $event)),\n url: previewImage.value.url\n }, null, 8, [\"modelValue\", \"url\"])\n ]))\n}\n}\n\n})"],"names":["_withScopeId","_pushScopeId","n","_popScopeId","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_createElementVNode","_hoisted_9","_sfc_main","_defineComponent","__props","__expose","__emit","props","emit","t","useI18n","inputRef","ref","draggedIndex","value","computed","val","fileTypesValid","fileSizeValid","previewImage","allowedTypes","FileImageTypes","id","uuid","validateRequired","validateFileTypesValid","validateFileSizeValid","vRules","result","validate","validationResult","useValidationField","handleDragStart","index","e","handleDragEnd","handleDragEnter","target","handleDragOver","handleDragLeave","handleDrop","draggedImg","openFileDialog","_a","handleChangeInput","fileList","createFileImages","file","convertToMB","reader","f","removeFileImage","removeFileImageSingle","numberOfBytes","preview","item","_ctx","_cache","_openBlock","_createElementBlock","_createVNode","BLabel","_unref","isEmpty","_createCommentVNode","_Fragment","_renderList","$event","BImagePickerCloseButton","_withModifiers","BButton","_withCtx","_createTextVNode","_toD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design-system100.mjs";
|
|
3
|
-
const k = { class: "b-switch ds-flex ds-items-center" }, w = ["id", "disabled", "value"], B = ["for"], x = ["for"], C = /* @__PURE__ */ m({
|
|
4
|
-
__name: "BSwitch",
|
|
5
|
-
props: {
|
|
6
|
-
inputId: { default: "" },
|
|
7
|
-
modelValue: { type: [Boolean, Array], default: !1 },
|
|
8
|
-
label: { default: "" },
|
|
9
|
-
labelOrphan: { type: Boolean, default: !1 },
|
|
10
|
-
disabled: { type: Boolean, default: !1 }
|
|
11
|
-
},
|
|
12
|
-
emits: ["update:modelValue"],
|
|
13
|
-
setup(i, { emit: n }) {
|
|
14
|
-
const e = i, c = n, l = d(() => e.inputId || `id-${V()}`), a = d({
|
|
15
|
-
get() {
|
|
16
|
-
return e.modelValue;
|
|
17
|
-
},
|
|
18
|
-
set(t) {
|
|
19
|
-
c("update:modelValue", t);
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
return (t, o) => (s(), r("div", k, [
|
|
23
|
-
f(u("input", {
|
|
24
|
-
"onUpdate:modelValue": o[0] || (o[0] = (p) => a.value = p),
|
|
25
|
-
id: l.value,
|
|
26
|
-
disabled: e.disabled,
|
|
27
|
-
value: t.$attrs.value,
|
|
28
|
-
type: "checkbox",
|
|
29
|
-
class: "b-switch__input"
|
|
30
|
-
}, null, 8, w), [
|
|
31
|
-
[b, a.value]
|
|
32
|
-
]),
|
|
33
|
-
u("label", {
|
|
34
|
-
for: l.value,
|
|
35
|
-
class: "b-switch__input-label ds-border ds-border-black/[0.1] ds-drop-shadow-light"
|
|
36
|
-
}, null, 8, B),
|
|
37
|
-
e.label || t.$slots.default ? (s(), r("label", {
|
|
38
|
-
key: 0,
|
|
39
|
-
for: e.labelOrphan ? void 0 : l.value,
|
|
40
|
-
class: "ds-ml-2 ds-text-sm ds-font-medium ds-text-gray-900"
|
|
41
|
-
}, [
|
|
42
|
-
h(t.$slots, "default", {}, () => [
|
|
43
|
-
v(_(e.label), 1)
|
|
44
|
-
], !0)
|
|
45
|
-
], 8, x)) : y("", !0)
|
|
46
|
-
]));
|
|
47
|
-
}
|
|
48
|
-
});
|
|
1
|
+
import f from "./design-system46.mjs";
|
|
49
2
|
export {
|
|
50
|
-
|
|
3
|
+
f as default
|
|
51
4
|
};
|
|
52
5
|
//# sourceMappingURL=design-system91.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"design-system91.mjs","sources":[
|
|
1
|
+
{"version":3,"file":"design-system91.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/dist/design-system92.mjs
CHANGED
|
@@ -1,5 +1,145 @@
|
|
|
1
|
-
|
|
1
|
+
import { defineComponent as I, ref as $, computed as l, watch as m, onMounted as M, openBlock as d, createElementBlock as n, createVNode as N, createElementVNode as f, renderSlot as b, createCommentVNode as u, normalizeClass as S, withKeys as w, createBlock as E, unref as x } from "vue";
|
|
2
|
+
import z from "./design-system16.mjs";
|
|
3
|
+
import { useValidationField as K } from "./design-system3.mjs";
|
|
4
|
+
import D from "./design-system15.mjs";
|
|
5
|
+
import { useI18n as U } from "./design-system50.mjs";
|
|
6
|
+
import F from "./design-system106.mjs";
|
|
7
|
+
import { SupportedLocale as A } from "./design-system5.mjs";
|
|
8
|
+
import L from "./design-system100.mjs";
|
|
9
|
+
const O = { class: "b-currency-field" }, j = { class: "ds-relative" }, G = {
|
|
10
|
+
key: 0,
|
|
11
|
+
class: "b-currency-field__prepend-icon ds-absolute ds-left-3 ds-top-0 ds-z-[1] ds-flex ds-h-full ds-cursor-pointer ds-items-center hover:ds-text-primary-t"
|
|
12
|
+
}, H = ["id", "autocomplete", "disabled", "placeholder", "readonly"], J = {
|
|
13
|
+
key: 1,
|
|
14
|
+
class: "b-currency-field__append-icon ds-absolute ds-right-3 ds-top-0 ds-z-[1] ds-flex ds-h-full ds-cursor-pointer ds-items-center hover:ds-text-primary-t"
|
|
15
|
+
}, oe = /* @__PURE__ */ I({
|
|
16
|
+
__name: "BCurrencyField",
|
|
17
|
+
props: {
|
|
18
|
+
inputId: { default: "" },
|
|
19
|
+
inputCssClass: { default: "" },
|
|
20
|
+
modelValue: {},
|
|
21
|
+
label: { default: "" },
|
|
22
|
+
validationRules: { default: void 0 },
|
|
23
|
+
placeholder: { default: "" },
|
|
24
|
+
autocomplete: { type: Boolean, default: !1 },
|
|
25
|
+
required: { type: Boolean, default: !1 },
|
|
26
|
+
requiredErrorMessage: { default: "" },
|
|
27
|
+
disabled: { type: Boolean, default: !1 },
|
|
28
|
+
readonly: { type: Boolean, default: !1 },
|
|
29
|
+
hideDetails: { type: Boolean, default: !1 },
|
|
30
|
+
locale: { default: A["vi-VN"] }
|
|
31
|
+
},
|
|
32
|
+
emits: ["press:enter", "update:modelValue"],
|
|
33
|
+
setup(v, { emit: k }) {
|
|
34
|
+
const s = v, i = k;
|
|
35
|
+
let o;
|
|
36
|
+
const { t: h } = U(), c = $(null), y = {
|
|
37
|
+
validateRule: (e) => !!(e && (e != null && e.trim())),
|
|
38
|
+
errorMessage: () => s.requiredErrorMessage || h("ds.global.field_required")
|
|
39
|
+
}, a = l(() => s.inputId || `id-${L()}`), t = l({
|
|
40
|
+
get() {
|
|
41
|
+
return s.modelValue;
|
|
42
|
+
},
|
|
43
|
+
set(e) {
|
|
44
|
+
i("update:modelValue", e);
|
|
45
|
+
}
|
|
46
|
+
}), g = l(() => [
|
|
47
|
+
{
|
|
48
|
+
"ds-cursor-not-allowed ds-bg-[#f2f2f2] ds-text-black/[0.4]": s.disabled,
|
|
49
|
+
"ds-text-black/[0.85]": !s.disabled,
|
|
50
|
+
"ds-border-error focus:ds-ring-1 focus:ds-ring-error": !r.value.valid,
|
|
51
|
+
"ds-border-black/[0.1] focus:ds-border-focus focus:ds-ring-1 focus:ds-ring-focus": r.value.valid
|
|
52
|
+
},
|
|
53
|
+
s.inputCssClass
|
|
54
|
+
]), _ = l(() => {
|
|
55
|
+
let e = [];
|
|
56
|
+
return s.required && e.push(y), s.validationRules && (e = e.concat(s.validationRules)), e.length ? e : void 0;
|
|
57
|
+
}), V = l(
|
|
58
|
+
() => s.locale === "en-US" ? {
|
|
59
|
+
mask: "$num",
|
|
60
|
+
blocks: {
|
|
61
|
+
num: {
|
|
62
|
+
mask: Number,
|
|
63
|
+
thousandsSeparator: " "
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
} : [
|
|
67
|
+
{ mask: "" },
|
|
68
|
+
{
|
|
69
|
+
mask: "num VND",
|
|
70
|
+
lazy: !1,
|
|
71
|
+
blocks: {
|
|
72
|
+
num: {
|
|
73
|
+
mask: Number,
|
|
74
|
+
thousandsSeparator: " "
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
), { validate: C, validationResult: r } = K(
|
|
80
|
+
a.value,
|
|
81
|
+
t,
|
|
82
|
+
_.value
|
|
83
|
+
);
|
|
84
|
+
m(
|
|
85
|
+
() => s.locale,
|
|
86
|
+
() => {
|
|
87
|
+
p();
|
|
88
|
+
}
|
|
89
|
+
), m(
|
|
90
|
+
() => s.modelValue,
|
|
91
|
+
(e) => {
|
|
92
|
+
e != o.unmaskedValue && (o.unmaskedValue = e.toString());
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
const q = () => {
|
|
96
|
+
C();
|
|
97
|
+
}, B = () => {
|
|
98
|
+
i("press:enter");
|
|
99
|
+
}, R = () => {
|
|
100
|
+
t.value = typeof t.value == "number" ? +o.unmaskedValue : o.unmaskedValue;
|
|
101
|
+
}, p = () => {
|
|
102
|
+
o && o.destroy(), o = F(c.value, V.value), o.on("accept", R);
|
|
103
|
+
};
|
|
104
|
+
return M(() => {
|
|
105
|
+
p(), o.unmaskedValue = t.value.toString();
|
|
106
|
+
}), (e, P) => (d(), n("div", O, [
|
|
107
|
+
N(z, {
|
|
108
|
+
id: a.value,
|
|
109
|
+
label: e.label,
|
|
110
|
+
required: e.required
|
|
111
|
+
}, null, 8, ["id", "label", "required"]),
|
|
112
|
+
f("div", j, [
|
|
113
|
+
e.$slots.prependIcon ? (d(), n("div", G, [
|
|
114
|
+
b(e.$slots, "prependIcon", {}, void 0, !0)
|
|
115
|
+
])) : u("", !0),
|
|
116
|
+
f("input", {
|
|
117
|
+
id: a.value,
|
|
118
|
+
ref_key: "inputRef",
|
|
119
|
+
ref: c,
|
|
120
|
+
autocomplete: s.autocomplete ? "on" : "off",
|
|
121
|
+
class: S([g.value, "ds-block ds-h-[40px] ds-w-full ds-rounded-lg ds-border ds-px-3 ds-text-sm ds-drop-shadow-light"]),
|
|
122
|
+
disabled: s.disabled,
|
|
123
|
+
placeholder: s.placeholder,
|
|
124
|
+
readonly: s.readonly,
|
|
125
|
+
onKeyup: [
|
|
126
|
+
q,
|
|
127
|
+
w(B, ["enter"])
|
|
128
|
+
]
|
|
129
|
+
}, null, 42, H),
|
|
130
|
+
e.$slots.appendIcon ? (d(), n("div", J, [
|
|
131
|
+
b(e.$slots, "appendIcon", {}, void 0, !0)
|
|
132
|
+
])) : u("", !0)
|
|
133
|
+
]),
|
|
134
|
+
e.hideDetails ? u("", !0) : (d(), E(D, {
|
|
135
|
+
key: 0,
|
|
136
|
+
"error-message": x(r).errorMessage(),
|
|
137
|
+
class: "ds-mt-1"
|
|
138
|
+
}, null, 8, ["error-message"]))
|
|
139
|
+
]));
|
|
140
|
+
}
|
|
141
|
+
});
|
|
2
142
|
export {
|
|
3
|
-
|
|
143
|
+
oe as default
|
|
4
144
|
};
|
|
5
145
|
//# sourceMappingURL=design-system92.mjs.map
|