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.
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 -25
  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
@@ -1,369 +1,239 @@
1
- <script setup lang="ts">
2
- /* ----------------------------------------------------------------------------
3
- // src\runtime\components\form\check-list.vue
4
- // ----------------------------------------------------------------------------
5
- // CheckList
6
- // CheckListCheckList
7
- ----------------------------------------------------------------------------- */
8
-
9
- // [ tailwind ]
10
- import { twMerge } from "tailwind-merge";
11
- // [ NUXT ]
12
- import { reactive, ref, watch, computed, nextTick } from "#imports";
13
- // [ utils ]
14
- import { type ClassType, ClassTypeToString } from "../../utils/class-style";
15
- import type { MultiLang } from "../../utils/multi-lang";
16
- import { ObjectCompare, ListIdSort } from "../../utils/object";
17
- import type { SelectItem } from "../../utils/select-item";
18
- // [ composables ]
19
- import { useHsMultiLang } from "../../composables/use-hs-multi-lang";
20
- // [ Components ]
21
- import InputFrame from "./input-frame.vue";
22
- import HsFcCheckBox from "./check-box.vue";
23
- // ----------------------------------------------------------------------------
24
- // ----------------------------------------------------------------------------
25
- const multiLang = useHsMultiLang();
26
- const tx = multiLang.tx;
27
- // ----------------------------------------------------------------------------
28
- // [ Props ]
29
- type Props = {
30
- // ----------------------------------------------------------------------------
31
- // Input 種類別
32
- list: SelectItem[] | readonly SelectItem[];
33
- image?: boolean;
34
- nullText?: MultiLang;
35
- classRow?: ClassType;
36
- classCol?: ClassType;
37
- classItem?: ClassType;
38
- classImg?: ClassType;
39
- classImgTag?: ClassType;
40
- // ----------------------------------------------------------------------------
41
- data: number[];
42
- diff?: number[] | undefined;
43
- tabindex?: string | undefined;
44
- // ----------------------------------------------------------------------------
45
- class?: ClassType;
46
- classHeader?: ClassType;
47
- classInput?: ClassType;
48
- // ----------------------------------------------------------------------------
49
- // 状態
50
- focusColor?: string;
51
- changeColor?: string;
52
- error?: boolean;
53
- errorColor?: string;
54
- disabled?: boolean;
55
- disabledColor?: string;
56
- readonly?: boolean;
57
- headerless?: boolean;
58
- // ----------------------------------------------------------------------------
59
- // 表示
60
- label?: MultiLang;
61
- // 表示-副情報
62
- require?: boolean;
63
- requireText?: MultiLang;
64
- warn?: string;
65
- warnTimeOut?: number;
66
- // ----------------------------------------------------------------------------
67
- // 設定
68
- size?: "s" | "m" | "l";
69
- // ----------------------------------------------------------------------------
70
- };
71
- const props = withDefaults(defineProps<Props>(), {
72
- // ----------------------------------------------------------------------------
73
- // Input 種類別
74
- order: false,
75
- image: false,
76
- nullText: () => ({ ja: "選択してください", en: "" }),
77
- nullable: true,
78
- classRow: "",
79
- classCol: "",
80
- classItem: "",
81
- classImg: "",
82
- classImgTag: "",
83
- // ----------------------------------------------------------------------------
84
- diff: undefined,
85
- tabindex: undefined,
86
- // ----------------------------------------------------------------------------
87
- class: "",
88
- classHeader: "",
89
- classInput: "",
90
- // ----------------------------------------------------------------------------
91
- // 状態
92
- // focus: false,
93
- focusColor: "shadow-[inset_0px_0px_1px_2px_#0d8ee4]",
94
- // change: false,
95
- changeColor: "shadow-[inset_0px_0px_1px_2px_#fd9831be]",
96
- error: false,
97
- errorColor: "shadow-[inset_0px_0px_1px_2px_#d80000dc]",
98
- disabled: false,
99
- disabledColor: "",
100
- readonly: false,
101
- headerless: false,
102
- // ----------------------------------------------------------------------------
103
- // 表示
104
- label: "",
105
- // 表示-副情報
106
- require: false,
107
- requireText: () => ({ ja: "必須", en: "" }),
108
- warn: "",
109
- warnTimeOut: 3000,
110
- // ----------------------------------------------------------------------------
111
- // 設定
112
- size: "m",
113
- });
114
- // [ emit ]
115
- type InputFocusEventArg = {
116
- elm: HTMLElement;
117
- label: MultiLang;
118
- data: number[];
119
- };
120
- type Emits = {
121
- ref: [element: HTMLElement];
122
- focus: [arg: InputFocusEventArg];
123
- blur: [arg: InputFocusEventArg];
124
- "update:data": [value: number[], id: number];
125
- "value-change": [after: number[], before: number[], id: number];
126
- };
127
- const emit = defineEmits<Emits>();
128
- // ----------------------------------------------------------------------------
129
- const slots = defineSlots<{
130
- default(props: { msg: string }): any;
131
- overlay?(): any;
132
- "right-icons"?(): any;
133
- "left-icons"?(): any;
134
- }>();
135
- // ----------------------------------------------------------------------------
136
-
137
- // [ 選択肢配列 ]
138
- interface ItemListRow {
139
- id: number;
140
- text: MultiLang;
141
- focus: boolean;
142
- imgUrl: string | null;
143
- }
144
- const itemList = ref<ItemListRow[]>([]);
145
- watch(
146
- () => [...props.list],
147
- () => {
148
- //
149
- setItemList();
150
- }
151
- );
152
- const setItemList = () => {
153
- itemList.value = props.list.map((row) => {
154
- return {
155
- id: row.id,
156
- text: row.text,
157
- imgUrl: row.imgUrl === undefined ? null : row.imgUrl,
158
- focus: false,
159
- } as ItemListRow;
160
- });
161
- };
162
- setItemList();
163
-
164
- // ----------------------------------------------------------------------------
165
-
166
- const valueChange = async (id: number) => {
167
- const before = props.data.map((row) => row);
168
- let temp = props.data.map((row) => row);
169
- if (props.data.includes(id)) {
170
- // console.log('valueChange off', id);
171
- temp = props.data.filter((row) => {
172
- if (row === id) {
173
- return false;
174
- } else {
175
- return true;
176
- }
177
- });
178
- } else {
179
- // console.log('valueChange on', id, value);
180
- temp.push(id);
181
- }
182
- const ret = ListIdSort([...props.list], temp);
183
- emit("update:data", ret, id);
184
- await nextTick();
185
- emit("value-change", ret, before, id);
186
- };
187
-
188
- // ----------------------------------------------------------------------------
189
- // [ ref ]
190
- const inputElement = ref();
191
- const setRef = (elm: any, index: number) => {
192
- if (index === 0) {
193
- inputElement.value = elm;
194
- emit("ref", inputElement.value as HTMLInputElement);
195
- }
196
- };
197
-
198
- // [ focus, blur ]
199
- interface FocusState {
200
- isMmousedown: boolean;
201
- }
202
-
203
- const focusState = reactive<FocusState>({
204
- isMmousedown: false,
205
- });
206
-
207
- /**
208
- * コントロールのFocus判定
209
- */
210
- const computedActivate = computed(() => {
211
- if (focusState.isMmousedown) return true;
212
- if (itemList.value.filter((row) => row.focus === true).length !== 0)
213
- return true;
214
- return false;
215
- });
216
-
217
- /**
218
- * focus, blur イベント
219
- */
220
- watch(computedActivate, (value) => {
221
- if (value === true) {
222
- // クリックでの遷移の場合に
223
- // 一つ前のコントロールのblurイベントよりも早くfocusが発生しないようにする対策で10ミリ秒処理をずらす
224
- setTimeout(() => {
225
- emit("focus", {
226
- elm: inputElement.value,
227
- label: props.label,
228
- data: props.data.map((row) => row),
229
- });
230
- }, 10);
231
- } else {
232
- emit("blur", {
233
- elm: inputElement.value,
234
- label: props.label,
235
- data: props.data.map((row) => row),
236
- });
237
- }
238
- });
239
-
240
- const onFocus = (row: ItemListRow) => {
241
- row.focus = true;
242
- };
243
-
244
- const onBlur = (row: ItemListRow) => {
245
- setTimeout(() => {
246
- row.focus = false;
247
- }, 10);
248
- };
249
-
250
- // 更新の有無判定
251
- const isChangeData = computed(() => {
252
- if (props.diff === undefined) return false;
253
- return !ObjectCompare(
254
- props.diff.map((row) => row).sort(),
255
- props.data.map((row) => row)
256
- );
257
- });
258
-
259
- const tabindex = computed(() => {
260
- if (props.disabled === true) return -1;
261
- return props.tabindex;
262
- });
263
- // ----------------------------------------------------------------------------
264
- // Class
265
- const baseClass = computed(() => {
266
- return [
267
- twMerge(
268
- //
269
- "h-auto",
270
- props.size === "s" ? "min-h-[44px] " : "",
271
- props.size === "m" ? "min-h-[48px]" : "",
272
- props.size === "l" ? "min-h-[60px]" : "",
273
- ClassTypeToString(props.class)
274
- ),
275
- ];
276
- });
277
- const rowClass = computed(() => {
278
- return twMerge(
279
- //
280
- "flex items-center flex-wrap",
281
- ClassTypeToString(props.classRow)
282
- );
283
- });
284
- const colClass = computed(() => {
285
- return twMerge(
286
- //
287
- "min-w-[0]",
288
- ClassTypeToString(props.classCol)
289
- );
290
- });
291
-
292
- const itemClass = computed(() => {
293
- return twMerge(
294
- //
295
- "px-[6px] py-[1px] w-full",
296
- ClassTypeToString(props.classItem)
297
- );
298
- });
299
-
300
- // ----------------------------------------------------------------------------
301
- </script>
302
-
303
- <template>
304
- <InputFrame
305
- :class="baseClass"
306
- :class-header="props.classHeader"
307
- :class-input="props.classInput"
308
- :focus="computedActivate"
309
- :focus-color="props.focusColor"
310
- :change="isChangeData"
311
- :change-color="props.changeColor"
312
- :error="props.error"
313
- :error-color="props.errorColor"
314
- :disabled="props.disabled"
315
- :disabled-color="props.disabledColor"
316
- :readonly="props.readonly"
317
- :label="props.label"
318
- :require="props.require"
319
- :require-text="tx(props.requireText).value"
320
- :warn="props.warn"
321
- :warn-time-out="props.warnTimeOut"
322
- :size="props.size"
323
- :headerless="props.headerless"
324
- >
325
- <template v-if="slots['left-icons']" #left-icons>
326
- <slot name="left-icons" :disabled="disabled" />
327
- </template>
328
- <template v-if="slots['right-icons']" #right-icons>
329
- <slot name="right-icons" :disabled="disabled" />
330
- </template>
331
- <template v-if="slots.overlay" #overlay>
332
- <slot name="overlay"></slot>
333
- </template>
334
- <div class="nac-input-box" @mousedown.stop="" @mouseup.stop="">
335
- <div
336
- class="w-full h-full"
337
- :class="rowClass"
338
- style="background-color: transparent"
339
- >
340
- <template v-for="(row, index) in itemList" :key="index">
341
- <div :class="colClass">
342
- <HsFcCheckBox
343
- :data="props.data.includes(row.id) === true"
344
- :label="tx(row.text).value"
345
- :class="itemClass"
346
- :class-img="props.classImg"
347
- :class-img-tag="props.classImgTag"
348
- :image="props.image"
349
- :img-url="row.imgUrl"
350
- :tabindex="tabindex"
351
- :disabled="props.disabled"
352
- @value-change="(value) => valueChange(row.id)"
353
- @focus="() => onFocus(row)"
354
- @blur="() => onBlur(row)"
355
- @ref="(e) => setRef(e, index)"
356
- />
357
- </div>
358
- </template>
359
- </div>
360
- </div>
361
- </InputFrame>
362
- </template>
363
-
1
+ <script setup>
2
+ import { twMerge } from "tailwind-merge";
3
+ import { reactive, ref, watch, computed, nextTick } from "#imports";
4
+ import { ClassTypeToString } from "../../utils/class-style";
5
+ import { ObjectCompare, ListIdSort } from "../../utils/object";
6
+ import { useHsMultiLang } from "../../composables/use-hs-multi-lang";
7
+ import { useHsPinia } from "../../composables/use-pinia";
8
+ import InputFrame from "./input-frame.vue";
9
+ import HsFcCheckBox from "./check-box.vue";
10
+ const multiLang = useHsMultiLang(useHsPinia());
11
+ const tx = multiLang.tx;
12
+ const props = defineProps({
13
+ list: { type: Array, required: true },
14
+ image: { type: Boolean, required: false, default: false },
15
+ nullText: { type: [String, Object], required: false, default: () => ({ ja: "\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044", en: "" }) },
16
+ classRow: { type: [String, Object, Array], required: false, default: "" },
17
+ classCol: { type: [String, Object, Array], required: false, default: "" },
18
+ classItem: { type: [String, Object, Array], required: false, default: "" },
19
+ classImg: { type: [String, Object, Array], required: false, default: "" },
20
+ classImgTag: { type: [String, Object, Array], required: false, default: "" },
21
+ data: { type: Array, required: true },
22
+ diff: { type: null, required: false, default: void 0 },
23
+ tabindex: { type: null, required: false, default: void 0 },
24
+ class: { type: [String, Object, Array], required: false, default: "" },
25
+ classHeader: { type: [String, Object, Array], required: false, default: "" },
26
+ classInput: { type: [String, Object, Array], required: false, default: "" },
27
+ focusColor: { type: String, required: false, default: "shadow-[inset_0px_0px_1px_2px_#0d8ee4]" },
28
+ changeColor: { type: String, required: false, default: "shadow-[inset_0px_0px_1px_2px_#fd9831be]" },
29
+ error: { type: Boolean, required: false, default: false },
30
+ errorColor: { type: String, required: false, default: "shadow-[inset_0px_0px_1px_2px_#d80000dc]" },
31
+ disabled: { type: Boolean, required: false, default: false },
32
+ disabledColor: { type: String, required: false, default: "" },
33
+ readonly: { type: Boolean, required: false, default: false },
34
+ headerless: { type: Boolean, required: false, default: false },
35
+ label: { type: [String, Object], required: false, default: "" },
36
+ require: { type: Boolean, required: false, default: false },
37
+ requireText: { type: [String, Object], required: false, default: () => ({ ja: "\u5FC5\u9808", en: "" }) },
38
+ warn: { type: String, required: false, default: "" },
39
+ warnTimeOut: { type: Number, required: false, default: 3e3 },
40
+ size: { type: String, required: false, default: "m" }
41
+ });
42
+ const emit = defineEmits(["ref", "focus", "blur", "update:data", "value-change"]);
43
+ const slots = defineSlots();
44
+ const itemList = ref([]);
45
+ watch(
46
+ () => [...props.list],
47
+ () => {
48
+ setItemList();
49
+ }
50
+ );
51
+ const setItemList = () => {
52
+ itemList.value = props.list.map((row) => {
53
+ return {
54
+ id: row.id,
55
+ text: row.text,
56
+ imgUrl: row.imgUrl === void 0 ? null : row.imgUrl,
57
+ focus: false
58
+ };
59
+ });
60
+ };
61
+ setItemList();
62
+ const valueChange = async (id) => {
63
+ const before = props.data.map((row) => row);
64
+ let temp = props.data.map((row) => row);
65
+ if (props.data.includes(id)) {
66
+ temp = props.data.filter((row) => {
67
+ if (row === id) {
68
+ return false;
69
+ } else {
70
+ return true;
71
+ }
72
+ });
73
+ } else {
74
+ temp.push(id);
75
+ }
76
+ const ret = ListIdSort([...props.list], temp);
77
+ emit("update:data", ret, id);
78
+ await nextTick();
79
+ emit("value-change", ret, before, id);
80
+ };
81
+ const inputElement = ref();
82
+ defineExpose({ el: inputElement });
83
+ const setRef = (elm, index) => {
84
+ if (index === 0) {
85
+ inputElement.value = elm;
86
+ emit("ref", inputElement.value);
87
+ }
88
+ };
89
+ const focusState = reactive({
90
+ isMmousedown: false
91
+ });
92
+ const computedActivate = computed(() => {
93
+ if (focusState.isMmousedown) return true;
94
+ if (itemList.value.filter((row) => row.focus === true).length !== 0) return true;
95
+ return false;
96
+ });
97
+ watch(computedActivate, (value) => {
98
+ if (value === true) {
99
+ setTimeout(() => {
100
+ emit("focus", {
101
+ elm: inputElement.value,
102
+ label: props.label,
103
+ data: props.data.map((row) => row)
104
+ });
105
+ }, 10);
106
+ } else {
107
+ emit("blur", {
108
+ elm: inputElement.value,
109
+ label: props.label,
110
+ data: props.data.map((row) => row)
111
+ });
112
+ }
113
+ });
114
+ const onFocus = (row) => {
115
+ row.focus = true;
116
+ };
117
+ const onBlur = (row) => {
118
+ setTimeout(() => {
119
+ row.focus = false;
120
+ }, 10);
121
+ };
122
+ const isChangeData = computed(() => {
123
+ if (props.diff === void 0) return false;
124
+ return !ObjectCompare(
125
+ props.diff.map((row) => row).sort(),
126
+ props.data.map((row) => row)
127
+ );
128
+ });
129
+ const tabindex = computed(() => {
130
+ if (props.disabled === true) return -1;
131
+ return props.tabindex;
132
+ });
133
+ const baseClass = computed(() => {
134
+ return [
135
+ twMerge(
136
+ //
137
+ "h-auto",
138
+ props.size === "s" ? "min-h-[44px] " : "",
139
+ props.size === "m" ? "min-h-[48px]" : "",
140
+ props.size === "l" ? "min-h-[60px]" : "",
141
+ ClassTypeToString(props.class)
142
+ )
143
+ ];
144
+ });
145
+ const rowClass = computed(() => {
146
+ return twMerge(
147
+ //
148
+ "flex items-center flex-wrap",
149
+ ClassTypeToString(props.classRow)
150
+ );
151
+ });
152
+ const colClass = computed(() => {
153
+ return twMerge(
154
+ //
155
+ "min-w-[0]",
156
+ ClassTypeToString(props.classCol)
157
+ );
158
+ });
159
+ const itemClass = computed(() => {
160
+ return twMerge(
161
+ //
162
+ "px-[6px] py-[1px] w-full",
163
+ ClassTypeToString(props.classItem)
164
+ );
165
+ });
166
+ </script>
167
+
168
+ <template>
169
+ <InputFrame
170
+ :class="baseClass"
171
+ :class-header="props.classHeader"
172
+ :class-input="props.classInput"
173
+ :focus="computedActivate"
174
+ :focus-color="props.focusColor"
175
+ :change="isChangeData"
176
+ :change-color="props.changeColor"
177
+ :error="props.error"
178
+ :error-color="props.errorColor"
179
+ :disabled="props.disabled"
180
+ :disabled-color="props.disabledColor"
181
+ :readonly="props.readonly"
182
+ :label="props.label"
183
+ :require="props.require"
184
+ :require-text="tx(props.requireText).value"
185
+ :warn="props.warn"
186
+ :warn-time-out="props.warnTimeOut"
187
+ :size="props.size"
188
+ :headerless="props.headerless"
189
+ >
190
+ <template v-if="slots.overlay" #overlay="{ focus, change }">
191
+ <slot name="overlay" :focus="focus" :change="change"></slot>
192
+ </template>
193
+ <template v-if="slots['left-icons']" #left-icons>
194
+ <slot name="left-icons" :disabled="disabled" />
195
+ </template>
196
+ <template v-if="slots['right-icons']" #right-icons>
197
+ <slot name="right-icons" :disabled="disabled" />
198
+ </template>
199
+ <template v-if="slots['label-prepend']" #label-prepend>
200
+ <slot name="label-prepend" />
201
+ </template>
202
+ <template v-if="slots['label-append']" #label-append>
203
+ <slot name="label-append" />
204
+ </template>
205
+ <template v-if="slots['header-right']" #header-right>
206
+ <slot name="header-right" />
207
+ </template>
208
+ <div class="nac-input-box" @mousedown.stop="" @mouseup.stop="">
209
+ <div class="w-full h-full" :class="rowClass" style="background-color: transparent">
210
+ <template v-for="(row, index) in itemList" :key="index">
211
+ <div :class="colClass">
212
+ <HsFcCheckBox
213
+ :data="props.data.includes(row.id) === true"
214
+ :label="tx(row.text).value"
215
+ :class="itemClass"
216
+ :class-img="props.classImg"
217
+ :class-img-tag="props.classImgTag"
218
+ :image="props.image"
219
+ :img-url="row.imgUrl"
220
+ :tabindex="tabindex === void 0 ? void 0 : String(tabindex)"
221
+ :disabled="props.disabled"
222
+ @value-change="(value) => valueChange(row.id)"
223
+ @focus="() => onFocus(row)"
224
+ @blur="() => onBlur(row)"
225
+ @ref="(e) => setRef(e, index)"
226
+ />
227
+ </div>
228
+ </template>
229
+ </div>
230
+ </div>
231
+ </InputFrame>
232
+ </template>
233
+
364
234
  <style scoped>
365
235
  .nac-input-box {
366
236
  width: 100%;
367
237
  height: 100%;
368
238
  }
369
- </style>
239
+ </style>