@trops/dash-core 0.1.275 → 0.1.277

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 CHANGED
@@ -29432,6 +29432,11 @@ var ComponentManager = {
29432
29432
  // otherwise fall back to the provided widgetKey for backward compatibility
29433
29433
  var registrationKey = config.id || widgetKey;
29434
29434
  tempComponentMap[registrationKey] = ComponentConfigModel(config);
29435
+ // Also register under plain component name for backward compat
29436
+ // (dashboards may reference "SlackWidget" instead of "trops.slack.SlackWidget")
29437
+ if (config.id && config.id !== widgetKey && !tempComponentMap[widgetKey]) {
29438
+ tempComponentMap[widgetKey] = tempComponentMap[registrationKey];
29439
+ }
29435
29440
  this.setComponentMap(tempComponentMap);
29436
29441
  },
29437
29442
  /**
@@ -45622,15 +45627,25 @@ var WidgetsSection = function WidgetsSection(_ref) {
45622
45627
  // ── Uninstall with usage check ──────────────────────────────────────
45623
45628
 
45624
45629
  function handleDeleteRequest(widget) {
45625
- var usage = findWidgetUsage(widget.componentNames, workspaces);
45630
+ // Find all sibling widgets in the same package (uninstall is package-level)
45631
+ var siblings = widget.packageId && widget.source === "installed" ? widgets.filter(function (w) {
45632
+ return w.packageId === widget.packageId && w.name !== widget.name;
45633
+ }) : [];
45634
+ var allComponentNames = [].concat(_toConsumableArray(widget.componentNames), _toConsumableArray(siblings.flatMap(function (s) {
45635
+ return s.componentNames;
45636
+ })));
45637
+ var usage = findWidgetUsage(allComponentNames, workspaces);
45626
45638
  setDeleteUsage(usage);
45627
- setDeleteTarget(widget);
45639
+ setDeleteTarget(_objectSpread$6(_objectSpread$6({}, widget), {}, {
45640
+ _siblings: siblings
45641
+ }));
45628
45642
  }
45629
45643
  function handleConfirmDelete() {
45630
45644
  return _handleConfirmDelete.apply(this, arguments);
45631
45645
  }
45632
45646
  function _handleConfirmDelete() {
45633
45647
  _handleConfirmDelete = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
45648
+ var allNames;
45634
45649
  return _regeneratorRuntime.wrap(function (_context) {
45635
45650
  while (1) switch (_context.prev = _context.next) {
45636
45651
  case 0:
@@ -45644,7 +45659,11 @@ var WidgetsSection = function WidgetsSection(_ref) {
45644
45659
  _context.next = 2;
45645
45660
  return uninstallWidget(deleteTarget.name);
45646
45661
  case 2:
45647
- if (selectedWidgetName === deleteTarget.name) {
45662
+ // Clear selection if it was the target or any sibling
45663
+ allNames = [deleteTarget.name].concat(_toConsumableArray((deleteTarget._siblings || []).map(function (s) {
45664
+ return s.name;
45665
+ })));
45666
+ if (allNames.includes(selectedWidgetName)) {
45648
45667
  setSelectedWidgetName(null);
45649
45668
  }
45650
45669
  _context.next = 4;
@@ -46113,6 +46132,9 @@ var WidgetsSection = function WidgetsSection(_ref) {
46113
46132
 
46114
46133
  var paragraphStyles = getStylesForItem(themeObjects.PARAGRAPH, currentTheme);
46115
46134
  var deleteWidgetLabel = (deleteTarget === null || deleteTarget === void 0 ? void 0 : deleteTarget.displayName) || (deleteTarget === null || deleteTarget === void 0 ? void 0 : deleteTarget.name) || "";
46135
+ var deleteSiblings = (deleteTarget === null || deleteTarget === void 0 ? void 0 : deleteTarget._siblings) || [];
46136
+ var deletePackageLabel = deleteTarget !== null && deleteTarget !== void 0 && deleteTarget.packageId ? deleteTarget.packageId.replace(/^@[^/]+\//, "") : "";
46137
+ var hasPackageSiblings = deleteSiblings.length > 0;
46116
46138
  return /*#__PURE__*/jsxs(Fragment, {
46117
46139
  children: [/*#__PURE__*/jsx(SectionLayout, {
46118
46140
  listContent: listContent,
@@ -46130,8 +46152,8 @@ var WidgetsSection = function WidgetsSection(_ref) {
46130
46152
  setDeleteTarget(null);
46131
46153
  setDeleteUsage([]);
46132
46154
  },
46133
- title: "Uninstall Widget"
46134
- }, deleteUsage.length === 0 ? {
46155
+ title: hasPackageSiblings ? "Uninstall Package" : "Uninstall Widget"
46156
+ }, !hasPackageSiblings && deleteUsage.length === 0 ? {
46135
46157
  message: "Are you sure you want to uninstall \"".concat(deleteWidgetLabel, "\"?")
46136
46158
  } : {}), {}, {
46137
46159
  confirmLabel: "Uninstall",
@@ -46141,27 +46163,48 @@ var WidgetsSection = function WidgetsSection(_ref) {
46141
46163
  setDeleteTarget(null);
46142
46164
  setDeleteUsage([]);
46143
46165
  },
46144
- children: deleteUsage.length > 0 && /*#__PURE__*/jsxs("div", {
46166
+ children: (hasPackageSiblings || deleteUsage.length > 0) && /*#__PURE__*/jsxs("div", {
46145
46167
  className: paragraphStyles.textColor || "",
46146
- children: [/*#__PURE__*/jsxs("p", {
46147
- className: "text-sm leading-relaxed",
46148
- children: ["\"", deleteWidgetLabel, "\" is currently used in ", deleteUsage.length, " ", "dashboard", deleteUsage.length !== 1 ? "s" : "", ". Uninstalling will leave orphaned layout items on these dashboards."]
46149
- }), /*#__PURE__*/jsxs("div", {
46150
- className: "mt-2 space-y-1",
46151
- children: [/*#__PURE__*/jsx("span", {
46152
- className: "text-xs font-semibold opacity-70",
46153
- children: "Affected dashboards:"
46154
- }), deleteUsage.map(function (u) {
46155
- return /*#__PURE__*/jsxs("div", {
46156
- className: "text-xs opacity-60 flex items-center gap-1.5 pl-2",
46157
- children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
46158
- icon: "triangle-exclamation",
46159
- className: "h-3 w-3 text-yellow-500"
46160
- }), u.workspaceName, " ", /*#__PURE__*/jsxs("span", {
46161
- className: "opacity-50",
46162
- children: ["(", u.count, " instance", u.count !== 1 ? "s" : "", ")"]
46163
- })]
46164
- }, u.workspaceId);
46168
+ children: [hasPackageSiblings && /*#__PURE__*/jsxs(Fragment, {
46169
+ children: [/*#__PURE__*/jsxs("p", {
46170
+ className: "text-sm leading-relaxed",
46171
+ children: ["\"", deleteWidgetLabel, "\" is part of the", " ", /*#__PURE__*/jsx("span", {
46172
+ className: "font-semibold",
46173
+ children: deletePackageLabel
46174
+ }), " ", "package. Uninstalling will remove all", " ", deleteSiblings.length + 1, " widgets in this package:"]
46175
+ }), /*#__PURE__*/jsx("div", {
46176
+ className: "mt-2 mb-2 space-y-1",
46177
+ children: [deleteTarget].concat(_toConsumableArray(deleteSiblings)).map(function (w) {
46178
+ return /*#__PURE__*/jsxs("div", {
46179
+ className: "text-xs opacity-60 flex items-center gap-1.5 pl-2",
46180
+ children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
46181
+ icon: "puzzle-piece",
46182
+ className: "h-3 w-3"
46183
+ }), w.displayName || w.name]
46184
+ }, w.name);
46185
+ })
46186
+ })]
46187
+ }), deleteUsage.length > 0 && /*#__PURE__*/jsxs(Fragment, {
46188
+ children: [/*#__PURE__*/jsxs("p", {
46189
+ className: "text-sm leading-relaxed",
46190
+ children: [hasPackageSiblings ? "These widgets are" : "\"".concat(deleteWidgetLabel, "\" is"), " ", "currently used in ", deleteUsage.length, " dashboard", deleteUsage.length !== 1 ? "s" : "", ". Uninstalling will leave orphaned layout items on these dashboards."]
46191
+ }), /*#__PURE__*/jsxs("div", {
46192
+ className: "mt-2 space-y-1",
46193
+ children: [/*#__PURE__*/jsx("span", {
46194
+ className: "text-xs font-semibold opacity-70",
46195
+ children: "Affected dashboards:"
46196
+ }), deleteUsage.map(function (u) {
46197
+ return /*#__PURE__*/jsxs("div", {
46198
+ className: "text-xs opacity-60 flex items-center gap-1.5 pl-2",
46199
+ children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
46200
+ icon: "triangle-exclamation",
46201
+ className: "h-3 w-3 text-yellow-500"
46202
+ }), u.workspaceName, " ", /*#__PURE__*/jsxs("span", {
46203
+ className: "opacity-50",
46204
+ children: ["(", u.count, " instance", u.count !== 1 ? "s" : "", ")"]
46205
+ })]
46206
+ }, u.workspaceId);
46207
+ })]
46165
46208
  })]
46166
46209
  })]
46167
46210
  })