dp-widgets-framework 1.7.3 → 1.7.5
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 +49 -60
- package/dist/index.js +48 -59
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -7,7 +7,7 @@ import * as LabelPrimitive from '@radix-ui/react-label';
|
|
|
7
7
|
import { cva } from 'class-variance-authority';
|
|
8
8
|
import * as SwitchPrimitives from '@radix-ui/react-switch';
|
|
9
9
|
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
10
|
-
import { ChevronDown, ChevronUp, Check, AlertCircle, MoveUp, MoveDown, Trash2, Plus, Bot, Type, Layout, LayoutGrid, BarChart as BarChart$1, Filter, Search, ArrowUp, ArrowDown, ChevronRight, RefreshCw, Loader2, Download, Send, X, AlignVerticalSpaceAround, LineChart as LineChart$1, PieChart as PieChart$1, Table,
|
|
10
|
+
import { ChevronDown, ChevronUp, Check, AlertCircle, MoveUp, MoveDown, Trash2, Plus, Bot, Type, Layout, LayoutGrid, BarChart as BarChart$1, Filter, Search, ArrowUp, ArrowDown, ChevronRight, RefreshCw, Loader2, Download, Send, X, AlignVerticalSpaceAround, LineChart as LineChart$1, PieChart as PieChart$1, Table, SlidersHorizontal, GripHorizontal, Edit, MessageCircleX, ChevronLeft, Maximize2, Grid3X3, Edit2 } from 'lucide-react';
|
|
11
11
|
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
12
12
|
import { Slot, createSlot, createSlottable } from '@radix-ui/react-slot';
|
|
13
13
|
import { debounce as debounce$1 } from 'lodash';
|
|
@@ -45397,54 +45397,56 @@ function FiltersContent({
|
|
|
45397
45397
|
children: "Clear All Filters"
|
|
45398
45398
|
}
|
|
45399
45399
|
) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}),
|
|
45400
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
45401
|
-
|
|
45402
|
-
|
|
45403
|
-
|
|
45404
|
-
|
|
45405
|
-
|
|
45406
|
-
|
|
45407
|
-
|
|
45408
|
-
|
|
45409
|
-
|
|
45400
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip$1, { children: [
|
|
45401
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: isEditing ? "cursor-not-allowed" : "", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
45402
|
+
Button,
|
|
45403
|
+
{
|
|
45404
|
+
onClick: async () => {
|
|
45405
|
+
const filtersWithLabels = {};
|
|
45406
|
+
filterGroups.forEach((group) => {
|
|
45407
|
+
const optionIds = selectedFilters[group.id] || [];
|
|
45408
|
+
filtersWithLabels[group.id] = optionIds.map((optionId) => {
|
|
45409
|
+
const option = group.options.find((opt) => opt.id === optionId);
|
|
45410
|
+
return (option == null ? void 0 : option.label) || optionId;
|
|
45411
|
+
});
|
|
45410
45412
|
});
|
|
45411
|
-
|
|
45412
|
-
|
|
45413
|
-
|
|
45414
|
-
|
|
45415
|
-
|
|
45416
|
-
|
|
45417
|
-
|
|
45418
|
-
|
|
45419
|
-
|
|
45420
|
-
|
|
45421
|
-
|
|
45422
|
-
|
|
45413
|
+
if (widgetBackendUrl && widgetId) {
|
|
45414
|
+
setIsSubmitting(true);
|
|
45415
|
+
try {
|
|
45416
|
+
const response = await fetch(`${widgetBackendUrl}/api/widgets/${widgetId}/config`, {
|
|
45417
|
+
method: "PATCH",
|
|
45418
|
+
headers: {
|
|
45419
|
+
"Content-Type": "application/json"
|
|
45420
|
+
},
|
|
45421
|
+
body: JSON.stringify({
|
|
45422
|
+
config: __spreadProps$7(__spreadValues$9({}, widget.config), {
|
|
45423
|
+
filters: filtersWithLabels
|
|
45424
|
+
})
|
|
45423
45425
|
})
|
|
45424
|
-
})
|
|
45425
|
-
|
|
45426
|
-
|
|
45427
|
-
|
|
45426
|
+
});
|
|
45427
|
+
if (!response.ok) {
|
|
45428
|
+
throw new Error("Failed to update widget config");
|
|
45429
|
+
}
|
|
45430
|
+
await (onApplyFilters == null ? void 0 : onApplyFilters(filtersWithLabels));
|
|
45431
|
+
} catch (error) {
|
|
45432
|
+
console.error("Error updating widget config:", error);
|
|
45433
|
+
} finally {
|
|
45434
|
+
setIsSubmitting(false);
|
|
45428
45435
|
}
|
|
45429
|
-
|
|
45430
|
-
|
|
45431
|
-
console.error("Error updating widget config:", error);
|
|
45432
|
-
} finally {
|
|
45433
|
-
setIsSubmitting(false);
|
|
45436
|
+
} else {
|
|
45437
|
+
onApplyFilters == null ? void 0 : onApplyFilters(filtersWithLabels);
|
|
45434
45438
|
}
|
|
45435
|
-
}
|
|
45436
|
-
|
|
45437
|
-
}
|
|
45438
|
-
|
|
45439
|
-
|
|
45440
|
-
|
|
45441
|
-
|
|
45442
|
-
|
|
45443
|
-
|
|
45444
|
-
|
|
45445
|
-
|
|
45446
|
-
}
|
|
45447
|
-
)
|
|
45439
|
+
},
|
|
45440
|
+
disabled: isEditing || isSubmitting,
|
|
45441
|
+
className: `${isEditing || isSubmitting ? "bg-gray-400 cursor-not-allowed" : "bg-primary-600 hover:bg-primary-700"} text-white`,
|
|
45442
|
+
children: isSubmitting ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
45443
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
45444
|
+
"Applying..."
|
|
45445
|
+
] }) : "Apply Filters"
|
|
45446
|
+
}
|
|
45447
|
+
) }) }),
|
|
45448
|
+
isEditing && /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "top", children: "Save the layout first to apply filters" })
|
|
45449
|
+
] }) })
|
|
45448
45450
|
] }) })
|
|
45449
45451
|
] });
|
|
45450
45452
|
}
|
|
@@ -47934,13 +47936,6 @@ function AddWidgetDialog({ isOpen, onClose, addWidgetFn, defaultAgentName = "adk
|
|
|
47934
47936
|
description: "Create interactive data tables with custom queries",
|
|
47935
47937
|
configRequired: true
|
|
47936
47938
|
},
|
|
47937
|
-
{
|
|
47938
|
-
type: "summary",
|
|
47939
|
-
title: "Summary Widget",
|
|
47940
|
-
icon: FileText,
|
|
47941
|
-
description: "Display text summaries with statistics and markdown rendering",
|
|
47942
|
-
configRequired: true
|
|
47943
|
-
},
|
|
47944
47939
|
{
|
|
47945
47940
|
type: "chatbot",
|
|
47946
47941
|
title: "Chatbot Widget",
|
|
@@ -48024,12 +48019,6 @@ function AddWidgetDialog({ isOpen, onClose, addWidgetFn, defaultAgentName = "adk
|
|
|
48024
48019
|
agentName: defaultAgentName,
|
|
48025
48020
|
agentType: "Data Grid Agent"
|
|
48026
48021
|
};
|
|
48027
|
-
} else if (selectedWidgetType === "summary") {
|
|
48028
|
-
config = {
|
|
48029
|
-
query,
|
|
48030
|
-
agentName: defaultAgentName,
|
|
48031
|
-
agentType: "Summary Agent"
|
|
48032
|
-
};
|
|
48033
48022
|
} else if (selectedWidgetType === "chatbot") {
|
|
48034
48023
|
config = {
|
|
48035
48024
|
agentName: defaultAgentName
|
|
@@ -48114,7 +48103,7 @@ function AddWidgetDialog({ isOpen, onClose, addWidgetFn, defaultAgentName = "adk
|
|
|
48114
48103
|
)
|
|
48115
48104
|
] }),
|
|
48116
48105
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-gray-700", children: selectedWidgetType === "chatbot" ? "Chatbot widget will be configured with the default agent." : selectedWidgetType === "text" ? "Customize the widget's appearance" : selectedWidgetType === "filters" ? "Configure the filters widget:" : "Enter a query for your chart widget:" }) }),
|
|
48117
|
-
(selectedWidgetType === "bar-chart" || selectedWidgetType === "series-bar-chart" || selectedWidgetType === "series-line-chart" || selectedWidgetType === "line-chart" || selectedWidgetType === "pie-chart" || selectedWidgetType === "data-grid"
|
|
48106
|
+
(selectedWidgetType === "bar-chart" || selectedWidgetType === "series-bar-chart" || selectedWidgetType === "series-line-chart" || selectedWidgetType === "line-chart" || selectedWidgetType === "pie-chart" || selectedWidgetType === "data-grid") && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-6", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
48118
48107
|
Textarea,
|
|
48119
48108
|
{
|
|
48120
48109
|
value: query,
|
|
@@ -48213,7 +48202,7 @@ function AddWidgetDialog({ isOpen, onClose, addWidgetFn, defaultAgentName = "adk
|
|
|
48213
48202
|
Button,
|
|
48214
48203
|
{
|
|
48215
48204
|
onClick: handleConfigSubmit,
|
|
48216
|
-
disabled: (selectedWidgetType === "bar-chart" || selectedWidgetType === "series-bar-chart" || selectedWidgetType === "series-line-chart" || selectedWidgetType === "line-chart" || selectedWidgetType === "pie-chart" || selectedWidgetType === "data-grid"
|
|
48205
|
+
disabled: (selectedWidgetType === "bar-chart" || selectedWidgetType === "series-bar-chart" || selectedWidgetType === "series-line-chart" || selectedWidgetType === "line-chart" || selectedWidgetType === "pie-chart" || selectedWidgetType === "data-grid") && !query.trim(),
|
|
48217
48206
|
children: "Add Widget"
|
|
48218
48207
|
}
|
|
48219
48208
|
)
|
package/dist/index.js
CHANGED
|
@@ -45425,54 +45425,56 @@ function FiltersContent({
|
|
|
45425
45425
|
children: "Clear All Filters"
|
|
45426
45426
|
}
|
|
45427
45427
|
) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", {}),
|
|
45428
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
45429
|
-
|
|
45430
|
-
|
|
45431
|
-
|
|
45432
|
-
|
|
45433
|
-
|
|
45434
|
-
|
|
45435
|
-
|
|
45436
|
-
|
|
45437
|
-
|
|
45428
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip$1, { children: [
|
|
45429
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: isEditing ? "cursor-not-allowed" : "", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
45430
|
+
Button,
|
|
45431
|
+
{
|
|
45432
|
+
onClick: async () => {
|
|
45433
|
+
const filtersWithLabels = {};
|
|
45434
|
+
filterGroups.forEach((group) => {
|
|
45435
|
+
const optionIds = selectedFilters[group.id] || [];
|
|
45436
|
+
filtersWithLabels[group.id] = optionIds.map((optionId) => {
|
|
45437
|
+
const option = group.options.find((opt) => opt.id === optionId);
|
|
45438
|
+
return (option == null ? void 0 : option.label) || optionId;
|
|
45439
|
+
});
|
|
45438
45440
|
});
|
|
45439
|
-
|
|
45440
|
-
|
|
45441
|
-
|
|
45442
|
-
|
|
45443
|
-
|
|
45444
|
-
|
|
45445
|
-
|
|
45446
|
-
|
|
45447
|
-
|
|
45448
|
-
|
|
45449
|
-
|
|
45450
|
-
|
|
45441
|
+
if (widgetBackendUrl && widgetId) {
|
|
45442
|
+
setIsSubmitting(true);
|
|
45443
|
+
try {
|
|
45444
|
+
const response = await fetch(`${widgetBackendUrl}/api/widgets/${widgetId}/config`, {
|
|
45445
|
+
method: "PATCH",
|
|
45446
|
+
headers: {
|
|
45447
|
+
"Content-Type": "application/json"
|
|
45448
|
+
},
|
|
45449
|
+
body: JSON.stringify({
|
|
45450
|
+
config: __spreadProps$7(__spreadValues$9({}, widget.config), {
|
|
45451
|
+
filters: filtersWithLabels
|
|
45452
|
+
})
|
|
45451
45453
|
})
|
|
45452
|
-
})
|
|
45453
|
-
|
|
45454
|
-
|
|
45455
|
-
|
|
45454
|
+
});
|
|
45455
|
+
if (!response.ok) {
|
|
45456
|
+
throw new Error("Failed to update widget config");
|
|
45457
|
+
}
|
|
45458
|
+
await (onApplyFilters == null ? void 0 : onApplyFilters(filtersWithLabels));
|
|
45459
|
+
} catch (error) {
|
|
45460
|
+
console.error("Error updating widget config:", error);
|
|
45461
|
+
} finally {
|
|
45462
|
+
setIsSubmitting(false);
|
|
45456
45463
|
}
|
|
45457
|
-
|
|
45458
|
-
|
|
45459
|
-
console.error("Error updating widget config:", error);
|
|
45460
|
-
} finally {
|
|
45461
|
-
setIsSubmitting(false);
|
|
45464
|
+
} else {
|
|
45465
|
+
onApplyFilters == null ? void 0 : onApplyFilters(filtersWithLabels);
|
|
45462
45466
|
}
|
|
45463
|
-
}
|
|
45464
|
-
|
|
45465
|
-
}
|
|
45466
|
-
|
|
45467
|
-
|
|
45468
|
-
|
|
45469
|
-
|
|
45470
|
-
|
|
45471
|
-
|
|
45472
|
-
|
|
45473
|
-
|
|
45474
|
-
}
|
|
45475
|
-
)
|
|
45467
|
+
},
|
|
45468
|
+
disabled: isEditing || isSubmitting,
|
|
45469
|
+
className: `${isEditing || isSubmitting ? "bg-gray-400 cursor-not-allowed" : "bg-primary-600 hover:bg-primary-700"} text-white`,
|
|
45470
|
+
children: isSubmitting ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
45471
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(lucideReact.Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
45472
|
+
"Applying..."
|
|
45473
|
+
] }) : "Apply Filters"
|
|
45474
|
+
}
|
|
45475
|
+
) }) }),
|
|
45476
|
+
isEditing && /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { side: "top", children: "Save the layout first to apply filters" })
|
|
45477
|
+
] }) })
|
|
45476
45478
|
] }) })
|
|
45477
45479
|
] });
|
|
45478
45480
|
}
|
|
@@ -47962,13 +47964,6 @@ function AddWidgetDialog({ isOpen, onClose, addWidgetFn, defaultAgentName = "adk
|
|
|
47962
47964
|
description: "Create interactive data tables with custom queries",
|
|
47963
47965
|
configRequired: true
|
|
47964
47966
|
},
|
|
47965
|
-
{
|
|
47966
|
-
type: "summary",
|
|
47967
|
-
title: "Summary Widget",
|
|
47968
|
-
icon: lucideReact.FileText,
|
|
47969
|
-
description: "Display text summaries with statistics and markdown rendering",
|
|
47970
|
-
configRequired: true
|
|
47971
|
-
},
|
|
47972
47967
|
{
|
|
47973
47968
|
type: "chatbot",
|
|
47974
47969
|
title: "Chatbot Widget",
|
|
@@ -48052,12 +48047,6 @@ function AddWidgetDialog({ isOpen, onClose, addWidgetFn, defaultAgentName = "adk
|
|
|
48052
48047
|
agentName: defaultAgentName,
|
|
48053
48048
|
agentType: "Data Grid Agent"
|
|
48054
48049
|
};
|
|
48055
|
-
} else if (selectedWidgetType === "summary") {
|
|
48056
|
-
config = {
|
|
48057
|
-
query,
|
|
48058
|
-
agentName: defaultAgentName,
|
|
48059
|
-
agentType: "Summary Agent"
|
|
48060
|
-
};
|
|
48061
48050
|
} else if (selectedWidgetType === "chatbot") {
|
|
48062
48051
|
config = {
|
|
48063
48052
|
agentName: defaultAgentName
|
|
@@ -48142,7 +48131,7 @@ function AddWidgetDialog({ isOpen, onClose, addWidgetFn, defaultAgentName = "adk
|
|
|
48142
48131
|
)
|
|
48143
48132
|
] }),
|
|
48144
48133
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-sm text-gray-700", children: selectedWidgetType === "chatbot" ? "Chatbot widget will be configured with the default agent." : selectedWidgetType === "text" ? "Customize the widget's appearance" : selectedWidgetType === "filters" ? "Configure the filters widget:" : "Enter a query for your chart widget:" }) }),
|
|
48145
|
-
(selectedWidgetType === "bar-chart" || selectedWidgetType === "series-bar-chart" || selectedWidgetType === "series-line-chart" || selectedWidgetType === "line-chart" || selectedWidgetType === "pie-chart" || selectedWidgetType === "data-grid"
|
|
48134
|
+
(selectedWidgetType === "bar-chart" || selectedWidgetType === "series-bar-chart" || selectedWidgetType === "series-line-chart" || selectedWidgetType === "line-chart" || selectedWidgetType === "pie-chart" || selectedWidgetType === "data-grid") && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-6", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
48146
48135
|
Textarea,
|
|
48147
48136
|
{
|
|
48148
48137
|
value: query,
|
|
@@ -48241,7 +48230,7 @@ function AddWidgetDialog({ isOpen, onClose, addWidgetFn, defaultAgentName = "adk
|
|
|
48241
48230
|
Button,
|
|
48242
48231
|
{
|
|
48243
48232
|
onClick: handleConfigSubmit,
|
|
48244
|
-
disabled: (selectedWidgetType === "bar-chart" || selectedWidgetType === "series-bar-chart" || selectedWidgetType === "series-line-chart" || selectedWidgetType === "line-chart" || selectedWidgetType === "pie-chart" || selectedWidgetType === "data-grid"
|
|
48233
|
+
disabled: (selectedWidgetType === "bar-chart" || selectedWidgetType === "series-bar-chart" || selectedWidgetType === "series-line-chart" || selectedWidgetType === "line-chart" || selectedWidgetType === "pie-chart" || selectedWidgetType === "data-grid") && !query.trim(),
|
|
48245
48234
|
children: "Add Widget"
|
|
48246
48235
|
}
|
|
48247
48236
|
)
|