@vanillabp/bc-ui 0.0.3 → 0.0.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.
Files changed (40) hide show
  1. package/README.md +1 -1
  2. package/dist/components/CustomWorkflowModuleComponent.d.ts +13 -0
  3. package/dist/components/CustomWorkflowModuleComponent.js +54 -0
  4. package/dist/components/FulltextSearchInput.d.ts +13 -0
  5. package/dist/components/FulltextSearchInput.js +159 -0
  6. package/dist/components/ListCell.d.ts +1 -2
  7. package/dist/components/ListCell.js +3 -5
  8. package/dist/components/ListColumnHeader.d.ts +7 -3
  9. package/dist/components/ListColumnHeader.js +27 -12
  10. package/dist/components/ListOfTasks.d.ts +7 -4
  11. package/dist/components/ListOfTasks.js +245 -157
  12. package/dist/components/ListOfWorkflows.d.ts +5 -2
  13. package/dist/components/ListOfWorkflows.js +150 -260
  14. package/dist/components/SearchableAndSortableUpdatingList.d.ts +3 -3
  15. package/dist/components/SearchableAndSortableUpdatingList.js +3 -2
  16. package/dist/components/SnapScrolling.d.ts +4 -4
  17. package/dist/components/SnapScrolling.js +1 -1
  18. package/dist/components/SnapScrollingDataTable.d.ts +2 -2
  19. package/dist/components/SnapScrollingDataTable.js +42 -17
  20. package/dist/components/User.d.ts +6 -4
  21. package/dist/components/User.js +34 -27
  22. package/dist/components/UserAvatar.d.ts +5 -3
  23. package/dist/components/UserAvatar.js +7 -35
  24. package/dist/components/UserTaskPage.d.ts +2 -1
  25. package/dist/components/UserTaskPage.js +21 -7
  26. package/dist/components/WorkflowPage.d.ts +3 -2
  27. package/dist/components/WorkflowPage.js +13 -5
  28. package/dist/components/index.d.ts +8 -6
  29. package/dist/components/index.js +2 -0
  30. package/dist/index.d.ts +7 -4
  31. package/dist/types/apis.d.ts +5 -3
  32. package/dist/types/index.d.ts +1 -1
  33. package/dist/types/lists.d.ts +2 -1
  34. package/dist/utils/column-type.d.ts +6 -0
  35. package/dist/utils/column-type.js +11 -0
  36. package/dist/utils/index.d.ts +2 -1
  37. package/dist/utils/index.js +1 -0
  38. package/dist/utils/module-federation.d.ts +5 -5
  39. package/dist/utils/module-federation.js +90 -38
  40. package/package.json +4 -4
@@ -5,31 +5,32 @@ import {
5
5
  __spreadValues
6
6
  } from "../chunk-YH4NJHER.js";
7
7
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
- import { useEffect, useMemo, useRef, useState } from "react";
8
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
9
9
  import { Box, CheckBox, Drop, Grid, Grommet, Text, TextInput, Tip } from "grommet";
10
10
  import {
11
- colorForEndedItemsOrUndefined,
12
- colorRowAccordingToUpdateStatus,
11
+ backgroundColorAccordingToStatus,
13
12
  debounce,
14
13
  DefaultListCell,
15
- ENDED_FONT_COLOR,
16
14
  Link,
17
15
  ListCell as StyledListCell,
18
- ListItemStatus,
16
+ textColorAccordingToStatus,
19
17
  useOnClickOutside,
18
+ UserDetailsBox,
20
19
  useResponsiveScreen
21
20
  } from "@vanillabp/bc-shared";
22
21
  import {
22
+ FulltextSearchInput,
23
23
  ListCell,
24
24
  SearchableAndSortableUpdatingList,
25
+ sortWithColumnTypeSpecificAttributes,
26
+ sortWithoutColumnTypeSpecificAttributes,
25
27
  TypeOfItem,
26
28
  useFederationModules
27
29
  } from "../index.js";
28
30
  import { Blank, ContactInfo, FormTrash, FormView, Hide, Refresh, User as UserIcon } from "grommet-icons";
29
31
  import { User } from "./User.js";
30
- import { ListColumnHeader } from "./ListColumnHeader.js";
32
+ import { AUTO_SIZE_COLUMN, ListColumnHeader } from "./ListColumnHeader.js";
31
33
  import { useTheme } from "styled-components";
32
- const minWidthOfTitleColumn = "20rem";
33
34
  const updateModuleDefinitions = (userTasks, existingModuleDefinitions, setModulesOfTasks, existingUserTaskDefinitions, setDefinitionsOfTasks) => {
34
35
  const newModuleDefinitions = userTasks.filter((userTask) => userTask.workflowModuleId !== void 0).reduce((moduleDefinitions, userTask) => moduleDefinitions.includes(userTask) ? moduleDefinitions : moduleDefinitions.concat(userTask), existingModuleDefinitions || []);
35
36
  if ((existingModuleDefinitions == null ? void 0 : existingModuleDefinitions.length) !== newModuleDefinitions.length) {
@@ -41,32 +42,38 @@ const updateModuleDefinitions = (userTasks, existingModuleDefinitions, setModule
41
42
  }
42
43
  }
43
44
  };
