intelicoreact 1.0.71 → 1.0.72
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.
|
@@ -31,6 +31,8 @@ require("./Dropdown.scss");
|
|
|
31
31
|
|
|
32
32
|
var _fieldValueFormatters = require("../../../Functions/fieldValueFormatters");
|
|
33
33
|
|
|
34
|
+
var _utils = require("../../../Functions/utils");
|
|
35
|
+
|
|
34
36
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
35
37
|
|
|
36
38
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -59,6 +61,8 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
59
61
|
_ref$isNotValidateASC = _ref.isNotValidateASCII,
|
|
60
62
|
isNotValidateASCII = _ref$isNotValidateASC === void 0 ? false : _ref$isNotValidateASC,
|
|
61
63
|
testId = _ref.testId,
|
|
64
|
+
_ref$sortAlphabetical = _ref.sortAlphabetical,
|
|
65
|
+
sortAlphabetical = _ref$sortAlphabetical === void 0 ? true : _ref$sortAlphabetical,
|
|
62
66
|
fieldKey = _ref.fieldKey,
|
|
63
67
|
id = _ref.id,
|
|
64
68
|
_ref$noOptionsText = _ref.noOptionsText,
|
|
@@ -308,11 +312,35 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
308
312
|
return /*#__PURE__*/(0, _reactDom.createPortal)(getListMarkUp(), lc);
|
|
309
313
|
};
|
|
310
314
|
|
|
315
|
+
var getSortedOptions = function getSortedOptions(data) {
|
|
316
|
+
var newData = (0, _toConsumableArray2.default)(data);
|
|
317
|
+
|
|
318
|
+
if (sortAlphabetical) {
|
|
319
|
+
var _newData, _newData2;
|
|
320
|
+
|
|
321
|
+
newData = [].concat((0, _toConsumableArray2.default)((_newData = newData) === null || _newData === void 0 ? void 0 : _newData.filter(function (_ref4) {
|
|
322
|
+
var value = _ref4.value;
|
|
323
|
+
return value === 'open_modal';
|
|
324
|
+
})), (0, _toConsumableArray2.default)((_newData2 = newData) === null || _newData2 === void 0 ? void 0 : _newData2.filter(function (_ref5) {
|
|
325
|
+
var value = _ref5.value;
|
|
326
|
+
return value !== 'open_modal';
|
|
327
|
+
}).sort(_utils.compareAlphabetical))).map(function (item) {
|
|
328
|
+
if (item !== null && item !== void 0 && item.items) {
|
|
329
|
+
item.items = (0, _toConsumableArray2.default)(item.items).sort(_utils.compareAlphabetical);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
return item;
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
return newData;
|
|
337
|
+
};
|
|
338
|
+
|
|
311
339
|
var getListMarkUp = function getListMarkUp() {
|
|
312
340
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
313
341
|
className: (0, _classnames.default)("".concat(RC, "__list"), (0, _defineProperty2.default)({}, "".concat(RC, "__list-top"), isListTop)),
|
|
314
342
|
ref: dropdownListRef
|
|
315
|
-
}, depend.options.map(function (filteredOption) {
|
|
343
|
+
}, getSortedOptions(depend.options).map(function (filteredOption) {
|
|
316
344
|
var _filteredOption$items2;
|
|
317
345
|
|
|
318
346
|
return (_filteredOption$items2 = filteredOption.items) !== null && _filteredOption$items2 !== void 0 && _filteredOption$items2.length ? filteredOptionList(filteredOption) : getMarkupForElement(filteredOption);
|
|
@@ -19,6 +19,8 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
19
19
|
|
|
20
20
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
21
21
|
|
|
22
|
+
var _utils = require("../../../Functions/utils");
|
|
23
|
+
|
|
22
24
|
var _CheckboxInput = _interopRequireDefault(require("../CheckboxInput/CheckboxInput"));
|
|
23
25
|
|
|
24
26
|
var _AccordionWithCheckbox = _interopRequireDefault(require("./partial/AccordionWithCheckbox"));
|
|
@@ -111,26 +113,13 @@ var TieredCheckboxes = function TieredCheckboxes(_ref) {
|
|
|
111
113
|
}));
|
|
112
114
|
}
|
|
113
115
|
};
|
|
114
|
-
|
|
115
|
-
var compareAlphabetical = function compareAlphabetical(a, b) {
|
|
116
|
-
if (a.label < b.label) {
|
|
117
|
-
return -1;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
if (a.label > b.label) {
|
|
121
|
-
return 1;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
return 0;
|
|
125
|
-
};
|
|
126
|
-
|
|
127
116
|
var preparedItems = (0, _react.useMemo)(function () {
|
|
128
117
|
var newItems = (0, _toConsumableArray2.default)(items);
|
|
129
118
|
|
|
130
119
|
if (sortGroups) {
|
|
131
120
|
var _newItems;
|
|
132
121
|
|
|
133
|
-
newItems = (_newItems = newItems) === null || _newItems === void 0 ? void 0 : _newItems.sort(compareAlphabetical);
|
|
122
|
+
newItems = (_newItems = newItems) === null || _newItems === void 0 ? void 0 : _newItems.sort(_utils.compareAlphabetical);
|
|
134
123
|
}
|
|
135
124
|
|
|
136
125
|
if (sortGroupItems) {
|
|
@@ -140,7 +129,7 @@ var TieredCheckboxes = function TieredCheckboxes(_ref) {
|
|
|
140
129
|
if (parent !== null && parent !== void 0 && parent.children) {
|
|
141
130
|
var _parent$children;
|
|
142
131
|
|
|
143
|
-
parent.children = parent === null || parent === void 0 ? void 0 : (_parent$children = parent.children) === null || _parent$children === void 0 ? void 0 : _parent$children.sort(compareAlphabetical);
|
|
132
|
+
parent.children = parent === null || parent === void 0 ? void 0 : (_parent$children = parent.children) === null || _parent$children === void 0 ? void 0 : _parent$children.sort(_utils.compareAlphabetical);
|
|
144
133
|
}
|
|
145
134
|
|
|
146
135
|
return parent;
|
package/dist/Functions/utils.js
CHANGED
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
10
|
exports.downloadEmulation = downloadEmulation;
|
|
11
|
-
exports.setCarretToEnd = exports.compare = exports.downloadFile = exports.checkedRef = exports.capitalized = exports.firstLetterCapital = exports.changeMeta = exports.addBitDepthPoints = exports.throttle = exports.debounce = exports.getColorById = exports.getStyles = exports.logout = exports.omitKeys = exports.clone = exports.useOutsideToggle = exports.handleObjectChange = void 0;
|
|
11
|
+
exports.compareAlphabetical = exports.setCarretToEnd = exports.compare = exports.downloadFile = exports.checkedRef = exports.capitalized = exports.firstLetterCapital = exports.changeMeta = exports.addBitDepthPoints = exports.throttle = exports.debounce = exports.getColorById = exports.getStyles = exports.logout = exports.omitKeys = exports.clone = exports.useOutsideToggle = exports.handleObjectChange = void 0;
|
|
12
12
|
|
|
13
13
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
14
14
|
|
|
@@ -312,4 +312,20 @@ var setCarretToEnd = function setCarretToEnd(input) {
|
|
|
312
312
|
}, 10);
|
|
313
313
|
};
|
|
314
314
|
|
|
315
|
-
exports.setCarretToEnd = setCarretToEnd;
|
|
315
|
+
exports.setCarretToEnd = setCarretToEnd;
|
|
316
|
+
|
|
317
|
+
var compareAlphabetical = function compareAlphabetical(a, b) {
|
|
318
|
+
var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'label';
|
|
319
|
+
|
|
320
|
+
if ((a === null || a === void 0 ? void 0 : a[key]) < (b === null || b === void 0 ? void 0 : b[key])) {
|
|
321
|
+
return -1;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
if ((a === null || a === void 0 ? void 0 : a[key]) > (b === null || b === void 0 ? void 0 : b[key])) {
|
|
325
|
+
return 1;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
return 0;
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
exports.compareAlphabetical = compareAlphabetical;
|