@pisell/materials 2.2.10 → 2.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +2 -2
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +14 -14
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +13 -13
- package/es/components/Pagination/index.d.ts +1 -1
- package/es/components/date-picker/index.js +2 -1
- package/es/components/drag-sort-tree/TreeItem/index.d.ts +4 -1
- package/es/components/drag-sort-tree/TreeItem/index.js +45 -31
- package/es/components/drag-sort-tree/TreeItem/index.less +44 -13
- package/es/components/drag-sort-tree/index.js +40 -16
- package/es/components/drag-sort-tree/types.d.ts +5 -1
- package/es/components/sort/index.d.ts +3 -3
- package/es/components/sort/index.js +28 -28
- package/es/components/table/BasicTable/index.d.ts +2 -2
- package/es/components/table/BasicTable/index.js +11 -10
- package/es/components/table/Table/fields/index.d.ts +31 -0
- package/es/components/table/Table/fields/index.js +5 -2
- package/es/components/table/Table/fields/oldRangePicker/Config/index.d.ts +3 -0
- package/es/components/table/Table/fields/oldRangePicker/Config/index.js +5 -0
- package/es/components/table/Table/fields/oldRangePicker/Edit/index.d.ts +4 -0
- package/es/components/table/Table/fields/oldRangePicker/Edit/index.js +106 -0
- package/es/components/table/Table/fields/oldRangePicker/Show/index.d.ts +4 -0
- package/es/components/table/Table/fields/oldRangePicker/Show/index.js +17 -0
- package/es/components/table/Table/fields/oldRangePicker/Sort/index.d.ts +3 -0
- package/es/components/table/Table/fields/oldRangePicker/Sort/index.js +5 -0
- package/es/components/table/Table/fields/oldRangePicker/filterUtil/index.d.ts +13 -0
- package/es/components/table/Table/fields/oldRangePicker/filterUtil/index.js +50 -0
- package/es/components/table/Table/fields/oldRangePicker/index.d.ts +16 -0
- package/es/components/table/Table/fields/oldRangePicker/index.js +19 -0
- package/es/components/table/Table/utils.js +1 -1
- package/es/locales/en-US.d.ts +1 -0
- package/es/locales/en-US.js +2 -1
- package/es/locales/zh-CN.d.ts +1 -0
- package/es/locales/zh-CN.js +2 -1
- package/es/locales/zh-TW.d.ts +1 -0
- package/es/locales/zh-TW.js +2 -1
- package/lib/components/Pagination/index.d.ts +1 -1
- package/lib/components/date-picker/index.js +1 -0
- package/lib/components/drag-sort-tree/TreeItem/index.d.ts +4 -1
- package/lib/components/drag-sort-tree/TreeItem/index.js +86 -29
- package/lib/components/drag-sort-tree/TreeItem/index.less +44 -13
- package/lib/components/drag-sort-tree/index.js +28 -13
- package/lib/components/drag-sort-tree/types.d.ts +5 -1
- package/lib/components/sort/index.d.ts +3 -3
- package/lib/components/sort/index.js +2 -2
- package/lib/components/table/BasicTable/index.d.ts +2 -2
- package/lib/components/table/BasicTable/index.js +6 -2
- package/lib/components/table/Table/fields/index.d.ts +31 -0
- package/lib/components/table/Table/fields/index.js +5 -2
- package/lib/components/table/Table/fields/oldRangePicker/Config/index.d.ts +3 -0
- package/lib/components/table/Table/fields/oldRangePicker/Config/index.js +39 -0
- package/lib/components/table/Table/fields/oldRangePicker/Edit/index.d.ts +4 -0
- package/lib/components/table/Table/fields/oldRangePicker/Edit/index.js +131 -0
- package/lib/components/table/Table/fields/oldRangePicker/Show/index.d.ts +4 -0
- package/lib/components/table/Table/fields/oldRangePicker/Show/index.js +48 -0
- package/lib/components/table/Table/fields/oldRangePicker/Sort/index.d.ts +3 -0
- package/lib/components/table/Table/fields/oldRangePicker/Sort/index.js +39 -0
- package/lib/components/table/Table/fields/oldRangePicker/filterUtil/index.d.ts +13 -0
- package/lib/components/table/Table/fields/oldRangePicker/filterUtil/index.js +61 -0
- package/lib/components/table/Table/fields/oldRangePicker/index.d.ts +16 -0
- package/lib/components/table/Table/fields/oldRangePicker/index.js +53 -0
- package/lib/components/table/Table/utils.js +1 -1
- package/lib/locales/en-US.d.ts +1 -0
- package/lib/locales/en-US.js +2 -1
- package/lib/locales/zh-CN.d.ts +1 -0
- package/lib/locales/zh-CN.js +2 -1
- package/lib/locales/zh-TW.d.ts +1 -0
- package/lib/locales/zh-TW.js +2 -1
- package/lowcode/date-picker.old-range-picker/__screenshots__/date-picker-range-picker-1.png +0 -0
- package/lowcode/date-picker.old-range-picker/__screenshots__/date-picker-range-picker-2.png +0 -0
- package/lowcode/date-picker.old-range-picker/__screenshots__/date-picker-range-picker-3.png +0 -0
- package/lowcode/date-picker.old-range-picker/__screenshots__/date-picker-range-picker-4.png +0 -0
- package/lowcode/date-picker.old-range-picker/meta.ts +305 -0
- package/lowcode/date-picker.old-range-picker/snippets.ts +11 -0
- package/lowcode/drag-sort-tree/meta.ts +10 -1
- package/lowcode/table/meta.ts +18 -0
- package/package.json +4 -4
|
@@ -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,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,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,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
|
+
};
|
|
@@ -181,7 +181,7 @@ export var sortDataSource = function sortDataSource(dataSource, sortObj) {
|
|
|
181
181
|
}
|
|
182
182
|
// 对比日期排序
|
|
183
183
|
if (sortType === "date") {
|
|
184
|
-
if (sortValue
|
|
184
|
+
if (sortValue !== "asc") {
|
|
185
185
|
return new Date(bValue).getTime() - new Date(aValue).getTime();
|
|
186
186
|
}
|
|
187
187
|
return new Date(aValue).getTime() - new Date(bValue).getTime();
|
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;
|