@trops/dash-core 0.1.321 → 0.1.323
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 +108 -50
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +76 -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) {
|
|
@@ -19057,6 +19075,7 @@ var WidgetCardHeader_Component = function WidgetCardHeader_Component(_ref) {
|
|
|
19057
19075
|
onSplitHorizontal = _ref$onSplitHorizonta === void 0 ? null : _ref$onSplitHorizonta,
|
|
19058
19076
|
_ref$onSplitVertical = _ref.onSplitVertical,
|
|
19059
19077
|
onSplitVertical = _ref$onSplitVertical === void 0 ? null : _ref$onSplitVertical,
|
|
19078
|
+
onEditWithAI = _ref.onEditWithAI,
|
|
19060
19079
|
_ref$isSelected = _ref.isSelected,
|
|
19061
19080
|
isSelected = _ref$isSelected === void 0 ? false : _ref$isSelected,
|
|
19062
19081
|
_ref$isSelectable = _ref.isSelectable,
|
|
@@ -19080,6 +19099,7 @@ var WidgetCardHeader_Component = function WidgetCardHeader_Component(_ref) {
|
|
|
19080
19099
|
onDelete: onDelete,
|
|
19081
19100
|
onSplitHorizontal: onSplitHorizontal,
|
|
19082
19101
|
onSplitVertical: onSplitVertical,
|
|
19102
|
+
onEditWithAI: onEditWithAI,
|
|
19083
19103
|
isSelected: isSelected,
|
|
19084
19104
|
isSelectable: isSelectable,
|
|
19085
19105
|
onToggleSelect: onToggleSelect
|
|
@@ -20488,6 +20508,40 @@ var LayoutBuilder = function LayoutBuilder(_ref) {
|
|
|
20488
20508
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
20489
20509
|
}, []);
|
|
20490
20510
|
|
|
20511
|
+
// Listen for AI widget remix — swaps existing widget component in-place
|
|
20512
|
+
React.useEffect(function () {
|
|
20513
|
+
var handler = function handler(e) {
|
|
20514
|
+
var _ref5 = e.detail || {},
|
|
20515
|
+
widgetComponentName = _ref5.widgetComponentName,
|
|
20516
|
+
widgetId = _ref5.widgetId;
|
|
20517
|
+
if (!widgetComponentName || !widgetId) return;
|
|
20518
|
+
var ws = wsRef.current;
|
|
20519
|
+
if (!(ws !== null && ws !== void 0 && ws.layout)) return;
|
|
20520
|
+
var config = ComponentManager.config(widgetComponentName);
|
|
20521
|
+
if (!config) {
|
|
20522
|
+
return;
|
|
20523
|
+
}
|
|
20524
|
+
try {
|
|
20525
|
+
var newLayout = updateLayoutItem(ws.layout, {
|
|
20526
|
+
id: widgetId,
|
|
20527
|
+
component: widgetComponentName
|
|
20528
|
+
});
|
|
20529
|
+
if (!newLayout) {
|
|
20530
|
+
return;
|
|
20531
|
+
}
|
|
20532
|
+
var newWorkspace = JSON.parse(JSON.stringify(ws));
|
|
20533
|
+
newWorkspace.layout = newLayout;
|
|
20534
|
+
setCurrentWorkspace(newWorkspace);
|
|
20535
|
+
} catch (err) {
|
|
20536
|
+
}
|
|
20537
|
+
};
|
|
20538
|
+
window.addEventListener("dash:swap-widget-in-cell", handler);
|
|
20539
|
+
return function () {
|
|
20540
|
+
return window.removeEventListener("dash:swap-widget-in-cell", handler);
|
|
20541
|
+
};
|
|
20542
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
20543
|
+
}, []);
|
|
20544
|
+
|
|
20491
20545
|
/**
|
|
20492
20546
|
* onClickAdd
|
|
20493
20547
|
* From the Widget or Container, clicked plus button to add a widget
|
|
@@ -20899,11 +20953,11 @@ var LayoutBuilder = function LayoutBuilder(_ref) {
|
|
|
20899
20953
|
|
|
20900
20954
|
// Grid Operation Handlers
|
|
20901
20955
|
|
|
20902
|
-
function handleSplitCell(
|
|
20903
|
-
var cellNumber =
|
|
20904
|
-
direction =
|
|
20905
|
-
count =
|
|
20906
|
-
gridContainer =
|
|
20956
|
+
function handleSplitCell(_ref6) {
|
|
20957
|
+
var cellNumber = _ref6.cellNumber,
|
|
20958
|
+
direction = _ref6.direction,
|
|
20959
|
+
count = _ref6.count,
|
|
20960
|
+
gridContainer = _ref6.gridContainer;
|
|
20907
20961
|
try {
|
|
20908
20962
|
var dashboard = new DashboardModel(currentWorkspace);
|
|
20909
20963
|
var result = dashboard.splitGridCell(gridContainer.id, cellNumber, direction, count);
|
|
@@ -20915,10 +20969,10 @@ var LayoutBuilder = function LayoutBuilder(_ref) {
|
|
|
20915
20969
|
} catch (e) {
|
|
20916
20970
|
}
|
|
20917
20971
|
}
|
|
20918
|
-
function handleMergeCells(
|
|
20919
|
-
var cellNumbers =
|
|
20920
|
-
gridContainer =
|
|
20921
|
-
keepComponent =
|
|
20972
|
+
function handleMergeCells(_ref7) {
|
|
20973
|
+
var cellNumbers = _ref7.cellNumbers,
|
|
20974
|
+
gridContainer = _ref7.gridContainer,
|
|
20975
|
+
keepComponent = _ref7.keepComponent;
|
|
20922
20976
|
try {
|
|
20923
20977
|
var dashboard = new DashboardModel(currentWorkspace);
|
|
20924
20978
|
var result = dashboard.mergeGridCells(gridContainer.id, cellNumbers);
|
|
@@ -25239,6 +25293,19 @@ var LayoutGridContainer = /*#__PURE__*/React.memo(function (_ref3) {
|
|
|
25239
25293
|
} : undefined,
|
|
25240
25294
|
onDelete: cellComponent ? function () {
|
|
25241
25295
|
if (onClickRemove) onClickRemove(cellComponent.id);
|
|
25296
|
+
} : undefined,
|
|
25297
|
+
onEditWithAI: cellComponent ? function () {
|
|
25298
|
+
var _ComponentManager$con;
|
|
25299
|
+
window.dispatchEvent(new CustomEvent("dash:edit-widget-with-ai", {
|
|
25300
|
+
detail: {
|
|
25301
|
+
cellNumber: cellNumber,
|
|
25302
|
+
gridItemId: item.id,
|
|
25303
|
+
workspaceId: workspace === null || workspace === void 0 ? void 0 : workspace.id,
|
|
25304
|
+
widgetComponentName: cellComponent.component,
|
|
25305
|
+
widgetId: cellComponent.id,
|
|
25306
|
+
sourcePackage: ((_ComponentManager$con = ComponentManager.config(cellComponent.component, cellComponent)) === null || _ComponentManager$con === void 0 ? void 0 : _ComponentManager$con._sourcePackage) || null
|
|
25307
|
+
}
|
|
25308
|
+
}));
|
|
25242
25309
|
} : undefined
|
|
25243
25310
|
}), cellComponent && ComponentManager.config(cellComponent.component, cellComponent) ? /*#__PURE__*/jsxRuntime.jsx(DraggableDroppableCellBody, {
|
|
25244
25311
|
cellNumber: cellNumber,
|