@cozeloop/components 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/dist/es/index.js +1 -1
  2. package/dist/lib/code-editor/index.js +3 -1
  3. package/dist/lib/code-editor/index.js.map +1 -1
  4. package/dist/lib/tsconfig.build.tsbuildinfo +1 -1
  5. package/package.json +9 -3
  6. package/.eslintcache +0 -1
  7. package/.rush/temp/shrinkwrap-deps.json +0 -770
  8. package/OWNERS +0 -5
  9. package/config/rush-project.json +0 -8
  10. package/eslint.config.js +0 -7
  11. package/rslib.config.js +0 -7
  12. package/script/publish.js +0 -146
  13. package/src/base-search-select/base-search-form-select.tsx +0 -10
  14. package/src/base-search-select/base-search-select.tsx +0 -200
  15. package/src/base-search-select/index.module.less +0 -16
  16. package/src/base-search-select/index.tsx +0 -3
  17. package/src/base-search-select/types.ts +0 -16
  18. package/src/base-search-select/utils.ts +0 -78
  19. package/src/basic-card/index.tsx +0 -23
  20. package/src/card-pane/index.module.less +0 -14
  21. package/src/card-pane/index.tsx +0 -25
  22. package/src/chip-select/index.module.less +0 -17
  23. package/src/chip-select/index.tsx +0 -7
  24. package/src/code-editor/index.tsx +0 -9
  25. package/src/code-usage/code-item.module.less +0 -32
  26. package/src/code-usage/index.tsx +0 -91
  27. package/src/codemirror-editor/code-editor.tsx +0 -139
  28. package/src/codemirror-editor/index.ts +0 -4
  29. package/src/codemirror-editor/json-editor.tsx +0 -183
  30. package/src/codemirror-editor/raw-text-editor.tsx +0 -68
  31. package/src/codemirror-editor/text-editor.tsx +0 -58
  32. package/src/codemirror-editor/themes/coze-dark.ts +0 -116
  33. package/src/codemirror-editor/themes/coze-light.ts +0 -122
  34. package/src/collapse-card/index.module.less +0 -27
  35. package/src/collapse-card/index.tsx +0 -93
  36. package/src/collapsible-card/index.module.less +0 -63
  37. package/src/collapsible-card/index.tsx +0 -57
  38. package/src/column-manage-storage/index.tsx +0 -64
  39. package/src/columns-select/index.tsx +0 -244
  40. package/src/edit-icon-button/index.tsx +0 -36
  41. package/src/footer-actions/index.tsx +0 -33
  42. package/src/hooks/use-infinite-scroll.ts +0 -183
  43. package/src/hooks/use-mouse-down-offset.ts +0 -50
  44. package/src/hooks/use-unsave-leave-warning.ts +0 -49
  45. package/src/id-render/icon-button-container.tsx +0 -37
  46. package/src/id-render/index.tsx +0 -64
  47. package/src/index-controller/record-navigation.tsx +0 -57
  48. package/src/index-controller/use-item-index-controller.ts +0 -197
  49. package/src/index.ts +0 -208
  50. package/src/infinite-scroll-table/index.tsx +0 -99
  51. package/src/info-tooltip/index.tsx +0 -41
  52. package/src/input-components/radio-button.tsx +0 -63
  53. package/src/input-slider/index.module.less +0 -30
  54. package/src/input-slider/index.tsx +0 -161
  55. package/src/input-with-count/index.tsx +0 -31
  56. package/src/jump-button/jump-icon-button.tsx +0 -12
  57. package/src/large-txt-render/index.tsx +0 -46
  58. package/src/layout/content.tsx +0 -28
  59. package/src/layout/header.tsx +0 -15
  60. package/src/layout/index.module.less +0 -28
  61. package/src/layout/index.tsx +0 -9
  62. package/src/layout/tabs.tsx +0 -11
  63. package/src/lazy-load-component/index.tsx +0 -55
  64. package/src/logic-editor/index.ts +0 -3
  65. package/src/logic-editor/logic-editor.module.less +0 -13
  66. package/src/logic-editor/logic-editor.tsx +0 -200
  67. package/src/logic-editor/logic-left-render.tsx +0 -100
  68. package/src/logic-editor/logic-operator-render.tsx +0 -54
  69. package/src/logic-editor/logic-right-render.tsx +0 -51
  70. package/src/logic-editor/logic-types.tsx +0 -238
  71. package/src/logic-editor/utils.ts +0 -22
  72. package/src/logic-expr/assets/select.svg +0 -1
  73. package/src/logic-expr/consts.ts +0 -6
  74. package/src/logic-expr/expr-group-render.tsx +0 -238
  75. package/src/logic-expr/expr-render.tsx +0 -226
  76. package/src/logic-expr/index.module.less +0 -252
  77. package/src/logic-expr/index.ts +0 -13
  78. package/src/logic-expr/logic-expr.tsx +0 -261
  79. package/src/logic-expr/logic-not.tsx +0 -46
  80. package/src/logic-expr/logic-toggle.tsx +0 -96
  81. package/src/logic-expr/types.ts +0 -95
  82. package/src/loop-radio-group/index.tsx +0 -16
  83. package/src/multi-part-editor/components/image-item-renderer.tsx +0 -134
  84. package/src/multi-part-editor/components/index.module.less +0 -21
  85. package/src/multi-part-editor/components/multipart-item-renderer.tsx +0 -74
  86. package/src/multi-part-editor/components/url-input-modal.tsx +0 -317
  87. package/src/multi-part-editor/components/video-item-renderer.tsx +0 -145
  88. package/src/multi-part-editor/index.module.less +0 -8
  89. package/src/multi-part-editor/index.tsx +0 -571
  90. package/src/multi-part-editor/multi-part-render.tsx +0 -87
  91. package/src/multi-part-editor/type.tsx +0 -103
  92. package/src/multi-part-editor/upload-button.tsx +0 -256
  93. package/src/multi-part-editor/utils.ts +0 -64
  94. package/src/open-detail-button/index.tsx +0 -30
  95. package/src/page-content/index.tsx +0 -99
  96. package/src/primary-page/index.tsx +0 -1
  97. package/src/primary-page/primary-header.tsx +0 -64
  98. package/src/primary-title/index.module.less +0 -14
  99. package/src/primary-title/index.tsx +0 -18
  100. package/src/provider/index.tsx +0 -89
  101. package/src/resizable-side-sheet/index.tsx +0 -69
  102. package/src/resize-sidesheet/index.module.less +0 -14
  103. package/src/resize-sidesheet/index.tsx +0 -68
  104. package/src/resize-sidesheet/use-drag.ts +0 -43
  105. package/src/schema-editor/index.tsx +0 -52
  106. package/src/search-form/index.tsx +0 -134
  107. package/src/semi-schema-form/components/tmpls/array-field-item.tsx +0 -97
  108. package/src/semi-schema-form/components/tmpls/array-field.tsx +0 -127
  109. package/src/semi-schema-form/components/tmpls/base-input.tsx +0 -126
  110. package/src/semi-schema-form/components/tmpls/description-field.tsx +0 -23
  111. package/src/semi-schema-form/components/tmpls/error-list.tsx +0 -44
  112. package/src/semi-schema-form/components/tmpls/field-error.tsx +0 -33
  113. package/src/semi-schema-form/components/tmpls/field.tsx +0 -54
  114. package/src/semi-schema-form/components/tmpls/icon-button.tsx +0 -112
  115. package/src/semi-schema-form/components/tmpls/index.ts +0 -39
  116. package/src/semi-schema-form/components/tmpls/object-field.tsx +0 -173
  117. package/src/semi-schema-form/components/tmpls/submit.tsx +0 -31
  118. package/src/semi-schema-form/components/tmpls/title-field.tsx +0 -30
  119. package/src/semi-schema-form/components/widgets/checkbox.tsx +0 -67
  120. package/src/semi-schema-form/components/widgets/checkboxs.tsx +0 -100
  121. package/src/semi-schema-form/components/widgets/index.ts +0 -17
  122. package/src/semi-schema-form/components/widgets/radio.tsx +0 -105
  123. package/src/semi-schema-form/components/widgets/range.tsx +0 -73
  124. package/src/semi-schema-form/components/widgets/select.tsx +0 -108
  125. package/src/semi-schema-form/components/widgets/textarea.tsx +0 -63
  126. package/src/semi-schema-form/index.tsx +0 -14
  127. package/src/sentinel-form/enum.ts +0 -16
  128. package/src/sentinel-form/index.tsx +0 -382
  129. package/src/step-nav/index.module.less +0 -45
  130. package/src/step-nav/index.tsx +0 -53
  131. package/src/table/index.module.less +0 -144
  132. package/src/table/index.tsx +0 -18
  133. package/src/table/sort-icon.tsx +0 -73
  134. package/src/table/table-with-pagination.tsx +0 -150
  135. package/src/table/table-without-pagniation.tsx +0 -66
  136. package/src/table-batch-operate/table-batch-operation.tsx +0 -47
  137. package/src/table-batch-operate/use-batch-operate.ts +0 -111
  138. package/src/table-col-actions/index.module.less +0 -8
  139. package/src/table-col-actions/index.tsx +0 -149
  140. package/src/table-cols-config/index.module.less +0 -34
  141. package/src/table-cols-config/index.tsx +0 -171
  142. package/src/table-cols-config/type.ts +0 -12
  143. package/src/table-cols-config/use-hidden-col-keys.ts +0 -53
  144. package/src/table-cols-config/util.ts +0 -56
  145. package/src/table-empty/index.tsx +0 -23
  146. package/src/table-header/index.module.less +0 -7
  147. package/src/table-header/index.tsx +0 -70
  148. package/src/tabs/index.module.less +0 -48
  149. package/src/tabs/index.tsx +0 -9
  150. package/src/text-area-pro/index.module.less +0 -5
  151. package/src/text-area-pro/index.tsx +0 -49
  152. package/src/text-with-copy/index.tsx +0 -95
  153. package/src/title-with-sub/index.tsx +0 -27
  154. package/src/tooltip-when-disabled/index.tsx +0 -23
  155. package/src/tooltip-with-disabled/index.tsx +0 -17
  156. package/src/types.d.ts +0 -24
  157. package/src/upload/index.ts +0 -39
  158. package/src/user-profile/index.tsx +0 -49
  159. package/src/utils/basic.ts +0 -29
  160. package/src/version-list/index.module.less +0 -16
  161. package/src/version-list/version-descriptions.tsx +0 -80
  162. package/src/version-list/version-item.tsx +0 -30
  163. package/src/version-list/version-list.tsx +0 -59
  164. package/src/version-list/version-switch-panel.tsx +0 -31
  165. package/tailwind.config.ts +0 -6
  166. package/tsconfig.build.json +0 -44
  167. package/tsconfig.json +0 -17
  168. package/tsconfig.misc.json +0 -28
  169. package/vitest.config.mts +0 -7
