@canlooks/can-ui 0.0.80 → 0.0.81
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/cjs/components/dataGrid/dataGrid.d.ts +5 -3
- package/dist/cjs/components/dataGrid/dataGrid.js +3 -1
- package/dist/cjs/components/dataGrid/dataGridRows.js +39 -34
- package/dist/cjs/components/inputBase/inputBase.js +1 -1
- package/dist/esm/components/dataGrid/dataGrid.d.ts +5 -3
- package/dist/esm/components/dataGrid/dataGrid.js +3 -1
- package/dist/esm/components/dataGrid/dataGridRows.js +40 -35
- package/dist/esm/components/inputBase/inputBase.js +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { ComponentProps, ReactElement, ReactNode } from 'react';
|
|
2
|
-
import { DivProps, Id, Obj, ToRequired } from '../../types';
|
|
2
|
+
import { DivProps, Id, Obj, SlotsAndProps, ToRequired } from '../../types';
|
|
3
3
|
import { SelectionContextProps } from '../selectionContext';
|
|
4
4
|
import { PaginationProps } from '../pagination';
|
|
5
5
|
import { TableProps } from '../table';
|
|
@@ -35,7 +35,9 @@ export interface ColumnType<R extends RowType = RowType> extends Omit<ComponentP
|
|
|
35
35
|
/** @private 内部使用,在{@link DataGridHead}内计算 */
|
|
36
36
|
_negativeRowSpan?: number;
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
interface DataGridSharedProps<R extends RowType = RowType> extends SlotsAndProps<{
|
|
39
|
+
tr: ComponentProps<'tr'>;
|
|
40
|
+
}> {
|
|
39
41
|
rowProps?(row: R, index: number, rows: R[]): ComponentProps<'tr'>;
|
|
40
42
|
/** 数据的主键名,默认为`id` */
|
|
41
43
|
primaryKey?: keyof R;
|
|
@@ -50,7 +52,7 @@ type DataGridSharedProps<R extends RowType = RowType> = {
|
|
|
50
52
|
/** 子行缩进,默认为`24` */
|
|
51
53
|
indent?: number;
|
|
52
54
|
renderExpandIcon?(key: Id, isExpand: boolean, expanded: Id[]): ReactNode;
|
|
53
|
-
}
|
|
55
|
+
}
|
|
54
56
|
export type OrderType = 'ascend' | 'descend';
|
|
55
57
|
export interface DataGridBaseProps<R extends RowType = RowType> extends DataGridSharedProps<R>, Omit<DivProps, 'defaultValue' | 'onChange'> {
|
|
56
58
|
columns?: (ColumnType<R> | symbol)[];
|
|
@@ -19,7 +19,7 @@ const DataGridContext = (0, react_1.createContext)({});
|
|
|
19
19
|
function useDataGridContext() {
|
|
20
20
|
return (0, react_1.useContext)(DataGridContext);
|
|
21
21
|
}
|
|
22
|
-
exports.DataGrid = (0, react_1.memo)(({ columns, rows, rowProps, primaryKey = 'id', childrenKey = null, filterProps, initialFilterValue, onFilter, onFilterClick, filterPredicate, defaultOrderColumn, orderColumn, defaultOrderType = 'descend', orderType, onOrderChange, selectable, relation = 'dependent', integration = 'shallowest', allowSelectAll = true, clickRowToSelect = true, selectorProps, indent = 24, renderExpandIcon, defaultExpanded, expanded, onExpandedChange, paginatable = true, paginationProps, renderPagination, loading, emptyPlaceholder, columnResizable = false, size, bordered, striped, tableProps, multiple, defaultValue, value, onChange, ...props }) => {
|
|
22
|
+
exports.DataGrid = (0, react_1.memo)(({ slots, slotProps, columns, rows, rowProps, primaryKey = 'id', childrenKey = null, filterProps, initialFilterValue, onFilter, onFilterClick, filterPredicate, defaultOrderColumn, orderColumn, defaultOrderType = 'descend', orderType, onOrderChange, selectable, relation = 'dependent', integration = 'shallowest', allowSelectAll = true, clickRowToSelect = true, selectorProps, indent = 24, renderExpandIcon, defaultExpanded, expanded, onExpandedChange, paginatable = true, paginationProps, renderPagination, loading, emptyPlaceholder, columnResizable = false, size, bordered, striped, tableProps, multiple, defaultValue, value, onChange, ...props }) => {
|
|
23
23
|
/**
|
|
24
24
|
* ---------------------------------------------------------------
|
|
25
25
|
* 选择行
|
|
@@ -137,9 +137,11 @@ exports.DataGrid = (0, react_1.memo)(({ columns, rows, rowProps, primaryKey = 'i
|
|
|
137
137
|
className: dataGrid_style_1.classes.filterForm,
|
|
138
138
|
onFinish: filterHandler
|
|
139
139
|
}), children: (0, jsx_runtime_1.jsx)(columnResize_1.ColumnResizeContext, { columnResizable: columnResizable, children: ({ scrollerRef, tableRef }) => (0, jsx_runtime_1.jsxs)(table_1.TableContainer, { ref: scrollerRef, className: dataGrid_style_1.classes.container, children: [(0, jsx_runtime_1.jsx)(table_1.Table, { size: size, bordered: bordered, striped: striped, ...tableProps, ref: (0, utils_1.cloneRef)(tableProps?.ref, tableRef), children: (0, jsx_runtime_1.jsxs)(selectionContext_1.SelectionContext, { options: rows, primaryKey: primaryKey, childrenKey: childrenKey !== null ? childrenKey : void 0, relation: relation, integration: integration, disabled: !selectable, multiple: multiple, defaultValue: defaultValue, value: value, onChange: onChange, children: [(0, jsx_runtime_1.jsx)(dataGridHead_1.DataGridHead, { rows: rows, flattedColumns: flattedColumns, completedColumns: completedColumns, primaryKey: primaryKey, allowSelectAll: allowSelectAll, columnResizable: columnResizable, orderColumn: innerOrderColumn.current, orderType: innerOrderType.current, onOrderChange: orderChangeHandler, onFilterClick: onFilterClick }), (0, jsx_runtime_1.jsx)("tbody", { children: (0, jsx_runtime_1.jsx)(DataGridContext, { value: (0, react_1.useMemo)(() => ({
|
|
140
|
+
slots, slotProps,
|
|
140
141
|
rowProps, primaryKey, childrenKey, clickRowToSelect, indent, renderExpandIcon,
|
|
141
142
|
expandedSet, flattedColumns, toggleExpanded
|
|
142
143
|
}), [
|
|
144
|
+
slots, slotProps,
|
|
143
145
|
rowProps, primaryKey, childrenKey, clickRowToSelect, indent, renderExpandIcon,
|
|
144
146
|
expandedSet, flattedColumns
|
|
145
147
|
]), children: !!paginatedRows?.length &&
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DataGridRows = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
4
|
const react_1 = require("@emotion/react");
|
|
5
|
+
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
6
6
|
const react_2 = require("react");
|
|
7
7
|
const dataGrid_1 = require("./dataGrid");
|
|
8
8
|
const selectionContext_1 = require("../selectionContext");
|
|
@@ -18,7 +18,9 @@ const faPlusSquare_1 = require("@fortawesome/free-regular-svg-icons/faPlusSquare
|
|
|
18
18
|
const dataGrid_style_1 = require("./dataGrid.style");
|
|
19
19
|
exports.DataGridRows = (0, react_2.memo)(({ rows, _level = 0 }) => {
|
|
20
20
|
const { multiple, toggleSelected, selectionStatus } = (0, selectionContext_1.useSelectionContext)();
|
|
21
|
-
const { rowProps, primaryKey, childrenKey, clickRowToSelect, indent, renderExpandIcon, expandedSet, flattedColumns, toggleExpanded } = (0, dataGrid_1.useDataGridContext)();
|
|
21
|
+
const { slots, slotProps, rowProps, primaryKey, childrenKey, clickRowToSelect, indent, renderExpandIcon, expandedSet, flattedColumns, toggleExpanded } = (0, dataGrid_1.useDataGridContext)();
|
|
22
|
+
const { tr: Tr = 'tr' } = slots || {};
|
|
23
|
+
const { tr: TrProps } = slotProps || {};
|
|
22
24
|
return rows?.flatMap((row, i, arr) => {
|
|
23
25
|
const trKey = row[primaryKey];
|
|
24
26
|
if ((0, utils_1.isUnset)(trKey)) {
|
|
@@ -31,40 +33,43 @@ exports.DataGridRows = (0, react_2.memo)(({ rows, _level = 0 }) => {
|
|
|
31
33
|
const currentExpanded = expandable && expandedSet.has(trKey);
|
|
32
34
|
let expandableIndex = -2;
|
|
33
35
|
const ret = [
|
|
34
|
-
(0,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (col === dataGrid_1.DataGrid.EXPAND_COLUMN) {
|
|
40
|
-
expandableIndex = j;
|
|
41
|
-
return [];
|
|
36
|
+
(0, jsx_runtime_1.jsx)(Tr, { ...(0, utils_1.mergeComponentProps)(TrProps, _rowProps, {
|
|
37
|
+
key: trKey,
|
|
38
|
+
className: (0, utils_1.clsx)(_rowProps, _level > 0 && dataGrid_style_1.classes.sub),
|
|
39
|
+
onClick() {
|
|
40
|
+
clickRowToSelect && toggleSelected(trKey, row);
|
|
42
41
|
}
|
|
43
|
-
|
|
44
|
-
if (
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
}), "data-selected": status === 2, children: flattedColumns?.flatMap((col, j) => {
|
|
43
|
+
if (typeof col === 'symbol') {
|
|
44
|
+
if (col === dataGrid_1.DataGrid.EXPAND_COLUMN) {
|
|
45
|
+
expandableIndex = j;
|
|
46
|
+
return [];
|
|
47
|
+
}
|
|
48
|
+
// col === DataGrid.SELECT_COLUMN
|
|
49
|
+
if (expandableIndex === j - 1) {
|
|
50
|
+
// select column紧跟在expand column后面,需要顺延expandableIndex
|
|
51
|
+
expandableIndex = j;
|
|
52
|
+
}
|
|
53
|
+
const Component = multiple ? checkbox_1.Checkbox : radio_1.Radio;
|
|
54
|
+
return ((0, jsx_runtime_1.jsx)(table_1.TdCell, { className: dataGrid_style_1.classes.selectable, sticky: j === 0 ? 'left' : void 0, children: (0, jsx_runtime_1.jsx)(Component, { checked: status === 2, indeterminate: status === 1, onChange: () => {
|
|
55
|
+
toggleSelected(trKey, row);
|
|
56
|
+
}, onClick: e => e.stopPropagation() }) }, j + '_selectable'));
|
|
47
57
|
}
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
: currentExpanded
|
|
64
|
-
? (0, jsx_runtime_1.jsx)(icon_1.Icon, { icon: faMinusSquare_1.faMinusSquare })
|
|
65
|
-
: (0, jsx_runtime_1.jsx)(icon_1.Icon, { icon: faPlusSquare_1.faPlusSquare }) }), renderedContent] })
|
|
66
|
-
: renderedContent));
|
|
67
|
-
}))
|
|
58
|
+
const {
|
|
59
|
+
// 排除无需加入dom节点的属性
|
|
60
|
+
// width属性只需加入thead列中,普通列需排除
|
|
61
|
+
// rowSpan与colSpan需排除
|
|
62
|
+
title, key, children, sticky, field, render, sorter, filter, width, _key, _negativeRowSpan, rowSpan, colSpan, ..._colProps } = col;
|
|
63
|
+
const renderedContent = (0, utils_1.renderCell)({ render, field }, row, i, arr);
|
|
64
|
+
const shouldRenderExpand = expandableIndex === j - 1;
|
|
65
|
+
return ((0, react_1.createElement)(table_1.TdCell, { ..._colProps, key: _key, className: shouldRenderExpand ? dataGrid_style_1.classes.expandable : void 0, sticky: sticky }, shouldRenderExpand
|
|
66
|
+
? (0, jsx_runtime_1.jsxs)("div", { className: dataGrid_style_1.classes.expandableWrap, style: { paddingLeft: _level * indent }, children: [(0, jsx_runtime_1.jsx)(button_1.Button, { variant: "text", shape: "circular", color: "text.disabled", onClick: () => toggleExpanded(trKey), style: expandable ? void 0 : { visibility: 'hidden' }, children: renderExpandIcon
|
|
67
|
+
? renderExpandIcon(trKey, currentExpanded, [...expandedSet])
|
|
68
|
+
: currentExpanded
|
|
69
|
+
? (0, jsx_runtime_1.jsx)(icon_1.Icon, { icon: faMinusSquare_1.faMinusSquare })
|
|
70
|
+
: (0, jsx_runtime_1.jsx)(icon_1.Icon, { icon: faPlusSquare_1.faPlusSquare }) }), renderedContent] })
|
|
71
|
+
: renderedContent));
|
|
72
|
+
}) })
|
|
68
73
|
];
|
|
69
74
|
if (Array.isArray(children)) {
|
|
70
75
|
currentExpanded && ret.push((0, jsx_runtime_1.jsx)(exports.DataGridRows, { rows: children, _level: _level + 1 }, trKey + '_children'));
|
|
@@ -60,7 +60,7 @@ min, max, step, precision, placeholder, disabled, readOnly, autoFocus, defaultVa
|
|
|
60
60
|
if (!clearable || disabled || readOnly) {
|
|
61
61
|
return false;
|
|
62
62
|
}
|
|
63
|
-
return (0, utils_1.isNoValue)(innerValue.current);
|
|
63
|
+
return !(0, utils_1.isNoValue)(innerValue.current);
|
|
64
64
|
};
|
|
65
65
|
return ((0, jsx_runtime_1.jsxs)("div", { ...(0, utils_1.mergeComponentProps)(props, {
|
|
66
66
|
ref: innerRef,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { ComponentProps, ReactElement, ReactNode } from 'react';
|
|
2
|
-
import { DivProps, Id, Obj, ToRequired } from '../../types';
|
|
2
|
+
import { DivProps, Id, Obj, SlotsAndProps, ToRequired } from '../../types';
|
|
3
3
|
import { SelectionContextProps } from '../selectionContext';
|
|
4
4
|
import { PaginationProps } from '../pagination';
|
|
5
5
|
import { TableProps } from '../table';
|
|
@@ -35,7 +35,9 @@ export interface ColumnType<R extends RowType = RowType> extends Omit<ComponentP
|
|
|
35
35
|
/** @private 内部使用,在{@link DataGridHead}内计算 */
|
|
36
36
|
_negativeRowSpan?: number;
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
interface DataGridSharedProps<R extends RowType = RowType> extends SlotsAndProps<{
|
|
39
|
+
tr: ComponentProps<'tr'>;
|
|
40
|
+
}> {
|
|
39
41
|
rowProps?(row: R, index: number, rows: R[]): ComponentProps<'tr'>;
|
|
40
42
|
/** 数据的主键名,默认为`id` */
|
|
41
43
|
primaryKey?: keyof R;
|
|
@@ -50,7 +52,7 @@ type DataGridSharedProps<R extends RowType = RowType> = {
|
|
|
50
52
|
/** 子行缩进,默认为`24` */
|
|
51
53
|
indent?: number;
|
|
52
54
|
renderExpandIcon?(key: Id, isExpand: boolean, expanded: Id[]): ReactNode;
|
|
53
|
-
}
|
|
55
|
+
}
|
|
54
56
|
export type OrderType = 'ascend' | 'descend';
|
|
55
57
|
export interface DataGridBaseProps<R extends RowType = RowType> extends DataGridSharedProps<R>, Omit<DivProps, 'defaultValue' | 'onChange'> {
|
|
56
58
|
columns?: (ColumnType<R> | symbol)[];
|
|
@@ -15,7 +15,7 @@ const DataGridContext = createContext({});
|
|
|
15
15
|
export function useDataGridContext() {
|
|
16
16
|
return useContext(DataGridContext);
|
|
17
17
|
}
|
|
18
|
-
export const DataGrid = memo(({ columns, rows, rowProps, primaryKey = 'id', childrenKey = null, filterProps, initialFilterValue, onFilter, onFilterClick, filterPredicate, defaultOrderColumn, orderColumn, defaultOrderType = 'descend', orderType, onOrderChange, selectable, relation = 'dependent', integration = 'shallowest', allowSelectAll = true, clickRowToSelect = true, selectorProps, indent = 24, renderExpandIcon, defaultExpanded, expanded, onExpandedChange, paginatable = true, paginationProps, renderPagination, loading, emptyPlaceholder, columnResizable = false, size, bordered, striped, tableProps, multiple, defaultValue, value, onChange, ...props }) => {
|
|
18
|
+
export const DataGrid = memo(({ slots, slotProps, columns, rows, rowProps, primaryKey = 'id', childrenKey = null, filterProps, initialFilterValue, onFilter, onFilterClick, filterPredicate, defaultOrderColumn, orderColumn, defaultOrderType = 'descend', orderType, onOrderChange, selectable, relation = 'dependent', integration = 'shallowest', allowSelectAll = true, clickRowToSelect = true, selectorProps, indent = 24, renderExpandIcon, defaultExpanded, expanded, onExpandedChange, paginatable = true, paginationProps, renderPagination, loading, emptyPlaceholder, columnResizable = false, size, bordered, striped, tableProps, multiple, defaultValue, value, onChange, ...props }) => {
|
|
19
19
|
/**
|
|
20
20
|
* ---------------------------------------------------------------
|
|
21
21
|
* 选择行
|
|
@@ -133,9 +133,11 @@ export const DataGrid = memo(({ columns, rows, rowProps, primaryKey = 'id', chil
|
|
|
133
133
|
className: classes.filterForm,
|
|
134
134
|
onFinish: filterHandler
|
|
135
135
|
}), children: _jsx(ColumnResizeContext, { columnResizable: columnResizable, children: ({ scrollerRef, tableRef }) => _jsxs(TableContainer, { ref: scrollerRef, className: classes.container, children: [_jsx(Table, { size: size, bordered: bordered, striped: striped, ...tableProps, ref: cloneRef(tableProps?.ref, tableRef), children: _jsxs(SelectionContext, { options: rows, primaryKey: primaryKey, childrenKey: childrenKey !== null ? childrenKey : void 0, relation: relation, integration: integration, disabled: !selectable, multiple: multiple, defaultValue: defaultValue, value: value, onChange: onChange, children: [_jsx(DataGridHead, { rows: rows, flattedColumns: flattedColumns, completedColumns: completedColumns, primaryKey: primaryKey, allowSelectAll: allowSelectAll, columnResizable: columnResizable, orderColumn: innerOrderColumn.current, orderType: innerOrderType.current, onOrderChange: orderChangeHandler, onFilterClick: onFilterClick }), _jsx("tbody", { children: _jsx(DataGridContext, { value: useMemo(() => ({
|
|
136
|
+
slots, slotProps,
|
|
136
137
|
rowProps, primaryKey, childrenKey, clickRowToSelect, indent, renderExpandIcon,
|
|
137
138
|
expandedSet, flattedColumns, toggleExpanded
|
|
138
139
|
}), [
|
|
140
|
+
slots, slotProps,
|
|
139
141
|
rowProps, primaryKey, childrenKey, clickRowToSelect, indent, renderExpandIcon,
|
|
140
142
|
expandedSet, flattedColumns
|
|
141
143
|
]), children: !!paginatedRows?.length &&
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
2
1
|
import { createElement as _createElement } from "@emotion/react";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
3
3
|
import { memo } from 'react';
|
|
4
4
|
import { DataGrid, useDataGridContext } from './dataGrid';
|
|
5
5
|
import { useSelectionContext } from '../selectionContext';
|
|
6
|
-
import { clsx, isUnset, renderCell } from '../../utils';
|
|
6
|
+
import { clsx, isUnset, mergeComponentProps, renderCell } from '../../utils';
|
|
7
7
|
import { Checkbox } from '../checkbox';
|
|
8
8
|
import { Radio } from '../radio';
|
|
9
9
|
import { TdCell } from '../table';
|
|
@@ -15,7 +15,9 @@ import { faPlusSquare } from '@fortawesome/free-regular-svg-icons/faPlusSquare';
|
|
|
15
15
|
import { classes } from './dataGrid.style';
|
|
16
16
|
export const DataGridRows = memo(({ rows, _level = 0 }) => {
|
|
17
17
|
const { multiple, toggleSelected, selectionStatus } = useSelectionContext();
|
|
18
|
-
const { rowProps, primaryKey, childrenKey, clickRowToSelect, indent, renderExpandIcon, expandedSet, flattedColumns, toggleExpanded } = useDataGridContext();
|
|
18
|
+
const { slots, slotProps, rowProps, primaryKey, childrenKey, clickRowToSelect, indent, renderExpandIcon, expandedSet, flattedColumns, toggleExpanded } = useDataGridContext();
|
|
19
|
+
const { tr: Tr = 'tr' } = slots || {};
|
|
20
|
+
const { tr: TrProps } = slotProps || {};
|
|
19
21
|
return rows?.flatMap((row, i, arr) => {
|
|
20
22
|
const trKey = row[primaryKey];
|
|
21
23
|
if (isUnset(trKey)) {
|
|
@@ -28,40 +30,43 @@ export const DataGridRows = memo(({ rows, _level = 0 }) => {
|
|
|
28
30
|
const currentExpanded = expandable && expandedSet.has(trKey);
|
|
29
31
|
let expandableIndex = -2;
|
|
30
32
|
const ret = [
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (col === DataGrid.EXPAND_COLUMN) {
|
|
37
|
-
expandableIndex = j;
|
|
38
|
-
return [];
|
|
33
|
+
_jsx(Tr, { ...mergeComponentProps(TrProps, _rowProps, {
|
|
34
|
+
key: trKey,
|
|
35
|
+
className: clsx(_rowProps, _level > 0 && classes.sub),
|
|
36
|
+
onClick() {
|
|
37
|
+
clickRowToSelect && toggleSelected(trKey, row);
|
|
39
38
|
}
|
|
40
|
-
|
|
41
|
-
if (
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
}), "data-selected": status === 2, children: flattedColumns?.flatMap((col, j) => {
|
|
40
|
+
if (typeof col === 'symbol') {
|
|
41
|
+
if (col === DataGrid.EXPAND_COLUMN) {
|
|
42
|
+
expandableIndex = j;
|
|
43
|
+
return [];
|
|
44
|
+
}
|
|
45
|
+
// col === DataGrid.SELECT_COLUMN
|
|
46
|
+
if (expandableIndex === j - 1) {
|
|
47
|
+
// select column紧跟在expand column后面,需要顺延expandableIndex
|
|
48
|
+
expandableIndex = j;
|
|
49
|
+
}
|
|
50
|
+
const Component = multiple ? Checkbox : Radio;
|
|
51
|
+
return (_jsx(TdCell, { className: classes.selectable, sticky: j === 0 ? 'left' : void 0, children: _jsx(Component, { checked: status === 2, indeterminate: status === 1, onChange: () => {
|
|
52
|
+
toggleSelected(trKey, row);
|
|
53
|
+
}, onClick: e => e.stopPropagation() }) }, j + '_selectable'));
|
|
44
54
|
}
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
: currentExpanded
|
|
61
|
-
? _jsx(Icon, { icon: faMinusSquare })
|
|
62
|
-
: _jsx(Icon, { icon: faPlusSquare }) }), renderedContent] })
|
|
63
|
-
: renderedContent));
|
|
64
|
-
}))
|
|
55
|
+
const {
|
|
56
|
+
// 排除无需加入dom节点的属性
|
|
57
|
+
// width属性只需加入thead列中,普通列需排除
|
|
58
|
+
// rowSpan与colSpan需排除
|
|
59
|
+
title, key, children, sticky, field, render, sorter, filter, width, _key, _negativeRowSpan, rowSpan, colSpan, ..._colProps } = col;
|
|
60
|
+
const renderedContent = renderCell({ render, field }, row, i, arr);
|
|
61
|
+
const shouldRenderExpand = expandableIndex === j - 1;
|
|
62
|
+
return (_createElement(TdCell, { ..._colProps, key: _key, className: shouldRenderExpand ? classes.expandable : void 0, sticky: sticky }, shouldRenderExpand
|
|
63
|
+
? _jsxs("div", { className: classes.expandableWrap, style: { paddingLeft: _level * indent }, children: [_jsx(Button, { variant: "text", shape: "circular", color: "text.disabled", onClick: () => toggleExpanded(trKey), style: expandable ? void 0 : { visibility: 'hidden' }, children: renderExpandIcon
|
|
64
|
+
? renderExpandIcon(trKey, currentExpanded, [...expandedSet])
|
|
65
|
+
: currentExpanded
|
|
66
|
+
? _jsx(Icon, { icon: faMinusSquare })
|
|
67
|
+
: _jsx(Icon, { icon: faPlusSquare }) }), renderedContent] })
|
|
68
|
+
: renderedContent));
|
|
69
|
+
}) })
|
|
65
70
|
];
|
|
66
71
|
if (Array.isArray(children)) {
|
|
67
72
|
currentExpanded && ret.push(_jsx(DataGridRows, { rows: children, _level: _level + 1 }, trKey + '_children'));
|
|
@@ -57,7 +57,7 @@ min, max, step, precision, placeholder, disabled, readOnly, autoFocus, defaultVa
|
|
|
57
57
|
if (!clearable || disabled || readOnly) {
|
|
58
58
|
return false;
|
|
59
59
|
}
|
|
60
|
-
return isNoValue(innerValue.current);
|
|
60
|
+
return !isNoValue(innerValue.current);
|
|
61
61
|
};
|
|
62
62
|
return (_jsxs("div", { ...mergeComponentProps(props, {
|
|
63
63
|
ref: innerRef,
|