fmui-base 2.3.50 → 2.3.52

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 CHANGED
@@ -3,6 +3,8 @@
3
3
  ---npm publish
4
4
 
5
5
  ## 更新日志
6
+ - 2.3.52:移动端批示意见为空时允许保存并显示落款
7
+ - 2.3.51:移动表单支持矩阵表单设置的字段名称字段内容的字体大小及颜色
6
8
  - 2.3.50:移动表单支持数据表字段宏值和关联值支持获取用户的性别、政治面貌和民族
7
9
  - 2.3.49:加签意见显示加签标识
8
10
  - 2.3.48:表单组件增加字段关联参数,流程待办或者推送打开已办理或者作废的流程会弹出相应状态的弹框
package/lib/form/form.js CHANGED
@@ -1472,27 +1472,7 @@ var PageHome = function (_React$Component) {
1472
1472
  t.resolveMobileOfficeAllowEdit();
1473
1473
 
1474
1474
  //修改样式
1475
- var styleStr = "";
1476
- var objs = itemParam.formStyleObj.contentStyle;
1477
- if (objs != null && objs != '' && objs != undefined && objs.fontFamily != null) {
1478
- styleStr = "font-family: '" + objs.fontFamily + "';" + "color:" + objs.color + ";" + "font-size:" + objs.fontSize + ";" + "font-weight:" + objs.fontWeight + ";" + "font-style:" + objs.fontStyle;
1479
- }
1480
-
1481
- var placeholderStyleStr = "";
1482
- if (objs != null && objs != '' && objs != undefined && objs.fontFamily != null) {
1483
- placeholderStyleStr = "font-family: '" + objs.fontFamily + "';" + "font-size:" + objs.fontSize + ";" + "font-weight:" + objs.fontWeight + ";" + "font-style:" + objs.fontStyle;
1484
- }
1485
- if (itemParam.fieldId != null && itemParam.fieldId != "") {
1486
- if ($("." + itemParam.fieldId).find(".t-text-field-placeholder").length > 0) {
1487
- $("." + itemParam.fieldId).find(".t-text-field-placeholder").attr("style", placeholderStyleStr);
1488
- }
1489
- if ($("." + itemParam.fieldId).find(".t-select-field-placeholder").length > 0) {
1490
- $("." + itemParam.fieldId).find(".t-select-field-placeholder").attr("style", placeholderStyleStr);
1491
- }
1492
- if ($("." + itemParam.fieldId).find(".t-datetime-field-placeholder").length > 0) {
1493
- $("." + itemParam.fieldId).find(".t-datetime-field-placeholder").attr("style", placeholderStyleStr);
1494
- }
1495
- }
1475
+ t.applyFieldFormStyles(itemParam);
1496
1476
  });
1497
1477
 
1498
1478
  t.props.onChange(data, t.state.itemParam);
@@ -1533,27 +1513,7 @@ var PageHome = function (_React$Component) {
1533
1513
  t.resolveMobileOfficeAllowEdit();
1534
1514
 
1535
1515
  //修改样式
1536
- var styleStr = "";
1537
- var objs = itemParam.formStyleObj.contentStyle;
1538
- if (objs != null && objs != '' && objs != undefined && objs.fontFamily != null) {
1539
- styleStr = "font-family: '" + objs.fontFamily + "';" + "color:" + objs.color + ";" + "font-size:" + objs.fontSize + ";" + "font-weight:" + objs.fontWeight + ";" + "font-style:" + objs.fontStyle;
1540
- }
1541
-
1542
- var placeholderStyleStr = "";
1543
- if (objs != null && objs != '' && objs != undefined && objs.fontFamily != null) {
1544
- placeholderStyleStr = "font-family: '" + objs.fontFamily + "';" + "font-size:" + objs.fontSize + ";" + "font-weight:" + objs.fontWeight + ";" + "font-style:" + objs.fontStyle;
1545
- }
1546
- if (itemParam.fieldId != null && itemParam.fieldId != "") {
1547
- if ($("." + itemParam.fieldId).find(".t-text-field-placeholder").length > 0) {
1548
- $("." + itemParam.fieldId).find(".t-text-field-placeholder").attr("style", placeholderStyleStr);
1549
- }
1550
- if ($("." + itemParam.fieldId).find(".t-select-field-placeholder").length > 0) {
1551
- $("." + itemParam.fieldId).find(".t-select-field-placeholder").attr("style", placeholderStyleStr);
1552
- }
1553
- if ($("." + itemParam.fieldId).find(".t-datetime-field-placeholder").length > 0) {
1554
- $("." + itemParam.fieldId).find(".t-datetime-field-placeholder").attr("style", placeholderStyleStr);
1555
- }
1556
- }
1516
+ t.applyFieldFormStyles(itemParam);
1557
1517
  });