@@ -1,382 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-magic-numbers */
2
- /* eslint-disable max-lines-per-function */
3
- /* eslint-disable security/detect-object-injection */
4
- /* eslint-disable @coze-arch/max-line-per-function -- 监控逻辑较多,函数较长,后续可拆分 */
5
- /* eslint-disable @typescript-eslint/no-explicit-any -- 表单组件需要处理任意类型的表单数据与第三方库接口 */
6
- import {
7
- forwardRef,
8
- useCallback,
9
- useImperativeHandle,
10
- useMemo,
11
- useRef,
12
- useState,
13
- useEffect,
14
- } from 'react';
15
- import type { Ref } from 'react';
16
-
17
- import { nanoid } from 'nanoid';
18
- import { debounce } from 'lodash-es';
19
- import dayjs from 'dayjs';
20
- import { useDebounceFn } from 'ahooks';
21
- import { type BaseFormProps, Form, type FormApi } from '@coze-arch/coze-design';
22
-
23
- import { useReportEvent } from '../provider';
24
- import { EventNames } from './enum';
25
-
26
- export interface SentinelFormProps<T extends Record<string, any>>
27
- extends BaseFormProps<any> {
28
- /**
29
- * 表单ID,用于快速定位该表单的用户,命名规范:[业务模块]-[业务名称]-[表单名称]
30
- * 示例:数据引擎-AIDP-表单创建
31
- */
32
- formID: string;
33
- // 用 T 强化对外体验,内部传递给实际 Form 时再做浅断言
34
- onSubmit?: (values: T, e?: React.FormEvent<HTMLFormElement>) => void;
35
- onValueChange?: (values: T, changed: Partial<T>) => void;
36
- }
37
- // 为外部可拿到的 ref 形态定义类型
38
- export type SentinelFormRef<T extends Record<string, any>> = Form<T> & {
39
- submitLog?: (isInterfaceError?: boolean, error?: any) => Promise<void>;
40
- };
41
-
42
- export type SentinelFormApi<T extends Record<string, any>> = FormApi<T> & {
43
- submitLog?: (isInterfaceError?: boolean, error?: any) => Promise<void>;
44
- };
45
-
46
- const SentinelFormInner = <T extends Record<string, any>>(
47
- {
48
- formID,
49
- children,
50
- onValueChange,
51
- onSubmit,
52
- getFormApi,
53
- ...props
54
- }: SentinelFormProps<T>,
55
- ref: Ref<SentinelFormRef<T>>,
56
- ) => {
57
- const sendEvent = useReportEvent();
58
- const sessionID = useMemo(() => nanoid(), []);
59
- const formRef = useRef<any>(null);
60
- const instanceRef = useRef<any>(null);
61
- const startTimeRef = useRef(0);
62
- const interfaceErrorCount = useRef(0);
63
- const validateErrorCount = useRef(0);
64
- const firstValidateSuccess = useRef(true);
65
- const noOperation = useRef(true);
66
- const noSubmit = useRef(true);
67
- const submitSuccess = useRef(false);
68
-
69
- const validateErrorLog = debounce((error: any) => {
70
- firstValidateSuccess.current = false;
71
- validateErrorCount.current = validateErrorCount.current + 1;
72
-
73
- const validateErrorTime = Date.now();
74
- const errorKeys = Object.keys(error) || [];
75
- sendEvent(EventNames.LOOP_FORM_FIELD_VALIDATE_ERROR, {
76
- form_id: formID,
77
- session_id: sessionID,
78
- form_item_error_count: errorKeys.length,
79
- form_item_error_detail: JSON.stringify(error || {}),
80
- time: validateErrorTime,
81
- time_str: dayjs(validateErrorTime).format('YYYY-MM-DD HH:mm:ss'),
82
- });
83
- }, 500);
84
-
85
- // 提交日志:仅用于接口错误统计与成功上报,不处理校验错误
86
- const submitLog = useCallback(
87
- async (isInterfaceError?: boolean, error?: any) => {
88
- noSubmit.current = false;
89
- if (isInterfaceError) {
90
- firstValidateSuccess.current = false;
91
- interfaceErrorCount.current = interfaceErrorCount.current + 1;
92
- sendEvent?.(EventNames.LOOP_FORM_SUBMIT_INTERFACE_ERROR, {
93
- form_id: formID,
94
- session_id: sessionID,
95
- form_interface_error_detail: JSON.stringify(error || {}),
96
- time: Date.now(),
97
- time_str: dayjs(Date.now()).format('YYYY-MM-DD HH:mm:ss'),
98
- });
99
- return;
100
- }
101
-
102
- const values = await formRef?.current?.formApi?.getValues();
103
- submitSuccess.current = true;
104
- const formItemShow = Object.keys(values);
105
- const formItemFilled = formItemShow.filter(key => values[key]);
106
- const successTime = Date.now();
107
- sendEvent?.(EventNames.LOOP_FORM_SUBMIT_SUCCESS, {
108
- form_id: formID,
109
- session_id: sessionID,
110
- // 完成耗时
111
- form_complete_consume_time: Date.now() - startTimeRef.current,
112
- // 接口报错次数,需要计算
113
- form_interface_error: interfaceErrorCount.current,
114
- // 一次点击成功次数 pv
115
- form_once_success_submit:
116
- interfaceErrorCount.current === 0 && firstValidateSuccess.current,
117
- // 表单填写项
118
- form_item_filled: JSON.stringify(formItemFilled),
119
- // 表单展现项
120
- form_item_show: JSON.stringify(formItemShow),
121
- // 表单项使用率
122
- form_item_used_percent: formItemFilled.length / formItemShow.length,
123
- form_values: JSON.stringify(values),
124
- time: successTime,
125
- time_str: dayjs(successTime).format('YYYY-MM-DD HH:mm:ss'),
126
- });
127
- },
128
- [formID, sessionID],
129
- );
130
-
131
- // 劫持 validate,确保任何方式获取到的 formApi 都会命中被包装的 validate
132
- const hijackValidate = useCallback(
133
- (instance: any) => {
134
- if (!instance) {
135
- return instance;
136
- }
137
- const FLAG = '__validateHijacked__';
138
- if (instance[FLAG]) {
139
- return instance;
140
- }
141
- const originalValidate =
142
- typeof instance.validate === 'function'
143
- ? instance.validate.bind(instance)
144
- : null;
145
- if (originalValidate) {
146
- instance.validate = (...args: any[]) => {
147
- try {
148
- const maybePromise = originalValidate(...args);
149
- return Promise.resolve(maybePromise).catch(err => {
150
- // 校验失败:直接上报校验错误,不触发 submitLog
151
- validateErrorLog(err);
152
- throw err;
153
- });
154
- } catch (err) {
155
- validateErrorLog(err);
156
- throw err;
157
- }
158
- };
159
- instance[FLAG] = true;
160
- }
161
- if (!instance?.submitLog) {
162
- instance.submitLog = submitLog;
163
- }
164
- return instance;
165
- },
166
- [submitLog],
167
- );
168
-
169
- const operationTimelineRef = useRef({});
170
- // 关闭标签页/浏览器上报所需:保证拿到最新的 formID/sessionID 与避免重复上报
171
- const formIdRef = useRef<string>(formID);
172
- const sessionIdRef = useRef<string>(sessionID);
173
- const flushedRef = useRef(false);
174
-
175
- useEffect(() => {
176
- formIdRef.current = formID;
177
- }, [formID]);
178
-
179
- useEffect(() => {
180
- sessionIdRef.current = sessionID;
181
- }, [sessionID]);
182
-
183
- // 空闲状态相关
184
- const [isIdle, setIsIdle] = useState(false);
185
- const [idleStartTime, setIdleStartTime] = useState<number | null>(null);
186
- const IDLE_THRESHOLD = 5000; // 空闲阈值,单位毫秒(5秒)
187
- const IDLE_CHECK_INTERVAL = 1000; // 空闲检查间隔,单位毫秒(1秒)
188
- // 记录最后一次用户活跃时间
189
- const [lastActiveTime, setLastActiveTime] = useState(Date.now());
190
-
191
- const handleValueChange = changedValues => {
192
- noOperation.current = false;
193
- for (const key in changedValues) {
194
- if (Object.prototype.hasOwnProperty.call(changedValues, key)) {
195
- const currentTime = Date.now();
196
- setLastActiveTime(currentTime); // 更新最后活跃时间
197
-
198
- if (!operationTimelineRef.current[key]) {
199
- // 首次操作该字段,初始化操作记录
200
- operationTimelineRef.current = {
201
- ...operationTimelineRef.current,
202
- [key]: [
203
- {
204
- startTime: currentTime,
205
- startTimeStr: dayjs(currentTime).format('YYYY-MM-DD HH:mm:ss'),
206
- endTime: currentTime,
207
- endTimeStr: dayjs(currentTime).format('YYYY-MM-DD HH:mm:ss'),
208
- duration: 0,
209
- idleTime: 0, // 初始无效空闲时间为0
210
- },
211
- ],
212
- };
213
- } else {
214
- const lastOperation =
215
- operationTimelineRef.current[key][
216
- operationTimelineRef.current[key].length - 1
217
- ];
218
- const totalDurationSinceLast = currentTime - lastOperation.startTime; // 本次操作从上次开始到现在的总时长
219
- let idleTimeDeducted = 0;
220
-
221
- if (isIdle && idleStartTime !== null) {
222
- // 如果之前处于空闲状态,扣除这段空闲时间
223
- idleTimeDeducted = currentTime - idleStartTime;
224
- setIsIdle(false); // 重置空闲状态
225
- }
226
-
227
- const effectiveDuration = totalDurationSinceLast - idleTimeDeducted;
228
- const newOperation = {
229
- startTime: currentTime,
230
- startTimeStr: dayjs(currentTime).format('YYYY-MM-DD HH:mm:ss'),
231
- endTime: currentTime,
232
- endTimeStr: dayjs(currentTime).format('YYYY-MM-DD HH:mm:ss'),
233
- duration: effectiveDuration,
234
- idleTime: idleTimeDeducted,
235
- };
236
-
237
- // 更新操作时间轴,添加新的操作记录
238
- operationTimelineRef.current = {
239
- ...operationTimelineRef.current,
240
- [key]: [...operationTimelineRef.current[key], newOperation],
241
- };
242
- }
243
- }
244
- }
245
- };
246
-
247
- const onFormClose = () => {
248
- const closeTime = Date.now();
249
- sendEvent?.(EventNames.LOOP_FORM_CLOSE, {
250
- form_id: formIdRef.current,
251
- session_id: sessionIdRef.current,
252
- // 无表单操作 pv
253
- form_no_operation: noOperation.current,
254
- // 有表单操作,无表单提交操作次数 pv
255
- form_operation_no_submit: !noOperation.current && noSubmit.current,
256
- // 表单是否提交成功
257
- form_operation_submit_success: submitSuccess.current,
258
- // 接口报错次数​, 需要计算
259
- form_request_error_times: interfaceErrorCount.current,
260
- // 表单项报错次数
261
- form_item_error_times: validateErrorCount.current,
262
- time: closeTime,
263
- time_str: dayjs(closeTime).format('YYYY-MM-DD HH:mm:ss'),
264
- });
265
- };
266
- const onFormCloseDobounce = useDebounceFn(onFormClose, { wait: 200 });
267
-
268
- const onValuesChange = (values: any, changedValues: any) => {
269
- handleValueChange(changedValues);
270
- onValueChange?.(values as T, changedValues as Partial<T>);
271
- };
272
-
273
- useEffect(() => {
274
- if (sessionID && formID) {
275
- startTimeRef.current = Date.now();
276
- }
277
- }, [formID, sessionID]);
278
-
279
- // 定时检测用户是否进入空闲状态
280
- useEffect(() => {
281
- const idleChecker = setInterval(() => {
282
- if (!isIdle && Date.now() - lastActiveTime > IDLE_THRESHOLD) {
283
- setIsIdle(true);
284
- setIdleStartTime(Date.now());
285
- }
286
- }, IDLE_CHECK_INTERVAL); // 每秒检查一次
287
-
288
- return () => clearInterval(idleChecker);
289
- }, [isIdle, lastActiveTime]);
290
-
291
- // 初始化: 进入表单时间
292
- useEffect(() => {
293
- if (sessionID && formID) {
294
- const initTime = Date.now();
295
- sendEvent?.(EventNames.INIT_LOOP_FORM, {
296
- form_id: formID,
297
- session_id: sessionID,
298
- time: initTime,
299
- time_str: dayjs(initTime).format('YYYY-MM-DD HH:mm:ss'),
300
- });
301
- }
302
-
303
- return () => {
304
- if (formID && sessionID && !flushedRef.current) {
305
- flushedRef.current = true;
306
- sendEvent?.(EventNames.LOOP_FORM_FIELD_CHANGE_TIMELINE, {
307
- form_id: formID,
308
- session_id: sessionID,
309
- time_line: JSON.stringify(operationTimelineRef.current),
310
- });
311
- onFormCloseDobounce.run();
312
- }
313
- };
314
- }, [formID, sessionID]);
315
-
316
- // 关注页面关闭(tab 关闭/浏览器退出/导航离开等),不处理页面隐藏
317
- useEffect(() => {
318
- const flushOnClose = () => {
319
- if (flushedRef.current) {
320
- return;
321
- }
322
- const fid = formIdRef.current;
323
- const sid = sessionIdRef.current;
324
- if (!fid || !sid) {
325
- return;
326
- }
327
- flushedRef.current = true;
328
-
329
- sendEvent?.(EventNames.LOOP_FORM_FIELD_CHANGE_TIMELINE, {
330
- form_id: fid,
331
- session_id: sid,
332
- time_line: JSON.stringify(operationTimelineRef.current),
333
- });
334
-
335
- onFormCloseDobounce.run();
336
- };
337
-
338
- // 仅监听会导致页面真正卸载的事件
339
- window.addEventListener('pagehide', flushOnClose);
340
- window.addEventListener('beforeunload', flushOnClose);
341
-
342
- return () => {
343
- window.removeEventListener('pagehide', flushOnClose);
344
- window.removeEventListener('beforeunload', flushOnClose);
345
- };
346
- }, []);
347
-
348
- useImperativeHandle(ref, () => {
349
- const newFormApi: any = hijackValidate(formRef?.current?.formApi);
350
- const result: SentinelFormRef<T> = {
351
- ...(formRef?.current || {}),
352
- formApi: newFormApi,
353
- submitLog,
354
- };
355
- return result;
356
- });
357
-
358
- return (
359
- <Form
360
- ref={formRef}
361
- onValueChange={onValuesChange}
362
- getFormApi={instance => {
363
- const hijacked = hijackValidate(instance);
364
- instanceRef.current = hijacked;
365
- getFormApi?.(hijacked);
366
- }}
367
- onSubmit={values => {
368
- onSubmit?.(values as T);
369
- }}
370
- onSubmitFail={validateErrorLog}
371
- {...(props as BaseFormProps<any>)}
372
- >
373
- {children}
374
- </Form>
375
- );
376
- };
377
-
378
- export const SentinelForm = forwardRef(SentinelFormInner) as <
379
- T extends Record<string, any>,
380
- >(
381
- props: SentinelFormProps<T> & { ref?: Ref<SentinelFormRef<T>> },
382
- ) => JSX.Element;
@@ -1,45 +0,0 @@
1
- .step-nav{
2
- height: 24px;
3
- display: flex;
4
- gap:28px;
5
- align-items: center;
6
- justify-content: center;
7
-
8
- .tab-step{
9
- display: flex;
10
- gap: 8px;
11
- align-items: center;
12
-
13
- font-weight: 500 !important;
14
- color: rgba(32, 41, 69, 62%);
15
-
16
- .tab-icon{
17
- display: inline-flex;
18
- align-items: center;
19
- justify-content: center;
20
-
21
- width: 24px;
22
- height: 24px;
23
-
24
- font-size: 13px;
25
- font-weight: 500;
26
- font-style: normal;
27
- line-height: 24px;
28
- text-align: center;
29
-
30
- background: rgba(87, 104, 161, 8%);
31
- border-radius: 12px;
32
-
33
- }
34
- }
35
-
36
- .tab-active{
37
- color: #5147FF;
38
-
39
- .tab-icon{
40
- color: #fff;
41
-
42
- background: #5147FF;
43
- }
44
- }
45
- }
@@ -1,53 +0,0 @@
1
- import classNames from 'classnames';
2
- import { IconCozCheckMarkFill } from '@coze-arch/coze-design/icons';
3
- import { Typography } from '@coze-arch/coze-design';
4
-
5
- import styles from './index.module.less';
6
-
7
- interface StepNavProps {
8
- currentStep: string;
9
- stepItems: {
10
- key: string;
11
- label: string;
12
- icon?: React.ReactNode;
13
- }[];
14
- onStepChange?: (step: string) => void;
15
- clickToChange?: boolean;
16
- }
17
-
18
- export function StepNav({
19
- currentStep,
20
- stepItems,
21
- onStepChange,
22
- clickToChange,
23
- }: StepNavProps) {
24
- const activeStepIndex = stepItems.findIndex(item => item.key === currentStep);
25
- return (
26
- <div className={styles['step-nav']}>
27
- {stepItems.map((item, index) => (
28
- <Typography.Text
29
- key={item.key}
30
- className={classNames(styles['tab-step'], {
31
- [styles['tab-active']]:
32
- currentStep === item.key || index <= activeStepIndex,
33
- 'cursor-pointer': clickToChange,
34
- })}
35
- icon={
36
- index < activeStepIndex ? (
37
- <span className={styles['tab-icon']}>
38
- <IconCozCheckMarkFill />
39
- </span>
40
- ) : (
41
- <span className={styles['tab-icon']}>
42
- {item?.icon ?? index + 1}
43
- </span>
44
- )
45
- }
46
- onClick={() => clickToChange && onStepChange?.(item.key)}
47
- >
48
- {item.label}
49
- </Typography.Text>
50
- ))}
51
- </div>
52
- );
53
- }
@@ -1,144 +0,0 @@
1
- #loop-table {
2
- /* stylelint-disable declaration-no-important */
3
- /* stylelint-disable no-descending-specificity */
4
- :global {
5
- .semi-table-container {
6
- overflow: hidden;
7
- border: 1px solid var(--line-color-border-2, #eaedf1);
8
- border-radius: 6px;
9
- }
10
-
11
- .semi-table-header {
12
- background-color: var(--coz-bg, #f0f0f7);
13
- }
14
-
15
- .semi-spin-wrapper {
16
- svg {
17
- width: 20px;
18
- height: 20px;
19
- }
20
- }
21
-
22
- .semi-table-row:hover > .semi-table-row-cell:first-child {
23
- border-top-left-radius: 0;
24
- border-bottom-left-radius: 0;
25
- }
26
-
27
- .semi-table-row:hover > .semi-table-row-cell:last-child {
28
- border-top-right-radius: 0;
29
- border-bottom-right-radius: 0;
30
- }
31
-
32
- .semi-table-tbody {
33
- .semi-table-row:last-child {
34
- .semi-table-row-cell {
35
- border-bottom: none;
36
- }
37
- }
38
- }
39
-
40
- .semi-table-row-head {
41
- box-sizing: border-box;
42
- height: 42px;
43
- padding: 5px 20px;
44
-
45
- font-size: 13px;
46
- font-weight: 500;
47
- line-height: 20px;
48
- color: var(--coz-fg-plus);
49
-
50
- background: var(--coz-bg, #f0f0f7);
51
- background-color: var(--coz-bg, #f0f0f7) !important;
52
- border-bottom: 1px solid var(--line-color-border-2, #eaedf1);
53
-
54
- &::before {
55
- background-color: var(--coz-bg, #f0f0f7) !important;
56
- }
57
- }
58
-
59
- .semi-table-row {
60
- background-color: var(--coz-bg-max);
61
-
62
- &:hover {
63
- border-radius: 0 !important;
64
-
65
- .semi-table-row-cell {
66
- background-color: var(--coz-bg);
67
- }
68
-
69
- .semi-table-cell-fixed-left {
70
- background-image: linear-gradient(0deg, var(--coz-bg), var(--coz-bg));
71
- }
72
-
73
- .semi-table-cell-fixed-right {
74
- background-image: linear-gradient(0deg, var(--coz-bg), var(--coz-bg));
75
- }
76
- }
77
- }
78
-
79
- .semi-table-row-cell {
80
- overflow: hidden;
81
-
82
- box-sizing: border-box;
83
- height: 42px;
84
- padding: 10px 20px;
85
-
86
- font-size: 13px;
87
- font-weight: 400;
88
- color: var(--coz-fg-primary);
89
- vertical-align: top;
90
-
91
- background-color: #fff;
92
- border-radius: 0;
93
- vertical-align: middle;
94
- }
95
-
96
- // 左侧固定列去除左边框,仅保留阴影
97
- .semi-table-tbody > .semi-table-row > .semi-table-cell-fixed-left-last,
98
- .semi-table-thead
99
- > .semi-table-row
100
- > .semi-table-row-head.semi-table-cell-fixed-left-last {
101
- border-right: none;
102
- box-shadow: 2px 0 8px rgba(0, 0, 0, 6%);
103
- }
104
-
105
- // 右侧固定列去除左边框,仅保留阴影
106
- .semi-table-tbody > .semi-table-row > .semi-table-cell-fixed-right-first,
107
- .semi-table-thead
108
- > .semi-table-row
109
- > .semi-table-row-head.semi-table-cell-fixed-right-first {
110
- border-left: none;
111
- box-shadow: -2px 0 8px rgba(0, 0, 0, 6%);
112
- }
113
-
114
- .semi-table-scroll-position-left
115
- .semi-table-tbody
116
- > .semi-table-row
117
- > .semi-table-cell-fixed-left-last,
118
- .semi-table-scroll-position-left
119
- .semi-table-thead
120
- > .semi-table-row
121
- > .semi-table-cell-fixed-left-last,
122
- .semi-table-scroll-position-right
123
- .semi-table-tbody
124
- > .semi-table-row
125
- > .semi-table-cell-fixed-right-first,
126
- .semi-table-scroll-position-right
127
- .semi-table-thead
128
- > .semi-table-row
129
- > .semi-table-cell-fixed-right-first {
130
- box-shadow: none !important;
131
- }
132
-
133
- .semi-table-bordered
134
- .semi-table-thead
135
- > .semi-table-row
136
- > .semi-table-row-head:last-child,
137
- .semi-table-bordered
138
- .semi-table-tbody
139
- > .semi-table-row
140
- > .semi-table-row-cell:last-child {
141
- border-right: none;
142
- }
143
- }
144
- }
@@ -1,18 +0,0 @@
1
- import { IconCozIllusEmpty } from '@coze-arch/coze-design/illustrations';
2
- import { type TableProps, EmptyState, Table } from '@coze-arch/coze-design';
3
-
4
- import styles from './index.module.less';
5
-
6
- export const LoopTable: React.FC<TableProps> = ({ className, ...props }) => (
7
- <Table
8
- empty={
9
- <EmptyState
10
- size="full_screen"
11
- icon={<IconCozIllusEmpty />}
12
- title="暂无数据"
13
- />
14
- }
15
- {...props}
16
- id={styles['loop-table']}
17
- />
18
- );