@digi-frontend/dgate-api-documentation 4.0.3 → 4.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  import { create } from "zustand";
2
2
  import { devtools } from "zustand/middleware";
3
3
  import { immer } from "zustand/middleware/immer";
4
- import { useEffect, useMemo, useRef, useState } from "react";
5
- import { Alert, Breadcrumb, Button, Card, Col, Divider, Drawer, Empty, Flex, Form, Grid, Input, Modal, Pagination, Row, Select, Switch, Table, Tabs, Tag, Tooltip, Tree, Typography, message, theme } from "antd";
4
+ import { useEffect, useId, useMemo, useRef, useState } from "react";
5
+ import { Alert, Breadcrumb, Button, Card, Col, Divider, Drawer, Empty, Flex, Form, Grid, Input, Menu, Modal, Pagination, Row, Select, Switch, Table, Tabs, Tag, Tooltip, Tree, Typography, message, theme } from "antd";
6
6
  import { useStyleRegister } from "@ant-design/cssinjs";
7
7
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
8
  import Text from "antd/es/typography/Text.js";
9
- import { AppstoreOutlined, BarsOutlined, CheckCircleOutlined, DownOutlined, EditOutlined, ExclamationCircleFilled, EyeOutlined, InfoCircleOutlined, LeftOutlined, MinusSquareOutlined, PlusOutlined, PlusSquareOutlined, RightOutlined, SafetyOutlined, SearchOutlined, UpCircleOutlined } from "@ant-design/icons";
9
+ import { AppstoreOutlined, BarsOutlined, CheckCircleOutlined, CloseCircleOutlined, DownOutlined, EditOutlined, ExclamationCircleFilled, ExclamationCircleOutlined, EyeOutlined, InfoCircleOutlined, LeftOutlined, MinusSquareOutlined, PlusOutlined, PlusSquareOutlined, RightOutlined, SafetyOutlined, SearchOutlined, TagOutlined, UpCircleOutlined } from "@ant-design/icons";
10
10
  import { Resizable } from "re-resizable";
11
11
  import Title from "antd/es/typography/Title.js";
12
12
  import { Light } from "react-syntax-highlighter";
