@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.
- 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 +19 -19
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +19 -19
- package/es/components/Pagination/index.d.ts +1 -1
- package/es/components/date-picker/index.js +2 -1
- package/es/components/drag-sort-tree/TreeItem/index.d.ts +4 -1
- package/es/components/drag-sort-tree/TreeItem/index.js +45 -31
- package/es/components/drag-sort-tree/TreeItem/index.less +44 -12
- package/es/components/drag-sort-tree/index.d.ts +1 -0
- package/es/components/drag-sort-tree/index.js +41 -18
- package/es/components/drag-sort-tree/index.less +4 -0
- package/es/components/drag-sort-tree/types.d.ts +5 -1
- package/es/components/table/Table/fields/index.d.ts +31 -0
- package/es/components/table/Table/fields/index.js +5 -2
- package/es/components/table/Table/fields/oldRangePicker/Config/index.d.ts +3 -0
- package/es/components/table/Table/fields/oldRangePicker/Config/index.js +5 -0
- package/es/components/table/Table/fields/oldRangePicker/Edit/index.d.ts +4 -0
- package/es/components/table/Table/fields/oldRangePicker/Edit/index.js +106 -0
- package/es/components/table/Table/fields/oldRangePicker/Show/index.d.ts +4 -0
- package/es/components/table/Table/fields/oldRangePicker/Show/index.js +17 -0
- package/es/components/table/Table/fields/oldRangePicker/Sort/index.d.ts +3 -0
- package/es/components/table/Table/fields/oldRangePicker/Sort/index.js +5 -0
- package/es/components/table/Table/fields/oldRangePicker/filterUtil/index.d.ts +13 -0
- package/es/components/table/Table/fields/oldRangePicker/filterUtil/index.js +50 -0
- package/es/components/table/Table/fields/oldRangePicker/index.d.ts +16 -0
- package/es/components/table/Table/fields/oldRangePicker/index.js +19 -0
- package/es/locales/en-US.d.ts +1 -0
- package/es/locales/en-US.js +2 -1
- package/es/locales/zh-CN.d.ts +1 -0
- package/es/locales/zh-CN.js +2 -1
- package/es/locales/zh-TW.d.ts +1 -0
- package/es/locales/zh-TW.js +2 -1
- package/lib/components/Pagination/index.d.ts +1 -1
- package/lib/components/date-picker/index.js +1 -0
- package/lib/components/drag-sort-tree/TreeItem/index.d.ts +4 -1
- package/lib/components/drag-sort-tree/TreeItem/index.js +86 -29
- package/lib/components/drag-sort-tree/TreeItem/index.less +44 -12
- package/lib/components/drag-sort-tree/index.d.ts +1 -0
- package/lib/components/drag-sort-tree/index.js +29 -13
- package/lib/components/drag-sort-tree/index.less +4 -0
- package/lib/components/drag-sort-tree/types.d.ts +5 -1
- package/lib/components/table/Table/fields/index.d.ts +31 -0
- package/lib/components/table/Table/fields/index.js +5 -2
- package/lib/components/table/Table/fields/oldRangePicker/Config/index.d.ts +3 -0
- package/lib/components/table/Table/fields/oldRangePicker/Config/index.js +39 -0
- package/lib/components/table/Table/fields/oldRangePicker/Edit/index.d.ts +4 -0
- package/lib/components/table/Table/fields/oldRangePicker/Edit/index.js +131 -0
- package/lib/components/table/Table/fields/oldRangePicker/Show/index.d.ts +4 -0
- package/lib/components/table/Table/fields/oldRangePicker/Show/index.js +48 -0
- package/lib/components/table/Table/fields/oldRangePicker/Sort/index.d.ts +3 -0
- package/lib/components/table/Table/fields/oldRangePicker/Sort/index.js +39 -0
- package/lib/components/table/Table/fields/oldRangePicker/filterUtil/index.d.ts +13 -0
- package/lib/components/table/Table/fields/oldRangePicker/filterUtil/index.js +61 -0
- package/lib/components/table/Table/fields/oldRangePicker/index.d.ts +16 -0
- package/lib/components/table/Table/fields/oldRangePicker/index.js +53 -0
- package/lib/locales/en-US.d.ts +1 -0
- package/lib/locales/en-US.js +2 -1
- package/lib/locales/zh-CN.d.ts +1 -0
- package/lib/locales/zh-CN.js +2 -1
- package/lib/locales/zh-TW.d.ts +1 -0
- package/lib/locales/zh-TW.js +2 -1
- package/lowcode/date-picker.old-range-picker/__screenshots__/date-picker-range-picker-1.png +0 -0
- package/lowcode/date-picker.old-range-picker/__screenshots__/date-picker-range-picker-2.png +0 -0
- package/lowcode/date-picker.old-range-picker/__screenshots__/date-picker-range-picker-3.png +0 -0
- package/lowcode/date-picker.old-range-picker/__screenshots__/date-picker-range-picker-4.png +0 -0
- package/lowcode/date-picker.old-range-picker/meta.ts +305 -0
- package/lowcode/date-picker.old-range-picker/snippets.ts +11 -0
- package/lowcode/date-picker.range-picker/meta.ts +20 -0
- package/lowcode/drag-sort-tree/meta.ts +10 -1
- package/lowcode/table/meta.ts +4 -0
- package/package.json +3 -3
- package/dist/umd/materials.min.css +0 -1
- package/dist/umd/materials.min.js +0 -1
- package/dist/umd/static/DotsSix.57d66266.svg +0 -1
- package/dist/umd/static/arrow-left.e542294f.svg +0 -1
- package/dist/umd/static/arrow-right.763f03e0.svg +0 -1
- package/dist/umd/static/filter-lines.04a54ae9.svg +0 -1
- package/dist/umd/static/help-circle.31c9be40.svg +0 -1
- package/dist/umd/static/switch-vertical-01.7ebe3ba8.svg +0 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Dayjs } from "dayjs";
|
|
2
|
+
/**
|
|
3
|
+
* 判断dataSource日期是否在filters范围内
|
|
4
|
+
* @param value 日期数组
|
|
5
|
+
* @param key 对应日期在对象中的键
|
|
6
|
+
* @param item 包含日期的对象
|
|
7
|
+
* @returns 如果日期在给定范围内返回true,否则返回false
|
|
8
|
+
*/
|
|
9
|
+
export default function ({ value, key, item, }: {
|
|
10
|
+
value: (string | Dayjs)[];
|
|
11
|
+
key: string | string[];
|
|
12
|
+
item: Record<string, any>;
|
|
13
|
+
}): boolean;
|
|
@@ -0,0 +1,50 @@
|
|
|
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 dayjs from "dayjs";
|
|
8
|
+
import { isUndefined } from "@pisell/utils";
|
|
9
|
+
import { getValueByKeys } from "../../utils";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 判断给定的日期是否在指定的日期范围内
|
|
13
|
+
* @param date 给定的日期
|
|
14
|
+
* @param range 指定的日期范围,格式为 [开始日期, 结束日期]
|
|
15
|
+
* @returns 如果给定的日期在指定的日期范围内,则返回 true,否则返回 false
|
|
16
|
+
*/
|
|
17
|
+
function isDateInRange(date, _ref) {
|
|
18
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
19
|
+
startDate = _ref2[0],
|
|
20
|
+
endDate = _ref2[1];
|
|
21
|
+
return date.isSame(startDate) || date.isSame(endDate) || date.isAfter(startDate) && date.isBefore(endDate);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 判断dataSource日期是否在filters范围内
|
|
26
|
+
* @param value 日期数组
|
|
27
|
+
* @param key 对应日期在对象中的键
|
|
28
|
+
* @param item 包含日期的对象
|
|
29
|
+
* @returns 如果日期在给定范围内返回true,否则返回false
|
|
30
|
+
*/
|
|
31
|
+
export default function (_ref3) {
|
|
32
|
+
var value = _ref3.value,
|
|
33
|
+
key = _ref3.key,
|
|
34
|
+
item = _ref3.item;
|
|
35
|
+
if (!value) return true;
|
|
36
|
+
if ((value === null || value === void 0 ? void 0 : value.length) !== 2) return true;
|
|
37
|
+
var valueDayjsObj = value.map(function (item) {
|
|
38
|
+
return dayjs(item || "");
|
|
39
|
+
});
|
|
40
|
+
if (valueDayjsObj.some(function (item) {
|
|
41
|
+
return !item.isValid();
|
|
42
|
+
})) {
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
var dataValue = getValueByKeys(item, key);
|
|
46
|
+
if (isUndefined(dataValue)) return false;
|
|
47
|
+
var dataDayjsObj = dayjs(dataValue);
|
|
48
|
+
if (!dataDayjsObj.isValid()) return false;
|
|
49
|
+
return isDateInRange(dataDayjsObj, valueDayjsObj);
|
|
50
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import filter from "./filterUtil";
|
|
3
|
+
declare const _default: {
|
|
4
|
+
field: {
|
|
5
|
+
field_icon: string;
|
|
6
|
+
field_name: string;
|
|
7
|
+
field_type: string;
|
|
8
|
+
default_value: string;
|
|
9
|
+
};
|
|
10
|
+
config: () => import("react").JSX.Element;
|
|
11
|
+
edit: import("react").ForwardRefExoticComponent<Omit<import("../types").EditPropsType, "ref"> & import("react").RefAttributes<any>>;
|
|
12
|
+
sort: () => import("react").JSX.Element;
|
|
13
|
+
show: (props: import("../types").FieldPropsType) => import("react").JSX.Element;
|
|
14
|
+
filterFn: typeof filter;
|
|
15
|
+
};
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Config from "./Config";
|
|
2
|
+
import Edit from "./Edit";
|
|
3
|
+
import Show from "./Show";
|
|
4
|
+
import Sort from "./Sort";
|
|
5
|
+
import filter from "./filterUtil";
|
|
6
|
+
var field = {
|
|
7
|
+
field_icon: "pi-a-Property3Singlelinetext",
|
|
8
|
+
field_name: "OldRangePicker",
|
|
9
|
+
field_type: "oldRangePicker",
|
|
10
|
+
default_value: "OldRangePicker"
|
|
11
|
+
};
|
|
12
|
+
export default {
|
|
13
|
+
field: field,
|
|
14
|
+
config: Config,
|
|
15
|
+
edit: Edit,
|
|
16
|
+
sort: Sort,
|
|
17
|
+
show: Show,
|
|
18
|
+
filterFn: filter
|
|
19
|
+
};
|
package/es/locales/en-US.d.ts
CHANGED
|
@@ -96,5 +96,6 @@ declare const _default: {
|
|
|
96
96
|
'table-action-export-import-log-err-log': string;
|
|
97
97
|
'table-action-export-import-log-copy': string;
|
|
98
98
|
'table-action-export-import-table-success-copy': string;
|
|
99
|
+
'drag-sort-tree-unavailable-today-tip': string;
|
|
99
100
|
};
|
|
100
101
|
export default _default;
|
package/es/locales/en-US.js
CHANGED
|
@@ -117,5 +117,6 @@ export default {
|
|
|
117
117
|
'table-action-export-import-log-detail-title': 'Import Details',
|
|
118
118
|
'table-action-export-import-log-err-log': 'Failure Log',
|
|
119
119
|
'table-action-export-import-log-copy': 'Copy',
|
|
120
|
-
'table-action-export-import-table-success-copy': 'Copy Success'
|
|
120
|
+
'table-action-export-import-table-success-copy': 'Copy Success',
|
|
121
|
+
'drag-sort-tree-unavailable-today-tip': 'Unavailable today'
|
|
121
122
|
};
|
package/es/locales/zh-CN.d.ts
CHANGED
|
@@ -96,5 +96,6 @@ declare const _default: {
|
|
|
96
96
|
'table-action-export-import-log-err-log': string;
|
|
97
97
|
'table-action-export-import-log-copy': string;
|
|
98
98
|
'table-action-export-import-table-success-copy': string;
|
|
99
|
+
'drag-sort-tree-unavailable-today-tip': string;
|
|
99
100
|
};
|
|
100
101
|
export default _default;
|
package/es/locales/zh-CN.js
CHANGED
|
@@ -117,5 +117,6 @@ export default {
|
|
|
117
117
|
'table-action-export-import-log-detail-title': '导入详情',
|
|
118
118
|
'table-action-export-import-log-err-log': '失败日志',
|
|
119
119
|
'table-action-export-import-log-copy': '复制',
|
|
120
|
-
'table-action-export-import-table-success-copy': '复制成功'
|
|
120
|
+
'table-action-export-import-table-success-copy': '复制成功',
|
|
121
|
+
'drag-sort-tree-unavailable-today-tip': '今日不可用'
|
|
121
122
|
};
|
package/es/locales/zh-TW.d.ts
CHANGED
|
@@ -96,5 +96,6 @@ declare const _default: {
|
|
|
96
96
|
'table-action-export-import-log-err-log': string;
|
|
97
97
|
'table-action-export-import-log-copy': string;
|
|
98
98
|
'table-action-export-import-table-success-copy': string;
|
|
99
|
+
'drag-sort-tree-unavailable-today-tip': string;
|
|
99
100
|
};
|
|
100
101
|
export default _default;
|
package/es/locales/zh-TW.js
CHANGED
|
@@ -117,5 +117,6 @@ export default {
|
|
|
117
117
|
'table-action-export-import-log-detail-title': '導入詳情',
|
|
118
118
|
'table-action-export-import-log-err-log': '失敗日誌',
|
|
119
119
|
'table-action-export-import-log-copy': '復製',
|
|
120
|
-
'table-action-export-import-table-success-copy': '復製成功'
|
|
120
|
+
'table-action-export-import-table-success-copy': '復製成功',
|
|
121
|
+
'drag-sort-tree-unavailable-today-tip': '今日不可用'
|
|
121
122
|
};
|
|
@@ -5,7 +5,7 @@ export declare const paginationConfig: {
|
|
|
5
5
|
className: string;
|
|
6
6
|
defaultCurrent: number;
|
|
7
7
|
showTotal: (total: number, range: [number, number]) => string;
|
|
8
|
-
itemRender: (page: number, type: "
|
|
8
|
+
itemRender: (page: number, type: "next" | "page" | "prev" | "jump-prev" | "jump-next", element: React.ReactNode) => React.ReactNode;
|
|
9
9
|
responsive: boolean;
|
|
10
10
|
size: string;
|
|
11
11
|
};
|
|
@@ -47,4 +47,5 @@ var DatePicker = (0, import_hoc.withMomentProps)(import_antd.DatePicker, [
|
|
|
47
47
|
"value"
|
|
48
48
|
]);
|
|
49
49
|
DatePicker.RangePicker = import_date_picker.RangePicker;
|
|
50
|
+
DatePicker.OldRangePicker = import_date_picker.OldPisellDateRangePicker;
|
|
50
51
|
var date_picker_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;
|
|
@@ -35,6 +35,9 @@ module.exports = __toCommonJS(TreeItem_exports);
|
|
|
35
35
|
var import_react = __toESM(require("react"));
|
|
36
36
|
var import_sortable = require("@dnd-kit/sortable");
|
|
37
37
|
var import_core = require("@dnd-kit/core");
|
|
38
|
+
var import_antd = require("antd");
|
|
39
|
+
var import_DotsSix = __toESM(require("@pisell/icon/es/DotsSix"));
|
|
40
|
+
var import_locales = require("../../../locales");
|
|
38
41
|
var import_utilities = require("@dnd-kit/utilities");
|
|
39
42
|
var import_icons = require("@ant-design/icons");
|
|
40
43
|
var import_sortable2 = require("@dnd-kit/sortable");
|
|
@@ -43,14 +46,25 @@ var import_classnames = __toESM(require("classnames"));
|
|
|
43
46
|
var import_index = require("./index.less");
|
|
44
47
|
var prefix = "pisell-lowcode";
|
|
45
48
|
var TreeItem = (props) => {
|
|
46
|
-
const {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
const {
|
|
50
|
+
id,
|
|
51
|
+
item,
|
|
52
|
+
depth,
|
|
53
|
+
sensors,
|
|
54
|
+
childrenProps,
|
|
55
|
+
lists,
|
|
56
|
+
expandedKeys,
|
|
57
|
+
onChange
|
|
58
|
+
} = props;
|
|
59
|
+
const {
|
|
60
|
+
attributes,
|
|
61
|
+
listeners,
|
|
62
|
+
setNodeRef,
|
|
63
|
+
transform,
|
|
64
|
+
transition,
|
|
65
|
+
isDragging
|
|
66
|
+
} = (0, import_sortable.useSortable)({ id });
|
|
67
|
+
const [isMobile, setIsMobile] = (0, import_react.useState)(window.innerWidth < 600);
|
|
54
68
|
const style = {
|
|
55
69
|
transform: import_utilities.CSS.Transform.toString(transform && { ...transform, scaleY: 1 }),
|
|
56
70
|
transition
|
|
@@ -64,14 +78,14 @@ var TreeItem = (props) => {
|
|
|
64
78
|
if (!over || !active || !lists.length)
|
|
65
79
|
return;
|
|
66
80
|
try {
|
|
67
|
-
let [activeParentId,
|
|
81
|
+
let [activeParentId, activeId] = (_a = active == null ? void 0 : active.id) == null ? void 0 : _a.split("-");
|
|
68
82
|
let [overParentId, overId] = (_b = over == null ? void 0 : over.id) == null ? void 0 : _b.split("-");
|
|
69
83
|
const parentIndex = lists.findIndex(
|
|
70
84
|
(item2) => item2[rowKey] == activeParentId
|
|
71
85
|
);
|
|
72
|
-
if (
|
|
86
|
+
if (activeId !== overId && activeParentId === overParentId && parentIndex !== -1) {
|
|
73
87
|
const activeIndex = item.children.findIndex(
|
|
74
|
-
(item2) => item2[rowKey] ==
|
|
88
|
+
(item2) => item2[rowKey] == activeId
|
|
75
89
|
);
|
|
76
90
|
const overIndex = item.children.findIndex(
|
|
77
91
|
(item2) => item2[rowKey] == overId
|
|
@@ -108,12 +122,7 @@ var TreeItem = (props) => {
|
|
|
108
122
|
var _a;
|
|
109
123
|
if (depth === 0 && ((_a = item.children) == null ? void 0 : _a.length)) {
|
|
110
124
|
const key = item[rowKey];
|
|
111
|
-
|
|
112
|
-
const _ids = expandedKeys.filter((id2) => id2 !== key);
|
|
113
|
-
setExpandedKeys(_ids);
|
|
114
|
-
} else {
|
|
115
|
-
setExpandedKeys([...expandedKeys, key]);
|
|
116
|
-
}
|
|
125
|
+
(childrenProps == null ? void 0 : childrenProps.onHiddenChange) && (childrenProps == null ? void 0 : childrenProps.onHiddenChange(key));
|
|
117
126
|
}
|
|
118
127
|
};
|
|
119
128
|
const renderChildren = (0, import_react.useMemo)(() => {
|
|
@@ -142,7 +151,14 @@ var TreeItem = (props) => {
|
|
|
142
151
|
) : null
|
|
143
152
|
)
|
|
144
153
|
);
|
|
145
|
-
}, [
|
|
154
|
+
}, [
|
|
155
|
+
item.children,
|
|
156
|
+
expandedKeys,
|
|
157
|
+
rowKey,
|
|
158
|
+
lists,
|
|
159
|
+
childrenProps == null ? void 0 : childrenProps.tabKey,
|
|
160
|
+
isDragging
|
|
161
|
+
]);
|
|
146
162
|
const rightIcon = (0, import_react.useMemo)(() => {
|
|
147
163
|
const hiddenRightIcon = childrenProps == null ? void 0 : childrenProps.hiddenRightIcon;
|
|
148
164
|
return !hiddenRightIcon ? /* @__PURE__ */ import_react.default.createElement(
|
|
@@ -156,8 +172,26 @@ var TreeItem = (props) => {
|
|
|
156
172
|
}, [childrenProps == null ? void 0 : childrenProps.hiddenRightIcon, item == null ? void 0 : item.show, lists]);
|
|
157
173
|
const warningIcon = (0, import_react.useMemo)(() => {
|
|
158
174
|
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(
|
|
175
|
+
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(
|
|
176
|
+
import_antd.Tooltip,
|
|
177
|
+
{
|
|
178
|
+
title: (0, import_locales.getText)("drag-sort-tree-unavailable-today-tip"),
|
|
179
|
+
color: "#ffffff",
|
|
180
|
+
overlayInnerStyle: { color: "#344054" }
|
|
181
|
+
},
|
|
182
|
+
/* @__PURE__ */ import_react.default.createElement(import_icons.WarningOutlined, { style: { color: "#FF2020" } })
|
|
183
|
+
)) : null;
|
|
160
184
|
}, [childrenProps == null ? void 0 : childrenProps.hiddenWarningIcon, item == null ? void 0 : item.is_available]);
|
|
185
|
+
const handleWindowResize = () => {
|
|
186
|
+
let windowWidth = window.innerWidth;
|
|
187
|
+
setIsMobile(windowWidth < 600);
|
|
188
|
+
};
|
|
189
|
+
(0, import_react.useEffect)(() => {
|
|
190
|
+
window.addEventListener("resize", handleWindowResize);
|
|
191
|
+
return () => {
|
|
192
|
+
window.removeEventListener("resize", handleWindowResize);
|
|
193
|
+
};
|
|
194
|
+
}, []);
|
|
161
195
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
162
196
|
import_core.DndContext,
|
|
163
197
|
{
|
|
@@ -165,19 +199,42 @@ var TreeItem = (props) => {
|
|
|
165
199
|
modifiers: [import_modifiers.restrictToVerticalAxis, import_modifiers.restrictToParentElement],
|
|
166
200
|
onDragEnd: handleDragEnd
|
|
167
201
|
},
|
|
168
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
202
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
169
203
|
"div",
|
|
170
204
|
{
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
),
|
|
176
|
-
onClick: onSelect
|
|
205
|
+
ref: setNodeRef,
|
|
206
|
+
style,
|
|
207
|
+
...attributes,
|
|
208
|
+
...!isMobile ? listeners : {}
|
|
177
209
|
},
|
|
178
|
-
/* @__PURE__ */ import_react.default.createElement(
|
|
179
|
-
|
|
180
|
-
|
|
210
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
211
|
+
"div",
|
|
212
|
+
{
|
|
213
|
+
className: (0, import_classnames.default)(
|
|
214
|
+
`${prefix}-drag-sort-tree`,
|
|
215
|
+
childrenProps == null ? void 0 : childrenProps.className,
|
|
216
|
+
isMobile ? `${prefix}-drag-sort-phone-tree` : ""
|
|
217
|
+
),
|
|
218
|
+
style: {
|
|
219
|
+
paddingLeft: !depth ? "10px" : `${depth * 40}px`,
|
|
220
|
+
cursor: isDragging ? "grabbing" : "grab"
|
|
221
|
+
},
|
|
222
|
+
onClick: onSelect
|
|
223
|
+
},
|
|
224
|
+
/* @__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(
|
|
225
|
+
import_DotsSix.default,
|
|
226
|
+
{
|
|
227
|
+
...isMobile ? listeners : {},
|
|
228
|
+
className: (0, import_classnames.default)(`${prefix}-drag-sort-tree-item-dot-icon`),
|
|
229
|
+
style: {
|
|
230
|
+
left: isMobile ? !depth ? "-14px" : "12px" : 0
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
) : 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))),
|
|
234
|
+
!depth ? rightIcon : warningIcon
|
|
235
|
+
),
|
|
236
|
+
renderChildren
|
|
237
|
+
)
|
|
181
238
|
);
|
|
182
239
|
};
|
|
183
240
|
var TreeItem_default = TreeItem;
|
|
@@ -5,37 +5,69 @@
|
|
|
5
5
|
display: flex;
|
|
6
6
|
align-items: center;
|
|
7
7
|
justify-content: space-between;
|
|
8
|
-
font-size:
|
|
9
|
-
cursor: pointer;
|
|
8
|
+
font-size: 14px;
|
|
10
9
|
touch-action: none !important;
|
|
11
10
|
width: 100%;
|
|
12
11
|
color: #101828;
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
padding: 9px 10px;
|
|
13
|
+
height: auto;
|
|
14
|
+
position: relative;
|
|
15
|
+
display: flex;
|
|
16
|
+
&:hover {
|
|
17
|
+
background: #F9FAFB;
|
|
18
|
+
border-radius: 6px;
|
|
19
|
+
}
|
|
15
20
|
}
|
|
16
21
|
|
|
17
|
-
&-drag-sort-tree
|
|
18
|
-
|
|
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
|
-
|
|
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
|
+
}
|
|
@@ -37,10 +37,18 @@ var import_core = require("@dnd-kit/core");
|
|
|
37
37
|
var import_sortable = require("@dnd-kit/sortable");
|
|
38
38
|
var import_TreeItem = __toESM(require("./TreeItem"));
|
|
39
39
|
var import_modifiers = require("@dnd-kit/modifiers");
|
|
40
|
+
var import_index = require("./index.less");
|
|
40
41
|
var DragSortTree = (props) => {
|
|
41
|
-
const { value, rowKey, tabKey, onChange } = props;
|
|
42
|
+
const { value, rowKey, tabKey, hiddenKeys, onChange } = props;
|
|
42
43
|
const [items, setItems] = (0, import_react.useState)(value || []);
|
|
43
|
-
const [
|
|
44
|
+
const [expandedKeys, setExpandedKeys] = (0, import_react.useState)([]);
|
|
45
|
+
(0, import_react.useEffect)(() => {
|
|
46
|
+
let keys = value == null ? void 0 : value.map((item) => item[rowKey]);
|
|
47
|
+
keys = keys.filter(
|
|
48
|
+
(key) => (hiddenKeys == null ? void 0 : hiddenKeys.length) ? !hiddenKeys.includes(key) : key
|
|
49
|
+
);
|
|
50
|
+
setExpandedKeys([...keys]);
|
|
51
|
+
}, [hiddenKeys]);
|
|
44
52
|
(0, import_react.useEffect)(() => {
|
|
45
53
|
setItems(value || []);
|
|
46
54
|
}, [tabKey]);
|
|
@@ -52,23 +60,30 @@ var DragSortTree = (props) => {
|
|
|
52
60
|
})
|
|
53
61
|
);
|
|
54
62
|
const handleDragStart = (event) => {
|
|
63
|
+
var _a, _b;
|
|
55
64
|
const { active } = event;
|
|
56
|
-
|
|
65
|
+
const activeId = (_b = (_a = active == null ? void 0 : active.id) == null ? void 0 : _a.split("-")) == null ? void 0 : _b[1];
|
|
66
|
+
const _keys = expandedKeys == null ? void 0 : expandedKeys.filter((key) => key != activeId);
|
|
67
|
+
setExpandedKeys([..._keys]);
|
|
57
68
|
};
|
|
58
69
|
const handleDragEnd = (event) => {
|
|
70
|
+
var _a, _b, _c, _d;
|
|
59
71
|
const { active, over } = event;
|
|
60
|
-
setActiveId(null);
|
|
61
72
|
if (!over || !active)
|
|
62
73
|
return;
|
|
63
74
|
try {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if (
|
|
75
|
+
let activeId = (_b = (_a = active == null ? void 0 : active.id) == null ? void 0 : _a.split("-")) == null ? void 0 : _b[1];
|
|
76
|
+
let overId = (_d = (_c = over == null ? void 0 : over.id) == null ? void 0 : _c.split("-")) == null ? void 0 : _d[1];
|
|
77
|
+
if (activeId !== overId) {
|
|
78
|
+
if (!(hiddenKeys == null ? void 0 : hiddenKeys.includes(Number(activeId)))) {
|
|
79
|
+
const _keys = [...expandedKeys, Number(activeId)];
|
|
80
|
+
setExpandedKeys([..._keys]);
|
|
81
|
+
}
|
|
67
82
|
const activeIndex = items.findIndex(
|
|
68
|
-
(item) => item[rowKey]
|
|
83
|
+
(item) => item[rowKey] == activeId
|
|
69
84
|
);
|
|
70
85
|
const overIndex = items.findIndex(
|
|
71
|
-
(item) => item[rowKey]
|
|
86
|
+
(item) => item[rowKey] == overId
|
|
72
87
|
);
|
|
73
88
|
const _lists = (0, import_sortable.arrayMove)(items, activeIndex, overIndex);
|
|
74
89
|
handleChange(_lists);
|
|
@@ -91,20 +106,21 @@ var DragSortTree = (props) => {
|
|
|
91
106
|
/* @__PURE__ */ import_react.default.createElement(
|
|
92
107
|
import_sortable.SortableContext,
|
|
93
108
|
{
|
|
94
|
-
items: items.map((item) => item[rowKey]),
|
|
109
|
+
items: items.map((item) => `0-${item[rowKey]}`),
|
|
95
110
|
strategy: import_sortable.verticalListSortingStrategy
|
|
96
111
|
},
|
|
97
112
|
items.map((item) => /* @__PURE__ */ import_react.default.createElement(
|
|
98
113
|
import_TreeItem.default,
|
|
99
114
|
{
|
|
100
|
-
key: item[rowKey]
|
|
101
|
-
id: item[rowKey]
|
|
115
|
+
key: `0-${item[rowKey]}`,
|
|
116
|
+
id: `0-${item[rowKey]}`,
|
|
102
117
|
item,
|
|
103
118
|
depth: 0,
|
|
104
119
|
sensors,
|
|
105
|
-
activeId,
|
|
106
120
|
childrenProps: props,
|
|
107
121
|
lists: items,
|
|
122
|
+
expandedKeys,
|
|
123
|
+
setExpandedKeys,
|
|
108
124
|
onChange: handleChange
|
|
109
125
|
}
|
|
110
126
|
))
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
declare type IdType = string | number;
|
|
2
3
|
export declare type ValueProps = {
|
|
3
|
-
id:
|
|
4
|
+
id: IdType;
|
|
4
5
|
title: string;
|
|
5
6
|
show?: boolean;
|
|
6
7
|
is_available?: boolean;
|
|
@@ -16,5 +17,8 @@ export declare type SortType = {
|
|
|
16
17
|
hiddenRightIcon?: boolean;
|
|
17
18
|
hiddenWarningIcon?: boolean;
|
|
18
19
|
tabKey?: string;
|
|
20
|
+
hiddenKeys?: IdType[];
|
|
21
|
+
onHiddenChange?: (value: IdType[]) => void;
|
|
19
22
|
onChange?: (value: ValueProps[]) => void;
|
|
20
23
|
};
|
|
24
|
+
export {};
|
|
@@ -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;
|
|
@@ -46,6 +46,7 @@ var import_rangePicker = __toESM(require("./rangePicker"));
|
|
|
46
46
|
var import_search = __toESM(require("./search"));
|
|
47
47
|
var import_pSwitch = __toESM(require("./pSwitch"));
|
|
48
48
|
var import_treeSelect = __toESM(require("./treeSelect"));
|
|
49
|
+
var import_oldRangePicker = __toESM(require("./oldRangePicker"));
|
|
49
50
|
var fieldMaps = {
|
|
50
51
|
text: import_text.default,
|
|
51
52
|
link: import_link.default,
|
|
@@ -57,7 +58,8 @@ var fieldMaps = {
|
|
|
57
58
|
search: import_search.default,
|
|
58
59
|
pSwitch: import_pSwitch.default,
|
|
59
60
|
numberRange: import_numberRange.default,
|
|
60
|
-
treeSelect: import_treeSelect.default
|
|
61
|
+
treeSelect: import_treeSelect.default,
|
|
62
|
+
oldRangePicker: import_oldRangePicker.default
|
|
61
63
|
};
|
|
62
64
|
var fieldList = Object.values(fieldMaps).map((d) => {
|
|
63
65
|
return d.field;
|
|
@@ -76,7 +78,8 @@ var fields_default = {
|
|
|
76
78
|
search: import_search.default,
|
|
77
79
|
pSwitch: import_pSwitch.default,
|
|
78
80
|
numberRange: import_numberRange.default,
|
|
79
|
-
treeSelect: import_treeSelect.default
|
|
81
|
+
treeSelect: import_treeSelect.default,
|
|
82
|
+
oldRangePicker: import_oldRangePicker.default
|
|
80
83
|
};
|
|
81
84
|
// Annotate the CommonJS export names for ESM import in node:
|
|
82
85
|
0 && (module.exports = {
|