@cozeloop/components 0.0.3 → 0.0.4
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/package.json +9 -3
- package/.eslintcache +0 -1
- package/.rush/temp/shrinkwrap-deps.json +0 -770
- package/OWNERS +0 -5
- package/config/rush-project.json +0 -8
- package/eslint.config.js +0 -7
- package/rslib.config.js +0 -7
- package/script/publish.js +0 -146
- package/src/base-search-select/base-search-form-select.tsx +0 -10
- package/src/base-search-select/base-search-select.tsx +0 -200
- package/src/base-search-select/index.module.less +0 -16
- package/src/base-search-select/index.tsx +0 -3
- package/src/base-search-select/types.ts +0 -16
- package/src/base-search-select/utils.ts +0 -78
- package/src/basic-card/index.tsx +0 -23
- package/src/card-pane/index.module.less +0 -14
- package/src/card-pane/index.tsx +0 -25
- package/src/chip-select/index.module.less +0 -17
- package/src/chip-select/index.tsx +0 -7
- package/src/code-editor/index.tsx +0 -9
- package/src/code-usage/code-item.module.less +0 -32
- package/src/code-usage/index.tsx +0 -91
- package/src/codemirror-editor/code-editor.tsx +0 -139
- package/src/codemirror-editor/index.ts +0 -4
- package/src/codemirror-editor/json-editor.tsx +0 -183
- package/src/codemirror-editor/raw-text-editor.tsx +0 -68
- package/src/codemirror-editor/text-editor.tsx +0 -58
- package/src/codemirror-editor/themes/coze-dark.ts +0 -116
- package/src/codemirror-editor/themes/coze-light.ts +0 -122
- package/src/collapse-card/index.module.less +0 -27
- package/src/collapse-card/index.tsx +0 -93
- package/src/collapsible-card/index.module.less +0 -63
- package/src/collapsible-card/index.tsx +0 -57
- package/src/column-manage-storage/index.tsx +0 -64
- package/src/columns-select/index.tsx +0 -244
- package/src/edit-icon-button/index.tsx +0 -36
- package/src/footer-actions/index.tsx +0 -33
- package/src/hooks/use-infinite-scroll.ts +0 -183
- package/src/hooks/use-mouse-down-offset.ts +0 -50
- package/src/hooks/use-unsave-leave-warning.ts +0 -49
- package/src/id-render/icon-button-container.tsx +0 -37
- package/src/id-render/index.tsx +0 -64
- package/src/index-controller/record-navigation.tsx +0 -57
- package/src/index-controller/use-item-index-controller.ts +0 -197
- package/src/index.ts +0 -208
- package/src/infinite-scroll-table/index.tsx +0 -99
- package/src/info-tooltip/index.tsx +0 -41
- package/src/input-components/radio-button.tsx +0 -63
- package/src/input-slider/index.module.less +0 -30
- package/src/input-slider/index.tsx +0 -161
- package/src/input-with-count/index.tsx +0 -31
- package/src/jump-button/jump-icon-button.tsx +0 -12
- package/src/large-txt-render/index.tsx +0 -46
- package/src/layout/content.tsx +0 -28
- package/src/layout/header.tsx +0 -15
- package/src/layout/index.module.less +0 -28
- package/src/layout/index.tsx +0 -9
- package/src/layout/tabs.tsx +0 -11
- package/src/lazy-load-component/index.tsx +0 -55
- package/src/logic-editor/index.ts +0 -3
- package/src/logic-editor/logic-editor.module.less +0 -13
- package/src/logic-editor/logic-editor.tsx +0 -200
- package/src/logic-editor/logic-left-render.tsx +0 -100
- package/src/logic-editor/logic-operator-render.tsx +0 -54
- package/src/logic-editor/logic-right-render.tsx +0 -51
- package/src/logic-editor/logic-types.tsx +0 -238
- package/src/logic-editor/utils.ts +0 -22
- package/src/logic-expr/assets/select.svg +0 -1
- package/src/logic-expr/consts.ts +0 -6
- package/src/logic-expr/expr-group-render.tsx +0 -238
- package/src/logic-expr/expr-render.tsx +0 -226
- package/src/logic-expr/index.module.less +0 -252
- package/src/logic-expr/index.ts +0 -13
- package/src/logic-expr/logic-expr.tsx +0 -261
- package/src/logic-expr/logic-not.tsx +0 -46
- package/src/logic-expr/logic-toggle.tsx +0 -96
- package/src/logic-expr/types.ts +0 -95
- package/src/loop-radio-group/index.tsx +0 -16
- package/src/multi-part-editor/components/image-item-renderer.tsx +0 -134
- package/src/multi-part-editor/components/index.module.less +0 -21
- package/src/multi-part-editor/components/multipart-item-renderer.tsx +0 -74
- package/src/multi-part-editor/components/url-input-modal.tsx +0 -317
- package/src/multi-part-editor/components/video-item-renderer.tsx +0 -145
- package/src/multi-part-editor/index.module.less +0 -8
- package/src/multi-part-editor/index.tsx +0 -571
- package/src/multi-part-editor/multi-part-render.tsx +0 -87
- package/src/multi-part-editor/type.tsx +0 -103
- package/src/multi-part-editor/upload-button.tsx +0 -256
- package/src/multi-part-editor/utils.ts +0 -64
- package/src/open-detail-button/index.tsx +0 -30
- package/src/page-content/index.tsx +0 -99
- package/src/primary-page/index.tsx +0 -1
- package/src/primary-page/primary-header.tsx +0 -64
- package/src/primary-title/index.module.less +0 -14
- package/src/primary-title/index.tsx +0 -18
- package/src/provider/index.tsx +0 -89
- package/src/resizable-side-sheet/index.tsx +0 -69
- package/src/resize-sidesheet/index.module.less +0 -14
- package/src/resize-sidesheet/index.tsx +0 -68
- package/src/resize-sidesheet/use-drag.ts +0 -43
- package/src/schema-editor/index.tsx +0 -52
- package/src/search-form/index.tsx +0 -134
- package/src/semi-schema-form/components/tmpls/array-field-item.tsx +0 -97
- package/src/semi-schema-form/components/tmpls/array-field.tsx +0 -127
- package/src/semi-schema-form/components/tmpls/base-input.tsx +0 -126
- package/src/semi-schema-form/components/tmpls/description-field.tsx +0 -23
- package/src/semi-schema-form/components/tmpls/error-list.tsx +0 -44
- package/src/semi-schema-form/components/tmpls/field-error.tsx +0 -33
- package/src/semi-schema-form/components/tmpls/field.tsx +0 -54
- package/src/semi-schema-form/components/tmpls/icon-button.tsx +0 -112
- package/src/semi-schema-form/components/tmpls/index.ts +0 -39
- package/src/semi-schema-form/components/tmpls/object-field.tsx +0 -173
- package/src/semi-schema-form/components/tmpls/submit.tsx +0 -31
- package/src/semi-schema-form/components/tmpls/title-field.tsx +0 -30
- package/src/semi-schema-form/components/widgets/checkbox.tsx +0 -67
- package/src/semi-schema-form/components/widgets/checkboxs.tsx +0 -100
- package/src/semi-schema-form/components/widgets/index.ts +0 -17
- package/src/semi-schema-form/components/widgets/radio.tsx +0 -105
- package/src/semi-schema-form/components/widgets/range.tsx +0 -73
- package/src/semi-schema-form/components/widgets/select.tsx +0 -108
- package/src/semi-schema-form/components/widgets/textarea.tsx +0 -63
- package/src/semi-schema-form/index.tsx +0 -14
- package/src/sentinel-form/enum.ts +0 -16
- package/src/sentinel-form/index.tsx +0 -382
- package/src/step-nav/index.module.less +0 -45
- package/src/step-nav/index.tsx +0 -53
- package/src/table/index.module.less +0 -144
- package/src/table/index.tsx +0 -18
- package/src/table/sort-icon.tsx +0 -73
- package/src/table/table-with-pagination.tsx +0 -150
- package/src/table/table-without-pagniation.tsx +0 -66
- package/src/table-batch-operate/table-batch-operation.tsx +0 -47
- package/src/table-batch-operate/use-batch-operate.ts +0 -111
- package/src/table-col-actions/index.module.less +0 -8
- package/src/table-col-actions/index.tsx +0 -149
- package/src/table-cols-config/index.module.less +0 -34
- package/src/table-cols-config/index.tsx +0 -171
- package/src/table-cols-config/type.ts +0 -12
- package/src/table-cols-config/use-hidden-col-keys.ts +0 -53
- package/src/table-cols-config/util.ts +0 -56
- package/src/table-empty/index.tsx +0 -23
- package/src/table-header/index.module.less +0 -7
- package/src/table-header/index.tsx +0 -70
- package/src/tabs/index.module.less +0 -48
- package/src/tabs/index.tsx +0 -9
- package/src/text-area-pro/index.module.less +0 -5
- package/src/text-area-pro/index.tsx +0 -49
- package/src/text-with-copy/index.tsx +0 -95
- package/src/title-with-sub/index.tsx +0 -27
- package/src/tooltip-when-disabled/index.tsx +0 -23
- package/src/tooltip-with-disabled/index.tsx +0 -17
- package/src/types.d.ts +0 -24
- package/src/upload/index.ts +0 -39
- package/src/user-profile/index.tsx +0 -49
- package/src/utils/basic.ts +0 -29
- package/src/version-list/index.module.less +0 -16
- package/src/version-list/version-descriptions.tsx +0 -80
- package/src/version-list/version-item.tsx +0 -30
- package/src/version-list/version-list.tsx +0 -59
- package/src/version-list/version-switch-panel.tsx +0 -31
- package/tailwind.config.ts +0 -6
- package/tsconfig.build.json +0 -44
- package/tsconfig.json +0 -17
- package/tsconfig.misc.json +0 -28
- package/vitest.config.mts +0 -7
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import { type ReactNode, useEffect, useState, useMemo } from 'react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
|
|
4
|
-
import classNames from 'classnames';
|
|
5
|
-
import { sleep } from '@cozeloop/toolkit';
|
|
6
|
-
import { Button, SideSheet, Switch, Typography } from '@coze-arch/coze-design';
|
|
7
|
-
import { IconCozSetting, IconCozEye } from '@coze-arch/coze-design/icons';
|
|
8
|
-
|
|
9
|
-
import { generateColumnsWithKey, generateConfigColumns } from './util';
|
|
10
|
-
import { useHiddenColKeys } from './use-hidden-col-keys';
|
|
11
|
-
import { type ColumnPropsPro, type ColKey } from './type';
|
|
12
|
-
|
|
13
|
-
export { type ColumnPropsPro, type ColKey };
|
|
14
|
-
|
|
15
|
-
import styles from './index.module.less';
|
|
16
|
-
|
|
17
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
|
-
export interface TableColsConfigProps<T extends Record<string, any> = any> {
|
|
19
|
-
className?: string;
|
|
20
|
-
defaultHiddenColKeys?: ColKey[];
|
|
21
|
-
localStorageKey?: string;
|
|
22
|
-
|
|
23
|
-
columns?: ColumnPropsPro<T>[];
|
|
24
|
-
onChangeConfig?: (newColumns: ColumnPropsPro<T>[]) => void;
|
|
25
|
-
onClose?: () => void;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
|
-
export function TableColsConfig<T extends Record<string, any> = any>({
|
|
30
|
-
className,
|
|
31
|
-
localStorageKey,
|
|
32
|
-
defaultHiddenColKeys,
|
|
33
|
-
columns,
|
|
34
|
-
onChangeConfig,
|
|
35
|
-
onClose,
|
|
36
|
-
}: TableColsConfigProps<T>) {
|
|
37
|
-
const [hiddenColKeys, setHiddenColKeys] = useHiddenColKeys({
|
|
38
|
-
localStorageKey,
|
|
39
|
-
defaultHiddenColKeys,
|
|
40
|
-
});
|
|
41
|
-
const [visible, setVisible] = useState(false);
|
|
42
|
-
const handledColumns = useMemo(
|
|
43
|
-
() => generateColumnsWithKey(columns),
|
|
44
|
-
[columns],
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
useEffect(() => {
|
|
48
|
-
if (!visible) {
|
|
49
|
-
const configColumns = generateConfigColumns(
|
|
50
|
-
handledColumns,
|
|
51
|
-
hiddenColKeys,
|
|
52
|
-
);
|
|
53
|
-
if (configColumns) {
|
|
54
|
-
// sleep 100ms,防止页面卡顿
|
|
55
|
-
sleep(100).then(() => {
|
|
56
|
-
onChangeConfig?.(configColumns);
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}, [handledColumns, visible]);
|
|
61
|
-
|
|
62
|
-
const renderItem = ({
|
|
63
|
-
record,
|
|
64
|
-
index,
|
|
65
|
-
disable,
|
|
66
|
-
parent,
|
|
67
|
-
}: {
|
|
68
|
-
record: ColumnPropsPro<T>;
|
|
69
|
-
index: number;
|
|
70
|
-
disable?: boolean;
|
|
71
|
-
parent?: ColumnPropsPro<T>;
|
|
72
|
-
}) => {
|
|
73
|
-
const { title, children, configurable = true, colKey } = record;
|
|
74
|
-
|
|
75
|
-
const hidden = Boolean(colKey && hiddenColKeys.includes(colKey));
|
|
76
|
-
|
|
77
|
-
return (
|
|
78
|
-
<React.Fragment key={index}>
|
|
79
|
-
<div
|
|
80
|
-
className={classNames(styles.row, {
|
|
81
|
-
[styles['row-border']]: parent || index !== 0,
|
|
82
|
-
})}
|
|
83
|
-
>
|
|
84
|
-
<div className={classNames(styles.cell, styles['cell-left'])}>
|
|
85
|
-
<Typography.Text ellipsis={{ rows: 1, showTooltip: true }}>
|
|
86
|
-
{title as ReactNode}
|
|
87
|
-
</Typography.Text>
|
|
88
|
-
</div>
|
|
89
|
-
<div className={classNames(styles.cell, styles['cell-right'])}>
|
|
90
|
-
{!configurable || !colKey ? null : (
|
|
91
|
-
<Switch
|
|
92
|
-
size="small"
|
|
93
|
-
disabled={disable}
|
|
94
|
-
checked={!hidden}
|
|
95
|
-
onChange={v => {
|
|
96
|
-
const colsSet = new Set(hiddenColKeys);
|
|
97
|
-
if (v) {
|
|
98
|
-
colsSet.delete(colKey);
|
|
99
|
-
} else {
|
|
100
|
-
colsSet.add(colKey);
|
|
101
|
-
}
|
|
102
|
-
const newList = [...colsSet];
|
|
103
|
-
setHiddenColKeys(newList);
|
|
104
|
-
}}
|
|
105
|
-
/>
|
|
106
|
-
)}
|
|
107
|
-
</div>
|
|
108
|
-
</div>
|
|
109
|
-
{children?.length ? (
|
|
110
|
-
<div className="ml-4">
|
|
111
|
-
{children.map((item, idx) =>
|
|
112
|
-
renderItem({
|
|
113
|
-
record: item,
|
|
114
|
-
index: idx,
|
|
115
|
-
disable: hidden,
|
|
116
|
-
parent: record,
|
|
117
|
-
}),
|
|
118
|
-
)}
|
|
119
|
-
</div>
|
|
120
|
-
) : null}
|
|
121
|
-
</React.Fragment>
|
|
122
|
-
);
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
return (
|
|
126
|
-
<>
|
|
127
|
-
<Button
|
|
128
|
-
className={className}
|
|
129
|
-
icon={<IconCozSetting />}
|
|
130
|
-
color="primary"
|
|
131
|
-
onClick={() => setVisible(true)}
|
|
132
|
-
>
|
|
133
|
-
列配置
|
|
134
|
-
</Button>
|
|
135
|
-
<SideSheet
|
|
136
|
-
placement="right"
|
|
137
|
-
size="small"
|
|
138
|
-
visible={visible}
|
|
139
|
-
onCancel={() => {
|
|
140
|
-
setVisible(false);
|
|
141
|
-
onClose?.();
|
|
142
|
-
}}
|
|
143
|
-
>
|
|
144
|
-
<div className={styles.row}>
|
|
145
|
-
<div
|
|
146
|
-
className={classNames(
|
|
147
|
-
styles.cell,
|
|
148
|
-
styles['cell-left'],
|
|
149
|
-
styles['cell-thead'],
|
|
150
|
-
)}
|
|
151
|
-
>
|
|
152
|
-
列名
|
|
153
|
-
</div>
|
|
154
|
-
<div
|
|
155
|
-
className={classNames(
|
|
156
|
-
styles.cell,
|
|
157
|
-
styles['cell-right'],
|
|
158
|
-
styles['cell-thead'],
|
|
159
|
-
)}
|
|
160
|
-
>
|
|
161
|
-
{<IconCozEye style={{ lineHeight: '22px' }} />}
|
|
162
|
-
</div>
|
|
163
|
-
</div>
|
|
164
|
-
{handledColumns?.map((item, index) =>
|
|
165
|
-
renderItem({ record: item, index }),
|
|
166
|
-
)}
|
|
167
|
-
<div className="h-5" />
|
|
168
|
-
</SideSheet>
|
|
169
|
-
</>
|
|
170
|
-
);
|
|
171
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { type ColumnProps } from '@coze-arch/coze-design';
|
|
2
|
-
|
|
3
|
-
export type ColKey = string | number;
|
|
4
|
-
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
|
-
export interface ColumnPropsPro<T extends Record<string, any> = any>
|
|
7
|
-
extends ColumnProps<T> {
|
|
8
|
-
/* 是否可配置,默认为true */
|
|
9
|
-
configurable?: boolean;
|
|
10
|
-
/* 内部使用可忽略 */
|
|
11
|
-
colConfigKey?: ColKey;
|
|
12
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect } from 'react';
|
|
2
|
-
|
|
3
|
-
import { safeJsonParse } from '@cozeloop/toolkit';
|
|
4
|
-
import { type ColKey } from './type';
|
|
5
|
-
|
|
6
|
-
const ITEM_KEY = 'FORNAX_TABLE_HIDDEN_COLS';
|
|
7
|
-
|
|
8
|
-
export function useHiddenColKeys({
|
|
9
|
-
localStorageKey,
|
|
10
|
-
defaultHiddenColKeys,
|
|
11
|
-
}: {
|
|
12
|
-
localStorageKey?: string;
|
|
13
|
-
defaultHiddenColKeys?: ColKey[];
|
|
14
|
-
}) {
|
|
15
|
-
const handleSetHiddenColKeys = () => {
|
|
16
|
-
if (localStorageKey) {
|
|
17
|
-
const res = safeJsonParse<Record<string, ColKey[] | undefined>>(
|
|
18
|
-
localStorage.getItem(ITEM_KEY),
|
|
19
|
-
);
|
|
20
|
-
if (res) {
|
|
21
|
-
const list = res[`${localStorageKey}`];
|
|
22
|
-
if (list) {
|
|
23
|
-
return list;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return defaultHiddenColKeys || [];
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const [hiddenColKeys, setHiddenColKeys] = useState<ColKey[]>(
|
|
32
|
-
handleSetHiddenColKeys,
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
setHiddenColKeys(handleSetHiddenColKeys());
|
|
37
|
-
}, [defaultHiddenColKeys]);
|
|
38
|
-
|
|
39
|
-
useEffect(() => {
|
|
40
|
-
if (localStorageKey) {
|
|
41
|
-
const res =
|
|
42
|
-
safeJsonParse<Record<string, ColKey[] | undefined>>(
|
|
43
|
-
localStorage.getItem(ITEM_KEY),
|
|
44
|
-
) || {};
|
|
45
|
-
res[`${localStorageKey}`] = hiddenColKeys.length
|
|
46
|
-
? hiddenColKeys
|
|
47
|
-
: undefined;
|
|
48
|
-
localStorage.setItem(ITEM_KEY, JSON.stringify(res));
|
|
49
|
-
}
|
|
50
|
-
}, [hiddenColKeys]);
|
|
51
|
-
|
|
52
|
-
return [hiddenColKeys, setHiddenColKeys] as const;
|
|
53
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import { type ColumnPropsPro, type ColKey } from './type';
|
|
3
|
-
|
|
4
|
-
export function generateColumnsWithKey<T extends Record<string, any> = any>(
|
|
5
|
-
cols?: ColumnPropsPro<T>[],
|
|
6
|
-
hiddenColKeys?: ColKey[],
|
|
7
|
-
) {
|
|
8
|
-
function mapCol(
|
|
9
|
-
col: ColumnPropsPro<T>,
|
|
10
|
-
index: number,
|
|
11
|
-
parentKey?: ColKey,
|
|
12
|
-
): ColumnPropsPro<T> {
|
|
13
|
-
const { key, children } = col;
|
|
14
|
-
let colKey: ColKey;
|
|
15
|
-
if (key) {
|
|
16
|
-
colKey = key;
|
|
17
|
-
} else {
|
|
18
|
-
const indexKey = `index${index}`;
|
|
19
|
-
colKey = parentKey ? `${parentKey}-${indexKey}` : indexKey;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return {
|
|
23
|
-
...col,
|
|
24
|
-
colKey,
|
|
25
|
-
children: children?.map((child, idx) => mapCol(child, idx, colKey)),
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return cols?.map((col, index) => mapCol(col, index));
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function generateConfigColumns<T extends Record<string, any> = any>(
|
|
33
|
-
cols?: ColumnPropsPro<T>[],
|
|
34
|
-
hiddenColKeys?: ColKey[],
|
|
35
|
-
) {
|
|
36
|
-
if (!hiddenColKeys?.length) {
|
|
37
|
-
return cols;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function mapCols(list?: ColumnPropsPro<T>[]) {
|
|
41
|
-
const res: ColumnPropsPro<T>[] = [];
|
|
42
|
-
list?.forEach(col => {
|
|
43
|
-
if (hiddenColKeys?.includes(col.colKey as ColKey)) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
res.push({
|
|
47
|
-
...col,
|
|
48
|
-
children: col.children && mapCols(col.children as ColumnPropsPro[]),
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
return res;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return mapCols(cols);
|
|
56
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import classNames from 'classnames';
|
|
4
|
-
import {
|
|
5
|
-
IconCozIllusNone,
|
|
6
|
-
IconCozIllusNoneDark,
|
|
7
|
-
} from '@coze-arch/coze-design/illustrations';
|
|
8
|
-
import { EmptyState, type EmptyStateProps } from '@coze-arch/coze-design';
|
|
9
|
-
|
|
10
|
-
import { useI18n } from '../provider';
|
|
11
|
-
|
|
12
|
-
export function TableEmpty({ className, ...props }: EmptyStateProps) {
|
|
13
|
-
const I18n = useI18n();
|
|
14
|
-
return (
|
|
15
|
-
<EmptyState
|
|
16
|
-
className={classNames('my-10', className)}
|
|
17
|
-
icon={<IconCozIllusNone />}
|
|
18
|
-
darkModeIcon={<IconCozIllusNoneDark />}
|
|
19
|
-
description={I18n.t('evaluate_dataset_no_data_yet')}
|
|
20
|
-
{...props}
|
|
21
|
-
/>
|
|
22
|
-
);
|
|
23
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import classNames from 'classnames';
|
|
2
|
-
import { IconCozRefresh } from '@coze-arch/coze-design/icons';
|
|
3
|
-
import {
|
|
4
|
-
Button,
|
|
5
|
-
Space,
|
|
6
|
-
Tooltip,
|
|
7
|
-
type ButtonProps,
|
|
8
|
-
} from '@coze-arch/coze-design';
|
|
9
|
-
|
|
10
|
-
import { ColumnSelector, type ColumnSelectorProps } from '../columns-select';
|
|
11
|
-
import { TableColsConfig, type TableColsConfigProps } from '../table-cols-config';
|
|
12
|
-
|
|
13
|
-
import styles from './index.module.less';
|
|
14
|
-
|
|
15
|
-
export interface TableHeaderProps {
|
|
16
|
-
columnSelectorConfigProps?: ColumnSelectorProps;
|
|
17
|
-
tableColsConfigProps?: TableColsConfigProps;
|
|
18
|
-
filterForm?: React.ReactNode;
|
|
19
|
-
actions?: React.ReactNode;
|
|
20
|
-
className?: string;
|
|
21
|
-
style?: React.CSSProperties;
|
|
22
|
-
spaceProps?: Record<string, unknown>;
|
|
23
|
-
refreshButtonPros?: ButtonProps;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function TableHeader({
|
|
27
|
-
columnSelectorConfigProps,
|
|
28
|
-
tableColsConfigProps,
|
|
29
|
-
filterForm,
|
|
30
|
-
actions,
|
|
31
|
-
className,
|
|
32
|
-
style,
|
|
33
|
-
spaceProps,
|
|
34
|
-
refreshButtonPros,
|
|
35
|
-
}: TableHeaderProps) {
|
|
36
|
-
return (
|
|
37
|
-
<div
|
|
38
|
-
className={classNames('flex flex-row justify-between w-full ', className)}
|
|
39
|
-
style={style}
|
|
40
|
-
>
|
|
41
|
-
<div className={classNames('flex flex-row', styles['table-header-form'])}>
|
|
42
|
-
{tableColsConfigProps ? (
|
|
43
|
-
<TableColsConfig
|
|
44
|
-
className={classNames('mr-2', tableColsConfigProps.className)}
|
|
45
|
-
{...tableColsConfigProps}
|
|
46
|
-
/>
|
|
47
|
-
) : null}
|
|
48
|
-
{filterForm}
|
|
49
|
-
</div>
|
|
50
|
-
<Space {...(spaceProps || {})}>
|
|
51
|
-
{refreshButtonPros ? (
|
|
52
|
-
<Tooltip content="刷新" theme="dark">
|
|
53
|
-
<Button
|
|
54
|
-
color="primary"
|
|
55
|
-
icon={<IconCozRefresh />}
|
|
56
|
-
{...refreshButtonPros}
|
|
57
|
-
></Button>
|
|
58
|
-
</Tooltip>
|
|
59
|
-
) : null}
|
|
60
|
-
{columnSelectorConfigProps ? (
|
|
61
|
-
<ColumnSelector
|
|
62
|
-
className={classNames(columnSelectorConfigProps.className)}
|
|
63
|
-
{...columnSelectorConfigProps}
|
|
64
|
-
/>
|
|
65
|
-
) : null}
|
|
66
|
-
{actions}
|
|
67
|
-
</Space>
|
|
68
|
-
</div>
|
|
69
|
-
);
|
|
70
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
.tabs{
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: column;
|
|
4
|
-
|
|
5
|
-
:global{
|
|
6
|
-
.semi-tabs-bar-card.semi-tabs-bar-top .semi-tabs-tab:first-of-type{
|
|
7
|
-
margin-left: 24px;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.semi-tabs-tab-card.semi-tabs-tab-top.semi-tabs-tab{
|
|
11
|
-
height: 36px;
|
|
12
|
-
padding-top: 6px;
|
|
13
|
-
padding-bottom: 6px;
|
|
14
|
-
|
|
15
|
-
color: var(--semi-color-text-0);
|
|
16
|
-
|
|
17
|
-
background-color: #F6F8FA;
|
|
18
|
-
border: 1px solid var(--semi-color-border);
|
|
19
|
-
border-top-left-radius: 4px;
|
|
20
|
-
border-top-right-radius: 4px;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.semi-tabs-tab-card.semi-tabs-tab-top.semi-tabs-tab-active{
|
|
24
|
-
color: rgb(var(--coze-up-brand-9));
|
|
25
|
-
background: linear-gradient(to bottom, rgb(var(--coze-up-brand-9)) 2px, transparent 2px);
|
|
26
|
-
border-top: 1px solid rgb(var(--coze-up-brand-9));
|
|
27
|
-
border-bottom: 1px solid var(--semi-color-bg-2);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.semi-tabs-content{
|
|
31
|
-
overflow: hidden;
|
|
32
|
-
flex: 1;
|
|
33
|
-
padding: 0;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.semi-tabs-pane{
|
|
37
|
-
height: 100%;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.semi-tabs-pane-motion-overlay{
|
|
41
|
-
height: 100%;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.semi-tag-large{
|
|
45
|
-
height: 20px;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
package/src/tabs/index.tsx
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import cs from 'classnames';
|
|
2
|
-
import { Tabs, type TabsProps } from '@coze-arch/coze-design';
|
|
3
|
-
|
|
4
|
-
import styles from './index.module.less';
|
|
5
|
-
|
|
6
|
-
export const LoopTabs = (props: TabsProps) => {
|
|
7
|
-
const { className, ...rest } = props;
|
|
8
|
-
return <Tabs {...rest} className={cs(styles.tabs, className)} />;
|
|
9
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
Button,
|
|
5
|
-
Modal,
|
|
6
|
-
TextArea,
|
|
7
|
-
type TextAreaProps,
|
|
8
|
-
} from '@coze-arch/coze-design';
|
|
9
|
-
import { IconCozContent } from '@coze-arch/coze-design/icons';
|
|
10
|
-
|
|
11
|
-
import s from './index.module.less';
|
|
12
|
-
|
|
13
|
-
export interface Props extends TextAreaProps {
|
|
14
|
-
bottomExtra?: React.ReactNode;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function TextAreaPro({ bottomExtra, ...props }: Props) {
|
|
18
|
-
const [full, setFull] = useState(false);
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<div className="relative">
|
|
22
|
-
{full ? (
|
|
23
|
-
<Modal
|
|
24
|
-
motion={false}
|
|
25
|
-
title=" "
|
|
26
|
-
fullScreen
|
|
27
|
-
visible={true}
|
|
28
|
-
onCancel={() => setFull(false)}
|
|
29
|
-
footer={null}
|
|
30
|
-
>
|
|
31
|
-
<TextArea {...props} rows={undefined} className={s.full} />
|
|
32
|
-
</Modal>
|
|
33
|
-
) : null}
|
|
34
|
-
|
|
35
|
-
<TextArea {...props} />
|
|
36
|
-
<div className="absolute bottom-1 left-1 z-10 h-8 flex flex-row items-center">
|
|
37
|
-
<Button
|
|
38
|
-
className="z-10 h-8 w-8"
|
|
39
|
-
icon={<IconCozContent />}
|
|
40
|
-
size="small"
|
|
41
|
-
color="secondary"
|
|
42
|
-
type="tertiary"
|
|
43
|
-
onClick={() => setFull(true)}
|
|
44
|
-
></Button>
|
|
45
|
-
{bottomExtra}
|
|
46
|
-
</div>
|
|
47
|
-
</div>
|
|
48
|
-
);
|
|
49
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { type CSSProperties } from 'react';
|
|
2
|
-
|
|
3
|
-
import classNames from 'classnames';
|
|
4
|
-
import { IconCozCopy } from '@coze-arch/coze-design/icons';
|
|
5
|
-
import { IconButton, Tooltip, Typography } from '@coze-arch/coze-design';
|
|
6
|
-
|
|
7
|
-
import { handleCopy } from '../utils/basic';
|
|
8
|
-
|
|
9
|
-
interface TextWithCopyProps {
|
|
10
|
-
content?: string;
|
|
11
|
-
displayText?: string;
|
|
12
|
-
copyTooltipText?: string;
|
|
13
|
-
maxWidth?: number | string;
|
|
14
|
-
className?: string;
|
|
15
|
-
style?: CSSProperties;
|
|
16
|
-
textClassName?: string;
|
|
17
|
-
textType?:
|
|
18
|
-
| 'success'
|
|
19
|
-
| 'secondary'
|
|
20
|
-
| 'primary'
|
|
21
|
-
| 'danger'
|
|
22
|
-
| 'warning'
|
|
23
|
-
| 'tertiary'
|
|
24
|
-
| 'quaternary';
|
|
25
|
-
onlyIconCopy?: boolean;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function TextWithCopy({
|
|
29
|
-
displayText,
|
|
30
|
-
copyTooltipText,
|
|
31
|
-
content,
|
|
32
|
-
className,
|
|
33
|
-
maxWidth,
|
|
34
|
-
style,
|
|
35
|
-
textClassName,
|
|
36
|
-
textType = 'secondary',
|
|
37
|
-
onlyIconCopy,
|
|
38
|
-
}: TextWithCopyProps) {
|
|
39
|
-
return (
|
|
40
|
-
<div
|
|
41
|
-
className={classNames(
|
|
42
|
-
'flex items-baseline justify-start gap-1',
|
|
43
|
-
className,
|
|
44
|
-
)}
|
|
45
|
-
style={style}
|
|
46
|
-
>
|
|
47
|
-
<Typography.Text
|
|
48
|
-
className={classNames(
|
|
49
|
-
'max-w-full',
|
|
50
|
-
{
|
|
51
|
-
'cursor-pointer': !onlyIconCopy,
|
|
52
|
-
},
|
|
53
|
-
textClassName,
|
|
54
|
-
)}
|
|
55
|
-
type={textType}
|
|
56
|
-
style={{ maxWidth }}
|
|
57
|
-
ellipsis={{
|
|
58
|
-
showTooltip: { opts: { theme: 'dark', content } },
|
|
59
|
-
}}
|
|
60
|
-
onClick={
|
|
61
|
-
onlyIconCopy
|
|
62
|
-
? undefined
|
|
63
|
-
: e => {
|
|
64
|
-
content && handleCopy(content);
|
|
65
|
-
e?.stopPropagation();
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
>
|
|
69
|
-
{displayText || content || ''}
|
|
70
|
-
</Typography.Text>
|
|
71
|
-
{content ? (
|
|
72
|
-
<Tooltip content={copyTooltipText || '复制内容'} theme="dark">
|
|
73
|
-
<IconButton
|
|
74
|
-
size="mini"
|
|
75
|
-
color="secondary"
|
|
76
|
-
className="flex-shrink-0"
|
|
77
|
-
style={{
|
|
78
|
-
width: 21,
|
|
79
|
-
height: 21,
|
|
80
|
-
}}
|
|
81
|
-
icon={
|
|
82
|
-
<IconCozCopy
|
|
83
|
-
onClick={e => {
|
|
84
|
-
content && handleCopy(content);
|
|
85
|
-
e?.stopPropagation();
|
|
86
|
-
}}
|
|
87
|
-
fill="var(--semi-color-text-2)"
|
|
88
|
-
/>
|
|
89
|
-
}
|
|
90
|
-
/>
|
|
91
|
-
</Tooltip>
|
|
92
|
-
) : null}
|
|
93
|
-
</div>
|
|
94
|
-
);
|
|
95
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Space, Typography } from '@coze-arch/coze-design';
|
|
3
|
-
|
|
4
|
-
interface TitleWithSubProps {
|
|
5
|
-
title: string;
|
|
6
|
-
subTitle?: string;
|
|
7
|
-
className?: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function TitleWithSub({
|
|
11
|
-
title,
|
|
12
|
-
subTitle,
|
|
13
|
-
className,
|
|
14
|
-
}: TitleWithSubProps) {
|
|
15
|
-
return (
|
|
16
|
-
<Space align="center" spacing="tight" className={className}>
|
|
17
|
-
<Typography.Title className="!text-sm" heading={6}>
|
|
18
|
-
{title}
|
|
19
|
-
</Typography.Title>
|
|
20
|
-
{subTitle ? (
|
|
21
|
-
<Typography.Text size="small" type="tertiary">
|
|
22
|
-
{subTitle}
|
|
23
|
-
</Typography.Text>
|
|
24
|
-
) : null}
|
|
25
|
-
</Space>
|
|
26
|
-
);
|
|
27
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { type TooltipProps } from '@coze-arch/coze-design';
|
|
2
|
-
import { Tooltip } from '@coze-arch/coze-design';
|
|
3
|
-
|
|
4
|
-
export interface TooltipWhenDisabledProps extends TooltipProps {
|
|
5
|
-
disabled?: boolean;
|
|
6
|
-
needWrap?: boolean;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function TooltipWhenDisabled({
|
|
10
|
-
children,
|
|
11
|
-
disabled,
|
|
12
|
-
needWrap,
|
|
13
|
-
...rest
|
|
14
|
-
}: TooltipWhenDisabledProps) {
|
|
15
|
-
if (disabled) {
|
|
16
|
-
return (
|
|
17
|
-
<Tooltip {...rest}>
|
|
18
|
-
{needWrap ? <span>{children}</span> : children}
|
|
19
|
-
</Tooltip>
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
return <>{children}</>;
|
|
23
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { type TooltipProps } from '@coze-arch/coze-design';
|
|
2
|
-
import { Tooltip } from '@coze-arch/coze-design';
|
|
3
|
-
|
|
4
|
-
export interface TooltipWithDisabledProps extends TooltipProps {
|
|
5
|
-
disabled?: boolean;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export function TooltipWithDisabled({
|
|
9
|
-
children,
|
|
10
|
-
disabled,
|
|
11
|
-
...rest
|
|
12
|
-
}: TooltipWithDisabledProps) {
|
|
13
|
-
if (disabled) {
|
|
14
|
-
return <>{children}</>;
|
|
15
|
-
}
|
|
16
|
-
return <Tooltip {...rest}>{children}</Tooltip>;
|
|
17
|
-
}
|