@libs-ui/services-dialog 0.2.156 → 0.2.158
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libs-ui-services-dialog.mjs","sources":["../../../../../libs-ui/services/dialog/src/dialog.service.ts","../../../../../libs-ui/services/dialog/src/libs-ui-services-dialog.ts"],"sourcesContent":["import { ComponentRef, Injectable, inject } from '@angular/core';\nimport { IModalFunctionsControl, LibsUiComponentsModalComponent, TYPE_MODAL_EVENT } from '@libs-ui/components-modal';\nimport { LibsUiDynamicComponentService } from '@libs-ui/services-dynamic-component';\nimport { uuid } from '@libs-ui/utils';\nimport { IDialog } from './interfaces/dialog.interface';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class LibsUiDialogService {\n private dialogsRef: Map<string, { component: ComponentRef<LibsUiComponentsModalComponent> }> = new Map();\n private dynamicComponentService = inject(LibsUiDynamicComponentService);\n\n public addDialog(config: IDialog, isAddParentDocument?: boolean): string {\n const idDialog = uuid();\n const component = this.dynamicComponentService.resolveComponentFactory(LibsUiComponentsModalComponent);\n const instance = component.instance;\n let functionControl: IModalFunctionsControl;\n instance.outFunctionControl.subscribe((func: IModalFunctionsControl) => functionControl = func);\n\n instance.outEvent.subscribe((eventName: TYPE_MODAL_EVENT) => {\n functionControl.setStateDisable(true);\n\n switch (eventName) {\n case 'agree':\n config.configAgreeEvent?.callback(functionControl);\n if (!config.configAgreeEvent?.ignoreRemoveDialog) {\n this.removeDialog(idDialog);\n }\n\n return;\n\n case 'close':\n config.configCloseEvent?.callback(functionControl);\n if (!config.configCloseEvent?.ignoreRemoveDialog) {\n this.removeDialog(idDialog);\n }\n\n return;\n\n case 'cancel':\n config.configCancelEvent?.callback(functionControl);\n if (!config.configCancelEvent?.ignoreRemoveDialog) {\n this.removeDialog(idDialog);\n }\n break;\n\n case 'back':\n config.configBackEvent?.callback(functionControl);\n if (!config.configBackEvent?.ignoreRemoveDialog) {\n this.removeDialog(idDialog);\n }\n break;\n }\n });\n\n component.setInput('zIndex', config.zIndex);\n component.setInput('title', config.title);\n component.setInput('width', config.width || '500px');\n component.setInput('height', config.height || 'auto');\n component.setInput('maxWidth', config.maxWidth);\n component.setInput('maxHeight', config.maxHeight);\n component.setInput('headerConfig', config.headerConfig || { hidden: !config.title });\n component.setInput('bodyConfig', config.bodyConfig);\n component.setInput('footerConfig', config.footerConfig);\n component.setInput('classIncludeModalWrapper', config.classIncludeModalWrapper);\n component.setInput('disable', config.disable || false);\n component.setInput('mode', config.mode || 'center');\n component.setInput('ignoreCommunicateMicroEvent', config.ignoreCommunicateMicroEvent);\n if (config.buttonsFooter) {\n component.setInput('buttonsFooter', config.buttonsFooter)\n }\n this.dialogsRef.set(idDialog, { component });\n this.dynamicComponentService.addToBody(component, isAddParentDocument);\n\n return idDialog;\n }\n\n public switchDisableActionsOnDialog(id: string) {\n const data = this.dialogsRef.get(id);\n\n if (!data) {\n return;\n }\n data.component.setInput('disable', !data.component.instance.disable);\n }\n\n public removeDialog(id: string) {\n const data = this.dialogsRef.get(id);\n\n if (!data) {\n return;\n }\n this.dynamicComponentService.remove(data.component);\n this.dialogsRef.delete(id);\n }\n\n public clearDialogsRef() {\n const keys = this.dialogsRef.keys();\n\n for (const key of keys) {\n this.removeDialog(key);\n }\n }\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MASa,mBAAmB,CAAA;AACtB,IAAA,UAAU,GAA6E,IAAI,GAAG,EAAE;
|
|
1
|
+
{"version":3,"file":"libs-ui-services-dialog.mjs","sources":["../../../../../libs-ui/services/dialog/src/dialog.service.ts","../../../../../libs-ui/services/dialog/src/libs-ui-services-dialog.ts"],"sourcesContent":["import { ComponentRef, Injectable, inject } from '@angular/core';\nimport { IModalFunctionsControl, LibsUiComponentsModalComponent, TYPE_MODAL_EVENT } from '@libs-ui/components-modal';\nimport { LibsUiDynamicComponentService } from '@libs-ui/services-dynamic-component';\nimport { uuid } from '@libs-ui/utils';\nimport { IDialog } from './interfaces/dialog.interface';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class LibsUiDialogService {\n private dialogsRef: Map<string, { component: ComponentRef<LibsUiComponentsModalComponent> }> = new Map();\n private dynamicComponentService = inject(LibsUiDynamicComponentService);\n\n public addDialog(config: IDialog, isAddParentDocument?: boolean): string {\n const idDialog = uuid();\n const component = this.dynamicComponentService.resolveComponentFactory(LibsUiComponentsModalComponent);\n const instance = component.instance;\n let functionControl: IModalFunctionsControl;\n instance.outFunctionControl.subscribe((func: IModalFunctionsControl) => functionControl = func);\n\n instance.outEvent.subscribe((eventName: TYPE_MODAL_EVENT) => {\n functionControl.setStateDisable(true);\n\n switch (eventName) {\n case 'agree':\n config.configAgreeEvent?.callback(functionControl);\n if (!config.configAgreeEvent?.ignoreRemoveDialog) {\n this.removeDialog(idDialog);\n }\n\n return;\n\n case 'close':\n config.configCloseEvent?.callback(functionControl);\n if (!config.configCloseEvent?.ignoreRemoveDialog) {\n this.removeDialog(idDialog);\n }\n\n return;\n\n case 'cancel':\n config.configCancelEvent?.callback(functionControl);\n if (!config.configCancelEvent?.ignoreRemoveDialog) {\n this.removeDialog(idDialog);\n }\n break;\n\n case 'back':\n config.configBackEvent?.callback(functionControl);\n if (!config.configBackEvent?.ignoreRemoveDialog) {\n this.removeDialog(idDialog);\n }\n break;\n }\n });\n\n component.setInput('zIndex', config.zIndex);\n component.setInput('title', config.title);\n component.setInput('width', config.width || '500px');\n component.setInput('height', config.height || 'auto');\n component.setInput('maxWidth', config.maxWidth);\n component.setInput('maxHeight', config.maxHeight);\n component.setInput('headerConfig', config.headerConfig || { hidden: !config.title });\n component.setInput('bodyConfig', config.bodyConfig);\n component.setInput('footerConfig', config.footerConfig);\n component.setInput('classIncludeModalWrapper', config.classIncludeModalWrapper);\n component.setInput('disable', config.disable || false);\n component.setInput('mode', config.mode || 'center');\n component.setInput('ignoreCommunicateMicroEvent', config.ignoreCommunicateMicroEvent);\n if (config.buttonsFooter) {\n component.setInput('buttonsFooter', config.buttonsFooter)\n }\n this.dialogsRef.set(idDialog, { component });\n this.dynamicComponentService.addToBody(component, isAddParentDocument);\n\n return idDialog;\n }\n\n public switchDisableActionsOnDialog(id: string) {\n const data = this.dialogsRef.get(id);\n\n if (!data) {\n return;\n }\n data.component.setInput('disable', !data.component.instance.disable);\n }\n\n public removeDialog(id: string) {\n const data = this.dialogsRef.get(id);\n\n if (!data) {\n return;\n }\n this.dynamicComponentService.remove(data.component);\n this.dialogsRef.delete(id);\n }\n\n public clearDialogsRef() {\n const keys = this.dialogsRef.keys();\n\n for (const key of keys) {\n this.removeDialog(key);\n }\n }\n}","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MASa,mBAAmB,CAAA;AACtB,IAAA,UAAU,GAA6E,IAAI,GAAG,EAAE,CAAC;AACjG,IAAA,uBAAuB,GAAG,MAAM,CAAC,6BAA6B,CAAC,CAAC;IAEjE,SAAS,CAAC,MAAe,EAAE,mBAA6B,EAAA;AAC7D,QAAA,MAAM,QAAQ,GAAG,IAAI,EAAE,CAAC;QACxB,MAAM,SAAS,GAAG,IAAI,CAAC,uBAAuB,CAAC,uBAAuB,CAAC,8BAA8B,CAAC,CAAC;AACvG,QAAA,MAAM,QAAQ,GAAG,SAAS,CAAC,QAAQ,CAAC;AACpC,QAAA,IAAI,eAAuC,CAAC;AAC5C,QAAA,QAAQ,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC,IAA4B,KAAK,eAAe,GAAG,IAAI,CAAC,CAAC;QAEhG,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,SAA2B,KAAI;AAC1D,YAAA,eAAe,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;YAEtC,QAAQ,SAAS;AACf,gBAAA,KAAK,OAAO;AACV,oBAAA,MAAM,CAAC,gBAAgB,EAAE,QAAQ,CAAC,eAAe,CAAC,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