@valtimo/layout 13.32.0 → 13.33.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.
- package/fesm2022/valtimo-layout.mjs +25 -11
- package/fesm2022/valtimo-layout.mjs.map +1 -1
- package/lib/components/widget-block/widget-block.component.d.ts +1 -1
- package/lib/components/widget-block/widget-block.component.d.ts.map +1 -1
- package/lib/components/widget-container/widget-container.component.d.ts +4 -1
- package/lib/components/widget-container/widget-container.component.d.ts.map +1 -1
- package/lib/constants/widget.constants.d.ts +1 -1
- package/lib/constants/widget.constants.d.ts.map +1 -1
- package/lib/services/widget-layout.service.d.ts +4 -0
- package/lib/services/widget-layout.service.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@ import { CommonModule, DOCUMENT, DatePipe } from '@angular/common';
|
|
|
11
11
|
import * as i2$2 from '@ngx-translate/core';
|
|
12
12
|
import { TranslateModule, TranslatePipe } from '@ngx-translate/core';
|
|
13
13
|
import * as i1$1 from '@valtimo/components';
|
|
14
|
-
import { ViewType, CarbonListModule, EllipsisPipe, MdiIconViewerComponent, FormIoModule, CARBON_THEME, CurrentCarbonTheme, InputLabelModule, InputModule as InputModule$1, FormModule, SelectModule, ParagraphModule, DateTimePickerComponent, OverflowMenuComponent, OverflowMenuOptionComponent, runAfterCarbonModalClosed, AutoKeyInputComponent, CARBON_CONSTANTS, ValuePathSelectorPrefix, CarbonMultiInputModule, ConfirmationModalModule, JsonEditorComponent, RemoveClassnamesDirective, ValuePathSelectorComponent, MdiIconSelectorComponent, ValuePathType, MenuRoutingModule, TopbarModule, LeftSidebarModule, RightSidebarModule, PageHeaderModule, AlertModule, PromptModule, MultiInputFormModule, RenderInPageHeaderDirective } from '@valtimo/components';
|
|
14
|
+
import { ViewType, CarbonListModule, EllipsisPipe, MdiIconViewerComponent, WIDGET_ROW_HEIGHT_DEFAULT, FormIoModule, CARBON_THEME, CurrentCarbonTheme, InputLabelModule, InputModule as InputModule$1, FormModule, SelectModule, ParagraphModule, DateTimePickerComponent, OverflowMenuComponent, OverflowMenuOptionComponent, resolveWidgetLayout, runAfterCarbonModalClosed, AutoKeyInputComponent, CARBON_CONSTANTS, ValuePathSelectorPrefix, CarbonMultiInputModule, ConfirmationModalModule, JsonEditorComponent, RemoveClassnamesDirective, ValuePathSelectorComponent, MdiIconSelectorComponent, ValuePathType, MenuRoutingModule, TopbarModule, LeftSidebarModule, RightSidebarModule, PageHeaderModule, AlertModule, PromptModule, MultiInputFormModule, RenderInPageHeaderDirective } from '@valtimo/components';
|
|
15
15
|
import * as i3 from 'carbon-components-angular';
|
|
16
16
|
import { ButtonModule, InputModule, LayerModule, SkeletonModule, PaginationModel, PaginationModule, TilesModule, IconModule, TimePickerModule, MenuButtonModule, ContextMenuModule, LoadingModule, ModalModule, TooltipModule, ComboBoxModule, CheckboxModule, DropdownModule, StructuredListModule, ToggleModule, AccordionModule, ProgressIndicatorModule, TabsModule, ToggletipModule, TagModule, Tab, SelectModule as SelectModule$1, RadioModule, PlaceholderModule } from 'carbon-components-angular';
|
|
17
17
|
import { Subscription, BehaviorSubject, combineLatest, map, tap, switchMap, take, filter as filter$1, Subject, debounceTime, of, startWith, merge, delay } from 'rxjs';
|
|
@@ -922,7 +922,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
922
922
|
*/
|
|
923
923
|
|
|
924
924
|
/*
|
|
925
|
-
* Copyright 2015-
|
|
925
|
+
* Copyright 2015-2026 Ritense BV, the Netherlands.
|
|
926
926
|
*
|
|
927
927
|
* Licensed under EUPL, Version 1.2 (the "License");
|
|
928
928
|
* you may not use this file except in compliance with the License.
|
|
@@ -946,6 +946,9 @@ class WidgetLayoutService {
|
|
|
946
946
|
get amountOfColumns$() {
|
|
947
947
|
return this._containerWidth$.pipe(map(containerWidth => Math.floor(containerWidth / WIDGET_WIDTH_1X)));
|
|
948
948
|
}
|
|
949
|
+
get rowHeightUnit$() {
|
|
950
|
+
return this._rowHeightUnit$.asObservable();
|
|
951
|
+
}
|
|
949
952
|
get _widgets$() {
|
|
950
953
|
return this._widgetsSubject$.pipe(filter$1(widgets => widgets !== null));
|
|
951
954
|
}
|
|
@@ -968,6 +971,8 @@ class WidgetLayoutService {
|
|
|
968
971
|
this._widgetDataLoadedSubject$ = new BehaviorSubject(null);
|
|
969
972
|
this._muuriSubject$ = new BehaviorSubject(null);
|
|
970
973
|
this._triggerMuuriLayout$ = new Subject();
|
|
974
|
+
/** Row-unit height (px) each widget snaps to; depends on the layout algorithm. */
|
|
975
|
+
this._rowHeightUnit$ = new BehaviorSubject(WIDGET_ROW_HEIGHT_DEFAULT);
|
|
971
976
|
this._widgetsWithExternalData$ = new BehaviorSubject([]);
|
|
972
977
|
this._widgetsWithExternalDataReady$ = new BehaviorSubject([]);
|
|
973
978
|
this._subscriptions = new Subscription();
|
|
@@ -998,6 +1003,9 @@ class WidgetLayoutService {
|
|
|
998
1003
|
setContainerWidth(width) {
|
|
999
1004
|
this._containerWidthSubject$.next(width);
|
|
1000
1005
|
}
|
|
1006
|
+
setRowHeightUnit(rowHeightUnit) {
|
|
1007
|
+
this._rowHeightUnit$.next(rowHeightUnit);
|
|
1008
|
+
}
|
|
1001
1009
|
setWidgetDataLoaded(uuid) {
|
|
1002
1010
|
this._widgetDataLoadedSubject$.pipe(take(1)).subscribe(widgetDataLoaded => {
|
|
1003
1011
|
if (!(widgetDataLoaded || []).includes(uuid)) {
|
|
@@ -1015,7 +1023,7 @@ class WidgetLayoutService {
|
|
|
1015
1023
|
}
|
|
1016
1024
|
openMuuriSubscription() {
|
|
1017
1025
|
this._subscriptions.add(combineLatest([this._muuri$, this._triggerMuuriLayout$])
|
|
1018
|
-
.pipe(debounceTime(
|
|
1026
|
+
.pipe(debounceTime(400))
|
|
1019
1027
|
.subscribe(([muuri]) => {
|
|
1020
1028
|
muuri.refreshItems();
|
|
1021
1029
|
muuri.layout();
|
|
@@ -2223,8 +2231,9 @@ class WidgetBlockComponent {
|
|
|
2223
2231
|
this._contentHeight$,
|
|
2224
2232
|
this._viewContainerRef$,
|
|
2225
2233
|
this.widget$,
|
|
2226
|
-
|
|
2227
|
-
|
|
2234
|
+
this.widgetLayoutService.rowHeightUnit$,
|
|
2235
|
+
]).pipe(filter$1(([contentHeight]) => contentHeight !== 0), tap(([contentHeight, viewRef, , rowHeightUnit]) => {
|
|
2236
|
+
const blockHeight = Math.ceil((contentHeight + 16) / rowHeightUnit) * rowHeightUnit;
|
|
2228
2237
|
this.renderer.setStyle(viewRef.element.nativeElement, 'height', `${blockHeight}px`);
|
|
2229
2238
|
this.widgetLayoutService.triggerMuuriLayout();
|
|
2230
2239
|
}));
|
|
@@ -2358,6 +2367,10 @@ class WidgetContainerComponent {
|
|
|
2358
2367
|
this.loadingWidgetConfiguration$.next(false);
|
|
2359
2368
|
this.initLayout();
|
|
2360
2369
|
}
|
|
2370
|
+
set widgetLayout(value) {
|
|
2371
|
+
this._resolvedLayout = resolveWidgetLayout(value);
|
|
2372
|
+
this.widgetLayoutService.setRowHeightUnit(this._resolvedLayout.rowHeightUnit);
|
|
2373
|
+
}
|
|
2361
2374
|
get widgetComponentMap$() {
|
|
2362
2375
|
return this._widgetComponentMap$.pipe(filter(componentMap => componentMap !== null));
|
|
2363
2376
|
}
|
|
@@ -2367,6 +2380,7 @@ class WidgetContainerComponent {
|
|
|
2367
2380
|
constructor(widgetLayoutService) {
|
|
2368
2381
|
this.widgetLayoutService = widgetLayoutService;
|
|
2369
2382
|
this.widgetsWithUuids$ = new BehaviorSubject(null);
|
|
2383
|
+
this._resolvedLayout = resolveWidgetLayout(null);
|
|
2370
2384
|
this._widgetComponentMap$ = new BehaviorSubject(DEFAULT_WIDGET_COMPONENT_MAP);
|
|
2371
2385
|
this.widgetParams = {};
|
|
2372
2386
|
this.loadingWidgetConfiguration$ = new BehaviorSubject(true);
|
|
@@ -2408,15 +2422,13 @@ class WidgetContainerComponent {
|
|
|
2408
2422
|
initMuuri() {
|
|
2409
2423
|
this.widgetLayoutService.loaded$.pipe(take(1), delay(300)).subscribe(() => {
|
|
2410
2424
|
this.widgetLayoutService.setMuuri(new Muuri(this._widgetsContainerRef.nativeElement, {
|
|
2411
|
-
layout:
|
|
2412
|
-
fillGaps: true,
|
|
2413
|
-
},
|
|
2425
|
+
layout: this._resolvedLayout.muuriLayout,
|
|
2414
2426
|
layoutOnResize: false,
|
|
2415
2427
|
}));
|
|
2416
2428
|
});
|
|
2417
2429
|
}
|
|
2418
2430
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: WidgetContainerComponent, deps: [{ token: WidgetLayoutService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2419
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: WidgetContainerComponent, isStandalone: true, selector: "valtimo-widget-container", inputs: { widgets: "widgets", widgetComponentMap: "widgetComponentMap", widgetParams: "widgetParams" }, providers: [WidgetLayoutService], viewQueries: [{ propertyName: "_widgetsContainerRef", first: true, predicate: ["widgetsContainer"], descendants: true }], ngImport: i0, template: "<!--\n ~ Copyright 2015-2025 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container\n *ngIf=\"{\n loadingWidgetConfiguration: loadingWidgetConfiguration$ | async,\n widgets: widgetsWithUuids$ | async,\n loaded: loaded$ | async,\n } as obs\"\n>\n <ng-container\n *ngIf=\"{\n noWidgetsConfigured: obs.widgets && obs.widgets.length === 0,\n } as vars\"\n >\n @if (!obs.loaded && !vars.noWidgetsConfigured) {\n <div class=\"loading-container\">\n <cds-loading></cds-loading>\n </div>\n }\n\n @if (vars.noWidgetsConfigured) {\n <valtimo-no-results\n [title]=\"'widgets.noWidgets' | translate\"\n [description]=\"'widgets.noWidgetsDescription' | translate\"\n illustration=\"valtimo-layout/img/no-widgets.svg\"\n ></valtimo-no-results>\n }\n\n <div [style.visibility]=\"!obs.loaded ? 'hidden' : 'visible'\">\n <div #widgetsContainer class=\"widgets-container\">\n @for (widget of (widgetsWithUuids$ | async) || []; track widget.uuid) {\n <valtimo-widget-block\n [widget]=\"widget\"\n [widgetComponentMap]=\"widgetComponentMap$ | async\"\n [widgetParams]=\"widgetParams\"\n ></valtimo-widget-block>\n }\n </div>\n </div>\n </ng-container>\n</ng-container>\n", styles: [".widgets-container{position:relative;width:calc(100% + 16px);margin-left:-8px;margin-top:-8px;padding-bottom:32px;box-sizing:content-box}.loading-container{display:flex;justify-content:center;padding:16px 0}\n/*!\n * Copyright 2015-2025 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }, { kind: "component", type: WidgetBlockComponent, selector: "valtimo-widget-block", inputs: ["widget", "widgetComponentMap", "widgetParams"] }, { kind: "ngmodule", type: LoadingModule }, { kind: "component", type: i3.Loading, selector: "cds-loading, ibm-loading", inputs: ["title", "isActive", "size", "overlay"] }, { kind: "ngmodule", type: CarbonListModule }, { kind: "component", type: i1$1.CarbonNoResultsComponent, selector: "valtimo-no-results", inputs: ["action", "description", "illustration", "title", "smallPadding", "collapseVertically", "alwaysRenderVertically"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2431
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: WidgetContainerComponent, isStandalone: true, selector: "valtimo-widget-container", inputs: { widgets: "widgets", widgetLayout: "widgetLayout", widgetComponentMap: "widgetComponentMap", widgetParams: "widgetParams" }, providers: [WidgetLayoutService], viewQueries: [{ propertyName: "_widgetsContainerRef", first: true, predicate: ["widgetsContainer"], descendants: true }], ngImport: i0, template: "<!--\n ~ Copyright 2015-2025 Ritense BV, the Netherlands.\n ~\n ~ Licensed under EUPL, Version 1.2 (the \"License\");\n ~ you may not use this file except in compliance with the License.\n ~ You may obtain a copy of the License at\n ~\n ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n ~\n ~ Unless required by applicable law or agreed to in writing, software\n ~ distributed under the License is distributed on an \"AS IS\" basis,\n ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n ~ See the License for the specific language governing permissions and\n ~ limitations under the License.\n -->\n\n<ng-container\n *ngIf=\"{\n loadingWidgetConfiguration: loadingWidgetConfiguration$ | async,\n widgets: widgetsWithUuids$ | async,\n loaded: loaded$ | async,\n } as obs\"\n>\n <ng-container\n *ngIf=\"{\n noWidgetsConfigured: obs.widgets && obs.widgets.length === 0,\n } as vars\"\n >\n @if (!obs.loaded && !vars.noWidgetsConfigured) {\n <div class=\"loading-container\">\n <cds-loading></cds-loading>\n </div>\n }\n\n @if (vars.noWidgetsConfigured) {\n <valtimo-no-results\n [title]=\"'widgets.noWidgets' | translate\"\n [description]=\"'widgets.noWidgetsDescription' | translate\"\n illustration=\"valtimo-layout/img/no-widgets.svg\"\n ></valtimo-no-results>\n }\n\n <div [style.visibility]=\"!obs.loaded ? 'hidden' : 'visible'\">\n <div #widgetsContainer class=\"widgets-container\">\n @for (widget of (widgetsWithUuids$ | async) || []; track widget.uuid) {\n <valtimo-widget-block\n [widget]=\"widget\"\n [widgetComponentMap]=\"widgetComponentMap$ | async\"\n [widgetParams]=\"widgetParams\"\n ></valtimo-widget-block>\n }\n </div>\n </div>\n </ng-container>\n</ng-container>\n", styles: [".widgets-container{position:relative;width:calc(100% + 16px);margin-left:-8px;margin-top:-8px;padding-bottom:32px;box-sizing:content-box}.loading-container{display:flex;justify-content:center;padding:16px 0}\n/*!\n * Copyright 2015-2025 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }, { kind: "component", type: WidgetBlockComponent, selector: "valtimo-widget-block", inputs: ["widget", "widgetComponentMap", "widgetParams"] }, { kind: "ngmodule", type: LoadingModule }, { kind: "component", type: i3.Loading, selector: "cds-loading, ibm-loading", inputs: ["title", "isActive", "size", "overlay"] }, { kind: "ngmodule", type: CarbonListModule }, { kind: "component", type: i1$1.CarbonNoResultsComponent, selector: "valtimo-no-results", inputs: ["action", "description", "illustration", "title", "smallPadding", "collapseVertically", "alwaysRenderVertically"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
2420
2432
|
}
|
|
2421
2433
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: WidgetContainerComponent, decorators: [{
|
|
2422
2434
|
type: Component,
|
|
@@ -2426,6 +2438,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
2426
2438
|
args: ['widgetsContainer']
|
|
2427
2439
|
}], widgets: [{
|
|
2428
2440
|
type: Input
|
|
2441
|
+
}], widgetLayout: [{
|
|
2442
|
+
type: Input
|
|
2429
2443
|
}], widgetComponentMap: [{
|
|
2430
2444
|
type: Input
|
|
2431
2445
|
}], widgetParams: [{
|
|
@@ -4739,7 +4753,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
4739
4753
|
*/
|
|
4740
4754
|
|
|
4741
4755
|
/*
|
|
4742
|
-
* Copyright 2015-
|
|
4756
|
+
* Copyright 2015-2026 Ritense BV, the Netherlands.
|
|
4743
4757
|
*
|
|
4744
4758
|
* Licensed under EUPL, Version 1.2 (the "License");
|
|
4745
4759
|
* you may not use this file except in compliance with the License.
|
|
@@ -4754,7 +4768,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
4754
4768
|
* limitations under the License.
|
|
4755
4769
|
*/
|
|
4756
4770
|
const WIDGET_WIDTH_1X = 320;
|
|
4757
|
-
const WIDGET_HEIGHT_1X =
|
|
4771
|
+
const WIDGET_HEIGHT_1X = 92;
|
|
4758
4772
|
const DEFAULT_WIDGET_COMPONENT_MAP = {
|
|
4759
4773
|
[WidgetType.FORMIO]: WidgetFormioComponent,
|
|
4760
4774
|
[WidgetType.CUSTOM]: WidgetCustomComponent,
|