@gct-paas/schema 0.1.4-dev.9 → 0.1.5-dev.0

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/index.esm.min.js +1 -0
  2. package/es/constants/design.d.ts +26 -0
  3. package/es/constants/design.mjs +30 -0
  4. package/es/constants/index.d.ts +24 -1
  5. package/es/constants/index.mjs +410 -18
  6. package/es/index.d.ts +1 -1
  7. package/es/index.mjs +13 -19
  8. package/es/interface/design/i-design-container-node.d.ts +13 -0
  9. package/es/interface/design/i-design-data.d.ts +44 -0
  10. package/es/interface/design/i-design-editor-data.d.ts +20 -0
  11. package/es/interface/design/i-design-editor-node.d.ts +15 -0
  12. package/es/interface/design/i-design-node-data.d.ts +19 -0
  13. package/es/interface/design/i-design-node.d.ts +80 -0
  14. package/es/interface/design/i-design-page-node-data.d.ts +15 -0
  15. package/es/interface/design/i-design-tree-item.d.ts +26 -0
  16. package/es/interface/design/i-drag-data-item.d.ts +46 -0
  17. package/es/interface/design/index.d.ts +9 -0
  18. package/es/interface/designer.d.ts +1 -1
  19. package/es/interface/index.d.ts +2 -0
  20. package/es/interface/modal/i-modal-body.d.ts +1 -1
  21. package/es/interface/relationship-diagram-config/i-relationship-diagram-node.d.ts +82 -0
  22. package/es/interface/relationship-diagram-config/i-rule-config.d.ts +135 -0
  23. package/es/interface/relationship-diagram-config/index.d.ts +2 -0
  24. package/es/interface/schema/widget-props/i-card-list-props.d.ts +79 -0
  25. package/es/interface/schema/widget-props/i-form-container-props.d.ts +19 -5
  26. package/es/interface/schema/widget-props/i-form-input-props.d.ts +1 -1
  27. package/es/interface/schema/widget-props/i-search-widget-props.d.ts +6 -0
  28. package/es/interface/schema/widget-props/i-table-props.d.ts +6 -6
  29. package/es/interface/schema/widget-props/index.d.ts +1 -0
  30. package/es/interface/schema/widget-types.d.ts +36 -7
  31. package/es/interface/widget/i-common.d.ts +2 -1
  32. package/es/interface/widget/i-editors.d.ts +3 -2
  33. package/es/interface/widget/i-props.d.ts +13 -32
  34. package/es/interface/widget/i-schemas.d.ts +2 -0
  35. package/es/interface/widget/i-styles.d.ts +1 -0
  36. package/es/interface/widget/index.d.ts +3 -1
  37. package/es/utils/field-editor-override-registry/field-editor-override-registry.d.ts +36 -0
  38. package/es/utils/field-editor-override-registry/field-editor-override-registry.mjs +29 -0
  39. package/es/utils/index.d.ts +1 -0
  40. package/es/utils/index.mjs +6 -0
  41. package/es/utils/schema/index.d.ts +4 -1
  42. package/es/utils/schema/index.mjs +75 -39
  43. package/es/utils/schema/search.d.ts +9 -0
  44. package/es/utils/schema/search.mjs +146 -0
  45. package/es/utils/schema/utils.d.ts +21 -0
  46. package/es/utils/schema/utils.mjs +182 -0
  47. package/es/utils/schema-style/index.mjs +203 -127
  48. package/es/utils/widget-info/widget-info.mjs +132 -57
  49. package/package.json +12 -13
  50. package/dist/index.esm.min.mjs +0 -898
  51. package/dist/index.min.cjs +0 -1
  52. package/dist/index.system.min.js +0 -1
  53. package/es/schema/common-config/base-button-config.d.ts +0 -3
  54. package/es/schema/common-config/base-button-config.mjs +0 -84
  55. package/es/schema/common-config/button-editor-config.d.ts +0 -4
  56. package/es/schema/common-config/button-editor-config.mjs +0 -206
  57. package/es/schema/common-config/button-props-func.d.ts +0 -5
  58. package/es/schema/common-config/button-props-func.mjs +0 -11
  59. package/es/schema/common-config/common-field-editor-config.d.ts +0 -10
  60. package/es/schema/common-config/common-field-editor-config.mjs +0 -61
  61. package/es/schema/common-config/common-style.d.ts +0 -3
  62. package/es/schema/common-config/common-style.mjs +0 -85
  63. package/es/schema/common-config/display-editor-config.d.ts +0 -3
  64. package/es/schema/common-config/display-editor-config.mjs +0 -89
  65. package/es/schema/common-config/permission-editor-config.d.ts +0 -2
  66. package/es/schema/common-config/permission-editor-config.mjs +0 -23
  67. package/es/schema/index.d.ts +0 -9
  68. package/es/schema/modal/modal-body.d.ts +0 -2
  69. package/es/schema/modal/modal-body.mjs +0 -9
  70. package/es/schema/modal/modal-footer.d.ts +0 -2
  71. package/es/schema/modal/modal-footer.mjs +0 -9
  72. package/es/schema/modal/modal.d.ts +0 -8
  73. package/es/schema/modal/modal.mjs +0 -182
