@c8y/ngx-components 1022.33.0 → 1022.34.0

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 (41) hide show
  1. package/branding/shared/branding-tab.factory.d.ts +1 -1
  2. package/branding/shared/branding-tab.factory.d.ts.map +1 -1
  3. package/branding/shared/data/branding.type.d.ts +3 -2
  4. package/branding/shared/data/branding.type.d.ts.map +1 -1
  5. package/branding/shared/lazy/add-branding-modal/add-branding-modal.component.d.ts.map +1 -1
  6. package/branding/shared/lazy/apply-branding-to-app-modal/apply-branding-to-app-modal.component.d.ts.map +1 -1
  7. package/branding/shared/lazy/branding/branding.component.d.ts.map +1 -1
  8. package/branding/shared/lazy/branding-assets/branding-assets.component.d.ts +25 -0
  9. package/branding/shared/lazy/branding-assets/branding-assets.component.d.ts.map +1 -0
  10. package/branding/shared/lazy/branding-theme-form/branding-theme-form.component.d.ts +1 -0
  11. package/branding/shared/lazy/branding-theme-form/branding-theme-form.component.d.ts.map +1 -1
  12. package/branding/shared/lazy/index.d.ts +1 -0
  13. package/branding/shared/lazy/index.d.ts.map +1 -1
  14. package/branding/shared/shared-branding.module.d.ts +12 -4
  15. package/branding/shared/shared-branding.module.d.ts.map +1 -1
  16. package/core/clipboard/clipboard.service.d.ts +8 -2
  17. package/core/clipboard/clipboard.service.d.ts.map +1 -1
  18. package/core/common/files.service.d.ts +5 -1
  19. package/core/common/files.service.d.ts.map +1 -1
  20. package/fesm2022/c8y-ngx-components-branding-shared-data.mjs +5 -1
  21. package/fesm2022/c8y-ngx-components-branding-shared-data.mjs.map +1 -1
  22. package/fesm2022/c8y-ngx-components-branding-shared-lazy-add-branding-modal.mjs +15 -6
  23. package/fesm2022/c8y-ngx-components-branding-shared-lazy-add-branding-modal.mjs.map +1 -1
  24. package/fesm2022/c8y-ngx-components-branding-shared-lazy.mjs +101 -28
  25. package/fesm2022/c8y-ngx-components-branding-shared-lazy.mjs.map +1 -1
  26. package/fesm2022/c8y-ngx-components-branding-shared.mjs +98 -40
  27. package/fesm2022/c8y-ngx-components-branding-shared.mjs.map +1 -1
  28. package/fesm2022/c8y-ngx-components-static-assets-modal.mjs +143 -41
  29. package/fesm2022/c8y-ngx-components-static-assets-modal.mjs.map +1 -1
  30. package/fesm2022/c8y-ngx-components.mjs +10 -6
  31. package/fesm2022/c8y-ngx-components.mjs.map +1 -1
  32. package/locales/locales.pot +33 -0
  33. package/package.json +1 -1
  34. package/static-assets/modal/index.d.ts +1 -0
  35. package/static-assets/modal/index.d.ts.map +1 -1
  36. package/static-assets/modal/static-asset-main-type.pipe.d.ts +10 -0
  37. package/static-assets/modal/static-asset-main-type.pipe.d.ts.map +1 -0
  38. package/static-assets/modal/static-assets-file-list/static-assets-file-list.component.d.ts +31 -0
  39. package/static-assets/modal/static-assets-file-list/static-assets-file-list.component.d.ts.map +1 -0
  40. package/static-assets/modal/static-assets-modal.component.d.ts +2 -14
  41. package/static-assets/modal/static-assets-modal.component.d.ts.map +1 -1
@@ -1,10 +1,10 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { Injectable, inject, NgModule } from '@angular/core';
3
3
  import * as i1$1 from '@angular/router';
4
- import { RouterModule } from '@angular/router';
5
4
  import * as i1 from '@c8y/ngx-components';
6
- import { NavigatorNode, gettext, AppStateService, hookNavigator, hookTab, HookProviderTypes } from '@c8y/ngx-components';
5
+ import { NavigatorNode, AppStateService, hookNavigator, hookTab, hookRoute, HookProviderTypes } from '@c8y/ngx-components';
7
6
  import { map, shareReplay, distinctUntilChanged, switchMap, filter } from 'rxjs/operators';
7
+ import { gettext } from '@c8y/ngx-components/gettext';
8
8
  import { of, merge } from 'rxjs';
9
9
  import { StoreBrandingService } from '@c8y/ngx-components/branding/shared/data';
10
10
 
@@ -59,7 +59,7 @@ class BrandingTabFactory {
59
59
  return of(true);
60
60
  }
61
61
  getPathForBranding(brandingName, subPath) {
62
- return `branding-editor/${brandingName}/edit/${subPath}`;
62
+ return `branding-editor/variants/${brandingName}/edit/${subPath}`;
63
63
  }
64
64
  getTabsForVersion(name) {
65
65
  return [
@@ -114,47 +114,70 @@ const BRANDING_ROUTING = [
114
114
  {
115
115
  path: '',
116
116
  pathMatch: 'full',
117
- loadComponent: () => import('@c8y/ngx-components/branding/shared/lazy').then(m => m.BrandingComponent)
117
+ redirectTo: 'variants'
118
118
  },
119
119
  {
120
- path: ':name',
121
- resolve: {
122
- branding: ((route, _state) => {
123
- return inject(StoreBrandingService).getBrandingOptionsForVersion(route.params.name);
124
- }),
125
- tags: (async (route, _state) => {
126
- const store = inject(StoreBrandingService);
127
- const { variants } = await store.loadBrandingVariants();
128
- return variants.find(v => v?.tags?.includes(route.params.name))?.tags;
129
- }),
130
- fallbackBranding: (async (_route, _state) => {
131
- try {
132
- const store = inject(StoreBrandingService);
133
- const appState = inject(AppStateService);
134
- // management tenant should be free to change what every they want, so we do not provide a fallback branding
135
- if (appState.currentTenant.value?.name === 'management') {
136
- return {};
137
- }
138
- const fallbackBranding = await store.getBrandingOptionsForVersion('fallback');
139
- return fallbackBranding;
140
- }
141
- catch (e) {
142
- return {};
143
- }
144
- })
145
- },
120
+ path: 'variants',
146
121
  children: [
147
122
  {
148
123
  path: '',
149
124
  pathMatch: 'full',
150
- redirectTo: 'edit'
125
+ loadComponent: () => import('@c8y/ngx-components/branding/shared/lazy').then(m => m.BrandingComponent)
151
126
  },
152
127
  {
153
- path: 'edit',
154
- loadComponent: () => import('@c8y/ngx-components/branding/shared/lazy').then(m => m.EditBrandingRouterOutletComponent),
155
- children: BRANDING_EDIT_CHILD_ROUTES
128
+ path: ':name',
129
+ resolve: {
130
+ branding: ((route, _state) => {
131
+ return inject(StoreBrandingService).getBrandingOptionsForVersion(route.params.name);
132
+ }),
133
+ tags: (async (route, _state) => {
134
+ const store = inject(StoreBrandingService);
135
+ const { variants } = await store.loadBrandingVariants();
136
+ return variants.find(v => v?.tags?.includes(route.params.name))?.tags;
137
+ }),
138
+ fallbackBranding: (async (_route, _state) => {
139
+ try {
140
+ const store = inject(StoreBrandingService);
141
+ const appState = inject(AppStateService);
142
+ // management tenant should be free to change what every they want, so we do not provide a fallback branding
143
+ if (appState.currentTenant.value?.name === 'management') {
144
+ return {};
145
+ }
146
+ const fallbackBranding = await store.getBrandingOptionsForVersion('fallback');
147
+ return fallbackBranding;
148
+ }
149
+ catch (e) {
150
+ return {};
151
+ }
152
+ })
153
+ },
154
+ children: [
155
+ {
156
+ path: '',
157
+ pathMatch: 'full',
158
+ redirectTo: 'edit'
159
+ },
160
+ {
161
+ path: 'edit',
162
+ loadComponent: () => import('@c8y/ngx-components/branding/shared/lazy').then(m => m.EditBrandingRouterOutletComponent),
163
+ children: BRANDING_EDIT_CHILD_ROUTES
164
+ }
165
+ ]
156
166
  }
157
167
  ]
168
+ },
169
+ {
170
+ path: 'assets',
171
+ loadComponent: () => import('@c8y/ngx-components/branding/shared/lazy').then(m => m.BrandingAssetsComponent)
172
+ },
173
+ // Redirect old paths (like "/branding-editor/default" to "/branding-editor/variants/default")
174
+ {
175
+ path: '**',
176
+ redirectTo: redirectData => {
177
+ const { url } = redirectData;
178
+ const urlToAppend = url.map(segment => segment.path).join('/');
179
+ return `/branding-editor/variants/${urlToAppend}`;
180
+ }
158
181
  }
159
182
  ]
160
183
  },
@@ -171,23 +194,58 @@ const BRANDING_ROUTING = [
171
194
  redirectTo: 'branding-editor'
172
195
  }
173
196
  ];
