release/2.18.2.2412.02

This commit is contained in:
lys 2024-12-30 16:55:47 +08:00
parent 8aa696fee5
commit 576a108fa9
2 changed files with 25 additions and 20 deletions

View File

@ -1,27 +1,28 @@
import React, { Component } from "react";
import { WeaCheckbox, WeaFormItem, WeaSearchGroup } from "ecCom";
import { WeaCheckbox, WeaFormItem, WeaLocaleProvider, WeaSearchGroup } from "ecCom";
import { observer } from "mobx-react";
import { WeaSwitch } from "comsMobx";
const getLabel = WeaLocaleProvider.getLabel;
@observer
export default class FormInfo extends Component {
renderForm = () => {
const {
formFields, form, colCount, itemRender, onSelectedChangeHandle,
showLabel, multiColumn, custLabelCol, childrenComponents
formFields, form, colCount, itemRender, onSelectedChangeHandle, showLabel, multiColumn, custLabelCol,
childrenComponents
} = this.props;
let groupArr = [];
const formParams = form.getFormParams();
const labelVisible = showLabel == null || showLabel == true;
const col = colCount ? colCount : 1;
const labelCol = labelVisible ? (custLabelCol || `${window.HrmEngineLabelCol}`) : 0;
const labelCol = labelVisible ? (custLabelCol || 6) : 0;
const itemProps = {
ratio1to2: labelVisible && custLabelCol == null,
// ratio1to2: labelVisible && custLabelCol == null,
style: { marginLeft: 0 },
tipPosition: "bottom",
labelCol: { span: labelCol },
wrapperCol: { span: 24 - labelCol }
wrapperCol: { span: 22 - labelCol }
};
const textAreaProps = { minRows: 4, maxRows: 4 };
@ -30,7 +31,7 @@ export default class FormInfo extends Component {
fields.items.map((field, j) => {
const customerRender = itemRender != null ? itemRender[field.domkey[0]] : null;
const showCheckbox = field.checkbox || false;
let label = field.label;
let label = getLabel(field.lanId, field.label);
if (showCheckbox)
label = <WeaCheckbox content={label} value={field.checkboxValue} onChange={(v) => {
field.checkboxValue = v === "1";
@ -38,13 +39,17 @@ export default class FormInfo extends Component {
}}/>;
let coms;
if (customerRender == null) {
coms = <WeaSwitch fieldConfig={{ ...field, ...textAreaProps, hasBorder: field.viewAttr === 1 }} form={form}
formParams={formParams}/>;
coms = <WeaSwitch fieldConfig={{
...field, helpfulTip: getLabel(field.helpfulTipLanId || "", field.helpfulTip || ""), ...textAreaProps,
hasBorder: false
}} form={form} formParams={formParams}/>;
} else {
coms = customerRender(field, textAreaProps, form, formParams);
coms = customerRender({
...field, helpfulTip: getLabel(field.helpfulTipLanId || "", field.helpfulTip || "")
}, textAreaProps, form, formParams);
}
Object.assign(itemProps, { label, error: form.getError(field) });
let col = 1;
let col = colCount ? colCount : 1;
if (multiColumn != null) {//检查有哪些字段需要一行显示多个
const idx = _.findIndex(multiColumn, item => item.key === field.domkey[0]);
if (idx > -1) {
@ -61,7 +66,6 @@ export default class FormInfo extends Component {
});
}
}
coms != null && formItems.push({
com: (<WeaFormItem {...itemProps}>{coms}</WeaFormItem>),
col
@ -85,12 +89,10 @@ export default class FormInfo extends Component {
};
render() {
const { formFields, className } = this.props;
if (formFields == null) return (<div></div>);
const { formFields, className, form } = this.props;
if (formFields == null || !form.isFormInit) return (<div></div>);
return (
<div className={className}>
{this.renderForm()}
</div>
<div className={className}>{this.renderForm()}</div>
);
}
}

View File

@ -18,8 +18,10 @@ CodeMirror.extendMode("javascript", {
if (this.jsonMode) {
return /^[\[,{]$/.test(content) || /^}/.test(textAfter) || /^]/.test(textAfter);
} else {
if (content == ";" && state.lexical && state.lexical.type == ")") return false;
return /^[;{}]$/.test(content) && !/^;/.test(textAfter);
if (content == ";" && state.lexical && state.lexical.type == "}") return false;
// if (content == ";" && state.lexical && state.lexical.type == ")") return false;
return /[=,]/.test(content) || /.*\)/.test(textAfter);
// return /^[;{}]$/.test(content) && !/^;/.test(textAfter);
}
}
});
@ -94,7 +96,8 @@ CodeMirror.defineExtension("autoFormatRange", function (from, to) {
atSol = false;
}
if (!atSol && inner.mode.newlineAfterToken &&
inner.mode.newlineAfterToken(style, cur, stream.string.slice(stream.pos) || text[i + 1] || "", inner.state))
// inner.mode.newlineAfterToken(style, cur, stream.string.slice(stream.pos) || text[i + 1] || "", inner.state))
inner.mode.newlineAfterToken(style, cur, stream.string.slice(stream.pos, stream.pos + 2) || text[i + 1] || "", inner.state))
newline();
}
if (!stream.pos && outer.blankLine) outer.blankLine(state);