@hortiview/shared-components 2.6.1 → 2.8.0
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/CHANGELOG.md +35 -0
- package/README.md +59 -19
- package/dist/components/DeleteModal/DeleteModal.js +5 -5
- package/dist/components/Filter/Filter.js +25 -24
- package/dist/components/GenericTable/GenericTable.js +3 -2
- package/dist/components/Modal/Modal.d.ts +5 -4
- package/dist/components/Modal/Modal.js +88 -86
- package/dist/components/ModulePadding/ModulePadding.js +3 -2
- package/dist/components/SafeForm/SafeForm.d.ts +11 -0
- package/dist/components/SafeForm/SafeForm.js +9 -0
- package/dist/components/SafeForm/SafeForm.test.d.ts +1 -0
- package/dist/components/SafeForm/SafeForm.test.js +91 -0
- package/dist/components/SearchBar/SearchBar.js +18 -17
- package/dist/main.d.ts +3 -1
- package/dist/main.js +74 -67
- package/dist/services/UtilService.d.ts +21 -0
- package/dist/services/UtilService.js +16 -12
- package/dist/services/services.test.js +70 -23
- package/dist/types/Time.d.ts +21 -0
- package/dist/types/Time.js +17 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,38 @@
|
|
|
1
|
+
## [2.8.0](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/compare/v2.7.0...v2.8.0) (2025-10-28)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
* add SafeForm component to prevent accidental submissions and update related components ([edcef25](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/edcef25688a9cde175feb1307639d742c020f4fe))
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
* allow onClick methods of submit buttons to be executed ([cc0f7df](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/cc0f7df87faf7647a336d1e07ba3d54630bcf24d))
|
|
10
|
+
* ensure button type is explicitly set in SearchBar component to avoid unindented submit ([1772631](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/17726319501bf5111dccb2bbb862e9968ee75aa7))
|
|
11
|
+
|
|
12
|
+
### Documentation
|
|
13
|
+
|
|
14
|
+
* update README to specify date and time formats from Time.ts ([a29a632](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/a29a632660dedf95241ab6c467cf95d1bafef385))
|
|
15
|
+
|
|
16
|
+
### Code Refactoring
|
|
17
|
+
|
|
18
|
+
* reorder SafeForm export in main.ts for faster lookup ([5935b7b](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/5935b7bebb4e970946d7f499c0b70db4f4b123c2))
|
|
19
|
+
|
|
20
|
+
## [2.7.0](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/compare/v2.6.1...v2.7.0) (2025-10-24)
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
* create getFormattedDateTime function ([2c0bee8](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/2c0bee8ab990f28cf4d9cbc198863ca411070b6c))
|
|
25
|
+
|
|
26
|
+
### Documentation
|
|
27
|
+
|
|
28
|
+
* mention using formats from Time.ts for consistency ([0026a3a](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/0026a3acb5422cfdda722b69020c9cbc1521ebd8))
|
|
29
|
+
* update README ([846bca1](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/846bca135f16d3f673ef1db3a8c37700371eb115))
|
|
30
|
+
|
|
31
|
+
### Code Refactoring
|
|
32
|
+
|
|
33
|
+
* add Date prop ([f962c7c](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/f962c7c106c66e0a55dcd7f49642233cf69344fe))
|
|
34
|
+
* create Time file and import/export date formats ([d7b6fd9](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/commit/d7b6fd974bf4634d8300426ece110881090e2653))
|
|
35
|
+
|
|
1
36
|
## [2.6.1](https://dev.azure.com/sdundc/HV%20Platform/_git/HortiView-Frontend-Shared/compare/v2.6.0...v2.6.1) (2025-10-02)
|
|
2
37
|
|
|
3
38
|
### Styles
|
package/README.md
CHANGED
|
@@ -54,6 +54,7 @@ Additionally the library provides form components using [react-hook-form](https:
|
|
|
54
54
|
1. [OfflineView](#offlineview)
|
|
55
55
|
1. [OnboardingBanner](#onboardingbanner)
|
|
56
56
|
1. [OverflowTooltip](#overflowtooltip)
|
|
57
|
+
1. [SafeForm](#safeform)
|
|
57
58
|
1. [ScrollBar](#scrollbar)
|
|
58
59
|
1. [SearchBar](#searchbar)
|
|
59
60
|
1. [Select](#select)
|
|
@@ -66,6 +67,7 @@ Additionally the library provides form components using [react-hook-form](https:
|
|
|
66
67
|
1. [capitalizeFirstLetters](#capitalizefirstletters)
|
|
67
68
|
1. [trimLeadingAndTrailingSpaces](#trimleadingandtrailingspaces)
|
|
68
69
|
1. [getNumberAsLocaleString](#getnumberaslocalestring)
|
|
70
|
+
1. [getFormattedDateTime](#getformatteddatetime)
|
|
69
71
|
|
|
70
72
|
## Available constants
|
|
71
73
|
|
|
@@ -357,14 +359,14 @@ const formMethods = useForm<{ check: boolean }>({
|
|
|
357
359
|
const { handleSubmit } = formMethods;
|
|
358
360
|
|
|
359
361
|
<FormProvider {...formMethods}>
|
|
360
|
-
<
|
|
362
|
+
<SafeForm onSubmit={handleSubmit(onSubmit)}>
|
|
361
363
|
<FormCheckBox<{ check: boolean }>
|
|
362
364
|
propertyName={`check`}
|
|
363
365
|
label={'My Checkbox'}
|
|
364
366
|
onChange={() => additionalOnChange()}
|
|
365
367
|
validate={validateFn}
|
|
366
368
|
/>
|
|
367
|
-
</
|
|
369
|
+
</SafeForm>
|
|
368
370
|
</FormProvider>;
|
|
369
371
|
```
|
|
370
372
|
|
|
@@ -383,13 +385,13 @@ const formMethods = useForm<{ birthday: string }>({
|
|
|
383
385
|
const { handleSubmit } = formMethods;
|
|
384
386
|
|
|
385
387
|
<FormProvider {...formMethods}>
|
|
386
|
-
<
|
|
388
|
+
<SafeForm onSubmit={handleSubmit(onSubmit)}>
|
|
387
389
|
<FormDatePicker<{ birthday: string }>
|
|
388
390
|
propertyName={'birthday'}
|
|
389
391
|
label={'user.date-of-birth'}
|
|
390
392
|
maxRangeYear={0}
|
|
391
393
|
/>
|
|
392
|
-
</
|
|
394
|
+
</SafeForm>
|
|
393
395
|
</FormProvider>;
|
|
394
396
|
```
|
|
395
397
|
|
|
@@ -408,7 +410,7 @@ const formMethods = useForm<{ birthday: string }>({
|
|
|
408
410
|
const { handleSubmit } = formMethods;
|
|
409
411
|
|
|
410
412
|
<FormProvider {...formMethods}>
|
|
411
|
-
<
|
|
413
|
+
<SafeForm onSubmit={handleSubmit(onSubmit)}>
|
|
412
414
|
<FormNumber<{ price: number }>
|
|
413
415
|
propertyName='price'
|
|
414
416
|
label='module.price'
|
|
@@ -419,7 +421,7 @@ const { handleSubmit } = formMethods;
|
|
|
419
421
|
allowLeadingZeros={false}
|
|
420
422
|
prefix=" €"
|
|
421
423
|
/>
|
|
422
|
-
</
|
|
424
|
+
</SafeForm>
|
|
423
425
|
</FormProvider>;
|
|
424
426
|
```
|
|
425
427
|
|
|
@@ -438,7 +440,7 @@ const formMethods = useForm<{ radioValue: string }>({
|
|
|
438
440
|
const { handleSubmit } = formMethods;
|
|
439
441
|
|
|
440
442
|
<FormProvider {...formMethods}>
|
|
441
|
-
<
|
|
443
|
+
<SafeForm onSubmit={handleSubmit(onSubmit)}>
|
|
442
444
|
<FormRadio<{ radioValue: string }>
|
|
443
445
|
propertyName='radioValue'
|
|
444
446
|
options={[
|
|
@@ -446,7 +448,7 @@ const { handleSubmit } = formMethods;
|
|
|
446
448
|
{ value: 'free', label: 'Free },
|
|
447
449
|
]}
|
|
448
450
|
/>
|
|
449
|
-
</
|
|
451
|
+
</SafeForm>
|
|
450
452
|
</FormProvider>;
|
|
451
453
|
```
|
|
452
454
|
|
|
@@ -478,7 +480,7 @@ const typeOptions = [
|
|
|
478
480
|
];
|
|
479
481
|
|
|
480
482
|
<FormProvider {...formMethods}>
|
|
481
|
-
<
|
|
483
|
+
<SafeForm onSubmit={handleSubmit(onSubmit)}>
|
|
482
484
|
<FormSelect<{ type: string }>
|
|
483
485
|
propertyName='type'
|
|
484
486
|
label='Type'
|
|
@@ -488,7 +490,7 @@ const typeOptions = [
|
|
|
488
490
|
requiredText='required'
|
|
489
491
|
required
|
|
490
492
|
/>
|
|
491
|
-
</
|
|
493
|
+
</SafeForm>
|
|
492
494
|
</FormProvider>;
|
|
493
495
|
```
|
|
494
496
|
|
|
@@ -507,9 +509,9 @@ const formMethods = useForm<{ range: string }>({
|
|
|
507
509
|
const { handleSubmit } = formMethods;
|
|
508
510
|
|
|
509
511
|
<FormProvider {...formMethods}>
|
|
510
|
-
<
|
|
512
|
+
<SafeForm onSubmit={handleSubmit(onSubmit)}>
|
|
511
513
|
<FormSlider<{ range: string }> propertyName='range' minValue={30} maxValue={90} step={30} />
|
|
512
|
-
</
|
|
514
|
+
</SafeForm>
|
|
513
515
|
</FormProvider>;
|
|
514
516
|
```
|
|
515
517
|
|
|
@@ -528,7 +530,7 @@ const formMethods = useForm<{ address: string }>({
|
|
|
528
530
|
const { handleSubmit } = formMethods;
|
|
529
531
|
|
|
530
532
|
<FormProvider {...formMethods}>
|
|
531
|
-
<
|
|
533
|
+
<SafeForm onSubmit={handleSubmit(onSubmit)}>
|
|
532
534
|
<FormText<{ address: string }>
|
|
533
535
|
maxLength={200}
|
|
534
536
|
label='address'
|
|
@@ -537,7 +539,7 @@ const { handleSubmit } = formMethods;
|
|
|
537
539
|
requiredText='required'
|
|
538
540
|
textarea
|
|
539
541
|
/>
|
|
540
|
-
</
|
|
542
|
+
</SafeForm>
|
|
541
543
|
</FormProvider>;
|
|
542
544
|
```
|
|
543
545
|
|
|
@@ -896,21 +898,20 @@ Shows an offline state with icon, title, and optional subtitle. Use `size` 'smal
|
|
|
896
898
|
```jsx
|
|
897
899
|
import { OfflineView } from '@hortiview/shared-components';
|
|
898
900
|
|
|
899
|
-
<OfflineView title=
|
|
901
|
+
<OfflineView title='Title' subtitle='Subtitle' />;
|
|
900
902
|
```
|
|
901
903
|
|
|
902
904
|
### OnboardingBanner
|
|
903
905
|
|
|
904
906
|
A responsive onboarding banner that adapts its layout for desktop and mobile.
|
|
905
907
|
|
|
906
|
-
- **Desktop:** Media content is displayed to the _right_ of the description
|
|
908
|
+
- **Desktop:** Media content is displayed to the _right_ of the description
|
|
907
909
|
- **Mobile:** Media content appears _above_ the description
|
|
908
910
|
|
|
909
911
|
```jsx
|
|
910
|
-
import {OnboardingBanner} from '@hortiview/shared-components';
|
|
911
|
-
|
|
912
|
-
<OnboardingBanner headline='Hello' />
|
|
912
|
+
import { OnboardingBanner } from '@hortiview/shared-components';
|
|
913
913
|
|
|
914
|
+
<OnboardingBanner headline='Hello' />;
|
|
914
915
|
```
|
|
915
916
|
|
|
916
917
|
### OverflowTooltip
|
|
@@ -929,6 +930,27 @@ const longText =
|
|
|
929
930
|
</OverflowTooltip>;
|
|
930
931
|
```
|
|
931
932
|
|
|
933
|
+
### SafeForm
|
|
934
|
+
|
|
935
|
+
A wrapper around a form that prevents accidental submission when pressing Enter in input fields.
|
|
936
|
+
|
|
937
|
+
- It handles the 'keydown' event and intercepts the Enter key press.
|
|
938
|
+
- If the focused element is a button, submit button or text area, it allows the default behavior.
|
|
939
|
+
- Otherwise, it prevents the default action to avoid unintended submissions.
|
|
940
|
+
|
|
941
|
+
```jsx
|
|
942
|
+
import { SafeForm } from '@hortiview/shared-components';
|
|
943
|
+
|
|
944
|
+
<FormProvider {...formMethods}>
|
|
945
|
+
<SafeForm onSubmit={handleSubmit(onSubmitForm)}>
|
|
946
|
+
<Group direction='vertical' primaryAlign='space-between'>
|
|
947
|
+
{children}
|
|
948
|
+
<Button type='submit'>Submit</Button>
|
|
949
|
+
</Group>
|
|
950
|
+
</SafeForm>
|
|
951
|
+
</FormProvider>;
|
|
952
|
+
```
|
|
953
|
+
|
|
932
954
|
### ScrollBar
|
|
933
955
|
|
|
934
956
|
Provides a scrollbar in hortiview styling. Add it a classname on your component.
|
|
@@ -1108,6 +1130,24 @@ const overlineTitle = `${getNumberAsLocaleString(userLocale, totalArea, 5)} ${t(
|
|
|
1108
1130
|
)}`;
|
|
1109
1131
|
```
|
|
1110
1132
|
|
|
1133
|
+
### getFormattedDateTime
|
|
1134
|
+
|
|
1135
|
+
Formats a date (string) with Intl.DateTimeFormat.
|
|
1136
|
+
If locale is a plain code ("en" | "es" | "tr"), it’s mapped to a regional tag ("en-US", "es-MX", "tr-TR").
|
|
1137
|
+
|
|
1138
|
+
For consistency, please use `DATE_FORMAT`, `TIME_FORMAT` and `DATE_TIME_FORMAT`.
|
|
1139
|
+
|
|
1140
|
+
```typescript
|
|
1141
|
+
import { DATE_FORMAT, TIME_FORMAT, DATE_TIME_FORMAT } from '@hortiview/shared-components';
|
|
1142
|
+
|
|
1143
|
+
getFormattedDateTime('2025-10-02T14:30:00Z', 'en-US', DATE_FORMAT);
|
|
1144
|
+
// -> 10/02/2025
|
|
1145
|
+
getFormattedDateTime('2025-10-02T14:30:00Z', 'es-MX', TIME_FORMAT);
|
|
1146
|
+
// -> 04:30 p.m.
|
|
1147
|
+
getFormattedDateTime('2025-10-02T14:30:00Z', 'tr-TR', DATE_TIME_FORMAT);
|
|
1148
|
+
// -> 02.10.2025 ÖS 04:30
|
|
1149
|
+
```
|
|
1150
|
+
|
|
1111
1151
|
## Available constants
|
|
1112
1152
|
|
|
1113
1153
|
### Languages and countries
|
|
@@ -23,9 +23,9 @@ import '../../assets/DeleteModal.css';const O = "_bulletPoint_bd412_1", j = "_mo
|
|
|
23
23
|
icon: g,
|
|
24
24
|
isIconCrossedOut: h,
|
|
25
25
|
impossibleDeleteHeader: v,
|
|
26
|
-
open:
|
|
26
|
+
open: _,
|
|
27
27
|
setOpen: d,
|
|
28
|
-
onDelete:
|
|
28
|
+
onDelete: y,
|
|
29
29
|
onCancel: C,
|
|
30
30
|
isDeletePossible: m = !0,
|
|
31
31
|
isOnline: u = !0,
|
|
@@ -39,16 +39,16 @@ import '../../assets/DeleteModal.css';const O = "_bulletPoint_bd412_1", j = "_mo
|
|
|
39
39
|
offlineViewProps: D,
|
|
40
40
|
className: `${t.modal}`,
|
|
41
41
|
modalSize: k ? "small" : "fullscreen",
|
|
42
|
-
open:
|
|
42
|
+
open: _,
|
|
43
43
|
title: r,
|
|
44
44
|
onClose: () => d(!1),
|
|
45
|
-
|
|
45
|
+
actionButton: /* @__PURE__ */ o(
|
|
46
46
|
p,
|
|
47
47
|
{
|
|
48
48
|
"data-testid": "delete-button",
|
|
49
49
|
variant: "danger",
|
|
50
50
|
label: e,
|
|
51
|
-
onClick:
|
|
51
|
+
onClick: y,
|
|
52
52
|
disabled: !m || !u
|
|
53
53
|
}
|
|
54
54
|
),
|
|
@@ -18,15 +18,16 @@ import "../../get-B8c-T4F8.js";
|
|
|
18
18
|
import "../../omit-1Eom1PmQ.js";
|
|
19
19
|
import "../../isArray-Dub1wGJM.js";
|
|
20
20
|
import "../../isString-BW9UHONv.js";
|
|
21
|
+
import "../../types/Time.js";
|
|
21
22
|
import '../../assets/Filter.css';const K = "_filterButton_qtl7a_1", T = "_relativeParent_qtl7a_6", V = "_filterBadge_qtl7a_10", E = "_dense_qtl7a_17", u = {
|
|
22
23
|
filterButton: K,
|
|
23
24
|
relativeParent: T,
|
|
24
25
|
filterBadge: V,
|
|
25
26
|
dense: E
|
|
26
|
-
},
|
|
27
|
+
}, ut = ({
|
|
27
28
|
clearFilterText: m,
|
|
28
29
|
closeCallback: s,
|
|
29
|
-
currentFilter:
|
|
30
|
+
currentFilter: r,
|
|
30
31
|
filterButtonAsIcon: d = !1,
|
|
31
32
|
filterButtonText: a,
|
|
32
33
|
filterModalTitle: t,
|
|
@@ -34,21 +35,21 @@ import '../../assets/Filter.css';const K = "_filterButton_qtl7a_1", T = "_relati
|
|
|
34
35
|
modalCancelButtonText: g,
|
|
35
36
|
modalConfirmButtonText: p,
|
|
36
37
|
useModal: o = !0,
|
|
37
|
-
selectAllLabel:
|
|
38
|
+
selectAllLabel: i,
|
|
38
39
|
"data-testid": w
|
|
39
40
|
}) => {
|
|
40
|
-
const { isDesktop: A } = k(), [$, B] = v(!1), [c,
|
|
41
|
-
B(!1), s(c),
|
|
41
|
+
const { isDesktop: A } = k(), [$, B] = v(!1), [c, C] = v(r), [q, x] = v(0), y = () => {
|
|
42
|
+
B(!1), s(c), x(
|
|
42
43
|
c.reduce((l, { filterValue: n }) => n === void 0 ? l : typeof n == "boolean" ? n ? l + 1 : l : Array.isArray(n) ? l + n.length : typeof n == "string" && n.length ? l + 1 : l, 0)
|
|
43
44
|
);
|
|
44
45
|
}, O = () => {
|
|
45
|
-
|
|
46
|
+
C([]), x(0);
|
|
46
47
|
}, S = (l) => {
|
|
47
48
|
const n = [
|
|
48
49
|
...c.filter((P) => P.id !== l.id),
|
|
49
50
|
l
|
|
50
51
|
];
|
|
51
|
-
|
|
52
|
+
C(n), o || s(n);
|
|
52
53
|
};
|
|
53
54
|
return o ? /* @__PURE__ */ b(D, { children: [
|
|
54
55
|
/* @__PURE__ */ e(
|
|
@@ -65,7 +66,7 @@ import '../../assets/Filter.css';const K = "_filterButton_qtl7a_1", T = "_relati
|
|
|
65
66
|
H,
|
|
66
67
|
{
|
|
67
68
|
open: $,
|
|
68
|
-
onClose:
|
|
69
|
+
onClose: y,
|
|
69
70
|
title: t,
|
|
70
71
|
modalSize: A ? "small" : "fullscreen",
|
|
71
72
|
headerActions: /* @__PURE__ */ e(h, { "data-testid": "filter-clear-button", variant: "text", onClick: O, children: m }),
|
|
@@ -78,12 +79,12 @@ import '../../assets/Filter.css';const K = "_filterButton_qtl7a_1", T = "_relati
|
|
|
78
79
|
children: g
|
|
79
80
|
}
|
|
80
81
|
),
|
|
81
|
-
|
|
82
|
-
children: /* @__PURE__ */ e(_, { direction: "vertical", "data-testid": "filter-map-filters", children: N(f, c, S,
|
|
82
|
+
actionButton: /* @__PURE__ */ e(h, { "data-testid": "filter-confirm-button", variant: "filled", onClick: y, children: p }),
|
|
83
|
+
children: /* @__PURE__ */ e(_, { direction: "vertical", "data-testid": "filter-map-filters", children: N(f, c, S, i) })
|
|
83
84
|
}
|
|
84
85
|
)
|
|
85
|
-
] }) : /* @__PURE__ */ e(_, { secondaryAlign: "center", fullWidth: !0, children: N(f, c, S,
|
|
86
|
-
}, N = (m, s,
|
|
86
|
+
] }) : /* @__PURE__ */ e(_, { secondaryAlign: "center", fullWidth: !0, children: N(f, c, S, i, !1) });
|
|
87
|
+
}, N = (m, s, r, d, a = !0) => m.map(({ id: t, title: f, availableOptions: g, icon: p, type: o }) => /* @__PURE__ */ b(_, { fullWidth: !0, secondaryAlign: "center", "data-testid": `filter-${o}-group-${t}`, children: [
|
|
87
88
|
p ? /* @__PURE__ */ e(z, { icon: p, iconSize: "medium" }) : null,
|
|
88
89
|
o === "select" && /* @__PURE__ */ e(
|
|
89
90
|
I,
|
|
@@ -97,8 +98,8 @@ import '../../assets/Filter.css';const K = "_filterButton_qtl7a_1", T = "_relati
|
|
|
97
98
|
multiSelect: !0,
|
|
98
99
|
textKey: "text",
|
|
99
100
|
valueKey: "id",
|
|
100
|
-
value: s.find((
|
|
101
|
-
onChange: (
|
|
101
|
+
value: s.find((i) => i.id === t)?.filterValue ?? [],
|
|
102
|
+
onChange: (i) => r({ id: t, type: o, filterValue: i }),
|
|
102
103
|
hoisted: !0,
|
|
103
104
|
menuMaxHeight: "300px",
|
|
104
105
|
disabled: t === "location",
|
|
@@ -113,8 +114,8 @@ import '../../assets/Filter.css';const K = "_filterButton_qtl7a_1", T = "_relati
|
|
|
113
114
|
{
|
|
114
115
|
"data-testid": `filter-switch-${t}`,
|
|
115
116
|
label: f,
|
|
116
|
-
onChange: (
|
|
117
|
-
checked: !!s.find((
|
|
117
|
+
onChange: (i) => r({ id: t, type: o, filterValue: i }),
|
|
118
|
+
checked: !!s.find((i) => i.id === t)?.filterValue
|
|
118
119
|
}
|
|
119
120
|
),
|
|
120
121
|
o === "search" && /* @__PURE__ */ e(
|
|
@@ -122,14 +123,14 @@ import '../../assets/Filter.css';const K = "_filterButton_qtl7a_1", T = "_relati
|
|
|
122
123
|
{
|
|
123
124
|
"data-testid": `filter-search-${t}`,
|
|
124
125
|
placeholder: f,
|
|
125
|
-
searchTerm: s.find((
|
|
126
|
-
setSearchTerm: (
|
|
126
|
+
searchTerm: s.find((i) => i.id === t)?.filterValue,
|
|
127
|
+
setSearchTerm: (i) => r({ id: t, type: o, filterValue: i })
|
|
127
128
|
}
|
|
128
129
|
)
|
|
129
130
|
] }, t)), J = ({
|
|
130
131
|
filterButtonText: m,
|
|
131
132
|
filterButtonAsIcon: s,
|
|
132
|
-
count:
|
|
133
|
+
count: r,
|
|
133
134
|
"data-testid": d,
|
|
134
135
|
onClick: a
|
|
135
136
|
}) => {
|
|
@@ -140,10 +141,10 @@ import '../../assets/Filter.css';const K = "_filterButton_qtl7a_1", T = "_relati
|
|
|
140
141
|
"data-testid": d ?? "filter-icon-button",
|
|
141
142
|
icon: "filter_list_alt",
|
|
142
143
|
onClick: a,
|
|
143
|
-
badge:
|
|
144
|
+
badge: r !== 0 && /* @__PURE__ */ e(
|
|
144
145
|
F,
|
|
145
146
|
{
|
|
146
|
-
counter:
|
|
147
|
+
counter: r,
|
|
147
148
|
className: u.filterBadge,
|
|
148
149
|
themeColor: "secondary",
|
|
149
150
|
"data-testid": "filter-badge"
|
|
@@ -170,10 +171,10 @@ import '../../assets/Filter.css';const K = "_filterButton_qtl7a_1", T = "_relati
|
|
|
170
171
|
children: m
|
|
171
172
|
}
|
|
172
173
|
),
|
|
173
|
-
|
|
174
|
+
r !== 0 && /* @__PURE__ */ e(
|
|
174
175
|
F,
|
|
175
176
|
{
|
|
176
|
-
counter:
|
|
177
|
+
counter: r,
|
|
177
178
|
className: u.filterBadge,
|
|
178
179
|
themeColor: "secondary",
|
|
179
180
|
"data-testid": "filter-badge"
|
|
@@ -184,5 +185,5 @@ import '../../assets/Filter.css';const K = "_filterButton_qtl7a_1", T = "_relati
|
|
|
184
185
|
);
|
|
185
186
|
};
|
|
186
187
|
export {
|
|
187
|
-
|
|
188
|
+
ut as Filter
|
|
188
189
|
};
|
|
@@ -29,6 +29,7 @@ import "react-hook-form";
|
|
|
29
29
|
import "../../get-B8c-T4F8.js";
|
|
30
30
|
import "../../isArray-Dub1wGJM.js";
|
|
31
31
|
import "../../isString-BW9UHONv.js";
|
|
32
|
+
import "../../types/Time.js";
|
|
32
33
|
import { useGenerateColumns as yl, useGenerateTableData as bl } from "./GenericTableService.js";
|
|
33
34
|
import { GenericCardList as wl } from "./Mobile/GenericCardList.js";
|
|
34
35
|
import '../../assets/GenericTable.css';function Rl(r, o) {
|
|
@@ -10407,7 +10408,7 @@ const cd = "_topBar_1tmb3_1", fd = "_filterBar_1tmb3_5", pd = "_start_1tmb3_10",
|
|
|
10407
10408
|
elevation: vd,
|
|
10408
10409
|
table: hd,
|
|
10409
10410
|
noBorder: md
|
|
10410
|
-
},
|
|
10411
|
+
}, Qd = ({
|
|
10411
10412
|
data: r = [],
|
|
10412
10413
|
hiddenColumns: o = [],
|
|
10413
10414
|
order: e = [],
|
|
@@ -10527,5 +10528,5 @@ const cd = "_topBar_1tmb3_1", fd = "_filterBar_1tmb3_5", pd = "_start_1tmb3_10",
|
|
|
10527
10528
|
);
|
|
10528
10529
|
};
|
|
10529
10530
|
export {
|
|
10530
|
-
|
|
10531
|
+
Qd as GenericTable
|
|
10531
10532
|
};
|
|
@@ -2,7 +2,7 @@ import { ModalProps as ElementModalProps } from '@element-public/react-modal';
|
|
|
2
2
|
import { AvailableCustomIcons } from '../../enums/AvailableCustomIcons';
|
|
3
3
|
import { OfflineViewProps } from '../OfflineView/OfflineView';
|
|
4
4
|
|
|
5
|
-
type ModalProps = ElementModalProps & React.HTMLProps<HTMLElement> & React.DOMAttributes<HTMLElement> & {
|
|
5
|
+
type ModalProps = Omit<ElementModalProps, 'primaryButton'> & React.HTMLProps<HTMLElement> & React.DOMAttributes<HTMLElement> & {
|
|
6
6
|
leadingIcon?: keyof typeof AvailableCustomIcons | string;
|
|
7
7
|
isOnline?: boolean;
|
|
8
8
|
offlineViewProps?: Partial<OfflineViewProps>;
|
|
@@ -13,12 +13,13 @@ type ModalProps = ElementModalProps & React.HTMLProps<HTMLElement> & React.DOMAt
|
|
|
13
13
|
* @param onClose - The function to call when the modal is closed - Should be passed to the modal.
|
|
14
14
|
* @param title - The title of the modal.
|
|
15
15
|
* @param headerActions - The actions to display in the header of the modal.
|
|
16
|
-
* @param
|
|
16
|
+
* @param actionButton - Button for the primary action of the modal - primaryButton is omitted from {@link ModalProps} since it triggers form submission on Enter key press.
|
|
17
|
+
* @param hideCloseIcon - If true, the close icon will be hidden. Default true.
|
|
17
18
|
* @param leadingIcon - Iconify icon string (material icons and custom icons)
|
|
18
|
-
* @param - Other element props to pass to the modal.
|
|
19
19
|
* @param isOnline - Whether the user is online; shows OfflineView when false.
|
|
20
20
|
* @param offlineViewProps - Props forwarded to OfflineView when offline.
|
|
21
|
+
* @param ...props - Other element props to pass to the modal.
|
|
21
22
|
* @returns
|
|
22
23
|
*/
|
|
23
|
-
export declare const Modal: ({ onClose, title, headerActions, hideCloseIcon, leadingIcon, isOnline, offlineViewProps, children, ...props }: ModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export declare const Modal: ({ onClose, title, headerActions, actionButton, hideCloseIcon, leadingIcon, isOnline, offlineViewProps, children, ...props }: ModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
25
|
export {};
|