@pisell/materials 2.2.6 → 2.2.8
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 +11 -11
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +13 -13
- package/es/components/drag-sort-tree/TreeItem/index.d.ts +16 -0
- package/es/components/drag-sort-tree/TreeItem/index.js +196 -0
- package/es/components/drag-sort-tree/TreeItem/index.less +41 -0
- package/es/components/drag-sort-tree/index.d.ts +5 -0
- package/es/components/drag-sort-tree/index.js +91 -0
- package/es/components/drag-sort-tree/index.less +4 -0
- package/es/components/drag-sort-tree/types.d.ts +20 -0
- package/es/components/drag-sort-tree/types.js +1 -0
- package/es/components/drawer/index.d.ts +1 -1
- package/es/components/drawer/index.js +23 -17
- package/es/components/drawer/index.less +25 -1
- package/es/components/table/Actions/component/ColumnsSetting/PopoverContent.less +2 -1
- package/es/components/table/BasicTable/index.js +5 -2
- package/es/components/tabs/index.d.ts +4 -4
- package/es/components/tabs/index.js +10 -9
- package/es/index.d.ts +81 -80
- package/es/index.js +40 -39
- package/lib/components/drag-sort-tree/TreeItem/index.d.ts +16 -0
- package/lib/components/drag-sort-tree/TreeItem/index.js +183 -0
- package/lib/components/drag-sort-tree/TreeItem/index.less +41 -0
- package/lib/components/drag-sort-tree/index.d.ts +5 -0
- package/lib/components/drag-sort-tree/index.js +115 -0
- package/lib/components/drag-sort-tree/index.less +4 -0
- package/lib/components/drag-sort-tree/types.d.ts +20 -0
- package/lib/components/drag-sort-tree/types.js +17 -0
- package/lib/components/drawer/index.d.ts +1 -1
- package/lib/components/drawer/index.js +4 -1
- package/lib/components/drawer/index.less +25 -1
- package/lib/components/table/Actions/component/ColumnsSetting/PopoverContent.less +2 -1
- package/lib/components/table/BasicTable/index.js +2 -2
- package/lib/components/tabs/index.d.ts +4 -4
- package/lib/components/tabs/index.js +3 -1
- package/lib/index.d.ts +81 -80
- package/lib/index.js +3 -0
- package/lowcode/drag-sort-tree/__screenshots__/drag-sort-tree.png +0 -0
- package/lowcode/drag-sort-tree/meta.ts +108 -0
- package/lowcode/drag-sort-tree/snippets.ts +57 -0
- package/lowcode/tabs/meta.ts +9 -0
- package/package.json +2 -2
|
@@ -18,12 +18,12 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
18
18
|
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; }
|
|
19
19
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
20
20
|
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); }
|
|
21
|
-
import React, { Component } from
|
|
22
|
-
import { Badge, Tabs as OriginalTabs } from
|
|
21
|
+
import React, { Component } from 'react';
|
|
22
|
+
import { Badge, Tabs as OriginalTabs } from 'antd';
|
|
23
23
|
import { warning } from "../../utils/warning";
|
|
24
|
-
import classNames from
|
|
24
|
+
import classNames from 'classnames';
|
|
25
25
|
import "./index.less";
|
|
26
|
-
var prefix =
|
|
26
|
+
var prefix = 'pisell-lowcode-';
|
|
27
27
|
var Tabs = /*#__PURE__*/function (_Component) {
|
|
28
28
|
_inherits(Tabs, _Component);
|
|
29
29
|
var _super = _createSuper(Tabs);
|
|
@@ -53,19 +53,20 @@ var Tabs = /*#__PURE__*/function (_Component) {
|
|
|
53
53
|
return _this.state.activeKey;
|
|
54
54
|
});
|
|
55
55
|
_defineProperty(_assertThisInitialized(_this), "renderIconLabelTabBar", function (props, DefaultTabBar) {
|
|
56
|
+
var _this$props2;
|
|
56
57
|
var _this$props = _this.props,
|
|
57
58
|
items = _this$props.items,
|
|
58
59
|
sidebarWidth = _this$props.sidebarWidth;
|
|
59
60
|
var wrapStyle = {
|
|
60
61
|
gap: props.tabBarGutter
|
|
61
62
|
};
|
|
62
|
-
if ([
|
|
63
|
+
if (['left', 'right'].includes(props.tabPosition)) {
|
|
63
64
|
wrapStyle = _objectSpread(_objectSpread({}, wrapStyle), {}, {
|
|
64
65
|
width: sidebarWidth || 130
|
|
65
66
|
});
|
|
66
67
|
}
|
|
67
68
|
return /*#__PURE__*/React.createElement("div", {
|
|
68
|
-
className: classNames(
|
|
69
|
+
className: classNames('pisell-lowcode-tabs-nav', "".concat(prefix, "tab-bar-wrap"), "".concat(prefix, "tab-bar-wrap-").concat(props.tabPosition), (_this$props2 = _this.props) === null || _this$props2 === void 0 ? void 0 : _this$props2.className),
|
|
69
70
|
style: wrapStyle
|
|
70
71
|
}, _this.filterHiddenTabs(items).map(function (item) {
|
|
71
72
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -104,7 +105,7 @@ var Tabs = /*#__PURE__*/function (_Component) {
|
|
|
104
105
|
// props.items 存在,只认 props.items
|
|
105
106
|
// 兼容代码:props.children 反推 props.items
|
|
106
107
|
if (!props.items && Array.isArray(children) && children.length > 0) {
|
|
107
|
-
warning(
|
|
108
|
+
warning('Tabs.TabPane is deprecated. Please use `items` directly.');
|
|
108
109
|
items = children.map(function (node) {
|
|
109
110
|
if ( /*#__PURE__*/React.isValidElement(node)) {
|
|
110
111
|
var key = node.key,
|
|
@@ -123,10 +124,10 @@ var Tabs = /*#__PURE__*/function (_Component) {
|
|
|
123
124
|
}).filter(Boolean);
|
|
124
125
|
}
|
|
125
126
|
items = this.filterHiddenTabs(items);
|
|
126
|
-
if (type ===
|
|
127
|
+
if (type === 'icon-label') {
|
|
127
128
|
otherProps = {
|
|
128
129
|
renderTabBar: this.renderIconLabelTabBar,
|
|
129
|
-
type:
|
|
130
|
+
type: 'line'
|
|
130
131
|
};
|
|
131
132
|
}
|
|
132
133
|
return /*#__PURE__*/React.createElement(OriginalTabs, _extends({}, props, otherProps, {
|
package/es/index.d.ts
CHANGED
|
@@ -1,80 +1,81 @@
|
|
|
1
|
-
export { Affix } from
|
|
2
|
-
export { Anchor } from
|
|
3
|
-
export { Alert } from
|
|
4
|
-
export { Avatar } from
|
|
5
|
-
export { Badge } from
|
|
6
|
-
export { Breadcrumb } from
|
|
7
|
-
export { Card } from
|
|
8
|
-
export { Collapse } from
|
|
9
|
-
export { Carousel } from
|
|
10
|
-
export { Col } from
|
|
11
|
-
export { Descriptions } from
|
|
12
|
-
export { Divider } from
|
|
13
|
-
export { Empty } from
|
|
14
|
-
export { Grid } from
|
|
15
|
-
export { Image } from
|
|
16
|
-
export { InputNumber } from
|
|
17
|
-
export { message } from
|
|
18
|
-
export { Menu } from
|
|
19
|
-
export { Mentions } from
|
|
20
|
-
export { Statistic } from
|
|
21
|
-
export { notification } from
|
|
22
|
-
export { Pagination } from
|
|
23
|
-
export { Popconfirm } from
|
|
24
|
-
export { Popover } from
|
|
25
|
-
export { Progress } from
|
|
26
|
-
export { Rate } from
|
|
27
|
-
export { Result } from
|
|
28
|
-
export { Row } from
|
|
29
|
-
export { Space } from
|
|
30
|
-
export { Spin } from
|
|
31
|
-
export { Steps } from
|
|
32
|
-
export { Switch } from
|
|
33
|
-
export { Transfer } from
|
|
34
|
-
export { Tree } from
|
|
35
|
-
export { Tag } from
|
|
36
|
-
export { Timeline } from
|
|
37
|
-
export { Tooltip } from
|
|
38
|
-
export { version } from
|
|
39
|
-
export { default as Typography } from
|
|
40
|
-
export { default as Skeleton } from
|
|
41
|
-
export { default as Checkbox } from
|
|
42
|
-
export { default as Button } from
|
|
43
|
-
export { default as Radio } from
|
|
44
|
-
export { default as Upload } from
|
|
45
|
-
export { default as Icon } from
|
|
46
|
-
export { default as Form } from
|
|
47
|
-
export { default as Dropdown } from
|
|
48
|
-
export { default as Calendar } from
|
|
49
|
-
export { default as ConfigProvider } from
|
|
50
|
-
export { default as DatePicker } from
|
|
51
|
-
export { default as Tabs } from
|
|
52
|
-
export { default as TimePicker } from
|
|
53
|
-
export { default as Slider } from
|
|
54
|
-
export { default as Table } from
|
|
55
|
-
export { default as Modal } from
|
|
56
|
-
export { default as Drawer } from
|
|
57
|
-
export { default as TreeSelect } from
|
|
58
|
-
export { default as Input } from
|
|
59
|
-
export { default as Select } from
|
|
60
|
-
export { default as Cascader } from
|
|
61
|
-
export { default as AutoComplete } from
|
|
62
|
-
export { default as Div } from
|
|
63
|
-
export { default as Page } from
|
|
64
|
-
export { default as Component } from
|
|
65
|
-
export { default as Filter } from
|
|
66
|
-
export { default as Translation } from
|
|
67
|
-
export { default as SortableList } from
|
|
68
|
-
export { default as RecordView } from
|
|
69
|
-
export { default as QRCode } from
|
|
70
|
-
export { default as ClassicLayout } from
|
|
71
|
-
export { default as List } from
|
|
72
|
-
export { default as Sort } from
|
|
73
|
-
export { default as InputNumberRange } from
|
|
74
|
-
export { default as LowCodePage } from
|
|
75
|
-
export { default as Segmented } from
|
|
76
|
-
export { default as VirtualKeyboard } from
|
|
77
|
-
export { default as VirtualKeyboardTime } from
|
|
78
|
-
export { default as SelectTime } from
|
|
79
|
-
export { default as AutoCompleteNumber } from
|
|
80
|
-
export { default as BatchEditor } from
|
|
1
|
+
export { Affix } from 'antd';
|
|
2
|
+
export { Anchor } from 'antd';
|
|
3
|
+
export { Alert } from 'antd';
|
|
4
|
+
export { Avatar } from 'antd';
|
|
5
|
+
export { Badge } from 'antd';
|
|
6
|
+
export { Breadcrumb } from 'antd';
|
|
7
|
+
export { Card } from 'antd';
|
|
8
|
+
export { Collapse } from 'antd';
|
|
9
|
+
export { Carousel } from 'antd';
|
|
10
|
+
export { Col } from 'antd';
|
|
11
|
+
export { Descriptions } from 'antd';
|
|
12
|
+
export { Divider } from 'antd';
|
|
13
|
+
export { Empty } from 'antd';
|
|
14
|
+
export { Grid } from 'antd';
|
|
15
|
+
export { Image } from 'antd';
|
|
16
|
+
export { InputNumber } from 'antd';
|
|
17
|
+
export { message } from 'antd';
|
|
18
|
+
export { Menu } from 'antd';
|
|
19
|
+
export { Mentions } from 'antd';
|
|
20
|
+
export { Statistic } from 'antd';
|
|
21
|
+
export { notification } from 'antd';
|
|
22
|
+
export { Pagination } from 'antd';
|
|
23
|
+
export { Popconfirm } from 'antd';
|
|
24
|
+
export { Popover } from 'antd';
|
|
25
|
+
export { Progress } from 'antd';
|
|
26
|
+
export { Rate } from 'antd';
|
|
27
|
+
export { Result } from 'antd';
|
|
28
|
+
export { Row } from 'antd';
|
|
29
|
+
export { Space } from 'antd';
|
|
30
|
+
export { Spin } from 'antd';
|
|
31
|
+
export { Steps } from 'antd';
|
|
32
|
+
export { Switch } from 'antd';
|
|
33
|
+
export { Transfer } from 'antd';
|
|
34
|
+
export { Tree } from 'antd';
|
|
35
|
+
export { Tag } from 'antd';
|
|
36
|
+
export { Timeline } from 'antd';
|
|
37
|
+
export { Tooltip } from 'antd';
|
|
38
|
+
export { version } from 'antd';
|
|
39
|
+
export { default as Typography } from './components/typography';
|
|
40
|
+
export { default as Skeleton } from './components/skeleton';
|
|
41
|
+
export { default as Checkbox } from './components/checkbox';
|
|
42
|
+
export { default as Button } from './components/button';
|
|
43
|
+
export { default as Radio } from './components/radio';
|
|
44
|
+
export { default as Upload } from './components/upload';
|
|
45
|
+
export { default as Icon } from './components/icon';
|
|
46
|
+
export { default as Form } from './components/form';
|
|
47
|
+
export { default as Dropdown } from './components/dropdown';
|
|
48
|
+
export { default as Calendar } from './components/calendar';
|
|
49
|
+
export { default as ConfigProvider } from './components/config-provider';
|
|
50
|
+
export { default as DatePicker } from './components/date-picker';
|
|
51
|
+
export { default as Tabs } from './components/tabs';
|
|
52
|
+
export { default as TimePicker } from './components/time-picker';
|
|
53
|
+
export { default as Slider } from './components/slider';
|
|
54
|
+
export { default as Table } from './components/table';
|
|
55
|
+
export { default as Modal } from './components/modal';
|
|
56
|
+
export { default as Drawer } from './components/drawer';
|
|
57
|
+
export { default as TreeSelect } from './components/tree-select';
|
|
58
|
+
export { default as Input } from './components/input';
|
|
59
|
+
export { default as Select } from './components/select';
|
|
60
|
+
export { default as Cascader } from './components/cascader';
|
|
61
|
+
export { default as AutoComplete } from './components/auto-complete';
|
|
62
|
+
export { default as Div } from './components/div';
|
|
63
|
+
export { default as Page } from './components/page';
|
|
64
|
+
export { default as Component } from './components/component';
|
|
65
|
+
export { default as Filter } from './components/filter';
|
|
66
|
+
export { default as Translation } from './components/translation';
|
|
67
|
+
export { default as SortableList } from './components/sortableList';
|
|
68
|
+
export { default as RecordView } from './components/record-view';
|
|
69
|
+
export { default as QRCode } from './components/qrcode';
|
|
70
|
+
export { default as ClassicLayout } from './components/classicLayout';
|
|
71
|
+
export { default as List } from './components/list';
|
|
72
|
+
export { default as Sort } from './components/sort';
|
|
73
|
+
export { default as InputNumberRange } from './components/input-number-range';
|
|
74
|
+
export { default as LowCodePage } from './components/lowCodePage';
|
|
75
|
+
export { default as Segmented } from './components/segmented';
|
|
76
|
+
export { default as VirtualKeyboard } from './components/virtual-keyboard';
|
|
77
|
+
export { default as VirtualKeyboardTime } from './components/virtual-keyboard/Time';
|
|
78
|
+
export { default as SelectTime } from './components/select-time';
|
|
79
|
+
export { default as AutoCompleteNumber } from './components/auto-complete-number';
|
|
80
|
+
export { default as BatchEditor } from './components/batch-editor';
|
|
81
|
+
export { default as DragSortTree } from './components/drag-sort-tree';
|
package/es/index.js
CHANGED
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
export { Affix } from
|
|
2
|
-
export { Anchor } from
|
|
3
|
-
export { Alert } from
|
|
4
|
-
export { Avatar } from
|
|
5
|
-
export { Badge } from
|
|
6
|
-
export { Breadcrumb } from
|
|
7
|
-
export { Card } from
|
|
8
|
-
export { Collapse } from
|
|
9
|
-
export { Carousel } from
|
|
1
|
+
export { Affix } from 'antd';
|
|
2
|
+
export { Anchor } from 'antd';
|
|
3
|
+
export { Alert } from 'antd';
|
|
4
|
+
export { Avatar } from 'antd';
|
|
5
|
+
export { Badge } from 'antd';
|
|
6
|
+
export { Breadcrumb } from 'antd';
|
|
7
|
+
export { Card } from 'antd';
|
|
8
|
+
export { Collapse } from 'antd';
|
|
9
|
+
export { Carousel } from 'antd';
|
|
10
10
|
|
|
11
11
|
// export { Cascader } from 'antd';
|
|
12
12
|
|
|
13
|
-
export { Col } from
|
|
14
|
-
export { Descriptions } from
|
|
15
|
-
export { Divider } from
|
|
13
|
+
export { Col } from 'antd';
|
|
14
|
+
export { Descriptions } from 'antd';
|
|
15
|
+
export { Divider } from 'antd';
|
|
16
16
|
|
|
17
17
|
// export { Drawer } from 'antd';
|
|
18
18
|
|
|
19
|
-
export { Empty } from
|
|
20
|
-
export { Grid } from
|
|
19
|
+
export { Empty } from 'antd';
|
|
20
|
+
export { Grid } from 'antd';
|
|
21
21
|
|
|
22
22
|
// export { Input } from 'antd';
|
|
23
23
|
|
|
24
|
-
export { Image } from
|
|
25
|
-
export { InputNumber } from
|
|
26
|
-
export { message } from
|
|
27
|
-
export { Menu } from
|
|
28
|
-
export { Mentions } from
|
|
29
|
-
export { Statistic } from
|
|
30
|
-
export { notification } from
|
|
24
|
+
export { Image } from 'antd';
|
|
25
|
+
export { InputNumber } from 'antd';
|
|
26
|
+
export { message } from 'antd';
|
|
27
|
+
export { Menu } from 'antd';
|
|
28
|
+
export { Mentions } from 'antd';
|
|
29
|
+
export { Statistic } from 'antd';
|
|
30
|
+
export { notification } from 'antd';
|
|
31
31
|
|
|
32
32
|
// export { PageHeader } from 'antd';
|
|
33
33
|
|
|
34
|
-
export { Pagination } from
|
|
35
|
-
export { Popconfirm } from
|
|
36
|
-
export { Popover } from
|
|
37
|
-
export { Progress } from
|
|
38
|
-
export { Rate } from
|
|
39
|
-
export { Result } from
|
|
40
|
-
export { Row } from
|
|
34
|
+
export { Pagination } from 'antd';
|
|
35
|
+
export { Popconfirm } from 'antd';
|
|
36
|
+
export { Popover } from 'antd';
|
|
37
|
+
export { Progress } from 'antd';
|
|
38
|
+
export { Rate } from 'antd';
|
|
39
|
+
export { Result } from 'antd';
|
|
40
|
+
export { Row } from 'antd';
|
|
41
41
|
|
|
42
42
|
// export { Skeleton } from 'antd';
|
|
43
43
|
|
|
44
|
-
export { Space } from
|
|
45
|
-
export { Spin } from
|
|
46
|
-
export { Steps } from
|
|
47
|
-
export { Switch } from
|
|
48
|
-
export { Transfer } from
|
|
49
|
-
export { Tree } from
|
|
44
|
+
export { Space } from 'antd';
|
|
45
|
+
export { Spin } from 'antd';
|
|
46
|
+
export { Steps } from 'antd';
|
|
47
|
+
export { Switch } from 'antd';
|
|
48
|
+
export { Transfer } from 'antd';
|
|
49
|
+
export { Tree } from 'antd';
|
|
50
50
|
|
|
51
51
|
// export { TreeSelect } from 'antd';
|
|
52
52
|
|
|
53
53
|
// export { Tabs } from 'antd';
|
|
54
54
|
|
|
55
|
-
export { Tag } from
|
|
56
|
-
export { Timeline } from
|
|
57
|
-
export { Tooltip } from
|
|
58
|
-
export { version } from
|
|
55
|
+
export { Tag } from 'antd';
|
|
56
|
+
export { Timeline } from 'antd';
|
|
57
|
+
export { Tooltip } from 'antd';
|
|
58
|
+
export { version } from 'antd';
|
|
59
59
|
export { default as Typography } from "./components/typography";
|
|
60
60
|
export { default as Skeleton } from "./components/skeleton";
|
|
61
61
|
export { default as Checkbox } from "./components/checkbox";
|
|
@@ -97,4 +97,5 @@ export { default as VirtualKeyboard } from "./components/virtual-keyboard";
|
|
|
97
97
|
export { default as VirtualKeyboardTime } from "./components/virtual-keyboard/Time";
|
|
98
98
|
export { default as SelectTime } from "./components/select-time";
|
|
99
99
|
export { default as AutoCompleteNumber } from "./components/auto-complete-number";
|
|
100
|
-
export { default as BatchEditor } from "./components/batch-editor";
|
|
100
|
+
export { default as BatchEditor } from "./components/batch-editor";
|
|
101
|
+
export { default as DragSortTree } from "./components/drag-sort-tree";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.less';
|
|
3
|
+
import { ValueProps, SortType } from '../types';
|
|
4
|
+
declare type TreeItemProps = {
|
|
5
|
+
id: string | number;
|
|
6
|
+
key: string | number;
|
|
7
|
+
item: ValueProps | any;
|
|
8
|
+
depth: number;
|
|
9
|
+
lists: any[];
|
|
10
|
+
activeId?: string | null;
|
|
11
|
+
childrenProps?: SortType;
|
|
12
|
+
sensors?: any;
|
|
13
|
+
onChange?: (value: any[]) => void;
|
|
14
|
+
};
|
|
15
|
+
declare const TreeItem: (props: TreeItemProps) => React.JSX.Element;
|
|
16
|
+
export default TreeItem;
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/drag-sort-tree/TreeItem/index.tsx
|
|
30
|
+
var TreeItem_exports = {};
|
|
31
|
+
__export(TreeItem_exports, {
|
|
32
|
+
default: () => TreeItem_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(TreeItem_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_sortable = require("@dnd-kit/sortable");
|
|
37
|
+
var import_core = require("@dnd-kit/core");
|
|
38
|
+
var import_utilities = require("@dnd-kit/utilities");
|
|
39
|
+
var import_icons = require("@ant-design/icons");
|
|
40
|
+
var import_sortable2 = require("@dnd-kit/sortable");
|
|
41
|
+
var import_modifiers = require("@dnd-kit/modifiers");
|
|
42
|
+
var import_classnames = __toESM(require("classnames"));
|
|
43
|
+
var import_index = require("./index.less");
|
|
44
|
+
var prefix = "pisell-lowcode";
|
|
45
|
+
var TreeItem = (props) => {
|
|
46
|
+
const { id, item, depth, activeId, sensors, childrenProps, lists, onChange } = props;
|
|
47
|
+
const [expandedKeys, setExpandedKeys] = (0, import_react.useState)([]);
|
|
48
|
+
const { attributes, listeners, setNodeRef, transform, transition } = (0, import_sortable.useSortable)({ id });
|
|
49
|
+
(0, import_react.useEffect)(() => {
|
|
50
|
+
if (activeId) {
|
|
51
|
+
setExpandedKeys([]);
|
|
52
|
+
}
|
|
53
|
+
}, [activeId]);
|
|
54
|
+
const style = {
|
|
55
|
+
transform: import_utilities.CSS.Transform.toString(transform && { ...transform, scaleY: 1 }),
|
|
56
|
+
transition
|
|
57
|
+
};
|
|
58
|
+
const rowKey = (0, import_react.useMemo)(() => {
|
|
59
|
+
return (childrenProps == null ? void 0 : childrenProps.rowKey) || "id";
|
|
60
|
+
}, [childrenProps == null ? void 0 : childrenProps.rowKey]);
|
|
61
|
+
const handleDragEnd = (event) => {
|
|
62
|
+
var _a, _b, _c;
|
|
63
|
+
const { active, over } = event;
|
|
64
|
+
if (!over || !active || !lists.length)
|
|
65
|
+
return;
|
|
66
|
+
try {
|
|
67
|
+
let [activeParentId, activeId2] = (_a = active == null ? void 0 : active.id) == null ? void 0 : _a.split("-");
|
|
68
|
+
let [overParentId, overId] = (_b = over == null ? void 0 : over.id) == null ? void 0 : _b.split("-");
|
|
69
|
+
const parentIndex = lists.findIndex(
|
|
70
|
+
(item2) => item2[rowKey] == activeParentId
|
|
71
|
+
);
|
|
72
|
+
if (activeId2 !== overId && activeParentId === overParentId && parentIndex !== -1) {
|
|
73
|
+
const activeIndex = item.children.findIndex(
|
|
74
|
+
(item2) => item2[rowKey] == activeId2
|
|
75
|
+
);
|
|
76
|
+
const overIndex = item.children.findIndex(
|
|
77
|
+
(item2) => item2[rowKey] == overId
|
|
78
|
+
);
|
|
79
|
+
if (activeIndex !== -1 && overIndex !== -1) {
|
|
80
|
+
const newChildren = (0, import_sortable2.arrayMove)(
|
|
81
|
+
(_c = lists[parentIndex]) == null ? void 0 : _c.children,
|
|
82
|
+
activeIndex,
|
|
83
|
+
overIndex
|
|
84
|
+
);
|
|
85
|
+
const _lists = [
|
|
86
|
+
...lists.slice(0, parentIndex),
|
|
87
|
+
{ ...lists == null ? void 0 : lists[parentIndex], children: newChildren },
|
|
88
|
+
...lists.slice(parentIndex + 1)
|
|
89
|
+
];
|
|
90
|
+
onChange && onChange([..._lists]);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
} catch (error) {
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
const handleShow = (e) => {
|
|
97
|
+
e.stopPropagation();
|
|
98
|
+
e.preventDefault();
|
|
99
|
+
const index = lists == null ? void 0 : lists.findIndex(
|
|
100
|
+
(node) => node[rowKey] === item[rowKey]
|
|
101
|
+
);
|
|
102
|
+
if (index !== -1) {
|
|
103
|
+
lists[index].show = !lists[index].show;
|
|
104
|
+
onChange == null ? void 0 : onChange([...lists]);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
const onSelect = () => {
|
|
108
|
+
var _a;
|
|
109
|
+
if (depth === 0 && ((_a = item.children) == null ? void 0 : _a.length)) {
|
|
110
|
+
const key = item[rowKey];
|
|
111
|
+
if (expandedKeys.includes(key)) {
|
|
112
|
+
const _ids = expandedKeys.filter((id2) => id2 !== key);
|
|
113
|
+
setExpandedKeys(_ids);
|
|
114
|
+
} else {
|
|
115
|
+
setExpandedKeys([...expandedKeys, key]);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
const renderChildren = (0, import_react.useMemo)(() => {
|
|
120
|
+
var _a;
|
|
121
|
+
const showChildren = ((_a = item == null ? void 0 : item.children) == null ? void 0 : _a.length) > 0 && (expandedKeys == null ? void 0 : expandedKeys.includes(item[rowKey]));
|
|
122
|
+
const _isAvailableTab = (childrenProps == null ? void 0 : childrenProps.tabKey) === "available";
|
|
123
|
+
return showChildren && /* @__PURE__ */ import_react.default.createElement(
|
|
124
|
+
import_sortable2.SortableContext,
|
|
125
|
+
{
|
|
126
|
+
items: item.children.map(
|
|
127
|
+
(child) => `${item[rowKey]}-${child[rowKey]}`
|
|
128
|
+
),
|
|
129
|
+
strategy: import_sortable2.verticalListSortingStrategy
|
|
130
|
+
},
|
|
131
|
+
item.children.map(
|
|
132
|
+
(child) => _isAvailableTab && (child == null ? void 0 : child.is_available) || !_isAvailableTab ? /* @__PURE__ */ import_react.default.createElement(
|
|
133
|
+
TreeItem,
|
|
134
|
+
{
|
|
135
|
+
id: `${item[rowKey]}-${child[rowKey]}`,
|
|
136
|
+
key: `${item[rowKey]}-${child[rowKey]}`,
|
|
137
|
+
item: child,
|
|
138
|
+
lists,
|
|
139
|
+
depth: depth + 1,
|
|
140
|
+
childrenProps
|
|
141
|
+
}
|
|
142
|
+
) : null
|
|
143
|
+
)
|
|
144
|
+
);
|
|
145
|
+
}, [item.children, expandedKeys, rowKey, lists, childrenProps == null ? void 0 : childrenProps.tabKey]);
|
|
146
|
+
const rightIcon = (0, import_react.useMemo)(() => {
|
|
147
|
+
const hiddenRightIcon = childrenProps == null ? void 0 : childrenProps.hiddenRightIcon;
|
|
148
|
+
return !hiddenRightIcon ? /* @__PURE__ */ import_react.default.createElement(
|
|
149
|
+
"div",
|
|
150
|
+
{
|
|
151
|
+
className: (0, import_classnames.default)(`${prefix}-drag-sort-tree-icon`),
|
|
152
|
+
onClick: handleShow
|
|
153
|
+
},
|
|
154
|
+
item.show ? /* @__PURE__ */ import_react.default.createElement(import_icons.EyeOutlined, null) : /* @__PURE__ */ import_react.default.createElement(import_icons.EyeInvisibleOutlined, null)
|
|
155
|
+
) : null;
|
|
156
|
+
}, [childrenProps == null ? void 0 : childrenProps.hiddenRightIcon, item == null ? void 0 : item.show, lists]);
|
|
157
|
+
const warningIcon = (0, import_react.useMemo)(() => {
|
|
158
|
+
const hiddenWarningIcon = childrenProps == null ? void 0 : childrenProps.hiddenWarningIcon;
|
|
159
|
+
return !hiddenWarningIcon && !(item == null ? void 0 : item.is_available) ? /* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)(`${prefix}-drag-sort-tree-item-icon`) }, /* @__PURE__ */ import_react.default.createElement(import_icons.WarningOutlined, { style: { color: "red" } })) : null;
|
|
160
|
+
}, [childrenProps == null ? void 0 : childrenProps.hiddenWarningIcon, item == null ? void 0 : item.is_available]);
|
|
161
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
162
|
+
import_core.DndContext,
|
|
163
|
+
{
|
|
164
|
+
sensors,
|
|
165
|
+
modifiers: [import_modifiers.restrictToVerticalAxis, import_modifiers.restrictToParentElement],
|
|
166
|
+
onDragEnd: handleDragEnd
|
|
167
|
+
},
|
|
168
|
+
/* @__PURE__ */ import_react.default.createElement("div", { ref: setNodeRef, style, ...attributes, ...listeners }, /* @__PURE__ */ import_react.default.createElement(
|
|
169
|
+
"div",
|
|
170
|
+
{
|
|
171
|
+
style: { paddingLeft: !depth ? "8px" : `${depth * 20}px` },
|
|
172
|
+
className: (0, import_classnames.default)(
|
|
173
|
+
`${prefix}-drag-sort-tree`,
|
|
174
|
+
childrenProps == null ? void 0 : childrenProps.className
|
|
175
|
+
),
|
|
176
|
+
onClick: onSelect
|
|
177
|
+
},
|
|
178
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: (0, import_classnames.default)(`${prefix}-drag-sort-tree-item`) }, !(childrenProps == null ? void 0 : childrenProps.hiddenDraggableIcon) ? /* @__PURE__ */ import_react.default.createElement(import_icons.HolderOutlined, null) : null, /* @__PURE__ */ import_react.default.createElement("div", { className: `${prefix}-drag-sort-tree-title` }, (childrenProps == null ? void 0 : childrenProps.titleRender) || (item == null ? void 0 : item.title))),
|
|
179
|
+
!depth ? rightIcon : warningIcon
|
|
180
|
+
), renderChildren)
|
|
181
|
+
);
|
|
182
|
+
};
|
|
183
|
+
var TreeItem_default = TreeItem;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
@pisell-prefix: pisell-lowcode;
|
|
2
|
+
|
|
3
|
+
.@{pisell-prefix} {
|
|
4
|
+
&-drag-sort-tree{
|
|
5
|
+
display: flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
justify-content: space-between;
|
|
8
|
+
font-size: 16px;
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
touch-action: none !important;
|
|
11
|
+
width: 100%;
|
|
12
|
+
color: #101828;
|
|
13
|
+
height: 40px;
|
|
14
|
+
line-height: 40px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&-drag-sort-tree:hover {
|
|
18
|
+
background: rgb(237, 238, 238);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&-drag-sort-tree-item {
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&-drag-sort-tree &-drag-sort-tree-title {
|
|
27
|
+
margin-left: 10px;
|
|
28
|
+
font-size: 14px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&-drag-sort-tree-icon,
|
|
32
|
+
&-drag-sort-tree-item-icon {
|
|
33
|
+
height: 30px;
|
|
34
|
+
width: 30px;
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
justify-content: center;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|