@rxdrag/website-studio 0.0.49 → 0.0.51
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/components/StatusBar/StopButton.d.ts +1 -1
- package/dist/components/common/ImportComponentModal/ImportComponentsTask.d.ts +23 -0
- package/dist/components/common/ImportComponentModal/useComponentsImportTask.d.ts +2 -4
- package/dist/{cssMode-b245dcc4.js → cssMode-a282f3f6.js} +2 -2
- package/dist/{cssMode-b245dcc4.js.map → cssMode-a282f3f6.js.map} +1 -1
- package/dist/{freemarker2-530ef1c5.js → freemarker2-f83d1246.js} +2 -2
- package/dist/{freemarker2-530ef1c5.js.map → freemarker2-f83d1246.js.map} +1 -1
- package/dist/{handlebars-bcc85b9a.js → handlebars-0a80f575.js} +2 -2
- package/dist/{handlebars-bcc85b9a.js.map → handlebars-0a80f575.js.map} +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useStopTask.d.ts +3 -0
- package/dist/hooks/useTranlateComponents.d.ts +1 -0
- package/dist/hooks/useTranslateRequest.d.ts +13 -0
- package/dist/{html-d6634f22.js → html-6a9d914d.js} +2 -2
- package/dist/{html-d6634f22.js.map → html-6a9d914d.js.map} +1 -1
- package/dist/{htmlMode-ba8f0a0a.js → htmlMode-9f16f56b.js} +2 -2
- package/dist/{htmlMode-ba8f0a0a.js.map → htmlMode-9f16f56b.js.map} +1 -1
- package/dist/{index-b7a393f5.js → index-310e120c.js} +447 -158
- package/dist/{index-b7a393f5.js.map → index-310e120c.js.map} +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{javascript-f4cdea9d.js → javascript-85b04aa6.js} +3 -3
- package/dist/{javascript-f4cdea9d.js.map → javascript-85b04aa6.js.map} +1 -1
- package/dist/{jsonMode-d1ffc4d7.js → jsonMode-61089a60.js} +2 -2
- package/dist/{jsonMode-d1ffc4d7.js.map → jsonMode-61089a60.js.map} +1 -1
- package/dist/{liquid-61fde33b.js → liquid-a45e3197.js} +2 -2
- package/dist/{liquid-61fde33b.js.map → liquid-a45e3197.js.map} +1 -1
- package/dist/{mdx-da1aa872.js → mdx-701cd16d.js} +2 -2
- package/dist/{mdx-da1aa872.js.map → mdx-701cd16d.js.map} +1 -1
- package/dist/{python-ac19bfb8.js → python-9e486ae7.js} +2 -2
- package/dist/{python-ac19bfb8.js.map → python-9e486ae7.js.map} +1 -1
- package/dist/{razor-31e1398a.js → razor-6bc3c261.js} +2 -2
- package/dist/{razor-31e1398a.js.map → razor-6bc3c261.js.map} +1 -1
- package/dist/{tsMode-1dd13bfc.js → tsMode-f84b3afc.js} +2 -2
- package/dist/{tsMode-1dd13bfc.js.map → tsMode-f84b3afc.js.map} +1 -1
- package/dist/{typescript-6541a5f9.js → typescript-d99b2a48.js} +2 -2
- package/dist/{typescript-6541a5f9.js.map → typescript-d99b2a48.js.map} +1 -1
- package/dist/{xml-c8d528af.js → xml-a116de23.js} +2 -2
- package/dist/{xml-c8d528af.js.map → xml-a116de23.js.map} +1 -1
- package/dist/{yaml-9d155394.js → yaml-331a88a9.js} +2 -2
- package/dist/{yaml-9d155394.js.map → yaml-331a88a9.js.map} +1 -1
- package/package.json +14 -14
|
@@ -24,7 +24,7 @@ import { ErrorBoundary, ColorPicker, useSave, CheckCircleIcon as CheckCircleIcon
|
|
|
24
24
|
import { PageLoader, PopoverController, ModalController, AnimateController, TabsController, NumberController, FlipController, CollapseController, AosController } from "@rxdrag/website-lib-core";
|
|
25
25
|
import gsap$2 from "gsap";
|
|
26
26
|
import { Input, Textarea, StringArrayInput, ImageSelect, TargetSetter, propSetters, DeviceBreakpoints, DeviceContext } from "@rxdrag/schema-setters";
|
|
27
|
-
import { Switch, Card, CardBody, Button as Button$2, CircularProgress, CardHeader, Select, SelectItem, Dropdown, DropdownTrigger, DropdownMenu as DropdownMenu$1, DropdownItem, Accordion, AccordionItem, Input as Input$1, Tabs, Tab, Divider, cn, Checkbox, Chip, Skeleton, CardFooter, Image, useDisclosure, Modal as Modal$2, ModalContent as ModalContent$2, ModalHeader as ModalHeader$1, ModalBody as ModalBody$1, RadioGroup, ModalFooter as ModalFooter$1, Radio, Popover, PopoverTrigger, PopoverContent } from "@heroui/react";
|
|
27
|
+
import { Switch, Card, CardBody, Button as Button$2, CircularProgress, addToast, CardHeader, Select, SelectItem, Dropdown, DropdownTrigger, DropdownMenu as DropdownMenu$1, DropdownItem, Accordion, AccordionItem, Input as Input$1, Tabs, Tab, Divider, cn, Checkbox, Chip, Skeleton, CardFooter, Image, useDisclosure, Modal as Modal$2, ModalContent as ModalContent$2, ModalHeader as ModalHeader$1, ModalBody as ModalBody$1, RadioGroup, ModalFooter as ModalFooter$1, Radio, Popover, PopoverTrigger, PopoverContent } from "@heroui/react";
|
|
28
28
|
import { useEntifyWrapperStore, useUpsertEntityWithIndicator } from "@rxdrag/rxcms-entify-wrapper";
|
|
29
29
|
import JSZip from "jszip";
|
|
30
30
|
import { create as create$4 } from "zustand";
|
|
@@ -39,7 +39,7 @@ import $4AOtR$reactdom, { createPortal } from "react-dom";
|
|
|
39
39
|
import { DeployType, useExportWebsite as useExportWebsite$1 } from "@rxdrag/code-generator";
|
|
40
40
|
import { ComponentRender } from "@rxdrag/react-runner-pro";
|
|
41
41
|
import tinycolor from "tinycolor2";
|
|
42
|
-
import { useInprogressTaskByKey, useUpdateTask, taskPool, ResetPageTask, ImportPagesTask
|
|
42
|
+
import { useInprogressTaskByKey, useUpdateTask, taskPool, ResetPageTask, ImportPagesTask } from "@rxdrag/ai-tasks";
|
|
43
43
|
var jsxRuntime = { exports: {} };
|
|
44
44
|
var reactJsxRuntime_production_min = {};
|
|
45
45
|
/**
|
|
@@ -6725,48 +6725,169 @@ function useIsBaseLangTheme() {
|
|
|
6725
6725
|
const website = useWebsite();
|
|
6726
6726
|
return ((_a3 = theme == null ? void 0 : theme.lang) == null ? void 0 : _a3.id) === ((_b3 = website == null ? void 0 : website.baseLang) == null ? void 0 : _b3.id);
|
|
6727
6727
|
}
|
|
6728
|
-
function
|
|
6728
|
+
function useTranslateRequest() {
|
|
6729
6729
|
const baseURL = useAiUrl();
|
|
6730
6730
|
const token = useEntifyToken();
|
|
6731
6731
|
const website = useWebsite();
|
|
6732
|
+
const isAxiosError = useCallback((err) => {
|
|
6733
|
+
return typeof err === "object" && err !== null;
|
|
6734
|
+
}, []);
|
|
6735
|
+
const validateBaseParams = useCallback((langId) => {
|
|
6736
|
+
if (!(langId == null ? void 0 : langId.trim())) {
|
|
6737
|
+
throw new Error("语言ID不能为空");
|
|
6738
|
+
}
|
|
6739
|
+
if (!token) {
|
|
6740
|
+
throw new Error("用户未登录或token已过期");
|
|
6741
|
+
}
|
|
6742
|
+
if (!(website == null ? void 0 : website.id)) {
|
|
6743
|
+
throw new Error("未找到网站信息");
|
|
6744
|
+
}
|
|
6745
|
+
if (!baseURL) {
|
|
6746
|
+
throw new Error("AI服务URL未配置");
|
|
6747
|
+
}
|
|
6748
|
+
}, [token, website == null ? void 0 : website.id, baseURL]);
|
|
6749
|
+
const extractErrorMessage = useCallback((responseData) => {
|
|
6750
|
+
if (!responseData)
|
|
6751
|
+
return "翻译请求失败";
|
|
6752
|
+
if (typeof responseData === "string") {
|
|
6753
|
+
return responseData;
|
|
6754
|
+
}
|
|
6755
|
+
if (typeof responseData === "object" && responseData !== null) {
|
|
6756
|
+
const data = responseData;
|
|
6757
|
+
return data.error || data.message || data.msg || "翻译请求失败";
|
|
6758
|
+
}
|
|
6759
|
+
return "翻译请求失败";
|
|
6760
|
+
}, []);
|
|
6761
|
+
const getStatusErrorMessage = useCallback((status2) => {
|
|
6762
|
+
switch (status2) {
|
|
6763
|
+
case 400:
|
|
6764
|
+
return "请求参数错误";
|
|
6765
|
+
case 401:
|
|
6766
|
+
return "认证失败,请重新登录";
|
|
6767
|
+
case 403:
|
|
6768
|
+
return "没有权限执行此操作";
|
|
6769
|
+
case 404:
|
|
6770
|
+
return "翻译服务不存在";
|
|
6771
|
+
case 429:
|
|
6772
|
+
return "请求过于频繁,请稍后再试";
|
|
6773
|
+
case 500:
|
|
6774
|
+
return "服务器内部错误";
|
|
6775
|
+
case 502:
|
|
6776
|
+
case 503:
|
|
6777
|
+
case 504:
|
|
6778
|
+
return "服务暂时不可用,请稍后再试";
|
|
6779
|
+
default:
|
|
6780
|
+
return `请求失败 (${status2})`;
|
|
6781
|
+
}
|
|
6782
|
+
}, []);
|
|
6783
|
+
const handleError = useCallback((error, context) => {
|
|
6784
|
+
var _a3, _b3;
|
|
6785
|
+
if (isAxiosError(error) && (error.code === "NETWORK_ERROR" || ((_a3 = error.message) == null ? void 0 : _a3.includes("fetch")))) {
|
|
6786
|
+
console.error(`${context}网络错误:`, error);
|
|
6787
|
+
throw new Error("网络连接失败,请检查网络连接");
|
|
6788
|
+
}
|
|
6789
|
+
if (isAxiosError(error) && ((_b3 = error.response) == null ? void 0 : _b3.status)) {
|
|
6790
|
+
const status2 = error.response.status;
|
|
6791
|
+
const responseData = error.response.data;
|
|
6792
|
+
let errorMsg2 = extractErrorMessage(responseData);
|
|
6793
|
+
if (errorMsg2 === "翻译请求失败") {
|
|
6794
|
+
errorMsg2 = getStatusErrorMessage(status2);
|
|
6795
|
+
}
|
|
6796
|
+
console.error(`${context}HTTP错误:`, {
|
|
6797
|
+
status: status2,
|
|
6798
|
+
statusText: error.response.statusText,
|
|
6799
|
+
responseData,
|
|
6800
|
+
error
|
|
6801
|
+
});
|
|
6802
|
+
throw new Error(errorMsg2);
|
|
6803
|
+
}
|
|
6804
|
+
const errorMsg = isAxiosError(error) && error.message ? error.message : "翻译过程中发生未知错误";
|
|
6805
|
+
console.error(`${context}未知错误:`, error);
|
|
6806
|
+
throw new Error(errorMsg);
|
|
6807
|
+
}, [isAxiosError, extractErrorMessage, getStatusErrorMessage]);
|
|
6808
|
+
const translateRequest = useCallback(
|
|
6809
|
+
async (endpoint, params, options) => {
|
|
6810
|
+
validateBaseParams(params.langId);
|
|
6811
|
+
if (options == null ? void 0 : options.validateParams) {
|
|
6812
|
+
options.validateParams(params);
|
|
6813
|
+
}
|
|
6814
|
+
try {
|
|
6815
|
+
const http = createHttpClient({ baseURL, token });
|
|
6816
|
+
const websiteId = website.id;
|
|
6817
|
+
const requestParams = (options == null ? void 0 : options.transformParams) ? options.transformParams(params, websiteId) : {
|
|
6818
|
+
websiteId,
|
|
6819
|
+
...params,
|
|
6820
|
+
langId: params.langId.trim()
|
|
6821
|
+
};
|
|
6822
|
+
const response = await http.post(endpoint, requestParams);
|
|
6823
|
+
return response;
|
|
6824
|
+
} catch (error) {
|
|
6825
|
+
handleError(error, "翻译");
|
|
6826
|
+
}
|
|
6827
|
+
},
|
|
6828
|
+
[baseURL, token, website, validateBaseParams, handleError]
|
|
6829
|
+
);
|
|
6830
|
+
return translateRequest;
|
|
6831
|
+
}
|
|
6832
|
+
function useTranslateTheme() {
|
|
6833
|
+
const translateRequest = useTranslateRequest();
|
|
6732
6834
|
const translate = useCallback(
|
|
6733
6835
|
async (langId, title) => {
|
|
6836
|
+
return await translateRequest(
|
|
6837
|
+
"/api/studio/translate-theme",
|
|
6838
|
+
{ langId, title },
|
|
6839
|
+
{
|
|
6840
|
+
validateParams: (params) => {
|
|
6841
|
+
const { title: title2 } = params;
|
|
6842
|
+
if (!(title2 == null ? void 0 : title2.trim())) {
|
|
6843
|
+
throw new Error("标题不能为空");
|
|
6844
|
+
}
|
|
6845
|
+
},
|
|
6846
|
+
transformParams: (params, websiteId) => ({
|
|
6847
|
+
websiteId,
|
|
6848
|
+
langId: params.langId.trim(),
|
|
6849
|
+
title: params.title.trim()
|
|
6850
|
+
})
|
|
6851
|
+
}
|
|
6852
|
+
);
|
|
6853
|
+
},
|
|
6854
|
+
[translateRequest]
|
|
6855
|
+
);
|
|
6856
|
+
return translate;
|
|
6857
|
+
}
|
|
6858
|
+
function useStopTask() {
|
|
6859
|
+
const baseURL = useAiUrl();
|
|
6860
|
+
const token = useEntifyToken();
|
|
6861
|
+
const [isMutating, setIsMutating] = useState(false);
|
|
6862
|
+
const stopTask = useCallback(
|
|
6863
|
+
async (taskId) => {
|
|
6734
6864
|
var _a3, _b3;
|
|
6735
|
-
if (!(
|
|
6736
|
-
throw new Error("
|
|
6737
|
-
}
|
|
6738
|
-
if (!(title == null ? void 0 : title.trim())) {
|
|
6739
|
-
throw new Error("标题不能为空");
|
|
6865
|
+
if (!(taskId == null ? void 0 : taskId.trim())) {
|
|
6866
|
+
throw new Error("任务ID不能为空");
|
|
6740
6867
|
}
|
|
6741
6868
|
if (!token) {
|
|
6742
6869
|
throw new Error("用户未登录或token已过期");
|
|
6743
6870
|
}
|
|
6744
|
-
if (!(website == null ? void 0 : website.id)) {
|
|
6745
|
-
throw new Error("未找到网站信息");
|
|
6746
|
-
}
|
|
6747
6871
|
if (!baseURL) {
|
|
6748
6872
|
throw new Error("AI服务URL未配置");
|
|
6749
6873
|
}
|
|
6750
6874
|
try {
|
|
6875
|
+
setIsMutating(true);
|
|
6751
6876
|
const http = createHttpClient({ baseURL, token });
|
|
6752
|
-
const response = await http.post(
|
|
6753
|
-
websiteId: website.id,
|
|
6754
|
-
langId: langId.trim(),
|
|
6755
|
-
title: title.trim()
|
|
6756
|
-
});
|
|
6877
|
+
const response = await http.post(`/api/stop-task/${taskId.trim()}`);
|
|
6757
6878
|
return response;
|
|
6758
6879
|
} catch (error) {
|
|
6759
6880
|
const isAxiosError = (err) => {
|
|
6760
6881
|
return typeof err === "object" && err !== null;
|
|
6761
6882
|
};
|
|
6762
6883
|
if (isAxiosError(error) && (error.code === "NETWORK_ERROR" || ((_a3 = error.message) == null ? void 0 : _a3.includes("fetch")))) {
|
|
6763
|
-
console.error("
|
|
6884
|
+
console.error("停止任务网络错误:", error);
|
|
6764
6885
|
throw new Error("网络连接失败,请检查网络连接");
|
|
6765
6886
|
}
|
|
6766
6887
|
if (isAxiosError(error) && ((_b3 = error.response) == null ? void 0 : _b3.status)) {
|
|
6767
6888
|
const status2 = error.response.status;
|
|
6768
6889
|
const responseData = error.response.data;
|
|
6769
|
-
let errorMsg2 = "
|
|
6890
|
+
let errorMsg2 = "停止任务失败";
|
|
6770
6891
|
if (responseData) {
|
|
6771
6892
|
if (typeof responseData === "string") {
|
|
6772
6893
|
errorMsg2 = responseData;
|
|
@@ -6778,7 +6899,7 @@ function useTranslateTheme() {
|
|
|
6778
6899
|
errorMsg2 = responseData.msg;
|
|
6779
6900
|
}
|
|
6780
6901
|
}
|
|
6781
|
-
if (errorMsg2 === "
|
|
6902
|
+
if (errorMsg2 === "停止任务失败") {
|
|
6782
6903
|
switch (status2) {
|
|
6783
6904
|
case 400:
|
|
6784
6905
|
errorMsg2 = "请求参数错误";
|
|
@@ -6790,7 +6911,7 @@ function useTranslateTheme() {
|
|
|
6790
6911
|
errorMsg2 = "没有权限执行此操作";
|
|
6791
6912
|
break;
|
|
6792
6913
|
case 404:
|
|
6793
|
-
errorMsg2 = "
|
|
6914
|
+
errorMsg2 = "任务不存在或已完成";
|
|
6794
6915
|
break;
|
|
6795
6916
|
case 429:
|
|
6796
6917
|
errorMsg2 = "请求过于频繁,请稍后再试";
|
|
@@ -6807,7 +6928,7 @@ function useTranslateTheme() {
|
|
|
6807
6928
|
errorMsg2 = `请求失败 (${status2})`;
|
|
6808
6929
|
}
|
|
6809
6930
|
}
|
|
6810
|
-
console.error("
|
|
6931
|
+
console.error("停止任务HTTP错误:", {
|
|
6811
6932
|
status: status2,
|
|
6812
6933
|
statusText: error.response.statusText,
|
|
6813
6934
|
responseData,
|
|
@@ -6815,14 +6936,16 @@ function useTranslateTheme() {
|
|
|
6815
6936
|
});
|
|
6816
6937
|
throw new Error(errorMsg2);
|
|
6817
6938
|
}
|
|
6818
|
-
const errorMsg = isAxiosError(error) && error.message ? error.message : "
|
|
6819
|
-
console.error("
|
|
6939
|
+
const errorMsg = isAxiosError(error) && error.message ? error.message : "停止任务过程中发生未知错误";
|
|
6940
|
+
console.error("停止任务未知错误:", error);
|
|
6820
6941
|
throw new Error(errorMsg);
|
|
6942
|
+
} finally {
|
|
6943
|
+
setIsMutating(false);
|
|
6821
6944
|
}
|
|
6822
6945
|
},
|
|
6823
|
-
[baseURL, token
|
|
6946
|
+
[baseURL, token]
|
|
6824
6947
|
);
|
|
6825
|
-
return
|
|
6948
|
+
return [stopTask, { isMutating }];
|
|
6826
6949
|
}
|
|
6827
6950
|
const linkTypes = [
|
|
6828
6951
|
{
|
|
@@ -6895,8 +7018,6 @@ function MultiLangPanel() {
|
|
|
6895
7018
|
const [linkType, setLinkType] = useState("subdomain");
|
|
6896
7019
|
const [confirmOpen, setConfirmOpen] = useState(false);
|
|
6897
7020
|
const [currentLangId, setCurrentLangId] = useCurrentLangId();
|
|
6898
|
-
const setError = useEntifyWrapperStore((state) => state.setGlobalError);
|
|
6899
|
-
const setSuccess = useEntifyWrapperStore((state) => state.setGlobalSuccess);
|
|
6900
7021
|
const tasksNotDone = useTasksNotDone();
|
|
6901
7022
|
const lastTask = useStudioStore((state) => state.lastedTaskEvent);
|
|
6902
7023
|
const selectedContent = useStudioStore((state) => state.selectedContent);
|
|
@@ -7024,13 +7145,19 @@ function MultiLangPanel() {
|
|
|
7024
7145
|
const title = `网站代码翻译到:${(lang == null ? void 0 : lang.cnName) || (lang == null ? void 0 : lang.enName) || (lang == null ? void 0 : lang.localName) || (lang == null ? void 0 : lang.abbr) || ""}`;
|
|
7025
7146
|
const task2 = await translateTheme(currentLangId, title);
|
|
7026
7147
|
setTask(task2);
|
|
7027
|
-
|
|
7148
|
+
addToast({
|
|
7149
|
+
title: "翻译任务已提交",
|
|
7150
|
+
color: "success"
|
|
7151
|
+
});
|
|
7028
7152
|
} catch (error) {
|
|
7029
7153
|
console.error("翻译主题失败:", error);
|
|
7030
7154
|
const errorString = error instanceof Error ? error.message : String(error);
|
|
7031
|
-
|
|
7155
|
+
addToast({
|
|
7156
|
+
title: errorString,
|
|
7157
|
+
color: "danger"
|
|
7158
|
+
});
|
|
7032
7159
|
}
|
|
7033
|
-
}, [currentLangId, allLangs == null ? void 0 : allLangs.items, translateTheme
|
|
7160
|
+
}, [currentLangId, allLangs == null ? void 0 : allLangs.items, translateTheme]);
|
|
7034
7161
|
const isRunning = (task == null ? void 0 : task.status) === TaskStatus.B_Pending || (task == null ? void 0 : task.status) === TaskStatus.A_Progress;
|
|
7035
7162
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
7036
7163
|
/* @__PURE__ */ jsxRuntimeExports.jsx(ModalBody, { className: "flex-1 p-4 min-h-0 overflow-auto", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
@@ -138390,7 +138517,7 @@ registerLanguage({
|
|
|
138390
138517
|
aliases: ["FreeMarker2", "Apache FreeMarker2"],
|
|
138391
138518
|
loader: () => {
|
|
138392
138519
|
{
|
|
138393
|
-
return import("./freemarker2-
|
|
138520
|
+
return import("./freemarker2-f83d1246.js").then((m2) => m2.TagAutoInterpolationDollar);
|
|
138394
138521
|
}
|
|
138395
138522
|
}
|
|
138396
138523
|
});
|
|
@@ -138399,7 +138526,7 @@ registerLanguage({
|
|
|
138399
138526
|
aliases: ["FreeMarker2 (Angle/Dollar)", "Apache FreeMarker2 (Angle/Dollar)"],
|
|
138400
138527
|
loader: () => {
|
|
138401
138528
|
{
|
|
138402
|
-
return import("./freemarker2-
|
|
138529
|
+
return import("./freemarker2-f83d1246.js").then((m2) => m2.TagAngleInterpolationDollar);
|
|
138403
138530
|
}
|
|
138404
138531
|
}
|
|
138405
138532
|
});
|
|
@@ -138408,7 +138535,7 @@ registerLanguage({
|
|
|
138408
138535
|
aliases: ["FreeMarker2 (Bracket/Dollar)", "Apache FreeMarker2 (Bracket/Dollar)"],
|
|
138409
138536
|
loader: () => {
|
|
138410
138537
|
{
|
|
138411
|
-
return import("./freemarker2-
|
|
138538
|
+
return import("./freemarker2-f83d1246.js").then((m2) => m2.TagBracketInterpolationDollar);
|
|
138412
138539
|
}
|
|
138413
138540
|
}
|
|
138414
138541
|
});
|
|
@@ -138417,7 +138544,7 @@ registerLanguage({
|
|
|
138417
138544
|
aliases: ["FreeMarker2 (Angle/Bracket)", "Apache FreeMarker2 (Angle/Bracket)"],
|
|
138418
138545
|
loader: () => {
|
|
138419
138546
|
{
|
|
138420
|
-
return import("./freemarker2-
|
|
138547
|
+
return import("./freemarker2-f83d1246.js").then((m2) => m2.TagAngleInterpolationBracket);
|
|
138421
138548
|
}
|
|
138422
138549
|
}
|
|
138423
138550
|
});
|
|
@@ -138426,7 +138553,7 @@ registerLanguage({
|
|
|
138426
138553
|
aliases: ["FreeMarker2 (Bracket/Bracket)", "Apache FreeMarker2 (Bracket/Bracket)"],
|
|
138427
138554
|
loader: () => {
|
|
138428
138555
|
{
|
|
138429
|
-
return import("./freemarker2-
|
|
138556
|
+
return import("./freemarker2-f83d1246.js").then((m2) => m2.TagBracketInterpolationBracket);
|
|
138430
138557
|
}
|
|
138431
138558
|
}
|
|
138432
138559
|
});
|
|
@@ -138435,7 +138562,7 @@ registerLanguage({
|
|
|
138435
138562
|
aliases: ["FreeMarker2 (Auto/Dollar)", "Apache FreeMarker2 (Auto/Dollar)"],
|
|
138436
138563
|
loader: () => {
|
|
138437
138564
|
{
|
|
138438
|
-
return import("./freemarker2-
|
|
138565
|
+
return import("./freemarker2-f83d1246.js").then((m2) => m2.TagAutoInterpolationDollar);
|
|
138439
138566
|
}
|
|
138440
138567
|
}
|
|
138441
138568
|
});
|
|
@@ -138444,7 +138571,7 @@ registerLanguage({
|
|
|
138444
138571
|
aliases: ["FreeMarker2 (Auto/Bracket)", "Apache FreeMarker2 (Auto/Bracket)"],
|
|
138445
138572
|
loader: () => {
|
|
138446
138573
|
{
|
|
138447
|
-
return import("./freemarker2-
|
|
138574
|
+
return import("./freemarker2-f83d1246.js").then((m2) => m2.TagAutoInterpolationBracket);
|
|
138448
138575
|
}
|
|
138449
138576
|
}
|
|
138450
138577
|
});
|
|
@@ -138494,7 +138621,7 @@ registerLanguage({
|
|
|
138494
138621
|
mimetypes: ["text/x-handlebars-template"],
|
|
138495
138622
|
loader: () => {
|
|
138496
138623
|
{
|
|
138497
|
-
return import("./handlebars-
|
|
138624
|
+
return import("./handlebars-0a80f575.js");
|
|
138498
138625
|
}
|
|
138499
138626
|
}
|
|
138500
138627
|
});
|
|
@@ -138527,7 +138654,7 @@ registerLanguage({
|
|
|
138527
138654
|
mimetypes: ["text/html", "text/x-jshtm", "text/template", "text/ng-template"],
|
|
138528
138655
|
loader: () => {
|
|
138529
138656
|
{
|
|
138530
|
-
return import("./html-
|
|
138657
|
+
return import("./html-6a9d914d.js");
|
|
138531
138658
|
}
|
|
138532
138659
|
}
|
|
138533
138660
|
});
|
|
@@ -138580,7 +138707,7 @@ registerLanguage({
|
|
|
138580
138707
|
mimetypes: ["text/javascript"],
|
|
138581
138708
|
loader: () => {
|
|
138582
138709
|
{
|
|
138583
|
-
return import("./javascript-
|
|
138710
|
+
return import("./javascript-85b04aa6.js");
|
|
138584
138711
|
}
|
|
138585
138712
|
}
|
|
138586
138713
|
});
|
|
@@ -138679,7 +138806,7 @@ registerLanguage({
|
|
|
138679
138806
|
mimetypes: ["application/liquid"],
|
|
138680
138807
|
loader: () => {
|
|
138681
138808
|
{
|
|
138682
|
-
return import("./liquid-
|
|
138809
|
+
return import("./liquid-a45e3197.js");
|
|
138683
138810
|
}
|
|
138684
138811
|
}
|
|
138685
138812
|
});
|
|
@@ -138727,7 +138854,7 @@ registerLanguage({
|
|
|
138727
138854
|
aliases: ["MDX", "mdx"],
|
|
138728
138855
|
loader: () => {
|
|
138729
138856
|
{
|
|
138730
|
-
return import("./mdx-
|
|
138857
|
+
return import("./mdx-701cd16d.js");
|
|
138731
138858
|
}
|
|
138732
138859
|
}
|
|
138733
138860
|
});
|
|
@@ -138986,7 +139113,7 @@ registerLanguage({
|
|
|
138986
139113
|
firstLine: "^#!/.*\\bpython[0-9.-]*\\b",
|
|
138987
139114
|
loader: () => {
|
|
138988
139115
|
{
|
|
138989
|
-
return import("./python-
|
|
139116
|
+
return import("./python-9e486ae7.js");
|
|
138990
139117
|
}
|
|
138991
139118
|
}
|
|
138992
139119
|
});
|
|
@@ -139035,7 +139162,7 @@ registerLanguage({
|
|
|
139035
139162
|
mimetypes: ["text/x-cshtml"],
|
|
139036
139163
|
loader: () => {
|
|
139037
139164
|
{
|
|
139038
|
-
return import("./razor-
|
|
139165
|
+
return import("./razor-6bc3c261.js");
|
|
139039
139166
|
}
|
|
139040
139167
|
}
|
|
139041
139168
|
});
|
|
@@ -139371,7 +139498,7 @@ registerLanguage({
|
|
|
139371
139498
|
mimetypes: ["text/typescript"],
|
|
139372
139499
|
loader: () => {
|
|
139373
139500
|
{
|
|
139374
|
-
return import("./typescript-
|
|
139501
|
+
return import("./typescript-d99b2a48.js");
|
|
139375
139502
|
}
|
|
139376
139503
|
}
|
|
139377
139504
|
});
|
|
@@ -139455,7 +139582,7 @@ registerLanguage({
|
|
|
139455
139582
|
mimetypes: ["text/xml", "application/xml", "application/xaml+xml", "application/xml-dtd"],
|
|
139456
139583
|
loader: () => {
|
|
139457
139584
|
{
|
|
139458
|
-
return import("./xml-
|
|
139585
|
+
return import("./xml-a116de23.js");
|
|
139459
139586
|
}
|
|
139460
139587
|
}
|
|
139461
139588
|
});
|
|
@@ -139472,7 +139599,7 @@ registerLanguage({
|
|
|
139472
139599
|
mimetypes: ["application/x-yaml", "text/x-yaml"],
|
|
139473
139600
|
loader: () => {
|
|
139474
139601
|
{
|
|
139475
|
-
return import("./yaml-
|
|
139602
|
+
return import("./yaml-331a88a9.js");
|
|
139476
139603
|
}
|
|
139477
139604
|
}
|
|
139478
139605
|
});
|
|
@@ -139596,7 +139723,7 @@ var lessDefaults = new LanguageServiceDefaultsImpl$3(
|
|
|
139596
139723
|
monaco_editor_core_exports$3.languages.css = { cssDefaults, lessDefaults, scssDefaults };
|
|
139597
139724
|
function getMode$3() {
|
|
139598
139725
|
{
|
|
139599
|
-
return import("./cssMode-
|
|
139726
|
+
return import("./cssMode-a282f3f6.js");
|
|
139600
139727
|
}
|
|
139601
139728
|
}
|
|
139602
139729
|
monaco_editor_core_exports$3.languages.onLanguage("less", () => {
|
|
@@ -139727,7 +139854,7 @@ monaco_editor_core_exports$2.languages.html = {
|
|
|
139727
139854
|
};
|
|
139728
139855
|
function getMode$2() {
|
|
139729
139856
|
{
|
|
139730
|
-
return import("./htmlMode-
|
|
139857
|
+
return import("./htmlMode-9f16f56b.js");
|
|
139731
139858
|
}
|
|
139732
139859
|
}
|
|
139733
139860
|
function registerHTMLLanguageService(languageId, options = optionsDefault, modeConfiguration = getConfigurationDefault(languageId)) {
|
|
@@ -139825,7 +139952,7 @@ var getWorker = () => getMode$1().then((mode) => mode.getWorker());
|
|
|
139825
139952
|
monaco_editor_core_exports$1.languages.json = { jsonDefaults, getWorker };
|
|
139826
139953
|
function getMode$1() {
|
|
139827
139954
|
{
|
|
139828
|
-
return import("./jsonMode-
|
|
139955
|
+
return import("./jsonMode-61089a60.js");
|
|
139829
139956
|
}
|
|
139830
139957
|
}
|
|
139831
139958
|
monaco_editor_core_exports$1.languages.register({
|
|
@@ -140101,7 +140228,7 @@ monaco_editor_core_exports.languages.typescript = {
|
|
|
140101
140228
|
};
|
|
140102
140229
|
function getMode() {
|
|
140103
140230
|
{
|
|
140104
|
-
return import("./tsMode-
|
|
140231
|
+
return import("./tsMode-f84b3afc.js");
|
|
140105
140232
|
}
|
|
140106
140233
|
}
|
|
140107
140234
|
monaco_editor_core_exports.languages.onLanguage("typescript", () => {
|
|
@@ -198625,21 +198752,35 @@ const RightPanel = memo(() => {
|
|
|
198625
198752
|
});
|
|
198626
198753
|
const StopButton = forwardRef$2(
|
|
198627
198754
|
(props, ref2) => {
|
|
198628
|
-
const { confirm,
|
|
198755
|
+
const { confirm, taskId, ...rest } = props;
|
|
198629
198756
|
const [open, setOpen] = useState(false);
|
|
198757
|
+
const [stopTask, { isMutating }] = useStopTask();
|
|
198630
198758
|
const handleClick = useCallback(() => {
|
|
198631
198759
|
if (confirm) {
|
|
198632
198760
|
setOpen(true);
|
|
198633
198761
|
} else {
|
|
198634
|
-
|
|
198762
|
+
if (taskId) {
|
|
198763
|
+
stopTask(taskId);
|
|
198764
|
+
}
|
|
198635
198765
|
}
|
|
198636
|
-
}, [confirm,
|
|
198766
|
+
}, [confirm, stopTask, taskId]);
|
|
198637
198767
|
const handleConfirm = useCallback(() => {
|
|
198638
|
-
|
|
198768
|
+
if (taskId) {
|
|
198769
|
+
stopTask(taskId);
|
|
198770
|
+
}
|
|
198639
198771
|
setOpen(false);
|
|
198640
|
-
}, [
|
|
198772
|
+
}, [stopTask, taskId]);
|
|
198641
198773
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
198642
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(StyledTooltip, { content: "停止任务", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
198774
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(StyledTooltip, { content: "停止任务", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
198775
|
+
Button$2,
|
|
198776
|
+
{
|
|
198777
|
+
ref: ref2,
|
|
198778
|
+
isDisabled: !taskId,
|
|
198779
|
+
onPress: handleClick,
|
|
198780
|
+
loading: isMutating,
|
|
198781
|
+
...rest
|
|
198782
|
+
}
|
|
198783
|
+
) }),
|
|
198643
198784
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
198644
198785
|
ConfirmDialog,
|
|
198645
198786
|
{
|
|
@@ -198670,14 +198811,14 @@ function TaskTable() {
|
|
|
198670
198811
|
{
|
|
198671
198812
|
className: cn(
|
|
198672
198813
|
"flex items-center gap-2",
|
|
198673
|
-
(row == null ? void 0 : row.status) === TaskStatus.
|
|
198814
|
+
(row == null ? void 0 : row.status) === TaskStatus.E_Success && "opacity-70"
|
|
198674
198815
|
),
|
|
198675
198816
|
children: [
|
|
198676
198817
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
|
|
198677
198818
|
(row == null ? void 0 : row.status) === TaskStatus.A_Progress && /* @__PURE__ */ jsxRuntimeExports.jsx(TaskIcon, { className: "size-5 text-primary" }),
|
|
198678
198819
|
(row == null ? void 0 : row.status) === TaskStatus.C_Failure && /* @__PURE__ */ jsxRuntimeExports.jsx(TaskErrorIcon, { className: "size-5 text-danger" }),
|
|
198679
198820
|
(row == null ? void 0 : row.status) === TaskStatus.B_Pending && /* @__PURE__ */ jsxRuntimeExports.jsx(TaskSuspendIcon, { className: "size-5" }),
|
|
198680
|
-
(row == null ? void 0 : row.status) === TaskStatus.
|
|
198821
|
+
(row == null ? void 0 : row.status) === TaskStatus.E_Success && /* @__PURE__ */ jsxRuntimeExports.jsx(TaskSuccessIcon, { className: "size-5" })
|
|
198681
198822
|
] }),
|
|
198682
198823
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col", children: [
|
|
198683
198824
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cn("text-sm"), children: text2 }),
|
|
@@ -198773,7 +198914,7 @@ function TaskTable() {
|
|
|
198773
198914
|
width: 80,
|
|
198774
198915
|
title: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full text-center", children: "操作" }),
|
|
198775
198916
|
cellRender: (text2, row) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-0.5 items-center", children: [
|
|
198776
|
-
(row == null ? void 0 : row.status) === TaskStatus.A_Progress && /* @__PURE__ */ jsxRuntimeExports.jsx(StopButton, { isIconOnly: true, size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(StopOutlineIcon, { className: "size-4 text-default-500" }) }),
|
|
198917
|
+
(row == null ? void 0 : row.status) === TaskStatus.A_Progress && /* @__PURE__ */ jsxRuntimeExports.jsx(StopButton, { taskId: row.id, isIconOnly: true, size: "sm", variant: "light", children: /* @__PURE__ */ jsxRuntimeExports.jsx(StopOutlineIcon, { className: "size-4 text-default-500" }) }),
|
|
198777
198918
|
(row == null ? void 0 : row.status) !== TaskStatus.A_Progress && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
198778
198919
|
RemoveButton,
|
|
198779
198920
|
{
|
|
@@ -198910,6 +199051,33 @@ function StatusBar({ doc }) {
|
|
|
198910
199051
|
requested: event,
|
|
198911
199052
|
response: event
|
|
198912
199053
|
});
|
|
199054
|
+
if (event.type === TaskType.TranslateTheme) {
|
|
199055
|
+
emit(EVENT_ENTITY_POSTED, {
|
|
199056
|
+
entityName: ThemeEntityName,
|
|
199057
|
+
requested: event,
|
|
199058
|
+
response: event
|
|
199059
|
+
});
|
|
199060
|
+
}
|
|
199061
|
+
if (event.type === TaskType.TranslateCusomizedPage || event.type === TaskType.TranslateBuiltinPage || event.type === TaskType.TranslateTheme) {
|
|
199062
|
+
emit(EVENT_ENTITY_POSTED, {
|
|
199063
|
+
entityName: PageEntityName,
|
|
199064
|
+
requested: event,
|
|
199065
|
+
response: event
|
|
199066
|
+
});
|
|
199067
|
+
}
|
|
199068
|
+
if (event.type === TaskType.TranslateComponent || event.type === TaskType.TranslateTheme) {
|
|
199069
|
+
console.log("===>收到组件任务事件:", event);
|
|
199070
|
+
emit(EVENT_ENTITY_POSTED, {
|
|
199071
|
+
entityName: FrontComponentEntityName,
|
|
199072
|
+
requested: event,
|
|
199073
|
+
response: event
|
|
199074
|
+
});
|
|
199075
|
+
emit(EVENT_ENTITY_POSTED, {
|
|
199076
|
+
entityName: ComponentCategoryEntityName,
|
|
199077
|
+
requested: event,
|
|
199078
|
+
response: event
|
|
199079
|
+
});
|
|
199080
|
+
}
|
|
198913
199081
|
},
|
|
198914
199082
|
[setLastedTaskEvent]
|
|
198915
199083
|
);
|
|
@@ -202746,89 +202914,185 @@ function ComponentCategoryModal(props) {
|
|
|
202746
202914
|
function ComponentsSkeletons() {
|
|
202747
202915
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full p-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "space-y-4", children: Array.from({ length: 6 }).map((_2, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx("li", { className: "flex items-center py-0.5", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "w-full h-12 rounded-md" }) }, index2)) }) });
|
|
202748
202916
|
}
|
|
202749
|
-
|
|
202917
|
+
class ImportComponentsTask {
|
|
202918
|
+
constructor(options, components, categories) {
|
|
202919
|
+
__publicField(this, "entifyClient");
|
|
202920
|
+
__publicField(this, "taskData");
|
|
202921
|
+
__publicField(this, "importOneComponent", async (component, overrideId, existCategory) => {
|
|
202922
|
+
var _a3;
|
|
202923
|
+
await this.entifyClient.upsertEntity(FrontComponentEntityName, {
|
|
202924
|
+
id: overrideId,
|
|
202925
|
+
theme: { sync: { id: (_a3 = this.taskData) == null ? void 0 : _a3.themeId } },
|
|
202926
|
+
category: (existCategory == null ? void 0 : existCategory.id) ? { sync: { id: existCategory.id } } : { clear: true },
|
|
202927
|
+
name: component.name,
|
|
202928
|
+
title: component.title,
|
|
202929
|
+
description: component.description,
|
|
202930
|
+
code: component.code,
|
|
202931
|
+
props: component.props,
|
|
202932
|
+
testConfig: component.testConfig
|
|
202933
|
+
});
|
|
202934
|
+
});
|
|
202935
|
+
this.components = components;
|
|
202936
|
+
this.categories = categories;
|
|
202937
|
+
this.entifyClient = options.entifyClient;
|
|
202938
|
+
this.taskData = {
|
|
202939
|
+
ids: options.ids,
|
|
202940
|
+
themeId: options.themeId,
|
|
202941
|
+
lang: options.lang
|
|
202942
|
+
};
|
|
202943
|
+
}
|
|
202944
|
+
/**
|
|
202945
|
+
* 实际执行导入页面的逻辑
|
|
202946
|
+
* @returns Promise
|
|
202947
|
+
*/
|
|
202948
|
+
async importComponents() {
|
|
202949
|
+
var _a3;
|
|
202950
|
+
for (const comId of this.taskData.ids) {
|
|
202951
|
+
const com = await this.entifyClient.oneEntity(
|
|
202952
|
+
new FrontComponentQueryOptions(
|
|
202953
|
+
[
|
|
202954
|
+
FrontComponentFields.id,
|
|
202955
|
+
FrontComponentFields.id,
|
|
202956
|
+
FrontComponentFields.name,
|
|
202957
|
+
FrontComponentFields.code,
|
|
202958
|
+
FrontComponentFields.description,
|
|
202959
|
+
FrontComponentFields.title,
|
|
202960
|
+
FrontComponentFields.seqValue,
|
|
202961
|
+
FrontComponentFields.testConfig,
|
|
202962
|
+
FrontComponentFields.props
|
|
202963
|
+
],
|
|
202964
|
+
{
|
|
202965
|
+
where: {
|
|
202966
|
+
id: {
|
|
202967
|
+
_eq: comId
|
|
202968
|
+
}
|
|
202969
|
+
}
|
|
202970
|
+
}
|
|
202971
|
+
).category([
|
|
202972
|
+
ComponentCategoryFields.id,
|
|
202973
|
+
ComponentCategoryFields.name,
|
|
202974
|
+
ComponentCategoryFields.seqValue
|
|
202975
|
+
])
|
|
202976
|
+
);
|
|
202977
|
+
if (!com) {
|
|
202978
|
+
throw Error("没有找到要导入的页面");
|
|
202979
|
+
}
|
|
202980
|
+
const existCom = (_a3 = this.components) == null ? void 0 : _a3.find((p2) => p2.name === com.name);
|
|
202981
|
+
let existCategory = this.categories.find(
|
|
202982
|
+
(c) => {
|
|
202983
|
+
var _a4;
|
|
202984
|
+
return c.name === ((_a4 = com.category) == null ? void 0 : _a4.name);
|
|
202985
|
+
}
|
|
202986
|
+
);
|
|
202987
|
+
if (!existCategory && com.category) {
|
|
202988
|
+
existCategory = await this.entifyClient.upsertEntity(
|
|
202989
|
+
ComponentCategoryEntityName,
|
|
202990
|
+
{
|
|
202991
|
+
...com.category,
|
|
202992
|
+
id: void 0,
|
|
202993
|
+
theme: { sync: { id: this.taskData.themeId } }
|
|
202994
|
+
}
|
|
202995
|
+
);
|
|
202996
|
+
if (existCategory) {
|
|
202997
|
+
this.categories.push({ ...existCategory, name: com.category.name });
|
|
202998
|
+
}
|
|
202999
|
+
}
|
|
203000
|
+
await this.importOneComponent(com, existCom == null ? void 0 : existCom.id, existCategory);
|
|
203001
|
+
}
|
|
203002
|
+
const msg = `成功导入 ${this.taskData.ids.length} 个文件`;
|
|
203003
|
+
addToast({
|
|
203004
|
+
title: "导入完成",
|
|
203005
|
+
description: msg,
|
|
203006
|
+
color: "success"
|
|
203007
|
+
});
|
|
203008
|
+
}
|
|
203009
|
+
}
|
|
202750
203010
|
function useComponentsImportTask() {
|
|
203011
|
+
const [isImporting, setIsImporting] = useState(false);
|
|
202751
203012
|
const theme = useStudioTheme();
|
|
202752
203013
|
const lang = useCurrentLang();
|
|
202753
203014
|
const components = useFrontComponents();
|
|
202754
|
-
const appKey = (theme == null ? void 0 : theme.id) || "";
|
|
202755
|
-
const taskState = useInprogressTaskByKey(IMPORT_COMPONENTS_KEY, appKey);
|
|
202756
|
-
const setTask = useUpdateTask(appKey);
|
|
202757
|
-
const setTaskRef = useRef(setTask);
|
|
202758
|
-
setTaskRef.current = setTask;
|
|
202759
203015
|
const entifyClient = useCreateEntityClient();
|
|
202760
|
-
const task = taskState && taskState.status !== "done" ? taskPool[taskState.taskId] : void 0;
|
|
202761
|
-
const aiUrl = useAiUrl();
|
|
202762
203016
|
const componentCategories = useComponentCategories();
|
|
202763
|
-
const handleTaskChange = useCallback((data) => {
|
|
202764
|
-
setTaskRef.current(data);
|
|
202765
|
-
}, []);
|
|
202766
203017
|
const importComponents = useCallback(
|
|
202767
|
-
(ids
|
|
202768
|
-
|
|
202769
|
-
|
|
202770
|
-
|
|
202771
|
-
|
|
202772
|
-
|
|
202773
|
-
|
|
202774
|
-
|
|
202775
|
-
|
|
202776
|
-
|
|
202777
|
-
|
|
202778
|
-
|
|
203018
|
+
async (ids) => {
|
|
203019
|
+
setIsImporting(true);
|
|
203020
|
+
try {
|
|
203021
|
+
if (!(theme == null ? void 0 : theme.id)) {
|
|
203022
|
+
console.error("没设置Theme");
|
|
203023
|
+
return;
|
|
203024
|
+
}
|
|
203025
|
+
if (!entifyClient) {
|
|
203026
|
+
console.error("entifyClient 创建失败");
|
|
203027
|
+
return;
|
|
203028
|
+
}
|
|
203029
|
+
const task = new ImportComponentsTask(
|
|
203030
|
+
{
|
|
203031
|
+
ids,
|
|
203032
|
+
entifyClient,
|
|
203033
|
+
themeId: theme == null ? void 0 : theme.id,
|
|
203034
|
+
lang
|
|
203035
|
+
},
|
|
203036
|
+
components || [],
|
|
203037
|
+
(componentCategories == null ? void 0 : componentCategories.items) || []
|
|
203038
|
+
);
|
|
203039
|
+
await task.importComponents();
|
|
203040
|
+
} catch (error) {
|
|
203041
|
+
console.error("导入组件失败", error);
|
|
203042
|
+
} finally {
|
|
203043
|
+
setIsImporting(false);
|
|
202779
203044
|
}
|
|
202780
|
-
|
|
203045
|
+
},
|
|
203046
|
+
[theme == null ? void 0 : theme.id, entifyClient, lang, components, componentCategories]
|
|
203047
|
+
);
|
|
203048
|
+
return {
|
|
203049
|
+
importComponents,
|
|
203050
|
+
isImporting
|
|
203051
|
+
};
|
|
203052
|
+
}
|
|
203053
|
+
function useTranlateComponents() {
|
|
203054
|
+
const translateRequest = useTranslateRequest();
|
|
203055
|
+
const translate = useCallback(
|
|
203056
|
+
async (langId, ids) => {
|
|
203057
|
+
return await translateRequest(
|
|
203058
|
+
"/api/studio/translate-components",
|
|
203059
|
+
{ langId, ids },
|
|
202781
203060
|
{
|
|
202782
|
-
|
|
202783
|
-
|
|
202784
|
-
|
|
202785
|
-
|
|
202786
|
-
|
|
202787
|
-
|
|
202788
|
-
|
|
202789
|
-
|
|
202790
|
-
|
|
202791
|
-
|
|
202792
|
-
|
|
203061
|
+
validateParams: (params) => {
|
|
203062
|
+
const { ids: ids2 } = params;
|
|
203063
|
+
if (!Array.isArray(ids2) || ids2.length === 0) {
|
|
203064
|
+
throw new Error("组件ID列表不能为空");
|
|
203065
|
+
}
|
|
203066
|
+
},
|
|
203067
|
+
transformParams: (params, websiteId) => ({
|
|
203068
|
+
websiteId,
|
|
203069
|
+
targetLangId: params.langId.trim(),
|
|
203070
|
+
sourceComponentIds: params.ids
|
|
203071
|
+
})
|
|
203072
|
+
}
|
|
202793
203073
|
);
|
|
202794
|
-
taskPool[task2.id] = task2;
|
|
202795
|
-
task2.onDataChange(handleTaskChange);
|
|
202796
|
-
task2.start();
|
|
202797
203074
|
},
|
|
202798
|
-
[
|
|
202799
|
-
theme == null ? void 0 : theme.id,
|
|
202800
|
-
entifyClient,
|
|
202801
|
-
aiUrl,
|
|
202802
|
-
lang,
|
|
202803
|
-
components,
|
|
202804
|
-
componentCategories,
|
|
202805
|
-
handleTaskChange
|
|
202806
|
-
]
|
|
203075
|
+
[translateRequest]
|
|
202807
203076
|
);
|
|
202808
|
-
return
|
|
203077
|
+
return translate;
|
|
202809
203078
|
}
|
|
202810
203079
|
function ImportComponentModal({
|
|
202811
203080
|
open,
|
|
202812
203081
|
onClose
|
|
202813
203082
|
}) {
|
|
203083
|
+
var _a3;
|
|
202814
203084
|
const [selection, setSelections] = useState([]);
|
|
203085
|
+
const [loading, setLoading] = useState(false);
|
|
202815
203086
|
const [confirmTitle, setConfirmTitle] = useState(
|
|
202816
203087
|
void 0
|
|
202817
203088
|
);
|
|
202818
203089
|
const baseThemeId = useBaseLangThemeId();
|
|
203090
|
+
const theme = useStudioTheme();
|
|
202819
203091
|
const isBaseTheme = useIsBaseLangTheme();
|
|
202820
203092
|
const parentTheme = useParentTheme();
|
|
202821
203093
|
const themeComs = useFrontComponents();
|
|
202822
|
-
const {
|
|
202823
|
-
|
|
202824
|
-
var _a3;
|
|
202825
|
-
setSelections == null ? void 0 : setSelections(((_a3 = taskState == null ? void 0 : taskState.data) == null ? void 0 : _a3.ids) || []);
|
|
202826
|
-
}, [setSelections, taskState == null ? void 0 : taskState.data]);
|
|
202827
|
-
useEffect(() => {
|
|
202828
|
-
if ((taskState == null ? void 0 : taskState.status) === "done") {
|
|
202829
|
-
setSelections == null ? void 0 : setSelections([]);
|
|
202830
|
-
}
|
|
202831
|
-
}, [setSelections, taskState]);
|
|
203094
|
+
const { importComponents } = useComponentsImportTask();
|
|
203095
|
+
const translateComponents = useTranlateComponents();
|
|
202832
203096
|
const confirmResolveRef = useRef();
|
|
202833
203097
|
const { data: baseTheme, isLoading } = useOneThemeById(
|
|
202834
203098
|
baseThemeId || void 0,
|
|
@@ -202858,8 +203122,8 @@ function ImportComponentModal({
|
|
|
202858
203122
|
}, [baseTheme == null ? void 0 : baseTheme.components, parentTheme == null ? void 0 : parentTheme.components, isBaseTheme]);
|
|
202859
203123
|
const noCategoryComponents = useMemo(() => {
|
|
202860
203124
|
return components.filter((component) => {
|
|
202861
|
-
var
|
|
202862
|
-
return !((
|
|
203125
|
+
var _a4;
|
|
203126
|
+
return !((_a4 = component.category) == null ? void 0 : _a4.id);
|
|
202863
203127
|
});
|
|
202864
203128
|
}, [components]);
|
|
202865
203129
|
const handleToggleSelect = React__default.useCallback((id) => {
|
|
@@ -202885,26 +203149,51 @@ function ImportComponentModal({
|
|
|
202885
203149
|
});
|
|
202886
203150
|
}, []);
|
|
202887
203151
|
const handleImport = useCallback(async () => {
|
|
202888
|
-
|
|
202889
|
-
|
|
202890
|
-
|
|
202891
|
-
|
|
202892
|
-
|
|
202893
|
-
|
|
202894
|
-
|
|
202895
|
-
|
|
202896
|
-
|
|
202897
|
-
|
|
203152
|
+
var _a4;
|
|
203153
|
+
setLoading(true);
|
|
203154
|
+
try {
|
|
203155
|
+
const comsToImport = components.filter(
|
|
203156
|
+
(c) => selection.includes(c.id || "")
|
|
203157
|
+
);
|
|
203158
|
+
const existings = themeComs == null ? void 0 : themeComs.filter(
|
|
203159
|
+
(c) => comsToImport == null ? void 0 : comsToImport.find((com) => c.name === com.name)
|
|
203160
|
+
);
|
|
203161
|
+
if (existings == null ? void 0 : existings.length) {
|
|
203162
|
+
const result = await confirmOverride(existings.length);
|
|
203163
|
+
if (!result) {
|
|
203164
|
+
return;
|
|
203165
|
+
}
|
|
202898
203166
|
}
|
|
203167
|
+
if (isBaseTheme) {
|
|
203168
|
+
await importComponents(selection);
|
|
203169
|
+
} else {
|
|
203170
|
+
await translateComponents(((_a4 = theme == null ? void 0 : theme.lang) == null ? void 0 : _a4.id) || "", selection);
|
|
203171
|
+
addToast({
|
|
203172
|
+
title: "成功添加导入任务",
|
|
203173
|
+
color: "success"
|
|
203174
|
+
});
|
|
203175
|
+
}
|
|
203176
|
+
setSelections([]);
|
|
203177
|
+
onClose();
|
|
203178
|
+
} catch (error) {
|
|
203179
|
+
console.error("导入组件失败:", error);
|
|
203180
|
+
addToast({
|
|
203181
|
+
title: "导入组件失败",
|
|
203182
|
+
color: "danger"
|
|
203183
|
+
});
|
|
203184
|
+
} finally {
|
|
203185
|
+
setLoading(false);
|
|
202899
203186
|
}
|
|
202900
|
-
importComponents(selection, !isBaseTheme);
|
|
202901
203187
|
}, [
|
|
202902
203188
|
components,
|
|
202903
203189
|
confirmOverride,
|
|
202904
203190
|
importComponents,
|
|
202905
203191
|
isBaseTheme,
|
|
203192
|
+
onClose,
|
|
202906
203193
|
selection,
|
|
202907
|
-
|
|
203194
|
+
(_a3 = theme == null ? void 0 : theme.lang) == null ? void 0 : _a3.id,
|
|
203195
|
+
themeComs,
|
|
203196
|
+
translateComponents
|
|
202908
203197
|
]);
|
|
202909
203198
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(Modal$1, { isOpen: open, onClose, children: [
|
|
202910
203199
|
/* @__PURE__ */ jsxRuntimeExports.jsx(ModalOverlay$1, { className: "z-10" }),
|
|
@@ -202922,8 +203211,8 @@ function ImportComponentModal({
|
|
|
202922
203211
|
/* @__PURE__ */ jsxRuntimeExports.jsx(ModalBody, { className: "flex-1 overflow-y-auto min-h-0 p-2", children: isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(ComponentsSkeletons, {}) : /* @__PURE__ */ jsxRuntimeExports.jsxs(TreeView, { children: [
|
|
202923
203212
|
categories == null ? void 0 : categories.map((category) => /* @__PURE__ */ jsxRuntimeExports.jsx(GroupNode, { title: category.name, icon: false, children: components.filter(
|
|
202924
203213
|
(component) => {
|
|
202925
|
-
var
|
|
202926
|
-
return ((
|
|
203214
|
+
var _a4;
|
|
203215
|
+
return ((_a4 = component.category) == null ? void 0 : _a4.id) === category.id;
|
|
202927
203216
|
}
|
|
202928
203217
|
).map((component) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
202929
203218
|
LeafNode,
|
|
@@ -202958,22 +203247,7 @@ function ImportComponentModal({
|
|
|
202958
203247
|
] }) }),
|
|
202959
203248
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Divider, {}),
|
|
202960
203249
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(ModalFooter, { className: "justify-between", children: [
|
|
202961
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
202962
|
-
selection.length > 0 && (taskState == null ? void 0 : taskState.status) !== "in-progress" ? `${selection.length}个组件选中` : "",
|
|
202963
|
-
taskState == null ? void 0 : taskState.infoMessage,
|
|
202964
|
-
(taskState == null ? void 0 : taskState.status) === "in-progress" && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
202965
|
-
Button$2,
|
|
202966
|
-
{
|
|
202967
|
-
variant: "light",
|
|
202968
|
-
size: "sm",
|
|
202969
|
-
isIconOnly: true,
|
|
202970
|
-
onPress: () => {
|
|
202971
|
-
task == null ? void 0 : task.stop();
|
|
202972
|
-
},
|
|
202973
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(TaskStopIcon, { className: "size-9 text-primary" })
|
|
202974
|
-
}
|
|
202975
|
-
)
|
|
202976
|
-
] }),
|
|
203250
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-default-500 flex items-center gap-2" }),
|
|
202977
203251
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-2", children: [
|
|
202978
203252
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Button$2, { variant: "light", onPress: onClose, children: "关闭" }),
|
|
202979
203253
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -202982,7 +203256,7 @@ function ImportComponentModal({
|
|
|
202982
203256
|
variant: "solid",
|
|
202983
203257
|
color: "primary",
|
|
202984
203258
|
onPress: handleImport,
|
|
202985
|
-
isLoading:
|
|
203259
|
+
isLoading: loading,
|
|
202986
203260
|
children: "转入"
|
|
202987
203261
|
}
|
|
202988
203262
|
)
|
|
@@ -203018,7 +203292,6 @@ function ComponentsRootNode(props) {
|
|
|
203018
203292
|
const website = useWebsite();
|
|
203019
203293
|
const handleNewCagegory = useNewRow();
|
|
203020
203294
|
const components = useFrontComponents();
|
|
203021
|
-
const { taskState } = useComponentsImportTask();
|
|
203022
203295
|
const comsNoCategory = useMemo(
|
|
203023
203296
|
() => components == null ? void 0 : components.filter((item) => {
|
|
203024
203297
|
var _a3;
|
|
@@ -203058,7 +203331,6 @@ function ComponentsRootNode(props) {
|
|
|
203058
203331
|
},
|
|
203059
203332
|
[setEditingPage, components, setEditingComponent, onSelectContent]
|
|
203060
203333
|
);
|
|
203061
|
-
const importting = (taskState == null ? void 0 : taskState.status) === "in-progress";
|
|
203062
203334
|
if (!themeId) {
|
|
203063
203335
|
return null;
|
|
203064
203336
|
}
|
|
@@ -203067,7 +203339,7 @@ function ComponentsRootNode(props) {
|
|
|
203067
203339
|
GroupNode,
|
|
203068
203340
|
{
|
|
203069
203341
|
title: "自定义组件",
|
|
203070
|
-
fiexdAction: open
|
|
203342
|
+
fiexdAction: open,
|
|
203071
203343
|
icon: null,
|
|
203072
203344
|
classNames: {
|
|
203073
203345
|
title: "text-sm font-semibold"
|
|
@@ -203080,7 +203352,6 @@ function ComponentsRootNode(props) {
|
|
|
203080
203352
|
size: "sm",
|
|
203081
203353
|
variant: "light",
|
|
203082
203354
|
isIconOnly: true,
|
|
203083
|
-
isLoading: importting,
|
|
203084
203355
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
203085
203356
|
Icon,
|
|
203086
203357
|
{
|
|
@@ -203511,11 +203782,20 @@ function WebsiteStudioInner(props) {
|
|
|
203511
203782
|
const { aiUrl, deployUrl } = props;
|
|
203512
203783
|
const website = useWebsite();
|
|
203513
203784
|
const langId = ((_a3 = useCurrentLang()) == null ? void 0 : _a3.id) || ((_b3 = website == null ? void 0 : website.baseLang) == null ? void 0 : _b3.id);
|
|
203785
|
+
const token = useEntifyToken();
|
|
203514
203786
|
const { data: theme, isLoading: themeLoading } = useOneTheme(
|
|
203515
203787
|
newThemeQueryOptions(website == null ? void 0 : website.id, langId)
|
|
203516
203788
|
);
|
|
203517
203789
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(StudioRoot, { theme, deployUrl, children: [
|
|
203518
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(EditorScope, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
203790
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(EditorScope, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
203791
|
+
AiAgentRoot,
|
|
203792
|
+
{
|
|
203793
|
+
endpoint: aiUrl,
|
|
203794
|
+
globalProvider: WEBSITE_DESIGN_PROMPT,
|
|
203795
|
+
token,
|
|
203796
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(WebsiteDesigner, { themeLoading, deployUrl })
|
|
203797
|
+
}
|
|
203798
|
+
) }),
|
|
203519
203799
|
/* @__PURE__ */ jsxRuntimeExports.jsx(GlobalLoading, { loading: themeLoading })
|
|
203520
203800
|
] });
|
|
203521
203801
|
}
|
|
@@ -204389,8 +204669,17 @@ const ThemeStudio = (props) => {
|
|
|
204389
204669
|
themeId,
|
|
204390
204670
|
newThemeByIdQueryOptions()
|
|
204391
204671
|
);
|
|
204672
|
+
const token = useEntifyToken();
|
|
204392
204673
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(StudioRoot, { theme, deployUrl: deployURL, children: [
|
|
204393
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(EditorScope, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
204674
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(EditorScope, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
204675
|
+
AiAgentRoot,
|
|
204676
|
+
{
|
|
204677
|
+
endpoint: aiUrl,
|
|
204678
|
+
globalProvider: WEBSITE_DESIGN_PROMPT,
|
|
204679
|
+
token,
|
|
204680
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(ThemeDesigner, {})
|
|
204681
|
+
}
|
|
204682
|
+
) }),
|
|
204394
204683
|
/* @__PURE__ */ jsxRuntimeExports.jsx(GlobalLoading, { loading: themeLoading })
|
|
204395
204684
|
] });
|
|
204396
204685
|
};
|
|
@@ -204408,4 +204697,4 @@ export {
|
|
|
204408
204697
|
typescriptDefaults as t,
|
|
204409
204698
|
useCustomizedMaterials as u
|
|
204410
204699
|
};
|
|
204411
|
-
//# sourceMappingURL=index-
|
|
204700
|
+
//# sourceMappingURL=index-310e120c.js.map
|