@tenorlab/react-dashboard 1.0.5 → 1.0.7

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.
@@ -32,13 +32,13 @@ export declare const getWidgetMetaFromCatalog: <TFrameworkElementType = any, TFr
32
32
  * Helper function to create static entries
33
33
  * This helps keep the catalog registration clean
34
34
  */
35
- export declare const createStaticEntry: <TFrameworkComponentType = any>(key: string, component: TFrameworkComponentType) => [string, IDynamicWidgetCatalogEntryBase];
35
+ export declare const createStaticEntry: <TFrameworkComponentType = any>(key: string, component: TFrameworkComponentType, metaData?: TWidgetMetaInfoBase) => [string, IDynamicWidgetCatalogEntryBase];
36
36
  /**
37
37
  * @name createDynamicEntry
38
38
  * Helper function to create dynamic entries
39
39
  * This helps keep the catalog registration clean
40
40
  */
41
- export declare const createDynamicEntry: (key: string, loader: TWidgetFactoryBase, meta: TWidgetMetaInfoBase) => [string, IDynamicWidgetCatalogEntryBase];
41
+ export declare const createDynamicEntry: (key: string, loader: TWidgetFactoryBase, metaData: TWidgetMetaInfoBase) => [string, IDynamicWidgetCatalogEntryBase];
42
42
  export declare const parseKeyAndTitleFromFilePath: (path: string) => {
43
43
  key: TDashboardWidgetKey;
44
44
  title: string;
@@ -87,7 +87,7 @@ const St = [
87
87
  value: y
88
88
  };
89
89
  }
90
- }, we = {
90
+ }, Ce = {
91
91
  userID: 0,
92
92
  clientAppKey: "",
93
93
  dashboardId: "default",
@@ -134,7 +134,7 @@ const St = [
134
134
  parentWidgetKey: o || i
135
135
  };
136
136
  }), e;
