disguise-ui 0.2.2 → 0.2.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.
Files changed (40) hide show
  1. package/dist/avatar-cell-BPzpEjQT.js +31 -0
  2. package/dist/context-DqlD6qDJ.js +50 -0
  3. package/dist/disguise-ui.js +1624 -1551
  4. package/dist/file-upload-BkRSvBlx.js +4 -0
  5. package/dist/{file-upload-g-PauJpk.js → file-upload-CeqibzK8.js} +5 -5
  6. package/dist/{i18n-DQW_MS90.js → i18n-DejVnxC8.js} +1 -1
  7. package/dist/{picture-upload-KEFFSvsi.js → picture-upload-E97PfpUU.js} +3 -3
  8. package/dist/{picture-upload-vp1RCUJo.js → picture-upload-uc9FsqEo.js} +1 -1
  9. package/dist/style.css +1 -1
  10. package/dist/types/components/async-select/async-select.type.d.ts +4 -0
  11. package/dist/types/components/async-select/async-select.utils.d.ts +1 -1
  12. package/dist/types/components/async-select/async-select.vue.d.ts +4 -4
  13. package/dist/types/components/async-select/index.d.ts +1 -1
  14. package/dist/types/components/dialog-list/index.vue.d.ts +10 -10
  15. package/dist/types/components/dict-tag/index.vue.d.ts +1 -1
  16. package/dist/types/components/drawer-form-page/index.vue.d.ts +2 -2
  17. package/dist/types/components/file-upload/components/file-status.vue.d.ts +1 -1
  18. package/dist/types/components/file-upload/file-upload.vue.d.ts +2 -2
  19. package/dist/types/components/image-upload/index.vue.d.ts +2 -2
  20. package/dist/types/components/images-view/index.vue.d.ts +1 -1
  21. package/dist/types/components/picture-upload/picture-upload.vue.d.ts +2 -2
  22. package/dist/types/components/rich-text-editor/index.type.d.ts +57 -0
  23. package/dist/types/components/rich-text-editor/index.vue.d.ts +3 -7
  24. package/dist/types/components/schema-form/index.d.ts +1 -1
  25. package/dist/types/components/schema-form/schema-form.type.d.ts +29 -8
  26. package/dist/types/components/schema-form/schema-form.vue.d.ts +1 -1
  27. package/dist/types/components/schema-form/translate-field.vue.d.ts +1 -1
  28. package/dist/types/components/schema-form/translate-toolbar.vue.d.ts +3 -3
  29. package/dist/types/components/search-form/index.vue.d.ts +1 -1
  30. package/dist/types/components/table-entity/index.vue.d.ts +2 -2
  31. package/dist/types/entities/registry.d.ts +3 -3
  32. package/dist/types/index.d.ts +6 -1
  33. package/dist/types/runtime/context.d.ts +3321 -0
  34. package/dist/types/setup.d.ts +1 -1
  35. package/dist/{use-image-url-hImb4UEO.js → use-image-url-Bs5WMZ6L.js} +1 -1
  36. package/dist/{use-multiple-file-upload-BrhklFSk.js → use-multiple-file-upload-BFNkLVy-.js} +3 -3
  37. package/dist/user-avatar-info-SD6OE607.js +276 -0
  38. package/package.json +1 -1
  39. package/dist/avatar-cell-BzklaM_h.js +0 -302
  40. package/dist/context-CpMT_OSb.js +0 -34
