@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.esm.js
CHANGED
|
@@ -15395,18 +15395,14 @@ var LayoutBuilderConfigModal = function LayoutBuilderConfigModal(_ref) {
|
|
|
15395
15395
|
return s.key === activeSection;
|
|
15396
15396
|
}) || sections[0];
|
|
15397
15397
|
|
|
15398
|
-
// Footer label:
|
|
15399
|
-
//
|
|
15398
|
+
// Footer label: full scoped id (`scope.package.Component`) so the
|
|
15399
|
+
// user always sees the underlying widget identity, even when the
|
|
15400
|
+
// primary title is a custom per-instance label. No workspace fallback.
|
|
15400
15401
|
var footerPackageLabel = function () {
|
|
15401
15402
|
var scopedId = (itemSelected === null || itemSelected === void 0 ? void 0 : itemSelected.component) || "";
|
|
15402
15403
|
if (typeof scopedId !== "string") return "";
|
|
15403
15404
|
var parts = scopedId.split(".");
|
|
15404
|
-
|
|
15405
|
-
var _parts = _slicedToArray(parts, 2),
|
|
15406
|
-
scope = _parts[0],
|
|
15407
|
-
pkg = _parts[1];
|
|
15408
|
-
if (!scope || !pkg) return "";
|
|
15409
|
-
return "@".concat(scope, "/").concat(pkg);
|
|
15405
|
+
return parts.length === 3 ? scopedId : "";
|
|
15410
15406
|
}();
|
|
15411
15407
|
var componentName = itemSelected ? itemSelected["component"] : "";
|
|
15412
15408
|
var footerLeftContent = footerPackageLabel ? /*#__PURE__*/jsxs("span", {
|
|
@@ -19709,24 +19705,40 @@ var WidgetCardHeader = function WidgetCardHeader(_ref) {
|
|
|
19709
19705
|
// Detect missing widgets (component key exists but not in ComponentManager)
|
|
19710
19706
|
var isWidgetMissing = (widgetItem === null || widgetItem === void 0 ? void 0 : widgetItem.component) && !widgetConfig;
|
|
19711
19707
|
|
|
19712
|
-
//
|
|
19713
|
-
|
|
19708
|
+
// Display name priority: per-instance user title → widget's default
|
|
19709
|
+
// title → developer's friendly displayName → widget config name →
|
|
19710
|
+
// bare component name (last segment) → full scoped id (last resort).
|
|
19711
|
+
// Mirrors WidgetsTab so the same widget shows the same name in both
|
|
19712
|
+
// surfaces.
|
|
19713
|
+
var widgetName = function (_widgetItem$userPrefs, _widgetConfig$userCon) {
|
|
19714
|
+
var prefsTitle = widgetItem === null || widgetItem === void 0 || (_widgetItem$userPrefs = widgetItem.userPrefs) === null || _widgetItem$userPrefs === void 0 ? void 0 : _widgetItem$userPrefs.title;
|
|
19715
|
+
if (typeof prefsTitle === "string" && prefsTitle.trim()) return prefsTitle;
|
|
19716
|
+
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;
|
|
19717
|
+
if (typeof configDefault === "string" && configDefault.trim()) {
|
|
19718
|
+
return configDefault;
|
|
19719
|
+
}
|
|
19720
|
+
if (widgetConfig !== null && widgetConfig !== void 0 && widgetConfig.displayName) return widgetConfig.displayName;
|
|
19721
|
+
if (widgetConfig !== null && widgetConfig !== void 0 && widgetConfig.name) return widgetConfig.name;
|
|
19722
|
+
if (widgetItem !== null && widgetItem !== void 0 && widgetItem.name) return widgetItem.name;
|
|
19723
|
+
var comp = widgetItem === null || widgetItem === void 0 ? void 0 : widgetItem.component;
|
|
19724
|
+
if (typeof comp === "string") {
|
|
19725
|
+
var parts = comp.split(".");
|
|
19726
|
+
if (parts.length === 3) return parts[2];
|
|
19727
|
+
return comp;
|
|
19728
|
+
}
|
|
19729
|
+
return "Widget";
|
|
19730
|
+
}();
|
|
19714
19731
|
|
|
19715
|
-
//
|
|
19716
|
-
//
|
|
19717
|
-
//
|
|
19718
|
-
//
|
|
19719
|
-
//
|
|
19732
|
+
// Show the full scoped registry id (`scope.package.Component`) as
|
|
19733
|
+
// the subtitle. The friendly title on line 1 may be a custom user
|
|
19734
|
+
// title that doesn't reveal which widget is mounted; the subtitle
|
|
19735
|
+
// pins down the underlying identity. Strict — the layout item is
|
|
19736
|
+
// the source of truth.
|
|
19720
19737
|
var packageLabel = function () {
|
|
19721
19738
|
var scopedId = (widgetItem === null || widgetItem === void 0 ? void 0 : widgetItem.component) || (widgetConfig === null || widgetConfig === void 0 ? void 0 : widgetConfig.id) || "";
|
|
19722
19739
|
if (typeof scopedId !== "string") return "";
|
|
19723
19740
|
var parts = scopedId.split(".");
|
|
19724
|
-
|
|
19725
|
-
var _parts = _slicedToArray(parts, 2),
|
|
19726
|
-
scope = _parts[0],
|
|
19727
|
-
pkg = _parts[1];
|
|
19728
|
-
if (!scope || !pkg) return "";
|
|
19729
|
-
return "@".concat(scope, "/").concat(pkg);
|
|
19741
|
+
return parts.length === 3 ? scopedId : "";
|
|
19730
19742
|
}();
|
|
19731
19743
|
|
|
19732
19744
|
// Get provider requirements from widget config (not from item directly)
|
|
@@ -55206,21 +55218,53 @@ function _arrayLikeToArray$5(r, a) { (null == a || a > r.length) && (a = r.lengt
|
|
|
55206
55218
|
var ALL_WIDGETS_ID = "__ALL__";
|
|
55207
55219
|
|
|
55208
55220
|
/**
|
|
55209
|
-
*
|
|
55210
|
-
*
|
|
55211
|
-
*
|
|
55212
|
-
*
|
|
55213
|
-
*
|
|
55214
|
-
*
|
|
55215
|
-
*
|
|
55221
|
+
* Pick the most user-friendly display name for a widget instance.
|
|
55222
|
+
* Priority: per-instance user title → widget's default title → widget
|
|
55223
|
+
* developer's friendly displayName → widget config name → the bare
|
|
55224
|
+
* component name (last segment of the scoped id) → the full scoped
|
|
55225
|
+
* id (last resort, never preferred — but always present).
|
|
55226
|
+
*
|
|
55227
|
+
* This is what shows on the primary line of the WidgetsTab list and
|
|
55228
|
+
* detail header. The full scoped registry id (`scope.package.X`) is
|
|
55229
|
+
* surfaced separately via `pickWidgetRef` below, so the user sees
|
|
55230
|
+
* BOTH a friendly name and an unambiguous reference.
|
|
55216
55231
|
*/
|
|
55217
|
-
function
|
|
55218
|
-
|
|
55219
|
-
var
|
|
55220
|
-
|
|
55221
|
-
|
|
55222
|
-
if (
|
|
55223
|
-
|
|
55232
|
+
function pickDisplayName(item, cfg) {
|
|
55233
|
+
var _item$userPrefs, _item$userConfig;
|
|
55234
|
+
var prefsTitle = item === null || item === void 0 || (_item$userPrefs = item.userPrefs) === null || _item$userPrefs === void 0 ? void 0 : _item$userPrefs.title;
|
|
55235
|
+
if (typeof prefsTitle === "string" && prefsTitle.trim()) return prefsTitle;
|
|
55236
|
+
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;
|
|
55237
|
+
if (typeof configDefault === "string" && configDefault.trim()) {
|
|
55238
|
+
return configDefault;
|
|
55239
|
+
}
|
|
55240
|
+
if (cfg !== null && cfg !== void 0 && cfg.displayName) return cfg.displayName;
|
|
55241
|
+
if (cfg !== null && cfg !== void 0 && cfg.name) return cfg.name;
|
|
55242
|
+
var bare = bareComponentName(item === null || item === void 0 ? void 0 : item.component);
|
|
55243
|
+
if (bare) return bare;
|
|
55244
|
+
return (item === null || item === void 0 ? void 0 : item.component) || "Widget";
|
|
55245
|
+
}
|
|
55246
|
+
|
|
55247
|
+
/**
|
|
55248
|
+
* Format the full scoped registry id (`scope.package.Component`) for
|
|
55249
|
+
* the subtitle. The friendly display name on line 1 may be a custom
|
|
55250
|
+
* per-instance title that doesn't reveal which widget is actually
|
|
55251
|
+
* mounted — the subtitle pins down the underlying widget identity so
|
|
55252
|
+
* the user can always see "this 'Q4 Pipeline' is actually a
|
|
55253
|
+
* `trops.pipeline.SalesPipeline`".
|
|
55254
|
+
*
|
|
55255
|
+
* Falls back to the cfg fields when the layout item is non-canonical
|
|
55256
|
+
* (legacy bare names that LayoutModel couldn't migrate). Returns
|
|
55257
|
+
* null when even those are missing — caller hides the subtitle.
|
|
55258
|
+
*/
|
|
55259
|
+
function pickWidgetRef(item, cfg) {
|
|
55260
|
+
if (parseScopedComponentId(item === null || item === void 0 ? void 0 : item.component)) return item.component;
|
|
55261
|
+
var scope = (cfg === null || cfg === void 0 ? void 0 : cfg.scope) || (item === null || item === void 0 ? void 0 : item.scope);
|
|
55262
|
+
var pkg = (cfg === null || cfg === void 0 ? void 0 : cfg.packageName) || (item === null || item === void 0 ? void 0 : item.packageName);
|
|
55263
|
+
var comp = bareComponentName(item === null || item === void 0 ? void 0 : item.component) || (cfg === null || cfg === void 0 ? void 0 : cfg.name);
|
|
55264
|
+
if (!scope || !pkg || !comp) return (item === null || item === void 0 ? void 0 : item.component) || null;
|
|
55265
|
+
var bareScope = String(scope).replace(/^@/, "");
|
|
55266
|
+
var barePkg = String(pkg).replace(new RegExp("^@?".concat(bareScope, "/")), "");
|
|
55267
|
+
return "".concat(bareScope, ".").concat(barePkg, ".").concat(comp);
|
|
55224
55268
|
}
|
|
55225
55269
|
|
|
55226
55270
|
/**
|
|
@@ -55267,13 +55311,11 @@ var WidgetsTab = function WidgetsTab(_ref) {
|
|
|
55267
55311
|
result.push({
|
|
55268
55312
|
id: id,
|
|
55269
55313
|
component: item.component,
|
|
55270
|
-
displayName: item
|
|
55314
|
+
displayName: pickDisplayName(item, cfg),
|
|
55315
|
+
widgetRef: pickWidgetRef(item, cfg),
|
|
55271
55316
|
section: section,
|
|
55272
55317
|
userConfig: cfg.userConfig || {},
|
|
55273
55318
|
userPrefs: item.userPrefs || {},
|
|
55274
|
-
// Identity fields for the registry-identifier label. Prefer
|
|
55275
|
-
// values from the widget's component manager entry since the
|
|
55276
|
-
// layout item itself often doesn't carry scope/packageName.
|
|
55277
55319
|
scope: cfg.scope || item.scope || null,
|
|
55278
55320
|
packageName: cfg.packageName || cfg.name || item.packageName || null
|
|
55279
55321
|
});
|
|
@@ -55411,6 +55453,10 @@ var WidgetsTab = function WidgetsTab(_ref) {
|
|
|
55411
55453
|
className: "text-[10px] bg-amber-500/20 text-amber-300 px-1.5 rounded",
|
|
55412
55454
|
children: stagedForWidget
|
|
55413
55455
|
})]
|
|
55456
|
+
}), w.widgetRef && /*#__PURE__*/jsx("div", {
|
|
55457
|
+
className: "text-[10px] text-gray-500 font-mono truncate mt-0.5",
|
|
55458
|
+
title: w.widgetRef,
|
|
55459
|
+
children: w.widgetRef
|
|
55414
55460
|
}), /*#__PURE__*/jsx("div", {
|
|
55415
55461
|
className: "text-[10px] text-gray-600 mt-0.5",
|
|
55416
55462
|
children: fieldCount === 0 ? "No configurable fields" : "".concat(fieldCount, " field").concat(fieldCount === 1 ? "" : "s")
|
|
@@ -55443,20 +55489,19 @@ function SingleWidgetPane(_ref4) {
|
|
|
55443
55489
|
effectivePrefs = _ref4.effectivePrefs,
|
|
55444
55490
|
onFieldChange = _ref4.onFieldChange;
|
|
55445
55491
|
var hasFields = Object.keys(widget.userConfig).length > 0;
|
|
55446
|
-
var scopedId = buildScopedId(widget);
|
|
55447
55492
|
return /*#__PURE__*/jsxs("div", {
|
|
55448
55493
|
children: [/*#__PURE__*/jsxs("div", {
|
|
55449
55494
|
className: "mb-3",
|
|
55450
55495
|
children: [/*#__PURE__*/jsx("div", {
|
|
55451
55496
|
className: "text-gray-200 font-semibold",
|
|
55452
55497
|
children: widget.displayName
|
|
55453
|
-
}), /*#__PURE__*/
|
|
55454
|
-
className: "text-xs text-gray-500",
|
|
55455
|
-
|
|
55456
|
-
|
|
55457
|
-
|
|
55458
|
-
|
|
55459
|
-
children:
|
|
55498
|
+
}), widget.widgetRef && /*#__PURE__*/jsx("div", {
|
|
55499
|
+
className: "text-xs text-gray-500 font-mono truncate mt-0.5",
|
|
55500
|
+
title: widget.widgetRef,
|
|
55501
|
+
children: widget.widgetRef
|
|
55502
|
+
}), /*#__PURE__*/jsx("div", {
|
|
55503
|
+
className: "text-xs text-gray-600 mt-0.5",
|
|
55504
|
+
children: widget.section
|
|
55460
55505
|
})]
|
|
55461
55506
|
}), hasFields ? /*#__PURE__*/jsx(PanelEditForm, {
|
|
55462
55507
|
userConfig: widget.userConfig,
|
|
@@ -55702,11 +55747,11 @@ var DashboardConfigModal = function DashboardConfigModal(_ref) {
|
|
|
55702
55747
|
var derivePackage = function derivePackage(item) {
|
|
55703
55748
|
var scopedId = typeof (item === null || item === void 0 ? void 0 : item.component) === "string" ? item.component : "";
|
|
55704
55749
|
var parts = scopedId.split(".");
|
|
55705
|
-
if (parts.length === 3) {
|
|
55706
|
-
|
|
55707
|
-
|
|
55708
|
-
|
|
55709
|
-
|
|
55750
|
+
if (parts.length === 3 && parts[0] && parts[1]) {
|
|
55751
|
+
// Group rows by `@scope/package` so two widgets from the same
|
|
55752
|
+
// package show up under one heading. The full scoped id is
|
|
55753
|
+
// surfaced per-row in the table (column-level identity).
|
|
55754
|
+
return "@".concat(parts[0], "/").concat(parts[1]);
|
|
55710
55755
|
}
|
|
55711
55756
|
// Defensive: an explicit packageId on the item still wins for
|
|
55712
55757
|
// legacy items the migration couldn't auto-resolve.
|