@trops/dash-core 0.1.436 → 0.1.437
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.
- package/dist/index.esm.js +97 -52
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +97 -52
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15413,18 +15413,14 @@ var LayoutBuilderConfigModal = function LayoutBuilderConfigModal(_ref) {
|
|
|
15413
15413
|
return s.key === activeSection;
|
|
15414
15414
|
}) || sections[0];
|
|
15415
15415
|
|
|
15416
|
-
// Footer label:
|
|
15417
|
-
//
|
|
15416
|
+
// Footer label: full scoped id (`scope.package.Component`) so the
|
|
15417
|
+
// user always sees the underlying widget identity, even when the
|
|
15418
|
+
// primary title is a custom per-instance label. No workspace fallback.
|
|
15418
15419
|
var footerPackageLabel = function () {
|
|
15419
15420
|
var scopedId = (itemSelected === null || itemSelected === void 0 ? void 0 : itemSelected.component) || "";
|
|
15420
15421
|
if (typeof scopedId !== "string") return "";
|
|
15421
15422
|
var parts = scopedId.split(".");
|
|
15422
|
-
|
|
15423
|
-
var _parts = _slicedToArray(parts, 2),
|
|
15424
|
-
scope = _parts[0],
|
|
15425
|
-
pkg = _parts[1];
|
|
15426
|
-
if (!scope || !pkg) return "";
|
|
15427
|
-
return "@".concat(scope, "/").concat(pkg);
|
|
15423
|
+
return parts.length === 3 ? scopedId : "";
|
|
15428
15424
|
}();
|
|
15429
15425
|
var componentName = itemSelected ? itemSelected["component"] : "";
|
|
15430
15426
|
var footerLeftContent = footerPackageLabel ? /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
@@ -19727,24 +19723,40 @@ var WidgetCardHeader = function WidgetCardHeader(_ref) {
|
|
|
19727
19723
|
// Detect missing widgets (component key exists but not in ComponentManager)
|
|
19728
19724
|
var isWidgetMissing = (widgetItem === null || widgetItem === void 0 ? void 0 : widgetItem.component) && !widgetConfig;
|
|
19729
19725
|
|
|
19730
|
-
//
|
|
19731
|
-
|
|
19726
|
+
// Display name priority: per-instance user title → widget's default
|
|
19727
|
+
// title → developer's friendly displayName → widget config name →
|
|
19728
|
+
// bare component name (last segment) → full scoped id (last resort).
|
|
19729
|
+
// Mirrors WidgetsTab so the same widget shows the same name in both
|
|
19730
|
+
// surfaces.
|
|
19731
|
+
var widgetName = function (_widgetItem$userPrefs, _widgetConfig$userCon) {
|
|
19732
|
+
var prefsTitle = widgetItem === null || widgetItem === void 0 || (_widgetItem$userPrefs = widgetItem.userPrefs) === null || _widgetItem$userPrefs === void 0 ? void 0 : _widgetItem$userPrefs.title;
|
|
19733
|
+
if (typeof prefsTitle === "string" && prefsTitle.trim()) return prefsTitle;
|
|
19734
|
+
var configDefault = widgetConfig === null || widgetConfig === void 0 || (_widgetConfig$userCon = widgetConfig.userConfig) === null || _widgetConfig$userCon === void 0 || (_widgetConfig$userCon = _widgetConfig$userCon.title) === null || _widgetConfig$userCon === void 0 ? void 0 : _widgetConfig$userCon.defaultValue;
|
|
19735
|
+
if (typeof configDefault === "string" && configDefault.trim()) {
|
|
19736
|
+
return configDefault;
|
|
19737
|
+
}
|
|
19738
|
+
if (widgetConfig !== null && widgetConfig !== void 0 && widgetConfig.displayName) return widgetConfig.displayName;
|
|
19739
|
+
if (widgetConfig !== null && widgetConfig !== void 0 && widgetConfig.name) return widgetConfig.name;
|
|
19740
|
+
if (widgetItem !== null && widgetItem !== void 0 && widgetItem.name) return widgetItem.name;
|
|
19741
|
+
var comp = widgetItem === null || widgetItem === void 0 ? void 0 : widgetItem.component;
|
|
19742
|
+
if (typeof comp === "string") {
|
|
19743
|
+
var parts = comp.split(".");
|
|
19744
|
+
if (parts.length === 3) return parts[2];
|
|
19745
|
+
return comp;
|
|
19746
|
+
}
|
|
19747
|
+
return "Widget";
|
|
19748
|
+
}();
|
|
19732
19749
|
|
|
19733
|
-
//
|
|
19734
|
-
//
|
|
19735
|
-
//
|
|
19736
|
-
//
|
|
19737
|
-
//
|
|
19750
|
+
// Show the full scoped registry id (`scope.package.Component`) as
|
|
19751
|
+
// the subtitle. The friendly title on line 1 may be a custom user
|
|
19752
|
+
// title that doesn't reveal which widget is mounted; the subtitle
|
|
19753
|
+
// pins down the underlying identity. Strict — the layout item is
|
|
19754
|
+
// the source of truth.
|
|
19738
19755
|
var packageLabel = function () {
|
|
19739
19756
|
var scopedId = (widgetItem === null || widgetItem === void 0 ? void 0 : widgetItem.component) || (widgetConfig === null || widgetConfig === void 0 ? void 0 : widgetConfig.id) || "";
|
|
19740
19757
|
if (typeof scopedId !== "string") return "";
|
|
19741
19758
|
var parts = scopedId.split(".");
|
|
19742
|
-
|
|
19743
|
-
var _parts = _slicedToArray(parts, 2),
|
|
19744
|
-
scope = _parts[0],
|
|
19745
|
-
pkg = _parts[1];
|
|
19746
|
-
if (!scope || !pkg) return "";
|
|
19747
|
-
return "@".concat(scope, "/").concat(pkg);
|
|
19759
|
+
return parts.length === 3 ? scopedId : "";
|
|
19748
19760
|
}();
|
|
19749
19761
|
|
|
19750
19762
|
// Get provider requirements from widget config (not from item directly)
|
|
@@ -55224,21 +55236,53 @@ function _arrayLikeToArray$5(r, a) { (null == a || a > r.length) && (a = r.lengt
|
|
|
55224
55236
|
var ALL_WIDGETS_ID = "__ALL__";
|
|
55225
55237
|
|
|
55226
55238
|
/**
|
|
55227
|
-
*
|
|
55228
|
-
*
|
|
55229
|
-
*
|
|
55230
|
-
*
|
|
55231
|
-
*
|
|
55232
|
-
*
|
|
55233
|
-
*
|
|
55239
|
+
* Pick the most user-friendly display name for a widget instance.
|
|
55240
|
+
* Priority: per-instance user title → widget's default title → widget
|
|
55241
|
+
* developer's friendly displayName → widget config name → the bare
|
|
55242
|
+
* component name (last segment of the scoped id) → the full scoped
|
|
55243
|
+
* id (last resort, never preferred — but always present).
|
|
55244
|
+
*
|
|
55245
|
+
* This is what shows on the primary line of the WidgetsTab list and
|
|
55246
|
+
* detail header. The full scoped registry id (`scope.package.X`) is
|
|
55247
|
+
* surfaced separately via `pickWidgetRef` below, so the user sees
|
|
55248
|
+
* BOTH a friendly name and an unambiguous reference.
|
|
55234
55249
|
*/
|
|
55235
|
-
function
|
|
55236
|
-
|
|
55237
|
-
var
|
|
55238
|
-
|
|
55239
|
-
|
|
55240
|
-
if (
|
|
55241
|
-
|
|
55250
|
+
function pickDisplayName(item, cfg) {
|
|
55251
|
+
var _item$userPrefs, _item$userConfig;
|
|
55252
|
+
var prefsTitle = item === null || item === void 0 || (_item$userPrefs = item.userPrefs) === null || _item$userPrefs === void 0 ? void 0 : _item$userPrefs.title;
|
|
55253
|
+
if (typeof prefsTitle === "string" && prefsTitle.trim()) return prefsTitle;
|
|
55254
|
+
var configDefault = item === null || item === void 0 || (_item$userConfig = item.userConfig) === null || _item$userConfig === void 0 || (_item$userConfig = _item$userConfig.title) === null || _item$userConfig === void 0 ? void 0 : _item$userConfig.defaultValue;
|
|
55255
|
+
if (typeof configDefault === "string" && configDefault.trim()) {
|
|
55256
|
+
return configDefault;
|
|
55257
|
+
}
|
|
55258
|
+
if (cfg !== null && cfg !== void 0 && cfg.displayName) return cfg.displayName;
|
|
55259
|
+
if (cfg !== null && cfg !== void 0 && cfg.name) return cfg.name;
|
|
55260
|
+
var bare = bareComponentName(item === null || item === void 0 ? void 0 : item.component);
|
|
55261
|
+
if (bare) return bare;
|
|
55262
|
+
return (item === null || item === void 0 ? void 0 : item.component) || "Widget";
|
|
55263
|
+
}
|
|
55264
|
+
|
|
55265
|
+
/**
|
|
55266
|
+
* Format the full scoped registry id (`scope.package.Component`) for
|
|
55267
|
+
* the subtitle. The friendly display name on line 1 may be a custom
|
|
55268
|
+
* per-instance title that doesn't reveal which widget is actually
|
|
55269
|
+
* mounted — the subtitle pins down the underlying widget identity so
|
|
55270
|
+
* the user can always see "this 'Q4 Pipeline' is actually a
|
|
55271
|
+
* `trops.pipeline.SalesPipeline`".
|
|
55272
|
+
*
|
|
55273
|
+
* Falls back to the cfg fields when the layout item is non-canonical
|
|
55274
|
+
* (legacy bare names that LayoutModel couldn't migrate). Returns
|
|
55275
|
+
* null when even those are missing — caller hides the subtitle.
|
|
55276
|
+
*/
|
|
55277
|
+
function pickWidgetRef(item, cfg) {
|
|
55278
|
+
if (parseScopedComponentId(item === null || item === void 0 ? void 0 : item.component)) return item.component;
|
|
55279
|
+
var scope = (cfg === null || cfg === void 0 ? void 0 : cfg.scope) || (item === null || item === void 0 ? void 0 : item.scope);
|
|
55280
|
+
var pkg = (cfg === null || cfg === void 0 ? void 0 : cfg.packageName) || (item === null || item === void 0 ? void 0 : item.packageName);
|
|
55281
|
+
var comp = bareComponentName(item === null || item === void 0 ? void 0 : item.component) || (cfg === null || cfg === void 0 ? void 0 : cfg.name);
|
|
55282
|
+
if (!scope || !pkg || !comp) return (item === null || item === void 0 ? void 0 : item.component) || null;
|
|
55283
|
+
var bareScope = String(scope).replace(/^@/, "");
|
|
55284
|
+
var barePkg = String(pkg).replace(new RegExp("^@?".concat(bareScope, "/")), "");
|
|
55285
|
+
return "".concat(bareScope, ".").concat(barePkg, ".").concat(comp);
|
|
55242
55286
|
}
|
|
55243
55287
|
|
|
55244
55288
|
/**
|
|
@@ -55285,13 +55329,11 @@ var WidgetsTab = function WidgetsTab(_ref) {
|
|
|
55285
55329
|
result.push({
|
|
55286
55330
|
id: id,
|
|
55287
55331
|
component: item.component,
|
|
55288
|
-
displayName: item
|
|
55332
|
+
displayName: pickDisplayName(item, cfg),
|
|
55333
|
+
widgetRef: pickWidgetRef(item, cfg),
|
|
55289
55334
|
section: section,
|
|
55290
55335
|
userConfig: cfg.userConfig || {},
|
|
55291
55336
|
userPrefs: item.userPrefs || {},
|
|
55292
|
-
// Identity fields for the registry-identifier label. Prefer
|
|
55293
|
-
// values from the widget's component manager entry since the
|
|
55294
|
-
// layout item itself often doesn't carry scope/packageName.
|
|
55295
55337
|
scope: cfg.scope || item.scope || null,
|
|
55296
55338
|
packageName: cfg.packageName || cfg.name || item.packageName || null
|
|
55297
55339
|
});
|
|
@@ -55429,6 +55471,10 @@ var WidgetsTab = function WidgetsTab(_ref) {
|
|
|
55429
55471
|
className: "text-[10px] bg-amber-500/20 text-amber-300 px-1.5 rounded",
|
|
55430
55472
|
children: stagedForWidget
|
|
55431
55473
|
})]
|
|
55474
|
+
}), w.widgetRef && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
55475
|
+
className: "text-[10px] text-gray-500 font-mono truncate mt-0.5",
|
|
55476
|
+
title: w.widgetRef,
|
|
55477
|
+
children: w.widgetRef
|
|
55432
55478
|
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
55433
55479
|
className: "text-[10px] text-gray-600 mt-0.5",
|
|
55434
55480
|
children: fieldCount === 0 ? "No configurable fields" : "".concat(fieldCount, " field").concat(fieldCount === 1 ? "" : "s")
|
|
@@ -55461,20 +55507,19 @@ function SingleWidgetPane(_ref4) {
|
|
|
55461
55507
|
effectivePrefs = _ref4.effectivePrefs,
|
|
55462
55508
|
onFieldChange = _ref4.onFieldChange;
|
|
55463
55509
|
var hasFields = Object.keys(widget.userConfig).length > 0;
|
|
55464
|
-
var scopedId = buildScopedId(widget);
|
|
55465
55510
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
55466
55511
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
55467
55512
|
className: "mb-3",
|
|
55468
55513
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
55469
55514
|
className: "text-gray-200 font-semibold",
|
|
55470
55515
|
children: widget.displayName
|
|
55471
|
-
}), /*#__PURE__*/jsxRuntime.
|
|
55472
|
-
className: "text-xs text-gray-500",
|
|
55473
|
-
|
|
55474
|
-
|
|
55475
|
-
|
|
55476
|
-
|
|
55477
|
-
children:
|
|
55516
|
+
}), widget.widgetRef && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
55517
|
+
className: "text-xs text-gray-500 font-mono truncate mt-0.5",
|
|
55518
|
+
title: widget.widgetRef,
|
|
55519
|
+
children: widget.widgetRef
|
|
55520
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
55521
|
+
className: "text-xs text-gray-600 mt-0.5",
|
|
55522
|
+
children: widget.section
|
|
55478
55523
|
})]
|
|
55479
55524
|
}), hasFields ? /*#__PURE__*/jsxRuntime.jsx(PanelEditForm, {
|
|
55480
55525
|
userConfig: widget.userConfig,
|
|
@@ -55720,11 +55765,11 @@ var DashboardConfigModal = function DashboardConfigModal(_ref) {
|
|
|
55720
55765
|
var derivePackage = function derivePackage(item) {
|
|
55721
55766
|
var scopedId = typeof (item === null || item === void 0 ? void 0 : item.component) === "string" ? item.component : "";
|
|
55722
55767
|
var parts = scopedId.split(".");
|
|
55723
|
-
if (parts.length === 3) {
|
|
55724
|
-
|
|
55725
|
-
|
|
55726
|
-
|
|
55727
|
-
|
|
55768
|
+
if (parts.length === 3 && parts[0] && parts[1]) {
|
|
55769
|
+
// Group rows by `@scope/package` so two widgets from the same
|
|
55770
|
+
// package show up under one heading. The full scoped id is
|
|
55771
|
+
// surfaced per-row in the table (column-level identity).
|
|
55772
|
+
return "@".concat(parts[0], "/").concat(parts[1]);
|
|
55728
55773
|
}
|
|
55729
55774
|
// Defensive: an explicit packageId on the item still wins for
|
|
55730
55775
|
// legacy items the migration couldn't auto-resolve.
|