@lark-apaas/client-toolkit-lite 1.1.10 → 1.1.11-alpha.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/dist/index.cjs +55 -295
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +43 -283
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -76,7 +76,7 @@ __export(index_exports, {
|
|
|
76
76
|
module.exports = __toCommonJS(index_exports);
|
|
77
77
|
|
|
78
78
|
// src/components/AppContainer/index.tsx
|
|
79
|
-
var
|
|
79
|
+
var import_react9 = __toESM(require("react"), 1);
|
|
80
80
|
var import_miaoda_inspector = require("@lark-apaas/miaoda-inspector");
|
|
81
81
|
|
|
82
82
|
// src/runtime/react-devtools-hook.ts
|
|
@@ -2059,221 +2059,8 @@ var Safety = /* @__PURE__ */ __name(() => {
|
|
|
2059
2059
|
}, "Safety");
|
|
2060
2060
|
var safety_default = Safety;
|
|
2061
2061
|
|
|
2062
|
-
// src/components/AppContainer/Watermark.tsx
|
|
2063
|
-
var import_react6 = __toESM(require("react"), 1);
|
|
2064
|
-
var PopoverPrimitive2 = __toESM(require("@radix-ui/react-popover"), 1);
|
|
2065
|
-
|
|
2066
|
-
// src/components/AppContainer/doubao-watermark-asset.ts
|
|
2067
|
-
var CDN = "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/miaoda-ui";
|
|
2068
|
-
var DOUBAO_LOGO_SRC = `${CDN}/setting_voice.svg`;
|
|
2069
|
-
var DOUBAO_CLOSE_SRC = `${CDN}/icon_close_outlined.svg`;
|
|
2070
|
-
var DOUBAO_REPORT_SRC = `${CDN}/%5BDBX%5DDropdown.svg`;
|
|
2071
|
-
var DOUBAO_PILL_MOBILE_SRC = `${CDN}/Frame%202147223991%20(4).svg`;
|
|
2072
|
-
var DOUBAO_REPORT_ITEM_SRC = `${CDN}/_Dropdown-item.svg`;
|
|
2073
|
-
var DOUBAO_DONTSHOW_ITEM_SRC = `${CDN}/_Dropdown-item%20(1).svg`;
|
|
2074
|
-
|
|
2075
|
-
// src/components/AppContainer/Watermark.tsx
|
|
2076
|
-
var DOUBAO_SOURCE = "5";
|
|
2077
|
-
var REPORT_ENABLED = false;
|
|
2078
|
-
var reportDomainByEnv = /* @__PURE__ */ __name((env) => {
|
|
2079
|
-
if (env === "boe") return "tns.feishu-boe.cn";
|
|
2080
|
-
if (env === "pre") return "tns.feishu-pre.cn";
|
|
2081
|
-
return "tns.feishu.cn";
|
|
2082
|
-
}, "reportDomainByEnv");
|
|
2083
|
-
var openDoubaoReport = /* @__PURE__ */ __name(() => {
|
|
2084
|
-
const params = JSON.stringify({
|
|
2085
|
-
scene: "miaoda_app_report",
|
|
2086
|
-
entity_id: getAppId() ?? "",
|
|
2087
|
-
entity_type: "miaoda_app",
|
|
2088
|
-
extra: ""
|
|
2089
|
-
});
|
|
2090
|
-
const domain = reportDomainByEnv(process.env.FORCE_FRAMEWORK_ENVIRONMENT);
|
|
2091
|
-
const url = `https://${domain}/cust/lark_report/?type=common¶ms=${encodeURIComponent(params)}&lang=zh-CN`;
|
|
2092
|
-
window.open(url, "_blank", "noopener,noreferrer");
|
|
2093
|
-
}, "openDoubaoReport");
|
|
2094
|
-
var mobilePillWrapper = {
|
|
2095
|
-
position: "fixed",
|
|
2096
|
-
right: 12,
|
|
2097
|
-
bottom: 12,
|
|
2098
|
-
width: 85,
|
|
2099
|
-
height: 30,
|
|
2100
|
-
zIndex: 9999,
|
|
2101
|
-
cursor: "pointer"
|
|
2102
|
-
};
|
|
2103
|
-
var mobilePillImg = {
|
|
2104
|
-
position: "absolute",
|
|
2105
|
-
right: -12,
|
|
2106
|
-
bottom: -40,
|
|
2107
|
-
width: 129,
|
|
2108
|
-
height: 94,
|
|
2109
|
-
// 钉死尺寸:宿主页常带 Tailwind preflight 的 `img{max-width:100%;height:auto}`,
|
|
2110
|
-
// 会把这张 129x94 的图压进 85x30 包裹层导致缩水变形 + 负偏移对齐错位。
|
|
2111
|
-
// 内联 style 特异度高于 element 选择器,可盖过 preflight。
|
|
2112
|
-
maxWidth: "none",
|
|
2113
|
-
maxHeight: "none",
|
|
2114
|
-
display: "block",
|
|
2115
|
-
pointerEvents: "none"
|
|
2116
|
-
};
|
|
2117
|
-
var mobileMenu = {
|
|
2118
|
-
display: "flex",
|
|
2119
|
-
flexDirection: "column",
|
|
2120
|
-
background: "#fff",
|
|
2121
|
-
borderRadius: 12,
|
|
2122
|
-
padding: 4,
|
|
2123
|
-
boxShadow: "0px 6px 16px rgba(0,0,0,0.12)",
|
|
2124
|
-
zIndex: 1e4,
|
|
2125
|
-
// radix Content 打开时获取焦点,去掉浏览器默认 focus 描边(同 Safety sheetContent)
|
|
2126
|
-
outline: "none"
|
|
2127
|
-
};
|
|
2128
|
-
var mobileMenuItem = {
|
|
2129
|
-
display: "block",
|
|
2130
|
-
// 同药丸:钉死尺寸盖过宿主 Tailwind preflight 的 img{max-width:100%;height:auto}
|
|
2131
|
-
width: 132,
|
|
2132
|
-
height: 38,
|
|
2133
|
-
maxWidth: "none",
|
|
2134
|
-
maxHeight: "none",
|
|
2135
|
-
cursor: "pointer"
|
|
2136
|
-
};
|
|
2137
|
-
var MobileWatermark = /* @__PURE__ */ __name(({ onDontShow }) => {
|
|
2138
|
-
const [open, setOpen] = (0, import_react6.useState)(false);
|
|
2139
|
-
return /* @__PURE__ */ import_react6.default.createElement(PopoverPrimitive2.Root, {
|
|
2140
|
-
open,
|
|
2141
|
-
onOpenChange: setOpen
|
|
2142
|
-
}, /* @__PURE__ */ import_react6.default.createElement(PopoverPrimitive2.Trigger, {
|
|
2143
|
-
asChild: true
|
|
2144
|
-
}, /* @__PURE__ */ import_react6.default.createElement("div", {
|
|
2145
|
-
"data-custom-element": "doubao-watermark-mobile",
|
|
2146
|
-
style: mobilePillWrapper
|
|
2147
|
-
}, /* @__PURE__ */ import_react6.default.createElement("img", {
|
|
2148
|
-
src: DOUBAO_PILL_MOBILE_SRC,
|
|
2149
|
-
width: 129,
|
|
2150
|
-
height: 94,
|
|
2151
|
-
alt: "\u8C46\u5305 AI \u751F\u6210",
|
|
2152
|
-
style: mobilePillImg
|
|
2153
|
-
}))), /* @__PURE__ */ import_react6.default.createElement(PopoverPrimitive2.Portal, null, /* @__PURE__ */ import_react6.default.createElement(PopoverPrimitive2.Content, {
|
|
2154
|
-
side: "top",
|
|
2155
|
-
align: "end",
|
|
2156
|
-
sideOffset: 8,
|
|
2157
|
-
style: mobileMenu
|
|
2158
|
-
}, /* @__PURE__ */ import_react6.default.createElement("img", {
|
|
2159
|
-
src: DOUBAO_REPORT_ITEM_SRC,
|
|
2160
|
-
width: 132,
|
|
2161
|
-
height: 38,
|
|
2162
|
-
alt: "\u6295\u8BC9\u4E0E\u4E3E\u62A5",
|
|
2163
|
-
style: mobileMenuItem
|
|
2164
|
-
}), /* @__PURE__ */ import_react6.default.createElement("img", {
|
|
2165
|
-
src: DOUBAO_DONTSHOW_ITEM_SRC,
|
|
2166
|
-
width: 132,
|
|
2167
|
-
height: 38,
|
|
2168
|
-
alt: "\u4E0D\u518D\u5C55\u793A",
|
|
2169
|
-
style: mobileMenuItem,
|
|
2170
|
-
onClick: /* @__PURE__ */ __name(() => {
|
|
2171
|
-
setOpen(false);
|
|
2172
|
-
onDontShow();
|
|
2173
|
-
}, "onClick")
|
|
2174
|
-
}))));
|
|
2175
|
-
}, "MobileWatermark");
|
|
2176
|
-
var Watermark = /* @__PURE__ */ __name(() => {
|
|
2177
|
-
const [closed, setClosed] = (0, import_react6.useState)(false);
|
|
2178
|
-
const [open, setOpen] = (0, import_react6.useState)(false);
|
|
2179
|
-
const timer = (0, import_react6.useRef)(null);
|
|
2180
|
-
const isMobile2 = useIsMobile();
|
|
2181
|
-
if (String(process.env.MIAODA_APP_SOURCE) !== DOUBAO_SOURCE) return null;
|
|
2182
|
-
if (closed) return null;
|
|
2183
|
-
if (isMobile2) {
|
|
2184
|
-
return /* @__PURE__ */ import_react6.default.createElement(MobileWatermark, {
|
|
2185
|
-
onDontShow: /* @__PURE__ */ __name(() => setClosed(true), "onDontShow")
|
|
2186
|
-
});
|
|
2187
|
-
}
|
|
2188
|
-
const enter = /* @__PURE__ */ __name(() => {
|
|
2189
|
-
if (timer.current) clearTimeout(timer.current);
|
|
2190
|
-
setOpen(true);
|
|
2191
|
-
}, "enter");
|
|
2192
|
-
const leave = /* @__PURE__ */ __name(() => {
|
|
2193
|
-
timer.current = setTimeout(() => setOpen(false), 100);
|
|
2194
|
-
}, "leave");
|
|
2195
|
-
return /* @__PURE__ */ import_react6.default.createElement("div", {
|
|
2196
|
-
"data-custom-element": "doubao-watermark",
|
|
2197
|
-
onMouseEnter: enter,
|
|
2198
|
-
onMouseLeave: leave,
|
|
2199
|
-
style: {
|
|
2200
|
-
position: "fixed",
|
|
2201
|
-
right: 12,
|
|
2202
|
-
bottom: 12,
|
|
2203
|
-
zIndex: 9999,
|
|
2204
|
-
display: "flex",
|
|
2205
|
-
flexDirection: "column",
|
|
2206
|
-
alignItems: "flex-end"
|
|
2207
|
-
}
|
|
2208
|
-
}, REPORT_ENABLED && open && /* @__PURE__ */ import_react6.default.createElement("img", {
|
|
2209
|
-
src: DOUBAO_REPORT_SRC,
|
|
2210
|
-
width: 168,
|
|
2211
|
-
height: 78,
|
|
2212
|
-
alt: "\u6295\u8BC9\u4E0E\u4E3E\u62A5",
|
|
2213
|
-
onClick: openDoubaoReport,
|
|
2214
|
-
style: {
|
|
2215
|
-
display: "block",
|
|
2216
|
-
cursor: "pointer",
|
|
2217
|
-
marginBottom: -8,
|
|
2218
|
-
marginRight: -12
|
|
2219
|
-
}
|
|
2220
|
-
}), /* @__PURE__ */ import_react6.default.createElement("div", {
|
|
2221
|
-
style: {
|
|
2222
|
-
boxSizing: "border-box",
|
|
2223
|
-
display: "inline-flex",
|
|
2224
|
-
alignItems: "center",
|
|
2225
|
-
gap: 4,
|
|
2226
|
-
padding: "6px 12px 6px 8px",
|
|
2227
|
-
background: "#363636",
|
|
2228
|
-
border: "0.5px solid rgba(255,255,255,0.1)",
|
|
2229
|
-
borderRadius: 100,
|
|
2230
|
-
boxShadow: "0px 2px 2px rgba(0,0,0,0.02), 0px 4px 8px rgba(0,0,0,0.04), 0px 8px 16px rgba(0,0,0,0.08)"
|
|
2231
|
-
}
|
|
2232
|
-
}, /* @__PURE__ */ import_react6.default.createElement("img", {
|
|
2233
|
-
src: DOUBAO_LOGO_SRC,
|
|
2234
|
-
width: 16,
|
|
2235
|
-
height: 16,
|
|
2236
|
-
alt: "",
|
|
2237
|
-
style: {
|
|
2238
|
-
borderRadius: 100,
|
|
2239
|
-
flexShrink: 0,
|
|
2240
|
-
display: "block"
|
|
2241
|
-
}
|
|
2242
|
-
}), /* @__PURE__ */ import_react6.default.createElement("span", {
|
|
2243
|
-
style: {
|
|
2244
|
-
fontFamily: "'PingFang SC', -apple-system, BlinkMacSystemFont, sans-serif",
|
|
2245
|
-
fontSize: 12,
|
|
2246
|
-
lineHeight: "18px",
|
|
2247
|
-
color: "rgba(255,255,255,0.85)",
|
|
2248
|
-
whiteSpace: "nowrap"
|
|
2249
|
-
}
|
|
2250
|
-
}, "\u7531 \u8C46\u5305AI \u751F\u6210"), /* @__PURE__ */ import_react6.default.createElement("span", {
|
|
2251
|
-
role: "button",
|
|
2252
|
-
"aria-label": "\u5173\u95ED",
|
|
2253
|
-
onClick: /* @__PURE__ */ __name((e) => {
|
|
2254
|
-
e.stopPropagation();
|
|
2255
|
-
setClosed(true);
|
|
2256
|
-
}, "onClick"),
|
|
2257
|
-
style: {
|
|
2258
|
-
display: "inline-flex",
|
|
2259
|
-
alignItems: "center",
|
|
2260
|
-
cursor: "pointer",
|
|
2261
|
-
flexShrink: 0
|
|
2262
|
-
}
|
|
2263
|
-
}, /* @__PURE__ */ import_react6.default.createElement("img", {
|
|
2264
|
-
src: DOUBAO_CLOSE_SRC,
|
|
2265
|
-
width: 10,
|
|
2266
|
-
height: 10,
|
|
2267
|
-
alt: "",
|
|
2268
|
-
style: {
|
|
2269
|
-
display: "block"
|
|
2270
|
-
}
|
|
2271
|
-
}))));
|
|
2272
|
-
}, "Watermark");
|
|
2273
|
-
var Watermark_default = Watermark;
|
|
2274
|
-
|
|
2275
2062
|
// src/components/QueryProvider/index.tsx
|
|
2276
|
-
var
|
|
2063
|
+
var import_react6 = __toESM(require("react"), 1);
|
|
2277
2064
|
var import_react_query = require("@tanstack/react-query");
|
|
2278
2065
|
var defaultQueryClient = null;
|
|
2279
2066
|
var getDefaultQueryClient = /* @__PURE__ */ __name(() => {
|
|
@@ -2294,20 +2081,20 @@ var getDefaultQueryClient = /* @__PURE__ */ __name(() => {
|
|
|
2294
2081
|
}, "getDefaultQueryClient");
|
|
2295
2082
|
var QueryProvider = /* @__PURE__ */ __name(({ children, client }) => {
|
|
2296
2083
|
const qc = client ?? getDefaultQueryClient();
|
|
2297
|
-
return /* @__PURE__ */
|
|
2084
|
+
return /* @__PURE__ */ import_react6.default.createElement(import_react_query.QueryClientProvider, {
|
|
2298
2085
|
client: qc
|
|
2299
2086
|
}, children);
|
|
2300
2087
|
}, "QueryProvider");
|
|
2301
2088
|
var QueryProvider_default = QueryProvider;
|
|
2302
2089
|
|
|
2303
2090
|
// src/components/AppContainer/IframeBridge.tsx
|
|
2304
|
-
var
|
|
2091
|
+
var import_react8 = require("react");
|
|
2305
2092
|
var import_react_router_dom = require("react-router-dom");
|
|
2306
2093
|
|
|
2307
2094
|
// src/hooks/useUpdatingRef.ts
|
|
2308
|
-
var
|
|
2095
|
+
var import_react7 = require("react");
|
|
2309
2096
|
function useUpdatingRef(value) {
|
|
2310
|
-
const ref = (0,
|
|
2097
|
+
const ref = (0, import_react7.useRef)(value);
|
|
2311
2098
|
ref.current = value;
|
|
2312
2099
|
return ref;
|
|
2313
2100
|
}
|
|
@@ -2328,20 +2115,20 @@ function IframeBridge() {
|
|
|
2328
2115
|
const location = (0, import_react_router_dom.useLocation)();
|
|
2329
2116
|
const navigate = (0, import_react_router_dom.useNavigate)();
|
|
2330
2117
|
const navigateRef = useUpdatingRef(navigate);
|
|
2331
|
-
const isActive = (0,
|
|
2332
|
-
const historyBack = (0,
|
|
2118
|
+
const isActive = (0, import_react8.useRef)(false);
|
|
2119
|
+
const historyBack = (0, import_react8.useCallback)((_payload) => {
|
|
2333
2120
|
navigateRef.current(-1);
|
|
2334
2121
|
isActive.current = true;
|
|
2335
2122
|
}, [
|
|
2336
2123
|
navigateRef
|
|
2337
2124
|
]);
|
|
2338
|
-
const historyForward = (0,
|
|
2125
|
+
const historyForward = (0, import_react8.useCallback)((_payload) => {
|
|
2339
2126
|
navigateRef.current(1);
|
|
2340
2127
|
isActive.current = true;
|
|
2341
2128
|
}, [
|
|
2342
2129
|
navigateRef
|
|
2343
2130
|
]);
|
|
2344
|
-
const operatorMessage = (0,
|
|
2131
|
+
const operatorMessage = (0, import_react8.useMemo)(() => ({
|
|
2345
2132
|
["RouteBack"]: historyBack,
|
|
2346
2133
|
["RouteForward"]: historyForward,
|
|
2347
2134
|
["RouteChange"]: navigateRef.current
|
|
@@ -2350,7 +2137,7 @@ function IframeBridge() {
|
|
|
2350
2137
|
historyForward,
|
|
2351
2138
|
navigateRef
|
|
2352
2139
|
]);
|
|
2353
|
-
(0,
|
|
2140
|
+
(0, import_react8.useEffect)(() => {
|
|
2354
2141
|
if (isActive.current) {
|
|
2355
2142
|
isActive.current = false;
|
|
2356
2143
|
return;
|
|
@@ -2362,7 +2149,7 @@ function IframeBridge() {
|
|
|
2362
2149
|
}, [
|
|
2363
2150
|
location
|
|
2364
2151
|
]);
|
|
2365
|
-
const handleMessage = (0,
|
|
2152
|
+
const handleMessage = (0, import_react8.useCallback)((event) => {
|
|
2366
2153
|
const data = event.data ?? {};
|
|
2367
2154
|
if (typeof data.type === "string" && isRouteMessageType(data.type)) {
|
|
2368
2155
|
operatorMessage[data.type](data.data);
|
|
@@ -2370,7 +2157,7 @@ function IframeBridge() {
|
|
|
2370
2157
|
}, [
|
|
2371
2158
|
operatorMessage
|
|
2372
2159
|
]);
|
|
2373
|
-
(0,
|
|
2160
|
+
(0, import_react8.useEffect)(() => {
|
|
2374
2161
|
window.addEventListener("message", handleMessage);
|
|
2375
2162
|
return () => {
|
|
2376
2163
|
window.removeEventListener("message", handleMessage);
|
|
@@ -2378,7 +2165,7 @@ function IframeBridge() {
|
|
|
2378
2165
|
}, [
|
|
2379
2166
|
handleMessage
|
|
2380
2167
|
]);
|
|
2381
|
-
return /* @__PURE__ */ (0,
|
|
2168
|
+
return /* @__PURE__ */ (0, import_react8.createElement)("div", {
|
|
2382
2169
|
style: {
|
|
2383
2170
|
display: "none"
|
|
2384
2171
|
}
|
|
@@ -2506,7 +2293,7 @@ var TrackKey = /* @__PURE__ */ (function(TrackKey2) {
|
|
|
2506
2293
|
// src/components/AppContainer/index.tsx
|
|
2507
2294
|
var AppContainer = /* @__PURE__ */ __name(({ children }) => {
|
|
2508
2295
|
useAppInfo();
|
|
2509
|
-
(0,
|
|
2296
|
+
(0, import_react9.useEffect)(() => {
|
|
2510
2297
|
if (process.env.NODE_ENV === "production") {
|
|
2511
2298
|
reportTeaEvent({
|
|
2512
2299
|
trackKey: TrackKey.VIEW,
|
|
@@ -2518,14 +2305,14 @@ var AppContainer = /* @__PURE__ */ __name(({ children }) => {
|
|
|
2518
2305
|
});
|
|
2519
2306
|
}
|
|
2520
2307
|
}, []);
|
|
2521
|
-
return /* @__PURE__ */
|
|
2308
|
+
return /* @__PURE__ */ import_react9.default.createElement(import_react9.default.Fragment, null, String(process.env.MIAODA_APP_TYPE) !== "7" && /* @__PURE__ */ import_react9.default.createElement(safety_default, null), process.env.NODE_ENV !== "production" && /* @__PURE__ */ import_react9.default.createElement(import_miaoda_inspector.MiaodaInspector, null), process.env.NODE_ENV !== "production" && /* @__PURE__ */ import_react9.default.createElement(IframeBridge, null), /* @__PURE__ */ import_react9.default.createElement(QueryProvider_default, null, children));
|
|
2522
2309
|
}, "AppContainer");
|
|
2523
2310
|
var AppContainer_default = AppContainer;
|
|
2524
2311
|
|
|
2525
2312
|
// src/components/Welcome/index.tsx
|
|
2526
|
-
var
|
|
2313
|
+
var import_react10 = __toESM(require("react"), 1);
|
|
2527
2314
|
var Welcome = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1", description = "\u9875\u9762\u6682\u672A\u5F00\u53D1\uFF0C\u8BF7\u8010\u5FC3\u7B49\u5F85..." }) => {
|
|
2528
|
-
return /* @__PURE__ */
|
|
2315
|
+
return /* @__PURE__ */ import_react10.default.createElement("div", {
|
|
2529
2316
|
style: {
|
|
2530
2317
|
display: "flex",
|
|
2531
2318
|
flexDirection: "column",
|
|
@@ -2536,7 +2323,7 @@ var Welcome = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1"
|
|
|
2536
2323
|
padding: "0 24px",
|
|
2537
2324
|
textAlign: "center"
|
|
2538
2325
|
}
|
|
2539
|
-
}, /* @__PURE__ */
|
|
2326
|
+
}, /* @__PURE__ */ import_react10.default.createElement("img", {
|
|
2540
2327
|
style: {
|
|
2541
2328
|
borderRadius: 6,
|
|
2542
2329
|
marginBottom: 24
|
|
@@ -2545,7 +2332,7 @@ var Welcome = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1"
|
|
|
2545
2332
|
height: "200",
|
|
2546
2333
|
src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/miao/welcome.svg",
|
|
2547
2334
|
alt: "Welcome"
|
|
2548
|
-
}), /* @__PURE__ */
|
|
2335
|
+
}), /* @__PURE__ */ import_react10.default.createElement("div", {
|
|
2549
2336
|
style: {
|
|
2550
2337
|
fontSize: 16,
|
|
2551
2338
|
fontWeight: 500,
|
|
@@ -2553,7 +2340,7 @@ var Welcome = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1"
|
|
|
2553
2340
|
marginBottom: 4,
|
|
2554
2341
|
color: "#1f2329"
|
|
2555
2342
|
}
|
|
2556
|
-
}, title), /* @__PURE__ */
|
|
2343
|
+
}, title), /* @__PURE__ */ import_react10.default.createElement("div", {
|
|
2557
2344
|
style: {
|
|
2558
2345
|
fontSize: 16,
|
|
2559
2346
|
lineHeight: "24px",
|
|
@@ -2565,9 +2352,9 @@ var Welcome = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1"
|
|
|
2565
2352
|
var Welcome_default = Welcome;
|
|
2566
2353
|
|
|
2567
2354
|
// src/components/PagePlaceholder/index.tsx
|
|
2568
|
-
var
|
|
2355
|
+
var import_react11 = __toESM(require("react"), 1);
|
|
2569
2356
|
var PagePlaceholder = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F00\u53D1", description = "\u9875\u9762\u6682\u672A\u5F00\u53D1\uFF0C\u8BF7\u8010\u5FC3\u7B49\u5F85..." }) => {
|
|
2570
|
-
return /* @__PURE__ */
|
|
2357
|
+
return /* @__PURE__ */ import_react11.default.createElement("div", {
|
|
2571
2358
|
style: {
|
|
2572
2359
|
display: "flex",
|
|
2573
2360
|
flexDirection: "column",
|
|
@@ -2578,7 +2365,7 @@ var PagePlaceholder = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F0
|
|
|
2578
2365
|
height: "calc(100vh - 64px)",
|
|
2579
2366
|
textAlign: "center"
|
|
2580
2367
|
}
|
|
2581
|
-
}, /* @__PURE__ */
|
|
2368
|
+
}, /* @__PURE__ */ import_react11.default.createElement("img", {
|
|
2582
2369
|
style: {
|
|
2583
2370
|
borderRadius: "6px",
|
|
2584
2371
|
marginBottom: "24px"
|
|
@@ -2587,14 +2374,14 @@ var PagePlaceholder = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F0
|
|
|
2587
2374
|
height: "200",
|
|
2588
2375
|
src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/LMfspH/ljhwZthlaukjlkulzlp/miao/welcome.svg",
|
|
2589
2376
|
alt: "Welcome"
|
|
2590
|
-
}), /* @__PURE__ */
|
|
2377
|
+
}), /* @__PURE__ */ import_react11.default.createElement("div", {
|
|
2591
2378
|
style: {
|
|
2592
2379
|
fontSize: "16px",
|
|
2593
2380
|
fontWeight: 500,
|
|
2594
2381
|
marginBottom: "4px",
|
|
2595
2382
|
lineHeight: "24px"
|
|
2596
2383
|
}
|
|
2597
|
-
}, title), /* @__PURE__ */
|
|
2384
|
+
}, title), /* @__PURE__ */ import_react11.default.createElement("div", {
|
|
2598
2385
|
style: {
|
|
2599
2386
|
color: "#6b7280",
|
|
2600
2387
|
fontSize: "16px",
|
|
@@ -2610,10 +2397,10 @@ var PagePlaceholder = /* @__PURE__ */ __name(({ title = "\u9875\u9762\u5F85\u5F0
|
|
|
2610
2397
|
var PagePlaceholder_default = PagePlaceholder;
|
|
2611
2398
|
|
|
2612
2399
|
// src/components/ErrorRender/index.tsx
|
|
2613
|
-
var
|
|
2400
|
+
var import_react12 = __toESM(require("react"), 1);
|
|
2614
2401
|
var ErrorRender = /* @__PURE__ */ __name((props) => {
|
|
2615
2402
|
const { error, resetErrorBoundary } = props;
|
|
2616
|
-
(0,
|
|
2403
|
+
(0, import_react12.useEffect)(() => {
|
|
2617
2404
|
if (error) {
|
|
2618
2405
|
submitPostMessage({
|
|
2619
2406
|
type: "RenderError",
|
|
@@ -2634,7 +2421,7 @@ var ErrorRender = /* @__PURE__ */ __name((props) => {
|
|
|
2634
2421
|
}, [
|
|
2635
2422
|
error
|
|
2636
2423
|
]);
|
|
2637
|
-
(0,
|
|
2424
|
+
(0, import_react12.useEffect)(() => {
|
|
2638
2425
|
if (!resetErrorBoundary) return;
|
|
2639
2426
|
const hmr = getHmrApi();
|
|
2640
2427
|
if (!hmr) return;
|
|
@@ -2649,27 +2436,27 @@ var ErrorRender = /* @__PURE__ */ __name((props) => {
|
|
|
2649
2436
|
}, [
|
|
2650
2437
|
resetErrorBoundary
|
|
2651
2438
|
]);
|
|
2652
|
-
return /* @__PURE__ */
|
|
2439
|
+
return /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2653
2440
|
className: "min-h-screen flex items-center justify-center bg-white"
|
|
2654
|
-
}, /* @__PURE__ */
|
|
2441
|
+
}, /* @__PURE__ */ import_react12.default.createElement("div", {
|
|
2655
2442
|
className: "flex flex-col justify-center items-center text-center"
|
|
2656
|
-
}, /* @__PURE__ */
|
|
2443
|
+
}, /* @__PURE__ */ import_react12.default.createElement("img", {
|
|
2657
2444
|
src: "https://lf3-static.bytednsdoc.com/obj/eden-cn/ylcylz_fsph_ryhs/ljhwZthlaukjlkulzlp/feisuda/template/illustration_empty_negative_error.svg",
|
|
2658
2445
|
alt: "render error",
|
|
2659
2446
|
className: "mb-3 w-[100px]"
|
|
2660
|
-
}), /* @__PURE__ */
|
|
2447
|
+
}), /* @__PURE__ */ import_react12.default.createElement("p", {
|
|
2661
2448
|
className: "text-l/[22px] text-[14px] text-[#1F2329] font-medium"
|
|
2662
2449
|
}, "\u9875\u9762\u51FA\u9519\u4E86")));
|
|
2663
2450
|
}, "ErrorRender");
|
|
2664
2451
|
var ErrorRender_default = ErrorRender;
|
|
2665
2452
|
|
|
2666
2453
|
// src/route-components/ActiveLink.tsx
|
|
2667
|
-
var
|
|
2454
|
+
var import_react13 = __toESM(require("react"), 1);
|
|
2668
2455
|
var import_react_router_dom2 = require("react-router-dom");
|
|
2669
|
-
var ActiveLink = /* @__PURE__ */ (0,
|
|
2670
|
-
const [currentHash, setCurrentHash] = (0,
|
|
2456
|
+
var ActiveLink = /* @__PURE__ */ (0, import_react13.forwardRef)(({ to, onClick, className, style, children, ...rest }, ref) => {
|
|
2457
|
+
const [currentHash, setCurrentHash] = (0, import_react13.useState)(() => typeof window !== "undefined" ? window.location.hash : "");
|
|
2671
2458
|
const isHashRoute = typeof to === "string" && to.startsWith("#");
|
|
2672
|
-
(0,
|
|
2459
|
+
(0, import_react13.useEffect)(() => {
|
|
2673
2460
|
if (!isHashRoute) return;
|
|
2674
2461
|
const handleHashChange = /* @__PURE__ */ __name(() => {
|
|
2675
2462
|
setCurrentHash(window.location.hash);
|
|
@@ -2681,7 +2468,7 @@ var ActiveLink = /* @__PURE__ */ (0, import_react14.forwardRef)(({ to, onClick,
|
|
|
2681
2468
|
]);
|
|
2682
2469
|
const isActive = isHashRoute && currentHash === to;
|
|
2683
2470
|
if (!isHashRoute) {
|
|
2684
|
-
return /* @__PURE__ */
|
|
2471
|
+
return /* @__PURE__ */ import_react13.default.createElement(import_react_router_dom2.NavLink, {
|
|
2685
2472
|
ref,
|
|
2686
2473
|
to,
|
|
2687
2474
|
onClick,
|
|
@@ -2722,7 +2509,7 @@ var ActiveLink = /* @__PURE__ */ (0, import_react14.forwardRef)(({ to, onClick,
|
|
|
2722
2509
|
isPending: false,
|
|
2723
2510
|
isTransitioning: false
|
|
2724
2511
|
}) : children;
|
|
2725
|
-
return /* @__PURE__ */
|
|
2512
|
+
return /* @__PURE__ */ import_react13.default.createElement("a", {
|
|
2726
2513
|
ref,
|
|
2727
2514
|
href: to,
|
|
2728
2515
|
onClick: handleHashClick,
|
|
@@ -2734,9 +2521,9 @@ var ActiveLink = /* @__PURE__ */ (0, import_react14.forwardRef)(({ to, onClick,
|
|
|
2734
2521
|
ActiveLink.displayName = "ActiveLink";
|
|
2735
2522
|
|
|
2736
2523
|
// src/route-components/NavLink.tsx
|
|
2737
|
-
var
|
|
2524
|
+
var React9 = __toESM(require("react"), 1);
|
|
2738
2525
|
var import_react_router_dom3 = require("react-router-dom");
|
|
2739
|
-
var NavLink2 = /* @__PURE__ */
|
|
2526
|
+
var NavLink2 = /* @__PURE__ */ React9.forwardRef(({ to, children, className, style, ...props }, ref) => {
|
|
2740
2527
|
const isHashLink = typeof to === "string" && to.startsWith("#");
|
|
2741
2528
|
const location = (0, import_react_router_dom3.useLocation)();
|
|
2742
2529
|
const navigate = (0, import_react_router_dom3.useNavigate)();
|
|
@@ -2760,7 +2547,7 @@ var NavLink2 = /* @__PURE__ */ React10.forwardRef(({ to, children, className, st
|
|
|
2760
2547
|
const resolvedClassName = typeof className === "function" ? className(renderProps) : className;
|
|
2761
2548
|
const resolvedStyle = typeof style === "function" ? style(renderProps) : style;
|
|
2762
2549
|
const { caseSensitive, end, replace, state, preventScrollReset, relative, viewTransition, ...restProps } = props;
|
|
2763
|
-
return /* @__PURE__ */
|
|
2550
|
+
return /* @__PURE__ */ React9.createElement("a", {
|
|
2764
2551
|
href: to,
|
|
2765
2552
|
onClick: handleClick,
|
|
2766
2553
|
ref,
|
|
@@ -2769,7 +2556,7 @@ var NavLink2 = /* @__PURE__ */ React10.forwardRef(({ to, children, className, st
|
|
|
2769
2556
|
...restProps
|
|
2770
2557
|
}, typeof children === "function" ? children(renderProps) : children);
|
|
2771
2558
|
}
|
|
2772
|
-
return /* @__PURE__ */
|
|
2559
|
+
return /* @__PURE__ */ React9.createElement(import_react_router_dom3.NavLink, {
|
|
2773
2560
|
to,
|
|
2774
2561
|
ref,
|
|
2775
2562
|
className,
|
|
@@ -2784,7 +2571,7 @@ var NavLink2 = /* @__PURE__ */ React10.forwardRef(({ to, children, className, st
|
|
|
2784
2571
|
NavLink2.displayName = "NavLink";
|
|
2785
2572
|
|
|
2786
2573
|
// src/route-components/UniversalLink.tsx
|
|
2787
|
-
var
|
|
2574
|
+
var import_react14 = __toESM(require("react"), 1);
|
|
2788
2575
|
var import_react_router_dom4 = require("react-router-dom");
|
|
2789
2576
|
function isInternalRoute(to) {
|
|
2790
2577
|
return !to.startsWith("#") && !to.startsWith("http://") && !to.startsWith("https://") && !to.startsWith("//");
|
|
@@ -2794,15 +2581,15 @@ function isExternalLink(to) {
|
|
|
2794
2581
|
return to.startsWith("http://") || to.startsWith("https://") || to.startsWith("//");
|
|
2795
2582
|
}
|
|
2796
2583
|
__name(isExternalLink, "isExternalLink");
|
|
2797
|
-
var UniversalLink = /* @__PURE__ */
|
|
2584
|
+
var UniversalLink = /* @__PURE__ */ import_react14.default.forwardRef(/* @__PURE__ */ __name(function UniversalLink2({ to, ...props }, ref) {
|
|
2798
2585
|
if (isInternalRoute(to)) {
|
|
2799
|
-
return /* @__PURE__ */
|
|
2586
|
+
return /* @__PURE__ */ import_react14.default.createElement(import_react_router_dom4.Link, {
|
|
2800
2587
|
to,
|
|
2801
2588
|
ref,
|
|
2802
2589
|
...props
|
|
2803
2590
|
});
|
|
2804
2591
|
}
|
|
2805
|
-
return /* @__PURE__ */
|
|
2592
|
+
return /* @__PURE__ */ import_react14.default.createElement("a", {
|
|
2806
2593
|
href: to,
|
|
2807
2594
|
ref,
|
|
2808
2595
|
...props,
|
|
@@ -3027,46 +2814,21 @@ function getAxiosForBackend() {
|
|
|
3027
2814
|
__name(getAxiosForBackend, "getAxiosForBackend");
|
|
3028
2815
|
var axiosForBackend = getAxiosForBackend();
|
|
3029
2816
|
|
|
3030
|
-
// src/utils/url.ts
|
|
3031
|
-
function splitWorkspaceUrl(fullUrl) {
|
|
3032
|
-
try {
|
|
3033
|
-
const url = new URL(fullUrl);
|
|
3034
|
-
const pathParts = url.pathname.split("/");
|
|
3035
|
-
const workspacesIndex = pathParts.findIndex((part) => part === "workspaces");
|
|
3036
|
-
if (workspacesIndex === -1) {
|
|
3037
|
-
throw new Error("Invalid workspace URL format");
|
|
3038
|
-
}
|
|
3039
|
-
const basePathParts = pathParts.slice(0, workspacesIndex);
|
|
3040
|
-
const workspace = pathParts[workspacesIndex + 1];
|
|
3041
|
-
return {
|
|
3042
|
-
baseUrl: `${url.origin}${basePathParts.join("/")}`,
|
|
3043
|
-
workspace
|
|
3044
|
-
};
|
|
3045
|
-
} catch (error) {
|
|
3046
|
-
console.error("Error splitting workspace URL:", error);
|
|
3047
|
-
}
|
|
3048
|
-
return {
|
|
3049
|
-
baseUrl: fullUrl,
|
|
3050
|
-
// 兜底给一个,不要给空字符串,不然 createClient 都直接挂了,页面会白屏,体感不太好
|
|
3051
|
-
workspace: "workspace"
|
|
3052
|
-
};
|
|
3053
|
-
}
|
|
3054
|
-
__name(splitWorkspaceUrl, "splitWorkspaceUrl");
|
|
3055
|
-
|
|
3056
2817
|
// src/integrations/dataloom.ts
|
|
3057
2818
|
var import_dataloom = require("@lark-apaas/dataloom");
|
|
3058
2819
|
var import_auth_sdk3 = require("@lark-apaas/auth-sdk");
|
|
3059
|
-
var createDataLoomClient = /* @__PURE__ */ __name((
|
|
3060
|
-
const { baseUrl } = url ? splitWorkspaceUrl(url) : {
|
|
3061
|
-
baseUrl: ""
|
|
3062
|
-
};
|
|
2820
|
+
var createDataLoomClient = /* @__PURE__ */ __name(() => {
|
|
3063
2821
|
const appId = getAppId() ?? "";
|
|
3064
|
-
return (0, import_dataloom.createClient)(
|
|
2822
|
+
return (0, import_dataloom.createClient)({
|
|
3065
2823
|
global: {
|
|
3066
2824
|
enableDataloomLog: process.env.NODE_ENV !== "production",
|
|
3067
2825
|
requestRateLimit: process.env.NODE_ENV !== "production" ? 100 : void 0,
|
|
3068
2826
|
brandName: "miaoda",
|
|
3069
2827
|
appId,
|
|
2828
|
+
// 同源网关下不会触发预检;CSRF token 仅用于 POST/PUT/DELETE 防护。
|
|
2829
|
+
headers: {
|
|
2830
|
+
"X-Suda-Csrf-Token": getCsrfToken() ?? ""
|
|
2831
|
+
},
|
|
3070
2832
|
accountServices: {
|
|
3071
2833
|
user: import_auth_sdk3.authClient.user,
|
|
3072
2834
|
session: import_auth_sdk3.authClient.session
|
|
@@ -3083,10 +2845,8 @@ function getDataloom() {
|
|
|
3083
2845
|
if (pendingPromise3) {
|
|
3084
2846
|
return pendingPromise3;
|
|
3085
2847
|
}
|
|
3086
|
-
pendingPromise3 = getInitialInfo().then((
|
|
3087
|
-
|
|
3088
|
-
const DATALOOM_PAT = info?.app_runtime_extra?.token;
|
|
3089
|
-
dataloom = createDataLoomClient(DATALOOM_CLIENT_URL, DATALOOM_PAT);
|
|
2848
|
+
pendingPromise3 = getInitialInfo().then(() => {
|
|
2849
|
+
dataloom = createDataLoomClient();
|
|
3090
2850
|
return dataloom;
|
|
3091
2851
|
}).finally(() => {
|
|
3092
2852
|
pendingPromise3 = null;
|