@pisell/materials 2.2.9 → 2.2.11

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 (86) 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 +19 -19
  9. package/build/lowcode/view.css +1 -1
  10. package/build/lowcode/view.js +19 -19
  11. package/es/components/Pagination/index.d.ts +1 -1
  12. package/es/components/date-picker/index.js +2 -1
  13. package/es/components/drag-sort-tree/TreeItem/index.d.ts +4 -1
  14. package/es/components/drag-sort-tree/TreeItem/index.js +45 -31
  15. package/es/components/drag-sort-tree/TreeItem/index.less +44 -12
  16. package/es/components/drag-sort-tree/index.d.ts +1 -0
  17. package/es/components/drag-sort-tree/index.js +41 -18
  18. package/es/components/drag-sort-tree/index.less +4 -0
  19. package/es/components/drag-sort-tree/types.d.ts +5 -1
  20. package/es/components/table/Table/fields/index.d.ts +31 -0
  21. package/es/components/table/Table/fields/index.js +5 -2
  22. package/es/components/table/Table/fields/oldRangePicker/Config/index.d.ts +3 -0
  23. package/es/components/table/Table/fields/oldRangePicker/Config/index.js +5 -0
  24. package/es/components/table/Table/fields/oldRangePicker/Edit/index.d.ts +4 -0
  25. package/es/components/table/Table/fields/oldRangePicker/Edit/index.js +106 -0
  26. package/es/components/table/Table/fields/oldRangePicker/Show/index.d.ts +4 -0
  27. package/es/components/table/Table/fields/oldRangePicker/Show/index.js +17 -0
  28. package/es/components/table/Table/fields/oldRangePicker/Sort/index.d.ts +3 -0
  29. package/es/components/table/Table/fields/oldRangePicker/Sort/index.js +5 -0
  30. package/es/components/table/Table/fields/oldRangePicker/filterUtil/index.d.ts +13 -0
  31. package/es/components/table/Table/fields/oldRangePicker/filterUtil/index.js +50 -0
  32. package/es/components/table/Table/fields/oldRangePicker/index.d.ts +16 -0
  33. package/es/components/table/Table/fields/oldRangePicker/index.js +19 -0
  34. package/es/locales/en-US.d.ts +1 -0
  35. package/es/locales/en-US.js +2 -1
  36. package/es/locales/zh-CN.d.ts +1 -0
  37. package/es/locales/zh-CN.js +2 -1
  38. package/es/locales/zh-TW.d.ts +1 -0
  39. package/es/locales/zh-TW.js +2 -1
  40. package/lib/components/Pagination/index.d.ts +1 -1
  41. package/lib/components/date-picker/index.js +1 -0
  42. package/lib/components/drag-sort-tree/TreeItem/index.d.ts +4 -1
  43. package/lib/components/drag-sort-tree/TreeItem/index.js +86 -29
  44. package/lib/components/drag-sort-tree/TreeItem/index.less +44 -12
  45. package/lib/components/drag-sort-tree/index.d.ts +1 -0
  46. package/lib/components/drag-sort-tree/index.js +29 -13
  47. package/lib/components/drag-sort-tree/index.less +4 -0
  48. package/lib/components/drag-sort-tree/types.d.ts +5 -1
  49. package/lib/components/table/Table/fields/index.d.ts +31 -0
  50. package/lib/components/table/Table/fields/index.js +5 -2
  51. package/lib/components/table/Table/fields/oldRangePicker/Config/index.d.ts +3 -0
  52. package/lib/components/table/Table/fields/oldRangePicker/Config/index.js +39 -0
  53. package/lib/components/table/Table/fields/oldRangePicker/Edit/index.d.ts +4 -0
  54. package/lib/components/table/Table/fields/oldRangePicker/Edit/index.js +131 -0
  55. package/lib/components/table/Table/fields/oldRangePicker/Show/index.d.ts +4 -0
  56. package/lib/components/table/Table/fields/oldRangePicker/Show/index.js +48 -0
  57. package/lib/components/table/Table/fields/oldRangePicker/Sort/index.d.ts +3 -0
  58. package/lib/components/table/Table/fields/oldRangePicker/Sort/index.js +39 -0
  59. package/lib/components/table/Table/fields/oldRangePicker/filterUtil/index.d.ts +13 -0
  60. package/lib/components/table/Table/fields/oldRangePicker/filterUtil/index.js +61 -0
  61. package/lib/components/table/Table/fields/oldRangePicker/index.d.ts +16 -0
  62. package/lib/components/table/Table/fields/oldRangePicker/index.js +53 -0
  63. package/lib/locales/en-US.d.ts +1 -0
  64. package/lib/locales/en-US.js +2 -1
  65. package/lib/locales/zh-CN.d.ts +1 -0
  66. package/lib/locales/zh-CN.js +2 -1
  67. package/lib/locales/zh-TW.d.ts +1 -0
  68. package/lib/locales/zh-TW.js +2 -1
  69. package/lowcode/date-picker.old-range-picker/__screenshots__/date-picker-range-picker-1.png +0 -0
  70. package/lowcode/date-picker.old-range-picker/__screenshots__/date-picker-range-picker-2.png +0 -0
  71. package/lowcode/date-picker.old-range-picker/__screenshots__/date-picker-range-picker-3.png +0 -0
  72. package/lowcode/date-picker.old-range-picker/__screenshots__/date-picker-range-picker-4.png +0 -0
  73. package/lowcode/date-picker.old-range-picker/meta.ts +305 -0
  74. package/lowcode/date-picker.old-range-picker/snippets.ts +11 -0
  75. package/lowcode/date-picker.range-picker/meta.ts +20 -0
  76. package/lowcode/drag-sort-tree/meta.ts +10 -1
  77. package/lowcode/table/meta.ts +4 -0
  78. package/package.json +3 -3
  79. package/dist/umd/materials.min.css +0 -1
  80. package/dist/umd/materials.min.js +0 -1
  81. package/dist/umd/static/DotsSix.57d66266.svg +0 -1
  82. package/dist/umd/static/arrow-left.e542294f.svg +0 -1
  83. package/dist/umd/static/arrow-right.763f03e0.svg +0 -1
  84. package/dist/umd/static/filter-lines.04a54ae9.svg +0 -1
  85. package/dist/umd/static/help-circle.31c9be40.svg +0 -1
  86. package/dist/umd/static/switch-vertical-01.7ebe3ba8.svg +0 -1
