@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.
Files changed (113) hide show
  1. package/README.md +37 -2
  2. package/components.manifest.json +198 -161
  3. package/dist/components/BaseCard/BaseCard.types.d.ts +36 -0
  4. package/dist/components/BaseCard/BaseCard.vue.d.ts +122 -0
  5. package/dist/components/BaseCard/index.d.ts +3 -0
  6. package/dist/components/BaseEChart/BaseEChart.types.d.ts +26 -0
  7. package/dist/components/BaseEChart/BaseEChart.vue.d.ts +66 -0
  8. package/dist/components/BaseEChart/index.d.ts +3 -0
  9. package/dist/components/BaseExportButton/BaseExportButton.types.d.ts +21 -0
  10. package/dist/components/BaseExportButton/BaseExportButton.utils.d.ts +4 -0
  11. package/dist/components/BaseExportButton/BaseExportButton.vue.d.ts +128 -0
  12. package/dist/components/BaseExportButton/index.d.ts +5 -0
  13. package/dist/components/BaseTable/BaseTable.types.d.ts +163 -0
  14. package/dist/components/BaseTable/BaseTable.vue.d.ts +157 -0
  15. package/dist/components/BaseTable/index.d.ts +3 -0
  16. package/dist/components/OutlinedCascader/OutlinedCascader.types.d.ts +25 -0
  17. package/dist/components/OutlinedCascader/OutlinedCascader.vue.d.ts +85 -0
  18. package/dist/components/OutlinedCascader/index.d.ts +3 -0
  19. package/dist/components/OutlinedDatePicker/OutlinedDatePicker.types.d.ts +27 -0
  20. package/dist/components/OutlinedDatePicker/OutlinedDatePicker.vue.d.ts +88 -0
  21. package/dist/components/OutlinedDatePicker/index.d.ts +3 -0
  22. package/dist/components/OutlinedDateTimePicker/OutlinedDateTimePicker.types.d.ts +26 -0
  23. package/dist/components/OutlinedDateTimePicker/OutlinedDateTimePicker.vue.d.ts +97 -0
  24. package/dist/components/OutlinedDateTimePicker/index.d.ts +3 -0
  25. package/dist/components/OutlinedInput/OutlinedInput.types.d.ts +29 -0
  26. package/dist/components/OutlinedInput/OutlinedInput.vue.d.ts +97 -0
  27. package/dist/components/OutlinedInput/index.d.ts +3 -0
  28. package/dist/components/OutlinedSelect/OutlinedSelect.types.d.ts +38 -0
  29. package/dist/components/OutlinedSelect/OutlinedSelect.vue.d.ts +116 -0
  30. package/dist/components/OutlinedSelect/index.d.ts +3 -0
  31. package/dist/components/OutlinedTimePicker/OutlinedTimePicker.types.d.ts +28 -0
  32. package/dist/components/OutlinedTimePicker/OutlinedTimePicker.vue.d.ts +94 -0
  33. package/dist/components/OutlinedTimePicker/index.d.ts +3 -0
  34. package/dist/components/OutlinedTreeSelect/OutlinedTreeSelect.types.d.ts +46 -0
  35. package/dist/components/OutlinedTreeSelect/OutlinedTreeSelect.vue.d.ts +137 -0
  36. package/dist/components/OutlinedTreeSelect/index.d.ts +3 -0
  37. package/dist/echarts/index.d.ts +9 -0
  38. package/dist/excel/exportExcel.d.ts +18 -0
  39. package/dist/index.cjs +1 -1
  40. package/dist/index.d.ts +26 -0
  41. package/dist/index.js +2181 -41
  42. package/dist/style.css +1 -1
  43. package/package.json +6 -4
  44. package/src/components/BaseCard/BaseCard.types.d.ts +36 -0
  45. package/src/components/BaseCard/BaseCard.vue.d.ts +122 -0
  46. package/src/components/BaseCard/index.d.ts +3 -0
  47. package/src/components/BaseEChart/BaseEChart.types.d.ts +26 -0
  48. package/src/components/BaseEChart/BaseEChart.vue.d.ts +66 -0
  49. package/src/components/BaseEChart/index.d.ts +3 -0
  50. package/src/components/BaseExportButton/BaseExportButton.types.d.ts +21 -0
  51. package/src/components/BaseExportButton/BaseExportButton.utils.d.ts +4 -0
  52. package/src/components/BaseExportButton/BaseExportButton.vue.d.ts +128 -0
  53. package/src/components/BaseExportButton/index.d.ts +5 -0
  54. package/src/components/BaseTable/BaseTable.types.d.ts +163 -0
  55. package/src/components/BaseTable/BaseTable.types.ts +12 -0
  56. package/src/components/BaseTable/BaseTable.vue +412 -13
  57. package/src/components/BaseTable/BaseTable.vue.d.ts +157 -0
  58. package/src/components/BaseTable/README.md +106 -120
  59. package/src/components/BaseTable/index.d.ts +3 -0
  60. package/src/components/OutlinedCascader/OutlinedCascader.types.d.ts +25 -0
  61. package/src/components/OutlinedCascader/OutlinedCascader.types.ts +28 -0
  62. package/src/components/OutlinedCascader/OutlinedCascader.vue +250 -0
  63. package/src/components/OutlinedCascader/OutlinedCascader.vue.d.ts +85 -0
  64. package/src/components/OutlinedCascader/README.md +91 -0
  65. package/src/components/OutlinedCascader/index.d.ts +3 -0
  66. package/src/components/OutlinedCascader/index.ts +10 -0
  67. package/src/components/OutlinedDatePicker/OutlinedDatePicker.types.d.ts +27 -0
  68. package/src/components/OutlinedDatePicker/OutlinedDatePicker.types.ts +40 -0
  69. package/src/components/OutlinedDatePicker/OutlinedDatePicker.vue +365 -0
  70. package/src/components/OutlinedDatePicker/OutlinedDatePicker.vue.d.ts +88 -0
  71. package/src/components/OutlinedDatePicker/README.md +137 -0
  72. package/src/components/OutlinedDatePicker/index.d.ts +3 -0
  73. package/src/components/OutlinedDatePicker/index.ts +11 -0
  74. package/src/components/OutlinedDateTimePicker/OutlinedDateTimePicker.types.d.ts +26 -0
  75. package/src/components/OutlinedDateTimePicker/OutlinedDateTimePicker.types.ts +34 -0
  76. package/src/components/OutlinedDateTimePicker/OutlinedDateTimePicker.vue +421 -0
  77. package/src/components/OutlinedDateTimePicker/OutlinedDateTimePicker.vue.d.ts +97 -0
  78. package/src/components/OutlinedDateTimePicker/README.md +88 -0
  79. package/src/components/OutlinedDateTimePicker/index.d.ts +3 -0
  80. package/src/components/OutlinedDateTimePicker/index.ts +11 -0
  81. package/src/components/OutlinedInput/OutlinedInput.types.d.ts +29 -0
  82. package/src/components/OutlinedInput/OutlinedInput.types.ts +32 -0
  83. package/src/components/OutlinedInput/OutlinedInput.vue +307 -0
  84. package/src/components/OutlinedInput/OutlinedInput.vue.d.ts +97 -0
  85. package/src/components/OutlinedInput/README.md +154 -0
  86. package/src/components/OutlinedInput/index.d.ts +3 -0
  87. package/src/components/OutlinedInput/index.ts +10 -0
  88. package/src/components/OutlinedSelect/OutlinedSelect.types.d.ts +38 -0
  89. package/src/components/OutlinedSelect/OutlinedSelect.types.ts +48 -0
  90. package/src/components/OutlinedSelect/OutlinedSelect.vue +359 -0
  91. package/src/components/OutlinedSelect/OutlinedSelect.vue.d.ts +116 -0
  92. package/src/components/OutlinedSelect/README.md +166 -0
  93. package/src/components/OutlinedSelect/index.d.ts +3 -0
  94. package/src/components/OutlinedSelect/index.ts +12 -0
  95. package/src/components/OutlinedTimePicker/OutlinedTimePicker.types.d.ts +28 -0
  96. package/src/components/OutlinedTimePicker/OutlinedTimePicker.types.ts +36 -0
  97. package/src/components/OutlinedTimePicker/OutlinedTimePicker.vue +303 -0
  98. package/src/components/OutlinedTimePicker/OutlinedTimePicker.vue.d.ts +94 -0
  99. package/src/components/OutlinedTimePicker/README.md +93 -0
  100. package/src/components/OutlinedTimePicker/index.d.ts +3 -0
  101. package/src/components/OutlinedTimePicker/index.ts +10 -0
  102. package/src/components/OutlinedTreeSelect/OutlinedTreeSelect.types.d.ts +46 -0
  103. package/src/components/OutlinedTreeSelect/OutlinedTreeSelect.types.ts +56 -0
  104. package/src/components/OutlinedTreeSelect/OutlinedTreeSelect.vue +354 -0
  105. package/src/components/OutlinedTreeSelect/OutlinedTreeSelect.vue.d.ts +137 -0
  106. package/src/components/OutlinedTreeSelect/README.md +107 -0
  107. package/src/components/OutlinedTreeSelect/index.d.ts +3 -0
  108. package/src/components/OutlinedTreeSelect/index.ts +12 -0
  109. package/src/echarts/index.d.ts +9 -0
  110. package/src/echarts/index.ts +13 -8
  111. package/src/excel/exportExcel.d.ts +18 -0
  112. package/src/index.d.ts +26 -0
  113. package/src/index.ts +14 -0
