@rxdrag/website-studio 0.0.51 → 0.0.52
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/LeftDrawer/PagesPanel/ImportPageModal/usePagesImport.d.ts +2 -0
- package/dist/components/LeftDrawer/PagesPanel/useResetPage.d.ts +2 -0
- package/dist/{cssMode-a282f3f6.js → cssMode-8bdd5502.js} +2 -3
- package/dist/{cssMode-a282f3f6.js.map → cssMode-8bdd5502.js.map} +1 -1
- package/dist/{freemarker2-f83d1246.js → freemarker2-24b36fc1.js} +2 -3
- package/dist/{freemarker2-f83d1246.js.map → freemarker2-24b36fc1.js.map} +1 -1
- package/dist/{handlebars-0a80f575.js → handlebars-53295c7b.js} +2 -3
- package/dist/{handlebars-0a80f575.js.map → handlebars-53295c7b.js.map} +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useTranslateBuiltinPage.d.ts +1 -0
- package/dist/hooks/useTranslateCustomizedPages.d.ts +1 -0
- package/dist/hooks/useTranslateRequest.d.ts +1 -9
- package/dist/{html-6a9d914d.js → html-70d8042e.js} +2 -3
- package/dist/{html-6a9d914d.js.map → html-70d8042e.js.map} +1 -1
- package/dist/{htmlMode-9f16f56b.js → htmlMode-fabb16ce.js} +2 -3
- package/dist/{htmlMode-9f16f56b.js.map → htmlMode-fabb16ce.js.map} +1 -1
- package/dist/{index-310e120c.js → index-a0e7f111.js} +252 -247
- package/dist/{index-310e120c.js.map → index-a0e7f111.js.map} +1 -1
- package/dist/index.mjs +1 -2
- package/dist/index.mjs.map +1 -1
- package/dist/{javascript-85b04aa6.js → javascript-d190129b.js} +3 -4
- package/dist/{javascript-85b04aa6.js.map → javascript-d190129b.js.map} +1 -1
- package/dist/{jsonMode-61089a60.js → jsonMode-04d036a7.js} +2 -3
- package/dist/{jsonMode-61089a60.js.map → jsonMode-04d036a7.js.map} +1 -1
- package/dist/{liquid-a45e3197.js → liquid-9ba71888.js} +2 -3
- package/dist/{liquid-a45e3197.js.map → liquid-9ba71888.js.map} +1 -1
- package/dist/{mdx-701cd16d.js → mdx-a1e1cc3f.js} +2 -3
- package/dist/{mdx-701cd16d.js.map → mdx-a1e1cc3f.js.map} +1 -1
- package/dist/{python-9e486ae7.js → python-e2f4ad56.js} +2 -3
- package/dist/{python-9e486ae7.js.map → python-e2f4ad56.js.map} +1 -1
- package/dist/{razor-6bc3c261.js → razor-e8f995b7.js} +2 -3
- package/dist/{razor-6bc3c261.js.map → razor-e8f995b7.js.map} +1 -1
- package/dist/{tsMode-f84b3afc.js → tsMode-dff5ab28.js} +2 -3
- package/dist/{tsMode-f84b3afc.js.map → tsMode-dff5ab28.js.map} +1 -1
- package/dist/{typescript-d99b2a48.js → typescript-44b6e68e.js} +2 -3
- package/dist/{typescript-d99b2a48.js.map → typescript-44b6e68e.js.map} +1 -1
- package/dist/{xml-a116de23.js → xml-3f4949e5.js} +2 -3
- package/dist/{xml-a116de23.js.map → xml-3f4949e5.js.map} +1 -1
- package/dist/{yaml-331a88a9.js → yaml-c6242439.js} +2 -3
- package/dist/{yaml-331a88a9.js.map → yaml-c6242439.js.map} +1 -1
- package/package.json +16 -16
- package/dist/components/LeftDrawer/PagesPanel/ImportPageModal/usePagesImportTask.d.ts +0 -7
- package/dist/components/LeftDrawer/PagesPanel/useResetPageTask.d.ts +0 -7
|
@@ -7,7 +7,7 @@ var __publicField = (obj, key2, value) => {
|
|
|
7
7
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i2, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$2, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa, _Ba, _Ca, _Da, _Ea, _Fa, _Ga, _Ha, _Ia, _Ja, _Ka, _La, _Ma, _Na, _Oa, _Pa, _Qa, _Ra, _Sa;
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
import React__default, { createContext, useContext, useMemo, memo, useEffect, useCallback, useState, useRef, forwardRef as forwardRef$2, Component, useImperativeHandle, isValidElement, cloneElement } from "react";
|
|
10
|
-
import { ThemeFields, PageQueryOptions, PageFields, FrontComponentQueryOptions, FrontComponentFields, ComponentCategoryFields, SectionTemplateQueryOptions, SectionTemplateFields, ComponentCategoryQueryOptions, TemplateCategoryQueryOptions, TemplateCategoryFields, ThemeQueryOptions, StyleConfigFields, LangFields, ThemeConfigQueryOptions, ThemeConfigFields, PageAssciations, TaskQueryOptions, TaskFields, AppModule, TaskStatus, PageType, ProductCategoryEntityName, ProductCategoryQueryOptions, ProductCategoryFields, ProductQueryOptions, ProductFields, PublishableStatus, websiteToInput, TaskType, LangQueryOptions, WebsiteAssciations, ExtendFieldType, ThemeConfigAssciations, MediaQueryOptions, WebsiteSettingsQueryOptions, WebsiteSettingsFields, themeConfigToInputCascade, ThemeConfigEntityName, MediaType, themeConfigToInput, websiteSettingsToInput, WebsiteSettingsEntityName, WebsiteSettingsAssciations, PageEntityName, ThemeEntityName, themeToInputCascade, ThemeCategoryFields, themeToInput, frontComponentToInput, sectionTemplateToInput, pageToInputCascade, ComponentCategoryEntityName, SectionTemplateEntityName, FrontComponentEntityName, TaskEntityName,
|
|
10
|
+
import { ThemeFields, PageQueryOptions, PageFields, FrontComponentQueryOptions, FrontComponentFields, ComponentCategoryFields, SectionTemplateQueryOptions, SectionTemplateFields, ComponentCategoryQueryOptions, TemplateCategoryQueryOptions, TemplateCategoryFields, ThemeQueryOptions, StyleConfigFields, LangFields, ThemeConfigQueryOptions, ThemeConfigFields, PageAssciations, TaskQueryOptions, TaskFields, AppModule, TaskStatus, PageType, ProductCategoryEntityName, ProductCategoryQueryOptions, ProductCategoryFields, ProductQueryOptions, ProductFields, PublishableStatus, websiteToInput, TaskType, LangQueryOptions, WebsiteAssciations, ExtendFieldType, ThemeConfigAssciations, MediaQueryOptions, WebsiteSettingsQueryOptions, WebsiteSettingsFields, themeConfigToInputCascade, ThemeConfigEntityName, MediaType, themeConfigToInput, websiteSettingsToInput, WebsiteSettingsEntityName, WebsiteSettingsAssciations, PageEntityName, ThemeEntityName, themeToInputCascade, ThemeCategoryFields, themeToInput, frontComponentToInput, sectionTemplateToInput, pageToInputCascade, ComponentCategoryEntityName, SectionTemplateEntityName, FrontComponentEntityName, TaskEntityName, pageToInput, PageMetaQueryOptions, PageMetaFields, PageMetaAssciations, componentCategoryToInput, TemplateCategoryEntityName, templateCategoryToInput } from "@rxdrag/rxcms-models";
|
|
11
11
|
import { GlobalLoading, EntityForm, SubmitButton, useListData, SearchInput, EntityPagination, useIsLoading, QueryListScope, RemoveButton, EntityTable, useRemoveRow, useEditRow, EntityEditModal, useSelectionsState, EntityListScope, NewButton, EntityRowScope, EntitySelectField, useNewRow } from "@rxdrag/rxcms-models-ui";
|
|
12
12
|
import { useOneTheme, usePageList, useTemplateCategoryList, useSectionTemplateList, useComponentCategoryList, useFrontComponentList, useOneThemeById, useTaskList, useUpsertOneWebsite, useDeleteThemeById, useUpsertOneTheme, useLangList, useOneWebsiteSettings, useOneThemeConfig, useUpsertOneThemeConfig, useUpsertOneWebsiteSettings, useUpsertOnePage, useUpsertOneFrontComponent, useUpsertOneSectionTemplate, useDeletePageById } from "@rxdrag/rxcms-model-hooks";
|
|
13
13
|
import { newPageMetaOptions, useWebsite, useCurrentLang, ComponentType, currentLangState, useCurrentLangId, MediaSingleSelectField, FullImageSelectField, useSiteId, usePreviewUrl, LangSelect, TitleAndSlug, TitleViewField, DescriptionViewField, SiteRoot } from "@rxdrag/biz-components";
|
|
@@ -39,7 +39,6 @@ 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 } from "@rxdrag/ai-tasks";
|
|
43
42
|
var jsxRuntime = { exports: {} };
|
|
44
43
|
var reactJsxRuntime_production_min = {};
|
|
45
44
|
/**
|
|
@@ -6732,20 +6731,6 @@ function useTranslateRequest() {
|
|
|
6732
6731
|
const isAxiosError = useCallback((err) => {
|
|
6733
6732
|
return typeof err === "object" && err !== null;
|
|
6734
6733
|
}, []);
|
|
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
6734
|
const extractErrorMessage = useCallback((responseData) => {
|
|
6750
6735
|
if (!responseData)
|
|
6751
6736
|
return "翻译请求失败";
|
|
@@ -6780,44 +6765,42 @@ function useTranslateRequest() {
|
|
|
6780
6765
|
return `请求失败 (${status2})`;
|
|
6781
6766
|
}
|
|
6782
6767
|
}, []);
|
|
6783
|
-
const handleError = useCallback(
|
|
6784
|
-
|
|
6785
|
-
|
|
6786
|
-
|
|
6787
|
-
|
|
6788
|
-
|
|
6789
|
-
|
|
6790
|
-
|
|
6791
|
-
|
|
6792
|
-
|
|
6793
|
-
|
|
6794
|
-
errorMsg2
|
|
6795
|
-
|
|
6796
|
-
|
|
6797
|
-
|
|
6798
|
-
|
|
6799
|
-
|
|
6800
|
-
|
|
6801
|
-
|
|
6802
|
-
|
|
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);
|
|
6768
|
+
const handleError = useCallback(
|
|
6769
|
+
(error, context) => {
|
|
6770
|
+
var _a3, _b3;
|
|
6771
|
+
if (isAxiosError(error) && (error.code === "NETWORK_ERROR" || ((_a3 = error.message) == null ? void 0 : _a3.includes("fetch")))) {
|
|
6772
|
+
console.error(`${context}网络错误:`, error);
|
|
6773
|
+
throw new Error("网络连接失败,请检查网络连接");
|
|
6774
|
+
}
|
|
6775
|
+
if (isAxiosError(error) && ((_b3 = error.response) == null ? void 0 : _b3.status)) {
|
|
6776
|
+
const status2 = error.response.status;
|
|
6777
|
+
const responseData = error.response.data;
|
|
6778
|
+
let errorMsg2 = extractErrorMessage(responseData);
|
|
6779
|
+
if (errorMsg2 === "翻译请求失败") {
|
|
6780
|
+
errorMsg2 = getStatusErrorMessage(status2);
|
|
6781
|
+
}
|
|
6782
|
+
console.error(`${context}HTTP错误:`, {
|
|
6783
|
+
status: status2,
|
|
6784
|
+
statusText: error.response.statusText,
|
|
6785
|
+
responseData,
|
|
6786
|
+
error
|
|
6787
|
+
});
|
|
6788
|
+
throw new Error(errorMsg2);
|
|
6813
6789
|
}
|
|
6790
|
+
const errorMsg = isAxiosError(error) && error.message ? error.message : "翻译过程中发生未知错误";
|
|
6791
|
+
console.error(`${context}未知错误:`, error);
|
|
6792
|
+
throw new Error(errorMsg);
|
|
6793
|
+
},
|
|
6794
|
+
[isAxiosError, extractErrorMessage, getStatusErrorMessage]
|
|
6795
|
+
);
|
|
6796
|
+
const translateRequest = useCallback(
|
|
6797
|
+
async (endpoint, params) => {
|
|
6814
6798
|
try {
|
|
6815
6799
|
const http = createHttpClient({ baseURL, token });
|
|
6816
6800
|
const websiteId = website.id;
|
|
6817
|
-
const requestParams =
|
|
6801
|
+
const requestParams = {
|
|
6818
6802
|
websiteId,
|
|
6819
|
-
...params
|
|
6820
|
-
langId: params.langId.trim()
|
|
6803
|
+
...params
|
|
6821
6804
|
};
|
|
6822
6805
|
const response = await http.post(endpoint, requestParams);
|
|
6823
6806
|
return response;
|
|
@@ -6825,7 +6808,7 @@ function useTranslateRequest() {
|
|
|
6825
6808
|
handleError(error, "翻译");
|
|
6826
6809
|
}
|
|
6827
6810
|
},
|
|
6828
|
-
[baseURL, token, website,
|
|
6811
|
+
[baseURL, token, website, handleError]
|
|
6829
6812
|
);
|
|
6830
6813
|
return translateRequest;
|
|
6831
6814
|
}
|
|
@@ -6833,23 +6816,10 @@ function useTranslateTheme() {
|
|
|
6833
6816
|
const translateRequest = useTranslateRequest();
|
|
6834
6817
|
const translate = useCallback(
|
|
6835
6818
|
async (langId, title) => {
|
|
6836
|
-
return await translateRequest(
|
|
6837
|
-
|
|
6838
|
-
|
|
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
|
-
);
|
|
6819
|
+
return await translateRequest("/api/studio/translate-theme", {
|
|
6820
|
+
targetLangId: langId,
|
|
6821
|
+
title
|
|
6822
|
+
});
|
|
6853
6823
|
},
|
|
6854
6824
|
[translateRequest]
|
|
6855
6825
|
);
|
|
@@ -6947,6 +6917,19 @@ function useStopTask() {
|
|
|
6947
6917
|
);
|
|
6948
6918
|
return [stopTask, { isMutating }];
|
|
6949
6919
|
}
|
|
6920
|
+
function useTranslateCustomizedPages() {
|
|
6921
|
+
const translateRequest = useTranslateRequest();
|
|
6922
|
+
const translate = useCallback(
|
|
6923
|
+
async (langId, ids) => {
|
|
6924
|
+
return await translateRequest("/api/studio/translate-customized-pages", {
|
|
6925
|
+
targetLangId: langId,
|
|
6926
|
+
sourcePageIds: ids
|
|
6927
|
+
});
|
|
6928
|
+
},
|
|
6929
|
+
[translateRequest]
|
|
6930
|
+
);
|
|
6931
|
+
return translate;
|
|
6932
|
+
}
|
|
6950
6933
|
const linkTypes = [
|
|
6951
6934
|
{
|
|
6952
6935
|
key: "path",
|
|
@@ -138517,7 +138500,7 @@ registerLanguage({
|
|
|
138517
138500
|
aliases: ["FreeMarker2", "Apache FreeMarker2"],
|
|
138518
138501
|
loader: () => {
|
|
138519
138502
|
{
|
|
138520
|
-
return import("./freemarker2-
|
|
138503
|
+
return import("./freemarker2-24b36fc1.js").then((m2) => m2.TagAutoInterpolationDollar);
|
|
138521
138504
|
}
|
|
138522
138505
|
}
|
|
138523
138506
|
});
|
|
@@ -138526,7 +138509,7 @@ registerLanguage({
|
|
|
138526
138509
|
aliases: ["FreeMarker2 (Angle/Dollar)", "Apache FreeMarker2 (Angle/Dollar)"],
|
|
138527
138510
|
loader: () => {
|
|
138528
138511
|
{
|
|
138529
|
-
return import("./freemarker2-
|
|
138512
|
+
return import("./freemarker2-24b36fc1.js").then((m2) => m2.TagAngleInterpolationDollar);
|
|
138530
138513
|
}
|
|
138531
138514
|
}
|
|
138532
138515
|
});
|
|
@@ -138535,7 +138518,7 @@ registerLanguage({
|
|
|
138535
138518
|
aliases: ["FreeMarker2 (Bracket/Dollar)", "Apache FreeMarker2 (Bracket/Dollar)"],
|
|
138536
138519
|
loader: () => {
|
|
138537
138520
|
{
|
|
138538
|
-
return import("./freemarker2-
|
|
138521
|
+
return import("./freemarker2-24b36fc1.js").then((m2) => m2.TagBracketInterpolationDollar);
|
|
138539
138522
|
}
|
|
138540
138523
|
}
|
|
138541
138524
|
});
|
|
@@ -138544,7 +138527,7 @@ registerLanguage({
|
|
|
138544
138527
|
aliases: ["FreeMarker2 (Angle/Bracket)", "Apache FreeMarker2 (Angle/Bracket)"],
|
|
138545
138528
|
loader: () => {
|
|
138546
138529
|
{
|
|
138547
|
-
return import("./freemarker2-
|
|
138530
|
+
return import("./freemarker2-24b36fc1.js").then((m2) => m2.TagAngleInterpolationBracket);
|
|
138548
138531
|
}
|
|
138549
138532
|
}
|
|
138550
138533
|
});
|
|
@@ -138553,7 +138536,7 @@ registerLanguage({
|
|
|
138553
138536
|
aliases: ["FreeMarker2 (Bracket/Bracket)", "Apache FreeMarker2 (Bracket/Bracket)"],
|
|
138554
138537
|
loader: () => {
|
|
138555
138538
|
{
|
|
138556
|
-
return import("./freemarker2-
|
|
138539
|
+
return import("./freemarker2-24b36fc1.js").then((m2) => m2.TagBracketInterpolationBracket);
|
|
138557
138540
|
}
|
|
138558
138541
|
}
|
|
138559
138542
|
});
|
|
@@ -138562,7 +138545,7 @@ registerLanguage({
|
|
|
138562
138545
|
aliases: ["FreeMarker2 (Auto/Dollar)", "Apache FreeMarker2 (Auto/Dollar)"],
|
|
138563
138546
|
loader: () => {
|
|
138564
138547
|
{
|
|
138565
|
-
return import("./freemarker2-
|
|
138548
|
+
return import("./freemarker2-24b36fc1.js").then((m2) => m2.TagAutoInterpolationDollar);
|
|
138566
138549
|
}
|
|
138567
138550
|
}
|
|
138568
138551
|
});
|
|
@@ -138571,7 +138554,7 @@ registerLanguage({
|
|
|
138571
138554
|
aliases: ["FreeMarker2 (Auto/Bracket)", "Apache FreeMarker2 (Auto/Bracket)"],
|
|
138572
138555
|
loader: () => {
|
|
138573
138556
|
{
|
|
138574
|
-
return import("./freemarker2-
|
|
138557
|
+
return import("./freemarker2-24b36fc1.js").then((m2) => m2.TagAutoInterpolationBracket);
|
|
138575
138558
|
}
|
|
138576
138559
|
}
|
|
138577
138560
|
});
|
|
@@ -138621,7 +138604,7 @@ registerLanguage({
|
|
|
138621
138604
|
mimetypes: ["text/x-handlebars-template"],
|
|
138622
138605
|
loader: () => {
|
|
138623
138606
|
{
|
|
138624
|
-
return import("./handlebars-
|
|
138607
|
+
return import("./handlebars-53295c7b.js");
|
|
138625
138608
|
}
|
|
138626
138609
|
}
|
|
138627
138610
|
});
|
|
@@ -138654,7 +138637,7 @@ registerLanguage({
|
|
|
138654
138637
|
mimetypes: ["text/html", "text/x-jshtm", "text/template", "text/ng-template"],
|
|
138655
138638
|
loader: () => {
|
|
138656
138639
|
{
|
|
138657
|
-
return import("./html-
|
|
138640
|
+
return import("./html-70d8042e.js");
|
|
138658
138641
|
}
|
|
138659
138642
|
}
|
|
138660
138643
|
});
|
|
@@ -138707,7 +138690,7 @@ registerLanguage({
|
|
|
138707
138690
|
mimetypes: ["text/javascript"],
|
|
138708
138691
|
loader: () => {
|
|
138709
138692
|
{
|
|
138710
|
-
return import("./javascript-
|
|
138693
|
+
return import("./javascript-d190129b.js");
|
|
138711
138694
|
}
|
|
138712
138695
|
}
|
|
138713
138696
|
});
|
|
@@ -138806,7 +138789,7 @@ registerLanguage({
|
|
|
138806
138789
|
mimetypes: ["application/liquid"],
|
|
138807
138790
|
loader: () => {
|
|
138808
138791
|
{
|
|
138809
|
-
return import("./liquid-
|
|
138792
|
+
return import("./liquid-9ba71888.js");
|
|
138810
138793
|
}
|
|
138811
138794
|
}
|
|
138812
138795
|
});
|
|
@@ -138854,7 +138837,7 @@ registerLanguage({
|
|
|
138854
138837
|
aliases: ["MDX", "mdx"],
|
|
138855
138838
|
loader: () => {
|
|
138856
138839
|
{
|
|
138857
|
-
return import("./mdx-
|
|
138840
|
+
return import("./mdx-a1e1cc3f.js");
|
|
138858
138841
|
}
|
|
138859
138842
|
}
|
|
138860
138843
|
});
|
|
@@ -139113,7 +139096,7 @@ registerLanguage({
|
|
|
139113
139096
|
firstLine: "^#!/.*\\bpython[0-9.-]*\\b",
|
|
139114
139097
|
loader: () => {
|
|
139115
139098
|
{
|
|
139116
|
-
return import("./python-
|
|
139099
|
+
return import("./python-e2f4ad56.js");
|
|
139117
139100
|
}
|
|
139118
139101
|
}
|
|
139119
139102
|
});
|
|
@@ -139162,7 +139145,7 @@ registerLanguage({
|
|
|
139162
139145
|
mimetypes: ["text/x-cshtml"],
|
|
139163
139146
|
loader: () => {
|
|
139164
139147
|
{
|
|
139165
|
-
return import("./razor-
|
|
139148
|
+
return import("./razor-e8f995b7.js");
|
|
139166
139149
|
}
|
|
139167
139150
|
}
|
|
139168
139151
|
});
|
|
@@ -139498,7 +139481,7 @@ registerLanguage({
|
|
|
139498
139481
|
mimetypes: ["text/typescript"],
|
|
139499
139482
|
loader: () => {
|
|
139500
139483
|
{
|
|
139501
|
-
return import("./typescript-
|
|
139484
|
+
return import("./typescript-44b6e68e.js");
|
|
139502
139485
|
}
|
|
139503
139486
|
}
|
|
139504
139487
|
});
|
|
@@ -139582,7 +139565,7 @@ registerLanguage({
|
|
|
139582
139565
|
mimetypes: ["text/xml", "application/xml", "application/xaml+xml", "application/xml-dtd"],
|
|
139583
139566
|
loader: () => {
|
|
139584
139567
|
{
|
|
139585
|
-
return import("./xml-
|
|
139568
|
+
return import("./xml-3f4949e5.js");
|
|
139586
139569
|
}
|
|
139587
139570
|
}
|
|
139588
139571
|
});
|
|
@@ -139599,7 +139582,7 @@ registerLanguage({
|
|
|
139599
139582
|
mimetypes: ["application/x-yaml", "text/x-yaml"],
|
|
139600
139583
|
loader: () => {
|
|
139601
139584
|
{
|
|
139602
|
-
return import("./yaml-
|
|
139585
|
+
return import("./yaml-c6242439.js");
|
|
139603
139586
|
}
|
|
139604
139587
|
}
|
|
139605
139588
|
});
|
|
@@ -139723,7 +139706,7 @@ var lessDefaults = new LanguageServiceDefaultsImpl$3(
|
|
|
139723
139706
|
monaco_editor_core_exports$3.languages.css = { cssDefaults, lessDefaults, scssDefaults };
|
|
139724
139707
|
function getMode$3() {
|
|
139725
139708
|
{
|
|
139726
|
-
return import("./cssMode-
|
|
139709
|
+
return import("./cssMode-8bdd5502.js");
|
|
139727
139710
|
}
|
|
139728
139711
|
}
|
|
139729
139712
|
monaco_editor_core_exports$3.languages.onLanguage("less", () => {
|
|
@@ -139854,7 +139837,7 @@ monaco_editor_core_exports$2.languages.html = {
|
|
|
139854
139837
|
};
|
|
139855
139838
|
function getMode$2() {
|
|
139856
139839
|
{
|
|
139857
|
-
return import("./htmlMode-
|
|
139840
|
+
return import("./htmlMode-fabb16ce.js");
|
|
139858
139841
|
}
|
|
139859
139842
|
}
|
|
139860
139843
|
function registerHTMLLanguageService(languageId, options = optionsDefault, modeConfiguration = getConfigurationDefault(languageId)) {
|
|
@@ -139952,7 +139935,7 @@ var getWorker = () => getMode$1().then((mode) => mode.getWorker());
|
|
|
139952
139935
|
monaco_editor_core_exports$1.languages.json = { jsonDefaults, getWorker };
|
|
139953
139936
|
function getMode$1() {
|
|
139954
139937
|
{
|
|
139955
|
-
return import("./jsonMode-
|
|
139938
|
+
return import("./jsonMode-04d036a7.js");
|
|
139956
139939
|
}
|
|
139957
139940
|
}
|
|
139958
139941
|
monaco_editor_core_exports$1.languages.register({
|
|
@@ -140228,7 +140211,7 @@ monaco_editor_core_exports.languages.typescript = {
|
|
|
140228
140211
|
};
|
|
140229
140212
|
function getMode() {
|
|
140230
140213
|
{
|
|
140231
|
-
return import("./tsMode-
|
|
140214
|
+
return import("./tsMode-dff5ab28.js");
|
|
140232
140215
|
}
|
|
140233
140216
|
}
|
|
140234
140217
|
monaco_editor_core_exports.languages.onLanguage("typescript", () => {
|
|
@@ -199059,6 +199042,7 @@ function StatusBar({ doc }) {
|
|
|
199059
199042
|
});
|
|
199060
199043
|
}
|
|
199061
199044
|
if (event.type === TaskType.TranslateCusomizedPage || event.type === TaskType.TranslateBuiltinPage || event.type === TaskType.TranslateTheme) {
|
|
199045
|
+
console.log("===>收到页面任务事件:", event);
|
|
199062
199046
|
emit(EVENT_ENTITY_POSTED, {
|
|
199063
199047
|
entityName: PageEntityName,
|
|
199064
199048
|
requested: event,
|
|
@@ -201112,52 +201096,48 @@ function CustomizedPageCard(props) {
|
|
|
201112
201096
|
}
|
|
201113
201097
|
);
|
|
201114
201098
|
}
|
|
201115
|
-
function
|
|
201099
|
+
function useResetPage() {
|
|
201116
201100
|
const theme = useStudioTheme();
|
|
201117
|
-
const
|
|
201118
|
-
const appKey = (theme == null ? void 0 : theme.id) || "";
|
|
201119
|
-
const taskState = useInprogressTaskByKey(taskKey, appKey);
|
|
201120
|
-
const setTask = useUpdateTask(appKey);
|
|
201121
|
-
const entifyClient = useCreateEntityClient();
|
|
201122
|
-
const task = taskState && taskState.status !== "done" ? taskPool[taskState.taskId] : void 0;
|
|
201123
|
-
const aiUrl = useAiUrl();
|
|
201124
|
-
const handleTaskChange = useCallback(
|
|
201125
|
-
(data) => {
|
|
201126
|
-
setTask(data);
|
|
201127
|
-
},
|
|
201128
|
-
[setTask]
|
|
201129
|
-
);
|
|
201101
|
+
const [upsertPage] = useUpsertOnePage();
|
|
201130
201102
|
const resetPage = useCallback(
|
|
201131
|
-
(basePage, targetPageId
|
|
201103
|
+
async (basePage, targetPageId) => {
|
|
201132
201104
|
if (!(theme == null ? void 0 : theme.id)) {
|
|
201133
201105
|
console.error("没设置Theme");
|
|
201134
201106
|
return;
|
|
201135
201107
|
}
|
|
201136
|
-
|
|
201137
|
-
|
|
201138
|
-
|
|
201139
|
-
|
|
201140
|
-
|
|
201141
|
-
|
|
201142
|
-
|
|
201143
|
-
|
|
201144
|
-
|
|
201145
|
-
|
|
201146
|
-
|
|
201147
|
-
|
|
201148
|
-
|
|
201108
|
+
await upsertPage(
|
|
201109
|
+
pageToInput({
|
|
201110
|
+
id: targetPageId,
|
|
201111
|
+
theme: { id: theme.id },
|
|
201112
|
+
title: basePage.title,
|
|
201113
|
+
slug: basePage.slug,
|
|
201114
|
+
description: basePage.description,
|
|
201115
|
+
code: basePage.code,
|
|
201116
|
+
pageType: basePage.pageType,
|
|
201117
|
+
meta: basePage.meta ? {
|
|
201118
|
+
...basePage.meta,
|
|
201119
|
+
id: void 0
|
|
201120
|
+
} : void 0
|
|
201121
|
+
})
|
|
201122
|
+
);
|
|
201123
|
+
},
|
|
201124
|
+
[theme == null ? void 0 : theme.id, upsertPage]
|
|
201125
|
+
);
|
|
201126
|
+
return resetPage;
|
|
201127
|
+
}
|
|
201128
|
+
function useTranslateBuiltinPage() {
|
|
201129
|
+
const translateRequest = useTranslateRequest();
|
|
201130
|
+
const translate = useCallback(
|
|
201131
|
+
async (sourcePageId, targetPageId, title) => {
|
|
201132
|
+
return await translateRequest("/api/studio/translate-builtin-page", {
|
|
201133
|
+
sourcePageId,
|
|
201149
201134
|
targetPageId,
|
|
201150
|
-
|
|
201151
|
-
lang,
|
|
201152
|
-
aiUrl
|
|
201135
|
+
title
|
|
201153
201136
|
});
|
|
201154
|
-
taskPool[task2.id] = task2;
|
|
201155
|
-
task2.onDataChange(handleTaskChange);
|
|
201156
|
-
task2.start();
|
|
201157
201137
|
},
|
|
201158
|
-
[
|
|
201138
|
+
[translateRequest]
|
|
201159
201139
|
);
|
|
201160
|
-
return
|
|
201140
|
+
return translate;
|
|
201161
201141
|
}
|
|
201162
201142
|
function PredefinedPageCard(props) {
|
|
201163
201143
|
const { pages, pageType } = props;
|
|
@@ -201166,6 +201146,7 @@ function PredefinedPageCard(props) {
|
|
|
201166
201146
|
void 0
|
|
201167
201147
|
);
|
|
201168
201148
|
const theme = useStudioTheme();
|
|
201149
|
+
const currentLang = useCurrentLang();
|
|
201169
201150
|
const parentTheme = useParentTheme();
|
|
201170
201151
|
const isBaseTheme = useIsBaseLangTheme();
|
|
201171
201152
|
const baseThemeId = useBaseLangThemeId();
|
|
@@ -201175,11 +201156,12 @@ function PredefinedPageCard(props) {
|
|
|
201175
201156
|
const page = pages.find((page2) => page2.pageType === (pageType == null ? void 0 : pageType.pageType));
|
|
201176
201157
|
const setEditingPage = useStudioStore((state) => state.setEditingPage);
|
|
201177
201158
|
const selectedContent = useStudioStore((state) => state.selectedContent);
|
|
201178
|
-
const setSelectedContent = useStudioStore(
|
|
201179
|
-
|
|
201180
|
-
"reset-page" + ((page == null ? void 0 : page.id) || "")
|
|
201159
|
+
const setSelectedContent = useStudioStore(
|
|
201160
|
+
(state) => state.setSelectedContent
|
|
201181
201161
|
);
|
|
201162
|
+
const resetPage = useResetPage();
|
|
201182
201163
|
const queryPage = useLazyQueryOneEntity();
|
|
201164
|
+
const translatePage = useTranslateBuiltinPage();
|
|
201183
201165
|
const confirmResolveRef = useRef();
|
|
201184
201166
|
const selected = (selectedContent == null ? void 0 : selectedContent.type) === ContentType.PredefinedPage && (selectedContent == null ? void 0 : selectedContent.id) === (page == null ? void 0 : page.id);
|
|
201185
201167
|
const [remove, { isMutating: removing }] = useDeletePageById();
|
|
@@ -201255,22 +201237,24 @@ function PredefinedPageCard(props) {
|
|
|
201255
201237
|
}
|
|
201256
201238
|
}
|
|
201257
201239
|
}
|
|
201258
|
-
).meta(
|
|
201259
|
-
|
|
201260
|
-
|
|
201261
|
-
|
|
201262
|
-
|
|
201263
|
-
|
|
201264
|
-
|
|
201265
|
-
|
|
201266
|
-
|
|
201267
|
-
|
|
201268
|
-
|
|
201269
|
-
|
|
201270
|
-
|
|
201271
|
-
|
|
201272
|
-
|
|
201273
|
-
|
|
201240
|
+
).meta(
|
|
201241
|
+
new PageMetaQueryOptions([
|
|
201242
|
+
PageMetaFields.id,
|
|
201243
|
+
PageMetaFields.ogDescription,
|
|
201244
|
+
PageMetaFields.ogSiteName,
|
|
201245
|
+
PageMetaFields.ogTitle,
|
|
201246
|
+
PageMetaFields.ogType,
|
|
201247
|
+
PageMetaFields.ogUrl,
|
|
201248
|
+
PageMetaFields.seoAuthor,
|
|
201249
|
+
PageMetaFields.seoDescription,
|
|
201250
|
+
PageMetaFields.seoKeywords,
|
|
201251
|
+
PageMetaFields.seoRobots,
|
|
201252
|
+
PageMetaFields.seoTitle,
|
|
201253
|
+
PageMetaFields.xCard,
|
|
201254
|
+
PageMetaFields.xSite,
|
|
201255
|
+
PageMetaFields.xUrl
|
|
201256
|
+
]).ogImage()
|
|
201257
|
+
).setNoQuery(!page || !(page == null ? void 0 : page.pageType)).toGqlOptions()
|
|
201274
201258
|
);
|
|
201275
201259
|
if (!parentPage) {
|
|
201276
201260
|
setResetting(false);
|
|
@@ -201279,17 +201263,29 @@ function PredefinedPageCard(props) {
|
|
|
201279
201263
|
}
|
|
201280
201264
|
const result = await confirmOverride();
|
|
201281
201265
|
if (result && (page == null ? void 0 : page.id)) {
|
|
201282
|
-
|
|
201283
|
-
{ ...parentPage, title: pageType == null ? void 0 : pageType.title },
|
|
201284
|
-
|
|
201285
|
-
|
|
201286
|
-
|
|
201266
|
+
if (isBaseTheme) {
|
|
201267
|
+
await resetPage({ ...parentPage, title: pageType == null ? void 0 : pageType.title }, page.id);
|
|
201268
|
+
} else {
|
|
201269
|
+
await translatePage(
|
|
201270
|
+
parentPage.id,
|
|
201271
|
+
page.id,
|
|
201272
|
+
`${page == null ? void 0 : page.title}的${currentLang == null ? void 0 : currentLang.cnName}版重置`
|
|
201273
|
+
);
|
|
201274
|
+
addToast({
|
|
201275
|
+
title: "翻译并重置任务已添加",
|
|
201276
|
+
color: "success"
|
|
201277
|
+
});
|
|
201278
|
+
}
|
|
201287
201279
|
}
|
|
201288
201280
|
if (selected) {
|
|
201289
201281
|
setSelectedContent(void 0);
|
|
201290
201282
|
}
|
|
201291
201283
|
} catch (error) {
|
|
201292
201284
|
setResetting(false);
|
|
201285
|
+
addToast({
|
|
201286
|
+
title: "重置页面失败",
|
|
201287
|
+
color: "danger"
|
|
201288
|
+
});
|
|
201293
201289
|
console.error("重置页面失败", error);
|
|
201294
201290
|
} finally {
|
|
201295
201291
|
setResetting(false);
|
|
@@ -201297,6 +201293,7 @@ function PredefinedPageCard(props) {
|
|
|
201297
201293
|
}, [
|
|
201298
201294
|
baseThemeId,
|
|
201299
201295
|
confirmOverride,
|
|
201296
|
+
currentLang == null ? void 0 : currentLang.cnName,
|
|
201300
201297
|
isBaseTheme,
|
|
201301
201298
|
page,
|
|
201302
201299
|
pageType == null ? void 0 : pageType.title,
|
|
@@ -201304,7 +201301,8 @@ function PredefinedPageCard(props) {
|
|
|
201304
201301
|
queryPage,
|
|
201305
201302
|
resetPage,
|
|
201306
201303
|
selected,
|
|
201307
|
-
setSelectedContent
|
|
201304
|
+
setSelectedContent,
|
|
201305
|
+
translatePage
|
|
201308
201306
|
]);
|
|
201309
201307
|
const handleConfirm = useCallback(() => {
|
|
201310
201308
|
setConfirmTitle(void 0);
|
|
@@ -201313,7 +201311,6 @@ function PredefinedPageCard(props) {
|
|
|
201313
201311
|
confirmResolveRef.current = void 0;
|
|
201314
201312
|
}
|
|
201315
201313
|
}, []);
|
|
201316
|
-
const taskRunning = (taskState == null ? void 0 : taskState.status) === "in-progress";
|
|
201317
201314
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
201318
201315
|
page ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
201319
201316
|
PageCard,
|
|
@@ -201321,12 +201318,12 @@ function PredefinedPageCard(props) {
|
|
|
201321
201318
|
onClick: handleDesign,
|
|
201322
201319
|
page,
|
|
201323
201320
|
selected,
|
|
201324
|
-
fiexdAction: removing || open || resetting
|
|
201321
|
+
fiexdAction: removing || open || resetting,
|
|
201325
201322
|
actions: page ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Dropdown, { isOpen: open, onOpenChange: handleOpenChange, children: [
|
|
201326
201323
|
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownTrigger, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
201327
201324
|
Button$2,
|
|
201328
201325
|
{
|
|
201329
|
-
isLoading: resetting
|
|
201326
|
+
isLoading: resetting,
|
|
201330
201327
|
isIconOnly: true,
|
|
201331
201328
|
variant: "light",
|
|
201332
201329
|
size: "sm",
|
|
@@ -201519,90 +201516,107 @@ function PageModal(props) {
|
|
|
201519
201516
|
}
|
|
201520
201517
|
);
|
|
201521
201518
|
}
|
|
201522
|
-
|
|
201523
|
-
function usePagesImportTask() {
|
|
201519
|
+
function usePagesImport() {
|
|
201524
201520
|
const theme = useStudioTheme();
|
|
201525
|
-
const lang = useCurrentLang();
|
|
201526
201521
|
const pages = usePages();
|
|
201527
|
-
const appKey = (theme == null ? void 0 : theme.id) || "";
|
|
201528
|
-
const taskState = useInprogressTaskByKey(IMPORT_PAGES_KEY, appKey);
|
|
201529
|
-
const setTask = useUpdateTask(appKey);
|
|
201530
201522
|
const entifyClient = useCreateEntityClient();
|
|
201531
|
-
const
|
|
201532
|
-
const
|
|
201533
|
-
|
|
201534
|
-
|
|
201535
|
-
|
|
201523
|
+
const [upsertPage] = useUpsertOnePage();
|
|
201524
|
+
const importOnePage = useCallback(
|
|
201525
|
+
async (page, overrideId) => {
|
|
201526
|
+
await upsertPage(
|
|
201527
|
+
pageToInput({
|
|
201528
|
+
id: overrideId,
|
|
201529
|
+
theme: { id: theme == null ? void 0 : theme.id },
|
|
201530
|
+
title: page.title,
|
|
201531
|
+
slug: page.slug,
|
|
201532
|
+
description: page.description,
|
|
201533
|
+
code: page.code,
|
|
201534
|
+
pageType: page.pageType,
|
|
201535
|
+
meta: page.meta ? { ...page.meta, id: void 0 } : void 0
|
|
201536
|
+
})
|
|
201537
|
+
);
|
|
201536
201538
|
},
|
|
201537
|
-
[
|
|
201539
|
+
[theme == null ? void 0 : theme.id, upsertPage]
|
|
201538
201540
|
);
|
|
201539
201541
|
const importPages = useCallback(
|
|
201540
|
-
(ids
|
|
201542
|
+
async (ids) => {
|
|
201543
|
+
var _a3;
|
|
201541
201544
|
if (!(theme == null ? void 0 : theme.id)) {
|
|
201542
201545
|
console.error("没设置Theme");
|
|
201543
201546
|
return;
|
|
201544
201547
|
}
|
|
201545
|
-
|
|
201546
|
-
|
|
201547
|
-
|
|
201548
|
-
|
|
201549
|
-
|
|
201550
|
-
|
|
201551
|
-
|
|
201548
|
+
for (const pageId of ids) {
|
|
201549
|
+
const page = await (entifyClient == null ? void 0 : entifyClient.oneEntity(
|
|
201550
|
+
new PageQueryOptions(
|
|
201551
|
+
[
|
|
201552
|
+
PageFields.id,
|
|
201553
|
+
PageFields.id,
|
|
201554
|
+
PageFields.pageType,
|
|
201555
|
+
PageFields.code,
|
|
201556
|
+
PageFields.description,
|
|
201557
|
+
PageFields.slug,
|
|
201558
|
+
PageFields.title
|
|
201559
|
+
],
|
|
201560
|
+
{
|
|
201561
|
+
where: {
|
|
201562
|
+
id: {
|
|
201563
|
+
_eq: pageId
|
|
201564
|
+
}
|
|
201565
|
+
}
|
|
201566
|
+
}
|
|
201567
|
+
).meta(
|
|
201568
|
+
new PageMetaQueryOptions([
|
|
201569
|
+
PageMetaFields.id,
|
|
201570
|
+
PageMetaFields.ogDescription,
|
|
201571
|
+
PageMetaFields.ogSiteName,
|
|
201572
|
+
PageMetaFields.ogTitle,
|
|
201573
|
+
PageMetaFields.ogType,
|
|
201574
|
+
PageMetaFields.ogUrl,
|
|
201575
|
+
PageMetaFields.seoAuthor,
|
|
201576
|
+
PageMetaFields.seoDescription,
|
|
201577
|
+
PageMetaFields.seoKeywords,
|
|
201578
|
+
PageMetaFields.seoRobots,
|
|
201579
|
+
PageMetaFields.seoTitle,
|
|
201580
|
+
PageMetaFields.xCard,
|
|
201581
|
+
PageMetaFields.xSite,
|
|
201582
|
+
PageMetaFields.xUrl
|
|
201583
|
+
]).ogImage()
|
|
201584
|
+
)
|
|
201585
|
+
));
|
|
201586
|
+
if (!page) {
|
|
201587
|
+
throw Error("没有找到要导入的页面");
|
|
201588
|
+
}
|
|
201589
|
+
const overrideId = (_a3 = pages == null ? void 0 : pages.find((p2) => p2.slug === page.slug)) == null ? void 0 : _a3.id;
|
|
201590
|
+
await importOnePage(page, overrideId);
|
|
201552
201591
|
}
|
|
201553
|
-
const task2 = new ImportPagesTask(
|
|
201554
|
-
{
|
|
201555
|
-
key: IMPORT_PAGES_KEY,
|
|
201556
|
-
ids,
|
|
201557
|
-
entifyClient,
|
|
201558
|
-
needTranslate,
|
|
201559
|
-
themeId: theme == null ? void 0 : theme.id,
|
|
201560
|
-
lang,
|
|
201561
|
-
aiUrl
|
|
201562
|
-
},
|
|
201563
|
-
pages || []
|
|
201564
|
-
);
|
|
201565
|
-
taskPool[task2.id] = task2;
|
|
201566
|
-
task2.onDataChange(handleTaskChange);
|
|
201567
|
-
task2.start();
|
|
201568
201592
|
},
|
|
201569
|
-
[
|
|
201593
|
+
[entifyClient, importOnePage, pages, theme == null ? void 0 : theme.id]
|
|
201570
201594
|
);
|
|
201571
|
-
return
|
|
201595
|
+
return importPages;
|
|
201572
201596
|
}
|
|
201573
201597
|
function PagesModalContent(props) {
|
|
201574
|
-
var _a3, _b3, _c2, _d2
|
|
201598
|
+
var _a3, _b3, _c2, _d2;
|
|
201575
201599
|
const { onClose } = props;
|
|
201576
201600
|
const pages = usePages();
|
|
201577
201601
|
const isBaseLangTheme = useIsBaseLangTheme();
|
|
201602
|
+
const [importing, setImporting] = useState(false);
|
|
201578
201603
|
const currentLang = useCurrentLang();
|
|
201579
201604
|
const parentTheme = useParentTheme();
|
|
201580
201605
|
const [pagesToImport, setPagesToImport] = useState();
|
|
201581
201606
|
const [confirmTitle, setConfirmTitle] = useState(
|
|
201582
201607
|
void 0
|
|
201583
201608
|
);
|
|
201584
|
-
const
|
|
201609
|
+
const importPages = usePagesImport();
|
|
201610
|
+
const tranlatePages = useTranslateCustomizedPages();
|
|
201585
201611
|
const data = useListData();
|
|
201586
201612
|
const [selection, setSelections] = useSelectionsState() || [];
|
|
201587
|
-
useEffect(() => {
|
|
201588
|
-
var _a4;
|
|
201589
|
-
setSelections == null ? void 0 : setSelections((_a4 = taskState == null ? void 0 : taskState.data) == null ? void 0 : _a4.ids);
|
|
201590
|
-
}, [setSelections, taskState == null ? void 0 : taskState.data]);
|
|
201591
201613
|
const confirmResolveRef = useRef();
|
|
201592
|
-
const importing = (taskState == null ? void 0 : taskState.status) === "in-progress";
|
|
201593
|
-
useEffect(() => {
|
|
201594
|
-
if ((taskState == null ? void 0 : taskState.status) === "done") {
|
|
201595
|
-
setSelections == null ? void 0 : setSelections([]);
|
|
201596
|
-
}
|
|
201597
|
-
}, [setSelections, taskState]);
|
|
201598
201614
|
useEffect(() => {
|
|
201599
201615
|
var _a4;
|
|
201600
|
-
|
|
201601
|
-
|
|
201602
|
-
|
|
201603
|
-
|
|
201604
|
-
}
|
|
201605
|
-
}, [selection, data == null ? void 0 : data.items, setPagesToImport, taskState == null ? void 0 : taskState.status, importing]);
|
|
201616
|
+
setPagesToImport(
|
|
201617
|
+
((_a4 = data == null ? void 0 : data.items) == null ? void 0 : _a4.filter((item) => selection == null ? void 0 : selection.includes((item == null ? void 0 : item.id) || ""))) || []
|
|
201618
|
+
);
|
|
201619
|
+
}, [selection, data == null ? void 0 : data.items, setPagesToImport]);
|
|
201606
201620
|
const cols = useMemo(() => {
|
|
201607
201621
|
return [
|
|
201608
201622
|
{
|
|
@@ -201645,22 +201659,41 @@ function PagesModalContent(props) {
|
|
|
201645
201659
|
return;
|
|
201646
201660
|
}
|
|
201647
201661
|
}
|
|
201648
|
-
|
|
201662
|
+
if (!(currentLang == null ? void 0 : currentLang.id)) {
|
|
201663
|
+
throw new Error("当前语言ID不能为空");
|
|
201664
|
+
}
|
|
201665
|
+
setImporting(true);
|
|
201666
|
+
if (needTranslate) {
|
|
201667
|
+
await tranlatePages((currentLang == null ? void 0 : currentLang.id) || "", selection || []);
|
|
201668
|
+
addToast({
|
|
201669
|
+
title: "成功添加导入任务",
|
|
201670
|
+
color: "success"
|
|
201671
|
+
});
|
|
201672
|
+
} else {
|
|
201673
|
+
await importPages(selection || []);
|
|
201674
|
+
}
|
|
201675
|
+
onClose == null ? void 0 : onClose();
|
|
201649
201676
|
} catch (error) {
|
|
201650
201677
|
console.error("导入页面时出错:", error);
|
|
201651
|
-
|
|
201678
|
+
addToast({
|
|
201679
|
+
title: "导入页面时出错:" + (error == null ? void 0 : error.message),
|
|
201680
|
+
color: "danger"
|
|
201681
|
+
});
|
|
201652
201682
|
} finally {
|
|
201653
201683
|
setPagesToImport([]);
|
|
201654
201684
|
setSelections == null ? void 0 : setSelections(void 0);
|
|
201685
|
+
setImporting(false);
|
|
201655
201686
|
}
|
|
201656
201687
|
}, [
|
|
201657
201688
|
pages,
|
|
201658
|
-
|
|
201659
|
-
selection,
|
|
201689
|
+
currentLang == null ? void 0 : currentLang.id,
|
|
201660
201690
|
needTranslate,
|
|
201691
|
+
onClose,
|
|
201661
201692
|
pagesToImport,
|
|
201662
201693
|
confirmOverride,
|
|
201663
|
-
|
|
201694
|
+
tranlatePages,
|
|
201695
|
+
selection,
|
|
201696
|
+
importPages,
|
|
201664
201697
|
setSelections
|
|
201665
201698
|
]);
|
|
201666
201699
|
const handleConfirm = useCallback(() => {
|
|
@@ -201685,30 +201718,15 @@ function PagesModalContent(props) {
|
|
|
201685
201718
|
columns: cols,
|
|
201686
201719
|
selectionMode: "multiple",
|
|
201687
201720
|
removeWrapper: true,
|
|
201688
|
-
disabledKeys: importing ? (_c2 = data == null ? void 0 : data.items) == null ? void 0 : _c2.map((item) => (item == null ? void 0 : item.id) || "") : [],
|
|
201689
201721
|
bottomContent: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
201690
|
-
!!((
|
|
201722
|
+
!!((_c2 = data == null ? void 0 : data.items) == null ? void 0 : _c2.length) && ((_d2 = data == null ? void 0 : data.items) == null ? void 0 : _d2.length) < (data.total || 0) && /* @__PURE__ */ jsxRuntimeExports.jsx(Divider, { className: "opacity-30" }),
|
|
201691
201723
|
/* @__PURE__ */ jsxRuntimeExports.jsx(EntityPagination, {})
|
|
201692
201724
|
] })
|
|
201693
201725
|
}
|
|
201694
201726
|
) }),
|
|
201695
201727
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Divider, {}),
|
|
201696
201728
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(ModalFooter, { className: "justify-between", children: [
|
|
201697
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
201698
|
-
taskState == null ? void 0 : taskState.infoMessage,
|
|
201699
|
-
(taskState == null ? void 0 : taskState.status) === "in-progress" && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
201700
|
-
Button$2,
|
|
201701
|
-
{
|
|
201702
|
-
variant: "light",
|
|
201703
|
-
size: "sm",
|
|
201704
|
-
isIconOnly: true,
|
|
201705
|
-
onPress: () => {
|
|
201706
|
-
task == null ? void 0 : task.stop();
|
|
201707
|
-
},
|
|
201708
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(TaskStopIcon, { className: "size-9 text-primary" })
|
|
201709
|
-
}
|
|
201710
|
-
)
|
|
201711
|
-
] }),
|
|
201729
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-default-500 flex items-center gap-2" }),
|
|
201712
201730
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-1", children: [
|
|
201713
201731
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
201714
201732
|
Button$2,
|
|
@@ -203054,23 +203072,10 @@ function useTranlateComponents() {
|
|
|
203054
203072
|
const translateRequest = useTranslateRequest();
|
|
203055
203073
|
const translate = useCallback(
|
|
203056
203074
|
async (langId, ids) => {
|
|
203057
|
-
return await translateRequest(
|
|
203058
|
-
|
|
203059
|
-
|
|
203060
|
-
|
|
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
|
-
}
|
|
203073
|
-
);
|
|
203075
|
+
return await translateRequest("/api/studio/translate-components", {
|
|
203076
|
+
targetLangId: langId,
|
|
203077
|
+
sourceComponentIds: ids
|
|
203078
|
+
});
|
|
203074
203079
|
},
|
|
203075
203080
|
[translateRequest]
|
|
203076
203081
|
);
|
|
@@ -204697,4 +204702,4 @@ export {
|
|
|
204697
204702
|
typescriptDefaults as t,
|
|
204698
204703
|
useCustomizedMaterials as u
|
|
204699
204704
|
};
|
|
204700
|
-
//# sourceMappingURL=index-
|
|
204705
|
+
//# sourceMappingURL=index-a0e7f111.js.map
|