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
|
@@ -202,7 +202,9 @@ c('&:last-child', 'flex-grow: 1;')])])])])])])]), c('>', [cB('base-loading', `
|
|
|
202
202
|
background-color .3s var(--n-bezier),
|
|
203
203
|
border-color .3s var(--n-bezier),
|
|
204
204
|
color .3s var(--n-bezier);
|
|
205
|
-
`, [cM('
|
|
205
|
+
`, [cM('expand', [cB('data-table-expand-trigger', `
|
|
206
|
+
margin-right: 0;
|
|
207
|
+
`)]), cM('last-row', {
|
|
206
208
|
borderBottom: '0 solid var(--n-merged-border-color)'
|
|
207
209
|
}, [// make sure there is no overlap between bottom border and
|
|
208
210
|
// fixed column box shadow
|
|
@@ -214,10 +216,13 @@ c('&::after', {
|
|
|
214
216
|
background-color: var(--n-merged-th-color);
|
|
215
217
|
`), cM('hover', {
|
|
216
218
|
backgroundColor: 'var(--n-merged-td-color-hover)'
|
|
217
|
-
}),
|
|
219
|
+
}), cE('ellipsis', `
|
|
220
|
+
display: inline-block;
|
|
218
221
|
text-overflow: ellipsis;
|
|
219
222
|
overflow: hidden;
|
|
220
223
|
white-space: nowrap;
|
|
224
|
+
max-width: 100%;
|
|
225
|
+
vertical-align: bottom;
|
|
221
226
|
`), cM('selection, expand', `
|
|
222
227
|
text-align: center;
|
|
223
228
|
padding: 0;
|
|
@@ -50,12 +50,20 @@ export function useCheck(props, data) {
|
|
|
50
50
|
});
|
|
51
51
|
function doUpdateCheckedRowKeys(keys) {
|
|
52
52
|
const { 'onUpdate:checkedRowKeys': _onUpdateCheckedRowKeys, onUpdateCheckedRowKeys, onCheckedRowKeysChange } = props;
|
|
53
|
+
const rows = [];
|
|
54
|
+
const { value: { getNode } } = treeMateRef;
|
|
55
|
+
keys.forEach((key) => {
|
|
56
|
+
var _a;
|
|
57
|
+
const row = (_a = getNode(key)) === null || _a === void 0 ? void 0 : _a.rawNode;
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
59
|
+
rows.push(row);
|
|
60
|
+
});
|
|
53
61
|
if (_onUpdateCheckedRowKeys)
|
|
54
|
-
call(_onUpdateCheckedRowKeys, keys);
|
|
62
|
+
call(_onUpdateCheckedRowKeys, keys, rows);
|
|
55
63
|
if (onUpdateCheckedRowKeys)
|
|
56
|
-
call(onUpdateCheckedRowKeys, keys);
|
|
64
|
+
call(onUpdateCheckedRowKeys, keys, rows);
|
|
57
65
|
if (onCheckedRowKeysChange)
|
|
58
|
-
call(onCheckedRowKeysChange, keys);
|
|
66
|
+
call(onCheckedRowKeysChange, keys, rows);
|
|
59
67
|
uncontrolledCheckedRowKeysRef.value = keys;
|
|
60
68
|
}
|
|
61
69
|
function doCheck(rowKey) {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { TreeMate } from 'treemate';
|
|
1
3
|
import type { DataTableSetupProps } from './DataTable';
|
|
2
|
-
import { RowKey } from './interface';
|
|
3
|
-
export declare function useExpand(props: DataTableSetupProps): {
|
|
4
|
-
mergedExpandedRowKeysRef: import("vue").ComputedRef<
|
|
4
|
+
import type { InternalRowData, RowKey } from './interface';
|
|
5
|
+
export declare function useExpand(props: DataTableSetupProps, treeMateRef: Ref<TreeMate<InternalRowData, InternalRowData, InternalRowData>>): {
|
|
6
|
+
mergedExpandedRowKeysRef: import("vue").ComputedRef<import("treemate").Key[]>;
|
|
5
7
|
renderExpandRef: import("vue").ComputedRef<import("./interface").RenderExpand<any> | undefined>;
|
|
6
8
|
doUpdateExpandedRowKeys: (expandedKeys: RowKey[]) => void;
|
|
7
9
|
};
|
|
@@ -2,7 +2,7 @@ import { toRef, ref } from 'vue';
|
|
|
2
2
|
import { useMemo, useMergedState } from 'vooks';
|
|
3
3
|
import { call, warn } from '../../_utils';
|
|
4
4
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
5
|
-
export function useExpand(props) {
|
|
5
|
+
export function useExpand(props, treeMateRef) {
|
|
6
6
|
const renderExpandRef = useMemo(() => {
|
|
7
7
|
for (const col of props.columns) {
|
|
8
8
|
if (col.type === 'expand') {
|
|
@@ -13,7 +13,27 @@ export function useExpand(props) {
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
-
|
|
16
|
+
// It's not reactive
|
|
17
|
+
let expandable;
|
|
18
|
+
for (const col of props.columns) {
|
|
19
|
+
if (col.type === 'expand') {
|
|
20
|
+
expandable = col.expandable;
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const uncontrolledExpandedRowKeysRef = ref(props.defaultExpandAll
|
|
25
|
+
? (renderExpandRef === null || renderExpandRef === void 0 ? void 0 : renderExpandRef.value)
|
|
26
|
+
? (() => {
|
|
27
|
+
const expandedKeys = [];
|
|
28
|
+
treeMateRef.value.treeNodes.forEach((tmNode) => {
|
|
29
|
+
if (expandable === null || expandable === void 0 ? void 0 : expandable(tmNode.rawNode)) {
|
|
30
|
+
expandedKeys.push(tmNode.key);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
return expandedKeys;
|
|
34
|
+
})()
|
|
35
|
+
: treeMateRef.value.getNonLeafKeys()
|
|
36
|
+
: props.defaultExpandedRowKeys);
|
|
17
37
|
const controlledExpandedRowKeysRef = toRef(props, 'expandedRowKeys');
|
|
18
38
|
const mergedExpandedRowKeysRef = useMergedState(controlledExpandedRowKeysRef, uncontrolledExpandedRowKeysRef);
|
|
19
39
|
function doUpdateExpandedRowKeys(expandedKeys) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CSSProperties } from 'vue';
|
|
2
2
|
import type { SortOrder, TableBaseColumn, InternalRowData, SortOrderFlag, SortState, CreateRowClassName, TableSelectionColumn, TableColumn, TableExpandColumn } from './interface';
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
3
|
+
export declare const SELECTION_COL_WIDTH = 40;
|
|
4
|
+
export declare const EXPAND_COL_WIDTH = 40;
|
|
5
5
|
export declare function getNumberColWidth(col: TableColumn): number | undefined;
|
|
6
6
|
export declare function getStringColWidth(col: TableColumn): string | undefined;
|
|
7
7
|
export declare function getColKey(col: TableColumn): string | number;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { depx } from 'seemly';
|
|
2
2
|
import { formatLength } from '../../_utils';
|
|
3
|
-
export const
|
|
4
|
-
export const
|
|
3
|
+
export const SELECTION_COL_WIDTH = 40;
|
|
4
|
+
export const EXPAND_COL_WIDTH = 40;
|
|
5
5
|
export function getNumberColWidth(col) {
|
|
6
|
-
if (col.type === 'selection')
|
|
7
|
-
return
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
if (col.type === 'selection') {
|
|
7
|
+
return col.width === undefined ? SELECTION_COL_WIDTH : depx(col.width);
|
|
8
|
+
}
|
|
9
|
+
if (col.type === 'expand') {
|
|
10
|
+
return col.width === undefined ? EXPAND_COL_WIDTH : depx(col.width);
|
|
11
|
+
}
|
|
10
12
|
if ('children' in col)
|
|
11
13
|
return undefined;
|
|
12
14
|
if (typeof col.width === 'string') {
|
|
@@ -17,10 +19,10 @@ export function getNumberColWidth(col) {
|
|
|
17
19
|
export function getStringColWidth(col) {
|
|
18
20
|
var _a, _b;
|
|
19
21
|
if (col.type === 'selection') {
|
|
20
|
-
return formatLength((_a = col.width) !== null && _a !== void 0 ? _a :
|
|
22
|
+
return formatLength((_a = col.width) !== null && _a !== void 0 ? _a : SELECTION_COL_WIDTH);
|
|
21
23
|
}
|
|
22
24
|
if (col.type === 'expand') {
|
|
23
|
-
return formatLength((_b = col.width) !== null && _b !== void 0 ? _b :
|
|
25
|
+
return formatLength((_b = col.width) !== null && _b !== void 0 ? _b : EXPAND_COL_WIDTH);
|
|
24
26
|
}
|
|
25
27
|
if ('children' in col) {
|
|
26
28
|
return undefined;
|
|
@@ -626,6 +626,77 @@ declare const dataTableLight: import("../../_mixins").Theme<"DataTable", {
|
|
|
626
626
|
paddingLarge: string;
|
|
627
627
|
clearSize: string;
|
|
628
628
|
}, any>;
|
|
629
|
+
Popselect: import("../../_mixins").Theme<"Popselect", {
|
|
630
|
+
menuBoxShadow: string;
|
|
631
|
+
}, {
|
|
632
|
+
Popover: import("../../_mixins").Theme<"Popover", {
|
|
633
|
+
fontSize: string;
|
|
634
|
+
borderRadius: string;
|
|
635
|
+
color: string;
|
|
636
|
+
dividerColor: string;
|
|
637
|
+
textColor: string;
|
|
638
|
+
boxShadow: string;
|
|
639
|
+
space: string;
|
|
640
|
+
spaceArrow: string;
|
|
641
|
+
arrowOffset: string;
|
|
642
|
+
arrowOffsetVertical: string;
|
|
643
|
+
arrowHeight: string;
|
|
644
|
+
padding: string;
|
|
645
|
+
}, any>;
|
|
646
|
+
InternalSelectMenu: import("../../_mixins").Theme<"InternalSelectMenu", {
|
|
647
|
+
optionFontSizeSmall: string;
|
|
648
|
+
optionFontSizeMedium: string;
|
|
649
|
+
optionFontSizeLarge: string;
|
|
650
|
+
optionFontSizeHuge: string;
|
|
651
|
+
optionHeightSmall: string;
|
|
652
|
+
optionHeightMedium: string;
|
|
653
|
+
optionHeightLarge: string;
|
|
654
|
+
optionHeightHuge: string;
|
|
655
|
+
borderRadius: string;
|
|
656
|
+
color: string;
|
|
657
|
+
groupHeaderTextColor: string;
|
|
658
|
+
actionDividerColor: string;
|
|
659
|
+
optionTextColor: string;
|
|
660
|
+
optionTextColorPressed: string;
|
|
661
|
+
optionTextColorDisabled: string;
|
|
662
|
+
optionTextColorActive: string;
|
|
663
|
+
optionOpacityDisabled: string;
|
|
664
|
+
optionCheckColor: string;
|
|
665
|
+
optionColorPending: string;
|
|
666
|
+
optionColorActive: string;
|
|
667
|
+
optionColorActivePending: string;
|
|
668
|
+
actionTextColor: string;
|
|
669
|
+
loadingColor: string;
|
|
670
|
+
height: string;
|
|
671
|
+
paddingSmall: string;
|
|
672
|
+
paddingMedium: string;
|
|
673
|
+
paddingLarge: string;
|
|
674
|
+
paddingHuge: string;
|
|
675
|
+
optionPaddingSmall: string;
|
|
676
|
+
optionPaddingMedium: string;
|
|
677
|
+
optionPaddingLarge: string;
|
|
678
|
+
optionPaddingHuge: string;
|
|
679
|
+
loadingSize: string;
|
|
680
|
+
}, {
|
|
681
|
+
Scrollbar: import("../../_mixins").Theme<"Scrollbar", {
|
|
682
|
+
color: string;
|
|
683
|
+
colorHover: string;
|
|
684
|
+
}, any>;
|
|
685
|
+
Empty: import("../../_mixins").Theme<"Empty", {
|
|
686
|
+
fontSizeSmall: string;
|
|
687
|
+
fontSizeMedium: string;
|
|
688
|
+
fontSizeLarge: string;
|
|
689
|
+
fontSizeHuge: string;
|
|
690
|
+
textColor: string;
|
|
691
|
+
iconColor: string;
|
|
692
|
+
extraTextColor: string;
|
|
693
|
+
iconSizeSmall: string;
|
|
694
|
+
iconSizeMedium: string;
|
|
695
|
+
iconSizeLarge: string;
|
|
696
|
+
iconSizeHuge: string;
|
|
697
|
+
}, any>;
|
|
698
|
+
}>;
|
|
699
|
+
}>;
|
|
629
700
|
}>;
|
|
630
701
|
Scrollbar: import("../../_mixins").Theme<"Scrollbar", {
|
|
631
702
|
color: string;
|
|
@@ -3948,8 +3948,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
3948
3948
|
isValueInvalid: import("vue").ComputedRef<boolean>;
|
|
3949
3949
|
isStartValueInvalid: import("vue").ComputedRef<boolean>;
|
|
3950
3950
|
isEndValueInvalid: import("vue").ComputedRef<boolean>;
|
|
3951
|
+
handleInputKeydown: (e: KeyboardEvent) => void;
|
|
3951
3952
|
handleClickOutside: (e: MouseEvent) => void;
|
|
3952
|
-
|
|
3953
|
+
handleKeydown: (e: KeyboardEvent) => void;
|
|
3953
3954
|
handleClear: () => void;
|
|
3954
3955
|
handlePanelClear: () => void;
|
|
3955
3956
|
handleTriggerClick: (e: MouseEvent) => void;
|
|
@@ -8,7 +8,7 @@ import { DateIcon, ToIcon } from '../../_internal/icons';
|
|
|
8
8
|
import { NInput } from '../../input';
|
|
9
9
|
import { NBaseIcon } from '../../_internal';
|
|
10
10
|
import { useFormItem, useTheme, useConfig, useLocale, useThemeClass } from '../../_mixins';
|
|
11
|
-
import { warn, call, useAdjustedTo, createKey, warnOnce, resolveSlot } from '../../_utils';
|
|
11
|
+
import { warn, call, useAdjustedTo, createKey, warnOnce, resolveSlot, markEventEffectPerformed } from '../../_utils';
|
|
12
12
|
import { datePickerLight } from '../styles';
|
|
13
13
|
import { strictParse } from './utils';
|
|
14
14
|
import { uniCalendarValidation, dualCalendarValidation } from './validation-utils';
|
|
@@ -302,11 +302,14 @@ export default defineComponent({
|
|
|
302
302
|
call(onUpdateShow, show);
|
|
303
303
|
uncontrolledShowRef.value = show;
|
|
304
304
|
}
|
|
305
|
-
function
|
|
305
|
+
function handleKeydown(e) {
|
|
306
306
|
if (e.key === 'Escape') {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
307
|
+
if (mergedShowRef.value) {
|
|
308
|
+
markEventEffectPerformed(e);
|
|
309
|
+
closeCalendar({
|
|
310
|
+
returnFocus: true
|
|
311
|
+
});
|
|
312
|
+
}
|
|
310
313
|
}
|
|
311
314
|
// We need to handle the conflict with normal date value input
|
|
312
315
|
// const { value: mergedValue } = mergedValueRef
|
|
@@ -315,6 +318,12 @@ export default defineComponent({
|
|
|
315
318
|
// doUpdateValue(nextValue)
|
|
316
319
|
// }
|
|
317
320
|
}
|
|
321
|
+
function handleInputKeydown(e) {
|
|
322
|
+
if (e.key === 'Escape' && mergedShowRef.value) {
|
|
323
|
+
markEventEffectPerformed(e);
|
|
324
|
+
// closeCalendar will be called in handleDeactivated
|
|
325
|
+
}
|
|
326
|
+
}
|
|
318
327
|
function handleClear() {
|
|
319
328
|
var _a;
|
|
320
329
|
doUpdateShow(false);
|
|
@@ -595,8 +604,9 @@ export default defineComponent({
|
|
|
595
604
|
: undefined;
|
|
596
605
|
return Object.assign(Object.assign({}, exposedMethods), { mergedStatus: mergedStatusRef, mergedClsPrefix: mergedClsPrefixRef, mergedBordered: mergedBorderedRef, namespace: namespaceRef, uncontrolledValue: uncontrolledValueRef, pendingValue: pendingValueRef, panelInstRef,
|
|
597
606
|
triggerElRef,
|
|
598
|
-
inputInstRef, isMounted: useIsMounted(), displayTime: singleInputValueRef, displayStartTime: rangeStartInputValueRef, displayEndTime: rangeEndInputValueRef, mergedShow: mergedShowRef, adjustedTo: useAdjustedTo(props), isRange: isRangeRef, localizedStartPlaceholder: localizedStartPlaceholderRef, localizedEndPlaceholder: localizedEndPlaceholderRef, mergedSize: mergedSizeRef, mergedDisabled: mergedDisabledRef, localizedPlacehoder: localizedPlacehoderRef, isValueInvalid: uniVaidation.isValueInvalidRef, isStartValueInvalid: dualValidation.isStartValueInvalidRef, isEndValueInvalid: dualValidation.isEndValueInvalidRef,
|
|
599
|
-
|
|
607
|
+
inputInstRef, isMounted: useIsMounted(), displayTime: singleInputValueRef, displayStartTime: rangeStartInputValueRef, displayEndTime: rangeEndInputValueRef, mergedShow: mergedShowRef, adjustedTo: useAdjustedTo(props), isRange: isRangeRef, localizedStartPlaceholder: localizedStartPlaceholderRef, localizedEndPlaceholder: localizedEndPlaceholderRef, mergedSize: mergedSizeRef, mergedDisabled: mergedDisabledRef, localizedPlacehoder: localizedPlacehoderRef, isValueInvalid: uniVaidation.isValueInvalidRef, isStartValueInvalid: dualValidation.isStartValueInvalidRef, isEndValueInvalid: dualValidation.isEndValueInvalidRef, handleInputKeydown,
|
|
608
|
+
handleClickOutside,
|
|
609
|
+
handleKeydown,
|
|
600
610
|
handleClear,
|
|
601
611
|
handlePanelClear,
|
|
602
612
|
handleTriggerClick,
|
|
@@ -618,7 +628,7 @@ export default defineComponent({
|
|
|
618
628
|
onTabOut: this.handlePanelTabOut,
|
|
619
629
|
onClose: this.handlePanelClose,
|
|
620
630
|
onClear: this.handlePanelClear,
|
|
621
|
-
onKeydown: this.
|
|
631
|
+
onKeydown: this.handleKeydown,
|
|
622
632
|
onConfirm: this.handlePanelConfirm,
|
|
623
633
|
ref: 'panelInstRef',
|
|
624
634
|
value: this.pendingValue,
|
|
@@ -648,6 +658,7 @@ export default defineComponent({
|
|
|
648
658
|
clearable,
|
|
649
659
|
onClear: this.handleClear,
|
|
650
660
|
onClick: this.handleTriggerClick,
|
|
661
|
+
onKeydown: this.handleInputKeydown,
|
|
651
662
|
onActivate: this.handleInputActivate,
|
|
652
663
|
onDeactivate: this.handleInputDeactivate,
|
|
653
664
|
onFocus: this.handleInputFocus,
|
|
@@ -658,7 +669,7 @@ export default defineComponent({
|
|
|
658
669
|
this.mergedDisabled && `${mergedClsPrefix}-date-picker--disabled`,
|
|
659
670
|
this.isRange && `${mergedClsPrefix}-date-picker--range`,
|
|
660
671
|
this.triggerThemeClass
|
|
661
|
-
], style: this.triggerCssVars, onKeydown: this.
|
|
672
|
+
], style: this.triggerCssVars, onKeydown: this.handleKeydown },
|
|
662
673
|
h(VBinder, null, {
|
|
663
674
|
default: () => [
|
|
664
675
|
h(VTarget, null, {
|
|
@@ -30,6 +30,7 @@ export default defineComponent({
|
|
|
30
30
|
return `Q ${item.dateObject.quarter}`;
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
|
+
const { useAsQuickJump } = props;
|
|
33
34
|
const renderItem = (item, i, mergedClsPrefix) => {
|
|
34
35
|
const { mergedIsDateDisabled, handleDateClick, handleQuickMonthClick } = useCalendarRef;
|
|
35
36
|
return (h("div", { "data-n-date": true, key: i, class: [
|
|
@@ -37,10 +38,10 @@ export default defineComponent({
|
|
|
37
38
|
{
|
|
38
39
|
[`${mergedClsPrefix}-date-panel-month-calendar__picker-col-item--current`]: item.isCurrent,
|
|
39
40
|
[`${mergedClsPrefix}-date-panel-month-calendar__picker-col-item--selected`]: item.selected,
|
|
40
|
-
[`${mergedClsPrefix}-date-panel-month-calendar__picker-col-item--disabled`]: mergedIsDateDisabled(item.ts)
|
|
41
|
+
[`${mergedClsPrefix}-date-panel-month-calendar__picker-col-item--disabled`]: !useAsQuickJump && mergedIsDateDisabled(item.ts)
|
|
41
42
|
}
|
|
42
43
|
], onClick: () => {
|
|
43
|
-
|
|
44
|
+
useAsQuickJump
|
|
44
45
|
? handleQuickMonthClick(item, (value) => props.onUpdateValue(value, false))
|
|
45
46
|
: handleDateClick(item);
|
|
46
47
|
} }, getRenderContent(item)));
|
|
@@ -295,7 +295,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
295
295
|
namespace: import("vue").ComputedRef<string | undefined>;
|
|
296
296
|
mergedBodyStyle: import("vue").ComputedRef<(string | CSSProperties)[]>;
|
|
297
297
|
handleMaskClick: (e: MouseEvent) => void;
|
|
298
|
-
handleEsc: () => void;
|
|
298
|
+
handleEsc: (e: KeyboardEvent) => void;
|
|
299
299
|
mergedTheme: import("vue").ComputedRef<{
|
|
300
300
|
common: {
|
|
301
301
|
baseColor: string;
|
package/es/drawer/src/Drawer.js
CHANGED
|
@@ -3,7 +3,7 @@ import { VLazyTeleport } from 'vueuc';
|
|
|
3
3
|
import { zindexable } from 'vdirs';
|
|
4
4
|
import { useIsMounted } from 'vooks';
|
|
5
5
|
import { useTheme, useConfig, useThemeClass } from '../../_mixins';
|
|
6
|
-
import { formatLength, call, warnOnce, useIsComposing } from '../../_utils';
|
|
6
|
+
import { formatLength, call, warnOnce, useIsComposing, eventEffectNotPerformed } from '../../_utils';
|
|
7
7
|
import { drawerLight } from '../styles';
|
|
8
8
|
import NDrawerBodyWrapper from './DrawerBodyWrapper';
|
|
9
9
|
import { drawerInjectionKey } from './interface';
|
|
@@ -103,10 +103,10 @@ export default defineComponent({
|
|
|
103
103
|
onMaskClick(e);
|
|
104
104
|
}
|
|
105
105
|
const isComposingRef = useIsComposing();
|
|
106
|
-
function handleEsc() {
|
|
106
|
+
function handleEsc(e) {
|
|
107
107
|
var _a;
|
|
108
108
|
(_a = props.onEsc) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
109
|
-
if (props.closeOnEsc) {
|
|
109
|
+
if (props.show && props.closeOnEsc && eventEffectNotPerformed(e)) {
|
|
110
110
|
!isComposingRef.value && doUpdateShow(false);
|
|
111
111
|
}
|
|
112
112
|
}
|
|
@@ -36,7 +36,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
36
36
|
onClickoutside: PropType<(e: MouseEvent) => void>;
|
|
37
37
|
onAfterLeave: PropType<() => void>;
|
|
38
38
|
onAfterEnter: PropType<() => void>;
|
|
39
|
-
onEsc: PropType<() => void>;
|
|
39
|
+
onEsc: PropType<(e: KeyboardEvent) => void>;
|
|
40
40
|
}, {
|
|
41
41
|
bodyRef: import("vue").Ref<HTMLElement | null>;
|
|
42
42
|
mergedClsPrefix: import("vue").Ref<string>;
|
|
@@ -222,7 +222,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
222
222
|
onClickoutside: PropType<(e: MouseEvent) => void>;
|
|
223
223
|
onAfterLeave: PropType<() => void>;
|
|
224
224
|
onAfterEnter: PropType<() => void>;
|
|
225
|
-
onEsc: PropType<() => void>;
|
|
225
|
+
onEsc: PropType<(e: KeyboardEvent) => void>;
|
|
226
226
|
}>>, {
|
|
227
227
|
show: boolean | undefined;
|
|
228
228
|
autoFocus: boolean;
|
|
@@ -323,6 +323,7 @@ declare const dropdownProps: {
|
|
|
323
323
|
readonly onClickoutside: PropType<(e: MouseEvent) => void>;
|
|
324
324
|
readonly 'onUpdate:show': PropType<MaybeArray<(value: boolean) => void>>;
|
|
325
325
|
readonly onUpdateShow: PropType<MaybeArray<(value: boolean) => void>>;
|
|
326
|
+
readonly internalDeactivateImmediately: BooleanConstructor;
|
|
326
327
|
readonly internalSyncTargetWithParent: BooleanConstructor;
|
|
327
328
|
readonly internalInheritedEventHandlers: {
|
|
328
329
|
type: PropType<import("../../popover/src/Popover").TriggerEventHandlers[]>;
|
|
@@ -646,6 +647,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
646
647
|
readonly onClickoutside: PropType<(e: MouseEvent) => void>;
|
|
647
648
|
readonly 'onUpdate:show': PropType<MaybeArray<(value: boolean) => void>>;
|
|
648
649
|
readonly onUpdateShow: PropType<MaybeArray<(value: boolean) => void>>;
|
|
650
|
+
readonly internalDeactivateImmediately: BooleanConstructor;
|
|
649
651
|
readonly internalSyncTargetWithParent: BooleanConstructor;
|
|
650
652
|
readonly internalInheritedEventHandlers: {
|
|
651
653
|
type: PropType<import("../../popover/src/Popover").TriggerEventHandlers[]>;
|
|
@@ -1160,6 +1162,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1160
1162
|
readonly onClickoutside: PropType<(e: MouseEvent) => void>;
|
|
1161
1163
|
readonly 'onUpdate:show': PropType<MaybeArray<(value: boolean) => void>>;
|
|
1162
1164
|
readonly onUpdateShow: PropType<MaybeArray<(value: boolean) => void>>;
|
|
1165
|
+
readonly internalDeactivateImmediately: BooleanConstructor;
|
|
1163
1166
|
readonly internalSyncTargetWithParent: BooleanConstructor;
|
|
1164
1167
|
readonly internalInheritedEventHandlers: {
|
|
1165
1168
|
type: PropType<import("../../popover/src/Popover").TriggerEventHandlers[]>;
|
|
@@ -1199,6 +1202,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1199
1202
|
readonly arrowPointToCenter: boolean;
|
|
1200
1203
|
readonly displayDirective: "show" | "if";
|
|
1201
1204
|
readonly keepAliveOnHover: boolean;
|
|
1205
|
+
readonly internalDeactivateImmediately: boolean;
|
|
1202
1206
|
readonly animated: boolean;
|
|
1203
1207
|
readonly internalTrapFocus: boolean;
|
|
1204
1208
|
readonly defaultShow: boolean;
|
|
@@ -87,7 +87,7 @@ export default defineComponent({
|
|
|
87
87
|
const nextValue = externalValue !== null && externalValue !== void 0 ? externalValue : inputValueRef.value;
|
|
88
88
|
if (nextValue) {
|
|
89
89
|
const tags = mergedValueRef.value.slice(0);
|
|
90
|
-
tags.push(nextValue);
|
|
90
|
+
tags.push(props.onCreate(nextValue));
|
|
91
91
|
doChange(tags);
|
|
92
92
|
}
|
|
93
93
|
showInputRef.value = false;
|
package/es/grid/src/Grid.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ declare const gridProps: {
|
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
29
|
export interface NGridInjection {
|
|
30
|
+
isSsrRef: Ref<boolean>;
|
|
30
31
|
itemStyleRef: Ref<CSSProperties | string | undefined>;
|
|
31
32
|
xGapRef: Ref<string | undefined>;
|
|
32
33
|
overflowRef: Ref<boolean>;
|
|
@@ -57,6 +58,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
57
58
|
readonly default: 0;
|
|
58
59
|
};
|
|
59
60
|
}, {
|
|
61
|
+
isSsr: boolean;
|
|
62
|
+
contentEl: Ref<HTMLElement | undefined>;
|
|
60
63
|
mergedClsPrefix: import("vue").ComputedRef<string>;
|
|
61
64
|
style: import("vue").ComputedRef<CSSProperties>;
|
|
62
65
|
isResponsive: import("vue").ComputedRef<boolean>;
|
package/es/grid/src/Grid.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { h, defineComponent, computed, provide, toRef, mergeProps, ref, cloneVNode } from 'vue';
|
|
1
|
+
import { h, defineComponent, computed, provide, toRef, mergeProps, ref, cloneVNode, vShow, onMounted } from 'vue';
|
|
2
2
|
import { useBreakpoints, useMemo } from 'vooks';
|
|
3
3
|
import { VResizeObserver } from 'vueuc';
|
|
4
4
|
import { pxfy, parseResponsivePropValue, beforeNextFrameOnce } from 'seemly';
|
|
5
5
|
import { defaultBreakpoints } from '../../config-provider/src/config';
|
|
6
6
|
import { useConfig } from '../../_mixins';
|
|
7
|
-
import { getSlot, flatten } from '../../_utils';
|
|
7
|
+
import { getSlot, flatten, isBrowser, isNodeVShowFalse } from '../../_utils';
|
|
8
8
|
import { defaultSpan, gridInjectionKey } from './config';
|
|
9
9
|
const defaultCols = 24;
|
|
10
|
+
const SSR_ATTR_NAME = '__ssr__';
|
|
10
11
|
const gridProps = {
|
|
11
12
|
responsive: {
|
|
12
13
|
type: [String, Boolean],
|
|
@@ -77,12 +78,27 @@ export default defineComponent({
|
|
|
77
78
|
}
|
|
78
79
|
return undefined;
|
|
79
80
|
});
|
|
81
|
+
// for SSR, fix bug https://github.com/TuSimple/naive-ui/issues/2462
|
|
82
|
+
const isSsrRef = ref(false);
|
|
83
|
+
const contentElRef = ref();
|
|
84
|
+
onMounted(() => {
|
|
85
|
+
const { value: contentEl } = contentElRef;
|
|
86
|
+
if (contentEl) {
|
|
87
|
+
if (contentEl.hasAttribute(SSR_ATTR_NAME)) {
|
|
88
|
+
contentEl.removeAttribute(SSR_ATTR_NAME);
|
|
89
|
+
isSsrRef.value = true;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
});
|
|
80
93
|
provide(gridInjectionKey, {
|
|
94
|
+
isSsrRef,
|
|
81
95
|
itemStyleRef: toRef(props, 'itemStyle'),
|
|
82
96
|
xGapRef: responsiveXGapRef,
|
|
83
97
|
overflowRef
|
|
84
98
|
});
|
|
85
99
|
return {
|
|
100
|
+
isSsr: !isBrowser,
|
|
101
|
+
contentEl: contentElRef,
|
|
86
102
|
mergedClsPrefix: mergedClsPrefixRef,
|
|
87
103
|
style: computed(() => {
|
|
88
104
|
return {
|
|
@@ -102,7 +118,7 @@ export default defineComponent({
|
|
|
102
118
|
},
|
|
103
119
|
render() {
|
|
104
120
|
const renderContent = () => {
|
|
105
|
-
var _a, _b, _c, _d, _e, _f;
|
|
121
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
106
122
|
this.overflow = false;
|
|
107
123
|
// render will be called twice when mounted, I can't figure out why
|
|
108
124
|
// 2 jobs will be pushed into job queues with same id, and then be flushed
|
|
@@ -110,11 +126,28 @@ export default defineComponent({
|
|
|
110
126
|
const childrenAndRawSpan = [];
|
|
111
127
|
const { collapsed, collapsedRows, responsiveCols, responsiveQuery } = this;
|
|
112
128
|
rawChildren.forEach((child) => {
|
|
113
|
-
var _a, _b, _c;
|
|
129
|
+
var _a, _b, _c, _d;
|
|
114
130
|
if (((_a = child === null || child === void 0 ? void 0 : child.type) === null || _a === void 0 ? void 0 : _a.__GRID_ITEM__) !== true)
|
|
115
131
|
return;
|
|
132
|
+
if (isNodeVShowFalse(child)) {
|
|
133
|
+
const clonedNode = cloneVNode(child);
|
|
134
|
+
if (clonedNode.props) {
|
|
135
|
+
clonedNode.props.privateShow = false;
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
clonedNode.props = { pirvateShow: false };
|
|
139
|
+
}
|
|
140
|
+
childrenAndRawSpan.push({
|
|
141
|
+
child: clonedNode,
|
|
142
|
+
rawChildSpan: 0
|
|
143
|
+
});
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
// We don't want v-show to control display, so we need to stripe it
|
|
147
|
+
// here, nor it may mess child's style
|
|
148
|
+
child.dirs = ((_b = child.dirs) === null || _b === void 0 ? void 0 : _b.filter(({ dir }) => dir !== vShow)) || null;
|
|
116
149
|
const clonedChild = cloneVNode(child);
|
|
117
|
-
const rawChildSpan = Number((
|
|
150
|
+
const rawChildSpan = Number((_d = parseResponsivePropValue((_c = clonedChild.props) === null || _c === void 0 ? void 0 : _c.span, responsiveQuery)) !== null && _d !== void 0 ? _d : defaultSpan);
|
|
118
151
|
if (rawChildSpan === 0)
|
|
119
152
|
return;
|
|
120
153
|
childrenAndRawSpan.push({
|
|
@@ -131,7 +164,8 @@ export default defineComponent({
|
|
|
131
164
|
maybeSuffixNode.props.privateSpan = suffixSpan;
|
|
132
165
|
maybeSuffixNode.props.privateColStart =
|
|
133
166
|
responsiveCols + 1 - suffixSpan;
|
|
134
|
-
maybeSuffixNode.props.privateShow =
|
|
167
|
+
maybeSuffixNode.props.privateShow =
|
|
168
|
+
(_e = maybeSuffixNode.props.privateShow) !== null && _e !== void 0 ? _e : true;
|
|
135
169
|
}
|
|
136
170
|
}
|
|
137
171
|
let spanCounter = 0;
|
|
@@ -141,8 +175,9 @@ export default defineComponent({
|
|
|
141
175
|
this.overflow = true;
|
|
142
176
|
}
|
|
143
177
|
if (!done) {
|
|
144
|
-
const childOffset = Number((
|
|
145
|
-
|
|
178
|
+
const childOffset = Number((_g = parseResponsivePropValue((_f = child.props) === null || _f === void 0 ? void 0 : _f.offset, responsiveQuery)) !== null && _g !== void 0 ? _g : 0);
|
|
179
|
+
// it could be 0 sometimes (v-show = false)
|
|
180
|
+
const childSpan = Math.min(rawChildSpan + childOffset, responsiveCols);
|
|
146
181
|
if (!child.props) {
|
|
147
182
|
child.props = {
|
|
148
183
|
privateSpan: childSpan,
|
|
@@ -169,6 +204,7 @@ export default defineComponent({
|
|
|
169
204
|
}
|
|
170
205
|
if (done) {
|
|
171
206
|
if (child.props) {
|
|
207
|
+
// suffix node's privateShow may be true
|
|
172
208
|
if (child.props.privateShow !== true) {
|
|
173
209
|
child.props.privateShow = false;
|
|
174
210
|
}
|
|
@@ -181,8 +217,10 @@ export default defineComponent({
|
|
|
181
217
|
}
|
|
182
218
|
}
|
|
183
219
|
return h('div', mergeProps({
|
|
220
|
+
ref: 'contentEl',
|
|
184
221
|
class: `${this.mergedClsPrefix}-grid`,
|
|
185
|
-
style: this.style
|
|
222
|
+
style: this.style,
|
|
223
|
+
[SSR_ATTR_NAME]: this.isSsr || undefined
|
|
186
224
|
}, this.$attrs), childrenAndRawSpan.map(({ child }) => child));
|
|
187
225
|
};
|
|
188
226
|
return this.isResponsive && this.responsive === 'self' ? (h(VResizeObserver, { onResize: this.handleResize }, {
|
package/es/grid/src/GridItem.js
CHANGED
|
@@ -29,7 +29,7 @@ export default defineComponent({
|
|
|
29
29
|
alias: ['Gi'],
|
|
30
30
|
props: gridItemProps,
|
|
31
31
|
setup() {
|
|
32
|
-
const { xGapRef, itemStyleRef, overflowRef
|
|
32
|
+
const { isSsrRef, xGapRef, itemStyleRef, overflowRef
|
|
33
33
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
34
34
|
} = inject(gridInjectionKey);
|
|
35
35
|
const self = getCurrentInstance();
|
|
@@ -37,6 +37,7 @@ export default defineComponent({
|
|
|
37
37
|
overflow: overflowRef,
|
|
38
38
|
itemStyle: itemStyleRef,
|
|
39
39
|
deriveStyle: () => {
|
|
40
|
+
void isSsrRef.value;
|
|
40
41
|
// Here is quite a hack, I hope there is a better way to solve it
|
|
41
42
|
const { privateSpan = defaultSpan, privateShow = true, privateColStart = undefined, privateOffset = 0
|
|
42
43
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
package/es/image/src/Image.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PropType, ImgHTMLAttributes } from 'vue';
|
|
2
2
|
import type { ExtractPublicPropTypes } from '../../_utils';
|
|
3
|
+
import type { IntersectionObserverOptions } from './utils';
|
|
3
4
|
export interface ImageInst {
|
|
4
5
|
click: () => void;
|
|
5
6
|
}
|
|
@@ -99,6 +100,8 @@ declare const imageProps: {
|
|
|
99
100
|
alt: StringConstructor;
|
|
100
101
|
height: PropType<string | number>;
|
|
101
102
|
imgProps: PropType<ImgHTMLAttributes>;
|
|
103
|
+
lazy: BooleanConstructor;
|
|
104
|
+
intersectionObserverOptions: PropType<IntersectionObserverOptions>;
|
|
102
105
|
objectFit: {
|
|
103
106
|
type: PropType<"fill" | "none" | "contain" | "cover" | "scale-down">;
|
|
104
107
|
default: string;
|
|
@@ -209,6 +212,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
209
212
|
alt: StringConstructor;
|
|
210
213
|
height: PropType<string | number>;
|
|
211
214
|
imgProps: PropType<ImgHTMLAttributes>;
|
|
215
|
+
lazy: BooleanConstructor;
|
|
216
|
+
intersectionObserverOptions: PropType<IntersectionObserverOptions>;
|
|
212
217
|
objectFit: {
|
|
213
218
|
type: PropType<"fill" | "none" | "contain" | "cover" | "scale-down">;
|
|
214
219
|
default: string;
|
|
@@ -233,6 +238,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
233
238
|
imageRef: import("vue").Ref<HTMLImageElement | null>;
|
|
234
239
|
imgProps: import("vue").Ref<ImgHTMLAttributes | undefined>;
|
|
235
240
|
showError: import("vue").Ref<boolean>;
|
|
241
|
+
shouldStartLoading: import("vue").Ref<boolean>;
|
|
242
|
+
loaded: import("vue").Ref<boolean>;
|
|
236
243
|
mergedOnError: (e: Event) => void;
|
|
237
244
|
mergedOnLoad: (e: Event) => void;
|
|
238
245
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -331,6 +338,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
331
338
|
alt: StringConstructor;
|
|
332
339
|
height: PropType<string | number>;
|
|
333
340
|
imgProps: PropType<ImgHTMLAttributes>;
|
|
341
|
+
lazy: BooleanConstructor;
|
|
342
|
+
intersectionObserverOptions: PropType<IntersectionObserverOptions>;
|
|
334
343
|
objectFit: {
|
|
335
344
|
type: PropType<"fill" | "none" | "contain" | "cover" | "scale-down">;
|
|
336
345
|
default: string;
|
|
@@ -344,6 +353,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
344
353
|
onError: PropType<(e: Event) => void>;
|
|
345
354
|
onLoad: PropType<(e: Event) => void>;
|
|
346
355
|
}>>, {
|
|
356
|
+
lazy: boolean;
|
|
347
357
|
objectFit: "fill" | "none" | "contain" | "cover" | "scale-down";
|
|
348
358
|
showToolbar: boolean;
|
|
349
359
|
showToolbarTooltip: boolean;
|