Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions src/rootPages/Designer/properties/dataFields/ABFieldLongText.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default function (AB) {
super(`${ibase}_longtext`, {
default: "",
defaultCheckbox: "",
maxLength: "", // <-- 新增 ID
});
}

Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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) {
Expand All @@ -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;
Expand Down
Loading