@vaadin/hilla-react-crud 24.7.0-alpha9 → 24.8.0-alpha1

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 (151) hide show
  1. package/autocrud-dialog.d.ts +0 -1
  2. package/autocrud-dialog.js +9 -23
  3. package/autocrud-dialog.js.map +1 -7
  4. package/autocrud-feature.d.ts +0 -1
  5. package/autocrud-feature.js +5 -8
  6. package/autocrud-feature.js.map +1 -7
  7. package/autocrud.d.ts +2 -64
  8. package/autocrud.js +43 -92
  9. package/autocrud.js.map +1 -7
  10. package/autocrud.obj.js +1 -6
  11. package/autoform-feature.d.ts +0 -1
  12. package/autoform-feature.js +5 -8
  13. package/autoform-feature.js.map +1 -7
  14. package/autoform-field.d.ts +0 -90
  15. package/autoform-field.js +87 -95
  16. package/autoform-field.js.map +1 -7
  17. package/autoform.d.ts +0 -190
  18. package/autoform.js +126 -184
  19. package/autoform.js.map +1 -7
  20. package/autoform.obj.js +1 -6
  21. package/autogrid-column-context.d.ts +1 -2
  22. package/autogrid-column-context.js +4 -8
  23. package/autogrid-column-context.js.map +1 -7
  24. package/autogrid-columns.d.ts +0 -1
  25. package/autogrid-columns.js +83 -99
  26. package/autogrid-columns.js.map +1 -7
  27. package/autogrid-feature.d.ts +0 -1
  28. package/autogrid-feature.js +5 -8
  29. package/autogrid-feature.js.map +1 -7
  30. package/autogrid-renderers.d.ts +0 -1
  31. package/autogrid-renderers.js +71 -80
  32. package/autogrid-renderers.js.map +1 -7
  33. package/autogrid.d.ts +1 -103
  34. package/autogrid.js +176 -234
  35. package/autogrid.js.map +1 -7
  36. package/autogrid.obj.js +1 -6
  37. package/crud.d.ts +7 -10
  38. package/data-provider.d.ts +37 -6
  39. package/data-provider.js +186 -121
  40. package/data-provider.js.map +1 -7
  41. package/header-filter.d.ts +1 -30
  42. package/header-filter.js +137 -244
  43. package/header-filter.js.map +1 -7
  44. package/header-sorter.d.ts +0 -1
  45. package/header-sorter.js +16 -27
  46. package/header-sorter.js.map +1 -7
  47. package/i18n.d.ts +0 -1
  48. package/i18n.js +2 -5
  49. package/i18n.js.map +1 -7
  50. package/index.d.ts +1 -2
  51. package/index.js +12 -16
  52. package/index.js.map +1 -7
  53. package/locale.d.ts +0 -1
  54. package/locale.js +100 -107
  55. package/locale.js.map +1 -7
  56. package/media-query.d.ts +0 -1
  57. package/media-query.js +12 -15
  58. package/media-query.js.map +1 -7
  59. package/model-info.d.ts +0 -1
  60. package/model-info.js +126 -127
  61. package/model-info.js.map +1 -7
  62. package/package.json +9 -33
  63. package/types/com/vaadin/hilla/crud/filter/AndFilter.d.ts +3 -4
  64. package/types/com/vaadin/hilla/crud/filter/AndFilterModel.d.ts +0 -1
  65. package/types/com/vaadin/hilla/crud/filter/AndFilterModel.js +6 -9
  66. package/types/com/vaadin/hilla/crud/filter/AndFilterModel.js.map +1 -7
  67. package/types/com/vaadin/hilla/crud/filter/Filter.d.ts +1 -2
  68. package/types/com/vaadin/hilla/crud/filter/FilterModel.d.ts +0 -1
  69. package/types/com/vaadin/hilla/crud/filter/FilterModel.js +3 -6
  70. package/types/com/vaadin/hilla/crud/filter/FilterModel.js.map +1 -7
  71. package/types/com/vaadin/hilla/crud/filter/FilterUnion.d.ts +4 -2
  72. package/types/com/vaadin/hilla/crud/filter/OrFilter.d.ts +3 -4
  73. package/types/com/vaadin/hilla/crud/filter/OrFilterModel.d.ts +0 -1
  74. package/types/com/vaadin/hilla/crud/filter/OrFilterModel.js +6 -9
  75. package/types/com/vaadin/hilla/crud/filter/OrFilterModel.js.map +1 -7
  76. package/types/com/vaadin/hilla/crud/filter/PropertyStringFilter/Matcher.d.ts +0 -1
  77. package/types/com/vaadin/hilla/crud/filter/PropertyStringFilter/Matcher.js +9 -12
  78. package/types/com/vaadin/hilla/crud/filter/PropertyStringFilter/Matcher.js.map +1 -7
  79. package/types/com/vaadin/hilla/crud/filter/PropertyStringFilter/MatcherModel.d.ts +0 -1
  80. package/types/com/vaadin/hilla/crud/filter/PropertyStringFilter/MatcherModel.js +4 -7
  81. package/types/com/vaadin/hilla/crud/filter/PropertyStringFilter/MatcherModel.js.map +1 -7
  82. package/types/com/vaadin/hilla/crud/filter/PropertyStringFilter.d.ts +4 -5
  83. package/types/com/vaadin/hilla/crud/filter/PropertyStringFilterModel.d.ts +0 -1
  84. package/types/com/vaadin/hilla/crud/filter/PropertyStringFilterModel.js +12 -15
  85. package/types/com/vaadin/hilla/crud/filter/PropertyStringFilterModel.js.map +1 -7
  86. package/types/com/vaadin/hilla/mappedtypes/Order.d.ts +3 -4
  87. package/types/com/vaadin/hilla/mappedtypes/OrderModel.d.ts +0 -1
  88. package/types/com/vaadin/hilla/mappedtypes/OrderModel.js +15 -18
  89. package/types/com/vaadin/hilla/mappedtypes/OrderModel.js.map +1 -7
  90. package/types/com/vaadin/hilla/mappedtypes/Pageable.d.ts +1 -2
  91. package/types/com/vaadin/hilla/mappedtypes/PageableModel.d.ts +0 -1
  92. package/types/com/vaadin/hilla/mappedtypes/PageableModel.js +12 -15
  93. package/types/com/vaadin/hilla/mappedtypes/PageableModel.js.map +1 -7
  94. package/types/com/vaadin/hilla/mappedtypes/Sort.d.ts +1 -2
  95. package/types/com/vaadin/hilla/mappedtypes/SortModel.d.ts +0 -1
  96. package/types/com/vaadin/hilla/mappedtypes/SortModel.js +6 -9
  97. package/types/com/vaadin/hilla/mappedtypes/SortModel.js.map +1 -7
  98. package/types/org/springframework/data/domain/Sort/Direction.d.ts +0 -1
  99. package/types/org/springframework/data/domain/Sort/Direction.js +7 -10
  100. package/types/org/springframework/data/domain/Sort/Direction.js.map +1 -7
  101. package/types/org/springframework/data/domain/Sort/DirectionModel.d.ts +0 -1
  102. package/types/org/springframework/data/domain/Sort/DirectionModel.js +4 -7
  103. package/types/org/springframework/data/domain/Sort/DirectionModel.js.map +1 -7
  104. package/types/org/springframework/data/domain/Sort/NullHandling.d.ts +0 -1
  105. package/types/org/springframework/data/domain/Sort/NullHandling.js +8 -11
  106. package/types/org/springframework/data/domain/Sort/NullHandling.js.map +1 -7
  107. package/types/org/springframework/data/domain/Sort/NullHandlingModel.d.ts +0 -1
  108. package/types/org/springframework/data/domain/Sort/NullHandlingModel.js +4 -7
  109. package/types/org/springframework/data/domain/Sort/NullHandlingModel.js.map +1 -7
  110. package/types.d.ts +6 -9
  111. package/types.js +2 -0
  112. package/types.js.map +1 -0
  113. package/util.d.ts +1 -2
  114. package/util.js +42 -47
  115. package/util.js.map +1 -7
  116. package/autocrud-dialog.d.ts.map +0 -1
  117. package/autocrud-feature.d.ts.map +0 -1
  118. package/autocrud.d.ts.map +0 -1
  119. package/autocrud.obj.js.map +0 -7
  120. package/autoform-feature.d.ts.map +0 -1
  121. package/autoform-field.d.ts.map +0 -1
  122. package/autoform.d.ts.map +0 -1
  123. package/autoform.obj.js.map +0 -7
  124. package/autogrid-column-context.d.ts.map +0 -1
  125. package/autogrid-columns.d.ts.map +0 -1
  126. package/autogrid-feature.d.ts.map +0 -1
  127. package/autogrid-renderers.d.ts.map +0 -1
  128. package/autogrid.d.ts.map +0 -1
  129. package/autogrid.obj.js.map +0 -7
  130. package/data-provider.d.ts.map +0 -1
  131. package/header-filter.d.ts.map +0 -1
  132. package/header-sorter.d.ts.map +0 -1
  133. package/i18n.d.ts.map +0 -1
  134. package/index.d.ts.map +0 -1
  135. package/locale.d.ts.map +0 -1
  136. package/media-query.d.ts.map +0 -1
  137. package/model-info.d.ts.map +0 -1
  138. package/types/com/vaadin/hilla/crud/filter/AndFilterModel.d.ts.map +0 -1
  139. package/types/com/vaadin/hilla/crud/filter/FilterModel.d.ts.map +0 -1
  140. package/types/com/vaadin/hilla/crud/filter/OrFilterModel.d.ts.map +0 -1
  141. package/types/com/vaadin/hilla/crud/filter/PropertyStringFilter/Matcher.d.ts.map +0 -1
  142. package/types/com/vaadin/hilla/crud/filter/PropertyStringFilter/MatcherModel.d.ts.map +0 -1
  143. package/types/com/vaadin/hilla/crud/filter/PropertyStringFilterModel.d.ts.map +0 -1
  144. package/types/com/vaadin/hilla/mappedtypes/OrderModel.d.ts.map +0 -1
  145. package/types/com/vaadin/hilla/mappedtypes/PageableModel.d.ts.map +0 -1
  146. package/types/com/vaadin/hilla/mappedtypes/SortModel.d.ts.map +0 -1
  147. package/types/org/springframework/data/domain/Sort/Direction.d.ts.map +0 -1
  148. package/types/org/springframework/data/domain/Sort/DirectionModel.d.ts.map +0 -1
  149. package/types/org/springframework/data/domain/Sort/NullHandling.d.ts.map +0 -1
  150. package/types/org/springframework/data/domain/Sort/NullHandlingModel.d.ts.map +0 -1
  151. package/util.d.ts.map +0 -1
