@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.
Files changed (49) hide show
  1. package/build/lowcode/assets-daily.json +11 -11
  2. package/build/lowcode/assets-dev.json +2 -2
  3. package/build/lowcode/assets-prod.json +11 -11
  4. package/build/lowcode/index.js +1 -1
  5. package/build/lowcode/meta.js +2 -2
  6. package/build/lowcode/preview.js +8 -8
  7. package/build/lowcode/render/default/view.css +1 -1
  8. package/build/lowcode/render/default/view.js +11 -11
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +13 -13
  11. package/es/components/drag-sort-tree/TreeItem/index.d.ts +16 -0
  12. package/es/components/drag-sort-tree/TreeItem/index.js +196 -0
  13. package/es/components/drag-sort-tree/TreeItem/index.less +41 -0
  14. package/es/components/drag-sort-tree/index.d.ts +5 -0
  15. package/es/components/drag-sort-tree/index.js +91 -0
  16. package/es/components/drag-sort-tree/index.less +4 -0
  17. package/es/components/drag-sort-tree/types.d.ts +20 -0
  18. package/es/components/drag-sort-tree/types.js +1 -0
  19. package/es/components/drawer/index.d.ts +1 -1
  20. package/es/components/drawer/index.js +23 -17
  21. package/es/components/drawer/index.less +25 -1
  22. package/es/components/table/Actions/component/ColumnsSetting/PopoverContent.less +2 -1
  23. package/es/components/table/BasicTable/index.js +5 -2
  24. package/es/components/tabs/index.d.ts +4 -4
  25. package/es/components/tabs/index.js +10 -9
  26. package/es/index.d.ts +81 -80
  27. package/es/index.js +40 -39
  28. package/lib/components/drag-sort-tree/TreeItem/index.d.ts +16 -0
  29. package/lib/components/drag-sort-tree/TreeItem/index.js +183 -0
  30. package/lib/components/drag-sort-tree/TreeItem/index.less +41 -0
  31. package/lib/components/drag-sort-tree/index.d.ts +5 -0
  32. package/lib/components/drag-sort-tree/index.js +115 -0
  33. package/lib/components/drag-sort-tree/index.less +4 -0
  34. package/lib/components/drag-sort-tree/types.d.ts +20 -0
  35. package/lib/components/drag-sort-tree/types.js +17 -0
  36. package/lib/components/drawer/index.d.ts +1 -1
  37. package/lib/components/drawer/index.js +4 -1
  38. package/lib/components/drawer/index.less +25 -1
  39. package/lib/components/table/Actions/component/ColumnsSetting/PopoverContent.less +2 -1
  40. package/lib/components/table/BasicTable/index.js +2 -2
  41. package/lib/components/tabs/index.d.ts +4 -4
  42. package/lib/components/tabs/index.js +3 -1
  43. package/lib/index.d.ts +81 -80
  44. package/lib/index.js +3 -0
  45. package/lowcode/drag-sort-tree/__screenshots__/drag-sort-tree.png +0 -0
  46. package/lowcode/drag-sort-tree/meta.ts +108 -0
  47. package/lowcode/drag-sort-tree/snippets.ts +57 -0
  48. package/lowcode/tabs/meta.ts +9 -0
  49. package/package.json +2 -2
