@iankibetsh/sh-tailwind 0.1.0 → 0.1.2
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 +253 -55
- package/dist/sh-tailwind.cjs.js +1 -1
- package/dist/sh-tailwind.es.js +371 -171
- package/package.json +3 -2
- package/src/components/form/ShForm.vue +13 -2
- package/src/components/form/inputs/MaskedInput.vue +61 -0
- package/src/components/form/inputs/PinInput.vue +125 -0
- package/src/components/table/ShTable.vue +1 -1
- package/src/index.js +3 -0
- package/src/theme/defaultTheme.js +58 -52
- package/src/utils/mask.js +103 -0
- package/src/utils/normalizeField.js +1 -1
package/dist/sh-tailwind.es.js
CHANGED
|
@@ -5,55 +5,61 @@ var U = {
|
|
|
5
5
|
form: {
|
|
6
6
|
form: "space-y-4",
|
|
7
7
|
group: "space-y-1",
|
|
8
|
-
label: "block text-sm font-medium text-gray-700
|
|
8
|
+
label: "block text-sm font-medium text-gray-700",
|
|
9
9
|
required: "text-red-500",
|
|
10
|
-
input: "block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm placeholder:text-gray-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/30 disabled:cursor-not-allowed disabled:opacity-50
|
|
11
|
-
inputInvalid: "block w-full rounded-md border border-red-500 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm placeholder:text-gray-400 focus:border-red-500 focus:outline-none focus:ring-2 focus:ring-red-500/30
|
|
12
|
-
helper: "text-xs text-gray-500
|
|
10
|
+
input: "block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm placeholder:text-gray-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/30 disabled:cursor-not-allowed disabled:opacity-50",
|
|
11
|
+
inputInvalid: "block w-full rounded-md border border-red-500 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm placeholder:text-gray-400 focus:border-red-500 focus:outline-none focus:ring-2 focus:ring-red-500/30",
|
|
12
|
+
helper: "text-xs text-gray-500",
|
|
13
13
|
error: "text-xs text-red-600",
|
|
14
|
-
errorTitle: "rounded-md bg-red-50 px-4 py-3 text-sm text-red-700
|
|
14
|
+
errorTitle: "rounded-md bg-red-50 px-4 py-3 text-sm text-red-700",
|
|
15
15
|
nav: "flex items-center justify-end gap-3 pt-2",
|
|
16
16
|
submitBtn: "inline-flex items-center justify-center gap-2 rounded-md bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500/40 disabled:cursor-not-allowed disabled:opacity-60",
|
|
17
|
-
prevBtn: "inline-flex items-center justify-center gap-2 rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-gray-300
|
|
17
|
+
prevBtn: "inline-flex items-center justify-center gap-2 rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-gray-300",
|
|
18
18
|
nextBtn: "inline-flex items-center justify-center gap-2 rounded-md bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500/40",
|
|
19
19
|
steps: {
|
|
20
20
|
wrapper: "mb-6 flex items-start",
|
|
21
21
|
step: "relative flex flex-1 flex-col items-center gap-1",
|
|
22
|
-
circle: "z-10 flex size-9 items-center justify-center rounded-full border-2 border-gray-300 bg-white text-sm font-semibold text-gray-500
|
|
22
|
+
circle: "z-10 flex size-9 items-center justify-center rounded-full border-2 border-gray-300 bg-white text-sm font-semibold text-gray-500",
|
|
23
23
|
circleActive: "z-10 flex size-9 items-center justify-center rounded-full border-2 border-blue-600 bg-blue-600 text-sm font-semibold text-white",
|
|
24
24
|
circleDone: "z-10 flex size-9 items-center justify-center rounded-full border-2 border-emerald-500 bg-emerald-500 text-sm font-semibold text-white",
|
|
25
|
-
title: "text-xs text-gray-600
|
|
25
|
+
title: "text-xs text-gray-600",
|
|
26
26
|
titleActive: "text-xs font-semibold text-blue-600",
|
|
27
|
-
connector: "absolute top-4 right-1/2 -z-0 h-0.5 w-full bg-gray-200
|
|
27
|
+
connector: "absolute top-4 right-1/2 -z-0 h-0.5 w-full bg-gray-200",
|
|
28
28
|
connectorDone: "absolute top-4 right-1/2 -z-0 h-0.5 w-full bg-emerald-500"
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
inputs: {
|
|
32
|
-
select: "block w-full appearance-none rounded-md border border-gray-300 bg-white px-3 py-2 pr-8 text-sm text-gray-900 shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/30 disabled:opacity-50
|
|
32
|
+
select: "block w-full appearance-none rounded-md border border-gray-300 bg-white px-3 py-2 pr-8 text-sm text-gray-900 shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/30 disabled:opacity-50",
|
|
33
33
|
passwordWrapper: "relative",
|
|
34
|
-
passwordToggle: "absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600
|
|
34
|
+
passwordToggle: "absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600",
|
|
35
|
+
pin: {
|
|
36
|
+
wrapper: "flex items-center gap-2",
|
|
37
|
+
box: "size-11 rounded-md border border-gray-300 bg-white text-center text-lg font-semibold text-gray-900 shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/30 disabled:cursor-not-allowed disabled:opacity-50",
|
|
38
|
+
boxFilled: "size-11 rounded-md border border-blue-400 bg-blue-50 text-center text-lg font-semibold text-gray-900 shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/30",
|
|
39
|
+
boxInvalid: "size-11 rounded-md border border-red-500 bg-white text-center text-lg font-semibold text-gray-900 shadow-sm focus:border-red-500 focus:outline-none focus:ring-2 focus:ring-red-500/30"
|
|
40
|
+
},
|
|
35
41
|
suggest: {
|
|
36
42
|
wrapper: "relative",
|
|
37
43
|
badges: "mb-1 flex flex-wrap gap-1",
|
|
38
|
-
badge: "inline-flex items-center gap-1 rounded-full bg-gray-200 px-2 py-0.5 text-xs text-gray-700
|
|
44
|
+
badge: "inline-flex items-center gap-1 rounded-full bg-gray-200 px-2 py-0.5 text-xs text-gray-700",
|
|
39
45
|
badgeRemove: "cursor-pointer text-gray-500 hover:text-red-600",
|
|
40
|
-
dropdown: "absolute z-20 mt-1 max-h-60 w-full overflow-auto rounded-md border border-gray-200 bg-white py-1 shadow-lg
|
|
41
|
-
option: "cursor-pointer px-3 py-2 text-sm text-gray-700 hover:bg-gray-100
|
|
42
|
-
optionActive: "cursor-pointer bg-blue-50 px-3 py-2 text-sm text-blue-700
|
|
46
|
+
dropdown: "absolute z-20 mt-1 max-h-60 w-full overflow-auto rounded-md border border-gray-200 bg-white py-1 shadow-lg",
|
|
47
|
+
option: "cursor-pointer px-3 py-2 text-sm text-gray-700 hover:bg-gray-100",
|
|
48
|
+
optionActive: "cursor-pointer bg-blue-50 px-3 py-2 text-sm text-blue-700",
|
|
43
49
|
empty: "px-3 py-2 text-sm text-gray-400"
|
|
44
50
|
},
|
|
45
51
|
phone: {
|
|
46
|
-
wrapper: "relative flex items-stretch rounded-md border border-gray-300 bg-white shadow-sm focus-within:border-blue-500 focus-within:ring-2 focus-within:ring-blue-500/30
|
|
47
|
-
trigger: "flex shrink-0 cursor-pointer items-center gap-1.5 rounded-l-md border-r border-gray-200 bg-gray-50 px-3 py-2 text-sm text-gray-700 hover:bg-gray-100 focus:outline-none
|
|
52
|
+
wrapper: "relative flex items-stretch rounded-md border border-gray-300 bg-white shadow-sm focus-within:border-blue-500 focus-within:ring-2 focus-within:ring-blue-500/30",
|
|
53
|
+
trigger: "flex shrink-0 cursor-pointer items-center gap-1.5 rounded-l-md border-r border-gray-200 bg-gray-50 px-3 py-2 text-sm text-gray-700 hover:bg-gray-100 focus:outline-none",
|
|
48
54
|
flag: "text-base leading-none",
|
|
49
|
-
dial: "text-sm font-medium text-gray-600
|
|
55
|
+
dial: "text-sm font-medium text-gray-600",
|
|
50
56
|
chevron: "size-3.5 text-gray-400",
|
|
51
|
-
input: "block w-full rounded-r-md border-0 bg-transparent px-3 py-2 text-sm text-gray-900 placeholder:text-gray-400 focus:outline-none focus:ring-0
|
|
52
|
-
dropdown: "absolute left-0 top-full z-20 mt-1 w-72 overflow-hidden rounded-lg border border-gray-200 bg-white shadow-lg
|
|
53
|
-
search: "block w-full border-0 border-b border-gray-100 bg-transparent px-3 py-2.5 text-sm text-gray-900 placeholder:text-gray-400 focus:outline-none focus:ring-0
|
|
57
|
+
input: "block w-full rounded-r-md border-0 bg-transparent px-3 py-2 text-sm text-gray-900 placeholder:text-gray-400 focus:outline-none focus:ring-0",
|
|
58
|
+
dropdown: "absolute left-0 top-full z-20 mt-1 w-72 overflow-hidden rounded-lg border border-gray-200 bg-white shadow-lg",
|
|
59
|
+
search: "block w-full border-0 border-b border-gray-100 bg-transparent px-3 py-2.5 text-sm text-gray-900 placeholder:text-gray-400 focus:outline-none focus:ring-0",
|
|
54
60
|
list: "max-h-60 overflow-y-auto py-1",
|
|
55
|
-
option: "flex w-full cursor-pointer items-center gap-2.5 px-3 py-2 text-left text-sm text-gray-700 hover:bg-gray-100
|
|
56
|
-
optionActive: "flex w-full cursor-pointer items-center gap-2.5 bg-blue-50 px-3 py-2 text-left text-sm text-blue-700
|
|
61
|
+
option: "flex w-full cursor-pointer items-center gap-2.5 px-3 py-2 text-left text-sm text-gray-700 hover:bg-gray-100",
|
|
62
|
+
optionActive: "flex w-full cursor-pointer items-center gap-2.5 bg-blue-50 px-3 py-2 text-left text-sm text-blue-700",
|
|
57
63
|
optionName: "flex-1 truncate",
|
|
58
64
|
optionDial: "text-xs text-gray-400",
|
|
59
65
|
empty: "px-3 py-3 text-center text-sm text-gray-400"
|
|
@@ -62,12 +68,12 @@ var U = {
|
|
|
62
68
|
dialog: {
|
|
63
69
|
backdrop: "fixed inset-0 bg-black/50",
|
|
64
70
|
wrapper: "fixed inset-0 flex items-center justify-center overflow-y-auto p-4",
|
|
65
|
-
panel: "relative flex max-h-[90vh] w-full flex-col rounded-xl bg-white shadow-xl outline-none
|
|
66
|
-
header: "flex items-center justify-between border-b border-gray-100 px-5 py-3.5
|
|
67
|
-
title: "text-base font-semibold text-gray-900
|
|
68
|
-
closeBtn: "rounded-md p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600 focus:outline-none
|
|
71
|
+
panel: "relative flex max-h-[90vh] w-full flex-col rounded-xl bg-white shadow-xl outline-none",
|
|
72
|
+
header: "flex items-center justify-between border-b border-gray-100 px-5 py-3.5",
|
|
73
|
+
title: "text-base font-semibold text-gray-900",
|
|
74
|
+
closeBtn: "rounded-md p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600 focus:outline-none",
|
|
69
75
|
body: "overflow-y-auto px-5 py-4",
|
|
70
|
-
footer: "flex justify-end gap-2 border-t border-gray-100 px-5 py-3
|
|
76
|
+
footer: "flex justify-end gap-2 border-t border-gray-100 px-5 py-3",
|
|
71
77
|
sizes: {
|
|
72
78
|
sm: "max-w-sm",
|
|
73
79
|
md: "max-w-lg",
|
|
@@ -78,10 +84,10 @@ var U = {
|
|
|
78
84
|
},
|
|
79
85
|
drawer: {
|
|
80
86
|
backdrop: "fixed inset-0 bg-black/50",
|
|
81
|
-
panel: "fixed flex flex-col bg-white shadow-xl outline-none
|
|
82
|
-
header: "flex items-center justify-between border-b border-gray-100 px-5 py-3.5
|
|
83
|
-
title: "text-base font-semibold text-gray-900
|
|
84
|
-
closeBtn: "rounded-md p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600 focus:outline-none
|
|
87
|
+
panel: "fixed flex flex-col bg-white shadow-xl outline-none",
|
|
88
|
+
header: "flex items-center justify-between border-b border-gray-100 px-5 py-3.5",
|
|
89
|
+
title: "text-base font-semibold text-gray-900",
|
|
90
|
+
closeBtn: "rounded-md p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600 focus:outline-none",
|
|
85
91
|
body: "flex-1 overflow-y-auto px-5 py-4",
|
|
86
92
|
sizes: {
|
|
87
93
|
sm: "max-w-xs",
|
|
@@ -101,48 +107,48 @@ var U = {
|
|
|
101
107
|
table: {
|
|
102
108
|
wrapper: "space-y-3",
|
|
103
109
|
toolbar: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between",
|
|
104
|
-
search: "block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm placeholder:text-gray-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/30 md:max-w-xs
|
|
110
|
+
search: "block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm placeholder:text-gray-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/30 md:max-w-xs",
|
|
105
111
|
exactLabel: "inline-flex items-center gap-1.5 text-xs text-gray-500",
|
|
106
112
|
rangeWrapper: "flex items-center gap-2",
|
|
107
|
-
rangeInput: "rounded-md border border-gray-300 px-2 py-1.5 text-sm text-gray-700
|
|
108
|
-
offline: "flex items-center gap-2 rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-700
|
|
109
|
-
container: "hidden overflow-x-auto rounded-lg border border-gray-200 md:block
|
|
110
|
-
table: "w-full min-w-full divide-y divide-gray-200 text-sm
|
|
111
|
-
thead: "bg-gray-50
|
|
112
|
-
th: "px-4 py-2.5 text-left text-xs font-semibold uppercase tracking-wide text-gray-500
|
|
113
|
-
sortBtn: "inline-flex cursor-pointer items-center gap-1 uppercase hover:text-gray-800
|
|
114
|
-
tbody: "divide-y divide-gray-100 bg-white
|
|
113
|
+
rangeInput: "rounded-md border border-gray-300 px-2 py-1.5 text-sm text-gray-700",
|
|
114
|
+
offline: "flex items-center gap-2 rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-700",
|
|
115
|
+
container: "hidden overflow-x-auto rounded-lg border border-gray-200 md:block",
|
|
116
|
+
table: "w-full min-w-full divide-y divide-gray-200 text-sm",
|
|
117
|
+
thead: "bg-gray-50",
|
|
118
|
+
th: "px-4 py-2.5 text-left text-xs font-semibold uppercase tracking-wide text-gray-500",
|
|
119
|
+
sortBtn: "inline-flex cursor-pointer items-center gap-1 uppercase hover:text-gray-800",
|
|
120
|
+
tbody: "divide-y divide-gray-100 bg-white",
|
|
115
121
|
tr: "",
|
|
116
|
-
trClickable: "cursor-pointer hover:bg-gray-50
|
|
117
|
-
td: "px-4 py-2.5 text-gray-700
|
|
122
|
+
trClickable: "cursor-pointer hover:bg-gray-50",
|
|
123
|
+
td: "px-4 py-2.5 text-gray-700",
|
|
118
124
|
money: "font-semibold text-emerald-600",
|
|
119
125
|
empty: "px-4 py-10 text-center text-sm text-gray-400",
|
|
120
|
-
error: "rounded-md bg-red-50 px-4 py-3 text-sm text-red-700
|
|
126
|
+
error: "rounded-md bg-red-50 px-4 py-3 text-sm text-red-700",
|
|
121
127
|
loading: "flex justify-center px-4 py-10 text-gray-400",
|
|
122
128
|
actionsCell: "whitespace-nowrap px-4 py-2.5 text-right",
|
|
123
129
|
actionBtn: "ml-3 inline-flex cursor-pointer items-center gap-1 text-sm text-blue-600 hover:underline first:ml-0",
|
|
124
130
|
checkbox: "size-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500",
|
|
125
131
|
cards: "space-y-3 md:hidden",
|
|
126
|
-
card: "rounded-lg border border-gray-200 bg-white p-4
|
|
132
|
+
card: "rounded-lg border border-gray-200 bg-white p-4",
|
|
127
133
|
cardLabel: "text-xs font-semibold uppercase tracking-wide text-gray-400",
|
|
128
|
-
cardValue: "mb-2 text-sm text-gray-700
|
|
134
|
+
cardValue: "mb-2 text-sm text-gray-700",
|
|
129
135
|
pagination: {
|
|
130
136
|
wrapper: "flex flex-col items-center justify-between gap-3 md:flex-row",
|
|
131
137
|
info: "text-xs text-gray-500",
|
|
132
|
-
perPage: "rounded-md border border-gray-300 px-2 py-1 text-xs text-gray-600
|
|
138
|
+
perPage: "rounded-md border border-gray-300 px-2 py-1 text-xs text-gray-600",
|
|
133
139
|
pages: "flex items-center gap-1",
|
|
134
|
-
pageBtn: "inline-flex size-8 cursor-pointer items-center justify-center rounded-md border border-gray-300 text-xs text-gray-600 hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-40
|
|
140
|
+
pageBtn: "inline-flex size-8 cursor-pointer items-center justify-center rounded-md border border-gray-300 text-xs text-gray-600 hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-40",
|
|
135
141
|
pageBtnActive: "inline-flex size-8 items-center justify-center rounded-md border border-blue-600 bg-blue-600 text-xs font-semibold text-white",
|
|
136
142
|
ellipsis: "px-1 text-xs text-gray-400",
|
|
137
|
-
loadMore: "inline-flex items-center justify-center gap-2 rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 disabled:opacity-60
|
|
143
|
+
loadMore: "inline-flex items-center justify-center gap-2 rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 disabled:opacity-60"
|
|
138
144
|
},
|
|
139
|
-
multiBar: "fixed bottom-5 left-1/2 z-40 flex min-w-80 -translate-x-1/2 items-center justify-between gap-4 rounded-xl border border-gray-200 bg-white p-3 shadow-lg
|
|
145
|
+
multiBar: "fixed bottom-5 left-1/2 z-40 flex min-w-80 -translate-x-1/2 items-center justify-between gap-4 rounded-xl border border-gray-200 bg-white p-3 shadow-lg",
|
|
140
146
|
multiCount: "inline-flex items-center justify-center rounded-full bg-blue-600 px-2 py-0.5 text-xs font-semibold text-white",
|
|
141
|
-
multiBtn: "inline-flex items-center justify-center gap-1 rounded-md border border-blue-200 px-3 py-1.5 text-xs font-medium text-blue-700 hover:bg-blue-50
|
|
147
|
+
multiBtn: "inline-flex items-center justify-center gap-1 rounded-md border border-blue-200 px-3 py-1.5 text-xs font-medium text-blue-700 hover:bg-blue-50"
|
|
142
148
|
},
|
|
143
149
|
buttons: {
|
|
144
150
|
primary: "inline-flex items-center justify-center gap-2 rounded-md bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500/40 disabled:opacity-60",
|
|
145
|
-
secondary: "inline-flex items-center justify-center gap-2 rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none
|
|
151
|
+
secondary: "inline-flex items-center justify-center gap-2 rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none",
|
|
146
152
|
danger: "inline-flex items-center justify-center gap-2 rounded-md bg-red-600 px-4 py-2 text-sm font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500/40",
|
|
147
153
|
link: "inline-flex cursor-pointer items-center gap-1 text-sm text-blue-600 hover:underline"
|
|
148
154
|
}
|
|
@@ -220,7 +226,7 @@ function ce({ isStatic: e, onClose: t, onOpen: n } = {}) {
|
|
|
220
226
|
//#region src/utils/strings.js
|
|
221
227
|
var le = (e) => String(e ?? "").replace(/[_-]+/g, " ").replace(/([a-z\d])([A-Z])/g, "$1 $2").trim().split(/\s+/).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" "), ue = {
|
|
222
228
|
password: "password",
|
|
223
|
-
pin: "
|
|
229
|
+
pin: "pin",
|
|
224
230
|
password_confirmation: "password",
|
|
225
231
|
message: "textarea",
|
|
226
232
|
description: "textarea",
|
|
@@ -451,12 +457,200 @@ var ve = /*#__PURE__*/ me(he, [["render", _e]]), ye = ["placeholder", "disabled"
|
|
|
451
457
|
}, null, -1)]]))], 2)], 2));
|
|
452
458
|
}
|
|
453
459
|
}), Ee = [
|
|
460
|
+
"value",
|
|
461
|
+
"type",
|
|
462
|
+
"disabled",
|
|
463
|
+
"onInput",
|
|
464
|
+
"onKeydown"
|
|
465
|
+
], De = /*@__PURE__*/ Object.assign({ inheritAttrs: !1 }, {
|
|
466
|
+
__name: "PinInput",
|
|
467
|
+
props: {
|
|
468
|
+
modelValue: [String, Number],
|
|
469
|
+
length: {
|
|
470
|
+
type: [Number, String],
|
|
471
|
+
default: 4
|
|
472
|
+
},
|
|
473
|
+
secret: Boolean,
|
|
474
|
+
isInvalid: Boolean,
|
|
475
|
+
disabled: Boolean
|
|
476
|
+
},
|
|
477
|
+
emits: [
|
|
478
|
+
"update:modelValue",
|
|
479
|
+
"clearValidationErrors",
|
|
480
|
+
"complete"
|
|
481
|
+
],
|
|
482
|
+
setup(e, { emit: t }) {
|
|
483
|
+
let n = e, r = t, i = q("inputs"), a = l(() => Math.max(1, parseInt(n.length) || 4)), s = O([]), c = O([]), u = (e) => {
|
|
484
|
+
let t = String(e ?? "").replace(/\D/g, "").slice(0, a.value).split("");
|
|
485
|
+
c.value = Array.from({ length: a.value }, (e, n) => t[n] ?? "");
|
|
486
|
+
};
|
|
487
|
+
u(n.modelValue), z(a, () => u(n.modelValue)), z(() => n.modelValue, (e) => {
|
|
488
|
+
e !== c.value.join("") && u(e);
|
|
489
|
+
});
|
|
490
|
+
let d = () => {
|
|
491
|
+
let e = c.value.join("");
|
|
492
|
+
r("update:modelValue", e), e.length === a.value && r("complete", e);
|
|
493
|
+
}, p = (e) => {
|
|
494
|
+
b(() => {
|
|
495
|
+
let t = s.value[e];
|
|
496
|
+
t?.focus(), t?.select();
|
|
497
|
+
});
|
|
498
|
+
}, m = (e, t) => {
|
|
499
|
+
r("clearValidationErrors");
|
|
500
|
+
let n = t.target.value.replace(/\D/g, "");
|
|
501
|
+
if (!n) {
|
|
502
|
+
c.value[e] = "", d();
|
|
503
|
+
return;
|
|
504
|
+
}
|
|
505
|
+
let i = n.split(""), o = e;
|
|
506
|
+
for (let e of i) {
|
|
507
|
+
if (o >= a.value) break;
|
|
508
|
+
c.value[o] = e, o++;
|
|
509
|
+
}
|
|
510
|
+
d(), p(Math.min(o, a.value - 1));
|
|
511
|
+
}, h = (e, t) => {
|
|
512
|
+
t.key === "Backspace" ? (t.preventDefault(), c.value[e] ? c.value[e] = "" : e > 0 && (c.value[e - 1] = "", p(e - 1)), d()) : t.key === "ArrowLeft" && e > 0 ? p(e - 1) : t.key === "ArrowRight" && e < a.value - 1 && p(e + 1);
|
|
513
|
+
}, g = (e) => {
|
|
514
|
+
e.preventDefault();
|
|
515
|
+
let t = (e.clipboardData?.getData("text") ?? "").replace(/\D/g, "").slice(0, a.value);
|
|
516
|
+
u(t), d(), p(Math.min(t.length, a.value - 1));
|
|
517
|
+
}, _ = (e) => n.isInvalid ? i.value.pin.boxInvalid : c.value[e] ? i.value.pin.boxFilled : i.value.pin.box;
|
|
518
|
+
return (t, n) => (E(), f("div", { class: x(N(i).pin.wrapper) }, [(E(!0), f(o, null, k(c.value, (t, i) => (E(), f("input", {
|
|
519
|
+
key: i,
|
|
520
|
+
ref_for: !0,
|
|
521
|
+
ref: (e) => s.value[i] = e,
|
|
522
|
+
value: t,
|
|
523
|
+
type: e.secret ? "password" : "text",
|
|
524
|
+
inputmode: "numeric",
|
|
525
|
+
autocomplete: "one-time-code",
|
|
526
|
+
maxlength: "1",
|
|
527
|
+
disabled: e.disabled,
|
|
528
|
+
class: x(_(i)),
|
|
529
|
+
onInput: (e) => m(i, e),
|
|
530
|
+
onKeydown: (e) => h(i, e),
|
|
531
|
+
onPaste: g,
|
|
532
|
+
onFocus: n[0] ||= (e) => {
|
|
533
|
+
e.target.select(), r("clearValidationErrors");
|
|
534
|
+
}
|
|
535
|
+
}, null, 42, Ee))), 128))], 2));
|
|
536
|
+
}
|
|
537
|
+
}), Oe = {
|
|
538
|
+
"#": /[0-9]/,
|
|
539
|
+
A: /[a-zA-Z]/,
|
|
540
|
+
N: /[a-zA-Z0-9]/,
|
|
541
|
+
"*": /[a-zA-Z0-9]/
|
|
542
|
+
}, ke = [
|
|
543
|
+
"money",
|
|
544
|
+
"integer",
|
|
545
|
+
"number",
|
|
546
|
+
"decimal"
|
|
547
|
+
];
|
|
548
|
+
function Ae(e) {
|
|
549
|
+
return typeof e == "string" && ke.includes(e);
|
|
550
|
+
}
|
|
551
|
+
function je(e, t, { unmask: n = !1 } = {}) {
|
|
552
|
+
let r = String(e ?? "").split(""), i = "", a = "", o = 0;
|
|
553
|
+
for (let e = 0; e < t.length; e++) {
|
|
554
|
+
let n = Oe[t[e]];
|
|
555
|
+
if (n) {
|
|
556
|
+
for (; o < r.length && !n.test(r[o]);) o++;
|
|
557
|
+
if (o >= r.length) break;
|
|
558
|
+
i += r[o], a += r[o], o++;
|
|
559
|
+
} else o < r.length && (i += t[e]);
|
|
560
|
+
}
|
|
561
|
+
return {
|
|
562
|
+
display: i,
|
|
563
|
+
model: n ? a : i
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
function Me(e, { decimals: t = 2, prefix: n = "", suffix: r = "", integer: i = !1 } = {}) {
|
|
567
|
+
let a = String(e ?? "").replace(/[^0-9.]/g, ""), o = a.indexOf(".");
|
|
568
|
+
o !== -1 && (a = a.slice(0, o + 1) + a.slice(o + 1).replace(/\./g, "")), i && (a = a.split(".")[0]);
|
|
569
|
+
let [s = "", c] = a.split(".");
|
|
570
|
+
s = s.replace(/^0+(?=\d)/, "");
|
|
571
|
+
let l = s.replace(/\B(?=(\d{3})+(?!\d))/g, ","), u = a.includes(".") && !i, d = l, f = s;
|
|
572
|
+
return u && (c = (c ?? "").slice(0, t), d = (l || "0") + "." + c, f = (s || "0") + "." + c), d &&= n + d + r, {
|
|
573
|
+
display: d,
|
|
574
|
+
model: f
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
function Ne(e, t) {
|
|
578
|
+
if (typeof t == "function") {
|
|
579
|
+
let n = t(e) ?? "";
|
|
580
|
+
return {
|
|
581
|
+
display: String(n),
|
|
582
|
+
model: String(n)
|
|
583
|
+
};
|
|
584
|
+
}
|
|
585
|
+
return t && typeof t == "object" ? t.pattern ? je(e, t.pattern, t) : Me(e, t) : Ae(t) ? Me(e, {
|
|
586
|
+
integer: t === "integer" || t === "number",
|
|
587
|
+
decimals: t === "integer" || t === "number" ? 0 : 2
|
|
588
|
+
}) : je(e, String(t));
|
|
589
|
+
}
|
|
590
|
+
function Pe(e) {
|
|
591
|
+
if (Ae(e) || e && typeof e == "object" && !e.pattern) return "decimal";
|
|
592
|
+
let t = typeof e == "string" ? e : e && e.pattern;
|
|
593
|
+
return typeof t == "string" && /^[#\s().+-]*$/.test(t) ? "numeric" : "text";
|
|
594
|
+
}
|
|
595
|
+
//#endregion
|
|
596
|
+
//#region src/components/form/inputs/MaskedInput.vue
|
|
597
|
+
var Fe = [
|
|
598
|
+
"value",
|
|
599
|
+
"inputmode",
|
|
600
|
+
"placeholder",
|
|
601
|
+
"disabled"
|
|
602
|
+
], Ie = {
|
|
603
|
+
__name: "MaskedInput",
|
|
604
|
+
props: {
|
|
605
|
+
modelValue: [String, Number],
|
|
606
|
+
mask: {
|
|
607
|
+
type: [
|
|
608
|
+
String,
|
|
609
|
+
Object,
|
|
610
|
+
Function
|
|
611
|
+
],
|
|
612
|
+
required: !0
|
|
613
|
+
},
|
|
614
|
+
placeholder: String,
|
|
615
|
+
isInvalid: Boolean,
|
|
616
|
+
disabled: Boolean
|
|
617
|
+
},
|
|
618
|
+
emits: ["update:modelValue", "clearValidationErrors"],
|
|
619
|
+
setup(e, { emit: t }) {
|
|
620
|
+
let n = e, r = t, i = O(""), a = (e) => {
|
|
621
|
+
let { display: t } = Ne(e, n.mask);
|
|
622
|
+
t !== i.value && (i.value = t);
|
|
623
|
+
};
|
|
624
|
+
z(() => n.modelValue, a, { immediate: !0 }), z(() => n.mask, () => a(n.modelValue));
|
|
625
|
+
let o = (e) => {
|
|
626
|
+
r("clearValidationErrors");
|
|
627
|
+
let t = e.target, a = t.selectionStart ?? t.value.length, o = t.value.length, { display: s, model: c } = Ne(t.value, n.mask);
|
|
628
|
+
i.value = s, r("update:modelValue", c), b(() => {
|
|
629
|
+
if (t.type !== "text" && t.type !== "tel") return;
|
|
630
|
+
let e = a + (s.length - o);
|
|
631
|
+
e = Math.max(0, Math.min(e, s.length));
|
|
632
|
+
try {
|
|
633
|
+
t.setSelectionRange(e, e);
|
|
634
|
+
} catch {}
|
|
635
|
+
});
|
|
636
|
+
};
|
|
637
|
+
return (t, n) => (E(), f("input", {
|
|
638
|
+
value: i.value,
|
|
639
|
+
type: "text",
|
|
640
|
+
inputmode: N(Pe)(e.mask),
|
|
641
|
+
placeholder: e.placeholder,
|
|
642
|
+
disabled: e.disabled,
|
|
643
|
+
onInput: o,
|
|
644
|
+
onFocus: n[0] ||= (e) => r("clearValidationErrors")
|
|
645
|
+
}, null, 40, Fe));
|
|
646
|
+
}
|
|
647
|
+
}, Le = [
|
|
454
648
|
"min",
|
|
455
649
|
"max",
|
|
456
650
|
"step",
|
|
457
651
|
"placeholder",
|
|
458
652
|
"disabled"
|
|
459
|
-
],
|
|
653
|
+
], Re = {
|
|
460
654
|
__name: "NumberInput",
|
|
461
655
|
props: {
|
|
462
656
|
modelValue: [String, Number],
|
|
@@ -482,14 +676,14 @@ var ve = /*#__PURE__*/ me(he, [["render", _e]]), ye = ["placeholder", "disabled"
|
|
|
482
676
|
placeholder: e.placeholder,
|
|
483
677
|
disabled: e.disabled,
|
|
484
678
|
onFocus: n[1] ||= (e) => r("clearValidationErrors")
|
|
485
|
-
}, null, 40,
|
|
679
|
+
}, null, 40, Le)), [[L, i.value]]);
|
|
486
680
|
}
|
|
487
|
-
},
|
|
681
|
+
}, ze = [
|
|
488
682
|
"type",
|
|
489
683
|
"min",
|
|
490
684
|
"max",
|
|
491
685
|
"disabled"
|
|
492
|
-
],
|
|
686
|
+
], Be = {
|
|
493
687
|
__name: "DateInput",
|
|
494
688
|
props: {
|
|
495
689
|
modelValue: String,
|
|
@@ -512,12 +706,12 @@ var ve = /*#__PURE__*/ me(he, [["render", _e]]), ye = ["placeholder", "disabled"
|
|
|
512
706
|
max: e.max,
|
|
513
707
|
disabled: e.disabled,
|
|
514
708
|
onFocus: n[1] ||= (e) => r("clearValidationErrors")
|
|
515
|
-
}, null, 40,
|
|
709
|
+
}, null, 40, ze)), [[F, i.value]]);
|
|
516
710
|
}
|
|
517
711
|
};
|
|
518
712
|
//#endregion
|
|
519
713
|
//#region src/utils/normalizeOptions.js
|
|
520
|
-
function
|
|
714
|
+
function Ve(e) {
|
|
521
715
|
return Array.isArray(e) ? e.map((e) => {
|
|
522
716
|
if (e == null) return null;
|
|
523
717
|
if (typeof e != "object") return {
|
|
@@ -534,10 +728,10 @@ function Ae(e) {
|
|
|
534
728
|
}
|
|
535
729
|
//#endregion
|
|
536
730
|
//#region src/components/form/inputs/SelectInput.vue
|
|
537
|
-
var
|
|
731
|
+
var He = ["disabled"], Ue = {
|
|
538
732
|
value: null,
|
|
539
733
|
disabled: ""
|
|
540
|
-
},
|
|
734
|
+
}, We = ["value"], Ge = {
|
|
541
735
|
__name: "SelectInput",
|
|
542
736
|
props: {
|
|
543
737
|
modelValue: [String, Number],
|
|
@@ -549,7 +743,7 @@ var je = ["disabled"], Me = {
|
|
|
549
743
|
},
|
|
550
744
|
emits: ["update:modelValue", "clearValidationErrors"],
|
|
551
745
|
setup(e, { emit: t }) {
|
|
552
|
-
let r = e, i = t, a = O([]), s = O(!1), c = l(() =>
|
|
746
|
+
let r = e, i = t, a = O([]), s = O(!1), c = l(() => Ve(r.options ?? a.value)), u = l({
|
|
553
747
|
get: () => r.modelValue,
|
|
554
748
|
set: (e) => i("update:modelValue", e)
|
|
555
749
|
});
|
|
@@ -563,12 +757,12 @@ var je = ["disabled"], Me = {
|
|
|
563
757
|
"onUpdate:modelValue": n[0] ||= (e) => u.value = e,
|
|
564
758
|
disabled: e.disabled || s.value,
|
|
565
759
|
onFocus: n[1] ||= (e) => i("clearValidationErrors")
|
|
566
|
-
}, [p("option",
|
|
760
|
+
}, [p("option", Ue, M(s.value ? "Loading..." : e.placeholder || "Select..."), 1), (E(!0), f(o, null, k(c.value, (e) => (E(), f("option", {
|
|
567
761
|
key: e.id,
|
|
568
762
|
value: e.id
|
|
569
|
-
}, M(e.label), 9,
|
|
763
|
+
}, M(e.label), 9, We))), 128))], 40, He)), [[I, u.value]]);
|
|
570
764
|
}
|
|
571
|
-
},
|
|
765
|
+
}, Ke = [
|
|
572
766
|
{
|
|
573
767
|
name: "Afghanistan",
|
|
574
768
|
dialCode: "+93",
|
|
@@ -2039,11 +2233,11 @@ var je = ["disabled"], Me = {
|
|
|
2039
2233
|
isoCode: "ZW",
|
|
2040
2234
|
flag: "https://www.countryflags.io/ZW/flat/64.png"
|
|
2041
2235
|
}
|
|
2042
|
-
],
|
|
2236
|
+
], qe = ["disabled", "aria-expanded"], Je = ["placeholder", "disabled"], Ye = [
|
|
2043
2237
|
"aria-selected",
|
|
2044
2238
|
"onPointerdown",
|
|
2045
2239
|
"onMouseenter"
|
|
2046
|
-
],
|
|
2240
|
+
], Xe = /*@__PURE__*/ Object.assign({ inheritAttrs: !1 }, {
|
|
2047
2241
|
__name: "PhoneInput",
|
|
2048
2242
|
props: {
|
|
2049
2243
|
modelValue: String,
|
|
@@ -2061,9 +2255,9 @@ var je = ["disabled"], Me = {
|
|
|
2061
2255
|
},
|
|
2062
2256
|
emits: ["update:modelValue", "clearValidationErrors"],
|
|
2063
2257
|
setup(e, { emit: t }) {
|
|
2064
|
-
let r = e, i = t, a = q("inputs"), s = O(null), c = O(null), u = O(""), m = O(!1), h = O(""), g = O(-1), _ = O(
|
|
2258
|
+
let r = e, i = t, a = q("inputs"), s = O(null), c = O(null), u = O(""), m = O(!1), h = O(""), g = O(-1), _ = O(Ke.find((e) => e.isoCode === r.countryCode.toUpperCase()) ?? Ke[0]), v = (e) => String(e ?? "").toUpperCase().split("").map((e) => String.fromCodePoint(127462 + e.charCodeAt(0) - 65)).join(""), y = l(() => {
|
|
2065
2259
|
let e = h.value.trim().toLowerCase();
|
|
2066
|
-
return e ?
|
|
2260
|
+
return e ? Ke.filter((t) => t.name.toLowerCase().includes(e) || t.dialCode.includes(e) || t.isoCode.toLowerCase().includes(e)) : Ke;
|
|
2067
2261
|
}), S = async () => {
|
|
2068
2262
|
r.disabled || (m.value = !m.value, m.value && (h.value = "", g.value = -1, await b(), c.value?.focus()));
|
|
2069
2263
|
}, T = (e) => {
|
|
@@ -2084,7 +2278,7 @@ var je = ["disabled"], Me = {
|
|
|
2084
2278
|
u.value = "";
|
|
2085
2279
|
return;
|
|
2086
2280
|
}
|
|
2087
|
-
let t =
|
|
2281
|
+
let t = Ke.find((t) => e.startsWith(t.dialCode));
|
|
2088
2282
|
t ? (_.value = t, u.value = e.replace(t.dialCode, "")) : u.value = e;
|
|
2089
2283
|
};
|
|
2090
2284
|
z(() => r.modelValue, A);
|
|
@@ -2093,7 +2287,7 @@ var je = ["disabled"], Me = {
|
|
|
2093
2287
|
};
|
|
2094
2288
|
return w(() => {
|
|
2095
2289
|
document.addEventListener("pointerdown", j), A(r.modelValue), r.detectCountry && !r.modelValue && n.doGet("sh-country-code").then((e) => {
|
|
2096
|
-
let t = e.data?.countryCode, n = t &&
|
|
2290
|
+
let t = e.data?.countryCode, n = t && Ke.find((e) => e.isoCode === t.toUpperCase());
|
|
2097
2291
|
n && (_.value = n);
|
|
2098
2292
|
}).catch(() => {});
|
|
2099
2293
|
}), C(() => {
|
|
@@ -2125,7 +2319,7 @@ var je = ["disabled"], Me = {
|
|
|
2125
2319
|
"stroke-linejoin": "round",
|
|
2126
2320
|
d: "M19.5 8.25l-7.5 7.5-7.5-7.5"
|
|
2127
2321
|
}, null, -1)]], 2))
|
|
2128
|
-
], 10,
|
|
2322
|
+
], 10, qe),
|
|
2129
2323
|
V(p("input", {
|
|
2130
2324
|
"onUpdate:modelValue": n[0] ||= (e) => u.value = e,
|
|
2131
2325
|
type: "tel",
|
|
@@ -2134,7 +2328,7 @@ var je = ["disabled"], Me = {
|
|
|
2134
2328
|
disabled: e.disabled,
|
|
2135
2329
|
onInput: ee,
|
|
2136
2330
|
onFocus: n[1] ||= (e) => i("clearValidationErrors")
|
|
2137
|
-
}, null, 42,
|
|
2331
|
+
}, null, 42, Je), [[L, u.value]]),
|
|
2138
2332
|
m.value ? (E(), f("div", {
|
|
2139
2333
|
key: 0,
|
|
2140
2334
|
class: x(N(a).phone.dropdown)
|
|
@@ -2162,13 +2356,13 @@ var je = ["disabled"], Me = {
|
|
|
2162
2356
|
p("span", { class: x(N(a).phone.flag) }, M(v(e.isoCode)), 3),
|
|
2163
2357
|
p("span", { class: x(N(a).phone.optionName) }, M(e.name), 3),
|
|
2164
2358
|
p("span", { class: x(N(a).phone.optionDial) }, M(e.dialCode), 3)
|
|
2165
|
-
], 42,
|
|
2359
|
+
], 42, Ye))), 128)), y.value.length ? d("", !0) : (E(), f("p", {
|
|
2166
2360
|
key: 0,
|
|
2167
2361
|
class: x(N(a).phone.empty)
|
|
2168
2362
|
}, "No country matches \"" + M(h.value) + "\"", 3))], 2)], 2)) : d("", !0)
|
|
2169
2363
|
], 2));
|
|
2170
2364
|
}
|
|
2171
|
-
}),
|
|
2365
|
+
}), Ze = ["onClick"], Qe = ["placeholder", "disabled"], $e = ["onPointerdown", "onMouseenter"], et = /*@__PURE__*/ Object.assign({ inheritAttrs: !1 }, {
|
|
2172
2366
|
__name: "ShSuggest",
|
|
2173
2367
|
props: {
|
|
2174
2368
|
modelValue: [
|
|
@@ -2191,7 +2385,7 @@ var je = ["disabled"], Me = {
|
|
|
2191
2385
|
emits: ["update:modelValue", "clearValidationErrors"],
|
|
2192
2386
|
setup(e, { emit: t }) {
|
|
2193
2387
|
let r = e, i = t, a = q("inputs"), s = O(null), c = O(""), m = O(!1), g = O(!1), _ = O(-1), v = O([]), b = O([]), S = l(() => {
|
|
2194
|
-
let e =
|
|
2388
|
+
let e = Ve(r.options ?? v.value), t = new Set(b.value.map((e) => e.id)), n = e.filter((e) => !t.has(e.id));
|
|
2195
2389
|
if (r.options && c.value) {
|
|
2196
2390
|
let e = c.value.toLowerCase();
|
|
2197
2391
|
n = n.filter((t) => t.label.toLowerCase().includes(e));
|
|
@@ -2226,7 +2420,7 @@ var je = ["disabled"], Me = {
|
|
|
2226
2420
|
}, B = () => {
|
|
2227
2421
|
let e = r.modelValue;
|
|
2228
2422
|
if (e == null || e === "") return;
|
|
2229
|
-
let t = Array.isArray(e) ? e : [e], n =
|
|
2423
|
+
let t = Array.isArray(e) ? e : [e], n = Ve(r.options ?? v.value);
|
|
2230
2424
|
b.value = t.map((e) => n.find((t) => t.id === e) ?? {
|
|
2231
2425
|
id: e,
|
|
2232
2426
|
label: String(e)
|
|
@@ -2252,7 +2446,7 @@ var je = ["disabled"], Me = {
|
|
|
2252
2446
|
}, [h(M(e.label) + " ", 1), p("span", {
|
|
2253
2447
|
class: x(N(a).suggest.badgeRemove),
|
|
2254
2448
|
onClick: (t) => P(e)
|
|
2255
|
-
}, "×", 10,
|
|
2449
|
+
}, "×", 10, Ze)], 2))), 128))], 2)) : d("", !0),
|
|
2256
2450
|
V(p("input", y(t.$attrs, {
|
|
2257
2451
|
"onUpdate:modelValue": n[0] ||= (e) => c.value = e,
|
|
2258
2452
|
type: "text",
|
|
@@ -2264,7 +2458,7 @@ var je = ["disabled"], Me = {
|
|
|
2264
2458
|
onFocus: n[1] ||= (e) => {
|
|
2265
2459
|
m.value = !0, i("clearValidationErrors");
|
|
2266
2460
|
}
|
|
2267
|
-
}), null, 16,
|
|
2461
|
+
}), null, 16, Qe), [[L, c.value]]),
|
|
2268
2462
|
m.value && !e.disabled ? (E(), f("div", {
|
|
2269
2463
|
key: 1,
|
|
2270
2464
|
class: x(N(a).suggest.dropdown)
|
|
@@ -2279,7 +2473,7 @@ var je = ["disabled"], Me = {
|
|
|
2279
2473
|
}, [e.optionTemplate ? (E(), u(j(e.optionTemplate), {
|
|
2280
2474
|
key: 0,
|
|
2281
2475
|
option: t.raw ?? t
|
|
2282
|
-
}, null, 8, ["option"])) : (E(), f(o, { key: 1 }, [h(M(t.label), 1)], 64))], 42,
|
|
2476
|
+
}, null, 8, ["option"])) : (E(), f(o, { key: 1 }, [h(M(t.label), 1)], 64))], 42, $e))), 128)) : e.allowCustom && c.value ? (E(), f("div", {
|
|
2283
2477
|
key: 2,
|
|
2284
2478
|
class: x(N(a).suggest.option),
|
|
2285
2479
|
onPointerdown: H(F, ["prevent"])
|
|
@@ -2289,7 +2483,7 @@ var je = ["disabled"], Me = {
|
|
|
2289
2483
|
}, "No matches", 2))], 2)) : d("", !0)
|
|
2290
2484
|
], 2));
|
|
2291
2485
|
}
|
|
2292
|
-
}),
|
|
2486
|
+
}), tt = ["onUpdate:modelValue"], nt = ["innerHTML"], rt = ["disabled"], it = {
|
|
2293
2487
|
__name: "ShForm",
|
|
2294
2488
|
props: {
|
|
2295
2489
|
action: {
|
|
@@ -2334,11 +2528,12 @@ var je = ["disabled"], Me = {
|
|
|
2334
2528
|
textarea: xe,
|
|
2335
2529
|
email: Se,
|
|
2336
2530
|
password: Te,
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2531
|
+
pin: De,
|
|
2532
|
+
number: Re,
|
|
2533
|
+
date: Be,
|
|
2534
|
+
select: Ge,
|
|
2535
|
+
phone: Xe,
|
|
2536
|
+
suggest: et
|
|
2342
2537
|
}, b = O([]), S = ee({}), C = O(!1), w = O(0), T = O(!1), D = () => {
|
|
2343
2538
|
let e = de(i.fields, i.currentData);
|
|
2344
2539
|
i.hiddenId && i.currentData?.id && !e.some((e) => e.name === "id") && e.push({
|
|
@@ -2356,7 +2551,7 @@ var je = ["disabled"], Me = {
|
|
|
2356
2551
|
})) : [{
|
|
2357
2552
|
title: "",
|
|
2358
2553
|
fields: b.value
|
|
2359
|
-
}]), F = l(() => w.value >= P.value.length - 1), I = (e) => e.component ?? m[e.type] ?? _[e.type] ?? _.text, B = (e) => S[e.name] ? s.value.inputInvalid : e.type === "select" ? c.value.select : s.value.input, U = (e) => ({
|
|
2554
|
+
}]), F = l(() => w.value >= P.value.length - 1), I = (e) => e.mask && e.type !== "pin" ? Ie : e.component ?? m[e.type] ?? _[e.type] ?? _.text, B = (e) => S[e.name] ? s.value.inputInvalid : e.type === "select" ? c.value.select : s.value.input, U = (e) => ({
|
|
2360
2555
|
placeholder: e.placeholder || void 0,
|
|
2361
2556
|
disabled: i.disabled || e.disabled,
|
|
2362
2557
|
...e.type === "select" || e.type === "suggest" ? {
|
|
@@ -2381,6 +2576,11 @@ var je = ["disabled"], Me = {
|
|
|
2381
2576
|
countryCode: e.countryCode,
|
|
2382
2577
|
detectCountry: e.detectCountry
|
|
2383
2578
|
} : {},
|
|
2579
|
+
...e.type === "pin" ? {
|
|
2580
|
+
length: e.length ?? e.digits,
|
|
2581
|
+
secret: e.secret
|
|
2582
|
+
} : {},
|
|
2583
|
+
...e.mask && e.type !== "pin" ? { mask: e.mask } : {},
|
|
2384
2584
|
...e.props ?? {}
|
|
2385
2585
|
}), W = (e, t) => {
|
|
2386
2586
|
T.value = !0, delete S[e.name];
|
|
@@ -2455,7 +2655,7 @@ var je = ["disabled"], Me = {
|
|
|
2455
2655
|
key: 0,
|
|
2456
2656
|
"onUpdate:modelValue": (t) => e.value = t,
|
|
2457
2657
|
type: "hidden"
|
|
2458
|
-
}, null, 8,
|
|
2658
|
+
}, null, 8, tt)), [[L, e.value]]) : (E(), f(o, { key: 1 }, [
|
|
2459
2659
|
e.label ? (E(), f("label", {
|
|
2460
2660
|
key: 0,
|
|
2461
2661
|
class: x(N(s).label)
|
|
@@ -2482,7 +2682,7 @@ var je = ["disabled"], Me = {
|
|
|
2482
2682
|
key: 1,
|
|
2483
2683
|
class: x(N(s).helper),
|
|
2484
2684
|
innerHTML: e.helper
|
|
2485
|
-
}, null, 10,
|
|
2685
|
+
}, null, 10, nt)) : d("", !0),
|
|
2486
2686
|
S[e.name] ? (E(), f("p", {
|
|
2487
2687
|
key: 2,
|
|
2488
2688
|
class: x(N(s).error)
|
|
@@ -2501,10 +2701,10 @@ var je = ["disabled"], Me = {
|
|
|
2501
2701
|
}, [C.value ? (E(), u(ve, {
|
|
2502
2702
|
key: 0,
|
|
2503
2703
|
class: "size-4"
|
|
2504
|
-
})) : d("", !0), h(" " + M(F.value ? e.submitLabel : "Next"), 1)], 10,
|
|
2704
|
+
})) : d("", !0), h(" " + M(F.value ? e.submitLabel : "Next"), 1)], 10, rt)], 2)
|
|
2505
2705
|
], 34));
|
|
2506
2706
|
}
|
|
2507
|
-
},
|
|
2707
|
+
}, at = {
|
|
2508
2708
|
__name: "ShDialog",
|
|
2509
2709
|
props: {
|
|
2510
2710
|
open: Boolean,
|
|
@@ -2635,7 +2835,7 @@ var je = ["disabled"], Me = {
|
|
|
2635
2835
|
_: 3
|
|
2636
2836
|
})], 4)) : d("", !0)]));
|
|
2637
2837
|
}
|
|
2638
|
-
},
|
|
2838
|
+
}, ot = {
|
|
2639
2839
|
__name: "ShDrawer",
|
|
2640
2840
|
props: {
|
|
2641
2841
|
open: Boolean,
|
|
@@ -2761,7 +2961,7 @@ var je = ["disabled"], Me = {
|
|
|
2761
2961
|
_: 3
|
|
2762
2962
|
}, 8, ["enter-from-class", "leave-to-class"])], 4)) : d("", !0)]));
|
|
2763
2963
|
}
|
|
2764
|
-
},
|
|
2964
|
+
}, st = {
|
|
2765
2965
|
__name: "ShDialogBtn",
|
|
2766
2966
|
props: {
|
|
2767
2967
|
title: String,
|
|
@@ -2781,7 +2981,7 @@ var je = ["disabled"], Me = {
|
|
|
2781
2981
|
type: "button",
|
|
2782
2982
|
class: x(e.btnClass ?? N(t).secondary),
|
|
2783
2983
|
onClick: i[0] ||= (e) => n.value = !0
|
|
2784
|
-
}, [A(r.$slots, "trigger", {}, () => [i[4] ||= h("Open", -1)])], 2), g(
|
|
2984
|
+
}, [A(r.$slots, "trigger", {}, () => [i[4] ||= h("Open", -1)])], 2), g(at, {
|
|
2785
2985
|
open: n.value,
|
|
2786
2986
|
"onUpdate:open": i[1] ||= (e) => n.value = e,
|
|
2787
2987
|
title: e.title,
|
|
@@ -2807,7 +3007,7 @@ var je = ["disabled"], Me = {
|
|
|
2807
3007
|
"classes"
|
|
2808
3008
|
])], 64));
|
|
2809
3009
|
}
|
|
2810
|
-
},
|
|
3010
|
+
}, ct = {
|
|
2811
3011
|
__name: "ShDrawerBtn",
|
|
2812
3012
|
props: {
|
|
2813
3013
|
title: String,
|
|
@@ -2831,7 +3031,7 @@ var je = ["disabled"], Me = {
|
|
|
2831
3031
|
type: "button",
|
|
2832
3032
|
class: x(e.btnClass ?? N(t).secondary),
|
|
2833
3033
|
onClick: i[0] ||= (e) => n.value = !0
|
|
2834
|
-
}, [A(r.$slots, "trigger", {}, () => [i[4] ||= h("Open", -1)])], 2), g(
|
|
3034
|
+
}, [A(r.$slots, "trigger", {}, () => [i[4] ||= h("Open", -1)])], 2), g(ot, {
|
|
2835
3035
|
open: n.value,
|
|
2836
3036
|
"onUpdate:open": i[1] ||= (e) => n.value = e,
|
|
2837
3037
|
title: e.title,
|
|
@@ -2855,7 +3055,7 @@ var je = ["disabled"], Me = {
|
|
|
2855
3055
|
"classes"
|
|
2856
3056
|
])], 64));
|
|
2857
3057
|
}
|
|
2858
|
-
},
|
|
3058
|
+
}, lt = {
|
|
2859
3059
|
__name: "ShDialogForm",
|
|
2860
3060
|
props: {
|
|
2861
3061
|
title: String,
|
|
@@ -2916,7 +3116,7 @@ var je = ["disabled"], Me = {
|
|
|
2916
3116
|
type: "button",
|
|
2917
3117
|
class: x(e.btnClass ?? N(a).primary),
|
|
2918
3118
|
onClick: n[0] ||= (e) => s.value = !0
|
|
2919
|
-
}, [A(t.$slots, "trigger", {}, () => [h(M(e.title ?? "Open form"), 1)])], 2), g(
|
|
3119
|
+
}, [A(t.$slots, "trigger", {}, () => [h(M(e.title ?? "Open form"), 1)])], 2), g(at, {
|
|
2920
3120
|
open: s.value,
|
|
2921
3121
|
"onUpdate:open": n[3] ||= (e) => s.value = e,
|
|
2922
3122
|
title: e.title,
|
|
@@ -2927,7 +3127,7 @@ var je = ["disabled"], Me = {
|
|
|
2927
3127
|
onOpened: n[4] ||= (e) => t.$emit("opened"),
|
|
2928
3128
|
onClosed: n[5] ||= (e) => t.$emit("closed")
|
|
2929
3129
|
}, {
|
|
2930
|
-
default: B(() => [(E(), u(
|
|
3130
|
+
default: B(() => [(E(), u(it, {
|
|
2931
3131
|
key: c.value,
|
|
2932
3132
|
action: e.action,
|
|
2933
3133
|
method: e.method,
|
|
@@ -2969,17 +3169,17 @@ var je = ["disabled"], Me = {
|
|
|
2969
3169
|
"classes"
|
|
2970
3170
|
])], 64));
|
|
2971
3171
|
}
|
|
2972
|
-
},
|
|
2973
|
-
function
|
|
2974
|
-
return
|
|
2975
|
-
let n = indexedDB.open(
|
|
3172
|
+
}, ut = "sh_tw_table_cache", dt = "pages", ft = "rows", pt = 1, mt = 3e3, ht = null;
|
|
3173
|
+
function gt() {
|
|
3174
|
+
return ht || (ht = new Promise((e, t) => {
|
|
3175
|
+
let n = indexedDB.open(ut, pt);
|
|
2976
3176
|
n.onupgradeneeded = (e) => {
|
|
2977
3177
|
let t = e.target.result;
|
|
2978
|
-
t.objectStoreNames.contains(
|
|
3178
|
+
t.objectStoreNames.contains(dt) || t.createObjectStore(dt), t.objectStoreNames.contains(ft) || t.createObjectStore(ft);
|
|
2979
3179
|
}, n.onsuccess = (t) => e(t.target.result), n.onerror = (e) => t(e.target.error);
|
|
2980
|
-
}),
|
|
3180
|
+
}), ht);
|
|
2981
3181
|
}
|
|
2982
|
-
function
|
|
3182
|
+
function _t() {
|
|
2983
3183
|
try {
|
|
2984
3184
|
let e = i.getItem("user");
|
|
2985
3185
|
return e?.id ? `u${e.id}_` : "";
|
|
@@ -2987,71 +3187,71 @@ function ot() {
|
|
|
2987
3187
|
return "";
|
|
2988
3188
|
}
|
|
2989
3189
|
}
|
|
2990
|
-
function
|
|
2991
|
-
return
|
|
3190
|
+
function vt(e, t, n) {
|
|
3191
|
+
return gt().then((r) => new Promise((i, a) => {
|
|
2992
3192
|
let o = n(r.transaction(e, t).objectStore(e));
|
|
2993
3193
|
o.onsuccess = () => i(o.result), o.onerror = () => a(o.error);
|
|
2994
3194
|
})).catch((e) => {
|
|
2995
3195
|
console.error("[sh-tailwind] table cache error", e);
|
|
2996
3196
|
});
|
|
2997
3197
|
}
|
|
2998
|
-
async function
|
|
2999
|
-
return (await
|
|
3198
|
+
async function yt(e) {
|
|
3199
|
+
return (await vt(dt, "readonly", (t) => t.get(_t() + e)))?.response ?? null;
|
|
3000
3200
|
}
|
|
3001
|
-
function
|
|
3002
|
-
return
|
|
3201
|
+
function bt(e, t) {
|
|
3202
|
+
return vt(dt, "readwrite", (n) => n.put({
|
|
3003
3203
|
response: t,
|
|
3004
3204
|
timestamp: Date.now()
|
|
3005
|
-
},
|
|
3205
|
+
}, _t() + e));
|
|
3006
3206
|
}
|
|
3007
|
-
async function
|
|
3008
|
-
return (await
|
|
3207
|
+
async function xt(e) {
|
|
3208
|
+
return (await vt(ft, "readonly", (t) => t.get(_t() + e)))?.rows ?? [];
|
|
3009
3209
|
}
|
|
3010
|
-
async function
|
|
3210
|
+
async function St(e, t) {
|
|
3011
3211
|
if (!Array.isArray(t) || !t.length) return;
|
|
3012
|
-
let n = await
|
|
3212
|
+
let n = await xt(e), r = /* @__PURE__ */ new Map();
|
|
3013
3213
|
n.forEach((e) => {
|
|
3014
3214
|
e && e.id !== void 0 && r.set(e.id, e);
|
|
3015
3215
|
}), t.forEach((e) => {
|
|
3016
3216
|
e && e.id !== void 0 && r.set(e.id, e);
|
|
3017
3217
|
});
|
|
3018
3218
|
let i = [...r.values()];
|
|
3019
|
-
return i.length >
|
|
3219
|
+
return i.length > mt && (i = i.slice(i.length - mt)), vt(ft, "readwrite", (t) => t.put({
|
|
3020
3220
|
rows: i,
|
|
3021
3221
|
timestamp: Date.now()
|
|
3022
|
-
},
|
|
3222
|
+
}, _t() + e));
|
|
3023
3223
|
}
|
|
3024
|
-
async function
|
|
3025
|
-
await
|
|
3224
|
+
async function Ct() {
|
|
3225
|
+
await vt(dt, "readwrite", (e) => e.clear()), await vt(ft, "readwrite", (e) => e.clear());
|
|
3026
3226
|
}
|
|
3027
|
-
var
|
|
3028
|
-
getPage:
|
|
3029
|
-
setPage:
|
|
3030
|
-
getRows:
|
|
3031
|
-
mergeRows:
|
|
3032
|
-
clear:
|
|
3227
|
+
var wt = {
|
|
3228
|
+
getPage: yt,
|
|
3229
|
+
setPage: bt,
|
|
3230
|
+
getRows: xt,
|
|
3231
|
+
mergeRows: St,
|
|
3232
|
+
clear: Ct
|
|
3033
3233
|
};
|
|
3034
3234
|
//#endregion
|
|
3035
3235
|
//#region src/table/localQuery.js
|
|
3036
|
-
function
|
|
3236
|
+
function Tt(e, t) {
|
|
3037
3237
|
return !e || !t || typeof t != "string" ? "" : t.split(".").reduce((e, t) => e ? e[t] : "", e);
|
|
3038
3238
|
}
|
|
3039
|
-
function
|
|
3239
|
+
function Et(e, t, n, r = 0) {
|
|
3040
3240
|
if (e == null) return !1;
|
|
3041
|
-
if (typeof e == "object") return r > 2 ? !1 : Object.values(e).some((e) =>
|
|
3241
|
+
if (typeof e == "object") return r > 2 ? !1 : Object.values(e).some((e) => Et(e, t, n, r + 1));
|
|
3042
3242
|
let i = String(e).toLowerCase();
|
|
3043
3243
|
return n ? i === t : i.includes(t);
|
|
3044
3244
|
}
|
|
3045
|
-
function
|
|
3245
|
+
function Dt(e, { search: t, exact: n, orderBy: r, orderMethod: i, page: a, perPage: o } = {}) {
|
|
3046
3246
|
let s = e;
|
|
3047
3247
|
if (t) {
|
|
3048
3248
|
let r = String(t).toLowerCase();
|
|
3049
|
-
s = e.filter((e) =>
|
|
3249
|
+
s = e.filter((e) => Et(e, r, !!n));
|
|
3050
3250
|
}
|
|
3051
3251
|
if (r) {
|
|
3052
3252
|
let e = i === "asc" ? 1 : -1;
|
|
3053
3253
|
s = [...s].sort((t, n) => {
|
|
3054
|
-
let i =
|
|
3254
|
+
let i = Tt(t, r), a = Tt(n, r);
|
|
3055
3255
|
return typeof i == "number" && typeof a == "number" ? (i - a) * e : String(i ?? "").localeCompare(String(a ?? ""), void 0, { numeric: !0 }) * e;
|
|
3056
3256
|
});
|
|
3057
3257
|
}
|
|
@@ -3067,7 +3267,7 @@ function gt(e, { search: t, exact: n, orderBy: r, orderMethod: i, page: a, perPa
|
|
|
3067
3267
|
}
|
|
3068
3268
|
//#endregion
|
|
3069
3269
|
//#region src/table/useTableData.js
|
|
3070
|
-
function
|
|
3270
|
+
function Ot({ query: e, cacheEnabled: t = () => !1, networkTimeout: r = () => 1e4 }) {
|
|
3071
3271
|
let i = O([]), a = O(null), o = O("loading"), s = O(""), c = O(!1), l = O(!1), u = 0, d = (e, t) => e + "|" + JSON.stringify(t), f = (e, { append: t = !1 } = {}) => {
|
|
3072
3272
|
t ? i.value.push(...e.data ?? []) : i.value = e.data ?? [], a.value = {
|
|
3073
3273
|
total: e.total ?? i.value.length,
|
|
@@ -3087,14 +3287,14 @@ function _t({ query: e, cacheEnabled: t = () => !1, networkTimeout: r = () => 1e
|
|
|
3087
3287
|
load: async ({ append: a = !1 } = {}) => {
|
|
3088
3288
|
let p = ++u, { endpoint: m, params: h } = e(), g = d(m, h), _ = !!t(), v = !1;
|
|
3089
3289
|
if (i.value.length || (o.value = "loading"), _ && !a) {
|
|
3090
|
-
let e = await
|
|
3290
|
+
let e = await wt.getPage(g);
|
|
3091
3291
|
e && p === u && (f(e), l.value = !0, v = !0);
|
|
3092
3292
|
}
|
|
3093
3293
|
try {
|
|
3094
3294
|
let e = await n.doGet(m, h, { timeout: r() });
|
|
3095
3295
|
if (p !== u) return;
|
|
3096
3296
|
let t = e.data?.data ?? e.data;
|
|
3097
|
-
return f(t, { append: a }), c.value = !1, l.value = !1, s.value = "", _ && (
|
|
3297
|
+
return f(t, { append: a }), c.value = !1, l.value = !1, s.value = "", _ && (wt.setPage(g, t), wt.mergeRows(m, t.data)), t;
|
|
3098
3298
|
} catch (e) {
|
|
3099
3299
|
if (p !== u) return;
|
|
3100
3300
|
if (e.response) {
|
|
@@ -3103,10 +3303,10 @@ function _t({ query: e, cacheEnabled: t = () => !1, networkTimeout: r = () => 1e
|
|
|
3103
3303
|
}
|
|
3104
3304
|
if (c.value = !0, v) return;
|
|
3105
3305
|
if (_) {
|
|
3106
|
-
let e = await
|
|
3306
|
+
let e = await wt.getRows(m);
|
|
3107
3307
|
if (p !== u) return;
|
|
3108
3308
|
if (e.length) {
|
|
3109
|
-
f(
|
|
3309
|
+
f(Dt(e, {
|
|
3110
3310
|
search: h.filter_value,
|
|
3111
3311
|
exact: h.exact,
|
|
3112
3312
|
orderBy: h.order_by,
|
|
@@ -3124,7 +3324,7 @@ function _t({ query: e, cacheEnabled: t = () => !1, networkTimeout: r = () => 1e
|
|
|
3124
3324
|
}
|
|
3125
3325
|
//#endregion
|
|
3126
3326
|
//#region src/components/table/ShTablePagination.vue
|
|
3127
|
-
var
|
|
3327
|
+
var kt = ["value"], At = ["value"], jt = ["disabled"], Mt = ["disabled"], Nt = ["onClick"], Pt = ["disabled"], Ft = {
|
|
3128
3328
|
__name: "ShTablePagination",
|
|
3129
3329
|
props: {
|
|
3130
3330
|
meta: {
|
|
@@ -3169,13 +3369,13 @@ var vt = ["value"], yt = ["value"], bt = ["disabled"], xt = ["disabled"], St = [
|
|
|
3169
3369
|
], (e) => p("option", {
|
|
3170
3370
|
key: e,
|
|
3171
3371
|
value: e
|
|
3172
|
-
}, M(e) + " / page", 9,
|
|
3372
|
+
}, M(e) + " / page", 9, At)), 64))], 42, kt)], 2), e.mode === "loadMore" ? (E(), f("button", {
|
|
3173
3373
|
key: 0,
|
|
3174
3374
|
type: "button",
|
|
3175
3375
|
class: x(e.theme.loadMore),
|
|
3176
3376
|
disabled: e.loading || e.meta.current_page >= e.meta.last_page,
|
|
3177
3377
|
onClick: n[1] ||= (e) => r("loadMore")
|
|
3178
|
-
}, M(e.meta.current_page >= e.meta.last_page ? "All loaded" : "Load more"), 11,
|
|
3378
|
+
}, M(e.meta.current_page >= e.meta.last_page ? "All loaded" : "Load more"), 11, jt)) : (E(), f("div", {
|
|
3179
3379
|
key: 1,
|
|
3180
3380
|
class: x(e.theme.pages)
|
|
3181
3381
|
}, [
|
|
@@ -3185,7 +3385,7 @@ var vt = ["value"], yt = ["value"], bt = ["disabled"], xt = ["disabled"], St = [
|
|
|
3185
3385
|
disabled: e.meta.current_page <= 1,
|
|
3186
3386
|
"aria-label": "Previous page",
|
|
3187
3387
|
onClick: n[2] ||= (t) => r("page", e.meta.current_page - 1)
|
|
3188
|
-
}, " ‹ ", 10,
|
|
3388
|
+
}, " ‹ ", 10, Mt),
|
|
3189
3389
|
(E(!0), f(o, null, k(a.value, (t, n) => (E(), f(o, { key: n }, [t === "..." ? (E(), f("span", {
|
|
3190
3390
|
key: 0,
|
|
3191
3391
|
class: x(e.theme.ellipsis)
|
|
@@ -3194,20 +3394,20 @@ var vt = ["value"], yt = ["value"], bt = ["disabled"], xt = ["disabled"], St = [
|
|
|
3194
3394
|
type: "button",
|
|
3195
3395
|
class: x(t === e.meta.current_page ? e.theme.pageBtnActive : e.theme.pageBtn),
|
|
3196
3396
|
onClick: (e) => r("page", t)
|
|
3197
|
-
}, M(t), 11,
|
|
3397
|
+
}, M(t), 11, Nt))], 64))), 128)),
|
|
3198
3398
|
p("button", {
|
|
3199
3399
|
type: "button",
|
|
3200
3400
|
class: x(e.theme.pageBtn),
|
|
3201
3401
|
disabled: e.meta.current_page >= e.meta.last_page,
|
|
3202
3402
|
"aria-label": "Next page",
|
|
3203
3403
|
onClick: n[3] ||= (t) => r("page", e.meta.current_page + 1)
|
|
3204
|
-
}, " › ", 10,
|
|
3404
|
+
}, " › ", 10, Pt)
|
|
3205
3405
|
], 2))], 2));
|
|
3206
3406
|
}
|
|
3207
|
-
},
|
|
3407
|
+
}, It = {
|
|
3208
3408
|
key: 0,
|
|
3209
3409
|
class: "flex w-full items-center gap-3 md:w-auto"
|
|
3210
|
-
},
|
|
3410
|
+
}, Lt = ["placeholder"], Rt = ["checked"], zt = ["onClick"], Bt = { key: 0 }, Vt = { key: 0 }, Ht = ["colspan"], Ut = ["onClick"], Wt = ["checked", "onChange"], Gt = ["innerHTML"], Kt = ["onClick"], qt = ["onClick"], Jt = ["checked", "onChange"], Yt = ["innerHTML"], Xt = ["onClick"], Zt = { class: "text-sm text-gray-700" }, Qt = { class: "flex items-center gap-2" }, $t = ["onClick"], en = {
|
|
3211
3411
|
__name: "ShTable",
|
|
3212
3412
|
props: {
|
|
3213
3413
|
endpoint: {
|
|
@@ -3276,7 +3476,7 @@ var vt = ["value"], yt = ["value"], bt = ["disabled"], xt = ["disabled"], St = [
|
|
|
3276
3476
|
}).filter((e) => e.show ? e.show() : !0)), D = () => `sh_table_per_page_${typeof window < "u" ? window.location.pathname : "server"}_${m.endpoint}`.replace(/[^a-z0-9]+/gi, "_").toLowerCase(), ee = () => {
|
|
3277
3477
|
let e = Number(i.getItem(D()));
|
|
3278
3478
|
return e > 0 ? e : Number(m.perPage ?? t("tablePerPage", 10));
|
|
3279
|
-
}, F = O(1), I = O(ee()), R = O(""), B = O(!1), U = O(m.sortBy), W = O(m.sortMethod), te = O(null), ne = O(null), G = O(""), K = O(""), re = l(() => m.paginationStyle ?? t("tablePaginationStyle", "pages")), ie = l(() => m.cache === null ? !!t("enableTableCache", !1) : m.cache), { records: J, meta: ae, status: oe, error: se, offline: Y, fromCache: ce, load: ue } =
|
|
3479
|
+
}, F = O(1), I = O(ee()), R = O(""), B = O(!1), U = O(m.sortBy), W = O(m.sortMethod), te = O(null), ne = O(null), G = O(""), K = O(""), re = l(() => m.paginationStyle ?? t("tablePaginationStyle", "pages")), ie = l(() => m.cache === null ? !!t("enableTableCache", !1) : m.cache), { records: J, meta: ae, status: oe, error: se, offline: Y, fromCache: ce, load: ue } = Ot({
|
|
3280
3480
|
query: () => {
|
|
3281
3481
|
let e = {
|
|
3282
3482
|
order_by: U.value,
|
|
@@ -3328,7 +3528,7 @@ var vt = ["value"], yt = ["value"], bt = ["disabled"], xt = ["disabled"], St = [
|
|
|
3328
3528
|
F.value = 1, I.value = ee(), X();
|
|
3329
3529
|
});
|
|
3330
3530
|
let Z = (e, t) => {
|
|
3331
|
-
let n =
|
|
3531
|
+
let n = Tt(e, t.name);
|
|
3332
3532
|
if (n == null || n === "") return "";
|
|
3333
3533
|
switch (t.format) {
|
|
3334
3534
|
case "date": return r.formatDate(n, "ll");
|
|
@@ -3337,7 +3537,7 @@ var vt = ["value"], yt = ["value"], bt = ["disabled"], xt = ["disabled"], St = [
|
|
|
3337
3537
|
case "money": return r.formatNumber(n, 2);
|
|
3338
3538
|
default: return n;
|
|
3339
3539
|
}
|
|
3340
|
-
}, be = (e) => !e.permission || b.isAllowedTo(e.permission), xe = (e) => m.actions.filter((t) => be(t) && (t.show ? t.show(e) : !0)), Q = l(() => m.multiActions.filter(be)), Se = (e, t) => String(e).replace(/\{(.*?)\}/g, (e, n) =>
|
|
3540
|
+
}, be = (e) => !e.permission || b.isAllowedTo(e.permission), xe = (e) => m.actions.filter((t) => be(t) && (t.show ? t.show(e) : !0)), Q = l(() => m.multiActions.filter(be)), Se = (e, t) => String(e).replace(/\{(.*?)\}/g, (e, n) => Tt(t, n)), Ce = async (e, t) => {
|
|
3341
3541
|
if (e.handler) return e.handler(t);
|
|
3342
3542
|
if (e.emit) {
|
|
3343
3543
|
v("action", e.emit, t), v(e.emit, t);
|
|
@@ -3376,13 +3576,13 @@ var vt = ["value"], yt = ["value"], bt = ["disabled"], xt = ["disabled"], St = [
|
|
|
3376
3576
|
e.searchable || e.hasRange ? (E(), f("div", {
|
|
3377
3577
|
key: 0,
|
|
3378
3578
|
class: x(N(y).toolbar)
|
|
3379
|
-
}, [e.searchable ? (E(), f("div",
|
|
3579
|
+
}, [e.searchable ? (E(), f("div", It, [V(p("input", {
|
|
3380
3580
|
"onUpdate:modelValue": n[0] ||= (e) => R.value = e,
|
|
3381
3581
|
type: "search",
|
|
3382
3582
|
placeholder: e.searchPlaceholder,
|
|
3383
3583
|
class: x(N(y).search),
|
|
3384
3584
|
onInput: fe
|
|
3385
|
-
}, null, 42,
|
|
3585
|
+
}, null, 42, Lt), [[L, R.value]]), R.value.length > 1 ? (E(), f("label", {
|
|
3386
3586
|
key: 0,
|
|
3387
3587
|
class: x(N(y).exactLabel)
|
|
3388
3588
|
}, [V(p("input", {
|
|
@@ -3439,7 +3639,7 @@ var vt = ["value"], yt = ["value"], bt = ["disabled"], xt = ["disabled"], St = [
|
|
|
3439
3639
|
class: x(N(y).checkbox),
|
|
3440
3640
|
checked: Te.value,
|
|
3441
3641
|
onChange: Ee
|
|
3442
|
-
}, null, 42,
|
|
3642
|
+
}, null, 42, Rt)], 2)) : d("", !0),
|
|
3443
3643
|
(E(!0), f(o, null, k(T.value, (e) => (E(), f("th", {
|
|
3444
3644
|
key: e.name,
|
|
3445
3645
|
class: x(N(y).th)
|
|
@@ -3447,15 +3647,15 @@ var vt = ["value"], yt = ["value"], bt = ["disabled"], xt = ["disabled"], St = [
|
|
|
3447
3647
|
key: 0,
|
|
3448
3648
|
class: x(N(y).sortBtn),
|
|
3449
3649
|
onClick: (t) => he(e)
|
|
3450
|
-
}, [h(M(e.label) + " ", 1), U.value === e.name ? (E(), f("span",
|
|
3650
|
+
}, [h(M(e.label) + " ", 1), U.value === e.name ? (E(), f("span", Bt, M(W.value === "desc" ? "↓" : "↑"), 1)) : d("", !0)], 10, zt)) : (E(), f(o, { key: 1 }, [h(M(e.label), 1)], 64))], 2))), 128)),
|
|
3451
3651
|
e.actions.length ? (E(), f("th", {
|
|
3452
3652
|
key: 1,
|
|
3453
3653
|
class: x([N(y).th, "text-right"])
|
|
3454
3654
|
}, "Actions", 2)) : d("", !0)
|
|
3455
|
-
])], 2), p("tbody", { class: x(N(y).tbody) }, [N(J).length ? d("", !0) : (E(), f("tr",
|
|
3655
|
+
])], 2), p("tbody", { class: x(N(y).tbody) }, [N(J).length ? d("", !0) : (E(), f("tr", Vt, [p("td", {
|
|
3456
3656
|
colspan: ke.value,
|
|
3457
3657
|
class: x(N(y).empty)
|
|
3458
|
-
}, [A(t.$slots, "empty", {}, () => [h(M(e.emptyMessage), 1)])], 10,
|
|
3658
|
+
}, [A(t.$slots, "empty", {}, () => [h(M(e.emptyMessage), 1)])], 10, Ht)])), (E(!0), f(o, null, k(N(J), (r, i) => (E(), f("tr", {
|
|
3459
3659
|
key: r.id ?? i,
|
|
3460
3660
|
class: x([N(y).tr, e.rowLink ? N(y).trClickable : ""]),
|
|
3461
3661
|
onClick: (e) => we(r)
|
|
@@ -3469,7 +3669,7 @@ var vt = ["value"], yt = ["value"], bt = ["disabled"], xt = ["disabled"], St = [
|
|
|
3469
3669
|
class: x(N(y).checkbox),
|
|
3470
3670
|
checked: $.value.includes(r.id),
|
|
3471
3671
|
onChange: (e) => De(r.id)
|
|
3472
|
-
}, null, 42,
|
|
3672
|
+
}, null, 42, Wt)], 2)) : d("", !0),
|
|
3473
3673
|
(E(!0), f(o, null, k(T.value, (e) => (E(), f("td", {
|
|
3474
3674
|
key: e.name,
|
|
3475
3675
|
class: x([N(y).td, e.class])
|
|
@@ -3480,14 +3680,14 @@ var vt = ["value"], yt = ["value"], bt = ["disabled"], xt = ["disabled"], St = [
|
|
|
3480
3680
|
}, () => [e.component ? (E(), u(j(e.component), {
|
|
3481
3681
|
key: 0,
|
|
3482
3682
|
row: r,
|
|
3483
|
-
value: N(
|
|
3683
|
+
value: N(Tt)(r, e.name)
|
|
3484
3684
|
}, null, 8, ["row", "value"])) : e.format === "money" ? (E(), f("span", {
|
|
3485
3685
|
key: 1,
|
|
3486
3686
|
class: x(N(y).money)
|
|
3487
3687
|
}, M(Z(r, e)), 3)) : (E(), f("span", {
|
|
3488
3688
|
key: 2,
|
|
3489
3689
|
innerHTML: Z(r, e)
|
|
3490
|
-
}, null, 8,
|
|
3690
|
+
}, null, 8, Gt))])], 2))), 128)),
|
|
3491
3691
|
e.actions.length ? (E(), f("td", {
|
|
3492
3692
|
key: 1,
|
|
3493
3693
|
class: x(N(y).actionsCell),
|
|
@@ -3496,8 +3696,8 @@ var vt = ["value"], yt = ["value"], bt = ["disabled"], xt = ["disabled"], St = [
|
|
|
3496
3696
|
key: e.label,
|
|
3497
3697
|
class: x([N(y).actionBtn, e.class]),
|
|
3498
3698
|
onClick: (t) => Ce(e, r)
|
|
3499
|
-
}, M(e.label), 11,
|
|
3500
|
-
], 10,
|
|
3699
|
+
}, M(e.label), 11, Kt))), 128))])], 2)) : d("", !0)
|
|
3700
|
+
], 10, Ut))), 128))], 2)], 2)], 2),
|
|
3501
3701
|
p("div", { class: x(N(y).cards) }, [N(J).length ? d("", !0) : (E(), f("p", {
|
|
3502
3702
|
key: 0,
|
|
3503
3703
|
class: x(N(y).empty)
|
|
@@ -3515,7 +3715,7 @@ var vt = ["value"], yt = ["value"], bt = ["disabled"], xt = ["disabled"], St = [
|
|
|
3515
3715
|
class: x(N(y).checkbox),
|
|
3516
3716
|
checked: $.value.includes(r.id),
|
|
3517
3717
|
onChange: (e) => De(r.id)
|
|
3518
|
-
}, null, 42,
|
|
3718
|
+
}, null, 42, Jt), n[13] ||= h(" Select ", -1)], 2)) : d("", !0),
|
|
3519
3719
|
(E(!0), f(o, null, k(T.value, (e) => (E(), f(o, { key: e.name }, [p("p", { class: x(N(y).cardLabel) }, M(e.label), 3), p("div", { class: x(N(y).cardValue) }, [A(t.$slots, `cell-${e.name}`, {
|
|
3520
3720
|
row: r,
|
|
3521
3721
|
value: Z(r, e),
|
|
@@ -3523,14 +3723,14 @@ var vt = ["value"], yt = ["value"], bt = ["disabled"], xt = ["disabled"], St = [
|
|
|
3523
3723
|
}, () => [e.component ? (E(), u(j(e.component), {
|
|
3524
3724
|
key: 0,
|
|
3525
3725
|
row: r,
|
|
3526
|
-
value: N(
|
|
3726
|
+
value: N(Tt)(r, e.name)
|
|
3527
3727
|
}, null, 8, ["row", "value"])) : e.format === "money" ? (E(), f("span", {
|
|
3528
3728
|
key: 1,
|
|
3529
3729
|
class: x(N(y).money)
|
|
3530
3730
|
}, M(Z(r, e)), 3)) : (E(), f("span", {
|
|
3531
3731
|
key: 2,
|
|
3532
3732
|
innerHTML: Z(r, e)
|
|
3533
|
-
}, null, 8,
|
|
3733
|
+
}, null, 8, Yt))])], 2)], 64))), 128)),
|
|
3534
3734
|
e.actions.length ? (E(), f("div", {
|
|
3535
3735
|
key: 1,
|
|
3536
3736
|
class: "mt-2",
|
|
@@ -3539,9 +3739,9 @@ var vt = ["value"], yt = ["value"], bt = ["disabled"], xt = ["disabled"], St = [
|
|
|
3539
3739
|
key: e.label,
|
|
3540
3740
|
class: x([N(y).actionBtn, e.class]),
|
|
3541
3741
|
onClick: (t) => Ce(e, r)
|
|
3542
|
-
}, M(e.label), 11,
|
|
3543
|
-
], 10,
|
|
3544
|
-
N(ae) && N(J).length ? (E(), u(
|
|
3742
|
+
}, M(e.label), 11, Xt))), 128))])])) : d("", !0)
|
|
3743
|
+
], 10, qt))), 128))], 2),
|
|
3744
|
+
N(ae) && N(J).length ? (E(), u(Ft, {
|
|
3545
3745
|
key: 0,
|
|
3546
3746
|
meta: N(ae),
|
|
3547
3747
|
"per-page": I.value,
|
|
@@ -3562,19 +3762,19 @@ var vt = ["value"], yt = ["value"], bt = ["disabled"], xt = ["disabled"], St = [
|
|
|
3562
3762
|
$.value.length && Q.value.length ? (E(), f("div", {
|
|
3563
3763
|
key: 5,
|
|
3564
3764
|
class: x(N(y).multiBar)
|
|
3565
|
-
}, [p("div",
|
|
3765
|
+
}, [p("div", Zt, [p("span", { class: x(N(y).multiCount) }, M($.value.length), 3), n[14] ||= h(" selected ", -1)]), p("div", Qt, [(E(!0), f(o, null, k(Q.value, (e) => (E(), f("button", {
|
|
3566
3766
|
key: e.label,
|
|
3567
3767
|
type: "button",
|
|
3568
3768
|
class: x([N(y).multiBtn, e.class]),
|
|
3569
3769
|
onClick: (t) => Oe(e)
|
|
3570
|
-
}, M(e.label), 11,
|
|
3770
|
+
}, M(e.label), 11, $t))), 128)), p("button", {
|
|
3571
3771
|
type: "button",
|
|
3572
3772
|
class: x(N(y).multiBtn),
|
|
3573
3773
|
onClick: n[9] ||= (e) => $.value = []
|
|
3574
3774
|
}, "Cancel", 2)])], 2)) : d("", !0)
|
|
3575
3775
|
], 2));
|
|
3576
3776
|
}
|
|
3577
|
-
},
|
|
3777
|
+
}, tn = {
|
|
3578
3778
|
__name: "ShConfirmAction",
|
|
3579
3779
|
props: {
|
|
3580
3780
|
url: {
|
|
@@ -3631,7 +3831,7 @@ var vt = ["value"], yt = ["value"], bt = ["disabled"], xt = ["disabled"], St = [
|
|
|
3631
3831
|
_: 3
|
|
3632
3832
|
}, 8, ["class"]));
|
|
3633
3833
|
}
|
|
3634
|
-
},
|
|
3834
|
+
}, nn = {
|
|
3635
3835
|
__name: "ShSilentAction",
|
|
3636
3836
|
props: {
|
|
3637
3837
|
url: {
|
|
@@ -3692,4 +3892,4 @@ var vt = ["value"], yt = ["value"], bt = ["disabled"], xt = ["disabled"], St = [
|
|
|
3692
3892
|
}
|
|
3693
3893
|
};
|
|
3694
3894
|
//#endregion
|
|
3695
|
-
export {
|
|
3895
|
+
export { Be as DateInput, Se as EmailInput, Ie as MaskedInput, Re as NumberInput, Te as PasswordInput, Xe as PhoneInput, De as PinInput, ne as SH_DIALOG_CONTEXT, te as SH_TW_COMPONENTS, W as SH_TW_THEME, Ge as SelectInput, tn as ShConfirmAction, at as ShDialog, st as ShDialogBtn, lt as ShDialogForm, ot as ShDrawer, ct as ShDrawerBtn, it as ShForm, pe as ShFormSteps, nn as ShSilentAction, ve as ShSpinner, et as ShSuggest, en as ShTable, Ft as ShTablePagination, re as ShTailwind, xe as TextAreaInput, Z as TextInput, Ne as applyMask, Ct as clearTableCache, Ke as countries, ie as createShTailwind, U as defaultTheme, Dt as localQuery, Me as maskMoney, je as maskPattern, wt as shTableCache, ce as useDialog, Ot as useTableData, q as useTheme };
|