@gct-paas/schema 0.1.4-dev.8 → 0.1.4-dev.9

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 (57) hide show
  1. package/dist/index.esm.min.mjs +764 -103
  2. package/dist/index.min.cjs +1 -1
  3. package/dist/index.system.min.js +1 -1
  4. package/es/constants/index.d.ts +5 -0
  5. package/es/constants/index.mjs +19 -0
  6. package/es/index.mjs +10 -1
  7. package/es/interface/common/data-linkage-config.d.ts +17 -0
  8. package/es/interface/designer.d.ts +7 -6
  9. package/es/interface/index.d.ts +5 -2
  10. package/es/interface/modal/i-modal.d.ts +1 -1
  11. package/es/interface/schema/index.d.ts +2 -0
  12. package/es/interface/schema/widget-props/i-button-props.d.ts +170 -0
  13. package/es/interface/schema/widget-props/i-display-props.d.ts +48 -0
  14. package/es/interface/schema/widget-props/i-form-container-props.d.ts +77 -0
  15. package/es/interface/schema/widget-props/i-form-input-props.d.ts +409 -0
  16. package/es/interface/schema/widget-props/i-layout-props.d.ts +77 -0
  17. package/es/interface/schema/widget-props/i-search-widget-props.d.ts +126 -0
  18. package/es/interface/schema/widget-props/i-table-column-props.d.ts +54 -0
  19. package/es/interface/schema/widget-props/i-table-props.d.ts +384 -0
  20. package/es/interface/schema/widget-props/index.d.ts +8 -0
  21. package/es/interface/schema/widget-types.d.ts +370 -0
  22. package/es/interface/widget/i-events.d.ts +2 -9
  23. package/es/interface/widget/i-hooks-and-misc.d.ts +1 -0
  24. package/es/interface/widget/i-props.d.ts +1 -0
  25. package/es/interface/widget/i-schemas.d.ts +4 -4
  26. package/es/interface/widget/i-styles.d.ts +1 -1
  27. package/es/interface/widget/index.d.ts +7 -2
  28. package/es/interface/widget-info/i-designer-item-hooks.d.ts +21 -0
  29. package/es/interface/widget-info/i-designer-schema-exports.d.ts +13 -0
  30. package/es/interface/widget-info/i-widget-info-item.d.ts +78 -0
  31. package/es/interface/widget-info/i-widget-info.d.ts +19 -0
  32. package/es/interface/widget-info/index.d.ts +4 -0
  33. package/es/schema/common-config/base-button-config.d.ts +3 -0
  34. package/es/schema/common-config/base-button-config.mjs +84 -0
  35. package/es/schema/common-config/button-editor-config.d.ts +4 -0
  36. package/es/schema/common-config/button-editor-config.mjs +206 -0
  37. package/es/schema/common-config/button-props-func.d.ts +5 -0
  38. package/es/schema/common-config/button-props-func.mjs +11 -0
  39. package/es/schema/common-config/common-field-editor-config.d.ts +10 -0
  40. package/es/schema/common-config/common-field-editor-config.mjs +61 -0
  41. package/es/schema/common-config/display-editor-config.d.ts +3 -0
  42. package/es/schema/common-config/display-editor-config.mjs +89 -0
  43. package/es/schema/common-config/permission-editor-config.d.ts +2 -0
  44. package/es/schema/common-config/permission-editor-config.mjs +23 -0
  45. package/es/schema/index.d.ts +9 -1
  46. package/es/schema/modal/modal-body.d.ts +2 -0
  47. package/es/schema/modal/modal-body.mjs +9 -0
  48. package/es/schema/modal/modal-footer.d.ts +2 -0
  49. package/es/schema/modal/modal-footer.mjs +9 -0
  50. package/es/schema/modal/modal.d.ts +8 -0
  51. package/es/schema/modal/modal.mjs +182 -0
  52. package/es/utils/index.d.ts +3 -2
  53. package/es/utils/schema/index.d.ts +34 -0
  54. package/es/utils/schema/index.mjs +44 -2
  55. package/es/utils/widget-info/widget-info.d.ts +104 -0
  56. package/es/utils/widget-info/widget-info.mjs +76 -0
  57. package/package.json +4 -4