@@ -1,5 +1,5 @@
1
1
  import { LowCodeModal, LowCodeWidget } from '..';
2
- import { InputProps, UploadFileProps, FormProps, DescriptionsProps, DataTableProps, DataListProps, ButtonProps, SelectProps, RadioProps, NumberProps, DoubleProps, MoneyProps, DateTimeProps, TimeProps, DateProps, UserProps, DeptProps, SwitchProps, SearchProps, ExportProps, ProcessButtonProps, LayoutProps, GridProps, GridColProps, ColumnsProps, ButtonContainerProps, SubTableProps, WorkflowNodesProps, LabelPrintProps, TabsProps, RefDataTableProps, TabPaneProps, ReadonlyCmpProps, CustomFieldProps, OperateProps, OperateButtonProps, ColumnTableProps, FormulaProps, TableSelectProps, GenRadioProps, GenSwitchProps, EsopProps, ExpressionProps, AggProps, treeTableProps, BaseButtonProps, DynamicTableProps, TransactionProps, SerialRuleProps, SelectSearchProps, TextProps, CollapseProps, SpaceOccupationProps, PrinterProps, SignatureProps, OnlineFormProps, TmplTreeSelectProps, DocumentPrintProps, RangeUserProps, GenImageProps, IframeProps, SubDataTableProps, ResetButtonProps, FormProcessProps, ApprovalHistoryProps, FlowDiagramProps, approveButtonProps, ButtonProcessContainerProps, BizProcessProps, TableApproveButtonProps, CustomCodeProps, ApprovalProcessProps, DividerProps } from './widget-props';
2
+ import { InputProps, UploadFileProps, FormProps, DescriptionsProps, DataTableProps, DataListProps, ButtonProps, SelectProps, RadioProps, NumberProps, DoubleProps, MoneyProps, DateTimeProps, TimeProps, DateProps, UserProps, DeptProps, SwitchProps, SearchProps, QuickSearchProps, ExportProps, ProcessButtonProps, LayoutProps, GridProps, GridColProps, ColumnsProps, ButtonContainerProps, SubTableProps, WorkflowNodesProps, LabelPrintProps, TabsProps, RefDataTableProps, TabPaneProps, ReadonlyCmpProps, CustomFieldProps, OperateProps, OperateButtonProps, ColumnTableProps, FormulaProps, TableSelectProps, GenRadioProps, GenSwitchProps, EsopProps, ExpressionProps, AggProps, treeTableProps, BaseButtonProps, DynamicTableProps, TransactionProps, SerialRuleProps, SelectSearchProps, TextProps, CollapseProps, SpaceOccupationProps, PrinterProps, SignatureProps, OnlineFormProps, TmplTreeSelectProps, DocumentPrintProps, RangeUserProps, GenImageProps, IframeProps, SubDataTableProps, ResetButtonProps, FormProcessProps, ApprovalHistoryProps, FlowDiagramProps, approveButtonProps, ButtonProcessContainerProps, BizProcessProps, TableApproveButtonProps, CustomCodeProps, ApprovalProcessProps, DividerProps, CardListProps, CardHeaderLeftProps, CardHeaderRightProps, CardContentProps, CardOpeBtnProps } from './widget-props';
3
3
  import { FormComponents, DisplayEnums } from '@gct-paas/core';
4
4
  import { LinkageItem } from '../common/data-linkage-config';
