@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,23 +1,22 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<view :class="[...classNames, $style['Badge']]">
|
|
3
3
|
<slot></slot>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
{{ showValue }}
|
|
14
|
-
</view>
|
|
4
|
+
|
|
5
|
+
<slot name="custom">
|
|
6
|
+
<view
|
|
7
|
+
v-if="$slots.badge || showValue"
|
|
8
|
+
:class="$style['Badge--box']"
|
|
9
|
+
>
|
|
10
|
+
<slot name="badge">{{ showValue }}</slot>
|
|
11
|
+
</view>
|
|
12
|
+
</slot>
|
|
15
13
|
</view>
|
|
16
14
|
</template>
|
|
17
15
|
|
|
18
16
|
<script lang="ts" setup>
|
|
19
17
|
import { computed } from 'vue';
|
|
20
18
|
import useClassNames from '../../composable/component-name';
|
|
19
|
+
import { badgeProps } from './types';
|
|
21
20
|
|
|
22
21
|
defineOptions({
|
|
23
22
|
options: {
|
|
@@ -28,6 +27,16 @@ defineOptions({
|
|
|
28
27
|
|
|
29
28
|
const classNames = useClassNames('badge');
|
|
30
29
|
|
|
30
|
+
type _Slots = {
|
|
31
|
+
default: () => void;
|
|
32
|
+
/** 完全自定义徽章 */
|
|
33
|
+
custom: () => void;
|
|
34
|
+
/** 徽章内容 */
|
|
35
|
+
badge: () => void;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
defineSlots<_Slots>();
|
|
39
|
+
|
|
31
40
|
type _Props = {
|
|
32
41
|
/** 显示在右上角的内容 */
|
|
33
42
|
value?: string | number;
|
|
@@ -38,6 +47,7 @@ type _Props = {
|
|
|
38
47
|
const props = withDefaults(defineProps<_Props>(), {
|
|
39
48
|
value: 0,
|
|
40
49
|
max: 99,
|
|
50
|
+
...badgeProps,
|
|
41
51
|
});
|
|
42
52
|
|
|
43
53
|
const showValue = computed(() => {
|
|
@@ -80,6 +90,7 @@ $__padding-x: UTILS__LOCAL_VAR(padding-x);
|
|
|
80
90
|
width: fit-content;
|
|
81
91
|
|
|
82
92
|
.Badge--box {
|
|
93
|
+
pointer-events: none;
|
|
83
94
|
box-sizing: border-box;
|
|
84
95
|
position: absolute;
|
|
85
96
|
top: 0;
|
|
@@ -24,14 +24,16 @@
|
|
|
24
24
|
:hover-class="disabled ? 'none' : $style['Button--active']"
|
|
25
25
|
:style="inlineCssVar"
|
|
26
26
|
@click="onClick"
|
|
27
|
-
@getphonenumber="
|
|
28
|
-
@getuserinfo="
|
|
29
|
-
@error="
|
|
30
|
-
@opensetting="
|
|
31
|
-
@launchapp="
|
|
32
|
-
@contact="
|
|
33
|
-
@chooseavatar="
|
|
34
|
-
@agreeprivacyauthorization="
|
|
27
|
+
@getphonenumber="onOpenType('getphonenumber', $event)"
|
|
28
|
+
@getuserinfo="onOpenType('getuserinfo', $event)"
|
|
29
|
+
@error="onOpenType('error', $event)"
|
|
30
|
+
@opensetting="onOpenType('opensetting', $event)"
|
|
31
|
+
@launchapp="onOpenType('launchapp', $event)"
|
|
32
|
+
@contact="onOpenType('contact', $event)"
|
|
33
|
+
@chooseavatar="onOpenType('chooseavatar', $event)"
|
|
34
|
+
@agreeprivacyauthorization="
|
|
35
|
+
onOpenType('agreeprivacyauthorization', $event)
|
|
36
|
+
"
|
|
35
37
|
>
|
|
36
38
|
<!-- 线性按钮边框:仅在线性按钮且不是禁用态时显示 -->
|
|
37
39
|
<view
|
|
@@ -41,9 +43,9 @@
|
|
|
41
43
|
<!-- 仅在配置了图标或文本按钮处于加载态(不能处于禁用态)时显示 -->
|
|
42
44
|
<template v-if="text">
|
|
43
45
|
<icon-cpn
|
|
44
|
-
v-if="icon || (
|
|
45
|
-
:icon="
|
|
46
|
-
:spinning="
|
|
46
|
+
v-if="icon || (isShowLoading && !disabled)"
|
|
47
|
+
:icon="isShowLoading ? 'loading-dot-spinner' : icon"
|
|
48
|
+
:spinning="isShowLoading"
|
|
47
49
|
:class="$style['Button--icon']"
|
|
48
50
|
/>
|
|
49
51
|
<slot></slot>
|
|
@@ -51,8 +53,8 @@
|
|
|
51
53
|
<view v-else :class="$style['Button--title']">
|
|
52
54
|
<icon-cpn
|
|
53
55
|
v-if="icon"
|
|
54
|
-
:icon="
|
|
55
|
-
:spinning="
|
|
56
|
+
:icon="isShowLoading ? 'loading-dot-spinner' : icon"
|
|
57
|
+
:spinning="isShowLoading"
|
|
56
58
|
:class="$style['Button--icon']"
|
|
57
59
|
/>
|
|
58
60
|
<slot></slot>
|
|
@@ -64,7 +66,7 @@
|
|
|
64
66
|
></view>
|
|
65
67
|
<!-- 加载态样式:仅在非文本按钮处于加载态(不能处于禁用态)时显示 -->
|
|
66
68
|
<view
|
|
67
|
-
v-if="!disabled && !text &&
|
|
69
|
+
v-if="!disabled && !text && isShowLoading"
|
|
68
70
|
:class="$style['Button--loading-icon']"
|
|
69
71
|
>
|
|
70
72
|
<icon-cpn icon="loading-dot-spinner" spinning />
|
|
@@ -76,13 +78,7 @@
|
|
|
76
78
|
import { computed, ref, useCssModule } from 'vue';
|
|
77
79
|
import useClassNames from '../../composable/component-name';
|
|
78
80
|
import IconCpn from '../icon/icon.vue';
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* **组件使用说明:**
|
|
82
|
-
*
|
|
83
|
-
* 当 async 为 false 时,组件会按传入的 coolDown 控制两次点击之间的间隔
|
|
84
|
-
* 当 async 为 true 时,需要在父组件监听 click 事件的回调函数中调用传入的 resolve 或 reject 方法,否则按钮将持续处于 loading 状态
|
|
85
|
-
*/
|
|
81
|
+
import { buttonProps } from './types';
|
|
86
82
|
|
|
87
83
|
defineOptions({
|
|
88
84
|
options: {
|
|
@@ -110,8 +106,16 @@ type _Props = {
|
|
|
110
106
|
| 'agreePrivacyAuthorization';
|
|
111
107
|
/** 按钮冷却时间,单位毫秒,两次点击之间的最小间隔,为 `0` 时可连续点击 */
|
|
112
108
|
coolDown?: number;
|
|
113
|
-
/**
|
|
114
|
-
|
|
109
|
+
/**
|
|
110
|
+
* 点击事件异步回调
|
|
111
|
+
*
|
|
112
|
+
* - 当 `openType` 为空时,如果配置了 `async` 回调,点击按钮会触发并等待 `async` 回调,期间不会触发 click 事件
|
|
113
|
+
* - 当 `openType` 不为空时,如果配置了 `async` 回调,点击按钮会先触发 emit 事件,
|
|
114
|
+
* 在 openType 事件触发后触发并等待 `async` 回调,且会将 `openType` 响应事件作为参数传递给 `async` 回调
|
|
115
|
+
*
|
|
116
|
+
*/
|
|
117
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
118
|
+
async?: (payload?: any) => any;
|
|
115
119
|
/** 是否圆角 */
|
|
116
120
|
round?: boolean;
|
|
117
121
|
/** 是否线性 */
|
|
@@ -122,6 +126,8 @@ type _Props = {
|
|
|
122
126
|
icon?: string;
|
|
123
127
|
/** 加载中 */
|
|
124
128
|
loading?: boolean;
|
|
129
|
+
/** 是否显示加载中 */
|
|
130
|
+
showLoading?: boolean;
|
|
125
131
|
/** 小尺寸 */
|
|
126
132
|
small?: boolean;
|
|
127
133
|
/** 大尺寸 */
|
|
@@ -134,18 +140,21 @@ const props = withDefaults(defineProps<_Props>(), {
|
|
|
134
140
|
type: 'primary',
|
|
135
141
|
openType: undefined,
|
|
136
142
|
coolDown: 500,
|
|
137
|
-
async:
|
|
143
|
+
async: undefined,
|
|
138
144
|
round: false,
|
|
139
145
|
plain: false,
|
|
140
146
|
text: false,
|
|
141
147
|
icon: '',
|
|
142
148
|
loading: false,
|
|
149
|
+
showLoading: undefined,
|
|
143
150
|
small: false,
|
|
144
151
|
large: false,
|
|
152
|
+
...buttonProps,
|
|
145
153
|
});
|
|
146
154
|
|
|
147
155
|
const emit = defineEmits<{
|
|
148
|
-
(event: 'click'
|
|
156
|
+
(event: 'click'): void;
|
|
157
|
+
/* eslint-disable vue/no-unused-emit-declarations */
|
|
149
158
|
(event: 'getphonenumber', payload?: UniApp.GetPhoneNumberEvent): void;
|
|
150
159
|
(event: 'getuserinfo', payload?: unknown): void;
|
|
151
160
|
(event: 'error', payload?: unknown): void;
|
|
@@ -154,6 +163,7 @@ const emit = defineEmits<{
|
|
|
154
163
|
(event: 'contact', payload?: unknown): void;
|
|
155
164
|
(event: 'chooseavatar', payload?: unknown): void;
|
|
156
165
|
(event: 'agreeprivacyauthorization', payload?: unknown): void;
|
|
166
|
+
/* eslint-enable vue/no-unused-emit-declarations */
|
|
157
167
|
}>();
|
|
158
168
|
|
|
159
169
|
/** 按钮是否冷却中 */
|
|
@@ -182,6 +192,10 @@ const buttonSize = computed(() => {
|
|
|
182
192
|
});
|
|
183
193
|
/** 按钮是否处于 loading 状态 */
|
|
184
194
|
const isLoading = computed(() => props.loading || isAsyncLoading.value);
|
|
195
|
+
/** 是否显示按钮 loading 状态 */
|
|
196
|
+
const isShowLoading = computed(
|
|
197
|
+
() => isLoading.value && (props.showLoading ?? props.text ? false : true)
|
|
198
|
+
);
|
|
185
199
|
/** 按钮是否可被点击 */
|
|
186
200
|
const isNotClickable = computed(
|
|
187
201
|
() =>
|
|
@@ -191,7 +205,9 @@ const isNotClickable = computed(
|
|
|
191
205
|
isCoolingDown.value
|
|
192
206
|
);
|
|
193
207
|
|
|
194
|
-
/**
|
|
208
|
+
/**
|
|
209
|
+
* 让按钮进入冷却
|
|
210
|
+
*/
|
|
195
211
|
const $_coolDown = () => {
|
|
196
212
|
if (props.coolDown > 0) {
|
|
197
213
|
isCoolingDown.value = true;
|
|
@@ -202,33 +218,52 @@ const $_coolDown = () => {
|
|
|
202
218
|
}
|
|
203
219
|
};
|
|
204
220
|
|
|
205
|
-
/**
|
|
206
|
-
|
|
221
|
+
/**
|
|
222
|
+
* 点击按钮响应
|
|
223
|
+
*/
|
|
224
|
+
const onClick = async () => {
|
|
207
225
|
if (isNotClickable.value) {
|
|
208
226
|
return;
|
|
209
227
|
}
|
|
210
228
|
|
|
211
229
|
$_coolDown();
|
|
212
230
|
|
|
231
|
+
if (props.openType) {
|
|
232
|
+
emit('click');
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
|
|
213
236
|
if (!props.async) {
|
|
214
237
|
emit('click');
|
|
215
238
|
return;
|
|
216
239
|
}
|
|
217
240
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
resolve = res;
|
|
224
|
-
reject = rej;
|
|
225
|
-
});
|
|
226
|
-
promise.finally(() => {
|
|
241
|
+
try {
|
|
242
|
+
isAsyncLoading.value = true;
|
|
243
|
+
await props.async();
|
|
244
|
+
return;
|
|
245
|
+
} finally {
|
|
227
246
|
isAsyncLoading.value = false;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
emit('click', { resolve, reject });
|
|
247
|
+
}
|
|
231
248
|
};
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* openType 事件响应
|
|
252
|
+
*/
|
|
253
|
+
async function onOpenType(event: string, payload?: unknown) {
|
|
254
|
+
if (!props.async) {
|
|
255
|
+
emit(event as Parameters<typeof emit>[0], payload);
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
try {
|
|
260
|
+
isAsyncLoading.value = true;
|
|
261
|
+
await props.async(payload);
|
|
262
|
+
return;
|
|
263
|
+
} finally {
|
|
264
|
+
isAsyncLoading.value = false;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
232
267
|
</script>
|
|
233
268
|
|
|
234
269
|
<style lang="scss" module>
|
|
@@ -236,7 +271,6 @@ const onClick = () => {
|
|
|
236
271
|
@use 'sass:math';
|
|
237
272
|
@use 'sass:map';
|
|
238
273
|
@use '../../styles/utils' as *;
|
|
239
|
-
@use '../../styles/var' as *;
|
|
240
274
|
@use './button' as *;
|
|
241
275
|
|
|
242
276
|
// 定义外部变量
|
|
@@ -302,7 +336,7 @@ $button-sizes: (
|
|
|
302
336
|
}
|
|
303
337
|
|
|
304
338
|
.Button--plain,
|
|
305
|
-
.Button
|
|
339
|
+
.Button--text {
|
|
306
340
|
--button-color: var(
|
|
307
341
|
#{UTILS__VAR_NAME('button', text-color)},
|
|
308
342
|
#{UTILS__LOCAL_VAR(theme)}
|
|
@@ -315,7 +349,6 @@ $button-sizes: (
|
|
|
315
349
|
display: block;
|
|
316
350
|
position: relative;
|
|
317
351
|
font-weight: 500;
|
|
318
|
-
width: 100%;
|
|
319
352
|
padding: 0 20rpx;
|
|
320
353
|
box-sizing: border-box;
|
|
321
354
|
text-decoration: none;
|
|
@@ -341,7 +374,6 @@ $button-sizes: (
|
|
|
341
374
|
background: UTILS__LOCAL_VAR(active-mask);
|
|
342
375
|
pointer-events: none;
|
|
343
376
|
opacity: 0;
|
|
344
|
-
will-change: opacity;
|
|
345
377
|
|
|
346
378
|
transition: opacity 0.3s;
|
|
347
379
|
}
|
|
@@ -378,9 +410,7 @@ $button-sizes: (
|
|
|
378
410
|
}
|
|
379
411
|
|
|
380
412
|
.Button--title {
|
|
381
|
-
|
|
382
|
-
inset: 0;
|
|
383
|
-
overflow: hidden;
|
|
413
|
+
height: 100%;
|
|
384
414
|
display: flex;
|
|
385
415
|
justify-content: center;
|
|
386
416
|
align-items: center;
|
|
@@ -406,7 +436,6 @@ $button-sizes: (
|
|
|
406
436
|
padding: 0;
|
|
407
437
|
line-height: inherit;
|
|
408
438
|
font-weight: inherit;
|
|
409
|
-
will-change: color;
|
|
410
439
|
|
|
411
440
|
transition: color 0.3s;
|
|
412
441
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type ConfigurableButtonProps = {
|
|
2
|
+
/** 按钮主题 */
|
|
3
|
+
type?: string;
|
|
4
|
+
/** 按钮冷却时间,单位毫秒,两次点击之间的最小间隔,为 `0` 时可连续点击 */
|
|
5
|
+
coolDown?: number;
|
|
6
|
+
/** 是否圆角 */
|
|
7
|
+
round?: boolean;
|
|
8
|
+
/** 是否线性 */
|
|
9
|
+
plain?: boolean;
|
|
10
|
+
/** 是否文本按钮 */
|
|
11
|
+
text?: boolean;
|
|
12
|
+
/** 按钮图标 */
|
|
13
|
+
icon?: string;
|
|
14
|
+
/** 小尺寸 */
|
|
15
|
+
small?: boolean;
|
|
16
|
+
/** 大尺寸 */
|
|
17
|
+
large?: boolean;
|
|
18
|
+
};
|
|
19
|
+
export declare let buttonProps: ConfigurableButtonProps;
|
|
20
|
+
export declare const setDefaultButtonProps: (props?: ConfigurableButtonProps) => void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type ConfigurableButtonProps = {
|
|
2
|
+
/** 按钮主题 */
|
|
3
|
+
type?: string;
|
|
4
|
+
/** 按钮冷却时间,单位毫秒,两次点击之间的最小间隔,为 `0` 时可连续点击 */
|
|
5
|
+
coolDown?: number;
|
|
6
|
+
/** 是否圆角 */
|
|
7
|
+
round?: boolean;
|
|
8
|
+
/** 是否线性 */
|
|
9
|
+
plain?: boolean;
|
|
10
|
+
/** 是否文本按钮 */
|
|
11
|
+
text?: boolean;
|
|
12
|
+
/** 按钮图标 */
|
|
13
|
+
icon?: string;
|
|
14
|
+
/** 小尺寸 */
|
|
15
|
+
small?: boolean;
|
|
16
|
+
/** 大尺寸 */
|
|
17
|
+
large?: boolean;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export let buttonProps: ConfigurableButtonProps = {};
|
|
21
|
+
|
|
22
|
+
export const setDefaultButtonProps = (props: ConfigurableButtonProps = {}) => {
|
|
23
|
+
buttonProps = props;
|
|
24
|
+
};
|
|
@@ -20,6 +20,7 @@ import { computed, inject, ref } from 'vue';
|
|
|
20
20
|
import type { ComputedRef, Ref } from 'vue';
|
|
21
21
|
import IconCpn from '../icon/icon.vue';
|
|
22
22
|
import useClassNames from '../../composable/component-name';
|
|
23
|
+
import { checkboxProps } from './types';
|
|
23
24
|
|
|
24
25
|
defineOptions({
|
|
25
26
|
options: {
|
|
@@ -78,6 +79,7 @@ const props = withDefaults(defineProps<_Props>(), {
|
|
|
78
79
|
icon: undefined,
|
|
79
80
|
checkedIcon: '',
|
|
80
81
|
uncheckedIcon: '',
|
|
82
|
+
...checkboxProps,
|
|
81
83
|
});
|
|
82
84
|
|
|
83
85
|
const emit = defineEmits<{
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type ConfigurableCheckboxProps = {
|
|
2
|
+
/** 是否显示勾选图标 */
|
|
3
|
+
icon?: boolean;
|
|
4
|
+
/** 选中时的图标 */
|
|
5
|
+
checkedIcon?: string;
|
|
6
|
+
/** 未选中时的图标 */
|
|
7
|
+
uncheckedIcon?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare let checkboxProps: ConfigurableCheckboxProps;
|
|
10
|
+
export declare const setDefaultCheckboxProps: (props?: ConfigurableCheckboxProps) => void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type ConfigurableCheckboxProps = {
|
|
2
|
+
/** 是否显示勾选图标 */
|
|
3
|
+
icon?: boolean;
|
|
4
|
+
/** 选中时的图标 */
|
|
5
|
+
checkedIcon?: string;
|
|
6
|
+
/** 未选中时的图标 */
|
|
7
|
+
uncheckedIcon?: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export let checkboxProps: ConfigurableCheckboxProps = {};
|
|
11
|
+
|
|
12
|
+
export const setDefaultCheckboxProps = (
|
|
13
|
+
props: ConfigurableCheckboxProps = {}
|
|
14
|
+
) => {
|
|
15
|
+
checkboxProps = props;
|
|
16
|
+
};
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
<script lang="ts" setup>
|
|
8
8
|
import { computed, provide, ref, watch } from 'vue';
|
|
9
9
|
import useClassNames from '../../composable/component-name';
|
|
10
|
+
import { checkboxGroupProps } from './types';
|
|
10
11
|
|
|
11
12
|
defineOptions({
|
|
12
13
|
options: {
|
|
@@ -36,6 +37,7 @@ const props = withDefaults(defineProps<_Props>(), {
|
|
|
36
37
|
icon: true,
|
|
37
38
|
checkedIcon: '',
|
|
38
39
|
uncheckedIcon: '',
|
|
40
|
+
...checkboxGroupProps,
|
|
39
41
|
});
|
|
40
42
|
|
|
41
43
|
const emit = defineEmits<{
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type ConfigurableCheckboxGroupProps = {
|
|
2
|
+
/** 是否显示勾选图标 */
|
|
3
|
+
icon?: boolean;
|
|
4
|
+
/** 选中时的图标 */
|
|
5
|
+
checkedIcon?: string;
|
|
6
|
+
/** 未选中时的图标 */
|
|
7
|
+
uncheckedIcon?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare let checkboxGroupProps: ConfigurableCheckboxGroupProps;
|
|
10
|
+
export declare const setDefaultCheckboxGroupProps: (props?: ConfigurableCheckboxGroupProps) => void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type ConfigurableCheckboxGroupProps = {
|
|
2
|
+
/** 是否显示勾选图标 */
|
|
3
|
+
icon?: boolean;
|
|
4
|
+
/** 选中时的图标 */
|
|
5
|
+
checkedIcon?: string;
|
|
6
|
+
/** 未选中时的图标 */
|
|
7
|
+
uncheckedIcon?: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export let checkboxGroupProps: ConfigurableCheckboxGroupProps = {
|
|
11
|
+
icon: true,
|
|
12
|
+
checkedIcon: '',
|
|
13
|
+
uncheckedIcon: '',
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const setDefaultCheckboxGroupProps = (
|
|
17
|
+
props: ConfigurableCheckboxGroupProps = {}
|
|
18
|
+
) => {
|
|
19
|
+
checkboxGroupProps = props;
|
|
20
|
+
};
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
import { computed, ref } from 'vue';
|
|
30
30
|
import useClassNames from '../../composable/component-name';
|
|
31
31
|
import Checkbox2Cpn from './checkbox2.vue';
|
|
32
|
+
import { checkboxGroupProps } from '../checkbox-group/types';
|
|
32
33
|
|
|
33
34
|
defineOptions({
|
|
34
35
|
options: {
|
|
@@ -67,6 +68,7 @@ const props = withDefaults(defineProps<_Props>(), {
|
|
|
67
68
|
icon: true,
|
|
68
69
|
checkedIcon: undefined,
|
|
69
70
|
uncheckedIcon: undefined,
|
|
71
|
+
...checkboxGroupProps,
|
|
70
72
|
});
|
|
71
73
|
|
|
72
74
|
const emit = defineEmits<{
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
<load-more-cpn
|
|
6
6
|
v-if="showLoadMore && pagingData && pagingData.totalCount"
|
|
7
|
+
:observe="false"
|
|
7
8
|
:loading="loadingMore"
|
|
8
9
|
:end="!pagingData.hasMore"
|
|
9
10
|
:class="$style['DataList--load-more']"
|
|
@@ -66,9 +67,13 @@ const vm = getCurrentInstance();
|
|
|
66
67
|
const startObserver = () => {
|
|
67
68
|
stopObserver();
|
|
68
69
|
|
|
69
|
-
_observer = uni
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
_observer = uni
|
|
71
|
+
.createIntersectionObserver(vm, {
|
|
72
|
+
nativeMode: true,
|
|
73
|
+
} as UniApp.CreateIntersectionObserverOptions)
|
|
74
|
+
.relativeToViewport({
|
|
75
|
+
bottom: 0,
|
|
76
|
+
});
|
|
72
77
|
_observer.observe('.' + $style['DataList--observe-view'], (res) => {
|
|
73
78
|
if (res.intersectionRatio === 0) return;
|
|
74
79
|
emit('load-more');
|
|
@@ -124,10 +129,11 @@ onBeforeUnmount(() => {
|
|
|
124
129
|
flex-direction: column;
|
|
125
130
|
width: 100%;
|
|
126
131
|
min-height: 100%;
|
|
127
|
-
|
|
128
|
-
.DataList--load-more {
|
|
129
|
-
|
|
130
|
-
|
|
132
|
+
|
|
133
|
+
.DataList--load-more {
|
|
134
|
+
position: sticky;
|
|
135
|
+
top: 100%;
|
|
136
|
+
}
|
|
131
137
|
}
|
|
132
138
|
.DataList--observe-view {
|
|
133
139
|
position: absolute;
|
|
@@ -75,6 +75,7 @@ import { formatDate, toDate } from '../../utils/date';
|
|
|
75
75
|
import PopupCpn from '../popup/popup.vue';
|
|
76
76
|
import SelectorCpn from '../selector/selector.vue';
|
|
77
77
|
import DatePickerViewCpn from './date-picker-view.vue';
|
|
78
|
+
import { datePickerProps } from './types';
|
|
78
79
|
|
|
79
80
|
defineOptions({
|
|
80
81
|
options: {
|
|
@@ -119,6 +120,7 @@ const props = withDefaults(defineProps<_Props>(), {
|
|
|
119
120
|
timeAppend: '',
|
|
120
121
|
min: '',
|
|
121
122
|
max: '',
|
|
123
|
+
...datePickerProps,
|
|
122
124
|
});
|
|
123
125
|
|
|
124
126
|
const emit = defineEmits<{
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type ConfigurableDatePickerProps = {
|
|
2
|
+
/** 占位文本 */
|
|
3
|
+
placeholder?: string;
|
|
4
|
+
/** 是否在选择开始日期时,同步修改结束日期,且保持时间差 */
|
|
5
|
+
keepDiff?: boolean;
|
|
6
|
+
/** 结束日期是否可以与开始日期相同 */
|
|
7
|
+
canSame?: boolean;
|
|
8
|
+
/** 在选择的日期后面拼接时间字符串,如果传入的是数组,会分别对应添加到范围日期值后 */
|
|
9
|
+
timeAppend?: string | (() => string[]);
|
|
10
|
+
};
|
|
11
|
+
export declare let datePickerProps: ConfigurableDatePickerProps;
|
|
12
|
+
export declare const setDefaultDatePickerProps: (props?: ConfigurableDatePickerProps) => void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type ConfigurableDatePickerProps = {
|
|
2
|
+
/** 占位文本 */
|
|
3
|
+
placeholder?: string;
|
|
4
|
+
/** 是否在选择开始日期时,同步修改结束日期,且保持时间差 */
|
|
5
|
+
keepDiff?: boolean;
|
|
6
|
+
/** 结束日期是否可以与开始日期相同 */
|
|
7
|
+
canSame?: boolean;
|
|
8
|
+
/** 在选择的日期后面拼接时间字符串,如果传入的是数组,会分别对应添加到范围日期值后 */
|
|
9
|
+
timeAppend?: string | (() => string[]);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export let datePickerProps: ConfigurableDatePickerProps = {};
|
|
13
|
+
|
|
14
|
+
export const setDefaultDatePickerProps = (
|
|
15
|
+
props: ConfigurableDatePickerProps = {}
|
|
16
|
+
) => {
|
|
17
|
+
datePickerProps = props;
|
|
18
|
+
};
|