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,408 +1,253 @@
1
- <script setup lang="ts">
2
- /* ----------------------------------------------------------------------------
3
- // src\runtime\components\interactive\dialog.vue
4
- // ----------------------------------------------------------------------------
5
- // Dialog
6
- // DialogDialog
7
- ----------------------------------------------------------------------------- */
8
-
9
- // [ tailwind ]
10
- // import { twMerge } from 'tailwind-merge';
11
-
12
- // ----------------------------------------------------------------------------
13
-
14
- // import { type ClassType, ClassTypeToString } from '~/components/lib/class-style';
15
- // import { TailwindPrefix } from '~/components/hs/setting';
16
- // ----------------------------------------------------------------------------
17
-
18
- import { disableBodyScroll, enableBodyScroll } from "body-scroll-lock";
19
- // [ NUXT ]
20
- import { computed, ref, watch, nextTick } from "#imports";
21
- // [ types ]
22
- import { DialogDefaultZIndex } from "../../types/dialog";
23
- // [ composables ]
24
- import { useHsDialog } from "../../composables/use-hs-dialog";
25
- import { useHsMultiLang } from "../../composables/use-hs-multi-lang";
26
- // [ Components ]
27
- import Modal from "./modal.vue";
28
- import Card from "../layout/card.vue";
29
- import CardItem from "../layout/card-item.vue";
30
- import Btn from "../form/btn.vue";
31
- // ----------------------------------------------------------------------------
32
-
33
- // ----------------------------------------------------------------------------
34
- // [ nac-Stroe ]
35
- const toast = useHsDialog();
36
- const state = toast.state;
37
- // ----------------------------------------------------------------------------
38
- const multiLang = useHsMultiLang();
39
- const tx = multiLang.tx;
40
- // ----------------------------------------------------------------------------
41
- const cancelBtnElm = ref<HTMLElement | null>(null);
42
- const leftBtnElm = ref<HTMLElement | null>(null);
43
- const rightBtnElm = ref<HTMLElement | null>(null);
44
- // ----------------------------------------------------------------------------
45
-
46
- const activeItem = computed(() => {
47
- if (state.pendingList.length !== 0) {
48
- return state.pendingList[0];
49
- } else {
50
- return null;
51
- }
52
- });
53
-
54
- const activateTs = computed(() => {
55
- if (activeItem.value !== null) {
56
- return activeItem.value.ts;
57
- } else {
58
- return null;
59
- }
60
- });
61
-
62
- const isShow = computed(() => {
63
- return activeItem.value !== null;
64
- });
65
-
66
- const clickLeft = () => {
67
- if (activeItem.value === null) return;
68
- const item = activeItem.value;
69
- if (item.data.option.btnLeft.isShow === false) return;
70
- item.data.leftBtnClick();
71
- };
72
- const clickRight = () => {
73
- if (activeItem.value === null) return;
74
- const item = activeItem.value;
75
- if (item.data.option.btnRight.isShow === false) return;
76
- item.data.rightBtnClick();
77
- };
78
-
79
- const clickCancel = () => {
80
- if (activeItem.value === null) return;
81
- const item = activeItem.value;
82
- if (item.data.option.btnCancel.isShow === false) return;
83
- item.data.cancelBtnClick();
84
- };
85
-
86
- const clickBg = () => {
87
- if (activeItem.value === null) return;
88
- const item = activeItem.value;
89
- if (activeItem.value?.data.option.bgClose === true) {
90
- item.data.cancelBtnClick();
91
- return;
92
- }
93
- if (item.data.option.btnCancel.isShow === false) return;
94
- item.data.cancelBtnClick();
95
- };
96
-
97
- watch(activateTs, async (ts) => {
98
- await nextTick();
99
- if (ts === null || !isShow.value) {
100
- return;
101
- }
102
- if (activeItem.value === null) return;
103
- if (isShow.value === true) {
104
- if (
105
- activeItem.value.data.option.defaultBtn === "right" &&
106
- rightBtnElm.value !== null
107
- ) {
108
- rightBtnElm.value.focus();
109
- } else if (
110
- activeItem.value.data.option.defaultBtn === "left" &&
111
- leftBtnElm.value !== null
112
- ) {
113
- leftBtnElm.value.focus();
114
- } else if (
115
- activeItem.value.data.option.defaultBtn === "cancel" &&
116
- cancelBtnElm.value !== null
117
- ) {
118
- cancelBtnElm.value.focus();
119
- }
120
- }
121
- });
122
-
123
- const keyMoveFlag = ref(false);
124
- const onKeyDownNoBtn = (e: KeyboardEvent) => {
125
- if (activeItem.value === null) return "";
126
- if (e.key === "Tab") return;
127
- if (
128
- activeItem.value.data.option.btnRight.isShow === true &&
129
- rightBtnElm.value !== null
130
- ) {
131
- keyMoveFlag.value = true;
132
- rightBtnElm.value.focus();
133
- }
134
- };
135
-
136
- const onKeyDownYesBtn = (e: KeyboardEvent) => {
137
- if (activeItem.value === null) return "";
138
- if (e.key === "Tab") return;
139
- if (
140
- activeItem.value.data.option.btnLeft.isShow === true &&
141
- leftBtnElm.value !== null
142
- ) {
143
- keyMoveFlag.value = true;
144
- leftBtnElm.value.focus();
145
- }
146
- };
147
-
148
- const zindex = computed(() => {
149
- if (activeItem.value === null) return DialogDefaultZIndex;
150
- return activeItem.value.data.option.zindex;
151
- });
152
-
153
- // const headerColor = computed(() => {
154
- // if (!activeItem.value) return '';
155
- // // return BgColorStyle(activeItem.value.data.option.color);
156
- // });
157
-
158
- // ----------------------------------------------------------------------------
159
- // ----------------------------------------------------------------------------
160
- const targetElm = ref<HTMLElement | null>(null);
161
- watch(isShow, (v) => {
162
- if (!targetElm.value) return;
163
- if (v) {
164
- const options = {
165
- reserveScrollBarGap: true, // bodyにスクロールバー分のpadding-rightを追加するかどうか(デフォルト値:false)
166
- };
167
- // console.log(id, 'activate');
168
- disableBodyScroll(targetElm.value, options);
169
- } else {
170
- // console.log(id, 'de-activate');
171
- enableBodyScroll(targetElm.value);
172
- }
173
- });
174
-
175
- const cancelBtnStyle = [
176
- //
177
- "px-2",
178
- "py-1",
179
- "border-[1px]",
180
- "!bg-transparent",
181
- "rounded-none",
182
- "h-full",
183
- ];
184
-
185
- const cancelBtnStyleInner = [
186
- //
187
- "flex",
188
- "items-center",
189
- ];
190
- const btnBaseStyle = [
191
- //
192
- "grid",
193
- "grid-cols-2",
194
- "gap-2",
195
- ];
196
- const btnStyle = [
197
- //
198
- "py-1",
199
- "w-full",
200
- ];
201
- const titleStyle = [
202
- //
203
- "text-[14px]",
204
- "sm:text-[18px]",
205
- "whitespace-pre-line",
206
- "text-wrap",
207
- ];
208
- const messageStyle = [
209
- //
210
- "text-[14px]",
211
- "sm:text-[18px]",
212
- "whitespace-pre-line",
213
- "text-wrap",
214
- "pb-2",
215
- ];
216
- const cardStyle = [
217
- //
218
- "min-w-[300px]",
219
- "mt-auto",
220
- "mb-auto",
221
- ];
222
- const closeBtnIcon = [
223
- //
224
- "mx-1",
225
- ];
226
- const baseCardHeader = [
227
- //
228
- "py-1",
229
- "pe-1",
230
- ];
231
-
232
- const modalClosable = computed(() => {
233
- if (activeItem.value?.data.option.btnCancel.isShow) return true;
234
- if (activeItem.value?.data.option.bgClose !== undefined) {
235
- return activeItem.value?.data.option.bgClose;
236
- }
237
- return false;
238
- });
239
- </script>
240
-
241
- <template>
242
- <ClientOnly>
243
- <Modal
244
- ref="targetElm"
245
- :show="isShow"
246
- :z-index="zindex"
247
- focus-lock
248
- :closeable="modalClosable"
249
- @close="clickBg()"
250
- >
251
- <Card
252
- v-if="activeItem !== null"
253
- class="HsUiDialog"
254
- :class="cardStyle"
255
- @click.stop
256
- >
257
- <CardItem
258
- :class="[`theme-${activeItem.data.option.theme}`, baseCardHeader]"
259
- variant="header"
260
- >
261
- <div :class="titleStyle">
262
- {{ tx(activeItem.data.title) }}
263
- </div>
264
- <Btn
265
- v-if="activeItem.data.option.btnCancel.isShow"
266
- :class="cancelBtnStyle"
267
- :class-inner="cancelBtnStyleInner"
268
- variant="outlined"
269
- :theme="activeItem.data.option.btnCancel.theme"
270
- @click="clickCancel()"
271
- @ref="(e:any) => (cancelBtnElm = e)"
272
- >
273
- <i class="fas fa-times" :class="closeBtnIcon" />
274
- {{ tx(activeItem.data.option.btnCancel.title) }}
275
- </Btn>
276
- </CardItem>
277
- <CardItem variant="body">
278
- <div :class="messageStyle">
279
- {{ tx(activeItem.data.message) }}
280
- </div>
281
- <div :class="btnBaseStyle">
282
- <div class="flex-cc">
283
- <Btn
284
- v-if="activeItem.data.option.btnLeft.isShow"
285
- :class="[
286
- btnStyle,
287
- activeItem.data.option.btnLeft.variant === 'outlined'
288
- ? 'bg-white'
289
- : '',
290
- ]"
291
- :variant="activeItem.data.option.btnLeft.variant"
292
- :theme="activeItem.data.option.btnLeft.theme"
293
- @click="clickLeft()"
294
- @ref="(e:any) => (leftBtnElm = e)"
295
- @keydown="onKeyDownNoBtn"
296
- >
297
- {{ tx(activeItem.data.option.btnLeft.title) }}
298
- </Btn>
299
- </div>
300
- <div class="flex-cc">
301
- <Btn
302
- v-if="activeItem.data.option.btnRight.isShow"
303
- :class="[
304
- btnStyle,
305
- activeItem.data.option.btnRight.variant === 'outlined'
306
- ? 'bg-white'
307
- : '',
308
- ]"
309
- :variant="activeItem.data.option.btnRight.variant"
310
- :theme="activeItem.data.option.btnRight.theme"
311
- @click="clickRight()"
312
- @ref="(e:any) => (rightBtnElm = e)"
313
- @keydown="onKeyDownYesBtn"
314
- >
315
- {{ tx(activeItem.data.option.btnRight.title) }}
316
- </Btn>
317
- </div>
318
- </div>
319
- </CardItem>
320
- </Card>
321
- </Modal>
322
- </ClientOnly>
323
- </template>
324
-
325
- <style scoped>
326
- .theme-main0 {
327
- background-color: theme("colors.main0");
328
- color: theme("colors.white");
329
- }
1
+ <script setup>
2
+ import { disableBodyScroll, enableBodyScroll } from "body-scroll-lock";
3
+ import { computed, ref, watch, nextTick } from "#imports";
4
+ import { DialogDefaultZIndex } from "../../types/dialog";
5
+ import { useHsDialog } from "../../composables/use-hs-dialog";
6
+ import { useHsMultiLang } from "../../composables/use-hs-multi-lang";
7
+ import { useHsPinia } from "../../composables/use-pinia";
8
+ import Modal from "./modal.vue";
9
+ import Card from "../layout/card.vue";
10
+ import CardItem from "../layout/card-item.vue";
11
+ import Btn from "../form/btn.vue";
12
+ import { GetTextColor, GetColorCode } from "../../utils/theme";
13
+ const toast = useHsDialog(useHsPinia());
14
+ const state = toast.state;
15
+ const multiLang = useHsMultiLang(useHsPinia());
16
+ const tx = multiLang.tx;
17
+ const cancelBtnElm = ref(null);
18
+ const leftBtnElm = ref(null);
19
+ const rightBtnElm = ref(null);
20
+ const activeItem = computed(() => {
21
+ if (state.pendingList.length !== 0) {
22
+ return state.pendingList[0];
23
+ } else {
24
+ return null;
25
+ }
26
+ });
27
+ const activateTs = computed(() => {
28
+ if (activeItem.value) {
29
+ return activeItem.value.ts;
30
+ } else {
31
+ return null;
32
+ }
33
+ });
34
+ const isShow = computed(() => {
35
+ return activeItem.value !== null;
36
+ });
37
+ const clickLeft = () => {
38
+ if (!activeItem.value) return;
39
+ const item = activeItem.value;
40
+ if (item.data.option.btnLeft.isShow === false) return;
41
+ item.data.leftBtnClick();
42
+ };
43
+ const clickRight = () => {
44
+ if (!activeItem.value) return;
45
+ const item = activeItem.value;
46
+ if (item.data.option.btnRight.isShow === false) return;
47
+ item.data.rightBtnClick();
48
+ };
49
+ const clickCancel = () => {
50
+ if (!activeItem.value) return;
51
+ const item = activeItem.value;
52
+ if (item.data.option.btnCancel.isShow === false) return;
53
+ item.data.cancelBtnClick();
54
+ };
55
+ const clickBg = () => {
56
+ if (!activeItem.value) return;
57
+ const item = activeItem.value;
58
+ if (activeItem.value?.data.option.bgClose === true) {
59
+ item.data.cancelBtnClick();
60
+ return;
61
+ }
62
+ if (item.data.option.btnCancel.isShow === false) return;
63
+ item.data.cancelBtnClick();
64
+ };
65
+ watch(activateTs, async (ts) => {
66
+ await nextTick();
67
+ if (ts === null || !isShow.value) {
68
+ return;
69
+ }
70
+ if (!activeItem.value) return;
71
+ if (isShow.value === true) {
72
+ if (activeItem.value.data.option.defaultBtn === "right" && rightBtnElm.value !== null) {
73
+ rightBtnElm.value.focus();
74
+ } else if (activeItem.value.data.option.defaultBtn === "left" && leftBtnElm.value !== null) {
75
+ leftBtnElm.value.focus();
76
+ } else if (activeItem.value.data.option.defaultBtn === "cancel" && cancelBtnElm.value !== null) {
77
+ cancelBtnElm.value.focus();
78
+ }
79
+ }
80
+ });
81
+ const keyMoveFlag = ref(false);
82
+ const onKeyDownNoBtn = (e) => {
83
+ if (!activeItem.value) return;
84
+ if (e.key === "Tab") return;
85
+ if (activeItem.value.data.option.btnRight.isShow === true && rightBtnElm.value !== null) {
86
+ keyMoveFlag.value = true;
87
+ rightBtnElm.value.focus();
88
+ }
89
+ };
90
+ const onKeyDownYesBtn = (e) => {
91
+ if (!activeItem.value) return;
92
+ if (e.key === "Tab") return;
93
+ if (activeItem.value.data.option.btnLeft.isShow === true && leftBtnElm.value !== null) {
94
+ keyMoveFlag.value = true;
95
+ leftBtnElm.value.focus();
96
+ }
97
+ };
98
+ const zindex = computed(() => {
99
+ if (!activeItem.value) return DialogDefaultZIndex;
100
+ return activeItem.value.data.option.zindex;
101
+ });
102
+ const targetElm = ref(null);
103
+ watch(isShow, (v) => {
104
+ if (!targetElm.value) return;
105
+ if (v) {
106
+ const options = {
107
+ reserveScrollBarGap: true
108
+ // bodyにスクロールバー分のpadding-rightを追加するかどうか(デフォルト値:false)
109
+ };
110
+ disableBodyScroll(targetElm.value, options);
111
+ } else {
112
+ enableBodyScroll(targetElm.value);
113
+ }
114
+ });
115
+ const cancelBtnStyle = [
116
+ //
117
+ "px-2",
118
+ "py-1",
119
+ "border-[1px]",
120
+ "!bg-transparent",
121
+ "rounded-none",
122
+ "h-full"
123
+ ];
124
+ const cancelBtnStyleInner = [
125
+ //
126
+ "flex",
127
+ "items-center"
128
+ ];
129
+ const btnBaseStyle = [
130
+ //
131
+ "grid",
132
+ "grid-cols-2",
133
+ "gap-2"
134
+ ];
135
+ const btnStyle = [
136
+ //
137
+ "py-1",
138
+ "w-full"
139
+ ];
140
+ const titleStyle = [
141
+ //
142
+ "text-[14px]",
143
+ "sm:text-[18px]",
144
+ "whitespace-pre-line",
145
+ "text-wrap"
146
+ ];
147
+ const messageStyle = [
148
+ //
149
+ "text-[14px]",
150
+ "sm:text-[18px]",
151
+ "whitespace-pre-line",
152
+ "text-wrap",
153
+ "pb-2"
154
+ ];
155
+ const cardStyle = [
156
+ //
157
+ "min-w-[300px]",
158
+ "mt-auto",
159
+ "mb-auto"
160
+ ];
161
+ const closeBtnIcon = [
162
+ //
163
+ "mx-1"
164
+ ];
165
+ const baseCardHeader = [
166
+ //
167
+ "py-1",
168
+ "pe-1",
169
+ "bg-[var(--color-bg)]",
170
+ "text-[var(--color-text)]"
171
+ ];
172
+ const modalClosable = computed(() => {
173
+ if (activeItem.value?.data.option.btnCancel.isShow) return true;
174
+ if (activeItem.value?.data.option.bgClose !== void 0) {
175
+ return activeItem.value?.data.option.bgClose;
176
+ }
177
+ return false;
178
+ });
179
+ const bgColorCode = computed(() => {
180
+ if (!activeItem.value) return "#000000";
181
+ return GetColorCode(activeItem.value.data.option.theme);
182
+ });
183
+ const textColorCode = computed(() => {
184
+ if (!activeItem.value) return "#FFFFFF";
185
+ return GetTextColor(bgColorCode.value);
186
+ });
187
+ const headerStyle = computed(() => {
188
+ return ["--color-bg:" + bgColorCode.value, "--color-text:" + textColorCode.value];
189
+ });
190
+ </script>
330
191
 
