@cloudbase/framework-plugin-low-code 1.7.3 → 1.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (239) hide show
  1. package/lib/index.d.ts +0 -0
  2. package/lib/index.d.ts.map +0 -0
  3. package/lib/index.js +0 -0
  4. package/lib/utils/common.d.ts +0 -0
  5. package/lib/utils/common.d.ts.map +0 -0
  6. package/lib/utils/common.js +0 -0
  7. package/lib/utils/index.d.ts +0 -0
  8. package/lib/utils/index.d.ts.map +0 -0
  9. package/lib/utils/index.js +0 -0
  10. package/package.json +4 -4
  11. package/scripts/link.js +3 -7
  12. package/lib/builder/config/common.d.ts +0 -2
  13. package/lib/builder/config/common.d.ts.map +0 -1
  14. package/lib/builder/config/common.js +0 -13
  15. package/lib/builder/config/index.d.ts +0 -3
  16. package/lib/builder/config/index.d.ts.map +0 -1
  17. package/lib/builder/config/index.js +0 -29
  18. package/lib/builder/config/mp.d.ts +0 -2
  19. package/lib/builder/config/mp.d.ts.map +0 -1
  20. package/lib/builder/config/mp.js +0 -13
  21. package/lib/builder/core/copy.d.ts +0 -5
  22. package/lib/builder/core/copy.d.ts.map +0 -1
  23. package/lib/builder/core/copy.js +0 -62
  24. package/lib/builder/core/generate.d.ts +0 -9
  25. package/lib/builder/core/generate.d.ts.map +0 -1
  26. package/lib/builder/core/generate.js +0 -128
  27. package/lib/builder/core/index.d.ts +0 -32
  28. package/lib/builder/core/index.d.ts.map +0 -1
  29. package/lib/builder/core/index.js +0 -149
  30. package/lib/builder/core/material.d.ts +0 -4
  31. package/lib/builder/core/material.d.ts.map +0 -1
  32. package/lib/builder/core/material.js +0 -80
  33. package/lib/builder/core/plugin.d.ts +0 -4
  34. package/lib/builder/core/plugin.d.ts.map +0 -1
  35. package/lib/builder/core/plugin.js +0 -30
  36. package/lib/builder/core/prepare.d.ts +0 -8
  37. package/lib/builder/core/prepare.d.ts.map +0 -1
  38. package/lib/builder/core/prepare.js +0 -108
  39. package/lib/builder/core/webpack.d.ts +0 -15
  40. package/lib/builder/core/webpack.d.ts.map +0 -1
  41. package/lib/builder/core/webpack.js +0 -58
  42. package/lib/builder/mp/BuildContext.d.ts +0 -13
  43. package/lib/builder/mp/BuildContext.d.ts.map +0 -1
  44. package/lib/builder/mp/BuildContext.js +0 -2
  45. package/lib/builder/mp/index.d.ts +0 -33
  46. package/lib/builder/mp/index.d.ts.map +0 -1
  47. package/lib/builder/mp/index.js +0 -450
  48. package/lib/builder/mp/lowcode.d.ts +0 -8
  49. package/lib/builder/mp/lowcode.d.ts.map +0 -1
  50. package/lib/builder/mp/lowcode.js +0 -54
  51. package/lib/builder/mp/materials.d.ts +0 -15
  52. package/lib/builder/mp/materials.d.ts.map +0 -1
  53. package/lib/builder/mp/materials.js +0 -338
  54. package/lib/builder/mp/mixMode.d.ts +0 -10
  55. package/lib/builder/mp/mixMode.d.ts.map +0 -1
  56. package/lib/builder/mp/mixMode.js +0 -215
  57. package/lib/builder/mp/mp_config.d.ts +0 -18
  58. package/lib/builder/mp/mp_config.d.ts.map +0 -1
  59. package/lib/builder/mp/mp_config.js +0 -206
  60. package/lib/builder/mp/util.d.ts +0 -20
  61. package/lib/builder/mp/util.d.ts.map +0 -1
  62. package/lib/builder/mp/util.js +0 -243
  63. package/lib/builder/mp/wxml.d.ts +0 -16
  64. package/lib/builder/mp/wxml.d.ts.map +0 -1
  65. package/lib/builder/mp/wxml.js +0 -300
  66. package/lib/builder/service/builder/copy.d.ts +0 -14
  67. package/lib/builder/service/builder/copy.d.ts.map +0 -1
  68. package/lib/builder/service/builder/copy.js +0 -189
  69. package/lib/builder/service/builder/generate.d.ts +0 -52
  70. package/lib/builder/service/builder/generate.d.ts.map +0 -1
  71. package/lib/builder/service/builder/generate.js +0 -792
  72. package/lib/builder/service/builder/index.d.ts +0 -16
  73. package/lib/builder/service/builder/index.d.ts.map +0 -1
  74. package/lib/builder/service/builder/index.js +0 -69
  75. package/lib/builder/service/builder/plugin.d.ts +0 -8
  76. package/lib/builder/service/builder/plugin.d.ts.map +0 -1
  77. package/lib/builder/service/builder/plugin.js +0 -149
  78. package/lib/builder/service/builder/webpack.d.ts +0 -91
  79. package/lib/builder/service/builder/webpack.d.ts.map +0 -1
  80. package/lib/builder/service/builder/webpack.js +0 -589
  81. package/lib/builder/types/common.d.ts +0 -12
  82. package/lib/builder/types/common.d.ts.map +0 -1
  83. package/lib/builder/types/common.js +0 -7
  84. package/lib/builder/util/common.d.ts +0 -36
  85. package/lib/builder/util/common.d.ts.map +0 -1
  86. package/lib/builder/util/common.js +0 -257
  87. package/lib/builder/util/console.d.ts +0 -2
  88. package/lib/builder/util/console.d.ts.map +0 -1
  89. package/lib/builder/util/console.js +0 -13
  90. package/lib/builder/util/generateFiles.d.ts +0 -6
  91. package/lib/builder/util/generateFiles.d.ts.map +0 -1
  92. package/lib/builder/util/generateFiles.js +0 -94
  93. package/lib/builder/util/index.d.ts +0 -2
  94. package/lib/builder/util/index.d.ts.map +0 -1
  95. package/lib/builder/util/index.js +0 -13
  96. package/lib/builder/util/junk.d.ts +0 -3
  97. package/lib/builder/util/junk.d.ts.map +0 -1
  98. package/lib/builder/util/junk.js +0 -25
  99. package/lib/builder/util/mp.d.ts +0 -5
  100. package/lib/builder/util/mp.d.ts.map +0 -1
  101. package/lib/builder/util/mp.js +0 -99
  102. package/lib/builder/util/name-mangler.d.ts +0 -3
  103. package/lib/builder/util/name-mangler.d.ts.map +0 -1
  104. package/lib/builder/util/name-mangler.js +0 -7
  105. package/lib/builder/util/net.d.ts +0 -3
  106. package/lib/builder/util/net.d.ts.map +0 -1
  107. package/lib/builder/util/net.js +0 -54
  108. package/lib/builder/util/process.d.ts +0 -9
  109. package/lib/builder/util/process.d.ts.map +0 -1
  110. package/lib/builder/util/process.js +0 -28
  111. package/lib/builder/util/style.d.ts +0 -2
  112. package/lib/builder/util/style.d.ts.map +0 -1
  113. package/lib/builder/util/style.js +0 -13
  114. package/lib/builder/util/weapp.d.ts +0 -2
  115. package/lib/builder/util/weapp.d.ts.map +0 -1
  116. package/lib/builder/util/weapp.js +0 -13
  117. package/lib/config/private.d.ts +0 -3
  118. package/lib/config/private.d.ts.map +0 -1
  119. package/lib/config/private.js +0 -14
  120. package/lib/generate.d.ts +0 -2
  121. package/lib/generate.d.ts.map +0 -1
  122. package/lib/generate.js +0 -49
  123. package/lib/generator/config/common.d.ts +0 -6
  124. package/lib/generator/config/common.d.ts.map +0 -1
  125. package/lib/generator/config/common.js +0 -25
  126. package/lib/generator/config/index.d.ts +0 -18
  127. package/lib/generator/config/index.d.ts.map +0 -1
  128. package/lib/generator/config/index.js +0 -43
  129. package/lib/generator/config/mp.d.ts +0 -56
  130. package/lib/generator/config/mp.d.ts.map +0 -1
  131. package/lib/generator/config/mp.js +0 -104
  132. package/lib/generator/core/generate.d.ts +0 -59
  133. package/lib/generator/core/generate.d.ts.map +0 -1
  134. package/lib/generator/core/generate.js +0 -663
  135. package/lib/generator/core/index.d.ts +0 -25
  136. package/lib/generator/core/index.d.ts.map +0 -1
  137. package/lib/generator/core/index.js +0 -102
  138. package/lib/generator/core/material.d.ts +0 -14
  139. package/lib/generator/core/material.d.ts.map +0 -1
  140. package/lib/generator/core/material.js +0 -230
  141. package/lib/generator/template.d.ts +0 -3
  142. package/lib/generator/template.d.ts.map +0 -1
  143. package/lib/generator/template.js +0 -3
  144. package/lib/generator/types/common.d.ts +0 -69
  145. package/lib/generator/types/common.d.ts.map +0 -1
  146. package/lib/generator/types/common.js +0 -21
  147. package/lib/generator/util/common.d.ts +0 -36
  148. package/lib/generator/util/common.d.ts.map +0 -1
  149. package/lib/generator/util/common.js +0 -238
  150. package/lib/generator/util/console.d.ts +0 -3
  151. package/lib/generator/util/console.d.ts.map +0 -1
  152. package/lib/generator/util/console.js +0 -17
  153. package/lib/generator/util/index.d.ts +0 -2
  154. package/lib/generator/util/index.d.ts.map +0 -1
  155. package/lib/generator/util/index.js +0 -13
  156. package/lib/generator/util/name-mangler.d.ts +0 -17
  157. package/lib/generator/util/name-mangler.d.ts.map +0 -1
  158. package/lib/generator/util/name-mangler.js +0 -63
  159. package/lib/generator/util/postcss-rpx.d.ts +0 -11
  160. package/lib/generator/util/postcss-rpx.d.ts.map +0 -1
  161. package/lib/generator/util/postcss-rpx.js +0 -16
  162. package/lib/generator/util/style.d.ts +0 -6
  163. package/lib/generator/util/style.d.ts.map +0 -1
  164. package/lib/generator/util/style.js +0 -92
  165. package/lib/generator/util/weapp.d.ts +0 -5
  166. package/lib/generator/util/weapp.d.ts.map +0 -1
  167. package/lib/generator/util/weapp.js +0 -17
  168. package/lib/types.d.ts +0 -14
  169. package/lib/types.d.ts.map +0 -1
  170. package/lib/types.js +0 -19
  171. package/lib/utils/dataSource.d.ts +0 -28
  172. package/lib/utils/dataSource.d.ts.map +0 -1
  173. package/lib/utils/dataSource.js +0 -171
  174. package/lib/utils/postProcess.d.ts +0 -3
  175. package/lib/utils/postProcess.d.ts.map +0 -1
  176. package/lib/utils/postProcess.js +0 -48
  177. package/lib/weapps-core/config/index.d.ts +0 -2
  178. package/lib/weapps-core/config/index.d.ts.map +0 -1
  179. package/lib/weapps-core/config/index.js +0 -13
  180. package/lib/weapps-core/config/style.d.ts +0 -7
  181. package/lib/weapps-core/config/style.d.ts.map +0 -1
  182. package/lib/weapps-core/config/style.js +0 -70
  183. package/lib/weapps-core/index.d.ts +0 -6
  184. package/lib/weapps-core/index.d.ts.map +0 -1
  185. package/lib/weapps-core/index.js +0 -31
  186. package/lib/weapps-core/types/action.d.ts +0 -25
  187. package/lib/weapps-core/types/action.d.ts.map +0 -1
  188. package/lib/weapps-core/types/action.js +0 -28
  189. package/lib/weapps-core/types/app.d.ts +0 -142
  190. package/lib/weapps-core/types/app.d.ts.map +0 -1
  191. package/lib/weapps-core/types/app.js +0 -21
  192. package/lib/weapps-core/types/appbuild.d.ts +0 -63
  193. package/lib/weapps-core/types/appbuild.d.ts.map +0 -1
  194. package/lib/weapps-core/types/appbuild.js +0 -78
  195. package/lib/weapps-core/types/code_types.d.ts +0 -26
  196. package/lib/weapps-core/types/code_types.d.ts.map +0 -1
  197. package/lib/weapps-core/types/code_types.js +0 -2
  198. package/lib/weapps-core/types/git.d.ts +0 -7
  199. package/lib/weapps-core/types/git.d.ts.map +0 -1
  200. package/lib/weapps-core/types/git.js +0 -2
  201. package/lib/weapps-core/types/index.d.ts +0 -11
  202. package/lib/weapps-core/types/index.d.ts.map +0 -1
  203. package/lib/weapps-core/types/index.js +0 -22
  204. package/lib/weapps-core/types/lowcode.d.ts +0 -26
  205. package/lib/weapps-core/types/lowcode.d.ts.map +0 -1
  206. package/lib/weapps-core/types/lowcode.js +0 -25
  207. package/lib/weapps-core/types/material.d.ts +0 -90
  208. package/lib/weapps-core/types/material.d.ts.map +0 -1
  209. package/lib/weapps-core/types/material.js +0 -9
  210. package/lib/weapps-core/types/plugins.d.ts +0 -17
  211. package/lib/weapps-core/types/plugins.d.ts.map +0 -1
  212. package/lib/weapps-core/types/plugins.js +0 -2
  213. package/lib/weapps-core/types/style.d.ts +0 -93
  214. package/lib/weapps-core/types/style.d.ts.map +0 -1
  215. package/lib/weapps-core/types/style.js +0 -2
  216. package/lib/weapps-core/types/web.d.ts +0 -120
  217. package/lib/weapps-core/types/web.d.ts.map +0 -1
  218. package/lib/weapps-core/types/web.js +0 -2
  219. package/lib/weapps-core/utils/appbuild.d.ts +0 -6
  220. package/lib/weapps-core/utils/appbuild.d.ts.map +0 -1
  221. package/lib/weapps-core/utils/appbuild.js +0 -40
  222. package/lib/weapps-core/utils/common.d.ts +0 -16
  223. package/lib/weapps-core/utils/common.d.ts.map +0 -1
  224. package/lib/weapps-core/utils/common.js +0 -90
  225. package/lib/weapps-core/utils/file.d.ts +0 -12
  226. package/lib/weapps-core/utils/file.d.ts.map +0 -1
  227. package/lib/weapps-core/utils/file.js +0 -142
  228. package/lib/weapps-core/utils/formily.d.ts +0 -5
  229. package/lib/weapps-core/utils/formily.d.ts.map +0 -1
  230. package/lib/weapps-core/utils/formily.js +0 -416
  231. package/lib/weapps-core/utils/index.d.ts +0 -7
  232. package/lib/weapps-core/utils/index.d.ts.map +0 -1
  233. package/lib/weapps-core/utils/index.js +0 -18
  234. package/lib/weapps-core/utils/lowcdoe.d.ts +0 -4
  235. package/lib/weapps-core/utils/lowcdoe.d.ts.map +0 -1
  236. package/lib/weapps-core/utils/lowcdoe.js +0 -69
  237. package/lib/weapps-core/utils/style.d.ts +0 -17
  238. package/lib/weapps-core/utils/style.d.ts.map +0 -1
  239. package/lib/weapps-core/utils/style.js +0 -330