1558
1518
  t.props.onChange(data, t.state.itemParam);
1559
1519
  }
@@ -1689,54 +1649,9 @@ var PageHome = function (_React$Component) {
1689
1649
  }
1690
1650
  }
1691
1651
 
1692
- //修改样式
1693
- var styleStr = "";
1694
- var objs = itemParam.formStyleObj.contentStyle;
1695
- if (objs != null && objs != '' && objs != undefined && objs.fontFamily != null) {
1696
- styleStr = "font-family: '" + objs.fontFamily + "';" + "color:" + objs.color + ";" + "font-size:" + objs.fontSize + ";" + "font-weight:" + objs.fontWeight + ";" + "font-style:" + objs.fontStyle;
1697
- }
1698
- if (itemType == "text") {
1699
- $("." + itemParam.fieldId).find(".t-text-field-input").attr("style", styleStr);
1700
- $("." + itemParam.fieldId).find(".t-FB1").find("span").attr("style", styleStr);
1701
- } else if (itemType == "select") {
1702
- $("." + itemParam.fieldId).find(".t-FB1").find("span").attr("style", styleStr);
1703
- } else if (itemType == "checkbox") {
1704
- $("." + itemParam.fieldId).find(".t-checkbox-field-value-list").attr("style", styleStr);
1705
- } else if (itemType == 'textarea') {
1706
- $("." + itemParam.fieldId).find(".t-textarea-field-content").attr("style", styleStr);
1707
- } else if (itemType == 'popuser') {
1708
- if (objs != null && objs != '' && objs != undefined && objs.fontFamily != null) {
1709
- styleStr = "font-family: '" + objs.fontFamily + "';" + "font-size:" + objs.fontSize + ";" + "font-weight:" + objs.fontWeight + ";" + "font-style:" + objs.fontStyle;
1710
- }
1711
- $("." + itemParam.fieldId).find(".t-popuser-placeholder").attr("style", styleStr);
1712
- } else if (itemType == 'poppage') {
1713
- if (objs != null && objs != '' && objs != undefined && objs.fontFamily != null) {
1714
- styleStr = "font-family: '" + objs.fontFamily + "';" + "font-size:" + objs.fontSize + ";" + "font-weight:" + objs.fontWeight + ";" + "font-style:" + objs.fontStyle;
1715
- }
1716
- $("." + itemParam.fieldId).find(".t-poppage-placeholder").attr("style", styleStr);
1717
- } else if (itemType == 'datetime') {
1718
- // alert($("." + itemParam.fieldId).find(".t-datetime-field-value").find("span").text());
1719
- $("." + itemParam.fieldId).find(".t-datetime-field-value").find("span").attr("style", styleStr);
1720
- // $("." + itemParam.fieldId).find(".t-datetime-field-value").find("span").attr("style",styleStr);
1721
- }
1722
-
1723
- var placeholderStyleStr = "";
1724
- if (objs != null && objs != '' && objs != undefined && objs.fontFamily != null) {
1725
- placeholderStyleStr = "font-family: '" + objs.fontFamily + "';" + "font-size:" + objs.fontSize + ";" + "font-weight:" + objs.fontWeight + ";" + "font-style:" + objs.fontStyle;
1726
- }
1727
- if (itemParam.fieldId != null && itemParam.fieldId != "") {
1728
- if ($("." + itemParam.fieldId).find(".t-text-field-placeholder").length > 0) {
1729
- $("." + itemParam.fieldId).find(".t-text-field-placeholder").attr("style", placeholderStyleStr);
1730
- }
1731
- if ($("." + itemParam.fieldId).find(".t-select-field-placeholder").length > 0) {
1732
- $("." + itemParam.fieldId).find(".t-select-field-placeholder").attr("style", placeholderStyleStr);
1733
- }
1734
- if ($("." + itemParam.fieldId).find(".t-datetime-field-placeholder").length > 0) {
1735
- $("." + itemParam.fieldId).find(".t-datetime-field-placeholder").attr("style", placeholderStyleStr);
1736
- }
1737
- }
1652
+ //修改样式(字段内容 + 字段名称;主表/子表统一处理)
1653
+ t.applyFieldFormStyles(itemParam);
1738
1654
  if (t.props.dataType === 'sub') {
1739
- t.applySubFormLabelStyle(itemParam);
1740
1655
  // 子表多列:loadComponet 完成后同步排版(预判与 ref 不一致时需重排)
1741
1656
  if (t.props.onSubFieldLayoutChange) {
1742
1657
  t.props.onSubFieldLayoutChange();
@@ -2111,47 +2026,126 @@ var PageHome = function (_React$Component) {
2111
2026
  }, {
2112
2027
  key: 'componentDidUpdate',
2113
2028
  value: function componentDidUpdate() {
2114
- if (this.props.dataType === 'sub' && this.state.loaded && this.state.itemParam && this.state.itemParam.fieldId) {
2115
- this.applySubFormLabelStyle(this.state.itemParam);
2029
+ if (this.state.loaded && this.state.itemParam && this.state.itemParam.fieldId) {
2030
+ this.applyFieldFormStyles(this.state.itemParam);
2116
2031
  }
2117
2032
  }
2118
2033
 
2119
- // 子表标签:单列保留主表边距,仅同步字号颜色;多列去掉 label 左边距
2034
+ // 是否配置了可用的字体样式属性(字体/字号/颜色等任一即可)
2120
2035
 
2121
2036
  }, {
2122
- key: 'applySubFormLabelStyle',
2123
- value: function applySubFormLabelStyle(itemParam) {
2124
- if (!itemParam || !itemParam.fieldId || typeof $ === 'undefined') {
2125
- return;
2037
+ key: 'hasFormStyleProps',
2038
+ value: function hasFormStyleProps(styleObj) {
2039
+ if (!styleObj) {
2040
+ return false;
2126
2041
  }
2127
- var subColumnCount = parseInt(this.props.subColumnCount, 10);
2128
- var isSubFormMultiCol = this.props.dataType === 'sub' && !isNaN(subColumnCount) && subColumnCount > 1;
2129
- var ts = itemParam.formStyleObj && itemParam.formStyleObj.titleStyle ? itemParam.formStyleObj.titleStyle : {};
2130
- var styleStr = 'font-size:14px;line-height:24px;color:rgb(51, 51, 51);font-weight:bold;';
2131
- if (ts.fontSize) {
2132
- styleStr += 'font-size:' + ts.fontSize + ';';
2042
+ return !!(styleObj.fontFamily || styleObj.fontSize || styleObj.color || styleObj.fontWeight || styleObj.fontStyle);
2043
+ }
2044
+
2045
+ // 组装 CSS 声明;important=true 用于压过 SaltUI 固定字号
2046
+
2047
+ }, {
2048
+ key: 'buildFormCssDecls',
2049
+ value: function buildFormCssDecls(styleObj, options) {
2050
+ if (!this.hasFormStyleProps(styleObj)) {
2051
+ return '';
2133
2052
  }
2134
- if (ts.color) {
2135
- styleStr = styleStr.replace(/color:[^;]+;?/, '') + 'color:' + ts.color + ';';
2053
+ options = options || {};
2054
+ var important = options.important ? ' !important' : '';
2055
+ var parts = [];
2056
+ if (styleObj.fontFamily) {
2057
+ parts.push("font-family:'" + styleObj.fontFamily + "'" + important);
2136
2058
  }
2137
- if (ts.fontFamily) {
2138
- styleStr += 'font-family:' + ts.fontFamily + ';';
2059
+ if (!options.skipColor && styleObj.color) {
2060
+ parts.push('color:' + styleObj.color + important);
2139
2061
  }
2140
- if (ts.fontWeight) {
2141
- styleStr += 'font-weight:' + ts.fontWeight + ';';
2062
+ if (styleObj.fontSize) {
2063
+ parts.push('font-size:' + styleObj.fontSize + important);
2064
+ if (options.withLineHeight) {
2065
+ var n = parseInt(styleObj.fontSize, 10);
2066
+ if (!isNaN(n) && n > 0) {
2067
+ parts.push('line-height:' + Math.round(n * 1.35) + 'px' + important);
2068
+ }
2069
+ }
2142
2070
  }
2143
- if (ts.fontStyle) {
2144
- styleStr += 'font-style:' + ts.fontStyle + ';';
2071
+ if (styleObj.fontWeight) {
2072
+ parts.push('font-weight:' + styleObj.fontWeight + important);
2145
2073
  }
2146
- if (isSubFormMultiCol) {
2147
- styleStr += 'margin-left:0;padding-left:0;padding-right:0;';
2074
+ if (styleObj.fontStyle) {
2075
+ parts.push('font-style:' + styleObj.fontStyle + important);
2148
2076
  }
2149
- var $root = $('.' + itemParam.fieldId);
2150
- $root.find('.t-field-layout-v-label-left').attr('style', styleStr);
2151
- $root.find('.t-field-layout-h-label').attr('style', styleStr);
2152
- if (isSubFormMultiCol) {
2153
- $root.find('.t-field-layout-v-label').attr('style', styleStr);
2077
+ return parts.join(';');
2078
+ }
2079
+
2080
+ // 字段名称+字段内容统一用 style 标签落地,避免各控件默认字号不一致、jQuery 被 React 冲掉
2081
+
2082
+ }, {
2083
+ key: 'applyFieldFormStyles',
2084
+ value: function applyFieldFormStyles(itemParam) {
2085
+ if (!itemParam || !itemParam.fieldId || typeof document === 'undefined') {
2086
+ return;
2087
+ }
2088
+ // fieldId 多为 UUID,常以数字开头;`.` + UUID 非法选择器会静默失效
2089
+ // 统一用属性选择器,避免 CSS.escape 兼容/转义差异
2090
+ var fid = String(itemParam.fieldId);
2091
+ var scope = '[class~="' + fid.replace(/\\/g, '\\\\').replace(/"/g, '\\"') + '"]';
2092
+ var styleId = 'fmui-field-style-' + fid.replace(/[^a-zA-Z0-9_-]/g, '_');
2093
+ var formStyleObj = itemParam.formStyleObj || {};
2094
+ var ts = formStyleObj.titleStyle || {};
2095
+ var cs = formStyleObj.contentStyle || {};
2096
+ var cssParts = [];
2097
+ var subColumnCount = parseInt(this.props.subColumnCount, 10);
2098
+ var isSubFormMultiCol = this.props.dataType === 'sub' && !isNaN(subColumnCount) && subColumnCount > 1;
2099
+
2100
+ if (this.hasFormStyleProps(ts)) {
2101
+ var labelCss = this.buildFormCssDecls(ts, { important: true, withLineHeight: true });
2102
+ var fontSizeNum = parseInt(ts.fontSize, 10);
2103
+ // 字号大于默认时放宽标签宽度,减少「主表单/行」被挤成两行
2104
+ if (!isNaN(fontSizeNum) && fontSizeNum > 16 && !isSubFormMultiCol) {
2105
+ labelCss += ';width:auto;min-width:118px;max-width:46%;box-sizing:border-box';
2106
+ }
2107
+ if (isSubFormMultiCol) {
2108
+ labelCss += ';margin-left:0;padding-left:0;padding-right:0;width:100%;max-width:100%';
2109
+ }
2110
+ cssParts.push([scope + ' .t-field-layout-h-label', scope + ' .t-field-layout-h-label span', scope + ' .t-field-layout-v-label', scope + ' .t-field-layout-v-label-left'].join(',') + '{' + labelCss + '}');
2111
+ }
2112
+
2113
+ if (this.hasFormStyleProps(cs)) {
2114
+ var contentCss = this.buildFormCssDecls(cs, { important: true, withLineHeight: true });
2115
+ cssParts.push([scope + ' .t-text-field-input', scope + ' .t-text-field-content-main', scope + ' .t-text-field-content-main span', scope + ' .t-field-content-box > .t-FB1', scope + ' .t-field-content-box > .t-FB1 span', scope + ' .t-field-multi', scope + ' .t-field-multi span', scope + ' .t-select-field-value', scope + ' .t-select-field-value span', scope + ' .t-radio-field-value', scope + ' .t-radio-field-value span', scope + ' .t-radio-field-value .t-FB1', scope + ' .t-radio-field-value .t-omit', scope + ' .t-datetime-field-value', scope + ' .t-datetime-field-value span', scope + ' .t-textarea-field-content', scope + ' .t-textarea-field-content textarea', scope + ' .t-checkbox-field-content', scope + ' .t-checkbox-field-label', scope + ' .t-checkbox-field-value-list', scope + ' .t-checkbox-field-value-list span', scope + ' .dd-select-input-option-text', scope + ' .t-popuser-value', scope + ' .t-popuser-value span', scope + ' .t-popuser-placeholder', scope + ' .t-poppage-value', scope + ' .t-poppage-value span', scope + ' .t-poppage-placeholder',
2116
+ // 月日自定义、意见、html 等非 SaltUI 标准内容节点
2117
+ scope + ' .t-FL', scope + ' .flex-comment .t-PT10', scope + ' .flex-comment .t-textarea-field-content', scope + ' .ueditor-content', scope + ' .t-FB1.t-FAL', scope + ' .t-FB1.t-omit', scope + ' .t-omit', scope + ' .t-LH1_4', scope + ' .t-FS16', scope + ' .t-field-box.t-FS16', scope + ' .t-field-box.t-FS16 .t-FB1', scope + ' .section-content .t-FB1'].join(',') + '{' + contentCss + '}');
2118
+
2119
+ var placeholderCss = this.buildFormCssDecls(cs, { important: true, skipColor: true, withLineHeight: true });
2120
+ cssParts.push([scope + ' .t-text-field-placeholder', scope + ' .t-select-field-placeholder', scope + ' .t-datetime-field-placeholder', scope + ' .t-checkbox-field-placeholder'].join(',') + '{' + placeholderCss + '}');
2121
+ }
2122
+
2123
+ var styleEl = document.getElementById(styleId);
2124
+ if (!styleEl) {
2125
+ styleEl = document.createElement('style');
2126
+ styleEl.id = styleId;
2127
+ styleEl.setAttribute('data-fmui-field-style', fid);
2128
+ document.head.appendChild(styleEl);
2154
2129
  }
2130
+ styleEl.innerHTML = cssParts.join('');
2131
+ }
2132
+
2133
+ // 兼容旧调用:统一走 CSS 注入
2134
+
2135
+ }, {
2136
+ key: 'applyFieldContentStyle',
2137
+ value: function applyFieldContentStyle(itemParam) {
2138
+ this.applyFieldFormStyles(itemParam);
2139
+ }
2140
+ }, {
2141
+ key: 'applyFieldLabelStyle',
2142
+ value: function applyFieldLabelStyle(itemParam) {
2143
+ this.applyFieldFormStyles(itemParam);
2144
+ }
2145
+ }, {
2146
+ key: 'applySubFormLabelStyle',
2147
+ value: function applySubFormLabelStyle(itemParam) {
2148
+ this.applyFieldFormStyles(itemParam);
2155
2149
  }
2156
2150
 
2157
2151
  //重新加载组件;options.silent=true 时不向上触发 onChange(用于字段关联批量刷新,避免死循环)
@@ -4636,7 +4630,11 @@ var PageHome = function (_React$Component) {
4636
4630
  _react2.default.createElement(
4637
4631
  'div',
4638
4632
  { className: t.state.itemParam.required ? "t-field-layout-h-label required" : "t-field-layout-h-label" },
4639
- t.state.itemParam.title
4633
+ _react2.default.createElement(
4634
+ 'span',
4635
+ { style: t.state.itemParam.formStyleObj.titleStyle == null ? {} : t.state.itemParam.formStyleObj.titleStyle },
4636
+ t.state.itemParam.title
4637
+ )
4640
4638
  ),
4641
4639
  _react2.default.createElement(
4642
4640
  HBox,
@@ -4706,7 +4704,11 @@ var PageHome = function (_React$Component) {
4706
4704
  _react2.default.createElement(
4707
4705
  'div',
4708
4706
  { className: t.state.itemParam.required ? "t-field-layout-h-label required" : "t-field-layout-h-label" },
4709
- t.state.itemParam.title
4707
+ _react2.default.createElement(
4708
+ 'span',
4709
+ { style: t.state.itemParam.formStyleObj.titleStyle == null ? {} : t.state.itemParam.formStyleObj.titleStyle },
4710
+ t.state.itemParam.title
4711
+ )
4710
4712
  ),
4711
4713
  _react2.default.createElement(
4712
4714
  HBox,
@@ -4915,7 +4917,7 @@ var PageHome = function (_React$Component) {
4915
4917
  { className: 't-field-layout-h-label t-FBJ' },
4916
4918
  _react2.default.createElement(
4917
4919
  'span',
4918
- null,
4920
+ { style: t.state.itemParam.formStyleObj.titleStyle == null ? {} : t.state.itemParam.formStyleObj.titleStyle },
4919
4921
  t.state.itemParam.title
4920
4922
  )
4921
4923
  ),
@@ -573,7 +573,7 @@ var PageHome = function (_React$Component) {
573
573
  css.fontWeight = ts.fontWeight;
574
574
  }
575
575
  if (ts.fontFamily) {
576
- css.fontFamily = ts.fontFamily;
576
+ css.fontFamily = "'" + ts.fontFamily + "'";
577
577
  }
578
578
  if (ts.fontStyle) {
579
579
  css.fontStyle = ts.fontStyle;
@@ -595,7 +595,7 @@ var PageHome = function (_React$Component) {
595
595
  }
596
596
  var scope = '.subform-fields-wrap.subform-fields-multi';
597
597
  var labelCss = this.getSubFormLabelCssText(true);
598
- 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('') } });
598
+ 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{margin-left:0!important;padding-left:0!important;padding-right:0!important;}'].join('') } });
599
599
  }
600
600
 
601
601
  // 子表多列布局样式(按行分组,避免 flex-wrap 导致错位)
@@ -613,7 +613,7 @@ var PageHome = function (_React$Component) {
613
613
  var text = scope + ' .subform-col-field-slot-text';
614
614
  var pick = scope + ' .subform-col-field-slot-pick';
615
615
  var pickCol = pick + ' ' + col;
616
- 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('') } });
616
+ 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;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('') } });
617
617
  }
618
618
 
619
619
  // 子表字段是否隐藏(设计隐藏 / 流程权限 / 关联规则 / 扩展方法)
package/lib/form/table.js CHANGED
@@ -458,11 +458,103 @@ var PageHome = function (_React$Component) {
458
458
  key: 'componentDidMount',
459
459
  value: function componentDidMount() {
460
460
  var t = this;
461
+ t.applyFormLevelStyles(t.props.formStyleObj);
461
462
  // 等子字段 loadComponet 完成后再统一刷新关联/联动,避免打开编辑页时清空已保存值
462
463
  setTimeout(function () {
463
464
  t.initFormLinkageAndRelaFields();
464
465
  }, 500);
465
466
  }
467
+ }, {
468
+ key: 'componentDidUpdate',
469
+ value: function componentDidUpdate(prevProps) {
470
+ if (prevProps.formStyleObj !== this.props.formStyleObj) {
471
+ this.applyFormLevelStyles(this.props.formStyleObj);
472
+ }
473
+ }
474
+ }, {
475
+ key: 'hasFormStyleProps',
476
+ value: function hasFormStyleProps(styleObj) {
477
+ if (!styleObj) {
478
+ return false;
479
+ }
480
+ return !!(styleObj.fontFamily || styleObj.fontSize || styleObj.color || styleObj.fontWeight || styleObj.fontStyle);
481
+ }
482
+ }, {
483
+ key: 'buildFormCssDecls',
484
+ value: function buildFormCssDecls(styleObj, options) {
485
+ if (!this.hasFormStyleProps(styleObj)) {
486
+ return '';
487
+ }
488
+ options = options || {};
489
+ var important = options.important ? ' !important' : '';
490
+ var parts = [];
491
+ if (styleObj.fontFamily) {
492
+ parts.push("font-family:'" + styleObj.fontFamily + "'" + important);
493
+ }
494
+ if (!options.skipColor && styleObj.color) {
495
+ parts.push('color:' + styleObj.color + important);
496
+ }
497
+ if (styleObj.fontSize) {
498
+ parts.push('font-size:' + styleObj.fontSize + important);
499
+ if (options.withLineHeight) {
500
+ var n = parseInt(styleObj.fontSize, 10);
501
+ if (!isNaN(n) && n > 0) {
502
+ parts.push('line-height:' + Math.round(n * 1.35) + 'px' + important);
503
+ }
504
+ }
505
+ }
506
+ if (styleObj.fontWeight) {
507
+ parts.push('font-weight:' + styleObj.fontWeight + important);
508
+ }
509
+ if (styleObj.fontStyle) {
510
+ parts.push('font-style:' + styleObj.fontStyle + important);
511
+ }
512
+ return parts.join(';');
513
+ }
514
+
515
+ // 表单级统一样式:覆盖主表/子表/编辑/只读,避免依赖 fieldId class(UUID 数字开头选择器会失效)
516
+
517
+ }, {
518
+ key: 'applyFormLevelStyles',
519
+ value: function applyFormLevelStyles(formStyleObj) {
520
+ if (typeof document === 'undefined') {
521
+ return;
522
+ }
523
+ var styleId = 'fmui-form-level-style';
524
+ var styleEl = document.getElementById(styleId);
525
+ if (!formStyleObj) {
526
+ if (styleEl) {
527
+ styleEl.innerHTML = '';
528
+ }
529
+ return;
530
+ }
531
+ var ts = formStyleObj.titleStyle || {};
532
+ var cs = formStyleObj.contentStyle || {};
533
+ var scope = '.fmui-form-style-root';
534
+ var cssParts = [];
535
+ if (this.hasFormStyleProps(ts)) {
536
+ var labelCss = this.buildFormCssDecls(ts, { important: true, withLineHeight: true });
537
+ var fontSizeNum = parseInt(ts.fontSize, 10);
538
+ if (!isNaN(fontSizeNum) && fontSizeNum > 16) {
539
+ labelCss += ';width:auto;min-width:118px;max-width:46%;box-sizing:border-box';
540
+ }
541
+ cssParts.push([scope + ' .t-field-layout-h-label', scope + ' .t-field-layout-h-label span', scope + ' .t-field-layout-v-label', scope + ' .t-field-layout-v-label-left'].join(',') + '{' + labelCss + '}');
542
+ }
543
+ if (this.hasFormStyleProps(cs)) {
544
+ var contentCss = this.buildFormCssDecls(cs, { important: true, withLineHeight: true });
545
+ cssParts.push([scope + ' .t-text-field-input', scope + ' .t-text-field-content-main', scope + ' .t-text-field-content-main span', scope + ' .t-field-content-box > .t-FB1', scope + ' .t-field-content-box > .t-FB1 span', scope + ' .t-field-multi', scope + ' .t-field-multi span', scope + ' .t-select-field-value', scope + ' .t-select-field-value span', scope + ' .t-radio-field-value', scope + ' .t-radio-field-value span', scope + ' .t-radio-field-value .t-FB1', scope + ' .t-radio-field-value .t-omit', scope + ' .t-datetime-field-value', scope + ' .t-datetime-field-value span', scope + ' .t-textarea-field-content', scope + ' .t-textarea-field-content textarea', scope + ' .t-checkbox-field-content', scope + ' .t-checkbox-field-label', scope + ' .t-checkbox-field-value-list', scope + ' .t-checkbox-field-value-list span', scope + ' .dd-select-input-option-text', scope + ' .t-popuser-value', scope + ' .t-popuser-value span', scope + ' .t-popuser-placeholder', scope + ' .t-poppage-value', scope + ' .t-poppage-value span', scope + ' .t-poppage-placeholder', scope + ' .t-FL', scope + ' .flex-comment .t-textarea-field-content', scope + ' .ueditor-content',
546
+ // 弹出选择/只读展示:常带 t-FS16 等工具类,需一并覆盖
547
+ scope + ' .t-FB1.t-FAL', scope + ' .t-FB1.t-omit', scope + ' .t-omit', scope + ' .t-LH1_4', scope + ' .t-FS16', scope + ' .t-field-box.t-FS16', scope + ' .t-field-box.t-FS16 .t-FB1', scope + ' .section-content .t-FB1'].join(',') + '{' + contentCss + '}');
548
+ var placeholderCss = this.buildFormCssDecls(cs, { important: true, skipColor: true, withLineHeight: true });
549
+ cssParts.push([scope + ' .t-text-field-placeholder', scope + ' .t-select-field-placeholder', scope + ' .t-datetime-field-placeholder', scope + ' .t-checkbox-field-placeholder'].join(',') + '{' + placeholderCss + '}');
550
+ }
551
+ if (!styleEl) {
552
+ styleEl = document.createElement('style');
553
+ styleEl.id = styleId;
554
+ document.head.appendChild(styleEl);
555
+ }
556
+ styleEl.innerHTML = cssParts.join('');
557
+ }
466
558
 
467
559
  // 编辑/查看打开后:刷新字段关联规则,并按触发条件回填联动字段(保留已保存值)
468
560
 
@@ -2598,7 +2690,7 @@ var PageHome = function (_React$Component) {
2598
2690
  }
2599
2691
  return _react2.default.createElement(
2600
2692
  'div',
2601
- null,
2693
+ { className: 'fmui-form-style-root' },
2602
2694
  _react2.default.createElement(
2603
2695
  'div',
2604
2696
  null,
@@ -1322,6 +1322,10 @@ var PageHome = function (_React$Component) {
1322
1322
  });
1323
1323
  return false;
1324
1324
  }
1325
+ // 允许为空时传 ""(勿用 undefined,否则 JSON 会丢 comment 字段导致不落库)
1326
+ if (typeof newComment == "undefined" || newComment == null || (newComment + '').trim() == '') {
1327
+ newComment = "";
1328
+ }
1325
1329
  }
1326
1330
  }
1327
1331
  if (operate == 1) {
@@ -2465,6 +2469,10 @@ var PageHome = function (_React$Component) {
2465
2469
  });
2466
2470
  return false;
2467
2471
  }
2472
+ // 允许为空时传 ""(勿用 undefined,否则 JSON 会丢 comment 字段导致不落库)
2473
+ if (typeof newComment == "undefined" || newComment == null || (newComment + '').trim() == '') {
2474
+ newComment = "";
2475
+ }
2468
2476
  }
2469
2477
  //判断是否保存常用语
2470
2478
  var savePhrase = this.state.savePhrase;
@@ -981,16 +981,20 @@ var PageHome = function (_React$Component) {
981
981
 
982
982
  if (comment != '' && comment != null) {
983
983
  if (comment.trim() == '' && hasCommentField == '1') {
984
- _Toast2.default.show({
985
- type: 'error',
986
- content: '意见不能为空!'
987
- });
988
- return false;
984
+ if (commentIsNotNull == '1') {
985
+ _Toast2.default.show({
986
+ type: 'error',
987
+ content: '意见不能为空!'
988
+ });
989
+ return false;
990
+ }
991
+ // 允许为空时传 ""
992
+ comment = "";
989
993
  }
990
- if (comment.length > 200) {
994
+ if (comment.length > 2000) {
991
995
  _Toast2.default.show({
992
996
  type: 'error',
993
- content: '意见不能多于200字!'
997
+ content: '意见不能多于2000字!'
994
998
  });
995
999
  return false;
996
1000
  }
@@ -1002,6 +1006,10 @@ var PageHome = function (_React$Component) {
1002
1006
  });
1003
1007
  return false;
1004
1008
  }
1009
+ // 允许为空时传 ""(勿用 undefined,否则 JSON 会丢 comment 字段导致不落库)
1010
+ if (hasCommentField == '1' && (typeof comment == "undefined" || comment == null || (comment + '').trim() == '')) {
1011
+ comment = "";
1012
+ }
1005
1013
  }
1006
1014
 
1007
1015
  //判断是否保存常用语
@@ -2353,6 +2353,10 @@ var PageHome = function (_React$Component) {
2353
2353
  });
2354
2354
  return false;
2355
2355
  }
2356
+ // 允许为空时传 ""(勿用 undefined,否则 JSON 会丢 comment 字段导致不落库)
2357
+ if (typeof newComment == "undefined" || newComment == null || (newComment + '').trim() == '') {
2358
+ newComment = "";
2359
+ }
2356
2360
  }
2357
2361
  }
2358
2362
  if (operate == 1) {
@@ -4059,6 +4063,10 @@ var PageHome = function (_React$Component) {
4059
4063
  });
4060
4064
  return false;
4061
4065
  }
4066
+ // 允许为空时传 ""(勿用 undefined,否则 JSON 会丢 comment 字段导致不落库)
4067
+ if (typeof newComment == "undefined" || newComment == null || (newComment + '').trim() == '') {
4068
+ newComment = "";
4069
+ }
4062
4070
  }
4063
4071
  //判断是否保存常用语
4064
4072
  var savePhrase = this.state.savePhrase;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fmui-base",
3
- "version": "2.3.50",
3
+ "version": "2.3.52",
4
4
  "title": "fmui-base",
5
5
  "description": "fmui移动端组件",
6
6
  "main": "lib/index.js",