@c8y/ngx-components 1024.20.1 → 1024.21.3

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.
Files changed (142) hide show
  1. package/fesm2022/c8y-ngx-components-ai-agent-chat.mjs +527 -12
  2. package/fesm2022/c8y-ngx-components-ai-agent-chat.mjs.map +1 -1
  3. package/fesm2022/c8y-ngx-components-ai-ai-chat.mjs +31 -9
  4. package/fesm2022/c8y-ngx-components-ai-ai-chat.mjs.map +1 -1
  5. package/fesm2022/c8y-ngx-components-ai.mjs +503 -62
  6. package/fesm2022/c8y-ngx-components-ai.mjs.map +1 -1
  7. package/fesm2022/c8y-ngx-components-alarm-event-selector.mjs +2 -2
  8. package/fesm2022/c8y-ngx-components-alarm-event-selector.mjs.map +1 -1
  9. package/fesm2022/c8y-ngx-components-alarms.mjs +3 -3
  10. package/fesm2022/c8y-ngx-components-alarms.mjs.map +1 -1
  11. package/fesm2022/c8y-ngx-components-application-access-list.mjs +1 -1
  12. package/fesm2022/c8y-ngx-components-application-access-list.mjs.map +1 -1
  13. package/fesm2022/c8y-ngx-components-application-select.mjs +1 -1
  14. package/fesm2022/c8y-ngx-components-application-select.mjs.map +1 -1
  15. package/fesm2022/c8y-ngx-components-asset-properties.mjs +3 -2
  16. package/fesm2022/c8y-ngx-components-asset-properties.mjs.map +1 -1
  17. package/fesm2022/c8y-ngx-components-auth-configuration.mjs +1 -1
  18. package/fesm2022/c8y-ngx-components-auth-configuration.mjs.map +1 -1
  19. package/fesm2022/c8y-ngx-components-bookmarks.mjs +1 -1
  20. package/fesm2022/c8y-ngx-components-bookmarks.mjs.map +1 -1
  21. package/fesm2022/c8y-ngx-components-branding-shared-lazy.mjs +1 -1
  22. package/fesm2022/c8y-ngx-components-branding-shared-lazy.mjs.map +1 -1
  23. package/fesm2022/c8y-ngx-components-cockpit-config.mjs +5 -5
  24. package/fesm2022/c8y-ngx-components-cockpit-config.mjs.map +1 -1
  25. package/fesm2022/{c8y-ngx-components-context-dashboard-dashboard-version-history.component-Jyjkv4JT.mjs → c8y-ngx-components-context-dashboard-dashboard-version-history.component-CP1afwVe.mjs} +2 -2
  26. package/fesm2022/{c8y-ngx-components-context-dashboard-dashboard-version-history.component-Jyjkv4JT.mjs.map → c8y-ngx-components-context-dashboard-dashboard-version-history.component-CP1afwVe.mjs.map} +1 -1
  27. package/fesm2022/c8y-ngx-components-context-dashboard.mjs +81 -20
  28. package/fesm2022/c8y-ngx-components-context-dashboard.mjs.map +1 -1
  29. package/fesm2022/{c8y-ngx-components-dashboard-details-advanced-tab-dashboard-details-advanced-tab.component-UEUYsXBv.mjs → c8y-ngx-components-dashboard-details-advanced-tab-dashboard-details-advanced-tab.component-CRvgIgri.mjs} +2 -2
  30. package/fesm2022/{c8y-ngx-components-dashboard-details-advanced-tab-dashboard-details-advanced-tab.component-UEUYsXBv.mjs.map → c8y-ngx-components-dashboard-details-advanced-tab-dashboard-details-advanced-tab.component-CRvgIgri.mjs.map} +1 -1
  31. package/fesm2022/c8y-ngx-components-dashboard-details-advanced-tab.mjs +2 -2
  32. package/fesm2022/c8y-ngx-components-dashboard-manager.mjs +1 -1
  33. package/fesm2022/c8y-ngx-components-dashboard-manager.mjs.map +1 -1
  34. package/fesm2022/c8y-ngx-components-datapoint-explorer-view.mjs +3 -3
  35. package/fesm2022/c8y-ngx-components-datapoint-explorer-view.mjs.map +1 -1
  36. package/fesm2022/c8y-ngx-components-datapoint-selector.mjs +2 -2
  37. package/fesm2022/c8y-ngx-components-datapoint-selector.mjs.map +1 -1
  38. package/fesm2022/c8y-ngx-components-device-profile.mjs +2 -2
  39. package/fesm2022/c8y-ngx-components-device-profile.mjs.map +1 -1
  40. package/fesm2022/c8y-ngx-components-diagnostics.mjs +1 -1
  41. package/fesm2022/c8y-ngx-components-diagnostics.mjs.map +1 -1
  42. package/fesm2022/c8y-ngx-components-echart.mjs +146 -126
  43. package/fesm2022/c8y-ngx-components-echart.mjs.map +1 -1
  44. package/fesm2022/c8y-ngx-components-ecosystem-application-plugins.mjs +2 -2
  45. package/fesm2022/c8y-ngx-components-ecosystem-application-plugins.mjs.map +1 -1
  46. package/fesm2022/c8y-ngx-components-ecosystem-shared.mjs +1 -1
  47. package/fesm2022/c8y-ngx-components-ecosystem-shared.mjs.map +1 -1
  48. package/fesm2022/c8y-ngx-components-ecosystem.mjs +4 -4
  49. package/fesm2022/c8y-ngx-components-ecosystem.mjs.map +1 -1
  50. package/fesm2022/c8y-ngx-components-events-events-timeline.mjs +1 -1
  51. package/fesm2022/c8y-ngx-components-events-events-timeline.mjs.map +1 -1
  52. package/fesm2022/c8y-ngx-components-events.mjs +2 -2
  53. package/fesm2022/c8y-ngx-components-events.mjs.map +1 -1
  54. package/fesm2022/c8y-ngx-components-icon-selector.mjs +4 -4
  55. package/fesm2022/c8y-ngx-components-icon-selector.mjs.map +1 -1
  56. package/fesm2022/c8y-ngx-components-operations-bulk-operation-list-item.mjs +1 -1
  57. package/fesm2022/c8y-ngx-components-operations-bulk-operation-list-item.mjs.map +1 -1
  58. package/fesm2022/c8y-ngx-components-operations-operations-list.mjs +1 -1
  59. package/fesm2022/c8y-ngx-components-operations-operations-list.mjs.map +1 -1
  60. package/fesm2022/c8y-ngx-components-operations-operations-timeline.mjs +1 -1
  61. package/fesm2022/c8y-ngx-components-operations-operations-timeline.mjs.map +1 -1
  62. package/fesm2022/c8y-ngx-components-operations-stepper-bulk-type-configuration.mjs +1 -1
  63. package/fesm2022/c8y-ngx-components-operations-stepper-bulk-type-configuration.mjs.map +1 -1
  64. package/fesm2022/c8y-ngx-components-operations-stepper-bulk-type-device-profile.mjs +2 -2
  65. package/fesm2022/c8y-ngx-components-operations-stepper-bulk-type-device-profile.mjs.map +1 -1
  66. package/fesm2022/c8y-ngx-components-operations-stepper-bulk-type-firmware.mjs +2 -2
  67. package/fesm2022/c8y-ngx-components-operations-stepper-bulk-type-firmware.mjs.map +1 -1
  68. package/fesm2022/c8y-ngx-components-operations-stepper-bulk-type-software.mjs +2 -2
  69. package/fesm2022/c8y-ngx-components-operations-stepper-bulk-type-software.mjs.map +1 -1
  70. package/fesm2022/c8y-ngx-components-protocol-lpwan.mjs +5 -5
  71. package/fesm2022/c8y-ngx-components-protocol-lpwan.mjs.map +1 -1
  72. package/fesm2022/c8y-ngx-components-protocol-opcua.mjs +1 -1
  73. package/fesm2022/c8y-ngx-components-protocol-opcua.mjs.map +1 -1
  74. package/fesm2022/c8y-ngx-components-register-device.mjs +3 -3
  75. package/fesm2022/c8y-ngx-components-register-device.mjs.map +1 -1
  76. package/fesm2022/c8y-ngx-components-remote-access-configurations.mjs +1 -1
  77. package/fesm2022/c8y-ngx-components-remote-access-configurations.mjs.map +1 -1
  78. package/fesm2022/c8y-ngx-components-replace-device-replace-device-wizard.mjs +1 -1
  79. package/fesm2022/c8y-ngx-components-replace-device-replace-device-wizard.mjs.map +1 -1
  80. package/fesm2022/c8y-ngx-components-report-dashboard.mjs +1 -1
  81. package/fesm2022/c8y-ngx-components-report-dashboard.mjs.map +1 -1
  82. package/fesm2022/c8y-ngx-components-repository-configuration.mjs +4 -4
  83. package/fesm2022/c8y-ngx-components-repository-configuration.mjs.map +1 -1
  84. package/fesm2022/c8y-ngx-components-repository-firmware.mjs +4 -4
  85. package/fesm2022/c8y-ngx-components-repository-firmware.mjs.map +1 -1
  86. package/fesm2022/c8y-ngx-components-repository-shared.mjs +2 -2
  87. package/fesm2022/c8y-ngx-components-repository-shared.mjs.map +1 -1
  88. package/fesm2022/c8y-ngx-components-repository-software.mjs +3 -3
  89. package/fesm2022/c8y-ngx-components-repository-software.mjs.map +1 -1
  90. package/fesm2022/c8y-ngx-components-static-assets-modal.mjs +1 -1
  91. package/fesm2022/c8y-ngx-components-static-assets-modal.mjs.map +1 -1
  92. package/fesm2022/c8y-ngx-components-tracking.mjs +1 -1
  93. package/fesm2022/c8y-ngx-components-tracking.mjs.map +1 -1
  94. package/fesm2022/c8y-ngx-components-trusted-certificates.mjs +1 -1
  95. package/fesm2022/c8y-ngx-components-trusted-certificates.mjs.map +1 -1
  96. package/fesm2022/c8y-ngx-components-widgets-definitions-html-widget.mjs +17 -1
  97. package/fesm2022/c8y-ngx-components-widgets-definitions-html-widget.mjs.map +1 -1
  98. package/fesm2022/c8y-ngx-components-widgets-definitions-scada.mjs +21 -1
  99. package/fesm2022/c8y-ngx-components-widgets-definitions-scada.mjs.map +1 -1
  100. package/fesm2022/c8y-ngx-components-widgets-implementations-asset-table.mjs +60 -31
  101. package/fesm2022/c8y-ngx-components-widgets-implementations-asset-table.mjs.map +1 -1
  102. package/fesm2022/c8y-ngx-components-widgets-implementations-datapoints-graph.mjs +2 -2
  103. package/fesm2022/c8y-ngx-components-widgets-implementations-datapoints-graph.mjs.map +1 -1
  104. package/fesm2022/c8y-ngx-components-widgets-implementations-datapoints-list.mjs +2 -2
  105. package/fesm2022/c8y-ngx-components-widgets-implementations-datapoints-list.mjs.map +1 -1
  106. package/fesm2022/c8y-ngx-components-widgets-implementations-datapoints-table.mjs +1 -1
  107. package/fesm2022/c8y-ngx-components-widgets-implementations-datapoints-table.mjs.map +1 -1
  108. package/fesm2022/c8y-ngx-components-widgets-implementations-image.mjs +1 -1
  109. package/fesm2022/c8y-ngx-components-widgets-implementations-image.mjs.map +1 -1
  110. package/fesm2022/c8y-ngx-components-widgets-implementations-quick-links.mjs +1 -1
  111. package/fesm2022/c8y-ngx-components-widgets-implementations-quick-links.mjs.map +1 -1
  112. package/fesm2022/c8y-ngx-components-widgets-implementations-scada.mjs +1 -1
  113. package/fesm2022/c8y-ngx-components-widgets-implementations-scada.mjs.map +1 -1
  114. package/fesm2022/c8y-ngx-components.mjs +500 -38
  115. package/fesm2022/c8y-ngx-components.mjs.map +1 -1
  116. package/locales/de.po +72 -0
  117. package/locales/es.po +72 -0
  118. package/locales/fr.po +72 -0
  119. package/locales/ja_JP.po +72 -0
  120. package/locales/ko.po +72 -0
  121. package/locales/locales.pot +72 -3
  122. package/locales/nl.po +72 -0
  123. package/locales/pl.po +73 -1
  124. package/locales/pt_BR.po +74 -2
  125. package/locales/zh_CN.po +72 -0
  126. package/locales/zh_TW.po +72 -0
  127. package/package.json +1 -1
  128. package/types/c8y-ngx-components-ai-agent-chat.d.ts +201 -3
  129. package/types/c8y-ngx-components-ai-agent-chat.d.ts.map +1 -1
  130. package/types/c8y-ngx-components-ai-ai-chat.d.ts +14 -4
  131. package/types/c8y-ngx-components-ai-ai-chat.d.ts.map +1 -1
  132. package/types/c8y-ngx-components-ai.d.ts +157 -2
  133. package/types/c8y-ngx-components-ai.d.ts.map +1 -1
  134. package/types/c8y-ngx-components-asset-properties.d.ts.map +1 -1
  135. package/types/c8y-ngx-components-context-dashboard.d.ts +37 -3
  136. package/types/c8y-ngx-components-context-dashboard.d.ts.map +1 -1
  137. package/types/c8y-ngx-components-echart.d.ts +6 -0
  138. package/types/c8y-ngx-components-echart.d.ts.map +1 -1
  139. package/types/c8y-ngx-components-widgets-implementations-asset-table.d.ts +5 -0
  140. package/types/c8y-ngx-components-widgets-implementations-asset-table.d.ts.map +1 -1
  141. package/types/c8y-ngx-components.d.ts +310 -12
  142. package/types/c8y-ngx-components.d.ts.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"c8y-ngx-components-context-dashboard-dashboard-version-history.component-Jyjkv4JT.mjs","sources":["../../context-dashboard/dashboard-settings/dashboard-version-history.component.ts","../../context-dashboard/dashboard-settings/dashboard-version-history.component.html"],"sourcesContent":["import { Component, ChangeDetectionStrategy } from '@angular/core';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport { C8yTranslatePipe, CoreModule } from '@c8y/ngx-components';\nimport { ContextDashboard } from '../context-dashboard.model';\nimport { TranslateService } from '@ngx-translate/core';\nimport { cloneDeep } from 'lodash-es';\nimport { ContextDashboardService } from '../context-dashboard.service';\nimport { DashboardDetailService } from '../dashboard-detail.service';\n\n@Component({\n selector: 'c8y-dashboard-version-history',\n templateUrl: './dashboard-version-history.component.html',\n standalone: true,\n imports: [C8yTranslatePipe, CoreModule],\n changeDetection: ChangeDetectionStrategy.Eager\n})\nexport class DashboardVersionHistoryComponent {\n dashboardHistory: ContextDashboard[] = [];\n isReport: boolean;\n dashboardHistoryExtended: (ContextDashboard & { descriptionText?: string })[] = [];\n restoredDashboardMessage = gettext(\n 'Restored dashboard state from {{ restoredStateCreationDate }}'\n );\n versionHistoryLimitMessage = gettext(\n 'Store up to {{ versionHistoryLimit }} dashboard versions. Any additional versions will replace/delete older ones'\n );\n\n constructor(\n private translateService: TranslateService,\n public contextDashboardService: ContextDashboardService,\n private dashboardDetailService: DashboardDetailService\n ) {}\n\n ngOnInit() {\n this.isReport = this.dashboardDetailService.details.isReport;\n this.dashboardHistory = this.dashboardDetailService.details.mo.c8y_DashboardHistory;\n this.generateDashboardHistoryDescription();\n }\n\n generateDashboardHistoryDescription() {\n for (const dashboard of this.dashboardHistory) {\n const copiedDashboard: ContextDashboard & { descriptionText?: string } = { ...dashboard };\n\n let settingChangesMessage = '';\n let assetModelMessage = '';\n let widgetChanges = '';\n\n if (dashboard.historyDescription.changeType === 'create') {\n copiedDashboard.descriptionText = this.translateService.instant(\n this.isReport ? gettext('Report created.') : gettext('Dashboard created.')\n );\n this.dashboardHistoryExtended.push(copiedDashboard);\n continue;\n }\n if (dashboard.historyDescription.changeType === 'reset') {\n copiedDashboard.descriptionText = this.translateService.instant(gettext('Reset widgets'));\n this.dashboardHistoryExtended.push(copiedDashboard);\n continue;\n }\n\n const isDashboardUpdated = dashboard.historyDescription.dashboardSettingChanges?.length > 0;\n if (isDashboardUpdated) {\n const translatedValuesChanged = dashboard.historyDescription.dashboardSettingChanges\n .map(val => this.translateService.instant(val))\n .join(', ');\n settingChangesMessage = this.translateService.instant(\n this.isReport\n ? gettext('Report updated: {{ values }}.')\n : gettext('Dashboard updated: {{ values }}.'),\n { values: translatedValuesChanged }\n );\n }\n\n const isDeviceDashboard = dashboard.historyDescription.deviceType != null && !this.isReport;\n if (isDeviceDashboard) {\n assetModelMessage = this.translateService.instant(\n dashboard.historyDescription.deviceType\n ? gettext('Dashboard asset model has been enabled.')\n : gettext('Dashboard asset model has been disabled.')\n );\n }\n\n if (dashboard.historyDescription.widgetChanges) {\n for (const change in dashboard.historyDescription.widgetChanges) {\n const widgetList = dashboard.historyDescription.widgetChanges[change];\n if (!widgetList) {\n continue;\n }\n const translatedWidgetList = dashboard.translateWidgetTitle\n ? widgetList.map(widget => this.translateService.instant(widget))\n : widgetList;\n switch (change) {\n case 'added':\n widgetChanges =\n widgetChanges +\n this.translateService.instant(gettext('Added widgets: {{ widgetList }}. '), {\n widgetList: `\"${translatedWidgetList.join('\", \"')}\"`\n });\n break;\n case 'removed':\n widgetChanges =\n widgetChanges +\n this.translateService.instant(gettext('Removed widgets: {{ widgetList }}. '), {\n widgetList: `\"${translatedWidgetList.join('\", \"')}\"`\n });\n break;\n case 'config':\n widgetChanges =\n widgetChanges +\n this.translateService.instant(gettext('Updated widgets: {{ widgetList }}. '), {\n widgetList: `\"${translatedWidgetList.join('\", \"')}\"`\n });\n break;\n case 'arrangement':\n widgetChanges =\n widgetChanges +\n this.translateService.instant(gettext('Rearranged widgets: {{ widgetList }}. '), {\n widgetList: `\"${translatedWidgetList.join('\", \"')}\"`\n });\n break;\n default:\n break;\n }\n }\n }\n\n copiedDashboard.descriptionText = `${settingChangesMessage} ${assetModelMessage} ${widgetChanges}`;\n this.dashboardHistoryExtended.push(copiedDashboard);\n }\n }\n\n revertDashboard(dashboard: ContextDashboard) {\n const newDashboard = cloneDeep(dashboard);\n newDashboard.historyDescription.restored = dashboard.created;\n this.dashboardDetailService.revertToDashboardFn(newDashboard);\n }\n}\n","<div class=\"bg-component p-t-8 p-b-8 separator-bottom text-center\">\n <i\n class=\"text-info m-r-4\"\n c8yIcon=\"info\"\n ></i>\n {{\n versionHistoryLimitMessage\n | translate: { versionHistoryLimit: contextDashboardService.VERSION_HISTORY_SIZE_LIMIT }\n }}\n</div>\n<c8y-list-group class=\"p-t-24 p-b-24\">\n <c8y-li-timeline\n *ngFor=\"let dashboard of dashboardHistoryExtended; index as i\"\n [ngClass]=\"{ active: i === 0 }\"\n >\n {{ dashboard.created | date: 'mediumDate' }}\n {{ dashboard.created | date: 'shortTime' }}\n <c8y-li data-cy=\"c8y-dashboard-version-history--history-row\">\n <c8y-li-body>\n <div class=\"d-flex a-i-start\">\n <div class=\"flex-grow\">\n <span\n class=\"text-truncate-wrap\"\n title=\"{{ dashboard.descriptionText }}\"\n data-cy=\"c8y-dashboard-version-history--history-title\"\n >\n {{ dashboard.descriptionText }}\n {{\n dashboard.historyDescription.restored\n ? (restoredDashboardMessage\n | translate\n : {\n restoredStateCreationDate: dashboard.historyDescription.restored | c8yDate\n })\n : ''\n }}\n </span>\n <small\n class=\"text-muted\"\n title=\"{{ 'by`user`' | translate }} {{ dashboard.author }}\"\n *ngIf=\"dashboard.author\"\n >\n <div class=\"icon-flex\">\n <i c8yIcon=\"c8y-user\"></i>\n {{ dashboard.author }}\n </div>\n </small>\n </div>\n\n <span\n class=\"label label-primary m-l-auto\"\n title=\"{{ 'The last saved status of the dashboard' | translate }}\"\n *ngIf=\"i === 0\"\n >\n {{ 'Current`dashboard status`' | translate }}\n </span>\n <span\n class=\"m-l-auto showOnHover\"\n *ngIf=\"dashboardHistoryExtended.length > 1 && i > 0\"\n >\n <button\n class=\"btn btn-default btn-sm\"\n title=\"{{ 'Restore the dashboard to this status' | translate }}\"\n type=\"button\"\n (click)=\"revertDashboard(dashboard)\"\n >\n {{ 'Restore' | translate }}\n </button>\n </span>\n </div>\n </c8y-li-body>\n </c8y-li>\n </c8y-li-timeline>\n</c8y-list-group>\n"],"names":["i1","i2.ContextDashboardService","i3.DashboardDetailService","i4"],"mappings":";;;;;;;;;;MAgBa,gCAAgC,CAAA;AAW3C,IAAA,WAAA,CACU,gBAAkC,EACnC,uBAAgD,EAC/C,sBAA8C,EAAA;QAF9C,IAAA,CAAA,gBAAgB,GAAhB,gBAAgB;QACjB,IAAA,CAAA,uBAAuB,GAAvB,uBAA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FAAA,EAAA;;;;;"}
