@vanillabp/bc-ui 0.0.3 → 0.0.5

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,27 +5,27 @@ import {
5
5
  __spreadValues
6
6
  } from "../chunk-YH4NJHER.js";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
- import { useEffect, useMemo, useRef, useState } from "react";
9
- import { Box, CheckBox, Grid, Text, TextInput, Tip } from "grommet";
8
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
9
+ import { Box, CheckBox, Grid, Text, Tip } from "grommet";
10
10
  import {
11
- colorForEndedItemsOrUndefined,
12
- colorRowAccordingToUpdateStatus,
13
- debounce,
11
+ backgroundColorAccordingToStatus,
14
12
  DefaultListCell,
15
- ENDED_FONT_COLOR,
16
13
  Link,
17
14
  ListCell as StyledListCell,
15
+ textColorAccordingToStatus,
18
16
  useResponsiveScreen
19
17
  } from "@vanillabp/bc-shared";
20
18
  import {
19
+ FulltextSearchInput,
21
20
  ListCell,
22
21
  SearchableAndSortableUpdatingList,
22
+ sortWithColumnTypeSpecificAttributes,
23
+ sortWithoutColumnTypeSpecificAttributes,
23
24
  TypeOfItem,
24
25
  useFederationModules
25
26
  } from "../index.js";
26
- import { ListColumnHeader } from "./ListColumnHeader.js";
27
- import { Clear, Refresh, Search } from "grommet-icons";
28
- const minWidthOfTitleColumn = "20rem";
27
+ import { AUTO_SIZE_COLUMN, ListColumnHeader } from "./ListColumnHeader.js";
28
+ import { Refresh } from "grommet-icons";
29
29
  const updateModuleDefinitions = (workflows, existingModuleDefinitions, setModulesOfWorkflows, existingWorkflowDefinitions, setDefinitionsOfWorkflows) => {
30
30
  const newModuleDefinitions = workflows.filter((workflow) => workflow.workflowModuleId !== void 0).reduce((moduleDefinitions, workflow) => moduleDefinitions.includes(workflow) ? moduleDefinitions : moduleDefinitions.concat(workflow), existingModuleDefinitions || []);
31
31
  if ((existingModuleDefinitions == null ? void 0 : existingModuleDefinitions.length) !== newModuleDefinitions.length) {
@@ -37,16 +37,18 @@ const updateModuleDefinitions = (workflows, existingModuleDefinitions, setModule
37
37
  }
38
38
  }
39
39
  };
