@pisell/materials 2.2.10 → 2.2.12
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +2 -2
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +14 -14
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +13 -13
- package/es/components/Pagination/index.d.ts +1 -1
- package/es/components/date-picker/index.js +2 -1
- package/es/components/drag-sort-tree/TreeItem/index.d.ts +4 -1
- package/es/components/drag-sort-tree/TreeItem/index.js +45 -31
- package/es/components/drag-sort-tree/TreeItem/index.less +44 -13
- package/es/components/drag-sort-tree/index.js +40 -16
- package/es/components/drag-sort-tree/types.d.ts +5 -1
- package/es/components/sort/index.d.ts +3 -3
- package/es/components/sort/index.js +28 -28
- package/es/components/table/BasicTable/index.d.ts +2 -2
- package/es/components/table/BasicTable/index.js +11 -10
- package/es/components/table/Table/fields/index.d.ts +31 -0
- package/es/components/table/Table/fields/index.js +5 -2
- package/es/components/table/Table/fields/oldRangePicker/Config/index.d.ts +3 -0
- package/es/components/table/Table/fields/oldRangePicker/Config/index.js +5 -0
- package/es/components/table/Table/fields/oldRangePicker/Edit/index.d.ts +4 -0
- package/es/components/table/Table/fields/oldRangePicker/Edit/index.js +106 -0
- package/es/components/table/Table/fields/oldRangePicker/Show/index.d.ts +4 -0
- package/es/components/table/Table/fields/oldRangePicker/Show/index.js +17 -0
- package/es/components/table/Table/fields/oldRangePicker/Sort/index.d.ts +3 -0
- package/es/components/table/Table/fields/oldRangePicker/Sort/index.js +5 -0
- package/es/components/table/Table/fields/oldRangePicker/filterUtil/index.d.ts +13 -0
- package/es/components/table/Table/fields/oldRangePicker/filterUtil/index.js +50 -0
- package/es/components/table/Table/fields/oldRangePicker/index.d.ts +16 -0
- package/es/components/table/Table/fields/oldRangePicker/index.js +19 -0
- package/es/components/table/Table/utils.js +1 -1
- package/es/locales/en-US.d.ts +1 -0
- package/es/locales/en-US.js +2 -1
- package/es/locales/zh-CN.d.ts +1 -0
- package/es/locales/zh-CN.js +2 -1
- package/es/locales/zh-TW.d.ts +1 -0
- package/es/locales/zh-TW.js +2 -1
- package/lib/components/Pagination/index.d.ts +1 -1
- package/lib/components/date-picker/index.js +1 -0
- package/lib/components/drag-sort-tree/TreeItem/index.d.ts +4 -1
- package/lib/components/drag-sort-tree/TreeItem/index.js +86 -29
- package/lib/components/drag-sort-tree/TreeItem/index.less +44 -13
- package/lib/components/drag-sort-tree/index.js +28 -13
- package/lib/components/drag-sort-tree/types.d.ts +5 -1
- package/lib/components/sort/index.d.ts +3 -3
- package/lib/components/sort/index.js +2 -2
- package/lib/components/table/BasicTable/index.d.ts +2 -2
- package/lib/components/table/BasicTable/index.js +6 -2
- package/lib/components/table/Table/fields/index.d.ts +31 -0
- package/lib/components/table/Table/fields/index.js +5 -2
- package/lib/components/table/Table/fields/oldRangePicker/Config/index.d.ts +3 -0
- package/lib/components/table/Table/fields/oldRangePicker/Config/index.js +39 -0
- package/lib/components/table/Table/fields/oldRangePicker/Edit/index.d.ts +4 -0
- package/lib/components/table/Table/fields/oldRangePicker/Edit/index.js +131 -0
- package/lib/components/table/Table/fields/oldRangePicker/Show/index.d.ts +4 -0
- package/lib/components/table/Table/fields/oldRangePicker/Show/index.js +48 -0
- package/lib/components/table/Table/fields/oldRangePicker/Sort/index.d.ts +3 -0
- package/lib/components/table/Table/fields/oldRangePicker/Sort/index.js +39 -0
- package/lib/components/table/Table/fields/oldRangePicker/filterUtil/index.d.ts +13 -0
- package/lib/components/table/Table/fields/oldRangePicker/filterUtil/index.js +61 -0
- package/lib/components/table/Table/fields/oldRangePicker/index.d.ts +16 -0
- package/lib/components/table/Table/fields/oldRangePicker/index.js +53 -0
- package/lib/components/table/Table/utils.js +1 -1
- package/lib/locales/en-US.d.ts +1 -0
- package/lib/locales/en-US.js +2 -1
- package/lib/locales/zh-CN.d.ts +1 -0
- package/lib/locales/zh-CN.js +2 -1
- package/lib/locales/zh-TW.d.ts +1 -0
- package/lib/locales/zh-TW.js +2 -1
- package/lowcode/date-picker.old-range-picker/__screenshots__/date-picker-range-picker-1.png +0 -0
- package/lowcode/date-picker.old-range-picker/__screenshots__/date-picker-range-picker-2.png +0 -0
- package/lowcode/date-picker.old-range-picker/__screenshots__/date-picker-range-picker-3.png +0 -0
- package/lowcode/date-picker.old-range-picker/__screenshots__/date-picker-range-picker-4.png +0 -0
- package/lowcode/date-picker.old-range-picker/meta.ts +305 -0
- package/lowcode/date-picker.old-range-picker/snippets.ts +11 -0
- package/lowcode/drag-sort-tree/meta.ts +10 -1
- package/lowcode/table/meta.ts +18 -0
- package/package.json +4 -4
|
@@ -5,7 +5,7 @@ export declare const paginationConfig: {
|
|
|
5
5
|
className: string;
|
|
6
6
|
defaultCurrent: number;
|
|
7
7
|
showTotal: (total: number, range: [number, number]) => string;
|
|
8
|
-
itemRender: (page: number, type: "
|
|
8
|
+
itemRender: (page: number, type: "next" | "page" | "prev" | "jump-prev" | "jump-next", element: React.ReactNode) => React.ReactNode;
|
|
9
9
|
responsive: boolean;
|
|
10
10
|
size: string;
|
|
11
11
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DatePicker as OriginalDatePicker } from 'antd';
|
|
2
2
|
import { withMomentProps } from "../../utils/hoc";
|
|
3
3
|
import dayjs from 'dayjs';
|
|
4
|
-
import { RangePicker } from "@pisell/date-picker";
|
|
4
|
+
import { RangePicker, OldPisellDateRangePicker } from "@pisell/date-picker";
|
|
5
5
|
import localeData from 'dayjs/plugin/localeData';
|
|
6
6
|
import weekday from 'dayjs/plugin/weekday';
|
|
7
7
|
dayjs.extend(weekday);
|
|
@@ -19,4 +19,5 @@ var DatePicker = withMomentProps(OriginalDatePicker, ['defaultPickerValue', 'def
|
|
|
19
19
|
// ]);
|
|
20
20
|
|
|
21
21
|
DatePicker.RangePicker = RangePicker;
|
|
22
|
+
DatePicker.OldRangePicker = OldPisellDateRangePicker;
|
|
22
23
|
export default DatePicker;
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './index.less';
|
|
3
3
|
import { ValueProps, SortType } from '../types';
|
|
4
|
+
declare type IdType = string | number;
|
|
4
5
|
declare type TreeItemProps = {
|
|
5
6
|
id: string | number;
|
|
6
7
|
key: string | number;
|
|
7
8
|
item: ValueProps | any;
|
|
8
9
|
depth: number;
|
|
9
10
|
lists: any[];
|
|
10
|
-
activeId?: string | null;
|
|
11
11
|
childrenProps?: SortType;
|
|
12
12
|
sensors?: any;
|
|
13
|
+
expandedKeys?: IdType[];
|
|
14
|
+
setExpandedKeys?: any;
|
|
15
|
+
onSelectKeys?: (ids: IdType) => void;
|
|
13
16
|
onChange?: (value: any[]) => void;
|
|
14
17
|
};
|
|
15
18
|
declare const TreeItem: (props: TreeItemProps) => React.JSX.Element;
|
|
@@ -18,8 +18,11 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
18
18
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
19
19
|
import { useSortable } from '@dnd-kit/sortable';
|
|
20
20
|
import { DndContext } from '@dnd-kit/core';
|
|
21
|
+
import { Tooltip } from 'antd';
|
|
22
|
+
import DotsSix from '@pisell/icon/es/DotsSix';
|
|
23
|
+
import { getText } from "../../../locales";
|
|
21
24
|
import { CSS } from '@dnd-kit/utilities';
|
|
22
|
-
import {
|
|
25
|
+
import { EyeOutlined, EyeInvisibleOutlined, WarningOutlined } from '@ant-design/icons';
|
|
23
26
|
import { SortableContext, verticalListSortingStrategy, arrayMove } from '@dnd-kit/sortable';
|
|
24
27
|
import { restrictToVerticalAxis, restrictToParentElement } from '@dnd-kit/modifiers';
|
|
25
28
|
import classNames from 'classnames';
|
|
@@ -29,15 +32,11 @@ var TreeItem = function TreeItem(props) {
|
|
|
29
32
|
var id = props.id,
|
|
30
33
|
item = props.item,
|
|
31
34
|
depth = props.depth,
|
|
32
|
-
activeId = props.activeId,
|
|
33
35
|
sensors = props.sensors,
|
|
34
36
|
childrenProps = props.childrenProps,
|
|
35
37
|
lists = props.lists,
|
|
38
|
+
expandedKeys = props.expandedKeys,
|
|
36
39
|
onChange = props.onChange;
|
|
37
|
-
var _useState = useState([]),
|
|
38
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
39
|
-
expandedKeys = _useState2[0],
|
|
40
|
-
setExpandedKeys = _useState2[1];
|
|
41
40
|
var _useSortable = useSortable({
|
|
42
41
|
id: id
|
|
43
42
|
}),
|
|
@@ -45,13 +44,12 @@ var TreeItem = function TreeItem(props) {
|
|
|
45
44
|
listeners = _useSortable.listeners,
|
|
46
45
|
setNodeRef = _useSortable.setNodeRef,
|
|
47
46
|
transform = _useSortable.transform,
|
|
48
|
-
transition = _useSortable.transition
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}, [activeId]);
|
|
47
|
+
transition = _useSortable.transition,
|
|
48
|
+
isDragging = _useSortable.isDragging;
|
|
49
|
+
var _useState = useState(window.innerWidth < 600),
|
|
50
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
51
|
+
isMobile = _useState2[0],
|
|
52
|
+
setIsMobile = _useState2[1];
|
|
55
53
|
var style = {
|
|
56
54
|
transform: CSS.Transform.toString(transform && _objectSpread(_objectSpread({}, transform), {}, {
|
|
57
55
|
scaleY: 1
|
|
@@ -70,7 +68,7 @@ var TreeItem = function TreeItem(props) {
|
|
|
70
68
|
var _active$id$split = active === null || active === void 0 ? void 0 : (_active$id = active.id) === null || _active$id === void 0 ? void 0 : _active$id.split('-'),
|
|
71
69
|
_active$id$split2 = _slicedToArray(_active$id$split, 2),
|
|
72
70
|
activeParentId = _active$id$split2[0],
|
|
73
|
-
|
|
71
|
+
activeId = _active$id$split2[1];
|
|
74
72
|
var _over$id$split = over === null || over === void 0 ? void 0 : (_over$id = over.id) === null || _over$id === void 0 ? void 0 : _over$id.split('-'),
|
|
75
73
|
_over$id$split2 = _slicedToArray(_over$id$split, 2),
|
|
76
74
|
overParentId = _over$id$split2[0],
|
|
@@ -78,9 +76,9 @@ var TreeItem = function TreeItem(props) {
|
|
|
78
76
|
var parentIndex = lists.findIndex(function (item) {
|
|
79
77
|
return item[rowKey] == activeParentId;
|
|
80
78
|
});
|
|
81
|
-
if (
|
|
79
|
+
if (activeId !== overId && activeParentId === overParentId && parentIndex !== -1) {
|
|
82
80
|
var activeIndex = item.children.findIndex(function (item) {
|
|
83
|
-
return item[rowKey] ==
|
|
81
|
+
return item[rowKey] == activeId;
|
|
84
82
|
});
|
|
85
83
|
var overIndex = item.children.findIndex(function (item) {
|
|
86
84
|
return item[rowKey] == overId;
|
|
@@ -122,14 +120,7 @@ var TreeItem = function TreeItem(props) {
|
|
|
122
120
|
var _item$children;
|
|
123
121
|
if (depth === 0 && (_item$children = item.children) !== null && _item$children !== void 0 && _item$children.length) {
|
|
124
122
|
var key = item[rowKey];
|
|
125
|
-
|
|
126
|
-
var _ids = expandedKeys.filter(function (id) {
|
|
127
|
-
return id !== key;
|
|
128
|
-
});
|
|
129
|
-
setExpandedKeys(_ids);
|
|
130
|
-
} else {
|
|
131
|
-
setExpandedKeys([].concat(_toConsumableArray(expandedKeys), [key]));
|
|
132
|
-
}
|
|
123
|
+
(childrenProps === null || childrenProps === void 0 ? void 0 : childrenProps.onHiddenChange) && (childrenProps === null || childrenProps === void 0 ? void 0 : childrenProps.onHiddenChange(key));
|
|
133
124
|
}
|
|
134
125
|
};
|
|
135
126
|
var renderChildren = useMemo(function () {
|
|
@@ -151,7 +142,7 @@ var TreeItem = function TreeItem(props) {
|
|
|
151
142
|
childrenProps: childrenProps
|
|
152
143
|
}) : null;
|
|
153
144
|
}));
|
|
154
|
-
}, [item.children, expandedKeys, rowKey, lists, childrenProps === null || childrenProps === void 0 ? void 0 : childrenProps.tabKey]);
|
|
145
|
+
}, [item.children, expandedKeys, rowKey, lists, childrenProps === null || childrenProps === void 0 ? void 0 : childrenProps.tabKey, isDragging]);
|
|
155
146
|
|
|
156
147
|
// 右侧图标
|
|
157
148
|
var rightIcon = useMemo(function () {
|
|
@@ -168,12 +159,29 @@ var TreeItem = function TreeItem(props) {
|
|
|
168
159
|
var hiddenWarningIcon = childrenProps === null || childrenProps === void 0 ? void 0 : childrenProps.hiddenWarningIcon;
|
|
169
160
|
return !hiddenWarningIcon && !(item !== null && item !== void 0 && item.is_available) ? /*#__PURE__*/React.createElement("div", {
|
|
170
161
|
className: classNames("".concat(prefix, "-drag-sort-tree-item-icon"))
|
|
162
|
+
}, /*#__PURE__*/React.createElement(Tooltip, {
|
|
163
|
+
title: getText('drag-sort-tree-unavailable-today-tip'),
|
|
164
|
+
color: "#ffffff",
|
|
165
|
+
overlayInnerStyle: {
|
|
166
|
+
color: '#344054'
|
|
167
|
+
}
|
|
171
168
|
}, /*#__PURE__*/React.createElement(WarningOutlined, {
|
|
172
169
|
style: {
|
|
173
|
-
color: '
|
|
170
|
+
color: '#FF2020'
|
|
174
171
|
}
|
|
175
|
-
})) : null;
|
|
172
|
+
}))) : null;
|
|
176
173
|
}, [childrenProps === null || childrenProps === void 0 ? void 0 : childrenProps.hiddenWarningIcon, item === null || item === void 0 ? void 0 : item.is_available]);
|
|
174
|
+
var handleWindowResize = function handleWindowResize() {
|
|
175
|
+
// 获取当前窗口的宽度
|
|
176
|
+
var windowWidth = window.innerWidth;
|
|
177
|
+
setIsMobile(windowWidth < 600);
|
|
178
|
+
};
|
|
179
|
+
useEffect(function () {
|
|
180
|
+
window.addEventListener('resize', handleWindowResize);
|
|
181
|
+
return function () {
|
|
182
|
+
window.removeEventListener('resize', handleWindowResize);
|
|
183
|
+
};
|
|
184
|
+
}, []);
|
|
177
185
|
return /*#__PURE__*/React.createElement(DndContext, {
|
|
178
186
|
sensors: sensors,
|
|
179
187
|
modifiers: [restrictToVerticalAxis, restrictToParentElement],
|
|
@@ -181,15 +189,21 @@ var TreeItem = function TreeItem(props) {
|
|
|
181
189
|
}, /*#__PURE__*/React.createElement("div", _extends({
|
|
182
190
|
ref: setNodeRef,
|
|
183
191
|
style: style
|
|
184
|
-
}, attributes, listeners), /*#__PURE__*/React.createElement("div", {
|
|
192
|
+
}, attributes, !isMobile ? listeners : {}), /*#__PURE__*/React.createElement("div", {
|
|
193
|
+
className: classNames("".concat(prefix, "-drag-sort-tree"), childrenProps === null || childrenProps === void 0 ? void 0 : childrenProps.className, isMobile ? "".concat(prefix, "-drag-sort-phone-tree") : ''),
|
|
185
194
|
style: {
|
|
186
|
-
paddingLeft: !depth ? '
|
|
195
|
+
paddingLeft: !depth ? '10px' : "".concat(depth * 40, "px"),
|
|
196
|
+
cursor: isDragging ? 'grabbing' : 'grab'
|
|
187
197
|
},
|
|
188
|
-
className: classNames("".concat(prefix, "-drag-sort-tree"), childrenProps === null || childrenProps === void 0 ? void 0 : childrenProps.className),
|
|
189
198
|
onClick: onSelect
|
|
190
199
|
}, /*#__PURE__*/React.createElement("div", {
|
|
191
200
|
className: classNames("".concat(prefix, "-drag-sort-tree-item"))
|
|
192
|
-
}, !(childrenProps !== null && childrenProps !== void 0 && childrenProps.hiddenDraggableIcon) ? /*#__PURE__*/React.createElement(
|
|
201
|
+
}, !(childrenProps !== null && childrenProps !== void 0 && childrenProps.hiddenDraggableIcon) ? /*#__PURE__*/React.createElement(DotsSix, _extends({}, isMobile ? listeners : {}, {
|
|
202
|
+
className: classNames("".concat(prefix, "-drag-sort-tree-item-dot-icon")),
|
|
203
|
+
style: {
|
|
204
|
+
left: isMobile ? !depth ? '-14px' : '12px' : 0
|
|
205
|
+
}
|
|
206
|
+
})) : null, /*#__PURE__*/React.createElement("div", {
|
|
193
207
|
className: "".concat(prefix, "-drag-sort-tree-title")
|
|
194
208
|
}, (childrenProps === null || childrenProps === void 0 ? void 0 : childrenProps.titleRender) || (item === null || item === void 0 ? void 0 : item.title))), !depth ? rightIcon : warningIcon), renderChildren));
|
|
195
209
|
};
|
|
@@ -5,38 +5,69 @@
|
|
|
5
5
|
display: flex;
|
|
6
6
|
align-items: center;
|
|
7
7
|
justify-content: space-between;
|
|
8
|
-
font-size:
|
|
9
|
-
cursor: pointer;
|
|
8
|
+
font-size: 14px;
|
|
10
9
|
touch-action: none !important;
|
|
11
10
|
width: 100%;
|
|
12
11
|
color: #101828;
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
padding: 9px 10px;
|
|
13
|
+
height: auto;
|
|
14
|
+
position: relative;
|
|
15
|
+
display: flex;
|
|
16
|
+
&:hover {
|
|
17
|
+
background: #F9FAFB;
|
|
18
|
+
border-radius: 6px;
|
|
19
|
+
}
|
|
15
20
|
}
|
|
16
21
|
|
|
17
|
-
&-drag-sort-tree
|
|
18
|
-
|
|
19
|
-
border-radius: 6px;
|
|
22
|
+
&-drag-sort-tree-item{
|
|
23
|
+
flex: 1;
|
|
20
24
|
}
|
|
21
25
|
|
|
22
26
|
&-drag-sort-tree-item {
|
|
23
27
|
display: flex;
|
|
24
28
|
align-items: center;
|
|
25
29
|
}
|
|
26
|
-
|
|
30
|
+
|
|
27
31
|
&-drag-sort-tree &-drag-sort-tree-title {
|
|
28
32
|
margin-left: 10px;
|
|
29
33
|
font-size: 14px;
|
|
34
|
+
line-height: 20px;
|
|
35
|
+
margin-right: 30px;
|
|
30
36
|
}
|
|
31
37
|
|
|
32
38
|
&-drag-sort-tree-icon,
|
|
33
|
-
&-drag-sort-tree-item-icon
|
|
34
|
-
|
|
35
|
-
width: 30px;
|
|
39
|
+
&-drag-sort-tree-item-icon,
|
|
40
|
+
&-drag-sort-tree-item-dot-icon {
|
|
36
41
|
display: flex;
|
|
37
42
|
align-items: center;
|
|
38
43
|
justify-content: center;
|
|
39
44
|
}
|
|
40
|
-
}
|
|
41
45
|
|
|
42
|
-
|
|
46
|
+
&-drag-sort-tree-icon,
|
|
47
|
+
&-drag-sort-tree-item-icon{
|
|
48
|
+
height: 40px;
|
|
49
|
+
width: 40px;
|
|
50
|
+
position: absolute;
|
|
51
|
+
right: 0;
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&-drag-sort-tree-icon{
|
|
56
|
+
cursor: pointer;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
&-drag-sort-tree-item-dot-icon{
|
|
60
|
+
height: 20px;
|
|
61
|
+
width: 20px;
|
|
62
|
+
color: #344054;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// 移动端
|
|
66
|
+
&-drag-sort-phone-tree &-drag-sort-tree-item-dot-icon {
|
|
67
|
+
position: absolute;
|
|
68
|
+
color: #344054;
|
|
69
|
+
top: 0;
|
|
70
|
+
width: 40px;
|
|
71
|
+
height: 40px;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
4
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
1
5
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
6
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
7
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -14,15 +18,26 @@ var DragSortTree = function DragSortTree(props) {
|
|
|
14
18
|
var value = props.value,
|
|
15
19
|
rowKey = props.rowKey,
|
|
16
20
|
tabKey = props.tabKey,
|
|
21
|
+
hiddenKeys = props.hiddenKeys,
|
|
17
22
|
onChange = props.onChange;
|
|
18
23
|
var _useState = useState(value || []),
|
|
19
24
|
_useState2 = _slicedToArray(_useState, 2),
|
|
20
25
|
items = _useState2[0],
|
|
21
26
|
setItems = _useState2[1];
|
|
22
|
-
var _useState3 = useState(
|
|
27
|
+
var _useState3 = useState([]),
|
|
23
28
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
24
|
-
|
|
25
|
-
|
|
29
|
+
expandedKeys = _useState4[0],
|
|
30
|
+
setExpandedKeys = _useState4[1];
|
|
31
|
+
useEffect(function () {
|
|
32
|
+
var keys = value === null || value === void 0 ? void 0 : value.map(function (item) {
|
|
33
|
+
return item[rowKey];
|
|
34
|
+
});
|
|
35
|
+
// 过滤需要折叠起来的key
|
|
36
|
+
keys = keys.filter(function (key) {
|
|
37
|
+
return hiddenKeys !== null && hiddenKeys !== void 0 && hiddenKeys.length ? !hiddenKeys.includes(key) : key;
|
|
38
|
+
});
|
|
39
|
+
setExpandedKeys(_toConsumableArray(keys));
|
|
40
|
+
}, [hiddenKeys]);
|
|
26
41
|
useEffect(function () {
|
|
27
42
|
// 防止切换的时候数据不更新,拖拽之后,如果切换tab,需要用更新之后的数据
|
|
28
43
|
setItems(value || []);
|
|
@@ -33,25 +48,33 @@ var DragSortTree = function DragSortTree(props) {
|
|
|
33
48
|
}
|
|
34
49
|
}));
|
|
35
50
|
var handleDragStart = function handleDragStart(event) {
|
|
51
|
+
var _active$id, _active$id$split;
|
|
36
52
|
var active = event.active;
|
|
37
|
-
|
|
53
|
+
var activeId = active === null || active === void 0 ? void 0 : (_active$id = active.id) === null || _active$id === void 0 ? void 0 : (_active$id$split = _active$id.split('-')) === null || _active$id$split === void 0 ? void 0 : _active$id$split[1];
|
|
54
|
+
var _keys = expandedKeys === null || expandedKeys === void 0 ? void 0 : expandedKeys.filter(function (key) {
|
|
55
|
+
return key != activeId;
|
|
56
|
+
});
|
|
57
|
+
setExpandedKeys(_toConsumableArray(_keys));
|
|
38
58
|
};
|
|
39
59
|
var handleDragEnd = function handleDragEnd(event) {
|
|
40
60
|
var active = event.active,
|
|
41
61
|
over = event.over;
|
|
42
|
-
|
|
43
|
-
// 拖拽结束将这个值设置为空,防止第二次拖拽同一个节点,监听不到这个变化
|
|
44
|
-
setActiveId(null);
|
|
45
62
|
if (!over || !active) return;
|
|
46
63
|
try {
|
|
47
|
-
var
|
|
48
|
-
var
|
|
49
|
-
|
|
64
|
+
var _active$id2, _active$id2$split, _over$id, _over$id$split;
|
|
65
|
+
var activeId = active === null || active === void 0 ? void 0 : (_active$id2 = active.id) === null || _active$id2 === void 0 ? void 0 : (_active$id2$split = _active$id2.split('-')) === null || _active$id2$split === void 0 ? void 0 : _active$id2$split[1];
|
|
66
|
+
var overId = over === null || over === void 0 ? void 0 : (_over$id = over.id) === null || _over$id === void 0 ? void 0 : (_over$id$split = _over$id.split('-')) === null || _over$id$split === void 0 ? void 0 : _over$id$split[1];
|
|
67
|
+
if (activeId !== overId) {
|
|
68
|
+
// 如果没有自动点击折叠则拖动结束再次打开
|
|
69
|
+
if (!(hiddenKeys !== null && hiddenKeys !== void 0 && hiddenKeys.includes(Number(activeId)))) {
|
|
70
|
+
var _keys = [].concat(_toConsumableArray(expandedKeys), [Number(activeId)]);
|
|
71
|
+
setExpandedKeys(_toConsumableArray(_keys));
|
|
72
|
+
}
|
|
50
73
|
var activeIndex = items.findIndex(function (item) {
|
|
51
|
-
return item[rowKey]
|
|
74
|
+
return item[rowKey] == activeId;
|
|
52
75
|
});
|
|
53
76
|
var overIndex = items.findIndex(function (item) {
|
|
54
|
-
return item[rowKey]
|
|
77
|
+
return item[rowKey] == overId;
|
|
55
78
|
});
|
|
56
79
|
var _lists = arrayMove(items, activeIndex, overIndex);
|
|
57
80
|
handleChange(_lists);
|
|
@@ -71,19 +94,20 @@ var DragSortTree = function DragSortTree(props) {
|
|
|
71
94
|
modifiers: [restrictToVerticalAxis, restrictToParentElement]
|
|
72
95
|
}, /*#__PURE__*/React.createElement(SortableContext, {
|
|
73
96
|
items: items.map(function (item) {
|
|
74
|
-
return item[rowKey];
|
|
97
|
+
return "0-".concat(item[rowKey]);
|
|
75
98
|
}),
|
|
76
99
|
strategy: verticalListSortingStrategy
|
|
77
100
|
}, items.map(function (item) {
|
|
78
101
|
return /*#__PURE__*/React.createElement(TreeItem, {
|
|
79
|
-
key: item[rowKey],
|
|
80
|
-
id: item[rowKey],
|
|
102
|
+
key: "0-".concat(item[rowKey]),
|
|
103
|
+
id: "0-".concat(item[rowKey]),
|
|
81
104
|
item: item,
|
|
82
105
|
depth: 0,
|
|
83
106
|
sensors: sensors,
|
|
84
|
-
activeId: activeId,
|
|
85
107
|
childrenProps: props,
|
|
86
108
|
lists: items,
|
|
109
|
+
expandedKeys: expandedKeys,
|
|
110
|
+
setExpandedKeys: setExpandedKeys,
|
|
87
111
|
onChange: handleChange
|
|
88
112
|
});
|
|
89
113
|
}))));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
declare type IdType = string | number;
|
|
2
3
|
export declare type ValueProps = {
|
|
3
|
-
id:
|
|
4
|
+
id: IdType;
|
|
4
5
|
title: string;
|
|
5
6
|
show?: boolean;
|
|
6
7
|
is_available?: boolean;
|
|
@@ -16,5 +17,8 @@ export declare type SortType = {
|
|
|
16
17
|
hiddenRightIcon?: boolean;
|
|
17
18
|
hiddenWarningIcon?: boolean;
|
|
18
19
|
tabKey?: string;
|
|
20
|
+
hiddenKeys?: IdType[];
|
|
21
|
+
onHiddenChange?: (value: IdType[]) => void;
|
|
19
22
|
onChange?: (value: ValueProps[]) => void;
|
|
20
23
|
};
|
|
24
|
+
export {};
|
|
@@ -2,16 +2,16 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2
2
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3
3
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
4
4
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
5
|
-
import React, { useMemo } from
|
|
6
|
-
import { Button, Dropdown, Popover } from
|
|
7
|
-
import classNames from
|
|
8
|
-
import { CheckOutlined } from
|
|
9
|
-
import SwitchVertical01 from
|
|
5
|
+
import React, { useMemo } from 'react';
|
|
6
|
+
import { Button, Dropdown, Popover } from 'antd';
|
|
7
|
+
import classNames from 'classnames';
|
|
8
|
+
import { CheckOutlined } from '@ant-design/icons';
|
|
9
|
+
import SwitchVertical01 from '@pisell/icon/es/SwitchVertical01';
|
|
10
10
|
import { isMobile } from "../../utils/platform";
|
|
11
11
|
import { getText } from "../../locales";
|
|
12
12
|
import InlineMenu from "./components/InlineMenu";
|
|
13
13
|
import "./index.less";
|
|
14
|
-
var prefix =
|
|
14
|
+
var prefix = 'pisell-lowcode-';
|
|
15
15
|
var Label = function Label(_ref) {
|
|
16
16
|
var content = _ref.content;
|
|
17
17
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -21,53 +21,53 @@ var Label = function Label(_ref) {
|
|
|
21
21
|
var sortChildrenMap = {
|
|
22
22
|
date: function date(key, isLocal) {
|
|
23
23
|
return [{
|
|
24
|
-
key: "".concat(key, ":
|
|
24
|
+
key: "".concat(key, ":asc").concat(isLocal ? ':date' : ''),
|
|
25
25
|
label: /*#__PURE__*/React.createElement(Label, {
|
|
26
|
-
content: getText(
|
|
26
|
+
content: getText('sort-oldest-to-newest')
|
|
27
27
|
})
|
|
28
28
|
}, {
|
|
29
|
-
key: "".concat(key, ":
|
|
29
|
+
key: "".concat(key, ":desc").concat(isLocal ? ':date' : ''),
|
|
30
30
|
label: /*#__PURE__*/React.createElement(Label, {
|
|
31
|
-
content: getText(
|
|
31
|
+
content: getText('sort-newest-to-oldest')
|
|
32
32
|
})
|
|
33
33
|
}];
|
|
34
34
|
},
|
|
35
35
|
time: function time(key, isLocal) {
|
|
36
36
|
return [{
|
|
37
|
-
key: "".concat(key, ":desc").concat(isLocal ?
|
|
37
|
+
key: "".concat(key, ":desc").concat(isLocal ? ':time' : ''),
|
|
38
38
|
label: /*#__PURE__*/React.createElement(Label, {
|
|
39
|
-
content: getText(
|
|
39
|
+
content: getText('sort-from-morning-to-night')
|
|
40
40
|
})
|
|
41
41
|
}, {
|
|
42
|
-
key: "".concat(key, ":asc").concat(isLocal ?
|
|
42
|
+
key: "".concat(key, ":asc").concat(isLocal ? ':time' : ''),
|
|
43
43
|
label: /*#__PURE__*/React.createElement(Label, {
|
|
44
|
-
content: getText(
|
|
44
|
+
content: getText('sort-from-evening-to-morning')
|
|
45
45
|
})
|
|
46
46
|
}];
|
|
47
47
|
},
|
|
48
48
|
string: function string(key, isLocal) {
|
|
49
49
|
return [{
|
|
50
|
-
key: "".concat(key, ":asc").concat(isLocal ?
|
|
50
|
+
key: "".concat(key, ":asc").concat(isLocal ? ':string' : ''),
|
|
51
51
|
label: /*#__PURE__*/React.createElement(Label, {
|
|
52
|
-
content: getText(
|
|
52
|
+
content: getText('sort-a-z')
|
|
53
53
|
})
|
|
54
54
|
}, {
|
|
55
|
-
key: "".concat(key, ":desc").concat(isLocal ?
|
|
55
|
+
key: "".concat(key, ":desc").concat(isLocal ? ':string' : ''),
|
|
56
56
|
label: /*#__PURE__*/React.createElement(Label, {
|
|
57
|
-
content: getText(
|
|
57
|
+
content: getText('sort-z-a')
|
|
58
58
|
})
|
|
59
59
|
}];
|
|
60
60
|
},
|
|
61
61
|
number: function number(key, isLocal) {
|
|
62
62
|
return [{
|
|
63
|
-
key: "".concat(key, ":asc").concat(isLocal ?
|
|
63
|
+
key: "".concat(key, ":asc").concat(isLocal ? ':number' : ''),
|
|
64
64
|
label: /*#__PURE__*/React.createElement(Label, {
|
|
65
|
-
content: getText(
|
|
65
|
+
content: getText('sort-0-9')
|
|
66
66
|
})
|
|
67
67
|
}, {
|
|
68
|
-
key: "".concat(key, ":desc").concat(isLocal ?
|
|
68
|
+
key: "".concat(key, ":desc").concat(isLocal ? ':number' : ''),
|
|
69
69
|
label: /*#__PURE__*/React.createElement(Label, {
|
|
70
|
-
content: getText(
|
|
70
|
+
content: getText('sort-9-0')
|
|
71
71
|
})
|
|
72
72
|
}];
|
|
73
73
|
}
|
|
@@ -89,14 +89,14 @@ var Sort = function Sort(_ref2) {
|
|
|
89
89
|
children: sortChildrenMap[d.type](d.name, !!(d !== null && d !== void 0 && d.localFilter)),
|
|
90
90
|
popupClassName: "".concat(prefix, "sort-sub-menu-popup-wrap"),
|
|
91
91
|
// 增加显示隐藏配置
|
|
92
|
-
className: "".concat(d.isHidden ? "".concat(prefix, "sort-menu-wrap-hide") :
|
|
92
|
+
className: "".concat(d.isHidden ? "".concat(prefix, "sort-menu-wrap-hide") : '')
|
|
93
93
|
};
|
|
94
94
|
});
|
|
95
95
|
}, [list, localPagination]);
|
|
96
96
|
var onClick = function onClick(detail) {
|
|
97
97
|
var _detail$keyPath, _detail$keyPath2;
|
|
98
98
|
if (((_detail$keyPath = detail.keyPath) === null || _detail$keyPath === void 0 ? void 0 : _detail$keyPath[0]) === value) {
|
|
99
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(
|
|
99
|
+
onChange === null || onChange === void 0 ? void 0 : onChange('', detail);
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
102
102
|
onChange === null || onChange === void 0 ? void 0 : onChange(detail === null || detail === void 0 ? void 0 : (_detail$keyPath2 = detail.keyPath) === null || _detail$keyPath2 === void 0 ? void 0 : _detail$keyPath2[0], detail);
|
|
@@ -108,12 +108,12 @@ var Sort = function Sort(_ref2) {
|
|
|
108
108
|
style: style,
|
|
109
109
|
className: classNames(_defineProperty({}, "".concat(prefix, "sort-button-active"), !!value)),
|
|
110
110
|
size: "large"
|
|
111
|
-
}, isMobileBool ? null : getText(
|
|
111
|
+
}, isMobileBool ? null : getText('sort-button-text'));
|
|
112
112
|
}, [button, style, value, isMobileBool]);
|
|
113
113
|
var content = useMemo(function () {
|
|
114
114
|
return /*#__PURE__*/React.createElement(InlineMenu, {
|
|
115
115
|
items: sortItems,
|
|
116
|
-
value: value ||
|
|
116
|
+
value: value || '',
|
|
117
117
|
onChange: onChange
|
|
118
118
|
});
|
|
119
119
|
}, [value, sortItems, onChange]);
|
|
@@ -123,11 +123,11 @@ var Sort = function Sort(_ref2) {
|
|
|
123
123
|
content: content,
|
|
124
124
|
arrow: false,
|
|
125
125
|
overlayClassName: "".concat(prefix, "mobile-sort-overlay"),
|
|
126
|
-
trigger: [
|
|
126
|
+
trigger: ['click']
|
|
127
127
|
}, btnContent);
|
|
128
128
|
}
|
|
129
129
|
return /*#__PURE__*/React.createElement(Dropdown, {
|
|
130
|
-
trigger: [
|
|
130
|
+
trigger: ['click'],
|
|
131
131
|
placement: placement,
|
|
132
132
|
menu: {
|
|
133
133
|
items: sortItems,
|
|
@@ -14,13 +14,13 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
|
|
|
14
14
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
15
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
16
16
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
17
|
-
import { Table, Form } from
|
|
18
|
-
import React, { useState, useMemo, useCallback, useEffect } from
|
|
17
|
+
import { Table, Form } from 'antd';
|
|
18
|
+
import React, { useState, useMemo, useCallback, useEffect } from 'react';
|
|
19
19
|
import { FormPagination } from "../../Pagination";
|
|
20
20
|
import { calcFilterSort } from "../Table/utils";
|
|
21
21
|
import { useSharedState } from "../../../hooks";
|
|
22
22
|
import { Context } from "../model";
|
|
23
|
-
import { isArr } from
|
|
23
|
+
import { isArr } from '@pisell/utils';
|
|
24
24
|
var BasicTable = function BasicTable(props) {
|
|
25
25
|
var _pagination$pageSizeO;
|
|
26
26
|
var dataSource = props.dataSource,
|
|
@@ -37,14 +37,14 @@ var BasicTable = function BasicTable(props) {
|
|
|
37
37
|
sort = _useState4[0],
|
|
38
38
|
setSort = _useState4[1];
|
|
39
39
|
var form = Form.useFormInstance();
|
|
40
|
-
var formPagination = Form.useWatch(
|
|
40
|
+
var formPagination = Form.useWatch('pagination', {
|
|
41
41
|
form: form,
|
|
42
42
|
preserve: true
|
|
43
43
|
}) || {
|
|
44
44
|
page: 1,
|
|
45
45
|
size: 10
|
|
46
46
|
};
|
|
47
|
-
var group = Form.useWatch(
|
|
47
|
+
var group = Form.useWatch('group_by', {
|
|
48
48
|
form: form,
|
|
49
49
|
preserve: true
|
|
50
50
|
});
|
|
@@ -84,6 +84,7 @@ var BasicTable = function BasicTable(props) {
|
|
|
84
84
|
total: _total
|
|
85
85
|
};
|
|
86
86
|
}, [localPagination, dataSource, formPagination === null || formPagination === void 0 ? void 0 : formPagination.page, formPagination === null || formPagination === void 0 ? void 0 : formPagination.size, filter, sort, other.columns]);
|
|
87
|
+
console.log(pagination, 'wh8888');
|
|
87
88
|
|
|
88
89
|
// 总数
|
|
89
90
|
var total = useMemo(function () {
|
|
@@ -99,19 +100,19 @@ var BasicTable = function BasicTable(props) {
|
|
|
99
100
|
var _expandedRowKeys = [];
|
|
100
101
|
_dataSource === null || _dataSource === void 0 ? void 0 : (_dataSource$list = _dataSource.list) === null || _dataSource$list === void 0 ? void 0 : _dataSource$list.forEach(function (item) {
|
|
101
102
|
if (item.__is_group) {
|
|
102
|
-
_expandedRowKeys.push(item[
|
|
103
|
+
_expandedRowKeys.push(item['__rowKey']);
|
|
103
104
|
}
|
|
104
105
|
});
|
|
105
106
|
return _expandedRowKeys;
|
|
106
107
|
}, [_dataSource === null || _dataSource === void 0 ? void 0 : _dataSource.list]);
|
|
107
108
|
useEffect(function () {
|
|
108
109
|
dispatch({
|
|
109
|
-
type:
|
|
110
|
+
type: 'setCurrentDataSource',
|
|
110
111
|
payload: (_dataSource === null || _dataSource === void 0 ? void 0 : _dataSource.list) || []
|
|
111
112
|
});
|
|
112
113
|
}, [_dataSource === null || _dataSource === void 0 ? void 0 : _dataSource.list]);
|
|
113
114
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Table, _extends({
|
|
114
|
-
key: defaultExpandedRowKeys.join(
|
|
115
|
+
key: defaultExpandedRowKeys.join('-')
|
|
115
116
|
}, other, {
|
|
116
117
|
// 开启分组条件后关闭行选择功能
|
|
117
118
|
rowSelection: isGroup ? false : other === null || other === void 0 ? void 0 : other.rowSelection,
|
|
@@ -132,13 +133,13 @@ var BasicTable = function BasicTable(props) {
|
|
|
132
133
|
return _objectSpread(_objectSpread({}, (other === null || other === void 0 ? void 0 : (_other$onRow = other.onRow) === null || _other$onRow === void 0 ? void 0 : _other$onRow.call(other, record, index)) || {}), {}, {
|
|
133
134
|
__is_group: record.__is_group,
|
|
134
135
|
__is_drag_sort: other.dragSort,
|
|
135
|
-
className: record.__is_group ?
|
|
136
|
+
className: record.__is_group ? 'pisell-lowcode-table-group-row-wrap' : ''
|
|
136
137
|
});
|
|
137
138
|
},
|
|
138
139
|
expandable: {
|
|
139
140
|
defaultExpandAllRows: true
|
|
140
141
|
}
|
|
141
|
-
})), total > ((pagination === null || pagination === void 0 ? void 0 : pagination.pageSize) || (pagination === null || pagination === void 0 ? void 0 : (_pagination$pageSizeO = pagination.pageSizeOptions) === null || _pagination$pageSizeO === void 0 ? void 0 : _pagination$pageSizeO[0]) || 10) ? /*#__PURE__*/React.createElement(Form.Item, {
|
|
142
|
+
})), total > ((pagination === null || pagination === void 0 ? void 0 : pagination.pageSize) || (pagination === null || pagination === void 0 ? void 0 : (_pagination$pageSizeO = pagination.pageSizeOptions) === null || _pagination$pageSizeO === void 0 ? void 0 : _pagination$pageSizeO[0]) || 10) || pagination !== null && pagination !== void 0 && pagination.showPagination && total > 10 ? /*#__PURE__*/React.createElement(Form.Item, {
|
|
142
143
|
name: "pagination"
|
|
143
144
|
}, /*#__PURE__*/React.createElement(FormPagination, _extends({}, pagination, {
|
|
144
145
|
showTotal: _showTotal,
|