formiojs-eorion 0.1.16 → 0.1.17

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/Formio.js CHANGED
@@ -1724,7 +1724,7 @@ Formio.projectUrlSet = false;
1724
1724
  Formio.plugins = [];
1725
1725
  Formio.cache = {};
1726
1726
  Formio.Providers = _providers.default;
1727
- Formio.version = '0.1.16';
1727
+ Formio.version = '0.1.17';
1728
1728
  Formio.pathType = '';
1729
1729
  Formio.events = new _EventEmitter.default();
1730
1730
  Formio.cdn = new _CDN.default();
@@ -159,6 +159,21 @@ var _default = [{
159
159
  }, ['openPage', 'bottomSheet']]
160
160
  }
161
161
  }
162
+ }, {
163
+ type: "textarea",
164
+ label: "Page Params",
165
+ key: "page_params",
166
+ input: true,
167
+ weight: 140,
168
+ editor: "ace",
169
+ tooltip: "传入下个页面的参数(json)",
170
+ conditional: {
171
+ json: {
172
+ in: [{
173
+ var: "data.action"
174
+ }, ["openPage", "bottomSheet"]]
175
+ }
176
+ }
162
177
  }, {
163
178
  type: 'datagrid',
164
179
  key: 'headers',
@@ -89,12 +89,27 @@ var DataChinaGrid = /*#__PURE__*/function (_Component) {
89
89
  if (clickEventType) {
90
90
  this.addEventListener(dataContainer, 'click', function (event) {
91
91
  // 点击事件
92
+ var params;
92
93
  switch (clickEventType) {
93
94
  case 'newPage':
94
- window.openNewPage(_this2.component['click-event-form-id']);
95
+ try {
96
+ params = JSON.parse(_this2.parseTpl(_this2.component['page_params'], {
97
+ data: _this2.rootValue
98
+ }));
99
+ } catch (e) {
100
+ console.log("json\u8F6C\u6362\u5931\u8D25:".concat(e));
101
+ }
102
+ window.openNewPage(_this2.component['click-event-form-id'], params);
95
103
  break;
96
104
  case 'bottomSheet':
97
- window.openBottomSheet(_this2.component['click-event-form-id']);
105
+ try {
106
+ params = JSON.parse(_this2.parseTpl(_this2.component['page_params'], {
107
+ data: _this2.rootValue
108
+ }));
109
+ } catch (e) {
110
+ console.log("json\u8F6C\u6362\u5931\u8D25:".concat(e));
111
+ }
112
+ window.openBottomSheet(_this2.component['click-event-form-id'], params);
98
113
  break;
99
114
  case 'setTab':
100
115
  // 切换tab
@@ -392,6 +392,20 @@ var _default = [{
392
392
  validate: {
393
393
  required: true
394
394
  }
395
+ }, {
396
+ type: "textarea",
397
+ label: "Page Params",
398
+ key: "page_params",
399
+ input: true,
400
+ editor: "ace",
401
+ tooltip: "传入下个页面的参数(json)",
402
+ conditional: {
403
+ json: {
404
+ in: [{
405
+ var: "data.click-event-type"
406
+ }, ["newPage", "bottomSheet"]]
407
+ }
408
+ }
395
409
  }, {
396
410
  type: 'input',
397
411
  label: '流程定义keys',
@@ -90,12 +90,27 @@ var DataChinaGridRow = /*#__PURE__*/function (_Component) {
90
90
  if (clickEventType) {
91
91
  this.addEventListener(dataContainer, 'click', function (event) {
92
92
  // 点击事件
93
+ var params;
93
94
  switch (clickEventType) {
94
95
  case 'newPage':
95
- window.openNewPage(_this2.component['click-event-form-id']);
96
+ try {
97
+ params = JSON.parse(_this2.parseTpl(_this2.component['page_params'], {
98
+ data: _this2.rootValue
99
+ }));
100
+ } catch (e) {
101
+ console.log("json\u8F6C\u6362\u5931\u8D25:".concat(e));
102
+ }
103
+ window.openNewPage(_this2.component['click-event-form-id'], params);
96
104
  break;
97
105
  case 'bottomSheet':
98
- window.openBottomSheet(_this2.component['click-event-form-id']);
106
+ try {
107
+ params = JSON.parse(_this2.parseTpl(_this2.component['page_params'], {
108
+ data: _this2.rootValue
109
+ }));
110
+ } catch (e) {
111
+ console.log("json\u8F6C\u6362\u5931\u8D25:".concat(e));
112
+ }
113
+ window.openBottomSheet(_this2.component['click-event-form-id'], params);
99
114
  break;
100
115
  case 'setTab':
101
116
  // 切换tab
@@ -399,6 +399,20 @@ var _default = [{
399
399
  validate: {
400
400
  required: true
401
401
  }
402
+ }, {
403
+ type: "textarea",
404
+ label: "Page Params",
405
+ key: "page_params",
406
+ input: true,
407
+ editor: "ace",
408
+ tooltip: "传入下个页面的参数(json)",
409
+ conditional: {
410
+ json: {
411
+ in: [{
412
+ var: "data.click-event-type"
413
+ }, ["newPage", "bottomSheet"]]
414
+ }
415
+ }
402
416
  }, {
403
417
  type: 'input',
404
418
  label: '流程定义keys',
@@ -108,7 +108,6 @@ var _default = [{
108
108
  key: "request.body",
109
109
  input: true,
110
110
  editor: "ace",
111
- as: "json",
112
111
  placeholder: "{\n \"token\": \"${data.token}\"\n }",
113
112
  tooltip: "输入请求的body(json)",
114
113
  conditional: {
@@ -24,6 +24,7 @@ require("core-js/modules/es.string.replace.js");
24
24
  require("core-js/modules/es.regexp.constructor.js");
25
25
  require("core-js/modules/es.regexp.to-string.js");
26
26
  require("core-js/modules/es.string.search.js");
27
+ require("core-js/modules/es.string.trim.js");
27
28
  require("core-js/modules/es.array.concat.js");
28
29
  require("core-js/modules/es.array.join.js");
29
30
  require("core-js/modules/es.array.map.js");
@@ -328,6 +329,22 @@ var ButtonComponent = /*#__PURE__*/function (_Field) {
328
329
  }
329
330
  _get(_getPrototypeOf(ButtonComponent.prototype), "detach", this).call(this);
330
331
  }
332
+ }, {
333
+ key: "parseTpl",
334
+ value: function parseTpl(template, map) {
335
+ return template.replace(/\$\{.+?}/g, function (match) {
336
+ var path = match.substr(2, match.length - 3).trim();
337
+ var strTmp = _lodash.default.get(map, path);
338
+ if (strTmp === undefined) {
339
+ strTmp = null;
340
+ } else {
341
+ if (_lodash.default.isArray(strTmp) || _lodash.default.isObject(strTmp)) {
342
+ strTmp = JSON.stringify(strTmp);
343
+ }
344
+ }
345
+ return strTmp;
346
+ });
347
+ }
331
348
  }, {
332
349
  key: "onClick",
333
350
  value: function onClick(event) {
@@ -340,6 +357,7 @@ var ButtonComponent = /*#__PURE__*/function (_Field) {
340
357
  if (this.component.action !== 'submit' && this.component.showValidations) {
341
358
  this.emit('checkValidity', this.data);
342
359
  }
360
+ var params;
343
361
  switch (this.component.action) {
344
362
  case 'saveState':
345
363
  case 'submit':
@@ -418,10 +436,24 @@ var ButtonComponent = /*#__PURE__*/function (_Field) {
418
436
  this.openOauth(this.oauthConfig);
419
437
  break;
420
438
  case 'openPage':
421
- window.openNewPage(this.component['page']);
439
+ try {
440
+ params = JSON.parse(this.parseTpl(this.component['page_params'], {
441
+ data: this.rootValue
442
+ }));
443
+ } catch (e) {
444
+ console.log("json\u8F6C\u6362\u5931\u8D25:".concat(e));
445
+ }
446
+ window.openNewPage(this.component['page'], params);
422
447
  break;
423
448
  case 'bottomSheet':
424
- window.openBottomSheet(this.component['page']);
449
+ try {
450
+ params = JSON.parse(this.parseTpl(this.component['page_params'], {
451
+ data: this.rootValue
452
+ }));
453
+ } catch (e) {
454
+ console.log("json\u8F6C\u6362\u5931\u8D25:".concat(e));
455
+ }
456
+ window.openBottomSheet(this.component['page'], params);
425
457
  break;
426
458
  case 'newIntent':
427
459
  var elink = document.createElement('a');
@@ -77,12 +77,27 @@ var IconButton = /*#__PURE__*/function (_FieldComponent) {
77
77
  if (clickEventType) {
78
78
  this.addEventListener(dataContainer, 'click', function (event) {
79
79
  // 点击事件
80
+ var params;
80
81
  switch (clickEventType) {
81
82
  case 'newPage':
82
- window.openNewPage(_this.component['click-event-form-id']);
83
+ try {
84
+ params = JSON.parse(_this.parseTpl(_this.component['page_params'], {
85
+ data: _this.rootValue
86
+ }));
87
+ } catch (e) {
88
+ console.log("json\u8F6C\u6362\u5931\u8D25:".concat(e));
89
+ }
90
+ window.openNewPage(_this.component['click-event-form-id'], params);
83
91
  break;
84
92
  case 'bottomSheet':
85
- window.openBottomSheet(_this.component['click-event-form-id']);
93
+ try {
94
+ params = JSON.parse(_this.parseTpl(_this.component['page_params'], {
95
+ data: _this.rootValue
96
+ }));
97
+ } catch (e) {
98
+ console.log("json\u8F6C\u6362\u5931\u8D25:".concat(e));
99
+ }
100
+ window.openBottomSheet(_this.component['click-event-form-id'], params);
86
101
  break;
87
102
  case 'newIntent':
88
103
  var elink = document.createElement('a');
@@ -96,6 +96,20 @@ var _default = [{
96
96
  validate: {
97
97
  required: true
98
98
  }
99
+ }, {
100
+ type: "textarea",
101
+ label: "Page Params",
102
+ key: "page_params",
103
+ input: true,
104
+ editor: "ace",
105
+ tooltip: "传入下个页面的参数(json)",
106
+ conditional: {
107
+ json: {
108
+ in: [{
109
+ var: "data.click-event-type"
110
+ }, ["newPage", "bottomSheet"]]
111
+ }
112
+ }
99
113
  }, {
100
114
  type: 'input',
101
115
  label: 'Url',
@@ -155,7 +155,6 @@ var _default = [{
155
155
  key: "request.body",
156
156
  input: true,
157
157
  editor: "ace",
158
- as: "json",
159
158
  placeholder: "{\n \"token\": \"${data.token}\"\n }",
160
159
  tooltip: "输入请求的body(json)",
161
160
  conditional: {