@@ -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,196 @@
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
4
+ 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."); }
5
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
7
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
8
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
9
+ 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; }
10
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
11
+ 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); }
12
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
13
+ 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."); }
14
+ 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); }
15
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
16
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
17
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
18
+ import React, { useEffect, useMemo, useState } from 'react';
19
+ import { useSortable } from '@dnd-kit/sortable';
20
+ import { DndContext } from '@dnd-kit/core';
21
+ import { CSS } from '@dnd-kit/utilities';
22
+ import { HolderOutlined, EyeOutlined, EyeInvisibleOutlined, WarningOutlined } from '@ant-design/icons';
23
+ import { SortableContext, verticalListSortingStrategy, arrayMove } from '@dnd-kit/sortable';
24
+ import { restrictToVerticalAxis, restrictToParentElement } from '@dnd-kit/modifiers';
25
+ import classNames from 'classnames';
26
+ import "./index.less";
27
+ var prefix = 'pisell-lowcode';
28
+ var TreeItem = function TreeItem(props) {
29
+ var id = props.id,
30
+ item = props.item,
31
+ depth = props.depth,
32
+ activeId = props.activeId,
33
+ sensors = props.sensors,
34
+ childrenProps = props.childrenProps,
35
+ lists = props.lists,
36
+ onChange = props.onChange;
37
+ var _useState = useState([]),
38
+ _useState2 = _slicedToArray(_useState, 2),
39
+ expandedKeys = _useState2[0],
40
+ setExpandedKeys = _useState2[1];
41
+ var _useSortable = useSortable({
42
+ id: id
43
+ }),
44
+ attributes = _useSortable.attributes,
45
+ listeners = _useSortable.listeners,
46
+ setNodeRef = _useSortable.setNodeRef,
47
+ transform = _useSortable.transform,
48
+ transition = _useSortable.transition;
49
+ useEffect(function () {
50
+ // 拖拽的时候将节点收起
51
+ if (activeId) {
52
+ setExpandedKeys([]);
53
+ }
54
+ }, [activeId]);
55
+ var style = {
56
+ transform: CSS.Transform.toString(transform && _objectSpread(_objectSpread({}, transform), {}, {
57
+ scaleY: 1
58
+ })),
59
+ transition: transition
60
+ };
61
+ var rowKey = useMemo(function () {
62
+ return (childrenProps === null || childrenProps === void 0 ? void 0 : childrenProps.rowKey) || 'id';
63
+ }, [childrenProps === null || childrenProps === void 0 ? void 0 : childrenProps.rowKey]);
64
+ var handleDragEnd = function handleDragEnd(event) {
65
+ var active = event.active,
66
+ over = event.over;
67
+ if (!over || !active || !lists.length) return;
68
+ try {
69
+ var _active$id, _over$id;
70
+ 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
+ _active$id$split2 = _slicedToArray(_active$id$split, 2),
72
+ activeParentId = _active$id$split2[0],
73
+ _activeId = _active$id$split2[1];
74
+ 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
+ _over$id$split2 = _slicedToArray(_over$id$split, 2),
76
+ overParentId = _over$id$split2[0],
77
+ overId = _over$id$split2[1];
78
+ var parentIndex = lists.findIndex(function (item) {
79
+ return item[rowKey] == activeParentId;
80
+ });
81
+ if (_activeId !== overId && activeParentId === overParentId && parentIndex !== -1) {
82
+ var activeIndex = item.children.findIndex(function (item) {
83
+ return item[rowKey] == _activeId;
84
+ });
85
+ var overIndex = item.children.findIndex(function (item) {
86
+ return item[rowKey] == overId;
87
+ });
88
+
89
+ // 移动数据
90
+ if (activeIndex !== -1 && overIndex !== -1) {
91
+ var _lists$parentIndex;
92
+ var newChildren = arrayMove((_lists$parentIndex = lists[parentIndex]) === null || _lists$parentIndex === void 0 ? void 0 : _lists$parentIndex.children, activeIndex, overIndex);
93
+ var _lists = [].concat(_toConsumableArray(lists.slice(0, parentIndex)), [_objectSpread(_objectSpread({}, lists === null || lists === void 0 ? void 0 : lists[parentIndex]), {}, {
94
+ children: newChildren
95
+ })], _toConsumableArray(lists.slice(parentIndex + 1)));
96
+ onChange && onChange(_toConsumableArray(_lists));
97
+ }
98
+ }
99
+ } catch (error) {}
100
+ };
101
+
102
+ /**
103
+ * @title: 点击切换眼睛
104
+ * @description:
105
+ * @param {any} e
106
+ * @return {*}
107
+ * @Author: WangHan
108
+ * @Date: 2024-07-19 22:43
109
+ */
110
+ var handleShow = function handleShow(e) {
111
+ e.stopPropagation(); // 阻止事件冒泡
112
+ e.preventDefault(); // 阻止默认行为
113
+ var index = lists === null || lists === void 0 ? void 0 : lists.findIndex(function (node) {
114
+ return node[rowKey] === item[rowKey];
115
+ });
116
+ if (index !== -1) {
117
+ lists[index].show = !lists[index].show;
118
+ onChange === null || onChange === void 0 ? void 0 : onChange(_toConsumableArray(lists));
119
+ }
120
+ };
121
+ var onSelect = function onSelect() {
122
+ var _item$children;
123
+ if (depth === 0 && (_item$children = item.children) !== null && _item$children !== void 0 && _item$children.length) {
124
+ var key = item[rowKey];
125
+ if (expandedKeys.includes(key)) {
126
+ var _ids = expandedKeys.filter(function (id) {
127
+ return id !== key;
128
+ });
129
+ setExpandedKeys(_ids);
130
+ } else {
131
+ setExpandedKeys([].concat(_toConsumableArray(expandedKeys), [key]));
132
+ }
133
+ }
134
+ };
135
+ var renderChildren = useMemo(function () {
136
+ var _item$children2;
137
+ var showChildren = (item === null || item === void 0 ? void 0 : (_item$children2 = item.children) === null || _item$children2 === void 0 ? void 0 : _item$children2.length) > 0 && (expandedKeys === null || expandedKeys === void 0 ? void 0 : expandedKeys.includes(item[rowKey]));
138
+ var _isAvailableTab = (childrenProps === null || childrenProps === void 0 ? void 0 : childrenProps.tabKey) === 'available';
139
+ return showChildren && /*#__PURE__*/React.createElement(SortableContext, {
140
+ items: item.children.map(function (child) {
141
+ return "".concat(item[rowKey], "-").concat(child[rowKey]);
142
+ }),
143
+ strategy: verticalListSortingStrategy
144
+ }, item.children.map(function (child) {
145
+ return _isAvailableTab && child !== null && child !== void 0 && child.is_available || !_isAvailableTab ? /*#__PURE__*/React.createElement(TreeItem, {
146
+ id: "".concat(item[rowKey], "-").concat(child[rowKey]),
147
+ key: "".concat(item[rowKey], "-").concat(child[rowKey]),
148
+ item: child,
149
+ lists: lists,
150
+ depth: depth + 1,
151
+ childrenProps: childrenProps
152
+ }) : null;
153
+ }));
154
+ }, [item.children, expandedKeys, rowKey, lists, childrenProps === null || childrenProps === void 0 ? void 0 : childrenProps.tabKey]);
155
+
156
+ // 右侧图标
157
+ var rightIcon = useMemo(function () {
158
+ // 右侧子级图标
159
+ var hiddenRightIcon = childrenProps === null || childrenProps === void 0 ? void 0 : childrenProps.hiddenRightIcon;
160
+ return !hiddenRightIcon ? /*#__PURE__*/React.createElement("div", {
161
+ className: classNames("".concat(prefix, "-drag-sort-tree-icon")),
162
+ onClick: handleShow
163
+ }, item.show ? /*#__PURE__*/React.createElement(EyeOutlined, null) : /*#__PURE__*/React.createElement(EyeInvisibleOutlined, null)) : null;
164
+ }, [childrenProps === null || childrenProps === void 0 ? void 0 : childrenProps.hiddenRightIcon, item === null || item === void 0 ? void 0 : item.show, lists]);
165
+
166
+ // 警告图标
167
+ var warningIcon = useMemo(function () {
168
+ var hiddenWarningIcon = childrenProps === null || childrenProps === void 0 ? void 0 : childrenProps.hiddenWarningIcon;
169
+ return !hiddenWarningIcon && !(item !== null && item !== void 0 && item.is_available) ? /*#__PURE__*/React.createElement("div", {
170
+ className: classNames("".concat(prefix, "-drag-sort-tree-item-icon"))
171
+ }, /*#__PURE__*/React.createElement(WarningOutlined, {
172
+ style: {
173
+ color: 'red'
174
+ }
175
+ })) : null;
176
+ }, [childrenProps === null || childrenProps === void 0 ? void 0 : childrenProps.hiddenWarningIcon, item === null || item === void 0 ? void 0 : item.is_available]);
177
+ return /*#__PURE__*/React.createElement(DndContext, {
178
+ sensors: sensors,
179
+ modifiers: [restrictToVerticalAxis, restrictToParentElement],
180
+ onDragEnd: handleDragEnd
181
+ }, /*#__PURE__*/React.createElement("div", _extends({
182
+ ref: setNodeRef,
183
+ style: style
184
+ }, attributes, listeners), /*#__PURE__*/React.createElement("div", {
185
+ style: {
186
+ paddingLeft: !depth ? '8px' : "".concat(depth * 20, "px")
187
+ },
188
+ className: classNames("".concat(prefix, "-drag-sort-tree"), childrenProps === null || childrenProps === void 0 ? void 0 : childrenProps.className),
189
+ onClick: onSelect
190
+ }, /*#__PURE__*/React.createElement("div", {
191
+ className: classNames("".concat(prefix, "-drag-sort-tree-item"))
192
+ }, !(childrenProps !== null && childrenProps !== void 0 && childrenProps.hiddenDraggableIcon) ? /*#__PURE__*/React.createElement(HolderOutlined, null) : null, /*#__PURE__*/React.createElement("div", {
193
+ className: "".concat(prefix, "-drag-sort-tree-title")
194
+ }, (childrenProps === null || childrenProps === void 0 ? void 0 : childrenProps.titleRender) || (item === null || item === void 0 ? void 0 : item.title))), !depth ? rightIcon : warningIcon), renderChildren));
195
+ };
196
+ export 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
+
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ import { SortType } from './types';
4
+ declare const DragSortTree: (props: SortType) => React.JSX.Element;
5
+ export default DragSortTree;
@@ -0,0 +1,91 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ 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
+ 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); }
4
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
5
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import React, { useEffect, useState } from 'react';
8
+ import { DndContext, useSensor, useSensors, PointerSensor } from '@dnd-kit/core';
9
+ import { SortableContext, verticalListSortingStrategy, arrayMove } from '@dnd-kit/sortable';
10
+ import TreeItem from "./TreeItem";
11
+ import { restrictToVerticalAxis, restrictToParentElement } from '@dnd-kit/modifiers';
12
+ import "./index.less";
13
+ var DragSortTree = function DragSortTree(props) {
14
+ var value = props.value,
15
+ rowKey = props.rowKey,
16
+ tabKey = props.tabKey,
17
+ onChange = props.onChange;
18
+ var _useState = useState(value || []),
19
+ _useState2 = _slicedToArray(_useState, 2),
20
+ items = _useState2[0],
21
+ setItems = _useState2[1];
22
+ var _useState3 = useState(null),
23
+ _useState4 = _slicedToArray(_useState3, 2),
24
+ activeId = _useState4[0],
25
+ setActiveId = _useState4[1];
26
+ useEffect(function () {
27
+ // 防止切换的时候数据不更新,拖拽之后,如果切换tab,需要用更新之后的数据
28
+ setItems(value || []);
29
+ }, [tabKey]);
30
+ var sensors = useSensors(useSensor(PointerSensor, {
31
+ activationConstraint: {
32
+ distance: 5
33
+ }
34
+ }));
35
+ var handleDragStart = function handleDragStart(event) {
36
+ var active = event.active;
37
+ setActiveId(active === null || active === void 0 ? void 0 : active.id);
38
+ };
39
+ var handleDragEnd = function handleDragEnd(event) {
40
+ var active = event.active,
41
+ over = event.over;
42
+
43
+ // 拖拽结束将这个值设置为空,防止第二次拖拽同一个节点,监听不到这个变化
44
+ setActiveId(null);
45
+ if (!over || !active) return;
46
+ try {
47
+ var _activeId = active.id;
48
+ var overId = over.id;
49
+ if (_activeId !== overId) {
50
+ var activeIndex = items.findIndex(function (item) {
51
+ return item[rowKey] === _activeId;
52
+ });
53
+ var overIndex = items.findIndex(function (item) {
54
+ return item[rowKey] === overId;
55
+ });
56
+ var _lists = arrayMove(items, activeIndex, overIndex);
57
+ handleChange(_lists);
58
+ }
59
+ } catch (error) {}
60
+ };
61
+ var handleChange = function handleChange(value) {
62
+ setItems(value);
63
+ onChange && onChange(value);
64
+ };
65
+ return /*#__PURE__*/React.createElement("div", {
66
+ className: "pisell-lowcode-drag-sort-tree-wrap"
67
+ }, /*#__PURE__*/React.createElement(DndContext, {
68
+ sensors: sensors,
69
+ onDragEnd: handleDragEnd,
70
+ onDragStart: handleDragStart,
71
+ modifiers: [restrictToVerticalAxis, restrictToParentElement]
72
+ }, /*#__PURE__*/React.createElement(SortableContext, {
73
+ items: items.map(function (item) {
74
+ return item[rowKey];
75
+ }),
76
+ strategy: verticalListSortingStrategy
77
+ }, items.map(function (item) {
78
+ return /*#__PURE__*/React.createElement(TreeItem, {
79
+ key: item[rowKey],
80
+ id: item[rowKey],
81
+ item: item,
82
+ depth: 0,
83
+ sensors: sensors,
84
+ activeId: activeId,
85
+ childrenProps: props,
86
+ lists: items,
87
+ onChange: handleChange
88
+ });
89
+ }))));
90
+ };
91
+ export default DragSortTree;
@@ -0,0 +1,4 @@
1
+ .pisell-lowcode-drag-sort-tree-wrap{
2
+ overflow-y: auto;
3
+ overflow-x: hidden;
4
+ }
@@ -0,0 +1,20 @@
1
+ /// <reference types="react" />
2
+ export declare type ValueProps = {
3
+ id: number | string;
4
+ title: string;
5
+ show?: boolean;
6
+ is_available?: boolean;
7
+ type_id?: number;
8
+ children?: ValueProps[];
9
+ };
10
+ export declare type SortType = {
11
+ value: ValueProps[];
12
+ rowKey: string;
13
+ className?: string | Function;
14
+ titleRender?: string | React.ReactElement;
15
+ hiddenDraggableIcon?: boolean;
16
+ hiddenRightIcon?: boolean;
17
+ hiddenWarningIcon?: boolean;
18
+ tabKey?: string;
19
+ onChange?: (value: ValueProps[]) => void;
20
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,3 @@
1
- import "./index.less";
1
+ import './index.less';
2
2
  declare const Drawer: any;
3
3
  export default Drawer;
@@ -1,6 +1,8 @@
1
1
  var _excluded = ["others"];
2
2
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
3
3
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
6
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
5
7
  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."); }
6
8
  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); }