package/header-filter.js CHANGED
@@ -1,258 +1,151 @@
1
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- import { _enum } from "@vaadin/hilla-lit-form";
3
- import { DatePicker } from "@vaadin/react-components/DatePicker.js";
4
- import { Item } from "@vaadin/react-components/Item.js";
5
- import { ListBox } from "@vaadin/react-components/ListBox.js";
6
- import { NumberField } from "@vaadin/react-components/NumberField.js";
7
- import { Select } from "@vaadin/react-components/Select.js";
8
- import { TextField } from "@vaadin/react-components/TextField.js";
9
- import { TimePicker } from "@vaadin/react-components/TimePicker.js";
10
- import {
11
- useContext,
12
- useEffect,
13
- useRef,
14
- useState
15
- } from "react";
16
- import { ColumnContext, CustomColumnContext } from "./autogrid-column-context.js";
17
- import { useDatePickerI18n } from "./locale.js";
18
- import Matcher from "./types/com/vaadin/hilla/crud/filter/PropertyStringFilter/Matcher.js";
19
- import { convertToTitleCase } from "./util";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { _enum } from '@vaadin/hilla-lit-form';
3
+ import { DatePicker } from '@vaadin/react-components/DatePicker.js';
4
+ import { Item } from '@vaadin/react-components/Item.js';
5
+ import { ListBox } from '@vaadin/react-components/ListBox.js';
6
+ import { NumberField } from '@vaadin/react-components/NumberField.js';
7
+ import { Select } from '@vaadin/react-components/Select.js';
8
+ import { TextField } from '@vaadin/react-components/TextField.js';
9
+ import { TimePicker } from '@vaadin/react-components/TimePicker.js';
10
+ import { useContext, useEffect, useRef, useState, } from 'react';
11
+ import { ColumnContext, CustomColumnContext } from './autogrid-column-context.js';
12
+ import { useDatePickerI18n } from './locale.js';
13
+ import Matcher from './types/com/vaadin/hilla/crud/filter/PropertyStringFilter/Matcher.js';
14
+ import { convertToTitleCase } from './util';
20
15
  function useFilterState(initialMatcher) {
21
- const context = useContext(ColumnContext);
22
- const [matcher, setMatcher] = useState(initialMatcher);
23
- const [filterValue, setFilterValue] = useState("");
24
- function updateFilter(newMatcher, newFilterValue) {
25
- setFilterValue(newFilterValue);
26
- setMatcher(newMatcher);
27
- const filter = {
28
- propertyId: context.propertyInfo.name,
29
- filterValue: newFilterValue,
30
- matcher: newMatcher,
31
- "@type": "propertyString"
32
- };
33
- context.setColumnFilter(filter, context.filterKey);
34
- }
35
- return { matcher, filterValue, updateFilter };
16
+ const context = useContext(ColumnContext);
17
+ const [matcher, setMatcher] = useState(initialMatcher);
18
+ const [filterValue, setFilterValue] = useState('');
19
+ function updateFilter(newMatcher, newFilterValue) {
20
+ setFilterValue(newFilterValue);
21
+ setMatcher(newMatcher);
22
+ const filter = {
23
+ propertyId: context.propertyInfo.name,
24
+ filterValue: newFilterValue,
25
+ matcher: newMatcher,
26
+ '@type': 'propertyString',
27
+ };
28
+ context.setColumnFilter(filter, context.filterKey);
29
+ }
30
+ return { matcher, filterValue, updateFilter };
36
31
  }
37
32
  function useSelectInitWorkaround(selectRef) {
38
- useEffect(() => {
39
- setTimeout(() => {
40
- if (selectRef.current) {
41
- selectRef.current.requestContentUpdate();
42
- }
43
- }, 1);
44
- }, []);
33
+ useEffect(() => {
34
+ setTimeout(() => {
35
+ if (selectRef.current) {
36
+ selectRef.current.requestContentUpdate();
37
+ }
38
+ }, 1);
39
+ }, []);
45
40
  }
46
41
  function ComparationSelection({ onMatcherChanged, value, isDateTimeType }) {
47
- const select = useRef(null);
48
- useSelectInitWorkaround(select);
49
- return /* @__PURE__ */ jsx(
50
- Select,
51
- {
52
- theme: "small",
53
- className: "auto-grid-comparation-selection",
54
- ref: select,
55
- value,
56
- onValueChanged: ({ detail }) => {
57
- onMatcherChanged(detail.value);
58
- },
59
- renderer: () => /* @__PURE__ */ jsxs(ListBox, { children: [
60
- /* @__PURE__ */ jsx(Item, { value: Matcher.GREATER_THAN, ...{ label: ">" }, children: isDateTimeType ? "> After" : "> Greater than" }),
61
- /* @__PURE__ */ jsx(Item, { value: Matcher.LESS_THAN, ...{ label: "<" }, children: isDateTimeType ? "< Before" : "< Less than" }),
62
- /* @__PURE__ */ jsx(Item, { value: Matcher.EQUALS, ...{ label: "=" }, children: "= Equals" })
63
- ] })
64
- }
65
- );
42
+ const select = useRef(null);
43
+ useSelectInitWorkaround(select);
44
+ return (_jsx(Select, { theme: "small", className: "auto-grid-comparation-selection", ref: select, value: value, onValueChanged: ({ detail }) => {
45
+ onMatcherChanged(detail.value);
46
+ }, renderer: () => (_jsxs(ListBox, { children: [_jsx(Item, { value: Matcher.GREATER_THAN, label: '>', children: isDateTimeType ? '> After' : '> Greater than' }), _jsx(Item, { value: Matcher.LESS_THAN, label: '<', children: isDateTimeType ? '< Before' : '< Less than' }), _jsx(Item, { value: Matcher.EQUALS, label: '=', children: "= Equals" })] })) }));
66
47
  }
