@cloudbase/framework-plugin-low-code 0.5.13 → 0.5.17-alpha.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/lib/builder/core/material.js +1 -1
- package/lib/builder/service/builder/copy.d.ts +2 -2
- package/lib/builder/service/builder/copy.d.ts.map +1 -1
- package/lib/builder/service/builder/copy.js +15 -4
- package/lib/builder/service/builder/generate.d.ts +8 -9
- package/lib/builder/service/builder/generate.d.ts.map +1 -1
- package/lib/builder/service/builder/generate.js +16 -13
- package/lib/generator/core/generate.d.ts +3 -3
- package/lib/generator/core/generate.d.ts.map +1 -1
- package/lib/generator/core/generate.js +2 -2
- package/lib/generator/core/material.d.ts +2 -2
- package/lib/generator/core/material.d.ts.map +1 -1
- package/lib/generator/core/material.js +3 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +8 -0
- package/lib/weapps-core/types/material.d.ts +5 -0
- package/lib/weapps-core/types/material.d.ts.map +1 -1
- package/package.json +1 -1
- package/template/html/index.html.ejs +4 -4
- package/template/mp/app/weapps-api.js +1 -0
- package/template/mp/common/util.js +7 -1
- package/template/package.json +2 -0
- package/template/src/handlers/FieldMiddleware/renderer.jsx +138 -113
- package/template/src/handlers/render.jsx +67 -30
- package/template/src/handlers/utils/common.js +15 -3
- package/template/src/pages/composite.tpl +4 -2
- package/template/webpack/web.prod.js +54 -37
|
@@ -69,7 +69,7 @@ function handleCompositeComponent({ dependencies, appBuildDir }) {
|
|
|
69
69
|
dependencies.forEach((item) => (materialGroupInfoMap[item.name] = {
|
|
70
70
|
isComposite: item.isComposite,
|
|
71
71
|
version: item.version,
|
|
72
|
-
|
|
72
|
+
entries: item.entries,
|
|
73
73
|
schemaVersion: item.schemaVersion,
|
|
74
74
|
}));
|
|
75
75
|
const componentsMeta = yield util_1.getComponentsInfo(path.join(appBuildDir, 'src'), dependencies);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IMaterialItem, IWebRuntimeAppData } from '../../../weapps-core';
|
|
1
|
+
import { IMaterialItem, IWebRuntimeAppData, IComponentLibEntry } from '../../../weapps-core';
|
|
2
2
|
import { IComponentsInfoMap } from '../../types/common';
|
|
3
3
|
export declare function copyEntryFile(appBuildDir: string, appContent: IWebRuntimeAppData, adminPortalKey: any): Promise<void>;
|
|
4
4
|
export declare function copyMaterialLibraries(dependencies: IMaterialItem[] | undefined, materialsDir: string, appBuildDir: string): Promise<void>;
|
|
@@ -6,7 +6,7 @@ export declare function genCompositeComponentLibraries(dependencies: IMaterialIt
|
|
|
6
6
|
[name: string]: {
|
|
7
7
|
isComposite: boolean;
|
|
8
8
|
version?: string | undefined;
|
|
9
|
-
|
|
9
|
+
entries?: IComponentLibEntry | undefined;
|
|
10
10
|
schemaVersion?: string | undefined;
|
|
11
11
|
isPlainProps?: boolean | undefined;
|
|
12
12
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copy.d.ts","sourceRoot":"","sources":["../../../../src/builder/service/builder/copy.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,aAAa,EACb,kBAAkB,
|
|
1
|
+
{"version":3,"file":"copy.d.ts","sourceRoot":"","sources":["../../../../src/builder/service/builder/copy.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,aAAa,EACb,kBAAkB,EAIlB,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAwB,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAQ9E,wBAAsB,aAAa,CACjC,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,kBAAkB,EAC9B,cAAc,KAAA,iBAef;AAED,wBAAsB,qBAAqB,CACzC,YAAY,6BAAsB,EAClC,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,iBA+DpB;AAED,wBAAsB,8BAA8B,CAClD,YAAY,6BAAsB,EAClC,WAAW,EAAE,MAAM,EACnB,oBAAoB;;qBAEH,OAAO;;;;;;aAMlB,EACN,iBAAiB,EAAE,kBAAkB,iBAmHtC"}
|
|
@@ -54,7 +54,7 @@ function copyMaterialLibraries(dependencies = [], materialsDir, appBuildDir) {
|
|
|
54
54
|
return __awaiter(this, void 0, void 0, function* () {
|
|
55
55
|
const localPkg = util_1.getCurrentPackageJson();
|
|
56
56
|
yield Promise.all(dependencies.map((componentLib) => __awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
var _a;
|
|
57
|
+
var _a, _b, _c, _d, _e;
|
|
58
58
|
const { name, version } = componentLib;
|
|
59
59
|
const materialNameVersion = `${name}@${version}`;
|
|
60
60
|
const materialDir = path_1.default.join(materialsDir, materialNameVersion);
|
|
@@ -85,8 +85,19 @@ function copyMaterialLibraries(dependencies = [], materialsDir, appBuildDir) {
|
|
|
85
85
|
catch (e) { }
|
|
86
86
|
try {
|
|
87
87
|
const packageJson = fs_extra_1.readJsonSync(path_1.default.join(materialDir, 'package.json'));
|
|
88
|
-
if (packageJson.
|
|
89
|
-
|
|
88
|
+
if ((_c = (_b = packageJson.weda) === null || _b === void 0 ? void 0 : _b.platform) === null || _c === void 0 ? void 0 : _c.web) {
|
|
89
|
+
const entries = (_e = (_d = packageJson.weda) === null || _d === void 0 ? void 0 : _d.platform) === null || _e === void 0 ? void 0 : _e.web;
|
|
90
|
+
componentLib['entries'] = {
|
|
91
|
+
entry: path_1.default.posix.relative(srcDir, entries.entry),
|
|
92
|
+
components: path_1.default.posix.relative(srcDir, entries.components),
|
|
93
|
+
actions: path_1.default.posix.relative(srcDir, entries.actions),
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
else if (packageJson.lowcode) {
|
|
97
|
+
const entry = path_1.default.posix.relative(srcDir, packageJson.lowcode);
|
|
98
|
+
componentLib['entries'] = {
|
|
99
|
+
entry,
|
|
100
|
+
};
|
|
90
101
|
}
|
|
91
102
|
}
|
|
92
103
|
catch (e) { }
|
|
@@ -143,7 +154,7 @@ function genCompositeComponentLibraries(dependencies = [], appBuildDir, material
|
|
|
143
154
|
var: lodash_1.default.upperFirst(lodash_1.default.camelCase(`${moduleName}:${name}`)),
|
|
144
155
|
moduleNameVar: lodash_1.default.camelCase(moduleName),
|
|
145
156
|
version: (compLib === null || compLib === void 0 ? void 0 : compLib.version) || '',
|
|
146
|
-
|
|
157
|
+
entries: compLib === null || compLib === void 0 ? void 0 : compLib.entries,
|
|
147
158
|
isPlainProps: isPlainProps,
|
|
148
159
|
});
|
|
149
160
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Schema } from '@formily/react-schema-renderer';
|
|
2
|
-
import { IMaterialItem, IPageInstance, IListenerInstance, IComponentSchemaJson, IPluginInstance, IItemInstance, IWebRuntimeAppData } from '../../../weapps-core';
|
|
2
|
+
import { IMaterialItem, IPageInstance, IListenerInstance, IComponentSchemaJson, IPluginInstance, IItemInstance, IWebRuntimeAppData, IComponentLibEntry } from '../../../weapps-core';
|
|
3
3
|
import { BuildType, IComponentsInfoMap } from '../../types/common';
|
|
4
4
|
import { DEPLOY_MODE } from '../../../types';
|
|
5
5
|
import { IOriginKeyInfo as IBaseOriginKeyInfo } from '../../../generator/core/generate';
|
|
@@ -20,14 +20,12 @@ export declare function getOriginComponentAndActionList(componentSchema: ICompon
|
|
|
20
20
|
originActionList: IOriginKeyInfo[];
|
|
21
21
|
};
|
|
22
22
|
export declare function getOriginPluginList(pluginInstances?: IPluginInstance[], dependencies?: IMaterialItem[], originPluginList?: IOriginKeyInfo[]): IOriginKeyInfo[];
|
|
23
|
-
|
|
23
|
+
interface IFixedDependence extends IMaterialItem {
|
|
24
24
|
isPlainProps?: boolean;
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
export declare function
|
|
28
|
-
|
|
29
|
-
entry?: string;
|
|
30
|
-
})[]): void;
|
|
25
|
+
entries?: IComponentLibEntry;
|
|
26
|
+
}
|
|
27
|
+
export declare function pullActionToListByInstances(listenerInstances: any, originActionList: any, fixedDependencies: IFixedDependence[]): void;
|
|
28
|
+
export declare function pullComponentToListByInstance(sourceKey: string, originComponentList: IOriginKeyInfo[], fixedDependencies: IFixedDependence[]): void;
|
|
31
29
|
export declare function getVirtualFieldsString(components: IOriginKeyInfo[]): string;
|
|
32
30
|
export declare function isSlot(comp: Schema): boolean | "" | undefined;
|
|
33
31
|
export declare function getComponentSchemaString(componentSchema: IComponentSchemaJson, isComposite?: boolean, componentsInfoMap?: IComponentsInfoMap, wrapperClass?: string): {
|
|
@@ -42,7 +40,7 @@ export declare function getComponentImportStringArr(components: IOriginKeyInfo[]
|
|
|
42
40
|
export declare function getEntryImportStringArr(materialInfoList?: {
|
|
43
41
|
materialName: string;
|
|
44
42
|
version: string;
|
|
45
|
-
|
|
43
|
+
entries?: IComponentLibEntry;
|
|
46
44
|
}[], entryImportStringArr?: string[]): string[];
|
|
47
45
|
export declare function getActionImportStringArr(originActionList: IOriginKeyInfo[], actionImportStringArr?: string[]): string[];
|
|
48
46
|
export declare function pushActionToImportStringArr(listenerInstance: IOriginKeyInfo, actionImportStringArr: string[]): void;
|
|
@@ -50,4 +48,5 @@ export declare function generateRouterFile(allAppDataList: IWebRuntimeAppData[],
|
|
|
50
48
|
export declare function writeLowCodeFiles(appData: IWebRuntimeAppData, appBuildDir: string): Promise<void>;
|
|
51
49
|
export declare function writeLowCodeFilesForCompositeComp(compositeGroups: IMaterialItem[], appBuildDir: string): Promise<void>;
|
|
52
50
|
export declare function generateCodeFromTpl(appData: IWebRuntimeAppData, appBuildDir: string, dependencies: IMaterialItem[], appKey: string, rootPath: any, deployMode: DEPLOY_MODE, buildTypeList: BuildType[], extraData: any): Promise<void>;
|
|
51
|
+
export {};
|
|
53
52
|
//# sourceMappingURL=generate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../../src/builder/service/builder/generate.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAGxD,OAAO,EACL,aAAa,EACb,aAAa,EACb,iBAAiB,EAEjB,oBAAoB,EACpB,eAAe,EAEf,aAAa,EAEb,kBAAkB,
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../../src/builder/service/builder/generate.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAGxD,OAAO,EACL,aAAa,EACb,aAAa,EACb,iBAAiB,EAEjB,oBAAoB,EACpB,eAAe,EAEf,aAAa,EAEb,kBAAkB,EAWlB,kBAAkB,EACnB,MAAM,sBAAsB,CAAC;AAgB9B,OAAO,EAGL,SAAS,EACT,kBAAkB,EAEnB,MAAM,oBAAoB,CAAC;AAQ5B,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAGxF,MAAM,WAAW,cAAe,SAAQ,kBAAkB;CAAG;AAE7D,wBAAsB,wBAAwB,CAC5C,cAAc,EAAE,kBAAkB,EAAE,EACpC,WAAW,EAAE,MAAM,iBAwBpB;AAED,wBAAsB,qBAAqB,CACzC,SAAS,oBAAa,EACtB,WAAW,EAAE,MAAM,iBAiBpB;AAED,wBAAsB,sBAAsB,CAC1C,gBAAgB,EAAE,aAAa,EAAE,EACjC,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,YAAY,6BAAsB,EAClC,SAAS;iBACM,OAAO;eACT,GAAG;aAIf,EACD,aAAa,EAAE,GAAG,EAAE,iBAcrB;AAED,wBAAsB,yBAAyB,CAC7C,YAAY,EAAE,aAAa,EAC3B,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,YAAY,6BAAsB,EAClC,SAAS;iBACM,OAAO;eACT,GAAG;aAIf,EACD,aAAa,EAAE,GAAG,EAAE,iBAyGrB;AAED,wBAAgB,+BAA+B,CAC7C,eAAe,EAAE,oBAAoB,EACrC,iBAAiB,EAAE,aAAa,EAAE,EAClC,mB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,kBAAkB,CAAC;CAC9B,EAAO,EACR,oBAAoB,GAAE,MAAM,EAAO,YAepC;AAED,wBAAgB,wBAAwB,CACtC,gBAAgB,EAAE,cAAc,EAAE,EAClC,qBAAqB,GAAE,MAAM,EAAO,YAQrC;AAED,wBAAgB,2BAA2B,CACzC,gBAAgB,EAAE,cAAc,EAChC,qBAAqB,EAAE,MAAM,EAAE,QAqBhC;AAED,wBAAsB,kBAAkB,CACtC,cAAc,EAAE,kBAAkB,EAAE,EACpC,WAAW,EAAE,MAAM,EACnB,QAAQ,SAAK,EACb,aAAa,GAAE,SAAS,EAAO,iBAwChC;AAED,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,kBAAkB,EAC3B,WAAW,EAAE,MAAM,iBAuCpB;AAED,wBAAsB,iCAAiC,CACrD,eAAe,EAAE,aAAa,EAAE,EAChC,WAAW,EAAE,MAAM,iBA6EpB;AAED,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,kBAAkB,EAC3B,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,aAAa,EAAE,EAC7B,MAAM,EAAE,MAAM,EACd,QAAQ,KAAA,EACR,UAAU,EAAE,WAAW,EACvB,aAAa,EAAE,SAAS,EAAE,EAC1B,SAAS,KAAA,iBAkFV"}
|
|
@@ -88,7 +88,7 @@ function generateSinglePageJsxFile(pageInstance, appBuildDir, rootPath, dependen
|
|
|
88
88
|
const info = {
|
|
89
89
|
materialName: component.materialName,
|
|
90
90
|
version: component.materialVersion,
|
|
91
|
-
|
|
91
|
+
entries: component.entries,
|
|
92
92
|
};
|
|
93
93
|
originEntryMap[component.materialName] = info;
|
|
94
94
|
}
|
|
@@ -98,7 +98,7 @@ function generateSinglePageJsxFile(pageInstance, appBuildDir, rootPath, dependen
|
|
|
98
98
|
const info = {
|
|
99
99
|
materialName: action.materialName,
|
|
100
100
|
version: action.materialVersion,
|
|
101
|
-
|
|
101
|
+
entries: action.entries,
|
|
102
102
|
};
|
|
103
103
|
originEntryMap[action.materialName] = info;
|
|
104
104
|
}
|
|
@@ -204,7 +204,7 @@ function pullActionToListByInstances(listenerInstances, originActionList, fixedD
|
|
|
204
204
|
key: actionKey,
|
|
205
205
|
type,
|
|
206
206
|
variableName,
|
|
207
|
-
|
|
207
|
+
entries: material === null || material === void 0 ? void 0 : material.entries,
|
|
208
208
|
});
|
|
209
209
|
}
|
|
210
210
|
});
|
|
@@ -226,7 +226,7 @@ function pullComponentToListByInstance(sourceKey, originComponentList, fixedDepe
|
|
|
226
226
|
key: componentKey,
|
|
227
227
|
variableName: variableName || '',
|
|
228
228
|
isPlainProps: !!(foundOne === null || foundOne === void 0 ? void 0 : foundOne.isPlainProps),
|
|
229
|
-
|
|
229
|
+
entries: foundOne === null || foundOne === void 0 ? void 0 : foundOne.entries,
|
|
230
230
|
});
|
|
231
231
|
}
|
|
232
232
|
}
|
|
@@ -520,9 +520,12 @@ function getPluginImportStringArr(plugins, pluginImportStringArr = []) {
|
|
|
520
520
|
exports.getPluginImportStringArr = getPluginImportStringArr;
|
|
521
521
|
function getComponentImportStringArr(components, componentImportStringArr = []) {
|
|
522
522
|
components.map((component) => __awaiter(this, void 0, void 0, function* () {
|
|
523
|
-
const { name, materialName, materialVersion, variableName,
|
|
523
|
+
const { name, materialName, materialVersion, variableName, entries } = component;
|
|
524
524
|
let importString = '';
|
|
525
|
-
if (
|
|
525
|
+
if (entries === null || entries === void 0 ? void 0 : entries.components) {
|
|
526
|
+
importString = `import { ${name} as ${lodash_1.default.upperFirst(variableName)} } from '${path_1.default.posix.join(`libraries/${materialName}@${materialVersion}`, entries === null || entries === void 0 ? void 0 : entries.components)}'`;
|
|
527
|
+
}
|
|
528
|
+
else if (entries === null || entries === void 0 ? void 0 : entries.entry) {
|
|
526
529
|
const componentsLibVariableName = util_3.camelcase(`${materialName}`);
|
|
527
530
|
importString = `const { ${name}: ${lodash_1.default.upperFirst(variableName)} } = ${componentsLibVariableName}.components`;
|
|
528
531
|
}
|
|
@@ -537,10 +540,10 @@ function getComponentImportStringArr(components, componentImportStringArr = [])
|
|
|
537
540
|
}
|
|
538
541
|
exports.getComponentImportStringArr = getComponentImportStringArr;
|
|
539
542
|
function getEntryImportStringArr(materialInfoList = [], entryImportStringArr = []) {
|
|
540
|
-
materialInfoList.forEach(({ materialName, version,
|
|
541
|
-
if (entry) {
|
|
543
|
+
materialInfoList.forEach(({ materialName, version, entries }) => {
|
|
544
|
+
if (!((entries === null || entries === void 0 ? void 0 : entries.actions) && (entries === null || entries === void 0 ? void 0 : entries.components)) && (entries === null || entries === void 0 ? void 0 : entries.entry)) {
|
|
542
545
|
const componentsLibVariableName = util_3.camelcase(`${materialName}`);
|
|
543
|
-
const importComponentLibString = `import ${componentsLibVariableName} from '${path_1.default.posix.join(`libraries/${materialName}@${version}`, entry)}'`;
|
|
546
|
+
const importComponentLibString = `import ${componentsLibVariableName} from '${path_1.default.posix.join(`libraries/${materialName}@${version}`, entries === null || entries === void 0 ? void 0 : entries.entry)}'`;
|
|
544
547
|
if (!entryImportStringArr.includes(importComponentLibString)) {
|
|
545
548
|
entryImportStringArr.push(importComponentLibString);
|
|
546
549
|
}
|
|
@@ -559,11 +562,11 @@ function getActionImportStringArr(originActionList, actionImportStringArr = [])
|
|
|
559
562
|
}
|
|
560
563
|
exports.getActionImportStringArr = getActionImportStringArr;
|
|
561
564
|
function pushActionToImportStringArr(listenerInstance, actionImportStringArr) {
|
|
562
|
-
const { name, materialName, materialVersion, variableName,
|
|
565
|
+
const { name, materialName, materialVersion, variableName, entries } = listenerInstance;
|
|
563
566
|
const componentsLibVariableName = util_3.camelcase(`${materialName}`);
|
|
564
|
-
const importString =
|
|
565
|
-
? `const { ${name}: ${variableName} } = ${componentsLibVariableName}.actions`
|
|
566
|
-
|
|
567
|
+
const importString = (entries === null || entries === void 0 ? void 0 : entries.actions) ? `import { ${name} as ${variableName} } from '${path_1.default.posix.join(`libraries/${materialName}@${materialVersion}`, entries === null || entries === void 0 ? void 0 : entries.actions)}'`
|
|
568
|
+
: (entries === null || entries === void 0 ? void 0 : entries.entry) ? `const { ${name}: ${variableName} } = ${componentsLibVariableName}.actions`
|
|
569
|
+
: `import ${variableName} from 'libraries/${materialName}@${materialVersion}/actions/${name}'`;
|
|
567
570
|
if (actionImportStringArr.includes(importString)) {
|
|
568
571
|
return;
|
|
569
572
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActionType, IComponentSchemaJson, IListenerInstance, IMaterialItem, IPageInstance, IWebRuntimeAppData, IExtraData, IBuildType, IWeAppComponentInstance } from '../../weapps-core';
|
|
1
|
+
import { ActionType, IComponentSchemaJson, IListenerInstance, IMaterialItem, IPageInstance, IWebRuntimeAppData, IExtraData, IBuildType, IWeAppComponentInstance, IComponentLibEntry } from '../../weapps-core';
|
|
2
2
|
import { IComponentsInfoMap, IFileCodeMap } from '../types/common';
|
|
3
3
|
import { Schema } from '@formily/react-schema-renderer';
|
|
4
4
|
import { DEPLOY_MODE, RUNTIME } from '../../types';
|
|
@@ -31,7 +31,7 @@ export interface IOriginKeyInfo {
|
|
|
31
31
|
type?: ActionType;
|
|
32
32
|
isComposite?: boolean;
|
|
33
33
|
isPlainProps?: boolean;
|
|
34
|
-
|
|
34
|
+
entries?: IComponentLibEntry;
|
|
35
35
|
}
|
|
36
36
|
export declare function generateSinglePageJsxFile(pageInstance: IPageInstance, appBuildDir: string, rootPath: string, dependencies: IMaterialItem[] | undefined, extraData: {
|
|
37
37
|
isComposite: boolean;
|
|
@@ -43,7 +43,7 @@ export declare function getOriginComponentAndActionList(componentSchema: ICompon
|
|
|
43
43
|
};
|
|
44
44
|
export declare function pullActionToListByInstances(listenerInstances: any, originActionList: any, fixedDependencies: (IMaterialItem & {
|
|
45
45
|
isPlainProps?: boolean;
|
|
46
|
-
|
|
46
|
+
entries?: IComponentLibEntry;
|
|
47
47
|
})[]): void;
|
|
48
48
|
export declare function pullComponentToListByInstance(sourceKey: string, originComponentList: IOriginKeyInfo[], fixedDependencies: IMaterialItem[]): void;
|
|
49
49
|
export declare function isSlot(comp: Schema): boolean | "" | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/generator/core/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAGV,oBAAoB,EAEpB,iBAAiB,EACjB,aAAa,EACb,aAAa,EAGb,kBAAkB,EAIlB,UAAU,EACV,UAAU,EACV,uBAAuB,
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/generator/core/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EAGV,oBAAoB,EAEpB,iBAAiB,EACjB,aAAa,EACb,aAAa,EAGb,kBAAkB,EAIlB,UAAU,EACV,UAAU,EACV,uBAAuB,EACvB,kBAAkB,EACnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEL,kBAAkB,EAClB,YAAY,EAEb,MAAM,iBAAiB,CAAC;AAiBzB,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AASxD,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAMnD,wBAAsB,eAAe,CAAC,KAAK,EAAE;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,kBAAkB,CAAC;IAC5B,cAAc,EAAE,kBAAkB,EAAE,CAAC;IACrC,YAAY,EAAE,aAAa,EAAE,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,UAAU,EAAE,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,WAAW,CAAC;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,OAAO,CAAC;IACvB,SAAS,EAAE;QACT,WAAW,EAAE,OAAO,CAAC;QACrB,SAAS,EAAE,GAAG,CAAC;KAChB,CAAC;IACF,UAAU,EAAE,GAAG,CAAC;IAChB,WAAW,EAAE,YAAY,CAAC;IAC1B,SAAS,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B,CACtC,eAAe,EAAE,oBAAoB,EACrC,WAAW,UAAQ,EACnB,iBAAiB,GAAE,kBAAuB,EAC1C,YAAY,CAAC,EAAE,MAAM;;;;EA+KtB;AA+JD,wBAAgB,kBAAkB,CAChC,SAAS,GAAE,iBAAiB,EAAO,EACnC,WAAW,UAAQ,UAQpB;AAED,wBAAsB,kBAAkB,CACtC,cAAc,EAAE,kBAAkB,EAAE,EACpC,WAAW,EAAE,MAAM,EACnB,QAAQ,oBAAK,EACb,WAAW,EAAE,YAAY,EACzB,SAAS,KAAA,iBA0DV;AAED,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,kBAAkB,EAC3B,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,YAAY,EACzB,QAAQ,EAAE,MAAM,iBAmEjB;AAmBD,wBAAsB,mBAAmB,CAIvC,MAAM,EAAE,MAAM,EAId,OAAO,EAAE,kBAAkB,EAC3B,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,UAAU,EACrB,UAAU,EAAE,GAAG,EACf,WAAW,EAAE,YAAY,EACzB,SAAS,EAAE,OAAO,EAClB,cAAc,EAAE,kBAAkB,EAAE,EACpC,aAAa,EAAE,UAAU,EAAE,EAC3B,UAAU,EAAE,WAAW,EAIvB,MAAM,EAAE,MAAM,iBA8Ef"}
|
|
@@ -155,7 +155,7 @@ function pullActionToListByInstances(listenerInstances, originActionList, fixedD
|
|
|
155
155
|
key: actionKey,
|
|
156
156
|
type,
|
|
157
157
|
variableName,
|
|
158
|
-
|
|
158
|
+
entries: material === null || material === void 0 ? void 0 : material.entries,
|
|
159
159
|
});
|
|
160
160
|
}
|
|
161
161
|
});
|
|
@@ -187,7 +187,7 @@ function pullComponentToListByInstance(sourceKey, originComponentList, fixedDepe
|
|
|
187
187
|
key: componentKey,
|
|
188
188
|
variableName: variableName || '',
|
|
189
189
|
isPlainProps,
|
|
190
|
-
|
|
190
|
+
entries: (_b = foundOne) === null || _b === void 0 ? void 0 : _b.entries,
|
|
191
191
|
});
|
|
192
192
|
}
|
|
193
193
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IMaterialItem } from '../../weapps-core';
|
|
1
|
+
import { IComponentLibEntry, IMaterialItem } from '../../weapps-core';
|
|
2
2
|
import { IComponentsInfoMap, IFileCodeMap } from '../types/common';
|
|
3
3
|
export declare function runHandleMaterial(appBuildDir: string, dependencies: IMaterialItem[] | undefined, i18nConfig: any, fileCodeMap: IFileCodeMap, isSandbox: boolean): Promise<void>;
|
|
4
4
|
export declare function writeLowCodeFilesForCompositeComp(compositeGroups: IMaterialItem[], appBuildDir: string, fileMap: any, isSandbox: boolean): Promise<any>;
|
|
@@ -7,7 +7,7 @@ export declare function genCompositeComponentLibraries(dependencies: IMaterialIt
|
|
|
7
7
|
[name: string]: {
|
|
8
8
|
isComposite?: boolean | undefined;
|
|
9
9
|
version?: string | undefined;
|
|
10
|
-
|
|
10
|
+
entries?: IComponentLibEntry | undefined;
|
|
11
11
|
schemaVersion?: string | undefined;
|
|
12
12
|
};
|
|
13
13
|
} | undefined, componentsInfoMap: IComponentsInfoMap, i18nConfig: any, fileMap: any, isSandbox: boolean): Promise<any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"material.d.ts","sourceRoot":"","sources":["../../../src/generator/core/material.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"material.d.ts","sourceRoot":"","sources":["../../../src/generator/core/material.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,kBAAkB,EAElB,aAAa,EAGd,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AASnE,wBAAsB,iBAAiB,CACrC,WAAW,EAAE,MAAM,EACnB,YAAY,6BAAsB,EAClC,UAAU,EAAE,GAAG,EACf,WAAW,EAAE,YAAY,EACzB,SAAS,EAAE,OAAO,iBASnB;AAiDD,wBAAsB,iCAAiC,CACrD,eAAe,EAAE,aAAa,EAAE,EAChC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,GAAG,EACZ,SAAS,EAAE,OAAO,gBAkGnB;AAED,wBAAgB,2BAA2B,CAAC,IAAI,KAAA,QAgB/C;AAED,wBAAsB,8BAA8B,CAClD,YAAY,6BAAsB,EAClC,WAAW,EAAE,MAAM,EACnB,oBAAoB;;;;;;;aAOd,EACN,iBAAiB,EAAE,kBAAkB,EACrC,UAAU,EAAE,GAAG,EACf,OAAO,EAAE,GAAG,EACZ,SAAS,EAAE,OAAO,gBAoHnB"}
|
|
@@ -61,9 +61,10 @@ function handleCompositeComponent({ dependencies, appBuildDir, i18nConfig, fileC
|
|
|
61
61
|
dependencies.forEach((item) => (materialGroupInfoMap[item.name] = {
|
|
62
62
|
isComposite: item.isComposite,
|
|
63
63
|
version: item.version,
|
|
64
|
-
|
|
64
|
+
entries: item.entries,
|
|
65
65
|
schemaVersion: item.schemaVersion,
|
|
66
66
|
}));
|
|
67
|
+
console.log('=====================================*****', materialGroupInfoMap);
|
|
67
68
|
const componentsInfoMap = yield util_1.getComponentsInfo(path.join(appBuildDir, 'src'), dependencies, fileCodeMap);
|
|
68
69
|
yield writeLowCodeFilesForCompositeComp(compositeDependencies, appBuildDir, fileCodeMap, isSandbox);
|
|
69
70
|
yield genCompositeComponentLibraries(compositeDependencies, appBuildDir, materialGroupInfoMap, componentsInfoMap, i18nConfig, fileCodeMap, isSandbox);
|
|
@@ -194,7 +195,7 @@ function genCompositeComponentLibraries(dependencies = [], appBuildDir, material
|
|
|
194
195
|
version: compLib === null || compLib === void 0 ? void 0 : compLib.version,
|
|
195
196
|
isComposite: compLib === null || compLib === void 0 ? void 0 : compLib.isComposite,
|
|
196
197
|
isPlainProps,
|
|
197
|
-
|
|
198
|
+
entries: compLib === null || compLib === void 0 ? void 0 : compLib.entries,
|
|
198
199
|
});
|
|
199
200
|
}
|
|
200
201
|
return value;
|
package/lib/index.d.ts.map
CHANGED
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AAC;IAClC,SAAS,CAAC,OAAO,EAAE,GAAG,EAAE,CAAM;IAC9B,SAAS,CAAC,QAAQ,EAAE,GAAG,CAAC;IACxB,SAAS,CAAC,MAAM,EAAE,GAAG,CAAC;IACtB,SAAS,CAAC,eAAe,EAAE,GAAG,CAAC;gBAEtB,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,gBAAgB,EACrB,MAAM,EAAE,6BAA6B;IA8I9C,QAAQ;IAMR,qBAAqB,CAAC,aAAa,EAAE,cAAc;IAmGnD,eAAe;IAUf,KAAK,CAAC,KAAK,KAAA;IASX,QAAQ,CAAC,KAAK,KAAA;IAWR,IAAI;IAKJ,GAAG;IAKH,MAAM;IAKN,OAAO;IAKP,KAAK;IAkPL,OAAO;IA2FP,MAAM;IAsGN,mBAAmB,CAAC,KAAK,KAAA,EAAE,KAAK,GAAE,OAAe;IAgBjD,eAAe,CAAC,KAAK,KAAA,EAAE,KAAK,GAAE,OAAe;IAqBnD,eAAe,CAAC,OAAO,KAAA;IAIjB,gBAAgB;IA4HhB,2BAA2B;IA6E3B,UAAU;IAwBV,OAAO,CAAC,GAAG,KAAA,EAAE,IAAI,KAAA;IAejB,uBAAuB;IAuCvB,yBAAyB;CA8EhC;AAgCD,eAAO,MAAM,MAAM,sBAAgB,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -111,6 +111,14 @@ class LowCodePlugin extends framework_core_1.Plugin {
|
|
|
111
111
|
if (!this._resolvedInputs.mainAppSerializeData) {
|
|
112
112
|
throw new Error('缺少必须参数: mainAppSerializeData');
|
|
113
113
|
}
|
|
114
|
+
let map = {};
|
|
115
|
+
this._resolvedInputs.dependencies = (this._resolvedInputs.dependencies || []).reduce((list, item) => {
|
|
116
|
+
if (!map[`${item.name}@${item.version}`]) {
|
|
117
|
+
map[`${item.name}@${item.version}`] = true;
|
|
118
|
+
list.push(item);
|
|
119
|
+
}
|
|
120
|
+
return list;
|
|
121
|
+
}, []);
|
|
114
122
|
if (this._checkIsVersion(this._resolvedInputs.calsVersion)) {
|
|
115
123
|
const cals = this._resolvedInputs.mainAppSerializeData;
|
|
116
124
|
if (!this._resolvedInputs.mainAppSerializeData.mpPkgUrl) {
|
|
@@ -30,6 +30,11 @@ export interface IMaterialItem {
|
|
|
30
30
|
meta?: Record<string, any>;
|
|
31
31
|
componentInstances?: IWeAppComponentInstance[];
|
|
32
32
|
}
|
|
33
|
+
export interface IComponentLibEntry {
|
|
34
|
+
entry: string;
|
|
35
|
+
components?: string;
|
|
36
|
+
actions?: string;
|
|
37
|
+
}
|
|
33
38
|
export interface ICompositedComponent {
|
|
34
39
|
id: number;
|
|
35
40
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"material.d.ts","sourceRoot":"","sources":["../../../src/weapps-core/types/material.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE;QACL,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IAEF,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,UAAU,CAAC;IAClB,KAAK,EAAE,UAAU,CAAC;IAClB,GAAG,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CAChC;AAGD,MAAM,WAAW,aAAa;IAC5B,qBAAqB,EAAE,sBAAsB,CAAC;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC5B,UAAU,EAAE,oBAAoB,EAAE,CAAC;IACnC,WAAW,CAAC,EAAE,OAAO,CAAC;IAItB,oBAAo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,CAAC,EAAE,MAAM,CAAC;IAKxB,UAAU,EAAE;QACV,CAAC,aAAa,EAAE,MAAM,GAAG,cAAc,CAAC;KACzC,CAAC;IACF,SAAS,EAAE;QAET,CAAC,aAAa,EAAE,MAAM,GAAG,cAAc,GAAG,cAAc,EAAE,CAAC;KAC5D,CAAC;IACF,SAAS,EAAE;QACT,EAAE,EAAE;YACF,OAAO,CAAC,EAAE,MAAM,CAAC;YACjB,IAAI,CAAC,EAAE,MAAM,CAAC;SACf,CAAC;KACH,CAAC;IACF,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,UAAU,cAAc;IAEtB,WAAW,EAAE,MAAM,CAAC;IAEpB,cAAc,EAAE,MAAM,CAAC;IAEvB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,oBAAoB,sBAAsB,CAAC;AACxD,eAAO,MAAM,eAAe,SAAS,CAAC;AAEtC,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,oBAAoB,UAErE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/framework-plugin-low-code",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.17-alpha.0",
|
|
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",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
});
|
|
23
23
|
<% } else {%>
|
|
24
24
|
const _aegis = new Aegis({
|
|
25
|
-
id: '
|
|
25
|
+
id: 'lXHFsBpTrKcnOMqTRQ', // 项目ID,即上报key
|
|
26
26
|
reportApiSpeed: false, // 接口测速
|
|
27
27
|
reportAssetSpeed: false, // 静态资源测速
|
|
28
28
|
spa: true,
|
|
@@ -440,10 +440,10 @@
|
|
|
440
440
|
}
|
|
441
441
|
</script>
|
|
442
442
|
<script
|
|
443
|
-
src="
|
|
443
|
+
src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/0.1.2/_url/ajax/libs/mobx/5.15.7/mobx.umd.js"
|
|
444
444
|
crossorigin="anonymous"
|
|
445
445
|
></script>
|
|
446
|
-
<script src="
|
|
447
|
-
<script src="
|
|
446
|
+
<script src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/release/_npm/@cloudbase/weda-cloud-sdk@0.3.19/dist/h5.browser.js"></script>
|
|
447
|
+
<script src="https://qbase.cdn-go.cn/lcap/lcap-resource-cdngo/-/0.1.2/_url/npm/@zxing/library@0.18.6/umd/index.min.js"></script>
|
|
448
448
|
</body>
|
|
449
449
|
</html>
|
|
@@ -233,13 +233,18 @@ export function setter(context, path, value = undefined) {
|
|
|
233
233
|
/**
|
|
234
234
|
* 检查页面权限
|
|
235
235
|
**/
|
|
236
|
+
const _AUTH_CACHE_MAP = {}
|
|
236
237
|
export async function checkAuth(app, appId, pageId) {
|
|
238
|
+
const cacheKey = `${appId}-${pageId}`
|
|
239
|
+
if(_AUTH_CACHE_MAP[cacheKey] !== undefined) {
|
|
240
|
+
return _AUTH_CACHE_MAP[cacheKey]
|
|
241
|
+
}
|
|
237
242
|
app.showNavigationBarLoading();
|
|
238
243
|
const checkAuthResult = await app.cloud.callWedaApi({
|
|
239
244
|
action: 'DescribeResourcesPermission',
|
|
240
245
|
data: {
|
|
241
246
|
ResourceType: `<%= isAdminPortal? 'modelApp' : 'app'%>`,
|
|
242
|
-
ResourceIdList: [
|
|
247
|
+
ResourceIdList: [cacheKey],
|
|
243
248
|
},
|
|
244
249
|
});
|
|
245
250
|
let isLogin = false;
|
|
@@ -254,6 +259,7 @@ export async function checkAuth(app, appId, pageId) {
|
|
|
254
259
|
icon: 'error',
|
|
255
260
|
});
|
|
256
261
|
}
|
|
262
|
+
_AUTH_CACHE_MAP[cacheKey] = isLogin
|
|
257
263
|
return isLogin;
|
|
258
264
|
}
|
|
259
265
|
|
package/template/package.json
CHANGED
|
@@ -51,6 +51,8 @@
|
|
|
51
51
|
"mini-css-extract-plugin": "^0.8.0",
|
|
52
52
|
"hard-source-webpack-plugin": "^0.13.1",
|
|
53
53
|
"html-webpack-plugin": "^3.2.0",
|
|
54
|
+
"ts-loader": "^8.3.0",
|
|
55
|
+
"typescript": "^4.4.4",
|
|
54
56
|
"webpack": "^4.41.4",
|
|
55
57
|
"webpack-cli": "^4.2.0",
|
|
56
58
|
"webpack-dev-server": "^3.11.0"
|
|
@@ -10,7 +10,106 @@ import { checkVisible } from '../../utils/index';
|
|
|
10
10
|
|
|
11
11
|
export const ForContext = createContext({});
|
|
12
12
|
|
|
13
|
-
export
|
|
13
|
+
export function getForList(dataBinds, parentForItems) {
|
|
14
|
+
// For循环渲染
|
|
15
|
+
let forList;
|
|
16
|
+
try {
|
|
17
|
+
// 绑定了 for 变量,但计算值错误时,应当空数组兜底
|
|
18
|
+
forList =
|
|
19
|
+
dataBinds && dataBinds._waFor && (dataBinds._waFor(parentForItems) || []);
|
|
20
|
+
} catch (e) {
|
|
21
|
+
// 计算值出错则使用空数组兜底
|
|
22
|
+
forList = [];
|
|
23
|
+
console.warn('_waFor data', e);
|
|
24
|
+
}
|
|
25
|
+
if (forList && !Array.isArray(forList)) {
|
|
26
|
+
console.warn(`${compId}循环绑定非数组值:`, forList);
|
|
27
|
+
forList = [];
|
|
28
|
+
}
|
|
29
|
+
return forList;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function getSafeComponentProps({
|
|
33
|
+
style,
|
|
34
|
+
classNameList,
|
|
35
|
+
staticResourceAttribute,
|
|
36
|
+
}) {
|
|
37
|
+
const componentProps = {};
|
|
38
|
+
if (classNameList.length) {
|
|
39
|
+
componentProps.className = classNameList.join(' ');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (style && Object.keys(style).length) {
|
|
43
|
+
componentProps.style = style;
|
|
44
|
+
}
|
|
45
|
+
if (staticResourceAttribute && staticResourceAttribute.length > 0) {
|
|
46
|
+
componentProps.staticResourceAttribute = staticResourceAttribute;
|
|
47
|
+
}
|
|
48
|
+
return componentProps;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// TODO: 需要不断移除 dataBinds(style/classList)
|
|
52
|
+
function getBindData({
|
|
53
|
+
forItems,
|
|
54
|
+
scopeContext,
|
|
55
|
+
wData,
|
|
56
|
+
commonStyle,
|
|
57
|
+
isInComposite,
|
|
58
|
+
codeContext,
|
|
59
|
+
classNameList,
|
|
60
|
+
}) {
|
|
61
|
+
// bindData
|
|
62
|
+
if (Array.isArray(wData)) {
|
|
63
|
+
wData =
|
|
64
|
+
forItems.forIndexes === void 0 || wData.length === 0
|
|
65
|
+
? {}
|
|
66
|
+
: get(wData, getForIndexes(forItems, wData));
|
|
67
|
+
}
|
|
68
|
+
wData = wData || {};
|
|
69
|
+
const fieldData = { ...wData };
|
|
70
|
+
|
|
71
|
+
// 再次计算 scope value
|
|
72
|
+
for (let key in fieldData) {
|
|
73
|
+
if (Object.prototype.hasOwnProperty.call(fieldData, key)) {
|
|
74
|
+
const value = fieldData[key];
|
|
75
|
+
if (value && value.__type === 'scopedValue') {
|
|
76
|
+
try {
|
|
77
|
+
fieldData[key] = value.getValue(scopeContext);
|
|
78
|
+
} catch (e) {
|
|
79
|
+
console.warn(`Error computing data bind '${key}' error:`, e);
|
|
80
|
+
fieldData[key] = '';
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// bindStyle
|
|
87
|
+
let bindStyle = fieldData.style || {};
|
|
88
|
+
// 复合组件第一层需要将最外层样式 style 挂到节点上
|
|
89
|
+
let cssStyle = commonStyle;
|
|
90
|
+
if (isInComposite && wData && !wData.parent) {
|
|
91
|
+
cssStyle = {
|
|
92
|
+
...cssStyle,
|
|
93
|
+
...(codeContext.$WEAPPS_COMP.props?.style || {}),
|
|
94
|
+
};
|
|
95
|
+
bindStyle = {
|
|
96
|
+
...bindStyle,
|
|
97
|
+
...(codeContext.$WEAPPS_COMP.props?.style || {}),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
const finalStyle = getFinalStyle(cssStyle, bindStyle);
|
|
101
|
+
|
|
102
|
+
// bindClassList
|
|
103
|
+
const bindClassList = fieldData.classList || [];
|
|
104
|
+
const finalClassNameList = getFinalClassNameList(
|
|
105
|
+
classNameList,
|
|
106
|
+
bindClassList
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
return { fieldData, finalStyle, finalClassNameList };
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export const getRenderList = function (props) {
|
|
14
113
|
const {
|
|
15
114
|
id: compId,
|
|
16
115
|
xProps,
|
|
@@ -27,24 +126,7 @@ export const CompRenderer = observer(function (props) {
|
|
|
27
126
|
? $page.widgets[compId]
|
|
28
127
|
: codeContext.$WEAPPS_COMP.widgets[compId];
|
|
29
128
|
|
|
30
|
-
if (!xProps) {
|
|
31
|
-
return props.children;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const {
|
|
35
|
-
commonStyle = {},
|
|
36
|
-
sourceKey,
|
|
37
|
-
data = {},
|
|
38
|
-
dataBinds,
|
|
39
|
-
listenerInstances,
|
|
40
|
-
styleBind,
|
|
41
|
-
classNameList = [],
|
|
42
|
-
classNameListBind,
|
|
43
|
-
staticResourceAttribute = [],
|
|
44
|
-
} = xProps;
|
|
45
|
-
const Field = virtualFields[sourceKey];
|
|
46
129
|
const parentForItems = useContext(ForContext);
|
|
47
|
-
|
|
48
130
|
const emit = useCallback(
|
|
49
131
|
(trigger, event, forItems, scopeContext) => {
|
|
50
132
|
const listeners = listenerInstances;
|
|
@@ -67,41 +149,23 @@ export const CompRenderer = observer(function (props) {
|
|
|
67
149
|
[props]
|
|
68
150
|
);
|
|
69
151
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
classNameList,
|
|
73
|
-
staticResourceAttribute,
|
|
74
|
-
}) {
|
|
75
|
-
const componentProps = {};
|
|
76
|
-
if (classNameList.length) {
|
|
77
|
-
componentProps.className = classNameList.join(' ');
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
if (style && Object.keys(style).length) {
|
|
81
|
-
componentProps.style = style;
|
|
82
|
-
}
|
|
83
|
-
if (staticResourceAttribute && staticResourceAttribute.length > 0) {
|
|
84
|
-
componentProps.staticResourceAttribute = staticResourceAttribute;
|
|
85
|
-
}
|
|
86
|
-
return componentProps;
|
|
152
|
+
if (!xProps) {
|
|
153
|
+
return props.children;
|
|
87
154
|
}
|
|
88
155
|
|
|
156
|
+
const {
|
|
157
|
+
commonStyle = {},
|
|
158
|
+
sourceKey,
|
|
159
|
+
dataBinds,
|
|
160
|
+
classNameList = [],
|
|
161
|
+
staticResourceAttribute = [],
|
|
162
|
+
listenerInstances,
|
|
163
|
+
} = xProps;
|
|
164
|
+
const Field = virtualFields[sourceKey];
|
|
165
|
+
|
|
89
166
|
// For循环渲染
|
|
90
|
-
let forList;
|
|
91
|
-
try {
|
|
92
|
-
// 绑定了 for 变量,但计算值错误时,应当空数组兜底
|
|
93
|
-
forList =
|
|
94
|
-
dataBinds && dataBinds._waFor && (dataBinds._waFor(parentForItems) || []);
|
|
95
|
-
} catch (e) {
|
|
96
|
-
// 计算值出错则使用空数组兜底
|
|
97
|
-
forList = [];
|
|
98
|
-
console.warn('_waFor data', e);
|
|
99
|
-
}
|
|
167
|
+
let forList = getForList(dataBinds, parentForItems);
|
|
100
168
|
if (forList) {
|
|
101
|
-
if (!Array.isArray(forList)) {
|
|
102
|
-
console.warn(`${compId}循环绑定非数组值:`, forList);
|
|
103
|
-
forList = [];
|
|
104
|
-
}
|
|
105
169
|
return forList.map((item, index) => {
|
|
106
170
|
const forItemsIndexes = (parentForItems.forIndexes || []).concat(index);
|
|
107
171
|
const forItems = {
|
|
@@ -113,7 +177,15 @@ export const CompRenderer = observer(function (props) {
|
|
|
113
177
|
fieldData: forItemData,
|
|
114
178
|
finalStyle: forItemStyle,
|
|
115
179
|
finalClassNameList: forItemClassNameList,
|
|
116
|
-
} = getBindData(
|
|
180
|
+
} = getBindData({
|
|
181
|
+
forItems,
|
|
182
|
+
scopeContext,
|
|
183
|
+
wData: widgetsData,
|
|
184
|
+
classNameList,
|
|
185
|
+
commonStyle,
|
|
186
|
+
isInComposite,
|
|
187
|
+
codeContext,
|
|
188
|
+
});
|
|
117
189
|
if (!checkVisible(forItemData)) {
|
|
118
190
|
return null;
|
|
119
191
|
}
|
|
@@ -157,16 +229,19 @@ export const CompRenderer = observer(function (props) {
|
|
|
157
229
|
}
|
|
158
230
|
|
|
159
231
|
// 单节点渲染
|
|
160
|
-
const { fieldData, finalClassNameList, finalStyle } = getBindData(
|
|
232
|
+
const { fieldData, finalClassNameList, finalStyle } = getBindData({
|
|
161
233
|
parentForItems,
|
|
162
|
-
scopeContext
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
234
|
+
scopeContext,
|
|
235
|
+
wData: widgetsData,
|
|
236
|
+
classNameList,
|
|
237
|
+
commonStyle,
|
|
238
|
+
isInComposite,
|
|
239
|
+
codeContext,
|
|
240
|
+
});
|
|
166
241
|
|
|
167
242
|
// false 或空字符串时
|
|
168
243
|
if (!checkVisible(fieldData)) {
|
|
169
|
-
return
|
|
244
|
+
return [];
|
|
170
245
|
}
|
|
171
246
|
|
|
172
247
|
// 单个组件的 slot 属性
|
|
@@ -191,12 +266,12 @@ export const CompRenderer = observer(function (props) {
|
|
|
191
266
|
classNameList: finalClassNameList,
|
|
192
267
|
staticResourceAttribute,
|
|
193
268
|
});
|
|
194
|
-
return
|
|
269
|
+
return [
|
|
195
270
|
<Field
|
|
196
271
|
data={fieldData}
|
|
197
272
|
id={compId}
|
|
198
273
|
{...componentProps}
|
|
199
|
-
emit={
|
|
274
|
+
emit={(trigger, evt) => emit(trigger, evt, parentForItems, scopeContext)}
|
|
200
275
|
events={emitEvents}
|
|
201
276
|
compositeParent={codeContext}
|
|
202
277
|
forIndexes={forIndexes}
|
|
@@ -204,62 +279,12 @@ export const CompRenderer = observer(function (props) {
|
|
|
204
279
|
domRef={domRef}
|
|
205
280
|
>
|
|
206
281
|
{props.children}
|
|
207
|
-
</Field
|
|
208
|
-
|
|
282
|
+
</Field>,
|
|
283
|
+
];
|
|
284
|
+
};
|
|
209
285
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
// bindData
|
|
213
|
-
let wData = widgetsData;
|
|
214
|
-
if (Array.isArray(wData)) {
|
|
215
|
-
wData =
|
|
216
|
-
forItems.forIndexes === void 0 || wData.length === 0
|
|
217
|
-
? {}
|
|
218
|
-
: get(wData, getForIndexes(forItems, wData));
|
|
219
|
-
}
|
|
220
|
-
wData = wData || {};
|
|
221
|
-
const fieldData = { ...wData };
|
|
222
|
-
|
|
223
|
-
// 再次计算 scope value
|
|
224
|
-
for (let key in fieldData) {
|
|
225
|
-
if (Object.prototype.hasOwnProperty.call(fieldData, key)) {
|
|
226
|
-
const value = fieldData[key];
|
|
227
|
-
if (value && value.__type === 'scopedValue') {
|
|
228
|
-
try {
|
|
229
|
-
fieldData[key] = value.getValue(scopeContext);
|
|
230
|
-
} catch (e) {
|
|
231
|
-
console.warn(`Error computing data bind '${key}' error:`, e);
|
|
232
|
-
fieldData[key] = '';
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
// bindStyle
|
|
239
|
-
let bindStyle = fieldData.style || {};
|
|
240
|
-
// 复合组件第一层需要将最外层样式 style 挂到节点上
|
|
241
|
-
let cssStyle = commonStyle;
|
|
242
|
-
if (isInComposite && wData && !wData.parent) {
|
|
243
|
-
cssStyle = {
|
|
244
|
-
...cssStyle,
|
|
245
|
-
...(codeContext.$WEAPPS_COMP.props?.style || {}),
|
|
246
|
-
};
|
|
247
|
-
bindStyle = {
|
|
248
|
-
...bindStyle,
|
|
249
|
-
...(codeContext.$WEAPPS_COMP.props?.style || {}),
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
const finalStyle = getFinalStyle(cssStyle, bindStyle);
|
|
253
|
-
|
|
254
|
-
// bindClassList
|
|
255
|
-
const bindClassList = fieldData.classList || [];
|
|
256
|
-
const finalClassNameList = getFinalClassNameList(
|
|
257
|
-
classNameList,
|
|
258
|
-
bindClassList
|
|
259
|
-
);
|
|
260
|
-
|
|
261
|
-
return { fieldData, finalStyle, finalClassNameList };
|
|
262
|
-
}
|
|
286
|
+
export const CompRenderer = observer(function (props) {
|
|
287
|
+
return getRenderList(props);
|
|
263
288
|
});
|
|
264
289
|
|
|
265
290
|
export function getFinalStyle(
|
|
@@ -1,20 +1,46 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useRef } from 'react';
|
|
3
3
|
import * as _ from 'lodash';
|
|
4
|
-
import {
|
|
4
|
+
import { getRenderList as getComponentRenderList } from './FieldMiddleware/renderer';
|
|
5
5
|
import { isScopeSlot } from '../utils/index';
|
|
6
|
+
import { observer } from 'mobx-react-lite';
|
|
6
7
|
|
|
7
|
-
function
|
|
8
|
+
function checkDoNotRenderSlot(isSlot, renderSlot, rootNode) {
|
|
9
|
+
return isSlot && !(renderSlot || rootNode);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function getComponentChildren(
|
|
13
|
+
component,
|
|
14
|
+
{ virtualFields, codeContext, scopeContext }
|
|
15
|
+
) {
|
|
8
16
|
const { properties } = component;
|
|
9
17
|
if (!properties) {
|
|
10
18
|
return [];
|
|
11
19
|
}
|
|
12
|
-
|
|
20
|
+
let list = Object.values(properties).sort(
|
|
13
21
|
(a, b) => (a['x-index'] || 0) - (b['x-index'] || 0)
|
|
14
22
|
);
|
|
23
|
+
|
|
24
|
+
const componentChildren = [];
|
|
25
|
+
const rootNode = false;
|
|
26
|
+
const renderSlot = false;
|
|
27
|
+
for (const schema of list) {
|
|
28
|
+
const children = getRenderList({
|
|
29
|
+
key: schema.key,
|
|
30
|
+
componentSchema: schema,
|
|
31
|
+
rootNode,
|
|
32
|
+
renderSlot,
|
|
33
|
+
virtualFields,
|
|
34
|
+
codeContext,
|
|
35
|
+
scopeContext,
|
|
36
|
+
});
|
|
37
|
+
componentChildren.push(children);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return componentChildren;
|
|
15
41
|
}
|
|
16
42
|
|
|
17
|
-
|
|
43
|
+
function getRenderList(props) {
|
|
18
44
|
const {
|
|
19
45
|
className,
|
|
20
46
|
virtualFields,
|
|
@@ -24,12 +50,11 @@ export function AppRender(props) {
|
|
|
24
50
|
codeContext,
|
|
25
51
|
scopeContext = {},
|
|
26
52
|
} = props;
|
|
27
|
-
|
|
28
53
|
const { 'x-props': xProps, properties = {} } = componentSchema;
|
|
29
54
|
|
|
30
55
|
// 判断是否为 slot
|
|
31
56
|
const isSlot = !xProps;
|
|
32
|
-
if (isSlot
|
|
57
|
+
if (checkDoNotRenderSlot(isSlot, renderSlot, rootNode)) {
|
|
33
58
|
return null;
|
|
34
59
|
}
|
|
35
60
|
|
|
@@ -67,7 +92,6 @@ export function AppRender(props) {
|
|
|
67
92
|
}
|
|
68
93
|
}
|
|
69
94
|
|
|
70
|
-
const children = getComponentChildren(componentSchema);
|
|
71
95
|
const slots = {};
|
|
72
96
|
// eslint-disable-next-line guard-for-in
|
|
73
97
|
for (const key in properties) {
|
|
@@ -105,27 +129,40 @@ export function AppRender(props) {
|
|
|
105
129
|
}
|
|
106
130
|
}
|
|
107
131
|
|
|
108
|
-
return (
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
132
|
+
// return (
|
|
133
|
+
// <CompRenderer
|
|
134
|
+
// id={componentSchema.key}
|
|
135
|
+
// xProps={xProps}
|
|
136
|
+
// emitEvents={componentSchema.emitEvents || []}
|
|
137
|
+
// virtualFields={virtualFields}
|
|
138
|
+
// slots={slots}
|
|
139
|
+
// codeContext={codeContext}
|
|
140
|
+
// scopeContext={scopeContext}
|
|
141
|
+
// >
|
|
142
|
+
// {getComponentChildren(componentSchema, {
|
|
143
|
+
// virtualFields,
|
|
144
|
+
// codeContext,
|
|
145
|
+
// scopeContext,
|
|
146
|
+
// })}
|
|
147
|
+
// </CompRenderer>
|
|
148
|
+
// );
|
|
149
|
+
|
|
150
|
+
return getComponentRenderList({
|
|
151
|
+
id: componentSchema.key,
|
|
152
|
+
xProps,
|
|
153
|
+
emitEvents: componentSchema.emitEvents || [],
|
|
154
|
+
virtualFields,
|
|
155
|
+
slots,
|
|
156
|
+
codeContext,
|
|
157
|
+
scopeContext,
|
|
158
|
+
children: getComponentChildren(componentSchema, {
|
|
159
|
+
virtualFields,
|
|
160
|
+
codeContext,
|
|
161
|
+
scopeContext,
|
|
162
|
+
}),
|
|
163
|
+
});
|
|
131
164
|
}
|
|
165
|
+
|
|
166
|
+
export const AppRender = observer(function (props) {
|
|
167
|
+
return getRenderList(props);
|
|
168
|
+
});
|
|
@@ -127,14 +127,19 @@ export function getStaticResourceAttribute(staticUrl) {
|
|
|
127
127
|
/**
|
|
128
128
|
* 检查页面权限
|
|
129
129
|
**/
|
|
130
|
+
const _AUTH_CACHE_MAP = {}
|
|
130
131
|
export async function checkAuth(app, appId, pageId) {
|
|
131
132
|
<% if(isAdminPortal){ %>return true;<% } %>
|
|
133
|
+
const cacheKey = `${appId}-${pageId}`
|
|
134
|
+
if(_AUTH_CACHE_MAP[cacheKey] !== undefined) {
|
|
135
|
+
return _AUTH_CACHE_MAP[cacheKey]
|
|
136
|
+
}
|
|
132
137
|
app.showNavigationBarLoading();
|
|
133
138
|
const checkAuthResult = await app.cloud.callWedaApi({
|
|
134
139
|
action: 'DescribeResourcesPermission',
|
|
135
140
|
data: {
|
|
136
141
|
ResourceType: `<%= isAdminPortal? 'modelApp' : 'app'%>`,
|
|
137
|
-
ResourceIdList: [
|
|
142
|
+
ResourceIdList: [cacheKey],
|
|
138
143
|
},
|
|
139
144
|
});
|
|
140
145
|
let isLogin = false;
|
|
@@ -149,6 +154,7 @@ export async function checkAuth(app, appId, pageId) {
|
|
|
149
154
|
icon: 'error',
|
|
150
155
|
});
|
|
151
156
|
}
|
|
157
|
+
_AUTH_CACHE_MAP[cacheKey] = isLogin
|
|
152
158
|
return isLogin;
|
|
153
159
|
}
|
|
154
160
|
|
|
@@ -157,10 +163,16 @@ export function reportTime(tag, time, only=false){
|
|
|
157
163
|
if(!window._aegis || !tag){
|
|
158
164
|
return;
|
|
159
165
|
}
|
|
160
|
-
if(
|
|
166
|
+
if(window['_WedaHostConfig'] && !window['_WedaHostConfig']['_REPORTED']) {
|
|
167
|
+
window['_WedaHostConfig']['_REPORTED'] = _REPORTED
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const CACHE_MAP = window['_WedaHostConfig']?.['_REPORTED'] || _REPORTED
|
|
171
|
+
|
|
172
|
+
if(only && CACHE_MAP[tag]){
|
|
161
173
|
return ;
|
|
162
174
|
}
|
|
163
|
-
|
|
175
|
+
CACHE_MAP[tag] = true
|
|
164
176
|
try {
|
|
165
177
|
let t = time === undefined? (performance?.now?.() || Date.now() - window['_aegis_inited']) :time;
|
|
166
178
|
window._aegis.reportTime({
|
|
@@ -17,8 +17,10 @@ import handler$<%= handler.name %> from "./lowcode/handler/<%= handler.name %>.j
|
|
|
17
17
|
|
|
18
18
|
// Import Components
|
|
19
19
|
<% var componentsMap = {}; useComponents.forEach(compItem => {%>
|
|
20
|
-
<% if(compItem.
|
|
21
|
-
import <%= compItem.
|
|
20
|
+
<% if(compItem.entries && compItem.entries.components){ %>
|
|
21
|
+
import { <%= compItem.name %> as <%= compItem.var %> } from "libraries/<%= compItem.moduleName %>@<%= compItem.version %>/<%= compItem.entries.components %>";
|
|
22
|
+
<% } else if(compItem.entries && compItem.entries.entry){ %><% if(!componentsMap[compItem.moduleName]){ componentsMap[compItem.moduleName] = true %>
|
|
23
|
+
import <%= compItem.moduleNameVar %> from "libraries/<%= compItem.moduleName %>@<%= compItem.version %>/<%= compItem.entries.entry %>";
|
|
22
24
|
<% } %>const { <%= compItem.name %>: <%= compItem.var %> } = <%= compItem.moduleNameVar %>.components
|
|
23
25
|
<% } else { %>import <%= compItem.var %> from "libraries/<%= compItem.moduleName %>@<%= compItem.version %>/components/<%= compItem.name %>";<% } %>
|
|
24
26
|
<%}) %>
|
|
@@ -10,6 +10,7 @@ const HappyPack = require('happypack');
|
|
|
10
10
|
const core = 4;
|
|
11
11
|
const happyThreadPool = HappyPack.ThreadPool({ size: core });
|
|
12
12
|
|
|
13
|
+
const TS_LOADER_ID = 'ts-loader';
|
|
13
14
|
module.exports = function (options) {
|
|
14
15
|
const {
|
|
15
16
|
context,
|
|
@@ -26,52 +27,63 @@ module.exports = function (options) {
|
|
|
26
27
|
definePlugin = {},
|
|
27
28
|
} = options;
|
|
28
29
|
const isDevelopment = mode !== 'production';
|
|
30
|
+
const babelLoader = {
|
|
31
|
+
loader: 'babel-loader',
|
|
32
|
+
options: {
|
|
33
|
+
compact: false,
|
|
34
|
+
cacheDirectory: true,
|
|
35
|
+
cwd: context,
|
|
36
|
+
presets: [
|
|
37
|
+
[
|
|
38
|
+
'@babel/preset-env',
|
|
39
|
+
{
|
|
40
|
+
modules: false,
|
|
41
|
+
targets: {
|
|
42
|
+
esmodules: true,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
'@babel/preset-react',
|
|
47
|
+
],
|
|
48
|
+
plugins: [
|
|
49
|
+
[
|
|
50
|
+
'babel-plugin-import',
|
|
51
|
+
{
|
|
52
|
+
libraryName: '@govcloud/gsd-kbone-react',
|
|
53
|
+
libraryDirectory: 'lib/components',
|
|
54
|
+
camel2DashComponentName: false,
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
'@babel/plugin-proposal-class-properties',
|
|
58
|
+
['@babel/plugin-proposal-decorators', { legacy: true }],
|
|
59
|
+
'@babel/plugin-proposal-export-default-from',
|
|
60
|
+
'@babel/plugin-proposal-export-namespace-from',
|
|
61
|
+
'@babel/plugin-proposal-optional-chaining',
|
|
62
|
+
'@babel/plugin-proposal-partial-application',
|
|
63
|
+
['@babel/plugin-proposal-pipeline-operator', { proposal: 'minimal' }],
|
|
64
|
+
].filter(Boolean),
|
|
65
|
+
},
|
|
66
|
+
};
|
|
29
67
|
let plugins = [
|
|
30
68
|
new HappyPack({
|
|
31
|
-
id:
|
|
69
|
+
id: TS_LOADER_ID,
|
|
32
70
|
loaders: [
|
|
71
|
+
babelLoader,
|
|
33
72
|
{
|
|
34
|
-
loader: '
|
|
73
|
+
loader: 'ts-loader',
|
|
35
74
|
options: {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
cwd: context,
|
|
39
|
-
presets: [
|
|
40
|
-
[
|
|
41
|
-
'@babel/preset-env',
|
|
42
|
-
{
|
|
43
|
-
targets: {
|
|
44
|
-
esmodules: true,
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
|
-
'@babel/preset-react',
|
|
49
|
-
],
|
|
50
|
-
plugins: [
|
|
51
|
-
[
|
|
52
|
-
'babel-plugin-import',
|
|
53
|
-
{
|
|
54
|
-
libraryName: '@govcloud/gsd-kbone-react',
|
|
55
|
-
libraryDirectory: 'lib/components',
|
|
56
|
-
camel2DashComponentName: false,
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
|
-
'@babel/plugin-proposal-class-properties',
|
|
60
|
-
['@babel/plugin-proposal-decorators', { legacy: true }],
|
|
61
|
-
'@babel/plugin-proposal-export-default-from',
|
|
62
|
-
'@babel/plugin-proposal-export-namespace-from',
|
|
63
|
-
'@babel/plugin-proposal-optional-chaining',
|
|
64
|
-
'@babel/plugin-proposal-partial-application',
|
|
65
|
-
[
|
|
66
|
-
'@babel/plugin-proposal-pipeline-operator',
|
|
67
|
-
{ proposal: 'minimal' },
|
|
68
|
-
],
|
|
69
|
-
].filter(Boolean),
|
|
75
|
+
happyPackMode: true,
|
|
76
|
+
transpileOnly: true,
|
|
70
77
|
},
|
|
71
78
|
},
|
|
72
79
|
],
|
|
73
80
|
threadPool: happyThreadPool,
|
|
74
81
|
}),
|
|
82
|
+
new HappyPack({
|
|
83
|
+
id: 'babel',
|
|
84
|
+
loaders: [babelLoader],
|
|
85
|
+
threadPool: happyThreadPool,
|
|
86
|
+
}),
|
|
75
87
|
new HtmlWebpackPlugin({
|
|
76
88
|
template: htmlTemplatePath,
|
|
77
89
|
filename: 'index.html',
|
|
@@ -128,7 +140,7 @@ module.exports = function (options) {
|
|
|
128
140
|
},
|
|
129
141
|
devtool: isDevelopment ? 'eval' : false,
|
|
130
142
|
resolve: {
|
|
131
|
-
extensions: ['.js', '.jsx', '.tsx', '.json', '.scss', '.css'],
|
|
143
|
+
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json', '.scss', '.css'],
|
|
132
144
|
modules: [...resolveModules],
|
|
133
145
|
symlinks: false,
|
|
134
146
|
cacheWithContext: false,
|
|
@@ -141,6 +153,11 @@ module.exports = function (options) {
|
|
|
141
153
|
},
|
|
142
154
|
module: {
|
|
143
155
|
rules: [
|
|
156
|
+
{
|
|
157
|
+
test: /\.tsx?$/,
|
|
158
|
+
exclude: /node_modules\/(?!@cloudbase\/weda-ui)|gsd-kbone-react/,
|
|
159
|
+
use: [`happypack/loader?id=${TS_LOADER_ID}`],
|
|
160
|
+
},
|
|
144
161
|
{
|
|
145
162
|
test: /\.(js|jsx)$/,
|
|
146
163
|
exclude: /node_modules\/(?!@cloudbase\/weda-ui)|gsd-kbone-react/,
|