@cloudtower/eagle 0.29.4-dry → 0.29.5
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/core/SimplePagination/index.js +0 -3
- package/dist/cjs/core/Table/index.js +21 -5
- package/dist/cjs/index.js +3 -0
- package/dist/cjs/stats1.html +1 -1
- package/dist/components.css +2624 -2624
- package/dist/esm/core/KitStoreProvider/index.js +42 -4
- package/dist/esm/core/ModalStack/index.js +2 -2
- package/dist/esm/core/SimplePagination/index.js +0 -3
- package/dist/esm/core/Table/index.js +21 -5
- 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/core/SimplePagination/index.d.ts +1 -1
- package/dist/src/store/index.d.ts +12 -0
- package/dist/stories/docs/core/KitStoreProvider.stories.d.ts +23 -0
- package/dist/stories/docs/core/Table.stories.d.ts +47 -16
- package/dist/style.css +2464 -2464
- package/package.json +4 -4
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var index = require('../../store/index.js');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var reactRedux = require('react-redux');
|
|
8
|
+
var redux = require('redux');
|
|
9
|
+
var modal = require('../../store/modal.js');
|
|
8
10
|
|
|
9
11
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
12
|
|
|
@@ -16,12 +18,51 @@ const ctx = React.createContext({
|
|
|
16
18
|
});
|
|
17
19
|
const KitStoreProvider = (props) => {
|
|
18
20
|
const { children } = props;
|
|
19
|
-
|
|
21
|
+
const storeRef = React.useRef(redux.createStore(index.rootReducer));
|
|
22
|
+
return /* @__PURE__ */ React__default.default.createElement(reactRedux.Provider, { context: ctx, store: storeRef.current }, children);
|
|
20
23
|
};
|
|
21
24
|
var KitStoreProvider$1 = KitStoreProvider;
|
|
22
25
|
const useKitDispatch = reactRedux.createDispatchHook(ctx);
|
|
23
26
|
const useKitSelector = reactRedux.createSelectorHook(ctx);
|
|
27
|
+
const usePushModal = () => {
|
|
28
|
+
const dispatch = useKitDispatch();
|
|
29
|
+
const pushModal = React.useCallback(
|
|
30
|
+
(modal$1) => {
|
|
31
|
+
dispatch({
|
|
32
|
+
type: modal.ModalActions.PUSH_MODAL,
|
|
33
|
+
payload: modal$1
|
|
34
|
+
});
|
|
35
|
+
},
|
|
36
|
+
[dispatch]
|
|
37
|
+
);
|
|
38
|
+
return pushModal;
|
|
39
|
+
};
|
|
40
|
+
const useCloseModal = () => {
|
|
41
|
+
const dispatch = useKitDispatch();
|
|
42
|
+
const closeModal = React.useCallback(
|
|
43
|
+
(id) => {
|
|
44
|
+
dispatch({
|
|
45
|
+
type: modal.ModalActions.CLOSE_MODAL,
|
|
46
|
+
id
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
[dispatch]
|
|
50
|
+
);
|
|
51
|
+
return closeModal;
|
|
52
|
+
};
|
|
53
|
+
const usePopModal = () => {
|
|
54
|
+
const dispatch = useKitDispatch();
|
|
55
|
+
const popModal = React.useCallback(() => {
|
|
56
|
+
dispatch({
|
|
57
|
+
type: modal.ModalActions.POP_MODAL
|
|
58
|
+
});
|
|
59
|
+
}, [dispatch]);
|
|
60
|
+
return popModal;
|
|
61
|
+
};
|
|
24
62
|
|
|
25
63
|
exports.default = KitStoreProvider$1;
|
|
64
|
+
exports.useCloseModal = useCloseModal;
|
|
26
65
|
exports.useKitDispatch = useKitDispatch;
|
|
27
66
|
exports.useKitSelector = useKitSelector;
|
|
67
|
+
exports.usePopModal = usePopModal;
|
|
68
|
+
exports.usePushModal = usePushModal;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('../KitStoreProvider/index.js');
|
|
4
|
-
var index$1 = require('../../store/index.js');
|
|
5
4
|
var React = require('react');
|
|
6
5
|
|
|
7
6
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -31,6 +30,7 @@ const ModalStack = () => {
|
|
|
31
30
|
const stack = index.useKitSelector(
|
|
32
31
|
(state) => state.modal.stack
|
|
33
32
|
);
|
|
33
|
+
const closeModal = index.useCloseModal();
|
|
34
34
|
return /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, stack.map((modal) => /* @__PURE__ */ React__default.default.createElement(
|
|
35
35
|
modal.component,
|
|
36
36
|
__spreadProps(__spreadValues({}, modal.props), {
|
|
@@ -40,7 +40,7 @@ const ModalStack = () => {
|
|
|
40
40
|
if ((_a = modal.props) == null ? void 0 : _a.onClose) {
|
|
41
41
|
modal.props.onClose();
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
closeModal(modal.id);
|
|
44
44
|
},
|
|
45
45
|
key: modal.id
|
|
46
46
|
})
|
|
@@ -38,9 +38,6 @@ const SimplePagination = props => {
|
|
|
38
38
|
onPageChange == null ? void 0 : onPageChange(1);
|
|
39
39
|
}
|
|
40
40
|
}, [onPageChange, pageLength]);
|
|
41
|
-
if (count === 0) {
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
41
|
return /* @__PURE__ */React__default.default.createElement("div", {
|
|
45
42
|
className: cs__default.default(index.PaginationStyle, "pagination-wrapper", className)
|
|
46
43
|
}, /* @__PURE__ */React__default.default.createElement("span", {
|
|
@@ -8,6 +8,7 @@ var common = require('./common.js');
|
|
|
8
8
|
var TableWidget = require('./TableWidget.js');
|
|
9
9
|
var antd = require('antd');
|
|
10
10
|
var cs = require('classnames');
|
|
11
|
+
var _ = require('lodash');
|
|
11
12
|
var React = require('react');
|
|
12
13
|
|
|
13
14
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -39,9 +40,9 @@ const TableContainerStyle = "E_tc97u5y";
|
|
|
39
40
|
const tableStyleCover = "E_tfzf37v";
|
|
40
41
|
const Table = props => {
|
|
41
42
|
const {
|
|
42
|
-
loading,
|
|
43
|
+
loading = false,
|
|
43
44
|
error,
|
|
44
|
-
dataSource,
|
|
45
|
+
dataSource: _dataSource,
|
|
45
46
|
columns,
|
|
46
47
|
onSorterChange,
|
|
47
48
|
onRowClick,
|
|
@@ -59,7 +60,7 @@ const Table = props => {
|
|
|
59
60
|
onRow
|
|
60
61
|
} = props;
|
|
61
62
|
const orderRef = React.useRef(null);
|
|
62
|
-
const hasScrollBard = common.useTableBodyHasScrollBar(wrapper,
|
|
63
|
+
const hasScrollBard = common.useTableBodyHasScrollBar(wrapper, _dataSource);
|
|
63
64
|
const _columns = React.useMemo(() => columns.map(column => {
|
|
64
65
|
const _column = __spreadValues({}, column);
|
|
65
66
|
if (_column.sorter && typeof _column.title !== "function") {
|
|
@@ -73,6 +74,21 @@ const Table = props => {
|
|
|
73
74
|
}
|
|
74
75
|
return _column;
|
|
75
76
|
}), [columns]);
|
|
77
|
+
const dataSource = React.useMemo(() => {
|
|
78
|
+
if (!_.isNil(error) || loading) {
|
|
79
|
+
return [];
|
|
80
|
+
}
|
|
81
|
+
return _dataSource != null ? _dataSource : [];
|
|
82
|
+
}, [_dataSource, error, loading]);
|
|
83
|
+
const emptyText = React.useMemo(() => {
|
|
84
|
+
if (loading) {
|
|
85
|
+
return "";
|
|
86
|
+
}
|
|
87
|
+
if (!_.isNil(error)) {
|
|
88
|
+
return error;
|
|
89
|
+
}
|
|
90
|
+
return empty;
|
|
91
|
+
}, [empty, error, loading]);
|
|
76
92
|
return /* @__PURE__ */React__default.default.createElement("div", {
|
|
77
93
|
className: core.cx(TableContainerStyle, "table-container", !hasScrollBard && "no-scroll-bar")
|
|
78
94
|
}, /* @__PURE__ */React__default.default.createElement(antd.Table, {
|
|
@@ -83,9 +99,9 @@ const Table = props => {
|
|
|
83
99
|
indicator: initLoading ? /* @__PURE__ */React__default.default.createElement(TableWidget.TableLoading, null) : /* @__PURE__ */React__default.default.createElement(index, null)
|
|
84
100
|
},
|
|
85
101
|
locale: {
|
|
86
|
-
emptyText
|
|
102
|
+
emptyText
|
|
87
103
|
},
|
|
88
|
-
dataSource
|
|
104
|
+
dataSource,
|
|
89
105
|
pagination: pagination || false,
|
|
90
106
|
columns: _columns,
|
|
91
107
|
components,
|
package/dist/cjs/index.js
CHANGED
|
@@ -203,8 +203,11 @@ exports.AntdPasswordInputStyled = index$A.AntdPasswordInputStyled;
|
|
|
203
203
|
exports.InputPassword = index$A.default;
|
|
204
204
|
exports.InputTagItem = index$B;
|
|
205
205
|
exports.KitStoreProvider = index$C.default;
|
|
206
|
+
exports.useCloseModal = index$C.useCloseModal;
|
|
206
207
|
exports.useKitDispatch = index$C.useKitDispatch;
|
|
207
208
|
exports.useKitSelector = index$C.useKitSelector;
|
|
209
|
+
exports.usePopModal = index$C.usePopModal;
|
|
210
|
+
exports.usePushModal = index$C.usePushModal;
|
|
208
211
|
exports.Link = index$D;
|
|
209
212
|
exports.Loading = index$E;
|
|
210
213
|
exports.attachTypeApi = index$F.attachTypeApi;
|