@canlooks/can-ui 0.0.137 → 0.0.139
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/curd/curd.d.ts +9 -7
- package/dist/cjs/components/dataGrid/dataGridHead.js +2 -2
- package/dist/cjs/components/dataGrid/dataGridRows.js +2 -2
- package/dist/cjs/utils/gesture.js +1 -1
- package/dist/esm/components/curd/curd.d.ts +9 -7
- package/dist/esm/components/dataGrid/dataGridHead.js +2 -2
- package/dist/esm/components/dataGrid/dataGridRows.js +2 -2
- package/dist/esm/utils/gesture.js +1 -1
- package/package.json +1 -1
|
@@ -40,13 +40,15 @@ export interface CurdBaseProps<R extends RowType = RowType, F extends FormValue
|
|
|
40
40
|
wrapperProps?: DivProps;
|
|
41
41
|
/** 嵌入式样式通常用于Dialog或Card组件内 */
|
|
42
42
|
variant?: 'standard' | 'embeded';
|
|
43
|
-
loadRows?:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
loadRows?: {
|
|
44
|
+
bivarianceHack(pagination?: {
|
|
45
|
+
page: number;
|
|
46
|
+
pageSize: number;
|
|
47
|
+
}, filterValue?: FormValue, sorter?: {
|
|
48
|
+
field: FieldPath;
|
|
49
|
+
type: OrderType;
|
|
50
|
+
}): LoadRowsReturn<R> | Promise<LoadRowsReturn<R>>;
|
|
51
|
+
}['bivarianceHack'];
|
|
50
52
|
columns?: (CurdColumn<R> | symbol)[];
|
|
51
53
|
toolbarLeft?: ReactNode;
|
|
52
54
|
toolbarRight?: ReactNode;
|
|
@@ -82,7 +82,7 @@ exports.DataGridHead = (0, react_2.memo)(({ allowSelectAll, columnResizable, fla
|
|
|
82
82
|
}
|
|
83
83
|
const {
|
|
84
84
|
// 排除无需加入dom节点的属性
|
|
85
|
-
title, key, children,
|
|
85
|
+
title, key, children, field, render, sorter, filter, _key, _negativeRowSpan = 0, ...colProps } = col;
|
|
86
86
|
const sortable = sorter && !children?.length;
|
|
87
87
|
const isOrderingColumn = orderColumn === _key;
|
|
88
88
|
const currentOrderType = isOrderingColumn ? orderType : 'descend';
|
|
@@ -92,7 +92,7 @@ exports.DataGridHead = (0, react_2.memo)(({ allowSelectAll, columnResizable, fla
|
|
|
92
92
|
onFilterClick?.(_key, e);
|
|
93
93
|
}, children: (0, jsx_runtime_1.jsx)(icon_1.Icon, { icon: faFilter_1.faFilter }) }));
|
|
94
94
|
return [
|
|
95
|
-
(0, react_1.createElement)(Column, { rowSpan: headRows.length - _negativeRowSpan, ...colProps, key: _key,
|
|
95
|
+
(0, react_1.createElement)(Column, { rowSpan: headRows.length - _negativeRowSpan, ...colProps, key: _key, "data-sortable": !!sortable, "data-ordering": isOrderingColumn, "data-order-type": currentOrderType, onClick: e => {
|
|
96
96
|
colProps.onClick?.(e);
|
|
97
97
|
sortable && onOrderChange?.(_key, currentOrderType === 'descend' ? 'ascend' : 'descend');
|
|
98
98
|
} }, sortable || filter
|
|
@@ -56,10 +56,10 @@ exports.DataGridRows = (0, react_2.memo)(({ rows, _level = 0 }) => {
|
|
|
56
56
|
// 排除无需加入dom节点的属性
|
|
57
57
|
// width属性只需加入thead列中,普通列需排除
|
|
58
58
|
// rowSpan与colSpan需排除
|
|
59
|
-
title, key, children,
|
|
59
|
+
title, key, children, field, render, sorter, filter, width, _key, _negativeRowSpan, rowSpan, colSpan, ..._colProps } = col;
|
|
60
60
|
const renderedContent = (0, utils_1.renderCell)({ render, field }, row, i, arr);
|
|
61
61
|
const shouldRenderExpand = expandableIndex === j - 1;
|
|
62
|
-
return ((0, react_1.createElement)(table_1.TdCell, { ..._colProps, key: _key, className: shouldRenderExpand
|
|
62
|
+
return ((0, react_1.createElement)(table_1.TdCell, { ..._colProps, key: _key, className: (0, utils_1.clsx)(_colProps.className, shouldRenderExpand && dataGrid_style_1.classes.expandable) }, shouldRenderExpand
|
|
63
63
|
? (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
|
|
64
64
|
? renderExpandIcon(trKey, currentExpanded, [...expandedSet])
|
|
65
65
|
: currentExpanded
|
|
@@ -93,6 +93,7 @@ function useGesture(options) {
|
|
|
93
93
|
}
|
|
94
94
|
const { clickVibration } = syncOptions.current;
|
|
95
95
|
if (!isDragged.current && (absDiffX > clickVibration || absDiffY > clickVibration)) {
|
|
96
|
+
// 拖拽距离超过允许抖动,将isDragged标记为true
|
|
96
97
|
isDragged.current = true;
|
|
97
98
|
}
|
|
98
99
|
syncOptions.current.onDrag?.(dragInfo, e);
|
|
@@ -100,7 +101,6 @@ function useGesture(options) {
|
|
|
100
101
|
const cancelDragFn = () => {
|
|
101
102
|
delayTimeout.current && clearTimeout(delayTimeout.current);
|
|
102
103
|
delayTimeout.current = void 0;
|
|
103
|
-
isDragged.current = false;
|
|
104
104
|
document.documentElement.style.userSelect = '';
|
|
105
105
|
removeEventListener('pointermove', draggingPointerMove);
|
|
106
106
|
removeEventListener('pointerup', draggingPointerUp);
|
|
@@ -40,13 +40,15 @@ export interface CurdBaseProps<R extends RowType = RowType, F extends FormValue
|
|
|
40
40
|
wrapperProps?: DivProps;
|
|
41
41
|
/** 嵌入式样式通常用于Dialog或Card组件内 */
|
|
42
42
|
variant?: 'standard' | 'embeded';
|
|
43
|
-
loadRows?:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
loadRows?: {
|
|
44
|
+
bivarianceHack(pagination?: {
|
|
45
|
+
page: number;
|
|
46
|
+
pageSize: number;
|
|
47
|
+
}, filterValue?: FormValue, sorter?: {
|
|
48
|
+
field: FieldPath;
|
|
49
|
+
type: OrderType;
|
|
50
|
+
}): LoadRowsReturn<R> | Promise<LoadRowsReturn<R>>;
|
|
51
|
+
}['bivarianceHack'];
|
|
50
52
|
columns?: (CurdColumn<R> | symbol)[];
|
|
51
53
|
toolbarLeft?: ReactNode;
|
|
52
54
|
toolbarRight?: ReactNode;
|
|
@@ -79,7 +79,7 @@ export const DataGridHead = memo(({ allowSelectAll, columnResizable, flattedColu
|
|
|
79
79
|
}
|
|
80
80
|
const {
|
|
81
81
|
// 排除无需加入dom节点的属性
|
|
82
|
-
title, key, children,
|
|
82
|
+
title, key, children, field, render, sorter, filter, _key, _negativeRowSpan = 0, ...colProps } = col;
|
|
83
83
|
const sortable = sorter && !children?.length;
|
|
84
84
|
const isOrderingColumn = orderColumn === _key;
|
|
85
85
|
const currentOrderType = isOrderingColumn ? orderType : 'descend';
|
|
@@ -89,7 +89,7 @@ export const DataGridHead = memo(({ allowSelectAll, columnResizable, flattedColu
|
|
|
89
89
|
onFilterClick?.(_key, e);
|
|
90
90
|
}, children: _jsx(Icon, { icon: faFilter }) }));
|
|
91
91
|
return [
|
|
92
|
-
_createElement(Column, { rowSpan: headRows.length - _negativeRowSpan, ...colProps, key: _key,
|
|
92
|
+
_createElement(Column, { rowSpan: headRows.length - _negativeRowSpan, ...colProps, key: _key, "data-sortable": !!sortable, "data-ordering": isOrderingColumn, "data-order-type": currentOrderType, onClick: e => {
|
|
93
93
|
colProps.onClick?.(e);
|
|
94
94
|
sortable && onOrderChange?.(_key, currentOrderType === 'descend' ? 'ascend' : 'descend');
|
|
95
95
|
} }, sortable || filter
|
|
@@ -53,10 +53,10 @@ export const DataGridRows = memo(({ rows, _level = 0 }) => {
|
|
|
53
53
|
// 排除无需加入dom节点的属性
|
|
54
54
|
// width属性只需加入thead列中,普通列需排除
|
|
55
55
|
// rowSpan与colSpan需排除
|
|
56
|
-
title, key, children,
|
|
56
|
+
title, key, children, field, render, sorter, filter, width, _key, _negativeRowSpan, rowSpan, colSpan, ..._colProps } = col;
|
|
57
57
|
const renderedContent = renderCell({ render, field }, row, i, arr);
|
|
58
58
|
const shouldRenderExpand = expandableIndex === j - 1;
|
|
59
|
-
return (_createElement(TdCell, { ..._colProps, key: _key, className: shouldRenderExpand
|
|
59
|
+
return (_createElement(TdCell, { ..._colProps, key: _key, className: clsx(_colProps.className, shouldRenderExpand && classes.expandable) }, shouldRenderExpand
|
|
60
60
|
? _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
|
|
61
61
|
? renderExpandIcon(trKey, currentExpanded, [...expandedSet])
|
|
62
62
|
: currentExpanded
|
|
@@ -88,6 +88,7 @@ export function useGesture(options) {
|
|
|
88
88
|
}
|
|
89
89
|
const { clickVibration } = syncOptions.current;
|
|
90
90
|
if (!isDragged.current && (absDiffX > clickVibration || absDiffY > clickVibration)) {
|
|
91
|
+
// 拖拽距离超过允许抖动,将isDragged标记为true
|
|
91
92
|
isDragged.current = true;
|
|
92
93
|
}
|
|
93
94
|
syncOptions.current.onDrag?.(dragInfo, e);
|
|
@@ -95,7 +96,6 @@ export function useGesture(options) {
|
|
|
95
96
|
const cancelDragFn = () => {
|
|
96
97
|
delayTimeout.current && clearTimeout(delayTimeout.current);
|
|
97
98
|
delayTimeout.current = void 0;
|
|
98
|
-
isDragged.current = false;
|
|
99
99
|
document.documentElement.style.userSelect = '';
|
|
100
100
|
removeEventListener('pointermove', draggingPointerMove);
|
|
101
101
|
removeEventListener('pointerup', draggingPointerUp);
|