naive-ui 2.30.3 → 2.30.4
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/index.js +1385 -901
- package/dist/index.prod.js +2 -2
- package/es/_internal/scrollbar/src/Scrollbar.js +5 -17
- package/es/_internal/select-menu/src/SelectGroupHeader.d.ts +1 -0
- package/es/_internal/select-menu/src/SelectGroupHeader.js +5 -3
- package/es/_internal/select-menu/src/SelectMenu.d.ts +3 -3
- package/es/_internal/select-menu/src/SelectMenu.js +6 -8
- package/es/_internal/select-menu/src/SelectOption.d.ts +1 -0
- package/es/_internal/select-menu/src/SelectOption.js +11 -5
- package/es/_internal/select-menu/src/interface.d.ts +3 -1
- package/es/_internal/selection/src/Selection.d.ts +0 -2
- package/es/_internal/selection/src/Selection.js +2 -2
- package/es/_mixins/use-theme.js +1 -1
- package/es/_utils/composable/index.d.ts +3 -5
- package/es/_utils/composable/index.js +3 -111
- package/es/_utils/composable/use-collection.d.ts +4 -0
- package/es/_utils/composable/use-collection.js +87 -0
- package/es/_utils/composable/use-deferred-true.d.ts +2 -0
- package/es/_utils/composable/use-deferred-true.js +25 -0
- package/es/_utils/composable/use-reactivated.d.ts +3 -0
- package/es/_utils/composable/use-reactivated.js +20 -0
- package/es/_utils/event/index.d.ts +2 -0
- package/es/_utils/event/index.js +7 -0
- package/es/_utils/index.d.ts +2 -1
- package/es/_utils/index.js +2 -1
- package/es/_utils/vue/index.d.ts +1 -0
- package/es/_utils/vue/index.js +1 -0
- package/es/_utils/vue/merge-handlers.d.ts +1 -0
- package/es/_utils/vue/merge-handlers.js +15 -0
- package/es/button/src/Button.js +7 -2
- package/es/cascader/src/Cascader.d.ts +2 -3
- package/es/cascader/src/Cascader.js +26 -22
- package/es/cascader/src/CascaderMenu.d.ts +2 -2
- package/es/cascader/src/CascaderMenu.js +2 -4
- package/es/data-table/src/DataTable.d.ts +787 -0
- package/es/data-table/src/DataTable.js +7 -3
- package/es/data-table/src/HeaderButton/FilterButton.d.ts +142 -0
- package/es/data-table/src/HeaderButton/FilterMenu.d.ts +142 -0
- package/es/data-table/src/MainTable.d.ts +2 -0
- package/es/data-table/src/MainTable.js +5 -1
- package/es/data-table/src/TableParts/Body.d.ts +143 -0
- package/es/data-table/src/TableParts/Body.js +11 -2
- package/es/data-table/src/TableParts/Cell.d.ts +284 -0
- package/es/data-table/src/TableParts/Header.d.ts +143 -0
- package/es/data-table/src/TableParts/Header.js +6 -2
- package/es/data-table/src/interface.d.ts +9 -5
- package/es/data-table/src/use-expand.d.ts +5 -3
- package/es/data-table/src/use-expand.js +22 -2
- package/es/data-table/src/utils.d.ts +2 -2
- package/es/data-table/src/utils.js +10 -8
- package/es/data-table/styles/light.d.ts +71 -0
- package/es/date-picker/src/DatePicker.d.ts +2 -1
- package/es/date-picker/src/DatePicker.js +20 -9
- package/es/date-picker/src/panel/month.js +3 -2
- package/es/drawer/src/Drawer.d.ts +1 -1
- package/es/drawer/src/Drawer.js +3 -3
- package/es/drawer/src/DrawerBodyWrapper.d.ts +2 -2
- package/es/dropdown/src/Dropdown.d.ts +4 -0
- package/es/dynamic-tags/src/DynamicTags.js +1 -1
- package/es/input/src/Input.d.ts +6 -3
- package/es/input/src/Input.js +56 -31
- package/es/input/src/utils.d.ts +7 -1
- package/es/input/src/utils.js +57 -2
- package/es/layout/src/Layout.d.ts +3 -1
- package/es/layout/src/Layout.js +22 -4
- package/es/layout/src/LayoutContent.d.ts +1 -0
- package/es/layout/src/LayoutSider.d.ts +1 -0
- package/es/layout/src/LayoutSider.js +22 -3
- package/es/menu/src/Menu.d.ts +1 -1
- package/es/modal/src/BodyWrapper.d.ts +2 -2
- package/es/modal/src/Modal.js +2 -2
- package/es/pagination/src/Pagination.d.ts +806 -20
- package/es/pagination/src/Pagination.js +115 -52
- package/es/pagination/src/interface.d.ts +2 -2
- package/es/pagination/src/styles/index.cssr.js +12 -10
- package/es/pagination/src/utils.d.ts +15 -5
- package/es/pagination/src/utils.js +117 -50
- package/es/pagination/styles/dark.js +3 -1
- package/es/pagination/styles/light.d.ts +71 -0
- package/es/pagination/styles/light.js +3 -1
- package/es/popconfirm/src/Popconfirm.d.ts +4 -0
- package/es/popover/src/Popover.d.ts +5 -0
- package/es/popover/src/Popover.js +1 -0
- package/es/popover/src/PopoverBody.d.ts +4 -0
- package/es/popover/src/PopoverBody.js +18 -10
- package/es/popselect/src/Popselect.d.ts +24 -0
- package/es/popselect/src/Popselect.js +12 -7
- package/es/popselect/src/PopselectPanel.d.ts +22 -2
- package/es/popselect/src/PopselectPanel.js +12 -1
- package/es/select/src/Select.d.ts +1 -1
- package/es/select/src/Select.js +5 -2
- package/es/slider/src/Slider.d.ts +1 -1
- package/es/slider/src/Slider.js +13 -5
- package/es/slider/src/styles/index.cssr.js +26 -31
- package/es/time-picker/src/TimePicker.d.ts +2 -1
- package/es/time-picker/src/TimePicker.js +18 -8
- package/es/tooltip/src/Tooltip.d.ts +4 -0
- package/es/tree/src/Tree.d.ts +2 -3
- package/es/tree/src/Tree.js +6 -8
- package/es/tree/src/TreeNode.js +4 -1
- package/es/tree/src/interface.d.ts +0 -1
- package/es/tree/src/keyboard.d.ts +0 -1
- package/es/tree/src/keyboard.js +6 -9
- package/es/tree-select/src/TreeSelect.d.ts +1 -3
- package/es/tree-select/src/TreeSelect.js +14 -16
- package/es/upload/src/UploadDragger.js +2 -2
- package/es/upload/src/UploadFile.d.ts +2 -2
- package/es/upload/src/UploadFile.js +9 -4
- package/es/upload/src/UploadTrigger.js +4 -3
- package/es/upload/src/styles/index.cssr.js +2 -2
- package/es/upload/src/utils.js +1 -15
- package/es/version.d.ts +1 -1
- package/es/version.js +1 -1
- package/lib/_internal/scrollbar/src/Scrollbar.js +4 -16
- package/lib/_internal/select-menu/src/SelectGroupHeader.d.ts +1 -0
- package/lib/_internal/select-menu/src/SelectGroupHeader.js +5 -3
- package/lib/_internal/select-menu/src/SelectMenu.d.ts +3 -3
- package/lib/_internal/select-menu/src/SelectMenu.js +5 -7
- package/lib/_internal/select-menu/src/SelectOption.d.ts +1 -0
- package/lib/_internal/select-menu/src/SelectOption.js +10 -4
- package/lib/_internal/select-menu/src/interface.d.ts +3 -1
- package/lib/_internal/selection/src/Selection.d.ts +0 -2
- package/lib/_internal/selection/src/Selection.js +2 -2
- package/lib/_mixins/use-theme.js +1 -1
- package/lib/_utils/composable/index.d.ts +3 -5
- package/lib/_utils/composable/index.js +9 -116
- package/lib/_utils/composable/use-collection.d.ts +4 -0
- package/lib/_utils/composable/use-collection.js +93 -0
- package/lib/_utils/composable/use-deferred-true.d.ts +2 -0
- package/lib/_utils/composable/use-deferred-true.js +29 -0
- package/lib/_utils/composable/use-reactivated.d.ts +3 -0
- package/lib/_utils/composable/use-reactivated.js +24 -0
- package/lib/_utils/event/index.d.ts +2 -0
- package/lib/_utils/event/index.js +12 -0
- package/lib/_utils/index.d.ts +2 -1
- package/lib/_utils/index.js +5 -1
- package/lib/_utils/vue/index.d.ts +1 -0
- package/lib/_utils/vue/index.js +3 -1
- package/lib/_utils/vue/merge-handlers.d.ts +1 -0
- package/lib/_utils/vue/merge-handlers.js +19 -0
- package/lib/button/src/Button.js +7 -2
- package/lib/cascader/src/Cascader.d.ts +2 -3
- package/lib/cascader/src/Cascader.js +25 -21
- package/lib/cascader/src/CascaderMenu.d.ts +2 -2
- package/lib/cascader/src/CascaderMenu.js +2 -4
- package/lib/data-table/src/DataTable.d.ts +787 -0
- package/lib/data-table/src/DataTable.js +7 -3
- package/lib/data-table/src/HeaderButton/FilterButton.d.ts +142 -0
- package/lib/data-table/src/HeaderButton/FilterMenu.d.ts +142 -0
- package/lib/data-table/src/MainTable.d.ts +2 -0
- package/lib/data-table/src/MainTable.js +5 -1
- package/lib/data-table/src/TableParts/Body.d.ts +143 -0
- package/lib/data-table/src/TableParts/Body.js +11 -2
- package/lib/data-table/src/TableParts/Cell.d.ts +284 -0
- package/lib/data-table/src/TableParts/Header.d.ts +143 -0
- package/lib/data-table/src/TableParts/Header.js +6 -2
- package/lib/data-table/src/interface.d.ts +9 -5
- package/lib/data-table/src/use-expand.d.ts +5 -3
- package/lib/data-table/src/use-expand.js +22 -2
- package/lib/data-table/src/utils.d.ts +2 -2
- package/lib/data-table/src/utils.js +11 -9
- package/lib/data-table/styles/light.d.ts +71 -0
- package/lib/date-picker/src/DatePicker.d.ts +2 -1
- package/lib/date-picker/src/DatePicker.js +19 -8
- package/lib/date-picker/src/panel/month.js +3 -2
- package/lib/drawer/src/Drawer.d.ts +1 -1
- package/lib/drawer/src/Drawer.js +2 -2
- package/lib/drawer/src/DrawerBodyWrapper.d.ts +2 -2
- package/lib/dropdown/src/Dropdown.d.ts +4 -0
- package/lib/dynamic-tags/src/DynamicTags.js +1 -1
- package/lib/input/src/Input.d.ts +6 -3
- package/lib/input/src/Input.js +55 -30
- package/lib/input/src/utils.d.ts +7 -1
- package/lib/input/src/utils.js +60 -4
- package/lib/layout/src/Layout.d.ts +3 -1
- package/lib/layout/src/Layout.js +22 -4
- package/lib/layout/src/LayoutContent.d.ts +1 -0
- package/lib/layout/src/LayoutSider.d.ts +1 -0
- package/lib/layout/src/LayoutSider.js +21 -2
- package/lib/menu/src/Menu.d.ts +1 -1
- package/lib/modal/src/BodyWrapper.d.ts +2 -2
- package/lib/modal/src/Modal.js +1 -1
- package/lib/pagination/src/Pagination.d.ts +806 -20
- package/lib/pagination/src/Pagination.js +114 -51
- package/lib/pagination/src/interface.d.ts +2 -2
- package/lib/pagination/src/styles/index.cssr.js +13 -11
- package/lib/pagination/src/utils.d.ts +15 -5
- package/lib/pagination/src/utils.js +118 -53
- package/lib/pagination/styles/dark.js +6 -4
- package/lib/pagination/styles/light.d.ts +71 -0
- package/lib/pagination/styles/light.js +6 -4
- package/lib/popconfirm/src/Popconfirm.d.ts +4 -0
- package/lib/popover/src/Popover.d.ts +5 -0
- package/lib/popover/src/Popover.js +1 -0
- package/lib/popover/src/PopoverBody.d.ts +4 -0
- package/lib/popover/src/PopoverBody.js +18 -10
- package/lib/popselect/src/Popselect.d.ts +24 -0
- package/lib/popselect/src/Popselect.js +10 -5
- package/lib/popselect/src/PopselectPanel.d.ts +22 -2
- package/lib/popselect/src/PopselectPanel.js +12 -1
- package/lib/select/src/Select.d.ts +1 -1
- package/lib/select/src/Select.js +4 -1
- package/lib/slider/src/Slider.d.ts +1 -1
- package/lib/slider/src/Slider.js +12 -4
- package/lib/slider/src/styles/index.cssr.js +26 -31
- package/lib/time-picker/src/TimePicker.d.ts +2 -1
- package/lib/time-picker/src/TimePicker.js +17 -7
- package/lib/tooltip/src/Tooltip.d.ts +4 -0
- package/lib/tree/src/Tree.d.ts +2 -3
- package/lib/tree/src/Tree.js +6 -8
- package/lib/tree/src/TreeNode.js +4 -1
- package/lib/tree/src/interface.d.ts +0 -1
- package/lib/tree/src/keyboard.d.ts +0 -1
- package/lib/tree/src/keyboard.js +6 -9
- package/lib/tree-select/src/TreeSelect.d.ts +1 -3
- package/lib/tree-select/src/TreeSelect.js +13 -15
- package/lib/upload/src/UploadDragger.js +2 -2
- package/lib/upload/src/UploadFile.d.ts +2 -2
- package/lib/upload/src/UploadFile.js +9 -4
- package/lib/upload/src/UploadTrigger.js +3 -2
- package/lib/upload/src/styles/index.cssr.js +2 -2
- package/lib/upload/src/utils.js +1 -15
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +2 -2
- package/web-types.json +37 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PropType } from 'vue';
|
|
2
2
|
import { TreeNode } from 'treemate';
|
|
3
3
|
import type { SelectOption, SelectGroupOption, SelectIgnoredOption, Value, SelectTreeMate } from '../../../select/src/interface';
|
|
4
|
-
import type { RenderLabel, Size, RenderOption } from './interface';
|
|
4
|
+
import type { RenderLabel, Size, RenderOption, NodeProps } from './interface';
|
|
5
5
|
declare const _default: import("vue").DefineComponent<{
|
|
6
6
|
clsPrefix: {
|
|
7
7
|
type: StringConstructor;
|
|
@@ -24,7 +24,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
24
24
|
type: PropType<Value | null>;
|
|
25
25
|
default: null;
|
|
26
26
|
};
|
|
27
|
-
width: (StringConstructor | NumberConstructor)[];
|
|
28
27
|
autoPending: BooleanConstructor;
|
|
29
28
|
virtualScroll: {
|
|
30
29
|
type: BooleanConstructor;
|
|
@@ -46,6 +45,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
46
45
|
focusable: BooleanConstructor;
|
|
47
46
|
renderLabel: PropType<RenderLabel>;
|
|
48
47
|
renderOption: PropType<RenderOption>;
|
|
48
|
+
nodeProps: PropType<NodeProps>;
|
|
49
49
|
showCheckmark: {
|
|
50
50
|
type: BooleanConstructor;
|
|
51
51
|
default: boolean;
|
|
@@ -483,7 +483,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
483
483
|
type: PropType<Value | null>;
|
|
484
484
|
default: null;
|
|
485
485
|
};
|
|
486
|
-
width: (StringConstructor | NumberConstructor)[];
|
|
487
486
|
autoPending: BooleanConstructor;
|
|
488
487
|
virtualScroll: {
|
|
489
488
|
type: BooleanConstructor;
|
|
@@ -505,6 +504,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
505
504
|
focusable: BooleanConstructor;
|
|
506
505
|
renderLabel: PropType<RenderLabel>;
|
|
507
506
|
renderOption: PropType<RenderOption>;
|
|
507
|
+
nodeProps: PropType<NodeProps>;
|
|
508
508
|
showCheckmark: {
|
|
509
509
|
type: BooleanConstructor;
|
|
510
510
|
default: boolean;
|
|
@@ -36,7 +36,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
36
36
|
}, value: {
|
|
37
37
|
type: [String, Number, Array],
|
|
38
38
|
default: null
|
|
39
|
-
},
|
|
39
|
+
}, autoPending: Boolean, virtualScroll: {
|
|
40
40
|
type: Boolean,
|
|
41
41
|
default: true
|
|
42
42
|
},
|
|
@@ -50,7 +50,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
50
50
|
}, valueField: {
|
|
51
51
|
type: String,
|
|
52
52
|
default: 'value'
|
|
53
|
-
}, loading: Boolean, focusable: Boolean, renderLabel: Function, renderOption: Function, showCheckmark: { type: Boolean, default: true }, onMousedown: Function, onScroll: Function, onFocus: Function, onBlur: Function, onKeyup: Function, onKeydown: Function, onTabOut: Function, onMouseenter: Function, onMouseleave: Function, onResize: Function, resetMenuOnOptionsChange: {
|
|
53
|
+
}, loading: Boolean, focusable: Boolean, renderLabel: Function, renderOption: Function, nodeProps: Function, showCheckmark: { type: Boolean, default: true }, onMousedown: Function, onScroll: Function, onFocus: Function, onBlur: Function, onKeyup: Function, onKeydown: Function, onTabOut: Function, onMouseenter: Function, onMouseleave: Function, onResize: Function, resetMenuOnOptionsChange: {
|
|
54
54
|
type: Boolean,
|
|
55
55
|
default: true
|
|
56
56
|
}, inlineThemeDisabled: Boolean,
|
|
@@ -247,12 +247,13 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
247
247
|
handleOptionMouseEnter,
|
|
248
248
|
handleOptionClick,
|
|
249
249
|
valueSetRef,
|
|
250
|
+
pendingTmNodeRef: pendingNodeRef,
|
|
251
|
+
nodePropsRef: (0, vue_1.toRef)(props, 'nodeProps'),
|
|
250
252
|
showCheckmarkRef: (0, vue_1.toRef)(props, 'showCheckmark'),
|
|
251
253
|
multipleRef: (0, vue_1.toRef)(props, 'multiple'),
|
|
252
254
|
valueRef: (0, vue_1.toRef)(props, 'value'),
|
|
253
255
|
renderLabelRef: (0, vue_1.toRef)(props, 'renderLabel'),
|
|
254
256
|
renderOptionRef: (0, vue_1.toRef)(props, 'renderOption'),
|
|
255
|
-
pendingTmNodeRef: pendingNodeRef,
|
|
256
257
|
labelFieldRef: (0, vue_1.toRef)(props, 'labelField'),
|
|
257
258
|
valueFieldRef: (0, vue_1.toRef)(props, 'valueField')
|
|
258
259
|
});
|
|
@@ -327,10 +328,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
327
328
|
`${clsPrefix}-base-select-menu`,
|
|
328
329
|
themeClass,
|
|
329
330
|
this.multiple && `${clsPrefix}-base-select-menu--multiple`
|
|
330
|
-
], style:
|
|
331
|
-
{ width: (0, _utils_1.formatLength)(this.width) },
|
|
332
|
-
this.cssVars
|
|
333
|
-
], onFocusin: this.handleFocusin, onFocusout: this.handleFocusout, onKeyup: this.handleKeyUp, onKeydown: this.handleKeyDown, onMousedown: this.handleMouseDown, onMouseenter: this.onMouseenter, onMouseleave: this.onMouseleave },
|
|
331
|
+
], style: this.cssVars, onFocusin: this.handleFocusin, onFocusout: this.handleFocusout, onKeyup: this.handleKeyUp, onKeydown: this.handleKeyDown, onMousedown: this.handleMouseDown, onMouseenter: this.onMouseenter, onMouseleave: this.onMouseleave },
|
|
334
332
|
this.loading ? ((0, vue_1.h)("div", { class: `${clsPrefix}-base-select-menu__loading` },
|
|
335
333
|
(0, vue_1.h)(loading_1.default, { clsPrefix: clsPrefix, strokeWidth: 20 }))) : !this.empty ? ((0, vue_1.h)(scrollbar_1.NScrollbar, { ref: "scrollbarRef", theme: mergedTheme.peers.Scrollbar, themeOverrides: mergedTheme.peerOverrides.Scrollbar, scrollable: this.scrollable, container: virtualScroll ? this.virtualListContainer : undefined, content: virtualScroll ? this.virtualListContent : undefined, onScroll: virtualScroll ? undefined : this.doScroll }, {
|
|
336
334
|
default: () => {
|
|
@@ -15,6 +15,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
15
15
|
multiple: Ref<boolean>;
|
|
16
16
|
isGrouped: import("vue").ComputedRef<boolean | null>;
|
|
17
17
|
showCheckmark: Ref<boolean>;
|
|
18
|
+
nodeProps: Ref<import("./interface").NodeProps | undefined>;
|
|
18
19
|
isPending: import("vue").ComputedRef<boolean>;
|
|
19
20
|
isSelected: import("vue").ComputedRef<boolean>;
|
|
20
21
|
labelField: Ref<string>;
|
|
@@ -27,7 +27,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
setup(props) {
|
|
30
|
-
const { valueRef, pendingTmNodeRef, multipleRef, valueSetRef, renderLabelRef, renderOptionRef, labelFieldRef, valueFieldRef, showCheckmarkRef, handleOptionClick, handleOptionMouseEnter
|
|
30
|
+
const { valueRef, pendingTmNodeRef, multipleRef, valueSetRef, renderLabelRef, renderOptionRef, labelFieldRef, valueFieldRef, showCheckmarkRef, nodePropsRef, handleOptionClick, handleOptionMouseEnter
|
|
31
31
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
32
32
|
} = (0, vue_1.inject)(interface_1.internalSelectionMenuInjectionKey);
|
|
33
33
|
const isPendingRef = (0, vooks_1.useMemo)(() => {
|
|
@@ -63,6 +63,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
63
63
|
return parent && parent.rawNode.type === 'group';
|
|
64
64
|
}),
|
|
65
65
|
showCheckmark: showCheckmarkRef,
|
|
66
|
+
nodeProps: nodePropsRef,
|
|
66
67
|
isPending: isPendingRef,
|
|
67
68
|
isSelected: (0, vooks_1.useMemo)(() => {
|
|
68
69
|
const { value } = valueRef;
|
|
@@ -87,7 +88,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
87
88
|
};
|
|
88
89
|
},
|
|
89
90
|
render() {
|
|
90
|
-
const { clsPrefix, tmNode: { rawNode }, isSelected, isPending, isGrouped, showCheckmark, renderOption, renderLabel, handleClick, handleMouseEnter, handleMouseMove } = this;
|
|
91
|
+
const { clsPrefix, tmNode: { rawNode }, isSelected, isPending, isGrouped, showCheckmark, nodeProps, renderOption, renderLabel, handleClick, handleMouseEnter, handleMouseMove } = this;
|
|
91
92
|
const checkmark = renderCheckMark(isSelected, clsPrefix);
|
|
92
93
|
const children = renderLabel
|
|
93
94
|
? [renderLabel(rawNode, isSelected), showCheckmark && checkmark]
|
|
@@ -95,9 +96,11 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
95
96
|
(0, _utils_1.render)(rawNode[this.labelField], rawNode, isSelected),
|
|
96
97
|
showCheckmark && checkmark
|
|
97
98
|
];
|
|
98
|
-
const
|
|
99
|
+
const attrs = nodeProps === null || nodeProps === void 0 ? void 0 : nodeProps(rawNode);
|
|
100
|
+
const node = ((0, vue_1.h)("div", Object.assign({}, attrs, { class: [
|
|
99
101
|
`${clsPrefix}-base-select-option`,
|
|
100
102
|
rawNode.class,
|
|
103
|
+
attrs === null || attrs === void 0 ? void 0 : attrs.class,
|
|
101
104
|
{
|
|
102
105
|
[`${clsPrefix}-base-select-option--disabled`]: rawNode.disabled,
|
|
103
106
|
[`${clsPrefix}-base-select-option--selected`]: isSelected,
|
|
@@ -105,7 +108,10 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
105
108
|
[`${clsPrefix}-base-select-option--pending`]: isPending,
|
|
106
109
|
[`${clsPrefix}-base-select-option--show-checkmark`]: showCheckmark
|
|
107
110
|
}
|
|
108
|
-
], style: rawNode.style, onClick: handleClick,
|
|
111
|
+
], style: [(attrs === null || attrs === void 0 ? void 0 : attrs.style) || '', rawNode.style || ''], onClick: (0, _utils_1.mergeEventHandlers)([handleClick, attrs === null || attrs === void 0 ? void 0 : attrs.onClick]), onMouseenter: (0, _utils_1.mergeEventHandlers)([
|
|
112
|
+
handleMouseEnter,
|
|
113
|
+
attrs === null || attrs === void 0 ? void 0 : attrs.onMouseenter
|
|
114
|
+
]), onMousemove: (0, _utils_1.mergeEventHandlers)([handleMouseMove, attrs === null || attrs === void 0 ? void 0 : attrs.onMousemove]) }),
|
|
109
115
|
(0, vue_1.h)("div", { class: `${clsPrefix}-base-select-option__content` }, children)));
|
|
110
116
|
return rawNode.render
|
|
111
117
|
? rawNode.render({ node, option: rawNode, selected: isSelected })
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { VNodeChild, Ref, UnwrapRef, VNode } from 'vue';
|
|
1
|
+
import { VNodeChild, Ref, UnwrapRef, VNode, HTMLAttributes } from 'vue';
|
|
2
2
|
import { TreeNode } from 'treemate';
|
|
3
3
|
import type { SelectBaseOption, SelectGroupOption, SelectIgnoredOption } from '../../../select/src/interface';
|
|
4
4
|
export declare type Size = 'small' | 'medium' | 'large' | 'huge';
|
|
@@ -14,6 +14,7 @@ export declare type RenderOptionImpl = (info: {
|
|
|
14
14
|
option: SelectBaseOption | SelectGroupOption | SelectIgnoredOption;
|
|
15
15
|
selected: boolean;
|
|
16
16
|
}) => VNodeChild;
|
|
17
|
+
export declare type NodeProps = (option: SelectBaseOption | SelectGroupOption) => HTMLAttributes & Record<string, unknown>;
|
|
17
18
|
export interface InternalSelectMenuInjection {
|
|
18
19
|
handleOptionMouseEnter: (e: MouseEvent, tmNode: TreeNode<SelectBaseOption>) => void;
|
|
19
20
|
handleOptionClick: (e: MouseEvent, tmNode: TreeNode<SelectBaseOption>) => void;
|
|
@@ -26,6 +27,7 @@ export interface InternalSelectMenuInjection {
|
|
|
26
27
|
renderOptionRef: Ref<RenderOption | undefined>;
|
|
27
28
|
labelFieldRef: Ref<string>;
|
|
28
29
|
valueFieldRef: Ref<string>;
|
|
30
|
+
nodePropsRef: Ref<NodeProps | undefined>;
|
|
29
31
|
}
|
|
30
32
|
export interface InternalExposedProps {
|
|
31
33
|
selfRef: Ref<HTMLElement | null>;
|
|
@@ -58,7 +58,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
58
58
|
inputProps: PropType<InputHTMLAttributes>;
|
|
59
59
|
focused: BooleanConstructor;
|
|
60
60
|
renderTag: PropType<RenderTag>;
|
|
61
|
-
onKeyup: PropType<(e: KeyboardEvent) => void>;
|
|
62
61
|
onKeydown: PropType<(e: KeyboardEvent) => void>;
|
|
63
62
|
onClick: PropType<(e: MouseEvent) => void>;
|
|
64
63
|
onBlur: PropType<(e: FocusEvent) => void>;
|
|
@@ -608,7 +607,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
608
607
|
inputProps: PropType<InputHTMLAttributes>;
|
|
609
608
|
focused: BooleanConstructor;
|
|
610
609
|
renderTag: PropType<RenderTag>;
|
|
611
|
-
onKeyup: PropType<(e: KeyboardEvent) => void>;
|
|
612
610
|
onKeydown: PropType<(e: KeyboardEvent) => void>;
|
|
613
611
|
onClick: PropType<(e: MouseEvent) => void>;
|
|
614
612
|
onBlur: PropType<(e: FocusEvent) => void>;
|
|
@@ -39,7 +39,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
39
39
|
}, loading: Boolean, autofocus: Boolean, showArrow: {
|
|
40
40
|
type: Boolean,
|
|
41
41
|
default: true
|
|
42
|
-
}, inputProps: Object, focused: Boolean, renderTag: Function,
|
|
42
|
+
}, inputProps: Object, focused: Boolean, renderTag: Function, onKeydown: Function, onClick: Function, onBlur: Function, onFocus: Function, onDeleteOption: Function, maxTagCount: [String, Number], onClear: Function, onPatternInput: Function, onPatternFocus: Function, onPatternBlur: Function, renderLabel: Function, status: String, inlineThemeDisabled: Boolean, onResize: Function }),
|
|
43
43
|
setup(props) {
|
|
44
44
|
const patternInputMirrorRef = (0, vue_1.ref)(null);
|
|
45
45
|
const patternInputRef = (0, vue_1.ref)(null);
|
|
@@ -566,7 +566,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
566
566
|
// many redundant codes.
|
|
567
567
|
[`${clsPrefix}-base-selection--focus`]: this.focused
|
|
568
568
|
}
|
|
569
|
-
], style: this.cssVars, onClick: this.onClick, onMouseenter: this.handleMouseEnter, onMouseleave: this.handleMouseLeave,
|
|
569
|
+
], style: this.cssVars, onClick: this.onClick, onMouseenter: this.handleMouseEnter, onMouseleave: this.handleMouseLeave, onKeydown: this.onKeydown, onFocusin: this.handleFocusin, onFocusout: this.handleFocusout, onMousedown: this.handleMouseDown },
|
|
570
570
|
body,
|
|
571
571
|
bordered ? ((0, vue_1.h)("div", { class: `${clsPrefix}-base-selection__border` })) : null,
|
|
572
572
|
bordered ? ((0, vue_1.h)("div", { class: `${clsPrefix}-base-selection__state-border` })) : null));
|
package/lib/_mixins/use-theme.js
CHANGED
|
@@ -62,7 +62,7 @@ function useTheme(resolveId, mountId, style, defaultTheme, props, clsPrefixRef)
|
|
|
62
62
|
common: mergedCommon,
|
|
63
63
|
self: mergedSelf,
|
|
64
64
|
peers: (0, lodash_1.merge)({}, defaultTheme.peers, globalPeers, peers),
|
|
65
|
-
peerOverrides: (0, lodash_1.merge)({}, globalPeersOverrides, peersOverrides)
|
|
65
|
+
peerOverrides: (0, lodash_1.merge)({}, builtinOverrides.peers, globalPeersOverrides, peersOverrides)
|
|
66
66
|
};
|
|
67
67
|
});
|
|
68
68
|
return mergedThemeRef;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
export declare function useInjectionCollection(injectionName: string | InjectionKey<unknown>, collectionKey: string, valueRef: Ref<any>): void;
|
|
4
|
-
export declare function useInjectionElementCollection(injectionName: string | InjectionKey<unknown>, collectionKey: string, getElement: () => HTMLElement | null): void;
|
|
5
|
-
export declare function useDeferredTrue(valueRef: Ref<any>, delay: number, shouldDelayRef: Ref<boolean>): Ref<boolean>;
|
|
1
|
+
export { useInjectionCollection, useInjectionElementCollection, useInjectionInstanceCollection } from './use-collection';
|
|
2
|
+
export { useDeferredTrue } from './use-deferred-true';
|
|
6
3
|
export { useAdjustedTo } from './use-adjusted-to';
|
|
7
4
|
export { useHoudini } from './use-houdini';
|
|
8
5
|
export { useOnResize } from './use-resize';
|
|
9
6
|
export { useLockHtmlScroll, lockHtmlScrollRightCompensationRef } from './use-lock-html-scroll';
|
|
10
7
|
export { useIsComposing } from './use-is-composing';
|
|
8
|
+
export { useReactivated } from './use-reactivated';
|
|
@@ -1,121 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useIsComposing = exports.lockHtmlScrollRightCompensationRef = exports.useLockHtmlScroll = exports.useOnResize = exports.useHoudini = exports.useAdjustedTo = exports.useDeferredTrue = exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _a;
|
|
11
|
-
const injection = (0, vue_1.inject)(injectionName, null);
|
|
12
|
-
if (injection === null)
|
|
13
|
-
return;
|
|
14
|
-
const vm = (_a = (0, vue_1.getCurrentInstance)()) === null || _a === void 0 ? void 0 : _a.proxy;
|
|
15
|
-
(0, vue_1.watch)(registerKeyRef, registerInstance);
|
|
16
|
-
registerInstance(registerKeyRef.value);
|
|
17
|
-
(0, vue_1.onBeforeUnmount)(() => {
|
|
18
|
-
registerInstance(undefined, registerKeyRef.value);
|
|
19
|
-
});
|
|
20
|
-
function registerInstance(key, oldKey) {
|
|
21
|
-
const collection = injection[collectionKey];
|
|
22
|
-
if (oldKey !== undefined)
|
|
23
|
-
removeInstance(collection, oldKey);
|
|
24
|
-
if (key !== undefined)
|
|
25
|
-
addInstance(collection, key);
|
|
26
|
-
}
|
|
27
|
-
function removeInstance(collection, key) {
|
|
28
|
-
if (!collection[key])
|
|
29
|
-
collection[key] = [];
|
|
30
|
-
collection[key].splice(collection[key].findIndex((instance) => instance === vm), 1);
|
|
31
|
-
}
|
|
32
|
-
function addInstance(collection, key) {
|
|
33
|
-
if (!collection[key])
|
|
34
|
-
collection[key] = [];
|
|
35
|
-
if (!~collection[key].findIndex((instance) => instance === vm)) {
|
|
36
|
-
collection[key].push(vm);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
exports.useInjectionInstanceCollection = useInjectionInstanceCollection;
|
|
41
|
-
// injection.collection {
|
|
42
|
-
// key1: [insta.value, instb.value]
|
|
43
|
-
// key2: [instc.value]
|
|
44
|
-
// }
|
|
45
|
-
function useInjectionCollection(injectionName, collectionKey, valueRef) {
|
|
46
|
-
const injection = (0, vue_1.inject)(injectionName, null);
|
|
47
|
-
if (injection === null)
|
|
48
|
-
return;
|
|
49
|
-
if (!(collectionKey in injection)) {
|
|
50
|
-
injection[collectionKey] = [];
|
|
51
|
-
}
|
|
52
|
-
injection[collectionKey].push(valueRef.value);
|
|
53
|
-
(0, vue_1.watch)(valueRef, (value, prevValue) => {
|
|
54
|
-
const collectionArray = injection[collectionKey];
|
|
55
|
-
const index = collectionArray.findIndex((collectionValue) => collectionValue === prevValue);
|
|
56
|
-
if (~index)
|
|
57
|
-
collectionArray.splice(index, 1);
|
|
58
|
-
collectionArray.push(value);
|
|
59
|
-
});
|
|
60
|
-
(0, vue_1.onBeforeUnmount)(() => {
|
|
61
|
-
const collectionArray = injection[collectionKey];
|
|
62
|
-
const index = collectionArray.findIndex((collectionValue) => collectionValue === valueRef.value);
|
|
63
|
-
if (~index)
|
|
64
|
-
collectionArray.splice(index, 1);
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
exports.useInjectionCollection = useInjectionCollection;
|
|
68
|
-
// injection.collection {
|
|
69
|
-
// key1: [insta.$el, instb.$el]
|
|
70
|
-
// key2: [instc.$el]
|
|
71
|
-
// }
|
|
72
|
-
function useInjectionElementCollection(injectionName, collectionKey, getElement) {
|
|
73
|
-
const injection = (0, vue_1.inject)(injectionName, null);
|
|
74
|
-
if (injection === null)
|
|
75
|
-
return;
|
|
76
|
-
if (!(collectionKey in injection)) {
|
|
77
|
-
injection[collectionKey] = [];
|
|
78
|
-
}
|
|
79
|
-
(0, vue_1.onMounted)(() => {
|
|
80
|
-
const el = getElement();
|
|
81
|
-
if (!el)
|
|
82
|
-
return;
|
|
83
|
-
injection[collectionKey].push(el);
|
|
84
|
-
});
|
|
85
|
-
(0, vue_1.onBeforeUnmount)(() => {
|
|
86
|
-
const collectionArray = injection[collectionKey];
|
|
87
|
-
const element = getElement();
|
|
88
|
-
const index = collectionArray.findIndex((collectionElement) => collectionElement === element);
|
|
89
|
-
if (~index)
|
|
90
|
-
collectionArray.splice(index, 1);
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
exports.useInjectionElementCollection = useInjectionElementCollection;
|
|
94
|
-
function useDeferredTrue(valueRef, delay, shouldDelayRef) {
|
|
95
|
-
if (!delay)
|
|
96
|
-
return valueRef;
|
|
97
|
-
const delayedRef = (0, vue_1.ref)(valueRef.value);
|
|
98
|
-
let timerId = null;
|
|
99
|
-
(0, vue_1.watch)(valueRef, (value) => {
|
|
100
|
-
if (timerId !== null)
|
|
101
|
-
window.clearTimeout(timerId);
|
|
102
|
-
if (value === true) {
|
|
103
|
-
if (shouldDelayRef && !shouldDelayRef.value) {
|
|
104
|
-
delayedRef.value = true;
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
timerId = window.setTimeout(() => {
|
|
108
|
-
delayedRef.value = true;
|
|
109
|
-
}, delay);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
delayedRef.value = false;
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
return delayedRef;
|
|
117
|
-
}
|
|
118
|
-
exports.useDeferredTrue = useDeferredTrue;
|
|
3
|
+
exports.useReactivated = exports.useIsComposing = exports.lockHtmlScrollRightCompensationRef = exports.useLockHtmlScroll = exports.useOnResize = exports.useHoudini = exports.useAdjustedTo = exports.useDeferredTrue = exports.useInjectionInstanceCollection = exports.useInjectionElementCollection = exports.useInjectionCollection = void 0;
|
|
4
|
+
var use_collection_1 = require("./use-collection");
|
|
5
|
+
Object.defineProperty(exports, "useInjectionCollection", { enumerable: true, get: function () { return use_collection_1.useInjectionCollection; } });
|
|
6
|
+
Object.defineProperty(exports, "useInjectionElementCollection", { enumerable: true, get: function () { return use_collection_1.useInjectionElementCollection; } });
|
|
7
|
+
Object.defineProperty(exports, "useInjectionInstanceCollection", { enumerable: true, get: function () { return use_collection_1.useInjectionInstanceCollection; } });
|
|
8
|
+
var use_deferred_true_1 = require("./use-deferred-true");
|
|
9
|
+
Object.defineProperty(exports, "useDeferredTrue", { enumerable: true, get: function () { return use_deferred_true_1.useDeferredTrue; } });
|
|
119
10
|
var use_adjusted_to_1 = require("./use-adjusted-to");
|
|
120
11
|
Object.defineProperty(exports, "useAdjustedTo", { enumerable: true, get: function () { return use_adjusted_to_1.useAdjustedTo; } });
|
|
121
12
|
var use_houdini_1 = require("./use-houdini");
|
|
@@ -127,3 +18,5 @@ Object.defineProperty(exports, "useLockHtmlScroll", { enumerable: true, get: fun
|
|
|
127
18
|
Object.defineProperty(exports, "lockHtmlScrollRightCompensationRef", { enumerable: true, get: function () { return use_lock_html_scroll_1.lockHtmlScrollRightCompensationRef; } });
|
|
128
19
|
var use_is_composing_1 = require("./use-is-composing");
|
|
129
20
|
Object.defineProperty(exports, "useIsComposing", { enumerable: true, get: function () { return use_is_composing_1.useIsComposing; } });
|
|
21
|
+
var use_reactivated_1 = require("./use-reactivated");
|
|
22
|
+
Object.defineProperty(exports, "useReactivated", { enumerable: true, get: function () { return use_reactivated_1.useReactivated; } });
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Ref, InjectionKey } from 'vue';
|
|
2
|
+
export declare function useInjectionInstanceCollection(injectionName: string | InjectionKey<unknown>, collectionKey: string, registerKeyRef: Ref<any>): void;
|
|
3
|
+
export declare function useInjectionCollection(injectionName: string | InjectionKey<unknown>, collectionKey: string, valueRef: Ref<any>): void;
|
|
4
|
+
export declare function useInjectionElementCollection(injectionName: string | InjectionKey<unknown>, collectionKey: string, getElement: () => HTMLElement | null): void;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useInjectionElementCollection = exports.useInjectionCollection = exports.useInjectionInstanceCollection = void 0;
|
|
4
|
+
const vue_1 = require("vue");
|
|
5
|
+
// injection.collection {
|
|
6
|
+
// key1: [insta, instb]
|
|
7
|
+
// key2: [instc]
|
|
8
|
+
// }
|
|
9
|
+
function useInjectionInstanceCollection(injectionName, collectionKey, registerKeyRef) {
|
|
10
|
+
var _a;
|
|
11
|
+
const injection = (0, vue_1.inject)(injectionName, null);
|
|
12
|
+
if (injection === null)
|
|
13
|
+
return;
|
|
14
|
+
const vm = (_a = (0, vue_1.getCurrentInstance)()) === null || _a === void 0 ? void 0 : _a.proxy;
|
|
15
|
+
(0, vue_1.watch)(registerKeyRef, registerInstance);
|
|
16
|
+
registerInstance(registerKeyRef.value);
|
|
17
|
+
(0, vue_1.onBeforeUnmount)(() => {
|
|
18
|
+
registerInstance(undefined, registerKeyRef.value);
|
|
19
|
+
});
|
|
20
|
+
function registerInstance(key, oldKey) {
|
|
21
|
+
const collection = injection[collectionKey];
|
|
22
|
+
if (oldKey !== undefined)
|
|
23
|
+
removeInstance(collection, oldKey);
|
|
24
|
+
if (key !== undefined)
|
|
25
|
+
addInstance(collection, key);
|
|
26
|
+
}
|
|
27
|
+
function removeInstance(collection, key) {
|
|
28
|
+
if (!collection[key])
|
|
29
|
+
collection[key] = [];
|
|
30
|
+
collection[key].splice(collection[key].findIndex((instance) => instance === vm), 1);
|
|
31
|
+
}
|
|
32
|
+
function addInstance(collection, key) {
|
|
33
|
+
if (!collection[key])
|
|
34
|
+
collection[key] = [];
|
|
35
|
+
if (!~collection[key].findIndex((instance) => instance === vm)) {
|
|
36
|
+
collection[key].push(vm);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.useInjectionInstanceCollection = useInjectionInstanceCollection;
|
|
41
|
+
// injection.collection {
|
|
42
|
+
// key1: [insta.value, instb.value]
|
|
43
|
+
// key2: [instc.value]
|
|
44
|
+
// }
|
|
45
|
+
function useInjectionCollection(injectionName, collectionKey, valueRef) {
|
|
46
|
+
const injection = (0, vue_1.inject)(injectionName, null);
|
|
47
|
+
if (injection === null)
|
|
48
|
+
return;
|
|
49
|
+
if (!(collectionKey in injection)) {
|
|
50
|
+
injection[collectionKey] = [];
|
|
51
|
+
}
|
|
52
|
+
injection[collectionKey].push(valueRef.value);
|
|
53
|
+
(0, vue_1.watch)(valueRef, (value, prevValue) => {
|
|
54
|
+
const collectionArray = injection[collectionKey];
|
|
55
|
+
const index = collectionArray.findIndex((collectionValue) => collectionValue === prevValue);
|
|
56
|
+
if (~index)
|
|
57
|
+
collectionArray.splice(index, 1);
|
|
58
|
+
collectionArray.push(value);
|
|
59
|
+
});
|
|
60
|
+
(0, vue_1.onBeforeUnmount)(() => {
|
|
61
|
+
const collectionArray = injection[collectionKey];
|
|
62
|
+
const index = collectionArray.findIndex((collectionValue) => collectionValue === valueRef.value);
|
|
63
|
+
if (~index)
|
|
64
|
+
collectionArray.splice(index, 1);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
exports.useInjectionCollection = useInjectionCollection;
|
|
68
|
+
// injection.collection {
|
|
69
|
+
// key1: [insta.$el, instb.$el]
|
|
70
|
+
// key2: [instc.$el]
|
|
71
|
+
// }
|
|
72
|
+
function useInjectionElementCollection(injectionName, collectionKey, getElement) {
|
|
73
|
+
const injection = (0, vue_1.inject)(injectionName, null);
|
|
74
|
+
if (injection === null)
|
|
75
|
+
return;
|
|
76
|
+
if (!(collectionKey in injection)) {
|
|
77
|
+
injection[collectionKey] = [];
|
|
78
|
+
}
|
|
79
|
+
(0, vue_1.onMounted)(() => {
|
|
80
|
+
const el = getElement();
|
|
81
|
+
if (!el)
|
|
82
|
+
return;
|
|
83
|
+
injection[collectionKey].push(el);
|
|
84
|
+
});
|
|
85
|
+
(0, vue_1.onBeforeUnmount)(() => {
|
|
86
|
+
const collectionArray = injection[collectionKey];
|
|
87
|
+
const element = getElement();
|
|
88
|
+
const index = collectionArray.findIndex((collectionElement) => collectionElement === element);
|
|
89
|
+
if (~index)
|
|
90
|
+
collectionArray.splice(index, 1);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
exports.useInjectionElementCollection = useInjectionElementCollection;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useDeferredTrue = void 0;
|
|
4
|
+
const vue_1 = require("vue");
|
|
5
|
+
function useDeferredTrue(valueRef, delay, shouldDelayRef) {
|
|
6
|
+
if (!delay)
|
|
7
|
+
return valueRef;
|
|
8
|
+
const delayedRef = (0, vue_1.ref)(valueRef.value);
|
|
9
|
+
let timerId = null;
|
|
10
|
+
(0, vue_1.watch)(valueRef, (value) => {
|
|
11
|
+
if (timerId !== null)
|
|
12
|
+
window.clearTimeout(timerId);
|
|
13
|
+
if (value === true) {
|
|
14
|
+
if (shouldDelayRef && !shouldDelayRef.value) {
|
|
15
|
+
delayedRef.value = true;
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
timerId = window.setTimeout(() => {
|
|
19
|
+
delayedRef.value = true;
|
|
20
|
+
}, delay);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
delayedRef.value = false;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
return delayedRef;
|
|
28
|
+
}
|
|
29
|
+
exports.useDeferredTrue = useDeferredTrue;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useReactivated = void 0;
|
|
4
|
+
const vue_1 = require("vue");
|
|
5
|
+
function useReactivated(callback) {
|
|
6
|
+
const isDeactivatedRef = { isDeactivated: false };
|
|
7
|
+
let activateStateInitialized = false;
|
|
8
|
+
(0, vue_1.onActivated)(() => {
|
|
9
|
+
isDeactivatedRef.isDeactivated = false;
|
|
10
|
+
if (!activateStateInitialized) {
|
|
11
|
+
activateStateInitialized = true;
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
callback();
|
|
15
|
+
});
|
|
16
|
+
(0, vue_1.onDeactivated)(() => {
|
|
17
|
+
isDeactivatedRef.isDeactivated = true;
|
|
18
|
+
if (!activateStateInitialized) {
|
|
19
|
+
activateStateInitialized = true;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
return isDeactivatedRef;
|
|
23
|
+
}
|
|
24
|
+
exports.useReactivated = useReactivated;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.eventEffectNotPerformed = exports.markEventEffectPerformed = void 0;
|
|
4
|
+
const eventSet = new WeakSet();
|
|
5
|
+
function markEventEffectPerformed(event) {
|
|
6
|
+
eventSet.add(event);
|
|
7
|
+
}
|
|
8
|
+
exports.markEventEffectPerformed = markEventEffectPerformed;
|
|
9
|
+
function eventEffectNotPerformed(event) {
|
|
10
|
+
return !eventSet.has(event);
|
|
11
|
+
}
|
|
12
|
+
exports.eventEffectNotPerformed = eventEffectNotPerformed;
|
package/lib/_utils/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { call, keep, omit, flatten, getSlot, getVNodeChildren, keysOf, render, getFirstSlotVNode, createDataKey, createRefSetter, createInjectionKey, resolveSlot, resolveSlotWithProps, resolveWrappedSlot, isSlotEmpty } from './vue';
|
|
1
|
+
export { call, keep, omit, flatten, getSlot, getVNodeChildren, keysOf, render, getFirstSlotVNode, createDataKey, createRefSetter, createInjectionKey, resolveSlot, resolveSlotWithProps, resolveWrappedSlot, isSlotEmpty, mergeEventHandlers } from './vue';
|
|
2
2
|
export type { MaybeArray } from './vue';
|
|
3
3
|
export { warn, warnOnce, throwError, smallerSize, largerSize, getTitleAttribute } from './naive';
|
|
4
4
|
export type { ExtractPublicPropTypes, ExtractInternalPropTypes, Mutable } from './naive';
|
|
@@ -6,4 +6,5 @@ export { formatLength, color2Class } from './css';
|
|
|
6
6
|
export { createKey } from './cssr';
|
|
7
7
|
export { isJsdom } from './env/is-jsdom';
|
|
8
8
|
export { isBrowser } from './env/is-browser';
|
|
9
|
+
export { eventEffectNotPerformed, markEventEffectPerformed } from './event';
|
|
9
10
|
export * from './composable';
|
package/lib/_utils/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.isBrowser = exports.isJsdom = exports.createKey = exports.color2Class = exports.formatLength = exports.getTitleAttribute = exports.largerSize = exports.smallerSize = exports.throwError = exports.warnOnce = exports.warn = exports.isSlotEmpty = exports.resolveWrappedSlot = exports.resolveSlotWithProps = exports.resolveSlot = exports.createInjectionKey = exports.createRefSetter = exports.createDataKey = exports.getFirstSlotVNode = exports.render = exports.keysOf = exports.getVNodeChildren = exports.getSlot = exports.flatten = exports.omit = exports.keep = exports.call = void 0;
|
|
17
|
+
exports.markEventEffectPerformed = exports.eventEffectNotPerformed = exports.isBrowser = exports.isJsdom = exports.createKey = exports.color2Class = exports.formatLength = exports.getTitleAttribute = exports.largerSize = exports.smallerSize = exports.throwError = exports.warnOnce = exports.warn = exports.mergeEventHandlers = exports.isSlotEmpty = exports.resolveWrappedSlot = exports.resolveSlotWithProps = exports.resolveSlot = exports.createInjectionKey = exports.createRefSetter = exports.createDataKey = exports.getFirstSlotVNode = exports.render = exports.keysOf = exports.getVNodeChildren = exports.getSlot = exports.flatten = exports.omit = exports.keep = exports.call = void 0;
|
|
18
18
|
var vue_1 = require("./vue");
|
|
19
19
|
Object.defineProperty(exports, "call", { enumerable: true, get: function () { return vue_1.call; } });
|
|
20
20
|
Object.defineProperty(exports, "keep", { enumerable: true, get: function () { return vue_1.keep; } });
|
|
@@ -32,6 +32,7 @@ Object.defineProperty(exports, "resolveSlot", { enumerable: true, get: function
|
|
|
32
32
|
Object.defineProperty(exports, "resolveSlotWithProps", { enumerable: true, get: function () { return vue_1.resolveSlotWithProps; } });
|
|
33
33
|
Object.defineProperty(exports, "resolveWrappedSlot", { enumerable: true, get: function () { return vue_1.resolveWrappedSlot; } });
|
|
34
34
|
Object.defineProperty(exports, "isSlotEmpty", { enumerable: true, get: function () { return vue_1.isSlotEmpty; } });
|
|
35
|
+
Object.defineProperty(exports, "mergeEventHandlers", { enumerable: true, get: function () { return vue_1.mergeEventHandlers; } });
|
|
35
36
|
var naive_1 = require("./naive");
|
|
36
37
|
Object.defineProperty(exports, "warn", { enumerable: true, get: function () { return naive_1.warn; } });
|
|
37
38
|
Object.defineProperty(exports, "warnOnce", { enumerable: true, get: function () { return naive_1.warnOnce; } });
|
|
@@ -48,4 +49,7 @@ var is_jsdom_1 = require("./env/is-jsdom");
|
|
|
48
49
|
Object.defineProperty(exports, "isJsdom", { enumerable: true, get: function () { return is_jsdom_1.isJsdom; } });
|
|
49
50
|
var is_browser_1 = require("./env/is-browser");
|
|
50
51
|
Object.defineProperty(exports, "isBrowser", { enumerable: true, get: function () { return is_browser_1.isBrowser; } });
|
|
52
|
+
var event_1 = require("./event");
|
|
53
|
+
Object.defineProperty(exports, "eventEffectNotPerformed", { enumerable: true, get: function () { return event_1.eventEffectNotPerformed; } });
|
|
54
|
+
Object.defineProperty(exports, "markEventEffectPerformed", { enumerable: true, get: function () { return event_1.markEventEffectPerformed; } });
|
|
51
55
|
__exportStar(require("./composable"), exports);
|
|
@@ -12,3 +12,4 @@ export { createRefSetter } from './create-ref-setter';
|
|
|
12
12
|
export { createInjectionKey } from './create-injection-key';
|
|
13
13
|
export { resolveSlot, resolveWrappedSlot, resolveSlotWithProps, isSlotEmpty } from './resolve-slot';
|
|
14
14
|
export type { MaybeArray } from './call';
|
|
15
|
+
export { mergeEventHandlers } from './merge-handlers';
|
package/lib/_utils/vue/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isSlotEmpty = exports.resolveSlotWithProps = exports.resolveWrappedSlot = exports.resolveSlot = exports.createInjectionKey = exports.createRefSetter = exports.createDataKey = exports.getFirstSlotVNode = exports.render = exports.keysOf = exports.call = exports.flatten = exports.omit = exports.keep = exports.getVNodeChildren = exports.getSlot = void 0;
|
|
3
|
+
exports.mergeEventHandlers = exports.isSlotEmpty = exports.resolveSlotWithProps = exports.resolveWrappedSlot = exports.resolveSlot = exports.createInjectionKey = exports.createRefSetter = exports.createDataKey = exports.getFirstSlotVNode = exports.render = exports.keysOf = exports.call = exports.flatten = exports.omit = exports.keep = exports.getVNodeChildren = exports.getSlot = void 0;
|
|
4
4
|
var get_slot_1 = require("./get-slot");
|
|
5
5
|
Object.defineProperty(exports, "getSlot", { enumerable: true, get: function () { return get_slot_1.getSlot; } });
|
|
6
6
|
var get_v_node_children_1 = require("./get-v-node-children");
|
|
@@ -30,3 +30,5 @@ Object.defineProperty(exports, "resolveSlot", { enumerable: true, get: function
|
|
|
30
30
|
Object.defineProperty(exports, "resolveWrappedSlot", { enumerable: true, get: function () { return resolve_slot_1.resolveWrappedSlot; } });
|
|
31
31
|
Object.defineProperty(exports, "resolveSlotWithProps", { enumerable: true, get: function () { return resolve_slot_1.resolveSlotWithProps; } });
|
|
32
32
|
Object.defineProperty(exports, "isSlotEmpty", { enumerable: true, get: function () { return resolve_slot_1.isSlotEmpty; } });
|
|
33
|
+
var merge_handlers_1 = require("./merge-handlers");
|
|
34
|
+
Object.defineProperty(exports, "mergeEventHandlers", { enumerable: true, get: function () { return merge_handlers_1.mergeEventHandlers; } });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function mergeEventHandlers<T>(handlers: Array<undefined | ((e: T) => void)>): undefined | ((e: T) => void);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.mergeEventHandlers = void 0;
|
|
4
|
+
function mergeEventHandlers(handlers) {
|
|
5
|
+
const filteredHandlers = handlers.filter((handler) => handler !== undefined);
|
|
6
|
+
if (filteredHandlers.length === 0)
|
|
7
|
+
return undefined;
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
9
|
+
if (filteredHandlers.length === 1)
|
|
10
|
+
return filteredHandlers[0];
|
|
11
|
+
return (e) => {
|
|
12
|
+
handlers.forEach((handler) => {
|
|
13
|
+
if (handler) {
|
|
14
|
+
handler(e);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
exports.mergeEventHandlers = mergeEventHandlers;
|