@@ -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: "page" | "next" | "prev" | "jump-prev" | "jump-next", element: React.ReactNode) => React.ReactNode;
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 { HolderOutlined, EyeOutlined, EyeInvisibleOutlined, WarningOutlined } from '@ant-design/icons';
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
- useEffect(function () {
50
- // 拖拽的时候将节点收起
51
- if (activeId) {
52
- setExpandedKeys([]);
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
- _activeId = _active$id$split2[1];
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 (_activeId !== overId && activeParentId === overParentId && parentIndex !== -1) {
79
+ if (activeId !== overId && activeParentId === overParentId && parentIndex !== -1) {
82
80
  var activeIndex = item.children.findIndex(function (item) {
83
- return item[rowKey] == _activeId;
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
- 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
- }
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: 'red'
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 ? '8px' : "".concat(depth * 20, "px")
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(HolderOutlined, null) : null, /*#__PURE__*/React.createElement("div", {
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,37 +5,69 @@
5
5
  display: flex;
6
6
  align-items: center;
7
7
  justify-content: space-between;
8
- font-size: 16px;
9
- cursor: pointer;
8
+ font-size: 14px;
10
9
  touch-action: none !important;
11
10
  width: 100%;
12
11
  color: #101828;
13
- height: 40px;
14
- line-height: 40px;
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:hover {
18
- background: rgb(237, 238, 238);
22
+ &-drag-sort-tree-item{
23
+ flex: 1;
19
24
  }
20
25
 
21
26
  &-drag-sort-tree-item {
22
27
  display: flex;
23
28
  align-items: center;
24
29
  }
25
-
30
+
26
31
  &-drag-sort-tree &-drag-sort-tree-title {
27
32
  margin-left: 10px;
28
33
  font-size: 14px;
34
+ line-height: 20px;
35
+ margin-right: 30px;
29
36
  }
30
37
 
31
38
  &-drag-sort-tree-icon,
32
- &-drag-sort-tree-item-icon {
33
- height: 30px;
34
- width: 30px;
39
+ &-drag-sort-tree-item-icon,
40
+ &-drag-sort-tree-item-dot-icon {
35
41
  display: flex;
36
42
  align-items: center;
37
43
  justify-content: center;
38
44
  }
39
- }
40
45
 
41
-
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,4 +1,5 @@
1
1
  import React from 'react';
2
+ import './index.less';
2
3
  import { SortType } from './types';
3
4
  declare const DragSortTree: (props: SortType) => React.JSX.Element;
4
5
  export default DragSortTree;
@@ -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); }
@@ -9,21 +13,31 @@ import { DndContext, useSensor, useSensors, PointerSensor } from '@dnd-kit/core'
9
13
  import { SortableContext, verticalListSortingStrategy, arrayMove } from '@dnd-kit/sortable';
10
14
  import TreeItem from "./TreeItem";
11
15
  import { restrictToVerticalAxis, restrictToParentElement } from '@dnd-kit/modifiers';
12
- // import './index.less';
13
-
16
+ import "./index.less";
14
17
  var DragSortTree = function DragSortTree(props) {
15
18
  var value = props.value,
16
19
  rowKey = props.rowKey,
17
20
  tabKey = props.tabKey,
21
+ hiddenKeys = props.hiddenKeys,
18
22
  onChange = props.onChange;
19
23
  var _useState = useState(value || []),
20
24
  _useState2 = _slicedToArray(_useState, 2),
21
25
  items = _useState2[0],
22
26
  setItems = _useState2[1];
23
- var _useState3 = useState(null),
27
+ var _useState3 = useState([]),
24
28
  _useState4 = _slicedToArray(_useState3, 2),
25
- activeId = _useState4[0],
26
- setActiveId = _useState4[1];
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]);
27
41
  useEffect(function () {
28
42
  // 防止切换的时候数据不更新,拖拽之后,如果切换tab,需要用更新之后的数据
29
43
  setItems(value || []);
@@ -34,25 +48,33 @@ var DragSortTree = function DragSortTree(props) {
34
48
  }
35
49
  }));
36
50
  var handleDragStart = function handleDragStart(event) {
51
+ var _active$id, _active$id$split;
37
52
  var active = event.active;
38
- setActiveId(active === null || active === void 0 ? void 0 : active.id);
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));
39
58
  };
40
59
  var handleDragEnd = function handleDragEnd(event) {
41
60
  var active = event.active,
42
61
  over = event.over;
43
-
44
- // 拖拽结束将这个值设置为空,防止第二次拖拽同一个节点,监听不到这个变化
45
- setActiveId(null);
46
62
  if (!over || !active) return;
47
63
  try {
48
- var _activeId = active.id;
49
- var overId = over.id;
50
- if (_activeId !== overId) {
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
+ }
51
73
  var activeIndex = items.findIndex(function (item) {
52
- return item[rowKey] === _activeId;
74
+ return item[rowKey] == activeId;
53
75
  });
54
76
  var overIndex = items.findIndex(function (item) {
55
- return item[rowKey] === overId;
77
+ return item[rowKey] == overId;
56
78
  });
57
79
  var _lists = arrayMove(items, activeIndex, overIndex);
58
80
  handleChange(_lists);
@@ -72,19 +94,20 @@ var DragSortTree = function DragSortTree(props) {
72
94
  modifiers: [restrictToVerticalAxis, restrictToParentElement]
73
95
  }, /*#__PURE__*/React.createElement(SortableContext, {
74
96
  items: items.map(function (item) {
75
- return item[rowKey];
97
+ return "0-".concat(item[rowKey]);
76
98
  }),
77
99
  strategy: verticalListSortingStrategy
78
100
  }, items.map(function (item) {
79
101
  return /*#__PURE__*/React.createElement(TreeItem, {
80
- key: item[rowKey],
81
- id: item[rowKey],
102
+ key: "0-".concat(item[rowKey]),
103
+ id: "0-".concat(item[rowKey]),
82
104
  item: item,
83
105
  depth: 0,
84
106
  sensors: sensors,
85
- activeId: activeId,
86
107
  childrenProps: props,
87
108
  lists: items,
109
+ expandedKeys: expandedKeys,
110
+ setExpandedKeys: setExpandedKeys,
88
111
  onChange: handleChange
89
112
  });
90
113
  }))));
@@ -0,0 +1,4 @@
1
+ .pisell-lowcode-drag-sort-tree-wrap{
2
+ overflow-y: auto;
3
+ overflow-x: hidden;
4
+ }
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
+ declare type IdType = string | number;
2
3
  export declare type ValueProps = {
3
- id: number | string;
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 {};
@@ -140,6 +140,19 @@ export declare const fieldMaps: {
140
140
  show: (props: import("./types").FieldPropsType) => import("react").JSX.Element;
141
141
  filterFn: typeof import("./treeSelect/filterUtil").default;
142
142
  };
143
+ oldRangePicker: {
144
+ field: {
145
+ field_icon: string;
146
+ field_name: string;
147
+ field_type: string;
148
+ default_value: string;
149
+ };
150
+ config: () => import("react").JSX.Element;
151
+ edit: import("react").ForwardRefExoticComponent<Omit<import("./types").EditPropsType, "ref"> & import("react").RefAttributes<any>>;
152
+ sort: () => import("react").JSX.Element;
153
+ show: (props: import("./types").FieldPropsType) => import("react").JSX.Element;
154
+ filterFn: typeof import("./oldRangePicker/filterUtil").default;
155
+ };
143
156
  };
144
157
  export declare const fieldList: ({
145
158
  field_icon: string;
@@ -196,6 +209,11 @@ export declare const fieldList: ({
196
209
  field_name: string;
197
210
  field_type: string;
198
211
  default_value: string;
212
+ } | {
213
+ field_icon: string;
214
+ field_name: string;
215
+ field_type: string;
216
+ default_value: string;
199
217
  })[];
200
218
  export declare const getFieldByType: (type: string) => {
201
219
  field: {
@@ -351,5 +369,18 @@ declare const _default: {
351
369
  show: (props: import("./types").FieldPropsType) => import("react").JSX.Element;
352
370
  filterFn: typeof import("./treeSelect/filterUtil").default;
353
371
  };
372
+ oldRangePicker: {
373
+ field: {
374
+ field_icon: string;
375
+ field_name: string;
376
+ field_type: string;
377
+ default_value: string;
378
+ };
379
+ config: () => import("react").JSX.Element;
380
+ edit: import("react").ForwardRefExoticComponent<Omit<import("./types").EditPropsType, "ref"> & import("react").RefAttributes<any>>;
381
+ sort: () => import("react").JSX.Element;
382
+ show: (props: import("./types").FieldPropsType) => import("react").JSX.Element;
383
+ filterFn: typeof import("./oldRangePicker/filterUtil").default;
384
+ };
354
385
  };
355
386
  export default _default;
@@ -9,6 +9,7 @@ import rangePicker from "./rangePicker";
9
9
  import search from "./search";
10
10
  import pSwitch from "./pSwitch";
11
11
  import treeSelect from "./treeSelect";
12
+ import oldRangePicker from "./oldRangePicker";
12
13
  export var fieldMaps = {
13
14
  text: text,
14
15
  link: link,
@@ -20,7 +21,8 @@ export var fieldMaps = {
20
21
  search: search,
21
22
  pSwitch: pSwitch,
22
23
  numberRange: numberRange,
23
- treeSelect: treeSelect
24
+ treeSelect: treeSelect,
25
+ oldRangePicker: oldRangePicker
24
26
  };
25
27
  export var fieldList = Object.values(fieldMaps).map(function (d) {
26
28
  return d.field;
@@ -39,5 +41,6 @@ export default {
39
41
  search: search,
40
42
  pSwitch: pSwitch,
41
43
  numberRange: numberRange,
42
- treeSelect: treeSelect
44
+ treeSelect: treeSelect,
45
+ oldRangePicker: oldRangePicker
43
46
  };
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ declare const Config: () => React.JSX.Element;
3
+ export default Config;
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ var Config = function Config() {
3
+ return /*#__PURE__*/React.createElement("div", null);
4
+ };
5
+ export default Config;
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import { EditPropsType } from "../../types";
3
+ declare const _default: React.ForwardRefExoticComponent<Omit<EditPropsType, "ref"> & React.RefAttributes<any>>;
4
+ export default _default;
@@ -0,0 +1,106 @@
1
+ var _excluded = ["value", "onChange", "onPressEnter", "onBlur", "style", "bordered", "presets", "showTime", "format"];
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 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; }
4
+ 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; }
5
+ 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; }
6
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
7
+ 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); }
8
+ 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); }
9
+ 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; }
10
+ 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; }
11
+ import { isArr, isBoolean, isString } from "@pisell/utils";
12
+ import dayjs from "dayjs";
13
+ import React, { forwardRef, useMemo } from "react";
14
+ import DatePicker from "../../../../../date-picker";
15
+ import { getText } from "../../../../../../locales";
16
+ var RangePicker = DatePicker.OldRangePicker;
17
+ var defaultFormat = "YYYY-MM-DD HH:mm:ss";
18
+ var Edit = function Edit(props, ref) {
19
+ var value = props.value,
20
+ _onChange = props.onChange,
21
+ onPressEnter = props.onPressEnter,
22
+ onBlur = props.onBlur,
23
+ style = props.style,
24
+ bordered = props.bordered,
25
+ presets = props.presets,
26
+ showTime = props.showTime,
27
+ format = props.format,
28
+ others = _objectWithoutProperties(props, _excluded);
29
+ var dayjsVal = useMemo(function () {
30
+ if (isString(value)) {
31
+ return dayjs(value);
32
+ }
33
+ if (isArr(value)) {
34
+ if (value.some(function (item) {
35
+ return !item;
36
+ })) {
37
+ return [];
38
+ }
39
+ return value.map(function (item) {
40
+ return dayjs(item);
41
+ });
42
+ }
43
+ return value;
44
+ }, [value]);
45
+ var rangePresets = [{
46
+ label: getText("table-action-range-picker-presets-today"),
47
+ value: [dayjs().startOf("day"), dayjs().endOf("day")]
48
+ }, {
49
+ label: getText("table-action-range-picker-presets-yesterday"),
50
+ value: [dayjs().add(-1, "d").startOf("day"), dayjs().add(-1, "d").endOf("day")]
51
+ }, {
52
+ label: getText("table-action-range-picker-presets-last-3-day"),
53
+ value: [dayjs().add(-3, "d").startOf("day"), dayjs().endOf("day")]
54
+ }, {
55
+ label: getText("table-action-range-picker-presets-last-7-day"),
56
+ value: [dayjs().add(-7, "d").startOf("day"), dayjs().endOf("day")]
57
+ }, {
58
+ label: getText("table-action-range-picker-presets-last-14-day"),
59
+ value: [dayjs().add(-14, "d").startOf("day"), dayjs().endOf("day")]
60
+ }, {
61
+ label: getText("table-action-range-picker-presets-last-30-day"),
62
+ value: [dayjs().add(-30, "d").startOf("day"), dayjs().endOf("day")]
63
+ }, {
64
+ label: getText("table-action-range-picker-presets-last-90-day"),
65
+ value: [dayjs().add(-90, "d").startOf("day"), dayjs().endOf("day")]
66
+ }];
67
+ var _showTime = useMemo(function () {
68
+ if (isBoolean(showTime)) {
69
+ return showTime;
70
+ } else if (_typeof(showTime) === "object") {
71
+ return showTime;
72
+ }
73
+ return true;
74
+ }, [showTime]);
75
+ return /*#__PURE__*/React.createElement(RangePicker, _extends({}, others, {
76
+ format: format,
77
+ showTime: _showTime,
78
+ presets: presets || rangePresets,
79
+ ref: ref,
80
+ value: dayjsVal,
81
+ onChange: function onChange(date) {
82
+ _onChange === null || _onChange === void 0 ? void 0 : _onChange(date === null || date === void 0 ? void 0 : date.map(function (item) {
83
+ var _item$format;
84
+ return (item === null || item === void 0 ? void 0 : (_item$format = item.format) === null || _item$format === void 0 ? void 0 : _item$format.call(item, defaultFormat)) || null;
85
+ }));
86
+ },
87
+ onPressEnter: onPressEnter,
88
+ onBlur: onBlur,
89
+ style: _objectSpread({
90
+ width: "220px"
91
+ }, style),
92
+ bordered: bordered,
93
+ onClick: function onClick(e) {
94
+ return e.stopPropagation();
95
+ },
96
+ panelRender: function panelRender(dom) {
97
+ // 面板点击时阻止外部toggleEdit
98
+ return /*#__PURE__*/React.createElement("div", {
99
+ onClick: function onClick(e) {
100
+ return e.stopPropagation();
101
+ }
102
+ }, dom);
103
+ }
104
+ }));
105
+ };
106
+ export default /*#__PURE__*/forwardRef(Edit);
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import { FieldPropsType } from "../../types";
3
+ declare const Show: (props: FieldPropsType) => React.JSX.Element;
4
+ export default Show;
@@ -0,0 +1,17 @@
1
+ var _excluded = ["title", "editable", "dataIndex", "field_type", "record", "handleSave"];
2
+ 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; }
3
+ 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; }
4
+ import React from "react";
5
+ var Show = function Show(props) {
6
+ var title = props.title,
7
+ editable = props.editable,
8
+ dataIndex = props.dataIndex,
9
+ field_type = props.field_type,
10
+ record = props.record,
11
+ handleSave = props.handleSave,
12
+ restProps = _objectWithoutProperties(props, _excluded);
13
+ return /*#__PURE__*/React.createElement("div", {
14
+ className: ""
15
+ }, record[dataIndex]);
16
+ };
17
+ export default Show;
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ declare const Sort: () => React.JSX.Element;
3
+ export default Sort;