formiojs-eorion 0.1.32 → 0.1.34

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.32';
1727
+ Formio.version = '0.1.34';
1728
1728
  Formio.pathType = '';
1729
1729
  Formio.events = new _EventEmitter.default();
1730
1730
  Formio.cdn = new _CDN.default();
@@ -19,8 +19,8 @@ require("core-js/modules/es.string.trim.js");
19
19
  require("core-js/modules/es.array.join.js");
20
20
  require("core-js/modules/es.array.map.js");
21
21
  require("core-js/modules/es.number.constructor.js");
22
- require("core-js/modules/es.string.ends-with.js");
23
22
  require("core-js/modules/es.array.concat.js");
23
+ require("core-js/modules/es.string.ends-with.js");
24
24
  require("core-js/modules/es.regexp.exec.js");
25
25
  require("core-js/modules/es.string.replace.js");
26
26
  require("core-js/modules/es.array.find.js");
@@ -123,11 +123,17 @@ var Data = /*#__PURE__*/function (_Component) {
123
123
  var _this2 = this;
124
124
  var self = this;
125
125
  var refs = {
126
- dataContainer: 'single'
126
+ dataContainer: 'single',
127
+ refHeader: 'single',
128
+ refSubHeader: 'single',
129
+ refValue: 'single',
130
+ refSubValue: 'single'
127
131
  };
128
132
  this.loadRefs(element, refs);
129
133
  var dataContainer = this.refs.dataContainer;
130
134
  if (dataContainer) {
135
+ var rect = dataContainer.getBoundingClientRect();
136
+ this.refs.dataContainer.style['background-size'] = "".concat(rect.width, "px ").concat(rect.height, "px");
131
137
  var clickEventType = this.component['click-event-type'];
132
138
  if (clickEventType) {
133
139
  var clickEventUrl;
@@ -185,6 +191,56 @@ var Data = /*#__PURE__*/function (_Component) {
185
191
  });
186
192
  }
187
193
  }
194
+ var customStyleStr = this.component['custom-style-bg'];
195
+ if (customStyleStr && customStyleStr.length > 0) {
196
+ try {
197
+ _lodash.default.forEach(JSON.parse(customStyleStr), function (value, key) {
198
+ _this2.refs.dataContainer.style[key] = value;
199
+ });
200
+ } catch (e) {
201
+ console.warn(e);
202
+ }
203
+ }
204
+ customStyleStr = this.component['custom-style-title'];
205
+ if (customStyleStr && customStyleStr.length > 0) {
206
+ try {
207
+ _lodash.default.forEach(JSON.parse(customStyleStr), function (value, key) {
208
+ _this2.refs.refHeader.style[key] = value;
209
+ });
210
+ } catch (e) {
211
+ console.warn(e);
212
+ }
213
+ }
214
+ customStyleStr = this.component['custom-style-sub-title'];
215
+ if (customStyleStr && customStyleStr.length > 0) {
216
+ try {
217
+ _lodash.default.forEach(JSON.parse(customStyleStr), function (value, key) {
218
+ _this2.refs.refSubHeader.style[key] = value;
219
+ });
220
+ } catch (e) {
221
+ console.warn(e);
222
+ }
223
+ }
224
+ customStyleStr = this.component['custom-style-value'];
225
+ if (customStyleStr && customStyleStr.length > 0) {
226
+ try {
227
+ _lodash.default.forEach(JSON.parse(customStyleStr), function (value, key) {
228
+ _this2.refs.refValue.style[key] = value;
229
+ });
230
+ } catch (e) {
231
+ console.warn(e);
232
+ }
233
+ }
234
+ customStyleStr = this.component['custom-style-sub-value'];
235
+ if (customStyleStr && customStyleStr.length > 0) {
236
+ try {
237
+ _lodash.default.forEach(JSON.parse(customStyleStr), function (value, key) {
238
+ _this2.refs.refSubValue.style[key] = value;
239
+ });
240
+ } catch (e) {
241
+ console.warn(e);
242
+ }
243
+ }
188
244
  setTimeout(function () {
189
245
  _this2.setValue('');
190
246
  }, 100);
