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
|
@@ -211,7 +211,9 @@ exports.default = (0, cssr_1.c)([(0, cssr_1.cB)('data-table', `
|
|
|
211
211
|
background-color .3s var(--n-bezier),
|
|
212
212
|
border-color .3s var(--n-bezier),
|
|
213
213
|
color .3s var(--n-bezier);
|
|
214
|
-
`, [(0, cssr_1.cM)('
|
|
214
|
+
`, [(0, cssr_1.cM)('expand', [(0, cssr_1.cB)('data-table-expand-trigger', `
|
|
215
|
+
margin-right: 0;
|
|
216
|
+
`)]), (0, cssr_1.cM)('last-row', {
|
|
215
217
|
borderBottom: '0 solid var(--n-merged-border-color)'
|
|
216
218
|
}, [// make sure there is no overlap between bottom border and
|
|
217
219
|
// fixed column box shadow
|
|
@@ -223,10 +225,13 @@ exports.default = (0, cssr_1.c)([(0, cssr_1.cB)('data-table', `
|
|
|
223
225
|
background-color: var(--n-merged-th-color);
|
|
224
226
|
`), (0, cssr_1.cM)('hover', {
|
|
225
227
|
backgroundColor: 'var(--n-merged-td-color-hover)'
|
|
226
|
-
}), (0, cssr_1.
|
|
228
|
+
}), (0, cssr_1.cE)('ellipsis', `
|
|
229
|
+
display: inline-block;
|
|
227
230
|
text-overflow: ellipsis;
|
|
228
231
|
overflow: hidden;
|
|
229
232
|
white-space: nowrap;
|
|
233
|
+
max-width: 100%;
|
|
234
|
+
vertical-align: bottom;
|
|
230
235
|
`), (0, cssr_1.cM)('selection, expand', `
|
|
231
236
|
text-align: center;
|
|
232
237
|
padding: 0;
|
|
@@ -53,12 +53,20 @@ function useCheck(props, data) {
|
|
|
53
53
|
});
|
|
54
54
|
function doUpdateCheckedRowKeys(keys) {
|
|
55
55
|
const { 'onUpdate:checkedRowKeys': _onUpdateCheckedRowKeys, onUpdateCheckedRowKeys, onCheckedRowKeysChange } = props;
|
|
56
|
+
const rows = [];
|
|
57
|
+
const { value: { getNode } } = treeMateRef;
|
|
58
|
+
keys.forEach((key) => {
|
|
59
|
+
var _a;
|
|
60
|
+
const row = (_a = getNode(key)) === null || _a === void 0 ? void 0 : _a.rawNode;
|
|
61
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
62
|
+
rows.push(row);
|
|
63
|
+
});
|
|
56
64
|
if (_onUpdateCheckedRowKeys)
|
|
57
|
-
(0, _utils_1.call)(_onUpdateCheckedRowKeys, keys);
|
|
65
|
+
(0, _utils_1.call)(_onUpdateCheckedRowKeys, keys, rows);
|
|
58
66
|
if (onUpdateCheckedRowKeys)
|
|
59
|
-
(0, _utils_1.call)(onUpdateCheckedRowKeys, keys);
|
|
67
|
+
(0, _utils_1.call)(onUpdateCheckedRowKeys, keys, rows);
|
|
60
68
|
if (onCheckedRowKeysChange)
|
|
61
|
-
(0, _utils_1.call)(onCheckedRowKeysChange, keys);
|
|
69
|
+
(0, _utils_1.call)(onCheckedRowKeysChange, keys, rows);
|
|
62
70
|
uncontrolledCheckedRowKeysRef.value = keys;
|
|
63
71
|
}
|
|
64
72
|
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
|
};
|
|
@@ -5,7 +5,7 @@ const vue_1 = require("vue");
|
|
|
5
5
|
const vooks_1 = require("vooks");
|
|
6
6
|
const _utils_1 = require("../../_utils");
|
|
7
7
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
8
|
-
function useExpand(props) {
|
|
8
|
+
function useExpand(props, treeMateRef) {
|
|
9
9
|
const renderExpandRef = (0, vooks_1.useMemo)(() => {
|
|
10
10
|
for (const col of props.columns) {
|
|
11
11
|
if (col.type === 'expand') {
|
|
@@ -16,7 +16,27 @@ function useExpand(props) {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
|
|
19
|
+
// It's not reactive
|
|
20
|
+
let expandable;
|
|
21
|
+
for (const col of props.columns) {
|
|
22
|
+
if (col.type === 'expand') {
|
|
23
|
+
expandable = col.expandable;
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const uncontrolledExpandedRowKeysRef = (0, vue_1.ref)(props.defaultExpandAll
|
|
28
|
+
? (renderExpandRef === null || renderExpandRef === void 0 ? void 0 : renderExpandRef.value)
|
|
29
|
+
? (() => {
|
|
30
|
+
const expandedKeys = [];
|
|
31
|
+
treeMateRef.value.treeNodes.forEach((tmNode) => {
|
|
32
|
+
if (expandable === null || expandable === void 0 ? void 0 : expandable(tmNode.rawNode)) {
|
|
33
|
+
expandedKeys.push(tmNode.key);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
return expandedKeys;
|
|
37
|
+
})()
|
|
38
|
+
: treeMateRef.value.getNonLeafKeys()
|
|
39
|
+
: props.defaultExpandedRowKeys);
|
|
20
40
|
const controlledExpandedRowKeysRef = (0, vue_1.toRef)(props, 'expandedRowKeys');
|
|
21
41
|
const mergedExpandedRowKeysRef = (0, vooks_1.useMergedState)(controlledExpandedRowKeysRef, uncontrolledExpandedRowKeysRef);
|
|
22
42
|
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,15 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isColumnSorting = exports.createNextSorter = exports.isColumnFilterable = exports.isColumnSortable = exports.shouldUseArrayInSingleMode = exports.createRowClassName = exports.createCustomWidthStyle = exports.getFlagOfOrder = exports.createShallowClonedObject = exports.getColKey = exports.getStringColWidth = exports.getNumberColWidth = exports.
|
|
3
|
+
exports.isColumnSorting = exports.createNextSorter = exports.isColumnFilterable = exports.isColumnSortable = exports.shouldUseArrayInSingleMode = exports.createRowClassName = exports.createCustomWidthStyle = exports.getFlagOfOrder = exports.createShallowClonedObject = exports.getColKey = exports.getStringColWidth = exports.getNumberColWidth = exports.EXPAND_COL_WIDTH = exports.SELECTION_COL_WIDTH = void 0;
|
|
4
4
|
const seemly_1 = require("seemly");
|
|
5
5
|
const _utils_1 = require("../../_utils");
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
6
|
+
exports.SELECTION_COL_WIDTH = 40;
|
|
7
|
+
exports.EXPAND_COL_WIDTH = 40;
|
|
8
8
|
function getNumberColWidth(col) {
|
|
9
|
-
if (col.type === 'selection')
|
|
10
|
-
return exports.
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
if (col.type === 'selection') {
|
|
10
|
+
return col.width === undefined ? exports.SELECTION_COL_WIDTH : (0, seemly_1.depx)(col.width);
|
|
11
|
+
}
|
|
12
|
+
if (col.type === 'expand') {
|
|
13
|
+
return col.width === undefined ? exports.EXPAND_COL_WIDTH : (0, seemly_1.depx)(col.width);
|
|
14
|
+
}
|
|
13
15
|
if ('children' in col)
|
|
14
16
|
return undefined;
|
|
15
17
|
if (typeof col.width === 'string') {
|
|
@@ -21,10 +23,10 @@ exports.getNumberColWidth = getNumberColWidth;
|
|
|
21
23
|
function getStringColWidth(col) {
|
|
22
24
|
var _a, _b;
|
|
23
25
|
if (col.type === 'selection') {
|
|
24
|
-
return (0, _utils_1.formatLength)((_a = col.width) !== null && _a !== void 0 ? _a : exports.
|
|
26
|
+
return (0, _utils_1.formatLength)((_a = col.width) !== null && _a !== void 0 ? _a : exports.SELECTION_COL_WIDTH);
|
|
25
27
|
}
|
|
26
28
|
if (col.type === 'expand') {
|
|
27
|
-
return (0, _utils_1.formatLength)((_b = col.width) !== null && _b !== void 0 ? _b : exports.
|
|
29
|
+
return (0, _utils_1.formatLength)((_b = col.width) !== null && _b !== void 0 ? _b : exports.EXPAND_COL_WIDTH);
|
|
28
30
|
}
|
|
29
31
|
if ('children' in col) {
|
|
30
32
|
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;
|
|
@@ -307,11 +307,14 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
307
307
|
(0, _utils_1.call)(onUpdateShow, show);
|
|
308
308
|
uncontrolledShowRef.value = show;
|
|
309
309
|
}
|
|
310
|
-
function
|
|
310
|
+
function handleKeydown(e) {
|
|
311
311
|
if (e.key === 'Escape') {
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
312
|
+
if (mergedShowRef.value) {
|
|
313
|
+
(0, _utils_1.markEventEffectPerformed)(e);
|
|
314
|
+
closeCalendar({
|
|
315
|
+
returnFocus: true
|
|
316
|
+
});
|
|
317
|
+
}
|
|
315
318
|
}
|
|
316
319
|
// We need to handle the conflict with normal date value input
|
|
317
320
|
// const { value: mergedValue } = mergedValueRef
|
|
@@ -320,6 +323,12 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
320
323
|
// doUpdateValue(nextValue)
|
|
321
324
|
// }
|
|
322
325
|
}
|
|
326
|
+
function handleInputKeydown(e) {
|
|
327
|
+
if (e.key === 'Escape' && mergedShowRef.value) {
|
|
328
|
+
(0, _utils_1.markEventEffectPerformed)(e);
|
|
329
|
+
// closeCalendar will be called in handleDeactivated
|
|
330
|
+
}
|
|
331
|
+
}
|
|
323
332
|
function handleClear() {
|
|
324
333
|
var _a;
|
|
325
334
|
doUpdateShow(false);
|
|
@@ -600,8 +609,9 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
600
609
|
: undefined;
|
|
601
610
|
return Object.assign(Object.assign({}, exposedMethods), { mergedStatus: mergedStatusRef, mergedClsPrefix: mergedClsPrefixRef, mergedBordered: mergedBorderedRef, namespace: namespaceRef, uncontrolledValue: uncontrolledValueRef, pendingValue: pendingValueRef, panelInstRef,
|
|
602
611
|
triggerElRef,
|
|
603
|
-
inputInstRef, isMounted: (0, vooks_1.useIsMounted)(), displayTime: singleInputValueRef, displayStartTime: rangeStartInputValueRef, displayEndTime: rangeEndInputValueRef, mergedShow: mergedShowRef, adjustedTo: (0, _utils_1.useAdjustedTo)(props), isRange: isRangeRef, localizedStartPlaceholder: localizedStartPlaceholderRef, localizedEndPlaceholder: localizedEndPlaceholderRef, mergedSize: mergedSizeRef, mergedDisabled: mergedDisabledRef, localizedPlacehoder: localizedPlacehoderRef, isValueInvalid: uniVaidation.isValueInvalidRef, isStartValueInvalid: dualValidation.isStartValueInvalidRef, isEndValueInvalid: dualValidation.isEndValueInvalidRef,
|
|
604
|
-
|
|
612
|
+
inputInstRef, isMounted: (0, vooks_1.useIsMounted)(), displayTime: singleInputValueRef, displayStartTime: rangeStartInputValueRef, displayEndTime: rangeEndInputValueRef, mergedShow: mergedShowRef, adjustedTo: (0, _utils_1.useAdjustedTo)(props), isRange: isRangeRef, localizedStartPlaceholder: localizedStartPlaceholderRef, localizedEndPlaceholder: localizedEndPlaceholderRef, mergedSize: mergedSizeRef, mergedDisabled: mergedDisabledRef, localizedPlacehoder: localizedPlacehoderRef, isValueInvalid: uniVaidation.isValueInvalidRef, isStartValueInvalid: dualValidation.isStartValueInvalidRef, isEndValueInvalid: dualValidation.isEndValueInvalidRef, handleInputKeydown,
|
|
613
|
+
handleClickOutside,
|
|
614
|
+
handleKeydown,
|
|
605
615
|
handleClear,
|
|
606
616
|
handlePanelClear,
|
|
607
617
|
handleTriggerClick,
|
|
@@ -623,7 +633,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
623
633
|
onTabOut: this.handlePanelTabOut,
|
|
624
634
|
onClose: this.handlePanelClose,
|
|
625
635
|
onClear: this.handlePanelClear,
|
|
626
|
-
onKeydown: this.
|
|
636
|
+
onKeydown: this.handleKeydown,
|
|
627
637
|
onConfirm: this.handlePanelConfirm,
|
|
628
638
|
ref: 'panelInstRef',
|
|
629
639
|
value: this.pendingValue,
|
|
@@ -653,6 +663,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
653
663
|
clearable,
|
|
654
664
|
onClear: this.handleClear,
|
|
655
665
|
onClick: this.handleTriggerClick,
|
|
666
|
+
onKeydown: this.handleInputKeydown,
|
|
656
667
|
onActivate: this.handleInputActivate,
|
|
657
668
|
onDeactivate: this.handleInputDeactivate,
|
|
658
669
|
onFocus: this.handleInputFocus,
|
|
@@ -663,7 +674,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
663
674
|
this.mergedDisabled && `${mergedClsPrefix}-date-picker--disabled`,
|
|
664
675
|
this.isRange && `${mergedClsPrefix}-date-picker--range`,
|
|
665
676
|
this.triggerThemeClass
|
|
666
|
-
], style: this.triggerCssVars, onKeydown: this.
|
|
677
|
+
], style: this.triggerCssVars, onKeydown: this.handleKeydown },
|
|
667
678
|
(0, vue_1.h)(vueuc_1.VBinder, null, {
|
|
668
679
|
default: () => [
|
|
669
680
|
(0, vue_1.h)(vueuc_1.VTarget, null, {
|
|
@@ -32,6 +32,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
32
32
|
return `Q ${item.dateObject.quarter}`;
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
|
+
const { useAsQuickJump } = props;
|
|
35
36
|
const renderItem = (item, i, mergedClsPrefix) => {
|
|
36
37
|
const { mergedIsDateDisabled, handleDateClick, handleQuickMonthClick } = useCalendarRef;
|
|
37
38
|
return ((0, vue_1.h)("div", { "data-n-date": true, key: i, class: [
|
|
@@ -39,10 +40,10 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
39
40
|
{
|
|
40
41
|
[`${mergedClsPrefix}-date-panel-month-calendar__picker-col-item--current`]: item.isCurrent,
|
|
41
42
|
[`${mergedClsPrefix}-date-panel-month-calendar__picker-col-item--selected`]: item.selected,
|
|
42
|
-
[`${mergedClsPrefix}-date-panel-month-calendar__picker-col-item--disabled`]: mergedIsDateDisabled(item.ts)
|
|
43
|
+
[`${mergedClsPrefix}-date-panel-month-calendar__picker-col-item--disabled`]: !useAsQuickJump && mergedIsDateDisabled(item.ts)
|
|
43
44
|
}
|
|
44
45
|
], onClick: () => {
|
|
45
|
-
|
|
46
|
+
useAsQuickJump
|
|
46
47
|
? handleQuickMonthClick(item, (value) => props.onUpdateValue(value, false))
|
|
47
48
|
: handleDateClick(item);
|
|
48
49
|
} }, 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/lib/drawer/src/Drawer.js
CHANGED
|
@@ -108,10 +108,10 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
108
108
|
onMaskClick(e);
|
|
109
109
|
}
|
|
110
110
|
const isComposingRef = (0, _utils_1.useIsComposing)();
|
|
111
|
-
function handleEsc() {
|
|
111
|
+
function handleEsc(e) {
|
|
112
112
|
var _a;
|
|
113
113
|
(_a = props.onEsc) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
114
|
-
if (props.closeOnEsc) {
|
|
114
|
+
if (props.show && props.closeOnEsc && (0, _utils_1.eventEffectNotPerformed)(e)) {
|
|
115
115
|
!isComposingRef.value && doUpdateShow(false);
|
|
116
116
|
}
|
|
117
117
|
}
|
|
@@ -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;
|
|
@@ -92,7 +92,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
92
92
|
const nextValue = externalValue !== null && externalValue !== void 0 ? externalValue : inputValueRef.value;
|
|
93
93
|
if (nextValue) {
|
|
94
94
|
const tags = mergedValueRef.value.slice(0);
|
|
95
|
-
tags.push(nextValue);
|
|
95
|
+
tags.push(props.onCreate(nextValue));
|
|
96
96
|
doChange(tags);
|
|
97
97
|
}
|
|
98
98
|
showInputRef.value = false;
|
package/lib/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/lib/grid/src/Grid.js
CHANGED
|
@@ -9,6 +9,7 @@ const _mixins_1 = require("../../_mixins");
|
|
|
9
9
|
const _utils_1 = require("../../_utils");
|
|
10
10
|
const config_2 = require("./config");
|
|
11
11
|
const defaultCols = 24;
|
|
12
|
+
const SSR_ATTR_NAME = '__ssr__';
|
|
12
13
|
const gridProps = {
|
|
13
14
|
responsive: {
|
|
14
15
|
type: [String, Boolean],
|
|
@@ -79,12 +80,27 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
79
80
|
}
|
|
80
81
|
return undefined;
|
|
81
82
|
});
|
|
83
|
+
// for SSR, fix bug https://github.com/TuSimple/naive-ui/issues/2462
|
|
84
|
+
const isSsrRef = (0, vue_1.ref)(false);
|
|
85
|
+
const contentElRef = (0, vue_1.ref)();
|
|
86
|
+
(0, vue_1.onMounted)(() => {
|
|
87
|
+
const { value: contentEl } = contentElRef;
|
|
88
|
+
if (contentEl) {
|
|
89
|
+
if (contentEl.hasAttribute(SSR_ATTR_NAME)) {
|
|
90
|
+
contentEl.removeAttribute(SSR_ATTR_NAME);
|
|
91
|
+
isSsrRef.value = true;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
});
|
|
82
95
|
(0, vue_1.provide)(config_2.gridInjectionKey, {
|
|
96
|
+
isSsrRef,
|
|
83
97
|
itemStyleRef: (0, vue_1.toRef)(props, 'itemStyle'),
|
|
84
98
|
xGapRef: responsiveXGapRef,
|
|
85
99
|
overflowRef
|
|
86
100
|
});
|
|
87
101
|
return {
|
|
102
|
+
isSsr: !_utils_1.isBrowser,
|
|
103
|
+
contentEl: contentElRef,
|
|
88
104
|
mergedClsPrefix: mergedClsPrefixRef,
|
|
89
105
|
style: (0, vue_1.computed)(() => {
|
|
90
106
|
return {
|
|
@@ -104,7 +120,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
104
120
|
},
|
|
105
121
|
render() {
|
|
106
122
|
const renderContent = () => {
|
|
107
|
-
var _a, _b, _c, _d, _e, _f;
|
|
123
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
108
124
|
this.overflow = false;
|
|
109
125
|
// render will be called twice when mounted, I can't figure out why
|
|
110
126
|
// 2 jobs will be pushed into job queues with same id, and then be flushed
|
|
@@ -112,11 +128,28 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
112
128
|
const childrenAndRawSpan = [];
|
|
113
129
|
const { collapsed, collapsedRows, responsiveCols, responsiveQuery } = this;
|
|
114
130
|
rawChildren.forEach((child) => {
|
|
115
|
-
var _a, _b, _c;
|
|
131
|
+
var _a, _b, _c, _d;
|
|
116
132
|
if (((_a = child === null || child === void 0 ? void 0 : child.type) === null || _a === void 0 ? void 0 : _a.__GRID_ITEM__) !== true)
|
|
117
133
|
return;
|
|
134
|
+
if ((0, _utils_1.isNodeVShowFalse)(child)) {
|
|
135
|
+
const clonedNode = (0, vue_1.cloneVNode)(child);
|
|
136
|
+
if (clonedNode.props) {
|
|
137
|
+
clonedNode.props.privateShow = false;
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
clonedNode.props = { pirvateShow: false };
|
|
141
|
+
}
|
|
142
|
+
childrenAndRawSpan.push({
|
|
143
|
+
child: clonedNode,
|
|
144
|
+
rawChildSpan: 0
|
|
145
|
+
});
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
// We don't want v-show to control display, so we need to stripe it
|
|
149
|
+
// here, nor it may mess child's style
|
|
150
|
+
child.dirs = ((_b = child.dirs) === null || _b === void 0 ? void 0 : _b.filter(({ dir }) => dir !== vue_1.vShow)) || null;
|
|
118
151
|
const clonedChild = (0, vue_1.cloneVNode)(child);
|
|
119
|
-
const rawChildSpan = Number((
|
|
152
|
+
const rawChildSpan = Number((_d = (0, seemly_1.parseResponsivePropValue)((_c = clonedChild.props) === null || _c === void 0 ? void 0 : _c.span, responsiveQuery)) !== null && _d !== void 0 ? _d : config_2.defaultSpan);
|
|
120
153
|
if (rawChildSpan === 0)
|
|
121
154
|
return;
|
|
122
155
|
childrenAndRawSpan.push({
|
|
@@ -133,7 +166,8 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
133
166
|
maybeSuffixNode.props.privateSpan = suffixSpan;
|
|
134
167
|
maybeSuffixNode.props.privateColStart =
|
|
135
168
|
responsiveCols + 1 - suffixSpan;
|
|
136
|
-
maybeSuffixNode.props.privateShow =
|
|
169
|
+
maybeSuffixNode.props.privateShow =
|
|
170
|
+
(_e = maybeSuffixNode.props.privateShow) !== null && _e !== void 0 ? _e : true;
|
|
137
171
|
}
|
|
138
172
|
}
|
|
139
173
|
let spanCounter = 0;
|
|
@@ -143,8 +177,9 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
143
177
|
this.overflow = true;
|
|
144
178
|
}
|
|
145
179
|
if (!done) {
|
|
146
|
-
const childOffset = Number((
|
|
147
|
-
|
|
180
|
+
const childOffset = Number((_g = (0, seemly_1.parseResponsivePropValue)((_f = child.props) === null || _f === void 0 ? void 0 : _f.offset, responsiveQuery)) !== null && _g !== void 0 ? _g : 0);
|
|
181
|
+
// it could be 0 sometimes (v-show = false)
|
|
182
|
+
const childSpan = Math.min(rawChildSpan + childOffset, responsiveCols);
|
|
148
183
|
if (!child.props) {
|
|
149
184
|
child.props = {
|
|
150
185
|
privateSpan: childSpan,
|
|
@@ -171,6 +206,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
171
206
|
}
|
|
172
207
|
if (done) {
|
|
173
208
|
if (child.props) {
|
|
209
|
+
// suffix node's privateShow may be true
|
|
174
210
|
if (child.props.privateShow !== true) {
|
|
175
211
|
child.props.privateShow = false;
|
|
176
212
|
}
|
|
@@ -183,8 +219,10 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
183
219
|
}
|
|
184
220
|
}
|
|
185
221
|
return (0, vue_1.h)('div', (0, vue_1.mergeProps)({
|
|
222
|
+
ref: 'contentEl',
|
|
186
223
|
class: `${this.mergedClsPrefix}-grid`,
|
|
187
|
-
style: this.style
|
|
224
|
+
style: this.style,
|
|
225
|
+
[SSR_ATTR_NAME]: this.isSsr || undefined
|
|
188
226
|
}, this.$attrs), childrenAndRawSpan.map(({ child }) => child));
|
|
189
227
|
};
|
|
190
228
|
return this.isResponsive && this.responsive === 'self' ? ((0, vue_1.h)(vueuc_1.VResizeObserver, { onResize: this.handleResize }, {
|
package/lib/grid/src/GridItem.js
CHANGED
|
@@ -32,7 +32,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
32
32
|
alias: ['Gi'],
|
|
33
33
|
props: exports.gridItemProps,
|
|
34
34
|
setup() {
|
|
35
|
-
const { xGapRef, itemStyleRef, overflowRef
|
|
35
|
+
const { isSsrRef, xGapRef, itemStyleRef, overflowRef
|
|
36
36
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
37
37
|
} = (0, vue_1.inject)(config_1.gridInjectionKey);
|
|
38
38
|
const self = (0, vue_1.getCurrentInstance)();
|
|
@@ -40,6 +40,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
40
40
|
overflow: overflowRef,
|
|
41
41
|
itemStyle: itemStyleRef,
|
|
42
42
|
deriveStyle: () => {
|
|
43
|
+
void isSsrRef.value;
|
|
43
44
|
// Here is quite a hack, I hope there is a better way to solve it
|
|
44
45
|
const { privateSpan = exports.defaultSpan, privateShow = true, privateColStart = undefined, privateOffset = 0
|
|
45
46
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
package/lib/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;
|