197
+ class BrandingVariantsAndAssetsTabFactory {
198
+ constructor(router) {
199
+ this.router = router;
200
+ this.tabs = [
201
+ {
202
+ path: '/branding-editor/variants',
203
+ label: gettext('Variants'),
204
+ icon: 'folder',
205
+ priority: 500
206
+ },
207
+ {
208
+ path: '/branding-editor/assets',
209
+ label: gettext('Branding assets'),
210
+ icon: 'file',
211
+ priority: 100
212
+ }
213
+ ];
214
+ }
215
+ get() {
216
+ if (this.tabs.map(tab => tab.path).includes(this.router.url)) {
217
+ return this.tabs;
218
+ }
219
+ return [];
220
+ }
221
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: BrandingVariantsAndAssetsTabFactory, deps: [{ token: i1$1.Router }], target: i0.ɵɵFactoryTarget.Injectable }); }
222
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: BrandingVariantsAndAssetsTabFactory, providedIn: 'root' }); }
223
+ }
224
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: BrandingVariantsAndAssetsTabFactory, decorators: [{
225
+ type: Injectable,
226
+ args: [{ providedIn: 'root' }]
227
+ }], ctorParameters: () => [{ type: i1$1.Router }] });
174
228
  class SharedBrandingModule {
175
229
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: SharedBrandingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
176
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.15", ngImport: i0, type: SharedBrandingModule, imports: [i1$1.RouterModule] }); }
230
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.15", ngImport: i0, type: SharedBrandingModule }); }
177
231
  static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: SharedBrandingModule, providers: [
178
232
  // providerType: HookProviderTypes.ExistingProvider is used to ensure that the hook is only applied once even if the module is imported multiple times
179
233
  hookNavigator(SupportsBrandingService, { providerType: HookProviderTypes.ExistingProvider }),
180
- hookTab(BrandingTabFactory)
181
- ], imports: [RouterModule.forChild(BRANDING_ROUTING)] }); }
234
+ hookTab(BrandingTabFactory),
235
+ hookTab(BrandingVariantsAndAssetsTabFactory),
236
+ hookRoute(BRANDING_ROUTING)
237
+ ] }); }
182
238
  }
183
239
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: SharedBrandingModule, decorators: [{
184
240
  type: NgModule,
185
241
  args: [{
186
- imports: [RouterModule.forChild(BRANDING_ROUTING)],
242
+ imports: [],
187
243
  providers: [
188
244
  // providerType: HookProviderTypes.ExistingProvider is used to ensure that the hook is only applied once even if the module is imported multiple times
189
245
  hookNavigator(SupportsBrandingService, { providerType: HookProviderTypes.ExistingProvider }),
190
- hookTab(BrandingTabFactory)
246
+ hookTab(BrandingTabFactory),
247
+ hookTab(BrandingVariantsAndAssetsTabFactory),
248
+ hookRoute(BRANDING_ROUTING)
191
249
  ]
192
250
  }]
193
251
  }] });
@@ -196,5 +254,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
196
254
  * Generated bundle index. Do not edit.
197
255
  */
198
256
 
199
- export { BRANDING_EDIT_CHILD_ROUTES, BRANDING_ROUTING, BrandingTabFactory, SharedBrandingModule, genericTabName, lightThemeTabName };
257
+ export { BRANDING_EDIT_CHILD_ROUTES, BRANDING_ROUTING, BrandingTabFactory, BrandingVariantsAndAssetsTabFactory, SharedBrandingModule, genericTabName, lightThemeTabName };
200
258
  //# sourceMappingURL=c8y-ngx-components-branding-shared.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"c8y-ngx-components-branding-shared.mjs","sources":["../../branding/shared/supports-branding.service.ts","../../branding/shared/branding-tab.factory.ts","../../branding/shared/shared-branding.module.ts","../../branding/shared/c8y-ngx-components-branding-shared.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { CanActivate, UrlTree } from '@angular/router';\nimport { AppStateService, ExtensionFactory, NavigatorNode } from '@c8y/ngx-components';\nimport { Observable } from 'rxjs';\nimport { map, shareReplay } from 'rxjs/operators';\n\n@Injectable({ providedIn: 'root' })\nexport class SupportsBrandingService implements CanActivate, ExtensionFactory<NavigatorNode> {\n private supportsBranding$: Observable<boolean>;\n private node: NavigatorNode;\n constructor(private appState: AppStateService) {\n this.supportsBranding$ = this.appState.currentAppsOfUser.pipe(\n map(apps => {\n const brandingFeatureApp = apps.find(\n app => app.name === 'feature-branding' && app.owner?.tenant?.id === 'management'\n );\n return !!brandingFeatureApp;\n }),\n shareReplay(1)\n );\n this.node = new NavigatorNode({\n featureId: 'branding-editor',\n label: 'Branding',\n path: 'branding-editor',\n icon: 'palette',\n parent: 'Settings',\n routerLinkExact: false\n });\n }\n\n get(): Observable<NavigatorNode | NavigatorNode[]> {\n return this.supportsBranding$.pipe(\n map(supported => {\n if (supported) {\n return this.node;\n }\n return [];\n })\n );\n }\n\n canActivate(): boolean | UrlTree | Observable<boolean | UrlTree> | Promise<boolean | UrlTree> {\n return this.supportsBranding$;\n }\n}\n","import { Injectable } from '@angular/core';\nimport { ActivatedRoute } from '@angular/router';\nimport { ExtensionFactory, Tab, gettext } from '@c8y/ngx-components';\nimport { Observable, merge, of } from 'rxjs';\nimport { distinctUntilChanged, map, filter, switchMap } from 'rxjs/operators';\n\nexport const lightThemeTabName = gettext('Light theme');\nexport const genericTabName = gettext('Generic');\n\n@Injectable({ providedIn: 'root' })\nexport class BrandingTabFactory implements ExtensionFactory<Tab> {\n get(activatedRoute?: ActivatedRoute): Observable<Tab | Tab[]> {\n const routes = activatedRoute.pathFromRoot.map(route => route.url);\n return this.shouldShowTab$().pipe(\n distinctUntilChanged(),\n switchMap(value => {\n if (!value) {\n return of([]);\n }\n return merge(...routes).pipe(\n filter(urlSegments =>\n urlSegments.some(urlSegment => urlSegment.path === 'branding-editor')\n ),\n switchMap(() => this.shouldShowTab$()),\n filter(shouldShow => !!shouldShow),\n switchMap(() =>\n activatedRoute.parent?.params.pipe(\n map(params => params.name),\n distinctUntilChanged(),\n filter(name => !!name),\n map(name => this.getTabsForVersion(name))\n )\n )\n );\n })\n );\n }\n\n protected shouldShowTab$(): Observable<boolean> {\n return of(true);\n }\n\n protected getPathForBranding<T extends string>(brandingName: string, subPath: T) {\n return `branding-editor/${brandingName}/edit/${subPath}` as const;\n }\n\n protected getTabsForVersion(name: string): Tab[] {\n return [\n {\n path: this.getPathForBranding(name, 'generic'),\n label: genericTabName,\n icon: 'palette',\n priority: 600\n },\n {\n path: this.getPathForBranding(name, 'light'),\n label: lightThemeTabName,\n icon: 'sun',\n priority: 500\n }\n ];\n }\n}\n","import { NgModule, inject } from '@angular/core';\nimport {\n RouterModule,\n Route,\n RouterStateSnapshot,\n ActivatedRouteSnapshot,\n ResolveFn,\n Routes\n} from '@angular/router';\nimport { SupportsBrandingService } from './supports-branding.service';\nimport { AppStateService, hookNavigator, HookProviderTypes, hookTab } from '@c8y/ngx-components';\nimport { BrandingTabFactory, lightThemeTabName, genericTabName } from './branding-tab.factory';\nimport {\n BrandingFileDetails,\n BrandingOptionsJson,\n StoreBrandingService\n} from '@c8y/ngx-components/branding/shared/data';\n\nexport const BRANDING_EDIT_CHILD_ROUTES: Route[] = [\n {\n path: '',\n pathMatch: 'full',\n redirectTo: 'generic'\n },\n {\n path: 'generic',\n loadComponent: () =>\n import('@c8y/ngx-components/branding/shared/lazy').then(m => m.BrandingFormComponent),\n data: {\n tabName: genericTabName\n }\n },\n {\n path: 'light',\n loadComponent: () =>\n import('@c8y/ngx-components/branding/shared/lazy').then(m => m.BrandingThemeFormComponent),\n data: {\n tabName: lightThemeTabName\n }\n }\n];\n\nexport const BRANDING_ROUTING: Routes = [\n {\n path: 'branding-editor',\n canActivate: [SupportsBrandingService],\n children: [\n {\n path: '',\n pathMatch: 'full',\n loadComponent: () =>\n import('@c8y/ngx-components/branding/shared/lazy').then(m => m.BrandingComponent)\n },\n {\n path: ':name',\n resolve: {\n branding: ((route: ActivatedRouteSnapshot, _state: RouterStateSnapshot) => {\n return inject(StoreBrandingService).getBrandingOptionsForVersion(route.params.name);\n }) as ResolveFn<BrandingFileDetails[]>,\n tags: (async (route: ActivatedRouteSnapshot, _state: RouterStateSnapshot) => {\n const store = inject(StoreBrandingService);\n const { variants } = await store.loadBrandingVariants();\n return variants.find(v => v?.tags?.includes(route.params.name))?.tags;\n }) as ResolveFn<string[]>,\n fallbackBranding: (async (\n _route: ActivatedRouteSnapshot,\n _state: RouterStateSnapshot\n ) => {\n try {\n const store = inject(StoreBrandingService);\n const appState = inject(AppStateService);\n // management tenant should be free to change what every they want, so we do not provide a fallback branding\n if (appState.currentTenant.value?.name === 'management') {\n return {};\n }\n const fallbackBranding = await store.getBrandingOptionsForVersion('fallback');\n return fallbackBranding;\n } catch (e) {\n return {};\n }\n }) as ResolveFn<BrandingOptionsJson>\n },\n children: [\n {\n path: '',\n pathMatch: 'full',\n redirectTo: 'edit'\n },\n {\n path: 'edit',\n loadComponent: () =>\n import('@c8y/ngx-components/branding/shared/lazy').then(\n m => m.EditBrandingRouterOutletComponent\n ),\n children: BRANDING_EDIT_CHILD_ROUTES\n }\n ]\n }\n ]\n },\n // Redirects for legacy paths from old angularJS implementation\n // allows to keep old links working and to use the old branding manager (as long as we still ship it) when the new plugins are removed from admin app\n {\n path: 'enterprise/branding',\n pathMatch: 'full',\n redirectTo: 'branding-editor'\n },\n {\n path: 'branding',\n pathMatch: 'full',\n redirectTo: 'branding-editor'\n }\n];\n\n@NgModule({\n imports: [RouterModule.forChild(BRANDING_ROUTING)],\n providers: [\n // providerType: HookProviderTypes.ExistingProvider is used to ensure that the hook is only applied once even if the module is imported multiple times\n hookNavigator(SupportsBrandingService, { providerType: HookProviderTypes.ExistingProvider }),\n hookTab(BrandingTabFactory)\n ]\n})\nexport class SharedBrandingModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1"],"mappings":";;;;;;;;;;MAOa,uBAAuB,CAAA;AAGlC,IAAA,WAAA,CAAoB,QAAyB,EAAA;QAAzB,IAAA,CAAA,QAAQ,GAAR,QAAQ;AAC1B,QAAA,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,IAAI,CAC3D,GAAG,CAAC,IAAI,IAAG;YACT,MAAM,kBAAkB,GAAG,IAAI,CAAC,IAAI,CAClC,GAAG,IAAI,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,kBAAkB;AAC3B,SAAA,EAAA,OAAA,EAAA,CALS,YAAY,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAA,EAAA,CAAA,CAAA;;4FAOtC,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBARhC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;AAClD,oBAAA,SAAS,EAAE;;wBAET,aAAa,CAAC,uBAAuB,EAAE,EAAE,YAAY,EAAE,iBAAiB,CAAC,gBAAgB,EAAE,CAAC;wBAC5F,OAAO,CAAC,kBAAkB;AAC3B;AACF,iBAAA;;;ACzHD;;AAEG;;;;"}