@@ -6,26 +6,53 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _default = [{
8
8
  type: 'input',
9
- label: 'Title',
9
+ label: '标题',
10
10
  key: 'header',
11
11
  input: true,
12
12
  tooltip: '',
13
13
  weight: 1
14
+ }, {
15
+ type: 'textarea',
16
+ label: '自定义标题样式',
17
+ key: 'custom-style-title',
18
+ editor: 'ace',
19
+ input: true,
20
+ defaultValue: '',
21
+ tooltip: '自定义的style:json格式,ex:{"border":"none","border-radius":"30px"}',
22
+ weight: 1
14
23
  }, {
15
24
  type: 'input',
16
- label: 'Sub Title',
25
+ label: '副标题',
17
26
  key: 'sub-header',
18
27
  input: true,
19
28
  tooltip: '',
20
29
  weight: 1
30
+ }, {
31
+ type: 'textarea',
32
+ label: '自定义副标题样式',
33
+ key: 'custom-style-sub-title',
34
+ editor: 'ace',
35
+ input: true,
36
+ defaultValue: '',
37
+ tooltip: '自定义的style:json格式,ex:{"border":"none","border-radius":"30px"}',
38
+ weight: 1
21
39
  }, {
22
40
  type: 'input',
23
- label: 'BackgroundColor',
41
+ label: '背景颜色',
24
42
  key: 'bgColor',
25
43
  input: true,
26
44
  tooltip: '',
27
45
  weight: 2,
28
46
  defaultValue: '#ffffff'
47
+ }, {
48
+ type: 'textarea',
49
+ label: '自定义背景样式',
50
+ key: 'custom-style-bg',
51
+ editor: 'ace',
52
+ input: true,
53
+ defaultValue: '',
54
+ tooltip: '自定义的style:json格式,ex:{"border":"none","border-radius":"30px"}',
55
+ weight: 2
29
56
  }, {
30
57
  type: 'panel',
31
58
  title: 'Icon',
@@ -58,27 +85,27 @@ var _default = [{
58
85
  input: true,
59
86
  tooltip: ''
60
87
  }, {
61
- type: "datagrid",
88
+ type: 'datagrid',
62
89
  input: true,
63
- label: "Request Headers",
64
- key: "new-value-headers",
90
+ label: 'Request Headers',
91
+ key: 'new-value-headers',
65
92
  defaultValue: [{
66
- key: "",
67
- value: ""
93
+ key: '',
94
+ value: ''
68
95
  }],
69
96
  components: [{
70
- label: "Key",
71
- key: "key",
97
+ label: 'Key',
98
+ key: 'key',
72
99
  input: true,
73
- type: "textfield",
100
+ type: 'textfield',
74
101
  validate: {
75
102
  required: true
76
103
  }
77
104
  }, {
78
- label: "Value",
79
- key: "value",
105
+ label: 'Value',
106
+ key: 'value',
80
107
  input: true,
81
- type: "textfield",
108
+ type: 'textfield',
82
109
  validate: {
83
110
  required: true
84
111
  }
@@ -95,6 +122,14 @@ var _default = [{
95
122
  key: 'value-color',
96
123
  input: true,
97
124
  tooltip: ''
125
+ }, {
126
+ type: 'textarea',
127
+ label: '自定义样式',
128
+ key: 'custom-style-value',
129
+ editor: 'ace',
130
+ input: true,
131
+ defaultValue: '',
132
+ tooltip: '自定义的style:json格式,ex:{"border":"none","border-radius":"30px"}'
98
133
  }]
99
134
  }, {
100
135
  type: 'panel',
@@ -120,6 +155,14 @@ var _default = [{
120
155
  key: 'subValue-color',
121
156
  input: true,
122
157
  tooltip: ''
158
+ }, {
159
+ type: 'textarea',
160
+ label: '自定义样式',
161
+ key: 'custom-style-sub-value',
162
+ editor: 'ace',
163
+ input: true,
164
+ defaultValue: '',
165
+ tooltip: '自定义的style:json格式,ex:{"border":"none","border-radius":"30px"}'
123
166
  }]
124
167
  }, {
125
168
  type: 'panel',
@@ -206,27 +249,27 @@ var _default = [{
206
249
  }
207
250
  }
208
251
  }, {
209
- type: "datagrid",
252
+ type: 'datagrid',
210
253
  input: true,
211
- label: "Request Headers",
212
- key: "new-sparkLine-headers",
254
+ label: 'Request Headers',
255
+ key: 'new-sparkLine-headers',
213
256
  defaultValue: [{
214
- key: "",
215
- value: ""
257
+ key: '',
258
+ value: ''
216
259
  }],
217
260
  components: [{
218
- label: "Key",
219
- key: "key",
261
+ label: 'Key',
262
+ key: 'key',
220
263
  input: true,
221
- type: "textfield",
264
+ type: 'textfield',
222
265
  validate: {
223
266
  required: true
224
267
  }
225
268
  }, {
226
- label: "Value",
227
- key: "value",
269
+ label: 'Value',
270
+ key: 'value',
228
271
  input: true,
229
- type: "textfield",
272
+ type: 'textfield',
230
273
  validate: {
231
274
  required: true
232
275
  }
@@ -327,14 +370,19 @@ var _default = [{
327
370
  label: '事件类型',
328
371
  dataSrc: 'values'
329
372
  }, {
330
- label: "锁定抽屉",
331
- key: "click-event-lock-drawer",
332
- type: "checkbox",
373
+ label: '显示跳转图标',
374
+ key: 'click-event-show-icon',
375
+ type: 'checkbox',
376
+ defaultValue: true
377
+ }, {
378
+ label: '锁定抽屉',
379
+ key: 'click-event-lock-drawer',
380
+ type: 'checkbox',
333
381
  conditional: {
334
382
  json: {
335
383
  in: [{
336
- var: "data.click-event-type"
337
- }, ["newProcessInstance"]]
384
+ var: 'data.click-event-type'
385
+ }, ['newProcessInstance']]
338
386
  }
339
387
  }
340
388
  }, {
@@ -109,6 +109,22 @@ var HTMLComponent = /*#__PURE__*/function (_Component) {
109
109
  singleTags: this.singleTags
110
110
  });
111
111
  }
112
+ }, {
113
+ key: "parseTpl",
114
+ value: function parseTpl(template, map) {
115
+ if (template && template.length > 0) {
116
+ try {
117
+ return template.replace(/\$\{.+?}/g, function (match) {
118
+ var _$get;
119
+ var path = match.substr(2, match.length - 3).trim();
120
+ return (_$get = _lodash.default.get(map, path)) !== null && _$get !== void 0 ? _$get : '--';
121
+ });
122
+ } catch (e) {
123
+ console.log(e);
124
+ }
125
+ }
126
+ return '{}';
127
+ }
112
128
  }, {
113
129
  key: "render",
114
130
  value: function render() {
@@ -117,9 +133,58 @@ var HTMLComponent = /*#__PURE__*/function (_Component) {
117
133
  }, {
118
134
  key: "attach",
119
135
  value: function attach(element) {
136
+ var _this2 = this;
137
+ var self = this;
120
138
  this.loadRefs(element, {
121
139
  html: 'single'
122
140
  });
141
+ var dataContainer = this.refs.html;
142
+ if (dataContainer) {
143
+ var clickEventType = this.component['click-event-type'];
144
+ if (clickEventType) {
145
+ this.addEventListener(dataContainer, 'click', function (event) {
146
+ // 点击事件
147
+ var params;
148
+ switch (clickEventType) {
149
+ case 'newPage':
150
+ try {
151
+ params = JSON.parse(_this2.parseTpl(_this2.component['page_params'], {
152
+ data: _this2.rootValue
153
+ }));
154
+ } catch (e) {
155
+ console.log("json\u8F6C\u6362\u5931\u8D25:".concat(e));
156
+ }
157
+ window.openNewPage(_this2.component['click-event-form-id'], params);
158
+ break;
159
+ case 'bottomSheet':
160
+ try {
161
+ params = JSON.parse(_this2.parseTpl(_this2.component['page_params'], {
162
+ data: _this2.rootValue
163
+ }));
164
+ } catch (e) {
165
+ console.log("json\u8F6C\u6362\u5931\u8D25:".concat(e));
166
+ }
167
+ window.openBottomSheet(_this2.component['click-event-form-id'], params);
168
+ break;
169
+ case 'setTab':
170
+ // 切换tab
171
+ Formio.forms[_this2.currentForm.id].getComponent(_this2.component['click-event-tab-id']).setTabByKey(_this2.component['click-event-tab-key']);
172
+ break;
173
+ case 'openUrl':
174
+ if (window.openNewUrlByQmx) {
175
+ window.openNewUrlByQmx(_this2.parseTpl(_this2.component['click-event-url'], {
176
+ data: _this2.rootValue
177
+ }));
178
+ } else {
179
+ window.open(_this2.parseTpl(_this2.component['click-event-url'], {
180
+ data: _this2.rootValue
181
+ }));
182
+ }
183
+ break;
184
+ }
185
+ });
186
+ }
187
+ }
123
188
  return _get(_getPrototypeOf(HTMLComponent.prototype), "attach", this).call(this, element);
124
189
  }
125
190
  }], [{
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+ require("core-js/modules/es.object.to-string.js");
8
+ require("core-js/modules/web.dom-collections.for-each.js");
7
9
  var _default = [{
8
10
  key: 'labelPosition',
9
11
  ignore: true
@@ -76,6 +78,186 @@ var _default = [{
76
78
  defaultValue: '<div class="well">Content</div>',
77
79
  key: 'content',
78
80
  weight: 80
81
+ }, {
82
+ type: 'panel',
83
+ title: '点击事件',
84
+ collapsible: true,
85
+ collapsed: false,
86
+ weight: 80,
87
+ components: [{
88
+ key: 'click-event-type',
89
+ data: {
90
+ values: [{
91
+ label: '跳转新页面',
92
+ value: 'newPage'
93
+ }, {
94
+ label: '打开弹窗',
95
+ value: 'bottomSheet'
96
+ }, {
97
+ label: '切换标签',
98
+ value: 'setTab'
99
+ }, {
100
+ label: 'Open URL',
101
+ value: 'openUrl'
102
+ }]
103
+ },
104
+ type: 'select',
105
+ input: true,
106
+ label: '事件类型',
107
+ dataSrc: 'values'
108
+ }, {
109
+ type: 'input',
110
+ label: 'Url',
111
+ key: 'click-event-url',
112
+ input: true,
113
+ tooltip: '',
114
+ conditional: {
115
+ json: {
116
+ in: [{
117
+ var: 'data.click-event-type'
118
+ }, ['newIntent', 'openUrl']]
119
+ }
120
+ },
121
+ validate: {
122
+ required: true
123
+ }
124
+ }, {
125
+ type: 'select',
126
+ input: true,
127
+ key: 'click-event-tab-id',
128
+ label: '选择切换的tabs',
129
+ dataSrc: 'custom',
130
+ valueProperty: 'value',
131
+ data: {
132
+ custom: function custom(context) {
133
+ var values = [];
134
+ context.utils.eachComponent(context.instance.options.editForm.components, function (component, path) {
135
+ if (component.key !== context.data.key && component.type === 'customTabs') {
136
+ values.push({
137
+ label: component.label || component.key,
138
+ value: path
139
+ });
140
+ }
141
+ }, true);
142
+ return values;
143
+ }
144
+ },
145
+ conditional: {
146
+ json: {
147
+ in: [{
148
+ var: 'data.click-event-type'
149
+ }, ['setTab']]
150
+ }
151
+ }
152
+ }, {
153
+ type: 'select',
154
+ input: true,
155
+ key: 'click-event-tab-key',
156
+ label: '选择切换到的tab位置',
157
+ dataSrc: 'custom',
158
+ valueProperty: 'value',
159
+ data: {
160
+ custom: function custom(context) {
161
+ var values = [];
162
+ context.utils.eachComponent(context.instance.options.editForm.components, function (component, path) {
163
+ if (component.key === context.data['click-event-tab-id']) {
164
+ component.components.forEach(function (tab) {
165
+ values.push({
166
+ label: tab.label || tab.key,
167
+ value: tab.key
168
+ });
169
+ });
170
+ }
171
+ }, true);
172
+ return values;
173
+ }
174
+ },
175
+ conditional: {
176
+ json: {
177
+ in: [{
178
+ var: 'data.click-event-type'
179
+ }, ['setTab']]
180
+ }
181
+ }
182
+ }, {
183
+ type: 'input',
184
+ label: 'FormId',
185
+ key: 'click-event-form-id',
186
+ input: true,
187
+ tooltip: '',
188
+ conditional: {
189
+ json: {
190
+ in: [{
191
+ var: 'data.click-event-type'
192
+ }, ['newPage', 'bottomSheet']]
193
+ }
194
+ },
195
+ validate: {
196
+ required: true
197
+ }
198
+ }, {
199
+ type: "textarea",
200
+ label: "Page Params",
201
+ key: "page_params",
202
+ input: true,
203
+ editor: "ace",
204
+ tooltip: "传入下个页面的参数(json)",
205
+ conditional: {
206
+ json: {
207
+ in: [{
208
+ var: "data.click-event-type"
209
+ }, ["newPage", "bottomSheet"]]
210
+ }
211
+ }
212
+ }, {
213
+ type: 'input',
214
+ label: '流程定义keys',
215
+ key: 'click-event-process-def-keys',
216
+ input: true,
217
+ tooltip: '',
218
+ conditional: {
219
+ json: {
220
+ in: [{
221
+ var: 'data.click-event-type'
222
+ }, ['processDefList', 'taskListPanel']]
223
+ }
224
+ },
225
+ validate: {
226
+ required: true
227
+ }
228
+ }, {
229
+ type: 'input',
230
+ label: '流程定义keys',
231
+ key: 'click-event-task-keys',
232
+ input: true,
233
+ tooltip: '',
234
+ conditional: {
235
+ json: {
236
+ '===': [{
237
+ var: 'data.click-event-type'
238
+ }, 'taskList']
239
+ }
240
+ },
241
+ validate: {
242
+ required: true
243
+ }
244
+ }, {
245
+ type: 'input',
246
+ label: '流程定义key',
247
+ key: 'click-event-process-def-key',
248
+ input: true,
249
+ tooltip: '',
250
+ conditional: {
251
+ json: {
252
+ '===': [{
253
+ var: 'data.click-event-type'
254
+ }, 'newProcessInstance']
255
+ }
256
+ },
257
+ validate: {
258
+ required: true
259
+ }
260
+ }]
79
261
  }, {
80
262
  weight: 85,
81
263
  type: 'checkbox',
@@ -1062,12 +1062,6 @@ td > .form-group {
1062
1062
  z-index: 100;
1063
1063
  }
1064
1064
 
1065
- .choices__list--dropdown {
1066
- position: fixed;
1067
- width: unset;
1068
- top: unset;
1069
- }
1070
-
1071
1065
  .component-edit-container .choices__list--dropdown {
1072
1066
  position: absolute;
1073
1067
  width: 100%;