@lark-apaas/client-toolkit 1.1.19-alpha.error.2 → 1.1.19-antd-test.1
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/lib/antd-table.d.ts +4 -0
- package/lib/antd-table.js +2 -0
- package/lib/components/AppContainer/index.js +108 -7
- package/package.json +7 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect } from "react";
|
|
2
|
+
import react, { useEffect } from "react";
|
|
3
3
|
import { MiaodaInspector } from "@lark-apaas/miaoda-inspector";
|
|
4
4
|
import IframeBridge from "./IframeBridge.js";
|
|
5
5
|
import { defaultUIConfig } from "../theme/ui-config.js";
|
|
@@ -14,6 +14,15 @@ import safety from "./safety.js";
|
|
|
14
14
|
registerDayjsPlugins();
|
|
15
15
|
initAxiosConfig();
|
|
16
16
|
const isMiaodaPreview = window.IS_MIAODA_PREVIEW;
|
|
17
|
+
const readCssVarColor = (varName, fallback)=>{
|
|
18
|
+
try {
|
|
19
|
+
if ('undefined' == typeof document) return fallback;
|
|
20
|
+
const value = getComputedStyle(document.documentElement).getPropertyValue(varName).trim();
|
|
21
|
+
return value || fallback;
|
|
22
|
+
} catch {
|
|
23
|
+
return fallback;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
17
26
|
const App = (props)=>{
|
|
18
27
|
const { themeMeta = {} } = props;
|
|
19
28
|
useAppInfo();
|
|
@@ -54,17 +63,109 @@ const App = (props)=>{
|
|
|
54
63
|
]
|
|
55
64
|
});
|
|
56
65
|
};
|
|
57
|
-
const
|
|
66
|
+
const AppContainer_AppContainer = (props)=>{
|
|
58
67
|
const { children, ...rest } = props;
|
|
68
|
+
const cssColors = {
|
|
69
|
+
background: readCssVarColor('--background'),
|
|
70
|
+
destructive: readCssVarColor('--destructive'),
|
|
71
|
+
primary: readCssVarColor('--primary'),
|
|
72
|
+
foreground: readCssVarColor('--foreground'),
|
|
73
|
+
warning: readCssVarColor('--warning'),
|
|
74
|
+
success: readCssVarColor('--success'),
|
|
75
|
+
muted: readCssVarColor('--muted'),
|
|
76
|
+
mutedForeground: readCssVarColor('--muted-foreground'),
|
|
77
|
+
border: readCssVarColor('--border'),
|
|
78
|
+
popover: readCssVarColor('--popover'),
|
|
79
|
+
accent: readCssVarColor('--accent'),
|
|
80
|
+
radius: readCssVarColor('--radius')
|
|
81
|
+
};
|
|
82
|
+
const antdThemeToken = {
|
|
83
|
+
borderRadius: cssColors.radius,
|
|
84
|
+
colorBgBase: cssColors.background,
|
|
85
|
+
colorError: cssColors.destructive,
|
|
86
|
+
colorInfo: cssColors.primary,
|
|
87
|
+
colorLink: cssColors.primary,
|
|
88
|
+
colorPrimary: cssColors.primary,
|
|
89
|
+
colorSuccess: cssColors.primary,
|
|
90
|
+
colorTextBase: cssColors.foreground,
|
|
91
|
+
colorWarning: cssColors.destructive
|
|
92
|
+
};
|
|
93
|
+
const antdTableToken = {
|
|
94
|
+
bodySortBg: cssColors.muted,
|
|
95
|
+
borderColor: cssColors.border,
|
|
96
|
+
expandIconBg: cssColors.background,
|
|
97
|
+
filterDropdownBg: cssColors.popover,
|
|
98
|
+
filterDropdownMenuBg: cssColors.popover,
|
|
99
|
+
fixedHeaderSortActiveBg: cssColors.muted,
|
|
100
|
+
footerBg: cssColors.muted,
|
|
101
|
+
footerColor: cssColors.mutedForeground,
|
|
102
|
+
headerBg: cssColors.muted,
|
|
103
|
+
headerColor: cssColors.mutedForeground,
|
|
104
|
+
headerFilterHoverBg: cssColors.muted,
|
|
105
|
+
headerSortActiveBg: cssColors.muted,
|
|
106
|
+
headerSortHoverBg: cssColors.muted,
|
|
107
|
+
headerSplitColor: cssColors.border,
|
|
108
|
+
rowExpandedBg: cssColors.background,
|
|
109
|
+
rowHoverBg: cssColors.muted,
|
|
110
|
+
rowSelectedBg: cssColors.accent,
|
|
111
|
+
rowSelectedHoverBg: cssColors.accent,
|
|
112
|
+
stickyScrollBarBg: cssColors.muted,
|
|
113
|
+
headerBorderRadius: 'var(--radius)'
|
|
114
|
+
};
|
|
115
|
+
const antdPaginationToken = {
|
|
116
|
+
itemActiveBg: cssColors.background,
|
|
117
|
+
itemActiveBgDisabled: cssColors.muted,
|
|
118
|
+
itemActiveColor: cssColors.primary,
|
|
119
|
+
itemActiveColorDisabled: cssColors.muted,
|
|
120
|
+
itemActiveColorHover: cssColors.muted,
|
|
121
|
+
itemBg: cssColors.background,
|
|
122
|
+
itemInputBg: cssColors.background,
|
|
123
|
+
itemLinkBg: cssColors.background
|
|
124
|
+
};
|
|
125
|
+
const OptionalAntdProvider = ({ children })=>{
|
|
126
|
+
const [Provider, setProvider] = react.useState(null);
|
|
127
|
+
const [ready, setReady] = react.useState(false);
|
|
128
|
+
react.useEffect(()=>{
|
|
129
|
+
let mounted = true;
|
|
130
|
+
import("antd").then((mod)=>{
|
|
131
|
+
if (mounted && mod?.ConfigProvider) setProvider(()=>mod.ConfigProvider);
|
|
132
|
+
if (mounted) setReady(true);
|
|
133
|
+
}).catch(()=>{
|
|
134
|
+
if (mounted) {
|
|
135
|
+
setProvider(null);
|
|
136
|
+
setReady(true);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
return ()=>{
|
|
140
|
+
mounted = false;
|
|
141
|
+
};
|
|
142
|
+
}, []);
|
|
143
|
+
if (!ready) return null;
|
|
144
|
+
if (!Provider) return /*#__PURE__*/ jsx(Fragment, {
|
|
145
|
+
children: children
|
|
146
|
+
});
|
|
147
|
+
return /*#__PURE__*/ jsx(Provider, {
|
|
148
|
+
theme: {
|
|
149
|
+
token: antdThemeToken,
|
|
150
|
+
components: {
|
|
151
|
+
Table: antdTableToken,
|
|
152
|
+
Pagination: antdPaginationToken
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
children: children
|
|
156
|
+
});
|
|
157
|
+
};
|
|
59
158
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
60
159
|
children: [
|
|
61
160
|
/*#__PURE__*/ jsx(safety, {}),
|
|
62
|
-
/*#__PURE__*/ jsx(
|
|
63
|
-
|
|
64
|
-
|
|
161
|
+
/*#__PURE__*/ jsx(OptionalAntdProvider, {
|
|
162
|
+
children: /*#__PURE__*/ jsx(App, {
|
|
163
|
+
themeMeta: props.themeMeta,
|
|
164
|
+
children: children
|
|
165
|
+
})
|
|
65
166
|
})
|
|
66
167
|
]
|
|
67
168
|
});
|
|
68
169
|
};
|
|
69
|
-
const
|
|
70
|
-
export {
|
|
170
|
+
const AppContainer = AppContainer_AppContainer;
|
|
171
|
+
export { AppContainer as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-apaas/client-toolkit",
|
|
3
|
-
"version": "1.1.19-
|
|
3
|
+
"version": "1.1.19-antd-test.1",
|
|
4
4
|
"types": "./lib/index.d.ts",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"files": [
|
|
@@ -15,6 +15,11 @@
|
|
|
15
15
|
"require": "./lib/index.js",
|
|
16
16
|
"types": "./lib/index.d.ts"
|
|
17
17
|
},
|
|
18
|
+
"./antd-table": {
|
|
19
|
+
"import": "./lib/antd-table.js",
|
|
20
|
+
"require": "./lib/antd-table.js",
|
|
21
|
+
"types": "./lib/antd-table.d.ts"
|
|
22
|
+
},
|
|
18
23
|
"./lib/index.css": "./lib/index.css",
|
|
19
24
|
"./dataloom": {
|
|
20
25
|
"import": "./lib/apis/dataloom.js",
|
|
@@ -76,7 +81,7 @@
|
|
|
76
81
|
"@ant-design/colors": "^7.2.1",
|
|
77
82
|
"@ant-design/cssinjs": "^1.24.0",
|
|
78
83
|
"@data-loom/js": "^0.4.0",
|
|
79
|
-
"@lark-apaas/miaoda-inspector": "^1.0.
|
|
84
|
+
"@lark-apaas/miaoda-inspector": "^1.0.4",
|
|
80
85
|
"@radix-ui/react-avatar": "^1.1.10",
|
|
81
86
|
"@radix-ui/react-popover": "^1.1.15",
|
|
82
87
|
"@radix-ui/react-slot": "^1.2.3",
|