nuxt-hs-ui 1.0.1
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 +4 -0
- package/dist/module.cjs +5 -0
- package/dist/module.d.mts +8 -0
- package/dist/module.d.ts +8 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +92 -0
- package/dist/runtime/components/hs-fc/btn/index.vue +508 -0
- package/dist/runtime/components/hs-fc/btn/line-loading.vue +125 -0
- package/dist/runtime/components/hs-fc/hoge +0 -0
- package/dist/runtime/components/hs-ui/accordion.vue +93 -0
- package/dist/runtime/components/hs-ui/aspect-box.vue +78 -0
- package/dist/runtime/components/hs-ui/block-loading.vue +210 -0
- package/dist/runtime/components/hs-ui/card-item.vue +136 -0
- package/dist/runtime/components/hs-ui/card.vue +48 -0
- package/dist/runtime/components/hs-ui/container.vue +46 -0
- package/dist/runtime/components/hs-ui/dialog/index.type.d.ts +48 -0
- package/dist/runtime/components/hs-ui/dialog/index.type.js +57 -0
- package/dist/runtime/components/hs-ui/dialog/index.vue +353 -0
- package/dist/runtime/components/hs-ui/modal/bg.vue +90 -0
- package/dist/runtime/components/hs-ui/modal/index.vue +203 -0
- package/dist/runtime/components/hs-ui/modal/use-ui-modal.d.ts +20 -0
- package/dist/runtime/components/hs-ui/modal/use-ui-modal.js +74 -0
- package/dist/runtime/components/hs-ui/toast/index.type.d.ts +24 -0
- package/dist/runtime/components/hs-ui/toast/index.type.js +7 -0
- package/dist/runtime/components/hs-ui/toast/index.vue +355 -0
- package/dist/runtime/components/hs-ui/window-loader.vue +185 -0
- package/dist/runtime/components/v-test.vue +57 -0
- package/dist/runtime/composables/use-hs-form-focus.d.ts +10 -0
- package/dist/runtime/composables/use-hs-form-focus.js +29 -0
- package/dist/runtime/composables/use-hs-multi-lang.d.ts +9 -0
- package/dist/runtime/composables/use-hs-multi-lang.js +21 -0
- package/dist/runtime/composables/use-hs-ui-dialog.d.ts +22 -0
- package/dist/runtime/composables/use-hs-ui-dialog.js +43 -0
- package/dist/runtime/composables/use-hs-ui-toast.d.ts +20 -0
- package/dist/runtime/composables/use-hs-ui-toast.js +55 -0
- package/dist/runtime/composables/use-hs-ui-window-loader.d.ts +11 -0
- package/dist/runtime/composables/use-hs-ui-window-loader.js +21 -0
- package/dist/runtime/lib/class-style.d.ts +8 -0
- package/dist/runtime/lib/class-style.js +59 -0
- package/dist/runtime/lib/com.d.ts +14 -0
- package/dist/runtime/lib/com.js +25 -0
- package/dist/runtime/lib/multi-lang.d.ts +9 -0
- package/dist/runtime/lib/multi-lang.js +75 -0
- package/dist/runtime/lib/number.d.ts +16 -0
- package/dist/runtime/lib/number.js +101 -0
- package/dist/runtime/lib/prefix.d.ts +2 -0
- package/dist/runtime/lib/prefix.js +19 -0
- package/dist/runtime/lib/theme.d.ts +2 -0
- package/dist/runtime/lib/theme.js +21 -0
- package/dist/runtime/server/tsconfig.json +3 -0
- package/dist/runtime/style.css +1 -0
- package/dist/types.d.mts +17 -0
- package/dist/types.d.ts +17 -0
- package/package.json +82 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/* ----------------------------------------------------------------------------
|
|
3
|
+
src\runtime\components\hs-ui\container.vue
|
|
4
|
+
// ----------------------------------------------------------------------------
|
|
5
|
+
HsUiContainer
|
|
6
|
+
HsUiContainerHsUiContainer
|
|
7
|
+
----------------------------------------------------------------------------- */
|
|
8
|
+
|
|
9
|
+
// [ node_modules ]
|
|
10
|
+
// [ vue ]
|
|
11
|
+
import { computed } from 'vue';
|
|
12
|
+
// [ tailwind ]
|
|
13
|
+
import { extendTailwindMerge } from 'tailwind-merge';
|
|
14
|
+
import { type ClassType, ClassTypeToString } from '../../lib/class-style';
|
|
15
|
+
import { GetPrefix, RemovePrefix } from '../../lib/prefix';
|
|
16
|
+
|
|
17
|
+
// ----------------------------------------------------------------------------
|
|
18
|
+
const twMerge = extendTailwindMerge({
|
|
19
|
+
prefix: GetPrefix(),
|
|
20
|
+
});
|
|
21
|
+
// ----------------------------------------------------------------------------
|
|
22
|
+
interface Props {
|
|
23
|
+
class?: ClassType | undefined;
|
|
24
|
+
}
|
|
25
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
26
|
+
class: '',
|
|
27
|
+
});
|
|
28
|
+
const baseClass = RemovePrefix([
|
|
29
|
+
//
|
|
30
|
+
'container',
|
|
31
|
+
'tw-container',
|
|
32
|
+
'mx-auto',
|
|
33
|
+
'tw-mx-auto',
|
|
34
|
+
'px-2',
|
|
35
|
+
'tw-px-2',
|
|
36
|
+
]);
|
|
37
|
+
|
|
38
|
+
const classStyle = computed(() => {
|
|
39
|
+
return twMerge(baseClass, ClassTypeToString(props.class));
|
|
40
|
+
});
|
|
41
|
+
</script>
|
|
42
|
+
<template>
|
|
43
|
+
<div :class="classStyle">
|
|
44
|
+
<slot />
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type MultiLang } from '../../../lib/multi-lang.js';
|
|
2
|
+
import type { Theme } from '../../../lib/theme.js';
|
|
3
|
+
export declare const DialogDefaultZIndex = 3000;
|
|
4
|
+
export declare const DialogResult: {
|
|
5
|
+
readonly left: "left";
|
|
6
|
+
readonly right: "right";
|
|
7
|
+
readonly cancel: "cancel";
|
|
8
|
+
};
|
|
9
|
+
export type DialogResult = (typeof DialogResult)[keyof typeof DialogResult];
|
|
10
|
+
/**
|
|
11
|
+
* Option interface
|
|
12
|
+
*/
|
|
13
|
+
export interface DialogOption {
|
|
14
|
+
zindex: number;
|
|
15
|
+
theme: Theme;
|
|
16
|
+
defaultBtn: 'left' | 'right' | 'cancel' | null;
|
|
17
|
+
btnLeft: {
|
|
18
|
+
isShow: boolean;
|
|
19
|
+
title: MultiLang;
|
|
20
|
+
theme: Theme;
|
|
21
|
+
};
|
|
22
|
+
btnRight: {
|
|
23
|
+
isShow: boolean;
|
|
24
|
+
title: MultiLang;
|
|
25
|
+
theme: Theme;
|
|
26
|
+
};
|
|
27
|
+
btnCancel: {
|
|
28
|
+
isShow: boolean;
|
|
29
|
+
title: MultiLang;
|
|
30
|
+
theme: Theme;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Option 初期化
|
|
35
|
+
* Store経由で利用する
|
|
36
|
+
*/
|
|
37
|
+
export declare const InitDialogOption: () => DialogOption;
|
|
38
|
+
export declare class DialogItem {
|
|
39
|
+
message: MultiLang;
|
|
40
|
+
title: MultiLang;
|
|
41
|
+
option: DialogOption;
|
|
42
|
+
counter: number;
|
|
43
|
+
constructor(message: MultiLang, title: MultiLang, option?: DialogOption);
|
|
44
|
+
leftBtnClick: () => void;
|
|
45
|
+
rightBtnClick: () => void;
|
|
46
|
+
cancelBtnClick: () => void;
|
|
47
|
+
show: () => Promise<DialogResult>;
|
|
48
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export const DialogDefaultZIndex = 3e3;
|
|
2
|
+
export const DialogResult = {
|
|
3
|
+
left: "left",
|
|
4
|
+
right: "right",
|
|
5
|
+
cancel: "cancel"
|
|
6
|
+
};
|
|
7
|
+
export const InitDialogOption = () => {
|
|
8
|
+
return {
|
|
9
|
+
zindex: 10001,
|
|
10
|
+
theme: "main1",
|
|
11
|
+
defaultBtn: "right",
|
|
12
|
+
btnLeft: {
|
|
13
|
+
isShow: true,
|
|
14
|
+
title: "no",
|
|
15
|
+
theme: "dark"
|
|
16
|
+
},
|
|
17
|
+
btnRight: {
|
|
18
|
+
isShow: true,
|
|
19
|
+
title: "Yes",
|
|
20
|
+
theme: "accent1"
|
|
21
|
+
},
|
|
22
|
+
btnCancel: {
|
|
23
|
+
isShow: true,
|
|
24
|
+
title: "",
|
|
25
|
+
theme: "white"
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export class DialogItem {
|
|
30
|
+
message;
|
|
31
|
+
title;
|
|
32
|
+
option;
|
|
33
|
+
counter;
|
|
34
|
+
// public timeout: boolean;
|
|
35
|
+
constructor(message, title, option = InitDialogOption()) {
|
|
36
|
+
this.message = message;
|
|
37
|
+
this.title = title;
|
|
38
|
+
this.option = option;
|
|
39
|
+
this.counter = -1;
|
|
40
|
+
}
|
|
41
|
+
leftBtnClick = () => console.log();
|
|
42
|
+
rightBtnClick = () => console.log();
|
|
43
|
+
cancelBtnClick = () => console.log();
|
|
44
|
+
show = () => {
|
|
45
|
+
return new Promise((resolve) => {
|
|
46
|
+
this.leftBtnClick = () => {
|
|
47
|
+
resolve(DialogResult.left);
|
|
48
|
+
};
|
|
49
|
+
this.rightBtnClick = () => {
|
|
50
|
+
resolve(DialogResult.right);
|
|
51
|
+
};
|
|
52
|
+
this.cancelBtnClick = () => {
|
|
53
|
+
resolve(DialogResult.cancel);
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
}
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/* ----------------------------------------------------------------------------
|
|
3
|
+
src\runtime\components\hs-ui\dialog\index.vue
|
|
4
|
+
// ----------------------------------------------------------------------------
|
|
5
|
+
HsUiDialog
|
|
6
|
+
HsUiDialogHsUiDialog
|
|
7
|
+
----------------------------------------------------------------------------- */
|
|
8
|
+
|
|
9
|
+
// [ vue ]
|
|
10
|
+
import { computed, watch, ref, nextTick } from 'vue';
|
|
11
|
+
// [ tailwind ]
|
|
12
|
+
import { RemovePrefix } from '../../../lib/prefix';
|
|
13
|
+
// ----------------------------------------------------------------------------
|
|
14
|
+
import { DialogDefaultZIndex } from './index.type';
|
|
15
|
+
import { disableBodyScroll, enableBodyScroll } from 'body-scroll-lock';
|
|
16
|
+
// ----------------------------------------------------------------------------
|
|
17
|
+
import { useHsUiDialog } from '../../../composables/use-hs-ui-dialog';
|
|
18
|
+
import { useHsMultiLang } from '../../../composables/use-hs-multi-lang';
|
|
19
|
+
// ----------------------------------------------------------------------------
|
|
20
|
+
// [ nac-Stroe ]
|
|
21
|
+
const toast = useHsUiDialog();
|
|
22
|
+
const state = toast.state;
|
|
23
|
+
// ----------------------------------------------------------------------------
|
|
24
|
+
const storeMultiLang = useHsMultiLang();
|
|
25
|
+
const MultiLangText = storeMultiLang.MultiLangText;
|
|
26
|
+
// ----------------------------------------------------------------------------
|
|
27
|
+
const cancelBtnElm = ref<HTMLElement | null>(null);
|
|
28
|
+
const leftBtnElm = ref<HTMLElement | null>(null);
|
|
29
|
+
const rightBtnElm = ref<HTMLElement | null>(null);
|
|
30
|
+
// ----------------------------------------------------------------------------
|
|
31
|
+
|
|
32
|
+
const activeItem = computed(() => {
|
|
33
|
+
if (state.pendingList.length !== 0) {
|
|
34
|
+
return state.pendingList[0];
|
|
35
|
+
} else {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const activateTs = computed(() => {
|
|
41
|
+
if (activeItem.value !== null) {
|
|
42
|
+
return activeItem.value.ts;
|
|
43
|
+
} else {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const isShow = computed(() => {
|
|
49
|
+
return activeItem.value !== null;
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const clickLeft = () => {
|
|
53
|
+
if (activeItem.value === null) return;
|
|
54
|
+
const item = activeItem.value;
|
|
55
|
+
if (item.data.option.btnLeft.isShow === false) return;
|
|
56
|
+
item.data.leftBtnClick();
|
|
57
|
+
};
|
|
58
|
+
const clickRight = () => {
|
|
59
|
+
if (activeItem.value === null) return;
|
|
60
|
+
const item = activeItem.value;
|
|
61
|
+
if (item.data.option.btnRight.isShow === false) return;
|
|
62
|
+
item.data.rightBtnClick();
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const clickCancel = () => {
|
|
66
|
+
if (activeItem.value === null) return;
|
|
67
|
+
const item = activeItem.value;
|
|
68
|
+
if (item.data.option.btnCancel.isShow === false) return;
|
|
69
|
+
item.data.cancelBtnClick();
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
watch(activateTs, async (ts) => {
|
|
73
|
+
await nextTick();
|
|
74
|
+
if (ts === null || !isShow.value) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
if (activeItem.value === null) return;
|
|
78
|
+
if (isShow.value === true) {
|
|
79
|
+
if (activeItem.value.data.option.defaultBtn === 'right' && rightBtnElm.value !== null) {
|
|
80
|
+
rightBtnElm.value.focus();
|
|
81
|
+
} else if (activeItem.value.data.option.defaultBtn === 'left' && leftBtnElm.value !== null) {
|
|
82
|
+
leftBtnElm.value.focus();
|
|
83
|
+
} else if (activeItem.value.data.option.defaultBtn === 'cancel' && cancelBtnElm.value !== null) {
|
|
84
|
+
cancelBtnElm.value.focus();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
const keyMoveFlag = ref(false);
|
|
90
|
+
const onKeyDownNoBtn = (e: KeyboardEvent) => {
|
|
91
|
+
if (activeItem.value === null) return '';
|
|
92
|
+
if (e.key === 'Tab') return;
|
|
93
|
+
if (activeItem.value.data.option.btnRight.isShow === true && rightBtnElm.value !== null) {
|
|
94
|
+
keyMoveFlag.value = true;
|
|
95
|
+
rightBtnElm.value.focus();
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const onKeyDownYesBtn = (e: KeyboardEvent) => {
|
|
100
|
+
if (activeItem.value === null) return '';
|
|
101
|
+
if (e.key === 'Tab') return;
|
|
102
|
+
if (activeItem.value.data.option.btnLeft.isShow === true && leftBtnElm.value !== null) {
|
|
103
|
+
keyMoveFlag.value = true;
|
|
104
|
+
leftBtnElm.value.focus();
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const zindex = computed(() => {
|
|
109
|
+
if (activeItem.value === null) return DialogDefaultZIndex;
|
|
110
|
+
return activeItem.value.data.option.zindex;
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
// const headerColor = computed(() => {
|
|
114
|
+
// if (!activeItem.value) return '';
|
|
115
|
+
// // return BgColorStyle(activeItem.value.data.option.color);
|
|
116
|
+
// });
|
|
117
|
+
|
|
118
|
+
// ----------------------------------------------------------------------------
|
|
119
|
+
// ----------------------------------------------------------------------------
|
|
120
|
+
const targetElm = ref<HTMLElement | null>(null);
|
|
121
|
+
watch(isShow, (v) => {
|
|
122
|
+
if (!targetElm.value) return;
|
|
123
|
+
if (v) {
|
|
124
|
+
const options = {
|
|
125
|
+
reserveScrollBarGap: true, // bodyにスクロールバー分のpadding-rightを追加するかどうか(デフォルト値:false)
|
|
126
|
+
};
|
|
127
|
+
// console.log(id, 'activate');
|
|
128
|
+
disableBodyScroll(targetElm.value, options);
|
|
129
|
+
} else {
|
|
130
|
+
// console.log(id, 'de-activate');
|
|
131
|
+
enableBodyScroll(targetElm.value);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
const cancelBtnStyle = RemovePrefix([
|
|
136
|
+
//
|
|
137
|
+
'px-2',
|
|
138
|
+
'tw-px-2',
|
|
139
|
+
'py-1',
|
|
140
|
+
'tw-py-1',
|
|
141
|
+
'border-[1px]',
|
|
142
|
+
'tw-border-[1px]',
|
|
143
|
+
'!bg-transparent',
|
|
144
|
+
'tw-bg-transparent',
|
|
145
|
+
'rounded-none',
|
|
146
|
+
'tw-rounded-none',
|
|
147
|
+
'h-full',
|
|
148
|
+
'tw-h-full',
|
|
149
|
+
]);
|
|
150
|
+
|
|
151
|
+
const cancelBtnStyleInner = RemovePrefix([
|
|
152
|
+
//
|
|
153
|
+
'flex',
|
|
154
|
+
'tw-flex',
|
|
155
|
+
'items-center',
|
|
156
|
+
'tw-items-center',
|
|
157
|
+
]);
|
|
158
|
+
const btnBaseStyle = RemovePrefix([
|
|
159
|
+
//
|
|
160
|
+
'grid',
|
|
161
|
+
'tw-grid',
|
|
162
|
+
'grid-cols-2',
|
|
163
|
+
'tw-grid-cols-2',
|
|
164
|
+
'gap-2',
|
|
165
|
+
'tw-gap-2',
|
|
166
|
+
]);
|
|
167
|
+
const btnStyle = RemovePrefix([
|
|
168
|
+
//
|
|
169
|
+
'py-1',
|
|
170
|
+
'tw-py-1',
|
|
171
|
+
'w-full',
|
|
172
|
+
'tw-w-full',
|
|
173
|
+
]);
|
|
174
|
+
const titleStyle = RemovePrefix([
|
|
175
|
+
//
|
|
176
|
+
'text-[14px]',
|
|
177
|
+
'tw-text-[14px]',
|
|
178
|
+
'sm:text-[18px]',
|
|
179
|
+
'sm:tw-text-[18px]',
|
|
180
|
+
'whitespace-pre-line',
|
|
181
|
+
'tw-whitespace-pre-line',
|
|
182
|
+
'text-wrap',
|
|
183
|
+
'tw-text-wrap',
|
|
184
|
+
]);
|
|
185
|
+
const messageStyle = RemovePrefix([
|
|
186
|
+
//
|
|
187
|
+
'text-[14px]',
|
|
188
|
+
'tw-text-[14px]',
|
|
189
|
+
'sm:text-[18px]',
|
|
190
|
+
'sm:tw-text-[18px]',
|
|
191
|
+
'whitespace-pre-line',
|
|
192
|
+
'tw-whitespace-pre-line',
|
|
193
|
+
'text-wrap',
|
|
194
|
+
'tw-text-wrap',
|
|
195
|
+
//
|
|
196
|
+
'pb-2',
|
|
197
|
+
'tw-pb-2',
|
|
198
|
+
]);
|
|
199
|
+
const cardStyle = RemovePrefix([
|
|
200
|
+
//
|
|
201
|
+
'min-w-[300px]',
|
|
202
|
+
'tw-min-w-[300px]',
|
|
203
|
+
'mt-auto',
|
|
204
|
+
'tw-mt-auto',
|
|
205
|
+
'mb-auto',
|
|
206
|
+
'tw-mb-auto',
|
|
207
|
+
]);
|
|
208
|
+
</script>
|
|
209
|
+
<template>
|
|
210
|
+
<ClientOnly>
|
|
211
|
+
<HsUiModal ref="targetElm" :show="isShow" :z-index="zindex" focus-lock @close="clickCancel()">
|
|
212
|
+
<HsUiCard v-if="activeItem !== null" class="HsUiDialog" :class="cardStyle" @click.stop>
|
|
213
|
+
<HsUiCardItem
|
|
214
|
+
:class="[`theme-${activeItem.data.option.theme}`, RemovePrefix(['py-1', 'tw-py-1', 'pe-1', 'tw-pe-1'])]"
|
|
215
|
+
variant="header"
|
|
216
|
+
>
|
|
217
|
+
<div :class="titleStyle">
|
|
218
|
+
{{ MultiLangText(activeItem.data.title) }}
|
|
219
|
+
</div>
|
|
220
|
+
<HsFcBtn
|
|
221
|
+
v-if="activeItem.data.option.btnCancel.isShow"
|
|
222
|
+
:class="cancelBtnStyle"
|
|
223
|
+
:class-inner="cancelBtnStyleInner"
|
|
224
|
+
variant="outlined"
|
|
225
|
+
:theme="activeItem.data.option.btnCancel.theme"
|
|
226
|
+
@click="clickCancel()"
|
|
227
|
+
@ref="(e:any) => (cancelBtnElm = e)"
|
|
228
|
+
>
|
|
229
|
+
<i class="fas fa-times mx-1" />
|
|
230
|
+
{{ MultiLangText(activeItem.data.option.btnCancel.title) }}
|
|
231
|
+
</HsFcBtn>
|
|
232
|
+
</HsUiCardItem>
|
|
233
|
+
<HsUiCardItem variant="body">
|
|
234
|
+
<div :class="messageStyle">
|
|
235
|
+
{{ MultiLangText(activeItem.data.message) }}
|
|
236
|
+
</div>
|
|
237
|
+
<div :class="btnBaseStyle">
|
|
238
|
+
<div>
|
|
239
|
+
<HsFcBtn
|
|
240
|
+
v-if="activeItem.data.option.btnLeft.isShow"
|
|
241
|
+
:class="btnStyle"
|
|
242
|
+
variant="flat"
|
|
243
|
+
:theme="activeItem.data.option.btnLeft.theme"
|
|
244
|
+
@click="clickLeft()"
|
|
245
|
+
@ref="(e:any) => (leftBtnElm = e)"
|
|
246
|
+
@keydown="onKeyDownNoBtn"
|
|
247
|
+
>
|
|
248
|
+
{{ MultiLangText(activeItem.data.option.btnLeft.title) }}
|
|
249
|
+
</HsFcBtn>
|
|
250
|
+
</div>
|
|
251
|
+
<div>
|
|
252
|
+
<HsFcBtn
|
|
253
|
+
v-if="activeItem.data.option.btnRight.isShow"
|
|
254
|
+
:class="btnStyle"
|
|
255
|
+
variant="flat"
|
|
256
|
+
:theme="activeItem.data.option.btnRight.theme"
|
|
257
|
+
@click="clickRight()"
|
|
258
|
+
@ref="(e:any) => (rightBtnElm = e)"
|
|
259
|
+
@keydown="onKeyDownYesBtn"
|
|
260
|
+
>
|
|
261
|
+
{{ MultiLangText(activeItem.data.option.btnRight.title) }}
|
|
262
|
+
</HsFcBtn>
|
|
263
|
+
</div>
|
|
264
|
+
</div>
|
|
265
|
+
</HsUiCardItem>
|
|
266
|
+
</HsUiCard>
|
|
267
|
+
</HsUiModal>
|
|
268
|
+
</ClientOnly>
|
|
269
|
+
</template>
|
|
270
|
+
<style scoped>
|
|
271
|
+
.theme-main0 {
|
|
272
|
+
background-color: theme("colors.main0");
|
|
273
|
+
color: theme("colors.white");
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
.theme-main1 {
|
|
277
|
+
background-color: theme("colors.main1");
|
|
278
|
+
color: theme("colors.white");
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
.theme-main2 {
|
|
282
|
+
background-color: theme("colors.main2");
|
|
283
|
+
color: theme("colors.white");
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.theme-main3 {
|
|
287
|
+
background-color: theme("colors.main3");
|
|
288
|
+
color: theme("colors.white");
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.theme-accent1 {
|
|
292
|
+
background-color: theme("colors.accent1");
|
|
293
|
+
color: theme("colors.white");
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.theme-accent2 {
|
|
297
|
+
background-color: theme("colors.accent2");
|
|
298
|
+
color: theme("colors.white");
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.theme-info {
|
|
302
|
+
background-color: theme("colors.info");
|
|
303
|
+
color: theme("colors.white");
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.theme-link {
|
|
307
|
+
background-color: theme("colors.link");
|
|
308
|
+
color: theme("colors.white");
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.theme-download {
|
|
312
|
+
background-color: theme("colors.download");
|
|
313
|
+
color: theme("colors.white");
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.theme-success {
|
|
317
|
+
background-color: theme("colors.success");
|
|
318
|
+
color: theme("colors.white");
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.theme-warn {
|
|
322
|
+
background-color: theme("colors.warn");
|
|
323
|
+
color: theme("colors.white");
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
.theme-error {
|
|
327
|
+
background-color: theme("colors.error");
|
|
328
|
+
color: theme("colors.white");
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.theme-white {
|
|
332
|
+
background-color: theme("colors.white");
|
|
333
|
+
color: theme("colors.main1");
|
|
334
|
+
}
|
|
335
|
+
.theme-white .HsFcBtn--border {
|
|
336
|
+
border-color: theme("colors.gray.600");
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
.theme-black {
|
|
340
|
+
background-color: theme("colors.black");
|
|
341
|
+
color: theme("colors.white");
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.theme-dark {
|
|
345
|
+
background-color: theme("colors.dark");
|
|
346
|
+
color: theme("colors.white");
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
.theme-back {
|
|
350
|
+
background-color: theme("colors.back");
|
|
351
|
+
color: theme("colors.main1");
|
|
352
|
+
}
|
|
353
|
+
</style>
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/* ----------------------------------------------------------------------------
|
|
3
|
+
src\runtime\components\hs-ui\modal\bg.vue
|
|
4
|
+
// ----------------------------------------------------------------------------
|
|
5
|
+
HsUiModalBg
|
|
6
|
+
HsUiModalBgHsUiModalBg
|
|
7
|
+
----------------------------------------------------------------------------- */
|
|
8
|
+
|
|
9
|
+
// [ vue ]
|
|
10
|
+
import { computed } from 'vue';
|
|
11
|
+
// [ tailwind ]
|
|
12
|
+
import { extendTailwindMerge } from 'tailwind-merge';
|
|
13
|
+
import { type ClassType, ClassTypeToString } from '../../../lib/class-style';
|
|
14
|
+
import { GetPrefix, RemovePrefix } from '../../../lib/prefix';
|
|
15
|
+
|
|
16
|
+
// [ components > v-ui > modal > * ]
|
|
17
|
+
import { useStoreModal } from './use-ui-modal';
|
|
18
|
+
|
|
19
|
+
// ----------------------------------------------------------------------------
|
|
20
|
+
const twMerge = extendTailwindMerge({
|
|
21
|
+
prefix: GetPrefix(),
|
|
22
|
+
});
|
|
23
|
+
// ----------------------------------------------------------------------------
|
|
24
|
+
|
|
25
|
+
type Props = {
|
|
26
|
+
class?: ClassType | undefined;
|
|
27
|
+
};
|
|
28
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
29
|
+
class: '',
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const vUiModal = useStoreModal();
|
|
33
|
+
|
|
34
|
+
const zIndex = computed(() => {
|
|
35
|
+
if (vUiModal.state.activeList.length === 0) return -1;
|
|
36
|
+
return Math.max(...vUiModal.state.activeList.map((row) => row.zIndex)) - 1;
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const isShow = computed(() => {
|
|
40
|
+
if (vUiModal.state.activeList.length === 0) return false;
|
|
41
|
+
return true;
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const baseClass = RemovePrefix([
|
|
45
|
+
//
|
|
46
|
+
'transition-opacity',
|
|
47
|
+
'tw-transition-opacity',
|
|
48
|
+
'fixed',
|
|
49
|
+
'tw-fixed',
|
|
50
|
+
'inset-0',
|
|
51
|
+
'tw-inset-0',
|
|
52
|
+
'bg-slate-800/[0.8]',
|
|
53
|
+
'tw-bg-slate-800/[0.8]',
|
|
54
|
+
'transition-opacity',
|
|
55
|
+
'tw-transition-opacity',
|
|
56
|
+
]);
|
|
57
|
+
|
|
58
|
+
const variableStyle = computed(() => {
|
|
59
|
+
if (isShow.value) {
|
|
60
|
+
return RemovePrefix([
|
|
61
|
+
//
|
|
62
|
+
'pointer-events-auto',
|
|
63
|
+
'tw-pointer-events-auto',
|
|
64
|
+
'opacity-100',
|
|
65
|
+
'tw-opacity-100',
|
|
66
|
+
]);
|
|
67
|
+
}
|
|
68
|
+
return RemovePrefix([
|
|
69
|
+
//
|
|
70
|
+
'pointer-events-none',
|
|
71
|
+
'tw-pointer-events-none',
|
|
72
|
+
'opacity-0',
|
|
73
|
+
'tw-opacity-0',
|
|
74
|
+
]);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
const classStyle = computed(() => {
|
|
78
|
+
return twMerge(baseClass, variableStyle.value, ClassTypeToString(props.class));
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const closeAll = () => {
|
|
82
|
+
vUiModal.removeAll();
|
|
83
|
+
};
|
|
84
|
+
</script>
|
|
85
|
+
<template>
|
|
86
|
+
<Teleport to="body">
|
|
87
|
+
<!-- -->
|
|
88
|
+
<div class="VUiModalBg" :class="classStyle" :style="{ zIndex: zIndex }" @click.stop="closeAll()"/>
|
|
89
|
+
</Teleport>
|
|
90
|
+
</template>
|