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.
Files changed (131) hide show
  1. package/README.md +202 -14
  2. package/dist/module.d.mts +3 -4
  3. package/dist/module.json +9 -6
  4. package/dist/module.mjs +109 -99
  5. package/dist/runtime/assets/flatpickr-dark.css +1 -1
  6. package/dist/runtime/assets/main.css +1 -0
  7. package/dist/runtime/assets/tabulator-custom.css +1 -1
  8. package/dist/runtime/components/form/_select/hidden-item-toggle.vue +28 -0
  9. package/dist/runtime/components/form/_select/hidden-item-toggle.vue.d.ts +10 -0
  10. package/dist/runtime/components/form/_select/item-container.vue +63 -0
  11. package/dist/runtime/components/form/_select/item-container.vue.d.ts +19 -0
  12. package/dist/runtime/components/form/_select/item-label.vue +31 -0
  13. package/dist/runtime/components/form/_select/item-label.vue.d.ts +13 -0
  14. package/dist/runtime/components/form/_select/item-row.vue +62 -0
  15. package/dist/runtime/components/form/_select/item-row.vue.d.ts +34 -0
  16. package/dist/runtime/components/form/btn-line-loading.vue +62 -81
  17. package/dist/runtime/components/form/btn-line-loading.vue.d.ts +14 -0
  18. package/dist/runtime/components/form/btn.vue +411 -494
  19. package/dist/runtime/components/form/btn.vue.d.ts +0 -0
  20. package/dist/runtime/components/form/check-box.vue +200 -315
  21. package/dist/runtime/components/form/check-box.vue.d.ts +71 -0
  22. package/dist/runtime/components/form/check-list.vue +234 -364
  23. package/dist/runtime/components/form/check-list.vue.d.ts +99 -0
  24. package/dist/runtime/components/form/combo-box.vue +340 -0
  25. package/dist/runtime/components/form/combo-box.vue.d.ts +69 -0
  26. package/dist/runtime/components/form/datepicker.vue +717 -883
  27. package/dist/runtime/components/form/datepicker.vue.d.ts +122 -0
  28. package/dist/runtime/components/form/input-frame.vue +174 -258
  29. package/dist/runtime/components/form/input-frame.vue.d.ts +88 -0
  30. package/dist/runtime/components/form/radio.vue +451 -614
  31. package/dist/runtime/components/form/radio.vue.d.ts +62 -0
  32. package/dist/runtime/components/form/select-img-icon.vue +38 -53
  33. package/dist/runtime/components/form/select-img-icon.vue.d.ts +15 -0
  34. package/dist/runtime/components/form/select.vue +733 -579
  35. package/dist/runtime/components/form/select.vue.d.ts +63 -0
  36. package/dist/runtime/components/form/text-box.vue +266 -365
  37. package/dist/runtime/components/form/text-box.vue.d.ts +105 -0
  38. package/dist/runtime/components/form/textarea.vue +338 -421
  39. package/dist/runtime/components/form/textarea.vue.d.ts +98 -0
  40. package/dist/runtime/components/form/value-box.vue +512 -641
  41. package/dist/runtime/components/form/value-box.vue.d.ts +128 -0
  42. package/dist/runtime/components/interactive/alert.vue +49 -113
  43. package/dist/runtime/components/interactive/alert.vue.d.ts +30 -0
  44. package/dist/runtime/components/interactive/block-loading.vue +91 -119
  45. package/dist/runtime/components/interactive/block-loading.vue.d.ts +22 -0
  46. package/dist/runtime/components/interactive/dialog.vue +252 -407
  47. package/dist/runtime/components/interactive/dialog.vue.d.ts +3 -0
  48. package/dist/runtime/components/interactive/modal-bg.vue +72 -82
  49. package/dist/runtime/components/interactive/modal-bg.vue.d.ts +11 -0
  50. package/dist/runtime/components/interactive/modal.vue +121 -169
  51. package/dist/runtime/components/interactive/modal.vue.d.ts +38 -0
  52. package/dist/runtime/components/interactive/toast.vue +164 -206
  53. package/dist/runtime/components/interactive/toast.vue.d.ts +3 -0
  54. package/dist/runtime/components/interactive/window-loader.vue +61 -84
  55. package/dist/runtime/components/interactive/window-loader.vue.d.ts +3 -0
  56. package/dist/runtime/components/layout/accordion-down.vue +72 -0
  57. package/dist/runtime/components/layout/accordion-down.vue.d.ts +26 -0
  58. package/dist/runtime/components/layout/accordion.vue +47 -78
  59. package/dist/runtime/components/layout/accordion.vue.d.ts +22 -0
  60. package/dist/runtime/components/layout/aspect-box.vue +29 -58
  61. package/dist/runtime/components/layout/aspect-box.vue.d.ts +29 -0
  62. package/dist/runtime/components/layout/card-item.vue +148 -193
  63. package/dist/runtime/components/layout/card-item.vue.d.ts +0 -0
  64. package/dist/runtime/components/layout/card.vue +27 -42
  65. package/dist/runtime/components/layout/card.vue.d.ts +23 -0
  66. package/dist/runtime/components/layout/container.vue +25 -40
  67. package/dist/runtime/components/layout/container.vue.d.ts +35 -0
  68. package/dist/runtime/components/layout/divider-h.vue +30 -50
  69. package/dist/runtime/components/layout/divider-h.vue.d.ts +18 -0
  70. package/dist/runtime/components/misc/breadcrumb.vue +47 -95
  71. package/dist/runtime/components/misc/breadcrumb.vue.d.ts +22 -0
  72. package/dist/runtime/components/misc/tabulator.vue +122 -190
  73. package/dist/runtime/components/misc/tabulator.vue.d.ts +28 -0
  74. package/dist/runtime/components/misc/view-name-display.vue +53 -68
  75. package/dist/runtime/components/misc/view-name-display.vue.d.ts +14 -0
  76. package/dist/runtime/components/test.vue +13 -0
  77. package/dist/runtime/components/test.vue.d.ts +3 -0
  78. package/dist/runtime/composables/test.d.ts +8 -0
  79. package/dist/runtime/composables/test.js +12 -0
  80. package/dist/runtime/composables/use-hs-dialog.d.ts +3 -20
  81. package/dist/runtime/composables/use-hs-dialog.js +3 -9
  82. package/dist/runtime/composables/use-hs-is-mobile.d.ts +8 -2
  83. package/dist/runtime/composables/use-hs-is-mobile.js +43 -26
  84. package/dist/runtime/composables/use-hs-misc.d.ts +8 -38
  85. package/dist/runtime/composables/use-hs-misc.js +9 -61
  86. package/dist/runtime/composables/use-hs-modal.js +1 -3
  87. package/dist/runtime/composables/use-hs-multi-lang.d.ts +23 -40
  88. package/dist/runtime/composables/use-hs-multi-lang.js +30 -74
  89. package/dist/runtime/composables/use-hs-scroll-lock.d.ts +1 -1
  90. package/dist/runtime/composables/use-hs-scroll-lock.js +2 -1
  91. package/dist/runtime/composables/use-hs-toast.d.ts +2 -2
  92. package/dist/runtime/composables/use-hs-toast.js +12 -4
  93. package/dist/runtime/composables/use-pinia.d.ts +1 -0
  94. package/dist/runtime/composables/use-pinia.js +2 -0
  95. package/dist/runtime/plugin.d.ts +2 -0
  96. package/dist/runtime/plugin.js +4 -0
  97. package/dist/runtime/server/tsconfig.json +3 -3
  98. package/dist/runtime/types/dialog.d.ts +11 -20
  99. package/dist/runtime/types/dialog.js +2 -1
  100. package/dist/runtime/types/flatpickr/default.js +2 -23
  101. package/dist/runtime/types/flatpickr/ja.js +3 -37
  102. package/dist/runtime/types/toast.d.ts +1 -1
  103. package/dist/runtime/utils/dayjs.d.ts +8 -6
  104. package/dist/runtime/utils/dayjs.js +12 -5
  105. package/dist/runtime/utils/modal.d.ts +9 -28
  106. package/dist/runtime/utils/modal.js +7 -36
  107. package/dist/runtime/utils/multi-lang-object.d.ts +2 -2
  108. package/dist/runtime/utils/multi-lang-object.js +1 -5
  109. package/dist/runtime/utils/multi-lang.js +12 -22
  110. package/dist/runtime/utils/object.js +1 -1
  111. package/dist/runtime/utils/select-item.d.ts +3 -1
  112. package/dist/runtime/utils/stop-watch.js +6 -4
  113. package/dist/runtime/utils/string.js +4 -4
  114. package/dist/runtime/utils/tabulator.d.ts +1 -42
  115. package/dist/runtime/utils/tabulator.js +2 -99
  116. package/dist/runtime/utils/theme.d.ts +20 -20
  117. package/dist/runtime/utils/theme.js +180 -30
  118. package/dist/runtime/utils/tv.d.ts +1 -101
  119. package/dist/runtime/utils/tv.js +0 -22
  120. package/dist/types.d.mts +3 -1
  121. package/package.json +61 -119
  122. package/dist/module.cjs +0 -5
  123. package/dist/module.d.ts +0 -16
  124. package/dist/runtime/assets/vue-select.css +0 -1
  125. package/dist/runtime/components/misc/view-name-display-target.vue +0 -39
  126. package/dist/runtime/plugin/v-select.d.ts +0 -2
  127. package/dist/runtime/plugin/v-select.js +0 -5
  128. package/dist/runtime/style.css +0 -22
  129. package/dist/runtime/tailwind.css +0 -78
  130. package/dist/runtime/types/app.config.d.ts +0 -5
  131. package/dist/types.d.ts +0 -1
