@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
package/OWNERS
DELETED
package/config/rush-project.json
DELETED
package/eslint.config.js
DELETED
package/rslib.config.js
DELETED
package/script/publish.js
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
const { performance } = require('perf_hooks');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const { execSync } = require('child_process');
|
|
5
|
-
const isBeta = process.argv.includes('--beta');
|
|
6
|
-
|
|
7
|
-
const pkgPath = path.resolve(__dirname, '..', 'package.json');
|
|
8
|
-
|
|
9
|
-
// 1. 备份 package.json
|
|
10
|
-
const backupPkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
|
|
11
|
-
|
|
12
|
-
// 2. 读取 package.json
|
|
13
|
-
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
|
|
14
|
-
|
|
15
|
-
// 3. 获取线上最新版本
|
|
16
|
-
let latestVersion = '0.0.0';
|
|
17
|
-
let isFirstPublish = false;
|
|
18
|
-
try {
|
|
19
|
-
const result = execSync(`npm view ${pkg.name} versions --json`, {
|
|
20
|
-
encoding: 'utf-8',
|
|
21
|
-
});
|
|
22
|
-
console.log('获取线上版本成功', result);
|
|
23
|
-
let parsed;
|
|
24
|
-
try {
|
|
25
|
-
parsed = JSON.parse(result);
|
|
26
|
-
} catch (parseErr) {
|
|
27
|
-
console.error('解析线上版本失败:', parseErr);
|
|
28
|
-
parsed = result;
|
|
29
|
-
}
|
|
30
|
-
const versionList = Array.isArray(parsed)
|
|
31
|
-
? parsed
|
|
32
|
-
: typeof parsed === 'string'
|
|
33
|
-
? [parsed]
|
|
34
|
-
: [];
|
|
35
|
-
const nonBeta = versionList.filter(v => !String(v).includes('-beta'));
|
|
36
|
-
latestVersion = (nonBeta.length ? nonBeta : versionList).pop() || '0.0.0';
|
|
37
|
-
if (latestVersion === '0.0.0') {
|
|
38
|
-
isFirstPublish = true;
|
|
39
|
-
}
|
|
40
|
-
} catch (e) {
|
|
41
|
-
console.error('获取线上版本失败:', e);
|
|
42
|
-
console.warn(
|
|
43
|
-
'获取线上版本失败,可能是首次发布或网络问题,使用 0.0.0 作为基准',
|
|
44
|
-
);
|
|
45
|
-
isFirstPublish = true;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// 4. 计算新版本号(patch +1)
|
|
49
|
-
function bumpPatch(version) {
|
|
50
|
-
if (isBeta) {
|
|
51
|
-
console.warn('检测到 --beta 参数,版本号将不进行自动递增');
|
|
52
|
-
return `${version}-beta-${performance.now()}`; // 如果是 beta 版本,不递增版本号
|
|
53
|
-
} else {
|
|
54
|
-
console.log('检测到非 beta 发布,自动递增 patch 版本号');
|
|
55
|
-
const parts = version.split('.').map(Number);
|
|
56
|
-
if (parts.length !== 3 || parts.some(isNaN)) {
|
|
57
|
-
return '0.0.1';
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
parts[2] += 1;
|
|
61
|
-
return parts.join('.');
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
const newVersion = bumpPatch(latestVersion);
|
|
65
|
-
console.log('即将发布的新版本:', newVersion);
|
|
66
|
-
|
|
67
|
-
// 5. 处理发布配置
|
|
68
|
-
const botPublishConfig = pkg.botPublishConfig || {};
|
|
69
|
-
|
|
70
|
-
// 6. 替换 workspace:* 依赖为 latest
|
|
71
|
-
function replaceWorkspaceDeps(deps) {
|
|
72
|
-
if (!deps) {
|
|
73
|
-
return deps;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const newDeps = {};
|
|
77
|
-
for (const [pkgName, version] of Object.entries(deps)) {
|
|
78
|
-
if (version === 'workspace:*') {
|
|
79
|
-
newDeps[pkgName] = 'latest';
|
|
80
|
-
console.log(`替换依赖 ${pkgName}: workspace:* -> latest`);
|
|
81
|
-
} else {
|
|
82
|
-
newDeps[pkgName] = version;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return newDeps;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// 替换所有依赖类型中的 workspace:*
|
|
89
|
-
const newPkg = { ...pkg, ...botPublishConfig, version: newVersion };
|
|
90
|
-
newPkg.dependencies = replaceWorkspaceDeps(newPkg.dependencies);
|
|
91
|
-
|
|
92
|
-
delete newPkg.botPublishConfig;
|
|
93
|
-
|
|
94
|
-
// 7. 写入临时 package.json
|
|
95
|
-
fs.writeFileSync(pkgPath, JSON.stringify(newPkg, null, 2));
|
|
96
|
-
|
|
97
|
-
// 8. 执行 build 和 publish
|
|
98
|
-
try {
|
|
99
|
-
execSync('npm run build:sdk', {
|
|
100
|
-
stdio: 'inherit',
|
|
101
|
-
});
|
|
102
|
-
const distPath = path.resolve(__dirname, '..', 'dist');
|
|
103
|
-
// 将 dist 文件夹下的 .mjs 文件重命名为 .js 文件
|
|
104
|
-
function renameMjsToJs(dir) {
|
|
105
|
-
const files = fs.readdirSync(dir);
|
|
106
|
-
files.forEach(file => {
|
|
107
|
-
const filePath = path.join(dir, file);
|
|
108
|
-
const stat = fs.statSync(filePath);
|
|
109
|
-
|
|
110
|
-
if (stat.isDirectory()) {
|
|
111
|
-
renameMjsToJs(filePath); // 递归处理子目录
|
|
112
|
-
} else if (file.endsWith('.mjs')) {
|
|
113
|
-
const newFilePath = filePath.replace(/\.mjs$/, '.js');
|
|
114
|
-
fs.renameSync(filePath, newFilePath);
|
|
115
|
-
console.log(`已重命名: ${filePath} -> ${newFilePath}`);
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
if (fs.existsSync(distPath)) {
|
|
121
|
-
renameMjsToJs(distPath);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
const publishCommand = isFirstPublish
|
|
125
|
-
? 'npm publish --access public'
|
|
126
|
-
: 'npm publish';
|
|
127
|
-
console.log(`执行发布命令: ${publishCommand}`);
|
|
128
|
-
execSync(publishCommand, { stdio: 'inherit' });
|
|
129
|
-
} catch (e) {
|
|
130
|
-
console.error('发布失败:', e);
|
|
131
|
-
} finally {
|
|
132
|
-
// 9. 还原 package.json
|
|
133
|
-
try {
|
|
134
|
-
fs.writeFileSync(pkgPath, JSON.stringify(backupPkg, null, 2));
|
|
135
|
-
console.log('package.json 已还原');
|
|
136
|
-
} catch (restoreError) {
|
|
137
|
-
console.error('还原 package.json 失败:', restoreError);
|
|
138
|
-
// 如果备份文件不存在,尝试从 git 恢复
|
|
139
|
-
try {
|
|
140
|
-
execSync('git checkout -- package.json', { stdio: 'inherit' });
|
|
141
|
-
console.log('已从 git 恢复 package.json');
|
|
142
|
-
} catch (gitError) {
|
|
143
|
-
console.error('从 git 恢复也失败:', gitError);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { withField } from '@coze-arch/coze-design';
|
|
2
|
-
|
|
3
|
-
import { type BaseSelectProps } from './types';
|
|
4
|
-
import BaseSearchSelect from './base-search-select';
|
|
5
|
-
|
|
6
|
-
const BaseSearchFormSelect: React.FC<BaseSelectProps> = withField(
|
|
7
|
-
(props: BaseSelectProps) => <BaseSearchSelect {...props} />,
|
|
8
|
-
);
|
|
9
|
-
|
|
10
|
-
export default BaseSearchFormSelect;
|
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
-
|
|
4
|
-
import { isNull, isUndefined } from 'lodash-es';
|
|
5
|
-
import classNames from 'classnames';
|
|
6
|
-
import { useRequest } from 'ahooks';
|
|
7
|
-
import { IconCozRefresh } from '@coze-arch/coze-design/icons';
|
|
8
|
-
import {
|
|
9
|
-
type RenderSelectedItemFn,
|
|
10
|
-
Select,
|
|
11
|
-
type OptionProps,
|
|
12
|
-
Tooltip,
|
|
13
|
-
Button,
|
|
14
|
-
} from '@coze-arch/coze-design';
|
|
15
|
-
|
|
16
|
-
import { getOptionsNotInList, transformValueToArray } from './utils';
|
|
17
|
-
import { type BaseSelectProps } from './types';
|
|
18
|
-
|
|
19
|
-
import styles from './index.module.less';
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* 基础选择器组件
|
|
23
|
-
* 解决两个主要问题:
|
|
24
|
-
* 1. 初始选中值不在第一页数据中导致只显示ID
|
|
25
|
-
* 2. 搜索后选中值不在结果中导致只显示ID
|
|
26
|
-
*/
|
|
27
|
-
// eslint-disable-next-line @coze-arch/max-line-per-function
|
|
28
|
-
const BaseSearchSelect = (props: BaseSelectProps) => {
|
|
29
|
-
const {
|
|
30
|
-
optionList: _optionList,
|
|
31
|
-
loadOptionByIds,
|
|
32
|
-
value,
|
|
33
|
-
defaultValue,
|
|
34
|
-
onSearch,
|
|
35
|
-
renderSelectedItem,
|
|
36
|
-
onChangeWithObject,
|
|
37
|
-
onDropdownVisibleChange,
|
|
38
|
-
showRefreshBtn,
|
|
39
|
-
onClickRefresh,
|
|
40
|
-
disabledCacheOptions,
|
|
41
|
-
} = props;
|
|
42
|
-
|
|
43
|
-
// 是否在搜索中
|
|
44
|
-
const [searchWord, setSearchWord] = useState('');
|
|
45
|
-
const [refreshFlag, setRefreshFlag] = useState([]);
|
|
46
|
-
const [dropdownVisible, setDropdownVisible] = useState(false);
|
|
47
|
-
const optionMapRef = useRef<Record<string, OptionProps>>({});
|
|
48
|
-
|
|
49
|
-
const optionList = useMemo(() => _optionList || [], [_optionList]);
|
|
50
|
-
|
|
51
|
-
const isOptionListNotExists = useMemo(() => !_optionList, [_optionList]);
|
|
52
|
-
|
|
53
|
-
useEffect(() => {
|
|
54
|
-
if (isOptionListNotExists) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
// 每次 optionList 变化, 将 optionList 中的 option 添加到 optionMapRef 中缓存
|
|
58
|
-
(optionList || []).forEach(item => {
|
|
59
|
-
optionMapRef.current[item?.value as string] = item;
|
|
60
|
-
});
|
|
61
|
-
}, [optionList]);
|
|
62
|
-
|
|
63
|
-
// 初始化
|
|
64
|
-
useRequest(
|
|
65
|
-
async () => {
|
|
66
|
-
const initialValue = value || defaultValue;
|
|
67
|
-
// 1. 判断 list 有没有value, 有则不发请求
|
|
68
|
-
if (
|
|
69
|
-
isUndefined(initialValue) ||
|
|
70
|
-
isNull(initialValue) ||
|
|
71
|
-
initialValue === '' ||
|
|
72
|
-
!loadOptionByIds
|
|
73
|
-
) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// 2. 判断 optionList 中有没有 value 中不存在的 选项, 有则不发请求
|
|
78
|
-
const optionsNotInList = getOptionsNotInList({
|
|
79
|
-
value: initialValue,
|
|
80
|
-
optionList,
|
|
81
|
-
onChangeWithObject,
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
if (optionsNotInList.length === 0) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
try {
|
|
89
|
-
const payload = transformValueToArray(value, onChangeWithObject);
|
|
90
|
-
const fetchOptions = await loadOptionByIds(payload);
|
|
91
|
-
if (fetchOptions) {
|
|
92
|
-
setRefreshFlag([]);
|
|
93
|
-
optionMapRef.current = {
|
|
94
|
-
...optionMapRef.current,
|
|
95
|
-
...fetchOptions.reduce((acc, item) => {
|
|
96
|
-
acc[item?.value as string] = item;
|
|
97
|
-
return acc;
|
|
98
|
-
}, {}),
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
} catch (error) {
|
|
102
|
-
console.error('Failed to load selected option:', error);
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
refreshDeps: [value],
|
|
107
|
-
},
|
|
108
|
-
);
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* 最后展示的选项
|
|
112
|
-
*/
|
|
113
|
-
const cacheOptions = useMemo(() => {
|
|
114
|
-
// searchWord 表示处于搜索中, 不应该展示不在选项列表中的选项
|
|
115
|
-
if (!value || searchWord || disabledCacheOptions) {
|
|
116
|
-
return optionList;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
const optionsNotInList = getOptionsNotInList({
|
|
120
|
-
value,
|
|
121
|
-
optionList,
|
|
122
|
-
onChangeWithObject,
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
// value 所有选项都在选项列表中, 直接返回
|
|
126
|
-
if (optionsNotInList.length === 0) {
|
|
127
|
-
return optionList;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// value 不在选项列表, 则对value进行处理, 前面已经处理为arr了
|
|
131
|
-
// 所以这里可以直接按arr 处理 返回缓存中的选项
|
|
132
|
-
const optionsInCache = optionsNotInList.map(k => optionMapRef.current[k]);
|
|
133
|
-
// 有可能存在远端数据被删除,id无法拉去到的情况
|
|
134
|
-
const newOptions = [...optionsInCache, ...optionList].filter(Boolean);
|
|
135
|
-
return newOptions;
|
|
136
|
-
}, [optionList, value, searchWord, refreshFlag]);
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* 选中项渲染, 如果list中没有, 从缓存中拿当前的选种值
|
|
140
|
-
*/
|
|
141
|
-
const RenderSelectedItem = useCallback(
|
|
142
|
-
(optionNode: Record<string, unknown>, multipleProps?: any) => {
|
|
143
|
-
const renderOpt =
|
|
144
|
-
optionMapRef.current[optionNode?.value as string] || optionNode;
|
|
145
|
-
|
|
146
|
-
if (renderSelectedItem) {
|
|
147
|
-
return renderSelectedItem(renderOpt, multipleProps);
|
|
148
|
-
}
|
|
149
|
-
// 多选
|
|
150
|
-
if (multipleProps) {
|
|
151
|
-
return {
|
|
152
|
-
isRenderInTag: true,
|
|
153
|
-
content: renderOpt?.label || renderOpt?.value,
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
return renderOpt?.label || renderOpt?.value;
|
|
157
|
-
},
|
|
158
|
-
[renderSelectedItem],
|
|
159
|
-
);
|
|
160
|
-
|
|
161
|
-
return (
|
|
162
|
-
<Select
|
|
163
|
-
suffix={
|
|
164
|
-
showRefreshBtn && dropdownVisible ? (
|
|
165
|
-
<Tooltip theme="dark" content="刷新">
|
|
166
|
-
<div className="flex flex-row items-center">
|
|
167
|
-
<Button
|
|
168
|
-
className="!h-6 !w-6"
|
|
169
|
-
icon={<IconCozRefresh />}
|
|
170
|
-
size="small"
|
|
171
|
-
color="secondary"
|
|
172
|
-
onClick={() => onClickRefresh?.()}
|
|
173
|
-
/>
|
|
174
|
-
<div className="h-3 w-0 border-0 border-l border-solid coz-stroke-primary ml-[2px]" />
|
|
175
|
-
</div>
|
|
176
|
-
</Tooltip>
|
|
177
|
-
) : null
|
|
178
|
-
}
|
|
179
|
-
{...props}
|
|
180
|
-
onDropdownVisibleChange={visible => {
|
|
181
|
-
setDropdownVisible(visible);
|
|
182
|
-
onDropdownVisibleChange?.(visible);
|
|
183
|
-
}}
|
|
184
|
-
dropdownClassName={classNames(
|
|
185
|
-
styles['select-dropdown-style'],
|
|
186
|
-
props.dropdownClassName,
|
|
187
|
-
)}
|
|
188
|
-
optionList={isOptionListNotExists ? undefined : cacheOptions}
|
|
189
|
-
renderSelectedItem={RenderSelectedItem as RenderSelectedItemFn}
|
|
190
|
-
onSearch={(vs, e) => {
|
|
191
|
-
setSearchWord(vs);
|
|
192
|
-
if (onSearch) {
|
|
193
|
-
onSearch?.(vs, e);
|
|
194
|
-
}
|
|
195
|
-
}}
|
|
196
|
-
/>
|
|
197
|
-
);
|
|
198
|
-
};
|
|
199
|
-
|
|
200
|
-
export default BaseSearchSelect;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/* stylelint-disable selector-class-pattern */
|
|
2
|
-
.select-dropdown-style {
|
|
3
|
-
:global {
|
|
4
|
-
.coz-select-option-item .option-text-wrapper {
|
|
5
|
-
padding-left: 8px;
|
|
6
|
-
.option-text {
|
|
7
|
-
padding-left: 0px;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
.coz-select-option-item.disabled {
|
|
11
|
-
.option-text-wrapper {
|
|
12
|
-
color: rgba(var(--coze-fg-1), var(--coze-fg-1-alpha));
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import { type OptionProps, type SelectProps } from '@coze-arch/coze-design';
|
|
3
|
-
|
|
4
|
-
export type LoadOptionByIds = (
|
|
5
|
-
ids: string[] | number[],
|
|
6
|
-
) => Promise<(OptionProps & { [key: string]: any })[]>;
|
|
7
|
-
|
|
8
|
-
export interface BaseSelectProps extends SelectProps {
|
|
9
|
-
/** 是否禁用缓存选项 */
|
|
10
|
-
disabledCacheOptions?: boolean;
|
|
11
|
-
loadOptionByIds?: LoadOptionByIds;
|
|
12
|
-
/** 是否显示刷新按钮 */
|
|
13
|
-
showRefreshBtn?: boolean;
|
|
14
|
-
/** 点击刷新按钮的回调 */
|
|
15
|
-
onClickRefresh?: () => void;
|
|
16
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
export const transformValueToArray = (
|
|
3
|
-
value: any,
|
|
4
|
-
onChangeWithObject = false,
|
|
5
|
-
): string[] | number[] => {
|
|
6
|
-
// 对象传入
|
|
7
|
-
if (onChangeWithObject) {
|
|
8
|
-
// 对象数组
|
|
9
|
-
if (Array.isArray(value)) {
|
|
10
|
-
return value.map(item => item?.value || '').filter(Boolean);
|
|
11
|
-
}
|
|
12
|
-
// 单个对象
|
|
13
|
-
return value?.value ? [value?.value] : [];
|
|
14
|
-
}
|
|
15
|
-
// 普通数组 或 字符串
|
|
16
|
-
return Array.isArray(value) ? value : [value];
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
// 过滤 value 中不在 optionlist 中的 option
|
|
20
|
-
export const filterValueNotInOptionList = (
|
|
21
|
-
value: any,
|
|
22
|
-
optionSet: Set<string | number | undefined>,
|
|
23
|
-
onChangeWithObject = false,
|
|
24
|
-
): Int64[] => {
|
|
25
|
-
if (onChangeWithObject) {
|
|
26
|
-
// 对象数组
|
|
27
|
-
if (Array.isArray(value)) {
|
|
28
|
-
return value
|
|
29
|
-
.filter(item => !optionSet.has(item?.value))
|
|
30
|
-
.map(it => it?.value);
|
|
31
|
-
}
|
|
32
|
-
// 单个对象
|
|
33
|
-
return optionSet.has(value?.value) ? [] : [value?.value];
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (Array.isArray(value)) {
|
|
37
|
-
return value.filter(item => !optionSet.has(item));
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (typeof value === 'string' || typeof value === 'number') {
|
|
41
|
-
return optionSet.has(value) ? [] : [value];
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return [];
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export const getOptionsNotInList = ({
|
|
48
|
-
value,
|
|
49
|
-
optionList,
|
|
50
|
-
onChangeWithObject = false,
|
|
51
|
-
}: {
|
|
52
|
-
value: any;
|
|
53
|
-
optionList: any[];
|
|
54
|
-
onChangeWithObject?: boolean;
|
|
55
|
-
}) => {
|
|
56
|
-
// 集合
|
|
57
|
-
const existingValues = new Set(optionList.map(item => item.value));
|
|
58
|
-
|
|
59
|
-
// 找到 value 里面不在选项列表中的选项
|
|
60
|
-
const optionsNotInList = filterValueNotInOptionList(
|
|
61
|
-
value,
|
|
62
|
-
existingValues,
|
|
63
|
-
onChangeWithObject,
|
|
64
|
-
);
|
|
65
|
-
return optionsNotInList;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export const initialValueChecker = (
|
|
69
|
-
value: any,
|
|
70
|
-
optionList: any[],
|
|
71
|
-
onChangeWithObject = false,
|
|
72
|
-
) => {
|
|
73
|
-
if (typeof value === 'string') {
|
|
74
|
-
return true;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return value;
|
|
78
|
-
};
|
package/src/basic-card/index.tsx
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { type ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
import classNames from 'classnames';
|
|
4
|
-
|
|
5
|
-
export interface CardProps {
|
|
6
|
-
title: ReactNode;
|
|
7
|
-
children?: ReactNode;
|
|
8
|
-
className?: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const BasicCard = ({ title, children, className }: CardProps) => (
|
|
12
|
-
<div
|
|
13
|
-
className={classNames(
|
|
14
|
-
'border border-solid coz-stroke-plus rounded-[6px] overflow-hidden',
|
|
15
|
-
className,
|
|
16
|
-
)}
|
|
17
|
-
>
|
|
18
|
-
<div className="text-sm font-medium px-4 h-[44px] flex items-center coze-fg-primary bg-[#F7F7FC]">
|
|
19
|
-
{title}
|
|
20
|
-
</div>
|
|
21
|
-
{children ? <div className="p-4 bg-white">{children}</div> : null}
|
|
22
|
-
</div>
|
|
23
|
-
);
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
.container {
|
|
2
|
-
padding: 8px 16px;
|
|
3
|
-
|
|
4
|
-
border: 1px solid var(--semi-color-border);
|
|
5
|
-
border-radius: var(--semi-border-radius-medium);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.shadow {
|
|
9
|
-
transition: box-shadow 0.3s;
|
|
10
|
-
&:hover {
|
|
11
|
-
box-shadow: var(--semi-shadow-elevated);
|
|
12
|
-
z-index: 1;
|
|
13
|
-
}
|
|
14
|
-
}
|
package/src/card-pane/index.tsx
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import classNames from 'classnames';
|
|
4
|
-
|
|
5
|
-
import styles from './index.module.less';
|
|
6
|
-
|
|
7
|
-
export interface CardPaneProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
8
|
-
/* hover 的时候是否展示 shadow 样式 */
|
|
9
|
-
hoverShadow?: boolean;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function CardPane({ hoverShadow, className, ...props }: CardPaneProps) {
|
|
13
|
-
return (
|
|
14
|
-
<div
|
|
15
|
-
className={classNames(
|
|
16
|
-
styles.container,
|
|
17
|
-
{
|
|
18
|
-
[styles.shadow]: hoverShadow,
|
|
19
|
-
},
|
|
20
|
-
className,
|
|
21
|
-
)}
|
|
22
|
-
{...props}
|
|
23
|
-
/>
|
|
24
|
-
);
|
|
25
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/* stylelint-disable declaration-no-important */
|
|
2
|
-
.select{
|
|
3
|
-
height: 24px !important;
|
|
4
|
-
min-height: 24px !important;
|
|
5
|
-
|
|
6
|
-
:global{
|
|
7
|
-
.semi-select-selection-text{
|
|
8
|
-
.coz-chip{
|
|
9
|
-
padding-right: 0;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.semi-select-arrow{
|
|
14
|
-
padding-left: 0 !important;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import cls from 'classnames';
|
|
2
|
-
import { Select, type SelectProps } from '@coze-arch/coze-design';
|
|
3
|
-
|
|
4
|
-
import styles from './index.module.less';
|
|
5
|
-
export const ChipSelect = (props: SelectProps) => (
|
|
6
|
-
<Select {...props} className={cls(styles.select, props.className)} />
|
|
7
|
-
);
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/// <reference path="../types.d.ts" />
|
|
2
|
-
export { default as CodeEditor, DiffEditor } from '@monaco-editor/react';
|
|
3
|
-
export { type Monaco, type MonacoDiffEditor } from '@monaco-editor/react';
|
|
4
|
-
export { type editor } from 'monaco-editor';
|
|
5
|
-
import { loader } from '@monaco-editor/react';
|
|
6
|
-
|
|
7
|
-
loader.config({
|
|
8
|
-
paths: { vs: MONACO_UNPKG },
|
|
9
|
-
});
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
.usage-detail {
|
|
2
|
-
position: relative;
|
|
3
|
-
padding-left: 16px;
|
|
4
|
-
|
|
5
|
-
padding-bottom: 16px;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
&:not(:last-child) {
|
|
9
|
-
&::before {
|
|
10
|
-
content: '';
|
|
11
|
-
position: absolute;
|
|
12
|
-
left: 6px;
|
|
13
|
-
top: 20px;
|
|
14
|
-
bottom: 4px;
|
|
15
|
-
border-left: 2px solid var(--semi-color-primary);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
&::after {
|
|
21
|
-
content: '•';
|
|
22
|
-
position: absolute;
|
|
23
|
-
left: 0;
|
|
24
|
-
top: -2px;
|
|
25
|
-
margin: auto 0;
|
|
26
|
-
height: 32px;
|
|
27
|
-
color: var(--semi-color-primary);
|
|
28
|
-
font-size: 32px;
|
|
29
|
-
line-height: 20px;
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
}
|