@@ -0,0 +1,182 @@
1
+ import { BuiltinType, Platform, PropGroup, StyleGroup, buildShortUUID } from '@gct-paas/core';
2
+ import { widget as widget$1 } from './modal-body.mjs';
3
+ import { widget as widget$2 } from './modal-footer.mjs';
4
+
5
+ const widget = {
6
+ id: "",
7
+ /**默认是WEB 添加的时候会根据当前环境改变 */
8
+ platform: Platform.WEB,
9
+ /**系统用的name */
10
+ name: "sys.pageDesigner.modal",
11
+ alias: "",
12
+ /**用户新建编辑的name */
13
+ modalName: "",
14
+ type: BuiltinType.MODAL,
15
+ js: "",
16
+ css: "",
17
+ children: [widget$1, widget$2],
18
+ props: {
19
+ modalTitle: "弹窗",
20
+ unitType: "px",
21
+ modalWidth: 800,
22
+ isSubTableModal: false,
23
+ bindSubTableId: "",
24
+ createModalTitle: "新建弹窗",
25
+ editModalTitle: "编辑弹窗",
26
+ hasFooter: true,
27
+ openMode: "modal",
28
+ /**just mobile */
29
+ mUnitType: "%",
30
+ mModalWidth: 80
31
+ },
32
+ style: {
33
+ paddingAll: "16",
34
+ paddingTop: "16",
35
+ paddingRight: "16",
36
+ paddingBottom: "16",
37
+ paddingLeft: "16"
38
+ },
39
+ events: {},
40
+ i18n: {},
41
+ runJs: "",
42
+ los: {},
43
+ icon: "icon-motaikuang1",
44
+ isField: false
45
+ };
46
+ const propEditorList = [
47
+ {
48
+ component: "text-editor",
49
+ name: "modalTitle",
50
+ label: "sys.pageDesigner.modalTitleName",
51
+ group: PropGroup.BASIC,
52
+ _config: {
53
+ showCount: true,
54
+ maxlength: 32
55
+ },
56
+ hidden: (widget2) => {
57
+ return widget2.props.isSubTableModal;
58
+ }
59
+ },
60
+ {
61
+ component: "input-unit-editor",
62
+ name: { unitType: "unitType", modalWidth: "modalWidth" },
63
+ label: "sys.pageDesigner.modalWidthProp",
64
+ group: PropGroup.MODAL,
65
+ hidden: (widget2) => {
66
+ return widget2.platform === Platform.MOBILE;
67
+ }
68
+ },
69
+ {
70
+ component: "input-unit-editor",
71
+ name: { unitType: "mUnitType", modalWidth: "mModalWidth" },
72
+ label: "sys.pageDesigner.modalHeightProp",
73
+ group: PropGroup.MODAL,
74
+ hidden: (widget2) => {
75
+ return widget2.platform !== Platform.MOBILE;
76
+ },
77
+ _config: {
78
+ filterUnitType: "px"
79
+ }
80
+ },
81
+ {
82
+ component: "text-editor",
83
+ name: "createModalTitle",
84
+ label: "sys.pageDesigner.createModalTitle",
85
+ group: PropGroup.MODALTITLECONFIG,
86
+ _config: {
87
+ i18n: true
88
+ },
89
+ hidden: (widget2) => {
90
+ return !widget2.props.isSubTableModal;
91
+ }
92
+ },
93
+ {
94
+ component: "text-editor",
95
+ name: "editModalTitle",
96
+ label: "sys.pageDesigner.editModalTitle",
97
+ group: PropGroup.MODALTITLECONFIG,
98
+ _config: {
99
+ i18n: true
100
+ },
101
+ hidden: (widget2) => {
102
+ return !widget2.props.isSubTableModal;
103
+ }
104
+ },
105
+ {
106
+ component: "select-editor",
107
+ name: "openMode",
108
+ label: "sys.appDesigner.openMode",
109
+ group: PropGroup.MODAL,
110
+ hidden: (widget2) => {
111
+ return widget2.platform !== Platform.WEB;
112
+ },
113
+ _config: {
114
+ options: () => {
115
+ return [
116
+ {
117
+ label: "打开弹窗页面",
118
+ value: "modal"
119
+ },
120
+ {
121
+ label: "右侧划入页面",
122
+ value: "drawer"
123
+ }
124
+ ];
125
+ }
126
+ },
127
+ changeCallback: (widget2, value) => {
128
+ if (value === "drawer") {
129
+ widget2.props.unitType = "%";
130
+ widget2.props.modalWidth = 80;
131
+ } else {
132
+ widget2.props.unitType = "px";
133
+ widget2.props.modalWidth = 800;
134
+ }
135
+ }
136
+ },
137
+ {
138
+ component: "switch-editor",
139
+ name: "hasFooter",
140
+ label: "sys.pageDesigner.operateButton",
141
+ group: PropGroup.BUTTON,
142
+ hidden: (widget2) => {
143
+ return widget2.props.isSubTableModal;
144
+ }
145
+ }
146
+ ];
147
+ const styleEditorList = [
148
+ {
149
+ component: "color-editor",
150
+ name: "backgroundColor",
151
+ label: "sys.pageDesigner.backgroundColor",
152
+ group: StyleGroup.BACKGROUND
153
+ },
154
+ {
155
+ component: "margin-editor",
156
+ group: StyleGroup.MARGIN,
157
+ _config: {
158
+ hiddenMarginOrPadding: "margin"
159
+ }
160
+ }
161
+ ];
162
+ const eventList = [
163
+ {
164
+ name: "onMounted",
165
+ title: "sys.pageDesigner.onMounted",
166
+ params: []
167
+ }
168
+ ];
169
+ const runCallback = () => {
170
+ };
171
+ const beforeCreate = (widget2) => {
172
+ widget2.children[0].id = buildShortUUID(widget2.children[0].type);
173
+ widget2.children[1].id = buildShortUUID(widget2.children[1].type);
174
+ };
175
+ const designerConfig = {
176
+ basicProps: {
177
+ key_label: "弹窗",
178
+ alias_hidden: true
179
+ }
180
+ };
181
+
182
+ export { beforeCreate, designerConfig, eventList, propEditorList, runCallback, styleEditorList, widget };
@@ -1,2 +1,3 @@
1
- export { getCompPos } from './schema';
2
- export { pxToVw, addPxUnit, addImportant, formatBorder, extractFontStyle, propsToStyle, makeStyleProp, ALIGN_TO_FLEX_MAP, transAlign2flex, generatePositionStyles, generateSpacingStyles, generateBorderStyles, generateWrapperStyle, } from './schema-style';
1
+ export * from './schema';
2
+ export * from './schema-style';
3
+ export * from './widget-info/widget-info';
@@ -9,3 +9,37 @@ import { LowCodeWidget } from '../../interface';
9
9
  * @return {*}
