@zjlab-fe/data-hub-ui 0.32.6 → 0.33.1

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 (73) hide show
  1. package/dist/types/components/FileUploader/UploadStoreProvider/UploadStoreProvider.d.ts +4 -1
  2. package/dist/types/components/SDK-modal/document-link.d.ts +1 -3
  3. package/dist/types/components/SDK-modal/index.d.ts +4 -0
  4. package/dist/types/components/SDK-modal/inner-modal.d.ts +9 -0
  5. package/dist/types/components/SDK-modal/types.d.ts +4 -3
  6. package/dist/types/components/apply-perm-modal/index.d.ts +14 -5
  7. package/dist/types/components/confirm-again/index.d.ts +8 -1
  8. package/dist/types/components/copy/index.d.ts +9 -4
  9. package/dist/types/components/limit-credit-modal/index.d.ts +9 -3
  10. package/dist/types/components/tag-group-filter/dataSizeFilter.d.ts +0 -1
  11. package/dist/types/components/tag-group-filter/index.d.ts +4 -1
  12. package/dist/types/index.d.ts +7 -5
  13. package/dist/types/locale/index.d.ts +18 -0
  14. package/dist/types/locale/modalHolder.d.ts +11 -0
  15. package/dist/types/locale/resolveLocale.d.ts +9 -0
  16. package/dist/types/locale/translations.d.ts +808 -0
  17. package/dist/types/locale/types.d.ts +32 -0
  18. package/es/components/FileUploader/Locale/useTranslate.js +34 -11
  19. package/es/components/FileUploader/UploadStoreProvider/UploadStoreProvider.js +5 -3
  20. package/es/components/FileUploader/hooks/useOnMountedResumeUnfinished.js +6 -3
  21. package/es/components/SDK-modal/document-link.js +5 -2
  22. package/es/components/SDK-modal/index.js +29 -2
  23. package/es/components/SDK-modal/inner-modal.js +23 -12
  24. package/es/components/apply-perm-modal/index.js +20 -8
  25. package/es/components/confirm-again/index.js +12 -2
  26. package/es/components/copy/index.js +21 -7
  27. package/es/components/data-table/index.js +15 -4
  28. package/es/components/dataset-batch-action/index.js +48 -25
  29. package/es/components/file-preview/data-table/index.js +4 -3
  30. package/es/components/file-preview/index.js +5 -4
  31. package/es/components/file-uploader/components/uploader-drop-zone.js +4 -2
  32. package/es/components/file-uploader/components/uploader-file-item.js +12 -9
  33. package/es/components/file-uploader/components/uploader-file-list.js +6 -3
  34. package/es/components/file-uploader/components/uploader.js +4 -2
  35. package/es/components/file-uploader/components/uploading-status.js +18 -12
  36. package/es/components/header/index.js +3 -1
  37. package/es/components/input-tag/index.js +5 -2
  38. package/es/components/limit-credit-modal/index.js +38 -19
  39. package/es/components/menu/index.js +5 -2
  40. package/es/components/notion-editor/code-block/languages.js +1 -1
  41. package/es/components/notion-editor/index.js +34 -13
  42. package/es/components/operator-chain/components/AddButton.js +3 -1
  43. package/es/components/operator-chain/components/IOCard.js +4 -1
  44. package/es/components/operator-chain/components/VirtualDropdown.js +6 -3
  45. package/es/components/permission-editor/index.js +1 -0
  46. package/es/components/permission-editor/permissionEditModal/index.js +7 -4
  47. package/es/components/permission-editor/permissionEditor/index.js +40 -75
  48. package/es/components/permission-editor/permissionViewPopover/index.js +5 -2
  49. package/es/components/tag-group-filter/dataSizeFilter.js +6 -3
  50. package/es/components/tag-group-filter/index.js +2 -2
  51. package/es/components/tip-tap/bubble-menu.js +8 -3
  52. package/es/components/tip-tap/editor.js +5 -2
  53. package/es/components/tip-tap/extensions/index.js +1 -1
  54. package/es/components/tip-tap/toolbar/components/color-picker.js +3 -1
  55. package/es/components/tip-tap/toolbar/components/heading-dropdown.js +8 -5
  56. package/es/components/tip-tap/toolbar/components/link-button.js +4 -1
  57. package/es/components/tip-tap/toolbar/components/table-button.js +5 -2
  58. package/es/components/tip-tap/toolbar/index.js +4 -1
  59. package/es/components/uploadDrawer/fileUploadDrawer.js +6 -2
  60. package/es/components/uploadDrawer/fileUploadDrawerList.js +4 -1
  61. package/es/components/uploadDrawer/fileUploadDrawerListProgressButton.js +4 -2
  62. package/es/components/uploadDrawer/hooks/useCancelUpload.js +3 -1
  63. package/es/components/uploadDrawer/hooks/useFilterFiles.js +7 -4
  64. package/es/components/uploadDrawer/hooks/useFormatFiles.js +3 -1
  65. package/es/components/uploadDrawer/hooks/useResumeUnfinishedUploads.js +7 -6
  66. package/es/components/uploadDrawer/index.js +4 -2
  67. package/es/index.js +6 -5
  68. package/es/locale/index.js +64 -0
  69. package/es/locale/modalHolder.js +21 -0
  70. package/es/locale/resolveLocale.js +73 -0
  71. package/es/locale/translations.js +273 -0
  72. package/lib/index.js +1 -1
  73. package/package.json +7 -3
