naive-ui 2.30.4 → 2.30.5
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 +293 -75
- package/dist/index.prod.js +2 -2
- package/es/_internal/scrollbar/src/Scrollbar.js +1 -2
- package/es/_internal/selection/src/Selection.js +5 -3
- 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/index.d.ts +2 -1
- package/es/_utils/index.js +2 -1
- package/es/_utils/vue/index.d.ts +2 -0
- package/es/_utils/vue/index.js +2 -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/{_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/data-table/src/DataTable.d.ts +5 -2
- package/es/data-table/src/DataTable.js +3 -2
- package/es/data-table/src/TableParts/Body.d.ts +1 -0
- package/es/data-table/src/TableParts/Body.js +4 -3
- package/es/data-table/src/TableParts/Cell.d.ts +3 -1
- package/es/data-table/src/TableParts/Cell.js +7 -3
- package/es/data-table/src/interface.d.ts +2 -1
- package/es/data-table/src/use-check.js +11 -3
- package/es/grid/src/Grid.js +28 -8
- package/es/image/src/Image.d.ts +10 -0
- package/es/image/src/Image.js +40 -8
- package/es/image/src/utils.d.ts +11 -0
- package/es/image/src/utils.js +81 -0
- package/es/input/src/styles/input-group-label.cssr.js +2 -0
- package/es/space/src/Space.d.ts +26 -0
- package/es/space/src/Space.js +53 -43
- package/es/tooltip/index.d.ts +1 -1
- package/es/version.d.ts +1 -1
- package/es/version.js +1 -1
- package/lib/_internal/scrollbar/src/Scrollbar.js +2 -3
- package/lib/_internal/selection/src/Selection.js +4 -2
- 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/index.d.ts +2 -1
- package/lib/_utils/index.js +4 -1
- package/lib/_utils/vue/index.d.ts +2 -0
- package/lib/_utils/vue/index.js +5 -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/{_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/data-table/src/DataTable.d.ts +5 -2
- package/lib/data-table/src/DataTable.js +3 -2
- package/lib/data-table/src/TableParts/Body.d.ts +1 -0
- package/lib/data-table/src/TableParts/Body.js +4 -3
- package/lib/data-table/src/TableParts/Cell.d.ts +3 -1
- package/lib/data-table/src/TableParts/Cell.js +7 -3
- package/lib/data-table/src/interface.d.ts +2 -1
- package/lib/data-table/src/use-check.js +11 -3
- package/lib/grid/src/Grid.js +26 -6
- package/lib/image/src/Image.d.ts +10 -0
- package/lib/image/src/Image.js +39 -7
- package/lib/image/src/utils.d.ts +11 -0
- package/lib/image/src/utils.js +86 -0
- package/lib/input/src/styles/input-group-label.cssr.js +2 -0
- package/lib/space/src/Space.d.ts +26 -0
- package/lib/space/src/Space.js +53 -43
- package/lib/tooltip/index.d.ts +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/volar.d.ts +0 -1
- package/web-types.json +37 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PropType } from 'vue';
|
|
1
|
+
import { PropType, VNodeChild } from 'vue';
|
|
2
2
|
import { TableBaseColumn, InternalRowData } from '../interface';
|
|
3
3
|
declare const _default: import("vue").DefineComponent<{
|
|
4
4
|
row: {
|
|
@@ -1149,6 +1149,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1149
1149
|
}>;
|
|
1150
1150
|
required: true;
|
|
1151
1151
|
};
|
|
1152
|
+
renderCell: PropType<(value: any, rowData: object, column: any) => VNodeChild>;
|
|
1152
1153
|
}, unknown, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
1153
1154
|
row: {
|
|
1154
1155
|
type: PropType<InternalRowData>;
|
|
@@ -2298,6 +2299,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
2298
2299
|
}>;
|
|
2299
2300
|
required: true;
|
|
2300
2301
|
};
|
|
2302
|
+
renderCell: PropType<(value: any, rowData: object, column: any) => VNodeChild>;
|
|
2301
2303
|
}>>, {
|
|
2302
2304
|
isSummary: boolean;
|
|
2303
2305
|
}>;
|
|
@@ -22,11 +22,13 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
22
22
|
mergedTheme: {
|
|
23
23
|
type: Object,
|
|
24
24
|
required: true
|
|
25
|
-
}
|
|
25
|
+
},
|
|
26
|
+
renderCell: Function
|
|
26
27
|
},
|
|
27
28
|
render() {
|
|
28
|
-
const { isSummary, column
|
|
29
|
+
const { isSummary, column, row, renderCell } = this;
|
|
29
30
|
let cell;
|
|
31
|
+
const { render, key, ellipsis } = column;
|
|
30
32
|
if (render && !isSummary) {
|
|
31
33
|
cell = render(row, this.index);
|
|
32
34
|
}
|
|
@@ -35,7 +37,9 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
35
37
|
cell = row[key].value;
|
|
36
38
|
}
|
|
37
39
|
else {
|
|
38
|
-
cell =
|
|
40
|
+
cell = renderCell
|
|
41
|
+
? renderCell((0, lodash_1.get)(row, key), row, column)
|
|
42
|
+
: (0, lodash_1.get)(row, key);
|
|
39
43
|
}
|
|
40
44
|
}
|
|
41
45
|
if (ellipsis && typeof ellipsis === 'object') {
|
|
@@ -173,6 +173,7 @@ export interface DataTableInjection {
|
|
|
173
173
|
handleTableBodyScroll: (e: Event) => void;
|
|
174
174
|
syncScrollState: (deltaX?: number, deltaY?: number) => void;
|
|
175
175
|
setHeaderScrollLeft: (scrollLeft: number) => void;
|
|
176
|
+
renderCell: Ref<undefined | ((value: any, rowData: object, column: TableBaseColumn) => VNodeChild)>;
|
|
176
177
|
}
|
|
177
178
|
export declare const dataTableInjectionKey: import("vue").InjectionKey<DataTableInjection>;
|
|
178
179
|
export interface MainTableInjection {
|
|
@@ -192,7 +193,7 @@ export declare type RenderFilterMenu = (actions: {
|
|
|
192
193
|
hide: () => void;
|
|
193
194
|
}) => VNodeChild;
|
|
194
195
|
export declare type OnUpdateExpandedRowKeys = (keys: RowKey[]) => void;
|
|
195
|
-
export declare type OnUpdateCheckedRowKeys = (keys: RowKey[]) => void;
|
|
196
|
+
export declare type OnUpdateCheckedRowKeys = (keys: RowKey[], row: InternalRowData[]) => void;
|
|
196
197
|
export declare type OnUpdateSorter = (sortState: SortState & SortState[] & null) => void;
|
|
197
198
|
export declare type OnUpdateSorterImpl = (sortState: SortState | SortState[] | null) => void;
|
|
198
199
|
export declare type OnUpdateFilters = (filterState: FilterState, sourceColumn: TableBaseColumn) => void;
|
|
@@ -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) {
|
package/lib/grid/src/Grid.js
CHANGED
|
@@ -104,7 +104,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
104
104
|
},
|
|
105
105
|
render() {
|
|
106
106
|
const renderContent = () => {
|
|
107
|
-
var _a, _b, _c, _d, _e, _f;
|
|
107
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
108
108
|
this.overflow = false;
|
|
109
109
|
// render will be called twice when mounted, I can't figure out why
|
|
110
110
|
// 2 jobs will be pushed into job queues with same id, and then be flushed
|
|
@@ -112,11 +112,28 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
112
112
|
const childrenAndRawSpan = [];
|
|
113
113
|
const { collapsed, collapsedRows, responsiveCols, responsiveQuery } = this;
|
|
114
114
|
rawChildren.forEach((child) => {
|
|
115
|
-
var _a, _b, _c;
|
|
115
|
+
var _a, _b, _c, _d;
|
|
116
116
|
if (((_a = child === null || child === void 0 ? void 0 : child.type) === null || _a === void 0 ? void 0 : _a.__GRID_ITEM__) !== true)
|
|
117
117
|
return;
|
|
118
|
+
if ((0, _utils_1.isNodeVShowFalse)(child)) {
|
|
119
|
+
const clonedNode = (0, vue_1.cloneVNode)(child);
|
|
120
|
+
if (clonedNode.props) {
|
|
121
|
+
clonedNode.props.privateShow = false;
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
clonedNode.props = { pirvateShow: false };
|
|
125
|
+
}
|
|
126
|
+
childrenAndRawSpan.push({
|
|
127
|
+
child: clonedNode,
|
|
128
|
+
rawChildSpan: 0
|
|
129
|
+
});
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
// We don't want v-show to control display, so we need to stripe it
|
|
133
|
+
// here, nor it may mess child's style
|
|
134
|
+
child.dirs = ((_b = child.dirs) === null || _b === void 0 ? void 0 : _b.filter(({ dir }) => dir !== vue_1.vShow)) || null;
|
|
118
135
|
const clonedChild = (0, vue_1.cloneVNode)(child);
|
|
119
|
-
const rawChildSpan = Number((
|
|
136
|
+
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
137
|
if (rawChildSpan === 0)
|
|
121
138
|
return;
|
|
122
139
|
childrenAndRawSpan.push({
|
|
@@ -133,7 +150,8 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
133
150
|
maybeSuffixNode.props.privateSpan = suffixSpan;
|
|
134
151
|
maybeSuffixNode.props.privateColStart =
|
|
135
152
|
responsiveCols + 1 - suffixSpan;
|
|
136
|
-
maybeSuffixNode.props.privateShow =
|
|
153
|
+
maybeSuffixNode.props.privateShow =
|
|
154
|
+
(_e = maybeSuffixNode.props.privateShow) !== null && _e !== void 0 ? _e : true;
|
|
137
155
|
}
|
|
138
156
|
}
|
|
139
157
|
let spanCounter = 0;
|
|
@@ -143,8 +161,9 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
143
161
|
this.overflow = true;
|
|
144
162
|
}
|
|
145
163
|
if (!done) {
|
|
146
|
-
const childOffset = Number((
|
|
147
|
-
|
|
164
|
+
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);
|
|
165
|
+
// it could be 0 sometimes (v-show = false)
|
|
166
|
+
const childSpan = Math.min(rawChildSpan + childOffset, responsiveCols);
|
|
148
167
|
if (!child.props) {
|
|
149
168
|
child.props = {
|
|
150
169
|
privateSpan: childSpan,
|
|
@@ -171,6 +190,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
171
190
|
}
|
|
172
191
|
if (done) {
|
|
173
192
|
if (child.props) {
|
|
193
|
+
// suffix node's privateShow may be true
|
|
174
194
|
if (child.props.privateShow !== true) {
|
|
175
195
|
child.props.privateShow = false;
|
|
176
196
|
}
|
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;
|
package/lib/image/src/Image.js
CHANGED
|
@@ -8,7 +8,8 @@ const ImagePreview_1 = __importDefault(require("./ImagePreview"));
|
|
|
8
8
|
const ImageGroup_1 = require("./ImageGroup");
|
|
9
9
|
const _mixins_1 = require("../../_mixins");
|
|
10
10
|
const interface_1 = require("./interface");
|
|
11
|
-
const
|
|
11
|
+
const utils_1 = require("./utils");
|
|
12
|
+
const imageProps = Object.assign({ alt: String, height: [String, Number], imgProps: Object, lazy: Boolean, intersectionObserverOptions: Object, objectFit: {
|
|
12
13
|
type: String,
|
|
13
14
|
default: 'fill'
|
|
14
15
|
}, previewSrc: String, fallbackSrc: String, width: [String, Number], src: String, previewDisabled: Boolean, loadDescription: String, onError: Function, onLoad: Function }, interface_1.imagePreviewSharedProps);
|
|
@@ -42,18 +43,34 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
42
43
|
previewInst.toggleShow();
|
|
43
44
|
}
|
|
44
45
|
};
|
|
46
|
+
const shouldStartLoadingRef = (0, vue_1.ref)(!props.lazy);
|
|
45
47
|
(0, vue_1.onMounted)(() => {
|
|
46
48
|
var _a;
|
|
47
49
|
(_a = imageRef.value) === null || _a === void 0 ? void 0 : _a.setAttribute('data-group-id', (imageGroupHandle === null || imageGroupHandle === void 0 ? void 0 : imageGroupHandle.groupId) || '');
|
|
48
50
|
});
|
|
51
|
+
(0, vue_1.onMounted)(() => {
|
|
52
|
+
let unobserve;
|
|
53
|
+
const stopWatchHandle = (0, vue_1.watchEffect)(() => {
|
|
54
|
+
unobserve === null || unobserve === void 0 ? void 0 : unobserve();
|
|
55
|
+
unobserve = undefined;
|
|
56
|
+
if (props.lazy) {
|
|
57
|
+
unobserve = (0, utils_1.observeIntersection)(imageRef.value, props.intersectionObserverOptions, shouldStartLoadingRef);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
(0, vue_1.onBeforeUnmount)(() => {
|
|
61
|
+
stopWatchHandle();
|
|
62
|
+
unobserve === null || unobserve === void 0 ? void 0 : unobserve();
|
|
63
|
+
});
|
|
64
|
+
});
|
|
49
65
|
(0, vue_1.watchEffect)(() => {
|
|
50
66
|
var _a;
|
|
51
67
|
void props.src;
|
|
52
68
|
void ((_a = props.imgProps) === null || _a === void 0 ? void 0 : _a.src);
|
|
53
69
|
showErrorRef.value = false;
|
|
54
70
|
});
|
|
71
|
+
const loadedRef = (0, vue_1.ref)(false);
|
|
55
72
|
return Object.assign({ mergedClsPrefix: mergedClsPrefixRef, groupId: imageGroupHandle === null || imageGroupHandle === void 0 ? void 0 : imageGroupHandle.groupId, previewInstRef,
|
|
56
|
-
imageRef, imgProps: imgPropsRef, showError: showErrorRef, mergedOnError: (e) => {
|
|
73
|
+
imageRef, imgProps: imgPropsRef, showError: showErrorRef, shouldStartLoading: shouldStartLoadingRef, loaded: loadedRef, mergedOnError: (e) => {
|
|
57
74
|
showErrorRef.value = true;
|
|
58
75
|
const { onError, imgProps: { onError: imgPropsOnError } = {} } = props;
|
|
59
76
|
onError === null || onError === void 0 ? void 0 : onError(e);
|
|
@@ -62,18 +79,33 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
62
79
|
const { onLoad, imgProps: { onLoad: imgPropsOnLoad } = {} } = props;
|
|
63
80
|
onLoad === null || onLoad === void 0 ? void 0 : onLoad(e);
|
|
64
81
|
imgPropsOnLoad === null || imgPropsOnLoad === void 0 ? void 0 : imgPropsOnLoad(e);
|
|
82
|
+
loadedRef.value = true;
|
|
65
83
|
} }, exposedMethods);
|
|
66
84
|
},
|
|
67
85
|
render() {
|
|
68
|
-
|
|
69
|
-
const
|
|
86
|
+
var _a, _b;
|
|
87
|
+
const { mergedClsPrefix, imgProps = {}, loaded, $attrs } = this;
|
|
88
|
+
const placeholderNode = (_b = (_a = this.$slots).placeholder) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
89
|
+
const imgNode = ((0, vue_1.h)("img", Object.assign({}, imgProps, { class: imgProps.class, ref: "imageRef", width: this.width || imgProps.width, height: this.height || imgProps.height, src: this.showError
|
|
90
|
+
? this.fallbackSrc
|
|
91
|
+
: this.shouldStartLoading
|
|
92
|
+
? this.src || imgProps.src
|
|
93
|
+
: undefined, alt: this.alt || imgProps.alt, "aria-label": this.alt || imgProps.alt, onClick: this.click, onError: this.mergedOnError, onLoad: this.mergedOnLoad, style: [
|
|
94
|
+
imgProps.style || '',
|
|
95
|
+
placeholderNode && !loaded
|
|
96
|
+
? { height: '0', width: '0', visibility: 'hidden' }
|
|
97
|
+
: '',
|
|
98
|
+
{ objectFit: this.objectFit }
|
|
99
|
+
], "data-error": this.showError, "data-preview-src": this.previewSrc || this.src })));
|
|
70
100
|
return ((0, vue_1.h)("div", Object.assign({}, $attrs, { role: "none", class: [
|
|
71
101
|
$attrs.class,
|
|
72
102
|
`${mergedClsPrefix}-image`,
|
|
73
103
|
(this.previewDisabled || this.showError) &&
|
|
74
104
|
`${mergedClsPrefix}-image--preview-disabled`
|
|
75
|
-
] }),
|
|
76
|
-
|
|
77
|
-
|
|
105
|
+
] }),
|
|
106
|
+
this.groupId ? (imgNode) : ((0, vue_1.h)(ImagePreview_1.default, { theme: this.theme, themeOverrides: this.themeOverrides, clsPrefix: mergedClsPrefix, ref: "previewInstRef", showToolbar: this.showToolbar, showToolbarTooltip: this.showToolbarTooltip }, {
|
|
107
|
+
default: () => imgNode
|
|
108
|
+
})),
|
|
109
|
+
!loaded && placeholderNode));
|
|
78
110
|
}
|
|
79
111
|
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
export declare type IntersectionObserverOptions = Omit<IntersectionObserverInit, 'root'> & {
|
|
3
|
+
root?: Element | Document | null | string;
|
|
4
|
+
};
|
|
5
|
+
export declare const resolveOptionsAndHash: (options?: IntersectionObserverOptions | undefined) => {
|
|
6
|
+
hash: string;
|
|
7
|
+
options: Omit<IntersectionObserverInit, "root"> & {
|
|
8
|
+
root: Element | Document;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export declare const observeIntersection: (el: HTMLImageElement | null, options: IntersectionObserverOptions | undefined, shouldStartLoadingRef: Ref<boolean>) => () => void;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.observeIntersection = exports.resolveOptionsAndHash = void 0;
|
|
4
|
+
const resolveOptionsAndHash = (options = {}) => {
|
|
5
|
+
var _a;
|
|
6
|
+
const { root = null } = options;
|
|
7
|
+
return {
|
|
8
|
+
hash: `${options.rootMargin || '0px 0px 0px 0px'}-${Array.isArray(options.threshold)
|
|
9
|
+
? options.threshold.join(',')
|
|
10
|
+
: (_a = options.threshold) !== null && _a !== void 0 ? _a : '0'}`,
|
|
11
|
+
options: Object.assign(Object.assign({}, options), { root: (typeof root === 'string' ? document.querySelector(root) : root) ||
|
|
12
|
+
document.documentElement })
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
exports.resolveOptionsAndHash = resolveOptionsAndHash;
|
|
16
|
+
// root -> options -> [observer, elements]
|
|
17
|
+
const observers = new WeakMap();
|
|
18
|
+
const unobserveHandleMap = new WeakMap();
|
|
19
|
+
const shouldStartLoadingRefMap = new WeakMap();
|
|
20
|
+
const observeIntersection = (el, options, shouldStartLoadingRef) => {
|
|
21
|
+
if (!el)
|
|
22
|
+
return () => { };
|
|
23
|
+
const resolvedOptionsAndHash = (0, exports.resolveOptionsAndHash)(options);
|
|
24
|
+
const { root } = resolvedOptionsAndHash.options;
|
|
25
|
+
let rootObservers;
|
|
26
|
+
const _rootObservers = observers.get(root);
|
|
27
|
+
if (_rootObservers) {
|
|
28
|
+
rootObservers = _rootObservers;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
rootObservers = new Map();
|
|
32
|
+
observers.set(root, rootObservers);
|
|
33
|
+
}
|
|
34
|
+
let observer;
|
|
35
|
+
let observerAndObservedElements;
|
|
36
|
+
if (rootObservers.has(resolvedOptionsAndHash.hash)) {
|
|
37
|
+
observerAndObservedElements =
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
39
|
+
rootObservers.get(resolvedOptionsAndHash.hash);
|
|
40
|
+
if (!observerAndObservedElements[1].has(el)) {
|
|
41
|
+
observer = observerAndObservedElements[0];
|
|
42
|
+
observerAndObservedElements[1].add(el);
|
|
43
|
+
observer.observe(el);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
observer = new IntersectionObserver((entries) => {
|
|
48
|
+
entries.forEach((entry) => {
|
|
49
|
+
if (entry.isIntersecting) {
|
|
50
|
+
const _unobserve = unobserveHandleMap.get(entry.target);
|
|
51
|
+
const _shouldStartLoadingRef = shouldStartLoadingRefMap.get(entry.target);
|
|
52
|
+
if (_unobserve)
|
|
53
|
+
_unobserve();
|
|
54
|
+
if (_shouldStartLoadingRef) {
|
|
55
|
+
_shouldStartLoadingRef.value = true;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}, resolvedOptionsAndHash.options);
|
|
60
|
+
observer.observe(el);
|
|
61
|
+
observerAndObservedElements = [observer, new Set([el])];
|
|
62
|
+
rootObservers.set(resolvedOptionsAndHash.hash, observerAndObservedElements);
|
|
63
|
+
}
|
|
64
|
+
let unobservered = false;
|
|
65
|
+
const unobserve = () => {
|
|
66
|
+
if (unobservered)
|
|
67
|
+
return;
|
|
68
|
+
unobserveHandleMap.delete(el);
|
|
69
|
+
shouldStartLoadingRefMap.delete(el);
|
|
70
|
+
unobservered = true;
|
|
71
|
+
if (observerAndObservedElements[1].has(el)) {
|
|
72
|
+
observerAndObservedElements[0].unobserve(el);
|
|
73
|
+
observerAndObservedElements[1].delete(el);
|
|
74
|
+
}
|
|
75
|
+
if (observerAndObservedElements[1].size <= 0) {
|
|
76
|
+
rootObservers.delete(resolvedOptionsAndHash.hash);
|
|
77
|
+
}
|
|
78
|
+
if (!rootObservers.size) {
|
|
79
|
+
observers.delete(root);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
unobserveHandleMap.set(el, unobserve);
|
|
83
|
+
shouldStartLoadingRefMap.set(el, shouldStartLoadingRef);
|
|
84
|
+
return unobserve;
|
|
85
|
+
};
|
|
86
|
+
exports.observeIntersection = observeIntersection;
|
|
@@ -26,6 +26,8 @@ exports.default = (0, cssr_1.cB)('input-group-label', `
|
|
|
26
26
|
font-size: var(--n-font-size);
|
|
27
27
|
line-height: var(--n-height);
|
|
28
28
|
height: var(--n-height);
|
|
29
|
+
flex-shrink: 0;
|
|
30
|
+
white-space: nowrap;
|
|
29
31
|
transition:
|
|
30
32
|
color .3s var(--n-bezier),
|
|
31
33
|
background-color .3s var(--n-bezier),
|
package/lib/space/src/Space.d.ts
CHANGED
|
@@ -14,11 +14,19 @@ declare const spaceProps: {
|
|
|
14
14
|
readonly type: PropType<number | [number, number] | "small" | "medium" | "large">;
|
|
15
15
|
readonly default: "medium";
|
|
16
16
|
};
|
|
17
|
+
readonly wrapItem: {
|
|
18
|
+
readonly type: BooleanConstructor;
|
|
19
|
+
readonly default: true;
|
|
20
|
+
};
|
|
17
21
|
readonly itemStyle: PropType<string | CSSProperties>;
|
|
18
22
|
readonly wrap: {
|
|
19
23
|
readonly type: BooleanConstructor;
|
|
20
24
|
readonly default: true;
|
|
21
25
|
};
|
|
26
|
+
readonly internalUseGap: {
|
|
27
|
+
readonly type: BooleanConstructor;
|
|
28
|
+
readonly default: undefined;
|
|
29
|
+
};
|
|
22
30
|
readonly theme: PropType<import("../../_mixins").Theme<"Space", {
|
|
23
31
|
gapSmall: string;
|
|
24
32
|
gapMedium: string;
|
|
@@ -48,11 +56,19 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
48
56
|
readonly type: PropType<number | [number, number] | "small" | "medium" | "large">;
|
|
49
57
|
readonly default: "medium";
|
|
50
58
|
};
|
|
59
|
+
readonly wrapItem: {
|
|
60
|
+
readonly type: BooleanConstructor;
|
|
61
|
+
readonly default: true;
|
|
62
|
+
};
|
|
51
63
|
readonly itemStyle: PropType<string | CSSProperties>;
|
|
52
64
|
readonly wrap: {
|
|
53
65
|
readonly type: BooleanConstructor;
|
|
54
66
|
readonly default: true;
|
|
55
67
|
};
|
|
68
|
+
readonly internalUseGap: {
|
|
69
|
+
readonly type: BooleanConstructor;
|
|
70
|
+
readonly default: undefined;
|
|
71
|
+
};
|
|
56
72
|
readonly theme: PropType<import("../../_mixins").Theme<"Space", {
|
|
57
73
|
gapSmall: string;
|
|
58
74
|
gapMedium: string;
|
|
@@ -88,11 +104,19 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
88
104
|
readonly type: PropType<number | [number, number] | "small" | "medium" | "large">;
|
|
89
105
|
readonly default: "medium";
|
|
90
106
|
};
|
|
107
|
+
readonly wrapItem: {
|
|
108
|
+
readonly type: BooleanConstructor;
|
|
109
|
+
readonly default: true;
|
|
110
|
+
};
|
|
91
111
|
readonly itemStyle: PropType<string | CSSProperties>;
|
|
92
112
|
readonly wrap: {
|
|
93
113
|
readonly type: BooleanConstructor;
|
|
94
114
|
readonly default: true;
|
|
95
115
|
};
|
|
116
|
+
readonly internalUseGap: {
|
|
117
|
+
readonly type: BooleanConstructor;
|
|
118
|
+
readonly default: undefined;
|
|
119
|
+
};
|
|
96
120
|
readonly theme: PropType<import("../../_mixins").Theme<"Space", {
|
|
97
121
|
gapSmall: string;
|
|
98
122
|
gapMedium: string;
|
|
@@ -114,5 +138,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
114
138
|
readonly wrap: boolean;
|
|
115
139
|
readonly vertical: boolean;
|
|
116
140
|
readonly justify: Justify;
|
|
141
|
+
readonly wrapItem: boolean;
|
|
142
|
+
readonly internalUseGap: boolean;
|
|
117
143
|
}>;
|
|
118
144
|
export default _default;
|
package/lib/space/src/Space.js
CHANGED
|
@@ -16,9 +16,17 @@ const spaceProps = Object.assign(Object.assign({}, _mixins_1.useTheme.props), {
|
|
|
16
16
|
}, inline: Boolean, vertical: Boolean, size: {
|
|
17
17
|
type: [String, Number, Array],
|
|
18
18
|
default: 'medium'
|
|
19
|
+
}, wrapItem: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: true
|
|
19
22
|
}, itemStyle: [String, Object], wrap: {
|
|
20
23
|
type: Boolean,
|
|
21
24
|
default: true
|
|
25
|
+
},
|
|
26
|
+
// internal
|
|
27
|
+
internalUseGap: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: undefined
|
|
22
30
|
} });
|
|
23
31
|
exports.default = (0, vue_1.defineComponent)({
|
|
24
32
|
name: 'Space',
|
|
@@ -55,7 +63,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
55
63
|
};
|
|
56
64
|
},
|
|
57
65
|
render() {
|
|
58
|
-
const { vertical, align, inline, justify, itemStyle, margin, wrap, mergedClsPrefix, rtlEnabled, useGap } = this;
|
|
66
|
+
const { vertical, align, inline, justify, itemStyle, margin, wrap, mergedClsPrefix, rtlEnabled, useGap, wrapItem, internalUseGap } = this;
|
|
59
67
|
const children = (0, _utils_1.flatten)((0, _utils_1.getSlot)(this));
|
|
60
68
|
if (!children.length)
|
|
61
69
|
return null;
|
|
@@ -79,50 +87,52 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
79
87
|
marginBottom: useGap || vertical ? '' : `-${semiVerticalMargin}`,
|
|
80
88
|
alignItems: align,
|
|
81
89
|
gap: useGap ? `${margin.vertical}px ${margin.horizontal}px` : ''
|
|
82
|
-
} },
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
?
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
: rtlEnabled
|
|
90
|
+
} }, !wrapItem && (useGap || internalUseGap)
|
|
91
|
+
? children
|
|
92
|
+
: children.map((child, index) => ((0, vue_1.h)("div", { role: "none", style: [
|
|
93
|
+
itemStyle,
|
|
94
|
+
{
|
|
95
|
+
maxWidth: '100%'
|
|
96
|
+
},
|
|
97
|
+
useGap
|
|
98
|
+
? ''
|
|
99
|
+
: vertical
|
|
94
100
|
? {
|
|
95
|
-
|
|
96
|
-
? justify === 'space-between' && index === lastIndex
|
|
97
|
-
? ''
|
|
98
|
-
: semiHorizontalMargin
|
|
99
|
-
: index !== lastIndex
|
|
100
|
-
? horizontalMargin
|
|
101
|
-
: '',
|
|
102
|
-
marginRight: isJustifySpace
|
|
103
|
-
? justify === 'space-between' && index === 0
|
|
104
|
-
? ''
|
|
105
|
-
: semiHorizontalMargin
|
|
106
|
-
: '',
|
|
107
|
-
paddingTop: semiVerticalMargin,
|
|
108
|
-
paddingBottom: semiVerticalMargin
|
|
101
|
+
marginBottom: index !== lastIndex ? verticalMargin : ''
|
|
109
102
|
}
|
|
110
|
-
:
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
? ''
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
103
|
+
: rtlEnabled
|
|
104
|
+
? {
|
|
105
|
+
marginLeft: isJustifySpace
|
|
106
|
+
? justify === 'space-between' && index === lastIndex
|
|
107
|
+
? ''
|
|
108
|
+
: semiHorizontalMargin
|
|
109
|
+
: index !== lastIndex
|
|
110
|
+
? horizontalMargin
|
|
111
|
+
: '',
|
|
112
|
+
marginRight: isJustifySpace
|
|
113
|
+
? justify === 'space-between' && index === 0
|
|
114
|
+
? ''
|
|
115
|
+
: semiHorizontalMargin
|
|
117
116
|
: '',
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
:
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
117
|
+
paddingTop: semiVerticalMargin,
|
|
118
|
+
paddingBottom: semiVerticalMargin
|
|
119
|
+
}
|
|
120
|
+
: {
|
|
121
|
+
marginRight: isJustifySpace
|
|
122
|
+
? justify === 'space-between' && index === lastIndex
|
|
123
|
+
? ''
|
|
124
|
+
: semiHorizontalMargin
|
|
125
|
+
: index !== lastIndex
|
|
126
|
+
? horizontalMargin
|
|
127
|
+
: '',
|
|
128
|
+
marginLeft: isJustifySpace
|
|
129
|
+
? justify === 'space-between' && index === 0
|
|
130
|
+
? ''
|
|
131
|
+
: semiHorizontalMargin
|
|
132
|
+
: '',
|
|
133
|
+
paddingTop: semiVerticalMargin,
|
|
134
|
+
paddingBottom: semiVerticalMargin
|
|
135
|
+
}
|
|
136
|
+
] }, child)))));
|
|
127
137
|
}
|
|
128
138
|
});
|
package/lib/tooltip/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default as NTooltip } from './src/Tooltip';
|
|
2
|
-
export type { TooltipProps } from './src/Tooltip';
|
|
2
|
+
export type { TooltipProps, TooltipInst } from './src/Tooltip';
|
package/lib/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "2.30.
|
|
1
|
+
declare const _default: "2.30.5";
|
|
2
2
|
export default _default;
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
package/volar.d.ts
CHANGED
|
@@ -139,7 +139,6 @@ declare module 'vue' {
|
|
|
139
139
|
NUploadFileList: typeof import('naive-ui')['NUploadFileList']
|
|
140
140
|
NUploadTrigger: typeof import('naive-ui')['NUploadTrigger']
|
|
141
141
|
NWatermark: typeof import('naive-ui')['NWatermark']
|
|
142
|
-
[key: string]: any
|
|
143
142
|
}
|
|
144
143
|
}
|
|
145
144
|
export {}
|