@creekjs/web-components 1.0.2 → 1.0.4
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/.fatherrc.ts +1 -5
- package/.turbo/turbo-father$colon$build.log +39 -0
- package/.turbo/turbo-father$colon$dev.log +33 -0
- package/dist/creek-config-provider/CreekConfigContext.js +31 -2
- package/dist/creek-config-provider/CreekConfigContext.js.map +7 -0
- package/dist/creek-config-provider/index.js +35 -13
- package/dist/creek-config-provider/index.js.map +7 -0
- package/dist/creek-hooks/index.d.ts +1 -0
- package/dist/creek-hooks/index.js +26 -1
- package/dist/creek-hooks/index.js.map +7 -0
- package/dist/creek-hooks/useApp/DrawerHelper.d.ts +9 -0
- package/dist/creek-hooks/useApp/DrawerHelper.js +62 -0
- package/dist/creek-hooks/useApp/DrawerHelper.js.map +7 -0
- package/dist/creek-hooks/useApp/ModalHelper.d.ts +9 -0
- package/dist/creek-hooks/useApp/ModalHelper.js +62 -0
- package/dist/creek-hooks/useApp/ModalHelper.js.map +7 -0
- package/dist/creek-hooks/useApp/index.d.ts +25 -0
- package/dist/creek-hooks/useApp/index.js +118 -0
- package/dist/creek-hooks/useApp/index.js.map +7 -0
- package/dist/creek-hooks/useApp/types.d.ts +26 -0
- package/dist/creek-hooks/useApp/types.js +18 -0
- package/dist/creek-hooks/useApp/types.js.map +7 -0
- package/dist/creek-hooks/useViewportHeight.js +99 -97
- package/dist/creek-hooks/useViewportHeight.js.map +7 -0
- package/dist/creek-icon/index.js +53 -31
- package/dist/creek-icon/index.js.map +7 -0
- package/dist/creek-keep-alive/index.js +36 -18
- package/dist/creek-keep-alive/index.js.map +7 -0
- package/dist/creek-layout/CollapseButton.js +69 -47
- package/dist/creek-layout/CollapseButton.js.map +7 -0
- package/dist/creek-layout/Exception/NotFound.js +42 -13
- package/dist/creek-layout/Exception/NotFound.js.map +7 -0
- package/dist/creek-layout/Exception/NotFoundPage.js +30 -5
- package/dist/creek-layout/Exception/NotFoundPage.js.map +7 -0
- package/dist/creek-layout/Exception/index.js +37 -8
- package/dist/creek-layout/Exception/index.js.map +7 -0
- package/dist/creek-layout/HeaderContent/FullScreen.js +45 -39
- package/dist/creek-layout/HeaderContent/FullScreen.js.map +7 -0
- package/dist/creek-layout/HeaderContent/UserInfo.js +75 -53
- package/dist/creek-layout/HeaderContent/UserInfo.js.map +7 -0
- package/dist/creek-layout/HeaderContent/index.js +48 -28
- package/dist/creek-layout/HeaderContent/index.js.map +7 -0
- package/dist/creek-layout/index.js +117 -81
- package/dist/creek-layout/index.js.map +7 -0
- package/dist/creek-loading/index.js +55 -48
- package/dist/creek-loading/index.js.map +7 -0
- package/dist/creek-table/SearchTable.js +118 -114
- package/dist/creek-table/SearchTable.js.map +7 -0
- package/dist/creek-table/TableOptionRender.js +69 -60
- package/dist/creek-table/TableOptionRender.js.map +7 -0
- package/dist/creek-table/hooks/index.d.ts +2 -1
- package/dist/creek-table/hooks/index.js +30 -3
- package/dist/creek-table/hooks/index.js.map +7 -0
- package/dist/creek-table/hooks/useAdaptiveToolBar.js +48 -36
- package/dist/creek-table/hooks/useAdaptiveToolBar.js.map +7 -0
- package/dist/creek-table/hooks/useAutoWidthColumns.d.ts +6 -0
- package/dist/creek-table/hooks/useAutoWidthColumns.js +187 -0
- package/dist/creek-table/hooks/useAutoWidthColumns.js.map +7 -0
- package/dist/creek-table/hooks/useElementDistance.js +51 -39
- package/dist/creek-table/hooks/useElementDistance.js.map +7 -0
- package/dist/creek-table/hooks/useTableScrollHeight.d.ts +1 -0
- package/dist/creek-table/hooks/useTableScrollHeight.js +72 -0
- package/dist/creek-table/hooks/useTableScrollHeight.js.map +7 -0
- package/dist/creek-table/index.js +35 -25
- package/dist/creek-table/index.js.map +7 -0
- package/dist/creek-table/toolBarRender.d.ts +1 -0
- package/dist/creek-table/toolBarRender.js +55 -33
- package/dist/creek-table/toolBarRender.js.map +7 -0
- package/dist/creek-table/type.d.ts +1 -1
- package/dist/creek-table/type.js +18 -1
- package/dist/creek-table/type.js.map +7 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.js +34 -7
- package/dist/index.js.map +7 -0
- package/package.json +2 -2
- package/src/creek-hooks/index.ts +2 -0
- package/src/creek-hooks/useApp/DrawerHelper.tsx +43 -0
- package/src/creek-hooks/useApp/ModalHelper.tsx +43 -0
- package/src/creek-hooks/useApp/index.tsx +119 -0
- package/src/creek-hooks/useApp/types.ts +25 -0
- package/src/creek-hooks/useViewportHeight.tsx +34 -5
- package/src/creek-layout/index.tsx +2 -2
- package/src/creek-table/SearchTable.tsx +69 -77
- package/src/creek-table/hooks/index.ts +3 -1
- package/src/creek-table/hooks/useAutoWidthColumns.tsx +212 -0
- package/src/creek-table/hooks/useTableScrollHeight.tsx +63 -0
- package/src/creek-table/index.tsx +2 -6
- package/src/creek-table/toolBarRender.tsx +3 -3
- package/src/creek-table/type.ts +1 -1
- package/src/index.tsx +2 -2
- package/dist/bg-center/index.d.ts +0 -5
- package/dist/bg-center/index.d.ts.map +0 -1
- package/dist/bg-center/index.js +0 -28
- package/dist/creek-config-provider/CreekConfigContext.d.ts.map +0 -1
- package/dist/creek-config-provider/index.d.ts.map +0 -1
- package/dist/creek-hooks/index.d.ts.map +0 -1
- package/dist/creek-hooks/useViewportHeight.d.ts.map +0 -1
- package/dist/creek-icon/index.d.ts.map +0 -1
- package/dist/creek-keep-alive/index.d.ts.map +0 -1
- package/dist/creek-layout/CollapseButton.d.ts.map +0 -1
- package/dist/creek-layout/Exception/NotFound.d.ts.map +0 -1
- package/dist/creek-layout/Exception/NotFoundPage.d.ts.map +0 -1
- package/dist/creek-layout/Exception/index.d.ts.map +0 -1
- package/dist/creek-layout/HeaderContent/FullScreen.d.ts.map +0 -1
- package/dist/creek-layout/HeaderContent/UserInfo.d.ts.map +0 -1
- package/dist/creek-layout/HeaderContent/index.d.ts.map +0 -1
- package/dist/creek-layout/index.d.ts.map +0 -1
- package/dist/creek-loading/index.d.ts.map +0 -1
- package/dist/creek-search/CreekSearch.d.ts +0 -7
- package/dist/creek-search/CreekSearch.d.ts.map +0 -1
- package/dist/creek-search/CreekSearch.js +0 -51
- package/dist/creek-search/CreekSearchContext.d.ts +0 -54
- package/dist/creek-search/CreekSearchContext.d.ts.map +0 -1
- package/dist/creek-search/CreekSearchContext.js +0 -546
- package/dist/creek-search/CreekSearchFilterDisplay.d.ts +0 -5
- package/dist/creek-search/CreekSearchFilterDisplay.d.ts.map +0 -1
- package/dist/creek-search/CreekSearchFilterDisplay.js +0 -97
- package/dist/creek-search/CreekSearchInput.d.ts +0 -4
- package/dist/creek-search/CreekSearchInput.d.ts.map +0 -1
- package/dist/creek-search/CreekSearchInput.js +0 -96
- package/dist/creek-search/CreekSearchValueSelector.d.ts +0 -5
- package/dist/creek-search/CreekSearchValueSelector.d.ts.map +0 -1
- package/dist/creek-search/CreekSearchValueSelector.js +0 -422
- package/dist/creek-search/index.d.ts +0 -5
- package/dist/creek-search/index.d.ts.map +0 -1
- package/dist/creek-search/index.js +0 -5
- package/dist/creek-search/type.d.ts +0 -8
- package/dist/creek-search/type.d.ts.map +0 -1
- package/dist/creek-search/type.js +0 -1
- package/dist/creek-table/SearchTable.d.ts.map +0 -1
- package/dist/creek-table/TableOptionRender.d.ts.map +0 -1
- package/dist/creek-table/TableViewContent.d.ts +0 -4
- package/dist/creek-table/TableViewContent.d.ts.map +0 -1
- package/dist/creek-table/TableViewContent.js +0 -47
- package/dist/creek-table/hooks/index.d.ts.map +0 -1
- package/dist/creek-table/hooks/useAdaptiveToolBar.d.ts.map +0 -1
- package/dist/creek-table/hooks/useAutoAddFilterToColumns.d.ts +0 -12
- package/dist/creek-table/hooks/useAutoAddFilterToColumns.d.ts.map +0 -1
- package/dist/creek-table/hooks/useAutoAddFilterToColumns.js +0 -96
- package/dist/creek-table/hooks/useElementDistance.d.ts.map +0 -1
- package/dist/creek-table/index.d.ts.map +0 -1
- package/dist/creek-table/toolBarRender.d.ts.map +0 -1
- package/dist/creek-table/type.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/src/bg-center/index.tsx +0 -26
- package/src/creek-search/CreekSearch.tsx +0 -60
- package/src/creek-search/CreekSearchContext.tsx +0 -593
- package/src/creek-search/CreekSearchFilterDisplay.tsx +0 -84
- package/src/creek-search/CreekSearchInput.tsx +0 -75
- package/src/creek-search/CreekSearchValueSelector.tsx +0 -324
- package/src/creek-search/index.tsx +0 -5
- package/src/creek-search/type.ts +0 -9
- package/src/creek-table/TableViewContent.tsx +0 -46
- package/src/creek-table/hooks/useAutoAddFilterToColumns.tsx +0 -90
package/.fatherrc.ts
CHANGED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
> @creekjs/web-components@1.0.3 father:build /Users/ernestwang/Documents/code-resoorce/creek/packages/web-components
|
|
4
|
+
> father build
|
|
5
|
+
|
|
6
|
+
[36minfo[39m - Clean output directories
|
|
7
|
+
[36minfo[39m - Bundless for [33msrc[39m directory to [33mcjs[39m format
|
|
8
|
+
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-config-provider/index.js[39m (with declaration)
|
|
9
|
+
[35mevent[39m - Bundless [90mCreekConfigContext.tsx[39m to [90mdist/creek-config-provider/CreekConfigContext.js[39m (with declaration)
|
|
10
|
+
[35mevent[39m - Bundless [90mindex.ts[39m to [90mdist/creek-hooks/index.js[39m (with declaration)
|
|
11
|
+
[35mevent[39m - Bundless [90mDrawerHelper.tsx[39m to [90mdist/creek-hooks/useApp/DrawerHelper.js[39m (with declaration)
|
|
12
|
+
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-hooks/useApp/index.js[39m (with declaration)
|
|
13
|
+
[35mevent[39m - Bundless [90mModalHelper.tsx[39m to [90mdist/creek-hooks/useApp/ModalHelper.js[39m (with declaration)
|
|
14
|
+
[35mevent[39m - Bundless [90mtypes.ts[39m to [90mdist/creek-hooks/useApp/types.js[39m (with declaration)
|
|
15
|
+
[35mevent[39m - Bundless [90museViewportHeight.tsx[39m to [90mdist/creek-hooks/useViewportHeight.js[39m (with declaration)
|
|
16
|
+
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-icon/index.js[39m (with declaration)
|
|
17
|
+
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-keep-alive/index.js[39m (with declaration)
|
|
18
|
+
[35mevent[39m - Bundless [90mCollapseButton.tsx[39m to [90mdist/creek-layout/CollapseButton.js[39m (with declaration)
|
|
19
|
+
[35mevent[39m - Bundless [90mNotFound.tsx[39m to [90mdist/creek-layout/Exception/NotFound.js[39m (with declaration)
|
|
20
|
+
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-layout/Exception/index.js[39m (with declaration)
|
|
21
|
+
[35mevent[39m - Bundless [90mNotFoundPage.tsx[39m to [90mdist/creek-layout/Exception/NotFoundPage.js[39m (with declaration)
|
|
22
|
+
[35mevent[39m - Bundless [90mFullScreen.tsx[39m to [90mdist/creek-layout/HeaderContent/FullScreen.js[39m (with declaration)
|
|
23
|
+
[35mevent[39m - Bundless [90mUserInfo.tsx[39m to [90mdist/creek-layout/HeaderContent/UserInfo.js[39m (with declaration)
|
|
24
|
+
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-layout/HeaderContent/index.js[39m (with declaration)
|
|
25
|
+
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-layout/index.js[39m (with declaration)
|
|
26
|
+
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-loading/index.js[39m (with declaration)
|
|
27
|
+
[35mevent[39m - Bundless [90museAdaptiveToolBar.tsx[39m to [90mdist/creek-table/hooks/useAdaptiveToolBar.js[39m (with declaration)
|
|
28
|
+
[35mevent[39m - Bundless [90mindex.ts[39m to [90mdist/creek-table/hooks/index.js[39m (with declaration)
|
|
29
|
+
[35mevent[39m - Bundless [90museAutoWidthColumns.tsx[39m to [90mdist/creek-table/hooks/useAutoWidthColumns.js[39m (with declaration)
|
|
30
|
+
[35mevent[39m - Bundless [90museTableScrollHeight.tsx[39m to [90mdist/creek-table/hooks/useTableScrollHeight.js[39m (with declaration)
|
|
31
|
+
[35mevent[39m - Bundless [90mTableOptionRender.tsx[39m to [90mdist/creek-table/TableOptionRender.js[39m (with declaration)
|
|
32
|
+
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/creek-table/index.js[39m (with declaration)
|
|
33
|
+
[35mevent[39m - Bundless [90museElementDistance.tsx[39m to [90mdist/creek-table/hooks/useElementDistance.js[39m (with declaration)
|
|
34
|
+
[35mevent[39m - Bundless [90mtype.ts[39m to [90mdist/creek-table/type.js[39m (with declaration)
|
|
35
|
+
[35mevent[39m - Bundless [90mtoolBarRender.tsx[39m to [90mdist/creek-table/toolBarRender.js[39m (with declaration)
|
|
36
|
+
[35mevent[39m - Bundless [90mindex.tsx[39m to [90mdist/index.js[39m (with declaration)
|
|
37
|
+
[35mevent[39m - Bundless [90mSearchTable.tsx[39m to [90mdist/creek-table/SearchTable.js[39m (with declaration)
|
|
38
|
+
[35mevent[39m - Generate declaration files...
|
|
39
|
+
[35mevent[39m - Transformed successfully in 13711 ms (30 files)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
> @creekjs/web-components@1.0.2 father:dev /Users/ernestwang/Documents/code-resoorce/creek/packages/web-components
|
|
3
|
+
> father dev
|
|
4
|
+
|
|
5
|
+
info - [18:16:09] Clean output directories
|
|
6
|
+
info - [18:16:09] Bundless for src directory to cjs format
|
|
7
|
+
event - [18:16:09] Bundless CreekConfigContext.tsx to dist/creek-config-provider/CreekConfigContext.js (with declaration)
|
|
8
|
+
event - [18:16:09] Bundless index.ts to dist/creek-hooks/index.js (with declaration)
|
|
9
|
+
event - [18:16:09] Bundless index.tsx to dist/creek-config-provider/index.js (with declaration)
|
|
10
|
+
event - [18:16:09] Bundless index.tsx to dist/creek-keep-alive/index.js (with declaration)
|
|
11
|
+
event - [18:16:09] Bundless useViewportHeight.tsx to dist/creek-hooks/useViewportHeight.js (with declaration)
|
|
12
|
+
event - [18:16:09] Bundless index.tsx to dist/creek-icon/index.js (with declaration)
|
|
13
|
+
event - [18:16:09] Bundless CollapseButton.tsx to dist/creek-layout/CollapseButton.js (with declaration)
|
|
14
|
+
event - [18:16:09] Bundless NotFoundPage.tsx to dist/creek-layout/Exception/NotFoundPage.js (with declaration)
|
|
15
|
+
event - [18:16:09] Bundless index.tsx to dist/creek-layout/Exception/index.js (with declaration)
|
|
16
|
+
event - [18:16:09] Bundless NotFound.tsx to dist/creek-layout/Exception/NotFound.js (with declaration)
|
|
17
|
+
event - [18:16:09] Bundless FullScreen.tsx to dist/creek-layout/HeaderContent/FullScreen.js (with declaration)
|
|
18
|
+
event - [18:16:09] Bundless UserInfo.tsx to dist/creek-layout/HeaderContent/UserInfo.js (with declaration)
|
|
19
|
+
event - [18:16:09] Bundless index.tsx to dist/creek-loading/index.js (with declaration)
|
|
20
|
+
event - [18:16:09] Bundless index.tsx to dist/creek-layout/index.js (with declaration)
|
|
21
|
+
event - [18:16:09] Bundless index.ts to dist/creek-table/hooks/index.js (with declaration)
|
|
22
|
+
event - [18:16:09] Bundless useAdaptiveToolBar.tsx to dist/creek-table/hooks/useAdaptiveToolBar.js (with declaration)
|
|
23
|
+
event - [18:16:09] Bundless useElementDistance.tsx to dist/creek-table/hooks/useElementDistance.js (with declaration)
|
|
24
|
+
event - [18:16:09] Bundless index.tsx to dist/creek-table/index.js (with declaration)
|
|
25
|
+
event - [18:16:09] Bundless SearchTable.tsx to dist/creek-table/SearchTable.js (with declaration)
|
|
26
|
+
event - [18:16:09] Bundless TableViewContent.tsx to dist/creek-table/TableViewContent.js (with declaration)
|
|
27
|
+
event - [18:16:09] Bundless TableOptionRender.tsx to dist/creek-table/TableOptionRender.js (with declaration)
|
|
28
|
+
event - [18:16:09] Bundless toolBarRender.tsx to dist/creek-table/toolBarRender.js (with declaration)
|
|
29
|
+
event - [18:16:09] Bundless index.tsx to dist/index.js (with declaration)
|
|
30
|
+
event - [18:16:10] Bundless type.ts to dist/creek-table/type.js (with declaration)
|
|
31
|
+
event - [18:16:10] Bundless index.tsx to dist/creek-layout/HeaderContent/index.js (with declaration)
|
|
32
|
+
event - [18:16:10] Generate declaration files...
|
|
33
|
+
event - [18:16:13] Start watching src directory...
|
|
@@ -1,2 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/creek-config-provider/CreekConfigContext.tsx
|
|
20
|
+
var CreekConfigContext_exports = {};
|
|
21
|
+
__export(CreekConfigContext_exports, {
|
|
22
|
+
CreekConfigContext: () => CreekConfigContext
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(CreekConfigContext_exports);
|
|
25
|
+
var import_react = require("react");
|
|
26
|
+
var CreekConfigContext = (0, import_react.createContext)({});
|
|
27
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
+
0 && (module.exports = {
|
|
29
|
+
CreekConfigContext
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=CreekConfigContext.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/creek-config-provider/CreekConfigContext.tsx"],
|
|
4
|
+
"sourcesContent": ["import { createContext } from 'react';\n\nexport type CreekConfigContextProps = {\n iconFontCNs?: string[]\n};\n\nexport const CreekConfigContext = createContext<CreekConfigContextProps>({});\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA8B;AAMvB,IAAM,yBAAqB,4BAAuC,CAAC,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,14 +1,36 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
more = _objectWithoutProperties(props, _excluded);
|
|
9
|
-
return /*#__PURE__*/_jsx(CreekConfigContext.Provider, {
|
|
10
|
-
value: more,
|
|
11
|
-
children: children
|
|
12
|
-
});
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
8
|
};
|
|
14
|
-
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/creek-config-provider/index.tsx
|
|
20
|
+
var creek_config_provider_exports = {};
|
|
21
|
+
__export(creek_config_provider_exports, {
|
|
22
|
+
CreekConfigProvider: () => CreekConfigProvider
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(creek_config_provider_exports);
|
|
25
|
+
var import_CreekConfigContext = require("./CreekConfigContext");
|
|
26
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
27
|
+
var CreekConfigProvider = (props) => {
|
|
28
|
+
const { children, ...more } = props;
|
|
29
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_CreekConfigContext.CreekConfigContext.Provider, { value: more, children });
|
|
30
|
+
};
|
|
31
|
+
CreekConfigProvider.CreekConfigContext = import_CreekConfigContext.CreekConfigContext;
|
|
32
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
33
|
+
0 && (module.exports = {
|
|
34
|
+
CreekConfigProvider
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/creek-config-provider/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import { CreekConfigContext, CreekConfigContextProps } from './CreekConfigContext';\n\nexport type CreekConfigProviderProps = CreekConfigContextProps & {\n children?: React.ReactNode;\n};\n\nexport const CreekConfigProvider = (props: CreekConfigProviderProps) => {\n const { children, ...more } = props;\n return <CreekConfigContext.Provider value={more}>{children}</CreekConfigContext.Provider>;\n};\n\nCreekConfigProvider.CreekConfigContext = CreekConfigContext;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAA4D;AAQnD;AAFF,IAAM,sBAAsB,CAAC,UAAoC;AACtE,QAAM,EAAE,UAAU,GAAG,KAAK,IAAI;AAC9B,SAAO,4CAAC,6CAAmB,UAAnB,EAA4B,OAAO,MAAO,UAAS;AAC7D;AAEA,oBAAoB,qBAAqB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1 +1,26 @@
|
|
|
1
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// src/creek-hooks/index.ts
|
|
17
|
+
var creek_hooks_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(creek_hooks_exports);
|
|
19
|
+
__reExport(creek_hooks_exports, require("./useApp"), module.exports);
|
|
20
|
+
__reExport(creek_hooks_exports, require("./useViewportHeight"), module.exports);
|
|
21
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
22
|
+
0 && (module.exports = {
|
|
23
|
+
...require("./useApp"),
|
|
24
|
+
...require("./useViewportHeight")
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/creek-hooks/useApp/DrawerHelper.tsx
|
|
20
|
+
var DrawerHelper_exports = {};
|
|
21
|
+
__export(DrawerHelper_exports, {
|
|
22
|
+
DrawerHelper: () => DrawerHelper
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(DrawerHelper_exports);
|
|
25
|
+
var import_pro_components = require("@ant-design/pro-components");
|
|
26
|
+
var import_antd = require("antd");
|
|
27
|
+
var import_lodash = require("lodash");
|
|
28
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
29
|
+
var DrawerHelper = ({ open, config, onClose }) => {
|
|
30
|
+
const { content, type, ...restConfig } = config;
|
|
31
|
+
if (type === "form") {
|
|
32
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
33
|
+
import_pro_components.DrawerForm,
|
|
34
|
+
{
|
|
35
|
+
open,
|
|
36
|
+
onOpenChange: (visible) => !visible && onClose(),
|
|
37
|
+
drawerProps: {
|
|
38
|
+
destroyOnHidden: true,
|
|
39
|
+
onClose,
|
|
40
|
+
...config.drawerProps || {}
|
|
41
|
+
},
|
|
42
|
+
...(0, import_lodash.omit)(restConfig, "drawerProps"),
|
|
43
|
+
children: content
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
48
|
+
import_antd.Drawer,
|
|
49
|
+
{
|
|
50
|
+
open,
|
|
51
|
+
onClose,
|
|
52
|
+
destroyOnHidden: true,
|
|
53
|
+
...restConfig,
|
|
54
|
+
children: content
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
59
|
+
0 && (module.exports = {
|
|
60
|
+
DrawerHelper
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=DrawerHelper.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/creek-hooks/useApp/DrawerHelper.tsx"],
|
|
4
|
+
"sourcesContent": ["import { DrawerForm } from '@ant-design/pro-components';\nimport { Drawer } from 'antd';\nimport { omit } from 'lodash';\nimport React from 'react';\nimport { DrawerConfig, FormDrawerConfig, NormalDrawerConfig } from './types';\n\ninterface DrawerHelperProps {\n open: boolean;\n config: DrawerConfig;\n onClose: () => void;\n}\n\nexport const DrawerHelper: React.FC<DrawerHelperProps> = ({ open, config, onClose }) => {\n const { content, type, ...restConfig } = config;\n\n if (type === 'form') {\n return (\n <DrawerForm\n open={open}\n onOpenChange={(visible) => !visible && onClose()}\n drawerProps={{\n destroyOnHidden: true,\n onClose,\n ...((config as FormDrawerConfig).drawerProps || {}),\n }}\n {...(omit(restConfig, 'drawerProps') as any)}\n >\n {content}\n </DrawerForm>\n );\n }\n\n return (\n <Drawer\n open={open}\n onClose={onClose}\n destroyOnHidden\n {...(restConfig as NormalDrawerConfig)}\n >\n {content}\n </Drawer>\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAA2B;AAC3B,kBAAuB;AACvB,oBAAqB;AAef;AALC,IAAM,eAA4C,CAAC,EAAE,MAAM,QAAQ,QAAQ,MAAM;AACtF,QAAM,EAAE,SAAS,MAAM,GAAG,WAAW,IAAI;AAEzC,MAAI,SAAS,QAAQ;AACnB,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,cAAc,CAAC,YAAY,CAAC,WAAW,QAAQ;AAAA,QAC/C,aAAa;AAAA,UACX,iBAAiB;AAAA,UACjB;AAAA,UACA,GAAK,OAA4B,eAAe,CAAC;AAAA,QACnD;AAAA,QACC,OAAI,oBAAK,YAAY,aAAa;AAAA,QAElC;AAAA;AAAA,IACH;AAAA,EAEJ;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,iBAAe;AAAA,MACd,GAAI;AAAA,MAEJ;AAAA;AAAA,EACH;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/creek-hooks/useApp/ModalHelper.tsx
|
|
20
|
+
var ModalHelper_exports = {};
|
|
21
|
+
__export(ModalHelper_exports, {
|
|
22
|
+
ModalHelper: () => ModalHelper
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(ModalHelper_exports);
|
|
25
|
+
var import_pro_components = require("@ant-design/pro-components");
|
|
26
|
+
var import_antd = require("antd");
|
|
27
|
+
var import_lodash = require("lodash");
|
|
28
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
29
|
+
var ModalHelper = ({ open, config, onClose }) => {
|
|
30
|
+
const { content, type, ...restConfig } = config;
|
|
31
|
+
if (type === "form") {
|
|
32
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
33
|
+
import_pro_components.ModalForm,
|
|
34
|
+
{
|
|
35
|
+
open,
|
|
36
|
+
onOpenChange: (visible) => !visible && onClose(),
|
|
37
|
+
modalProps: {
|
|
38
|
+
destroyOnHidden: true,
|
|
39
|
+
onCancel: onClose,
|
|
40
|
+
...config.modalProps || {}
|
|
41
|
+
},
|
|
42
|
+
...(0, import_lodash.omit)(restConfig, "modalProps"),
|
|
43
|
+
children: content
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
48
|
+
import_antd.Modal,
|
|
49
|
+
{
|
|
50
|
+
open,
|
|
51
|
+
onCancel: onClose,
|
|
52
|
+
destroyOnHidden: true,
|
|
53
|
+
...restConfig,
|
|
54
|
+
children: content
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
59
|
+
0 && (module.exports = {
|
|
60
|
+
ModalHelper
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=ModalHelper.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/creek-hooks/useApp/ModalHelper.tsx"],
|
|
4
|
+
"sourcesContent": ["import { ModalForm } from '@ant-design/pro-components';\nimport { Modal } from 'antd';\nimport { omit } from 'lodash';\nimport React from 'react';\nimport { FormModalConfig, ModalConfig, NormalModalConfig } from './types';\n\ninterface ModalHelperProps {\n open: boolean;\n config: ModalConfig;\n onClose: () => void;\n}\n\nexport const ModalHelper: React.FC<ModalHelperProps> = ({ open, config, onClose }) => {\n const { content, type, ...restConfig } = config;\n\n if (type === 'form') {\n return (\n <ModalForm\n open={open}\n onOpenChange={(visible) => !visible && onClose()}\n modalProps={{\n destroyOnHidden: true,\n onCancel: onClose,\n ...((config as FormModalConfig).modalProps || {}),\n }}\n {...(omit(restConfig, 'modalProps') as any)}\n >\n {content}\n </ModalForm>\n );\n }\n\n return (\n <Modal\n open={open}\n onCancel={onClose}\n destroyOnHidden\n {...(restConfig as NormalModalConfig)}\n >\n {content}\n </Modal>\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAA0B;AAC1B,kBAAsB;AACtB,oBAAqB;AAef;AALC,IAAM,cAA0C,CAAC,EAAE,MAAM,QAAQ,QAAQ,MAAM;AACpF,QAAM,EAAE,SAAS,MAAM,GAAG,WAAW,IAAI;AAEzC,MAAI,SAAS,QAAQ;AACnB,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,cAAc,CAAC,YAAY,CAAC,WAAW,QAAQ;AAAA,QAC/C,YAAY;AAAA,UACV,iBAAiB;AAAA,UACjB,UAAU;AAAA,UACV,GAAK,OAA2B,cAAc,CAAC;AAAA,QACjD;AAAA,QACC,OAAI,oBAAK,YAAY,YAAY;AAAA,QAEjC;AAAA;AAAA,IACH;AAAA,EAEJ;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,UAAU;AAAA,MACV,iBAAe;AAAA,MACd,GAAI;AAAA,MAEJ;AAAA;AAAA,EACH;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FormDrawerConfig, FormModalConfig, NormalDrawerConfig, NormalModalConfig } from './types';
|
|
3
|
+
export declare const AppProvider: React.FC<{
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const useApp: () => {
|
|
7
|
+
drawer: {
|
|
8
|
+
open: (config: NormalDrawerConfig) => void;
|
|
9
|
+
openForm: (config: Omit<FormDrawerConfig, "type">) => void;
|
|
10
|
+
close: () => void;
|
|
11
|
+
};
|
|
12
|
+
modal: {
|
|
13
|
+
open: (config: NormalModalConfig) => void;
|
|
14
|
+
openForm: (config: Omit<FormModalConfig, "type">) => void;
|
|
15
|
+
close: () => void;
|
|
16
|
+
info: import("antd/es/modal/useModal").ModalFuncWithPromise;
|
|
17
|
+
success: import("antd/es/modal/useModal").ModalFuncWithPromise;
|
|
18
|
+
error: import("antd/es/modal/useModal").ModalFuncWithPromise;
|
|
19
|
+
warning: import("antd/es/modal/useModal").ModalFuncWithPromise;
|
|
20
|
+
confirm: import("antd/es/modal/useModal").ModalFuncWithPromise;
|
|
21
|
+
};
|
|
22
|
+
message: import("antd/es/message/interface").MessageInstance;
|
|
23
|
+
notification: import("antd/es/notification/interface").NotificationInstance;
|
|
24
|
+
};
|
|
25
|
+
export * from './types';
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/creek-hooks/useApp/index.tsx
|
|
21
|
+
var useApp_exports = {};
|
|
22
|
+
__export(useApp_exports, {
|
|
23
|
+
AppProvider: () => AppProvider,
|
|
24
|
+
useApp: () => useApp
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(useApp_exports);
|
|
27
|
+
var import_ahooks = require("ahooks");
|
|
28
|
+
var import_antd = require("antd");
|
|
29
|
+
var import_react = require("react");
|
|
30
|
+
var import_DrawerHelper = require("./DrawerHelper");
|
|
31
|
+
var import_ModalHelper = require("./ModalHelper");
|
|
32
|
+
__reExport(useApp_exports, require("./types"), module.exports);
|
|
33
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
34
|
+
var usePopupState = () => {
|
|
35
|
+
const [state, setState] = (0, import_react.useState)({
|
|
36
|
+
open: false,
|
|
37
|
+
config: {}
|
|
38
|
+
});
|
|
39
|
+
const show = (0, import_ahooks.useMemoizedFn)((config) => {
|
|
40
|
+
setState({ open: true, config });
|
|
41
|
+
});
|
|
42
|
+
const close = (0, import_ahooks.useMemoizedFn)(() => {
|
|
43
|
+
setState((prev) => ({ ...prev, open: false }));
|
|
44
|
+
});
|
|
45
|
+
return { ...state, show, close };
|
|
46
|
+
};
|
|
47
|
+
var AppContext = (0, import_react.createContext)(null);
|
|
48
|
+
var AppProvider = ({ children }) => {
|
|
49
|
+
const drawer = usePopupState();
|
|
50
|
+
const modal = usePopupState();
|
|
51
|
+
const handleCloseModal = (0, import_ahooks.useMemoizedFn)(() => {
|
|
52
|
+
modal.close();
|
|
53
|
+
});
|
|
54
|
+
const handleCloseDrawer = (0, import_ahooks.useMemoizedFn)(() => {
|
|
55
|
+
drawer.close();
|
|
56
|
+
});
|
|
57
|
+
const contextValue = (0, import_react.useMemo)(
|
|
58
|
+
() => ({
|
|
59
|
+
openDrawer: drawer.show,
|
|
60
|
+
closeDrawer: handleCloseDrawer,
|
|
61
|
+
openModal: modal.show,
|
|
62
|
+
closeModal: handleCloseModal
|
|
63
|
+
}),
|
|
64
|
+
[drawer.show, handleCloseDrawer, modal.show, handleCloseModal]
|
|
65
|
+
);
|
|
66
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AppContext.Provider, { value: contextValue, children: [
|
|
67
|
+
children,
|
|
68
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DrawerHelper.DrawerHelper, { open: drawer.open, config: drawer.config, onClose: handleCloseDrawer }),
|
|
69
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ModalHelper.ModalHelper, { open: modal.open, config: modal.config, onClose: handleCloseModal })
|
|
70
|
+
] });
|
|
71
|
+
};
|
|
72
|
+
var useApp = () => {
|
|
73
|
+
const antdApp = import_antd.App.useApp();
|
|
74
|
+
const appContext = (0, import_react.useContext)(AppContext);
|
|
75
|
+
return (0, import_react.useMemo)(() => {
|
|
76
|
+
const { openDrawer, closeDrawer, openModal, closeModal } = appContext || {};
|
|
77
|
+
const warn = () => console.warn("AppProvider is missing");
|
|
78
|
+
const createOpener = (opener, type) => {
|
|
79
|
+
return (config) => {
|
|
80
|
+
if (opener) {
|
|
81
|
+
opener({ ...config, type });
|
|
82
|
+
} else {
|
|
83
|
+
warn();
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
const createFormOpener = (opener, type) => {
|
|
88
|
+
return (config) => {
|
|
89
|
+
if (opener) {
|
|
90
|
+
opener({ ...config, type });
|
|
91
|
+
} else {
|
|
92
|
+
warn();
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
return {
|
|
97
|
+
...antdApp,
|
|
98
|
+
drawer: {
|
|
99
|
+
open: createOpener(openDrawer, "normal"),
|
|
100
|
+
openForm: createFormOpener(openDrawer, "form"),
|
|
101
|
+
close: closeDrawer || warn
|
|
102
|
+
},
|
|
103
|
+
modal: {
|
|
104
|
+
...antdApp.modal,
|
|
105
|
+
open: createOpener(openModal, "normal"),
|
|
106
|
+
openForm: createFormOpener(openModal, "form"),
|
|
107
|
+
close: closeModal || warn
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
}, [antdApp, appContext]);
|
|
111
|
+
};
|
|
112
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
113
|
+
0 && (module.exports = {
|
|
114
|
+
AppProvider,
|
|
115
|
+
useApp,
|
|
116
|
+
...require("./types")
|
|
117
|
+
});
|
|
118
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/creek-hooks/useApp/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import { useMemoizedFn } from 'ahooks';\nimport { App } from 'antd';\nimport React, { createContext, useContext, useMemo, useState } from 'react';\n\nimport { DrawerHelper } from './DrawerHelper';\nimport { ModalHelper } from './ModalHelper';\nimport {\n AppContextType,\n DrawerConfig,\n FormDrawerConfig,\n FormModalConfig,\n ModalConfig,\n NormalDrawerConfig,\n NormalModalConfig,\n} from './types';\n\n// --- Helper Hook for State Management ---\nconst usePopupState = <T extends object>() => {\n const [state, setState] = useState<{ open: boolean; config: T }>({\n open: false,\n config: {} as T,\n });\n\n const show = useMemoizedFn((config: T) => {\n setState({ open: true, config });\n });\n\n const close = useMemoizedFn(() => {\n setState((prev) => ({ ...prev, open: false }));\n });\n\n return { ...state, show, close };\n};\n\nconst AppContext = createContext<AppContextType | null>(null);\n\nexport const AppProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {\n const drawer = usePopupState<DrawerConfig>();\n const modal = usePopupState<ModalConfig>();\n\n const handleCloseModal = useMemoizedFn(() => {\n modal.close();\n });\n\n const handleCloseDrawer = useMemoizedFn(() => {\n drawer.close();\n });\n\n const contextValue = useMemo(\n () => ({\n openDrawer: drawer.show,\n closeDrawer: handleCloseDrawer,\n openModal: modal.show,\n closeModal: handleCloseModal,\n }),\n [drawer.show, handleCloseDrawer, modal.show, handleCloseModal],\n );\n\n return (\n <AppContext.Provider value={contextValue}>\n {children}\n <DrawerHelper open={drawer.open} config={drawer.config} onClose={handleCloseDrawer} />\n <ModalHelper open={modal.open} config={modal.config} onClose={handleCloseModal} />\n </AppContext.Provider>\n );\n};\n\nexport const useApp = () => {\n const antdApp = App.useApp();\n const appContext = useContext(AppContext);\n\n return useMemo(() => {\n const { openDrawer, closeDrawer, openModal, closeModal } = appContext || {};\n const warn = () => console.warn('AppProvider is missing');\n\n const createOpener = <T extends NormalModalConfig | NormalDrawerConfig>(\n opener: ((config: T) => void) | undefined,\n type: 'normal',\n ) => {\n return (config: T) => {\n if (opener) {\n opener({ ...config, type } as T);\n } else {\n warn();\n }\n };\n };\n\n const createFormOpener = <T extends FormModalConfig | FormDrawerConfig>(\n opener: ((config: T) => void) | undefined,\n type: 'form',\n ) => {\n return (config: Omit<T, 'type'>) => {\n if (opener) {\n opener({ ...config, type } as T);\n } else {\n warn();\n }\n };\n };\n\n return {\n ...antdApp,\n drawer: {\n open: createOpener<NormalDrawerConfig>(openDrawer, 'normal'),\n openForm: createFormOpener<FormDrawerConfig>(openDrawer, 'form'),\n close: closeDrawer || warn,\n },\n modal: {\n ...antdApp.modal,\n open: createOpener<NormalModalConfig>(openModal, 'normal'),\n openForm: createFormOpener<FormModalConfig>(openModal, 'form'),\n close: closeModal || warn,\n },\n };\n }, [antdApp, appContext]);\n};\n\nexport * from './types';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA8B;AAC9B,kBAAoB;AACpB,mBAAoE;AAEpE,0BAA6B;AAC7B,yBAA4B;AAiH5B,2BAAc,oBAtHd;AA2DI;AA1CJ,IAAM,gBAAgB,MAAwB;AAC5C,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAuC;AAAA,IAC/D,MAAM;AAAA,IACN,QAAQ,CAAC;AAAA,EACX,CAAC;AAED,QAAM,WAAO,6BAAc,CAAC,WAAc;AACxC,aAAS,EAAE,MAAM,MAAM,OAAO,CAAC;AAAA,EACjC,CAAC;AAED,QAAM,YAAQ,6BAAc,MAAM;AAChC,aAAS,CAAC,UAAU,EAAE,GAAG,MAAM,MAAM,MAAM,EAAE;AAAA,EAC/C,CAAC;AAED,SAAO,EAAE,GAAG,OAAO,MAAM,MAAM;AACjC;AAEA,IAAM,iBAAa,4BAAqC,IAAI;AAErD,IAAM,cAAuD,CAAC,EAAE,SAAS,MAAM;AACpF,QAAM,SAAS,cAA4B;AAC3C,QAAM,QAAQ,cAA2B;AAEzC,QAAM,uBAAmB,6BAAc,MAAM;AAC3C,UAAM,MAAM;AAAA,EACd,CAAC;AAED,QAAM,wBAAoB,6BAAc,MAAM;AAC5C,WAAO,MAAM;AAAA,EACf,CAAC;AAED,QAAM,mBAAe;AAAA,IACnB,OAAO;AAAA,MACL,YAAY,OAAO;AAAA,MACnB,aAAa;AAAA,MACb,WAAW,MAAM;AAAA,MACjB,YAAY;AAAA,IACd;AAAA,IACA,CAAC,OAAO,MAAM,mBAAmB,MAAM,MAAM,gBAAgB;AAAA,EAC/D;AAEA,SACE,6CAAC,WAAW,UAAX,EAAoB,OAAO,cACzB;AAAA;AAAA,IACD,4CAAC,oCAAa,MAAM,OAAO,MAAM,QAAQ,OAAO,QAAQ,SAAS,mBAAmB;AAAA,IACpF,4CAAC,kCAAY,MAAM,MAAM,MAAM,QAAQ,MAAM,QAAQ,SAAS,kBAAkB;AAAA,KAClF;AAEJ;AAEO,IAAM,SAAS,MAAM;AAC1B,QAAM,UAAU,gBAAI,OAAO;AAC3B,QAAM,iBAAa,yBAAW,UAAU;AAExC,aAAO,sBAAQ,MAAM;AACnB,UAAM,EAAE,YAAY,aAAa,WAAW,WAAW,IAAI,cAAc,CAAC;AAC1E,UAAM,OAAO,MAAM,QAAQ,KAAK,wBAAwB;AAExD,UAAM,eAAe,CACnB,QACA,SACG;AACH,aAAO,CAAC,WAAc;AACpB,YAAI,QAAQ;AACV,iBAAO,EAAE,GAAG,QAAQ,KAAK,CAAM;AAAA,QACjC,OAAO;AACL,eAAK;AAAA,QACP;AAAA,MACF;AAAA,IACF;AAEA,UAAM,mBAAmB,CACvB,QACA,SACG;AACH,aAAO,CAAC,WAA4B;AAClC,YAAI,QAAQ;AACV,iBAAO,EAAE,GAAG,QAAQ,KAAK,CAAM;AAAA,QACjC,OAAO;AACL,eAAK;AAAA,QACP;AAAA,MACF;AAAA,IACF;AAEA,WAAO;AAAA,MACL,GAAG;AAAA,MACH,QAAQ;AAAA,QACN,MAAM,aAAiC,YAAY,QAAQ;AAAA,QAC3D,UAAU,iBAAmC,YAAY,MAAM;AAAA,QAC/D,OAAO,eAAe;AAAA,MACxB;AAAA,MACA,OAAO;AAAA,QACL,GAAG,QAAQ;AAAA,QACX,MAAM,aAAgC,WAAW,QAAQ;AAAA,QACzD,UAAU,iBAAkC,WAAW,MAAM;AAAA,QAC7D,OAAO,cAAc;AAAA,MACvB;AAAA,IACF;AAAA,EACF,GAAG,CAAC,SAAS,UAAU,CAAC;AAC1B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { DrawerFormProps, ModalFormProps } from '@ant-design/pro-components';
|
|
2
|
+
import { DrawerProps, ModalProps } from 'antd';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
export type BaseConfig = {
|
|
5
|
+
content?: React.ReactNode;
|
|
6
|
+
};
|
|
7
|
+
export type NormalModalConfig = BaseConfig & ModalProps & {
|
|
8
|
+
type?: 'normal';
|
|
9
|
+
};
|
|
10
|
+
export type FormModalConfig<T = any> = BaseConfig & Omit<ModalFormProps<T>, 'content'> & {
|
|
11
|
+
type: 'form';
|
|
12
|
+
};
|
|
13
|
+
export type ModalConfig = NormalModalConfig | FormModalConfig;
|
|
14
|
+
export type NormalDrawerConfig = BaseConfig & DrawerProps & {
|
|
15
|
+
type?: 'normal';
|
|
16
|
+
};
|
|
17
|
+
export type FormDrawerConfig<T = any> = BaseConfig & Omit<DrawerFormProps<T>, 'content'> & {
|
|
18
|
+
type: 'form';
|
|
19
|
+
};
|
|
20
|
+
export type DrawerConfig = NormalDrawerConfig | FormDrawerConfig;
|
|
21
|
+
export interface AppContextType {
|
|
22
|
+
openDrawer: (config: DrawerConfig) => void;
|
|
23
|
+
closeDrawer: () => void;
|
|
24
|
+
openModal: (config: ModalConfig) => void;
|
|
25
|
+
closeModal: () => void;
|
|
26
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
|
|
15
|
+
// src/creek-hooks/useApp/types.ts
|
|
16
|
+
var types_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(types_exports);
|
|
18
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/creek-hooks/useApp/types.ts"],
|
|
4
|
+
"sourcesContent": ["import { DrawerFormProps, ModalFormProps } from '@ant-design/pro-components';\nimport { DrawerProps, ModalProps } from 'antd';\nimport React from 'react';\n\n// --- Common ---\nexport type BaseConfig = {\n content?: React.ReactNode;\n};\n\n// --- Modal Types ---\nexport type NormalModalConfig = BaseConfig & ModalProps & { type?: 'normal' };\nexport type FormModalConfig<T = any> = BaseConfig & Omit<ModalFormProps<T>, 'content'> & { type: 'form' };\nexport type ModalConfig = NormalModalConfig | FormModalConfig;\n\n// --- Drawer Types ---\nexport type NormalDrawerConfig = BaseConfig & DrawerProps & { type?: 'normal' };\nexport type FormDrawerConfig<T = any> = BaseConfig & Omit<DrawerFormProps<T>, 'content'> & { type: 'form' };\nexport type DrawerConfig = NormalDrawerConfig | FormDrawerConfig;\n\nexport interface AppContextType {\n openDrawer: (config: DrawerConfig) => void;\n closeDrawer: () => void;\n openModal: (config: ModalConfig) => void;\n closeModal: () => void;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|