@@ -12,7 +12,10 @@ export declare const UploadStoreDispatchContext: React.Context<UploadStoreDispat
12
12
  /**
13
13
  * @deprecated This component is deprecated and will be removed in future releases.
14
14
  */
15
- export default function UploadStoreProvider({ locale, children, }: {
15
+ export default function UploadStoreProvider({ locale: _locale, children, }: {
16
+ /**
17
+ * @deprecated 语言由 DataHubProvider / antd ConfigProvider 决定,此字段不再读取
18
+ */
16
19
  locale?: 'zh' | 'en';
17
20
  children: React.ReactElement;
18
21
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,5 @@
1
- import { SDKModalLocale } from './locale/translations';
2
1
  type DocumentationLinkProps = {
3
2
  link: string;
4
- locale: SDKModalLocale;
5
3
  };
6
- export default function DocumentationLink({ link, locale }: DocumentationLinkProps): import("react/jsx-runtime").JSX.Element;
4
+ export default function DocumentationLink({ link }: DocumentationLinkProps): import("react/jsx-runtime").JSX.Element;
7
5
  export {};
@@ -2,6 +2,10 @@ import { SDKModalProps, SDKModalConfig } from './types';
2
2
  export declare function showSDKModal(config: SDKModalConfig): {
3
3
  destroy: () => void;
4
4
  };
5
+ export declare function useSDKModal(): (config: SDKModalConfig) => {
6
+ destroy: () => void;
7
+ update: (configUpdate: import("antd/es/modal/confirm").ConfigUpdate) => void;
8
+ };
5
9
  declare function SDKModalComponent(props: SDKModalProps): import("react/jsx-runtime").JSX.Element;
6
10
  type SDKModalType = typeof SDKModalComponent & {
7
11
  show: typeof showSDKModal;
@@ -1,3 +1,12 @@
1
+ import { ModalProps } from 'antd';
1
2
  import { SDKModalProps } from './types';
3
+ export declare const defaultModalConfig: ModalProps;
4
+ export declare const SDKModalContent: import("react").NamedExoticComponent<{
5
+ SDKCode?: string;
6
+ loadSDK?: () => Promise<string>;
7
+ subTitle?: string;
8
+ documentLink?: string;
9
+ active?: boolean;
10
+ }>;
2
11
  declare const _default: import("react").NamedExoticComponent<SDKModalProps>;
3
12
  export default _default;
@@ -1,6 +1,4 @@
1
- import { SDKModalLang } from './locale/translations';
2
1
  import { ModalProps } from 'antd';
3
- export type { SDKModalLang };
4
2
  export type SDKModalProps = {
5
3
  open: boolean;
6
4
  onClose: () => void;
@@ -10,6 +8,9 @@ export type SDKModalProps = {
10
8
  subTitle?: string;
11
9
  modalConfig?: ModalProps;
12
10
  documentLink?: string;
13
- locale?: SDKModalLang;
11
+ /**
12
+ * @deprecated 语言由 DataHubProvider / antd ConfigProvider 决定,此字段不再读取
13
+ */
14
+ locale?: 'zh' | 'en';
14
15
  };
15
16
  export type SDKModalConfig = Omit<SDKModalProps, 'open'>;
@@ -1,5 +1,8 @@
1
1
  import React from 'react';
2
- export interface IProps {
2
+ export type IProps = {
3
+ /**
4
+ * @deprecated 语言由 DataHubProvider / antd ConfigProvider 决定,此字段不再读取
5
+ */
3
6
  locale?: 'zh' | 'en';
4
7
  open?: boolean;
5
8
  /**
@@ -7,17 +10,23 @@ export interface IProps {
7
10
  */
8
11
  noModal?: boolean;
9
12
  onCancel?: (e: React.MouseEvent<HTMLButtonElement>) => void;
10
- }
13
+ };
11
14
  /**
12
15
  * 申请权限弹窗
13
- * @param locale {string} 语言 'zh' | 'en',默认zh
16
+ * @param locale 已废弃,语言由 DataHubProvider / antd ConfigProvider 决定
14
17
  * @param open {boolean} 是否展示弹窗
15
18
  * @param noModal {boolean} 是否以非弹窗形式展示
16
19
  * @param onCancel {function} 取消回调
17
- * @returns
18
20
  */
19
21
  declare function ApplyPermModal(props: IProps): import("react/jsx-runtime").JSX.Element;
20
22
  declare namespace ApplyPermModal {
21
- var confirm: (props?: IProps) => void;
23
+ var confirm: (props?: IProps) => {
24
+ destroy: () => void;
25
+ update: (configUpdate: import("antd/es/modal/confirm").ConfigUpdate) => void;
26
+ };
22
27
  }
23
28
  export default ApplyPermModal;
29
+ export declare function useApplyPermModal(): (props?: IProps) => {
30
+ destroy: () => void;
31
+ update: (configUpdate: import("antd/es/modal/confirm").ConfigUpdate) => void;
32
+ };
@@ -2,6 +2,13 @@ import type { ModalProps, ModalFuncProps } from 'antd';
2
2
  import './index.scss';
3
3
  declare function ConfirmAgain(props: ModalProps): import("react/jsx-runtime").JSX.Element;
4
4
  declare namespace ConfirmAgain {
5
- var confirm: (props: ModalFuncProps) => void;
5
+ var confirm: (props: ModalFuncProps) => {
6
+ destroy: () => void;
7
+ update: (configUpdate: import("antd/es/modal/confirm").ConfigUpdate) => void;
8
+ };
6
9
  }
7
10
  export default ConfirmAgain;
11
+ export declare function useConfirmAgain(): (props: ModalFuncProps) => {
12
+ destroy: () => void;
13
+ update: (configUpdate: import("antd/es/modal/confirm").ConfigUpdate) => void;
14
+ };
@@ -1,19 +1,24 @@
1
- export interface ICopy {
1
+ export type ICopy = {
2
2
  /** 是否展示复制成功后的反馈信息,默认展示 */
3
3
  showFeedback?: boolean;
4
4
  /** 待复制到粘贴板的文本,如果传入为null or undefined,将不会自动复制到粘贴板 */
5
5
  text?: string;
6
6
  onClick?: () => void;
7
- /** 语言,默认:zh */
7
+ /**
8
+ * @deprecated 语言由 DataHubProvider / antd ConfigProvider 决定,此字段不再读取
9
+ */
8
10
  locale?: 'zh' | 'en';
9
- }
11
+ };
10
12
  export default function Copy(props: ICopy): import("react/jsx-runtime").JSX.Element;
13
+ export declare function useCopy(): (text: string, options?: {
14
+ showFeedback?: boolean;
15
+ }) => void;
11
16
  /**
12
17
  * 复制文本内容到粘贴板
13
18
  * @param text {string} 文本内容
14
19
  * @param options {object} 其它选项
15
20
  * @param options.showFeedback {boolean} 是否展示复制成功的反馈信息,默认展示
16
- * @param options.locale {string} 语言,默认:zh
21
+ * @param options.locale 已废弃,语言由 DataHubProvider / antd ConfigProvider 决定
17
22
  */
18
23
  export declare function copy(text: string, options?: {
19
24
  showFeedback?: boolean;
@@ -1,9 +1,15 @@
1
- export interface LimitCreditModalProps {
1
+ export type LimitCreditModalProps = {
2
2
  open?: boolean;
3
3
  onCancel?: () => void;
4
- }
4
+ };
5
5
  declare const LimitCreditModal: {
6
6
  (props: LimitCreditModalProps): import("react/jsx-runtime").JSX.Element;
7
- open(): void;
7
+ open(props?: Omit<LimitCreditModalProps, "open">): {
8
+ destroy: () => void;
9
+ };
10
+ };
11
+ export declare function useLimitCreditModal(): (props?: Omit<LimitCreditModalProps, "open">) => {
12
+ destroy: () => void;
13
+ update: (configUpdate: import("antd/es/modal/confirm").ConfigUpdate) => void;
8
14
  };
9
15
  export default LimitCreditModal;
@@ -1,6 +1,5 @@
1
1
  interface IProps {
2
2
  value: string[];
3
- isEn?: boolean;
4
3
  onChange: (selected: string[]) => void;
5
4
  }
6
5
  export default function DataSizeFilter(p: IProps): import("react/jsx-runtime").JSX.Element;
@@ -9,6 +9,9 @@ interface IProps {
9
9
  tagSelected: Record<string, string[]>;
10
10
  needDataSizeFilter?: boolean;
11
11
  dataSizeValue?: string[];
12
+ /**
13
+ * @deprecated 语言由 DataHubProvider / antd ConfigProvider 决定,此字段不再读取
14
+ */
12
15
  isEn?: boolean;
13
16
  tagClassName?: {
14
17
  default?: string;
@@ -23,7 +26,7 @@ interface IProps {
23
26
  * @param tagSelected 标签选中状态
24
27
  * @param needDataSizeFilter 是否需要数据量过滤(可选)
25
28
  * @param dataSizeValue 数据量过滤值(可选)
26
- * @param isEn 是否英文环境(可选)
29
+ * @param isEn 已废弃,语言由 DataHubProvider / antd ConfigProvider 决定
27
30
  * @param tagClassName 标签类名(可选)
28
31
  * @param onTagChange 标签选中状态变化回调
29
32
  * @param onDataSizeChange 数据量过滤值变化回调(可选)
@@ -10,9 +10,9 @@ export type { FileUploadModalProps } from './components/FileUploader/FileUploadM
10
10
  export type { FileUploaderProps } from './components/FileUploader/FileUploaderImpl/FileUploader';
11
11
  export * from './components/file-uploader';
12
12
  export { default as FilePreview } from './components/file-preview';
13
- export { default as Copy, copy } from './components/copy';
13
+ export { default as Copy, copy, useCopy } from './components/copy';
14
14
  export type { ICopy } from './components/copy';
15
- export { default as ConfirmAgain } from './components/confirm-again';
15
+ export { default as ConfirmAgain, useConfirmAgain } from './components/confirm-again';
16
16
  export { default as FloatingLayer } from './components/floating-layer';
17
17
  export { default as BenchCard } from './components/bench-card';
18
18
  export { default as AuthTag } from './components/auth-tag';
@@ -28,7 +28,7 @@ export { default as Tiptap, TipTapReader } from './components/tip-tap';
28
28
  export { default as PermissionEditor } from './components/permission-editor';
29
29
  export { PermissionEditModal } from './components/permission-editor';
30
30
  export { PermissionViewPopover } from './components/permission-editor';
31
- export { default as ApplyPermModal } from './components/apply-perm-modal';
31
+ export { default as ApplyPermModal, useApplyPermModal } from './components/apply-perm-modal';
32
32
  export { default as Menu } from './components/menu';
33
33
  export { default as RadioCard } from './components/radio-card';
34
34
  export type { RadioCardProps, RadioOption } from './components/radio-card';
@@ -40,11 +40,13 @@ export type { ModelCardProps } from './components/model-card';
40
40
  export type { CorpusCardProps, ProcessTemplateListItem, ProcessTemplateLabel, LabelTypeColor, } from './components/corpus-card';
41
41
  export { default as DataTable } from './components/data-table';
42
42
  export type { DataTableProps, DataTableColumn, TableRowAction, RowSelectionConfig, RowTextExpandConfig, } from './components/data-table';
43
- export { default as SDKModal } from './components/SDK-modal';
43
+ export { default as SDKModal, useSDKModal } from './components/SDK-modal';
44
44
  export { default as TagView } from './components/tag-view';
45
45
  export { default as TagGroupFilter } from './components/tag-group-filter';
46
- export { default as LimitCreditModal } from './components/limit-credit-modal';
46
+ export { default as LimitCreditModal, useLimitCreditModal } from './components/limit-credit-modal';
47
47
  export type { LimitCreditModalProps } from './components/limit-credit-modal';
48
48
  export { default as DatasetBatchAction } from './components/dataset-batch-action';
49
49
  export type { IConfirmParam, IFieldOption, IDatasetBatchActionParams, } from './components/dataset-batch-action';
50
50
  export { EDatasetBatchType } from './components/dataset-batch-action';
51
+ export { DataHubProvider } from './locale';
52
+ export type { DataHubProviderProps, DataHubAntdMode, DataHubTheme, DataHubThemeToken, DataHubLang, } from './locale';
@@ -0,0 +1,18 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { DataHubAntdMode, DataHubTheme, DataHubLang, DataHubLocale } from './types';
3
+ import { interpolate } from './resolveLocale';
4
+ export type { DataHubAntdMode, DataHubTheme, DataHubThemeToken, DataHubLang, DataHubLocale } from './types';
5
+ export type DataHubProviderProps = {
6
+ /** data-hub-ui 文案语言。不传时 inherit 跟随宿主 antd locale,否则默认中文。 */
7
+ intl?: DataHubLang;
8
+ /** 与宿主共享 antd 5 Context 时用 inherit;双实例时显式使用 isolated。 */
9
+ antdMode?: DataHubAntdMode;
10
+ /** data-hub-ui 内部 antd 5 使用的稳定 Seed Token 子集与亮暗模式。 */
11
+ theme?: DataHubTheme;
12
+ children: ReactNode;
13
+ };
14
+ export declare function DataHubProvider(props: DataHubProviderProps): import("react/jsx-runtime").JSX.Element;
15
+ export declare function useLocale(): {
16
+ locale: DataHubLocale;
17
+ t: typeof interpolate;
18
+ };
@@ -0,0 +1,11 @@
1
+ import { type ReactNode } from 'react';
2
+ import { Modal } from 'antd';
3
+ import type { ModalFuncProps } from 'antd';
4
+ type DataHubModalApi = {
5
+ confirm: (config: ModalFuncProps) => ReturnType<typeof Modal.confirm>;
6
+ };
7
+ export declare function DataHubModalProvider(props: {
8
+ children: ReactNode;
9
+ }): import("react/jsx-runtime").JSX.Element;
10
+ export declare function useDataHubModal(): DataHubModalApi;
11
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { DataHubLang, DataHubLocale } from './types';
2
+ export declare function createLocaleData(lang: DataHubLang): DataHubLocale;
3
+ export declare const zhCN: DataHubLocale;
4
+ export declare const enUS: DataHubLocale;
5
+ export declare function mapToLang(input?: string): DataHubLang;
6
+ export declare function extractAntdLocaleName(antdLocale: unknown): string | undefined;
7
+ export declare function resolveIntlInput(intl?: DataHubLang): DataHubLocale | undefined;
8
+ export declare function resolveLocaleData(antdLocale?: unknown): DataHubLocale;
9
+ export declare function interpolate(template: string, params?: Record<string, string | number>): string;