@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
@@ -8316,6 +8316,453 @@ function friendlyDateTime(dateTimeish) {
8316
8316
  }
8317
8317
  }
8318
8318
 
8319
+ /** Granularity levels for date intervals, from YEAR down to MILLISECOND. AUTO triggers auto-detection. */
8320
+ exports.DateDistance = void 0;
8321
+ (function (DateDistance) {
8322
+ DateDistance["YEAR"] = "year";
8323
+ DateDistance["QUARTER"] = "quarter";
8324
+ DateDistance["MONTH"] = "month";
8325
+ DateDistance["WEEK"] = "week";
8326
+ DateDistance["DAY"] = "day";
8327
+ DateDistance["HOUR"] = "hour";
8328
+ DateDistance["MINUTE"] = "minute";
8329
+ DateDistance["SECOND"] = "second";
8330
+ DateDistance["MILLISECOND"] = "millisecond";
8331
+ DateDistance["NONE"] = "fallback";
8332
+ DateDistance["AUTO"] = "auto";
8333
+ })(exports.DateDistance || (exports.DateDistance = {}));
8334
+ /** IBCS date-link modes controlling how start/end dates are rendered in titles and axis labels. */
8335
+ exports.DateLink = void 0;
8336
+ (function (DateLink) {
8337
+ DateLink["AVG"] = "avg";
8338
+ DateLink["INTERVAL"] = "interval";
8339
+ DateLink["START"] = "start";
8340
+ DateLink["END"] = "end";
8341
+ DateLink["YTD"] = "ytd";
8342
+ DateLink["YTG"] = "ytg";
8343
+ DateLink["CUM"] = "cum";
8344
+ DateLink["MAT"] = "mat";
8345
+ DateLink["NONE"] = "none";
8346
+ DateLink["AUTO"] = "auto";
8347
+ })(exports.DateLink || (exports.DateLink = {}));
8348
+ /**
8349
+ * Produces formatted date strings and IBCS date-link notations for time-series charts.
8350
+ *
8351
+ * Supports configurable date formats (full and abbreviated), locale-aware formatting
8352
+ * via Luxon, smart boundary labels that append the parent period at crossings
8353
+ * (e.g. month name shown at the first day of a new month), and IBCS date-link
8354
+ * notation (AVG, YTD, YTG, CUM, MAT, INTERVAL, START, END).
8355
+ */
8356
+ class DateStringFactory {
8357
+ constructor() {
8358
+ this._dateFormat = {
8359
+ year: "yyyy",
8360
+ quarter: "q'Q' yyyy",
8361
+ month: "LLL yyyy",
8362
+ week: "'KW'WW yyyy",
8363
+ day: "dd.MM.yyyy",
8364
+ hour: "TT",
8365
+ minute: "TT",
8366
+ second: "TT",
8367
+ millisecond: "TT:SSS",
8368
+ fallback: "dd.MM.yyyy",
8369
+ };
8370
+ this._dateFormatShort = {
8371
+ year: "yy",
8372
+ quarter: "q'Q'",
8373
+ month: "LLL",
8374
+ week: "'KW'WW",
8375
+ day: "dd",
8376
+ hour: "hh'h'",
8377
+ minute: "mm'm'",
8378
+ second: "ss's'",
8379
+ millisecond: "SSS'ms'",
8380
+ fallback: "dd.MM.yyyy",
8381
+ };
8382
+ this._dateLinkFormat = {
8383
+ avg: "Ø[LINK]",
8384
+ interval: "[DATE]..[DATE2]",
8385
+ start: ".[DATE]",
8386
+ end: "[DATE].",
8387
+ ytd: "_[DATE]",
8388
+ ytg: "[DATE]_",
8389
+ cum: "[DATE]_[DATE2]",
8390
+ mat: "~[DATE]",
8391
+ none: "[DATE]",
8392
+ };
8393
+ this.locale = "de";
8394
+ this.dateFormat = this._dateFormat;
8395
+ this.dateLinkFormat = this._dateLinkFormat;
8396
+ this.dateFormatShort = this._dateFormatShort;
8397
+ }
8398
+ setDateLinkFormat(datelink) {
8399
+ this.dateLinkFormat = datelink;
8400
+ }
8401
+ setDateFormat(dateFormat) {
8402
+ this.dateFormat = dateFormat;
8403
+ }
8404
+ setDateFormatShort(dateFormatShort) {
8405
+ this.dateFormatShort = dateFormatShort;
8406
+ }
8407
+ setLocale(locale) {
8408
+ this.locale = locale;
8409
+ }
8410
+ /**
8411
+ * Converts date string based on dateFormatMap and the selected Type
8412
+ *
8413
+ * @param date
8414
+ * @param type?
8415
+ */
8416
+ getDateString(date, type) {
8417
+ return date.setLocale(this.locale).toFormat(this.dateFormat[type] || this.dateFormat["fallback"]);
8418
+ }
8419
+ /**
8420
+ * Produces abbreviated date labels that include the parent period at boundary crossings.
8421
+ *
8422
+ * For example, with MONTH granularity, most ticks show just "Jan", "Feb", etc.,
8423
+ * but the first month of a new year also appends the year ("Jan 24").
8424
+ * This avoids redundant repetition while keeping boundary context visible.
8425
+ */
8426
+ getSmartDateString(date, type) {
8427
+ switch (type) {
8428
+ case exports.DateDistance.DAY: {
8429
+ return this.getFormatedDayDate(date);
8430
+ }
8431
+ case exports.DateDistance.MONTH: {
8432
+ return this.getFormatedMonthDate(date);
8433
+ }
8434
+ case exports.DateDistance.QUARTER: {
8435
+ return this.getFormatedQuarterDate(date);
8436
+ }
8437
+ case exports.DateDistance.WEEK: {
8438
+ return this.getFormatedWeekDate(date);
8439
+ }
8440
+ case exports.DateDistance.HOUR: {
8441
+ return this.getFormatedHourDate(date);
8442
+ }
8443
+ case exports.DateDistance.MINUTE: {
8444
+ return this.getFormatedMinuteDate(date);
8445
+ }
8446
+ case exports.DateDistance.SECOND: {
8447
+ return this.getFormatedSecondDate(date);
8448
+ }
8449
+ case exports.DateDistance.MILLISECOND: {
8450
+ return this.getFormatedMilliSecondDate(date);
8451
+ }
8452
+ default: {
8453
+ return this.getDateString(date, type);
8454
+ }
8455
+ }
8456
+ }
8457
+ /**
8458
+ * Determines the best-fitting {@link DateDistance} granularity for the span between two dates.
8459
+ *
8460
+ * Cascades through granularities from finest (millisecond) to coarsest (year),
8461
+ * comparing the span against the `limit` threshold at each level. Returns the
8462
+ * first granularity where the span is below the limit, ensuring the number of
8463
+ * axis ticks stays manageable. Defaults to DAY for zero-span or null end dates.
8464
+ *
8465
+ * @param limit Maximum number of intervals before stepping up to a coarser granularity (default 32).
8466
+ */
8467
+ calculateDistanceType(start, end, limit = 32) {
8468
+ if (end == null) {
8469
+ return exports.DateDistance.DAY;
8470
+ }
8471
+ const mStart = typeof start == "number" ? DateTime.fromMillis(start) : start;
8472
+ const mEnd = typeof end == "number" ? DateTime.fromMillis(end) : end;
8473
+ if (mEnd.diff(mStart).as("milliseconds") === 0) {
8474
+ return exports.DateDistance.DAY;
8475
+ }
8476
+ else if (mEnd.diff(mStart).as("milliseconds") < limit) {
8477
+ return exports.DateDistance.MILLISECOND;
8478
+ }
8479
+ else if (mEnd.diff(mStart).as("seconds") < limit) {
8480
+ return exports.DateDistance.SECOND;
8481
+ }
8482
+ else if (mEnd.diff(mStart).as("minutes") < limit) {
8483
+ return exports.DateDistance.MINUTE;
8484
+ }
8485
+ else if (mEnd.diff(mStart).as("hours") < limit) {
8486
+ return exports.DateDistance.HOUR;
8487
+ }
8488
+ else if (mEnd.diff(mStart).as("days") < limit) {
8489
+ return exports.DateDistance.DAY;
8490
+ }
8491
+ else if (mEnd.diff(mStart).as("weeks") < limit) {
8492
+ return exports.DateDistance.WEEK;
8493
+ }
8494
+ else if (mEnd.diff(mStart).as("months") < limit) {
8495
+ return exports.DateDistance.MONTH;
8496
+ }
8497
+ else if (mEnd.diff(mStart).as("quarters") < limit) {
8498
+ return exports.DateDistance.QUARTER;
8499
+ }
8500
+ else {
8501
+ return exports.DateDistance.YEAR;
8502
+ }
8503
+ }
8504
+ /**
8505
+ * Get an array of moment instances, each representing a day beween given timestamps.
8506
+ * @param {string|Date} from start date
8507
+ * @param {string|Date} to end date
8508
+ * @param dateInterval
8509
+ * @param spanLimit
8510
+ */
8511
+ datesBetween(from, to, dateInterval, spanLimit) {
8512
+ const unit = this.convertDateDistanceToMomentunitOfTime(dateInterval);
8513
+ const fromDate = from.startOf(unit);
8514
+ const toDate = to.endOf(unit);
8515
+ let span = toDate.diff(fromDate).as(unit);
8516
+ const days = [];
8517
+ if (span >= spanLimit) {
8518
+ span = spanLimit;
8519
+ }
8520
+ let currentDate = fromDate;
8521
+ do {
8522
+ days.push(currentDate);
8523
+ currentDate = currentDate.plus(this.createDiratonLike(unit, 1));
8524
+ } while (currentDate <= toDate && days.length < span);
8525
+ return days;
8526
+ }
8527
+ /**
8528
+ * Produces an IBCS date-link string combining date formatting with link notation.
8529
+ *
8530
+ * Supported modes map to IBCS conventions:
8531
+ * - `AVG`: average symbol `Ø` wrapping the interval
8532
+ * - `YTD` / `YTG`: year-to-date / year-to-go underline notation
8533
+ * - `CUM`: cumulative range `start_end`
8534
+ * - `MAT`: moving annual total `~date`
8535
+ * - `INTERVAL`: `start..end` range
8536
+ * - `START` / `END`: dot-prefixed/suffixed single date
8537
+ *
8538
+ * When start and end resolve to the same formatted string, INTERVAL is collapsed
8539
+ * to NONE to avoid redundant display. Year parts are deduplicated when both dates
8540
+ * share the same year (e.g. "Q1 .. Q3 2024" instead of "Q1 2024 .. Q3 2024").
8541
+ *
8542
+ * @param type DateDistance granularity; when AUTO, it is auto-detected via `calculateDistanceType`.
8543
+ */
8544
+ getDateLinkString(startDateTime, endDateTime, mode, type, spanLimit) {
8545
+ // No Start/ End Date exists
8546
+ if (startDateTime == null && endDateTime == null) {
8547
+ // BinoSystem.warn('NO START AND END DATE SELECTED');
8548
+ return "";
8549
+ }
8550
+ if (startDateTime == null && !(mode === exports.DateLink.END || mode === exports.DateLink.YTD)) {
8551
+ // BinoSystem.warn('NO START N SELECTED');
8552
+ return "";
8553
+ }
8554
+ if (endDateTime == null &&
8555
+ (exports.DateLink.INTERVAL === mode || exports.DateLink.CUM === mode || exports.DateLink.END === mode || exports.DateLink.YTD === mode)) {
8556
+ // BinoSystem.warn('NO END N SELECTED');
8557
+ return "";
8558
+ }
8559
+ const date1 = startDateTime || DateTime.now();
8560
+ const date2 = endDateTime;
8561
+ // calculate type value aka. auto-mode
8562
+ if (type === exports.DateDistance.AUTO) {
8563
+ type = this.calculateDistanceType(date1, date2, spanLimit);
8564
+ }
8565
+ let dateString1 = this.getDateString(date1, type);
8566
+ let dateString2 = "";
8567
+ let link = exports.DateLink.NONE;
8568
+ if (date2 != null) {
8569
+ dateString2 = this.getDateString(date2, type);
8570
+ link = exports.DateLink.INTERVAL;
8571
+ // clean up visualisation if start and end (formated) ist identical
8572
+ if (dateString1 === dateString2 && mode === exports.DateLink.INTERVAL) {
8573
+ // BinoSystem.warn('CHANGED INTERVAL TO NONE; START AND END ARE IDENTICAL');
8574
+ mode = exports.DateLink.NONE;
8575
+ }
8576
+ if (dateString1 === dateString2 && mode === exports.DateLink.AVG) {
8577
+ // BinoSystem.warn('CHANGED INTERVAL TO NONE; START AND END ARE IDENTICAL');
8578
+ link = exports.DateLink.NONE;
8579
+ }
8580
+ if (exports.DateLink.END === mode || exports.DateLink.YTD === mode) {
8581
+ dateString1 = dateString2;
8582
+ }
8583
+ // clean up dateString1 if same year
8584
+ if (mode === exports.DateLink.INTERVAL || mode === exports.DateLink.CUM || exports.DateLink.AVG) {
8585
+ if (type === exports.DateDistance.QUARTER) {
8586
+ if (date1.quarter === date2.quarter && date1.year === date2.year) {
8587
+ dateString2 = dateString2.replace(" " + date2.year, "");
8588
+ }
8589
+ else if (date1.year === date2.year) {
8590
+ dateString1 = dateString1.replace(" " + date1.year, "");
8591
+ }
8592
+ }
8593
+ else if (type === exports.DateDistance.MONTH) {
8594
+ if (date1.month === date2.month && date1.year === date2.year) {
8595
+ dateString2 = dateString2.replace(" " + date2.year, "");
8596
+ }
8597
+ else if (date1.year === date2.year) {
8598
+ dateString1 = dateString1.replace(" " + date1.year, "");
8599
+ }
8600
+ }
8601
+ else if (type === exports.DateDistance.WEEK) {
8602
+ if (date1.weekNumber === date2.weekNumber && date1.year === date2.year) {
8603
+ dateString2 = dateString2.replace(" " + date2.year, "");
8604
+ }
8605
+ else if (date1.year === date2.year) {
8606
+ dateString1 = dateString1.replace(" " + date1.year, "");
8607
+ }
8608
+ }
8609
+ }
8610
+ }
8611
+ return this.dateLinkFormat[mode]
8612
+ .replace("[LINK]", this.dateLinkFormat[link])
8613
+ .replace("[DATE]", dateString1)
8614
+ .replace("[DATE2]", dateString2);
8615
+ }
8616
+ /** Returns an abbreviated date string using the short format map (e.g. "yy" for year, "LLL" for month). */
8617
+ getShortDateString(date, type) {
8618
+ return date
8619
+ .setLocale(this.locale)
8620
+ .toFormat(this.dateFormatShort[type] || this.dateFormatShort["fallback"]);
8621
+ }
8622
+ getFormatedDayDate(date) {
8623
+ let format = this.dateFormatShort["day"];
8624
+ if (this.isFirstInMonth(date)) {
8625
+ format += " " + this.dateFormatShort["month"];
8626
+ }
8627
+ if (this.isJanuary(date)) {
8628
+ format += " " + this.dateFormatShort["year"];
8629
+ }
8630
+ return date.setLocale(this.locale).toFormat(format);
8631
+ }
8632
+ getFormatedMonthDate(date) {
8633
+ let format = this.dateFormatShort["month"];
8634
+ if (this.isJanuary(date)) {
8635
+ format += " " + this.dateFormatShort["year"];
8636
+ }
8637
+ return date.setLocale(this.locale).toFormat(format);
8638
+ }
8639
+ getFormatedQuarterDate(date) {
8640
+ let format = this.dateFormatShort["quarter"];
8641
+ if (this.isFirstQuarter(date)) {
8642
+ format += " " + this.dateFormatShort["year"];
8643
+ }
8644
+ return date.setLocale(this.locale).toFormat(format);
8645
+ }
8646
+ getFormatedWeekDate(date) {
8647
+ let format = this.dateFormatShort["week"];
8648
+ if (this.isFirstWeek(date)) {
8649
+ format += " " + this.dateFormatShort["year"];
8650
+ }
8651
+ return date.setLocale(this.locale).toFormat(format);
8652
+ }
8653
+ getFormatedHourDate(date) {
8654
+ let format = this.dateFormatShort["hour"];
8655
+ if (this.isFirstHour(date)) {
8656
+ format += " " + this.dateFormatShort["day"];
8657
+ }
8658
+ return date.setLocale(this.locale).toFormat(format);
8659
+ }
8660
+ getFormatedMinuteDate(date) {
8661
+ let format = this.dateFormatShort["minute"];
8662
+ if (this.isFirstMinute(date)) {
8663
+ format = this.dateFormatShort["hour"] + ":" + format;
8664
+ }
8665
+ return date.setLocale(this.locale).toFormat(format);
8666
+ }
8667
+ getFormatedSecondDate(date) {
8668
+ let format = this.dateFormatShort["second"];
8669
+ if (this.isFirstSecond(date)) {
8670
+ format = this.dateFormatShort["minute"] + ":" + format;
8671
+ }
8672
+ return date.setLocale(this.locale).toFormat(format);
8673
+ }
8674
+ getFormatedMilliSecondDate(date) {
8675
+ let format = this.dateFormatShort["millisecond"];
8676
+ if (this.isFirstMilliSecond(date)) {
8677
+ format = this.dateFormatShort["second"] + ":" + format;
8678
+ }
8679
+ return date.setLocale(this.locale).toFormat(format);
8680
+ }
8681
+ isFirstInMonth(date) {
8682
+ return date.day === 1;
8683
+ }
8684
+ isJanuary(date) {
8685
+ return date.month === 1;
8686
+ }
8687
+ isFirstQuarter(date) {
8688
+ return date.quarter === 1;
8689
+ }
8690
+ isFirstWeek(date) {
8691
+ return date.weekNumber === 1;
8692
+ }
8693
+ isFirstHour(date) {
8694
+ return date.hour === 0;
8695
+ }
8696
+ isFirstMinute(date) {
8697
+ return date.minute === 0;
8698
+ }
8699
+ isFirstSecond(date) {
8700
+ return date.second === 0;
8701
+ }
8702
+ isFirstMilliSecond(date) {
8703
+ return date.millisecond === 0;
8704
+ }
8705
+ convertDateDistanceToMomentunitOfTime(dateInterval) {
8706
+ let unitOfTime;
8707
+ switch (dateInterval) {
8708
+ case exports.DateDistance.YEAR:
8709
+ unitOfTime = "year";
8710
+ break;
8711
+ case exports.DateDistance.MONTH:
8712
+ unitOfTime = "month";
8713
+ break;
8714
+ case exports.DateDistance.QUARTER:
8715
+ unitOfTime = "quarter";
8716
+ break;
8717
+ case exports.DateDistance.WEEK:
8718
+ unitOfTime = "week";
8719
+ break;
8720
+ case exports.DateDistance.DAY:
8721
+ unitOfTime = "day";
8722
+ break;
8723
+ case exports.DateDistance.HOUR:
8724
+ unitOfTime = "hour";
8725
+ break;
8726
+ case exports.DateDistance.MINUTE:
8727
+ unitOfTime = "minute";
8728
+ break;
8729
+ case exports.DateDistance.SECOND:
8730
+ unitOfTime = "second";
8731
+ break;
8732
+ case exports.DateDistance.MILLISECOND:
8733
+ unitOfTime = "millisecond";
8734
+ break;
8735
+ default:
8736
+ unitOfTime = "day";
8737
+ }
8738
+ return unitOfTime;
8739
+ }
8740
+ createDiratonLike(unit, number) {
8741
+ switch (unit) {
8742
+ case "year":
8743
+ return { years: number };
8744
+ case "month":
8745
+ return { months: number };
8746
+ case "quarter":
8747
+ return { quarters: number };
8748
+ case "week":
8749
+ return { weeks: number };
8750
+ case "day":
8751
+ return { days: number };
8752
+ case "hour":
8753
+ return { hours: number };
8754
+ case "minute":
8755
+ return { minutes: number };
8756
+ case "second":
8757
+ return { seconds: number };
8758
+ case "millisecond":
8759
+ return { milliseconds: number };
8760
+ default:
8761
+ return { days: number };
8762
+ }
8763
+ }
8764
+ }
8765
+
8319
8766
  /**
8320
8767
  * Type-checking utility used throughout the adapter layer for safe JSON-to-domain conversion.
8321
8768
  *
@@ -8441,5 +8888,6 @@ class OrderAdapter {
8441
8888
  exports.AdapterUtils = AdapterUtils;
8442
8889
  exports.BAR_COLUMN_WIDTH_EM = BAR_COLUMN_WIDTH_EM;
8443
8890
  exports.CompareUtil = CompareUtil;
8891
+ exports.DateStringFactory = DateStringFactory;
8444
8892
  exports.DateTime = DateTime;
8445
8893
  exports.OrderAdapter = OrderAdapter;