331
- .theme-main1 {
332
- background-color: theme("colors.main1");
333
- color: theme("colors.white");
334
- }
335
-
336
- .theme-main2 {
337
- background-color: theme("colors.main2");
338
- color: theme("colors.white");
339
- }
340
-
341
- .theme-main3 {
342
- background-color: theme("colors.main3");
343
- color: theme("colors.white");
344
- }
345
-
346
- .theme-accent1 {
347
- background-color: theme("colors.accent1");
348
- color: theme("colors.white");
349
- }
350
-
351
- .theme-accent2 {
352
- background-color: theme("colors.accent2");
353
- color: theme("colors.white");
354
- }
355
-
356
- .theme-info {
357
- background-color: theme("colors.info");
358
- color: theme("colors.white");
359
- }
360
-
361
- .theme-link {
362
- background-color: theme("colors.link");
363
- color: theme("colors.white");
364
- }
365
-
366
- .theme-download {
367
- background-color: theme("colors.download");
368
- color: theme("colors.white");
369
- }
370
-
371
- .theme-success {
372
- background-color: theme("colors.success");
373
- color: theme("colors.white");
374
- }
375
-
376
- .theme-warn {
377
- background-color: theme("colors.warn");
378
- color: theme("colors.white");
379
- }
380
-
381
- .theme-error {
382
- background-color: theme("colors.error");
383
- color: theme("colors.white");
384
- }
385
-
386
- .theme-white {
387
- background-color: theme("colors.white");
388
- color: theme("colors.main1");
389
- }
390
- .theme-white .Btn--border {
391
- border-color: theme("colors.gray.600");
392
- }
393
-
394
- .theme-black {
395
- background-color: theme("colors.black");
396
- color: theme("colors.white");
397
- }
398
-
399
- .theme-dark {
400
- background-color: theme("colors.dark");
401
- color: theme("colors.white");
402
- }
403
-
404
- .theme-back {
405
- background-color: theme("colors.back");
406
- color: theme("colors.main1");
407
- }
408
- </style>
192
+ <template>
193
+ <ClientOnly>
194
+ <Modal ref="targetElm" :show="isShow" :z-index="zindex" focus-lock :closeable="modalClosable" @close="clickBg()">
195
+ <Card v-if="activeItem" class="HsUiDialog" :class="cardStyle" @click.stop>
196
+ <CardItem
197
+ :class="[`theme-${activeItem.data.option.theme}`, baseCardHeader]"
198
+ variant="header"
199
+ :style="headerStyle"
200
+ >
201
+ <div :class="titleStyle">
202
+ {{ tx(activeItem.data.title) }}
203
+ </div>
204
+ <Btn
205
+ v-if="activeItem.data.option.btnCancel.isShow"
206
+ :class="cancelBtnStyle"
207
+ :class-inner="cancelBtnStyleInner"
208
+ variant="outlined"
209
+ :theme="activeItem.data.option.btnCancel.theme"
210
+ @click="clickCancel()"
211
+ @ref="(e) => cancelBtnElm = e"
212
+ >
213
+ <i class="fas fa-times" :class="closeBtnIcon" />
214
+ {{ tx(activeItem.data.option.btnCancel.title) }}
215
+ </Btn>
216
+ </CardItem>
217
+ <CardItem variant="body">
218
+ <div :class="messageStyle">
219
+ {{ tx(activeItem.data.message) }}
220
+ </div>
221
+ <div :class="btnBaseStyle">
222
+ <div class="flex items-center justify-center">
223
+ <Btn
224
+ v-if="activeItem.data.option.btnLeft.isShow"
225
+ :class="[btnStyle, activeItem.data.option.btnLeft.variant === 'outlined' ? 'bg-white' : '']"
226
+ :variant="activeItem.data.option.btnLeft.variant"
227
+ :theme="activeItem.data.option.btnLeft.theme"
228
+ @click="clickLeft()"
229
+ @ref="(e) => leftBtnElm = e"
230
+ @keydown="onKeyDownNoBtn"
231
+ >
232
+ {{ tx(activeItem.data.option.btnLeft.title) }}
233
+ </Btn>
234
+ </div>
235
+ <div class="flex items-center justify-center">
236
+ <Btn
237
+ v-if="activeItem.data.option.btnRight.isShow"
238
+ :class="[btnStyle, activeItem.data.option.btnRight.variant === 'outlined' ? 'bg-white' : '']"
239
+ :variant="activeItem.data.option.btnRight.variant"
240
+ :theme="activeItem.data.option.btnRight.theme"
241
+ @click="clickRight()"
242
+ @ref="(e) => rightBtnElm = e"
243
+ @keydown="onKeyDownYesBtn"
244
+ >
245
+ {{ tx(activeItem.data.option.btnRight.title) }}
246
+ </Btn>
247
+ </div>
248
+ </div>
249
+ </CardItem>
250
+ </Card>
251
+ </Modal>
252
+ </ClientOnly>
253
+ </template>