@@ -0,0 +1,57 @@
1
+ import type { Editor } from '@tiptap/vue-3';
2
+ import type { Component } from 'vue';
3
+ /** 富文本工具始终可用的编辑器上下文。 */
4
+ export type RichTextToolBaseContext = {
5
+ /** 当前 Tiptap 编辑器实例。 */
6
+ editor: Editor;
7
+ /** 编辑器当前是否允许修改。 */
8
+ editable: boolean;
9
+ /** 调用工具时的最新 HTML。 */
10
+ value: string;
11
+ /** 获取最新 HTML,适合在弹窗或异步流程结束后调用。 */
12
+ getValue: () => string;
13
+ /** 更新编辑器 HTML,并同步触发 v-model。 */
14
+ updateValue: (value: string) => void;
15
+ };
16
+ /** 自定义工具收到的完整上下文;泛型可由上层组件补充表单信息。 */
17
+ export type RichTextToolContext<TExtraContext extends object = Record<string, never>> = RichTextToolBaseContext & TExtraContext;
18
+ export type RichTextToolPredicate<TExtraContext extends object = Record<string, never>> = boolean | ((context: RichTextToolContext<TExtraContext>) => boolean);
19
+ type RichTextToolBase<TExtraContext extends object> = {
20
+ /** 工具唯一标识。 */
21
+ key: string;
22
+ /** 按钮提示文案;未提供 icon 时也作为按钮文字。 */
23
+ label: string;
24
+ /** Vue 图标组件。 */
25
+ icon?: Component;
26
+ /** 自定义工具之间的排序值,默认 0;数值越小越靠前。 */
27
+ order?: number;
28
+ /** 是否显示工具。 */
29
+ visible?: RichTextToolPredicate<TExtraContext>;
30
+ /** 是否禁用工具。编辑器不可编辑时,按钮工具始终禁用。 */
31
+ disabled?: RichTextToolPredicate<TExtraContext>;
32
+ };
33
+ /** 直接在工具栏渲染自定义 Vue 组件。组件会收到 context 与 disabled。 */
34
+ export type RichTextComponentTool<TExtraContext extends object = Record<string, never>> = RichTextToolBase<TExtraContext> & {
35
+ component: Component;
36
+ onClick?: never;
37
+ /** 额外透传给自定义组件的属性。 */
38
+ props?: Record<string, unknown>;
39
+ };
40
+ /** 渲染为工具栏按钮,点击后调用 onClick。 */
41
+ export type RichTextActionTool<TExtraContext extends object = Record<string, never>> = RichTextToolBase<TExtraContext> & {
42
+ component?: never;
43
+ onClick: (context: RichTextToolContext<TExtraContext>) => Promise<void> | void;
44
+ props?: never;
45
+ };
46
+ export type RichTextTool<TExtraContext extends object = Record<string, never>> = RichTextActionTool<TExtraContext> | RichTextComponentTool<TExtraContext>;
47
+ export type RichTextEditorProps<TExtraContext extends object = Record<string, never>> = {
48
+ editable?: boolean;
49
+ maxHeight?: string;
50
+ modelValue?: string;
51
+ placeholder?: string;
52
+ /** 追加到内置工具栏末尾的自定义工具。 */
53
+ richTextTools?: RichTextTool<TExtraContext>[];
54
+ /** 上层组件注入的额外上下文;工具使用时会与编辑器上下文合并。 */
55
+ toolContext?: TExtraContext;
56
+ };
57
+ export {};
@@ -1,10 +1,6 @@
1
1
  import type { Editor } from '@tiptap/vue-3';
2
- type __VLS_Props = {
3
- editable?: boolean;
4
- maxHeight?: string;
5
- modelValue?: string;
6
- placeholder?: string;
7
- };
2
+ import type { RichTextEditorProps } from './index.type';
3
+ type __VLS_Props = RichTextEditorProps<Record<string, unknown>>;
8
4
  declare function clearFormat(): void;