@@ -0,0 +1,99 @@
1
+ import { type ClassType } from '../../utils/class-style.js';
2
+ import type { MultiLang } from '../../utils/multi-lang.js';
3
+ import type { SelectItem } from '../../utils/select-item.js';
4
+ type Props = {
5
+ list: SelectItem[] | readonly SelectItem[];
6
+ image?: boolean;
7
+ nullText?: MultiLang;
8
+ classRow?: ClassType;
9
+ classCol?: ClassType;
10
+ classItem?: ClassType;
11
+ classImg?: ClassType;
12
+ classImgTag?: ClassType;
13
+ data: number[];
14
+ diff?: number[] | undefined;
15
+ tabindex?: string | undefined;
16
+ class?: ClassType;
17
+ classHeader?: ClassType;
18
+ classInput?: ClassType;
19
+ focusColor?: string;
20
+ changeColor?: string;
21
+ error?: boolean;
22
+ errorColor?: string;
23
+ disabled?: boolean;
24
+ disabledColor?: string;
25
+ readonly?: boolean;
26
+ headerless?: boolean;
27
+ label?: MultiLang;
28
+ require?: boolean;
29
+ requireText?: MultiLang;
30
+ warn?: string;
31
+ warnTimeOut?: number;
32
+ size?: 's' | 'm' | 'l';
33
+ };
34
+ type InputFocusEventArg = {
35
+ elm: HTMLElement;
36
+ label: MultiLang;
37
+ data: number[];
38
+ };
39
+ type __VLS_Slots = {
40
+ default(props: {
41
+ msg: string;
42
+ }): any;
43
+ overlay?(): any;
44
+ 'right-icons'?(): any;
45
+ 'left-icons'?(): any;
46
+ 'label-prepend'?(): any;
47
+ 'label-append'?(): any;
48
+ 'header-right'?(): any;
49
+ };
50
+ declare const __VLS_base: import("vue").DefineComponent<Props, {
51
+ el: import("vue").Ref<any, any>;
52
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
53
+ blur: (arg: InputFocusEventArg) => any;
54
+ focus: (arg: InputFocusEventArg) => any;
55
+ ref: (element: HTMLElement) => any;
56
+ "update:data": (value: number[], id: number) => any;
57
+ "value-change": (after: number[], before: number[], id: number) => any;
58
+ }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
59
+ onBlur?: ((arg: InputFocusEventArg) => any) | undefined;
60
+ onFocus?: ((arg: InputFocusEventArg) => any) | undefined;
61
+ onRef?: ((element: HTMLElement) => any) | undefined;
62
+ "onUpdate:data"?: ((value: number[], id: number) => any) | undefined;
63
+ "onValue-change"?: ((after: number[], before: number[], id: number) => any) | undefined;
64
+ }>, {
65
+ error: boolean;
66
+ size: "s" | "m" | "l";
67
+ image: boolean;
68
+ disabled: boolean;
69
+ warn: string;
70
+ class: ClassType;
71
+ classImg: ClassType;
72
+ classImgTag: ClassType;
73
+ diff: number[];
74
+ tabindex: string;
75
+ label: MultiLang;
76
+ warnTimeOut: number;
77
+ classHeader: ClassType;
78
+ classInput: ClassType;
79
+ focusColor: string;
80
+ changeColor: string;
81
+ errorColor: string;
82
+ disabledColor: string;
83
+ readonly: boolean;
84
+ headerless: boolean;
85
+ require: boolean;
86
+ requireText: MultiLang;
87
+ nullText: MultiLang;
88
+ classRow: ClassType;
89
+ classCol: ClassType;
90
+ classItem: ClassType;
91
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
92
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
93
+ declare const _default: typeof __VLS_export;
94
+ export default _default;
95
+ type __VLS_WithSlots<T, S> = T & {
96
+ new (): {
97
+ $slots: S;
98
+ };
99
+ };
@@ -0,0 +1,340 @@
1
+ <script setup>
2
+ import { twMerge } from "tailwind-merge";
3
+ import { reactive, ref, watch, computed, nextTick, useId, watchEffect } from "#imports";
4
+ import { useHsFocus } from "../../composables/use-hs-focus";
5
+ import { useHsPinia } from "../../composables/use-pinia";
6
+ import { useHsMultiLang } from "../../composables/use-hs-multi-lang";
7
+ import { useHsMisc } from "../../composables/use-hs-misc";
8
+ import InputFrame from "./input-frame.vue";
9
+ const fcFocus = useHsFocus(useHsPinia());
10
+ const hsMisc = useHsMisc(useHsPinia());
11
+ const props = defineProps({
12
+ type: { type: String, required: false, default: "text" },
13
+ textAlign: { type: String, required: false, default: "left" },
14
+ maxLen: { type: Number, required: false, default: 0 },
15
+ autocomplete: { type: String, required: false, default: "off" },
16
+ datalist: { type: Array, required: false, default: () => [] },
17
+ enterkeyhint: { type: null, required: false, default: void 0 },
18
+ inputmode: { type: null, required: false, default: void 0 },
19
+ inputSize: { type: [String, Number], required: false, default: 10 },
20
+ placeholder: { type: [String, Object], required: false, default: "" },
21
+ pattern: { type: String, required: false, default: void 0 },
22
+ lang: { type: String, required: false, default: void 0 },
23
+ list: { type: Array, required: true },
24
+ listLoading: { type: Boolean, required: false, default: false },
25
+ activeId: { type: null, required: true },
26
+ freeTextId: { type: null, required: true },
27
+ data: { type: [String, null], required: true },
28
+ diff: { type: null, required: false, default: void 0 },
29
+ tabindex: { type: null, required: false, default: void 0 },
30
+ class: { type: [String, Object, Array], required: false, default: "" },
31
+ classHeader: { type: [String, Object, Array], required: false, default: "" },
32
+ classInput: { type: [String, Object, Array], required: false, default: "" },
33
+ focusColor: { type: String, required: false, default: "shadow-[inset_0px_0px_1px_2px_#0d8ee4]" },
34
+ changeColor: { type: String, required: false, default: "shadow-[inset_0px_0px_1px_2px_#fd9831be]" },
35
+ error: { type: Boolean, required: false, default: false },
36
+ errorColor: { type: String, required: false, default: "shadow-[inset_0px_0px_1px_2px_#d80000dc]" },
37
+ disabled: { type: Boolean, required: false, default: false },
38
+ disabledColor: { type: String, required: false, default: "" },
39
+ readonly: { type: Boolean, required: false, default: false },
40
+ headerless: { type: Boolean, required: false, default: false },
41
+ label: { type: [String, Object], required: false, default: "" },
42
+ require: { type: Boolean, required: false, default: false },
43
+ requireText: { type: [String, Object], required: false, default: () => ({ ja: "\u5FC5\u9808", en: "Required" }) },
44
+ warn: { type: String, required: false, default: "" },
45
+ warnTimeOut: { type: Number, required: false, default: 3e3 },
46
+ size: { type: String, required: false, default: "m" }
47
+ });
48
+ const emit = defineEmits(["ref", "focus", "blur", "update:data", "update:activeId", "value-change", "keydown", "keyup"]);
49
+ const slots = defineSlots();
50
+ const uid = useId();
51
+ const multiLang = useHsMultiLang(useHsPinia());
52
+ const tx = multiLang.tx;
53
+ const gt = multiLang.gt;
54
+ watch(
55
+ () => multiLang.lang,
56
+ () => {
57
+ if (!props.activeId) return;
58
+ const data = props.list.find((row) => row.id === props.activeId);
59
+ if (!data) return;
60
+ updateValue(gt(data.text), props.activeId);
61
+ }
62
+ );
63
+ const state = reactive({
64
+ value: ""
65
+ });
66
+ watch(
67
+ () => props.data,
68
+ () => {
69
+ setValue(props.data);
70
+ }
71
+ );
72
+ const updateValue = async (text, forceId) => {
73
+ const before = props.data;
74
+ let setText = "";
75
+ if (text === null) {
76
+ setText = "";
77
+ } else if (props.maxLen === 0 || text.length <= props.maxLen) {
78
+ setText = text;
79
+ } else {
80
+ const CutLen = (text2, len, addWard = "") => {
81
+ if (text2 === null) return "";
82
+ if (len === 0) return text2;
83
+ return text2.substring(0, len) + addWard;
84
+ };
85
+ setText = CutLen(text, props.maxLen, "");
86
+ }
87
+ state.value = setText;
88
+ emit("update:data", setText);
89
+ if (!setText) {
90
+ emit("update:activeId", null);
91
+ } else if (forceId !== void 0) {
92
+ if (props.activeId !== forceId) {
93
+ emit("update:activeId", forceId);
94
+ }
95
+ } else {
96
+ const matched = props.list.find((row) => tx(row.text).value === setText);
97
+ emit("update:activeId", matched ? matched.id : props.freeTextId ?? null);
98
+ }
99
+ await nextTick();
100
+ emit("value-change", setText, before);
101
+ };
102
+ const setValue = (text) => {
103
+ if (text === null) {
104
+ state.value = "";
105
+ return;
106
+ }
107
+ if (props.maxLen === 0 || text.length <= props.maxLen) {
108
+ state.value = text;
109
+ } else {
110
+ updateValue(text);
111
+ }
112
+ };
113
+ setValue(props.data);
114
+ const inputElement = ref();
115
+ defineExpose({ el: inputElement });
116
+ const setRef = (elm) => {
117
+ inputElement.value = elm;
118
+ emit("ref", elm);
119
+ };
120
+ const focusState = reactive({
121
+ isActivate: false,
122
+ isMmousedown: false
123
+ });
124
+ const computedActivate = computed(() => {
125
+ if (props.disabled === true) return false;
126
+ if (props.readonly === true) return false;
127
+ if (fcFocus.state.id !== uid) return false;
128
+ if (focusState.isActivate) return true;
129
+ if (focusState.isMmousedown) return true;
130
+ return false;
131
+ });
132
+ watch(computedActivate, (value) => {
133
+ if (value === true) {
134
+ setTimeout(() => {
135
+ emit("focus", inputElement.value);
136
+ }, 10);
137
+ } else {
138
+ emit("blur", inputElement.value);
139
+ }
140
+ });
141
+ const onFocus = () => {
142
+ if (props.disabled === true) return;
143
+ if (props.readonly === true) return;
144
+ focusState.isActivate = true;
145
+ fcFocus.state.id = uid;
146
+ };
147
+ const onBlur = () => {
148
+ focusState.isActivate = false;
149
+ };
150
+ const isChangeData = computed(() => {
151
+ if (props.diff === void 0) return false;
152
+ if (props.diff === null && props.data === "") return false;
153
+ if (props.diff === "" && props.data === null) return false;
154
+ if (props.diff !== props.data) return true;
155
+ return false;
156
+ });
157
+ const tabindex = computed(() => {
158
+ if (props.disabled === true) return -1;
159
+ if (props.readonly === true) return -1;
160
+ return props.tabindex;
161
+ });
162
+ const lastLen = computed(() => {
163
+ return props.maxLen - state.value.length;
164
+ });
165
+ const lenLabelClass = computed(() => {
166
+ return [
167
+ twMerge(
168
+ "text-white bg-[#2fa412]",
169
+ lastLen.value < 9 ? "bg-[#fdc90d]" : "",
170
+ lastLen.value < 6 ? "bg-[#fd750d]" : "",
171
+ lastLen.value < 3 ? "bg-[#fa541d]" : ""
172
+ )
173
+ ];
174
+ });
175
+ const dataListId = ref(`textbox-list-${uid}`);
176
+ const placeholder = computed(() => tx(props.placeholder).value);
177
+ const filteredList = computed(() => {
178
+ if (!props.data || props.data.length === 0) return props.list;
179
+ const query = props.data.toLowerCase();
180
+ return props.list.filter((row) => tx(row.text).value.toLowerCase().includes(query));
181
+ });
182
+ const open = ref(false);
183
+ watchEffect(() => {
184
+ if (computedActivate.value && (filteredList.value.length !== 0 || props.listLoading)) {
185
+ open.value = computedActivate.value;
186
+ } else if (!computedActivate.value) {
187
+ open.value = false;
188
+ }
189
+ });
190
+ </script>
191
+
192
+ <template>
193
+ <UPopover :open="open" :ui="{ content: 'w-(--reka-popper-anchor-width) p-0 overflow-hidden' }">
194
+ <InputFrame
195
+ :class="props.class"
196
+ :class-header="props.classHeader"
197
+ :class-input="[props.classInput]"
198
+ :focus="computedActivate"
199
+ :focus-color="props.focusColor"
200
+ :change="isChangeData"
201
+ :change-color="props.changeColor"
202
+ :error="props.error"
203
+ :error-color="props.errorColor"
204
+ :disabled="props.disabled"
205
+ :disabled-color="props.disabledColor"
206
+ :readonly="props.readonly"
207
+ :label="props.label"
208
+ :require="props.require"
209
+ :require-text="props.requireText"
210
+ :warn="props.warn"
211
+ :warn-time-out="props.warnTimeOut"
212
+ :size="props.size"
213
+ :headerless="props.headerless"
214
+ >
215
+ <template #overlay="{ focus, change }">
216
+ <div
217
+ v-if="props.diff !== void 0 && change"
218
+ class="absolute inset-0 bg-red/30 transition-opacity flex items-center p-1 bg-dark/20"
219
+ :class="!focus && hsMisc.capsLockState ? 'opacity-100' : 'opacity-0 pointer-events-none select-none'"
220
+ >
221
+ <div class="flex">
222
+ <Btn
223
+ variant="outlined"
224
+ theme="error"
225
+ tabindex="-1"
226
+ size="xs"
227
+ class="bg-white flex-none"
228
+ @click="updateValue(props.diff)"
229
+ >
230
+ <i class="fa-solid fa-rotate-right"></i>
231
+ </Btn>
232
+ <div v-if="props.diff" class="px-1 truncate bg-white mx-1 flex items-center">{{ props.diff }}</div>
233
+ </div>
234
+ </div>
235
+ <template v-if="slots.overlay">
236
+ <slot name="overlay" :focus="focus" :change="change"></slot>
237
+ </template>
238
+ </template>
239
+ <template v-if="slots['left-icons']" #left-icons>
240
+ <slot name="left-icons" :disabled="disabled" />
241
+ </template>
242
+ <template v-if="slots['right-icons']" #right-icons>
243
+ <slot name="right-icons" :disabled="disabled" />
244
+ </template>
245
+ <template v-if="slots['label-prepend']" #label-prepend>
246
+ <slot name="label-prepend" />
247
+ </template>
248
+ <template v-if="slots['label-append']" #label-append>
249
+ <slot name="label-append" />
250
+ </template>
251
+ <template v-if="props.maxLen > 0 || slots['header-right']" #header-right="{ defaultClass }">
252
+ <slot name="header-right" />
253
+ <div v-if="props.maxLen > 0 && lastLen < 15" :class="[defaultClass, lenLabelClass]">
254
+ {{ state.value.length }} / {{ props.maxLen }}
255
+ </div>
256
+ </template>
257
+ <template #default="{ focus }">
258
+ <span
259
+ v-if="placeholder"
260
+ class="text-black/50 pointer-events-none select-none px-1 absolute inset-0 items-center transition-opacity truncate"
261
+ :class="focus || !!state.value ? 'opacity-0' : ''"
262
+ >
263
+ <div class="truncate w-full" :style="`text-align:${props.textAlign};`">
264
+ {{ placeholder }}
265
+ </div>
266
+ </span>
267
+
268
+ <div v-if="props.disabled" class="input-d" :style="`text-align:${props.textAlign};`">
269
+ {{ state.value }}
270
+ </div>
271
+
272
+ <input
273
+ v-else
274
+ :ref="(e) => setRef(e)"
275
+ v-model="state.value"
276
+ :list="props.datalist.length > 0 ? dataListId : void 0"
277
+ :type="props.type"
278
+ :autocomplete="props.autocomplete"
279
+ style="ime-mode: active"
280
+ :style="`text-align:${props.textAlign};`"
281
+ class="w-full"
282
+ :disabled="props.disabled"
283
+ :readonly="props.readonly"
284
+ :tabindex="tabindex"
285
+ :enterkeyhint="props.enterkeyhint"
286
+ :inputmode="props.inputmode"
287
+ :size="props.inputSize"
288
+ :lang="props.lang"
289
+ :pattern="props.pattern"
290
+ @blur="onBlur()"
291
+ @focus="onFocus()"
292
+ @input="updateValue(state.value)"
293
+ @keydown="(e) => emit('keydown', e)"
294
+ @keyup="(e) => emit('keyup', e)"
295
+ @click.stop=""
296
+ />
297
+ <datalist v-if="props.datalist.length !== 0" :id="dataListId">
298
+ <template v-for="(row, index) in props.datalist" :key="index">
299
+ <option :value="row" />
300
+ </template>
301
+ </datalist>
302
+ </template>
303
+ </InputFrame>
304
+ <template #content>
305
+ <div class="grid gap-1 bg-white max-h-60 overflow-y-auto p-2 select-none min-h-30">
306
+ <BlockLoading :show="props.listLoading" />
307
+ <template v-for="(row, index) in filteredList" :key="index">
308
+ <div
309
+ class="relative border border-dark hover:border-accent1 cursor-pointer hover:bg-accent1/5 rounded p-2"
310
+ :class="props.activeId === row.id ? 'pointer-events-none' : ''"
311
+ @click="updateValue(tx(row.text).value, row.id)"
312
+ >
313
+ {{ tx(row.text) }}
314
+ <div v-if="props.activeId === row.id" class="absolute inset-px border-2 border-accent1 rounded"></div>
315
+ </div>
316
+ </template>
317
+ </div>
318
+ </template>
319
+ </UPopover>
320
+ </template>
321
+
322
+ <style scoped>
323
+ .input-d,
324
+ input {
325
+ width: 100%;
326
+ height: auto;
327
+ background-color: transparent;
328
+ -webkit-appearance: none;
329
+ -moz-appearance: none;
330
+ appearance: none;
331
+ border: 0px;
332
+ outline: none;
333
+ line-height: 1.4em;
334
+ color: inherit;
335
+ }
336
+
337
+ input::-webkit-calendar-picker-indicator {
338
+ opacity: 0;
339
+ }
340
+ </style>
@@ -0,0 +1,69 @@
1
+ import type { ClassType } from '../../utils/class-style.js';
2
+ import type { MultiLang } from '../../utils/multi-lang.js';
3
+ import type { SelectItem } from '../../utils/select-item.js';
4
+ declare const __VLS_export: <IdType extends string | number>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
5
+ props: __VLS_PrettifyLocal<{
6
+ type?: "email" | "number" | "tel" | "text" | "url";
7
+ textAlign?: "left" | "center" | "right";
8
+ maxLen?: number;
9
+ autocomplete?: string;
10
+ datalist?: string[];
11
+ enterkeyhint?: ("done" | "search" | "enter" | "go" | "next" | "previous" | "send") | undefined;
12
+ inputmode?: "text" | "search" | "none" | "tel" | "url" | "email" | "numeric" | "decimal" | undefined;
13
+ inputSize?: string | number;
14
+ placeholder?: MultiLang;
15
+ pattern?: string;
16
+ lang?: string;
17
+ list: SelectItem<IdType>[];
18
+ listLoading?: boolean;
19
+ activeId: IdType | null;
20
+ freeTextId: IdType | null;
21
+ data: string | null;
22
+ diff?: string | null | undefined;
23
+ tabindex?: string | undefined;
24
+ class?: ClassType;
25
+ classHeader?: ClassType;
26
+ classInput?: ClassType;
27
+ focusColor?: string;
28
+ changeColor?: string;
29
+ error?: boolean;
30
+ errorColor?: string;
31
+ disabled?: boolean;
32
+ disabledColor?: string;
33
+ readonly?: boolean;
34
+ headerless?: boolean;
35
+ label?: MultiLang;
36
+ require?: boolean;
37
+ requireText?: MultiLang;
38
+ warn?: string;
39
+ warnTimeOut?: number;
40
+ size?: "s" | "m" | "l";
41
+ } & __VLS_EmitsToProps<__VLS_NormalizeEmits<((evt: "blur", elm: HTMLElement) => void) & ((evt: "focus", elm: HTMLElement) => void) & ((evt: "keydown", event: KeyboardEvent) => void) & ((evt: "keyup", event: KeyboardEvent) => void) & ((evt: "ref", element: HTMLElement) => void) & ((evt: "update:data", value: string) => void) & ((evt: "value-change", after: string, before: string | null) => void) & ((evt: "update:activeId", id: IdType | null) => void)>>> & import("vue").PublicProps & (typeof globalThis extends {
42
+ __VLS_PROPS_FALLBACK: infer P;
43
+ } ? P : {});
44
+ expose: (exposed: import("vue").ShallowUnwrapRef<{
45
+ el: import("vue").Ref<any, any>;
46
+ }>) => void;
47
+ attrs: any;
48
+ slots: {
49
+ default(props: {
50
+ msg: string;
51
+ }): any;
52
+ overlay?(): any;
53
+ 'right-icons'?(): any;
54
+ 'left-icons'?(): any;
55
+ 'label-prepend'?(): any;
56
+ 'label-append'?(): any;
57
+ 'header-right'?(): any;
58
+ };
59
+ emit: ((evt: "blur", elm: HTMLElement) => void) & ((evt: "focus", elm: HTMLElement) => void) & ((evt: "keydown", event: KeyboardEvent) => void) & ((evt: "keyup", event: KeyboardEvent) => void) & ((evt: "ref", element: HTMLElement) => void) & ((evt: "update:data", value: string) => void) & ((evt: "value-change", after: string, before: string | null) => void) & ((evt: "update:activeId", id: IdType | null) => void);
60
+ }>) => import("vue").VNode & {
61
+ __ctx?: Awaited<typeof __VLS_setup>;
62
+ };
63
+ declare const _default: typeof __VLS_export;
64
+ export default _default;
65
+ type __VLS_PrettifyLocal<T> = (T extends any ? {
66
+ [K in keyof T]: T[K];
67
+ } : {
68
+ [K in keyof T as K]: T[K];
69
+ }) & {};