formiojs-eorion 0.1.0 → 0.1.2
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 +1 -1
- package/components/CustomTabs/Tabs.form.js +22 -0
- package/components/CustomTabs/Tabs.js +355 -0
- package/components/CustomTabs/Tabs.unit.js +43 -0
- package/components/CustomTabs/editForm/Tabs.edit.display.js +112 -0
- package/components/CustomTabs/fixtures/comp1.js +33 -0
- package/components/CustomTabs/fixtures/index.js +13 -0
- package/components/DataChinaGrid/Data.form.js +19 -0
- package/components/DataChinaGrid/Data.js +261 -0
- package/components/DataChinaGrid/editForm/Data.edit.display.js +478 -0
- package/components/DataChinaGridRow/Data.form.js +19 -0
- package/components/DataChinaGridRow/Data.js +266 -0
- package/components/DataChinaGridRow/editForm/Data.edit.display.js +485 -0
- package/components/FileDownload/FileDownload.js +1 -1
- package/components/Flex/editForm/Flex.edit.display.js +12 -0
- package/components/builder.js +6 -0
- package/components/index.js +7 -1
- package/dist/formio.builder.css +23 -0
- package/dist/formio.builder.min.css +1 -1
- package/dist/formio.contrib.js +76 -3
- package/dist/formio.contrib.min.js +1 -1
- package/dist/formio.contrib.min.js.LICENSE.txt +1 -1
- package/dist/formio.embed.min.js.LICENSE.txt +1 -1
- package/dist/formio.form.js +179 -7
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.css +23 -0
- package/dist/formio.full.js +179 -7
- package/dist/formio.full.min.css +1 -1
- package/dist/formio.full.min.js +1 -1
- package/dist/formio.full.min.js.LICENSE.txt +1 -1
- package/dist/formio.js +1 -1
- package/dist/formio.min.js +1 -1
- package/dist/formio.min.js.LICENSE.txt +1 -1
- package/dist/formio.utils.min.js.LICENSE.txt +1 -1
- package/package.json +1 -1
- package/templates/bootstrap/customTab/flat.ejs.js +19 -0
- package/templates/bootstrap/customTab/form.ejs.js +41 -0
- package/templates/bootstrap/customTab/index.js +14 -0
- package/templates/bootstrap/dataChinaGrid/form.ejs.js +61 -0
- package/templates/bootstrap/dataChinaGrid/index.js +12 -0
- package/templates/bootstrap/dataChinaGridRow/form.ejs.js +63 -0
- package/templates/bootstrap/dataChinaGridRow/index.js +12 -0
- package/templates/bootstrap/flex/form.ejs.js +27 -3
- package/templates/bootstrap/index.js +7 -1
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
require("core-js/modules/es.reflect.construct.js");
|
|
5
|
+
require("core-js/modules/es.reflect.get.js");
|
|
6
|
+
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
7
|
+
require("core-js/modules/es.symbol.to-primitive.js");
|
|
8
|
+
require("core-js/modules/es.date.to-primitive.js");
|
|
9
|
+
require("core-js/modules/es.symbol.js");
|
|
10
|
+
require("core-js/modules/es.symbol.description.js");
|
|
11
|
+
require("core-js/modules/es.number.constructor.js");
|
|
12
|
+
require("core-js/modules/es.symbol.iterator.js");
|
|
13
|
+
require("core-js/modules/es.array.iterator.js");
|
|
14
|
+
require("core-js/modules/es.string.iterator.js");
|
|
15
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
16
|
+
Object.defineProperty(exports, "__esModule", {
|
|
17
|
+
value: true
|
|
18
|
+
});
|
|
19
|
+
exports.default = void 0;
|
|
20
|
+
require("core-js/modules/es.regexp.exec.js");
|
|
21
|
+
require("core-js/modules/es.string.replace.js");
|
|
22
|
+
require("core-js/modules/es.string.trim.js");
|
|
23
|
+
require("core-js/modules/es.array.find.js");
|
|
24
|
+
require("core-js/modules/es.object.to-string.js");
|
|
25
|
+
require("core-js/modules/web.dom-collections.for-each.js");
|
|
26
|
+
require("core-js/modules/es.array.concat.js");
|
|
27
|
+
require("core-js/modules/es.object.get-prototype-of.js");
|
|
28
|
+
var _Field = _interopRequireDefault(require("../_classes/field/Field"));
|
|
29
|
+
require("peity");
|
|
30
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
31
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
32
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
33
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
34
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
35
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
36
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
37
|
+
function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
|
|
38
|
+
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
39
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
40
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
41
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
42
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
43
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
44
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
45
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
46
|
+
/**
|
|
47
|
+
* Here we will derive from the base component which all Form.io form components derive from.
|
|
48
|
+
*
|
|
49
|
+
* @param component
|
|
50
|
+
* @param options
|
|
51
|
+
* @param data
|
|
52
|
+
* @constructor
|
|
53
|
+
*/
|
|
54
|
+
var DataChinaGrid = /*#__PURE__*/function (_Component) {
|
|
55
|
+
_inherits(DataChinaGrid, _Component);
|
|
56
|
+
var _super = _createSuper(DataChinaGrid);
|
|
57
|
+
function DataChinaGrid(component, options, data) {
|
|
58
|
+
var _this;
|
|
59
|
+
_classCallCheck(this, DataChinaGrid);
|
|
60
|
+
_this = _super.call(this, component, options, data);
|
|
61
|
+
_this.isLoadingSparkLine = false;
|
|
62
|
+
return _this;
|
|
63
|
+
}
|
|
64
|
+
_createClass(DataChinaGrid, [{
|
|
65
|
+
key: "render",
|
|
66
|
+
value: function render() {
|
|
67
|
+
return _get(_getPrototypeOf(DataChinaGrid.prototype), "render", this).call(this, this.renderTemplate('dataChinaGrid'));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* After the html string has been mounted into the dom, the dom element is returned here. Use refs to find specific
|
|
72
|
+
* elements to attach functionality to.
|
|
73
|
+
*
|
|
74
|
+
* @param element
|
|
75
|
+
* @returns {Promise}
|
|
76
|
+
*/
|
|
77
|
+
}, {
|
|
78
|
+
key: "attach",
|
|
79
|
+
value: function attach(element) {
|
|
80
|
+
var _this2 = this;
|
|
81
|
+
var self = this;
|
|
82
|
+
var refs = {
|
|
83
|
+
dataContainer: 'single'
|
|
84
|
+
};
|
|
85
|
+
this.loadRefs(element, refs);
|
|
86
|
+
var dataContainer = this.refs.dataContainer;
|
|
87
|
+
if (dataContainer) {
|
|
88
|
+
var clickEventType = this.component['click-event-type'];
|
|
89
|
+
if (clickEventType) {
|
|
90
|
+
this.addEventListener(dataContainer, 'click', function (event) {
|
|
91
|
+
// 点击事件
|
|
92
|
+
switch (clickEventType) {
|
|
93
|
+
case 'newPage':
|
|
94
|
+
window.openNewPage(_this2.component['click-event-form-id']);
|
|
95
|
+
break;
|
|
96
|
+
case 'bottomSheet':
|
|
97
|
+
window.openBottomSheet(_this2.component['click-event-form-id']);
|
|
98
|
+
break;
|
|
99
|
+
case 'setTab':
|
|
100
|
+
// 切换tab
|
|
101
|
+
Formio.forms[_this2.currentForm.id].getComponent(_this2.component['click-event-tab-id']).setTabByKey(_this2.component['click-event-tab-key']);
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
setTimeout(function () {
|
|
108
|
+
_this2.setValue('');
|
|
109
|
+
}, 100);
|
|
110
|
+
return _get(_getPrototypeOf(DataChinaGrid.prototype), "attach", this).call(this, element);
|
|
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 path = match.substr(2, match.length - 3).trim();
|
|
119
|
+
return _lodash.default.get(map, path);
|
|
120
|
+
});
|
|
121
|
+
} catch (e) {
|
|
122
|
+
console.log(e);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return '{}';
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Get the value of the component from the dom elements.
|
|
130
|
+
*
|
|
131
|
+
* @returns {Array}
|
|
132
|
+
*/
|
|
133
|
+
}, {
|
|
134
|
+
key: "getValue",
|
|
135
|
+
value: function getValue() {
|
|
136
|
+
return this.component.field;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Set the value of the component into the dom elements.
|
|
141
|
+
*
|
|
142
|
+
* @param value
|
|
143
|
+
* @returns {boolean}
|
|
144
|
+
*/
|
|
145
|
+
}, {
|
|
146
|
+
key: "setValue",
|
|
147
|
+
value: function setValue(value) {
|
|
148
|
+
var self = this;
|
|
149
|
+
try {
|
|
150
|
+
var container = this.element.querySelector('.data-container');
|
|
151
|
+
// 标题设置
|
|
152
|
+
var element = container.querySelector('.title-container');
|
|
153
|
+
element.innerHTML = self.parseTpl(self.component['title-content'], {
|
|
154
|
+
data: self.rootValue
|
|
155
|
+
});
|
|
156
|
+
element = container.querySelector('.value-container');
|
|
157
|
+
element.innerHTML = self.parseTpl(self.component['value-content'], {
|
|
158
|
+
data: self.rootValue
|
|
159
|
+
});
|
|
160
|
+
element = container.querySelector('.footer-container-value1');
|
|
161
|
+
element.innerHTML = self.parseTpl(self.component['footer-content1'], {
|
|
162
|
+
data: self.rootValue
|
|
163
|
+
});
|
|
164
|
+
element = container.querySelector('.footer-container-value2');
|
|
165
|
+
element.innerHTML = self.parseTpl(self.component['footer-content2'], {
|
|
166
|
+
data: self.rootValue
|
|
167
|
+
});
|
|
168
|
+
element = container.querySelector('.footer-container-value3');
|
|
169
|
+
if (element) {
|
|
170
|
+
element.innerHTML = self.parseTpl(self.component['footer-content3'], {
|
|
171
|
+
data: self.rootValue
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
// 图标
|
|
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
|
+
}
|
|
225
|
+
} catch (e) {
|
|
226
|
+
console.log(e);
|
|
227
|
+
}
|
|
228
|
+
return true;
|
|
229
|
+
}
|
|
230
|
+
}], [{
|
|
231
|
+
key: "schema",
|
|
232
|
+
value: function schema() {
|
|
233
|
+
for (var _len = arguments.length, extend = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
234
|
+
extend[_key] = arguments[_key];
|
|
235
|
+
}
|
|
236
|
+
return _Field.default.schema.apply(_Field.default, [{
|
|
237
|
+
type: 'data_china_grid',
|
|
238
|
+
"title-content": "低压问题综合治理率 <i class=\"fa fa-info-circle\" aria-hidden=\"true\"></i>",
|
|
239
|
+
"value-content": "160 <i style='font-size: 10px;color: #0a6ebd'>%</i>",
|
|
240
|
+
"footer-content1": "name",
|
|
241
|
+
"footer-content2": "<div style='color:red'>up</div>",
|
|
242
|
+
"footer-content3": "info",
|
|
243
|
+
"footer-content": "开始时间"
|
|
244
|
+
}].concat(extend));
|
|
245
|
+
}
|
|
246
|
+
}, {
|
|
247
|
+
key: "builderInfo",
|
|
248
|
+
get: function get() {
|
|
249
|
+
return {
|
|
250
|
+
title: 'Info Block ChinaFrid',
|
|
251
|
+
group: 'advanced',
|
|
252
|
+
icon: 'square-info',
|
|
253
|
+
weight: 70,
|
|
254
|
+
documentation: 'http://help.form.io/userguide/#table',
|
|
255
|
+
schema: DataChinaGrid.schema()
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
}]);
|
|
259
|
+
return DataChinaGrid;
|
|
260
|
+
}(_Field.default);
|
|
261
|
+
exports.default = DataChinaGrid;
|