@@ -12,15 +14,15 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
12
14
  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; }
13
15
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
14
16
  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); }
15
- import React, { useLayoutEffect, useMemo } from "react";
16
- import { Drawer as OriginalDrawer } from "antd";
17
- import { useControllableValue, useUpdateEffect } from "ahooks";
18
- import classNames from "classnames";
19
- import { isBoolean, isUndefined } from "@pisell/utils";
20
- import XClose from "@pisell/icon/es/XClose";
21
- import Pin02 from "@pisell/icon/es/Pin02";
17
+ import React, { useLayoutEffect, useMemo } from 'react';
18
+ import { Drawer as OriginalDrawer } from 'antd';
19
+ import { useControllableValue, useUpdateEffect } from 'ahooks';
20
+ import classNames from 'classnames';
21
+ import { isBoolean, isUndefined } from '@pisell/utils';
22
+ import XClose from '@pisell/icon/es/XClose';
23
+ import Pin02 from '@pisell/icon/es/Pin02';
22
24
  import "./index.less";
23
- var prefix = "pisell-lowcode-";
25
+ var prefix = 'pisell-lowcode-';
24
26
  var Title = function Title(props) {
25
27
  var placement = props.placement,
26
28
  onClose = props.onClose,
@@ -51,8 +53,8 @@ var Drawer = function Drawer(props) {
51
53
  getContainer = props.getContainer,
52
54
  open = props.open;
53
55
  var _useControllableValue = useControllableValue(props, {
54
- trigger: "onPersistentChange",
55
- valuePropName: "persistent"
56
+ trigger: 'onPersistentChange',
57
+ valuePropName: 'persistent'
56
58
  }),
57
59
  _useControllableValue2 = _slicedToArray(_useControllableValue, 2),
58
60
  persistentState = _useControllableValue2[0],
@@ -60,17 +62,17 @@ var Drawer = function Drawer(props) {
60
62
  var currentDrawerId = props.__id;
61
63
  var storageKey = "drawer-".concat(currentDrawerId);
62
64
  var innerProps = {};
63
- if (props.__designMode === "design") {
65
+ if (props.__designMode === 'design') {
64
66
  // 低代码编辑态中强制显示,将控制权交给引擎侧
65
67
  innerProps.open = true;
66
68
  }
67
69
  useLayoutEffect(function () {
68
70
  if (isBoolean(persistentState) && isUndefined(getContainer) && showPin) {
69
71
  document.body.style.transition = 'all 0.3s';
70
- document.body.style["padding-".concat(placement)] = persistentState && open ? "".concat(width || 378, "px") : "0";
72
+ document.body.style["padding-".concat(placement)] = persistentState && open ? "".concat(width || 378, "px") : '0';
71
73
  }
72
74
  return function () {
73
- document.body.style["padding-".concat(placement)] = "0";
75
+ document.body.style["padding-".concat(placement)] = '0';
74
76
  document.body.style.transition = 'none';
75
77
  };
76
78
  }, [persistentState, width, showPin, placement, open]);
@@ -81,14 +83,14 @@ var Drawer = function Drawer(props) {
81
83
  }, [persistentState, storageKey, showPin]);
82
84
  useLayoutEffect(function () {
83
85
  if (!isBoolean(persistentState) && showPin) {
84
- setPersistentState(localStorage.getItem(storageKey) === "true");
86
+ setPersistentState(localStorage.getItem(storageKey) === 'true');
85
87
  }
86
88
  }, [persistentState, storageKey, showPin]);
87
89
  var otherProps = useMemo(function () {
88
- if (operateMode === "outside") {
90
+ if (operateMode === 'outside') {
89
91
  return {
90
92
  headerStyle: {
91
- border: "none",
93
+ border: 'none',
92
94
  height: 0,
93
95
  padding: 0
94
96
  },
@@ -101,7 +103,11 @@ var Drawer = function Drawer(props) {
101
103
  })
102
104
  };
103
105
  }
104
- return headerStyle;
106
+ return _objectSpread({
107
+ closeIcon: /*#__PURE__*/React.createElement(XClose, {
108
+ className: "".concat(prefix, "drawer-header-close-icon")
109
+ })
110
+ }, headerStyle);
105
111
  }, [operateMode, placement, onClose, persistentState, setPersistentState]);
106
112
  return /*#__PURE__*/React.createElement(OriginalDrawer, _extends({}, resetProps, innerProps, otherProps, others));
107
113
  };
@@ -1,6 +1,24 @@
1
1
  @pisell-prefix: pisell-lowcode;
2
2
 
3
3
  .@{pisell-prefix} {
4
+ &-drawer-header {
5
+ position: relative;
6
+ }
7
+
8
+ &-drawer-header-close-icon {
9
+ position: absolute;
10
+ top: 0;
11
+ bottom: 0;
12
+ left: 0;
13
+ width: 50px;
14
+ cursor: pointer;
15
+ display: flex;
16
+ align-items: center;
17
+ justify-content: center;
18
+ font-size: 20px;
19
+ z-index: 1;
20
+ }
21
+
4
22
  &-drawer-outside-wrap {
5
23
  position: absolute;
6
24
  padding: 10px;
@@ -8,9 +26,11 @@
8
26
  display: flex;
9
27
  flex-direction: column;
10
28
  }
29
+
11
30
  &-drawer-outside-wrap-right {
12
31
  left: -82px;
13
32
  }
33
+
14
34
  &-drawer-outside-action-wrap {
15
35
  width: 56px;
16
36
  height: 56px;
@@ -24,17 +44,21 @@
24
44
  justify-content: center;
25
45
  margin-bottom: 20px;
26
46
  cursor: pointer;
47
+
27
48
  &:hover {
28
49
  background: #e8e8ee;
29
50
  }
51
+
30
52
  .anticon {
31
53
  font-size: 20px;
32
54
  }
33
55
  }
56
+
34
57
  &-drawer-outside-action-wrap:last-child {
35
58
  margin-bottom: 0;
36
59
  }
60
+
37
61
  &-drawer-outside-action-active {
38
62
  background: var(--Primary-200, #E9D7FE) !important;
39
63
  }
40
- }
64
+ }
@@ -22,7 +22,7 @@
22
22
  }
23
23
  &-table-action-column-drag-item {
24
24
  display: flex;
25
- height: 36px;
25
+ min-height: 36px;
26
26
  border-radius: 4px;
27
27
  align-items: center;
28
28
  &:hover {
@@ -39,6 +39,7 @@
39
39
  padding-right: 6px;
40
40
  display: flex;
41
41
  justify-content: space-between;
42
+ align-items: center;
42
43
  flex: 1;
43
44
  }
44
45
  &-table-action-column-drag-item-right-text {
@@ -37,7 +37,10 @@ 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("pagination", form) || {
40
+ var formPagination = Form.useWatch("pagination", {
41
+ form: form,
42
+ preserve: true
43
+ }) || {
41
44
  page: 1,
42
45
  size: 10
43
46
  };
@@ -135,7 +138,7 @@ var BasicTable = function BasicTable(props) {
135
138
  expandable: {
136
139
  defaultExpandAllRows: true
137
140
  }
138
- })), total > ((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, {
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, {
139
142
  name: "pagination"
140
143
  }, /*#__PURE__*/React.createElement(FormPagination, _extends({}, pagination, {
141
144
  showTotal: _showTotal,
@@ -1,6 +1,6 @@
1
- import React, { Component } from "react";
2
- import { TabsProps } from "antd";
3
- import "./index.less";
1
+ import React, { Component } from 'react';
2
+ import { TabsProps } from 'antd';
3
+ import './index.less';
4
4
  declare class Tabs extends Component<any> {
5
5
  state: {
6
6
  activeKey: any;
@@ -8,7 +8,7 @@ declare class Tabs extends Component<any> {
8
8
  private _handleChange;
9
9
  setActiveKey: (key: string) => void;
10
10
  getActiveKey: () => any;
11
- renderIconLabelTabBar: TabsProps["renderTabBar"];
11
+ renderIconLabelTabBar: TabsProps['renderTabBar'];
12
12
  filterHiddenTabs: (tabs: any[]) => any[];
13
13
  render(): React.JSX.Element;
14
14
  }