fmui-base 2.3.6 → 2.3.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/README.md +2 -0
- package/lib/form/form.js +11 -0
- package/lib/form/formExtHelper.js +161 -0
- package/lib/form/subForm.js +139 -42
- package/lib/selectMember/select.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
package/lib/form/form.js
CHANGED
|
@@ -1610,6 +1610,10 @@ var PageHome = function (_React$Component) {
|
|
|
1610
1610
|
}
|
|
1611
1611
|
if (t.props.dataType === 'sub') {
|
|
1612
1612
|
t.applySubFormLabelStyle(itemParam);
|
|
1613
|
+
// 子表多列:loadComponet 完成后同步排版(预判与 ref 不一致时需重排)
|
|
1614
|
+
if (t.props.onSubFieldLayoutChange) {
|
|
1615
|
+
t.props.onSubFieldLayoutChange();
|
|
1616
|
+
}
|
|
1613
1617
|
}
|
|
1614
1618
|
this.props.onChange(data, itemParam);
|
|
1615
1619
|
});
|
|
@@ -2047,6 +2051,7 @@ var PageHome = function (_React$Component) {
|
|
|
2047
2051
|
var itemParam = this.state.itemParam;
|
|
2048
2052
|
var selectText = ''; //多选值修改的显示文本
|
|
2049
2053
|
var checkboxValueHas = false; //是否有多选值修改
|
|
2054
|
+
var layoutNeedRefresh = false;
|
|
2050
2055
|
for (var i = 0; i < itemNew.length; i++) {
|
|
2051
2056
|
var key = itemNew[i].key;
|
|
2052
2057
|
if (key == 'value') {
|
|
@@ -2099,6 +2104,9 @@ var PageHome = function (_React$Component) {
|
|
|
2099
2104
|
if (key == 'isHidden' && itemNew[i].value) {
|
|
2100
2105
|
itemParam.required = false;
|
|
2101
2106
|
}
|
|
2107
|
+
if (key === 'isHidden') {
|
|
2108
|
+
layoutNeedRefresh = true;
|
|
2109
|
+
}
|
|
2102
2110
|
}
|
|
2103
2111
|
}
|
|
2104
2112
|
this.setState({
|
|
@@ -2130,6 +2138,9 @@ var PageHome = function (_React$Component) {
|
|
|
2130
2138
|
var formData = this.props.data;
|
|
2131
2139
|
this.dealwithData(itemParam, formData.mainTblData || [], formData.relatedTbl || []);
|
|
2132
2140
|
}
|
|
2141
|
+
if (layoutNeedRefresh && this.props.dataType === 'sub' && this.props.onSubFieldLayoutChange) {
|
|
2142
|
+
this.props.onSubFieldLayoutChange();
|
|
2143
|
+
}
|
|
2133
2144
|
if (!silent && this.props.onChange) {
|
|
2134
2145
|
this.props.onChange(this.props.data, itemParam);
|
|
2135
2146
|
}
|
|
@@ -9,6 +9,10 @@ exports.clampSubColumnCount = clampSubColumnCount;
|
|
|
9
9
|
exports.buildDetailItemParam = buildDetailItemParam;
|
|
10
10
|
exports.applyDealwithFormParamExt = applyDealwithFormParamExt;
|
|
11
11
|
exports.resolveSubColumnCountFromConfig = resolveSubColumnCountFromConfig;
|
|
12
|
+
exports.normalizeRelaTriggerValue = normalizeRelaTriggerValue;
|
|
13
|
+
exports.isRelaRuleMatched = isRelaRuleMatched;
|
|
14
|
+
exports.getRelaTriggerFieldValueForLayout = getRelaTriggerFieldValueForLayout;
|
|
15
|
+
exports.resolveFieldRelaHidden = resolveFieldRelaHidden;
|
|
12
16
|
exports.mapCommentAttitudeSaveValue = mapCommentAttitudeSaveValue;
|
|
13
17
|
/**
|
|
14
18
|
* 表单扩展加载:流程 flow_common / 纯表单 form_common
|
|
@@ -228,6 +232,163 @@ function resolveSubColumnCountFromConfig(options) {
|
|
|
228
232
|
return 1;
|
|
229
233
|
}
|
|
230
234
|
|
|
235
|
+
/** 关联触发值规范化(与 form.jsx / table.jsx normalizeRelaTriggerValue 一致) */
|
|
236
|
+
function normalizeRelaTriggerValue(nowValue) {
|
|
237
|
+
if (nowValue == null || typeof nowValue === 'undefined') {
|
|
238
|
+
return '';
|
|
239
|
+
}
|
|
240
|
+
nowValue = String(nowValue);
|
|
241
|
+
if (nowValue.indexOf('[') >= 0 && nowValue.indexOf(']') >= 0) {
|
|
242
|
+
try {
|
|
243
|
+
var nowValueArray = JSON.parse(nowValue);
|
|
244
|
+
if (nowValueArray.length === 1) {
|
|
245
|
+
return nowValueArray[0];
|
|
246
|
+
}
|
|
247
|
+
return nowValueArray.join(',');
|
|
248
|
+
} catch (e) {
|
|
249
|
+
return nowValue;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
if (nowValue !== '' && (nowValue.indexOf('$#$#') >= 0 || nowValue.indexOf('#$#$') >= 0)) {
|
|
253
|
+
if (nowValue.indexOf('#$#$') >= 0) {
|
|
254
|
+
var nowValueList = nowValue.split('#$#$');
|
|
255
|
+
if (nowValueList.length === 1) {
|
|
256
|
+
return nowValueList[0].replace(/\$#\$#/g, '');
|
|
257
|
+
}
|
|
258
|
+
return nowValueList.map(function (item) {
|
|
259
|
+
return item.replace(/\$#\$#/g, '');
|
|
260
|
+
}).join(',');
|
|
261
|
+
}
|
|
262
|
+
return nowValue.replace(/\$#\$#/g, '');
|
|
263
|
+
}
|
|
264
|
+
return nowValue;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/** 关联规则是否命中(与 form.jsx isRelaRuleMatched 一致) */
|
|
268
|
+
function isRelaRuleMatched(rule, nowValue) {
|
|
269
|
+
var triggerFieldVal = rule.triggerFieldVal;
|
|
270
|
+
if (triggerFieldVal == ' ') {
|
|
271
|
+
triggerFieldVal = '';
|
|
272
|
+
}
|
|
273
|
+
if (triggerFieldVal === '') {
|
|
274
|
+
return true;
|
|
275
|
+
}
|
|
276
|
+
nowValue = nowValue == null ? '' : String(nowValue);
|
|
277
|
+
return triggerFieldVal == nowValue || nowValue.split(',').indexOf(triggerFieldVal) !== -1;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/** 读取关联触发字段当前值(布局预判,与 form.jsx 子表场景一致) */
|
|
281
|
+
function getRelaTriggerFieldValueForLayout(rule, fullFormData, rowIndex) {
|
|
282
|
+
var nowValue = '';
|
|
283
|
+
if (!rule || !fullFormData) {
|
|
284
|
+
return '';
|
|
285
|
+
}
|
|
286
|
+
var mainTblName = fullFormData.mainTblName;
|
|
287
|
+
var mainTblData = fullFormData.mainTblData || [];
|
|
288
|
+
if (rule.triggerTblName === mainTblName) {
|
|
289
|
+
for (var i = 0; i < mainTblData.length; i++) {
|
|
290
|
+
if (mainTblData[i].key === rule.triggerFieldName) {
|
|
291
|
+
nowValue = mainTblData[i].value ? mainTblData[i].value : '';
|
|
292
|
+
break;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
} else if (fullFormData.subTbl && fullFormData.subTbl.length > 0) {
|
|
296
|
+
var ridx = typeof rowIndex !== 'undefined' ? rowIndex : 0;
|
|
297
|
+
for (var j = 0; j < fullFormData.subTbl.length; j++) {
|
|
298
|
+
var subItem = fullFormData.subTbl[j];
|
|
299
|
+
if (subItem.subTblName === rule.triggerTblName && subItem.subTblData && subItem.subTblData.length > ridx) {
|
|
300
|
+
var subRow = subItem.subTblData[ridx];
|
|
301
|
+
for (var k = 0; k < subRow.length; k++) {
|
|
302
|
+
if (subRow[k].key === rule.triggerFieldName) {
|
|
303
|
+
nowValue = subRow[k].value ? subRow[k].value : '';
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
return normalizeRelaTriggerValue(nowValue);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* 预判字段是否被关联规则隐藏(与 form.jsx dealwithRelaField 的 isHidden 逻辑一致)
|
|
314
|
+
* 用于子表多列首帧排版,避免等待 Form ref 就绪才隐藏。
|
|
315
|
+
*/
|
|
316
|
+
function resolveFieldRelaHidden(options) {
|
|
317
|
+
options = options || {};
|
|
318
|
+
var uniqueName = options.uniqueName;
|
|
319
|
+
var formRelaFieldMaps = options.formRelaFieldMaps;
|
|
320
|
+
var fieldControll = options.fieldControll || {};
|
|
321
|
+
var formReadOnly = !!options.formReadOnly;
|
|
322
|
+
|
|
323
|
+
if (!uniqueName || !formRelaFieldMaps || !formRelaFieldMaps[uniqueName]) {
|
|
324
|
+
return false;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
var defaulthideFields = [];
|
|
328
|
+
var defaultshowFields = [];
|
|
329
|
+
var defaultmustFields = [];
|
|
330
|
+
if (fieldControll.hiddenFields) {
|
|
331
|
+
fieldControll.hiddenFields.split(',').forEach(function (f) {
|
|
332
|
+
if (f) {
|
|
333
|
+
defaulthideFields.push(f);
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
if (fieldControll.showFields) {
|
|
338
|
+
fieldControll.showFields.split(',').forEach(function (f) {
|
|
339
|
+
if (f) {
|
|
340
|
+
defaultshowFields.push(f);
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
if (fieldControll.mustFields) {
|
|
345
|
+
fieldControll.mustFields.split(',').forEach(function (f) {
|
|
346
|
+
if (f) {
|
|
347
|
+
defaultmustFields.push(f);
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
var baseline = {
|
|
353
|
+
isHidden: defaulthideFields.indexOf(uniqueName) !== -1 || !!options.baselineHidden,
|
|
354
|
+
required: defaultmustFields.indexOf(uniqueName) !== -1 || options.fieldValid === true,
|
|
355
|
+
readOnly: defaultshowFields.indexOf(uniqueName) !== -1 || formReadOnly
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
var skipEditMust = defaultshowFields.indexOf(uniqueName) !== -1 || defaultmustFields.indexOf(uniqueName) !== -1 || baseline.readOnly === true || formReadOnly;
|
|
359
|
+
|
|
360
|
+
var isHidden = baseline.isHidden;
|
|
361
|
+
var hideFlag = baseline.isHidden;
|
|
362
|
+
var mustFlag = baseline.required;
|
|
363
|
+
|
|
364
|
+
var rules = formRelaFieldMaps[uniqueName];
|
|
365
|
+
var sortedRules = rules.slice().sort(function (a, b) {
|
|
366
|
+
return (parseInt(a.sortNo, 10) || 0) - (parseInt(b.sortNo, 10) || 0);
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
for (var ri = sortedRules.length - 1; ri >= 0; ri--) {
|
|
370
|
+
var rule = sortedRules[ri];
|
|
371
|
+
var nowValue = getRelaTriggerFieldValueForLayout(rule, options.fullFormData, options.rowIndex);
|
|
372
|
+
var matched = isRelaRuleMatched(rule, nowValue);
|
|
373
|
+
var editType = rule.editType;
|
|
374
|
+
if (editType === 'hide' || editType === 'rowhide') {
|
|
375
|
+
if (matched) {
|
|
376
|
+
isHidden = true;
|
|
377
|
+
hideFlag = true;
|
|
378
|
+
} else if (!hideFlag) {
|
|
379
|
+
isHidden = baseline.isHidden;
|
|
380
|
+
}
|
|
381
|
+
} else if (editType === 'must') {
|
|
382
|
+
if (!skipEditMust && matched && !hideFlag) {
|
|
383
|
+
mustFlag = true;
|
|
384
|
+
isHidden = false;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
return !!isHidden;
|
|
390
|
+
}
|
|
391
|
+
|
|
231
392
|
/** 批示意见态度显示值转存库值(与 PC comment_idea_radio 一致) */
|
|
232
393
|
function mapCommentAttitudeSaveValue(displayValue) {
|
|
233
394
|
var val = displayValue == null ? '' : String(displayValue);
|
package/lib/form/subForm.js
CHANGED
|
@@ -584,7 +584,112 @@ var PageHome = function (_React$Component) {
|
|
|
584
584
|
var text = scope + ' .subform-col-field-slot-text';
|
|
585
585
|
var pick = scope + ' .subform-col-field-slot-pick';
|
|
586
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-
|
|
587
|
+
return _react2.default.createElement('style', { dangerouslySetInnerHTML: { __html: [scope + '{display:block;}', scope + ' .subform-fields-flow{display:flex;flex-wrap:wrap;align-items:stretch;width:100%;box-sizing:border-box;}', 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;border-bottom:0.5px solid #e9ebee;}', scope + ' .subform-field-slot-hidden{display:none!important;width:0!important;height:0!important;overflow:hidden!important;margin:0!important;padding:0!important;border:none!important;}', 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-radio-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-radio-field-value,' + 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-radio-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-radio-field-value,' + pickCol + '.t-datetime-field-value{display:flex!important;flex-direction:row!important;align-items:flex-start!important;flex-wrap:wrap!important;}', pickCol + '.t-select-field-value .t-FB1,' + pickCol + '.t-radio-field-value .t-FB1,' + pickCol + '.t-datetime-field-value .t-FB1,' + pickCol + '.t-select-field-value span,' + pickCol + '.t-radio-field-value span,' + pickCol + '.t-datetime-field-value span{display:block!important;width:100%!important;max-width:100%!important;white-space:normal!important;word-break:normal!important;overflow-wrap:break-word!important;-webkit-line-clamp:unset!important;line-clamp:unset!important;-webkit-box-orient:horizontal!important;text-align:left!important;}'].join('') } });
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
// 子表字段是否隐藏(设计隐藏 / 流程权限 / 关联规则 / 扩展方法)
|
|
591
|
+
|
|
592
|
+
}, {
|
|
593
|
+
key: 'isSubFormFieldHidden',
|
|
594
|
+
value: function isSubFormFieldHidden(field, rowIndex) {
|
|
595
|
+
if (field && field.isHidden) {
|
|
596
|
+
return true;
|
|
597
|
+
}
|
|
598
|
+
var fieldControll = this.state.fieldControll || this.props.fieldControll;
|
|
599
|
+
if (fieldControll && fieldControll.hiddenFields && field) {
|
|
600
|
+
var hiddenCsv = ',' + fieldControll.hiddenFields + ',';
|
|
601
|
+
if (field.uniqueName && hiddenCsv.indexOf(',' + field.uniqueName + ',') >= 0) {
|
|
602
|
+
return true;
|
|
603
|
+
}
|
|
604
|
+
var subTblName = this.state.itemParam && this.state.itemParam.key;
|
|
605
|
+
if (subTblName && field.itemCode && hiddenCsv.indexOf(',' + subTblName + '_' + field.itemCode + ',') >= 0) {
|
|
606
|
+
return true;
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
if (field && field.uniqueName != null && rowIndex != null) {
|
|
610
|
+
var fieldRef = this.refs[field.uniqueName + '_' + rowIndex];
|
|
611
|
+
if (fieldRef && fieldRef.state && fieldRef.state.loaded && fieldRef.state.itemParam) {
|
|
612
|
+
return !!fieldRef.state.itemParam.isHidden;
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
return this.predictSubFormFieldRelaHidden(field, rowIndex);
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
// ref 未就绪时按关联规则预判隐藏(与 Form.dealwithRelaField 一致)
|
|
619
|
+
|
|
620
|
+
}, {
|
|
621
|
+
key: 'predictSubFormFieldRelaHidden',
|
|
622
|
+
value: function predictSubFormFieldRelaHidden(field, rowIndex) {
|
|
623
|
+
if (!field || !field.uniqueName) {
|
|
624
|
+
return false;
|
|
625
|
+
}
|
|
626
|
+
return (0, _formExtHelper.resolveFieldRelaHidden)({
|
|
627
|
+
uniqueName: field.uniqueName,
|
|
628
|
+
formRelaFieldMaps: this.props.formRelaFieldMaps,
|
|
629
|
+
fieldControll: this.state.fieldControll || this.props.fieldControll,
|
|
630
|
+
fullFormData: this.props.data,
|
|
631
|
+
rowIndex: rowIndex,
|
|
632
|
+
baselineHidden: false,
|
|
633
|
+
formReadOnly: field.readOnly === true,
|
|
634
|
+
fieldValid: field.valid == 'true'
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
// 过滤当前行可见字段(多列排版仅参与可见字段)
|
|
639
|
+
|
|
640
|
+
}, {
|
|
641
|
+
key: 'getVisibleSubFormFields',
|
|
642
|
+
value: function getVisibleSubFormFields(formFields, rowIndex) {
|
|
643
|
+
var t = this;
|
|
644
|
+
return (formFields || []).filter(function (field) {
|
|
645
|
+
return !t.isSubFormFieldHidden(field, rowIndex);
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
// 子表字段显隐变化后刷新多列排版
|
|
650
|
+
|
|
651
|
+
}, {
|
|
652
|
+
key: 'notifySubFormLayoutChange',
|
|
653
|
+
value: function notifySubFormLayoutChange() {
|
|
654
|
+
if (this.resolveSubColumnCount(this.props) <= 1) {
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
657
|
+
if (this._layoutRefreshTimer) {
|
|
658
|
+
clearTimeout(this._layoutRefreshTimer);
|
|
659
|
+
}
|
|
660
|
+
var t = this;
|
|
661
|
+
this._layoutRefreshTimer = setTimeout(function () {
|
|
662
|
+
t._layoutRefreshTimer = null;
|
|
663
|
+
t.forceUpdate();
|
|
664
|
+
}, 0);
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
// 基于可见字段计算多列排版元数据(保持 formFields 原始顺序挂载,避免 remount)
|
|
668
|
+
|
|
669
|
+
}, {
|
|
670
|
+
key: 'buildSubFormFieldLayoutMeta',
|
|
671
|
+
value: function buildSubFormFieldLayoutMeta(formFields, rowIndex, subColumnCount) {
|
|
672
|
+
var t = this;
|
|
673
|
+
var meta = {};
|
|
674
|
+
var visibleFields = t.getVisibleSubFormFields(formFields, rowIndex);
|
|
675
|
+
var rows = t.buildSubFormFieldRows(visibleFields, subColumnCount);
|
|
676
|
+
var order = 0;
|
|
677
|
+
rows.forEach(function (row) {
|
|
678
|
+
if (row.type === 'full') {
|
|
679
|
+
meta[row.field.uniqueName] = { type: 'full', order: order++, rowFieldCount: 1 };
|
|
680
|
+
} else {
|
|
681
|
+
var rowFieldCount = row.fields.length;
|
|
682
|
+
row.fields.forEach(function (field) {
|
|
683
|
+
meta[field.uniqueName] = { type: 'col', order: order++, rowFieldCount: rowFieldCount };
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
});
|
|
687
|
+
(formFields || []).forEach(function (field) {
|
|
688
|
+
if (!meta[field.uniqueName]) {
|
|
689
|
+
meta[field.uniqueName] = { type: 'hidden' };
|
|
690
|
+
}
|
|
691
|
+
});
|
|
692
|
+
return meta;
|
|
588
693
|
}
|
|
589
694
|
|
|
590
695
|
// 将字段列表按列数拆成行(整行字段单独成行)
|
|
@@ -642,7 +747,8 @@ var PageHome = function (_React$Component) {
|
|
|
642
747
|
formRelaFieldMaps: t.props.formRelaFieldMaps,
|
|
643
748
|
linkFields: t.props.linkFields,
|
|
644
749
|
onChange: t.changeSub.bind(t, t.state.itemParam, rowIndex),
|
|
645
|
-
reloadSubItemParam: t.reloadSubItemParam.bind(t)
|
|
750
|
+
reloadSubItemParam: t.reloadSubItemParam.bind(t),
|
|
751
|
+
onSubFieldLayoutChange: t.notifySubFormLayoutChange.bind(t)
|
|
646
752
|
});
|
|
647
753
|
if (subColumnCount > 1) {
|
|
648
754
|
return _react2.default.cloneElement(formEl, { subColumnCount: subColumnCount });
|
|
@@ -664,8 +770,7 @@ var PageHome = function (_React$Component) {
|
|
|
664
770
|
});
|
|
665
771
|
}
|
|
666
772
|
|
|
667
|
-
var
|
|
668
|
-
var rows = t.buildSubFormFieldRows(formFields, subColumnCount);
|
|
773
|
+
var layoutMeta = t.buildSubFormFieldLayoutMeta(formFields, rowIndex, subColumnCount);
|
|
669
774
|
return _react2.default.createElement(
|
|
670
775
|
'div',
|
|
671
776
|
null,
|
|
@@ -673,50 +778,42 @@ var PageHome = function (_React$Component) {
|
|
|
673
778
|
_react2.default.createElement(
|
|
674
779
|
'div',
|
|
675
780
|
{ className: 'subform-fields-wrap subform-fields-multi' },
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
781
|
+
_react2.default.createElement(
|
|
782
|
+
'div',
|
|
783
|
+
{ className: 'subform-fields-flow' },
|
|
784
|
+
formFields.map(function (field) {
|
|
785
|
+
var fieldMeta = layoutMeta[field.uniqueName] || { type: 'hidden' };
|
|
786
|
+
var hidden = fieldMeta.type === 'hidden';
|
|
787
|
+
var fullWidth = fieldMeta.type === 'full';
|
|
788
|
+
var colWidth = hidden ? undefined : fullWidth ? '100%' : 100 / fieldMeta.rowFieldCount + '%';
|
|
789
|
+
var wrapperClass = 'subform-field-slot';
|
|
790
|
+
if (hidden) {
|
|
791
|
+
wrapperClass += ' subform-field-slot-hidden';
|
|
792
|
+
} else if (fullWidth) {
|
|
793
|
+
wrapperClass += ' subform-field-full';
|
|
794
|
+
} else {
|
|
795
|
+
wrapperClass += ' subform-field-col';
|
|
796
|
+
}
|
|
679
797
|
return _react2.default.createElement(
|
|
680
798
|
'div',
|
|
681
|
-
{
|
|
799
|
+
{
|
|
800
|
+
key: field.uniqueName,
|
|
801
|
+
className: wrapperClass,
|
|
802
|
+
style: {
|
|
803
|
+
order: hidden ? undefined : fieldMeta.order,
|
|
804
|
+
width: colWidth,
|
|
805
|
+
boxSizing: 'border-box'
|
|
806
|
+
},
|
|
807
|
+
'aria-hidden': hidden ? 'true' : undefined
|
|
808
|
+
},
|
|
682
809
|
_react2.default.createElement(
|
|
683
810
|
'div',
|
|
684
|
-
{ className: t.getSubFormFieldSlotClass(true,
|
|
685
|
-
t.renderSubFormFieldForm(
|
|
811
|
+
{ className: t.getSubFormFieldSlotClass(true, fullWidth, field.itemType) },
|
|
812
|
+
t.renderSubFormFieldForm(field, rowIndex, subColumnCount)
|
|
686
813
|
)
|
|
687
814
|
);
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
for (var ci = 0; ci < subColumnCount; ci++) {
|
|
691
|
-
var cellField = row.fields[ci];
|
|
692
|
-
if (cellField) {
|
|
693
|
-
cells.push(_react2.default.createElement(
|
|
694
|
-
'div',
|
|
695
|
-
{
|
|
696
|
-
key: cellField.uniqueName || 'col_' + ri + '_' + ci,
|
|
697
|
-
className: 'subform-field-col',
|
|
698
|
-
style: { width: colWidth, boxSizing: 'border-box' }
|
|
699
|
-
},
|
|
700
|
-
_react2.default.createElement(
|
|
701
|
-
'div',
|
|
702
|
-
{ className: t.getSubFormFieldSlotClass(true, false, cellField.itemType) },
|
|
703
|
-
t.renderSubFormFieldForm(cellField, rowIndex, subColumnCount)
|
|
704
|
-
)
|
|
705
|
-
));
|
|
706
|
-
} else {
|
|
707
|
-
cells.push(_react2.default.createElement('div', {
|
|
708
|
-
key: 'empty_' + ri + '_' + ci,
|
|
709
|
-
className: 'subform-field-col subform-field-col-empty',
|
|
710
|
-
style: { width: colWidth, boxSizing: 'border-box' }
|
|
711
|
-
}));
|
|
712
|
-
}
|
|
713
|
-
}
|
|
714
|
-
return _react2.default.createElement(
|
|
715
|
-
'div',
|
|
716
|
-
{ key: 'row_' + ri, className: 'subform-fields-row' },
|
|
717
|
-
cells
|
|
718
|
-
);
|
|
719
|
-
})
|
|
815
|
+
})
|
|
816
|
+
)
|
|
720
817
|
)
|
|
721
818
|
);
|
|
722
819
|
}
|
|
@@ -8158,9 +8158,9 @@ var Page = function (_React$Component) {
|
|
|
8158
8158
|
var props = {
|
|
8159
8159
|
placeholder: "请输入",
|
|
8160
8160
|
locale: 'zh_CN',
|
|
8161
|
-
instantSearch:
|
|
8161
|
+
instantSearch: true, //即时搜索
|
|
8162
8162
|
hasHistory: false,
|
|
8163
|
-
searchDelay:
|
|
8163
|
+
searchDelay: 1000, //输入过程中1秒后未输入才触发搜索
|
|
8164
8164
|
onEnter: function onEnter() {
|
|
8165
8165
|
var $searchbar = $(".select-member-div-class").find(".t-search-bar-input");
|
|
8166
8166
|
$searchbar.attr('maxlength', 20);
|