@addsign/moje-agenda-shared-lib 2.0.66 → 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.
Files changed (58) hide show
  1. package/dist/Calendar-DWT4e7Th.js.map +1 -1
  2. package/dist/Combination-DmhTQmbL.js +996 -0
  3. package/dist/Combination-DmhTQmbL.js.map +1 -0
  4. package/dist/Dialog-3u5-ws89.js +424 -0
  5. package/dist/Dialog-3u5-ws89.js.map +1 -0
  6. package/dist/Dialog-CCrUyF91.js.map +1 -1
  7. package/dist/assets/style.css +3 -3
  8. package/dist/components/datatable/DataTableServer.js +349 -252
  9. package/dist/components/datatable/DataTableServer.js.map +1 -1
  10. package/dist/components/form/FileInputForm.d.ts +14 -0
  11. package/dist/components/form/FileInputForm.js +173 -0
  12. package/dist/components/form/FileInputForm.js.map +1 -0
  13. package/dist/components/form/FileInputFormMultiple.d.ts +16 -0
  14. package/dist/components/form/FileInputFormMultiple.js +240 -0
  15. package/dist/components/form/FileInputFormMultiple.js.map +1 -0
  16. package/dist/components/form/FileInputFull.d.ts +17 -0
  17. package/dist/components/form/FileInputFull.js +188 -0
  18. package/dist/components/form/FileInputFull.js.map +1 -0
  19. package/dist/components/form/FileInputFullMultiple.d.ts +19 -0
  20. package/dist/components/form/FileInputFullMultiple.js +226 -0
  21. package/dist/components/form/FileInputFullMultiple.js.map +1 -0
  22. package/dist/components/ui/Combobox.js.map +1 -1
  23. package/dist/components/ui/checkbox.js.map +1 -1
  24. package/dist/components/ui/command.js.map +1 -1
  25. package/dist/components/ui/multi-select.js.map +1 -1
  26. package/dist/components/ui/radioGroup.js.map +1 -1
  27. package/dist/components/ui/toast.js.map +1 -1
  28. package/dist/handleErrors-B2be_Hgy.js +31615 -0
  29. package/dist/handleErrors-B2be_Hgy.js.map +1 -0
  30. package/dist/handleErrors-P52guX3U.js +32 -0
  31. package/dist/handleErrors-P52guX3U.js.map +1 -0
  32. package/dist/index-BikTN7j8.js +2266 -0
  33. package/dist/index-BikTN7j8.js.map +1 -0
  34. package/dist/main.d.ts +2 -0
  35. package/dist/main.js +34 -30
  36. package/dist/main.js.map +1 -1
  37. package/dist/popover-BLI2Jq-c.js +319 -0
  38. package/dist/popover-BLI2Jq-c.js.map +1 -0
  39. package/dist/popover-CcrzvSk7.js.map +1 -1
  40. package/dist/tslib.es6-e8r3nMQ9.js +172 -0
  41. package/dist/tslib.es6-e8r3nMQ9.js.map +1 -0
  42. package/dist/types.d.ts +1 -0
  43. package/dist/types.js.map +1 -1
  44. package/lib/components/datatable/DataTableServer.tsx +165 -42
  45. package/lib/components/form/FileInputForm.tsx +184 -0
  46. package/lib/components/form/FileInputFormMultiple.tsx +220 -0
  47. package/lib/components/ui/Calendar.tsx +0 -2
  48. package/lib/components/ui/Combobox.tsx +0 -2
  49. package/lib/components/ui/Dialog.tsx +0 -2
  50. package/lib/components/ui/checkbox.tsx +0 -2
  51. package/lib/components/ui/command.tsx +0 -2
  52. package/lib/components/ui/multi-select.tsx +387 -387
  53. package/lib/components/ui/popover.tsx +0 -2
  54. package/lib/components/ui/radioGroup.tsx +0 -2
  55. package/lib/components/ui/toast.tsx +0 -1
  56. package/lib/main.ts +2 -0
  57. package/lib/types.ts +1 -0
  58. package/package.json +1 -2