5
5
  export interface Userpicker extends LowCodeWidget.BasicSchema {
@@ -80,6 +80,9 @@ export interface Descriptions extends LowCodeWidget.BasicSchema {
80
80
  export interface Search extends LowCodeWidget.BasicSchema {
81
81
  props: SearchProps;
82
82
  }
83
+ export interface QuickSearch extends LowCodeWidget.BasicSchema {
84
+ props: QuickSearchProps;
85
+ }
83
86
  export interface RefDataTable extends DataTable {
84
87
  props: RefDataTableProps;
85
88
  }
@@ -89,18 +92,23 @@ export interface DataTable extends LowCodeWidget.BasicSchema {
89
92
  OperateTable,
90
93
  {
91
94
  alias: string;
92
- props: IData;
95
+ props?: IData;
93
96
  children: (FormulaTable | ColumnTable)[];
97
+ preLocation?: string;
94
98
  },
95
99
  {
96
100
  alias: string;
97
- props: IData;
101
+ props?: IData;
98
102
  children: OperateButton[];
103
+ preLocation?: string;
104
+ visibleButtons?: number;
99
105
  },
100
106
  {
101
107
  alias: string;
102
- props: IData;
108
+ props?: IData;
103
109
  children: OperateButton[];
110
+ preLocation?: string;
111
+ visibleButtons?: number;
104
112
  },
105
113
  SubDataTable
106
114
  ];
@@ -111,18 +119,23 @@ export interface TreeTable extends LowCodeWidget.BasicSchema {
111
119
  OperateTable,
112
120
  {
113
121
  alias: string;
114
- props: IData;
122
+ props?: IData;
115
123
  children: (FormulaTable | ColumnTable)[];
124
+ preLocation?: string;
116
125
  },
117
126
  {
118
127
  alias: string;
119
- props: IData;
128
+ props?: IData;
120
129
  children: OperateButton[];
130
+ preLocation?: string;
131
+ visibleButtons?: number;
121
132
  },
122
133
  {
123
134
  alias: string;
124
- props: IData;
135
+ props?: IData;
125
136
  children: OperateButton[];
137
+ preLocation?: string;
138
+ visibleButtons?: number;
126
139
  }
127
140
  ];
128
141
  }
@@ -318,6 +331,22 @@ export interface BizProcess extends LowCodeWidget.BasicSchema {
318
331
  export interface ApprovalProcess extends LowCodeWidget.BasicSchema {
319
332
  props: ApprovalProcessProps;
320
333
  }
334
+ export interface CardList extends LowCodeWidget.BasicSchema {
335
+ props: CardListProps;
336
+ children: CardHeaderLeft[] | CardHeaderRight[] | CardContent[] | CardOpeBtn[];
337
+ }
338
+ export interface CardHeaderLeft extends LowCodeWidget.BasicSchema {
339
+ props: CardHeaderLeftProps;
340
+ }
341
+ export interface CardHeaderRight extends LowCodeWidget.BasicSchema {
342
+ props: CardHeaderRightProps;
343
+ }
344
+ export interface CardContent extends LowCodeWidget.BasicSchema {
345
+ props: CardContentProps;
346
+ }
347
+ export interface CardOpeBtn extends LowCodeWidget.BasicSchema {
348
+ props: CardOpeBtnProps;
349
+ }
321
350
  /**
322
351
  * type 和 类型的映射关系
323
352
  */
@@ -30,9 +30,10 @@ export interface validateRule {
30
30
  ruleName: string;
31
31
  field: string;
32
32
  ruleType: VERIFICATIONCONDITIONS_TYPE.JS;
33
- trigger?: 'change' | 'bulr';
33
+ trigger?: 'change' | 'blur';
34
34
  message?: string;
35
35
  jsName?: string;
36
+ extParams?: IObject;
36
37
  }
37
38
  /**
38
39
  * 组件类型与组件Schema接口映射
@@ -79,7 +79,7 @@ export interface IPropEditor {
79
79
  /** prop分组 */
80
80
  group: PropGroup | string;
81
81
  /** 自定义校验 */
82
- validate?: Promise<any>;
82
+ validate?: Promise<any> | Fn;
83
83
  /** editor内部的自定义config逻辑 */
84
84
  _config?: Partial<IPropEditorConfig>;
85
85
  /** 表单项额外配置 */
@@ -97,6 +97,7 @@ export interface IPropEditor {
97
97
  formItemStyle?: CSSProperties;
98
98
  formItemClass?: string;
99
99
  onMounted?: (widget: IBasicSchema) => void;
100
+ [key: string]: any;
100
101
  }
101
102
  /**
102
103
  * editor属性
@@ -194,7 +195,7 @@ export interface IPropEditorConfig {
194
195
  /** 需要过滤的字段 */
195
196
  excludeFieldType?: FIELD_TYPE[];
196
197
  /** 最要过滤的字段key */
197
- excludeFieldKey?: string[];
198
+ excludeFieldKey?: string[] | Function;
198
199
  /** 默认展开所有节点 */
199
200
  defaultExpandAll?: boolean;
200
201
  /** 显示checkbox */
@@ -1,5 +1,5 @@
1
1
  import { FieldMetaDTO } from '@gct-paas/api/apaas';
2
- import { DisplayType, Dependency_ENUM, ASSIGNMENTSTRATEGY_ENUM, EntityModelCategoryEnum, EntityModelTypeEnum, FIELD_TYPE, UniqueConstraintType } from '@gct-paas/core';
2
+ import { DisplayType, Dependency_ENUM, EntityModelCategoryEnum, EntityModelTypeEnum, FIELD_TYPE, UniqueConstraintType } from '@gct-paas/core';
3
3
  /**
4
4
  * BasicSchema中的组件prop
5
5
  *
@@ -11,7 +11,9 @@ export type ICommonProps = Record<string, any>;
11
11
  *
12
12
  * @type IWidgetProps
13
13
  */
14
- export type IWidgetProps = IDisplayProps;
14
+ export interface IWidgetProps extends IDisplayProps {
15
+ [key: string]: any;
16
+ }
15
17
  /**
16
18
  * 布局组件Prop Schema
17
19
  *
@@ -50,41 +52,20 @@ export interface IDisplayProps {
50
52
  };
51
53
  deviceConnectivity: boolean;
52
54
  }
55
+ export interface IDependencyItem {
56
+ expressionStr?: string;
57
+ expression?: string;
58
+ value?: boolean;
59
+ /** 字段组件上的配置信息 */
60
+ fieldValue?: boolean;
61
+ strategy?: string;
62
+ }
53
63
  /**
54
64
  * 组件依赖
55
65
  *
56
66
  * @interface IDependency
57
67
  */
58
- export interface IDependency {
59
- [Dependency_ENUM.HIDDEN]: {
60
- expression?: string;
61
- value?: boolean;
62
- };
63
- /** 只读 */
64
- [Dependency_ENUM.READONLY]: {
65
- expression?: string;
66
- value?: boolean;
67
- /** 字段组件上的配置信息 */
68
- fieldValue?: boolean;
69
- };
70
- /** 禁用 */
71
- [Dependency_ENUM.DISABLED]: {
72
- expression?: string;
73
- value?: boolean;
74
- };
75
- /** 必填 */
76
- [Dependency_ENUM.REQUIRED]: {
77
- expression?: string;
78
- value?: boolean;
79
- /** 字段组件上的配置信息 */
80
- fieldValue?: boolean;
81
- };
82
- [Dependency_ENUM.ASSIGNMENT]: {
83
- expression?: string;
84
- strategy?: ASSIGNMENTSTRATEGY_ENUM;
85
- value?: boolean;
86
- };
87
- }
68
+ export type IDependency = Partial<Record<Dependency_ENUM, IDependencyItem>>;
88
69
  /**
89
70
  * 表单组件Prop Schema
90
71
  *
@@ -9,6 +9,7 @@ import { PagePlugin } from '../designer';
9
9
  * @interface IBasicSchema
10
10
  */
11
11
  export interface IBasicSchema {
12
+ [key: string]: any;
12
13
  /** 组件唯一标识 */
13
14
  id: string;
14
15
  /** 显示设备 */
@@ -110,6 +111,7 @@ export interface ISearchSchema {
110
111
  isSearchField: boolean;
111
112
  materialType: MaterialEnum;
112
113
  props: {
114
+ [key: string]: any;
113
115
  /** 字段key */
114
116
  field: string;
115
117
  /** 字段id */
@@ -111,4 +111,5 @@ export interface IBasicStyle {
111
111
  /** 表格高度样式 */
112
112
  tableheightConfigure?: tableColumnWidthEnum;
113
113
  enableHeaderBGColor?: boolean;
114
+ enableBGColor?: boolean;
114
115
  }
@@ -4,6 +4,7 @@ import { IBasicStyle, IFontStyle, IBorderStyle, ITagConfigStyle, IProgressConfig
4
4
  import { IBasicEvents, IJsEvent, IInnerEvents, IEventsType } from './i-events';
5
5
  import { IStyleEditor, IStyleEditorConfig, IPropEditor, IPropEditorConfig } from './i-editors';
6
6
  import { IDesignerConfig, IPageVars, RunCallback as RunCallbackSelf, beforeCreate as beforeCreateSelf, loopCallback as loopCallbackSelf } from './i-hooks-and-misc';
7
+ import { IDesignerItemHooks } from '../widget-info';
7
8
  export type * from './i-common';
8
9
  /**
9
10
  * 低代码组件命名空间
@@ -39,12 +40,13 @@ export declare namespace LowCodeWidget {
39
40
  type PropEditorConfig = IPropEditorConfig;
40
41
  type RunCallback = RunCallbackSelf;
41
42
  type beforeCreate = beforeCreateSelf;
43
+ type hooks<O = unknown> = IDesignerItemHooks<O>;
42
44
  type loopCallback = loopCallbackSelf;
43
45
  type DesignerConfig = IDesignerConfig;
44
46
  type PageVars = IPageVars;
45
47
  }
46
48
  export type { IBasicSchema, IFieldSchema, ISearchSchema, IWrapperCmpConfigParams, } from './i-schemas';
47
- export type { ICommonProps, IWidgetProps, IDisplayProps, IFormItemProps, ILayoutProps, IDependency, IFieldToProp, } from './i-props';
49
+ export type { ICommonProps, IWidgetProps, IDisplayProps, IFormItemProps, ILayoutProps, IDependency, IFieldToProp, IDependencyItem, } from './i-props';
48
50
  export type { IBasicStyle, IFontStyle, IBorderStyle, ITagConfigStyle, IProgressConfigStyle, IColumnFontStyleByRule, IColumnBackgroundByRule, } from './i-styles';
49
51
  export type { IBasicEvents, IJsEvent, IInnerEvents, IEventsType, } from './i-events';
50
52
  export type { IStyleEditor, IStyleEditorConfig, IPropEditor, IPropEditorConfig, } from './i-editors';
@@ -0,0 +1,36 @@
1
+ import { LowCodeWidget } from '../../interface';
2
+ import { MaterialEnum } from '@gct-paas/core';
3
+ /** 事件覆写函数类型 */
4
+ export type EventsOverrideFn = (selected: LowCodeWidget.BasicSchema, defaultEvents: LowCodeWidget.EventsType[]) => LowCodeWidget.BasicEvents[];
5
+ /** 属性编辑器覆写函数类型 */
6
+ export type PropEditorOverrideFn = (selected: LowCodeWidget.BasicSchema, defaultList: LowCodeWidget.PropEditor[], preCompInfo?: LowCodeWidget.BasicSchema) => LowCodeWidget.PropEditor[] | undefined;
7
+ /** 样式编辑器覆写函数类型 */
8
+ export type StyleEditorOverrideFn = (selected: LowCodeWidget.BasicSchema, defaultWidget: LowCodeWidget.StyleEditor[]) => LowCodeWidget.StyleEditor[] | undefined;
9
+ /** 容器编辑器覆写配置 */
10
+ export interface IContainerEditorOverrides {
11
+ events?: EventsOverrideFn;
12
+ propEditor?: PropEditorOverrideFn;
13
+ styleEditor?: StyleEditorOverrideFn;
14
+ }
15
+ /**
16
+ * 字段编辑器覆写注册表
17
+ *
18
+ * 用于按物料类型注册和获取编辑器(事件、属性编辑器、样式编辑器)的覆写配置。
19
+ * 通过静态方法统一操作,保证全局唯一实例的注册中心语义清晰。
20
+ */
21
+ export declare class FieldEditorOverrideRegistry {
22
+ /** 物料类型到编辑器覆写配置的映射 */
23
+ private static _registry;
24
+ /**
25
+ * 注册指定物料类型的编辑器覆写配置
26
+ * @param materialType 物料类型
27
+ * @param overrides 编辑器覆写配置
28
+ */
29
+ static register(materialType: MaterialEnum, overrides: IContainerEditorOverrides): void;
30
+ /**
31
+ * 获取指定物料类型的编辑器覆写配置
32
+ * @param materialType 物料类型
33
+ * @returns 编辑器覆写配置,未注册时返回 undefined
34
+ */
35
+ static get(materialType: MaterialEnum): IContainerEditorOverrides | undefined;
36
+ }
@@ -0,0 +1,29 @@
1
+ //#region src/utils/field-editor-override-registry/field-editor-override-registry.ts
2
+ /**
3
+ * 字段编辑器覆写注册表
4
+ *
5
+ * 用于按物料类型注册和获取编辑器(事件、属性编辑器、样式编辑器)的覆写配置。
6
+ * 通过静态方法统一操作,保证全局唯一实例的注册中心语义清晰。
7
+ */
8
+ var FieldEditorOverrideRegistry = class FieldEditorOverrideRegistry {
9
+ /** 物料类型到编辑器覆写配置的映射 */
10
+ static _registry = /* @__PURE__ */ new Map();
11
+ /**
12
+ * 注册指定物料类型的编辑器覆写配置
13
+ * @param materialType 物料类型
14
+ * @param overrides 编辑器覆写配置
15
+ */
16
+ static register(materialType, overrides) {
17
+ FieldEditorOverrideRegistry._registry.set(materialType, overrides);
18
+ }
19
+ /**
20
+ * 获取指定物料类型的编辑器覆写配置
21
+ * @param materialType 物料类型
22
+ * @returns 编辑器覆写配置,未注册时返回 undefined
23
+ */
24
+ static get(materialType) {
25
+ return FieldEditorOverrideRegistry._registry.get(materialType);
26
+ }
27
+ };
28
+ //#endregion
29
+ export { FieldEditorOverrideRegistry };
@@ -1,3 +1,4 @@
1
+ export * from './field-editor-override-registry/field-editor-override-registry';
1
2
  export * from './schema';
2
3
  export * from './schema-style';
3
4
  export * from './widget-info/widget-info';
@@ -0,0 +1,6 @@
1
+ import "./field-editor-override-registry/field-editor-override-registry.mjs";
2
+ import "./widget-info/widget-info.mjs";
3
+ import "./schema/search.mjs";
4
+ import "./schema/utils.mjs";
5
+ import "./schema/index.mjs";
6
+ import "./schema-style/index.mjs";
@@ -1,4 +1,4 @@
1
- import { LowCodeWidget } from '../../interface';
1
+ import { IBasicSchema, LowCodeWidget } from '../../interface';
2
2
  /**
3
3
  * 获取组件所属位置
4
4
  *
@@ -43,3 +43,6 @@ export declare function deepFindNotField(item: IObject[]): {
43
43
  [x: string]: any;
44
44
  [x: symbol]: any;
45
45
  }[];
46
+ export declare function setChildrenId(widget: IBasicSchema): void;
47
+ export * from './search';
48
+ export * from './utils';
@@ -1,49 +1,85 @@
1
- import { buildShortUUID, t, MaterialEnum } from '@gct-paas/core';
2
- import { cloneDeep, has } from 'lodash-es';
3
- import { getWidgetInfo } from '../widget-info/widget-info.mjs';
4
-
1
+ import { getWidgetInfo } from "../widget-info/widget-info.mjs";
2
+ import "./search.mjs";
3
+ import "./utils.mjs";
4
+ import { MaterialEnum, TreeHelper, buildShortUUID, t } from "@gct-paas/core";
5
+ import { cloneDeep, has } from "lodash-es";
6
+ //#region src/utils/schema/index.ts
7
+ /**
8
+ * 获取组件所属位置
9
+ *
10
+ * @export
11
+ * @param {LowCodeWidget.BasicSchema} widget
12
+ * @param {string} fieldType
13
+ * @param {string} componentType
14
+ * @return {*}
15
+ */
5
16
  function getCompPos(widget, fieldType, componentType) {
6
- return widget.type === componentType && has(widget, "preLocation") && new RegExp(`^${fieldType}_`).test(widget.preLocation);
17
+ return widget.type === componentType && has(widget, "preLocation") && new RegExp(`^${fieldType}_`).test(widget.preLocation);
7
18
  }
19
+ /**
20
+ * 是否是表单字段类型
21
+ *
22
+ * @export
23
+ * @param {LowCodeWidget.BasicSchema} widget
24
+ * @return {boolean}
25
+ */
8
26
  function isFormFieldType(widget) {
9
- return [
10
- MaterialEnum.MaterialFormField,
11
- MaterialEnum.MaterialSubTableModalField,
12
- MaterialEnum.DescriptionsFormField
13
- ].includes(widget.materialType);
27
+ return [
28
+ MaterialEnum.MaterialFormField,
29
+ MaterialEnum.MaterialSubTableModalField,
30
+ MaterialEnum.DescriptionsFormField
31
+ ].includes(widget.materialType);
14
32
  }
33
+ /**
34
+ * 初始化国际化处理
35
+ *
36
+ * @export
37
+ * @param {LowCodeWidget.BasicSchema['props']} props
38
+ */
15
39
  function transformI18n(props) {
16
- const reg = /^\$\{(\S+)\}$/;
17
- for (const key in props) {
18
- const value = props[key];
19
- if (reg.test(value)) {
20
- props[key] = t(value.match(reg)?.[1]);
21
- }
22
- }
40
+ const reg = /^\$\{(\S+)\}$/;
41
+ for (const key in props) {
42
+ const value = props[key];
43
+ if (reg.test(value)) props[key] = t(value.match(reg)?.[1]);
44
+ }
23
45
  }
46
+ /**
47
+ * 克隆组件schema
48
+ *
49
+ * @export
50
+ * @param {LowCodeWidget.BasicSchema} widgetSchema
51
+ * @return {*} {LowCodeWidget.BasicSchema}
52
+ */
24
53
  function cloneWidget(widgetSchema) {
25
- const instance = cloneDeep(widgetSchema);
26
- instance.id = buildShortUUID(instance.type);
27
- instance.alias = t(instance.name);
28
- if (instance.formItem) {
29
- instance.props.label = t(instance.name);
30
- }
31
- const widgetInfo = getWidgetInfo(instance.platform);
32
- if (widgetInfo) {
33
- widgetInfo.beforeCreate?.[instance.type]?.(instance);
34
- }
35
- transformI18n(instance.props);
36
- return instance;
54
+ const instance = cloneDeep(widgetSchema);
55
+ instance.id = buildShortUUID(instance.type);
56
+ instance.alias = t(instance.name);
57
+ if (instance.formItem) instance.props.label = t(instance.name);
58
+ const widgetInfo = getWidgetInfo(instance.platform);
59
+ if (widgetInfo) widgetInfo.beforeCreate?.[instance.type]?.(instance);
60
+ transformI18n(instance.props);
61
+ return instance;
37
62
  }
63
+ /**
64
+ * 递归获取所有非字段组件
65
+ *
66
+ * @param {LowCodeWidget.BasicSchema} item
67
+ * @param {string[]} [types=[]]
68
+ * @returns {*} {string[]}
69
+ */
38
70
  function deepFindNotField(item) {
39
- return item.map((node) => ({ ...node })).filter((node) => {
40
- if (node.props?.model) {
41
- return predicate(node);
42
- }
43
- node.children = node.children && deepFindNotField(node.children);
44
- return predicate(node);
45
- });
71
+ return item.map((node) => ({ ...node })).filter((node) => {
72
+ if (node.props?.model) return predicate(node);
73
+ node.children = node.children && deepFindNotField(node.children);
74
+ return predicate(node);
75
+ });
46
76
  }
47
- const predicate = (node) => !node.formItem;
48
-
49
- export { cloneWidget, deepFindNotField, getCompPos, isFormFieldType, transformI18n };
77
+ var predicate = (node) => !node.formItem;
78
+ function setChildrenId(widget) {
79
+ if (widget.children?.length) TreeHelper.eachTree(widget.children, (child) => {
80
+ child.id = buildShortUUID(child.type);
81
+ return child;
82
+ });
83
+ }
84
+ //#endregion
85
+ export { cloneWidget, deepFindNotField, getCompPos, isFormFieldType, setChildrenId, transformI18n };
@@ -0,0 +1,9 @@
1
+ import { FIELD_TYPE } from '@gct-paas/core';
2
+ export declare const basicSearchAttrsUtils: {
3
+ ope: {
4
+ from: string;
5
+ to: string;
6
+ transform: (value: FIELD_TYPE) => import('@gct-paas/core').SEARCH_SERVICE[];
7
+ }[];
8
+ };
9
+ export declare const transformField2SearchComponent: (fieldType: FIELD_TYPE) => IObject;
@@ -0,0 +1,146 @@
1
+ import { SEARCH_TYPE } from "../../constants/index.mjs";
2
+ import { FIELD_TYPE, SearchComponents } from "@gct-paas/core";
3
+ //#region src/utils/schema/search.ts
4
+ var basicSearchAttrsUtils = { ope: [{
5
+ from: "fieldType",
6
+ to: "ope",
7
+ transform: (value) => {
8
+ return [...SEARCH_TYPE[value]?.default || []];
9
+ }
10
+ }] };
11
+ var transformField2SearchComponent = (fieldType) => {
12
+ return {
13
+ [FIELD_TYPE.PRIMARY_KEY]: {
14
+ searchCmpKey: SearchComponents.SearchInput,
15
+ attrsTransform: []
16
+ },
17
+ [FIELD_TYPE.ASSOCIATED_PRIMARY_KEY]: {
18
+ searchCmpKey: SearchComponents.SearchSelect,
19
+ attrsTransform: []
20
+ },
21
+ [FIELD_TYPE.TEXT]: {
22
+ searchCmpKey: SearchComponents.SearchInput,
23
+ attrsTransform: []
24
+ },
25
+ [FIELD_TYPE.LONG_TEXT]: {
26
+ searchCmpKey: SearchComponents.SearchInput,
27
+ attrsTransform: []
28
+ },
29
+ [FIELD_TYPE.SERIAL]: {
30
+ searchCmpKey: SearchComponents.SearchInput,
31
+ attrsTransform: []
32
+ },
33
+ [FIELD_TYPE.DATE]: {
34
+ searchCmpKey: SearchComponents.SearchDate,
35
+ attrsTransform: []
36
+ },
37
+ [FIELD_TYPE.DATE_TIME]: {
38
+ searchCmpKey: SearchComponents.SearchDateTime,
39
+ attrsTransform: []
40
+ },
41
+ [FIELD_TYPE.TIME]: {
42
+ searchCmpKey: SearchComponents.SearchTime,
43
+ attrsTransform: []
44
+ },
45
+ [FIELD_TYPE.INTEGER]: {
46
+ searchCmpKey: SearchComponents.SearchNumberInput,
47
+ attrsTransform: []
48
+ },
49
+ [FIELD_TYPE.DOUBLE]: {
50
+ searchCmpKey: SearchComponents.SearchStringNumberInput,
51
+ attrsTransform: []
52
+ },
53
+ [FIELD_TYPE.LONG]: {
54
+ searchCmpKey: SearchComponents.SearchNumberInput,
55
+ attrsTransform: []
56
+ },
57
+ [FIELD_TYPE.DECIMAL]: {
58
+ searchCmpKey: SearchComponents.SearchStringNumberInput,
59
+ attrsTransform: []
60
+ },
61
+ [FIELD_TYPE.BOOLEAN]: {
62
+ searchCmpKey: SearchComponents.SearchSwitch,
63
+ attrsTransform: []
64
+ },
65
+ [FIELD_TYPE.ENUM]: {
66
+ searchCmpKey: SearchComponents.SearchSelect,
67
+ attrsTransform: []
68
+ },
69
+ [FIELD_TYPE.ENUM_MULTI]: {
70
+ searchCmpKey: SearchComponents.SearchSelect,
71
+ attrsTransform: []
72
+ },
73
+ [FIELD_TYPE.ORG_MULTI]: {
74
+ searchCmpKey: SearchComponents.SearchSelectDepartment,
75
+ attrsTransform: []
76
+ },
77
+ [FIELD_TYPE.USER_MULTI]: {
78
+ searchCmpKey: SearchComponents.SearchUserSelect,
79
+ attrsTransform: []
80
+ },
81
+ [FIELD_TYPE.ORG]: {
82
+ searchCmpKey: SearchComponents.SearchSelectDepartment,
83
+ attrsTransform: []
84
+ },
85
+ [FIELD_TYPE.USER]: {
86
+ searchCmpKey: SearchComponents.SearchUserSelect,
87
+ attrsTransform: []
88
+ },
89
+ [FIELD_TYPE.REF_MULTI]: {
90
+ searchCmpKey: SearchComponents.SearchSelect,
91
+ attrsTransform: [{
92
+ from: "refModelType",
93
+ to: "refModelType"
94
+ }]
95
+ },
96
+ [FIELD_TYPE.REF]: {
97
+ searchCmpKey: SearchComponents.SearchSelect,
98
+ attrsTransform: [{
99
+ from: "refModelType",
100
+ to: "refModelType"
101
+ }]
102
+ },
103
+ [FIELD_TYPE.RDO_REF]: {
104
+ searchCmpKey: SearchComponents.SearchRdoSelect,
105
+ attrsTransform: []
106
+ },
107
+ [FIELD_TYPE.TRANSACTION]: {
108
+ searchCmpKey: SearchComponents.SearchTransaction,
109
+ attrsTransform: []
110
+ },
111
+ [FIELD_TYPE.PRINTER]: {
112
+ searchCmpKey: SearchComponents.SearchPrinter,
113
+ attrsTransform: []
114
+ },
115
+ [FIELD_TYPE.RANGE_USER]: {
116
+ searchCmpKey: SearchComponents.SearchSelectRangUser,
117
+ attrsTransform: []
118
+ },
119
+ [FIELD_TYPE.MESSAGE_TMPL]: {
120
+ searchCmpKey: SearchComponents.SearchSelect,
121
+ attrsTransform: []
122
+ },
123
+ [FIELD_TYPE.LABEL_TEMPLATE_REF]: {
124
+ searchCmpKey: SearchComponents.SearchTmplTreeSelect,
125
+ attrsTransform: []
126
+ },
127
+ [FIELD_TYPE.DOCUMENT_TEMPLATE]: {
128
+ searchCmpKey: SearchComponents.SearchTmplTreeSelect,
129
+ attrsTransform: []
130
+ },
131
+ [FIELD_TYPE.ONLINE_FORM_TEMPLATE]: {
132
+ searchCmpKey: SearchComponents.SearchTmplTreeSelect,
133
+ attrsTransform: []
134
+ },
135
+ [FIELD_TYPE.E_DHR_TEMPLATE]: {
136
+ searchCmpKey: SearchComponents.SearchTmplTreeSelect,
137
+ attrsTransform: []
138
+ },
139
+ [FIELD_TYPE.Biz_Process]: {
140
+ searchCmpKey: SearchComponents.SearchBizProcess,
141
+ attrsTransform: []
142
+ }
143
+ }[fieldType];
144
+ };
145
+ //#endregion
146
+ export { basicSearchAttrsUtils, transformField2SearchComponent };
@@ -0,0 +1,21 @@
1
+ import { FIELD_TYPE, ReturnTypeEnum, EntityFormulaReturnTypeEnum } from '@gct-paas/core';
2
+ /** 树转一维数组 */
3
+ export declare function flatten(array?: IObject[], path?: string, inSubTable?: boolean): IObject[];
4
+ /** 字段映射项 */
5
+ interface FieldFilterConfig {
6
+ filterArr: FIELD_TYPE[];
7
+ equal?: boolean;
8
+ }
9
+ /**
10
+ * 字段填充映射处理
11
+ */
12
+ export declare const transformMappingField: (fieldType: FIELD_TYPE) => FieldFilterConfig | undefined;
13
+ /**
14
+ * 转换原始的returnType为字段类型
15
+ */
16
+ export declare const convertMappingType: (type: ReturnTypeEnum) => EntityFormulaReturnTypeEnum;
17
+ /**
18
+ * 自动填充映射处理
19
+ */
20
+ export declare const transformMappingField4Auto: (fieldType: FIELD_TYPE) => FieldFilterConfig | undefined;
21
+ export {};