@crystaldesign/diva-navigator 24.11.0-beta.9 → 24.11.0-rc.1
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/esm/index.js
CHANGED
|
@@ -328,7 +328,7 @@ function TextElement(_ref) {
|
|
|
328
328
|
,
|
|
329
329
|
children: displayName
|
|
330
330
|
})
|
|
331
|
-
})), isOver && (hoverStatus || isShortend) && renderLayer(
|
|
331
|
+
})), isOver && (hoverStatus || isShortend) && renderLayer(/*#__PURE__*/jsxs("div", _objectSpread$2(_objectSpread$2({
|
|
332
332
|
className: tooltip
|
|
333
333
|
}, layerProps), {}, {
|
|
334
334
|
style: _objectSpread$2(_objectSpread$2({}, {
|
|
@@ -461,7 +461,7 @@ function OrganizationSelection (_ref) {
|
|
|
461
461
|
searchData = _useState14[0],
|
|
462
462
|
setSearchData = _useState14[1];
|
|
463
463
|
var onSearch = /*#__PURE__*/function () {
|
|
464
|
-
var _ref2 = _asyncToGenerator(
|
|
464
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(query) {
|
|
465
465
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
466
466
|
while (1) switch (_context.prev = _context.next) {
|
|
467
467
|
case 0:
|
|
@@ -484,8 +484,8 @@ function OrganizationSelection (_ref) {
|
|
|
484
484
|
var multiplier = ((_scroller$current2 = scroller.current) === null || _scroller$current2 === void 0 ? void 0 : _scroller$current2.clientHeight) / 300;
|
|
485
485
|
return Math.ceil(20 * multiplier);
|
|
486
486
|
}, [scroller.current, (_scroller$current3 = scroller.current) === null || _scroller$current3 === void 0 ? void 0 : _scroller$current3.clientHeight]);
|
|
487
|
-
var debouncedSearch = useCallback(debounce(
|
|
488
|
-
var _ref3 = _asyncToGenerator(
|
|
487
|
+
var debouncedSearch = useCallback(debounce(/*#__PURE__*/function () {
|
|
488
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(query) {
|
|
489
489
|
var _root$_id;
|
|
490
490
|
var data, result, _iterator, _step, _loop;
|
|
491
491
|
return _regeneratorRuntime.wrap(function _callee2$(_context3) {
|
|
@@ -592,8 +592,8 @@ function OrganizationSelection (_ref) {
|
|
|
592
592
|
return _ref3.apply(this, arguments);
|
|
593
593
|
};
|
|
594
594
|
}(), 300), [selectedHierarchies, selectedOrganizations]);
|
|
595
|
-
var debouncedScroll = useCallback(debounce(
|
|
596
|
-
var _ref5 = _asyncToGenerator(
|
|
595
|
+
var debouncedScroll = useCallback(debounce(/*#__PURE__*/function () {
|
|
596
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(e) {
|
|
597
597
|
return _regeneratorRuntime.wrap(function _callee3$(_context4) {
|
|
598
598
|
while (1) switch (_context4.prev = _context4.next) {
|
|
599
599
|
case 0:
|
|
@@ -654,8 +654,8 @@ function OrganizationSelection (_ref) {
|
|
|
654
654
|
top: 0
|
|
655
655
|
});
|
|
656
656
|
}, [onChange, selectedHierarchies]);
|
|
657
|
-
var onOpen = useCallback(
|
|
658
|
-
var _ref6 = _asyncToGenerator(
|
|
657
|
+
var onOpen = useCallback(/*#__PURE__*/function () {
|
|
658
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(id) {
|
|
659
659
|
var flat, elem, _parent$children, _parent$children$leng, _parent$children2, _parent$children3, parent, result, _elem$children, _elem$children2, _result;
|
|
660
660
|
return _regeneratorRuntime.wrap(function _callee4$(_context5) {
|
|
661
661
|
while (1) switch (_context5.prev = _context5.next) {
|
|
@@ -754,248 +754,262 @@ function OrganizationSelection (_ref) {
|
|
|
754
754
|
var elementLimit = getElementLimit();
|
|
755
755
|
useEffect(function () {
|
|
756
756
|
if (!elementLimit) return;
|
|
757
|
-
|
|
758
|
-
var
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
757
|
+
var fn = /*#__PURE__*/function () {
|
|
758
|
+
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
759
|
+
var total, flatTotal, totalList, _iterator2, _step2, _loop2, result, _root$_id2, _result2, rootData;
|
|
760
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context8) {
|
|
761
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
762
|
+
case 0:
|
|
763
|
+
total = 0;
|
|
764
|
+
flatTotal = 0;
|
|
765
|
+
totalList = []; //first add all selected organizations
|
|
766
|
+
_iterator2 = _createForOfIteratorHelper(selectedHierarchies);
|
|
767
|
+
_context8.prev = 4;
|
|
768
|
+
_loop2 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop2() {
|
|
769
|
+
var _parentsOfSelected$_i, _parentsOfSelected;
|
|
770
|
+
var hierarchy, selectedChild, existing, rootIndex, parentsOfSelected, orgData, isNew, _iterator3, _step3, _loop3;
|
|
771
|
+
return _regeneratorRuntime.wrap(function _loop2$(_context7) {
|
|
772
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
773
|
+
case 0:
|
|
774
|
+
hierarchy = _step2.value;
|
|
775
|
+
selectedChild = hierarchy[hierarchy.length - 1]; //if the selected organization is already loaded as a parent or child of another selected organization
|
|
776
|
+
//we simple set it as selected and are done
|
|
777
|
+
existing = getExisting(totalList, selectedChild._id);
|
|
778
|
+
if (!existing) {
|
|
779
|
+
_context7.next = 6;
|
|
780
|
+
break;
|
|
781
|
+
}
|
|
782
|
+
existing.isSelected = true;
|
|
783
|
+
return _context7.abrupt("return", 1);
|
|
784
|
+
case 6:
|
|
785
|
+
rootIndex = 0;
|
|
786
|
+
if (root) {
|
|
787
|
+
rootIndex = hierarchy.findIndex(function (d) {
|
|
788
|
+
return d._id == root._id;
|
|
789
|
+
});
|
|
790
|
+
}
|
|
791
|
+
parentsOfSelected = hierarchy.slice(rootIndex, -1);
|
|
792
|
+
parentsOfSelected.reverse(); //iterate list from the back
|
|
793
|
+
orgData = _objectSpread$1(_objectSpread$1({}, selectedChild), {}, {
|
|
794
|
+
parent: (_parentsOfSelected$_i = (_parentsOfSelected = parentsOfSelected[parentsOfSelected.length - 1]) === null || _parentsOfSelected === void 0 ? void 0 : _parentsOfSelected._id) !== null && _parentsOfSelected$_i !== void 0 ? _parentsOfSelected$_i : 'ROOT',
|
|
795
|
+
isSelected: true,
|
|
796
|
+
hasChildren: selectedChild.hasChildren,
|
|
797
|
+
parentOrganizations: parentsOfSelected
|
|
788
798
|
});
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
799
|
+
isNew = true;
|
|
800
|
+
_iterator3 = _createForOfIteratorHelper(parentsOfSelected);
|
|
801
|
+
_context7.prev = 13;
|
|
802
|
+
_loop3 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop3() {
|
|
803
|
+
var organization, existing, indexOfCurrent, limit, _result3, _iterator4, _step4, _indexOfCurrent;
|
|
804
|
+
return _regeneratorRuntime.wrap(function _loop3$(_context6) {
|
|
805
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
806
|
+
case 0:
|
|
807
|
+
organization = _step3.value;
|
|
808
|
+
//set the parent field of the previouse organization
|
|
809
|
+
orgData.parent = organization._id;
|
|
810
|
+
existing = getExisting(totalList, organization._id); //if the parent was already loaded, use that instance and add the previouse organization as first child
|
|
811
|
+
if (existing) {
|
|
812
|
+
if (!existing.children) existing.children = [];
|
|
813
|
+
//incase the previouse organization was already in the list as child, remove it. Otherwise the entry is double
|
|
814
|
+
indexOfCurrent = existing.children.findIndex(function (v) {
|
|
815
|
+
return v._id == orgData._id;
|
|
816
|
+
});
|
|
817
|
+
if (indexOfCurrent >= 0) {
|
|
818
|
+
existing.children.splice(indexOfCurrent, 1);
|
|
819
|
+
total -= 1;
|
|
820
|
+
}
|
|
821
|
+
existing.children.unshift(orgData); //set the previouse organization as first child
|
|
822
|
+
total += 1;
|
|
823
|
+
isNew = false;
|
|
824
|
+
orgData = existing;
|
|
825
|
+
} else {
|
|
826
|
+
//if the parent was not loaded yet, create a new instance, and add the previouse organization as first child
|
|
827
|
+
orgData = _objectSpread$1(_objectSpread$1({}, organization), {}, {
|
|
828
|
+
parent: '',
|
|
829
|
+
//parent ID is set below on next iteration
|
|
830
|
+
hasChildren: true,
|
|
831
|
+
children: [orgData] //set the previouse organization as first child
|
|
832
|
+
});
|
|
833
|
+
total += 1;
|
|
819
834
|
}
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
//if the parent was not loaded yet, create a new instance, and add the previouse organization as first child
|
|
826
|
-
orgData = _objectSpread$1(_objectSpread$1({}, organization), {}, {
|
|
827
|
-
parent: '',
|
|
828
|
-
//parent ID is set below on next iteration
|
|
829
|
-
hasChildren: true,
|
|
830
|
-
children: [orgData] //set the previouse organization as first child
|
|
831
|
-
});
|
|
832
|
-
total += 1;
|
|
833
|
-
}
|
|
834
|
-
|
|
835
|
-
//if the organization was already open, the children are also alreaddy loaded and we are done, otherwise we have to load the children
|
|
836
|
-
if (orgData.open) {
|
|
837
|
-
_context6.next = 17;
|
|
838
|
-
break;
|
|
839
|
-
}
|
|
840
|
-
//load at least one element, so we know the total count of children of the organization
|
|
841
|
-
limit = elementLimit - total;
|
|
842
|
-
limit = limit > 0 ? limit : 1;
|
|
843
|
-
_context6.next = 9;
|
|
844
|
-
return organizationHandler.getOrganizationsChildren(organization._id, 0, limit);
|
|
845
|
-
case 9:
|
|
846
|
-
_result3 = _context6.sent;
|
|
847
|
-
total += _result3.total;
|
|
848
|
-
flatTotal = _result3.flatTotal;
|
|
849
|
-
|
|
850
|
-
//incase the a loaded child was already in the list as child, remove it. Otherwise the entry is double
|
|
851
|
-
_iterator4 = _createForOfIteratorHelper(findAllIndexes(_result3.data, hierarchy));
|
|
852
|
-
try {
|
|
853
|
-
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
854
|
-
_indexOfCurrent = _step4.value;
|
|
855
|
-
_result3.data.splice(_indexOfCurrent, 1);
|
|
856
|
-
total -= 1;
|
|
835
|
+
|
|
836
|
+
//if the organization was already open, the children are also alreaddy loaded and we are done, otherwise we have to load the children
|
|
837
|
+
if (orgData.open) {
|
|
838
|
+
_context6.next = 17;
|
|
839
|
+
break;
|
|
857
840
|
}
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
841
|
+
//load at least one element, so we know the total count of children of the organization
|
|
842
|
+
limit = elementLimit - total;
|
|
843
|
+
limit = limit > 0 ? limit : 1;
|
|
844
|
+
_context6.next = 9;
|
|
845
|
+
return organizationHandler.getOrganizationsChildren(organization._id, 0, limit);
|
|
846
|
+
case 9:
|
|
847
|
+
_result3 = _context6.sent;
|
|
848
|
+
total += _result3.total;
|
|
849
|
+
flatTotal = _result3.flatTotal;
|
|
850
|
+
|
|
851
|
+
//incase the a loaded child was already in the list as child, remove it. Otherwise the entry is double
|
|
852
|
+
_iterator4 = _createForOfIteratorHelper(findAllIndexes(_result3.data, hierarchy));
|
|
853
|
+
try {
|
|
854
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
855
|
+
_indexOfCurrent = _step4.value;
|
|
856
|
+
_result3.data.splice(_indexOfCurrent, 1);
|
|
857
|
+
total -= 1;
|
|
858
|
+
}
|
|
859
|
+
} catch (err) {
|
|
860
|
+
_iterator4.e(err);
|
|
861
|
+
} finally {
|
|
862
|
+
_iterator4.f();
|
|
863
|
+
}
|
|
864
|
+
orgData.open = true;
|
|
865
|
+
orgData.total = _result3.total;
|
|
866
|
+
orgData.children = [].concat(_toConsumableArray(orgData.children), _toConsumableArray(_result3.data.map(function (d) {
|
|
867
|
+
return _objectSpread$1(_objectSpread$1({}, d), {}, {
|
|
868
|
+
parent: organization._id
|
|
869
|
+
});
|
|
870
|
+
})));
|
|
871
|
+
case 17:
|
|
872
|
+
if (isNew) {
|
|
873
|
+
_context6.next = 19;
|
|
874
|
+
break;
|
|
875
|
+
}
|
|
876
|
+
return _context6.abrupt("return", 1);
|
|
877
|
+
case 19:
|
|
878
|
+
case "end":
|
|
879
|
+
return _context6.stop();
|
|
880
|
+
}
|
|
881
|
+
}, _loop3);
|
|
882
|
+
});
|
|
883
|
+
_iterator3.s();
|
|
884
|
+
case 16:
|
|
885
|
+
if ((_step3 = _iterator3.n()).done) {
|
|
886
|
+
_context7.next = 22;
|
|
887
|
+
break;
|
|
888
|
+
}
|
|
889
|
+
return _context7.delegateYield(_loop3(), "t0", 18);
|
|
890
|
+
case 18:
|
|
891
|
+
if (!_context7.t0) {
|
|
892
|
+
_context7.next = 20;
|
|
893
|
+
break;
|
|
894
|
+
}
|
|
895
|
+
return _context7.abrupt("break", 22);
|
|
896
|
+
case 20:
|
|
897
|
+
_context7.next = 16;
|
|
886
898
|
break;
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
case 18:
|
|
890
|
-
if (!_context7.t0) {
|
|
891
|
-
_context7.next = 20;
|
|
899
|
+
case 22:
|
|
900
|
+
_context7.next = 27;
|
|
892
901
|
break;
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
902
|
+
case 24:
|
|
903
|
+
_context7.prev = 24;
|
|
904
|
+
_context7.t1 = _context7["catch"](13);
|
|
905
|
+
_iterator3.e(_context7.t1);
|
|
906
|
+
case 27:
|
|
907
|
+
_context7.prev = 27;
|
|
908
|
+
_iterator3.f();
|
|
909
|
+
return _context7.finish(27);
|
|
910
|
+
case 30:
|
|
911
|
+
if (isNew) totalList.push(orgData); //add the orgData is not new, it is already in the list
|
|
912
|
+
case 31:
|
|
913
|
+
case "end":
|
|
914
|
+
return _context7.stop();
|
|
915
|
+
}
|
|
916
|
+
}, _loop2, null, [[13, 24, 27, 30]]);
|
|
917
|
+
});
|
|
918
|
+
_iterator2.s();
|
|
919
|
+
case 7:
|
|
920
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
921
|
+
_context8.next = 13;
|
|
922
|
+
break;
|
|
923
|
+
}
|
|
924
|
+
return _context8.delegateYield(_loop2(), "t0", 9);
|
|
925
|
+
case 9:
|
|
926
|
+
if (!_context8.t0) {
|
|
927
|
+
_context8.next = 11;
|
|
928
|
+
break;
|
|
929
|
+
}
|
|
930
|
+
return _context8.abrupt("continue", 11);
|
|
931
|
+
case 11:
|
|
932
|
+
_context8.next = 7;
|
|
921
933
|
break;
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
case 9:
|
|
925
|
-
if (!_context8.t0) {
|
|
926
|
-
_context8.next = 11;
|
|
934
|
+
case 13:
|
|
935
|
+
_context8.next = 18;
|
|
927
936
|
break;
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
937
|
+
case 15:
|
|
938
|
+
_context8.prev = 15;
|
|
939
|
+
_context8.t1 = _context8["catch"](4);
|
|
940
|
+
_iterator2.e(_context8.t1);
|
|
941
|
+
case 18:
|
|
942
|
+
_context8.prev = 18;
|
|
943
|
+
_iterator2.f();
|
|
944
|
+
return _context8.finish(18);
|
|
945
|
+
case 21:
|
|
946
|
+
if (!(totalList.length == 0 && root)) {
|
|
947
|
+
_context8.next = 30;
|
|
948
|
+
break;
|
|
949
|
+
}
|
|
950
|
+
_context8.next = 24;
|
|
951
|
+
return organizationHandler.getOrganizationsChildren(root._id, 0, elementLimit - total);
|
|
952
|
+
case 24:
|
|
953
|
+
result = _context8.sent;
|
|
954
|
+
totalList.push(_objectSpread$1(_objectSpread$1({}, root), {}, {
|
|
955
|
+
children: _toConsumableArray(result.data.map(function (d) {
|
|
956
|
+
return _objectSpread$1(_objectSpread$1({}, d), {}, {
|
|
957
|
+
parent: root._id
|
|
958
|
+
});
|
|
959
|
+
})),
|
|
960
|
+
total: result.total
|
|
961
|
+
}));
|
|
962
|
+
total += result.total - result.data.length;
|
|
963
|
+
flatTotal = result.flatTotal;
|
|
964
|
+
_context8.next = 39;
|
|
947
965
|
break;
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
966
|
+
case 30:
|
|
967
|
+
if (totalList.find(function (org) {
|
|
968
|
+
return org._id == (root === null || root === void 0 ? void 0 : root._id);
|
|
969
|
+
})) {
|
|
970
|
+
_context8.next = 39;
|
|
971
|
+
break;
|
|
972
|
+
}
|
|
973
|
+
_context8.next = 33;
|
|
974
|
+
return organizationHandler.getOrganizationsChildren((_root$_id2 = root === null || root === void 0 ? void 0 : root._id) !== null && _root$_id2 !== void 0 ? _root$_id2 : 'ROOT', 0, Math.max(elementLimit - total, 1));
|
|
975
|
+
case 33:
|
|
976
|
+
_result2 = _context8.sent;
|
|
977
|
+
rootData = _result2;
|
|
978
|
+
rootData.data = _result2.data.filter(function (d) {
|
|
979
|
+
return !totalList.find(function (org) {
|
|
980
|
+
return org._id == d._id;
|
|
957
981
|
});
|
|
958
|
-
})),
|
|
959
|
-
total: _result2.total
|
|
960
|
-
}));
|
|
961
|
-
case 26:
|
|
962
|
-
_context8.next = 28;
|
|
963
|
-
return organizationHandler.getOrganizationsChildren('ROOT', 0, Math.max(elementLimit - total, 1));
|
|
964
|
-
case 28:
|
|
965
|
-
result = _context8.sent;
|
|
966
|
-
rootData = result;
|
|
967
|
-
rootData.data = result.data.filter(function (d) {
|
|
968
|
-
return !totalList.find(function (org) {
|
|
969
|
-
return org._id == d._id;
|
|
970
982
|
});
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
983
|
+
totalList.push.apply(totalList, _toConsumableArray(rootData.data));
|
|
984
|
+
total += _result2.total - (_result2.data.length - rootData.data.length);
|
|
985
|
+
flatTotal = _result2.flatTotal;
|
|
986
|
+
case 39:
|
|
987
|
+
setData([{
|
|
988
|
+
_id: 'ROOT',
|
|
989
|
+
displayName: '',
|
|
990
|
+
children: _toConsumableArray(totalList.map(function (d) {
|
|
991
|
+
return _objectSpread$1(_objectSpread$1({}, d), {}, {
|
|
992
|
+
parent: 'ROOT'
|
|
993
|
+
});
|
|
994
|
+
})),
|
|
995
|
+
total: total
|
|
996
|
+
}]);
|
|
997
|
+
flatTotal = flatTotal > total ? flatTotal : total;
|
|
998
|
+
setTotal(flatTotal);
|
|
999
|
+
if (flatTotal > 5) setShowSearch(true);
|
|
1000
|
+
setOrgsCount === null || setOrgsCount === void 0 || setOrgsCount(flatTotal);
|
|
1001
|
+
setLoading(false);
|
|
1002
|
+
case 45:
|
|
1003
|
+
case "end":
|
|
1004
|
+
return _context8.stop();
|
|
1005
|
+
}
|
|
1006
|
+
}, _callee5, null, [[4, 15, 18, 21]]);
|
|
1007
|
+
}));
|
|
1008
|
+
return function fn() {
|
|
1009
|
+
return _ref7.apply(this, arguments);
|
|
1010
|
+
};
|
|
1011
|
+
}();
|
|
1012
|
+
fn();
|
|
999
1013
|
}, [selectedHierarchies]);
|
|
1000
1014
|
useEffect(function () {
|
|
1001
1015
|
if (scroll) {
|
|
@@ -1003,7 +1017,7 @@ function OrganizationSelection (_ref) {
|
|
|
1003
1017
|
var flat = flatElements(searchData !== null && searchData !== void 0 && searchData.length ? searchData : data);
|
|
1004
1018
|
//check if scrolled to bottom, with a tolerance of 1px.
|
|
1005
1019
|
if (Math.abs(scroll.scrollHeight - scroll.scrollTop - scroll.clientHeight) <= 1.0 && total > flat.length) {
|
|
1006
|
-
_asyncToGenerator(
|
|
1020
|
+
_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
1007
1021
|
var lastParent, correctSkip, _iterator5, _step5, hierarchy, _iterator7, _step7, indexOfCurrent, result, _iterator6, _step6, _hierarchy, _iterator8, _step8, _indexOfCurrent2, _ref9, _ref10;
|
|
1008
1022
|
return _regeneratorRuntime.wrap(function _callee6$(_context9) {
|
|
1009
1023
|
while (1) switch (_context9.prev = _context9.next) {
|
|
@@ -1935,7 +1949,7 @@ function matchProduct(_x, _x2, _x3) {
|
|
|
1935
1949
|
return _matchProduct.apply(this, arguments);
|
|
1936
1950
|
}
|
|
1937
1951
|
function _matchProduct() {
|
|
1938
|
-
_matchProduct = _asyncToGenerator(
|
|
1952
|
+
_matchProduct = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(url, shopBaseUrl, apiGetProductByFilter) {
|
|
1939
1953
|
var _product$data$;
|
|
1940
1954
|
var variableRegex, variableNames, match, regex, matches, filter, values, variables, parts, lastPart, divaParts, product, id;
|
|
1941
1955
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
@@ -2060,7 +2074,7 @@ function Scanner() {
|
|
|
2060
2074
|
error = _React$useState2[0],
|
|
2061
2075
|
setError = _React$useState2[1];
|
|
2062
2076
|
var onScanned = /*#__PURE__*/function () {
|
|
2063
|
-
var _ref = _asyncToGenerator(
|
|
2077
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(text) {
|
|
2064
2078
|
var divaNr, productId;
|
|
2065
2079
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
2066
2080
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -2121,8 +2135,8 @@ function Scanner() {
|
|
|
2121
2135
|
return _ref.apply(this, arguments);
|
|
2122
2136
|
};
|
|
2123
2137
|
}();
|
|
2124
|
-
var mountedQrCodeScanner = useCallback(
|
|
2125
|
-
var _ref2 = _asyncToGenerator(
|
|
2138
|
+
var mountedQrCodeScanner = useCallback(/*#__PURE__*/function () {
|
|
2139
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(node) {
|
|
2126
2140
|
var _qrCodeReader$current, _qrCodeReader$current2;
|
|
2127
2141
|
var _qrCodeReader$current3;
|
|
2128
2142
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
@@ -2148,7 +2162,7 @@ function Scanner() {
|
|
|
2148
2162
|
height: 250
|
|
2149
2163
|
}
|
|
2150
2164
|
}, /*#__PURE__*/function () {
|
|
2151
|
-
var _ref3 = _asyncToGenerator(
|
|
2165
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(decodedText, decodedResult) {
|
|
2152
2166
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
2153
2167
|
while (1) switch (_context2.prev = _context2.next) {
|
|
2154
2168
|
case 0:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/OrganizationSelection/index.tsx"],"names":[],"mappings":"AAWA,UAAU,KAAK;IACb,QAAQ,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,IAAI,CAAC;IACzC,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAED,UAAU,SAAS;IACjB,QAAQ,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,EAAE,KAAK,IAAI,CAAC;IAC3C,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,OAAO,CAAC,EAAE,QAAQ,EAAE,EAAE,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,IAAI,CAAC;IACZ,IAAI,CAAC,EAAE,QAAQ,CAAC;CACjB;AAED,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,OAAO;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACrB,mBAAmB,CAAC,EAAE,OAAO,EAAE,CAAC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,CAAC,OAAO,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,KAAK,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/OrganizationSelection/index.tsx"],"names":[],"mappings":"AAWA,UAAU,KAAK;IACb,QAAQ,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,IAAI,CAAC;IACzC,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAED,UAAU,SAAS;IACjB,QAAQ,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,EAAE,KAAK,IAAI,CAAC;IAC3C,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,OAAO,CAAC,EAAE,QAAQ,EAAE,EAAE,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,IAAI,CAAC;IACZ,IAAI,CAAC,EAAE,QAAQ,CAAC;CACjB;AAED,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,OAAO;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC;IACrB,mBAAmB,CAAC,EAAE,OAAO,EAAE,CAAC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,CAAC,OAAO,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,KAAK,GAAG,SAAS,eA2WtG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crystaldesign/diva-navigator",
|
|
3
|
-
"version": "24.11.0-
|
|
3
|
+
"version": "24.11.0-rc.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@testing-library/jest-dom": "^5.15.0",
|
|
@@ -23,5 +23,5 @@
|
|
|
23
23
|
},
|
|
24
24
|
"module": "build/esm/index.js",
|
|
25
25
|
"types": "./build/types/navigator/src/index.d.ts",
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "8f594f0b9af1cf9c9211f0eb282042a3914d8c7d"
|
|
27
27
|
}
|