@cozeloop/components 0.0.5 → 0.0.7-beta-1766595012100
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/es/index.css +11 -27
- package/dist/es/{index.js → index.mjs} +495 -449
- package/dist/lib/code-editor-with-loading/index.d.ts +10 -0
- package/dist/lib/codemirror-editor/code-editor.d.ts +23 -2
- package/dist/lib/codemirror-editor/index.d.ts +2 -0
- package/dist/lib/codemirror-editor/json-editor.d.ts +1 -1
- package/dist/lib/codemirror-editor/raw-code-editor.d.ts +20 -0
- package/dist/lib/codemirror-editor/text-editor.d.ts +23 -2
- package/dist/lib/collapse-card/index.d.ts +2 -1
- package/dist/lib/copyable/index.d.ts +5 -0
- package/dist/lib/hooks/use-unsave-leave-warning.d.ts +4 -1
- package/dist/lib/index.d.ts +5 -5
- package/dist/lib/logic-editor/logic-editor.d.ts +2 -4
- package/dist/lib/logic-editor/logic-types.d.ts +6 -2
- package/dist/lib/loop-icons/index.d.ts +1 -0
- package/dist/lib/multi-part-editor/type.d.ts +1 -1
- package/dist/lib/provider/index.d.ts +10 -9
- package/dist/lib/table/sort-icon.d.ts +3 -3
- package/package.json +23 -25
- package/dist/lib/base-search-select/base-search-form-select.js +0 -6
- package/dist/lib/base-search-select/base-search-form-select.js.map +0 -1
- package/dist/lib/base-search-select/base-search-select.js +0 -127
- package/dist/lib/base-search-select/base-search-select.js.map +0 -1
- package/dist/lib/base-search-select/index.js +0 -3
- package/dist/lib/base-search-select/index.js.map +0 -1
- package/dist/lib/base-search-select/types.js +0 -2
- package/dist/lib/base-search-select/types.js.map +0 -1
- package/dist/lib/base-search-select/utils.js +0 -48
- package/dist/lib/base-search-select/utils.js.map +0 -1
- package/dist/lib/basic-card/index.js +0 -4
- package/dist/lib/basic-card/index.js.map +0 -1
- package/dist/lib/card-pane/index.js +0 -9
- package/dist/lib/card-pane/index.js.map +0 -1
- package/dist/lib/chip-select/index.js +0 -6
- package/dist/lib/chip-select/index.js.map +0 -1
- package/dist/lib/code-editor/index.js +0 -9
- package/dist/lib/code-editor/index.js.map +0 -1
- package/dist/lib/code-usage/index.d.ts +0 -14
- package/dist/lib/code-usage/index.js +0 -31
- package/dist/lib/code-usage/index.js.map +0 -1
- package/dist/lib/codemirror-editor/code-editor.js +0 -108
- package/dist/lib/codemirror-editor/code-editor.js.map +0 -1
- package/dist/lib/codemirror-editor/index.js +0 -5
- package/dist/lib/codemirror-editor/index.js.map +0 -1
- package/dist/lib/codemirror-editor/json-editor.js +0 -97
- package/dist/lib/codemirror-editor/json-editor.js.map +0 -1
- package/dist/lib/codemirror-editor/raw-text-editor.js +0 -32
- package/dist/lib/codemirror-editor/raw-text-editor.js.map +0 -1
- package/dist/lib/codemirror-editor/text-editor.js +0 -44
- package/dist/lib/codemirror-editor/text-editor.js.map +0 -1
- package/dist/lib/codemirror-editor/themes/coze-dark.js +0 -113
- package/dist/lib/codemirror-editor/themes/coze-dark.js.map +0 -1
- package/dist/lib/codemirror-editor/themes/coze-light.js +0 -119
- package/dist/lib/codemirror-editor/themes/coze-light.js.map +0 -1
- package/dist/lib/collapse-card/index.js +0 -31
- package/dist/lib/collapse-card/index.js.map +0 -1
- package/dist/lib/collapsible-card/index.js +0 -13
- package/dist/lib/collapsible-card/index.js.map +0 -1
- package/dist/lib/column-manage-storage/index.js +0 -48
- package/dist/lib/column-manage-storage/index.js.map +0 -1
- package/dist/lib/columns-select/index.js +0 -77
- package/dist/lib/columns-select/index.js.map +0 -1
- package/dist/lib/edit-icon-button/index.js +0 -13
- package/dist/lib/edit-icon-button/index.js.map +0 -1
- package/dist/lib/footer-actions/index.js +0 -9
- package/dist/lib/footer-actions/index.js.map +0 -1
- package/dist/lib/hooks/use-infinite-scroll.js +0 -133
- package/dist/lib/hooks/use-infinite-scroll.js.map +0 -1
- package/dist/lib/hooks/use-mouse-down-offset.js +0 -39
- package/dist/lib/hooks/use-mouse-down-offset.js.map +0 -1
- package/dist/lib/hooks/use-unsave-leave-warning.js +0 -33
- package/dist/lib/hooks/use-unsave-leave-warning.js.map +0 -1
- package/dist/lib/id-render/icon-button-container.js +0 -8
- package/dist/lib/id-render/icon-button-container.js.map +0 -1
- package/dist/lib/id-render/index.js +0 -21
- package/dist/lib/id-render/index.js.map +0 -1
- package/dist/lib/index-controller/record-navigation.js +0 -9
- package/dist/lib/index-controller/record-navigation.js.map +0 -1
- package/dist/lib/index-controller/use-item-index-controller.js +0 -123
- package/dist/lib/index-controller/use-item-index-controller.js.map +0 -1
- package/dist/lib/index.js +0 -76
- package/dist/lib/index.js.map +0 -1
- package/dist/lib/infinite-scroll-table/index.js +0 -34
- package/dist/lib/infinite-scroll-table/index.js.map +0 -1
- package/dist/lib/info-tooltip/index.js +0 -9
- package/dist/lib/info-tooltip/index.js.map +0 -1
- package/dist/lib/input-components/radio-button.js +0 -21
- package/dist/lib/input-components/radio-button.js.map +0 -1
- package/dist/lib/input-slider/index.js +0 -81
- package/dist/lib/input-slider/index.js.map +0 -1
- package/dist/lib/input-with-count/index.js +0 -7
- package/dist/lib/input-with-count/index.js.map +0 -1
- package/dist/lib/jump-button/jump-icon-button.js +0 -7
- package/dist/lib/jump-button/jump-icon-button.js.map +0 -1
- package/dist/lib/large-txt-render/index.js +0 -26
- package/dist/lib/large-txt-render/index.js.map +0 -1
- package/dist/lib/layout/content.js +0 -5
- package/dist/lib/layout/content.js.map +0 -1
- package/dist/lib/layout/header.js +0 -6
- package/dist/lib/layout/header.js.map +0 -1
- package/dist/lib/layout/index.js +0 -9
- package/dist/lib/layout/index.js.map +0 -1
- package/dist/lib/layout/tabs.js +0 -10
- package/dist/lib/layout/tabs.js.map +0 -1
- package/dist/lib/lazy-load-component/index.js +0 -42
- package/dist/lib/lazy-load-component/index.js.map +0 -1
- package/dist/lib/logic-editor/index.js +0 -3
- package/dist/lib/logic-editor/index.js.map +0 -1
- package/dist/lib/logic-editor/logic-editor.js +0 -69
- package/dist/lib/logic-editor/logic-editor.js.map +0 -1
- package/dist/lib/logic-editor/logic-left-render.js +0 -60
- package/dist/lib/logic-editor/logic-left-render.js.map +0 -1
- package/dist/lib/logic-editor/logic-operator-render.js +0 -29
- package/dist/lib/logic-editor/logic-operator-render.js.map +0 -1
- package/dist/lib/logic-editor/logic-right-render.js +0 -25
- package/dist/lib/logic-editor/logic-right-render.js.map +0 -1
- package/dist/lib/logic-editor/logic-types.js +0 -136
- package/dist/lib/logic-editor/logic-types.js.map +0 -1
- package/dist/lib/logic-editor/utils.js +0 -18
- package/dist/lib/logic-editor/utils.js.map +0 -1
- package/dist/lib/logic-expr/consts.js +0 -5
- package/dist/lib/logic-expr/consts.js.map +0 -1
- package/dist/lib/logic-expr/expr-group-render.js +0 -61
- package/dist/lib/logic-expr/expr-group-render.js.map +0 -1
- package/dist/lib/logic-expr/expr-render.js +0 -85
- package/dist/lib/logic-expr/expr-render.js.map +0 -1
- package/dist/lib/logic-expr/index.js +0 -2
- package/dist/lib/logic-expr/index.js.map +0 -1
- package/dist/lib/logic-expr/logic-expr.js +0 -187
- package/dist/lib/logic-expr/logic-expr.js.map +0 -1
- package/dist/lib/logic-expr/logic-not.js +0 -21
- package/dist/lib/logic-expr/logic-not.js.map +0 -1
- package/dist/lib/logic-expr/logic-toggle.js +0 -33
- package/dist/lib/logic-expr/logic-toggle.js.map +0 -1
- package/dist/lib/logic-expr/types.js +0 -2
- package/dist/lib/logic-expr/types.js.map +0 -1
- package/dist/lib/loop-radio-group/index.js +0 -7
- package/dist/lib/loop-radio-group/index.js.map +0 -1
- package/dist/lib/multi-part-editor/components/image-item-renderer.js +0 -57
- package/dist/lib/multi-part-editor/components/image-item-renderer.js.map +0 -1
- package/dist/lib/multi-part-editor/components/multipart-item-renderer.js +0 -25
- package/dist/lib/multi-part-editor/components/multipart-item-renderer.js.map +0 -1
- package/dist/lib/multi-part-editor/components/url-input-modal.js +0 -150
- package/dist/lib/multi-part-editor/components/url-input-modal.js.map +0 -1
- package/dist/lib/multi-part-editor/components/video-item-renderer.js +0 -57
- package/dist/lib/multi-part-editor/components/video-item-renderer.js.map +0 -1
- package/dist/lib/multi-part-editor/index.js +0 -300
- package/dist/lib/multi-part-editor/index.js.map +0 -1
- package/dist/lib/multi-part-editor/multi-part-render.js +0 -40
- package/dist/lib/multi-part-editor/multi-part-render.js.map +0 -1
- package/dist/lib/multi-part-editor/type.js +0 -25
- package/dist/lib/multi-part-editor/type.js.map +0 -1
- package/dist/lib/multi-part-editor/upload-button.js +0 -103
- package/dist/lib/multi-part-editor/upload-button.js.map +0 -1
- package/dist/lib/multi-part-editor/utils.js +0 -43
- package/dist/lib/multi-part-editor/utils.js.map +0 -1
- package/dist/lib/open-detail-button/index.js +0 -11
- package/dist/lib/open-detail-button/index.js.map +0 -1
- package/dist/lib/page-content/index.js +0 -23
- package/dist/lib/page-content/index.js.map +0 -1
- package/dist/lib/primary-page/index.js +0 -2
- package/dist/lib/primary-page/index.js.map +0 -1
- package/dist/lib/primary-page/primary-header.js +0 -4
- package/dist/lib/primary-page/primary-header.js.map +0 -1
- package/dist/lib/primary-title/index.js +0 -8
- package/dist/lib/primary-title/index.js.map +0 -1
- package/dist/lib/provider/index.js +0 -43
- package/dist/lib/provider/index.js.map +0 -1
- package/dist/lib/resizable-side-sheet/index.js +0 -32
- package/dist/lib/resizable-side-sheet/index.js.map +0 -1
- package/dist/lib/resize-sidesheet/index.js +0 -15
- package/dist/lib/resize-sidesheet/index.js.map +0 -1
- package/dist/lib/resize-sidesheet/use-drag.js +0 -30
- package/dist/lib/resize-sidesheet/use-drag.js.map +0 -1
- package/dist/lib/schema-editor/index.js +0 -5
- package/dist/lib/schema-editor/index.js.map +0 -1
- package/dist/lib/search-form/index.d.ts +0 -15
- package/dist/lib/search-form/index.js +0 -77
- package/dist/lib/search-form/index.js.map +0 -1
- package/dist/lib/semi-schema-form/components/tmpls/array-field-item.js +0 -19
- package/dist/lib/semi-schema-form/components/tmpls/array-field-item.js.map +0 -1
- package/dist/lib/semi-schema-form/components/tmpls/array-field.js +0 -39
- package/dist/lib/semi-schema-form/components/tmpls/array-field.js.map +0 -1
- package/dist/lib/semi-schema-form/components/tmpls/base-input.js +0 -32
- package/dist/lib/semi-schema-form/components/tmpls/base-input.js.map +0 -1
- package/dist/lib/semi-schema-form/components/tmpls/description-field.js +0 -13
- package/dist/lib/semi-schema-form/components/tmpls/description-field.js.map +0 -1
- package/dist/lib/semi-schema-form/components/tmpls/error-list.js +0 -14
- package/dist/lib/semi-schema-form/components/tmpls/error-list.js.map +0 -1
- package/dist/lib/semi-schema-form/components/tmpls/field-error.js +0 -16
- package/dist/lib/semi-schema-form/components/tmpls/field-error.js.map +0 -1
- package/dist/lib/semi-schema-form/components/tmpls/field.js +0 -21
- package/dist/lib/semi-schema-form/components/tmpls/field.js.map +0 -1
- package/dist/lib/semi-schema-form/components/tmpls/icon-button.js +0 -29
- package/dist/lib/semi-schema-form/components/tmpls/icon-button.js.map +0 -1
- package/dist/lib/semi-schema-form/components/tmpls/index.js +0 -31
- package/dist/lib/semi-schema-form/components/tmpls/index.js.map +0 -1
- package/dist/lib/semi-schema-form/components/tmpls/object-field.js +0 -81
- package/dist/lib/semi-schema-form/components/tmpls/object-field.js.map +0 -1
- package/dist/lib/semi-schema-form/components/tmpls/submit.js +0 -13
- package/dist/lib/semi-schema-form/components/tmpls/submit.js.map +0 -1
- package/dist/lib/semi-schema-form/components/tmpls/title-field.js +0 -12
- package/dist/lib/semi-schema-form/components/tmpls/title-field.js.map +0 -1
- package/dist/lib/semi-schema-form/components/widgets/checkbox.js +0 -26
- package/dist/lib/semi-schema-form/components/widgets/checkbox.js.map +0 -1
- package/dist/lib/semi-schema-form/components/widgets/checkboxs.js +0 -27
- package/dist/lib/semi-schema-form/components/widgets/checkboxs.js.map +0 -1
- package/dist/lib/semi-schema-form/components/widgets/index.js +0 -15
- package/dist/lib/semi-schema-form/components/widgets/index.js.map +0 -1
- package/dist/lib/semi-schema-form/components/widgets/radio.js +0 -27
- package/dist/lib/semi-schema-form/components/widgets/radio.js.map +0 -1
- package/dist/lib/semi-schema-form/components/widgets/range.js +0 -26
- package/dist/lib/semi-schema-form/components/widgets/range.js.map +0 -1
- package/dist/lib/semi-schema-form/components/widgets/select.js +0 -44
- package/dist/lib/semi-schema-form/components/widgets/select.js.map +0 -1
- package/dist/lib/semi-schema-form/components/widgets/textarea.js +0 -18
- package/dist/lib/semi-schema-form/components/widgets/textarea.js.map +0 -1
- package/dist/lib/semi-schema-form/index.js +0 -9
- package/dist/lib/semi-schema-form/index.js.map +0 -1
- package/dist/lib/sentinel-form/enum.js +0 -15
- package/dist/lib/sentinel-form/enum.js.map +0 -1
- package/dist/lib/sentinel-form/index.js +0 -289
- package/dist/lib/sentinel-form/index.js.map +0 -1
- package/dist/lib/step-nav/index.js +0 -13
- package/dist/lib/step-nav/index.js.map +0 -1
- package/dist/lib/table/index.js +0 -6
- package/dist/lib/table/index.js.map +0 -1
- package/dist/lib/table/sort-icon.js +0 -30
- package/dist/lib/table/sort-icon.js.map +0 -1
- package/dist/lib/table/table-with-pagination.js +0 -74
- package/dist/lib/table/table-with-pagination.js.map +0 -1
- package/dist/lib/table/table-without-pagniation.js +0 -37
- package/dist/lib/table/table-without-pagniation.js.map +0 -1
- package/dist/lib/table-batch-operate/table-batch-operation.js +0 -14
- package/dist/lib/table-batch-operate/table-batch-operation.js.map +0 -1
- package/dist/lib/table-batch-operate/use-batch-operate.js +0 -71
- package/dist/lib/table-batch-operate/use-batch-operate.js.map +0 -1
- package/dist/lib/table-col-actions/index.js +0 -35
- package/dist/lib/table-col-actions/index.js.map +0 -1
- package/dist/lib/table-cols-config/index.js +0 -57
- package/dist/lib/table-cols-config/index.js.map +0 -1
- package/dist/lib/table-cols-config/type.js +0 -2
- package/dist/lib/table-cols-config/type.js.map +0 -1
- package/dist/lib/table-cols-config/use-hidden-col-keys.js +0 -32
- package/dist/lib/table-cols-config/use-hidden-col-keys.js.map +0 -1
- package/dist/lib/table-cols-config/util.js +0 -39
- package/dist/lib/table-cols-config/util.js.map +0 -1
- package/dist/lib/table-empty/index.js +0 -10
- package/dist/lib/table-empty/index.js.map +0 -1
- package/dist/lib/table-header/index.js +0 -11
- package/dist/lib/table-header/index.js.map +0 -1
- package/dist/lib/tabs/index.js +0 -9
- package/dist/lib/tabs/index.js.map +0 -1
- package/dist/lib/text-area-pro/index.js +0 -10
- package/dist/lib/text-area-pro/index.js.map +0 -1
- package/dist/lib/text-with-copy/index.js +0 -24
- package/dist/lib/text-with-copy/index.js.map +0 -1
- package/dist/lib/title-with-sub/index.js +0 -6
- package/dist/lib/title-with-sub/index.js.map +0 -1
- package/dist/lib/tooltip-when-disabled/index.js +0 -9
- package/dist/lib/tooltip-when-disabled/index.js.map +0 -1
- package/dist/lib/tooltip-with-disabled/index.js +0 -9
- package/dist/lib/tooltip-with-disabled/index.js.map +0 -1
- package/dist/lib/tsconfig.build.tsbuildinfo +0 -1
- package/dist/lib/upload/index.js +0 -25
- package/dist/lib/upload/index.js.map +0 -1
- package/dist/lib/user-profile/index.js +0 -21
- package/dist/lib/user-profile/index.js.map +0 -1
- package/dist/lib/utils/basic.js +0 -29
- package/dist/lib/utils/basic.js.map +0 -1
- package/dist/lib/version-list/version-descriptions.js +0 -14
- package/dist/lib/version-list/version-descriptions.js.map +0 -1
- package/dist/lib/version-list/version-item.js +0 -6
- package/dist/lib/version-list/version-item.js.map +0 -1
- package/dist/lib/version-list/version-list.js +0 -11
- package/dist/lib/version-list/version-list.js.map +0 -1
- package/dist/lib/version-list/version-switch-panel.js +0 -10
- package/dist/lib/version-list/version-switch-panel.js.map +0 -1
|
@@ -3,15 +3,15 @@ import "./static/svg/select.svg";
|
|
|
3
3
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { arrayMove, sortableContainer as external_react_sortable_hoc_sortableContainer, sortableElement, sortableHandle } from "react-sortable-hoc";
|
|
5
5
|
import react, { Fragment as external_react_Fragment, createContext, forwardRef, useCallback, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
6
|
+
import { I18n as i18n_I18n, initIntl } from "@cozeloop/i18n";
|
|
6
7
|
import { IconCozArrowDown, IconCozArrowLeft, IconCozArrowRight, IconCozCheckMarkCircleFill, IconCozCheckMarkFill, IconCozContent, IconCozCopy, IconCozCross, IconCozCrossCircleFill, IconCozCrossFill, IconCozEye, IconCozFilter, IconCozHandle, IconCozImage, IconCozImageArrowUp, IconCozImageBroken, IconCozInfoCircle, IconCozLongArrowTopRight, IconCozLongArrowUp, IconCozMore, IconCozPencil, IconCozPlayCircle, IconCozPlus, IconCozPlusCircle, IconCozQuestionMarkCircle, IconCozRefresh, IconCozSetting, IconCozTableSetting, IconCozTrashCan, IconCozVideo, IconCozWarningCircle } from "@coze-arch/coze-design/icons";
|
|
7
8
|
import { Banner, Button, ButtonGroup, Cascader, Checkbox, Col, Collapse, CozAvatar, CozInputNumber, CozPagination, DatePicker, Descriptions, Divider, Dropdown, Empty, EmptyState, Form, IconButton, Image, ImagePreview, Input, List, Loading, Menu, Modal, Popover, Radio, RadioGroup, Row, Select, SideSheet, Skeleton, Slider, Space, Spin, Switch, Table, Tabs, Tag, TextArea, Toast, Tooltip, Typography, Upload, withField } from "@coze-arch/coze-design";
|
|
8
|
-
import { IconCozIllus404, IconCozIllus404Dark, IconCozIllusEmpty, IconCozIllusEmptyDark, IconCozIllusError, IconCozIllusErrorDark, IconCozIllusLock, IconCozIllusLockDark, IconCozIllusNone, IconCozIllusNoneDark } from "@coze-arch/coze-design/illustrations";
|
|
9
9
|
import classnames from "classnames";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { IconCozIllus404, IconCozIllus404Dark, IconCozIllusEmpty, IconCozIllusEmptyDark, IconCozIllusError, IconCozIllusErrorDark, IconCozIllusLock, IconCozIllusLockDark, IconCozIllusNone, IconCozIllusNoneDark } from "@coze-arch/coze-design/illustrations";
|
|
11
|
+
import { useInfiniteScroll, useLatest, useMemoizedFn, useRequest, useSize } from "ahooks";
|
|
12
|
+
import { cloneDeep, debounce, get, isEmpty as external_lodash_es_isEmpty, isInteger, isNull, isNumber, isObject, isString, isUndefined, set } from "lodash-es";
|
|
12
13
|
import copy_to_clipboard from "copy-to-clipboard";
|
|
13
14
|
import { formatTimestampToString, safeJsonParse, sleep as toolkit_sleep } from "@cozeloop/toolkit";
|
|
14
|
-
import { useBlocker, useSearchParams } from "react-router-dom";
|
|
15
15
|
import _monaco_editor_react, { DiffEditor, loader } from "@monaco-editor/react";
|
|
16
16
|
import sortablejs from "sortablejs";
|
|
17
17
|
import { nanoid } from "nanoid";
|
|
@@ -25,10 +25,13 @@ import { useMouseDownOffset as hooks_useMouseDownOffset } from "@cozeloop/hooks"
|
|
|
25
25
|
import dayjs from "dayjs";
|
|
26
26
|
import { EditorProvider, createRenderer, option as react_option } from "@coze-editor/editor/react";
|
|
27
27
|
import preset_code, { createTheme, languages, tags, themes, transformerCreator } from "@coze-editor/editor/preset-code";
|
|
28
|
+
import { typescript } from "@coze-editor/editor/language-typescript";
|
|
28
29
|
import { shell } from "@coze-editor/editor/language-shell";
|
|
30
|
+
import { python } from "@coze-editor/editor/language-python";
|
|
29
31
|
import { json } from "@coze-editor/editor/language-json";
|
|
30
32
|
import { mixLanguages } from "@coze-editor/editor";
|
|
31
33
|
import { EditorView, keymap } from "@codemirror/view";
|
|
34
|
+
import { goLanguage } from "@codemirror/lang-go";
|
|
32
35
|
import preset_universal from "@coze-editor/editor/preset-universal";
|
|
33
36
|
import { defaultKeymap, history as commands_history, historyKeymap } from "@codemirror/commands";
|
|
34
37
|
var __webpack_require__ = {};
|
|
@@ -69,10 +72,10 @@ const SortableContainer = columns_select_sortableContainer(({ children })=>/*#__
|
|
|
69
72
|
}));
|
|
70
73
|
const DragHandle = columns_select_sortableHandle(()=>/*#__PURE__*/ jsx(IconCozHandle, {
|
|
71
74
|
className: "cursor-grab",
|
|
72
|
-
"aria-label":
|
|
75
|
+
"aria-label": i18n_I18n.t('drag_to_sort'),
|
|
73
76
|
role: "button"
|
|
74
77
|
}));
|
|
75
|
-
const ColumnSelector = ({ columns, defaultColumns = columns, onChange, buttonText, resetButtonText
|
|
78
|
+
const ColumnSelector = ({ columns, defaultColumns = columns, onChange, buttonText, resetButtonText, className, sortable = true, itemRender, footerRender })=>{
|
|
76
79
|
const [list, setList] = useState(()=>[
|
|
77
80
|
...columns
|
|
78
81
|
]);
|
|
@@ -115,7 +118,7 @@ const ColumnSelector = ({ columns, defaultColumns = columns, onChange, buttonTex
|
|
|
115
118
|
/*#__PURE__*/ jsx(Checkbox, {
|
|
116
119
|
disabled: disabledKeys.includes(value.key ?? '') || value.disabled,
|
|
117
120
|
checked: selectedKeys.includes(value.key ?? ''),
|
|
118
|
-
"aria-label":
|
|
121
|
+
"aria-label": `${i18n_I18n.t('select')}${value.value}`
|
|
119
122
|
}),
|
|
120
123
|
/*#__PURE__*/ jsx(Typography.Text, {
|
|
121
124
|
ellipsis: {
|
|
@@ -188,7 +191,7 @@ const ColumnSelector = ({ columns, defaultColumns = columns, onChange, buttonTex
|
|
|
188
191
|
onClick: handleReset,
|
|
189
192
|
children: /*#__PURE__*/ jsx("span", {
|
|
190
193
|
className: "text-brand font-medium text-[13px]",
|
|
191
|
-
children: resetButtonText
|
|
194
|
+
children: resetButtonText || i18n_I18n.t('reset_to_default')
|
|
192
195
|
})
|
|
193
196
|
})
|
|
194
197
|
]
|
|
@@ -199,7 +202,7 @@ const ColumnSelector = ({ columns, defaultColumns = columns, onChange, buttonTex
|
|
|
199
202
|
onClick: handleReset,
|
|
200
203
|
children: /*#__PURE__*/ jsx("span", {
|
|
201
204
|
className: "text-brand font-medium text-[13px]",
|
|
202
|
-
children: resetButtonText
|
|
205
|
+
children: resetButtonText || i18n_I18n.t('reset_to_default')
|
|
203
206
|
})
|
|
204
207
|
})
|
|
205
208
|
]
|
|
@@ -207,7 +210,7 @@ const ColumnSelector = ({ columns, defaultColumns = columns, onChange, buttonTex
|
|
|
207
210
|
trigger: "click",
|
|
208
211
|
children: /*#__PURE__*/ jsx("div", {
|
|
209
212
|
children: /*#__PURE__*/ jsx(Tooltip, {
|
|
210
|
-
content:
|
|
213
|
+
content: i18n_I18n.t('column_management'),
|
|
211
214
|
theme: "dark",
|
|
212
215
|
position: "top",
|
|
213
216
|
children: /*#__PURE__*/ jsx(Button, {
|
|
@@ -242,6 +245,21 @@ function TooltipWithDisabled({ children, disabled, ...rest }) {
|
|
|
242
245
|
children: children
|
|
243
246
|
});
|
|
244
247
|
}
|
|
248
|
+
function Copyable({ className, text }) {
|
|
249
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
250
|
+
className: classnames(className, 'inline-flex items-center gap-1'),
|
|
251
|
+
children: [
|
|
252
|
+
text,
|
|
253
|
+
/*#__PURE__*/ jsx(IconCozCopy, {
|
|
254
|
+
className: "cursor-pointer",
|
|
255
|
+
onClick: async ()=>{
|
|
256
|
+
await navigator.clipboard.writeText(text);
|
|
257
|
+
Toast.success(i18n_I18n.t('copy_success'));
|
|
258
|
+
}
|
|
259
|
+
})
|
|
260
|
+
]
|
|
261
|
+
});
|
|
262
|
+
}
|
|
245
263
|
const index_module = {
|
|
246
264
|
"loop-table": "loop-table-ZtuuXn",
|
|
247
265
|
loopTable: "loop-table-ZtuuXn"
|
|
@@ -250,7 +268,7 @@ const LoopTable = ({ className, ...props })=>/*#__PURE__*/ jsx(Table, {
|
|
|
250
268
|
empty: /*#__PURE__*/ jsx(EmptyState, {
|
|
251
269
|
size: "full_screen",
|
|
252
270
|
icon: /*#__PURE__*/ jsx(IconCozIllusEmpty, {}),
|
|
253
|
-
title:
|
|
271
|
+
title: i18n_I18n.t('no_data')
|
|
254
272
|
}),
|
|
255
273
|
...props,
|
|
256
274
|
id: index_module["loop-table"]
|
|
@@ -295,24 +313,24 @@ const IconSortArrow = ({ sortOrder, ...rest })=>{
|
|
|
295
313
|
]
|
|
296
314
|
});
|
|
297
315
|
};
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
316
|
+
const createLoopTableSortIcon = ()=>({ sortOrder })=>{
|
|
317
|
+
let tooltip = i18n_I18n.t('click_ascending');
|
|
318
|
+
if ('ascend' === sortOrder) tooltip = i18n_I18n.t('click_descending');
|
|
319
|
+
else if ('descend' === sortOrder) tooltip = i18n_I18n.t('restore_default_sort');
|
|
320
|
+
return /*#__PURE__*/ jsx(Tooltip, {
|
|
321
|
+
theme: "dark",
|
|
322
|
+
content: tooltip,
|
|
323
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
324
|
+
className: "flex items-center",
|
|
325
|
+
children: /*#__PURE__*/ jsx(IconButtonContainer, {
|
|
326
|
+
icon: /*#__PURE__*/ jsx(IconSortArrow, {
|
|
327
|
+
sortOrder: sortOrder,
|
|
328
|
+
className: "text-[var(--coz-fg-secondary)]"
|
|
329
|
+
})
|
|
311
330
|
})
|
|
312
331
|
})
|
|
313
|
-
})
|
|
314
|
-
}
|
|
315
|
-
}
|
|
332
|
+
});
|
|
333
|
+
};
|
|
316
334
|
function getStoragePageSize(pageSizeStorageKey) {
|
|
317
335
|
if (!pageSizeStorageKey) return;
|
|
318
336
|
const pageSize = localStorage.getItem(pageSizeStorageKey);
|
|
@@ -377,7 +395,7 @@ function TableWithPagination(props) {
|
|
|
377
395
|
columns: columns?.filter((column)=>true !== column.hidden && false !== column.checked)?.map((column)=>({
|
|
378
396
|
...column,
|
|
379
397
|
...column.sorter && !column.sortIcon ? {
|
|
380
|
-
sortIcon:
|
|
398
|
+
sortIcon: createLoopTableSortIcon()
|
|
381
399
|
} : {}
|
|
382
400
|
})),
|
|
383
401
|
dataSource: service?.data?.list ?? []
|
|
@@ -426,7 +444,7 @@ function PageNotFound({ className, ...props }) {
|
|
|
426
444
|
darkModeImage: /*#__PURE__*/ jsx(IconCozIllus404Dark, {
|
|
427
445
|
className: "text-[160px]"
|
|
428
446
|
}),
|
|
429
|
-
description:
|
|
447
|
+
description: i18n_I18n.t('page_not_found'),
|
|
430
448
|
...props
|
|
431
449
|
})
|
|
432
450
|
});
|
|
@@ -441,7 +459,7 @@ function PageError({ className, ...props }) {
|
|
|
441
459
|
darkModeImage: /*#__PURE__*/ jsx(IconCozIllusErrorDark, {
|
|
442
460
|
className: "text-[160px]"
|
|
443
461
|
}),
|
|
444
|
-
description:
|
|
462
|
+
description: i18n_I18n.t('page_load_failed'),
|
|
445
463
|
...props
|
|
446
464
|
})
|
|
447
465
|
});
|
|
@@ -456,7 +474,7 @@ function PageNoAuth({ className, ...props }) {
|
|
|
456
474
|
darkModeImage: /*#__PURE__*/ jsx(IconCozIllusLockDark, {
|
|
457
475
|
className: "text-[160px]"
|
|
458
476
|
}),
|
|
459
|
-
description:
|
|
477
|
+
description: i18n_I18n.t('no_permission'),
|
|
460
478
|
...props
|
|
461
479
|
})
|
|
462
480
|
});
|
|
@@ -687,14 +705,14 @@ const handleCopy = async (value, hideToast)=>{
|
|
|
687
705
|
try {
|
|
688
706
|
copy_to_clipboard(value);
|
|
689
707
|
hideToast || Toast.success({
|
|
690
|
-
content:
|
|
708
|
+
content: i18n_I18n.t('copy_success'),
|
|
691
709
|
showClose: false,
|
|
692
710
|
zIndex: 99999
|
|
693
711
|
});
|
|
694
712
|
return Promise.resolve(true);
|
|
695
713
|
} catch (e) {
|
|
696
714
|
Toast.warning({
|
|
697
|
-
content:
|
|
715
|
+
content: i18n_I18n.t('copy_failed'),
|
|
698
716
|
showClose: false,
|
|
699
717
|
zIndex: 99999
|
|
700
718
|
});
|
|
@@ -769,7 +787,7 @@ const version_list_index_module = {
|
|
|
769
787
|
description: "description-gjffk4"
|
|
770
788
|
};
|
|
771
789
|
function VersionDescriptions({ version, className }) {
|
|
772
|
-
const { version: versionName, draftSubmitText =
|
|
790
|
+
const { version: versionName, draftSubmitText = i18n_I18n.t('save_time'), submitTime, submitter, description, isDraft = false } = version || {};
|
|
773
791
|
return /*#__PURE__*/ jsxs(Descriptions, {
|
|
774
792
|
align: "left",
|
|
775
793
|
className: classnames(version_list_index_module.description, className),
|
|
@@ -777,17 +795,17 @@ function VersionDescriptions({ version, className }) {
|
|
|
777
795
|
/*#__PURE__*/ jsx(Tag, {
|
|
778
796
|
color: isDraft ? 'primary' : 'green',
|
|
779
797
|
className: "mb-2",
|
|
780
|
-
children: isDraft ?
|
|
798
|
+
children: isDraft ? i18n_I18n.t('current_draft') : i18n_I18n.t('submit')
|
|
781
799
|
}),
|
|
782
800
|
isDraft ? null : /*#__PURE__*/ jsx(Descriptions.Item, {
|
|
783
|
-
itemKey:
|
|
801
|
+
itemKey: i18n_I18n.t('version'),
|
|
784
802
|
children: /*#__PURE__*/ jsx("span", {
|
|
785
803
|
className: "font-medium",
|
|
786
804
|
children: versionName ?? '-'
|
|
787
805
|
})
|
|
788
806
|
}),
|
|
789
807
|
submitTime ? /*#__PURE__*/ jsx(Descriptions.Item, {
|
|
790
|
-
itemKey: isDraft ? draftSubmitText :
|
|
808
|
+
itemKey: isDraft ? draftSubmitText : i18n_I18n.t('submit_time'),
|
|
791
809
|
className: "!text-[13px]",
|
|
792
810
|
children: /*#__PURE__*/ jsx("span", {
|
|
793
811
|
className: "font-medium !text-[13px]",
|
|
@@ -795,7 +813,7 @@ function VersionDescriptions({ version, className }) {
|
|
|
795
813
|
})
|
|
796
814
|
}) : null,
|
|
797
815
|
isDraft && !submitter ? null : /*#__PURE__*/ jsx(Descriptions.Item, {
|
|
798
|
-
itemKey:
|
|
816
|
+
itemKey: i18n_I18n.t('submit_user'),
|
|
799
817
|
className: "!text-[13px]",
|
|
800
818
|
children: /*#__PURE__*/ jsx(UserProfile, {
|
|
801
819
|
name: submitter?.name,
|
|
@@ -803,7 +821,7 @@ function VersionDescriptions({ version, className }) {
|
|
|
803
821
|
})
|
|
804
822
|
}),
|
|
805
823
|
isDraft ? null : /*#__PURE__*/ jsx(Descriptions.Item, {
|
|
806
|
-
itemKey: "
|
|
824
|
+
itemKey: i18n_I18n.t("version_description"),
|
|
807
825
|
className: "!text-[13px]",
|
|
808
826
|
children: /*#__PURE__*/ jsx(Typography.Text, {
|
|
809
827
|
ellipsis: {
|
|
@@ -844,7 +862,7 @@ function VersionList({ versions = [], loadMoreLoading = false, enableLoadMore =
|
|
|
844
862
|
loading: loadMoreLoading,
|
|
845
863
|
color: "primary",
|
|
846
864
|
onClick: ()=>onLoadMore?.(),
|
|
847
|
-
children:
|
|
865
|
+
children: i18n_I18n.t('show_more')
|
|
848
866
|
})
|
|
849
867
|
});
|
|
850
868
|
return /*#__PURE__*/ jsx(Fragment, {
|
|
@@ -873,7 +891,7 @@ function VersionSwitchPanel({ visible = true, onClose, ...versionListProps }) {
|
|
|
873
891
|
children: [
|
|
874
892
|
/*#__PURE__*/ jsx("div", {
|
|
875
893
|
className: "text-sm font-medium",
|
|
876
|
-
children:
|
|
894
|
+
children: i18n_I18n.t('version_record')
|
|
877
895
|
}),
|
|
878
896
|
/*#__PURE__*/ jsx(IconCozCross, {
|
|
879
897
|
className: "ml-auto cursor-pointer text-gray-400 hover:text-gray-900",
|
|
@@ -921,7 +939,7 @@ function TextWithCopy({ displayText, copyTooltipText, content, className, maxWid
|
|
|
921
939
|
children: displayText || content || ''
|
|
922
940
|
}),
|
|
923
941
|
content ? /*#__PURE__*/ jsx(Tooltip, {
|
|
924
|
-
content: copyTooltipText ||
|
|
942
|
+
content: copyTooltipText || i18n_I18n.t('copy_content'),
|
|
925
943
|
theme: "dark",
|
|
926
944
|
children: /*#__PURE__*/ jsx(IconButton, {
|
|
927
945
|
size: "mini",
|
|
@@ -990,7 +1008,7 @@ function IDRender({ id, showSuffixLength = 5, enableCopy = true, useTag = false,
|
|
|
990
1008
|
})
|
|
991
1009
|
}),
|
|
992
1010
|
enableCopy ? /*#__PURE__*/ jsx(Tooltip, {
|
|
993
|
-
content:
|
|
1011
|
+
content: i18n_I18n.t('copy_id'),
|
|
994
1012
|
theme: "dark",
|
|
995
1013
|
children: /*#__PURE__*/ jsx("div", {
|
|
996
1014
|
children: /*#__PURE__*/ jsx(IconButtonContainer, {
|
|
@@ -1000,10 +1018,10 @@ function IDRender({ id, showSuffixLength = 5, enableCopy = true, useTag = false,
|
|
|
1000
1018
|
e.stopPropagation();
|
|
1001
1019
|
try {
|
|
1002
1020
|
await navigator.clipboard.writeText(idString);
|
|
1003
|
-
Toast.success(
|
|
1021
|
+
Toast.success(i18n_I18n.t('copy_success'));
|
|
1004
1022
|
} catch (error) {
|
|
1005
1023
|
console.error(error);
|
|
1006
|
-
Toast.error(
|
|
1024
|
+
Toast.error(i18n_I18n.t('copy_failed'));
|
|
1007
1025
|
}
|
|
1008
1026
|
}
|
|
1009
1027
|
})
|
|
@@ -1197,42 +1215,8 @@ const ResizeSidesheet = (props)=>{
|
|
|
1197
1215
|
]
|
|
1198
1216
|
});
|
|
1199
1217
|
};
|
|
1200
|
-
const CozeLoopContext = /*#__PURE__*/ createContext({});
|
|
1201
|
-
function CozeLoopProvider({ children, i18n, sendEvent }) {
|
|
1202
|
-
return /*#__PURE__*/ jsx(CozeLoopContext.Provider, {
|
|
1203
|
-
value: {
|
|
1204
|
-
i18n,
|
|
1205
|
-
sendEvent
|
|
1206
|
-
},
|
|
1207
|
-
children: children
|
|
1208
|
-
});
|
|
1209
|
-
}
|
|
1210
|
-
function useI18n() {
|
|
1211
|
-
const context = useContext(CozeLoopContext);
|
|
1212
|
-
if (!context.i18n) return {
|
|
1213
|
-
t: (key)=>{
|
|
1214
|
-
console.warn(`CozeLoopProvider: No i18n function provided, returning key: ${key}`);
|
|
1215
|
-
return key;
|
|
1216
|
-
},
|
|
1217
|
-
language: 'zh-CN'
|
|
1218
|
-
};
|
|
1219
|
-
if ('object' == typeof context.i18n && 't' in context.i18n) return context.i18n;
|
|
1220
|
-
return {
|
|
1221
|
-
t: context.i18n
|
|
1222
|
-
};
|
|
1223
|
-
}
|
|
1224
|
-
function useReportEvent() {
|
|
1225
|
-
const context = useContext(CozeLoopContext);
|
|
1226
|
-
return context.sendEvent ?? ((name, params)=>{
|
|
1227
|
-
console.info(name, params);
|
|
1228
|
-
});
|
|
1229
|
-
}
|
|
1230
|
-
function useCozeLoopContext() {
|
|
1231
|
-
return useContext(CozeLoopContext);
|
|
1232
|
-
}
|
|
1233
1218
|
const useUnsaveLeaveWarning = ({ block, message })=>{
|
|
1234
|
-
const
|
|
1235
|
-
const warnMessage = message || i18n.t('unsave_leave_confirm_warning') || 'Close confirm';
|
|
1219
|
+
const warnMessage = message || i18n_I18n.t('unsave_leave_confirm_warning') || 'Close confirm';
|
|
1236
1220
|
useEffect(()=>{
|
|
1237
1221
|
const handleBeforeUnload = (event)=>{
|
|
1238
1222
|
if (block) {
|
|
@@ -1248,10 +1232,6 @@ const useUnsaveLeaveWarning = ({ block, message })=>{
|
|
|
1248
1232
|
block,
|
|
1249
1233
|
warnMessage
|
|
1250
1234
|
]);
|
|
1251
|
-
useBlocker(()=>{
|
|
1252
|
-
if (block) return !window.confirm(warnMessage);
|
|
1253
|
-
return true;
|
|
1254
|
-
});
|
|
1255
1235
|
};
|
|
1256
1236
|
const InfiniteScrollTable = /*#__PURE__*/ forwardRef(({ service, options, className, ...restTableProps }, ref)=>{
|
|
1257
1237
|
const containerRef = useRef(null);
|
|
@@ -1285,7 +1265,7 @@ const InfiniteScrollTable = /*#__PURE__*/ forwardRef(({ service, options, classN
|
|
|
1285
1265
|
empty: restTableProps.empty ?? /*#__PURE__*/ jsx(EmptyState, {
|
|
1286
1266
|
size: "full_screen",
|
|
1287
1267
|
icon: /*#__PURE__*/ jsx(IconCozIllusEmpty, {}),
|
|
1288
|
-
title:
|
|
1268
|
+
title: i18n_I18n.t('no_data')
|
|
1289
1269
|
}),
|
|
1290
1270
|
enableLoad: true,
|
|
1291
1271
|
loadMode: "cursor",
|
|
@@ -1386,7 +1366,7 @@ function TableColsConfig({ className, localStorageKey, defaultHiddenColKeys, col
|
|
|
1386
1366
|
const configColumns = generateConfigColumns(handledColumns, hiddenColKeys);
|
|
1387
1367
|
if (configColumns) toolkit_sleep(100).then(()=>{
|
|
1388
1368
|
onChangeConfig?.(configColumns);
|
|
1389
|
-
});
|
|
1369
|
+
}).catch(console.error);
|
|
1390
1370
|
}
|
|
1391
1371
|
}, [
|
|
1392
1372
|
handledColumns,
|
|
@@ -1450,7 +1430,7 @@ function TableColsConfig({ className, localStorageKey, defaultHiddenColKeys, col
|
|
|
1450
1430
|
icon: /*#__PURE__*/ jsx(IconCozSetting, {}),
|
|
1451
1431
|
color: "primary",
|
|
1452
1432
|
onClick: ()=>setVisible(true),
|
|
1453
|
-
children:
|
|
1433
|
+
children: i18n_I18n.t('column_configuration')
|
|
1454
1434
|
}),
|
|
1455
1435
|
/*#__PURE__*/ jsxs(SideSheet, {
|
|
1456
1436
|
placement: "right",
|
|
@@ -1466,7 +1446,7 @@ function TableColsConfig({ className, localStorageKey, defaultHiddenColKeys, col
|
|
|
1466
1446
|
children: [
|
|
1467
1447
|
/*#__PURE__*/ jsx("div", {
|
|
1468
1448
|
className: classnames(table_cols_config_index_module.cell, table_cols_config_index_module["cell-left"], table_cols_config_index_module["cell-thead"]),
|
|
1469
|
-
children:
|
|
1449
|
+
children: i18n_I18n.t('column_name')
|
|
1470
1450
|
}),
|
|
1471
1451
|
/*#__PURE__*/ jsx("div", {
|
|
1472
1452
|
className: classnames(table_cols_config_index_module.cell, table_cols_config_index_module["cell-right"], table_cols_config_index_module["cell-thead"]),
|
|
@@ -1513,7 +1493,7 @@ function TableHeader({ columnSelectorConfigProps, tableColsConfigProps, filterFo
|
|
|
1513
1493
|
...spaceProps || {},
|
|
1514
1494
|
children: [
|
|
1515
1495
|
refreshButtonPros ? /*#__PURE__*/ jsx(Tooltip, {
|
|
1516
|
-
content:
|
|
1496
|
+
content: i18n_I18n.t('refresh'),
|
|
1517
1497
|
theme: "dark",
|
|
1518
1498
|
children: /*#__PURE__*/ jsx(Button, {
|
|
1519
1499
|
color: "primary",
|
|
@@ -1535,7 +1515,7 @@ function TableWithoutPagination(props) {
|
|
|
1535
1515
|
const { header, heightFull = false, className } = props;
|
|
1536
1516
|
const { columns } = props.tableProps ?? {};
|
|
1537
1517
|
const tableContainerRef = useRef(null);
|
|
1538
|
-
const size = useSize(tableContainerRef
|
|
1518
|
+
const size = useSize(tableContainerRef);
|
|
1539
1519
|
const tableHeaderSize = useSize(tableContainerRef.current?.querySelector('.semi-table-header'));
|
|
1540
1520
|
const tableHeaderHeight = tableHeaderSize?.height ?? 56;
|
|
1541
1521
|
return /*#__PURE__*/ jsxs("div", {
|
|
@@ -1559,7 +1539,7 @@ function TableWithoutPagination(props) {
|
|
|
1559
1539
|
columns: columns?.filter((column)=>true !== column.hidden && false !== column.checked)?.map((column)=>({
|
|
1560
1540
|
...column,
|
|
1561
1541
|
...column.sorter && !column.sortIcon ? {
|
|
1562
|
-
sortIcon:
|
|
1542
|
+
sortIcon: createLoopTableSortIcon()
|
|
1563
1543
|
} : {}
|
|
1564
1544
|
}))
|
|
1565
1545
|
}
|
|
@@ -1573,7 +1553,7 @@ function TableBatchOperate({ actions, batchOperateStore }) {
|
|
|
1573
1553
|
if (!enableBatchOperate) return /*#__PURE__*/ jsx(Button, {
|
|
1574
1554
|
color: "primary",
|
|
1575
1555
|
onClick: ()=>setEnableBatchOperate?.(true),
|
|
1576
|
-
children:
|
|
1556
|
+
children: i18n_I18n.t('bulk_select')
|
|
1577
1557
|
});
|
|
1578
1558
|
return /*#__PURE__*/ jsxs("div", {
|
|
1579
1559
|
className: "flex items-center gap-2",
|
|
@@ -1581,16 +1561,16 @@ function TableBatchOperate({ actions, batchOperateStore }) {
|
|
|
1581
1561
|
/*#__PURE__*/ jsxs("div", {
|
|
1582
1562
|
className: "text-xs",
|
|
1583
1563
|
children: [
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1564
|
+
i18n_I18n.t('cozeloop_open_evaluate_selected_data_count', {
|
|
1565
|
+
placeholder1: selectedItems.length
|
|
1566
|
+
}),
|
|
1587
1567
|
/*#__PURE__*/ jsx("span", {
|
|
1588
1568
|
className: "ml-1 text-[rgb(var(--coze-up-brand-9))] cursor-pointer",
|
|
1589
1569
|
onClick: ()=>{
|
|
1590
1570
|
setSelectedItems([]);
|
|
1591
1571
|
setEnableBatchOperate?.(false);
|
|
1592
1572
|
},
|
|
1593
|
-
children:
|
|
1573
|
+
children: i18n_I18n.t('unselect')
|
|
1594
1574
|
})
|
|
1595
1575
|
]
|
|
1596
1576
|
}),
|
|
@@ -1776,7 +1756,7 @@ function IndexControllerView({ indexControllerStore, className }) {
|
|
|
1776
1756
|
spacing: 4,
|
|
1777
1757
|
children: [
|
|
1778
1758
|
/*#__PURE__*/ jsx(Tooltip, {
|
|
1779
|
-
content:
|
|
1759
|
+
content: i18n_I18n.t('prev_item'),
|
|
1780
1760
|
theme: "dark",
|
|
1781
1761
|
children: /*#__PURE__*/ jsx("div", {
|
|
1782
1762
|
className: "flex items-center",
|
|
@@ -1801,7 +1781,7 @@ function IndexControllerView({ indexControllerStore, className }) {
|
|
|
1801
1781
|
]
|
|
1802
1782
|
}),
|
|
1803
1783
|
/*#__PURE__*/ jsx(Tooltip, {
|
|
1804
|
-
content:
|
|
1784
|
+
content: i18n_I18n.t('next_one'),
|
|
1805
1785
|
theme: "dark",
|
|
1806
1786
|
children: /*#__PURE__*/ jsx("div", {
|
|
1807
1787
|
className: "flex items-center",
|
|
@@ -1937,7 +1917,7 @@ const BaseSearchSelect = (props)=>{
|
|
|
1937
1917
|
return /*#__PURE__*/ jsx(Select, {
|
|
1938
1918
|
suffix: showRefreshBtn && dropdownVisible ? /*#__PURE__*/ jsx(Tooltip, {
|
|
1939
1919
|
theme: "dark",
|
|
1940
|
-
content:
|
|
1920
|
+
content: i18n_I18n.t('refresh'),
|
|
1941
1921
|
children: /*#__PURE__*/ jsxs("div", {
|
|
1942
1922
|
className: "flex flex-row items-center",
|
|
1943
1923
|
children: [
|
|
@@ -1976,7 +1956,7 @@ const base_search_form_select = BaseSearchFormSelect;
|
|
|
1976
1956
|
function OpenDetailButton({ url, className }) {
|
|
1977
1957
|
return /*#__PURE__*/ jsx(Tooltip, {
|
|
1978
1958
|
theme: "dark",
|
|
1979
|
-
content:
|
|
1959
|
+
content: i18n_I18n.t('view_detail'),
|
|
1980
1960
|
children: /*#__PURE__*/ jsx(Button, {
|
|
1981
1961
|
onClick: (e)=>{
|
|
1982
1962
|
e.stopPropagation();
|
|
@@ -2115,7 +2095,6 @@ const logic_expr_index_module = {
|
|
|
2115
2095
|
};
|
|
2116
2096
|
function LogicNot(props) {
|
|
2117
2097
|
const { not, readonly, onChange, className, style } = props;
|
|
2118
|
-
const I18n = useI18n();
|
|
2119
2098
|
const onClick = ()=>{
|
|
2120
2099
|
if (readonly) return;
|
|
2121
2100
|
onChange?.(!not);
|
|
@@ -2129,7 +2108,7 @@ function LogicNot(props) {
|
|
|
2129
2108
|
e.stopPropagation();
|
|
2130
2109
|
onClick();
|
|
2131
2110
|
},
|
|
2132
|
-
children:
|
|
2111
|
+
children: i18n_I18n.t('logic_expr_not')
|
|
2133
2112
|
});
|
|
2134
2113
|
}
|
|
2135
2114
|
const LOGIC_OPTIONS = [
|
|
@@ -2157,7 +2136,6 @@ const SvgSelect = (props)=>/*#__PURE__*/ jsx("svg", {
|
|
|
2157
2136
|
});
|
|
2158
2137
|
function LogicToggle(props) {
|
|
2159
2138
|
const { operator = 'and', hideLine, enableNot, not = false, readonly, allowLogicOperators, onChange } = props;
|
|
2160
|
-
const I18n = useI18n();
|
|
2161
2139
|
const filteredLogicOptions = allowLogicOperators ? LOGIC_OPTIONS.filter((op)=>allowLogicOperators.includes(op.value)) : LOGIC_OPTIONS;
|
|
2162
2140
|
const label = filteredLogicOptions.find((op)=>op.value === operator)?.label || '-';
|
|
2163
2141
|
return /*#__PURE__*/ jsx("div", {
|
|
@@ -2168,7 +2146,7 @@ function LogicToggle(props) {
|
|
|
2168
2146
|
}),
|
|
2169
2147
|
children: readonly ? /*#__PURE__*/ jsx("div", {
|
|
2170
2148
|
className: logic_expr_index_module["logic-toggle-tag"],
|
|
2171
|
-
children:
|
|
2149
|
+
children: i18n_I18n.t(label)
|
|
2172
2150
|
}) : /*#__PURE__*/ jsx(Select, {
|
|
2173
2151
|
size: "small",
|
|
2174
2152
|
showClear: false,
|
|
@@ -2184,7 +2162,7 @@ function LogicToggle(props) {
|
|
|
2184
2162
|
onChange(operator, val);
|
|
2185
2163
|
}
|
|
2186
2164
|
}) : null,
|
|
2187
|
-
|
|
2165
|
+
i18n_I18n.t(label),
|
|
2188
2166
|
/*#__PURE__*/ jsx(SvgSelect, {
|
|
2189
2167
|
className: logic_expr_index_module["logic-toggle-tag-icon"]
|
|
2190
2168
|
})
|
|
@@ -2192,7 +2170,7 @@ function LogicToggle(props) {
|
|
|
2192
2170
|
}),
|
|
2193
2171
|
optionList: filteredLogicOptions.map((item)=>({
|
|
2194
2172
|
...item,
|
|
2195
|
-
label:
|
|
2173
|
+
label: i18n_I18n.t(item.label ?? '')
|
|
2196
2174
|
})),
|
|
2197
2175
|
value: operator,
|
|
2198
2176
|
onChange: (val)=>{
|
|
@@ -2261,7 +2239,6 @@ function defaultRightRender({ expr, readonly, size, onChange, onExprChange }) {
|
|
|
2261
2239
|
}
|
|
2262
2240
|
const ExprRender = ({ value, readonly, enableNot, className, style, path, leftRender, operatorRender, rightRender, elementSize = 'default', onChange, onDelete, renderTool, errorMsgRender })=>{
|
|
2263
2241
|
const isEdit = !readonly;
|
|
2264
|
-
const I18n = useI18n();
|
|
2265
2242
|
const [deleteButtonHover, setDeleteButtonHover] = useState(false);
|
|
2266
2243
|
const patchExpr = (expr)=>{
|
|
2267
2244
|
const newExpr = {
|
|
@@ -2343,7 +2320,7 @@ const ExprRender = ({ value, readonly, enableNot, className, style, path, leftRe
|
|
|
2343
2320
|
renderRight(),
|
|
2344
2321
|
isEdit ? /*#__PURE__*/ jsx(Tooltip, {
|
|
2345
2322
|
theme: "dark",
|
|
2346
|
-
content:
|
|
2323
|
+
content: i18n_I18n.t('logic_expr_delete_filter'),
|
|
2347
2324
|
children: /*#__PURE__*/ jsx(IconButton, {
|
|
2348
2325
|
className: classnames('expr-render-del-btn', logic_expr_index_module["expr-render-del-btn"]),
|
|
2349
2326
|
size: "small",
|
|
@@ -2385,7 +2362,6 @@ function genPath(path, index) {
|
|
|
2385
2362
|
return path ? `${path}-${index}` : `${index}`;
|
|
2386
2363
|
}
|
|
2387
2364
|
function ExprGroupRender({ value, readonly, singleTag, enableNot, className, exprGroupRenderContentItemsClassName, style, path, leftRender, operatorRender, rightRender, allowLogicOperators, maxNestingDepth, elementSize = 'default', logicToggleReadonly, onExprChange, onExprGroupChange, onAddItem, onAddGroup, onDeleteExpr, onDeleteExprGroup, errorMsgRender }) {
|
|
2388
|
-
const I18n = useI18n();
|
|
2389
2365
|
const isEdit = !readonly;
|
|
2390
2366
|
const patchExpr = (expr)=>{
|
|
2391
2367
|
if (!value) return;
|
|
@@ -2418,7 +2394,7 @@ function ExprGroupRender({ value, readonly, singleTag, enableNot, className, exp
|
|
|
2418
2394
|
type: "primary",
|
|
2419
2395
|
children: /*#__PURE__*/ jsx("span", {
|
|
2420
2396
|
className: "text-brand-9 text-[14px] leading-[20px]",
|
|
2421
|
-
children:
|
|
2397
|
+
children: i18n_I18n.t('logic_expr_add_filter')
|
|
2422
2398
|
})
|
|
2423
2399
|
}),
|
|
2424
2400
|
showAddGroupButton ? /*#__PURE__*/ jsxs(Fragment, {
|
|
@@ -2429,7 +2405,7 @@ function ExprGroupRender({ value, readonly, singleTag, enableNot, className, exp
|
|
|
2429
2405
|
/*#__PURE__*/ jsx(ToolButton, {
|
|
2430
2406
|
icon: /*#__PURE__*/ jsx(IconCozPlusCircle, {}),
|
|
2431
2407
|
onClick: ()=>onAddGroup?.(path),
|
|
2432
|
-
children:
|
|
2408
|
+
children: i18n_I18n.t('logic_expr_add_filter_group')
|
|
2433
2409
|
})
|
|
2434
2410
|
]
|
|
2435
2411
|
}) : null
|
|
@@ -2705,85 +2681,85 @@ function findFieldByPath(fields, fieldPaths) {
|
|
|
2705
2681
|
});
|
|
2706
2682
|
return field;
|
|
2707
2683
|
}
|
|
2708
|
-
const stringOperations = [
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
];
|
|
2726
|
-
const numberOperations = [
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
];
|
|
2752
|
-
const dateOperations = [
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
];
|
|
2770
|
-
const selectOperations = [
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
];
|
|
2684
|
+
const stringOperations = ()=>[
|
|
2685
|
+
{
|
|
2686
|
+
label: i18n_I18n.t('contain'),
|
|
2687
|
+
value: 'like'
|
|
2688
|
+
},
|
|
2689
|
+
{
|
|
2690
|
+
label: i18n_I18n.t('not_contain'),
|
|
2691
|
+
value: 'not-like'
|
|
2692
|
+
},
|
|
2693
|
+
{
|
|
2694
|
+
label: i18n_I18n.t('equal_to'),
|
|
2695
|
+
value: 'equals'
|
|
2696
|
+
},
|
|
2697
|
+
{
|
|
2698
|
+
label: i18n_I18n.t('not_equal_to'),
|
|
2699
|
+
value: 'not-equals'
|
|
2700
|
+
}
|
|
2701
|
+
];
|
|
2702
|
+
const numberOperations = ()=>[
|
|
2703
|
+
{
|
|
2704
|
+
label: i18n_I18n.t('equal_to'),
|
|
2705
|
+
value: 'equals'
|
|
2706
|
+
},
|
|
2707
|
+
{
|
|
2708
|
+
label: i18n_I18n.t('not_equal_to'),
|
|
2709
|
+
value: 'not-equals'
|
|
2710
|
+
},
|
|
2711
|
+
{
|
|
2712
|
+
label: i18n_I18n.t('greater_than'),
|
|
2713
|
+
value: 'greater-than'
|
|
2714
|
+
},
|
|
2715
|
+
{
|
|
2716
|
+
label: i18n_I18n.t('task_filter_gte'),
|
|
2717
|
+
value: 'greater-than-equals'
|
|
2718
|
+
},
|
|
2719
|
+
{
|
|
2720
|
+
label: i18n_I18n.t('less_than'),
|
|
2721
|
+
value: 'less-than'
|
|
2722
|
+
},
|
|
2723
|
+
{
|
|
2724
|
+
label: i18n_I18n.t('task_filter_lte'),
|
|
2725
|
+
value: 'less-than-equals'
|
|
2726
|
+
}
|
|
2727
|
+
];
|
|
2728
|
+
const dateOperations = ()=>[
|
|
2729
|
+
{
|
|
2730
|
+
label: i18n_I18n.t('equal_to'),
|
|
2731
|
+
value: 'equals'
|
|
2732
|
+
},
|
|
2733
|
+
{
|
|
2734
|
+
label: i18n_I18n.t('not_equal_to'),
|
|
2735
|
+
value: 'not-equals'
|
|
2736
|
+
},
|
|
2737
|
+
{
|
|
2738
|
+
label: i18n_I18n.t('later_than'),
|
|
2739
|
+
value: 'greater-than'
|
|
2740
|
+
},
|
|
2741
|
+
{
|
|
2742
|
+
label: i18n_I18n.t('earlier_than'),
|
|
2743
|
+
value: 'less-than'
|
|
2744
|
+
}
|
|
2745
|
+
];
|
|
2746
|
+
const selectOperations = ()=>[
|
|
2747
|
+
{
|
|
2748
|
+
label: i18n_I18n.t('contain'),
|
|
2749
|
+
value: 'contains'
|
|
2750
|
+
},
|
|
2751
|
+
{
|
|
2752
|
+
label: i18n_I18n.t('not_contain'),
|
|
2753
|
+
value: 'not-contains'
|
|
2754
|
+
}
|
|
2755
|
+
];
|
|
2780
2756
|
function StringSetter({ textAreaMode = true, ...props }) {
|
|
2781
2757
|
if (false === textAreaMode) return /*#__PURE__*/ jsx(Input, {
|
|
2782
|
-
placeholder:
|
|
2758
|
+
placeholder: i18n_I18n.t('please_enter'),
|
|
2783
2759
|
...props
|
|
2784
2760
|
});
|
|
2785
2761
|
return /*#__PURE__*/ jsx(TextArea, {
|
|
2786
|
-
placeholder:
|
|
2762
|
+
placeholder: i18n_I18n.t('please_enter'),
|
|
2787
2763
|
rows: 1,
|
|
2788
2764
|
...props
|
|
2789
2765
|
});
|
|
@@ -2791,7 +2767,7 @@ function StringSetter({ textAreaMode = true, ...props }) {
|
|
|
2791
2767
|
function NumberSetter(props) {
|
|
2792
2768
|
const { value, onChange, ...rest } = props;
|
|
2793
2769
|
return /*#__PURE__*/ jsx(CozInputNumber, {
|
|
2794
|
-
placeholder:
|
|
2770
|
+
placeholder: i18n_I18n.t('please_enter'),
|
|
2795
2771
|
...rest,
|
|
2796
2772
|
className: `w-full ${props.className ?? ''}`,
|
|
2797
2773
|
value: value ?? '',
|
|
@@ -2809,7 +2785,7 @@ function DateSetter(props) {
|
|
|
2809
2785
|
function SelectSetter(props) {
|
|
2810
2786
|
const { value, onChange, optionList = [], className = '', ...rest } = props;
|
|
2811
2787
|
return /*#__PURE__*/ jsx(Select, {
|
|
2812
|
-
placeholder:
|
|
2788
|
+
placeholder: i18n_I18n.t('please_select'),
|
|
2813
2789
|
...rest,
|
|
2814
2790
|
className: `w-full ${className}`,
|
|
2815
2791
|
optionList: optionList,
|
|
@@ -2817,33 +2793,40 @@ function SelectSetter(props) {
|
|
|
2817
2793
|
onChange: (val)=>onChange(val)
|
|
2818
2794
|
});
|
|
2819
2795
|
}
|
|
2820
|
-
|
|
2821
|
-
{
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2796
|
+
function useDataTypeList() {
|
|
2797
|
+
const [state] = useState(()=>{
|
|
2798
|
+
const dataTypeList = [
|
|
2799
|
+
{
|
|
2800
|
+
type: 'string',
|
|
2801
|
+
operations: stringOperations(),
|
|
2802
|
+
setter: StringSetter
|
|
2803
|
+
},
|
|
2804
|
+
{
|
|
2805
|
+
type: 'number',
|
|
2806
|
+
operations: numberOperations(),
|
|
2807
|
+
setter: NumberSetter
|
|
2808
|
+
},
|
|
2809
|
+
{
|
|
2810
|
+
type: 'date',
|
|
2811
|
+
operations: dateOperations(),
|
|
2812
|
+
setter: DateSetter
|
|
2813
|
+
},
|
|
2814
|
+
{
|
|
2815
|
+
type: 'options',
|
|
2816
|
+
operations: selectOperations(),
|
|
2817
|
+
setter: SelectSetter
|
|
2818
|
+
}
|
|
2819
|
+
];
|
|
2820
|
+
return dataTypeList;
|
|
2821
|
+
});
|
|
2822
|
+
return state;
|
|
2823
|
+
}
|
|
2842
2824
|
function RightRender(props) {
|
|
2843
2825
|
const { expr, onExprChange, fields, disabled = false } = props;
|
|
2844
2826
|
const field = findFieldByPath(fields, expr.left);
|
|
2845
2827
|
if (!field) return null;
|
|
2846
2828
|
if ('is-empty' === expr.operator || 'is-not-empty' === expr.operator) return null;
|
|
2829
|
+
const dataTypeList = useDataTypeList();
|
|
2847
2830
|
const Setter = field?.setter || dataTypeList.find((dataType)=>dataType.type === field.type)?.setter;
|
|
2848
2831
|
if (!Setter) return null;
|
|
2849
2832
|
return /*#__PURE__*/ jsx("div", {
|
|
@@ -2866,6 +2849,7 @@ function RightRender(props) {
|
|
|
2866
2849
|
function OperatorRender(props) {
|
|
2867
2850
|
const { expr, onExprChange, fields, disabled = false } = props;
|
|
2868
2851
|
const field = findFieldByPath(fields, expr.left);
|
|
2852
|
+
const dataTypeList = useDataTypeList();
|
|
2869
2853
|
const dataType = dataTypeList.find((item)=>item.type === field?.type);
|
|
2870
2854
|
if (!field) return null;
|
|
2871
2855
|
const { disabledOperations = [], customOperations } = field;
|
|
@@ -2875,7 +2859,7 @@ function OperatorRender(props) {
|
|
|
2875
2859
|
return /*#__PURE__*/ jsx("div", {
|
|
2876
2860
|
className: "w-24",
|
|
2877
2861
|
children: /*#__PURE__*/ jsx(Select, {
|
|
2878
|
-
placeholder:
|
|
2862
|
+
placeholder: i18n_I18n.t('operator'),
|
|
2879
2863
|
value: expr.operator,
|
|
2880
2864
|
style: {
|
|
2881
2865
|
width: '100%'
|
|
@@ -2900,10 +2884,11 @@ function fieldsToOptions(fields) {
|
|
|
2900
2884
|
}
|
|
2901
2885
|
function LeftRender(props) {
|
|
2902
2886
|
const { expr, onExprChange, fields, disabled, enableCascadeMode } = props;
|
|
2887
|
+
const dataTypeList = useDataTypeList();
|
|
2903
2888
|
if (enableCascadeMode) return /*#__PURE__*/ jsx("div", {
|
|
2904
2889
|
className: "w-56",
|
|
2905
2890
|
children: /*#__PURE__*/ jsx(Cascader, {
|
|
2906
|
-
placeholder:
|
|
2891
|
+
placeholder: i18n_I18n.t('please_select'),
|
|
2907
2892
|
value: expr.left,
|
|
2908
2893
|
className: "w-full",
|
|
2909
2894
|
disabled: disabled,
|
|
@@ -2930,7 +2915,7 @@ function LeftRender(props) {
|
|
|
2930
2915
|
return /*#__PURE__*/ jsx("div", {
|
|
2931
2916
|
className: "w-40",
|
|
2932
2917
|
children: /*#__PURE__*/ jsx(Select, {
|
|
2933
|
-
placeholder:
|
|
2918
|
+
placeholder: i18n_I18n.t('please_select'),
|
|
2934
2919
|
value: expr.left,
|
|
2935
2920
|
className: "w-full",
|
|
2936
2921
|
disabled: disabled,
|
|
@@ -3017,7 +3002,7 @@ function LogicEditor({ fields = [], disabled = false, value, popoverProps = {},
|
|
|
3017
3002
|
children: [
|
|
3018
3003
|
/*#__PURE__*/ jsx("div", {
|
|
3019
3004
|
className: "font-medium",
|
|
3020
|
-
children:
|
|
3005
|
+
children: i18n_I18n.t('filter')
|
|
3021
3006
|
}),
|
|
3022
3007
|
tooltip ? /*#__PURE__*/ jsx(Tooltip, {
|
|
3023
3008
|
theme: "dark",
|
|
@@ -3032,7 +3017,7 @@ function LogicEditor({ fields = [], disabled = false, value, popoverProps = {},
|
|
|
3032
3017
|
setLogicFilter(void 0);
|
|
3033
3018
|
onChange?.(void 0);
|
|
3034
3019
|
},
|
|
3035
|
-
children:
|
|
3020
|
+
children: i18n_I18n.t('clear_filter')
|
|
3036
3021
|
})
|
|
3037
3022
|
]
|
|
3038
3023
|
}),
|
|
@@ -3057,7 +3042,7 @@ function LogicEditor({ fields = [], disabled = false, value, popoverProps = {},
|
|
|
3057
3042
|
setVisible(false);
|
|
3058
3043
|
onClose?.();
|
|
3059
3044
|
},
|
|
3060
|
-
children:
|
|
3045
|
+
children: i18n_I18n.t('apply')
|
|
3061
3046
|
})
|
|
3062
3047
|
})
|
|
3063
3048
|
]
|
|
@@ -3084,7 +3069,7 @@ function LogicEditor({ fields = [], disabled = false, value, popoverProps = {},
|
|
|
3084
3069
|
icon: /*#__PURE__*/ jsx(IconCozFilter, {}),
|
|
3085
3070
|
color: "primary",
|
|
3086
3071
|
children: [
|
|
3087
|
-
|
|
3072
|
+
i18n_I18n.t('filter'),
|
|
3088
3073
|
count ? /*#__PURE__*/ jsx("div", {
|
|
3089
3074
|
className: "flex items-center justify-center w-5 h-5 rounded-[50%] text-brand-9 bg-brand-4 ml-1 text-[13px]",
|
|
3090
3075
|
children: count
|
|
@@ -3095,7 +3080,7 @@ function LogicEditor({ fields = [], disabled = false, value, popoverProps = {},
|
|
|
3095
3080
|
}
|
|
3096
3081
|
loader.config({
|
|
3097
3082
|
paths: {
|
|
3098
|
-
vs:
|
|
3083
|
+
vs: "https://unpkg.com/monaco-editor@0.43.0/min/vs"
|
|
3099
3084
|
}
|
|
3100
3085
|
});
|
|
3101
3086
|
const BasicCard = ({ title, children, className })=>/*#__PURE__*/ jsxs("div", {
|
|
@@ -3155,23 +3140,23 @@ var type_ImageStatus = /*#__PURE__*/ function(ImageStatus) {
|
|
|
3155
3140
|
ImageStatus["Error"] = "error";
|
|
3156
3141
|
return ImageStatus;
|
|
3157
3142
|
}({});
|
|
3158
|
-
const
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
};
|
|
3143
|
+
const getErrorTypeMap = ()=>({
|
|
3144
|
+
[ItemErrorType.MismatchSchema]: i18n_I18n.t('schema_mismatch'),
|
|
3145
|
+
[ItemErrorType.EmptyData]: i18n_I18n.t('empty_data'),
|
|
3146
|
+
[ItemErrorType.ExceedMaxItemSize]: i18n_I18n.t('single_data_size_exceeded'),
|
|
3147
|
+
[ItemErrorType.ExceedDatasetCapacity]: i18n_I18n.t('dataset_capacity_exceeded'),
|
|
3148
|
+
[ItemErrorType.MalformedFile]: i18n_I18n.t('file_format_error'),
|
|
3149
|
+
[ItemErrorType.InternalError]: i18n_I18n.t('system_error'),
|
|
3150
|
+
[ItemErrorType.IllegalContent]: i18n_I18n.t('contains_illegal_content'),
|
|
3151
|
+
[ItemErrorType.MissingRequiredField]: i18n_I18n.t('missing_required_field'),
|
|
3152
|
+
[ItemErrorType.ExceedMaxNestedDepth]: i18n_I18n.t('data_nesting_exceeds_limit'),
|
|
3153
|
+
[ItemErrorType.TransformItemFailed]: i18n_I18n.t('data_conversion_failed'),
|
|
3154
|
+
[ItemErrorType.ExceedMaxImageCount]: i18n_I18n.t('exceed_max_image_count'),
|
|
3155
|
+
[ItemErrorType.ExceedMaxImageSize]: i18n_I18n.t('exceed_max_image_size'),
|
|
3156
|
+
[ItemErrorType.GetImageFailed]: i18n_I18n.t('get_image_failed'),
|
|
3157
|
+
[ItemErrorType.IllegalExtension]: i18n_I18n.t('illegal_extension'),
|
|
3158
|
+
[ItemErrorType.UploadImageFailed]: i18n_I18n.t('cozeloop_open_evaluate_image_upload_failed')
|
|
3159
|
+
});
|
|
3175
3160
|
const UrlInputModal = ({ visible, onConfirm, onCancel, maxCount = 6, uploadImageUrl, uploadType = 'image', intranetUrlValidator })=>{
|
|
3176
3161
|
const [error, setError] = useState('');
|
|
3177
3162
|
const [isUploading, setIsUploading] = useState(false);
|
|
@@ -3187,7 +3172,7 @@ const UrlInputModal = ({ visible, onConfirm, onCancel, maxCount = 6, uploadImage
|
|
|
3187
3172
|
}
|
|
3188
3173
|
};
|
|
3189
3174
|
const handleUpload = async (formValues)=>{
|
|
3190
|
-
if (formValues?.urls?.length === 0) return void setError(
|
|
3175
|
+
if (formValues?.urls?.length === 0) return void setError(i18n_I18n.t('please_add_at_least_one_image_link'));
|
|
3191
3176
|
setIsUploading(true);
|
|
3192
3177
|
setError('');
|
|
3193
3178
|
try {
|
|
@@ -3195,7 +3180,7 @@ const UrlInputModal = ({ visible, onConfirm, onCancel, maxCount = 6, uploadImage
|
|
|
3195
3180
|
setUploadResults(results || []);
|
|
3196
3181
|
setIsUploaded(true);
|
|
3197
3182
|
} catch (err) {
|
|
3198
|
-
setError(
|
|
3183
|
+
setError(i18n_I18n.t('upload_failed_please_try_again'));
|
|
3199
3184
|
} finally{
|
|
3200
3185
|
setIsUploading(false);
|
|
3201
3186
|
}
|
|
@@ -3248,24 +3233,28 @@ const UrlInputModal = ({ visible, onConfirm, onCancel, maxCount = 6, uploadImage
|
|
|
3248
3233
|
/*#__PURE__*/ jsx(Form.Input, {
|
|
3249
3234
|
field: `urls[${idx}]`,
|
|
3250
3235
|
label: {
|
|
3251
|
-
text: `${'image' === uploadType ?
|
|
3236
|
+
text: `${'image' === uploadType ? i18n_I18n.t('image') : i18n_I18n.t('video')}${idx + 1}`,
|
|
3252
3237
|
required: true
|
|
3253
3238
|
},
|
|
3254
3239
|
fieldClassName: "flex-1",
|
|
3255
|
-
placeholder:
|
|
3240
|
+
placeholder: `${i18n_I18n.t('please_input_placeholder1_link_public', {
|
|
3241
|
+
placeholder1: 'image' === uploadType ? i18n_I18n.t('image') : i18n_I18n.t('video')
|
|
3242
|
+
})}`,
|
|
3256
3243
|
rules: [
|
|
3257
3244
|
{
|
|
3258
3245
|
validator: (_, value, cb)=>{
|
|
3259
3246
|
if (!value) {
|
|
3260
|
-
cb(
|
|
3247
|
+
cb(`${i18n_I18n.t('please_input_placeholder1_link', {
|
|
3248
|
+
placeholder1: 'image' === uploadType ? i18n_I18n.t('image') : i18n_I18n.t('video')
|
|
3249
|
+
})}`);
|
|
3261
3250
|
return false;
|
|
3262
3251
|
}
|
|
3263
3252
|
if (intranetUrlValidator && intranetUrlValidator(value)) {
|
|
3264
|
-
cb(
|
|
3253
|
+
cb(i18n_I18n.t('please_use_public_domain'));
|
|
3265
3254
|
return false;
|
|
3266
3255
|
}
|
|
3267
3256
|
if (!validateUrl(value)) {
|
|
3268
|
-
cb(
|
|
3257
|
+
cb(i18n_I18n.t('please_enter_a_valid_url'));
|
|
3269
3258
|
return false;
|
|
3270
3259
|
}
|
|
3271
3260
|
return true;
|
|
@@ -3298,7 +3287,7 @@ const UrlInputModal = ({ visible, onConfirm, onCancel, maxCount = 6, uploadImage
|
|
|
3298
3287
|
]),
|
|
3299
3288
|
className: "mt-2",
|
|
3300
3289
|
children: [
|
|
3301
|
-
|
|
3290
|
+
i18n_I18n.t('space_member_role_type_add_btn'),
|
|
3302
3291
|
/*#__PURE__*/ jsx(Typography.Text, {
|
|
3303
3292
|
className: "ml-1",
|
|
3304
3293
|
type: "secondary",
|
|
@@ -3316,7 +3305,7 @@ const UrlInputModal = ({ visible, onConfirm, onCancel, maxCount = 6, uploadImage
|
|
|
3316
3305
|
});
|
|
3317
3306
|
const columns = [
|
|
3318
3307
|
{
|
|
3319
|
-
title:
|
|
3308
|
+
title: i18n_I18n.t('image_address'),
|
|
3320
3309
|
dataIndex: 'originImage.url',
|
|
3321
3310
|
width: 220,
|
|
3322
3311
|
ellipsis: {
|
|
@@ -3324,7 +3313,7 @@ const UrlInputModal = ({ visible, onConfirm, onCancel, maxCount = 6, uploadImage
|
|
|
3324
3313
|
}
|
|
3325
3314
|
},
|
|
3326
3315
|
{
|
|
3327
|
-
title:
|
|
3316
|
+
title: i18n_I18n.t('image_preview'),
|
|
3328
3317
|
dataIndex: 'originImage.url',
|
|
3329
3318
|
width: 120,
|
|
3330
3319
|
render: (url)=>/*#__PURE__*/ jsx(Image, {
|
|
@@ -3337,7 +3326,7 @@ const UrlInputModal = ({ visible, onConfirm, onCancel, maxCount = 6, uploadImage
|
|
|
3337
3326
|
})
|
|
3338
3327
|
},
|
|
3339
3328
|
{
|
|
3340
|
-
title:
|
|
3329
|
+
title: i18n_I18n.t('status'),
|
|
3341
3330
|
key: 'status',
|
|
3342
3331
|
align: 'left',
|
|
3343
3332
|
width: 200,
|
|
@@ -3347,12 +3336,12 @@ const UrlInputModal = ({ visible, onConfirm, onCancel, maxCount = 6, uploadImage
|
|
|
3347
3336
|
/*#__PURE__*/ jsx(Tag, {
|
|
3348
3337
|
prefixIcon: record?.errorType ? /*#__PURE__*/ jsx(IconCozCrossCircleFill, {}) : /*#__PURE__*/ jsx(IconCozCheckMarkCircleFill, {}),
|
|
3349
3338
|
color: record?.errorType ? 'red' : 'green',
|
|
3350
|
-
children: record?.errorType ?
|
|
3339
|
+
children: record?.errorType ? i18n_I18n.t('failure') : i18n_I18n.t('success')
|
|
3351
3340
|
}),
|
|
3352
3341
|
/*#__PURE__*/ jsx(Typography.Text, {
|
|
3353
3342
|
type: "secondary",
|
|
3354
3343
|
className: "ml-1",
|
|
3355
|
-
children: record.errorType ?
|
|
3344
|
+
children: record.errorType ? getErrorTypeMap()[record.errorType] : ''
|
|
3356
3345
|
})
|
|
3357
3346
|
]
|
|
3358
3347
|
})
|
|
@@ -3371,13 +3360,15 @@ const UrlInputModal = ({ visible, onConfirm, onCancel, maxCount = 6, uploadImage
|
|
|
3371
3360
|
})
|
|
3372
3361
|
});
|
|
3373
3362
|
const getConfirmButtonText = ()=>{
|
|
3374
|
-
if (!uploadImageUrl) return
|
|
3375
|
-
if (isUploading) return
|
|
3376
|
-
if (isUploaded) return
|
|
3377
|
-
return
|
|
3363
|
+
if (!uploadImageUrl) return i18n_I18n.t('global_btn_confirm');
|
|
3364
|
+
if (isUploading) return i18n_I18n.t('cozeloop_open_evaluate_uploading');
|
|
3365
|
+
if (isUploaded) return `${i18n_I18n.t('import')}${'image' === uploadType ? i18n_I18n.t('image') : i18n_I18n.t('video')}`;
|
|
3366
|
+
return i18n_I18n.t('upload');
|
|
3378
3367
|
};
|
|
3379
3368
|
return /*#__PURE__*/ jsxs(Modal, {
|
|
3380
|
-
title:
|
|
3369
|
+
title: `${i18n_I18n.t('add_placeholder1_link', {
|
|
3370
|
+
placeholder1: 'image' === uploadType ? i18n_I18n.t('image') : i18n_I18n.t('video')
|
|
3371
|
+
})}`,
|
|
3381
3372
|
visible: visible,
|
|
3382
3373
|
onCancel: handleCancel,
|
|
3383
3374
|
width: 640,
|
|
@@ -3387,7 +3378,7 @@ const UrlInputModal = ({ visible, onConfirm, onCancel, maxCount = 6, uploadImage
|
|
|
3387
3378
|
/*#__PURE__*/ jsx(Button, {
|
|
3388
3379
|
onClick: handleCancel,
|
|
3389
3380
|
color: "primary",
|
|
3390
|
-
children:
|
|
3381
|
+
children: i18n_I18n.t('cancel')
|
|
3391
3382
|
}),
|
|
3392
3383
|
/*#__PURE__*/ jsx(Button, {
|
|
3393
3384
|
type: "primary",
|
|
@@ -3406,7 +3397,7 @@ const UrlInputModal = ({ visible, onConfirm, onCancel, maxCount = 6, uploadImage
|
|
|
3406
3397
|
}),
|
|
3407
3398
|
/*#__PURE__*/ jsx("span", {
|
|
3408
3399
|
className: "ml-2",
|
|
3409
|
-
children:
|
|
3400
|
+
children: i18n_I18n.t('cozeloop_open_evaluate_uploading_image')
|
|
3410
3401
|
})
|
|
3411
3402
|
]
|
|
3412
3403
|
}) : null,
|
|
@@ -3508,10 +3499,10 @@ const VideoItemRenderer = ({ className, style, spaceID, item, onRemove, onChange
|
|
|
3508
3499
|
}),
|
|
3509
3500
|
status === type_ImageStatus.Error ? /*#__PURE__*/ jsx("div", {
|
|
3510
3501
|
className: "text-sm text-red-500",
|
|
3511
|
-
children:
|
|
3502
|
+
children: i18n_I18n.t('upload_fail')
|
|
3512
3503
|
}) : null,
|
|
3513
3504
|
/*#__PURE__*/ jsx(Modal, {
|
|
3514
|
-
title:
|
|
3505
|
+
title: i18n_I18n.t('video_preview'),
|
|
3515
3506
|
footer: null,
|
|
3516
3507
|
visible: visible,
|
|
3517
3508
|
onCancel: ()=>setVisible(false),
|
|
@@ -3629,7 +3620,7 @@ const ImageItemRenderer = ({ className, style, spaceID, item, onRemove, onChange
|
|
|
3629
3620
|
}),
|
|
3630
3621
|
status === type_ImageStatus.Error && /*#__PURE__*/ jsx("div", {
|
|
3631
3622
|
className: "text-sm text-red-500",
|
|
3632
|
-
children:
|
|
3623
|
+
children: i18n_I18n.t('upload_fail')
|
|
3633
3624
|
})
|
|
3634
3625
|
]
|
|
3635
3626
|
});
|
|
@@ -3654,7 +3645,7 @@ const MultipartItemRenderer = ({ item, readonly, onChange, onRemove })=>{
|
|
|
3654
3645
|
maxRows: 3
|
|
3655
3646
|
},
|
|
3656
3647
|
disabled: readonly,
|
|
3657
|
-
placeholder:
|
|
3648
|
+
placeholder: i18n_I18n.t('please_input_text')
|
|
3658
3649
|
}),
|
|
3659
3650
|
readonly ? null : /*#__PURE__*/ jsx(Button, {
|
|
3660
3651
|
icon: /*#__PURE__*/ jsx(IconCozTrashCan, {}),
|
|
@@ -3857,12 +3848,16 @@ const MultipartEditor = ({ spaceID, uploadFile, value, onChange, className, mult
|
|
|
3857
3848
|
};
|
|
3858
3849
|
const getDisabledTooltip = useCallback(({ type, exceed, disabled })=>{
|
|
3859
3850
|
if (type === ContentType.Image) {
|
|
3860
|
-
if (exceed) return
|
|
3861
|
-
|
|
3851
|
+
if (exceed) return `${i18n_I18n.t('multi_modal_image_limit_reached', {
|
|
3852
|
+
canUseFileLimit
|
|
3853
|
+
})}`;
|
|
3854
|
+
if (disabled) return i18n_I18n.t('model_not_support_multi_modal_image');
|
|
3862
3855
|
} else {
|
|
3863
|
-
if ('Video' !== type) return
|
|
3864
|
-
if (exceed) return
|
|
3865
|
-
|
|
3856
|
+
if ('Video' !== type) return i18n_I18n.t('model_not_support_multi_modal');
|
|
3857
|
+
if (exceed) return `${i18n_I18n.t('multi_modal_video_limit_reached', {
|
|
3858
|
+
canUseFileLimit
|
|
3859
|
+
})}`;
|
|
3860
|
+
if (disabled) return i18n_I18n.t('model_not_support_multi_modal_video');
|
|
3866
3861
|
}
|
|
3867
3862
|
}, []);
|
|
3868
3863
|
const renderImageSubMenu = useCallback((children)=>/*#__PURE__*/ jsx(TooltipWhenDisabled, {
|
|
@@ -3899,14 +3894,14 @@ const MultipartEditor = ({ spaceID, uploadFile, value, onChange, className, mult
|
|
|
3899
3894
|
/*#__PURE__*/ jsx(Menu.Item, {
|
|
3900
3895
|
onClick: handleAddText,
|
|
3901
3896
|
disabled: imageCount >= maxPartCount,
|
|
3902
|
-
children:
|
|
3897
|
+
children: i18n_I18n.t('text')
|
|
3903
3898
|
}),
|
|
3904
3899
|
imageHidden ? null : /*#__PURE__*/ jsx(Menu.Item, {
|
|
3905
3900
|
onClick: handleAddImageFile,
|
|
3906
3901
|
disabled: exceedFileCount || !imageEnabled,
|
|
3907
3902
|
children: renderImageSubMenu(/*#__PURE__*/ jsx("span", {
|
|
3908
3903
|
className: "w-full",
|
|
3909
|
-
children:
|
|
3904
|
+
children: i18n_I18n.t('image_source_file')
|
|
3910
3905
|
}))
|
|
3911
3906
|
}),
|
|
3912
3907
|
imageHidden ? null : /*#__PURE__*/ jsx(Menu.Item, {
|
|
@@ -3914,7 +3909,7 @@ const MultipartEditor = ({ spaceID, uploadFile, value, onChange, className, mult
|
|
|
3914
3909
|
disabled: exceedFileCount || !imageEnabled,
|
|
3915
3910
|
children: renderImageSubMenu(/*#__PURE__*/ jsx("span", {
|
|
3916
3911
|
className: "w-full",
|
|
3917
|
-
children:
|
|
3912
|
+
children: i18n_I18n.t('image_external_link')
|
|
3918
3913
|
}))
|
|
3919
3914
|
}),
|
|
3920
3915
|
videoHidden ? null : /*#__PURE__*/ jsx(Menu.Item, {
|
|
@@ -3922,7 +3917,7 @@ const MultipartEditor = ({ spaceID, uploadFile, value, onChange, className, mult
|
|
|
3922
3917
|
disabled: exceedFileCount || !videoEnabled,
|
|
3923
3918
|
children: renderVideoSubMenu(/*#__PURE__*/ jsx("span", {
|
|
3924
3919
|
className: "w-full",
|
|
3925
|
-
children:
|
|
3920
|
+
children: i18n_I18n.t('video_source_file')
|
|
3926
3921
|
}))
|
|
3927
3922
|
}),
|
|
3928
3923
|
videoHidden ? null : /*#__PURE__*/ jsx(Menu.Item, {
|
|
@@ -3930,7 +3925,7 @@ const MultipartEditor = ({ spaceID, uploadFile, value, onChange, className, mult
|
|
|
3930
3925
|
disabled: exceedFileCount || !videoEnabled,
|
|
3931
3926
|
children: renderVideoSubMenu(/*#__PURE__*/ jsx("span", {
|
|
3932
3927
|
className: "w-full",
|
|
3933
|
-
children:
|
|
3928
|
+
children: i18n_I18n.t('video_external_link')
|
|
3934
3929
|
}))
|
|
3935
3930
|
})
|
|
3936
3931
|
]
|
|
@@ -4011,7 +4006,7 @@ const MultipartEditor = ({ spaceID, uploadFile, value, onChange, className, mult
|
|
|
4011
4006
|
color: "primary",
|
|
4012
4007
|
disabled: true,
|
|
4013
4008
|
children: [
|
|
4014
|
-
|
|
4009
|
+
i18n_I18n.t('add_data'),
|
|
4015
4010
|
/*#__PURE__*/ jsx(Typography.Text, {
|
|
4016
4011
|
className: "ml-1 !text-inherit",
|
|
4017
4012
|
type: "secondary",
|
|
@@ -4030,7 +4025,7 @@ const MultipartEditor = ({ spaceID, uploadFile, value, onChange, className, mult
|
|
|
4030
4025
|
color: "primary",
|
|
4031
4026
|
disabled: items.length >= maxPartCount,
|
|
4032
4027
|
children: [
|
|
4033
|
-
|
|
4028
|
+
i18n_I18n.t('add_data'),
|
|
4034
4029
|
/*#__PURE__*/ jsx(Typography.Text, {
|
|
4035
4030
|
className: "ml-1",
|
|
4036
4031
|
type: "secondary",
|
|
@@ -4044,7 +4039,7 @@ const MultipartEditor = ({ spaceID, uploadFile, value, onChange, className, mult
|
|
|
4044
4039
|
action: "",
|
|
4045
4040
|
maxSize: maxFileSize,
|
|
4046
4041
|
onSizeError: ()=>{
|
|
4047
|
-
Toast.error(
|
|
4042
|
+
Toast.error(i18n_I18n.t('cozeloop_open_evaluate_image_size_limit_20mb'));
|
|
4048
4043
|
},
|
|
4049
4044
|
accept: supportedFormats,
|
|
4050
4045
|
customRequest: handleUploadFile,
|
|
@@ -4055,7 +4050,7 @@ const MultipartEditor = ({ spaceID, uploadFile, value, onChange, className, mult
|
|
|
4055
4050
|
multiple: true,
|
|
4056
4051
|
limit: canUseFileLimit > canUsePartLimit ? canUsePartLimit : canUseFileLimit,
|
|
4057
4052
|
onExceed: ()=>{
|
|
4058
|
-
Toast.error(
|
|
4053
|
+
Toast.error(i18n_I18n.t('image_or_node_quantity_limit'));
|
|
4059
4054
|
}
|
|
4060
4055
|
}),
|
|
4061
4056
|
showUrlModal ? /*#__PURE__*/ jsx(UrlInputModal, {
|
|
@@ -4135,7 +4130,7 @@ const UploadButton = /*#__PURE__*/ forwardRef(({ spaceID, disabled, maxImageSize
|
|
|
4135
4130
|
onFilePartsChange?.(newPart);
|
|
4136
4131
|
} catch (error) {
|
|
4137
4132
|
console.info('error', error);
|
|
4138
|
-
Toast.error(
|
|
4133
|
+
Toast.error(i18n_I18n.t('image_upload_error'));
|
|
4139
4134
|
onFilePartsChange?.({
|
|
4140
4135
|
...part,
|
|
4141
4136
|
status: 'uploadFail'
|
|
@@ -4151,8 +4146,12 @@ const UploadButton = /*#__PURE__*/ forwardRef(({ spaceID, disabled, maxImageSize
|
|
|
4151
4146
|
showUploadList: false,
|
|
4152
4147
|
maxSize: maxImageSize ? 1024 * maxImageSize * 1024 : 0,
|
|
4153
4148
|
limit: fileLimit,
|
|
4154
|
-
onSizeError: ()=>Toast.error(
|
|
4155
|
-
|
|
4149
|
+
onSizeError: ()=>Toast.error(`${i18n_I18n.t('image_size_exceed_max', {
|
|
4150
|
+
maxImageSize
|
|
4151
|
+
})}`),
|
|
4152
|
+
onExceed: ()=>Toast.warning(`${i18n_I18n.t('max_upload_images_limit', {
|
|
4153
|
+
maxFileCount
|
|
4154
|
+
})}`),
|
|
4156
4155
|
multiple: true,
|
|
4157
4156
|
fileList: fileParts.map((it)=>({
|
|
4158
4157
|
uid: it.uid || '',
|
|
@@ -4176,8 +4175,12 @@ const UploadButton = /*#__PURE__*/ forwardRef(({ spaceID, disabled, maxImageSize
|
|
|
4176
4175
|
showUploadList: false,
|
|
4177
4176
|
maxSize: maxVideoSize ? 1024 * maxVideoSize : 0,
|
|
4178
4177
|
limit: fileLimit,
|
|
4179
|
-
onSizeError: ()=>Toast.error(
|
|
4180
|
-
|
|
4178
|
+
onSizeError: ()=>Toast.error(`${i18n_I18n.t('video_size_exceed_max', {
|
|
4179
|
+
maxVideoSize
|
|
4180
|
+
})}`),
|
|
4181
|
+
onExceed: ()=>Toast.warning(`${i18n_I18n.t('max_upload_videos_limit', {
|
|
4182
|
+
maxFileCount
|
|
4183
|
+
})}`),
|
|
4181
4184
|
multiple: true,
|
|
4182
4185
|
fileList: fileParts.map((it)=>({
|
|
4183
4186
|
uid: it.uid || '',
|
|
@@ -4203,14 +4206,14 @@ const UploadButton = /*#__PURE__*/ forwardRef(({ spaceID, disabled, maxImageSize
|
|
|
4203
4206
|
color: "primary",
|
|
4204
4207
|
disabled: disabled,
|
|
4205
4208
|
"data-btm": "d41383",
|
|
4206
|
-
"data-btm-title":
|
|
4209
|
+
"data-btm-title": i18n_I18n.t('image_upload')
|
|
4207
4210
|
}));
|
|
4208
4211
|
if (!imageEnabled && videoEnabled) return renderVideoUpload(/*#__PURE__*/ jsx(IconButton, {
|
|
4209
4212
|
icon: /*#__PURE__*/ jsx(IconCozVideo, {}),
|
|
4210
4213
|
color: "primary",
|
|
4211
4214
|
disabled: disabled,
|
|
4212
4215
|
"data-btm": "d27622",
|
|
4213
|
-
"data-btm-title":
|
|
4216
|
+
"data-btm-title": i18n_I18n.t('video_upload')
|
|
4214
4217
|
}));
|
|
4215
4218
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
4216
4219
|
children: [
|
|
@@ -4223,16 +4226,16 @@ const UploadButton = /*#__PURE__*/ forwardRef(({ spaceID, disabled, maxImageSize
|
|
|
4223
4226
|
uploadImgRef.current?.openFileDialog();
|
|
4224
4227
|
},
|
|
4225
4228
|
"data-btm": "d41383",
|
|
4226
|
-
"data-btm-title":
|
|
4227
|
-
children:
|
|
4229
|
+
"data-btm-title": i18n_I18n.t('image_upload'),
|
|
4230
|
+
children: i18n_I18n.t('image_upload')
|
|
4228
4231
|
}),
|
|
4229
4232
|
/*#__PURE__*/ jsx(Menu.Item, {
|
|
4230
4233
|
onClick: ()=>{
|
|
4231
4234
|
uploadVideoRef.current?.openFileDialog();
|
|
4232
4235
|
},
|
|
4233
4236
|
"data-btm": "d27622",
|
|
4234
|
-
"data-btm-title":
|
|
4235
|
-
children:
|
|
4237
|
+
"data-btm-title": i18n_I18n.t('video_upload'),
|
|
4238
|
+
children: i18n_I18n.t('video_upload')
|
|
4236
4239
|
})
|
|
4237
4240
|
]
|
|
4238
4241
|
}),
|
|
@@ -4431,76 +4434,6 @@ function LoopRadioGroup({ className, ...props }) {
|
|
|
4431
4434
|
...props
|
|
4432
4435
|
});
|
|
4433
4436
|
}
|
|
4434
|
-
const code_item_module = {
|
|
4435
|
-
"usage-detail": "usage-detail-avIFhw",
|
|
4436
|
-
usageDetail: "usage-detail-avIFhw"
|
|
4437
|
-
};
|
|
4438
|
-
var code_usage_SupportedLang = /*#__PURE__*/ function(SupportedLang) {
|
|
4439
|
-
SupportedLang["Golang"] = "go";
|
|
4440
|
-
SupportedLang["Js"] = "javascript";
|
|
4441
|
-
SupportedLang["Python"] = "python";
|
|
4442
|
-
return SupportedLang;
|
|
4443
|
-
}({});
|
|
4444
|
-
const UsageContent = ({ content, copyable, lang = "javascript", height = 300 })=>/*#__PURE__*/ jsxs("div", {
|
|
4445
|
-
className: "bg-[var(--semi-color-fill-0)] p-[16px] rounded-[8px] text-[14px] flex",
|
|
4446
|
-
children: [
|
|
4447
|
-
/*#__PURE__*/ jsx("div", {
|
|
4448
|
-
className: "flex-1 whitespace-pre-wrap break-all",
|
|
4449
|
-
children: /*#__PURE__*/ jsx(_monaco_editor_react, {
|
|
4450
|
-
width: '100%',
|
|
4451
|
-
height: height,
|
|
4452
|
-
language: lang,
|
|
4453
|
-
value: content,
|
|
4454
|
-
theme: 'code-block-grey',
|
|
4455
|
-
options: {
|
|
4456
|
-
minimap: {
|
|
4457
|
-
enabled: false
|
|
4458
|
-
},
|
|
4459
|
-
wordWrap: 'on',
|
|
4460
|
-
scrollBeyondLastLine: false,
|
|
4461
|
-
unicodeHighlight: {
|
|
4462
|
-
ambiguousCharacters: false
|
|
4463
|
-
},
|
|
4464
|
-
lineNumbers: 'on',
|
|
4465
|
-
formatOnPaste: true,
|
|
4466
|
-
readOnly: true
|
|
4467
|
-
},
|
|
4468
|
-
beforeMount: (monaco)=>{
|
|
4469
|
-
monaco.editor.defineTheme('code-block-grey', {
|
|
4470
|
-
base: 'vs',
|
|
4471
|
-
inherit: true,
|
|
4472
|
-
rules: [],
|
|
4473
|
-
colors: {
|
|
4474
|
-
'editor.background': '#F4F4F4'
|
|
4475
|
-
}
|
|
4476
|
-
});
|
|
4477
|
-
}
|
|
4478
|
-
})
|
|
4479
|
-
}),
|
|
4480
|
-
/*#__PURE__*/ jsx("div", {
|
|
4481
|
-
className: "ml-[8px]",
|
|
4482
|
-
children: copyable ? /*#__PURE__*/ jsx(IconCozCopy, {
|
|
4483
|
-
className: "ml-[4px] text-[var(--coz-fg-dim)] cursor-pointer hover:coz-fg-primary",
|
|
4484
|
-
onClick: ()=>handleCopy(content || '')
|
|
4485
|
-
}) : null
|
|
4486
|
-
})
|
|
4487
|
-
]
|
|
4488
|
-
});
|
|
4489
|
-
const UsageItem = ({ title, content, lang, contentHeight })=>/*#__PURE__*/ jsxs("div", {
|
|
4490
|
-
className: code_item_module["usage-detail"],
|
|
4491
|
-
children: [
|
|
4492
|
-
/*#__PURE__*/ jsx("div", {
|
|
4493
|
-
className: "text-[#16px] font-[500] mb-4",
|
|
4494
|
-
children: title
|
|
4495
|
-
}),
|
|
4496
|
-
content ? /*#__PURE__*/ jsx(UsageContent, {
|
|
4497
|
-
content: content,
|
|
4498
|
-
copyable: true,
|
|
4499
|
-
lang: lang,
|
|
4500
|
-
height: contentHeight
|
|
4501
|
-
}) : null
|
|
4502
|
-
]
|
|
4503
|
-
});
|
|
4504
4437
|
const layout_index_module = {
|
|
4505
4438
|
tabs: "tabs-GNhC2M"
|
|
4506
4439
|
};
|
|
@@ -4535,78 +4468,6 @@ const Layout = {
|
|
|
4535
4468
|
Content: Content,
|
|
4536
4469
|
Tabs: tabs_Tabs
|
|
4537
4470
|
};
|
|
4538
|
-
const stringifyObjectValue = (value)=>Object.keys(value).reduce((acc, key)=>{
|
|
4539
|
-
const val = value[key];
|
|
4540
|
-
if ('object' == typeof val) acc[key] = JSON.stringify(val);
|
|
4541
|
-
else acc[key] = val;
|
|
4542
|
-
return acc;
|
|
4543
|
-
}, {});
|
|
4544
|
-
const parseObjectValue = (data)=>Object.keys(data).reduce((acc, key)=>{
|
|
4545
|
-
const value = data[key];
|
|
4546
|
-
if (value.startsWith('{') || value.startsWith('[')) acc[key] = safeJsonParse(value) || value;
|
|
4547
|
-
else acc[key] = value;
|
|
4548
|
-
return acc;
|
|
4549
|
-
}, {});
|
|
4550
|
-
const SearchForm = /*#__PURE__*/ forwardRef(({ className, children, onSearch, SemiForm, initValue = {} }, ref)=>{
|
|
4551
|
-
const formRef = useRef(null);
|
|
4552
|
-
const [initValueAndParams] = useState(()=>{
|
|
4553
|
-
const params = new URLSearchParams(window.location.search);
|
|
4554
|
-
const initParams = {};
|
|
4555
|
-
params.forEach((value, key)=>{
|
|
4556
|
-
initParams[key] = value;
|
|
4557
|
-
});
|
|
4558
|
-
const urlValues = parseObjectValue(initParams);
|
|
4559
|
-
const defaultValue = {
|
|
4560
|
-
...initValue,
|
|
4561
|
-
...urlValues
|
|
4562
|
-
};
|
|
4563
|
-
const defaultSearchParams = new URLSearchParams(stringifyObjectValue(defaultValue));
|
|
4564
|
-
const filterValue = omit(defaultValue, [
|
|
4565
|
-
'page',
|
|
4566
|
-
'pageSize'
|
|
4567
|
-
]);
|
|
4568
|
-
if (0 !== Object.keys(filterValue).length) onSearch?.(filterValue);
|
|
4569
|
-
return {
|
|
4570
|
-
defaultValue: filterValue,
|
|
4571
|
-
defaultSearchParams
|
|
4572
|
-
};
|
|
4573
|
-
});
|
|
4574
|
-
const [searchParams, setSearchParams] = useSearchParams();
|
|
4575
|
-
const formValueChange = useCallback((allValues)=>{
|
|
4576
|
-
const searchResult = onSearch?.(allValues);
|
|
4577
|
-
searchResult?.then(()=>{
|
|
4578
|
-
setSearchParams((prev)=>{
|
|
4579
|
-
const v = stringifyObjectValue(allValues || {});
|
|
4580
|
-
prev.forEach((_value, key)=>{
|
|
4581
|
-
if (![
|
|
4582
|
-
'page',
|
|
4583
|
-
'pageSize',
|
|
4584
|
-
'tab'
|
|
4585
|
-
].includes(key)) prev.delete(key);
|
|
4586
|
-
});
|
|
4587
|
-
Object.keys(v).forEach((key)=>{
|
|
4588
|
-
prev.set(key, v[key]);
|
|
4589
|
-
});
|
|
4590
|
-
return prev;
|
|
4591
|
-
}, {
|
|
4592
|
-
replace: true
|
|
4593
|
-
});
|
|
4594
|
-
});
|
|
4595
|
-
}, [
|
|
4596
|
-
searchParams
|
|
4597
|
-
]);
|
|
4598
|
-
useImperativeHandle(ref, ()=>({
|
|
4599
|
-
getValues: ()=>formRef.current?.formApi?.getValues?.()
|
|
4600
|
-
}));
|
|
4601
|
-
return children ? /*#__PURE__*/ jsx(SemiForm, {
|
|
4602
|
-
ref: formRef,
|
|
4603
|
-
initValues: initValueAndParams.defaultValue,
|
|
4604
|
-
onValueChange: formValueChange,
|
|
4605
|
-
layout: "horizontal",
|
|
4606
|
-
className: className,
|
|
4607
|
-
children: children
|
|
4608
|
-
}) : null;
|
|
4609
|
-
});
|
|
4610
4471
|
function TitleWithSub({ title, subTitle, className }) {
|
|
4611
4472
|
return /*#__PURE__*/ jsxs(Space, {
|
|
4612
4473
|
align: "center",
|
|
@@ -4626,31 +4487,63 @@ function TitleWithSub({ title, subTitle, className }) {
|
|
|
4626
4487
|
]
|
|
4627
4488
|
});
|
|
4628
4489
|
}
|
|
4490
|
+
const CozeLoopContext = /*#__PURE__*/ createContext({});
|
|
4491
|
+
function CozeLoopProvider({ children, defaultLanguage, resources, sendEvent }) {
|
|
4492
|
+
const isInitialized = useRef(false);
|
|
4493
|
+
const [initialized, setInitialized] = useState(false);
|
|
4494
|
+
useEffect(()=>{
|
|
4495
|
+
if (resources && !isInitialized.current) initIntl({
|
|
4496
|
+
lng: defaultLanguage,
|
|
4497
|
+
resources
|
|
4498
|
+
}).then(()=>{
|
|
4499
|
+
isInitialized.current = true;
|
|
4500
|
+
setInitialized(true);
|
|
4501
|
+
}).catch((error)=>{
|
|
4502
|
+
console.error('Error initializing intl:', error);
|
|
4503
|
+
isInitialized.current = true;
|
|
4504
|
+
setInitialized(true);
|
|
4505
|
+
});
|
|
4506
|
+
}, [
|
|
4507
|
+
resources,
|
|
4508
|
+
defaultLanguage
|
|
4509
|
+
]);
|
|
4510
|
+
if (!initialized) return /*#__PURE__*/ jsx(PageLoading, {});
|
|
4511
|
+
return /*#__PURE__*/ jsx(CozeLoopContext.Provider, {
|
|
4512
|
+
value: {
|
|
4513
|
+
sendEvent
|
|
4514
|
+
},
|
|
4515
|
+
children: children
|
|
4516
|
+
});
|
|
4517
|
+
}
|
|
4518
|
+
function useReportEvent() {
|
|
4519
|
+
const context = useContext(CozeLoopContext);
|
|
4520
|
+
return context.sendEvent ?? ((name, params)=>{
|
|
4521
|
+
console.info(name, params);
|
|
4522
|
+
});
|
|
4523
|
+
}
|
|
4629
4524
|
function FooterActions({ confirmBtnProps: { text: confirmBtnText, ...confirmBtnProps } = {}, cancelBtnProps: { text: cancelBtnText, ...cancelBtnProps } = {} }) {
|
|
4630
|
-
const I18n = useI18n();
|
|
4631
4525
|
return /*#__PURE__*/ jsxs("div", {
|
|
4632
4526
|
className: "flex justify-end",
|
|
4633
4527
|
children: [
|
|
4634
4528
|
/*#__PURE__*/ jsx(Button, {
|
|
4635
4529
|
color: "primary",
|
|
4636
4530
|
...cancelBtnProps,
|
|
4637
|
-
children: cancelBtnText ??
|
|
4531
|
+
children: cancelBtnText ?? i18n_I18n.t('cancel')
|
|
4638
4532
|
}),
|
|
4639
4533
|
/*#__PURE__*/ jsx(Button, {
|
|
4640
4534
|
className: "ml-2",
|
|
4641
4535
|
...confirmBtnProps,
|
|
4642
|
-
children: confirmBtnText ??
|
|
4536
|
+
children: confirmBtnText ?? i18n_I18n.t('global_btn_confirm')
|
|
4643
4537
|
})
|
|
4644
4538
|
]
|
|
4645
4539
|
});
|
|
4646
4540
|
}
|
|
4647
4541
|
function TableEmpty({ className, ...props }) {
|
|
4648
|
-
const I18n = useI18n();
|
|
4649
4542
|
return /*#__PURE__*/ jsx(EmptyState, {
|
|
4650
4543
|
className: classnames('my-10', className),
|
|
4651
4544
|
icon: /*#__PURE__*/ jsx(IconCozIllusNone, {}),
|
|
4652
4545
|
darkModeIcon: /*#__PURE__*/ jsx(IconCozIllusNoneDark, {}),
|
|
4653
|
-
description:
|
|
4546
|
+
description: i18n_I18n.t('no_data'),
|
|
4654
4547
|
...props
|
|
4655
4548
|
});
|
|
4656
4549
|
}
|
|
@@ -5441,9 +5334,6 @@ const SentinelFormInner = ({ formID, children, onValueChange, onSubmit, getFormA
|
|
|
5441
5334
|
time_str: dayjs(closeTime).format('YYYY-MM-DD HH:mm:ss')
|
|
5442
5335
|
});
|
|
5443
5336
|
};
|
|
5444
|
-
const onFormCloseDobounce = useDebounceFn(onFormClose, {
|
|
5445
|
-
wait: 200
|
|
5446
|
-
});
|
|
5447
5337
|
const onValuesChange = (values, changedValues)=>{
|
|
5448
5338
|
handleValueChange(changedValues);
|
|
5449
5339
|
onValueChange?.(values, changedValues);
|
|
@@ -5479,12 +5369,17 @@ const SentinelFormInner = ({ formID, children, onValueChange, onSubmit, getFormA
|
|
|
5479
5369
|
return ()=>{
|
|
5480
5370
|
if (formID && sessionID && !flushedRef.current) {
|
|
5481
5371
|
flushedRef.current = true;
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5372
|
+
try {
|
|
5373
|
+
sendEvent?.(enum_EventNames.LOOP_FORM_FIELD_CHANGE_TIMELINE, {
|
|
5374
|
+
form_id: formID,
|
|
5375
|
+
session_id: sessionID,
|
|
5376
|
+
time_line: JSON.stringify(operationTimelineRef.current)
|
|
5377
|
+
});
|
|
5378
|
+
} catch (err) {
|
|
5379
|
+
console.error(err);
|
|
5380
|
+
} finally{
|
|
5381
|
+
onFormClose();
|
|
5382
|
+
}
|
|
5488
5383
|
}
|
|
5489
5384
|
};
|
|
5490
5385
|
}, [
|
|
@@ -5498,12 +5393,17 @@ const SentinelFormInner = ({ formID, children, onValueChange, onSubmit, getFormA
|
|
|
5498
5393
|
const sid = sessionIdRef.current;
|
|
5499
5394
|
if (!fid || !sid) return;
|
|
5500
5395
|
flushedRef.current = true;
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5396
|
+
try {
|
|
5397
|
+
sendEvent?.(enum_EventNames.LOOP_FORM_FIELD_CHANGE_TIMELINE, {
|
|
5398
|
+
form_id: fid,
|
|
5399
|
+
session_id: sid,
|
|
5400
|
+
time_line: JSON.stringify(operationTimelineRef.current)
|
|
5401
|
+
});
|
|
5402
|
+
} catch (err) {
|
|
5403
|
+
console.error(err);
|
|
5404
|
+
} finally{
|
|
5405
|
+
onFormClose();
|
|
5406
|
+
}
|
|
5507
5407
|
};
|
|
5508
5408
|
window.addEventListener('pagehide', flushOnClose);
|
|
5509
5409
|
window.addEventListener('beforeunload', flushOnClose);
|
|
@@ -5797,6 +5697,11 @@ languages.register('json', {
|
|
|
5797
5697
|
languageService: json.languageService
|
|
5798
5698
|
});
|
|
5799
5699
|
languages.register('shell', shell);
|
|
5700
|
+
languages.register('python', python);
|
|
5701
|
+
languages.register("typescript", typescript);
|
|
5702
|
+
languages.register('go', {
|
|
5703
|
+
language: goLanguage
|
|
5704
|
+
});
|
|
5800
5705
|
themes.register('coze-light', cozeLight);
|
|
5801
5706
|
themes.register('coze-dark', cozeDark);
|
|
5802
5707
|
const minHeightOption = (value)=>EditorView.theme({
|
|
@@ -5836,7 +5741,7 @@ function createStyleOptions() {
|
|
|
5836
5741
|
return [
|
|
5837
5742
|
react_option('minHeight', minHeightOption),
|
|
5838
5743
|
react_option('maxHeight', maxHeightOption),
|
|
5839
|
-
react_option('
|
|
5744
|
+
react_option('editorHeight', heightOption),
|
|
5840
5745
|
react_option('borderRadius', borderRadiusOption),
|
|
5841
5746
|
react_option('padding', paddingOption),
|
|
5842
5747
|
react_option('lineHeight', lineHeightOption)
|
|
@@ -5930,7 +5835,7 @@ const transformer = transformerCreator((text)=>{
|
|
|
5930
5835
|
return text;
|
|
5931
5836
|
});
|
|
5932
5837
|
const CodeMirrorJsonEditor = /*#__PURE__*/ react.forwardRef((props, ref)=>{
|
|
5933
|
-
const { value, onChange, placeholder, className, isDarkTheme, readonly, minHeight = '100px', maxHeight,
|
|
5838
|
+
const { value, onChange, placeholder, className, isDarkTheme, readonly, minHeight = '100px', maxHeight, editorHeight, padding, borderRadius, onFocus, onBlur } = props;
|
|
5934
5839
|
const apiRef = useRef(null);
|
|
5935
5840
|
const handleChange = useCallback((e)=>{
|
|
5936
5841
|
if ('function' == typeof onChange) onChange(e.value);
|
|
@@ -5974,7 +5879,7 @@ const CodeMirrorJsonEditor = /*#__PURE__*/ react.forwardRef((props, ref)=>{
|
|
|
5974
5879
|
transformer,
|
|
5975
5880
|
minHeight,
|
|
5976
5881
|
maxHeight,
|
|
5977
|
-
|
|
5882
|
+
editorHeight,
|
|
5978
5883
|
borderRadius,
|
|
5979
5884
|
padding,
|
|
5980
5885
|
fontSize: 13,
|
|
@@ -6023,6 +5928,101 @@ const CodeMirrorRawTextEditor = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
6023
5928
|
})
|
|
6024
5929
|
});
|
|
6025
5930
|
});
|
|
5931
|
+
const raw_code_editor_extensions = [
|
|
5932
|
+
EditorView.theme({
|
|
5933
|
+
'.cm-activeLineGutter': {
|
|
5934
|
+
backgroundColor: 'transparent !important'
|
|
5935
|
+
},
|
|
5936
|
+
'.cm-activeLine': {
|
|
5937
|
+
backgroundColor: 'transparent !important'
|
|
5938
|
+
}
|
|
5939
|
+
})
|
|
5940
|
+
];
|
|
5941
|
+
function raw_code_editor_findAllMatches(inputString, regex) {
|
|
5942
|
+
const globalRegex = new RegExp(regex, regex.flags.includes('g') ? regex.flags : `${regex.flags}g`);
|
|
5943
|
+
let match;
|
|
5944
|
+
const matches = [];
|
|
5945
|
+
while(true){
|
|
5946
|
+
match = globalRegex.exec(inputString);
|
|
5947
|
+
if (!match) break;
|
|
5948
|
+
if (match.index === globalRegex.lastIndex) globalRegex.lastIndex++;
|
|
5949
|
+
matches.push({
|
|
5950
|
+
match: match[0],
|
|
5951
|
+
range: [
|
|
5952
|
+
match.index,
|
|
5953
|
+
match.index + match[0].length
|
|
5954
|
+
]
|
|
5955
|
+
});
|
|
5956
|
+
}
|
|
5957
|
+
return matches;
|
|
5958
|
+
}
|
|
5959
|
+
const raw_code_editor_transformer = transformerCreator((text)=>{
|
|
5960
|
+
const originalSource = text.toString();
|
|
5961
|
+
const matches = raw_code_editor_findAllMatches(originalSource, /\{\{([^\}]*)\}\}/g);
|
|
5962
|
+
if (matches.length > 0) matches.forEach(({ range })=>{
|
|
5963
|
+
text.replaceRange(range[0], range[1], 'null');
|
|
5964
|
+
});
|
|
5965
|
+
return text;
|
|
5966
|
+
});
|
|
5967
|
+
const CodeMirrorRawCodeEditor = /*#__PURE__*/ react.forwardRef((props, ref)=>{
|
|
5968
|
+
const { value, onChange, placeholder, className, isDarkTheme, readonly, minHeight = '100px', maxHeight, editorHeight, padding, borderRadius, onFocus, onBlur, language = 'shell' } = props;
|
|
5969
|
+
const apiRef = useRef(null);
|
|
5970
|
+
const handleChange = useCallback((e)=>{
|
|
5971
|
+
if ('function' == typeof onChange) onChange(e.value);
|
|
5972
|
+
}, [
|
|
5973
|
+
onChange
|
|
5974
|
+
]);
|
|
5975
|
+
useEffect(()=>{
|
|
5976
|
+
apiRef.current?.updateASTDecorations();
|
|
5977
|
+
}, [
|
|
5978
|
+
isDarkTheme
|
|
5979
|
+
]);
|
|
5980
|
+
useEffect(()=>{
|
|
5981
|
+
const editor = apiRef.current;
|
|
5982
|
+
if (!editor) return;
|
|
5983
|
+
if ('string' == typeof value && value !== editor.getValue()) editor.setValue(value);
|
|
5984
|
+
}, [
|
|
5985
|
+
value
|
|
5986
|
+
]);
|
|
5987
|
+
const formatJson = async ()=>{
|
|
5988
|
+
const view = apiRef.current?.$view;
|
|
5989
|
+
if (!view) return;
|
|
5990
|
+
view.dispatch(await json.languageService.format(view.state, {
|
|
5991
|
+
tabSize: 2
|
|
5992
|
+
}));
|
|
5993
|
+
};
|
|
5994
|
+
useImperativeHandle(ref, ()=>({
|
|
5995
|
+
formatJson
|
|
5996
|
+
}));
|
|
5997
|
+
return /*#__PURE__*/ jsx(EditorProvider, {
|
|
5998
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
5999
|
+
className: className,
|
|
6000
|
+
children: /*#__PURE__*/ jsx(CodeMirrorCodeEditor, {
|
|
6001
|
+
defaultValue: value ?? '',
|
|
6002
|
+
onChange: handleChange,
|
|
6003
|
+
options: {
|
|
6004
|
+
placeholder,
|
|
6005
|
+
lineWrapping: true,
|
|
6006
|
+
theme: isDarkTheme ? 'coze-dark' : 'coze-light',
|
|
6007
|
+
languageId: language,
|
|
6008
|
+
editable: !readonly,
|
|
6009
|
+
transformer: raw_code_editor_transformer,
|
|
6010
|
+
minHeight,
|
|
6011
|
+
maxHeight,
|
|
6012
|
+
editorHeight,
|
|
6013
|
+
borderRadius,
|
|
6014
|
+
padding,
|
|
6015
|
+
fontSize: 13,
|
|
6016
|
+
lineHeight: 20
|
|
6017
|
+
},
|
|
6018
|
+
didMount: (api)=>apiRef.current = api,
|
|
6019
|
+
extensions: raw_code_editor_extensions,
|
|
6020
|
+
onFocus: onFocus,
|
|
6021
|
+
onBlur: onBlur
|
|
6022
|
+
})
|
|
6023
|
+
})
|
|
6024
|
+
});
|
|
6025
|
+
});
|
|
6026
6026
|
const SchemaEditor = ({ value, onChange, placeholder, readOnly, language, className })=>/*#__PURE__*/ jsx("div", {
|
|
6027
6027
|
className: classnames('w-full h-[500px] border border-solid coz-stroke-primary rounded-[4px] overflow-hidden relative bg-white', {
|
|
6028
6028
|
'opacity-70': readOnly
|
|
@@ -6042,4 +6042,50 @@ const SchemaEditor = ({ value, onChange, placeholder, readOnly, language, classN
|
|
|
6042
6042
|
readonly: readOnly
|
|
6043
6043
|
})
|
|
6044
6044
|
});
|
|
6045
|
-
|
|
6045
|
+
const code_editor_with_loading_index_module = {
|
|
6046
|
+
"code-container": "code-container-A_QOb1",
|
|
6047
|
+
codeContainer: "code-container-A_QOb1"
|
|
6048
|
+
};
|
|
6049
|
+
const codeOptionsConfig = {
|
|
6050
|
+
lineNumbersMinChars: 3,
|
|
6051
|
+
automaticLayout: true,
|
|
6052
|
+
scrollBeyondLastLine: false,
|
|
6053
|
+
renderLineHighlight: 'none',
|
|
6054
|
+
tabSize: 2,
|
|
6055
|
+
insertSpaces: true,
|
|
6056
|
+
minimap: {
|
|
6057
|
+
enabled: false
|
|
6058
|
+
}
|
|
6059
|
+
};
|
|
6060
|
+
const CodeEditorWithLoading = ({ value, onChange, disabled, className })=>{
|
|
6061
|
+
const [loading, setLoading] = useState(true);
|
|
6062
|
+
const LoadingNode = loading && /*#__PURE__*/ jsx("div", {
|
|
6063
|
+
className: "absolute bg-[white] z-20 top-0 bottom-0 left-0 right-0 flex items-center justify-center",
|
|
6064
|
+
children: /*#__PURE__*/ jsx(Loading, {
|
|
6065
|
+
loading: true
|
|
6066
|
+
})
|
|
6067
|
+
});
|
|
6068
|
+
const onEditorMount = ()=>{
|
|
6069
|
+
setLoading(false);
|
|
6070
|
+
};
|
|
6071
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
6072
|
+
className: classnames(code_editor_with_loading_index_module["code-container"], className),
|
|
6073
|
+
children: [
|
|
6074
|
+
LoadingNode,
|
|
6075
|
+
/*#__PURE__*/ jsx(_monaco_editor_react, {
|
|
6076
|
+
language: 'json',
|
|
6077
|
+
value: value,
|
|
6078
|
+
options: {
|
|
6079
|
+
readOnly: disabled,
|
|
6080
|
+
...codeOptionsConfig
|
|
6081
|
+
},
|
|
6082
|
+
onMount: onEditorMount,
|
|
6083
|
+
theme: "vs-dark",
|
|
6084
|
+
onChange: (newValue)=>{
|
|
6085
|
+
onChange?.(newValue || '');
|
|
6086
|
+
}
|
|
6087
|
+
})
|
|
6088
|
+
]
|
|
6089
|
+
});
|
|
6090
|
+
};
|
|
6091
|
+
export { base_search_form_select as BaseSearchFormSelect, base_search_select as BaseSearchSelect, BasicCard, CardPane, ChipSelect, _monaco_editor_react as CodeEditor, CodeEditorWithLoading, CodeMirrorCodeEditor, CodeMirrorJsonEditor, CodeMirrorRawCodeEditor, CodeMirrorRawTextEditor, CodeMirrorTextEditor, CollapseCard, ColumnSelector, Copyable, CozeLoopProvider, DEFAULT_FILE_COUNT, DEFAULT_FILE_SIZE, DEFAULT_PAGE_SIZE, DEFAULT_PART_COUNT, DEFAULT_SUPPORTED_FORMATS, DEFAULT_VIDEO_SUPPORTED_FORMATS, DiffEditor, EditIconButton, EditorProvider, FooterActions, FullPage, IDRender, IconButtonContainer, ImageItemRenderer, IndexControllerView, InfiniteScrollTable, InfoTooltip, InputSlider, InputWithCount, JumpIconButton, LargeTxtRender, Layout, LazyLoadComponent, LogicEditor, LogicExpr, LoopRadioGroup, LoopTable, LoopTabs, MultiPartRender, MultipartEditor, type_ImageStatus as MultipartRenderStatus, OpenDetailButton, PAGE_SIZE_OPTIONS, PageError, PageLoading, PageNoAuth, PageNoContent, PageNotFound, PrimaryPage, PrimaryTitle, RadioButton, ResizableSideSheet, ResizeSidesheet, SchemaEditor, SemiSchemaForm, SentinelForm, StepNav, TableBatchOperate, TableColActions, TableColsConfig, TableEmpty, TableHeader, TableWithPagination, TableWithoutPagination, TextAreaPro, TextWithCopy, TitleWithSub, TooltipWhenDisabled, TooltipWithDisabled, UploadButton, UserProfile, VersionItem, VersionList, VersionSwitchPanel, VideoItemRenderer, dealColumnsWithStorage, formateDecimalPlacesString, getColumnManageStorage, getStoragePageSize, handleCopy, validator_ajv8 as schemaValidators, setColumnsManageStorage, sleep, upload_uploadFile as uploadFile, useBatchOperate, useItemIndexController, useReportEvent, useUnsaveLeaveWarning };
|