67
- function StringHeaderFilter() {
68
- const context = useContext(ColumnContext);
69
- const { filterPlaceholder, filterDebounceTime, filterMinLength } = context.customColumnOptions ?? {};
70
- const { updateFilter } = useFilterState(Matcher.CONTAINS);
71
- const [inputValue, setInputValue] = useState("");
72
- useEffect(() => {
73
- if (filterMinLength && inputValue && inputValue.length < filterMinLength) {
74
- updateFilter(Matcher.CONTAINS, "");
75
- return () => {
76
- };
77
- }
78
- const delayInputTimeoutId = setTimeout(() => {
79
- updateFilter(Matcher.CONTAINS, inputValue);
80
- }, filterDebounceTime ?? 200);
81
- return () => clearTimeout(delayInputTimeoutId);
82
- }, [inputValue]);
83
- return /* @__PURE__ */ jsx("div", { className: "auto-grid-string-filter", children: /* @__PURE__ */ jsx(
84
- TextField,
85
- {
86
- theme: "small",
87
- placeholder: filterPlaceholder ?? "Filter...",
88
- onInput: (e) => {
89
- const fieldValue = e.target.value;
90
- setInputValue(fieldValue);
91
- }
92
- }
93
- ) });
94
- }
95
- function NumberHeaderFilter() {
96
- const context = useContext(ColumnContext);
97
- const { filterPlaceholder, filterDebounceTime } = context.customColumnOptions ?? {};
98
- const [inputValue, setInputValue] = useState("");
99
- const { matcher, filterValue, updateFilter } = useFilterState(Matcher.GREATER_THAN);
100
- const select = useRef(null);
101
- useSelectInitWorkaround(select);
102
- useEffect(() => {
103
- const delayInputTimeoutId = setTimeout(() => {
104
- updateFilter(matcher, inputValue);
105
- }, filterDebounceTime ?? 200);
106
- return () => clearTimeout(delayInputTimeoutId);
107
- }, [inputValue]);
108
- return /* @__PURE__ */ jsxs("div", { className: "auto-grid-number-filter", children: [
109
- /* @__PURE__ */ jsx(ComparationSelection, { value: matcher, onMatcherChanged: (m) => updateFilter(m, filterValue) }),
110
- /* @__PURE__ */ jsx(
111
- NumberField,
112
- {
113
- theme: "small",
114
- placeholder: filterPlaceholder ?? "Filter...",
115
- onInput: (e) => {
116
- const fieldValue = e.target.value;
117
- setInputValue(fieldValue);
48
+ export function StringHeaderFilter() {
49
+ const context = useContext(ColumnContext);
50
+ const { filterPlaceholder, filterDebounceTime, filterMinLength } = context.customColumnOptions ?? {};
51
+ const { updateFilter } = useFilterState(Matcher.CONTAINS);
52
+ const [inputValue, setInputValue] = useState('');
53
+ useEffect(() => {
54
+ if (filterMinLength && inputValue && inputValue.length < filterMinLength) {
55
+ updateFilter(Matcher.CONTAINS, '');
56
+ return () => { };
118
57
  }
119
- }
120
- )
121
- ] });
122
- }
123
- function EnumHeaderFilter() {
124
- const { filterValue, updateFilter } = useFilterState(Matcher.EQUALS);
125
- const context = useContext(ColumnContext);
126
- const model = context.propertyInfo.model;
127
- const options = [
128
- {
129
- value: "",
130
- label: ""
131
- },
132
- ...Object.keys(model[_enum]).map((value) => ({
133
- label: convertToTitleCase(value),
134
- value
135
- }))
136
- ];
137
- return /* @__PURE__ */ jsx("div", { className: "auto-grid-enum-filter", children: /* @__PURE__ */ jsx(
138
- Select,
139
- {
140
- theme: "small",
141
- items: options,
142
- value: filterValue,
143
- onValueChanged: (e) => {
144
- const newFilterValue = e.detail.value;
145
- updateFilter(Matcher.EQUALS, newFilterValue);
146
- }
147
- }
148
- ) });
58
+ const delayInputTimeoutId = setTimeout(() => {
59
+ updateFilter(Matcher.CONTAINS, inputValue);
60
+ }, filterDebounceTime ?? 200);
61
+ return () => clearTimeout(delayInputTimeoutId);
62
+ }, [inputValue]);
63
+ return (_jsx("div", { className: "auto-grid-string-filter", children: _jsx(TextField, { theme: "small", placeholder: filterPlaceholder ?? 'Filter...', onInput: (e) => {
64
+ const fieldValue = e.target.value;
65
+ setInputValue(fieldValue);
66
+ } }) }));
149
67
  }
150
- function BooleanHeaderFilter() {
151
- const { filterValue, updateFilter } = useFilterState(Matcher.EQUALS);
152
- const select = useRef(null);
153
- useSelectInitWorkaround(select);
154
- return /* @__PURE__ */ jsx("div", { className: "auto-grid-boolean-filter", children: /* @__PURE__ */ jsx(
155
- Select,
156
- {
157
- theme: "small",
158
- ref: select,
159
- onValueChanged: (e) => {
160
- const newFilterValue = e.detail.value;
161
- updateFilter(Matcher.EQUALS, newFilterValue);
162
- },
163
- renderer: () => /* @__PURE__ */ jsxs(ListBox, { children: [
164
- /* @__PURE__ */ jsx(Item, { value: "", ...{ label: "" } }),
165
- /* @__PURE__ */ jsx(Item, { value: "True", ...{ label: "Yes" }, children: "Yes" }),
166
- /* @__PURE__ */ jsx(Item, { value: "False", ...{ label: "No" }, children: "No" })
167
- ] }),
168
- value: filterValue
169
- }
170
- ) });
68
+ export function NumberHeaderFilter() {
69
+ const context = useContext(ColumnContext);
70
+ const { filterPlaceholder, filterDebounceTime } = context.customColumnOptions ?? {};
71
+ const [inputValue, setInputValue] = useState('');
72
+ const { matcher, filterValue, updateFilter } = useFilterState(Matcher.GREATER_THAN);
73
+ const select = useRef(null);
74
+ useSelectInitWorkaround(select);
75
+ useEffect(() => {
76
+ const delayInputTimeoutId = setTimeout(() => {
77
+ updateFilter(matcher, inputValue);
78
+ }, filterDebounceTime ?? 200);
79
+ return () => clearTimeout(delayInputTimeoutId);
80
+ }, [inputValue]);
81
+ return (_jsxs("div", { className: "auto-grid-number-filter", children: [_jsx(ComparationSelection, { value: matcher, onMatcherChanged: (m) => updateFilter(m, filterValue) }), _jsx(NumberField, { theme: "small", placeholder: filterPlaceholder ?? 'Filter...', onInput: (e) => {
82
+ const fieldValue = e.target.value;
83
+ setInputValue(fieldValue);
84
+ } })] }));
171
85
  }
172
- function DateHeaderFilter() {
173
- const context = useContext(ColumnContext);
174
- const i18n = useDatePickerI18n();
175
- const { matcher, filterValue, updateFilter } = useFilterState(Matcher.GREATER_THAN);
176
- const [invalid, setInvalid] = useState(false);
177
- return /* @__PURE__ */ jsxs("div", { className: "auto-grid-date-filter", children: [
178
- /* @__PURE__ */ jsx(
179
- ComparationSelection,
180
- {
181
- value: matcher,
182
- onMatcherChanged: (m) => updateFilter(m, filterValue),
183
- isDateTimeType: true
184
- }
185
- ),
186
- /* @__PURE__ */ jsx(
187
- DatePicker,
188
- {
189
- theme: "small",
190
- value: filterValue,
191
- placeholder: context.customColumnOptions?.filterPlaceholder ?? "Filter...",
192
- i18n,
193
- onInvalidChanged: ({ detail: { value } }) => {
194
- setInvalid(value);
86
+ export function EnumHeaderFilter() {
87
+ const { filterValue, updateFilter } = useFilterState(Matcher.EQUALS);
88
+ const context = useContext(ColumnContext);
89
+ const model = context.propertyInfo.model;
90
+ const options = [
91
+ {
92
+ value: '',
93
+ label: '',
195
94
  },
196
- onValueChanged: ({ detail: { value } }) => {
197
- if (!(invalid || value === filterValue)) {
198
- updateFilter(matcher, value);
199
- }
200
- }
201
- }
202
- )
203
- ] });
95
+ ...Object.keys(model[_enum]).map((value) => ({
96
+ label: convertToTitleCase(value),
97
+ value,
98
+ })),
99
+ ];
100
+ return (_jsx("div", { className: "auto-grid-enum-filter", children: _jsx(Select, { theme: "small", items: options, value: filterValue, onValueChanged: (e) => {
101
+ const newFilterValue = e.detail.value;
102
+ updateFilter(Matcher.EQUALS, newFilterValue);
103
+ } }) }));
204
104
  }
205
- function TimeHeaderFilter() {
206
- const context = useContext(ColumnContext);
207
- const { matcher, filterValue, updateFilter } = useFilterState(Matcher.GREATER_THAN);
208
- const [invalid, setInvalid] = useState(false);
209
- return /* @__PURE__ */ jsxs("div", { className: "auto-grid-time-filter", children: [
210
- /* @__PURE__ */ jsx(
211
- ComparationSelection,
212
- {
213
- value: matcher,
214
- onMatcherChanged: (m) => updateFilter(m, filterValue),
215
- isDateTimeType: true
216
- }
217
- ),
218
- /* @__PURE__ */ jsx(
219
- TimePicker,
220
- {
221
- theme: "small",
222
- value: filterValue,
223
- placeholder: context.customColumnOptions?.filterPlaceholder ?? "Filter...",
224
- onInvalidChanged: ({ detail: { value } }) => {
225
- setInvalid(value);
226
- },
227
- onValueChanged: ({ detail: { value } }) => {
228
- if (!(invalid || value === filterValue)) {
229
- updateFilter(matcher, value);
230
- }
231
- }
232
- }
233
- )
234
- ] });
105
+ export function BooleanHeaderFilter() {
106
+ const { filterValue, updateFilter } = useFilterState(Matcher.EQUALS);
107
+ const select = useRef(null);
108
+ useSelectInitWorkaround(select);
109
+ return (_jsx("div", { className: "auto-grid-boolean-filter", children: _jsx(Select, { theme: "small", ref: select, onValueChanged: (e) => {
110
+ const newFilterValue = e.detail.value;
111
+ updateFilter(Matcher.EQUALS, newFilterValue);
112
+ }, renderer: () => (_jsxs(ListBox, { children: [_jsx(Item, { value: '', label: '' }), _jsx(Item, { value: 'True', label: 'Yes', children: "Yes" }), _jsx(Item, { value: 'False', label: 'No', children: "No" })] })), value: filterValue }) }));
235
113
  }
236
- function NoHeaderFilter() {
237
- return /* @__PURE__ */ jsx(Fragment, {});
114
+ export function DateHeaderFilter() {
115
+ const context = useContext(ColumnContext);
116
+ const i18n = useDatePickerI18n();
117
+ const { matcher, filterValue, updateFilter } = useFilterState(Matcher.GREATER_THAN);
118
+ const [invalid, setInvalid] = useState(false);
119
+ return (_jsxs("div", { className: "auto-grid-date-filter", children: [_jsx(ComparationSelection, { value: matcher, onMatcherChanged: (m) => updateFilter(m, filterValue), isDateTimeType: true }), _jsx(DatePicker, { theme: "small", value: filterValue, placeholder: context.customColumnOptions?.filterPlaceholder ?? 'Filter...', i18n: i18n, onInvalidChanged: ({ detail: { value } }) => {
120
+ setInvalid(value);
121
+ }, onValueChanged: ({ detail: { value } }) => {
122
+ if (!(invalid || value === filterValue)) {
123
+ updateFilter(matcher, value);
124
+ }
125
+ } })] }));
238
126
  }
239
- function HeaderFilterWrapper({ original }) {
240
- const context = useContext(ColumnContext);
241
- const customContext = useContext(CustomColumnContext);
242
- const { setColumnFilter, headerFilterRenderer: HeaderFilterRenderer, filterKey } = context ?? customContext;
243
- function setFilter(filter) {
244
- setColumnFilter(filter, filterKey);
245
- }
246
- return /* @__PURE__ */ jsx(HeaderFilterRenderer, { original, setFilter });
127
+ export function TimeHeaderFilter() {
128
+ const context = useContext(ColumnContext);
129
+ const { matcher, filterValue, updateFilter } = useFilterState(Matcher.GREATER_THAN);
130
+ const [invalid, setInvalid] = useState(false);
131
+ return (_jsxs("div", { className: "auto-grid-time-filter", children: [_jsx(ComparationSelection, { value: matcher, onMatcherChanged: (m) => updateFilter(m, filterValue), isDateTimeType: true }), _jsx(TimePicker, { theme: "small", value: filterValue, placeholder: context.customColumnOptions?.filterPlaceholder ?? 'Filter...', onInvalidChanged: ({ detail: { value } }) => {
132
+ setInvalid(value);
133
+ }, onValueChanged: ({ detail: { value } }) => {
134
+ if (!(invalid || value === filterValue)) {
135
+ updateFilter(matcher, value);
136
+ }
137
+ } })] }));
138
+ }
139
+ export function NoHeaderFilter() {
140
+ return _jsx(_Fragment, {});
141
+ }
142
+ export function HeaderFilterWrapper({ original }) {
143
+ const context = useContext(ColumnContext);
144
+ const customContext = useContext(CustomColumnContext);
145
+ const { setColumnFilter, headerFilterRenderer: HeaderFilterRenderer, filterKey } = (context ?? customContext);
146
+ function setFilter(filter) {
147
+ setColumnFilter(filter, filterKey);
148
+ }
149
+ return _jsx(HeaderFilterRenderer, { original: original, setFilter: setFilter });
247
150
  }
248
- export {
249
- BooleanHeaderFilter,
250
- DateHeaderFilter,
251
- EnumHeaderFilter,
252
- HeaderFilterWrapper,
253
- NoHeaderFilter,
254
- NumberHeaderFilter,
255
- StringHeaderFilter,
256
- TimeHeaderFilter
257
- };
258
- //# sourceMappingURL=header-filter.js.map
151
+ //# sourceMappingURL=header-filter.js.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["src/header-filter.tsx"],
4
- "sourcesContent": ["import { _enum, type EnumModel } from '@vaadin/hilla-lit-form';\nimport { DatePicker } from '@vaadin/react-components/DatePicker.js';\nimport type { GridColumnProps } from '@vaadin/react-components/GridColumn.js';\nimport { Item } from '@vaadin/react-components/Item.js';\nimport { ListBox } from '@vaadin/react-components/ListBox.js';\nimport { NumberField } from '@vaadin/react-components/NumberField.js';\nimport { Select, type SelectElement } from '@vaadin/react-components/Select.js';\nimport { TextField, type TextFieldElement } from '@vaadin/react-components/TextField.js';\nimport { TimePicker } from '@vaadin/react-components/TimePicker.js';\nimport {\n type ComponentType,\n type JSX,\n type ReactElement,\n type RefObject,\n useContext,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport { ColumnContext, CustomColumnContext } from './autogrid-column-context.js';\nimport { useDatePickerI18n } from './locale.js';\nimport type FilterUnion from './types/com/vaadin/hilla/crud/filter/FilterUnion';\nimport type PropertyStringFilter from './types/com/vaadin/hilla/crud/filter/PropertyStringFilter';\nimport Matcher from './types/com/vaadin/hilla/crud/filter/PropertyStringFilter/Matcher.js';\nimport { convertToTitleCase } from './util';\n\ntype ExtractComponentTypeProps<T extends ComponentType<any>> = T extends ComponentType<infer U> ? U : never;\n\nexport type HeaderRendererProps = ExtractComponentTypeProps<\n NonNullable<Required<GridColumnProps<unknown>>['headerRenderer']>\n>;\n\nexport type HeaderFilterRendererProps = HeaderRendererProps & {\n /**\n * Allows to set custom filters for the column.\n * This is used by the header filter components.\n * @param filter - The filter to set in the filter list.\n */\n setFilter(filter: FilterUnion): void;\n};\n\nexport type HeaderFilterProps = Readonly<{\n /**\n * If true, the column can be sorted. This is useful to disable sorting for\n * properties that are not sortable in the backend, or that require excessive processing.\n */\n sortable?: boolean;\n /**\n * If true, the column can be filtered. This is useful to disable filtering for\n * properties that are not sortable in the backend, or that require excessive processing.\n */\n filterable?: boolean;\n /**\n * Placeholder text for the filter input.\n * Only applies to string, number and date/time value filters.\n */\n filterPlaceholder?: string;\n /**\n * Debounce time for the filter input in milliseconds.\n * Only applies to string value filters and number value filters.\n */\n filterDebounceTime?: number;\n /**\n * Minimum length for the filter input.\n * Only applies to string value filters.\n */\n filterMinLength?: number;\n\n /**\n * Custom renderer for the filter in the header.\n */\n headerFilterRenderer?: ComponentType<HeaderFilterRendererProps>;\n}>;\n\nfunction useFilterState(initialMatcher: Matcher) {\n const context = useContext(ColumnContext)!;\n const [matcher, setMatcher] = useState(initialMatcher);\n const [filterValue, setFilterValue] = useState('');\n\n function updateFilter(newMatcher: Matcher, newFilterValue: string) {\n setFilterValue(newFilterValue);\n setMatcher(newMatcher);\n\n const filter: PropertyStringFilter = {\n propertyId: context.propertyInfo.name,\n filterValue: newFilterValue,\n matcher: newMatcher,\n '@type': 'propertyString',\n };\n context.setColumnFilter(filter, context.filterKey);\n }\n\n return { matcher, filterValue, updateFilter };\n}\n\n// Workaround for https://github.com/vaadin/react-components/issues/148\nfunction useSelectInitWorkaround(selectRef: RefObject<SelectElement | null>) {\n useEffect(() => {\n setTimeout(() => {\n if (selectRef.current) {\n selectRef.current.requestContentUpdate();\n }\n }, 1);\n }, []);\n}\n\n// extracted component (and type) to avoid code duplication\ntype ComparationSelectionProps = Readonly<{\n value: Matcher;\n onMatcherChanged(matcher: Matcher): void;\n isDateTimeType?: boolean;\n}>;\n\nfunction ComparationSelection({ onMatcherChanged, value, isDateTimeType }: ComparationSelectionProps): ReactElement {\n const select = useRef<SelectElement>(null);\n\n useSelectInitWorkaround(select);\n\n return (\n <Select\n theme=\"small\"\n className=\"auto-grid-comparation-selection\"\n ref={select}\n value={value}\n onValueChanged={({ detail }) => {\n onMatcherChanged(detail.value as Matcher);\n }}\n renderer={() => (\n <ListBox>\n <Item value={Matcher.GREATER_THAN} {...{ label: '>' }}>\n {isDateTimeType ? '> After' : '> Greater than'}\n </Item>\n <Item value={Matcher.LESS_THAN} {...{ label: '<' }}>\n {isDateTimeType ? '< Before' : '< Less than'}\n </Item>\n <Item value={Matcher.EQUALS} {...{ label: '=' }}>\n = Equals\n </Item>\n </ListBox>\n )}\n ></Select>\n );\n}\n\nexport function StringHeaderFilter(): ReactElement {\n const context = useContext(ColumnContext)!;\n const { filterPlaceholder, filterDebounceTime, filterMinLength } = context.customColumnOptions ?? {};\n const { updateFilter } = useFilterState(Matcher.CONTAINS);\n const [inputValue, setInputValue] = useState('');\n\n useEffect(() => {\n if (filterMinLength && inputValue && inputValue.length < filterMinLength) {\n updateFilter(Matcher.CONTAINS, '');\n return () => {};\n }\n\n const delayInputTimeoutId = setTimeout(() => {\n updateFilter(Matcher.CONTAINS, inputValue);\n }, filterDebounceTime ?? 200);\n return () => clearTimeout(delayInputTimeoutId);\n }, [inputValue]);\n\n return (\n <div className=\"auto-grid-string-filter\">\n <TextField\n theme=\"small\"\n placeholder={filterPlaceholder ?? 'Filter...'}\n onInput={(e: any) => {\n const fieldValue = ((e as InputEvent).target as TextFieldElement).value;\n setInputValue(fieldValue);\n }}\n ></TextField>\n </div>\n );\n}\n\nexport function NumberHeaderFilter(): ReactElement {\n const context = useContext(ColumnContext)!;\n const { filterPlaceholder, filterDebounceTime } = context.customColumnOptions ?? {};\n const [inputValue, setInputValue] = useState('');\n const { matcher, filterValue, updateFilter } = useFilterState(Matcher.GREATER_THAN);\n const select = useRef<SelectElement>(null);\n\n useSelectInitWorkaround(select);\n\n useEffect(() => {\n const delayInputTimeoutId = setTimeout(() => {\n updateFilter(matcher, inputValue);\n }, filterDebounceTime ?? 200);\n return () => clearTimeout(delayInputTimeoutId);\n }, [inputValue]);\n\n return (\n <div className=\"auto-grid-number-filter\">\n <ComparationSelection value={matcher} onMatcherChanged={(m) => updateFilter(m, filterValue)} />\n <NumberField\n theme=\"small\"\n placeholder={filterPlaceholder ?? 'Filter...'}\n onInput={(e) => {\n const fieldValue = ((e as InputEvent).target as TextFieldElement).value;\n setInputValue(fieldValue);\n }}\n />\n </div>\n );\n}\n\nexport function EnumHeaderFilter(): ReactElement {\n const { filterValue, updateFilter } = useFilterState(Matcher.EQUALS);\n const context = useContext(ColumnContext)!;\n const model = context.propertyInfo.model as EnumModel;\n const options = [\n {\n value: '',\n label: '',\n },\n ...Object.keys(model[_enum]).map((value) => ({\n label: convertToTitleCase(value),\n value,\n })),\n ];\n return (\n <div className=\"auto-grid-enum-filter\">\n <Select\n theme=\"small\"\n items={options}\n value={filterValue}\n onValueChanged={(e) => {\n const newFilterValue = e.detail.value;\n updateFilter(Matcher.EQUALS, newFilterValue);\n }}\n />\n </div>\n );\n}\n\nexport function BooleanHeaderFilter(): ReactElement {\n const { filterValue, updateFilter } = useFilterState(Matcher.EQUALS);\n const select = useRef<SelectElement>(null);\n\n useSelectInitWorkaround(select);\n\n return (\n <div className=\"auto-grid-boolean-filter\">\n <Select\n theme=\"small\"\n ref={select}\n onValueChanged={(e) => {\n const newFilterValue = e.detail.value;\n updateFilter(Matcher.EQUALS, newFilterValue);\n }}\n renderer={() => (\n <ListBox>\n <Item value={''} {...{ label: '' }}></Item>\n <Item value={'True'} {...{ label: 'Yes' }}>\n Yes\n </Item>\n <Item value={'False'} {...{ label: 'No' }}>\n No\n </Item>\n </ListBox>\n )}\n value={filterValue}\n ></Select>\n </div>\n );\n}\n\nexport function DateHeaderFilter(): ReactElement {\n const context = useContext(ColumnContext)!;\n const i18n = useDatePickerI18n();\n const { matcher, filterValue, updateFilter } = useFilterState(Matcher.GREATER_THAN);\n const [invalid, setInvalid] = useState(false);\n\n return (\n <div className=\"auto-grid-date-filter\">\n <ComparationSelection\n value={matcher}\n onMatcherChanged={(m) => updateFilter(m, filterValue)}\n isDateTimeType={true}\n />\n <DatePicker\n theme=\"small\"\n value={filterValue}\n placeholder={context.customColumnOptions?.filterPlaceholder ?? 'Filter...'}\n i18n={i18n}\n onInvalidChanged={({ detail: { value } }) => {\n setInvalid(value);\n }}\n onValueChanged={({ detail: { value } }) => {\n if (!(invalid || value === filterValue)) {\n updateFilter(matcher, value);\n }\n }}\n />\n </div>\n );\n}\n\nexport function TimeHeaderFilter(): ReactElement {\n const context = useContext(ColumnContext)!;\n const { matcher, filterValue, updateFilter } = useFilterState(Matcher.GREATER_THAN);\n const [invalid, setInvalid] = useState(false);\n\n return (\n <div className=\"auto-grid-time-filter\">\n <ComparationSelection\n value={matcher}\n onMatcherChanged={(m) => updateFilter(m, filterValue)}\n isDateTimeType={true}\n />\n <TimePicker\n theme=\"small\"\n value={filterValue}\n placeholder={context.customColumnOptions?.filterPlaceholder ?? 'Filter...'}\n onInvalidChanged={({ detail: { value } }) => {\n setInvalid(value);\n }}\n onValueChanged={({ detail: { value } }) => {\n if (!(invalid || value === filterValue)) {\n updateFilter(matcher, value);\n }\n }}\n />\n </div>\n );\n}\n\nexport function NoHeaderFilter(): ReactElement {\n return <></>;\n}\n\nexport function HeaderFilterWrapper({ original }: HeaderRendererProps): JSX.Element | null {\n const context = useContext(ColumnContext);\n const customContext = useContext(CustomColumnContext);\n const { setColumnFilter, headerFilterRenderer: HeaderFilterRenderer, filterKey } = (context ?? customContext)!;\n\n function setFilter(filter: FilterUnion) {\n setColumnFilter(filter, filterKey);\n }\n\n return <HeaderFilterRenderer original={original} setFilter={setFilter} />;\n}\n"],
5
- "mappings": "AAgIQ,SAyMC,UAxMC,KADF;AAhIR,S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E,CACP,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,cAAc;IAC5B,OAAO,mBAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,EAAE,QAAQ,EAAuB;IACnE,MAAM,OAAO,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;IAC1C,MAAM,aAAa,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAC;IACtD,MAAM,EAAE,eAAe,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,SAAS,EAAE,GAAG,CAAC,OAAO,IAAI,aAAa,CAAE,CAAC;IAE/G,SAAS,SAAS,CAAC,MAAmB;QACpC,eAAe,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACrC,CAAC;IAED,OAAO,KAAC,oBAAoB,IAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,GAAI,CAAC;AAC5E,CAAC","sourcesContent":["import { _enum, type EnumModel } from '@vaadin/hilla-lit-form';\nimport { DatePicker } from '@vaadin/react-components/DatePicker.js';\nimport type { GridColumnProps } from '@vaadin/react-components/GridColumn.js';\nimport { Item } from '@vaadin/react-components/Item.js';\nimport { ListBox } from '@vaadin/react-components/ListBox.js';\nimport { NumberField } from '@vaadin/react-components/NumberField.js';\nimport { Select, type SelectElement } from '@vaadin/react-components/Select.js';\nimport { TextField, type TextFieldElement } from '@vaadin/react-components/TextField.js';\nimport { TimePicker } from '@vaadin/react-components/TimePicker.js';\nimport {\n type ComponentType,\n type JSX,\n type ReactElement,\n type RefObject,\n useContext,\n useEffect,\n useRef,\n useState,\n} from 'react';\nimport { ColumnContext, CustomColumnContext } from './autogrid-column-context.js';\nimport { useDatePickerI18n } from './locale.js';\nimport type FilterUnion from './types/com/vaadin/hilla/crud/filter/FilterUnion.js';\nimport Matcher from './types/com/vaadin/hilla/crud/filter/PropertyStringFilter/Matcher.js';\nimport type PropertyStringFilter from './types/com/vaadin/hilla/crud/filter/PropertyStringFilter.js';\nimport { convertToTitleCase } from './util';\n\ntype ExtractComponentTypeProps<T extends ComponentType<any>> = T extends ComponentType<infer U> ? U : never;\n\nexport type HeaderRendererProps = ExtractComponentTypeProps<\n NonNullable<Required<GridColumnProps<unknown>>['headerRenderer']>\n>;\n\nexport type HeaderFilterRendererProps = HeaderRendererProps & {\n /**\n * Allows to set custom filters for the column.\n * This is used by the header filter components.\n * @param filter - The filter to set in the filter list.\n */\n setFilter(filter: FilterUnion): void;\n};\n\nexport type HeaderFilterProps = Readonly<{\n /**\n * If true, the column can be sorted. This is useful to disable sorting for\n * properties that are not sortable in the backend, or that require excessive processing.\n */\n sortable?: boolean;\n /**\n * If true, the column can be filtered. This is useful to disable filtering for\n * properties that are not sortable in the backend, or that require excessive processing.\n */\n filterable?: boolean;\n /**\n * Placeholder text for the filter input.\n * Only applies to string, number and date/time value filters.\n */\n filterPlaceholder?: string;\n /**\n * Debounce time for the filter input in milliseconds.\n * Only applies to string value filters and number value filters.\n */\n filterDebounceTime?: number;\n /**\n * Minimum length for the filter input.\n * Only applies to string value filters.\n */\n filterMinLength?: number;\n\n /**\n * Custom renderer for the filter in the header.\n */\n headerFilterRenderer?: ComponentType<HeaderFilterRendererProps>;\n}>;\n\nfunction useFilterState(initialMatcher: Matcher) {\n const context = useContext(ColumnContext)!;\n const [matcher, setMatcher] = useState(initialMatcher);\n const [filterValue, setFilterValue] = useState('');\n\n function updateFilter(newMatcher: Matcher, newFilterValue: string) {\n setFilterValue(newFilterValue);\n setMatcher(newMatcher);\n\n const filter: PropertyStringFilter = {\n propertyId: context.propertyInfo.name,\n filterValue: newFilterValue,\n matcher: newMatcher,\n '@type': 'propertyString',\n };\n context.setColumnFilter(filter, context.filterKey);\n }\n\n return { matcher, filterValue, updateFilter };\n}\n\n// Workaround for https://github.com/vaadin/react-components/issues/148\nfunction useSelectInitWorkaround(selectRef: RefObject<SelectElement | null>) {\n useEffect(() => {\n setTimeout(() => {\n if (selectRef.current) {\n selectRef.current.requestContentUpdate();\n }\n }, 1);\n }, []);\n}\n\n// extracted component (and type) to avoid code duplication\ntype ComparationSelectionProps = Readonly<{\n value: Matcher;\n onMatcherChanged(matcher: Matcher): void;\n isDateTimeType?: boolean;\n}>;\n\nfunction ComparationSelection({ onMatcherChanged, value, isDateTimeType }: ComparationSelectionProps): ReactElement {\n const select = useRef<SelectElement>(null);\n\n useSelectInitWorkaround(select);\n\n return (\n <Select\n theme=\"small\"\n className=\"auto-grid-comparation-selection\"\n ref={select}\n value={value}\n onValueChanged={({ detail }) => {\n onMatcherChanged(detail.value as Matcher);\n }}\n renderer={() => (\n <ListBox>\n <Item value={Matcher.GREATER_THAN} {...{ label: '>' }}>\n {isDateTimeType ? '> After' : '> Greater than'}\n </Item>\n <Item value={Matcher.LESS_THAN} {...{ label: '<' }}>\n {isDateTimeType ? '< Before' : '< Less than'}\n </Item>\n <Item value={Matcher.EQUALS} {...{ label: '=' }}>\n = Equals\n </Item>\n </ListBox>\n )}\n ></Select>\n );\n}\n\nexport function StringHeaderFilter(): ReactElement {\n const context = useContext(ColumnContext)!;\n const { filterPlaceholder, filterDebounceTime, filterMinLength } = context.customColumnOptions ?? {};\n const { updateFilter } = useFilterState(Matcher.CONTAINS);\n const [inputValue, setInputValue] = useState('');\n\n useEffect(() => {\n if (filterMinLength && inputValue && inputValue.length < filterMinLength) {\n updateFilter(Matcher.CONTAINS, '');\n return () => {};\n }\n\n const delayInputTimeoutId = setTimeout(() => {\n updateFilter(Matcher.CONTAINS, inputValue);\n }, filterDebounceTime ?? 200);\n return () => clearTimeout(delayInputTimeoutId);\n }, [inputValue]);\n\n return (\n <div className=\"auto-grid-string-filter\">\n <TextField\n theme=\"small\"\n placeholder={filterPlaceholder ?? 'Filter...'}\n onInput={(e: any) => {\n const fieldValue = ((e as InputEvent).target as TextFieldElement).value;\n setInputValue(fieldValue);\n }}\n ></TextField>\n </div>\n );\n}\n\nexport function NumberHeaderFilter(): ReactElement {\n const context = useContext(ColumnContext)!;\n const { filterPlaceholder, filterDebounceTime } = context.customColumnOptions ?? {};\n const [inputValue, setInputValue] = useState('');\n const { matcher, filterValue, updateFilter } = useFilterState(Matcher.GREATER_THAN);\n const select = useRef<SelectElement>(null);\n\n useSelectInitWorkaround(select);\n\n useEffect(() => {\n const delayInputTimeoutId = setTimeout(() => {\n updateFilter(matcher, inputValue);\n }, filterDebounceTime ?? 200);\n return () => clearTimeout(delayInputTimeoutId);\n }, [inputValue]);\n\n return (\n <div className=\"auto-grid-number-filter\">\n <ComparationSelection value={matcher} onMatcherChanged={(m) => updateFilter(m, filterValue)} />\n <NumberField\n theme=\"small\"\n placeholder={filterPlaceholder ?? 'Filter...'}\n onInput={(e) => {\n const fieldValue = ((e as InputEvent).target as TextFieldElement).value;\n setInputValue(fieldValue);\n }}\n />\n </div>\n );\n}\n\nexport function EnumHeaderFilter(): ReactElement {\n const { filterValue, updateFilter } = useFilterState(Matcher.EQUALS);\n const context = useContext(ColumnContext)!;\n const model = context.propertyInfo.model as EnumModel;\n const options = [\n {\n value: '',\n label: '',\n },\n ...Object.keys(model[_enum]).map((value) => ({\n label: convertToTitleCase(value),\n value,\n })),\n ];\n return (\n <div className=\"auto-grid-enum-filter\">\n <Select\n theme=\"small\"\n items={options}\n value={filterValue}\n onValueChanged={(e) => {\n const newFilterValue = e.detail.value;\n updateFilter(Matcher.EQUALS, newFilterValue);\n }}\n />\n </div>\n );\n}\n\nexport function BooleanHeaderFilter(): ReactElement {\n const { filterValue, updateFilter } = useFilterState(Matcher.EQUALS);\n const select = useRef<SelectElement>(null);\n\n useSelectInitWorkaround(select);\n\n return (\n <div className=\"auto-grid-boolean-filter\">\n <Select\n theme=\"small\"\n ref={select}\n onValueChanged={(e) => {\n const newFilterValue = e.detail.value;\n updateFilter(Matcher.EQUALS, newFilterValue);\n }}\n renderer={() => (\n <ListBox>\n <Item value={''} {...{ label: '' }}></Item>\n <Item value={'True'} {...{ label: 'Yes' }}>\n Yes\n </Item>\n <Item value={'False'} {...{ label: 'No' }}>\n No\n </Item>\n </ListBox>\n )}\n value={filterValue}\n ></Select>\n </div>\n );\n}\n\nexport function DateHeaderFilter(): ReactElement {\n const context = useContext(ColumnContext)!;\n const i18n = useDatePickerI18n();\n const { matcher, filterValue, updateFilter } = useFilterState(Matcher.GREATER_THAN);\n const [invalid, setInvalid] = useState(false);\n\n return (\n <div className=\"auto-grid-date-filter\">\n <ComparationSelection\n value={matcher}\n onMatcherChanged={(m) => updateFilter(m, filterValue)}\n isDateTimeType={true}\n />\n <DatePicker\n theme=\"small\"\n value={filterValue}\n placeholder={context.customColumnOptions?.filterPlaceholder ?? 'Filter...'}\n i18n={i18n}\n onInvalidChanged={({ detail: { value } }) => {\n setInvalid(value);\n }}\n onValueChanged={({ detail: { value } }) => {\n if (!(invalid || value === filterValue)) {\n updateFilter(matcher, value);\n }\n }}\n />\n </div>\n );\n}\n\nexport function TimeHeaderFilter(): ReactElement {\n const context = useContext(ColumnContext)!;\n const { matcher, filterValue, updateFilter } = useFilterState(Matcher.GREATER_THAN);\n const [invalid, setInvalid] = useState(false);\n\n return (\n <div className=\"auto-grid-time-filter\">\n <ComparationSelection\n value={matcher}\n onMatcherChanged={(m) => updateFilter(m, filterValue)}\n isDateTimeType={true}\n />\n <TimePicker\n theme=\"small\"\n value={filterValue}\n placeholder={context.customColumnOptions?.filterPlaceholder ?? 'Filter...'}\n onInvalidChanged={({ detail: { value } }) => {\n setInvalid(value);\n }}\n onValueChanged={({ detail: { value } }) => {\n if (!(invalid || value === filterValue)) {\n updateFilter(matcher, value);\n }\n }}\n />\n </div>\n );\n}\n\nexport function NoHeaderFilter(): ReactElement {\n return <></>;\n}\n\nexport function HeaderFilterWrapper({ original }: HeaderRendererProps): JSX.Element | null {\n const context = useContext(ColumnContext);\n const customContext = useContext(CustomColumnContext);\n const { setColumnFilter, headerFilterRenderer: HeaderFilterRenderer, filterKey } = (context ?? customContext)!;\n\n function setFilter(filter: FilterUnion) {\n setColumnFilter(filter, filterKey);\n }\n\n return <HeaderFilterRenderer original={original} setFilter={setFilter} />;\n}\n"]}
@@ -1,3 +1,2 @@
1
1
  import { type ReactElement } from 'react';
2
2
  export declare function HeaderSorter(): ReactElement;
3
- //# sourceMappingURL=header-sorter.d.ts.map
package/header-sorter.js CHANGED
@@ -1,28 +1,17 @@
1
- import { Fragment, jsx } from "react/jsx-runtime";
2
- import { GridSorter } from "@vaadin/react-components/GridSorter.js";
3
- import { useContext } from "react";
4
- import { ColumnContext } from "./autogrid-column-context.js";
5
- function HeaderSorter() {
6
- const context = useContext(ColumnContext);
7
- const sorterState = context.sortState[context.propertyInfo.name];
8
- const direction = sorterState?.direction ?? null;
9
- const headerLabel = context.customColumnOptions?.header ?? context.propertyInfo.humanReadableName;
10
- return context.customColumnOptions?.sortable === false ? /* @__PURE__ */ jsx(Fragment, { children: headerLabel }) : /* @__PURE__ */ jsx(
11
- GridSorter,
12
- {
13
- path: context.propertyInfo.name,
14
- direction,
15
- onDirectionChanged: (e) => {
16
- context.setSortState((prevState) => {
17
- const newSorterState = e.detail.value ? { direction: e.detail.value } : void 0;
18
- return { ...prevState, [context.propertyInfo.name]: newSorterState };
19
- });
20
- },
21
- children: headerLabel
22
- }
23
- );
1
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
+ import { GridSorter } from '@vaadin/react-components/GridSorter.js';
3
+ import { useContext } from 'react';
4
+ import { ColumnContext } from './autogrid-column-context.js';
5
+ export function HeaderSorter() {
6
+ const context = useContext(ColumnContext);
7
+ const sorterState = context.sortState[context.propertyInfo.name];
8
+ const direction = sorterState?.direction ?? null;
9
+ const headerLabel = context.customColumnOptions?.header ?? context.propertyInfo.humanReadableName;
10
+ return context.customColumnOptions?.sortable === false ? (_jsx(_Fragment, { children: headerLabel })) : (_jsx(GridSorter, { path: context.propertyInfo.name, direction: direction, onDirectionChanged: (e) => {
11
+ context.setSortState((prevState) => {
12
+ const newSorterState = e.detail.value ? { direction: e.detail.value } : undefined;
13
+ return { ...prevState, [context.propertyInfo.name]: newSorterState };
14
+ });
15
+ }, children: headerLabel }));
24
16
  }
25
- export {
26
- HeaderSorter
27
- };
28
- //# sourceMappingURL=header-sorter.js.map
17
+ //# sourceMappingURL=header-sorter.js.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["src/header-sorter.tsx"],
4
- "sourcesContent": ["import { GridSorter } from '@vaadin/react-components/GridSorter.js';\nimport { useContext, type ReactElement } from 'react';\nimport { ColumnContext } from './autogrid-column-context.js';\n\nexport function HeaderSorter(): ReactElement {\n const context = useContext(ColumnContext)!;\n const sorterState = context.sortState[context.propertyInfo.name];\n const direction = sorterState?.direction ?? null;\n const headerLabel = context.customColumnOptions?.header ?? context.propertyInfo.humanReadableName;\n\n return context.customColumnOptions?.sortable === false ? (\n <>{headerLabel}</>\n ) : (\n <GridSorter\n path={context.propertyInfo.name}\n direction={direction}\n onDirectionChanged={(e) => {\n context.setSortState((prevState) => {\n const newSorterState = e.detail.value ? { direction: e.detail.value } : undefined;\n return { ...prevState, [context.propertyInfo.name]: newSorterState };\n });\n }}\n >\n {headerLabel}\n </GridSorter>\n );\n}\n"],
5
- "mappings": "AAWI;AAXJ,SAAS,kBAAkB;AAC3B,SAAS,kBAAqC;AAC9C,SAAS,qBAAqB;AAEvB,SAAS,eAA6B;AAC3C,QAAM,UAAU,WAAW,aAAa;AACxC,QAAM,cAAc,QAAQ,UAAU,QAAQ,aAAa,IAAI;AAC/D,QAAM,YAAY,aAAa,aAAa;AAC5C,QAAM,cAAc,QAAQ,qBAAqB,UAAU,QAAQ,aAAa;AAEhF,SAAO,QAAQ,qBAAqB,aAAa,QAC/C,gCAAG,uBAAY,IAEf;AAAA,IAAC;AAAA;AAAA,MACC,MAAM,QAAQ,aAAa;AAAA,MAC3B;AAAA,MACA,oBAAoB,CAAC,MAAM;AACzB,gBAAQ,aAAa,CAAC,cAAc;AAClC,gBAAM,iBAAiB,EAAE,OAAO,QAAQ,EAAE,WAAW,EAAE,OAAO,MAAM,IAAI;AACxE,iBAAO,EAAE,GAAG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EAAE,cAAc,EAAE,CAAC;YACvE,CAAC,CAAC,CAAC;QACL,CAAC,YAEA,WAAW,GACD,CACd,CAAC;AACJ,CAAC","sourcesContent":["import { GridSorter } from '@vaadin/react-components/GridSorter.js';\nimport { useContext, type ReactElement } from 'react';\nimport { ColumnContext } from './autogrid-column-context.js';\n\nexport function HeaderSorter(): ReactElement {\n const context = useContext(ColumnContext)!;\n const sorterState = context.sortState[context.propertyInfo.name];\n const direction = sorterState?.direction ?? null;\n const headerLabel = context.customColumnOptions?.header ?? context.propertyInfo.humanReadableName;\n\n return context.customColumnOptions?.sortable === false ? (\n <>{headerLabel}</>\n ) : (\n <GridSorter\n path={context.propertyInfo.name}\n direction={direction}\n onDirectionChanged={(e) => {\n context.setSortState((prevState) => {\n const newSorterState = e.detail.value ? { direction: e.detail.value } : undefined;\n return { ...prevState, [context.propertyInfo.name]: newSorterState };\n });\n }}\n >\n {headerLabel}\n </GridSorter>\n );\n}\n"]}
package/i18n.d.ts CHANGED
@@ -1,2 +1 @@
1
1
  export declare const defaultLocale: string | undefined;
2
- //# sourceMappingURL=i18n.d.ts.map
package/i18n.js CHANGED
@@ -1,5 +1,2 @@
1
- const defaultLocale = void 0;
2
- export {
3
- defaultLocale
4
- };
5
- //# sourceMappingURL=i18n.js.map
1
+ export const defaultLocale = undefined;
2
+ //# sourceMappingURL=i18n.js.map
package/i18n.js.map CHANGED
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["src/i18n.ts"],
4
- "sourcesContent": ["// The default locale to use for renderers, filter inputs, etc.\n// If undefined, the browser's locale will be used.\n// Allows to modify the locale for testing purposes.\nexport const defaultLocale: string | undefined = undefined;\n"],
5
- "mappings": "AAGO,MAAM,gBAAoC;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"i18n.js","sourceRoot":"","sources":["src/i18n.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,aAAa,GAAuB,SAAS,CAAC","sourcesContent":["// The default locale to use for renderers, filter inputs, etc.\n// If undefined, the browser's locale will be used.\n// Allows to modify the locale for testing purposes.\nexport const defaultLocale: string | undefined = undefined;\n"]}
package/index.d.ts CHANGED
@@ -2,5 +2,4 @@ export * from './autogrid-feature.js';
2
2
  export type * from './crud.js';
3
3
  export * from './autoform-feature.js';
4
4
  export * from './autocrud-feature.js';
5
- export { useDataProvider } from './data-provider.js';
6
- //# sourceMappingURL=index.d.ts.map
5
+ export { useDataProvider, useGridDataProvider, useComboBoxDataProvider } from './data-provider.js';
package/index.js CHANGED
@@ -1,16 +1,12 @@
1
- function __REGISTER__(feature, vaadinObj = window.Vaadin ??= {}) {
2
- vaadinObj.registrations ??= [];
3
- vaadinObj.registrations.push({
4
- is: feature ? `${"@vaadin/hilla-react-crud"}/${feature}` : "@vaadin/hilla-react-crud",
5
- version: "24.7.0-alpha9"
6
- });
7
- }
8
- export * from "./autogrid-feature.js";
9
- export * from "./autoform-feature.js";
10
- export * from "./autocrud-feature.js";
11
- import { useDataProvider } from "./data-provider.js";
12
- __REGISTER__();
13
- export {
14
- useDataProvider
15
- };
16
- //# sourceMappingURL=index.js.map
1
+ export * from './autogrid-feature.js';
2
+ export * from './autoform-feature.js';
3
+ export * from './autocrud-feature.js';
4
+ export { useDataProvider, useGridDataProvider, useComboBoxDataProvider } from './data-provider.js';
5
+ ((feature, vaadinObj = (window.Vaadin ??= {})) => {
6
+ vaadinObj.registrations ??= [];
7
+ vaadinObj.registrations.push({
8
+ is: feature ? `@vaadin/hilla-react-crud/${feature}` : '@vaadin/hilla-react-crud',
9
+ version: '24.8.0-alpha1',
10
+ });
11
+ })();
12
+ //# sourceMappingURL=index.js.map