@cloudbase/lowcode-builder 0.0.2 → 0.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/lowcode-builder",
3
- "version": "0.0.2",
3
+ "version": "0.1.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",
@@ -64,6 +64,7 @@
64
64
  "csstype": "^2.6.10",
65
65
  "jest": "^26.0.1",
66
66
  "ts-jest": "^27.0.5",
67
+ "ts-node": "^10.4.0",
67
68
  "typescript": "^4.4.2"
68
69
  }
69
70
  }
@@ -17,6 +17,7 @@ export function createPage(
17
17
  dataBinds,
18
18
  app,
19
19
  handler,
20
+ pageContext = {}
20
21
  ) {
21
22
  const evtHandlers = createEventHandlers(evtListeners);
22
23
 
@@ -119,12 +120,13 @@ export function createPage(
119
120
  getWeAppInst() {
120
121
  let $page = this.$WEAPPS_PAGE
121
122
  if ($page) { return $page }
122
- $page = {
123
+ Object.assign(pageContext, {
123
124
  id,
124
125
  uuid,
125
126
  state: observable(pageState),
126
127
  widgets: {}
127
- }
128
+ })
129
+ $page = pageContext;
128
130
  this.$WEAPPS_PAGE = $page
129
131
  $page.handler = Object.keys(handler).reduce((result, key) => {
130
132
  result[key] = handler[key].bind($page)
@@ -7,6 +7,7 @@
7
7
  "mobx": "^5.15.4",
8
8
  "lodash.get": "^4.4.2",
9
9
  "lodash.set": "^4.3.2",
10
+ "miniprogram-gesture": "^1.0.6",
10
11
  "miniprogram-api-promise": "^1.0.4"<% Object.keys(extraDeps).map(depName => {%>,
11
12
  "<%= depName%>": "<%= extraDeps[depName]%>"<%})
12
13
  %>
@@ -0,0 +1 @@
1
+ export const $page = {};
@@ -6,8 +6,9 @@ import { <%= pageName %> as handlers } from '../../app/handlers'
6
6
  import lifecyle from '../../lowcode/<%= pageName %>/lifecycle'
7
7
  import state from '../../lowcode/<%= pageName %>/state'
8
8
  import computed from '../../lowcode/<%= pageName %>/computed'
9
-
9
+ import { $page } from './api'
10
10
  const $app = app;
11
+
11
12
  const widgetProps = <%= stringifyObj(widgetProps, {depth: null}) %>
12
13
  /** widget event listeners **/
13
14
  const evtListeners = {<% Object.entries(eventHanlders).map(([handlerName, listeners])=>{%>
@@ -27,4 +28,4 @@ const dataBinds = {<% Object.entries(dataBinds).map(([id, widgetBinds])=>{%>
27
28
  },<%}) %>
28
29
  }
29
30
 
30
- createPage('<%= pageName %>', '<%= pageUUID %>', widgetProps, {}, lifecyle, state, computed, evtListeners, dataBinds, app, handlers)
31
+ createPage('<%= pageName %>', '<%= pageUUID %>', widgetProps, {}, lifecyle, state, computed, evtListeners, dataBinds, app, handlers, $page)