@capillarytech/blaze-ui 0.1.6-alpha.3 → 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 +60 -0
- package/components/CapInput/Number.js +39 -0
- package/components/CapInput/Search.js +34 -0
- package/components/CapInput/TextArea.js +41 -0
- package/components/CapInput/index.js +13 -0
- package/components/CapInput/messages.js +24 -0
- package/components/CapInput/styles.js +8 -0
- package/components/CapSkeleton/CapSkeleton.js +24 -0
- package/components/CapSkeleton/index.js +7 -0
- package/components/CapSpin/CapSpin.js +30 -0
- package/components/CapSpin/index.js +7 -0
- package/components/CapTable/CapTable.js +118 -0
- package/components/CapTable/index.js +7 -0
- package/components/CapTable/loadable.js +18 -0
- package/components/CapTable/styles.js +23 -0
- package/components/CapTestSelect/CapTestSelect.js +36 -0
- package/components/CapTestSelect/index.js +7 -0
- package/components/CapUnifiedSelect/CapUnifiedSelect.js +359 -0
- package/components/CapUnifiedSelect/index.js +7 -0
- package/components/CapUnifiedSelect/messages.js +27 -0
- package/components/CapUnifiedSelect/styles.js +36 -0
- package/components/LocaleHoc/index.js +42 -0
- package/components/index.js +33 -0
- package/components/styled/index.js +14 -0
- package/components/styled/variables.js +70 -0
- package/{translations → components/translations}/en.js +37 -35
- package/dist/components/CapSkeleton/CapSkeleton.js +29 -0
- package/dist/components/CapSkeleton/index.js +13 -0
- package/dist/components/CapSpin/CapSpin.js +35 -0
- package/dist/components/CapSpin/index.js +13 -0
- package/dist/{CapTable → components/CapTable}/loadable.js +4 -4
- package/dist/components/CapTestSelect/CapTestSelect.js +40 -0
- package/dist/components/CapTestSelect/index.js +13 -0
- package/dist/components/CapUnifiedSelect/CapUnifiedSelect.js +406 -0
- package/dist/components/CapUnifiedSelect/index.js +13 -0
- package/dist/components/CapUnifiedSelect/messages.js +29 -0
- package/dist/components/CapUnifiedSelect/styles.js +39 -0
- package/dist/{index.js → components/index.js} +27 -0
- package/dist/esm/{CapRow/CapRow.js → components/CapSkeleton/CapSkeleton.js} +12 -12
- package/dist/esm/components/CapSkeleton/index.js +1 -0
- package/dist/esm/components/CapSpin/CapSpin.js +28 -0
- package/dist/esm/components/CapSpin/index.js +1 -0
- package/dist/esm/components/CapTable/loadable.js +12 -0
- package/dist/esm/components/CapTestSelect/CapTestSelect.js +34 -0
- package/dist/esm/components/CapTestSelect/index.js +1 -0
- package/dist/esm/components/CapUnifiedSelect/CapUnifiedSelect.js +398 -0
- package/dist/esm/components/CapUnifiedSelect/index.js +1 -0
- package/dist/esm/components/CapUnifiedSelect/styles.js +31 -0
- package/dist/esm/{index.js → components/index.js} +5 -1
- package/dist/esm/utils/index.js +1 -0
- package/dist/esm/utils/withStyles.js +23 -0
- package/dist/utils/index.js +13 -0
- package/dist/utils/withStyles.js +29 -0
- package/package.json +6 -10
- package/utils/index.js +7 -0
- package/utils/withStyles.js +15 -0
- package/CapHeading/CapHeading.js +0 -71
- package/CapHeading/index.js +0 -1
- package/CapHeading/styles.js +0 -125
- package/CapInfoNote/CapInfoNote.js +0 -54
- package/CapInfoNote/index.js +0 -1
- package/CapInfoNote/styles.js +0 -63
- package/CapInput/CapInput.js +0 -67
- package/CapInput/Number.js +0 -38
- package/CapInput/Search.js +0 -32
- package/CapInput/TextArea.js +0 -45
- package/CapInput/index.js +0 -10
- package/CapInput/loadable.js +0 -9
- package/CapInput/messages.js +0 -27
- package/CapInput/styles.js +0 -81
- package/CapLabel/CapLabel.js +0 -106
- package/CapLabel/index.js +0 -1
- package/CapLabel/styles.js +0 -221
- package/CapRow/CapRow.js +0 -22
- package/CapRow/index.js +0 -1
- package/CapRow/styles.js +0 -9
- package/CapTable/CapTable.js +0 -146
- package/CapTable/index.js +0 -3
- package/CapTable/loadable.js +0 -13
- package/CapTable/styles.js +0 -134
- package/CapTooltip/CapTooltip.js +0 -36
- package/CapTooltip/index.js +0 -1
- package/CapTooltip/styles.js +0 -42
- package/CapUnifiedSelect/CapUnifiedSelect.js +0 -121
- package/CapUnifiedSelect/index.js +0 -4
- package/CapUnifiedSelect/loadable.js +0 -3
- package/CapUnifiedSelect/messages.js +0 -24
- package/CapUnifiedSelect/styles.js +0 -223
- package/LocaleHoc/index.js +0 -38
- package/dist/235.index.js +0 -2
- package/dist/235.index.js.LICENSE.txt +0 -29
- package/dist/603.index.js +0 -1
- package/dist/esm/CapHeading/CapHeading.js +0 -41
- package/dist/esm/CapHeading/index.js +0 -1
- package/dist/esm/CapHeading/styles.js +0 -123
- package/dist/esm/CapInfoNote/CapInfoNote.js +0 -62
- package/dist/esm/CapInfoNote/index.js +0 -1
- package/dist/esm/CapInfoNote/styles.js +0 -6
- package/dist/esm/CapInput/loadable.js +0 -9
- package/dist/esm/CapLabel/CapLabel.js +0 -50
- package/dist/esm/CapLabel/index.js +0 -1
- package/dist/esm/CapLabel/styles.js +0 -219
- package/dist/esm/CapRow/index.js +0 -1
- package/dist/esm/CapRow/styles.js +0 -5
- package/dist/esm/CapTable/loadable.js +0 -12
- package/dist/esm/CapTooltip/CapTooltip.js +0 -34
- package/dist/esm/CapTooltip/index.js +0 -1
- package/dist/esm/CapTooltip/styles.js +0 -6
- package/dist/esm/CapUnifiedSelect/CapUnifiedSelect.js +0 -101
- package/dist/esm/CapUnifiedSelect/index.js +0 -3
- package/dist/esm/CapUnifiedSelect/loadable.js +0 -4
- package/dist/esm/CapUnifiedSelect/styles.js +0 -15
- package/dist/index.js.LICENSE.txt +0 -7
- package/index.js +0 -10
- package/styled/index.js +0 -6
- package/styled/variables.js +0 -89
- /package/dist/{CapInput → components/CapInput}/CapInput.js +0 -0
- /package/dist/{CapInput → components/CapInput}/Number.js +0 -0
- /package/dist/{CapInput → components/CapInput}/Search.js +0 -0
- /package/dist/{CapInput → components/CapInput}/TextArea.js +0 -0
- /package/dist/{CapInput → components/CapInput}/index.js +0 -0
- /package/dist/{CapInput → components/CapInput}/messages.js +0 -0
- /package/dist/{CapInput → components/CapInput}/styles.js +0 -0
- /package/dist/{CapTable → components/CapTable}/CapTable.js +0 -0
- /package/dist/{CapTable → components/CapTable}/index.js +0 -0
- /package/dist/{CapTable → components/CapTable}/styles.js +0 -0
- /package/dist/{LocaleHoc → components/LocaleHoc}/index.js +0 -0
- /package/dist/{styled → components/styled}/index.js +0 -0
- /package/dist/{styled → components/styled}/variables.js +0 -0
- /package/dist/{translations → components/translations}/en.js +0 -0
- /package/dist/esm/{CapInput → components/CapInput}/CapInput.js +0 -0
- /package/dist/esm/{CapInput → components/CapInput}/Number.js +0 -0
- /package/dist/esm/{CapInput → components/CapInput}/Search.js +0 -0
- /package/dist/esm/{CapInput → components/CapInput}/TextArea.js +0 -0
- /package/dist/esm/{CapInput → components/CapInput}/index.js +0 -0
- /package/dist/esm/{CapInput → components/CapInput}/messages.js +0 -0
- /package/dist/esm/{CapInput → components/CapInput}/styles.js +0 -0
- /package/dist/esm/{CapTable → components/CapTable}/CapTable.js +0 -0
- /package/dist/esm/{CapTable → components/CapTable}/index.js +0 -0
- /package/dist/esm/{CapTable → components/CapTable}/styles.js +0 -0
- /package/dist/esm/{CapUnifiedSelect → components/CapUnifiedSelect}/messages.js +0 -0
- /package/dist/esm/{LocaleHoc → components/LocaleHoc}/index.js +0 -0
- /package/dist/esm/{styled → components/styled}/index.js +0 -0
- /package/dist/esm/{styled → components/styled}/variables.js +0 -0
- /package/dist/esm/{translations → components/translations}/en.js +0 -0
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
+
var _antd = require("antd");
|
|
12
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
13
|
+
var _icons = require("@ant-design/icons");
|
|
14
|
+
var _withStyles = _interopRequireDefault(require("../utils/withStyles"));
|
|
15
|
+
var _styles = require("./styles");
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
17
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(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 (var _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); }
|
|
18
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
19
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
20
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
21
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
22
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
23
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
24
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
25
|
+
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."); }
|
|
26
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
27
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
28
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
29
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } // Enhanced CapUnifiedSelect supporting 4 scenarios with advanced features
|
|
30
|
+
// Updated import path
|
|
31
|
+
var CapUnifiedSelect = function CapUnifiedSelect(_ref) {
|
|
32
|
+
var type = _ref.type,
|
|
33
|
+
_ref$options = _ref.options,
|
|
34
|
+
options = _ref$options === void 0 ? [] : _ref$options,
|
|
35
|
+
treeData = _ref.treeData,
|
|
36
|
+
value = _ref.value,
|
|
37
|
+
onChange = _ref.onChange,
|
|
38
|
+
_ref$placeholder = _ref.placeholder,
|
|
39
|
+
placeholder = _ref$placeholder === void 0 ? 'Select an option' : _ref$placeholder,
|
|
40
|
+
className = _ref.className,
|
|
41
|
+
style = _ref.style,
|
|
42
|
+
status = _ref.status,
|
|
43
|
+
statusMessage = _ref.statusMessage,
|
|
44
|
+
_ref$allowClear = _ref.allowClear,
|
|
45
|
+
allowClear = _ref$allowClear === void 0 ? false : _ref$allowClear,
|
|
46
|
+
label = _ref.label,
|
|
47
|
+
tooltip = _ref.tooltip,
|
|
48
|
+
_ref$disabled = _ref.disabled,
|
|
49
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
50
|
+
_ref$treeCheckable = _ref.treeCheckable,
|
|
51
|
+
treeCheckable = _ref$treeCheckable === void 0 ? false : _ref$treeCheckable,
|
|
52
|
+
_ref$customPopupRende = _ref.customPopupRender,
|
|
53
|
+
customPopupRender = _ref$customPopupRende === void 0 ? false : _ref$customPopupRende,
|
|
54
|
+
onConfirm = _ref.onConfirm,
|
|
55
|
+
onCancel = _ref.onCancel;
|
|
56
|
+
var StyledSelect = (0, _styledComponents["default"])(_antd.Select).withConfig({
|
|
57
|
+
displayName: "StyledSelect",
|
|
58
|
+
componentId: "sc-wsphu8-0"
|
|
59
|
+
})(["", ""], _styles.selectStyles);
|
|
60
|
+
var StyledTreeSelect = (0, _styledComponents["default"])(_antd.TreeSelect).withConfig({
|
|
61
|
+
displayName: "StyledTreeSelect",
|
|
62
|
+
componentId: "sc-wsphu8-1"
|
|
63
|
+
})(["", ""], _styles.selectStyles);
|
|
64
|
+
var _useState = (0, _react.useState)(''),
|
|
65
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
66
|
+
searchText = _useState2[0],
|
|
67
|
+
setSearchText = _useState2[1];
|
|
68
|
+
var _useState3 = (0, _react.useState)(value),
|
|
69
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
70
|
+
tempValue = _useState4[0],
|
|
71
|
+
setTempValue = _useState4[1];
|
|
72
|
+
var _useState5 = (0, _react.useState)(false),
|
|
73
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
74
|
+
allSelected = _useState6[0],
|
|
75
|
+
setAllSelected = _useState6[1];
|
|
76
|
+
|
|
77
|
+
// Update tempValue when value changes
|
|
78
|
+
(0, _react.useEffect)(function () {
|
|
79
|
+
setTempValue(value);
|
|
80
|
+
}, [value]);
|
|
81
|
+
var selectVirtualizationProps = {
|
|
82
|
+
listHeight: 256
|
|
83
|
+
};
|
|
84
|
+
var treeSelectVirtualizationProps = {
|
|
85
|
+
listHeight: 256,
|
|
86
|
+
listItemHeight: 32
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// No results component
|
|
90
|
+
var NoResult = function NoResult() {
|
|
91
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
92
|
+
style: {
|
|
93
|
+
display: 'flex',
|
|
94
|
+
flexDirection: 'column',
|
|
95
|
+
alignItems: 'center',
|
|
96
|
+
justifyContent: 'center',
|
|
97
|
+
height: 200,
|
|
98
|
+
color: '#8c8c8c',
|
|
99
|
+
fontSize: 14
|
|
100
|
+
}
|
|
101
|
+
}, /*#__PURE__*/_react["default"].createElement(_icons.WarningFilled, {
|
|
102
|
+
style: {
|
|
103
|
+
fontSize: 36,
|
|
104
|
+
marginBottom: 8,
|
|
105
|
+
color: '#bfbfbf'
|
|
106
|
+
}
|
|
107
|
+
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
108
|
+
style: {
|
|
109
|
+
fontWeight: 500
|
|
110
|
+
}
|
|
111
|
+
}, "No results found"));
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
// Filter tree data based on search text
|
|
115
|
+
var getFilteredTreeData = function getFilteredTreeData(data, search) {
|
|
116
|
+
if (!search) return data;
|
|
117
|
+
var filterNode = function filterNode(node) {
|
|
118
|
+
var _node$title, _node$label;
|
|
119
|
+
var titleText = ((_node$title = node.title) === null || _node$title === void 0 ? void 0 : _node$title.toLowerCase()) || '';
|
|
120
|
+
var labelText = ((_node$label = node.label) === null || _node$label === void 0 ? void 0 : _node$label.toLowerCase()) || '';
|
|
121
|
+
return titleText.includes(search.toLowerCase()) || labelText.includes(search.toLowerCase());
|
|
122
|
+
};
|
|
123
|
+
var _loop = function loop(data) {
|
|
124
|
+
return data.map(function (item) {
|
|
125
|
+
var children = item.children ? _loop(item.children) : [];
|
|
126
|
+
if (filterNode(item) || children.length) {
|
|
127
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
128
|
+
children: children
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
return null;
|
|
132
|
+
}).filter(Boolean);
|
|
133
|
+
};
|
|
134
|
+
return _loop(data);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
// Get all leaf node values from tree data
|
|
138
|
+
var _flattenedLeafValues = function flattenedLeafValues(nodes) {
|
|
139
|
+
return (nodes === null || nodes === void 0 ? void 0 : nodes.flatMap(function (node) {
|
|
140
|
+
return node.children ? _flattenedLeafValues(node.children) : [node.value];
|
|
141
|
+
})) || [];
|
|
142
|
+
};
|
|
143
|
+
var filteredTree = getFilteredTreeData(treeData || options, searchText);
|
|
144
|
+
var filteredOptions = !searchText ? options : options.filter(function (opt) {
|
|
145
|
+
var _opt$label;
|
|
146
|
+
return (_opt$label = opt.label) === null || _opt$label === void 0 ? void 0 : _opt$label.toLowerCase().includes(searchText.toLowerCase());
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
// All available leaf values for the current filtered tree data
|
|
150
|
+
var leafValues = _flattenedLeafValues(filteredTree);
|
|
151
|
+
|
|
152
|
+
// Handles select all checkbox click
|
|
153
|
+
var handleSelectAll = function handleSelectAll() {
|
|
154
|
+
var isTree = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
155
|
+
var availableValues = isTree ? leafValues : filteredOptions.map(function (opt) {
|
|
156
|
+
return opt.value;
|
|
157
|
+
});
|
|
158
|
+
if (allSelected) {
|
|
159
|
+
setTempValue([]);
|
|
160
|
+
} else {
|
|
161
|
+
setTempValue(availableValues);
|
|
162
|
+
}
|
|
163
|
+
setAllSelected(!allSelected);
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
// Update allSelected state when value changes
|
|
167
|
+
(0, _react.useEffect)(function () {
|
|
168
|
+
var isMultipleMode = type === 'multiSelect' || type === 'multiTreeSelect';
|
|
169
|
+
if (isMultipleMode && Array.isArray(tempValue)) {
|
|
170
|
+
var availableValues = type.includes('tree') ? leafValues : filteredOptions.map(function (opt) {
|
|
171
|
+
return opt.value;
|
|
172
|
+
});
|
|
173
|
+
setAllSelected(tempValue.length > 0 && tempValue.length === availableValues.length);
|
|
174
|
+
}
|
|
175
|
+
}, [tempValue, filteredOptions, leafValues, type]);
|
|
176
|
+
|
|
177
|
+
// Handle confirmation
|
|
178
|
+
var handleConfirm = function handleConfirm() {
|
|
179
|
+
if (onConfirm) {
|
|
180
|
+
onConfirm(tempValue);
|
|
181
|
+
} else {
|
|
182
|
+
onChange(tempValue);
|
|
183
|
+
}
|
|
184
|
+
setSearchText('');
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
// Handle cancellation
|
|
188
|
+
var handleCancel = function handleCancel() {
|
|
189
|
+
if (onCancel) {
|
|
190
|
+
onCancel();
|
|
191
|
+
}
|
|
192
|
+
setTempValue(value);
|
|
193
|
+
setSearchText('');
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
// Handle temporary value change
|
|
197
|
+
var handleTempChange = function handleTempChange(newValue) {
|
|
198
|
+
setTempValue(newValue);
|
|
199
|
+
};
|
|
200
|
+
var suffix = (type === "multiTreeSelect" || type === "multiSelect") && Array.isArray(value) && value.length > 1 ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("span", null, "+", value.length - 1, " more", /*#__PURE__*/_react["default"].createElement(_icons.DownOutlined, null))) : /*#__PURE__*/_react["default"].createElement(_icons.DownOutlined, null);
|
|
201
|
+
var prefix = function prefix() {
|
|
202
|
+
if ((type === "multiTreeSelect" || type === "multiSelect") && Array.isArray(value) && value.length > 0) {
|
|
203
|
+
var selectedLabels = options.filter(function (opt) {
|
|
204
|
+
return value.includes(opt.value);
|
|
205
|
+
}).map(function (opt) {
|
|
206
|
+
return opt.label;
|
|
207
|
+
});
|
|
208
|
+
return selectedLabels[0];
|
|
209
|
+
} else {
|
|
210
|
+
return null;
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
var renderHeader = function renderHeader() {
|
|
214
|
+
if (!label && !tooltip) return null;
|
|
215
|
+
return /*#__PURE__*/_react["default"].createElement(_styles.HeaderWrapper, {
|
|
216
|
+
className: disabled ? 'disabled' : ''
|
|
217
|
+
}, label && /*#__PURE__*/_react["default"].createElement("label", {
|
|
218
|
+
type: "label16",
|
|
219
|
+
className: disabled ? 'disabled' : ''
|
|
220
|
+
}, label), tooltip && /*#__PURE__*/_react["default"].createElement(_antd.Tooltip, {
|
|
221
|
+
title: tooltip
|
|
222
|
+
}, /*#__PURE__*/_react["default"].createElement(_icons.InfoCircleOutlined, {
|
|
223
|
+
className: disabled ? 'disabled' : '',
|
|
224
|
+
style: {
|
|
225
|
+
color: '#B3BAC5'
|
|
226
|
+
}
|
|
227
|
+
})));
|
|
228
|
+
};
|
|
229
|
+
var renderDropdown = function renderDropdown() {
|
|
230
|
+
var isMultipleSelect = type === 'multiSelect' || type === 'multiTreeSelect';
|
|
231
|
+
var isTreeMode = type === 'treeSelect' || type === 'multiTreeSelect';
|
|
232
|
+
var currentItems = isTreeMode ? filteredTree : filteredOptions;
|
|
233
|
+
var selectedCount = Array.isArray(tempValue) ? tempValue.length : tempValue ? 1 : 0;
|
|
234
|
+
|
|
235
|
+
// Custom dropdown render for both Select and TreeSelect
|
|
236
|
+
var renderCustomDropdown = function renderCustomDropdown(menu) {
|
|
237
|
+
if (!customPopupRender) return menu;
|
|
238
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
239
|
+
style: {
|
|
240
|
+
borderBottom: '1px solid #f0f0f0'
|
|
241
|
+
}
|
|
242
|
+
}, /*#__PURE__*/_react["default"].createElement(_antd.Input, {
|
|
243
|
+
prefix: /*#__PURE__*/_react["default"].createElement(_icons.SearchOutlined, {
|
|
244
|
+
style: {
|
|
245
|
+
color: "#B3BAC5"
|
|
246
|
+
}
|
|
247
|
+
}),
|
|
248
|
+
placeholder: "Search",
|
|
249
|
+
variant: "borderless",
|
|
250
|
+
value: searchText,
|
|
251
|
+
onChange: function onChange(e) {
|
|
252
|
+
return setSearchText(e.target.value);
|
|
253
|
+
},
|
|
254
|
+
onKeyDown: function onKeyDown(e) {
|
|
255
|
+
return e.stopPropagation();
|
|
256
|
+
}
|
|
257
|
+
})), isMultipleSelect && currentItems.length > 0 && /*#__PURE__*/_react["default"].createElement("div", {
|
|
258
|
+
style: {
|
|
259
|
+
padding: '8px 12px',
|
|
260
|
+
cursor: 'pointer',
|
|
261
|
+
display: 'flex',
|
|
262
|
+
alignItems: 'center',
|
|
263
|
+
borderBottom: '1px solid #f0f0f0'
|
|
264
|
+
},
|
|
265
|
+
onClick: function onClick(e) {
|
|
266
|
+
// Prevent event propagation to keep dropdown open
|
|
267
|
+
e.stopPropagation();
|
|
268
|
+
handleSelectAll(isTreeMode);
|
|
269
|
+
}
|
|
270
|
+
}, /*#__PURE__*/_react["default"].createElement("input", {
|
|
271
|
+
type: "checkbox",
|
|
272
|
+
checked: allSelected,
|
|
273
|
+
readOnly: true,
|
|
274
|
+
style: {
|
|
275
|
+
cursor: 'pointer'
|
|
276
|
+
},
|
|
277
|
+
onClick: function onClick(e) {
|
|
278
|
+
return e.stopPropagation();
|
|
279
|
+
}
|
|
280
|
+
}), /*#__PURE__*/_react["default"].createElement("label", {
|
|
281
|
+
style: {
|
|
282
|
+
marginLeft: 8,
|
|
283
|
+
cursor: 'pointer'
|
|
284
|
+
}
|
|
285
|
+
}, "Select all")), currentItems.length === 0 ? /*#__PURE__*/_react["default"].createElement(NoResult, null) : menu, currentItems.length > 0 && isMultipleSelect && /*#__PURE__*/_react["default"].createElement("div", {
|
|
286
|
+
style: {
|
|
287
|
+
display: 'flex',
|
|
288
|
+
justifyContent: 'space-between',
|
|
289
|
+
alignItems: 'center',
|
|
290
|
+
padding: '8px 12px',
|
|
291
|
+
borderTop: '1px solid #f0f0f0'
|
|
292
|
+
}
|
|
293
|
+
}, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_antd.Button, {
|
|
294
|
+
type: "primary",
|
|
295
|
+
size: "small",
|
|
296
|
+
style: {
|
|
297
|
+
marginRight: 8
|
|
298
|
+
},
|
|
299
|
+
onClick: function onClick(e) {
|
|
300
|
+
e.stopPropagation();
|
|
301
|
+
handleConfirm();
|
|
302
|
+
}
|
|
303
|
+
}, "Confirm"), /*#__PURE__*/_react["default"].createElement(_antd.Button, {
|
|
304
|
+
type: "text",
|
|
305
|
+
size: "small",
|
|
306
|
+
onClick: function onClick(e) {
|
|
307
|
+
e.stopPropagation();
|
|
308
|
+
handleCancel();
|
|
309
|
+
}
|
|
310
|
+
}, "Cancel")), selectedCount > 0 && /*#__PURE__*/_react["default"].createElement("span", {
|
|
311
|
+
style: {
|
|
312
|
+
color: '#8c8c8c',
|
|
313
|
+
fontSize: '14px'
|
|
314
|
+
}
|
|
315
|
+
}, selectedCount, " selected")));
|
|
316
|
+
};
|
|
317
|
+
if (type === 'treeSelect' || type === 'multiTreeSelect') {
|
|
318
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(StyledTreeSelect, _extends({
|
|
319
|
+
treeData: filteredTree,
|
|
320
|
+
value: customPopupRender ? tempValue : value,
|
|
321
|
+
onChange: customPopupRender ? handleTempChange : onChange,
|
|
322
|
+
placeholder: placeholder,
|
|
323
|
+
maxTagCount: 0,
|
|
324
|
+
maxTagPlaceholder: function maxTagPlaceholder() {
|
|
325
|
+
return null;
|
|
326
|
+
},
|
|
327
|
+
prefix: type === "multiTreeSelect" && value.length > 0 && prefix(),
|
|
328
|
+
suffixIcon: suffix,
|
|
329
|
+
className: (0, _classnames["default"])("cap-unified-tree-select ".concat(className || '')),
|
|
330
|
+
style: style,
|
|
331
|
+
status: status,
|
|
332
|
+
allowClear: allowClear,
|
|
333
|
+
showSearch: false,
|
|
334
|
+
multiple: type === 'multiTreeSelect',
|
|
335
|
+
treeCheckable: treeCheckable,
|
|
336
|
+
showCheckedStrategy: _antd.TreeSelect.SHOW_PARENT,
|
|
337
|
+
virtual: true,
|
|
338
|
+
disabled: disabled,
|
|
339
|
+
filterTreeNode: false
|
|
340
|
+
}, treeSelectVirtualizationProps, {
|
|
341
|
+
popupRender: renderCustomDropdown
|
|
342
|
+
})), status === 'error' && /*#__PURE__*/_react["default"].createElement("div", {
|
|
343
|
+
style: {
|
|
344
|
+
color: '#E83135'
|
|
345
|
+
},
|
|
346
|
+
className: "cap-unified-select-status"
|
|
347
|
+
}, statusMessage));
|
|
348
|
+
}
|
|
349
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(StyledSelect, _extends({
|
|
350
|
+
options: filteredOptions,
|
|
351
|
+
value: customPopupRender ? tempValue : value,
|
|
352
|
+
onChange: customPopupRender ? handleTempChange : onChange,
|
|
353
|
+
placeholder: placeholder,
|
|
354
|
+
maxTagCount: 0,
|
|
355
|
+
maxTagPlaceholder: function maxTagPlaceholder() {
|
|
356
|
+
return null;
|
|
357
|
+
},
|
|
358
|
+
prefix: type === "multiSelect" && value.length > 0 && prefix(),
|
|
359
|
+
suffixIcon: suffix,
|
|
360
|
+
className: (0, _classnames["default"])('cap-unified-select', className),
|
|
361
|
+
style: style,
|
|
362
|
+
allowClear: allowClear,
|
|
363
|
+
showSearch: false,
|
|
364
|
+
mode: type === 'multiSelect' ? 'multiple' : undefined,
|
|
365
|
+
virtual: true,
|
|
366
|
+
disabled: disabled,
|
|
367
|
+
status: status
|
|
368
|
+
}, selectVirtualizationProps, {
|
|
369
|
+
popupRender: renderCustomDropdown
|
|
370
|
+
})), status === 'error' && /*#__PURE__*/_react["default"].createElement("div", {
|
|
371
|
+
style: {
|
|
372
|
+
color: '#E83135'
|
|
373
|
+
},
|
|
374
|
+
className: "cap-unified-select-status"
|
|
375
|
+
}, statusMessage));
|
|
376
|
+
};
|
|
377
|
+
return /*#__PURE__*/_react["default"].createElement(_styles.SelectWrapper, {
|
|
378
|
+
className: (0, _classnames["default"])("cap-unified-select-container ".concat(className || ''))
|
|
379
|
+
}, renderHeader(), renderDropdown());
|
|
380
|
+
};
|
|
381
|
+
CapUnifiedSelect.propTypes = {
|
|
382
|
+
type: _propTypes["default"].oneOf(['select', 'multiSelect', 'treeSelect', 'multiTreeSelect']),
|
|
383
|
+
options: _propTypes["default"].array,
|
|
384
|
+
treeData: _propTypes["default"].array,
|
|
385
|
+
value: _propTypes["default"].any,
|
|
386
|
+
onChange: _propTypes["default"].func,
|
|
387
|
+
placeholder: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].node]),
|
|
388
|
+
className: _propTypes["default"].string,
|
|
389
|
+
style: _propTypes["default"].object,
|
|
390
|
+
allowClear: _propTypes["default"].bool,
|
|
391
|
+
label: _propTypes["default"].string,
|
|
392
|
+
tooltip: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].node]),
|
|
393
|
+
disabled: _propTypes["default"].bool,
|
|
394
|
+
treeCheckable: _propTypes["default"].bool,
|
|
395
|
+
customPopupRender: _propTypes["default"].bool,
|
|
396
|
+
onConfirm: _propTypes["default"].func,
|
|
397
|
+
onCancel: _propTypes["default"].func
|
|
398
|
+
};
|
|
399
|
+
CapUnifiedSelect.defaultProps = {
|
|
400
|
+
type: 'select',
|
|
401
|
+
allowClear: false,
|
|
402
|
+
customPopupRender: false,
|
|
403
|
+
treeCheckable: false,
|
|
404
|
+
className: ''
|
|
405
|
+
};
|
|
406
|
+
var _default = exports["default"] = (0, _withStyles["default"])(CapUnifiedSelect, _styles.selectStyles);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "default", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _CapUnifiedSelect["default"];
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _CapUnifiedSelect = _interopRequireDefault(require("./CapUnifiedSelect"));
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _reactIntl = require("react-intl");
|
|
8
|
+
var _default = exports["default"] = (0, _reactIntl.defineMessages)({
|
|
9
|
+
selectPlaceholder: {
|
|
10
|
+
id: 'cap.unified.select.placeholder',
|
|
11
|
+
defaultMessage: 'Select an option'
|
|
12
|
+
},
|
|
13
|
+
searchPlaceholder: {
|
|
14
|
+
id: 'cap.unified.select.search.placeholder',
|
|
15
|
+
defaultMessage: 'Search...'
|
|
16
|
+
},
|
|
17
|
+
noData: {
|
|
18
|
+
id: 'cap.unified.select.no.data',
|
|
19
|
+
defaultMessage: 'No data'
|
|
20
|
+
},
|
|
21
|
+
loading: {
|
|
22
|
+
id: 'cap.unified.select.loading',
|
|
23
|
+
defaultMessage: 'Loading...'
|
|
24
|
+
},
|
|
25
|
+
selected: {
|
|
26
|
+
id: 'cap.unified.select.selected',
|
|
27
|
+
defaultMessage: '{count} items selected'
|
|
28
|
+
}
|
|
29
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.selectStyles = exports.StyledInfoIcon = exports.SelectWrapper = exports.SelectAllCheckbox = exports.SearchInputWrapper = exports.NoResultWrapper = exports.HeaderWrapper = exports.DropdownFooter = void 0;
|
|
8
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
|
+
var styledVars = _interopRequireWildcard(require("../styled/variables"));
|
|
10
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(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 (var _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
|
+
var SelectWrapper = exports.SelectWrapper = _styledComponents["default"].div.withConfig({
|
|
12
|
+
displayName: "SelectWrapper",
|
|
13
|
+
componentId: "sc-3v7xpu-0"
|
|
14
|
+
})(["display:flex;flex-direction:column;gap:8px;width:100%;&.disabled{cursor:not-allowed;}"]);
|
|
15
|
+
var HeaderWrapper = exports.HeaderWrapper = _styledComponents["default"].div.withConfig({
|
|
16
|
+
displayName: "HeaderWrapper",
|
|
17
|
+
componentId: "sc-3v7xpu-1"
|
|
18
|
+
})(["display:flex;align-items:center;gap:4px;&.disabled{opacity:0.5;cursor:not-allowed;}"]);
|
|
19
|
+
var DropdownFooter = exports.DropdownFooter = _styledComponents["default"].div.withConfig({
|
|
20
|
+
displayName: "DropdownFooter",
|
|
21
|
+
componentId: "sc-3v7xpu-2"
|
|
22
|
+
})(["display:flex;justify-content:space-between;align-items:center;padding:8px;border-top:1px solid #f0f0f0;.footer-buttons{display:flex;align-items:center;gap:8px;}.total-count{color:#8c8c8c;font-size:12px;}"]);
|
|
23
|
+
var SearchInputWrapper = exports.SearchInputWrapper = _styledComponents["default"].div.withConfig({
|
|
24
|
+
displayName: "SearchInputWrapper",
|
|
25
|
+
componentId: "sc-3v7xpu-3"
|
|
26
|
+
})(["padding:8px;border-bottom:1px solid #f0f0f0;"]);
|
|
27
|
+
var SelectAllCheckbox = exports.SelectAllCheckbox = _styledComponents["default"].div.withConfig({
|
|
28
|
+
displayName: "SelectAllCheckbox",
|
|
29
|
+
componentId: "sc-3v7xpu-4"
|
|
30
|
+
})(["display:flex;align-items:center;padding:8px 12px;cursor:pointer;font-weight:500;border-bottom:1px solid #f0f0f0;user-select:none;input[type=\"checkbox\"]{cursor:pointer;}"]);
|
|
31
|
+
var NoResultWrapper = exports.NoResultWrapper = _styledComponents["default"].div.withConfig({
|
|
32
|
+
displayName: "NoResultWrapper",
|
|
33
|
+
componentId: "sc-3v7xpu-5"
|
|
34
|
+
})(["display:flex;flex-direction:column;align-items:center;justify-content:center;height:200px;color:#8c8c8c;font-size:14px;"]);
|
|
35
|
+
var StyledInfoIcon = exports.StyledInfoIcon = _styledComponents["default"].span.withConfig({
|
|
36
|
+
displayName: "StyledInfoIcon",
|
|
37
|
+
componentId: "sc-3v7xpu-6"
|
|
38
|
+
})(["color:", ";font-size:16px;cursor:help;margin-left:4px;display:flex;align-items:center;&:hover{color:", ";}&.disabled{cursor:not-allowed;&:hover{color:", ";}}"], styledVars.CAP_G05, styledVars.CAP_G03, styledVars.CAP_G05);
|
|
39
|
+
var selectStyles = exports.selectStyles = (0, _styledComponents.css)(["&.cap-unified-select{width:100%;font-family:", ";}&.cap-unified-select-container{.ant-select-prefix{margin-left:-5px !important;font-size:14px !important;font-weight:400 !important;color:#091E42 !important;line-height:20px !important;}}"], styledVars.FONT_FAMILY);
|
|
@@ -4,6 +4,14 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
+
var _exportNames = {
|
|
8
|
+
CapInput: true,
|
|
9
|
+
CapTable: true,
|
|
10
|
+
CapTestSelect: true,
|
|
11
|
+
LocaleHoc: true,
|
|
12
|
+
styledVars: true,
|
|
13
|
+
styled: true
|
|
14
|
+
};
|
|
7
15
|
Object.defineProperty(exports, "CapInput", {
|
|
8
16
|
enumerable: true,
|
|
9
17
|
get: function get() {
|
|
@@ -16,6 +24,12 @@ Object.defineProperty(exports, "CapTable", {
|
|
|
16
24
|
return _CapTable["default"];
|
|
17
25
|
}
|
|
18
26
|
});
|
|
27
|
+
Object.defineProperty(exports, "CapTestSelect", {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function get() {
|
|
30
|
+
return _CapTestSelect["default"];
|
|
31
|
+
}
|
|
32
|
+
});
|
|
19
33
|
Object.defineProperty(exports, "LocaleHoc", {
|
|
20
34
|
enumerable: true,
|
|
21
35
|
get: function get() {
|
|
@@ -31,9 +45,22 @@ Object.defineProperty(exports, "styled", {
|
|
|
31
45
|
exports.styledVars = void 0;
|
|
32
46
|
var _CapInput = _interopRequireDefault(require("./CapInput"));
|
|
33
47
|
var _CapTable = _interopRequireDefault(require("./CapTable"));
|
|
48
|
+
var _CapTestSelect = _interopRequireDefault(require("./CapTestSelect"));
|
|
34
49
|
var _LocaleHoc = _interopRequireDefault(require("./LocaleHoc"));
|
|
35
50
|
var _styledVars = _interopRequireWildcard(require("./styled/variables"));
|
|
36
51
|
exports.styledVars = _styledVars;
|
|
37
52
|
var _styled = _interopRequireDefault(require("./styled"));
|
|
53
|
+
var _utils = require("../utils");
|
|
54
|
+
Object.keys(_utils).forEach(function (key) {
|
|
55
|
+
if (key === "default" || key === "__esModule") return;
|
|
56
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
57
|
+
if (key in exports && exports[key] === _utils[key]) return;
|
|
58
|
+
Object.defineProperty(exports, key, {
|
|
59
|
+
enumerable: true,
|
|
60
|
+
get: function get() {
|
|
61
|
+
return _utils[key];
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
});
|
|
38
65
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(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 (var _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); }
|
|
39
66
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
var _excluded = ["className"
|
|
1
|
+
var _excluded = ["className"];
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
4
4
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
5
|
+
/**
|
|
6
|
+
* CapSkeleton - Migrated to Ant Design v5
|
|
7
|
+
*/
|
|
5
8
|
import React from 'react';
|
|
6
9
|
import PropTypes from 'prop-types';
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
import { RowWrapper } from './styles';
|
|
10
|
-
var CapRow = function CapRow(_ref) {
|
|
10
|
+
import { Skeleton } from 'antd';
|
|
11
|
+
var CapSkeleton = function CapSkeleton(_ref) {
|
|
11
12
|
var className = _ref.className,
|
|
12
|
-
children = _ref.children,
|
|
13
13
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
var combinedClassName = "cap-skeleton-v2 ".concat(className || '').trim();
|
|
15
|
+
return /*#__PURE__*/React.createElement(Skeleton, _extends({
|
|
16
|
+
className: combinedClassName
|
|
17
|
+
}, rest));
|
|
17
18
|
};
|
|
18
|
-
|
|
19
|
-
children: PropTypes.node,
|
|
19
|
+
CapSkeleton.propTypes = {
|
|
20
20
|
className: PropTypes.string
|
|
21
21
|
};
|
|
22
|
-
export default
|
|
22
|
+
export default CapSkeleton;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './CapSkeleton';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
var _excluded = ["className"];
|
|
2
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
4
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
5
|
+
/**
|
|
6
|
+
* CapSpin - Migrated to Ant Design v5
|
|
7
|
+
*/
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import PropTypes from 'prop-types';
|
|
10
|
+
import { Spin } from 'antd';
|
|
11
|
+
var CapSpin = function CapSpin(_ref) {
|
|
12
|
+
var className = _ref.className,
|
|
13
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
14
|
+
return /*#__PURE__*/React.createElement(Spin, _extends({
|
|
15
|
+
className: className
|
|
16
|
+
}, rest));
|
|
17
|
+
};
|
|
18
|
+
CapSpin.propTypes = {
|
|
19
|
+
className: PropTypes.string,
|
|
20
|
+
size: PropTypes.oneOf(['small', 'default', 'large']),
|
|
21
|
+
spinning: PropTypes.bool,
|
|
22
|
+
tip: PropTypes.string,
|
|
23
|
+
delay: PropTypes.number,
|
|
24
|
+
indicator: PropTypes.node,
|
|
25
|
+
fullscreen: PropTypes.bool,
|
|
26
|
+
wrapperClassName: PropTypes.string
|
|
27
|
+
};
|
|
28
|
+
export default CapSpin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './CapSpin';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import CapSkeleton from '../CapSkeleton';
|
|
2
|
+
import { loadable } from '@capillarytech/cap-ui-utils';
|
|
3
|
+
import React, { Suspense } from 'react';
|
|
4
|
+
var LoadableComponent = loadable(function () {
|
|
5
|
+
return import('./CapTable');
|
|
6
|
+
});
|
|
7
|
+
var CapTableLoadable = function CapTableLoadable(props) {
|
|
8
|
+
return /*#__PURE__*/React.createElement(Suspense, {
|
|
9
|
+
fallback: /*#__PURE__*/React.createElement(CapSkeleton, null)
|
|
10
|
+
}, /*#__PURE__*/React.createElement(LoadableComponent, props));
|
|
11
|
+
};
|
|
12
|
+
export default CapTableLoadable;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { Select } from 'antd';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Test component to verify Ant Design v5 Select integration
|
|
7
|
+
* This is a simple wrapper for testing purposes only
|
|
8
|
+
*/
|
|
9
|
+
var CapTestSelect = function CapTestSelect(props) {
|
|
10
|
+
return /*#__PURE__*/React.createElement(Select, props);
|
|
11
|
+
};
|
|
12
|
+
CapTestSelect.propTypes = {
|
|
13
|
+
// Common Select props from antd
|
|
14
|
+
allowClear: PropTypes.bool,
|
|
15
|
+
defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number]))]),
|
|
16
|
+
disabled: PropTypes.bool,
|
|
17
|
+
loading: PropTypes.bool,
|
|
18
|
+
mode: PropTypes.oneOf(['multiple', 'tags']),
|
|
19
|
+
placeholder: PropTypes.string,
|
|
20
|
+
showSearch: PropTypes.bool,
|
|
21
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number]))]),
|
|
22
|
+
options: PropTypes.arrayOf(PropTypes.shape({
|
|
23
|
+
label: PropTypes.node,
|
|
24
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
25
|
+
disabled: PropTypes.bool
|
|
26
|
+
}))
|
|
27
|
+
};
|
|
28
|
+
CapTestSelect.defaultProps = {
|
|
29
|
+
allowClear: false,
|
|
30
|
+
disabled: false,
|
|
31
|
+
loading: false,
|
|
32
|
+
showSearch: false
|
|
33
|
+
};
|
|
34
|
+
export default CapTestSelect;
|