dp-widgets-framework 1.7.3 → 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 +46 -44
- package/dist/index.js +46 -44
- 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
|
}
|
|
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
|
}
|
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
|
}
|