1
+ {"version":3,"file":"c8y-ngx-components-context-dashboard-dashboard-version-history.component-CP1afwVe.mjs","sources":["../../context-dashboard/dashboard-settings/dashboard-version-history.component.ts","../../context-dashboard/dashboard-settings/dashboard-version-history.component.html"],"sourcesContent":["import { Component, ChangeDetectionStrategy } from '@angular/core';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport { C8yTranslatePipe, CoreModule } from '@c8y/ngx-components';\nimport { ContextDashboard } from '../context-dashboard.model';\nimport { TranslateService } from '@ngx-translate/core';\nimport { cloneDeep } from 'lodash-es';\nimport { ContextDashboardService } from '../context-dashboard.service';\nimport { DashboardDetailService } from '../dashboard-detail.service';\n\n@Component({\n selector: 'c8y-dashboard-version-history',\n templateUrl: './dashboard-version-history.component.html',\n standalone: true,\n imports: [C8yTranslatePipe, CoreModule],\n changeDetection: ChangeDetectionStrategy.Eager\n})\nexport class DashboardVersionHistoryComponent {\n dashboardHistory: ContextDashboard[] = [];\n isReport: boolean;\n dashboardHistoryExtended: (ContextDashboard & { descriptionText?: string })[] = [];\n restoredDashboardMessage = gettext(\n 'Restored dashboard state from {{ restoredStateCreationDate }}'\n );\n versionHistoryLimitMessage = gettext(\n 'Store up to {{ versionHistoryLimit }} dashboard versions. Any additional versions will replace/delete older ones'\n );\n\n constructor(\n private translateService: TranslateService,\n public contextDashboardService: ContextDashboardService,\n private dashboardDetailService: DashboardDetailService\n ) {}\n\n ngOnInit() {\n this.isReport = this.dashboardDetailService.details.isReport;\n this.dashboardHistory = this.dashboardDetailService.details.mo.c8y_DashboardHistory;\n this.generateDashboardHistoryDescription();\n }\n\n generateDashboardHistoryDescription() {\n for (const dashboard of this.dashboardHistory) {\n const copiedDashboard: ContextDashboard & { descriptionText?: string } = { ...dashboard };\n\n let settingChangesMessage = '';\n let assetModelMessage = '';\n let widgetChanges = '';\n\n if (dashboard.historyDescription.changeType === 'create') {\n copiedDashboard.descriptionText = this.translateService.instant(\n this.isReport ? gettext('Report created.') : gettext('Dashboard created.')\n );\n this.dashboardHistoryExtended.push(copiedDashboard);\n continue;\n }\n if (dashboard.historyDescription.changeType === 'reset') {\n copiedDashboard.descriptionText = this.translateService.instant(gettext('Reset widgets'));\n this.dashboardHistoryExtended.push(copiedDashboard);\n continue;\n }\n\n const isDashboardUpdated = dashboard.historyDescription.dashboardSettingChanges?.length > 0;\n if (isDashboardUpdated) {\n const translatedValuesChanged = dashboard.historyDescription.dashboardSettingChanges\n .map(val => this.translateService.instant(val))\n .join(', ');\n settingChangesMessage = this.translateService.instant(\n this.isReport\n ? gettext('Report updated: {{ values }}.')\n : gettext('Dashboard updated: {{ values }}.'),\n { values: translatedValuesChanged }\n );\n }\n\n const isDeviceDashboard = dashboard.historyDescription.deviceType != null && !this.isReport;\n if (isDeviceDashboard) {\n assetModelMessage = this.translateService.instant(\n dashboard.historyDescription.deviceType\n ? gettext('Dashboard asset model has been enabled.')\n : gettext('Dashboard asset model has been disabled.')\n );\n }\n\n if (dashboard.historyDescription.widgetChanges) {\n for (const change in dashboard.historyDescription.widgetChanges) {\n const widgetList = dashboard.historyDescription.widgetChanges[change];\n if (!widgetList) {\n continue;\n }\n const translatedWidgetList = dashboard.translateWidgetTitle\n ? widgetList.map(widget => this.translateService.instant(widget))\n : widgetList;\n switch (change) {\n case 'added':\n widgetChanges =\n widgetChanges +\n this.translateService.instant(gettext('Added widgets: {{ widgetList }}. '), {\n widgetList: `\"${translatedWidgetList.join('\", \"')}\"`\n });\n break;\n case 'removed':\n widgetChanges =\n widgetChanges +\n this.translateService.instant(gettext('Removed widgets: {{ widgetList }}. '), {\n widgetList: `\"${translatedWidgetList.join('\", \"')}\"`\n });\n break;\n case 'config':\n widgetChanges =\n widgetChanges +\n this.translateService.instant(gettext('Updated widgets: {{ widgetList }}. '), {\n widgetList: `\"${translatedWidgetList.join('\", \"')}\"`\n });\n break;\n case 'arrangement':\n widgetChanges =\n widgetChanges +\n this.translateService.instant(gettext('Rearranged widgets: {{ widgetList }}. '), {\n widgetList: `\"${translatedWidgetList.join('\", \"')}\"`\n });\n break;\n default:\n break;\n }\n }\n }\n\n copiedDashboard.descriptionText = `${settingChangesMessage} ${assetModelMessage} ${widgetChanges}`;\n this.dashboardHistoryExtended.push(copiedDashboard);\n }\n }\n\n revertDashboard(dashboard: ContextDashboard) {\n const newDashboard = cloneDeep(dashboard);\n newDashboard.historyDescription.restored = dashboard.created;\n this.dashboardDetailService.revertToDashboardFn(newDashboard);\n }\n}\n","<div class=\"bg-component p-t-8 p-b-8 separator-bottom text-center\">\n <i\n class=\"text-info m-r-4\"\n c8yIcon=\"info\"\n ></i>\n {{\n versionHistoryLimitMessage\n | translate: { versionHistoryLimit: contextDashboardService.VERSION_HISTORY_SIZE_LIMIT }\n }}\n</div>\n<c8y-list-group class=\"p-t-24 p-b-24\">\n <c8y-li-timeline\n *ngFor=\"let dashboard of dashboardHistoryExtended; index as i\"\n [ngClass]=\"{ active: i === 0 }\"\n >\n {{ dashboard.created | date: 'mediumDate' }}\n {{ dashboard.created | date: 'shortTime' }}\n <c8y-li data-cy=\"c8y-dashboard-version-history--history-row\">\n <c8y-li-body>\n <div class=\"d-flex a-i-start\">\n <div class=\"flex-grow\">\n <span\n class=\"text-truncate-wrap\"\n title=\"{{ dashboard.descriptionText }}\"\n data-cy=\"c8y-dashboard-version-history--history-title\"\n >\n {{ dashboard.descriptionText }}\n {{\n dashboard.historyDescription.restored\n ? (restoredDashboardMessage\n | translate\n : {\n restoredStateCreationDate: dashboard.historyDescription.restored | c8yDate\n })\n : ''\n }}\n </span>\n <small\n class=\"text-muted\"\n title=\"{{ 'by`user`' | translate }} {{ dashboard.author }}\"\n *ngIf=\"dashboard.author\"\n >\n <div class=\"icon-flex\">\n <i c8yIcon=\"c8y-user\"></i>\n {{ dashboard.author }}\n </div>\n </small>\n </div>\n\n <span\n class=\"label label-primary m-l-auto\"\n title=\"{{ 'The last saved status of the dashboard' | translate }}\"\n *ngIf=\"i === 0\"\n >\n {{ 'Current`dashboard status`' | translate }}\n </span>\n <span\n class=\"m-l-auto showOnHover\"\n *ngIf=\"dashboardHistoryExtended.length > 1 && i > 0\"\n >\n <button\n class=\"btn btn-default btn-sm\"\n title=\"{{ 'Restore the dashboard to this status' | translate }}\"\n type=\"button\"\n (click)=\"revertDashboard(dashboard)\"\n >\n {{ 'Restore' | translate }}\n </button>\n </span>\n </div>\n </c8y-li-body>\n </c8y-li>\n </c8y-li-timeline>\n</c8y-list-group>\n"],"names":["i1","i2.ContextDashboardService","i3.DashboardDetailService","i4"],"mappings":";;;;;;;;;;MAgBa,gCAAgC,CAAA;AAW3C,IAAA,WAAA,CACU,gBAAkC,EACnC,uBAAgD,EAC/C,sBAA8C,EAAA;QAF9C,IAAA,CAAA,gBAAgB,GAAhB,gBAAgB;QACjB,IAAA,CAAA,uBAAuB,GAAvB,uBAAuB;QACtB,IAAA,CAAA,sBAAsB,GAAtB,sBAAsB;QAbhC,IAAA,CAAA,gBAAgB,GAAuB,EAAE;QAEzC,IAAA,CAAA,wBAAwB,GAAwD,EAAE;AAClF,QAAA,IAAA,CAAA,wBAAwB,GAAG,OAAO,CAChC,+DAA+D,CAChE;AACD,QAAA,IAAA,CAAA,0BAA0B,GAAG,OAAO,CAClC,kHAAkH,CACnH;IAME;IAEH,QAAQ,GAAA;QACN,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,QAAQ;AAC5D,QAAA,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,EAAE,CAAC,oBAAoB;QACnF,IAAI,CAAC,mCAAmC,EAAE;IAC5C;IAEA,mCAAmC,GAAA;AACjC,QAAA,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,gBAAgB,EAAE;AAC7C,YAAA,MAAM,eAAe,GAAoD,EAAE,GAAG,SAAS,EAAE;YAEzF,IAAI,qBAAqB,GAAG,EAAE;YAC9B,IAAI,iBAAiB,GAAG,EAAE;YAC1B,IAAI,a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BAA5B,gBAAgB,EAAA,IAAA,EAAA,WAAA,EAAA,EAAA,EAAA,IAAA,EAAA,MAAA,EAAA,IAAA,EAAA,EAAA,CAAA,QAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,EAAA,IAAA,EAAA,MAAA,EAAA,IAAA,EAAAC,IAAA,CAAA,QAAA,EAAA,IAAA,EAAA,SAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,KAAA,EAAA,CAAA,CAAA;;4FAGf,gCAAgC,EAAA,UAAA,EAAA,CAAA;kBAP5C,SAAS;+BACE,+BAA+B,EAAA,UAAA,EAE7B,IAAI,EAAA,OAAA,EACP,CAAC,gBAAgB,EAAE,UAAU,CAAC,EAAA,eAAA,EACtB,uBAAuB,CAAC,KAAK,EAAA,QAAA,EAAA,0hFAAA,EAAA;;;;;"}
@@ -12,7 +12,7 @@ import { NgTemplateOutlet, CommonModule, NgClass, AsyncPipe, NgIf, NgForOf, NgFo
12
12
  import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
13
13
  import * as i6 from '@c8y/ngx-components/context-dashboard-state';
14
14
  import * as i2$1 from '@ngx-translate/core';
15
- import { assign, pick, isEmpty, cloneDeep, some, keys, keyBy, has, set, forEach, get, isEqual, clone, merge as merge$1, omit, sortBy, isNull, escapeRegExp, findIndex, kebabCase, every, words, camelCase } from 'lodash-es';
15
+ import { assign, pick, isEmpty, cloneDeep, some, keys, keyBy, has, set, forEach, get, isEqual, clone, omit, sortBy, isNull, escapeRegExp, findIndex, kebabCase, every, words, camelCase } from 'lodash-es';
16
16
  import * as i2$2 from 'ngx-bootstrap/popover';
17
17
  import { PopoverModule, PopoverDirective } from 'ngx-bootstrap/popover';
18
18
  import * as i1$1 from '@c8y/client';
@@ -2058,7 +2058,7 @@ class WidgetConfigSectionComponent {
2058
2058
  return Array.from(controlNames);
2059
2059
  }
2060
2060
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.19", ngImport: i0, type: WidgetConfigSectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2061
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.19", type: WidgetConfigSectionComponent, isStandalone: true, selector: "c8y-widget-config-section", inputs: { section: "section" }, ngImport: i0, template: "<c8y-li\n class=\"c8y-list__item--no-expand c8y-list__item--sticky-top c8y-list__item--dense full-w-collapse\"\n [collapsed]=\"!section.expanded\"\n #li\n>\n <div class=\"d-flex p-r-16 fit-w m-t-4 m-b-4\">\n <button\n class=\"btn-clean flex-no-shrink p-r-8 flex-grow\"\n type=\"button\"\n [attr.data-cy]=\"section.label\"\n (click)=\"li.collapsed = !li.collapsed\"\n >\n <i\n class=\"p-r-4\"\n [c8yIcon]=\"li.collapsed ? 'chevron-right' : 'chevron-down'\"\n ></i>\n <span class=\"text-medium\">\n {{ section.label | translate }}\n </span>\n </button>\n <ng-container *ngTemplateOutlet=\"feedbackTemplate\"></ng-container>\n @for (error of section.validationErrors | keyvalue; track error.key) {\n @if (parentForm.form?.errors?.[error.key] && customValidatorsTouched()) {\n <button\n class=\"btn-clean\"\n [attr.aria-label]=\"error.value | translate\"\n [tooltip]=\"error.value | translate\"\n type=\"button\"\n [delay]=\"500\"\n >\n <i\n class=\"status major\"\n [c8yIcon]=\"'warning'\"\n ></i>\n </button>\n }\n }\n </div>\n <c8y-list-item-collapse>\n @for (error of section.validationErrors | keyvalue; track error.key) {\n @if (parentForm.form?.errors?.[error.key] && customValidatorsTouched()) {\n <div\n class=\"alert alert-warning m-t-8\"\n role=\"alert\"\n >\n {{ error.value | translate }}\n </div>\n }\n }\n <ng-container\n *c8yComponentOutlet=\"\n section.component;\n initialState: section.initialState;\n environmentInjector: section.injector\n \"\n ></ng-container>\n </c8y-list-item-collapse>\n</c8y-li>\n", dependencies: [{ kind: "ngmodule", type: ListGroupModule }, { kind: "component", type: i2.ListItemComponent, selector: "c8y-list-item, c8y-li", inputs: ["active", "highlighted", "emptyActions", "dense", "collapsed", "selectable"], outputs: ["collapsedChange"] }, { kind: "component", type: i2.ListItemCollapseComponent, selector: "c8y-list-item-collapse, c8y-li-collapse", inputs: ["collapseWay"] }, { kind: "directive", type: C8yComponentOutlet, selector: "[c8yComponentOutlet]", inputs: ["c8yComponentOutlet", "c8yComponentOutletInjector", "c8yComponentOutletEnvironmentInjector", "c8yComponentOutletProviders", "c8yComponentOutletInitialState"] }, { kind: "directive", type: IconDirective, selector: "[c8yIcon]", inputs: ["c8yIcon"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: TooltipDirective, selector: "[tooltip], [tooltipHtml]", inputs: ["adaptivePosition", "tooltip", "placement", "triggers", "container", "containerClass", "boundariesElement", "isOpen", "isDisabled", "delay", "tooltipHtml", "tooltipPlacement", "tooltipIsOpen", "tooltipEnable", "tooltipAppendToBody", "tooltipAnimation", "tooltipClass", "tooltipContext", "tooltipPopupDelay", "tooltipFadeDuration", "tooltipTrigger"], outputs: ["tooltipChange", "onShown", "onHidden", "tooltipStateChanged"], exportAs: ["bs-tooltip"] }, { kind: "pipe", type: i5.KeyValuePipe, name: "keyvalue" }, { kind: "pipe", type: C8yTranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
2061
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.19", type: WidgetConfigSectionComponent, isStandalone: true, selector: "c8y-widget-config-section", inputs: { section: "section" }, ngImport: i0, template: "<c8y-li\n class=\"c8y-list__item--no-expand c8y-list__item--sticky-top c8y-list__item--dense full-w-collapse\"\n [collapsed]=\"!section.expanded\"\n #li\n>\n <div class=\"d-flex p-r-16 fit-w m-t-4 m-b-4\">\n <button\n class=\"btn-clean flex-no-shrink p-r-8 flex-grow\"\n type=\"button\"\n [attr.data-cy]=\"section.label\"\n (click)=\"li.collapsed = !li.collapsed\"\n >\n <i\n class=\"p-r-4\"\n [c8yIcon]=\"li.collapsed ? 'chevron-right' : 'chevron-down'\"\n ></i>\n <span class=\"text-medium\">\n {{ section.label | translate }}\n </span>\n </button>\n <ng-container *ngTemplateOutlet=\"feedbackTemplate\"></ng-container>\n @for (error of section.validationErrors | keyvalue; track error.key) {\n @if (parentForm.form?.errors?.[error.key] && customValidatorsTouched()) {\n <button\n class=\"btn-clean\"\n [attr.aria-label]=\"error.value | translate\"\n [tooltip]=\"error.value | translate\"\n type=\"button\"\n [delay]=\"500\"\n >\n <i\n class=\"status major\"\n [c8yIcon]=\"'warning'\"\n ></i>\n </button>\n }\n }\n </div>\n <c8y-list-item-collapse>\n @for (error of section.validationErrors | keyvalue; track error.key) {\n @if (parentForm.form?.errors?.[error.key] && customValidatorsTouched()) {\n <div\n class=\"alert alert-warning m-t-8\"\n role=\"alert\"\n >\n {{ error.value | translate }}\n </div>\n }\n }\n <ng-container\n *c8yComponentOutlet=\"\n section.component;\n initialState: section.initialState;\n environmentInjector: section.injector\n \"\n ></ng-container>\n </c8y-list-item-collapse>\n</c8y-li>\n", dependencies: [{ kind: "ngmodule", type: ListGroupModule }, { kind: "component", type: i2.ListItemComponent, selector: "c8y-list-item, c8y-li", inputs: ["active", "highlighted", "emptyActions", "dense", "collapsed", "selectable", "selectOnClick"], outputs: ["collapsedChange"] }, { kind: "component", type: i2.ListItemCollapseComponent, selector: "c8y-list-item-collapse, c8y-li-collapse", inputs: ["collapseWay"] }, { kind: "directive", type: C8yComponentOutlet, selector: "[c8yComponentOutlet]", inputs: ["c8yComponentOutlet", "c8yComponentOutletInjector", "c8yComponentOutletEnvironmentInjector", "c8yComponentOutletProviders", "c8yComponentOutletInitialState"] }, { kind: "directive", type: IconDirective, selector: "[c8yIcon]", inputs: ["c8yIcon"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: TooltipDirective, selector: "[tooltip], [tooltipHtml]", inputs: ["adaptivePosition", "tooltip", "placement", "triggers", "container", "containerClass", "boundariesElement", "isOpen", "isDisabled", "delay", "tooltipHtml", "tooltipPlacement", "tooltipIsOpen", "tooltipEnable", "tooltipAppendToBody", "tooltipAnimation", "tooltipClass", "tooltipContext", "tooltipPopupDelay", "tooltipFadeDuration", "tooltipTrigger"], outputs: ["tooltipChange", "onShown", "onHidden", "tooltipStateChanged"], exportAs: ["bs-tooltip"] }, { kind: "pipe", type: i5.KeyValuePipe, name: "keyvalue" }, { kind: "pipe", type: C8yTranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
2062
2062
  }
2063
2063
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.19", ngImport: i0, type: WidgetConfigSectionComponent, decorators: [{
2064
2064
  type: Component,
@@ -2470,7 +2470,10 @@ class WidgetConfigService {
2470
2470
  updateConfig(change, force = false) {
2471
2471
  if (force) {
2472
2472
  this._currentConfig$.next({ ...this._currentConfig$.value, ...change });
2473
- merge$1(this._assignedCurrentConfig$.value, change);
2473
+ // Apply the change with a shallow assign (as the non-force path does), not a deep merge.
2474
+ if (this._assignedCurrentConfig$.value) {
2475
+ Object.assign(this._assignedCurrentConfig$.value, change);
2476
+ }
2474
2477
  return;
2475
2478
  }
2476
2479
  this.configChange$.next(change);
@@ -3131,7 +3134,7 @@ class ContextDashboardComponent {
3131
3134
  get disabled() {
3132
3135
  return (!this.hasPermissionToEditDashboard || !this.dashboardDetails?.isCollapsed || this.isDisabled());
3133
3136
  }
3134
- constructor(route, router, contextDashboardService, alert, renderer, moduleConfig, widgetService, bottomDrawerService, gainsightService, actionBarService, translateService, modal, destroyRef, contextDashboardStateService, editModeService) {
3137
+ constructor(route, router, contextDashboardService, alert, renderer, moduleConfig, widgetService, bottomDrawerService, gainsightService, actionBarService, translateService, modal, destroyRef, contextDashboardStateService, editModeService, widgetContextBinding) {
3135
3138
  this.route = route;
3136
3139
  this.router = router;
3137
3140
  this.contextDashboardService = contextDashboardService;
@@ -3147,6 +3150,7 @@ class ContextDashboardComponent {
3147
3150
  this.destroyRef = destroyRef;
3148
3151
  this.contextDashboardStateService = contextDashboardStateService;
3149
3152
  this.editModeService = editModeService;
3153
+ this.widgetContextBinding = widgetContextBinding;
3150
3154
  this.childrenClasses = '';
3151
3155
  this.setTitle = false;
3152
3156
  this.defaultWidgets = [];
@@ -3585,12 +3589,12 @@ class ContextDashboardComponent {
3585
3589
  await this.onLoad();
3586
3590
  }
3587
3591
  async setWidgets(dashboardChildren, trackExperience = false) {
3588
- const isDeviceType = this.contextDashboardService.isDeviceType(this.mo);
3589
- this.widgets = await Promise.all(Object.values(dashboardChildren || {}).map(widget => {
3590
- widget.classes = this.mergeWidgetClasses(widget);
3591
- if (isDeviceType) {
3592
- this.applyDeviceTarget(widget);
3593
- }
3592
+ const widgets = Object.values(dashboardChildren || {});
3593
+ widgets.forEach(widget => (widget.classes = this.mergeWidgetClasses(widget)));
3594
+ if (this.contextDashboardService.isDeviceType(this.mo)) {
3595
+ await this.widgetContextBinding.applyContextToWidgets(widgets, this.context, widget => this.applyDeviceTarget(widget));
3596
+ }
3597
+ this.widgets = await Promise.all(widgets.map(widget => {
3594
3598
  if (trackExperience) {
3595
3599
  this.gainsightService.triggerEvent('loadWidget', {
3596
3600
  widgetName: widget.componentId || widget.name
@@ -3832,7 +3836,7 @@ class ContextDashboardComponent {
3832
3836
  ? str
3833
3837
  : this.gainsightService.hashGroupName(str);
3834
3838
  }
3835
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.19", ngImport: i0, type: ContextDashboardComponent, deps: [{ token: i1.ActivatedRoute }, { token: i1.Router }, { token: ContextDashboardService }, { token: i2.AlertService }, { token: i0.Renderer2 }, { token: CONTEXT_DASHBOARD_CONFIG }, { token: WidgetService }, { token: i2.BottomDrawerService }, { token: i2.GainsightService }, { token: i2.ActionBarService }, { token: i2$1.TranslateService }, { token: i2.ModalService }, { token: i0.DestroyRef }, { token: i6.ContextDashboardStateService }, { token: DashboardEditModeService }], target: i0.ɵɵFactoryTarget.Component }); }
3839
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.19", ngImport: i0, type: ContextDashboardComponent, deps: [{ token: i1.ActivatedRoute }, { token: i1.Router }, { token: ContextDashboardService }, { token: i2.AlertService }, { token: i0.Renderer2 }, { token: CONTEXT_DASHBOARD_CONFIG }, { token: WidgetService }, { token: i2.BottomDrawerService }, { token: i2.GainsightService }, { token: i2.ActionBarService }, { token: i2$1.TranslateService }, { token: i2.ModalService }, { token: i0.DestroyRef }, { token: i6.ContextDashboardStateService }, { token: DashboardEditModeService }, { token: i2.WidgetContextBindingService }], target: i0.ɵɵFactoryTarget.Component }); }
3836
3840
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.19", type: ContextDashboardComponent, isStandalone: true, selector: "c8y-context-dashboard", inputs: { name: { classPropertyName: "name", publicName: "name", isSignal: false, isRequired: false, transformFunction: null }, childrenClasses: { classPropertyName: "childrenClasses", publicName: "childrenClasses", isSignal: false, isRequired: false, transformFunction: null }, context: { classPropertyName: "context", publicName: "context", isSignal: false, isRequired: false, transformFunction: null }, setTitle: { classPropertyName: "setTitle", publicName: "setTitle", isSignal: false, isRequired: false, transformFunction: null }, defaultWidgets: { classPropertyName: "defaultWidgets", publicName: "defaultWidgets", isSignal: false, isRequired: false, transformFunction: null }, _canCopy: { classPropertyName: "_canCopy", publicName: "canCopy", isSignal: false, isRequired: false, transformFunction: null }, canDelete: { classPropertyName: "canDelete", publicName: "canDelete", isSignal: false, isRequired: false, transformFunction: null }, isLoading: { classPropertyName: "isLoading", publicName: "isLoading", isSignal: false, isRequired: false, transformFunction: null }, breadcrumbSettings: { classPropertyName: "breadcrumbSettings", publicName: "breadcrumbSettings", isSignal: false, isRequired: false, transformFunction: null }, showContextHelpButton: { classPropertyName: "showContextHelpButton", publicName: "showContextHelpButton", isSignal: false, isRequired: false, transformFunction: null }, translateWidgetTitle: { classPropertyName: "translateWidgetTitle", publicName: "translateWidgetTitle", isSignal: false, isRequired: false, transformFunction: null }, translateDashboardTitle: { classPropertyName: "translateDashboardTitle", publicName: "translateDashboardTitle", isSignal: false, isRequired: false, transformFunction: null }, hideAvailability: { classPropertyName: "hideAvailability", publicName: "hideAvailability", isSignal: false, isRequired: false, transformFunction: null }, isDisabled: { classPropertyName: "isDisabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "window:beforeunload": "beforeUnloadHandler($event)" }, properties: { "class": "this.class" }, styleAttribute: "\n display: block;\n ", classAttribute: "dashboard c8y-grid-dashboard" }, viewQueries: [{ propertyName: "dashboardDetails", first: true, predicate: DashboardDetailComponent, descendants: true, static: true }, { propertyName: "widgetsDashboard", first: true, predicate: WidgetsDashboardComponent, descendants: true, static: true }], ngImport: i0, template: "@if (title) {\n <c8y-title>\n {{ title }}\n </c8y-title>\n}\n\n@if (dashboard?.deviceType && dashboard.deviceTypeValue) {\n <c8y-action-bar-item\n [placement]=\"'right'\"\n [priority]=\"10000\"\n >\n <button\n class=\"btn-clean btn-link\"\n popoverTitle=\"{{ 'Dashboard template' | translate }}\"\n [attr.aria-label]=\"'Help' | translate\"\n [popover]=\"dashboardTypePopoverRef\"\n placement=\"bottom\"\n triggers=\"focus\"\n container=\"body\"\n type=\"button\"\n >\n <span class=\"tag tag--info text-12\">\n <span class=\"dashboard-template-marker\"></span>\n {{ dashboardTypeLabel | translate: { dashboardType: dashboard.deviceTypeValue } }}\n </span>\n </button>\n <ng-template #dashboardTypePopoverRef>\n <div\n [innerHTML]=\"dashboardTypePopover | translate: { dashboardType: dashboard.deviceTypeValue }\"\n ></div>\n </ng-template>\n </c8y-action-bar-item>\n}\n\n@if (defaultWidgets.length > 0) {\n <c8y-action-bar-item\n [placement]=\"'right'\"\n [priority]=\"-1\"\n >\n <button\n class=\"btn btn-link\"\n title=\"{{ 'Reset widgets' | translate }}\"\n type=\"button\"\n px-event=\"Reset dashboard\"\n (click)=\"restore()\"\n [disabled]=\"disabled || !mo?.id || (widgetsDashboard?.editMode$ | async)\"\n data-cy=\"context-dashboard--button-reset-dashboard\"\n >\n <i\n class=\"m-r-4\"\n c8yIcon=\"reset\"\n ></i>\n <span class=\"visible-xs-inline hidden-sm visible-md-inline visible-lg-inline\">\n {{ 'Reset widgets' | translate }}\n </span>\n </button>\n </c8y-action-bar-item>\n}\n\n@if (showContextHelpButton) {\n <c8y-help src=\"/docs/cockpit/working-with-dashboards/#working-with-dashboards\"></c8y-help>\n}\n\n<c8y-dashboard-detail\n class=\"d-contents\"\n [isReport]=\"isReport\"\n [dashboard]=\"dashboard\"\n [mo]=\"mo\"\n [context]=\"context\"\n [deviceType]=\"context?.type\"\n [hideAvailability]=\"hideAvailability\"\n [isNamedDashboard]=\"isNamedDashboard\"\n (dashboardSaved)=\"reloadDashboard($event)\"\n (previewChanged)=\"dashboardPreview($event)\"\n></c8y-dashboard-detail>\n\n<c8y-widgets-dashboard\n [context]=\"context\"\n [contextDashboard]=\"dashboard\"\n [widgets]=\"widgets\"\n [isCopyDisabled]=\"isCopyDisabled\"\n [isSaveDisabled]=\"contextDashboardStateService.isSaveDisabled | async\"\n [settings]=\"{\n isLoading: isLoading,\n isDisabled: disabled,\n canDelete: canDelete && !!dashboard,\n translateWidgetTitle: dashboard?.translateWidgetTitle ?? translateWidgetTitle,\n translateDashboardTitle: dashboard?.translateDashboardTitle ?? translateDashboardTitle,\n allowFullscreen: moduleConfig.allowFullscreen,\n title: setTitle ? dashboard?.name || title : undefined,\n widgetMargin: dashboard?.widgetMargin,\n canCopy: canCopy && !!dashboard,\n defaultWidth: dashboard?.columns >= 24 ? 8 : 4,\n columns: dashboard?.columns || 12,\n layout: dashboard?.layout || 'grid',\n alignViewHeight: !!dashboard?.alignViewHeight,\n rows: dashboard?.alignViewHeight ? dashboard?.rows || 24 : 'auto',\n float: !!dashboard?.float\n }\"\n [breadcrumb]=\"breadcrumbSettings\"\n [editModeButtons]=\"{\n undoButtonDisabled: editModeService.undoButtonDisabled,\n changeToUndoName: editModeService.changeToUndoName,\n redoButtonDisabled: !editModeService.redoStackLastItem,\n changeToRedoName: editModeService.redoStackLastItem?.name\n }\"\n (onChangeDashboard)=\"positionOrWidgetDimensionChange($event)\"\n (onAddWidget)=\"addWidget()\"\n (onEditWidget)=\"editWidget($event)\"\n (onDeleteWidget)=\"deleteWidget($event)\"\n (onSaveDashboard)=\"saveWidgetsToDashboard()\"\n (onCancelDashboard)=\"cancelEditMode()\"\n (revertChange)=\"revertChange($event)\"\n (onChangeStart)=\"addDashboardClassToBody()\"\n (onChangeEnd)=\"removeDashboardClassFromBody()\"\n (onEditDashboard)=\"editDashboard()\"\n (onCopyDashboard)=\"copyDashboard()\"\n (onDeleteDashboard)=\"deleteDashboard()\"\n></c8y-widgets-dashboard>\n", dependencies: [{ kind: "component", type: TitleComponent, selector: "c8y-title", inputs: ["pageTitleUpdate"] }, { kind: "component", type: ActionBarItemComponent, selector: "c8y-action-bar-item", inputs: ["placement", "priority", "itemClass", "injector", "groupId", "inGroupPriority"] }, { kind: "directive", type: PopoverDirective, selector: "[popover]", inputs: ["adaptivePosition", "boundariesElement", "popover", "popoverContext", "popoverTitle", "placement", "outsideClick", "triggers", "container", "containerClass", "isOpen", "delay"], outputs: ["onShown", "onHidden"], exportAs: ["bs-popover"] }, { kind: "directive", type: IconDirective, selector: "[c8yIcon]", inputs: ["c8yIcon"] }, { kind: "component", type: HelpComponent, selector: "c8y-help", inputs: ["src", "isCollapsed", "priority", "icon"] }, { kind: "component", type: DashboardDetailComponent, selector: "c8y-dashboard-detail", inputs: ["isReport", "deviceType", "context", "mo", "dashboard", "isNamedDashboard", "hideAvailability"], outputs: ["dashboardSaved", "previewChanged"] }, { kind: "component", type: WidgetsDashboardComponent, selector: "c8y-widgets-dashboard", inputs: ["widgets", "context", "contextDashboard", "settings", "isCopyDisabled", "breadcrumb", "editModeButtons", "isSaveDisabled", "clearWidgetContentOnLeave"], outputs: ["onAddWidget", "onEditWidget", "onDeleteWidget", "onChangeDashboard", "onResize", "onEditDashboard", "onCopyDashboard", "onDeleteDashboard", "onChangeStart", "onChangeEnd", "onSaveDashboard", "onCancelDashboard", "revertChange"] }, { kind: "pipe", type: C8yTranslatePipe, name: "translate" }, { kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.Eager }); }
3837
3841
  }
3838
3842
  __decorate([
@@ -3862,7 +3866,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.19", ngImpo
3862
3866
  }], ctorParameters: () => [{ type: i1.ActivatedRoute }, { type: i1.Router }, { type: ContextDashboardService }, { type: i2.AlertService }, { type: i0.Renderer2 }, { type: undefined, decorators: [{
3863
3867
  type: Inject,
3864
3868
  args: [CONTEXT_DASHBOARD_CONFIG]
3865
- }] }, { type: WidgetService }, { type: i2.BottomDrawerService }, { type: i2.GainsightService }, { type: i2.ActionBarService }, { type: i2$1.TranslateService }, { type: i2.ModalService }, { type: i0.DestroyRef }, { type: i6.ContextDashboardStateService }, { type: DashboardEditModeService }], propDecorators: { name: [{
3869
+ }] }, { type: WidgetService }, { type: i2.BottomDrawerService }, { type: i2.GainsightService }, { type: i2.ActionBarService }, { type: i2$1.TranslateService }, { type: i2.ModalService }, { type: i0.DestroyRef }, { type: i6.ContextDashboardStateService }, { type: DashboardEditModeService }, { type: i2.WidgetContextBindingService }], propDecorators: { name: [{
3866
3870
  type: Input
3867
3871
  }], childrenClasses: [{
3868
3872
  type: Input
@@ -4207,7 +4211,7 @@ class ContextDashboardModule {
4207
4211
  },
4208
4212
  {
4209
4213
  path: DashboardDetailsTabId.VERSIONHISTORY,
4210
- loadComponent: () => import('./c8y-ngx-components-context-dashboard-dashboard-version-history.component-Jyjkv4JT.mjs').then(m => m.DashboardVersionHistoryComponent),
4214
+ loadComponent: () => import('./c8y-ngx-components-context-dashboard-dashboard-version-history.component-CP1afwVe.mjs').then(m => m.DashboardVersionHistoryComponent),
4211
4215
  outlet: DASHBOARD_DETAILS_OUTLET,
4212
4216
  context: ViewContext.Dashboard
4213
4217
  }
@@ -4280,7 +4284,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.19", ngImpo
4280
4284
  },
4281
4285
  {
4282
4286
  path: DashboardDetailsTabId.VERSIONHISTORY,
4283
- loadComponent: () => import('./c8y-ngx-components-context-dashboard-dashboard-version-history.component-Jyjkv4JT.mjs').then(m => m.DashboardVersionHistoryComponent),
4287
+ loadComponent: () => import('./c8y-ngx-components-context-dashboard-dashboard-version-history.component-CP1afwVe.mjs').then(m => m.DashboardVersionHistoryComponent),
4284
4288
  outlet: DASHBOARD_DETAILS_OUTLET,
4285
4289
  context: ViewContext.Dashboard
4286
4290
  }
@@ -4987,7 +4991,29 @@ function referencesOldContext(id, oldContext) {
4987
4991
  */
4988
4992
  function replaceContextInAssetReference(reference, newContext, oldContext) {
4989
4993
  if (reference && referencesOldContext(reference.id, oldContext)) {
4990
- Object.assign(reference, pick(newContext, ['id', 'name']));
4994
+ bindAssetReferenceToContext(reference, newContext);
4995
+ }
4996
+ return reference;
4997
+ }
4998
+ /**
4999
+ * Binds a single asset reference of a widget configuration to the given context, whichever asset it
5000
+ * pointed at before.
5001
+ *
5002
+ * Use this from a widget's `applyContext` hook for every asset, device or group reference the
5003
+ * widget stores. On a device type dashboard one template is shared by all devices of the type, so
5004
+ * every reference has to follow the device being viewed, unlike on paste, where references
5005
+ * deliberately bound to another asset are preserved.
5006
+ *
5007
+ * Only `id` and `name` are copied, so that the widget configuration does not grow to hold a
5008
+ * complete managed object when the dashboard is saved.
5009
+ *
5010
+ * @param reference - The asset reference to rebind, modified in place
5011
+ * @param context - The managed object of the context currently being viewed
5012
+ * @returns The same reference, bound to the context
5013
+ */
5014
+ function bindAssetReferenceToContext(reference, context) {
5015
+ if (reference) {
5016
+ Object.assign(reference, pick(context, ['id', 'name']));
4991
5017
  }
4992
5018
  return reference;
4993
5019
  }
@@ -5010,16 +5036,51 @@ const IDENTIFIER_REGEX = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/;
5010
5036
  * @returns The same mappings object, with matching asset references replaced in place
5011
5037
  */
5012
5038
  function replaceContextInAssetPropertyMappings(mappings, newContext, oldContext) {
5039
+ return rebindAssetPropertyMappings(mappings, newContext, id => referencesOldContext(id, oldContext));
5040
+ }
5041
+ /**
5042
+ * Binds per-placeholder asset property mappings to the given context, whichever assets they pointed
5043
+ * at before.
5044
+ *
5045
+ * This is the `applyContext` counterpart of `replaceContextInAssetPropertyMappings`: on a device
5046
+ * type dashboard one template is shared by all devices of the type, so every placeholder has to
5047
+ * follow the device being viewed rather than only those bound to a previous context. The same three
5048
+ * references are covered: `assetProperty.asset`, the computed `contextAssetId` and every
5049
+ * `config.dp[].__target`. Mappings with a `null` `assetProperty` (unmapped placeholders) are left
5050
+ * untouched.
5051
+ *
5052
+ * @param mappings - Map of placeholder name to asset property mapping
5053
+ * @param context - The managed object of the context currently being viewed
5054
+ * @returns The same mappings object, with every asset reference bound to the context
5055
+ */
5056
+ function bindAssetPropertyMappingsToContext(mappings, context) {
5057
+ return rebindAssetPropertyMappings(mappings, context, () => true);
5058
+ }
5059
+ /**
5060
+ * Shared walker of the asset references an `AssetPropertyMappings` holds.
5061
+ *
5062
+ * @param mappings - Map of placeholder name to asset property mapping
5063
+ * @param context - The managed object to bind matching references to
5064
+ * @param shouldRebind - Decides, per stored ID, whether that reference is rebound
5065
+ */
5066
+ function rebindAssetPropertyMappings(mappings, context, shouldRebind) {
5013
5067
  forEach(mappings, mapping => {
5014
5068
  const assetProperty = mapping?.assetProperty;
5015
5069
  if (!assetProperty) {
5016
5070
  return;
5017
5071
  }
5018
- replaceContextInAssetReference(assetProperty.asset, newContext, oldContext);
5019
- if (referencesOldContext(assetProperty.contextAssetId, oldContext)) {
5020
- assetProperty.contextAssetId = newContext.id;
5072
+ if (assetProperty.asset && shouldRebind(assetProperty.asset.id)) {
5073
+ bindAssetReferenceToContext(assetProperty.asset, context);
5021
5074
  }
5022
- forEach(assetProperty.config?.dp, dataPoint => replaceContextInAssetReference(dataPoint?.__target, newContext, oldContext));
5075
+ // Only computed properties carry a contextAssetId; never add one to a property without it.
5076
+ if (assetProperty.contextAssetId && shouldRebind(assetProperty.contextAssetId)) {
5077
+ assetProperty.contextAssetId = context.id;
5078
+ }
5079
+ forEach(assetProperty.config?.dp, dataPoint => {
5080
+ if (dataPoint?.__target && shouldRebind(dataPoint.__target.id)) {
5081
+ bindAssetReferenceToContext(dataPoint.__target, context);
5082
+ }
5083
+ });
5023
5084
  });
5024
5085
  return mappings;
5025
5086
  }
@@ -5417,5 +5478,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.19", ngImpo
5417
5478
  * Generated bundle index. Do not edit.
5418
5479
  */
5419
5480
 
5420
- export { ALL_GLOBAL_ROLES_SELECTED, APPLIED_TO_APPLICATIONS_FRAGMENT, AddDashboardComponent, AddDashboardFactory, AppearanceSettingsComponent, AssetPropertyMappingsComponent, AssetPropertyMappingsService, CONTEXT_DASHBOARD_CONFIG, ContextDashboardComponent, ContextDashboardModule, ContextDashboardService, ContextDashboardType, DASHBOARD_CHILDREN_STATE_NAME, DASHBOARD_DETAILS_OUTLET, DASHBOARD_DETAILS_TABS_OUTLET_NAME, DASHBOARD_FOUNDATION_MAP, DASHBOARD_SETTINGS_CHANGES, DASHBOARD_THEME_CLASSES, DashboardActionBarFactory, DashboardDetailComponent, DashboardDetailService, DashboardDetailsTabId, DeviceInfoDashboardComponent, DeviceInfoDashboardModule, DeviceManagementHomeDashboardComponent, DeviceManagementHomeDashboardModule, FOUNDATION_CLASSES, GlobalContextSectionComponent, HOOK_WIDGET_CONFIG, NewDashboardGuard, PRODUCT_EXPERIENCE, PasteDashboardActionComponent, REPORT_DEFAULT_NAVIGATION_NODE_PRIORITY, STYLING_CLASS_PREFIXES, THEME_FOUNDATION_MAP, TypeDashboardInfoComponent, WIDGET_CONTENT_CLASSES, WIDGET_FOUNDATION_MAP, WIDGET_HEADER_CLASSES, WidgetAssetSelectorComponent, WidgetConfigAppearanceComponent, WidgetConfigChangeMode, WidgetConfigComponent, WidgetConfigFeedbackComponent, WidgetConfigGeneralComponent, WidgetConfigSectionComponent, WidgetConfigSectionService, WidgetConfigService, WidgetPreviewComponent, WidgetPreviewWrapperComponent, WidgetService, applyEntitySharing, escapeForRegExp, getPropertyBaseKey, getSharedApplicationKeys, hookWidgetConfig, newDashboardTab, quoteAndEscape, referencesOldContext, renamePropertyKeyInCode, replaceContextInAssetPropertyMappings, replaceContextInAssetReference };
5481
+ export { ALL_GLOBAL_ROLES_SELECTED, APPLIED_TO_APPLICATIONS_FRAGMENT, AddDashboardComponent, AddDashboardFactory, AppearanceSettingsComponent, AssetPropertyMappingsComponent, AssetPropertyMappingsService, CONTEXT_DASHBOARD_CONFIG, ContextDashboardComponent, ContextDashboardModule, ContextDashboardService, ContextDashboardType, DASHBOARD_CHILDREN_STATE_NAME, DASHBOARD_DETAILS_OUTLET, DASHBOARD_DETAILS_TABS_OUTLET_NAME, DASHBOARD_FOUNDATION_MAP, DASHBOARD_SETTINGS_CHANGES, DASHBOARD_THEME_CLASSES, DashboardActionBarFactory, DashboardDetailComponent, DashboardDetailService, DashboardDetailsTabId, DeviceInfoDashboardComponent, DeviceInfoDashboardModule, DeviceManagementHomeDashboardComponent, DeviceManagementHomeDashboardModule, FOUNDATION_CLASSES, GlobalContextSectionComponent, HOOK_WIDGET_CONFIG, NewDashboardGuard, PRODUCT_EXPERIENCE, PasteDashboardActionComponent, REPORT_DEFAULT_NAVIGATION_NODE_PRIORITY, STYLING_CLASS_PREFIXES, THEME_FOUNDATION_MAP, TypeDashboardInfoComponent, WIDGET_CONTENT_CLASSES, WIDGET_FOUNDATION_MAP, WIDGET_HEADER_CLASSES, WidgetAssetSelectorComponent, WidgetConfigAppearanceComponent, WidgetConfigChangeMode, WidgetConfigComponent, WidgetConfigFeedbackComponent, WidgetConfigGeneralComponent, WidgetConfigSectionComponent, WidgetConfigSectionService, WidgetConfigService, WidgetPreviewComponent, WidgetPreviewWrapperComponent, WidgetService, applyEntitySharing, bindAssetPropertyMappingsToContext, bindAssetReferenceToContext, escapeForRegExp, getPropertyBaseKey, getSharedApplicationKeys, hookWidgetConfig, newDashboardTab, quoteAndEscape, referencesOldContext, renamePropertyKeyInCode, replaceContextInAssetPropertyMappings, replaceContextInAssetReference };
5421
5482
  //# sourceMappingURL=c8y-ngx-components-context-dashboard.mjs.map