1
+ {"version":3,"file":"c8y-ngx-components-branding-shared.mjs","sources":["../../branding/shared/supports-branding.service.ts","../../branding/shared/branding-tab.factory.ts","../../branding/shared/shared-branding.module.ts","../../branding/shared/c8y-ngx-components-branding-shared.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { CanActivate, UrlTree } from '@angular/router';\nimport { AppStateService, ExtensionFactory, NavigatorNode } from '@c8y/ngx-components';\nimport { Observable } from 'rxjs';\nimport { map, shareReplay } from 'rxjs/operators';\n\n@Injectable({ providedIn: 'root' })\nexport class SupportsBrandingService implements CanActivate, ExtensionFactory<NavigatorNode> {\n private supportsBranding$: Observable<boolean>;\n private node: NavigatorNode;\n constructor(private appState: AppStateService) {\n this.supportsBranding$ = this.appState.currentAppsOfUser.pipe(\n map(apps => {\n const brandingFeatureApp = apps.find(\n app => app.name === 'feature-branding' && app.owner?.tenant?.id === 'management'\n );\n return !!brandingFeatureApp;\n }),\n shareReplay(1)\n );\n this.node = new NavigatorNode({\n featureId: 'branding-editor',\n label: 'Branding',\n path: 'branding-editor',\n icon: 'palette',\n parent: 'Settings',\n routerLinkExact: false\n });\n }\n\n get(): Observable<NavigatorNode | NavigatorNode[]> {\n return this.supportsBranding$.pipe(\n map(supported => {\n if (supported) {\n return this.node;\n }\n return [];\n })\n );\n }\n\n canActivate(): boolean | UrlTree | Observable<boolean | UrlTree> | Promise<boolean | UrlTree> {\n return this.supportsBranding$;\n }\n}\n","import { Injectable } from '@angular/core';\nimport { ActivatedRoute } from '@angular/router';\nimport { ExtensionFactory, Tab } from '@c8y/ngx-components';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport { Observable, merge, of } from 'rxjs';\nimport { distinctUntilChanged, map, filter, switchMap } from 'rxjs/operators';\n\nexport const lightThemeTabName = gettext('Light theme');\nexport const genericTabName = gettext('Generic');\n\n@Injectable({ providedIn: 'root' })\nexport class BrandingTabFactory implements ExtensionFactory<Tab> {\n get(activatedRoute?: ActivatedRoute): Observable<Tab | Tab[]> {\n const routes = activatedRoute.pathFromRoot.map(route => route.url);\n return this.shouldShowTab$().pipe(\n distinctUntilChanged(),\n switchMap(value => {\n if (!value) {\n return of([]);\n }\n return merge(...routes).pipe(\n filter(urlSegments =>\n urlSegments.some(urlSegment => urlSegment.path === 'branding-editor')\n ),\n switchMap(() => this.shouldShowTab$()),\n filter(shouldShow => !!shouldShow),\n switchMap(() =>\n activatedRoute.parent?.params.pipe(\n map(params => params.name),\n distinctUntilChanged(),\n filter(name => !!name),\n map(name => this.getTabsForVersion(name))\n )\n )\n );\n })\n );\n }\n\n protected shouldShowTab$(): Observable<boolean> {\n return of(true);\n }\n\n protected getPathForBranding<T extends string>(brandingName: string, subPath: T) {\n return `branding-editor/variants/${brandingName}/edit/${subPath}` as const;\n }\n\n protected getTabsForVersion(name: string): Tab[] {\n return [\n {\n path: this.getPathForBranding(name, 'generic'),\n label: genericTabName,\n icon: 'palette',\n priority: 600\n },\n {\n path: this.getPathForBranding(name, 'light'),\n label: lightThemeTabName,\n icon: 'sun',\n priority: 500\n }\n ];\n }\n}\n","import { Injectable, NgModule, inject } from '@angular/core';\nimport { RouterStateSnapshot, ActivatedRouteSnapshot, ResolveFn, Router } from '@angular/router';\nimport { SupportsBrandingService } from './supports-branding.service';\nimport {\n AppStateService,\n ExtensionFactory,\n hookNavigator,\n HookProviderTypes,\n hookRoute,\n hookTab,\n Route,\n Tab\n} from '@c8y/ngx-components';\nimport { gettext } from '@c8y/ngx-components/gettext';\nimport { BrandingTabFactory, lightThemeTabName, genericTabName } from './branding-tab.factory';\nimport {\n BrandingFileDetails,\n BrandingOptionsJson,\n StoreBrandingService\n} from '@c8y/ngx-components/branding/shared/data';\n\nexport const BRANDING_EDIT_CHILD_ROUTES: Route[] = [\n {\n path: '',\n pathMatch: 'full',\n redirectTo: 'generic'\n },\n {\n path: 'generic',\n loadComponent: () =>\n import('@c8y/ngx-components/branding/shared/lazy').then(m => m.BrandingFormComponent),\n data: {\n tabName: genericTabName\n }\n },\n {\n path: 'light',\n loadComponent: () =>\n import('@c8y/ngx-components/branding/shared/lazy').then(m => m.BrandingThemeFormComponent),\n data: {\n tabName: lightThemeTabName\n }\n }\n];\n\nexport const BRANDING_ROUTING: Route[] = [\n {\n path: 'branding-editor',\n canActivate: [SupportsBrandingService],\n children: [\n {\n path: '',\n pathMatch: 'full',\n redirectTo: 'variants'\n },\n {\n path: 'variants',\n children: [\n {\n path: '',\n pathMatch: 'full',\n loadComponent: () =>\n import('@c8y/ngx-components/branding/shared/lazy').then(m => m.BrandingComponent)\n },\n {\n path: ':name',\n resolve: {\n branding: ((route: ActivatedRouteSnapshot, _state: RouterStateSnapshot) => {\n return inject(StoreBrandingService).getBrandingOptionsForVersion(route.params.name);\n }) as ResolveFn<BrandingFileDetails[]>,\n tags: (async (route: ActivatedRouteSnapshot, _state: RouterStateSnapshot) => {\n const store = inject(StoreBrandingService);\n const { variants } = await store.loadBrandingVariants();\n return variants.find(v => v?.tags?.includes(route.params.name))?.tags;\n }) as ResolveFn<string[]>,\n fallbackBranding: (async (\n _route: ActivatedRouteSnapshot,\n _state: RouterStateSnapshot\n ) => {\n try {\n const store = inject(StoreBrandingService);\n const appState = inject(AppStateService);\n // management tenant should be free to change what every they want, so we do not provide a fallback branding\n if (appState.currentTenant.value?.name === 'management') {\n return {};\n }\n const fallbackBranding = await store.getBrandingOptionsForVersion('fallback');\n return fallbackBranding;\n } catch (e) {\n return {};\n }\n }) as ResolveFn<BrandingOptionsJson>\n },\n children: [\n {\n path: '',\n pathMatch: 'full',\n redirectTo: 'edit'\n },\n {\n path: 'edit',\n loadComponent: () =>\n import('@c8y/ngx-components/branding/shared/lazy').then(\n m => m.EditBrandingRouterOutletComponent\n ),\n children: BRANDING_EDIT_CHILD_ROUTES\n }\n ]\n }\n ]\n },\n {\n path: 'assets',\n loadComponent: () =>\n import('@c8y/ngx-components/branding/shared/lazy').then(m => m.BrandingAssetsComponent)\n },\n // Redirect old paths (like \"/branding-editor/default\" to \"/branding-editor/variants/default\")\n {\n path: '**',\n redirectTo: redirectData => {\n const { url } = redirectData;\n const urlToAppend = url.map(segment => segment.path).join('/');\n return `/branding-editor/variants/${urlToAppend}`;\n }\n }\n ]\n },\n // Redirects for legacy paths from old angularJS implementation\n // allows to keep old links working and to use the old branding manager (as long as we still ship it) when the new plugins are removed from admin app\n {\n path: 'enterprise/branding',\n pathMatch: 'full',\n redirectTo: 'branding-editor'\n },\n {\n path: 'branding',\n pathMatch: 'full',\n redirectTo: 'branding-editor'\n }\n];\n\n@Injectable({ providedIn: 'root' })\nexport class BrandingVariantsAndAssetsTabFactory implements ExtensionFactory<Tab> {\n tabs: Tab[] = [\n {\n path: '/branding-editor/variants',\n label: gettext('Variants'),\n icon: 'folder',\n priority: 500\n },\n {\n path: '/branding-editor/assets',\n label: gettext('Branding assets'),\n icon: 'file',\n priority: 100\n }\n ];\n constructor(private router: Router) {}\n get(): Tab[] {\n if (this.tabs.map(tab => tab.path).includes(this.router.url)) {\n return this.tabs;\n }\n return [];\n }\n}\n\n@NgModule({\n imports: [],\n providers: [\n // providerType: HookProviderTypes.ExistingProvider is used to ensure that the hook is only applied once even if the module is imported multiple times\n hookNavigator(SupportsBrandingService, { providerType: HookProviderTypes.ExistingProvider }),\n hookTab(BrandingTabFactory),\n hookTab(BrandingVariantsAndAssetsTabFactory),\n hookRoute(BRANDING_ROUTING)\n ]\n})\nexport class SharedBrandingModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1"],"mappings":";;;;;;;;;;MAOa,uBAAuB,CAAA;AAGlC,IAAA,WAAA,CAAoB,QAAyB,EAAA;QAAzB,IAAA,CAAA,QAAQ,GAAR,QAAQ;AAC1B,QAAA,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,IAAI,CAC3D,GAAG,CAAC,IAAI,IAAG;YACT,MAAM,kBAAkB,GAAG,IAAI,CAAC,IAAI,CAClC,GAAG,IAAI,GAAG,CAAC,IAAI,KAAK,kBAAkB,IAAI,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,YAAY,CACjF;YACD,OAAO,CAAC,CAAC,kBAAkB;AAC7B,QAAA,CAAC,CAAC,EACF,WAAW,CAAC,CAAC,CAAC,CACf;AACD,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI,aAAa,CAAC;AAC5B,YAAA,SAAS,EAAE,iBAAiB;AAC5B,YAAA,KAAK,EAAE,UAAU;AACjB,YAAA,IAAI,EAAE,iBAAiB;AACvB,YAAA,IAAI,EAAE,SAAS;AACf,YAAA,MAAM,EAAE,UAAU;AAClB,YAAA,eAAe,EAAE;AAClB,SAAA,CAAC;IACJ;IAEA,GAAG,GAAA;QACD,OAAO,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAChC,GAAG,CAAC,SAAS,IAAG;YACd,IAAI,SAAS,EAAE;gBACb,OAAO,IAAI,CAAC,IAAI;YAClB;AACA,YAAA,OAAO,EAAE;QACX,CAAC,CAAC,CACH;IACH;IAEA,WAAW,GAAA;QACT,OAAO,IAAI,CAAC,iBAAiB;IAC/B;+GApCW,uBAAuB,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,EAAA,CAAA,eAAA,EAAA,CAAA,EAA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B,EAAE,EAAE,YAAY,EAAE,iBAAiB,CAAC,gBAAgB,EAAE,CAAC;wBAC5F,OAAO,CAAC,kBAAkB,CAAC;wBAC3B,OAAO,CAAC,mCAAmC,CAAC;wBAC5C,SAAS,CAAC,gBAAgB;AAC3B;AACF,iBAAA;;;AC/KD;;AAEG;;;;"}
@@ -1,53 +1,155 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Input, Component } from '@angular/core';
3
- import * as i1 from 'ngx-bootstrap/modal';
4
- import { Subject, merge, from } from 'rxjs';
5
- import * as i2 from '@c8y/ngx-components/static-assets/data';
6
- import { shareReplay, map, tap, first } from 'rxjs/operators';
7
- import { NgFor, NgIf, AsyncPipe, DatePipe } from '@angular/common';
8
- import * as i3 from '@c8y/ngx-components';
9
- import { gettext, CoreModule } from '@c8y/ngx-components';
10
- import * as i4 from 'ngx-bootstrap/popover';
11
- import { PopoverModule } from 'ngx-bootstrap/popover';
12
- import * as i5 from 'ngx-bootstrap/collapse';
2
+ import { Pipe, output, input, viewChild, inject, Component, Input } from '@angular/core';
3
+ import * as i1$1 from 'ngx-bootstrap/modal';
4
+ import { DropAreaComponent, AlertService, DatePipe, BytesPipe, LoadingComponent, C8yTranslatePipe, C8yTranslateDirective, MessagesComponent, ListGroupComponent, ListItemComponent, ListItemIconComponent, ListItemBodyComponent, IconDirective, ModalComponent } from '@c8y/ngx-components';
5
+ import { gettext } from '@c8y/ngx-components/gettext';
6
+ import { NgForOf, NgIf, AsyncPipe, NgStyle, NgClass, NgSwitch, NgSwitchCase, NgSwitchDefault } from '@angular/common';
7
+ import * as i1 from 'ngx-bootstrap/collapse';
13
8
  import { CollapseModule } from 'ngx-bootstrap/collapse';
