@cloudbase/lowcode-builder 1.8.94 → 1.8.96
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/builder/core/index.d.ts +9 -0
- package/lib/builder/core/index.js +118 -7
- package/lib/builder/h5/generate.d.ts +1 -1
- package/lib/builder/h5/index.d.ts +2 -2
- package/lib/builder/h5/index.js +24 -6
- package/lib/builder/h5/webpack.d.ts +2 -2
- package/lib/builder/mp/BuildContext.d.ts +18 -14
- package/lib/builder/mp/index.d.ts +11 -1
- package/lib/builder/mp/index.js +98 -85
- package/lib/builder/mp/lowcode.d.ts +5 -3
- package/lib/builder/mp/lowcode.js +14 -5
- package/lib/builder/mp/materials.d.ts +10 -5
- package/lib/builder/mp/materials.js +139 -135
- package/lib/builder/mp/util.d.ts +15 -12
- package/lib/builder/mp/util.js +50 -22
- package/lib/builder/mp/wxml.d.ts +5 -3
- package/lib/builder/mp/wxml.js +29 -27
- package/lib/builder/service/webpack.js +0 -1
- package/lib/builder/util/common.d.ts +1 -2
- package/lib/builder/util/common.js +1 -45
- package/lib/builder/util/generateFiles.d.ts +1 -1
- package/lib/builder/util/generateFiles.js +5 -1
- package/lib/builder.web.js +8 -55
- package/package.json +2 -2
- package/template/html/index.html.ejs +7 -3
- package/template/mp/app/weapps-api.js +1 -1
- package/template/mp/app.js +4 -2
- package/template/mp/common/cloud-sdk.js +28 -0
- package/template/mp/common/data-patch.js +18 -3
- package/template/mp/common/util.js +6 -2
- package/template/mp/common/watch.js +1 -1
- package/template/mp/common/weapp-component.js +5 -5
- package/template/mp/common/weapp-page.js +4 -3
- package/template/mp/common/widget.js +51 -38
- package/template/mp/component/index.js +7 -6
- package/template/mp/datasources/index.js.tpl +2 -30
- package/template/mp/package.json +3 -3
- package/template/webpack/web.prod.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/lowcode-builder",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.96",
|
|
4
4
|
"description": "云开发 Tencent CloudBase Framework Low Code Plugin,将低码配置生成完整项目并一键部署云开发资源。",
|
|
5
5
|
"author": "yhsunshining@gmail.com",
|
|
6
6
|
"homepage": "https://github.com/TencentCloudBase/cloudbase-framework#readme",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@babel/core": "7.21.4",
|
|
49
49
|
"@babel/preset-env": "7.21.4",
|
|
50
50
|
"@cloudbase/cals": "^1.0.75",
|
|
51
|
-
"@cloudbase/lowcode-generator": "^1.8.
|
|
51
|
+
"@cloudbase/lowcode-generator": "^1.8.29",
|
|
52
52
|
"axios": "^0.21.0",
|
|
53
53
|
"browserfs": "^1.4.3",
|
|
54
54
|
"browserify-zlib": "^0.2.0",
|
|
@@ -456,7 +456,11 @@
|
|
|
456
456
|
<script type="module" src="/src/index.jsx"></script>
|
|
457
457
|
<% } %> <% if(!isAdminPortal){ %>
|
|
458
458
|
<script src="<%= wedaPrivateConfigEndpoint ? wedaPrivateConfigEndpoint : '' %>/weda-config/weda-private.js"></script>
|
|
459
|
-
<script src="<%= cdnEndpoints.cloudbase %>/cloudbase-js-sdk/2.5.
|
|
459
|
+
<script src="<%= cdnEndpoints.cloudbase %>/cloudbase-js-sdk/2.5.41-beta.0/cloudbase.full.js?v=1"></script>
|
|
460
|
+
<script
|
|
461
|
+
crossorigin
|
|
462
|
+
src="<%= cdnEndpoints.cdngo %>/lcap/lcap-resource-cdngo/-/release/_npm/cloudbase-adapter-privatelink@0.0.1/dist/index.js"
|
|
463
|
+
></script>
|
|
460
464
|
<% }%>
|
|
461
465
|
<script>
|
|
462
466
|
if (window.cloudbase && window._aegis) {
|
|
@@ -516,7 +520,7 @@
|
|
|
516
520
|
crossorigin="anonymous"
|
|
517
521
|
src="<%=
|
|
518
522
|
cdnEndpoints.cdngo
|
|
519
|
-
%>/lcap/lcap-resource-cdngo/-/release/_npm/@cloudbase/weda-cloud-sdk@1.0.
|
|
523
|
+
%>/lcap/lcap-resource-cdngo/-/release/_npm/@cloudbase/weda-cloud-sdk@1.0.61/dist/h5.browser.js"
|
|
520
524
|
></script>
|
|
521
525
|
<script
|
|
522
526
|
crossorigin
|
|
@@ -545,7 +549,7 @@
|
|
|
545
549
|
crossorigin
|
|
546
550
|
src="<%=
|
|
547
551
|
cdnEndpoints.cdngo
|
|
548
|
-
%>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.
|
|
552
|
+
%>/lcap/lcap-resource-cdngo/-/0.1.4/_files/static/weda-render/main.dcb4b774286f577116be.bundle.js"
|
|
549
553
|
></script>
|
|
550
554
|
</body>
|
|
551
555
|
</html>
|
|
@@ -4,7 +4,7 @@ import { createComputed, formatEnum, enumOptions } from '<%= subLevelPath %>../c
|
|
|
4
4
|
import { generateDatasetQuery } from '<%= subLevelPath %>../common/query'
|
|
5
5
|
|
|
6
6
|
import appGlobal from '<%= subLevelPath %>../app/app-global'
|
|
7
|
-
import { createDataset } from '<%= subLevelPath %>../
|
|
7
|
+
import { createDataset } from '<%= subLevelPath %>../common/cloud-sdk'
|
|
8
8
|
|
|
9
9
|
import lodashGet from 'lodash.get';
|
|
10
10
|
import config from '<%= subLevelPath %>../common/config';
|
package/template/mp/app.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
// 必须优先初始化数据源
|
|
2
|
+
import '<%= wedaRootRelativePath %>datasources/index';
|
|
1
3
|
<%= importor.lifecycle? `import lifeCycle from '${wedaRootRelativePath}lowcode/lifecycle'` : "const lifeCycle = {}" %>
|
|
2
|
-
import { app, $app } from '<%= wedaRootRelativePath %>app/weapps-api';
|
|
3
4
|
// 引入数据源管理器并进行初始化
|
|
5
|
+
import { app, $app } from '<%= wedaRootRelativePath %>app/weapps-api';
|
|
4
6
|
import {
|
|
5
7
|
EXTRA_API,
|
|
6
8
|
createStateDataSourceVar,
|
|
7
9
|
generateParamsParser,
|
|
8
|
-
} from '<%= wedaRootRelativePath %>
|
|
10
|
+
} from '<%= wedaRootRelativePath %>common/cloud-sdk'
|
|
9
11
|
|
|
10
12
|
App({
|
|
11
13
|
_query: {},
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { _WEDA_CLOUD_SDK as WEDA_CLOUD_SDK } from '@cloudbase/weda-client'
|
|
2
|
+
const {
|
|
3
|
+
setConfig,
|
|
4
|
+
initTcb,
|
|
5
|
+
CLOUD_SDK,
|
|
6
|
+
createDataset,
|
|
7
|
+
getDatasetProfiles,
|
|
8
|
+
setDatasetProfiles,
|
|
9
|
+
createStateDataSourceVar,
|
|
10
|
+
generateParamsParser,
|
|
11
|
+
EXTRA_API,
|
|
12
|
+
DS_SDK,
|
|
13
|
+
setLocalDatasetState
|
|
14
|
+
} = WEDA_CLOUD_SDK
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
setConfig,
|
|
18
|
+
initTcb,
|
|
19
|
+
createDataset,
|
|
20
|
+
getDatasetProfiles,
|
|
21
|
+
setDatasetProfiles,
|
|
22
|
+
createStateDataSourceVar,
|
|
23
|
+
generateParamsParser,
|
|
24
|
+
EXTRA_API,
|
|
25
|
+
CLOUD_SDK,
|
|
26
|
+
DS_SDK,
|
|
27
|
+
setLocalDatasetState
|
|
28
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { deepEqual } from "./util"
|
|
1
2
|
|
|
2
3
|
export function getDatapatch(base, pendingData) {
|
|
3
4
|
const patch = {}
|
|
@@ -37,9 +38,23 @@ function patchProp(baseWidget, pendingWidget, patch, prefixes) {
|
|
|
37
38
|
if (pendingWidget._waIf === false && baseWidget._waIf === false) {
|
|
38
39
|
return
|
|
39
40
|
}
|
|
40
|
-
const
|
|
41
|
-
//
|
|
42
|
-
|
|
41
|
+
const propSet = new Set([...Object.keys(pendingWidget), ...Object.keys(baseWidget)])
|
|
42
|
+
// 额外剔除公共数据
|
|
43
|
+
propSet.delete('_parentId');
|
|
44
|
+
const allProps = Array.from(propSet);
|
|
45
|
+
// Attention: can not set xxx value to undefined with setData
|
|
46
|
+
let hasUndefined = false;
|
|
47
|
+
const differentProps = allProps.filter(prop => {
|
|
48
|
+
if(pendingWidget[prop] === undefined) {
|
|
49
|
+
hasUndefined = true;
|
|
50
|
+
}
|
|
51
|
+
// container 组件上的属性依赖自身的数据,例如 container.style 依赖 container.data,deepequal 防止死循环
|
|
52
|
+
if (prop === 'data' && typeof pendingWidget[prop] === 'object' && deepEqual(pendingWidget[prop], baseWidget[prop])) {
|
|
53
|
+
return false
|
|
54
|
+
}
|
|
55
|
+
// Attention: since setData will copy data deeply, if property is object, it should be treated as different
|
|
56
|
+
return typeof pendingWidget[prop] === 'object' || pendingWidget[prop] !== baseWidget[prop]
|
|
57
|
+
})
|
|
43
58
|
if (differentProps.length === 1 || differentProps.length <= allProps.length / 3) {
|
|
44
59
|
differentProps.map(patchProp => {
|
|
45
60
|
patch[prefixes + '.' + patchProp] = pendingWidget[patchProp]
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
import { generateForContextOfWidget, generateWidgetAPIContext, getWidget } from './widget';
|
|
4
4
|
import { observable, untracked } from 'mobx';
|
|
5
|
-
import {
|
|
6
|
-
|
|
5
|
+
import { auth } from '@cloudbase/weda-client';
|
|
6
|
+
const { getAccessToken, loginScope } = auth;
|
|
7
7
|
import lodashGet from 'lodash.get';
|
|
8
8
|
import lodashSet from 'lodash.set';
|
|
9
9
|
import { getWedaAPI } from '@cloudbase/weda-client'
|
|
@@ -89,6 +89,7 @@ export function createEventHandlers(
|
|
|
89
89
|
for (const name in evtListeners) {
|
|
90
90
|
const listeners = evtListeners[name];
|
|
91
91
|
evtHandlers[name] = function (event = {}) {
|
|
92
|
+
const { app } = getWedaAPI();
|
|
92
93
|
const self = this;
|
|
93
94
|
const owner = this._getInstance();
|
|
94
95
|
const target = !!event?.target?.id ? getWidget(owner.widgets, event.target.id) : undefined;
|
|
@@ -782,6 +783,7 @@ function replaceStaticResourceAttribute(obj, replacer, paths, index = 0) {
|
|
|
782
783
|
}
|
|
783
784
|
|
|
784
785
|
export function processStaticResourceAttribute(data, replacer, property) {
|
|
786
|
+
const { app } = getWedaAPI();
|
|
785
787
|
const { __internal__ = {} } = app || {};
|
|
786
788
|
const { resolveStaticResourceUrl = (str) => str } = __internal__ || {};
|
|
787
789
|
if (!replacer) {
|
|
@@ -895,6 +897,7 @@ export function patchWdigetPropsWithEvtListeners(widgetProps, evtListeners) {
|
|
|
895
897
|
|
|
896
898
|
|
|
897
899
|
export function reportEvent(tag) {
|
|
900
|
+
const { app } = getWedaAPI()
|
|
898
901
|
try {
|
|
899
902
|
const { envVersion } = app.__internal__?.getConfig?.() || {};
|
|
900
903
|
// console.log('>>>>>>reportevent:', tag);
|
|
@@ -906,6 +909,7 @@ export function reportEvent(tag) {
|
|
|
906
909
|
}
|
|
907
910
|
|
|
908
911
|
export async function getLoginConfig() {
|
|
912
|
+
const { app } = getWedaAPI()
|
|
909
913
|
<% if(loginConfigPathname){ %>
|
|
910
914
|
const { staticResourceDomain, loginConfigVersion, id } = app.__internal__?.getConfig() || {};
|
|
911
915
|
if (staticResourceDomain && loginConfigVersion && id) {
|
|
@@ -5,8 +5,7 @@ import mergeRenderer from './merge-renderer'
|
|
|
5
5
|
import { runWatchers } from './watch'
|
|
6
6
|
import lodashGet from 'lodash.get';
|
|
7
7
|
import { createInitData, createWidget } from './widget';
|
|
8
|
-
import { commonCompBehavior } from '@cloudbase/weda-client';
|
|
9
|
-
import { $w as baseAPI } from '../app/weapps-api'
|
|
8
|
+
import { commonCompBehavior, getWedaAPI } from '@cloudbase/weda-client';
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* Lowcodes of all components
|
|
@@ -54,6 +53,7 @@ export function createComponent(key, behaviors, properties={}, events, handler,
|
|
|
54
53
|
this._pageActive = true
|
|
55
54
|
this._disposers = []
|
|
56
55
|
this._nativeObserver = false
|
|
56
|
+
this._nativeMode = <%= !!nativeMode %>
|
|
57
57
|
},
|
|
58
58
|
attached() {
|
|
59
59
|
const $comp = this._getInstance()
|
|
@@ -134,7 +134,7 @@ export function createComponent(key, behaviors, properties={}, events, handler,
|
|
|
134
134
|
if (!this.$WEAPPS_COMP) {
|
|
135
135
|
let widget = this.$node
|
|
136
136
|
if (!widget) {
|
|
137
|
-
if(this.selectOwnerComponent && !this.selectOwnerComponent?.()) {
|
|
137
|
+
if ((this.selectOwnerComponent && !this.selectOwnerComponent?.()) || this._nativeMode) {
|
|
138
138
|
const widgetValue = {}
|
|
139
139
|
for (const key in properties) {
|
|
140
140
|
if (properties[key]?.value !== undefined) {
|
|
@@ -163,7 +163,7 @@ export function createComponent(key, behaviors, properties={}, events, handler,
|
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
// The component instance for lowcode
|
|
166
|
-
|
|
166
|
+
function create$comp(w) {
|
|
167
167
|
const lowcode = compLowcodes[w.widgetType]
|
|
168
168
|
if (!lowcode) {
|
|
169
169
|
return
|
|
@@ -196,7 +196,7 @@ export function create$comp(w) {
|
|
|
196
196
|
|
|
197
197
|
|
|
198
198
|
$comp.__internal__.$w = new Proxy(
|
|
199
|
-
|
|
199
|
+
getWedaAPI()?.$w || {},
|
|
200
200
|
{
|
|
201
201
|
get(target, prop) {
|
|
202
202
|
if (prop === '$comp') {
|
|
@@ -17,9 +17,9 @@ import {
|
|
|
17
17
|
createStateDataSourceVar,
|
|
18
18
|
generateParamsParser,
|
|
19
19
|
setConfig,
|
|
20
|
-
} from '
|
|
20
|
+
} from './cloud-sdk';
|
|
21
21
|
import { runWatchers, watchAndSyncDatasetState2Local } from './watch';
|
|
22
|
-
import {
|
|
22
|
+
import { getWedaAPI } from '@cloudbase/weda-client';
|
|
23
23
|
import { Event } from './event-emitter';
|
|
24
24
|
import { mergeDynamic2StaticData, patchWdigetPropsWithEvtListeners } from './util';
|
|
25
25
|
import { styleToCss } from './style';
|
|
@@ -82,7 +82,8 @@ function extractLifecycles(ctx, lifecycle, appShareMessage, dataBinds, resetShar
|
|
|
82
82
|
|
|
83
83
|
// 更新设备信息 窗口信息
|
|
84
84
|
result['onResize'] = (res) => {
|
|
85
|
-
|
|
85
|
+
const { $w } = getWedaAPI()
|
|
86
|
+
let device = $w.device;
|
|
86
87
|
if (!device) {
|
|
87
88
|
return;
|
|
88
89
|
}
|
|
@@ -181,7 +181,7 @@ function createSubWidgetTree(
|
|
|
181
181
|
w.id = `${node.id}${indexPostfix}`;
|
|
182
182
|
disposeWidget(existedWidget, true);
|
|
183
183
|
}
|
|
184
|
-
parentForWidgetArr
|
|
184
|
+
parentForWidgetArr[currentIndex || 0] = w;
|
|
185
185
|
setUpWidgetDataBinds(w, dataBinds[node.id], forContext, failedBinds, ownerMpInst._getInstance());
|
|
186
186
|
widgetHolder[node.id] = w;
|
|
187
187
|
if (widgetHolder?.[node._ancestorId]) {
|
|
@@ -198,7 +198,7 @@ function createSubWidgetTree(
|
|
|
198
198
|
widgetHolder[node.id] = existedWidget;
|
|
199
199
|
}
|
|
200
200
|
if (parentForWidgetArr) {
|
|
201
|
-
parentForWidgetArr
|
|
201
|
+
parentForWidgetArr[currentIndex || 0] = widgetHolder[node.id];
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
},
|
|
@@ -324,11 +324,17 @@ function runFor(curForNode, dataBinds, ownerMpInst, forContext, ownerForWidgetHo
|
|
|
324
324
|
}
|
|
325
325
|
});
|
|
326
326
|
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
327
|
+
if (!Object.keys(extraWidgetsIndexMap).length && arr.length === Object.keys(existingWidgetIndexMap).length) {
|
|
328
|
+
/**
|
|
329
|
+
* 数组完全复用,不需要进行修改
|
|
330
|
+
*/
|
|
331
|
+
} else {
|
|
332
|
+
/**
|
|
333
|
+
* 重头开始生成
|
|
334
|
+
* 清空原有 arr 并保持引用不变
|
|
335
|
+
*/
|
|
336
|
+
arr.splice(0, arr.length);
|
|
337
|
+
}
|
|
332
338
|
},
|
|
333
339
|
undefined,
|
|
334
340
|
);
|
|
@@ -345,7 +351,7 @@ function runFor(curForNode, dataBinds, ownerMpInst, forContext, ownerForWidgetHo
|
|
|
345
351
|
// w.parent = null
|
|
346
352
|
}
|
|
347
353
|
|
|
348
|
-
const isInRepeaterChild = parentWidget
|
|
354
|
+
const isInRepeaterChild = isRepeaterWidget(parentWidget, REPEATER.REPEATER_NAME);
|
|
349
355
|
forList.forEach((item, index) => {
|
|
350
356
|
let forContextListAlias;
|
|
351
357
|
let { lists = [], forItems = {} } = forContext;
|
|
@@ -410,38 +416,35 @@ export function createWidget(props, nodeId, indexPostfix, parent, ownerMpInst, f
|
|
|
410
416
|
parent.children.push(w);
|
|
411
417
|
}
|
|
412
418
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
return descendants;
|
|
419
|
+
mountBuiltinWigetsAPI(w, ownerMpInst);
|
|
420
|
+
|
|
421
|
+
if (isRepeaterWidget(w, REPEATER.REPEATER_NAME)) {
|
|
422
|
+
if (!w.items) {
|
|
423
|
+
Object.defineProperty(w, 'items', {
|
|
424
|
+
get() {
|
|
425
|
+
return (w.children || []).map((item) => {
|
|
426
|
+
const descendants = {};
|
|
427
|
+
Object.keys(item?._descendants || {}).forEach((key) => {
|
|
428
|
+
descendants[key] = item._descendants[key]._userWidget;
|
|
424
429
|
});
|
|
425
|
-
|
|
426
|
-
});
|
|
427
|
-
}
|
|
428
|
-
// 默认初始值
|
|
429
|
-
w._disposers.push(
|
|
430
|
-
autorun((r) => {
|
|
431
|
-
const ref = {
|
|
432
|
-
data: w.data,
|
|
433
|
-
items: w.items,
|
|
434
|
-
};
|
|
435
|
-
untracked(() => {
|
|
436
|
-
w._instanceRef.current = ref;
|
|
430
|
+
return descendants;
|
|
437
431
|
});
|
|
438
|
-
}
|
|
439
|
-
);
|
|
440
|
-
break;
|
|
432
|
+
},
|
|
433
|
+
});
|
|
441
434
|
}
|
|
435
|
+
// 默认初始值
|
|
436
|
+
w._disposers.push(
|
|
437
|
+
autorun((r) => {
|
|
438
|
+
const ref = {
|
|
439
|
+
data: w.data,
|
|
440
|
+
items: w.items,
|
|
441
|
+
};
|
|
442
|
+
untracked(() => {
|
|
443
|
+
w._instanceRef.current = ref;
|
|
444
|
+
});
|
|
445
|
+
}),
|
|
446
|
+
);
|
|
442
447
|
}
|
|
443
|
-
|
|
444
|
-
mountBuiltinWigetsAPI(w, ownerMpInst);
|
|
445
448
|
return w;
|
|
446
449
|
}
|
|
447
450
|
|
|
@@ -557,8 +560,8 @@ function createWidgetDataTree(widgets, dataBinds) {
|
|
|
557
560
|
function addForCount(node) {
|
|
558
561
|
if (node.parent) {
|
|
559
562
|
node.forCount = node.parent.forCount;
|
|
560
|
-
const { widgetType } = node.parent.value;
|
|
561
|
-
if (widgetType
|
|
563
|
+
const { widgetType, getConfig } = node.parent.value;
|
|
564
|
+
if (isRepeaterWidget({ widgetType, getConfig }, REPEATER.REPEATER_ITEM_NAME)) {
|
|
562
565
|
node._ancestorId = node.parent.id;
|
|
563
566
|
}
|
|
564
567
|
if (node.parent?._ancestorId) {
|
|
@@ -857,3 +860,13 @@ export function generateWidgetAPIContext($w = {}, widget, forContext) {
|
|
|
857
860
|
},
|
|
858
861
|
});
|
|
859
862
|
}
|
|
863
|
+
|
|
864
|
+
function isRepeaterWidget(
|
|
865
|
+
w /* : { widgetType: string; getConfig: () => { componentType?: string } } */,
|
|
866
|
+
repeaterComponentName /* : string */ /* 'Repeater' | 'RepeaterItem' */,
|
|
867
|
+
) {
|
|
868
|
+
const { componentType } = w?.getConfig?.() || {};
|
|
869
|
+
if (componentType === repeaterComponentName || w?.widgetType === `${REPEATER.MODULE_NAME}:${repeaterComponentName}`) {
|
|
870
|
+
return true;
|
|
871
|
+
}
|
|
872
|
+
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { observable } from 'mobx';
|
|
2
|
-
import { createComponent } from '
|
|
3
|
-
import { concatClassList, px2rpx } from '
|
|
4
|
-
import {
|
|
2
|
+
import { createComponent } from '<%= relativeWedaRoot %>/common/weapp-component'
|
|
3
|
+
import { concatClassList, px2rpx } from '<%= relativeWedaRoot %>/common/style'
|
|
4
|
+
import { getWedaAPI } from '@cloudbase/weda-client'
|
|
5
5
|
<%= importor.lifecycle? "import lifeCycle from './lowcode/lifecycle'" : "const lifeCycle = {}" %>
|
|
6
6
|
<%= importor.state? "import stateFn from './lowcode/state'" : "const stateFn = {}" %>
|
|
7
7
|
<%= importor.computed? "import computedFuncs from './lowcode/computed'" : "const computedFuncs = {}" %>
|
|
8
8
|
<% handlers.forEach(h => {%>
|
|
9
9
|
import _hanlder<%= h %> from './lowcode/handler/<%= h %>' <%}) %>
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
|
|
11
|
+
const app = new Proxy({}, { get: function(obj, prop){ return getWedaAPI()?.app?.[prop] }});
|
|
12
|
+
const $app = new Proxy({}, { get: function(obj, prop){ return app[prop] }});
|
|
12
13
|
|
|
13
14
|
const handlers = {<% handlers.forEach(h => {%>
|
|
14
15
|
<%= h %>: _hanlder<%= h %>, <%}) %>
|
|
@@ -67,4 +68,4 @@ const dataBinds = {<% Object.entries(dataBinds).map(([id, widgetBinds])=>{%>
|
|
|
67
68
|
const config = <%= JSON.stringify(config || {})%>
|
|
68
69
|
|
|
69
70
|
createComponent('<%= key %>', behaviors, properties, events, handlers, dataBinds, evtListeners, widgetProps,
|
|
70
|
-
{}, lifeCycle, stateFn, computedFuncs, config, { const:
|
|
71
|
+
{}, lifeCycle, stateFn, computedFuncs, config, { const: {}, tools: {} }, libCode)
|
|
@@ -1,38 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { auth, getWedaAPI } from '@cloudbase/weda-client'
|
|
2
2
|
import { redirectToLogin, findLoginPage, getAuthConfig, checkAnonymous } from '../common/util';
|
|
3
|
+
import { setConfig, initTcb } from '../common/cloud-sdk';
|
|
3
4
|
|
|
4
|
-
const {
|
|
5
|
-
setConfig,
|
|
6
|
-
initTcb,
|
|
7
|
-
CLOUD_SDK,
|
|
8
|
-
createDataset,
|
|
9
|
-
getDatasetProfiles,
|
|
10
|
-
setDatasetProfiles,
|
|
11
|
-
createStateDataSourceVar,
|
|
12
|
-
generateParamsParser,
|
|
13
|
-
EXTRA_API,
|
|
14
|
-
DS_SDK,
|
|
15
|
-
setLocalDatasetState
|
|
16
|
-
} = WEDA_CLOUD_SDK
|
|
17
5
|
const getAccessToken = auth.getAccessToken
|
|
18
6
|
const loginScope = auth.loginScope
|
|
19
7
|
|
|
20
|
-
export {
|
|
21
|
-
createDataset,
|
|
22
|
-
getDatasetProfiles,
|
|
23
|
-
setDatasetProfiles,
|
|
24
|
-
createStateDataSourceVar,
|
|
25
|
-
generateParamsParser,
|
|
26
|
-
EXTRA_API,
|
|
27
|
-
CLOUD_SDK,
|
|
28
|
-
DS_SDK,
|
|
29
|
-
setConfig,
|
|
30
|
-
getAccessToken,
|
|
31
|
-
loginScope,
|
|
32
|
-
initTcb,
|
|
33
|
-
setLocalDatasetState
|
|
34
|
-
}
|
|
35
|
-
|
|
36
8
|
import { default as config, AEGIS_CONFIG } from './config'
|
|
37
9
|
|
|
38
10
|
setConfig({
|
package/template/mp/package.json
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
"version": "1.0.8",
|
|
4
4
|
"scripts": {},
|
|
5
5
|
"dependencies": {<% if(importJSSDK) {%>
|
|
6
|
-
"@cloudbase/js-sdk": "2.5.
|
|
6
|
+
"@cloudbase/js-sdk": "2.5.41-beta.0",<% } %>
|
|
7
7
|
"@cloudbase/oauth": "0.1.1-alpha.5",
|
|
8
|
-
"@cloudbase/weda-client": "1.0.
|
|
9
|
-
"@cloudbase/weda-cloud-sdk": "1.0.
|
|
8
|
+
"@cloudbase/weda-client": "1.0.31",
|
|
9
|
+
"@cloudbase/weda-cloud-sdk": "1.0.61",
|
|
10
10
|
"mobx": "^5.15.4",
|
|
11
11
|
"lodash.get": "^4.4.2",
|
|
12
12
|
"lodash.set": "^4.3.2",
|
|
@@ -3,7 +3,7 @@ const webpack = require('webpack');
|
|
|
3
3
|
const TerserPlugin = require('terser-webpack-plugin');
|
|
4
4
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
5
5
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
6
|
-
const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');
|
|
6
|
+
// const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');
|
|
7
7
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
8
8
|
const { VueLoaderPlugin } = require('vue-loader');
|
|
9
9
|
const themeVars = require('./themeVars');
|