@qrvey/widget-configurability 0.0.0-beta.4430 → 0.0.0-beta.4482

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 (36) hide show
  1. package/dist/cjs/constants/configs.js +29 -1
  2. package/dist/cjs/constants/configs.js.map +1 -1
  3. package/dist/cjs/constants/structure.constants.js +14 -1
  4. package/dist/cjs/constants/structure.constants.js.map +1 -1
  5. package/dist/cjs/doc/dashboard.structure.doc.js +8 -0
  6. package/dist/cjs/doc/dashboard.structure.doc.js.map +1 -1
  7. package/dist/cjs/doc/swagger.optional.js +3 -1
  8. package/dist/cjs/doc/swagger.optional.js.map +1 -1
  9. package/dist/cjs/index.js +28 -1
  10. package/dist/cjs/index.js.map +1 -1
  11. package/dist/cjs/models/scope.models.js +3 -0
  12. package/dist/cjs/models/scope.models.js.map +1 -0
  13. package/dist/cjs/structural-manager.js +69 -5
  14. package/dist/cjs/structural-manager.js.map +1 -1
  15. package/dist/cjs/structures/chart-builder.structure.v1.js +18 -0
  16. package/dist/cjs/structures/chart-builder.structure.v1.js.map +1 -0
  17. package/dist/cjs/structures/chart-gallery.structure.v1.js +18 -0
  18. package/dist/cjs/structures/chart-gallery.structure.v1.js.map +1 -0
  19. package/dist/cjs/structures/chart-panel.structure.v1.js +71 -0
  20. package/dist/cjs/structures/chart-panel.structure.v1.js.map +1 -0
  21. package/dist/cjs/structures/dashboard.structure.v1.js +116 -13
  22. package/dist/cjs/structures/dashboard.structure.v1.js.map +1 -1
  23. package/dist/cjs/structures/download-modal.structure.v1.js +33 -0
  24. package/dist/cjs/structures/download-modal.structure.v1.js.map +1 -0
  25. package/dist/cjs/utils/defaults.helpers.js +26 -6
  26. package/dist/cjs/utils/defaults.helpers.js.map +1 -1
  27. package/dist/cjs/utils/download-modal.helpers.js +27 -0
  28. package/dist/cjs/utils/download-modal.helpers.js.map +1 -0
  29. package/dist/cjs/utils/scope.helpers.js +88 -0
  30. package/dist/cjs/utils/scope.helpers.js.map +1 -0
  31. package/dist/cjs/utils/structural.helpers.js +52 -29
  32. package/dist/cjs/utils/structural.helpers.js.map +1 -1
  33. package/dist/esm/index.mjs +655 -170
  34. package/dist/esm/index.mjs.map +1 -1
  35. package/dist/types/index.d.ts +135 -5
  36. package/package.json +8 -1
@@ -1,4 +1,6 @@
1
1
  var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
2
4
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
4
6
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
@@ -14,13 +16,8 @@ var __spreadValues = (a, b) => {
14
16
  }
15
17
  return a;
16
18
  };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
