@pisell/materials 1.0.66 → 1.0.68
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 +1 -1
- package/build/lowcode/preview.js +7 -7
- package/build/lowcode/render/default/view.js +6 -4
- package/build/lowcode/view.js +5 -3
- package/dist/umd/materials.min.css +1 -0
- package/dist/umd/materials.min.js +1 -0
- package/dist/umd/static/DotsSix.57d66266.svg +1 -0
- package/dist/umd/static/arrow-left.e542294f.svg +1 -0
- package/dist/umd/static/arrow-right.763f03e0.svg +1 -0
- package/dist/umd/static/filter-lines.04a54ae9.svg +1 -0
- package/dist/umd/static/help-circle.31c9be40.svg +1 -0
- package/dist/umd/static/switch-vertical-01.7ebe3ba8.svg +1 -0
- package/es/components/drawer/index.js +0 -1
- package/es/components/filter/components/FilterItem/index.js +3 -2
- package/es/components/table/BasicTable/index.js +49 -8
- package/es/components/table/Table/AddFieldModal/index.js +0 -1
- package/es/components/table/Table/fields/index.d.ts +29 -0
- package/es/components/table/Table/fields/index.js +5 -2
- package/es/components/table/Table/fields/pSwitch/Config/index.d.ts +3 -0
- package/es/components/table/Table/fields/pSwitch/Config/index.js +4 -0
- package/es/components/table/Table/fields/pSwitch/Edit/index.d.ts +4 -0
- package/es/components/table/Table/fields/pSwitch/Edit/index.js +12 -0
- package/es/components/table/Table/fields/pSwitch/Show/index.d.ts +4 -0
- package/es/components/table/Table/fields/pSwitch/Show/index.js +24 -0
- package/es/components/table/Table/fields/pSwitch/Sort/index.d.ts +3 -0
- package/es/components/table/Table/fields/pSwitch/Sort/index.js +4 -0
- package/es/components/table/Table/fields/pSwitch/index.d.ts +14 -0
- package/es/components/table/Table/fields/pSwitch/index.js +17 -0
- package/es/components/table/Table/fields/rangePicker/Edit/index.js +0 -1
- package/es/components/table/Table/fields/types/index.d.ts +2 -1
- package/es/components/table/Table/index.js +36 -2
- package/es/components/table/Table/tableConfig/body/CellProvider/index.js +5 -1
- package/es/components/table/Table/tableConfig/body/index.d.ts +1 -0
- package/es/components/table/Table/tableConfig/body/index.js +2 -1
- package/es/components/table/Table/tableConfig/header/CellProvider/index.less +1 -1
- package/es/components/table/Table/tableConfig/summary/index.js +0 -1
- package/es/components/table/Table/utils.d.ts +1 -0
- package/es/components/table/Table/utils.js +70 -0
- package/es/components/table/TableFilter/SortIcon.d.ts +6 -0
- package/es/components/table/TableFilter/SortIcon.js +30 -0
- package/es/components/table/TableFilter/index.less +14 -0
- package/es/components/table/TableFilter/numberFilter.d.ts +6 -0
- package/es/components/table/TableFilter/numberFilter.js +95 -0
- package/es/components/table/TableFilter/selectFilter.d.ts +10 -0
- package/es/components/table/TableFilter/selectFilter.js +126 -0
- package/es/components/table/TableFilter/stringFilter.d.ts +6 -0
- package/es/components/table/TableFilter/stringFilter.js +71 -0
- package/es/components/table/index.js +2 -1
- package/es/components/table/index.less +49 -1
- package/lib/components/drawer/index.js +0 -1
- package/lib/components/filter/components/FilterItem/index.js +1 -1
- package/lib/components/table/BasicTable/index.js +44 -8
- package/lib/components/table/Table/AddFieldModal/index.js +0 -1
- package/lib/components/table/Table/fields/index.d.ts +29 -0
- package/lib/components/table/Table/fields/index.js +5 -2
- package/lib/components/table/Table/fields/pSwitch/Config/index.d.ts +3 -0
- package/lib/components/table/Table/fields/pSwitch/Config/index.js +28 -0
- package/lib/components/table/Table/fields/pSwitch/Edit/index.d.ts +4 -0
- package/lib/components/table/Table/fields/pSwitch/Edit/index.js +41 -0
- package/lib/components/table/Table/fields/pSwitch/Show/index.d.ts +4 -0
- package/lib/components/table/Table/fields/pSwitch/Show/index.js +58 -0
- package/lib/components/table/Table/fields/pSwitch/Sort/index.d.ts +3 -0
- package/lib/components/table/Table/fields/pSwitch/Sort/index.js +28 -0
- package/lib/components/table/Table/fields/pSwitch/index.d.ts +14 -0
- package/lib/components/table/Table/fields/pSwitch/index.js +51 -0
- package/lib/components/table/Table/fields/rangePicker/Edit/index.js +0 -1
- package/lib/components/table/Table/fields/types/index.d.ts +2 -1
- package/lib/components/table/Table/index.js +27 -1
- package/lib/components/table/Table/tableConfig/body/CellProvider/index.js +5 -1
- package/lib/components/table/Table/tableConfig/body/index.d.ts +1 -0
- package/lib/components/table/Table/tableConfig/body/index.js +1 -0
- package/lib/components/table/Table/tableConfig/header/CellProvider/index.less +1 -1
- package/lib/components/table/Table/tableConfig/summary/index.js +0 -1
- package/lib/components/table/Table/utils.d.ts +1 -0
- package/lib/components/table/Table/utils.js +108 -0
- package/lib/components/table/TableFilter/SortIcon.d.ts +6 -0
- package/lib/components/table/TableFilter/SortIcon.js +59 -0
- package/lib/components/table/TableFilter/index.less +14 -0
- package/lib/components/table/TableFilter/numberFilter.d.ts +6 -0
- package/lib/components/table/TableFilter/numberFilter.js +110 -0
- package/lib/components/table/TableFilter/selectFilter.d.ts +10 -0
- package/lib/components/table/TableFilter/selectFilter.js +123 -0
- package/lib/components/table/TableFilter/stringFilter.d.ts +6 -0
- package/lib/components/table/TableFilter/stringFilter.js +97 -0
- package/lib/components/table/index.js +1 -1
- package/lib/components/table/index.less +49 -1
- package/package.json +1 -1
|
@@ -0,0 +1,95 @@
|
|
|
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
|
+
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; }
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
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
|
+
import React from "react";
|
|
8
|
+
import { Button, InputNumber, Space } from "antd";
|
|
9
|
+
import { FilterFunnel01, FilterFunnel01Fill } from "@pisell/icon";
|
|
10
|
+
import "./index.less";
|
|
11
|
+
var getColumnNumberProps = function getColumnNumberProps(_ref) {
|
|
12
|
+
var dataIndex = _ref.dataIndex;
|
|
13
|
+
return {
|
|
14
|
+
filterDropdown: function filterDropdown(_ref2) {
|
|
15
|
+
var _selectedKeys$, _selectedKeys$2;
|
|
16
|
+
var setSelectedKeys = _ref2.setSelectedKeys,
|
|
17
|
+
selectedKeys = _ref2.selectedKeys,
|
|
18
|
+
confirm = _ref2.confirm,
|
|
19
|
+
clearFilters = _ref2.clearFilters,
|
|
20
|
+
close = _ref2.close;
|
|
21
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
22
|
+
onKeyDown: function onKeyDown(e) {
|
|
23
|
+
return e.stopPropagation();
|
|
24
|
+
},
|
|
25
|
+
className: "pisell-table-filter-dropdown"
|
|
26
|
+
}, /*#__PURE__*/React.createElement(Space, {
|
|
27
|
+
split: "-",
|
|
28
|
+
className: "pisell-table-filter-dropdown-top"
|
|
29
|
+
}, /*#__PURE__*/React.createElement(InputNumber, {
|
|
30
|
+
value: selectedKeys === null || selectedKeys === void 0 ? void 0 : (_selectedKeys$ = selectedKeys[0]) === null || _selectedKeys$ === void 0 ? void 0 : _selectedKeys$.min,
|
|
31
|
+
onChange: function onChange(value) {
|
|
32
|
+
var newVal = _objectSpread(_objectSpread({}, (selectedKeys === null || selectedKeys === void 0 ? void 0 : selectedKeys[0]) || {}), {}, {
|
|
33
|
+
min: value
|
|
34
|
+
});
|
|
35
|
+
setSelectedKeys([newVal]);
|
|
36
|
+
},
|
|
37
|
+
placeholder: "Min",
|
|
38
|
+
onPressEnter: function onPressEnter() {
|
|
39
|
+
return confirm();
|
|
40
|
+
},
|
|
41
|
+
style: {
|
|
42
|
+
width: 105
|
|
43
|
+
}
|
|
44
|
+
}), /*#__PURE__*/React.createElement(InputNumber, {
|
|
45
|
+
value: selectedKeys === null || selectedKeys === void 0 ? void 0 : (_selectedKeys$2 = selectedKeys[0]) === null || _selectedKeys$2 === void 0 ? void 0 : _selectedKeys$2.max,
|
|
46
|
+
placeholder: "Max",
|
|
47
|
+
onChange: function onChange(value) {
|
|
48
|
+
var newVal = _objectSpread(_objectSpread({}, (selectedKeys === null || selectedKeys === void 0 ? void 0 : selectedKeys[0]) || {}), {}, {
|
|
49
|
+
max: value
|
|
50
|
+
});
|
|
51
|
+
setSelectedKeys([newVal]);
|
|
52
|
+
},
|
|
53
|
+
onPressEnter: function onPressEnter() {
|
|
54
|
+
return confirm();
|
|
55
|
+
},
|
|
56
|
+
style: {
|
|
57
|
+
width: 105
|
|
58
|
+
}
|
|
59
|
+
})), /*#__PURE__*/React.createElement(Space, {
|
|
60
|
+
className: "pisell-table-filter-dropdown-bottom",
|
|
61
|
+
styles: {
|
|
62
|
+
item: {
|
|
63
|
+
flex: 1
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
67
|
+
onClick: function onClick() {
|
|
68
|
+
clearFilters && clearFilters();
|
|
69
|
+
confirm();
|
|
70
|
+
},
|
|
71
|
+
block: true
|
|
72
|
+
}, "Clear"), /*#__PURE__*/React.createElement(Button, {
|
|
73
|
+
type: "primary",
|
|
74
|
+
onClick: function onClick() {
|
|
75
|
+
return confirm();
|
|
76
|
+
},
|
|
77
|
+
block: true
|
|
78
|
+
}, "Filter")));
|
|
79
|
+
},
|
|
80
|
+
filterIcon: function filterIcon(filtered) {
|
|
81
|
+
return filtered ? /*#__PURE__*/React.createElement(FilterFunnel01Fill, {
|
|
82
|
+
style: {
|
|
83
|
+
color: "#7f56d9",
|
|
84
|
+
fontSize: 14
|
|
85
|
+
}
|
|
86
|
+
}) : /*#__PURE__*/React.createElement(FilterFunnel01, {
|
|
87
|
+
style: {
|
|
88
|
+
color: "#98A2B3",
|
|
89
|
+
fontSize: 14
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
export default getColumnNumberProps;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ColumnType } from "antd/es/table";
|
|
2
|
+
import "./index.less";
|
|
3
|
+
declare const getColumnSelectProps: ({ dataIndex, filters, }: {
|
|
4
|
+
dataIndex: string;
|
|
5
|
+
filters: {
|
|
6
|
+
text: string;
|
|
7
|
+
value: string;
|
|
8
|
+
}[];
|
|
9
|
+
}) => ColumnType<any>;
|
|
10
|
+
export default getColumnSelectProps;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
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); }
|
|
2
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
5
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
6
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
7
|
+
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."); }
|
|
8
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
9
|
+
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; }
|
|
10
|
+
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; } }
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
import React, { useEffect, useMemo, useState } from "react";
|
|
13
|
+
import { Button, Checkbox, Space, Menu } from "antd";
|
|
14
|
+
import { FilterFunnel01, FilterFunnel01Fill } from "@pisell/icon";
|
|
15
|
+
import "./index.less";
|
|
16
|
+
var FilterDropdown = function FilterDropdown(props) {
|
|
17
|
+
var setSelectedKeys = props.setSelectedKeys,
|
|
18
|
+
selectedKeys = props.selectedKeys,
|
|
19
|
+
confirm = props.confirm,
|
|
20
|
+
clearFilters = props.clearFilters,
|
|
21
|
+
filters = props.filters;
|
|
22
|
+
var _useState = useState((selectedKeys === null || selectedKeys === void 0 ? void 0 : selectedKeys[0]) || []),
|
|
23
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
24
|
+
value = _useState2[0],
|
|
25
|
+
setValue = _useState2[1];
|
|
26
|
+
useEffect(function () {
|
|
27
|
+
setValue((selectedKeys === null || selectedKeys === void 0 ? void 0 : selectedKeys[0]) || []);
|
|
28
|
+
}, [selectedKeys === null || selectedKeys === void 0 ? void 0 : selectedKeys[0]]);
|
|
29
|
+
var items = useMemo(function () {
|
|
30
|
+
return filters.map(function (item) {
|
|
31
|
+
return {
|
|
32
|
+
label: /*#__PURE__*/React.createElement("span", {
|
|
33
|
+
onClick: function onClick(e) {
|
|
34
|
+
// 防止menu onClick触发两次
|
|
35
|
+
e.preventDefault();
|
|
36
|
+
}
|
|
37
|
+
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
38
|
+
checked: value.includes(item.value)
|
|
39
|
+
}, item.text)),
|
|
40
|
+
key: item.value
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
}, [filters, value]);
|
|
44
|
+
var handleClick = function handleClick(_ref) {
|
|
45
|
+
var key = _ref.key;
|
|
46
|
+
setValue(function (v) {
|
|
47
|
+
if (v.includes(key)) {
|
|
48
|
+
return v.filter(function (item) {
|
|
49
|
+
return item !== key;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return [].concat(_toConsumableArray(v), [key]);
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
useEffect(function () {
|
|
56
|
+
setSelectedKeys(value !== null && value !== void 0 && value.length ? [value] : []);
|
|
57
|
+
}, [value]);
|
|
58
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
59
|
+
onKeyDown: function onKeyDown(e) {
|
|
60
|
+
return e.stopPropagation();
|
|
61
|
+
},
|
|
62
|
+
className: "pisell-table-filter-dropdown"
|
|
63
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
64
|
+
className: "pisell-table-filter-dropdown-top",
|
|
65
|
+
style: {
|
|
66
|
+
padding: 0
|
|
67
|
+
}
|
|
68
|
+
}, /*#__PURE__*/React.createElement(Menu, {
|
|
69
|
+
onClick: handleClick,
|
|
70
|
+
items: items,
|
|
71
|
+
selectedKeys: [],
|
|
72
|
+
style: {
|
|
73
|
+
width: 272
|
|
74
|
+
}
|
|
75
|
+
})), /*#__PURE__*/React.createElement(Space, {
|
|
76
|
+
className: "pisell-table-filter-dropdown-bottom",
|
|
77
|
+
styles: {
|
|
78
|
+
item: {
|
|
79
|
+
flex: 1
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
83
|
+
onClick: function onClick() {
|
|
84
|
+
clearFilters && clearFilters();
|
|
85
|
+
confirm();
|
|
86
|
+
},
|
|
87
|
+
block: true,
|
|
88
|
+
style: {
|
|
89
|
+
flex: 1
|
|
90
|
+
}
|
|
91
|
+
}, "Clear"), /*#__PURE__*/React.createElement(Button, {
|
|
92
|
+
type: "primary",
|
|
93
|
+
onClick: function onClick() {
|
|
94
|
+
return confirm();
|
|
95
|
+
},
|
|
96
|
+
block: true,
|
|
97
|
+
style: {
|
|
98
|
+
flex: 1
|
|
99
|
+
}
|
|
100
|
+
}, "Filter")));
|
|
101
|
+
};
|
|
102
|
+
var getColumnSelectProps = function getColumnSelectProps(_ref2) {
|
|
103
|
+
var dataIndex = _ref2.dataIndex,
|
|
104
|
+
filters = _ref2.filters;
|
|
105
|
+
return {
|
|
106
|
+
filterDropdown: function filterDropdown(props) {
|
|
107
|
+
return /*#__PURE__*/React.createElement(FilterDropdown, _extends({}, props, {
|
|
108
|
+
filters: filters
|
|
109
|
+
}));
|
|
110
|
+
},
|
|
111
|
+
filterIcon: function filterIcon(filtered) {
|
|
112
|
+
return filtered ? /*#__PURE__*/React.createElement(FilterFunnel01Fill, {
|
|
113
|
+
style: {
|
|
114
|
+
color: "#7f56d9",
|
|
115
|
+
fontSize: 14
|
|
116
|
+
}
|
|
117
|
+
}) : /*#__PURE__*/React.createElement(FilterFunnel01, {
|
|
118
|
+
style: {
|
|
119
|
+
color: "#98A2B3",
|
|
120
|
+
fontSize: 14
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
export default getColumnSelectProps;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Button, Input, Space } from "antd";
|
|
3
|
+
import { SearchLg } from "@pisell/icon";
|
|
4
|
+
import "./index.less";
|
|
5
|
+
var getColumnStringProps = function getColumnStringProps(_ref) {
|
|
6
|
+
var dataIndex = _ref.dataIndex;
|
|
7
|
+
return {
|
|
8
|
+
filterDropdown: function filterDropdown(_ref2) {
|
|
9
|
+
var setSelectedKeys = _ref2.setSelectedKeys,
|
|
10
|
+
selectedKeys = _ref2.selectedKeys,
|
|
11
|
+
confirm = _ref2.confirm,
|
|
12
|
+
clearFilters = _ref2.clearFilters,
|
|
13
|
+
close = _ref2.close;
|
|
14
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
15
|
+
onKeyDown: function onKeyDown(e) {
|
|
16
|
+
return e.stopPropagation();
|
|
17
|
+
},
|
|
18
|
+
className: "pisell-table-filter-dropdown"
|
|
19
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
20
|
+
className: "pisell-table-filter-dropdown-top"
|
|
21
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
22
|
+
prefix: /*#__PURE__*/React.createElement(SearchLg, null),
|
|
23
|
+
placeholder: "Search",
|
|
24
|
+
value: selectedKeys[0],
|
|
25
|
+
onChange: function onChange(e) {
|
|
26
|
+
return setSelectedKeys(e.target.value ? [e.target.value] : []);
|
|
27
|
+
},
|
|
28
|
+
onPressEnter: function onPressEnter() {
|
|
29
|
+
return confirm();
|
|
30
|
+
},
|
|
31
|
+
style: {
|
|
32
|
+
width: 240
|
|
33
|
+
}
|
|
34
|
+
})), /*#__PURE__*/React.createElement(Space, {
|
|
35
|
+
className: "pisell-table-filter-dropdown-bottom",
|
|
36
|
+
styles: {
|
|
37
|
+
item: {
|
|
38
|
+
flex: 1
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
42
|
+
onClick: function onClick() {
|
|
43
|
+
clearFilters && clearFilters();
|
|
44
|
+
confirm();
|
|
45
|
+
},
|
|
46
|
+
block: true,
|
|
47
|
+
style: {
|
|
48
|
+
flex: 1
|
|
49
|
+
}
|
|
50
|
+
}, "Clear"), /*#__PURE__*/React.createElement(Button, {
|
|
51
|
+
type: "primary",
|
|
52
|
+
onClick: function onClick() {
|
|
53
|
+
return confirm();
|
|
54
|
+
},
|
|
55
|
+
block: true,
|
|
56
|
+
style: {
|
|
57
|
+
flex: 1
|
|
58
|
+
}
|
|
59
|
+
}, "Filter")));
|
|
60
|
+
},
|
|
61
|
+
filterIcon: function filterIcon(filtered) {
|
|
62
|
+
return /*#__PURE__*/React.createElement(SearchLg, {
|
|
63
|
+
style: {
|
|
64
|
+
color: filtered ? "#7f56d9" : undefined,
|
|
65
|
+
fontSize: 16
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
export default getColumnStringProps;
|
|
@@ -78,7 +78,8 @@ var GridView = Provider(function (props) {
|
|
|
78
78
|
});
|
|
79
79
|
} else {
|
|
80
80
|
var _other$pagination;
|
|
81
|
-
|
|
81
|
+
// 如果使用本地分页 不执行onValuesChange
|
|
82
|
+
if (other !== null && other !== void 0 && (_other$pagination = other.pagination) !== null && _other$pagination !== void 0 && _other$pagination.localPagination) {
|
|
82
83
|
return;
|
|
83
84
|
}
|
|
84
85
|
}
|
|
@@ -3,5 +3,53 @@
|
|
|
3
3
|
height: 100%;
|
|
4
4
|
display: flex;
|
|
5
5
|
flex-direction: column;
|
|
6
|
-
|
|
6
|
+
.pisell-lowcode-table-filter-column {
|
|
7
|
+
align-items: center;
|
|
8
|
+
.pisell-lowcode-dropdown-trigger {
|
|
9
|
+
width: 25px;
|
|
10
|
+
height: 25px;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
}
|
|
13
|
+
.pisell-lowcode-table-filter-trigger.active {
|
|
14
|
+
background: var(--primary-100, #F4EBFF);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
.pisell-lowcode-table-column-sorters {
|
|
18
|
+
cursor: pointer;
|
|
19
|
+
}
|
|
20
|
+
.pisell-table-sorter-inner {
|
|
21
|
+
width: 25px;
|
|
22
|
+
height: 25px;
|
|
23
|
+
display: inline-flex;
|
|
24
|
+
flex-direction: column;
|
|
25
|
+
align-items: center;
|
|
26
|
+
margin-inline-start: 4px;
|
|
27
|
+
color: rgba(0, 0, 0, 0.29);
|
|
28
|
+
font-size: 12px;
|
|
29
|
+
transition: color 0.3s;
|
|
30
|
+
border-radius: 8px;
|
|
31
|
+
justify-content: center;
|
|
32
|
+
&:hover {
|
|
33
|
+
background: var(--primary-100, #F4EBFF);
|
|
34
|
+
}
|
|
35
|
+
.pisell-table-column-sorter-up,.pisell-table-column-sorter-down {
|
|
36
|
+
color: rgba(102, 112, 133, 0.65);
|
|
37
|
+
font-size: 12px;
|
|
38
|
+
}
|
|
39
|
+
.pisell-table-column-sorter-down {
|
|
40
|
+
margin-top: -0.3em;
|
|
41
|
+
}
|
|
42
|
+
.pisell-table-column-up {
|
|
43
|
+
font-size: 20px;
|
|
44
|
+
}
|
|
45
|
+
.pisell-table-column-down {
|
|
46
|
+
font-size: 20px;
|
|
47
|
+
transform: rotate(180deg);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
.pisell-table-sorter-inner.active {
|
|
51
|
+
background: var(--primary-100, #F4EBFF);
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
color: #7F56D9
|
|
54
|
+
}
|
|
7
55
|
}
|
|
@@ -39,7 +39,6 @@ var Drawer = (props) => {
|
|
|
39
39
|
if (props.__designMode === "design") {
|
|
40
40
|
innerProps.open = true;
|
|
41
41
|
}
|
|
42
|
-
console.log(props, "Drawer props", innerProps);
|
|
43
42
|
return /* @__PURE__ */ import_react.default.createElement(import_antd.Drawer, { ...props, ...innerProps });
|
|
44
43
|
};
|
|
45
44
|
var drawer_default = Drawer;
|
|
@@ -42,6 +42,6 @@ var FilterItem = (props) => {
|
|
|
42
42
|
var _a;
|
|
43
43
|
return (_a = import_fields.fieldMaps[type]) == null ? void 0 : _a.edit;
|
|
44
44
|
}, [type]);
|
|
45
|
-
return /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { label, name }, /* @__PURE__ */ import_react.default.createElement(Com, { ...other }));
|
|
45
|
+
return /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { label, name, ...(other == null ? void 0 : other.formItemProps) || {} }, /* @__PURE__ */ import_react.default.createElement(Com, { ...other }));
|
|
46
46
|
};
|
|
47
47
|
var FilterItem_default = FilterItem;
|
|
@@ -35,29 +35,37 @@ module.exports = __toCommonJS(BasicTable_exports);
|
|
|
35
35
|
var import_antd = require("antd");
|
|
36
36
|
var import_react = __toESM(require("react"));
|
|
37
37
|
var import_Pagination = require("../../Pagination");
|
|
38
|
+
var import_utils = require("../Table/utils");
|
|
38
39
|
var BasicTable = (props) => {
|
|
39
40
|
var _a;
|
|
40
41
|
const { dataSource, pagination, value, ...other } = props;
|
|
42
|
+
const [filter, setFilter] = (0, import_react.useState)();
|
|
43
|
+
const [sort, setSort] = (0, import_react.useState)();
|
|
41
44
|
const form = import_antd.Form.useFormInstance();
|
|
42
45
|
const formPagination = import_antd.Form.useWatch("pagination", form) || {
|
|
43
46
|
page: 1,
|
|
44
47
|
size: 10
|
|
45
48
|
};
|
|
46
|
-
const { showTotal } = pagination;
|
|
49
|
+
const { showTotal, localPagination } = pagination;
|
|
47
50
|
const _showTotal = (0, import_react.useCallback)(
|
|
48
51
|
(total2, range) => {
|
|
49
|
-
let _size = formPagination.size;
|
|
52
|
+
let _size = formPagination.size || 10;
|
|
50
53
|
return showTotal(total2, range, _size);
|
|
51
54
|
},
|
|
52
55
|
[showTotal, formPagination == null ? void 0 : formPagination.page, formPagination == null ? void 0 : formPagination.size]
|
|
53
56
|
);
|
|
54
57
|
const _dataSource = (0, import_react.useMemo)(() => {
|
|
55
58
|
let _page = formPagination.page;
|
|
56
|
-
let _size = formPagination.size;
|
|
59
|
+
let _size = formPagination.size || 10;
|
|
57
60
|
let list = [];
|
|
58
61
|
let _total = total;
|
|
59
|
-
if (
|
|
60
|
-
list =
|
|
62
|
+
if (localPagination) {
|
|
63
|
+
list = (0, import_utils.calcFilterSort)({
|
|
64
|
+
dataSource,
|
|
65
|
+
columns: other.columns,
|
|
66
|
+
sort,
|
|
67
|
+
filter
|
|
68
|
+
});
|
|
61
69
|
_total = list.length;
|
|
62
70
|
list = list.slice((_page - 1) * _size, _page * _size);
|
|
63
71
|
} else {
|
|
@@ -67,11 +75,39 @@ var BasicTable = (props) => {
|
|
|
67
75
|
list,
|
|
68
76
|
total: _total
|
|
69
77
|
};
|
|
70
|
-
}, [
|
|
78
|
+
}, [
|
|
79
|
+
localPagination,
|
|
80
|
+
dataSource,
|
|
81
|
+
formPagination == null ? void 0 : formPagination.page,
|
|
82
|
+
formPagination == null ? void 0 : formPagination.size,
|
|
83
|
+
filter,
|
|
84
|
+
sort,
|
|
85
|
+
other.columns
|
|
86
|
+
]);
|
|
71
87
|
const total = (0, import_react.useMemo)(() => {
|
|
88
|
+
if (dataSource.length > formPagination.size) {
|
|
89
|
+
return (_dataSource == null ? void 0 : _dataSource.total) || 0;
|
|
90
|
+
}
|
|
72
91
|
return (pagination == null ? void 0 : pagination.total) || (_dataSource == null ? void 0 : _dataSource.total) || 0;
|
|
73
|
-
}, [
|
|
74
|
-
return /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement(
|
|
92
|
+
}, [_dataSource, pagination]);
|
|
93
|
+
return /* @__PURE__ */ import_react.default.createElement("div", null, /* @__PURE__ */ import_react.default.createElement(
|
|
94
|
+
import_antd.Table,
|
|
95
|
+
{
|
|
96
|
+
...other,
|
|
97
|
+
onChange: (pagination2, filters, sorter) => {
|
|
98
|
+
form.setFieldsValue({
|
|
99
|
+
pagination: {
|
|
100
|
+
...formPagination,
|
|
101
|
+
page: 1
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
setFilter(filters);
|
|
105
|
+
setSort(sorter);
|
|
106
|
+
},
|
|
107
|
+
pagination: false,
|
|
108
|
+
dataSource: _dataSource == null ? void 0 : _dataSource.list
|
|
109
|
+
}
|
|
110
|
+
), total > (((_a = pagination == null ? void 0 : pagination.pageSizeOptions) == null ? void 0 : _a[0]) || 10) ? /* @__PURE__ */ import_react.default.createElement(import_antd.Form.Item, { name: "pagination" }, /* @__PURE__ */ import_react.default.createElement(
|
|
75
111
|
import_Pagination.FormPagination,
|
|
76
112
|
{
|
|
77
113
|
...pagination,
|
|
@@ -46,7 +46,6 @@ var AddFieldModal = () => {
|
|
|
46
46
|
const [count, setCount] = (0, import_react.useState)(2);
|
|
47
47
|
const [openModal, setOpenModal] = (0, import_react.useState)(false);
|
|
48
48
|
const addField = (values) => {
|
|
49
|
-
console.log(values);
|
|
50
49
|
let field_name = values.field_name;
|
|
51
50
|
if (defaultColumns.find((d) => d.dataIndex === field_name)) {
|
|
52
51
|
import_antd.message.warning("This field already exists");
|
|
@@ -96,6 +96,18 @@ export declare const fieldMaps: {
|
|
|
96
96
|
sort: () => JSX.Element;
|
|
97
97
|
show: (props: import("./types").FieldPropsType) => JSX.Element;
|
|
98
98
|
};
|
|
99
|
+
pSwitch: {
|
|
100
|
+
field: {
|
|
101
|
+
field_icon: string;
|
|
102
|
+
field_name: string;
|
|
103
|
+
field_type: string;
|
|
104
|
+
default_value: boolean;
|
|
105
|
+
};
|
|
106
|
+
config: () => JSX.Element;
|
|
107
|
+
edit: import("react").ForwardRefExoticComponent<Omit<import("./types").EditPropsType, "ref"> & import("react").RefAttributes<any>>;
|
|
108
|
+
sort: () => JSX.Element;
|
|
109
|
+
show: (props: import("./types").FieldPropsType) => JSX.Element;
|
|
110
|
+
};
|
|
99
111
|
};
|
|
100
112
|
export declare const fieldList: ({
|
|
101
113
|
field_icon: string;
|
|
@@ -137,6 +149,11 @@ export declare const fieldList: ({
|
|
|
137
149
|
field_name: string;
|
|
138
150
|
field_type: string;
|
|
139
151
|
default_value: string;
|
|
152
|
+
} | {
|
|
153
|
+
field_icon: string;
|
|
154
|
+
field_name: string;
|
|
155
|
+
field_type: string;
|
|
156
|
+
default_value: boolean;
|
|
140
157
|
})[];
|
|
141
158
|
export declare const getFieldByType: (type: string) => {
|
|
142
159
|
field: {
|
|
@@ -247,5 +264,17 @@ declare const _default: {
|
|
|
247
264
|
sort: () => JSX.Element;
|
|
248
265
|
show: (props: import("./types").FieldPropsType) => JSX.Element;
|
|
249
266
|
};
|
|
267
|
+
pSwitch: {
|
|
268
|
+
field: {
|
|
269
|
+
field_icon: string;
|
|
270
|
+
field_name: string;
|
|
271
|
+
field_type: string;
|
|
272
|
+
default_value: boolean;
|
|
273
|
+
};
|
|
274
|
+
config: () => JSX.Element;
|
|
275
|
+
edit: import("react").ForwardRefExoticComponent<Omit<import("./types").EditPropsType, "ref"> & import("react").RefAttributes<any>>;
|
|
276
|
+
sort: () => JSX.Element;
|
|
277
|
+
show: (props: import("./types").FieldPropsType) => JSX.Element;
|
|
278
|
+
};
|
|
250
279
|
};
|
|
251
280
|
export default _default;
|
|
@@ -43,6 +43,7 @@ var import_text = __toESM(require("./text"));
|
|
|
43
43
|
var import_image = __toESM(require("./image"));
|
|
44
44
|
var import_rangePicker = __toESM(require("./rangePicker"));
|
|
45
45
|
var import_search = __toESM(require("./search"));
|
|
46
|
+
var import_pSwitch = __toESM(require("./pSwitch"));
|
|
46
47
|
var fieldMaps = {
|
|
47
48
|
text: import_text.default,
|
|
48
49
|
link: import_link.default,
|
|
@@ -51,7 +52,8 @@ var fieldMaps = {
|
|
|
51
52
|
select: import_select.default,
|
|
52
53
|
image: import_image.default,
|
|
53
54
|
rangePicker: import_rangePicker.default,
|
|
54
|
-
search: import_search.default
|
|
55
|
+
search: import_search.default,
|
|
56
|
+
pSwitch: import_pSwitch.default
|
|
55
57
|
};
|
|
56
58
|
var fieldList = Object.values(fieldMaps).map((d) => {
|
|
57
59
|
return d.field;
|
|
@@ -67,7 +69,8 @@ var fields_default = {
|
|
|
67
69
|
select: import_select.default,
|
|
68
70
|
image: import_image.default,
|
|
69
71
|
rangePicker: import_rangePicker.default,
|
|
70
|
-
search: import_search.default
|
|
72
|
+
search: import_search.default,
|
|
73
|
+
pSwitch: import_pSwitch.default
|
|
71
74
|
};
|
|
72
75
|
// Annotate the CommonJS export names for ESM import in node:
|
|
73
76
|
0 && (module.exports = {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/components/table/Table/fields/pSwitch/Config/index.tsx
|
|
20
|
+
var Config_exports = {};
|
|
21
|
+
__export(Config_exports, {
|
|
22
|
+
default: () => Config_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(Config_exports);
|
|
25
|
+
var Config = () => {
|
|
26
|
+
return /* @__PURE__ */ React.createElement("div", null);
|
|
27
|
+
};
|
|
28
|
+
var Config_default = Config;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/table/Table/fields/pSwitch/Edit/index.tsx
|
|
30
|
+
var Edit_exports = {};
|
|
31
|
+
__export(Edit_exports, {
|
|
32
|
+
default: () => Edit_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(Edit_exports);
|
|
35
|
+
var import_react = require("react");
|
|
36
|
+
var import_react2 = __toESM(require("react"));
|
|
37
|
+
var Edit = (props, ref) => {
|
|
38
|
+
const { value, onChange, onPressEnter, onBlur, style, bordered } = props;
|
|
39
|
+
return /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null);
|
|
40
|
+
};
|
|
41
|
+
var Edit_default = (0, import_react.forwardRef)(Edit);
|