formiojs-eorion 0.1.6 → 0.1.8

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.6';
1727
+ Formio.version = '0.1.8';
1728
1728
  Formio.pathType = '';
1729
1729
  Formio.events = new _EventEmitter.default();
1730
1730
  Formio.cdn = new _CDN.default();
@@ -26,8 +26,8 @@ require("core-js/modules/es.array.map.js");
26
26
  require("core-js/modules/es.object.to-string.js");
27
27
  require("core-js/modules/web.dom-collections.for-each.js");
28
28
  require("core-js/modules/es.array.find-index.js");
29
- require("core-js/modules/es.array.filter.js");
30
29
  require("core-js/modules/es.array.includes.js");
30
+ require("core-js/modules/es.array.filter.js");
31
31
  require("core-js/modules/es.string.includes.js");
32
32
  require("core-js/modules/es.object.get-prototype-of.js");
33
33
  var _lodash = _interopRequireDefault(require("lodash"));
@@ -294,12 +294,20 @@ var CustomTabsComponent = /*#__PURE__*/function (_NestedComponent) {
294
294
  }, {
295
295
  key: "handleTabsValidation",
296
296
  value: function handleTabsValidation() {
297
+ var _this11 = this;
297
298
  if (!this.refs[this.tabLinkKey] || !this.refs[this.tabLinkKey].length || !this.tabs.length) {
298
299
  return;
299
300
  }
300
301
  // 切换tab时,刷新taskCalendar组件,修复taskCalendar在tab中高度错乱的问题
301
- if (this.tabs[this.currentTab] && this.tabs[this.currentTab].length > 0 && this.tabs[this.currentTab][0].type === 'taskCalendar') {
302
- this.tabs[this.currentTab][0].refresh(new Date().getTime());
302
+ if (this.tabs[this.currentTab] && this.tabs[this.currentTab].length > 0) {
303
+ this.tabs[this.currentTab].forEach(function (item, index) {
304
+ if (['echarts', 'taskCalendar'].includes(item.type)) {
305
+ _this11.tabs[_this11.currentTab][index].refresh(new Date().getTime());
306
+ }
307
+ if (['data_china_grid_row', 'data_china_grid'].includes(item.type)) {
308
+ _this11.tabs[_this11.currentTab][index].resetSparkLine();
309
+ }
310
+ });
303
311
  }
304
312
  this.clearErrorClasses(this.refs[this.tabLinkKey]);
305
313
  var invalidTabsIndexes = this.tabs.reduce(function (invalidTabs, tab, tabIndex) {
@@ -135,6 +135,62 @@ var DataChinaGrid = /*#__PURE__*/function (_Component) {
135
135
  value: function getValue() {
136
136
  return this.component.field;
137
137
  }
138
+ }, {
139
+ key: "resetSparkLine",
140
+ value: function resetSparkLine() {
141
+ var self = this;
142
+ var container = this.element.querySelector('.data-container');
143
+ if (self.component['enable-sparkline']) {
144
+ if (self.isLoadingSparkLine) {
145
+ return true;
146
+ }
147
+ self.isLoadingSparkLine = true;
148
+ var sparkLineType = this.component['sparkLine-type'] || 'line';
149
+ var fillColor;
150
+ if (self.component['sparkLine-fill-color']) {
151
+ switch (sparkLineType) {
152
+ case 'line':
153
+ fillColor = self.component['sparkLine-fill-color'].split(',')[0];
154
+ break;
155
+ case 'pie':
156
+ case 'donut':
157
+ case 'bar':
158
+ fillColor = self.component['sparkLine-fill-color'].split(',');
159
+ break;
160
+ }
161
+ }
162
+ // values
163
+ container.querySelector('.sparkline-container').innerHTML = "<span class=\"line\">".concat(self.parseTpl(self.component['sparkLine-value'], {
164
+ data: self.rootValue
165
+ }), "</span>");
166
+ try {
167
+ // @ts-ignore
168
+ $(container).find('.line').peity(sparkLineType, {
169
+ fill: fillColor,
170
+ height: self.component['sparkLine-height'],
171
+ max: self.component['sparkLine-max-value-count'],
172
+ min: 0,
173
+ stroke: self.component['sparkLine-stroke-color'],
174
+ strokeWidth: 2,
175
+ width: self.component['sparkLine-width']
176
+ });
177
+ self.isLoadingSparkLine = false;
178
+ } catch (e) {
179
+ container.querySelectorAll(".line").forEach(function (e) {
180
+ return peity(e, sparkLineType, {
181
+ fill: fillColor,
182
+ height: self.component['sparkLine-height'],
183
+ max: self.component['sparkLine-max-value-count'],
184
+ min: 0,
185
+ stroke: self.component['sparkLine-stroke-color'],
186
+ strokeWidth: 2,
187
+ width: self.component['sparkLine-width']
188
+ });
189
+ });
190
+ self.isLoadingSparkLine = false;
191
+ }
192
+ }
193
+ }
138
194
 
139
195
  /**
140
196
  * Set the value of the component into the dom elements.
@@ -145,9 +201,16 @@ var DataChinaGrid = /*#__PURE__*/function (_Component) {
145
201
  }, {
146
202
  key: "setValue",
147
203
  value: function setValue(value) {
204
+ var _this3 = this;
148
205
  var self = this;
149
206
  try {
150
207
  var container = this.element.querySelector('.data-container');
208
+ try {
209
+ var customStyle = JSON.parse(this.component["custom-style"] || {});
210
+ _lodash.default.forEach(customStyle, function (value, key) {
211
+ _this3.refs.dataContainer.style[key] = value;
212
+ });
213
+ } catch (e) {}
151
214
  // 标题设置
152
215
  var element = container.querySelector('.title-container');
153
216
  element.innerHTML = self.parseTpl(self.component['title-content'], {
@@ -172,56 +235,7 @@ var DataChinaGrid = /*#__PURE__*/function (_Component) {
172
235
  });
173
236
  }
174
237
  // 图标
175
- if (self.component['enable-sparkline']) {
176
- if (self.isLoadingSparkLine) {
177
- return true;
178
- }
179
- self.isLoadingSparkLine = true;
180
- var sparkLineType = this.component['sparkLine-type'] || 'line';
181
- var fillColor;
182
- if (self.component['sparkLine-fill-color']) {
183
- switch (sparkLineType) {
184
- case 'line':
185
- fillColor = self.component['sparkLine-fill-color'].split(',')[0];
186
- break;
187
- case 'pie':
188
- case 'donut':
189
- case 'bar':
190
- fillColor = self.component['sparkLine-fill-color'].split(',');
191
- break;
192
- }
193
- }
194
- // values
195
- container.querySelector('.sparkline-container').innerHTML = "<span class=\"line\">".concat(self.parseTpl(self.component['sparkLine-value'], {
196
- data: self.rootValue
197
- }), "</span>");
198
- try {
199
- // @ts-ignore
200
- $(container).find('.line').peity(sparkLineType, {
201
- fill: fillColor,
202
- height: self.component['sparkLine-height'],
203
- max: self.component['sparkLine-max-value-count'],
204
- min: 0,
205
- stroke: self.component['sparkLine-stroke-color'],
206
- strokeWidth: 2,
207
- width: self.component['sparkLine-width']
208
- });
209
- self.isLoadingSparkLine = false;
210
- } catch (e) {
211
- container.querySelectorAll(".line").forEach(function (e) {
212
- return peity(e, sparkLineType, {
213
- fill: fillColor,
214
- height: self.component['sparkLine-height'],
215
- max: self.component['sparkLine-max-value-count'],
216
- min: 0,
217
- stroke: self.component['sparkLine-stroke-color'],
218
- strokeWidth: 2,
219
- width: self.component['sparkLine-width']
220
- });
221
- });
222
- self.isLoadingSparkLine = false;
223
- }
224
- }
238
+ self.resetSparkLine();
225
239
  } catch (e) {
226
240
  console.log(e);
227
241
  }
@@ -277,6 +277,15 @@ var _default = [{
277
277
  defaultValue: ''
278
278
  }]
279
279
  }]
280
+ }, {
281
+ type: 'textarea',
282
+ label: '自定义样式',
283
+ key: 'custom-style',
284
+ editor: 'ace',
285
+ input: true,
286
+ defaultValue: {},
287
+ tooltip: '自定义的style:json格式,ex:{"border":"none","border-radius":"30px"}',
288
+ weight: 2
280
289
  }, {
281
290
  type: 'input',
282
291
  label: 'BackgroundColor',
@@ -136,6 +136,65 @@ var DataChinaGridRow = /*#__PURE__*/function (_Component) {
136
136
  value: function getValue() {
137
137
  return this.component.field;
138
138
  }
139
+ }, {
140
+ key: "resetSparkLine",
141
+ value: function resetSparkLine() {
142
+ var self = this;
143
+ var container = this.element.querySelector('.data-container');
144
+ if (self.component['enable-sparkline']) {
145
+ if (self.isLoadingSparkLine) {
146
+ return true;
147
+ }
148
+ self.isLoadingSparkLine = true;
149
+ var sparkLineType = this.component['sparkLine-type'] || 'line';
150
+ var fillColor;
151
+ if (self.component['sparkLine-fill-color']) {
152
+ switch (sparkLineType) {
153
+ case 'line':
154
+ fillColor = self.component['sparkLine-fill-color'].split(',')[0];
155
+ break;
156
+ case 'pie':
157
+ case 'donut':
158
+ case 'bar':
159
+ fillColor = self.component['sparkLine-fill-color'].split(',');
160
+ break;
161
+ }
162
+ }
163
+ // values
164
+ container.querySelector('.sparkline-container').innerHTML = "<span class=\"line\">".concat(self.parseTpl(self.component['sparkLine-value'], {
165
+ data: self.rootValue
166
+ }), "</span>");
167
+ // 宽度计算
168
+ var parentWidth = container.querySelector('#sparkline-container-parent').offsetWidth;
169
+ parentWidth = parentWidth * self.component['sparkLine-width'];
170
+ try {
171
+ // @ts-ignore
172
+ (0, _jquery.default)(container).find('.line').peity(sparkLineType, {
173
+ fill: fillColor,
174
+ height: self.component['sparkLine-height'],
175
+ max: self.component['sparkLine-max-value-count'],
176
+ min: 0,
177
+ stroke: self.component['sparkLine-stroke-color'],
178
+ strokeWidth: 2,
179
+ width: parentWidth
180
+ });
181
+ self.isLoadingSparkLine = false;
182
+ } catch (e) {
183
+ container.querySelectorAll(".line").forEach(function (e) {
184
+ return peity(e, sparkLineType, {
185
+ fill: fillColor,
186
+ height: self.component['sparkLine-height'],
187
+ max: self.component['sparkLine-max-value-count'],
188
+ min: 0,
189
+ stroke: self.component['sparkLine-stroke-color'],
190
+ strokeWidth: 2,
191
+ width: parentWidth
192
+ });
193
+ });
194
+ self.isLoadingSparkLine = false;
195
+ }
196
+ }
197
+ }
139
198
 
140
199
  /**
141
200
  * Set the value of the component into the dom elements.
@@ -146,9 +205,16 @@ var DataChinaGridRow = /*#__PURE__*/function (_Component) {
146
205
  }, {
147
206
  key: "setValue",
148
207
  value: function setValue(value) {
208
+ var _this3 = this;
149
209
  var self = this;
150
210
  try {
151
211
  var container = this.element.querySelector('.data-container');
212
+ try {
213
+ var customStyle = JSON.parse(this.component["custom-style"] || {});
214
+ _lodash.default.forEach(customStyle, function (value, key) {
215
+ _this3.refs.dataContainer.style[key] = value;
216
+ });
217
+ } catch (e) {}
152
218
  // 标题设置
153
219
  var element = container.querySelector('.title-container');
154
220
  element.innerHTML = self.parseTpl(self.component['title-content'], {
@@ -173,59 +239,7 @@ var DataChinaGridRow = /*#__PURE__*/function (_Component) {
173
239
  });
174
240
  }
175
241
  // 图标
176
- if (self.component['enable-sparkline']) {
177
- if (self.isLoadingSparkLine) {
178
- return true;
179
- }
180
- self.isLoadingSparkLine = true;
181
- var sparkLineType = this.component['sparkLine-type'] || 'line';
182
- var fillColor;
183
- if (self.component['sparkLine-fill-color']) {
184
- switch (sparkLineType) {
185
- case 'line':
186
- fillColor = self.component['sparkLine-fill-color'].split(',')[0];
187
- break;
188
- case 'pie':
189
- case 'donut':
190
- case 'bar':
191
- fillColor = self.component['sparkLine-fill-color'].split(',');
192
- break;
193
- }
194
- }
195
- // values
196
- container.querySelector('.sparkline-container').innerHTML = "<span class=\"line\">".concat(self.parseTpl(self.component['sparkLine-value'], {
197
- data: self.rootValue
198
- }), "</span>");
199
- // 宽度计算
200
- var parentWidth = container.querySelector('#sparkline-container-parent').offsetWidth;
201
- parentWidth = parentWidth * self.component['sparkLine-width'];
202
- try {
203
- // @ts-ignore
204
- (0, _jquery.default)(container).find('.line').peity(sparkLineType, {
205
- fill: fillColor,
206
- height: self.component['sparkLine-height'],
207
- max: self.component['sparkLine-max-value-count'],
208
- min: 0,
209
- stroke: self.component['sparkLine-stroke-color'],
210
- strokeWidth: 2,
211
- width: parentWidth
212
- });
213
- self.isLoadingSparkLine = false;
214
- } catch (e) {
215
- container.querySelectorAll(".line").forEach(function (e) {
216
- return peity(e, sparkLineType, {
217
- fill: fillColor,
218
- height: self.component['sparkLine-height'],
219
- max: self.component['sparkLine-max-value-count'],
220
- min: 0,
221
- stroke: self.component['sparkLine-stroke-color'],
222
- strokeWidth: 2,
223
- width: parentWidth
224
- });
225
- });
226
- self.isLoadingSparkLine = false;
227
- }
228
- }
242
+ self.resetSparkLine();
229
243
  } catch (e) {
230
244
  console.log(e);
231
245
  }
@@ -202,6 +202,15 @@ var _default = [{
202
202
  defaultValue: '#000000',
203
203
  label: '字体大小'
204
204
  }]
205
+ }, {
206
+ type: 'textarea',
207
+ label: '自定义样式',
208
+ key: 'custom-style',
209
+ editor: 'ace',
210
+ input: true,
211
+ defaultValue: {},
212
+ tooltip: '自定义的style:json格式,ex:{"border":"none","border-radius":"30px"}',
213
+ weight: 3
205
214
  }, {
206
215
  type: 'panel',
207
216
  title: '统计图表',
@@ -49,11 +49,8 @@ var ECharts = /*#__PURE__*/function (_FieldComponent) {
49
49
  _inherits(ECharts, _FieldComponent);
50
50
  var _super = _createSuper(ECharts);
51
51
  function ECharts(component, options, data) {
52
- var _this;
53
52
  _classCallCheck(this, ECharts);
54
- _this = _super.call(this, component, options, data);
55
- _this.chartInstance = null;
56
- return _this;
53
+ return _super.call(this, component, options, data);
57
54
  }
58
55
  _createClass(ECharts, [{
59
56
  key: "render",
@@ -71,11 +68,11 @@ var ECharts = /*#__PURE__*/function (_FieldComponent) {
71
68
  }, {
72
69
  key: "attach",
73
70
  value: function attach(element) {
74
- var _this2 = this;
71
+ var _this = this;
75
72
  var refs = {};
76
73
  this.loadRefs(element, refs);
77
74
  setTimeout(function () {
78
- _this2.setValue();
75
+ _this.setValue();
79
76
  }, 100);
80
77
  return _get(_getPrototypeOf(ECharts.prototype), "attach", this).call(this, element);
81
78
  }
@@ -116,17 +113,18 @@ var ECharts = /*#__PURE__*/function (_FieldComponent) {
116
113
  }, {
117
114
  key: "setValue",
118
115
  value: function setValue(value) {
119
- if (!this.chartInstance) {
116
+ var canvas = this.element.querySelector('#echarts-container');
117
+ var chartInstance = echarts.getInstanceByDom(canvas);
118
+ if (!chartInstance) {
120
119
  // 初始化 ECharts 实例
121
- var canvas = this.element.querySelector('#echarts-container');
122
- this.chartInstance = echarts.init(canvas);
120
+ chartInstance = echarts.init(canvas);
123
121
  }
124
122
  var optionsStr = this.component["option-value"];
125
123
  optionsStr = this.parseTpl(optionsStr, {
126
124
  data: this.rootValue
127
125
  });
128
126
  // 使用配置项渲染图表
129
- this.chartInstance.setOption(JSON.parse(optionsStr), true);
127
+ chartInstance.setOption(JSON.parse(optionsStr), true);
130
128
  return true;
131
129
  }
132
130
  }], [{
@@ -26,8 +26,8 @@ require("core-js/modules/es.array.map.js");
26
26
  require("core-js/modules/es.object.to-string.js");
27
27
  require("core-js/modules/web.dom-collections.for-each.js");
28
28
  require("core-js/modules/es.array.find-index.js");
29
- require("core-js/modules/es.array.filter.js");
30
29
  require("core-js/modules/es.array.includes.js");
30
+ require("core-js/modules/es.array.filter.js");
31
31
  require("core-js/modules/es.string.includes.js");
32
32
  require("core-js/modules/es.object.get-prototype-of.js");
33
33
  var _lodash = _interopRequireDefault(require("lodash"));
@@ -251,12 +251,17 @@ var TabsComponent = /*#__PURE__*/function (_NestedComponent) {
251
251
  }, {
252
252
  key: "handleTabsValidation",
253
253
  value: function handleTabsValidation() {
254
+ var _this9 = this;
254
255
  if (!this.refs[this.tabLinkKey] || !this.refs[this.tabLinkKey].length || !this.tabs.length) {
255
256
  return;
256
257
  }
257
258
  // 切换tab时,刷新taskCalendar组件,修复taskCalendar在tab中高度错乱的问题
258
- if (this.tabs[this.currentTab] && this.tabs[this.currentTab].length > 0 && this.tabs[this.currentTab][0].type === 'taskCalendar') {
259
- this.tabs[this.currentTab][0].refresh(new Date().getTime());
259
+ if (this.tabs[this.currentTab] && this.tabs[this.currentTab].length > 0) {
260
+ this.tabs[this.currentTab].forEach(function (item, index) {
261
+ if (['echarts', 'taskCalendar'].includes(item.type)) {
262
+ _this9.tabs[_this9.currentTab][index].refresh(new Date().getTime());
263
+ }
264
+ });
260
265
  }
261
266
  this.clearErrorClasses(this.refs[this.tabLinkKey]);
262
267
  var invalidTabsIndexes = this.tabs.reduce(function (invalidTabs, tab, tabIndex) {