Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/ilovecveti.ru/bitrix/js/ui/accessrights/v2/src/service/ |
Upload File : |
import { Cache } from 'main.core'; import type { AccessRightItem } from '../store/model/access-rights-model'; import { DependentVariables } from './value/type/dependent-variables'; import { Multivariables } from './value/type/multivariables'; import { Toggler } from './value/type/toggler'; import type { ValueType } from './value/type/value-type'; import { Variables } from './value/type/variables'; export class ServiceLocator { static #cache = new Cache.MemoryCache(); /** * `BX.UI.Hint.createInstance` takes up to 30% of CPU time when multiple hints are mounted on page * (e.g. on a load, search), probably because of `Manager.initByClassName` call in `new Manager`. * therefore, we share a Manager instance across all hints in the app */ static getHint(appGuid: string): BX.UI.Hint { return this.#cache.remember(`hint-${appGuid}`, () => { return BX.UI.Hint.createInstance({ id: `ui-access-rights-v2-hint-${appGuid}`, popupParameters: { className: 'ui-access-rights-v2-popup-pointer-events ui-hint-popup', autoHide: true, darkMode: true, maxWidth: 280, offsetTop: 0, offsetLeft: 8, angle: true, animation: 'fading-slide', }, }); }); } static getValueTypeByRight(right: AccessRightItem): ?ValueType { return this.getValueType(right.type); } static getValueType(type: string): ?ValueType { const stringType = String(type); return this.#cache.remember(stringType, () => { if (stringType === 'dependent_variables') { return new DependentVariables(); } if (stringType === 'multivariables') { return new Multivariables(); } if (stringType === 'toggler') { return new Toggler(); } if (stringType === 'variables') { return new Variables(); } console.warn('ui.accessrights.v2: Unknown access right type', type); return null; }); } }