@capillarytech/blaze-ui 0.1.6-alpha.31 → 0.1.6-alpha.32
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/components/CapInput/CapInput.js +34 -25
- package/components/CapInput/Number.js +25 -19
- package/components/CapInput/Search.js +19 -13
- package/components/CapInput/TextArea.js +23 -17
- package/components/CapInput/index.js +13 -8
- package/components/CapInput/messages.js +6 -7
- package/components/CapInput/styles.js +8 -3
- package/components/CapSkeleton/CapSkeleton.js +15 -12
- package/components/CapSkeleton/index.js +7 -1
- package/components/CapSpin/CapSpin.js +22 -19
- package/components/CapSpin/index.js +7 -1
- package/components/CapTable/CapTable.js +44 -50
- package/components/CapTable/index.js +7 -2
- package/components/CapTable/loadable.js +18 -8
- package/components/CapTable/styles.js +10 -4
- package/components/CapTestSelect/CapTestSelect.js +24 -22
- package/components/CapTestSelect/index.js +7 -1
- package/components/CapUnifiedSelect/CapUnifiedSelect.js +218 -203
- package/components/CapUnifiedSelect/index.js +7 -1
- package/components/CapUnifiedSelect/messages.js +6 -2
- package/components/CapUnifiedSelect/styles.js +15 -10
- package/components/LocaleHoc/index.js +18 -9
- package/components/index.js +32 -13
- package/components/styled/index.js +13 -4
- package/components/styled/variables.js +62 -80
- package/components/translations/en.js +5 -1
- package/package.json +1 -1
- package/utils/index.js +7 -1
- package/utils/withStyles.js +7 -15
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.StyledTable = void 0;
|
|
5
|
+
var _antd = require("antd");
|
|
6
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
7
|
+
var styledVars = _interopRequireWildcard(require("../styled/variables"));
|
|
8
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
4
10
|
const {
|
|
5
11
|
CAP_G09,
|
|
6
12
|
CAP_G01,
|
|
@@ -11,7 +17,7 @@ const {
|
|
|
11
17
|
SPACING_24,
|
|
12
18
|
FONT_SIZE_S
|
|
13
19
|
} = styledVars;
|
|
14
|
-
|
|
20
|
+
const StyledTable = exports.StyledTable = (0, _styledComponents.default)(_antd.Table).withConfig({
|
|
15
21
|
displayName: "StyledTable",
|
|
16
22
|
componentId: "sc-1ldu1k4-0"
|
|
17
23
|
})(["&.cap-table-v2{.ant-table{border:1px solid ", ";}}&.show-loader{.ant-table-body > table > tbody::after{content:'", "';display:flex;justify-content:center;position:absolute;width:100%;align-items:center;height:60px;text-align:center;font-size:16px;color:gray;border-top:1px solid ", ";}}.ant-table{border:1px solid ", ";.ant-table-thead > tr > th{color:", ";font-size:", ";line-height:", ";background-color:", ";text-align:left;}.ant-table-thead > tr > th,.ant-table-tbody > tr > td{padding:", " ", ";}.ant-table-tbody > tr > td{border-bottom:1px solid ", ";}.ant-table-tbody > tr:last-child > td{border-bottom:none;}.ant-table-thead > tr.ant-table-row-hover:not(.ant-table-expanded-row) > td,.ant-table-tbody > tr.ant-table-row-hover:not(.ant-table-expanded-row) > td,.ant-table-thead > tr:hover:not(.ant-table-expanded-row) > td,.ant-table-tbody > tr:hover:not(.ant-table-expanded-row) > td{background-color:", ";}.ant-table-thead > tr > th .ant-table-column-sorter-up,.ant-table-thead > tr > th .ant-table-column-sorter-down{&.active{color:", ";}&:not(.active){color:", ";}}.ant-table-thead{.table-children{padding:6px ", " 16px;position:relative;}.table-parent{padding-bottom:0;padding-left:", ";}.table-children.show-separator:not(:last-child)::after{content:'';height:8px;width:1px;right:0;top:30%;background-color:", ";position:absolute;}}.ant-table-thead > tr > th .ant-table-column-sorter{vertical-align:unset;}.ant-table-body table{table-layout:fixed;width:100%;}}&.no-pagination-loader{.ant-table-body > table > tbody::after{content:'';height:unset;display:none;}}&.hide-hover{.ant-table{.ant-table-thead > tr.ant-table-row-hover:not(.ant-table-expanded-row) > td,.ant-table-tbody > tr.ant-table-row-hover:not(.ant-table-expanded-row) > td,.ant-table-thead > tr:hover:not(.ant-table-expanded-row) > td,.ant-table-tbody > tr:hover:not(.ant-table-expanded-row) > td{background:none;}}}a{color:", ";}"], CAP_G07, props => props.loadMoreData, CAP_G07, CAP_G07, CAP_G01, FONT_SIZE_S, SPACING_16, CAP_G10, SPACING_16, SPACING_24, CAP_G07, CAP_G09, CAP_G01, CAP_G06, SPACING_24, SPACING_24, CAP_G07, CAP_G01);
|
|
@@ -1,28 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { Select } from 'antd';
|
|
1
|
+
"use strict";
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
7
|
+
var _antd = require("antd");
|
|
8
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
10
|
const CapTestSelect = props => {
|
|
10
|
-
return
|
|
11
|
+
return (0, _jsxRuntime.jsx)(_antd.Select, {
|
|
12
|
+
...props
|
|
13
|
+
});
|
|
11
14
|
};
|
|
12
15
|
CapTestSelect.propTypes = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
disabled: PropTypes.bool
|
|
16
|
+
allowClear: _propTypes.default.bool,
|
|
17
|
+
defaultValue: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number, _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]))]),
|
|
18
|
+
disabled: _propTypes.default.bool,
|
|
19
|
+
loading: _propTypes.default.bool,
|
|
20
|
+
mode: _propTypes.default.oneOf(['multiple', 'tags']),
|
|
21
|
+
placeholder: _propTypes.default.string,
|
|
22
|
+
showSearch: _propTypes.default.bool,
|
|
23
|
+
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number, _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]))]),
|
|
24
|
+
options: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
25
|
+
label: _propTypes.default.node,
|
|
26
|
+
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
27
|
+
disabled: _propTypes.default.bool
|
|
26
28
|
}))
|
|
27
29
|
};
|
|
28
30
|
CapTestSelect.defaultProps = {
|
|
@@ -31,4 +33,4 @@ CapTestSelect.defaultProps = {
|
|
|
31
33
|
loading: false,
|
|
32
34
|
showSearch: false
|
|
33
35
|
};
|
|
34
|
-
|
|
36
|
+
var _default = exports.default = CapTestSelect;
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
var _CapTestSelect = _interopRequireDefault(require("./CapTestSelect"));
|
|
6
|
+
exports.default = _CapTestSelect.default;
|
|
7
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
6
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
7
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
8
|
+
var _antd = require("antd");
|
|
9
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
10
|
+
var _icons = require("@ant-design/icons");
|
|
11
|
+
var _withStyles = _interopRequireDefault(require("../../utils/withStyles"));
|
|
12
|
+
var _styles = require("./styles");
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
11
16
|
const CapUnifiedSelect = _ref => {
|
|
12
17
|
let {
|
|
13
18
|
type,
|
|
@@ -29,20 +34,18 @@ const CapUnifiedSelect = _ref => {
|
|
|
29
34
|
onConfirm,
|
|
30
35
|
onCancel
|
|
31
36
|
} = _ref;
|
|
32
|
-
const StyledSelect =
|
|
37
|
+
const StyledSelect = (0, _styledComponents.default)(_antd.Select).withConfig({
|
|
33
38
|
displayName: "StyledSelect",
|
|
34
39
|
componentId: "sc-wsphu8-0"
|
|
35
|
-
})(["", ""], selectStyles);
|
|
36
|
-
const StyledTreeSelect =
|
|
40
|
+
})(["", ""], _styles.selectStyles);
|
|
41
|
+
const StyledTreeSelect = (0, _styledComponents.default)(_antd.TreeSelect).withConfig({
|
|
37
42
|
displayName: "StyledTreeSelect",
|
|
38
43
|
componentId: "sc-wsphu8-1"
|
|
39
|
-
})(["", ""], selectStyles);
|
|
40
|
-
const [searchText, setSearchText] = useState('');
|
|
41
|
-
const [tempValue, setTempValue] = useState(value);
|
|
42
|
-
const [allSelected, setAllSelected] = useState(false);
|
|
43
|
-
|
|
44
|
-
// Update tempValue when value changes
|
|
45
|
-
useEffect(() => {
|
|
44
|
+
})(["", ""], _styles.selectStyles);
|
|
45
|
+
const [searchText, setSearchText] = (0, _react.useState)('');
|
|
46
|
+
const [tempValue, setTempValue] = (0, _react.useState)(value);
|
|
47
|
+
const [allSelected, setAllSelected] = (0, _react.useState)(false);
|
|
48
|
+
(0, _react.useEffect)(() => {
|
|
46
49
|
setTempValue(value);
|
|
47
50
|
}, [value]);
|
|
48
51
|
const selectVirtualizationProps = {
|
|
@@ -52,9 +55,7 @@ const CapUnifiedSelect = _ref => {
|
|
|
52
55
|
listHeight: 256,
|
|
53
56
|
listItemHeight: 32
|
|
54
57
|
};
|
|
55
|
-
|
|
56
|
-
// No results component
|
|
57
|
-
const NoResult = () => /*#__PURE__*/React.createElement("div", {
|
|
58
|
+
const NoResult = () => (0, _jsxRuntime.jsxs)("div", {
|
|
58
59
|
style: {
|
|
59
60
|
display: 'flex',
|
|
60
61
|
flexDirection: 'column',
|
|
@@ -63,25 +64,26 @@ const CapUnifiedSelect = _ref => {
|
|
|
63
64
|
height: 200,
|
|
64
65
|
color: '#8c8c8c',
|
|
65
66
|
fontSize: 14
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
67
|
+
},
|
|
68
|
+
children: [(0, _jsxRuntime.jsx)(_icons.WarningFilled, {
|
|
69
|
+
style: {
|
|
70
|
+
fontSize: 36,
|
|
71
|
+
marginBottom: 8,
|
|
72
|
+
color: '#bfbfbf'
|
|
73
|
+
}
|
|
74
|
+
}), (0, _jsxRuntime.jsx)("div", {
|
|
75
|
+
style: {
|
|
76
|
+
fontWeight: 500
|
|
77
|
+
},
|
|
78
|
+
children: "No results found"
|
|
79
|
+
})]
|
|
80
|
+
});
|
|
80
81
|
const getFilteredTreeData = (data, search) => {
|
|
81
82
|
if (!search) return data;
|
|
82
83
|
const filterNode = node => {
|
|
83
|
-
|
|
84
|
-
const
|
|
84
|
+
var _node$title, _node$label;
|
|
85
|
+
const titleText = ((_node$title = node.title) == null ? void 0 : _node$title.toLowerCase()) || '';
|
|
86
|
+
const labelText = ((_node$label = node.label) == null ? void 0 : _node$label.toLowerCase()) || '';
|
|
85
87
|
return titleText.includes(search.toLowerCase()) || labelText.includes(search.toLowerCase());
|
|
86
88
|
};
|
|
87
89
|
const loop = data => data.map(item => {
|
|
@@ -96,18 +98,17 @@ const CapUnifiedSelect = _ref => {
|
|
|
96
98
|
}).filter(Boolean);
|
|
97
99
|
return loop(data);
|
|
98
100
|
};
|
|
99
|
-
|
|
100
|
-
// Get all leaf node values from tree data
|
|
101
|
-
const flattenedLeafValues = nodes => nodes?.flatMap(node => node.children ? flattenedLeafValues(node.children) : [node.value]) || [];
|
|
101
|
+
const flattenedLeafValues = nodes => (nodes == null ? void 0 : nodes.flatMap(node => node.children ? flattenedLeafValues(node.children) : [node.value])) || [];
|
|
102
102
|
const filteredTree = getFilteredTreeData(treeData || options, searchText);
|
|
103
|
-
const filteredOptions = !searchText ? options : options.filter(opt =>
|
|
104
|
-
|
|
105
|
-
|
|
103
|
+
const filteredOptions = !searchText ? options : options.filter(opt => {
|
|
104
|
+
var _opt$label;
|
|
105
|
+
return (_opt$label = opt.label) == null ? void 0 : _opt$label.toLowerCase().includes(searchText.toLowerCase());
|
|
106
|
+
});
|
|
106
107
|
const leafValues = flattenedLeafValues(filteredTree);
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
const handleSelectAll = function (isTree) {
|
|
109
|
+
if (isTree === void 0) {
|
|
110
|
+
isTree = false;
|
|
111
|
+
}
|
|
111
112
|
const availableValues = isTree ? leafValues : filteredOptions.map(opt => opt.value);
|
|
112
113
|
if (allSelected) {
|
|
113
114
|
setTempValue([]);
|
|
@@ -116,17 +117,13 @@ const CapUnifiedSelect = _ref => {
|
|
|
116
117
|
}
|
|
117
118
|
setAllSelected(!allSelected);
|
|
118
119
|
};
|
|
119
|
-
|
|
120
|
-
// Update allSelected state when value changes
|
|
121
|
-
useEffect(() => {
|
|
120
|
+
(0, _react.useEffect)(() => {
|
|
122
121
|
const isMultipleMode = type === 'multiSelect' || type === 'multiTreeSelect';
|
|
123
122
|
if (isMultipleMode && Array.isArray(tempValue)) {
|
|
124
123
|
const availableValues = type.includes('tree') ? leafValues : filteredOptions.map(opt => opt.value);
|
|
125
124
|
setAllSelected(tempValue.length > 0 && tempValue.length === availableValues.length);
|
|
126
125
|
}
|
|
127
126
|
}, [tempValue, filteredOptions, leafValues, type]);
|
|
128
|
-
|
|
129
|
-
// Handle confirmation
|
|
130
127
|
const handleConfirm = () => {
|
|
131
128
|
if (onConfirm) {
|
|
132
129
|
onConfirm(tempValue);
|
|
@@ -135,8 +132,6 @@ const CapUnifiedSelect = _ref => {
|
|
|
135
132
|
}
|
|
136
133
|
setSearchText('');
|
|
137
134
|
};
|
|
138
|
-
|
|
139
|
-
// Handle cancellation
|
|
140
135
|
const handleCancel = () => {
|
|
141
136
|
if (onCancel) {
|
|
142
137
|
onCancel();
|
|
@@ -144,12 +139,14 @@ const CapUnifiedSelect = _ref => {
|
|
|
144
139
|
setTempValue(value);
|
|
145
140
|
setSearchText('');
|
|
146
141
|
};
|
|
147
|
-
|
|
148
|
-
// Handle temporary value change
|
|
149
142
|
const handleTempChange = newValue => {
|
|
150
143
|
setTempValue(newValue);
|
|
151
144
|
};
|
|
152
|
-
const suffix = (type === "multiTreeSelect" || type === "multiSelect") && Array.isArray(value) && value.length > 1 ?
|
|
145
|
+
const suffix = (type === "multiTreeSelect" || type === "multiSelect") && Array.isArray(value) && value.length > 1 ? (0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
146
|
+
children: (0, _jsxRuntime.jsxs)("span", {
|
|
147
|
+
children: ["+", value.length - 1, " more", (0, _jsxRuntime.jsx)(_icons.DownOutlined, {})]
|
|
148
|
+
})
|
|
149
|
+
}) : (0, _jsxRuntime.jsx)(_icons.DownOutlined, {});
|
|
153
150
|
const prefix = () => {
|
|
154
151
|
if ((type === "multiTreeSelect" || type === "multiSelect") && Array.isArray(value) && value.length > 0) {
|
|
155
152
|
const selectedLabels = options.filter(opt => value.includes(opt.value)).map(opt => opt.label);
|
|
@@ -160,179 +157,197 @@ const CapUnifiedSelect = _ref => {
|
|
|
160
157
|
};
|
|
161
158
|
const renderHeader = () => {
|
|
162
159
|
if (!label && !tooltip) return null;
|
|
163
|
-
return
|
|
164
|
-
className: disabled ? 'disabled' : ''
|
|
165
|
-
}, label && /*#__PURE__*/React.createElement("label", {
|
|
166
|
-
type: "label16",
|
|
167
|
-
className: disabled ? 'disabled' : ''
|
|
168
|
-
}, label), tooltip && /*#__PURE__*/React.createElement(Tooltip, {
|
|
169
|
-
title: tooltip
|
|
170
|
-
}, /*#__PURE__*/React.createElement(InfoCircleOutlined, {
|
|
160
|
+
return (0, _jsxRuntime.jsxs)(_styles.HeaderWrapper, {
|
|
171
161
|
className: disabled ? 'disabled' : '',
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
162
|
+
children: [label && (0, _jsxRuntime.jsx)("label", {
|
|
163
|
+
type: "label16",
|
|
164
|
+
className: disabled ? 'disabled' : '',
|
|
165
|
+
children: label
|
|
166
|
+
}), tooltip && (0, _jsxRuntime.jsx)(_antd.Tooltip, {
|
|
167
|
+
title: tooltip,
|
|
168
|
+
children: (0, _jsxRuntime.jsx)(_icons.InfoCircleOutlined, {
|
|
169
|
+
className: disabled ? 'disabled' : '',
|
|
170
|
+
style: {
|
|
171
|
+
color: '#B3BAC5'
|
|
172
|
+
}
|
|
173
|
+
})
|
|
174
|
+
})]
|
|
175
|
+
});
|
|
176
176
|
};
|
|
177
177
|
const renderDropdown = () => {
|
|
178
178
|
const isMultipleSelect = type === 'multiSelect' || type === 'multiTreeSelect';
|
|
179
179
|
const isTreeMode = type === 'treeSelect' || type === 'multiTreeSelect';
|
|
180
180
|
const currentItems = isTreeMode ? filteredTree : filteredOptions;
|
|
181
181
|
const selectedCount = Array.isArray(tempValue) ? tempValue.length : tempValue ? 1 : 0;
|
|
182
|
-
|
|
183
|
-
// Custom dropdown render for both Select and TreeSelect
|
|
184
182
|
const renderCustomDropdown = menu => {
|
|
185
183
|
if (!customPopupRender) return menu;
|
|
186
|
-
return
|
|
187
|
-
|
|
188
|
-
borderBottom: '1px solid #f0f0f0'
|
|
189
|
-
}
|
|
190
|
-
}, /*#__PURE__*/React.createElement(Input, {
|
|
191
|
-
prefix: /*#__PURE__*/React.createElement(SearchOutlined, {
|
|
184
|
+
return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
185
|
+
children: [(0, _jsxRuntime.jsx)("div", {
|
|
192
186
|
style: {
|
|
193
|
-
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
187
|
+
borderBottom: '1px solid #f0f0f0'
|
|
188
|
+
},
|
|
189
|
+
children: (0, _jsxRuntime.jsx)(_antd.Input, {
|
|
190
|
+
prefix: (0, _jsxRuntime.jsx)(_icons.SearchOutlined, {
|
|
191
|
+
style: {
|
|
192
|
+
color: "#B3BAC5"
|
|
193
|
+
}
|
|
194
|
+
}),
|
|
195
|
+
placeholder: "Search",
|
|
196
|
+
variant: "borderless",
|
|
197
|
+
value: searchText,
|
|
198
|
+
onChange: e => setSearchText(e.target.value),
|
|
199
|
+
onKeyDown: e => e.stopPropagation()
|
|
200
|
+
})
|
|
201
|
+
}), isMultipleSelect && currentItems.length > 0 && (0, _jsxRuntime.jsxs)("div", {
|
|
202
|
+
style: {
|
|
203
|
+
padding: '8px 12px',
|
|
204
|
+
cursor: 'pointer',
|
|
205
|
+
display: 'flex',
|
|
206
|
+
alignItems: 'center',
|
|
207
|
+
borderBottom: '1px solid #f0f0f0'
|
|
208
|
+
},
|
|
209
|
+
onClick: e => {
|
|
210
|
+
e.stopPropagation();
|
|
211
|
+
handleSelectAll(isTreeMode);
|
|
212
|
+
},
|
|
213
|
+
children: [(0, _jsxRuntime.jsx)("input", {
|
|
214
|
+
type: "checkbox",
|
|
215
|
+
checked: allSelected,
|
|
216
|
+
readOnly: true,
|
|
217
|
+
style: {
|
|
218
|
+
cursor: 'pointer'
|
|
219
|
+
},
|
|
220
|
+
onClick: e => e.stopPropagation()
|
|
221
|
+
}), (0, _jsxRuntime.jsx)("label", {
|
|
222
|
+
style: {
|
|
223
|
+
marginLeft: 8,
|
|
224
|
+
cursor: 'pointer'
|
|
225
|
+
},
|
|
226
|
+
children: "Select all"
|
|
227
|
+
})]
|
|
228
|
+
}), currentItems.length === 0 ? (0, _jsxRuntime.jsx)(NoResult, {}) : menu, currentItems.length > 0 && isMultipleSelect && (0, _jsxRuntime.jsxs)("div", {
|
|
229
|
+
style: {
|
|
230
|
+
display: 'flex',
|
|
231
|
+
justifyContent: 'space-between',
|
|
232
|
+
alignItems: 'center',
|
|
233
|
+
padding: '8px 12px',
|
|
234
|
+
borderTop: '1px solid #f0f0f0'
|
|
235
|
+
},
|
|
236
|
+
children: [(0, _jsxRuntime.jsxs)("div", {
|
|
237
|
+
children: [(0, _jsxRuntime.jsx)(_antd.Button, {
|
|
238
|
+
type: "primary",
|
|
239
|
+
size: "small",
|
|
240
|
+
style: {
|
|
241
|
+
marginRight: 8
|
|
242
|
+
},
|
|
243
|
+
onClick: e => {
|
|
244
|
+
e.stopPropagation();
|
|
245
|
+
handleConfirm();
|
|
246
|
+
},
|
|
247
|
+
children: "Confirm"
|
|
248
|
+
}), (0, _jsxRuntime.jsx)(_antd.Button, {
|
|
249
|
+
type: "text",
|
|
250
|
+
size: "small",
|
|
251
|
+
onClick: e => {
|
|
252
|
+
e.stopPropagation();
|
|
253
|
+
handleCancel();
|
|
254
|
+
},
|
|
255
|
+
children: "Cancel"
|
|
256
|
+
})]
|
|
257
|
+
}), selectedCount > 0 && (0, _jsxRuntime.jsxs)("span", {
|
|
258
|
+
style: {
|
|
259
|
+
color: '#8c8c8c',
|
|
260
|
+
fontSize: '14px'
|
|
261
|
+
},
|
|
262
|
+
children: [selectedCount, " selected"]
|
|
263
|
+
})]
|
|
264
|
+
})]
|
|
265
|
+
});
|
|
258
266
|
};
|
|
259
267
|
if (type === 'treeSelect' || type === 'multiTreeSelect') {
|
|
260
|
-
return
|
|
261
|
-
|
|
268
|
+
return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
269
|
+
children: [(0, _jsxRuntime.jsx)(StyledTreeSelect, {
|
|
270
|
+
treeData: filteredTree,
|
|
271
|
+
value: customPopupRender ? tempValue : value,
|
|
272
|
+
onChange: customPopupRender ? handleTempChange : onChange,
|
|
273
|
+
placeholder: placeholder,
|
|
274
|
+
maxTagCount: 0,
|
|
275
|
+
maxTagPlaceholder: () => null,
|
|
276
|
+
prefix: type === "multiTreeSelect" && value.length > 0 && prefix(),
|
|
277
|
+
suffixIcon: suffix,
|
|
278
|
+
className: (0, _classnames.default)(`cap-unified-tree-select ${className || ''}`),
|
|
279
|
+
style: style,
|
|
280
|
+
status: status,
|
|
281
|
+
allowClear: allowClear,
|
|
282
|
+
showSearch: false,
|
|
283
|
+
multiple: type === 'multiTreeSelect',
|
|
284
|
+
treeCheckable: treeCheckable,
|
|
285
|
+
showCheckedStrategy: _antd.TreeSelect.SHOW_PARENT,
|
|
286
|
+
virtual: true,
|
|
287
|
+
disabled: disabled,
|
|
288
|
+
filterTreeNode: false,
|
|
289
|
+
...treeSelectVirtualizationProps,
|
|
290
|
+
popupRender: renderCustomDropdown
|
|
291
|
+
}), status === 'error' && (0, _jsxRuntime.jsx)("div", {
|
|
292
|
+
style: {
|
|
293
|
+
color: '#E83135'
|
|
294
|
+
},
|
|
295
|
+
className: "cap-unified-select-status",
|
|
296
|
+
children: statusMessage
|
|
297
|
+
})]
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
return (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
301
|
+
children: [(0, _jsxRuntime.jsx)(StyledSelect, {
|
|
302
|
+
options: filteredOptions,
|
|
262
303
|
value: customPopupRender ? tempValue : value,
|
|
263
304
|
onChange: customPopupRender ? handleTempChange : onChange,
|
|
264
305
|
placeholder: placeholder,
|
|
265
306
|
maxTagCount: 0,
|
|
266
307
|
maxTagPlaceholder: () => null,
|
|
267
|
-
prefix: type === "
|
|
308
|
+
prefix: type === "multiSelect" && value.length > 0 && prefix(),
|
|
268
309
|
suffixIcon: suffix,
|
|
269
|
-
className:
|
|
310
|
+
className: (0, _classnames.default)('cap-unified-select', className),
|
|
270
311
|
style: style,
|
|
271
|
-
status: status,
|
|
272
312
|
allowClear: allowClear,
|
|
273
313
|
showSearch: false,
|
|
274
|
-
|
|
275
|
-
treeCheckable: treeCheckable,
|
|
276
|
-
showCheckedStrategy: TreeSelect.SHOW_PARENT,
|
|
314
|
+
mode: type === 'multiSelect' ? 'multiple' : undefined,
|
|
277
315
|
virtual: true,
|
|
278
316
|
disabled: disabled,
|
|
279
|
-
|
|
280
|
-
|
|
317
|
+
status: status,
|
|
318
|
+
...selectVirtualizationProps,
|
|
281
319
|
popupRender: renderCustomDropdown
|
|
282
|
-
})
|
|
320
|
+
}), status === 'error' && (0, _jsxRuntime.jsx)("div", {
|
|
283
321
|
style: {
|
|
284
322
|
color: '#E83135'
|
|
285
323
|
},
|
|
286
|
-
className: "cap-unified-select-status"
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
options: filteredOptions,
|
|
291
|
-
value: customPopupRender ? tempValue : value,
|
|
292
|
-
onChange: customPopupRender ? handleTempChange : onChange,
|
|
293
|
-
placeholder: placeholder,
|
|
294
|
-
maxTagCount: 0,
|
|
295
|
-
maxTagPlaceholder: () => null,
|
|
296
|
-
prefix: type === "multiSelect" && value.length > 0 && prefix(),
|
|
297
|
-
suffixIcon: suffix,
|
|
298
|
-
className: classnames('cap-unified-select', className),
|
|
299
|
-
style: style,
|
|
300
|
-
allowClear: allowClear,
|
|
301
|
-
showSearch: false,
|
|
302
|
-
mode: type === 'multiSelect' ? 'multiple' : undefined,
|
|
303
|
-
virtual: true,
|
|
304
|
-
disabled: disabled,
|
|
305
|
-
status: status
|
|
306
|
-
}, selectVirtualizationProps, {
|
|
307
|
-
popupRender: renderCustomDropdown
|
|
308
|
-
})), status === 'error' && /*#__PURE__*/React.createElement("div", {
|
|
309
|
-
style: {
|
|
310
|
-
color: '#E83135'
|
|
311
|
-
},
|
|
312
|
-
className: "cap-unified-select-status"
|
|
313
|
-
}, statusMessage));
|
|
324
|
+
className: "cap-unified-select-status",
|
|
325
|
+
children: statusMessage
|
|
326
|
+
})]
|
|
327
|
+
});
|
|
314
328
|
};
|
|
315
|
-
return
|
|
316
|
-
className:
|
|
317
|
-
|
|
329
|
+
return (0, _jsxRuntime.jsxs)(_styles.SelectWrapper, {
|
|
330
|
+
className: (0, _classnames.default)(`cap-unified-select-container ${className || ''}`),
|
|
331
|
+
children: [renderHeader(), renderDropdown()]
|
|
332
|
+
});
|
|
318
333
|
};
|
|
319
334
|
CapUnifiedSelect.propTypes = {
|
|
320
|
-
type:
|
|
321
|
-
options:
|
|
322
|
-
treeData:
|
|
323
|
-
value:
|
|
324
|
-
onChange:
|
|
325
|
-
placeholder:
|
|
326
|
-
className:
|
|
327
|
-
style:
|
|
328
|
-
allowClear:
|
|
329
|
-
label:
|
|
330
|
-
tooltip:
|
|
331
|
-
disabled:
|
|
332
|
-
treeCheckable:
|
|
333
|
-
customPopupRender:
|
|
334
|
-
onConfirm:
|
|
335
|
-
onCancel:
|
|
335
|
+
type: _propTypes.default.oneOf(['select', 'multiSelect', 'treeSelect', 'multiTreeSelect']),
|
|
336
|
+
options: _propTypes.default.array,
|
|
337
|
+
treeData: _propTypes.default.array,
|
|
338
|
+
value: _propTypes.default.any,
|
|
339
|
+
onChange: _propTypes.default.func,
|
|
340
|
+
placeholder: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
|
|
341
|
+
className: _propTypes.default.string,
|
|
342
|
+
style: _propTypes.default.object,
|
|
343
|
+
allowClear: _propTypes.default.bool,
|
|
344
|
+
label: _propTypes.default.string,
|
|
345
|
+
tooltip: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
|
|
346
|
+
disabled: _propTypes.default.bool,
|
|
347
|
+
treeCheckable: _propTypes.default.bool,
|
|
348
|
+
customPopupRender: _propTypes.default.bool,
|
|
349
|
+
onConfirm: _propTypes.default.func,
|
|
350
|
+
onCancel: _propTypes.default.func
|
|
336
351
|
};
|
|
337
352
|
CapUnifiedSelect.defaultProps = {
|
|
338
353
|
type: 'select',
|
|
@@ -341,4 +356,4 @@ CapUnifiedSelect.defaultProps = {
|
|
|
341
356
|
treeCheckable: false,
|
|
342
357
|
className: ''
|
|
343
358
|
};
|
|
344
|
-
|
|
359
|
+
var _default = exports.default = (0, _withStyles.default)(CapUnifiedSelect, _styles.selectStyles);
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.default = void 0;
|
|
5
|
+
var _CapUnifiedSelect = _interopRequireDefault(require("./CapUnifiedSelect"));
|
|
6
|
+
exports.default = _CapUnifiedSelect.default;
|
|
7
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|