@@ -0,0 +1,85 @@
1
+ import type { OutlinedCascaderCssValue, OutlinedCascaderProps, OutlinedCascaderValue } from './OutlinedCascader.types';
2
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<OutlinedCascaderProps>, {
3
+ value: () => never[];
4
+ options: () => never[];
5
+ clearable: boolean;
6
+ propsValue: undefined;
7
+ placeholder: string;
8
+ label: string;
9
+ popperClass: string;
10
+ disabled: boolean;
11
+ inputHeight: number;
12
+ isBorder: boolean;
13
+ filterable: boolean;
14
+ levels: boolean;
15
+ marginBottom: number;
16
+ paddingTop: number;
17
+ }>>, {
18
+ focus: () => void;
19
+ blur: () => void;
20
+ togglePopperVisible: () => void;
21
+ clear: () => void;
22
+ getCascaderRef: () => unknown;
23
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
24
+ input: (value: OutlinedCascaderValue) => void;
25
+ "update:value": (value: OutlinedCascaderValue) => void;
26
+ change: (value: OutlinedCascaderValue) => void;
27
+ focus: (value: FocusEvent) => void;
28
+ blur: (value: FocusEvent) => void;
29
+ "visible-change": (value: boolean) => void;
30
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<OutlinedCascaderProps>, {
31
+ value: () => never[];
32
+ options: () => never[];
33
+ clearable: boolean;
34
+ propsValue: undefined;
35
+ placeholder: string;
36
+ label: string;
37
+ popperClass: string;
38
+ disabled: boolean;
39
+ inputHeight: number;
40
+ isBorder: boolean;
41
+ filterable: boolean;
42
+ levels: boolean;
43
+ marginBottom: number;
44
+ paddingTop: number;
45
+ }>>> & Readonly<{
46
+ onBlur?: ((value: FocusEvent) => any) | undefined;
47
+ onChange?: ((value: OutlinedCascaderValue) => any) | undefined;
48
+ onFocus?: ((value: FocusEvent) => any) | undefined;
49
+ onInput?: ((value: OutlinedCascaderValue) => any) | undefined;
50
+ "onUpdate:value"?: ((value: OutlinedCascaderValue) => any) | undefined;
51
+ "onVisible-change"?: ((value: boolean) => any) | undefined;
52
+ }>, {
53
+ label: string;
54
+ disabled: boolean;
55
+ popperClass: string;
56
+ value: OutlinedCascaderValue;
57
+ placeholder: string;
58
+ clearable: boolean;
59
+ options: Record<string, unknown>[];
60
+ inputHeight: number;
61
+ isBorder: boolean;
62
+ marginBottom: OutlinedCascaderCssValue;
63
+ paddingTop: OutlinedCascaderCssValue;
64
+ filterable: boolean;
65
+ propsValue: Record<string, unknown>;
66
+ levels: boolean;
67
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
68
+ export default _default;
69
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
70
+ type __VLS_TypePropsToRuntimeProps<T> = {
71
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
72
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
73
+ } : {
74
+ type: import('vue').PropType<T[K]>;
75
+ required: true;
76
+ };
77
+ };
78
+ type __VLS_WithDefaults<P, D> = {
79
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
80
+ default: D[K];
81
+ }> : P[K];
82
+ };
83
+ type __VLS_Prettify<T> = {
84
+ [K in keyof T]: T[K];
85
+ } & {};
@@ -0,0 +1,91 @@
1
+ # OutlinedCascader
2
+
3
+ `OutlinedCascader` 是 `OutlinedForm` 系列里的级联选择控件,用来统一封装浮动标签、边框风格、级联面板显隐和实例方法暴露。
4
+
5
+ ## 适用场景
6
+
7
+ - 页面里经常出现区域、组织、站点树这类级联选择
8
+ - 需要统一 `el-cascader` 的浮动标签样式
9
+ - 需要在页面层直接打开或关闭级联面板
10
+ - 需要统一 `props` 映射、`clearable`、`filterable` 等高频配置
11
+
12
+ ## 基本用法
13
+
14
+ ```vue
15
+ <script setup lang="ts">
16
+ import { ref } from 'vue'
17
+ import { OutlinedCascader, type OutlinedCascaderExpose } from '@hbdlzy/ui'
18
+
19
+ const cascaderRef = ref<OutlinedCascaderExpose | null>(null)
20
+ const areaPath = ref<Array<string | number>>([])
21
+
22
+ const areaOptions = [
23
+ {
24
+ label: '华北',
25
+ value: 'north',
26
+ children: [
27
+ { label: '北京', value: 'beijing' },
28
+ { label: '天津', value: 'tianjin' }
29
+ ]
30
+ }
31
+ ]
32
+ </script>
33
+
34
+ <template>
35
+ <OutlinedCascader
36
+ ref="cascaderRef"
37
+ v-model:value="areaPath"
38
+ placeholder="所属区域"
39
+ :options="areaOptions"
40
+ :is-border="true"
41
+ clearable
42
+ filterable
43
+ />
44
+ </template>
45
+ ```
46
+
47
+ ## Props
48
+
49
+ | 属性 | 类型 | 默认值 | 说明 |
50
+ | --- | --- | --- | --- |
51
+ | `value` | `Array<string \| number>` | `[]` | `v-model:value` 绑定值 |
52
+ | `options` | `Record<string, unknown>[]` | `[]` | 级联选项数据 |
53
+ | `clearable` | `boolean` | `false` | 是否允许清空 |
54
+ | `propsValue` | `Record<string, unknown>` | `undefined` | 透传给 `el-cascader` 的 `props` |
55
+ | `placeholder` | `string` | `''` | 占位文案,也会作为浮动标签文案 |
56
+ | `label` | `string` | `''` | 自定义浮动标签文案,优先级高于 `placeholder` |
57
+ | `popperClass` | `string` | `''` | 自定义弹层类名 |
58
+ | `disabled` | `boolean` | `false` | 是否禁用 |
59
+ | `inputHeight` | `number` | `40` | 输入框高度 |
60
+ | `isBorder` | `boolean` | `false` | 是否启用下边框风格 |
61
+ | `filterable` | `boolean` | `true` | 是否允许搜索 |
62
+ | `levels` | `boolean` | `true` | 是否展示完整级联路径 |
63
+ | `marginBottom` | `string \| number` | `20` | 外层下边距 |
64
+ | `paddingTop` | `string \| number` | `20` | 外层上内边距,用于浮动标签留白 |
65
+
66
+ ## Emits
67
+
68
+ | 事件 | 参数 | 说明 |
69
+ | --- | --- | --- |
70
+ | `input` | `Array<string \| number>` | 输入值变化时触发 |
71
+ | `update:value` | `Array<string \| number>` | `v-model:value` 同步事件 |
72
+ | `change` | `Array<string \| number>` | 选项确认变化时触发 |
73
+ | `focus` | `FocusEvent` | 聚焦时触发 |
74
+ | `blur` | `FocusEvent` | 失焦时触发 |
75
+ | `visible-change` | `boolean` | 级联面板显隐变化时触发 |
76
+
77
+ ## Expose
78
+
79
+ | 方法 | 说明 |
80
+ | --- | --- |
81
+ | `focus()` | 打开级联面板 |
82
+ | `blur()` | 关闭级联面板 |
83
+ | `togglePopperVisible()` | 切换级联面板显隐 |
84
+ | `clear()` | 清空当前值 |
85
+ | `getCascaderRef()` | 获取内部 `el-cascader` 实例 |
86
+
87
+ ## 设计约束
88
+
89
+ - 组件只负责通用级联选择壳子和交互状态,不直接耦合区域接口、组织树接口等业务数据源
90
+ - 页面层如果需要多选级联、懒加载或复杂回填逻辑,优先先通过 `propsValue` 和插值配置解决
91
+ - 如果业务需要固定某种树结构,可以在业务包里再封一层领域组件,而不是反向污染 `ui-core`
@@ -0,0 +1,3 @@
1
+ import OutlinedCascader from './OutlinedCascader.vue';
2
+ export default OutlinedCascader;
3
+ export type { OutlinedCascaderCssValue, OutlinedCascaderExpose, OutlinedCascaderProps, OutlinedCascaderValue } from './OutlinedCascader.types';
@@ -0,0 +1,10 @@
1
+ import OutlinedCascader from './OutlinedCascader.vue'
2
+
3
+ export default OutlinedCascader
4
+
5
+ export type {
6
+ OutlinedCascaderCssValue,
7
+ OutlinedCascaderExpose,
8
+ OutlinedCascaderProps,
9
+ OutlinedCascaderValue
10
+ } from './OutlinedCascader.types'
@@ -0,0 +1,27 @@
1
+ export type OutlinedDatePickerCssValue = string | number;
2
+ export type OutlinedDatePickerValue = string | number | Date | Array<string | number | Date> | null;
3
+ export type OutlinedDatePickerDisabledDate = string | number | Date | ((date: Date) => boolean);
4
+ export interface OutlinedDatePickerProps {
5
+ value?: OutlinedDatePickerValue;
6
+ placeholder?: string;
7
+ label?: string;
8
+ disabled?: boolean;
9
+ timeValue?: boolean;
10
+ typeDate?: string;
11
+ format?: string;
12
+ valueFormat?: string;
13
+ showPassword?: boolean;
14
+ multiple?: boolean;
15
+ inputHeight?: number;
16
+ isBorder?: boolean;
17
+ disabledDate?: OutlinedDatePickerDisabledDate;
18
+ marginBottom?: OutlinedDatePickerCssValue;
19
+ paddingTop?: OutlinedDatePickerCssValue;
20
+ }
21
+ export interface OutlinedDatePickerExpose {
22
+ focus: () => void;
23
+ blur: () => void;
24
+ handleOpen: () => void;
25
+ handleClose: () => void;
26
+ getPickerRef: () => unknown | null;
27
+ }
@@ -0,0 +1,40 @@
1
+ export type OutlinedDatePickerCssValue = string | number
2
+
3
+ export type OutlinedDatePickerValue =
4
+ | string
5
+ | number
6
+ | Date
7
+ | Array<string | number | Date>
8
+ | null
9
+
10
+ export type OutlinedDatePickerDisabledDate =
11
+ | string
12
+ | number
13
+ | Date
14
+ | ((date: Date) => boolean)
15
+
16
+ export interface OutlinedDatePickerProps {
17
+ value?: OutlinedDatePickerValue
18
+ placeholder?: string
19
+ label?: string
20
+ disabled?: boolean
21
+ timeValue?: boolean
22
+ typeDate?: string
23
+ format?: string
24
+ valueFormat?: string
25
+ showPassword?: boolean
26
+ multiple?: boolean
27
+ inputHeight?: number
28
+ isBorder?: boolean
29
+ disabledDate?: OutlinedDatePickerDisabledDate
30
+ marginBottom?: OutlinedDatePickerCssValue
31
+ paddingTop?: OutlinedDatePickerCssValue
32
+ }
33
+
34
+ export interface OutlinedDatePickerExpose {
35
+ focus: () => void
36
+ blur: () => void
37
+ handleOpen: () => void
38
+ handleClose: () => void
39
+ getPickerRef: () => unknown | null
40
+ }
@@ -0,0 +1,365 @@
1
+ <template>
2
+ <div
3
+ class="outlined-date-picker"
4
+ :class="[containerClasses, rootClass]"
5
+ :style="[containerStyle, rootStyle]"
6
+ >
7
+ <el-date-picker
8
+ ref="pickerRef"
9
+ v-bind="pickerAttrs"
10
+ class="outlined-date-picker__control"
11
+ :model-value="pickerValue"
12
+ :type="typeDate"
13
+ :format="format"
14
+ :value-format="resolvedValueFormat"
15
+ :placeholder="placeholder"
16
+ :disabled="disabled"
17
+ :style="pickerStyle"
18
+ @update:model-value="handleModelValueUpdate"
19
+ @focus="handleFocus"
20
+ @blur="handleBlur"
21
+ @change="handleChange"
22
+ @visible-change="handleVisibleChange"
23
+ />
24
+
25
+ <div
26
+ v-if="floatingLabel"
27
+ class="outlined-date-picker__label"
28
+ :class="labelClasses"
29
+ >
30
+ {{ floatingLabel }}
31
+ </div>
32
+ </div>
33
+ </template>
34
+
35
+ <script setup lang="ts">
36
+ import { computed, ref, useAttrs, watch } from 'vue'
37
+ import type {
38
+ OutlinedDatePickerCssValue,
39
+ OutlinedDatePickerDisabledDate,
40
+ OutlinedDatePickerExpose,
41
+ OutlinedDatePickerProps,
42
+ OutlinedDatePickerValue
43
+ } from './OutlinedDatePicker.types'
44
+
45
+ defineOptions({
46
+ name: 'OutlinedDatePicker',
47
+ inheritAttrs: false
48
+ })
49
+
50
+ const props = withDefaults(defineProps<OutlinedDatePickerProps>(), {
51
+ value: '',
52
+ placeholder: '',
53
+ label: '',
54
+ disabled: false,
55
+ timeValue: false,
56
+ typeDate: 'date',
57
+ format: 'YYYY-MM-DD',
58
+ valueFormat: '',
59
+ showPassword: false,
60
+ multiple: false,
61
+ inputHeight: 40,
62
+ isBorder: false,
63
+ disabledDate: undefined,
64
+ marginBottom: 20,
65
+ paddingTop: 20
66
+ })
67
+
68
+ const emit = defineEmits<{
69
+ (event: 'input', value: OutlinedDatePickerValue | ''): void
70
+ (event: 'update:value', value: OutlinedDatePickerValue | ''): void
71
+ (event: 'change', value: OutlinedDatePickerValue | ''): void
72
+ (event: 'focus', value: FocusEvent): void
73
+ (event: 'blur', value: FocusEvent): void
74
+ (event: 'visible-change', value: boolean): void
75
+ }>()
76
+
77
+ const attrs = useAttrs()
78
+ const pickerRef = ref<any>(null)
79
+ const pickerValue = ref<OutlinedDatePickerValue | ''>(props.value ?? '')
80
+ const focused = ref(false)
81
+ const blurred = ref(false)
82
+ const visible = ref(false)
83
+
84
+ watch(
85
+ () => props.value,
86
+ (value) => {
87
+ pickerValue.value = value ?? ''
88
+ },
89
+ { immediate: true }
90
+ )
91
+
92
+ const rootClass = computed(() => attrs.class)
93
+ const rootStyle = computed(() => attrs.style)
94
+
95
+ const resolvedValueFormat = computed(() => props.valueFormat || props.format)
96
+
97
+ const resolvedDisabledDate = computed(() => createDisabledDateHandler(props.disabledDate))
98
+
99
+ const resolvedDefaultTime = computed(() => {
100
+ if (attrs.defaultTime !== undefined) {
101
+ return attrs.defaultTime
102
+ }
103
+
104
+ if ((attrs as Record<string, unknown>)['default-time'] !== undefined) {
105
+ return (attrs as Record<string, unknown>)['default-time']
106
+ }
107
+
108
+ return props.timeValue ? new Date().setHours(0, 0, 0, 0) : new Date()
109
+ })
110
+
111
+ const resolvedDisabledHours = computed(() => {
112
+ if (attrs.disabledHours !== undefined) {
113
+ return attrs.disabledHours
114
+ }
115
+
116
+ if ((attrs as Record<string, unknown>)['disabled-hours'] !== undefined) {
117
+ return (attrs as Record<string, unknown>)['disabled-hours']
118
+ }
119
+
120
+ if (!shouldLimitCurrentTime()) {
121
+ return undefined
122
+ }
123
+
124
+ return () => {
125
+ const hours = new Date().getHours()
126
+ return Array.from({ length: hours }, (_, index) => index)
127
+ }
128
+ })
129
+
130
+ const resolvedDisabledMinutes = computed(() => {
131
+ if (attrs.disabledMinutes !== undefined) {
132
+ return attrs.disabledMinutes
133
+ }
134
+
135
+ if ((attrs as Record<string, unknown>)['disabled-minutes'] !== undefined) {
136
+ return (attrs as Record<string, unknown>)['disabled-minutes']
137
+ }
138
+
139
+ if (!shouldLimitCurrentTime()) {
140
+ return undefined
141
+ }
142
+
143
+ return () => {
144
+ const minutes = new Date().getMinutes()
145
+ return Array.from({ length: minutes }, (_, index) => index)
146
+ }
147
+ })
148
+
149
+ const pickerAttrs = computed(() => {
150
+ const { class: _class, style: _style, ...rest } = attrs
151
+
152
+ return {
153
+ ...rest,
154
+ defaultTime: resolvedDefaultTime.value,
155
+ disabledDate: resolvedDisabledDate.value,
156
+ disabledHours: resolvedDisabledHours.value,
157
+ disabledMinutes: resolvedDisabledMinutes.value
158
+ }
159
+ })
160
+
161
+ const containerClasses = computed(() => ({
162
+ 'outlined-date-picker--bordered': props.isBorder
163
+ }))
164
+
165
+ const containerStyle = computed(() => ({
166
+ marginBottom: toCssValue(props.marginBottom),
167
+ paddingTop: toCssValue(props.paddingTop)
168
+ }))
169
+
170
+ const pickerStyle = computed(() => ({
171
+ height: `${props.inputHeight}px`
172
+ }))
173
+
174
+ const floatingLabel = computed(() => props.label || props.placeholder || '')
175
+
176
+ const hasContent = computed(() => hasFilledValue(pickerValue.value))
177
+
178
+ const labelClasses = computed(() => ({
179
+ 'outlined-date-picker__label--floating': focused.value || hasContent.value,
180
+ 'outlined-date-picker__label--placeholder': !focused.value && !hasContent.value,
181
+ 'outlined-date-picker__label--filled': hasContent.value && !focused.value
182
+ }))
183
+
184
+ function handleModelValueUpdate(value: OutlinedDatePickerValue) {
185
+ const normalizedValue = normalizeValue(value)
186
+ pickerValue.value = normalizedValue
187
+ emitModelValue(normalizedValue)
188
+ }
189
+
190
+ function handleChange(value: OutlinedDatePickerValue) {
191
+ const normalizedValue = normalizeValue(value)
192
+ pickerValue.value = normalizedValue
193
+ emit('change', normalizedValue)
194
+ }
195
+
196
+ function handleFocus(event: FocusEvent) {
197
+ blurred.value = false
198
+ focused.value = true
199
+ emit('focus', event)
200
+ }
201
+
202
+ function handleBlur(event: FocusEvent) {
203
+ blurred.value = true
204
+
205
+ if (!visible.value) {
206
+ focused.value = false
207
+ emitModelValue(pickerValue.value)
208
+ }
209
+
210
+ emit('blur', event)
211
+ }
212
+
213
+ function handleVisibleChange(nextVisible: boolean) {
214
+ visible.value = nextVisible
215
+
216
+ if (!nextVisible && blurred.value) {
217
+ focused.value = false
218
+ }
219
+
220
+ emit('visible-change', nextVisible)
221
+ }
222
+
223
+ function emitModelValue(value: OutlinedDatePickerValue | '') {
224
+ emit('input', value)
225
+ emit('update:value', value)
226
+ }
227
+
228
+ function normalizeValue(value: OutlinedDatePickerValue | undefined) {
229
+ return value ?? ''
230
+ }
231
+
232
+ function createDisabledDateHandler(disabledDate: OutlinedDatePickerDisabledDate | undefined) {
233
+ if (!disabledDate) {
234
+ return undefined
235
+ }
236
+
237
+ if (typeof disabledDate === 'function') {
238
+ return disabledDate
239
+ }
240
+
241
+ const boundary = normalizeBoundary(disabledDate)
242
+
243
+ return (value: Date) => value.getTime() < boundary - 86400000
244
+ }
245
+
246
+ function normalizeBoundary(value: Exclude<OutlinedDatePickerDisabledDate, ((date: Date) => boolean)>) {
247
+ if (value === 'nowDate') {
248
+ return Date.now()
249
+ }
250
+
251
+ if (value instanceof Date) {
252
+ return value.getTime()
253
+ }
254
+
255
+ if (typeof value === 'number') {
256
+ return value
257
+ }
258
+
259
+ return new Date(value).getTime()
260
+ }
261
+
262
+ function shouldLimitCurrentTime() {
263
+ return Boolean(props.disabledDate) && props.typeDate.toLowerCase().includes('time')
264
+ }
265
+
266
+ function hasFilledValue(value: unknown) {
267
+ if (Array.isArray(value)) {
268
+ return value.length > 0
269
+ }
270
+
271
+ return value !== undefined && value !== null && String(value) !== ''
272
+ }
273
+
274
+ function toCssValue(value: OutlinedDatePickerCssValue | undefined) {
275
+ if (typeof value === 'number') {
276
+ return `${value}px`
277
+ }
278
+
279
+ return value
280
+ }
281
+
282
+ defineExpose<OutlinedDatePickerExpose>({
283
+ focus: () => {
284
+ pickerRef.value?.focus?.()
285
+ },
286
+ blur: () => {
287
+ pickerRef.value?.blur?.()
288
+ },
289
+ handleOpen: () => {
290
+ pickerRef.value?.handleOpen?.()
291
+ },
292
+ handleClose: () => {
293
+ pickerRef.value?.handleClose?.()
294
+ },
295
+ getPickerRef: () => pickerRef.value
296
+ })
297
+ </script>
298
+
299
+ <style scoped>
300
+ .outlined-date-picker {
301
+ position: relative;
302
+ }
303
+
304
+ .outlined-date-picker__label {
305
+ position: absolute;
306
+ left: -2px;
307
+ padding: 2px 5px;
308
+ border-radius: 2px;
309
+ background-color: #ffffff;
310
+ font-size: 12px;
311
+ line-height: 1;
312
+ transition: color 200ms cubic-bezier(0, 0, 0.2, 1), transform 200ms cubic-bezier(0, 0, 0.2, 1);
313
+ pointer-events: none;
314
+ }
315
+
316
+ .outlined-date-picker__label--floating {
317
+ top: 18px;
318
+ z-index: 1;
319
+ opacity: 1;
320
+ transform: translate(14px, -6px) scale(1);
321
+ color: var(--el-color-primary);
322
+ }
323
+
324
+ .outlined-date-picker__label--placeholder {
325
+ top: 50%;
326
+ left: 1px;
327
+ z-index: -1;
328
+ opacity: 0;
329
+ transform: translate(14px, 6px) scale(1);
330
+ }
331
+
332
+ .outlined-date-picker__label--filled {
333
+ color: var(--el-text-color-regular);
334
+ }
335
+
336
+ :deep(.outlined-date-picker__control.el-date-editor) {
337
+ width: 100%;
338
+ }
339
+
340
+ :deep(.outlined-date-picker__control .el-input__wrapper) {
341
+ position: relative;
342
+ min-height: inherit;
343
+ height: inherit;
344
+ }
345
+
346
+ :deep(.outlined-date-picker__control .el-input__prefix) {
347
+ position: absolute;
348
+ right: 0;
349
+ }
350
+
351
+ :deep(.outlined-date-picker__control .el-input__suffix) {
352
+ position: absolute;
353
+ right: 30px;
354
+ }
355
+
356
+ :deep(.outlined-date-picker--bordered .el-input__wrapper) {
357
+ box-shadow: none;
358
+ border-radius: 0;
359
+ border-bottom: 1px solid #cccccc;
360
+ }
361
+
362
+ :deep(.outlined-date-picker--bordered .el-input__wrapper.is-focus) {
363
+ border-bottom-color: var(--el-color-primary);
364
+ }
365
+ </style>