@ecolovo/uniapp-components 2.0.4 → 2.0.6
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/components/badge/badge.vue +22 -11
- package/components/badge/types.d.ts +6 -0
- package/components/badge/types.js +4 -0
- package/components/badge/types.ts +10 -0
- package/components/button/button.vue +77 -48
- package/components/button/types.d.ts +20 -0
- package/components/button/types.js +4 -0
- package/components/button/types.ts +24 -0
- package/components/checkbox/checkbox.scss +1 -1
- package/components/checkbox/checkbox.vue +2 -0
- package/components/checkbox/types.d.ts +10 -0
- package/components/checkbox/types.js +4 -0
- package/components/checkbox/types.ts +16 -0
- package/components/checkbox-group/checkbox-group.vue +2 -0
- package/components/checkbox-group/types.d.ts +10 -0
- package/components/checkbox-group/types.js +8 -0
- package/components/checkbox-group/types.ts +20 -0
- package/components/checkbox-group2/checkbox-group2.vue +2 -0
- package/components/data-list/data-list.vue +13 -7
- package/components/date-picker/date-picker.vue +2 -0
- package/components/date-picker/types.d.ts +12 -0
- package/components/date-picker/types.js +4 -0
- package/components/date-picker/types.ts +18 -0
- package/components/dialog/dialog-content.vue +61 -46
- package/components/dialog/dialog.vue +55 -29
- package/components/dialog/types.d.ts +20 -0
- package/components/dialog/types.js +4 -0
- package/components/dialog/types.ts +24 -0
- package/components/dropdown/dropdown.vue +2 -0
- package/components/dropdown/types.d.ts +10 -0
- package/components/dropdown/types.js +4 -0
- package/components/dropdown/types.ts +16 -0
- package/components/empty/empty.vue +37 -20
- package/components/empty/types.d.ts +12 -0
- package/components/empty/types.js +9 -0
- package/components/empty/types.ts +21 -0
- package/components/flex/flex.vue +2 -0
- package/components/flex/types.d.ts +12 -0
- package/components/flex/types.js +4 -0
- package/components/flex/types.ts +22 -0
- package/components/form/form.vue +2 -0
- package/components/form/types.d.ts +6 -0
- package/components/form/types.js +4 -0
- package/components/form/types.ts +10 -0
- package/components/form-item/form-item.scss +6 -0
- package/components/form-item/form-item.vue +9 -3
- package/components/form-item/types.d.ts +6 -0
- package/components/form-item/types.js +4 -0
- package/components/form-item/types.ts +12 -0
- package/components/image/image.vue +28 -21
- package/components/image/types.d.ts +18 -0
- package/components/image/types.js +4 -0
- package/components/image/types.ts +23 -0
- package/components/index.d.ts +1 -0
- package/components/index.js +1 -0
- package/components/index.ts +1 -0
- package/components/input/input.scss +9 -0
- package/components/input/input.vue +11 -4
- package/components/input/password-input.vue +3 -1
- package/components/input/types.d.ts +20 -0
- package/components/input/types.js +8 -0
- package/components/input/types.ts +31 -0
- package/components/list-page/list-page.vue +21 -24
- package/components/list-page/types.d.ts +6 -0
- package/components/list-page/types.js +4 -0
- package/components/list-page/types.ts +12 -0
- package/components/load-more/load-more.scss +1 -0
- package/components/load-more/load-more.vue +66 -6
- package/components/load-more/types.d.ts +6 -0
- package/components/load-more/types.js +4 -0
- package/components/load-more/types.ts +12 -0
- package/components/loading/loading.vue +2 -0
- package/components/loading/types.d.ts +6 -0
- package/components/loading/types.js +4 -0
- package/components/loading/types.ts +12 -0
- package/components/message-box/message-box.d.ts +14 -16
- package/components/message-box/message-box.ts +0 -2
- package/components/message-box/message-box.vue +18 -43
- package/components/message-box/types.d.ts +16 -0
- package/components/message-box/types.js +4 -0
- package/components/message-box/types.ts +22 -0
- package/components/number-dialog/number-dialog.vue +5 -3
- package/components/number-dialog/types.d.ts +18 -0
- package/components/number-dialog/types.js +4 -0
- package/components/number-dialog/types.ts +24 -0
- package/components/number-input/number-input.scss +1 -1
- package/components/number-input/number-input.vue +6 -4
- package/components/number-input/types.d.ts +20 -0
- package/components/number-input/types.js +4 -0
- package/components/number-input/types.ts +26 -0
- package/components/numpad/numpad.vue +2 -0
- package/components/numpad/types.d.ts +10 -0
- package/components/numpad/types.js +4 -0
- package/components/numpad/types.ts +14 -0
- package/components/page/page-body.scss +1 -1
- package/components/page/page-footer.vue +2 -3
- package/components/page/page-header.vue +19 -9
- package/components/page/page.vue +45 -14
- package/components/page/types.d.ts +16 -0
- package/components/page/types.js +8 -0
- package/components/page/types.ts +27 -0
- package/components/picker/picker-popup.vue +10 -6
- package/components/picker/picker.vue +8 -0
- package/components/picker/types.d.ts +14 -0
- package/components/picker/types.js +4 -0
- package/components/picker/types.ts +18 -0
- package/components/popover/popover-content.vue +10 -1
- package/components/popover/popover-mask.vue +5 -5
- package/components/popover/popover.vue +34 -29
- package/components/popover/types.d.ts +10 -0
- package/components/popover/types.js +4 -0
- package/components/popover/types.ts +16 -0
- package/components/popup/popup-content.vue +61 -43
- package/components/popup/popup.vue +34 -28
- package/components/popup/types.d.ts +20 -0
- package/components/popup/types.js +4 -0
- package/components/popup/types.ts +24 -0
- package/components/price/price.scss +7 -3
- package/components/price/price.vue +6 -0
- package/components/price/types.d.ts +10 -0
- package/components/price/types.js +4 -0
- package/components/price/types.ts +14 -0
- package/components/search/search.vue +4 -2
- package/components/search/types.d.ts +14 -0
- package/components/search/types.js +4 -0
- package/components/search/types.ts +18 -0
- package/components/searching/searching.vue +2 -0
- package/components/searching/types.d.ts +8 -0
- package/components/searching/types.js +4 -0
- package/components/searching/types.ts +14 -0
- package/components/switch/switch.vue +5 -8
- package/components/switch/types.d.ts +8 -0
- package/components/switch/types.js +4 -0
- package/components/switch/types.ts +12 -0
- package/components/tab/tab.vue +2 -0
- package/components/tab/types.d.ts +8 -0
- package/components/tab/types.js +4 -0
- package/components/tab/types.ts +12 -0
- package/components/textarea/textarea.scss +10 -0
- package/components/textarea/textarea.vue +17 -9
- package/components/textarea/types.d.ts +12 -0
- package/components/textarea/types.js +4 -0
- package/components/textarea/types.ts +18 -0
- package/components/upload/composable.d.ts +24 -0
- package/components/upload/composable.js +173 -0
- package/components/upload/composable.ts +228 -0
- package/components/upload/media-upload.scss +12 -0
- package/components/upload/media-upload.vue +250 -0
- package/components/upload/types.d.ts +29 -0
- package/components/upload/types.js +4 -0
- package/components/upload/types.ts +38 -0
- package/composable/component-name.d.ts +8 -0
- package/composable/component-name.js +11 -4
- package/composable/component-name.ts +8 -0
- package/composable/dialog.d.ts +40 -0
- package/composable/dialog.js +96 -0
- package/composable/dialog.ts +113 -0
- package/composable/index.d.ts +5 -0
- package/composable/index.js +5 -0
- package/composable/index.ts +5 -0
- package/composable/message-box.d.ts +45 -28
- package/composable/message-box.js +68 -53
- package/composable/message-box.ts +101 -36
- package/composable/model.d.ts +8 -0
- package/composable/model.js +23 -0
- package/composable/model.ts +27 -0
- package/composable/page.d.ts +72 -0
- package/composable/page.js +25 -0
- package/composable/page.ts +34 -0
- package/configs/index.d.ts +24 -19
- package/configs/index.js +38 -35
- package/configs/index.ts +19 -0
- package/easyCom.d.ts +6 -6
- package/easyCom.js +19 -31
- package/easyCom.ts +4 -4
- package/globals.d.ts +93 -33
- package/globals.js +1 -0
- package/globals.ts +118 -0
- package/index.d.ts +3 -2
- package/index.js +2 -2
- package/index.ts +3 -2
- package/init.d.ts +11 -6
- package/init.js +84 -14
- package/init.ts +86 -1
- package/package.json +15 -12
- package/styles/var/component.scss +1 -0
- package/utils/date.d.ts +14 -19
- package/utils/date.js +77 -87
- package/utils/freezeDeep.js +7 -7
- package/utils/price.d.ts +15 -18
- package/utils/price.js +36 -37
- package/utils/upload.d.ts +1 -0
- package/utils/upload.js +8 -0
- package/utils/upload.ts +12 -0
- package/utils/windowInfo.d.ts +1 -9
- package/utils/windowInfo.js +10 -17
- package/utils/round.d.ts +0 -2
- package/utils/round.js +0 -13
- package/utils/round.ts +0 -14
|
@@ -3,32 +3,33 @@
|
|
|
3
3
|
<popover-content-cpn position="center" :loading="loading">
|
|
4
4
|
<!-- 内容上方标题 -->
|
|
5
5
|
<template #header>
|
|
6
|
-
<slot
|
|
7
|
-
<view
|
|
8
|
-
v-else-if="title || showClose"
|
|
9
|
-
:class="$style['DialogContent--header']"
|
|
10
|
-
>
|
|
6
|
+
<slot name="header">
|
|
11
7
|
<view
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
{
|
|
15
|
-
[$style['DialogContent--title-center']]:
|
|
16
|
-
centerTitle,
|
|
17
|
-
},
|
|
18
|
-
]"
|
|
8
|
+
v-if="title || showClose"
|
|
9
|
+
:class="$style['DialogContent--header']"
|
|
19
10
|
>
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
11
|
+
<view
|
|
12
|
+
:class="[
|
|
13
|
+
$style['DialogContent--title'],
|
|
14
|
+
{
|
|
15
|
+
[$style['DialogContent--title-center']]:
|
|
16
|
+
centerTitle,
|
|
17
|
+
},
|
|
18
|
+
]"
|
|
19
|
+
>
|
|
20
|
+
<slot name="title">
|
|
21
|
+
<text>{{ title }}</text>
|
|
22
|
+
</slot>
|
|
23
|
+
</view>
|
|
24
|
+
<view
|
|
25
|
+
v-if="showClose"
|
|
26
|
+
:class="$style['DialogContent--close']"
|
|
27
|
+
@click="$emit('close')"
|
|
28
|
+
>
|
|
29
|
+
<icon-cpn icon="close" tap-size="80rpx" />
|
|
30
|
+
</view>
|
|
23
31
|
</view>
|
|
24
|
-
|
|
25
|
-
v-if="showClose"
|
|
26
|
-
:class="$style['DialogContent--close']"
|
|
27
|
-
@click="$emit('close')"
|
|
28
|
-
>
|
|
29
|
-
<icon-cpn icon="close" tap-size="80rpx" />
|
|
30
|
-
</view>
|
|
31
|
-
</view>
|
|
32
|
+
</slot>
|
|
32
33
|
</template>
|
|
33
34
|
|
|
34
35
|
<!-- 内容区域 -->
|
|
@@ -36,32 +37,35 @@
|
|
|
36
37
|
|
|
37
38
|
<!-- 内容下方操作按钮 -->
|
|
38
39
|
<template #footer>
|
|
39
|
-
<slot
|
|
40
|
-
<view
|
|
41
|
-
v-else-if="cancel || confirm"
|
|
42
|
-
:class="$style['DialogContent--footer']"
|
|
43
|
-
>
|
|
40
|
+
<slot name="footer">
|
|
44
41
|
<view
|
|
45
|
-
v-if="
|
|
46
|
-
|
|
42
|
+
v-if="
|
|
43
|
+
cancel || confirm || $slots.cancel || $slots.confirm
|
|
44
|
+
"
|
|
45
|
+
:class="$style['DialogContent--footer']"
|
|
47
46
|
>
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
<view
|
|
48
|
+
v-if="cancel || $slots.cancel"
|
|
49
|
+
:class="$style['DialogContent--button']"
|
|
50
|
+
>
|
|
51
|
+
<slot name="cancel">
|
|
52
|
+
<button-cpn plain @click="$emit('cancel')">
|
|
53
|
+
{{ cancel }}
|
|
54
|
+
</button-cpn>
|
|
55
|
+
</slot>
|
|
56
|
+
</view>
|
|
57
|
+
<view
|
|
58
|
+
v-if="confirm || $slots.confirm"
|
|
59
|
+
:class="$style['DialogContent--button']"
|
|
60
|
+
>
|
|
61
|
+
<slot name="confirm">
|
|
62
|
+
<button-cpn @click="$emit('confirm')">
|
|
63
|
+
{{ confirm }}
|
|
64
|
+
</button-cpn>
|
|
65
|
+
</slot>
|
|
66
|
+
</view>
|
|
53
67
|
</view>
|
|
54
|
-
|
|
55
|
-
v-if="confirm"
|
|
56
|
-
:class="$style['DialogContent--button']"
|
|
57
|
-
>
|
|
58
|
-
<slot name="confirm">
|
|
59
|
-
<button-cpn @click="$emit('confirm')">
|
|
60
|
-
{{ confirm }}
|
|
61
|
-
</button-cpn>
|
|
62
|
-
</slot>
|
|
63
|
-
</view>
|
|
64
|
-
</view>
|
|
68
|
+
</slot>
|
|
65
69
|
</template>
|
|
66
70
|
</popover-content-cpn>
|
|
67
71
|
</view>
|
|
@@ -82,6 +86,17 @@ defineOptions({
|
|
|
82
86
|
|
|
83
87
|
const classNames = useClassNames('dialog-content');
|
|
84
88
|
|
|
89
|
+
type _Slots = {
|
|
90
|
+
header: () => void;
|
|
91
|
+
title: () => void;
|
|
92
|
+
default: () => void;
|
|
93
|
+
footer: () => void;
|
|
94
|
+
cancel: () => void;
|
|
95
|
+
confirm: () => void;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
defineSlots<_Slots>();
|
|
99
|
+
|
|
85
100
|
type _Props = {
|
|
86
101
|
/** 是否显示 loading 动画 */
|
|
87
102
|
loading?: boolean;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view :class="classNames">
|
|
2
|
+
<view v-if="isShow" :class="classNames">
|
|
3
3
|
<popover-mask-cpn
|
|
4
4
|
ref="maskRef"
|
|
5
|
-
|
|
5
|
+
v-model="isShow"
|
|
6
6
|
:modal="modal || isLoading"
|
|
7
|
-
@
|
|
7
|
+
@mask="onCancel()"
|
|
8
8
|
@close="emit('close')"
|
|
9
9
|
@closed="emit('closed')"
|
|
10
10
|
>
|
|
@@ -16,11 +16,16 @@
|
|
|
16
16
|
:show-close="showClose"
|
|
17
17
|
:cancel="cancel"
|
|
18
18
|
:confirm="confirm"
|
|
19
|
-
@close="
|
|
19
|
+
@close="onCancel()"
|
|
20
20
|
@cancel="onCancel()"
|
|
21
21
|
@confirm="onConfirm()"
|
|
22
22
|
>
|
|
23
|
+
<template #[headerSlot]><slot name="header" /></template>
|
|
24
|
+
<template #[titleSlot]><slot name="title" /></template>
|
|
23
25
|
<slot></slot>
|
|
26
|
+
<template #[footerSlot]><slot name="footer" /></template>
|
|
27
|
+
<template #[confirmSlot]><slot name="confirm" /></template>
|
|
28
|
+
<template #[cancelSlot]><slot name="cancel" /></template>
|
|
24
29
|
</dialog-content-cpn>
|
|
25
30
|
</slot>
|
|
26
31
|
</popover-mask-cpn>
|
|
@@ -28,10 +33,12 @@
|
|
|
28
33
|
</template>
|
|
29
34
|
|
|
30
35
|
<script lang="ts" setup>
|
|
31
|
-
import { ref, computed } from 'vue';
|
|
36
|
+
import { ref, computed, useSlots } from 'vue';
|
|
32
37
|
import useClassNames from '../../composable/component-name';
|
|
33
38
|
import PopoverMaskCpn from '../popover/popover-mask.vue';
|
|
34
39
|
import DialogContentCpn from './dialog-content.vue';
|
|
40
|
+
import { dialogProps } from './types';
|
|
41
|
+
import { useAwaitableDialog, useModelValue } from '../../composable';
|
|
35
42
|
|
|
36
43
|
defineOptions({
|
|
37
44
|
options: {
|
|
@@ -42,9 +49,29 @@ defineOptions({
|
|
|
42
49
|
|
|
43
50
|
const classNames = useClassNames('dialog');
|
|
44
51
|
|
|
52
|
+
type _Slots = {
|
|
53
|
+
content: () => void;
|
|
54
|
+
header: () => void;
|
|
55
|
+
title: () => void;
|
|
56
|
+
default: () => void;
|
|
57
|
+
footer: () => void;
|
|
58
|
+
cancel: () => void;
|
|
59
|
+
confirm: () => void;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
defineSlots<_Slots>();
|
|
63
|
+
|
|
64
|
+
// 这些值用于插槽的透传
|
|
65
|
+
// 注意:小程序无法实现动态插槽,组件在初始化时就确定了哪些插槽在用,哪些没用使用
|
|
66
|
+
// 后续无论如何更新都无法改变这个行为,但插槽的内容可以动态更新
|
|
67
|
+
const $slots = useSlots();
|
|
68
|
+
const headerSlot = $slots.header ? 'header' : 'unused_slot';
|
|
69
|
+
const titleSlot = $slots.title ? 'title' : 'unused_slot';
|
|
70
|
+
const footerSlot = $slots.footer ? 'footer' : 'unused_slot';
|
|
71
|
+
const confirmSlot = $slots.confirm ? 'confirm' : 'unused_slot';
|
|
72
|
+
const cancelSlot = $slots.cancel ? 'cancel' : 'unused_slot';
|
|
73
|
+
|
|
45
74
|
type _Props = {
|
|
46
|
-
/** v-model 绑定值,控制对话框是否可见 */
|
|
47
|
-
modelValue?: boolean;
|
|
48
75
|
/** 是否模态框 */
|
|
49
76
|
modal?: boolean;
|
|
50
77
|
/** 是否显示 loading 动画 */
|
|
@@ -68,7 +95,6 @@ type _Props = {
|
|
|
68
95
|
};
|
|
69
96
|
|
|
70
97
|
const props = withDefaults(defineProps<_Props>(), {
|
|
71
|
-
modelValue: false,
|
|
72
98
|
modal: false,
|
|
73
99
|
loading: false,
|
|
74
100
|
title: '',
|
|
@@ -79,33 +105,34 @@ const props = withDefaults(defineProps<_Props>(), {
|
|
|
79
105
|
confirm: '确认',
|
|
80
106
|
closeOnConfirm: true,
|
|
81
107
|
async: false,
|
|
108
|
+
...dialogProps,
|
|
82
109
|
});
|
|
83
110
|
|
|
84
111
|
const emit = defineEmits<{
|
|
85
|
-
(e: 'update:modelValue', val: boolean): void;
|
|
86
112
|
(e: 'close'): void;
|
|
87
113
|
(e: 'closed'): void;
|
|
88
114
|
(e: 'cancel', closeFn?: VoidFunction): void;
|
|
89
|
-
(
|
|
90
|
-
e: 'confirm',
|
|
91
|
-
payload?: UniApp.PromiseResolvers<unknown> | VoidFunction
|
|
92
|
-
): void;
|
|
115
|
+
(e: 'confirm', payload?: PromiseResolvers<unknown> | VoidFunction): void;
|
|
93
116
|
}>();
|
|
94
117
|
|
|
118
|
+
const isShow_ = defineModel<boolean>();
|
|
119
|
+
/** 是否显示 */
|
|
120
|
+
const isShow = useModelValue(isShow_);
|
|
121
|
+
|
|
122
|
+
const {
|
|
123
|
+
show,
|
|
124
|
+
onConfirm: onConfirmDialog,
|
|
125
|
+
onCancel: onCancelDialog,
|
|
126
|
+
} = useAwaitableDialog(isShow);
|
|
127
|
+
|
|
95
128
|
const isAsyncLoading = ref(false);
|
|
96
129
|
const maskRef = ref<InstanceType<typeof PopoverMaskCpn>>();
|
|
97
130
|
|
|
98
131
|
/** 按钮 loading */
|
|
99
132
|
const isLoading = computed(() => props.loading || isAsyncLoading.value);
|
|
100
133
|
|
|
101
|
-
const close = () => {
|
|
102
|
-
maskRef.value?.close();
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
/** 隐藏 */
|
|
106
|
-
const onClose = () => {
|
|
107
|
-
if (isLoading.value) return;
|
|
108
|
-
close();
|
|
134
|
+
const close = (onClosed?: VoidFunction) => {
|
|
135
|
+
maskRef.value?.close(onClosed);
|
|
109
136
|
};
|
|
110
137
|
|
|
111
138
|
/** 点击取消按钮响应 */
|
|
@@ -113,11 +140,13 @@ const onCancel = () => {
|
|
|
113
140
|
if (isLoading.value) return;
|
|
114
141
|
|
|
115
142
|
if (props.closeOnCancel) {
|
|
143
|
+
onCancelDialog();
|
|
116
144
|
emit('cancel');
|
|
117
145
|
close();
|
|
118
146
|
return;
|
|
119
147
|
}
|
|
120
148
|
|
|
149
|
+
onCancelDialog();
|
|
121
150
|
emit('cancel', maskRef.value?.close.bind(maskRef.value));
|
|
122
151
|
};
|
|
123
152
|
|
|
@@ -128,13 +157,7 @@ const onConfirm = () => {
|
|
|
128
157
|
if (props.async) {
|
|
129
158
|
isAsyncLoading.value = true;
|
|
130
159
|
|
|
131
|
-
|
|
132
|
-
let resolve: UniApp.PromiseResolver<unknown>,
|
|
133
|
-
reject: UniApp.PromiseRejector<unknown>;
|
|
134
|
-
const promise = new Promise((res, rej) => {
|
|
135
|
-
resolve = res;
|
|
136
|
-
reject = rej;
|
|
137
|
-
});
|
|
160
|
+
const { promise, resolve, reject } = Promise.withResolvers();
|
|
138
161
|
|
|
139
162
|
promise
|
|
140
163
|
.then((willClose = true) => {
|
|
@@ -151,20 +174,23 @@ const onConfirm = () => {
|
|
|
151
174
|
}
|
|
152
175
|
isAsyncLoading.value = false;
|
|
153
176
|
});
|
|
177
|
+
onConfirmDialog();
|
|
154
178
|
emit('confirm', { resolve, reject });
|
|
155
179
|
return;
|
|
156
180
|
}
|
|
157
181
|
|
|
158
182
|
if (props.closeOnConfirm) {
|
|
183
|
+
onConfirmDialog();
|
|
159
184
|
emit('confirm');
|
|
160
185
|
close();
|
|
161
186
|
return;
|
|
162
187
|
}
|
|
163
188
|
|
|
189
|
+
onConfirmDialog();
|
|
164
190
|
emit('confirm', maskRef.value?.close.bind(maskRef.value));
|
|
165
191
|
};
|
|
166
192
|
|
|
167
|
-
defineExpose({ close });
|
|
193
|
+
defineExpose({ show, close });
|
|
168
194
|
</script>
|
|
169
195
|
|
|
170
196
|
<style lang="scss" module>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type ConfigurableDialogProps = {
|
|
2
|
+
/** 是否模态框 */
|
|
3
|
+
modal?: boolean;
|
|
4
|
+
/** 标题 */
|
|
5
|
+
title?: string;
|
|
6
|
+
/** 是否居中标题 */
|
|
7
|
+
centerTitle?: boolean;
|
|
8
|
+
/** 是否显示关闭按钮 */
|
|
9
|
+
showClose?: boolean;
|
|
10
|
+
/** 取消按钮文本,为 falsy 时( false 或 '' )不显示 */
|
|
11
|
+
cancel?: string | boolean;
|
|
12
|
+
/** 点击取消按钮时是否自动关闭对话框 */
|
|
13
|
+
closeOnCancel?: boolean;
|
|
14
|
+
/** 确认按钮文本,为 falsy 时( false 或 '' )不显示 */
|
|
15
|
+
confirm?: string | boolean;
|
|
16
|
+
/** 点击确认按钮时是否自动关闭对话框 */
|
|
17
|
+
closeOnConfirm?: boolean;
|
|
18
|
+
};
|
|
19
|
+
export declare let dialogProps: ConfigurableDialogProps;
|
|
20
|
+
export declare const setDefaultDialogProps: (props?: ConfigurableDialogProps) => void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type ConfigurableDialogProps = {
|
|
2
|
+
/** 是否模态框 */
|
|
3
|
+
modal?: boolean;
|
|
4
|
+
/** 标题 */
|
|
5
|
+
title?: string;
|
|
6
|
+
/** 是否居中标题 */
|
|
7
|
+
centerTitle?: boolean;
|
|
8
|
+
/** 是否显示关闭按钮 */
|
|
9
|
+
showClose?: boolean;
|
|
10
|
+
/** 取消按钮文本,为 falsy 时( false 或 '' )不显示 */
|
|
11
|
+
cancel?: string | boolean;
|
|
12
|
+
/** 点击取消按钮时是否自动关闭对话框 */
|
|
13
|
+
closeOnCancel?: boolean;
|
|
14
|
+
/** 确认按钮文本,为 falsy 时( false 或 '' )不显示 */
|
|
15
|
+
confirm?: string | boolean;
|
|
16
|
+
/** 点击确认按钮时是否自动关闭对话框 */
|
|
17
|
+
closeOnConfirm?: boolean;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export let dialogProps: ConfigurableDialogProps = {};
|
|
21
|
+
|
|
22
|
+
export const setDefaultDialogProps = (props: ConfigurableDialogProps = {}) => {
|
|
23
|
+
dialogProps = props;
|
|
24
|
+
};
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
import { computed } from 'vue';
|
|
30
30
|
import useClassNames from '../../composable/component-name';
|
|
31
31
|
import IconCpn from '../icon/icon.vue';
|
|
32
|
+
import { dropdownProps } from './types';
|
|
32
33
|
|
|
33
34
|
defineOptions({
|
|
34
35
|
options: {
|
|
@@ -58,6 +59,7 @@ const props = withDefaults(defineProps<_Props>(), {
|
|
|
58
59
|
align: '',
|
|
59
60
|
multiple: true,
|
|
60
61
|
formatter: null,
|
|
62
|
+
...dropdownProps,
|
|
61
63
|
});
|
|
62
64
|
|
|
63
65
|
/** 是否选择了值 */
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type ConfigurableDropdownProps = {
|
|
2
|
+
/** 未选中时的提示语 */
|
|
3
|
+
placeholder?: string;
|
|
4
|
+
/** 文本对齐方式 */
|
|
5
|
+
align?: string;
|
|
6
|
+
/** 展示值格式化函数 */
|
|
7
|
+
formatter?: ((val: unknown) => string) | null;
|
|
8
|
+
};
|
|
9
|
+
export declare let dropdownProps: ConfigurableDropdownProps;
|
|
10
|
+
export declare const setDefaultDropdownProps: (props?: ConfigurableDropdownProps) => void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type ConfigurableDropdownProps = {
|
|
2
|
+
/** 未选中时的提示语 */
|
|
3
|
+
placeholder?: string;
|
|
4
|
+
/** 文本对齐方式 */
|
|
5
|
+
align?: string;
|
|
6
|
+
/** 展示值格式化函数 */
|
|
7
|
+
formatter?: ((val: unknown) => string) | null;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export let dropdownProps: ConfigurableDropdownProps = {};
|
|
11
|
+
|
|
12
|
+
export const setDefaultDropdownProps = (
|
|
13
|
+
props: ConfigurableDropdownProps = {}
|
|
14
|
+
) => {
|
|
15
|
+
dropdownProps = props;
|
|
16
|
+
};
|
|
@@ -1,27 +1,39 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view :class="[...classNames, $style['Empty']]">
|
|
3
3
|
<template v-if="loading">
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
<view v-else :class="$style['Empty--loading-icon-wrapper']">
|
|
10
|
-
<icon-cpn
|
|
11
|
-
icon="search"
|
|
12
|
-
:class="$style['Empty--loading-icon']"
|
|
4
|
+
<slot name="loading">
|
|
5
|
+
<image
|
|
6
|
+
v-if="loadingImage"
|
|
7
|
+
:src="loadingImage"
|
|
8
|
+
:class="$style['Empty--image']"
|
|
13
9
|
/>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
<view v-else :class="$style['Empty--loading-icon-wrapper']">
|
|
11
|
+
<icon-cpn
|
|
12
|
+
icon="search"
|
|
13
|
+
:class="$style['Empty--loading-icon']"
|
|
14
|
+
/>
|
|
15
|
+
</view>
|
|
16
|
+
<view :class="$style['Empty--text']">
|
|
17
|
+
<slot>{{ loadingText }}</slot>
|
|
18
|
+
</view>
|
|
19
|
+
</slot>
|
|
18
20
|
</template>
|
|
19
21
|
<template v-else>
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
<slot name="empty">
|
|
23
|
+
<image
|
|
24
|
+
v-if="image"
|
|
25
|
+
:src="image"
|
|
26
|
+
:class="$style['Empty--image']"
|
|
27
|
+
/>
|
|
28
|
+
<image
|
|
29
|
+
v-else
|
|
30
|
+
:src="emptyImage"
|
|
31
|
+
:class="$style['Empty--image']"
|
|
32
|
+
/>
|
|
33
|
+
<view :class="$style['Empty--text']">
|
|
34
|
+
<slot>{{ text }}</slot>
|
|
35
|
+
</view>
|
|
36
|
+
</slot>
|
|
25
37
|
</template>
|
|
26
38
|
</view>
|
|
27
39
|
</template>
|
|
@@ -30,6 +42,7 @@
|
|
|
30
42
|
import useClassNames from '../../composable/component-name';
|
|
31
43
|
import IconCpn from '../icon/icon.vue';
|
|
32
44
|
import emptyImage from '../../resources/image/empty.svg';
|
|
45
|
+
import { emptyProps } from './types';
|
|
33
46
|
|
|
34
47
|
defineOptions({
|
|
35
48
|
options: {
|
|
@@ -59,6 +72,7 @@ withDefaults(defineProps<_Props>(), {
|
|
|
59
72
|
loading: false,
|
|
60
73
|
loadingImage: '',
|
|
61
74
|
loadingText: '数据加载中',
|
|
75
|
+
...emptyProps,
|
|
62
76
|
});
|
|
63
77
|
</script>
|
|
64
78
|
|
|
@@ -86,16 +100,19 @@ withDefaults(defineProps<_Props>(), {
|
|
|
86
100
|
margin-top: UTILS__LOCAL_VAR(space);
|
|
87
101
|
color: UTILS__LOCAL_VAR(color);
|
|
88
102
|
font-size: UTILS__LOCAL_VAR(font-size);
|
|
103
|
+
display: flex;
|
|
104
|
+
flex-direction: column;
|
|
105
|
+
justify-content: center;
|
|
106
|
+
align-items: center;
|
|
89
107
|
}
|
|
90
108
|
.Empty--loading-icon-wrapper {
|
|
91
109
|
width: 100rpx;
|
|
92
110
|
height: 100rpx;
|
|
111
|
+
font-size: 60rpx;
|
|
93
112
|
transform-origin: center center;
|
|
94
113
|
animation: Empty--circle 1.5s infinite linear;
|
|
95
114
|
}
|
|
96
115
|
.Empty--loading-icon {
|
|
97
|
-
position: absolute;
|
|
98
|
-
font-size: 60rpx;
|
|
99
116
|
color: UTILS__LOCAL_VAR(color);
|
|
100
117
|
animation: Empty--circle 1.5s linear infinite reverse;
|
|
101
118
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type ConfigurableEmptyProps = {
|
|
2
|
+
/** 图片 */
|
|
3
|
+
image?: string;
|
|
4
|
+
/** 文本 */
|
|
5
|
+
text?: string;
|
|
6
|
+
/** 数据加载中显示图片 */
|
|
7
|
+
loadingImage?: string;
|
|
8
|
+
/** 加载中文本 */
|
|
9
|
+
loadingText?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare let emptyProps: ConfigurableEmptyProps;
|
|
12
|
+
export declare const setDefaultEmptyProps: (props?: ConfigurableEmptyProps) => void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type ConfigurableEmptyProps = {
|
|
2
|
+
/** 图片 */
|
|
3
|
+
image?: string;
|
|
4
|
+
/** 文本 */
|
|
5
|
+
text?: string;
|
|
6
|
+
/** 数据加载中显示图片 */
|
|
7
|
+
loadingImage?: string;
|
|
8
|
+
/** 加载中文本 */
|
|
9
|
+
loadingText?: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export let emptyProps: ConfigurableEmptyProps = {
|
|
13
|
+
image: '',
|
|
14
|
+
text: '暂无数据',
|
|
15
|
+
loadingImage: '',
|
|
16
|
+
loadingText: '数据加载中',
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const setDefaultEmptyProps = (props: ConfigurableEmptyProps = {}) => {
|
|
20
|
+
emptyProps = props;
|
|
21
|
+
};
|
package/components/flex/flex.vue
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
<script lang="ts" setup>
|
|
8
8
|
import { computed } from 'vue';
|
|
9
9
|
import useClassNames from '../../composable/component-name';
|
|
10
|
+
import { flexProps } from './types';
|
|
10
11
|
|
|
11
12
|
defineOptions({
|
|
12
13
|
options: {
|
|
@@ -42,6 +43,7 @@ const props = withDefaults(defineProps<_Props>(), {
|
|
|
42
43
|
align: 'center',
|
|
43
44
|
wrap: false,
|
|
44
45
|
gap: '0px',
|
|
46
|
+
...flexProps,
|
|
45
47
|
});
|
|
46
48
|
|
|
47
49
|
const gapValue = computed(() => {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type ConfigurableFlexProps = {
|
|
2
|
+
/** 当前轴对齐方式 */
|
|
3
|
+
justify?: 'start' | 'center' | 'end' | 'space-between' | 'space-around' | 'space-evenly';
|
|
4
|
+
/** 交叉轴对齐方式 */
|
|
5
|
+
align?: 'start' | 'center' | 'end' | 'baseline' | 'stretch';
|
|
6
|
+
/** 是否换行 */
|
|
7
|
+
wrap?: boolean;
|
|
8
|
+
/** 间距 */
|
|
9
|
+
gap?: string | number | (() => (string | number)[]);
|
|
10
|
+
};
|
|
11
|
+
export declare let flexProps: ConfigurableFlexProps;
|
|
12
|
+
export declare const setDefaultFlexProps: (props?: ConfigurableFlexProps) => void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type ConfigurableFlexProps = {
|
|
2
|
+
/** 当前轴对齐方式 */
|
|
3
|
+
justify?:
|
|
4
|
+
| 'start'
|
|
5
|
+
| 'center'
|
|
6
|
+
| 'end'
|
|
7
|
+
| 'space-between'
|
|
8
|
+
| 'space-around'
|
|
9
|
+
| 'space-evenly';
|
|
10
|
+
/** 交叉轴对齐方式 */
|
|
11
|
+
align?: 'start' | 'center' | 'end' | 'baseline' | 'stretch';
|
|
12
|
+
/** 是否换行 */
|
|
13
|
+
wrap?: boolean;
|
|
14
|
+
/** 间距 */
|
|
15
|
+
gap?: string | number | (() => (string | number)[]);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export let flexProps: ConfigurableFlexProps = {};
|
|
19
|
+
|
|
20
|
+
export const setDefaultFlexProps = (props: ConfigurableFlexProps = {}) => {
|
|
21
|
+
flexProps = props;
|
|
22
|
+
};
|
package/components/form/form.vue
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
<script lang="ts" setup>
|
|
8
8
|
import { computed, provide } from 'vue';
|
|
9
9
|
import useClassNames from '../../composable/component-name';
|
|
10
|
+
import { formProps } from './types';
|
|
10
11
|
|
|
11
12
|
defineOptions({
|
|
12
13
|
options: {
|
|
@@ -27,6 +28,7 @@ type _Props = {
|
|
|
27
28
|
const props = withDefaults(defineProps<_Props>(), {
|
|
28
29
|
readonly: false,
|
|
29
30
|
type: 'line',
|
|
31
|
+
...formProps,
|
|
30
32
|
});
|
|
31
33
|
|
|
32
34
|
provide(
|
|
@@ -5,6 +5,12 @@ $form-item: () !default;
|
|
|
5
5
|
$form-item-default: (
|
|
6
6
|
// label 宽度
|
|
7
7
|
label-width: 6em,
|
|
8
|
+
// label 颜色
|
|
9
|
+
label-color: #999,
|
|
10
|
+
// label 字体大小
|
|
11
|
+
label-font-size: UTILS__GLOBAL_VAR(font-size, normal),
|
|
12
|
+
// label 字体粗细
|
|
13
|
+
label-font-weight: 600,
|
|
8
14
|
// 高度
|
|
9
15
|
height: 80rpx
|
|
10
16
|
);
|