@@ -21923,12 +21923,34 @@ function DataTableServer({
21923
21923
  const response = await federationContext.apiClient.get(
21924
21924
  column.filterSource
21925
21925
  );
21926
- const options = response.data.map((item) => {
21926
+ const options = [];
21927
+ response.data.forEach((item) => {
21927
21928
  var _a2, _b2;
21928
- return {
21929
- value: (_a2 = item[column.filterValueKey]) == null ? void 0 : _a2.toString(),
21930
- label: (_b2 = item[column.filterLabelKey]) == null ? void 0 : _b2.toString()
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) => ({ ...prev, [filterParam]: value }));
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 = () => {
@@ -22260,270 +22329,298 @@ function DataTableServer({
22260
22329
  ) })
22261
22330
  ] }),
22262
22331
  setMinWidth && /* @__PURE__ */ jsx("div", { ref: topScrollbarRef, className: "overflow-x-auto h-4 mb-1 mmmmm", children: /* @__PURE__ */ jsx("div", { ref: syncWidthRef, className: "h-full" }) }),
22263
- /* @__PURE__ */ jsx("div", { ref: bottomScrollbarRef, className: "overflow-auto min-h-[500px]", children: /* @__PURE__ */ jsxs(
22264
- "table",
22332
+ /* @__PURE__ */ jsxs(
22333
+ "div",
22265
22334
  {
22266
- ref: tableRef,
22267
- className: "w-full leading-normal",
22268
- "data-cy": "datatable-table-" + id,
22335
+ ref: bottomScrollbarRef,
22336
+ className: "overflow-auto min-h-[500px] relative",
22269
22337
  children: [
22270
- /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
22271
- data && bulkAction && /* @__PURE__ */ jsx("th", { className: "w-[20px] h-10 hover:bg-gray-200 bg-gray-50 font-medium text-xs text-center text-gray-600 cursor-pointer border-t border-b border-gray-200", children: /* @__PURE__ */ jsx("label", { className: "w-full h-full flex items-center justify-center cursor-pointer px-2", children: /* @__PURE__ */ jsx(
22272
- "input",
22273
- {
22274
- id: "selectAll",
22275
- type: "checkbox",
22276
- className: "w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded !focus:ring-indigo-200 focus:ring-4",
22277
- onChange: handleSelectAll,
22278
- checked: data && selectedItems.length === data.content.length && data.content.length > 0
22279
- }
22280
- ) }) }),
22281
- columns.map(
22282
- ({
22283
- key,
22284
- header,
22285
- actions,
22286
- sortParam,
22287
- width,
22288
- filterType,
22289
- filterParam,
22290
- filterParam2
22291
- }, index) => /* @__PURE__ */ jsx(
22292
- Resizable,
22293
- {
22294
- tableId: id,
22295
- colKey: String(key),
22296
- defaultWidth: width || "auto",
22297
- setMinWidth,
22298
- children: ({ ref }) => {
22299
- var _a2, _b2, _c;
22300
- return /* @__PURE__ */ jsxs(
22301
- "th",
22302
- {
22303
- className: `tableHeader relative font-medium text-xs !leading-9 text-left px-3 text-gray-600
22304
- bg-gray-50 border-t border-b border-gray-200 content-start ${!title && !subtitle ? "border-t-0" : ""} ${sortParam ? " cursor-pointer " : ""}`,
22305
- onClick: () => sortParam ? requestSort(sortParam) : void 0,
22306
- "data-cy": "datatable-header-" + id + "-" + String(key),
22307
- children: [
22308
- /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-2 group select-none w-full", children: [
22309
- header,
22310
- " ",
22311
- !actions && sortParam ? getSortIcon(sortParam) : ""
22312
- ] }),
22313
- /* @__PURE__ */ jsx(
22314
- "div",
22315
- {
22316
- className: `resizer absolute top-0 right-0 h-full w-2 bg-transparent ${index < columns.length - 1 ? "cursor-col-resize hover:border-x border-gray-300 border-r w-1" : "w-0"}`,
22317
- ref,
22318
- onClick: (e) => e.stopPropagation()
22319
- }
22320
- ),
22321
- showColFilters && /* @__PURE__ */ jsx(
22322
- "div",
22323
- {
22324
- className: "p-0 m-0 pb-2",
22325
- onClick: (e) => e.stopPropagation(),
22326
- "data-cy": "datatable-filter-container-" + id + "-" + String(key),
22327
- children: filterType === "select" ? /* @__PURE__ */ jsxs(
22328
- Select,
22329
- {
22330
- onValueChange: (value) => {
22331
- if (value === "__clear__") {
22332
- filterHandler(filterParam, "");
22333
- } else {
22334
- filterHandler(
22335
- filterParam,
22336
- value
22337
- );
22338
- }
22339
- },
22340
- value: ((_a2 = mergedFilters == null ? void 0 : mergedFilters[String(filterParam)]) == null ? void 0 : _a2.toString()) || "__clear__",
22341
- disabled: Object.keys(
22342
- filters || {}
22343
- ).includes(String(filterParam)),
22344
- children: [
22345
- /* @__PURE__ */ jsx(SelectTrigger, { className: "flex-1 w-full px-2 font-normal placeholder-muted-foreground", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Zadejte filtr" }) }),
22346
- /* @__PURE__ */ jsx(SelectContent, { children: (_c = (_b2 = filterOptions[String(filterParam)]) == null ? void 0 : _b2.filter(
22347
- (option) => option.value !== null && option.value !== void 0 && option.value !== ""
22348
- )) == null ? void 0 : _c.map((option) => {
22349
- var _a3;
22350
- return /* @__PURE__ */ jsx(
22351
- SelectItem,
22352
- {
22353
- value: ((_a3 = option.value) == null ? void 0 : _a3.toString()) || "unknown",
22354
- children: option.label
22355
- },
22356
- option.value
22357
- );
22358
- }) })
22359
- ]
22360
- }
22361
- ) : filterType === "multi-select" ? /* @__PURE__ */ jsx(
22362
- MultiSelect,
22363
- {
22364
- options: filterOptions[String(filterParam)] || [],
22365
- onChange: (values) => filterHandler(
22366
- filterParam,
22367
- values
22368
- ),
22369
- value: (mergedFilters == null ? void 0 : mergedFilters[String(filterParam)]) || [],
22370
- placeholder: "Zadejte filtr",
22371
- className: "px-0",
22372
- disabled: Object.keys(
22373
- filters || {}
22374
- ).includes(String(filterParam)),
22375
- variant: "secondary",
22376
- maxCount: 0
22377
- }
22378
- ) : filterType === "dateRange" ? /* @__PURE__ */ jsx(
22379
- DateRangeField,
22380
- {
22381
- name: String(filterParam),
22382
- nameEnd: String(filterParam2),
22383
- onInputChange: (e) => filterHandler(
22384
- e.target.name,
22385
- e.target.value
22386
- ),
22387
- type: filterType,
22388
- value: {
22389
- startDate: (mergedFilters == null ? void 0 : mergedFilters[String(filterParam)]) || "",
22390
- endDate: (mergedFilters == null ? void 0 : mergedFilters[String(filterParam2)]) || ""
22391
- },
22392
- clearable: true,
22393
- className: " px-0 py-0 ",
22394
- placeholder: "Zadejte filtr",
22395
- rounded: true,
22396
- disabled: Object.keys(
22397
- filters || {}
22398
- ).includes(String(filterParam))
22399
- }
22400
- ) : filterType === "date" ? /* @__PURE__ */ jsx(
22401
- DateField,
22402
- {
22403
- name: String(filterParam),
22404
- onInputChange: (e) => filterHandler(
22405
- e.target.name,
22406
- e.target.value
22407
- ),
22408
- type: filterType,
22409
- value: (mergedFilters == null ? void 0 : mergedFilters[String(filterParam)]) || "",
22410
- clearable: true,
22411
- className: " px-0 py-0 ",
22412
- placeholder: "Zadejte filtr",
22413
- rounded: true,
22414
- disabled: Object.keys(
22415
- filters || {}
22416
- ).includes(String(filterParam))
22417
- }
22418
- ) : filterType === "text" ? /* @__PURE__ */ jsx(
22419
- Input,
22420
- {
22421
- onChange: (e) => filterHandler(
22422
- filterParam,
22423
- e.target.value
22424
- ),
22425
- value: (mergedFilters == null ? void 0 : mergedFilters[String(filterParam)]) || "",
22426
- disabled: Object.keys(
22427
- filters || {}
22428
- ).includes(String(filterParam)),
22429
- clearable: true,
22430
- className: "min-w-[100px] px-2 font-normal placeholder-muted-foreground\r\n",
22431
- placeholder: "Zadejte filtr",
22432
- debounceTimeout: 1e3
22433
- }
22434
- ) : null
22435
- }
22436
- )
22437
- ]
22438
- }
22439
- );
22440
- }
22441
- },
22442
- String(key)
22443
- )
22444
- )
22445
- ] }) }),
22446
- !isLoading && data && (data == null ? void 0 : data.content) && (data == null ? void 0 : data.content.length) > 0 && /* @__PURE__ */ jsxs("tbody", { className: "relative", children: [
22447
- data.content.map((item, rowIndex) => /* @__PURE__ */ jsxs(
22448
- "tr",
22449
- {
22450
- className: `${item._isHighlighted || isSelected(item) ? "bg-gray-50" : ""} hover:bg-gray-100 border-gray-200 border-b text-sm`,
22451
- children: [
22452
- bulkAction && /* @__PURE__ */ jsx("td", { className: "w-[20px] h-[52px] hover:bg-gray-200 font-medium text-xs text-center text-gray-600 cursor-pointer", children: /* @__PURE__ */ jsx("label", { className: "w-full h-full flex items-center justify-center cursor-pointer px-2", children: /* @__PURE__ */ jsx(
22338
+ isLoading && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center h-[500px] py-2 z-10", children: /* @__PURE__ */ jsx(Spinner, {}) }),
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" }),
22340
+ /* @__PURE__ */ jsxs(
22341
+ "table",
22342
+ {
22343
+ ref: tableRef,
22344
+ className: "w-full leading-normal",
22345
+ "data-cy": "datatable-table-" + id,
22346
+ children: [
22347
+ /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
22348
+ data && bulkAction && /* @__PURE__ */ jsx("th", { className: "w-[20px] h-10 hover:bg-gray-200 bg-gray-50 font-medium text-xs text-center text-gray-600 cursor-pointer border-t border-b border-gray-200", children: /* @__PURE__ */ jsx("label", { className: "w-full h-full flex items-center justify-center cursor-pointer px-2", children: /* @__PURE__ */ jsx(
22453
22349
  "input",
22454
22350
  {
22351
+ id: "selectAll",
22455
22352
  type: "checkbox",
22456
22353
  className: "w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded !focus:ring-indigo-200 focus:ring-4",
22457
- checked: isSelected(item) || false,
22458
- onChange: () => handleSelectItem(item)
22354
+ onChange: handleSelectAll,
22355
+ checked: data && selectedItems.length === data.content.length && data.content.length > 0
22459
22356
  }
22460
22357
  ) }) }),
22461
- columns.map(({ render, actions, classes }, colIndex) => /* @__PURE__ */ jsxs(
22462
- "td",
22358
+ columns.map(
22359
+ ({
22360
+ key,
22361
+ header,
22362
+ actions,
22363
+ sortParam,
22364
+ width,
22365
+ filterType,
22366
+ filterParam,
22367
+ filterParam2
22368
+ }, index) => /* @__PURE__ */ jsx(
22369
+ Resizable,
22370
+ {
22371
+ tableId: id,
22372
+ colKey: String(key),
22373
+ defaultWidth: width || "auto",
22374
+ setMinWidth,
22375
+ children: ({ ref }) => {
22376
+ var _a2, _b2, _c;
22377
+ return /* @__PURE__ */ jsxs(
22378
+ "th",
22379
+ {
22380
+ className: `tableHeader relative font-medium text-xs !leading-9 text-left px-3 text-gray-600
22381
+ bg-gray-50 border-t border-b border-gray-200 content-start ${!title && !subtitle ? "border-t-0" : ""} ${sortParam ? " cursor-pointer " : ""}`,
22382
+ onClick: () => sortParam ? requestSort(sortParam) : void 0,
22383
+ "data-cy": "datatable-header-" + id + "-" + String(key),
22384
+ children: [
22385
+ /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-2 group select-none w-full", children: [
22386
+ header,
22387
+ " ",
22388
+ !actions && sortParam ? getSortIcon(sortParam) : ""
22389
+ ] }),
22390
+ /* @__PURE__ */ jsx(
22391
+ "div",
22392
+ {
22393
+ className: `resizer absolute top-0 right-0 h-full w-2 bg-transparent ${index < columns.length - 1 ? "cursor-col-resize hover:border-x border-gray-300 border-r w-1" : "w-0"}`,
22394
+ ref,
22395
+ onClick: (e) => e.stopPropagation()
22396
+ }
22397
+ ),
22398
+ showColFilters && /* @__PURE__ */ jsx(
22399
+ "div",
22400
+ {
22401
+ className: "p-0 m-0 pb-2",
22402
+ onClick: (e) => e.stopPropagation(),
22403
+ "data-cy": "datatable-filter-container-" + id + "-" + String(key),
22404
+ children: filterType === "select" ? /* @__PURE__ */ jsxs(
22405
+ Select,
22406
+ {
22407
+ onValueChange: (value) => {
22408
+ if (value === "__clear__") {
22409
+ filterHandler(
22410
+ filterParam,
22411
+ "",
22412
+ filterParam2
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
+ }
22429
+ }
22430
+ },
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__",
22432
+ disabled: Object.keys(
22433
+ filters || {}
22434
+ ).includes(String(filterParam)),
22435
+ children: [
22436
+ /* @__PURE__ */ jsx(SelectTrigger, { className: "flex-1 w-full px-2 font-normal placeholder-muted-foreground", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Zadejte filtr" }) }),
22437
+ /* @__PURE__ */ jsx(SelectContent, { children: (_c = (_b2 = filterOptions[String(filterParam)]) == null ? void 0 : _b2.filter(
22438
+ (option) => option.value !== null && option.value !== void 0 && option.value !== ""
22439
+ )) == null ? void 0 : _c.map((option) => {
22440
+ var _a3;
22441
+ return /* @__PURE__ */ jsx(
22442
+ SelectItem,
22443
+ {
22444
+ value: ((_a3 = option.value) == null ? void 0 : _a3.toString()) || "unknown",
22445
+ children: option.label
22446
+ },
22447
+ option.value
22448
+ );
22449
+ }) })
22450
+ ]
22451
+ }
22452
+ ) : filterType === "multi-select" ? /* @__PURE__ */ jsx(
22453
+ MultiSelect,
22454
+ {
22455
+ options: filterOptions[String(filterParam)] || [],
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)]] : [],
22466
+ placeholder: "Zadejte filtr",
22467
+ className: "px-0",
22468
+ disabled: Object.keys(
22469
+ filters || {}
22470
+ ).includes(String(filterParam)),
22471
+ variant: "secondary",
22472
+ maxCount: 0
22473
+ }
22474
+ ) : filterType === "dateRange" ? /* @__PURE__ */ jsx(
22475
+ DateRangeField,
22476
+ {
22477
+ name: String(filterParam),
22478
+ nameEnd: String(filterParam2),
22479
+ onInputChange: (e) => filterHandler(
22480
+ e.target.name,
22481
+ e.target.value
22482
+ ),
22483
+ type: filterType,
22484
+ value: {
22485
+ startDate: (mergedFilters == null ? void 0 : mergedFilters[String(filterParam)]) || "",
22486
+ endDate: (mergedFilters == null ? void 0 : mergedFilters[String(filterParam2)]) || ""
22487
+ },
22488
+ clearable: true,
22489
+ className: " px-0 py-0 ",
22490
+ placeholder: "Zadejte filtr",
22491
+ rounded: true,
22492
+ disabled: Object.keys(
22493
+ filters || {}
22494
+ ).includes(String(filterParam))
22495
+ }
22496
+ ) : filterType === "date" ? /* @__PURE__ */ jsx(
22497
+ DateField,
22498
+ {
22499
+ name: String(filterParam),
22500
+ onInputChange: (e) => filterHandler(
22501
+ e.target.name,
22502
+ e.target.value
22503
+ ),
22504
+ type: filterType,
22505
+ value: (mergedFilters == null ? void 0 : mergedFilters[String(filterParam)]) || "",
22506
+ clearable: true,
22507
+ className: " px-0 py-0 ",
22508
+ placeholder: "Zadejte filtr",
22509
+ rounded: true,
22510
+ disabled: Object.keys(
22511
+ filters || {}
22512
+ ).includes(String(filterParam))
22513
+ }
22514
+ ) : filterType === "text" ? /* @__PURE__ */ jsx(
22515
+ Input,
22516
+ {
22517
+ onChange: (e) => filterHandler(
22518
+ filterParam,
22519
+ e.target.value
22520
+ ),
22521
+ value: (mergedFilters == null ? void 0 : mergedFilters[String(filterParam)]) || "",
22522
+ disabled: Object.keys(
22523
+ filters || {}
22524
+ ).includes(String(filterParam)),
22525
+ clearable: true,
22526
+ className: "min-w-[100px] px-2 font-normal placeholder-muted-foreground\r\n",
22527
+ placeholder: "Zadejte filtr",
22528
+ debounceTimeout: 1e3
22529
+ }
22530
+ ) : null
22531
+ }
22532
+ )
22533
+ ]
22534
+ }
22535
+ );
22536
+ }
22537
+ },
22538
+ String(key)
22539
+ )
22540
+ )
22541
+ ] }) }),
22542
+ !isLoading && data && (data == null ? void 0 : data.content) && (data == null ? void 0 : data.content.length) > 0 && /* @__PURE__ */ jsxs("tbody", { className: "relative", children: [
22543
+ data.content.map((item, rowIndex) => /* @__PURE__ */ jsxs(
22544
+ "tr",
22463
22545
  {
22464
- onClick: rowAction ? () => rowAction(item) : void 0,
22465
- className: `px-3 py-2 text-gray-800 ${rowAction ? "cursor-pointer" : ""} ${colIndex === 0 ? "font-bold " : ""} ${classes || ""}`,
22546
+ className: `${item._isHighlighted || isSelected(item) ? "bg-gray-50" : ""} hover:bg-gray-100 border-gray-200 border-b text-sm`,
22466
22547
  children: [
22467
- render ? render(item) : "",
22468
- actions && actions.filter((it) => {
22469
- if (it.rowAction)
22470
- return false;
22471
- if (it.visible) {
22472
- return it.visible(item);
22473
- } else
22474
- return true;
22475
- }).map((action, actionIndex) => /* @__PURE__ */ jsxs(
22476
- "div",
22548
+ bulkAction && /* @__PURE__ */ jsx("td", { className: "w-[20px] h-[52px] hover:bg-gray-200 font-medium text-xs text-center text-gray-600 cursor-pointer", children: /* @__PURE__ */ jsx("label", { className: "w-full h-full flex items-center justify-center cursor-pointer px-2", children: /* @__PURE__ */ jsx(
22549
+ "input",
22550
+ {
22551
+ type: "checkbox",
22552
+ className: "w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded !focus:ring-indigo-200 focus:ring-4",
22553
+ checked: isSelected(item) || false,
22554
+ onChange: () => handleSelectItem(item)
22555
+ }
22556
+ ) }) }),
22557
+ columns.map(({ render, actions, classes }, colIndex) => /* @__PURE__ */ jsxs(
22558
+ "td",
22477
22559
  {
22478
- className: "inline-flex align-middle",
22560
+ onClick: rowAction ? () => rowAction(item) : void 0,
22561
+ className: `px-3 py-2 text-gray-800 ${rowAction ? "cursor-pointer" : ""} ${colIndex === 0 ? "font-bold " : ""} ${classes || ""}`,
22479
22562
  children: [
22480
- action.icon && /* @__PURE__ */ jsx(
22481
- Button,
22563
+ render ? render(item) : "",
22564
+ actions && actions.filter((it) => {
22565
+ if (it.rowAction)
22566
+ return false;
22567
+ if (it.visible) {
22568
+ return it.visible(item);
22569
+ } else
22570
+ return true;
22571
+ }).map((action, actionIndex) => /* @__PURE__ */ jsxs(
22572
+ "div",
22482
22573
  {
22483
- variant: "icon",
22484
- onClick: () => action.onClick(item),
22485
- children: action.icon
22486
- }
22487
- ),
22488
- !action.icon && /* @__PURE__ */ jsx(
22489
- Button,
22490
- {
22491
- variant: "primary",
22492
- onClick: (e) => {
22493
- e.stopPropagation();
22494
- action.onClick(item);
22495
- },
22496
- children: action.label
22497
- }
22498
- )
22574
+ className: "inline-flex align-middle",
22575
+ children: [
22576
+ action.icon && /* @__PURE__ */ jsx(
22577
+ Button,
22578
+ {
22579
+ variant: "icon",
22580
+ onClick: () => action.onClick(item),
22581
+ children: action.icon
22582
+ }
22583
+ ),
22584
+ !action.icon && /* @__PURE__ */ jsx(
22585
+ Button,
22586
+ {
22587
+ variant: "primary",
22588
+ onClick: (e) => {
22589
+ e.stopPropagation();
22590
+ action.onClick(item);
22591
+ },
22592
+ children: action.label
22593
+ }
22594
+ )
22595
+ ]
22596
+ },
22597
+ `${rowIndex}-${colIndex}-${actionIndex}`
22598
+ ))
22499
22599
  ]
22500
22600
  },
22501
- `${rowIndex}-${colIndex}-${actionIndex}`
22601
+ `${rowIndex}-${colIndex}`
22502
22602
  ))
22503
22603
  ]
22504
22604
  },
22505
- `${rowIndex}-${colIndex}`
22506
- ))
22507
- ]
22508
- },
22509
- rowIndex
22510
- )),
22511
- ((_a = data == null ? void 0 : data.content) == null ? void 0 : _a.length) === 0 && /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx(
22512
- "td",
22513
- {
22514
- className: "px-5 py-3 border-b border-gray-200 bg-white text-sm items-center justify-center align-middle",
22515
- colSpan: columns.length,
22516
- children: "No data"
22517
- },
22518
- "td-nodata"
22519
- ) }, "tr-nodata")
22520
- ] }),
22521
- isLoading && /* @__PURE__ */ jsx("tbody", { className: "relative", children: /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: 100, children: /* @__PURE__ */ jsx("div", { className: "w-full flex items-center justify-center h-[500px] py-2", children: /* @__PURE__ */ jsx(Spinner, {}) }) }) }) }),
22522
- !isLoading && (!data || ((_b = data == null ? void 0 : data.content) == null ? void 0 : _b.length) === 0) && /* @__PURE__ */ jsx("tbody", { className: "relative h-[440px]", children: /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: 100, children: /* @__PURE__ */ jsx("div", { className: "w-full flex items-center justify-center h-full py-2 text-gray-600 font-medium text-xs ", children: "Žádná data" }) }) }) })
22605
+ rowIndex
22606
+ )),
22607
+ ((_b = data == null ? void 0 : data.content) == null ? void 0 : _b.length) === 0 && /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx(
22608
+ "td",
22609
+ {
22610
+ className: "px-5 py-3 border-b border-gray-200 bg-white text-sm items-center justify-center align-middle",
22611
+ colSpan: columns.length,
22612
+ children: "No data"
22613
+ },
22614
+ "td-nodata"
22615
+ ) }, "tr-nodata")
22616
+ ] })
22617
+ ]
22618
+ },
22619
+ tableKey
22620
+ )
22523
22621
  ]
22524
- },
22525
- tableKey
22526
- ) }),
22622
+ }
22623
+ ),
22527
22624
  (data == null ? void 0 : data.isPageable) && /* @__PURE__ */ jsxs(
22528
22625
  "div",
22529
22626
  {