9
5
  declare const __VLS_template: () => {
10
6
  __VLS_Slots: {
@@ -21,9 +17,9 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
21
17
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
22
18
  }>, {
23
19
  modelValue: string;
20
+ maxHeight: string;
24
21
  placeholder: string;
25
22
  editable: boolean;
26
- maxHeight: string;
27
23
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
28
24
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
29
25
  declare const _default: typeof __VLS_export;
@@ -1,5 +1,5 @@
1
1
  export { registerSchemaFormComponents, resolveSchemaFormComponent, } from './schema-form-registry';
2
2
  export type { SchemaFormComponent, SchemaFormComponentConfig, SchemaFormComponentRegistration, } from './schema-form-registry';
3
- export type { ApiFieldOptions, FieldCondition, FieldContext, FieldOption, FieldOptionsResolver, FieldPropsContext, FieldPropsResolver, SchemaFormField, SchemaFormGroup, SchemaFormItem, SchemaFormMode, SchemaFormProps, SchemaFormSlotProps, TranslateCommand, TranslateConfig, TranslateHandlerContext, TranslateLanguage, TranslateLanguageValues, } from './schema-form.type';
3
+ export type { ApiFieldOptions, FieldCondition, FieldContext, FieldOption, FieldOptionsResolver, FieldPropsContext, FieldPropsResolver, SchemaCascaderProps, SchemaFormField, SchemaFormGroup, SchemaFormItem, SchemaFormMode, SchemaFormProps, SchemaFormSlotProps, SchemaRichTextEditorProps, SchemaRichTextToolContext, TranslateCommand, TranslateConfig, TranslateHandlerContext, TranslateLanguage, TranslateLanguageValues, } from './schema-form.type';
4
4
  export { DEFAULT_TRANSLATE_LANGUAGES } from './schema-form.type';
5
5
  export { default as SchemaForm } from './schema-form.vue';
@@ -1,4 +1,5 @@
1
- import type { FormItemRule } from 'element-plus';
1
+ import type { CascaderComponentProps, FormItemRule } from 'element-plus';
2
+ import type { RichTextEditorProps } from '../rich-text-editor/index.type';
2
3
  import type { SchemaFormComponent, SchemaFormComponentConfig } from './schema-form-registry';
3
4
  /** ****************************** 基础 ********************************/
4
5
  export type SchemaFormMode = 'create' | 'edit' | 'view';
@@ -38,7 +39,7 @@ export type FieldOptionsResolver = (ctx: FieldContext) => FieldOption[];
38
39
  export type FieldPropsContext = FieldContext & {
39
40
  updateValue: (value: any) => void;
40
41
  };
41
- export type FieldPropsResolver = (ctx: FieldPropsContext) => Record<string, any>;
42
+ export type FieldPropsResolver<TProps extends Record<string, any> = Record<string, any>> = (ctx: FieldPropsContext) => TProps;
42
43
  export type TranslateLanguage = {
43
44
  code: string;
44
45
  label: string;
@@ -67,9 +68,9 @@ export type TranslateConfig = {
67
68
  /** 未配置时使用显式提示的模拟翻译(复制源文到目标语言) */
68
69
  translate?: (ctx: TranslateHandlerContext) => Partial<TranslateLanguageValues> | Promise<Partial<TranslateLanguageValues> | undefined> | undefined;
69
70
  };
70
- export type FieldType = 'async-select' | 'checkbox' | 'component' | 'date' | 'datetime' | 'file' | 'number' | 'picture' | 'radio' | 'rich-text' | 'select' | 'slot' | 'switch' | 'text' | 'textarea' | 'upload';
71
+ export type FieldType = 'async-select' | 'cascader' | 'checkbox' | 'component' | 'date' | 'datetime' | 'file' | 'number' | 'picture' | 'radio' | 'rich-text' | 'select' | 'slot' | 'switch' | 'text' | 'textarea' | 'upload';
71
72
  /** ****************************** 字段 ********************************/
72
- type BaseField = {
73
+ type BaseField<TProps extends Record<string, any> = Record<string, any>> = {
73
74
  /** 覆盖内置控件,或配合 type: 'component' 使用注册的自定义组件 */
74
75
  component?: SchemaFormComponent | SchemaFormComponentConfig | string;
75
76
  /** 只读态是否附带复制按钮,默认跟随 readonly */
@@ -86,7 +87,7 @@ type BaseField = {
86
87
  newRow?: boolean;
87
88
  placeholder?: string;
88
89
  /** 透传给底层控件的额外属性 */
89
- props?: FieldPropsResolver | Record<string, any>;
90
+ props?: FieldPropsResolver<TProps> | TProps;
90
91
  prop: string;
91
92
  /** 渲染为纯文本而非输入控件 */
92
93
  readonly?: boolean;
@@ -100,6 +101,22 @@ type BaseField = {
100
101
  /** 为 text、textarea、rich-text 字段启用多语言编辑 */
101
102
  translateConfig?: TranslateConfig;
102
103
  };
104
+ /** SchemaForm 为富文本工具补充的表单上下文。 */
105
+ export type SchemaRichTextToolContext = {
106
+ /** 当前字段元数据。 */
107
+ field: ResolvedField;
108
+ /** 当前整张表单的最新值。 */
109
+ formData: Record<string, any>;
110
+ /** 弹窗或异步操作完成后获取最新表单值。 */
111
+ getFormData: () => Record<string, any>;
112
+ /** 多语言富文本当前正在编辑的语言代码。 */
113
+ language?: string;
114
+ mode: SchemaFormMode;
115
+ };
116
+ /** type: 'rich-text' 字段 props 的完整类型。 */
117
+ export type SchemaRichTextEditorProps = Omit<RichTextEditorProps<SchemaRichTextToolContext>, 'modelValue' | 'toolContext'>;
118
+ /** type: 'cascader' 字段 props 的完整类型。 */
119
+ export type SchemaCascaderProps = Omit<CascaderComponentProps, 'modelValue'>;
103
120
  export type ApiFieldOptions = {
104
121
  entityKey: string;
105
122
  labelKey?: string;
@@ -109,7 +126,7 @@ export type ApiFieldOptions = {
109
126
  subtitleKey?: string;
110
127
  valueKey?: string;
111
128
  };
112
- export type SchemaFormField = BaseField & ({
129
+ export type SchemaFormField = ((BaseField & ({
113
130
  apiOptions: ApiFieldOptions;
114
131
  optionSource?: 'api';
115
132
  type: 'async-select';
@@ -129,8 +146,12 @@ export type SchemaFormField = BaseField & ({
129
146
  optionSource?: 'static';
130
147
  type: 'checkbox' | 'radio' | 'select';
131
148
  } | {
132
- type: 'date' | 'datetime' | 'file' | 'listExpand' | 'number' | 'picture' | 'rich-text' | 'slot' | 'switch' | 'text' | 'textarea' | 'upload';
133
- }) & {
149
+ type: 'date' | 'datetime' | 'file' | 'listExpand' | 'number' | 'picture' | 'slot' | 'switch' | 'text' | 'textarea' | 'upload';
150
+ })) | (BaseField<SchemaCascaderProps> & {
151
+ type: 'cascader';
152
+ }) | (BaseField<SchemaRichTextEditorProps> & {
153
+ type: 'rich-text';
154
+ })) & {
134
155
  label: string;
135
156
  };
136
157
  /** Omit 作用在联合类型上会丢掉各分支特有字段,分组子项必须按成员展开 */
@@ -38,10 +38,10 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
38
38
  }>, {
39
39
  mode: import("./schema-form.type").SchemaFormMode;
40
40
  columns: number;
41
+ underline: boolean;
41
42
  disabled: boolean;
42
43
  loading: boolean;
43
44
  labelPosition: "top" | "left" | "right";
44
- underline: boolean;
45
45
  labelAlign: "center" | "left" | "right";
46
46
  itemGap: string | number;
47
47
  groupGap: string | number;
@@ -16,8 +16,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
16
16
  "onUpdate:modelValue"?: ((value: TranslateLanguageValues) => any) | undefined;
17
17
  }>, {
18
18
  modelValue: undefined;
19
- placeholder: string;
20
19
  disabled: boolean;
20
+ placeholder: string;
21
21
  config: TranslateConfig;
22
22
  inputProps: Record<string, any>;
23
23
  labelPosition: "top" | "left" | "right";
@@ -8,16 +8,16 @@ type __VLS_Props = {
8
8
  targetLanguage: string;
9
9
  };
10
10
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
11
+ translate: (command: TranslateCommand) => any;
11
12
  "update:sourceLanguage": (value: string) => any;
12
13
  "update:targetLanguage": (value: string) => any;
13
- translate: (command: TranslateCommand) => any;
14
14
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
15
+ onTranslate?: ((command: TranslateCommand) => any) | undefined;
15
16
  "onUpdate:sourceLanguage"?: ((value: string) => any) | undefined;
16
17
  "onUpdate:targetLanguage"?: ((value: string) => any) | undefined;
17
- onTranslate?: ((command: TranslateCommand) => any) | undefined;
18
18
  }>, {
19
- disabled: boolean;
20
19
  inline: boolean;
20
+ disabled: boolean;
21
21
  loading: boolean;
22
22
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
23
23
  declare const _default: typeof __VLS_export;
@@ -48,8 +48,8 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
48
48
  }>, {
49
49
  mode: SchemaFormMode;
50
50
  columns: number;
51
- showActions: boolean;
52
51
  disabled: boolean;
52
+ showActions: boolean;
53
53
  labelPosition: "top" | "left" | "right";
54
54
  labelAlign: "center" | "left" | "right";
55
55
  labelWidth: string | number;
@@ -60,12 +60,12 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {
60
60
  onRowSort?: ((payload: TableEntityRowSortPayload) => any) | undefined;
61
61
  }>, {
62
62
  data: import("./index.type").TableEntityRecord[] | import("./index.type").TableEntityDataFetcher<import("./index.type").TableEntityRecord>;
63
- columns: ColumnsItem[];
64
63
  height: number;
64
+ columns: ColumnsItem[];
65
+ multiple: boolean;
65
66
  rowHeight: number;
66
67
  cache: number;
67
68
  selectable: boolean;
68
- multiple: boolean;
69
69
  rowKey: string;
70
70
  selectedKeys: any[];
71
71
  tree: boolean;
@@ -5,6 +5,8 @@ export type EntityFetchParams = {
5
5
  page: number;
6
6
  per_page: number;
7
7
  params?: Record<string, any>;
8
+ /** AsyncSelect 回显已选项时传入,接口应按 valueKey 对应字段过滤。 */
9
+ selectedValues?: Array<number | string>;
8
10
  };
9
11
  export type EntityFetchResult = {
10
12
  items: Record<string, any>[];
@@ -27,7 +29,5 @@ export type EntityDefinition = {
27
29
  export declare function registerEntity(definition: EntityDefinition): void;
28
30
  export declare function getEntity(key: string): EntityDefinition | undefined;
29
31
  /** ****************************** 工具 ********************************/
30
- /**
31
- * 全量接口转分页结果:接口一次性返回全部数据时,在前端完成关键词过滤与分页。
32
- */
32
+ /** @deprecated 远程实体应由接口按 page/per_page 分页;仅保留给纯本地数据。 */
33
33
  export declare function paginateLocally(rows: Record<string, any>[], { keyword, page, per_page }: EntityFetchParams, searchKeys: string[]): EntityFetchResult;
@@ -3,10 +3,13 @@ export type * from './components/async-select/async-select.type.js';
3
3
  export { default as BaseCard } from './components/card/index.vue';
4
4
  export { CrudPage } from './components/crud-page/index.js';
5
5
  export type * from './components/crud-page/index.type.js';
6
+ export { default as DialogList } from './components/dialog-list/index.vue';
6
7
  export { default as DictTag } from './components/dict-tag/index.vue';
7
8
  export { DrawerFormPage, useDrawerFormPage, } from './components/drawer-form-page/index.js';
8
9
  export type * from './components/drawer-form-page/index.type.js';
9
10
  export { default as DisguiseIcon } from './components/disguise-icon/index.vue';
11
+ export { default as FileUpload } from './components/file-upload/file-upload.vue';
12
+ export type * from './components/file-upload/file-upload.type.js';
10
13
  export { default as ImageUpload } from './components/image-upload/index.vue';
11
14
  export { default as ImagesView } from './components/images-view/index.vue';
12
15
  export type { ImagesViewProps } from './components/images-view/index.vue';
@@ -14,6 +17,7 @@ export { default as ImportDialog } from './components/import-dialog/index';
14
17
  export type * from './components/import-dialog/index.type.js';
15
18
  export { default as PictureUpload } from './components/picture-upload/picture-upload.vue';
16
19
  export { default as RichTextEditor } from './components/rich-text-editor/index.vue';
20
+ export type * from './components/rich-text-editor/index.type.js';
17
21
  export { registerSchemaFormComponents, SchemaForm } from './components/schema-form/index.js';
18
22
  export type { SchemaFormComponent, SchemaFormComponentConfig, SchemaFormComponentRegistration, } from './components/schema-form/index.js';
19
23
  export type * from './components/schema-form/schema-form.type.js';
@@ -21,7 +25,8 @@ export { SearchForm } from './components/search-form/index.js';
21
25
  export type * from './components/search-form/index.type.js';
22
26
  export type * from './components/table-entity/index.type.js';
23
27
  export { default as TableEntity } from './components/table-entity/index.vue';
28
+ export { default as UserAvatarInfo } from './components/user-avatar-info/index.vue';
24
29
  export { getEntity, paginateLocally, registerEntity } from './entities/index';
25
30
  export type { EntityDefinition, EntityFetchParams, EntityFetchResult, } from './entities/index';
26
31
  export { setupDisguise } from './setup';
27
- export type { DisguiseOptions, DisguiseOptions as SetupDisguiseOptions, } from './setup';
32
+ export type { DisguiseOptions, DisguiseOptions as SetupDisguiseOptions, PaginationConfig, } from './setup';