@cozeloop/components 0.0.7 → 0.0.9
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 +529 -391
- package/dist/es/loopIcons.js +2 -0
- package/dist/lib/base-search-select/base-search-select.js +2 -1
- package/dist/lib/base-search-select/base-search-select.js.map +1 -1
- package/dist/lib/code-editor-with-loading/index.d.ts +10 -0
- package/dist/lib/code-editor-with-loading/index.js +31 -0
- package/dist/lib/code-editor-with-loading/index.js.map +1 -0
- package/dist/lib/codemirror-editor/code-editor.js +9 -1
- package/dist/lib/codemirror-editor/code-editor.js.map +1 -1
- package/dist/lib/codemirror-editor/index.d.ts +2 -0
- package/dist/lib/codemirror-editor/index.js +2 -0
- package/dist/lib/codemirror-editor/index.js.map +1 -1
- package/dist/lib/codemirror-editor/json-editor.d.ts +1 -1
- package/dist/lib/codemirror-editor/json-editor.js +9 -3
- package/dist/lib/codemirror-editor/json-editor.js.map +1 -1
- package/dist/lib/codemirror-editor/raw-code-editor.d.ts +20 -0
- package/dist/lib/codemirror-editor/raw-code-editor.js +103 -0
- package/dist/lib/codemirror-editor/raw-code-editor.js.map +1 -0
- package/dist/lib/collapse-card/index.d.ts +2 -1
- package/dist/lib/collapse-card/index.js.map +1 -1
- package/dist/lib/columns-select/index.js +5 -4
- package/dist/lib/columns-select/index.js.map +1 -1
- package/dist/lib/copyable/index.d.ts +5 -0
- package/dist/lib/copyable/index.js +12 -0
- package/dist/lib/copyable/index.js.map +1 -0
- package/dist/lib/footer-actions/index.js +2 -3
- package/dist/lib/footer-actions/index.js.map +1 -1
- package/dist/lib/hooks/use-unsave-leave-warning.d.ts +4 -1
- package/dist/lib/hooks/use-unsave-leave-warning.js +6 -4
- package/dist/lib/hooks/use-unsave-leave-warning.js.map +1 -1
- package/dist/lib/id-render/index.js +4 -3
- package/dist/lib/id-render/index.js.map +1 -1
- package/dist/lib/index-controller/record-navigation.js +2 -1
- package/dist/lib/index-controller/record-navigation.js.map +1 -1
- package/dist/lib/index.d.ts +5 -4
- package/dist/lib/index.js +5 -4
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/infinite-scroll-table/index.js +2 -1
- package/dist/lib/infinite-scroll-table/index.js.map +1 -1
- package/dist/lib/logic-editor/logic-editor.d.ts +2 -4
- package/dist/lib/logic-editor/logic-editor.js +5 -4
- package/dist/lib/logic-editor/logic-editor.js.map +1 -1
- package/dist/lib/logic-editor/logic-left-render.js +5 -3
- package/dist/lib/logic-editor/logic-left-render.js.map +1 -1
- package/dist/lib/logic-editor/logic-operator-render.js +4 -2
- package/dist/lib/logic-editor/logic-operator-render.js.map +1 -1
- package/dist/lib/logic-editor/logic-right-render.js +2 -1
- package/dist/lib/logic-editor/logic-right-render.js.map +1 -1
- package/dist/lib/logic-editor/logic-types.d.ts +6 -2
- package/dist/lib/logic-editor/logic-types.js +59 -51
- package/dist/lib/logic-editor/logic-types.js.map +1 -1
- package/dist/lib/logic-expr/expr-group-render.js +2 -3
- package/dist/lib/logic-expr/expr-group-render.js.map +1 -1
- package/dist/lib/logic-expr/expr-render.js +2 -3
- package/dist/lib/logic-expr/expr-render.js.map +1 -1
- package/dist/lib/logic-expr/logic-not.js +2 -3
- package/dist/lib/logic-expr/logic-not.js.map +1 -1
- package/dist/lib/logic-expr/logic-toggle.js +1 -2
- package/dist/lib/logic-expr/logic-toggle.js.map +1 -1
- package/dist/lib/loop-icons/index.d.ts +1 -0
- package/dist/lib/loop-icons/index.js +3 -0
- package/dist/lib/loop-icons/index.js.map +1 -0
- package/dist/lib/multi-part-editor/components/image-item-renderer.js +2 -1
- package/dist/lib/multi-part-editor/components/image-item-renderer.js.map +1 -1
- package/dist/lib/multi-part-editor/components/multipart-item-renderer.js +2 -1
- package/dist/lib/multi-part-editor/components/multipart-item-renderer.js.map +1 -1
- package/dist/lib/multi-part-editor/components/url-input-modal.js +19 -18
- package/dist/lib/multi-part-editor/components/url-input-modal.js.map +1 -1
- package/dist/lib/multi-part-editor/components/video-item-renderer.js +2 -1
- package/dist/lib/multi-part-editor/components/video-item-renderer.js.map +1 -1
- package/dist/lib/multi-part-editor/index.js +10 -9
- package/dist/lib/multi-part-editor/index.js.map +1 -1
- package/dist/lib/multi-part-editor/type.d.ts +1 -1
- package/dist/lib/multi-part-editor/type.js +19 -17
- package/dist/lib/multi-part-editor/type.js.map +1 -1
- package/dist/lib/multi-part-editor/upload-button.js +8 -7
- package/dist/lib/multi-part-editor/upload-button.js.map +1 -1
- package/dist/lib/open-detail-button/index.js +2 -1
- package/dist/lib/open-detail-button/index.js.map +1 -1
- package/dist/lib/page-content/index.js +4 -3
- package/dist/lib/page-content/index.js.map +1 -1
- package/dist/lib/provider/index.d.ts +10 -9
- package/dist/lib/provider/index.js +27 -28
- package/dist/lib/provider/index.js.map +1 -1
- package/dist/lib/sentinel-form/index.js +26 -14
- package/dist/lib/sentinel-form/index.js.map +1 -1
- package/dist/lib/table/index.js +2 -1
- package/dist/lib/table/index.js.map +1 -1
- package/dist/lib/table/sort-icon.d.ts +3 -3
- package/dist/lib/table/sort-icon.js +6 -5
- package/dist/lib/table/sort-icon.js.map +1 -1
- package/dist/lib/table/table-with-pagination.js +2 -2
- package/dist/lib/table/table-with-pagination.js.map +1 -1
- package/dist/lib/table/table-without-pagniation.js +3 -3
- package/dist/lib/table/table-without-pagniation.js.map +1 -1
- package/dist/lib/table-batch-operate/table-batch-operation.js +6 -3
- package/dist/lib/table-batch-operate/table-batch-operation.js.map +1 -1
- package/dist/lib/table-col-actions/index.d.ts +2 -0
- package/dist/lib/table-col-actions/index.js +17 -13
- package/dist/lib/table-col-actions/index.js.map +1 -1
- package/dist/lib/table-cols-config/index.js +8 -5
- package/dist/lib/table-cols-config/index.js.map +1 -1
- package/dist/lib/table-empty/index.js +2 -3
- package/dist/lib/table-empty/index.js.map +1 -1
- package/dist/lib/table-header/index.js +3 -2
- package/dist/lib/table-header/index.js.map +1 -1
- package/dist/lib/text-with-copy/index.js +2 -1
- package/dist/lib/text-with-copy/index.js.map +1 -1
- package/dist/lib/tsconfig.build.tsbuildinfo +1 -1
- package/dist/lib/utils/basic.js +3 -2
- package/dist/lib/utils/basic.js.map +1 -1
- package/dist/lib/version-list/version-descriptions.js +4 -3
- package/dist/lib/version-list/version-descriptions.js.map +1 -1
- package/dist/lib/version-list/version-list.js +2 -1
- package/dist/lib/version-list/version-list.js.map +1 -1
- package/dist/lib/version-list/version-switch-panel.js +2 -1
- package/dist/lib/version-list/version-switch-panel.js.map +1 -1
- package/package.json +25 -5
- 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/es/index.js
CHANGED
|
@@ -3,10 +3,11 @@ 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 { IconCozIllus404, IconCozIllus404Dark, IconCozIllusEmpty, IconCozIllusEmptyDark, IconCozIllusError, IconCozIllusErrorDark, IconCozIllusLock, IconCozIllusLockDark, IconCozIllusNone, IconCozIllusNoneDark } from "@coze-arch/coze-design/illustrations";
|
|
10
11
|
import { useDebounceFn, useInfiniteScroll, useLatest, useMemoizedFn, useRequest, useSize } from "ahooks";
|
|
11
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";
|
|
@@ -24,10 +25,13 @@ import { useMouseDownOffset as hooks_useMouseDownOffset } from "@cozeloop/hooks"
|
|
|
24
25
|
import dayjs from "dayjs";
|
|
25
26
|
import { EditorProvider, createRenderer, option as react_option } from "@coze-editor/editor/react";
|
|
26
27
|
import preset_code, { createTheme, languages, tags, themes, transformerCreator } from "@coze-editor/editor/preset-code";
|
|
28
|
+
import { typescript } from "@coze-editor/editor/language-typescript";
|
|
27
29
|
import { shell } from "@coze-editor/editor/language-shell";
|
|
30
|
+
import { python } from "@coze-editor/editor/language-python";
|
|
28
31
|
import { json } from "@coze-editor/editor/language-json";
|
|
29
32
|
import { mixLanguages } from "@coze-editor/editor";
|
|
30
33
|
import { EditorView, keymap } from "@codemirror/view";
|
|
34
|
+
import { goLanguage } from "@codemirror/lang-go";
|
|
31
35
|
import preset_universal from "@coze-editor/editor/preset-universal";
|
|
32
36
|
import { defaultKeymap, history as commands_history, historyKeymap } from "@codemirror/commands";
|
|
33
37
|
var __webpack_require__ = {};
|
|
@@ -68,10 +72,10 @@ const SortableContainer = columns_select_sortableContainer(({ children })=>/*#__
|
|
|
68
72
|
}));
|
|
69
73
|
const DragHandle = columns_select_sortableHandle(()=>/*#__PURE__*/ jsx(IconCozHandle, {
|
|
70
74
|
className: "cursor-grab",
|
|
71
|
-
"aria-label":
|
|
75
|
+
"aria-label": i18n_I18n.t('drag_to_sort'),
|
|
72
76
|
role: "button"
|
|
73
77
|
}));
|
|
74
|
-
const ColumnSelector = ({ columns, defaultColumns = columns, onChange, buttonText, resetButtonText
|
|
78
|
+
const ColumnSelector = ({ columns, defaultColumns = columns, onChange, buttonText, resetButtonText, className, sortable = true, itemRender, footerRender })=>{
|
|
75
79
|
const [list, setList] = useState(()=>[
|
|
76
80
|
...columns
|
|
77
81
|
]);
|
|
@@ -114,7 +118,7 @@ const ColumnSelector = ({ columns, defaultColumns = columns, onChange, buttonTex
|
|
|
114
118
|
/*#__PURE__*/ jsx(Checkbox, {
|
|
115
119
|
disabled: disabledKeys.includes(value.key ?? '') || value.disabled,
|
|
116
120
|
checked: selectedKeys.includes(value.key ?? ''),
|
|
117
|
-
"aria-label":
|
|
121
|
+
"aria-label": `${i18n_I18n.t('select')}${value.value}`
|
|
118
122
|
}),
|
|
119
123
|
/*#__PURE__*/ jsx(Typography.Text, {
|
|
120
124
|
ellipsis: {
|
|
@@ -187,7 +191,7 @@ const ColumnSelector = ({ columns, defaultColumns = columns, onChange, buttonTex
|
|
|
187
191
|
onClick: handleReset,
|
|
188
192
|
children: /*#__PURE__*/ jsx("span", {
|
|
189
193
|
className: "text-brand font-medium text-[13px]",
|
|
190
|
-
children: resetButtonText
|
|
194
|
+
children: resetButtonText || i18n_I18n.t('reset_to_default')
|
|
191
195
|
})
|
|
192
196
|
})
|
|
193
197
|
]
|
|
@@ -198,7 +202,7 @@ const ColumnSelector = ({ columns, defaultColumns = columns, onChange, buttonTex
|
|
|
198
202
|
onClick: handleReset,
|
|
199
203
|
children: /*#__PURE__*/ jsx("span", {
|
|
200
204
|
className: "text-brand font-medium text-[13px]",
|
|
201
|
-
children: resetButtonText
|
|
205
|
+
children: resetButtonText || i18n_I18n.t('reset_to_default')
|
|
202
206
|
})
|
|
203
207
|
})
|
|
204
208
|
]
|
|
@@ -206,7 +210,7 @@ const ColumnSelector = ({ columns, defaultColumns = columns, onChange, buttonTex
|
|
|
206
210
|
trigger: "click",
|
|
207
211
|
children: /*#__PURE__*/ jsx("div", {
|
|
208
212
|
children: /*#__PURE__*/ jsx(Tooltip, {
|
|
209
|
-
content:
|
|
213
|
+
content: i18n_I18n.t('column_management'),
|
|
210
214
|
theme: "dark",
|
|
211
215
|
position: "top",
|
|
212
216
|
children: /*#__PURE__*/ jsx(Button, {
|
|
@@ -241,6 +245,21 @@ function TooltipWithDisabled({ children, disabled, ...rest }) {
|
|
|
241
245
|
children: children
|
|
242
246
|
});
|
|
243
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
|
+
}
|
|
244
263
|
const index_module = {
|
|
245
264
|
"loop-table": "loop-table-ZtuuXn",
|
|
246
265
|
loopTable: "loop-table-ZtuuXn"
|
|
@@ -249,7 +268,7 @@ const LoopTable = ({ className, ...props })=>/*#__PURE__*/ jsx(Table, {
|
|
|
249
268
|
empty: /*#__PURE__*/ jsx(EmptyState, {
|
|
250
269
|
size: "full_screen",
|
|
251
270
|
icon: /*#__PURE__*/ jsx(IconCozIllusEmpty, {}),
|
|
252
|
-
title:
|
|
271
|
+
title: i18n_I18n.t('no_data')
|
|
253
272
|
}),
|
|
254
273
|
...props,
|
|
255
274
|
id: index_module["loop-table"]
|
|
@@ -294,24 +313,24 @@ const IconSortArrow = ({ sortOrder, ...rest })=>{
|
|
|
294
313
|
]
|
|
295
314
|
});
|
|
296
315
|
};
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
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
|
+
})
|
|
310
330
|
})
|
|
311
331
|
})
|
|
312
|
-
})
|
|
313
|
-
}
|
|
314
|
-
}
|
|
332
|
+
});
|
|
333
|
+
};
|
|
315
334
|
function getStoragePageSize(pageSizeStorageKey) {
|
|
316
335
|
if (!pageSizeStorageKey) return;
|
|
317
336
|
const pageSize = localStorage.getItem(pageSizeStorageKey);
|
|
@@ -376,7 +395,7 @@ function TableWithPagination(props) {
|
|
|
376
395
|
columns: columns?.filter((column)=>true !== column.hidden && false !== column.checked)?.map((column)=>({
|
|
377
396
|
...column,
|
|
378
397
|
...column.sorter && !column.sortIcon ? {
|
|
379
|
-
sortIcon:
|
|
398
|
+
sortIcon: createLoopTableSortIcon()
|
|
380
399
|
} : {}
|
|
381
400
|
})),
|
|
382
401
|
dataSource: service?.data?.list ?? []
|
|
@@ -425,7 +444,7 @@ function PageNotFound({ className, ...props }) {
|
|
|
425
444
|
darkModeImage: /*#__PURE__*/ jsx(IconCozIllus404Dark, {
|
|
426
445
|
className: "text-[160px]"
|
|
427
446
|
}),
|
|
428
|
-
description:
|
|
447
|
+
description: i18n_I18n.t('page_not_found'),
|
|
429
448
|
...props
|
|
430
449
|
})
|
|
431
450
|
});
|
|
@@ -440,7 +459,7 @@ function PageError({ className, ...props }) {
|
|
|
440
459
|
darkModeImage: /*#__PURE__*/ jsx(IconCozIllusErrorDark, {
|
|
441
460
|
className: "text-[160px]"
|
|
442
461
|
}),
|
|
443
|
-
description:
|
|
462
|
+
description: i18n_I18n.t('page_load_failed'),
|
|
444
463
|
...props
|
|
445
464
|
})
|
|
446
465
|
});
|
|
@@ -455,7 +474,7 @@ function PageNoAuth({ className, ...props }) {
|
|
|
455
474
|
darkModeImage: /*#__PURE__*/ jsx(IconCozIllusLockDark, {
|
|
456
475
|
className: "text-[160px]"
|
|
457
476
|
}),
|
|
458
|
-
description:
|
|
477
|
+
description: i18n_I18n.t('no_permission'),
|
|
459
478
|
...props
|
|
460
479
|
})
|
|
461
480
|
});
|
|
@@ -492,25 +511,29 @@ function TableColActions({ actions, maxCount = 2, disabled, spaceProps = {}, wra
|
|
|
492
511
|
spacing: 12,
|
|
493
512
|
...spaceProps,
|
|
494
513
|
children: [
|
|
495
|
-
firstActions.map((action, index)
|
|
496
|
-
|
|
497
|
-
|
|
514
|
+
firstActions.map((action, index)=>{
|
|
515
|
+
const { disabledTooltip, disabled: actionDisabled, onClick: actionOnclick, type: actionType, label: actionLabel, icon: actionIcon, ...restProps } = action;
|
|
516
|
+
return /*#__PURE__*/ jsx(TooltipWhenDisabled, {
|
|
517
|
+
content: disabledTooltip || actionLabel,
|
|
518
|
+
disabled: Boolean(actionDisabled),
|
|
498
519
|
needWrap: false,
|
|
499
520
|
children: /*#__PURE__*/ jsx(Typography.Text, {
|
|
500
521
|
size: "small",
|
|
501
522
|
className: classnames(`!text-[13px] ${textClassName}`, {
|
|
502
|
-
'opacity-45':
|
|
523
|
+
'opacity-45': actionDisabled || disabled
|
|
503
524
|
}),
|
|
504
|
-
type:
|
|
505
|
-
disabled:
|
|
525
|
+
type: actionType,
|
|
526
|
+
disabled: actionDisabled || disabled,
|
|
506
527
|
onClick: ()=>{
|
|
507
|
-
if (!(
|
|
528
|
+
if (!(actionDisabled || disabled)) actionOnclick?.();
|
|
508
529
|
},
|
|
509
|
-
link: !
|
|
510
|
-
|
|
530
|
+
link: !actionType,
|
|
531
|
+
...restProps,
|
|
532
|
+
children: actionIcon ? null : actionLabel
|
|
511
533
|
})
|
|
512
|
-
}, index)
|
|
513
|
-
|
|
534
|
+
}, index);
|
|
535
|
+
}),
|
|
536
|
+
moreActions.length > 0 ? /*#__PURE__*/ jsx(Menu, {
|
|
514
537
|
position: "bottomLeft",
|
|
515
538
|
visible: visible,
|
|
516
539
|
trigger: "custom",
|
|
@@ -519,35 +542,36 @@ function TableColActions({ actions, maxCount = 2, disabled, spaceProps = {}, wra
|
|
|
519
542
|
render: /*#__PURE__*/ jsx(Menu.SubMenu, {
|
|
520
543
|
mode: "menu",
|
|
521
544
|
children: moreActions.map((action, index)=>{
|
|
522
|
-
const
|
|
523
|
-
const
|
|
545
|
+
const { disabledTooltip, disabled: actionDisabled, onClick: actionOnclick, type: actionType, label: actionLabel, icon: actionIcon, ...restProps } = action;
|
|
546
|
+
const isDisabled = actionDisabled || disabled;
|
|
524
547
|
const dropdownItem = /*#__PURE__*/ jsx(Menu.Item, {
|
|
525
548
|
disabled: isDisabled,
|
|
526
549
|
onClick: ()=>{
|
|
527
550
|
if (!isDisabled) {
|
|
528
551
|
setVisible(false);
|
|
529
|
-
|
|
552
|
+
actionOnclick?.();
|
|
530
553
|
}
|
|
531
554
|
},
|
|
532
555
|
className: classnames('min-w-[90px] !p-0 !pl-2', {
|
|
533
556
|
'opacity-50': isDisabled
|
|
534
557
|
}),
|
|
535
|
-
icon:
|
|
558
|
+
icon: actionIcon,
|
|
536
559
|
style: {
|
|
537
560
|
minWidth: '90px'
|
|
538
561
|
},
|
|
562
|
+
...restProps,
|
|
539
563
|
children: /*#__PURE__*/ jsx(Typography.Text, {
|
|
540
|
-
type:
|
|
564
|
+
type: actionType,
|
|
541
565
|
size: "small",
|
|
542
566
|
className: "!text-[13px] min-w-[80px]",
|
|
543
|
-
link: !
|
|
544
|
-
children:
|
|
567
|
+
link: !actionType,
|
|
568
|
+
children: actionLabel
|
|
545
569
|
})
|
|
546
570
|
});
|
|
547
571
|
return /*#__PURE__*/ jsx("div", {
|
|
548
572
|
children: /*#__PURE__*/ jsx(TooltipWhenDisabled, {
|
|
549
|
-
content:
|
|
550
|
-
disabled: Boolean(isDisabled &&
|
|
573
|
+
content: disabledTooltip,
|
|
574
|
+
disabled: Boolean(isDisabled && disabledTooltip),
|
|
551
575
|
theme: "dark",
|
|
552
576
|
needWrap: false,
|
|
553
577
|
children: dropdownItem
|
|
@@ -562,7 +586,7 @@ function TableColActions({ actions, maxCount = 2, disabled, spaceProps = {}, wra
|
|
|
562
586
|
className: "text-[#5A4DED]"
|
|
563
587
|
})
|
|
564
588
|
})
|
|
565
|
-
})
|
|
589
|
+
}) : null
|
|
566
590
|
]
|
|
567
591
|
})
|
|
568
592
|
});
|
|
@@ -686,14 +710,14 @@ const handleCopy = async (value, hideToast)=>{
|
|
|
686
710
|
try {
|
|
687
711
|
copy_to_clipboard(value);
|
|
688
712
|
hideToast || Toast.success({
|
|
689
|
-
content:
|
|
713
|
+
content: i18n_I18n.t('copy_success'),
|
|
690
714
|
showClose: false,
|
|
691
715
|
zIndex: 99999
|
|
692
716
|
});
|
|
693
717
|
return Promise.resolve(true);
|
|
694
718
|
} catch (e) {
|
|
695
719
|
Toast.warning({
|
|
696
|
-
content:
|
|
720
|
+
content: i18n_I18n.t('copy_failed'),
|
|
697
721
|
showClose: false,
|
|
698
722
|
zIndex: 99999
|
|
699
723
|
});
|
|
@@ -768,7 +792,7 @@ const version_list_index_module = {
|
|
|
768
792
|
description: "description-gjffk4"
|
|
769
793
|
};
|
|
770
794
|
function VersionDescriptions({ version, className }) {
|
|
771
|
-
const { version: versionName, draftSubmitText =
|
|
795
|
+
const { version: versionName, draftSubmitText = i18n_I18n.t('save_time'), submitTime, submitter, description, isDraft = false } = version || {};
|
|
772
796
|
return /*#__PURE__*/ jsxs(Descriptions, {
|
|
773
797
|
align: "left",
|
|
774
798
|
className: classnames(version_list_index_module.description, className),
|
|
@@ -776,17 +800,17 @@ function VersionDescriptions({ version, className }) {
|
|
|
776
800
|
/*#__PURE__*/ jsx(Tag, {
|
|
777
801
|
color: isDraft ? 'primary' : 'green',
|
|
778
802
|
className: "mb-2",
|
|
779
|
-
children: isDraft ?
|
|
803
|
+
children: isDraft ? i18n_I18n.t('current_draft') : i18n_I18n.t('submit')
|
|
780
804
|
}),
|
|
781
805
|
isDraft ? null : /*#__PURE__*/ jsx(Descriptions.Item, {
|
|
782
|
-
itemKey:
|
|
806
|
+
itemKey: i18n_I18n.t('version'),
|
|
783
807
|
children: /*#__PURE__*/ jsx("span", {
|
|
784
808
|
className: "font-medium",
|
|
785
809
|
children: versionName ?? '-'
|
|
786
810
|
})
|
|
787
811
|
}),
|
|
788
812
|
submitTime ? /*#__PURE__*/ jsx(Descriptions.Item, {
|
|
789
|
-
itemKey: isDraft ? draftSubmitText :
|
|
813
|
+
itemKey: isDraft ? draftSubmitText : i18n_I18n.t('submit_time'),
|
|
790
814
|
className: "!text-[13px]",
|
|
791
815
|
children: /*#__PURE__*/ jsx("span", {
|
|
792
816
|
className: "font-medium !text-[13px]",
|
|
@@ -794,7 +818,7 @@ function VersionDescriptions({ version, className }) {
|
|
|
794
818
|
})
|
|
795
819
|
}) : null,
|
|
796
820
|
isDraft && !submitter ? null : /*#__PURE__*/ jsx(Descriptions.Item, {
|
|
797
|
-
itemKey:
|
|
821
|
+
itemKey: i18n_I18n.t('submit_user'),
|
|
798
822
|
className: "!text-[13px]",
|
|
799
823
|
children: /*#__PURE__*/ jsx(UserProfile, {
|
|
800
824
|
name: submitter?.name,
|
|
@@ -802,7 +826,7 @@ function VersionDescriptions({ version, className }) {
|
|
|
802
826
|
})
|
|
803
827
|
}),
|
|
804
828
|
isDraft ? null : /*#__PURE__*/ jsx(Descriptions.Item, {
|
|
805
|
-
itemKey: "
|
|
829
|
+
itemKey: i18n_I18n.t("version_description"),
|
|
806
830
|
className: "!text-[13px]",
|
|
807
831
|
children: /*#__PURE__*/ jsx(Typography.Text, {
|
|
808
832
|
ellipsis: {
|
|
@@ -843,7 +867,7 @@ function VersionList({ versions = [], loadMoreLoading = false, enableLoadMore =
|
|
|
843
867
|
loading: loadMoreLoading,
|
|
844
868
|
color: "primary",
|
|
845
869
|
onClick: ()=>onLoadMore?.(),
|
|
846
|
-
children:
|
|
870
|
+
children: i18n_I18n.t('show_more')
|
|
847
871
|
})
|
|
848
872
|
});
|
|
849
873
|
return /*#__PURE__*/ jsx(Fragment, {
|
|
@@ -872,7 +896,7 @@ function VersionSwitchPanel({ visible = true, onClose, ...versionListProps }) {
|
|
|
872
896
|
children: [
|
|
873
897
|
/*#__PURE__*/ jsx("div", {
|
|
874
898
|
className: "text-sm font-medium",
|
|
875
|
-
children:
|
|
899
|
+
children: i18n_I18n.t('version_record')
|
|
876
900
|
}),
|
|
877
901
|
/*#__PURE__*/ jsx(IconCozCross, {
|
|
878
902
|
className: "ml-auto cursor-pointer text-gray-400 hover:text-gray-900",
|
|
@@ -920,7 +944,7 @@ function TextWithCopy({ displayText, copyTooltipText, content, className, maxWid
|
|
|
920
944
|
children: displayText || content || ''
|
|
921
945
|
}),
|
|
922
946
|
content ? /*#__PURE__*/ jsx(Tooltip, {
|
|
923
|
-
content: copyTooltipText ||
|
|
947
|
+
content: copyTooltipText || i18n_I18n.t('copy_content'),
|
|
924
948
|
theme: "dark",
|
|
925
949
|
children: /*#__PURE__*/ jsx(IconButton, {
|
|
926
950
|
size: "mini",
|
|
@@ -989,7 +1013,7 @@ function IDRender({ id, showSuffixLength = 5, enableCopy = true, useTag = false,
|
|
|
989
1013
|
})
|
|
990
1014
|
}),
|
|
991
1015
|
enableCopy ? /*#__PURE__*/ jsx(Tooltip, {
|
|
992
|
-
content:
|
|
1016
|
+
content: i18n_I18n.t('copy_id'),
|
|
993
1017
|
theme: "dark",
|
|
994
1018
|
children: /*#__PURE__*/ jsx("div", {
|
|
995
1019
|
children: /*#__PURE__*/ jsx(IconButtonContainer, {
|
|
@@ -999,10 +1023,10 @@ function IDRender({ id, showSuffixLength = 5, enableCopy = true, useTag = false,
|
|
|
999
1023
|
e.stopPropagation();
|
|
1000
1024
|
try {
|
|
1001
1025
|
await navigator.clipboard.writeText(idString);
|
|
1002
|
-
Toast.success(
|
|
1026
|
+
Toast.success(i18n_I18n.t('copy_success'));
|
|
1003
1027
|
} catch (error) {
|
|
1004
1028
|
console.error(error);
|
|
1005
|
-
Toast.error(
|
|
1029
|
+
Toast.error(i18n_I18n.t('copy_failed'));
|
|
1006
1030
|
}
|
|
1007
1031
|
}
|
|
1008
1032
|
})
|
|
@@ -1196,42 +1220,8 @@ const ResizeSidesheet = (props)=>{
|
|
|
1196
1220
|
]
|
|
1197
1221
|
});
|
|
1198
1222
|
};
|
|
1199
|
-
const CozeLoopContext = /*#__PURE__*/ createContext({});
|
|
1200
|
-
function CozeLoopProvider({ children, i18n, sendEvent }) {
|
|
1201
|
-
return /*#__PURE__*/ jsx(CozeLoopContext.Provider, {
|
|
1202
|
-
value: {
|
|
1203
|
-
i18n,
|
|
1204
|
-
sendEvent
|
|
1205
|
-
},
|
|
1206
|
-
children: children
|
|
1207
|
-
});
|
|
1208
|
-
}
|
|
1209
|
-
function useI18n() {
|
|
1210
|
-
const context = useContext(CozeLoopContext);
|
|
1211
|
-
if (!context.i18n) return {
|
|
1212
|
-
t: (key)=>{
|
|
1213
|
-
console.warn(`CozeLoopProvider: No i18n function provided, returning key: ${key}`);
|
|
1214
|
-
return key;
|
|
1215
|
-
},
|
|
1216
|
-
language: 'zh-CN'
|
|
1217
|
-
};
|
|
1218
|
-
if ('object' == typeof context.i18n && 't' in context.i18n) return context.i18n;
|
|
1219
|
-
return {
|
|
1220
|
-
t: context.i18n
|
|
1221
|
-
};
|
|
1222
|
-
}
|
|
1223
|
-
function useReportEvent() {
|
|
1224
|
-
const context = useContext(CozeLoopContext);
|
|
1225
|
-
return context.sendEvent ?? ((name, params)=>{
|
|
1226
|
-
console.info(name, params);
|
|
1227
|
-
});
|
|
1228
|
-
}
|
|
1229
|
-
function useCozeLoopContext() {
|
|
1230
|
-
return useContext(CozeLoopContext);
|
|
1231
|
-
}
|
|
1232
1223
|
const useUnsaveLeaveWarning = ({ block, message })=>{
|
|
1233
|
-
const
|
|
1234
|
-
const warnMessage = message || i18n.t('unsave_leave_confirm_warning') || 'Close confirm';
|
|
1224
|
+
const warnMessage = message || i18n_I18n.t('unsave_leave_confirm_warning') || 'Close confirm';
|
|
1235
1225
|
useEffect(()=>{
|
|
1236
1226
|
const handleBeforeUnload = (event)=>{
|
|
1237
1227
|
if (block) {
|
|
@@ -1280,7 +1270,7 @@ const InfiniteScrollTable = /*#__PURE__*/ forwardRef(({ service, options, classN
|
|
|
1280
1270
|
empty: restTableProps.empty ?? /*#__PURE__*/ jsx(EmptyState, {
|
|
1281
1271
|
size: "full_screen",
|
|
1282
1272
|
icon: /*#__PURE__*/ jsx(IconCozIllusEmpty, {}),
|
|
1283
|
-
title:
|
|
1273
|
+
title: i18n_I18n.t('no_data')
|
|
1284
1274
|
}),
|
|
1285
1275
|
enableLoad: true,
|
|
1286
1276
|
loadMode: "cursor",
|
|
@@ -1381,7 +1371,7 @@ function TableColsConfig({ className, localStorageKey, defaultHiddenColKeys, col
|
|
|
1381
1371
|
const configColumns = generateConfigColumns(handledColumns, hiddenColKeys);
|
|
1382
1372
|
if (configColumns) toolkit_sleep(100).then(()=>{
|
|
1383
1373
|
onChangeConfig?.(configColumns);
|
|
1384
|
-
});
|
|
1374
|
+
}).catch(console.error);
|
|
1385
1375
|
}
|
|
1386
1376
|
}, [
|
|
1387
1377
|
handledColumns,
|
|
@@ -1445,7 +1435,7 @@ function TableColsConfig({ className, localStorageKey, defaultHiddenColKeys, col
|
|
|
1445
1435
|
icon: /*#__PURE__*/ jsx(IconCozSetting, {}),
|
|
1446
1436
|
color: "primary",
|
|
1447
1437
|
onClick: ()=>setVisible(true),
|
|
1448
|
-
children:
|
|
1438
|
+
children: i18n_I18n.t('column_configuration')
|
|
1449
1439
|
}),
|
|
1450
1440
|
/*#__PURE__*/ jsxs(SideSheet, {
|
|
1451
1441
|
placement: "right",
|
|
@@ -1461,7 +1451,7 @@ function TableColsConfig({ className, localStorageKey, defaultHiddenColKeys, col
|
|
|
1461
1451
|
children: [
|
|
1462
1452
|
/*#__PURE__*/ jsx("div", {
|
|
1463
1453
|
className: classnames(table_cols_config_index_module.cell, table_cols_config_index_module["cell-left"], table_cols_config_index_module["cell-thead"]),
|
|
1464
|
-
children:
|
|
1454
|
+
children: i18n_I18n.t('column_name')
|
|
1465
1455
|
}),
|
|
1466
1456
|
/*#__PURE__*/ jsx("div", {
|
|
1467
1457
|
className: classnames(table_cols_config_index_module.cell, table_cols_config_index_module["cell-right"], table_cols_config_index_module["cell-thead"]),
|
|
@@ -1508,7 +1498,7 @@ function TableHeader({ columnSelectorConfigProps, tableColsConfigProps, filterFo
|
|
|
1508
1498
|
...spaceProps || {},
|
|
1509
1499
|
children: [
|
|
1510
1500
|
refreshButtonPros ? /*#__PURE__*/ jsx(Tooltip, {
|
|
1511
|
-
content:
|
|
1501
|
+
content: i18n_I18n.t('refresh'),
|
|
1512
1502
|
theme: "dark",
|
|
1513
1503
|
children: /*#__PURE__*/ jsx(Button, {
|
|
1514
1504
|
color: "primary",
|
|
@@ -1530,7 +1520,7 @@ function TableWithoutPagination(props) {
|
|
|
1530
1520
|
const { header, heightFull = false, className } = props;
|
|
1531
1521
|
const { columns } = props.tableProps ?? {};
|
|
1532
1522
|
const tableContainerRef = useRef(null);
|
|
1533
|
-
const size = useSize(tableContainerRef
|
|
1523
|
+
const size = useSize(tableContainerRef);
|
|
1534
1524
|
const tableHeaderSize = useSize(tableContainerRef.current?.querySelector('.semi-table-header'));
|
|
1535
1525
|
const tableHeaderHeight = tableHeaderSize?.height ?? 56;
|
|
1536
1526
|
return /*#__PURE__*/ jsxs("div", {
|
|
@@ -1554,7 +1544,7 @@ function TableWithoutPagination(props) {
|
|
|
1554
1544
|
columns: columns?.filter((column)=>true !== column.hidden && false !== column.checked)?.map((column)=>({
|
|
1555
1545
|
...column,
|
|
1556
1546
|
...column.sorter && !column.sortIcon ? {
|
|
1557
|
-
sortIcon:
|
|
1547
|
+
sortIcon: createLoopTableSortIcon()
|
|
1558
1548
|
} : {}
|
|
1559
1549
|
}))
|
|
1560
1550
|
}
|
|
@@ -1568,7 +1558,7 @@ function TableBatchOperate({ actions, batchOperateStore }) {
|
|
|
1568
1558
|
if (!enableBatchOperate) return /*#__PURE__*/ jsx(Button, {
|
|
1569
1559
|
color: "primary",
|
|
1570
1560
|
onClick: ()=>setEnableBatchOperate?.(true),
|
|
1571
|
-
children:
|
|
1561
|
+
children: i18n_I18n.t('bulk_select')
|
|
1572
1562
|
});
|
|
1573
1563
|
return /*#__PURE__*/ jsxs("div", {
|
|
1574
1564
|
className: "flex items-center gap-2",
|
|
@@ -1576,16 +1566,16 @@ function TableBatchOperate({ actions, batchOperateStore }) {
|
|
|
1576
1566
|
/*#__PURE__*/ jsxs("div", {
|
|
1577
1567
|
className: "text-xs",
|
|
1578
1568
|
children: [
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1569
|
+
i18n_I18n.t('cozeloop_open_evaluate_selected_data_count', {
|
|
1570
|
+
placeholder1: selectedItems.length
|
|
1571
|
+
}),
|
|
1582
1572
|
/*#__PURE__*/ jsx("span", {
|
|
1583
1573
|
className: "ml-1 text-[rgb(var(--coze-up-brand-9))] cursor-pointer",
|
|
1584
1574
|
onClick: ()=>{
|
|
1585
1575
|
setSelectedItems([]);
|
|
1586
1576
|
setEnableBatchOperate?.(false);
|
|
1587
1577
|
},
|
|
1588
|
-
children:
|
|
1578
|
+
children: i18n_I18n.t('unselect')
|
|
1589
1579
|
})
|
|
1590
1580
|
]
|
|
1591
1581
|
}),
|
|
@@ -1771,7 +1761,7 @@ function IndexControllerView({ indexControllerStore, className }) {
|
|
|
1771
1761
|
spacing: 4,
|
|
1772
1762
|
children: [
|
|
1773
1763
|
/*#__PURE__*/ jsx(Tooltip, {
|
|
1774
|
-
content:
|
|
1764
|
+
content: i18n_I18n.t('prev_item'),
|
|
1775
1765
|
theme: "dark",
|
|
1776
1766
|
children: /*#__PURE__*/ jsx("div", {
|
|
1777
1767
|
className: "flex items-center",
|
|
@@ -1796,7 +1786,7 @@ function IndexControllerView({ indexControllerStore, className }) {
|
|
|
1796
1786
|
]
|
|
1797
1787
|
}),
|
|
1798
1788
|
/*#__PURE__*/ jsx(Tooltip, {
|
|
1799
|
-
content:
|
|
1789
|
+
content: i18n_I18n.t('next_one'),
|
|
1800
1790
|
theme: "dark",
|
|
1801
1791
|
children: /*#__PURE__*/ jsx("div", {
|
|
1802
1792
|
className: "flex items-center",
|
|
@@ -1932,7 +1922,7 @@ const BaseSearchSelect = (props)=>{
|
|
|
1932
1922
|
return /*#__PURE__*/ jsx(Select, {
|
|
1933
1923
|
suffix: showRefreshBtn && dropdownVisible ? /*#__PURE__*/ jsx(Tooltip, {
|
|
1934
1924
|
theme: "dark",
|
|
1935
|
-
content:
|
|
1925
|
+
content: i18n_I18n.t('refresh'),
|
|
1936
1926
|
children: /*#__PURE__*/ jsxs("div", {
|
|
1937
1927
|
className: "flex flex-row items-center",
|
|
1938
1928
|
children: [
|
|
@@ -1971,7 +1961,7 @@ const base_search_form_select = BaseSearchFormSelect;
|
|
|
1971
1961
|
function OpenDetailButton({ url, className }) {
|
|
1972
1962
|
return /*#__PURE__*/ jsx(Tooltip, {
|
|
1973
1963
|
theme: "dark",
|
|
1974
|
-
content:
|
|
1964
|
+
content: i18n_I18n.t('view_detail'),
|
|
1975
1965
|
children: /*#__PURE__*/ jsx(Button, {
|
|
1976
1966
|
onClick: (e)=>{
|
|
1977
1967
|
e.stopPropagation();
|
|
@@ -2110,7 +2100,6 @@ const logic_expr_index_module = {
|
|
|
2110
2100
|
};
|
|
2111
2101
|
function LogicNot(props) {
|
|
2112
2102
|
const { not, readonly, onChange, className, style } = props;
|
|
2113
|
-
const I18n = useI18n();
|
|
2114
2103
|
const onClick = ()=>{
|
|
2115
2104
|
if (readonly) return;
|
|
2116
2105
|
onChange?.(!not);
|
|
@@ -2124,7 +2113,7 @@ function LogicNot(props) {
|
|
|
2124
2113
|
e.stopPropagation();
|
|
2125
2114
|
onClick();
|
|
2126
2115
|
},
|
|
2127
|
-
children:
|
|
2116
|
+
children: i18n_I18n.t('logic_expr_not')
|
|
2128
2117
|
});
|
|
2129
2118
|
}
|
|
2130
2119
|
const LOGIC_OPTIONS = [
|
|
@@ -2152,7 +2141,6 @@ const SvgSelect = (props)=>/*#__PURE__*/ jsx("svg", {
|
|
|
2152
2141
|
});
|
|
2153
2142
|
function LogicToggle(props) {
|
|
2154
2143
|
const { operator = 'and', hideLine, enableNot, not = false, readonly, allowLogicOperators, onChange } = props;
|
|
2155
|
-
const I18n = useI18n();
|
|
2156
2144
|
const filteredLogicOptions = allowLogicOperators ? LOGIC_OPTIONS.filter((op)=>allowLogicOperators.includes(op.value)) : LOGIC_OPTIONS;
|
|
2157
2145
|
const label = filteredLogicOptions.find((op)=>op.value === operator)?.label || '-';
|
|
2158
2146
|
return /*#__PURE__*/ jsx("div", {
|
|
@@ -2163,7 +2151,7 @@ function LogicToggle(props) {
|
|
|
2163
2151
|
}),
|
|
2164
2152
|
children: readonly ? /*#__PURE__*/ jsx("div", {
|
|
2165
2153
|
className: logic_expr_index_module["logic-toggle-tag"],
|
|
2166
|
-
children:
|
|
2154
|
+
children: i18n_I18n.t(label)
|
|
2167
2155
|
}) : /*#__PURE__*/ jsx(Select, {
|
|
2168
2156
|
size: "small",
|
|
2169
2157
|
showClear: false,
|
|
@@ -2179,7 +2167,7 @@ function LogicToggle(props) {
|
|
|
2179
2167
|
onChange(operator, val);
|
|
2180
2168
|
}
|
|
2181
2169
|
}) : null,
|
|
2182
|
-
|
|
2170
|
+
i18n_I18n.t(label),
|
|
2183
2171
|
/*#__PURE__*/ jsx(SvgSelect, {
|
|
2184
2172
|
className: logic_expr_index_module["logic-toggle-tag-icon"]
|
|
2185
2173
|
})
|
|
@@ -2187,7 +2175,7 @@ function LogicToggle(props) {
|
|
|
2187
2175
|
}),
|
|
2188
2176
|
optionList: filteredLogicOptions.map((item)=>({
|
|
2189
2177
|
...item,
|
|
2190
|
-
label:
|
|
2178
|
+
label: i18n_I18n.t(item.label ?? '')
|
|
2191
2179
|
})),
|
|
2192
2180
|
value: operator,
|
|
2193
2181
|
onChange: (val)=>{
|
|
@@ -2256,7 +2244,6 @@ function defaultRightRender({ expr, readonly, size, onChange, onExprChange }) {
|
|
|
2256
2244
|
}
|
|
2257
2245
|
const ExprRender = ({ value, readonly, enableNot, className, style, path, leftRender, operatorRender, rightRender, elementSize = 'default', onChange, onDelete, renderTool, errorMsgRender })=>{
|
|
2258
2246
|
const isEdit = !readonly;
|
|
2259
|
-
const I18n = useI18n();
|
|
2260
2247
|
const [deleteButtonHover, setDeleteButtonHover] = useState(false);
|
|
2261
2248
|
const patchExpr = (expr)=>{
|
|
2262
2249
|
const newExpr = {
|
|
@@ -2338,7 +2325,7 @@ const ExprRender = ({ value, readonly, enableNot, className, style, path, leftRe
|
|
|
2338
2325
|
renderRight(),
|
|
2339
2326
|
isEdit ? /*#__PURE__*/ jsx(Tooltip, {
|
|
2340
2327
|
theme: "dark",
|
|
2341
|
-
content:
|
|
2328
|
+
content: i18n_I18n.t('logic_expr_delete_filter'),
|
|
2342
2329
|
children: /*#__PURE__*/ jsx(IconButton, {
|
|
2343
2330
|
className: classnames('expr-render-del-btn', logic_expr_index_module["expr-render-del-btn"]),
|
|
2344
2331
|
size: "small",
|
|
@@ -2380,7 +2367,6 @@ function genPath(path, index) {
|
|
|
2380
2367
|
return path ? `${path}-${index}` : `${index}`;
|
|
2381
2368
|
}
|
|
2382
2369
|
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 }) {
|
|
2383
|
-
const I18n = useI18n();
|
|
2384
2370
|
const isEdit = !readonly;
|
|
2385
2371
|
const patchExpr = (expr)=>{
|
|
2386
2372
|
if (!value) return;
|
|
@@ -2413,7 +2399,7 @@ function ExprGroupRender({ value, readonly, singleTag, enableNot, className, exp
|
|
|
2413
2399
|
type: "primary",
|
|
2414
2400
|
children: /*#__PURE__*/ jsx("span", {
|
|
2415
2401
|
className: "text-brand-9 text-[14px] leading-[20px]",
|
|
2416
|
-
children:
|
|
2402
|
+
children: i18n_I18n.t('logic_expr_add_filter')
|
|
2417
2403
|
})
|
|
2418
2404
|
}),
|
|
2419
2405
|
showAddGroupButton ? /*#__PURE__*/ jsxs(Fragment, {
|
|
@@ -2424,7 +2410,7 @@ function ExprGroupRender({ value, readonly, singleTag, enableNot, className, exp
|
|
|
2424
2410
|
/*#__PURE__*/ jsx(ToolButton, {
|
|
2425
2411
|
icon: /*#__PURE__*/ jsx(IconCozPlusCircle, {}),
|
|
2426
2412
|
onClick: ()=>onAddGroup?.(path),
|
|
2427
|
-
children:
|
|
2413
|
+
children: i18n_I18n.t('logic_expr_add_filter_group')
|
|
2428
2414
|
})
|
|
2429
2415
|
]
|
|
2430
2416
|
}) : null
|
|
@@ -2700,85 +2686,85 @@ function findFieldByPath(fields, fieldPaths) {
|
|
|
2700
2686
|
});
|
|
2701
2687
|
return field;
|
|
2702
2688
|
}
|
|
2703
|
-
const stringOperations = [
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
];
|
|
2721
|
-
const numberOperations = [
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
];
|
|
2747
|
-
const dateOperations = [
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
];
|
|
2765
|
-
const selectOperations = [
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
];
|
|
2689
|
+
const stringOperations = ()=>[
|
|
2690
|
+
{
|
|
2691
|
+
label: i18n_I18n.t('contain'),
|
|
2692
|
+
value: 'like'
|
|
2693
|
+
},
|
|
2694
|
+
{
|
|
2695
|
+
label: i18n_I18n.t('not_contain'),
|
|
2696
|
+
value: 'not-like'
|
|
2697
|
+
},
|
|
2698
|
+
{
|
|
2699
|
+
label: i18n_I18n.t('equal_to'),
|
|
2700
|
+
value: 'equals'
|
|
2701
|
+
},
|
|
2702
|
+
{
|
|
2703
|
+
label: i18n_I18n.t('not_equal_to'),
|
|
2704
|
+
value: 'not-equals'
|
|
2705
|
+
}
|
|
2706
|
+
];
|
|
2707
|
+
const numberOperations = ()=>[
|
|
2708
|
+
{
|
|
2709
|
+
label: i18n_I18n.t('equal_to'),
|
|
2710
|
+
value: 'equals'
|
|
2711
|
+
},
|
|
2712
|
+
{
|
|
2713
|
+
label: i18n_I18n.t('not_equal_to'),
|
|
2714
|
+
value: 'not-equals'
|
|
2715
|
+
},
|
|
2716
|
+
{
|
|
2717
|
+
label: i18n_I18n.t('greater_than'),
|
|
2718
|
+
value: 'greater-than'
|
|
2719
|
+
},
|
|
2720
|
+
{
|
|
2721
|
+
label: i18n_I18n.t('task_filter_gte'),
|
|
2722
|
+
value: 'greater-than-equals'
|
|
2723
|
+
},
|
|
2724
|
+
{
|
|
2725
|
+
label: i18n_I18n.t('less_than'),
|
|
2726
|
+
value: 'less-than'
|
|
2727
|
+
},
|
|
2728
|
+
{
|
|
2729
|
+
label: i18n_I18n.t('task_filter_lte'),
|
|
2730
|
+
value: 'less-than-equals'
|
|
2731
|
+
}
|
|
2732
|
+
];
|
|
2733
|
+
const dateOperations = ()=>[
|
|
2734
|
+
{
|
|
2735
|
+
label: i18n_I18n.t('equal_to'),
|
|
2736
|
+
value: 'equals'
|
|
2737
|
+
},
|
|
2738
|
+
{
|
|
2739
|
+
label: i18n_I18n.t('not_equal_to'),
|
|
2740
|
+
value: 'not-equals'
|
|
2741
|
+
},
|
|
2742
|
+
{
|
|
2743
|
+
label: i18n_I18n.t('later_than'),
|
|
2744
|
+
value: 'greater-than'
|
|
2745
|
+
},
|
|
2746
|
+
{
|
|
2747
|
+
label: i18n_I18n.t('earlier_than'),
|
|
2748
|
+
value: 'less-than'
|
|
2749
|
+
}
|
|
2750
|
+
];
|
|
2751
|
+
const selectOperations = ()=>[
|
|
2752
|
+
{
|
|
2753
|
+
label: i18n_I18n.t('contain'),
|
|
2754
|
+
value: 'contains'
|
|
2755
|
+
},
|
|
2756
|
+
{
|
|
2757
|
+
label: i18n_I18n.t('not_contain'),
|
|
2758
|
+
value: 'not-contains'
|
|
2759
|
+
}
|
|
2760
|
+
];
|
|
2775
2761
|
function StringSetter({ textAreaMode = true, ...props }) {
|
|
2776
2762
|
if (false === textAreaMode) return /*#__PURE__*/ jsx(Input, {
|
|
2777
|
-
placeholder:
|
|
2763
|
+
placeholder: i18n_I18n.t('please_enter'),
|
|
2778
2764
|
...props
|
|
2779
2765
|
});
|
|
2780
2766
|
return /*#__PURE__*/ jsx(TextArea, {
|
|
2781
|
-
placeholder:
|
|
2767
|
+
placeholder: i18n_I18n.t('please_enter'),
|
|
2782
2768
|
rows: 1,
|
|
2783
2769
|
...props
|
|
2784
2770
|
});
|
|
@@ -2786,7 +2772,7 @@ function StringSetter({ textAreaMode = true, ...props }) {
|
|
|
2786
2772
|
function NumberSetter(props) {
|
|
2787
2773
|
const { value, onChange, ...rest } = props;
|
|
2788
2774
|
return /*#__PURE__*/ jsx(CozInputNumber, {
|
|
2789
|
-
placeholder:
|
|
2775
|
+
placeholder: i18n_I18n.t('please_enter'),
|
|
2790
2776
|
...rest,
|
|
2791
2777
|
className: `w-full ${props.className ?? ''}`,
|
|
2792
2778
|
value: value ?? '',
|
|
@@ -2804,7 +2790,7 @@ function DateSetter(props) {
|
|
|
2804
2790
|
function SelectSetter(props) {
|
|
2805
2791
|
const { value, onChange, optionList = [], className = '', ...rest } = props;
|
|
2806
2792
|
return /*#__PURE__*/ jsx(Select, {
|
|
2807
|
-
placeholder:
|
|
2793
|
+
placeholder: i18n_I18n.t('please_select'),
|
|
2808
2794
|
...rest,
|
|
2809
2795
|
className: `w-full ${className}`,
|
|
2810
2796
|
optionList: optionList,
|
|
@@ -2812,33 +2798,40 @@ function SelectSetter(props) {
|
|
|
2812
2798
|
onChange: (val)=>onChange(val)
|
|
2813
2799
|
});
|
|
2814
2800
|
}
|
|
2815
|
-
|
|
2816
|
-
{
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2801
|
+
function useDataTypeList() {
|
|
2802
|
+
const [state] = useState(()=>{
|
|
2803
|
+
const dataTypeList = [
|
|
2804
|
+
{
|
|
2805
|
+
type: 'string',
|
|
2806
|
+
operations: stringOperations(),
|
|
2807
|
+
setter: StringSetter
|
|
2808
|
+
},
|
|
2809
|
+
{
|
|
2810
|
+
type: 'number',
|
|
2811
|
+
operations: numberOperations(),
|
|
2812
|
+
setter: NumberSetter
|
|
2813
|
+
},
|
|
2814
|
+
{
|
|
2815
|
+
type: 'date',
|
|
2816
|
+
operations: dateOperations(),
|
|
2817
|
+
setter: DateSetter
|
|
2818
|
+
},
|
|
2819
|
+
{
|
|
2820
|
+
type: 'options',
|
|
2821
|
+
operations: selectOperations(),
|
|
2822
|
+
setter: SelectSetter
|
|
2823
|
+
}
|
|
2824
|
+
];
|
|
2825
|
+
return dataTypeList;
|
|
2826
|
+
});
|
|
2827
|
+
return state;
|
|
2828
|
+
}
|
|
2837
2829
|
function RightRender(props) {
|
|
2838
2830
|
const { expr, onExprChange, fields, disabled = false } = props;
|
|
2839
2831
|
const field = findFieldByPath(fields, expr.left);
|
|
2840
2832
|
if (!field) return null;
|
|
2841
2833
|
if ('is-empty' === expr.operator || 'is-not-empty' === expr.operator) return null;
|
|
2834
|
+
const dataTypeList = useDataTypeList();
|
|
2842
2835
|
const Setter = field?.setter || dataTypeList.find((dataType)=>dataType.type === field.type)?.setter;
|
|
2843
2836
|
if (!Setter) return null;
|
|
2844
2837
|
return /*#__PURE__*/ jsx("div", {
|
|
@@ -2861,6 +2854,7 @@ function RightRender(props) {
|
|
|
2861
2854
|
function OperatorRender(props) {
|
|
2862
2855
|
const { expr, onExprChange, fields, disabled = false } = props;
|
|
2863
2856
|
const field = findFieldByPath(fields, expr.left);
|
|
2857
|
+
const dataTypeList = useDataTypeList();
|
|
2864
2858
|
const dataType = dataTypeList.find((item)=>item.type === field?.type);
|
|
2865
2859
|
if (!field) return null;
|
|
2866
2860
|
const { disabledOperations = [], customOperations } = field;
|
|
@@ -2870,7 +2864,7 @@ function OperatorRender(props) {
|
|
|
2870
2864
|
return /*#__PURE__*/ jsx("div", {
|
|
2871
2865
|
className: "w-24",
|
|
2872
2866
|
children: /*#__PURE__*/ jsx(Select, {
|
|
2873
|
-
placeholder:
|
|
2867
|
+
placeholder: i18n_I18n.t('operator'),
|
|
2874
2868
|
value: expr.operator,
|
|
2875
2869
|
style: {
|
|
2876
2870
|
width: '100%'
|
|
@@ -2895,10 +2889,11 @@ function fieldsToOptions(fields) {
|
|
|
2895
2889
|
}
|
|
2896
2890
|
function LeftRender(props) {
|
|
2897
2891
|
const { expr, onExprChange, fields, disabled, enableCascadeMode } = props;
|
|
2892
|
+
const dataTypeList = useDataTypeList();
|
|
2898
2893
|
if (enableCascadeMode) return /*#__PURE__*/ jsx("div", {
|
|
2899
2894
|
className: "w-56",
|
|
2900
2895
|
children: /*#__PURE__*/ jsx(Cascader, {
|
|
2901
|
-
placeholder:
|
|
2896
|
+
placeholder: i18n_I18n.t('please_select'),
|
|
2902
2897
|
value: expr.left,
|
|
2903
2898
|
className: "w-full",
|
|
2904
2899
|
disabled: disabled,
|
|
@@ -2925,7 +2920,7 @@ function LeftRender(props) {
|
|
|
2925
2920
|
return /*#__PURE__*/ jsx("div", {
|
|
2926
2921
|
className: "w-40",
|
|
2927
2922
|
children: /*#__PURE__*/ jsx(Select, {
|
|
2928
|
-
placeholder:
|
|
2923
|
+
placeholder: i18n_I18n.t('please_select'),
|
|
2929
2924
|
value: expr.left,
|
|
2930
2925
|
className: "w-full",
|
|
2931
2926
|
disabled: disabled,
|
|
@@ -3012,7 +3007,7 @@ function LogicEditor({ fields = [], disabled = false, value, popoverProps = {},
|
|
|
3012
3007
|
children: [
|
|
3013
3008
|
/*#__PURE__*/ jsx("div", {
|
|
3014
3009
|
className: "font-medium",
|
|
3015
|
-
children:
|
|
3010
|
+
children: i18n_I18n.t('filter')
|
|
3016
3011
|
}),
|
|
3017
3012
|
tooltip ? /*#__PURE__*/ jsx(Tooltip, {
|
|
3018
3013
|
theme: "dark",
|
|
@@ -3027,7 +3022,7 @@ function LogicEditor({ fields = [], disabled = false, value, popoverProps = {},
|
|
|
3027
3022
|
setLogicFilter(void 0);
|
|
3028
3023
|
onChange?.(void 0);
|
|
3029
3024
|
},
|
|
3030
|
-
children:
|
|
3025
|
+
children: i18n_I18n.t('clear_filter')
|
|
3031
3026
|
})
|
|
3032
3027
|
]
|
|
3033
3028
|
}),
|
|
@@ -3052,7 +3047,7 @@ function LogicEditor({ fields = [], disabled = false, value, popoverProps = {},
|
|
|
3052
3047
|
setVisible(false);
|
|
3053
3048
|
onClose?.();
|
|
3054
3049
|
},
|
|
3055
|
-
children:
|
|
3050
|
+
children: i18n_I18n.t('apply')
|
|
3056
3051
|
})
|
|
3057
3052
|
})
|
|
3058
3053
|
]
|
|
@@ -3079,7 +3074,7 @@ function LogicEditor({ fields = [], disabled = false, value, popoverProps = {},
|
|
|
3079
3074
|
icon: /*#__PURE__*/ jsx(IconCozFilter, {}),
|
|
3080
3075
|
color: "primary",
|
|
3081
3076
|
children: [
|
|
3082
|
-
|
|
3077
|
+
i18n_I18n.t('filter'),
|
|
3083
3078
|
count ? /*#__PURE__*/ jsx("div", {
|
|
3084
3079
|
className: "flex items-center justify-center w-5 h-5 rounded-[50%] text-brand-9 bg-brand-4 ml-1 text-[13px]",
|
|
3085
3080
|
children: count
|
|
@@ -3150,23 +3145,23 @@ var type_ImageStatus = /*#__PURE__*/ function(ImageStatus) {
|
|
|
3150
3145
|
ImageStatus["Error"] = "error";
|
|
3151
3146
|
return ImageStatus;
|
|
3152
3147
|
}({});
|
|
3153
|
-
const
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
};
|
|
3148
|
+
const getErrorTypeMap = ()=>({
|
|
3149
|
+
[ItemErrorType.MismatchSchema]: i18n_I18n.t('schema_mismatch'),
|
|
3150
|
+
[ItemErrorType.EmptyData]: i18n_I18n.t('empty_data'),
|
|
3151
|
+
[ItemErrorType.ExceedMaxItemSize]: i18n_I18n.t('single_data_size_exceeded'),
|
|
3152
|
+
[ItemErrorType.ExceedDatasetCapacity]: i18n_I18n.t('dataset_capacity_exceeded'),
|
|
3153
|
+
[ItemErrorType.MalformedFile]: i18n_I18n.t('file_format_error'),
|
|
3154
|
+
[ItemErrorType.InternalError]: i18n_I18n.t('system_error'),
|
|
3155
|
+
[ItemErrorType.IllegalContent]: i18n_I18n.t('contains_illegal_content'),
|
|
3156
|
+
[ItemErrorType.MissingRequiredField]: i18n_I18n.t('missing_required_field'),
|
|
3157
|
+
[ItemErrorType.ExceedMaxNestedDepth]: i18n_I18n.t('data_nesting_exceeds_limit'),
|
|
3158
|
+
[ItemErrorType.TransformItemFailed]: i18n_I18n.t('data_conversion_failed'),
|
|
3159
|
+
[ItemErrorType.ExceedMaxImageCount]: i18n_I18n.t('exceed_max_image_count'),
|
|
3160
|
+
[ItemErrorType.ExceedMaxImageSize]: i18n_I18n.t('exceed_max_image_size'),
|
|
3161
|
+
[ItemErrorType.GetImageFailed]: i18n_I18n.t('get_image_failed'),
|
|
3162
|
+
[ItemErrorType.IllegalExtension]: i18n_I18n.t('illegal_extension'),
|
|
3163
|
+
[ItemErrorType.UploadImageFailed]: i18n_I18n.t('cozeloop_open_evaluate_image_upload_failed')
|
|
3164
|
+
});
|
|
3170
3165
|
const UrlInputModal = ({ visible, onConfirm, onCancel, maxCount = 6, uploadImageUrl, uploadType = 'image', intranetUrlValidator })=>{
|
|
3171
3166
|
const [error, setError] = useState('');
|
|
3172
3167
|
const [isUploading, setIsUploading] = useState(false);
|
|
@@ -3182,7 +3177,7 @@ const UrlInputModal = ({ visible, onConfirm, onCancel, maxCount = 6, uploadImage
|
|
|
3182
3177
|
}
|
|
3183
3178
|
};
|
|
3184
3179
|
const handleUpload = async (formValues)=>{
|
|
3185
|
-
if (formValues?.urls?.length === 0) return void setError(
|
|
3180
|
+
if (formValues?.urls?.length === 0) return void setError(i18n_I18n.t('please_add_at_least_one_image_link'));
|
|
3186
3181
|
setIsUploading(true);
|
|
3187
3182
|
setError('');
|
|
3188
3183
|
try {
|
|
@@ -3190,7 +3185,7 @@ const UrlInputModal = ({ visible, onConfirm, onCancel, maxCount = 6, uploadImage
|
|
|
3190
3185
|
setUploadResults(results || []);
|
|
3191
3186
|
setIsUploaded(true);
|
|
3192
3187
|
} catch (err) {
|
|
3193
|
-
setError(
|
|
3188
|
+
setError(i18n_I18n.t('upload_failed_please_try_again'));
|
|
3194
3189
|
} finally{
|
|
3195
3190
|
setIsUploading(false);
|
|
3196
3191
|
}
|
|
@@ -3243,24 +3238,28 @@ const UrlInputModal = ({ visible, onConfirm, onCancel, maxCount = 6, uploadImage
|
|
|
3243
3238
|
/*#__PURE__*/ jsx(Form.Input, {
|
|
3244
3239
|
field: `urls[${idx}]`,
|
|
3245
3240
|
label: {
|
|
3246
|
-
text: `${'image' === uploadType ?
|
|
3241
|
+
text: `${'image' === uploadType ? i18n_I18n.t('image') : i18n_I18n.t('video')}${idx + 1}`,
|
|
3247
3242
|
required: true
|
|
3248
3243
|
},
|
|
3249
3244
|
fieldClassName: "flex-1",
|
|
3250
|
-
placeholder:
|
|
3245
|
+
placeholder: `${i18n_I18n.t('please_input_placeholder1_link_public', {
|
|
3246
|
+
placeholder1: 'image' === uploadType ? i18n_I18n.t('image') : i18n_I18n.t('video')
|
|
3247
|
+
})}`,
|
|
3251
3248
|
rules: [
|
|
3252
3249
|
{
|
|
3253
3250
|
validator: (_, value, cb)=>{
|
|
3254
3251
|
if (!value) {
|
|
3255
|
-
cb(
|
|
3252
|
+
cb(`${i18n_I18n.t('please_input_placeholder1_link', {
|
|
3253
|
+
placeholder1: 'image' === uploadType ? i18n_I18n.t('image') : i18n_I18n.t('video')
|
|
3254
|
+
})}`);
|
|
3256
3255
|
return false;
|
|
3257
3256
|
}
|
|
3258
3257
|
if (intranetUrlValidator && intranetUrlValidator(value)) {
|
|
3259
|
-
cb(
|
|
3258
|
+
cb(i18n_I18n.t('please_use_public_domain'));
|
|
3260
3259
|
return false;
|
|
3261
3260
|
}
|
|
3262
3261
|
if (!validateUrl(value)) {
|
|
3263
|
-
cb(
|
|
3262
|
+
cb(i18n_I18n.t('please_enter_a_valid_url'));
|
|
3264
3263
|
return false;
|
|
3265
3264
|
}
|
|
3266
3265
|
return true;
|
|
@@ -3293,7 +3292,7 @@ const UrlInputModal = ({ visible, onConfirm, onCancel, maxCount = 6, uploadImage
|
|
|
3293
3292
|
]),
|
|
3294
3293
|
className: "mt-2",
|
|
3295
3294
|
children: [
|
|
3296
|
-
|
|
3295
|
+
i18n_I18n.t('space_member_role_type_add_btn'),
|
|
3297
3296
|
/*#__PURE__*/ jsx(Typography.Text, {
|
|
3298
3297
|
className: "ml-1",
|
|
3299
3298
|
type: "secondary",
|
|
@@ -3311,7 +3310,7 @@ const UrlInputModal = ({ visible, onConfirm, onCancel, maxCount = 6, uploadImage
|
|
|
3311
3310
|
});
|
|
3312
3311
|
const columns = [
|
|
3313
3312
|
{
|
|
3314
|
-
title:
|
|
3313
|
+
title: i18n_I18n.t('image_address'),
|
|
3315
3314
|
dataIndex: 'originImage.url',
|
|
3316
3315
|
width: 220,
|
|
3317
3316
|
ellipsis: {
|
|
@@ -3319,7 +3318,7 @@ const UrlInputModal = ({ visible, onConfirm, onCancel, maxCount = 6, uploadImage
|
|
|
3319
3318
|
}
|
|
3320
3319
|
},
|
|
3321
3320
|
{
|
|
3322
|
-
title:
|
|
3321
|
+
title: i18n_I18n.t('image_preview'),
|
|
3323
3322
|
dataIndex: 'originImage.url',
|
|
3324
3323
|
width: 120,
|
|
3325
3324
|
render: (url)=>/*#__PURE__*/ jsx(Image, {
|
|
@@ -3332,7 +3331,7 @@ const UrlInputModal = ({ visible, onConfirm, onCancel, maxCount = 6, uploadImage
|
|
|
3332
3331
|
})
|
|
3333
3332
|
},
|
|
3334
3333
|
{
|
|
3335
|
-
title:
|
|
3334
|
+
title: i18n_I18n.t('status'),
|
|
3336
3335
|
key: 'status',
|
|
3337
3336
|
align: 'left',
|
|
3338
3337
|
width: 200,
|
|
@@ -3342,12 +3341,12 @@ const UrlInputModal = ({ visible, onConfirm, onCancel, maxCount = 6, uploadImage
|
|
|
3342
3341
|
/*#__PURE__*/ jsx(Tag, {
|
|
3343
3342
|
prefixIcon: record?.errorType ? /*#__PURE__*/ jsx(IconCozCrossCircleFill, {}) : /*#__PURE__*/ jsx(IconCozCheckMarkCircleFill, {}),
|
|
3344
3343
|
color: record?.errorType ? 'red' : 'green',
|
|
3345
|
-
children: record?.errorType ?
|
|
3344
|
+
children: record?.errorType ? i18n_I18n.t('failure') : i18n_I18n.t('success')
|
|
3346
3345
|
}),
|
|
3347
3346
|
/*#__PURE__*/ jsx(Typography.Text, {
|
|
3348
3347
|
type: "secondary",
|
|
3349
3348
|
className: "ml-1",
|
|
3350
|
-
children: record.errorType ?
|
|
3349
|
+
children: record.errorType ? getErrorTypeMap()[record.errorType] : ''
|
|
3351
3350
|
})
|
|
3352
3351
|
]
|
|
3353
3352
|
})
|
|
@@ -3366,13 +3365,15 @@ const UrlInputModal = ({ visible, onConfirm, onCancel, maxCount = 6, uploadImage
|
|
|
3366
3365
|
})
|
|
3367
3366
|
});
|
|
3368
3367
|
const getConfirmButtonText = ()=>{
|
|
3369
|
-
if (!uploadImageUrl) return
|
|
3370
|
-
if (isUploading) return
|
|
3371
|
-
if (isUploaded) return
|
|
3372
|
-
return
|
|
3368
|
+
if (!uploadImageUrl) return i18n_I18n.t('global_btn_confirm');
|
|
3369
|
+
if (isUploading) return i18n_I18n.t('cozeloop_open_evaluate_uploading');
|
|
3370
|
+
if (isUploaded) return `${i18n_I18n.t('import')}${'image' === uploadType ? i18n_I18n.t('image') : i18n_I18n.t('video')}`;
|
|
3371
|
+
return i18n_I18n.t('upload');
|
|
3373
3372
|
};
|
|
3374
3373
|
return /*#__PURE__*/ jsxs(Modal, {
|
|
3375
|
-
title:
|
|
3374
|
+
title: `${i18n_I18n.t('add_placeholder1_link', {
|
|
3375
|
+
placeholder1: 'image' === uploadType ? i18n_I18n.t('image') : i18n_I18n.t('video')
|
|
3376
|
+
})}`,
|
|
3376
3377
|
visible: visible,
|
|
3377
3378
|
onCancel: handleCancel,
|
|
3378
3379
|
width: 640,
|
|
@@ -3382,7 +3383,7 @@ const UrlInputModal = ({ visible, onConfirm, onCancel, maxCount = 6, uploadImage
|
|
|
3382
3383
|
/*#__PURE__*/ jsx(Button, {
|
|
3383
3384
|
onClick: handleCancel,
|
|
3384
3385
|
color: "primary",
|
|
3385
|
-
children:
|
|
3386
|
+
children: i18n_I18n.t('cancel')
|
|
3386
3387
|
}),
|
|
3387
3388
|
/*#__PURE__*/ jsx(Button, {
|
|
3388
3389
|
type: "primary",
|
|
@@ -3401,7 +3402,7 @@ const UrlInputModal = ({ visible, onConfirm, onCancel, maxCount = 6, uploadImage
|
|
|
3401
3402
|
}),
|
|
3402
3403
|
/*#__PURE__*/ jsx("span", {
|
|
3403
3404
|
className: "ml-2",
|
|
3404
|
-
children:
|
|
3405
|
+
children: i18n_I18n.t('cozeloop_open_evaluate_uploading_image')
|
|
3405
3406
|
})
|
|
3406
3407
|
]
|
|
3407
3408
|
}) : null,
|
|
@@ -3503,10 +3504,10 @@ const VideoItemRenderer = ({ className, style, spaceID, item, onRemove, onChange
|
|
|
3503
3504
|
}),
|
|
3504
3505
|
status === type_ImageStatus.Error ? /*#__PURE__*/ jsx("div", {
|
|
3505
3506
|
className: "text-sm text-red-500",
|
|
3506
|
-
children:
|
|
3507
|
+
children: i18n_I18n.t('upload_fail')
|
|
3507
3508
|
}) : null,
|
|
3508
3509
|
/*#__PURE__*/ jsx(Modal, {
|
|
3509
|
-
title:
|
|
3510
|
+
title: i18n_I18n.t('video_preview'),
|
|
3510
3511
|
footer: null,
|
|
3511
3512
|
visible: visible,
|
|
3512
3513
|
onCancel: ()=>setVisible(false),
|
|
@@ -3624,7 +3625,7 @@ const ImageItemRenderer = ({ className, style, spaceID, item, onRemove, onChange
|
|
|
3624
3625
|
}),
|
|
3625
3626
|
status === type_ImageStatus.Error && /*#__PURE__*/ jsx("div", {
|
|
3626
3627
|
className: "text-sm text-red-500",
|
|
3627
|
-
children:
|
|
3628
|
+
children: i18n_I18n.t('upload_fail')
|
|
3628
3629
|
})
|
|
3629
3630
|
]
|
|
3630
3631
|
});
|
|
@@ -3649,7 +3650,7 @@ const MultipartItemRenderer = ({ item, readonly, onChange, onRemove })=>{
|
|
|
3649
3650
|
maxRows: 3
|
|
3650
3651
|
},
|
|
3651
3652
|
disabled: readonly,
|
|
3652
|
-
placeholder:
|
|
3653
|
+
placeholder: i18n_I18n.t('please_input_text')
|
|
3653
3654
|
}),
|
|
3654
3655
|
readonly ? null : /*#__PURE__*/ jsx(Button, {
|
|
3655
3656
|
icon: /*#__PURE__*/ jsx(IconCozTrashCan, {}),
|
|
@@ -3852,12 +3853,16 @@ const MultipartEditor = ({ spaceID, uploadFile, value, onChange, className, mult
|
|
|
3852
3853
|
};
|
|
3853
3854
|
const getDisabledTooltip = useCallback(({ type, exceed, disabled })=>{
|
|
3854
3855
|
if (type === ContentType.Image) {
|
|
3855
|
-
if (exceed) return
|
|
3856
|
-
|
|
3856
|
+
if (exceed) return `${i18n_I18n.t('multi_modal_image_limit_reached', {
|
|
3857
|
+
canUseFileLimit
|
|
3858
|
+
})}`;
|
|
3859
|
+
if (disabled) return i18n_I18n.t('model_not_support_multi_modal_image');
|
|
3857
3860
|
} else {
|
|
3858
|
-
if ('Video' !== type) return
|
|
3859
|
-
if (exceed) return
|
|
3860
|
-
|
|
3861
|
+
if ('Video' !== type) return i18n_I18n.t('model_not_support_multi_modal');
|
|
3862
|
+
if (exceed) return `${i18n_I18n.t('multi_modal_video_limit_reached', {
|
|
3863
|
+
canUseFileLimit
|
|
3864
|
+
})}`;
|
|
3865
|
+
if (disabled) return i18n_I18n.t('model_not_support_multi_modal_video');
|
|
3861
3866
|
}
|
|
3862
3867
|
}, []);
|
|
3863
3868
|
const renderImageSubMenu = useCallback((children)=>/*#__PURE__*/ jsx(TooltipWhenDisabled, {
|
|
@@ -3894,14 +3899,14 @@ const MultipartEditor = ({ spaceID, uploadFile, value, onChange, className, mult
|
|
|
3894
3899
|
/*#__PURE__*/ jsx(Menu.Item, {
|
|
3895
3900
|
onClick: handleAddText,
|
|
3896
3901
|
disabled: imageCount >= maxPartCount,
|
|
3897
|
-
children:
|
|
3902
|
+
children: i18n_I18n.t('text')
|
|
3898
3903
|
}),
|
|
3899
3904
|
imageHidden ? null : /*#__PURE__*/ jsx(Menu.Item, {
|
|
3900
3905
|
onClick: handleAddImageFile,
|
|
3901
3906
|
disabled: exceedFileCount || !imageEnabled,
|
|
3902
3907
|
children: renderImageSubMenu(/*#__PURE__*/ jsx("span", {
|
|
3903
3908
|
className: "w-full",
|
|
3904
|
-
children:
|
|
3909
|
+
children: i18n_I18n.t('image_source_file')
|
|
3905
3910
|
}))
|
|
3906
3911
|
}),
|
|
3907
3912
|
imageHidden ? null : /*#__PURE__*/ jsx(Menu.Item, {
|
|
@@ -3909,7 +3914,7 @@ const MultipartEditor = ({ spaceID, uploadFile, value, onChange, className, mult
|
|
|
3909
3914
|
disabled: exceedFileCount || !imageEnabled,
|
|
3910
3915
|
children: renderImageSubMenu(/*#__PURE__*/ jsx("span", {
|
|
3911
3916
|
className: "w-full",
|
|
3912
|
-
children:
|
|
3917
|
+
children: i18n_I18n.t('image_external_link')
|
|
3913
3918
|
}))
|
|
3914
3919
|
}),
|
|
3915
3920
|
videoHidden ? null : /*#__PURE__*/ jsx(Menu.Item, {
|
|
@@ -3917,7 +3922,7 @@ const MultipartEditor = ({ spaceID, uploadFile, value, onChange, className, mult
|
|
|
3917
3922
|
disabled: exceedFileCount || !videoEnabled,
|
|
3918
3923
|
children: renderVideoSubMenu(/*#__PURE__*/ jsx("span", {
|
|
3919
3924
|
className: "w-full",
|
|
3920
|
-
children:
|
|
3925
|
+
children: i18n_I18n.t('video_source_file')
|
|
3921
3926
|
}))
|
|
3922
3927
|
}),
|
|
3923
3928
|
videoHidden ? null : /*#__PURE__*/ jsx(Menu.Item, {
|
|
@@ -3925,7 +3930,7 @@ const MultipartEditor = ({ spaceID, uploadFile, value, onChange, className, mult
|
|
|
3925
3930
|
disabled: exceedFileCount || !videoEnabled,
|
|
3926
3931
|
children: renderVideoSubMenu(/*#__PURE__*/ jsx("span", {
|
|
3927
3932
|
className: "w-full",
|
|
3928
|
-
children:
|
|
3933
|
+
children: i18n_I18n.t('video_external_link')
|
|
3929
3934
|
}))
|
|
3930
3935
|
})
|
|
3931
3936
|
]
|
|
@@ -4006,7 +4011,7 @@ const MultipartEditor = ({ spaceID, uploadFile, value, onChange, className, mult
|
|
|
4006
4011
|
color: "primary",
|
|
4007
4012
|
disabled: true,
|
|
4008
4013
|
children: [
|
|
4009
|
-
|
|
4014
|
+
i18n_I18n.t('add_data'),
|
|
4010
4015
|
/*#__PURE__*/ jsx(Typography.Text, {
|
|
4011
4016
|
className: "ml-1 !text-inherit",
|
|
4012
4017
|
type: "secondary",
|
|
@@ -4025,7 +4030,7 @@ const MultipartEditor = ({ spaceID, uploadFile, value, onChange, className, mult
|
|
|
4025
4030
|
color: "primary",
|
|
4026
4031
|
disabled: items.length >= maxPartCount,
|
|
4027
4032
|
children: [
|
|
4028
|
-
|
|
4033
|
+
i18n_I18n.t('add_data'),
|
|
4029
4034
|
/*#__PURE__*/ jsx(Typography.Text, {
|
|
4030
4035
|
className: "ml-1",
|
|
4031
4036
|
type: "secondary",
|
|
@@ -4039,7 +4044,7 @@ const MultipartEditor = ({ spaceID, uploadFile, value, onChange, className, mult
|
|
|
4039
4044
|
action: "",
|
|
4040
4045
|
maxSize: maxFileSize,
|
|
4041
4046
|
onSizeError: ()=>{
|
|
4042
|
-
Toast.error(
|
|
4047
|
+
Toast.error(i18n_I18n.t('cozeloop_open_evaluate_image_size_limit_20mb'));
|
|
4043
4048
|
},
|
|
4044
4049
|
accept: supportedFormats,
|
|
4045
4050
|
customRequest: handleUploadFile,
|
|
@@ -4050,7 +4055,7 @@ const MultipartEditor = ({ spaceID, uploadFile, value, onChange, className, mult
|
|
|
4050
4055
|
multiple: true,
|
|
4051
4056
|
limit: canUseFileLimit > canUsePartLimit ? canUsePartLimit : canUseFileLimit,
|
|
4052
4057
|
onExceed: ()=>{
|
|
4053
|
-
Toast.error(
|
|
4058
|
+
Toast.error(i18n_I18n.t('image_or_node_quantity_limit'));
|
|
4054
4059
|
}
|
|
4055
4060
|
}),
|
|
4056
4061
|
showUrlModal ? /*#__PURE__*/ jsx(UrlInputModal, {
|
|
@@ -4130,7 +4135,7 @@ const UploadButton = /*#__PURE__*/ forwardRef(({ spaceID, disabled, maxImageSize
|
|
|
4130
4135
|
onFilePartsChange?.(newPart);
|
|
4131
4136
|
} catch (error) {
|
|
4132
4137
|
console.info('error', error);
|
|
4133
|
-
Toast.error(
|
|
4138
|
+
Toast.error(i18n_I18n.t('image_upload_error'));
|
|
4134
4139
|
onFilePartsChange?.({
|
|
4135
4140
|
...part,
|
|
4136
4141
|
status: 'uploadFail'
|
|
@@ -4146,8 +4151,12 @@ const UploadButton = /*#__PURE__*/ forwardRef(({ spaceID, disabled, maxImageSize
|
|
|
4146
4151
|
showUploadList: false,
|
|
4147
4152
|
maxSize: maxImageSize ? 1024 * maxImageSize * 1024 : 0,
|
|
4148
4153
|
limit: fileLimit,
|
|
4149
|
-
onSizeError: ()=>Toast.error(
|
|
4150
|
-
|
|
4154
|
+
onSizeError: ()=>Toast.error(`${i18n_I18n.t('image_size_exceed_max', {
|
|
4155
|
+
maxImageSize
|
|
4156
|
+
})}`),
|
|
4157
|
+
onExceed: ()=>Toast.warning(`${i18n_I18n.t('max_upload_images_limit', {
|
|
4158
|
+
maxFileCount
|
|
4159
|
+
})}`),
|
|
4151
4160
|
multiple: true,
|
|
4152
4161
|
fileList: fileParts.map((it)=>({
|
|
4153
4162
|
uid: it.uid || '',
|
|
@@ -4171,8 +4180,12 @@ const UploadButton = /*#__PURE__*/ forwardRef(({ spaceID, disabled, maxImageSize
|
|
|
4171
4180
|
showUploadList: false,
|
|
4172
4181
|
maxSize: maxVideoSize ? 1024 * maxVideoSize : 0,
|
|
4173
4182
|
limit: fileLimit,
|
|
4174
|
-
onSizeError: ()=>Toast.error(
|
|
4175
|
-
|
|
4183
|
+
onSizeError: ()=>Toast.error(`${i18n_I18n.t('video_size_exceed_max', {
|
|
4184
|
+
maxVideoSize
|
|
4185
|
+
})}`),
|
|
4186
|
+
onExceed: ()=>Toast.warning(`${i18n_I18n.t('max_upload_videos_limit', {
|
|
4187
|
+
maxFileCount
|
|
4188
|
+
})}`),
|
|
4176
4189
|
multiple: true,
|
|
4177
4190
|
fileList: fileParts.map((it)=>({
|
|
4178
4191
|
uid: it.uid || '',
|
|
@@ -4198,14 +4211,14 @@ const UploadButton = /*#__PURE__*/ forwardRef(({ spaceID, disabled, maxImageSize
|
|
|
4198
4211
|
color: "primary",
|
|
4199
4212
|
disabled: disabled,
|
|
4200
4213
|
"data-btm": "d41383",
|
|
4201
|
-
"data-btm-title":
|
|
4214
|
+
"data-btm-title": i18n_I18n.t('image_upload')
|
|
4202
4215
|
}));
|
|
4203
4216
|
if (!imageEnabled && videoEnabled) return renderVideoUpload(/*#__PURE__*/ jsx(IconButton, {
|
|
4204
4217
|
icon: /*#__PURE__*/ jsx(IconCozVideo, {}),
|
|
4205
4218
|
color: "primary",
|
|
4206
4219
|
disabled: disabled,
|
|
4207
4220
|
"data-btm": "d27622",
|
|
4208
|
-
"data-btm-title":
|
|
4221
|
+
"data-btm-title": i18n_I18n.t('video_upload')
|
|
4209
4222
|
}));
|
|
4210
4223
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
4211
4224
|
children: [
|
|
@@ -4218,16 +4231,16 @@ const UploadButton = /*#__PURE__*/ forwardRef(({ spaceID, disabled, maxImageSize
|
|
|
4218
4231
|
uploadImgRef.current?.openFileDialog();
|
|
4219
4232
|
},
|
|
4220
4233
|
"data-btm": "d41383",
|
|
4221
|
-
"data-btm-title":
|
|
4222
|
-
children:
|
|
4234
|
+
"data-btm-title": i18n_I18n.t('image_upload'),
|
|
4235
|
+
children: i18n_I18n.t('image_upload')
|
|
4223
4236
|
}),
|
|
4224
4237
|
/*#__PURE__*/ jsx(Menu.Item, {
|
|
4225
4238
|
onClick: ()=>{
|
|
4226
4239
|
uploadVideoRef.current?.openFileDialog();
|
|
4227
4240
|
},
|
|
4228
4241
|
"data-btm": "d27622",
|
|
4229
|
-
"data-btm-title":
|
|
4230
|
-
children:
|
|
4242
|
+
"data-btm-title": i18n_I18n.t('video_upload'),
|
|
4243
|
+
children: i18n_I18n.t('video_upload')
|
|
4231
4244
|
})
|
|
4232
4245
|
]
|
|
4233
4246
|
}),
|
|
@@ -4426,76 +4439,6 @@ function LoopRadioGroup({ className, ...props }) {
|
|
|
4426
4439
|
...props
|
|
4427
4440
|
});
|
|
4428
4441
|
}
|
|
4429
|
-
const code_item_module = {
|
|
4430
|
-
"usage-detail": "usage-detail-avIFhw",
|
|
4431
|
-
usageDetail: "usage-detail-avIFhw"
|
|
4432
|
-
};
|
|
4433
|
-
var code_usage_SupportedLang = /*#__PURE__*/ function(SupportedLang) {
|
|
4434
|
-
SupportedLang["Golang"] = "go";
|
|
4435
|
-
SupportedLang["Js"] = "javascript";
|
|
4436
|
-
SupportedLang["Python"] = "python";
|
|
4437
|
-
return SupportedLang;
|
|
4438
|
-
}({});
|
|
4439
|
-
const UsageContent = ({ content, copyable, lang = "javascript", height = 300 })=>/*#__PURE__*/ jsxs("div", {
|
|
4440
|
-
className: "bg-[var(--semi-color-fill-0)] p-[16px] rounded-[8px] text-[14px] flex",
|
|
4441
|
-
children: [
|
|
4442
|
-
/*#__PURE__*/ jsx("div", {
|
|
4443
|
-
className: "flex-1 whitespace-pre-wrap break-all",
|
|
4444
|
-
children: /*#__PURE__*/ jsx(_monaco_editor_react, {
|
|
4445
|
-
width: '100%',
|
|
4446
|
-
height: height,
|
|
4447
|
-
language: lang,
|
|
4448
|
-
value: content,
|
|
4449
|
-
theme: 'code-block-grey',
|
|
4450
|
-
options: {
|
|
4451
|
-
minimap: {
|
|
4452
|
-
enabled: false
|
|
4453
|
-
},
|
|
4454
|
-
wordWrap: 'on',
|
|
4455
|
-
scrollBeyondLastLine: false,
|
|
4456
|
-
unicodeHighlight: {
|
|
4457
|
-
ambiguousCharacters: false
|
|
4458
|
-
},
|
|
4459
|
-
lineNumbers: 'on',
|
|
4460
|
-
formatOnPaste: true,
|
|
4461
|
-
readOnly: true
|
|
4462
|
-
},
|
|
4463
|
-
beforeMount: (monaco)=>{
|
|
4464
|
-
monaco.editor.defineTheme('code-block-grey', {
|
|
4465
|
-
base: 'vs',
|
|
4466
|
-
inherit: true,
|
|
4467
|
-
rules: [],
|
|
4468
|
-
colors: {
|
|
4469
|
-
'editor.background': '#F4F4F4'
|
|
4470
|
-
}
|
|
4471
|
-
});
|
|
4472
|
-
}
|
|
4473
|
-
})
|
|
4474
|
-
}),
|
|
4475
|
-
/*#__PURE__*/ jsx("div", {
|
|
4476
|
-
className: "ml-[8px]",
|
|
4477
|
-
children: copyable ? /*#__PURE__*/ jsx(IconCozCopy, {
|
|
4478
|
-
className: "ml-[4px] text-[var(--coz-fg-dim)] cursor-pointer hover:coz-fg-primary",
|
|
4479
|
-
onClick: ()=>handleCopy(content || '')
|
|
4480
|
-
}) : null
|
|
4481
|
-
})
|
|
4482
|
-
]
|
|
4483
|
-
});
|
|
4484
|
-
const UsageItem = ({ title, content, lang, contentHeight })=>/*#__PURE__*/ jsxs("div", {
|
|
4485
|
-
className: code_item_module["usage-detail"],
|
|
4486
|
-
children: [
|
|
4487
|
-
/*#__PURE__*/ jsx("div", {
|
|
4488
|
-
className: "text-[#16px] font-[500] mb-4",
|
|
4489
|
-
children: title
|
|
4490
|
-
}),
|
|
4491
|
-
content ? /*#__PURE__*/ jsx(UsageContent, {
|
|
4492
|
-
content: content,
|
|
4493
|
-
copyable: true,
|
|
4494
|
-
lang: lang,
|
|
4495
|
-
height: contentHeight
|
|
4496
|
-
}) : null
|
|
4497
|
-
]
|
|
4498
|
-
});
|
|
4499
4442
|
const layout_index_module = {
|
|
4500
4443
|
tabs: "tabs-GNhC2M"
|
|
4501
4444
|
};
|
|
@@ -4549,31 +4492,63 @@ function TitleWithSub({ title, subTitle, className }) {
|
|
|
4549
4492
|
]
|
|
4550
4493
|
});
|
|
4551
4494
|
}
|
|
4495
|
+
const CozeLoopContext = /*#__PURE__*/ createContext({});
|
|
4496
|
+
function CozeLoopProvider({ children, defaultLanguage, resources, sendEvent }) {
|
|
4497
|
+
const isInitialized = useRef(false);
|
|
4498
|
+
const [initialized, setInitialized] = useState(false);
|
|
4499
|
+
useEffect(()=>{
|
|
4500
|
+
if (resources && !isInitialized.current) initIntl({
|
|
4501
|
+
lng: defaultLanguage,
|
|
4502
|
+
resources
|
|
4503
|
+
}).then(()=>{
|
|
4504
|
+
isInitialized.current = true;
|
|
4505
|
+
setInitialized(true);
|
|
4506
|
+
}).catch((error)=>{
|
|
4507
|
+
console.error('Error initializing intl:', error);
|
|
4508
|
+
isInitialized.current = true;
|
|
4509
|
+
setInitialized(true);
|
|
4510
|
+
});
|
|
4511
|
+
}, [
|
|
4512
|
+
resources,
|
|
4513
|
+
defaultLanguage
|
|
4514
|
+
]);
|
|
4515
|
+
if (!initialized) return /*#__PURE__*/ jsx(PageLoading, {});
|
|
4516
|
+
return /*#__PURE__*/ jsx(CozeLoopContext.Provider, {
|
|
4517
|
+
value: {
|
|
4518
|
+
sendEvent
|
|
4519
|
+
},
|
|
4520
|
+
children: children
|
|
4521
|
+
});
|
|
4522
|
+
}
|
|
4523
|
+
function useReportEvent() {
|
|
4524
|
+
const context = useContext(CozeLoopContext);
|
|
4525
|
+
return context.sendEvent ?? ((name, params)=>{
|
|
4526
|
+
console.info(name, params);
|
|
4527
|
+
});
|
|
4528
|
+
}
|
|
4552
4529
|
function FooterActions({ confirmBtnProps: { text: confirmBtnText, ...confirmBtnProps } = {}, cancelBtnProps: { text: cancelBtnText, ...cancelBtnProps } = {} }) {
|
|
4553
|
-
const I18n = useI18n();
|
|
4554
4530
|
return /*#__PURE__*/ jsxs("div", {
|
|
4555
4531
|
className: "flex justify-end",
|
|
4556
4532
|
children: [
|
|
4557
4533
|
/*#__PURE__*/ jsx(Button, {
|
|
4558
4534
|
color: "primary",
|
|
4559
4535
|
...cancelBtnProps,
|
|
4560
|
-
children: cancelBtnText ??
|
|
4536
|
+
children: cancelBtnText ?? i18n_I18n.t('cancel')
|
|
4561
4537
|
}),
|
|
4562
4538
|
/*#__PURE__*/ jsx(Button, {
|
|
4563
4539
|
className: "ml-2",
|
|
4564
4540
|
...confirmBtnProps,
|
|
4565
|
-
children: confirmBtnText ??
|
|
4541
|
+
children: confirmBtnText ?? i18n_I18n.t('global_btn_confirm')
|
|
4566
4542
|
})
|
|
4567
4543
|
]
|
|
4568
4544
|
});
|
|
4569
4545
|
}
|
|
4570
4546
|
function TableEmpty({ className, ...props }) {
|
|
4571
|
-
const I18n = useI18n();
|
|
4572
4547
|
return /*#__PURE__*/ jsx(EmptyState, {
|
|
4573
4548
|
className: classnames('my-10', className),
|
|
4574
4549
|
icon: /*#__PURE__*/ jsx(IconCozIllusNone, {}),
|
|
4575
4550
|
darkModeIcon: /*#__PURE__*/ jsx(IconCozIllusNoneDark, {}),
|
|
4576
|
-
description:
|
|
4551
|
+
description: i18n_I18n.t('no_data'),
|
|
4577
4552
|
...props
|
|
4578
4553
|
});
|
|
4579
4554
|
}
|
|
@@ -5364,9 +5339,6 @@ const SentinelFormInner = ({ formID, children, onValueChange, onSubmit, getFormA
|
|
|
5364
5339
|
time_str: dayjs(closeTime).format('YYYY-MM-DD HH:mm:ss')
|
|
5365
5340
|
});
|
|
5366
5341
|
};
|
|
5367
|
-
const onFormCloseDobounce = useDebounceFn(onFormClose, {
|
|
5368
|
-
wait: 200
|
|
5369
|
-
});
|
|
5370
5342
|
const onValuesChange = (values, changedValues)=>{
|
|
5371
5343
|
handleValueChange(changedValues);
|
|
5372
5344
|
onValueChange?.(values, changedValues);
|
|
@@ -5402,12 +5374,17 @@ const SentinelFormInner = ({ formID, children, onValueChange, onSubmit, getFormA
|
|
|
5402
5374
|
return ()=>{
|
|
5403
5375
|
if (formID && sessionID && !flushedRef.current) {
|
|
5404
5376
|
flushedRef.current = true;
|
|
5405
|
-
|
|
5406
|
-
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
|
|
5410
|
-
|
|
5377
|
+
try {
|
|
5378
|
+
sendEvent?.(enum_EventNames.LOOP_FORM_FIELD_CHANGE_TIMELINE, {
|
|
5379
|
+
form_id: formID,
|
|
5380
|
+
session_id: sessionID,
|
|
5381
|
+
time_line: JSON.stringify(operationTimelineRef.current)
|
|
5382
|
+
});
|
|
5383
|
+
} catch (err) {
|
|
5384
|
+
console.error(err);
|
|
5385
|
+
} finally{
|
|
5386
|
+
onFormClose();
|
|
5387
|
+
}
|
|
5411
5388
|
}
|
|
5412
5389
|
};
|
|
5413
5390
|
}, [
|
|
@@ -5421,12 +5398,17 @@ const SentinelFormInner = ({ formID, children, onValueChange, onSubmit, getFormA
|
|
|
5421
5398
|
const sid = sessionIdRef.current;
|
|
5422
5399
|
if (!fid || !sid) return;
|
|
5423
5400
|
flushedRef.current = true;
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
|
|
5427
|
-
|
|
5428
|
-
|
|
5429
|
-
|
|
5401
|
+
try {
|
|
5402
|
+
sendEvent?.(enum_EventNames.LOOP_FORM_FIELD_CHANGE_TIMELINE, {
|
|
5403
|
+
form_id: fid,
|
|
5404
|
+
session_id: sid,
|
|
5405
|
+
time_line: JSON.stringify(operationTimelineRef.current)
|
|
5406
|
+
});
|
|
5407
|
+
} catch (err) {
|
|
5408
|
+
console.error(err);
|
|
5409
|
+
} finally{
|
|
5410
|
+
onFormClose();
|
|
5411
|
+
}
|
|
5430
5412
|
};
|
|
5431
5413
|
window.addEventListener('pagehide', flushOnClose);
|
|
5432
5414
|
window.addEventListener('beforeunload', flushOnClose);
|
|
@@ -5720,6 +5702,11 @@ languages.register('json', {
|
|
|
5720
5702
|
languageService: json.languageService
|
|
5721
5703
|
});
|
|
5722
5704
|
languages.register('shell', shell);
|
|
5705
|
+
languages.register('python', python);
|
|
5706
|
+
languages.register("typescript", typescript);
|
|
5707
|
+
languages.register('go', {
|
|
5708
|
+
language: goLanguage
|
|
5709
|
+
});
|
|
5723
5710
|
themes.register('coze-light', cozeLight);
|
|
5724
5711
|
themes.register('coze-dark', cozeDark);
|
|
5725
5712
|
const minHeightOption = (value)=>EditorView.theme({
|
|
@@ -5759,7 +5746,7 @@ function createStyleOptions() {
|
|
|
5759
5746
|
return [
|
|
5760
5747
|
react_option('minHeight', minHeightOption),
|
|
5761
5748
|
react_option('maxHeight', maxHeightOption),
|
|
5762
|
-
react_option('
|
|
5749
|
+
react_option('editorHeight', heightOption),
|
|
5763
5750
|
react_option('borderRadius', borderRadiusOption),
|
|
5764
5751
|
react_option('padding', paddingOption),
|
|
5765
5752
|
react_option('lineHeight', lineHeightOption)
|
|
@@ -5853,15 +5840,20 @@ const transformer = transformerCreator((text)=>{
|
|
|
5853
5840
|
return text;
|
|
5854
5841
|
});
|
|
5855
5842
|
const CodeMirrorJsonEditor = /*#__PURE__*/ react.forwardRef((props, ref)=>{
|
|
5856
|
-
const { value, onChange, placeholder, className, isDarkTheme, readonly, minHeight = '100px', maxHeight,
|
|
5843
|
+
const { value, onChange, placeholder, className, isDarkTheme, readonly, minHeight = '100px', maxHeight, editorHeight, padding, borderRadius, onFocus, onBlur } = props;
|
|
5857
5844
|
const apiRef = useRef(null);
|
|
5858
5845
|
const handleChange = useCallback((e)=>{
|
|
5859
5846
|
if ('function' == typeof onChange) onChange(e.value);
|
|
5860
5847
|
}, [
|
|
5861
5848
|
onChange
|
|
5862
5849
|
]);
|
|
5863
|
-
|
|
5850
|
+
const updateAst = useDebounceFn(()=>{
|
|
5864
5851
|
apiRef.current?.updateASTDecorations();
|
|
5852
|
+
}, {
|
|
5853
|
+
wait: 200
|
|
5854
|
+
});
|
|
5855
|
+
useEffect(()=>{
|
|
5856
|
+
updateAst.run();
|
|
5865
5857
|
}, [
|
|
5866
5858
|
isDarkTheme
|
|
5867
5859
|
]);
|
|
@@ -5897,7 +5889,7 @@ const CodeMirrorJsonEditor = /*#__PURE__*/ react.forwardRef((props, ref)=>{
|
|
|
5897
5889
|
transformer,
|
|
5898
5890
|
minHeight,
|
|
5899
5891
|
maxHeight,
|
|
5900
|
-
|
|
5892
|
+
editorHeight,
|
|
5901
5893
|
borderRadius,
|
|
5902
5894
|
padding,
|
|
5903
5895
|
fontSize: 13,
|
|
@@ -5946,6 +5938,106 @@ const CodeMirrorRawTextEditor = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
5946
5938
|
})
|
|
5947
5939
|
});
|
|
5948
5940
|
});
|
|
5941
|
+
const raw_code_editor_extensions = [
|
|
5942
|
+
EditorView.theme({
|
|
5943
|
+
'.cm-activeLineGutter': {
|
|
5944
|
+
backgroundColor: 'transparent !important'
|
|
5945
|
+
},
|
|
5946
|
+
'.cm-activeLine': {
|
|
5947
|
+
backgroundColor: 'transparent !important'
|
|
5948
|
+
}
|
|
5949
|
+
})
|
|
5950
|
+
];
|
|
5951
|
+
function raw_code_editor_findAllMatches(inputString, regex) {
|
|
5952
|
+
const globalRegex = new RegExp(regex, regex.flags.includes('g') ? regex.flags : `${regex.flags}g`);
|
|
5953
|
+
let match;
|
|
5954
|
+
const matches = [];
|
|
5955
|
+
while(true){
|
|
5956
|
+
match = globalRegex.exec(inputString);
|
|
5957
|
+
if (!match) break;
|
|
5958
|
+
if (match.index === globalRegex.lastIndex) globalRegex.lastIndex++;
|
|
5959
|
+
matches.push({
|
|
5960
|
+
match: match[0],
|
|
5961
|
+
range: [
|
|
5962
|
+
match.index,
|
|
5963
|
+
match.index + match[0].length
|
|
5964
|
+
]
|
|
5965
|
+
});
|
|
5966
|
+
}
|
|
5967
|
+
return matches;
|
|
5968
|
+
}
|
|
5969
|
+
const raw_code_editor_transformer = transformerCreator((text)=>{
|
|
5970
|
+
const originalSource = text.toString();
|
|
5971
|
+
const matches = raw_code_editor_findAllMatches(originalSource, /\{\{([^\}]*)\}\}/g);
|
|
5972
|
+
if (matches.length > 0) matches.forEach(({ range })=>{
|
|
5973
|
+
text.replaceRange(range[0], range[1], 'null');
|
|
5974
|
+
});
|
|
5975
|
+
return text;
|
|
5976
|
+
});
|
|
5977
|
+
const CodeMirrorRawCodeEditor = /*#__PURE__*/ react.forwardRef((props, ref)=>{
|
|
5978
|
+
const { value, onChange, placeholder, className, isDarkTheme, readonly, minHeight = '100px', maxHeight, editorHeight, padding, borderRadius, onFocus, onBlur, language = 'shell' } = props;
|
|
5979
|
+
const apiRef = useRef(null);
|
|
5980
|
+
const handleChange = useCallback((e)=>{
|
|
5981
|
+
if ('function' == typeof onChange) onChange(e.value);
|
|
5982
|
+
}, [
|
|
5983
|
+
onChange
|
|
5984
|
+
]);
|
|
5985
|
+
const updateAst = useDebounceFn(()=>{
|
|
5986
|
+
apiRef.current?.updateASTDecorations();
|
|
5987
|
+
}, {
|
|
5988
|
+
wait: 200
|
|
5989
|
+
});
|
|
5990
|
+
useEffect(()=>{
|
|
5991
|
+
updateAst.run();
|
|
5992
|
+
}, [
|
|
5993
|
+
isDarkTheme
|
|
5994
|
+
]);
|
|
5995
|
+
useEffect(()=>{
|
|
5996
|
+
const editor = apiRef.current;
|
|
5997
|
+
if (!editor) return;
|
|
5998
|
+
if ('string' == typeof value && value !== editor.getValue()) editor.setValue(value);
|
|
5999
|
+
}, [
|
|
6000
|
+
value
|
|
6001
|
+
]);
|
|
6002
|
+
const formatJson = async ()=>{
|
|
6003
|
+
const view = apiRef.current?.$view;
|
|
6004
|
+
if (!view) return;
|
|
6005
|
+
view.dispatch(await json.languageService.format(view.state, {
|
|
6006
|
+
tabSize: 2
|
|
6007
|
+
}));
|
|
6008
|
+
};
|
|
6009
|
+
useImperativeHandle(ref, ()=>({
|
|
6010
|
+
formatJson
|
|
6011
|
+
}));
|
|
6012
|
+
return /*#__PURE__*/ jsx(EditorProvider, {
|
|
6013
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
6014
|
+
className: className,
|
|
6015
|
+
children: /*#__PURE__*/ jsx(CodeMirrorCodeEditor, {
|
|
6016
|
+
defaultValue: value ?? '',
|
|
6017
|
+
onChange: handleChange,
|
|
6018
|
+
options: {
|
|
6019
|
+
placeholder,
|
|
6020
|
+
lineWrapping: true,
|
|
6021
|
+
theme: isDarkTheme ? 'coze-dark' : 'coze-light',
|
|
6022
|
+
languageId: language,
|
|
6023
|
+
editable: !readonly,
|
|
6024
|
+
transformer: raw_code_editor_transformer,
|
|
6025
|
+
minHeight,
|
|
6026
|
+
maxHeight,
|
|
6027
|
+
editorHeight,
|
|
6028
|
+
borderRadius,
|
|
6029
|
+
padding,
|
|
6030
|
+
fontSize: 13,
|
|
6031
|
+
lineHeight: 20
|
|
6032
|
+
},
|
|
6033
|
+
didMount: (api)=>apiRef.current = api,
|
|
6034
|
+
extensions: raw_code_editor_extensions,
|
|
6035
|
+
onFocus: onFocus,
|
|
6036
|
+
onBlur: onBlur
|
|
6037
|
+
})
|
|
6038
|
+
})
|
|
6039
|
+
});
|
|
6040
|
+
});
|
|
5949
6041
|
const SchemaEditor = ({ value, onChange, placeholder, readOnly, language, className })=>/*#__PURE__*/ jsx("div", {
|
|
5950
6042
|
className: classnames('w-full h-[500px] border border-solid coz-stroke-primary rounded-[4px] overflow-hidden relative bg-white', {
|
|
5951
6043
|
'opacity-70': readOnly
|
|
@@ -5965,4 +6057,50 @@ const SchemaEditor = ({ value, onChange, placeholder, readOnly, language, classN
|
|
|
5965
6057
|
readonly: readOnly
|
|
5966
6058
|
})
|
|
5967
6059
|
});
|
|
5968
|
-
|
|
6060
|
+
const code_editor_with_loading_index_module = {
|
|
6061
|
+
"code-container": "code-container-A_QOb1",
|
|
6062
|
+
codeContainer: "code-container-A_QOb1"
|
|
6063
|
+
};
|
|
6064
|
+
const codeOptionsConfig = {
|
|
6065
|
+
lineNumbersMinChars: 3,
|
|
6066
|
+
automaticLayout: true,
|
|
6067
|
+
scrollBeyondLastLine: false,
|
|
6068
|
+
renderLineHighlight: 'none',
|
|
6069
|
+
tabSize: 2,
|
|
6070
|
+
insertSpaces: true,
|
|
6071
|
+
minimap: {
|
|
6072
|
+
enabled: false
|
|
6073
|
+
}
|
|
6074
|
+
};
|
|
6075
|
+
const CodeEditorWithLoading = ({ value, onChange, disabled, className })=>{
|
|
6076
|
+
const [loading, setLoading] = useState(true);
|
|
6077
|
+
const LoadingNode = loading && /*#__PURE__*/ jsx("div", {
|
|
6078
|
+
className: "absolute bg-[white] z-20 top-0 bottom-0 left-0 right-0 flex items-center justify-center",
|
|
6079
|
+
children: /*#__PURE__*/ jsx(Loading, {
|
|
6080
|
+
loading: true
|
|
6081
|
+
})
|
|
6082
|
+
});
|
|
6083
|
+
const onEditorMount = ()=>{
|
|
6084
|
+
setLoading(false);
|
|
6085
|
+
};
|
|
6086
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
6087
|
+
className: classnames(code_editor_with_loading_index_module["code-container"], className),
|
|
6088
|
+
children: [
|
|
6089
|
+
LoadingNode,
|
|
6090
|
+
/*#__PURE__*/ jsx(_monaco_editor_react, {
|
|
6091
|
+
language: 'json',
|
|
6092
|
+
value: value,
|
|
6093
|
+
options: {
|
|
6094
|
+
readOnly: disabled,
|
|
6095
|
+
...codeOptionsConfig
|
|
6096
|
+
},
|
|
6097
|
+
onMount: onEditorMount,
|
|
6098
|
+
theme: "vs-dark",
|
|
6099
|
+
onChange: (newValue)=>{
|
|
6100
|
+
onChange?.(newValue || '');
|
|
6101
|
+
}
|
|
6102
|
+
})
|
|
6103
|
+
]
|
|
6104
|
+
});
|
|
6105
|
+
};
|
|
6106
|
+
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 };
|