10
10
  */
11
11
  export declare function getCompPos(widget: LowCodeWidget.BasicSchema, fieldType: string, componentType: string): boolean;
12
+ /**
13
+ * 是否是表单字段类型
14
+ *
15
+ * @export
16
+ * @param {LowCodeWidget.BasicSchema} widget
17
+ * @return {boolean}
18
+ */
19
+ export declare function isFormFieldType(widget: LowCodeWidget.BasicSchema): boolean;
20
+ /**
21
+ * 初始化国际化处理
22
+ *
23
+ * @export
24
+ * @param {LowCodeWidget.BasicSchema['props']} props
25
+ */
26
+ export declare function transformI18n(props: LowCodeWidget.BasicSchema['props']): void;
27
+ /**
28
+ * 克隆组件schema
29
+ *
30
+ * @export
31
+ * @param {LowCodeWidget.BasicSchema} widgetSchema
32
+ * @return {*} {LowCodeWidget.BasicSchema}
33
+ */
34
+ export declare function cloneWidget(widgetSchema: LowCodeWidget.BasicSchema): LowCodeWidget.BasicSchema;
35
+ /**
36
+ * 递归获取所有非字段组件
37
+ *
38
+ * @param {LowCodeWidget.BasicSchema} item
39
+ * @param {string[]} [types=[]]
40
+ * @returns {*} {string[]}
41
+ */
42
+ export declare function deepFindNotField(item: IObject[]): {
43
+ [x: string]: any;
44
+ [x: symbol]: any;
45
+ }[];
@@ -1,7 +1,49 @@
1
- import { has } from 'lodash-es';
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';
2
4
 
3
5
  function getCompPos(widget, fieldType, componentType) {
4
6
  return widget.type === componentType && has(widget, "preLocation") && new RegExp(`^${fieldType}_`).test(widget.preLocation);
5
7
  }
8
+ function isFormFieldType(widget) {
9
+ return [
10
+ MaterialEnum.MaterialFormField,
11
+ MaterialEnum.MaterialSubTableModalField,
12
+ MaterialEnum.DescriptionsFormField
13
+ ].includes(widget.materialType);
14
+ }
15
+ 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
+ }
23
+ }
24
+ 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;
37
+ }
38
+ 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
+ });
46
+ }
47
+ const predicate = (node) => !node.formItem;
6
48
 
