dp-widgets-framework 1.7.2 → 1.7.4
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 +50 -48
- package/dist/index.js +50 -48
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -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
|
}
|
|
45436
|
+
} else {
|
|
45429
45437
|
onApplyFilters == null ? void 0 : onApplyFilters(filtersWithLabels);
|
|
45430
|
-
} catch (error) {
|
|
45431
|
-
console.error("Error updating widget config:", error);
|
|
45432
|
-
} finally {
|
|
45433
|
-
setIsSubmitting(false);
|
|
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
|
}
|
|
@@ -45545,13 +45547,13 @@ function CopilotKitFilters({
|
|
|
45545
45547
|
}, [reset, widget.id, onResetReady]);
|
|
45546
45548
|
useEffect(() => {
|
|
45547
45549
|
const handleTriggerAgent = (event) => {
|
|
45548
|
-
const { widgetId, query
|
|
45550
|
+
const { widgetId, query } = event.detail;
|
|
45549
45551
|
reset();
|
|
45550
45552
|
if (widgetId === widget.id) {
|
|
45551
45553
|
let messageContent = `${query}`;
|
|
45552
|
-
console.log("triggering to datasetId==>",
|
|
45553
|
-
setFilterState(createInitialFilterState(
|
|
45554
|
-
setAgentState(createInitialFilterState(
|
|
45554
|
+
console.log("triggering to datasetId==>", datasetId);
|
|
45555
|
+
setFilterState(createInitialFilterState(datasetId));
|
|
45556
|
+
setAgentState(createInitialFilterState(datasetId));
|
|
45555
45557
|
setApiCallCount(0);
|
|
45556
45558
|
setHasTimeoutError(false);
|
|
45557
45559
|
appendMessage(
|
|
@@ -45578,7 +45580,7 @@ function CopilotKitFilters({
|
|
|
45578
45580
|
window.removeEventListener("triggerAgent", handleTriggerAgent);
|
|
45579
45581
|
window.removeEventListener("clearFilterState", handleClearFilterState);
|
|
45580
45582
|
};
|
|
45581
|
-
}, [widget.id, appendMessage, setFilterState, startLoadingTimeout]);
|
|
45583
|
+
}, [widget.id, appendMessage, setFilterState, startLoadingTimeout, datasetId]);
|
|
45582
45584
|
const handleConfirmation = useCallback(async (tableMapping) => {
|
|
45583
45585
|
var _a2, _b2, _c2;
|
|
45584
45586
|
console.log("[FiltersWidget] handleConfirmation called with:", {
|
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
|
}
|
|
45464
|
+
} else {
|
|
45457
45465
|
onApplyFilters == null ? void 0 : onApplyFilters(filtersWithLabels);
|
|
45458
|
-
} catch (error) {
|
|
45459
|
-
console.error("Error updating widget config:", error);
|
|
45460
|
-
} finally {
|
|
45461
|
-
setIsSubmitting(false);
|
|
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
|
}
|
|
@@ -45573,13 +45575,13 @@ function CopilotKitFilters({
|
|
|
45573
45575
|
}, [reset, widget.id, onResetReady]);
|
|
45574
45576
|
React.useEffect(() => {
|
|
45575
45577
|
const handleTriggerAgent = (event) => {
|
|
45576
|
-
const { widgetId, query
|
|
45578
|
+
const { widgetId, query } = event.detail;
|
|
45577
45579
|
reset();
|
|
45578
45580
|
if (widgetId === widget.id) {
|
|
45579
45581
|
let messageContent = `${query}`;
|
|
45580
|
-
console.log("triggering to datasetId==>",
|
|
45581
|
-
setFilterState(createInitialFilterState(
|
|
45582
|
-
setAgentState(createInitialFilterState(
|
|
45582
|
+
console.log("triggering to datasetId==>", datasetId);
|
|
45583
|
+
setFilterState(createInitialFilterState(datasetId));
|
|
45584
|
+
setAgentState(createInitialFilterState(datasetId));
|
|
45583
45585
|
setApiCallCount(0);
|
|
45584
45586
|
setHasTimeoutError(false);
|
|
45585
45587
|
appendMessage(
|
|
@@ -45606,7 +45608,7 @@ function CopilotKitFilters({
|
|
|
45606
45608
|
window.removeEventListener("triggerAgent", handleTriggerAgent);
|
|
45607
45609
|
window.removeEventListener("clearFilterState", handleClearFilterState);
|
|
45608
45610
|
};
|
|
45609
|
-
}, [widget.id, appendMessage, setFilterState, startLoadingTimeout]);
|
|
45611
|
+
}, [widget.id, appendMessage, setFilterState, startLoadingTimeout, datasetId]);
|
|
45610
45612
|
const handleConfirmation = React.useCallback(async (tableMapping) => {
|
|
45611
45613
|
var _a2, _b2, _c2;
|
|
45612
45614
|
console.log("[FiltersWidget] handleConfirmation called with:", {
|