nuxt-hs-ui 1.0.10 → 2.0.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 +11 -4
- package/dist/module.d.mts +10 -2
- package/dist/module.d.ts +10 -2
- package/dist/module.json +5 -2
- package/dist/module.mjs +90 -51
- package/dist/runtime/assets/flatpickr-dark.css +1 -0
- package/dist/runtime/assets/flatpickr-month-select-style.css +1 -0
- package/dist/runtime/assets/tabulator-custom.css +1 -0
- package/dist/runtime/assets/tabulator.css +1 -0
- package/dist/runtime/assets/vue-select.css +1 -0
- package/dist/runtime/components/{hs-fc/btn/line-loading.vue → form/btn-line-loading.vue} +28 -42
- package/dist/runtime/components/form/btn.vue +488 -0
- package/dist/runtime/components/form/check-box.vue +352 -0
- package/dist/runtime/components/form/check-list.vue +354 -0
- package/dist/runtime/components/form/datepicker copy.vue +770 -0
- package/dist/runtime/components/form/datepicker.vue +897 -0
- package/dist/runtime/components/form/input-frame.vue +272 -0
- package/dist/runtime/components/form/radio.vue +685 -0
- package/dist/runtime/components/form/select-img-icon.vue +53 -0
- package/dist/runtime/components/form/select.vue +438 -0
- package/dist/runtime/components/form/text-box.vue +375 -0
- package/dist/runtime/components/form/textarea.vue +466 -0
- package/dist/runtime/components/form/value-box.vue +681 -0
- package/dist/runtime/components/interactive/alert.vue +113 -0
- package/dist/runtime/components/{hs-ui → interactive}/block-loading.vue +42 -59
- package/dist/runtime/components/{hs-ui/dialog/index.vue → interactive/dialog.vue} +132 -127
- package/dist/runtime/components/interactive/modal-bg.vue +82 -0
- package/dist/runtime/components/interactive/modal.vue +143 -0
- package/dist/runtime/components/{hs-ui/toast/index.vue → interactive/toast.vue} +76 -109
- package/dist/runtime/components/{hs-ui → interactive}/window-loader.vue +12 -9
- package/dist/runtime/components/{hs-ui → layout}/accordion.vue +21 -30
- package/dist/runtime/components/layout/aspect-box.vue +71 -0
- package/dist/runtime/components/layout/card-item.vue +193 -0
- package/dist/runtime/components/layout/card.vue +42 -0
- package/dist/runtime/components/layout/container.vue +40 -0
- package/dist/runtime/components/misc/breadcrumb.vue +96 -0
- package/dist/runtime/components/misc/tabulator.vue +187 -0
- package/dist/runtime/components/misc/view-name-display-target.vue +39 -0
- package/dist/runtime/components/misc/view-name-display.vue +90 -0
- package/dist/runtime/composables/use-hs-dialog.d.ts +40 -0
- package/dist/runtime/composables/{use-hs-ui-dialog.js → use-hs-dialog.js} +15 -10
- package/dist/runtime/composables/{use-hs-form-focus.d.ts → use-hs-focus.d.ts} +1 -1
- package/dist/runtime/composables/{use-hs-form-focus.js → use-hs-focus.js} +2 -4
- package/dist/runtime/composables/use-hs-misc.d.ts +22 -0
- package/dist/runtime/composables/use-hs-misc.js +62 -0
- package/dist/runtime/composables/use-hs-modal.d.ts +31 -0
- package/dist/runtime/{components/hs-ui/modal/use-ui-modal.js → composables/use-hs-modal.js} +18 -16
- package/dist/runtime/composables/use-hs-multi-lang.d.ts +14 -6
- package/dist/runtime/composables/use-hs-multi-lang.js +44 -11
- package/dist/runtime/composables/{use-hs-ui-toast.d.ts → use-hs-toast.d.ts} +3 -3
- package/dist/runtime/composables/{use-hs-ui-toast.js → use-hs-toast.js} +4 -5
- package/dist/runtime/composables/{use-hs-ui-window-loader.d.ts → use-hs-window-loader.d.ts} +1 -1
- package/dist/runtime/composables/{use-hs-ui-window-loader.js → use-hs-window-loader.js} +1 -2
- package/dist/runtime/plugin/v-select.d.ts +2 -0
- package/dist/runtime/plugin/v-select.js +5 -0
- package/dist/runtime/style.css +22 -1
- package/dist/runtime/tailwind.css +78 -0
- package/dist/runtime/types/app.config.d.ts +5 -0
- package/dist/runtime/{components/hs-ui/dialog/index.type.d.ts → types/dialog.d.ts} +3 -3
- package/dist/runtime/{components/hs-ui/toast/index.type.d.ts → types/toast.d.ts} +1 -2
- package/dist/runtime/{components/hs-ui/toast/index.type.js → types/toast.js} +0 -1
- package/dist/runtime/utils/class-style.d.ts +6 -0
- package/dist/runtime/utils/class-style.js +27 -0
- package/dist/runtime/utils/com.d.ts +6 -0
- package/dist/runtime/{lib → utils}/com.js +1 -4
- package/dist/runtime/utils/dayjs.d.ts +53 -0
- package/dist/runtime/utils/dayjs.js +124 -0
- package/dist/runtime/utils/float.d.ts +2 -0
- package/dist/runtime/utils/float.js +35 -0
- package/dist/runtime/utils/multi-lang-object.d.ts +17 -0
- package/dist/runtime/utils/multi-lang-object.js +34 -0
- package/dist/runtime/{lib → utils}/multi-lang.d.ts +1 -1
- package/dist/runtime/{lib → utils}/multi-lang.js +31 -27
- package/dist/runtime/{lib → utils}/number.d.ts +2 -4
- package/dist/runtime/{lib → utils}/number.js +29 -69
- package/dist/runtime/utils/object.d.ts +46 -0
- package/dist/runtime/utils/object.js +107 -0
- package/dist/runtime/utils/select-item.d.ts +31 -0
- package/dist/runtime/utils/select.d.ts +14 -0
- package/dist/runtime/utils/select.js +36 -0
- package/dist/runtime/utils/string.d.ts +39 -0
- package/dist/runtime/utils/string.js +125 -0
- package/dist/runtime/utils/tabulator.d.ts +108 -0
- package/dist/runtime/utils/tabulator.js +296 -0
- package/dist/runtime/utils/theme.d.ts +21 -0
- package/dist/runtime/utils/theme.js +31 -0
- package/dist/runtime/utils/tv.d.ts +101 -0
- package/dist/runtime/utils/tv.js +26 -0
- package/dist/runtime/utils/wareki.d.ts +3 -0
- package/dist/runtime/utils/wareki.js +106 -0
- package/dist/types.d.mts +1 -17
- package/dist/types.d.ts +1 -17
- package/package.json +99 -37
- package/dist/runtime/components/hs-fc/btn/index.vue +0 -510
- package/dist/runtime/components/hs-ui/aspect-box.vue +0 -83
- package/dist/runtime/components/hs-ui/card-item.vue +0 -141
- package/dist/runtime/components/hs-ui/card.vue +0 -54
- package/dist/runtime/components/hs-ui/container.vue +0 -50
- package/dist/runtime/components/hs-ui/modal/bg.vue +0 -94
- package/dist/runtime/components/hs-ui/modal/index.vue +0 -206
- package/dist/runtime/components/hs-ui/modal/use-ui-modal.d.ts +0 -20
- package/dist/runtime/components/v-test.vue +0 -60
- package/dist/runtime/composables/use-hs-ui-dialog.d.ts +0 -22
- package/dist/runtime/lib/class-style.d.ts +0 -8
- package/dist/runtime/lib/class-style.js +0 -59
- package/dist/runtime/lib/com.d.ts +0 -14
- package/dist/runtime/lib/prefix.d.ts +0 -2
- package/dist/runtime/lib/prefix.js +0 -17
- package/dist/runtime/lib/theme.d.ts +0 -2
- package/dist/runtime/lib/theme.js +0 -21
- /package/dist/runtime/{components/hs-ui/dialog/index.type.js → types/dialog.js} +0 -0
- /package/dist/runtime/{components/hs-fc/hoge → utils/select-item.js} +0 -0
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/* ----------------------------------------------------------------------------
|
|
3
|
+
// src\runtime\components\form\btn.vue
|
|
4
|
+
// ----------------------------------------------------------------------------
|
|
5
|
+
// Btn
|
|
6
|
+
// BtnBtn
|
|
7
|
+
----------------------------------------------------------------------------- */
|
|
8
|
+
|
|
9
|
+
// [ utils ]
|
|
10
|
+
import { tv } from "../../utils/tv";
|
|
11
|
+
import { Theme } from "../../utils/theme";
|
|
12
|
+
import { ObjectKeyToMap } from "../../utils/object";
|
|
13
|
+
// ----------------------------------------------------------------------------
|
|
14
|
+
const buttonTv = tv({
|
|
15
|
+
slots: {
|
|
16
|
+
base: [
|
|
17
|
+
//
|
|
18
|
+
`inline-flex items-center`,
|
|
19
|
+
`rounded`,
|
|
20
|
+
"touch-manipulation ",
|
|
21
|
+
`min-w-0 overflow-hidden`,
|
|
22
|
+
],
|
|
23
|
+
indicator: [
|
|
24
|
+
"pointer-events-none",
|
|
25
|
+
`absolute transition-all`,
|
|
26
|
+
`border rounded`,
|
|
27
|
+
`hover:opacity-60`,
|
|
28
|
+
"border-[1px] inset-[-2px] rounded",
|
|
29
|
+
],
|
|
30
|
+
overlay: [
|
|
31
|
+
"pointer-events-none",
|
|
32
|
+
"will-change-transform",
|
|
33
|
+
`absolute inset-0`,
|
|
34
|
+
"bg-white",
|
|
35
|
+
"transition-[opacity_100ms_ease]",
|
|
36
|
+
"z-10",
|
|
37
|
+
"opacity-0",
|
|
38
|
+
],
|
|
39
|
+
body: [
|
|
40
|
+
//
|
|
41
|
+
"min-w-0 flex-1",
|
|
42
|
+
"pointer-events-none",
|
|
43
|
+
"select-none",
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
variants: {
|
|
47
|
+
size: {
|
|
48
|
+
xs: { base: ["text-[14px] leading-[1.4em] min-h-[32px]"] },
|
|
49
|
+
s: { base: ["text-[14px] leading-[1.5em] min-h-[38px]"] },
|
|
50
|
+
m: { base: ["text-[16px] leading-[1.5em] min-h-[48px]"] },
|
|
51
|
+
l: { base: ["text-[1.2rem] leading-[1.6em] min-h-[60px]"] },
|
|
52
|
+
xl: { base: ["text-[1.4rem] leading-[1.6em] min-h-[70px]"] },
|
|
53
|
+
},
|
|
54
|
+
textAlign: {
|
|
55
|
+
left: {
|
|
56
|
+
base: "justify-start",
|
|
57
|
+
body: "text-left ",
|
|
58
|
+
},
|
|
59
|
+
center: {
|
|
60
|
+
base: "justify-center",
|
|
61
|
+
body: "text-center",
|
|
62
|
+
},
|
|
63
|
+
right: {
|
|
64
|
+
base: "justify-end",
|
|
65
|
+
body: "text-end",
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
wrap: {
|
|
69
|
+
true: {
|
|
70
|
+
body: "text-wrap whitespace-pre-wrap text-ellipsis overflow-hidden",
|
|
71
|
+
},
|
|
72
|
+
false: { body: "truncate" },
|
|
73
|
+
},
|
|
74
|
+
disabled: {
|
|
75
|
+
true: {
|
|
76
|
+
base: "cursor-default",
|
|
77
|
+
// overlay: "opacity-40",
|
|
78
|
+
},
|
|
79
|
+
false: {
|
|
80
|
+
base: "cursor-pointer",
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
flash: {
|
|
84
|
+
true: "",
|
|
85
|
+
false: "",
|
|
86
|
+
},
|
|
87
|
+
focus: {
|
|
88
|
+
true: "",
|
|
89
|
+
false: "",
|
|
90
|
+
},
|
|
91
|
+
hover: {
|
|
92
|
+
true: "",
|
|
93
|
+
false: "",
|
|
94
|
+
},
|
|
95
|
+
variant: {
|
|
96
|
+
outlined: {
|
|
97
|
+
base: "py-1 px-2 border-[2px]",
|
|
98
|
+
indicator: "hover:border-[2px] ",
|
|
99
|
+
},
|
|
100
|
+
flat: {
|
|
101
|
+
base: "py-1 px-2 border",
|
|
102
|
+
indicator: "hover:border-[2px] ",
|
|
103
|
+
},
|
|
104
|
+
text: {
|
|
105
|
+
base: "border-0 min-h-0 h-auto no-underline",
|
|
106
|
+
indicator: "border-0",
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
theme: ObjectKeyToMap(Theme, ""),
|
|
110
|
+
},
|
|
111
|
+
defaultVariants: {
|
|
112
|
+
size: "m",
|
|
113
|
+
variant: "outlined",
|
|
114
|
+
theme: "accent1",
|
|
115
|
+
textAlign: "center",
|
|
116
|
+
},
|
|
117
|
+
compoundVariants: [
|
|
118
|
+
{
|
|
119
|
+
flash: true,
|
|
120
|
+
disabled: false,
|
|
121
|
+
class: {
|
|
122
|
+
overlay: "opacity-40",
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
flash: false,
|
|
127
|
+
disabled: false,
|
|
128
|
+
class: {
|
|
129
|
+
overlay: "opacity-0",
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
{
|
|
134
|
+
variant: "text",
|
|
135
|
+
disabled: false,
|
|
136
|
+
class: {
|
|
137
|
+
base: "hover:underline",
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
variant: ["outlined", "flat"],
|
|
142
|
+
focus: true,
|
|
143
|
+
hover: [true, false],
|
|
144
|
+
disabled: false,
|
|
145
|
+
class: {
|
|
146
|
+
indicator: " border-[3px] inset-[2px] rounded opacity-50",
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
variant: ["outlined", "flat"],
|
|
151
|
+
focus: false,
|
|
152
|
+
hover: true,
|
|
153
|
+
disabled: false,
|
|
154
|
+
class: {
|
|
155
|
+
indicator: "border-[2px] inset-[2px] rounded",
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
variant: ["text"],
|
|
160
|
+
focus: true,
|
|
161
|
+
hover: [false],
|
|
162
|
+
disabled: false,
|
|
163
|
+
class: {
|
|
164
|
+
base: "underline decoration-dotted",
|
|
165
|
+
indicator: "",
|
|
166
|
+
overlay: "opacity-0",
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
...Object.keys(Theme).map((theme) => {
|
|
170
|
+
return {
|
|
171
|
+
theme: theme,
|
|
172
|
+
variant: "flat",
|
|
173
|
+
class: {
|
|
174
|
+
base: [
|
|
175
|
+
`bg-[var(--main-color)] border-[var(--main-color)]`,
|
|
176
|
+
["back", "white", "warn"].includes(theme)
|
|
177
|
+
? `text-black `
|
|
178
|
+
: "text-white ",
|
|
179
|
+
],
|
|
180
|
+
indicator: ["back", "white"].includes(theme)
|
|
181
|
+
? `border-gray-500`
|
|
182
|
+
: "border-white",
|
|
183
|
+
},
|
|
184
|
+
} as any;
|
|
185
|
+
}),
|
|
186
|
+
...Object.keys(Theme).map((theme) => {
|
|
187
|
+
return {
|
|
188
|
+
theme: theme,
|
|
189
|
+
variant: "outlined",
|
|
190
|
+
class: {
|
|
191
|
+
base: [
|
|
192
|
+
"bg-transparent",
|
|
193
|
+
`text-[var(--main-color)] border-[var(--main-color)]`,
|
|
194
|
+
],
|
|
195
|
+
indicator: ["border-current"],
|
|
196
|
+
},
|
|
197
|
+
} as any;
|
|
198
|
+
}),
|
|
199
|
+
...Object.keys(Theme).map((theme) => {
|
|
200
|
+
return {
|
|
201
|
+
theme: theme,
|
|
202
|
+
variant: "text",
|
|
203
|
+
class: {
|
|
204
|
+
base: ["bg-transparent", `text-[var(--main-color)]`],
|
|
205
|
+
indicator: [],
|
|
206
|
+
},
|
|
207
|
+
} as any;
|
|
208
|
+
}),
|
|
209
|
+
// disable
|
|
210
|
+
{
|
|
211
|
+
flash: [false, true],
|
|
212
|
+
variant: ["flat"],
|
|
213
|
+
disabled: true,
|
|
214
|
+
class: {
|
|
215
|
+
base: "",
|
|
216
|
+
overlay: "opacity-50 ",
|
|
217
|
+
},
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
flash: [false, true],
|
|
221
|
+
variant: ["outlined"],
|
|
222
|
+
disabled: true,
|
|
223
|
+
class: {
|
|
224
|
+
base: [
|
|
225
|
+
"bg-transparent",
|
|
226
|
+
`text-[var(--main-color)] border-[var(--main-color-opacity-50)]`,
|
|
227
|
+
],
|
|
228
|
+
overlay: "opacity-50 ",
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
flash: [false, true],
|
|
233
|
+
variant: ["text"],
|
|
234
|
+
disabled: true,
|
|
235
|
+
class: {
|
|
236
|
+
base: "text-[var(--main-color-opacity-50)] ",
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
],
|
|
240
|
+
});
|
|
241
|
+
</script>
|
|
242
|
+
<script setup lang="ts">
|
|
243
|
+
// ----------------------------------------------------------------------------
|
|
244
|
+
// [ vueuse ]
|
|
245
|
+
import { useElementHover } from "@vueuse/core";
|
|
246
|
+
// [ NUXT ]
|
|
247
|
+
import { ref, computed, useId } from "#imports";
|
|
248
|
+
// [ utils ]
|
|
249
|
+
import { Dayjs } from "../../utils/dayjs";
|
|
250
|
+
import { type ClassType, ClassTypeToString } from "../../utils/class-style";
|
|
251
|
+
import { GetGolorCode } from "../../utils/theme";
|
|
252
|
+
import { Sleep } from "../../utils/com";
|
|
253
|
+
// [ composables ]
|
|
254
|
+
import { useHsFocus } from "../../composables/use-hs-focus";
|
|
255
|
+
|
|
256
|
+
import BtnLineLoading from "./btn-line-loading.vue";
|
|
257
|
+
// ----------------------------------------------------------------------------
|
|
258
|
+
// ----------------------------------------------------------------------------
|
|
259
|
+
interface Props {
|
|
260
|
+
class?: ClassType;
|
|
261
|
+
classInner?: ClassType;
|
|
262
|
+
disabled?: boolean;
|
|
263
|
+
to?: string;
|
|
264
|
+
theme?: Theme;
|
|
265
|
+
variant?: "outlined" | "flat" | "text";
|
|
266
|
+
textWrap?: boolean;
|
|
267
|
+
textAlign?: "left" | "center" | "right";
|
|
268
|
+
loading?: boolean;
|
|
269
|
+
noneFocusLine?: boolean;
|
|
270
|
+
wrap?: boolean;
|
|
271
|
+
// ----------------------------------------------------------------------------
|
|
272
|
+
// 設定
|
|
273
|
+
size?: "xs" | "s" | "m" | "l" | "xl";
|
|
274
|
+
}
|
|
275
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
276
|
+
class: "",
|
|
277
|
+
classInner: "",
|
|
278
|
+
to: undefined,
|
|
279
|
+
theme: "accent1",
|
|
280
|
+
variant: "outlined",
|
|
281
|
+
disabled: false,
|
|
282
|
+
textWrap: false,
|
|
283
|
+
align: "center",
|
|
284
|
+
loading: false,
|
|
285
|
+
textAlign: "center",
|
|
286
|
+
noneFocusLine: false,
|
|
287
|
+
wrap: false,
|
|
288
|
+
// ----------------------------------------------------------------------------
|
|
289
|
+
// 設定
|
|
290
|
+
size: "m",
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
type InputFocusEventArg = {
|
|
294
|
+
elm: HTMLElement;
|
|
295
|
+
id: string;
|
|
296
|
+
};
|
|
297
|
+
type Emits = {
|
|
298
|
+
id: [id: string];
|
|
299
|
+
ref: [element: HTMLElement];
|
|
300
|
+
focus: [e: InputFocusEventArg];
|
|
301
|
+
blur: [e: InputFocusEventArg];
|
|
302
|
+
};
|
|
303
|
+
const emit = defineEmits<Emits>();
|
|
304
|
+
// ----------------------------------------------------------------------------
|
|
305
|
+
const fcFocus = useHsFocus();
|
|
306
|
+
|
|
307
|
+
const uid = useId();
|
|
308
|
+
emit("id", uid);
|
|
309
|
+
// ----------------------------------------------------------------------------
|
|
310
|
+
// ----------------------------------------------------------------------------
|
|
311
|
+
|
|
312
|
+
const styleMain = computed(() => {
|
|
313
|
+
return [
|
|
314
|
+
//
|
|
315
|
+
`--main-color:${GetGolorCode(props.theme)};`,
|
|
316
|
+
`--main-color-opacity-50:${GetGolorCode(props.theme)}88;`,
|
|
317
|
+
`--sub-color:${GetGolorCode(props.theme)};`,
|
|
318
|
+
];
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
const classStyle = computed(() => {
|
|
322
|
+
return btnTvBase.value;
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
// ----------------------------------------------------------------------------
|
|
326
|
+
// disabled
|
|
327
|
+
const disabled = computed(() => {
|
|
328
|
+
if (props.disabled) return true;
|
|
329
|
+
if (props.loading) return true;
|
|
330
|
+
return false;
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
// ----------------------------------------------------------------------------
|
|
334
|
+
|
|
335
|
+
// [ focus, blur ]
|
|
336
|
+
const isActivate = ref(false);
|
|
337
|
+
|
|
338
|
+
/** コントロールのFocus判定 */
|
|
339
|
+
const computedActivate = computed(() => {
|
|
340
|
+
if (disabled.value) return;
|
|
341
|
+
if (fcFocus.state.id !== uid) return false;
|
|
342
|
+
if (isActivate.value) return true;
|
|
343
|
+
// if (flashState.value) return true;
|
|
344
|
+
return false;
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
// focus, blur Event
|
|
348
|
+
const imputElm = ref<HTMLElement | null>(null);
|
|
349
|
+
const setRef = (e: any) => {
|
|
350
|
+
imputElm.value = e;
|
|
351
|
+
emit("ref", e);
|
|
352
|
+
};
|
|
353
|
+
const onFocus = () => {
|
|
354
|
+
// console.log("onFocus");
|
|
355
|
+
if (disabled.value) return;
|
|
356
|
+
isActivate.value = true;
|
|
357
|
+
fcFocus.state.id = uid;
|
|
358
|
+
const elm = imputElm.value;
|
|
359
|
+
if (elm === null) return;
|
|
360
|
+
emit("focus", { elm: elm, id: uid });
|
|
361
|
+
};
|
|
362
|
+
const onBlur = () => {
|
|
363
|
+
// console.log("onBlur");
|
|
364
|
+
isActivate.value = false;
|
|
365
|
+
if (fcFocus.state.id === uid) {
|
|
366
|
+
fcFocus.state.id = "";
|
|
367
|
+
}
|
|
368
|
+
if (disabled.value) return;
|
|
369
|
+
const elm = imputElm.value;
|
|
370
|
+
if (elm === null) return;
|
|
371
|
+
emit("blur", { elm: elm, id: uid });
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
// ----------------------------------------------------------------------------
|
|
375
|
+
|
|
376
|
+
const isHovered = useElementHover(imputElm);
|
|
377
|
+
|
|
378
|
+
// ----------------------------------------------------------------------------
|
|
379
|
+
const flash = ref(false);
|
|
380
|
+
const pushOnTs = ref("");
|
|
381
|
+
const pushOn = async (e: any) => {
|
|
382
|
+
if (imputElm.value === null) return;
|
|
383
|
+
if (disabled.value) return;
|
|
384
|
+
const ts = Dayjs().format("");
|
|
385
|
+
pushOnTs.value = ts;
|
|
386
|
+
flash.value = true;
|
|
387
|
+
await Sleep(10000);
|
|
388
|
+
if (pushOnTs.value === ts) {
|
|
389
|
+
flash.value = false;
|
|
390
|
+
}
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
const pushOff = () => {
|
|
394
|
+
flash.value = false;
|
|
395
|
+
// isActivate.value = false;
|
|
396
|
+
if (props.disabled) return true;
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
// ----------------------------------------------------------------------------
|
|
400
|
+
|
|
401
|
+
const ui = computed(() => {
|
|
402
|
+
return buttonTv({
|
|
403
|
+
size: props.size,
|
|
404
|
+
variant: props.variant,
|
|
405
|
+
theme: props.theme,
|
|
406
|
+
wrap: props.wrap,
|
|
407
|
+
textAlign: props.textAlign,
|
|
408
|
+
focus: computedActivate.value,
|
|
409
|
+
flash: flash.value,
|
|
410
|
+
hover: isHovered.value,
|
|
411
|
+
disabled: disabled.value,
|
|
412
|
+
});
|
|
413
|
+
});
|
|
414
|
+
|
|
415
|
+
const btnTvBase = computed(() => {
|
|
416
|
+
return ui.value.base({
|
|
417
|
+
class: ClassTypeToString(props.class),
|
|
418
|
+
});
|
|
419
|
+
});
|
|
420
|
+
|
|
421
|
+
const btnTvIndicator = computed(() => {
|
|
422
|
+
return ui.value.indicator({});
|
|
423
|
+
});
|
|
424
|
+
|
|
425
|
+
const btnTvBody = computed(() => {
|
|
426
|
+
return ui.value.body({});
|
|
427
|
+
});
|
|
428
|
+
|
|
429
|
+
const btnTvOverlay = computed(() => {
|
|
430
|
+
return ui.value.overlay({});
|
|
431
|
+
});
|
|
432
|
+
|
|
433
|
+
// ----------------------------------------------------------------------------
|
|
434
|
+
</script>
|
|
435
|
+
|
|
436
|
+
<template>
|
|
437
|
+
<button
|
|
438
|
+
v-if="props.to === undefined"
|
|
439
|
+
:ref="(e:any) => setRef(e)"
|
|
440
|
+
type="button"
|
|
441
|
+
:class="btnTvBase"
|
|
442
|
+
:style="styleMain"
|
|
443
|
+
:disabled="disabled"
|
|
444
|
+
@focus="onFocus()"
|
|
445
|
+
@blur="onBlur()"
|
|
446
|
+
@mousedown="pushOn"
|
|
447
|
+
@mouseup="pushOff"
|
|
448
|
+
@mouseend="pushOff"
|
|
449
|
+
@touchstart="pushOn"
|
|
450
|
+
@touchend="pushOff"
|
|
451
|
+
@touchcancel="pushOff"
|
|
452
|
+
@keydown.enter="pushOn"
|
|
453
|
+
@keyup.enter="pushOff"
|
|
454
|
+
>
|
|
455
|
+
<div :class="btnTvIndicator"></div>
|
|
456
|
+
<div :class="btnTvOverlay"></div>
|
|
457
|
+
<div :class="btnTvBody">
|
|
458
|
+
<slot />
|
|
459
|
+
</div>
|
|
460
|
+
<BtnLineLoading class="Btn--loading" :show="props.loading" />
|
|
461
|
+
</button>
|
|
462
|
+
<NuxtLink
|
|
463
|
+
v-else
|
|
464
|
+
:ref="(e:any) => setRef(e)"
|
|
465
|
+
:to="disabled ? undefined : props.to"
|
|
466
|
+
:class="classStyle"
|
|
467
|
+
:style="styleMain"
|
|
468
|
+
:disabled="disabled"
|
|
469
|
+
ontouchstart=""
|
|
470
|
+
@focus="onFocus()"
|
|
471
|
+
@blur="onBlur()"
|
|
472
|
+
@mousedown="pushOn"
|
|
473
|
+
@mouseup="pushOff"
|
|
474
|
+
@mouseend="pushOff"
|
|
475
|
+
@touchstart="pushOn"
|
|
476
|
+
@touchend="pushOff"
|
|
477
|
+
@touchcancel="pushOff"
|
|
478
|
+
@keydown.enter="pushOn"
|
|
479
|
+
@keyup.enter="pushOff"
|
|
480
|
+
>
|
|
481
|
+
<div :class="btnTvIndicator"></div>
|
|
482
|
+
<div :class="btnTvOverlay"></div>
|
|
483
|
+
<div :class="btnTvBody">
|
|
484
|
+
<slot />
|
|
485
|
+
</div>
|
|
486
|
+
<BtnLineLoading class="Btn--loading" :show="props.loading" />
|
|
487
|
+
</NuxtLink>
|
|
488
|
+
</template>
|