web-mojo 2.2.47 → 2.2.49

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 (92) hide show
  1. package/dist/admin.cjs.js +1 -1
  2. package/dist/admin.cjs.js.map +1 -1
  3. package/dist/admin.es.js +18 -13
  4. package/dist/admin.es.js.map +1 -1
  5. package/dist/auth.cjs.js +1 -1
  6. package/dist/auth.es.js +1 -1
  7. package/dist/charts.cjs.js +1 -1
  8. package/dist/charts.es.js +4 -4
  9. package/dist/chunks/{ChatView-BT_nD9K9.js → ChatView-BUfkeVnX.js} +14 -7
  10. package/dist/chunks/ChatView-BUfkeVnX.js.map +1 -0
  11. package/dist/chunks/ChatView-Tj1Kb9Hf.js +2 -0
  12. package/dist/chunks/ChatView-Tj1Kb9Hf.js.map +1 -0
  13. package/dist/chunks/{Collection-C_Ssejpi.js → Collection-D3K_bEJN.js} +2 -2
  14. package/dist/chunks/{Collection-C_Ssejpi.js.map → Collection-D3K_bEJN.js.map} +1 -1
  15. package/dist/chunks/{Collection-C5uDBFur.js → Collection-DpUI5_9f.js} +2 -2
  16. package/dist/chunks/{Collection-C5uDBFur.js.map → Collection-DpUI5_9f.js.map} +1 -1
  17. package/dist/chunks/{ContextMenu-leHTa126.js → ContextMenu-BSlbXHBy.js} +2 -2
  18. package/dist/chunks/{ContextMenu-leHTa126.js.map → ContextMenu-BSlbXHBy.js.map} +1 -1
  19. package/dist/chunks/{ContextMenu-4yi1YZwj.js → ContextMenu-sdxDECHa.js} +3 -3
  20. package/dist/chunks/{ContextMenu-4yi1YZwj.js.map → ContextMenu-sdxDECHa.js.map} +1 -1
  21. package/dist/chunks/{DataView-34YwqbHX.js → DataView-CACdHJV9.js} +2 -2
  22. package/dist/chunks/{DataView-34YwqbHX.js.map → DataView-CACdHJV9.js.map} +1 -1
  23. package/dist/chunks/{DataView-DNhn9WNt.js → DataView-DUOJRtqo.js} +2 -2
  24. package/dist/chunks/{DataView-DNhn9WNt.js.map → DataView-DUOJRtqo.js.map} +1 -1
  25. package/dist/chunks/{Dialog-G4K6rcmt.js → Dialog-BVDLaVFL.js} +5 -5
  26. package/dist/chunks/{Dialog-G4K6rcmt.js.map → Dialog-BVDLaVFL.js.map} +1 -1
  27. package/dist/chunks/{Dialog-DISGn8Ys.js → Dialog-BmkbDDol.js} +2 -2
  28. package/dist/chunks/{Dialog-DISGn8Ys.js.map → Dialog-BmkbDDol.js.map} +1 -1
  29. package/dist/chunks/{FormView-DezJ-BG_.js → FormView-CqiU2UkE.js} +3 -3
  30. package/dist/chunks/{FormView-DezJ-BG_.js.map → FormView-CqiU2UkE.js.map} +1 -1
  31. package/dist/chunks/{FormView-DTIezo2P.js → FormView-Cuqamyp7.js} +3 -3
  32. package/dist/chunks/{FormView-DTIezo2P.js.map → FormView-Cuqamyp7.js.map} +1 -1
  33. package/dist/chunks/{ListView-CCa2A8AN.js → ListView-B7_jgGeh.js} +2 -2
  34. package/dist/chunks/{ListView-CCa2A8AN.js.map → ListView-B7_jgGeh.js.map} +1 -1
  35. package/dist/chunks/{ListView-fAR_2dr2.js → ListView-ChN3NCAY.js} +3 -3
  36. package/dist/chunks/{ListView-fAR_2dr2.js.map → ListView-ChN3NCAY.js.map} +1 -1
  37. package/dist/chunks/{MetricsCountryMapView-B-f2p9Sa.js → MetricsCountryMapView-BDdS4s7L.js} +2 -2
  38. package/dist/chunks/{MetricsCountryMapView-B-f2p9Sa.js.map → MetricsCountryMapView-BDdS4s7L.js.map} +1 -1
  39. package/dist/chunks/{MetricsCountryMapView-CUOaeRfl.js → MetricsCountryMapView-Pu1VZIJT.js} +2 -2
  40. package/dist/chunks/{MetricsCountryMapView-CUOaeRfl.js.map → MetricsCountryMapView-Pu1VZIJT.js.map} +1 -1
  41. package/dist/chunks/{MetricsMiniChartWidget-DLg1F5tP.js → MetricsMiniChartWidget-BVS-pJks.js} +4 -4
  42. package/dist/chunks/{MetricsMiniChartWidget-DLg1F5tP.js.map → MetricsMiniChartWidget-BVS-pJks.js.map} +1 -1
  43. package/dist/chunks/{MetricsMiniChartWidget-B8KsG_h3.js → MetricsMiniChartWidget-ZqmLtt06.js} +2 -2
  44. package/dist/chunks/{MetricsMiniChartWidget-B8KsG_h3.js.map → MetricsMiniChartWidget-ZqmLtt06.js.map} +1 -1
  45. package/dist/chunks/{PDFViewer-cMv7WDvp.js → PDFViewer-Byo3kf7Z.js} +3 -3
  46. package/dist/chunks/{PDFViewer-cMv7WDvp.js.map → PDFViewer-Byo3kf7Z.js.map} +1 -1
  47. package/dist/chunks/{PDFViewer-D-NSWRwM.js → PDFViewer-CCW5ZvRb.js} +2 -2
  48. package/dist/chunks/{PDFViewer-D-NSWRwM.js.map → PDFViewer-CCW5ZvRb.js.map} +1 -1
  49. package/dist/chunks/Rest-BSz7rF0G.js +2 -0
  50. package/dist/chunks/Rest-BSz7rF0G.js.map +1 -0
  51. package/dist/chunks/{Rest-CtdC4cD9.js → Rest-DSzjaYYe.js} +77 -15
  52. package/dist/chunks/Rest-DSzjaYYe.js.map +1 -0
  53. package/dist/chunks/{TokenManager-D_WVmyKY.js → TokenManager-C07o8g1O.js} +2 -2
  54. package/dist/chunks/{TokenManager-D_WVmyKY.js.map → TokenManager-C07o8g1O.js.map} +1 -1
  55. package/dist/chunks/{TokenManager-DmqJ4qmb.js → TokenManager-DNwuLDw6.js} +5 -5
  56. package/dist/chunks/{TokenManager-DmqJ4qmb.js.map → TokenManager-DNwuLDw6.js.map} +1 -1
  57. package/dist/chunks/{WebApp-158Y9QSF.js → WebApp-1HetrsR0.js} +2 -2
  58. package/dist/chunks/{WebApp-158Y9QSF.js.map → WebApp-1HetrsR0.js.map} +1 -1
  59. package/dist/chunks/{WebApp-CiBl53Hl.js → WebApp-Do2IaAGx.js} +12 -12
  60. package/dist/chunks/{WebApp-CiBl53Hl.js.map → WebApp-Do2IaAGx.js.map} +1 -1
  61. package/dist/chunks/{WebSocketClient-BGnzEIjP.js → WebSocketClient-BlBSBvYP.js} +2 -2
  62. package/dist/chunks/{WebSocketClient-BGnzEIjP.js.map → WebSocketClient-BlBSBvYP.js.map} +1 -1
  63. package/dist/chunks/{WebSocketClient-iJiqRgNy.js → WebSocketClient-BvwLDqeR.js} +2 -2
  64. package/dist/chunks/{WebSocketClient-iJiqRgNy.js.map → WebSocketClient-BvwLDqeR.js.map} +1 -1
  65. package/dist/chunks/{version-7OD8J84F.js → version-DXeLxR_3.js} +4 -4
  66. package/dist/chunks/{version-7OD8J84F.js.map → version-DXeLxR_3.js.map} +1 -1
  67. package/dist/chunks/{version-Dra0sZ9N.js → version-e7n3DAiW.js} +2 -2
  68. package/dist/chunks/{version-Dra0sZ9N.js.map → version-e7n3DAiW.js.map} +1 -1
  69. package/dist/docit.cjs.js +1 -1
  70. package/dist/docit.es.js +6 -6
  71. package/dist/index.cjs.js +1 -1
  72. package/dist/index.cjs.js.map +1 -1
  73. package/dist/index.es.js +70 -17
  74. package/dist/index.es.js.map +1 -1
  75. package/dist/lightbox.cjs.js +1 -1
  76. package/dist/lightbox.es.js +5 -5
  77. package/dist/map.cjs.js +1 -1
  78. package/dist/map.es.js +5 -5
  79. package/dist/timeline.cjs.js +1 -1
  80. package/dist/timeline.es.js +4 -4
  81. package/dist/web-mojo.lite.css +154 -0
  82. package/dist/web-mojo.lite.iife.js +21760 -0
  83. package/dist/web-mojo.lite.iife.js.map +1 -0
  84. package/dist/web-mojo.lite.iife.min.js +1765 -0
  85. package/dist/web-mojo.lite.iife.min.js.map +1 -0
  86. package/package.json +4 -3
  87. package/dist/chunks/ChatView-BT_nD9K9.js.map +0 -1
  88. package/dist/chunks/ChatView-G_I8KNR_.js +0 -2
  89. package/dist/chunks/ChatView-G_I8KNR_.js.map +0 -1
  90. package/dist/chunks/Rest-Bd1ABsfh.js +0 -2
  91. package/dist/chunks/Rest-Bd1ABsfh.js.map +0 -1
  92. package/dist/chunks/Rest-CtdC4cD9.js.map +0 -1
