formiojs-eorion 0.1.8 → 0.1.10
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.js +33 -6
- package/components/CustomTabs/editForm/Tabs.edit.display.js +16 -0
- package/components/echarts/ECharts.js +1 -1
- package/components/index.js +2 -1
- package/components/progress/Progress.form.js +2 -2
- package/components/progress/Progress.js +43 -5
- package/components/progress/editForm/Progress.edit.display.js +47 -28
- package/dist/formio.builder.css +12 -1
- package/dist/formio.builder.min.css +1 -1
- package/dist/formio.contrib.js +3 -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 +10 -10
- package/dist/formio.form.min.js +1 -1
- package/dist/formio.form.min.js.LICENSE.txt +1 -1
- package/dist/formio.full.css +12 -1
- package/dist/formio.full.js +10 -10
- 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/form.ejs.js +28 -8
- package/templates/bootstrap/progress/form.ejs.js +7 -1
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.
|
|
1727
|
+
Formio.version = '0.1.10';
|
|
1728
1728
|
Formio.pathType = '';
|
|
1729
1729
|
Formio.events = new _EventEmitter.default();
|
|
1730
1730
|
Formio.cdn = new _CDN.default();
|
|
@@ -139,7 +139,7 @@ var CustomTabsComponent = /*#__PURE__*/function (_NestedComponent) {
|
|
|
139
139
|
value: function attach(element) {
|
|
140
140
|
var _this$loadRefs,
|
|
141
141
|
_this5 = this;
|
|
142
|
-
this.loadRefs(element, (_this$loadRefs = {}, _defineProperty(_this$loadRefs, this.tabLinkKey, 'multiple'), _defineProperty(_this$loadRefs, this.tabKey, 'multiple'), _defineProperty(_this$loadRefs, this.tabLikey, 'multiple'), _defineProperty(_this$loadRefs, 'tabLine', 'single'), _this$loadRefs));
|
|
142
|
+
this.loadRefs(element, (_this$loadRefs = {}, _defineProperty(_this$loadRefs, this.tabLinkKey, 'multiple'), _defineProperty(_this$loadRefs, this.tabKey, 'multiple'), _defineProperty(_this$loadRefs, this.tabLikey, 'multiple'), _defineProperty(_this$loadRefs, 'tabLine', 'single'), _defineProperty(_this$loadRefs, 'tabHeaderContainer', 'single'), _defineProperty(_this$loadRefs, 'tabHeaderContainerScroll', 'single'), _this$loadRefs));
|
|
143
143
|
['change', 'error'].forEach(function (event) {
|
|
144
144
|
return _this5.on(event, _this5.handleTabsValidation.bind(_this5));
|
|
145
145
|
});
|
|
@@ -193,12 +193,39 @@ var CustomTabsComponent = /*#__PURE__*/function (_NestedComponent) {
|
|
|
193
193
|
_lodash.default.each(this.refs[this.tabLinkKey], function (tabLink, tabIndex) {
|
|
194
194
|
// 设置下划线位置 //设置颜色
|
|
195
195
|
if (tabIndex === _this7.currentTab) {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
_this7.refs.
|
|
199
|
-
|
|
196
|
+
// 检测tab标签是否完整显示
|
|
197
|
+
var rect = tabLink.getBoundingClientRect();
|
|
198
|
+
var rectScroll = _this7.refs.tabHeaderContainerScroll.getBoundingClientRect();
|
|
199
|
+
// 10px是左右的padding
|
|
200
|
+
if (rect.right > rectScroll.right) {
|
|
201
|
+
// 右滑
|
|
202
|
+
_this7.refs.tabHeaderContainerScroll.scrollLeft = _this7.refs.tabHeaderContainerScroll.scrollLeft + (rect.right - rectScroll.right);
|
|
203
|
+
}
|
|
204
|
+
if (rect.left < rectScroll.left) {
|
|
205
|
+
// 左滑
|
|
206
|
+
_this7.refs.tabHeaderContainerScroll.scrollLeft = _this7.refs.tabHeaderContainerScroll.scrollLeft - (rectScroll.left - rect.left);
|
|
207
|
+
}
|
|
208
|
+
if (_this7.refs.tabLine) {
|
|
209
|
+
_this7.refs.tabLine.style.width = "".concat(tabLink.offsetWidth, "px");
|
|
210
|
+
_this7.refs.tabLine.style.transform = "translateX(".concat(tabLink.offsetLeft, "px)");
|
|
211
|
+
}
|
|
212
|
+
if (_this7.component["headerStyle"] === "pills") {
|
|
213
|
+
tabLink.querySelector(".tab-pills-item").style.color = "white";
|
|
214
|
+
tabLink.querySelector(".tab-pills-item").style["background-color"] = _this7.component["headerColor"];
|
|
215
|
+
tabLink.querySelector(".tab-pills-item").style.border = "1px solid ".concat(_this7.component["headerColor"]);
|
|
216
|
+
tabLink.querySelector(".triangle").style.display = "flex";
|
|
217
|
+
} else {
|
|
218
|
+
tabLink.style.color = _this7.component["headerColor"];
|
|
219
|
+
}
|
|
200
220
|
} else {
|
|
201
|
-
|
|
221
|
+
if (_this7.component["headerStyle"] === "pills") {
|
|
222
|
+
tabLink.querySelector(".tab-pills-item").style.color = _this7.component["headerNormalColor"];
|
|
223
|
+
tabLink.querySelector(".tab-pills-item").style.border = "1px solid ".concat(_this7.component["headerNormalColor"]);
|
|
224
|
+
tabLink.querySelector(".tab-pills-item").style["background-color"] = "transparent";
|
|
225
|
+
tabLink.querySelector(".triangle").style.display = "none";
|
|
226
|
+
} else {
|
|
227
|
+
tabLink.style.color = _this7.component["headerNormalColor"];
|
|
228
|
+
}
|
|
202
229
|
}
|
|
203
230
|
});
|
|
204
231
|
}
|
|
@@ -61,6 +61,22 @@ var _default = [{
|
|
|
61
61
|
key: 'hideHeader',
|
|
62
62
|
label: '隐藏头部',
|
|
63
63
|
input: true
|
|
64
|
+
}, {
|
|
65
|
+
type: 'select',
|
|
66
|
+
label: '样式',
|
|
67
|
+
data: {
|
|
68
|
+
values: [{
|
|
69
|
+
label: '普通',
|
|
70
|
+
value: 'normal'
|
|
71
|
+
}, {
|
|
72
|
+
label: 'pills',
|
|
73
|
+
value: 'pills'
|
|
74
|
+
}]
|
|
75
|
+
},
|
|
76
|
+
key: 'headerStyle',
|
|
77
|
+
input: true,
|
|
78
|
+
defaultValue: 'normal',
|
|
79
|
+
dataSrc: 'values'
|
|
64
80
|
}, {
|
|
65
81
|
type: 'select',
|
|
66
82
|
label: '对齐方式',
|
|
@@ -119,7 +119,7 @@ var ECharts = /*#__PURE__*/function (_FieldComponent) {
|
|
|
119
119
|
// 初始化 ECharts 实例
|
|
120
120
|
chartInstance = echarts.init(canvas);
|
|
121
121
|
}
|
|
122
|
-
var optionsStr = this.component[
|
|
122
|
+
var optionsStr = this.component['option-value'];
|
|
123
123
|
optionsStr = this.parseTpl(optionsStr, {
|
|
124
124
|
data: this.rootValue
|
|
125
125
|
});
|
package/components/index.js
CHANGED
|
@@ -161,6 +161,7 @@ var _default = {
|
|
|
161
161
|
data_china_grid: _Data2.default,
|
|
162
162
|
data_china_grid_row: _Data3.default,
|
|
163
163
|
customTabs: _Tabs2.default,
|
|
164
|
-
echarts: _ECharts.default
|
|
164
|
+
echarts: _ECharts.default,
|
|
165
|
+
progress: _Progress.default
|
|
165
166
|
};
|
|
166
167
|
exports.default = _default;
|
|
@@ -5,14 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = _default;
|
|
7
7
|
require("core-js/modules/es.array.concat.js");
|
|
8
|
-
var
|
|
8
|
+
var _Component = _interopRequireDefault(require("../_classes/component/Component.form"));
|
|
9
9
|
var _ProgressEdit = _interopRequireDefault(require("./editForm/Progress.edit.display"));
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
11
|
function _default() {
|
|
12
12
|
for (var _len = arguments.length, extend = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
13
13
|
extend[_key] = arguments[_key];
|
|
14
14
|
}
|
|
15
|
-
return
|
|
15
|
+
return _Component.default.apply(void 0, [[{
|
|
16
16
|
key: 'display',
|
|
17
17
|
components: _ProgressEdit.default
|
|
18
18
|
}]].concat(extend));
|
|
@@ -15,12 +15,13 @@ exports.default = void 0;
|
|
|
15
15
|
require("core-js/modules/es.regexp.exec.js");
|
|
16
16
|
require("core-js/modules/es.string.replace.js");
|
|
17
17
|
require("core-js/modules/es.string.trim.js");
|
|
18
|
+
require("core-js/modules/es.object.to-string.js");
|
|
19
|
+
require("core-js/modules/web.dom-collections.for-each.js");
|
|
18
20
|
require("core-js/modules/es.array.concat.js");
|
|
19
21
|
require("core-js/modules/es.symbol.to-primitive.js");
|
|
20
22
|
require("core-js/modules/es.date.to-primitive.js");
|
|
21
23
|
require("core-js/modules/es.symbol.js");
|
|
22
24
|
require("core-js/modules/es.symbol.description.js");
|
|
23
|
-
require("core-js/modules/es.object.to-string.js");
|
|
24
25
|
require("core-js/modules/es.number.constructor.js");
|
|
25
26
|
var _Field = _interopRequireDefault(require("../_classes/field/Field"));
|
|
26
27
|
var _Progress = _interopRequireDefault(require("./Progress.form"));
|
|
@@ -65,9 +66,15 @@ var Progress = /*#__PURE__*/function (_FieldComponent) {
|
|
|
65
66
|
}, {
|
|
66
67
|
key: "attach",
|
|
67
68
|
value: function attach(element) {
|
|
68
|
-
var
|
|
69
|
+
var _this = this;
|
|
70
|
+
var refs = {
|
|
71
|
+
titleContainer: 'single',
|
|
72
|
+
progressContainer: 'single'
|
|
73
|
+
};
|
|
69
74
|
this.loadRefs(element, refs);
|
|
70
|
-
|
|
75
|
+
setTimeout(function () {
|
|
76
|
+
_this.setValue();
|
|
77
|
+
}, 100);
|
|
71
78
|
// Allow basic component functionality to attach like field logic and tooltips.
|
|
72
79
|
return _get(_getPrototypeOf(Progress.prototype), "attach", this).call(this, element);
|
|
73
80
|
}
|
|
@@ -87,7 +94,15 @@ var Progress = /*#__PURE__*/function (_FieldComponent) {
|
|
|
87
94
|
value: function parseTpl(template, map) {
|
|
88
95
|
return template.replace(/\$\{.+?}/g, function (match) {
|
|
89
96
|
var path = match.substr(2, match.length - 3).trim();
|
|
90
|
-
|
|
97
|
+
var strTmp = _lodash.default.get(map, path);
|
|
98
|
+
if (strTmp === undefined) {
|
|
99
|
+
strTmp = null;
|
|
100
|
+
} else {
|
|
101
|
+
if (_lodash.default.isArray(strTmp) || _lodash.default.isObject(strTmp)) {
|
|
102
|
+
strTmp = JSON.stringify(strTmp);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return strTmp;
|
|
91
106
|
});
|
|
92
107
|
}
|
|
93
108
|
|
|
@@ -100,6 +115,29 @@ var Progress = /*#__PURE__*/function (_FieldComponent) {
|
|
|
100
115
|
}, {
|
|
101
116
|
key: "setValue",
|
|
102
117
|
value: function setValue(value) {
|
|
118
|
+
var _this2 = this;
|
|
119
|
+
this.refs.titleContainer.innerHTML = "";
|
|
120
|
+
this.refs.progressContainer.innerHTML = "";
|
|
121
|
+
var optionsStr = this.component['option-value'];
|
|
122
|
+
try {
|
|
123
|
+
optionsStr = this.parseTpl(optionsStr, {
|
|
124
|
+
data: this.rootValue
|
|
125
|
+
});
|
|
126
|
+
optionsStr = JSON.parse(optionsStr);
|
|
127
|
+
var sum = _lodash.default.sumBy(optionsStr, 'value');
|
|
128
|
+
if (this.component['max-value'] && this.component['max-value'].trim().length > 0) {
|
|
129
|
+
sum = _lodash.default.toNumber(this.parseTpl(this.component['max-value'], {
|
|
130
|
+
data: this.rootValue
|
|
131
|
+
}));
|
|
132
|
+
}
|
|
133
|
+
optionsStr.forEach(function (item) {
|
|
134
|
+
var percent = _lodash.default.floor(_lodash.default.divide(item.value, sum) * 100, 1);
|
|
135
|
+
_this2.refs.titleContainer.insertAdjacentHTML('beforeend', "<div class=\"progress-title-container\" style=\"display: flex;flex-direction: row;align-items: center;font-size: ".concat(_this2.component['font-size'], "\">\n <div class=\"progress-title-item-indicator\" style=\"width: 5px;height: 5px;background-color: ").concat(item.color, ";margin-right: 10px\"></div>\n <div class=\"progress-title-item-title\" style=\"color: ").concat(item.color, "\">").concat(item.title, "</div>\n <div class=\"progress-title-item-value\" style=\"font-weight: bold;margin-left: 5px;margin-right: 5px;color: black\">").concat(item.value, "</div>\n <div class=\"progress-title-item-unit\" style=\"color: grey\">").concat(item.unit, "</div>\n <div class=\"progress-title-item-percent\" style=\"margin-left: 10px;color: grey\">").concat(percent, "%</div>\n </div>"));
|
|
136
|
+
_this2.refs.progressContainer.insertAdjacentHTML('beforeend', "<div class=\"progress-bar\" role=\"progressbar\" style=\"width: ".concat(percent, "%;background-color: ").concat(item.color, "\" aria-valuenow=\"").concat(item.value, "\" aria-valuemin=\"0\" aria-valuemax=\"").concat(sum, "\"></div>"));
|
|
137
|
+
});
|
|
138
|
+
} catch (e) {
|
|
139
|
+
console.log('json转换失败', e);
|
|
140
|
+
}
|
|
103
141
|
return true;
|
|
104
142
|
}
|
|
105
143
|
}], [{
|
|
@@ -121,7 +159,7 @@ exports.default = Progress;
|
|
|
121
159
|
_defineProperty(Progress, "builderInfo", {
|
|
122
160
|
title: 'Progress',
|
|
123
161
|
group: 'advanced',
|
|
124
|
-
icon: '
|
|
162
|
+
icon: 'bar-progress',
|
|
125
163
|
weight: 70,
|
|
126
164
|
documentation: 'http://help.form.io/userguide/#progress',
|
|
127
165
|
schema: Progress.schema()
|
|
@@ -5,40 +5,59 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _default = [{
|
|
8
|
-
type: '
|
|
9
|
-
label: '
|
|
8
|
+
type: 'textfield',
|
|
9
|
+
label: '宽度',
|
|
10
10
|
key: 'width',
|
|
11
11
|
input: true,
|
|
12
12
|
weight: 1,
|
|
13
|
-
defaultValue:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}, {
|
|
17
|
-
type: 'select',
|
|
18
|
-
label: '对齐方式',
|
|
19
|
-
key: 'align',
|
|
20
|
-
weight: 2,
|
|
21
|
-
defaultValue: "start",
|
|
22
|
-
data: {
|
|
23
|
-
values: [{
|
|
24
|
-
label: 'left',
|
|
25
|
-
value: 'start'
|
|
26
|
-
}, {
|
|
27
|
-
label: 'right',
|
|
28
|
-
value: 'end'
|
|
29
|
-
}, {
|
|
30
|
-
label: 'mid',
|
|
31
|
-
value: 'center'
|
|
32
|
-
}]
|
|
13
|
+
defaultValue: "100%",
|
|
14
|
+
validate: {
|
|
15
|
+
required: true
|
|
33
16
|
}
|
|
34
17
|
}, {
|
|
35
|
-
type: '
|
|
36
|
-
label: '
|
|
37
|
-
key: '
|
|
18
|
+
type: 'textfield',
|
|
19
|
+
label: '高度',
|
|
20
|
+
key: 'height',
|
|
38
21
|
input: true,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
22
|
+
weight: 1,
|
|
23
|
+
defaultValue: "50px",
|
|
24
|
+
validate: {
|
|
25
|
+
required: true
|
|
26
|
+
}
|
|
27
|
+
}, {
|
|
28
|
+
type: 'textarea',
|
|
29
|
+
label: '配置项',
|
|
30
|
+
key: 'option-value',
|
|
31
|
+
editor: 'ace',
|
|
32
|
+
input: true,
|
|
33
|
+
tooltip: '配置项(json格式)',
|
|
34
|
+
placeholder: "[{\"value\":10,\"title\":\"demo\",\"color\":\"black\",\"unit\":\"\u4E2A\"}]",
|
|
35
|
+
weight: 1,
|
|
36
|
+
validate: {
|
|
37
|
+
required: true
|
|
38
|
+
}
|
|
39
|
+
}, {
|
|
40
|
+
type: 'textfield',
|
|
41
|
+
label: '最大值',
|
|
42
|
+
key: 'max-value',
|
|
43
|
+
input: true,
|
|
44
|
+
weight: 1,
|
|
45
|
+
tooltip: '进度条最大值,若该值为空,则根据所有选项自动计算百分比',
|
|
46
|
+
defaultValue: null
|
|
47
|
+
}, {
|
|
48
|
+
type: 'textfield',
|
|
49
|
+
label: '字体大小',
|
|
50
|
+
key: 'font-size',
|
|
51
|
+
input: true,
|
|
52
|
+
weight: 1,
|
|
53
|
+
defaultValue: "20px"
|
|
54
|
+
}, {
|
|
55
|
+
type: 'textfield',
|
|
56
|
+
label: '进度条背景颜色',
|
|
57
|
+
key: 'progress-color',
|
|
58
|
+
input: true,
|
|
59
|
+
weight: 1,
|
|
60
|
+
defaultValue: "white"
|
|
42
61
|
}, {
|
|
43
62
|
key: 'labelPosition',
|
|
44
63
|
ignore: true
|
package/dist/formio.builder.css
CHANGED
|
@@ -2626,6 +2626,11 @@ span[role=link] {
|
|
|
2626
2626
|
height: 100%;
|
|
2627
2627
|
}
|
|
2628
2628
|
|
|
2629
|
+
.formio-component-customTabs .tab-header {
|
|
2630
|
+
display: flex;
|
|
2631
|
+
width: 100%;
|
|
2632
|
+
flex-direction: column;
|
|
2633
|
+
}
|
|
2629
2634
|
.formio-component-customTabs .tab-header .tab-item {
|
|
2630
2635
|
display: flex;
|
|
2631
2636
|
align-items: center;
|
|
@@ -2644,11 +2649,17 @@ span[role=link] {
|
|
|
2644
2649
|
cursor: default;
|
|
2645
2650
|
}
|
|
2646
2651
|
.formio-component-customTabs .tab-header .tab-line {
|
|
2647
|
-
position: absolute;
|
|
2648
2652
|
height: 2px;
|
|
2649
2653
|
margin-top: 5px;
|
|
2650
2654
|
transition: all 0.3s;
|
|
2651
2655
|
}
|
|
2656
|
+
.formio-component-customTabs .tab-header .tab-pills-item {
|
|
2657
|
+
display: table;
|
|
2658
|
+
width: fit-content;
|
|
2659
|
+
border-radius: 0.35rem;
|
|
2660
|
+
padding: 0.5rem 1rem;
|
|
2661
|
+
word-break: keep-all;
|
|
2662
|
+
}
|
|
2652
2663
|
|
|
2653
2664
|
.formio-component-customTable table, .formio-component-customTable th, .formio-component-customTable td {
|
|
2654
2665
|
border: 1px solid black;
|