@ecolovo/uniapp-components 2.0.4 → 2.0.5
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 +5 -3
- 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 +2 -0
- 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 +41 -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 +9 -9
- 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
|
@@ -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,7 +16,7 @@
|
|
|
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
|
>
|
|
@@ -32,6 +32,8 @@ import { ref, computed } from 'vue';
|
|
|
32
32
|
import useClassNames from '../../composable/component-name';
|
|
33
33
|
import PopoverMaskCpn from '../popover/popover-mask.vue';
|
|
34
34
|
import PopupContentCpn from './popup-content.vue';
|
|
35
|
+
import { popupProps } from './types';
|
|
36
|
+
import { useAwaitableDialog, useModelValue } from '../../composable';
|
|
35
37
|
|
|
36
38
|
defineOptions({
|
|
37
39
|
options: {
|
|
@@ -40,11 +42,26 @@ defineOptions({
|
|
|
40
42
|
},
|
|
41
43
|
});
|
|
42
44
|
|
|
45
|
+
type _Slots = {
|
|
46
|
+
content: () => void;
|
|
47
|
+
default: () => void;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
defineSlots<_Slots>();
|
|
51
|
+
|
|
43
52
|
const classNames = useClassNames('popup');
|
|
44
53
|
|
|
54
|
+
const isShow_ = defineModel<boolean>();
|
|
55
|
+
/** 是否可见 */
|
|
56
|
+
const isShow = useModelValue(isShow_);
|
|
57
|
+
|
|
58
|
+
const {
|
|
59
|
+
show,
|
|
60
|
+
onConfirm: onConfirmDialog,
|
|
61
|
+
onCancel: onCancelDialog,
|
|
62
|
+
} = useAwaitableDialog(isShow);
|
|
63
|
+
|
|
45
64
|
type _Props = {
|
|
46
|
-
/** v-model 绑定值,控制弹出框是否可见 */
|
|
47
|
-
modelValue?: boolean;
|
|
48
65
|
/** 是否模态框 */
|
|
49
66
|
modal?: boolean;
|
|
50
67
|
/** 是否显示 loading 动画 */
|
|
@@ -68,7 +85,6 @@ type _Props = {
|
|
|
68
85
|
};
|
|
69
86
|
|
|
70
87
|
const props = withDefaults(defineProps<_Props>(), {
|
|
71
|
-
modelValue: false,
|
|
72
88
|
modal: false,
|
|
73
89
|
loading: false,
|
|
74
90
|
title: '',
|
|
@@ -79,17 +95,14 @@ const props = withDefaults(defineProps<_Props>(), {
|
|
|
79
95
|
confirm: '确认',
|
|
80
96
|
closeOnConfirm: true,
|
|
81
97
|
async: false,
|
|
98
|
+
...popupProps,
|
|
82
99
|
});
|
|
83
100
|
|
|
84
101
|
const emit = defineEmits<{
|
|
85
|
-
(e: 'update:modelValue', val: boolean): void;
|
|
86
102
|
(e: 'close'): void;
|
|
87
103
|
(e: 'closed'): void;
|
|
88
104
|
(e: 'cancel', closeFn?: VoidFunction): void;
|
|
89
|
-
(
|
|
90
|
-
e: 'confirm',
|
|
91
|
-
payload?: UniApp.PromiseResolvers<unknown> | VoidFunction
|
|
92
|
-
): void;
|
|
105
|
+
(e: 'confirm', payload?: PromiseResolvers<unknown> | VoidFunction): void;
|
|
93
106
|
}>();
|
|
94
107
|
|
|
95
108
|
const isAsyncLoading = ref(false);
|
|
@@ -98,14 +111,8 @@ const maskRef = ref<InstanceType<typeof PopoverMaskCpn>>();
|
|
|
98
111
|
/** 按钮 loading */
|
|
99
112
|
const isLoading = computed(() => props.loading || isAsyncLoading.value);
|
|
100
113
|
|
|
101
|
-
const close = () => {
|
|
102
|
-
maskRef.value?.close();
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
/** 隐藏 */
|
|
106
|
-
const onClose = () => {
|
|
107
|
-
if (isLoading.value) return;
|
|
108
|
-
close();
|
|
114
|
+
const close = (onClosed?: VoidFunction) => {
|
|
115
|
+
maskRef.value?.close(onClosed);
|
|
109
116
|
};
|
|
110
117
|
|
|
111
118
|
/** 点击取消按钮响应 */
|
|
@@ -113,11 +120,13 @@ const onCancel = () => {
|
|
|
113
120
|
if (isLoading.value) return;
|
|
114
121
|
|
|
115
122
|
if (props.closeOnCancel) {
|
|
123
|
+
onCancelDialog();
|
|
116
124
|
emit('cancel');
|
|
117
125
|
close();
|
|
118
126
|
return;
|
|
119
127
|
}
|
|
120
128
|
|
|
129
|
+
onCancelDialog();
|
|
121
130
|
emit('cancel', maskRef.value?.close.bind(maskRef.value));
|
|
122
131
|
};
|
|
123
132
|
|
|
@@ -128,13 +137,7 @@ const onConfirm = () => {
|
|
|
128
137
|
if (props.async) {
|
|
129
138
|
isAsyncLoading.value = true;
|
|
130
139
|
|
|
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
|
-
});
|
|
140
|
+
const { promise, resolve, reject } = Promise.withResolvers();
|
|
138
141
|
|
|
139
142
|
promise
|
|
140
143
|
.then((willClose = true) => {
|
|
@@ -151,20 +154,23 @@ const onConfirm = () => {
|
|
|
151
154
|
}
|
|
152
155
|
isAsyncLoading.value = false;
|
|
153
156
|
});
|
|
157
|
+
onConfirmDialog();
|
|
154
158
|
emit('confirm', { resolve, reject });
|
|
155
159
|
return;
|
|
156
160
|
}
|
|
157
161
|
|
|
158
162
|
if (props.closeOnConfirm) {
|
|
163
|
+
onConfirmDialog();
|
|
159
164
|
emit('confirm');
|
|
160
165
|
close();
|
|
161
166
|
return;
|
|
162
167
|
}
|
|
163
168
|
|
|
169
|
+
onConfirmDialog();
|
|
164
170
|
emit('confirm', maskRef.value?.close.bind(maskRef.value));
|
|
165
171
|
};
|
|
166
172
|
|
|
167
|
-
defineExpose({ close });
|
|
173
|
+
defineExpose({ show, close });
|
|
168
174
|
</script>
|
|
169
175
|
|
|
170
176
|
<style lang="scss" module>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type ConfigurablePopupProps = {
|
|
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 popupProps: ConfigurablePopupProps;
|
|
20
|
+
export declare const setDefaultPopupProps: (props?: ConfigurablePopupProps) => void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type ConfigurablePopupProps = {
|
|
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 popupProps: ConfigurablePopupProps = {};
|
|
21
|
+
|
|
22
|
+
export const setDefaultPopupProps = (props: ConfigurablePopupProps = {}) => {
|
|
23
|
+
popupProps = props;
|
|
24
|
+
};
|
|
@@ -4,17 +4,21 @@
|
|
|
4
4
|
// 可配置的变量
|
|
5
5
|
$price: () !default;
|
|
6
6
|
$price-default: (
|
|
7
|
-
color:
|
|
8
|
-
font-
|
|
9
|
-
font-
|
|
7
|
+
color: initial,
|
|
8
|
+
font-family: initial,
|
|
9
|
+
font-size: initial,
|
|
10
|
+
font-weight: initial,
|
|
10
11
|
integer-color: UTILS__LOCAL_VAR(color),
|
|
12
|
+
integer-font-family: UTILS__LOCAL_VAR(font-family),
|
|
11
13
|
integer-font-size: UTILS__LOCAL_VAR(font-size),
|
|
12
14
|
integer-font-weight: UTILS__LOCAL_VAR(font-weight),
|
|
13
15
|
decimal-color: UTILS__LOCAL_VAR(color),
|
|
16
|
+
decimal-font-family: UTILS__LOCAL_VAR(font-family),
|
|
14
17
|
decimal-font-size: UTILS__LOCAL_VAR(font-size),
|
|
15
18
|
decimal-font-weight: UTILS__LOCAL_VAR(font-weight),
|
|
16
19
|
unit-spacing: 0,
|
|
17
20
|
unit-color: UTILS__LOCAL_VAR(color),
|
|
21
|
+
unit-font-family: UTILS__LOCAL_VAR(font-family),
|
|
18
22
|
unit-font-size: UTILS__LOCAL_VAR(font-size),
|
|
19
23
|
unit-font-weight: UTILS__LOCAL_VAR(font-weight),
|
|
20
24
|
);
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
import { computed } from 'vue';
|
|
33
33
|
import useClassNames from '../../composable/component-name';
|
|
34
34
|
import { formatPrice } from '../../utils/price';
|
|
35
|
+
import { priceProps } from './types';
|
|
35
36
|
|
|
36
37
|
defineOptions({
|
|
37
38
|
options: {
|
|
@@ -58,6 +59,7 @@ const props = withDefaults(defineProps<_Props>(), {
|
|
|
58
59
|
prefixUnit: false,
|
|
59
60
|
showSymbol: false,
|
|
60
61
|
alwaysShowDecimal: true,
|
|
62
|
+
...priceProps,
|
|
61
63
|
});
|
|
62
64
|
|
|
63
65
|
/** 格式化后的价格 */
|
|
@@ -80,6 +82,7 @@ const formattedPrice = computed(() => formatPrice(props.value));
|
|
|
80
82
|
.Price {
|
|
81
83
|
@extend %external-vars;
|
|
82
84
|
color: UTILS__LOCAL_VAR(color);
|
|
85
|
+
font-family: UTILS__LOCAL_VAR(font-family);
|
|
83
86
|
font-size: UTILS__LOCAL_VAR(font-size);
|
|
84
87
|
font-weight: UTILS__LOCAL_VAR(font-weight);
|
|
85
88
|
}
|
|
@@ -88,16 +91,19 @@ const formattedPrice = computed(() => formatPrice(props.value));
|
|
|
88
91
|
}
|
|
89
92
|
.Price--integer {
|
|
90
93
|
color: UTILS__LOCAL_VAR(integer-color);
|
|
94
|
+
font-family: UTILS__LOCAL_VAR(integer-font-size);
|
|
91
95
|
font-size: UTILS__LOCAL_VAR(integer-font-size);
|
|
92
96
|
font-weight: UTILS__LOCAL_VAR(integer-font-weight);
|
|
93
97
|
}
|
|
94
98
|
.Price--decimal {
|
|
95
99
|
color: UTILS__LOCAL_VAR(decimal-color);
|
|
100
|
+
font-family: UTILS__LOCAL_VAR(decimal-font-family);
|
|
96
101
|
font-size: UTILS__LOCAL_VAR(decimal-font-size);
|
|
97
102
|
font-weight: UTILS__LOCAL_VAR(decimal-font-weight);
|
|
98
103
|
}
|
|
99
104
|
.Price--unit {
|
|
100
105
|
color: UTILS__LOCAL_VAR(unit-color);
|
|
106
|
+
font-family: UTILS__LOCAL_VAR(unit-font-family);
|
|
101
107
|
font-size: UTILS__LOCAL_VAR(unit-font-size);
|
|
102
108
|
font-weight: UTILS__LOCAL_VAR(unit-font-weight);
|
|
103
109
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type ConfigurablePriceProps = {
|
|
2
|
+
/** 前置单位 */
|
|
3
|
+
prefixUnit?: boolean;
|
|
4
|
+
/** 是否一直显示符号 */
|
|
5
|
+
showSymbol?: boolean;
|
|
6
|
+
/** 是否始终显示小数 */
|
|
7
|
+
alwaysShowDecimal?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare let priceProps: ConfigurablePriceProps;
|
|
10
|
+
export declare const setDefaultPriceProps: (props?: ConfigurablePriceProps) => void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type ConfigurablePriceProps = {
|
|
2
|
+
/** 前置单位 */
|
|
3
|
+
prefixUnit?: boolean;
|
|
4
|
+
/** 是否一直显示符号 */
|
|
5
|
+
showSymbol?: boolean;
|
|
6
|
+
/** 是否始终显示小数 */
|
|
7
|
+
alwaysShowDecimal?: boolean;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export let priceProps: ConfigurablePriceProps = {};
|
|
11
|
+
|
|
12
|
+
export const setDefaultPriceProps = (props: ConfigurablePriceProps = {}) => {
|
|
13
|
+
priceProps = props;
|
|
14
|
+
};
|
|
@@ -53,6 +53,7 @@ import { debounce as debounceFn } from 'lodash-es';
|
|
|
53
53
|
import useClassNames from '../../composable/component-name';
|
|
54
54
|
import ButtonCpn from '../button/button.vue';
|
|
55
55
|
import IconCpn from '../icon/icon.vue';
|
|
56
|
+
import { searchProps } from './types';
|
|
56
57
|
|
|
57
58
|
defineOptions({
|
|
58
59
|
options: {
|
|
@@ -91,6 +92,7 @@ const props = withDefaults(defineProps<_Props>(), {
|
|
|
91
92
|
disabled: false,
|
|
92
93
|
readonly: false,
|
|
93
94
|
cancelButton: false,
|
|
95
|
+
...searchProps,
|
|
94
96
|
});
|
|
95
97
|
|
|
96
98
|
const emit = defineEmits<{
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type ConfigurableSearchProps = {
|
|
2
|
+
/** 最大输入文本长度 */
|
|
3
|
+
maxlength?: number;
|
|
4
|
+
/** 占位文本 */
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
/** 防抖时长 */
|
|
7
|
+
debounce?: number;
|
|
8
|
+
/** 是否有清空按钮 */
|
|
9
|
+
clearable?: boolean;
|
|
10
|
+
/** 是否显示取消按钮 */
|
|
11
|
+
cancelButton?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare let searchProps: ConfigurableSearchProps;
|
|
14
|
+
export declare const setDefaultSearchProps: (props?: ConfigurableSearchProps) => void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type ConfigurableSearchProps = {
|
|
2
|
+
/** 最大输入文本长度 */
|
|
3
|
+
maxlength?: number;
|
|
4
|
+
/** 占位文本 */
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
/** 防抖时长 */
|
|
7
|
+
debounce?: number;
|
|
8
|
+
/** 是否有清空按钮 */
|
|
9
|
+
clearable?: boolean;
|
|
10
|
+
/** 是否显示取消按钮 */
|
|
11
|
+
cancelButton?: boolean;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export let searchProps: ConfigurableSearchProps = {};
|
|
15
|
+
|
|
16
|
+
export const setDefaultSearchProps = (props: ConfigurableSearchProps = {}) => {
|
|
17
|
+
searchProps = props;
|
|
18
|
+
};
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
<script lang="ts" setup>
|
|
14
14
|
import useClassNames from '../../composable/component-name';
|
|
15
15
|
import IconCpn from '../icon/icon.vue';
|
|
16
|
+
import { searchingProps } from './types';
|
|
16
17
|
|
|
17
18
|
defineOptions({
|
|
18
19
|
options: {
|
|
@@ -33,6 +34,7 @@ type _Props = {
|
|
|
33
34
|
withDefaults(defineProps<_Props>(), {
|
|
34
35
|
image: '',
|
|
35
36
|
text: '数据加载中',
|
|
37
|
+
...searchingProps,
|
|
36
38
|
});
|
|
37
39
|
</script>
|
|
38
40
|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type ConfigurableSearchingProps = {
|
|
2
|
+
/** 图片 */
|
|
3
|
+
image?: string;
|
|
4
|
+
/** 文本 */
|
|
5
|
+
text?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare let searchingProps: ConfigurableSearchingProps;
|
|
8
|
+
export declare const setDefaultSearchingProps: (props?: ConfigurableSearchingProps) => void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type ConfigurableSearchingProps = {
|
|
2
|
+
/** 图片 */
|
|
3
|
+
image?: string;
|
|
4
|
+
/** 文本 */
|
|
5
|
+
text?: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export let searchingProps: ConfigurableSearchingProps = {};
|
|
9
|
+
|
|
10
|
+
export const setDefaultSearchingProps = (
|
|
11
|
+
props: ConfigurableSearchingProps = {}
|
|
12
|
+
) => {
|
|
13
|
+
searchingProps = props;
|
|
14
|
+
};
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
<icon-cpn
|
|
15
15
|
v-if="loading"
|
|
16
16
|
icon="loading-dot-spinner"
|
|
17
|
+
spinning
|
|
17
18
|
:class="$style['Switch--loading']"
|
|
18
19
|
/>
|
|
19
20
|
</view>
|
|
@@ -24,6 +25,7 @@
|
|
|
24
25
|
import { computed, inject, ref } from 'vue';
|
|
25
26
|
import useClassNames from '../../composable/component-name';
|
|
26
27
|
import IconCpn from '../icon/icon.vue';
|
|
28
|
+
import { switchProps } from './types';
|
|
27
29
|
|
|
28
30
|
defineOptions({
|
|
29
31
|
options: {
|
|
@@ -56,6 +58,7 @@ const props = withDefaults(defineProps<_Props>(), {
|
|
|
56
58
|
valueOff: false,
|
|
57
59
|
disabled: false,
|
|
58
60
|
readonly: false,
|
|
61
|
+
...switchProps,
|
|
59
62
|
});
|
|
60
63
|
|
|
61
64
|
const emit = defineEmits<{
|
|
@@ -64,7 +67,7 @@ const emit = defineEmits<{
|
|
|
64
67
|
e: 'async',
|
|
65
68
|
payload: {
|
|
66
69
|
value: boolean | number | string;
|
|
67
|
-
} &
|
|
70
|
+
} & PromiseResolvers<unknown>
|
|
68
71
|
): void;
|
|
69
72
|
}>();
|
|
70
73
|
|
|
@@ -98,13 +101,7 @@ const toggle = () => {
|
|
|
98
101
|
const nextValue =
|
|
99
102
|
props.modelValue !== props.valueOn ? props.valueOn : props.valueOff;
|
|
100
103
|
|
|
101
|
-
|
|
102
|
-
let resolve: UniApp.PromiseResolver<unknown>,
|
|
103
|
-
reject: UniApp.PromiseRejector<unknown>;
|
|
104
|
-
const promise = new Promise((res, rej) => {
|
|
105
|
-
resolve = res;
|
|
106
|
-
reject = rej;
|
|
107
|
-
});
|
|
104
|
+
const { promise, resolve, reject } = Promise.withResolvers();
|
|
108
105
|
|
|
109
106
|
promise
|
|
110
107
|
.then((isOk = true) => {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type ConfigurableSwitchProps = {
|
|
2
|
+
/** 开启状态的值 */
|
|
3
|
+
valueOn?: boolean | number | string;
|
|
4
|
+
/** 关闭状态的值 */
|
|
5
|
+
valueOff?: boolean | number | string;
|
|
6
|
+
};
|
|
7
|
+
export declare let switchProps: ConfigurableSwitchProps;
|
|
8
|
+
export declare const setDefaultSwitchProps: (props?: ConfigurableSwitchProps) => void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type ConfigurableSwitchProps = {
|
|
2
|
+
/** 开启状态的值 */
|
|
3
|
+
valueOn?: boolean | number | string;
|
|
4
|
+
/** 关闭状态的值 */
|
|
5
|
+
valueOff?: boolean | number | string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export let switchProps: ConfigurableSwitchProps = {};
|
|
9
|
+
|
|
10
|
+
export const setDefaultSwitchProps = (props: ConfigurableSwitchProps = {}) => {
|
|
11
|
+
switchProps = props;
|
|
12
|
+
};
|
package/components/tab/tab.vue
CHANGED
|
@@ -47,6 +47,7 @@ import {
|
|
|
47
47
|
watch,
|
|
48
48
|
} from 'vue';
|
|
49
49
|
import useClassNames from '../../composable/component-name';
|
|
50
|
+
import { tabProps } from './types';
|
|
50
51
|
|
|
51
52
|
defineOptions({
|
|
52
53
|
options: {
|
|
@@ -84,6 +85,7 @@ const props = withDefaults(defineProps<_Props>(), {
|
|
|
84
85
|
tabs: () => [],
|
|
85
86
|
evenly: true,
|
|
86
87
|
indicator: true,
|
|
88
|
+
...tabProps,
|
|
87
89
|
});
|
|
88
90
|
|
|
89
91
|
const emit = defineEmits<{
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type ConfigurableTabProps = {
|
|
2
|
+
/** 是否均分大小 */
|
|
3
|
+
evenly?: boolean;
|
|
4
|
+
/** 是否显示指示器 */
|
|
5
|
+
indicator?: boolean;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export let tabProps: ConfigurableTabProps = {};
|
|
9
|
+
|
|
10
|
+
export const setDefaultTabProps = (props: ConfigurableTabProps = {}) => {
|
|
11
|
+
tabProps = props;
|
|
12
|
+
};
|
|
@@ -74,6 +74,7 @@ import {
|
|
|
74
74
|
} from 'vue';
|
|
75
75
|
import useClassNames from '../../composable/component-name';
|
|
76
76
|
import IconCpn from '../icon/icon.vue';
|
|
77
|
+
import { textareaProps } from './types';
|
|
77
78
|
|
|
78
79
|
defineOptions({
|
|
79
80
|
options: {
|
|
@@ -85,6 +86,12 @@ defineOptions({
|
|
|
85
86
|
const classNames = useClassNames('textarea');
|
|
86
87
|
const $style = useCssModule();
|
|
87
88
|
|
|
89
|
+
type _Slots = {
|
|
90
|
+
placeholder: () => void;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
defineSlots<_Slots>();
|
|
94
|
+
|
|
88
95
|
type _Props = {
|
|
89
96
|
/** 绑定值 */
|
|
90
97
|
modelValue?: string;
|
|
@@ -107,6 +114,7 @@ const props = withDefaults(defineProps<_Props>(), {
|
|
|
107
114
|
autoHeight: true,
|
|
108
115
|
readonly: false,
|
|
109
116
|
fold: true,
|
|
117
|
+
...textareaProps,
|
|
110
118
|
});
|
|
111
119
|
|
|
112
120
|
const emit = defineEmits<{
|
|
@@ -171,27 +179,27 @@ const trimValue = (e: Event) => {
|
|
|
171
179
|
|
|
172
180
|
<style lang="scss" module>
|
|
173
181
|
@use '../../styles/utils' as *;
|
|
182
|
+
@use './textarea' as *;
|
|
174
183
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
:host(.display-inline) {
|
|
179
|
-
display: inline;
|
|
184
|
+
// 定义外部变量
|
|
185
|
+
%external-vars {
|
|
186
|
+
@include UTILS__DEFINE_COMPONENT_VARS('textarea', $textarea);
|
|
180
187
|
}
|
|
181
188
|
|
|
182
189
|
.Textarea {
|
|
190
|
+
@extend %external-vars;
|
|
183
191
|
flex: 1;
|
|
184
192
|
position: relative;
|
|
185
|
-
padding: 20rpx;
|
|
193
|
+
padding: 20rpx 20rpx 0 20rpx;
|
|
186
194
|
background: UTILS__GLOBAL_VAR(color, background);
|
|
187
195
|
border-radius: 20rpx;
|
|
188
196
|
line-height: 1.5;
|
|
189
197
|
}
|
|
190
198
|
.Textarea--input {
|
|
191
199
|
width: 100%;
|
|
192
|
-
height:
|
|
193
|
-
min-height:
|
|
194
|
-
max-height:
|
|
200
|
+
height: UTILS__LOCAL_VAR(min-height);
|
|
201
|
+
min-height: UTILS__LOCAL_VAR(min-height);
|
|
202
|
+
max-height: UTILS__LOCAL_VAR(max-height);
|
|
195
203
|
padding: 0;
|
|
196
204
|
}
|
|
197
205
|
.Textarea--placeholder {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type ConfigurableTextareaProps = {
|
|
2
|
+
/** 最大输入文本长度 */
|
|
3
|
+
maxlength?: number;
|
|
4
|
+
/** 占位文本 */
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
/** 是否自动调整高度 */
|
|
7
|
+
autoHeight?: boolean;
|
|
8
|
+
/** 当只读时,如果文字过多,是否折叠 */
|
|
9
|
+
fold?: boolean;
|
|
10
|
+
};
|
|
11
|
+
export declare let textareaProps: ConfigurableTextareaProps;
|
|
12
|
+
export declare const setDefaultTextareaProps: (props?: ConfigurableTextareaProps) => void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type ConfigurableTextareaProps = {
|
|
2
|
+
/** 最大输入文本长度 */
|
|
3
|
+
maxlength?: number;
|
|
4
|
+
/** 占位文本 */
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
/** 是否自动调整高度 */
|
|
7
|
+
autoHeight?: boolean;
|
|
8
|
+
/** 当只读时,如果文字过多,是否折叠 */
|
|
9
|
+
fold?: boolean;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export let textareaProps: ConfigurableTextareaProps = {};
|
|
13
|
+
|
|
14
|
+
export const setDefaultTextareaProps = (
|
|
15
|
+
props: ConfigurableTextareaProps = {}
|
|
16
|
+
) => {
|
|
17
|
+
textareaProps = props;
|
|
18
|
+
};
|