@finema/core 2.3.0 → 2.4.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/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/components/Dialog/index.vue +36 -21
- package/dist/runtime/components/Dialog/index.vue.d.ts +1 -1
- package/dist/runtime/components/Empty.vue +1 -1
- package/dist/runtime/components/Empty.vue.d.ts +0 -1
- package/dist/runtime/components/Loader.vue +1 -1
- package/dist/runtime/components/Loader.vue.d.ts +0 -1
- package/dist/runtime/composables/useDialog.d.ts +2 -0
- package/dist/runtime/composables/useDialog.js +10 -1
- package/dist/runtime/theme/dialog.d.ts +13 -2
- package/dist/runtime/theme/dialog.js +15 -4
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
<AlertDialogRoot :open="true">
|
|
3
|
+
<AlertDialogPortal>
|
|
4
|
+
<AlertDialogOverlay :class="ui.overlay()" />
|
|
5
|
+
<AlertDialogContent
|
|
6
|
+
:class="ui.base()"
|
|
7
|
+
>
|
|
8
8
|
<Icon
|
|
9
9
|
v-if="!propsSafe.isHideIcon"
|
|
10
10
|
:name="getIcon"
|
|
11
11
|
:class="ui.icon()"
|
|
12
12
|
/>
|
|
13
13
|
<div :class="ui.wrapper()">
|
|
14
|
-
<
|
|
14
|
+
<AlertDialogTitle :class="ui.title()">
|
|
15
15
|
{{ propsSafe.title }}
|
|
16
|
-
</
|
|
17
|
-
<
|
|
16
|
+
</AlertDialogTitle>
|
|
17
|
+
<AlertDialogDescription
|
|
18
18
|
v-if="propsSafe.description"
|
|
19
19
|
:class="ui.description()"
|
|
20
20
|
>
|
|
21
21
|
{{ propsSafe.description }}
|
|
22
|
-
</
|
|
22
|
+
</AlertDialogDescription>
|
|
23
|
+
|
|
23
24
|
<div :class="ui.buttonGroup()">
|
|
24
25
|
<Button
|
|
25
26
|
v-if="propsSafe.isShowCancelBtn"
|
|
@@ -33,7 +34,7 @@
|
|
|
33
34
|
</Button>
|
|
34
35
|
<Button
|
|
35
36
|
type="button"
|
|
36
|
-
:color="propsSafe.type"
|
|
37
|
+
:color="propsSafe.isConfirm ? ui.confirmColor() : propsSafe.type"
|
|
37
38
|
:class="ui.confirmButton()"
|
|
38
39
|
@click="emits('close', true)"
|
|
39
40
|
>
|
|
@@ -41,16 +42,24 @@
|
|
|
41
42
|
</Button>
|
|
42
43
|
</div>
|
|
43
44
|
</div>
|
|
44
|
-
</
|
|
45
|
-
</
|
|
46
|
-
</
|
|
45
|
+
</AlertDialogContent>
|
|
46
|
+
</AlertDialogPortal>
|
|
47
|
+
</AlertDialogRoot>
|
|
47
48
|
</template>
|
|
48
49
|
|
|
49
50
|
<script setup>
|
|
51
|
+
import {
|
|
52
|
+
AlertDialogContent,
|
|
53
|
+
AlertDialogDescription,
|
|
54
|
+
AlertDialogOverlay,
|
|
55
|
+
AlertDialogPortal,
|
|
56
|
+
AlertDialogRoot,
|
|
57
|
+
AlertDialogTitle
|
|
58
|
+
} from "reka-ui";
|
|
50
59
|
import { computed, useAttrs } from "vue";
|
|
51
|
-
import { DialogType } from "#core/composables/useDialog";
|
|
52
60
|
import { useUiConfig } from "#core/composables/useConfig";
|
|
53
61
|
import { dialogTheme } from "#core/theme/dialog";
|
|
62
|
+
import { DialogType } from "#core/composables/useDialog";
|
|
54
63
|
const emits = defineEmits();
|
|
55
64
|
const props = withDefaults(defineProps(), {
|
|
56
65
|
confirmText: "\u0E15\u0E01\u0E25\u0E07",
|
|
@@ -71,18 +80,24 @@ const getIcon = computed(() => {
|
|
|
71
80
|
if (propsSafe.value.icon) {
|
|
72
81
|
return propsSafe.value.icon;
|
|
73
82
|
}
|
|
83
|
+
if (propsSafe.value.isConfirm) {
|
|
84
|
+
return ui.value.iconConfirm();
|
|
85
|
+
}
|
|
74
86
|
switch (propsSafe.value.type) {
|
|
75
87
|
case DialogType.SUCCESS:
|
|
76
|
-
return
|
|
88
|
+
return ui.value.iconSuccess();
|
|
77
89
|
case DialogType.ERROR:
|
|
78
|
-
return
|
|
90
|
+
return ui.value.iconError();
|
|
79
91
|
case DialogType.INFO:
|
|
80
|
-
return
|
|
92
|
+
return ui.value.iconInfo();
|
|
81
93
|
case DialogType.WARNING:
|
|
82
|
-
return
|
|
94
|
+
return ui.value.iconWarning();
|
|
83
95
|
default:
|
|
84
|
-
return
|
|
96
|
+
return ui.value.iconInfo();
|
|
85
97
|
}
|
|
86
98
|
});
|
|
87
|
-
const ui = computed(() => useUiConfig(dialogTheme, "dialog")({
|
|
99
|
+
const ui = computed(() => useUiConfig(dialogTheme, "dialog")({
|
|
100
|
+
color: propsSafe.value.isConfirm ? void 0 : propsSafe.value.type,
|
|
101
|
+
confirm: propsSafe.value.isConfirm
|
|
102
|
+
}));
|
|
88
103
|
</script>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { IDialogMetaItem } from '#core/composables/useDialog';
|
|
2
2
|
declare const _default: import("vue").DefineComponent<IDialogMetaItem, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
3
3
|
close: (args_0: boolean) => any;
|
|
4
4
|
}, string, import("vue").PublicProps, Readonly<IDialogMetaItem> & Readonly<{
|
|
@@ -25,7 +25,7 @@ import { useUiConfig } from "#core/composables/useConfig";
|
|
|
25
25
|
import { emptyTheme } from "#core/theme/empty";
|
|
26
26
|
const props = defineProps({
|
|
27
27
|
message: { type: null, required: false, default: "\u0E44\u0E21\u0E48\u0E1E\u0E1A\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25!" },
|
|
28
|
-
icon: { type: String, required: false
|
|
28
|
+
icon: { type: String, required: false },
|
|
29
29
|
ui: { type: null, required: false },
|
|
30
30
|
class: { type: null, required: false }
|
|
31
31
|
});
|
|
@@ -6,7 +6,6 @@ type __VLS_Props = {
|
|
|
6
6
|
class?: any;
|
|
7
7
|
};
|
|
8
8
|
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
9
|
-
icon: string;
|
|
10
9
|
message: any;
|
|
11
10
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
11
|
export default _default;
|
|
@@ -21,7 +21,7 @@ import { loaderTheme } from "#core/theme/loader";
|
|
|
21
21
|
import { useUiConfig } from "#core/composables/useConfig";
|
|
22
22
|
const props = defineProps({
|
|
23
23
|
loading: { type: Boolean, required: false, default: true },
|
|
24
|
-
icon: { type: String, required: false
|
|
24
|
+
icon: { type: String, required: false },
|
|
25
25
|
ui: { type: null, required: false },
|
|
26
26
|
class: { type: null, required: false }
|
|
27
27
|
});
|
|
@@ -11,7 +11,6 @@ type __VLS_Slots = {} & {
|
|
|
11
11
|
};
|
|
12
12
|
declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
13
13
|
loading: boolean;
|
|
14
|
-
icon: string;
|
|
15
14
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
15
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
17
16
|
export default _default;
|
|
@@ -13,11 +13,13 @@ export interface IDialogMetaItem {
|
|
|
13
13
|
cancelText?: string;
|
|
14
14
|
isShowCancelBtn?: boolean;
|
|
15
15
|
isHideIcon?: boolean;
|
|
16
|
+
isConfirm?: boolean;
|
|
16
17
|
}
|
|
17
18
|
export interface IDialog {
|
|
18
19
|
error: (payload: IDialogMetaItem) => Promise<boolean>;
|
|
19
20
|
info: (payload: IDialogMetaItem) => Promise<boolean>;
|
|
20
21
|
success: (payload: IDialogMetaItem) => Promise<boolean>;
|
|
21
22
|
warning: (payload: IDialogMetaItem) => Promise<boolean>;
|
|
23
|
+
confirm: (payload: IDialogMetaItem) => Promise<boolean>;
|
|
22
24
|
}
|
|
23
25
|
export declare const useDialog: () => IDialog;
|
|
@@ -44,10 +44,19 @@ export const useDialog = () => {
|
|
|
44
44
|
type: "warning" /* WARNING */
|
|
45
45
|
});
|
|
46
46
|
};
|
|
47
|
+
const confirm = async (payload) => {
|
|
48
|
+
return openDialog({
|
|
49
|
+
...payload,
|
|
50
|
+
type: "info" /* INFO */,
|
|
51
|
+
isShowCancelBtn: true,
|
|
52
|
+
isConfirm: true
|
|
53
|
+
});
|
|
54
|
+
};
|
|
47
55
|
return {
|
|
48
56
|
error,
|
|
49
57
|
success,
|
|
50
58
|
info,
|
|
51
|
-
warning
|
|
59
|
+
warning,
|
|
60
|
+
confirm
|
|
52
61
|
};
|
|
53
62
|
};
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
export declare const dialogTheme: {
|
|
2
2
|
slots: {
|
|
3
3
|
base: string;
|
|
4
|
+
overlay: string;
|
|
4
5
|
icon: string;
|
|
6
|
+
iconSuccess: string;
|
|
7
|
+
iconInfo: string;
|
|
8
|
+
iconWarning: string;
|
|
9
|
+
iconError: string;
|
|
10
|
+
iconConfirm: string;
|
|
5
11
|
wrapper: string;
|
|
12
|
+
confirmColor: string;
|
|
6
13
|
title: string;
|
|
7
14
|
description: string;
|
|
8
15
|
buttonGroup: string;
|
|
@@ -24,8 +31,12 @@ export declare const dialogTheme: {
|
|
|
24
31
|
icon: string;
|
|
25
32
|
};
|
|
26
33
|
};
|
|
27
|
-
|
|
28
|
-
|
|
34
|
+
confirm: {
|
|
35
|
+
true: {
|
|
36
|
+
icon: string;
|
|
37
|
+
};
|
|
38
|
+
false: {};
|
|
29
39
|
};
|
|
30
40
|
};
|
|
41
|
+
defaultVariants: {};
|
|
31
42
|
};
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
export const dialogTheme = {
|
|
2
2
|
slots: {
|
|
3
|
-
base: "flex space-x-4",
|
|
3
|
+
base: "flex space-x-4 shadow-lg ring ring-default z-[100] text-sm fixed top-[50%] left-[50%] max-h-[85vh] w-[90vw] max-w-[500px] translate-x-[-50%] translate-y-[-50%] rounded-lg bg-white p-[25px] focus:outline-none",
|
|
4
|
+
overlay: "fixed inset-0 bg-elevated/75 backdrop-blur",
|
|
4
5
|
icon: "size-12",
|
|
6
|
+
iconSuccess: "i-heroicons-check-circle",
|
|
7
|
+
iconInfo: "i-heroicons-information-circle",
|
|
8
|
+
iconWarning: "i-heroicons-exclamation-circle",
|
|
9
|
+
iconError: "i-heroicons-x-circle",
|
|
10
|
+
iconConfirm: "i-heroicons-information-circle",
|
|
5
11
|
wrapper: "flex flex-col w-full",
|
|
12
|
+
confirmColor: "info",
|
|
6
13
|
title: "font-bold text-lg",
|
|
7
|
-
description: "text-neutral-400",
|
|
14
|
+
description: "text-neutral-400 text-sm",
|
|
8
15
|
buttonGroup: "flex justify-end items-center space-x-3 mt-4",
|
|
9
16
|
confirmButton: "",
|
|
10
17
|
cancelButton: ""
|
|
@@ -16,6 +23,10 @@ export const dialogTheme = {
|
|
|
16
23
|
warning: { icon: "text-warning" },
|
|
17
24
|
error: { icon: "text-error" }
|
|
18
25
|
},
|
|
19
|
-
|
|
20
|
-
|
|
26
|
+
confirm: {
|
|
27
|
+
true: { icon: "text-info" },
|
|
28
|
+
false: {}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
defaultVariants: {}
|
|
21
32
|
};
|