7
- export { getCompPos };
49
+ export { cloneWidget, deepFindNotField, getCompPos, isFormFieldType, transformI18n };
@@ -0,0 +1,104 @@
1
+ import { ExportWidgetBeforeCreate, ExportWidgetBlackList, ExportWidgetCallback, ExportWidgetDesignerConfig, ExportWidgetEvents, ExportWidgetHooks, ExportWidgetPropEditors, ExportWidgetSchema, ExportWidgetStyleEditors, ExportWidgetWhiteList, IWidgetInfo, IWidgetInfoItem } from '../../interface';
2
+ import { Platform } from '@gct-paas/core';
3
+ /**
4
+ * 设计界面所有组件配置信息
5
+ *
6
+ * @export
7
+ * @class WidgetInfo
8
+ * @implements {IWidgetInfo}
9
+ */
10
+ declare class WidgetInfo implements IWidgetInfo {
11
+ events: ExportWidgetEvents;
12
+ propEditors: ExportWidgetPropEditors;
13
+ schema: ExportWidgetSchema;
14
+ callback: ExportWidgetCallback;
15
+ beforeCreate: ExportWidgetBeforeCreate;
16
+ styleEditors: ExportWidgetStyleEditors;
17
+ designerConfig: ExportWidgetDesignerConfig;
18
+ hooks: ExportWidgetHooks;
19
+ whiteList: ExportWidgetWhiteList;
20
+ blackList: ExportWidgetBlackList;
21
+ }
22
+ /**
23
+ * 网页端组件配置信息
24
+ */
25
+ export declare const webWidgetInfo: WidgetInfo;
26
+ /**
27
+ * 移动端组件配置信息
28
+ */
29
+ export declare const mobileWidgetInfo: WidgetInfo;
30
+ /**
31
+ * 平板端组件配置信息
32
+ */
33
+ export declare const padWidgetInfo: WidgetInfo;
34
+ /**
35
+ * 获取指定平台的组件配置信息
36
+ *
37
+ * @export
38
+ * @param {Platform} [platform] 平台类型
39
+ * @return {*} {IWidgetInfo} 组件配置信息
40
+ */
41
+ export declare function getWidgetInfo(platform?: Platform): IWidgetInfo;
42
+ /**
43
+ * 注册单一组件信息
44
+ *
45
+ * @export
46
+ * @param {IWidgetInfo} widgetInfo
47
+ * @param {string} type
48
+ * @param {IObject} module
49
+ */
50
+ export declare function registerWidgetItem(widgetInfo: IWidgetInfo, type: string, module: IObject): void;
51
+ /**
52
+ * 注册网页端单一组件信息
53
+ *
54
+ * @export
55
+ * @param {IObject} module
56
+ * @param {string} type
57
+ */
58
+ export declare function registerWebWidgetItem(module: IObject, type: string): void;
59
+ /**
60
+ * 注册移动端单一组件信息
61
+ *
62
+ * @export
63
+ * @param {IObject} module
64
+ * @param {string} type
65
+ */
66
+ export declare function registerMobileWidgetItem(module: IObject, type: string): void;
67
+ /**
68
+ * 注册平板端单一组件信息
69
+ *
70
+ * @export
71
+ * @param {IObject} module
72
+ * @param {string} type
73
+ */
74
+ export declare function registerPadWidgetItem(module: IObject, type: string): void;
75
+ /**
76
+ * 注册单一组件信息(插件方式)
77
+ *
78
+ * @export
79
+ * @param {IWidgetInfo} widgetInfo
80
+ * @param {IWidgetInfoItem} designer
81
+ */
82
+ export declare function registerPluginWidgetItem(widgetInfo: IWidgetInfo, designer: IWidgetInfoItem): void;
83
+ /**
84
+ * 注册网页端插件组件配置
85
+ *
86
+ * @export
87
+ * @param {IWidgetInfoItem} designer
88
+ */
89
+ export declare function registerWebPluginWidgetItem(designer: IWidgetInfoItem): void;
90
+ /**
91
+ * 注册移动端插件组件配置
92
+ *
93
+ * @export
94
+ * @param {IWidgetInfoItem} designer
95
+ */
96
+ export declare function registerMobilePluginWidgetItem(designer: IWidgetInfoItem): void;
97
+ /**
98
+ * 注册平板端插件组件配置
99
+ *
100
+ * @export
101
+ * @param {IWidgetInfoItem} designer
102
+ */
103
+ export declare function registerPadPluginWidgetItem(designer: IWidgetInfoItem): void;
104
+ export {};
@@ -0,0 +1,76 @@
1
+ import { Platform } from '@gct-paas/core';
2
+
3
+ class WidgetInfo {
4
+ events = {};
5
+ propEditors = {};
6
+ schema = {};
7
+ callback = {};
8
+ beforeCreate = {};
9
+ styleEditors = {};
10
+ designerConfig = {};
11
+ hooks = {};
12
+ whiteList = {};
13
+ blackList = {};
14
+ }
15
+ const webWidgetInfo = new WidgetInfo();
16
+ const mobileWidgetInfo = new WidgetInfo();
17
+ const padWidgetInfo = new WidgetInfo();
18
+ function getWidgetInfo(platform) {
19
+ switch (platform) {
20
+ case Platform.WEB:
21
+ return webWidgetInfo;
22
+ case Platform.MOBILE:
23
+ return mobileWidgetInfo;
24
+ case Platform.PAD:
25
+ return padWidgetInfo;
26
+ default:
27
+ return webWidgetInfo;
28
+ }
29
+ }
30
+ function registerWidgetItem(widgetInfo, type, module) {
31
+ widgetInfo.events[type] = module.eventList;
32
+ widgetInfo.hooks[type] = module.hooks;
33
+ widgetInfo.whiteList[type] = module.whiteList;
34
+ widgetInfo.blackList[type] = module.blackList;
35
+ widgetInfo.propEditors[type] = module.propEditorList;
36
+ widgetInfo.schema[type] = module.widget;
37
+ widgetInfo.callback[type] = module.runCallback;
38
+ widgetInfo.beforeCreate[type] = module.beforeCreate;
39
+ widgetInfo.styleEditors[type] = module.styleEditorList;
40
+ widgetInfo.designerConfig[type] = module.designerConfig;
41
+ }
42
+ function registerWebWidgetItem(module, type) {
43
+ registerWidgetItem(webWidgetInfo, type, module);
44
+ }
45
+ function registerMobileWidgetItem(module, type) {
46
+ registerWidgetItem(mobileWidgetInfo, type, module);
47
+ }
48
+ function registerPadWidgetItem(module, type) {
49
+ registerWidgetItem(padWidgetInfo, type, module);
50
+ }
51
+ function registerPluginWidgetItem(widgetInfo, designer) {
52
+ if (designer) {
53
+ const { type } = designer.schema;
54
+ widgetInfo.events[type] = designer.events;
55
+ widgetInfo.hooks[type] = designer.hooks;
56
+ widgetInfo.whiteList[type] = designer.whiteList;
57
+ widgetInfo.blackList[type] = designer.blackList;
58
+ widgetInfo.propEditors[type] = designer.propEditors;
59
+ widgetInfo.schema[type] = designer.schema;
60
+ widgetInfo.callback[type] = designer.callback;
61
+ widgetInfo.beforeCreate[type] = designer.beforeCreate;
62
+ widgetInfo.styleEditors[type] = designer.styleEditors;
63
+ widgetInfo.designerConfig[type] = designer.designerConfig;
64
+ }
65
+ }
66
+ function registerWebPluginWidgetItem(designer) {
67
+ registerPluginWidgetItem(webWidgetInfo, designer);
68
+ }
69
+ function registerMobilePluginWidgetItem(designer) {
70
+ registerPluginWidgetItem(mobileWidgetInfo, designer);
71
+ }
72
+ function registerPadPluginWidgetItem(designer) {
73
+ registerPluginWidgetItem(padWidgetInfo, designer);
74
+ }
75
+
76
+ export { getWidgetInfo, mobileWidgetInfo, padWidgetInfo, registerMobilePluginWidgetItem, registerMobileWidgetItem, registerPadPluginWidgetItem, registerPadWidgetItem, registerPluginWidgetItem, registerWebPluginWidgetItem, registerWebWidgetItem, registerWidgetItem, webWidgetInfo };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gct-paas/schema",
3
- "version": "0.1.4-dev.8",
3
+ "version": "0.1.4-dev.9",
4
4
  "type": "module",
5
5
  "description": "paas 平台 schema 架构包",
6
6
  "main": "dist/index.min.cjs",
@@ -52,12 +52,12 @@
52
52
  },
53
53
  "dependencies": {
54
54
  "@gct-paas/api": "0.1.0-dev.8",
55
- "@gct-paas/core": "0.1.4-dev.8",
55
+ "@gct-paas/core": "0.1.4-dev.9",
56
56
  "vue": "^3.5.28"
57
57
  },
58
58
  "devDependencies": {
59
- "@gct-paas/build": "^0.1.5-dev.6",
59
+ "@gct-paas/build": "^0.1.5-dev.8",
60
60
  "vitest": "^4.0.18"
61
61
  },
62
- "gitHead": "bf7f4f9672c3906ec834e6d58b999ce78f7cad08"
62
+ "gitHead": "c51d9883f7d287433d2def4d7338a06773804fbf"
63
63
  }