@@ -608,7 +608,8 @@ const getSidebarStyles$1 = (token, scope) => ({
608
608
  backgroundColor: token.colorBgContainer,
609
609
  overflowY: "auto",
610
610
  overflowX: "clip",
611
- borderRadius: token.borderRadius
611
+ borderRadius: token.borderRadius,
612
+ height: "100%"
612
613
  },
613
614
  [scope("content")]: { padding: token.padding },
614
615
  [scope("controls")]: {
@@ -1068,8 +1069,8 @@ const Sidebar$1 = ({ searchValue, setSearchValue }) => {
1068
1069
  };
1069
1070
  return wrapSSR(/* @__PURE__ */ jsx(Resizable, {
1070
1071
  as: "aside",
1071
- minWidth: 300,
1072
- maxWidth: 386,
1072
+ minWidth: 240,
1073
+ maxWidth: 240,
1073
1074
  enable: {
1074
1075
  top: false,
1075
1076
  right: true,
@@ -1081,7 +1082,7 @@ const Sidebar$1 = ({ searchValue, setSearchValue }) => {
1081
1082
  topLeft: false
1082
1083
  },
1083
1084
  defaultSize: {
1084
- width: 333,
1085
+ width: 240,
1085
1086
  height: "100%"
1086
1087
  },
1087
1088
  className: cx("sider"),
@@ -1731,7 +1732,7 @@ const requestColumns$1 = [
1731
1732
  }
1732
1733
  ];
1733
1734
  const responseColumns$1 = [...requestColumns$1];
1734
- const buildRequestData$1 = (params) => [...params].sort((a, b) => a.required === b.required ? 0 : a.required ? -1 : 1).map((p, index) => {
1735
+ const buildRequestData$1 = (params, colors) => [...params].sort((a, b) => a.required === b.required ? 0 : a.required ? -1 : 1).map((p, index) => {
1735
1736
  let typeLabel = p.schema?.type;
1736
1737
  if (p.schema?.type === "array" && p.schema?.items?.type) typeLabel = `${p.schema.type}_${p.schema.items.type}`;
1737
1738
  return {
@@ -1740,17 +1741,17 @@ const buildRequestData$1 = (params) => [...params].sort((a, b) => a.required ===
1740
1741
  p.name,
1741
1742
  typeLabel && /* @__PURE__ */ jsx("span", {
1742
1743
  style: {
1743
- color: "rgba(0,0,0,0.45)",
1744
+ color: colors.typeLabel,
1744
1745
  marginLeft: "0.25rem",
1745
1746
  marginRight: "0.25rem"
1746
1747
  },
1747
1748
  children: typeLabel
1748
1749
  }),
1749
1750
  p.required ? /* @__PURE__ */ jsx("span", {
1750
- style: { color: "red" },
1751
+ style: { color: colors.required },
1751
1752
  children: "*"
1752
1753
  }) : /* @__PURE__ */ jsx("span", {
1753
- style: { color: "#52C41A" },
1754
+ style: { color: colors.optional },
1754
1755
  children: "Optional"
1755
1756
  })
1756
1757
  ] }),
@@ -1758,7 +1759,7 @@ const buildRequestData$1 = (params) => [...params].sort((a, b) => a.required ===
1758
1759
  enum: p.schema?.enum ? p.schema.enum.map((e) => /* @__PURE__ */ jsx(Tag, { children: e }, e)) : "--"
1759
1760
  };
1760
1761
  });
1761
- const buildHeaderData$1 = (headers) => {
1762
+ const buildHeaderData$1 = (headers, colors) => {
1762
1763
  if (!headers) return [];
1763
1764
  return Object.entries(headers).sort(([, a], [, b]) => a.required === b.required ? 0 : a.required ? -1 : 1).map(([name, header], idx) => {
1764
1765
  let typeLabel = header.schema?.type;
@@ -1769,17 +1770,17 @@ const buildHeaderData$1 = (headers) => {
1769
1770
  name,
1770
1771
  typeLabel && /* @__PURE__ */ jsx("span", {
1771
1772
  style: {
1772
- color: "rgba(0,0,0,0.45)",
1773
+ color: colors.typeLabel,
1773
1774
  marginLeft: "0.25rem",
1774
1775
  marginRight: "0.25rem"
1775
1776
  },
1776
1777
  children: typeLabel
1777
1778
  }),
1778
1779
  header.required ? /* @__PURE__ */ jsx("span", {
1779
- style: { color: "red" },
1780
+ style: { color: colors.required },
1780
1781
  children: "*"
1781
1782
  }) : /* @__PURE__ */ jsx("span", {
1782
- style: { color: "#52C41A" },
1783
+ style: { color: colors.optional },
1783
1784
  children: "Optional"
1784
1785
  })
1785
1786
  ] }, idx),
@@ -1792,17 +1793,13 @@ const EndpointPage$1 = () => {
1792
1793
  const { selectedEndpoint, selectedApi, selectedStatusCode, setSelectedNodeKey, setFocusedContent, setFocusedTag } = useStore(({ view }) => view);
1793
1794
  const [endpointTooltip, setEndpointTooltip] = useState("Copy endpoint");
1794
1795
  const [selectedServer, setSelectedServer] = useState(0);
1795
- const { cx } = useStyle("EndpointPage", (token, scope) => ({
1796
+ const { cx, token } = useStyle("EndpointPage", (token, scope) => ({
1796
1797
  [scope("docs-endpoint-container")]: {
1797
1798
  display: "flex",
1798
1799
  flexDirection: "column",
1799
- gap: token.marginLG,
1800
- height: "100%"
1801
- },
1802
- [scope("content")]: {
1803
- width: "100%",
1804
- height: "100%"
1800
+ gap: token.marginLG
1805
1801
  },
1802
+ [scope("content")]: { width: "100%" },
1806
1803
  [scope("code")]: {
1807
1804
  background: "unset",
1808
1805
  borderRadius: token.borderRadius,
@@ -1826,12 +1823,19 @@ const EndpointPage$1 = () => {
1826
1823
  padding: "0px 0.75rem 0.75rem 0.75rem",
1827
1824
  ".ant-tabs-tab": { paddingTop: "0" }
1828
1825
  }
1829
- }
1826
+ },
1827
+ [scope("row-odd")]: { "& > td": { background: `${token.colorBgLayout} !important` } },
1828
+ [scope("row-even")]: { "& > td": { background: `${token.colorBgContainer} !important` } }
1830
1829
  }));
1831
1830
  const methodStyle = methodColors$1[selectedEndpoint?.method];
1832
- const headerParams = buildRequestData$1(selectedEndpoint?.parameters?.filter((p) => p.in === "header") || []);
1833
- const pathParams = buildRequestData$1(selectedEndpoint?.parameters?.filter((p) => p.in === "path") || []);
1834
- const queryParams = buildRequestData$1(selectedEndpoint?.parameters?.filter((p) => p.in === "query") || []);
1831
+ const paramColors = {
1832
+ typeLabel: token.colorTextQuaternary,
1833
+ required: token.colorError,
1834
+ optional: token.colorSuccess
1835
+ };
1836
+ const headerParams = buildRequestData$1(selectedEndpoint?.parameters?.filter((p) => p.in === "header") || [], paramColors);
1837
+ const pathParams = buildRequestData$1(selectedEndpoint?.parameters?.filter((p) => p.in === "path") || [], paramColors);
1838
+ const queryParams = buildRequestData$1(selectedEndpoint?.parameters?.filter((p) => p.in === "query") || [], paramColors);
1835
1839
  const requestTabs = [
1836
1840
  {
1837
1841
  key: "header",
@@ -1841,7 +1845,8 @@ const EndpointPage$1 = () => {
1841
1845
  dataSource: headerParams,
1842
1846
  pagination: false,
1843
1847
  bordered: true,
1844
- size: "small"
1848
+ size: "small",
1849
+ rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-odd" : "row-even")
1845
1850
  })
1846
1851
  },
1847
1852
  {
@@ -1852,7 +1857,8 @@ const EndpointPage$1 = () => {
1852
1857
  dataSource: pathParams,
1853
1858
  pagination: false,
1854
1859
  bordered: true,
1855
- size: "small"
1860
+ size: "small",
1861
+ rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-odd" : "row-even")
1856
1862
  })
1857
1863
  },
1858
1864
  {
@@ -1863,12 +1869,13 @@ const EndpointPage$1 = () => {
1863
1869
  dataSource: queryParams,
1864
1870
  pagination: false,
1865
1871
  bordered: true,
1866
- size: "small"
1872
+ size: "small",
1873
+ rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-odd" : "row-even")
1867
1874
  })
1868
1875
  }
1869
1876
  ].filter((t) => t !== null);
1870
1877
  const responseHeaders = (selectedEndpoint?.responses?.[selectedStatusCode || 200])?.headers;
1871
- const responseHeaderData = buildHeaderData$1(responseHeaders);
1878
+ const responseHeaderData = buildHeaderData$1(responseHeaders, paramColors);
1872
1879
  selectedApi?.servers?.map((server, index) => ({
1873
1880
  value: index,
1874
1881
  label: `${server.url}${selectedEndpoint?.path || ""}`
@@ -1912,7 +1919,7 @@ const EndpointPage$1 = () => {
1912
1919
  display: "flex",
1913
1920
  flexDirection: "row",
1914
1921
  alignItems: "center",
1915
- color: "rgba(0,0,0,0.45)",
1922
+ color: token.colorTextQuaternary,
1916
1923
  gap: "0.25rem"
1917
1924
  },
1918
1925
  children: /* @__PURE__ */ jsx("span", { children: selectedEndpoint?.tagName || "default" })
@@ -1977,7 +1984,8 @@ const EndpointPage$1 = () => {
1977
1984
  dataSource: responseHeaderData,
1978
1985
  pagination: false,
1979
1986
  bordered: true,
1980
- size: "small"
1987
+ size: "small",
1988
+ rowClassName: (_, idx) => cx(idx % 2 === 0 ? "row-odd" : "row-even")
1981
1989
  })
1982
1990
  })
1983
1991
  ]
@@ -2014,9 +2022,9 @@ const MainContent$1 = ({ searchEnabled, handleResetSearch, handleVisitLandingPag
2014
2022
  const { wrapSSR, cx, token } = useStyle("MainContent", (token, scope) => ({
2015
2023
  [scope("inner-doc-container")]: {
2016
2024
  backgroundColor: token.colorBgContainer,
2025
+ flex: 1,
2026
+ minWidth: 0,
2017
2027
  height: "100%",
2018
- width: "100%",
2019
- maxHeight: "100%",
2020
2028
  overflow: "auto",
2021
2029
  borderRadius: token.borderRadius,
2022
2030
  padding: token.paddingXL
@@ -2102,7 +2110,7 @@ const MainContent$1 = ({ searchEnabled, handleResetSearch, handleVisitLandingPag
2102
2110
  //#region src/view/components/ApiPage/components/ApiDocumentationBar.tsx
2103
2111
  const { useBreakpoint: useBreakpoint$4 } = Grid;
2104
2112
  const { Title: Title$2 } = Typography;
2105
- const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, hasChanges = false, switcherNode }) => {
2113
+ const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, hasChanges = false, hasErrors = false, switcherNode }) => {
2106
2114
  const isMobile = !useBreakpoint$4().md;
2107
2115
  const { wrapSSR, cx, token } = useStyle("ApiDocumentationBar", (token, scope) => ({
2108
2116
  [scope("root")]: {
@@ -2238,7 +2246,7 @@ const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, has
2238
2246
  }), /* @__PURE__ */ jsx(Button, {
2239
2247
  size: "large",
2240
2248
  type: "primary",
2241
- disabled: !hasChanges,
2249
+ disabled: !hasChanges || hasErrors,
2242
2250
  onClick: onSave,
2243
2251
  children: "Save"
2244
2252
  })]
@@ -2296,7 +2304,7 @@ const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, has
2296
2304
  }), /* @__PURE__ */ jsx(Button, {
2297
2305
  size: "large",
2298
2306
  type: "primary",
2299
- disabled: !hasChanges,
2307
+ disabled: !hasChanges || hasErrors,
2300
2308
  onClick: onSave,
2301
2309
  children: "Save & Publish Changes"
2302
2310
  })]
@@ -2307,14 +2315,16 @@ const ApiDocumentationBar = ({ apiName, mode, onModeChange, onReset, onSave, has
2307
2315
  //#endregion
2308
2316
  //#region src/view/components/ApiPage/components/GeneralSection.tsx
2309
2317
  const { useBreakpoint: useBreakpoint$3 } = Grid;
2310
- const GeneralSection = ({ apiName, authType, version, description, onApiNameChange, onDescriptionChange, collapsed = false, onToggleCollapse, onChangeDetected }) => {
2318
+ const GeneralSection = ({ apiName, authType, version, description, onApiNameChange, onDescriptionChange, onChangeDetected, collapsed, onToggleCollapse, apiNameError, descriptionError }) => {
2311
2319
  const isMobile = !useBreakpoint$3().md;
2312
2320
  const { wrapSSR, cx, token } = useStyle("GeneralSection", (token, scope) => ({
2313
2321
  [scope("root")]: {
2314
2322
  display: "flex",
2315
2323
  flexDirection: "column",
2316
- borderRadius: token.borderRadius,
2317
- overflow: "hidden",
2324
+ gap: token.margin,
2325
+ padding: `${token.marginLG}px ${token.marginLG}px 48px`,
2326
+ background: token.colorBgElevated,
2327
+ borderRadius: token.borderRadiusLG,
2318
2328
  width: "100%"
2319
2329
  },
2320
2330
  [scope("head")]: {
@@ -2328,15 +2338,20 @@ const GeneralSection = ({ apiName, authType, version, description, onApiNameChan
2328
2338
  [scope("body")]: {
2329
2339
  display: "flex",
2330
2340
  flexDirection: "column",
2331
- gap: token.paddingLG,
2341
+ gap: token.margin,
2332
2342
  padding: token.paddingLG,
2333
- paddingBottom: token.paddingXXL ?? 48,
2334
2343
  background: token.colorBgElevated,
2335
2344
  borderRadius: `0 0 ${token.borderRadius}px ${token.borderRadius}px`
2336
2345
  },
2346
+ [scope("fields")]: {
2347
+ display: "flex",
2348
+ flexDirection: "column",
2349
+ gap: token.margin,
2350
+ width: "100%"
2351
+ },
2337
2352
  [scope("row")]: {
2338
2353
  display: "flex",
2339
- gap: token.paddingLG,
2354
+ gap: token.margin,
2340
2355
  width: "100%"
2341
2356
  },
2342
2357
  [scope("field")]: {
@@ -2355,108 +2370,91 @@ const GeneralSection = ({ apiName, authType, version, description, onApiNameChan
2355
2370
  paddingBottom: token.paddingXS,
2356
2371
  lineHeight: "22px"
2357
2372
  },
2358
- [scope("label-required")]: {
2373
+ [scope("required")]: {
2359
2374
  color: token.colorError,
2360
2375
  fontSize: token.fontSize
2361
- },
2362
- [scope("count")]: {
2363
- alignSelf: "flex-end",
2364
- fontSize: token.fontSize,
2365
- color: token.colorTextDescription,
2366
- marginTop: token.marginXXS
2367
2376
  }
2368
2377
  }));
2369
- return wrapSSR(/* @__PURE__ */ jsxs("div", {
2370
- className: cx("root"),
2371
- children: [/* @__PURE__ */ jsxs("div", {
2372
- className: cx("head"),
2373
- children: [/* @__PURE__ */ jsx(Title, {
2374
- level: 4,
2375
- style: {
2376
- margin: 0,
2377
- color: token.colorTextHeading
2378
- },
2379
- children: "General"
2380
- }), /* @__PURE__ */ jsx(Button, {
2381
- type: "text",
2382
- size: "large",
2383
- icon: /* @__PURE__ */ jsx(UpCircleOutlined, { style: { fontSize: 18 } }),
2384
- onClick: onToggleCollapse,
2385
- style: {
2386
- transform: collapsed ? "rotate(180deg)" : "rotate(0deg)",
2387
- transition: "transform 0.2s"
2388
- }
2389
- })]
2390
- }), !collapsed && /* @__PURE__ */ jsxs("div", {
2391
- className: cx("body"),
2392
- style: isMobile ? {
2393
- padding: token.paddingMD,
2394
- paddingBottom: token.paddingXXL ?? 48
2395
- } : void 0,
2396
- children: [/* @__PURE__ */ jsxs("div", {
2378
+ const fieldsContent = /* @__PURE__ */ jsxs("div", {
2379
+ className: cx("fields"),
2380
+ children: [
2381
+ /* @__PURE__ */ jsxs("div", {
2382
+ className: cx("field"),
2383
+ children: [/* @__PURE__ */ jsxs("div", {
2384
+ className: cx("label"),
2385
+ children: [/* @__PURE__ */ jsx("span", { children: "API Name" }), /* @__PURE__ */ jsx("span", {
2386
+ className: cx("required"),
2387
+ children: "*"
2388
+ })]
2389
+ }), /* @__PURE__ */ jsx(Input, {
2390
+ size: "large",
2391
+ value: apiName,
2392
+ status: apiNameError ? "error" : void 0,
2393
+ suffix: apiNameError ? /* @__PURE__ */ jsx(CloseCircleOutlined, {
2394
+ style: {
2395
+ color: token.colorError,
2396
+ cursor: "pointer"
2397
+ },
2398
+ onClick: () => {
2399
+ onApiNameChange("");
2400
+ onChangeDetected?.();
2401
+ }
2402
+ }) : void 0,
2403
+ onChange: (e) => {
2404
+ onApiNameChange(e.target.value);
2405
+ onChangeDetected?.();
2406
+ },
2407
+ maxLength: 100,
2408
+ showCount: true
2409
+ })]
2410
+ }),
2411
+ /* @__PURE__ */ jsxs("div", {
2397
2412
  className: cx("row"),
2398
2413
  style: isMobile ? { flexDirection: "column" } : void 0,
2399
- children: [
2400
- /* @__PURE__ */ jsxs("div", {
2401
- className: cx("field"),
2402
- children: [/* @__PURE__ */ jsxs("div", {
2403
- className: cx("label"),
2404
- children: [/* @__PURE__ */ jsx("span", { children: "API Name" }), /* @__PURE__ */ jsx("span", {
2405
- className: cx("label-required"),
2406
- children: "*"
2407
- })]
2408
- }), /* @__PURE__ */ jsx(Input, {
2409
- size: "large",
2410
- value: apiName,
2411
- onChange: (e) => {
2412
- onApiNameChange(e.target.value);
2413
- onChangeDetected?.();
2414
- },
2415
- maxLength: 35,
2416
- showCount: true
2417
- })]
2418
- }),
2419
- /* @__PURE__ */ jsxs("div", {
2420
- className: cx("field"),
2421
- children: [/* @__PURE__ */ jsxs("div", {
2422
- className: cx("label"),
2423
- children: [/* @__PURE__ */ jsx("span", { children: "Authentication Type" }), /* @__PURE__ */ jsx("span", {
2424
- className: cx("label-required"),
2425
- children: "*"
2426
- })]
2427
- }), /* @__PURE__ */ jsx(Input, {
2428
- size: "large",
2429
- value: authType,
2430
- disabled: true
2414
+ children: [/* @__PURE__ */ jsxs("div", {
2415
+ className: cx("field"),
2416
+ style: isMobile ? void 0 : {
2417
+ flex: "none",
2418
+ width: 436
2419
+ },
2420
+ children: [/* @__PURE__ */ jsxs("div", {
2421
+ className: cx("label"),
2422
+ children: [/* @__PURE__ */ jsx("span", { children: "Authentication Type" }), /* @__PURE__ */ jsx("span", {
2423
+ className: cx("required"),
2424
+ children: "*"
2431
2425
  })]
2432
- }),
2433
- /* @__PURE__ */ jsxs("div", {
2434
- className: cx("field"),
2435
- children: [/* @__PURE__ */ jsxs("div", {
2436
- className: cx("label"),
2437
- children: [/* @__PURE__ */ jsx("span", { children: "Version" }), /* @__PURE__ */ jsx("span", {
2438
- className: cx("label-required"),
2439
- children: "*"
2440
- })]
2441
- }), /* @__PURE__ */ jsx(Input, {
2442
- size: "large",
2443
- value: version,
2444
- disabled: true
2426
+ }), /* @__PURE__ */ jsx(Input, {
2427
+ size: "large",
2428
+ value: authType,
2429
+ disabled: true
2430
+ })]
2431
+ }), /* @__PURE__ */ jsxs("div", {
2432
+ className: cx("field"),
2433
+ children: [/* @__PURE__ */ jsxs("div", {
2434
+ className: cx("label"),
2435
+ children: [/* @__PURE__ */ jsx("span", { children: "Version" }), /* @__PURE__ */ jsx("span", {
2436
+ className: cx("required"),
2437
+ children: "*"
2445
2438
  })]
2446
- })
2447
- ]
2448
- }), /* @__PURE__ */ jsxs("div", {
2439
+ }), /* @__PURE__ */ jsx(Input, {
2440
+ size: "large",
2441
+ value: version,
2442
+ disabled: true
2443
+ })]
2444
+ })]
2445
+ }),
2446
+ /* @__PURE__ */ jsxs("div", {
2449
2447
  className: cx("field"),
2450
- style: { width: "100%" },
2451
2448
  children: [/* @__PURE__ */ jsxs("div", {
2452
2449
  className: cx("label"),
2453
2450
  children: [/* @__PURE__ */ jsx("span", { children: "Description" }), /* @__PURE__ */ jsx("span", {
2454
- className: cx("label-required"),
2451
+ className: cx("required"),
2455
2452
  children: "*"
2456
2453
  })]
2457
2454
  }), /* @__PURE__ */ jsx(Input.TextArea, {
2458
2455
  size: "large",
2459
2456
  value: description,
2457
+ status: descriptionError ? "error" : void 0,
2460
2458
  onChange: (e) => {
2461
2459
  onDescriptionChange(e.target.value);
2462
2460
  onChangeDetected?.();
@@ -2468,64 +2466,138 @@ const GeneralSection = ({ apiName, authType, version, description, onApiNameChan
2468
2466
  resize: "vertical"
2469
2467
  }
2470
2468
  })]
2469
+ })
2470
+ ]
2471
+ });
2472
+ return wrapSSR(isMobile ? /* @__PURE__ */ jsxs("div", {
2473
+ style: { width: "100%" },
2474
+ children: [/* @__PURE__ */ jsxs("div", {
2475
+ className: cx("head"),
2476
+ children: [/* @__PURE__ */ jsx(Title, {
2477
+ level: 4,
2478
+ style: {
2479
+ margin: 0,
2480
+ color: token.colorTextHeading
2481
+ },
2482
+ children: "General"
2483
+ }), /* @__PURE__ */ jsx(Button, {
2484
+ type: "text",
2485
+ size: "large",
2486
+ icon: /* @__PURE__ */ jsx(UpCircleOutlined, { style: { fontSize: 18 } }),
2487
+ onClick: onToggleCollapse,
2488
+ style: {
2489
+ transform: collapsed ? "rotate(180deg)" : "rotate(0deg)",
2490
+ transition: "transform 0.2s"
2491
+ }
2471
2492
  })]
2493
+ }), !collapsed && /* @__PURE__ */ jsx("div", {
2494
+ className: cx("body"),
2495
+ children: fieldsContent
2472
2496
  })]
2497
+ }) : /* @__PURE__ */ jsxs("div", {
2498
+ className: cx("root"),
2499
+ children: [/* @__PURE__ */ jsx(Title, {
2500
+ level: 4,
2501
+ style: {
2502
+ margin: 0,
2503
+ color: token.colorTextHeading
2504
+ },
2505
+ children: "General"
2506
+ }), fieldsContent]
2473
2507
  }));
2474
2508
  };
2475
2509
  //#endregion
2476
2510
  //#region src/assets/trash.tsx
2477
- const Trash = (props) => /* @__PURE__ */ jsxs("svg", {
2478
- viewBox: "0 0 40 40",
2511
+ const Trash = (props) => {
2512
+ const maskId = `trash-mask-${useId()}`;
2513
+ return /* @__PURE__ */ jsxs("svg", {
2514
+ viewBox: "0 0 40 40",
2515
+ fill: "none",
2516
+ xmlns: "http://www.w3.org/2000/svg",
2517
+ ...props,
2518
+ children: [
2519
+ /* @__PURE__ */ jsx("mask", {
2520
+ id: maskId,
2521
+ fill: "white",
2522
+ children: /* @__PURE__ */ jsx("path", { d: "M0 8C0 3.58172 3.58172 0 8 0H32C36.4183 0 40 3.58172 40 8V32C40 36.4183 36.4183 40 32 40H8C3.58172 40 0 36.4183 0 32V8Z" })
2523
+ }),
2524
+ /* @__PURE__ */ jsx("path", {
2525
+ d: "M8 0V1H32V0V-1H8V0ZM40 8H39V32H40H41V8H40ZM32 40V39H8V40V41H32V40ZM0 32H1V8H0H-1V32H0ZM8 40V39C4.13401 39 1 35.866 1 32H0H-1C-1 36.9706 3.02944 41 8 41V40ZM40 32H39C39 35.866 35.866 39 32 39V40V41C36.9706 41 41 36.9706 41 32H40ZM32 0V1C35.866 1 39 4.13401 39 8H40H41C41 3.02944 36.9706 -1 32 -1V0ZM8 0V-1C3.02944 -1 -1 3.02944 -1 8H0H1C1 4.13401 4.13401 1 8 1V0Z",
2526
+ fill: "currentColor",
2527
+ mask: `url(#${maskId})`
2528
+ }),
2529
+ /* @__PURE__ */ jsx("path", {
2530
+ d: "M26.75 15.4844C24.2525 15.2369 21.74 15.1094 19.235 15.1094C17.75 15.1094 16.265 15.1844 14.78 15.3344L13.25 15.4844",
2531
+ fill: "currentColor"
2532
+ }),
2533
+ /* @__PURE__ */ jsx("path", {
2534
+ d: "M26.75 15.4844C24.2525 15.2369 21.74 15.1094 19.235 15.1094C17.75 15.1094 16.265 15.1844 14.78 15.3344L13.25 15.4844",
2535
+ stroke: "currentColor",
2536
+ strokeWidth: "1.5",
2537
+ strokeLinecap: "round",
2538
+ strokeLinejoin: "round"
2539
+ }),
2540
+ /* @__PURE__ */ jsx("path", {
2541
+ d: "M17.375 14.7275L17.54 13.745C17.66 13.0325 17.75 12.5 19.0175 12.5H20.9825C22.25 12.5 22.3475 13.0625 22.46 13.7525L22.625 14.7275",
2542
+ stroke: "currentColor",
2543
+ strokeWidth: "1.5",
2544
+ strokeLinecap: "round",
2545
+ strokeLinejoin: "round"
2546
+ }),
2547
+ /* @__PURE__ */ jsx("path", {
2548
+ d: "M25.1373 17.8555L24.6498 25.408C24.5673 26.5855 24.4998 27.5005 22.4073 27.5005H17.5923C15.4998 27.5005 15.4323 26.5855 15.3498 25.408L14.8623 17.8555",
2549
+ stroke: "currentColor",
2550
+ strokeWidth: "1.5",
2551
+ strokeLinecap: "round",
2552
+ strokeLinejoin: "round"
2553
+ }),
2554
+ /* @__PURE__ */ jsx("path", {
2555
+ d: "M18.7476 23.375H21.2451",
2556
+ stroke: "currentColor",
2557
+ strokeWidth: "1.5",
2558
+ strokeLinecap: "round",
2559
+ strokeLinejoin: "round"
2560
+ }),
2561
+ /* @__PURE__ */ jsx("path", {
2562
+ d: "M18.125 20.375H21.875",
2563
+ stroke: "currentColor",
2564
+ strokeWidth: "1.5",
2565
+ strokeLinecap: "round",
2566
+ strokeLinejoin: "round"
2567
+ })
2568
+ ]
2569
+ });
2570
+ };
2571
+ //#endregion
2572
+ //#region src/assets/icons/editTag.tsx
2573
+ const EditTag = (props) => /* @__PURE__ */ jsxs("svg", {
2574
+ width: "18",
2575
+ height: "18",
2576
+ viewBox: "0 0 18 18",
2479
2577
  fill: "none",
2480
2578
  xmlns: "http://www.w3.org/2000/svg",
2481
2579
  ...props,
2482
2580
  children: [
2483
- /* @__PURE__ */ jsx("mask", {
2484
- id: "path-1-inside-1_17984_239034",
2485
- fill: "white",
2486
- children: /* @__PURE__ */ jsx("path", { d: "M0 8C0 3.58172 3.58172 0 8 0H32C36.4183 0 40 3.58172 40 8V32C40 36.4183 36.4183 40 32 40H8C3.58172 40 0 36.4183 0 32V8Z" })
2487
- }),
2488
- /* @__PURE__ */ jsx("path", {
2489
- d: "M8 0V1H32V0V-1H8V0ZM40 8H39V32H40H41V8H40ZM32 40V39H8V40V41H32V40ZM0 32H1V8H0H-1V32H0ZM8 40V39C4.13401 39 1 35.866 1 32H0H-1C-1 36.9706 3.02944 41 8 41V40ZM40 32H39C39 35.866 35.866 39 32 39V40V41C36.9706 41 41 36.9706 41 32H40ZM32 0V1C35.866 1 39 4.13401 39 8H40H41C41 3.02944 36.9706 -1 32 -1V0ZM8 0V-1C3.02944 -1 -1 3.02944 -1 8H0H1C1 4.13401 4.13401 1 8 1V0Z",
2490
- fill: "#FF4D4F",
2491
- mask: "url(#path-1-inside-1_17984_239034)"
2492
- }),
2493
- /* @__PURE__ */ jsx("path", {
2494
- d: "M26.75 15.4844C24.2525 15.2369 21.74 15.1094 19.235 15.1094C17.75 15.1094 16.265 15.1844 14.78 15.3344L13.25 15.4844",
2495
- fill: "#FF4D4F"
2496
- }),
2497
- /* @__PURE__ */ jsx("path", {
2498
- d: "M26.75 15.4844C24.2525 15.2369 21.74 15.1094 19.235 15.1094C17.75 15.1094 16.265 15.1844 14.78 15.3344L13.25 15.4844",
2499
- stroke: "#FF4D4F",
2500
- strokeWidth: "1.5",
2501
- strokeLinecap: "round",
2502
- strokeLinejoin: "round"
2503
- }),
2504
2581
  /* @__PURE__ */ jsx("path", {
2505
- d: "M17.375 14.7275L17.54 13.745C17.66 13.0325 17.75 12.5 19.0175 12.5H20.9825C22.25 12.5 22.3475 13.0625 22.46 13.7525L22.625 14.7275",
2506
- stroke: "#FF4D4F",
2582
+ d: "M8.25 1.5H6.75C3 1.5 1.5 3 1.5 6.75V11.25C1.5 15 3 16.5 6.75 16.5H11.25C15 16.5 16.5 15 16.5 11.25V9.75",
2583
+ stroke: "currentColor",
2507
2584
  strokeWidth: "1.5",
2508
2585
  strokeLinecap: "round",
2509
2586
  strokeLinejoin: "round"
2510
2587
  }),
2511
2588
  /* @__PURE__ */ jsx("path", {
2512
- d: "M25.1373 17.8555L24.6498 25.408C24.5673 26.5855 24.4998 27.5005 22.4073 27.5005H17.5923C15.4998 27.5005 15.4323 26.5855 15.3498 25.408L14.8623 17.8555",
2513
- stroke: "#FF4D4F",
2589
+ d: "M12.0299 2.26592L6.11991 8.17592C5.89491 8.40092 5.66991 8.84342 5.62491 9.16592L5.30241 11.4234C5.18241 12.2409 5.75991 12.8109 6.57741 12.6984L8.83491 12.3759C9.14991 12.3309 9.59241 12.1059 9.82491 11.8809L15.7349 5.97092C16.7549 4.95092 17.2349 3.76592 15.7349 2.26592C14.2349 0.765922 13.0499 1.24592 12.0299 2.26592Z",
2590
+ stroke: "currentColor",
2514
2591
  strokeWidth: "1.5",
2592
+ strokeMiterlimit: "10",
2515
2593
  strokeLinecap: "round",
2516
2594
  strokeLinejoin: "round"
2517
2595
  }),
2518
2596
  /* @__PURE__ */ jsx("path", {
2519
- d: "M18.7476 23.375H21.2451",
2520
- stroke: "#FF4D4F",
2521
- strokeWidth: "1.5",
2522
- strokeLinecap: "round",
2523
- strokeLinejoin: "round"
2524
- }),
2525
- /* @__PURE__ */ jsx("path", {
2526
- d: "M18.125 20.375H21.875",
2527
- stroke: "#FF4D4F",
2597
+ d: "M11.1826 3.11328C11.6851 4.90578 13.0876 6.30828 14.8876 6.81828",
2598
+ stroke: "currentColor",
2528
2599
  strokeWidth: "1.5",
2600
+ strokeMiterlimit: "10",
2529
2601
  strokeLinecap: "round",
2530
2602
  strokeLinejoin: "round"
2531
2603
  })
@@ -3177,7 +3249,8 @@ const AddParameterDrawer = ({ open, onClose, onAdd, onEdit, mode = "add", initia
3177
3249
  //#endregion
3178
3250
  //#region src/view/components/ApiPage/components/EndpointsSection.tsx
3179
3251
  const { useBreakpoint: useBreakpoint$2 } = Grid;
3180
- const PAGE_SIZE = 5;
3252
+ const PAGE_SIZE = 4;
3253
+ const VIEW_PAGE_SIZE = 4;
3181
3254
  const getStatusCodeColor = (code, token) => {
3182
3255
  const n = parseInt(code, 10);
3183
3256
  if (n >= 400 && n < 500) return {
@@ -3197,8 +3270,24 @@ const buildViewParamRows = (params) => params.map((p, idx) => ({
3197
3270
  description: p.description ?? "",
3198
3271
  enum: p.enum ?? []
3199
3272
  }));
3200
- const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse, endpointNames, endpointDescs, endpointTags, availableTags, onEndpointNameChange, onEndpointDescChange, onEndpointTagsChange, endpointParams, onAddParameter, onEditParameter, onDeleteParameter, endpointResponseParams, onAddResponseParameter, onEditResponseParameter, onDeleteResponseParameter, mode = "edit" }) => {
3273
+ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse, endpointNames, endpointDescs, endpointTags, availableTags, onEndpointNameChange, onEndpointDescChange, onEndpointTagsChange, endpointParams, onAddParameter, onEditParameter, onDeleteParameter, endpointResponseParams, onAddResponseParameter, onEditResponseParameter, onDeleteResponseParameter, mode = "edit", selectedEndpointKey }) => {
3201
3274
  const [expandedId, setExpandedId] = useState(null);
3275
+ const [activeTab, setActiveTab] = useState("general");
3276
+ useEffect(() => {
3277
+ setActiveTab("general");
3278
+ }, [selectedEndpointKey]);
3279
+ useEffect(() => {
3280
+ if (!selectedEndpointKey) return;
3281
+ if (selectedStatusCodes[selectedEndpointKey]) return;
3282
+ const ep = Object.values(endpointsByTag).flat().find((e) => e.id === selectedEndpointKey);
3283
+ if (!ep) return;
3284
+ const keys = Object.keys(ep.responses ?? {});
3285
+ const defaultCode = keys.includes("200") ? "200" : keys[0];
3286
+ if (defaultCode) setSelectedStatusCodes((prev) => ({
3287
+ ...prev,
3288
+ [selectedEndpointKey]: defaultCode
3289
+ }));
3290
+ }, [selectedEndpointKey]);
3202
3291
  const [paramDrawerOpen, setParamDrawerOpen] = useState(false);
3203
3292
  const [paramDrawerEndpointId, setParamDrawerEndpointId] = useState(null);
3204
3293
  const [paramDrawerMode, setParamDrawerMode] = useState("add");
@@ -3245,10 +3334,13 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
3245
3334
  [scope("root")]: {
3246
3335
  display: "flex",
3247
3336
  flexDirection: "column",
3248
- borderRadius: token.borderRadius,
3249
- overflow: "hidden",
3250
3337
  width: "100%",
3251
- flexShrink: 0
3338
+ flexShrink: 0,
3339
+ "& .ant-tabs-content-holder": {
3340
+ background: token.colorBgElevated,
3341
+ borderRadius: token.borderRadiusLG,
3342
+ padding: `${token.paddingLG}px ${token.paddingLG}px 48px`
3343
+ }
3252
3344
  },
3253
3345
  [scope("head")]: {
3254
3346
  display: "flex",
@@ -3297,15 +3389,12 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
3297
3389
  display: "flex",
3298
3390
  alignItems: "center",
3299
3391
  justifyContent: "center",
3300
- width: 64,
3301
- padding: `0 ${token.paddingXS}px`,
3392
+ padding: "0 15px",
3302
3393
  borderRadius: token.borderRadius,
3303
- border: "1px solid",
3304
3394
  fontSize: token.fontSize,
3305
3395
  fontWeight: 400,
3306
3396
  lineHeight: "22px",
3307
- whiteSpace: "nowrap",
3308
- alignSelf: "stretch"
3397
+ whiteSpace: "nowrap"
3309
3398
  },
3310
3399
  [scope("endpoint-path")]: {
3311
3400
  fontSize: token.fontSizeLG,
@@ -3386,7 +3475,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
3386
3475
  overflow: "hidden"
3387
3476
  },
3388
3477
  [scope("code-area")]: {
3389
- background: "#1d2856",
3478
+ background: token.colorBgSpotlight,
3390
3479
  padding: "10px 12px",
3391
3480
  fontFamily: "Cairo, sans-serif",
3392
3481
  fontSize: 14,
@@ -3398,7 +3487,7 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
3398
3487
  display: "block"
3399
3488
  },
3400
3489
  [scope("code-footer")]: {
3401
- background: "#161d40",
3490
+ background: token.colorBgSpotlight,
3402
3491
  padding: 12,
3403
3492
  borderBottomLeftRadius: 8,
3404
3493
  borderBottomRightRadius: 8,
@@ -3555,26 +3644,36 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
3555
3644
  gap: 8
3556
3645
  },
3557
3646
  [scope("param-edit-btn")]: {
3558
- width: 32,
3559
- height: 32,
3647
+ width: 40,
3648
+ height: 40,
3560
3649
  padding: 0,
3650
+ lineHeight: 1,
3561
3651
  display: "flex",
3562
3652
  alignItems: "center",
3563
3653
  justifyContent: "center",
3564
- borderColor: token.colorPrimary,
3654
+ borderRadius: 8,
3655
+ borderColor: "#D9D9D9",
3656
+ background: "#FFF !important",
3657
+ boxShadow: "0 2px 0 0 rgba(0, 0, 0, 0.02) !important",
3565
3658
  color: token.colorPrimary,
3659
+ "& .ant-btn-icon": {
3660
+ display: "flex",
3661
+ alignItems: "center",
3662
+ justifyContent: "center"
3663
+ },
3566
3664
  "&:hover": {
3567
3665
  borderColor: `${token.colorPrimary} !important`,
3568
3666
  color: `${token.colorPrimary} !important`
3569
3667
  }
3570
3668
  },
3571
3669
  [scope("param-delete-btn")]: {
3572
- width: 32,
3573
- height: 32,
3670
+ width: 40,
3671
+ height: 40,
3574
3672
  padding: 0,
3575
3673
  display: "flex",
3576
3674
  alignItems: "center",
3577
- justifyContent: "center"
3675
+ justifyContent: "center",
3676
+ "& svg path[mask]": { display: "none" }
3578
3677
  },
3579
3678
  [".delete-param-confirm-modal .ant-modal-container"]: {
3580
3679
  "--ant-modal-content-padding": "0px !important",
@@ -3898,36 +3997,1162 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
3898
3997
  }
3899
3998
  }
3900
3999
  ];
3901
- return wrapSSR(/* @__PURE__ */ jsxs("div", {
3902
- className: cx("root"),
3903
- children: [
3904
- /* @__PURE__ */ jsxs("div", {
3905
- className: cx("head"),
3906
- children: [/* @__PURE__ */ jsx(Title, {
4000
+ if (selectedEndpointKey) {
4001
+ const ep = Object.values(endpointsByTag).flat().find((e) => e.id === selectedEndpointKey);
4002
+ if (!ep) return wrapSSR(/* @__PURE__ */ jsx("div", {}));
4003
+ const methodColor = methodColors$1[ep.method];
4004
+ const epHeader = /* @__PURE__ */ jsxs("div", {
4005
+ style: {
4006
+ display: "flex",
4007
+ alignItems: "center",
4008
+ gap: token.marginXS,
4009
+ marginBottom: token.marginLG
4010
+ },
4011
+ children: [/* @__PURE__ */ jsx("span", {
4012
+ className: cx("method-badge"),
4013
+ style: {
4014
+ color: methodColor?.color,
4015
+ backgroundColor: methodColor?.bg ?? "transparent"
4016
+ },
4017
+ children: ep.method
4018
+ }), /* @__PURE__ */ jsx(Tooltip, {
4019
+ title: ep.path,
4020
+ children: /* @__PURE__ */ jsx(Title, {
3907
4021
  level: 4,
3908
4022
  style: {
3909
4023
  margin: 0,
3910
4024
  color: token.colorTextHeading
3911
4025
  },
3912
- children: "Endpoints"
3913
- }), /* @__PURE__ */ jsx(Button, {
3914
- type: "text",
3915
- size: "large",
3916
- icon: /* @__PURE__ */ jsx(UpCircleOutlined, { style: { fontSize: 18 } }),
3917
- onClick: onToggleCollapse,
3918
- style: {
3919
- transform: collapsed ? "rotate(180deg)" : "rotate(0deg)",
3920
- transition: "transform 0.2s"
3921
- }
3922
- })]
3923
- }),
3924
- !collapsed && /* @__PURE__ */ jsx("div", {
3925
- className: cx("body"),
3926
- children: Object.values(endpointsByTag).flat().map((ep) => {
3927
- const isExpanded = expandedId === ep.id;
3928
- const methodColor = methodColors$1[ep.method];
3929
- return /* @__PURE__ */ jsxs("div", { children: [
3930
- /* @__PURE__ */ jsxs("div", {
4026
+ children: ep.path
4027
+ })
4028
+ })]
4029
+ });
4030
+ return wrapSSR(/* @__PURE__ */ jsxs("div", {
4031
+ className: cx("root"),
4032
+ children: [
4033
+ /* @__PURE__ */ jsx(Tabs, {
4034
+ activeKey: activeTab,
4035
+ onChange: setActiveTab,
4036
+ tabBarStyle: {
4037
+ background: "transparent",
4038
+ padding: "0 16px",
4039
+ marginBottom: 16
4040
+ },
4041
+ tabBarGutter: 32,
4042
+ style: { borderRadius: `0 0 ${token.borderRadius}px ${token.borderRadius}px` },
4043
+ items: [
4044
+ {
4045
+ key: "general",
4046
+ label: "General",
4047
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [epHeader, /* @__PURE__ */ jsxs("div", {
4048
+ style: {
4049
+ display: "flex",
4050
+ flexDirection: "column",
4051
+ gap: token.paddingLG
4052
+ },
4053
+ children: [/* @__PURE__ */ jsxs("div", {
4054
+ className: cx("form-row"),
4055
+ style: isMobile ? { flexDirection: "column" } : void 0,
4056
+ children: [/* @__PURE__ */ jsxs("div", {
4057
+ className: cx("form-field"),
4058
+ children: [/* @__PURE__ */ jsxs("div", {
4059
+ className: cx("field-label"),
4060
+ children: [/* @__PURE__ */ jsx("span", { children: "Endpoint Name" }), /* @__PURE__ */ jsx("span", {
4061
+ className: cx("label-required"),
4062
+ children: "*"
4063
+ })]
4064
+ }), /* @__PURE__ */ jsx(Input, {
4065
+ size: "large",
4066
+ value: endpointNames[ep.id] ?? ep.summary ?? "",
4067
+ onChange: (e) => onEndpointNameChange(ep.id, e.target.value),
4068
+ maxLength: 100,
4069
+ showCount: true
4070
+ })]
4071
+ }), /* @__PURE__ */ jsxs("div", {
4072
+ className: cx("form-field"),
4073
+ children: [/* @__PURE__ */ jsx("div", {
4074
+ className: cx("field-label"),
4075
+ children: /* @__PURE__ */ jsx("span", { children: "Endpoint Tag" })
4076
+ }), /* @__PURE__ */ jsx(Select, {
4077
+ mode: "multiple",
4078
+ size: "large",
4079
+ style: { width: "100%" },
4080
+ placeholder: "Select",
4081
+ value: endpointTags[ep.id] ?? ep.tags ?? [],
4082
+ options: availableTags.map((t) => ({
4083
+ label: t,
4084
+ value: t
4085
+ })),
4086
+ onChange: (val) => onEndpointTagsChange(ep.id, val)
4087
+ })]
4088
+ })]
4089
+ }), /* @__PURE__ */ jsxs("div", {
4090
+ className: cx("form-field"),
4091
+ style: { width: "100%" },
4092
+ children: [/* @__PURE__ */ jsxs("div", {
4093
+ className: cx("field-label"),
4094
+ children: [/* @__PURE__ */ jsx("span", { children: "Description" }), /* @__PURE__ */ jsx("span", {
4095
+ className: cx("label-optional"),
4096
+ children: "(optional)"
4097
+ })]
4098
+ }), /* @__PURE__ */ jsx(Input.TextArea, {
4099
+ value: endpointDescs[ep.id] ?? ep.description ?? "",
4100
+ onChange: (e) => onEndpointDescChange(ep.id, e.target.value),
4101
+ maxLength: 500,
4102
+ showCount: true,
4103
+ style: {
4104
+ height: 52,
4105
+ resize: "vertical"
4106
+ }
4107
+ })]
4108
+ })]
4109
+ })] })
4110
+ },
4111
+ {
4112
+ key: "request",
4113
+ label: "Request",
4114
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [epHeader, /* @__PURE__ */ jsxs("div", {
4115
+ className: cx("form-field"),
4116
+ style: { width: "100%" },
4117
+ children: [
4118
+ /* @__PURE__ */ jsx("div", {
4119
+ className: cx("section-header"),
4120
+ children: isMobile ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
4121
+ style: {
4122
+ display: "flex",
4123
+ alignItems: "center",
4124
+ gap: token.marginMD
4125
+ },
4126
+ children: [/* @__PURE__ */ jsx("span", {
4127
+ className: cx("section-title"),
4128
+ children: "Request Details"
4129
+ }), /* @__PURE__ */ jsx(Button, {
4130
+ ghost: true,
4131
+ type: "primary",
4132
+ icon: /* @__PURE__ */ jsx(SearchOutlined, {}),
4133
+ size: "large",
4134
+ style: {
4135
+ width: 40,
4136
+ height: 40,
4137
+ padding: 0
4138
+ },
4139
+ disabled: (endpointParams[ep.id] ?? []).length === 0,
4140
+ onClick: () => setShowRequestSearch((prev) => ({
4141
+ ...prev,
4142
+ [ep.id]: !prev[ep.id]
4143
+ }))
4144
+ })]
4145
+ }), /* @__PURE__ */ jsx(Button, {
4146
+ ghost: true,
4147
+ type: "primary",
4148
+ icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
4149
+ onClick: () => {
4150
+ setDrawerSource("request");
4151
+ setParamDrawerMode("add");
4152
+ setEditParamIdx(null);
4153
+ setParamDrawerEndpointId(ep.id);
4154
+ setParamDrawerOpen(true);
4155
+ },
4156
+ children: "Add Parameter"
4157
+ })] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
4158
+ style: {
4159
+ display: "flex",
4160
+ alignItems: "center",
4161
+ gap: 24
4162
+ },
4163
+ children: [/* @__PURE__ */ jsx("span", {
4164
+ className: cx("section-title"),
4165
+ children: "Request Details"
4166
+ }), /* @__PURE__ */ jsx(Input.Search, {
4167
+ placeholder: "Search by parameter name",
4168
+ style: { width: 310 },
4169
+ disabled: (endpointParams[ep.id] ?? []).length === 0,
4170
+ value: requestSearches[ep.id] ?? "",
4171
+ onChange: (e) => {
4172
+ const val = e.target.value;
4173
+ setRequestSearches((prev) => ({
4174
+ ...prev,
4175
+ [ep.id]: val
4176
+ }));
4177
+ setRequestPages((prev) => new Map(prev).set(ep.id, 1));
4178
+ },
4179
+ allowClear: true
4180
+ })]
4181
+ }), /* @__PURE__ */ jsx(Button, {
4182
+ ghost: true,
4183
+ type: "primary",
4184
+ icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
4185
+ onClick: () => {
4186
+ setDrawerSource("request");
4187
+ setParamDrawerMode("add");
4188
+ setEditParamIdx(null);
4189
+ setParamDrawerEndpointId(ep.id);
4190
+ setParamDrawerOpen(true);
4191
+ },
4192
+ children: "Add Parameter"
4193
+ })] })
4194
+ }),
4195
+ isMobile && showRequestSearch[ep.id] && /* @__PURE__ */ jsx(Input.Search, {
4196
+ placeholder: "Search by parameter name",
4197
+ style: {
4198
+ width: "100%",
4199
+ marginTop: 8
4200
+ },
4201
+ disabled: (endpointParams[ep.id] ?? []).length === 0,
4202
+ value: requestSearches[ep.id] ?? "",
4203
+ onChange: (e) => {
4204
+ const val = e.target.value;
4205
+ setRequestSearches((prev) => ({
4206
+ ...prev,
4207
+ [ep.id]: val
4208
+ }));
4209
+ setRequestPages((prev) => new Map(prev).set(ep.id, 1));
4210
+ },
4211
+ allowClear: true,
4212
+ autoFocus: true
4213
+ }),
4214
+ (endpointParams[ep.id] ?? []).length === 0 ? /* @__PURE__ */ jsx("div", {
4215
+ className: cx("empty-wrapper"),
4216
+ children: /* @__PURE__ */ jsx(Empty, {
4217
+ image: Empty.PRESENTED_IMAGE_SIMPLE,
4218
+ imageStyle: {
4219
+ width: 184,
4220
+ height: 117
4221
+ },
4222
+ description: /* @__PURE__ */ jsx("span", {
4223
+ className: cx("empty-description"),
4224
+ children: "No Data"
4225
+ })
4226
+ })
4227
+ }) : (() => {
4228
+ const reqSearch = (debouncedRequestSearches[ep.id] ?? "").toLowerCase();
4229
+ const allReqParams = (endpointParams[ep.id] ?? []).filter((p) => p.name.toLowerCase().includes(reqSearch));
4230
+ if (allReqParams.length === 0) return /* @__PURE__ */ jsx("div", {
4231
+ className: cx("empty-wrapper"),
4232
+ children: /* @__PURE__ */ jsx(Empty, {
4233
+ image: Empty.PRESENTED_IMAGE_SIMPLE,
4234
+ imageStyle: {
4235
+ width: 184,
4236
+ height: 117
4237
+ },
4238
+ description: /* @__PURE__ */ jsx("span", {
4239
+ className: cx("empty-description"),
4240
+ children: "No Data"
4241
+ })
4242
+ })
4243
+ });
4244
+ const reqPage = requestPages.get(ep.id) ?? 1;
4245
+ const pagedReqParams = allReqParams.slice((reqPage - 1) * PAGE_SIZE, reqPage * PAGE_SIZE);
4246
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
4247
+ className: cx("param-list"),
4248
+ style: { marginTop: token.margin },
4249
+ children: pagedReqParams.map((param, i) => {
4250
+ const idx = (reqPage - 1) * PAGE_SIZE + i;
4251
+ return /* @__PURE__ */ jsx("div", {
4252
+ className: cx("param-item-row"),
4253
+ children: isMobile ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
4254
+ style: {
4255
+ display: "flex",
4256
+ alignItems: "center",
4257
+ gap: 24,
4258
+ flex: 1,
4259
+ minWidth: 0
4260
+ },
4261
+ children: [/* @__PURE__ */ jsxs("div", {
4262
+ className: cx("param-detail-cell"),
4263
+ children: [/* @__PURE__ */ jsx("span", {
4264
+ className: cx("param-detail-label"),
4265
+ children: "Parameter Name"
4266
+ }), /* @__PURE__ */ jsx("span", {
4267
+ className: cx("param-detail-value"),
4268
+ children: param.name
4269
+ })]
4270
+ }), /* @__PURE__ */ jsxs("div", {
4271
+ className: cx("param-detail-cell"),
4272
+ style: {
4273
+ flex: 1,
4274
+ minWidth: 0
4275
+ },
4276
+ children: [/* @__PURE__ */ jsx("span", {
4277
+ className: cx("param-detail-label"),
4278
+ children: "Parameter In"
4279
+ }), /* @__PURE__ */ jsx("span", {
4280
+ className: cx("param-detail-value"),
4281
+ children: param.in
4282
+ })]
4283
+ })]
4284
+ }), /* @__PURE__ */ jsxs("div", {
4285
+ style: {
4286
+ display: "flex",
4287
+ alignItems: "center",
4288
+ gap: token.margin,
4289
+ background: token.colorFillTertiary,
4290
+ borderRadius: token.borderRadius,
4291
+ padding: `0 ${token.marginSM}px`,
4292
+ height: 50,
4293
+ flexShrink: 0
4294
+ },
4295
+ children: [/* @__PURE__ */ jsx(Button, {
4296
+ danger: true,
4297
+ icon: /* @__PURE__ */ jsx(Trash, {
4298
+ width: 32,
4299
+ height: 32
4300
+ }),
4301
+ style: {
4302
+ padding: 0,
4303
+ lineHeight: 1,
4304
+ width: 40,
4305
+ height: 40
4306
+ },
4307
+ className: cx("param-delete-btn"),
4308
+ onClick: () => setDeleteParamModal({
4309
+ open: true,
4310
+ endpointId: ep.id,
4311
+ idx,
4312
+ name: param.name,
4313
+ source: "request"
4314
+ })
4315
+ }), /* @__PURE__ */ jsx(Button, {
4316
+ ghost: true,
4317
+ icon: /* @__PURE__ */ jsx(EditTag, {
4318
+ width: 18,
4319
+ height: 18
4320
+ }),
4321
+ style: {
4322
+ width: 40,
4323
+ height: 40,
4324
+ padding: 0,
4325
+ lineHeight: 1
4326
+ },
4327
+ className: cx("param-edit-btn"),
4328
+ onClick: () => {
4329
+ setDrawerSource("request");
4330
+ setParamDrawerMode("edit");
4331
+ setEditParamIdx(idx);
4332
+ setParamDrawerEndpointId(ep.id);
4333
+ setParamDrawerOpen(true);
4334
+ }
4335
+ })]
4336
+ })] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
4337
+ className: cx("param-details"),
4338
+ children: [
4339
+ /* @__PURE__ */ jsxs("div", {
4340
+ className: cx("param-detail-cell"),
4341
+ children: [/* @__PURE__ */ jsx("span", {
4342
+ className: cx("param-detail-label"),
4343
+ children: "Parameter Name"
4344
+ }), /* @__PURE__ */ jsx("span", {
4345
+ className: cx("param-detail-value"),
4346
+ children: param.name
4347
+ })]
4348
+ }),
4349
+ /* @__PURE__ */ jsxs("div", {
4350
+ className: cx("param-detail-cell"),
4351
+ children: [/* @__PURE__ */ jsx("span", {
4352
+ className: cx("param-detail-label"),
4353
+ children: "Parameter In"
4354
+ }), /* @__PURE__ */ jsx("span", {
4355
+ className: cx("param-detail-value"),
4356
+ children: param.in
4357
+ })]
4358
+ }),
4359
+ /* @__PURE__ */ jsxs("div", {
4360
+ className: cx("param-detail-cell"),
4361
+ children: [/* @__PURE__ */ jsx("span", {
4362
+ className: cx("param-detail-label"),
4363
+ children: "Parameter Type"
4364
+ }), /* @__PURE__ */ jsx("span", {
4365
+ className: cx("param-detail-value"),
4366
+ children: param.type
4367
+ })]
4368
+ }),
4369
+ /* @__PURE__ */ jsxs("div", {
4370
+ className: cx("param-detail-cell"),
4371
+ children: [/* @__PURE__ */ jsx("span", {
4372
+ className: cx("param-detail-label"),
4373
+ children: "Enum"
4374
+ }), param.enum && param.enum.length > 0 ? /* @__PURE__ */ jsxs("span", {
4375
+ className: cx("param-enum-container"),
4376
+ children: [/* @__PURE__ */ jsx("span", {
4377
+ className: cx("param-enum-tag"),
4378
+ children: param.enum[0]
4379
+ }), param.enum.length > 1 && /* @__PURE__ */ jsx(Tooltip, {
4380
+ title: /* @__PURE__ */ jsx("ul", {
4381
+ style: {
4382
+ margin: 0,
4383
+ paddingLeft: 16
4384
+ },
4385
+ children: param.enum.map((e) => /* @__PURE__ */ jsx("li", { children: e }, e))
4386
+ }),
4387
+ placement: "bottom",
4388
+ children: /* @__PURE__ */ jsxs("span", {
4389
+ className: cx("param-enum-pill"),
4390
+ children: ["+", param.enum.length - 1]
4391
+ })
4392
+ })]
4393
+ }) : /* @__PURE__ */ jsx("span", {
4394
+ className: cx("param-detail-value"),
4395
+ children: "—"
4396
+ })]
4397
+ }),
4398
+ /* @__PURE__ */ jsxs("div", {
4399
+ className: cx("param-detail-cell"),
4400
+ children: [/* @__PURE__ */ jsx("span", {
4401
+ className: cx("param-detail-label"),
4402
+ children: "Required?"
4403
+ }), /* @__PURE__ */ jsx("span", {
4404
+ className: cx("param-detail-value"),
4405
+ children: param.required ? "Yes" : "No"
4406
+ })]
4407
+ }),
4408
+ /* @__PURE__ */ jsxs("div", {
4409
+ className: cx("param-detail-cell"),
4410
+ children: [/* @__PURE__ */ jsx("span", {
4411
+ className: cx("param-detail-label"),
4412
+ children: "Description"
4413
+ }), /* @__PURE__ */ jsx("span", {
4414
+ className: cx("param-detail-value", "param-detail-value--ellipsis"),
4415
+ children: param.description || "—"
4416
+ })]
4417
+ })
4418
+ ]
4419
+ }), /* @__PURE__ */ jsxs("div", {
4420
+ className: cx("param-actions"),
4421
+ children: [/* @__PURE__ */ jsx(Button, {
4422
+ danger: true,
4423
+ icon: /* @__PURE__ */ jsx(Trash, {
4424
+ width: 32,
4425
+ height: 32
4426
+ }),
4427
+ style: {
4428
+ padding: 0,
4429
+ lineHeight: 1,
4430
+ width: 40,
4431
+ height: 40
4432
+ },
4433
+ className: cx("param-delete-btn"),
4434
+ onClick: () => setDeleteParamModal({
4435
+ open: true,
4436
+ endpointId: ep.id,
4437
+ idx,
4438
+ name: param.name,
4439
+ source: "request"
4440
+ })
4441
+ }), /* @__PURE__ */ jsx(Button, {
4442
+ ghost: true,
4443
+ icon: /* @__PURE__ */ jsx(EditTag, {
4444
+ width: 18,
4445
+ height: 18
4446
+ }),
4447
+ style: {
4448
+ width: 40,
4449
+ height: 40,
4450
+ padding: 0,
4451
+ lineHeight: 1
4452
+ },
4453
+ className: cx("param-edit-btn"),
4454
+ onClick: () => {
4455
+ setDrawerSource("request");
4456
+ setParamDrawerMode("edit");
4457
+ setEditParamIdx(idx);
4458
+ setParamDrawerEndpointId(ep.id);
4459
+ setParamDrawerOpen(true);
4460
+ }
4461
+ })]
4462
+ })] })
4463
+ }, idx);
4464
+ })
4465
+ }), allReqParams.length > PAGE_SIZE && /* @__PURE__ */ jsx(Pagination, {
4466
+ current: reqPage,
4467
+ pageSize: PAGE_SIZE,
4468
+ total: allReqParams.length,
4469
+ onChange: (page) => setRequestPages((prev) => new Map(prev).set(ep.id, page)),
4470
+ showSizeChanger: false,
4471
+ className: cx("pagination")
4472
+ })] });
4473
+ })(),
4474
+ /* @__PURE__ */ jsxs("div", {
4475
+ className: cx("param-row"),
4476
+ style: { marginTop: token.margin },
4477
+ onClick: () => toggleRequestPanel(ep.id),
4478
+ children: [/* @__PURE__ */ jsx(DownOutlined, { className: cx("param-row-icon", openRequestPanels.has(ep.id) ? "param-row-icon--open" : "") }), /* @__PURE__ */ jsxs("span", {
4479
+ style: { fontSize: token.fontSize },
4480
+ children: ["Request ", /* @__PURE__ */ jsx("span", {
4481
+ style: { color: token.colorError },
4482
+ children: "*"
4483
+ })]
4484
+ })]
4485
+ }),
4486
+ openRequestPanels.has(ep.id) && /* @__PURE__ */ jsxs("div", {
4487
+ className: cx("code-panel"),
4488
+ children: [/* @__PURE__ */ jsx("code", {
4489
+ className: cx("code-area"),
4490
+ children: JSON.stringify((endpointParams[ep.id] ?? []).map((p) => ({
4491
+ name: p.name,
4492
+ in: p.in,
4493
+ type: p.type,
4494
+ required: p.required,
4495
+ ...p.description ? { description: p.description } : {},
4496
+ ...p.enum && p.enum.length > 0 ? { enum: p.enum } : {}
4497
+ })), null, 2)
4498
+ }), /* @__PURE__ */ jsxs("div", {
4499
+ className: cx("code-footer"),
4500
+ children: [/* @__PURE__ */ jsx(Button, {
4501
+ ghost: true,
4502
+ size: "small",
4503
+ className: cx("code-btn"),
4504
+ children: "Validate"
4505
+ }), /* @__PURE__ */ jsx(Button, {
4506
+ ghost: true,
4507
+ size: "small",
4508
+ className: cx("code-btn"),
4509
+ children: "Beautify"
4510
+ })]
4511
+ })]
4512
+ })
4513
+ ]
4514
+ })] })
4515
+ },
4516
+ {
4517
+ key: "response",
4518
+ label: "Response",
4519
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [epHeader, /* @__PURE__ */ jsxs("div", {
4520
+ className: cx("form-field"),
4521
+ style: { width: "100%" },
4522
+ children: [
4523
+ /* @__PURE__ */ jsx("div", {
4524
+ className: cx("section-header"),
4525
+ children: isMobile ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
4526
+ style: {
4527
+ display: "flex",
4528
+ alignItems: "center",
4529
+ gap: token.marginMD
4530
+ },
4531
+ children: [/* @__PURE__ */ jsx("span", {
4532
+ className: cx("section-title"),
4533
+ children: "Response Details"
4534
+ }), /* @__PURE__ */ jsx(Button, {
4535
+ ghost: true,
4536
+ type: "primary",
4537
+ icon: /* @__PURE__ */ jsx(SearchOutlined, {}),
4538
+ size: "large",
4539
+ style: {
4540
+ width: 40,
4541
+ height: 40,
4542
+ padding: 0
4543
+ },
4544
+ disabled: (endpointResponseParams[ep.id] ?? []).length === 0,
4545
+ onClick: () => setShowResponseSearch((prev) => ({
4546
+ ...prev,
4547
+ [ep.id]: !prev[ep.id]
4548
+ }))
4549
+ })]
4550
+ }), /* @__PURE__ */ jsx(Button, {
4551
+ ghost: true,
4552
+ type: "primary",
4553
+ icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
4554
+ onClick: () => {
4555
+ setDrawerSource("response");
4556
+ setParamDrawerMode("add");
4557
+ setEditParamIdx(null);
4558
+ setParamDrawerEndpointId(ep.id);
4559
+ setParamDrawerOpen(true);
4560
+ },
4561
+ children: "Add Parameter"
4562
+ })] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
4563
+ style: {
4564
+ display: "flex",
4565
+ alignItems: "center",
4566
+ gap: 24
4567
+ },
4568
+ children: [/* @__PURE__ */ jsx("span", {
4569
+ className: cx("section-title"),
4570
+ children: "Response Details"
4571
+ }), /* @__PURE__ */ jsxs("div", {
4572
+ className: cx("response-controls"),
4573
+ children: [/* @__PURE__ */ jsx(Input.Search, {
4574
+ placeholder: "Search by parameter name",
4575
+ style: { width: 310 },
4576
+ disabled: (endpointResponseParams[ep.id] ?? []).length === 0,
4577
+ value: responseSearches[ep.id] ?? "",
4578
+ onChange: (e) => {
4579
+ const val = e.target.value;
4580
+ setResponseSearches((prev) => ({
4581
+ ...prev,
4582
+ [ep.id]: val
4583
+ }));
4584
+ setResponsePages((prev) => new Map(prev).set(ep.id, 1));
4585
+ },
4586
+ allowClear: true
4587
+ }), /* @__PURE__ */ jsx(Tooltip, {
4588
+ title: selectedStatusCodes[ep.id] ? "Filled" : void 0,
4589
+ placement: "bottom",
4590
+ children: /* @__PURE__ */ jsx(Select, {
4591
+ className: cx("status-select"),
4592
+ popupClassName: "status-code-dropdown",
4593
+ value: selectedStatusCodes[ep.id] ?? void 0,
4594
+ onChange: (val) => setSelectedStatusCodes((prev) => ({
4595
+ ...prev,
4596
+ [ep.id]: val
4597
+ })),
4598
+ options: Object.keys(ep.responses ?? {}).map((code) => ({
4599
+ value: code,
4600
+ label: /* @__PURE__ */ jsxs("span", {
4601
+ className: cx("status-label"),
4602
+ children: [/* @__PURE__ */ jsx("span", {
4603
+ className: cx("status-dot"),
4604
+ style: { background: getStatusCodeColor(code, antdToken).dot }
4605
+ }), /* @__PURE__ */ jsx("span", {
4606
+ style: { color: getStatusCodeColor(code, antdToken).text },
4607
+ children: code
4608
+ })]
4609
+ })
4610
+ })),
4611
+ optionRender: (option) => {
4612
+ const code = option.value;
4613
+ const { dot, text } = getStatusCodeColor(code, antdToken);
4614
+ const isSelected = selectedStatusCodes[ep.id] === code;
4615
+ return /* @__PURE__ */ jsx(Tooltip, {
4616
+ title: "Filled",
4617
+ placement: "bottom",
4618
+ children: /* @__PURE__ */ jsxs("span", {
4619
+ className: cx("status-option-content"),
4620
+ children: [
4621
+ /* @__PURE__ */ jsx("span", {
4622
+ className: cx("status-dot"),
4623
+ style: { background: dot }
4624
+ }),
4625
+ /* @__PURE__ */ jsx("span", {
4626
+ style: { color: text },
4627
+ children: code
4628
+ }),
4629
+ isSelected && /* @__PURE__ */ jsx(CheckCircleOutlined, {
4630
+ className: cx("status-checkmark"),
4631
+ style: { color: text }
4632
+ })
4633
+ ]
4634
+ })
4635
+ });
4636
+ }
4637
+ })
4638
+ })]
4639
+ })]
4640
+ }), /* @__PURE__ */ jsx(Button, {
4641
+ ghost: true,
4642
+ type: "primary",
4643
+ icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
4644
+ onClick: () => {
4645
+ setDrawerSource("response");
4646
+ setParamDrawerMode("add");
4647
+ setEditParamIdx(null);
4648
+ setParamDrawerEndpointId(ep.id);
4649
+ setParamDrawerOpen(true);
4650
+ },
4651
+ children: "Add Parameter"
4652
+ })] })
4653
+ }),
4654
+ isMobile && showResponseSearch[ep.id] && /* @__PURE__ */ jsx(Input.Search, {
4655
+ placeholder: "Search by parameter name",
4656
+ style: {
4657
+ width: "100%",
4658
+ marginTop: 8
4659
+ },
4660
+ disabled: (endpointResponseParams[ep.id] ?? []).length === 0,
4661
+ value: responseSearches[ep.id] ?? "",
4662
+ onChange: (e) => {
4663
+ const val = e.target.value;
4664
+ setResponseSearches((prev) => ({
4665
+ ...prev,
4666
+ [ep.id]: val
4667
+ }));
4668
+ setResponsePages((prev) => new Map(prev).set(ep.id, 1));
4669
+ },
4670
+ allowClear: true,
4671
+ autoFocus: true
4672
+ }),
4673
+ (endpointResponseParams[ep.id] ?? []).length === 0 ? /* @__PURE__ */ jsx("div", {
4674
+ className: cx("empty-wrapper"),
4675
+ children: /* @__PURE__ */ jsx(Empty, {
4676
+ image: Empty.PRESENTED_IMAGE_SIMPLE,
4677
+ imageStyle: {
4678
+ width: 184,
4679
+ height: 117
4680
+ },
4681
+ description: /* @__PURE__ */ jsx("span", {
4682
+ className: cx("empty-description"),
4683
+ children: "No Data"
4684
+ })
4685
+ })
4686
+ }) : (() => {
4687
+ const resSearch = (debouncedResponseSearches[ep.id] ?? "").toLowerCase();
4688
+ const allResParams = (endpointResponseParams[ep.id] ?? []).filter((p) => p.name.toLowerCase().includes(resSearch));
4689
+ if (allResParams.length === 0) return /* @__PURE__ */ jsx("div", {
4690
+ className: cx("empty-wrapper"),
4691
+ children: /* @__PURE__ */ jsx(Empty, {
4692
+ image: Empty.PRESENTED_IMAGE_SIMPLE,
4693
+ imageStyle: {
4694
+ width: 184,
4695
+ height: 117
4696
+ },
4697
+ description: /* @__PURE__ */ jsx("span", {
4698
+ className: cx("empty-description"),
4699
+ children: "No Data"
4700
+ })
4701
+ })
4702
+ });
4703
+ const resPage = responsePages.get(ep.id) ?? 1;
4704
+ const pagedResParams = allResParams.slice((resPage - 1) * PAGE_SIZE, resPage * PAGE_SIZE);
4705
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
4706
+ className: cx("param-list"),
4707
+ style: { marginTop: token.margin },
4708
+ children: pagedResParams.map((param, i) => {
4709
+ const idx = (resPage - 1) * PAGE_SIZE + i;
4710
+ return /* @__PURE__ */ jsx("div", {
4711
+ className: cx("param-item-row"),
4712
+ children: isMobile ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
4713
+ style: {
4714
+ display: "flex",
4715
+ alignItems: "center",
4716
+ gap: 24,
4717
+ flex: 1,
4718
+ minWidth: 0
4719
+ },
4720
+ children: [/* @__PURE__ */ jsxs("div", {
4721
+ className: cx("param-detail-cell"),
4722
+ children: [/* @__PURE__ */ jsx("span", {
4723
+ className: cx("param-detail-label"),
4724
+ children: "Parameter Name"
4725
+ }), /* @__PURE__ */ jsx("span", {
4726
+ className: cx("param-detail-value"),
4727
+ children: param.name
4728
+ })]
4729
+ }), /* @__PURE__ */ jsxs("div", {
4730
+ className: cx("param-detail-cell"),
4731
+ style: {
4732
+ flex: 1,
4733
+ minWidth: 0
4734
+ },
4735
+ children: [/* @__PURE__ */ jsx("span", {
4736
+ className: cx("param-detail-label"),
4737
+ children: "Parameter In"
4738
+ }), /* @__PURE__ */ jsx("span", {
4739
+ className: cx("param-detail-value"),
4740
+ children: param.in
4741
+ })]
4742
+ })]
4743
+ }), /* @__PURE__ */ jsxs("div", {
4744
+ style: {
4745
+ display: "flex",
4746
+ alignItems: "center",
4747
+ gap: token.margin,
4748
+ background: token.colorFillTertiary,
4749
+ borderRadius: token.borderRadius,
4750
+ padding: `0 ${token.marginSM}px`,
4751
+ height: 50,
4752
+ flexShrink: 0
4753
+ },
4754
+ children: [/* @__PURE__ */ jsx(Button, {
4755
+ danger: true,
4756
+ icon: /* @__PURE__ */ jsx(Trash, {
4757
+ width: 32,
4758
+ height: 32
4759
+ }),
4760
+ style: {
4761
+ padding: 0,
4762
+ lineHeight: 1,
4763
+ width: 40,
4764
+ height: 40
4765
+ },
4766
+ className: cx("param-delete-btn"),
4767
+ onClick: () => setDeleteParamModal({
4768
+ open: true,
4769
+ endpointId: ep.id,
4770
+ idx,
4771
+ name: param.name,
4772
+ source: "response"
4773
+ })
4774
+ }), /* @__PURE__ */ jsx(Button, {
4775
+ ghost: true,
4776
+ icon: /* @__PURE__ */ jsx(EditTag, {
4777
+ width: 18,
4778
+ height: 18
4779
+ }),
4780
+ style: {
4781
+ width: 40,
4782
+ height: 40,
4783
+ padding: 0,
4784
+ lineHeight: 1
4785
+ },
4786
+ className: cx("param-edit-btn"),
4787
+ onClick: () => {
4788
+ setDrawerSource("response");
4789
+ setParamDrawerMode("edit");
4790
+ setEditParamIdx(idx);
4791
+ setParamDrawerEndpointId(ep.id);
4792
+ setParamDrawerOpen(true);
4793
+ }
4794
+ })]
4795
+ })] }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
4796
+ className: cx("param-details"),
4797
+ children: [
4798
+ /* @__PURE__ */ jsxs("div", {
4799
+ className: cx("param-detail-cell"),
4800
+ children: [/* @__PURE__ */ jsx("span", {
4801
+ className: cx("param-detail-label"),
4802
+ children: "Parameter Name"
4803
+ }), /* @__PURE__ */ jsx("span", {
4804
+ className: cx("param-detail-value"),
4805
+ children: param.name
4806
+ })]
4807
+ }),
4808
+ /* @__PURE__ */ jsxs("div", {
4809
+ className: cx("param-detail-cell"),
4810
+ children: [/* @__PURE__ */ jsx("span", {
4811
+ className: cx("param-detail-label"),
4812
+ children: "Parameter In"
4813
+ }), /* @__PURE__ */ jsx("span", {
4814
+ className: cx("param-detail-value"),
4815
+ children: param.in
4816
+ })]
4817
+ }),
4818
+ /* @__PURE__ */ jsxs("div", {
4819
+ className: cx("param-detail-cell"),
4820
+ children: [/* @__PURE__ */ jsx("span", {
4821
+ className: cx("param-detail-label"),
4822
+ children: "Parameter Type"
4823
+ }), /* @__PURE__ */ jsx("span", {
4824
+ className: cx("param-detail-value"),
4825
+ children: param.type
4826
+ })]
4827
+ }),
4828
+ /* @__PURE__ */ jsxs("div", {
4829
+ className: cx("param-detail-cell"),
4830
+ children: [/* @__PURE__ */ jsx("span", {
4831
+ className: cx("param-detail-label"),
4832
+ children: "Enum"
4833
+ }), param.enum && param.enum.length > 0 ? /* @__PURE__ */ jsxs("span", {
4834
+ className: cx("param-enum-container"),
4835
+ children: [/* @__PURE__ */ jsx("span", {
4836
+ className: cx("param-enum-tag"),
4837
+ children: param.enum[0]
4838
+ }), param.enum.length > 1 && /* @__PURE__ */ jsx(Tooltip, {
4839
+ title: /* @__PURE__ */ jsx("ul", {
4840
+ style: {
4841
+ margin: 0,
4842
+ paddingLeft: 16
4843
+ },
4844
+ children: param.enum.map((e) => /* @__PURE__ */ jsx("li", { children: e }, e))
4845
+ }),
4846
+ placement: "bottom",
4847
+ children: /* @__PURE__ */ jsxs("span", {
4848
+ className: cx("param-enum-pill"),
4849
+ children: ["+", param.enum.length - 1]
4850
+ })
4851
+ })]
4852
+ }) : /* @__PURE__ */ jsx("span", {
4853
+ className: cx("param-detail-value"),
4854
+ children: "—"
4855
+ })]
4856
+ }),
4857
+ /* @__PURE__ */ jsxs("div", {
4858
+ className: cx("param-detail-cell"),
4859
+ children: [/* @__PURE__ */ jsx("span", {
4860
+ className: cx("param-detail-label"),
4861
+ children: "Required?"
4862
+ }), /* @__PURE__ */ jsx("span", {
4863
+ className: cx("param-detail-value"),
4864
+ children: param.required ? "Yes" : "No"
4865
+ })]
4866
+ }),
4867
+ /* @__PURE__ */ jsxs("div", {
4868
+ className: cx("param-detail-cell"),
4869
+ children: [/* @__PURE__ */ jsx("span", {
4870
+ className: cx("param-detail-label"),
4871
+ children: "Description"
4872
+ }), /* @__PURE__ */ jsx("span", {
4873
+ className: cx("param-detail-value", "param-detail-value--ellipsis"),
4874
+ children: param.description || "—"
4875
+ })]
4876
+ })
4877
+ ]
4878
+ }), /* @__PURE__ */ jsxs("div", {
4879
+ className: cx("param-actions"),
4880
+ children: [/* @__PURE__ */ jsx(Button, {
4881
+ danger: true,
4882
+ icon: /* @__PURE__ */ jsx(Trash, {
4883
+ width: 32,
4884
+ height: 32
4885
+ }),
4886
+ style: {
4887
+ padding: 0,
4888
+ lineHeight: 1,
4889
+ width: 40,
4890
+ height: 40
4891
+ },
4892
+ className: cx("param-delete-btn"),
4893
+ onClick: () => setDeleteParamModal({
4894
+ open: true,
4895
+ endpointId: ep.id,
4896
+ idx,
4897
+ name: param.name,
4898
+ source: "response"
4899
+ })
4900
+ }), /* @__PURE__ */ jsx(Button, {
4901
+ ghost: true,
4902
+ icon: /* @__PURE__ */ jsx(EditTag, {
4903
+ width: 18,
4904
+ height: 18
4905
+ }),
4906
+ style: {
4907
+ width: 40,
4908
+ height: 40,
4909
+ padding: 0,
4910
+ lineHeight: 1
4911
+ },
4912
+ className: cx("param-edit-btn"),
4913
+ onClick: () => {
4914
+ setDrawerSource("response");
4915
+ setParamDrawerMode("edit");
4916
+ setEditParamIdx(idx);
4917
+ setParamDrawerEndpointId(ep.id);
4918
+ setParamDrawerOpen(true);
4919
+ }
4920
+ })]
4921
+ })] })
4922
+ }, idx);
4923
+ })
4924
+ }), allResParams.length > PAGE_SIZE && /* @__PURE__ */ jsx(Pagination, {
4925
+ current: resPage,
4926
+ pageSize: PAGE_SIZE,
4927
+ total: allResParams.length,
4928
+ onChange: (page) => setResponsePages((prev) => new Map(prev).set(ep.id, page)),
4929
+ showSizeChanger: false,
4930
+ className: cx("pagination")
4931
+ })] });
4932
+ })(),
4933
+ /* @__PURE__ */ jsxs("div", {
4934
+ className: cx("param-row"),
4935
+ style: { marginTop: token.margin },
4936
+ onClick: () => toggleResponsePanel(ep.id),
4937
+ children: [
4938
+ /* @__PURE__ */ jsx(DownOutlined, { className: cx("param-row-icon", openResponsePanels.has(ep.id) ? "param-row-icon--open" : "") }),
4939
+ /* @__PURE__ */ jsxs("span", {
4940
+ style: { fontSize: token.fontSize },
4941
+ children: ["Response ", /* @__PURE__ */ jsx("span", {
4942
+ style: { color: token.colorError },
4943
+ children: "*"
4944
+ })]
4945
+ }),
4946
+ /* @__PURE__ */ jsx(InfoCircle, { style: {
4947
+ width: 24,
4948
+ height: 24
4949
+ } })
4950
+ ]
4951
+ }),
4952
+ openResponsePanels.has(ep.id) && /* @__PURE__ */ jsxs("div", {
4953
+ className: cx("code-panel"),
4954
+ children: [/* @__PURE__ */ jsx("code", {
4955
+ className: cx("code-area"),
4956
+ children: JSON.stringify((endpointResponseParams[ep.id] ?? []).map((p) => ({
4957
+ name: p.name,
4958
+ in: p.in,
4959
+ type: p.type,
4960
+ required: p.required,
4961
+ ...p.description ? { description: p.description } : {},
4962
+ ...p.enum && p.enum.length > 0 ? { enum: p.enum } : {}
4963
+ })), null, 2)
4964
+ }), /* @__PURE__ */ jsxs("div", {
4965
+ className: cx("code-footer"),
4966
+ children: [/* @__PURE__ */ jsx(Button, {
4967
+ ghost: true,
4968
+ size: "small",
4969
+ className: cx("code-btn"),
4970
+ children: "Validate"
4971
+ }), /* @__PURE__ */ jsx(Button, {
4972
+ ghost: true,
4973
+ size: "small",
4974
+ className: cx("code-btn"),
4975
+ children: "Beautify"
4976
+ })]
4977
+ })]
4978
+ })
4979
+ ]
4980
+ })] })
4981
+ }
4982
+ ]
4983
+ }),
4984
+ /* @__PURE__ */ jsxs(Modal, {
4985
+ open: deleteParamModal.open,
4986
+ onCancel: () => setDeleteParamModal({
4987
+ open: false,
4988
+ endpointId: "",
4989
+ idx: -1,
4990
+ name: "",
4991
+ source: "request"
4992
+ }),
4993
+ centered: true,
4994
+ title: null,
4995
+ footer: null,
4996
+ closable: false,
4997
+ width: 520,
4998
+ className: "delete-param-confirm-modal",
4999
+ styles: {
5000
+ content: {
5001
+ padding: 0,
5002
+ borderRadius: 8,
5003
+ overflow: "hidden"
5004
+ },
5005
+ body: {
5006
+ padding: 0,
5007
+ margin: 0
5008
+ }
5009
+ },
5010
+ children: [
5011
+ /* @__PURE__ */ jsxs("div", {
5012
+ className: cx("deleteModalHead"),
5013
+ children: [/* @__PURE__ */ jsxs("span", {
5014
+ className: cx("deleteModalTitle"),
5015
+ children: [
5016
+ "Delete ",
5017
+ deleteParamModal.name,
5018
+ " parameter"
5019
+ ]
5020
+ }), /* @__PURE__ */ jsx("button", {
5021
+ className: cx("deleteModalCloseBtn"),
5022
+ onClick: () => setDeleteParamModal({
5023
+ open: false,
5024
+ endpointId: "",
5025
+ idx: -1,
5026
+ name: "",
5027
+ source: "request"
5028
+ }),
5029
+ "aria-label": "Close",
5030
+ children: "×"
5031
+ })]
5032
+ }),
5033
+ /* @__PURE__ */ jsx("div", {
5034
+ className: cx("deleteModalContent"),
5035
+ children: /* @__PURE__ */ jsxs("span", {
5036
+ className: cx("deleteModalContentText"),
5037
+ children: [
5038
+ "Are you sure you want to delete ",
5039
+ deleteParamModal.name,
5040
+ " parameter?"
5041
+ ]
5042
+ })
5043
+ }),
5044
+ /* @__PURE__ */ jsxs("div", {
5045
+ className: cx("deleteModalFooter"),
5046
+ children: [/* @__PURE__ */ jsx(Button, {
5047
+ size: "middle",
5048
+ onClick: () => setDeleteParamModal({
5049
+ open: false,
5050
+ endpointId: "",
5051
+ idx: -1,
5052
+ name: "",
5053
+ source: "request"
5054
+ }),
5055
+ style: {
5056
+ borderRadius: 8,
5057
+ height: 32,
5058
+ paddingInline: 15
5059
+ },
5060
+ children: "Cancel"
5061
+ }), /* @__PURE__ */ jsx(Button, {
5062
+ type: "primary",
5063
+ danger: true,
5064
+ size: "middle",
5065
+ style: {
5066
+ borderRadius: 8,
5067
+ height: 32,
5068
+ paddingInline: 16
5069
+ },
5070
+ onClick: () => {
5071
+ const epId = deleteParamModal.endpointId;
5072
+ if (deleteParamModal.source === "response") {
5073
+ const total = (endpointResponseParams[epId] ?? []).length - 1;
5074
+ const maxPage = Math.max(1, Math.ceil(total / PAGE_SIZE));
5075
+ if ((responsePages.get(epId) ?? 1) > maxPage) setResponsePages((prev) => new Map(prev).set(epId, 1));
5076
+ onDeleteResponseParameter?.(epId, deleteParamModal.idx);
5077
+ } else {
5078
+ const total = (endpointParams[epId] ?? []).length - 1;
5079
+ const maxPage = Math.max(1, Math.ceil(total / PAGE_SIZE));
5080
+ if ((requestPages.get(epId) ?? 1) > maxPage) setRequestPages((prev) => new Map(prev).set(epId, 1));
5081
+ onDeleteParameter?.(epId, deleteParamModal.idx);
5082
+ }
5083
+ setDeleteParamModal({
5084
+ open: false,
5085
+ endpointId: "",
5086
+ idx: -1,
5087
+ name: "",
5088
+ source: "request"
5089
+ });
5090
+ },
5091
+ children: "Yes, Delete"
5092
+ })]
5093
+ })
5094
+ ]
5095
+ }),
5096
+ /* @__PURE__ */ jsx(AddParameterDrawer, {
5097
+ open: paramDrawerOpen,
5098
+ mode: paramDrawerMode,
5099
+ initialValues: paramDrawerMode === "edit" && paramDrawerEndpointId && editParamIdx !== null ? drawerSource === "response" ? endpointResponseParams[paramDrawerEndpointId]?.[editParamIdx] : endpointParams[paramDrawerEndpointId]?.[editParamIdx] : void 0,
5100
+ onClose: () => {
5101
+ setParamDrawerOpen(false);
5102
+ setParamDrawerEndpointId(null);
5103
+ setParamDrawerMode("add");
5104
+ setEditParamIdx(null);
5105
+ },
5106
+ onAdd: (param) => {
5107
+ if (paramDrawerEndpointId) if (drawerSource === "response") onAddResponseParameter?.(paramDrawerEndpointId, param);
5108
+ else onAddParameter?.(paramDrawerEndpointId, param);
5109
+ setParamDrawerOpen(false);
5110
+ setParamDrawerEndpointId(null);
5111
+ setParamDrawerMode("add");
5112
+ setEditParamIdx(null);
5113
+ },
5114
+ onEdit: (param) => {
5115
+ if (paramDrawerEndpointId && editParamIdx !== null) if (drawerSource === "response") onEditResponseParameter?.(paramDrawerEndpointId, editParamIdx, param);
5116
+ else onEditParameter?.(paramDrawerEndpointId, editParamIdx, param);
5117
+ setParamDrawerOpen(false);
5118
+ setParamDrawerEndpointId(null);
5119
+ setParamDrawerMode("add");
5120
+ setEditParamIdx(null);
5121
+ }
5122
+ })
5123
+ ]
5124
+ }));
5125
+ }
5126
+ return wrapSSR(/* @__PURE__ */ jsxs("div", {
5127
+ className: cx("root"),
5128
+ children: [
5129
+ /* @__PURE__ */ jsxs("div", {
5130
+ className: cx("head"),
5131
+ children: [/* @__PURE__ */ jsx(Title, {
5132
+ level: 4,
5133
+ style: {
5134
+ margin: 0,
5135
+ color: token.colorTextHeading
5136
+ },
5137
+ children: "Endpoints"
5138
+ }), /* @__PURE__ */ jsx(Button, {
5139
+ type: "text",
5140
+ size: "large",
5141
+ icon: /* @__PURE__ */ jsx(UpCircleOutlined, { style: { fontSize: 18 } }),
5142
+ onClick: onToggleCollapse,
5143
+ style: {
5144
+ transform: collapsed ? "rotate(180deg)" : "rotate(0deg)",
5145
+ transition: "transform 0.2s"
5146
+ }
5147
+ })]
5148
+ }),
5149
+ !collapsed && /* @__PURE__ */ jsx("div", {
5150
+ className: cx("body"),
5151
+ children: Object.values(endpointsByTag).flat().map((ep) => {
5152
+ const isExpanded = expandedId === ep.id;
5153
+ const methodColor = methodColors$1[ep.method];
5154
+ return /* @__PURE__ */ jsxs("div", { children: [
5155
+ /* @__PURE__ */ jsxs("div", {
3931
5156
  className: cx("endpoint-row"),
3932
5157
  children: [/* @__PURE__ */ jsxs("div", {
3933
5158
  className: cx("endpoint-card", isExpanded ? "endpoint-card-active" : ""),
@@ -3969,49 +5194,95 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
3969
5194
  className: cx("view-params-title"),
3970
5195
  children: "Request"
3971
5196
  })
3972
- }), /* @__PURE__ */ jsx(Table, {
3973
- dataSource: buildViewParamRows(endpointParams[ep.id] ?? []),
3974
- columns: viewParamColumns,
3975
- pagination: false,
3976
- rowClassName: (_, idx) => cx(idx % 2 === 0 ? "view-row-odd" : "view-row-even"),
3977
- size: "small",
3978
- bordered: true
3979
- })]
5197
+ }), (() => {
5198
+ const allVReqRows = buildViewParamRows(endpointParams[ep.id] ?? []);
5199
+ const vReqPage = requestPages.get(ep.id) ?? 1;
5200
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Table, {
5201
+ dataSource: allVReqRows.slice((vReqPage - 1) * VIEW_PAGE_SIZE, vReqPage * VIEW_PAGE_SIZE),
5202
+ columns: viewParamColumns,
5203
+ pagination: false,
5204
+ rowClassName: (_, idx) => cx(idx % 2 === 0 ? "view-row-odd" : "view-row-even"),
5205
+ size: "small",
5206
+ bordered: true
5207
+ }), allVReqRows.length > VIEW_PAGE_SIZE && /* @__PURE__ */ jsx("div", {
5208
+ style: { paddingBottom: 12 },
5209
+ children: /* @__PURE__ */ jsx(Pagination, {
5210
+ current: vReqPage,
5211
+ pageSize: VIEW_PAGE_SIZE,
5212
+ total: allVReqRows.length,
5213
+ onChange: (page) => setRequestPages((prev) => new Map(prev).set(ep.id, page)),
5214
+ showSizeChanger: false,
5215
+ className: cx("pagination")
5216
+ })
5217
+ })] });
5218
+ })()]
3980
5219
  }), /* @__PURE__ */ jsxs("div", {
3981
5220
  className: cx("view-params-card"),
3982
- children: [/* @__PURE__ */ jsxs("div", {
3983
- className: cx("view-params-header"),
3984
- children: [/* @__PURE__ */ jsx("span", {
3985
- className: cx("view-params-title"),
3986
- children: "Response"
3987
- }), /* @__PURE__ */ jsx(Select, {
3988
- className: cx("view-status-select-sm"),
3989
- popupClassName: "status-code-dropdown",
3990
- value: selectedStatusCodes[ep.id] ?? (Object.keys(ep.responses ?? {}).includes("200") ? "200" : Object.keys(ep.responses ?? {})[0]),
3991
- onChange: (val) => setSelectedStatusCodes((prev) => ({
3992
- ...prev,
3993
- [ep.id]: val
3994
- })),
3995
- options: Object.keys(ep.responses ?? {}).map((code) => ({
3996
- value: code,
3997
- label: /* @__PURE__ */ jsxs("span", {
3998
- className: cx("status-label"),
3999
- children: [/* @__PURE__ */ jsx("span", {
4000
- className: cx("status-dot"),
4001
- style: { background: getStatusCodeColor(code, antdToken).dot }
4002
- }), /* @__PURE__ */ jsx("span", { children: code })]
5221
+ children: [
5222
+ /* @__PURE__ */ jsxs("div", {
5223
+ className: cx("view-params-header"),
5224
+ children: [/* @__PURE__ */ jsx("span", {
5225
+ className: cx("view-params-title"),
5226
+ children: "Response"
5227
+ }), /* @__PURE__ */ jsx(Select, {
5228
+ className: cx("view-status-select-sm"),
5229
+ popupClassName: "status-code-dropdown",
5230
+ value: selectedStatusCodes[ep.id] ?? (Object.keys(ep.responses ?? {}).includes("200") ? "200" : Object.keys(ep.responses ?? {})[0]),
5231
+ onChange: (val) => setSelectedStatusCodes((prev) => ({
5232
+ ...prev,
5233
+ [ep.id]: val
5234
+ })),
5235
+ options: Object.keys(ep.responses ?? {}).map((code) => ({
5236
+ value: code,
5237
+ label: /* @__PURE__ */ jsxs("span", {
5238
+ className: cx("status-label"),
5239
+ children: [/* @__PURE__ */ jsx("span", {
5240
+ className: cx("status-dot"),
5241
+ style: { background: getStatusCodeColor(code, antdToken).dot }
5242
+ }), /* @__PURE__ */ jsx("span", { children: code })]
5243
+ })
5244
+ })),
5245
+ size: "middle"
5246
+ })]
5247
+ }),
5248
+ (() => {
5249
+ const allVResRows = buildViewParamRows(endpointResponseParams[ep.id] ?? []);
5250
+ const vResPage = responsePages.get(ep.id) ?? 1;
5251
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Table, {
5252
+ dataSource: allVResRows.slice((vResPage - 1) * VIEW_PAGE_SIZE, vResPage * VIEW_PAGE_SIZE),
5253
+ columns: viewParamColumns,
5254
+ pagination: false,
5255
+ rowClassName: (_, idx) => cx(idx % 2 === 0 ? "view-row-odd" : "view-row-even"),
5256
+ size: "small",
5257
+ bordered: true
5258
+ }), allVResRows.length > VIEW_PAGE_SIZE && /* @__PURE__ */ jsx("div", {
5259
+ style: { paddingBottom: 12 },
5260
+ children: /* @__PURE__ */ jsx(Pagination, {
5261
+ current: vResPage,
5262
+ pageSize: VIEW_PAGE_SIZE,
5263
+ total: allVResRows.length,
5264
+ onChange: (page) => setResponsePages((prev) => new Map(prev).set(ep.id, page)),
5265
+ showSizeChanger: false,
5266
+ className: cx("pagination")
4003
5267
  })
4004
- })),
4005
- size: "middle"
4006
- })]
4007
- }), /* @__PURE__ */ jsx(Table, {
4008
- dataSource: buildViewParamRows(endpointResponseParams[ep.id] ?? []),
4009
- columns: viewParamColumns,
4010
- pagination: false,
4011
- rowClassName: (_, idx) => cx(idx % 2 === 0 ? "view-row-odd" : "view-row-even"),
4012
- size: "small",
4013
- bordered: true
4014
- })]
5268
+ })] });
5269
+ })(),
5270
+ (() => {
5271
+ const selectedCode = selectedStatusCodes[ep.id] ?? (Object.keys(ep.responses ?? {}).includes("200") ? "200" : Object.keys(ep.responses ?? {})[0]);
5272
+ const responseContent = ep.responses?.[selectedCode]?.content;
5273
+ if (!responseContent) return null;
5274
+ const schema = Object.values(responseContent)[0]?.schema;
5275
+ if (!schema) return null;
5276
+ return /* @__PURE__ */ jsx("div", {
5277
+ className: cx("code-panel"),
5278
+ style: { marginTop: token.marginSM },
5279
+ children: /* @__PURE__ */ jsx("code", {
5280
+ className: cx("code-area"),
5281
+ children: JSON.stringify(schema, null, 2)
5282
+ })
5283
+ });
5284
+ })()
5285
+ ]
4015
5286
  })]
4016
5287
  }),
4017
5288
  isExpanded && mode !== "view" && /* @__PURE__ */ jsxs("div", {
@@ -4031,7 +5302,9 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
4031
5302
  }), /* @__PURE__ */ jsx(Input, {
4032
5303
  size: "large",
4033
5304
  value: endpointNames[ep.id] ?? ep.summary ?? "",
4034
- onChange: (e) => onEndpointNameChange(ep.id, e.target.value)
5305
+ onChange: (e) => onEndpointNameChange(ep.id, e.target.value),
5306
+ maxLength: 100,
5307
+ showCount: true
4035
5308
  })]
4036
5309
  }), /* @__PURE__ */ jsxs("div", {
4037
5310
  className: cx("form-field"),
@@ -4264,9 +5537,8 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
4264
5537
  style: {
4265
5538
  padding: 0,
4266
5539
  lineHeight: 1,
4267
- width: 32,
4268
- height: 32,
4269
- fontSize: 20
5540
+ width: 40,
5541
+ height: 40
4270
5542
  },
4271
5543
  className: cx("param-delete-btn"),
4272
5544
  onClick: () => setDeleteParamModal({
@@ -4278,7 +5550,16 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
4278
5550
  })
4279
5551
  }), /* @__PURE__ */ jsx(Button, {
4280
5552
  ghost: true,
4281
- icon: /* @__PURE__ */ jsx(EditOutlined, {}),
5553
+ icon: /* @__PURE__ */ jsx(EditTag, {
5554
+ width: 18,
5555
+ height: 18
5556
+ }),
5557
+ style: {
5558
+ width: 40,
5559
+ height: 40,
5560
+ padding: 0,
5561
+ lineHeight: 1
5562
+ },
4282
5563
  className: cx("param-edit-btn"),
4283
5564
  onClick: () => {
4284
5565
  setDrawerSource("request");
@@ -4375,14 +5656,15 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
4375
5656
  className: cx("param-actions"),
4376
5657
  children: [/* @__PURE__ */ jsx(Button, {
4377
5658
  danger: true,
4378
- type: "text",
4379
5659
  icon: /* @__PURE__ */ jsx(Trash, {
4380
- height: 32,
4381
- width: 32
5660
+ width: 32,
5661
+ height: 32
4382
5662
  }),
4383
5663
  style: {
4384
5664
  padding: 0,
4385
- lineHeight: 1
5665
+ lineHeight: 1,
5666
+ width: 40,
5667
+ height: 40
4386
5668
  },
4387
5669
  className: cx("param-delete-btn"),
4388
5670
  onClick: () => setDeleteParamModal({
@@ -4394,7 +5676,16 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
4394
5676
  })
4395
5677
  }), /* @__PURE__ */ jsx(Button, {
4396
5678
  ghost: true,
4397
- icon: /* @__PURE__ */ jsx(EditOutlined, {}),
5679
+ icon: /* @__PURE__ */ jsx(EditTag, {
5680
+ width: 18,
5681
+ height: 18
5682
+ }),
5683
+ style: {
5684
+ width: 40,
5685
+ height: 40,
5686
+ padding: 0,
5687
+ lineHeight: 1
5688
+ },
4398
5689
  className: cx("param-edit-btn"),
4399
5690
  onClick: () => {
4400
5691
  setDrawerSource("request");
@@ -4703,9 +5994,8 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
4703
5994
  style: {
4704
5995
  padding: 0,
4705
5996
  lineHeight: 1,
4706
- width: 32,
4707
- height: 32,
4708
- fontSize: 20
5997
+ width: 40,
5998
+ height: 40
4709
5999
  },
4710
6000
  className: cx("param-delete-btn"),
4711
6001
  onClick: () => setDeleteParamModal({
@@ -4717,7 +6007,16 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
4717
6007
  })
4718
6008
  }), /* @__PURE__ */ jsx(Button, {
4719
6009
  ghost: true,
4720
- icon: /* @__PURE__ */ jsx(EditOutlined, {}),
6010
+ icon: /* @__PURE__ */ jsx(EditTag, {
6011
+ width: 18,
6012
+ height: 18
6013
+ }),
6014
+ style: {
6015
+ width: 40,
6016
+ height: 40,
6017
+ padding: 0,
6018
+ lineHeight: 1
6019
+ },
4721
6020
  className: cx("param-edit-btn"),
4722
6021
  onClick: () => {
4723
6022
  setDrawerSource("response");
@@ -4814,7 +6113,16 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
4814
6113
  className: cx("param-actions"),
4815
6114
  children: [/* @__PURE__ */ jsx(Button, {
4816
6115
  ghost: true,
4817
- icon: /* @__PURE__ */ jsx(EditOutlined, {}),
6116
+ icon: /* @__PURE__ */ jsx(EditTag, {
6117
+ width: 18,
6118
+ height: 18
6119
+ }),
6120
+ style: {
6121
+ width: 40,
6122
+ height: 40,
6123
+ padding: 0,
6124
+ lineHeight: 1
6125
+ },
4818
6126
  className: cx("param-edit-btn"),
4819
6127
  onClick: () => {
4820
6128
  setDrawerSource("response");
@@ -4825,14 +6133,15 @@ const EndpointsSection = ({ endpointsByTag, collapsed = false, onToggleCollapse,
4825
6133
  }
4826
6134
  }), /* @__PURE__ */ jsx(Button, {
4827
6135
  danger: true,
4828
- type: "text",
4829
6136
  icon: /* @__PURE__ */ jsx(Trash, {
4830
- height: 18,
4831
- width: 18
6137
+ width: 32,
6138
+ height: 32
4832
6139
  }),
4833
6140
  style: {
4834
6141
  padding: 0,
4835
- lineHeight: 1
6142
+ lineHeight: 1,
6143
+ width: 40,
6144
+ height: 40
4836
6145
  },
4837
6146
  className: cx("param-delete-btn"),
4838
6147
  onClick: () => setDeleteParamModal({
@@ -5073,7 +6382,7 @@ const UnsavedChangesBanner = ({ onClose }) => {
5073
6382
  children: /* @__PURE__ */ jsx(Alert, {
5074
6383
  className: cx("alert"),
5075
6384
  type: "warning",
5076
- message: "There are changes you made may not be saved",
6385
+ message: "There are changes you made that may not be saved",
5077
6386
  closable: true,
5078
6387
  onClose,
5079
6388
  icon: /* @__PURE__ */ jsx(ExclamationCircleFilled, {}),
@@ -5084,57 +6393,50 @@ const UnsavedChangesBanner = ({ onClose }) => {
5084
6393
  //#endregion
5085
6394
  //#region src/view/components/ApiPage/components/TagsSection.tsx
5086
6395
  const { useBreakpoint: useBreakpoint$1 } = Grid;
5087
- const TagsSection = ({ tags, collapsed = false, onToggleCollapse, onAddTag, onEditTag, onDeleteTag }) => {
6396
+ const TAGS_PAGE_SIZE = 8;
6397
+ const TagsSection = ({ tags, collapsed, onToggleCollapse, onAddTag, onEditTag, onDeleteTag }) => {
5088
6398
  const isMobile = !useBreakpoint$1().md;
6399
+ const [currentPage, setCurrentPage] = useState(1);
6400
+ const sortedTags = [...tags].sort((a, b) => a.isDefault === b.isDefault ? 0 : a.isDefault ? -1 : 1);
6401
+ const maxPage = Math.max(1, Math.ceil(tags.length / TAGS_PAGE_SIZE));
6402
+ const safePage = Math.min(currentPage, maxPage);
6403
+ const paginatedTags = sortedTags.slice((safePage - 1) * TAGS_PAGE_SIZE, safePage * TAGS_PAGE_SIZE);
5089
6404
  const { wrapSSR, cx, token } = useStyle("TagsSection", (token, scope) => ({
5090
6405
  [scope("root")]: {
5091
6406
  display: "flex",
5092
6407
  flexDirection: "column",
5093
- borderRadius: token.borderRadius,
5094
- overflow: "hidden",
5095
- width: "100%",
5096
- flexShrink: 0
6408
+ gap: token.margin,
6409
+ padding: token.marginLG,
6410
+ background: token.colorBgElevated,
6411
+ borderRadius: token.borderRadiusLG,
6412
+ width: "100%"
5097
6413
  },
5098
6414
  [scope("head")]: {
5099
6415
  display: "flex",
5100
6416
  alignItems: "center",
5101
6417
  justifyContent: "space-between",
5102
- padding: `${token.paddingXS}px ${token.paddingLG}px`,
5103
- background: token.colorPrimaryBg,
5104
- borderRadius: `${token.borderRadius}px ${token.borderRadius}px 0 0`
5105
- },
5106
- [scope("head-actions")]: {
5107
- display: "flex",
5108
- alignItems: "center",
5109
- gap: token.margin
6418
+ width: "100%"
5110
6419
  },
5111
- [scope("body")]: {
6420
+ [scope("tags-list")]: {
5112
6421
  display: "flex",
5113
6422
  flexDirection: "column",
5114
- gap: 0,
5115
- padding: token.paddingLG,
5116
- background: token.colorBgElevated,
5117
- borderRadius: `0 0 ${token.borderRadius}px ${token.borderRadius}px`
6423
+ width: "100%"
5118
6424
  },
5119
6425
  [scope("tag-row")]: {
5120
6426
  display: "flex",
5121
6427
  alignItems: "center",
5122
6428
  justifyContent: "space-between",
5123
- height: 50,
5124
- paddingTop: token.controlHeightLG,
5125
- paddingBottom: token.controlHeightLG,
5126
- paddingRight: token.paddingLG,
5127
- borderBottom: `1px solid ${token.colorBorder}`,
5128
- width: "100%"
5129
- },
5130
- [scope("tag-row-last")]: {
5131
- borderBottom: "none",
5132
- paddingBottom: token.marginLG
6429
+ minHeight: 50,
6430
+ paddingTop: 12,
6431
+ paddingBottom: 12,
6432
+ width: "100%",
6433
+ borderBottom: `1px solid ${token.colorBorder}`
5133
6434
  },
6435
+ [scope("tag-row-last")]: { borderBottom: "none" },
5134
6436
  [scope("tag-info")]: {
5135
6437
  display: "flex",
5136
6438
  alignItems: "center",
5137
- gap: 32,
6439
+ gap: token.marginXL,
5138
6440
  flex: 1,
5139
6441
  minWidth: 0
5140
6442
  },
@@ -5170,32 +6472,13 @@ const TagsSection = ({ tags, collapsed = false, onToggleCollapse, onAddTag, onEd
5170
6472
  alignItems: "center",
5171
6473
  gap: token.margin
5172
6474
  },
5173
- [scope("btn-delete")]: {
5174
- width: 40,
5175
- height: 40,
5176
- border: `1px solid ${token.colorError}`,
5177
- borderRadius: token.borderRadius,
5178
- display: "flex",
5179
- alignItems: "center",
5180
- justifyContent: "center"
5181
- },
5182
- [scope("btn-edit")]: {
5183
- width: 40,
5184
- height: 40,
5185
- border: `1px solid ${token.colorBorder}`,
5186
- borderRadius: token.borderRadius,
5187
- background: token.colorBgContainer,
5188
- boxShadow: "0px 2px 0px 0px rgba(0,0,0,0.02)",
5189
- display: "flex",
5190
- alignItems: "center",
5191
- justifyContent: "center"
5192
- },
5193
6475
  [scope("tag-row-mobile")]: {
5194
6476
  display: "flex",
5195
6477
  flexDirection: "row",
5196
6478
  alignItems: "flex-start",
5197
6479
  justifyContent: "space-between",
5198
6480
  gap: 8,
6481
+ paddingTop: 12,
5199
6482
  paddingBottom: token.margin,
5200
6483
  borderBottom: `1px solid ${token.colorBorder}`,
5201
6484
  width: "100%",
@@ -5225,16 +6508,176 @@ const TagsSection = ({ tags, collapsed = false, onToggleCollapse, onAddTag, onEd
5225
6508
  display: "flex",
5226
6509
  flexDirection: "column",
5227
6510
  gap: 0,
5228
- padding: token.paddingMD,
5229
- background: token.colorBgElevated,
5230
- borderRadius: `0 0 ${token.borderRadius}px ${token.borderRadius}px`,
5231
6511
  overflowX: "auto"
6512
+ },
6513
+ [scope("head-collapse")]: {
6514
+ display: "flex",
6515
+ alignItems: "center",
6516
+ justifyContent: "space-between",
6517
+ padding: `${token.paddingXS}px ${token.paddingLG}px`,
6518
+ background: token.colorPrimaryBg,
6519
+ borderRadius: `${token.borderRadius}px ${token.borderRadius}px 0 0`
6520
+ },
6521
+ [scope("body-collapse")]: {
6522
+ display: "flex",
6523
+ flexDirection: "column",
6524
+ gap: token.margin,
6525
+ padding: token.paddingLG,
6526
+ background: token.colorBgElevated,
6527
+ borderRadius: `0 0 ${token.borderRadius}px ${token.borderRadius}px`
6528
+ },
6529
+ [scope("pagination")]: {
6530
+ display: "flex",
6531
+ justifyContent: "center",
6532
+ marginTop: token.marginMD,
6533
+ ".ant-pagination-item-active": {
6534
+ backgroundColor: token.colorBgContainer,
6535
+ borderColor: token.colorPrimary,
6536
+ borderRadius: token.borderRadius,
6537
+ display: "flex",
6538
+ alignItems: "center",
6539
+ justifyContent: "center",
6540
+ a: {
6541
+ color: token.colorPrimary,
6542
+ fontWeight: token.fontWeightStrong,
6543
+ fontSize: token.fontSize,
6544
+ lineHeight: "22px",
6545
+ display: "flex",
6546
+ alignItems: "center",
6547
+ justifyContent: "center",
6548
+ height: "100%"
6549
+ }
6550
+ },
6551
+ ".ant-pagination-item": {
6552
+ borderRadius: token.borderRadius,
6553
+ minWidth: 32,
6554
+ height: 32,
6555
+ lineHeight: "32px",
6556
+ a: {
6557
+ color: token.colorText,
6558
+ fontWeight: 400,
6559
+ fontSize: token.fontSize
6560
+ }
6561
+ },
6562
+ ".ant-pagination-prev .ant-pagination-item-link, .ant-pagination-next .ant-pagination-item-link": {
6563
+ borderRadius: token.borderRadius,
6564
+ width: 32,
6565
+ height: 32,
6566
+ display: "flex",
6567
+ alignItems: "center",
6568
+ justifyContent: "center",
6569
+ border: "none",
6570
+ background: "transparent"
6571
+ }
5232
6572
  }
5233
6573
  }));
5234
- return wrapSSR(/* @__PURE__ */ jsxs("div", {
5235
- className: cx("root"),
6574
+ const mobileTagsList = /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
6575
+ className: cx("body-mobile"),
6576
+ children: paginatedTags.map((tag, index) => {
6577
+ return /* @__PURE__ */ jsxs("div", {
6578
+ className: cx("tag-row-mobile", index === paginatedTags.length - 1 ? "tag-row-mobile-last" : ""),
6579
+ children: [/* @__PURE__ */ jsxs("div", {
6580
+ className: cx("tag-info-mobile"),
6581
+ children: [/* @__PURE__ */ jsxs("div", {
6582
+ className: cx("tag-col-mobile"),
6583
+ children: [/* @__PURE__ */ jsx("span", {
6584
+ className: cx("col-label"),
6585
+ style: {
6586
+ fontSize: token.fontSize,
6587
+ lineHeight: "20px"
6588
+ },
6589
+ children: "Tag Name:"
6590
+ }), /* @__PURE__ */ jsx("span", {
6591
+ className: cx("col-value"),
6592
+ style: {
6593
+ fontSize: token.fontSize,
6594
+ lineHeight: "20px",
6595
+ overflow: "hidden",
6596
+ textOverflow: "ellipsis",
6597
+ whiteSpace: "nowrap"
6598
+ },
6599
+ children: tag.name
6600
+ })]
6601
+ }), /* @__PURE__ */ jsxs("div", {
6602
+ className: cx("tag-col-mobile"),
6603
+ children: [/* @__PURE__ */ jsx("span", {
6604
+ className: cx("col-label"),
6605
+ style: {
6606
+ fontSize: token.fontSize,
6607
+ lineHeight: "20px"
6608
+ },
6609
+ children: "Description:"
6610
+ }), /* @__PURE__ */ jsx(Tooltip, {
6611
+ title: tag.description && tag.description.length > 20 ? tag.description : "",
6612
+ children: /* @__PURE__ */ jsx("span", {
6613
+ className: cx("col-value"),
6614
+ style: {
6615
+ fontSize: token.fontSize,
6616
+ lineHeight: "20px",
6617
+ overflow: "hidden",
6618
+ textOverflow: "ellipsis",
6619
+ whiteSpace: "nowrap",
6620
+ maxWidth: 140,
6621
+ display: "block"
6622
+ },
6623
+ children: tag.description ?? "-"
6624
+ })
6625
+ })]
6626
+ })]
6627
+ }), /* @__PURE__ */ jsxs("div", {
6628
+ className: cx("tag-actions"),
6629
+ style: {
6630
+ paddingTop: 6,
6631
+ flexShrink: 0
6632
+ },
6633
+ children: [/* @__PURE__ */ jsx(Tooltip, {
6634
+ title: tag.isDefault ? "The default tag cannot be deleted or edited" : "",
6635
+ children: /* @__PURE__ */ jsx(Button, {
6636
+ danger: true,
6637
+ type: "text",
6638
+ icon: /* @__PURE__ */ jsx(Trash, {
6639
+ width: 32,
6640
+ height: 32
6641
+ }),
6642
+ disabled: tag.isDefault,
6643
+ onClick: () => !tag.isDefault && onDeleteTag?.(tag.name),
6644
+ style: {
6645
+ width: 40,
6646
+ height: 40,
6647
+ padding: 0,
6648
+ lineHeight: 1
6649
+ }
6650
+ })
6651
+ }), /* @__PURE__ */ jsx(Tooltip, {
6652
+ title: tag.isDefault ? "The default tag cannot be deleted or edited" : "",
6653
+ children: /* @__PURE__ */ jsx(Button, {
6654
+ icon: /* @__PURE__ */ jsx(EditTag, {}),
6655
+ disabled: tag.isDefault,
6656
+ onClick: () => !tag.isDefault && onEditTag?.(tag),
6657
+ style: {
6658
+ width: 32,
6659
+ height: 32,
6660
+ padding: 0,
6661
+ lineHeight: 1,
6662
+ ...!tag.isDefault && { color: "#A146B3" }
6663
+ }
6664
+ })
6665
+ })]
6666
+ })]
6667
+ }, tag.name);
6668
+ })
6669
+ }), tags.length > TAGS_PAGE_SIZE && /* @__PURE__ */ jsx(Pagination, {
6670
+ current: safePage,
6671
+ pageSize: TAGS_PAGE_SIZE,
6672
+ total: tags.length,
6673
+ onChange: setCurrentPage,
6674
+ showSizeChanger: false,
6675
+ className: cx("pagination")
6676
+ })] });
6677
+ return wrapSSR(isMobile ? /* @__PURE__ */ jsxs("div", {
6678
+ style: { width: "100%" },
5236
6679
  children: [/* @__PURE__ */ jsxs("div", {
5237
- className: cx("head"),
6680
+ className: cx("head-collapse"),
5238
6681
  children: [/* @__PURE__ */ jsx(Title, {
5239
6682
  level: 4,
5240
6683
  style: {
@@ -5243,7 +6686,11 @@ const TagsSection = ({ tags, collapsed = false, onToggleCollapse, onAddTag, onEd
5243
6686
  },
5244
6687
  children: "Tags"
5245
6688
  }), /* @__PURE__ */ jsxs("div", {
5246
- className: cx("head-actions"),
6689
+ style: {
6690
+ display: "flex",
6691
+ alignItems: "center",
6692
+ gap: token.marginXS
6693
+ },
5247
6694
  children: [/* @__PURE__ */ jsx(Button, {
5248
6695
  ghost: true,
5249
6696
  type: "primary",
@@ -5262,208 +6709,149 @@ const TagsSection = ({ tags, collapsed = false, onToggleCollapse, onAddTag, onEd
5262
6709
  }
5263
6710
  })]
5264
6711
  })]
5265
- }), !collapsed && (isMobile ? /* @__PURE__ */ jsx("div", {
5266
- className: cx("body-mobile"),
5267
- children: tags.map((tag, index) => {
5268
- return /* @__PURE__ */ jsxs("div", {
5269
- className: cx("tag-row-mobile", index === tags.length - 1 ? "tag-row-mobile-last" : ""),
5270
- children: [/* @__PURE__ */ jsxs("div", {
5271
- className: cx("tag-info-mobile"),
6712
+ }), !collapsed && /* @__PURE__ */ jsx("div", {
6713
+ className: cx("body-collapse"),
6714
+ children: mobileTagsList
6715
+ })]
6716
+ }) : /* @__PURE__ */ jsxs("div", {
6717
+ className: cx("root"),
6718
+ children: [
6719
+ /* @__PURE__ */ jsxs("div", {
6720
+ className: cx("head"),
6721
+ children: [/* @__PURE__ */ jsx(Title, {
6722
+ level: 4,
6723
+ style: {
6724
+ margin: 0,
6725
+ color: token.colorTextHeading
6726
+ },
6727
+ children: "Tags"
6728
+ }), /* @__PURE__ */ jsx(Button, {
6729
+ ghost: true,
6730
+ type: "primary",
6731
+ icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
6732
+ onClick: onAddTag,
6733
+ style: { borderRadius: token.borderRadius },
6734
+ children: "Add Tag"
6735
+ })]
6736
+ }),
6737
+ /* @__PURE__ */ jsx("div", {
6738
+ className: cx("tags-list"),
6739
+ children: paginatedTags.map((tag, index) => {
6740
+ return /* @__PURE__ */ jsxs("div", {
6741
+ className: cx("tag-row", index === paginatedTags.length - 1 ? "tag-row-last" : ""),
5272
6742
  children: [/* @__PURE__ */ jsxs("div", {
5273
- className: cx("tag-col-mobile"),
5274
- children: [/* @__PURE__ */ jsx("span", {
5275
- className: cx("col-label"),
5276
- style: {
5277
- fontSize: token.fontSize,
5278
- lineHeight: "20px"
5279
- },
5280
- children: "Tag Name:"
5281
- }), /* @__PURE__ */ jsx("span", {
5282
- className: cx("col-value"),
5283
- style: {
5284
- fontSize: token.fontSize,
5285
- lineHeight: "20px",
5286
- overflow: "hidden",
5287
- textOverflow: "ellipsis",
5288
- whiteSpace: "nowrap"
5289
- },
5290
- children: tag.name
5291
- })]
6743
+ className: cx("tag-info"),
6744
+ children: [
6745
+ /* @__PURE__ */ jsxs("div", {
6746
+ className: cx("tag-col"),
6747
+ style: { width: 200 },
6748
+ children: [/* @__PURE__ */ jsx("span", {
6749
+ className: cx("col-label"),
6750
+ children: "Tag Name"
6751
+ }), /* @__PURE__ */ jsx("span", {
6752
+ className: cx("col-value"),
6753
+ children: tag.name
6754
+ })]
6755
+ }),
6756
+ /* @__PURE__ */ jsxs("div", {
6757
+ className: cx("tag-col"),
6758
+ style: { width: 280 },
6759
+ children: [/* @__PURE__ */ jsx("span", {
6760
+ className: cx("col-label"),
6761
+ children: "Description"
6762
+ }), /* @__PURE__ */ jsx(Tooltip, {
6763
+ title: tag.description && tag.description.length > 30 ? tag.description : "",
6764
+ children: /* @__PURE__ */ jsx("span", {
6765
+ className: cx("col-value"),
6766
+ style: {
6767
+ overflow: "hidden",
6768
+ textOverflow: "ellipsis",
6769
+ whiteSpace: "nowrap",
6770
+ maxWidth: 280,
6771
+ display: "block"
6772
+ },
6773
+ children: tag.description ?? "-"
6774
+ })
6775
+ })]
6776
+ }),
6777
+ /* @__PURE__ */ jsxs("div", {
6778
+ className: cx("tag-col"),
6779
+ style: {
6780
+ flex: 1,
6781
+ minWidth: 0
6782
+ },
6783
+ children: [/* @__PURE__ */ jsx("span", {
6784
+ className: cx("col-label"),
6785
+ children: "External Docs"
6786
+ }), tag.externalDocsUrl ? /* @__PURE__ */ jsx(Tooltip, {
6787
+ title: tag.externalDocsUrl.length > 25 ? tag.externalDocsUrl : "",
6788
+ children: /* @__PURE__ */ jsx("a", {
6789
+ href: tag.externalDocsUrl,
6790
+ target: "_blank",
6791
+ rel: "noreferrer",
6792
+ className: cx("col-value-link"),
6793
+ style: {
6794
+ overflow: "hidden",
6795
+ textOverflow: "ellipsis",
6796
+ whiteSpace: "nowrap",
6797
+ display: "block"
6798
+ },
6799
+ children: tag.externalDocsUrl
6800
+ })
6801
+ }) : /* @__PURE__ */ jsx("span", {
6802
+ className: cx("col-value"),
6803
+ children: "-"
6804
+ })]
6805
+ })
6806
+ ]
5292
6807
  }), /* @__PURE__ */ jsxs("div", {
5293
- className: cx("tag-col-mobile"),
5294
- children: [/* @__PURE__ */ jsx("span", {
5295
- className: cx("col-label"),
5296
- style: {
5297
- fontSize: token.fontSize,
5298
- lineHeight: "20px"
5299
- },
5300
- children: "Description:"
6808
+ className: cx("tag-actions"),
6809
+ children: [/* @__PURE__ */ jsx(Tooltip, {
6810
+ title: tag.isDefault ? "The default tag cannot be deleted or edited" : "",
6811
+ children: /* @__PURE__ */ jsx(Button, {
6812
+ danger: true,
6813
+ type: "text",
6814
+ icon: /* @__PURE__ */ jsx(Trash, {
6815
+ width: 32,
6816
+ height: 32
6817
+ }),
6818
+ disabled: tag.isDefault,
6819
+ onClick: () => !tag.isDefault && onDeleteTag?.(tag.name),
6820
+ style: {
6821
+ width: 40,
6822
+ height: 40,
6823
+ padding: 0,
6824
+ lineHeight: 1
6825
+ }
6826
+ })
5301
6827
  }), /* @__PURE__ */ jsx(Tooltip, {
5302
- title: tag.description && tag.description.length > 20 ? tag.description : "",
5303
- children: /* @__PURE__ */ jsx("span", {
5304
- className: cx("col-value"),
6828
+ title: tag.isDefault ? "The default tag cannot be deleted or edited" : "",
6829
+ children: /* @__PURE__ */ jsx(Button, {
6830
+ icon: /* @__PURE__ */ jsx(EditTag, {}),
6831
+ disabled: tag.isDefault,
6832
+ onClick: () => !tag.isDefault && onEditTag?.(tag),
5305
6833
  style: {
5306
- fontSize: token.fontSize,
5307
- lineHeight: "20px",
5308
- overflow: "hidden",
5309
- textOverflow: "ellipsis",
5310
- whiteSpace: "nowrap",
5311
- maxWidth: 140,
5312
- display: "block"
5313
- },
5314
- children: tag.description ?? "-"
6834
+ width: 32,
6835
+ height: 32,
6836
+ padding: 0,
6837
+ lineHeight: 1,
6838
+ ...!tag.isDefault && { color: "#A146B3" }
6839
+ }
5315
6840
  })
5316
6841
  })]
5317
6842
  })]
5318
- }), /* @__PURE__ */ jsxs("div", {
5319
- className: cx("tag-actions"),
5320
- style: {
5321
- paddingTop: 6,
5322
- flexShrink: 0
5323
- },
5324
- children: [/* @__PURE__ */ jsx(Tooltip, {
5325
- title: tag.isDefault ? "The default tag cannot be deleted or edited" : "",
5326
- children: /* @__PURE__ */ jsx(Button, {
5327
- danger: true,
5328
- type: "text",
5329
- icon: /* @__PURE__ */ jsx(Trash, {
5330
- width: 32,
5331
- height: 32
5332
- }),
5333
- disabled: tag.isDefault,
5334
- onClick: () => !tag.isDefault && onDeleteTag?.(tag.name),
5335
- style: {
5336
- width: 40,
5337
- height: 40,
5338
- padding: 0,
5339
- lineHeight: 1
5340
- }
5341
- })
5342
- }), /* @__PURE__ */ jsx(Tooltip, {
5343
- title: tag.isDefault ? "The default tag cannot be deleted or edited" : "",
5344
- children: /* @__PURE__ */ jsx(Button, {
5345
- icon: /* @__PURE__ */ jsx(EditOutlined, { style: { fontSize: 18 } }),
5346
- disabled: tag.isDefault,
5347
- onClick: () => !tag.isDefault && onEditTag?.(tag),
5348
- style: {
5349
- width: 32,
5350
- height: 32,
5351
- padding: 0,
5352
- lineHeight: 1
5353
- }
5354
- })
5355
- })]
5356
- })]
5357
- }, tag.name);
5358
- })
5359
- }) : /* @__PURE__ */ jsx("div", {
5360
- className: cx("body"),
5361
- children: tags.map((tag, index) => {
5362
- return /* @__PURE__ */ jsxs("div", {
5363
- className: cx("tag-row", index === tags.length - 1 ? "tag-row-last" : ""),
5364
- children: [/* @__PURE__ */ jsxs("div", {
5365
- className: cx("tag-info"),
5366
- children: [
5367
- /* @__PURE__ */ jsxs("div", {
5368
- className: cx("tag-col"),
5369
- style: { width: 200 },
5370
- children: [/* @__PURE__ */ jsx("span", {
5371
- className: cx("col-label"),
5372
- children: "Tag Name"
5373
- }), /* @__PURE__ */ jsx("span", {
5374
- className: cx("col-value"),
5375
- children: tag.name
5376
- })]
5377
- }),
5378
- /* @__PURE__ */ jsxs("div", {
5379
- className: cx("tag-col"),
5380
- style: { width: 280 },
5381
- children: [/* @__PURE__ */ jsx("span", {
5382
- className: cx("col-label"),
5383
- children: "Description"
5384
- }), /* @__PURE__ */ jsx(Tooltip, {
5385
- title: tag.description && tag.description.length > 30 ? tag.description : "",
5386
- children: /* @__PURE__ */ jsx("span", {
5387
- className: cx("col-value"),
5388
- style: {
5389
- overflow: "hidden",
5390
- textOverflow: "ellipsis",
5391
- whiteSpace: "nowrap",
5392
- maxWidth: 280,
5393
- display: "block"
5394
- },
5395
- children: tag.description ?? "-"
5396
- })
5397
- })]
5398
- }),
5399
- /* @__PURE__ */ jsxs("div", {
5400
- className: cx("tag-col"),
5401
- style: {
5402
- flex: 1,
5403
- minWidth: 0
5404
- },
5405
- children: [/* @__PURE__ */ jsx("span", {
5406
- className: cx("col-label"),
5407
- children: "External Docs"
5408
- }), tag.externalDocsUrl ? /* @__PURE__ */ jsx(Tooltip, {
5409
- title: tag.externalDocsUrl.length > 25 ? tag.externalDocsUrl : "",
5410
- children: /* @__PURE__ */ jsx("a", {
5411
- href: tag.externalDocsUrl,
5412
- target: "_blank",
5413
- rel: "noreferrer",
5414
- className: cx("col-value-link"),
5415
- style: {
5416
- overflow: "hidden",
5417
- textOverflow: "ellipsis",
5418
- whiteSpace: "nowrap",
5419
- display: "block"
5420
- },
5421
- children: tag.externalDocsUrl
5422
- })
5423
- }) : /* @__PURE__ */ jsx("span", {
5424
- className: cx("col-value"),
5425
- children: "-"
5426
- })]
5427
- })
5428
- ]
5429
- }), /* @__PURE__ */ jsxs("div", {
5430
- className: cx("tag-actions"),
5431
- children: [/* @__PURE__ */ jsx(Tooltip, {
5432
- title: tag.isDefault ? "The default tag cannot be deleted or edited" : "",
5433
- children: /* @__PURE__ */ jsx(Button, {
5434
- danger: true,
5435
- type: "text",
5436
- icon: /* @__PURE__ */ jsx(Trash, {
5437
- width: 32,
5438
- height: 32
5439
- }),
5440
- disabled: tag.isDefault,
5441
- onClick: () => !tag.isDefault && onDeleteTag?.(tag.name),
5442
- style: {
5443
- width: 40,
5444
- height: 40,
5445
- padding: 0,
5446
- lineHeight: 1
5447
- }
5448
- })
5449
- }), /* @__PURE__ */ jsx(Tooltip, {
5450
- title: tag.isDefault ? "The default tag cannot be deleted or edited" : "",
5451
- children: /* @__PURE__ */ jsx(Button, {
5452
- icon: /* @__PURE__ */ jsx(EditOutlined, { style: { fontSize: 18 } }),
5453
- disabled: tag.isDefault,
5454
- onClick: () => !tag.isDefault && onEditTag?.(tag),
5455
- style: {
5456
- width: 32,
5457
- height: 32,
5458
- padding: 0,
5459
- lineHeight: 1
5460
- }
5461
- })
5462
- })]
5463
- })]
5464
- }, tag.name);
6843
+ }, tag.name);
6844
+ })
6845
+ }),
6846
+ tags.length > TAGS_PAGE_SIZE && /* @__PURE__ */ jsx(Pagination, {
6847
+ current: safePage,
6848
+ pageSize: TAGS_PAGE_SIZE,
6849
+ total: tags.length,
6850
+ onChange: setCurrentPage,
6851
+ showSizeChanger: false,
6852
+ className: cx("pagination")
5465
6853
  })
5466
- }))]
6854
+ ]
5467
6855
  }));
5468
6856
  };
5469
6857
  //#endregion
@@ -5607,13 +6995,6 @@ const AddTagDrawer = ({ open, onClose, mode, initialValues, onAddTag, onEditTag
5607
6995
  if (open && mode === "edit" && initialValues) form.setFieldsValue(initialValues);
5608
6996
  if (!open) form.resetFields();
5609
6997
  }, [open]);
5610
- useEffect(() => {
5611
- if (!extDocsDesc?.trim()) form.setFields([{
5612
- name: "externalDocsLink",
5613
- value: void 0,
5614
- errors: []
5615
- }]);
5616
- }, [extDocsDesc]);
5617
6998
  useEffect(() => {
5618
6999
  if (extDocsDesc?.trim()) form.validateFields(["externalDocsLink"]).catch(() => {});
5619
7000
  }, [extDocsLink, extDocsDesc]);
@@ -5769,7 +7150,14 @@ const AddTagDrawer = ({ open, onClose, mode, initialValues, onAddTag, onEditTag
5769
7150
  children: /* @__PURE__ */ jsx(Input, {
5770
7151
  showCount: true,
5771
7152
  maxLength: 25,
5772
- placeholder: "Describe External Docs"
7153
+ placeholder: "Describe External Docs",
7154
+ onChange: (e) => {
7155
+ if (!e.target.value?.trim()) form.setFields([{
7156
+ name: "externalDocsLink",
7157
+ value: void 0,
7158
+ errors: []
7159
+ }]);
7160
+ }
5773
7161
  })
5774
7162
  }),
5775
7163
  /* @__PURE__ */ jsx(Form.Item, {
@@ -5794,19 +7182,11 @@ const AddTagDrawer = ({ open, onClose, mode, initialValues, onAddTag, onEditTag
5794
7182
  return Promise.reject(/* @__PURE__ */ new Error("Please enter a valid URL"));
5795
7183
  }
5796
7184
  } }],
5797
- children: /* @__PURE__ */ jsx(Tooltip, {
5798
- title: !isLinkEnabled ? "You need to add the External Docs Description first." : "",
5799
- color: "rgba(0,0,0,0.85)",
5800
- placement: "topLeft",
5801
- children: /* @__PURE__ */ jsx(Input, {
5802
- showCount: true,
5803
- maxLength: 512,
5804
- placeholder: "External Docs Link",
5805
- disabled: !isLinkEnabled,
5806
- onChange: (e) => {
5807
- form.setFieldValue("externalDocsLink", e.target.value);
5808
- }
5809
- })
7185
+ children: /* @__PURE__ */ jsx(Input, {
7186
+ showCount: true,
7187
+ maxLength: 500,
7188
+ placeholder: "External Docs Link",
7189
+ disabled: !isLinkEnabled
5810
7190
  })
5811
7191
  })
5812
7192
  ]
@@ -5883,6 +7263,251 @@ const AddTagDrawer = ({ open, onClose, mode, initialValues, onAddTag, onEditTag
5883
7263
  })
5884
7264
  ] }));
5885
7265
  };
7266
+ //#endregion
7267
+ //#region src/assets/icons/restApi.tsx
7268
+ const RestApiIcon = (props) => /* @__PURE__ */ jsxs("svg", {
7269
+ width: "16",
7270
+ height: "16",
7271
+ viewBox: "0 0 16 16",
7272
+ fill: "none",
7273
+ xmlns: "http://www.w3.org/2000/svg",
7274
+ ...props,
7275
+ children: [/* @__PURE__ */ jsxs("g", {
7276
+ clipPath: "url(#restapi-clip)",
7277
+ children: [
7278
+ /* @__PURE__ */ jsx("path", {
7279
+ d: "M14.4059 7.73805H13.2601V7.23565C13.2601 7.11607 13.1787 7.01187 13.0626 6.98294L12.2915 6.79083L11.8883 5.81794L12.2975 5.13716C12.3591 5.03469 12.343 4.90341 12.2585 4.81888L11.1795 3.73987C11.0949 3.65531 10.9636 3.63922 10.8612 3.70081L10.1804 4.11003L9.20745 3.70685L9.01534 2.9357C8.98644 2.81966 8.88222 2.73823 8.76264 2.73823H8.26032V1.59245C8.26032 1.44862 8.14373 1.33203 7.9999 1.33203C7.85607 1.33203 7.73949 1.44862 7.73949 1.59245V2.73823H7.23709C7.11751 2.73823 7.01331 2.81966 6.98438 2.9357L6.79227 3.70685L5.81938 4.11003L5.1386 3.70081C5.03607 3.63919 4.90485 3.65529 4.82032 3.73987L3.74131 4.81888C3.65675 4.90344 3.64066 5.03471 3.70225 5.13716L4.11146 5.81794L3.70829 6.79083L2.93714 6.98294C2.8211 7.01185 2.73967 7.11607 2.73967 7.23565V7.73805H1.59391C1.45008 7.73805 1.3335 7.85463 1.3335 7.99846C1.3335 8.14226 1.45008 8.25888 1.59391 8.25888H2.73969V8.76128C2.73969 8.88086 2.82113 8.98508 2.93717 9.01396L3.70831 9.20609L4.11149 10.179L3.70225 10.8598C3.64063 10.9623 3.65675 11.0935 3.74131 11.1781L4.82032 12.2571C4.90488 12.3416 5.03615 12.3577 5.13865 12.2961L5.81941 11.8869L6.79232 12.2901L6.98443 13.0612C7.01334 13.1773 7.11756 13.2587 7.23714 13.2587H7.73951V14.4045C7.73951 14.5483 7.8561 14.6649 7.99993 14.6649C8.14376 14.6649 8.26034 14.5483 8.26034 14.4045V13.2587H8.76274C8.88232 13.2587 8.98652 13.1773 9.01545 13.0612L9.20756 12.2901L10.1805 11.8869L10.8612 12.2961C10.9637 12.3577 11.095 12.3416 11.1796 12.2571L12.2586 11.1781C12.3431 11.0935 12.3592 10.9622 12.2976 10.8598L11.8884 10.179L12.2916 9.20609L13.0627 9.01396C13.1788 8.98508 13.2602 8.88086 13.2602 8.76128V8.25888H14.406C14.5498 8.25888 14.6664 8.14226 14.6664 7.99846C14.6663 7.85463 14.5497 7.73805 14.4059 7.73805ZM12.7393 8.55779L12.0382 8.73247C11.9581 8.75245 11.8922 8.80919 11.8606 8.88547L11.3569 10.1009C11.3253 10.1772 11.3318 10.264 11.3743 10.3348L11.7463 10.9537L10.9551 11.7449L10.3362 11.3729C10.2654 11.3303 10.1786 11.3239 10.1023 11.3555L8.88686 11.8592C8.81058 11.8909 8.75383 11.9567 8.73386 12.0369L8.5592 12.7379H7.44055L7.26589 12.0369C7.24592 11.9567 7.18917 11.8909 7.1129 11.8592L5.89743 11.3555C5.82113 11.3239 5.73435 11.3303 5.66355 11.3729L5.04464 11.7449L4.25342 10.9537L4.62545 10.3348C4.668 10.264 4.67443 10.1772 4.64282 10.1009L4.13912 8.88547C4.10751 8.80919 4.04159 8.75245 3.96149 8.73247L3.26045 8.55779V7.43914L3.96152 7.26448C4.04162 7.2445 4.10753 7.18776 4.13915 7.11148L4.64284 5.89602C4.67446 5.81971 4.668 5.73294 4.62548 5.66216L4.25344 5.04325L5.04467 4.25203L5.66357 4.62406C5.73435 4.66661 5.82113 4.67307 5.89743 4.64143L7.1129 4.13773C7.18917 4.10612 7.24592 4.04021 7.26589 3.9601L7.44055 3.25904H8.5592L8.73386 3.9601C8.75383 4.04021 8.81058 4.10612 8.88686 4.13773L10.1023 4.64143C10.1787 4.67305 10.2654 4.66659 10.3362 4.62406L10.9551 4.25203L11.7463 5.04325L11.3743 5.66216C11.3317 5.73294 11.3253 5.81971 11.3569 5.89602L11.8606 7.11148C11.8922 7.18776 11.9581 7.2445 12.0382 7.26448L12.7393 7.43914V8.55779Z",
7280
+ fill: "currentColor"
7281
+ }),
7282
+ /* @__PURE__ */ jsx("path", {
7283
+ d: "M9.14809 4.86755C9.01309 4.81807 8.86346 4.88729 8.8139 5.02229C8.76434 5.15731 8.83364 5.30692 8.96864 5.35648C10.0712 5.76114 10.8121 6.82252 10.8121 7.99757C10.8121 9.54835 9.55041 10.81 7.99965 10.81C6.4489 10.81 5.18729 9.54833 5.18729 7.99755C5.18729 6.88567 5.84426 5.87593 6.86098 5.42515C6.99247 5.36687 7.05179 5.21302 6.99348 5.08156C6.9352 4.9501 6.78132 4.89075 6.64989 4.94906C5.44505 5.48325 4.6665 6.67987 4.6665 7.99755C4.6665 9.83546 6.16176 11.3308 7.99971 11.3308C9.83765 11.3308 11.3329 9.83546 11.3329 7.99755C11.3329 6.605 10.4549 5.34713 9.14809 4.86755Z",
7284
+ fill: "currentColor"
7285
+ }),
7286
+ /* @__PURE__ */ jsx("path", {
7287
+ d: "M8.01348 4.66409L7.99967 4.66406C7.85585 4.66406 7.73926 4.78065 7.73926 4.92448C7.73926 5.06831 7.85585 5.1849 7.99967 5.1849L8.01194 5.18492C8.0122 5.18492 8.01246 5.18492 8.01272 5.18492C8.15618 5.18492 8.2727 5.06883 8.27314 4.92526C8.27355 4.78143 8.1573 4.6645 8.01348 4.66409Z",
7288
+ fill: "currentColor"
7289
+ }),
7290
+ /* @__PURE__ */ jsx("path", {
7291
+ d: "M9.81413 6.96094C9.6703 6.96094 9.55371 7.07753 9.55371 7.22135V8.73919C9.55371 8.883 9.6703 8.99961 9.81413 8.99961C9.95796 8.99961 10.0745 8.883 10.0745 8.73919V7.22133C10.0745 7.0775 9.95796 6.96094 9.81413 6.96094Z",
7292
+ fill: "currentColor"
7293
+ }),
7294
+ /* @__PURE__ */ jsx("path", {
7295
+ d: "M8.55132 6.96094H8.01481C7.87098 6.96094 7.75439 7.07753 7.75439 7.22135V7.74057V8.09581V8.73917C7.75439 8.88297 7.87098 8.99958 8.01481 8.99958C8.15864 8.99958 8.27523 8.88297 8.27523 8.73917V8.35622H8.55135C8.91463 8.35622 9.2102 8.06063 9.2102 7.69737V7.61979C9.21018 7.25648 8.91463 6.96094 8.55132 6.96094ZM8.68937 7.69734C8.68937 7.77346 8.62744 7.83539 8.55132 7.83539H8.2752V7.74055V7.48172H8.55132C8.62744 7.48172 8.68937 7.54365 8.68937 7.61977V7.69734Z",
7296
+ fill: "currentColor"
7297
+ }),
7298
+ /* @__PURE__ */ jsx("path", {
7299
+ d: "M7.47523 8.67635L6.80685 7.1187C6.76581 7.02297 6.67169 6.96094 6.56755 6.96094C6.46341 6.96094 6.3693 7.02297 6.32823 7.11867L5.65984 8.67633C5.60312 8.80849 5.6643 8.96161 5.79648 9.01831C5.92867 9.075 6.08177 9.01385 6.13849 8.88169L6.56755 7.88172L6.99664 8.88169C7.03898 8.98039 7.13508 9.0395 7.23607 9.0395C7.27031 9.0395 7.30515 9.03268 7.33862 9.01833C7.47078 8.96164 7.53195 8.80852 7.47523 8.67635Z",
7300
+ fill: "currentColor"
7301
+ }),
7302
+ /* @__PURE__ */ jsx("path", {
7303
+ d: "M13.7813 1.33203C13.2931 1.33203 12.896 1.72919 12.896 2.21742C12.896 2.3668 12.9333 2.50755 12.9989 2.63107L12.0025 3.62737C11.9008 3.72906 11.9008 3.89396 12.0025 3.99565C12.0534 4.04648 12.1201 4.0719 12.1867 4.0719C12.2533 4.0719 12.32 4.04648 12.3708 3.99562L13.367 2.99951C13.4907 3.06531 13.6317 3.10279 13.7813 3.10279C14.2695 3.10279 14.6667 2.70562 14.6667 2.2174C14.6667 1.72917 14.2696 1.33203 13.7813 1.33203Z",
7304
+ fill: "currentColor"
7305
+ }),
7306
+ /* @__PURE__ */ jsx("path", {
7307
+ d: "M3.99712 12.002C3.89542 11.9004 3.73053 11.9004 3.62886 12.002L2.6329 12.998C2.50925 12.9323 2.36837 12.8949 2.21889 12.8949C1.73066 12.8949 1.3335 13.2921 1.3335 13.7803C1.3335 14.2685 1.73066 14.6657 2.21889 14.6657C2.70712 14.6657 3.10428 14.2685 3.10428 13.7803C3.10428 13.6308 3.06688 13.4899 3.00118 13.3663L3.99714 12.3703C4.09881 12.2686 4.09881 12.1037 3.99712 12.002Z",
7308
+ fill: "currentColor"
7309
+ }),
7310
+ /* @__PURE__ */ jsx("path", {
7311
+ d: "M12.3711 12.0021C12.3224 11.9536 12.2552 11.9258 12.1867 11.9258C12.1182 11.9258 12.051 11.9536 12.0026 12.0021C11.9541 12.0505 11.9263 12.1177 11.9263 12.1862C11.9263 12.2547 11.9541 12.3219 12.0026 12.3703C12.051 12.4187 12.1182 12.4466 12.1867 12.4466C12.2554 12.4466 12.3224 12.4187 12.3711 12.3703C12.4195 12.3219 12.4471 12.2549 12.4471 12.1862C12.4471 12.1177 12.4195 12.0505 12.3711 12.0021Z",
7312
+ fill: "currentColor"
7313
+ }),
7314
+ /* @__PURE__ */ jsx("path", {
7315
+ d: "M13.7813 12.8934C13.6316 12.8934 13.4906 12.9308 13.3669 12.9967L12.927 12.5567C12.8253 12.4551 12.6604 12.455 12.5587 12.5567C12.457 12.6584 12.457 12.8233 12.5587 12.925L12.9988 13.3651C12.9332 13.4887 12.8959 13.6294 12.8959 13.7788C12.8959 14.267 13.2931 14.6642 13.7813 14.6642C14.2695 14.6642 14.6666 14.267 14.6666 13.7788C14.6666 13.2905 14.2695 12.8934 13.7813 12.8934Z",
7316
+ fill: "currentColor"
7317
+ }),
7318
+ /* @__PURE__ */ jsx("path", {
7319
+ d: "M3.99712 3.62737L3.00118 2.63143C3.06688 2.50779 3.10428 2.3669 3.10428 2.21742C3.10428 1.72922 2.70712 1.33203 2.21889 1.33203C1.73066 1.33203 1.3335 1.72919 1.3335 2.21742C1.3335 2.70565 1.73066 3.10281 2.21889 3.10281C2.36839 3.10281 2.50928 3.06542 2.6329 2.99971L3.62886 3.99565C3.67972 4.04651 3.74636 4.07193 3.813 4.07193C3.87964 4.07193 3.94631 4.04651 3.99714 3.99565C4.09881 3.89396 4.09881 3.72906 3.99712 3.62737Z",
7320
+ fill: "currentColor"
7321
+ })
7322
+ ]
7323
+ }), /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", {
7324
+ id: "restapi-clip",
7325
+ children: /* @__PURE__ */ jsx("rect", {
7326
+ width: "13.3333",
7327
+ height: "13.3333",
7328
+ fill: "white",
7329
+ transform: "translate(1.3335 1.33203)"
7330
+ })
7331
+ }) })]
7332
+ });
7333
+ //#endregion
7334
+ //#region src/view/components/EditModeSidebar/index.tsx
7335
+ const EditModeSidebar = ({ selectedItem, onSelectItem, endpoints, hasGeneralError, hasSaveErrors }) => {
7336
+ const { wrapSSR, cx, token } = useStyle("EditModeSidebar", (token, scope) => ({
7337
+ [scope("root")]: {
7338
+ display: "flex",
7339
+ flexDirection: "column",
7340
+ gap: token.marginXS,
7341
+ padding: token.padding,
7342
+ backgroundColor: token.colorBgContainer,
7343
+ borderRadius: token.borderRadius,
7344
+ width: 320,
7345
+ minWidth: 320,
7346
+ flexShrink: 0,
7347
+ overflowY: "auto"
7348
+ },
7349
+ [scope("spec-icon")]: {
7350
+ fontSize: 16,
7351
+ color: token.colorTextSecondary,
7352
+ flexShrink: 0,
7353
+ display: "flex",
7354
+ alignItems: "center"
7355
+ },
7356
+ [scope("spec-label")]: {
7357
+ fontSize: token.fontSize,
7358
+ fontWeight: 400,
7359
+ color: token.colorText,
7360
+ lineHeight: "22px"
7361
+ },
7362
+ [scope("badge")]: {
7363
+ minWidth: "3.75rem",
7364
+ textAlign: "center",
7365
+ border: "none"
7366
+ },
7367
+ [scope("path")]: {
7368
+ fontSize: token.fontSize,
7369
+ fontWeight: 400,
7370
+ lineHeight: "22px",
7371
+ whiteSpace: "nowrap",
7372
+ overflow: "hidden",
7373
+ textOverflow: "ellipsis",
7374
+ flex: 1
7375
+ },
7376
+ [`${scope("root")} .ant-menu`]: {
7377
+ background: "transparent",
7378
+ border: "none",
7379
+ paddingInline: 0
7380
+ },
7381
+ [`${scope("root")} .ant-menu-item`]: {
7382
+ padding: `${token.paddingXS}px ${token.paddingLG}px`,
7383
+ borderRadius: token.borderRadius,
7384
+ height: "auto",
7385
+ lineHeight: "22px",
7386
+ display: "flex",
7387
+ alignItems: "center",
7388
+ gap: 12,
7389
+ marginInline: 0,
7390
+ marginBlock: 0,
7391
+ width: "100%",
7392
+ transition: "background-color 0.15s"
7393
+ },
7394
+ [`${scope("root")} .ant-menu-item:not(.ant-menu-item-selected):hover`]: { backgroundColor: token.colorFillTertiary },
7395
+ [`${scope("root")} .ant-menu-item-selected`]: { backgroundColor: token.colorPrimaryBg },
7396
+ [`${scope("root")} .ant-menu-item.error-active.ant-menu-item-selected`]: { backgroundColor: token.colorErrorBg },
7397
+ [`${scope("root")} .ant-menu-item-group-title`]: {
7398
+ fontSize: token.fontSize,
7399
+ fontWeight: 400,
7400
+ color: token.colorTextTertiary,
7401
+ lineHeight: "22px",
7402
+ paddingInline: 0,
7403
+ paddingTop: 0,
7404
+ paddingBottom: token.marginXXS,
7405
+ userSelect: "none"
7406
+ },
7407
+ [`${scope("root")} .ant-menu-item-group + .ant-menu-item-group`]: { marginTop: token.marginXS },
7408
+ [`${scope("spec-item")}:not(:last-child)`]: { marginBottom: token.marginXS },
7409
+ [`${scope("root")} .ant-menu-title-content`]: {
7410
+ overflow: "hidden",
7411
+ display: "flex",
7412
+ flex: 1,
7413
+ alignItems: "center",
7414
+ minWidth: 0,
7415
+ gap: 12
7416
+ },
7417
+ [`${scope("root")} .ant-menu-item-selected ${scope("spec-label")}`]: { color: token.colorPrimary }
7418
+ }));
7419
+ const selectedKeys = selectedItem.type === "endpoint" ? [selectedItem.key] : [selectedItem.type];
7420
+ const items = [{
7421
+ type: "group",
7422
+ label: "Specifications",
7423
+ children: [
7424
+ hasSaveErrors && {
7425
+ key: "errors",
7426
+ className: `${cx("spec-item")} error-active`,
7427
+ icon: /* @__PURE__ */ jsx("span", {
7428
+ className: cx("spec-icon"),
7429
+ style: { color: token.colorError },
7430
+ children: /* @__PURE__ */ jsx(ExclamationCircleOutlined, {})
7431
+ }),
7432
+ label: /* @__PURE__ */ jsx("span", {
7433
+ className: cx("spec-label"),
7434
+ style: { color: token.colorError },
7435
+ children: "Errors"
7436
+ })
7437
+ },
7438
+ {
7439
+ key: "general",
7440
+ className: cx("spec-item"),
7441
+ icon: /* @__PURE__ */ jsx("span", {
7442
+ className: cx("spec-icon"),
7443
+ style: hasGeneralError ? { color: token.colorError } : void 0,
7444
+ children: /* @__PURE__ */ jsx(RestApiIcon, {})
7445
+ }),
7446
+ label: /* @__PURE__ */ jsx("span", {
7447
+ className: cx("spec-label"),
7448
+ style: hasGeneralError ? { color: token.colorError } : void 0,
7449
+ children: "General"
7450
+ })
7451
+ },
7452
+ {
7453
+ key: "tags",
7454
+ className: cx("spec-item"),
7455
+ icon: /* @__PURE__ */ jsx("span", {
7456
+ className: cx("spec-icon"),
7457
+ children: /* @__PURE__ */ jsx(TagOutlined, {})
7458
+ }),
7459
+ label: /* @__PURE__ */ jsx("span", {
7460
+ className: cx("spec-label"),
7461
+ children: "Tags"
7462
+ })
7463
+ }
7464
+ ].filter(Boolean)
7465
+ }, {
7466
+ type: "group",
7467
+ label: "Endpoints",
7468
+ children: endpoints.map((ep) => {
7469
+ const colors = methodColors$1[ep.method];
7470
+ return {
7471
+ key: ep.id,
7472
+ label: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Tag, {
7473
+ className: cx("badge"),
7474
+ style: {
7475
+ backgroundColor: colors?.bg,
7476
+ color: colors?.color,
7477
+ border: "none"
7478
+ },
7479
+ children: ep.method
7480
+ }), /* @__PURE__ */ jsx("span", {
7481
+ className: cx("path"),
7482
+ style: { color: selectedItem.type === "endpoint" && selectedItem.key === ep.id ? token.colorPrimary : token.colorText },
7483
+ children: ep.path
7484
+ })] })
7485
+ };
7486
+ })
7487
+ }];
7488
+ const handleMenuClick = ({ key }) => {
7489
+ if (key === "errors") onSelectItem({ type: "errors" });
7490
+ else if (key === "general") onSelectItem({ type: "general" });
7491
+ else if (key === "tags") onSelectItem({ type: "tags" });
7492
+ else onSelectItem({
7493
+ type: "endpoint",
7494
+ key
7495
+ });
7496
+ };
7497
+ return wrapSSR(/* @__PURE__ */ jsx("div", {
7498
+ className: cx("root"),
7499
+ children: /* @__PURE__ */ jsx(Menu, {
7500
+ mode: "inline",
7501
+ selectedKeys,
7502
+ items,
7503
+ onClick: handleMenuClick,
7504
+ style: {
7505
+ background: "transparent",
7506
+ border: "none"
7507
+ }
7508
+ })
7509
+ }));
7510
+ };
5886
7511
  token.colorPrimary, token.colorSuccess, token.colorError, token.colorWarning, token["volcano.5"], token["geekblue.6"], token["purple.5"], token["volcano.4"];
5887
7512
  const darkerMethodColors = {
5888
7513
  GET: {
@@ -6053,9 +7678,10 @@ const filterTreeData = (data, searchText) => {
6053
7678
  const getSidebarStyles = (token, scope) => ({
6054
7679
  [scope("sider")]: {
6055
7680
  backgroundColor: token.colorBgElevated,
7681
+ overflowY: "auto",
6056
7682
  overflowX: "clip",
6057
7683
  borderRadius: token.borderRadius,
6058
- height: "auto"
7684
+ height: "100%"
6059
7685
  },
6060
7686
  [scope("content")]: { padding: token.padding },
6061
7687
  [scope("controls")]: {
@@ -6323,10 +7949,7 @@ const Sidebar = ({ searchValue, setSearchValue, onNodeSelect }) => {
6323
7949
  });
6324
7950
  if (isMobile) return wrapSSR(/* @__PURE__ */ jsx("aside", {
6325
7951
  className: cx("sider"),
6326
- style: {
6327
- width: "100%",
6328
- height: "100%"
6329
- },
7952
+ style: { height: "100%" },
6330
7953
  children: inner
6331
7954
  }));
6332
7955
  return wrapSSR(/* @__PURE__ */ jsx(Resizable, {
@@ -6354,6 +7977,47 @@ const Sidebar = ({ searchValue, setSearchValue, onNodeSelect }) => {
6354
7977
  //#endregion
6355
7978
  //#region src/view/console/EndpointPage/EndpointPage.tsx
6356
7979
  const { Title: Title$1, Paragraph } = Typography;
7980
+ const MAX_VISIBLE_ENUMS = 2;
7981
+ const renderEnumTags = (enums, token) => {
7982
+ const tagStyle = {
7983
+ background: token.colorFillAlter,
7984
+ border: `1px solid ${token.colorBorder}`,
7985
+ borderRadius: token.borderRadiusSM
7986
+ };
7987
+ if (enums.length <= MAX_VISIBLE_ENUMS) return /* @__PURE__ */ jsx("span", {
7988
+ style: {
7989
+ display: "flex",
7990
+ flexWrap: "wrap",
7991
+ gap: token.marginXXS
7992
+ },
7993
+ children: enums.map((e) => /* @__PURE__ */ jsx(Tag, {
7994
+ style: tagStyle,
7995
+ children: e
7996
+ }, e))
7997
+ });
7998
+ const visible = enums.slice(0, MAX_VISIBLE_ENUMS);
7999
+ const hidden = enums.slice(MAX_VISIBLE_ENUMS);
8000
+ return /* @__PURE__ */ jsxs("span", {
8001
+ style: {
8002
+ display: "flex",
8003
+ flexWrap: "wrap",
8004
+ gap: token.marginXXS
8005
+ },
8006
+ children: [visible.map((e) => /* @__PURE__ */ jsx(Tag, {
8007
+ style: tagStyle,
8008
+ children: e
8009
+ }, e)), /* @__PURE__ */ jsx(Tooltip, {
8010
+ title: hidden.join(", "),
8011
+ children: /* @__PURE__ */ jsxs(Tag, {
8012
+ style: {
8013
+ ...tagStyle,
8014
+ cursor: "pointer"
8015
+ },
8016
+ children: ["+", hidden.length]
8017
+ })
8018
+ })]
8019
+ });
8020
+ };
6357
8021
  const requestColumns = [
6358
8022
  {
6359
8023
  title: "Parameter",
@@ -6396,7 +8060,7 @@ const buildRequestData = (params, token) => [...params].sort((a, b) => a.require
6396
8060
  })
6397
8061
  ] }),
6398
8062
  desc: p.description || "--",
6399
- enum: p.schema?.enum ? p.schema.enum.map((e) => /* @__PURE__ */ jsx(Tag, { children: e }, e)) : "--"
8063
+ enum: p.schema?.enum ? renderEnumTags(p.schema.enum, token) : "--"
6400
8064
  };
6401
8065
  });
6402
8066
  const buildHeaderData = (headers, token) => {
@@ -6425,7 +8089,7 @@ const buildHeaderData = (headers, token) => {
6425
8089
  })
6426
8090
  ] }, idx),
6427
8091
  desc: header.description || "--",
6428
- enum: header.schema?.enum ? header.schema.enum.map((e) => /* @__PURE__ */ jsx(Tag, { children: e }, e)) : "--"
8092
+ enum: header.schema?.enum ? renderEnumTags(header.schema.enum, token) : "--"
6429
8093
  };
6430
8094
  });
6431
8095
  };
@@ -6457,7 +8121,7 @@ const buildRequestBodyData = (requestBody, token) => {
6457
8121
  })
6458
8122
  ] }),
6459
8123
  desc: prop.description || "--",
6460
- enum: prop.enum ? prop.enum.map((e) => /* @__PURE__ */ jsx(Tag, { children: e }, e)) : "--"
8124
+ enum: prop.enum ? renderEnumTags(prop.enum, token) : "--"
6461
8125
  }));
6462
8126
  };
6463
8127
  const EndpointPage = () => {
@@ -6468,13 +8132,9 @@ const EndpointPage = () => {
6468
8132
  [scope("docs-endpoint-container")]: {
6469
8133
  display: "flex",
6470
8134
  flexDirection: "column",
6471
- gap: token.marginLG,
6472
- height: "100%"
6473
- },
6474
- [scope("content")]: {
6475
- width: "100%",
6476
- height: "100%"
8135
+ gap: token.marginLG
6477
8136
  },
8137
+ [scope("content")]: { width: "100%" },
6478
8138
  [scope("code")]: {
6479
8139
  background: "unset",
6480
8140
  borderRadius: token.borderRadius,
@@ -6503,8 +8163,7 @@ const EndpointPage = () => {
6503
8163
  ".ant-tabs-tab": { paddingTop: "0" }
6504
8164
  },
6505
8165
  "& .ant-table": { backgroundColor: `${token.colorBgBase} !important` },
6506
- "& .ant-table-thead > tr > th": { backgroundColor: `${token.colorBgBase} !important` },
6507
- "& .ant-table-tbody > tr > td": { backgroundColor: `${token.colorBgBase} !important` }
8166
+ "& .ant-table-thead > tr > th": { backgroundColor: `${token.colorBgBase} !important` }
6508
8167
  },
6509
8168
  [scope("row-odd")]: { "& > td": { background: `${token.colorBgElevated} !important` } },
6510
8169
  [scope("row-even")]: { "& > td": { background: `${token.colorBgLayout} !important` } }
@@ -6716,12 +8375,9 @@ const MainContent = ({ searchEnabled, handleResetSearch, handleVisitLandingPage
6716
8375
  const { focusedContent, transformedData } = useStore(({ view }) => view);
6717
8376
  const { wrapSSR, cx, token } = useStyle("MainContent", (token, scope) => ({
6718
8377
  [scope("inner-doc-container")]: {
6719
- width: "100%",
6720
- height: "auto",
8378
+ minWidth: 0,
6721
8379
  borderRadius: token.borderRadius,
6722
- padding: token.paddingXL,
6723
- overflow: "hidden",
6724
- minWidth: 0
8380
+ padding: token.paddingXL
6725
8381
  },
6726
8382
  [scope("centered")]: {
6727
8383
  display: "flex",
@@ -6825,13 +8481,7 @@ const Codebox$1 = ({ code, language, wrapLongLines }) => {
6825
8481
  const [appTheme] = useState("DARK");
6826
8482
  const { token, theme: themeConfig } = theme.useToken();
6827
8483
  const bodyBg = themeConfig.id == 1 ? token.colorBgContainer : "#1d2856";
6828
- const { cx } = useStyle("codeBox", (token, scope) => ({ [scope("codebox")]: {
6829
- borderRadius: token.borderRadius,
6830
- height: "100%",
6831
- maxHeight: "100%",
6832
- overflow: "auto",
6833
- pre: { height: "100%" }
6834
- } }));
8484
+ const { cx } = useStyle("codeBox", (token, scope) => ({ [scope("codebox")]: { borderRadius: token.borderRadius } }));
6835
8485
  return /* @__PURE__ */ jsx("div", {
6836
8486
  className: cx("codebox"),
6837
8487
  children: /* @__PURE__ */ jsx(Light, {
@@ -6843,7 +8493,6 @@ const Codebox$1 = ({ code, language, wrapLongLines }) => {
6843
8493
  customStyle: {
6844
8494
  margin: 0,
6845
8495
  minHeight: "3rem",
6846
- overflowY: "auto",
6847
8496
  padding: "0.75rem 1rem 0.75rem 1.5rem",
6848
8497
  backgroundColor: bodyBg,
6849
8498
  fontSize: "0.75rem"
@@ -7111,6 +8760,18 @@ const transformOpenApiToDocs = (api) => {
7111
8760
  content: resolvedContent
7112
8761
  };
7113
8762
  }
8763
+ if (entry.responses) {
8764
+ const resolvedResponses = {};
8765
+ for (const [code, responseValue] of Object.entries(entry.responses)) if (responseValue.content) {
8766
+ const resolvedContent = {};
8767
+ for (const [contentType, contentValue] of Object.entries(responseValue.content)) resolvedContent[contentType] = { schema: resolveSchema(contentValue.schema, api.components) ?? contentValue.schema };
8768
+ resolvedResponses[code] = {
8769
+ ...responseValue,
8770
+ content: resolvedContent
8771
+ };
8772
+ } else resolvedResponses[code] = responseValue;
8773
+ entry.responses = resolvedResponses;
8774
+ }
7114
8775
  const matchedTags = (methodData.tags ?? []).filter((tag) => validTags.has(tag));
7115
8776
  if (matchedTags.length > 0) matchedTags.forEach((tag) => {
7116
8777
  if (!groupedPathsByTags[tag]) groupedPathsByTags[tag] = [];
@@ -7153,14 +8814,23 @@ const transformOpenApiToDocs = (api) => {
7153
8814
  const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPage, onSave }) => {
7154
8815
  const [searchValue, setSearchValue] = useState("");
7155
8816
  const [mode, setMode] = useState("edit");
7156
- const [hasChanges, setHasChanges] = useState(false);
7157
8817
  const [bannerVisible, setBannerVisible] = useState(false);
7158
8818
  const [resetKey, setResetKey] = useState(0);
7159
- const [generalCollapsed, setGeneralCollapsed] = useState(false);
7160
- const [tagsCollapsed, setTagsCollapsed] = useState(false);
8819
+ const [generalCollapsed, setGeneralCollapsed] = useState(true);
8820
+ const [tagsCollapsed, setTagsCollapsed] = useState(true);
7161
8821
  const [endpointsCollapsed, setEndpointsCollapsed] = useState(false);
8822
+ const [saveConfirmModal, setSaveConfirmModal] = useState(false);
8823
+ const [resetConfirmModal, setResetConfirmModal] = useState(false);
8824
+ const [selectedEditItem, setSelectedEditItem] = useState({ type: "general" });
8825
+ const [errorBoxExpanded, setErrorBoxExpanded] = useState(false);
7162
8826
  const [localApiName, setLocalApiName] = useState("");
8827
+ const [apiNameTouched, setApiNameTouched] = useState(false);
7163
8828
  const [localDescription, setLocalDescription] = useState("");
8829
+ const [descriptionTouched, setDescriptionTouched] = useState(false);
8830
+ const hasApiNameError = apiNameTouched && (!localApiName.trim() || !/^[A-Za-z0-9_-]+$/.test(localApiName.trim()));
8831
+ const hasDescriptionError = descriptionTouched && !localDescription.trim();
8832
+ const hasGeneralError = hasApiNameError || hasDescriptionError;
8833
+ const [saveErrors, setSaveErrors] = useState([]);
7164
8834
  const [selectedUrl, setSelectedUrl] = useState("");
7165
8835
  const [endpointNames, setEndpointNames] = useState({});
7166
8836
  const [endpointDescs, setEndpointDescs] = useState({});
@@ -7182,6 +8852,7 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7182
8852
  const hasInitializedRef = useRef(false);
7183
8853
  const { useBreakpoint } = Grid;
7184
8854
  const isMobile = !useBreakpoint().md;
8855
+ const allEndpoints = useMemo(() => selectedApi ? Object.values(selectedApi.tags ?? {}).flat() : [], [selectedApi]);
7185
8856
  useEffect(() => {
7186
8857
  return () => {
7187
8858
  resetStore();
@@ -7228,8 +8899,7 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7228
8899
  display: "flex",
7229
8900
  flexDirection: "column",
7230
8901
  gap: token.marginLG,
7231
- height: "100%",
7232
- overflowY: "auto"
8902
+ height: "100%"
7233
8903
  },
7234
8904
  [scope("section")]: {
7235
8905
  flexShrink: 0,
@@ -7237,11 +8907,19 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7237
8907
  },
7238
8908
  [scope("docs-layout")]: {
7239
8909
  display: "flex",
7240
- flexShrink: 0,
7241
- height: "auto",
8910
+ flex: 1,
8911
+ minHeight: 0,
7242
8912
  gap: token.marginLG,
7243
8913
  width: "100%"
7244
8914
  },
8915
+ [scope("content-scroll-area")]: {
8916
+ display: "grid",
8917
+ gridTemplateColumns: "minmax(0, 1fr) auto",
8918
+ flex: 1,
8919
+ gap: token.marginLG,
8920
+ overflow: "auto",
8921
+ minWidth: 0
8922
+ },
7245
8923
  [".delete-tag-confirm-modal .ant-modal-container"]: {
7246
8924
  "--ant-modal-content-padding": "0px !important",
7247
8925
  padding: "0 !important"
@@ -7320,15 +8998,18 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7320
8998
  }, [selectedApi]);
7321
8999
  const tagMetadata = useMemo(() => {
7322
9000
  if (!originalData || !selectedApi) return [];
7323
- const rawFile = originalData.find((f) => Object.keys(f.paths)[0] === selectedApi.contextPath);
7324
- if (!rawFile?.tags) return [];
7325
- return rawFile.tags.map((t) => ({
9001
+ const mapped = originalData.find((f) => Object.keys(f.paths)[0] === selectedApi.contextPath)?.tags?.map((t) => ({
7326
9002
  name: t.name,
7327
9003
  description: t.description,
7328
9004
  externalDocsUrl: t.externalDocs?.url,
7329
9005
  externalDocsDescription: t.externalDocs?.description,
7330
9006
  isDefault: t.name.toLowerCase() === "default"
7331
- }));
9007
+ })) ?? [];
9008
+ if (!mapped.some((t) => t.isDefault) && selectedApi.tags["default"]) mapped.push({
9009
+ name: "default",
9010
+ isDefault: true
9011
+ });
9012
+ return mapped;
7332
9013
  }, [originalData, selectedApi]);
7333
9014
  const initialEndpointResponseParams = useMemo(() => {
7334
9015
  if (!originalData || !selectedApi) return {};
@@ -7395,6 +9076,44 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7395
9076
  setEndpointParams(initialEndpointParams);
7396
9077
  setEndpointResponseParams(initialEndpointResponseParams);
7397
9078
  }, [selectedApi]);
9079
+ const hasChanges = useMemo(() => {
9080
+ if (!selectedApi) return false;
9081
+ if (localApiName !== (selectedApi.title || "")) return true;
9082
+ if (localDescription !== (selectedApi.description || "")) return true;
9083
+ if (JSON.stringify(localTags) !== JSON.stringify(tagMetadata)) return true;
9084
+ for (const [id, name] of Object.entries(endpointNames)) {
9085
+ const ep = allEndpoints.find((e) => e.id === id);
9086
+ if (ep && name !== (ep.summary ?? "")) return true;
9087
+ }
9088
+ for (const [id, desc] of Object.entries(endpointDescs)) {
9089
+ const ep = allEndpoints.find((e) => e.id === id);
9090
+ if (ep && desc !== (ep.description ?? "")) return true;
9091
+ }
9092
+ for (const [id, tags] of Object.entries(endpointTags)) {
9093
+ const ep = allEndpoints.find((e) => e.id === id);
9094
+ if (ep && JSON.stringify(tags) !== JSON.stringify(ep.tags ?? [])) return true;
9095
+ }
9096
+ if (JSON.stringify(endpointParams) !== JSON.stringify(initialEndpointParams)) return true;
9097
+ if (JSON.stringify(endpointResponseParams) !== JSON.stringify(initialEndpointResponseParams)) return true;
9098
+ return false;
9099
+ }, [
9100
+ selectedApi,
9101
+ localApiName,
9102
+ localDescription,
9103
+ localTags,
9104
+ tagMetadata,
9105
+ allEndpoints,
9106
+ endpointNames,
9107
+ endpointDescs,
9108
+ endpointTags,
9109
+ endpointParams,
9110
+ endpointResponseParams,
9111
+ initialEndpointParams,
9112
+ initialEndpointResponseParams
9113
+ ]);
9114
+ useEffect(() => {
9115
+ setBannerVisible(hasChanges);
9116
+ }, [hasChanges]);
7398
9117
  useEffect(() => {
7399
9118
  if (mode !== "view" || !selectedEndpoint) return;
7400
9119
  const epId = selectedEndpoint.id;
@@ -7445,7 +9164,6 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7445
9164
  isDefault: false
7446
9165
  };
7447
9166
  setLocalTags((prev) => [...prev, newTag]);
7448
- setHasChanges(true);
7449
9167
  setBannerVisible(true);
7450
9168
  };
7451
9169
  const handleUpdateTag = (updatedTag) => {
@@ -7457,7 +9175,6 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7457
9175
  externalDocsUrl: updatedTag.externalDocsLink,
7458
9176
  externalDocsDescription: updatedTag.externalDocsDescription
7459
9177
  } : t));
7460
- setHasChanges(true);
7461
9178
  setBannerVisible(true);
7462
9179
  };
7463
9180
  const handleDeleteTagConfirm = () => {
@@ -7467,7 +9184,6 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7467
9184
  open: false,
7468
9185
  tagName: ""
7469
9186
  });
7470
- setHasChanges(true);
7471
9187
  setBannerVisible(true);
7472
9188
  };
7473
9189
  const getEndpointsByTag = () => {
@@ -7487,8 +9203,10 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7487
9203
  return filtered;
7488
9204
  };
7489
9205
  const handleReset = () => {
7490
- setHasChanges(false);
7491
9206
  setBannerVisible(false);
9207
+ setApiNameTouched(false);
9208
+ setDescriptionTouched(false);
9209
+ setSaveErrors([]);
7492
9210
  setLocalApiName(selectedApi?.title ?? "");
7493
9211
  setLocalDescription(selectedApi?.description ?? "");
7494
9212
  setEndpointNames({});
@@ -7497,6 +9215,7 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7497
9215
  setEndpointParams(initialEndpointParams);
7498
9216
  setEndpointResponseParams(initialEndpointResponseParams);
7499
9217
  setResetKey((prev) => prev + 1);
9218
+ messageApi.success("Changes have been reset successfully.");
7500
9219
  };
7501
9220
  const handleSave = async () => {
7502
9221
  if (!selectedApi || !originalData) return;
@@ -7570,9 +9289,21 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7570
9289
  else delete methodObj["x-response-params"];
7571
9290
  }
7572
9291
  });
7573
- await onSave?.(cloned);
7574
- setHasChanges(false);
7575
- setBannerVisible(false);
9292
+ try {
9293
+ await onSave?.(cloned);
9294
+ setBannerVisible(false);
9295
+ setSaveErrors([]);
9296
+ messageApi.success("Changes have been saved and published successfully.");
9297
+ } catch (err) {
9298
+ let messages = [];
9299
+ if (err && typeof err === "object" && "errors" in err) {
9300
+ const e = err;
9301
+ messages = Array.isArray(e.errors) ? e.errors : [e.errors];
9302
+ } else if (err instanceof Error) messages = err.message.split("\n").filter(Boolean);
9303
+ else messages = [String(err)];
9304
+ setSaveErrors(messages);
9305
+ setSelectedEditItem({ type: "errors" });
9306
+ }
7576
9307
  };
7577
9308
  const handleResetSearch = () => {
7578
9309
  setSearchValue("");
@@ -7584,6 +9315,102 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7584
9315
  }
7585
9316
  window.location.pathname = "/";
7586
9317
  };
9318
+ useEffect(() => {
9319
+ setErrorBoxExpanded(false);
9320
+ }, [selectedEditItem]);
9321
+ const errorBox = saveErrors.length > 0 ? /* @__PURE__ */ jsxs("div", {
9322
+ style: {
9323
+ background: token.colorErrorBg,
9324
+ borderRadius: token.borderRadiusLG,
9325
+ padding: `${token.marginLG}px ${token.marginLG}px 48px`,
9326
+ width: "100%"
9327
+ },
9328
+ children: [
9329
+ /* @__PURE__ */ jsxs("div", {
9330
+ style: {
9331
+ display: "flex",
9332
+ alignItems: "center",
9333
+ gap: token.marginXS
9334
+ },
9335
+ children: [selectedEditItem.type !== "errors" && /* @__PURE__ */ jsx("button", {
9336
+ onClick: () => setErrorBoxExpanded((prev) => !prev),
9337
+ style: {
9338
+ display: "flex",
9339
+ alignItems: "center",
9340
+ background: "transparent",
9341
+ border: "none",
9342
+ cursor: "pointer",
9343
+ padding: 0,
9344
+ lineHeight: 1
9345
+ },
9346
+ "aria-label": "Collapse",
9347
+ children: /* @__PURE__ */ jsx(RightOutlined, { style: {
9348
+ fontSize: 14,
9349
+ color: token.colorError,
9350
+ transform: errorBoxExpanded ? "rotate(90deg)" : "none",
9351
+ transition: "transform 0.2s"
9352
+ } })
9353
+ }), /* @__PURE__ */ jsx(Title, {
9354
+ level: 3,
9355
+ style: {
9356
+ margin: 0,
9357
+ color: token.colorError
9358
+ },
9359
+ children: "Errors"
9360
+ })]
9361
+ }),
9362
+ /* @__PURE__ */ jsx("p", {
9363
+ style: {
9364
+ color: token.colorError,
9365
+ fontSize: 16,
9366
+ lineHeight: "24px",
9367
+ marginTop: token.marginXS,
9368
+ marginBottom: token.marginSM
9369
+ },
9370
+ children: "Failed to update the OpenAPI documentation. Please resolve the following issues:"
9371
+ }),
9372
+ /* @__PURE__ */ jsx(Divider, { style: { margin: `${token.marginSM}px 0` } }),
9373
+ /* @__PURE__ */ jsx("ol", {
9374
+ style: {
9375
+ paddingLeft: token.marginLG,
9376
+ margin: 0
9377
+ },
9378
+ children: saveErrors.map((msg, i) => /* @__PURE__ */ jsx("li", {
9379
+ style: {
9380
+ color: token.colorText,
9381
+ marginBottom: token.marginXS
9382
+ },
9383
+ children: msg
9384
+ }, i))
9385
+ })
9386
+ ]
9387
+ }) : null;
9388
+ const errorBoxCollapsed = saveErrors.length > 0 ? /* @__PURE__ */ jsxs("button", {
9389
+ onClick: () => setErrorBoxExpanded(true),
9390
+ style: {
9391
+ display: "flex",
9392
+ alignItems: "center",
9393
+ gap: token.marginXS,
9394
+ padding: `${token.paddingXS}px ${token.paddingLG}px`,
9395
+ background: token.colorErrorBg,
9396
+ borderRadius: token.borderRadiusLG,
9397
+ border: "none",
9398
+ cursor: "pointer",
9399
+ width: "100%",
9400
+ textAlign: "left"
9401
+ },
9402
+ children: [/* @__PURE__ */ jsx(RightOutlined, { style: {
9403
+ fontSize: 14,
9404
+ color: token.colorError
9405
+ } }), /* @__PURE__ */ jsx("span", {
9406
+ style: {
9407
+ color: token.colorError,
9408
+ fontSize: token.fontSizeLG,
9409
+ fontWeight: 600
9410
+ },
9411
+ children: "Errors"
9412
+ })]
9413
+ }) : null;
7587
9414
  const switcherNode = /* @__PURE__ */ jsxs("div", {
7588
9415
  style: {
7589
9416
  display: "flex",
@@ -7633,6 +9460,7 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7633
9460
  });
7634
9461
  return /* @__PURE__ */ jsxs("div", {
7635
9462
  className: cx("documentation-container"),
9463
+ style: { overflow: mode === "view" ? "hidden" : "auto" },
7636
9464
  children: [
7637
9465
  contextHolder,
7638
9466
  /* @__PURE__ */ jsx("div", {
@@ -7641,158 +9469,321 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7641
9469
  apiName: selectedApi?.title || "API",
7642
9470
  mode,
7643
9471
  onModeChange: setMode,
7644
- onReset: handleReset,
7645
- onSave: handleSave,
9472
+ onReset: () => setResetConfirmModal(true),
9473
+ onSave: () => setSaveConfirmModal(true),
7646
9474
  hasChanges,
9475
+ hasErrors: hasGeneralError,
7647
9476
  switcherNode: isMobile ? switcherNode : void 0
7648
9477
  })
7649
9478
  }),
7650
9479
  bannerVisible && /* @__PURE__ */ jsx(UnsavedChangesBanner, { onClose: () => setBannerVisible(false) }),
7651
- mode === "edit" ? /* @__PURE__ */ jsxs(Fragment, { children: [
7652
- /* @__PURE__ */ jsx("div", {
7653
- className: cx("section"),
7654
- children: /* @__PURE__ */ jsx(GeneralSection, {
7655
- apiName: localApiName,
7656
- authType: selectedApi?.authType || "",
7657
- version: selectedApi?.relatedVersions?.find((v) => v.apiId === selectedApi?.currentVersion)?.version || "",
7658
- description: localDescription,
7659
- onApiNameChange: setLocalApiName,
7660
- onDescriptionChange: setLocalDescription,
7661
- collapsed: generalCollapsed,
7662
- onToggleCollapse: () => setGeneralCollapsed((c) => !c),
7663
- onChangeDetected: () => {
7664
- setHasChanges(true);
7665
- setBannerVisible(true);
7666
- }
7667
- })
7668
- }),
7669
- /* @__PURE__ */ jsx("div", {
7670
- className: cx("section"),
7671
- children: /* @__PURE__ */ jsx(TagsSection, {
7672
- tags: localTags,
7673
- collapsed: tagsCollapsed,
7674
- onToggleCollapse: () => setTagsCollapsed((prev) => !prev),
7675
- onAddTag: () => setTagDrawerState({
7676
- open: true,
7677
- mode: "add"
9480
+ mode === "edit" ? /* @__PURE__ */ jsxs("div", {
9481
+ style: {
9482
+ display: "flex",
9483
+ gap: token.marginLG,
9484
+ flex: 1,
9485
+ minHeight: 0
9486
+ },
9487
+ children: [!isMobile && /* @__PURE__ */ jsx(EditModeSidebar, {
9488
+ selectedItem: selectedEditItem,
9489
+ onSelectItem: setSelectedEditItem,
9490
+ endpoints: allEndpoints,
9491
+ hasGeneralError,
9492
+ hasSaveErrors: saveErrors.length > 0
9493
+ }), /* @__PURE__ */ jsx("div", {
9494
+ style: {
9495
+ display: "flex",
9496
+ flexDirection: "column",
9497
+ gap: token.marginLG,
9498
+ flex: 1,
9499
+ overflow: "auto"
9500
+ },
9501
+ children: isMobile ? /* @__PURE__ */ jsxs(Fragment, { children: [
9502
+ errorBox && /* @__PURE__ */ jsx("div", {
9503
+ className: cx("section"),
9504
+ children: errorBox
7678
9505
  }),
7679
- onEditTag: (tag) => setTagDrawerState({
7680
- open: true,
7681
- mode: "edit",
7682
- initialValues: {
7683
- name: tag.name,
7684
- description: tag.description,
7685
- externalDocsDescription: tag.externalDocsDescription,
7686
- externalDocsLink: tag.externalDocsUrl
7687
- }
9506
+ /* @__PURE__ */ jsx("div", {
9507
+ className: cx("section"),
9508
+ children: /* @__PURE__ */ jsx(GeneralSection, {
9509
+ apiName: localApiName,
9510
+ authType: selectedApi?.authType || "",
9511
+ version: selectedApi?.relatedVersions?.find((v) => v.apiId === selectedApi?.currentVersion)?.version || "",
9512
+ description: localDescription,
9513
+ onApiNameChange: (val) => {
9514
+ setApiNameTouched(true);
9515
+ setLocalApiName(val);
9516
+ },
9517
+ apiNameError: hasApiNameError,
9518
+ onDescriptionChange: (val) => {
9519
+ setDescriptionTouched(true);
9520
+ setLocalDescription(val);
9521
+ },
9522
+ descriptionError: hasDescriptionError,
9523
+ collapsed: generalCollapsed,
9524
+ onToggleCollapse: () => setGeneralCollapsed((c) => !c),
9525
+ onChangeDetected: () => {
9526
+ setBannerVisible(true);
9527
+ }
9528
+ })
9529
+ }),
9530
+ /* @__PURE__ */ jsx("div", {
9531
+ className: cx("section"),
9532
+ children: /* @__PURE__ */ jsx(TagsSection, {
9533
+ tags: localTags,
9534
+ collapsed: tagsCollapsed,
9535
+ onToggleCollapse: () => setTagsCollapsed((prev) => !prev),
9536
+ onAddTag: () => setTagDrawerState({
9537
+ open: true,
9538
+ mode: "add"
9539
+ }),
9540
+ onEditTag: (tag) => setTagDrawerState({
9541
+ open: true,
9542
+ mode: "edit",
9543
+ initialValues: {
9544
+ name: tag.name,
9545
+ description: tag.description,
9546
+ externalDocsDescription: tag.externalDocsDescription,
9547
+ externalDocsLink: tag.externalDocsUrl
9548
+ }
9549
+ }),
9550
+ onDeleteTag: (tagName) => setDeleteTagModal({
9551
+ open: true,
9552
+ tagName
9553
+ })
9554
+ })
7688
9555
  }),
7689
- onDeleteTag: (tagName) => setDeleteTagModal({
7690
- open: true,
7691
- tagName
9556
+ /* @__PURE__ */ jsx("div", {
9557
+ className: cx("section"),
9558
+ children: /* @__PURE__ */ jsx(EndpointsSection, {
9559
+ mode,
9560
+ endpointsByTag: getEndpointsByTag(),
9561
+ collapsed: endpointsCollapsed,
9562
+ onToggleCollapse: () => setEndpointsCollapsed((c) => !c),
9563
+ endpointNames,
9564
+ endpointDescs,
9565
+ endpointTags,
9566
+ availableTags: localTags.map((t) => t.name),
9567
+ onEndpointNameChange: (id, val) => {
9568
+ setEndpointNames((prev) => ({
9569
+ ...prev,
9570
+ [id]: val
9571
+ }));
9572
+ setBannerVisible(true);
9573
+ },
9574
+ onEndpointDescChange: (id, val) => {
9575
+ setEndpointDescs((prev) => ({
9576
+ ...prev,
9577
+ [id]: val
9578
+ }));
9579
+ setBannerVisible(true);
9580
+ },
9581
+ onEndpointTagsChange: (id, val) => {
9582
+ setEndpointTags((prev) => ({
9583
+ ...prev,
9584
+ [id]: val
9585
+ }));
9586
+ setBannerVisible(true);
9587
+ },
9588
+ endpointParams,
9589
+ onAddParameter: (endpointId, param) => {
9590
+ setEndpointParams((prev) => ({
9591
+ ...prev,
9592
+ [endpointId]: [...prev[endpointId] ?? [], param]
9593
+ }));
9594
+ setBannerVisible(true);
9595
+ },
9596
+ onEditParameter: (endpointId, idx, param) => {
9597
+ setEndpointParams((prev) => ({
9598
+ ...prev,
9599
+ [endpointId]: prev[endpointId]?.map((p, i) => i === idx ? param : p) ?? []
9600
+ }));
9601
+ setBannerVisible(true);
9602
+ },
9603
+ onDeleteParameter: (endpointId, idx) => {
9604
+ setEndpointParams((prev) => ({
9605
+ ...prev,
9606
+ [endpointId]: prev[endpointId]?.filter((_, i) => i !== idx) ?? []
9607
+ }));
9608
+ setBannerVisible(true);
9609
+ },
9610
+ endpointResponseParams,
9611
+ onAddResponseParameter: (endpointId, param) => {
9612
+ setEndpointResponseParams((prev) => ({
9613
+ ...prev,
9614
+ [endpointId]: [...prev[endpointId] ?? [], param]
9615
+ }));
9616
+ setBannerVisible(true);
9617
+ },
9618
+ onEditResponseParameter: (endpointId, idx, param) => {
9619
+ setEndpointResponseParams((prev) => ({
9620
+ ...prev,
9621
+ [endpointId]: prev[endpointId]?.map((p, i) => i === idx ? param : p) ?? []
9622
+ }));
9623
+ setBannerVisible(true);
9624
+ },
9625
+ onDeleteResponseParameter: (endpointId, idx) => {
9626
+ setEndpointResponseParams((prev) => ({
9627
+ ...prev,
9628
+ [endpointId]: prev[endpointId]?.filter((_, i) => i !== idx) ?? []
9629
+ }));
9630
+ setBannerVisible(true);
9631
+ }
9632
+ }, resetKey)
7692
9633
  })
7693
- })
7694
- }),
7695
- /* @__PURE__ */ jsx("div", {
7696
- className: cx("section"),
7697
- children: /* @__PURE__ */ jsx(EndpointsSection, {
7698
- mode,
7699
- endpointsByTag: getEndpointsByTag(),
7700
- collapsed: endpointsCollapsed,
7701
- onToggleCollapse: () => setEndpointsCollapsed((c) => !c),
7702
- endpointNames,
7703
- endpointDescs,
7704
- endpointTags,
7705
- availableTags: localTags.map((t) => t.name),
7706
- onEndpointNameChange: (id, val) => {
7707
- setEndpointNames((prev) => ({
7708
- ...prev,
7709
- [id]: val
7710
- }));
7711
- setHasChanges(true);
7712
- setBannerVisible(true);
7713
- },
7714
- onEndpointDescChange: (id, val) => {
7715
- setEndpointDescs((prev) => ({
7716
- ...prev,
7717
- [id]: val
7718
- }));
7719
- setHasChanges(true);
7720
- setBannerVisible(true);
7721
- },
7722
- onEndpointTagsChange: (id, val) => {
7723
- setEndpointTags((prev) => ({
7724
- ...prev,
7725
- [id]: val
7726
- }));
7727
- setHasChanges(true);
7728
- setBannerVisible(true);
7729
- },
7730
- endpointParams,
7731
- onAddParameter: (endpointId, param) => {
7732
- setEndpointParams((prev) => ({
7733
- ...prev,
7734
- [endpointId]: [...prev[endpointId] ?? [], param]
7735
- }));
7736
- setHasChanges(true);
7737
- setBannerVisible(true);
7738
- },
7739
- onEditParameter: (endpointId, idx, param) => {
7740
- setEndpointParams((prev) => ({
7741
- ...prev,
7742
- [endpointId]: prev[endpointId]?.map((p, i) => i === idx ? param : p) ?? []
7743
- }));
7744
- setHasChanges(true);
7745
- setBannerVisible(true);
7746
- },
7747
- onDeleteParameter: (endpointId, idx) => {
7748
- setEndpointParams((prev) => ({
7749
- ...prev,
7750
- [endpointId]: prev[endpointId]?.filter((_, i) => i !== idx) ?? []
7751
- }));
7752
- setHasChanges(true);
7753
- setBannerVisible(true);
7754
- },
7755
- endpointResponseParams,
7756
- onAddResponseParameter: (endpointId, param) => {
7757
- setEndpointResponseParams((prev) => ({
7758
- ...prev,
7759
- [endpointId]: [...prev[endpointId] ?? [], param]
7760
- }));
7761
- setHasChanges(true);
7762
- setBannerVisible(true);
7763
- },
7764
- onEditResponseParameter: (endpointId, idx, param) => {
7765
- setEndpointResponseParams((prev) => ({
7766
- ...prev,
7767
- [endpointId]: prev[endpointId]?.map((p, i) => i === idx ? param : p) ?? []
7768
- }));
7769
- setHasChanges(true);
7770
- setBannerVisible(true);
7771
- },
7772
- onDeleteResponseParameter: (endpointId, idx) => {
7773
- setEndpointResponseParams((prev) => ({
7774
- ...prev,
7775
- [endpointId]: prev[endpointId]?.filter((_, i) => i !== idx) ?? []
7776
- }));
7777
- setHasChanges(true);
7778
- setBannerVisible(true);
7779
- }
7780
- }, resetKey)
7781
- })
7782
- ] }) : /* @__PURE__ */ jsxs("div", {
9634
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
9635
+ selectedEditItem.type === "errors" && errorBox && /* @__PURE__ */ jsx("div", {
9636
+ className: cx("section"),
9637
+ children: errorBox
9638
+ }),
9639
+ selectedEditItem.type !== "errors" && /* @__PURE__ */ jsx(Fragment, { children: errorBoxExpanded && errorBox ? /* @__PURE__ */ jsx("div", {
9640
+ className: cx("section"),
9641
+ children: errorBox
9642
+ }) : errorBoxCollapsed && /* @__PURE__ */ jsx("div", {
9643
+ className: cx("section"),
9644
+ children: errorBoxCollapsed
9645
+ }) }),
9646
+ selectedEditItem.type === "general" && /* @__PURE__ */ jsx("div", {
9647
+ className: cx("section"),
9648
+ children: /* @__PURE__ */ jsx(GeneralSection, {
9649
+ apiName: localApiName,
9650
+ authType: selectedApi?.authType || "",
9651
+ version: selectedApi?.relatedVersions?.find((v) => v.apiId === selectedApi?.currentVersion)?.version || "",
9652
+ description: localDescription,
9653
+ onApiNameChange: (val) => {
9654
+ setApiNameTouched(true);
9655
+ setLocalApiName(val);
9656
+ },
9657
+ apiNameError: hasApiNameError,
9658
+ onDescriptionChange: (val) => {
9659
+ setDescriptionTouched(true);
9660
+ setLocalDescription(val);
9661
+ },
9662
+ descriptionError: hasDescriptionError,
9663
+ collapsed: generalCollapsed,
9664
+ onToggleCollapse: () => setGeneralCollapsed((c) => !c),
9665
+ onChangeDetected: () => {
9666
+ setBannerVisible(true);
9667
+ }
9668
+ })
9669
+ }),
9670
+ selectedEditItem.type === "tags" && /* @__PURE__ */ jsx("div", {
9671
+ className: cx("section"),
9672
+ children: /* @__PURE__ */ jsx(TagsSection, {
9673
+ tags: localTags,
9674
+ collapsed: tagsCollapsed,
9675
+ onToggleCollapse: () => setTagsCollapsed((prev) => !prev),
9676
+ onAddTag: () => setTagDrawerState({
9677
+ open: true,
9678
+ mode: "add"
9679
+ }),
9680
+ onEditTag: (tag) => setTagDrawerState({
9681
+ open: true,
9682
+ mode: "edit",
9683
+ initialValues: {
9684
+ name: tag.name,
9685
+ description: tag.description,
9686
+ externalDocsDescription: tag.externalDocsDescription,
9687
+ externalDocsLink: tag.externalDocsUrl
9688
+ }
9689
+ }),
9690
+ onDeleteTag: (tagName) => setDeleteTagModal({
9691
+ open: true,
9692
+ tagName
9693
+ })
9694
+ })
9695
+ }),
9696
+ selectedEditItem.type === "endpoint" && /* @__PURE__ */ jsx(EndpointsSection, {
9697
+ mode,
9698
+ endpointsByTag: getEndpointsByTag(),
9699
+ selectedEndpointKey: selectedEditItem.key,
9700
+ collapsed: endpointsCollapsed,
9701
+ onToggleCollapse: () => setEndpointsCollapsed((c) => !c),
9702
+ endpointNames,
9703
+ endpointDescs,
9704
+ endpointTags,
9705
+ availableTags: localTags.map((t) => t.name),
9706
+ onEndpointNameChange: (id, val) => {
9707
+ setEndpointNames((prev) => ({
9708
+ ...prev,
9709
+ [id]: val
9710
+ }));
9711
+ setBannerVisible(true);
9712
+ },
9713
+ onEndpointDescChange: (id, val) => {
9714
+ setEndpointDescs((prev) => ({
9715
+ ...prev,
9716
+ [id]: val
9717
+ }));
9718
+ setBannerVisible(true);
9719
+ },
9720
+ onEndpointTagsChange: (id, val) => {
9721
+ setEndpointTags((prev) => ({
9722
+ ...prev,
9723
+ [id]: val
9724
+ }));
9725
+ setBannerVisible(true);
9726
+ },
9727
+ endpointParams,
9728
+ onAddParameter: (endpointId, param) => {
9729
+ setEndpointParams((prev) => ({
9730
+ ...prev,
9731
+ [endpointId]: [...prev[endpointId] ?? [], param]
9732
+ }));
9733
+ setBannerVisible(true);
9734
+ },
9735
+ onEditParameter: (endpointId, idx, param) => {
9736
+ setEndpointParams((prev) => ({
9737
+ ...prev,
9738
+ [endpointId]: prev[endpointId]?.map((p, i) => i === idx ? param : p) ?? []
9739
+ }));
9740
+ setBannerVisible(true);
9741
+ },
9742
+ onDeleteParameter: (endpointId, idx) => {
9743
+ setEndpointParams((prev) => ({
9744
+ ...prev,
9745
+ [endpointId]: prev[endpointId]?.filter((_, i) => i !== idx) ?? []
9746
+ }));
9747
+ setBannerVisible(true);
9748
+ },
9749
+ endpointResponseParams,
9750
+ onAddResponseParameter: (endpointId, param) => {
9751
+ setEndpointResponseParams((prev) => ({
9752
+ ...prev,
9753
+ [endpointId]: [...prev[endpointId] ?? [], param]
9754
+ }));
9755
+ setBannerVisible(true);
9756
+ },
9757
+ onEditResponseParameter: (endpointId, idx, param) => {
9758
+ setEndpointResponseParams((prev) => ({
9759
+ ...prev,
9760
+ [endpointId]: prev[endpointId]?.map((p, i) => i === idx ? param : p) ?? []
9761
+ }));
9762
+ setBannerVisible(true);
9763
+ },
9764
+ onDeleteResponseParameter: (endpointId, idx) => {
9765
+ setEndpointResponseParams((prev) => ({
9766
+ ...prev,
9767
+ [endpointId]: prev[endpointId]?.filter((_, i) => i !== idx) ?? []
9768
+ }));
9769
+ setBannerVisible(true);
9770
+ }
9771
+ }, resetKey)
9772
+ ] })
9773
+ })]
9774
+ }) : /* @__PURE__ */ jsxs("div", {
7783
9775
  className: cx("docs-layout"),
7784
- children: [
7785
- /* @__PURE__ */ jsx(Sidebar, {
7786
- searchValue,
7787
- setSearchValue
7788
- }),
7789
- /* @__PURE__ */ jsx(MainContent, {
9776
+ children: [/* @__PURE__ */ jsx(Sidebar, {
9777
+ searchValue,
9778
+ setSearchValue
9779
+ }), /* @__PURE__ */ jsxs("div", {
9780
+ className: cx("content-scroll-area"),
9781
+ children: [/* @__PURE__ */ jsx(MainContent, {
7790
9782
  handleVisitLandingPage: _handleVisitLandingPage,
7791
9783
  handleResetSearch,
7792
9784
  searchEnabled: !!searchValue
7793
- }),
7794
- !isMobile && focusedContent === "ENDPOINT" && /* @__PURE__ */ jsx(CodeboxSidebar$1, {})
7795
- ]
9785
+ }), !isMobile && focusedContent === "ENDPOINT" && /* @__PURE__ */ jsx(CodeboxSidebar$1, {})]
9786
+ })]
7796
9787
  }),
7797
9788
  /* @__PURE__ */ jsx(AddTagDrawer, {
7798
9789
  open: tagDrawerState.open,
@@ -7805,6 +9796,144 @@ const ConsoleDocumentationLayout = ({ data, preSelectedApi, handleVisitLandingPa
7805
9796
  onAddTag: handleAddTag,
7806
9797
  onEditTag: handleUpdateTag
7807
9798
  }),
9799
+ /* @__PURE__ */ jsxs(Modal, {
9800
+ open: saveConfirmModal,
9801
+ onCancel: () => setSaveConfirmModal(false),
9802
+ centered: true,
9803
+ title: null,
9804
+ footer: null,
9805
+ closable: false,
9806
+ width: 520,
9807
+ className: "delete-tag-confirm-modal",
9808
+ styles: {
9809
+ content: {
9810
+ padding: 0,
9811
+ borderRadius: 8,
9812
+ overflow: "hidden"
9813
+ },
9814
+ body: {
9815
+ padding: 0,
9816
+ margin: 0
9817
+ }
9818
+ },
9819
+ children: [
9820
+ /* @__PURE__ */ jsxs("div", {
9821
+ className: cx("deleteModalHead"),
9822
+ children: [/* @__PURE__ */ jsx("span", {
9823
+ className: cx("deleteModalTitle"),
9824
+ children: "Save & Publish Changes"
9825
+ }), /* @__PURE__ */ jsx("button", {
9826
+ className: cx("deleteModalCloseBtn"),
9827
+ onClick: () => setSaveConfirmModal(false),
9828
+ "aria-label": "Close",
9829
+ children: "×"
9830
+ })]
9831
+ }),
9832
+ /* @__PURE__ */ jsx("div", {
9833
+ className: cx("deleteModalContent"),
9834
+ children: /* @__PURE__ */ jsx("span", {
9835
+ className: cx("deleteModalContentText"),
9836
+ children: "Are you sure you want to Save & Publish Changes?"
9837
+ })
9838
+ }),
9839
+ /* @__PURE__ */ jsxs("div", {
9840
+ className: cx("deleteModalFooter"),
9841
+ children: [/* @__PURE__ */ jsx(Button, {
9842
+ size: "middle",
9843
+ onClick: () => setSaveConfirmModal(false),
9844
+ style: {
9845
+ borderRadius: 8,
9846
+ height: 32,
9847
+ paddingInline: 15
9848
+ },
9849
+ children: "Cancel"
9850
+ }), /* @__PURE__ */ jsx(Button, {
9851
+ type: "primary",
9852
+ size: "middle",
9853
+ onClick: () => {
9854
+ setSaveConfirmModal(false);
9855
+ handleSave();
9856
+ },
9857
+ style: {
9858
+ borderRadius: 8,
9859
+ height: 32,
9860
+ paddingInline: 16
9861
+ },
9862
+ children: "Yes, Save & Publish"
9863
+ })]
9864
+ })
9865
+ ]
9866
+ }),
9867
+ /* @__PURE__ */ jsxs(Modal, {
9868
+ open: resetConfirmModal,
9869
+ onCancel: () => setResetConfirmModal(false),
9870
+ centered: true,
9871
+ title: null,
9872
+ footer: null,
9873
+ closable: false,
9874
+ width: 520,
9875
+ className: "delete-tag-confirm-modal",
9876
+ styles: {
9877
+ content: {
9878
+ padding: 0,
9879
+ borderRadius: 8,
9880
+ overflow: "hidden"
9881
+ },
9882
+ body: {
9883
+ padding: 0,
9884
+ margin: 0
9885
+ }
9886
+ },
9887
+ children: [
9888
+ /* @__PURE__ */ jsxs("div", {
9889
+ className: cx("deleteModalHead"),
9890
+ children: [/* @__PURE__ */ jsx("span", {
9891
+ className: cx("deleteModalTitle"),
9892
+ children: "Reset changes?"
9893
+ }), /* @__PURE__ */ jsx("button", {
9894
+ className: cx("deleteModalCloseBtn"),
9895
+ onClick: () => setResetConfirmModal(false),
9896
+ "aria-label": "Close",
9897
+ children: "×"
9898
+ })]
9899
+ }),
9900
+ /* @__PURE__ */ jsx("div", {
9901
+ className: cx("deleteModalContent"),
9902
+ children: /* @__PURE__ */ jsx("span", {
9903
+ className: cx("deleteModalContentText"),
9904
+ children: "This will discard your unsaved changes."
9905
+ })
9906
+ }),
9907
+ /* @__PURE__ */ jsxs("div", {
9908
+ className: cx("deleteModalFooter"),
9909
+ children: [/* @__PURE__ */ jsx(Button, {
9910
+ size: "middle",
9911
+ onClick: () => setResetConfirmModal(false),
9912
+ style: {
9913
+ borderRadius: 8,
9914
+ height: 32,
9915
+ paddingInline: 15
9916
+ },
9917
+ children: "Cancel"
9918
+ }), /* @__PURE__ */ jsx(Button, {
9919
+ size: "middle",
9920
+ onClick: () => {
9921
+ setResetConfirmModal(false);
9922
+ handleReset();
9923
+ },
9924
+ style: {
9925
+ borderRadius: 8,
9926
+ height: 32,
9927
+ paddingInline: 16,
9928
+ backgroundColor: "#faad14",
9929
+ borderColor: "#faad14",
9930
+ color: "#fff"
9931
+ },
9932
+ children: "Yes, Reset"
9933
+ })]
9934
+ })
9935
+ ]
9936
+ }),
7808
9937
  /* @__PURE__ */ jsxs(Modal, {
7809
9938
  open: deleteTagModal.open,
7810
9939
  onCancel: () => setDeleteTagModal({