@@ -1,416 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.readCmpInstances = exports.deserialize = exports.serialize = void 0;
4
- const types_1 = require("../types");
5
- const common_1 = require("./common");
6
- const style_1 = require("./style");
7
- const types_2 = require("../../types");
8
- function serialize(webRuntimeAppData) {
9
- const weAppData = {
10
- selectedPageId: webRuntimeAppData.selectedPageId,
11
- pageInstanceList: [],
12
- lowCodes: webRuntimeAppData.codeModules,
13
- npmDependencies: webRuntimeAppData.npmDependencies,
14
- plugins: webRuntimeAppData.plugins,
15
- rootPath: webRuntimeAppData.rootPath,
16
- datasources: webRuntimeAppData.datasources || [],
17
- vars: webRuntimeAppData.vars || { data: [] },
18
- dataset: webRuntimeAppData.dataset,
19
- };
20
- (0, common_1.setValidValue)(weAppData, 'appConfig', webRuntimeAppData.appConfig);
21
- (0, common_1.setValidValue)(weAppData, 'themeVars', webRuntimeAppData.themeVars);
22
- (0, common_1.setValidValue)(weAppData, 'presetColors', webRuntimeAppData.presetColors);
23
- handlePageInstanceList(webRuntimeAppData.pageInstanceList, weAppData.pageInstanceList);
24
- function handlePageInstanceList(pageInstanceList, collection) {
25
- pageInstanceList.map((pageData) => {
26
- var _a;
27
- const newPage = {
28
- id: pageData.id,
29
- };
30
- (0, common_1.setValidValue)(newPage, 'isHome', pageData.isHome);
31
- (0, common_1.setValidValue)(newPage, 'data', readDynamicData(pageData));
32
- (0, common_1.setValidValue)(newPage, 'commonStyle', (0, style_1.removeInvalidStyleFormValue)(pageData.style));
33
- (0, common_1.setValidValue)(newPage, 'styleBindPath', pageData.styleBindPath);
34
- if ((0, common_1.isValidStyleBind)(pageData.styleBind)) {
35
- (0, common_1.setValidValue)(newPage, 'styleBind', pageData.styleBind);
36
- }
37
- if ((0, common_1.isValidClassNameListBind)(pageData.classNameListBind)) {
38
- (0, common_1.setValidValue)(newPage, 'classNameListBind', pageData.classNameListBind);
39
- }
40
- (0, common_1.setValidValue)(newPage, 'componentInstances', readComponents(pageData.componentSchemaJson.properties));
41
- (0, common_1.setValidValue)(newPage, 'listeners', readListeners(pageData.listenerInstances));
42
- (0, common_1.setValidValue)(newPage, 'pluginInstances', pageData.pluginInstances);
43
- (0, common_1.setValidValue)(newPage, 'lowCodes', pageData.codeModules);
44
- if ((_a = pageData.children) === null || _a === void 0 ? void 0 : _a.length) {
45
- newPage.children = newPage.children || [];
46
- handlePageInstanceList(pageData.children, newPage.children);
47
- }
48
- collection.push(newPage);
49
- });
50
- }
51
- function readComponents(properties = {}, excludeKeys = []) {
52
- var _a;
53
- const cmps = {};
54
- for (const key in properties) {
55
- if (excludeKeys.indexOf(key) > -1) {
56
- continue;
57
- }
58
- const srcCmp = properties[key];
59
- const srcProps = srcCmp['x-props'];
60
- if (srcProps) {
61
- const cmpParts = srcProps.sourceKey.split(':');
62
- cmps[key] = { genericComp: srcCmp['genericComp'] };
63
- (0, common_1.setValidValue)(cmps[key], 'xComponent', {
64
- moduleName: cmpParts[0],
65
- name: cmpParts[1],
66
- });
67
- const componentXProps = {};
68
- (0, common_1.setValidValue)(componentXProps, 'data', readDynamicData(srcProps));
69
- (0, common_1.setValidValue)(componentXProps, 'listeners', readListeners(srcProps.listenerInstances));
70
- (0, common_1.setValidValue)(componentXProps, 'staticResourceAttribute', srcProps.staticResourceAttribute);
71
- (0, common_1.setValidValue)(componentXProps, 'directives', readDirectives(srcProps));
72
- (0, common_1.setValidValue)(componentXProps, 'customDataForm', srcProps.customDataForm);
73
- (0, common_1.setValidValue)(componentXProps, 'style', srcProps.style);
74
- (0, common_1.setValidValue)(componentXProps, 'commonStyle', (0, style_1.removeInvalidStyleFormValue)(srcProps.commonStyle));
75
- (0, common_1.setValidValue)(componentXProps, 'styleBindPath', srcProps.styleBindPath);
76
- if ((_a = srcProps.styleBind) === null || _a === void 0 ? void 0 : _a.bindDataPath) {
77
- componentXProps.styleBind = {
78
- type: srcProps.styleBind.type,
79
- value: srcProps.styleBind.bindDataPath,
80
- };
81
- }
82
- if ((0, common_1.isValidClassNameListBind)(srcProps.classNameListBind)) {
83
- const classList = srcProps.classNameListBind;
84
- (0, common_1.setValidValue)(componentXProps, 'classListBind', {
85
- type: classList.type,
86
- value: classList.bindDataPath,
87
- });
88
- }
89
- if (srcProps.classNameList) {
90
- (0, common_1.setValidValue)(componentXProps, 'classList', srcProps.classNameList);
91
- }
92
- (0, common_1.setValidValue)(cmps[key], 'xProps', componentXProps);
93
- (0, common_1.setValidValue)(cmps[key], 'xIndex', srcCmp['x-index']);
94
- const excludeKeys = (srcProps.dataTypes || [])
95
- .filter((dataType) => dataType.type !== 'slot')
96
- .map((dataType) => dataType.propertyPath);
97
- (0, common_1.setValidValue)(cmps[key], 'properties', readComponents(srcCmp.properties, excludeKeys));
98
- }
99
- else {
100
- cmps[key] = { properties: readComponents(srcCmp.properties) };
101
- }
102
- }
103
- return cmps;
104
- }
105
- function readDirectives(cmp) {
106
- var _a, _b, _c;
107
- const directives = {};
108
- if (cmp.data && cmp.data._visible !== true) {
109
- directives.waIf = {
110
- value: cmp.data._visible,
111
- };
112
- }
113
- if ((_a = cmp.dataBinds) === null || _a === void 0 ? void 0 : _a.length) {
114
- const bind = cmp.dataBinds.find((bind) => bind.propertyPath === '_visible');
115
- if (bind) {
116
- const foundDataType = (cmp.dataTypes || []).find((dataType) => dataType.propertyPath === bind.propertyPath);
117
- if (foundDataType && foundDataType.type === 'bind') {
118
- directives.waIf = {
119
- type: bind.type || types_1.PropBindType.state,
120
- value: bind.bindDataPath,
121
- };
122
- }
123
- }
124
- const forBind = cmp.dataBinds.find((bind) => bind.propertyPath === '_waFor');
125
- if (forBind) {
126
- directives.waFor = {
127
- type: forBind.type || types_1.PropBindType.state,
128
- value: forBind.bindDataPath,
129
- };
130
- }
131
- }
132
- if (directives.waFor && ((_b = cmp.data) === null || _b === void 0 ? void 0 : _b._waForKey)) {
133
- directives.waForKey = {
134
- value: (_c = cmp.data) === null || _c === void 0 ? void 0 : _c._waForKey,
135
- };
136
- }
137
- return directives;
138
- }
139
- function readDynamicData(cmp) {
140
- var _a;
141
- const data = {};
142
- const ignoredProps = ['_visible', '_waFor', '_waForKey'];
143
- for (const prop in cmp.data) {
144
- if (ignoredProps.indexOf(prop) > -1) {
145
- continue;
146
- }
147
- data[prop] = { value: cmp.data[prop] };
148
- }
149
- (_a = cmp.dataBinds) === null || _a === void 0 ? void 0 : _a.forEach((bind) => {
150
- if (ignoredProps.indexOf(bind.propertyPath) > -1) {
151
- return;
152
- }
153
- const foundDataType = (cmp.dataTypes || []).find((dataType) => dataType.propertyPath === bind.propertyPath);
154
- if (foundDataType && foundDataType.type === 'bind') {
155
- data[bind.propertyPath] = {
156
- type: bind.type || types_1.PropBindType.state,
157
- value: bind.bindDataPath,
158
- };
159
- }
160
- });
161
- return data;
162
- }
163
- function readListeners(listenerInstances = []) {
164
- const listeners = listenerInstances.map((act) => {
165
- const fromParts = act.sourceKey.split(':');
166
- let handler;
167
- if (act.type !== types_1.ActionType.Inline) {
168
- const fromParts = act.sourceKey.split(':');
169
- handler = {
170
- handler: {
171
- moduleName: fromParts[0],
172
- name: fromParts[1],
173
- },
174
- };
175
- }
176
- else {
177
- handler = { jsCode: act.jsCode };
178
- }
179
- return Object.assign(Object.assign({ key: act.key || '', trigger: act.trigger, type: act.type }, handler), { data: readDynamicData(act), isCapturePhase: act.isCapturePhase, noPropagation: act.noPropagation });
180
- });
181
- return listeners;
182
- }
183
- return weAppData;
184
- }
185
- exports.serialize = serialize;
186
- function deserialize(weAppData) {
187
- const webRuntimeAppData = {
188
- appTitle: weAppData.label,
189
- label: weAppData.label,
190
- selectedPageId: weAppData.selectedPageId,
191
- historyType: weAppData.historyType || types_2.HISTORY_TYPE.BROWSER,
192
- pageInstanceList: [],
193
- codeModules: weAppData.lowCodes || [],
194
- npmDependencies: weAppData.npmDependencies || {},
195
- plugins: weAppData.plugins || [],
196
- rootPath: weAppData.rootPath || '',
197
- themeVars: weAppData.themeVars || {},
198
- presetColors: weAppData.presetColors || [],
199
- appConfig: weAppData.appConfig || {},
200
- datasources: weAppData.datasources || [],
201
- vars: weAppData.vars || { data: [] },
202
- dataset: weAppData.dataset,
203
- envId: weAppData.envId || '',
204
- extra: weAppData.extra || {},
205
- };
206
- handlePageInstanceList(weAppData.pageInstanceList, webRuntimeAppData.pageInstanceList);
207
- function handlePageInstanceList(pageInstanceList, collection) {
208
- pageInstanceList.map((srcPage) => {
209
- var _a;
210
- const page = {
211
- id: srcPage.id,
212
- data: {},
213
- dataBinds: [],
214
- vars: { data: [] },
215
- dataset: srcPage.dataset,
216
- };
217
- page.vars = srcPage.vars ? srcPage.vars : page.vars;
218
- page.isHome = srcPage.isHome || false;
219
- page.style = srcPage.commonStyle || {};
220
- (0, common_1.setValidValue)(page, 'styleBindPath', srcPage.styleBindPath);
221
- page.codeModules = srcPage.lowCodes || [];
222
- page.pluginInstances = srcPage.pluginInstances || [];
223
- page.componentSchemaJson = {
224
- type: 'object',
225
- properties: readCmpInstances(srcPage.componentInstances),
226
- 'x-index': 0,
227
- };
228
- page.listenerInstances = readListeners(srcPage.listeners) || [];
229
- if (srcPage['code']) {
230
- const target = srcPage['codeType'] === 'page' ? page : webRuntimeAppData;
231
- target.codeModules.push({
232
- type: 'rematch',
233
- code: srcPage['code'],
234
- name: srcPage.id,
235
- path: '',
236
- });
237
- }
238
- readDynamicData(srcPage.data, page);
239
- if ((_a = srcPage.children) === null || _a === void 0 ? void 0 : _a.length) {
240
- page.children = page.children || [];
241
- handlePageInstanceList(srcPage.children, page.children);
242
- }
243
- collection.push(page);
244
- });
245
- }
246
- return webRuntimeAppData;
247
- }
248
- exports.deserialize = deserialize;
249
- function readCmpInstances(cmps) {
250
- const properties = {};
251
- for (const key in cmps) {
252
- const cmp = cmps[key];
253
- const target = (properties[key] = {
254
- key,
255
- type: 'object',
256
- properties: readCmpInstances(cmp.properties || {}),
257
- genericComp: cmp.genericComp,
258
- });
259
- if (cmp.xComponent) {
260
- cmp.xProps = (cmp.xProps || {});
261
- const xCmp = cmp.xComponent.moduleName + ':' + cmp.xComponent.name;
262
- const xProps = {
263
- sourceKey: xCmp,
264
- data: {},
265
- };
266
- xProps.dataBinds = xProps.dataBinds || [];
267
- xProps.dataTypes = xProps.dataTypes || [];
268
- xProps.customDataForm = xProps.customDataForm || {};
269
- xProps.style = cmp.xProps.style || {};
270
- xProps.commonStyle = cmp.xProps.commonStyle || {};
271
- xProps.staticResourceAttribute = cmp.xProps.staticResourceAttribute || [];
272
- (0, common_1.setValidValue)(xProps, 'styleBindPath', cmp.xProps.styleBindPath);
273
- let { classList, classListBind } = cmp.xProps;
274
- const { styleBind } = cmp.xProps;
275
- const legacyClassList = classList;
276
- if (legacyClassList === null || legacyClassList === void 0 ? void 0 : legacyClassList.value) {
277
- if (!legacyClassList.type || legacyClassList.type === 'static') {
278
- classList = legacyClassList.value;
279
- }
280
- else {
281
- classList = [];
282
- classListBind = classListBind;
283
- }
284
- }
285
- classList && (0, common_1.setValidValue)(xProps, 'classNameList', classList);
286
- classListBind &&
287
- (0, common_1.setValidValue)(xProps, 'classNameListBind', {
288
- type: classListBind.type,
289
- propertyPath: 'classNameList',
290
- bindDataPath: classListBind.value,
291
- });
292
- if (styleBind && styleBind.type !== 'static') {
293
- xProps.styleBind = {
294
- type: styleBind.type,
295
- propertyPath: 'style',
296
- bindDataPath: styleBind.value,
297
- };
298
- }
299
- xProps.listenerInstances = readListeners(cmp.xProps.listeners) || [];
300
- readDynamicData(cmp.xProps.data, xProps, cmp.properties);
301
- if (cmp.xProps.directives) {
302
- const { waIf, waFor, waForKey } = cmp.xProps.directives;
303
- if (waIf) {
304
- if (waIf.type === 'static' || waIf.type === undefined) {
305
- xProps.data = xProps.data || {};
306
- xProps.data._visible = waIf.value;
307
- }
308
- else {
309
- xProps.dataBinds = xProps.dataBinds || [];
310
- xProps.dataBinds.push({
311
- type: waIf.type || types_1.PropBindType.state,
312
- propertyPath: '_visible',
313
- bindDataPath: waIf.value,
314
- });
315
- xProps.dataTypes.push({
316
- propertyPath: '_visible',
317
- type: 'bind',
318
- });
319
- }
320
- }
321
- if (waFor && waFor.type !== 'static') {
322
- xProps.dataBinds = xProps.dataBinds || [];
323
- xProps.dataBinds.push({
324
- type: waFor.type || types_1.PropBindType.state,
325
- propertyPath: '_waFor',
326
- bindDataPath: waFor.value,
327
- });
328
- xProps.dataTypes.push({
329
- propertyPath: '_waFor',
330
- type: 'bind',
331
- });
332
- if (waForKey && (waForKey.type === 'static' || waForKey.type === undefined)) {
333
- xProps.data = xProps.data || {};
334
- xProps.data._waForKey = waForKey.value;
335
- }
336
- }
337
- }
338
- else {
339
- xProps.data = xProps.data || {};
340
- xProps.data._visible = true;
341
- }
342
- (0, common_1.setValidValue)(target, 'x-component', xCmp.toLocaleLowerCase());
343
- (0, common_1.setValidValue)(xProps, 'customDataForm', cmp.xProps.customDataForm);
344
- target['x-props'] = xProps;
345
- (0, common_1.setValidValue)(target, 'x-index', cmp.xIndex);
346
- }
347
- }
348
- return properties;
349
- }
350
- exports.readCmpInstances = readCmpInstances;
351
- function readListeners(listeners = []) {
352
- return listeners.map((l) => {
353
- const { handler } = l;
354
- const act = {
355
- key: l.key || '',
356
- sourceKey: handler ? handler.moduleName + ':' + handler.name : '',
357
- trigger: l.trigger,
358
- type: l.type,
359
- data: {},
360
- dataBinds: [],
361
- handler: l.handler,
362
- jsCode: l.jsCode,
363
- isCapturePhase: l.isCapturePhase,
364
- noPropagation: l.noPropagation,
365
- };
366
- readDynamicData(l.data, act);
367
- return act;
368
- });
369
- }
370
- function readDynamicData(from = {}, to, properties) {
371
- to.dataTypes = to.dataTypes || [];
372
- for (const prop in from) {
373
- const dv = from[prop];
374
- if (dv.type === 'static' || dv.type === undefined) {
375
- to.data = to.data || {};
376
- to.data[prop] = dv.value;
377
- to.dataTypes.push({
378
- propertyPath: prop,
379
- type: 'static',
380
- });
381
- }
382
- else if (dv.type === 'slot') {
383
- to.dataTypes.push({
384
- propertyPath: prop,
385
- type: 'slot',
386
- });
387
- }
388
- else {
389
- to.dataBinds = to.dataBinds || [];
390
- to.dataBinds.push({
391
- propertyPath: prop,
392
- bindDataPath: dv.value,
393
- type: dv.type,
394
- });
395
- to.dataTypes.push({
396
- propertyPath: prop,
397
- type: 'bind',
398
- });
399
- }
400
- }
401
- if (properties) {
402
- Object.keys(properties).forEach((key) => {
403
- const foundOne = to.dataTypes.find((dataType) => dataType.propertyPath === key);
404
- if (foundOne) {
405
- foundOne.type = 'slot';
406
- }
407
- else {
408
- if (!properties[key].xComponent)
409
- to.dataTypes.push({
410
- propertyPath: key,
411
- type: 'slot',
412
- });
413
- }
414
- });
415
- }
416
- }
@@ -1,7 +0,0 @@
1
- export * from './formily';
2
- export * from './style';
3
- export * from './common';
4
- export * from './lowcdoe';
5
- export * from './file';
6
- export * from './appbuild';
7
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/weapps-core/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC"}
@@ -1,18 +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
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- __exportStar(require("./formily"), exports);
14
- __exportStar(require("./style"), exports);
15
- __exportStar(require("./common"), exports);
16
- __exportStar(require("./lowcdoe"), exports);
17
- __exportStar(require("./file"), exports);
18
- __exportStar(require("./appbuild"), exports);
@@ -1,4 +0,0 @@
1
- import { ILowCodesModifyStatus, IWeAppData, ILockedPage } from '../types';
2
- export declare function evalExpression(code: string, runtime: any): any;
3
- export declare function receiveDataByLowcodeDiff(lastestAppData: IWeAppData, appSaveData: IWeAppData, allLowCodes: ILowCodesModifyStatus[], redisLockedPages: ILockedPage[], username: string): void;
4
- //# sourceMappingURL=lowcdoe.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lowcdoe.d.ts","sourceRoot":"","sources":["../../../src/weapps-core/utils/lowcdoe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACzE,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,OAMxD;AAiBD,wBAAgB,wBAAwB,CACtC,cAAc,EAAE,UAAU,EAC1B,WAAW,EAAE,UAAU,EACvB,WAAW,EAAE,qBAAqB,EAAE,EACpC,gBAAgB,EAAE,WAAW,EAAE,EAC/B,QAAQ,EAAE,MAAM,QAwDjB"}
@@ -1,69 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.receiveDataByLowcodeDiff = exports.evalExpression = void 0;
4
- function evalExpression(code, runtime) {
5
- try {
6
- return runtime.eval(`(function(forItems, $context){const $for = forItems; return ${code};})`);
7
- }
8
- catch (e) {
9
- runtime.console.error(`Error in expression:\t${code}\n\n`, e);
10
- }
11
- }
12
- exports.evalExpression = evalExpression;
13
- function findLowcodeItem(appData, lowcodeDiff) {
14
- const pathKeys = lowcodeDiff.path.split('/');
15
- if (pathKeys[0] === 'global') {
16
- return appData.lowCodes.find((item) => item.path === lowcodeDiff.path);
17
- }
18
- else {
19
- const pageInstance = appData.pageInstanceList.find((item) => item.id === pathKeys[0]);
20
- return pageInstance.lowCodes.find((item) => item.path === lowcodeDiff.path);
21
- }
22
- }
23
- function receiveDataByLowcodeDiff(lastestAppData, appSaveData, allLowCodes, redisLockedPages, username) {
24
- allLowCodes.forEach((lowcodeDiff) => {
25
- const cannotDel = redisLockedPages.find((lockedPage) => lockedPage.id === lowcodeDiff.path && username !== lockedPage.username);
26
- if (cannotDel)
27
- return;
28
- const pathKeys = lowcodeDiff.path.split('/');
29
- let index = -1;
30
- switch (lowcodeDiff.type) {
31
- case 'add':
32
- case 'mod':
33
- if (pathKeys[0] === 'global') {
34
- const lowcode = findLowcodeItem(appSaveData, lowcodeDiff);
35
- index = lastestAppData.lowCodes.findIndex((item) => item.path === lowcodeDiff.path);
36
- if (index === -1) {
37
- lastestAppData.lowCodes.push(lowcode);
38
- }
39
- else {
40
- lastestAppData.lowCodes[index] = lowcode;
41
- }
42
- }
43
- else {
44
- const lowcode = findLowcodeItem(appSaveData, lowcodeDiff);
45
- const pageInstance = lastestAppData.pageInstanceList.find((item) => item.id === pathKeys[0]);
46
- index = pageInstance.lowCodes.findIndex((item) => item.path === lowcodeDiff.path);
47
- if (index === -1) {
48
- pageInstance.lowCodes.push(lowcode);
49
- }
50
- else {
51
- pageInstance.lowCodes[index] = lowcode;
52
- }
53
- }
54
- break;
55
- case 'del':
56
- if (pathKeys[0] === 'global') {
57
- index = lastestAppData.lowCodes.findIndex((item) => item.path === lowcodeDiff.path);
58
- index > -1 && lastestAppData.lowCodes.splice(index, 1);
59
- }
60
- else {
61
- const pageInstance = lastestAppData.pageInstanceList.find((item) => item.id === pathKeys[0]);
62
- index = pageInstance.lowCodes.findIndex((item) => item.path === lowcodeDiff.path);
63
- index > -1 && pageInstance.lowCodes.splice(index, 1);
64
- }
65
- break;
66
- }
67
- });
68
- }
69
- exports.receiveDataByLowcodeDiff = receiveDataByLowcodeDiff;
@@ -1,17 +0,0 @@
1
- import { CSSProperties, ICommonStyle } from '../types';
2
- export declare function toCssStyle(commonStyle?: ICommonStyle, options?: {
3
- toRem: boolean;
4
- ignoreSelf?: boolean;
5
- addPXUnit?: boolean;
6
- toRpx?: boolean;
7
- }): CSSProperties;
8
- export declare function removeInvalidStyleFormValue(styleForm?: ICommonStyle): ICommonStyle;
9
- export declare function translateStyleToRpx(style?: CSSProperties): CSSProperties;
10
- export declare function translateStyleToRem(style?: CSSProperties): CSSProperties;
11
- export declare function translateStyleByHandler(style: any, handler: (p: string) => string): {};
12
- export declare function toREM(cssLen: number | string): string;
13
- export declare function toRPX(cssLen: number | string): string;
14
- export declare function removeWrapperBadEffectStyle(commonStyle?: CSSProperties): CSSProperties;
15
- export declare function removeEffectTwiceStyle(commonStyle?: CSSProperties): CSSProperties;
16
- export declare function toCssText(style: CSSProperties, className?: string): string;
17
- //# sourceMappingURL=style.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../src/weapps-core/utils/style.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAqBvD,wBAAgB,UAAU,CACxB,WAAW,GAAE,YAAiB,EAC9B,OAAO,GAAE;IACP,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;CACoD,GACrE,aAAa,CAgNf;AAED,wBAAgB,2BAA2B,CAAC,SAAS,GAAE,YAAiB,GAAG,YAAY,CAUtF;AAyCD,wBAAgB,mBAAmB,CAAC,KAAK,GAAE,aAAkB,GAAG,aAAa,CAE5E;AAED,wBAAgB,mBAAmB,CAAC,KAAK,GAAE,aAAkB,GAAG,aAAa,CAE5E;AAED,wBAAgB,uBAAuB,CAAC,KAAK,KAAoB,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,MAUhG;AA0BD,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAiBrD;AAED,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAcrD;AAED,wBAAgB,2BAA2B,CAAC,WAAW,GAAE,aAAkB,GAAG,aAAa,CAgB1F;AAED,wBAAgB,sBAAsB,CAAC,WAAW,GAAE,aAAkB,GAAG,aAAa,CAoBrF;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,aAAa,EAAE,SAAS,SAAqB,UAQ7E"}