@trops/dash-core 0.1.321 → 0.1.322
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/electron/index.js +100 -0
- package/dist/electron/index.js.map +1 -1
- package/dist/index.esm.js +106 -50
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +74 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -18403,6 +18403,7 @@ var WidgetCardHeader = function WidgetCardHeader(_ref) {
|
|
|
18403
18403
|
_ref$onSplitVertical = _ref.onSplitVertical,
|
|
18404
18404
|
onSplitVertical = _ref$onSplitVertical === void 0 ? null : _ref$onSplitVertical,
|
|
18405
18405
|
onMoreOptions = _ref.onMoreOptions,
|
|
18406
|
+
onEditWithAI = _ref.onEditWithAI,
|
|
18406
18407
|
_ref$isSelected = _ref.isSelected,
|
|
18407
18408
|
isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
|
|
18408
18409
|
_ref$isSelectable = _ref.isSelectable,
|
|
@@ -18520,6 +18521,16 @@ var WidgetCardHeader = function WidgetCardHeader(_ref) {
|
|
|
18520
18521
|
}
|
|
18521
18522
|
});
|
|
18522
18523
|
}
|
|
18524
|
+
if (onEditWithAI && widgetItem) {
|
|
18525
|
+
overflowActions.push({
|
|
18526
|
+
icon: "wand-magic-sparkles",
|
|
18527
|
+
label: "Edit with AI",
|
|
18528
|
+
onClick: function onClick() {
|
|
18529
|
+
onEditWithAI(widgetItem);
|
|
18530
|
+
setShowOverflowMenu(false);
|
|
18531
|
+
}
|
|
18532
|
+
});
|
|
18533
|
+
}
|
|
18523
18534
|
if (onSplitHorizontal) {
|
|
18524
18535
|
overflowActions.push({
|
|
18525
18536
|
icon: "arrows-left-right",
|
|
@@ -18669,6 +18680,13 @@ var WidgetCardHeader = function WidgetCardHeader(_ref) {
|
|
|
18669
18680
|
},
|
|
18670
18681
|
title: "Configure widget",
|
|
18671
18682
|
theme: false
|
|
18683
|
+
}), onEditWithAI && widgetItem && /*#__PURE__*/jsxRuntime.jsx(DashReact.ButtonIcon2, {
|
|
18684
|
+
icon: "wand-magic-sparkles",
|
|
18685
|
+
onClick: function onClick() {
|
|
18686
|
+
return onEditWithAI(widgetItem);
|
|
18687
|
+
},
|
|
18688
|
+
title: "Edit with AI",
|
|
18689
|
+
theme: false
|
|
18672
18690
|
}), onSplitHorizontal && /*#__PURE__*/jsxRuntime.jsx(DashReact.ButtonIcon2, {
|
|
18673
18691
|
icon: "arrows-left-right",
|
|
18674
18692
|
onClick: function onClick(e) {
|
|
@@ -20488,6 +20506,40 @@ var LayoutBuilder = function LayoutBuilder(_ref) {
|
|
|
20488
20506
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
20489
20507
|
}, []);
|
|
20490
20508
|
|
|
20509
|
+
// Listen for AI widget remix — swaps existing widget component in-place
|
|
20510
|
+
React.useEffect(function () {
|
|
20511
|
+
var handler = function handler(e) {
|
|
20512
|
+
var _ref5 = e.detail || {},
|
|
20513
|
+
widgetComponentName = _ref5.widgetComponentName,
|
|
20514
|
+
widgetId = _ref5.widgetId;
|
|
20515
|
+
if (!widgetComponentName || !widgetId) return;
|
|
20516
|
+
var ws = wsRef.current;
|
|
20517
|
+
if (!(ws !== null && ws !== void 0 && ws.layout)) return;
|
|
20518
|
+
var config = ComponentManager.config(widgetComponentName);
|
|
20519
|
+
if (!config) {
|
|
20520
|
+
return;
|
|
20521
|
+
}
|
|
20522
|
+
try {
|
|
20523
|
+
var newLayout = updateLayoutItem(ws.layout, {
|
|
20524
|
+
id: widgetId,
|
|
20525
|
+
component: widgetComponentName
|
|
20526
|
+
});
|
|
20527
|
+
if (!newLayout) {
|
|
20528
|
+
return;
|
|
20529
|
+
}
|
|
20530
|
+
var newWorkspace = JSON.parse(JSON.stringify(ws));
|
|
20531
|
+
newWorkspace.layout = newLayout;
|
|
20532
|
+
setCurrentWorkspace(newWorkspace);
|
|
20533
|
+
} catch (err) {
|
|
20534
|
+
}
|
|
20535
|
+
};
|
|
20536
|
+
window.addEventListener("dash:swap-widget-in-cell", handler);
|
|
20537
|
+
return function () {
|
|
20538
|
+
return window.removeEventListener("dash:swap-widget-in-cell", handler);
|
|
20539
|
+
};
|
|
20540
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
20541
|
+
}, []);
|
|
20542
|
+
|
|
20491
20543
|
/**
|
|
20492
20544
|
* onClickAdd
|
|
20493
20545
|
* From the Widget or Container, clicked plus button to add a widget
|
|
@@ -20899,11 +20951,11 @@ var LayoutBuilder = function LayoutBuilder(_ref) {
|
|
|
20899
20951
|
|
|
20900
20952
|
// Grid Operation Handlers
|
|
20901
20953
|
|
|
20902
|
-
function handleSplitCell(
|
|
20903
|
-
var cellNumber =
|
|
20904
|
-
direction =
|
|
20905
|
-
count =
|
|
20906
|
-
gridContainer =
|
|
20954
|
+
function handleSplitCell(_ref6) {
|
|
20955
|
+
var cellNumber = _ref6.cellNumber,
|
|
20956
|
+
direction = _ref6.direction,
|
|
20957
|
+
count = _ref6.count,
|
|
20958
|
+
gridContainer = _ref6.gridContainer;
|
|
20907
20959
|
try {
|
|
20908
20960
|
var dashboard = new DashboardModel(currentWorkspace);
|
|
20909
20961
|
var result = dashboard.splitGridCell(gridContainer.id, cellNumber, direction, count);
|
|
@@ -20915,10 +20967,10 @@ var LayoutBuilder = function LayoutBuilder(_ref) {
|
|
|
20915
20967
|
} catch (e) {
|
|
20916
20968
|
}
|
|
20917
20969
|
}
|
|
20918
|
-
function handleMergeCells(
|
|
20919
|
-
var cellNumbers =
|
|
20920
|
-
gridContainer =
|
|
20921
|
-
keepComponent =
|
|
20970
|
+
function handleMergeCells(_ref7) {
|
|
20971
|
+
var cellNumbers = _ref7.cellNumbers,
|
|
20972
|
+
gridContainer = _ref7.gridContainer,
|
|
20973
|
+
keepComponent = _ref7.keepComponent;
|
|
20922
20974
|
try {
|
|
20923
20975
|
var dashboard = new DashboardModel(currentWorkspace);
|
|
20924
20976
|
var result = dashboard.mergeGridCells(gridContainer.id, cellNumbers);
|
|
@@ -25239,6 +25291,19 @@ var LayoutGridContainer = /*#__PURE__*/React.memo(function (_ref3) {
|
|
|
25239
25291
|
} : undefined,
|
|
25240
25292
|
onDelete: cellComponent ? function () {
|
|
25241
25293
|
if (onClickRemove) onClickRemove(cellComponent.id);
|
|
25294
|
+
} : undefined,
|
|
25295
|
+
onEditWithAI: cellComponent ? function () {
|
|
25296
|
+
var _ComponentManager$con;
|
|
25297
|
+
window.dispatchEvent(new CustomEvent("dash:edit-widget-with-ai", {
|
|
25298
|
+
detail: {
|
|
25299
|
+
cellNumber: cellNumber,
|
|
25300
|
+
gridItemId: item.id,
|
|
25301
|
+
workspaceId: workspace === null || workspace === void 0 ? void 0 : workspace.id,
|
|
25302
|
+
widgetComponentName: cellComponent.component,
|
|
25303
|
+
widgetId: cellComponent.id,
|
|
25304
|
+
sourcePackage: ((_ComponentManager$con = ComponentManager.config(cellComponent.component, cellComponent)) === null || _ComponentManager$con === void 0 ? void 0 : _ComponentManager$con._sourcePackage) || null
|
|
25305
|
+
}
|
|
25306
|
+
}));
|
|
25242
25307
|
} : undefined
|
|
25243
25308
|
}), cellComponent && ComponentManager.config(cellComponent.component, cellComponent) ? /*#__PURE__*/jsxRuntime.jsx(DraggableDroppableCellBody, {
|
|
25244
25309
|
cellNumber: cellNumber,
|