EgwAction changes to suit Sl-Tree

This commit is contained in:
Milan 2024-02-08 21:16:07 +01:00
parent da195d2029
commit 96760511ea
3 changed files with 5 additions and 7 deletions

View File

@ -48,7 +48,7 @@ import {egwActionObjectInterface} from "./egw_action";
* defaults to 0
*/
export class EgwActionObject {
readonly id: string
id: string
readonly parent: EgwActionObject
public readonly children: EgwActionObject[] = []
private actionLinks: EgwActionLink[] = []
@ -111,13 +111,10 @@ export class EgwActionObject {
// * @return {egwActionObject} description
// * @todo Add search function to egw_action_commons.js
// */
getObjectById(_id, _search_depth) {
getObjectById(_id, _search_depth=Number.MAX_VALUE):EgwActionObject {
if (this.id == _id) {
return this;
}
if (typeof _search_depth == "undefined") {
_search_depth = Number.MAX_VALUE;
}
for (let i = 0; i < this.children.length && _search_depth > 0; i++) {
const obj = this.children[i].getObjectById(_id, _search_depth - 1);
@ -163,7 +160,7 @@ export class EgwActionObject {
* @returns object the generated object
*/
insertObject(_index: number | boolean, _id: string | EgwActionObject, _iface: EgwActionObjectInterface, _flags: number) {
insertObject(_index: number | boolean, _id: string | EgwActionObject, _iface?: EgwActionObjectInterface, _flags?: number) {
if (_index === false) _index = this.children.length;
let obj = null;

View File

@ -21,6 +21,7 @@
*/
export interface EgwActionObjectInterface {
//properties
id?:string
_state: number;
stateChangeCallback: Function;
stateChangeContext: any;

View File

@ -105,7 +105,7 @@ export function egw_getObjectManager(_id, _create = true, _search_depth = Number
* @param {string} _appName //appName might not always be the current app, e.g. running app content under admin tab
* @return {EgwActionObjectManager}
*/
export function egw_getAppObjectManager(_create, _appName = "") {
export function egw_getAppObjectManager(_create = true, _appName = "") {
return egw_getObjectManager(_appName ? _appName : window.egw(window).app_name(), _create, 1);
}