@lark-apaas/client-toolkit-lite 1.1.7-alpha.8 → 1.1.7-alpha.9
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/index.cjs +65 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -1
- package/dist/index.d.ts +18 -1
- package/dist/index.js +62 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -33,6 +33,7 @@ var index_exports = {};
|
|
|
33
33
|
__export(index_exports, {
|
|
34
34
|
ActiveLink: () => ActiveLink,
|
|
35
35
|
AppContainer: () => AppContainer_default,
|
|
36
|
+
ErrorRender: () => ErrorRender_default,
|
|
36
37
|
NavLink: () => NavLink2,
|
|
37
38
|
PagePlaceholder: () => PagePlaceholder_default,
|
|
38
39
|
QueryProvider: () => QueryProvider_default,
|
|
@@ -2130,13 +2131,62 @@ var PagePlaceholder = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F0
|
|
|
2130
2131
|
}, "PagePlaceholder");
|
|
2131
2132
|
var PagePlaceholder_default = PagePlaceholder;
|
|
2132
2133
|
|
|
2133
|
-
// src/
|
|
2134
|
+
// src/components/ErrorRender/index.tsx
|
|
2134
2135
|
var import_react12 = __toESM(require("react"), 1);
|
|
2136
|
+
var ErrorRender = /* @__PURE__ */ __name((props) => {
|
|
2137
|
+
const { error, resetErrorBoundary } = props;
|
|
2138
|
+
(0, import_react12.useEffect)(() => {
|
|
2139
|
+
if (error) {
|
|
2140
|
+
submitPostMessage({
|
|
2141
|
+
type: "RenderError",
|
|
2142
|
+
data: error
|
|
2143
|
+
});
|
|
2144
|
+
logger.log({
|
|
2145
|
+
level: "error",
|
|
2146
|
+
args: [
|
|
2147
|
+
"Render Error",
|
|
2148
|
+
error
|
|
2149
|
+
],
|
|
2150
|
+
meta: {
|
|
2151
|
+
type: "render-error"
|
|
2152
|
+
}
|
|
2153
|
+
});
|
|
2154
|
+
}
|
|
2155
|
+
}, [
|
|
2156
|
+
error
|
|
2157
|
+
]);
|
|
2158
|
+
(0, import_react12.useEffect)(() => {
|
|
2159
|
+
if (!resetErrorBoundary) return;
|
|
2160
|
+
const hmr = getHmrApi();
|
|
2161
|
+
if (hmr) {
|
|
2162
|
+
return hmr.onSuccess(() => {
|
|
2163
|
+
resetErrorBoundary();
|
|
2164
|
+
});
|
|
2165
|
+
}
|
|
2166
|
+
}, [
|
|
2167
|
+
resetErrorBoundary
|
|
2168
|
+
]);
|
|
2169
|
+
return /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2170
|
+
className: "min-h-screen flex items-center justify-center bg-white"
|
|
2171
|
+
}, /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2172
|
+
className: "flex flex-col justify-center items-center text-center"
|
|
2173
|
+
}, /* @__PURE__ */ import_react12.default.createElement("img", {
|
|
2174
|
+
src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/ylcylz_fsph_ryhs/ljhwZthlaukjlkulzlp/feisuda/template/illustration_empty_negative_error.svg",
|
|
2175
|
+
alt: "render error",
|
|
2176
|
+
className: "mb-3 w-[100px]"
|
|
2177
|
+
}), /* @__PURE__ */ import_react12.default.createElement("p", {
|
|
2178
|
+
className: "text-l/[22px] text-[14px] text-[#1F2329] font-medium"
|
|
2179
|
+
}, "\u9875\u9762\u51FA\u9519\u4E86")));
|
|
2180
|
+
}, "ErrorRender");
|
|
2181
|
+
var ErrorRender_default = ErrorRender;
|
|
2182
|
+
|
|
2183
|
+
// src/route-components/ActiveLink.tsx
|
|
2184
|
+
var import_react13 = __toESM(require("react"), 1);
|
|
2135
2185
|
var import_react_router_dom2 = require("react-router-dom");
|
|
2136
|
-
var ActiveLink = /* @__PURE__ */ (0,
|
|
2137
|
-
const [currentHash, setCurrentHash] = (0,
|
|
2186
|
+
var ActiveLink = /* @__PURE__ */ (0, import_react13.forwardRef)(({ to, onClick, className, style, children, ...rest }, ref) => {
|
|
2187
|
+
const [currentHash, setCurrentHash] = (0, import_react13.useState)(() => typeof window !== "undefined" ? window.location.hash : "");
|
|
2138
2188
|
const isHashRoute = typeof to === "string" && to.startsWith("#");
|
|
2139
|
-
(0,
|
|
2189
|
+
(0, import_react13.useEffect)(() => {
|
|
2140
2190
|
if (!isHashRoute) return;
|
|
2141
2191
|
const handleHashChange = /* @__PURE__ */ __name(() => {
|
|
2142
2192
|
setCurrentHash(window.location.hash);
|
|
@@ -2148,7 +2198,7 @@ var ActiveLink = /* @__PURE__ */ (0, import_react12.forwardRef)(({ to, onClick,
|
|
|
2148
2198
|
]);
|
|
2149
2199
|
const isActive = isHashRoute && currentHash === to;
|
|
2150
2200
|
if (!isHashRoute) {
|
|
2151
|
-
return /* @__PURE__ */
|
|
2201
|
+
return /* @__PURE__ */ import_react13.default.createElement(import_react_router_dom2.NavLink, {
|
|
2152
2202
|
ref,
|
|
2153
2203
|
to,
|
|
2154
2204
|
onClick,
|
|
@@ -2189,7 +2239,7 @@ var ActiveLink = /* @__PURE__ */ (0, import_react12.forwardRef)(({ to, onClick,
|
|
|
2189
2239
|
isPending: false,
|
|
2190
2240
|
isTransitioning: false
|
|
2191
2241
|
}) : children;
|
|
2192
|
-
return /* @__PURE__ */
|
|
2242
|
+
return /* @__PURE__ */ import_react13.default.createElement("a", {
|
|
2193
2243
|
ref,
|
|
2194
2244
|
href: to,
|
|
2195
2245
|
onClick: handleHashClick,
|
|
@@ -2201,9 +2251,9 @@ var ActiveLink = /* @__PURE__ */ (0, import_react12.forwardRef)(({ to, onClick,
|
|
|
2201
2251
|
ActiveLink.displayName = "ActiveLink";
|
|
2202
2252
|
|
|
2203
2253
|
// src/route-components/NavLink.tsx
|
|
2204
|
-
var
|
|
2254
|
+
var React10 = __toESM(require("react"), 1);
|
|
2205
2255
|
var import_react_router_dom3 = require("react-router-dom");
|
|
2206
|
-
var NavLink2 = /* @__PURE__ */
|
|
2256
|
+
var NavLink2 = /* @__PURE__ */ React10.forwardRef(({ to, children, className, style, ...props }, ref) => {
|
|
2207
2257
|
const isHashLink = typeof to === "string" && to.startsWith("#");
|
|
2208
2258
|
const location = (0, import_react_router_dom3.useLocation)();
|
|
2209
2259
|
const navigate = (0, import_react_router_dom3.useNavigate)();
|
|
@@ -2227,7 +2277,7 @@ var NavLink2 = /* @__PURE__ */ React9.forwardRef(({ to, children, className, sty
|
|
|
2227
2277
|
const resolvedClassName = typeof className === "function" ? className(renderProps) : className;
|
|
2228
2278
|
const resolvedStyle = typeof style === "function" ? style(renderProps) : style;
|
|
2229
2279
|
const { caseSensitive, end, replace, state, preventScrollReset, relative, viewTransition, ...restProps } = props;
|
|
2230
|
-
return /* @__PURE__ */
|
|
2280
|
+
return /* @__PURE__ */ React10.createElement("a", {
|
|
2231
2281
|
href: to,
|
|
2232
2282
|
onClick: handleClick,
|
|
2233
2283
|
ref,
|
|
@@ -2236,7 +2286,7 @@ var NavLink2 = /* @__PURE__ */ React9.forwardRef(({ to, children, className, sty
|
|
|
2236
2286
|
...restProps
|
|
2237
2287
|
}, typeof children === "function" ? children(renderProps) : children);
|
|
2238
2288
|
}
|
|
2239
|
-
return /* @__PURE__ */
|
|
2289
|
+
return /* @__PURE__ */ React10.createElement(import_react_router_dom3.NavLink, {
|
|
2240
2290
|
to,
|
|
2241
2291
|
ref,
|
|
2242
2292
|
className,
|
|
@@ -2251,7 +2301,7 @@ var NavLink2 = /* @__PURE__ */ React9.forwardRef(({ to, children, className, sty
|
|
|
2251
2301
|
NavLink2.displayName = "NavLink";
|
|
2252
2302
|
|
|
2253
2303
|
// src/route-components/UniversalLink.tsx
|
|
2254
|
-
var
|
|
2304
|
+
var import_react14 = __toESM(require("react"), 1);
|
|
2255
2305
|
var import_react_router_dom4 = require("react-router-dom");
|
|
2256
2306
|
function isInternalRoute(to) {
|
|
2257
2307
|
return !to.startsWith("#") && !to.startsWith("http://") && !to.startsWith("https://") && !to.startsWith("//");
|
|
@@ -2261,15 +2311,15 @@ function isExternalLink(to) {
|
|
|
2261
2311
|
return to.startsWith("http://") || to.startsWith("https://") || to.startsWith("//");
|
|
2262
2312
|
}
|
|
2263
2313
|
__name(isExternalLink, "isExternalLink");
|
|
2264
|
-
var UniversalLink = /* @__PURE__ */
|
|
2314
|
+
var UniversalLink = /* @__PURE__ */ import_react14.default.forwardRef(/* @__PURE__ */ __name(function UniversalLink2({ to, ...props }, ref) {
|
|
2265
2315
|
if (isInternalRoute(to)) {
|
|
2266
|
-
return /* @__PURE__ */
|
|
2316
|
+
return /* @__PURE__ */ import_react14.default.createElement(import_react_router_dom4.Link, {
|
|
2267
2317
|
to,
|
|
2268
2318
|
ref,
|
|
2269
2319
|
...props
|
|
2270
2320
|
});
|
|
2271
2321
|
}
|
|
2272
|
-
return /* @__PURE__ */
|
|
2322
|
+
return /* @__PURE__ */ import_react14.default.createElement("a", {
|
|
2273
2323
|
href: to,
|
|
2274
2324
|
ref,
|
|
2275
2325
|
...props,
|
|
@@ -2670,6 +2720,7 @@ var abstractArt3dRenderingCoverImg6 = "https://lf3-static.bytednsdoc.com/obj/ede
|
|
|
2670
2720
|
0 && (module.exports = {
|
|
2671
2721
|
ActiveLink,
|
|
2672
2722
|
AppContainer,
|
|
2723
|
+
ErrorRender,
|
|
2673
2724
|
NavLink,
|
|
2674
2725
|
PagePlaceholder,
|
|
2675
2726
|
QueryProvider,
|