ep-craft 0.1.30 → 0.1.32
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/dist/components/aside/aside.d.ts +26 -0
- package/dist/components/aside/aside.js +29 -0
- package/dist/components/aside/index.d.ts +2 -2
- package/dist/components/aside/index.js +4 -4
- package/dist/components/autocomplete/EpAutocomplete.d.ts +494 -0
- package/dist/components/autocomplete/EpAutocomplete.js +465 -0
- package/dist/components/autocomplete/autocomplete.d.ts +322 -0
- package/dist/components/autocomplete/autocomplete.js +120 -0
- package/dist/components/autocomplete/index.d.ts +23 -2
- package/dist/components/autocomplete/index.js +9 -3
- package/dist/components/autocomplete/instance.d.ts +70 -0
- package/dist/components/backtop/EpBacktop.vue.d.ts +55 -0
- package/dist/components/backtop/EpBacktop.vue.js +59 -0
- package/dist/components/backtop/EpBacktop2.vue.js +4 -0
- package/dist/components/backtop/backtop.d.ts +43 -0
- package/dist/components/backtop/backtop.js +36 -0
- package/dist/components/backtop/index.d.ts +35 -2
- package/dist/components/backtop/index.js +6 -3
- package/dist/components/backtop/instance.d.ts +10 -0
- package/dist/components/backtop/use-backtop.d.ts +13 -0
- package/dist/components/backtop/use-backtop.js +23 -0
- package/dist/components/checkbox/EpCheckbox.vue.d.ts +147 -0
- package/dist/components/checkbox/EpCheckbox.vue.js +101 -0
- package/dist/components/checkbox/EpCheckbox2.vue.js +4 -0
- package/dist/components/checkbox/index.d.ts +34 -2
- package/dist/components/checkbox/index.js +10 -4
- package/dist/components/checkbox/instance.d.ts +10 -0
- package/dist/components/checkbox/src/checkbox.d.ts +208 -0
- package/dist/components/checkbox/src/checkbox.js +119 -0
- package/dist/components/checkbox/src/composables/use-checkbox-disabled.d.ts +7 -0
- package/dist/components/checkbox/src/composables/use-checkbox-disabled.js +31 -0
- package/dist/components/checkbox/src/composables/use-checkbox-event.d.ts +9 -0
- package/dist/components/checkbox/src/composables/use-checkbox-event.js +48 -0
- package/dist/components/checkbox/src/composables/use-checkbox-model.d.ts +7 -0
- package/dist/components/checkbox/src/composables/use-checkbox-model.js +31 -0
- package/dist/components/checkbox/src/composables/use-checkbox-status.d.ts +12 -0
- package/dist/components/checkbox/src/composables/use-checkbox-status.js +33 -0
- package/dist/components/checkbox/src/composables/use-checkbox.d.ts +16 -0
- package/dist/components/checkbox/src/composables/use-checkbox.js +81 -0
- package/dist/components/checkbox/src/constants.d.ts +8 -0
- package/dist/components/checkbox/src/constants.js +4 -0
- package/dist/components/checkbox-button/EpCheckboxButton.vue.d.ts +147 -0
- package/dist/components/checkbox-button/EpCheckboxButton.vue.js +84 -0
- package/dist/components/checkbox-button/EpCheckboxButton2.vue.js +4 -0
- package/dist/components/checkbox-button/index.d.ts +24 -2
- package/dist/components/checkbox-button/index.js +6 -3
- package/dist/components/checkbox-button/instance.d.ts +10 -0
- package/dist/components/checkbox-group/EpCheckboxGroup.vue.d.ts +74 -0
- package/dist/components/checkbox-group/EpCheckboxGroup.vue.js +92 -0
- package/dist/components/checkbox-group/EpCheckboxGroup2.vue.js +4 -0
- package/dist/components/checkbox-group/index.d.ts +27 -2
- package/dist/components/checkbox-group/index.js +10 -4
- package/dist/components/checkbox-group/instance.d.ts +10 -0
- package/dist/components/checkbox-group/src/checkbox-group.d.ts +102 -0
- package/dist/components/checkbox-group/src/checkbox-group.js +84 -0
- package/dist/components/container/container.d.ts +35 -0
- package/dist/components/container/container.js +26 -0
- package/dist/components/container/index.d.ts +23 -2
- package/dist/components/container/index.js +13 -4
- package/dist/components/date-picker/src/date-picker.d.ts +5 -5
- package/dist/components/footer/footer.d.ts +28 -0
- package/dist/components/footer/footer.js +29 -0
- package/dist/components/footer/index.d.ts +2 -2
- package/dist/components/footer/index.js +4 -4
- package/dist/components/header/header.d.ts +28 -0
- package/dist/components/header/header.js +29 -0
- package/dist/components/header/index.d.ts +2 -2
- package/dist/components/header/index.js +4 -4
- package/dist/components/input/index.d.ts +177 -0
- package/dist/components/input/index.js +8 -6
- package/dist/components/input/input.d.ts +2 -2
- package/dist/components/input/input.js +6 -6
- package/dist/components/input-number/EpInputNumber.vue.d.ts +5 -5
- package/dist/components/input-number/input-number.d.ts +2 -2
- package/dist/components/main/index.d.ts +2 -2
- package/dist/components/main/index.js +3 -3
- package/dist/components/main/main.d.ts +14 -0
- package/dist/components/main/main.js +14 -0
- package/dist/components/pagination/index.d.ts +4 -2
- package/dist/components/pagination/index.js +9 -3
- package/dist/components/pagination/src/components/jumper.d.ts +13 -0
- package/dist/components/pagination/src/components/jumper.js +16 -0
- package/dist/components/pagination/src/components/jumper.vue.d.ts +16 -0
- package/dist/components/pagination/src/components/jumper.vue.js +58 -0
- package/dist/components/pagination/src/components/jumper2.vue.js +4 -0
- package/dist/components/pagination/src/components/next.d.ts +22 -0
- package/dist/components/pagination/src/components/next.js +26 -0
- package/dist/components/pagination/src/components/next.vue.d.ts +42 -0
- package/dist/components/pagination/src/components/next.vue.js +44 -0
- package/dist/components/pagination/src/components/next2.vue.js +4 -0
- package/dist/components/pagination/src/components/pager.d.ts +16 -0
- package/dist/components/pagination/src/components/pager.js +24 -0
- package/dist/components/pagination/src/components/pager.vue.d.ts +30 -0
- package/dist/components/pagination/src/components/pager.vue.js +148 -0
- package/dist/components/pagination/src/components/pager2.vue.js +4 -0
- package/dist/components/pagination/src/components/prev.d.ts +24 -0
- package/dist/components/pagination/src/components/prev.js +25 -0
- package/dist/components/pagination/src/components/prev.vue.d.ts +39 -0
- package/dist/components/pagination/src/components/prev.vue.js +44 -0
- package/dist/components/pagination/src/components/prev2.vue.js +4 -0
- package/dist/components/pagination/src/components/sizes.d.ts +35 -0
- package/dist/components/pagination/src/components/sizes.js +34 -0
- package/dist/components/pagination/src/components/sizes.vue.d.ts +68 -0
- package/dist/components/pagination/src/components/sizes.vue.js +73 -0
- package/dist/components/pagination/src/components/sizes2.vue.js +4 -0
- package/dist/components/pagination/src/components/total.d.ts +8 -0
- package/dist/components/pagination/src/components/total.js +15 -0
- package/dist/components/pagination/src/components/total.vue.d.ts +8 -0
- package/dist/components/pagination/src/components/total.vue.js +33 -0
- package/dist/components/pagination/src/components/total2.vue.js +4 -0
- package/dist/components/pagination/src/constants.d.ts +9 -0
- package/dist/components/pagination/src/constants.js +4 -0
- package/dist/components/pagination/src/pagination.d.ts +147 -0
- package/dist/components/pagination/src/pagination.js +314 -0
- package/dist/components/pagination/src/usePagination.d.ts +1 -0
- package/dist/components/pagination/src/usePagination.js +6 -0
- package/dist/components/popper/src/content.vue.d.ts +6 -6
- package/dist/components/scrollbar/index.d.ts +217 -6
- package/dist/components/scrollbar/index.js +12 -5
- package/dist/components/scrollbar/src/bar.d.ts +23 -0
- package/dist/components/scrollbar/src/bar.js +19 -0
- package/dist/components/scrollbar/src/bar.vue.d.ts +23 -0
- package/dist/components/scrollbar/src/bar.vue.js +43 -0
- package/dist/components/scrollbar/src/bar2.vue.js +4 -0
- package/dist/components/scrollbar/src/constants.d.ts +6 -0
- package/dist/components/scrollbar/src/constants.js +4 -0
- package/dist/components/scrollbar/src/scrollbar.d.ts +111 -6
- package/dist/components/scrollbar/src/scrollbar.js +108 -7
- package/dist/components/scrollbar/src/scrollbar.vue.d.ts +101 -0
- package/dist/components/scrollbar/src/scrollbar.vue.js +178 -0
- package/dist/components/scrollbar/src/scrollbar2.vue.js +4 -0
- package/dist/components/scrollbar/src/thumb.d.ts +29 -0
- package/dist/components/scrollbar/src/thumb.js +19 -0
- package/dist/components/scrollbar/src/thumb.vue.d.ts +27 -0
- package/dist/components/scrollbar/src/thumb.vue.js +109 -0
- package/dist/components/scrollbar/src/thumb2.vue.js +4 -0
- package/dist/components/scrollbar/src/util.d.ts +2 -14
- package/dist/components/scrollbar/src/util.js +12 -3
- package/dist/components/select/index.d.ts +2214 -0
- package/dist/components/select/index.js +10 -7
- package/dist/components/select/select.vue.d.ts +148 -90
- package/dist/components/select-v2/src/select.vue.d.ts +30 -30
- package/dist/components/time-picker/src/common/picker.vue.d.ts +5 -5
- package/dist/components/time-picker/src/time-picker.d.ts +5 -5
- package/dist/components/tooltip/index.d.ts +24 -24
- package/dist/components/tooltip/src/content.vue.d.ts +6 -6
- package/dist/components/tooltip/src/tooltip.vue.d.ts +8 -8
- package/dist/ep-craft.js +187 -179
- package/dist/index.css +1 -1
- package/dist/index.d.ts +18 -0
- package/dist/vendored-components.d.ts +5 -2
- package/dist/vendored-components.js +22 -1
- package/package.json +5 -2
- package/theme-chalk/src/float-label.scss +51 -26
|
@@ -1,4 +1,36 @@
|
|
|
1
1
|
import type { Plugin } from 'vue';
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
import _EpCheckbox from './EpCheckbox.vue';
|
|
3
|
+
/**
|
|
4
|
+
* checkbox 自持 barrel:用**本地**安装辅助把 SFC 本体注册为 `ep-checkbox`
|
|
5
|
+
* ——对外注册名与迁移前的包装态**逐字相同**(需求 6.2)。
|
|
6
|
+
*
|
|
7
|
+
* 形态对齐 `src/components/backtop/index.ts`(纯本地本体的自持 barrel)。与迁移前的
|
|
8
|
+
* `Object.assign({}, ElCheckbox, { name: 'EpCheckbox' })` 包装态的关键差异:本体不再来自
|
|
9
|
+
* `element-plus`,故本入口模块**零 element-plus 引用**(需求 1.3)。
|
|
10
|
+
*
|
|
11
|
+
* 本切片顺带修复一处既有缺陷:包装态 checkbox 注入的是 element-plus 的 form 上下文
|
|
12
|
+
* Symbol,与本地 `EpForm` / `EpFormItem` provide 的本地 Symbol 不匹配,导致禁用 / 尺寸
|
|
13
|
+
* 继承、`label for` 关联、`change` 校验与分组 `aria-labelledby` 静默失效(design.md 决策 1)。
|
|
14
|
+
*
|
|
15
|
+
* **必须用 `../../utils/with-install`(本地版),不得误用 `../../utils/vue/install`(上游版)**:
|
|
16
|
+
* 二者同名而签名不同——本地版 `withInstall(component, name: string)` 按**显式注册名**注册;
|
|
17
|
+
* 上游版 `withInstall(main, extra?)` 按 `comp.name` 注册,并把 `extra` 交给 `Object.values()`
|
|
18
|
+
* 展开。若误用上游版,第二参字符串会被**逐字符展开**,`ep-checkbox` **静默注册失败**。
|
|
19
|
+
*
|
|
20
|
+
* **不导出 `ElCheckbox` 别名**(需求 6.5,design.md 决策 3):本仓的 `El*` 别名只服务于
|
|
21
|
+
* 「过渡期仍需用上游组件」的场景;本体已自持后,别名只会与 `EpCheckbox` 争抢同一个 `.install`。
|
|
22
|
+
*
|
|
23
|
+
* **不导出 `checkboxPropsDefaults`**(design.md 决策 5):它在上游只是 barrel 顺带带出的
|
|
24
|
+
* 默认值常量,本组件的运行时逻辑并不消费它(上游 checkbox 目录内无 `setPropsDefaults` 调用),
|
|
25
|
+
* 导出会把上游内部实现细节固化为本库契约。需求 6.3 只要求「迁移前已提供的导出不缺失」,
|
|
26
|
+
* 而迁移前的包装态 barrel 不导出任何常量,故此处按契约显式不导出。
|
|
27
|
+
*
|
|
28
|
+
* **不使用 `export *`**:公开面按契约显式列出,避免 `checkbox.ts` / `instance.ts` 的
|
|
29
|
+
* 内部声明外泄到主入口(与 `backtop` / `input` 一致)。
|
|
30
|
+
*/
|
|
31
|
+
export declare const EpCheckbox: typeof _EpCheckbox & Plugin;
|
|
4
32
|
export default EpCheckbox;
|
|
33
|
+
export { checkboxEmits, checkboxProps } from './src/checkbox';
|
|
34
|
+
export { checkboxGroupContextKey } from './src/constants';
|
|
35
|
+
export type { CheckboxEmits, CheckboxProps, CheckboxPropsPublic, CheckboxValueType, } from './src/checkbox';
|
|
36
|
+
export type { CheckboxInstance } from './instance';
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { withInstall as o } from "../../utils/with-install.js";
|
|
2
|
+
import c from "./EpCheckbox.vue.js";
|
|
3
|
+
import { checkboxEmits as x, checkboxProps as h } from "./src/checkbox.js";
|
|
4
|
+
const e = o(
|
|
5
|
+
c,
|
|
6
|
+
"ep-checkbox"
|
|
7
|
+
);
|
|
4
8
|
export {
|
|
5
|
-
|
|
9
|
+
e as EpCheckbox,
|
|
10
|
+
x as checkboxEmits,
|
|
11
|
+
h as checkboxProps
|
|
6
12
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type _EpCheckbox from './EpCheckbox.vue';
|
|
2
|
+
/**
|
|
3
|
+
* EpCheckbox 的公开实例类型。
|
|
4
|
+
*
|
|
5
|
+
* 对应上游 `es/components/checkbox/src/checkbox.d.ts` 的 `CheckboxInstance`
|
|
6
|
+
* (上游写作 `InstanceType<typeof _default> & unknown`)。本地对 SFC 取实例类型,
|
|
7
|
+
* 与 `src/components/backtop/instance.ts` 的 `BacktopInstance` 同款写法:
|
|
8
|
+
* `X & unknown` 与 `X` 类型等价,故省略该恒等交集。
|
|
9
|
+
*/
|
|
10
|
+
export type CheckboxInstance = InstanceType<typeof _EpCheckbox>;
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import type { ExtractPublicPropTypes } from 'vue';
|
|
2
|
+
import type { ComponentSize } from '@element-plus/constants';
|
|
3
|
+
import type { AriaProps } from '@element-plus/hooks/use-aria';
|
|
4
|
+
export type CheckboxValueType = string | number | boolean;
|
|
5
|
+
export interface CheckboxProps extends Pick<AriaProps, 'ariaLabel' | 'ariaControls'> {
|
|
6
|
+
/**
|
|
7
|
+
* @description binding value
|
|
8
|
+
*/
|
|
9
|
+
modelValue?: number | string | boolean;
|
|
10
|
+
/**
|
|
11
|
+
* @description label of the Checkbox when used inside a `checkbox-group`
|
|
12
|
+
*/
|
|
13
|
+
label?: string | boolean | number | object;
|
|
14
|
+
/**
|
|
15
|
+
* @description value of the Checkbox when used inside a `checkbox-group`
|
|
16
|
+
*/
|
|
17
|
+
value?: string | boolean | number | object;
|
|
18
|
+
/**
|
|
19
|
+
* @description Set indeterminate state, only responsible for style control
|
|
20
|
+
*/
|
|
21
|
+
indeterminate?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* @description whether the Checkbox is disabled
|
|
24
|
+
*/
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* @description if the Checkbox is checked
|
|
28
|
+
*/
|
|
29
|
+
checked?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* @description native 'name' attribute
|
|
32
|
+
*/
|
|
33
|
+
name?: string;
|
|
34
|
+
/**
|
|
35
|
+
* @description value of the Checkbox if it's checked
|
|
36
|
+
*/
|
|
37
|
+
trueValue?: string | number;
|
|
38
|
+
/**
|
|
39
|
+
* @description value of the Checkbox if it's not checked
|
|
40
|
+
*/
|
|
41
|
+
falseValue?: string | number;
|
|
42
|
+
/**
|
|
43
|
+
* @deprecated use `trueValue` instead
|
|
44
|
+
* @description value of the Checkbox if it's checked
|
|
45
|
+
*/
|
|
46
|
+
trueLabel?: string | number;
|
|
47
|
+
/**
|
|
48
|
+
* @deprecated use `falseValue` instead
|
|
49
|
+
* @description value of the Checkbox if it's not checked
|
|
50
|
+
*/
|
|
51
|
+
falseLabel?: string | number;
|
|
52
|
+
/**
|
|
53
|
+
* @description input id
|
|
54
|
+
*/
|
|
55
|
+
id?: string;
|
|
56
|
+
/**
|
|
57
|
+
* @description whether to add a border around Checkbox
|
|
58
|
+
*/
|
|
59
|
+
border?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* @description size of the Checkbox
|
|
62
|
+
*/
|
|
63
|
+
size?: ComponentSize;
|
|
64
|
+
/**
|
|
65
|
+
* @description input tabindex
|
|
66
|
+
*/
|
|
67
|
+
tabindex?: string | number;
|
|
68
|
+
/**
|
|
69
|
+
* @description whether to trigger form validation
|
|
70
|
+
*/
|
|
71
|
+
validateEvent?: boolean;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* @deprecated Removed after 3.0.0, Use `CheckboxProps` instead.
|
|
75
|
+
*/
|
|
76
|
+
export declare const checkboxProps: {
|
|
77
|
+
ariaControls: StringConstructor;
|
|
78
|
+
/**
|
|
79
|
+
* @description binding value
|
|
80
|
+
*/
|
|
81
|
+
modelValue: {
|
|
82
|
+
type: (BooleanConstructor | NumberConstructor | StringConstructor)[];
|
|
83
|
+
default: undefined;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* @description label of the Checkbox when used inside a `checkbox-group`
|
|
87
|
+
*/
|
|
88
|
+
label: {
|
|
89
|
+
type: (BooleanConstructor | ObjectConstructor | NumberConstructor | StringConstructor)[];
|
|
90
|
+
default: undefined;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* @description value of the Checkbox when used inside a `checkbox-group`
|
|
94
|
+
*/
|
|
95
|
+
value: {
|
|
96
|
+
type: (BooleanConstructor | ObjectConstructor | NumberConstructor | StringConstructor)[];
|
|
97
|
+
default: undefined;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* @description Set indeterminate state, only responsible for style control
|
|
101
|
+
*/
|
|
102
|
+
indeterminate: BooleanConstructor;
|
|
103
|
+
/**
|
|
104
|
+
* @description whether the Checkbox is disabled
|
|
105
|
+
*/
|
|
106
|
+
disabled: {
|
|
107
|
+
type: BooleanConstructor;
|
|
108
|
+
default: undefined;
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* @description if the Checkbox is checked
|
|
112
|
+
*/
|
|
113
|
+
checked: BooleanConstructor;
|
|
114
|
+
/**
|
|
115
|
+
* @description native 'name' attribute
|
|
116
|
+
*/
|
|
117
|
+
name: {
|
|
118
|
+
type: StringConstructor;
|
|
119
|
+
default: undefined;
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* @description value of the Checkbox if it's checked
|
|
123
|
+
*/
|
|
124
|
+
trueValue: {
|
|
125
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
126
|
+
default: undefined;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* @description value of the Checkbox if it's not checked
|
|
130
|
+
*/
|
|
131
|
+
falseValue: {
|
|
132
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
133
|
+
default: undefined;
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* @deprecated use `trueValue` instead
|
|
137
|
+
* @description value of the Checkbox if it's checked
|
|
138
|
+
*/
|
|
139
|
+
trueLabel: {
|
|
140
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
141
|
+
default: undefined;
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* @deprecated use `falseValue` instead
|
|
145
|
+
* @description value of the Checkbox if it's not checked
|
|
146
|
+
*/
|
|
147
|
+
falseLabel: {
|
|
148
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
149
|
+
default: undefined;
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* @description input id
|
|
153
|
+
*/
|
|
154
|
+
id: {
|
|
155
|
+
type: StringConstructor;
|
|
156
|
+
default: undefined;
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* @description whether to add a border around Checkbox
|
|
160
|
+
*/
|
|
161
|
+
border: BooleanConstructor;
|
|
162
|
+
/**
|
|
163
|
+
* @description size of the Checkbox
|
|
164
|
+
*/
|
|
165
|
+
size: {
|
|
166
|
+
readonly type: import("vue").PropType<import("@element-plus/utils").EpPropMergeType<StringConstructor, "" | "small" | "default" | "large", never>>;
|
|
167
|
+
readonly required: false;
|
|
168
|
+
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
169
|
+
__epPropKey: true;
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* @description input tabindex
|
|
173
|
+
*/
|
|
174
|
+
tabindex: (NumberConstructor | StringConstructor)[];
|
|
175
|
+
/**
|
|
176
|
+
* @description whether to trigger form validation
|
|
177
|
+
*/
|
|
178
|
+
validateEvent: {
|
|
179
|
+
type: BooleanConstructor;
|
|
180
|
+
default: boolean;
|
|
181
|
+
};
|
|
182
|
+
ariaLabel: StringConstructor;
|
|
183
|
+
};
|
|
184
|
+
export declare const checkboxEmits: {
|
|
185
|
+
"update:modelValue": (val: CheckboxValueType) => val is string | number | boolean;
|
|
186
|
+
change: (val: CheckboxValueType) => val is string | number | boolean;
|
|
187
|
+
};
|
|
188
|
+
export type CheckboxEmits = typeof checkboxEmits;
|
|
189
|
+
/**
|
|
190
|
+
* @deprecated Removed after 3.0.0, Use `CheckboxProps` instead.
|
|
191
|
+
*/
|
|
192
|
+
export type CheckboxPropsPublic = ExtractPublicPropTypes<typeof checkboxProps>;
|
|
193
|
+
/**
|
|
194
|
+
* @description default values for CheckboxProps
|
|
195
|
+
*/
|
|
196
|
+
export declare const checkboxPropsDefaults: {
|
|
197
|
+
readonly modelValue: undefined;
|
|
198
|
+
readonly label: undefined;
|
|
199
|
+
readonly value: undefined;
|
|
200
|
+
readonly disabled: undefined;
|
|
201
|
+
readonly name: undefined;
|
|
202
|
+
readonly trueValue: undefined;
|
|
203
|
+
readonly falseValue: undefined;
|
|
204
|
+
readonly trueLabel: undefined;
|
|
205
|
+
readonly falseLabel: undefined;
|
|
206
|
+
readonly id: undefined;
|
|
207
|
+
readonly validateEvent: true;
|
|
208
|
+
};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { UPDATE_MODEL_EVENT as i } from "../../../constants/event.js";
|
|
2
|
+
import { useAriaProps as a } from "../../../hooks/use-aria/index.js";
|
|
3
|
+
import { useSizeProp as l } from "../../../hooks/use-size/index.js";
|
|
4
|
+
import { isNumber as t, isBoolean as o } from "../../../utils/types.js";
|
|
5
|
+
import "lodash-unified";
|
|
6
|
+
import "@vueuse/core";
|
|
7
|
+
import { isString as r } from "@vue/shared";
|
|
8
|
+
import "@element-plus/icons-vue";
|
|
9
|
+
import "vue";
|
|
10
|
+
const S = {
|
|
11
|
+
/**
|
|
12
|
+
* @description binding value
|
|
13
|
+
*/
|
|
14
|
+
modelValue: {
|
|
15
|
+
type: [Number, String, Boolean],
|
|
16
|
+
default: void 0
|
|
17
|
+
},
|
|
18
|
+
/**
|
|
19
|
+
* @description label of the Checkbox when used inside a `checkbox-group`
|
|
20
|
+
*/
|
|
21
|
+
label: {
|
|
22
|
+
type: [String, Boolean, Number, Object],
|
|
23
|
+
default: void 0
|
|
24
|
+
},
|
|
25
|
+
/**
|
|
26
|
+
* @description value of the Checkbox when used inside a `checkbox-group`
|
|
27
|
+
*/
|
|
28
|
+
value: {
|
|
29
|
+
type: [String, Boolean, Number, Object],
|
|
30
|
+
default: void 0
|
|
31
|
+
},
|
|
32
|
+
/**
|
|
33
|
+
* @description Set indeterminate state, only responsible for style control
|
|
34
|
+
*/
|
|
35
|
+
indeterminate: Boolean,
|
|
36
|
+
/**
|
|
37
|
+
* @description whether the Checkbox is disabled
|
|
38
|
+
*/
|
|
39
|
+
disabled: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: void 0
|
|
42
|
+
},
|
|
43
|
+
/**
|
|
44
|
+
* @description if the Checkbox is checked
|
|
45
|
+
*/
|
|
46
|
+
checked: Boolean,
|
|
47
|
+
/**
|
|
48
|
+
* @description native 'name' attribute
|
|
49
|
+
*/
|
|
50
|
+
name: {
|
|
51
|
+
type: String,
|
|
52
|
+
default: void 0
|
|
53
|
+
},
|
|
54
|
+
/**
|
|
55
|
+
* @description value of the Checkbox if it's checked
|
|
56
|
+
*/
|
|
57
|
+
trueValue: {
|
|
58
|
+
type: [String, Number],
|
|
59
|
+
default: void 0
|
|
60
|
+
},
|
|
61
|
+
/**
|
|
62
|
+
* @description value of the Checkbox if it's not checked
|
|
63
|
+
*/
|
|
64
|
+
falseValue: {
|
|
65
|
+
type: [String, Number],
|
|
66
|
+
default: void 0
|
|
67
|
+
},
|
|
68
|
+
/**
|
|
69
|
+
* @deprecated use `trueValue` instead
|
|
70
|
+
* @description value of the Checkbox if it's checked
|
|
71
|
+
*/
|
|
72
|
+
trueLabel: {
|
|
73
|
+
type: [String, Number],
|
|
74
|
+
default: void 0
|
|
75
|
+
},
|
|
76
|
+
/**
|
|
77
|
+
* @deprecated use `falseValue` instead
|
|
78
|
+
* @description value of the Checkbox if it's not checked
|
|
79
|
+
*/
|
|
80
|
+
falseLabel: {
|
|
81
|
+
type: [String, Number],
|
|
82
|
+
default: void 0
|
|
83
|
+
},
|
|
84
|
+
/**
|
|
85
|
+
* @description input id
|
|
86
|
+
*/
|
|
87
|
+
id: {
|
|
88
|
+
type: String,
|
|
89
|
+
default: void 0
|
|
90
|
+
},
|
|
91
|
+
/**
|
|
92
|
+
* @description whether to add a border around Checkbox
|
|
93
|
+
*/
|
|
94
|
+
border: Boolean,
|
|
95
|
+
/**
|
|
96
|
+
* @description size of the Checkbox
|
|
97
|
+
*/
|
|
98
|
+
size: l,
|
|
99
|
+
/**
|
|
100
|
+
* @description input tabindex
|
|
101
|
+
*/
|
|
102
|
+
tabindex: [String, Number],
|
|
103
|
+
/**
|
|
104
|
+
* @description whether to trigger form validation
|
|
105
|
+
*/
|
|
106
|
+
validateEvent: {
|
|
107
|
+
type: Boolean,
|
|
108
|
+
default: !0
|
|
109
|
+
},
|
|
110
|
+
ariaLabel: String,
|
|
111
|
+
...a(["ariaControls"])
|
|
112
|
+
}, c = {
|
|
113
|
+
[i]: (e) => r(e) || t(e) || o(e),
|
|
114
|
+
change: (e) => r(e) || t(e) || o(e)
|
|
115
|
+
};
|
|
116
|
+
export {
|
|
117
|
+
c as checkboxEmits,
|
|
118
|
+
S as checkboxProps
|
|
119
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CheckboxModel } from './use-checkbox-model';
|
|
2
|
+
import type { CheckboxStatus } from './use-checkbox-status';
|
|
3
|
+
export declare const useCheckboxDisabled: ({ model, isChecked, }: Pick<CheckboxModel, "model"> & Pick<CheckboxStatus, "isChecked">) => {
|
|
4
|
+
isDisabled: import("vue").ComputedRef<boolean>;
|
|
5
|
+
isLimitDisabled: import("vue").ComputedRef<boolean>;
|
|
6
|
+
};
|
|
7
|
+
export type CheckboxDisabled = ReturnType<typeof useCheckboxDisabled>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { inject as s, computed as u } from "vue";
|
|
2
|
+
import { formContextKey as v } from "../../../form/src/constants.js";
|
|
3
|
+
import { useFormDisabled as p } from "../../../form/src/hooks/use-form-common-props.js";
|
|
4
|
+
import { isUndefined as d } from "../../../../utils/types.js";
|
|
5
|
+
import "lodash-unified";
|
|
6
|
+
import "@vueuse/core";
|
|
7
|
+
import "@vue/shared";
|
|
8
|
+
import "@element-plus/icons-vue";
|
|
9
|
+
import { checkboxGroupContextKey as f } from "../constants.js";
|
|
10
|
+
const F = ({
|
|
11
|
+
model: r,
|
|
12
|
+
isChecked: m
|
|
13
|
+
}) => {
|
|
14
|
+
const e = s(f, void 0), t = s(v, void 0), o = u(() => {
|
|
15
|
+
var a, l;
|
|
16
|
+
const i = (a = e == null ? void 0 : e.max) == null ? void 0 : a.value, n = (l = e == null ? void 0 : e.min) == null ? void 0 : l.value;
|
|
17
|
+
return !d(i) && r.value.length >= i && !m.value || !d(n) && r.value.length <= n && m.value;
|
|
18
|
+
});
|
|
19
|
+
return {
|
|
20
|
+
isDisabled: p(
|
|
21
|
+
u(() => {
|
|
22
|
+
var i;
|
|
23
|
+
return e === void 0 ? (t == null ? void 0 : t.disabled) ?? o.value : ((i = e.disabled) == null ? void 0 : i.value) || o.value;
|
|
24
|
+
})
|
|
25
|
+
),
|
|
26
|
+
isLimitDisabled: o
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
F as useCheckboxDisabled
|
|
31
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useFormItemInputId } from '@element-plus/components/form/src/hooks/use-form-item';
|
|
2
|
+
import type { CheckboxProps } from '../checkbox';
|
|
3
|
+
import type { CheckboxDisabled } from './use-checkbox-disabled';
|
|
4
|
+
import type { CheckboxModel } from './use-checkbox-model';
|
|
5
|
+
import type { CheckboxStatus } from './use-checkbox-status';
|
|
6
|
+
export declare const useCheckboxEvent: (props: CheckboxProps, { model, isLimitExceeded, hasOwnLabel, isDisabled, isLabeledByFormItem, }: Pick<CheckboxModel, "model" | "isLimitExceeded"> & Pick<CheckboxStatus, "hasOwnLabel"> & Pick<CheckboxDisabled, "isDisabled"> & Pick<ReturnType<typeof useFormItemInputId>, "isLabeledByFormItem">) => {
|
|
7
|
+
handleChange: (e: Event) => void;
|
|
8
|
+
onClickRoot: (e: MouseEvent) => Promise<void>;
|
|
9
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { inject as E, getCurrentInstance as C, computed as V, watch as b, nextTick as L } from "vue";
|
|
2
|
+
import { useFormItem as k } from "../../../form/src/hooks/use-form-item.js";
|
|
3
|
+
import { CHANGE_EVENT as r } from "../../../../constants/event.js";
|
|
4
|
+
import { NOOP as N } from "@vue/shared";
|
|
5
|
+
import "lodash-unified";
|
|
6
|
+
import "@vueuse/core";
|
|
7
|
+
import "@element-plus/icons-vue";
|
|
8
|
+
import { checkboxGroupContextKey as x } from "../constants.js";
|
|
9
|
+
const F = (e, {
|
|
10
|
+
model: n,
|
|
11
|
+
isLimitExceeded: c,
|
|
12
|
+
hasOwnLabel: f,
|
|
13
|
+
isDisabled: v,
|
|
14
|
+
isLabeledByFormItem: m
|
|
15
|
+
}) => {
|
|
16
|
+
const u = E(x, void 0), { formItem: l } = k(), { emit: o } = C();
|
|
17
|
+
function i(t) {
|
|
18
|
+
return [!0, e.trueValue, e.trueLabel].includes(t) ? e.trueValue ?? e.trueLabel ?? !0 : e.falseValue ?? e.falseLabel ?? !1;
|
|
19
|
+
}
|
|
20
|
+
function s(t, a) {
|
|
21
|
+
o(r, i(t), a);
|
|
22
|
+
}
|
|
23
|
+
function d(t) {
|
|
24
|
+
if (c.value) return;
|
|
25
|
+
const a = t.target;
|
|
26
|
+
o(r, i(a.checked), t);
|
|
27
|
+
}
|
|
28
|
+
async function h(t) {
|
|
29
|
+
c.value || !f.value && !v.value && m.value && (t.composedPath().some((a) => a.tagName === "LABEL") || (n.value = i(
|
|
30
|
+
[!1, e.falseValue, e.falseLabel].includes(n.value)
|
|
31
|
+
), await L(), s(n.value, t)));
|
|
32
|
+
}
|
|
33
|
+
const g = V(
|
|
34
|
+
() => (u == null ? void 0 : u.validateEvent) || e.validateEvent
|
|
35
|
+
);
|
|
36
|
+
return b(
|
|
37
|
+
() => e.modelValue,
|
|
38
|
+
() => {
|
|
39
|
+
g.value && (l == null || l.validate("change").catch(N));
|
|
40
|
+
}
|
|
41
|
+
), {
|
|
42
|
+
handleChange: d,
|
|
43
|
+
onClickRoot: h
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
F as useCheckboxEvent
|
|
48
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CheckboxProps } from '../checkbox';
|
|
2
|
+
export declare const useCheckboxModel: (props: CheckboxProps) => {
|
|
3
|
+
model: import("vue").WritableComputedRef<any, any>;
|
|
4
|
+
isGroup: import("vue").ComputedRef<boolean>;
|
|
5
|
+
isLimitExceeded: import("vue").Ref<boolean, boolean>;
|
|
6
|
+
};
|
|
7
|
+
export type CheckboxModel = ReturnType<typeof useCheckboxModel>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ref as a, getCurrentInstance as g, inject as p, computed as o } from "vue";
|
|
2
|
+
import { UPDATE_MODEL_EVENT as E } from "../../../../constants/event.js";
|
|
3
|
+
import { isUndefined as C } from "../../../../utils/types.js";
|
|
4
|
+
import "lodash-unified";
|
|
5
|
+
import "@vueuse/core";
|
|
6
|
+
import { isArray as V } from "@vue/shared";
|
|
7
|
+
import "@element-plus/icons-vue";
|
|
8
|
+
import { checkboxGroupContextKey as M } from "../constants.js";
|
|
9
|
+
const j = (d) => {
|
|
10
|
+
const s = a(!1), { emit: u, vnode: f } = g(), e = p(M, void 0), l = o(() => C(e) === !1), n = a(!1), v = o(() => {
|
|
11
|
+
const t = f.props ?? {};
|
|
12
|
+
return "modelValue" in t || "model-value" in t;
|
|
13
|
+
}), i = o({
|
|
14
|
+
get() {
|
|
15
|
+
var t;
|
|
16
|
+
return l.value ? (t = e == null ? void 0 : e.modelValue) == null ? void 0 : t.value : v.value ? d.modelValue : s.value;
|
|
17
|
+
},
|
|
18
|
+
set(t) {
|
|
19
|
+
var m, r;
|
|
20
|
+
l.value && V(t) ? (n.value = ((m = e == null ? void 0 : e.max) == null ? void 0 : m.value) !== void 0 && t.length > (e == null ? void 0 : e.max.value) && t.length > i.value.length, n.value === !1 && ((r = e == null ? void 0 : e.changeEvent) == null || r.call(e, t))) : (u(E, t), s.value = t);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
return {
|
|
24
|
+
model: i,
|
|
25
|
+
isGroup: l,
|
|
26
|
+
isLimitExceeded: n
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
j as useCheckboxModel
|
|
31
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ComponentInternalInstance } from 'vue';
|
|
2
|
+
import type { CheckboxProps } from '../checkbox';
|
|
3
|
+
import type { CheckboxModel } from './use-checkbox-model';
|
|
4
|
+
export declare const useCheckboxStatus: (props: CheckboxProps, slots: ComponentInternalInstance["slots"], { model }: Pick<CheckboxModel, "model">) => {
|
|
5
|
+
checkboxButtonSize: import("vue").ComputedRef<"" | "small" | "default" | "large">;
|
|
6
|
+
isChecked: import("vue").ComputedRef<boolean>;
|
|
7
|
+
isFocused: import("vue").Ref<boolean, boolean>;
|
|
8
|
+
checkboxSize: import("vue").ComputedRef<"" | "small" | "default" | "large">;
|
|
9
|
+
hasOwnLabel: import("vue").ComputedRef<boolean>;
|
|
10
|
+
actualValue: import("vue").ComputedRef<string | number | boolean | object | undefined>;
|
|
11
|
+
};
|
|
12
|
+
export type CheckboxStatus = ReturnType<typeof useCheckboxStatus>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { inject as v, ref as d, computed as i, toRaw as o } from "vue";
|
|
2
|
+
import { isEqual as b } from "lodash-unified";
|
|
3
|
+
import { useFormSize as l } from "../../../form/src/hooks/use-form-common-props.js";
|
|
4
|
+
import { isPropAbsent as a, isBoolean as p } from "../../../../utils/types.js";
|
|
5
|
+
import "@vueuse/core";
|
|
6
|
+
import { isArray as z, isObject as S } from "@vue/shared";
|
|
7
|
+
import "@element-plus/icons-vue";
|
|
8
|
+
import { checkboxGroupContextKey as h } from "../constants.js";
|
|
9
|
+
const F = (r, s, { model: n }) => {
|
|
10
|
+
const t = v(h, void 0), m = d(!1), u = i(() => a(r.value) ? r.label : r.value), c = i(() => {
|
|
11
|
+
const e = n.value;
|
|
12
|
+
return p(e) ? e : z(e) ? S(u.value) ? e.map(o).some((f) => b(f, u.value)) : e.map(o).includes(u.value) : e != null ? e === r.trueValue || e === r.trueLabel : !!e;
|
|
13
|
+
});
|
|
14
|
+
return {
|
|
15
|
+
checkboxButtonSize: l(i(() => {
|
|
16
|
+
var e;
|
|
17
|
+
return (e = t == null ? void 0 : t.size) == null ? void 0 : e.value;
|
|
18
|
+
}), {
|
|
19
|
+
prop: !0
|
|
20
|
+
}),
|
|
21
|
+
isChecked: c,
|
|
22
|
+
isFocused: m,
|
|
23
|
+
checkboxSize: l(i(() => {
|
|
24
|
+
var e;
|
|
25
|
+
return (e = t == null ? void 0 : t.size) == null ? void 0 : e.value;
|
|
26
|
+
})),
|
|
27
|
+
hasOwnLabel: i(() => !!s.default || !a(u.value)),
|
|
28
|
+
actualValue: u
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
F as useCheckboxStatus
|
|
33
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ComponentInternalInstance } from 'vue';
|
|
2
|
+
import type { CheckboxProps } from '../checkbox';
|
|
3
|
+
export declare const useCheckbox: (props: CheckboxProps, slots: ComponentInternalInstance["slots"]) => {
|
|
4
|
+
inputId: import("vue").Ref<string | undefined, string | undefined>;
|
|
5
|
+
isLabeledByFormItem: import("vue").ComputedRef<boolean>;
|
|
6
|
+
isChecked: import("vue").ComputedRef<boolean>;
|
|
7
|
+
isDisabled: import("vue").ComputedRef<boolean>;
|
|
8
|
+
isFocused: import("vue").Ref<boolean, boolean>;
|
|
9
|
+
checkboxButtonSize: import("vue").ComputedRef<"" | "small" | "default" | "large">;
|
|
10
|
+
checkboxSize: import("vue").ComputedRef<"" | "small" | "default" | "large">;
|
|
11
|
+
hasOwnLabel: import("vue").ComputedRef<boolean>;
|
|
12
|
+
model: import("vue").WritableComputedRef<any, any>;
|
|
13
|
+
actualValue: import("vue").ComputedRef<string | number | boolean | object | undefined>;
|
|
14
|
+
handleChange: (e: Event) => void;
|
|
15
|
+
onClickRoot: (e: MouseEvent) => Promise<void>;
|
|
16
|
+
};
|