9
+ import { PopoverDirective } from 'ngx-bootstrap/popover';
10
+ import { Subject, merge, combineLatest, firstValueFrom } from 'rxjs';
11
+ import { switchMap, shareReplay, map, tap, first } from 'rxjs/operators';
12
+ import { StaticAssetsService } from '@c8y/ngx-components/static-assets/data';
13
+ import { toObservable, takeUntilDestroyed } from '@angular/core/rxjs-interop';
14
+ import { TranslateService } from '@ngx-translate/core';
14
15
 
15
- class StaticAssetsModalComponent {
16
- constructor(modalRef, staticAssets) {
17
- this.modalRef = modalRef;
18
- this.staticAssets = staticAssets;
19
- this.assetType = 'branding';
20
- this.supportedFileExtensions = [];
21
- this.modalTitle = gettext('Select asset');
22
- this.layout = 'grid';
23
- this.accept = '';
16
+ class StaticAssetMainTypePipe {
17
+ constructor() {
18
+ this.supportedTypes = ['image', 'font'];
19
+ }
20
+ transform(value) {
21
+ if (!value?.type) {
22
+ return 'unknown';
23
+ }
24
+ const typePrefix = value.type.replace(/\/.*$/, '');
25
+ if (this.supportedTypes.includes(typePrefix)) {
26
+ return typePrefix;
27
+ }
28
+ return 'unknown';
29
+ }
30
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: StaticAssetMainTypePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
31
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.15", ngImport: i0, type: StaticAssetMainTypePipe, isStandalone: true, name: "staticAssetMainType" }); }
32
+ }
33
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: StaticAssetMainTypePipe, decorators: [{
34
+ type: Pipe,
35
+ args: [{
36
+ name: 'staticAssetMainType',
37
+ pure: true,
38
+ standalone: true
39
+ }]
40
+ }] });
41
+
42
+ class StaticAssetsFileListComponent {
43
+ constructor() {
44
+ this.itemSelected = output();
45
+ this.inModalView = input(false);
46
+ this.assetType = input('branding');
47
+ this.supportedFileExtensions = input([]);
48
+ this.layout = input('grid');
24
49
  this.isExpanded = false;
25
50
  this._filesUpdate$ = new Subject();
26
- this.result = new Promise((resolve, reject) => {
27
- this.resolve = resolve;
28
- this.reject = reject;
29
- });
30
- }
31
- ngOnInit() {
32
- this._unfilteredFiles$ = merge(this._filesUpdate$, from(this.staticAssets.listFiles(this.assetType))).pipe(shareReplay(1));
33
- this.files$ = this._unfilteredFiles$.pipe(map(files => this.supportedFileExtensions
34
- ? files.filter(tmp => this.supportedFileExtensions.includes(tmp.extension.toLowerCase()))
51
+ this.styleTagId = `static-assets-font-faces`;
52
+ this.dropArea = viewChild(DropAreaComponent);
53
+ this.alert = inject(AlertService);
54
+ this.translate = inject(TranslateService);
55
+ this.staticAssets = inject(StaticAssetsService);
56
+ this._unfilteredFiles$ = merge(toObservable(this.assetType).pipe(switchMap(assetType => this.staticAssets.listFiles(assetType))), this._filesUpdate$).pipe(shareReplay({ bufferSize: 1, refCount: true }));
57
+ this.files$ = combineLatest([
58
+ this._unfilteredFiles$,
59
+ toObservable(this.supportedFileExtensions)
60
+ ]).pipe(map(([files, supportedFileExtensions]) => supportedFileExtensions?.length
61
+ ? files.filter(tmp => supportedFileExtensions.includes(tmp.extension.toLowerCase()))
35
62
  : files), map(files => files.sort((a, b) => (a.addedAt < b.addedAt ? 1 : a.addedAt > b.addedAt ? -1 : 0))), tap(files => {
36
63
  if (!files.length) {
37
64
  this.isExpanded = true;
38
65
  }
39
- }));
40
- if (this.supportedFileExtensions) {
41
- this.accept = this.supportedFileExtensions.join(',');
42
- }
66
+ }), shareReplay({ bufferSize: 1, refCount: true }));
67
+ this.accept$ = toObservable(this.supportedFileExtensions).pipe(map(exts => exts.join(',')));
68
+ this.files$.pipe(takeUntilDestroyed()).subscribe(files => this.applyStylesForFiles(files));
69
+ }
70
+ ngOnDestroy() {
71
+ this.removeStyleTag();
43
72
  }
