@canlooks/can-ui 0.0.79 → 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/calendar/calendar.style.js +124 -124
- package/dist/cjs/components/clickAway/clickAway.d.ts +1 -1
- 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/cjs/components/popper/popper.js +3 -2
- package/dist/cjs/components/status/status.d.ts +6 -6
- package/dist/esm/components/calendar/calendar.style.js +124 -124
- package/dist/esm/components/clickAway/clickAway.d.ts +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/dist/esm/components/popper/popper.js +3 -2
- package/dist/esm/components/status/status.d.ts +6 -6
- package/extensions/curd.cjs +5 -5
- package/extensions/documentViewer.cjs +5 -5
- package/extensions/textFormatter.cjs +5 -5
- package/package.json +1 -1
- package/documentation/dist/assets/index-DvrKS6Tv.js +0 -7747
- package/documentation/dist/atom-one-dark.min.css +0 -1
- package/documentation/dist/components/accordion.md +0 -38
- package/documentation/dist/components/actionSheet.md +0 -49
- package/documentation/dist/components/alert.md +0 -38
- package/documentation/dist/components/anchorList.md +0 -36
- package/documentation/dist/components/autocomplete.md +0 -68
- package/documentation/dist/components/avatar.md +0 -79
- package/documentation/dist/components/badge.md +0 -33
- package/documentation/dist/components/bottomNavigation.md +0 -39
- package/documentation/dist/components/breadcrumb.md +0 -28
- package/documentation/dist/components/bubbleConfirm.md +0 -34
- package/documentation/dist/components/button.md +0 -62
- package/documentation/dist/components/card.md +0 -30
- package/documentation/dist/components/cascade.md +0 -48
- package/documentation/dist/components/checkbox.md +0 -36
- package/documentation/dist/components/colorPicker.md +0 -27
- package/documentation/dist/components/contextMenu.md +0 -27
- package/documentation/dist/components/counter.md +0 -29
- package/documentation/dist/components/dataGrid.md +0 -112
- package/documentation/dist/components/dateTimePicker.md +0 -35
- package/documentation/dist/components/dateTimeRangePicker.md +0 -36
- package/documentation/dist/components/descriptions.md +0 -35
- package/documentation/dist/components/dialog.md +0 -56
- package/documentation/dist/components/divider.md +0 -26
- package/documentation/dist/components/drawer.md +0 -40
- package/documentation/dist/components/flex.md +0 -20
- package/documentation/dist/components/form.md +0 -131
- package/documentation/dist/components/formDialog.md +0 -36
- package/documentation/dist/components/grid.md +0 -34
- package/documentation/dist/components/highlight.md +0 -26
- package/documentation/dist/components/image.md +0 -90
- package/documentation/dist/components/input.md +0 -39
- package/documentation/dist/components/loading.md +0 -46
- package/documentation/dist/components/menu.md +0 -85
- package/documentation/dist/components/pagination.md +0 -38
- package/documentation/dist/components/pickerDialog.md +0 -56
- package/documentation/dist/components/placeholder.md +0 -30
- package/documentation/dist/components/progress.md +0 -43
- package/documentation/dist/components/radio.md +0 -37
- package/documentation/dist/components/rating.md +0 -35
- package/documentation/dist/components/resizable.md +0 -41
- package/documentation/dist/components/scrollbar.md +0 -31
- package/documentation/dist/components/segmented.md +0 -57
- package/documentation/dist/components/select.md +0 -30
- package/documentation/dist/components/skeleton.md +0 -26
- package/documentation/dist/components/slidableActions.md +0 -53
- package/documentation/dist/guide/appComponent.md +0 -30
- package/documentation/dist/guide/globalMethods.md +0 -238
- package/documentation/dist/guide/icon.md +0 -57
- package/documentation/dist/guide/introduction.md +0 -2
- package/documentation/dist/guide/overrideProps.md +0 -0
- package/documentation/dist/guide/startup.md +0 -23
- package/documentation/dist/guide/theme.md +0 -249
- package/documentation/dist/index.html +0 -13
- package/documentation/dist/logo.png +0 -0
|
@@ -16,128 +16,128 @@ exports.classes = (0, utils_1.defineInnerClasses)('calendar', [
|
|
|
16
16
|
'yearItem',
|
|
17
17
|
'foot'
|
|
18
18
|
]);
|
|
19
|
-
exports.style = (0, utils_1.defineCss)(({ divider, text, spacing }) => (0, react_1.css) `
|
|
20
|
-
.${exports.classes.head} {
|
|
21
|
-
height: 40px;
|
|
22
|
-
display: flex;
|
|
23
|
-
align-items: center;
|
|
24
|
-
justify-content: space-between;
|
|
25
|
-
border-bottom: 1px solid ${divider};
|
|
26
|
-
padding: 0 ${menuItem_style_1.menuListPadding}px;
|
|
27
|
-
position: relative;
|
|
28
|
-
|
|
29
|
-
.${exports.classes.headSide} {
|
|
30
|
-
z-index: 1;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.${exports.classes.headControl} {
|
|
34
|
-
color: ${text.placeholder};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.${exports.classes.headCenter} {
|
|
38
|
-
display: flex;
|
|
39
|
-
align-items: center;
|
|
40
|
-
justify-content: center;
|
|
41
|
-
position: absolute;
|
|
42
|
-
inset: 0;
|
|
43
|
-
|
|
44
|
-
.${exports.classes.headButton} {
|
|
45
|
-
font-weight: bold;
|
|
46
|
-
color: ${text.primary};
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.${exports.classes.body} {
|
|
52
|
-
padding: ${spacing[3]}px ${spacing[4]}px;
|
|
53
|
-
display: grid;
|
|
54
|
-
place-items: center;
|
|
55
|
-
|
|
56
|
-
&[data-view-type=date] {
|
|
57
|
-
font-size: ${13 / 14}em;
|
|
58
|
-
grid-template-columns: repeat(7, 36px);
|
|
59
|
-
grid-template-rows: repeat(7, 36px);
|
|
60
|
-
|
|
61
|
-
.${exports.classes.dateItem} {
|
|
62
|
-
width: 24px;
|
|
63
|
-
height: 24px;
|
|
64
|
-
|
|
65
|
-
&:not([data-variant=filled]) {
|
|
66
|
-
color: ${text.primary};
|
|
67
|
-
border-color: ${text.disabled};
|
|
68
|
-
|
|
69
|
-
&[data-other-month=true] {
|
|
70
|
-
color: ${text.placeholder};
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
&:disabled {
|
|
75
|
-
width: 100%;
|
|
76
|
-
border-radius: 0;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
&[data-view-type=month], &[data-view-type=year] {
|
|
82
|
-
grid-template-columns: repeat(3, 84px);
|
|
83
|
-
grid-template-rows: repeat(4, 63px);
|
|
84
|
-
|
|
85
|
-
.${exports.classes.monthItem},
|
|
86
|
-
.${exports.classes.yearItem} {
|
|
87
|
-
width: 72px;
|
|
88
|
-
padding-inline: 0;
|
|
89
|
-
|
|
90
|
-
&:not([data-variant=filled]) {
|
|
91
|
-
color: ${text.primary};
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
&[data-size=small] {
|
|
98
|
-
.${exports.classes.body} {
|
|
99
|
-
&[data-view-type=date] {
|
|
100
|
-
grid-template-columns: repeat(7, 30px);
|
|
101
|
-
grid-template-rows: repeat(7, 30px);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
&[data-view-type=month], &[data-view-type=year] {
|
|
105
|
-
grid-template-columns: repeat(3, 70px);
|
|
106
|
-
grid-template-rows: repeat(4, 52.5px);
|
|
107
|
-
|
|
108
|
-
.${exports.classes.monthItem},
|
|
109
|
-
.${exports.classes.yearItem} {
|
|
110
|
-
width: 60px;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
&[data-size=large] {
|
|
117
|
-
.${exports.classes.body} {
|
|
118
|
-
&[data-view-type=date] {
|
|
119
|
-
font-size: 1em;
|
|
120
|
-
grid-template-columns: repeat(7, 42px);
|
|
121
|
-
grid-template-rows: repeat(7, 42px);
|
|
122
|
-
|
|
123
|
-
.${exports.classes.dateItem} {
|
|
124
|
-
width: 32px;
|
|
125
|
-
height: 32px;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
&[data-view-type=month], &[data-view-type=year] {
|
|
130
|
-
grid-template-columns: repeat(3, 98px);
|
|
131
|
-
grid-template-rows: repeat(4, 73.5px);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
.${exports.classes.foot} {
|
|
137
|
-
height: 41px;
|
|
138
|
-
display: flex;
|
|
139
|
-
align-items: center;
|
|
140
|
-
justify-content: center;
|
|
141
|
-
border-top: 1px solid ${divider};
|
|
142
|
-
}
|
|
19
|
+
exports.style = (0, utils_1.defineCss)(({ divider, text, spacing }) => (0, react_1.css) `
|
|
20
|
+
.${exports.classes.head} {
|
|
21
|
+
height: 40px;
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
justify-content: space-between;
|
|
25
|
+
border-bottom: 1px solid ${divider};
|
|
26
|
+
padding: 0 ${menuItem_style_1.menuListPadding}px;
|
|
27
|
+
position: relative;
|
|
28
|
+
|
|
29
|
+
.${exports.classes.headSide} {
|
|
30
|
+
z-index: 1;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.${exports.classes.headControl} {
|
|
34
|
+
color: ${text.placeholder};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.${exports.classes.headCenter} {
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
position: absolute;
|
|
42
|
+
inset: 0;
|
|
43
|
+
|
|
44
|
+
.${exports.classes.headButton} {
|
|
45
|
+
font-weight: bold;
|
|
46
|
+
color: ${text.primary};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.${exports.classes.body} {
|
|
52
|
+
padding: ${spacing[3]}px ${spacing[4]}px;
|
|
53
|
+
display: grid;
|
|
54
|
+
place-items: center;
|
|
55
|
+
|
|
56
|
+
&[data-view-type=date] {
|
|
57
|
+
font-size: ${13 / 14}em;
|
|
58
|
+
grid-template-columns: repeat(7, 36px);
|
|
59
|
+
grid-template-rows: repeat(7, 36px);
|
|
60
|
+
|
|
61
|
+
.${exports.classes.dateItem} {
|
|
62
|
+
width: 24px;
|
|
63
|
+
height: 24px;
|
|
64
|
+
|
|
65
|
+
&:not([data-variant=filled]) {
|
|
66
|
+
color: ${text.primary};
|
|
67
|
+
border-color: ${text.disabled};
|
|
68
|
+
|
|
69
|
+
&[data-other-month=true] {
|
|
70
|
+
color: ${text.placeholder};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&:disabled {
|
|
75
|
+
width: 100%;
|
|
76
|
+
border-radius: 0;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&[data-view-type=month], &[data-view-type=year] {
|
|
82
|
+
grid-template-columns: repeat(3, 84px);
|
|
83
|
+
grid-template-rows: repeat(4, 63px);
|
|
84
|
+
|
|
85
|
+
.${exports.classes.monthItem},
|
|
86
|
+
.${exports.classes.yearItem} {
|
|
87
|
+
width: 72px;
|
|
88
|
+
padding-inline: 0;
|
|
89
|
+
|
|
90
|
+
&:not([data-variant=filled]) {
|
|
91
|
+
color: ${text.primary};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&[data-size=small] {
|
|
98
|
+
.${exports.classes.body} {
|
|
99
|
+
&[data-view-type=date] {
|
|
100
|
+
grid-template-columns: repeat(7, 30px);
|
|
101
|
+
grid-template-rows: repeat(7, 30px);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&[data-view-type=month], &[data-view-type=year] {
|
|
105
|
+
grid-template-columns: repeat(3, 70px);
|
|
106
|
+
grid-template-rows: repeat(4, 52.5px);
|
|
107
|
+
|
|
108
|
+
.${exports.classes.monthItem},
|
|
109
|
+
.${exports.classes.yearItem} {
|
|
110
|
+
width: 60px;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
&[data-size=large] {
|
|
117
|
+
.${exports.classes.body} {
|
|
118
|
+
&[data-view-type=date] {
|
|
119
|
+
font-size: 1em;
|
|
120
|
+
grid-template-columns: repeat(7, 42px);
|
|
121
|
+
grid-template-rows: repeat(7, 42px);
|
|
122
|
+
|
|
123
|
+
.${exports.classes.dateItem} {
|
|
124
|
+
width: 32px;
|
|
125
|
+
height: 32px;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
&[data-view-type=month], &[data-view-type=year] {
|
|
130
|
+
grid-template-columns: repeat(3, 98px);
|
|
131
|
+
grid-template-rows: repeat(4, 73.5px);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.${exports.classes.foot} {
|
|
137
|
+
height: 41px;
|
|
138
|
+
display: flex;
|
|
139
|
+
align-items: center;
|
|
140
|
+
justify-content: center;
|
|
141
|
+
border-top: 1px solid ${divider};
|
|
142
|
+
}
|
|
143
143
|
`);
|
|
@@ -60,7 +60,7 @@ export declare function ClickAway({ ref, container, eventType, onClickAway, disa
|
|
|
60
60
|
results: number;
|
|
61
61
|
security: string;
|
|
62
62
|
unselectable: "off" | "on";
|
|
63
|
-
popover: "" | "auto" | "manual";
|
|
63
|
+
popover: "" | "auto" | "manual" | "hint";
|
|
64
64
|
popoverTargetAction: "toggle" | "hide" | "show";
|
|
65
65
|
popoverTarget: string;
|
|
66
66
|
inert: boolean;
|
|
@@ -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,
|
|
@@ -468,9 +468,10 @@ function Popper({ ref, popperRef, anchorElement, container = document.body, effe
|
|
|
468
468
|
const click = () => {
|
|
469
469
|
setOpenForce(false);
|
|
470
470
|
};
|
|
471
|
-
anchorRef.current
|
|
471
|
+
const anchorEl = anchorRef.current;
|
|
472
|
+
anchorEl.addEventListener('click', click);
|
|
472
473
|
return () => {
|
|
473
|
-
|
|
474
|
+
anchorEl.removeEventListener('click', click);
|
|
474
475
|
};
|
|
475
476
|
}
|
|
476
477
|
}, [clickToClose]);
|
|
@@ -3,12 +3,12 @@ import { DivProps, Status as IStatus } from '../../types';
|
|
|
3
3
|
import { FontAwesomeIconProps } from '@fortawesome/react-fontawesome';
|
|
4
4
|
export type StatusType = IStatus | 'confirm' | 'unknown';
|
|
5
5
|
export declare const statusMapToIconDefinition: {
|
|
6
|
-
info: import("@fortawesome/
|
|
7
|
-
success: import("@fortawesome/
|
|
8
|
-
warning: import("@fortawesome/
|
|
9
|
-
error: import("@fortawesome/
|
|
10
|
-
confirm: import("@fortawesome/
|
|
11
|
-
unknown: import("@fortawesome/
|
|
6
|
+
info: import("@fortawesome/free-solid-svg-icons").IconDefinition;
|
|
7
|
+
success: import("@fortawesome/free-solid-svg-icons").IconDefinition;
|
|
8
|
+
warning: import("@fortawesome/free-solid-svg-icons").IconDefinition;
|
|
9
|
+
error: import("@fortawesome/free-solid-svg-icons").IconDefinition;
|
|
10
|
+
confirm: import("@fortawesome/free-solid-svg-icons").IconDefinition;
|
|
11
|
+
unknown: import("@fortawesome/free-solid-svg-icons").IconDefinition;
|
|
12
12
|
};
|
|
13
13
|
export interface StatusIconProps extends Partial<FontAwesomeIconProps> {
|
|
14
14
|
status?: StatusType;
|