17
20
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
18
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
19
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
20
- }) : x)(function(x) {
21
- if (typeof require !== "undefined") return require.apply(this, arguments);
22
- throw Error('Dynamic require of "' + x + '" is not supported');
23
- });
24
21
  var __export = (target, all) => {
25
22
  for (var name in all)
26
23
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -39,24 +36,207 @@ var Widget = /* @__PURE__ */ function(Widget2) {
39
36
  Widget2["DASHBOARD"] = "dashboard";
40
37
  Widget2["REPORT"] = "report";
41
38
  Widget2["DOWNLOAD_MANAGER"] = "download-manager";
39
+ Widget2["DOWNLOAD_MODAL"] = "download-modal";
40
+ Widget2["CHART_PANEL"] = "chart-panel";
41
+ Widget2["CHART_GALLERY"] = "chart-gallery";
42
+ Widget2["CHART_BUILDER"] = "chart-builder";
42
43
  return Widget2;
43
44
  }({});
45
+ var WIDGET_SUBMODULE_NAMES = {
46
+ ["download-modal"]: "downloadModal",
47
+ ["chart-panel"]: "chartPanel",
48
+ ["chart-gallery"]: "chartGallery",
49
+ ["chart-builder"]: "chartBuilder"
50
+ };
51
+ var WIDGET_STRUCTURE_SCOPE_KIND = "qrvey.widget-structure-scope";
52
+ var WIDGET_STRUCTURE_SCOPE_FORMAT = 1;
44
53
  var WidgetVersion = /* @__PURE__ */ function(WidgetVersion2) {
45
54
  WidgetVersion2["v1"] = "1.0";
46
55
  WidgetVersion2["latest"] = "latest";
47
56
  return WidgetVersion2;
48
57
  }({});
49
58
 
59
+ // src/utils/defaults.helpers.ts
60
+ var FONT_SIZES = [
61
+ 8,
62
+ 9,
63
+ 10,
64
+ 11,
65
+ 12,
66
+ 14,
67
+ 15,
68
+ 16,
69
+ 18,
70
+ 24,
71
+ 30,
72
+ 36,
73
+ 48,
74
+ 60,
75
+ 72,
76
+ 96
77
+ ];
78
+ function applyValidation(currentObj, validatorMap, parentKey = "", sanitize) {
79
+ const validatedObj = {};
80
+ Object.keys(currentObj).forEach((key) => {
81
+ const fullKey = parentKey ? `${parentKey}.${key}` : key;
82
+ const value = currentObj[key];
83
+ if (typeof value === "object" && !Array.isArray(value) && value !== null) {
84
+ validatedObj[key] = applyValidation(value, validatorMap, fullKey, sanitize);
85
+ } else if (validatorMap[fullKey]) {
86
+ validatedObj[key] = validatorMap[fullKey](value);
87
+ } else {
88
+ validatedObj[key] = sanitize && typeof value === "string" ? sanitize(value) : value;
89
+ }
90
+ });
91
+ return validatedObj;
92
+ }
93
+ __name(applyValidation, "applyValidation");
94
+ function validateDefaults(obj, validatorMap, sanitize) {
95
+ return applyValidation(obj, validatorMap, "", sanitize);
96
+ }
97
+ __name(validateDefaults, "validateDefaults");
98
+ var isANumber = /* @__PURE__ */ __name((value) => {
99
+ const _value = Number(value);
100
+ if (!_value || isNaN(_value)) return void 0;
101
+ return _value;
102
+ }, "isANumber");
103
+ var numberMinMaxValue = /* @__PURE__ */ __name((maxValue, minValue) => (value) => {
104
+ const _value = isANumber(value);
105
+ if (!_value) return void 0;
106
+ if (minValue && _value < minValue) return minValue;
107
+ if (_value > maxValue) return maxValue;
108
+ return _value;
109
+ }, "numberMinMaxValue");
110
+ var fontSizeMinMaxValue = /* @__PURE__ */ __name((minSize, maxSize) => (value) => {
111
+ const inputSize = parseInt(value, 10);
112
+ if (FONT_SIZES.includes(inputSize) && inputSize >= minSize && inputSize <= maxSize) {
113
+ return `${inputSize}px`;
114
+ }
115
+ const validFontSizes = FONT_SIZES.filter((size) => size >= minSize && size <= maxSize);
116
+ if (validFontSizes.length === 0) {
117
+ return void 0;
118
+ }
119
+ let closestSize = validFontSizes[0];
120
+ let smallestDiff = Math.abs(inputSize - closestSize);
121
+ for (const size of validFontSizes) {
122
+ const diff = Math.abs(inputSize - size);
123
+ if (diff < smallestDiff) {
124
+ smallestDiff = diff;
125
+ closestSize = size;
126
+ }
127
+ }
128
+ return `${closestSize}px`;
129
+ }, "fontSizeMinMaxValue");
130
+ var fontColorValue = /* @__PURE__ */ __name((value) => {
131
+ const normalizedColor = value.toLowerCase();
132
+ return normalizedColor;
133
+ }, "fontColorValue");
134
+ var validateBoolean = /* @__PURE__ */ __name((value) => typeof value === "boolean" ? value : void 0, "validateBoolean");
135
+ var validateUnsavedChangesBehavior = /* @__PURE__ */ __name((value) => {
136
+ if (typeof value !== "string") return void 0;
137
+ return [
138
+ "prompt",
139
+ "autoSave",
140
+ "discard"
141
+ ].includes(value) ? value : void 0;
142
+ }, "validateUnsavedChangesBehavior");
143
+ var validateType = /* @__PURE__ */ __name((validValues) => (value) => {
144
+ if (typeof value !== "string") return void 0;
145
+ const receivedValue = value.toUpperCase();
146
+ return validValues.includes(receivedValue) ? receivedValue : void 0;
147
+ }, "validateType");
148
+ var DX_VALIDATOR_MAP = {
149
+ "customStyles.header.height": numberMinMaxValue(300, 10),
150
+ "customStyles.text.fontSize": fontSizeMinMaxValue(8, 96),
151
+ "customStyles.text.fontColor": fontColorValue,
152
+ "customStyles.container.borderWidth": numberMinMaxValue(20, 1),
153
+ "customStyles.line.lineWidth": numberMinMaxValue(20, 1),
154
+ "customStyles.rectangle.borderWidth": numberMinMaxValue(20, 1),
155
+ "customStyles.ellipse.borderWidth": numberMinMaxValue(20, 1),
156
+ "customStyles.container.borderRadius": numberMinMaxValue(100, 0),
157
+ // Filter Controls: MULTISELECT LIST
158
+ "customStyles.filterList.type": validateType([
159
+ "LIST",
160
+ "DROPDOWN"
161
+ ]),
162
+ "customStyles.filterList.triggerType": validateType([
163
+ "BUTTON",
164
+ "AUTOMATIC"
165
+ ]),
166
+ // Filter Controls: INPUTBOX
167
+ "customStyles.filterInput.triggerType": validateType([
168
+ "BUTTON",
169
+ "AUTOMATIC"
170
+ ]),
171
+ // Filter Controls: DATE
172
+ "customStyles.filterDate.triggerType": validateType([
173
+ "BUTTON",
174
+ "AUTOMATIC"
175
+ ]),
176
+ // Unsaved Changes Behavior
177
+ unsavedChangesBehavior: validateUnsavedChangesBehavior,
178
+ // Download modal
179
+ "downloadModal.subscribeMyself": validateBoolean
180
+ };
181
+ var DOWNLOAD_MODAL_VALIDATOR_MAP = {
182
+ subscribeMyself: validateBoolean
183
+ };
184
+
185
+ // src/structures/download-modal.structure.v1.ts
186
+ var DOWNLOAD_MODAL_V1_KEYS = [
187
+ "qScheduleOption",
188
+ "qSubscribeOption",
189
+ "qSubscribeExternalUsers",
190
+ "qSubscribeBanner",
191
+ "qSubscribeOwner",
192
+ "qSubscribeOrganization",
193
+ "qSubscribeMyself",
194
+ "qSubscribeSpecificPeople",
195
+ "qIncludeHyperlinks"
196
+ ];
197
+ var DOWNLOAD_MODAL_V1_KEEP_INHERITANCE = {
198
+ qSubscribeBanner: "qSubscribeOption",
199
+ qSubscribeOwner: "qSubscribeOption",
200
+ qSubscribeOrganization: "qSubscribeOption",
201
+ qSubscribeMyself: "qSubscribeOption",
202
+ qSubscribeSpecificPeople: "qSubscribeOption"
203
+ };
204
+ var DOWNLOAD_MODAL_V1_DEFAULTS = {
205
+ subscribeMyself: true
206
+ };
207
+ var downloadModalV1Config = {
208
+ version: "1.0",
209
+ keepInheritance: DOWNLOAD_MODAL_V1_KEEP_INHERITANCE,
210
+ baseStructure: __spreadValues({
211
+ defaults: __spreadValues({}, DOWNLOAD_MODAL_V1_DEFAULTS)
212
+ }, Object.fromEntries(DOWNLOAD_MODAL_V1_KEYS.map((key) => [
213
+ key,
214
+ true
215
+ ])))
216
+ };
217
+ var download_modal_structure_v1_default = downloadModalV1Config;
218
+
50
219
  // src/structures/dashboard.structure.v1.ts
220
+ var DOWNLOAD_MODAL_HOST_KEYS = [
221
+ "qExportVersion",
222
+ "qSavedVersionWarning",
223
+ "qUnsavedVersionWarning"
224
+ ];
51
225
  var dashboardV1Config = {
52
226
  version: "1.0",
227
+ keepInheritance: Object.fromEntries(Object.entries(DOWNLOAD_MODAL_V1_KEEP_INHERITANCE).map(([key, alias]) => [
228
+ `downloadModal.${key}`,
229
+ `downloadModal.${alias}`
230
+ ])),
53
231
  baseStructure: {
54
232
  views: {
55
233
  list: [
56
234
  "navBar",
57
235
  "assetList",
58
236
  "controlBarLeft",
59
- "controlBarRight"
237
+ "controlBarRight",
238
+ "qQvTokenExpiredMessage",
239
+ "duplicateModal"
60
240
  ],
61
241
  design: [
62
242
  "navBar",
@@ -66,19 +246,27 @@ var dashboardV1Config = {
66
246
  "toolBar",
67
247
  "configPanel",
68
248
  "filterPanel",
69
- "downloadModal"
249
+ "downloadModal",
250
+ "canvas",
251
+ "qQvTokenExpiredMessage",
252
+ "duplicateModal"
70
253
  ],
71
254
  preview: [
72
255
  "navBar",
73
256
  "header",
74
257
  "controlBarRight",
75
- "filterPanel"
258
+ "filterPanel",
259
+ "qGoToDashBackButton",
260
+ "qQvTokenExpiredMessage"
76
261
  ],
77
262
  endUser: [
78
263
  "navBar",
79
264
  "toolBar",
80
265
  "filterPanel",
81
- "downloadModal"
266
+ "downloadModal",
267
+ "canvas",
268
+ "qGoToDashBackButton",
269
+ "qQvTokenExpiredMessage"
82
270
  ]
83
271
  },
84
272
  navBar: [
@@ -96,13 +284,44 @@ var dashboardV1Config = {
96
284
  asset: {
97
285
  optionMenu: [
98
286
  "qEditDash",
287
+ "qUseDash",
99
288
  "qRenameDash",
100
289
  "qDeleteDash",
101
290
  "qDuplDash",
102
- "qShareDash"
291
+ "qDuplDashAndCharts",
292
+ "qManageSharing"
293
+ ],
294
+ card: [
295
+ "qFavorite",
296
+ "qCreatedDate",
297
+ "qLastModifDate",
298
+ "qStatus",
299
+ "qNumberOfCharts",
300
+ "qSharing",
301
+ "qSharingIcon",
302
+ "qOwner",
303
+ "qDescription"
304
+ ],
305
+ table: [
306
+ "qFavorite",
307
+ "qCreatedDate",
308
+ "qLastModifDate",
309
+ "qStatus",
310
+ "qNumberOfCharts",
311
+ "qSharing",
312
+ "qSharingIcon",
313
+ "qOwner",
314
+ "qDescription"
103
315
  ]
104
316
  }
105
317
  },
318
+ canvas: {
319
+ defaults: {
320
+ removeElement: true,
321
+ dragElement: true,
322
+ resizeElement: true
323
+ }
324
+ },
106
325
  controlBarLeft: [
107
326
  "qCreateDash"
108
327
  ],
@@ -117,11 +336,14 @@ var dashboardV1Config = {
117
336
  "qPreview",
118
337
  "qDiscard",
119
338
  "qPublish",
120
- "qDesign"
339
+ "qUnpublish",
340
+ "qSwitchMode",
341
+ "qDesign",
342
+ "qDownloadList"
121
343
  ],
122
344
  header: [
123
345
  "qDashFavorite",
124
- "qShareDash",
346
+ "qSharingIcon",
125
347
  "qDashName",
126
348
  "qDashDesc"
127
349
  ],
@@ -130,12 +352,16 @@ var dashboardV1Config = {
130
352
  "qMnuCreateDash",
131
353
  "qMnuOpenDash",
132
354
  "qMnuDuplicateDash",
355
+ "qMnuDuplicateDashAndCharts",
133
356
  "qMnuCanvasSize",
134
357
  "qMnuThemes",
135
- "qShareDash",
358
+ "qManageSharing",
136
359
  "qMnuDeleteDash",
137
- "qCreateCustomViewDataset",
138
360
  {
361
+ qCreateDataset: [
362
+ "qCreateCustomDataset",
363
+ "qViewCustomDataset"
364
+ ],
139
365
  qMnuDownloadDash: [
140
366
  "qDashPDF",
141
367
  "qDashCSV",
@@ -169,7 +395,13 @@ var dashboardV1Config = {
169
395
  qMnuInsertFilterCtrl: [
170
396
  "qMnuDatePicker",
171
397
  "qMnuInputBox",
172
- "qMnuMultiSelectList"
398
+ "qMnuMultiSelectList",
399
+ "qMnuSingleSelectList"
400
+ ],
401
+ qMnuInsertShape: [
402
+ "qMnuLine",
403
+ "qMnuRectangle",
404
+ "qMnuEllipse"
173
405
  ]
174
406
  },
175
407
  "qMnuInsertText",
@@ -205,7 +437,13 @@ var dashboardV1Config = {
205
437
  qInsertFilterCtrl: [
206
438
  "qDatePicker",
207
439
  "qInputBox",
208
- "qMultiSelectList"
440
+ "qMultiSelectList",
441
+ "qSingleSelectList"
442
+ ],
443
+ qInsertShape: [
444
+ "qLine",
445
+ "qRectangle",
446
+ "qEllipse"
209
447
  ],
210
448
  grid: [
211
449
  "qSnapToGrid",
@@ -235,10 +473,13 @@ var dashboardV1Config = {
235
473
  "qAlignTop",
236
474
  "qAlignMiddle",
237
475
  "qAlignBottom"
476
+ ],
477
+ qCreateDataset: [
478
+ "qCreateCustomDataset",
479
+ "qViewCustomDataset"
238
480
  ]
239
481
  },
240
482
  "qInsertText",
241
- "qCreateCustomViewDataset",
242
483
  "qInsertImage",
243
484
  "qInsertButton",
244
485
  "qInsertContainer",
@@ -249,17 +490,24 @@ var dashboardV1Config = {
249
490
  // only for end user
250
491
  "qDashVersion",
251
492
  "qGetDashVersion",
493
+ "qSourceDashBanner",
252
494
  "qHiddenItems",
253
495
  "qDiscard",
254
496
  "qSave",
255
- "qHideToolBar"
497
+ "qSwitchMode",
498
+ "qHideToolBar",
499
+ "qDownloadList",
500
+ "qChangeLayout"
256
501
  ],
502
+ qQvTokenExpiredMessage: true,
503
+ qGoToDashBackButton: true,
257
504
  configPanel: true,
258
505
  filterPanel: {
259
506
  qAddFilter: true,
260
507
  qEnabDisabAllFilters: true,
261
508
  qDeleteAllFilters: true,
262
509
  qFilterSettings: true,
510
+ viewOnlyFilterScope: true,
263
511
  dashFilterScope: [
264
512
  "qEditFilter",
265
513
  "qEnabDisabFilter",
@@ -270,6 +518,11 @@ var dashboardV1Config = {
270
518
  "qEnabDisabFilter",
271
519
  "qDeleteFilter"
272
520
  ],
521
+ containerFilterScope: [
522
+ "qEditFilter",
523
+ "qEnabDisabFilter",
524
+ "qDeleteFilter"
525
+ ],
273
526
  panelFilterScope: [
274
527
  "qEditFilter",
275
528
  "qEnabDisabFilter",
@@ -277,10 +530,22 @@ var dashboardV1Config = {
277
530
  ]
278
531
  },
279
532
  downloadModal: [
280
- "qScheduleOption",
281
- "qSubscribeOption",
282
- "qSubscribeExternalUsers",
283
- "qIncludeHyperlinks"
533
+ ...DOWNLOAD_MODAL_V1_KEYS,
534
+ ...DOWNLOAD_MODAL_HOST_KEYS
535
+ ],
536
+ duplicateModal: [
537
+ "qCharts",
538
+ "qFilters",
539
+ "qDashActions",
540
+ {
541
+ options: {
542
+ defaults: {
543
+ qCharts: true,
544
+ qFilters: true,
545
+ qDashActions: true
546
+ }
547
+ }
548
+ }
284
549
  ],
285
550
  subModules: {
286
551
  chartPanel: {},
@@ -548,6 +813,134 @@ var reportV1Config = {
548
813
  };
549
814
  var report_structure_v1_default = reportV1Config;
550
815
 
816
+ // src/structures/chart-panel.structure.v1.ts
817
+ var optionMenuChildren = [
818
+ "qEditChart",
819
+ "qDuplicateChart",
820
+ {
821
+ qDownloadChart: [
822
+ "qChartJPG",
823
+ "qChartPDF",
824
+ "qChartCSV",
825
+ "qChartSummary",
826
+ "qChartExcel"
827
+ ]
828
+ }
829
+ ];
830
+ var headerConfig = [
831
+ "qChartName",
832
+ "qFitPanel",
833
+ "qChartSelection",
834
+ "qColumnSection",
835
+ "qSorting",
836
+ "qColumnReplacement",
837
+ "qColumnAggregation",
838
+ "qColumnGrouping",
839
+ "qDateGrouping",
840
+ "qColumnSelection",
841
+ "qResetColumnsWidth",
842
+ "qSmartAnalyzer",
843
+ {
844
+ optionMenu: optionMenuChildren
845
+ },
846
+ {
847
+ qFilter: [
848
+ "qAddFilter",
849
+ {
850
+ dashFilterScope: [
851
+ "qEditFilter",
852
+ "qDeleteFilter"
853
+ ]
854
+ },
855
+ {
856
+ tabFilterScope: [
857
+ "qEditFilter",
858
+ "qDeleteFilter"
859
+ ]
860
+ },
861
+ {
862
+ panelFilterScope: [
863
+ "qEditFilter",
864
+ "qDeleteFilter"
865
+ ]
866
+ }
867
+ ]
868
+ },
869
+ {
870
+ optionDateGrouping: [
871
+ "qDayOnly",
872
+ "qMonth",
873
+ "qMonthOnly",
874
+ "qQuarter",
875
+ "qQuarterOnly",
876
+ "qWeek",
877
+ "qYear",
878
+ "qDay",
879
+ "qHour",
880
+ "qHourOnly",
881
+ "qMinute",
882
+ "qMinuteOnly",
883
+ "qSecond",
884
+ "qSecondOnly"
885
+ ]
886
+ }
887
+ ];
888
+ var floatingMenuConfig = [
889
+ ...headerConfig.filter((item) => typeof item !== "object" || !("optionMenu" in item)),
890
+ ...optionMenuChildren
891
+ ];
892
+ var chartPanelV1Config = {
893
+ version: "1.0",
894
+ baseStructure: {
895
+ header: headerConfig,
896
+ floatingMenu: floatingMenuConfig,
897
+ menuLayout: {
898
+ defaults: {
899
+ menuLayout: void 0
900
+ }
901
+ },
902
+ body: [
903
+ "actions",
904
+ "qComparativeAnalysis"
905
+ ]
906
+ }
907
+ };
908
+ var chart_panel_structure_v1_default = chartPanelV1Config;
909
+
910
+ // src/structures/chart-gallery.structure.v1.ts
911
+ var chartGalleryV1Config = {
912
+ version: "1.0",
913
+ baseStructure: {
914
+ chartTypeFilter: true,
915
+ showSummary: true,
916
+ inputSearch: true,
917
+ switch: true,
918
+ subModules: {
919
+ chartPanel: {
920
+ title: false
921
+ }
922
+ }
923
+ }
924
+ };
925
+ var chart_gallery_structure_v1_default = chartGalleryV1Config;
926
+
927
+ // src/structures/chart-builder.structure.v1.ts
928
+ var chartBuilderV1Config = {
929
+ version: "1.0",
930
+ baseStructure: {
931
+ chartTypeFilter: true,
932
+ showSummary: true,
933
+ inputSearch: true,
934
+ switch: true,
935
+ subModules: {
936
+ chartPanel: {
937
+ title: false
938
+ }
939
+ }
940
+ }
941
+ };
942
+ var chart_builder_structure_v1_default = chartBuilderV1Config;
943
+
551
944
  // src/constants/configs.ts
552
945
  var widgetConfigs = {
553
946
  [Widget.DASHBOARD]: {
@@ -561,8 +954,30 @@ var widgetConfigs = {
561
954
  [Widget.DOWNLOAD_MANAGER]: {
562
955
  [WidgetVersion.v1]: download_manager_structure_v1_default,
563
956
  [WidgetVersion.latest]: download_manager_structure_v1_default
957
+ },
958
+ [Widget.DOWNLOAD_MODAL]: {
959
+ [WidgetVersion.v1]: download_modal_structure_v1_default,
960
+ [WidgetVersion.latest]: download_modal_structure_v1_default
961
+ },
962
+ [Widget.CHART_PANEL]: {
963
+ [WidgetVersion.v1]: chart_panel_structure_v1_default,
964
+ [WidgetVersion.latest]: chart_panel_structure_v1_default
965
+ },
966
+ [Widget.CHART_GALLERY]: {
967
+ [WidgetVersion.v1]: chart_gallery_structure_v1_default,
968
+ [WidgetVersion.latest]: chart_gallery_structure_v1_default
969
+ },
970
+ [Widget.CHART_BUILDER]: {
971
+ [WidgetVersion.v1]: chart_builder_structure_v1_default,
972
+ [WidgetVersion.latest]: chart_builder_structure_v1_default
564
973
  }
565
974
  };
975
+ var widgetValidators = {
976
+ [Widget.DASHBOARD]: DX_VALIDATOR_MAP,
977
+ [Widget.REPORT]: DX_VALIDATOR_MAP,
978
+ [Widget.DOWNLOAD_MANAGER]: DX_VALIDATOR_MAP,
979
+ [Widget.DOWNLOAD_MODAL]: DOWNLOAD_MODAL_VALIDATOR_MAP
980
+ };
566
981
 
567
982
  // src/models/conditions.models.ts
568
983
  var allowedOperators = [
@@ -626,113 +1041,6 @@ function checkConditions(state, conditions) {
626
1041
  }
627
1042
  __name(checkConditions, "checkConditions");
628
1043
 
629
- // src/utils/defaults.helpers.ts
630
- var FONT_SIZES = [
631
- 8,
632
- 9,
633
- 10,
634
- 11,
635
- 12,
636
- 14,
637
- 15,
638
- 16,
639
- 18,
640
- 24,
641
- 30,
642
- 36,
643
- 48,
644
- 60,
645
- 72,
646
- 96
647
- ];
648
- function applyValidation(currentObj, validatorMap, parentKey = "") {
649
- const validatedObj = {};
650
- Object.keys(currentObj).forEach((key) => {
651
- const fullKey = parentKey ? `${parentKey}.${key}` : key;
652
- const value = currentObj[key];
653
- if (typeof value === "object" && !Array.isArray(value) && value !== null) {
654
- validatedObj[key] = applyValidation(value, validatorMap, fullKey);
655
- } else if (validatorMap[fullKey]) {
656
- validatedObj[key] = validatorMap[fullKey](value);
657
- } else {
658
- validatedObj[key] = value;
659
- }
660
- });
661
- return validatedObj;
662
- }
663
- __name(applyValidation, "applyValidation");
664
- function validateDefaults(obj, validatorMap) {
665
- return applyValidation(obj, validatorMap);
666
- }
667
- __name(validateDefaults, "validateDefaults");
668
- var isANumber = /* @__PURE__ */ __name((value) => {
669
- const _value = Number(value);
670
- if (!_value || isNaN(_value)) return void 0;
671
- return _value;
672
- }, "isANumber");
673
- var numberMinMaxValue = /* @__PURE__ */ __name((maxValue, minValue) => (value) => {
674
- const _value = isANumber(value);
675
- if (!_value) return void 0;
676
- if (minValue && _value < minValue) return minValue;
677
- if (_value > maxValue) return maxValue;
678
- return _value;
679
- }, "numberMinMaxValue");
680
- var fontSizeMinMaxValue = /* @__PURE__ */ __name((minSize, maxSize) => (value) => {
681
- const inputSize = parseInt(value, 10);
682
- if (FONT_SIZES.includes(inputSize) && inputSize >= minSize && inputSize <= maxSize) {
683
- return `${inputSize}px`;
684
- }
685
- const validFontSizes = FONT_SIZES.filter((size) => size >= minSize && size <= maxSize);
686
- if (validFontSizes.length === 0) {
687
- return void 0;
688
- }
689
- let closestSize = validFontSizes[0];
690
- let smallestDiff = Math.abs(inputSize - closestSize);
691
- for (const size of validFontSizes) {
692
- const diff = Math.abs(inputSize - size);
693
- if (diff < smallestDiff) {
694
- smallestDiff = diff;
695
- closestSize = size;
696
- }
697
- }
698
- return `${closestSize}px`;
699
- }, "fontSizeMinMaxValue");
700
- var fontColorValue = /* @__PURE__ */ __name((value) => {
701
- const normalizedColor = value.toLowerCase();
702
- return normalizedColor;
703
- }, "fontColorValue");
704
- var validateType = /* @__PURE__ */ __name((validValues) => (value) => {
705
- if (typeof value !== "string") return void 0;
706
- const receivedValue = value.toUpperCase();
707
- return validValues.includes(receivedValue) ? receivedValue : void 0;
708
- }, "validateType");
709
- var DX_VALIDATOR_MAP = {
710
- "customStyles.header.height": numberMinMaxValue(300, 10),
711
- "customStyles.text.fontSize": fontSizeMinMaxValue(8, 96),
712
- "customStyles.text.fontColor": fontColorValue,
713
- "customStyles.container.borderWidth": numberMinMaxValue(20, 1),
714
- "customStyles.container.borderRadius": numberMinMaxValue(100, 0),
715
- // Filter Controls: MULTISELECT LIST
716
- "customStyles.filterList.type": validateType([
717
- "LIST",
718
- "DROPDOWN"
719
- ]),
720
- "customStyles.filterList.triggerType": validateType([
721
- "BUTTON",
722
- "AUTOMATIC"
723
- ]),
724
- // Filter Controls: INPUTBOX
725
- "customStyles.filterInput.triggerType": validateType([
726
- "BUTTON",
727
- "AUTOMATIC"
728
- ]),
729
- // Filter Controls: DATE
730
- "customStyles.filterDate.triggerType": validateType([
731
- "BUTTON",
732
- "AUTOMATIC"
733
- ])
734
- };
735
-
736
1044
  // src/utils/merge.helpers.ts
737
1045
  function mergeDeep(obj1, obj2, settings) {
738
1046
  var _a, _b;
@@ -787,49 +1095,59 @@ function isObject(value) {
787
1095
  __name(isObject, "isObject");
788
1096
 
789
1097
  // src/utils/structural.helpers.ts
790
- function getWidgetStructure(config, customization, validationMap) {
791
- return calculateViewMap(config.baseStructure, customization, validationMap);
1098
+ function getWidgetStructure(config, customization, validationMap, options) {
1099
+ return calculateViewMap(config.baseStructure, customization, validationMap, __spreadProps(__spreadValues({}, options), {
1100
+ keepInheritance: config.keepInheritance
1101
+ }));
792
1102
  }
793
1103
  __name(getWidgetStructure, "getWidgetStructure");
794
- function calculateViewMap(config, customization, validationMap) {
1104
+ function calculateViewMap(config, customization, validationMap, options) {
795
1105
  const permissionMap = {};
1106
+ const keepAliases = options == null ? void 0 : options.keepInheritance;
796
1107
  if (config.views) {
797
1108
  for (const view in config.views) {
798
- Object.assign(permissionMap, calculateSpecificViewMap(view, config, customization, validationMap));
1109
+ Object.assign(permissionMap, calculateSpecificViewMap(view, config, customization, validationMap, options));
799
1110
  }
800
1111
  } else {
801
- const customDefaults = calculateCustomDefaults(customization, void 0, validationMap);
1112
+ const customDefaults = calculateCustomDefaults(customization, void 0, validationMap, options == null ? void 0 : options.sanitize);
802
1113
  const prevDefaults = config.defaults;
803
1114
  const submodules = calculateSubmodules(config, customization);
804
1115
  if (submodules) {
805
1116
  permissionMap.subModules = submodules;
806
1117
  }
807
- const conditionMaps = calculateConditions(config, customization);
1118
+ const conditionMaps = calculateConditions(config, customization, void 0, keepAliases);
808
1119
  Object.assign(permissionMap, calculatePermissionMap(config, customization, {
809
1120
  prevDefaults,
810
1121
  customDefaults,
811
- conditionMaps
1122
+ conditionMaps,
1123
+ keepAliases
812
1124
  }));
813
1125
  }
814
1126
  return permissionMap;
815
1127
  }
816
1128
  __name(calculateViewMap, "calculateViewMap");
817
- function calculateSpecificViewMap(view, config, customization, validationMap) {
1129
+ function calculateRootDefaults(config, customization, validationMap, sanitize) {
1130
+ return calculateDefaults(config.defaults, void 0, calculateCustomDefaults(customization, void 0, validationMap, sanitize));
1131
+ }
1132
+ __name(calculateRootDefaults, "calculateRootDefaults");
1133
+ function calculateSpecificViewMap(view, config, customization, validationMap, options) {
818
1134
  const viewDefinition = config.views[view];
819
- const customDefaults = calculateCustomDefaults(customization, view, validationMap);
1135
+ const keepAliases = options == null ? void 0 : options.keepInheritance;
1136
+ const customDefaults = calculateCustomDefaults(customization, view, validationMap, options == null ? void 0 : options.sanitize);
820
1137
  const prevDefaults = config.defaults;
821
1138
  const permissionMap = {};
822
1139
  const submodules = calculateSubmodules(config, customization, view);
823
1140
  if (submodules) {
824
1141
  permissionMap[`${view}::subModules`] = submodules;
825
1142
  }
826
- const conditionMaps = calculateConditions(config, customization, view);
1143
+ const conditionMaps = (options == null ? void 0 : options.viewConditionals) === false ? void 0 : calculateConditions(config, customization, view, keepAliases);
827
1144
  Object.assign(permissionMap, calculatePermissionMap(config, customization, {
828
1145
  viewKeys: viewDefinition,
829
1146
  viewPrefix: view,
830
1147
  prevDefaults,
831
1148
  customDefaults,
832
- conditionMaps
1149
+ conditionMaps,
1150
+ keepAliases
833
1151
  }));
834
1152
  return permissionMap;
835
1153
  }
@@ -847,12 +1165,16 @@ var matchWildcard = /* @__PURE__ */ __name((pattern, value) => {
847
1165
  const regexPattern = new RegExp("^" + pattern.replace(/\./g, "\\.").replace(/\*/g, ".*") + "$");
848
1166
  return regexPattern.test(value);
849
1167
  }, "matchWildcard");
850
- function keyIsIncludedInKeep(key, customization) {
1168
+ function keyIsIncludedInKeep(key, customization, keepAliases) {
851
1169
  const { keep = [] } = customization;
1170
+ const alias = keepAliases == null ? void 0 : keepAliases[key];
852
1171
  for (const pattern of keep) {
853
1172
  if (pattern === key || matchWildcard(pattern, key)) {
854
1173
  return true;
855
1174
  }
1175
+ if (alias && (pattern === alias || matchWildcard(pattern, alias))) {
1176
+ return true;
1177
+ }
856
1178
  }
857
1179
  return false;
858
1180
  }
@@ -867,10 +1189,11 @@ function keyIsIncludedInRemove(key, customization) {
867
1189
  return false;
868
1190
  }
869
1191
  __name(keyIsIncludedInRemove, "keyIsIncludedInRemove");
870
- function canInsertInCustomization(key, customization, validateKeepOption) {
1192
+ function canInsertInCustomization(key, customization, validateKeepOption, keepAliases) {
871
1193
  const includedInRemove = keyIsIncludedInRemove(key, customization);
872
- const canInsert = !includedInRemove && (!validateKeepOption || keyIsIncludedInKeep(key, customization));
873
- const keepValue = keyIsIncludedInKeep(key, customization) ? "keep" : "remove";
1194
+ const includedInKeep = keyIsIncludedInKeep(key, customization, keepAliases);
1195
+ const canInsert = !includedInRemove && (!validateKeepOption || includedInKeep);
1196
+ const keepValue = includedInKeep ? "keep" : "remove";
874
1197
  const keepResult = validateKeepOption ? keepValue : false;
875
1198
  const conditionAffect = includedInRemove ? "remove" : keepResult;
876
1199
  return {
@@ -879,14 +1202,14 @@ function canInsertInCustomization(key, customization, validateKeepOption) {
879
1202
  };
880
1203
  }
881
1204
  __name(canInsertInCustomization, "canInsertInCustomization");
882
- function evalInsertKey(key, { viewKeys, viewPrefix = "", hasKeepOption }, customization) {
1205
+ function evalInsertKey(key, { viewKeys, viewPrefix = "", hasKeepOption, keepAliases }, customization) {
883
1206
  var _a;
884
1207
  const customizationView = (_a = customization == null ? void 0 : customization.views) == null ? void 0 : _a[viewPrefix];
885
- const custCanInsert = customization ? canInsertInCustomization(key, customization, hasKeepOption === "root") : {
1208
+ const custCanInsert = customization ? canInsertInCustomization(key, customization, hasKeepOption === "root", keepAliases) : {
886
1209
  canInsert: true,
887
1210
  conditionAffect: false
888
1211
  };
889
- const custViewCanInsert = customizationView ? canInsertInCustomization(key, customizationView, hasKeepOption === "view") : {
1212
+ const custViewCanInsert = customizationView ? canInsertInCustomization(key, customizationView, hasKeepOption === "view", keepAliases) : {
890
1213
  canInsert: true,
891
1214
  conditionAffect: false
892
1215
  };
@@ -898,11 +1221,13 @@ function evalInsertKey(key, { viewKeys, viewPrefix = "", hasKeepOption }, custom
898
1221
  };
899
1222
  }
900
1223
  __name(evalInsertKey, "evalInsertKey");
901
- function canInsertKey(key, { viewKeys, viewPrefix = "", hasKeepOption, checkCondition = false }, customization) {
1224
+ function canInsertKey(key, { viewKeys, viewPrefix = "", hasKeepOption, checkCondition = false, keepAliases }, customization) {
902
1225
  const result = evalInsertKey(key, {
903
1226
  viewKeys,
904
1227
  viewPrefix,
905
- hasKeepOption}, customization);
1228
+ hasKeepOption,
1229
+ keepAliases
1230
+ }, customization);
906
1231
  const canInsert = checkCondition || result.canInsert;
907
1232
  return {
908
1233
  canInsert,
@@ -928,7 +1253,7 @@ function addKeyToPermissions(permissionMap, key, { viewPrefix, checkCondition, c
928
1253
  });
929
1254
  }
930
1255
  __name(addKeyToPermissions, "addKeyToPermissions");
931
- function calculatePermissionMap(config, customization, { viewKeys, pathPrefix = "", viewPrefix = "", hasKeepOption: previousKeepOption, prevDefaults, customDefaults, conditionMaps, checkCondition }) {
1256
+ function calculatePermissionMap(config, customization, { viewKeys, pathPrefix = "", viewPrefix = "", hasKeepOption: previousKeepOption, prevDefaults, customDefaults, conditionMaps, checkCondition, keepAliases }) {
932
1257
  const permissionMap = {};
933
1258
  const currentKeepOption = nodeHasKeepOption(config, customization, {
934
1259
  viewPrefix,
@@ -946,7 +1271,8 @@ function calculatePermissionMap(config, customization, { viewKeys, pathPrefix =
946
1271
  viewKeys,
947
1272
  viewPrefix,
948
1273
  hasKeepOption,
949
- checkCondition
1274
+ checkCondition,
1275
+ keepAliases
950
1276
  }, customization);
951
1277
  if (!canInsertResult.canInsert) {
952
1278
  continue;
@@ -962,7 +1288,8 @@ function calculatePermissionMap(config, customization, { viewKeys, pathPrefix =
962
1288
  prevDefaults,
963
1289
  customDefaults,
964
1290
  conditionMaps,
965
- checkCondition
1291
+ checkCondition,
1292
+ keepAliases
966
1293
  });
967
1294
  Object.assign(permissionMap, childMap);
968
1295
  } else if (typeof configValue === "object" && !Array.isArray(configValue)) {
@@ -973,7 +1300,8 @@ function calculatePermissionMap(config, customization, { viewKeys, pathPrefix =
973
1300
  pathPrefix: newPrefix,
974
1301
  prevDefaults: defaults,
975
1302
  conditionMaps,
976
- checkCondition
1303
+ checkCondition,
1304
+ keepAliases
977
1305
  });
978
1306
  Object.assign(permissionMap, childMap);
979
1307
  } else if (typeof configValue === "boolean" && !configValue) {
@@ -1006,7 +1334,7 @@ function getConditionsForKey(key, conditionMaps) {
1006
1334
  return result;
1007
1335
  }
1008
1336
  __name(getConditionsForKey, "getConditionsForKey");
1009
- function calculateConditions(config, customization, view) {
1337
+ function calculateConditions(config, customization, view, keepAliases) {
1010
1338
  var _a, _b, _c;
1011
1339
  const rootConditionals = customization == null ? void 0 : customization.conditional;
1012
1340
  const viewConditionals = view ? (_b = (_a = customization == null ? void 0 : customization.views) == null ? void 0 : _a[view]) == null ? void 0 : _b.conditional : void 0;
@@ -1018,7 +1346,8 @@ function calculateConditions(config, customization, view) {
1018
1346
  return (_c = customConditionals == null ? void 0 : customConditionals.map((c) => ({
1019
1347
  condition: c.condition,
1020
1348
  map: calculatePermissionMap(config, c, {
1021
- checkCondition: true
1349
+ checkCondition: true,
1350
+ keepAliases
1022
1351
  })
1023
1352
  }))) != null ? _c : void 0;
1024
1353
  }
@@ -1031,12 +1360,13 @@ function calculateSubmodules(config, customization, view) {
1031
1360
  return mergeObjects(config.subModules, customSubmodules);
1032
1361
  }
1033
1362
  __name(calculateSubmodules, "calculateSubmodules");
1034
- function calculateCustomDefaults(customization, view, validationMap) {
1363
+ function calculateCustomDefaults(customization, view, validationMap, sanitize) {
1035
1364
  var _a, _b, _c;
1036
1365
  const viewDefaults = view ? (_b = (_a = customization == null ? void 0 : customization.views) == null ? void 0 : _a[view]) == null ? void 0 : _b.defaults : void 0;
1037
1366
  const customRootDefaults = (_c = customization == null ? void 0 : customization.defaults) != null ? _c : {};
1038
1367
  const defaultObj = viewDefaults ? mergeObjects(customRootDefaults, viewDefaults) : customRootDefaults;
1039
- return validationMap && defaultObj ? validateDefaults(defaultObj, validationMap) : defaultObj;
1368
+ if (!defaultObj || !validationMap && !sanitize) return defaultObj;
1369
+ return validateDefaults(defaultObj, validationMap != null ? validationMap : {}, sanitize);
1040
1370
  }
1041
1371
  __name(calculateCustomDefaults, "calculateCustomDefaults");
1042
1372
  function calculateDefaults(structureDefaults, itemDefaults, customDefaults) {
@@ -1088,7 +1418,7 @@ function nodeHasKeepOption(configValue, customization, { viewPrefix, pathPrefix
1088
1418
  return void 0;
1089
1419
  }
1090
1420
  __name(nodeHasKeepOption, "nodeHasKeepOption");
1091
- function calculatePermissionMapArray(configValue, customization, { viewKeys, viewPrefix, pathPrefix, prevDefaults, customDefaults, conditionMaps, checkCondition }) {
1421
+ function calculatePermissionMapArray(configValue, customization, { viewKeys, viewPrefix, pathPrefix, prevDefaults, customDefaults, conditionMaps, checkCondition, keepAliases }) {
1092
1422
  const permissionMap = {};
1093
1423
  const hasKeepOption = nodeHasKeepOption(configValue, customization, {
1094
1424
  viewPrefix,
@@ -1102,7 +1432,8 @@ function calculatePermissionMapArray(configValue, customization, { viewKeys, vie
1102
1432
  viewKeys,
1103
1433
  viewPrefix,
1104
1434
  hasKeepOption,
1105
- checkCondition
1435
+ checkCondition,
1436
+ keepAliases
1106
1437
  }, customization);
1107
1438
  if (!canInsertResult.canInsert) {
1108
1439
  return;
@@ -1121,7 +1452,8 @@ function calculatePermissionMapArray(configValue, customization, { viewKeys, vie
1121
1452
  prevDefaults,
1122
1453
  customDefaults,
1123
1454
  conditionMaps,
1124
- checkCondition
1455
+ checkCondition,
1456
+ keepAliases
1125
1457
  }));
1126
1458
  }
1127
1459
  });
@@ -1130,21 +1462,31 @@ function calculatePermissionMapArray(configValue, customization, { viewKeys, vie
1130
1462
  __name(calculatePermissionMapArray, "calculatePermissionMapArray");
1131
1463
 
1132
1464
  // src/structural-manager.ts
1133
- function buildStructure(widget, customization, version) {
1465
+ function getWidgetConfig(widget, version) {
1134
1466
  var _a;
1135
1467
  const versionSet = version != null ? version : WidgetVersion.latest;
1136
1468
  const widgetConfigurability = (_a = widgetConfigs[widget]) == null ? void 0 : _a[versionSet];
1137
1469
  if (!widgetConfigurability) {
1138
1470
  throw new Error(`No config found for widget ${widget} and version ${version}`);
1139
1471
  }
1140
- const structureMap = getWidgetStructure(widgetConfigurability, customization, DX_VALIDATOR_MAP);
1141
- return new WidgetStructureInstance(structureMap);
1472
+ return widgetConfigurability;
1473
+ }
1474
+ __name(getWidgetConfig, "getWidgetConfig");
1475
+ function buildStructure(widget, customization, version, options) {
1476
+ var _a;
1477
+ const config = getWidgetConfig(widget, version);
1478
+ const validationMap = (_a = options == null ? void 0 : options.validationMap) != null ? _a : widgetValidators[widget];
1479
+ const structureMap = getWidgetStructure(config, customization, validationMap, options);
1480
+ const rootDefaults = config.baseStructure.views ? void 0 : calculateRootDefaults(config.baseStructure, customization, validationMap, options == null ? void 0 : options.sanitize);
1481
+ return new WidgetStructureInstance(structureMap, rootDefaults);
1142
1482
  }
1143
1483
  __name(buildStructure, "buildStructure");
1144
1484
  var _WidgetStructureInstance = class _WidgetStructureInstance {
1145
- constructor(viewMap) {
1485
+ constructor(viewMap, rootDefaults) {
1146
1486
  __publicField(this, "viewMap");
1487
+ __publicField(this, "rootDefaults");
1147
1488
  this.viewMap = viewMap;
1489
+ this.rootDefaults = rootDefaults;
1148
1490
  }
1149
1491
  getValue(key) {
1150
1492
  return this.viewMap[key];
@@ -1162,20 +1504,154 @@ var _WidgetStructureInstance = class _WidgetStructureInstance {
1162
1504
  if (!value || typeof value === "boolean" || typeof value === "string" || !value.childMap) return void 0;
1163
1505
  return value.childMap;
1164
1506
  }
1165
- getSubmodule(module, view) {
1507
+ getSubmodule(module2, view) {
1166
1508
  const key = `${view ? view + "::" : ""}subModules`;
1167
1509
  const value = this.getValue(key);
1168
- return value == null ? void 0 : value[module];
1510
+ return value == null ? void 0 : value[module2];
1169
1511
  }
1170
1512
  getDefaults(key) {
1171
1513
  const value = this.getValue(key);
1172
1514
  if (!value || typeof value === "boolean" || typeof value === "string" || !value.defaults) return void 0;
1173
1515
  return value.defaults;
1174
1516
  }
1517
+ getRootDefaults() {
1518
+ return this.rootDefaults;
1519
+ }
1520
+ /**
1521
+ * Re-roots a resolved section (`design::downloadModal`) as plain JSON another bundle can rebuild a structure from.
1522
+ */
1523
+ scope(prefixKey, options = {}) {
1524
+ var _a;
1525
+ const { widget, version, state } = options;
1526
+ const present = this.isVisible(prefixKey, state);
1527
+ const sectionPath = (_a = prefixKey.split(STRUCTURE_VIEW_NAME_SEPARATOR).pop()) != null ? _a : prefixKey;
1528
+ const namespace = options.defaultsNamespace === void 0 ? sectionPath.split(STRUCTURE_SECTION_NAME_SEPARATOR).pop() : options.defaultsNamespace;
1529
+ const sectionDefaults = present ? this.getDefaults(prefixKey) : void 0;
1530
+ const defaults = namespace ? sectionDefaults == null ? void 0 : sectionDefaults[namespace] : sectionDefaults;
1531
+ const childPrefix = `${prefixKey}${STRUCTURE_SECTION_NAME_SEPARATOR}`;
1532
+ const map = {};
1533
+ let structureVersion;
1534
+ if (widget) {
1535
+ const config = getWidgetConfig(widget, version);
1536
+ structureVersion = config.version;
1537
+ Object.keys(calculateViewMap(config.baseStructure)).filter((key) => key !== "subModules").forEach((key) => {
1538
+ map[key] = present && this.isVisible(`${childPrefix}${key}`, state);
1539
+ });
1540
+ } else if (present) {
1541
+ Object.keys(this.viewMap).filter((key) => key.startsWith(childPrefix)).forEach((key) => {
1542
+ if (this.isVisible(key, state)) {
1543
+ map[key.slice(childPrefix.length)] = true;
1544
+ }
1545
+ });
1546
+ }
1547
+ return JSON.parse(JSON.stringify({
1548
+ kind: WIDGET_STRUCTURE_SCOPE_KIND,
1549
+ format: WIDGET_STRUCTURE_SCOPE_FORMAT,
1550
+ widget,
1551
+ structureVersion,
1552
+ source: prefixKey,
1553
+ present,
1554
+ map,
1555
+ defaults
1556
+ }));
1557
+ }
1175
1558
  };
1176
1559
  __name(_WidgetStructureInstance, "WidgetStructureInstance");
1177
1560
  var WidgetStructureInstance = _WidgetStructureInstance;
1178
1561
 
1562
+ // src/utils/scope.helpers.ts
1563
+ var isPlainObject = /* @__PURE__ */ __name((value) => typeof value === "object" && value !== null && !Array.isArray(value), "isPlainObject");
1564
+ function isWidgetStructureScope(value) {
1565
+ return isPlainObject(value) && value.kind === WIDGET_STRUCTURE_SCOPE_KIND;
1566
+ }
1567
+ __name(isWidgetStructureScope, "isWidgetStructureScope");
1568
+ function scopeToCustomization(scope) {
1569
+ var _a;
1570
+ const remove = scope.present ? Object.keys((_a = scope.map) != null ? _a : {}).filter((key) => scope.map[key] === false) : [
1571
+ "*"
1572
+ ];
1573
+ return __spreadValues(__spreadValues({}, remove.length ? {
1574
+ remove
1575
+ } : {}), scope.defaults ? {
1576
+ defaults: scope.defaults
1577
+ } : {});
1578
+ }
1579
+ __name(scopeToCustomization, "scopeToCustomization");
1580
+ function extractCustomization(host, customization, prefixKey, target, options) {
1581
+ const hostStructure = buildStructure(host, customization, void 0, options);
1582
+ return scopeToCustomization(hostStructure.scope(prefixKey, {
1583
+ widget: target
1584
+ }));
1585
+ }
1586
+ __name(extractCustomization, "extractCustomization");
1587
+ function submoduleOf(input, module2, view) {
1588
+ var _a, _b, _c, _d;
1589
+ const root = (_a = input.subModules) == null ? void 0 : _a[module2];
1590
+ const fromView = view ? (_d = (_c = (_b = input.views) == null ? void 0 : _b[view]) == null ? void 0 : _c.subModules) == null ? void 0 : _d[module2] : void 0;
1591
+ if (!fromView) return root;
1592
+ return root ? mergeDeep(root, fromView) : fromView;
1593
+ }
1594
+ __name(submoduleOf, "submoduleOf");
1595
+ function structureFrom(widget, input, view, version) {
1596
+ if (input === void 0 || input === null) return void 0;
1597
+ try {
1598
+ if (!isPlainObject(input)) {
1599
+ throw new Error("expected an object");
1600
+ }
1601
+ if ("kind" in input) {
1602
+ if (!isWidgetStructureScope(input)) {
1603
+ throw new Error(`unknown kind ${String(input.kind)}`);
1604
+ }
1605
+ if (input.format !== WIDGET_STRUCTURE_SCOPE_FORMAT) {
1606
+ throw new Error(`unknown scope format ${input.format}`);
1607
+ }
1608
+ if (input.widget && input.widget !== widget) {
1609
+ throw new Error(`scope of ${input.widget}, expected ${widget}`);
1610
+ }
1611
+ return buildStructure(widget, scopeToCustomization(input), version);
1612
+ }
1613
+ const customization = input;
1614
+ const module2 = WIDGET_SUBMODULE_NAMES[widget];
1615
+ const submodule = module2 ? submoduleOf(customization, module2, view) : void 0;
1616
+ return buildStructure(widget, submodule != null ? submodule : customization, version);
1617
+ } catch (error) {
1618
+ console.warn(`[widget-configurability] ignoring the ${widget} customization: ${error.message}`);
1619
+ return void 0;
1620
+ }
1621
+ }
1622
+ __name(structureFrom, "structureFrom");
1623
+ function structureFromSubmodule(parent, module2, view, options) {
1624
+ const widget = Object.keys(WIDGET_SUBMODULE_NAMES).find((key) => WIDGET_SUBMODULE_NAMES[key] === module2);
1625
+ if (!widget) {
1626
+ throw new Error(`No widget registered for the submodule ${module2}`);
1627
+ }
1628
+ return buildStructure(widget, parent.getSubmodule(module2, view), void 0, options);
1629
+ }
1630
+ __name(structureFromSubmodule, "structureFromSubmodule");
1631
+
1632
+ // src/utils/download-modal.helpers.ts
1633
+ function resolveDownloadModalConfig(structure, { organizationAvailable = true } = {}) {
1634
+ var _a;
1635
+ const visible = /* @__PURE__ */ __name((key) => structure.isVisible(key), "visible");
1636
+ const elements = {
1637
+ banner: visible("qSubscribeBanner"),
1638
+ owner: visible("qSubscribeOwner"),
1639
+ organization: visible("qSubscribeOrganization"),
1640
+ myself: visible("qSubscribeMyself"),
1641
+ specificPeople: visible("qSubscribeSpecificPeople")
1642
+ };
1643
+ const schedule = visible("qScheduleOption");
1644
+ const anyElement = elements.banner || elements.owner || organizationAvailable && elements.organization || elements.myself || elements.specificPeople;
1645
+ return __spreadProps(__spreadValues({}, elements), {
1646
+ schedule,
1647
+ subscribe: schedule && visible("qSubscribeOption") && anyElement,
1648
+ externalUsers: visible("qSubscribeExternalUsers"),
1649
+ // A rejected value comes back undefined, which keeps the checkbox checked as it always started.
1650
+ subscribeMyselfDefault: ((_a = structure.getRootDefaults()) == null ? void 0 : _a.subscribeMyself) !== false
1651
+ });
1652
+ }
1653
+ __name(resolveDownloadModalConfig, "resolveDownloadModalConfig");
1654
+
1179
1655
  // src/doc/dashboard.structure.doc.ts
1180
1656
  var dashboard_structure_doc_exports = {};
1181
1657
  __export(dashboard_structure_doc_exports, {
@@ -1189,8 +1665,9 @@ __export(dashboard_structure_doc_exports, {
1189
1665
 
1190
1666
  // src/doc/swagger.optional.ts
1191
1667
  var ApiProperty;
1668
+ var nodeRequire = typeof module !== "undefined" && typeof module.require === "function" ? module.require.bind(module) : void 0;
1192
1669
  try {
1193
- ApiProperty = __require("@nestjs/swagger").ApiProperty;
1670
+ ApiProperty = nodeRequire("@nestjs/swagger").ApiProperty;
1194
1671
  } catch (e) {
1195
1672
  ApiProperty = /* @__PURE__ */ __name((metadata) => {
1196
1673
  return () => {
@@ -1764,7 +2241,15 @@ _ts_decorate([
1764
2241
  "qScheduleOption",
1765
2242
  "qSubscribeOption",
1766
2243
  "qSubscribeExternalUsers",
1767
- "qIncludeHyperlinks"
2244
+ "qSubscribeBanner",
2245
+ "qSubscribeOwner",
2246
+ "qSubscribeOrganization",
2247
+ "qSubscribeMyself",
2248
+ "qSubscribeSpecificPeople",
2249
+ "qIncludeHyperlinks",
2250
+ "qExportVersion",
2251
+ "qSavedVersionWarning",
2252
+ "qUnsavedVersionWarning"
1768
2253
  ]
1769
2254
  }),
1770
2255
  _ts_metadata("design:type", Array)
@@ -1777,6 +2262,6 @@ _ts_decorate([
1777
2262
  _ts_metadata("design:type", typeof SubModulesDto === "undefined" ? Object : SubModulesDto)
1778
2263
  ], BaseDashboardV1StructureDto.prototype, "subModules", void 0);
1779
2264
 
1780
- export { dashboard_structure_doc_exports as DashboardDoc, Widget, WidgetStructureInstance, WidgetVersion, buildStructure };
2265
+ export { DOWNLOAD_MODAL_V1_DEFAULTS, DOWNLOAD_MODAL_V1_KEYS, DOWNLOAD_MODAL_VALIDATOR_MAP, DX_VALIDATOR_MAP, dashboard_structure_doc_exports as DashboardDoc, WIDGET_STRUCTURE_SCOPE_FORMAT, WIDGET_STRUCTURE_SCOPE_KIND, WIDGET_SUBMODULE_NAMES, Widget, WidgetStructureInstance, WidgetVersion, buildStructure, calculateRootDefaults, calculateViewMap, checkConditions, evaluateCondition, extractCustomization, getWidgetConfig, getWidgetStructure, isWidgetStructureScope, resolveDownloadModalConfig, scopeToCustomization, structureFrom, structureFromSubmodule, validateBoolean, validateDefaults };
1781
2266
  //# sourceMappingURL=index.mjs.map
1782
2267
  //# sourceMappingURL=index.mjs.map