@panneau/core 3.0.224 → 3.0.228
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/es/contexts.js +25 -17
- package/es/hooks.js +1 -1
- package/package.json +2 -2
package/es/contexts.js
CHANGED
|
@@ -850,9 +850,10 @@ var ModalProvider = function ModalProvider(_ref) {
|
|
|
850
850
|
}, data)]);
|
|
851
851
|
setModals(newModals);
|
|
852
852
|
modalsRef.current = newModals;
|
|
853
|
-
}, [
|
|
853
|
+
}, [setModals]);
|
|
854
854
|
var unregister = useCallback(function () {
|
|
855
855
|
var id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
856
|
+
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
856
857
|
var _modalsRef$current2 = modalsRef.current,
|
|
857
858
|
currentModals = _modalsRef$current2 === void 0 ? [] : _modalsRef$current2;
|
|
858
859
|
var foundIndex = currentModals.findIndex(function (_ref2) {
|
|
@@ -860,36 +861,44 @@ var ModalProvider = function ModalProvider(_ref) {
|
|
|
860
861
|
return modalId === id;
|
|
861
862
|
});
|
|
862
863
|
if (foundIndex !== -1) {
|
|
863
|
-
var
|
|
864
|
-
|
|
864
|
+
var _ref3 = data || {},
|
|
865
|
+
_ref3$onClose = _ref3.onClose,
|
|
866
|
+
onClose = _ref3$onClose === void 0 ? null : _ref3$onClose;
|
|
867
|
+
if (onClose !== null) {
|
|
868
|
+
onClose();
|
|
869
|
+
}
|
|
870
|
+
var newModals = currentModals.filter(function (_ref4) {
|
|
871
|
+
var modalId = _ref4.id;
|
|
865
872
|
return modalId !== id;
|
|
866
873
|
});
|
|
867
874
|
setModals(newModals);
|
|
868
875
|
modalsRef.current = newModals;
|
|
869
876
|
}
|
|
870
|
-
}, [
|
|
877
|
+
}, [setModals]);
|
|
871
878
|
var closeLastModal = useCallback(function () {
|
|
872
879
|
var lastModal = modals.pop() || null;
|
|
873
880
|
if (lastModal !== null) {
|
|
874
|
-
var
|
|
875
|
-
|
|
876
|
-
lastModalId =
|
|
877
|
-
|
|
878
|
-
|
|
881
|
+
var _ref5 = lastModal || {},
|
|
882
|
+
_ref5$id = _ref5.id,
|
|
883
|
+
lastModalId = _ref5$id === void 0 ? null : _ref5$id,
|
|
884
|
+
_ref5$onClose = _ref5.onClose,
|
|
885
|
+
onClose = _ref5$onClose === void 0 ? null : _ref5$onClose;
|
|
886
|
+
if (onClose !== null) {
|
|
887
|
+
onClose();
|
|
888
|
+
}
|
|
889
|
+
var newModals = modals.filter(function (_ref6) {
|
|
890
|
+
var modalId = _ref6.id;
|
|
879
891
|
return modalId !== lastModalId;
|
|
880
892
|
});
|
|
881
893
|
setModals(newModals);
|
|
882
894
|
modalsRef.current = newModals;
|
|
883
895
|
}
|
|
884
896
|
}, [modals, setModals]);
|
|
885
|
-
var
|
|
897
|
+
var getModalById = useCallback(function (modalId) {
|
|
886
898
|
return (modals || []).find(function (modal) {
|
|
887
|
-
return (modal === null || modal === void 0 ? void 0 : modal.id) ===
|
|
899
|
+
return (modal === null || modal === void 0 ? void 0 : modal.id) === modalId;
|
|
888
900
|
}) || null;
|
|
889
901
|
}, [modals]);
|
|
890
|
-
var modalIsOpen = useCallback(function (key) {
|
|
891
|
-
return getModalByKey(key) !== null;
|
|
892
|
-
}, [getModalByKey]);
|
|
893
902
|
var value = useMemo(function () {
|
|
894
903
|
return {
|
|
895
904
|
modals: modals,
|
|
@@ -898,10 +907,9 @@ var ModalProvider = function ModalProvider(_ref) {
|
|
|
898
907
|
register: register,
|
|
899
908
|
unregister: unregister,
|
|
900
909
|
closeLastModal: closeLastModal,
|
|
901
|
-
|
|
902
|
-
modalIsOpen: modalIsOpen
|
|
910
|
+
getModalById: getModalById
|
|
903
911
|
};
|
|
904
|
-
}, [modals, container, setContainer, register, unregister, closeLastModal,
|
|
912
|
+
}, [modals, container, setContainer, register, unregister, closeLastModal, getModalById]);
|
|
905
913
|
return /*#__PURE__*/React.createElement(ModalContext.Provider, {
|
|
906
914
|
value: value
|
|
907
915
|
}, children);
|
package/es/hooks.js
CHANGED
|
@@ -113,7 +113,7 @@ var useActions = function useActions() {
|
|
|
113
113
|
id: 'show',
|
|
114
114
|
component: 'show',
|
|
115
115
|
label: iconsOnly ? null : showLabel,
|
|
116
|
-
icon: iconsOnly ? 'eye
|
|
116
|
+
icon: iconsOnly ? 'eye' : null,
|
|
117
117
|
href: urlGenerator !== null && (!hasCustomShowUrl || withoutItemShowUrl) ? urlGenerator('show', {
|
|
118
118
|
id: id
|
|
119
119
|
}) || null : showUrl || url,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/core",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.228",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -110,5 +110,5 @@
|
|
|
110
110
|
"publishConfig": {
|
|
111
111
|
"access": "public"
|
|
112
112
|
},
|
|
113
|
-
"gitHead": "
|
|
113
|
+
"gitHead": "2adf72884fb88052c6a6822e6f32169bb1dfe18b"
|
|
114
114
|
}
|