From 42305a65628b75cb90cc5698964e54942314eaf2 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Wed, 9 Jun 2021 14:28:29 +0200 Subject: [PATCH] Fix some imports for et2 widgets --- api/js/egw_action/egw_action.js | 4 ++++ api/js/egw_action/egw_action_dragdrop.js | 4 ---- api/js/etemplate/et2_core_DOMWidget.js | 4 ++-- api/js/etemplate/et2_core_DOMWidget.ts | 10 ++++++++-- api/js/etemplate/et2_widget_grid.js | 4 ++-- api/js/etemplate/et2_widget_grid.ts | 4 ++-- api/js/etemplate/et2_widget_toolbar.js | 3 ++- api/js/etemplate/et2_widget_toolbar.ts | 3 ++- 8 files changed, 22 insertions(+), 14 deletions(-) diff --git a/api/js/egw_action/egw_action.js b/api/js/egw_action/egw_action.js index 49ef5791a8..03d9de837e 100644 --- a/api/js/egw_action/egw_action.js +++ b/api/js/egw_action/egw_action.js @@ -2537,3 +2537,7 @@ export function egwActionObjectManager(_id, _manager) return ao; } + +export const EGW_AI_DRAG = 0x0100; // Use the first byte as mask for event types - 01 is for events used with drag stuff +export const EGW_AI_DRAG_OUT = EGW_AI_DRAG | 0x01; +export const EGW_AI_DRAG_OVER = EGW_AI_DRAG | 0x02; diff --git a/api/js/egw_action/egw_action_dragdrop.js b/api/js/egw_action/egw_action_dragdrop.js index 364748b4e5..fbc41c07a1 100644 --- a/api/js/egw_action/egw_action_dragdrop.js +++ b/api/js/egw_action/egw_action_dragdrop.js @@ -535,10 +535,6 @@ export function getDropImplementation() return _dropActionImpl; } -var EGW_AI_DRAG = 0x0100; // Use the first byte as mask for event types - 01 is for events used with drag stuff -var EGW_AI_DRAG_OUT = EGW_AI_DRAG | 0x01; -var EGW_AI_DRAG_OVER = EGW_AI_DRAG | 0x02; - export function egwDropActionImplementation() { var ai = new egwActionImplementation(); diff --git a/api/js/etemplate/et2_core_DOMWidget.js b/api/js/etemplate/et2_core_DOMWidget.js index e65d65aabe..90a51378f6 100644 --- a/api/js/etemplate/et2_core_DOMWidget.js +++ b/api/js/etemplate/et2_core_DOMWidget.js @@ -16,7 +16,7 @@ import { ClassWithAttributes } from './et2_core_inheritance'; import { et2_IDOMNode } from "./et2_core_interfaces"; import { et2_hasChild, et2_no_init } from "./et2_core_common"; import { et2_widget } from "./et2_core_widget"; -import '../egw_action/egw_action.js'; +import { egw_getActionManager, egwActionObject, egwActionObjectInterface, egw_getAppObjectManager, EGW_AI_DRAG_OVER, EGW_AI_DRAG_OUT } from '../egw_action/egw_action.js'; import { egw } from "../jsapi/egw_global"; /** * Abstract widget class which can be inserted into the DOM. All widget classes @@ -400,7 +400,7 @@ export class et2_DOMWidget extends et2_widget { } // Initialize the action manager and add some actions to it // Only look 1 level deep - var gam = window.egw_getActionManager(this.egw().appName, true, 1); + var gam = egw_getActionManager(this.egw().appName, true, 1); if (typeof this._actionManager != "object") { if (gam.getActionById(this.getInstanceManager().uniqueId, 1) !== null) { gam = gam.getActionById(this.getInstanceManager().uniqueId, 1); diff --git a/api/js/etemplate/et2_core_DOMWidget.ts b/api/js/etemplate/et2_core_DOMWidget.ts index dea52533bd..f98f6d0b66 100644 --- a/api/js/etemplate/et2_core_DOMWidget.ts +++ b/api/js/etemplate/et2_core_DOMWidget.ts @@ -18,7 +18,13 @@ import {ClassWithAttributes} from './et2_core_inheritance'; import {et2_IDOMNode} from "./et2_core_interfaces"; import {et2_hasChild, et2_no_init} from "./et2_core_common"; import {et2_widget, WidgetConfig} from "./et2_core_widget"; -import '../egw_action/egw_action.js'; +import { + egw_getActionManager, + egwActionObject, + egwActionObjectInterface, + egw_getAppObjectManager, + EGW_AI_DRAG_OVER, EGW_AI_DRAG_OUT +} from '../egw_action/egw_action.js'; import {egw} from "../jsapi/egw_global"; // fixing circular dependencies by only importing type import type {et2_tabbox} from "./et2_widget_tabs"; @@ -594,7 +600,7 @@ export abstract class et2_DOMWidget extends et2_widget implements et2_IDOMNode // Initialize the action manager and add some actions to it // Only look 1 level deep - var gam = window.egw_getActionManager(this.egw().appName,true,1); + var gam = egw_getActionManager(this.egw().appName,true,1); if(typeof this._actionManager != "object") { if(gam.getActionById(this.getInstanceManager().uniqueId,1) !== null) diff --git a/api/js/etemplate/et2_widget_grid.js b/api/js/etemplate/et2_widget_grid.js index 0e4c61fefd..784231508e 100644 --- a/api/js/etemplate/et2_widget_grid.js +++ b/api/js/etemplate/et2_widget_grid.js @@ -17,7 +17,7 @@ import { et2_no_init } from "./et2_core_common"; import { et2_register_widget, et2_widget } from "./et2_core_widget"; import { ClassWithAttributes } from "./et2_core_inheritance"; import { et2_action_object_impl, et2_DOMWidget } from "./et2_core_DOMWidget"; -import '../egw_action/egw_action.js'; +import { egw_getAppObjectManager, egwActionObject } from '../egw_action/egw_action.js'; import { et2_directChildrenByTagName, et2_filteredNodeIterator, et2_readAttrWithDefault } from "./et2_core_xml"; import { egw } from "../jsapi/egw_global"; /** @@ -719,7 +719,7 @@ export class et2_grid extends et2_DOMWidget { // Get the top level element for the tree // get appObjectManager for the actual app, it might not always be the current app(e.g. running app content under admin tab) // @ts-ignore - let objectManager = window.egw_getAppObjectManager(true, this.getInstanceManager().app); + let objectManager = egw_getAppObjectManager(true, this.getInstanceManager().app); objectManager = objectManager.getObjectById(this.getInstanceManager().uniqueId, 2) || objectManager; let widget_object = objectManager.getObjectById(this.id); if (widget_object == null) { diff --git a/api/js/etemplate/et2_widget_grid.ts b/api/js/etemplate/et2_widget_grid.ts index 51b44922c3..f265f5bbce 100644 --- a/api/js/etemplate/et2_widget_grid.ts +++ b/api/js/etemplate/et2_widget_grid.ts @@ -20,7 +20,7 @@ import {et2_IAligned, et2_IDetachedDOM, et2_IResizeable} from "./et2_core_interf import {et2_register_widget, et2_widget, WidgetConfig} from "./et2_core_widget"; import {ClassWithAttributes} from "./et2_core_inheritance"; import {et2_action_object_impl, et2_DOMWidget} from "./et2_core_DOMWidget"; -import '../egw_action/egw_action.js'; +import {egw_getAppObjectManager, egwActionObject} from '../egw_action/egw_action.js'; import {et2_directChildrenByTagName, et2_filteredNodeIterator, et2_readAttrWithDefault} from "./et2_core_xml"; import {egw} from "../jsapi/egw_global"; @@ -1005,7 +1005,7 @@ export class et2_grid extends et2_DOMWidget implements et2_IDetachedDOM, et2_IAl // Get the top level element for the tree // get appObjectManager for the actual app, it might not always be the current app(e.g. running app content under admin tab) // @ts-ignore - let objectManager = window.egw_getAppObjectManager(true, this.getInstanceManager().app); + let objectManager = egw_getAppObjectManager(true, this.getInstanceManager().app); objectManager = objectManager.getObjectById(this.getInstanceManager().uniqueId,2) || objectManager; let widget_object = objectManager.getObjectById(this.id); if (widget_object == null) { diff --git a/api/js/etemplate/et2_widget_toolbar.js b/api/js/etemplate/et2_widget_toolbar.js index 21c9094026..f55ef43daa 100644 --- a/api/js/etemplate/et2_widget_toolbar.js +++ b/api/js/etemplate/et2_widget_toolbar.js @@ -16,9 +16,10 @@ import { et2_DOMWidget } from "./et2_core_DOMWidget"; import { et2_createWidget, et2_register_widget } from "./et2_core_widget"; import { ClassWithAttributes } from "./et2_core_inheritance"; -import '../egw_action/egw_action.js'; +import { egwActionObject, egw_getObjectManager, egwActionObjectManager } from '../egw_action/egw_action.js'; import { et2_dialog } from "./et2_widget_dialog"; import { egw } from "../jsapi/egw_global"; +import { egwIsMobile } from "../egw_action/egw_action_common.js"; /** * This toolbar gets its contents from its actions * diff --git a/api/js/etemplate/et2_widget_toolbar.ts b/api/js/etemplate/et2_widget_toolbar.ts index 7e2a780f9b..f80c32db39 100644 --- a/api/js/etemplate/et2_widget_toolbar.ts +++ b/api/js/etemplate/et2_widget_toolbar.ts @@ -18,12 +18,13 @@ import {et2_DOMWidget} from "./et2_core_DOMWidget"; import {et2_createWidget, et2_register_widget, WidgetConfig} from "./et2_core_widget"; import {ClassWithAttributes} from "./et2_core_inheritance"; -import '../egw_action/egw_action.js'; +import {egwActionObject, egw_getObjectManager, egwActionObjectManager} from '../egw_action/egw_action.js'; import {et2_dialog} from "./et2_widget_dialog"; import {et2_dropdown_button} from "./et2_widget_dropdown_button"; import {et2_checkbox} from "./et2_widget_checkbox"; import {et2_IInput} from "./et2_core_interfaces"; import {egw} from "../jsapi/egw_global"; +import {egwIsMobile} from "../egw_action/egw_action_common.js"; /** * This toolbar gets its contents from its actions *