nuxt-hs-ui 2.12.7 → 4.0.0
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 +202 -14
- package/dist/module.d.mts +3 -4
- package/dist/module.json +9 -6
- package/dist/module.mjs +109 -99
- package/dist/runtime/assets/flatpickr-dark.css +1 -1
- package/dist/runtime/assets/main.css +1 -0
- package/dist/runtime/assets/tabulator-custom.css +1 -1
- package/dist/runtime/components/form/_select/hidden-item-toggle.vue +28 -0
- package/dist/runtime/components/form/_select/hidden-item-toggle.vue.d.ts +10 -0
- package/dist/runtime/components/form/_select/item-container.vue +63 -0
- package/dist/runtime/components/form/_select/item-container.vue.d.ts +19 -0
- package/dist/runtime/components/form/_select/item-label.vue +31 -0
- package/dist/runtime/components/form/_select/item-label.vue.d.ts +13 -0
- package/dist/runtime/components/form/_select/item-row.vue +62 -0
- package/dist/runtime/components/form/_select/item-row.vue.d.ts +34 -0
- package/dist/runtime/components/form/btn-line-loading.vue +62 -81
- package/dist/runtime/components/form/btn-line-loading.vue.d.ts +14 -0
- package/dist/runtime/components/form/btn.vue +411 -494
- package/dist/runtime/components/form/btn.vue.d.ts +0 -0
- package/dist/runtime/components/form/check-box.vue +200 -315
- package/dist/runtime/components/form/check-box.vue.d.ts +71 -0
- package/dist/runtime/components/form/check-list.vue +234 -364
- package/dist/runtime/components/form/check-list.vue.d.ts +99 -0
- package/dist/runtime/components/form/combo-box.vue +340 -0
- package/dist/runtime/components/form/combo-box.vue.d.ts +69 -0
- package/dist/runtime/components/form/datepicker.vue +717 -883
- package/dist/runtime/components/form/datepicker.vue.d.ts +122 -0
- package/dist/runtime/components/form/input-frame.vue +174 -258
- package/dist/runtime/components/form/input-frame.vue.d.ts +88 -0
- package/dist/runtime/components/form/radio.vue +451 -614
- package/dist/runtime/components/form/radio.vue.d.ts +62 -0
- package/dist/runtime/components/form/select-img-icon.vue +38 -53
- package/dist/runtime/components/form/select-img-icon.vue.d.ts +15 -0
- package/dist/runtime/components/form/select.vue +733 -579
- package/dist/runtime/components/form/select.vue.d.ts +63 -0
- package/dist/runtime/components/form/text-box.vue +266 -365
- package/dist/runtime/components/form/text-box.vue.d.ts +105 -0
- package/dist/runtime/components/form/textarea.vue +338 -421
- package/dist/runtime/components/form/textarea.vue.d.ts +98 -0
- package/dist/runtime/components/form/value-box.vue +512 -641
- package/dist/runtime/components/form/value-box.vue.d.ts +128 -0
- package/dist/runtime/components/interactive/alert.vue +49 -113
- package/dist/runtime/components/interactive/alert.vue.d.ts +30 -0
- package/dist/runtime/components/interactive/block-loading.vue +91 -119
- package/dist/runtime/components/interactive/block-loading.vue.d.ts +22 -0
- package/dist/runtime/components/interactive/dialog.vue +252 -407
- package/dist/runtime/components/interactive/dialog.vue.d.ts +3 -0
- package/dist/runtime/components/interactive/modal-bg.vue +72 -82
- package/dist/runtime/components/interactive/modal-bg.vue.d.ts +11 -0
- package/dist/runtime/components/interactive/modal.vue +121 -169
- package/dist/runtime/components/interactive/modal.vue.d.ts +38 -0
- package/dist/runtime/components/interactive/toast.vue +164 -206
- package/dist/runtime/components/interactive/toast.vue.d.ts +3 -0
- package/dist/runtime/components/interactive/window-loader.vue +61 -84
- package/dist/runtime/components/interactive/window-loader.vue.d.ts +3 -0
- package/dist/runtime/components/layout/accordion-down.vue +72 -0
- package/dist/runtime/components/layout/accordion-down.vue.d.ts +26 -0
- package/dist/runtime/components/layout/accordion.vue +47 -78
- package/dist/runtime/components/layout/accordion.vue.d.ts +22 -0
- package/dist/runtime/components/layout/aspect-box.vue +29 -58
- package/dist/runtime/components/layout/aspect-box.vue.d.ts +29 -0
- package/dist/runtime/components/layout/card-item.vue +148 -193
- package/dist/runtime/components/layout/card-item.vue.d.ts +0 -0
- package/dist/runtime/components/layout/card.vue +27 -42
- package/dist/runtime/components/layout/card.vue.d.ts +23 -0
- package/dist/runtime/components/layout/container.vue +25 -40
- package/dist/runtime/components/layout/container.vue.d.ts +35 -0
- package/dist/runtime/components/layout/divider-h.vue +30 -50
- package/dist/runtime/components/layout/divider-h.vue.d.ts +18 -0
- package/dist/runtime/components/misc/breadcrumb.vue +47 -95
- package/dist/runtime/components/misc/breadcrumb.vue.d.ts +22 -0
- package/dist/runtime/components/misc/tabulator.vue +122 -190
- package/dist/runtime/components/misc/tabulator.vue.d.ts +28 -0
- package/dist/runtime/components/misc/view-name-display.vue +53 -68
- package/dist/runtime/components/misc/view-name-display.vue.d.ts +14 -0
- package/dist/runtime/components/test.vue +13 -0
- package/dist/runtime/components/test.vue.d.ts +3 -0
- package/dist/runtime/composables/test.d.ts +8 -0
- package/dist/runtime/composables/test.js +12 -0
- package/dist/runtime/composables/use-hs-dialog.d.ts +3 -20
- package/dist/runtime/composables/use-hs-dialog.js +3 -9
- package/dist/runtime/composables/use-hs-is-mobile.d.ts +8 -2
- package/dist/runtime/composables/use-hs-is-mobile.js +43 -25
- package/dist/runtime/composables/use-hs-misc.d.ts +8 -38
- package/dist/runtime/composables/use-hs-misc.js +9 -61
- package/dist/runtime/composables/use-hs-modal.js +1 -3
- package/dist/runtime/composables/use-hs-multi-lang.d.ts +23 -40
- package/dist/runtime/composables/use-hs-multi-lang.js +30 -74
- package/dist/runtime/composables/use-hs-scroll-lock.d.ts +1 -1
- package/dist/runtime/composables/use-hs-scroll-lock.js +2 -1
- package/dist/runtime/composables/use-hs-toast.d.ts +2 -2
- package/dist/runtime/composables/use-hs-toast.js +12 -4
- package/dist/runtime/composables/use-pinia.d.ts +1 -0
- package/dist/runtime/composables/use-pinia.js +2 -0
- package/dist/runtime/plugin.d.ts +2 -0
- package/dist/runtime/plugin.js +4 -0
- package/dist/runtime/server/tsconfig.json +3 -3
- package/dist/runtime/types/dialog.d.ts +11 -20
- package/dist/runtime/types/dialog.js +2 -1
- package/dist/runtime/types/flatpickr/default.js +2 -23
- package/dist/runtime/types/flatpickr/ja.js +3 -37
- package/dist/runtime/types/toast.d.ts +1 -1
- package/dist/runtime/utils/dayjs.d.ts +8 -6
- package/dist/runtime/utils/dayjs.js +12 -5
- package/dist/runtime/utils/modal.d.ts +9 -28
- package/dist/runtime/utils/modal.js +7 -36
- package/dist/runtime/utils/multi-lang-object.d.ts +2 -2
- package/dist/runtime/utils/multi-lang-object.js +1 -5
- package/dist/runtime/utils/multi-lang.js +12 -22
- package/dist/runtime/utils/object.js +1 -1
- package/dist/runtime/utils/select-item.d.ts +3 -1
- package/dist/runtime/utils/stop-watch.js +6 -4
- package/dist/runtime/utils/string.js +4 -4
- package/dist/runtime/utils/tabulator.d.ts +1 -42
- package/dist/runtime/utils/tabulator.js +2 -99
- package/dist/runtime/utils/theme.d.ts +20 -20
- package/dist/runtime/utils/theme.js +180 -30
- package/dist/runtime/utils/tv.d.ts +1 -101
- package/dist/runtime/utils/tv.js +0 -22
- package/dist/types.d.mts +3 -1
- package/package.json +61 -119
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -16
- package/dist/runtime/assets/vue-select.css +0 -1
- package/dist/runtime/components/misc/view-name-display-target.vue +0 -39
- package/dist/runtime/plugin/v-select.d.ts +0 -2
- package/dist/runtime/plugin/v-select.js +0 -5
- package/dist/runtime/style.css +0 -22
- package/dist/runtime/tailwind.css +0 -78
- package/dist/runtime/types/app.config.d.ts +0 -5
- package/dist/types.d.ts +0 -1
|
File without changes
|
|
@@ -1,317 +1,202 @@
|
|
|
1
|
-
<script setup
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
};
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
focusState.isActivate = false;
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
// [ iconEventShowWarn ]
|
|
204
|
-
const iconEventShowWarn = () => {
|
|
205
|
-
Toast.Warning(props.warn, props.uiText.validError.title, props.warnTimeOut);
|
|
206
|
-
};
|
|
207
|
-
const tabindex = computed(() => {
|
|
208
|
-
if (props.disabled === true) return -1;
|
|
209
|
-
return props.tabindex;
|
|
210
|
-
});
|
|
211
|
-
//
|
|
212
|
-
// ----------------------------------------------------------------------------
|
|
213
|
-
// Class
|
|
214
|
-
|
|
215
|
-
const baseClass = computed(() => {
|
|
216
|
-
return {
|
|
217
|
-
disabled: props.disabled,
|
|
218
|
-
activate: computedActivate.value,
|
|
219
|
-
diff:
|
|
220
|
-
props.diff !== undefined &&
|
|
221
|
-
props.diff !== props.data &&
|
|
222
|
-
!(props.diff === null && props.data === true),
|
|
223
|
-
};
|
|
224
|
-
});
|
|
225
|
-
|
|
226
|
-
const boxClass = computed(() => {
|
|
227
|
-
return [
|
|
228
|
-
twMerge(
|
|
229
|
-
"border border-gray-700",
|
|
230
|
-
!props.disabled ? "cursor-pointer" : "cursor-not-allowed",
|
|
231
|
-
!props.disabled ? "bg-white" : "bg-gray-100",
|
|
232
|
-
props.size === "s" ? "w-[16px] h-[16px] " : "",
|
|
233
|
-
props.size === "m" ? "w-[18px] h-[18px] " : "",
|
|
234
|
-
props.size === "l" ? "w-[22px] h-[22px] " : ""
|
|
235
|
-
),
|
|
236
|
-
];
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
const checkClass = computed(() => {
|
|
240
|
-
return [
|
|
241
|
-
twMerge(
|
|
242
|
-
"absolute inset-0",
|
|
243
|
-
"flex items-center justify-center",
|
|
244
|
-
props.size === "s" ? "text-[14px]" : "",
|
|
245
|
-
props.size === "m" ? "text-[16px]" : "",
|
|
246
|
-
props.size === "l" ? "text-[18px]" : "",
|
|
247
|
-
props.data === true ? "scale-100" : "scale-0"
|
|
248
|
-
),
|
|
249
|
-
];
|
|
250
|
-
});
|
|
251
|
-
const labelClass = computed(() => {
|
|
252
|
-
return [
|
|
253
|
-
twMerge(
|
|
254
|
-
"flex items-center gap-[2px]",
|
|
255
|
-
!props.disabled ? "cursor-pointer" : "cursor-not-allowed",
|
|
256
|
-
props.size === "s" ? "text-[14px] ps-[6px]" : "",
|
|
257
|
-
props.size === "m" ? "text-[16px] ps-[8px]" : "",
|
|
258
|
-
props.size === "l" ? "text-[20px] ps-[10px]" : "",
|
|
259
|
-
ClassTypeToString(props.classLabel)
|
|
260
|
-
),
|
|
261
|
-
];
|
|
262
|
-
});
|
|
263
|
-
|
|
264
|
-
// ----------------------------------------------------------------------------
|
|
265
|
-
</script>
|
|
266
|
-
|
|
267
|
-
<template>
|
|
268
|
-
<div class="nac-checkbox" :class="baseClass">
|
|
269
|
-
<input
|
|
270
|
-
:ref="(e) => setRef(e)"
|
|
271
|
-
:tabindex="tabindex"
|
|
272
|
-
type="checkbox"
|
|
273
|
-
class="checkbox"
|
|
274
|
-
@blur="onBlur()"
|
|
275
|
-
@focus="onFocus()"
|
|
276
|
-
/>
|
|
277
|
-
<div
|
|
278
|
-
class="nac-checkbox-box flex-none"
|
|
279
|
-
:class="[boxClass, { checked: props.data === true }]"
|
|
280
|
-
@click="switchValue()"
|
|
281
|
-
>
|
|
282
|
-
<div :class="checkClass">
|
|
283
|
-
<i class="fas fa-check text-green-600"></i>
|
|
284
|
-
</div>
|
|
285
|
-
</div>
|
|
286
|
-
<div
|
|
287
|
-
class="nac-checkbox-text"
|
|
288
|
-
:class="labelClass"
|
|
289
|
-
@mousedown="onMousedown()"
|
|
290
|
-
@mouseup="onMouseup()"
|
|
291
|
-
@click="switchValue()"
|
|
292
|
-
>
|
|
293
|
-
<SelectImgIcon
|
|
294
|
-
v-if="props.image"
|
|
295
|
-
class="flex-none"
|
|
296
|
-
:img-url="props.imgUrl"
|
|
297
|
-
:class-img="props.classImg"
|
|
298
|
-
:class-img-tag="props.classImgTag"
|
|
299
|
-
/>
|
|
300
|
-
<div class="flex-1 min-w-[0] whitespace-pre-wrap break-words">
|
|
301
|
-
{{ tx(label) }}
|
|
302
|
-
<slot />
|
|
303
|
-
</div>
|
|
304
|
-
<span
|
|
305
|
-
v-if="props.warn.length !== 0"
|
|
306
|
-
class="warn flex-none"
|
|
307
|
-
@click.stop="iconEventShowWarn()"
|
|
308
|
-
>
|
|
309
|
-
<i class="fas fa-exclamation-triangle"></i>{{ props.warn }}
|
|
310
|
-
</span>
|
|
311
|
-
</div>
|
|
312
|
-
</div>
|
|
313
|
-
</template>
|
|
314
|
-
|
|
1
|
+
<script setup>
|
|
2
|
+
import { twMerge } from "tailwind-merge";
|
|
3
|
+
import { reactive, ref, watch, computed, useId, nextTick } from "#imports";
|
|
4
|
+
import { ClassTypeToString } from "../../utils/class-style";
|
|
5
|
+
import { useHsFocus } from "../../composables/use-hs-focus";
|
|
6
|
+
import { useHsToast } from "../../composables/use-hs-toast";
|
|
7
|
+
import { useHsMultiLang } from "../../composables/use-hs-multi-lang";
|
|
8
|
+
import { useHsPinia } from "../../composables/use-pinia";
|
|
9
|
+
import SelectImgIcon from "./select-img-icon.vue";
|
|
10
|
+
const hsFocus = useHsFocus(useHsPinia());
|
|
11
|
+
const Toast = useHsToast(useHsPinia());
|
|
12
|
+
const props = defineProps({
|
|
13
|
+
image: { type: Boolean, required: false, default: false },
|
|
14
|
+
imgUrl: { type: [String, null], required: false, default: null },
|
|
15
|
+
classImg: { type: [String, Object, Array], required: false, default: "" },
|
|
16
|
+
classImgTag: { type: [String, Object, Array], required: false, default: "" },
|
|
17
|
+
classLabel: { type: [String, Object, Array], required: false, default: "" },
|
|
18
|
+
data: { type: [Boolean, null], required: true },
|
|
19
|
+
diff: { type: [Boolean, null], required: false, skipCheck: true, default: void 0 },
|
|
20
|
+
tabindex: { type: null, required: false, default: void 0 },
|
|
21
|
+
disabled: { type: Boolean, required: false, default: false },
|
|
22
|
+
label: { type: [String, Object], required: false, default: "" },
|
|
23
|
+
warn: { type: String, required: false, default: "" },
|
|
24
|
+
warnTimeOut: { type: Number, required: false, default: 3e3 },
|
|
25
|
+
size: { type: String, required: false, default: "m" },
|
|
26
|
+
uiText: { type: Object, required: false, default: () => {
|
|
27
|
+
return {
|
|
28
|
+
validError: {
|
|
29
|
+
title: { ja: "\u5165\u529B\u5024\u306E\u8B66\u544A", en: "Input Value Warning" }
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
} }
|
|
33
|
+
});
|
|
34
|
+
const emit = defineEmits(["ref", "focus", "blur", "update:data", "value-change", "keydown", "keyup"]);
|
|
35
|
+
const multiLang = useHsMultiLang(useHsPinia());
|
|
36
|
+
const tx = multiLang.tx;
|
|
37
|
+
const uid = useId();
|
|
38
|
+
const inputElement = ref();
|
|
39
|
+
defineExpose({ el: inputElement });
|
|
40
|
+
const setRef = (elm) => {
|
|
41
|
+
inputElement.value = elm;
|
|
42
|
+
emit("ref", elm);
|
|
43
|
+
};
|
|
44
|
+
const switchValue = () => {
|
|
45
|
+
const before = props.data;
|
|
46
|
+
if (props.disabled === true) return;
|
|
47
|
+
if (props.data === true) {
|
|
48
|
+
emit("update:data", false);
|
|
49
|
+
nextTick(() => {
|
|
50
|
+
emit("value-change", false, before);
|
|
51
|
+
});
|
|
52
|
+
} else {
|
|
53
|
+
emit("update:data", true);
|
|
54
|
+
nextTick(() => {
|
|
55
|
+
emit("value-change", true, before);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
if (inputElement.value !== null) {
|
|
59
|
+
inputElement.value.focus();
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
const elmFocus = () => {
|
|
63
|
+
inputElement.value.focus();
|
|
64
|
+
};
|
|
65
|
+
const focusState = reactive({
|
|
66
|
+
isActivate: false,
|
|
67
|
+
isMmousedown: false
|
|
68
|
+
});
|
|
69
|
+
const computedActivate = computed(() => {
|
|
70
|
+
if (props.disabled === true) return false;
|
|
71
|
+
if (hsFocus.state.id !== uid) return false;
|
|
72
|
+
if (focusState.isActivate) return true;
|
|
73
|
+
if (focusState.isMmousedown) return true;
|
|
74
|
+
return false;
|
|
75
|
+
});
|
|
76
|
+
watch(computedActivate, (value) => {
|
|
77
|
+
if (value === true) {
|
|
78
|
+
setTimeout(() => {
|
|
79
|
+
emit("focus", inputElement.value);
|
|
80
|
+
}, 10);
|
|
81
|
+
} else {
|
|
82
|
+
emit("blur", inputElement.value);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
const onMousedown = () => {
|
|
86
|
+
if (props.disabled === true) return;
|
|
87
|
+
focusState.isMmousedown = true;
|
|
88
|
+
};
|
|
89
|
+
const onMouseup = () => {
|
|
90
|
+
if (props.disabled === true) return;
|
|
91
|
+
elmFocus();
|
|
92
|
+
focusState.isMmousedown = false;
|
|
93
|
+
};
|
|
94
|
+
const onFocus = () => {
|
|
95
|
+
if (props.disabled === true) return;
|
|
96
|
+
focusState.isActivate = true;
|
|
97
|
+
if (hsFocus.state.id !== uid) {
|
|
98
|
+
hsFocus.state.id = uid;
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
const onBlur = () => {
|
|
102
|
+
focusState.isActivate = false;
|
|
103
|
+
};
|
|
104
|
+
const iconEventShowWarn = () => {
|
|
105
|
+
Toast.Warning(props.warn, props.uiText.validError.title, props.warnTimeOut);
|
|
106
|
+
};
|
|
107
|
+
const tabindex = computed(() => {
|
|
108
|
+
if (props.disabled === true) return -1;
|
|
109
|
+
return props.tabindex;
|
|
110
|
+
});
|
|
111
|
+
const baseClass = computed(() => {
|
|
112
|
+
return {
|
|
113
|
+
disabled: props.disabled,
|
|
114
|
+
activate: computedActivate.value,
|
|
115
|
+
diff: props.diff !== void 0 && props.diff !== props.data && !(props.diff === null && props.data === true)
|
|
116
|
+
};
|
|
117
|
+
});
|
|
118
|
+
const boxClass = computed(() => {
|
|
119
|
+
return [
|
|
120
|
+
twMerge(
|
|
121
|
+
"border border-gray-700",
|
|
122
|
+
!props.disabled ? "cursor-pointer" : "cursor-not-allowed",
|
|
123
|
+
!props.disabled ? "bg-white" : "bg-gray-100",
|
|
124
|
+
props.size === "s" ? "w-[16px] h-[16px] " : "",
|
|
125
|
+
props.size === "m" ? "w-[18px] h-[18px] " : "",
|
|
126
|
+
props.size === "l" ? "w-[22px] h-[22px] " : ""
|
|
127
|
+
)
|
|
128
|
+
];
|
|
129
|
+
});
|
|
130
|
+
const checkClass = computed(() => {
|
|
131
|
+
return [
|
|
132
|
+
twMerge(
|
|
133
|
+
"absolute inset-0",
|
|
134
|
+
"flex items-center justify-center",
|
|
135
|
+
props.size === "s" ? "text-[14px]" : "",
|
|
136
|
+
props.size === "m" ? "text-[16px]" : "",
|
|
137
|
+
props.size === "l" ? "text-[18px]" : "",
|
|
138
|
+
props.data === true ? "scale-100" : "scale-0"
|
|
139
|
+
)
|
|
140
|
+
];
|
|
141
|
+
});
|
|
142
|
+
const labelClass = computed(() => {
|
|
143
|
+
return [
|
|
144
|
+
twMerge(
|
|
145
|
+
"flex items-center gap-[2px]",
|
|
146
|
+
!props.disabled ? "cursor-pointer" : "cursor-not-allowed",
|
|
147
|
+
props.size === "s" ? "text-[14px] ps-[6px]" : "",
|
|
148
|
+
props.size === "m" ? "text-[16px] ps-[8px]" : "",
|
|
149
|
+
props.size === "l" ? "text-[20px] ps-[10px]" : "",
|
|
150
|
+
ClassTypeToString(props.classLabel)
|
|
151
|
+
)
|
|
152
|
+
];
|
|
153
|
+
});
|
|
154
|
+
</script>
|
|
155
|
+
|
|
156
|
+
<template>
|
|
157
|
+
<div class="nac-checkbox" :class="baseClass">
|
|
158
|
+
<input
|
|
159
|
+
:ref="(e) => setRef(e)"
|
|
160
|
+
:tabindex="tabindex"
|
|
161
|
+
type="checkbox"
|
|
162
|
+
class="checkbox"
|
|
163
|
+
@blur="onBlur()"
|
|
164
|
+
@focus="onFocus()"
|
|
165
|
+
/>
|
|
166
|
+
<div
|
|
167
|
+
class="nac-checkbox-box flex-none relative"
|
|
168
|
+
:class="[boxClass, { checked: props.data === true }]"
|
|
169
|
+
@click="switchValue()"
|
|
170
|
+
>
|
|
171
|
+
<div :class="checkClass">
|
|
172
|
+
<i class="fas fa-check text-green-600"></i>
|
|
173
|
+
</div>
|
|
174
|
+
</div>
|
|
175
|
+
<div
|
|
176
|
+
class="nac-checkbox-text"
|
|
177
|
+
:class="labelClass"
|
|
178
|
+
@mousedown="onMousedown()"
|
|
179
|
+
@mouseup="onMouseup()"
|
|
180
|
+
@click="switchValue()"
|
|
181
|
+
>
|
|
182
|
+
<SelectImgIcon
|
|
183
|
+
v-if="props.image"
|
|
184
|
+
class="flex-none"
|
|
185
|
+
:img-url="props.imgUrl"
|
|
186
|
+
:class-img="props.classImg"
|
|
187
|
+
:class-img-tag="props.classImgTag"
|
|
188
|
+
/>
|
|
189
|
+
<div class="flex-1 min-w-0 whitespace-pre-wrap wrap-break-word">
|
|
190
|
+
{{ tx(label) }}
|
|
191
|
+
<slot />
|
|
192
|
+
</div>
|
|
193
|
+
<span v-if="props.warn.length !== 0" class="warn flex-none" @click.stop="iconEventShowWarn()">
|
|
194
|
+
<i class="fas fa-exclamation-triangle"></i>{{ props.warn }}
|
|
195
|
+
</span>
|
|
196
|
+
</div>
|
|
197
|
+
</div>
|
|
198
|
+
</template>
|
|
199
|
+
|
|
315
200
|
<style scoped>
|
|
316
201
|
.nac-checkbox {
|
|
317
202
|
display: inline-flex;
|
|
@@ -353,4 +238,4 @@ const labelClass = computed(() => {
|
|
|
353
238
|
.nac-checkbox.activate:not(.disabled) .nac-checkbox-text {
|
|
354
239
|
text-decoration: underline;
|
|
355
240
|
}
|
|
356
|
-
</style>
|
|
241
|
+
</style>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { type ClassType } from '../../utils/class-style.js';
|
|
2
|
+
import type { MultiLang } from '../../utils/multi-lang.js';
|
|
3
|
+
type Props = {
|
|
4
|
+
image?: boolean;
|
|
5
|
+
imgUrl?: string | null;
|
|
6
|
+
classImg?: ClassType;
|
|
7
|
+
classImgTag?: ClassType;
|
|
8
|
+
classLabel?: ClassType;
|
|
9
|
+
data: boolean | null;
|
|
10
|
+
diff?: boolean | null | undefined;
|
|
11
|
+
tabindex?: string | undefined;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
label?: MultiLang;
|
|
14
|
+
warn?: string;
|
|
15
|
+
warnTimeOut?: number;
|
|
16
|
+
size?: 's' | 'm' | 'l';
|
|
17
|
+
uiText?: {
|
|
18
|
+
validError: {
|
|
19
|
+
title: MultiLang;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
declare var __VLS_6: {};
|
|
24
|
+
type __VLS_Slots = {} & {
|
|
25
|
+
default?: (props: typeof __VLS_6) => any;
|
|
26
|
+
};
|
|
27
|
+
declare const __VLS_base: import("vue").DefineComponent<Props, {
|
|
28
|
+
el: import("vue").Ref<any, any>;
|
|
29
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
30
|
+
blur: (elm: HTMLElement) => any;
|
|
31
|
+
focus: (elm: HTMLElement) => any;
|
|
32
|
+
keydown: (event: KeyboardEvent) => any;
|
|
33
|
+
keyup: (event: KeyboardEvent) => any;
|
|
34
|
+
ref: (element: HTMLElement) => any;
|
|
35
|
+
"update:data": (value: boolean) => any;
|
|
36
|
+
"value-change": (after: boolean, before: boolean | null) => any;
|
|
37
|
+
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
38
|
+
onBlur?: ((elm: HTMLElement) => any) | undefined;
|
|
39
|
+
onFocus?: ((elm: HTMLElement) => any) | undefined;
|
|
40
|
+
onKeydown?: ((event: KeyboardEvent) => any) | undefined;
|
|
41
|
+
onKeyup?: ((event: KeyboardEvent) => any) | undefined;
|
|
42
|
+
onRef?: ((element: HTMLElement) => any) | undefined;
|
|
43
|
+
"onUpdate:data"?: ((value: boolean) => any) | undefined;
|
|
44
|
+
"onValue-change"?: ((after: boolean, before: boolean | null) => any) | undefined;
|
|
45
|
+
}>, {
|
|
46
|
+
size: "s" | "m" | "l";
|
|
47
|
+
image: boolean;
|
|
48
|
+
disabled: boolean;
|
|
49
|
+
warn: string;
|
|
50
|
+
imgUrl: string | null;
|
|
51
|
+
classImg: ClassType;
|
|
52
|
+
classImgTag: ClassType;
|
|
53
|
+
classLabel: ClassType;
|
|
54
|
+
diff: boolean | null;
|
|
55
|
+
tabindex: string;
|
|
56
|
+
label: MultiLang;
|
|
57
|
+
warnTimeOut: number;
|
|
58
|
+
uiText: {
|
|
59
|
+
validError: {
|
|
60
|
+
title: MultiLang;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
64
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
65
|
+
declare const _default: typeof __VLS_export;
|
|
66
|
+
export default _default;
|
|
67
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
68
|
+
new (): {
|
|
69
|
+
$slots: S;
|
|
70
|
+
};
|
|
71
|
+
};
|