@cloudbase/cals 1.0.49-alpha.0 → 1.0.50
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/lib/parser/cals/utils/template.js +3 -3
- package/lib/utils/dts/index.d.ts +1 -1
- package/lib/utils/dts/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/lib/parser/cals/utils/block/index.js +0 -151
- package/lib/parser/cals/utils/code/index.js +0 -393
- package/lib/parser/cals/utils/common.js +0 -268
- package/lib/parser/cals/utils/getUsedResources.d.ts +0 -10
- package/lib/parser/cals/utils/getUsedResources.d.ts.map +0 -1
- package/lib/parser/cals/utils/getUsedResources.js +0 -128
- package/lib/parser/cals/utils/runtime.js +0 -268
- package/lib/parser/cals/utils/style.js +0 -472
- package/lib/parser/cals/utils/version/common.js +0 -385
- package/lib/parser/cals/utils/version/config.d.ts +0 -16
- package/lib/parser/cals/utils/version/config.d.ts.map +0 -1
- package/lib/parser/cals/utils/version/config.js +0 -244
- package/lib/parser/cals/utils/version/index.js +0 -96
- package/lib/parser/cals/utils/version/parses.js +0 -581
- package/lib/parser/cals/utils/version/utils.d.ts +0 -14
- package/lib/parser/cals/utils/version/utils.d.ts.map +0 -1
- package/lib/parser/cals/utils/version/utils.js +0 -148
- package/lib/parser/expression/index.d.ts +0 -123
- package/lib/parser/expression/index.d.ts.map +0 -1
- package/lib/parser/expression/index.js +0 -301
- package/lib/parser/plugins/postcss-rpx2clac.d.ts +0 -18
- package/lib/parser/plugins/postcss-rpx2clac.d.ts.map +0 -1
- package/lib/parser/plugins/postcss-rpx2clac.js +0 -68
- package/lib/types/basic/app.d.ts +0 -73
- package/lib/types/basic/app.d.ts.map +0 -1
- package/lib/types/basic/app.js +0 -2
- package/lib/types/basic/common.d.ts +0 -93
- package/lib/types/basic/common.d.ts.map +0 -1
- package/lib/types/basic/common.js +0 -2
- package/lib/types/basic/component.d.ts +0 -211
- package/lib/types/basic/component.d.ts.map +0 -1
- package/lib/types/basic/component.js +0 -2
- package/lib/types/basic/datasource.d.ts +0 -50
- package/lib/types/basic/datasource.d.ts.map +0 -1
- package/lib/types/basic/datasource.js +0 -2
- package/lib/types/index.js +0 -42
- package/lib/types/lcds.js +0 -25
- package/lib/types/platform/app.js +0 -11
- package/lib/types/platform/common.d.ts +0 -181
- package/lib/types/platform/common.d.ts.map +0 -1
- package/lib/types/platform/common.js +0 -87
- package/lib/types/platform/component.d.ts +0 -139
- package/lib/types/platform/component.d.ts.map +0 -1
- package/lib/types/platform/component.js +0 -11
- package/lib/types/platform/datasource.d.ts +0 -467
- package/lib/types/platform/datasource.d.ts.map +0 -1
- package/lib/types/platform/datasource.js +0 -2
- package/lib/types/platform/eventFlow.d.ts +0 -20
- package/lib/types/platform/eventFlow.d.ts.map +0 -1
- package/lib/types/platform/eventFlow.js +0 -2
- package/lib/types/platform/query.d.ts +0 -67
- package/lib/types/platform/query.d.ts.map +0 -1
- package/lib/types/platform/query.js +0 -2
- package/lib/types/platform/theme.js +0 -2
- package/lib/types/platform/widget/form.d.ts +0 -5
- package/lib/types/platform/widget/form.d.ts.map +0 -1
- package/lib/types/platform/widget/form.js +0 -5
- package/lib/types/platform/widget/meta.d.ts +0 -60
- package/lib/types/platform/widget/meta.d.ts.map +0 -1
- package/lib/types/platform/widget/meta.js +0 -6
- package/lib/utils/CSSProperty.d.ts +0 -64
- package/lib/utils/CSSProperty.d.ts.map +0 -1
- package/lib/utils/CSSProperty.js +0 -89
- package/lib/utils/build.d.ts +0 -2
- package/lib/utils/build.d.ts.map +0 -1
- package/lib/utils/build.js +0 -75
- package/lib/utils/dts/auto-generated.d.ts +0 -2
- package/lib/utils/dts/auto-generated.d.ts.map +0 -1
- package/lib/utils/dts/auto-generated.js +0 -1796
- package/lib/utils/dts/build.d.ts +0 -2
- package/lib/utils/dts/build.d.ts.map +0 -1
- package/lib/utils/dts/build.js +0 -136
- package/lib/utils/dts/index.js +0 -1008
- package/lib/utils/index.js +0 -27
- package/lib/utils/version/common.d.ts +0 -3
- package/lib/utils/version/common.d.ts.map +0 -1
- package/lib/utils/version/common.js +0 -27
- package/lib/utils/version/featureChecker.js +0 -35
- package/lib/utils/version/migrations/version4.js +0 -199
- package/lib/utils/version-migrations/common.d.ts +0 -5
- package/lib/utils/version-migrations/common.d.ts.map +0 -1
- package/lib/utils/version-migrations/common.js +0 -29
- package/lib/utils/version-migrations/version4.d.ts +0 -3
- package/lib/utils/version-migrations/version4.d.ts.map +0 -1
- package/lib/utils/version-migrations/version4.js +0 -199
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.deepParse = exports.upgrageToVersion2 = void 0;
|
|
27
|
-
const utils_1 = require("./utils");
|
|
28
|
-
const common_1 = require("./common");
|
|
29
|
-
const CompParse = __importStar(require("./parses"));
|
|
30
|
-
const index_1 = require("../../index");
|
|
31
|
-
function upgrageToVersion2(app) {
|
|
32
|
-
if (app.selectedPageId) {
|
|
33
|
-
(0, utils_1.init)(app);
|
|
34
|
-
(0, common_1.renameRepeatId)(app);
|
|
35
|
-
parse2V2(app);
|
|
36
|
-
let str = JSON.stringify(app);
|
|
37
|
-
let obj = JSON.parse(str.replace(/app\.getPageOptions/g, '(()=>{})').replace(/\\\\n/g, '\\n'));
|
|
38
|
-
return (0, index_1.serializePlatformApp)(obj, { dependencies: [] });
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
return app;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
exports.upgrageToVersion2 = upgrageToVersion2;
|
|
45
|
-
function parse2V2(json) {
|
|
46
|
-
const { pageInstanceList = [], selectedPageId } = json;
|
|
47
|
-
let findSelectedPage = false;
|
|
48
|
-
pageInstanceList.forEach((pageInstance, index) => {
|
|
49
|
-
if (pageInstance.id === selectedPageId) {
|
|
50
|
-
findSelectedPage = true;
|
|
51
|
-
}
|
|
52
|
-
CompParse.addFormWrapperComp(pageInstance);
|
|
53
|
-
if ((0, utils_1.isComplexJSON)(json)) {
|
|
54
|
-
CompParse.parseComplexComponentInstance(pageInstance);
|
|
55
|
-
}
|
|
56
|
-
const { componentInstances } = pageInstance;
|
|
57
|
-
for (const i in componentInstances) {
|
|
58
|
-
const comp = componentInstances[i];
|
|
59
|
-
deepParse(comp, i, null);
|
|
60
|
-
}
|
|
61
|
-
let { lowCodes = [] } = pageInstance;
|
|
62
|
-
let find = lowCodes.find((meta) => {
|
|
63
|
-
return meta.path == 'registerUser/handler/onFormSubmit';
|
|
64
|
-
});
|
|
65
|
-
if (find) {
|
|
66
|
-
find.code =
|
|
67
|
-
"/*\n* 可通过 $page.handler.xxx 访问这里定义的方法\n* 注意:该方法仅在所属的页面有效\n* 如果需要 async-await,请修改成 export default async function() {}\n*/\n\nexport default async function({event}) {\n let result = event.detail\n try {\n app.showLoading('创建中...')\n const createResp = await app.dataSources.user.create(result)\n app.hideLoading()\n if (!createResp.code) {\n app.dataVar.$status.users = {status: 'loading'}\n const listResp = await app.dataSources.user.getList()\n app.hideLoading()\n if (!listResp.code) {\n app.dataVar.users = listResp.data\n app.dataVar.$status.users = {status: 'success', message: 'test-success'}\n } else {\n app.dataVar.$status.users = {status: 'failed', code: listResp.code, message: listResp.message}\n app.showToast({title: '重新获取列表失败: ' + listResp.message, duration: 2000})\n }\n } else {\n app.hideLoading()\n app.showToast({title: '创建失败: ' + createResp.message, duration: 2000})\n return\n }\n } catch (e) {\n app.hideLoading()\n console.warn(e)\n app.showToast({title: '错误:' + e.message, duration: 2000})\n }\n app.navigateBack()\n}";
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
if (!findSelectedPage && pageInstanceList.length) {
|
|
71
|
-
json.selectedPageId = pageInstanceList[0].id || '';
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
function deepParse(comp, key, parent) {
|
|
75
|
-
const { xComponent } = comp;
|
|
76
|
-
if (xComponent) {
|
|
77
|
-
const { name } = xComponent;
|
|
78
|
-
(0, common_1.beforeCommonParse)(comp);
|
|
79
|
-
const parseFunction = CompParse[`parseGsdKbone${name}`];
|
|
80
|
-
parseFunction === null || parseFunction === void 0 ? void 0 : parseFunction(comp, key, parent);
|
|
81
|
-
(0, common_1.afterCommonParse)(comp);
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
// 当前为 slot
|
|
85
|
-
}
|
|
86
|
-
// 处理后再取 keys
|
|
87
|
-
const keys = Object.keys(comp['properties'] || {});
|
|
88
|
-
if (keys.length > 0) {
|
|
89
|
-
keys.forEach((key) => {
|
|
90
|
-
const _comp = comp['properties'][key];
|
|
91
|
-
_comp && deepParse(_comp, key, comp);
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
exports.deepParse = deepParse;
|
|
@@ -1,581 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.parseComplexComponentInstance = exports.parseGsdKboneTabs = exports.addFormWrapperComp = exports.parseGsdKboneUpload = exports.parseGsdKboneDateTimePicker = exports.parseGsdKbonePicker = exports.parseGsdKboneSwitch = exports.parseGsdKboneInput = exports.parseGsdKboneText = exports.parseGsdKboneRichText = exports.parseGsdKboneSwiper = exports.parseGsdKboneAgree = exports.parseGsdKbonePopLayer = exports.parseGsdKboneButton = exports.parseGsdKboneFooter = void 0;
|
|
7
|
-
const utils_1 = require("./utils");
|
|
8
|
-
const get_1 = __importDefault(require("lodash/get"));
|
|
9
|
-
const set_1 = __importDefault(require("lodash/set"));
|
|
10
|
-
const merge_1 = __importDefault(require("lodash/merge"));
|
|
11
|
-
const common_1 = require("./common");
|
|
12
|
-
const utils_2 = require("../../../../utils");
|
|
13
|
-
function parseGsdKboneFooter(comp) {
|
|
14
|
-
const { xComponent, xProps } = comp;
|
|
15
|
-
if (xComponent.moduleName === 'gsd-kbone') {
|
|
16
|
-
xComponent.moduleName = utils_2.OFFICIAL_COMPONENT_LIB_NAME;
|
|
17
|
-
xComponent.name = 'Footer';
|
|
18
|
-
const { data } = xProps;
|
|
19
|
-
const textValue = data.text.value;
|
|
20
|
-
comp.properties = {
|
|
21
|
-
text: {
|
|
22
|
-
properties: {
|
|
23
|
-
[(0, utils_1.getId)()]: {
|
|
24
|
-
xComponent: {
|
|
25
|
-
moduleName: 'gsd-h5-react',
|
|
26
|
-
name: 'Text',
|
|
27
|
-
},
|
|
28
|
-
xProps: {
|
|
29
|
-
data: {
|
|
30
|
-
text: {
|
|
31
|
-
value: textValue,
|
|
32
|
-
},
|
|
33
|
-
decode: {
|
|
34
|
-
value: false,
|
|
35
|
-
},
|
|
36
|
-
selectable: {
|
|
37
|
-
value: false,
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
xIndex: 0,
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
delete data.text;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
exports.parseGsdKboneFooter = parseGsdKboneFooter;
|
|
50
|
-
function parseGsdKboneButton(comp) {
|
|
51
|
-
const { xComponent, xProps } = comp;
|
|
52
|
-
if (xComponent.moduleName === 'gsd-kbone') {
|
|
53
|
-
xComponent.moduleName = utils_2.OFFICIAL_COMPONENT_LIB_NAME;
|
|
54
|
-
xComponent.name = 'Button';
|
|
55
|
-
const targetData = {
|
|
56
|
-
size: {
|
|
57
|
-
type: 'static',
|
|
58
|
-
value: 'default',
|
|
59
|
-
},
|
|
60
|
-
type: {
|
|
61
|
-
type: 'static',
|
|
62
|
-
value: 'primary',
|
|
63
|
-
},
|
|
64
|
-
plain: {
|
|
65
|
-
type: 'static',
|
|
66
|
-
value: false,
|
|
67
|
-
},
|
|
68
|
-
loading: {
|
|
69
|
-
type: 'static',
|
|
70
|
-
value: false,
|
|
71
|
-
},
|
|
72
|
-
disabled: {
|
|
73
|
-
type: 'static',
|
|
74
|
-
value: false,
|
|
75
|
-
},
|
|
76
|
-
formType: {
|
|
77
|
-
type: 'static',
|
|
78
|
-
value: '',
|
|
79
|
-
},
|
|
80
|
-
openType: {
|
|
81
|
-
type: 'static',
|
|
82
|
-
value: '',
|
|
83
|
-
},
|
|
84
|
-
categoryId: {
|
|
85
|
-
type: 'static',
|
|
86
|
-
value: [],
|
|
87
|
-
},
|
|
88
|
-
sessionFrom: {
|
|
89
|
-
type: 'static',
|
|
90
|
-
value: '',
|
|
91
|
-
},
|
|
92
|
-
appParameter: {
|
|
93
|
-
type: 'static',
|
|
94
|
-
value: '',
|
|
95
|
-
},
|
|
96
|
-
sendMessageImg: {
|
|
97
|
-
type: 'static',
|
|
98
|
-
value: '',
|
|
99
|
-
},
|
|
100
|
-
sendMessagePath: {
|
|
101
|
-
type: 'static',
|
|
102
|
-
value: '',
|
|
103
|
-
},
|
|
104
|
-
showMessageCard: {
|
|
105
|
-
type: 'static',
|
|
106
|
-
value: false,
|
|
107
|
-
},
|
|
108
|
-
sendMessageTitle: {
|
|
109
|
-
type: 'static',
|
|
110
|
-
value: '',
|
|
111
|
-
},
|
|
112
|
-
};
|
|
113
|
-
const { data } = xProps;
|
|
114
|
-
const { text = {} } = data;
|
|
115
|
-
// 转换 data
|
|
116
|
-
for (const i in targetData) {
|
|
117
|
-
for (const j in targetData[i]) {
|
|
118
|
-
if (data[i] && data[i][j]) {
|
|
119
|
-
targetData[i][j] = data[i][j];
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
xProps.data = targetData;
|
|
124
|
-
// 转换内容
|
|
125
|
-
if (text.type === 'slot') {
|
|
126
|
-
comp.properties = {
|
|
127
|
-
contentSlot: {
|
|
128
|
-
properties: comp.properties.text.properties,
|
|
129
|
-
},
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
comp.properties = {
|
|
134
|
-
contentSlot: {
|
|
135
|
-
properties: {
|
|
136
|
-
[(0, utils_1.getId)()]: {
|
|
137
|
-
xComponent: {
|
|
138
|
-
moduleName: 'gsd-h5-react',
|
|
139
|
-
name: 'Text',
|
|
140
|
-
},
|
|
141
|
-
xProps: {
|
|
142
|
-
data: {
|
|
143
|
-
decode: {
|
|
144
|
-
value: false,
|
|
145
|
-
},
|
|
146
|
-
selectable: {
|
|
147
|
-
value: false,
|
|
148
|
-
},
|
|
149
|
-
text: text,
|
|
150
|
-
},
|
|
151
|
-
},
|
|
152
|
-
xIndex: 0,
|
|
153
|
-
},
|
|
154
|
-
},
|
|
155
|
-
},
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
exports.parseGsdKboneButton = parseGsdKboneButton;
|
|
161
|
-
function parseGsdKbonePopLayer(comp) {
|
|
162
|
-
// 特殊处理,因为组件名字大小写改了
|
|
163
|
-
comp.xComponent.name = 'Poplayer';
|
|
164
|
-
const slotKeys = ['content', 'footer'];
|
|
165
|
-
(0, utils_1.addDefaultSlot)(slotKeys, comp);
|
|
166
|
-
const defaultData = {
|
|
167
|
-
visible: {
|
|
168
|
-
value: true,
|
|
169
|
-
},
|
|
170
|
-
content: {
|
|
171
|
-
value: '内容',
|
|
172
|
-
type: 'slot',
|
|
173
|
-
},
|
|
174
|
-
footer: {
|
|
175
|
-
value: '',
|
|
176
|
-
type: 'slot',
|
|
177
|
-
},
|
|
178
|
-
direction: {
|
|
179
|
-
value: 'bottom',
|
|
180
|
-
},
|
|
181
|
-
popWidth: {
|
|
182
|
-
value: '100%',
|
|
183
|
-
},
|
|
184
|
-
popHeight: {
|
|
185
|
-
value: '120',
|
|
186
|
-
},
|
|
187
|
-
};
|
|
188
|
-
(0, utils_1.addDefaultData)(defaultData, comp);
|
|
189
|
-
}
|
|
190
|
-
exports.parseGsdKbonePopLayer = parseGsdKbonePopLayer;
|
|
191
|
-
function parseGsdKboneAgree(comp, key, parent) {
|
|
192
|
-
(0, common_1.addFormItem)(comp, key, parent, true);
|
|
193
|
-
const slotKeys = ['content'];
|
|
194
|
-
(0, utils_1.addDefaultSlot)(slotKeys, comp);
|
|
195
|
-
const defaultData = {
|
|
196
|
-
name: {
|
|
197
|
-
value: 'thisIsAgreeKey',
|
|
198
|
-
},
|
|
199
|
-
value: {
|
|
200
|
-
value: false,
|
|
201
|
-
},
|
|
202
|
-
checkedIcon: {
|
|
203
|
-
value: 'https://weapps-prod-1301730524.cos.ap-guangzhou.myqcloud.com/res/2/square.svg',
|
|
204
|
-
},
|
|
205
|
-
uncheckedIcon: {
|
|
206
|
-
value: 'https://weapps-prod-1301730524.cos.ap-guangzhou.myqcloud.com/res/2/square_un.svg',
|
|
207
|
-
},
|
|
208
|
-
};
|
|
209
|
-
(0, utils_1.addDefaultData)(defaultData, comp);
|
|
210
|
-
if (comp.properties && comp.properties.custom) {
|
|
211
|
-
comp.properties.content = comp.properties.custom;
|
|
212
|
-
delete comp.properties.custom;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
exports.parseGsdKboneAgree = parseGsdKboneAgree;
|
|
216
|
-
function parseGsdKboneSwiper(comp) {
|
|
217
|
-
const defaultData = {
|
|
218
|
-
indicatorDots: {
|
|
219
|
-
value: false,
|
|
220
|
-
},
|
|
221
|
-
autoplay: {
|
|
222
|
-
value: true,
|
|
223
|
-
},
|
|
224
|
-
current: {
|
|
225
|
-
value: 0,
|
|
226
|
-
},
|
|
227
|
-
interval: {
|
|
228
|
-
value: 2000,
|
|
229
|
-
},
|
|
230
|
-
duration: {
|
|
231
|
-
value: 500,
|
|
232
|
-
},
|
|
233
|
-
circular: {
|
|
234
|
-
value: false,
|
|
235
|
-
},
|
|
236
|
-
vertical: {
|
|
237
|
-
value: false,
|
|
238
|
-
},
|
|
239
|
-
previousMargin: {
|
|
240
|
-
value: 0,
|
|
241
|
-
},
|
|
242
|
-
nextMargin: {
|
|
243
|
-
value: 0,
|
|
244
|
-
},
|
|
245
|
-
displayMultipleItems: {
|
|
246
|
-
value: 1,
|
|
247
|
-
},
|
|
248
|
-
updated: {
|
|
249
|
-
value: 0,
|
|
250
|
-
},
|
|
251
|
-
indicatorColor: {
|
|
252
|
-
value: '',
|
|
253
|
-
},
|
|
254
|
-
indicatorActiveColor: {
|
|
255
|
-
value: '',
|
|
256
|
-
},
|
|
257
|
-
};
|
|
258
|
-
(0, utils_1.addDefaultData)(defaultData, comp);
|
|
259
|
-
(0, utils_1.getComponentChildren)(comp).map(([subKey, subComp]) => {
|
|
260
|
-
const { xComponent } = subComp;
|
|
261
|
-
if (xComponent.name === 'Container') {
|
|
262
|
-
xComponent.moduleName = 'gsd-h5-react';
|
|
263
|
-
xComponent.name = 'SwiperItem';
|
|
264
|
-
}
|
|
265
|
-
else {
|
|
266
|
-
const newSwiperItemId = (0, utils_1.getId)();
|
|
267
|
-
const newSubComp = JSON.parse(JSON.stringify(subComp).replace(new RegExp(`forItems\\.${subKey}`, 'g'), `forItems.${newSwiperItemId}`));
|
|
268
|
-
const waFor = (0, get_1.default)(newSubComp, 'xProps.directives.waFor');
|
|
269
|
-
try {
|
|
270
|
-
delete newSubComp.xProps.directives.waFor;
|
|
271
|
-
delete comp.properties[subKey];
|
|
272
|
-
}
|
|
273
|
-
catch (e) {
|
|
274
|
-
console.error('parseGsdKboneSwiper 删除 waFor 出错', e);
|
|
275
|
-
}
|
|
276
|
-
comp.properties[newSwiperItemId] = {
|
|
277
|
-
xComponent: {
|
|
278
|
-
moduleName: 'gsd-h5-react',
|
|
279
|
-
name: 'SwiperItem',
|
|
280
|
-
},
|
|
281
|
-
// @ts-ignore
|
|
282
|
-
xProps: {
|
|
283
|
-
commonStyle: {
|
|
284
|
-
self: {
|
|
285
|
-
width: '100%',
|
|
286
|
-
height: '100%',
|
|
287
|
-
position: 'absolute',
|
|
288
|
-
},
|
|
289
|
-
},
|
|
290
|
-
directives: {
|
|
291
|
-
waFor,
|
|
292
|
-
},
|
|
293
|
-
},
|
|
294
|
-
properties: {
|
|
295
|
-
[subKey]: newSubComp,
|
|
296
|
-
},
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
|
-
exports.parseGsdKboneSwiper = parseGsdKboneSwiper;
|
|
302
|
-
function parseGsdKboneRichText(comp) {
|
|
303
|
-
const { xProps } = comp;
|
|
304
|
-
if (xProps.data) {
|
|
305
|
-
xProps.data.nodes = xProps.data.nodes || xProps.data.content;
|
|
306
|
-
delete xProps.data.content;
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
exports.parseGsdKboneRichText = parseGsdKboneRichText;
|
|
310
|
-
function parseGsdKboneText(comp) {
|
|
311
|
-
// @ts-ignore
|
|
312
|
-
comp.xProps = comp.xProps || {};
|
|
313
|
-
comp.xProps.commonStyle = comp.xProps.commonStyle || {};
|
|
314
|
-
// v1 版本 text 为 block
|
|
315
|
-
comp.xProps.commonStyle = (0, merge_1.default)({
|
|
316
|
-
display: 'block',
|
|
317
|
-
self: {
|
|
318
|
-
display: 'block',
|
|
319
|
-
},
|
|
320
|
-
}, comp.xProps.commonStyle);
|
|
321
|
-
}
|
|
322
|
-
exports.parseGsdKboneText = parseGsdKboneText;
|
|
323
|
-
function parseGsdKboneInput(comp, key, parent) {
|
|
324
|
-
(0, common_1.addFormItem)(comp, key, parent);
|
|
325
|
-
const slotKeys = ['prefix', 'suffix'];
|
|
326
|
-
(0, utils_1.addDefaultSlot)(slotKeys, comp);
|
|
327
|
-
const defaultData = {
|
|
328
|
-
name: {
|
|
329
|
-
value: 'uniqueFormKey',
|
|
330
|
-
},
|
|
331
|
-
placeholder: {
|
|
332
|
-
value: '请输入',
|
|
333
|
-
},
|
|
334
|
-
disabled: {
|
|
335
|
-
value: false,
|
|
336
|
-
},
|
|
337
|
-
focus: {
|
|
338
|
-
value: false,
|
|
339
|
-
},
|
|
340
|
-
password: {
|
|
341
|
-
value: false,
|
|
342
|
-
},
|
|
343
|
-
type: {
|
|
344
|
-
value: 'text',
|
|
345
|
-
},
|
|
346
|
-
maxLength: {
|
|
347
|
-
value: 140,
|
|
348
|
-
},
|
|
349
|
-
clearable: {
|
|
350
|
-
value: true,
|
|
351
|
-
},
|
|
352
|
-
value: {
|
|
353
|
-
value: '',
|
|
354
|
-
},
|
|
355
|
-
confirmType: {
|
|
356
|
-
value: 'done',
|
|
357
|
-
},
|
|
358
|
-
prefix: {
|
|
359
|
-
value: '',
|
|
360
|
-
type: 'slot',
|
|
361
|
-
},
|
|
362
|
-
suffix: {
|
|
363
|
-
value: '',
|
|
364
|
-
type: 'slot',
|
|
365
|
-
},
|
|
366
|
-
};
|
|
367
|
-
(0, utils_1.addDefaultData)(defaultData, comp);
|
|
368
|
-
const append = (0, get_1.default)(comp, 'properties.append');
|
|
369
|
-
if (append) {
|
|
370
|
-
(0, set_1.default)(comp, 'properties.suffix', append);
|
|
371
|
-
(0, set_1.default)(comp, 'xProps.data.isSuffix.value', true);
|
|
372
|
-
delete comp.properties.append;
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
exports.parseGsdKboneInput = parseGsdKboneInput;
|
|
376
|
-
function parseGsdKboneSwitch(comp, key, parent) {
|
|
377
|
-
(0, common_1.addFormItem)(comp, key, parent, true);
|
|
378
|
-
const defaultValue = (0, get_1.default)(comp, 'xProps.data.defaultValue');
|
|
379
|
-
defaultValue && (0, set_1.default)(comp, 'xProps.data.value', defaultValue);
|
|
380
|
-
const originStyle = (0, get_1.default)(comp, 'xProps.commonStyle.margin');
|
|
381
|
-
(0, set_1.default)(comp, 'xProps.commonStyle.margin', Object.assign(Object.assign({}, originStyle), { top: '30', right: '40', bottom: '30', left: '40' }));
|
|
382
|
-
}
|
|
383
|
-
exports.parseGsdKboneSwitch = parseGsdKboneSwitch;
|
|
384
|
-
function parseGsdKbonePicker(comp, key, parent) {
|
|
385
|
-
(0, common_1.addFormItem)(comp, key, parent);
|
|
386
|
-
comp.xComponent.name = 'Selector';
|
|
387
|
-
}
|
|
388
|
-
exports.parseGsdKbonePicker = parseGsdKbonePicker;
|
|
389
|
-
function parseGsdKboneDateTimePicker(comp, key, parent) {
|
|
390
|
-
(0, common_1.addFormItem)(comp, key, parent);
|
|
391
|
-
const modeValue = (0, get_1.default)(comp, 'xProps.data.mode.value');
|
|
392
|
-
if (modeValue === 'date') {
|
|
393
|
-
comp.xComponent.name = 'Date';
|
|
394
|
-
}
|
|
395
|
-
else {
|
|
396
|
-
comp.xComponent.name = 'Time';
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
exports.parseGsdKboneDateTimePicker = parseGsdKboneDateTimePicker;
|
|
400
|
-
function parseGsdKboneUpload(comp, key, parent) {
|
|
401
|
-
(0, common_1.addFormItem)(comp, key, parent);
|
|
402
|
-
comp.xComponent.name = 'Uploader';
|
|
403
|
-
const defaultData = {
|
|
404
|
-
name: {
|
|
405
|
-
value: 'thisIsUploadKey',
|
|
406
|
-
},
|
|
407
|
-
value: {
|
|
408
|
-
value: [],
|
|
409
|
-
},
|
|
410
|
-
maxNumber: {
|
|
411
|
-
value: 9,
|
|
412
|
-
},
|
|
413
|
-
type: {
|
|
414
|
-
value: 'media',
|
|
415
|
-
},
|
|
416
|
-
mediaType: {
|
|
417
|
-
value: ['image'],
|
|
418
|
-
},
|
|
419
|
-
sourceType: {
|
|
420
|
-
value: ['album', 'camera'],
|
|
421
|
-
},
|
|
422
|
-
maxSize: {
|
|
423
|
-
value: 500,
|
|
424
|
-
},
|
|
425
|
-
filename: {
|
|
426
|
-
value: 'file',
|
|
427
|
-
},
|
|
428
|
-
header: {
|
|
429
|
-
value: {},
|
|
430
|
-
},
|
|
431
|
-
formData: {
|
|
432
|
-
value: {},
|
|
433
|
-
},
|
|
434
|
-
disabled: {
|
|
435
|
-
value: false,
|
|
436
|
-
},
|
|
437
|
-
action: {
|
|
438
|
-
value: '',
|
|
439
|
-
},
|
|
440
|
-
extension: {
|
|
441
|
-
value: '',
|
|
442
|
-
},
|
|
443
|
-
};
|
|
444
|
-
(0, utils_1.addDefaultData)(defaultData, comp);
|
|
445
|
-
}
|
|
446
|
-
exports.parseGsdKboneUpload = parseGsdKboneUpload;
|
|
447
|
-
function addFormWrapperComp(pageInstance) {
|
|
448
|
-
const { componentInstances } = pageInstance;
|
|
449
|
-
const cloneTree = {
|
|
450
|
-
properties: componentInstances,
|
|
451
|
-
};
|
|
452
|
-
if ((0, utils_1.checkIsNeedAddFormWrapper)(cloneTree)) {
|
|
453
|
-
let listeners = [];
|
|
454
|
-
// 获取 Button 按钮事件,赋值到 Form 并删除按钮事件监听
|
|
455
|
-
(0, utils_1.findComponentInTree)(cloneTree, (_comp) => {
|
|
456
|
-
let comp = _comp;
|
|
457
|
-
const { xComponent, xProps } = comp;
|
|
458
|
-
if (xComponent && xComponent.name === 'Button') {
|
|
459
|
-
const target = (0, get_1.default)(xProps, 'listeners[0]');
|
|
460
|
-
if (target && target.trigger && target.trigger === 'click') {
|
|
461
|
-
listeners = xProps.listeners;
|
|
462
|
-
(0, set_1.default)(xProps, 'data.formType', {
|
|
463
|
-
value: 'submit',
|
|
464
|
-
});
|
|
465
|
-
target.trigger = 'submit';
|
|
466
|
-
delete xProps.listeners;
|
|
467
|
-
return true;
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
});
|
|
471
|
-
// @ts-ignore
|
|
472
|
-
pageInstance.componentInstances = {
|
|
473
|
-
[(0, utils_1.getId)()]: {
|
|
474
|
-
xComponent: {
|
|
475
|
-
moduleName: 'gsd-h5-react',
|
|
476
|
-
name: 'Form',
|
|
477
|
-
},
|
|
478
|
-
xProps: {
|
|
479
|
-
data: {
|
|
480
|
-
layout: {
|
|
481
|
-
value: 'horizontal',
|
|
482
|
-
},
|
|
483
|
-
},
|
|
484
|
-
listeners,
|
|
485
|
-
},
|
|
486
|
-
xIndex: 1,
|
|
487
|
-
properties: {
|
|
488
|
-
contentSlot: {
|
|
489
|
-
properties: componentInstances,
|
|
490
|
-
},
|
|
491
|
-
},
|
|
492
|
-
},
|
|
493
|
-
};
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
exports.addFormWrapperComp = addFormWrapperComp;
|
|
497
|
-
function parseGsdKboneTabs(comp) {
|
|
498
|
-
const { xProps, properties } = comp;
|
|
499
|
-
// 有内容说明之前已经转过了,不需要再次转
|
|
500
|
-
if (properties === null || properties === void 0 ? void 0 : properties.content) {
|
|
501
|
-
return;
|
|
502
|
-
}
|
|
503
|
-
if (xProps.listeners) {
|
|
504
|
-
xProps.listeners = xProps.listeners.map((lItem) => {
|
|
505
|
-
// tab change 事件名由 handleTabChange 改为 change
|
|
506
|
-
if (lItem.trigger === 'handleTabChange') {
|
|
507
|
-
lItem.trigger = 'change';
|
|
508
|
-
}
|
|
509
|
-
return lItem;
|
|
510
|
-
});
|
|
511
|
-
}
|
|
512
|
-
let tabItems; // [{key, title, content}]
|
|
513
|
-
if (xProps.data) {
|
|
514
|
-
tabItems = (0, get_1.default)(xProps.data, 'TabItems.value', []);
|
|
515
|
-
// 只保留 activeKey
|
|
516
|
-
Object.keys(xProps.data).forEach((key) => {
|
|
517
|
-
if (key !== 'activeKey')
|
|
518
|
-
delete xProps.data[key];
|
|
519
|
-
});
|
|
520
|
-
}
|
|
521
|
-
if (properties) {
|
|
522
|
-
const newProperties = {};
|
|
523
|
-
Object.values(properties).forEach((pItem, idx) => {
|
|
524
|
-
const tabItem = tabItems[idx];
|
|
525
|
-
if (tabItem) {
|
|
526
|
-
newProperties[(0, utils_1.getId)()] = {
|
|
527
|
-
xComponent: {
|
|
528
|
-
moduleName: utils_2.OFFICIAL_COMPONENT_LIB_NAME,
|
|
529
|
-
name: 'TabPane',
|
|
530
|
-
},
|
|
531
|
-
xProps: {
|
|
532
|
-
data: {
|
|
533
|
-
key: {
|
|
534
|
-
value: tabItem.key,
|
|
535
|
-
},
|
|
536
|
-
tab: {
|
|
537
|
-
value: tabItem.title,
|
|
538
|
-
},
|
|
539
|
-
},
|
|
540
|
-
},
|
|
541
|
-
xIndex: idx,
|
|
542
|
-
properties: {
|
|
543
|
-
content: pItem,
|
|
544
|
-
},
|
|
545
|
-
};
|
|
546
|
-
}
|
|
547
|
-
});
|
|
548
|
-
comp.properties = {
|
|
549
|
-
content: {
|
|
550
|
-
properties: newProperties,
|
|
551
|
-
},
|
|
552
|
-
};
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
exports.parseGsdKboneTabs = parseGsdKboneTabs;
|
|
556
|
-
// 处理组件公共部分
|
|
557
|
-
function parseComplexComponentInstance(instance) {
|
|
558
|
-
const { data, lowCodes = [], componentInstances = {} } = instance;
|
|
559
|
-
const styleLowCode = lowCodes.find((item) => item.name == 'style');
|
|
560
|
-
// 默认样式加.
|
|
561
|
-
if ((styleLowCode === null || styleLowCode === void 0 ? void 0 : styleLowCode.code) && (styleLowCode === null || styleLowCode === void 0 ? void 0 : styleLowCode.code.match(/^&/m)) === null) {
|
|
562
|
-
// 没有添加过的才进行添加
|
|
563
|
-
styleLowCode.code = `&{
|
|
564
|
-
${styleLowCode.code}
|
|
565
|
-
}`;
|
|
566
|
-
}
|
|
567
|
-
const keys = Object.keys(componentInstances);
|
|
568
|
-
if (keys.length > 1) {
|
|
569
|
-
instance.componentInstances = {
|
|
570
|
-
[(0, utils_1.getId)()]: {
|
|
571
|
-
xComponent: {
|
|
572
|
-
moduleName: 'gsd-h5-react',
|
|
573
|
-
name: 'Container',
|
|
574
|
-
},
|
|
575
|
-
xIndex: 0,
|
|
576
|
-
properties: componentInstances,
|
|
577
|
-
},
|
|
578
|
-
};
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
exports.parseComplexComponentInstance = parseComplexComponentInstance;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export declare function init(json: any): void;
|
|
2
|
-
export declare function getId(): string;
|
|
3
|
-
export declare function isComplexComponent(name?: string): string;
|
|
4
|
-
export declare function isGsdH5ReactComponent(name?: string): string;
|
|
5
|
-
export declare function addDefaultSlot(slotKey: string[], comp: any): void;
|
|
6
|
-
export declare function addDefaultData(defaultData: any, comp: any): void;
|
|
7
|
-
export declare function isComplexJSON(json: any): any;
|
|
8
|
-
export declare function getComponentChildren(component: any): [string, unknown][];
|
|
9
|
-
export declare function isWeAppId(key?: string): RegExpMatchArray;
|
|
10
|
-
export declare function isEmptyObject(obj?: {}): boolean;
|
|
11
|
-
export declare function isPlainObject(src: any): boolean;
|
|
12
|
-
export declare function checkIsNeedAddFormWrapper(tree: any): boolean;
|
|
13
|
-
export declare function findComponentInTree(tree: any, cb: (cmp: any, path: string) => any, path?: string): any;
|
|
14
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/parser/cals/utils/version/utils.ts"],"names":[],"mappings":"AAKA,wBAAgB,IAAI,CAAC,IAAI,EAAE,GAAG,QA2B7B;AAED,wBAAgB,KAAK,WAEpB;AAED,wBAAgB,kBAAkB,CAAC,IAAI,SAAK,UAQ3C;AAED,wBAAgB,qBAAqB,CAAC,IAAI,SAAK,UAQ9C;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAO,EAAE,IAAI,EAAE,GAAG,QAO/D;AAED,wBAAgB,cAAc,CAAC,WAAW,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,QAKzD;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,GAAG,OAItC;AAED,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,GAAG,uBASlD;AAED,wBAAgB,SAAS,CAAC,GAAG,SAAK,oBAEjC;AAED,wBAAgB,aAAa,CAAC,GAAG,KAAK,WAErC;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,WAErC;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,GAAG,WAkBlD;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,GAAG,EAAE,IAAI,SAAK,GAAG,GAAG,CAmBlG"}
|