44
73
  async addFiles(files) {
45
74
  if (!files?.length) {
46
75
  return;
47
76
  }
48
- const existingFiles = await this._unfilteredFiles$.pipe(first()).toPromise();
49
- const newFiles = await this.staticAssets.addFilesToStaticAssets(this.assetType, files, existingFiles);
50
- this._filesUpdate$.next(newFiles);
77
+ this.dropArea().loading = true;
78
+ try {
79
+ const existingFiles = await firstValueFrom(this._unfilteredFiles$.pipe(first()));
80
+ const updatedFiles = await this.staticAssets.addFilesToStaticAssets(this.assetType(), files, existingFiles);
81
+ this._filesUpdate$.next(updatedFiles);
82
+ }
83
+ catch (e) {
84
+ this.alert.danger(this.translate.instant(gettext('Failed to upload asset.')), e?.message);
85
+ }
86
+ this.dropArea().files = null;
87
+ this.dropArea().loading = false;
88
+ }
89
+ select(asset) {
90
+ this.itemSelected.emit(asset);
91
+ }
92
+ applyStylesForFiles(files) {
93
+ this.removeStyleTag();
94
+ const styles = files
95
+ .filter(file => file.type.startsWith('font/'))
96
+ .map(file => `@font-face { font-family: '${file.hashSum}'; src: url('${file.path}'); }`)
97
+ .join('\n');
98
+ if (!styles) {
99
+ return;
100
+ }
101
+ const styleTag = document.createElement('style');
102
+ styleTag.id = this.styleTagId;
103
+ styleTag.innerHTML = styles;
104
+ styleTag.type = 'text/css';
105
+ document.body.appendChild(styleTag);
106
+ }
107
+ removeStyleTag() {
108
+ document.getElementById(this.styleTagId)?.remove();
109
+ }
110
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: StaticAssetsFileListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
111
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.15", type: StaticAssetsFileListComponent, isStandalone: true, selector: "c8y-static-assets-file-list", inputs: { inModalView: { classPropertyName: "inModalView", publicName: "inModalView", isSignal: true, isRequired: false, transformFunction: null }, assetType: { classPropertyName: "assetType", publicName: "assetType", isSignal: true, isRequired: false, transformFunction: null }, supportedFileExtensions: { classPropertyName: "supportedFileExtensions", publicName: "supportedFileExtensions", isSignal: true, isRequired: false, transformFunction: null }, layout: { classPropertyName: "layout", publicName: "layout", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { itemSelected: "itemSelected" }, viewQueries: [{ propertyName: "dropArea", first: true, predicate: DropAreaComponent, descendants: true, isSignal: true }], ngImport: i0, template: "<ng-container *ngIf=\"files$ | async as assets; else loading\">\n <div\n class=\"text-center sticky-top separator-bottom bg-component\"\n style=\"z-index: 1001\"\n >\n <p\n class=\"m-0 p-16\"\n *ngIf=\"assets.length\"\n >\n {{ 'Select from the list below or`first part, followed by upload a new asset`' | translate }}\n <button\n class=\"btn-link\"\n aria-controls=\"collapseUpload\"\n [attr.aria-expanded]=\"isExpanded\"\n (click)=\"isExpanded = !isExpanded\"\n >\n {{ 'upload a new asset' | translate }}\n </button>\n </p>\n <div\n class=\"collapse\"\n id=\"collapseUpload\"\n [isAnimated]=\"true\"\n [collapse]=\"!isExpanded\"\n >\n <div class=\"p-t-24 p-l-24 p-r-24 bg-level-1 separator-top-bottom p-b-32\">\n <c8y-drop-area\n class=\"drop-area-sm m-b-8\"\n [icon]=\"'upload'\"\n [accept]=\"accept$ | async\"\n (dropped)=\"addFiles($event)\"\n ></c8y-drop-area>\n <c8y-messages\n [helpMessage]=\"\n 'After uploading, the asset will be visible in the list below.' | translate\n \"\n ></c8y-messages>\n </div>\n </div>\n </div>\n <div *ngIf=\"assets.length\">\n <c8y-list-group\n class=\"m-b-0\"\n *ngIf=\"layout() != 'grid'\"\n >\n <c8y-list-item *ngFor=\"let asset of assets\">\n <c8y-list-item-icon icon=\"file\"></c8y-list-item-icon>\n\n <c8y-list-item-body>\n <div class=\"row\">\n <div class=\"col-md-3 col-xs-12 d-flex a-i-center\">\n <div\n class=\"text-truncate\"\n title=\"{{ asset.fileName }}\"\n >\n {{ asset.fileName }}\n </div>\n <button\n class=\"btn-dot m-l-4\"\n [title]=\"'Preview' | translate\"\n [popover]=\"preview\"\n placement=\"end\"\n triggers=\"focus\"\n container=\"body\"\n [adaptivePosition]=\"false\"\n >\n <i [c8yIcon]=\"'eye'\"></i>\n </button>\n <ng-template #preview>\n <div class=\"bg-checkered\">\n <img\n class=\"fit-w\"\n [alt]=\"asset.fileName\"\n [src]=\"asset.path\"\n />\n </div>\n </ng-template>\n </div>\n <div class=\"col-md-3 col-xs-12 text-muted\">\n <code class=\"text-10\">{{ asset.type }}</code>\n </div>\n <div class=\"col-md-2 col-xs-12 text-muted\">\n <span class=\"small\">{{ asset.size | bytes }}</span>\n </div>\n <div\n class=\"col-md-2 col-xs-12 text-muted\"\n [title]=\"asset.addedAt | c8yDate\"\n >\n <div class=\"icon-flex small\">\n <i\n class=\"m-r-4\"\n [c8yIcon]=\"'calendar'\"\n ></i>\n <span>{{ asset.addedAt | c8yDate }}</span>\n </div>\n </div>\n <div class=\"col-md-2 col-xs-12 d-flex\">\n <button\n class=\"btn btn-default btn-sm m-l-auto showOnHover\"\n (click)=\"select(asset)\"\n translate\n >\n Select\n </button>\n </div>\n </div>\n </c8y-list-item-body>\n </c8y-list-item>\n </c8y-list-group>\n <div\n class=\"card-group-block interact-grid\"\n *ngIf=\"layout() === 'grid'\"\n >\n <button\n class=\"card btn-clean interact pointer\"\n [ngClass]=\"{\n 'col-md-3 col-sm-4 col-xs-12': inModalView(),\n 'col-md-1 col-sm-3 col-xs-12': !inModalView()\n }\"\n *ngFor=\"let asset of assets\"\n (click)=\"select(asset)\"\n >\n <div class=\"card-block\">\n <ng-container [ngSwitch]=\"asset | staticAssetMainType\">\n <div\n class=\"bg-checkered\"\n *ngSwitchCase=\"'image'\"\n >\n <img\n class=\"img-responsive m-auto img-square\"\n [alt]=\"asset.fileName\"\n [src]=\"asset.path\"\n />\n </div>\n <div\n class=\"bg-checkered\"\n *ngSwitchCase=\"'font'\"\n >\n <div\n class=\"img-responsive m-auto img-square\"\n [ngStyle]=\"{ 'font-family': asset.hashSum }\"\n >\n <p class=\"fit-h text-balance text-truncate-wrap\">\n <!-- intentionally not translated -->\n The quick brown fox jumps over the lazy dog.\n </p>\n </div>\n </div>\n <div\n class=\"bg-checkered\"\n *ngSwitchDefault\n >\n <div class=\"img-responsive m-auto img-square d-flex a-i-center j-c-center\">\n <i\n class=\"icon-2x\"\n [c8yIcon]=\"'file'\"\n ></i>\n </div>\n </div>\n </ng-container>\n <p\n class=\"text-medium text-truncate-wrap m-t-8\"\n [title]=\"asset.fileName\"\n >\n <a\n [href]=\"asset.path\"\n download\n (click)=\"$event.stopPropagation()\"\n >\n <i [c8yIcon]=\"'download'\"></i>\n {{ asset.fileName }}\n </a>\n </p>\n <p class=\"m-b-4\">\n <code class=\"text-10\">{{ asset.type }}</code>\n </p>\n <p class=\"small text-muted d-flex flex-wrap a-i-center\">\n {{ asset.size | bytes }}\n <span class=\"m-l-auto\">\n <i\n class=\"m-r-4\"\n [c8yIcon]=\"'calendar'\"\n ></i>\n <span>{{ asset.addedAt | c8yDate }}</span>\n </span>\n </p>\n </div>\n </button>\n </div>\n </div>\n</ng-container>\n\n<ng-template #loading>\n <div class=\"p-24\">\n <c8y-loading></c8y-loading>\n </div>\n</ng-template>\n", dependencies: [{ kind: "directive", type: NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: DatePipe, name: "c8yDate" }, { kind: "pipe", type: BytesPipe, name: "bytes" }, { kind: "component", type: LoadingComponent, selector: "c8y-loading", inputs: ["layout", "progress", "message"] }, { kind: "component", type: DropAreaComponent, selector: "c8y-drop-area", inputs: ["formControl", "title", "message", "icon", "loadingMessage", "forceHideList", "alwaysShow", "clickToOpen", "loading", "progress", "maxAllowedFiles", "files", "maxFileSizeInMegaBytes", "accept"], outputs: ["dropped"] }, { kind: "pipe", type: C8yTranslatePipe, name: "translate" }, { kind: "directive", type: C8yTranslateDirective, selector: "[translate],[ngx-translate]" }, { kind: "component", type: MessagesComponent, selector: "c8y-messages", inputs: ["show", "defaults", "helpMessage"] }, { kind: "component", type: ListGroupComponent, selector: "c8y-list-group" }, { kind: "component", type: ListItemComponent, selector: "c8y-list-item, c8y-li", inputs: ["active", "highlighted", "emptyActions", "dense", "collapsed", "selectable"], outputs: ["collapsedChange"] }, { kind: "component", type: ListItemIconComponent, selector: "c8y-list-item-icon, c8y-li-icon", inputs: ["icon", "status"] }, { kind: "component", type: ListItemBodyComponent, selector: "c8y-list-item-body, c8y-li-body", inputs: ["body"] }, { 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: "ngmodule", type: CollapseModule }, { kind: "directive", type: i1.CollapseDirective, selector: "[collapse]", inputs: ["display", "isAnimated", "collapse"], outputs: ["collapsed", "collapses", "expanded", "expands"], exportAs: ["bs-collapse"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: IconDirective, selector: "[c8yIcon]", inputs: ["c8yIcon"] }, { kind: "pipe", type: StaticAssetMainTypePipe, name: "staticAssetMainType" }, { kind: "directive", type: NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: NgSwitchDefault, selector: "[ngSwitchDefault]" }] }); }
112
+ }
113
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: StaticAssetsFileListComponent, decorators: [{
114
+ type: Component,
115
+ args: [{ selector: 'c8y-static-assets-file-list', standalone: true, imports: [
116
+ NgForOf,
117
+ NgIf,
118
+ AsyncPipe,
119
+ DatePipe,
120
+ BytesPipe,
121
+ LoadingComponent,
122
+ DropAreaComponent,
123
+ C8yTranslatePipe,
124
+ C8yTranslateDirective,
125
+ MessagesComponent,
126
+ ListGroupComponent,
127
+ ListItemComponent,
128
+ ListItemIconComponent,
129
+ ListItemBodyComponent,
130
+ PopoverDirective,
131
+ CollapseModule,
132
+ NgStyle,
133
+ NgClass,
134
+ IconDirective,
135
+ StaticAssetMainTypePipe,
136
+ NgSwitch,
137
+ NgSwitchCase,
138
+ NgSwitchDefault
139
+ ], template: "<ng-container *ngIf=\"files$ | async as assets; else loading\">\n <div\n class=\"text-center sticky-top separator-bottom bg-component\"\n style=\"z-index: 1001\"\n >\n <p\n class=\"m-0 p-16\"\n *ngIf=\"assets.length\"\n >\n {{ 'Select from the list below or`first part, followed by upload a new asset`' | translate }}\n <button\n class=\"btn-link\"\n aria-controls=\"collapseUpload\"\n [attr.aria-expanded]=\"isExpanded\"\n (click)=\"isExpanded = !isExpanded\"\n >\n {{ 'upload a new asset' | translate }}\n </button>\n </p>\n <div\n class=\"collapse\"\n id=\"collapseUpload\"\n [isAnimated]=\"true\"\n [collapse]=\"!isExpanded\"\n >\n <div class=\"p-t-24 p-l-24 p-r-24 bg-level-1 separator-top-bottom p-b-32\">\n <c8y-drop-area\n class=\"drop-area-sm m-b-8\"\n [icon]=\"'upload'\"\n [accept]=\"accept$ | async\"\n (dropped)=\"addFiles($event)\"\n ></c8y-drop-area>\n <c8y-messages\n [helpMessage]=\"\n 'After uploading, the asset will be visible in the list below.' | translate\n \"\n ></c8y-messages>\n </div>\n </div>\n </div>\n <div *ngIf=\"assets.length\">\n <c8y-list-group\n class=\"m-b-0\"\n *ngIf=\"layout() != 'grid'\"\n >\n <c8y-list-item *ngFor=\"let asset of assets\">\n <c8y-list-item-icon icon=\"file\"></c8y-list-item-icon>\n\n <c8y-list-item-body>\n <div class=\"row\">\n <div class=\"col-md-3 col-xs-12 d-flex a-i-center\">\n <div\n class=\"text-truncate\"\n title=\"{{ asset.fileName }}\"\n >\n {{ asset.fileName }}\n </div>\n <button\n class=\"btn-dot m-l-4\"\n [title]=\"'Preview' | translate\"\n [popover]=\"preview\"\n placement=\"end\"\n triggers=\"focus\"\n container=\"body\"\n [adaptivePosition]=\"false\"\n >\n <i [c8yIcon]=\"'eye'\"></i>\n </button>\n <ng-template #preview>\n <div class=\"bg-checkered\">\n <img\n class=\"fit-w\"\n [alt]=\"asset.fileName\"\n [src]=\"asset.path\"\n />\n </div>\n </ng-template>\n </div>\n <div class=\"col-md-3 col-xs-12 text-muted\">\n <code class=\"text-10\">{{ asset.type }}</code>\n </div>\n <div class=\"col-md-2 col-xs-12 text-muted\">\n <span class=\"small\">{{ asset.size | bytes }}</span>\n </div>\n <div\n class=\"col-md-2 col-xs-12 text-muted\"\n [title]=\"asset.addedAt | c8yDate\"\n >\n <div class=\"icon-flex small\">\n <i\n class=\"m-r-4\"\n [c8yIcon]=\"'calendar'\"\n ></i>\n <span>{{ asset.addedAt | c8yDate }}</span>\n </div>\n </div>\n <div class=\"col-md-2 col-xs-12 d-flex\">\n <button\n class=\"btn btn-default btn-sm m-l-auto showOnHover\"\n (click)=\"select(asset)\"\n translate\n >\n Select\n </button>\n </div>\n </div>\n </c8y-list-item-body>\n </c8y-list-item>\n </c8y-list-group>\n <div\n class=\"card-group-block interact-grid\"\n *ngIf=\"layout() === 'grid'\"\n >\n <button\n class=\"card btn-clean interact pointer\"\n [ngClass]=\"{\n 'col-md-3 col-sm-4 col-xs-12': inModalView(),\n 'col-md-1 col-sm-3 col-xs-12': !inModalView()\n }\"\n *ngFor=\"let asset of assets\"\n (click)=\"select(asset)\"\n >\n <div class=\"card-block\">\n <ng-container [ngSwitch]=\"asset | staticAssetMainType\">\n <div\n class=\"bg-checkered\"\n *ngSwitchCase=\"'image'\"\n >\n <img\n class=\"img-responsive m-auto img-square\"\n [alt]=\"asset.fileName\"\n [src]=\"asset.path\"\n />\n </div>\n <div\n class=\"bg-checkered\"\n *ngSwitchCase=\"'font'\"\n >\n <div\n class=\"img-responsive m-auto img-square\"\n [ngStyle]=\"{ 'font-family': asset.hashSum }\"\n >\n <p class=\"fit-h text-balance text-truncate-wrap\">\n <!-- intentionally not translated -->\n The quick brown fox jumps over the lazy dog.\n </p>\n </div>\n </div>\n <div\n class=\"bg-checkered\"\n *ngSwitchDefault\n >\n <div class=\"img-responsive m-auto img-square d-flex a-i-center j-c-center\">\n <i\n class=\"icon-2x\"\n [c8yIcon]=\"'file'\"\n ></i>\n </div>\n </div>\n </ng-container>\n <p\n class=\"text-medium text-truncate-wrap m-t-8\"\n [title]=\"asset.fileName\"\n >\n <a\n [href]=\"asset.path\"\n download\n (click)=\"$event.stopPropagation()\"\n >\n <i [c8yIcon]=\"'download'\"></i>\n {{ asset.fileName }}\n </a>\n </p>\n <p class=\"m-b-4\">\n <code class=\"text-10\">{{ asset.type }}</code>\n </p>\n <p class=\"small text-muted d-flex flex-wrap a-i-center\">\n {{ asset.size | bytes }}\n <span class=\"m-l-auto\">\n <i\n class=\"m-r-4\"\n [c8yIcon]=\"'calendar'\"\n ></i>\n <span>{{ asset.addedAt | c8yDate }}</span>\n </span>\n </p>\n </div>\n </button>\n </div>\n </div>\n</ng-container>\n\n<ng-template #loading>\n <div class=\"p-24\">\n <c8y-loading></c8y-loading>\n </div>\n</ng-template>\n" }]
140
+ }], ctorParameters: () => [] });
141
+
142
+ class StaticAssetsModalComponent {
143
+ constructor(modalRef) {
144
+ this.modalRef = modalRef;
145
+ this.assetType = 'branding';
146
+ this.supportedFileExtensions = [];
147
+ this.modalTitle = gettext('Select asset');
148
+ this.layout = 'grid';
149
+ this.result = new Promise((resolve, reject) => {
150
+ this.resolve = resolve;
151
+ this.reject = reject;
152
+ });
51
153
  }
52
154
  select(asset) {
53
155
  this.modalRef.hide();
@@ -57,13 +159,13 @@ class StaticAssetsModalComponent {
57
159
  this.modalRef.hide();
58
160
  this.reject();
59
161
  }
60
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: StaticAssetsModalComponent, deps: [{ token: i1.BsModalRef }, { token: i2.StaticAssetsService }], target: i0.ɵɵFactoryTarget.Component }); }
61
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: StaticAssetsModalComponent, isStandalone: true, selector: "c8y-static-assets-modal", inputs: { assetType: "assetType", supportedFileExtensions: "supportedFileExtensions", modalTitle: "modalTitle", layout: "layout" }, ngImport: i0, template: "<c8y-modal\n [title]=\"modalTitle\"\n (onDismiss)=\"cancel()\"\n [headerClasses]=\"'dialog-header'\"\n [labels]=\"{ cancel: 'Cancel' }\"\n>\n <ng-container c8y-modal-title>\n <span [c8yIcon]=\"'select-all'\"></span>\n </ng-container>\n <ng-container *ngIf=\"files$ | async as assets; else loading\">\n <div class=\"text-center sticky-top separator-bottom bg-component\" style=\"z-index: 1001;\">\n <p *ngIf=\"assets.length\" class=\"m-0 p-16\">\n {{ 'Select from the list below or`first part, followed by upload a new asset`' | translate }}\n <button\n class=\"btn-link\"\n aria-controls=\"collapseUpload\"\n [attr.aria-expanded]=\"isExpanded\"\n (click)=\"isExpanded = !isExpanded\"\n >\n {{ 'upload a new asset' | translate }}\n </button>\n </p>\n <div\n class=\"collapse\"\n id=\"collapseUpload\"\n [isAnimated]=\"true\"\n [collapse]=\"!isExpanded\"\n >\n <div class=\"p-t-24 p-l-24 p-r-24 bg-level-1 separator-top-bottom p-b-32\">\n <c8y-drop-area\n class=\"drop-area-sm m-b-8\"\n [icon]=\"'upload'\"\n [accept]=\"accept\"\n (dropped)=\"addFiles($event)\"\n ></c8y-drop-area>\n <c8y-messages\n [helpMessage]=\"\n 'After uploading, the asset will be visible in the list below.' | translate\n \"\n ></c8y-messages>\n </div>\n </div>\n </div>\n <div *ngIf=\"assets.length\">\n <c8y-list-group\n class=\"m-b-0\"\n *ngIf=\"layout != 'grid'\"\n >\n <c8y-list-item *ngFor=\"let asset of assets\">\n <c8y-list-item-icon icon=\"file\"></c8y-list-item-icon>\n\n <c8y-list-item-body>\n <div class=\"row\">\n <div class=\"col-md-3 col-xs-12 d-flex a-i-center\">\n <div\n class=\"text-truncate\"\n title=\"{{ asset.fileName }}\"\n >\n {{ asset.fileName }}\n </div>\n <button\n class=\"btn-dot m-l-4\"\n [title]=\"'Preview' | translate\"\n [popover]=\"preview\"\n placement=\"end\"\n triggers=\"focus\"\n container=\"body\"\n [adaptivePosition]=\"false\"\n >\n <i c8yIcon=\"eye\"></i>\n </button>\n <ng-template #preview>\n <div class=\"bg-checkered\">\n <img\n class=\"fit-w\"\n [alt]=\"asset.fileName\"\n [src]=\"asset.path\"\n />\n </div>\n </ng-template>\n </div>\n <div class=\"col-md-3 col-xs-12 text-muted\">\n <code class=\"text-10\">{{ asset.type }}</code>\n </div>\n <div class=\"col-md-2 col-xs-12 text-muted\">\n <span class=\"small\">{{ asset.size | bytes }}</span>\n </div>\n <div\n class=\"col-md-2 col-xs-12 text-muted\"\n [title]=\"asset.addedAt | date\"\n >\n <div class=\"icon-flex small\">\n <i\n class=\"m-r-4\"\n c8yIcon=\"calendar\"\n ></i>\n <span>{{ asset.addedAt | date }}</span>\n </div>\n </div>\n <div class=\"col-md-2 col-xs-12 d-flex\">\n <button\n class=\"btn btn-default btn-sm m-l-auto showOnHover\"\n (click)=\"select(asset)\"\n translate\n >\n Select\n </button>\n </div>\n </div>\n </c8y-list-item-body>\n </c8y-list-item>\n </c8y-list-group>\n <div\n class=\"card-group-block interact-grid\"\n *ngIf=\"layout === 'grid'\"\n >\n <button\n class=\"col-md-3 col-sm-4 col-xs-12 card btn-clean interact pointer\"\n *ngFor=\"let asset of assets\"\n (click)=\"select(asset)\"\n >\n <div class=\"card-block\">\n <div class=\"bg-checkered\">\n <img\n class=\"img-responsive m-auto img-square\"\n [alt]=\"asset.fileName\"\n [src]=\"asset.path\"\n />\n </div>\n <p\n class=\"text-medium text-truncate-wrap m-t-8\"\n title=\"{{ asset.fileName }}\"\n >\n {{ asset.fileName }}\n </p>\n <p class=\"m-b-4\">\n <code class=\"text-10\">{{ asset.type }}</code>\n </p>\n <p class=\"small text-muted d-flex a-i-center\">\n {{ asset.size | bytes }}\n <span class=\"m-l-auto\">\n <i\n class=\"m-r-4\"\n c8yIcon=\"calendar\"\n ></i>\n <span>{{ asset.addedAt | date }}</span>\n </span>\n </p>\n </div>\n </button>\n </div>\n </div>\n </ng-container>\n\n <ng-template #loading>\n <div class=\"p-24\">\n <c8y-loading></c8y-loading>\n </div>\n </ng-template>\n</c8y-modal>\n", dependencies: [{ kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "pipe", type: DatePipe, name: "date" }, { kind: "ngmodule", type: CoreModule }, { kind: "directive", type: i3.IconDirective, selector: "[c8yIcon]", inputs: ["c8yIcon"] }, { kind: "pipe", type: i3.C8yTranslatePipe, name: "translate" }, { kind: "directive", type: i3.C8yTranslateDirective, selector: "[translate],[ngx-translate]" }, { kind: "component", type: i3.LoadingComponent, selector: "c8y-loading", inputs: ["layout", "progress", "message"] }, { kind: "pipe", type: i3.BytesPipe, name: "bytes" }, { kind: "component", type: i3.DropAreaComponent, selector: "c8y-drop-area", inputs: ["formControl", "title", "message", "icon", "loadingMessage", "forceHideList", "alwaysShow", "clickToOpen", "loading", "progress", "maxAllowedFiles", "files", "maxFileSizeInMegaBytes", "accept"], outputs: ["dropped"] }, { kind: "component", type: i3.ModalComponent, selector: "c8y-modal", inputs: ["disabled", "close", "dismiss", "title", "body", "customFooter", "headerClasses", "labels"], outputs: ["onDismiss", "onClose"] }, { kind: "component", type: i3.MessagesComponent, selector: "c8y-messages", inputs: ["show", "defaults", "helpMessage"] }, { kind: "component", type: i3.ListGroupComponent, selector: "c8y-list-group" }, { kind: "component", type: i3.ListItemComponent, selector: "c8y-list-item, c8y-li", inputs: ["active", "highlighted", "emptyActions", "dense", "collapsed", "selectable"], outputs: ["collapsedChange"] }, { kind: "component", type: i3.ListItemIconComponent, selector: "c8y-list-item-icon, c8y-li-icon", inputs: ["icon", "status"] }, { kind: "component", type: i3.ListItemBodyComponent, selector: "c8y-list-item-body, c8y-li-body", inputs: ["body"] }, { kind: "ngmodule", type: PopoverModule }, { kind: "directive", type: i4.PopoverDirective, selector: "[popover]", inputs: ["adaptivePosition", "boundariesElement", "popover", "popoverContext", "popoverTitle", "placement", "outsideClick", "triggers", "container", "containerClass", "isOpen", "delay"], outputs: ["onShown", "onHidden"], exportAs: ["bs-popover"] }, { kind: "ngmodule", type: CollapseModule }, { kind: "directive", type: i5.CollapseDirective, selector: "[collapse]", inputs: ["display", "isAnimated", "collapse"], outputs: ["collapsed", "collapses", "expanded", "expands"], exportAs: ["bs-collapse"] }] }); }
162
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: StaticAssetsModalComponent, deps: [{ token: i1$1.BsModalRef }], target: i0.ɵɵFactoryTarget.Component }); }
163
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: StaticAssetsModalComponent, isStandalone: true, selector: "c8y-static-assets-modal", inputs: { assetType: "assetType", supportedFileExtensions: "supportedFileExtensions", modalTitle: "modalTitle", layout: "layout" }, ngImport: i0, template: "<c8y-modal\n [title]=\"modalTitle\"\n (onDismiss)=\"cancel()\"\n [headerClasses]=\"'dialog-header'\"\n [labels]=\"{ cancel: 'Cancel' }\"\n>\n <ng-container c8y-modal-title>\n <span [c8yIcon]=\"'select-all'\"></span>\n </ng-container>\n <c8y-static-assets-file-list\n (itemSelected)=\"select($event)\"\n [assetType]=\"assetType\"\n [supportedFileExtensions]=\"supportedFileExtensions\"\n [layout]=\"layout\"\n [inModalView]=\"true\"\n ></c8y-static-assets-file-list>\n</c8y-modal>\n", dependencies: [{ kind: "component", type: StaticAssetsFileListComponent, selector: "c8y-static-assets-file-list", inputs: ["inModalView", "assetType", "supportedFileExtensions", "layout"], outputs: ["itemSelected"] }, { kind: "component", type: ModalComponent, selector: "c8y-modal", inputs: ["disabled", "close", "dismiss", "title", "body", "customFooter", "headerClasses", "labels"], outputs: ["onDismiss", "onClose"] }, { kind: "directive", type: IconDirective, selector: "[c8yIcon]", inputs: ["c8yIcon"] }] }); }
62
164
  }
