@gct-paas/schema 0.1.4-dev.8 → 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.
- package/dist/index.esm.min.js +1 -0
- package/es/constants/design.d.ts +26 -0
- package/es/constants/design.mjs +30 -0
- package/es/constants/index.d.ts +28 -0
- package/es/constants/index.mjs +411 -0
- package/es/index.d.ts +1 -1
- package/es/index.mjs +13 -10
- package/es/interface/common/data-linkage-config.d.ts +17 -0
- package/es/interface/design/i-design-container-node.d.ts +13 -0
- package/es/interface/design/i-design-data.d.ts +44 -0
- package/es/interface/design/i-design-editor-data.d.ts +20 -0
- package/es/interface/design/i-design-editor-node.d.ts +15 -0
- package/es/interface/design/i-design-node-data.d.ts +19 -0
- package/es/interface/design/i-design-node.d.ts +80 -0
- package/es/interface/design/i-design-page-node-data.d.ts +15 -0
- package/es/interface/design/i-design-tree-item.d.ts +26 -0
- package/es/interface/design/i-drag-data-item.d.ts +46 -0
- package/es/interface/design/index.d.ts +9 -0
- package/es/interface/designer.d.ts +8 -7
- package/es/interface/index.d.ts +7 -2
- package/es/interface/modal/i-modal-body.d.ts +1 -1
- package/es/interface/modal/i-modal.d.ts +1 -1
- package/es/interface/relationship-diagram-config/i-relationship-diagram-node.d.ts +82 -0
- package/es/interface/relationship-diagram-config/i-rule-config.d.ts +135 -0
- package/es/interface/relationship-diagram-config/index.d.ts +2 -0
- package/es/interface/schema/index.d.ts +2 -0
- package/es/interface/schema/widget-props/i-button-props.d.ts +170 -0
- package/es/interface/schema/widget-props/i-card-list-props.d.ts +79 -0
- package/es/interface/schema/widget-props/i-display-props.d.ts +48 -0
- package/es/interface/schema/widget-props/i-form-container-props.d.ts +91 -0
- package/es/interface/schema/widget-props/i-form-input-props.d.ts +409 -0
- package/es/interface/schema/widget-props/i-layout-props.d.ts +77 -0
- package/es/interface/schema/widget-props/i-search-widget-props.d.ts +132 -0
- package/es/interface/schema/widget-props/i-table-column-props.d.ts +54 -0
- package/es/interface/schema/widget-props/i-table-props.d.ts +384 -0
- package/es/interface/schema/widget-props/index.d.ts +9 -0
- package/es/interface/schema/widget-types.d.ts +399 -0
- package/es/interface/widget/i-common.d.ts +2 -1
- package/es/interface/widget/i-editors.d.ts +3 -2
- package/es/interface/widget/i-events.d.ts +2 -9
- package/es/interface/widget/i-hooks-and-misc.d.ts +1 -0
- package/es/interface/widget/i-props.d.ts +14 -32
- package/es/interface/widget/i-schemas.d.ts +6 -4
- package/es/interface/widget/i-styles.d.ts +2 -1
- package/es/interface/widget/index.d.ts +9 -2
- package/es/interface/widget-info/i-designer-item-hooks.d.ts +21 -0
- package/es/interface/widget-info/i-designer-schema-exports.d.ts +13 -0
- package/es/interface/widget-info/i-widget-info-item.d.ts +78 -0
- package/es/interface/widget-info/i-widget-info.d.ts +19 -0
- package/es/interface/widget-info/index.d.ts +4 -0
- package/es/utils/field-editor-override-registry/field-editor-override-registry.d.ts +36 -0
- package/es/utils/field-editor-override-registry/field-editor-override-registry.mjs +29 -0
- package/es/utils/index.d.ts +4 -2
- package/es/utils/index.mjs +6 -0
- package/es/utils/schema/index.d.ts +38 -1
- package/es/utils/schema/index.mjs +83 -5
- package/es/utils/schema/search.d.ts +9 -0
- package/es/utils/schema/search.mjs +146 -0
- package/es/utils/schema/utils.d.ts +21 -0
- package/es/utils/schema/utils.mjs +182 -0
- package/es/utils/schema-style/index.mjs +203 -127
- package/es/utils/widget-info/widget-info.d.ts +104 -0
- package/es/utils/widget-info/widget-info.mjs +151 -0
- package/package.json +12 -13
- package/dist/index.esm.min.mjs +0 -237
- package/dist/index.min.cjs +0 -1
- package/dist/index.system.min.js +0 -1
- package/es/schema/common-config/common-style.d.ts +0 -3
- package/es/schema/common-config/common-style.mjs +0 -85
- package/es/schema/index.d.ts +0 -1
|
@@ -1,155 +1,231 @@
|
|
|
1
|
-
import { isEmpty,
|
|
2
|
-
|
|
1
|
+
import { isEmpty, isNil, pick } from "lodash-es";
|
|
2
|
+
//#region src/utils/schema-style/index.ts
|
|
3
|
+
/**
|
|
4
|
+
* 样式计算工具类
|
|
5
|
+
* 提供样式单位转换、属性映射、样式属性处理等公共方法
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* 将像素值转换为对应单位
|
|
9
|
+
* 在移动环境下转换为 vw,其他环境保持 px
|
|
10
|
+
*
|
|
11
|
+
* @param pxValue - 像素值
|
|
12
|
+
* @returns 转换后的单位值字符串
|
|
13
|
+
*/
|
|
3
14
|
function pxToVw(pxValue) {
|
|
4
|
-
|
|
15
|
+
return pxValue + "px";
|
|
5
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* 添加 px 单位到样式值
|
|
19
|
+
*
|
|
20
|
+
* @param value - 样式值
|
|
21
|
+
* @returns 带 px 单位和 !important 的样式字符串
|
|
22
|
+
*/
|
|
6
23
|
function addPxUnit(value) {
|
|
7
|
-
|
|
24
|
+
return isEmpty(value) ? "" : `${value}px !important`;
|
|
8
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* 添加 !important 标志到样式值(不添加单位)
|
|
28
|
+
*
|
|
29
|
+
* @param value - 样式值
|
|
30
|
+
* @returns 带 !important 的样式字符串
|
|
31
|
+
*/
|
|
9
32
|
function addImportant(value) {
|
|
10
|
-
|
|
33
|
+
return isEmpty(value) ? "" : `${value} !important`;
|
|
11
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* 格式化边框样式对象
|
|
37
|
+
*
|
|
38
|
+
* @param border - 边框配置对象,包含 borderWidth、borderStyle、borderColor
|
|
39
|
+
* @returns 格式化后的边框样式字符串
|
|
40
|
+
*/
|
|
12
41
|
function formatBorder(border) {
|
|
13
|
-
|
|
14
|
-
|
|
42
|
+
if (!border || isEmpty(border.borderWidth)) return "";
|
|
43
|
+
return `${border.borderWidth}px ${border.borderStyle || "solid"} ${border.borderColor || "transparent"} !important`;
|
|
15
44
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
45
|
+
/**
|
|
46
|
+
* 字体样式处理默认配置
|
|
47
|
+
*/
|
|
48
|
+
var DEFAULT_FONT_CONFIG = {
|
|
49
|
+
fontAttrs: [
|
|
50
|
+
"fontWeight",
|
|
51
|
+
"fontSize",
|
|
52
|
+
"color",
|
|
53
|
+
"textDecorationLine",
|
|
54
|
+
"textAlign"
|
|
55
|
+
],
|
|
56
|
+
mapAttrs: {
|
|
57
|
+
bold: {
|
|
58
|
+
attr: "fontWeight",
|
|
59
|
+
callback: (value) => {
|
|
60
|
+
return value ? 700 : 400;
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
italic: {
|
|
64
|
+
attr: "fontStyle",
|
|
65
|
+
callback: (value) => {
|
|
66
|
+
return value ? "italic" : "normal";
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
textDecoration: { attr: "textDecorationLine" },
|
|
70
|
+
fontSize: {
|
|
71
|
+
attr: "fontSize",
|
|
72
|
+
callback: (value) => {
|
|
73
|
+
return value ? pxToVw(value) : "";
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
align: { attr: "textAlign" }
|
|
77
|
+
}
|
|
50
78
|
};
|
|
79
|
+
/**
|
|
80
|
+
* 从字体配置对象中提取并转换字体样式
|
|
81
|
+
*
|
|
82
|
+
* @param font - 字体配置对象
|
|
83
|
+
* @param config - 字体样式处理配置(可选,使用默认配置)
|
|
84
|
+
* @returns 转换后的样式对象
|
|
85
|
+
*/
|
|
51
86
|
function extractFontStyle(font, config = DEFAULT_FONT_CONFIG) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
return result;
|
|
87
|
+
if (!font) return {};
|
|
88
|
+
const result = {};
|
|
89
|
+
Object.assign(result, pick(font, config.fontAttrs));
|
|
90
|
+
if (typeof config.mapAttrs === "object") Object.keys(config.mapAttrs).forEach((k) => {
|
|
91
|
+
const { attr, callback } = config.mapAttrs[k];
|
|
92
|
+
result[attr] = typeof callback === "function" ? callback(font[k]) : font[k];
|
|
93
|
+
});
|
|
94
|
+
return result;
|
|
62
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* 将样式属性对象转换为 CSS 样式字符串格式
|
|
98
|
+
*
|
|
99
|
+
* @param styleProps - 样式属性对象
|
|
100
|
+
* @returns 转换后的样式对象(含单位和 !important)
|
|
101
|
+
*/
|
|
63
102
|
function propsToStyle(styleProps = {}) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
return wStyle;
|
|
103
|
+
const wStyle = {};
|
|
104
|
+
for (const prop in styleProps) wStyle[prop] = makeStyleProp(prop, styleProps[prop]);
|
|
105
|
+
return wStyle;
|
|
69
106
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
107
|
+
/**
|
|
108
|
+
* 不需要添加 px 单位的 CSS 属性列表
|
|
109
|
+
*/
|
|
110
|
+
var NOT_NEED_PX_STYLE = [
|
|
111
|
+
"opacity",
|
|
112
|
+
"zIndex",
|
|
113
|
+
"fontWeight",
|
|
114
|
+
"lineHeight",
|
|
115
|
+
"letterSpacing",
|
|
116
|
+
"wordSpacing",
|
|
117
|
+
"textAlign",
|
|
118
|
+
"textDecoration",
|
|
119
|
+
"textTransform",
|
|
120
|
+
"fontStyle",
|
|
121
|
+
"textDecorationLine"
|
|
82
122
|
];
|
|
123
|
+
/**
|
|
124
|
+
* 将单个样式属性值转换为带单位的 CSS 字符串
|
|
125
|
+
*
|
|
126
|
+
* @param prop - 属性名
|
|
127
|
+
* @param value - 属性值
|
|
128
|
+
* @returns 转换后的样式值字符串
|
|
129
|
+
*/
|
|
83
130
|
function makeStyleProp(prop, value) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
if (NOT_NEED_PX_STYLE.includes(prop)) {
|
|
88
|
-
return value + " !important";
|
|
89
|
-
}
|
|
90
|
-
return value + "px !important";
|
|
131
|
+
if (isNil(value) || isEmpty(value)) return "";
|
|
132
|
+
if (NOT_NEED_PX_STYLE.includes(prop)) return value + " !important";
|
|
133
|
+
return value + "px !important";
|
|
91
134
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
135
|
+
/**
|
|
136
|
+
* 对齐方式到 Flex 对齐值的映射
|
|
137
|
+
*/
|
|
138
|
+
var ALIGN_TO_FLEX_MAP = {
|
|
139
|
+
left: "flex-start",
|
|
140
|
+
center: "center",
|
|
141
|
+
right: "flex-end",
|
|
142
|
+
justify: "space-between"
|
|
97
143
|
};
|
|
144
|
+
/**
|
|
145
|
+
* 将对齐属性值转换为 Flex 对齐值
|
|
146
|
+
*
|
|
147
|
+
* @param align - 对齐方式(left、center、right、justify)
|
|
148
|
+
* @returns 对应的 Flex 对齐值
|
|
149
|
+
*/
|
|
98
150
|
function transAlign2flex(align) {
|
|
99
|
-
|
|
151
|
+
return ALIGN_TO_FLEX_MAP[align] || align;
|
|
100
152
|
}
|
|
153
|
+
/**
|
|
154
|
+
* 生成位置和尺寸样式对象
|
|
155
|
+
*
|
|
156
|
+
* @param style - 样式配置对象
|
|
157
|
+
* @returns 位置和尺寸样式对象
|
|
158
|
+
*/
|
|
101
159
|
function generatePositionStyles(style) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
160
|
+
return {
|
|
161
|
+
position: addImportant(style.position),
|
|
162
|
+
top: addPxUnit(style.top),
|
|
163
|
+
left: addPxUnit(style.left),
|
|
164
|
+
right: addPxUnit(style.right),
|
|
165
|
+
bottom: addPxUnit(style.bottom),
|
|
166
|
+
width: addPxUnit(style.width),
|
|
167
|
+
height: addPxUnit(style.height)
|
|
168
|
+
};
|
|
111
169
|
}
|
|
170
|
+
/**
|
|
171
|
+
* 生成背景和间距样式对象
|
|
172
|
+
*
|
|
173
|
+
* @param style - 样式配置对象
|
|
174
|
+
* @returns 背景和间距样式对象
|
|
175
|
+
*/
|
|
112
176
|
function generateSpacingStyles(style) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
177
|
+
return {
|
|
178
|
+
backgroundColor: addImportant(style.backgroundColor),
|
|
179
|
+
marginTop: addPxUnit(style.marginTop),
|
|
180
|
+
marginRight: addPxUnit(style.marginRight),
|
|
181
|
+
marginBottom: addPxUnit(style.marginBottom),
|
|
182
|
+
marginLeft: addPxUnit(style.marginLeft),
|
|
183
|
+
paddingTop: addPxUnit(style.paddingTop),
|
|
184
|
+
paddingRight: addPxUnit(style.paddingRight),
|
|
185
|
+
paddingBottom: addPxUnit(style.paddingBottom),
|
|
186
|
+
paddingLeft: addPxUnit(style.paddingLeft)
|
|
187
|
+
};
|
|
124
188
|
}
|
|
189
|
+
/**
|
|
190
|
+
* 生成边框样式对象
|
|
191
|
+
*
|
|
192
|
+
* @param style - 样式配置对象
|
|
193
|
+
* @returns 边框样式对象
|
|
194
|
+
*/
|
|
125
195
|
function generateBorderStyles(style) {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
196
|
+
return {
|
|
197
|
+
borderLeft: formatBorder(style.borderLeft),
|
|
198
|
+
borderRight: formatBorder(style.borderRight),
|
|
199
|
+
borderBottom: formatBorder(style.borderBottom),
|
|
200
|
+
borderTop: formatBorder(style.borderTop),
|
|
201
|
+
borderTopRightRadius: addPxUnit(style.borderTopRightRadius),
|
|
202
|
+
borderTopLeftRadius: addPxUnit(style.borderTopLeftRadius),
|
|
203
|
+
borderBottomRightRadius: addPxUnit(style.borderBottomRightRadius),
|
|
204
|
+
borderBottomLeftRadius: addPxUnit(style.borderBottomLeftRadius)
|
|
205
|
+
};
|
|
136
206
|
}
|
|
207
|
+
/**
|
|
208
|
+
* 生成完整的包装样式对象
|
|
209
|
+
* 合并位置、间距、边框等所有样式
|
|
210
|
+
*
|
|
211
|
+
* @param style - 样式配置对象
|
|
212
|
+
* @param ignoringStyle - 需要忽略的样式属性数组
|
|
213
|
+
* @returns 合并后的完整样式对象
|
|
214
|
+
*/
|
|
137
215
|
function generateWrapperStyle(style, ignoringStyle = []) {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
});
|
|
152
|
-
return styleData;
|
|
216
|
+
const styleData = {
|
|
217
|
+
...generatePositionStyles(style),
|
|
218
|
+
...generateSpacingStyles(style),
|
|
219
|
+
...generateBorderStyles(style)
|
|
220
|
+
};
|
|
221
|
+
ignoringStyle.forEach((key) => {
|
|
222
|
+
delete styleData[key];
|
|
223
|
+
});
|
|
224
|
+
Object.keys(styleData).forEach((key) => {
|
|
225
|
+
const val = styleData[key];
|
|
226
|
+
if (isNil(val) || isEmpty(val)) delete styleData[key];
|
|
227
|
+
});
|
|
228
|
+
return styleData;
|
|
153
229
|
}
|
|
154
|
-
|
|
230
|
+
//#endregion
|
|
155
231
|
export { ALIGN_TO_FLEX_MAP, addImportant, addPxUnit, extractFontStyle, formatBorder, generateBorderStyles, generatePositionStyles, generateSpacingStyles, generateWrapperStyle, makeStyleProp, propsToStyle, pxToVw, transAlign2flex };
|
|
@@ -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,151 @@
|
|
|
1
|
+
import { Platform } from "@gct-paas/core";
|
|
2
|
+
//#region src/utils/widget-info/widget-info.ts
|
|
3
|
+
/**
|
|
4
|
+
* 设计界面所有组件配置信息
|
|
5
|
+
*
|
|
6
|
+
* @export
|
|
7
|
+
* @class WidgetInfo
|
|
8
|
+
* @implements {IWidgetInfo}
|
|
9
|
+
*/
|
|
10
|
+
var WidgetInfo = class {
|
|
11
|
+
events = {};
|
|
12
|
+
propEditors = {};
|
|
13
|
+
schema = {};
|
|
14
|
+
callback = {};
|
|
15
|
+
beforeCreate = {};
|
|
16
|
+
styleEditors = {};
|
|
17
|
+
designerConfig = {};
|
|
18
|
+
hooks = {};
|
|
19
|
+
whiteList = {};
|
|
20
|
+
blackList = {};
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* 网页端组件配置信息
|
|
24
|
+
*/
|
|
25
|
+
var webWidgetInfo = new WidgetInfo();
|
|
26
|
+
/**
|
|
27
|
+
* 移动端组件配置信息
|
|
28
|
+
*/
|
|
29
|
+
var mobileWidgetInfo = new WidgetInfo();
|
|
30
|
+
/**
|
|
31
|
+
* 平板端组件配置信息
|
|
32
|
+
*/
|
|
33
|
+
var padWidgetInfo = new WidgetInfo();
|
|
34
|
+
/**
|
|
35
|
+
* 获取指定平台的组件配置信息
|
|
36
|
+
*
|
|
37
|
+
* @export
|
|
38
|
+
* @param {Platform} [platform] 平台类型
|
|
39
|
+
* @return {*} {IWidgetInfo} 组件配置信息
|
|
40
|
+
*/
|
|
41
|
+
function getWidgetInfo(platform) {
|
|
42
|
+
switch (platform) {
|
|
43
|
+
case Platform.WEB: return webWidgetInfo;
|
|
44
|
+
case Platform.MOBILE: return mobileWidgetInfo;
|
|
45
|
+
case Platform.PAD: return padWidgetInfo;
|
|
46
|
+
default:
|
|
47
|
+
console.warn(`Unknown platform "${platform}", returning webWidgetInfo by default.`);
|
|
48
|
+
return webWidgetInfo;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* 注册单一组件信息
|
|
53
|
+
*
|
|
54
|
+
* @export
|
|
55
|
+
* @param {IWidgetInfo} widgetInfo
|
|
56
|
+
* @param {string} type
|
|
57
|
+
* @param {IObject} module
|
|
58
|
+
*/
|
|
59
|
+
function registerWidgetItem(widgetInfo, type, module) {
|
|
60
|
+
widgetInfo.events[type] = module.eventList;
|
|
61
|
+
widgetInfo.hooks[type] = module.hooks;
|
|
62
|
+
widgetInfo.whiteList[type] = module.whiteList;
|
|
63
|
+
widgetInfo.blackList[type] = module.blackList;
|
|
64
|
+
widgetInfo.propEditors[type] = module.propEditorList;
|
|
65
|
+
widgetInfo.schema[type] = module.widget;
|
|
66
|
+
widgetInfo.callback[type] = module.runCallback;
|
|
67
|
+
widgetInfo.beforeCreate[type] = module.beforeCreate;
|
|
68
|
+
widgetInfo.styleEditors[type] = module.styleEditorList;
|
|
69
|
+
widgetInfo.designerConfig[type] = module.designerConfig;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* 注册网页端单一组件信息
|
|
73
|
+
*
|
|
74
|
+
* @export
|
|
75
|
+
* @param {IObject} module
|
|
76
|
+
* @param {string} type
|
|
77
|
+
*/
|
|
78
|
+
function registerWebWidgetItem(module, type) {
|
|
79
|
+
registerWidgetItem(webWidgetInfo, type, module);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* 注册移动端单一组件信息
|
|
83
|
+
*
|
|
84
|
+
* @export
|
|
85
|
+
* @param {IObject} module
|
|
86
|
+
* @param {string} type
|
|
87
|
+
*/
|
|
88
|
+
function registerMobileWidgetItem(module, type) {
|
|
89
|
+
registerWidgetItem(mobileWidgetInfo, type, module);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* 注册平板端单一组件信息
|
|
93
|
+
*
|
|
94
|
+
* @export
|
|
95
|
+
* @param {IObject} module
|
|
96
|
+
* @param {string} type
|
|
97
|
+
*/
|
|
98
|
+
function registerPadWidgetItem(module, type) {
|
|
99
|
+
registerWidgetItem(padWidgetInfo, type, module);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* 注册单一组件信息(插件方式)
|
|
103
|
+
*
|
|
104
|
+
* @export
|
|
105
|
+
* @param {IWidgetInfo} widgetInfo
|
|
106
|
+
* @param {IWidgetInfoItem} designer
|
|
107
|
+
*/
|
|
108
|
+
function registerPluginWidgetItem(widgetInfo, designer) {
|
|
109
|
+
if (designer) {
|
|
110
|
+
const { type } = designer.schema;
|
|
111
|
+
widgetInfo.events[type] = designer.events;
|
|
112
|
+
widgetInfo.hooks[type] = designer.hooks;
|
|
113
|
+
widgetInfo.whiteList[type] = designer.whiteList;
|
|
114
|
+
widgetInfo.blackList[type] = designer.blackList;
|
|
115
|
+
widgetInfo.propEditors[type] = designer.propEditors;
|
|
116
|
+
widgetInfo.schema[type] = designer.schema;
|
|
117
|
+
widgetInfo.callback[type] = designer.callback;
|
|
118
|
+
widgetInfo.beforeCreate[type] = designer.beforeCreate;
|
|
119
|
+
widgetInfo.styleEditors[type] = designer.styleEditors;
|
|
120
|
+
widgetInfo.designerConfig[type] = designer.designerConfig;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* 注册网页端插件组件配置
|
|
125
|
+
*
|
|
126
|
+
* @export
|
|
127
|
+
* @param {IWidgetInfoItem} designer
|
|
128
|
+
*/
|
|
129
|
+
function registerWebPluginWidgetItem(designer) {
|
|
130
|
+
registerPluginWidgetItem(webWidgetInfo, designer);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* 注册移动端插件组件配置
|
|
134
|
+
*
|
|
135
|
+
* @export
|
|
136
|
+
* @param {IWidgetInfoItem} designer
|
|
137
|
+
*/
|
|
138
|
+
function registerMobilePluginWidgetItem(designer) {
|
|
139
|
+
registerPluginWidgetItem(mobileWidgetInfo, designer);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* 注册平板端插件组件配置
|
|
143
|
+
*
|
|
144
|
+
* @export
|
|
145
|
+
* @param {IWidgetInfoItem} designer
|
|
146
|
+
*/
|
|
147
|
+
function registerPadPluginWidgetItem(designer) {
|
|
148
|
+
registerPluginWidgetItem(padWidgetInfo, designer);
|
|
149
|
+
}
|
|
150
|
+
//#endregion
|
|
151
|
+
export { getWidgetInfo, mobileWidgetInfo, padWidgetInfo, registerMobilePluginWidgetItem, registerMobileWidgetItem, registerPadPluginWidgetItem, registerPadWidgetItem, registerPluginWidgetItem, registerWebPluginWidgetItem, registerWebWidgetItem, registerWidgetItem, webWidgetInfo };
|
package/package.json
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gct-paas/schema",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5-dev.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "paas 平台 schema 架构包",
|
|
6
|
-
"
|
|
7
|
-
"module": "es/index.mjs",
|
|
6
|
+
"loader": "dist/index.esm.min.js",
|
|
8
7
|
"types": "es/index.d.ts",
|
|
9
|
-
"system": "dist/index.system.min.js",
|
|
10
8
|
"exports": {
|
|
11
9
|
".": {
|
|
12
10
|
"types": "./es/index.d.ts",
|
|
13
|
-
"import": "./es/index.mjs"
|
|
14
|
-
"require": "./dist/index.min.cjs"
|
|
11
|
+
"import": "./es/index.mjs"
|
|
15
12
|
},
|
|
16
13
|
"./types": {
|
|
17
14
|
"types": "./es/types/index.d.ts"
|
|
@@ -51,13 +48,15 @@
|
|
|
51
48
|
"gen-api:platform": "gct-paas gen-api --url=http://paas.paasdev.gct-paas.com --tag=platform -t ../cli/hbs-temp -o ./src/service/gct-platform && prettier './src/service/gct-platform' --write"
|
|
52
49
|
},
|
|
53
50
|
"dependencies": {
|
|
54
|
-
"@gct-paas/api": "0.1.
|
|
55
|
-
"@gct-paas/core": "0.1.
|
|
56
|
-
"
|
|
51
|
+
"@gct-paas/api": "^0.1.2-dev.3",
|
|
52
|
+
"@gct-paas/core": "0.1.5-dev.0",
|
|
53
|
+
"lodash-es": "^4.17.23",
|
|
54
|
+
"vue": "^3.5.30"
|
|
57
55
|
},
|
|
58
|
-
"
|
|
59
|
-
"@gct-paas/
|
|
60
|
-
"
|
|
56
|
+
"peerDependencies": {
|
|
57
|
+
"@gct-paas/api": "*",
|
|
58
|
+
"@gct-paas/core": "*",
|
|
59
|
+
"vue": ">=3"
|
|
61
60
|
},
|
|
62
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "d5a1badfd34c55ceefd2cf33f2ee659454076e37"
|
|
63
62
|
}
|