@gooddata/sdk-ui-dashboard 10.19.0-alpha.16 → 10.19.0-alpha.18
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/esm/__version.d.ts +1 -1
- package/esm/__version.js +1 -1
- package/esm/_staging/dashboard/flexibleLayout/builder/interfaces.d.ts +81 -0
- package/esm/_staging/dashboard/flexibleLayout/builder/interfaces.d.ts.map +1 -1
- package/esm/_staging/dashboard/flexibleLayout/builder/item.d.ts +4 -3
- package/esm/_staging/dashboard/flexibleLayout/builder/item.d.ts.map +1 -1
- package/esm/_staging/dashboard/flexibleLayout/builder/item.js +12 -4
- package/esm/_staging/dashboard/flexibleLayout/builder/item.js.map +1 -1
- package/esm/_staging/dashboard/flexibleLayout/builder/layout.d.ts +14 -10
- package/esm/_staging/dashboard/flexibleLayout/builder/layout.d.ts.map +1 -1
- package/esm/_staging/dashboard/flexibleLayout/builder/layout.js +160 -50
- package/esm/_staging/dashboard/flexibleLayout/builder/layout.js.map +1 -1
- package/esm/_staging/dashboard/flexibleLayout/builder/section.d.ts +0 -1
- package/esm/_staging/dashboard/flexibleLayout/builder/section.d.ts.map +1 -1
- package/esm/_staging/dashboard/flexibleLayout/builder/section.js +1 -5
- package/esm/_staging/dashboard/flexibleLayout/builder/section.js.map +1 -1
- package/esm/_staging/dashboard/flexibleLayout/facade/interfaces.d.ts +2 -1
- package/esm/_staging/dashboard/flexibleLayout/facade/interfaces.d.ts.map +1 -1
- package/esm/_staging/dashboard/flexibleLayout/facade/layout.d.ts +2 -1
- package/esm/_staging/dashboard/flexibleLayout/facade/layout.d.ts.map +1 -1
- package/esm/_staging/dashboard/flexibleLayout/facade/layout.js +18 -2
- package/esm/_staging/dashboard/flexibleLayout/facade/layout.js.map +1 -1
- package/esm/model/events/index.d.ts +4 -4
- package/esm/model/events/index.d.ts.map +1 -1
- package/esm/model/events/index.js +1 -1
- package/esm/model/events/index.js.map +1 -1
- package/esm/model/react/useDashboardCommand.d.ts +1 -1
- package/esm/model/react/useDashboardCommand.d.ts.map +1 -1
- package/esm/model/react/useDashboardCommandProcessing.d.ts +4 -0
- package/esm/model/react/useDashboardCommandProcessing.d.ts.map +1 -1
- package/esm/plugins/customizationApis/fluidLayoutCustomizer.d.ts +5 -2
- package/esm/plugins/customizationApis/fluidLayoutCustomizer.d.ts.map +1 -1
- package/esm/plugins/customizationApis/fluidLayoutCustomizer.js +40 -19
- package/esm/plugins/customizationApis/fluidLayoutCustomizer.js.map +1 -1
- package/esm/plugins/customizer.d.ts +34 -1
- package/esm/plugins/customizer.d.ts.map +1 -1
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutViewSectionHeaderRenderer.js +2 -2
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/DashboardLayoutViewSectionHeaderRenderer.js.map +1 -1
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/EditableHeader/SectionHeaderEditable.js +2 -2
- package/esm/presentation/flexibleLayout/DefaultDashboardLayoutRenderer/EditableHeader/SectionHeaderEditable.js.map +1 -1
- package/esm/presentation/localization/bundles/en-US.json +5 -0
- package/esm/presentation/scheduledEmail/DefaultScheduledEmailDialog/components/RecipientsSelect/RecipientsSelect.d.ts.map +1 -1
- package/esm/presentation/scheduledEmail/DefaultScheduledEmailDialog/components/RecipientsSelect/RecipientsSelect.js +5 -5
- package/esm/presentation/scheduledEmail/DefaultScheduledEmailDialog/components/RecipientsSelect/RecipientsSelect.js.map +1 -1
- package/esm/presentation/scheduledEmail/DefaultScheduledEmailDialog/components/RecipientsSelect/RecipientsSelectRenderer.d.ts.map +1 -1
- package/esm/presentation/scheduledEmail/DefaultScheduledEmailDialog/components/RecipientsSelect/RecipientsSelectRenderer.js +18 -3
- package/esm/presentation/scheduledEmail/DefaultScheduledEmailDialog/components/RecipientsSelect/RecipientsSelectRenderer.js.map +1 -1
- package/esm/presentation/scheduledEmail/DefaultScheduledEmailDialog/hooks/useEditScheduledEmail.d.ts.map +1 -1
- package/esm/presentation/scheduledEmail/DefaultScheduledEmailDialog/hooks/useEditScheduledEmail.js +3 -1
- package/esm/presentation/scheduledEmail/DefaultScheduledEmailDialog/hooks/useEditScheduledEmail.js.map +1 -1
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/hooks/useEditAlert.d.ts.map +1 -1
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/hooks/useEditAlert.js +8 -2
- package/esm/presentation/widget/insight/configuration/InsightAlertConfig/hooks/useEditAlert.js.map +1 -1
- package/esm/sdk-ui-dashboard.d.ts +114 -2
- package/package.json +15 -15
- package/styles/css/dashboard.css +1 -0
- package/styles/css/dashboard.css.map +1 -1
- package/styles/css/main.css +1 -0
- package/styles/css/main.css.map +1 -1
- package/styles/css/scheduled_mail_recipients.css +1 -0
- package/styles/css/scheduled_mail_recipients.css.map +1 -1
- package/styles/scss/scheduled_mail_recipients.scss +1 -0
package/esm/__version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const LIB_VERSION = "10.19.0-alpha.
|
|
1
|
+
export declare const LIB_VERSION = "10.19.0-alpha.18";
|
|
2
2
|
//# sourceMappingURL=__version.d.ts.map
|
package/esm/__version.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ObjRef, IDashboardLayout, IDashboardWidget, IDashboardLayoutSection, IDashboardLayoutSectionHeader, IDashboardLayoutSize, IDashboardLayoutSizeByScreenSize, IDashboardLayoutItem } from "@gooddata/sdk-model";
|
|
2
2
|
import { InsightWidgetBuilder, KpiWidgetBuilder, ValueOrUpdateCallback } from "@gooddata/sdk-backend-base";
|
|
3
3
|
import { IDashboardLayoutFacade, IDashboardLayoutItemFacade, IDashboardLayoutItemsFacade, IDashboardLayoutSectionFacade, IDashboardLayoutSectionsFacade } from "../facade/interfaces.js";
|
|
4
|
+
import { ILayoutItemPath, ILayoutSectionPath } from "../../../../types.js";
|
|
4
5
|
/**
|
|
5
6
|
* Represents a query to select a subset of layout sections.
|
|
6
7
|
*
|
|
@@ -125,6 +126,14 @@ export interface IDashboardLayoutItemBuilder<TWidget = IDashboardWidget> {
|
|
|
125
126
|
* @param modify - callback to modify the widget
|
|
126
127
|
*/
|
|
127
128
|
modifyKpiWidget(modify: (builder: KpiWidgetBuilder) => KpiWidgetBuilder): this;
|
|
129
|
+
/**
|
|
130
|
+
* Modify existing layout widget in this item.
|
|
131
|
+
*
|
|
132
|
+
* Note: When the item doesn't contain a layout widget, the error is thrown.
|
|
133
|
+
*
|
|
134
|
+
* @param modify - callback to modify the widget
|
|
135
|
+
*/
|
|
136
|
+
modifyLayoutWidget(modify: (builder: IDashboardLayoutBuilder<TWidget>) => IDashboardLayoutBuilder<TWidget>, dashboardLayoutBuilderConstructor: (layout: IDashboardLayout<TWidget>, layoutPath?: ILayoutItemPath) => IDashboardLayoutBuilder<TWidget>): this;
|
|
128
137
|
}
|
|
129
138
|
/**
|
|
130
139
|
* Builder for convenient creation or transformation of any {@link @gooddata/sdk-backend-spi#IDashboardLayoutRow}.
|
|
@@ -309,6 +318,22 @@ export interface IDashboardLayoutBuilder<TWidget = IDashboardWidget> {
|
|
|
309
318
|
* @returns this
|
|
310
319
|
*/
|
|
311
320
|
createSection(create?: (builder: IDashboardLayoutSectionBuilder<TWidget>) => IDashboardLayoutSectionBuilder<TWidget>, index?: number): this;
|
|
321
|
+
/**
|
|
322
|
+
* Creates a new section and adds it to a layout.
|
|
323
|
+
*
|
|
324
|
+
* Note:
|
|
325
|
+
* - This operation is non-invasive, it cannot replace an existing section.
|
|
326
|
+
* This means that if there is already an existing section on the specified index,
|
|
327
|
+
* this and all subsequent sections will be moved after the added section.
|
|
328
|
+
* If you want to replace an existing section use .modifySection() or .modifySections() method instead.
|
|
329
|
+
*
|
|
330
|
+
* - When no create callback is provided, an empty section is added
|
|
331
|
+
*
|
|
332
|
+
* @param create - callback to create the section
|
|
333
|
+
* @param sectionPath - path in layout where to place the section
|
|
334
|
+
* @returns this
|
|
335
|
+
*/
|
|
336
|
+
createSection(create?: (builder: IDashboardLayoutSectionBuilder<TWidget>) => IDashboardLayoutSectionBuilder<TWidget>, sectionPath?: ILayoutSectionPath): this;
|
|
312
337
|
/**
|
|
313
338
|
* Adds a new section to a layout.
|
|
314
339
|
*
|
|
@@ -325,6 +350,20 @@ export interface IDashboardLayoutBuilder<TWidget = IDashboardWidget> {
|
|
|
325
350
|
* @returns this
|
|
326
351
|
*/
|
|
327
352
|
addSection(section: IDashboardLayoutSection<TWidget>, index?: number): this;
|
|
353
|
+
/**
|
|
354
|
+
* Adds a new section to a layout.
|
|
355
|
+
*
|
|
356
|
+
* Note:
|
|
357
|
+
* - This operation is non-invasive, it cannot replace an existing section.
|
|
358
|
+
* This means that if there is already an existing section on the specified index,
|
|
359
|
+
* this and all subsequent sections will be moved after the added section.
|
|
360
|
+
* If you want to replace an existing section use .modifySection() or .modifySections() method instead.
|
|
361
|
+
*
|
|
362
|
+
* @param section - section to add
|
|
363
|
+
* @param sectionPath - path where to place the section
|
|
364
|
+
* @returns this
|
|
365
|
+
*/
|
|
366
|
+
addSection(section: IDashboardLayoutSection<TWidget>, sectionPath: ILayoutSectionPath): this;
|
|
328
367
|
/**
|
|
329
368
|
* Modify section at a specified index.
|
|
330
369
|
*
|
|
@@ -338,6 +377,19 @@ export interface IDashboardLayoutBuilder<TWidget = IDashboardWidget> {
|
|
|
338
377
|
* @returns this
|
|
339
378
|
*/
|
|
340
379
|
modifySection(index: number, modify: DashboardLayoutSectionModifications<TWidget>): this;
|
|
380
|
+
/**
|
|
381
|
+
* Modify section at a specified path.
|
|
382
|
+
*
|
|
383
|
+
* Note:
|
|
384
|
+
* - If the section does not exist at the specified index, the error is thrown.
|
|
385
|
+
* Do this only when you are sure about the section index, or use .modifySections() method instead,
|
|
386
|
+
* which allows you to select the sections according to your predicate and does nothing if it is not met.
|
|
387
|
+
*
|
|
388
|
+
* @param sectionPath - section path
|
|
389
|
+
* @param modify - callback to modify the section
|
|
390
|
+
* @returns this
|
|
391
|
+
*/
|
|
392
|
+
modifySection(sectionPath: ILayoutSectionPath, modify: DashboardLayoutSectionModifications<TWidget>): this;
|
|
341
393
|
/**
|
|
342
394
|
* Remove the section at a specified index.
|
|
343
395
|
*
|
|
@@ -350,6 +402,18 @@ export interface IDashboardLayoutBuilder<TWidget = IDashboardWidget> {
|
|
|
350
402
|
* @returns this
|
|
351
403
|
*/
|
|
352
404
|
removeSection(index: number): this;
|
|
405
|
+
/**
|
|
406
|
+
* Remove the section at a specified path.
|
|
407
|
+
*
|
|
408
|
+
* Note:
|
|
409
|
+
* - If the section does not exist at the specified index, the error is thrown.
|
|
410
|
+
* Do this only when you are sure about the section index, or use .removeSections() method instead,
|
|
411
|
+
* which allows you to select the sections according to your predicate and does nothing if it is not met.
|
|
412
|
+
*
|
|
413
|
+
* @param sectionPath - the path of the section to remove
|
|
414
|
+
* @returns this
|
|
415
|
+
*/
|
|
416
|
+
removeSection(sectionPath: ILayoutSectionPath): this;
|
|
353
417
|
/**
|
|
354
418
|
* Move section from a specified index to a target index.
|
|
355
419
|
*
|
|
@@ -366,11 +430,26 @@ export interface IDashboardLayoutBuilder<TWidget = IDashboardWidget> {
|
|
|
366
430
|
* @returns this
|
|
367
431
|
*/
|
|
368
432
|
moveSection(fromIndex: number, toIndex: number): this;
|
|
433
|
+
/**
|
|
434
|
+
* Move section from a specified path to a target path.
|
|
435
|
+
*
|
|
436
|
+
* Note:
|
|
437
|
+
* - If the section does not exist at the specified path, the error is thrown.
|
|
438
|
+
* - This operation is non-invasive, it cannot replace an existing section.
|
|
439
|
+
* This means that if there is already an existing section at the target path,
|
|
440
|
+
* this and all subsequent sections will be moved after the added section.
|
|
441
|
+
*
|
|
442
|
+
* @param fromPath - the path of the section to move
|
|
443
|
+
* @param toPath - the target path where the section will be moved
|
|
444
|
+
* @returns this
|
|
445
|
+
*/
|
|
446
|
+
moveSection(fromPath: ILayoutSectionPath, toPath: ILayoutSectionPath): this;
|
|
369
447
|
/**
|
|
370
448
|
* Perform modifications for the selected section(s).
|
|
371
449
|
* This is useful to perform a set of transformations for sections selected by any predicate.
|
|
372
450
|
* Usually, you want to use .filter() and or .find() for the selector,
|
|
373
451
|
* but it's really flexible and you can select any subset of the sections.
|
|
452
|
+
* Works only in root of this layout. Any nested layouts are not affected.
|
|
374
453
|
*
|
|
375
454
|
* Note:
|
|
376
455
|
* - When no selector is provided, all sections are selected by default.
|
|
@@ -387,6 +466,7 @@ export interface IDashboardLayoutBuilder<TWidget = IDashboardWidget> {
|
|
|
387
466
|
* This is useful to remove sections selected by any predicate.
|
|
388
467
|
* Usually, you want to use .filter() and or .find() for the selector,
|
|
389
468
|
* but it's really flexible and you can select any subset of the sections.
|
|
469
|
+
* Works only in root of this layout. Any nested layouts are not affected.
|
|
390
470
|
*
|
|
391
471
|
* Note:
|
|
392
472
|
* - When no selector is provided, all sections are selected by default (and therefore removed).
|
|
@@ -399,6 +479,7 @@ export interface IDashboardLayoutBuilder<TWidget = IDashboardWidget> {
|
|
|
399
479
|
removeSections(selector?: DashboardLayoutSectionsSelector<TWidget>): this;
|
|
400
480
|
/**
|
|
401
481
|
* Remove all empty sections.
|
|
482
|
+
* Works only in root of this layout. Any nested layouts are not affected.
|
|
402
483
|
*
|
|
403
484
|
* @returns this
|
|
404
485
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../../src/_staging/dashboard/flexibleLayout/builder/interfaces.ts"],"names":[],"mappings":"AACA,OAAO,EACH,MAAM,EACN,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACvB,6BAA6B,EAC7B,oBAAoB,EACpB,gCAAgC,EAChC,oBAAoB,EACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAC3G,OAAO,EACH,sBAAsB,EACtB,0BAA0B,EAC1B,2BAA2B,EAC3B,6BAA6B,EAC7B,8BAA8B,EACjC,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../../src/_staging/dashboard/flexibleLayout/builder/interfaces.ts"],"names":[],"mappings":"AACA,OAAO,EACH,MAAM,EACN,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACvB,6BAA6B,EAC7B,oBAAoB,EACpB,gCAAgC,EAChC,oBAAoB,EACvB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAC3G,OAAO,EACH,sBAAsB,EACtB,0BAA0B,EAC1B,2BAA2B,EAC3B,6BAA6B,EAC7B,8BAA8B,EACjC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE3E;;;;;;GAMG;AACH,MAAM,MAAM,+BAA+B,CAAC,OAAO,GAAG,gBAAgB,IAAI,CACtE,cAAc,EAAE,8BAA8B,CAAC,OAAO,CAAC,KACtD,6BAA6B,CAAC,OAAO,CAAC,EAAE,GAAG,6BAA6B,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC;AAEnG;;;;;;;GAOG;AACH,MAAM,MAAM,mCAAmC,CAAC,OAAO,GAAG,gBAAgB,IAAI,CAC1E,cAAc,EAAE,8BAA8B,CAAC,OAAO,CAAC,EACvD,aAAa,EAAE,6BAA6B,CAAC,OAAO,CAAC,KACpD,8BAA8B,CAAC,OAAO,CAAC,CAAC;AAE7C;;;;;;GAMG;AACH,MAAM,MAAM,4BAA4B,CAAC,OAAO,GAAG,gBAAgB,IAAI,CACnE,WAAW,EAAE,2BAA2B,CAAC,OAAO,CAAC,KAChD,0BAA0B,CAAC,OAAO,CAAC,EAAE,GAAG,0BAA0B,CAAC,OAAO,CAAC,GAAG,SAAS,CAAC;AAE7F;;;;;;;GAOG;AAC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,IAAI,CAAC;IAE1E;;;;;OAKG;IACH,mBAAmB,IAAI,IAAI,CAAC;IAE5B;;;;;;OAMG;IACH,SAAS,CAAC,qBAAqB,EAAE,qBAAqB,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAEzF;;;;OAIG;IACH,MAAM,IAAI,sBAAsB,CAAC,OAAO,CAAC,CAAC;IAE1C;;;;;;OAMG;IACH,MAAM,CAAC,aAAa,EAAE,4BAA4B,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;IAEnE;;;;OAIG;IACH,KAAK,IAAI,gBAAgB,CAAC,OAAO,CAAC,CAAC;CACtC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { DashboardLayoutItemModifications, IDashboardLayoutItemBuilder, IDashboardLayoutSectionBuilder } from "./interfaces.js";
|
|
1
|
+
import { DashboardLayoutItemModifications, IDashboardLayoutItemBuilder, IDashboardLayoutSectionBuilder, IDashboardLayoutBuilder } from "./interfaces.js";
|
|
2
2
|
import { IDashboardLayoutItemFacade } from "../facade/interfaces.js";
|
|
3
3
|
import { InsightWidgetBuilder, KpiWidgetBuilder, ValueOrUpdateCallback } from "@gooddata/sdk-backend-base";
|
|
4
|
-
import { ObjRef, IDashboardLayoutSection, IDashboardLayoutSizeByScreenSize, IDashboardLayoutItem } from "@gooddata/sdk-model";
|
|
4
|
+
import { ObjRef, IDashboardLayoutSection, IDashboardLayoutSizeByScreenSize, IDashboardLayoutItem, IDashboardLayout } from "@gooddata/sdk-model";
|
|
5
|
+
import { ILayoutItemPath } from "../../../../types.js";
|
|
5
6
|
/**
|
|
6
|
-
* TODO LX-603: rewrite to support nested layouts
|
|
7
7
|
* @alpha
|
|
8
8
|
*/
|
|
9
9
|
export declare class DashboardLayoutItemBuilder<TWidget> implements IDashboardLayoutItemBuilder<TWidget> {
|
|
@@ -28,5 +28,6 @@ export declare class DashboardLayoutItemBuilder<TWidget> implements IDashboardLa
|
|
|
28
28
|
modifyInsightWidget(modify: (builder: InsightWidgetBuilder) => InsightWidgetBuilder): this;
|
|
29
29
|
newKpiWidget(measure: ObjRef, create?: (builder: KpiWidgetBuilder) => KpiWidgetBuilder): this;
|
|
30
30
|
modifyKpiWidget(modify: (builder: KpiWidgetBuilder) => KpiWidgetBuilder): this;
|
|
31
|
+
modifyLayoutWidget(modify: (builder: IDashboardLayoutBuilder<TWidget>) => IDashboardLayoutBuilder<TWidget>, dashboardLayoutBuilderConstructor: (layout: IDashboardLayout<TWidget>, layoutPath?: ILayoutItemPath) => IDashboardLayoutBuilder<TWidget>): this;
|
|
31
32
|
}
|
|
32
33
|
//# sourceMappingURL=item.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item.d.ts","sourceRoot":"","sources":["../../../../../src/_staging/dashboard/flexibleLayout/builder/item.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,gCAAgC,EAChC,2BAA2B,EAC3B,8BAA8B,
|
|
1
|
+
{"version":3,"file":"item.d.ts","sourceRoot":"","sources":["../../../../../src/_staging/dashboard/flexibleLayout/builder/item.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,gCAAgC,EAChC,2BAA2B,EAC3B,8BAA8B,EAC9B,uBAAuB,EAC1B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EACH,oBAAoB,EACpB,gBAAgB,EAEhB,qBAAqB,EACxB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACH,MAAM,EAKN,uBAAuB,EACvB,gCAAgC,EAChC,oBAAoB,EAGpB,gBAAgB,EACnB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD;;GAEG;AACH,qBAAa,0BAA0B,CAAC,OAAO,CAAE,YAAW,2BAA2B,CAAC,OAAO,CAAC;IAExF,SAAS,CAAC,UAAU,EAAE,CAClB,qBAAqB,EAAE,qBAAqB,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EAAE,gBAAgB,KAAK,gBAAgB,GAAG,IAAI;IAW9E,kBAAkB,CACrB,MAAM,EAAE,CAAC,OAAO,EAAE,uBAAuB,CAAC,OAAO,CAAC,KAAK,uBAAuB,CAAC,OAAO,CAAC,EACvF,iCAAiC,EAAE,CAC/B,MAAM,EAAE,gBAAgB,CAAC,OAAO,CAAC,EACjC,UAAU,CAAC,EAAE,eAAe,KAC3B,uBAAuB,CAAC,OAAO,CAAC,GACtC,IAAI;CAQV"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
// (C) 2019-
|
|
1
|
+
// (C) 2019-2025 GoodData Corporation
|
|
2
2
|
import { invariant } from "ts-invariant";
|
|
3
3
|
import { InsightWidgetBuilder, KpiWidgetBuilder, resolveValueOrUpdateCallback, } from "@gooddata/sdk-backend-base";
|
|
4
|
-
import { isKpiWidgetDefinition, isKpiWidget, isInsightWidgetDefinition, isInsightWidget, isDashboardLayoutItem, } from "@gooddata/sdk-model";
|
|
4
|
+
import { isKpiWidgetDefinition, isKpiWidget, isInsightWidgetDefinition, isInsightWidget, isDashboardLayoutItem, isDashboardLayout, } from "@gooddata/sdk-model";
|
|
5
5
|
import identity from "lodash/identity.js";
|
|
6
6
|
/**
|
|
7
|
-
* TODO LX-603: rewrite to support nested layouts
|
|
8
7
|
* @alpha
|
|
9
8
|
*/
|
|
10
9
|
export class DashboardLayoutItemBuilder {
|
|
@@ -80,7 +79,16 @@ export class DashboardLayoutItemBuilder {
|
|
|
80
79
|
modifyKpiWidget(modify) {
|
|
81
80
|
const content = this.facade().widget();
|
|
82
81
|
invariant(isKpiWidgetDefinition(content) || isKpiWidget(content), "Content of the item is not a kpi widget.");
|
|
83
|
-
|
|
82
|
+
const builder = KpiWidgetBuilder.for(content);
|
|
83
|
+
this.widget(modify(builder).build());
|
|
84
|
+
return this;
|
|
85
|
+
}
|
|
86
|
+
modifyLayoutWidget(modify, dashboardLayoutBuilderConstructor) {
|
|
87
|
+
const content = this.facade().widget();
|
|
88
|
+
invariant(isDashboardLayout(content), "Content of the item is not a layout widget.");
|
|
89
|
+
const itemPath = this.getItemFacade().index();
|
|
90
|
+
const builder = dashboardLayoutBuilderConstructor(content, itemPath);
|
|
91
|
+
this.widget(modify(builder).build());
|
|
84
92
|
return this;
|
|
85
93
|
}
|
|
86
94
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item.js","sourceRoot":"","sources":["../../../../../src/_staging/dashboard/flexibleLayout/builder/item.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"item.js","sourceRoot":"","sources":["../../../../../src/_staging/dashboard/flexibleLayout/builder/item.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAQzC,OAAO,EACH,oBAAoB,EACpB,gBAAgB,EAChB,4BAA4B,GAE/B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEH,qBAAqB,EACrB,WAAW,EACX,yBAAyB,EACzB,eAAe,EAIf,qBAAqB,EACrB,iBAAiB,GAEpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,QAAQ,MAAM,oBAAoB,CAAC;AAG1C;;GAEG;AACH,MAAM,OAAO,0BAA0B;IAErB;IAGA;IACA;IALd,YACc,UAED,EACC,aAAwD,EACxD,SAAiB;QAJjB,eAAU,GAAV,UAAU,CAEX;QACC,kBAAa,GAAb,aAAa,CAA2C;QACxD,cAAS,GAAT,SAAS,CAAQ;IAC5B,CAAC;IAEJ;;;;;OAKG;IACI,MAAM,CAAC,GAAG,CACb,cAAuD,EACvD,SAAiB;QAEjB,SAAS,CACL,qBAAqB,CAAU,cAAc,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,CAAC,EAC9E,+CAA+C,SAAS,IAAI,cAAc;aACrE,MAAM,EAAE;aACR,IAAI,CAAC,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AC,KAAK,EAAwB,CAAC,CAAC;QAC3D,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,kBAAkB,CACrB,MAAuF,EACvF,iCAGqC;QAErC,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,CAAC;QACvC,SAAS,CAAC,iBAAiB,CAAU,OAAO,CAAC,EAAE,6CAA6C,CAAC,CAAC;QAC9F,MAAM,QAAQ,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,CAAC;QAC9C,MAAM,OAAO,GAAG,iCAAiC,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACrE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAwB,CAAC,CAAC;QAC3D,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { IDashboardLayout, IDashboardLayoutSection, IDashboardLayoutSize } from "@gooddata/sdk-model";
|
|
2
|
-
import { DashboardLayoutModifications, DashboardLayoutSectionModifications, DashboardLayoutSectionsSelector, IDashboardLayoutBuilder } from "./interfaces.js";
|
|
2
|
+
import { DashboardLayoutModifications, DashboardLayoutSectionModifications, DashboardLayoutSectionsSelector, IDashboardLayoutBuilder, IDashboardLayoutSectionBuilder } from "./interfaces.js";
|
|
3
3
|
import { IDashboardLayoutFacade } from "../facade/interfaces.js";
|
|
4
4
|
import { ValueOrUpdateCallback } from "@gooddata/sdk-backend-base";
|
|
5
|
-
import { ILayoutItemPath } from "../../../../types.js";
|
|
5
|
+
import { ILayoutItemPath, ILayoutSectionPath } from "../../../../types.js";
|
|
6
6
|
/**
|
|
7
|
-
* TODO LX-603: rewrite to support nested layouts
|
|
8
7
|
* @alpha
|
|
9
8
|
*/
|
|
10
9
|
export declare class DashboardLayoutBuilder<TWidget> implements IDashboardLayoutBuilder<TWidget> {
|
|
@@ -16,19 +15,24 @@ export declare class DashboardLayoutBuilder<TWidget> implements IDashboardLayout
|
|
|
16
15
|
*
|
|
17
16
|
* @param layout - layout to modify
|
|
18
17
|
*/
|
|
19
|
-
static for<TWidget>(layout: IDashboardLayout<TWidget>, layoutPath?: ILayoutItemPath):
|
|
18
|
+
static for<TWidget>(layout: IDashboardLayout<TWidget>, layoutPath?: ILayoutItemPath): DashboardLayoutBuilder<TWidget>;
|
|
20
19
|
/**
|
|
21
20
|
* Creates an instance of DashboardLayoutBuilder with empty layout.
|
|
22
21
|
*
|
|
23
22
|
* @param layoutPath - layout path in case of nested layout
|
|
24
23
|
*/
|
|
25
|
-
static forNewLayout<TWidget>(layoutPath
|
|
24
|
+
static forNewLayout<TWidget>(layoutPath?: ILayoutItemPath): IDashboardLayoutBuilder<TWidget>;
|
|
26
25
|
size(valueOrUpdateCallback: ValueOrUpdateCallback<IDashboardLayoutSize | undefined>): this;
|
|
27
|
-
createSection(create?:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
26
|
+
createSection(create?: (builder: IDashboardLayoutSectionBuilder<TWidget>) => IDashboardLayoutSectionBuilder<TWidget>, indexOrPath?: number | ILayoutSectionPath): this;
|
|
27
|
+
private createSectionByPath;
|
|
28
|
+
addSection(section: IDashboardLayoutSection<TWidget>, indexOrPath: number | ILayoutSectionPath | undefined): this;
|
|
29
|
+
private addSectionByPath;
|
|
30
|
+
modifySection(indexOrPath: number | ILayoutSectionPath, modify: DashboardLayoutSectionModifications<TWidget>): this;
|
|
31
|
+
private modifySectionByPath;
|
|
32
|
+
removeSection(indexOrPath: number | ILayoutSectionPath): this;
|
|
33
|
+
private removeSectionByPath;
|
|
34
|
+
moveSection(fromIndexOrPath: number | ILayoutSectionPath, toIndexOrPath: number | ILayoutSectionPath): this;
|
|
35
|
+
private moveSectionByPath;
|
|
32
36
|
removeSections(selector?: DashboardLayoutSectionsSelector<TWidget>): this;
|
|
33
37
|
removeEmptySections(): this;
|
|
34
38
|
modifySections(modify: DashboardLayoutSectionModifications<TWidget>, selector?: DashboardLayoutSectionsSelector<TWidget>): this;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../../../src/_staging/dashboard/flexibleLayout/builder/layout.ts"],"names":[],"mappings":"AACA,OAAO,EACH,gBAAgB,EAChB,uBAAuB,EACvB,oBAAoB,EAEvB,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EACH,4BAA4B,EAC5B,mCAAmC,EACnC,+BAA+B,EAC/B,uBAAuB,
|
|
1
|
+
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../../../src/_staging/dashboard/flexibleLayout/builder/layout.ts"],"names":[],"mappings":"AACA,OAAO,EACH,gBAAgB,EAChB,uBAAuB,EACvB,oBAAoB,EAEvB,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EACH,4BAA4B,EAC5B,mCAAmC,EACnC,+BAA+B,EAC/B,uBAAuB,EACvB,8BAA8B,EACjC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAGjE,OAAO,EAAgC,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEjG,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG3E;;GAEG;AACH,qBAAa,sBAAsB,CAAC,OAAO,CAAE,YAAW,uBAAuB,CAAC,OAAO,CAAC;IAEhF,SAAS,CAAC,YAAY,EAAE,sBAAsB,CAAC,OAAO,CAAC;IACvD,SAAS,CAAC,uBAAuB,EAAE,CAC/B,MAAM,EAAE,gBAAgB,CAAC,OAAO,CAAC,EACjC,UAAU,EAAE,eAAe,GAAG,SAAS,KACtC,sBAAsB,CAAC,OAAO,CAAC;IALxC,SAAS,aACK,YAAY,EAAE,sBAAsB,CAAC,OAAO,CAAC,EAC7C,uBAAuB,EAAE,CAC/B,MAAM,EAAE,gBAAgB,CAAC,OAAO,CAAC,EACjC,UAAU,EAAE,eAAe,GAAG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AO,CAAC,EACpD,QAAQ,GAAE,+BAA+B,CAAC,OAAO,CAAgC,GAClF,IAAI;IAYA,SAAS,CAAC,qBAAqB,EAAE,qBAAqB,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,GAAG,IAAI;IAMxF,MAAM,IAAI,sBAAsB,CAAC,OAAO,CAAC;IAIzC,MAAM,CAAC,aAAa,EAAE,4BAA4B,CAAC,OAAO,CAAC,GAAG,IAAI;IAKlE,KAAK,IAAI,gBAAgB,CAAC,OAAO,CAAC;CAG5C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// (C) 2019-
|
|
1
|
+
// (C) 2019-2025 GoodData Corporation
|
|
2
2
|
import { isDashboardLayout, } from "@gooddata/sdk-model";
|
|
3
3
|
import { invariant } from "ts-invariant";
|
|
4
4
|
import difference from "lodash/difference.js";
|
|
@@ -8,8 +8,8 @@ import { DashboardLayoutFacade } from "../facade/layout.js";
|
|
|
8
8
|
import { DashboardLayoutSectionBuilder } from "./section.js";
|
|
9
9
|
import { resolveValueOrUpdateCallback } from "@gooddata/sdk-backend-base";
|
|
10
10
|
import { getSectionIndex } from "../../../layout/coordinates.js";
|
|
11
|
+
import { DashboardLayoutItemBuilder } from "./item.js";
|
|
11
12
|
/**
|
|
12
|
-
* TODO LX-603: rewrite to support nested layouts
|
|
13
13
|
* @alpha
|
|
14
14
|
*/
|
|
15
15
|
export class DashboardLayoutBuilder {
|
|
@@ -26,8 +26,7 @@ export class DashboardLayoutBuilder {
|
|
|
26
26
|
*/
|
|
27
27
|
static for(layout, layoutPath) {
|
|
28
28
|
invariant(isDashboardLayout(layout), "Provided data must be IDashboardLayout.");
|
|
29
|
-
|
|
30
|
-
return dashboardLayoutBuilder;
|
|
29
|
+
return new DashboardLayoutBuilder(DashboardLayoutFacade.for(layout, layoutPath), DashboardLayoutFacade.for);
|
|
31
30
|
}
|
|
32
31
|
/**
|
|
33
32
|
* Creates an instance of DashboardLayoutBuilder with empty layout.
|
|
@@ -47,59 +46,174 @@ export class DashboardLayoutBuilder {
|
|
|
47
46
|
size: resolveValueOrUpdateCallback(valueOrUpdateCallback, this.facade().size()),
|
|
48
47
|
}));
|
|
49
48
|
}
|
|
50
|
-
createSection(create = identity,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
49
|
+
createSection(create = identity, indexOrPath) {
|
|
50
|
+
if (typeof indexOrPath === "number" || typeof indexOrPath === "undefined") {
|
|
51
|
+
const index = indexOrPath ?? this.facade().sections().count();
|
|
52
|
+
const emptySection = {
|
|
53
|
+
type: "IDashboardLayoutSection",
|
|
54
|
+
items: [],
|
|
55
|
+
};
|
|
56
|
+
this.setLayout((layout) => {
|
|
57
|
+
const updatedRows = [...layout.sections];
|
|
58
|
+
updatedRows.splice(index, 0, emptySection);
|
|
59
|
+
return {
|
|
60
|
+
...layout,
|
|
61
|
+
sections: updatedRows,
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
DashboardLayoutSectionBuilder.for(this, index).modify(create);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
this.createSectionByPath(create, indexOrPath);
|
|
68
|
+
}
|
|
69
|
+
return this;
|
|
70
|
+
}
|
|
71
|
+
createSectionByPath(create, sectionPath) {
|
|
72
|
+
if (sectionPath.parent && sectionPath.parent.length > 0) {
|
|
73
|
+
const [nextPathEntry, ...remainingPath] = sectionPath.parent;
|
|
74
|
+
const nestedLayout = this.facade().nestedLayout([nextPathEntry])?.raw();
|
|
75
|
+
invariant(nestedLayout, `Cannot create section - nested layout at path ${JSON.stringify(nextPathEntry)} does not exist.`);
|
|
76
|
+
const sectionBuilder = DashboardLayoutSectionBuilder.for(this, nextPathEntry.sectionIndex);
|
|
77
|
+
const modify = (nestedLayoutBuilder) => {
|
|
78
|
+
return nestedLayoutBuilder.createSection(create, {
|
|
79
|
+
parent: remainingPath,
|
|
80
|
+
sectionIndex: sectionPath.sectionIndex,
|
|
81
|
+
});
|
|
61
82
|
};
|
|
62
|
-
|
|
63
|
-
|
|
83
|
+
DashboardLayoutItemBuilder.for(sectionBuilder, nextPathEntry.itemIndex).modifyLayoutWidget(modify, DashboardLayoutBuilder.for);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
this.createSection(create, sectionPath.sectionIndex);
|
|
87
|
+
}
|
|
88
|
+
return this;
|
|
89
|
+
}
|
|
90
|
+
addSection(section, indexOrPath) {
|
|
91
|
+
if (typeof indexOrPath === "number" || typeof indexOrPath === "undefined") {
|
|
92
|
+
const index = indexOrPath === undefined ? this.facade().sections().count() : indexOrPath;
|
|
93
|
+
this.setLayout((layout) => {
|
|
94
|
+
const updatedRows = [...layout.sections];
|
|
95
|
+
updatedRows.splice(index, 0, section);
|
|
96
|
+
return {
|
|
97
|
+
...layout,
|
|
98
|
+
sections: updatedRows,
|
|
99
|
+
};
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
this.addSectionByPath(indexOrPath, section);
|
|
104
|
+
}
|
|
64
105
|
return this;
|
|
65
106
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
107
|
+
addSectionByPath(sectionPath, section) {
|
|
108
|
+
if (sectionPath.parent && sectionPath.parent.length > 0) {
|
|
109
|
+
const [nextPathEntry, ...remainingPath] = sectionPath.parent;
|
|
110
|
+
const nestedLayout = this.facade().nestedLayout([nextPathEntry])?.raw();
|
|
111
|
+
invariant(nestedLayout, `Cannot add section - nested layout at path ${JSON.stringify(nextPathEntry)} does not exist.`);
|
|
112
|
+
const sectionBuilder = DashboardLayoutSectionBuilder.for(this, nextPathEntry.sectionIndex);
|
|
113
|
+
const modify = (nestedLayoutBuilder) => {
|
|
114
|
+
return nestedLayoutBuilder.addSection(section, {
|
|
115
|
+
parent: remainingPath,
|
|
116
|
+
sectionIndex: sectionPath.sectionIndex,
|
|
117
|
+
});
|
|
73
118
|
};
|
|
74
|
-
|
|
119
|
+
DashboardLayoutItemBuilder.for(sectionBuilder, nextPathEntry.itemIndex).modifyLayoutWidget(modify, DashboardLayoutBuilder.for);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
this.addSection(section, sectionPath.sectionIndex);
|
|
123
|
+
}
|
|
75
124
|
return this;
|
|
76
125
|
}
|
|
77
|
-
modifySection(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
126
|
+
modifySection(indexOrPath, modify) {
|
|
127
|
+
if (typeof indexOrPath === "number") {
|
|
128
|
+
const sectionFacade = this.facade().sections().section(indexOrPath);
|
|
129
|
+
invariant(sectionFacade, `Cannot modify the section - section at index ${indexOrPath} does not exist.`);
|
|
130
|
+
DashboardLayoutSectionBuilder.for(this, indexOrPath).modify(modify);
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
this.modifySectionByPath(indexOrPath, modify);
|
|
134
|
+
}
|
|
81
135
|
return this;
|
|
82
136
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
137
|
+
modifySectionByPath(sectionPath, modify) {
|
|
138
|
+
if (sectionPath.parent && sectionPath.parent.length > 0) {
|
|
139
|
+
const [nextPathEntry, ...remainingPath] = sectionPath.parent;
|
|
140
|
+
const nestedLayout = this.facade().nestedLayout([nextPathEntry])?.raw();
|
|
141
|
+
invariant(nestedLayout, `Cannot modify section - nested layout at path ${JSON.stringify(nextPathEntry)} does not exist.`);
|
|
142
|
+
const sectionBuilder = DashboardLayoutSectionBuilder.for(this, nextPathEntry.sectionIndex);
|
|
143
|
+
const widgetModify = (nestedLayoutBuilder) => {
|
|
144
|
+
return nestedLayoutBuilder.modifySection({
|
|
145
|
+
parent: remainingPath,
|
|
146
|
+
sectionIndex: sectionPath.sectionIndex,
|
|
147
|
+
}, modify);
|
|
92
148
|
};
|
|
93
|
-
|
|
149
|
+
DashboardLayoutItemBuilder.for(sectionBuilder, nextPathEntry.itemIndex).modifyLayoutWidget(widgetModify, DashboardLayoutBuilder.for);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
this.modifySection(sectionPath.sectionIndex, modify);
|
|
153
|
+
}
|
|
154
|
+
return this;
|
|
155
|
+
}
|
|
156
|
+
removeSection(indexOrPath) {
|
|
157
|
+
if (typeof indexOrPath === "number") {
|
|
158
|
+
const sectionFacade = this.facade().sections().section(indexOrPath);
|
|
159
|
+
invariant(sectionFacade, `Cannot remove the section - section at index ${indexOrPath} does not exist.`);
|
|
160
|
+
return this.setLayout((layout) => {
|
|
161
|
+
const updatedRows = [...layout.sections];
|
|
162
|
+
updatedRows.splice(indexOrPath, 1);
|
|
163
|
+
return {
|
|
164
|
+
...layout,
|
|
165
|
+
sections: updatedRows,
|
|
166
|
+
};
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
return this.removeSectionByPath(indexOrPath);
|
|
170
|
+
}
|
|
171
|
+
removeSectionByPath(sectionPath) {
|
|
172
|
+
if (sectionPath.parent && sectionPath.parent.length > 0) {
|
|
173
|
+
const [nextPathEntry, ...remainingPath] = sectionPath.parent;
|
|
174
|
+
const nestedLayout = this.facade().nestedLayout([nextPathEntry])?.raw();
|
|
175
|
+
invariant(nestedLayout, `Cannot modify section - nested layout at path ${JSON.stringify(nextPathEntry)} does not exist.`);
|
|
176
|
+
const sectionBuilder = DashboardLayoutSectionBuilder.for(this, nextPathEntry.sectionIndex);
|
|
177
|
+
const widgetModify = (nestedLayoutBuilder) => {
|
|
178
|
+
return nestedLayoutBuilder.removeSection({
|
|
179
|
+
parent: remainingPath,
|
|
180
|
+
sectionIndex: sectionPath.sectionIndex,
|
|
181
|
+
});
|
|
182
|
+
};
|
|
183
|
+
DashboardLayoutItemBuilder.for(sectionBuilder, nextPathEntry.itemIndex).modifyLayoutWidget(widgetModify, DashboardLayoutBuilder.for);
|
|
184
|
+
return this;
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
return this.removeSection(sectionPath.sectionIndex);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
moveSection(fromIndexOrPath, toIndexOrPath) {
|
|
191
|
+
if (typeof fromIndexOrPath === "number" && typeof toIndexOrPath === "number") {
|
|
192
|
+
const section = this.facade().section(fromIndexOrPath)?.raw();
|
|
193
|
+
invariant(section, `Cannot move the section - section at index ${fromIndexOrPath} does not exist.`);
|
|
194
|
+
const maxToIndex = Math.min(toIndexOrPath, this.facade().sections().count() - 1);
|
|
195
|
+
this.removeSection(fromIndexOrPath);
|
|
196
|
+
this.createSection((r) => {
|
|
197
|
+
return r.setSection(section);
|
|
198
|
+
}, maxToIndex);
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
this.moveSectionByPath(fromIndexOrPath, toIndexOrPath);
|
|
202
|
+
}
|
|
203
|
+
return this;
|
|
94
204
|
}
|
|
95
|
-
|
|
96
|
-
const section =
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
205
|
+
moveSectionByPath(fromIndexOrPath, toIndexOrPath) {
|
|
206
|
+
const section = typeof fromIndexOrPath === "number"
|
|
207
|
+
? this.facade().section(fromIndexOrPath)?.raw()
|
|
208
|
+
: this.facade()
|
|
209
|
+
.nestedLayout(fromIndexOrPath.parent ?? [])
|
|
210
|
+
?.section(fromIndexOrPath.sectionIndex)
|
|
211
|
+
?.raw();
|
|
212
|
+
invariant(section, `Cannot move the section - section at index ${JSON.stringify(fromIndexOrPath)} does not exist.`);
|
|
213
|
+
this.removeSection(fromIndexOrPath);
|
|
100
214
|
this.createSection((r) => {
|
|
101
215
|
return r.setSection(section);
|
|
102
|
-
},
|
|
216
|
+
}, toIndexOrPath);
|
|
103
217
|
return this;
|
|
104
218
|
}
|
|
105
219
|
removeSections(selector = (sections) => sections.all()) {
|
|
@@ -114,7 +228,6 @@ export class DashboardLayoutBuilder {
|
|
|
114
228
|
});
|
|
115
229
|
}
|
|
116
230
|
else if (sectionsToRemove) {
|
|
117
|
-
// TODO LX-603: rewrite to support nested layouts, currently works only in root layout
|
|
118
231
|
this.removeSection(getSectionIndex(sectionsToRemove.index()));
|
|
119
232
|
}
|
|
120
233
|
return this;
|
|
@@ -126,20 +239,17 @@ export class DashboardLayoutBuilder {
|
|
|
126
239
|
const sectionsToModify = selector(this.facade().sections());
|
|
127
240
|
if (isArray(sectionsToModify)) {
|
|
128
241
|
sectionsToModify.forEach((section) => {
|
|
129
|
-
// TODO LX-603: rewrite to support nested layouts, currently works only in root layout
|
|
130
242
|
this.modifySection(getSectionIndex(section.index()), modify);
|
|
131
243
|
});
|
|
132
244
|
}
|
|
133
245
|
else if (sectionsToModify) {
|
|
134
|
-
// TODO LX-603: rewrite to support nested layouts, currently works only in root layout
|
|
135
246
|
this.modifySection(getSectionIndex(sectionsToModify.index()), modify);
|
|
136
247
|
}
|
|
137
248
|
return this;
|
|
138
249
|
}
|
|
139
250
|
setLayout(valueOrUpdateCallback) {
|
|
140
251
|
const updatedLayout = resolveValueOrUpdateCallback(valueOrUpdateCallback, this.build());
|
|
141
|
-
|
|
142
|
-
this.layoutFacade = this.layoutFacadeConstructor(updatedLayout, undefined);
|
|
252
|
+
this.layoutFacade = this.layoutFacadeConstructor(updatedLayout, this.facade().path());
|
|
143
253
|
return this;
|
|
144
254
|
}
|
|
145
255
|
facade() {
|