137
- }, Ie = (e, n) => {
137
+ }, xe = (e, n) => {
138
138
  const t = `${e}`.includes("Container"), r = t ? ["Container"] : ["Widget"], i = n?.title || e, o = n?.description || (t ? "Container" : "Unknown");
139
139
  return {
140
140
  title: i,
@@ -146,32 +146,35 @@ const St = [
146
146
  };
147
147
  }, _n = (e, n, t) => {
148
148
  const r = n[e];
149
- return r || Ie(e, t);
149
+ return r || xe(e, t);
150
150
  }, Mt = (e, n) => {
151
151
  const r = n.get(e)?.meta;
152
- return r || Ie(e);
153
- }, Mn = (e, n) => {
154
- const t = Ie(e);
152
+ return r || xe(e);
153
+ }, Mn = (e, n, t) => {
154
+ const r = t || xe(e);
155
155
  return [
156
156
  e,
157
157
  {
158
158
  key: e,
159
- title: t.displayName,
159
+ title: r.displayName,
160
160
  isContainer: `${e}`.includes("Container"),
161
- meta: t,
161
+ meta: r,
162
162
  component: n
163
163
  }
164
164
  ];
165
- }, Pt = (e, n, t) => [
166
- e,
167
- {
168
- key: e,
169
- title: t.displayName,
170
- isContainer: !1,
171
- meta: t,
172
- loader: n
173
- }
174
- ], Pn = (e) => {
165
+ }, Pt = (e, n, t) => {
166
+ const r = t || xe(e);
167
+ return [
168
+ e,
169
+ {
170
+ key: e,
171
+ title: r.displayName,
172
+ isContainer: !1,
173
+ meta: r,
174
+ loader: n
175
+ }
176
+ ];
177
+ }, Pn = (e) => {
175
178
  const n = e.match(/\/widget-([a-zA-Z0-9-]+)\/index\.ts$/);
176
179
  if (n && n[1]) {
177
180
  const t = n[1], r = `Widget${t.split("-").map((o) => o.charAt(0).toUpperCase() + o.slice(1)).join("")}`, i = t.split("-").map((o) => o.charAt(0).toUpperCase() + o.slice(1)).join(" ");
@@ -348,8 +351,8 @@ const Ot = (e) => {
348
351
  }, Ut = (e, n) => ({
349
352
  isLoading: !1,
350
353
  isEditing: !1,
351
- allDashboardConfigs: [we],
352
- currentDashboardConfig: we,
354
+ allDashboardConfigs: [Ce],
355
+ currentDashboardConfig: Ce,
353
356
  targetContainerKey: void 0,
354
357
  getNextContainerKey: (t) => kt(n().currentDashboardConfig, t),
355
358
  setIsLoading: (t) => (e(() => ({ isLoading: t })), t),
@@ -386,7 +389,7 @@ const Ot = (e) => {
386
389
  return e(() => ({
387
390
  ...r,
388
391
  allDashboardConfigs: i,
389
- currentDashboardConfig: i[0] || we
392
+ currentDashboardConfig: i[0] || Ce
390
393
  })), i;
391
394
  },
392
395
  selectDashboardById: (t) => (e(() => {
@@ -857,7 +860,7 @@ const Z = (e, ...n) => [
857
860
  }
858
861
  )
859
862
  ] });
860
- }, Ce = /* @__PURE__ */ new Map([
863
+ }, Se = /* @__PURE__ */ new Map([
861
864
  [
862
865
  "normal",
863
866
  "group bg-[category] content-[category] hover:bg-[category] group-hover:bg-[category] focus:outline-[category] focus:outline-offset-[category]"
@@ -902,7 +905,7 @@ function J(e) {
902
905
  else {
903
906
  $.push("cursor-pointer");
904
907
  let O = "";
905
- Ce.has(v) ? O = `${Ce.get(v)}` : O = `${Ce.get("normal")}`, S < 1 && (O = O.replace("border-[category]", ""));
908
+ Se.has(v) ? O = `${Se.get(v)}` : O = `${Se.get("normal")}`, S < 1 && (O = O.replace("border-[category]", ""));
906
909
  const E = O.replace(/\[category\]/g, w).trim();
907
910
  $.push(E);
908
911
  }
@@ -964,7 +967,7 @@ const Kn = le(
964
967
  function tn(e) {
965
968
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
966
969
  }
967
- var fe = { exports: {} }, Se = {}, me = { exports: {} }, pe = { exports: {} }, V = {};
970
+ var fe = { exports: {} }, De = {}, me = { exports: {} }, pe = { exports: {} }, V = {};
968
971
  var Ue;
969
972
  function nn() {
970
973
  if (Ue) return V;
@@ -1119,9 +1122,9 @@ var Ye;
1119
1122
  function mt() {
1120
1123
  return Ye || (Ye = 1, process.env.NODE_ENV === "production" ? pe.exports = nn() : pe.exports = rn()), pe.exports;
1121
1124
  }
1122
- var De, qe;
1125
+ var Te, qe;
1123
1126
  function on() {
1124
- if (qe) return De;
1127
+ if (qe) return Te;
1125
1128
  qe = 1;
1126
1129
  var e = Object.getOwnPropertySymbols, n = Object.prototype.hasOwnProperty, t = Object.prototype.propertyIsEnumerable;
1127
1130
  function r(o) {
@@ -1151,7 +1154,7 @@ function on() {
1151
1154
  return !1;
1152
1155
  }
1153
1156
  }
1154
- return De = i() ? Object.assign : function(o, s) {
1157
+ return Te = i() ? Object.assign : function(o, s) {
1155
1158
  for (var d, y = r(o), m, h = 1; h < arguments.length; h++) {
1156
1159
  d = Object(arguments[h]);
1157
1160
  for (var u in d)
@@ -1163,22 +1166,22 @@ function on() {
1163
1166
  }
1164
1167
  }
1165
1168
  return y;
1166
- }, De;
1169
+ }, Te;
1167
1170
  }
1168
- var Te, ze;
1171
+ var Ne, ze;
1169
1172
  function Oe() {
1170
- if (ze) return Te;
1173
+ if (ze) return Ne;
1171
1174
  ze = 1;
1172
1175
  var e = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
1173
- return Te = e, Te;
1176
+ return Ne = e, Ne;
1174
1177
  }
1175
- var Ne, Be;
1178
+ var Ee, Be;
1176
1179
  function pt() {
1177
- return Be || (Be = 1, Ne = Function.call.bind(Object.prototype.hasOwnProperty)), Ne;
1180
+ return Be || (Be = 1, Ee = Function.call.bind(Object.prototype.hasOwnProperty)), Ee;
1178
1181
  }
1179
- var Ee, Ke;
1182
+ var _e, Ke;
1180
1183
  function an() {
1181
- if (Ke) return Ee;
1184
+ if (Ke) return _e;
1182
1185
  Ke = 1;
1183
1186
  var e = function() {
1184
1187
  };
@@ -1223,11 +1226,11 @@ function an() {
1223
1226
  }
1224
1227
  return i.resetWarningCache = function() {
1225
1228
  process.env.NODE_ENV !== "production" && (t = {});
1226
- }, Ee = i, Ee;
1229
+ }, _e = i, _e;
1227
1230
  }
1228
- var _e, He;
1231
+ var Me, He;
1229
1232
  function sn() {
1230
- if (He) return _e;
1233
+ if (He) return Me;
1231
1234
  He = 1;
1232
1235
  var e = mt(), n = on(), t = /* @__PURE__ */ Oe(), r = /* @__PURE__ */ pt(), i = /* @__PURE__ */ an(), o = function() {
1233
1236
  };
@@ -1242,7 +1245,7 @@ function sn() {
1242
1245
  function s() {
1243
1246
  return null;
1244
1247
  }
1245
- return _e = function(d, y) {
1248
+ return Me = function(d, y) {
1246
1249
  var m = typeof Symbol == "function" && Symbol.iterator, h = "@@iterator";
1247
1250
  function u(x) {
1248
1251
  var M = x && (m && x[m] || x[h]);
@@ -1544,18 +1547,18 @@ Valid keys: ` + JSON.stringify(Object.keys(x), null, " ")
1544
1547
  return !x.constructor || !x.constructor.name ? g : x.constructor.name;
1545
1548
  }
1546
1549
  return p.checkPropTypes = i, p.resetWarningCache = i.resetWarningCache, p.PropTypes = p, p;
1547
- }, _e;
1550
+ }, Me;
1548
1551
  }
1549
- var Me, Xe;
1552
+ var Pe, Xe;
1550
1553
  function ln() {
1551
- if (Xe) return Me;
1554
+ if (Xe) return Pe;
1552
1555
  Xe = 1;
1553
1556
  var e = /* @__PURE__ */ Oe();
1554
1557
  function n() {
1555
1558
  }
1556
1559
  function t() {
1557
1560
  }
1558
- return t.resetWarningCache = n, Me = function() {
1561
+ return t.resetWarningCache = n, Pe = function() {
1559
1562
  function r(s, d, y, m, h, u) {
1560
1563
  if (u !== e) {
1561
1564
  var g = new Error(
@@ -1592,7 +1595,7 @@ function ln() {
1592
1595
  resetWarningCache: n
1593
1596
  };
1594
1597
  return o.PropTypes = o, o;
1595
- }, Me;
1598
+ }, Pe;
1596
1599
  }
1597
1600
  var Ge;
1598
1601
  function yt() {
@@ -1624,7 +1627,7 @@ function cn() {
1624
1627
  return ye.exports = n, ye.exports.clsx = n, ye.exports;
1625
1628
  }
1626
1629
  var B = {}, oe = {}, Je;
1627
- function xe() {
1630
+ function we() {
1628
1631
  if (Je) return oe;
1629
1632
  Je = 1, Object.defineProperty(oe, "__esModule", {
1630
1633
  value: !0
@@ -1684,7 +1687,7 @@ function Re() {
1684
1687
  et = 1, Object.defineProperty(B, "__esModule", {
1685
1688
  value: !0
1686
1689
  }), B.addClassName = c, B.addEvent = s, B.addUserSelectStyles = T, B.createCSSTransform = p, B.createSVGTransform = w, B.getTouch = b, B.getTouchIdentifier = C, B.getTranslation = v, B.innerHeight = h, B.innerWidth = u, B.matchesSelector = i, B.matchesSelectorAndParentsTo = o, B.offsetXYFromParent = g, B.outerHeight = y, B.outerWidth = m, B.removeClassName = N, B.removeEvent = d, B.scheduleRemoveUserSelectStyles = S;
1687
- var e = xe(), n = t(dn());
1690
+ var e = we(), n = t(dn());
1688
1691
  function t(l, f) {
1689
1692
  if (typeof WeakMap == "function") var P = /* @__PURE__ */ new WeakMap(), $ = /* @__PURE__ */ new WeakMap();
1690
1693
  return (t = function(O, E) {
@@ -1825,7 +1828,7 @@ function vt() {
1825
1828
  tt = 1, Object.defineProperty(ne, "__esModule", {
1826
1829
  value: !0
1827
1830
  }), ne.canDragX = i, ne.canDragY = o, ne.createCoreData = d, ne.createDraggableData = y, ne.getBoundPosition = t, ne.getControlPosition = s, ne.snapToGrid = r;
1828
- var e = xe(), n = Re();
1831
+ var e = we(), n = Re();
1829
1832
  function t(u, g, p) {
1830
1833
  if (!u.props.bounds) return [g, p];
1831
1834
  let {
@@ -1930,7 +1933,7 @@ function un() {
1930
1933
  rt = 1, Object.defineProperty(he, "__esModule", {
1931
1934
  value: !0
1932
1935
  }), he.default = void 0;
1933
- var e = y(se), n = d(/* @__PURE__ */ yt()), t = d(st), r = Re(), i = vt(), o = xe(), s = d(bt());
1936
+ var e = y(se), n = d(/* @__PURE__ */ yt()), t = d(st), r = Re(), i = vt(), o = we(), s = d(bt());
1934
1937
  function d(v) {
1935
1938
  return v && v.__esModule ? v : { default: v };
1936
1939
  }
@@ -2235,7 +2238,7 @@ function fn() {
2235
2238
  return y.default;
2236
2239
  }
2237
2240
  }), e.default = void 0;
2238
- var n = u(se), t = h(/* @__PURE__ */ yt()), r = h(st), i = cn(), o = Re(), s = vt(), d = xe(), y = h(un()), m = h(bt());
2241
+ var n = u(se), t = h(/* @__PURE__ */ yt()), r = h(st), i = cn(), o = Re(), s = vt(), d = we(), y = h(un()), m = h(bt());
2239
2242
  function h(C) {
2240
2243
  return C && C.__esModule ? C : { default: C };
2241
2244
  }
@@ -2535,7 +2538,7 @@ function fn() {
2535
2538
  },
2536
2539
  scale: 1
2537
2540
  });
2538
- })(Se)), Se;
2541
+ })(De)), De;
2539
2542
  }
2540
2543
  var it;
2541
2544
  function hn() {
@@ -2619,7 +2622,7 @@ const er = (e) => {
2619
2622
  "border border-solid border-primary"
2620
2623
  );
2621
2624
  return /* @__PURE__ */ a("div", { className: s, style: o, children: e.children });
2622
- }), Pe = "size-5", vn = (e, n) => {
2625
+ }), $e = "size-5", vn = (e, n) => {
2623
2626
  const t = e.hideTitle && !e.isEditing, r = e.noBorder;
2624
2627
  let i = `dashboard-widget ${e.isEditing ? "editing" : ""} border border-solid`;
2625
2628
  r ? i = `${i} border-transparent border-opacity-0` : (e.borderCssClasses || "").trim().length > 0 ? i = `${i} ${e.borderCssClasses}` : i = `${i} border-card-invert border-opacity-20`, e.noShadow && (i = `${i} no-shadow`), e.noPadding && (i = `${i} no-padding p-0`), (e.backgroundCssClasses || "").trim().length > 0 ? i = `${i} ${e.backgroundCssClasses}` : i = `${i} bg-card content-card`, ["large", "xlarge"].indexOf(e.size || "") > -1 && (i = `${i} ${e.size}-widget`);
@@ -2655,7 +2658,7 @@ const er = (e) => {
2655
2658
  title: `${e.index < 1 ? "Already at min position" : "Move Widget to the left/up"}`
2656
2659
  },
2657
2660
  onClick: () => s(-1),
2658
- children: /* @__PURE__ */ a(dt, { className: Pe })
2661
+ children: /* @__PURE__ */ a(dt, { className: $e })
2659
2662
  }
2660
2663
  ),
2661
2664
  /* @__PURE__ */ a(
@@ -2669,7 +2672,7 @@ const er = (e) => {
2669
2672
  title: `${e.index >= e.maxIndex ? "Already at max position" : "Move Widget to the right/down"}`
2670
2673
  },
2671
2674
  onClick: () => s(1),
2672
- children: /* @__PURE__ */ a(ut, { className: Pe })
2675
+ children: /* @__PURE__ */ a(ut, { className: $e })
2673
2676
  }
2674
2677
  ),
2675
2678
  /* @__PURE__ */ a(
@@ -2682,7 +2685,7 @@ const er = (e) => {
2682
2685
  title: "Remove Widget"
2683
2686
  },
2684
2687
  onClick: () => o(),
2685
- children: /* @__PURE__ */ a(ft, { className: Pe })
2688
+ children: /* @__PURE__ */ a(ft, { className: $e })
2686
2689
  }
2687
2690
  )
2688
2691
  ] })
@@ -2892,7 +2895,7 @@ function or(e) {
2892
2895
  const { direction: n, ...t } = e;
2893
2896
  return /* @__PURE__ */ a(je, { direction: "row", ...t });
2894
2897
  }
2895
- function $e({
2898
+ function We({
2896
2899
  // widgetKey,
2897
2900
  metaData: e,
2898
2901
  alreadyAdded: n,
@@ -2956,7 +2959,7 @@ function Cn({
2956
2959
  ] })
2957
2960
  ] }) });
2958
2961
  }
2959
- const We = (e, n) => [
2962
+ const Ie = (e, n) => [
2960
2963
  ...n.widgets.filter((r) => r.indexOf("Container") === -1),
2961
2964
  ...n.childWidgetsConfig.map((r) => r.widgetKey)
2962
2965
  ].includes(e);
@@ -3100,11 +3103,11 @@ function ir({
3100
3103
  g === 0 && C.filter(
3101
3104
  (E) => E.metaData.categories.includes("Widget") && S(E.metaData)
3102
3105
  ).map((E) => /* @__PURE__ */ a(
3103
- $e,
3106
+ We,
3104
3107
  {
3105
3108
  widgetKey: E.widgetKey,
3106
3109
  metaData: E.metaData,
3107
- alreadyAdded: We(E.widgetKey, t),
3110
+ alreadyAdded: Ie(E.widgetKey, t),
3108
3111
  addWidget: () => l(E.widgetKey)
3109
3112
  },
3110
3113
  E.widgetKey
@@ -3112,21 +3115,21 @@ function ir({
3112
3115
  g === 1 && C.filter(
3113
3116
  (E) => E.metaData.categories.includes("Chart") && S(E.metaData)
3114
3117
  ).map((E) => /* @__PURE__ */ a(
3115
- $e,
3118
+ We,
3116
3119
  {
3117
3120
  widgetKey: E.widgetKey,
3118
3121
  metaData: E.metaData,
3119
- alreadyAdded: We(E.widgetKey, t),
3122
+ alreadyAdded: Ie(E.widgetKey, t),
3120
3123
  addWidget: () => l(E.widgetKey)
3121
3124
  },
3122
3125
  E.widgetKey
3123
3126
  )),
3124
3127
  !N && g === 2 && C.filter((E) => E.metaData.categories.includes("Container")).map((E) => /* @__PURE__ */ a(
3125
- $e,
3128
+ We,
3126
3129
  {
3127
3130
  widgetKey: E.widgetKey,
3128
3131
  metaData: E.metaData,
3129
- alreadyAdded: We(E.widgetKey, t),
3132
+ alreadyAdded: Ie(E.widgetKey, t),
3130
3133
  addWidget: () => o(E.widgetKey)
3131
3134
  },
3132
3135
  E.widgetKey
@@ -3201,7 +3204,7 @@ export {
3201
3204
  ft as XCircleIcon,
3202
3205
  Vn as ZoomInIcon,
3203
3206
  Yn as ZoomOutIcon,
3204
- we as blankDashboardConfig,
3207
+ Ce as blankDashboardConfig,
3205
3208
  Pt as createDynamicEntry,
3206
3209
  Mn as createStaticEntry,
3207
3210
  St as cssSettingsCatalog,
@@ -3209,7 +3212,7 @@ export {
3209
3212
  Nt as dashboardSettingsUtils,
3210
3213
  _t as ensureContainersSequence,
3211
3214
  lt as ensureZoomScaleIsWithinRange,
3212
- Ie as getDefaultWidgetMetaFromKey,
3215
+ xe as getDefaultWidgetMetaFromKey,
3213
3216
  _n as getDefaultWidgetMetaFromMap,
3214
3217
  Z as getDistinctCssClasses,
3215
3218
  Nn as getNewZoomScaleWithinRange,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tenorlab/react-dashboard",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Foundation components for creating user-configurable dashboards in React",
5
5
  "author": "Damiano Fusco",
6
6
  "type": "module",