fmui-base 2.2.87 → 2.2.89
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/README.md +2 -0
- package/lib/form/form.js +191 -147
- package/lib/form/formExtHelper.js +131 -55
- package/lib/form/subForm.js +272 -21
- package/lib/form/table.js +472 -76
- package/lib/process_info/processInfo.js +2 -1
- package/lib/tblform/README.md +12 -3
- package/lib/tblform/TblForm.js +2 -0
- package/lib/tblform/formFieldProps.js +1 -0
- package/lib/tblform/pureFormAdapter.js +2 -1
- package/package.json +1 -1
|
@@ -5,103 +5,73 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.loadFlowOrFormCommon = loadFlowOrFormCommon;
|
|
7
7
|
exports.resolveMobileFormExt = resolveMobileFormExt;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
exports.clampSubColumnCount = clampSubColumnCount;
|
|
9
|
+
exports.buildDetailItemParam = buildDetailItemParam;
|
|
10
|
+
exports.applyDealwithFormParamExt = applyDealwithFormParamExt;
|
|
11
|
+
exports.resolveSubColumnCountFromConfig = resolveSubColumnCountFromConfig;
|
|
12
|
+
/**
|
|
13
|
+
* 表单扩展加载:流程 flow_common / 纯表单 form_common
|
|
14
|
+
*
|
|
15
|
+
* form_common 使用包内 require.context('./form_common'),避免宿主无 pages/form_common 时 webpack 告警。
|
|
16
|
+
* 宿主扩展目录请通过 webpack alias 映射到 fmui-base/lib/form/form_common(见 tblform/README)。
|
|
13
17
|
*/
|
|
14
18
|
|
|
15
19
|
var formCommonContext = require.context('./form_common', false, /\.js$/);
|
|
16
20
|
|
|
17
21
|
function loadFormCommonModule(formCode) {
|
|
18
|
-
|
|
19
22
|
if (!formCode) {
|
|
20
|
-
|
|
21
23
|
return null;
|
|
22
24
|
}
|
|
23
|
-
|
|
24
25
|
var keys = ['./' + formCode + '.js', './' + formCode];
|
|
25
|
-
|
|
26
26
|
for (var i = 0; i < keys.length; i++) {
|
|
27
|
-
|
|
28
27
|
if (!formCommonContext.keys().includes(keys[i])) {
|
|
29
|
-
|
|
30
28
|
continue;
|
|
31
29
|
}
|
|
32
|
-
|
|
33
30
|
try {
|
|
34
|
-
|
|
35
31
|
var mod = formCommonContext(keys[i]);
|
|
36
|
-
|
|
37
32
|
return mod.default ? mod.default : mod;
|
|
38
33
|
} catch (e) {
|
|
39
|
-
|
|
40
34
|
// try next key
|
|
41
|
-
|
|
42
35
|
}
|
|
43
36
|
}
|
|
44
|
-
|
|
45
37
|
return loadFormCommonFromGlobal(formCode);
|
|
46
38
|
}
|
|
47
39
|
|
|
48
40
|
/** 宿主可在 window 挂载 {formCode}_formCommon,无需改 node_modules */
|
|
49
|
-
|
|
50
41
|
function loadFormCommonFromGlobal(formCode) {
|
|
51
|
-
|
|
52
42
|
if (!formCode) {
|
|
53
|
-
|
|
54
43
|
return null;
|
|
55
44
|
}
|
|
56
|
-
|
|
57
45
|
try {
|
|
58
|
-
|
|
59
46
|
var globalName = formCode + '_formCommon';
|
|
60
|
-
|
|
61
47
|
if (typeof window !== 'undefined' && window[globalName]) {
|
|
62
|
-
|
|
63
48
|
return window[globalName];
|
|
64
49
|
}
|
|
65
|
-
|
|
66
50
|
if (typeof global !== 'undefined' && global[globalName]) {
|
|
67
|
-
|
|
68
51
|
return global[globalName];
|
|
69
52
|
}
|
|
70
53
|
} catch (e) {
|
|
71
|
-
|
|
72
54
|
// ignore
|
|
73
|
-
|
|
74
55
|
}
|
|
75
|
-
|
|
76
56
|
return null;
|
|
77
57
|
}
|
|
78
58
|
|
|
79
59
|
function loadFlowOrFormCommon(props) {
|
|
80
|
-
|
|
81
60
|
var formCode = props && props.formCode || '';
|
|
82
|
-
|
|
83
61
|
var module = props && props.module;
|
|
84
|
-
|
|
85
62
|
if (module === undefined || module === null || module === 'undefined') {
|
|
86
|
-
|
|
87
63
|
module = formCode ? '' : 'approve';
|
|
88
64
|
}
|
|
89
65
|
|
|
90
66
|
var FlowCommon = null;
|
|
91
|
-
|
|
92
67
|
try {
|
|
93
|
-
|
|
94
68
|
if (formCode) {
|
|
95
|
-
|
|
96
69
|
FlowCommon = loadFormCommonModule(formCode);
|
|
97
70
|
} else if (module) {
|
|
98
|
-
|
|
99
71
|
var mod = require('pages/flow_common/' + module);
|
|
100
|
-
|
|
101
72
|
FlowCommon = mod.default ? mod.default : mod;
|
|
102
73
|
}
|
|
103
74
|
} catch (e) {
|
|
104
|
-
|
|
105
75
|
FlowCommon = null;
|
|
106
76
|
}
|
|
107
77
|
|
|
@@ -109,44 +79,150 @@ function loadFlowOrFormCommon(props) {
|
|
|
109
79
|
}
|
|
110
80
|
|
|
111
81
|
/** form_common: {formCode}_mobileExt;流程: {module}_{formKey}_mobileExt */
|
|
112
|
-
|
|
113
82
|
function resolveMobileFormExt(formCode, module, formKey) {
|
|
114
|
-
|
|
115
83
|
if (formCode) {
|
|
116
|
-
|
|
117
84
|
try {
|
|
118
|
-
|
|
119
85
|
var extName = formCode + '_mobileExt';
|
|
120
|
-
|
|
121
86
|
if (typeof eval(extName) !== 'undefined') {
|
|
122
|
-
|
|
123
87
|
return eval(extName);
|
|
124
88
|
}
|
|
125
89
|
} catch (e) {
|
|
126
|
-
|
|
127
90
|
// ignore
|
|
128
|
-
|
|
129
91
|
}
|
|
130
|
-
|
|
131
92
|
return null;
|
|
132
93
|
}
|
|
133
|
-
|
|
134
94
|
if (module && formKey) {
|
|
135
|
-
|
|
136
95
|
try {
|
|
137
|
-
|
|
138
96
|
var _extName = module + '_' + formKey + '_mobileExt';
|
|
139
|
-
|
|
140
97
|
if (typeof eval(_extName) !== 'undefined') {
|
|
141
|
-
|
|
142
98
|
return eval(_extName);
|
|
143
99
|
}
|
|
144
100
|
} catch (e) {
|
|
145
|
-
|
|
146
101
|
// ignore
|
|
147
|
-
|
|
148
102
|
}
|
|
149
103
|
}
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** 将子表列数限制在 1-4;无效则返回 null */
|
|
108
|
+
function clampSubColumnCount(count) {
|
|
109
|
+
if (count == null || count === '') {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
var n = parseInt(count, 10);
|
|
113
|
+
if (isNaN(n)) {
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
return Math.max(1, Math.min(4, n));
|
|
117
|
+
}
|
|
150
118
|
|
|
119
|
+
function resolveSubColumnCountFromItemType(itemType) {
|
|
120
|
+
if (itemType === 'twocolumns') {
|
|
121
|
+
return 2;
|
|
122
|
+
}
|
|
123
|
+
if (itemType === 'threecolumns') {
|
|
124
|
+
return 3;
|
|
125
|
+
}
|
|
126
|
+
if (itemType === 'fourcolumns') {
|
|
127
|
+
return 4;
|
|
128
|
+
}
|
|
151
129
|
return null;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** 由子表字段配置构建 itemParam,供扩展方法使用 */
|
|
133
|
+
function buildDetailItemParam(detailForm) {
|
|
134
|
+
if (!detailForm) {
|
|
135
|
+
return { key: '', itemType: 'detail', title: '' };
|
|
136
|
+
}
|
|
137
|
+
return {
|
|
138
|
+
id: detailForm.id,
|
|
139
|
+
title: detailForm.itemTitle,
|
|
140
|
+
key: detailForm.itemCode,
|
|
141
|
+
itemType: detailForm.itemType || 'detail',
|
|
142
|
+
uniqueName: detailForm.uniqueName,
|
|
143
|
+
subColumnCount: detailForm.subColumnCount
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* 调用现有表单扩展:FlowCommon.dealwithCommonFormParam、mobileExt.dealwithFormParamExt
|
|
149
|
+
* 流程:pages/flow_common/{module};纯表单:form_common / {formCode}_mobileExt
|
|
150
|
+
*/
|
|
151
|
+
function applyDealwithFormParamExt(options) {
|
|
152
|
+
options = options || {};
|
|
153
|
+
var itemParam = options.itemParam;
|
|
154
|
+
if (!itemParam) {
|
|
155
|
+
itemParam = buildDetailItemParam(options.detailForm);
|
|
156
|
+
}
|
|
157
|
+
var FlowCommon = options.FlowCommon;
|
|
158
|
+
var component = options.component;
|
|
159
|
+
var module = options.module;
|
|
160
|
+
var formKey = options.formKey;
|
|
161
|
+
var formCode = options.formCode || '';
|
|
162
|
+
|
|
163
|
+
if (FlowCommon && typeof FlowCommon.dealwithCommonFormParam === 'function') {
|
|
164
|
+
itemParam = FlowCommon.dealwithCommonFormParam(itemParam, component);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
var mobileExt = null;
|
|
168
|
+
try {
|
|
169
|
+
mobileExt = resolveMobileFormExt(formCode, module, formKey);
|
|
170
|
+
} catch (e) {
|
|
171
|
+
// ignore
|
|
172
|
+
}
|
|
173
|
+
if (mobileExt && typeof mobileExt.dealwithFormParamExt === 'function') {
|
|
174
|
+
itemParam = mobileExt.dealwithFormParamExt(itemParam, component);
|
|
175
|
+
}
|
|
176
|
+
if (module && mobileExt && typeof mobileExt[module + '_dealwithFormParamExt'] === 'function') {
|
|
177
|
+
itemParam = mobileExt[module + '_dealwithFormParamExt'](itemParam, component);
|
|
178
|
+
}
|
|
179
|
+
return itemParam;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* 解析子表列数(扩展通过 itemParam.subColumnCount 回写,无新扩展方法)
|
|
184
|
+
* 优先级:扩展 itemParam → 子表 JSON → props → 全表单 → itemType → 默认 1
|
|
185
|
+
*/
|
|
186
|
+
function resolveSubColumnCountFromConfig(options) {
|
|
187
|
+
options = options || {};
|
|
188
|
+
var count = void 0;
|
|
189
|
+
|
|
190
|
+
var itemParam = options.itemParam;
|
|
191
|
+
if (itemParam && itemParam.subColumnCount != null && itemParam.subColumnCount !== '') {
|
|
192
|
+
count = clampSubColumnCount(itemParam.subColumnCount);
|
|
193
|
+
if (count != null) {
|
|
194
|
+
return count;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
var detailForm = options.detailForm;
|
|
199
|
+
if (detailForm) {
|
|
200
|
+
if (detailForm.subColumnCount != null && detailForm.subColumnCount !== '') {
|
|
201
|
+
count = clampSubColumnCount(detailForm.subColumnCount);
|
|
202
|
+
if (count != null) {
|
|
203
|
+
return count;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
count = resolveSubColumnCountFromItemType(detailForm.itemType);
|
|
207
|
+
if (count != null) {
|
|
208
|
+
return count;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
if (options.subColumnCount != null && options.subColumnCount !== '') {
|
|
213
|
+
count = clampSubColumnCount(options.subColumnCount);
|
|
214
|
+
if (count != null) {
|
|
215
|
+
return count;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
var allForm = options.allForm;
|
|
220
|
+
if (allForm && allForm.subColumnCount != null && allForm.subColumnCount !== '') {
|
|
221
|
+
count = clampSubColumnCount(allForm.subColumnCount);
|
|
222
|
+
if (count != null) {
|
|
223
|
+
return count;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
return 1;
|
|
152
228
|
}
|
package/lib/form/subForm.js
CHANGED
|
@@ -193,24 +193,16 @@ var PageHome = function (_React$Component) {
|
|
|
193
193
|
itemParam.show = true;
|
|
194
194
|
itemParam.value = value;
|
|
195
195
|
itemParam.detailAction = form.detailAction; //添加事件名字
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
itemParam
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}
|
|
207
|
-
} catch (e) {
|
|
208
|
-
// alert("exception: "+e.message);
|
|
209
|
-
}
|
|
210
|
-
if (mobileExt && typeof mobileExt["dealwithFormParamExt"] === "function") {
|
|
211
|
-
itemParam = mobileExt["dealwithFormParamExt"](itemParam, this);
|
|
212
|
-
itemType = itemParam.itemType;
|
|
213
|
-
}
|
|
196
|
+
// 流程 flow_common / 纯表单 form_common + mobileExt(可设置 itemParam.subColumnCount 等)
|
|
197
|
+
itemParam = (0, _formExtHelper.applyDealwithFormParamExt)({
|
|
198
|
+
itemParam: itemParam,
|
|
199
|
+
FlowCommon: FlowCommon,
|
|
200
|
+
module: module,
|
|
201
|
+
formKey: formKey,
|
|
202
|
+
formCode: this.state.formCode || this.props.formCode,
|
|
203
|
+
component: this
|
|
204
|
+
});
|
|
205
|
+
itemType = itemParam.itemType;
|
|
214
206
|
|
|
215
207
|
this.setState({
|
|
216
208
|
itemParam: itemParam
|
|
@@ -468,6 +460,266 @@ var PageHome = function (_React$Component) {
|
|
|
468
460
|
return itemParam;
|
|
469
461
|
}
|
|
470
462
|
|
|
463
|
+
// 解析子表列数(扩展在 dealwithCommonFormParam / dealwithFormParamExt 中设置 itemParam.subColumnCount)
|
|
464
|
+
|
|
465
|
+
}, {
|
|
466
|
+
key: 'resolveSubColumnCount',
|
|
467
|
+
value: function resolveSubColumnCount(props) {
|
|
468
|
+
var p = props || this.props;
|
|
469
|
+
return (0, _formExtHelper.resolveSubColumnCountFromConfig)({
|
|
470
|
+
itemParam: this.state.itemParam,
|
|
471
|
+
detailForm: p.form,
|
|
472
|
+
subColumnCount: p.subColumnCount,
|
|
473
|
+
allForm: p.allForm
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
// 占满整行的字段类型(多列模式下仍单列展示)
|
|
478
|
+
|
|
479
|
+
}, {
|
|
480
|
+
key: 'isSubFormFieldFullWidth',
|
|
481
|
+
value: function isSubFormFieldFullWidth(itemType) {
|
|
482
|
+
return itemType === 'textarea' || itemType === 'comment' || itemType === 'upload' || itemType === 'image' || itemType === 'html' || itemType === 'note' || itemType === 'title' || itemType === 'detail';
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
// 子表多列时可自动增高、内容换行的字段(单行文本/浮点等)
|
|
486
|
+
|
|
487
|
+
}, {
|
|
488
|
+
key: 'isSubFormFieldAutoWrap',
|
|
489
|
+
value: function isSubFormFieldAutoWrap(itemType) {
|
|
490
|
+
return itemType === 'text';
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
// 下拉、时间(右侧箭头需与值同一行对齐)
|
|
494
|
+
|
|
495
|
+
}, {
|
|
496
|
+
key: 'isSubFormFieldPickType',
|
|
497
|
+
value: function isSubFormFieldPickType(itemType) {
|
|
498
|
+
return itemType === 'select' || itemType === 'datetime';
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
// 子表多列字段单元格 class
|
|
502
|
+
|
|
503
|
+
}, {
|
|
504
|
+
key: 'getSubFormFieldSlotClass',
|
|
505
|
+
value: function getSubFormFieldSlotClass(multiCol, fullWidth, itemType) {
|
|
506
|
+
if (!multiCol || fullWidth) {
|
|
507
|
+
return '';
|
|
508
|
+
}
|
|
509
|
+
if (this.isSubFormFieldAutoWrap(itemType)) {
|
|
510
|
+
return 'subform-col-field-slot subform-col-field-slot-text';
|
|
511
|
+
}
|
|
512
|
+
if (this.isSubFormFieldPickType(itemType)) {
|
|
513
|
+
return 'subform-col-field-slot subform-col-field-slot-pick';
|
|
514
|
+
}
|
|
515
|
+
return 'subform-col-field-slot subform-col-field-slot-fixed';
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
// 子表标签样式:多列去掉边距;单列不覆盖边距,与主表 SaltUI 默认一致
|
|
519
|
+
|
|
520
|
+
}, {
|
|
521
|
+
key: 'getSubFormLabelCssText',
|
|
522
|
+
value: function getSubFormLabelCssText(isMultiCol) {
|
|
523
|
+
var ts = this.props.formStyle && this.props.formStyle.titleStyle ? this.props.formStyle.titleStyle : {};
|
|
524
|
+
var css = {
|
|
525
|
+
fontSize: '14px',
|
|
526
|
+
lineHeight: '24px',
|
|
527
|
+
color: 'rgb(51, 51, 51)',
|
|
528
|
+
fontWeight: 'bold',
|
|
529
|
+
background: 'transparent'
|
|
530
|
+
};
|
|
531
|
+
if (isMultiCol) {
|
|
532
|
+
css.marginLeft = '0';
|
|
533
|
+
css.padding = '4px 0 0 0';
|
|
534
|
+
css.paddingLeft = '0';
|
|
535
|
+
css.paddingRight = '0';
|
|
536
|
+
}
|
|
537
|
+
if (ts.fontSize) {
|
|
538
|
+
css.fontSize = ts.fontSize;
|
|
539
|
+
}
|
|
540
|
+
if (ts.color) {
|
|
541
|
+
css.color = ts.color;
|
|
542
|
+
}
|
|
543
|
+
if (ts.fontWeight) {
|
|
544
|
+
css.fontWeight = ts.fontWeight;
|
|
545
|
+
}
|
|
546
|
+
if (ts.fontFamily) {
|
|
547
|
+
css.fontFamily = ts.fontFamily;
|
|
548
|
+
}
|
|
549
|
+
if (ts.fontStyle) {
|
|
550
|
+
css.fontStyle = ts.fontStyle;
|
|
551
|
+
}
|
|
552
|
+
var parts = [];
|
|
553
|
+
Object.keys(css).forEach(function (k) {
|
|
554
|
+
var key = k.replace(/[A-Z]/g, function (m) {
|
|
555
|
+
return '-' + m.toLowerCase();
|
|
556
|
+
});
|
|
557
|
+
parts.push(key + ':' + css[k]);
|
|
558
|
+
});
|
|
559
|
+
return parts.join(';');
|
|
560
|
+
}
|
|
561
|
+
}, {
|
|
562
|
+
key: 'renderSubFormLabelStyle',
|
|
563
|
+
value: function renderSubFormLabelStyle(isMultiCol) {
|
|
564
|
+
if (!isMultiCol) {
|
|
565
|
+
return null;
|
|
566
|
+
}
|
|
567
|
+
var scope = '.subform-fields-wrap.subform-fields-multi';
|
|
568
|
+
var labelCss = this.getSubFormLabelCssText(true);
|
|
569
|
+
return _react2.default.createElement('style', { dangerouslySetInnerHTML: { __html: [scope + ' .t-field-layout-v-label,', scope + ' .t-field-layout-v-label-left,', scope + ' .t-field-layout-h-label,', scope + ' .t-field-layout-h-label-left{' + labelCss + '}', scope + ' .t-field-layout-v-label,' + scope + ' .t-field-layout-h-label{color:rgb(51,51,51)!important;margin-left:0!important;padding-left:0!important;padding-right:0!important;}'].join('') } });
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
// 子表多列布局样式(按行分组,避免 flex-wrap 导致错位)
|
|
573
|
+
|
|
574
|
+
}, {
|
|
575
|
+
key: 'renderSubFormFieldsStyle',
|
|
576
|
+
value: function renderSubFormFieldsStyle(subColumnCount) {
|
|
577
|
+
if (subColumnCount <= 1) {
|
|
578
|
+
return null;
|
|
579
|
+
}
|
|
580
|
+
var scope = '.subform-fields-wrap.subform-fields-multi';
|
|
581
|
+
var row = scope + ' .subform-fields-row';
|
|
582
|
+
var slot = scope + ' .subform-field-col>.subform-col-field-slot';
|
|
583
|
+
var col = scope + ' .subform-col-field';
|
|
584
|
+
var text = scope + ' .subform-col-field-slot-text';
|
|
585
|
+
var pick = scope + ' .subform-col-field-slot-pick';
|
|
586
|
+
var pickCol = pick + ' ' + col;
|
|
587
|
+
return _react2.default.createElement('style', { dangerouslySetInnerHTML: { __html: [scope + '{display:block;}', row + '{display:flex;align-items:stretch;width:100%;border-bottom:0.5px solid #e9ebee;box-sizing:border-box;}', scope + ' .subform-field-full{width:100%;box-sizing:border-box;border-bottom:0.5px solid #e9ebee;}', scope + ' .subform-field-col{display:flex;flex-direction:column;box-sizing:border-box;}', scope + ' .subform-field-col-empty{visibility:hidden;}', slot + '{box-sizing:border-box;padding:8px 16px 8px 0;overflow:hidden;}', col + '{width:100%;}', col + ' .t-group-list{border-bottom:none!important;background:transparent;}', col + ' .t-group-list-item::after{display:none!important;}', col + '>.t-group-list>.t-group-list-item::after{display:none!important;}', col + ' .t-field-box.t-field-content-box{display:flex!important;flex-direction:column!important;align-items:stretch!important;width:100%!important;min-height:0!important;padding-left:0!important;padding-right:0!important;}', col + ' .t-field-layout-h-label,' + col + ' .t-field-layout-v-label,' + col + ' .t-field-layout-v-label-left{width:100%!important;max-width:100%!important;margin-left:0!important;padding-left:0!important;padding-right:0!important;color:rgb(51,51,51)!important;background:transparent!important;}', col + ' .t-field-box{padding-left:0!important;padding-right:0!important;}', col + ' .t-field-content-box{justify-content:flex-start!important;align-items:flex-start!important;}', col + ' .t-field-content-box .t-FB1,' + col + ' .t-field-multi{width:100%!important;max-width:100%!important;padding:0 0 4px 0!important;text-align:left!important;}', col + ' .t-field-content-box .t-FB1 span,' + col + ' .t-field-multi span,' + col + ' .t-text-field-content-main span{text-align:left!important;word-break:break-word;}', col + ' .t-text-field-content{width:100%;justify-content:flex-start!important;}', col + ' .t-text-field-input{text-align:left!important;}', text + ' .t-text-field-input,' + text + ' .t-text-field-content-main span{white-space:normal!important;word-wrap:break-word;word-break:break-word;line-height:20px;}', text + ' .t-text-field-placeholder.t-DN{display:none!important;}', pickCol + '.t-field.t-select-field.t-FBH,' + pickCol + '.t-field.t-datetime-field.t-FBH{display:block!important;position:relative!important;width:100%!important;}', pickCol + '.t-field-pos-box{width:100%!important;padding-right:28px!important;box-sizing:border-box;}', pickCol + '.t-field-layout-v-label{margin-left:0!important;padding-left:0!important;}', pickCol + '.t-field-content-box{display:flex!important;flex-direction:row!important;align-items:center!important;justify-content:flex-start!important;width:100%!important;min-height:24px!important;padding:2px 0 11px 0!important;}', pickCol + '.t-field-pos-icon{position:absolute!important;right:0!important;top:auto!important;bottom:10px!important;margin:0!important;height:26px!important;display:flex!important;align-items:center!important;justify-content:center!important;}', pickCol + '.t-select-field-content,' + pickCol + '.t-datetime-field-value,' + pickCol + '.t-datetime-field-placeholder,' + pickCol + '.t-select-field-placeholder{min-height:24px!important;line-height:24px!important;}', pickCol + '.t-field-content-box>.t-FB1{flex:1!important;width:100%!important;min-width:0!important;max-width:100%!important;padding:0!important;text-align:left!important;}', pickCol + '.t-select-field-content,' + pickCol + '.t-field-content-box>.t-FB1>div{width:100%!important;text-align:left!important;}', pickCol + '.t-select-field-placeholder,' + pickCol + '.t-datetime-field-placeholder,' + pickCol + '.t-select-field-value,' + pickCol + '.t-datetime-field-value{text-align:left!important;justify-content:flex-start!important;width:100%!important;}', pickCol + '.t-select-field-placeholder,' + pickCol + '.t-datetime-field-placeholder{position:static!important;height:auto!important;line-height:24px!important;flex:none!important;max-width:100%!important;}', pickCol + '.t-select-field-value,' + pickCol + '.t-datetime-field-value{display:flex!important;flex-direction:row!important;align-items:center!important;flex-wrap:nowrap!important;}', pickCol + '.t-select-field-value .t-FB1,' + pickCol + '.t-datetime-field-value .t-FB1,' + pickCol + '.t-select-field-value span,' + pickCol + '.t-datetime-field-value span{text-align:left!important;width:100%!important;}'].join('') } });
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
// 将字段列表按列数拆成行(整行字段单独成行)
|
|
591
|
+
|
|
592
|
+
}, {
|
|
593
|
+
key: 'buildSubFormFieldRows',
|
|
594
|
+
value: function buildSubFormFieldRows(formFields, subColumnCount) {
|
|
595
|
+
var t = this;
|
|
596
|
+
var rows = [];
|
|
597
|
+
var currentRow = [];
|
|
598
|
+
formFields.forEach(function (item2) {
|
|
599
|
+
if (t.isSubFormFieldFullWidth(item2.itemType)) {
|
|
600
|
+
if (currentRow.length) {
|
|
601
|
+
rows.push({ type: 'cols', fields: currentRow });
|
|
602
|
+
currentRow = [];
|
|
603
|
+
}
|
|
604
|
+
rows.push({ type: 'full', field: item2 });
|
|
605
|
+
} else {
|
|
606
|
+
currentRow.push(item2);
|
|
607
|
+
if (currentRow.length >= subColumnCount) {
|
|
608
|
+
rows.push({ type: 'cols', fields: currentRow });
|
|
609
|
+
currentRow = [];
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
});
|
|
613
|
+
if (currentRow.length) {
|
|
614
|
+
rows.push({ type: 'cols', fields: currentRow });
|
|
615
|
+
}
|
|
616
|
+
return rows;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
// 渲染子表一行内的单个字段(公共 props)
|
|
620
|
+
|
|
621
|
+
}, {
|
|
622
|
+
key: 'renderSubFormFieldForm',
|
|
623
|
+
value: function renderSubFormFieldForm(item2, rowIndex, subColumnCount) {
|
|
624
|
+
var t = this;
|
|
625
|
+
var formEl = _react2.default.createElement(_form2.default, {
|
|
626
|
+
className: 'subform_' + item2.uniqueName,
|
|
627
|
+
keyNo: rowIndex,
|
|
628
|
+
ref: item2.uniqueName + '_' + rowIndex,
|
|
629
|
+
dataType: 'sub',
|
|
630
|
+
subTblName: t.state.itemParam.key,
|
|
631
|
+
module: t.state.module,
|
|
632
|
+
formKey: item2.formKey,
|
|
633
|
+
status: t.state.status,
|
|
634
|
+
form: item2,
|
|
635
|
+
allForm: t.props.allForm,
|
|
636
|
+
formStyle: t.props.formStyle,
|
|
637
|
+
data: t.state.itemParam.value[rowIndex],
|
|
638
|
+
fieldControll: t.state.fieldControll,
|
|
639
|
+
caIsPrd: t.props.caIsPrd,
|
|
640
|
+
preCaFields: t.props.preCaFields,
|
|
641
|
+
formRelaFieldMaps: t.props.formRelaFieldMaps,
|
|
642
|
+
linkFields: t.props.linkFields,
|
|
643
|
+
onChange: t.changeSub.bind(t, t.state.itemParam, rowIndex),
|
|
644
|
+
reloadSubItemParam: t.reloadSubItemParam.bind(t)
|
|
645
|
+
});
|
|
646
|
+
if (subColumnCount > 1) {
|
|
647
|
+
return _react2.default.cloneElement(formEl, { subColumnCount: subColumnCount });
|
|
648
|
+
}
|
|
649
|
+
return formEl;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
// 渲染子表一行内的字段列表(仅 subColumnCount>1 时多列布局,为 1 时与原版一致)
|
|
653
|
+
|
|
654
|
+
}, {
|
|
655
|
+
key: 'renderSubFormFields',
|
|
656
|
+
value: function renderSubFormFields(formFields, rowIndex) {
|
|
657
|
+
var t = this;
|
|
658
|
+
var subColumnCount = t.resolveSubColumnCount(t.props);
|
|
659
|
+
|
|
660
|
+
if (subColumnCount <= 1) {
|
|
661
|
+
return formFields.map(function (item2, j) {
|
|
662
|
+
return t.renderSubFormFieldForm(item2, rowIndex, subColumnCount);
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
var colWidth = 100 / subColumnCount + '%';
|
|
667
|
+
var rows = t.buildSubFormFieldRows(formFields, subColumnCount);
|
|
668
|
+
return _react2.default.createElement(
|
|
669
|
+
'div',
|
|
670
|
+
null,
|
|
671
|
+
t.renderSubFormFieldsStyle(subColumnCount),
|
|
672
|
+
_react2.default.createElement(
|
|
673
|
+
'div',
|
|
674
|
+
{ className: 'subform-fields-wrap subform-fields-multi' },
|
|
675
|
+
rows.map(function (row, ri) {
|
|
676
|
+
if (row.type === 'full') {
|
|
677
|
+
var fullField = row.field;
|
|
678
|
+
return _react2.default.createElement(
|
|
679
|
+
'div',
|
|
680
|
+
{ key: fullField.uniqueName || 'full_' + ri, className: 'subform-field-full' },
|
|
681
|
+
_react2.default.createElement(
|
|
682
|
+
'div',
|
|
683
|
+
{ className: t.getSubFormFieldSlotClass(true, true, fullField.itemType) },
|
|
684
|
+
t.renderSubFormFieldForm(fullField, rowIndex, subColumnCount)
|
|
685
|
+
)
|
|
686
|
+
);
|
|
687
|
+
}
|
|
688
|
+
var cells = [];
|
|
689
|
+
for (var ci = 0; ci < subColumnCount; ci++) {
|
|
690
|
+
var cellField = row.fields[ci];
|
|
691
|
+
if (cellField) {
|
|
692
|
+
cells.push(_react2.default.createElement(
|
|
693
|
+
'div',
|
|
694
|
+
{
|
|
695
|
+
key: cellField.uniqueName || 'col_' + ri + '_' + ci,
|
|
696
|
+
className: 'subform-field-col',
|
|
697
|
+
style: { width: colWidth, boxSizing: 'border-box' }
|
|
698
|
+
},
|
|
699
|
+
_react2.default.createElement(
|
|
700
|
+
'div',
|
|
701
|
+
{ className: t.getSubFormFieldSlotClass(true, false, cellField.itemType) },
|
|
702
|
+
t.renderSubFormFieldForm(cellField, rowIndex, subColumnCount)
|
|
703
|
+
)
|
|
704
|
+
));
|
|
705
|
+
} else {
|
|
706
|
+
cells.push(_react2.default.createElement('div', {
|
|
707
|
+
key: 'empty_' + ri + '_' + ci,
|
|
708
|
+
className: 'subform-field-col subform-field-col-empty',
|
|
709
|
+
style: { width: colWidth, boxSizing: 'border-box' }
|
|
710
|
+
}));
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
return _react2.default.createElement(
|
|
714
|
+
'div',
|
|
715
|
+
{ key: 'row_' + ri, className: 'subform-fields-row' },
|
|
716
|
+
cells
|
|
717
|
+
);
|
|
718
|
+
})
|
|
719
|
+
)
|
|
720
|
+
);
|
|
721
|
+
}
|
|
722
|
+
|
|
471
723
|
//明细显示隐藏(全部)
|
|
472
724
|
|
|
473
725
|
}, {
|
|
@@ -741,9 +993,7 @@ var PageHome = function (_React$Component) {
|
|
|
741
993
|
_react2.default.createElement(
|
|
742
994
|
'div',
|
|
743
995
|
{ className: item.show ? "" : "t-DN" },
|
|
744
|
-
item.form
|
|
745
|
-
return _react2.default.createElement(_form2.default, { className: "subform_" + item2.uniqueName, keyNo: i, ref: item2.uniqueName + '_' + i, dataType: 'sub', subTblName: t.state.itemParam.key, module: t.state.module, formKey: item2.formKey, status: t.state.status, form: item2, allForm: t.props.allForm, formStyle: t.props.formStyle, data: t.state.itemParam.value[i], fieldControll: t.state.fieldControll, caIsPrd: t.props.caIsPrd, preCaFields: t.props.preCaFields, formRelaFieldMaps: t.props.formRelaFieldMaps, linkFields: t.props.linkFields, onChange: _this2.changeSub.bind(_this2, _this2.state.itemParam, i), reloadSubItemParam: _this2.reloadSubItemParam.bind(_this2) });
|
|
746
|
-
})
|
|
996
|
+
t.renderSubFormFields(item.form, i)
|
|
747
997
|
)
|
|
748
998
|
);
|
|
749
999
|
});
|
|
@@ -890,6 +1140,7 @@ var PageHome = function (_React$Component) {
|
|
|
890
1140
|
_react2.default.createElement(
|
|
891
1141
|
'div',
|
|
892
1142
|
{ className: this.state.itemParam.show ? "" : 't-DN' },
|
|
1143
|
+
t.renderSubFormLabelStyle(t.resolveSubColumnCount(t.props) > 1),
|
|
893
1144
|
this.getDetai()
|
|
894
1145
|
),
|
|
895
1146
|
_react2.default.createElement(
|