63
165
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: StaticAssetsModalComponent, decorators: [{
64
166
  type: Component,
65
- args: [{ selector: 'c8y-static-assets-modal', imports: [NgFor, NgIf, AsyncPipe, DatePipe, CoreModule, PopoverModule, CollapseModule], standalone: true, template: "<c8y-modal\n [title]=\"modalTitle\"\n (onDismiss)=\"cancel()\"\n [headerClasses]=\"'dialog-header'\"\n [labels]=\"{ cancel: 'Cancel' }\"\n>\n <ng-container c8y-modal-title>\n <span [c8yIcon]=\"'select-all'\"></span>\n </ng-container>\n <ng-container *ngIf=\"files$ | async as assets; else loading\">\n <div class=\"text-center sticky-top separator-bottom bg-component\" style=\"z-index: 1001;\">\n <p *ngIf=\"assets.length\" class=\"m-0 p-16\">\n {{ 'Select from the list below or`first part, followed by upload a new asset`' | translate }}\n <button\n class=\"btn-link\"\n aria-controls=\"collapseUpload\"\n [attr.aria-expanded]=\"isExpanded\"\n (click)=\"isExpanded = !isExpanded\"\n >\n {{ 'upload a new asset' | translate }}\n </button>\n </p>\n <div\n class=\"collapse\"\n id=\"collapseUpload\"\n [isAnimated]=\"true\"\n [collapse]=\"!isExpanded\"\n >\n <div class=\"p-t-24 p-l-24 p-r-24 bg-level-1 separator-top-bottom p-b-32\">\n <c8y-drop-area\n class=\"drop-area-sm m-b-8\"\n [icon]=\"'upload'\"\n [accept]=\"accept\"\n (dropped)=\"addFiles($event)\"\n ></c8y-drop-area>\n <c8y-messages\n [helpMessage]=\"\n 'After uploading, the asset will be visible in the list below.' | translate\n \"\n ></c8y-messages>\n </div>\n </div>\n </div>\n <div *ngIf=\"assets.length\">\n <c8y-list-group\n class=\"m-b-0\"\n *ngIf=\"layout != 'grid'\"\n >\n <c8y-list-item *ngFor=\"let asset of assets\">\n <c8y-list-item-icon icon=\"file\"></c8y-list-item-icon>\n\n <c8y-list-item-body>\n <div class=\"row\">\n <div class=\"col-md-3 col-xs-12 d-flex a-i-center\">\n <div\n class=\"text-truncate\"\n title=\"{{ asset.fileName }}\"\n >\n {{ asset.fileName }}\n </div>\n <button\n class=\"btn-dot m-l-4\"\n [title]=\"'Preview' | translate\"\n [popover]=\"preview\"\n placement=\"end\"\n triggers=\"focus\"\n container=\"body\"\n [adaptivePosition]=\"false\"\n >\n <i c8yIcon=\"eye\"></i>\n </button>\n <ng-template #preview>\n <div class=\"bg-checkered\">\n <img\n class=\"fit-w\"\n [alt]=\"asset.fileName\"\n [src]=\"asset.path\"\n />\n </div>\n </ng-template>\n </div>\n <div class=\"col-md-3 col-xs-12 text-muted\">\n <code class=\"text-10\">{{ asset.type }}</code>\n </div>\n <div class=\"col-md-2 col-xs-12 text-muted\">\n <span class=\"small\">{{ asset.size | bytes }}</span>\n </div>\n <div\n class=\"col-md-2 col-xs-12 text-muted\"\n [title]=\"asset.addedAt | date\"\n >\n <div class=\"icon-flex small\">\n <i\n class=\"m-r-4\"\n c8yIcon=\"calendar\"\n ></i>\n <span>{{ asset.addedAt | date }}</span>\n </div>\n </div>\n <div class=\"col-md-2 col-xs-12 d-flex\">\n <button\n class=\"btn btn-default btn-sm m-l-auto showOnHover\"\n (click)=\"select(asset)\"\n translate\n >\n Select\n </button>\n </div>\n </div>\n </c8y-list-item-body>\n </c8y-list-item>\n </c8y-list-group>\n <div\n class=\"card-group-block interact-grid\"\n *ngIf=\"layout === 'grid'\"\n >\n <button\n class=\"col-md-3 col-sm-4 col-xs-12 card btn-clean interact pointer\"\n *ngFor=\"let asset of assets\"\n (click)=\"select(asset)\"\n >\n <div class=\"card-block\">\n <div class=\"bg-checkered\">\n <img\n class=\"img-responsive m-auto img-square\"\n [alt]=\"asset.fileName\"\n [src]=\"asset.path\"\n />\n </div>\n <p\n class=\"text-medium text-truncate-wrap m-t-8\"\n title=\"{{ asset.fileName }}\"\n >\n {{ asset.fileName }}\n </p>\n <p class=\"m-b-4\">\n <code class=\"text-10\">{{ asset.type }}</code>\n </p>\n <p class=\"small text-muted d-flex a-i-center\">\n {{ asset.size | bytes }}\n <span class=\"m-l-auto\">\n <i\n class=\"m-r-4\"\n c8yIcon=\"calendar\"\n ></i>\n <span>{{ asset.addedAt | date }}</span>\n </span>\n </p>\n </div>\n </button>\n </div>\n </div>\n </ng-container>\n\n <ng-template #loading>\n <div class=\"p-24\">\n <c8y-loading></c8y-loading>\n </div>\n </ng-template>\n</c8y-modal>\n" }]
66
- }], ctorParameters: () => [{ type: i1.BsModalRef }, { type: i2.StaticAssetsService }], propDecorators: { assetType: [{
167
+ args: [{ selector: 'c8y-static-assets-modal', imports: [StaticAssetsFileListComponent, ModalComponent, IconDirective], standalone: true, template: "<c8y-modal\n [title]=\"modalTitle\"\n (onDismiss)=\"cancel()\"\n [headerClasses]=\"'dialog-header'\"\n [labels]=\"{ cancel: 'Cancel' }\"\n>\n <ng-container c8y-modal-title>\n <span [c8yIcon]=\"'select-all'\"></span>\n </ng-container>\n <c8y-static-assets-file-list\n (itemSelected)=\"select($event)\"\n [assetType]=\"assetType\"\n [supportedFileExtensions]=\"supportedFileExtensions\"\n [layout]=\"layout\"\n [inModalView]=\"true\"\n ></c8y-static-assets-file-list>\n</c8y-modal>\n" }]
168
+ }], ctorParameters: () => [{ type: i1$1.BsModalRef }], propDecorators: { assetType: [{
67
169
  type: Input
68
170
  }], supportedFileExtensions: [{
69
171
  type: Input
@@ -77,5 +179,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImpo
77
179
  * Generated bundle index. Do not edit.
78
180
  */
79
181
 
80
- export { StaticAssetsModalComponent };
182
+ export { StaticAssetsFileListComponent, StaticAssetsModalComponent };
81
183
  //# sourceMappingURL=c8y-ngx-components-static-assets-modal.mjs.map