nuxt-hs-ui 2.12.6 → 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 -26
- 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
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import type { ClassType } from '../../utils/class-style.js';
|
|
2
|
+
import type { MultiLang } from '../../utils/multi-lang.js';
|
|
3
|
+
import { type ThemeColor } from '../../utils/theme.js';
|
|
4
|
+
type Props = {
|
|
5
|
+
theme?: ThemeColor;
|
|
6
|
+
textAlign?: 'left' | 'center' | 'right';
|
|
7
|
+
mode?: 'all' | 'date' | 'time';
|
|
8
|
+
/** mode=time の場合、[HH:mm:ss.SSS] に固定 */
|
|
9
|
+
dataFormat?: string;
|
|
10
|
+
/** mode=time の場合、[HH:mm] に固定 */
|
|
11
|
+
showFormat?: string;
|
|
12
|
+
minDate?: string | null;
|
|
13
|
+
maxDate?: string | null;
|
|
14
|
+
hideDeleteBtn?: boolean;
|
|
15
|
+
hideTodayBtn?: boolean;
|
|
16
|
+
disableMobile?: boolean;
|
|
17
|
+
hasShift?: boolean;
|
|
18
|
+
/** 言語設定
|
|
19
|
+
* * 例 'ja-JP' 'en-US'" */
|
|
20
|
+
locale?: string | undefined;
|
|
21
|
+
portal?: string | false | true | HTMLElement;
|
|
22
|
+
data: string | null;
|
|
23
|
+
diff?: string | null | undefined;
|
|
24
|
+
tabindex?: string | undefined;
|
|
25
|
+
class?: ClassType;
|
|
26
|
+
classHeader?: ClassType;
|
|
27
|
+
classInput?: ClassType;
|
|
28
|
+
focusColor?: string;
|
|
29
|
+
changeColor?: string;
|
|
30
|
+
error?: boolean;
|
|
31
|
+
errorColor?: string;
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
disabledColor?: string;
|
|
34
|
+
readonly?: boolean;
|
|
35
|
+
headerless?: boolean;
|
|
36
|
+
label?: MultiLang;
|
|
37
|
+
require?: boolean;
|
|
38
|
+
requireText?: MultiLang;
|
|
39
|
+
warn?: string;
|
|
40
|
+
warnTimeOut?: number;
|
|
41
|
+
size?: 's' | 'm' | 'l';
|
|
42
|
+
uiText?: {
|
|
43
|
+
error: {
|
|
44
|
+
inputRangeTitle: MultiLang;
|
|
45
|
+
inputRangeMessage: MultiLang;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
type __VLS_Slots = {
|
|
50
|
+
default(props: {
|
|
51
|
+
msg: string;
|
|
52
|
+
}): any;
|
|
53
|
+
overlay?(): any;
|
|
54
|
+
'right-icons'?(): any;
|
|
55
|
+
'left-icons'?(): any;
|
|
56
|
+
'label-prepend'?(): any;
|
|
57
|
+
'label-append'?(): any;
|
|
58
|
+
'header-right'?(): any;
|
|
59
|
+
};
|
|
60
|
+
declare const __VLS_base: import("vue").DefineComponent<Props, {
|
|
61
|
+
el: import("vue").Ref<any, any>;
|
|
62
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
63
|
+
blur: (elm: HTMLElement) => any;
|
|
64
|
+
focus: (elm: HTMLElement) => any;
|
|
65
|
+
ref: (element: HTMLElement) => any;
|
|
66
|
+
"update:data": (value: string | null) => any;
|
|
67
|
+
"value-change": (after: string | null, before: string | null) => any;
|
|
68
|
+
"reset-piceker-func": (func: any) => any;
|
|
69
|
+
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
70
|
+
onBlur?: ((elm: HTMLElement) => any) | undefined;
|
|
71
|
+
onFocus?: ((elm: HTMLElement) => any) | undefined;
|
|
72
|
+
onRef?: ((element: HTMLElement) => any) | undefined;
|
|
73
|
+
"onUpdate:data"?: ((value: string | null) => any) | undefined;
|
|
74
|
+
"onValue-change"?: ((after: string | null, before: string | null) => any) | undefined;
|
|
75
|
+
"onReset-piceker-func"?: ((func: any) => any) | undefined;
|
|
76
|
+
}>, {
|
|
77
|
+
error: boolean;
|
|
78
|
+
size: "s" | "m" | "l";
|
|
79
|
+
disabled: boolean;
|
|
80
|
+
warn: string;
|
|
81
|
+
theme: ThemeColor;
|
|
82
|
+
class: ClassType;
|
|
83
|
+
textAlign: "left" | "center" | "right";
|
|
84
|
+
diff: string | null;
|
|
85
|
+
tabindex: string;
|
|
86
|
+
label: MultiLang;
|
|
87
|
+
warnTimeOut: number;
|
|
88
|
+
uiText: {
|
|
89
|
+
error: {
|
|
90
|
+
inputRangeTitle: MultiLang;
|
|
91
|
+
inputRangeMessage: MultiLang;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
classHeader: ClassType;
|
|
95
|
+
classInput: ClassType;
|
|
96
|
+
focusColor: string;
|
|
97
|
+
changeColor: string;
|
|
98
|
+
errorColor: string;
|
|
99
|
+
disabledColor: string;
|
|
100
|
+
readonly: boolean;
|
|
101
|
+
headerless: boolean;
|
|
102
|
+
require: boolean;
|
|
103
|
+
requireText: MultiLang;
|
|
104
|
+
mode: "all" | "date" | "time";
|
|
105
|
+
dataFormat: string;
|
|
106
|
+
showFormat: string;
|
|
107
|
+
minDate: string | null;
|
|
108
|
+
maxDate: string | null;
|
|
109
|
+
hideDeleteBtn: boolean;
|
|
110
|
+
disableMobile: boolean;
|
|
111
|
+
hasShift: boolean;
|
|
112
|
+
locale: string;
|
|
113
|
+
portal: string | false | true | HTMLElement;
|
|
114
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
115
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
116
|
+
declare const _default: typeof __VLS_export;
|
|
117
|
+
export default _default;
|
|
118
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
119
|
+
new (): {
|
|
120
|
+
$slots: S;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
@@ -1,275 +1,191 @@
|
|
|
1
|
-
<script setup
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
type
|
|
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
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
"
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
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
|
-
if (props.disabled) return true;
|
|
166
|
-
if (props.readonly) return true;
|
|
167
|
-
return false;
|
|
168
|
-
});
|
|
169
|
-
// ----------------------------------------------------------------------------
|
|
170
|
-
const label = computed(() => tx(props.label).value);
|
|
171
|
-
// ----------------------------------------------------------------------------
|
|
172
|
-
const slots = useSlots();
|
|
173
|
-
const hasHeader = computed(() => {
|
|
174
|
-
if (label.value.length !== 0) return true;
|
|
175
|
-
if (props.require && !props.readonly) return true;
|
|
176
|
-
// if (slots.label) return true;
|
|
177
|
-
if (slots["label-prepend"]) return true;
|
|
178
|
-
if (slots["label-append"]) return true;
|
|
179
|
-
if (slots["header-right"]) return true;
|
|
180
|
-
return false;
|
|
181
|
-
});
|
|
182
|
-
// ----------------------------------------------------------------------------
|
|
183
|
-
</script>
|
|
184
|
-
|
|
185
|
-
<template>
|
|
186
|
-
<div ref="el" class="hc-ui-input-frame" :class="baseClass">
|
|
187
|
-
<div
|
|
188
|
-
v-if="$slots['left-icons']"
|
|
189
|
-
class="icons left-icons flex-none"
|
|
190
|
-
:class="iconDisabled ? 'disabled' : ''"
|
|
191
|
-
>
|
|
192
|
-
<slot name="left-icons" :disabled="iconDisabled" />
|
|
193
|
-
</div>
|
|
194
|
-
<div class="flex-1 flex flex-col overflow-hidden justify-start">
|
|
195
|
-
<div
|
|
196
|
-
v-if="hasHeader && !props.headerless"
|
|
197
|
-
class="flex-none flex items-end"
|
|
198
|
-
:class="headerClass"
|
|
199
|
-
>
|
|
200
|
-
<div
|
|
201
|
-
class="hc-input-label grow-0 shrink-1 truncate leading-[1.5em]"
|
|
202
|
-
:title="label"
|
|
203
|
-
@click.stop="emit('header-label-click')"
|
|
204
|
-
>
|
|
205
|
-
<slot name="label-prepend" />{{ label }}<slot name="label-append" />
|
|
206
|
-
</div>
|
|
207
|
-
<div class="flex-1"></div>
|
|
208
|
-
<div class="flex-none flex gap-2">
|
|
209
|
-
<slot name="header-right" :default-class="headerIconClass" />
|
|
210
|
-
<div
|
|
211
|
-
v-if="props.require && !props.readonly"
|
|
212
|
-
:class="headerIconClass"
|
|
213
|
-
class="text-white bg-error"
|
|
214
|
-
>
|
|
215
|
-
<span data-type="require">{{ tx(props.requireText) }}</span>
|
|
216
|
-
</div>
|
|
217
|
-
</div>
|
|
218
|
-
</div>
|
|
219
|
-
<div class="hc-input-body flex-1 flex flex-col justify-center">
|
|
220
|
-
<div :class="inputClass"><slot /></div>
|
|
221
|
-
</div>
|
|
222
|
-
</div>
|
|
223
|
-
<div
|
|
224
|
-
v-if="$slots['right-icons'] || props.warn"
|
|
225
|
-
class="icons right-icons flex-none"
|
|
226
|
-
:class="iconDisabled ? 'disabled' : ''"
|
|
227
|
-
>
|
|
228
|
-
<slot name="right-icons" :disabled="iconDisabled" />
|
|
229
|
-
<div
|
|
230
|
-
v-if="props.warn"
|
|
231
|
-
@click="toast.Warning(props.warn, '', props.warnTimeOut)"
|
|
232
|
-
>
|
|
233
|
-
<i
|
|
234
|
-
class="fa-solid fa-triangle-exclamation text-error cursor-pointer"
|
|
235
|
-
></i>
|
|
236
|
-
</div>
|
|
237
|
-
</div>
|
|
238
|
-
<slot name="overlay"></slot>
|
|
239
|
-
</div>
|
|
240
|
-
</template>
|
|
241
|
-
|
|
242
|
-
<style scoped>
|
|
243
|
-
.icons {
|
|
1
|
+
<script setup>
|
|
2
|
+
import { twMerge } from "tailwind-merge";
|
|
3
|
+
import { computed, useSlots } from "#imports";
|
|
4
|
+
import { ClassTypeToString } from "../../utils/class-style";
|
|
5
|
+
import { useHsToast } from "../../composables/use-hs-toast";
|
|
6
|
+
import { useHsMultiLang } from "../../composables/use-hs-multi-lang";
|
|
7
|
+
import { useHsPinia } from "../../composables/use-pinia";
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
class: { type: [String, Object, Array], required: false, default: "" },
|
|
10
|
+
classHeader: { type: [String, Object, Array], required: false, default: "" },
|
|
11
|
+
classInput: { type: [String, Object, Array], required: false, default: "" },
|
|
12
|
+
focus: { type: Boolean, required: false, default: false },
|
|
13
|
+
focusColor: { type: String, required: false, default: "shadow-[inset_0px_0px_1px_2px_#0d8ee4]" },
|
|
14
|
+
change: { type: Boolean, required: false, default: false },
|
|
15
|
+
changeColor: { type: String, required: false, default: "shadow-[inset_0px_0px_1px_2px_#fd9831be]" },
|
|
16
|
+
error: { type: Boolean, required: false, default: false },
|
|
17
|
+
errorColor: { type: String, required: false, default: "shadow-[inset_0px_0px_1px_2px_#d80000dc]" },
|
|
18
|
+
disabled: { type: Boolean, required: false, default: false },
|
|
19
|
+
disabledColor: { type: String, required: false, default: "" },
|
|
20
|
+
readonly: { type: Boolean, required: false, default: false },
|
|
21
|
+
headerless: { type: Boolean, required: false, default: false },
|
|
22
|
+
label: { type: [String, Object], required: false, default: "" },
|
|
23
|
+
require: { type: Boolean, required: false, default: false },
|
|
24
|
+
requireText: { type: [String, Object], required: false, default: () => ({ ja: "\u5FC5\u9808", en: "Required" }) },
|
|
25
|
+
warn: { type: String, required: false, default: "" },
|
|
26
|
+
warnTimeOut: { type: Number, required: false, default: 3e3 },
|
|
27
|
+
size: { type: String, required: false, default: "m" }
|
|
28
|
+
});
|
|
29
|
+
const emit = defineEmits(["header-label-click", "ref", "focus"]);
|
|
30
|
+
const toast = useHsToast(useHsPinia());
|
|
31
|
+
const multiLang = useHsMultiLang(useHsPinia());
|
|
32
|
+
const tx = multiLang.tx;
|
|
33
|
+
const baseClass = computed(() => {
|
|
34
|
+
return [
|
|
35
|
+
twMerge(
|
|
36
|
+
//
|
|
37
|
+
"flex max-w-full relative",
|
|
38
|
+
"border-[1px] border-[#183C5E]",
|
|
39
|
+
"bg-white",
|
|
40
|
+
"min-w-[100px]",
|
|
41
|
+
props.size === "s" ? "min-h-[44px]" : "",
|
|
42
|
+
props.size === "m" ? "min-h-[48px]" : "",
|
|
43
|
+
props.size === "l" ? "min-h-[60px]" : "",
|
|
44
|
+
props.change ? props.changeColor : "",
|
|
45
|
+
props.error ? props.errorColor : "",
|
|
46
|
+
props.warn ? props.errorColor : "",
|
|
47
|
+
props.focus ? props.focusColor : "",
|
|
48
|
+
props.disabled ? "shadow-none bg-slate-300" : "",
|
|
49
|
+
props.disabled ? props.disabledColor : "",
|
|
50
|
+
props.readonly ? "shadow-none bg-transparent " : "",
|
|
51
|
+
ClassTypeToString(props.class)
|
|
52
|
+
),
|
|
53
|
+
props.disabled ? "disabled " : "",
|
|
54
|
+
props.readonly ? "readonly " : ""
|
|
55
|
+
];
|
|
56
|
+
});
|
|
57
|
+
const headerClass = computed(() => {
|
|
58
|
+
return [
|
|
59
|
+
twMerge(
|
|
60
|
+
//
|
|
61
|
+
"px-1",
|
|
62
|
+
"overflow-hidden",
|
|
63
|
+
"text-[#996655]",
|
|
64
|
+
props.size === "s" ? "h-[18px] text-[12px]" : "",
|
|
65
|
+
props.size === "m" ? "h-[20px] text-[14px]" : "",
|
|
66
|
+
props.size === "l" ? "h-[22px] text-[15px]" : "",
|
|
67
|
+
ClassTypeToString(props.classHeader)
|
|
68
|
+
)
|
|
69
|
+
];
|
|
70
|
+
});
|
|
71
|
+
const headerIconClass = computed(() => {
|
|
72
|
+
return [
|
|
73
|
+
twMerge(
|
|
74
|
+
//
|
|
75
|
+
props.size === "s" ? "text-[12px] rounded leading-[12px] px-[2px] py-[2px]" : "",
|
|
76
|
+
props.size === "m" ? "text-[13px] rounded leading-[13px] px-[2px] py-[2px]" : "",
|
|
77
|
+
props.size === "l" ? "text-[14px] rounded leading-[14px] px-[2px] py-[3px]" : ""
|
|
78
|
+
)
|
|
79
|
+
];
|
|
80
|
+
});
|
|
81
|
+
const inputClass = computed(() => {
|
|
82
|
+
return [
|
|
83
|
+
twMerge(
|
|
84
|
+
"px-1",
|
|
85
|
+
"truncate relative",
|
|
86
|
+
"flex items-center",
|
|
87
|
+
"text-black",
|
|
88
|
+
props.disabled ? "text-gray-600 " : "",
|
|
89
|
+
// props.readonly ? 'text-black' : '',
|
|
90
|
+
"w-full",
|
|
91
|
+
// 'max-w-full max-h-full w-full',
|
|
92
|
+
props.size === "s" ? "text-[16px]" : "",
|
|
93
|
+
props.size === "m" ? "text-[16px]" : "",
|
|
94
|
+
props.size === "l" ? "text-[20px]" : "",
|
|
95
|
+
ClassTypeToString(props.classInput)
|
|
96
|
+
)
|
|
97
|
+
];
|
|
98
|
+
});
|
|
99
|
+
const iconDisabled = computed(() => {
|
|
100
|
+
if (props.disabled) return true;
|
|
101
|
+
if (props.readonly) return true;
|
|
102
|
+
return false;
|
|
103
|
+
});
|
|
104
|
+
const label = computed(() => tx(props.label).value);
|
|
105
|
+
const slots = useSlots();
|
|
106
|
+
const hasHeader = computed(() => {
|
|
107
|
+
if (label.value) return true;
|
|
108
|
+
if (props.require && !props.readonly) return true;
|
|
109
|
+
if (slots["label-prepend"]) return true;
|
|
110
|
+
if (slots["label-append"]) return true;
|
|
111
|
+
if (slots["header-right"]) return true;
|
|
112
|
+
return false;
|
|
113
|
+
});
|
|
114
|
+
const setRef = (e) => {
|
|
115
|
+
emit("ref", e);
|
|
116
|
+
};
|
|
117
|
+
</script>
|
|
118
|
+
|
|
119
|
+
<template>
|
|
120
|
+
<div :ref="(e) => setRef(e)" class="hc-ui-input-frame" :class="baseClass">
|
|
121
|
+
<div
|
|
122
|
+
v-if="$slots['left-icons']"
|
|
123
|
+
class="icons left-icons flex-none text-accent1 relative"
|
|
124
|
+
:class="iconDisabled ? 'disabled' : ''"
|
|
125
|
+
>
|
|
126
|
+
<slot name="left-icons" :disabled="iconDisabled" />
|
|
127
|
+
</div>
|
|
128
|
+
<div class="flex-1 flex flex-col overflow-hidden justify-start relative">
|
|
129
|
+
<div v-if="hasHeader && !props.headerless" class="flex-none flex items-end relative" :class="headerClass">
|
|
130
|
+
<div
|
|
131
|
+
class="hc-input-label grow-0 shrink truncate leading-[1.5em] relative"
|
|
132
|
+
:title="label"
|
|
133
|
+
@click="emit('header-label-click')"
|
|
134
|
+
>
|
|
135
|
+
<slot name="label-prepend" />{{ label }}<slot name="label-append" />
|
|
136
|
+
</div>
|
|
137
|
+
<div class="flex-1"></div>
|
|
138
|
+
<div class="flex-none flex gap-2 relative">
|
|
139
|
+
<slot name="header-right" :default-class="headerIconClass" />
|
|
140
|
+
<div v-if="props.require && !props.readonly" :class="headerIconClass" class="text-white bg-error">
|
|
141
|
+
<span data-type="require">{{ tx(props.requireText) }}</span>
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
<div class="hc-input-body flex-1 flex flex-col justify-center relative">
|
|
146
|
+
<div :class="inputClass"><slot name="default" :focus="props.focus" :change="props.change" /></div>
|
|
147
|
+
</div>
|
|
148
|
+
</div>
|
|
149
|
+
<div
|
|
150
|
+
v-if="$slots['right-icons'] || props.warn"
|
|
151
|
+
class="icons right-icons flex-none relative"
|
|
152
|
+
:class="iconDisabled ? 'disabled' : ''"
|
|
153
|
+
>
|
|
154
|
+
<slot name="right-icons" :disabled="iconDisabled" />
|
|
155
|
+
<div v-if="props.warn" class="relative" @click="toast.Warning(props.warn, '', props.warnTimeOut)">
|
|
156
|
+
<i class="fa-solid fa-triangle-exclamation text-error cursor-pointer"></i>
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
<slot name="overlay" :focus="props.focus" :change="props.change"></slot>
|
|
160
|
+
</div>
|
|
161
|
+
</template>
|
|
162
|
+
|
|
163
|
+
<style>
|
|
164
|
+
.hc-ui-input-frame .icons {
|
|
244
165
|
display: flex;
|
|
166
|
+
align-items: center;
|
|
245
167
|
}
|
|
246
|
-
.icons > * {
|
|
168
|
+
.hc-ui-input-frame .icons > * {
|
|
169
|
+
position: relative;
|
|
247
170
|
height: 100%;
|
|
248
171
|
min-width: 2em;
|
|
249
172
|
display: flex;
|
|
250
173
|
justify-content: center;
|
|
251
174
|
align-items: center;
|
|
252
|
-
color: theme("colors.accent1");
|
|
253
175
|
}
|
|
254
|
-
.icons > *::after {
|
|
176
|
+
.hc-ui-input-frame .icons > *::after {
|
|
255
177
|
content: "";
|
|
256
178
|
width: 1px;
|
|
257
179
|
position: absolute;
|
|
258
|
-
background-color:
|
|
180
|
+
background-color: #9faab3;
|
|
259
181
|
}
|
|
260
|
-
.icons.disabled > * {
|
|
261
|
-
color:
|
|
182
|
+
.hc-ui-input-frame .icons.disabled > * {
|
|
183
|
+
color: #224466;
|
|
262
184
|
}
|
|
263
|
-
|
|
264
|
-
.left-icons > *::after {
|
|
185
|
+
.hc-ui-input-frame .left-icons > *::after {
|
|
265
186
|
inset: 2px 0 2px auto;
|
|
266
187
|
}
|
|
267
|
-
|
|
268
|
-
.right-icons > *::after {
|
|
188
|
+
.hc-ui-input-frame .right-icons > *::after {
|
|
269
189
|
inset: 2px auto 2px 0;
|
|
270
190
|
}
|
|
271
|
-
|
|
272
|
-
.hc-ui-input-frame {
|
|
273
|
-
min-width: 100px;
|
|
274
|
-
}
|
|
275
|
-
</style>
|
|
191
|
+
</style>
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { type ClassType } from '../../utils/class-style.js';
|
|
2
|
+
import type { MultiLang } from '../../utils/multi-lang.js';
|
|
3
|
+
type Props = {
|
|
4
|
+
class?: ClassType;
|
|
5
|
+
classHeader?: ClassType;
|
|
6
|
+
classInput?: ClassType;
|
|
7
|
+
focus?: boolean;
|
|
8
|
+
focusColor?: string;
|
|
9
|
+
change?: boolean;
|
|
10
|
+
changeColor?: string;
|
|
11
|
+
error?: boolean;
|
|
12
|
+
errorColor?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
disabledColor?: string;
|
|
15
|
+
readonly?: boolean;
|
|
16
|
+
headerless?: boolean;
|
|
17
|
+
label?: MultiLang;
|
|
18
|
+
require?: boolean;
|
|
19
|
+
requireText?: MultiLang;
|
|
20
|
+
warn?: string;
|
|
21
|
+
warnTimeOut?: number;
|
|
22
|
+
size?: 's' | 'm' | 'l';
|
|
23
|
+
};
|
|
24
|
+
declare var __VLS_1: {
|
|
25
|
+
disabled: any;
|
|
26
|
+
}, __VLS_3: {}, __VLS_5: {}, __VLS_7: {
|
|
27
|
+
defaultClass: any;
|
|
28
|
+
}, __VLS_9: {
|
|
29
|
+
focus: boolean;
|
|
30
|
+
change: boolean;
|
|
31
|
+
}, __VLS_11: {
|
|
32
|
+
disabled: any;
|
|
33
|
+
}, __VLS_13: {
|
|
34
|
+
focus: boolean;
|
|
35
|
+
change: boolean;
|
|
36
|
+
};
|
|
37
|
+
type __VLS_Slots = {} & {
|
|
38
|
+
'left-icons'?: (props: typeof __VLS_1) => any;
|
|
39
|
+
} & {
|
|
40
|
+
'label-prepend'?: (props: typeof __VLS_3) => any;
|
|
41
|
+
} & {
|
|
42
|
+
'label-append'?: (props: typeof __VLS_5) => any;
|
|
43
|
+
} & {
|
|
44
|
+
'header-right'?: (props: typeof __VLS_7) => any;
|
|
45
|
+
} & {
|
|
46
|
+
default?: (props: typeof __VLS_9) => any;
|
|
47
|
+
} & {
|
|
48
|
+
'right-icons'?: (props: typeof __VLS_11) => any;
|
|
49
|
+
} & {
|
|
50
|
+
overlay?: (props: typeof __VLS_13) => any;
|
|
51
|
+
};
|
|
52
|
+
declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
53
|
+
focus: (flag: boolean) => any;
|
|
54
|
+
ref: (elm: HTMLElement) => any;
|
|
55
|
+
"header-label-click": () => any;
|
|
56
|
+
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
57
|
+
onFocus?: ((flag: boolean) => any) | undefined;
|
|
58
|
+
onRef?: ((elm: HTMLElement) => any) | undefined;
|
|
59
|
+
"onHeader-label-click"?: (() => any) | undefined;
|
|
60
|
+
}>, {
|
|
61
|
+
change: boolean;
|
|
62
|
+
error: boolean;
|
|
63
|
+
focus: boolean;
|
|
64
|
+
size: "s" | "m" | "l";
|
|
65
|
+
disabled: boolean;
|
|
66
|
+
warn: string;
|
|
67
|
+
class: ClassType;
|
|
68
|
+
label: MultiLang;
|
|
69
|
+
warnTimeOut: number;
|
|
70
|
+
classHeader: ClassType;
|
|
71
|
+
classInput: ClassType;
|
|
72
|
+
focusColor: string;
|
|
73
|
+
changeColor: string;
|
|
74
|
+
errorColor: string;
|
|
75
|
+
disabledColor: string;
|
|
76
|
+
readonly: boolean;
|
|
77
|
+
headerless: boolean;
|
|
78
|
+
require: boolean;
|
|
79
|
+
requireText: MultiLang;
|
|
80
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
81
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
82
|
+
declare const _default: typeof __VLS_export;
|
|
83
|
+
export default _default;
|
|
84
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
85
|
+
new (): {
|
|
86
|
+
$slots: S;
|
|
87
|
+
};
|
|
88
|
+
};
|