diff --git a/src/rootPages/Designer/properties/dataFields/ABFieldLongText.js b/src/rootPages/Designer/properties/dataFields/ABFieldLongText.js index bfa0f4f..268cbb7 100644 --- a/src/rootPages/Designer/properties/dataFields/ABFieldLongText.js +++ b/src/rootPages/Designer/properties/dataFields/ABFieldLongText.js @@ -16,6 +16,7 @@ export default function (AB) { super(`${ibase}_longtext`, { default: "", defaultCheckbox: "", + maxLength: "", // <-- 新增 ID }); } @@ -61,6 +62,32 @@ export default function (AB) { }, ], }, + { + view: "layout", + cols: [ + { + view: "label", + label: L("Max Length:"), + align: "right", + width: 100, + }, + { + id: ids.maxLength, + view: "counter", + name: "maxLength", + min: 1, + max: 10000, + step: 1, + labelWidth: uiConfig.labelWidthXLarge, + placeholder: L("Optional limit"), + on: { + onAfterRender: function () { + ABField.CYPRESS_REF(this); + }, + }, + }, + ], + }, { view: "checkbox", name: "supportMultilingual", @@ -89,13 +116,25 @@ export default function (AB) { populate(field) { super.populate(field); + const value = field.settings.default === "" ? 0 : 1; $$(this.ids.defaultCheckbox).setValue(value); + $$(this.ids.default).setValue(field.settings.default || ""); + + // 新增:设置 maxLength 值 + if (field.settings.maxLength) { + $$(this.ids.maxLength).setValue(field.settings.maxLength); + } } show() { super.show(); $$(this.ids.defaultCheckbox).setValue(0); + $$(this.ids.default).setValue(""); + $$(this.ids.default).disable(); + + // 新增:清空 maxLength + $$(this.ids.maxLength).setValue(""); } checkboxDefaultValue(state) { @@ -106,6 +145,19 @@ export default function (AB) { $$(this.ids.default).enable(); } } + + values() { + const values = super.values(); + + values.default = $$(this.ids.defaultCheckbox).getValue() + ? $$(this.ids.default).getValue() + : ""; + + // 加入 maxLength 保存 + values.maxLength = parseInt($$(this.ids.maxLength).getValue()) || null; + + return values; + } } return ABFieldLongText;