@bino-bi/bn-template-engine 1.0.0-alpha.4 → 1.0.0-alpha.6

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 (166) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/p-06946f44.entry.js +1 -0
  3. package/dist/bn-template-engine/p-0fabe296.entry.js +1 -0
  4. package/dist/bn-template-engine/p-1164c0b0.entry.js +1 -0
  5. package/dist/bn-template-engine/p-355abdf0.entry.js +1 -0
  6. package/dist/bn-template-engine/p-79KuA4Ox.js +1 -0
  7. package/dist/bn-template-engine/p-859cc06d.entry.js +1 -0
  8. package/dist/bn-template-engine/p-8acec99e.entry.js +1 -0
  9. package/dist/bn-template-engine/p-8f490c45.entry.js +1 -0
  10. package/dist/bn-template-engine/p-98cf512f.entry.js +1 -0
  11. package/dist/bn-template-engine/p-9a564f8f.entry.js +1 -0
  12. package/dist/bn-template-engine/{p-CL1RYuNU.js → p-B0lsgVuN.js} +1 -1
  13. package/dist/bn-template-engine/p-B7p8beYH.js +1 -0
  14. package/dist/bn-template-engine/p-BDh7GfC5.js +1 -0
  15. package/dist/bn-template-engine/p-BoMtoHJB.js +1 -0
  16. package/dist/bn-template-engine/p-Bs8BqBsb.js +1 -0
  17. package/dist/bn-template-engine/p-CYjZRKdI.js +1 -0
  18. package/dist/bn-template-engine/{p-P7pGJBgc.js → p-DG-1MR_T.js} +1 -1
  19. package/dist/bn-template-engine/p-bdd2b243.entry.js +1 -0
  20. package/dist/bn-template-engine/p-e6b24f15.entry.js +1 -0
  21. package/dist/bn-template-engine/p-f27995c9.entry.js +1 -0
  22. package/dist/bn-template-engine/{p-Bnhh02CF.js → p-sRO-lj7X.js} +1 -1
  23. package/dist/bn-template-engine/p-tzFCK9qn.js +1 -0
  24. package/dist/cjs/{Order-iG11HI4R.js → Order-BGx39pS5.js} +448 -0
  25. package/dist/cjs/{alasql.min-C_nHTuEQ.js → SVGVariancesStyleGroup-BqAdPYtL.js} +8228 -3
  26. package/dist/cjs/bn-asset_16.cjs.entry.js +9018 -0
  27. package/dist/cjs/bn-card.cjs.entry.js +3 -4
  28. package/dist/cjs/bn-chart-time.cjs.entry.js +11 -16
  29. package/dist/cjs/bn-grid.cjs.entry.js +5 -8
  30. package/dist/cjs/bn-image.cjs.entry.js +5 -8
  31. package/dist/cjs/bn-internationalization.cjs.entry.js +3 -4
  32. package/dist/cjs/bn-layout-card.cjs.entry.js +125 -6
  33. package/dist/cjs/bn-template-engine.cjs.js +1 -1
  34. package/dist/cjs/bn-template.cjs.entry.js +2 -3
  35. package/dist/cjs/bn-text.cjs.entry.js +7 -11
  36. package/dist/cjs/bn-tree.cjs.entry.js +5 -8
  37. package/dist/cjs/{formatter-DIJL_crx.js → formatter-4XCS0d2B.js} +8 -2
  38. package/dist/cjs/ibcs-chart-time.cjs.entry.js +37 -42
  39. package/dist/cjs/loader.cjs.js +1 -1
  40. package/dist/cjs/{scaling-9Tz595RQ.js → scaling-BidPsO53.js} +115 -12
  41. package/dist/cjs/{withBodyObserver-CKpSD8UT.js → withBodyObserver-C6gLgq_e.js} +3 -3
  42. package/dist/cjs/{withComponentStatus-Bw70BhO0.js → withComponentStatus-_x4LQZ0N.js} +5 -5
  43. package/dist/cjs/{withComponentStyle-aIbTCtfj.js → withComponentStyle-ClSJfCku.js} +4 -4
  44. package/dist/cjs/{utils-CwHIVbbL.js → withHasError-B8gHkfV2.js} +69 -1
  45. package/dist/cjs/{withStyled-CS1Yp4sv.js → withStyled-9tG024gQ.js} +62 -9
  46. package/dist/collection/components/bn-chart-structure/utils/elements/Label.js +11 -0
  47. package/dist/collection/components/bn-chart-structure/utils/elements/StackedBar.js +5 -2
  48. package/dist/collection/components/bn-layout-card/bn-layout-card.css +1 -0
  49. package/dist/collection/components/bn-layout-card/bn-layout-card.js +162 -27
  50. package/dist/collection/components/bn-layout-page/bn-layout-page.css +1 -0
  51. package/dist/collection/components/bn-layout-page/bn-layout-page.js +151 -33
  52. package/dist/collection/components/bn-table/bn-table.js +12 -10
  53. package/dist/collection/components/bn-table/ibcs-table.js +2 -2
  54. package/dist/collection/utils/parentDimensions.js +38 -6
  55. package/dist/components/bn-layout-card.js +1 -1
  56. package/dist/components/bn-layout-page.js +1 -1
  57. package/dist/components/bn-table.js +1 -1
  58. package/dist/components/ibcs-chart-structure2.js +1 -1
  59. package/dist/components/ibcs-table2.js +1 -1
  60. package/dist/components/scaling.js +1 -1
  61. package/dist/esm/{Order-Bnhh02CF.js → Order-sRO-lj7X.js} +448 -1
  62. package/dist/esm/{alasql.min-CWu4NkIt.js → SVGVariancesStyleGroup-DOIT-zvI.js} +8212 -2
  63. package/dist/esm/bn-asset_16.entry.js +9001 -0
  64. package/dist/esm/bn-card.entry.js +4 -5
  65. package/dist/esm/bn-chart-time.entry.js +8 -13
  66. package/dist/esm/bn-grid.entry.js +6 -9
  67. package/dist/esm/bn-image.entry.js +6 -9
  68. package/dist/esm/bn-internationalization.entry.js +4 -5
  69. package/dist/esm/bn-layout-card.entry.js +126 -7
  70. package/dist/esm/bn-template-engine.js +1 -1
  71. package/dist/esm/bn-template.entry.js +2 -3
  72. package/dist/esm/bn-text.entry.js +7 -11
  73. package/dist/esm/bn-tree.entry.js +6 -9
  74. package/dist/esm/{context-protocol-BHnQsVsr.js → context-protocol-2peaD4y8.js} +1 -1
  75. package/dist/esm/editor-companion.entry.js +1 -1
  76. package/dist/esm/{formatter-DTMEZ6d8.js → formatter-BDh7GfC5.js} +6 -2
  77. package/dist/esm/ibcs-chart-time.entry.js +3 -8
  78. package/dist/esm/loader.js +1 -1
  79. package/dist/esm/{scaling-Cehc74IE.js → scaling-BOcjT8M0.js} +112 -10
  80. package/dist/esm/{withBodyObserver-FQ8NwCIz.js → withBodyObserver-DczL5ia8.js} +1 -1
  81. package/dist/esm/{withComponentStatus-DWjDYtZ7.js → withComponentStatus-DodoSXe-.js} +1 -1
  82. package/dist/esm/{withComponentStyle-9uP_hcDq.js → withComponentStyle-D3VWOsto.js} +2 -2
  83. package/dist/esm/{utils-DvvwfRQG.js → withHasError-B3QX2emi.js} +69 -1
  84. package/dist/esm/{withStyled--qQWquTH.js → withStyled-CE3_3taP.js} +57 -5
  85. package/dist/types/components/bn-chart-structure/utils/elements/Label.d.ts +2 -0
  86. package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +139 -0
  87. package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +154 -0
  88. package/dist/types/components/bn-table/bn-table.d.ts +7 -5
  89. package/dist/types/components.d.ts +170 -2
  90. package/dist/types/utils/parentDimensions.d.ts +6 -1
  91. package/package.json +1 -1
  92. package/dist/bn-template-engine/p-1265d8d3.entry.js +0 -1
  93. package/dist/bn-template-engine/p-15516dac.entry.js +0 -1
  94. package/dist/bn-template-engine/p-1c716641.entry.js +0 -1
  95. package/dist/bn-template-engine/p-1jFf17Vj.js +0 -1
  96. package/dist/bn-template-engine/p-27cc8dc0.entry.js +0 -1
  97. package/dist/bn-template-engine/p-4426d484.entry.js +0 -1
  98. package/dist/bn-template-engine/p-51f8dc9e.entry.js +0 -1
  99. package/dist/bn-template-engine/p-53d4e690.entry.js +0 -1
  100. package/dist/bn-template-engine/p-5KQYRQLK.js +0 -1
  101. package/dist/bn-template-engine/p-745f4596.entry.js +0 -1
  102. package/dist/bn-template-engine/p-75e97c87.entry.js +0 -1
  103. package/dist/bn-template-engine/p-7a560278.entry.js +0 -1
  104. package/dist/bn-template-engine/p-7ea7c325.entry.js +0 -1
  105. package/dist/bn-template-engine/p-945cc95d.entry.js +0 -1
  106. package/dist/bn-template-engine/p-BFTU3MAI.js +0 -1
  107. package/dist/bn-template-engine/p-BYBpC0EO.js +0 -1
  108. package/dist/bn-template-engine/p-BYmPQYxx.js +0 -1
  109. package/dist/bn-template-engine/p-BfXY5dsy.js +0 -1
  110. package/dist/bn-template-engine/p-BgnHJQ9Q.js +0 -1
  111. package/dist/bn-template-engine/p-Bhd_WSML.js +0 -1
  112. package/dist/bn-template-engine/p-Bka-Z6jo.js +0 -1
  113. package/dist/bn-template-engine/p-C7dQL8CS.js +0 -1
  114. package/dist/bn-template-engine/p-CYwd_ZNM.js +0 -1
  115. package/dist/bn-template-engine/p-ChlK-T9I.js +0 -1
  116. package/dist/bn-template-engine/p-DHezf8pZ.js +0 -1
  117. package/dist/bn-template-engine/p-DlppAFq9.js +0 -1
  118. package/dist/bn-template-engine/p-DvDDgmcV.js +0 -1
  119. package/dist/bn-template-engine/p-DvvwfRQG.js +0 -1
  120. package/dist/bn-template-engine/p-b34eaf86.entry.js +0 -1
  121. package/dist/bn-template-engine/p-bdb8b44c.entry.js +0 -1
  122. package/dist/bn-template-engine/p-c44fcb8e.entry.js +0 -1
  123. package/dist/bn-template-engine/p-c7e1a49b.entry.js +0 -1
  124. package/dist/bn-template-engine/p-d9003041.entry.js +0 -1
  125. package/dist/bn-template-engine/p-daa7ffa3.entry.js +0 -1
  126. package/dist/bn-template-engine/p-e084f50a.entry.js +0 -1
  127. package/dist/bn-template-engine/p-eaba6658.entry.js +0 -1
  128. package/dist/bn-template-engine/p-u8igQLRZ.js +0 -1
  129. package/dist/cjs/DataFormatDigits-DKcOeLNK.js +0 -142
  130. package/dist/cjs/DateStringFactory-CSKvbS8K.js +0 -452
  131. package/dist/cjs/SVGVariancesStyleGroup-K-Tw6lOD.js +0 -7960
  132. package/dist/cjs/_commonjsHelpers-BJu3ubxk.js +0 -10
  133. package/dist/cjs/bn-asset.cjs.entry.js +0 -42
  134. package/dist/cjs/bn-body_4.cjs.entry.js +0 -748
  135. package/dist/cjs/bn-chart-structure_5.cjs.entry.js +0 -3934
  136. package/dist/cjs/bn-component-style.cjs.entry.js +0 -44
  137. package/dist/cjs/bn-dataset.cjs.entry.js +0 -306
  138. package/dist/cjs/bn-layout-page.cjs.entry.js +0 -143
  139. package/dist/cjs/bn-message.cjs.entry.js +0 -52
  140. package/dist/cjs/bn-table.cjs.entry.js +0 -979
  141. package/dist/cjs/contentDecoder-JxOldq1e.js +0 -419
  142. package/dist/cjs/emotion-hash.esm-nbbEQ0Dn.js +0 -57
  143. package/dist/cjs/ibcs-table.cjs.entry.js +0 -2276
  144. package/dist/cjs/ibcsRuleSet-DgUoXOfd.js +0 -136
  145. package/dist/cjs/index-Dm85hG6t.js +0 -65
  146. package/dist/cjs/withHasError-D7ue5vAv.js +0 -72
  147. package/dist/cjs/withTranslation-rwgyITqe.js +0 -77
  148. package/dist/esm/DataFormatDigits-oSZ1hBKE.js +0 -137
  149. package/dist/esm/DateStringFactory-CSGz6TDk.js +0 -450
  150. package/dist/esm/SVGVariancesStyleGroup-CqTjrZYg.js +0 -7950
  151. package/dist/esm/_commonjsHelpers-BFTU3MAI.js +0 -7
  152. package/dist/esm/bn-asset.entry.js +0 -40
  153. package/dist/esm/bn-body_4.entry.js +0 -743
  154. package/dist/esm/bn-chart-structure_5.entry.js +0 -3928
  155. package/dist/esm/bn-component-style.entry.js +0 -42
  156. package/dist/esm/bn-dataset.entry.js +0 -304
  157. package/dist/esm/bn-layout-page.entry.js +0 -141
  158. package/dist/esm/bn-message.entry.js +0 -50
  159. package/dist/esm/bn-table.entry.js +0 -977
  160. package/dist/esm/contentDecoder-oMmxz6nJ.js +0 -416
  161. package/dist/esm/emotion-hash.esm-BYBpC0EO.js +0 -55
  162. package/dist/esm/ibcs-table.entry.js +0 -2274
  163. package/dist/esm/ibcsRuleSet-K4ytuA1f.js +0 -133
  164. package/dist/esm/index-DHezf8pZ.js +0 -65
  165. package/dist/esm/withHasError-FyY5mQ_3.js +0 -70
  166. package/dist/esm/withTranslation-BqD0Kp7b.js +0 -75
