@addsign/moje-agenda-shared-lib 2.0.67 → 2.0.68
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/assets/style.css +3 -0
- package/dist/components/datatable/DataTableServer.js +105 -17
- package/dist/components/datatable/DataTableServer.js.map +1 -1
- package/dist/components/ui/multi-select.js.map +1 -1
- package/lib/components/datatable/DataTableServer.tsx +152 -20
- package/lib/components/ui/multi-select.tsx +387 -387
- package/package.json +1 -1
package/dist/assets/style.css
CHANGED
|
@@ -21923,12 +21923,34 @@ function DataTableServer({
|
|
|
21923
21923
|
const response = await federationContext.apiClient.get(
|
|
21924
21924
|
column.filterSource
|
|
21925
21925
|
);
|
|
21926
|
-
const options =
|
|
21926
|
+
const options = [];
|
|
21927
|
+
response.data.forEach((item) => {
|
|
21927
21928
|
var _a2, _b2;
|
|
21928
|
-
|
|
21929
|
-
|
|
21930
|
-
|
|
21931
|
-
|
|
21929
|
+
const categoryId = (_a2 = item[column.filterValueKey]) == null ? void 0 : _a2.toString();
|
|
21930
|
+
const categoryLabel = (_b2 = item[column.filterLabelKey]) == null ? void 0 : _b2.toString();
|
|
21931
|
+
const subcategories = item.subcategories;
|
|
21932
|
+
if (Array.isArray(subcategories) && subcategories.length > 0 && column.filterParam2) {
|
|
21933
|
+
options.push({
|
|
21934
|
+
value: categoryId,
|
|
21935
|
+
label: categoryLabel
|
|
21936
|
+
});
|
|
21937
|
+
subcategories.forEach((subcategory) => {
|
|
21938
|
+
var _a3, _b3;
|
|
21939
|
+
const subcategoryId = (_a3 = subcategory.id) == null ? void 0 : _a3.toString();
|
|
21940
|
+
const subcategoryLabel = (_b3 = subcategory.name) == null ? void 0 : _b3.toString();
|
|
21941
|
+
if (subcategoryId && subcategoryLabel) {
|
|
21942
|
+
options.push({
|
|
21943
|
+
value: `${categoryId}-${subcategoryId}`,
|
|
21944
|
+
label: `${categoryLabel} - ${subcategoryLabel}`
|
|
21945
|
+
});
|
|
21946
|
+
}
|
|
21947
|
+
});
|
|
21948
|
+
} else {
|
|
21949
|
+
options.push({
|
|
21950
|
+
value: categoryId,
|
|
21951
|
+
label: categoryLabel
|
|
21952
|
+
});
|
|
21953
|
+
}
|
|
21932
21954
|
});
|
|
21933
21955
|
return options;
|
|
21934
21956
|
} catch (error) {
|
|
@@ -22026,8 +22048,55 @@ function DataTableServer({
|
|
|
22026
22048
|
setCurrentPage(0);
|
|
22027
22049
|
};
|
|
22028
22050
|
const paginationDisplay = `Strana ${(currentPage || 0) + 1} z ${(data == null ? void 0 : data.totalPages) || 1}`;
|
|
22029
|
-
const filterHandler = (filterParam, value) => {
|
|
22030
|
-
setColumnFilters((prev) =>
|
|
22051
|
+
const filterHandler = (filterParam, value, filterParam2, clearFilterParam2) => {
|
|
22052
|
+
setColumnFilters((prev) => {
|
|
22053
|
+
const newFilters = { ...prev };
|
|
22054
|
+
if (value === "" || value === "__clear__" || Array.isArray(value) && value.length === 0) {
|
|
22055
|
+
delete newFilters[String(filterParam)];
|
|
22056
|
+
if (filterParam2) {
|
|
22057
|
+
delete newFilters[filterParam2];
|
|
22058
|
+
}
|
|
22059
|
+
return newFilters;
|
|
22060
|
+
}
|
|
22061
|
+
if (filterParam2) {
|
|
22062
|
+
if (clearFilterParam2) {
|
|
22063
|
+
newFilters[String(filterParam)] = value;
|
|
22064
|
+
delete newFilters[filterParam2];
|
|
22065
|
+
return newFilters;
|
|
22066
|
+
}
|
|
22067
|
+
if (typeof value === "string" && value.includes("-")) {
|
|
22068
|
+
const parts = value.split("-");
|
|
22069
|
+
if (parts.length === 2) {
|
|
22070
|
+
newFilters[String(filterParam)] = parts[0];
|
|
22071
|
+
newFilters[filterParam2] = parts[1];
|
|
22072
|
+
return newFilters;
|
|
22073
|
+
}
|
|
22074
|
+
}
|
|
22075
|
+
if (Array.isArray(value)) {
|
|
22076
|
+
const subcategoryIds = [];
|
|
22077
|
+
value.forEach((val) => {
|
|
22078
|
+
if (val.includes("-")) {
|
|
22079
|
+
const parts = val.split("-");
|
|
22080
|
+
if (parts.length === 2) {
|
|
22081
|
+
subcategoryIds.push(parts[1]);
|
|
22082
|
+
}
|
|
22083
|
+
}
|
|
22084
|
+
});
|
|
22085
|
+
newFilters[String(filterParam)] = value.length > 0 ? value : void 0;
|
|
22086
|
+
if (subcategoryIds.length > 0) {
|
|
22087
|
+
newFilters[filterParam2] = subcategoryIds;
|
|
22088
|
+
} else {
|
|
22089
|
+
delete newFilters[filterParam2];
|
|
22090
|
+
}
|
|
22091
|
+
return newFilters;
|
|
22092
|
+
}
|
|
22093
|
+
newFilters[String(filterParam)] = value;
|
|
22094
|
+
delete newFilters[filterParam2];
|
|
22095
|
+
return newFilters;
|
|
22096
|
+
}
|
|
22097
|
+
newFilters[String(filterParam)] = value;
|
|
22098
|
+
return newFilters;
|
|
22099
|
+
});
|
|
22031
22100
|
setCurrentPage(0);
|
|
22032
22101
|
};
|
|
22033
22102
|
const handleToggleShowColFilters = () => {
|
|
@@ -22267,7 +22336,7 @@ function DataTableServer({
|
|
|
22267
22336
|
className: "overflow-auto min-h-[500px] relative",
|
|
22268
22337
|
children: [
|
|
22269
22338
|
isLoading && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center h-[500px] py-2 z-10", children: /* @__PURE__ */ jsx(Spinner, {}) }),
|
|
22270
|
-
!isLoading && (!data || ((_a = data == null ? void 0 : data.content) == null ? void 0 : _a.length) === 0) && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center
|
|
22339
|
+
!isLoading && (!data || ((_a = data == null ? void 0 : data.content) == null ? void 0 : _a.length) === 0) && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center py-2 text-gray-600 font-medium text-xs top-[90px]", children: "Žádná data" }),
|
|
22271
22340
|
/* @__PURE__ */ jsxs(
|
|
22272
22341
|
"table",
|
|
22273
22342
|
{
|
|
@@ -22337,15 +22406,29 @@ function DataTableServer({
|
|
|
22337
22406
|
{
|
|
22338
22407
|
onValueChange: (value) => {
|
|
22339
22408
|
if (value === "__clear__") {
|
|
22340
|
-
filterHandler(filterParam, "");
|
|
22341
|
-
} else {
|
|
22342
22409
|
filterHandler(
|
|
22343
22410
|
filterParam,
|
|
22344
|
-
|
|
22411
|
+
"",
|
|
22412
|
+
filterParam2
|
|
22345
22413
|
);
|
|
22414
|
+
} else {
|
|
22415
|
+
if (value.includes("-") && filterParam2) {
|
|
22416
|
+
filterHandler(
|
|
22417
|
+
filterParam,
|
|
22418
|
+
value,
|
|
22419
|
+
filterParam2
|
|
22420
|
+
);
|
|
22421
|
+
} else {
|
|
22422
|
+
filterHandler(
|
|
22423
|
+
filterParam,
|
|
22424
|
+
value,
|
|
22425
|
+
filterParam2,
|
|
22426
|
+
true
|
|
22427
|
+
);
|
|
22428
|
+
}
|
|
22346
22429
|
}
|
|
22347
22430
|
},
|
|
22348
|
-
value: ((_a2 = mergedFilters == null ? void 0 : mergedFilters[String(filterParam)]) == null ? void 0 : _a2.toString()) || "__clear__",
|
|
22431
|
+
value: filterParam2 && (mergedFilters == null ? void 0 : mergedFilters[String(filterParam)]) && (mergedFilters == null ? void 0 : mergedFilters[String(filterParam2)]) ? `${mergedFilters[String(filterParam)]}-${mergedFilters[String(filterParam2)]}` : ((_a2 = mergedFilters == null ? void 0 : mergedFilters[String(filterParam)]) == null ? void 0 : _a2.toString()) || "__clear__",
|
|
22349
22432
|
disabled: Object.keys(
|
|
22350
22433
|
filters || {}
|
|
22351
22434
|
).includes(String(filterParam)),
|
|
@@ -22370,11 +22453,16 @@ function DataTableServer({
|
|
|
22370
22453
|
MultiSelect,
|
|
22371
22454
|
{
|
|
22372
22455
|
options: filterOptions[String(filterParam)] || [],
|
|
22373
|
-
onChange: (values) =>
|
|
22374
|
-
|
|
22375
|
-
|
|
22376
|
-
|
|
22377
|
-
|
|
22456
|
+
onChange: (values) => {
|
|
22457
|
+
filterHandler(
|
|
22458
|
+
filterParam,
|
|
22459
|
+
values,
|
|
22460
|
+
filterParam2
|
|
22461
|
+
);
|
|
22462
|
+
},
|
|
22463
|
+
value: Array.isArray(
|
|
22464
|
+
mergedFilters == null ? void 0 : mergedFilters[String(filterParam)]
|
|
22465
|
+
) ? mergedFilters[String(filterParam)] : (mergedFilters == null ? void 0 : mergedFilters[String(filterParam)]) ? [mergedFilters[String(filterParam)]] : [],
|
|
22378
22466
|
placeholder: "Zadejte filtr",
|
|
22379
22467
|
className: "px-0",
|
|
22380
22468
|
disabled: Object.keys(
|