@pisell/materials 3.0.32 → 3.0.34
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/date-picker/index.js +2 -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/lib/components/date-picker/index.js +1 -0
- 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/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/information-modal/meta.ts +1888 -0
- package/lowcode/pisell-text/meta.ts +8117 -0
- package/lowcode/table/meta.ts +18 -0
- package/package.json +4 -4
|
@@ -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;
|
|
@@ -2,16 +2,16 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
|
|
|
2
2
|
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; }
|
|
3
3
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
4
4
|
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); }
|
|
5
|
-
import React, { useMemo } from
|
|
6
|
-
import { Button, Dropdown, Popover } from
|
|
7
|
-
import classNames from
|
|
8
|
-
import { CheckOutlined } from
|
|
9
|
-
import SwitchVertical01 from
|
|
5
|
+
import React, { useMemo } from 'react';
|
|
6
|
+
import { Button, Dropdown, Popover } from 'antd';
|
|
7
|
+
import classNames from 'classnames';
|
|
8
|
+
import { CheckOutlined } from '@ant-design/icons';
|
|
9
|
+
import SwitchVertical01 from '@pisell/icon/es/SwitchVertical01';
|
|
10
10
|
import { isMobile } from "../../utils/platform";
|
|
11
11
|
import { getText } from "../../locales";
|
|
12
12
|
import InlineMenu from "./components/InlineMenu";
|
|
13
13
|
import "./index.less";
|
|
14
|
-
var prefix =
|
|
14
|
+
var prefix = 'pisell-lowcode-';
|
|
15
15
|
var Label = function Label(_ref) {
|
|
16
16
|
var content = _ref.content;
|
|
17
17
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -21,53 +21,53 @@ var Label = function Label(_ref) {
|
|
|
21
21
|
var sortChildrenMap = {
|
|
22
22
|
date: function date(key, isLocal) {
|
|
23
23
|
return [{
|
|
24
|
-
key: "".concat(key, ":
|
|
24
|
+
key: "".concat(key, ":asc").concat(isLocal ? ':date' : ''),
|
|
25
25
|
label: /*#__PURE__*/React.createElement(Label, {
|
|
26
|
-
content: getText(
|
|
26
|
+
content: getText('sort-oldest-to-newest')
|
|
27
27
|
})
|
|
28
28
|
}, {
|
|
29
|
-
key: "".concat(key, ":
|
|
29
|
+
key: "".concat(key, ":desc").concat(isLocal ? ':date' : ''),
|
|
30
30
|
label: /*#__PURE__*/React.createElement(Label, {
|
|
31
|
-
content: getText(
|
|
31
|
+
content: getText('sort-newest-to-oldest')
|
|
32
32
|
})
|
|
33
33
|
}];
|
|
34
34
|
},
|
|
35
35
|
time: function time(key, isLocal) {
|
|
36
36
|
return [{
|
|
37
|
-
key: "".concat(key, ":desc").concat(isLocal ?
|
|
37
|
+
key: "".concat(key, ":desc").concat(isLocal ? ':time' : ''),
|
|
38
38
|
label: /*#__PURE__*/React.createElement(Label, {
|
|
39
|
-
content: getText(
|
|
39
|
+
content: getText('sort-from-morning-to-night')
|
|
40
40
|
})
|
|
41
41
|
}, {
|
|
42
|
-
key: "".concat(key, ":asc").concat(isLocal ?
|
|
42
|
+
key: "".concat(key, ":asc").concat(isLocal ? ':time' : ''),
|
|
43
43
|
label: /*#__PURE__*/React.createElement(Label, {
|
|
44
|
-
content: getText(
|
|
44
|
+
content: getText('sort-from-evening-to-morning')
|
|
45
45
|
})
|
|
46
46
|
}];
|
|
47
47
|
},
|
|
48
48
|
string: function string(key, isLocal) {
|
|
49
49
|
return [{
|
|
50
|
-
key: "".concat(key, ":asc").concat(isLocal ?
|
|
50
|
+
key: "".concat(key, ":asc").concat(isLocal ? ':string' : ''),
|
|
51
51
|
label: /*#__PURE__*/React.createElement(Label, {
|
|
52
|
-
content: getText(
|
|
52
|
+
content: getText('sort-a-z')
|
|
53
53
|
})
|
|
54
54
|
}, {
|
|
55
|
-
key: "".concat(key, ":desc").concat(isLocal ?
|
|
55
|
+
key: "".concat(key, ":desc").concat(isLocal ? ':string' : ''),
|
|
56
56
|
label: /*#__PURE__*/React.createElement(Label, {
|
|
57
|
-
content: getText(
|
|
57
|
+
content: getText('sort-z-a')
|
|
58
58
|
})
|
|
59
59
|
}];
|
|
60
60
|
},
|
|
61
61
|
number: function number(key, isLocal) {
|
|
62
62
|
return [{
|
|
63
|
-
key: "".concat(key, ":asc").concat(isLocal ?
|
|
63
|
+
key: "".concat(key, ":asc").concat(isLocal ? ':number' : ''),
|
|
64
64
|
label: /*#__PURE__*/React.createElement(Label, {
|
|
65
|
-
content: getText(
|
|
65
|
+
content: getText('sort-0-9')
|
|
66
66
|
})
|
|
67
67
|
}, {
|
|
68
|
-
key: "".concat(key, ":desc").concat(isLocal ?
|
|
68
|
+
key: "".concat(key, ":desc").concat(isLocal ? ':number' : ''),
|
|
69
69
|
label: /*#__PURE__*/React.createElement(Label, {
|
|
70
|
-
content: getText(
|
|
70
|
+
content: getText('sort-9-0')
|
|
71
71
|
})
|
|
72
72
|
}];
|
|
73
73
|
}
|
|
@@ -89,14 +89,14 @@ var Sort = function Sort(_ref2) {
|
|
|
89
89
|
children: sortChildrenMap[d.type](d.name, !!(d !== null && d !== void 0 && d.localFilter)),
|
|
90
90
|
popupClassName: "".concat(prefix, "sort-sub-menu-popup-wrap"),
|
|
91
91
|
// 增加显示隐藏配置
|
|
92
|
-
className: "".concat(d.isHidden ? "".concat(prefix, "sort-menu-wrap-hide") :
|
|
92
|
+
className: "".concat(d.isHidden ? "".concat(prefix, "sort-menu-wrap-hide") : '')
|
|
93
93
|
};
|
|
94
94
|
});
|
|
95
95
|
}, [list, localPagination]);
|
|
96
96
|
var onClick = function onClick(detail) {
|
|
97
97
|
var _detail$keyPath, _detail$keyPath2;
|
|
98
98
|
if (((_detail$keyPath = detail.keyPath) === null || _detail$keyPath === void 0 ? void 0 : _detail$keyPath[0]) === value) {
|
|
99
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(
|
|
99
|
+
onChange === null || onChange === void 0 ? void 0 : onChange('', detail);
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
102
102
|
onChange === null || onChange === void 0 ? void 0 : onChange(detail === null || detail === void 0 ? void 0 : (_detail$keyPath2 = detail.keyPath) === null || _detail$keyPath2 === void 0 ? void 0 : _detail$keyPath2[0], detail);
|
|
@@ -108,12 +108,12 @@ var Sort = function Sort(_ref2) {
|
|
|
108
108
|
style: style,
|
|
109
109
|
className: classNames(_defineProperty({}, "".concat(prefix, "sort-button-active"), !!value)),
|
|
110
110
|
size: "large"
|
|
111
|
-
}, isMobileBool ? null : getText(
|
|
111
|
+
}, isMobileBool ? null : getText('sort-button-text'));
|
|
112
112
|
}, [button, style, value, isMobileBool]);
|
|
113
113
|
var content = useMemo(function () {
|
|
114
114
|
return /*#__PURE__*/React.createElement(InlineMenu, {
|
|
115
115
|
items: sortItems,
|
|
116
|
-
value: value ||
|
|
116
|
+
value: value || '',
|
|
117
117
|
onChange: onChange
|
|
118
118
|
});
|
|
119
119
|
}, [value, sortItems, onChange]);
|
|
@@ -123,11 +123,11 @@ var Sort = function Sort(_ref2) {
|
|
|
123
123
|
content: content,
|
|
124
124
|
arrow: false,
|
|
125
125
|
overlayClassName: "".concat(prefix, "mobile-sort-overlay"),
|
|
126
|
-
trigger: [
|
|
126
|
+
trigger: ['click']
|
|
127
127
|
}, btnContent);
|
|
128
128
|
}
|
|
129
129
|
return /*#__PURE__*/React.createElement(Dropdown, {
|
|
130
|
-
trigger: [
|
|
130
|
+
trigger: ['click'],
|
|
131
131
|
placement: placement,
|
|
132
132
|
menu: {
|
|
133
133
|
items: sortItems,
|
|
@@ -14,13 +14,13 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
|
|
|
14
14
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
15
|
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; }
|
|
16
16
|
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; }
|
|
17
|
-
import { Table, Form } from
|
|
18
|
-
import React, { useState, useMemo, useCallback, useEffect } from
|
|
17
|
+
import { Table, Form } from 'antd';
|
|
18
|
+
import React, { useState, useMemo, useCallback, useEffect } from 'react';
|
|
19
19
|
import { FormPagination } from "../../Pagination";
|
|
20
20
|
import { calcFilterSort } from "../Table/utils";
|
|
21
21
|
import { useSharedState } from "../../../hooks";
|
|
22
22
|
import { Context } from "../model";
|
|
23
|
-
import { isArr } from
|
|
23
|
+
import { isArr } from '@pisell/utils';
|
|
24
24
|
var BasicTable = function BasicTable(props) {
|
|
25
25
|
var _pagination$pageSizeO;
|
|
26
26
|
var dataSource = props.dataSource,
|
|
@@ -37,14 +37,14 @@ var BasicTable = function BasicTable(props) {
|
|
|
37
37
|
sort = _useState4[0],
|
|
38
38
|
setSort = _useState4[1];
|
|
39
39
|
var form = Form.useFormInstance();
|
|
40
|
-
var formPagination = Form.useWatch(
|
|
40
|
+
var formPagination = Form.useWatch('pagination', {
|
|
41
41
|
form: form,
|
|
42
42
|
preserve: true
|
|
43
43
|
}) || {
|
|
44
44
|
page: 1,
|
|
45
45
|
size: 10
|
|
46
46
|
};
|
|
47
|
-
var group = Form.useWatch(
|
|
47
|
+
var group = Form.useWatch('group_by', {
|
|
48
48
|
form: form,
|
|
49
49
|
preserve: true
|
|
50
50
|
});
|
|
@@ -84,6 +84,7 @@ var BasicTable = function BasicTable(props) {
|
|
|
84
84
|
total: _total
|
|
85
85
|
};
|
|
86
86
|
}, [localPagination, dataSource, formPagination === null || formPagination === void 0 ? void 0 : formPagination.page, formPagination === null || formPagination === void 0 ? void 0 : formPagination.size, filter, sort, other.columns]);
|
|
87
|
+
console.log(pagination, 'wh8888');
|
|
87
88
|
|
|
88
89
|
// 总数
|
|
89
90
|
var total = useMemo(function () {
|
|
@@ -99,19 +100,19 @@ var BasicTable = function BasicTable(props) {
|
|
|
99
100
|
var _expandedRowKeys = [];
|
|
100
101
|
_dataSource === null || _dataSource === void 0 ? void 0 : (_dataSource$list = _dataSource.list) === null || _dataSource$list === void 0 ? void 0 : _dataSource$list.forEach(function (item) {
|
|
101
102
|
if (item.__is_group) {
|
|
102
|
-
_expandedRowKeys.push(item[
|
|
103
|
+
_expandedRowKeys.push(item['__rowKey']);
|
|
103
104
|
}
|
|
104
105
|
});
|
|
105
106
|
return _expandedRowKeys;
|
|
106
107
|
}, [_dataSource === null || _dataSource === void 0 ? void 0 : _dataSource.list]);
|
|
107
108
|
useEffect(function () {
|
|
108
109
|
dispatch({
|
|
109
|
-
type:
|
|
110
|
+
type: 'setCurrentDataSource',
|
|
110
111
|
payload: (_dataSource === null || _dataSource === void 0 ? void 0 : _dataSource.list) || []
|
|
111
112
|
});
|
|
112
113
|
}, [_dataSource === null || _dataSource === void 0 ? void 0 : _dataSource.list]);
|
|
113
114
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Table, _extends({
|
|
114
|
-
key: defaultExpandedRowKeys.join(
|
|
115
|
+
key: defaultExpandedRowKeys.join('-')
|
|
115
116
|
}, other, {
|
|
116
117
|
// 开启分组条件后关闭行选择功能
|
|
117
118
|
rowSelection: isGroup ? false : other === null || other === void 0 ? void 0 : other.rowSelection,
|
|
@@ -132,13 +133,13 @@ var BasicTable = function BasicTable(props) {
|
|
|
132
133
|
return _objectSpread(_objectSpread({}, (other === null || other === void 0 ? void 0 : (_other$onRow = other.onRow) === null || _other$onRow === void 0 ? void 0 : _other$onRow.call(other, record, index)) || {}), {}, {
|
|
133
134
|
__is_group: record.__is_group,
|
|
134
135
|
__is_drag_sort: other.dragSort,
|
|
135
|
-
className: record.__is_group ?
|
|
136
|
+
className: record.__is_group ? 'pisell-lowcode-table-group-row-wrap' : ''
|
|
136
137
|
});
|
|
137
138
|
},
|
|
138
139
|
expandable: {
|
|
139
140
|
defaultExpandAllRows: true
|
|
140
141
|
}
|
|
141
|
-
})), total > ((pagination === null || pagination === void 0 ? void 0 : pagination.pageSize) || (pagination === null || pagination === void 0 ? void 0 : (_pagination$pageSizeO = pagination.pageSizeOptions) === null || _pagination$pageSizeO === void 0 ? void 0 : _pagination$pageSizeO[0]) || 10) ? /*#__PURE__*/React.createElement(Form.Item, {
|
|
142
|
+
})), total > ((pagination === null || pagination === void 0 ? void 0 : pagination.pageSize) || (pagination === null || pagination === void 0 ? void 0 : (_pagination$pageSizeO = pagination.pageSizeOptions) === null || _pagination$pageSizeO === void 0 ? void 0 : _pagination$pageSizeO[0]) || 10) || pagination !== null && pagination !== void 0 && pagination.showPagination && total > 10 ? /*#__PURE__*/React.createElement(Form.Item, {
|
|
142
143
|
name: "pagination"
|
|
143
144
|
}, /*#__PURE__*/React.createElement(FormPagination, _extends({}, pagination, {
|
|
144
145
|
showTotal: _showTotal,
|
|
@@ -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();
|
|
@@ -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;
|
|
@@ -48,11 +48,11 @@ var Label = ({ content }) => {
|
|
|
48
48
|
var sortChildrenMap = {
|
|
49
49
|
date: (key, isLocal) => [
|
|
50
50
|
{
|
|
51
|
-
key: `${key}:
|
|
51
|
+
key: `${key}:asc${isLocal ? ":date" : ""}`,
|
|
52
52
|
label: /* @__PURE__ */ import_react.default.createElement(Label, { content: (0, import_locales.getText)("sort-oldest-to-newest") })
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
|
-
key: `${key}:
|
|
55
|
+
key: `${key}:desc${isLocal ? ":date" : ""}`,
|
|
56
56
|
label: /* @__PURE__ */ import_react.default.createElement(Label, { content: (0, import_locales.getText)("sort-newest-to-oldest") })
|
|
57
57
|
}
|
|
58
58
|
],
|