Add break_title option for link widget in order to be able to break link's title into new line based on a given delimiter

This commit is contained in:
Hadi Nategh 2021-02-03 14:14:22 +01:00
parent 0f69a5669f
commit 62951986ae
2 changed files with 16 additions and 0 deletions

View File

@ -24,6 +24,7 @@ var __extends = (this && this.__extends) || (function () {
})(); })();
var _a; var _a;
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.et2_link_add = exports.et2_link_list = exports.et2_link_string = exports.et2_link = exports.et2_link_entry = exports.et2_link_apps = exports.et2_link_to = void 0;
/*egw:uses /*egw:uses
/vendor/bower-asset/jquery/dist/jquery.js; /vendor/bower-asset/jquery/dist/jquery.js;
/vendor/bower-asset/jquery-ui/jquery-ui.js; /vendor/bower-asset/jquery-ui/jquery-ui.js;
@ -1143,6 +1144,8 @@ var et2_link = /** @class */ (function (_super) {
_value.title = ""; _value.title = "";
} }
} }
if (this.options.break_title && _value.title)
_value.title = _value.title.replace(this.options.break_title, "\r\n");
this.set_title(this.link, _value.title); this.set_title(this.link, _value.title);
}; };
/** /**
@ -1226,6 +1229,12 @@ var et2_link = /** @class */ (function (_super) {
"type": "string", "type": "string",
"default": null, "default": null,
"description": "Optional parameter to be passed to egw().open in order to open links in specified target eg. _blank" "description": "Optional parameter to be passed to egw().open in order to open links in specified target eg. _blank"
},
"break_title": {
"name": "break title",
"type": "string",
"default": null,
"description": "Breaks title into multiple lines based on selected delimiter by replacing it with '\r\n'"
} }
}; };
et2_link.legacyOptions = ["only_app"]; et2_link.legacyOptions = ["only_app"];

View File

@ -1322,6 +1322,12 @@ export class et2_link extends et2_valueWidget implements et2_IDetachedDOM
"type": "string", "type": "string",
"default": null, "default": null,
"description": "Optional parameter to be passed to egw().open in order to open links in specified target eg. _blank" "description": "Optional parameter to be passed to egw().open in order to open links in specified target eg. _blank"
},
"break_title": {
"name": "break title",
"type": "string",
"default": null,
"description": "Breaks title into multiple lines based on selected delimiter by replacing it with '\r\n'"
} }
}; };
public static readonly legacyOptions = ["only_app"]; public static readonly legacyOptions = ["only_app"];
@ -1440,6 +1446,7 @@ export class et2_link extends et2_valueWidget implements et2_IDetachedDOM
_value.title = ""; _value.title = "";
} }
} }
if (this.options.break_title && _value.title) _value.title = _value.title.replace(this.options.break_title, "\r\n");
this.set_title(this.link, _value.title); this.set_title(this.link, _value.title);
} }