40
- const loadWorkflows = (workflowlistApi, setNumberOfWorkflows, existingModuleDefinitions, setModulesOfWorkflows, existingWorkflowDefinitions, setDefinitionsOfWorkflows, pageSize, pageNumber, initialTimestamp, searchQueries, sort, sortAscending, mapToBcWorkflow) => __async(void 0, null, function* () {
40
+ const loadWorkflows = (workflowlistApi, numberOfWorkflows, setNumberOfWorkflows, existingModuleDefinitions, setModulesOfWorkflows, existingWorkflowDefinitions, setDefinitionsOfWorkflows, pageSize, pageNumber, initialTimestamp, searchQueries, sort, sortAscending, mapToBcWorkflow) => __async(void 0, null, function* () {
41
41
  const result = yield workflowlistApi.getWorkflows((/* @__PURE__ */ new Date()).getTime().toString(), pageNumber, pageSize, sort, sortAscending, searchQueries, initialTimestamp);
42
- setNumberOfWorkflows(result.page.totalElements);
42
+ if (numberOfWorkflows !== result.page.totalElements) {
43
+ setNumberOfWorkflows(result.page.totalElements);
44
+ }
43
45
  updateModuleDefinitions(result.workflows, existingModuleDefinitions, setModulesOfWorkflows, existingWorkflowDefinitions, setDefinitionsOfWorkflows);
44
46
  return {
45
47
  serverTimestamp: result.serverTimestamp,
46
48
  items: result.workflows.map((workflow) => mapToBcWorkflow(workflow))
47
49
  };
48
50
  });
49
- const reloadWorkflows = (workflowlistApi, setNumberOfWorkflows, existingModuleDefinitions, setModulesOfWorkflows, existingWorkflowDefinitions, setDefinitionsOfWorkflows, numberOfItems, knownItemsIds, initialTimestamp, searchQueries, sort, sortAscending, mapToBcWorkflow) => __async(void 0, null, function* () {
51
+ const reloadWorkflows = (workflowlistApi, numberOfWorkflows, setNumberOfWorkflows, existingModuleDefinitions, setModulesOfWorkflows, existingWorkflowDefinitions, setDefinitionsOfWorkflows, numberOfItems, knownItemsIds, initialTimestamp, searchQueries, sort, sortAscending, mapToBcWorkflow) => __async(void 0, null, function* () {
50
52
  const result = yield workflowlistApi.getWorkflowsUpdate(
51
53
  (/* @__PURE__ */ new Date()).getTime().toString(),
52
54
  numberOfItems,
@@ -56,162 +58,15 @@ const reloadWorkflows = (workflowlistApi, setNumberOfWorkflows, existingModuleDe
56
58
  searchQueries,
57
59
  initialTimestamp
58
60
  );
59
- setNumberOfWorkflows(result.page.totalElements);
61
+ if (numberOfWorkflows !== result.page.totalElements) {
62
+ setNumberOfWorkflows(result.page.totalElements);
63
+ }
60
64
  updateModuleDefinitions(result.workflows, existingModuleDefinitions, setModulesOfWorkflows, existingWorkflowDefinitions, setDefinitionsOfWorkflows);
61
65
  return {
62
66
  serverTimestamp: result.serverTimestamp,
63
67
  items: result.workflows.map((workflow) => mapToBcWorkflow(workflow))
64
68
  };
65
69
  });
66
- const FulltextSearch = ({
67
- t,
68
- initialQuery,
69
- limitListToKwic,
70
- kwic
71
- // focus = false,
72
- }) => {
73
- const { isPhone } = useResponsiveScreen();
74
- const textFieldRef = useRef(null);
75
- const [query, setQuery] = useState(initialQuery);
76
- const currentQuery = useRef(initialQuery(void 0));
77
- const [suggestions, setSuggestions] = useState(void 0);
78
- const ignoreKeyEnter = useRef(false);
79
- const select = (value, suggestion) => {
80
- if (suggestion) {
81
- ignoreKeyEnter.current = true;
82
- } else if (ignoreKeyEnter.current) {
83
- ignoreKeyEnter.current = false;
84
- return;
85
- }
86
- if (value === void 0)
87
- return;
88
- setSuggestions(void 0);
89
- setQuery(value);
90
- currentQuery.current = value;
91
- limitListToKwic(void 0, value);
92
- };
93
- const kwicDebounced = useMemo(() => debounce(() => __async(void 0, null, function* () {
94
- const result = yield kwic(void 0, currentQuery.current);
95
- const newSuggestions = result.map((r) => ({
96
- value: r.item,
97
- label: /* @__PURE__ */ jsxs(
98
- Box,
99
- {
100
- direction: "row",
101
- justify: "between",
102
- pad: "xsmall",
103
- children: [
104
- /* @__PURE__ */ jsx(
105
- Text,
106
- {
107
- weight: "bold",
108
- truncate: "tip",
109
- children: r.item
110
- }
111
- ),
112
- /* @__PURE__ */ jsx(
113
- Box,
114
- {
115
- align: "right",
116
- children: r.count
117
- }
118
- )
119
- ]
120
- }
121
- )
122
- }));
123
- setSuggestions(
124
- newSuggestions.length > 20 ? [...newSuggestions.slice(0, 20), { value: void 0, label: /* @__PURE__ */ jsx(Box, { pad: "xsmall", children: t("kwic_to-many-hits") }) }] : newSuggestions
125
- );
126
- }), 300), [currentQuery, setSuggestions]);
127
- const updateResult = (newQuery) => {
128
- currentQuery.current = newQuery;
129
- setQuery(newQuery);
130
- if (newQuery.length < 3) {
131
- if (suggestions) {
132
- setSuggestions(void 0);
133
- }
134
- return;
135
- }
136
- kwicDebounced();
137
- };
138
- const clear = () => {
139
- currentQuery.current = "";
140
- setQuery("");
141
- setSuggestions(void 0);
142
- textFieldRef.current.focus();
143
- limitListToKwic(void 0, void 0);
144
- };
145
- return /* @__PURE__ */ jsx(
146
- Box,
147
- {
148
- width: isPhone ? "100%" : "min(100%, 30rem)",
149
- elevation: "small",
150
- alignContent: "center",
151
- hoverIndicator: "white",
152
- focusIndicator: false,
153
- round: { size: "0.4rem" },
154
- border: { color: "dark-4" },
155
- children: /* @__PURE__ */ jsxs(
156
- Grid,
157
- {
158
- columns: ["auto", "2rem"],
159
- fill: true,
160
- children: [
161
- /* @__PURE__ */ jsx(
162
- Box,
163
- {
164
- pad: { horizontal: "0.4rem", vertical: "0.25rem" },
165
- direction: "row",
166
- justify: "center",
167
- children: /* @__PURE__ */ jsx(
168
- TextInput,
169
- {
170
- plain: "full",
171
- ref: textFieldRef,
172
- value: query,
173
- placeholder: t("kwic_placeholder"),
174
- onKeyDown: (event) => event.key === "Enter" ? select(query, false) : void 0,
175
- onChange: (event) => updateResult(event.target.value),
176
- suggestions: suggestions === void 0 ? [] : suggestions.length === 0 ? [{ value: void 0, label: /* @__PURE__ */ jsx(Box, { pad: "xsmall", children: t("kwic_no-hit") }) }] : suggestions,
177
- onSuggestionSelect: (x) => select(x.suggestion.value, true),
178
- focusIndicator: false,
179
- reverse: true
180
- }
181
- )
182
- }
183
- ),
184
- /* @__PURE__ */ jsx(
185
- Tip,
186
- {
187
- content: t("kwic_tooltip"),
188
- children: /* @__PURE__ */ jsx(
189
- Box,
190
- {
191
- align: "center",
192
- justify: "center",
193
- children: Boolean(query) ? /* @__PURE__ */ jsx(
194
- Clear,
195
- {
196
- onMouseUp: clear,
197
- color: "dark-4"
198
- }
199
- ) : /* @__PURE__ */ jsx(
200
- Search,
201
- {
202
- color: "dark-4"
203
- }
204
- )
205
- }
206
- )
207
- }
208
- )
209
- ]
210
- }
211
- )
212
- }
213
- );
214
- };
215
70
  const RefreshButton = ({
216
71
  t,
217
72
  disabled,
@@ -222,12 +77,12 @@ const RefreshButton = ({
222
77
  return /* @__PURE__ */ jsx(
223
78
  Box,
224
79
  {
225
- hoverIndicator: disabled ? "light-2" : "accent-1",
80
+ hoverIndicator: disabled ? "light-2" : "list-refresh",
226
81
  focusIndicator: false,
227
82
  onClick: refresh,
228
83
  direction: "row",
229
84
  elevation: "small",
230
- background: !disabled ? { color: "accent-1", opacity: "strong" } : void 0,
85
+ background: !disabled ? { color: "list-refresh", opacity: "strong" } : void 0,
231
86
  round: { size: "0.4rem" },
232
87
  border: { color },
233
88
  children: /* @__PURE__ */ jsx(
@@ -238,6 +93,7 @@ const RefreshButton = ({
238
93
  Box,
239
94
  {
240
95
  height: "2rem",
96
+ width: "2rem",
241
97
  pad: { horizontal: "0.4rem" },
242
98
  align: "center",
243
99
  direction: "row",
@@ -245,7 +101,6 @@ const RefreshButton = ({
245
101
  children: /* @__PURE__ */ jsx(
246
102
  Refresh,
247
103
  {
248
- size: "20rem",
249
104
  color: textColor
250
105
  }
251
106
  )
@@ -339,8 +194,8 @@ const DefaultFooter = ({
339
194
  height: "100%",
340
195
  align: "center",
341
196
  justify: "center",
342
- background: { color: "accent-3", opacity: 0.1 },
343
- children: /* @__PURE__ */ jsx(Text, { size: "xsmall", children: "T" })
197
+ background: "list-new",
198
+ children: /* @__PURE__ */ jsx(Text, { size: "xsmall", color: "list-text-new", children: "T" })
344
199
  }
345
200
  )
346
201
  }
@@ -369,8 +224,8 @@ const DefaultFooter = ({
369
224
  height: "100%",
370
225
  align: "center",
371
226
  justify: "center",
372
- background: { color: "accent-1", opacity: 0.35 },
373
- children: /* @__PURE__ */ jsx(Text, { size: "xsmall", children: "T" })
227
+ background: "list-updated",
228
+ children: /* @__PURE__ */ jsx(Text, { size: "xsmall", color: "list-text-updated", children: "T" })
374
229
  }
375
230
  )
376
231
  }
@@ -399,8 +254,8 @@ const DefaultFooter = ({
399
254
  height: "100%",
400
255
  align: "center",
401
256
  justify: "center",
402
- background: { color: "light-2", opacity: 0.5 },
403
- children: /* @__PURE__ */ jsx(Text, { size: "xsmall", color: ENDED_FONT_COLOR, children: "T" })
257
+ background: "list-ended",
258
+ children: /* @__PURE__ */ jsx(Text, { size: "xsmall", color: "list-text-ended", children: "T" })
404
259
  }
405
260
  )
406
261
  }
@@ -429,8 +284,8 @@ const DefaultFooter = ({
429
284
  height: "100%",
430
285
  align: "center",
431
286
  justify: "center",
432
- background: { color: "light-2", opacity: 0.5 },
433
- children: /* @__PURE__ */ jsx(Text, { size: "xsmall", children: "T" })
287
+ background: "list-removed_from_list",
288
+ children: /* @__PURE__ */ jsx(Text, { size: "xsmall", color: "list-text-removed_from_list", children: "T" })
434
289
  }
435
290
  )
436
291
  }
@@ -472,7 +327,7 @@ const DefaultHeader = ({
472
327
  pad: { horizontal: "xsmall" },
473
328
  children: [
474
329
  /* @__PURE__ */ jsx(
475
- FulltextSearch,
330
+ FulltextSearchInput,
476
331
  {
477
332
  t,
478
333
  initialQuery: initialKwicQuery,
@@ -496,7 +351,7 @@ const SelectDefaultListCell = ({
496
351
  item,
497
352
  selectItem
498
353
  }) => {
499
- const background = colorRowAccordingToUpdateStatus(item);
354
+ const background = backgroundColorAccordingToStatus(item);
500
355
  return /* @__PURE__ */ jsx(
501
356
  StyledListCell,
502
357
  {
@@ -505,6 +360,7 @@ const SelectDefaultListCell = ({
505
360
  children: /* @__PURE__ */ jsx(
506
361
  CheckBox,
507
362
  {
363
+ id: item.id,
508
364
  checked: item.selected,
509
365
  onChange: (event) => selectItem(event.currentTarget.checked)
510
366
  }
@@ -523,7 +379,8 @@ const TitleDefaultListCell = ({
523
379
  } else {
524
380
  title = item.data["title"][titleLanguages[0]];
525
381
  }
526
- const background = colorRowAccordingToUpdateStatus(item);
382
+ const background = backgroundColorAccordingToStatus(item);
383
+ const text = textColorAccordingToStatus(item);
527
384
  return /* @__PURE__ */ jsx(
528
385
  StyledListCell,
529
386
  {
@@ -532,12 +389,12 @@ const TitleDefaultListCell = ({
532
389
  children: /* @__PURE__ */ jsx(
533
390
  Text,
534
391
  {
535
- color: colorForEndedItemsOrUndefined(item),
536
392
  weight: item.read === void 0 ? "bold" : "normal",
537
393
  truncate: "tip",
538
394
  children: /* @__PURE__ */ jsx(
539
395
  Link,
540
396
  {
397
+ color: text,
541
398
  onClick: item.data.navigateToWorkflow,
542
399
  children: title
543
400
  }
@@ -568,12 +425,15 @@ const ListOfWorkflows = ({
568
425
  showLoadingIndicator,
569
426
  useGuiSse,
570
427
  useWorkflowlistApi,
428
+ useTasklistApi,
571
429
  openTask,
572
430
  navigateToWorkflow,
573
431
  currentLanguage,
574
432
  defaultSort,
575
- defaultSortAscending,
433
+ defaultSortAscending = true,
576
434
  name,
435
+ minWidthOfColumns = "4rem",
436
+ minWidthOfAutoColumn = "20rem",
577
437
  columns,
578
438
  children,
579
439
  headerHeight = "3rem",
@@ -586,12 +446,13 @@ const ListOfWorkflows = ({
586
446
  excludeIdColumn = false,
587
447
  columnHeader,
588
448
  columnHeaderBackground = "dark-3",
589
- columnHeaderSeparator,
449
+ columnHeaderSeparator = "light-6",
590
450
  defaultSearchQueries = []
591
451
  }) => {
592
452
  const { isPhone, isTablet, isNotPhone } = useResponsiveScreen();
593
453
  const wakeupSseCallback = useRef(void 0);
594
454
  const workflowlistApi = useWorkflowlistApi(wakeupSseCallback);
455
+ const tasklistApi = useTasklistApi(wakeupSseCallback);
595
456
  const [refreshIndicator, setRefreshIndicator] = useState(/* @__PURE__ */ new Date());
596
457
  const [searchQueries, setSearchQueries] = useState(defaultSearchQueries);
597
458
  const updateListRef = useRef(void 0);
@@ -615,8 +476,16 @@ const ListOfWorkflows = ({
615
476
  )).map((userTask) => __spreadProps(__spreadValues({}, userTask), {
616
477
  open: () => openTask(userTask),
617
478
  navigateToWorkflow: () => {
618
- }
479
+ },
619
480
  // don't change view because workflow is already shown
481
+ assign: (userId) => {
482
+ tasklistApi.assignTask(userTask.id, userId, false);
483
+ },
484
+ unassign: (userId) => {
485
+ tasklistApi.assignTask(userTask.id, userId, true);
486
+ },
487
+ claim: () => tasklistApi.claimTask(userTask.id, false),
488
+ unclaim: () => tasklistApi.claimTask(userTask.id, true)
620
489
  }));
621
490
  });
622
491
  return __spreadProps(__spreadValues({}, workflow), {
@@ -627,13 +496,13 @@ const ListOfWorkflows = ({
627
496
  const workflows = useRef(void 0);
628
497
  const [numberOfWorkflows, setNumberOfWorkflows] = useState(-1);
629
498
  const [modulesOfWorkflows, setModulesOfWorkflows] = useState(void 0);
630
- const [languagesOfTitles, setLanguagesOfTitles] = useState([currentLanguage]);
631
499
  const [definitionsOfWorkflows, setDefinitionsOfWorkflows] = useState(void 0);
632
500
  useEffect(
633
501
  () => {
634
502
  const loadMetaInformation = () => __async(void 0, null, function* () {
635
- const result = yield loadWorkflows(
503
+ yield loadWorkflows(
636
504
  workflowlistApi,
505
+ numberOfWorkflows,
637
506
  setNumberOfWorkflows,
638
507
  modulesOfWorkflows,
639
508
  setModulesOfWorkflows,
@@ -643,17 +512,10 @@ const ListOfWorkflows = ({
643
512
  0,
644
513
  void 0,
645
514
  searchQueries,
646
- effectiveSort,
647
- sortAscending,
515
+ void 0,
516
+ true,
648
517
  mapToBcWorkflow
649
518
  );
650
- const titleLanguages = result.items.flatMap((workflow) => Object.keys(workflow.title)).reduce((allLanguages, titleLanguage) => {
651
- if (!allLanguages.includes(titleLanguage)) {
652
- allLanguages.push(titleLanguage);
653
- }
654
- return allLanguages;
655
- }, new Array(currentLanguage));
656
- setLanguagesOfTitles(titleLanguages);
657
519
  });
658
520
  if (workflows.current === void 0) {
659
521
  showLoadingIndicator(true);
@@ -662,7 +524,7 @@ const ListOfWorkflows = ({
662
524
  },
663
525
  // workflowlistApi is not part of dependency because it changes one time but this is irrelevant to the
664
526
  // purpose of preloading modules used by workflows
665
- [workflows, setNumberOfWorkflows, setModulesOfWorkflows, setDefinitionsOfWorkflows, showLoadingIndicator, refreshIndicator, setLanguagesOfTitles]
527
+ [workflows, setNumberOfWorkflows, setModulesOfWorkflows, setDefinitionsOfWorkflows, showLoadingIndicator, refreshIndicator]
666
528
  );
667
529
  const [columnsOfWorkflows, setColumnsOfWorkflows] = useState(void 0);
668
530
  const modules = useFederationModules(modulesOfWorkflows, "WorkflowList");
@@ -700,7 +562,8 @@ const ListOfWorkflows = ({
700
562
  totalColumns.title = {
701
563
  title: { [currentLanguage]: t("column_title") },
702
564
  path: "title",
703
- width: "",
565
+ type: "i18n",
566
+ width: AUTO_SIZE_COLUMN,
704
567
  priority: 0,
705
568
  show: true,
706
569
  sortable: true,
@@ -720,8 +583,8 @@ const ListOfWorkflows = ({
720
583
  const [anySelected, setAnySelected] = useState(false);
721
584
  const [refreshNecessary, setRefreshNecessary] = useState(false);
722
585
  const [effectiveSort, _setSort] = useState(defaultSort);
723
- const sort = (effectiveSort == null ? void 0 : effectiveSort.startsWith("title.")) ? "title" : effectiveSort;
724
- const [sortAscending, _setSortAscending] = useState(defaultSortAscending === void 0 ? true : defaultSortAscending);
586
+ const sort = sortWithoutColumnTypeSpecificAttributes(currentLanguage, effectiveSort);
587
+ const [sortAscending, _setSortAscending] = useState(defaultSortAscending);
725
588
  const refreshList = () => {
726
589
  workflows.current = void 0;
727
590
  setRefreshNecessary(false);
@@ -729,37 +592,40 @@ const ListOfWorkflows = ({
729
592
  setRefreshIndicator(/* @__PURE__ */ new Date());
730
593
  };
731
594
  const setSort = (column) => {
732
- if (column) {
733
- if (column.path === "title") {
734
- _setSort("title." + languagesOfTitles.join(",title."));
735
- } else {
736
- _setSort(column.path);
737
- }
595
+ let ascending;
596
+ if (!column) {
597
+ ascending = defaultSortAscending;
598
+ column = columnsOfWorkflows == null ? void 0 : columnsOfWorkflows.filter((c) => c.path === defaultSort).at(0);
738
599
  } else {
739
- _setSort(defaultSort);
600
+ ascending = true;
740
601
  }
741
- _setSortAscending(defaultSortAscending === void 0 ? true : defaultSortAscending);
602
+ _setSort(sortWithColumnTypeSpecificAttributes(currentLanguage, column));
603
+ _setSortAscending(ascending);
742
604
  refreshList();
743
605
  };
744
- const setSortAscending = (sortAscending2) => {
745
- _setSortAscending(sortAscending2);
606
+ const setSortAscending = (newSortAscending) => {
607
+ _setSortAscending(newSortAscending);
746
608
  refreshList();
747
609
  };
748
610
  const [columnWidthAdjustments, setColumnWidthAdjustments] = useState({});
749
- const getColumnSize = (column) => {
750
- 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;
751
- };
752
- const setColumnWidthAdjustment = (column, adjustment) => {
753
- if (column.width === "") {
754
- column.width = `${adjustment}px`;
755
- return;
611
+ const autoColumnWidth = useRef();
612
+ const getColumnSize = useCallback(
613
+ (column) => {
614
+ var _a;
615
+ 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;
616
+ },
617
+ [columnWidthAdjustments]
618
+ );
619
+ const setColumnWidthAdjustment = useCallback((column, adjustment) => {
620
+ if (autoColumnWidth.current && autoColumnWidth.current.column.width === AUTO_SIZE_COLUMN) {
621
+ autoColumnWidth.current.column.width = `${autoColumnWidth.current.width}px`;
756
622
  }
757
623
  const current = columnWidthAdjustments[column.path];
758
624
  if (current === adjustment)
759
625
  return;
760
626
  setColumnWidthAdjustments(__spreadProps(__spreadValues({}, columnWidthAdjustments), { [column.path]: adjustment }));
761
- };
762
- const selectAll = (select) => {
627
+ }, [columnWidthAdjustments, setColumnWidthAdjustments, autoColumnWidth]);
628
+ const selectAll = useCallback((select) => {
763
629
  refreshItemRef.current(
764
630
  workflows.current.reduce((allItemIds, item) => {
765
631
  item.selected = select;
@@ -771,8 +637,8 @@ const ListOfWorkflows = ({
771
637
  if (anySelected !== select) {
772
638
  setAnySelected(select);
773
639
  }
774
- };
775
- const selectItem = (item, select) => {
640
+ }, [refreshItemRef, workflows, setAllSelected, setAnySelected, anySelected]);
641
+ const selectItem = useCallback((item, select) => {
776
642
  item.selected = select;
777
643
  refreshItemRef.current([item.id]);
778
644
  const currentlyAllSelected = workflows.current.reduce((allSelected2, userTask) => allSelected2 && userTask.selected, true);
@@ -783,48 +649,70 @@ const ListOfWorkflows = ({
783
649
  if (anySelected !== currentlyAnySelected) {
784
650
  setAnySelected(currentlyAnySelected);
785
651
  }
786
- };
787
- const columnsOfList = columnsOfWorkflows === void 0 ? [] : columnsOfWorkflows.filter((column) => column.show).filter((column) => columns === void 0 || columns.includes(column.path)).map((column, columnIndex, allColumns) => ({
788
- property: column.path,
789
- size: getColumnSize(column),
790
- plain: true,
791
- verticalAlign: "top",
792
- header: /* @__PURE__ */ jsx(
793
- ListColumnHeader,
794
- {
795
- t,
796
- currentLanguage,
797
- nameOfList: name,
798
- columnHeader,
799
- hasColumnWidthAdjustment: columnWidthAdjustments[column.path] !== void 0,
800
- setColumnWidthAdjustment,
801
- sort: sort === column.path,
802
- setSort,
803
- sortAscending,
804
- setSortAscending,
805
- column,
806
- columnIndex,
807
- numberOfAllColumns: allColumns.length,
808
- allSelected,
809
- selectAll
810
- }
811
- ),
812
- render: (item) => /* @__PURE__ */ jsx(
813
- ListCell,
814
- {
815
- modulesAvailable: modules,
816
- column,
817
- currentLanguage,
818
- nameOfList: name,
819
- typeOfItem: TypeOfItem.WorkflowList,
820
- showUnreadAsBold: false,
821
- t,
822
- item,
823
- selectItem,
824
- defaultListCell: WorkflowDefaultListCell
825
- }
826
- )
827
- }));
652
+ }, [refreshItemRef, workflows, allSelected, anySelected, setAnySelected, setAllSelected]);
653
+ const columnsOfList = useMemo(
654
+ () => columnsOfWorkflows === void 0 ? [] : columnsOfWorkflows.filter((column) => column.show).filter((column) => columns === void 0 || columns.includes(column.path)).map((column, columnIndex, allColumns) => ({
655
+ property: column.path,
656
+ size: getColumnSize(column),
657
+ plain: true,
658
+ verticalAlign: "top",
659
+ header: /* @__PURE__ */ jsx(
660
+ ListColumnHeader,
661
+ {
662
+ t,
663
+ currentLanguage,
664
+ nameOfList: name,
665
+ columnHeader,
666
+ columnWidthAdjustment: columnWidthAdjustments[column.path],
667
+ setAutoColumnWidth: (column2, width) => autoColumnWidth.current = { column: column2, width },
668
+ setColumnWidthAdjustment,
669
+ sort: sort === column.path,
670
+ setSort,
671
+ isDefaultSort: column.path === defaultSort,
672
+ sortAscending,
673
+ setSortAscending,
674
+ defaultSortAscending,
675
+ column,
676
+ columnIndex,
677
+ numberOfAllColumns: allColumns.length,
678
+ allSelected,
679
+ selectAll
680
+ }
681
+ ),
682
+ render: (item) => /* @__PURE__ */ jsx(
683
+ ListCell,
684
+ {
685
+ modulesAvailable: modules,
686
+ column,
687
+ currentLanguage,
688
+ nameOfList: name,
689
+ typeOfItem: TypeOfItem.WorkflowList,
690
+ showUnreadAsBold: false,
691
+ t,
692
+ item,
693
+ selectItem,
694
+ defaultListCell: WorkflowDefaultListCell
695
+ }
696
+ )
697
+ })),
698
+ [
699
+ modules,
700
+ currentLanguage,
701
+ name,
702
+ columnsOfWorkflows,
703
+ setSort,
704
+ setSortAscending,
705
+ sortAscending,
706
+ defaultSortAscending,
707
+ selectItem,
708
+ selectAll,
709
+ allSelected,
710
+ getColumnSize,
711
+ columnWidthAdjustments,
712
+ defaultSort,
713
+ setColumnWidthAdjustment
714
+ ]
715
+ );
828
716
  const initialKwicQuery = (columnPath) => {
829
717
  const query = searchQueries.filter((query2) => query2.path === columnPath).map((query2) => query2.query);
830
718
  if (query.length === 0)
@@ -834,7 +722,7 @@ const ListOfWorkflows = ({
834
722
  const setKwic = (columnPath, value) => {
835
723
  const newSearchQueries = searchQueries.filter((query) => query.path !== columnPath);
836
724
  if (value !== void 0 && value.trim().length > 0) {
837
- newSearchQueries.push({ path: columnPath, query: value });
725
+ newSearchQueries.push({ path: columnPath, query: value, caseInsensitive: true });
838
726
  }
839
727
  setSearchQueries(newSearchQueries);
840
728
  refreshList();
@@ -901,7 +789,7 @@ const ListOfWorkflows = ({
901
789
  rowSeparator,
902
790
  applyBackgroundColor,
903
791
  showLoadingIndicator,
904
- minWidthOfAutoColumn: minWidthOfTitleColumn,
792
+ minWidthOfAutoColumn,
905
793
  showColumnHeaders,
906
794
  columnHeaderBackground,
907
795
  columnHeaderSeparator,
@@ -914,6 +802,7 @@ const ListOfWorkflows = ({
914
802
  // @ts-ignore
915
803
  loadWorkflows(
916
804
  workflowlistApi,
805
+ numberOfWorkflows,
917
806
  setNumberOfWorkflows,
918
807
  modulesOfWorkflows,
919
808
  setModulesOfWorkflows,
@@ -932,6 +821,7 @@ const ListOfWorkflows = ({
932
821
  // @ts-ignore
933
822
  reloadWorkflows(
934
823
  workflowlistApi,
824
+ numberOfWorkflows,
935
825
  setNumberOfWorkflows,
936
826
  modulesOfWorkflows,
937
827
  setModulesOfWorkflows,