@ecolovo/uniapp-components 1.0.10 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +202 -66
- package/components/aspect/aspect.vue +24 -15
- package/components/badge/badge.scss +20 -0
- package/components/badge/badge.vue +49 -40
- package/components/button/button.scss +15 -0
- package/components/button/button.vue +121 -177
- package/components/checkbox/checkbox.scss +10 -0
- package/components/checkbox/checkbox.vue +118 -146
- package/components/checkbox-group/checkbox-group.vue +79 -85
- package/components/checkbox-group2/checkbox-group2.vue +111 -107
- package/components/checkbox-group2/checkbox2.vue +104 -0
- package/components/data-list/data-list.scss +9 -0
- package/components/data-list/data-list.vue +70 -79
- package/components/date-picker/date-picker-view.vue +125 -124
- package/components/date-picker/date-picker.vue +145 -146
- package/components/dialog/dialog-content.vue +39 -47
- package/components/dialog/dialog.scss +11 -0
- package/components/dialog/dialog.vue +125 -138
- package/components/dropdown/dropdown.scss +11 -0
- package/components/dropdown/dropdown.vue +55 -97
- package/components/empty/empty.scss +14 -0
- package/components/empty/empty.vue +42 -41
- package/components/flex/flex.vue +45 -54
- package/components/form/form.vue +29 -24
- package/components/form-item/form-item.scss +11 -0
- package/components/form-item/form-item.vue +43 -40
- package/components/icon/icon.vue +70 -85
- package/components/image/image.vue +35 -38
- package/components/input/input.vue +65 -79
- package/components/input/password-input.vue +34 -42
- package/components/list-page/list-page.vue +73 -99
- package/components/load-more/load-more.scss +12 -0
- package/components/load-more/load-more.vue +29 -29
- package/components/loading/animations/loading-animation1.vue +8 -8
- package/components/loading/animations/loading-animation2.vue +8 -9
- package/components/loading/animations/loading-animation3.vue +11 -11
- package/components/loading/animations/loading-animation4.vue +8 -8
- package/components/loading/loading.vue +19 -20
- package/components/message-box/message-box.vue +59 -41
- package/components/number-dialog/number-dialog.scss +9 -0
- package/components/number-dialog/number-dialog.vue +209 -204
- package/components/number-input/number-input.scss +9 -0
- package/components/number-input/number-input.vue +233 -232
- package/components/numpad/numpad.scss +9 -0
- package/components/numpad/numpad.vue +133 -150
- package/components/page/page-body.scss +15 -0
- package/components/page/page-body.vue +137 -119
- package/components/page/page-footer.scss +13 -0
- package/components/page/page-footer.vue +31 -33
- package/components/page/page-header.scss +17 -0
- package/components/page/page-header.vue +89 -94
- package/components/page/page.scss +9 -0
- package/components/page/page.vue +105 -81
- package/components/picker/picker-popup.vue +218 -209
- package/components/picker/picker.vue +99 -104
- package/components/popover/popover-content.vue +54 -63
- package/components/popover/popover-mask.vue +63 -63
- package/components/popover/popover.scss +28 -0
- package/components/popover/popover.vue +49 -47
- package/components/popup/popup-content.vue +49 -53
- package/components/popup/popup.scss +11 -0
- package/components/popup/popup.vue +117 -132
- package/components/price/price.scss +20 -0
- package/components/price/price.vue +31 -42
- package/components/search/search.scss +12 -0
- package/components/search/search.vue +93 -117
- package/components/searching/searching.vue +33 -40
- package/components/selector/selector.vue +43 -48
- package/components/switch/switch.scss +12 -0
- package/components/switch/switch.vue +99 -96
- package/components/tab/tab.scss +19 -0
- package/components/tab/tab.vue +151 -145
- package/components/textarea/textarea.vue +104 -101
- package/composable/component-name.d.ts +2 -0
- package/composable/component-name.js +8 -0
- package/composable/component-name.ts +10 -0
- package/configs/index.d.ts +25 -10
- package/configs/index.js +14 -23
- package/configs/index.ts +82 -0
- package/easyCom.d.ts +9 -0
- package/easyCom.js +1 -2
- package/easyCom.ts +31 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.ts +1 -0
- package/init.d.ts +4 -7
- package/init.js +5 -4
- package/init.ts +34 -0
- package/package.json +14 -4
- package/styles/utils/css-var.scss +12 -15
- package/styles/utils/ellipsis.scss +0 -7
- package/styles/utils/z-index.scss +1 -1
- package/styles/var/component.scss +21 -245
- package/utils/date.d.ts +47 -0
- package/utils/date.js +23 -43
- package/utils/date.ts +153 -0
- package/utils/freezeDeep.d.ts +1 -0
- package/utils/freezeDeep.js +4 -14
- package/utils/freezeDeep.ts +9 -0
- package/utils/price.d.ts +24 -0
- package/utils/price.js +14 -8
- package/utils/price.ts +57 -0
- package/utils/round.d.ts +2 -0
- package/utils/round.js +2 -14
- package/utils/round.ts +11 -0
- package/utils/windowInfo.d.ts +24 -0
- package/utils/windowInfo.js +8 -36
- package/utils/windowInfo.ts +50 -0
- package/components/checkbox-group2/checkbox.vue +0 -109
- package/components/datetime-picker/datetime-picker-view.vue +0 -209
- package/components/datetime-picker/datetime-picker.vue +0 -235
- package/components/form/mixin.js +0 -13
- package/components/list-page/list-page.js +0 -10
- package/components/table/table.vue +0 -112
- package/components/time-picker/time-picker-view.vue +0 -127
- package/components/time-picker/time-picker.vue +0 -140
- package/components/uploader/download.js +0 -81
- package/components/uploader/file-uploader.vue +0 -52
- package/components/uploader/files.js +0 -225
- package/components/uploader/media-uploader.vue +0 -189
- package/components/uploader/mixin.js +0 -171
- package/components/uploader/uni.js +0 -38
- package/components/uploader/upload-button.vue +0 -29
- package/components/uploader/uploader copy.vue +0 -547
- package/components/uploader/uploader.vue +0 -117
- package/mixins/componentName.js +0 -32
- package/mixins/listPage.js +0 -1
- package/mixins/windowInfo.js +0 -1
- package/utils/fileSize.js +0 -39
- package/utils/floor.js +0 -20
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view :class="
|
|
2
|
+
<view :class="[...classNames, $style['DatePicker']]">
|
|
3
3
|
<selector-cpn
|
|
4
|
-
:value="showText"
|
|
4
|
+
:model-value="showText"
|
|
5
5
|
:readonly="isReadonly"
|
|
6
6
|
:disabled="disabled"
|
|
7
7
|
:placeholder="placeholder"
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
<!-- 选择器弹框 -->
|
|
14
14
|
<popup-cpn
|
|
15
15
|
v-if="isShowPopup"
|
|
16
|
-
ref="
|
|
16
|
+
ref="popupRef"
|
|
17
17
|
v-model="isShowPopup"
|
|
18
18
|
:cancel="false"
|
|
19
19
|
title="选择日期"
|
|
20
|
-
@click.
|
|
20
|
+
@click.stop.prevent="doNothing"
|
|
21
21
|
@confirm="onConfirm"
|
|
22
22
|
>
|
|
23
23
|
<view v-if="range" :class="$style['DatePicker--date-selector']">
|
|
@@ -52,161 +52,160 @@
|
|
|
52
52
|
</view>
|
|
53
53
|
</template>
|
|
54
54
|
|
|
55
|
-
<script>
|
|
56
|
-
import
|
|
57
|
-
import
|
|
55
|
+
<script lang="ts" setup>
|
|
56
|
+
import { computed, inject, ref } from 'vue';
|
|
57
|
+
import useClassNames from '../../composable/component-name';
|
|
58
58
|
import { formatDate, toDate } from '../../utils/date';
|
|
59
59
|
import PopupCpn from '../popup/popup.vue';
|
|
60
60
|
import SelectorCpn from '../selector/selector.vue';
|
|
61
61
|
import DatePickerViewCpn from './date-picker-view.vue';
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
name: 'DatePicker',
|
|
63
|
+
defineOptions({
|
|
65
64
|
options: {
|
|
66
65
|
virtualHost: true,
|
|
67
66
|
styleIsolation: 'shared',
|
|
68
67
|
},
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const classNames = useClassNames('date-picker');
|
|
71
|
+
|
|
72
|
+
type _Props = {
|
|
73
|
+
/** 绑定值 */
|
|
74
|
+
modelValue?: string | null | [string, string];
|
|
75
|
+
/** 是否禁用 */
|
|
76
|
+
disabled?: boolean;
|
|
77
|
+
/** 是否只读 */
|
|
78
|
+
readonly?: boolean;
|
|
79
|
+
/** 占位文本 */
|
|
80
|
+
placeholder?: string;
|
|
81
|
+
/** 是选择日期范围 */
|
|
82
|
+
range?: boolean;
|
|
83
|
+
/** 是否在选择开始日期时,同步修改结束日期,且保持时间差 */
|
|
84
|
+
keepDiff?: boolean;
|
|
85
|
+
/** 结束日期是否可以与开始日期相同 */
|
|
86
|
+
canSame?: boolean;
|
|
87
|
+
/** 在选择的日期后面拼接时间字符串,如果传入的是数组,会分别对应添加到范围日期值后 */
|
|
88
|
+
timeAppend?: string | string[];
|
|
89
|
+
/** 最小日期 */
|
|
90
|
+
min?: string;
|
|
91
|
+
/** 最大日期 */
|
|
92
|
+
max?: string;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const props = withDefaults(defineProps<_Props>(), {
|
|
96
|
+
modelValue: null,
|
|
97
|
+
disabled: false,
|
|
98
|
+
readonly: false,
|
|
99
|
+
placeholder: '请选择',
|
|
100
|
+
range: false,
|
|
101
|
+
keepDiff: false,
|
|
102
|
+
canSame: true,
|
|
103
|
+
timeAppend: '',
|
|
104
|
+
min: '',
|
|
105
|
+
max: '',
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
const emit = defineEmits<{
|
|
109
|
+
(e: 'update:modelValue', val: string | null | [string, string]): void;
|
|
110
|
+
(e: 'change', val: string | null | [string, string]): void;
|
|
111
|
+
(e: 'show'): void;
|
|
112
|
+
}>();
|
|
113
|
+
|
|
114
|
+
/** 表单是否只读 */
|
|
115
|
+
const isFormReadonly = inject(
|
|
116
|
+
'ecolovo/form/readonly',
|
|
117
|
+
computed(() => false)
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
/** 选择框是否可见 */
|
|
121
|
+
const isShowPopup = ref(false);
|
|
122
|
+
/** 开始日期 */
|
|
123
|
+
const startStr = ref('');
|
|
124
|
+
/** 结束日期 */
|
|
125
|
+
const endStr = ref('');
|
|
126
|
+
/** 当前选中的日期类型 */
|
|
127
|
+
const checkedDateType = ref<'start' | 'end'>('start');
|
|
128
|
+
|
|
129
|
+
const popupRef = ref<InstanceType<typeof PopupCpn>>();
|
|
130
|
+
|
|
131
|
+
const isReadonly = computed(() => props.readonly || isFormReadonly.value);
|
|
132
|
+
|
|
133
|
+
const startDate = computed(() => {
|
|
134
|
+
return formatDate(
|
|
135
|
+
toDate(props.range && Array.isArray(props.modelValue) ? props.modelValue[0] : (props.modelValue as string))
|
|
136
|
+
);
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
const endDate = computed(() => {
|
|
140
|
+
return formatDate(toDate(props.range && Array.isArray(props.modelValue) ? props.modelValue[1] : ''));
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
const showText = computed(() => {
|
|
144
|
+
return props.range && startDate.value && endDate.value ? `${startDate.value} 至 ${endDate.value}` : startDate.value;
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
const doNothing = () => {};
|
|
148
|
+
|
|
149
|
+
/** 显示选择器弹出框 */
|
|
150
|
+
const showPicker = () => {
|
|
151
|
+
if (props.disabled || isReadonly.value) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
checkedDateType.value = 'start';
|
|
156
|
+
|
|
157
|
+
const [start, end] = [startDate.value, endDate.value];
|
|
158
|
+
startStr.value = start || formatDate(new Date());
|
|
159
|
+
endStr.value = end || formatDate(new Date(Date.now() + (props.canSame ? 0 : 8.64e7)));
|
|
160
|
+
|
|
161
|
+
isShowPopup.value = true;
|
|
162
|
+
emit('show');
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
/** 选中日期类型 */
|
|
166
|
+
const selectDateType = (type: 'start' | 'end') => {
|
|
167
|
+
if (checkedDateType.value !== type) checkedDateType.value = type;
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
const onChangeStart = (dateStr: string) => {
|
|
171
|
+
if (!props.range) return;
|
|
172
|
+
|
|
173
|
+
const timeDiff = toDate(endStr.value)!.getTime() - toDate(dateStr)!.getTime();
|
|
174
|
+
if (endStr.value <= dateStr || props.keepDiff) {
|
|
175
|
+
if (props.keepDiff) {
|
|
176
|
+
endStr.value = formatDate(new Date(toDate(dateStr)!.getTime() + timeDiff));
|
|
177
|
+
} else if (!props.canSame) {
|
|
178
|
+
endStr.value = formatDate(new Date(toDate(dateStr)!.getTime() + 8.64e7));
|
|
179
|
+
} else {
|
|
180
|
+
endStr.value = dateStr;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
const onChangeEnd = (dateStr: string) => {
|
|
186
|
+
if (dateStr <= startStr.value) {
|
|
187
|
+
if (props.canSame) {
|
|
188
|
+
endStr.value = startStr.value;
|
|
189
|
+
} else {
|
|
190
|
+
endStr.value = formatDate(new Date(toDate(startStr.value)!.getTime() + 8.64e7));
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
const onConfirm = () => {
|
|
196
|
+
popupRef.value?.close();
|
|
197
|
+
const startAppend = Array.isArray(props.timeAppend) ? props.timeAppend[0] : props.timeAppend;
|
|
198
|
+
const endAppend = Array.isArray(props.timeAppend) ? props.timeAppend[1] : props.timeAppend;
|
|
199
|
+
const start = startAppend ? `${startStr.value} ${startAppend}` : startStr.value;
|
|
200
|
+
const end = endAppend ? `${endStr.value} ${endAppend}` : endStr.value;
|
|
201
|
+
const result = props.range ? ([start, end] as [string, string]) : start;
|
|
202
|
+
emit('update:modelValue', result);
|
|
203
|
+
emit('change', result);
|
|
205
204
|
};
|
|
206
205
|
</script>
|
|
207
206
|
|
|
208
207
|
<style lang="scss" module>
|
|
209
|
-
@use '../../styles/
|
|
208
|
+
@use '../../styles/utils' as *;
|
|
210
209
|
|
|
211
210
|
.DatePicker {
|
|
212
211
|
width: 100%;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<view :class="
|
|
2
|
+
<view :class="[...classNames, $style['DialogContent']]">
|
|
3
3
|
<popover-content-cpn position="center" :loading="loading">
|
|
4
4
|
<!-- 内容上方标题 -->
|
|
5
5
|
<template #header>
|
|
@@ -48,67 +48,59 @@
|
|
|
48
48
|
</view>
|
|
49
49
|
</template>
|
|
50
50
|
|
|
51
|
-
<script>
|
|
52
|
-
import
|
|
51
|
+
<script lang="ts" setup>
|
|
52
|
+
import useClassNames from '../../composable/component-name';
|
|
53
53
|
import ButtonCpn from '../button/button.vue';
|
|
54
54
|
import IconCpn from '../icon/icon.vue';
|
|
55
55
|
import PopoverContentCpn from '../popover/popover-content.vue';
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
name: 'DialogContent',
|
|
57
|
+
defineOptions({
|
|
59
58
|
options: {
|
|
60
59
|
virtualHost: true,
|
|
61
60
|
styleIsolation: 'shared',
|
|
62
61
|
},
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
},
|
|
81
|
-
/** 是否显示关闭按钮 */
|
|
82
|
-
showClose: {
|
|
83
|
-
type: Boolean,
|
|
84
|
-
default: false,
|
|
85
|
-
},
|
|
86
|
-
/** 取消按钮文本,为 falsy 时( false 或 '' )不显示 */
|
|
87
|
-
cancel: {
|
|
88
|
-
type: [String, Boolean],
|
|
89
|
-
default: '取消',
|
|
90
|
-
},
|
|
91
|
-
/** 确认按钮文本,为 falsy 时( false 或 '' )不显示 */
|
|
92
|
-
confirm: {
|
|
93
|
-
type: [String, Boolean],
|
|
94
|
-
default: '确认',
|
|
95
|
-
},
|
|
96
|
-
},
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const classNames = useClassNames('dialog-content');
|
|
65
|
+
|
|
66
|
+
type _Props = {
|
|
67
|
+
/** 是否显示 loading 动画 */
|
|
68
|
+
loading?: boolean;
|
|
69
|
+
/** 标题 */
|
|
70
|
+
title?: string;
|
|
71
|
+
/** 是否居中标题 */
|
|
72
|
+
centerTitle?: boolean;
|
|
73
|
+
/** 是否显示关闭按钮 */
|
|
74
|
+
showClose?: boolean;
|
|
75
|
+
/** 取消按钮文本,为 falsy 时( false 或 '' )不显示 */
|
|
76
|
+
cancel?: string | boolean;
|
|
77
|
+
/** 确认按钮文本,为 falsy 时( false 或 '' )不显示 */
|
|
78
|
+
confirm?: string | boolean;
|
|
97
79
|
};
|
|
80
|
+
|
|
81
|
+
withDefaults(defineProps<_Props>(), {
|
|
82
|
+
loading: false,
|
|
83
|
+
title: '',
|
|
84
|
+
centerTitle: false,
|
|
85
|
+
showClose: false,
|
|
86
|
+
cancel: '取消',
|
|
87
|
+
confirm: '确认',
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
defineEmits<{
|
|
91
|
+
(e: 'close'): void;
|
|
92
|
+
(e: 'cancel'): void;
|
|
93
|
+
(e: 'confirm'): void;
|
|
94
|
+
}>();
|
|
98
95
|
</script>
|
|
99
96
|
|
|
100
97
|
<style lang="scss" module>
|
|
101
|
-
@use '../../styles/
|
|
98
|
+
@use '../../styles/utils' as *;
|
|
99
|
+
@use './dialog' as *;
|
|
102
100
|
|
|
103
101
|
// 定义外部变量
|
|
104
|
-
$component-name: 'dialog';
|
|
105
|
-
$component-vars: $dialog;
|
|
106
102
|
%external-vars {
|
|
107
|
-
@include UTILS__DEFINE_COMPONENT_VARS();
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
:host {
|
|
111
|
-
display: block;
|
|
103
|
+
@include UTILS__DEFINE_COMPONENT_VARS($dialog, 'dialog');
|
|
112
104
|
}
|
|
113
105
|
|
|
114
106
|
.DialogContent {
|