@pisell/materials 3.0.4 → 3.0.6
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/antd/antd-css-compatible-5.17.2.min.js +346 -0
- 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 +3 -3
- 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 +20 -20
- package/es/components/filter/components/FilterButton/index.js +7 -3
- package/es/components/sort/index.js +1 -1
- package/es/components/sort/types.d.ts +1 -0
- package/es/components/table/BasicTable/index.js +10 -0
- package/es/components/table/Table/fields/rangePicker/Edit/index.js +8 -7
- package/es/components/table/Table/index.js +2 -1
- package/es/components/table/Table/tableConfig/body/index.less +0 -2
- package/es/components/table/Table/tableConfig/header/index.d.ts +1 -0
- package/es/components/table/Table/tableConfig/header/index.js +8 -4
- package/es/components/table/Table/utils.d.ts +1 -1
- package/es/components/table/hooks/useTransColumns.d.ts +1 -0
- package/es/components/table/hooks/useTransColumns.js +35 -15
- package/es/components/table/hooks/useTransSortSetting.js +4 -1
- package/es/components/table/hooks/useTriggerValuesChange.js +36 -3
- package/es/components/table/index.less +17 -2
- package/es/locales/en-US.d.ts +7 -0
- package/es/locales/en-US.js +8 -1
- package/es/locales/zh-CN.d.ts +7 -0
- package/es/locales/zh-CN.js +8 -1
- package/es/locales/zh-TW.d.ts +7 -0
- package/es/locales/zh-TW.js +8 -1
- package/lib/components/filter/components/FilterButton/index.js +3 -2
- package/lib/components/sort/index.js +1 -1
- package/lib/components/sort/types.d.ts +1 -0
- package/lib/components/table/BasicTable/index.js +4 -0
- package/lib/components/table/Table/fields/rangePicker/Edit/index.js +8 -7
- package/lib/components/table/Table/index.js +2 -1
- package/lib/components/table/Table/tableConfig/body/index.less +0 -2
- package/lib/components/table/Table/tableConfig/header/index.d.ts +1 -0
- package/lib/components/table/Table/tableConfig/header/index.js +6 -2
- package/lib/components/table/Table/utils.d.ts +1 -1
- package/lib/components/table/hooks/useTransColumns.d.ts +1 -0
- package/lib/components/table/hooks/useTransColumns.js +24 -10
- package/lib/components/table/hooks/useTransSortSetting.js +3 -1
- package/lib/components/table/hooks/useTriggerValuesChange.js +27 -3
- package/lib/components/table/index.less +17 -2
- package/lib/locales/en-US.d.ts +7 -0
- package/lib/locales/en-US.js +8 -1
- package/lib/locales/zh-CN.d.ts +7 -0
- package/lib/locales/zh-CN.js +8 -1
- package/lib/locales/zh-TW.d.ts +7 -0
- package/lib/locales/zh-TW.js +8 -1
- package/lowcode/table/meta.ts +20 -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
|
@@ -38,12 +38,16 @@ var Filter = function Filter(_ref) {
|
|
|
38
38
|
return /*#__PURE__*/React.createElement("div", {
|
|
39
39
|
ref: ref
|
|
40
40
|
}, /*#__PURE__*/React.createElement(Popover, {
|
|
41
|
-
trigger: "click",
|
|
42
41
|
content: content,
|
|
43
|
-
arrow: false
|
|
42
|
+
arrow: false
|
|
43
|
+
// 渲染到当前元素上时页面会闪烁滚动条
|
|
44
|
+
// 渲染到body时内部form等无法继承
|
|
45
|
+
,
|
|
44
46
|
getPopupContainer: function getPopupContainer() {
|
|
45
47
|
return ref.current;
|
|
46
|
-
}
|
|
48
|
+
},
|
|
49
|
+
mouseEnterDelay: 0.1,
|
|
50
|
+
transitionName: "test"
|
|
47
51
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
48
52
|
icon: /*#__PURE__*/React.createElement(FilterLines, null),
|
|
49
53
|
size: "large"
|
|
@@ -86,7 +86,7 @@ var Sort = function Sort(_ref2) {
|
|
|
86
86
|
return {
|
|
87
87
|
key: d.name,
|
|
88
88
|
label: d.label,
|
|
89
|
-
children: sortChildrenMap[d.type](d.name, !!
|
|
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
92
|
});
|
|
@@ -18,6 +18,7 @@ import { Table, Form } from "antd";
|
|
|
18
18
|
import React, { useState, useMemo, useCallback } from "react";
|
|
19
19
|
import { FormPagination } from "../../Pagination";
|
|
20
20
|
import { calcFilterSort } from "../Table/utils";
|
|
21
|
+
import { isArr } from "@pisell/utils";
|
|
21
22
|
var BasicTable = function BasicTable(props) {
|
|
22
23
|
var _pagination$pageSizeO;
|
|
23
24
|
var dataSource = props.dataSource,
|
|
@@ -38,6 +39,13 @@ var BasicTable = function BasicTable(props) {
|
|
|
38
39
|
page: 1,
|
|
39
40
|
size: 10
|
|
40
41
|
};
|
|
42
|
+
var group = Form.useWatch("group_by", {
|
|
43
|
+
form: form,
|
|
44
|
+
preserve: true
|
|
45
|
+
});
|
|
46
|
+
var isGroup = useMemo(function () {
|
|
47
|
+
return isArr(group) && group.length > 0;
|
|
48
|
+
}, [group]);
|
|
41
49
|
var showTotal = pagination.showTotal,
|
|
42
50
|
localPagination = pagination.localPagination;
|
|
43
51
|
var _showTotal = useCallback(function (total, range) {
|
|
@@ -92,6 +100,8 @@ var BasicTable = function BasicTable(props) {
|
|
|
92
100
|
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Table, _extends({
|
|
93
101
|
key: defaultExpandedRowKeys.join("-")
|
|
94
102
|
}, other, {
|
|
103
|
+
// 开启分组条件后关闭行选择功能
|
|
104
|
+
rowSelection: isGroup ? false : other === null || other === void 0 ? void 0 : other.rowSelection,
|
|
95
105
|
virtual: virtual,
|
|
96
106
|
onChange: function onChange(pagination, filters, sorter) {
|
|
97
107
|
form.setFieldsValue({
|
|
@@ -12,6 +12,7 @@ import { isArr, isBoolean, isString } from "@pisell/utils";
|
|
|
12
12
|
import dayjs from "dayjs";
|
|
13
13
|
import React, { forwardRef, useMemo } from "react";
|
|
14
14
|
import DatePicker from "../../../../../date-picker";
|
|
15
|
+
import { getText } from "../../../../../../locales";
|
|
15
16
|
var RangePicker = DatePicker.RangePicker;
|
|
16
17
|
var defaultFormat = "YYYY-MM-DD HH:mm:ss";
|
|
17
18
|
var Edit = function Edit(props, ref) {
|
|
@@ -42,25 +43,25 @@ var Edit = function Edit(props, ref) {
|
|
|
42
43
|
return value;
|
|
43
44
|
}, [value]);
|
|
44
45
|
var rangePresets = [{
|
|
45
|
-
label: "
|
|
46
|
+
label: getText("table-action-range-picker-presets-today"),
|
|
46
47
|
value: [dayjs().startOf("day"), dayjs().endOf("day")]
|
|
47
48
|
}, {
|
|
48
|
-
label: "
|
|
49
|
+
label: getText("table-action-range-picker-presets-yesterday"),
|
|
49
50
|
value: [dayjs().add(-1, "d").startOf("day"), dayjs().add(-1, "d").endOf("day")]
|
|
50
51
|
}, {
|
|
51
|
-
label: "
|
|
52
|
+
label: getText("table-action-range-picker-presets-last-3-day"),
|
|
52
53
|
value: [dayjs().add(-3, "d").startOf("day"), dayjs().endOf("day")]
|
|
53
54
|
}, {
|
|
54
|
-
label: "
|
|
55
|
+
label: getText("table-action-range-picker-presets-last-7-day"),
|
|
55
56
|
value: [dayjs().add(-7, "d").startOf("day"), dayjs().endOf("day")]
|
|
56
57
|
}, {
|
|
57
|
-
label: "
|
|
58
|
+
label: getText("table-action-range-picker-presets-last-14-day"),
|
|
58
59
|
value: [dayjs().add(-14, "d").startOf("day"), dayjs().endOf("day")]
|
|
59
60
|
}, {
|
|
60
|
-
label: "
|
|
61
|
+
label: getText("table-action-range-picker-presets-last-30-day"),
|
|
61
62
|
value: [dayjs().add(-30, "d").startOf("day"), dayjs().endOf("day")]
|
|
62
63
|
}, {
|
|
63
|
-
label: "
|
|
64
|
+
label: getText("table-action-range-picker-presets-last-90-day"),
|
|
64
65
|
value: [dayjs().add(-90, "d").startOf("day"), dayjs().endOf("day")]
|
|
65
66
|
}];
|
|
66
67
|
var _showTime = useMemo(function () {
|
|
@@ -76,7 +76,8 @@ var GridViewTable = function GridViewTable(_ref) {
|
|
|
76
76
|
localPagination: !!(tableProps !== null && tableProps !== void 0 && (_tableProps$paginatio = tableProps.pagination) !== null && _tableProps$paginatio !== void 0 && _tableProps$paginatio.localPagination),
|
|
77
77
|
handleResize: handleResize,
|
|
78
78
|
handleSave: handleSave,
|
|
79
|
-
dragSort: tableProps === null || tableProps === void 0 ? void 0 : tableProps.dragSort
|
|
79
|
+
dragSort: tableProps === null || tableProps === void 0 ? void 0 : tableProps.dragSort,
|
|
80
|
+
bordered: tableProps.bordered
|
|
80
81
|
}),
|
|
81
82
|
columns = _useTransColumns.columns;
|
|
82
83
|
var dataSource = useTransDataSource({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
2
|
var _excluded = ["index"],
|
|
3
|
-
_excluded2 = ["onResize", "width", "field_type", "lock", "editable", "dataIndex"];
|
|
3
|
+
_excluded2 = ["onResize", "width", "field_type", "lock", "editable", "dataIndex", "position"];
|
|
4
4
|
var _templateObject;
|
|
5
5
|
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; }
|
|
6
6
|
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; }
|
|
@@ -29,14 +29,18 @@ var CustomHeaderCell = function CustomHeaderCell(props) {
|
|
|
29
29
|
lock = props.lock,
|
|
30
30
|
editable = props.editable,
|
|
31
31
|
dataIndex = props.dataIndex,
|
|
32
|
+
position = props.position,
|
|
32
33
|
restProps = _objectWithoutProperties(props, _excluded2);
|
|
33
34
|
var isCheckbox = !props.record;
|
|
34
35
|
|
|
35
36
|
// checkbox 不居中, 添加padding
|
|
36
37
|
if (isCheckbox) {
|
|
37
|
-
restProps.style = _objectSpread(
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
restProps.style = _objectSpread({}, restProps.style);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// 最后一列不增加拖拽功能
|
|
42
|
+
if (position === 'end') {
|
|
43
|
+
return /*#__PURE__*/React.createElement("td", restProps, /*#__PURE__*/React.createElement(CellProvider, props));
|
|
40
44
|
}
|
|
41
45
|
return /*#__PURE__*/React.createElement(ResizeCellStyle, {
|
|
42
46
|
width: width || 200,
|
|
@@ -146,7 +146,7 @@ export declare const getSettingKeyArrByMode: ({ filter, columnSetting, dataSourc
|
|
|
146
146
|
sort?: SortType | undefined;
|
|
147
147
|
mode: "" | "localStorage" | "remote";
|
|
148
148
|
currentViewMode: ModeType;
|
|
149
|
-
}) => ("
|
|
149
|
+
}) => ("view_mode" | "column_setting" | "order_by" | "group_by" | "gallery_setting" | "filter_setting")[];
|
|
150
150
|
export declare const omit: (obj: Record<string, any>, keys: string[]) => Record<string, any>;
|
|
151
151
|
export declare const stringify: (obj: Record<string, any>) => string;
|
|
152
152
|
export {};
|
|
@@ -6,6 +6,7 @@ declare type UseTransColumnsProps = {
|
|
|
6
6
|
handleSave?: (row: Record<string, any>) => void;
|
|
7
7
|
handleResize?: (index: number) => (e: any, p2: any) => void;
|
|
8
8
|
dragSort: boolean;
|
|
9
|
+
bordered: boolean;
|
|
9
10
|
};
|
|
10
11
|
declare const useTransColumns: (params: UseTransColumnsProps) => {
|
|
11
12
|
columns: any[];
|
|
@@ -13,26 +13,29 @@ import getColumnSelectProps from "../TableFilter/selectFilter";
|
|
|
13
13
|
import SortIcon from "../TableFilter/SortIcon";
|
|
14
14
|
import { getValueByKeys } from "../Table/fields/utils";
|
|
15
15
|
import { getText } from "../../../locales";
|
|
16
|
-
var genOnCell = function genOnCell(
|
|
16
|
+
var genOnCell = function genOnCell(_ref) {
|
|
17
|
+
var bordered = _ref.bordered,
|
|
18
|
+
position = _ref.position;
|
|
17
19
|
return function (_) {
|
|
18
20
|
var styleObj = {};
|
|
19
21
|
var notGroupStyle = {};
|
|
22
|
+
var borderStr = bordered ? "1px solid #EAECF0" : "";
|
|
20
23
|
if (position === "start") {
|
|
21
24
|
styleObj = {
|
|
22
|
-
borderLeft:
|
|
25
|
+
borderLeft: borderStr,
|
|
23
26
|
borderRadius: "8px 0px 0px 0px",
|
|
24
27
|
padding: "12px"
|
|
25
28
|
};
|
|
26
29
|
notGroupStyle = {
|
|
27
|
-
borderLeft:
|
|
30
|
+
borderLeft: borderStr
|
|
28
31
|
};
|
|
29
32
|
} else if (position === "end") {
|
|
30
33
|
styleObj = {
|
|
31
|
-
borderRight:
|
|
34
|
+
borderRight: borderStr,
|
|
32
35
|
borderRadius: "0px 8px 0px 0px"
|
|
33
36
|
};
|
|
34
37
|
notGroupStyle = {
|
|
35
|
-
borderRight:
|
|
38
|
+
borderRight: borderStr
|
|
36
39
|
};
|
|
37
40
|
}
|
|
38
41
|
return {
|
|
@@ -48,7 +51,8 @@ var useTransColumns = function useTransColumns(params) {
|
|
|
48
51
|
form = params.form,
|
|
49
52
|
handleSave = params.handleSave,
|
|
50
53
|
handleResize = params.handleResize,
|
|
51
|
-
dragSort = params.dragSort
|
|
54
|
+
dragSort = params.dragSort,
|
|
55
|
+
bordered = params.bordered;
|
|
52
56
|
var group = Form.useWatch("group_by", {
|
|
53
57
|
form: form,
|
|
54
58
|
preserve: true
|
|
@@ -60,9 +64,9 @@ var useTransColumns = function useTransColumns(params) {
|
|
|
60
64
|
var fieldCol = columns.find(function (item) {
|
|
61
65
|
return "".concat(item.dataIndex) === groupField;
|
|
62
66
|
});
|
|
63
|
-
var
|
|
64
|
-
render =
|
|
65
|
-
dataIndex =
|
|
67
|
+
var _ref2 = fieldCol || {},
|
|
68
|
+
render = _ref2.render,
|
|
69
|
+
dataIndex = _ref2.dataIndex;
|
|
66
70
|
var dom = /*#__PURE__*/React.createElement("div", null, getValueByKeys(children === null || children === void 0 ? void 0 : children[0], dataIndex || groupField.split(",")));
|
|
67
71
|
if (render) {
|
|
68
72
|
dom = render(getValueByKeys(children === null || children === void 0 ? void 0 : children[0], dataIndex), record.children[0]);
|
|
@@ -87,7 +91,8 @@ var useTransColumns = function useTransColumns(params) {
|
|
|
87
91
|
newColumns.unshift({
|
|
88
92
|
key: "__sort",
|
|
89
93
|
width: 60,
|
|
90
|
-
align: "center"
|
|
94
|
+
align: "center",
|
|
95
|
+
className: "drag-sort-cell"
|
|
91
96
|
});
|
|
92
97
|
}
|
|
93
98
|
return newColumns.map(function (col, index) {
|
|
@@ -103,16 +108,27 @@ var useTransColumns = function useTransColumns(params) {
|
|
|
103
108
|
position = "end";
|
|
104
109
|
}
|
|
105
110
|
var groupObj = {};
|
|
111
|
+
if (groupField) {
|
|
112
|
+
groupObj = {
|
|
113
|
+
render: function render(text, record) {
|
|
114
|
+
var _col$render;
|
|
115
|
+
if (record.__is_group) {
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
return (col === null || col === void 0 ? void 0 : (_col$render = col.render) === null || _col$render === void 0 ? void 0 : _col$render.call(col, text, record)) || text;
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
}
|
|
106
122
|
if (position === "start" && groupField) {
|
|
107
123
|
groupObj = {
|
|
108
124
|
fixed: "left",
|
|
109
125
|
width: 350,
|
|
110
126
|
render: function render(text, record) {
|
|
111
|
-
var _col$
|
|
127
|
+
var _col$render2;
|
|
112
128
|
if (record.__is_group && groupFieldRender) {
|
|
113
129
|
return groupFieldRender(text, record);
|
|
114
130
|
}
|
|
115
|
-
return (col === null || col === void 0 ? void 0 : (_col$
|
|
131
|
+
return (col === null || col === void 0 ? void 0 : (_col$render2 = col.render) === null || _col$render2 === void 0 ? void 0 : _col$render2.call(col, text, record)) || text;
|
|
116
132
|
}
|
|
117
133
|
};
|
|
118
134
|
}
|
|
@@ -159,7 +175,10 @@ var useTransColumns = function useTransColumns(params) {
|
|
|
159
175
|
onCell: function onCell(record) {
|
|
160
176
|
return _objectSpread(_objectSpread(_objectSpread({
|
|
161
177
|
record: record
|
|
162
|
-
}, item), genOnCell(
|
|
178
|
+
}, item), genOnCell({
|
|
179
|
+
position: position,
|
|
180
|
+
bordered: bordered
|
|
181
|
+
})(record)), {}, {
|
|
163
182
|
handleSave: handleSave
|
|
164
183
|
});
|
|
165
184
|
},
|
|
@@ -167,12 +186,13 @@ var useTransColumns = function useTransColumns(params) {
|
|
|
167
186
|
return _objectSpread(_objectSpread({
|
|
168
187
|
record: record
|
|
169
188
|
}, item), {}, {
|
|
170
|
-
onResize: handleResize === null || handleResize === void 0 ? void 0 : handleResize(index)
|
|
189
|
+
onResize: handleResize === null || handleResize === void 0 ? void 0 : handleResize(index),
|
|
190
|
+
position: position
|
|
171
191
|
});
|
|
172
192
|
}
|
|
173
193
|
});
|
|
174
194
|
});
|
|
175
|
-
}, [columns, groupFieldRender, dragSort, groupField]);
|
|
195
|
+
}, [columns, groupFieldRender, dragSort, groupField, bordered]);
|
|
176
196
|
return {
|
|
177
197
|
columns: _columns
|
|
178
198
|
};
|
|
@@ -5,6 +5,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
5
5
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
6
|
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); }
|
|
7
7
|
import { useMemo } from "react";
|
|
8
|
+
import { isBoolean } from "@pisell/utils";
|
|
8
9
|
var useTransSortSetting = function useTransSortSetting(params) {
|
|
9
10
|
var sort = params.sort,
|
|
10
11
|
originColumnsMap = params.originColumnsMap;
|
|
@@ -15,13 +16,15 @@ var useTransSortSetting = function useTransSortSetting(params) {
|
|
|
15
16
|
var name = item.name,
|
|
16
17
|
label = item.label,
|
|
17
18
|
columnKey = item.columnKey,
|
|
18
|
-
isCustom = item.isCustom
|
|
19
|
+
isCustom = item.isCustom,
|
|
20
|
+
localFilter = item.localFilter;
|
|
19
21
|
if (!isCustom && columnKey && originColumnsMap.has(columnKey)) {
|
|
20
22
|
var column = originColumnsMap.get(columnKey);
|
|
21
23
|
name = column.dataIndex || name;
|
|
22
24
|
label = column.title || label;
|
|
23
25
|
}
|
|
24
26
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
27
|
+
localFilter: isBoolean(localFilter) ? localFilter : true,
|
|
25
28
|
name: name,
|
|
26
29
|
label: label
|
|
27
30
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useCallback } from "react";
|
|
1
|
+
import { useCallback, useRef } from "react";
|
|
2
2
|
import { getSettingKeyArrByMode } from "../Table/utils";
|
|
3
3
|
/**
|
|
4
4
|
* 判断是否触发值变化
|
|
@@ -14,6 +14,10 @@ var useTriggerValuesChange = function useTriggerValuesChange(params) {
|
|
|
14
14
|
var _ref = filter || {},
|
|
15
15
|
list = _ref.list,
|
|
16
16
|
show = _ref.show;
|
|
17
|
+
var _ref2 = sort || {},
|
|
18
|
+
sortList = _ref2.list,
|
|
19
|
+
sortShow = _ref2.show;
|
|
20
|
+
var lastIsRemoteSort = useRef(false);
|
|
17
21
|
var getIsTriggerValuesChange = useCallback(function (changedValues, values) {
|
|
18
22
|
var keys = getSettingKeyArrByMode({
|
|
19
23
|
filter: filter,
|
|
@@ -27,10 +31,38 @@ var useTriggerValuesChange = function useTriggerValuesChange(params) {
|
|
|
27
31
|
if (changedKey === "pagination") {
|
|
28
32
|
return true;
|
|
29
33
|
}
|
|
30
|
-
if (changedKey ===
|
|
34
|
+
if (changedKey === "view_mode") {
|
|
31
35
|
return false;
|
|
32
36
|
}
|
|
33
37
|
|
|
38
|
+
/**
|
|
39
|
+
* 排序变化时,如果排序有远程接口排序,则触发值变化
|
|
40
|
+
*/
|
|
41
|
+
if (changedKey === "order_by") {
|
|
42
|
+
if (sortShow && sortList !== null && sortList !== void 0 && sortList.length) {
|
|
43
|
+
var _value$split, _value$split$call;
|
|
44
|
+
var value = changedValues[changedKey];
|
|
45
|
+
var sortField = (value === null || value === void 0 ? void 0 : (_value$split = value.split) === null || _value$split === void 0 ? void 0 : (_value$split$call = _value$split.call(value, ":")) === null || _value$split$call === void 0 ? void 0 : _value$split$call[0]) || "";
|
|
46
|
+
var remoteSortKeys = sortList.filter(function (item) {
|
|
47
|
+
return !item.localFilter;
|
|
48
|
+
}).map(function (item) {
|
|
49
|
+
var _item$name;
|
|
50
|
+
return (_item$name = item.name) === null || _item$name === void 0 ? void 0 : _item$name.toString();
|
|
51
|
+
});
|
|
52
|
+
var result = remoteSortKeys.includes(sortField);
|
|
53
|
+
// sort值清空时 如果上次更新是远程排序 那么触发onValuesChange
|
|
54
|
+
if (sortField === "" && lastIsRemoteSort.current) {
|
|
55
|
+
lastIsRemoteSort.current = false;
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
// sortField有值时 存入当前是否远程状态
|
|
59
|
+
if (sortField !== "") {
|
|
60
|
+
lastIsRemoteSort.current = result;
|
|
61
|
+
}
|
|
62
|
+
return result;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
34
66
|
/**
|
|
35
67
|
* 过滤器变化时,如果过滤器有远程过滤,则触发值变化
|
|
36
68
|
*/
|
|
@@ -41,7 +73,8 @@ var useTriggerValuesChange = function useTriggerValuesChange(params) {
|
|
|
41
73
|
var remoteFilterKeys = list.filter(function (item) {
|
|
42
74
|
return !item.localFilter;
|
|
43
75
|
}).map(function (item) {
|
|
44
|
-
|
|
76
|
+
var _item$name2;
|
|
77
|
+
return (_item$name2 = item.name) === null || _item$name2 === void 0 ? void 0 : _item$name2.toString();
|
|
45
78
|
});
|
|
46
79
|
return remoteFilterKeys.includes(filterKey);
|
|
47
80
|
}
|
|
@@ -69,10 +69,25 @@
|
|
|
69
69
|
.pisell-lowcode-table-wrapper .pisell-lowcode-table.pisell-lowcode-table-bordered >.pisell-lowcode-table-container {
|
|
70
70
|
border-left: none;
|
|
71
71
|
}
|
|
72
|
-
.pisell-lowcode-table-wrapper .pisell-lowcode-table-thead tr td:first-child {
|
|
72
|
+
.pisell-lowcode-table-wrapper .pisell-lowcode-table-bordered .pisell-lowcode-table-thead tr td:first-child {
|
|
73
73
|
border-left: 1px solid #EAECF0;
|
|
74
74
|
}
|
|
75
|
-
.pisell-lowcode-table-wrapper .pisell-lowcode-table-thead tr th:first-child {
|
|
75
|
+
.pisell-lowcode-table-wrapper .pisell-lowcode-table-bordered .pisell-lowcode-table-thead tr th:first-child {
|
|
76
76
|
border-left: 1px solid #EAECF0;
|
|
77
77
|
}
|
|
78
|
+
div.pisell-lowcode-table-selection-column {
|
|
79
|
+
display: flex;
|
|
80
|
+
align-items: center;
|
|
81
|
+
justify-content: center;
|
|
82
|
+
}
|
|
83
|
+
.pisell-lowcode-table-bordered .pisell-lowcode-table-tbody .pisell-lowcode-table-selection-column {
|
|
84
|
+
border-left: 1px solid #EAECF0;
|
|
85
|
+
}
|
|
86
|
+
.drag-sort-cell {
|
|
87
|
+
.editable-cell-value-wrap {
|
|
88
|
+
display: flex;
|
|
89
|
+
align-items: center;
|
|
90
|
+
justify-content: center;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
78
93
|
}
|
package/es/locales/en-US.d.ts
CHANGED
|
@@ -28,5 +28,12 @@ declare const _default: {
|
|
|
28
28
|
"table-column-group-records": string;
|
|
29
29
|
"table-column-drag-sort-disabled-tip": string;
|
|
30
30
|
"table-action-filter-no-filter": string;
|
|
31
|
+
"table-action-range-picker-presets-today": string;
|
|
32
|
+
"table-action-range-picker-presets-yesterday": string;
|
|
33
|
+
"table-action-range-picker-presets-last-3-day": string;
|
|
34
|
+
"table-action-range-picker-presets-last-7-day": string;
|
|
35
|
+
"table-action-range-picker-presets-last-14-day": string;
|
|
36
|
+
"table-action-range-picker-presets-last-30-day": string;
|
|
37
|
+
"table-action-range-picker-presets-last-90-day": string;
|
|
31
38
|
};
|
|
32
39
|
export default _default;
|
package/es/locales/en-US.js
CHANGED
|
@@ -33,5 +33,12 @@ export default {
|
|
|
33
33
|
"table-action-column-title": "Header settings",
|
|
34
34
|
"table-column-group-records": "records",
|
|
35
35
|
"table-column-drag-sort-disabled-tip": "Automatic sorting is enabled, manual dragging is disabled.",
|
|
36
|
-
"table-action-filter-no-filter": "No filter options available."
|
|
36
|
+
"table-action-filter-no-filter": "No filter options available.",
|
|
37
|
+
"table-action-range-picker-presets-today": "Today",
|
|
38
|
+
"table-action-range-picker-presets-yesterday": "Yesterday",
|
|
39
|
+
"table-action-range-picker-presets-last-3-day": "Last 3 Days",
|
|
40
|
+
"table-action-range-picker-presets-last-7-day": "Last 7 Days",
|
|
41
|
+
"table-action-range-picker-presets-last-14-day": "Last 14 Days",
|
|
42
|
+
"table-action-range-picker-presets-last-30-day": "Last 30 Days",
|
|
43
|
+
"table-action-range-picker-presets-last-90-day": "Last 90 Days"
|
|
37
44
|
};
|
package/es/locales/zh-CN.d.ts
CHANGED
|
@@ -28,5 +28,12 @@ declare const _default: {
|
|
|
28
28
|
"table-column-group-records": string;
|
|
29
29
|
"table-column-drag-sort-disabled-tip": string;
|
|
30
30
|
"table-action-filter-no-filter": string;
|
|
31
|
+
"table-action-range-picker-presets-today": string;
|
|
32
|
+
"table-action-range-picker-presets-yesterday": string;
|
|
33
|
+
"table-action-range-picker-presets-last-3-day": string;
|
|
34
|
+
"table-action-range-picker-presets-last-7-day": string;
|
|
35
|
+
"table-action-range-picker-presets-last-14-day": string;
|
|
36
|
+
"table-action-range-picker-presets-last-30-day": string;
|
|
37
|
+
"table-action-range-picker-presets-last-90-day": string;
|
|
31
38
|
};
|
|
32
39
|
export default _default;
|
package/es/locales/zh-CN.js
CHANGED
|
@@ -33,5 +33,12 @@ export default {
|
|
|
33
33
|
"table-action-column-title": "表头设置",
|
|
34
34
|
"table-column-group-records": "条记录",
|
|
35
35
|
"table-column-drag-sort-disabled-tip": "已开启自动排序,无法手动拖拽",
|
|
36
|
-
"table-action-filter-no-filter": "没有可用的筛选器。"
|
|
36
|
+
"table-action-filter-no-filter": "没有可用的筛选器。",
|
|
37
|
+
"table-action-range-picker-presets-today": "今天",
|
|
38
|
+
"table-action-range-picker-presets-yesterday": "昨天",
|
|
39
|
+
"table-action-range-picker-presets-last-3-day": "过去3天",
|
|
40
|
+
"table-action-range-picker-presets-last-7-day": "过去7天",
|
|
41
|
+
"table-action-range-picker-presets-last-14-day": "过去14天",
|
|
42
|
+
"table-action-range-picker-presets-last-30-day": "过去30天",
|
|
43
|
+
"table-action-range-picker-presets-last-90-day": "过去90天"
|
|
37
44
|
};
|
package/es/locales/zh-TW.d.ts
CHANGED
|
@@ -28,5 +28,12 @@ declare const _default: {
|
|
|
28
28
|
"table-column-group-records": string;
|
|
29
29
|
"table-column-drag-sort-disabled-tip": string;
|
|
30
30
|
"table-action-filter-no-filter": string;
|
|
31
|
+
"table-action-range-picker-presets-today": string;
|
|
32
|
+
"table-action-range-picker-presets-yesterday": string;
|
|
33
|
+
"table-action-range-picker-presets-last-3-day": string;
|
|
34
|
+
"table-action-range-picker-presets-last-7-day": string;
|
|
35
|
+
"table-action-range-picker-presets-last-14-day": string;
|
|
36
|
+
"table-action-range-picker-presets-last-30-day": string;
|
|
37
|
+
"table-action-range-picker-presets-last-90-day": string;
|
|
31
38
|
};
|
|
32
39
|
export default _default;
|
package/es/locales/zh-TW.js
CHANGED
|
@@ -33,5 +33,12 @@ export default {
|
|
|
33
33
|
"table-action-column-title": "表頭設置",
|
|
34
34
|
"table-column-group-records": "條記錄",
|
|
35
35
|
"table-column-drag-sort-disabled-tip": "已開啟自動排序,無法手動拖曳",
|
|
36
|
-
"table-action-filter-no-filter": "沒有可用的篩選器。"
|
|
36
|
+
"table-action-filter-no-filter": "沒有可用的篩選器。",
|
|
37
|
+
"table-action-range-picker-presets-today": "今天",
|
|
38
|
+
"table-action-range-picker-presets-yesterday": "昨天",
|
|
39
|
+
"table-action-range-picker-presets-last-3-day": "過去3天",
|
|
40
|
+
"table-action-range-picker-presets-last-7-day": "過去7天",
|
|
41
|
+
"table-action-range-picker-presets-last-14-day": "過去14天",
|
|
42
|
+
"table-action-range-picker-presets-last-30-day": "過去30天",
|
|
43
|
+
"table-action-range-picker-presets-last-90-day": "過去90天"
|
|
37
44
|
};
|
|
@@ -70,10 +70,11 @@ var Filter = ({
|
|
|
70
70
|
return /* @__PURE__ */ import_react.default.createElement("div", { ref }, /* @__PURE__ */ import_react.default.createElement(
|
|
71
71
|
import_antd.Popover,
|
|
72
72
|
{
|
|
73
|
-
trigger: "click",
|
|
74
73
|
content,
|
|
75
74
|
arrow: false,
|
|
76
|
-
getPopupContainer: () => ref.current
|
|
75
|
+
getPopupContainer: () => ref.current,
|
|
76
|
+
mouseEnterDelay: 0.1,
|
|
77
|
+
transitionName: "test"
|
|
77
78
|
},
|
|
78
79
|
/* @__PURE__ */ import_react.default.createElement(import_antd.Button, { icon: /* @__PURE__ */ import_react.default.createElement(import_FilterLines.default, null), size: "large" }, isMobileBool ? null : (0, import_locales.getText)("table-action-filter-button"))
|
|
79
80
|
));
|
|
@@ -101,7 +101,7 @@ var Sort = ({
|
|
|
101
101
|
return {
|
|
102
102
|
key: d.name,
|
|
103
103
|
label: d.label,
|
|
104
|
-
children: sortChildrenMap[d.type](d.name, !!
|
|
104
|
+
children: sortChildrenMap[d.type](d.name, !!(d == null ? void 0 : d.localFilter)),
|
|
105
105
|
popupClassName: `${prefix}sort-sub-menu-popup-wrap`
|
|
106
106
|
};
|
|
107
107
|
});
|
|
@@ -36,6 +36,7 @@ var import_antd = require("antd");
|
|
|
36
36
|
var import_react = __toESM(require("react"));
|
|
37
37
|
var import_Pagination = require("../../Pagination");
|
|
38
38
|
var import_utils = require("../Table/utils");
|
|
39
|
+
var import_utils2 = require("@pisell/utils");
|
|
39
40
|
var BasicTable = (props) => {
|
|
40
41
|
var _a;
|
|
41
42
|
const { dataSource, pagination, value, virtual, ...other } = props;
|
|
@@ -46,6 +47,8 @@ var BasicTable = (props) => {
|
|
|
46
47
|
page: 1,
|
|
47
48
|
size: 10
|
|
48
49
|
};
|
|
50
|
+
const group = import_antd.Form.useWatch("group_by", { form, preserve: true });
|
|
51
|
+
const isGroup = (0, import_react.useMemo)(() => (0, import_utils2.isArr)(group) && group.length > 0, [group]);
|
|
49
52
|
const { showTotal, localPagination } = pagination;
|
|
50
53
|
const _showTotal = (0, import_react.useCallback)(
|
|
51
54
|
(total2, range) => {
|
|
@@ -105,6 +108,7 @@ var BasicTable = (props) => {
|
|
|
105
108
|
{
|
|
106
109
|
key: defaultExpandedRowKeys.join("-"),
|
|
107
110
|
...other,
|
|
111
|
+
rowSelection: isGroup ? false : other == null ? void 0 : other.rowSelection,
|
|
108
112
|
virtual,
|
|
109
113
|
onChange: (pagination2, filters, sorter) => {
|
|
110
114
|
form.setFieldsValue({
|
|
@@ -36,6 +36,7 @@ var import_utils = require("@pisell/utils");
|
|
|
36
36
|
var import_dayjs = __toESM(require("dayjs"));
|
|
37
37
|
var import_react = __toESM(require("react"));
|
|
38
38
|
var import_date_picker = __toESM(require("../../../../../date-picker"));
|
|
39
|
+
var import_locales = require("../../../../../../locales");
|
|
39
40
|
var { RangePicker } = import_date_picker.default;
|
|
40
41
|
var defaultFormat = "YYYY-MM-DD HH:mm:ss";
|
|
41
42
|
var Edit = (props, ref) => {
|
|
@@ -64,32 +65,32 @@ var Edit = (props, ref) => {
|
|
|
64
65
|
return value;
|
|
65
66
|
}, [value]);
|
|
66
67
|
const rangePresets = [
|
|
67
|
-
{ label: "
|
|
68
|
+
{ label: (0, import_locales.getText)("table-action-range-picker-presets-today"), value: [(0, import_dayjs.default)().startOf("day"), (0, import_dayjs.default)().endOf("day")] },
|
|
68
69
|
{
|
|
69
|
-
label: "
|
|
70
|
+
label: (0, import_locales.getText)("table-action-range-picker-presets-yesterday"),
|
|
70
71
|
value: [
|
|
71
72
|
(0, import_dayjs.default)().add(-1, "d").startOf("day"),
|
|
72
73
|
(0, import_dayjs.default)().add(-1, "d").endOf("day")
|
|
73
74
|
]
|
|
74
75
|
},
|
|
75
76
|
{
|
|
76
|
-
label: "
|
|
77
|
+
label: (0, import_locales.getText)("table-action-range-picker-presets-last-3-day"),
|
|
77
78
|
value: [(0, import_dayjs.default)().add(-3, "d").startOf("day"), (0, import_dayjs.default)().endOf("day")]
|
|
78
79
|
},
|
|
79
80
|
{
|
|
80
|
-
label: "
|
|
81
|
+
label: (0, import_locales.getText)("table-action-range-picker-presets-last-7-day"),
|
|
81
82
|
value: [(0, import_dayjs.default)().add(-7, "d").startOf("day"), (0, import_dayjs.default)().endOf("day")]
|
|
82
83
|
},
|
|
83
84
|
{
|
|
84
|
-
label: "
|
|
85
|
+
label: (0, import_locales.getText)("table-action-range-picker-presets-last-14-day"),
|
|
85
86
|
value: [(0, import_dayjs.default)().add(-14, "d").startOf("day"), (0, import_dayjs.default)().endOf("day")]
|
|
86
87
|
},
|
|
87
88
|
{
|
|
88
|
-
label: "
|
|
89
|
+
label: (0, import_locales.getText)("table-action-range-picker-presets-last-30-day"),
|
|
89
90
|
value: [(0, import_dayjs.default)().add(-30, "d").startOf("day"), (0, import_dayjs.default)().endOf("day")]
|
|
90
91
|
},
|
|
91
92
|
{
|
|
92
|
-
label: "
|
|
93
|
+
label: (0, import_locales.getText)("table-action-range-picker-presets-last-90-day"),
|
|
93
94
|
value: [(0, import_dayjs.default)().add(-90, "d").startOf("day"), (0, import_dayjs.default)().endOf("day")]
|
|
94
95
|
}
|
|
95
96
|
];
|
|
@@ -83,7 +83,8 @@ var GridViewTable = ({ tableProps, filter, setTableSetting, onDataSourceChange }
|
|
|
83
83
|
localPagination: !!((_a = tableProps == null ? void 0 : tableProps.pagination) == null ? void 0 : _a.localPagination),
|
|
84
84
|
handleResize,
|
|
85
85
|
handleSave,
|
|
86
|
-
dragSort: tableProps == null ? void 0 : tableProps.dragSort
|
|
86
|
+
dragSort: tableProps == null ? void 0 : tableProps.dragSort,
|
|
87
|
+
bordered: tableProps.bordered
|
|
87
88
|
});
|
|
88
89
|
const dataSource = (0, import_useTransDataSource.default)({
|
|
89
90
|
dataSource: originDataSource,
|