@hbdlzy/ui-core 0.1.1 → 0.1.3
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 +37 -2
- package/components.manifest.json +198 -161
- package/dist/components/BaseCard/BaseCard.types.d.ts +36 -0
- package/dist/components/BaseCard/BaseCard.vue.d.ts +122 -0
- package/dist/components/BaseCard/index.d.ts +3 -0
- package/dist/components/BaseEChart/BaseEChart.types.d.ts +26 -0
- package/dist/components/BaseEChart/BaseEChart.vue.d.ts +66 -0
- package/dist/components/BaseEChart/index.d.ts +3 -0
- package/dist/components/BaseExportButton/BaseExportButton.types.d.ts +21 -0
- package/dist/components/BaseExportButton/BaseExportButton.utils.d.ts +4 -0
- package/dist/components/BaseExportButton/BaseExportButton.vue.d.ts +128 -0
- package/dist/components/BaseExportButton/index.d.ts +5 -0
- package/dist/components/BaseTable/BaseTable.types.d.ts +163 -0
- package/dist/components/BaseTable/BaseTable.vue.d.ts +157 -0
- package/dist/components/BaseTable/index.d.ts +3 -0
- package/dist/components/OutlinedCascader/OutlinedCascader.types.d.ts +25 -0
- package/dist/components/OutlinedCascader/OutlinedCascader.vue.d.ts +85 -0
- package/dist/components/OutlinedCascader/index.d.ts +3 -0
- package/dist/components/OutlinedDatePicker/OutlinedDatePicker.types.d.ts +27 -0
- package/dist/components/OutlinedDatePicker/OutlinedDatePicker.vue.d.ts +88 -0
- package/dist/components/OutlinedDatePicker/index.d.ts +3 -0
- package/dist/components/OutlinedDateTimePicker/OutlinedDateTimePicker.types.d.ts +26 -0
- package/dist/components/OutlinedDateTimePicker/OutlinedDateTimePicker.vue.d.ts +97 -0
- package/dist/components/OutlinedDateTimePicker/index.d.ts +3 -0
- package/dist/components/OutlinedInput/OutlinedInput.types.d.ts +29 -0
- package/dist/components/OutlinedInput/OutlinedInput.vue.d.ts +97 -0
- package/dist/components/OutlinedInput/index.d.ts +3 -0
- package/dist/components/OutlinedSelect/OutlinedSelect.types.d.ts +38 -0
- package/dist/components/OutlinedSelect/OutlinedSelect.vue.d.ts +116 -0
- package/dist/components/OutlinedSelect/index.d.ts +3 -0
- package/dist/components/OutlinedTimePicker/OutlinedTimePicker.types.d.ts +28 -0
- package/dist/components/OutlinedTimePicker/OutlinedTimePicker.vue.d.ts +94 -0
- package/dist/components/OutlinedTimePicker/index.d.ts +3 -0
- package/dist/components/OutlinedTreeSelect/OutlinedTreeSelect.types.d.ts +46 -0
- package/dist/components/OutlinedTreeSelect/OutlinedTreeSelect.vue.d.ts +137 -0
- package/dist/components/OutlinedTreeSelect/index.d.ts +3 -0
- package/dist/echarts/index.d.ts +9 -0
- package/dist/excel/exportExcel.d.ts +18 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +26 -0
- package/dist/index.js +2181 -41
- package/dist/style.css +1 -1
- package/package.json +6 -4
- package/src/components/BaseCard/BaseCard.types.d.ts +36 -0
- package/src/components/BaseCard/BaseCard.vue.d.ts +122 -0
- package/src/components/BaseCard/index.d.ts +3 -0
- package/src/components/BaseEChart/BaseEChart.types.d.ts +26 -0
- package/src/components/BaseEChart/BaseEChart.vue.d.ts +66 -0
- package/src/components/BaseEChart/index.d.ts +3 -0
- package/src/components/BaseExportButton/BaseExportButton.types.d.ts +21 -0
- package/src/components/BaseExportButton/BaseExportButton.utils.d.ts +4 -0
- package/src/components/BaseExportButton/BaseExportButton.vue.d.ts +128 -0
- package/src/components/BaseExportButton/index.d.ts +5 -0
- package/src/components/BaseTable/BaseTable.types.d.ts +163 -0
- package/src/components/BaseTable/BaseTable.types.ts +12 -0
- package/src/components/BaseTable/BaseTable.vue +412 -13
- package/src/components/BaseTable/BaseTable.vue.d.ts +157 -0
- package/src/components/BaseTable/README.md +106 -120
- package/src/components/BaseTable/index.d.ts +3 -0
- package/src/components/OutlinedCascader/OutlinedCascader.types.d.ts +25 -0
- package/src/components/OutlinedCascader/OutlinedCascader.types.ts +28 -0
- package/src/components/OutlinedCascader/OutlinedCascader.vue +250 -0
- package/src/components/OutlinedCascader/OutlinedCascader.vue.d.ts +85 -0
- package/src/components/OutlinedCascader/README.md +91 -0
- package/src/components/OutlinedCascader/index.d.ts +3 -0
- package/src/components/OutlinedCascader/index.ts +10 -0
- package/src/components/OutlinedDatePicker/OutlinedDatePicker.types.d.ts +27 -0
- package/src/components/OutlinedDatePicker/OutlinedDatePicker.types.ts +40 -0
- package/src/components/OutlinedDatePicker/OutlinedDatePicker.vue +365 -0
- package/src/components/OutlinedDatePicker/OutlinedDatePicker.vue.d.ts +88 -0
- package/src/components/OutlinedDatePicker/README.md +137 -0
- package/src/components/OutlinedDatePicker/index.d.ts +3 -0
- package/src/components/OutlinedDatePicker/index.ts +11 -0
- package/src/components/OutlinedDateTimePicker/OutlinedDateTimePicker.types.d.ts +26 -0
- package/src/components/OutlinedDateTimePicker/OutlinedDateTimePicker.types.ts +34 -0
- package/src/components/OutlinedDateTimePicker/OutlinedDateTimePicker.vue +421 -0
- package/src/components/OutlinedDateTimePicker/OutlinedDateTimePicker.vue.d.ts +97 -0
- package/src/components/OutlinedDateTimePicker/README.md +88 -0
- package/src/components/OutlinedDateTimePicker/index.d.ts +3 -0
- package/src/components/OutlinedDateTimePicker/index.ts +11 -0
- package/src/components/OutlinedInput/OutlinedInput.types.d.ts +29 -0
- package/src/components/OutlinedInput/OutlinedInput.types.ts +32 -0
- package/src/components/OutlinedInput/OutlinedInput.vue +307 -0
- package/src/components/OutlinedInput/OutlinedInput.vue.d.ts +97 -0
- package/src/components/OutlinedInput/README.md +154 -0
- package/src/components/OutlinedInput/index.d.ts +3 -0
- package/src/components/OutlinedInput/index.ts +10 -0
- package/src/components/OutlinedSelect/OutlinedSelect.types.d.ts +38 -0
- package/src/components/OutlinedSelect/OutlinedSelect.types.ts +48 -0
- package/src/components/OutlinedSelect/OutlinedSelect.vue +359 -0
- package/src/components/OutlinedSelect/OutlinedSelect.vue.d.ts +116 -0
- package/src/components/OutlinedSelect/README.md +166 -0
- package/src/components/OutlinedSelect/index.d.ts +3 -0
- package/src/components/OutlinedSelect/index.ts +12 -0
- package/src/components/OutlinedTimePicker/OutlinedTimePicker.types.d.ts +28 -0
- package/src/components/OutlinedTimePicker/OutlinedTimePicker.types.ts +36 -0
- package/src/components/OutlinedTimePicker/OutlinedTimePicker.vue +303 -0
- package/src/components/OutlinedTimePicker/OutlinedTimePicker.vue.d.ts +94 -0
- package/src/components/OutlinedTimePicker/README.md +93 -0
- package/src/components/OutlinedTimePicker/index.d.ts +3 -0
- package/src/components/OutlinedTimePicker/index.ts +10 -0
- package/src/components/OutlinedTreeSelect/OutlinedTreeSelect.types.d.ts +46 -0
- package/src/components/OutlinedTreeSelect/OutlinedTreeSelect.types.ts +56 -0
- package/src/components/OutlinedTreeSelect/OutlinedTreeSelect.vue +354 -0
- package/src/components/OutlinedTreeSelect/OutlinedTreeSelect.vue.d.ts +137 -0
- package/src/components/OutlinedTreeSelect/README.md +107 -0
- package/src/components/OutlinedTreeSelect/index.d.ts +3 -0
- package/src/components/OutlinedTreeSelect/index.ts +12 -0
- package/src/echarts/index.d.ts +9 -0
- package/src/echarts/index.ts +13 -8
- package/src/excel/exportExcel.d.ts +18 -0
- package/src/index.d.ts +26 -0
- package/src/index.ts +14 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export type OutlinedTimePickerCssValue = string | number
|
|
2
|
+
|
|
3
|
+
export type OutlinedTimePickerValue =
|
|
4
|
+
| string
|
|
5
|
+
| number
|
|
6
|
+
| Date
|
|
7
|
+
| Array<string | number | Date>
|
|
8
|
+
| null
|
|
9
|
+
|
|
10
|
+
export interface OutlinedTimePickerProps {
|
|
11
|
+
value?: OutlinedTimePickerValue
|
|
12
|
+
placeholder?: string
|
|
13
|
+
label?: string
|
|
14
|
+
disabled?: boolean
|
|
15
|
+
clearable?: boolean
|
|
16
|
+
isRange?: boolean
|
|
17
|
+
startPlaceholder?: string
|
|
18
|
+
endPlaceholder?: string
|
|
19
|
+
rangeSeparator?: string
|
|
20
|
+
format?: string
|
|
21
|
+
valueFormat?: string
|
|
22
|
+
arrowControl?: boolean
|
|
23
|
+
inputHeight?: number
|
|
24
|
+
isBorder?: boolean
|
|
25
|
+
marginBottom?: OutlinedTimePickerCssValue
|
|
26
|
+
paddingTop?: OutlinedTimePickerCssValue
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface OutlinedTimePickerExpose {
|
|
30
|
+
focus: () => void
|
|
31
|
+
blur: () => void
|
|
32
|
+
handleOpen: () => void
|
|
33
|
+
handleClose: () => void
|
|
34
|
+
clear: () => void
|
|
35
|
+
getPickerRef: () => unknown | null
|
|
36
|
+
}
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="outlined-time-picker"
|
|
4
|
+
:class="[containerClasses, rootClass]"
|
|
5
|
+
:style="[containerStyle, rootStyle]"
|
|
6
|
+
>
|
|
7
|
+
<el-time-picker
|
|
8
|
+
ref="pickerRef"
|
|
9
|
+
v-bind="pickerAttrs"
|
|
10
|
+
class="outlined-time-picker__control"
|
|
11
|
+
:model-value="pickerValue"
|
|
12
|
+
:is-range="isRange"
|
|
13
|
+
:format="format"
|
|
14
|
+
:value-format="resolvedValueFormat"
|
|
15
|
+
:placeholder="placeholder"
|
|
16
|
+
:start-placeholder="startPlaceholder"
|
|
17
|
+
:end-placeholder="endPlaceholder"
|
|
18
|
+
:range-separator="rangeSeparator"
|
|
19
|
+
:disabled="disabled"
|
|
20
|
+
:clearable="clearable"
|
|
21
|
+
:arrow-control="arrowControl"
|
|
22
|
+
:style="pickerStyle"
|
|
23
|
+
@update:model-value="handleModelValueUpdate"
|
|
24
|
+
@focus="handleFocus"
|
|
25
|
+
@blur="handleBlur"
|
|
26
|
+
@change="handleChange"
|
|
27
|
+
@visible-change="handleVisibleChange"
|
|
28
|
+
@clear="handleClear"
|
|
29
|
+
/>
|
|
30
|
+
|
|
31
|
+
<div
|
|
32
|
+
v-if="floatingLabel"
|
|
33
|
+
class="outlined-time-picker__label"
|
|
34
|
+
:class="labelClasses"
|
|
35
|
+
>
|
|
36
|
+
{{ floatingLabel }}
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<script setup lang="ts">
|
|
42
|
+
import { computed, ref, useAttrs, watch } from 'vue'
|
|
43
|
+
import type {
|
|
44
|
+
OutlinedTimePickerCssValue,
|
|
45
|
+
OutlinedTimePickerExpose,
|
|
46
|
+
OutlinedTimePickerProps,
|
|
47
|
+
OutlinedTimePickerValue
|
|
48
|
+
} from './OutlinedTimePicker.types'
|
|
49
|
+
|
|
50
|
+
defineOptions({
|
|
51
|
+
name: 'OutlinedTimePicker',
|
|
52
|
+
inheritAttrs: false
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
const props = withDefaults(defineProps<OutlinedTimePickerProps>(), {
|
|
56
|
+
value: '',
|
|
57
|
+
placeholder: '',
|
|
58
|
+
label: '',
|
|
59
|
+
disabled: false,
|
|
60
|
+
clearable: true,
|
|
61
|
+
isRange: false,
|
|
62
|
+
startPlaceholder: '开始时间',
|
|
63
|
+
endPlaceholder: '结束时间',
|
|
64
|
+
rangeSeparator: '-',
|
|
65
|
+
format: 'HH:mm',
|
|
66
|
+
valueFormat: '',
|
|
67
|
+
arrowControl: false,
|
|
68
|
+
inputHeight: 40,
|
|
69
|
+
isBorder: false,
|
|
70
|
+
marginBottom: 20,
|
|
71
|
+
paddingTop: 20
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
const emit = defineEmits<{
|
|
75
|
+
(event: 'input', value: OutlinedTimePickerValue | ''): void
|
|
76
|
+
(event: 'update:value', value: OutlinedTimePickerValue | ''): void
|
|
77
|
+
(event: 'change', value: OutlinedTimePickerValue | ''): void
|
|
78
|
+
(event: 'focus', value: FocusEvent): void
|
|
79
|
+
(event: 'blur', value: FocusEvent): void
|
|
80
|
+
(event: 'visible-change', value: boolean): void
|
|
81
|
+
(event: 'clear'): void
|
|
82
|
+
}>()
|
|
83
|
+
|
|
84
|
+
const attrs = useAttrs()
|
|
85
|
+
const pickerRef = ref<any>(null)
|
|
86
|
+
const pickerValue = ref<OutlinedTimePickerValue | ''>(normalizeValue(props.value, props.isRange))
|
|
87
|
+
const focused = ref(false)
|
|
88
|
+
const blurred = ref(false)
|
|
89
|
+
const visible = ref(false)
|
|
90
|
+
|
|
91
|
+
watch(
|
|
92
|
+
() => [props.value, props.isRange] as const,
|
|
93
|
+
([value, isRange]) => {
|
|
94
|
+
pickerValue.value = normalizeValue(value, isRange)
|
|
95
|
+
},
|
|
96
|
+
{ immediate: true }
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
const rootClass = computed(() => attrs.class)
|
|
100
|
+
const rootStyle = computed(() => attrs.style)
|
|
101
|
+
const resolvedValueFormat = computed(() => props.valueFormat || props.format)
|
|
102
|
+
|
|
103
|
+
const pickerAttrs = computed(() => {
|
|
104
|
+
const { class: _class, style: _style, ...rest } = attrs
|
|
105
|
+
return rest
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
const containerClasses = computed(() => ({
|
|
109
|
+
'outlined-time-picker--bordered': props.isBorder
|
|
110
|
+
}))
|
|
111
|
+
|
|
112
|
+
const containerStyle = computed(() => ({
|
|
113
|
+
marginBottom: toCssValue(props.marginBottom),
|
|
114
|
+
paddingTop: toCssValue(props.paddingTop)
|
|
115
|
+
}))
|
|
116
|
+
|
|
117
|
+
const pickerStyle = computed(() => ({
|
|
118
|
+
height: `${props.inputHeight}px`
|
|
119
|
+
}))
|
|
120
|
+
|
|
121
|
+
const floatingLabel = computed(() => props.label || props.placeholder || '')
|
|
122
|
+
|
|
123
|
+
const hasContent = computed(() => {
|
|
124
|
+
if (Array.isArray(pickerValue.value)) {
|
|
125
|
+
return pickerValue.value.length > 0
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return hasFilledValue(pickerValue.value)
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
const labelClasses = computed(() => ({
|
|
132
|
+
'outlined-time-picker__label--floating': focused.value || hasContent.value,
|
|
133
|
+
'outlined-time-picker__label--placeholder': !focused.value && !hasContent.value,
|
|
134
|
+
'outlined-time-picker__label--filled': hasContent.value && !focused.value
|
|
135
|
+
}))
|
|
136
|
+
|
|
137
|
+
function handleModelValueUpdate(value: OutlinedTimePickerValue) {
|
|
138
|
+
const normalizedValue = normalizeValue(value, props.isRange)
|
|
139
|
+
pickerValue.value = normalizedValue
|
|
140
|
+
emitModelValue(normalizedValue)
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function handleChange(value: OutlinedTimePickerValue) {
|
|
144
|
+
const normalizedValue = normalizeValue(value, props.isRange)
|
|
145
|
+
pickerValue.value = normalizedValue
|
|
146
|
+
emit('change', normalizedValue)
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function handleFocus(event: FocusEvent) {
|
|
150
|
+
blurred.value = false
|
|
151
|
+
focused.value = true
|
|
152
|
+
emit('focus', event)
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function handleBlur(event: FocusEvent) {
|
|
156
|
+
blurred.value = true
|
|
157
|
+
|
|
158
|
+
if (!visible.value) {
|
|
159
|
+
focused.value = false
|
|
160
|
+
emitModelValue(pickerValue.value)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
emit('blur', event)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function handleVisibleChange(nextVisible: boolean) {
|
|
167
|
+
visible.value = nextVisible
|
|
168
|
+
|
|
169
|
+
if (!nextVisible && blurred.value) {
|
|
170
|
+
focused.value = false
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
emit('visible-change', nextVisible)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function handleClear() {
|
|
177
|
+
emit('clear')
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function emitModelValue(value: OutlinedTimePickerValue | '') {
|
|
181
|
+
emit('input', value)
|
|
182
|
+
emit('update:value', value)
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function normalizeValue(value: OutlinedTimePickerValue | undefined, isRange: boolean) {
|
|
186
|
+
if (isRange) {
|
|
187
|
+
if (Array.isArray(value)) {
|
|
188
|
+
return value
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (value === undefined || value === null || value === '') {
|
|
192
|
+
return []
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return [value]
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return value ?? ''
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function hasFilledValue(value: unknown) {
|
|
202
|
+
return value !== undefined && value !== null && String(value) !== ''
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function toCssValue(value: OutlinedTimePickerCssValue | undefined) {
|
|
206
|
+
if (typeof value === 'number') {
|
|
207
|
+
return `${value}px`
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return value
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
defineExpose<OutlinedTimePickerExpose>({
|
|
214
|
+
focus: () => {
|
|
215
|
+
pickerRef.value?.focus?.()
|
|
216
|
+
},
|
|
217
|
+
blur: () => {
|
|
218
|
+
pickerRef.value?.blur?.()
|
|
219
|
+
},
|
|
220
|
+
handleOpen: () => {
|
|
221
|
+
pickerRef.value?.handleOpen?.()
|
|
222
|
+
},
|
|
223
|
+
handleClose: () => {
|
|
224
|
+
pickerRef.value?.handleClose?.()
|
|
225
|
+
},
|
|
226
|
+
clear: () => {
|
|
227
|
+
const emptyValue = props.isRange ? [] : ''
|
|
228
|
+
pickerValue.value = emptyValue
|
|
229
|
+
emitModelValue(emptyValue)
|
|
230
|
+
emit('change', emptyValue)
|
|
231
|
+
emit('clear')
|
|
232
|
+
},
|
|
233
|
+
getPickerRef: () => pickerRef.value
|
|
234
|
+
})
|
|
235
|
+
</script>
|
|
236
|
+
|
|
237
|
+
<style scoped>
|
|
238
|
+
.outlined-time-picker {
|
|
239
|
+
position: relative;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.outlined-time-picker__label {
|
|
243
|
+
position: absolute;
|
|
244
|
+
left: -2px;
|
|
245
|
+
padding: 2px 5px;
|
|
246
|
+
border-radius: 2px;
|
|
247
|
+
background-color: #ffffff;
|
|
248
|
+
font-size: 12px;
|
|
249
|
+
line-height: 1;
|
|
250
|
+
transition: color 200ms cubic-bezier(0, 0, 0.2, 1), transform 200ms cubic-bezier(0, 0, 0.2, 1);
|
|
251
|
+
pointer-events: none;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.outlined-time-picker__label--floating {
|
|
255
|
+
top: 18px;
|
|
256
|
+
z-index: 1;
|
|
257
|
+
opacity: 1;
|
|
258
|
+
transform: translate(14px, -6px) scale(1);
|
|
259
|
+
color: var(--el-color-primary);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.outlined-time-picker__label--placeholder {
|
|
263
|
+
top: 50%;
|
|
264
|
+
left: 1px;
|
|
265
|
+
z-index: -1;
|
|
266
|
+
opacity: 0;
|
|
267
|
+
transform: translate(14px, 6px) scale(1);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
.outlined-time-picker__label--filled {
|
|
271
|
+
color: var(--el-text-color-regular);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
:deep(.outlined-time-picker__control.el-date-editor) {
|
|
275
|
+
width: 100%;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
:deep(.outlined-time-picker__control .el-input__wrapper) {
|
|
279
|
+
position: relative;
|
|
280
|
+
min-height: inherit;
|
|
281
|
+
height: inherit;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
:deep(.outlined-time-picker__control .el-input__prefix) {
|
|
285
|
+
position: absolute;
|
|
286
|
+
right: 0;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
:deep(.outlined-time-picker__control .el-input__suffix) {
|
|
290
|
+
position: absolute;
|
|
291
|
+
right: 30px;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
:deep(.outlined-time-picker--bordered .el-input__wrapper) {
|
|
295
|
+
box-shadow: none;
|
|
296
|
+
border-radius: 0;
|
|
297
|
+
border-bottom: 1px solid #cccccc;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
:deep(.outlined-time-picker--bordered .el-input__wrapper.is-focus) {
|
|
301
|
+
border-bottom-color: var(--el-color-primary);
|
|
302
|
+
}
|
|
303
|
+
</style>
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { OutlinedTimePickerCssValue, OutlinedTimePickerProps, OutlinedTimePickerValue } from './OutlinedTimePicker.types';
|
|
2
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<OutlinedTimePickerProps>, {
|
|
3
|
+
value: string;
|
|
4
|
+
placeholder: string;
|
|
5
|
+
label: string;
|
|
6
|
+
disabled: boolean;
|
|
7
|
+
clearable: boolean;
|
|
8
|
+
isRange: boolean;
|
|
9
|
+
startPlaceholder: string;
|
|
10
|
+
endPlaceholder: string;
|
|
11
|
+
rangeSeparator: string;
|
|
12
|
+
format: string;
|
|
13
|
+
valueFormat: string;
|
|
14
|
+
arrowControl: boolean;
|
|
15
|
+
inputHeight: number;
|
|
16
|
+
isBorder: boolean;
|
|
17
|
+
marginBottom: number;
|
|
18
|
+
paddingTop: number;
|
|
19
|
+
}>>, {
|
|
20
|
+
focus: () => void;
|
|
21
|
+
blur: () => void;
|
|
22
|
+
handleOpen: () => void;
|
|
23
|
+
handleClose: () => void;
|
|
24
|
+
clear: () => void;
|
|
25
|
+
getPickerRef: () => unknown;
|
|
26
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
27
|
+
input: (value: OutlinedTimePickerValue) => void;
|
|
28
|
+
"update:value": (value: OutlinedTimePickerValue) => void;
|
|
29
|
+
change: (value: OutlinedTimePickerValue) => void;
|
|
30
|
+
focus: (value: FocusEvent) => void;
|
|
31
|
+
blur: (value: FocusEvent) => void;
|
|
32
|
+
"visible-change": (value: boolean) => void;
|
|
33
|
+
clear: () => void;
|
|
34
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<OutlinedTimePickerProps>, {
|
|
35
|
+
value: string;
|
|
36
|
+
placeholder: string;
|
|
37
|
+
label: string;
|
|
38
|
+
disabled: boolean;
|
|
39
|
+
clearable: boolean;
|
|
40
|
+
isRange: boolean;
|
|
41
|
+
startPlaceholder: string;
|
|
42
|
+
endPlaceholder: string;
|
|
43
|
+
rangeSeparator: string;
|
|
44
|
+
format: string;
|
|
45
|
+
valueFormat: string;
|
|
46
|
+
arrowControl: boolean;
|
|
47
|
+
inputHeight: number;
|
|
48
|
+
isBorder: boolean;
|
|
49
|
+
marginBottom: number;
|
|
50
|
+
paddingTop: number;
|
|
51
|
+
}>>> & Readonly<{
|
|
52
|
+
onBlur?: ((value: FocusEvent) => any) | undefined;
|
|
53
|
+
onChange?: ((value: OutlinedTimePickerValue) => any) | undefined;
|
|
54
|
+
onFocus?: ((value: FocusEvent) => any) | undefined;
|
|
55
|
+
onInput?: ((value: OutlinedTimePickerValue) => any) | undefined;
|
|
56
|
+
onClear?: (() => any) | undefined;
|
|
57
|
+
"onUpdate:value"?: ((value: OutlinedTimePickerValue) => any) | undefined;
|
|
58
|
+
"onVisible-change"?: ((value: boolean) => any) | undefined;
|
|
59
|
+
}>, {
|
|
60
|
+
label: string;
|
|
61
|
+
disabled: boolean;
|
|
62
|
+
value: OutlinedTimePickerValue;
|
|
63
|
+
placeholder: string;
|
|
64
|
+
clearable: boolean;
|
|
65
|
+
inputHeight: number;
|
|
66
|
+
isBorder: boolean;
|
|
67
|
+
marginBottom: OutlinedTimePickerCssValue;
|
|
68
|
+
paddingTop: OutlinedTimePickerCssValue;
|
|
69
|
+
format: string;
|
|
70
|
+
valueFormat: string;
|
|
71
|
+
isRange: boolean;
|
|
72
|
+
startPlaceholder: string;
|
|
73
|
+
endPlaceholder: string;
|
|
74
|
+
rangeSeparator: string;
|
|
75
|
+
arrowControl: boolean;
|
|
76
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
77
|
+
export default _default;
|
|
78
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
79
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
80
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
81
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
82
|
+
} : {
|
|
83
|
+
type: import('vue').PropType<T[K]>;
|
|
84
|
+
required: true;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
type __VLS_WithDefaults<P, D> = {
|
|
88
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
89
|
+
default: D[K];
|
|
90
|
+
}> : P[K];
|
|
91
|
+
};
|
|
92
|
+
type __VLS_Prettify<T> = {
|
|
93
|
+
[K in keyof T]: T[K];
|
|
94
|
+
} & {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# OutlinedTimePicker
|
|
2
|
+
|
|
3
|
+
`OutlinedTimePicker` 是 `OutlinedForm` 系列里的时间选择控件,用来统一封装浮动标签、时间范围输入、下边框风格和实例方法暴露。
|
|
4
|
+
|
|
5
|
+
## 适用场景
|
|
6
|
+
|
|
7
|
+
- 页面里需要选择单个时间点,比如“开始时间”
|
|
8
|
+
- 页面里需要选择时间范围,比如“开始时间 - 结束时间”
|
|
9
|
+
- 需要统一时间控件的浮动标签样式
|
|
10
|
+
- 需要在页面层直接打开、关闭或清空时间选择面板
|
|
11
|
+
|
|
12
|
+
## 基本用法
|
|
13
|
+
|
|
14
|
+
```vue
|
|
15
|
+
<script setup lang="ts">
|
|
16
|
+
import { ref } from 'vue'
|
|
17
|
+
import { OutlinedTimePicker, type OutlinedTimePickerExpose } from '@hbdlzy/ui'
|
|
18
|
+
|
|
19
|
+
const pickerRef = ref<OutlinedTimePickerExpose | null>(null)
|
|
20
|
+
const startTime = ref('')
|
|
21
|
+
const periodRange = ref<string[]>([])
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<template>
|
|
25
|
+
<OutlinedTimePicker
|
|
26
|
+
ref="pickerRef"
|
|
27
|
+
v-model:value="startTime"
|
|
28
|
+
placeholder="开始时间"
|
|
29
|
+
:is-border="true"
|
|
30
|
+
clearable
|
|
31
|
+
/>
|
|
32
|
+
|
|
33
|
+
<OutlinedTimePicker
|
|
34
|
+
v-model:value="periodRange"
|
|
35
|
+
label="执行时段"
|
|
36
|
+
:is-range="true"
|
|
37
|
+
start-placeholder="开始时间"
|
|
38
|
+
end-placeholder="结束时间"
|
|
39
|
+
:is-border="true"
|
|
40
|
+
clearable
|
|
41
|
+
/>
|
|
42
|
+
</template>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Props
|
|
46
|
+
|
|
47
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
48
|
+
| --- | --- | --- | --- |
|
|
49
|
+
| `value` | `string \| number \| Date \| Array<string \| number \| Date> \| null` | `''` | `v-model:value` 绑定值 |
|
|
50
|
+
| `placeholder` | `string` | `''` | 单值模式占位文案,也会作为浮动标签文案 |
|
|
51
|
+
| `label` | `string` | `''` | 自定义浮动标签文案,优先级高于 `placeholder` |
|
|
52
|
+
| `disabled` | `boolean` | `false` | 是否禁用 |
|
|
53
|
+
| `clearable` | `boolean` | `true` | 是否允许清空 |
|
|
54
|
+
| `isRange` | `boolean` | `false` | 是否启用时间范围模式 |
|
|
55
|
+
| `startPlaceholder` | `string` | `'开始时间'` | 范围模式开始占位文案 |
|
|
56
|
+
| `endPlaceholder` | `string` | `'结束时间'` | 范围模式结束占位文案 |
|
|
57
|
+
| `rangeSeparator` | `string` | `'-'` | 范围模式中间分隔符 |
|
|
58
|
+
| `format` | `string` | `'HH:mm'` | 展示格式 |
|
|
59
|
+
| `valueFormat` | `string` | `format` | 提交值格式 |
|
|
60
|
+
| `arrowControl` | `boolean` | `false` | 是否使用箭头切换时间 |
|
|
61
|
+
| `inputHeight` | `number` | `40` | 输入框高度 |
|
|
62
|
+
| `isBorder` | `boolean` | `false` | 是否启用下边框风格 |
|
|
63
|
+
| `marginBottom` | `string \| number` | `20` | 外层下边距 |
|
|
64
|
+
| `paddingTop` | `string \| number` | `20` | 外层上内边距,用于浮动标签留白 |
|
|
65
|
+
|
|
66
|
+
## Emits
|
|
67
|
+
|
|
68
|
+
| 事件 | 参数 | 说明 |
|
|
69
|
+
| --- | --- | --- |
|
|
70
|
+
| `input` | `OutlinedTimePickerValue \| ''` | 输入值变化时触发 |
|
|
71
|
+
| `update:value` | `OutlinedTimePickerValue \| ''` | `v-model:value` 同步事件 |
|
|
72
|
+
| `change` | `OutlinedTimePickerValue \| ''` | 选项确认变化时触发 |
|
|
73
|
+
| `focus` | `FocusEvent` | 聚焦时触发 |
|
|
74
|
+
| `blur` | `FocusEvent` | 失焦时触发 |
|
|
75
|
+
| `visible-change` | `boolean` | 面板显隐变化时触发 |
|
|
76
|
+
| `clear` | 无 | 清空时触发 |
|
|
77
|
+
|
|
78
|
+
## Expose
|
|
79
|
+
|
|
80
|
+
| 方法 | 说明 |
|
|
81
|
+
| --- | --- |
|
|
82
|
+
| `focus()` | 聚焦时间控件 |
|
|
83
|
+
| `blur()` | 取消聚焦 |
|
|
84
|
+
| `handleOpen()` | 打开时间面板 |
|
|
85
|
+
| `handleClose()` | 关闭时间面板 |
|
|
86
|
+
| `clear()` | 清空当前值 |
|
|
87
|
+
| `getPickerRef()` | 获取内部 `el-time-picker` 实例 |
|
|
88
|
+
|
|
89
|
+
## 设计约束
|
|
90
|
+
|
|
91
|
+
- 组件只负责通用时间选择壳子,不直接耦合业务时段规则、起止合法性判断或接口结构
|
|
92
|
+
- 更复杂的业务约束,比如“结束时间必须晚于开始时间”,应由页面层或业务组件负责
|
|
93
|
+
- 如果后续某个业务强依赖固定时段模板,建议在业务包里再封一层,不要反向污染 `ui-core`
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import OutlinedTimePicker from './OutlinedTimePicker.vue'
|
|
2
|
+
|
|
3
|
+
export default OutlinedTimePicker
|
|
4
|
+
|
|
5
|
+
export type {
|
|
6
|
+
OutlinedTimePickerCssValue,
|
|
7
|
+
OutlinedTimePickerExpose,
|
|
8
|
+
OutlinedTimePickerProps,
|
|
9
|
+
OutlinedTimePickerValue
|
|
10
|
+
} from './OutlinedTimePicker.types'
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export type OutlinedTreeSelectCssValue = string | number;
|
|
2
|
+
export type OutlinedTreeSelectOptionValue = string | number | boolean | Record<string, unknown> | null;
|
|
3
|
+
export type OutlinedTreeSelectValue = OutlinedTreeSelectOptionValue | OutlinedTreeSelectOptionValue[];
|
|
4
|
+
export interface OutlinedTreeSelectNode {
|
|
5
|
+
label?: string;
|
|
6
|
+
value?: OutlinedTreeSelectOptionValue;
|
|
7
|
+
children?: OutlinedTreeSelectNode[];
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
[key: string]: unknown;
|
|
10
|
+
}
|
|
11
|
+
export interface OutlinedTreeSelectProps {
|
|
12
|
+
value?: OutlinedTreeSelectValue;
|
|
13
|
+
data?: OutlinedTreeSelectNode[];
|
|
14
|
+
propsValue?: Record<string, unknown>;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
label?: string;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
clearable?: boolean;
|
|
19
|
+
filterable?: boolean;
|
|
20
|
+
multiple?: boolean;
|
|
21
|
+
showCheckbox?: boolean;
|
|
22
|
+
checkStrictly?: boolean;
|
|
23
|
+
checkOnClickNode?: boolean;
|
|
24
|
+
defaultExpandAll?: boolean;
|
|
25
|
+
expandOnClickNode?: boolean;
|
|
26
|
+
renderAfterExpand?: boolean;
|
|
27
|
+
collapseTags?: boolean;
|
|
28
|
+
collapseTagsTooltip?: boolean;
|
|
29
|
+
maxCollapseTags?: number;
|
|
30
|
+
popperClass?: string;
|
|
31
|
+
nodeKey?: string;
|
|
32
|
+
keyValue?: string;
|
|
33
|
+
labelValue?: string;
|
|
34
|
+
childrenValue?: string;
|
|
35
|
+
disabledValue?: string;
|
|
36
|
+
inputHeight?: number;
|
|
37
|
+
isBorder?: boolean;
|
|
38
|
+
marginBottom?: OutlinedTreeSelectCssValue;
|
|
39
|
+
paddingTop?: OutlinedTreeSelectCssValue;
|
|
40
|
+
}
|
|
41
|
+
export interface OutlinedTreeSelectExpose {
|
|
42
|
+
focus: () => void;
|
|
43
|
+
blur: () => void;
|
|
44
|
+
clear: () => void;
|
|
45
|
+
getTreeSelectRef: () => unknown | null;
|
|
46
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export type OutlinedTreeSelectCssValue = string | number
|
|
2
|
+
|
|
3
|
+
export type OutlinedTreeSelectOptionValue =
|
|
4
|
+
| string
|
|
5
|
+
| number
|
|
6
|
+
| boolean
|
|
7
|
+
| Record<string, unknown>
|
|
8
|
+
| null
|
|
9
|
+
|
|
10
|
+
export type OutlinedTreeSelectValue = OutlinedTreeSelectOptionValue | OutlinedTreeSelectOptionValue[]
|
|
11
|
+
|
|
12
|
+
export interface OutlinedTreeSelectNode {
|
|
13
|
+
label?: string
|
|
14
|
+
value?: OutlinedTreeSelectOptionValue
|
|
15
|
+
children?: OutlinedTreeSelectNode[]
|
|
16
|
+
disabled?: boolean
|
|
17
|
+
[key: string]: unknown
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface OutlinedTreeSelectProps {
|
|
21
|
+
value?: OutlinedTreeSelectValue
|
|
22
|
+
data?: OutlinedTreeSelectNode[]
|
|
23
|
+
propsValue?: Record<string, unknown>
|
|
24
|
+
placeholder?: string
|
|
25
|
+
label?: string
|
|
26
|
+
disabled?: boolean
|
|
27
|
+
clearable?: boolean
|
|
28
|
+
filterable?: boolean
|
|
29
|
+
multiple?: boolean
|
|
30
|
+
showCheckbox?: boolean
|
|
31
|
+
checkStrictly?: boolean
|
|
32
|
+
checkOnClickNode?: boolean
|
|
33
|
+
defaultExpandAll?: boolean
|
|
34
|
+
expandOnClickNode?: boolean
|
|
35
|
+
renderAfterExpand?: boolean
|
|
36
|
+
collapseTags?: boolean
|
|
37
|
+
collapseTagsTooltip?: boolean
|
|
38
|
+
maxCollapseTags?: number
|
|
39
|
+
popperClass?: string
|
|
40
|
+
nodeKey?: string
|
|
41
|
+
keyValue?: string
|
|
42
|
+
labelValue?: string
|
|
43
|
+
childrenValue?: string
|
|
44
|
+
disabledValue?: string
|
|
45
|
+
inputHeight?: number
|
|
46
|
+
isBorder?: boolean
|
|
47
|
+
marginBottom?: OutlinedTreeSelectCssValue
|
|
48
|
+
paddingTop?: OutlinedTreeSelectCssValue
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface OutlinedTreeSelectExpose {
|
|
52
|
+
focus: () => void
|
|
53
|
+
blur: () => void
|
|
54
|
+
clear: () => void
|
|
55
|
+
getTreeSelectRef: () => unknown | null
|
|
56
|
+
}
|