@@ -8314,6 +8314,453 @@ function friendlyDateTime(dateTimeish) {
8314
8314
  }
8315
8315
  }
8316
8316
 
8317
+ /** Granularity levels for date intervals, from YEAR down to MILLISECOND. AUTO triggers auto-detection. */
8318
+ var DateDistance;
8319
+ (function (DateDistance) {
8320
+ DateDistance["YEAR"] = "year";
8321
+ DateDistance["QUARTER"] = "quarter";
8322
+ DateDistance["MONTH"] = "month";
8323
+ DateDistance["WEEK"] = "week";
8324
+ DateDistance["DAY"] = "day";
8325
+ DateDistance["HOUR"] = "hour";
8326
+ DateDistance["MINUTE"] = "minute";
8327
+ DateDistance["SECOND"] = "second";
8328
+ DateDistance["MILLISECOND"] = "millisecond";
8329
+ DateDistance["NONE"] = "fallback";
8330
+ DateDistance["AUTO"] = "auto";
8331
+ })(DateDistance || (DateDistance = {}));
8332
+ /** IBCS date-link modes controlling how start/end dates are rendered in titles and axis labels. */
8333
+ var DateLink;
8334
+ (function (DateLink) {
8335
+ DateLink["AVG"] = "avg";
8336
+ DateLink["INTERVAL"] = "interval";
8337
+ DateLink["START"] = "start";
8338
+ DateLink["END"] = "end";
8339
+ DateLink["YTD"] = "ytd";
8340
+ DateLink["YTG"] = "ytg";
8341
+ DateLink["CUM"] = "cum";
8342
+ DateLink["MAT"] = "mat";
8343
+ DateLink["NONE"] = "none";
8344
+ DateLink["AUTO"] = "auto";
8345
+ })(DateLink || (DateLink = {}));
8346
+ /**
8347
+ * Produces formatted date strings and IBCS date-link notations for time-series charts.
8348
+ *
8349
+ * Supports configurable date formats (full and abbreviated), locale-aware formatting
8350
+ * via Luxon, smart boundary labels that append the parent period at crossings
8351
+ * (e.g. month name shown at the first day of a new month), and IBCS date-link
8352
+ * notation (AVG, YTD, YTG, CUM, MAT, INTERVAL, START, END).
8353
+ */
8354
+ class DateStringFactory {
8355
+ constructor() {
8356
+ this._dateFormat = {
8357
+ year: "yyyy",
8358
+ quarter: "q'Q' yyyy",
8359
+ month: "LLL yyyy",
8360
+ week: "'KW'WW yyyy",
8361
+ day: "dd.MM.yyyy",
8362
+ hour: "TT",
8363
+ minute: "TT",
8364
+ second: "TT",
8365
+ millisecond: "TT:SSS",
8366
+ fallback: "dd.MM.yyyy",
8367
+ };
8368
+ this._dateFormatShort = {
8369
+ year: "yy",
8370
+ quarter: "q'Q'",
8371
+ month: "LLL",
8372
+ week: "'KW'WW",
8373
+ day: "dd",
8374
+ hour: "hh'h'",
8375
+ minute: "mm'm'",
8376
+ second: "ss's'",
8377
+ millisecond: "SSS'ms'",
8378
+ fallback: "dd.MM.yyyy",
8379
+ };
8380
+ this._dateLinkFormat = {
8381
+ avg: "Ø[LINK]",
8382
+ interval: "[DATE]..[DATE2]",
8383
+ start: ".[DATE]",
8384
+ end: "[DATE].",
8385
+ ytd: "_[DATE]",
8386
+ ytg: "[DATE]_",
8387
+ cum: "[DATE]_[DATE2]",
8388
+ mat: "~[DATE]",
8389
+ none: "[DATE]",
8390
+ };
8391
+ this.locale = "de";
8392
+ this.dateFormat = this._dateFormat;
8393
+ this.dateLinkFormat = this._dateLinkFormat;
8394
+ this.dateFormatShort = this._dateFormatShort;
8395
+ }
8396
+ setDateLinkFormat(datelink) {
8397
+ this.dateLinkFormat = datelink;
8398
+ }
8399
+ setDateFormat(dateFormat) {
8400
+ this.dateFormat = dateFormat;
8401
+ }
8402
+ setDateFormatShort(dateFormatShort) {
8403
+ this.dateFormatShort = dateFormatShort;
8404
+ }
8405
+ setLocale(locale) {
8406
+ this.locale = locale;
8407
+ }
8408
+ /**
8409
+ * Converts date string based on dateFormatMap and the selected Type
8410
+ *
8411
+ * @param date
8412
+ * @param type?
8413
+ */
8414
+ getDateString(date, type) {
8415
+ return date.setLocale(this.locale).toFormat(this.dateFormat[type] || this.dateFormat["fallback"]);
8416
+ }
8417
+ /**
8418
+ * Produces abbreviated date labels that include the parent period at boundary crossings.
8419
+ *
8420
+ * For example, with MONTH granularity, most ticks show just "Jan", "Feb", etc.,
8421
+ * but the first month of a new year also appends the year ("Jan 24").
8422
+ * This avoids redundant repetition while keeping boundary context visible.
8423
+ */
8424
+ getSmartDateString(date, type) {
8425
+ switch (type) {
8426
+ case DateDistance.DAY: {
8427
+ return this.getFormatedDayDate(date);
8428
+ }
8429
+ case DateDistance.MONTH: {
8430
+ return this.getFormatedMonthDate(date);
8431
+ }
8432
+ case DateDistance.QUARTER: {
8433
+ return this.getFormatedQuarterDate(date);
8434
+ }
8435
+ case DateDistance.WEEK: {
8436
+ return this.getFormatedWeekDate(date);
8437
+ }
8438
+ case DateDistance.HOUR: {
8439
+ return this.getFormatedHourDate(date);
8440
+ }
8441
+ case DateDistance.MINUTE: {
8442
+ return this.getFormatedMinuteDate(date);
8443
+ }
8444
+ case DateDistance.SECOND: {
8445
+ return this.getFormatedSecondDate(date);
8446
+ }
8447
+ case DateDistance.MILLISECOND: {
8448
+ return this.getFormatedMilliSecondDate(date);
8449
+ }
8450
+ default: {
8451
+ return this.getDateString(date, type);
8452
+ }
8453
+ }
8454
+ }
8455
+ /**
8456
+ * Determines the best-fitting {@link DateDistance} granularity for the span between two dates.
8457
+ *
8458
+ * Cascades through granularities from finest (millisecond) to coarsest (year),
8459
+ * comparing the span against the `limit` threshold at each level. Returns the
8460
+ * first granularity where the span is below the limit, ensuring the number of
8461
+ * axis ticks stays manageable. Defaults to DAY for zero-span or null end dates.
8462
+ *
8463
+ * @param limit Maximum number of intervals before stepping up to a coarser granularity (default 32).
8464
+ */
8465
+ calculateDistanceType(start, end, limit = 32) {
8466
+ if (end == null) {
8467
+ return DateDistance.DAY;
8468
+ }
8469
+ const mStart = typeof start == "number" ? DateTime.fromMillis(start) : start;
8470
+ const mEnd = typeof end == "number" ? DateTime.fromMillis(end) : end;
8471
+ if (mEnd.diff(mStart).as("milliseconds") === 0) {
8472
+ return DateDistance.DAY;
8473
+ }
8474
+ else if (mEnd.diff(mStart).as("milliseconds") < limit) {
8475
+ return DateDistance.MILLISECOND;
8476
+ }
8477
+ else if (mEnd.diff(mStart).as("seconds") < limit) {
8478
+ return DateDistance.SECOND;
8479
+ }
8480
+ else if (mEnd.diff(mStart).as("minutes") < limit) {
8481
+ return DateDistance.MINUTE;
8482
+ }
8483
+ else if (mEnd.diff(mStart).as("hours") < limit) {
8484
+ return DateDistance.HOUR;
8485
+ }
8486
+ else if (mEnd.diff(mStart).as("days") < limit) {
8487
+ return DateDistance.DAY;
8488
+ }
8489
+ else if (mEnd.diff(mStart).as("weeks") < limit) {
8490
+ return DateDistance.WEEK;
8491
+ }
8492
+ else if (mEnd.diff(mStart).as("months") < limit) {
8493
+ return DateDistance.MONTH;
8494
+ }
8495
+ else if (mEnd.diff(mStart).as("quarters") < limit) {
8496
+ return DateDistance.QUARTER;
8497
+ }
8498
+ else {
8499
+ return DateDistance.YEAR;
8500
+ }
8501
+ }
8502
+ /**
8503
+ * Get an array of moment instances, each representing a day beween given timestamps.
8504
+ * @param {string|Date} from start date
8505
+ * @param {string|Date} to end date
8506
+ * @param dateInterval
8507
+ * @param spanLimit
8508
+ */
8509
+ datesBetween(from, to, dateInterval, spanLimit) {
8510
+ const unit = this.convertDateDistanceToMomentunitOfTime(dateInterval);
8511
+ const fromDate = from.startOf(unit);
8512
+ const toDate = to.endOf(unit);
8513
+ let span = toDate.diff(fromDate).as(unit);
8514
+ const days = [];
8515
+ if (span >= spanLimit) {
8516
+ span = spanLimit;
8517
+ }
8518
+ let currentDate = fromDate;
8519
+ do {
8520
+ days.push(currentDate);
8521
+ currentDate = currentDate.plus(this.createDiratonLike(unit, 1));
8522
+ } while (currentDate <= toDate && days.length < span);
8523
+ return days;
8524
+ }
8525
+ /**
8526
+ * Produces an IBCS date-link string combining date formatting with link notation.
8527
+ *
8528
+ * Supported modes map to IBCS conventions:
8529
+ * - `AVG`: average symbol `Ø` wrapping the interval
8530
+ * - `YTD` / `YTG`: year-to-date / year-to-go underline notation
8531
+ * - `CUM`: cumulative range `start_end`
8532
+ * - `MAT`: moving annual total `~date`
8533
+ * - `INTERVAL`: `start..end` range
8534
+ * - `START` / `END`: dot-prefixed/suffixed single date
8535
+ *
8536
+ * When start and end resolve to the same formatted string, INTERVAL is collapsed
8537
+ * to NONE to avoid redundant display. Year parts are deduplicated when both dates
8538
+ * share the same year (e.g. "Q1 .. Q3 2024" instead of "Q1 2024 .. Q3 2024").
8539
+ *
8540
+ * @param type DateDistance granularity; when AUTO, it is auto-detected via `calculateDistanceType`.
8541
+ */
8542
+ getDateLinkString(startDateTime, endDateTime, mode, type, spanLimit) {
8543
+ // No Start/ End Date exists
8544
+ if (startDateTime == null && endDateTime == null) {
8545
+ // BinoSystem.warn('NO START AND END DATE SELECTED');
8546
+ return "";
8547
+ }
8548
+ if (startDateTime == null && !(mode === DateLink.END || mode === DateLink.YTD)) {
8549
+ // BinoSystem.warn('NO START N SELECTED');
8550
+ return "";
8551
+ }
8552
+ if (endDateTime == null &&
8553
+ (DateLink.INTERVAL === mode || DateLink.CUM === mode || DateLink.END === mode || DateLink.YTD === mode)) {
8554
+ // BinoSystem.warn('NO END N SELECTED');
8555
+ return "";
8556
+ }
8557
+ const date1 = startDateTime || DateTime.now();
8558
+ const date2 = endDateTime;
8559
+ // calculate type value aka. auto-mode
8560
+ if (type === DateDistance.AUTO) {
8561
+ type = this.calculateDistanceType(date1, date2, spanLimit);
8562
+ }
8563
+ let dateString1 = this.getDateString(date1, type);
8564
+ let dateString2 = "";
8565
+ let link = DateLink.NONE;
8566
+ if (date2 != null) {
8567
+ dateString2 = this.getDateString(date2, type);
8568
+ link = DateLink.INTERVAL;
8569
+ // clean up visualisation if start and end (formated) ist identical
8570
+ if (dateString1 === dateString2 && mode === DateLink.INTERVAL) {
8571
+ // BinoSystem.warn('CHANGED INTERVAL TO NONE; START AND END ARE IDENTICAL');
8572
+ mode = DateLink.NONE;
8573
+ }
8574
+ if (dateString1 === dateString2 && mode === DateLink.AVG) {
8575
+ // BinoSystem.warn('CHANGED INTERVAL TO NONE; START AND END ARE IDENTICAL');
8576
+ link = DateLink.NONE;
8577
+ }
8578
+ if (DateLink.END === mode || DateLink.YTD === mode) {
8579
+ dateString1 = dateString2;
8580
+ }
8581
+ // clean up dateString1 if same year
8582
+ if (mode === DateLink.INTERVAL || mode === DateLink.CUM || DateLink.AVG) {
8583
+ if (type === DateDistance.QUARTER) {
8584
+ if (date1.quarter === date2.quarter && date1.year === date2.year) {
8585
+ dateString2 = dateString2.replace(" " + date2.year, "");
8586
+ }
8587
+ else if (date1.year === date2.year) {
8588
+ dateString1 = dateString1.replace(" " + date1.year, "");
8589
+ }
8590
+ }
8591
+ else if (type === DateDistance.MONTH) {
8592
+ if (date1.month === date2.month && date1.year === date2.year) {
8593
+ dateString2 = dateString2.replace(" " + date2.year, "");
8594
+ }
8595
+ else if (date1.year === date2.year) {
8596
+ dateString1 = dateString1.replace(" " + date1.year, "");
8597
+ }
8598
+ }
8599
+ else if (type === DateDistance.WEEK) {
8600
+ if (date1.weekNumber === date2.weekNumber && date1.year === date2.year) {
8601
+ dateString2 = dateString2.replace(" " + date2.year, "");
8602
+ }
8603
+ else if (date1.year === date2.year) {
8604
+ dateString1 = dateString1.replace(" " + date1.year, "");
8605
+ }
8606
+ }
8607
+ }
8608
+ }
8609
+ return this.dateLinkFormat[mode]
8610
+ .replace("[LINK]", this.dateLinkFormat[link])
8611
+ .replace("[DATE]", dateString1)
8612
+ .replace("[DATE2]", dateString2);
8613
+ }
8614
+ /** Returns an abbreviated date string using the short format map (e.g. "yy" for year, "LLL" for month). */
8615
+ getShortDateString(date, type) {
8616
+ return date
8617
+ .setLocale(this.locale)
8618
+ .toFormat(this.dateFormatShort[type] || this.dateFormatShort["fallback"]);
8619
+ }
8620
+ getFormatedDayDate(date) {
8621
+ let format = this.dateFormatShort["day"];
8622
+ if (this.isFirstInMonth(date)) {
8623
+ format += " " + this.dateFormatShort["month"];
8624
+ }
8625
+ if (this.isJanuary(date)) {
8626
+ format += " " + this.dateFormatShort["year"];
8627
+ }
8628
+ return date.setLocale(this.locale).toFormat(format);
8629
+ }
8630
+ getFormatedMonthDate(date) {
8631
+ let format = this.dateFormatShort["month"];
8632
+ if (this.isJanuary(date)) {
8633
+ format += " " + this.dateFormatShort["year"];
8634
+ }
8635
+ return date.setLocale(this.locale).toFormat(format);
8636
+ }
8637
+ getFormatedQuarterDate(date) {
8638
+ let format = this.dateFormatShort["quarter"];
8639
+ if (this.isFirstQuarter(date)) {
8640
+ format += " " + this.dateFormatShort["year"];
8641
+ }
8642
+ return date.setLocale(this.locale).toFormat(format);
8643
+ }
8644
+ getFormatedWeekDate(date) {
8645
+ let format = this.dateFormatShort["week"];
8646
+ if (this.isFirstWeek(date)) {
8647
+ format += " " + this.dateFormatShort["year"];
8648
+ }
8649
+ return date.setLocale(this.locale).toFormat(format);
8650
+ }
8651
+ getFormatedHourDate(date) {
8652
+ let format = this.dateFormatShort["hour"];
8653
+ if (this.isFirstHour(date)) {
8654
+ format += " " + this.dateFormatShort["day"];
8655
+ }
8656
+ return date.setLocale(this.locale).toFormat(format);
8657
+ }
8658
+ getFormatedMinuteDate(date) {
8659
+ let format = this.dateFormatShort["minute"];
8660
+ if (this.isFirstMinute(date)) {
8661
+ format = this.dateFormatShort["hour"] + ":" + format;
8662
+ }
8663
+ return date.setLocale(this.locale).toFormat(format);
8664
+ }
8665
+ getFormatedSecondDate(date) {
8666
+ let format = this.dateFormatShort["second"];
8667
+ if (this.isFirstSecond(date)) {
8668
+ format = this.dateFormatShort["minute"] + ":" + format;
8669
+ }
8670
+ return date.setLocale(this.locale).toFormat(format);
8671
+ }
8672
+ getFormatedMilliSecondDate(date) {
8673
+ let format = this.dateFormatShort["millisecond"];
8674
+ if (this.isFirstMilliSecond(date)) {
8675
+ format = this.dateFormatShort["second"] + ":" + format;
8676
+ }
8677
+ return date.setLocale(this.locale).toFormat(format);
8678
+ }
8679
+ isFirstInMonth(date) {
8680
+ return date.day === 1;
8681
+ }
8682
+ isJanuary(date) {
8683
+ return date.month === 1;
8684
+ }
8685
+ isFirstQuarter(date) {
8686
+ return date.quarter === 1;
8687
+ }
8688
+ isFirstWeek(date) {
8689
+ return date.weekNumber === 1;
8690
+ }
8691
+ isFirstHour(date) {
8692
+ return date.hour === 0;
8693
+ }
8694
+ isFirstMinute(date) {
8695
+ return date.minute === 0;
8696
+ }
8697
+ isFirstSecond(date) {
8698
+ return date.second === 0;
8699
+ }
8700
+ isFirstMilliSecond(date) {
8701
+ return date.millisecond === 0;
8702
+ }
8703
+ convertDateDistanceToMomentunitOfTime(dateInterval) {
8704
+ let unitOfTime;
8705
+ switch (dateInterval) {
8706
+ case DateDistance.YEAR:
8707
+ unitOfTime = "year";
8708
+ break;
8709
+ case DateDistance.MONTH:
8710
+ unitOfTime = "month";
8711
+ break;
8712
+ case DateDistance.QUARTER:
8713
+ unitOfTime = "quarter";
8714
+ break;
8715
+ case DateDistance.WEEK:
8716
+ unitOfTime = "week";
8717
+ break;
8718
+ case DateDistance.DAY:
8719
+ unitOfTime = "day";
8720
+ break;
8721
+ case DateDistance.HOUR:
8722
+ unitOfTime = "hour";
8723
+ break;
8724
+ case DateDistance.MINUTE:
8725
+ unitOfTime = "minute";
8726
+ break;
8727
+ case DateDistance.SECOND:
8728
+ unitOfTime = "second";
8729
+ break;
8730
+ case DateDistance.MILLISECOND:
8731
+ unitOfTime = "millisecond";
8732
+ break;
8733
+ default:
8734
+ unitOfTime = "day";
8735
+ }
8736
+ return unitOfTime;
8737
+ }
8738
+ createDiratonLike(unit, number) {
8739
+ switch (unit) {
8740
+ case "year":
8741
+ return { years: number };
8742
+ case "month":
8743
+ return { months: number };
8744
+ case "quarter":
8745
+ return { quarters: number };
8746
+ case "week":
8747
+ return { weeks: number };
8748
+ case "day":
8749
+ return { days: number };
8750
+ case "hour":
8751
+ return { hours: number };
8752
+ case "minute":
8753
+ return { minutes: number };
8754
+ case "second":
8755
+ return { seconds: number };
8756
+ case "millisecond":
8757
+ return { milliseconds: number };
8758
+ default:
8759
+ return { days: number };
8760
+ }
8761
+ }
8762
+ }
8763
+
8317
8764
  /**
8318
8765
  * Type-checking utility used throughout the adapter layer for safe JSON-to-domain conversion.
8319
8766
  *
@@ -8436,4 +8883,4 @@ class OrderAdapter {
8436
8883
  }
8437
8884
  }
8438
8885
 
8439
- export { AxisLabelsMode as A, BAR_COLUMN_WIDTH_EM as B, ChartMode as C, DateTime as D, I18nMode as I, MeasureType as M, OrderDirection as O, StackBy as S, TableCategoryWidth as T, OrderColumn as a, StackOrder as b, StackMode as c, DataFormat as d, TableBarColumnWidth as e, AdapterUtils as f, CompareUtil as g, Scenarios as h, Sentiments as i, AggregationLevel as j, TableType as k, OrderAdapter as l };
8886
+ export { AxisLabelsMode as A, BAR_COLUMN_WIDTH_EM as B, ChartMode as C, DateDistance as D, I18nMode as I, MeasureType as M, OrderDirection as O, StackBy as S, TableBarColumnWidth as T, OrderColumn as a, StackOrder as b, StackMode as c, Scenarios as d, Sentiments as e, AggregationLevel as f, DataFormat as g, TableType as h, TableCategoryWidth as i, DateLink as j, CompareUtil as k, DateTime as l, DateStringFactory as m, AdapterUtils as n, OrderAdapter as o };