@cloudbase/framework-plugin-low-code 0.7.0 → 0.7.2-beta.1

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 (76) hide show
  1. package/lib/builder/config/common.js +1 -1
  2. package/lib/builder/config/index.js +2 -2
  3. package/lib/builder/config/mp.js +1 -1
  4. package/lib/builder/core/copy.js +3 -3
  5. package/lib/builder/core/generate.js +11 -11
  6. package/lib/builder/core/index.js +13 -13
  7. package/lib/builder/core/material.js +6 -6
  8. package/lib/builder/core/plugin.js +3 -3
  9. package/lib/builder/core/prepare.js +2 -2
  10. package/lib/builder/core/webpack.js +5 -5
  11. package/lib/builder/mp/index.d.ts.map +1 -1
  12. package/lib/builder/mp/index.js +50 -49
  13. package/lib/builder/mp/lowcode.js +4 -4
  14. package/lib/builder/mp/materials.js +16 -16
  15. package/lib/builder/mp/mixMode.js +12 -12
  16. package/lib/builder/mp/mp_config.js +11 -11
  17. package/lib/builder/mp/util.js +6 -6
  18. package/lib/builder/mp/wxml.js +4 -4
  19. package/lib/builder/service/builder/copy.js +11 -11
  20. package/lib/builder/service/builder/generate.js +56 -52
  21. package/lib/builder/service/builder/index.js +2 -2
  22. package/lib/builder/service/builder/plugin.js +2 -2
  23. package/lib/builder/service/builder/webpack.js +24 -23
  24. package/lib/builder/types/common.js +1 -0
  25. package/lib/builder/util/common.d.ts.map +1 -1
  26. package/lib/builder/util/common.js +8 -6
  27. package/lib/builder/util/console.js +1 -1
  28. package/lib/builder/util/generateFiles.js +2 -2
  29. package/lib/builder/util/index.js +1 -1
  30. package/lib/builder/util/junk.js +4 -2
  31. package/lib/builder/util/mp.js +1 -1
  32. package/lib/builder/util/net.js +1 -1
  33. package/lib/builder/util/style.js +1 -1
  34. package/lib/builder/util/weapp.js +1 -1
  35. package/lib/generate.js +2 -2
  36. package/lib/generator/config/index.js +2 -2
  37. package/lib/generator/core/generate.js +36 -34
  38. package/lib/generator/core/index.js +4 -4
  39. package/lib/generator/core/material.js +14 -14
  40. package/lib/generator/types/common.js +6 -3
  41. package/lib/generator/util/common.d.ts.map +1 -1
  42. package/lib/generator/util/common.js +1 -1
  43. package/lib/generator/util/index.js +1 -1
  44. package/lib/generator/util/style.js +2 -2
  45. package/lib/index.d.ts.map +1 -1
  46. package/lib/index.js +104 -66
  47. package/lib/utils/common.d.ts +1 -1
  48. package/lib/utils/common.d.ts.map +1 -1
  49. package/lib/utils/common.js +2 -2
  50. package/lib/utils/dataSource.js +2 -2
  51. package/lib/utils/index.js +1 -1
  52. package/lib/utils/postProcess.js +3 -3
  53. package/lib/weapps-core/config/index.js +1 -1
  54. package/lib/weapps-core/index.js +2 -2
  55. package/lib/weapps-core/types/index.js +1 -1
  56. package/lib/weapps-core/utils/appbuild.js +6 -3
  57. package/lib/weapps-core/utils/common.js +3 -2
  58. package/lib/weapps-core/utils/formily.js +37 -37
  59. package/lib/weapps-core/utils/index.js +1 -1
  60. package/lib/weapps-core/utils/style.js +15 -15
  61. package/package.json +1 -1
  62. package/template/html/index.html.ejs +1 -1
  63. package/template/mp/app/weapps-api.js +16 -6
  64. package/template/mp/app.js +59 -48
  65. package/template/mp/common/util.js +52 -4
  66. package/template/mp/common/weapp-page.js +16 -3
  67. package/template/mp/package.json +2 -2
  68. package/template/mp/page/index.js +3 -1
  69. package/template/package.json +2 -2
  70. package/template/src/app/global-api.js +20 -5
  71. package/template/src/handlers/FieldMiddleware/renderer.jsx +411 -321
  72. package/template/src/handlers/render.jsx +114 -97
  73. package/template/src/handlers/utils/common.js +28 -22
  74. package/template/src/index.jsx +3 -2
  75. package/template/src/pages/app.tpl +26 -25
  76. package/template/src/utils/formatEnum.js +42 -0
@@ -5,6 +5,7 @@ import store, { subPackageName } from '../store';
5
5
  import computed from '../store/computed';
6
6
  import common from './common';
7
7
  import { formatDate } from '../utils/date';
8
+ import { formatEnum, enumOptions } from '../utils/formatEnum';
8
9
  import { getter, setter, _isMobile } from '../utils';
9
10
  import actionMap from './material-actions';
10
11
  import { scanCodeApi } from '../utils/scan-code-action';
@@ -16,6 +17,9 @@ export const app = createGlboalApi();
16
17
  export const $page = createPageApi();
17
18
 
18
19
  export function setCurrentPage(pageCtx) {
20
+ try {
21
+ app.__internal__.activePage = pageCtx
22
+ } catch(e) { }
19
23
  Object.assign($page, pageCtx);
20
24
  }
21
25
 
@@ -24,6 +28,12 @@ function createGlboalApi() {
24
28
  id: '<%= appId %>',
25
29
  domain: '<%= domain %>',
26
30
  platform: 'WEB',
31
+ __internal__: {
32
+ activePage: null,
33
+ getConfig: function () {
34
+ return <%= appConfig %>;
35
+ },
36
+ },
27
37
  formActions: {},
28
38
  pages: {},
29
39
  session: {
@@ -31,12 +41,13 @@ function createGlboalApi() {
31
41
  request: sdk.request,
32
42
  getSessionId: sdk.getSessionId,
33
43
  },
44
+ enumOptions: enumOptions,
34
45
  state: store,
35
46
  computed: createComputed(computed.global),
36
47
  common,
37
48
  dataSources: DS_SDK,
38
49
  relaunchHome: function () {
39
- const { pages = [] } = globalAPI.utils._getConfig();
50
+ const { pages = [] } = globalAPI.__internal__.getConfig();
40
51
  if (pages[0]) {
41
52
  globalAPI.reLaunch({
42
53
  pageId: pages[0].id,
@@ -45,15 +56,19 @@ function createGlboalApi() {
45
56
  },
46
57
  utils: {
47
58
  formatDate,
59
+ formatEnum,
48
60
  get: getter,
49
61
  set: setter,
50
- _getConfig: function () {
51
- return <%= appConfig %>;
62
+ /**
63
+ * @deprecated
64
+ */
65
+ _getConfig(){
66
+ return globalAPI.__internal__.getConfig()
52
67
  },
53
- getWXContext: function() {
68
+ getWXContext: function () {
54
69
  return Promise.resolve({})
55
70
  },
56
- getCurrentPage: function(){
71
+ getCurrentPage: function () {
57
72
  return $page
58
73
  },
59
74
  },