44
- const loadUserTasks = (tasklistApi, setNumberOfUserTasks, existingModuleDefinitions, setModulesOfTasks, existingUserTaskDefinitions, setDefinitionsOfTasks, pageSize, pageNumber, initialTimestamp, sort, sortAscending, mapToBcUserTask) => __async(void 0, null, function* () {
45
+ const loadUserTasks = (tasklistApi, numberOfUserTask, setNumberOfUserTasks, existingModuleDefinitions, setModulesOfTasks, existingUserTaskDefinitions, setDefinitionsOfTasks, pageSize, pageNumber, initialTimestamp, searchQueries, sort, sortAscending, mapToBcUserTask) => __async(void 0, null, function* () {
45
46
  const result = yield tasklistApi.getUserTasks(
46
47
  (/* @__PURE__ */ new Date()).getTime().toString(),
47
48
  pageNumber,
48
49
  pageSize,
49
50
  sort,
50
51
  sortAscending,
52
+ searchQueries,
51
53
  initialTimestamp
52
54
  );
53
- setNumberOfUserTasks(result.page.totalElements);
55
+ if (numberOfUserTask !== result.page.totalElements) {
56
+ setNumberOfUserTasks(result.page.totalElements);
57
+ }
54
58
  updateModuleDefinitions(result.userTasks, existingModuleDefinitions, setModulesOfTasks, existingUserTaskDefinitions, setDefinitionsOfTasks);
55
59
  return {
56
60
  serverTimestamp: result.serverTimestamp,
57
61
  items: result.userTasks.map((userTask) => mapToBcUserTask(userTask))
58
62
  };
59
63
  });
60
- const reloadUserTasks = (tasklistApi, setNumberOfUserTasks, existingModuleDefinitions, setModulesOfTasks, existingUserTaskDefinitions, setDefinitionsOfTasks, numberOfItems, knownItemsIds, initialTimestamp, sort, sortAscending, mapToBcUserTask, allSelected) => __async(void 0, null, function* () {
64
+ const reloadUserTasks = (tasklistApi, numberOfUserTask, setNumberOfUserTasks, existingModuleDefinitions, setModulesOfTasks, existingUserTaskDefinitions, setDefinitionsOfTasks, numberOfItems, knownItemsIds, initialTimestamp, searchQueries, sort, sortAscending, mapToBcUserTask, allSelected) => __async(void 0, null, function* () {
61
65
  const result = yield tasklistApi.getUserTasksUpdate(
62
66
  (/* @__PURE__ */ new Date()).getTime().toString(),
63
67
  numberOfItems,
64
68
  knownItemsIds,
65
69
  sort,
66
70
  sortAscending,
71
+ searchQueries,
67
72
  initialTimestamp
68
73
  );
69
- setNumberOfUserTasks(result.page.totalElements);
74
+ if (numberOfUserTask !== result.page.totalElements) {
75
+ setNumberOfUserTasks(result.page.totalElements);
76
+ }
70
77
  updateModuleDefinitions(result.userTasks, existingModuleDefinitions, setModulesOfTasks, existingUserTaskDefinitions, setDefinitionsOfTasks);
71
78
  return {
72
79
  serverTimestamp: result.serverTimestamp,
@@ -89,6 +96,7 @@ const SetReadStatusButtons = ({
89
96
  Box,
90
97
  {
91
98
  direction: "row",
99
+ flex: false,
92
100
  round: { size: "0.4rem" },
93
101
  border: { color },
94
102
  elevation: "small",
@@ -184,10 +192,17 @@ const ClaimButtons = ({
184
192
  justify: "center",
185
193
  children: [
186
194
  /* @__PURE__ */ jsx(
187
- UserIcon,
195
+ Box,
188
196
  {
189
- size: "20rem",
190
- color: textColor
197
+ pad: { vertical: "0.25rem" },
198
+ width: "1.5rem",
199
+ height: "2rem",
200
+ children: /* @__PURE__ */ jsx(
201
+ UserIcon,
202
+ {
203
+ color: textColor
204
+ }
205
+ )
191
206
  }
192
207
  ),
193
208
  isNotPhone && /* @__PURE__ */ jsx(
@@ -207,38 +222,43 @@ const ClaimButtons = ({
207
222
  Tip,
208
223
  {
209
224
  content: t("unclaim_tasks"),
210
- children: /* @__PURE__ */ jsxs(
225
+ children: /* @__PURE__ */ jsx(
211
226
  Box,
212
227
  {
213
228
  hoverIndicator: "light-2",
214
229
  focusIndicator: false,
215
230
  onClick: unclaimTasks,
216
- round: { size: "0.4rem", corner: "right" },
217
- style: { position: "relative" },
218
- width: "2rem",
219
231
  height: "2rem",
232
+ pad: { horizontal: "0.4rem" },
233
+ round: { size: "0.4rem", corner: "right" },
220
234
  align: "center",
221
235
  justify: "center",
222
236
  border: { color, side: "left" },
223
- children: [
224
- /* @__PURE__ */ jsx(
225
- UserIcon,
226
- {
227
- style: { position: "absolute" },
228
- color: textColor,
229
- size: "20rem"
230
- }
231
- ),
232
- /* @__PURE__ */ jsx(
233
- Blank,
234
- {
235
- style: { position: "absolute" },
236
- color: textColor,
237
- size: "20rem",
238
- children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("line", { x1: "24", y1: "4", x2: "4", y2: "24", strokeWidth: "2" }) })
239
- }
240
- )
241
- ]
237
+ children: /* @__PURE__ */ jsxs(
238
+ Box,
239
+ {
240
+ style: { position: "relative" },
241
+ pad: { vertical: "0.25rem" },
242
+ width: "1.5rem",
243
+ height: "2rem",
244
+ children: [
245
+ /* @__PURE__ */ jsx(
246
+ UserIcon,
247
+ {
248
+ color: textColor
249
+ }
250
+ ),
251
+ /* @__PURE__ */ jsx(
252
+ Blank,
253
+ {
254
+ style: { position: "absolute" },
255
+ color: textColor,
256
+ children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("line", { x1: "24", y1: "4", x2: "4", y2: "24", strokeWidth: "2" }) })
257
+ }
258
+ )
259
+ ]
260
+ }
261
+ )
242
262
  }
243
263
  )
244
264
  }
@@ -288,6 +308,7 @@ const AssignButton = ({
288
308
  setEdit(false);
289
309
  setHide(false);
290
310
  };
311
+ const { isPhone } = useResponsiveScreen();
291
312
  useOnClickOutside(inputRef, hideEdit);
292
313
  const findUsersDebounced = useMemo(() => debounce(loadResult, 300), [tasklistApi, currentQuery]);
293
314
  const updateResult = (newQuery) => {
@@ -312,7 +333,7 @@ const AssignButton = ({
312
333
  Box,
313
334
  {
314
335
  height: "2rem",
315
- width: "15rem",
336
+ width: isPhone ? "10rem" : "15rem",
316
337
  align: "center",
317
338
  justify: "center",
318
339
  style: { position: "relative" },
@@ -416,6 +437,7 @@ const AssignButton = ({
416
437
  children: /* @__PURE__ */ jsx(
417
438
  User,
418
439
  {
440
+ t,
419
441
  user,
420
442
  isUserLoggedIn: false,
421
443
  iconSize: "small",
@@ -445,12 +467,12 @@ const RefreshButton = ({
445
467
  return /* @__PURE__ */ jsx(
446
468
  Box,
447
469
  {
448
- hoverIndicator: disabled ? "light-2" : "accent-1",
470
+ hoverIndicator: disabled ? "light-2" : "list-refresh",
449
471
  focusIndicator: false,
450
472
  onClick: refresh,
451
473
  direction: "row",
452
474
  elevation: "small",
453
- background: !disabled ? { color: "accent-1", opacity: "strong" } : void 0,
475
+ background: !disabled ? { color: "list-refresh", opacity: "strong" } : void 0,
454
476
  round: { size: "0.4rem" },
455
477
  border: { color },
456
478
  children: /* @__PURE__ */ jsx(
@@ -461,6 +483,7 @@ const RefreshButton = ({
461
483
  Box,
462
484
  {
463
485
  height: "2rem",
486
+ width: "2rem",
464
487
  pad: { horizontal: "0.4rem" },
465
488
  align: "center",
466
489
  direction: "row",
@@ -468,7 +491,6 @@ const RefreshButton = ({
468
491
  children: /* @__PURE__ */ jsx(
469
492
  Refresh,
470
493
  {
471
- size: "20rem",
472
494
  color: textColor
473
495
  }
474
496
  )
@@ -562,8 +584,8 @@ const DefaultFooter = ({
562
584
  height: "100%",
563
585
  align: "center",
564
586
  justify: "center",
565
- background: { color: "accent-3", opacity: 0.1 },
566
- children: /* @__PURE__ */ jsx(Text, { size: "xsmall", children: "T" })
587
+ background: "list-new",
588
+ children: /* @__PURE__ */ jsx(Text, { size: "xsmall", color: "list-text-new", children: "T" })
567
589
  }
568
590
  )
569
591
  }
@@ -592,8 +614,8 @@ const DefaultFooter = ({
592
614
  height: "100%",
593
615
  align: "center",
594
616
  justify: "center",
595
- background: { color: "accent-1", opacity: 0.35 },
596
- children: /* @__PURE__ */ jsx(Text, { size: "xsmall", children: "T" })
617
+ background: "list-updated",
618
+ children: /* @__PURE__ */ jsx(Text, { size: "xsmall", color: "list-text-updated", children: "T" })
597
619
  }
598
620
  )
599
621
  }
@@ -622,8 +644,8 @@ const DefaultFooter = ({
622
644
  height: "100%",
623
645
  align: "center",
624
646
  justify: "center",
625
- background: { color: "light-2", opacity: 0.5 },
626
- children: /* @__PURE__ */ jsx(Text, { size: "xsmall", color: ENDED_FONT_COLOR, children: "T" })
647
+ background: "list-ended",
648
+ children: /* @__PURE__ */ jsx(Text, { size: "xsmall", color: "list-text-ended", children: "T" })
627
649
  }
628
650
  )
629
651
  }
@@ -652,8 +674,8 @@ const DefaultFooter = ({
652
674
  height: "100%",
653
675
  align: "center",
654
676
  justify: "center",
655
- background: { color: "light-2", opacity: 0.5 },
656
- children: /* @__PURE__ */ jsx(Text, { size: "xsmall", children: "T" })
677
+ background: "list-removed_from_list",
678
+ children: /* @__PURE__ */ jsx(Text, { size: "xsmall", color: "list-text-removed_from_list", children: "T" })
657
679
  }
658
680
  )
659
681
  }
@@ -682,7 +704,10 @@ const DefaultHeader = ({
682
704
  unclaimTasks,
683
705
  claimTasksDisabled,
684
706
  assignTasks,
685
- assignDisabled
707
+ assignDisabled,
708
+ initialKwicQuery,
709
+ limitListToKwic,
710
+ kwic
686
711
  }) => {
687
712
  return /* @__PURE__ */ jsxs(
688
713
  Box,
@@ -729,18 +754,28 @@ const DefaultHeader = ({
729
754
  refresh,
730
755
  disabled: refreshDisabled
731
756
  }
757
+ ),
758
+ /* @__PURE__ */ jsx(
759
+ FulltextSearchInput,
760
+ {
761
+ t,
762
+ initialQuery: initialKwicQuery,
763
+ limitListToKwic,
764
+ kwic
765
+ }
732
766
  )
733
767
  ]
734
768
  }
735
769
  );
736
770
  };
737
771
  const CandidateUsersListCell = ({
772
+ t,
738
773
  item
739
774
  }) => {
740
775
  var _a, _b;
741
776
  const targetRef = useRef(null);
742
777
  const [dropIdentifier, setDropIdentifier] = useState(void 0);
743
- const background = colorRowAccordingToUpdateStatus(item);
778
+ const background = backgroundColorAccordingToStatus(item);
744
779
  return /* @__PURE__ */ jsx(
745
780
  StyledListCell,
746
781
  {
@@ -759,29 +794,24 @@ const CandidateUsersListCell = ({
759
794
  Drop,
760
795
  {
761
796
  inline: true,
797
+ stretch: true,
762
798
  round: "xsmall",
763
799
  onMouseLeave: () => setDropIdentifier(void 0),
764
800
  target: targetRef,
765
- children: /* @__PURE__ */ jsx(
766
- Box,
767
- {
768
- direction: "column",
769
- margin: "xsmall",
770
- gap: "xsmall",
771
- children: (_b = item.data.candidateUsers) == null ? void 0 : _b.map((user) => /* @__PURE__ */ jsxs(
772
- Box,
801
+ children: /* @__PURE__ */ jsx(Grid, { columns: ["auto", "auto"], gap: "xsmall", margin: "xsmall", children: (_b = item.data.candidateUsers) == null ? void 0 : _b.map((user) => {
802
+ var _a2, _b2;
803
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
804
+ /* @__PURE__ */ jsx(
805
+ Text,
773
806
  {
774
- direction: "row",
775
- align: "center",
776
- justify: "center",
777
- children: [
778
- user,
779
- /* @__PURE__ */ jsx(FormTrash, { onClick: () => item.data.unassign(user) })
780
- ]
807
+ style: { whiteSpace: "nowrap" },
808
+ tip: { content: /* @__PURE__ */ jsx(UserDetailsBox, { user, t }) },
809
+ children: (_b2 = (_a2 = user.displayShort) != null ? _a2 : user.email) != null ? _b2 : user.id
781
810
  }
782
- ))
783
- }
784
- )
811
+ ),
812
+ /* @__PURE__ */ jsx(FormTrash, { onClick: () => item.data.unassign(user.id) })
813
+ ] });
814
+ }) })
785
815
  }
786
816
  )
787
817
  ] }) : void 0
@@ -792,7 +822,7 @@ const SelectDefaultListCell = ({
792
822
  item,
793
823
  selectItem
794
824
  }) => {
795
- const background = colorRowAccordingToUpdateStatus(item);
825
+ const background = backgroundColorAccordingToStatus(item);
796
826
  return /* @__PURE__ */ jsx(
797
827
  StyledListCell,
798
828
  {
@@ -801,6 +831,7 @@ const SelectDefaultListCell = ({
801
831
  children: /* @__PURE__ */ jsx(
802
832
  CheckBox,
803
833
  {
834
+ id: item.id,
804
835
  checked: item.selected,
805
836
  onChange: (event) => selectItem(event.currentTarget.checked)
806
837
  }
@@ -819,7 +850,8 @@ const TitleDefaultListCell = ({
819
850
  } else {
820
851
  title = item.data["title"][titleLanguages[0]];
821
852
  }
822
- const background = colorRowAccordingToUpdateStatus(item);
853
+ const background = backgroundColorAccordingToStatus(item);
854
+ const text = textColorAccordingToStatus(item);
823
855
  return /* @__PURE__ */ jsx(
824
856
  StyledListCell,
825
857
  {
@@ -828,12 +860,12 @@ const TitleDefaultListCell = ({
828
860
  children: /* @__PURE__ */ jsx(
829
861
  Text,
830
862
  {
831
- color: colorForEndedItemsOrUndefined(item),
832
863
  weight: item.read === void 0 ? "bold" : "normal",
833
864
  truncate: "tip",
834
- children: item.status === ListItemStatus.ENDED ? /* @__PURE__ */ jsx(Fragment, { children: title }) : /* @__PURE__ */ jsx(
865
+ children: /* @__PURE__ */ jsx(
835
866
  Link,
836
867
  {
868
+ color: text,
837
869
  onClick: item.data.open,
838
870
  children: title
839
871
  }
@@ -871,9 +903,11 @@ const ListOfTasks = ({
871
903
  t,
872
904
  currentLanguage,
873
905
  defaultSort,
874
- defaultSortAscending,
906
+ defaultSortAscending = true,
875
907
  name,
876
908
  columns,
909
+ minWidthOfColumns = "4rem",
910
+ minWidthOfAutoColumn = "20rem",
877
911
  children,
878
912
  headerHeight = "3rem",
879
913
  footer,
@@ -884,12 +918,14 @@ const ListOfTasks = ({
884
918
  excludeIdColumn = false,
885
919
  columnHeader,
886
920
  columnHeaderBackground = "dark-3",
887
- columnHeaderSeparator
921
+ columnHeaderSeparator = "light-6",
922
+ defaultSearchQueries = []
888
923
  }) => {
889
924
  const { isPhone, isTablet } = useResponsiveScreen();
890
925
  const wakeupSseCallback = useRef(void 0);
891
926
  const tasklistApi = useTasklistApi(wakeupSseCallback);
892
927
  const [refreshIndicator, setRefreshIndicator] = useState(/* @__PURE__ */ new Date());
928
+ const [searchQueries, setSearchQueries] = useState(defaultSearchQueries);
893
929
  const updateListRef = useRef(void 0);
894
930
  const updateList = useMemo(() => (ev) => __async(void 0, null, function* () {
895
931
  if (!updateListRef.current)
@@ -906,19 +942,22 @@ const ListOfTasks = ({
906
942
  return __spreadProps(__spreadValues({}, userTask), {
907
943
  open: () => openTask(userTask),
908
944
  navigateToWorkflow: () => navigateToWorkflow(userTask),
909
- unassign: (userId) => unassign(userTask.id, userId)
945
+ assign: (userId) => assignFunction(userTask.id, userId, false),
946
+ unassign: (userId) => assignFunction(userTask.id, userId, true),
947
+ claim: () => tasklistApi.claimTask(userTask.id, false),
948
+ unclaim: () => tasklistApi.claimTask(userTask.id, true)
910
949
  });
911
950
  };
912
951
  const userTasks = useRef(void 0);
913
952
  const [numberOfTasks, setNumberOfTasks] = useState(0);
914
953
  const [modulesOfTasks, setModulesOfTasks] = useState(void 0);
915
- const [languagesOfTitles, setLanguagesOfTitles] = useState([currentLanguage]);
916
954
  const [definitionsOfTasks, setDefinitionsOfTasks] = useState(void 0);
917
955
  useEffect(
918
956
  () => {
919
957
  const loadMetaInformation = () => __async(void 0, null, function* () {
920
- const result = yield loadUserTasks(
958
+ yield loadUserTasks(
921
959
  tasklistApi,
960
+ numberOfTasks,
922
961
  setNumberOfTasks,
923
962
  modulesOfTasks,
924
963
  setModulesOfTasks,
@@ -927,17 +966,11 @@ const ListOfTasks = ({
927
966
  20,
928
967
  0,
929
968
  void 0,
969
+ searchQueries,
930
970
  void 0,
931
971
  true,
932
972
  mapToBcUserTask
933
973
  );
934
- const titleLanguages = result.items.flatMap((userTask) => Object.keys(userTask.title)).reduce((allLanguages, titleLanguage) => {
935
- if (!allLanguages.includes(titleLanguage)) {
936
- allLanguages.push(titleLanguage);
937
- }
938
- return allLanguages;
939
- }, new Array(currentLanguage));
940
- setLanguagesOfTitles(titleLanguages);
941
974
  });
942
975
  if (userTasks.current === void 0) {
943
976
  showLoadingIndicator(true);
@@ -946,7 +979,7 @@ const ListOfTasks = ({
946
979
  },
947
980
  // tasklistApi is not part of dependency because it changes one time but this is irrelevant to the
948
981
  // purpose of preloading modules used by usertasks
949
- [userTasks, setNumberOfTasks, setModulesOfTasks, setDefinitionsOfTasks, showLoadingIndicator, refreshIndicator, setLanguagesOfTitles]
982
+ [userTasks, setNumberOfTasks, setModulesOfTasks, setDefinitionsOfTasks, showLoadingIndicator, refreshIndicator]
950
983
  );
951
984
  const [columnsOfTasks, setColumnsOfTasks] = useState(void 0);
952
985
  const modules = useFederationModules(modulesOfTasks, "UserTaskList");
@@ -983,8 +1016,9 @@ const ListOfTasks = ({
983
1016
  if (totalColumns.title === void 0) {
984
1017
  totalColumns.title = {
985
1018
  title: { [currentLanguage]: t("column_title") },
1019
+ type: "i18n",
986
1020
  path: "title",
987
- width: "",
1021
+ width: AUTO_SIZE_COLUMN,
988
1022
  priority: 0,
989
1023
  show: true,
990
1024
  sortable: true,
@@ -995,8 +1029,9 @@ const ListOfTasks = ({
995
1029
  if (totalColumns.assignee === void 0) {
996
1030
  totalColumns.assignee = {
997
1031
  path: "assignee",
1032
+ type: "person",
998
1033
  show: true,
999
- sortable: false,
1034
+ sortable: true,
1000
1035
  filterable: false,
1001
1036
  title: { [currentLanguage]: t("column_assignee") },
1002
1037
  width: "10rem",
@@ -1028,8 +1063,8 @@ const ListOfTasks = ({
1028
1063
  const [anySelected, setAnySelected] = useState(false);
1029
1064
  const [refreshNecessary, setRefreshNecessary] = useState(false);
1030
1065
  const [effectiveSort, _setSort] = useState(defaultSort);
1031
- const sort = (effectiveSort == null ? void 0 : effectiveSort.startsWith("title.")) ? "title" : effectiveSort;
1032
- const [sortAscending, _setSortAscending] = useState(defaultSortAscending === void 0 ? true : defaultSortAscending);
1066
+ const sort = sortWithoutColumnTypeSpecificAttributes(currentLanguage, effectiveSort);
1067
+ const [sortAscending, _setSortAscending] = useState(defaultSortAscending);
1033
1068
  const refreshList = () => {
1034
1069
  userTasks.current = void 0;
1035
1070
  setRefreshNecessary(false);
@@ -1037,40 +1072,43 @@ const ListOfTasks = ({
1037
1072
  setRefreshIndicator(/* @__PURE__ */ new Date());
1038
1073
  };
1039
1074
  const setSort = (column) => {
1040
- if (column) {
1041
- if (column.path === "title") {
1042
- _setSort("title." + languagesOfTitles.join(",title."));
1043
- } else {
1044
- _setSort(column.path);
1045
- }
1075
+ let ascending;
1076
+ if (!column) {
1077
+ ascending = defaultSortAscending;
1078
+ column = columnsOfTasks == null ? void 0 : columnsOfTasks.filter((c) => c.path === defaultSort).at(0);
1046
1079
  } else {
1047
- _setSort(defaultSort);
1080
+ ascending = true;
1048
1081
  }
1049
- _setSortAscending(defaultSortAscending === void 0 ? true : defaultSortAscending);
1082
+ _setSort(sortWithColumnTypeSpecificAttributes(currentLanguage, column));
1083
+ _setSortAscending(ascending);
1050
1084
  refreshList();
1051
1085
  };
1052
- const setSortAscending = (sortAscending2) => {
1053
- _setSortAscending(sortAscending2);
1086
+ const setSortAscending = (newSortAscending) => {
1087
+ _setSortAscending(newSortAscending);
1054
1088
  refreshList();
1055
1089
  };
1056
- const unassign = (userTaskId, userId) => {
1057
- tasklistApi.assignTask(userTaskId, userId, true);
1090
+ const assignFunction = (userTaskId, userId, unassign) => {
1091
+ tasklistApi.assignTask(userTaskId, userId, unassign);
1058
1092
  };
1059
1093
  const [columnWidthAdjustments, setColumnWidthAdjustments] = useState({});
1060
- const getColumnSize = (column) => {
1061
- return !column.resizeable ? column.width : column.width !== "" ? `max(4rem, calc(${column.width} + ${columnWidthAdjustments[column.path] ? columnWidthAdjustments[column.path] : 0}px))` : columnWidthAdjustments[column.path] ? `${columnWidthAdjustments[column.path]}px` : void 0;
1062
- };
1063
- const setColumnWidthAdjustment = (column, adjustment) => {
1064
- if (column.width === "") {
1065
- column.width = `${adjustment}px`;
1066
- return;
1094
+ const autoColumnWidth = useRef();
1095
+ const getColumnSize = useCallback(
1096
+ (column) => {
1097
+ var _a;
1098
+ return !column.resizeable ? column.width : column.width !== AUTO_SIZE_COLUMN ? `max(${((_a = autoColumnWidth.current) == null ? void 0 : _a.column.path) === column.path ? minWidthOfAutoColumn : minWidthOfColumns}, calc(${column.width} + ${columnWidthAdjustments[column.path] ? columnWidthAdjustments[column.path] : 0}px))` : columnWidthAdjustments[column.path] ? `${columnWidthAdjustments[column.path]}px` : void 0;
1099
+ },
1100
+ [columnWidthAdjustments]
1101
+ );
1102
+ const setColumnWidthAdjustment = useCallback((column, adjustment) => {
1103
+ if (autoColumnWidth.current && autoColumnWidth.current.column.width === AUTO_SIZE_COLUMN) {
1104
+ autoColumnWidth.current.column.width = `${autoColumnWidth.current.width}px`;
1067
1105
  }
1068
1106
  const current = columnWidthAdjustments[column.path];
1069
1107
  if (current === adjustment)
1070
1108
  return;
1071
1109
  setColumnWidthAdjustments(__spreadProps(__spreadValues({}, columnWidthAdjustments), { [column.path]: adjustment }));
1072
- };
1073
- const selectAll = (select) => {
1110
+ }, [columnWidthAdjustments, setColumnWidthAdjustments, autoColumnWidth]);
1111
+ const selectAll = useCallback((select) => {
1074
1112
  refreshItemRef.current(
1075
1113
  userTasks.current.reduce((allItemIds, item) => {
1076
1114
  item.selected = select;
@@ -1082,8 +1120,8 @@ const ListOfTasks = ({
1082
1120
  if (anySelected !== select) {
1083
1121
  setAnySelected(select);
1084
1122
  }
1085
- };
1086
- const selectItem = (item, select) => {
1123
+ }, [refreshItemRef, userTasks, allSelected, anySelected, setAnySelected, setAllSelected]);
1124
+ const selectItem = useCallback((item, select) => {
1087
1125
  item.selected = select;
1088
1126
  refreshItemRef.current([item.id]);
1089
1127
  const currentlyAllSelected = userTasks.current.reduce((allSelected2, userTask) => allSelected2 && userTask.selected, true);
@@ -1094,48 +1132,70 @@ const ListOfTasks = ({
1094
1132
  if (anySelected !== currentlyAnySelected) {
1095
1133
  setAnySelected(currentlyAnySelected);
1096
1134
  }
1097
- };
1098
- const columnsOfList = columnsOfTasks === void 0 ? [] : columnsOfTasks.filter((column) => column.show).filter((column) => columns === void 0 || columns.includes(column.path)).map((column, columnIndex, allColumns) => ({
1099
- property: column.path,
1100
- size: getColumnSize(column),
1101
- plain: true,
1102
- verticalAlign: "top",
1103
- header: /* @__PURE__ */ jsx(
1104
- ListColumnHeader,
1105
- {
1106
- t,
1107
- currentLanguage,
1108
- nameOfList: name,
1109
- columnHeader,
1110
- hasColumnWidthAdjustment: columnWidthAdjustments[column.path] !== void 0,
1111
- setColumnWidthAdjustment,
1112
- sort: sort === column.path,
1113
- setSort,
1114
- sortAscending,
1115
- setSortAscending,
1116
- column,
1117
- columnIndex,
1118
- numberOfAllColumns: allColumns.length,
1119
- allSelected,
1120
- selectAll
1121
- }
1122
- ),
1123
- render: (item) => /* @__PURE__ */ jsx(
1124
- ListCell,
1125
- {
1126
- modulesAvailable: modules,
1127
- column,
1128
- currentLanguage,
1129
- nameOfList: name,
1130
- typeOfItem: TypeOfItem.TaskList,
1131
- showUnreadAsBold: true,
1132
- t,
1133
- item,
1134
- selectItem,
1135
- defaultListCell: UserTaskDefaultListCell
1136
- }
1137
- )
1138
- }));
1135
+ }, [refreshItemRef, userTasks, allSelected, anySelected, setAnySelected, setAllSelected]);
1136
+ const columnsOfList = useMemo(
1137
+ () => columnsOfTasks === void 0 ? [] : columnsOfTasks.filter((column) => column.show).filter((column) => columns === void 0 || columns.includes(column.path)).map((column, columnIndex, allColumns) => ({
1138
+ property: column.path,
1139
+ size: getColumnSize(column),
1140
+ plain: true,
1141
+ verticalAlign: "top",
1142
+ header: /* @__PURE__ */ jsx(
1143
+ ListColumnHeader,
1144
+ {
1145
+ t,
1146
+ currentLanguage,
1147
+ nameOfList: name,
1148
+ columnHeader,
1149
+ columnWidthAdjustment: columnWidthAdjustments[column.path],
1150
+ setAutoColumnWidth: (column2, width) => autoColumnWidth.current = { column: column2, width },
1151
+ setColumnWidthAdjustment,
1152
+ sort: sort === column.path,
1153
+ setSort,
1154
+ isDefaultSort: column.path === defaultSort,
1155
+ sortAscending,
1156
+ defaultSortAscending,
1157
+ setSortAscending,
1158
+ column,
1159
+ columnIndex,
1160
+ numberOfAllColumns: allColumns.length,
1161
+ allSelected,
1162
+ selectAll
1163
+ }
1164
+ ),
1165
+ render: (item) => /* @__PURE__ */ jsx(
1166
+ ListCell,
1167
+ {
1168
+ modulesAvailable: modules,
1169
+ column,
1170
+ currentLanguage,
1171
+ nameOfList: name,
1172
+ typeOfItem: TypeOfItem.TaskList,
1173
+ showUnreadAsBold: true,
1174
+ t,
1175
+ item,
1176
+ selectItem,
1177
+ defaultListCell: UserTaskDefaultListCell
1178
+ }
1179
+ )
1180
+ })),
1181
+ [
1182
+ modules,
1183
+ currentLanguage,
1184
+ name,
1185
+ columnsOfTasks,
1186
+ setSort,
1187
+ setSortAscending,
1188
+ sortAscending,
1189
+ defaultSortAscending,
1190
+ selectItem,
1191
+ selectAll,
1192
+ allSelected,
1193
+ getColumnSize,
1194
+ columnWidthAdjustments,
1195
+ defaultSort,
1196
+ setColumnWidthAdjustment
1197
+ ]
1198
+ );
1139
1199
  const markAsRead = (unread) => {
1140
1200
  const read = unread ? void 0 : /* @__PURE__ */ new Date();
1141
1201
  const userTaskMarkedIds = userTasks.current.filter((userTask) => userTask.selected).map((userTask) => {
@@ -1177,6 +1237,27 @@ const ListOfTasks = ({
1177
1237
  setAnySelected(false);
1178
1238
  tasklistApi.assignTasks(userTaskMarkedIds, userId);
1179
1239
  };
1240
+ const initialKwicQuery = (columnPath) => {
1241
+ const query = searchQueries.filter((query2) => query2.path === columnPath).map((query2) => query2.query);
1242
+ if (query.length === 0)
1243
+ return "";
1244
+ return query[0];
1245
+ };
1246
+ const setKwic = (columnPath, value) => {
1247
+ const newSearchQueries = searchQueries.filter((query) => query.path !== columnPath);
1248
+ if (value !== void 0 && value.trim().length > 0) {
1249
+ newSearchQueries.push({ path: columnPath, query: value, caseInsensitive: true });
1250
+ }
1251
+ setSearchQueries(newSearchQueries);
1252
+ refreshList();
1253
+ };
1254
+ const kwic = (columnPath, query) => __async(void 0, null, function* () {
1255
+ return yield tasklistApi.kwicUserTasks(
1256
+ query,
1257
+ columnPath,
1258
+ searchQueries
1259
+ );
1260
+ });
1180
1261
  const defaultFooter = () => /* @__PURE__ */ jsx(
1181
1262
  DefaultFooter,
1182
1263
  {
@@ -1200,7 +1281,10 @@ const ListOfTasks = ({
1200
1281
  unclaimTasks: () => claim(true),
1201
1282
  claimTasksDisabled: !anySelected,
1202
1283
  assignTasks: assign,
1203
- assignDisabled: !anySelected
1284
+ assignDisabled: !anySelected,
1285
+ initialKwicQuery,
1286
+ limitListToKwic: setKwic,
1287
+ kwic
1204
1288
  }
1205
1289
  );
1206
1290
  const themeContext = useTheme();
@@ -1244,7 +1328,7 @@ const ListOfTasks = ({
1244
1328
  rowSeparator,
1245
1329
  applyBackgroundColor,
1246
1330
  showLoadingIndicator,
1247
- minWidthOfAutoColumn: minWidthOfTitleColumn,
1331
+ minWidthOfAutoColumn,
1248
1332
  columns: columnsOfList,
1249
1333
  itemsRef: userTasks,
1250
1334
  showColumnHeaders,
@@ -1258,6 +1342,7 @@ const ListOfTasks = ({
1258
1342
  // @ts-ignore
1259
1343
  yield loadUserTasks(
1260
1344
  tasklistApi,
1345
+ numberOfTasks,
1261
1346
  setNumberOfTasks,
1262
1347
  modulesOfTasks,
1263
1348
  setModulesOfTasks,
@@ -1266,6 +1351,7 @@ const ListOfTasks = ({
1266
1351
  pageSize,
1267
1352
  pageNumber,
1268
1353
  initialTimestamp,
1354
+ searchQueries,
1269
1355
  effectiveSort,
1270
1356
  sortAscending,
1271
1357
  mapToBcUserTask
@@ -1277,6 +1363,7 @@ const ListOfTasks = ({
1277
1363
  // @ts-ignore
1278
1364
  yield reloadUserTasks(
1279
1365
  tasklistApi,
1366
+ numberOfTasks,
1280
1367
  setNumberOfTasks,
1281
1368
  modulesOfTasks,
1282
1369
  setModulesOfTasks,
@@ -1285,6 +1372,7 @@ const ListOfTasks = ({
1285
1372
  numberOfItems,
1286
1373
  updatedItemsIds,
1287
1374
  initialTimestamp,
1375
+ searchQueries,
1288
1376
  effectiveSort,
1289
1377
  sortAscending,
1290
1378
  mapToBcUserTask