@v-c/table 1.2.1 → 1.3.0
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/Cell/index.js +2 -3
- package/dist/Table.js +7 -7
- package/dist/interface.d.ts +1 -1
- package/dist/utils/valueUtil.d.ts +0 -1
- package/dist/utils/valueUtil.js +1 -5
- package/package.json +2 -2
package/dist/Cell/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { useInjectTableContext } from "../context/TableContext.js";
|
|
2
2
|
import { useInjectPerfContext } from "../context/PerfContext.js";
|
|
3
|
-
import { validateValue } from "../utils/valueUtil.js";
|
|
4
3
|
import useHoverState from "./useHoverState.js";
|
|
5
4
|
import { computed, createVNode, defineComponent, isVNode, mergeProps, shallowRef, toRaw, watch } from "vue";
|
|
6
|
-
import { clsx, warning } from "@v-c/util";
|
|
5
|
+
import { clsx, isNonNullable, warning } from "@v-c/util";
|
|
7
6
|
import { filterEmpty, getStylePxValue } from "@v-c/util/dist/props-util";
|
|
8
7
|
import getValue from "@v-c/util/dist/utils/get";
|
|
9
8
|
//#region src/Cell/index.tsx
|
|
@@ -24,7 +23,7 @@ function isRenderCell(data) {
|
|
|
24
23
|
return data && typeof data === "object" && !Array.isArray(data) && !isVNode(data);
|
|
25
24
|
}
|
|
26
25
|
function resolveCellRender({ record, dataIndex, renderIndex, children, render, perfRecord }) {
|
|
27
|
-
if (
|
|
26
|
+
if (isNonNullable(children)) return [children];
|
|
28
27
|
const value = getValue(record, dataIndex === null || dataIndex === void 0 || dataIndex === "" ? [] : Array.isArray(dataIndex) ? dataIndex : [dataIndex]);
|
|
29
28
|
let returnChildNode = value;
|
|
30
29
|
let returnCellProps;
|
package/dist/Table.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useProvideTableContext } from "./context/TableContext.js";
|
|
2
2
|
import ColGroup from "./ColGroup.js";
|
|
3
|
-
import { getColumnsKey, validNumberValue
|
|
3
|
+
import { getColumnsKey, validNumberValue } from "./utils/valueUtil.js";
|
|
4
4
|
import Body from "./Body/index.js";
|
|
5
5
|
import { EXPAND_COLUMN, INTERNAL_HOOKS } from "./constant.js";
|
|
6
6
|
import FixedHolder from "./FixedHolder/index.js";
|
|
@@ -19,7 +19,7 @@ import Column from "./sugar/Column.js";
|
|
|
19
19
|
import ColumnGroup from "./sugar/ColumnGroup.js";
|
|
20
20
|
import { Fragment, computed, createVNode, defineComponent, isVNode, mergeDefaults, mergeProps, nextTick, onMounted, reactive, ref, shallowRef, watch, watchEffect } from "vue";
|
|
21
21
|
import ResizeObserver from "@v-c/resize-observer";
|
|
22
|
-
import { clsx, get, warning } from "@v-c/util";
|
|
22
|
+
import { clsx, get, isNonNullable, isVueRenderable, warning } from "@v-c/util";
|
|
23
23
|
import canUseDom from "@v-c/util/dist/Dom/canUseDom";
|
|
24
24
|
import { getDOM } from "@v-c/util/dist/Dom/findDOMNode";
|
|
25
25
|
import { getTargetScrollBarSize } from "@v-c/util/dist/getScrollBarSize";
|
|
@@ -150,8 +150,8 @@ var ImmutableTable = /* @__PURE__ */ defineComponent((props, { attrs, slots, exp
|
|
|
150
150
|
...stickyOffsets.value,
|
|
151
151
|
isSticky: stickyConfig.value.isSticky
|
|
152
152
|
}));
|
|
153
|
-
const fixHeader = computed(() => !!(props.scroll &&
|
|
154
|
-
const horizonScroll = computed(() => !!(props.scroll &&
|
|
153
|
+
const fixHeader = computed(() => !!(props.scroll && isNonNullable(props.scroll.y)));
|
|
154
|
+
const horizonScroll = computed(() => !!(props.scroll && isNonNullable(mergedScrollX.value)) || !!expandableConfig.value.fixed);
|
|
155
155
|
const fixColumn = computed(() => horizonScroll.value && flattenColumns.value.some(({ fixed }) => fixed));
|
|
156
156
|
const summaryNode = computed(() => props.summary?.(mergedData.value));
|
|
157
157
|
const fixFooter = computed(() => {
|
|
@@ -382,7 +382,7 @@ var ImmutableTable = /* @__PURE__ */ defineComponent((props, { attrs, slots, exp
|
|
|
382
382
|
"colWidths": flattenColumns.value.map(({ width }) => width),
|
|
383
383
|
"columns": flattenColumns.value
|
|
384
384
|
}, null);
|
|
385
|
-
const captionElement = props.caption
|
|
385
|
+
const captionElement = isNonNullable(props.caption) ? createVNode("caption", { "class": `${mergedPrefixCls.value}-caption` }, [props.caption]) : void 0;
|
|
386
386
|
let groupTableNode;
|
|
387
387
|
if (fixHeader.value || stickyConfig.value.isSticky) {
|
|
388
388
|
let bodyContent;
|
|
@@ -408,7 +408,7 @@ var ImmutableTable = /* @__PURE__ */ defineComponent((props, { attrs, slots, exp
|
|
|
408
408
|
captionElement,
|
|
409
409
|
bodyColGroupNode,
|
|
410
410
|
bodyTableNode,
|
|
411
|
-
!fixFooter.value && summaryNode.value && createVNode(Footer, {
|
|
411
|
+
!fixFooter.value && isVueRenderable(summaryNode.value) && createVNode(Footer, {
|
|
412
412
|
"stickyOffsets": mergedStickyOffsets.value,
|
|
413
413
|
"flattenColumns": flattenColumns.value
|
|
414
414
|
}, { default: () => [summaryNode.value] })
|
|
@@ -471,7 +471,7 @@ var ImmutableTable = /* @__PURE__ */ defineComponent((props, { attrs, slots, exp
|
|
|
471
471
|
"flattenColumns": flattenColumns.value
|
|
472
472
|
}), null),
|
|
473
473
|
bodyTableNode,
|
|
474
|
-
!fixFooter.value && summaryNode.value && createVNode(Footer, {
|
|
474
|
+
!fixFooter.value && isVueRenderable(summaryNode.value) && createVNode(Footer, {
|
|
475
475
|
"stickyOffsets": mergedStickyOffsets.value,
|
|
476
476
|
"flattenColumns": flattenColumns.value
|
|
477
477
|
}, { default: () => [summaryNode.value] })
|
package/dist/interface.d.ts
CHANGED
|
@@ -143,7 +143,7 @@ export interface LegacyExpandableProps<RecordType> {
|
|
|
143
143
|
expandedRowRender?: ExpandedRowRender<RecordType>;
|
|
144
144
|
/** @deprecated Use `expandable.expandRowByClick` instead */
|
|
145
145
|
expandRowByClick?: boolean;
|
|
146
|
-
/** @deprecated Use `
|
|
146
|
+
/** @deprecated Use `components.ExpandIcon` instead */
|
|
147
147
|
expandIcon?: RenderExpandIcon<RecordType>;
|
|
148
148
|
/** @deprecated Use `expandable.onExpand` instead */
|
|
149
149
|
onExpand?: (expanded: boolean, record: RecordType) => void;
|
|
@@ -4,5 +4,4 @@ export interface GetColumnKeyColumn<T = any> {
|
|
|
4
4
|
dataIndex?: DataIndex<T>;
|
|
5
5
|
}
|
|
6
6
|
export declare function getColumnsKey<T = any>(columns: readonly GetColumnKeyColumn<T>[]): Key[];
|
|
7
|
-
export declare function validateValue<T>(val: T): boolean;
|
|
8
7
|
export declare function validNumberValue(value: any): boolean;
|
package/dist/utils/valueUtil.js
CHANGED
|
@@ -16,12 +16,8 @@ function getColumnsKey(columns) {
|
|
|
16
16
|
});
|
|
17
17
|
return columnKeys;
|
|
18
18
|
}
|
|
19
|
-
function validateValue(val) {
|
|
20
|
-
if (Array.isArray(val) && val.length === 0) return false;
|
|
21
|
-
return val !== null && val !== void 0;
|
|
22
|
-
}
|
|
23
19
|
function validNumberValue(value) {
|
|
24
20
|
return typeof value === "number" && !Number.isNaN(value);
|
|
25
21
|
}
|
|
26
22
|
//#endregion
|
|
27
|
-
export { getColumnsKey, validNumberValue
|
|
23
|
+
export { getColumnsKey, validNumberValue };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@v-c/table",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.3.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/antdv-next/vue-components/tree/next/packages/table",
|
|
7
7
|
"repository": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@v-c/resize-observer": "^1.1.3",
|
|
30
|
-
"@v-c/util": "^1.
|
|
30
|
+
"@v-c/util": "^1.2.0",
|
|
31
31
|
"@v-c/virtual-list": "^1.1.1"
|
|
32
32
|
},
|
|
33
33
|
"publishConfig": {
|