@@ -57,6 +57,7 @@ class DataFormatter {
57
57
  this.register("lower", (v) => String(v).toLowerCase());
58
58
  this.register("capitalize", this.capitalize.bind(this));
59
59
  this.register("caps", this.capitalize.bind(this));
60
+ this.register("replace", this.replace.bind(this));
60
61
  this.register("truncate", this.truncate.bind(this));
61
62
  this.register("truncate_middle", this.truncate_middle.bind(this));
62
63
  this.register("truncate_front", this.truncate_front.bind(this));
@@ -651,11 +652,13 @@ class DataFormatter {
651
652
  const date = value instanceof Date ? value : new Date(value);
652
653
  if (isNaN(date.getTime())) return String(value);
653
654
  const now = /* @__PURE__ */ new Date();
654
- const diffMs = now - date;
655
- const diffSecs = Math.floor(diffMs / 1e3);
655
+ const diffMs = date - now;
656
+ const absDiffMs = Math.abs(diffMs);
657
+ const diffSecs = Math.floor(absDiffMs / 1e3);
656
658
  const diffMins = Math.floor(diffSecs / 60);
657
659
  const diffHours = Math.floor(diffMins / 60);
658
660
  const diffDays = Math.floor(diffHours / 24);
661
+ const isFuture = diffMs > 0;
659
662
  if (short) {
660
663
  if (diffDays > 365) return Math.floor(diffDays / 365) + "y";
661
664
  if (diffDays > 30) return Math.floor(diffDays / 30) + "mo";
@@ -667,21 +670,43 @@ class DataFormatter {
667
670
  }
668
671
  if (diffDays > 365) {
669
672
  const years = Math.floor(diffDays / 365);
670
- return years + " year" + (years > 1 ? "s" : "") + " ago";
673
+ const prefix = isFuture ? "in " : "";
674
+ const suffix = isFuture ? "" : " ago";
675
+ return prefix + years + " year" + (years > 1 ? "s" : "") + suffix;
671
676
  }
672
677
  if (diffDays > 30) {
673
678
  const months = Math.floor(diffDays / 30);
674
- return months + " month" + (months > 1 ? "s" : "") + " ago";
679
+ const prefix = isFuture ? "in " : "";
680
+ const suffix = isFuture ? "" : " ago";
681
+ return prefix + months + " month" + (months > 1 ? "s" : "") + suffix;
675
682
  }
676
683
  if (diffDays > 7) {
677
684
  const weeks = Math.floor(diffDays / 7);
678
- return weeks + " week" + (weeks > 1 ? "s" : "") + " ago";
685
+ const prefix = isFuture ? "in " : "";
686
+ const suffix = isFuture ? "" : " ago";
687
+ return prefix + weeks + " week" + (weeks > 1 ? "s" : "") + suffix;
688
+ }
689
+ if (diffDays === 1) return isFuture ? "tomorrow" : "yesterday";
690
+ if (diffDays > 0) {
691
+ const prefix = isFuture ? "in " : "";
692
+ const suffix = isFuture ? "" : " ago";
693
+ return prefix + diffDays + " days" + suffix;
694
+ }
695
+ if (diffHours > 0) {
696
+ const prefix = isFuture ? "in " : "";
697
+ const suffix = isFuture ? "" : " ago";
698
+ return prefix + diffHours + " hour" + (diffHours > 1 ? "s" : "") + suffix;
699
+ }
700
+ if (diffMins > 0) {
701
+ const prefix = isFuture ? "in " : "";
702
+ const suffix = isFuture ? "" : " ago";
703
+ return prefix + diffMins + " minute" + (diffMins > 1 ? "s" : "") + suffix;
704
+ }
705
+ if (diffSecs > 30) {
706
+ const prefix = isFuture ? "in " : "";
707
+ const suffix = isFuture ? "" : " ago";
708
+ return prefix + diffSecs + " seconds" + suffix;
679
709
  }
680
- if (diffDays === 1) return "yesterday";
681
- if (diffDays > 0) return diffDays + " days ago";
682
- if (diffHours > 0) return diffHours + " hour" + (diffHours > 1 ? "s" : "") + " ago";
683
- if (diffMins > 0) return diffMins + " minute" + (diffMins > 1 ? "s" : "") + " ago";
684
- if (diffSecs > 30) return diffSecs + " seconds ago";
685
710
  return "just now";
686
711
  }
687
712
  /**
@@ -888,6 +913,43 @@ class DataFormatter {
888
913
  }
889
914
  return str.charAt(0).toUpperCase() + str.slice(1);
890
915
  }
916
+ /**
917
+ * Replace occurrences in a string
918
+ * @param {*} value - String value
919
+ * @param {*} search - Search value (string or RegExp-ish string like "/_/g")
920
+ * @param {*} replacement - Replacement string
921
+ * @param {string} flags - Optional RegExp flags when search is a plain string
922
+ * @returns {string} Updated string
923
+ *
924
+ * Examples:
925
+ * - {{model.name|replace:'_':''}} // underscores removed (all occurrences)
926
+ * - {{model.name|replace('_', '')}} // parentheses syntax
927
+ * - {{model.name|replace:'_':' ':'g'}} // replace all underscores with spaces
928
+ * - {{model.name|replace:'/[_-]+/g':' '}} // regex form in a string
929
+ */
930
+ replace(value, search, replacement = "", flags = "g") {
931
+ if (value === null || value === void 0) return "";
932
+ const str = String(value);
933
+ if (search === null || search === void 0 || search === "") {
934
+ return str;
935
+ }
936
+ if (search instanceof RegExp) {
937
+ return str.replace(search, String(replacement));
938
+ }
939
+ const searchStr = String(search);
940
+ const regexLike = searchStr.match(/^\/(.+)\/([a-z]*)$/i);
941
+ if (regexLike) {
942
+ const [, pattern, rxFlags] = regexLike;
943
+ try {
944
+ return str.replace(new RegExp(pattern, rxFlags), String(replacement));
945
+ } catch (e) {
946
+ }
947
+ }
948
+ if (String(flags).includes("g")) {
949
+ return str.split(searchStr).join(String(replacement));
950
+ }
951
+ return str.replace(searchStr, String(replacement));
952
+ }
891
953
  /**
892
954
  * Truncate string
893
955
  * @param {*} value - String value
@@ -1249,21 +1311,21 @@ class DataFormatter {
1249
1311
  /**
1250
1312
  * Compare value and return one of two results based on equality
1251
1313
  * Useful for conditional CSS classes, text, or any conditional output
1252
- *
1314
+ *
1253
1315
  * @param {*} value - Value to compare
1254
1316
  * @param {*} compareValue - Value to compare against
1255
1317
  * @param {*} trueResult - Result if values are equal
1256
1318
  * @param {*} falseResult - Result if values are not equal (optional, defaults to empty string)
1257
1319
  * @returns {*} trueResult or falseResult
1258
- *
1320
+ *
1259
1321
  * @example
1260
1322
  * // CSS classes
1261
1323
  * {{status|equals:1:'text-success':'text-secondary'}}
1262
1324
  * {{model.state|equals:'active':'badge-success':'badge-secondary'}}
1263
- *
1325
+ *
1264
1326
  * // Text output
1265
1327
  * {{role|equals:'admin':'Administrator':'User'}}
1266
- *
1328
+ *
1267
1329
  * // Numbers
1268
1330
  * {{count|equals:0:'No items':'Has items'}}
1269
1331
  */
@@ -4292,4 +4354,4 @@ export {
4292
4354
  dataFormatter as d,
4293
4355
  rest as r
4294
4356
  };
4295
- //# sourceMappingURL=Rest-CtdC4cD9.js.map
4357
+ //# sourceMappingURL=Rest-DSzjaYYe.js.map