@cloudtower/eagle 0.28.0 → 0.29.0
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/cjs/core/KitStoreProvider/index.js +42 -1
- package/dist/cjs/core/ModalStack/index.js +2 -2
- package/dist/cjs/index.js +3 -0
- package/dist/cjs/stats1.html +1 -1
- package/dist/components.css +1688 -1687
- package/dist/esm/core/KitStoreProvider/index.js +42 -4
- package/dist/esm/core/ModalStack/index.js +2 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/stats1.html +1 -1
- package/dist/src/core/KitStoreProvider/index.d.ts +4 -1
- package/dist/src/store/index.d.ts +12 -0
- package/dist/style.css +1301 -1301
- package/package.json +4 -4
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { UIKitStore } from '../../store/index.js';
|
|
2
|
-
import React__default, { createContext } from 'react';
|
|
1
|
+
import { UIKitStore, rootReducer } from '../../store/index.js';
|
|
2
|
+
import React__default, { createContext, useRef, useCallback } from 'react';
|
|
3
3
|
import { Provider, createDispatchHook, createSelectorHook } from 'react-redux';
|
|
4
|
+
import { createStore } from 'redux';
|
|
5
|
+
import { ModalActions } from '../../store/modal.js';
|
|
4
6
|
|
|
5
7
|
const ctx = createContext({
|
|
6
8
|
store: UIKitStore,
|
|
@@ -8,10 +10,46 @@ const ctx = createContext({
|
|
|
8
10
|
});
|
|
9
11
|
const KitStoreProvider = (props) => {
|
|
10
12
|
const { children } = props;
|
|
11
|
-
|
|
13
|
+
const storeRef = useRef(createStore(rootReducer));
|
|
14
|
+
return /* @__PURE__ */ React__default.createElement(Provider, { context: ctx, store: storeRef.current }, children);
|
|
12
15
|
};
|
|
13
16
|
var KitStoreProvider$1 = KitStoreProvider;
|
|
14
17
|
const useKitDispatch = createDispatchHook(ctx);
|
|
15
18
|
const useKitSelector = createSelectorHook(ctx);
|
|
19
|
+
const usePushModal = () => {
|
|
20
|
+
const dispatch = useKitDispatch();
|
|
21
|
+
const pushModal = useCallback(
|
|
22
|
+
(modal) => {
|
|
23
|
+
dispatch({
|
|
24
|
+
type: ModalActions.PUSH_MODAL,
|
|
25
|
+
payload: modal
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
[dispatch]
|
|
29
|
+
);
|
|
30
|
+
return pushModal;
|
|
31
|
+
};
|
|
32
|
+
const useCloseModal = () => {
|
|
33
|
+
const dispatch = useKitDispatch();
|
|
34
|
+
const closeModal = useCallback(
|
|
35
|
+
(id) => {
|
|
36
|
+
dispatch({
|
|
37
|
+
type: ModalActions.CLOSE_MODAL,
|
|
38
|
+
id
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
[dispatch]
|
|
42
|
+
);
|
|
43
|
+
return closeModal;
|
|
44
|
+
};
|
|
45
|
+
const usePopModal = () => {
|
|
46
|
+
const dispatch = useKitDispatch();
|
|
47
|
+
const popModal = useCallback(() => {
|
|
48
|
+
dispatch({
|
|
49
|
+
type: ModalActions.POP_MODAL
|
|
50
|
+
});
|
|
51
|
+
}, [dispatch]);
|
|
52
|
+
return popModal;
|
|
53
|
+
};
|
|
16
54
|
|
|
17
|
-
export { KitStoreProvider$1 as default, useKitDispatch, useKitSelector };
|
|
55
|
+
export { KitStoreProvider$1 as default, useCloseModal, useKitDispatch, useKitSelector, usePopModal, usePushModal };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { useKitSelector } from '../KitStoreProvider/index.js';
|
|
2
|
-
import { closeModal } from '../../store/index.js';
|
|
1
|
+
import { useKitSelector, useCloseModal } from '../KitStoreProvider/index.js';
|
|
3
2
|
import React__default from 'react';
|
|
4
3
|
|
|
5
4
|
var __defProp = Object.defineProperty;
|
|
@@ -25,6 +24,7 @@ const ModalStack = () => {
|
|
|
25
24
|
const stack = useKitSelector(
|
|
26
25
|
(state) => state.modal.stack
|
|
27
26
|
);
|
|
27
|
+
const closeModal = useCloseModal();
|
|
28
28
|
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, stack.map((modal) => /* @__PURE__ */ React__default.createElement(
|
|
29
29
|
modal.component,
|
|
30
30
|
__spreadProps(__spreadValues({}, modal.props), {
|
package/dist/esm/index.js
CHANGED
|
@@ -41,7 +41,7 @@ export { AntdIntStyled, default as InputInteger } from './core/InputInteger/inde
|
|
|
41
41
|
export { AntdInputNumberStyled, default as InputNumber } from './core/InputNumber/index.js';
|
|
42
42
|
export { AntdPasswordInputStyled, default as InputPassword } from './core/InputPassword/index.js';
|
|
43
43
|
export { default as InputTagItem } from './core/InputTagItem/index.js';
|
|
44
|
-
export { default as KitStoreProvider, useKitDispatch, useKitSelector } from './core/KitStoreProvider/index.js';
|
|
44
|
+
export { default as KitStoreProvider, useCloseModal, useKitDispatch, useKitSelector, usePopModal, usePushModal } from './core/KitStoreProvider/index.js';
|
|
45
45
|
export { default as Link } from './core/Link/index.js';
|
|
46
46
|
export { default as Loading } from './core/Loading/index.js';
|
|
47
47
|
export { attachTypeApi, getKeyThenIncreaseKey, default as message } from './core/message/index.js';
|