element-pe 1.0.5 → 1.0.6
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/attributes.json +1 -1
- package/dist/index.css +1 -1
- package/dist/index.full.js +632 -1287
- package/dist/index.full.min.js +9 -10
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +7 -8
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +630 -1289
- package/es/component.d.ts +24 -2
- package/es/components/affix/index.js +1 -1
- package/es/components/autocomplete/index.d.ts +4 -4
- package/es/components/autocomplete/src/index.vue.d.ts +2 -2
- package/es/components/carousel/index.d.ts +2 -2
- package/es/components/carousel/src/main.vue.d.ts +2 -2
- package/es/components/cascader/index.d.ts +2 -2
- package/es/components/cascader/src/index.vue.d.ts +1 -1
- package/es/components/checkbox/index.d.ts +6 -6
- package/es/components/checkbox/src/checkbox-button.vue.d.ts +1 -1
- package/es/components/checkbox/src/checkbox-group.vue.d.ts +1 -1
- package/es/components/checkbox/src/checkbox.vue.d.ts +2 -2
- package/es/components/color-picker/index.d.ts +2 -2
- package/es/components/color-picker/src/components/alpha-slider.vue.d.ts +1 -1
- package/es/components/color-picker/src/components/hue-slider.vue.d.ts +1 -1
- package/es/components/color-picker/src/index.vue.d.ts +1 -1
- package/es/components/descriptions/index.d.ts +8 -8
- package/es/components/descriptions/src/description-item.d.ts +2 -2
- package/es/components/descriptions/src/descriptions-cell.d.ts +1 -1
- package/es/components/descriptions/src/index.vue.d.ts +4 -4
- package/es/components/drawer/index.d.ts +6 -6
- package/es/components/drawer/src/index.vue.d.ts +3 -3
- package/es/components/dropdown/index.d.ts +2 -2
- package/es/components/dropdown/src/dropdown.vue.d.ts +2 -2
- package/es/components/form/index.js +2 -2
- package/es/components/icon/index.d.ts +1 -1
- package/es/components/icon/src/icon.vue.d.ts +1 -1
- package/es/components/image/index.d.ts +3 -3
- package/es/components/image/index.js +2 -3
- package/es/components/image/src/image.d.ts +1 -1
- package/es/components/image/src/image.vue.d.ts +3 -3
- package/es/components/image-viewer/index.d.ts +28 -104
- package/es/components/image-viewer/index.js +60 -61
- package/es/components/image-viewer/src/image-viewer.d.ts +14 -0
- package/es/components/image-viewer/src/image-viewer.vue.d.ts +55 -0
- package/es/components/input/index.d.ts +116 -360
- package/es/components/input/index.js +216 -209
- package/es/components/input/src/calc-textarea-height.d.ts +6 -0
- package/es/components/input/src/input.d.ts +46 -0
- package/es/components/input/src/input.vue.d.ts +162 -0
- package/es/components/input-number/index.d.ts +2 -2
- package/es/components/input-number/src/index.vue.d.ts +1 -1
- package/es/components/menu/index.d.ts +7 -3
- package/es/components/menu/index.js +8 -3
- package/es/components/menu/src/menu.d.ts +8 -3
- package/es/components/pagination/index.d.ts +2 -2
- package/es/components/pagination/src/pagination.d.ts +2 -2
- package/es/components/progress/index.js +0 -1
- package/es/components/radio/index.d.ts +2 -2
- package/es/components/radio/src/radio.vue.d.ts +2 -2
- package/es/components/rate/index.js +1 -1
- package/es/components/row/index.d.ts +4 -4
- package/es/components/row/src/row.d.ts +2 -2
- package/es/components/scrollbar/index.d.ts +4 -4
- package/es/components/scrollbar/src/index.vue.d.ts +2 -2
- package/es/components/select/index.d.ts +3 -3
- package/es/components/select/src/select.vue.d.ts +3 -3
- package/es/components/select-v2/index.d.ts +6 -6
- package/es/components/select-v2/index.js +2 -0
- package/es/components/select-v2/src/select.vue.d.ts +3 -3
- package/es/components/slider/index.d.ts +4 -4
- package/es/components/slider/src/button.vue.d.ts +2 -2
- package/es/components/slider/src/index.vue.d.ts +2 -2
- package/es/components/space/index.d.ts +2 -2
- package/es/components/space/src/space.d.ts +2 -2
- package/es/components/steps/index.d.ts +2 -2
- package/es/components/steps/src/index.vue.d.ts +2 -2
- package/es/components/table/index.d.ts +4 -4
- package/es/components/table/index.js +17 -9
- package/es/components/table/src/table.vue.d.ts +4 -4
- package/es/components/tag/index.d.ts +1 -1
- package/es/components/tag/src/tag.vue.d.ts +1 -1
- package/es/components/timeline/index.d.ts +4 -4
- package/es/components/timeline/src/item.vue.d.ts +2 -2
- package/es/components/tree/index.js +1 -1
- package/es/components/tree-v2/index.d.ts +1 -1
- package/es/components/tree-v2/index.js +2 -24
- package/es/components/tree-v2/src/tree.vue.d.ts +1 -1
- package/es/components/upload/index.d.ts +4 -4
- package/es/components/upload/src/index.vue.d.ts +2 -2
- package/es/components/upload/src/upload.vue.d.ts +2 -2
- package/es/components/virtual-list/src/builders/build-grid.d.ts +3 -3
- package/es/components/virtual-list/src/builders/build-list.d.ts +4 -4
- package/es/components/virtual-list/src/components/dynamic-size-grid.d.ts +3 -3
- package/es/components/virtual-list/src/components/dynamic-size-list.d.ts +4 -4
- package/es/components/virtual-list/src/components/fixed-size-grid.d.ts +3 -3
- package/es/components/virtual-list/src/components/fixed-size-list.d.ts +4 -4
- package/es/components/virtual-list/src/components/scrollbar.d.ts +1 -1
- package/es/utils/dom.d.ts +5 -5
- package/es/utils/dom.js +29 -36
- package/es/utils/props.d.ts +2 -2
- package/es/utils/props.js +15 -7
- package/es/utils/util.d.ts +2 -2
- package/es/utils/util.js +3 -3
- package/es/version.d.ts +1 -1
- package/es/version.js +1 -1
- package/lib/component.d.ts +24 -2
- package/lib/components/affix/index.js +1 -1
- package/lib/components/autocomplete/index.d.ts +4 -4
- package/lib/components/autocomplete/src/index.vue.d.ts +2 -2
- package/lib/components/carousel/index.d.ts +2 -2
- package/lib/components/carousel/src/main.vue.d.ts +2 -2
- package/lib/components/cascader/index.d.ts +2 -2
- package/lib/components/cascader/src/index.vue.d.ts +1 -1
- package/lib/components/checkbox/index.d.ts +6 -6
- package/lib/components/checkbox/src/checkbox-button.vue.d.ts +1 -1
- package/lib/components/checkbox/src/checkbox-group.vue.d.ts +1 -1
- package/lib/components/checkbox/src/checkbox.vue.d.ts +2 -2
- package/lib/components/color-picker/index.d.ts +2 -2
- package/lib/components/color-picker/src/components/alpha-slider.vue.d.ts +1 -1
- package/lib/components/color-picker/src/components/hue-slider.vue.d.ts +1 -1
- package/lib/components/color-picker/src/index.vue.d.ts +1 -1
- package/lib/components/descriptions/index.d.ts +8 -8
- package/lib/components/descriptions/src/description-item.d.ts +2 -2
- package/lib/components/descriptions/src/descriptions-cell.d.ts +1 -1
- package/lib/components/descriptions/src/index.vue.d.ts +4 -4
- package/lib/components/drawer/index.d.ts +6 -6
- package/lib/components/drawer/src/index.vue.d.ts +3 -3
- package/lib/components/dropdown/index.d.ts +2 -2
- package/lib/components/dropdown/src/dropdown.vue.d.ts +2 -2
- package/lib/components/form/index.js +2 -2
- package/lib/components/icon/index.d.ts +1 -1
- package/lib/components/icon/src/icon.vue.d.ts +1 -1
- package/lib/components/image/index.d.ts +3 -3
- package/lib/components/image/index.js +2 -3
- package/lib/components/image/src/image.d.ts +1 -1
- package/lib/components/image/src/image.vue.d.ts +3 -3
- package/lib/components/image-viewer/index.d.ts +28 -104
- package/lib/components/image-viewer/index.js +61 -60
- package/lib/components/image-viewer/src/image-viewer.d.ts +14 -0
- package/lib/components/image-viewer/src/image-viewer.vue.d.ts +55 -0
- package/lib/components/input/index.d.ts +116 -360
- package/lib/components/input/index.js +215 -206
- package/lib/components/input/src/calc-textarea-height.d.ts +6 -0
- package/lib/components/input/src/input.d.ts +46 -0
- package/lib/components/input/src/input.vue.d.ts +162 -0
- package/lib/components/input-number/index.d.ts +2 -2
- package/lib/components/input-number/src/index.vue.d.ts +1 -1
- package/lib/components/menu/index.d.ts +7 -3
- package/lib/components/menu/index.js +8 -3
- package/lib/components/menu/src/menu.d.ts +8 -3
- package/lib/components/pagination/index.d.ts +2 -2
- package/lib/components/pagination/src/pagination.d.ts +2 -2
- package/lib/components/progress/index.js +0 -1
- package/lib/components/radio/index.d.ts +2 -2
- package/lib/components/radio/src/radio.vue.d.ts +2 -2
- package/lib/components/rate/index.js +1 -1
- package/lib/components/row/index.d.ts +4 -4
- package/lib/components/row/src/row.d.ts +2 -2
- package/lib/components/scrollbar/index.d.ts +4 -4
- package/lib/components/scrollbar/src/index.vue.d.ts +2 -2
- package/lib/components/select/index.d.ts +3 -3
- package/lib/components/select/src/select.vue.d.ts +3 -3
- package/lib/components/select-v2/index.d.ts +6 -6
- package/lib/components/select-v2/index.js +2 -0
- package/lib/components/select-v2/src/select.vue.d.ts +3 -3
- package/lib/components/slider/index.d.ts +4 -4
- package/lib/components/slider/src/button.vue.d.ts +2 -2
- package/lib/components/slider/src/index.vue.d.ts +2 -2
- package/lib/components/space/index.d.ts +2 -2
- package/lib/components/space/src/space.d.ts +2 -2
- package/lib/components/steps/index.d.ts +2 -2
- package/lib/components/steps/src/index.vue.d.ts +2 -2
- package/lib/components/table/index.d.ts +4 -4
- package/lib/components/table/index.js +17 -9
- package/lib/components/table/src/table.vue.d.ts +4 -4
- package/lib/components/tag/index.d.ts +1 -1
- package/lib/components/tag/src/tag.vue.d.ts +1 -1
- package/lib/components/timeline/index.d.ts +4 -4
- package/lib/components/timeline/src/item.vue.d.ts +2 -2
- package/lib/components/tree/index.js +1 -1
- package/lib/components/tree-v2/index.d.ts +1 -1
- package/lib/components/tree-v2/index.js +2 -24
- package/lib/components/tree-v2/src/tree.vue.d.ts +1 -1
- package/lib/components/upload/index.d.ts +4 -4
- package/lib/components/upload/src/index.vue.d.ts +2 -2
- package/lib/components/upload/src/upload.vue.d.ts +2 -2
- package/lib/components/virtual-list/src/builders/build-grid.d.ts +3 -3
- package/lib/components/virtual-list/src/builders/build-list.d.ts +4 -4
- package/lib/components/virtual-list/src/components/dynamic-size-grid.d.ts +3 -3
- package/lib/components/virtual-list/src/components/dynamic-size-list.d.ts +4 -4
- package/lib/components/virtual-list/src/components/fixed-size-grid.d.ts +3 -3
- package/lib/components/virtual-list/src/components/fixed-size-list.d.ts +4 -4
- package/lib/components/virtual-list/src/components/scrollbar.d.ts +1 -1
- package/lib/utils/dom.d.ts +5 -5
- package/lib/utils/dom.js +29 -36
- package/lib/utils/props.d.ts +2 -2
- package/lib/utils/props.js +15 -7
- package/lib/utils/util.d.ts +2 -2
- package/lib/utils/util.js +2 -2
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +3 -2
- package/packages/components/affix/src/affix.vue +1 -1
- package/packages/components/color-picker/src/index.vue +1 -1
- package/packages/components/form/__tests__/form.spec.ts +1 -1
- package/packages/components/form/src/form-item.vue +2 -2
- package/packages/components/image/src/image.ts +3 -3
- package/packages/components/image/src/image.vue +1 -1
- package/packages/components/image-viewer/__tests__/image-viewer.spec.ts +1 -1
- package/packages/components/image-viewer/index.ts +5 -10
- package/packages/components/image-viewer/src/image-viewer.ts +32 -0
- package/packages/components/image-viewer/src/{index.vue → image-viewer.vue} +73 -82
- package/packages/components/input/__tests__/input.spec.ts +7 -7
- package/packages/components/input/index.ts +5 -10
- package/packages/components/input/src/{calcTextareaHeight.ts → calc-textarea-height.ts} +9 -7
- package/packages/components/input/src/input.ts +100 -0
- package/packages/components/input/src/{index.vue → input.vue} +135 -239
- package/packages/components/menu/src/menu.ts +10 -3
- package/packages/components/progress/src/index.vue +0 -1
- package/packages/components/rate/src/index.vue +1 -1
- package/packages/components/select-v2/src/useSelect.ts +2 -0
- package/packages/components/space/__tests__/space.spec.ts +1 -1
- package/packages/components/switch/__tests__/switch.spec.ts +1 -1
- package/packages/components/table/src/store/tree.ts +18 -3
- package/packages/components/table/src/table-body/render-helper.ts +1 -1
- package/packages/components/table/src/table-column/index.ts +4 -1
- package/packages/components/table/src/table-layout.ts +2 -2
- package/packages/components/table/src/util.ts +1 -1
- package/packages/components/tree/src/model/node.ts +1 -1
- package/packages/element-plus/package.json +3 -2
- package/packages/element-plus/version.ts +1 -1
- package/packages/theme-chalk/package.json +1 -2
- package/packages/theme-chalk/src/message-box.scss +1 -0
- package/packages/utils/dist/es/dom.d.ts +5 -5
- package/packages/utils/dist/es/dom.js +29 -36
- package/packages/utils/dist/es/props.d.ts +2 -2
- package/packages/utils/dist/es/props.js +15 -7
- package/packages/utils/dist/es/util.d.ts +2 -2
- package/packages/utils/dist/es/util.js +3 -3
- package/packages/utils/dist/lib/dom.d.ts +5 -5
- package/packages/utils/dist/lib/dom.js +29 -36
- package/packages/utils/dist/lib/props.d.ts +2 -2
- package/packages/utils/dist/lib/props.js +15 -7
- package/packages/utils/dist/lib/util.d.ts +2 -2
- package/packages/utils/dist/lib/util.js +2 -2
- package/packages/utils/dom.ts +34 -41
- package/packages/utils/props.ts +27 -11
- package/packages/utils/tests/dom.spec.ts +183 -0
- package/packages/utils/util.ts +8 -9
- package/tags.json +1 -1
- package/theme-chalk/el-message-box.css +1 -1
- package/theme-chalk/index.css +1 -1
- package/theme-chalk/src/message-box.scss +1 -0
- package/web-types.json +1 -1
- package/es/components/image-viewer/src/index.vue.d.ts +0 -67
- package/es/components/input/src/calcTextareaHeight.d.ts +0 -6
- package/es/components/input/src/index.vue.d.ts +0 -197
- package/lib/components/image-viewer/src/index.vue.d.ts +0 -67
- package/lib/components/input/src/calcTextareaHeight.d.ts +0 -6
- package/lib/components/input/src/index.vue.d.ts +0 -197
|
@@ -67,6 +67,7 @@ function useTree<T>(watcherData: WatcherPropsData<T>) {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
const updateTreeData = (
|
|
70
|
+
ifChangeExpandRowKeys = false,
|
|
70
71
|
ifExpandAll = instance.store?.states.defaultExpandAll.value
|
|
71
72
|
) => {
|
|
72
73
|
const nested = normalizedData.value
|
|
@@ -77,10 +78,17 @@ function useTree<T>(watcherData: WatcherPropsData<T>) {
|
|
|
77
78
|
const oldTreeData = unref(treeData)
|
|
78
79
|
const rootLazyRowKeys = []
|
|
79
80
|
const getExpanded = (oldValue, key) => {
|
|
80
|
-
if (
|
|
81
|
-
|
|
81
|
+
if (ifChangeExpandRowKeys) {
|
|
82
|
+
if (expandRowKeys.value) {
|
|
83
|
+
return ifExpandAll || expandRowKeys.value.includes(key)
|
|
84
|
+
} else {
|
|
85
|
+
return !!(ifExpandAll || oldValue?.expanded)
|
|
86
|
+
}
|
|
82
87
|
} else {
|
|
83
|
-
|
|
88
|
+
const included =
|
|
89
|
+
ifExpandAll ||
|
|
90
|
+
(expandRowKeys.value && expandRowKeys.value.includes(key))
|
|
91
|
+
return !!(oldValue?.expanded || included)
|
|
84
92
|
}
|
|
85
93
|
}
|
|
86
94
|
// 合并 expanded 与 display,确保数据刷新后,状态不变
|
|
@@ -126,6 +134,13 @@ function useTree<T>(watcherData: WatcherPropsData<T>) {
|
|
|
126
134
|
instance.store?.updateTableScrollY()
|
|
127
135
|
}
|
|
128
136
|
|
|
137
|
+
watch(
|
|
138
|
+
() => expandRowKeys.value,
|
|
139
|
+
() => {
|
|
140
|
+
updateTreeData(true)
|
|
141
|
+
}
|
|
142
|
+
)
|
|
143
|
+
|
|
129
144
|
watch(
|
|
130
145
|
() => normalizedData.value,
|
|
131
146
|
() => {
|
|
@@ -201,7 +201,7 @@ function useRender<T>(props: Partial<TableBodyProps<T>>) {
|
|
|
201
201
|
}
|
|
202
202
|
const childKey = getRowIdentity(node, rowKey.value)
|
|
203
203
|
if (childKey === undefined || childKey === null) {
|
|
204
|
-
throw new Error('
|
|
204
|
+
throw new Error('For nested data item, row-key is required.')
|
|
205
205
|
}
|
|
206
206
|
cur = { ...treeData.value[childKey] }
|
|
207
207
|
// 对于当前节点,分成有无子节点两种情况。
|
|
@@ -165,7 +165,10 @@ export default defineComponent({
|
|
|
165
165
|
})
|
|
166
166
|
if (renderDefault instanceof Array) {
|
|
167
167
|
for (const childNode of renderDefault) {
|
|
168
|
-
if (
|
|
168
|
+
if (
|
|
169
|
+
childNode.type?.name === 'ElTableColumn' ||
|
|
170
|
+
childNode.shapeFlag & 2
|
|
171
|
+
) {
|
|
169
172
|
children.push(childNode)
|
|
170
173
|
} else if (
|
|
171
174
|
childNode.type === Fragment &&
|
|
@@ -62,10 +62,10 @@ class TableLayout<T> {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
if (!this.table) {
|
|
65
|
-
throw new Error('
|
|
65
|
+
throw new Error('Table is required for Table Layout')
|
|
66
66
|
}
|
|
67
67
|
if (!this.store) {
|
|
68
|
-
throw new Error('
|
|
68
|
+
throw new Error('Store is required for Table Layout')
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -149,7 +149,7 @@ export const getRowIdentity = <T>(
|
|
|
149
149
|
row: T,
|
|
150
150
|
rowKey: string | ((row: T) => any)
|
|
151
151
|
): string => {
|
|
152
|
-
if (!row) throw new Error('
|
|
152
|
+
if (!row) throw new Error('Row is required when get row identity')
|
|
153
153
|
if (typeof rowKey === 'string') {
|
|
154
154
|
if (rowKey.indexOf('.') < 0) {
|
|
155
155
|
return `${row[rowKey]}`
|
|
@@ -251,7 +251,7 @@ class Node {
|
|
|
251
251
|
}
|
|
252
252
|
|
|
253
253
|
insertChild(child?: FakeNode | Node, index?: number, batch?: boolean): void {
|
|
254
|
-
if (!child) throw new Error('
|
|
254
|
+
if (!child) throw new Error('InsertChild error: child is required.')
|
|
255
255
|
|
|
256
256
|
if (!(child instanceof Node)) {
|
|
257
257
|
if (!batch) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "element-pe",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "A Component Library for Vue 3",
|
|
5
5
|
"homepage": "https://element-plus.org/",
|
|
6
6
|
"keywords": [
|
|
@@ -35,7 +35,8 @@
|
|
|
35
35
|
"vue": "^3.2.0"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@
|
|
38
|
+
"@element-plus/icons": "^0.0.11",
|
|
39
|
+
"@popperjs/core": "^2.10.2",
|
|
39
40
|
"@vueuse/core": "~6.1.0",
|
|
40
41
|
"async-validator": "^4.0.3",
|
|
41
42
|
"dayjs": "^1.10.7",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '1.0.
|
|
1
|
+
export const version = '1.0.5'
|
|
@@ -3,14 +3,14 @@ import type { Nullable } from './types';
|
|
|
3
3
|
export declare const on: (element: HTMLElement | Document | Window, event: string, handler: EventListenerOrEventListenerObject, useCapture?: boolean) => void;
|
|
4
4
|
export declare const off: (element: HTMLElement | Document | Window, event: string, handler: EventListenerOrEventListenerObject, useCapture?: boolean) => void;
|
|
5
5
|
export declare const once: (el: HTMLElement, event: string, fn: EventListener) => void;
|
|
6
|
-
export declare function hasClass(el: HTMLElement, cls: string): boolean;
|
|
7
|
-
export declare function addClass(el: HTMLElement, cls: string): void;
|
|
8
|
-
export declare function removeClass(el: HTMLElement, cls: string): void;
|
|
6
|
+
export declare function hasClass(el: HTMLElement | Element, cls: string): boolean;
|
|
7
|
+
export declare function addClass(el: HTMLElement | Element, cls: string): void;
|
|
8
|
+
export declare function removeClass(el: HTMLElement | Element, cls: string): void;
|
|
9
9
|
export declare const getStyle: (element: HTMLElement, styleName: string) => string;
|
|
10
10
|
export declare function setStyle(element: HTMLElement, styleName: CSSProperties | string, value?: string): void;
|
|
11
11
|
export declare function removeStyle(element: HTMLElement, style: CSSProperties | string): void;
|
|
12
|
-
export declare const isScroll: (el: HTMLElement, isVertical?: Nullable<boolean>) => RegExpMatchArray;
|
|
13
|
-
export declare const getScrollContainer: (el: HTMLElement, isVertical?: Nullable<boolean>) => Window | HTMLElement;
|
|
12
|
+
export declare const isScroll: (el: HTMLElement, isVertical?: Nullable<boolean>) => RegExpMatchArray | null;
|
|
13
|
+
export declare const getScrollContainer: (el: HTMLElement, isVertical?: Nullable<boolean>) => Window | HTMLElement | undefined;
|
|
14
14
|
export declare const isInContainer: (el: Element | undefined, container: Element | Window | undefined) => boolean;
|
|
15
15
|
export declare const getOffsetTop: (el: HTMLElement) => number;
|
|
16
16
|
export declare const getOffsetTopDistance: (el: HTMLElement, containerEl: HTMLElement) => number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import isServer from './isServer';
|
|
2
2
|
import { camelize, isObject } from './util';
|
|
3
|
-
const
|
|
4
|
-
return (s || '').
|
|
3
|
+
const trimArr = function (s) {
|
|
4
|
+
return (s || '').split(' ').filter((item) => !!item.trim());
|
|
5
5
|
};
|
|
6
6
|
export const on = function (element, event, handler, useCapture = false) {
|
|
7
7
|
if (element && event && handler) {
|
|
@@ -31,54 +31,47 @@ export function hasClass(el, cls) {
|
|
|
31
31
|
return el.classList.contains(cls);
|
|
32
32
|
}
|
|
33
33
|
else {
|
|
34
|
-
|
|
34
|
+
const className = el.getAttribute('class') || '';
|
|
35
|
+
return className.split(' ').includes(cls);
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
export function addClass(el, cls) {
|
|
38
39
|
if (!el)
|
|
39
40
|
return;
|
|
40
|
-
let
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
el.classList.add(clsName);
|
|
48
|
-
}
|
|
49
|
-
else if (!hasClass(el, clsName)) {
|
|
50
|
-
curClass += ` ${clsName}`;
|
|
51
|
-
}
|
|
41
|
+
let className = el.getAttribute('class') || '';
|
|
42
|
+
const curClass = trimArr(className);
|
|
43
|
+
const classes = (cls || '')
|
|
44
|
+
.split(' ')
|
|
45
|
+
.filter((item) => !curClass.includes(item) && !!item.trim());
|
|
46
|
+
if (el.classList) {
|
|
47
|
+
el.classList.add(...classes);
|
|
52
48
|
}
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
else {
|
|
50
|
+
className += ` ${classes.join(' ')}`;
|
|
51
|
+
el.setAttribute('class', className);
|
|
55
52
|
}
|
|
56
53
|
}
|
|
57
54
|
export function removeClass(el, cls) {
|
|
58
55
|
if (!el || !cls)
|
|
59
56
|
return;
|
|
60
|
-
const classes = cls
|
|
61
|
-
let curClass =
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
continue;
|
|
66
|
-
if (el.classList) {
|
|
67
|
-
el.classList.remove(clsName);
|
|
68
|
-
}
|
|
69
|
-
else if (hasClass(el, clsName)) {
|
|
70
|
-
curClass = curClass.replace(` ${clsName} `, ' ');
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
if (!el.classList) {
|
|
74
|
-
el.className = trim(curClass);
|
|
57
|
+
const classes = trimArr(cls);
|
|
58
|
+
let curClass = el.getAttribute('class') || '';
|
|
59
|
+
if (el.classList) {
|
|
60
|
+
el.classList.remove(...classes);
|
|
61
|
+
return;
|
|
75
62
|
}
|
|
63
|
+
classes.forEach((item) => {
|
|
64
|
+
curClass = curClass.replace(` ${item} `, ' ');
|
|
65
|
+
});
|
|
66
|
+
const className = trimArr(curClass).join(' ');
|
|
67
|
+
el.setAttribute('class', className);
|
|
76
68
|
}
|
|
77
69
|
export const getStyle = function (element, styleName) {
|
|
70
|
+
var _a;
|
|
78
71
|
if (isServer)
|
|
79
|
-
return;
|
|
72
|
+
return '';
|
|
80
73
|
if (!element || !styleName)
|
|
81
|
-
return
|
|
74
|
+
return '';
|
|
82
75
|
styleName = camelize(styleName);
|
|
83
76
|
if (styleName === 'float') {
|
|
84
77
|
styleName = 'cssFloat';
|
|
@@ -87,7 +80,7 @@ export const getStyle = function (element, styleName) {
|
|
|
87
80
|
const style = element.style[styleName];
|
|
88
81
|
if (style)
|
|
89
82
|
return style;
|
|
90
|
-
const computed = document.defaultView.getComputedStyle(element, '');
|
|
83
|
+
const computed = (_a = document.defaultView) === null || _a === void 0 ? void 0 : _a.getComputedStyle(element, '');
|
|
91
84
|
return computed ? computed[styleName] : '';
|
|
92
85
|
}
|
|
93
86
|
catch (e) {
|
|
@@ -121,7 +114,7 @@ export function removeStyle(element, style) {
|
|
|
121
114
|
}
|
|
122
115
|
export const isScroll = (el, isVertical) => {
|
|
123
116
|
if (isServer)
|
|
124
|
-
return;
|
|
117
|
+
return null;
|
|
125
118
|
const determinedDirection = isVertical === null || isVertical === undefined;
|
|
126
119
|
const overflow = determinedDirection
|
|
127
120
|
? getStyle(el, 'overflow')
|
|
@@ -39,13 +39,13 @@ export declare type BuildPropReturn<T, D, R, V, C> = {
|
|
|
39
39
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
40
40
|
[propKey]: true;
|
|
41
41
|
} & BuildPropDefault<BuildPropType<T, V, C>, IfUnknown<D, never>, IfUnknown<R, false>>;
|
|
42
|
-
export declare function buildProp<T = never, D extends BuildPropType<T, V, C> = never, R extends boolean = false, V = never, C = never>(option: BuildPropOption<T, D, R, V, C
|
|
42
|
+
export declare function buildProp<T = never, D extends BuildPropType<T, V, C> = never, R extends boolean = false, V = never, C = never>(option: BuildPropOption<T, D, R, V, C>, key?: string): BuildPropReturn<T, D, R, V, C>;
|
|
43
43
|
declare type NativePropType = [
|
|
44
44
|
((...args: any) => any) | {
|
|
45
45
|
new (...args: any): any;
|
|
46
46
|
} | undefined | null
|
|
47
47
|
];
|
|
48
|
-
export declare const buildProps: <O extends { [K in keyof O]: O[K] extends BuildPropReturn<any, any, any, any, any> ? O[K] : [O[K]] extends NativePropType ? O[K] : O[K] extends BuildPropOption<infer T, infer D, infer R, infer V, infer C> ? D extends BuildPropType<T, V, C> ? BuildPropOption<T, D, R, V, C> : never : never; }>(
|
|
48
|
+
export declare const buildProps: <O extends { [K in keyof O]: O[K] extends BuildPropReturn<any, any, any, any, any> ? O[K] : [O[K]] extends NativePropType ? O[K] : O[K] extends BuildPropOption<infer T, infer D, infer R, infer V, infer C> ? D extends BuildPropType<T, V, C> ? BuildPropOption<T, D, R, V, C> : never : never; }>(props: O) => { [K_1 in keyof O]: O[K_1] extends {
|
|
49
49
|
[propKey]: boolean;
|
|
50
50
|
} ? O[K_1] : [O[K_1]] extends NativePropType ? O[K_1] : O[K_1] extends BuildPropOption<infer T_1, infer _D, infer R_1, infer V_1, infer C_1> ? BuildPropReturn<T_1, O[K_1]["default"], R_1, V_1, C_1> : never; };
|
|
51
51
|
export declare const definePropType: <T>(val: any) => PropWrapper<T>;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
+
import { warn } from 'vue';
|
|
1
2
|
import { isObject } from '@vue/shared';
|
|
2
|
-
import
|
|
3
|
-
import { debugWarn } from './error';
|
|
3
|
+
import fromPairs from 'lodash/fromPairs';
|
|
4
4
|
const wrapperKey = Symbol();
|
|
5
5
|
export const propKey = Symbol();
|
|
6
|
-
export function buildProp(option) {
|
|
7
|
-
var _a;
|
|
6
|
+
export function buildProp(option, key) {
|
|
8
7
|
if (!isObject(option) || !!option[propKey])
|
|
9
8
|
return option;
|
|
10
9
|
const { values, required, default: defaultValue, type, validator } = option;
|
|
@@ -19,20 +18,29 @@ export function buildProp(option) {
|
|
|
19
18
|
if (validator)
|
|
20
19
|
valid || (valid = validator(val));
|
|
21
20
|
if (!valid && allowedValues.length > 0) {
|
|
22
|
-
|
|
21
|
+
const allowValuesText = [...new Set(allowedValues)]
|
|
22
|
+
.map((value) => JSON.stringify(value))
|
|
23
|
+
.join(', ');
|
|
24
|
+
warn(`Invalid prop: validation failed${key ? ` for prop "${key}"` : ''}. Expected one of [${allowValuesText}], got value ${JSON.stringify(val)}.`);
|
|
23
25
|
}
|
|
24
26
|
return valid;
|
|
25
27
|
}
|
|
26
28
|
: undefined;
|
|
27
29
|
return {
|
|
28
|
-
type:
|
|
30
|
+
type: typeof type === 'object' &&
|
|
31
|
+
Object.getOwnPropertySymbols(type).includes(wrapperKey)
|
|
32
|
+
? type[wrapperKey]
|
|
33
|
+
: type,
|
|
29
34
|
required: !!required,
|
|
30
35
|
default: defaultValue,
|
|
31
36
|
validator: _validator,
|
|
32
37
|
[propKey]: true,
|
|
33
38
|
};
|
|
34
39
|
}
|
|
35
|
-
export const buildProps = (
|
|
40
|
+
export const buildProps = (props) => fromPairs(Object.entries(props).map(([key, option]) => [
|
|
41
|
+
key,
|
|
42
|
+
buildProp(option, key),
|
|
43
|
+
]));
|
|
36
44
|
export const definePropType = (val) => ({ [wrapperKey]: val });
|
|
37
45
|
export const keyOf = (arr) => Object.keys(arr);
|
|
38
46
|
export const mutable = (val) => val;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { camelize, capitalize, extend, hasOwn, isArray, isObject, isString, looseEqual } from '@vue/shared';
|
|
2
2
|
import type { ComponentPublicInstance, CSSProperties, Ref } from 'vue';
|
|
3
|
-
import type {
|
|
3
|
+
import type { TimeoutHandle, Nullable } from './types';
|
|
4
4
|
export declare const SCOPE = "Util";
|
|
5
5
|
export declare function toObject<T>(arr: Array<T>): Record<string, T>;
|
|
6
6
|
export declare const getValueByPath: (obj: any, paths?: string) => unknown;
|
|
@@ -20,7 +20,7 @@ export { hasOwn, isObject, isArray, isString, capitalize, camelize, looseEqual,
|
|
|
20
20
|
export declare const isBool: (val: unknown) => val is boolean;
|
|
21
21
|
export declare const isNumber: (val: unknown) => val is number;
|
|
22
22
|
export declare const isHTMLElement: (val: unknown) => boolean;
|
|
23
|
-
export declare function rafThrottle<T extends
|
|
23
|
+
export declare function rafThrottle<T extends (...args: any) => any>(fn: T): T;
|
|
24
24
|
export declare const clearTimer: (timer: Ref<TimeoutHandle>) => void;
|
|
25
25
|
export declare function getRandomInt(max: number): number;
|
|
26
26
|
export declare function isUndefined(val: any): val is undefined;
|
|
@@ -2,7 +2,7 @@ import { getCurrentInstance } from 'vue';
|
|
|
2
2
|
import { camelize, capitalize, extend, hasOwn, hyphenate, isArray, isObject, isString, isFunction, looseEqual, toRawType, } from '@vue/shared';
|
|
3
3
|
import isEqualWith from 'lodash/isEqualWith';
|
|
4
4
|
import isServer from './isServer';
|
|
5
|
-
import { debugWarn } from './error';
|
|
5
|
+
import { debugWarn, throwError } from './error';
|
|
6
6
|
export const SCOPE = 'Util';
|
|
7
7
|
export function toObject(arr) {
|
|
8
8
|
const res = {};
|
|
@@ -41,7 +41,7 @@ export function getPropByPath(obj, path, strict) {
|
|
|
41
41
|
}
|
|
42
42
|
else {
|
|
43
43
|
if (strict) {
|
|
44
|
-
|
|
44
|
+
throwError(SCOPE, 'Please transfer a valid prop path to form item!');
|
|
45
45
|
}
|
|
46
46
|
break;
|
|
47
47
|
}
|
|
@@ -92,7 +92,7 @@ export function rafThrottle(fn) {
|
|
|
92
92
|
return;
|
|
93
93
|
locked = true;
|
|
94
94
|
window.requestAnimationFrame(() => {
|
|
95
|
-
|
|
95
|
+
Reflect.apply(fn, this, args);
|
|
96
96
|
locked = false;
|
|
97
97
|
});
|
|
98
98
|
};
|
|
@@ -3,14 +3,14 @@ import type { Nullable } from './types';
|
|
|
3
3
|
export declare const on: (element: HTMLElement | Document | Window, event: string, handler: EventListenerOrEventListenerObject, useCapture?: boolean) => void;
|
|
4
4
|
export declare const off: (element: HTMLElement | Document | Window, event: string, handler: EventListenerOrEventListenerObject, useCapture?: boolean) => void;
|
|
5
5
|
export declare const once: (el: HTMLElement, event: string, fn: EventListener) => void;
|
|
6
|
-
export declare function hasClass(el: HTMLElement, cls: string): boolean;
|
|
7
|
-
export declare function addClass(el: HTMLElement, cls: string): void;
|
|
8
|
-
export declare function removeClass(el: HTMLElement, cls: string): void;
|
|
6
|
+
export declare function hasClass(el: HTMLElement | Element, cls: string): boolean;
|
|
7
|
+
export declare function addClass(el: HTMLElement | Element, cls: string): void;
|
|
8
|
+
export declare function removeClass(el: HTMLElement | Element, cls: string): void;
|
|
9
9
|
export declare const getStyle: (element: HTMLElement, styleName: string) => string;
|
|
10
10
|
export declare function setStyle(element: HTMLElement, styleName: CSSProperties | string, value?: string): void;
|
|
11
11
|
export declare function removeStyle(element: HTMLElement, style: CSSProperties | string): void;
|
|
12
|
-
export declare const isScroll: (el: HTMLElement, isVertical?: Nullable<boolean>) => RegExpMatchArray;
|
|
13
|
-
export declare const getScrollContainer: (el: HTMLElement, isVertical?: Nullable<boolean>) => Window | HTMLElement;
|
|
12
|
+
export declare const isScroll: (el: HTMLElement, isVertical?: Nullable<boolean>) => RegExpMatchArray | null;
|
|
13
|
+
export declare const getScrollContainer: (el: HTMLElement, isVertical?: Nullable<boolean>) => Window | HTMLElement | undefined;
|
|
14
14
|
export declare const isInContainer: (el: Element | undefined, container: Element | Window | undefined) => boolean;
|
|
15
15
|
export declare const getOffsetTop: (el: HTMLElement) => number;
|
|
16
16
|
export declare const getOffsetTopDistance: (el: HTMLElement, containerEl: HTMLElement) => number;
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.stop = exports.getOffsetTopDistance = exports.getOffsetTop = exports.isInContainer = exports.getScrollContainer = exports.isScroll = exports.removeStyle = exports.setStyle = exports.getStyle = exports.removeClass = exports.addClass = exports.hasClass = exports.once = exports.off = exports.on = void 0;
|
|
7
7
|
const isServer_1 = __importDefault(require("./isServer"));
|
|
8
8
|
const util_1 = require("./util");
|
|
9
|
-
const
|
|
10
|
-
return (s || '').
|
|
9
|
+
const trimArr = function (s) {
|
|
10
|
+
return (s || '').split(' ').filter((item) => !!item.trim());
|
|
11
11
|
};
|
|
12
12
|
const on = function (element, event, handler, useCapture = false) {
|
|
13
13
|
if (element && event && handler) {
|
|
@@ -40,57 +40,50 @@ function hasClass(el, cls) {
|
|
|
40
40
|
return el.classList.contains(cls);
|
|
41
41
|
}
|
|
42
42
|
else {
|
|
43
|
-
|
|
43
|
+
const className = el.getAttribute('class') || '';
|
|
44
|
+
return className.split(' ').includes(cls);
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
exports.hasClass = hasClass;
|
|
47
48
|
function addClass(el, cls) {
|
|
48
49
|
if (!el)
|
|
49
50
|
return;
|
|
50
|
-
let
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
el.classList.add(clsName);
|
|
58
|
-
}
|
|
59
|
-
else if (!hasClass(el, clsName)) {
|
|
60
|
-
curClass += ` ${clsName}`;
|
|
61
|
-
}
|
|
51
|
+
let className = el.getAttribute('class') || '';
|
|
52
|
+
const curClass = trimArr(className);
|
|
53
|
+
const classes = (cls || '')
|
|
54
|
+
.split(' ')
|
|
55
|
+
.filter((item) => !curClass.includes(item) && !!item.trim());
|
|
56
|
+
if (el.classList) {
|
|
57
|
+
el.classList.add(...classes);
|
|
62
58
|
}
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
else {
|
|
60
|
+
className += ` ${classes.join(' ')}`;
|
|
61
|
+
el.setAttribute('class', className);
|
|
65
62
|
}
|
|
66
63
|
}
|
|
67
64
|
exports.addClass = addClass;
|
|
68
65
|
function removeClass(el, cls) {
|
|
69
66
|
if (!el || !cls)
|
|
70
67
|
return;
|
|
71
|
-
const classes = cls
|
|
72
|
-
let curClass =
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
continue;
|
|
77
|
-
if (el.classList) {
|
|
78
|
-
el.classList.remove(clsName);
|
|
79
|
-
}
|
|
80
|
-
else if (hasClass(el, clsName)) {
|
|
81
|
-
curClass = curClass.replace(` ${clsName} `, ' ');
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
if (!el.classList) {
|
|
85
|
-
el.className = trim(curClass);
|
|
68
|
+
const classes = trimArr(cls);
|
|
69
|
+
let curClass = el.getAttribute('class') || '';
|
|
70
|
+
if (el.classList) {
|
|
71
|
+
el.classList.remove(...classes);
|
|
72
|
+
return;
|
|
86
73
|
}
|
|
74
|
+
classes.forEach((item) => {
|
|
75
|
+
curClass = curClass.replace(` ${item} `, ' ');
|
|
76
|
+
});
|
|
77
|
+
const className = trimArr(curClass).join(' ');
|
|
78
|
+
el.setAttribute('class', className);
|
|
87
79
|
}
|
|
88
80
|
exports.removeClass = removeClass;
|
|
89
81
|
const getStyle = function (element, styleName) {
|
|
82
|
+
var _a;
|
|
90
83
|
if (isServer_1.default)
|
|
91
|
-
return;
|
|
84
|
+
return '';
|
|
92
85
|
if (!element || !styleName)
|
|
93
|
-
return
|
|
86
|
+
return '';
|
|
94
87
|
styleName = (0, util_1.camelize)(styleName);
|
|
95
88
|
if (styleName === 'float') {
|
|
96
89
|
styleName = 'cssFloat';
|
|
@@ -99,7 +92,7 @@ const getStyle = function (element, styleName) {
|
|
|
99
92
|
const style = element.style[styleName];
|
|
100
93
|
if (style)
|
|
101
94
|
return style;
|
|
102
|
-
const computed = document.defaultView.getComputedStyle(element, '');
|
|
95
|
+
const computed = (_a = document.defaultView) === null || _a === void 0 ? void 0 : _a.getComputedStyle(element, '');
|
|
103
96
|
return computed ? computed[styleName] : '';
|
|
104
97
|
}
|
|
105
98
|
catch (e) {
|
|
@@ -136,7 +129,7 @@ function removeStyle(element, style) {
|
|
|
136
129
|
exports.removeStyle = removeStyle;
|
|
137
130
|
const isScroll = (el, isVertical) => {
|
|
138
131
|
if (isServer_1.default)
|
|
139
|
-
return;
|
|
132
|
+
return null;
|
|
140
133
|
const determinedDirection = isVertical === null || isVertical === undefined;
|
|
141
134
|
const overflow = determinedDirection
|
|
142
135
|
? (0, exports.getStyle)(el, 'overflow')
|
|
@@ -39,13 +39,13 @@ export declare type BuildPropReturn<T, D, R, V, C> = {
|
|
|
39
39
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
40
40
|
[propKey]: true;
|
|
41
41
|
} & BuildPropDefault<BuildPropType<T, V, C>, IfUnknown<D, never>, IfUnknown<R, false>>;
|
|
42
|
-
export declare function buildProp<T = never, D extends BuildPropType<T, V, C> = never, R extends boolean = false, V = never, C = never>(option: BuildPropOption<T, D, R, V, C
|
|
42
|
+
export declare function buildProp<T = never, D extends BuildPropType<T, V, C> = never, R extends boolean = false, V = never, C = never>(option: BuildPropOption<T, D, R, V, C>, key?: string): BuildPropReturn<T, D, R, V, C>;
|
|
43
43
|
declare type NativePropType = [
|
|
44
44
|
((...args: any) => any) | {
|
|
45
45
|
new (...args: any): any;
|
|
46
46
|
} | undefined | null
|
|
47
47
|
];
|
|
48
|
-
export declare const buildProps: <O extends { [K in keyof O]: O[K] extends BuildPropReturn<any, any, any, any, any> ? O[K] : [O[K]] extends NativePropType ? O[K] : O[K] extends BuildPropOption<infer T, infer D, infer R, infer V, infer C> ? D extends BuildPropType<T, V, C> ? BuildPropOption<T, D, R, V, C> : never : never; }>(
|
|
48
|
+
export declare const buildProps: <O extends { [K in keyof O]: O[K] extends BuildPropReturn<any, any, any, any, any> ? O[K] : [O[K]] extends NativePropType ? O[K] : O[K] extends BuildPropOption<infer T, infer D, infer R, infer V, infer C> ? D extends BuildPropType<T, V, C> ? BuildPropOption<T, D, R, V, C> : never : never; }>(props: O) => { [K_1 in keyof O]: O[K_1] extends {
|
|
49
49
|
[propKey]: boolean;
|
|
50
50
|
} ? O[K_1] : [O[K_1]] extends NativePropType ? O[K_1] : O[K_1] extends BuildPropOption<infer T_1, infer _D, infer R_1, infer V_1, infer C_1> ? BuildPropReturn<T_1, O[K_1]["default"], R_1, V_1, C_1> : never; };
|
|
51
51
|
export declare const definePropType: <T>(val: any) => PropWrapper<T>;
|
|
@@ -4,13 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.componentSize = exports.mutable = exports.keyOf = exports.definePropType = exports.buildProps = exports.buildProp = exports.propKey = void 0;
|
|
7
|
+
const vue_1 = require("vue");
|
|
7
8
|
const shared_1 = require("@vue/shared");
|
|
8
|
-
const
|
|
9
|
-
const error_1 = require("./error");
|
|
9
|
+
const fromPairs_1 = __importDefault(require("lodash/fromPairs"));
|
|
10
10
|
const wrapperKey = Symbol();
|
|
11
11
|
exports.propKey = Symbol();
|
|
12
|
-
function buildProp(option) {
|
|
13
|
-
var _a;
|
|
12
|
+
function buildProp(option, key) {
|
|
14
13
|
if (!(0, shared_1.isObject)(option) || !!option[exports.propKey])
|
|
15
14
|
return option;
|
|
16
15
|
const { values, required, default: defaultValue, type, validator } = option;
|
|
@@ -25,13 +24,19 @@ function buildProp(option) {
|
|
|
25
24
|
if (validator)
|
|
26
25
|
valid || (valid = validator(val));
|
|
27
26
|
if (!valid && allowedValues.length > 0) {
|
|
28
|
-
|
|
27
|
+
const allowValuesText = [...new Set(allowedValues)]
|
|
28
|
+
.map((value) => JSON.stringify(value))
|
|
29
|
+
.join(', ');
|
|
30
|
+
(0, vue_1.warn)(`Invalid prop: validation failed${key ? ` for prop "${key}"` : ''}. Expected one of [${allowValuesText}], got value ${JSON.stringify(val)}.`);
|
|
29
31
|
}
|
|
30
32
|
return valid;
|
|
31
33
|
}
|
|
32
34
|
: undefined;
|
|
33
35
|
return {
|
|
34
|
-
type:
|
|
36
|
+
type: typeof type === 'object' &&
|
|
37
|
+
Object.getOwnPropertySymbols(type).includes(wrapperKey)
|
|
38
|
+
? type[wrapperKey]
|
|
39
|
+
: type,
|
|
35
40
|
required: !!required,
|
|
36
41
|
default: defaultValue,
|
|
37
42
|
validator: _validator,
|
|
@@ -39,7 +44,10 @@ function buildProp(option) {
|
|
|
39
44
|
};
|
|
40
45
|
}
|
|
41
46
|
exports.buildProp = buildProp;
|
|
42
|
-
const buildProps = (
|
|
47
|
+
const buildProps = (props) => (0, fromPairs_1.default)(Object.entries(props).map(([key, option]) => [
|
|
48
|
+
key,
|
|
49
|
+
buildProp(option, key),
|
|
50
|
+
]));
|
|
43
51
|
exports.buildProps = buildProps;
|
|
44
52
|
const definePropType = (val) => ({ [wrapperKey]: val });
|
|
45
53
|
exports.definePropType = definePropType;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { camelize, capitalize, extend, hasOwn, isArray, isObject, isString, looseEqual } from '@vue/shared';
|
|
2
2
|
import type { ComponentPublicInstance, CSSProperties, Ref } from 'vue';
|
|
3
|
-
import type {
|
|
3
|
+
import type { TimeoutHandle, Nullable } from './types';
|
|
4
4
|
export declare const SCOPE = "Util";
|
|
5
5
|
export declare function toObject<T>(arr: Array<T>): Record<string, T>;
|
|
6
6
|
export declare const getValueByPath: (obj: any, paths?: string) => unknown;
|
|
@@ -20,7 +20,7 @@ export { hasOwn, isObject, isArray, isString, capitalize, camelize, looseEqual,
|
|
|
20
20
|
export declare const isBool: (val: unknown) => val is boolean;
|
|
21
21
|
export declare const isNumber: (val: unknown) => val is number;
|
|
22
22
|
export declare const isHTMLElement: (val: unknown) => boolean;
|
|
23
|
-
export declare function rafThrottle<T extends
|
|
23
|
+
export declare function rafThrottle<T extends (...args: any) => any>(fn: T): T;
|
|
24
24
|
export declare const clearTimer: (timer: Ref<TimeoutHandle>) => void;
|
|
25
25
|
export declare function getRandomInt(max: number): number;
|
|
26
26
|
export declare function isUndefined(val: any): val is undefined;
|
|
@@ -57,7 +57,7 @@ function getPropByPath(obj, path, strict) {
|
|
|
57
57
|
}
|
|
58
58
|
else {
|
|
59
59
|
if (strict) {
|
|
60
|
-
|
|
60
|
+
(0, error_1.throwError)(exports.SCOPE, 'Please transfer a valid prop path to form item!');
|
|
61
61
|
}
|
|
62
62
|
break;
|
|
63
63
|
}
|
|
@@ -117,7 +117,7 @@ function rafThrottle(fn) {
|
|
|
117
117
|
return;
|
|
118
118
|
locked = true;
|
|
119
119
|
window.requestAnimationFrame(() => {
|
|
120
|
-
|
|
120
|
+
Reflect.apply(fn, this, args);
|
|
121
121
|
locked = false;
|
|
122
122
|
});
|
|
123
123
|
};
|