@panneau/core 4.0.21 → 4.0.37
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/dist/contexts.d.ts +1 -1
- package/dist/contexts.js +9 -16
- package/dist/hooks.js +9 -5
- package/package.json +4 -4
package/dist/contexts.d.ts
CHANGED
|
@@ -373,7 +373,7 @@ interface ModalContextValue {
|
|
|
373
373
|
container: unknown | null;
|
|
374
374
|
setContainer: (container: unknown) => void;
|
|
375
375
|
register: (id: string, data?: Record<string, unknown> | null) => void;
|
|
376
|
-
unregister: (id?: string | null
|
|
376
|
+
unregister: (id?: string | null) => void;
|
|
377
377
|
closeLastModal: () => void;
|
|
378
378
|
getModalById: (modalId: string) => ModalData | null;
|
|
379
379
|
}
|
package/dist/contexts.js
CHANGED
|
@@ -645,7 +645,6 @@ function ModalProvider(_ref) {
|
|
|
645
645
|
}, [setModals]);
|
|
646
646
|
var unregister = useCallback(function () {
|
|
647
647
|
var id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
648
|
-
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
649
648
|
var _modalsRef$current2 = modalsRef.current,
|
|
650
649
|
currentModals = _modalsRef$current2 === void 0 ? [] : _modalsRef$current2;
|
|
651
650
|
var foundIndex = currentModals.findIndex(function (_ref2) {
|
|
@@ -653,14 +652,8 @@ function ModalProvider(_ref) {
|
|
|
653
652
|
return modalId === id;
|
|
654
653
|
});
|
|
655
654
|
if (foundIndex !== -1) {
|
|
656
|
-
var
|
|
657
|
-
|
|
658
|
-
onClose = _ref3$onClose === void 0 ? null : _ref3$onClose;
|
|
659
|
-
if (onClose !== null) {
|
|
660
|
-
onClose();
|
|
661
|
-
}
|
|
662
|
-
var newModals = currentModals.filter(function (_ref4) {
|
|
663
|
-
var modalId = _ref4.id;
|
|
655
|
+
var newModals = currentModals.filter(function (_ref3) {
|
|
656
|
+
var modalId = _ref3.id;
|
|
664
657
|
return modalId !== id;
|
|
665
658
|
});
|
|
666
659
|
setModals(newModals);
|
|
@@ -670,16 +663,16 @@ function ModalProvider(_ref) {
|
|
|
670
663
|
var closeLastModal = useCallback(function () {
|
|
671
664
|
var lastModal = modals.pop() || null;
|
|
672
665
|
if (lastModal !== null) {
|
|
673
|
-
var
|
|
674
|
-
|
|
675
|
-
lastModalId =
|
|
676
|
-
|
|
677
|
-
onClose =
|
|
666
|
+
var _ref4 = lastModal || {},
|
|
667
|
+
_ref4$id = _ref4.id,
|
|
668
|
+
lastModalId = _ref4$id === void 0 ? null : _ref4$id,
|
|
669
|
+
_ref4$onClose = _ref4.onClose,
|
|
670
|
+
onClose = _ref4$onClose === void 0 ? null : _ref4$onClose;
|
|
678
671
|
if (onClose !== null) {
|
|
679
672
|
onClose();
|
|
680
673
|
}
|
|
681
|
-
var newModals = modals.filter(function (
|
|
682
|
-
var modalId =
|
|
674
|
+
var newModals = modals.filter(function (_ref5) {
|
|
675
|
+
var modalId = _ref5.id;
|
|
683
676
|
return modalId !== lastModalId;
|
|
684
677
|
});
|
|
685
678
|
setModals(newModals);
|
package/dist/hooks.js
CHANGED
|
@@ -1008,17 +1008,21 @@ function useQuery() {
|
|
|
1008
1008
|
setQuery(initialQuery);
|
|
1009
1009
|
}, [initialQuery, setQuery]);
|
|
1010
1010
|
var onPageChange = useCallback(function (newPage) {
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1011
|
+
if (newPage !== null) {
|
|
1012
|
+
setQuery(function (prev) {
|
|
1013
|
+
return _objectSpread(_objectSpread({}, prev || {}), {}, {
|
|
1014
|
+
page: newPage || 1
|
|
1015
|
+
});
|
|
1016
|
+
});
|
|
1017
|
+
}
|
|
1018
|
+
}, [setQuery]);
|
|
1015
1019
|
var onQueryChange = useCallback(function (newQuery) {
|
|
1016
1020
|
var finalQuery = newQuery !== null ? Object.keys(newQuery).reduce(function (currentQuery, key) {
|
|
1017
1021
|
var val = newQuery[key];
|
|
1018
1022
|
return val !== null ? _objectSpread(_objectSpread({}, currentQuery || {}), {}, _defineProperty({}, key, val)) : currentQuery;
|
|
1019
1023
|
}, null) : null;
|
|
1020
1024
|
setQuery(_objectSpread(_objectSpread({}, initialQuery || {}), finalQuery || {}));
|
|
1021
|
-
}, [
|
|
1025
|
+
}, [setQuery, initialQuery]);
|
|
1022
1026
|
var onQueryReset = useCallback(function () {
|
|
1023
1027
|
setQuery(initialQuery);
|
|
1024
1028
|
}, [initialQuery, setQuery]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/core",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.37",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"types": "./dist/index.d.ts",
|
|
31
31
|
"exports": {
|
|
32
32
|
".": {
|
|
33
|
-
"
|
|
34
|
-
"
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"default": "./dist/index.js"
|
|
35
35
|
},
|
|
36
36
|
"./contexts": {
|
|
37
37
|
"default": "./dist/contexts.js",
|
|
@@ -96,5 +96,5 @@
|
|
|
96
96
|
"publishConfig": {
|
|
97
97
|
"access": "public"
|
|
98
98
|
},
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "6184dad4b62fb9587ef48fb3af35f736a4caee73"
|
|
100
100
|
}
|