naive-ui 2.30.3 → 2.30.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/dist/index.js +1829 -1088
- package/dist/index.prod.js +2 -2
- package/es/_internal/scrollbar/src/Scrollbar.js +5 -18
- 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 +7 -5
- 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/dom/index.d.ts +1 -0
- package/es/_utils/dom/index.js +1 -0
- package/es/_utils/dom/is-document.d.ts +1 -0
- package/es/_utils/dom/is-document.js +3 -0
- package/es/_utils/event/index.d.ts +2 -0
- package/es/_utils/event/index.js +7 -0
- package/es/_utils/index.d.ts +3 -1
- package/es/_utils/index.js +3 -1
- package/es/_utils/vue/index.d.ts +3 -0
- package/es/_utils/vue/index.js +3 -0
- package/es/_utils/vue/is-node-v-show-false.d.ts +2 -0
- package/es/_utils/vue/is-node-v-show-false.js +6 -0
- package/es/_utils/vue/merge-handlers.d.ts +1 -0
- package/es/_utils/vue/merge-handlers.js +15 -0
- package/es/{_internal/scrollbar/src/Wrapper.d.ts → _utils/vue/wrapper.d.ts} +0 -0
- package/es/{_internal/scrollbar/src/Wrapper.js → _utils/vue/wrapper.js} +0 -0
- package/es/back-top/src/BackTop.d.ts +1 -1
- package/es/back-top/src/BackTop.js +24 -31
- 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/color-picker/src/ColorInputUnit.js +1 -1
- package/es/data-table/src/DataTable.d.ts +792 -2
- package/es/data-table/src/DataTable.js +10 -5
- 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 +144 -0
- package/es/data-table/src/TableParts/Body.js +15 -8
- package/es/data-table/src/TableParts/Cell.d.ts +295 -1
- package/es/data-table/src/TableParts/Cell.js +19 -6
- 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 +14 -7
- package/es/data-table/src/styles/index.cssr.js +7 -2
- package/es/data-table/src/use-check.js +11 -3
- 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/grid/src/Grid.d.ts +3 -0
- package/es/grid/src/Grid.js +47 -9
- package/es/grid/src/GridItem.js +2 -1
- package/es/image/src/Image.d.ts +10 -0
- package/es/image/src/Image.js +42 -8
- package/es/image/src/utils.d.ts +11 -0
- package/es/image/src/utils.js +81 -0
- package/es/input/src/Input.d.ts +6 -3
- package/es/input/src/Input.js +56 -31
- package/es/input/src/styles/input-group-label.cssr.js +2 -0
- 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 +15 -20
- package/es/modal/src/BodyWrapper.js +38 -33
- package/es/modal/src/Modal.js +14 -9
- 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/space/src/Space.d.ts +26 -0
- package/es/space/src/Space.js +53 -43
- package/es/time-picker/src/TimePicker.d.ts +2 -1
- package/es/time-picker/src/TimePicker.js +18 -8
- package/es/tooltip/index.d.ts +1 -1
- 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 +6 -19
- 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 +6 -4
- 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/dom/index.d.ts +1 -0
- package/lib/_utils/dom/index.js +5 -0
- package/lib/_utils/dom/is-document.d.ts +1 -0
- package/lib/_utils/dom/is-document.js +7 -0
- package/lib/_utils/event/index.d.ts +2 -0
- package/lib/_utils/event/index.js +12 -0
- package/lib/_utils/index.d.ts +3 -1
- package/lib/_utils/index.js +8 -1
- package/lib/_utils/vue/index.d.ts +3 -0
- package/lib/_utils/vue/index.js +7 -1
- package/lib/_utils/vue/is-node-v-show-false.d.ts +2 -0
- package/lib/_utils/vue/is-node-v-show-false.js +10 -0
- package/lib/_utils/vue/merge-handlers.d.ts +1 -0
- package/lib/_utils/vue/merge-handlers.js +19 -0
- package/lib/{_internal/scrollbar/src/Wrapper.d.ts → _utils/vue/wrapper.d.ts} +0 -0
- package/lib/{_internal/scrollbar/src/Wrapper.js → _utils/vue/wrapper.js} +0 -0
- package/lib/back-top/src/BackTop.d.ts +1 -1
- package/lib/back-top/src/BackTop.js +23 -30
- 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/color-picker/src/ColorInputUnit.js +1 -1
- package/lib/data-table/src/DataTable.d.ts +792 -2
- package/lib/data-table/src/DataTable.js +10 -5
- 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 +144 -0
- package/lib/data-table/src/TableParts/Body.js +15 -8
- package/lib/data-table/src/TableParts/Cell.d.ts +295 -1
- package/lib/data-table/src/TableParts/Cell.js +19 -6
- 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 +14 -7
- package/lib/data-table/src/styles/index.cssr.js +7 -2
- package/lib/data-table/src/use-check.js +11 -3
- 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/grid/src/Grid.d.ts +3 -0
- package/lib/grid/src/Grid.js +45 -7
- package/lib/grid/src/GridItem.js +2 -1
- package/lib/image/src/Image.d.ts +10 -0
- package/lib/image/src/Image.js +41 -7
- package/lib/image/src/utils.d.ts +11 -0
- package/lib/image/src/utils.js +86 -0
- package/lib/input/src/Input.d.ts +6 -3
- package/lib/input/src/Input.js +55 -30
- package/lib/input/src/styles/input-group-label.cssr.js +2 -0
- 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 +15 -20
- package/lib/modal/src/BodyWrapper.js +38 -33
- package/lib/modal/src/Modal.js +13 -8
- 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/space/src/Space.d.ts +26 -0
- package/lib/space/src/Space.js +53 -43
- package/lib/time-picker/src/TimePicker.d.ts +2 -1
- package/lib/time-picker/src/TimePicker.js +17 -7
- package/lib/tooltip/index.d.ts +1 -1
- 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/volar.d.ts +0 -1
- package/web-types.json +73 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { h, defineComponent, computed, ref, toRef, inject, provide } from 'vue';
|
|
2
2
|
import { useMergedState } from 'vooks';
|
|
3
3
|
import { useConfig, useTheme, useThemeClass } from '../../_mixins';
|
|
4
|
-
import { formatLength, call, warn } from '../../_utils';
|
|
4
|
+
import { formatLength, call, warn, useReactivated } from '../../_utils';
|
|
5
5
|
import { NScrollbar } from '../../_internal';
|
|
6
6
|
import { layoutLight } from '../styles';
|
|
7
7
|
import style from './styles/layout-sider.cssr';
|
|
@@ -130,6 +130,24 @@ export default defineComponent({
|
|
|
130
130
|
call(onCollapse);
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
+
let scrollX = 0;
|
|
134
|
+
let scrollY = 0;
|
|
135
|
+
const handleNativeElScroll = (e) => {
|
|
136
|
+
var _a;
|
|
137
|
+
const target = e.target;
|
|
138
|
+
scrollX = target.scrollLeft;
|
|
139
|
+
scrollY = target.scrollTop;
|
|
140
|
+
(_a = props.onScroll) === null || _a === void 0 ? void 0 : _a.call(props, e);
|
|
141
|
+
};
|
|
142
|
+
useReactivated(() => {
|
|
143
|
+
if (props.nativeScrollbar) {
|
|
144
|
+
const el = scrollableElRef.value;
|
|
145
|
+
if (el) {
|
|
146
|
+
el.scrollTop = scrollY;
|
|
147
|
+
el.scrollLeft = scrollX;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
});
|
|
133
151
|
provide(layoutSiderInjectionKey, {
|
|
134
152
|
collapsedRef: mergedCollapsedRef,
|
|
135
153
|
collapseModeRef: toRef(props, 'collapseMode')
|
|
@@ -180,7 +198,8 @@ export default defineComponent({
|
|
|
180
198
|
? useThemeClass('layout-sider', computed(() => (props.inverted ? 'a' : 'b')), cssVarsRef, props)
|
|
181
199
|
: undefined;
|
|
182
200
|
return Object.assign({ scrollableElRef,
|
|
183
|
-
scrollbarInstRef, mergedClsPrefix: mergedClsPrefixRef, mergedTheme: themeRef, styleMaxWidth: styleMaxWidthRef, mergedCollapsed: mergedCollapsedRef, scrollContainerStyle: scrollContainerStyleRef, siderPlacement: siderPlacementRef,
|
|
201
|
+
scrollbarInstRef, mergedClsPrefix: mergedClsPrefixRef, mergedTheme: themeRef, styleMaxWidth: styleMaxWidthRef, mergedCollapsed: mergedCollapsedRef, scrollContainerStyle: scrollContainerStyleRef, siderPlacement: siderPlacementRef, handleNativeElScroll,
|
|
202
|
+
handleTransitionend,
|
|
184
203
|
handleTriggerClick,
|
|
185
204
|
inlineThemeDisabled, cssVars: cssVarsRef, themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass, onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender }, exposedMethods);
|
|
186
205
|
},
|
|
@@ -212,7 +231,7 @@ export default defineComponent({
|
|
|
212
231
|
colorHover: 'rgba(255, 255, 255, .4)',
|
|
213
232
|
color: 'rgba(255, 255, 255, .3)'
|
|
214
233
|
}
|
|
215
|
-
: undefined }), this.$slots)) : (h("div", { class: `${mergedClsPrefix}-layout-sider-scroll-container`, onScroll: this.
|
|
234
|
+
: undefined }), this.$slots)) : (h("div", { class: `${mergedClsPrefix}-layout-sider-scroll-container`, onScroll: this.handleNativeElScroll, style: [
|
|
216
235
|
this.scrollContainerStyle,
|
|
217
236
|
{
|
|
218
237
|
overflow: 'auto'
|
package/es/menu/src/Menu.d.ts
CHANGED
|
@@ -2147,13 +2147,13 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
2147
2147
|
readonly labelField: string;
|
|
2148
2148
|
readonly defaultValue: Key | null;
|
|
2149
2149
|
readonly childrenField: string;
|
|
2150
|
+
readonly defaultExpandAll: boolean;
|
|
2150
2151
|
readonly indent: number;
|
|
2151
2152
|
readonly inverted: boolean;
|
|
2152
2153
|
readonly accordion: boolean;
|
|
2153
2154
|
readonly collapsed: boolean | undefined;
|
|
2154
2155
|
readonly collapsedWidth: number;
|
|
2155
2156
|
readonly collapsedIconSize: number;
|
|
2156
|
-
readonly defaultExpandAll: boolean;
|
|
2157
2157
|
readonly watchProps: ("defaultValue" | "defaultExpandedKeys")[];
|
|
2158
2158
|
readonly dropdownPlacement: FollowerPlacement;
|
|
2159
2159
|
}>;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { PropType, VNode, ComponentPublicInstance } from 'vue';
|
|
1
|
+
import { PropType, VNode, ComponentPublicInstance, VNodeChild } from 'vue';
|
|
2
2
|
declare const _default: import("vue").DefineComponent<{
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
required: true;
|
|
6
|
-
};
|
|
3
|
+
renderMask: PropType<() => VNodeChild>;
|
|
4
|
+
onClickoutside: PropType<(e: MouseEvent) => void>;
|
|
7
5
|
onBeforeLeave: {
|
|
8
6
|
type: FunctionConstructor;
|
|
9
7
|
required: true;
|
|
@@ -25,13 +23,13 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
25
23
|
required: true;
|
|
26
24
|
};
|
|
27
25
|
onAfterEnter: PropType<() => void>;
|
|
28
|
-
onEsc: PropType<() => void>;
|
|
29
|
-
icon: PropType<() =>
|
|
26
|
+
onEsc: PropType<(e: KeyboardEvent) => void>;
|
|
27
|
+
icon: PropType<() => VNodeChild>;
|
|
30
28
|
type: {
|
|
31
29
|
readonly type: PropType<"default" | "error" | "info" | "success" | "warning">;
|
|
32
30
|
readonly default: "default";
|
|
33
31
|
};
|
|
34
|
-
title: PropType<string | (() =>
|
|
32
|
+
title: PropType<string | (() => VNodeChild)>;
|
|
35
33
|
closable: {
|
|
36
34
|
readonly type: BooleanConstructor;
|
|
37
35
|
readonly default: true;
|
|
@@ -40,8 +38,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
40
38
|
positiveText: StringConstructor;
|
|
41
39
|
positiveButtonProps: PropType<import("../..").ButtonProps>;
|
|
42
40
|
negativeButtonProps: PropType<import("../..").ButtonProps>;
|
|
43
|
-
content: PropType<string | (() =>
|
|
44
|
-
action: PropType<() =>
|
|
41
|
+
content: PropType<string | (() => VNodeChild)>;
|
|
42
|
+
action: PropType<() => VNodeChild>;
|
|
45
43
|
showIcon: {
|
|
46
44
|
readonly type: BooleanConstructor;
|
|
47
45
|
readonly default: true;
|
|
@@ -713,7 +711,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
713
711
|
childNodeRef: import("vue").Ref<VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
714
712
|
[key: string]: any;
|
|
715
713
|
}> | null>;
|
|
716
|
-
handleClickOutside: (e: MouseEvent) => void;
|
|
717
714
|
handlePositiveClick: () => void;
|
|
718
715
|
handleNegativeClick: () => void;
|
|
719
716
|
handleCloseClick: () => void;
|
|
@@ -721,10 +718,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
721
718
|
handleBeforeLeave: (el: HTMLElement) => void;
|
|
722
719
|
handleEnter: (el: HTMLElement) => void;
|
|
723
720
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
required: true;
|
|
727
|
-
};
|
|
721
|
+
renderMask: PropType<() => VNodeChild>;
|
|
722
|
+
onClickoutside: PropType<(e: MouseEvent) => void>;
|
|
728
723
|
onBeforeLeave: {
|
|
729
724
|
type: FunctionConstructor;
|
|
730
725
|
required: true;
|
|
@@ -746,13 +741,13 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
746
741
|
required: true;
|
|
747
742
|
};
|
|
748
743
|
onAfterEnter: PropType<() => void>;
|
|
749
|
-
onEsc: PropType<() => void>;
|
|
750
|
-
icon: PropType<() =>
|
|
744
|
+
onEsc: PropType<(e: KeyboardEvent) => void>;
|
|
745
|
+
icon: PropType<() => VNodeChild>;
|
|
751
746
|
type: {
|
|
752
747
|
readonly type: PropType<"default" | "error" | "info" | "success" | "warning">;
|
|
753
748
|
readonly default: "default";
|
|
754
749
|
};
|
|
755
|
-
title: PropType<string | (() =>
|
|
750
|
+
title: PropType<string | (() => VNodeChild)>;
|
|
756
751
|
closable: {
|
|
757
752
|
readonly type: BooleanConstructor;
|
|
758
753
|
readonly default: true;
|
|
@@ -761,8 +756,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
761
756
|
positiveText: StringConstructor;
|
|
762
757
|
positiveButtonProps: PropType<import("../..").ButtonProps>;
|
|
763
758
|
negativeButtonProps: PropType<import("../..").ButtonProps>;
|
|
764
|
-
content: PropType<string | (() =>
|
|
765
|
-
action: PropType<() =>
|
|
759
|
+
content: PropType<string | (() => VNodeChild)>;
|
|
760
|
+
action: PropType<() => VNodeChild>;
|
|
766
761
|
showIcon: {
|
|
767
762
|
readonly type: BooleanConstructor;
|
|
768
763
|
readonly default: true;
|
|
@@ -26,12 +26,9 @@ export default defineComponent({
|
|
|
26
26
|
}, autoFocus: {
|
|
27
27
|
type: Boolean,
|
|
28
28
|
default: true
|
|
29
|
-
}, blockScroll: Boolean }, presetProps), {
|
|
29
|
+
}, blockScroll: Boolean }, presetProps), { renderMask: Function,
|
|
30
30
|
// events
|
|
31
|
-
onClickoutside: {
|
|
32
|
-
type: Function,
|
|
33
|
-
required: true
|
|
34
|
-
}, onBeforeLeave: {
|
|
31
|
+
onClickoutside: Function, onBeforeLeave: {
|
|
35
32
|
type: Function,
|
|
36
33
|
required: true
|
|
37
34
|
}, onAfterLeave: {
|
|
@@ -122,9 +119,6 @@ export default defineComponent({
|
|
|
122
119
|
function handlePositiveClick() {
|
|
123
120
|
props.onPositiveClick();
|
|
124
121
|
}
|
|
125
|
-
function handleClickOutside(e) {
|
|
126
|
-
props.onClickoutside(e);
|
|
127
|
-
}
|
|
128
122
|
const childNodeRef = ref(null);
|
|
129
123
|
watch(childNodeRef, (node) => {
|
|
130
124
|
if (node) {
|
|
@@ -148,7 +142,6 @@ export default defineComponent({
|
|
|
148
142
|
scrollbarRef,
|
|
149
143
|
displayed: displayedRef,
|
|
150
144
|
childNodeRef,
|
|
151
|
-
handleClickOutside,
|
|
152
145
|
handlePositiveClick,
|
|
153
146
|
handleNegativeClick,
|
|
154
147
|
handleCloseClick,
|
|
@@ -158,7 +151,7 @@ export default defineComponent({
|
|
|
158
151
|
};
|
|
159
152
|
},
|
|
160
153
|
render() {
|
|
161
|
-
const { $slots, $attrs, handleEnter, handleAfterLeave, handleBeforeLeave,
|
|
154
|
+
const { $slots, $attrs, handleEnter, handleAfterLeave, handleBeforeLeave, preset, mergedClsPrefix } = this;
|
|
162
155
|
let childNode = null;
|
|
163
156
|
if (!preset) {
|
|
164
157
|
childNode = getFirstSlotVNode($slots);
|
|
@@ -174,29 +167,41 @@ export default defineComponent({
|
|
|
174
167
|
return this.displayDirective === 'show' || this.displayed || this.show
|
|
175
168
|
? withDirectives(h("div", { role: "none", class: `${mergedClsPrefix}-modal-body-wrapper` },
|
|
176
169
|
h(NScrollbar, { ref: "scrollbarRef", theme: this.mergedTheme.peers.Scrollbar, themeOverrides: this.mergedTheme.peerOverrides.Scrollbar, contentClass: `${mergedClsPrefix}-modal-scroll-content` }, {
|
|
177
|
-
default: () =>
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
170
|
+
default: () => {
|
|
171
|
+
var _a;
|
|
172
|
+
return [
|
|
173
|
+
(_a = this.renderMask) === null || _a === void 0 ? void 0 : _a.call(this),
|
|
174
|
+
h(VFocusTrap, { disabled: !this.trapFocus, active: this.show, onEsc: this.onEsc, autoFocus: this.autoFocus }, {
|
|
175
|
+
default: () => {
|
|
176
|
+
var _a;
|
|
177
|
+
return (h(Transition, { name: "fade-in-scale-up-transition", appear: (_a = this.appear) !== null && _a !== void 0 ? _a : this.isMounted, onEnter: handleEnter, onAfterEnter: this.onAfterEnter, onAfterLeave: handleAfterLeave, onBeforeLeave: handleBeforeLeave }, {
|
|
178
|
+
default: () => {
|
|
179
|
+
const dirs = [
|
|
180
|
+
[vShow, this.show]
|
|
181
|
+
];
|
|
182
|
+
const { onClickoutside } = this;
|
|
183
|
+
if (onClickoutside) {
|
|
184
|
+
dirs.push([
|
|
185
|
+
clickoutside,
|
|
186
|
+
this.onClickoutside,
|
|
187
|
+
undefined,
|
|
188
|
+
{ capture: true }
|
|
189
|
+
]);
|
|
190
|
+
}
|
|
191
|
+
return withDirectives((this.preset === 'confirm' ||
|
|
192
|
+
this.preset === 'dialog' ? (h(NDialog, Object.assign({}, this.$attrs, { class: [
|
|
193
|
+
`${mergedClsPrefix}-modal`,
|
|
194
|
+
this.$attrs.class
|
|
195
|
+
], ref: "bodyRef", theme: this.mergedTheme.peers.Dialog, themeOverrides: this.mergedTheme.peerOverrides.Dialog }, keep(this.$props, dialogPropKeys), { "aria-modal": "true" }), $slots)) : this.preset === 'card' ? (h(NCard, Object.assign({}, this.$attrs, { ref: "bodyRef", class: [
|
|
196
|
+
`${mergedClsPrefix}-modal`,
|
|
197
|
+
this.$attrs.class
|
|
198
|
+
], theme: this.mergedTheme.peers.Card, themeOverrides: this.mergedTheme.peerOverrides.Card }, keep(this.$props, cardBasePropKeys), { "aria-modal": "true", role: "dialog" }), $slots)) : ((this.childNodeRef = childNode))), dirs);
|
|
199
|
+
}
|
|
200
|
+
}));
|
|
201
|
+
}
|
|
202
|
+
})
|
|
203
|
+
];
|
|
204
|
+
}
|
|
200
205
|
})), [
|
|
201
206
|
[
|
|
202
207
|
vShow,
|
package/es/modal/src/Modal.js
CHANGED
|
@@ -4,7 +4,7 @@ import { useIsMounted, useClicked, useClickPosition } from 'vooks';
|
|
|
4
4
|
import { VLazyTeleport } from 'vueuc';
|
|
5
5
|
import { dialogProviderInjectionKey } from '../../dialog/src/context';
|
|
6
6
|
import { useConfig, useTheme, useThemeClass } from '../../_mixins';
|
|
7
|
-
import { keep, call, warnOnce, useIsComposing } from '../../_utils';
|
|
7
|
+
import { keep, call, warnOnce, useIsComposing, eventEffectNotPerformed } from '../../_utils';
|
|
8
8
|
import { modalLight } from '../styles';
|
|
9
9
|
import { presetProps, presetPropsKeys } from './presetProps';
|
|
10
10
|
import NModalBodyWrapper from './BodyWrapper';
|
|
@@ -150,7 +150,7 @@ export default defineComponent({
|
|
|
150
150
|
function handleEsc(e) {
|
|
151
151
|
var _a;
|
|
152
152
|
(_a = props.onEsc) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
153
|
-
if (props.closeOnEsc) {
|
|
153
|
+
if (props.show && props.closeOnEsc && eventEffectNotPerformed(e)) {
|
|
154
154
|
!isComposingRef.value && doUpdateShow(false);
|
|
155
155
|
}
|
|
156
156
|
}
|
|
@@ -212,19 +212,24 @@ export default defineComponent({
|
|
|
212
212
|
const { mergedClsPrefix } = this;
|
|
213
213
|
return (h(VLazyTeleport, { to: this.to, show: this.show }, {
|
|
214
214
|
default: () => {
|
|
215
|
-
var _a
|
|
215
|
+
var _a;
|
|
216
216
|
(_a = this.onRender) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
217
|
+
const { unstableShowMask } = this;
|
|
217
218
|
return withDirectives(h("div", { role: "none", ref: "containerRef", class: [
|
|
218
219
|
`${mergedClsPrefix}-modal-container`,
|
|
219
220
|
this.themeClass,
|
|
220
221
|
this.namespace
|
|
221
222
|
], style: this.cssVars },
|
|
222
|
-
this.
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
223
|
+
h(NModalBodyWrapper, Object.assign({ style: this.overlayStyle }, this.$attrs, { ref: "bodyWrapper", displayDirective: this.displayDirective, show: this.show, preset: this.preset, autoFocus: this.autoFocus, trapFocus: this.trapFocus, blockScroll: this.blockScroll }, this.presetProps, { onEsc: this.handleEsc, onClose: this.handleCloseClick, onNegativeClick: this.handleNegativeClick, onPositiveClick: this.handlePositiveClick, onBeforeLeave: this.handleBeforeLeave, onAfterEnter: this.onAfterEnter, onAfterLeave: this.handleAfterLeave, onClickoutside: unstableShowMask ? undefined : this.handleClickoutside, renderMask: unstableShowMask
|
|
224
|
+
? () => {
|
|
225
|
+
var _a;
|
|
226
|
+
return (h(Transition, { name: "fade-in-transition", key: "mask", appear: (_a = this.internalAppear) !== null && _a !== void 0 ? _a : this.isMounted }, {
|
|
227
|
+
default: () => {
|
|
228
|
+
return this.show ? (h("div", { "aria-hidden": true, ref: "containerRef", class: `${mergedClsPrefix}-modal-mask`, onClick: this.handleClickoutside })) : null;
|
|
229
|
+
}
|
|
230
|
+
}));
|
|
231
|
+
}
|
|
232
|
+
: undefined }), this.$slots)), [
|
|
228
233
|
[
|
|
229
234
|
zindexable,
|
|
230
235
|
{
|