@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
@@ -1,102 +1,86 @@
1
- import {
2
- AutoGridBooleanRenderer,
3
- AutoGridDateRenderer,
4
- AutoGridDateTimeRenderer,
5
- AutoGridDecimalRenderer,
6
- AutoGridEnumRenderer,
7
- AutoGridIntegerRenderer,
8
- AutoGridJsonRenderer,
9
- AutoGridTimeRenderer
10
- } from "./autogrid-renderers";
11
- import {
12
- BooleanHeaderFilter,
13
- DateHeaderFilter,
14
- EnumHeaderFilter,
15
- NoHeaderFilter,
16
- NumberHeaderFilter,
17
- StringHeaderFilter,
18
- TimeHeaderFilter
19
- } from "./header-filter";
1
+ import { AutoGridBooleanRenderer, AutoGridDateRenderer, AutoGridDateTimeRenderer, AutoGridDecimalRenderer, AutoGridEnumRenderer, AutoGridIntegerRenderer, AutoGridJsonRenderer, AutoGridTimeRenderer, } from './autogrid-renderers';
2
+ import { BooleanHeaderFilter, DateHeaderFilter, EnumHeaderFilter, NoHeaderFilter, NumberHeaderFilter, StringHeaderFilter, TimeHeaderFilter, } from './header-filter';
20
3
  function getTypeColumnOptions(propertyInfo, customColumnOptions) {
21
- switch (propertyInfo.type) {
22
- case "integer":
23
- return {
24
- autoWidth: true,
25
- textAlign: "end",
26
- flexGrow: 0,
27
- renderer: AutoGridIntegerRenderer,
28
- headerFilterRenderer: NumberHeaderFilter
29
- };
30
- case "decimal":
31
- return {
32
- autoWidth: true,
33
- textAlign: "end",
34
- flexGrow: 0,
35
- renderer: AutoGridDecimalRenderer,
36
- headerFilterRenderer: NumberHeaderFilter
37
- };
38
- case "boolean":
39
- return {
40
- autoWidth: true,
41
- textAlign: "end",
42
- flexGrow: 0,
43
- renderer: AutoGridBooleanRenderer,
44
- headerFilterRenderer: BooleanHeaderFilter
45
- };
46
- case "date":
47
- return {
48
- autoWidth: true,
49
- textAlign: "end",
50
- flexGrow: 0,
51
- renderer: AutoGridDateRenderer,
52
- headerFilterRenderer: DateHeaderFilter
53
- };
54
- case "time":
55
- return {
56
- autoWidth: true,
57
- textAlign: "end",
58
- flexGrow: 0,
59
- renderer: AutoGridTimeRenderer,
60
- headerFilterRenderer: TimeHeaderFilter
61
- };
62
- case "datetime":
63
- return {
64
- autoWidth: true,
65
- textAlign: "end",
66
- flexGrow: 0,
67
- renderer: AutoGridDateTimeRenderer,
68
- headerFilterRenderer: DateHeaderFilter
69
- };
70
- case "enum":
71
- return {
72
- autoWidth: true,
73
- renderer: AutoGridEnumRenderer,
74
- headerFilterRenderer: EnumHeaderFilter
75
- };
76
- case "string":
77
- return {
78
- autoWidth: true,
79
- headerFilterRenderer: StringHeaderFilter
80
- };
81
- case "object":
82
- return {
83
- autoWidth: true,
84
- renderer: customColumnOptions?.path !== void 0 && customColumnOptions.renderer == null ? null : AutoGridJsonRenderer,
85
- headerFilterRenderer: NoHeaderFilter
86
- };
87
- default:
88
- return {
89
- autoWidth: true,
90
- headerFilterRenderer: NoHeaderFilter
91
- };
92
- }
4
+ switch (propertyInfo.type) {
5
+ case 'integer':
6
+ return {
7
+ autoWidth: true,
8
+ textAlign: 'end',
9
+ flexGrow: 0,
10
+ renderer: AutoGridIntegerRenderer,
11
+ headerFilterRenderer: NumberHeaderFilter,
12
+ };
13
+ case 'decimal':
14
+ return {
15
+ autoWidth: true,
16
+ textAlign: 'end',
17
+ flexGrow: 0,
18
+ renderer: AutoGridDecimalRenderer,
19
+ headerFilterRenderer: NumberHeaderFilter,
20
+ };
21
+ case 'boolean':
22
+ return {
23
+ autoWidth: true,
24
+ textAlign: 'end',
25
+ flexGrow: 0,
26
+ renderer: AutoGridBooleanRenderer,
27
+ headerFilterRenderer: BooleanHeaderFilter,
28
+ };
29
+ case 'date':
30
+ return {
31
+ autoWidth: true,
32
+ textAlign: 'end',
33
+ flexGrow: 0,
34
+ renderer: AutoGridDateRenderer,
35
+ headerFilterRenderer: DateHeaderFilter,
36
+ };
37
+ case 'time':
38
+ return {
39
+ autoWidth: true,
40
+ textAlign: 'end',
41
+ flexGrow: 0,
42
+ renderer: AutoGridTimeRenderer,
43
+ headerFilterRenderer: TimeHeaderFilter,
44
+ };
45
+ case 'datetime':
46
+ return {
47
+ autoWidth: true,
48
+ textAlign: 'end',
49
+ flexGrow: 0,
50
+ renderer: AutoGridDateTimeRenderer,
51
+ headerFilterRenderer: DateHeaderFilter,
52
+ };
53
+ case 'enum':
54
+ return {
55
+ autoWidth: true,
56
+ renderer: AutoGridEnumRenderer,
57
+ headerFilterRenderer: EnumHeaderFilter,
58
+ };
59
+ case 'string':
60
+ return {
61
+ autoWidth: true,
62
+ headerFilterRenderer: StringHeaderFilter,
63
+ };
64
+ case 'object':
65
+ return {
66
+ autoWidth: true,
67
+ renderer: customColumnOptions?.path !== undefined && customColumnOptions.renderer == null ? null : AutoGridJsonRenderer,
68
+ headerFilterRenderer: NoHeaderFilter,
69
+ };
70
+ default:
71
+ return {
72
+ autoWidth: true,
73
+ headerFilterRenderer: NoHeaderFilter,
74
+ };
75
+ }
93
76
  }
94
- function getColumnOptions(propertyInfo, customColumnOptions) {
95
- const typeColumnOptions = getTypeColumnOptions(propertyInfo, customColumnOptions);
96
- const headerFilterRenderer = customColumnOptions?.filterable === false ? NoHeaderFilter : typeColumnOptions.headerFilterRenderer ?? NoHeaderFilter;
97
- return customColumnOptions ? { ...typeColumnOptions, headerFilterRenderer, ...customColumnOptions } : typeColumnOptions;
77
+ export function getColumnOptions(propertyInfo, customColumnOptions) {
78
+ const typeColumnOptions = getTypeColumnOptions(propertyInfo, customColumnOptions);
79
+ const headerFilterRenderer = customColumnOptions?.filterable === false
80
+ ? NoHeaderFilter
81
+ : (typeColumnOptions.headerFilterRenderer ?? NoHeaderFilter);
82
+ return customColumnOptions
83
+ ? { ...typeColumnOptions, headerFilterRenderer, ...customColumnOptions }
84
+ : typeColumnOptions;
98
85
  }
99
- export {
100
- getColumnOptions
101
- };
102
- //# sourceMappingURL=autogrid-columns.js.map
86
+ //# sourceMappingURL=autogrid-columns.js.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["src/autogrid-columns.tsx"],
4
- "sourcesContent": ["import type { GridColumnProps } from '@vaadin/react-components/GridColumn.js';\nimport {\n AutoGridBooleanRenderer,\n AutoGridDateRenderer,\n AutoGridDateTimeRenderer,\n AutoGridDecimalRenderer,\n AutoGridEnumRenderer,\n AutoGridIntegerRenderer,\n AutoGridJsonRenderer,\n AutoGridTimeRenderer,\n} from './autogrid-renderers';\nimport {\n BooleanHeaderFilter,\n DateHeaderFilter,\n EnumHeaderFilter,\n type HeaderFilterProps,\n NoHeaderFilter,\n NumberHeaderFilter,\n StringHeaderFilter,\n TimeHeaderFilter,\n} from './header-filter';\nimport type { PropertyInfo } from './model-info';\n\nexport type ColumnOptions = HeaderFilterProps & Omit<GridColumnProps<any>, 'dangerouslySetInnerHTML'>;\n\n// eslint-disable-next-line consistent-return\nfunction getTypeColumnOptions(propertyInfo: PropertyInfo, customColumnOptions?: ColumnOptions): ColumnOptions {\n // eslint-disable-next-line default-case\n switch (propertyInfo.type) {\n case 'integer':\n return {\n autoWidth: true,\n textAlign: 'end',\n flexGrow: 0,\n renderer: AutoGridIntegerRenderer,\n headerFilterRenderer: NumberHeaderFilter,\n };\n case 'decimal':\n return {\n autoWidth: true,\n textAlign: 'end',\n flexGrow: 0,\n renderer: AutoGridDecimalRenderer,\n headerFilterRenderer: NumberHeaderFilter,\n };\n case 'boolean':\n return {\n autoWidth: true,\n textAlign: 'end',\n flexGrow: 0,\n renderer: AutoGridBooleanRenderer,\n headerFilterRenderer: BooleanHeaderFilter,\n };\n case 'date':\n return {\n autoWidth: true,\n textAlign: 'end',\n flexGrow: 0,\n renderer: AutoGridDateRenderer,\n headerFilterRenderer: DateHeaderFilter,\n };\n case 'time':\n return {\n autoWidth: true,\n textAlign: 'end',\n flexGrow: 0,\n renderer: AutoGridTimeRenderer,\n headerFilterRenderer: TimeHeaderFilter,\n };\n case 'datetime':\n return {\n autoWidth: true,\n textAlign: 'end',\n flexGrow: 0,\n renderer: AutoGridDateTimeRenderer,\n headerFilterRenderer: DateHeaderFilter,\n };\n case 'enum':\n return {\n autoWidth: true,\n renderer: AutoGridEnumRenderer,\n headerFilterRenderer: EnumHeaderFilter,\n };\n case 'string':\n return {\n autoWidth: true,\n headerFilterRenderer: StringHeaderFilter,\n };\n case 'object':\n return {\n autoWidth: true,\n renderer:\n customColumnOptions?.path !== undefined && customColumnOptions.renderer == null ? null : AutoGridJsonRenderer,\n headerFilterRenderer: NoHeaderFilter,\n };\n default:\n return {\n autoWidth: true,\n headerFilterRenderer: NoHeaderFilter,\n };\n }\n}\n\nexport function getColumnOptions(\n propertyInfo: PropertyInfo,\n customColumnOptions: ColumnOptions | undefined,\n): ColumnOptions {\n const typeColumnOptions = getTypeColumnOptions(propertyInfo, customColumnOptions);\n const headerFilterRenderer =\n customColumnOptions?.filterable === false\n ? NoHeaderFilter\n : (typeColumnOptions.headerFilterRenderer ?? NoHeaderFilter);\n // TODO: Remove eslint-disable when all TypeScript version issues are resolved\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n return customColumnOptions\n ? { ...typeColumnOptions, headerFilterRenderer, ...customColumnOptions }\n : typeColumnOptions;\n}\n"],
5
- "mappings": "AACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAA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A,MACxB;AAAA,EACJ;AACF;AAEO,SAAS,iBACd,cACA,qBACe;AACf,QAAM,oBAAoB,qBAAqB,cAAc,mBAAmB;AAChF,QAAM,uBACJ,qBAAqB,eAAe,QAChC,iBACC,kBAAkB,wBAAwB;AAGjD,SAAO,sBACH,EAAE,GAAG,mBAAmB,sBAAsB,GAAG,oBAAoB,IACrE;AACN;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"autogrid-columns.js","sourceRoot":"","sources":["src/autogrid-columns.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,wBAAwB,EACxB,uBAAuB,EACvB,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAEhB,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAMzB,SAAS,oBAAoB,CAAC,YAA0B,EAAE,mBAAmC;IAE3F,QAAQ,YAAY,CAAC,IAAI,EAAE,CAAC;QAC1B,KAAK,SAAS;YACZ,OAAO;gBACL,SAAS,EAAE,IAAI;gBACf,SAAS,EAAE,KAAK;gBAChB,QAAQ,EAAE,CAAC;gBACX,QAAQ,EAAE,uBAAuB;gBACjC,oBAAoB,EAAE,kBAAkB;aACzC,CAAC;QACJ,KAAK,SAAS;YACZ,OAAO;gBACL,SAAS,EAAE,IAAI;gBACf,SAAS,EAAE,KAAK;gBAChB,QAAQ,EAAE,CAAC;gBACX,QAAQ,EAAE,uBAAuB;gBACjC,oBAAoB,EAAE,kBAAkB;aACzC,CAAC;QACJ,KAAK,SAAS;YACZ,OAAO;gBACL,SAAS,EAAE,IAAI;gBACf,SAAS,EAAE,KAAK;gBAChB,QAAQ,EAAE,CAAC;gBACX,QAAQ,EAAE,uBAAuB;gBACjC,oBAAoB,EAAE,mBAAmB;aAC1C,CAA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ACxB,mBAAmB,EAAE,UAAU,KAAK,KAAK;QACvC,CAAC,CAAC,cAAc;QAChB,CAAC,CAAC,CAAC,iBAAiB,CAAC,oBAAoB,IAAI,cAAc,CAAC,CAAC;IAGjE,OAAO,mBAAmB;QACxB,CAAC,CAAC,EAAE,GAAG,iBAAiB,EAAE,oBAAoB,EAAE,GAAG,mBAAmB,EAAE;QACxE,CAAC,CAAC,iBAAiB,CAAC;AACxB,CAAC","sourcesContent":["import type { GridColumnProps } from '@vaadin/react-components/GridColumn.js';\nimport {\n AutoGridBooleanRenderer,\n AutoGridDateRenderer,\n AutoGridDateTimeRenderer,\n AutoGridDecimalRenderer,\n AutoGridEnumRenderer,\n AutoGridIntegerRenderer,\n AutoGridJsonRenderer,\n AutoGridTimeRenderer,\n} from './autogrid-renderers';\nimport {\n BooleanHeaderFilter,\n DateHeaderFilter,\n EnumHeaderFilter,\n type HeaderFilterProps,\n NoHeaderFilter,\n NumberHeaderFilter,\n StringHeaderFilter,\n TimeHeaderFilter,\n} from './header-filter';\nimport type { PropertyInfo } from './model-info';\n\nexport type ColumnOptions = HeaderFilterProps & Omit<GridColumnProps<any>, 'dangerouslySetInnerHTML'>;\n\n// eslint-disable-next-line consistent-return\nfunction getTypeColumnOptions(propertyInfo: PropertyInfo, customColumnOptions?: ColumnOptions): ColumnOptions {\n // eslint-disable-next-line default-case\n switch (propertyInfo.type) {\n case 'integer':\n return {\n autoWidth: true,\n textAlign: 'end',\n flexGrow: 0,\n renderer: AutoGridIntegerRenderer,\n headerFilterRenderer: NumberHeaderFilter,\n };\n case 'decimal':\n return {\n autoWidth: true,\n textAlign: 'end',\n flexGrow: 0,\n renderer: AutoGridDecimalRenderer,\n headerFilterRenderer: NumberHeaderFilter,\n };\n case 'boolean':\n return {\n autoWidth: true,\n textAlign: 'end',\n flexGrow: 0,\n renderer: AutoGridBooleanRenderer,\n headerFilterRenderer: BooleanHeaderFilter,\n };\n case 'date':\n return {\n autoWidth: true,\n textAlign: 'end',\n flexGrow: 0,\n renderer: AutoGridDateRenderer,\n headerFilterRenderer: DateHeaderFilter,\n };\n case 'time':\n return {\n autoWidth: true,\n textAlign: 'end',\n flexGrow: 0,\n renderer: AutoGridTimeRenderer,\n headerFilterRenderer: TimeHeaderFilter,\n };\n case 'datetime':\n return {\n autoWidth: true,\n textAlign: 'end',\n flexGrow: 0,\n renderer: AutoGridDateTimeRenderer,\n headerFilterRenderer: DateHeaderFilter,\n };\n case 'enum':\n return {\n autoWidth: true,\n renderer: AutoGridEnumRenderer,\n headerFilterRenderer: EnumHeaderFilter,\n };\n case 'string':\n return {\n autoWidth: true,\n headerFilterRenderer: StringHeaderFilter,\n };\n case 'object':\n return {\n autoWidth: true,\n renderer:\n customColumnOptions?.path !== undefined && customColumnOptions.renderer == null ? null : AutoGridJsonRenderer,\n headerFilterRenderer: NoHeaderFilter,\n };\n default:\n return {\n autoWidth: true,\n headerFilterRenderer: NoHeaderFilter,\n };\n }\n}\n\nexport function getColumnOptions(\n propertyInfo: PropertyInfo,\n customColumnOptions: ColumnOptions | undefined,\n): ColumnOptions {\n const typeColumnOptions = getTypeColumnOptions(propertyInfo, customColumnOptions);\n const headerFilterRenderer =\n customColumnOptions?.filterable === false\n ? NoHeaderFilter\n : (typeColumnOptions.headerFilterRenderer ?? NoHeaderFilter);\n // TODO: Remove eslint-disable when all TypeScript version issues are resolved\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n return customColumnOptions\n ? { ...typeColumnOptions, headerFilterRenderer, ...customColumnOptions }\n : typeColumnOptions;\n}\n"]}
@@ -1,4 +1,3 @@
1
1
  import { AutoGrid as _AutoGrid } from './autogrid.js';
2
2
  export * from './autogrid.js';
3
3
  export declare const AutoGrid: typeof _AutoGrid;
4
- //# sourceMappingURL=autogrid-feature.d.ts.map
@@ -1,8 +1,5 @@
1
- import { AutoGrid as _AutoGrid } from "./autogrid.js";
2
- import { featureRegistration } from "./util";
3
- export * from "./autogrid.js";
4
- const AutoGrid = featureRegistration(_AutoGrid, "AutoGrid");
5
- export {
6
- AutoGrid
7
- };
8
- //# sourceMappingURL=autogrid-feature.js.map
1
+ import { AutoGrid as _AutoGrid } from './autogrid.js';
2
+ import { featureRegistration } from './util';
3
+ export * from './autogrid.js';
4
+ export const AutoGrid = featureRegistration(_AutoGrid, 'AutoGrid');
5
+ //# sourceMappingURL=autogrid-feature.js.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["src/autogrid-feature.ts"],
4
- "sourcesContent": ["/* eslint-disable import/export */\nimport { AutoGrid as _AutoGrid } from './autogrid.js';\nimport { featureRegistration } from './util';\n\nexport * from './autogrid.js';\n\nexport const AutoGrid: typeof _AutoGrid = featureRegistration(_AutoGrid, 'AutoGrid');\n"],
5
- "mappings": "AACA,SAAS,YAAY,iBAAiB;AACtC,SAAS,2BAA2B;AAEpC,cAAc;AAEP,MAAM,WAA6B,oBAAoB,WAAW,UAAU;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"autogrid-feature.js","sourceRoot":"","sources":["src/autogrid-feature.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,IAAI,SAAS,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAE7C,cAAc,eAAe,CAAC;AAE9B,MAAM,CAAC,MAAM,QAAQ,GAAqB,mBAAmB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC","sourcesContent":["/* eslint-disable import/export */\nimport { AutoGrid as _AutoGrid } from './autogrid.js';\nimport { featureRegistration } from './util';\n\nexport * from './autogrid.js';\n\nexport const AutoGrid: typeof _AutoGrid = featureRegistration(_AutoGrid, 'AutoGrid');\n"]}
@@ -25,4 +25,3 @@ export type FooterContextType = {
25
25
  };
26
26
  export declare const FooterContext: import("react").Context<FooterContextType>;
27
27
  export declare function AutoGridFooterItemCountRenderer(): JSX.Element;
28
- //# sourceMappingURL=autogrid-renderers.d.ts.map
@@ -1,92 +1,83 @@
1
- import { Fragment, jsx } from "react/jsx-runtime";
2
- import { Icon } from "@vaadin/react-components/Icon.js";
3
- import { createContext, useContext } from "react";
4
- import { ColumnContext } from "./autogrid-column-context";
5
- import { useLocaleFormatter } from "./locale.js";
6
- import { convertToTitleCase } from "./util";
7
- import "@vaadin/vaadin-lumo-styles/vaadin-iconset.js";
1
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Icon } from '@vaadin/react-components/Icon.js';
3
+ import { createContext, useContext } from 'react';
4
+ import { ColumnContext } from './autogrid-column-context';
5
+ import { useLocaleFormatter } from './locale.js';
6
+ import { convertToTitleCase } from './util';
7
+ import '@vaadin/vaadin-lumo-styles/vaadin-iconset.js';
8
8
  function getColumnValue(context, item) {
9
- const path = context.propertyInfo.name;
10
- return path.split(".").reduce((obj, property) => obj ? obj[property] : void 0, item);
9
+ const path = context.propertyInfo.name;
10
+ return path.split('.').reduce((obj, property) => (obj ? obj[property] : undefined), item);
11
11
  }
12
- const fontVariantStyle = { fontVariantNumeric: "tabular-nums" };
13
- function AutoGridIntegerRenderer({ item }) {
14
- const formatter = useLocaleFormatter();
15
- const context = useContext(ColumnContext);
16
- return /* @__PURE__ */ jsx("span", { style: fontVariantStyle, children: formatter.formatInteger(getColumnValue(context, item)) });
12
+ const fontVariantStyle = { fontVariantNumeric: 'tabular-nums' };
13
+ export function AutoGridIntegerRenderer({ item }) {
14
+ const formatter = useLocaleFormatter();
15
+ const context = useContext(ColumnContext);
16
+ return _jsx("span", { style: fontVariantStyle, children: formatter.formatInteger(getColumnValue(context, item)) });
17
17
  }
18
- function AutoGridDecimalRenderer({ item }) {
19
- const formatter = useLocaleFormatter();
20
- const context = useContext(ColumnContext);
21
- return /* @__PURE__ */ jsx("span", { style: fontVariantStyle, children: formatter.formatDecimal(getColumnValue(context, item)) });
18
+ export function AutoGridDecimalRenderer({ item }) {
19
+ const formatter = useLocaleFormatter();
20
+ const context = useContext(ColumnContext);
21
+ return _jsx("span", { style: fontVariantStyle, children: formatter.formatDecimal(getColumnValue(context, item)) });
22
22
  }
23
- function AutoGridEnumRenderer({ item }) {
24
- const context = useContext(ColumnContext);
25
- const value = getColumnValue(context, item) || "";
26
- return /* @__PURE__ */ jsx("span", { children: convertToTitleCase(value) });
23
+ export function AutoGridEnumRenderer({ item }) {
24
+ const context = useContext(ColumnContext);
25
+ const value = getColumnValue(context, item) || '';
26
+ return _jsx("span", { children: convertToTitleCase(value) });
27
27
  }
28
- function AutoGridBooleanRenderer({ item }) {
29
- const context = useContext(ColumnContext);
30
- const value = getColumnValue(context, item);
31
- if (value) {
32
- return /* @__PURE__ */ jsx(Icon, { "aria-label": "false", icon: "lumo:checkmark" });
33
- }
34
- return /* @__PURE__ */ jsx(Icon, { "aria-label": "true", style: { color: "var(--lumo-secondary-text-color)" }, icon: "lumo:minus" });
28
+ export function AutoGridBooleanRenderer({ item }) {
29
+ const context = useContext(ColumnContext);
30
+ const value = getColumnValue(context, item);
31
+ if (value) {
32
+ return _jsx(Icon, { "aria-label": "false", icon: "lumo:checkmark" });
33
+ }
34
+ return _jsx(Icon, { "aria-label": "true", style: { color: 'var(--lumo-secondary-text-color)' }, icon: "lumo:minus" });
35
35
  }
36
- function AutoGridDateRenderer({ item }) {
37
- const formatter = useLocaleFormatter();
38
- const context = useContext(ColumnContext);
39
- return /* @__PURE__ */ jsx("span", { style: fontVariantStyle, children: formatter.formatDate(getColumnValue(context, item)) });
36
+ export function AutoGridDateRenderer({ item }) {
37
+ const formatter = useLocaleFormatter();
38
+ const context = useContext(ColumnContext);
39
+ return _jsx("span", { style: fontVariantStyle, children: formatter.formatDate(getColumnValue(context, item)) });
40
40
  }
41
- function AutoGridTimeRenderer({ item }) {
42
- const formatter = useLocaleFormatter();
43
- const context = useContext(ColumnContext);
44
- return /* @__PURE__ */ jsx("span", { style: fontVariantStyle, children: formatter.formatLocalTime(getColumnValue(context, item)) });
41
+ export function AutoGridTimeRenderer({ item }) {
42
+ const formatter = useLocaleFormatter();
43
+ const context = useContext(ColumnContext);
44
+ return _jsx("span", { style: fontVariantStyle, children: formatter.formatLocalTime(getColumnValue(context, item)) });
45
45
  }
46
- function AutoGridDateTimeRenderer({ item }) {
47
- const formatter = useLocaleFormatter();
48
- const context = useContext(ColumnContext);
49
- return /* @__PURE__ */ jsx("span", { style: fontVariantStyle, children: formatter.formatLocalDateTime(getColumnValue(context, item)) });
46
+ export function AutoGridDateTimeRenderer({ item }) {
47
+ const formatter = useLocaleFormatter();
48
+ const context = useContext(ColumnContext);
49
+ return _jsx("span", { style: fontVariantStyle, children: formatter.formatLocalDateTime(getColumnValue(context, item)) });
50
50
  }
51
- function AutoGridJsonRenderer({ item }) {
52
- const context = useContext(ColumnContext);
53
- const value = getColumnValue(context, item);
54
- const jsonString = value ? JSON.stringify(value) : "";
55
- const jsonPreview = jsonString.length > 50 ? `${jsonString.substring(0, 50)}...` : jsonString;
56
- return /* @__PURE__ */ jsx("span", { children: jsonPreview });
51
+ export function AutoGridJsonRenderer({ item }) {
52
+ const context = useContext(ColumnContext);
53
+ const value = getColumnValue(context, item);
54
+ const jsonString = value ? JSON.stringify(value) : '';
55
+ const jsonPreview = jsonString.length > 50 ? `${jsonString.substring(0, 50)}...` : jsonString;
56
+ return _jsx("span", { children: jsonPreview });
57
57
  }
58
- function AutoGridRowNumberRenderer({ model }) {
59
- return /* @__PURE__ */ jsx(Fragment, { children: model.index + 1 });
58
+ export function AutoGridRowNumberRenderer({ model }) {
59
+ return _jsx(_Fragment, { children: model.index + 1 });
60
60
  }
61
- const FooterContext = createContext(void 0);
62
- function AutoGridFooterItemCountRenderer() {
63
- const footerContext = useContext(FooterContext);
64
- const { totalCount, filteredCount, itemCounts, footerCountRenderer: FooterRenderer } = footerContext;
65
- if (FooterRenderer) {
66
- return /* @__PURE__ */ jsx(FooterRenderer, { ...itemCounts });
67
- }
68
- let filterCountText;
69
- if (filteredCount && itemCounts?.filteredCount !== void 0) {
70
- filterCountText = totalCount && itemCounts.totalCount !== void 0 ? `Showing: ${itemCounts.filteredCount} out of ${itemCounts.totalCount}` : `Showing: ${itemCounts.filteredCount}`;
71
- } else if (totalCount && itemCounts?.totalCount !== void 0) {
72
- filterCountText = `Total: ${itemCounts.totalCount}`;
73
- }
74
- if (filterCountText) {
75
- return /* @__PURE__ */ jsx("p", { children: filterCountText });
76
- }
77
- return /* @__PURE__ */ jsx(Fragment, {});
61
+ export const FooterContext = createContext(undefined);
62
+ export function AutoGridFooterItemCountRenderer() {
63
+ const footerContext = useContext(FooterContext);
64
+ const { totalCount, filteredCount, itemCounts, footerCountRenderer: FooterRenderer } = footerContext;
65
+ if (FooterRenderer) {
66
+ return _jsx(FooterRenderer, { ...itemCounts });
67
+ }
68
+ let filterCountText;
69
+ if (filteredCount && itemCounts?.filteredCount !== undefined) {
70
+ filterCountText =
71
+ totalCount && itemCounts.totalCount !== undefined
72
+ ? `Showing: ${itemCounts.filteredCount} out of ${itemCounts.totalCount}`
73
+ : `Showing: ${itemCounts.filteredCount}`;
74
+ }
75
+ else if (totalCount && itemCounts?.totalCount !== undefined) {
76
+ filterCountText = `Total: ${itemCounts.totalCount}`;
77
+ }
78
+ if (filterCountText) {
79
+ return _jsx("p", { children: filterCountText });
80
+ }
81
+ return _jsx(_Fragment, {});
78
82
  }
79
- export {
80
- AutoGridBooleanRenderer,
81
- AutoGridDateRenderer,
82
- AutoGridDateTimeRenderer,
83
- AutoGridDecimalRenderer,
84
- AutoGridEnumRenderer,
85
- AutoGridFooterItemCountRenderer,
86
- AutoGridIntegerRenderer,
87
- AutoGridJsonRenderer,
88
- AutoGridRowNumberRenderer,
89
- AutoGridTimeRenderer,
90
- FooterContext
91
- };
92
- //# sourceMappingURL=autogrid-renderers.js.map
83
+ //# sourceMappingURL=autogrid-renderers.js.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["src/autogrid-renderers.tsx"],
4
- "sourcesContent": ["import type { GridItemModel } from '@vaadin/react-components/Grid.js';\nimport type { GridColumnElement } from '@vaadin/react-components/GridColumn.js';\nimport { Icon } from '@vaadin/react-components/Icon.js';\nimport { type ComponentType, createContext, type CSSProperties, type JSX, useContext } from 'react';\nimport { ColumnContext } from './autogrid-column-context';\nimport type { ItemCounts } from './data-provider';\nimport { useLocaleFormatter } from './locale.js';\nimport { convertToTitleCase } from './util';\n\n// eslint-disable-next-line\nimport '@vaadin/vaadin-lumo-styles/vaadin-iconset.js';\n\nexport type RendererOptions<TItem> = {\n item: TItem;\n model: GridItemModel<TItem>;\n original: GridColumnElement<TItem>;\n};\n\nfunction getColumnValue<TItem>(context: ColumnContext, item: TItem): any {\n const path = context.propertyInfo.name;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n return path.split('.').reduce<any>((obj, property) => (obj ? obj[property] : undefined), item);\n}\n\nconst fontVariantStyle: CSSProperties = { fontVariantNumeric: 'tabular-nums' };\n\nexport function AutoGridIntegerRenderer<TItem>({ item }: RendererOptions<TItem>): JSX.Element {\n const formatter = useLocaleFormatter();\n const context = useContext(ColumnContext)!;\n return <span style={fontVariantStyle}>{formatter.formatInteger(getColumnValue(context, item))}</span>;\n}\n\nexport function AutoGridDecimalRenderer<TItem>({ item }: RendererOptions<TItem>): JSX.Element {\n const formatter = useLocaleFormatter();\n const context = useContext(ColumnContext)!;\n return <span style={fontVariantStyle}>{formatter.formatDecimal(getColumnValue(context, item))}</span>;\n}\n\nexport function AutoGridEnumRenderer<TItem>({ item }: RendererOptions<TItem>): JSX.Element {\n const context = useContext(ColumnContext)!;\n const value = getColumnValue(context, item) || '';\n return <span>{convertToTitleCase(value)}</span>;\n}\n\nexport function AutoGridBooleanRenderer<TItem>({ item }: RendererOptions<TItem>): JSX.Element {\n const context = useContext(ColumnContext)!;\n const value = getColumnValue(context, item);\n if (value) {\n return <Icon aria-label=\"false\" icon=\"lumo:checkmark\" />;\n }\n return <Icon aria-label=\"true\" style={{ color: 'var(--lumo-secondary-text-color)' }} icon=\"lumo:minus\" />;\n}\n\nexport function AutoGridDateRenderer<TItem>({ item }: RendererOptions<TItem>): JSX.Element {\n const formatter = useLocaleFormatter();\n const context = useContext(ColumnContext)!;\n return <span style={fontVariantStyle}>{formatter.formatDate(getColumnValue(context, item))}</span>;\n}\n\nexport function AutoGridTimeRenderer<TItem>({ item }: RendererOptions<TItem>): JSX.Element {\n const formatter = useLocaleFormatter();\n const context = useContext(ColumnContext)!;\n return <span style={fontVariantStyle}>{formatter.formatLocalTime(getColumnValue(context, item))}</span>;\n}\n\nexport function AutoGridDateTimeRenderer<TItem>({ item }: RendererOptions<TItem>): JSX.Element {\n const formatter = useLocaleFormatter();\n const context = useContext(ColumnContext)!;\n return <span style={fontVariantStyle}>{formatter.formatLocalDateTime(getColumnValue(context, item))}</span>;\n}\n\nexport function AutoGridJsonRenderer<TItem>({ item }: RendererOptions<TItem>): JSX.Element {\n const context = useContext(ColumnContext)!;\n const value = getColumnValue(context, item);\n const jsonString = value ? JSON.stringify(value) : '';\n const jsonPreview = jsonString.length > 50 ? `${jsonString.substring(0, 50)}...` : jsonString;\n return <span>{jsonPreview}</span>;\n}\n\nexport function AutoGridRowNumberRenderer<TItem>({ model }: RendererOptions<TItem>): JSX.Element {\n return <>{model.index + 1}</>;\n}\n\nexport type FooterContextType = {\n totalCount?: boolean;\n filteredCount?: boolean;\n footerCountRenderer?: ComponentType<ItemCounts>;\n itemCounts?: ItemCounts;\n};\n\nexport const FooterContext = createContext<FooterContextType>(undefined!);\n\nexport function AutoGridFooterItemCountRenderer(): JSX.Element {\n const footerContext = useContext(FooterContext);\n const { totalCount, filteredCount, itemCounts, footerCountRenderer: FooterRenderer } = footerContext;\n\n if (FooterRenderer) {\n return <FooterRenderer {...itemCounts} />;\n }\n\n let filterCountText: string | undefined;\n if (filteredCount && itemCounts?.filteredCount !== undefined) {\n filterCountText =\n totalCount && itemCounts.totalCount !== undefined\n ? `Showing: ${itemCounts.filteredCount} out of ${itemCounts.totalCount}`\n : `Showing: ${itemCounts.filteredCount}`;\n } else if (totalCount && itemCounts?.totalCount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yBAAO,WAAW,GAAQ,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAQ,EAAE,KAAK,EAA0B;IAChF,OAAO,4BAAG,KAAK,CAAC,KAAK,GAAG,CAAC,GAAI,CAAC;AAChC,CAAC;AASD,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAAoB,SAAU,CAAC,CAAC;AAE1E,MAAM,UAAU,+BAA+B;IAC7C,MAAM,aAAa,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;IAChD,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,mBAAmB,EAAE,cAAc,EAAE,GAAG,aAAa,CAAC;IAErG,IAAI,cAAc,EAAE,CAAC;QACnB,OAAO,KAAC,cAAc,OAAK,UAAU,GAAI,CAAC;IAC5C,CAAC;IAED,IAAI,eAAmC,CAAC;IACxC,IAAI,aAAa,IAAI,UAAU,EAAE,aAAa,KAAK,SAAS,EAAE,CAAC;QAC7D,eAAe;YACb,UAAU,IAAI,UAAU,CAAC,UAAU,KAAK,SAAS;gBAC/C,CAAC,CAAC,YAAY,UAAU,CAAC,aAAa,WAAW,UAAU,CAAC,UAAU,EAAE;gBACxE,CAAC,CAAC,YAAY,UAAU,CAAC,aAAa,EAAE,CAAC;IAC/C,CAAC;SAAM,IAAI,UAAU,IAAI,UAAU,EAAE,UAAU,KAAK,SAAS,EAAE,CAAC;QAC9D,eAAe,GAAG,UAAU,UAAU,CAAC,UAAU,EAAE,CAAC;IACtD,CAAC;IACD,IAAI,eAAe,EAAE,CAAC;QACpB,OAAO,sBAAI,eAAe,GAAK,CAAC;IAClC,CAAC;IACD,OAAO,mBAAK,CAAC;AACf,CAAC","sourcesContent":["import type { GridItemModel } from '@vaadin/react-components/Grid.js';\nimport type { GridColumnElement } from '@vaadin/react-components/GridColumn.js';\nimport { Icon } from '@vaadin/react-components/Icon.js';\nimport { type ComponentType, createContext, type CSSProperties, type JSX, useContext } from 'react';\nimport { ColumnContext } from './autogrid-column-context';\nimport type { ItemCounts } from './data-provider';\nimport { useLocaleFormatter } from './locale.js';\nimport { convertToTitleCase } from './util';\n\n// eslint-disable-next-line\nimport '@vaadin/vaadin-lumo-styles/vaadin-iconset.js';\n\nexport type RendererOptions<TItem> = {\n item: TItem;\n model: GridItemModel<TItem>;\n original: GridColumnElement<TItem>;\n};\n\nfunction getColumnValue<TItem>(context: ColumnContext, item: TItem): any {\n const path = context.propertyInfo.name;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n return path.split('.').reduce<any>((obj, property) => (obj ? obj[property] : undefined), item);\n}\n\nconst fontVariantStyle: CSSProperties = { fontVariantNumeric: 'tabular-nums' };\n\nexport function AutoGridIntegerRenderer<TItem>({ item }: RendererOptions<TItem>): JSX.Element {\n const formatter = useLocaleFormatter();\n const context = useContext(ColumnContext)!;\n return <span style={fontVariantStyle}>{formatter.formatInteger(getColumnValue(context, item))}</span>;\n}\n\nexport function AutoGridDecimalRenderer<TItem>({ item }: RendererOptions<TItem>): JSX.Element {\n const formatter = useLocaleFormatter();\n const context = useContext(ColumnContext)!;\n return <span style={fontVariantStyle}>{formatter.formatDecimal(getColumnValue(context, item))}</span>;\n}\n\nexport function AutoGridEnumRenderer<TItem>({ item }: RendererOptions<TItem>): JSX.Element {\n const context = useContext(ColumnContext)!;\n const value = getColumnValue(context, item) || '';\n return <span>{convertToTitleCase(value)}</span>;\n}\n\nexport function AutoGridBooleanRenderer<TItem>({ item }: RendererOptions<TItem>): JSX.Element {\n const context = useContext(ColumnContext)!;\n const value = getColumnValue(context, item);\n if (value) {\n return <Icon aria-label=\"false\" icon=\"lumo:checkmark\" />;\n }\n return <Icon aria-label=\"true\" style={{ color: 'var(--lumo-secondary-text-color)' }} icon=\"lumo:minus\" />;\n}\n\nexport function AutoGridDateRenderer<TItem>({ item }: RendererOptions<TItem>): JSX.Element {\n const formatter = useLocaleFormatter();\n const context = useContext(ColumnContext)!;\n return <span style={fontVariantStyle}>{formatter.formatDate(getColumnValue(context, item))}</span>;\n}\n\nexport function AutoGridTimeRenderer<TItem>({ item }: RendererOptions<TItem>): JSX.Element {\n const formatter = useLocaleFormatter();\n const context = useContext(ColumnContext)!;\n return <span style={fontVariantStyle}>{formatter.formatLocalTime(getColumnValue(context, item))}</span>;\n}\n\nexport function AutoGridDateTimeRenderer<TItem>({ item }: RendererOptions<TItem>): JSX.Element {\n const formatter = useLocaleFormatter();\n const context = useContext(ColumnContext)!;\n return <span style={fontVariantStyle}>{formatter.formatLocalDateTime(getColumnValue(context, item))}</span>;\n}\n\nexport function AutoGridJsonRenderer<TItem>({ item }: RendererOptions<TItem>): JSX.Element {\n const context = useContext(ColumnContext)!;\n const value = getColumnValue(context, item);\n const jsonString = value ? JSON.stringify(value) : '';\n const jsonPreview = jsonString.length > 50 ? `${jsonString.substring(0, 50)}...` : jsonString;\n return <span>{jsonPreview}</span>;\n}\n\nexport function AutoGridRowNumberRenderer<TItem>({ model }: RendererOptions<TItem>): JSX.Element {\n return <>{model.index + 1}</>;\n}\n\nexport type FooterContextType = {\n totalCount?: boolean;\n filteredCount?: boolean;\n footerCountRenderer?: ComponentType<ItemCounts>;\n itemCounts?: ItemCounts;\n};\n\nexport const FooterContext = createContext<FooterContextType>(undefined!);\n\nexport function AutoGridFooterItemCountRenderer(): JSX.Element {\n const footerContext = useContext(FooterContext);\n const { totalCount, filteredCount, itemCounts, footerCountRenderer: FooterRenderer } = footerContext;\n\n if (FooterRenderer) {\n return <FooterRenderer {...itemCounts} />;\n }\n\n let filterCountText: string | undefined;\n if (filteredCount && itemCounts?.filteredCount !== undefined) {\n filterCountText =\n totalCount && itemCounts.totalCount !== undefined\n ? `Showing: ${itemCounts.filteredCount} out of ${itemCounts.totalCount}`\n : `Showing: ${itemCounts.filteredCount}`;\n } else if (totalCount && itemCounts?.totalCount !== undefined) {\n filterCountText = `Total: ${itemCounts.totalCount}`;\n }\n if (filterCountText) {\n return <p>{filterCountText}</p>;\n }\n return <></>;\n}\n"]}
package/autogrid.d.ts CHANGED
@@ -2,114 +2,27 @@ import type { AbstractModel, DetachedModelConstructor } from '@vaadin/hilla-lit-
2
2
  import { type GridElement, type GridProps } from '@vaadin/react-components/Grid.js';
3
3
  import { type ComponentType, type ForwardedRef, type JSX } from 'react';
4
4
  import { type ColumnOptions } from './autogrid-columns.js';
5
- import type { ListService } from './crud';
5
+ import type { ListService } from './crud.js';
6
6
  import { type ItemCounts } from './data-provider.js';
7
7
  import { type HeaderFilterRendererProps } from './header-filter';
8
8
  import type FilterUnion from './types/com/vaadin/hilla/crud/filter/FilterUnion.js';
9
9
  export interface AutoGridRef<TItem = any> {
10
- /**
11
- * The underlying vaadin-grid DOM element.
12
- */
13
10
  grid: GridElement<TItem> | null;
14
- /**
15
- * Refreshes the grid by reloading the data from the backend.
16
- */
17
11
  refresh(): void;
18
12
  }
19
13
  interface AutoGridOwnProps<TItem> {
20
- /**
21
- * The service to use for fetching the data. This must be a TypeScript service
22
- * that has been generated by Hilla from a backend Java service that
23
- * implements the `com.vaadin.hilla.crud.ListService` interface.
24
- */
25
14
  service: ListService<TItem>;
26
- /**
27
- * The entity model to use for the grid, which determines which columns to
28
- * show and how to render them. This must be a Typescript model class that has
29
- * been generated by Hilla from a backend Java class. The model must match
30
- * with the type of the items returned by the service. For example, a
31
- * `PersonModel` can be used with a service that returns `Person` instances.
32
- *
33
- * By default, the grid shows columns for all properties of the model which
34
- * have a type that is supported. Use the `visibleColumns` option to customize
35
- * which columns to show and in which order.
36
- */
37
15
  model: DetachedModelConstructor<AbstractModel<TItem>>;
38
- /**
39
- * The property to use to detect an item's ID. The item ID is used to keep
40
- * the selection state when reloading the grid.
41
- *
42
- * By default, the component uses the property annotated with
43
- * `jakarta.persistence.Id`, or a property named `id`, in that order.
44
- * This option can be used to override the default behavior, or define the ID
45
- * property in case a class doesn't have a property matching the defaults.
46
- */
47
16
  itemIdProperty?: string;
48
- /**
49
- * Allows to provide a filter that is applied when fetching data from the
50
- * service. This can be used for implementing an external filter UI outside
51
- * the grid. A custom filter is not compatible with header filters.
52
- *
53
- * **NOTE:** This is considered an experimental feature and the API may change
54
- * in the future.
55
- */
56
17
  experimentalFilter?: FilterUnion;
57
- /**
58
- * Allows to customize which columns to show and in which order. This must be
59
- * an array of property names that are defined in the model. Nested properties
60
- * can be specified using dot notation, e.g. `address.street`.
61
- */
62
18
  visibleColumns?: string[];
63
- /**
64
- * Allows to customize which columns to hide. This must be an array of property
65
- * names that are defined in the model. Nested properties can be specified using
66
- * dot notation, e.g. `address.street`.
67
- */
68
19
  hiddenColumns?: string[];
69
- /**
70
- * Disables header filters, which are otherwise enabled by default.
71
- */
72
20
  noHeaderFilters?: boolean;
73
- /**
74
- * Allows to add custom columns to the grid. This must be an array of
75
- * `GridColumn` component instances. Custom columns are added after the
76
- * auto-generated columns.
77
- */
78
21
  customColumns?: JSX.Element[];
79
- /**
80
- * Allows to customize the props for individual columns. This is an object
81
- * where the keys must be property names that are defined in the model, and
82
- * the values are props that are accepted by the `GridColumn` component.
83
- * Nested properties can be specified using dot notation, e.g.
84
- * `address.street`.
85
- */
86
22
  columnOptions?: Record<string, ColumnOptions>;
87
- /**
88
- * When enabled, inserts a column with row numbers at the beginning of the
89
- * grid.
90
- */
91
23
  rowNumbers?: boolean;
92
- /**
93
- * When enabled, shows the total count of items in the grid footer.
94
- * This requires the provided service to implement the CountService interface,
95
- * otherwise an error will be logged to the console, without any count being
96
- * rendered.
97
- */
98
24
  totalCount?: boolean;
99
- /**
100
- * When enabled, shows the filtered item count in the grid footer.
101
- * if totalCount is also enabled, it will show both totalCount and filteredCount.
102
- * This requires the provided service to implement the CountService interface,
103
- * otherwise an error will be logged to the console, without any count being
104
- * rendered.
105
- */
106
25
  filteredCount?: boolean;
107
- /**
108
- * Allows to customize the grid footer with a custom renderer component for
109
- * the total count and filtered item count.
110
- * This requires the provided service to implement the CountService interface,
111
- * See {@link AutoGrid#totalCount} and {@link AutoGrid#filteredCount}.
112
- */
113
26
  footerCountRenderer?: ComponentType<ItemCounts>;
114
27
  }
115
28
  export type AutoGridProps<TItem> = GridProps<TItem> & Readonly<AutoGridOwnProps<TItem>>;
@@ -117,20 +30,5 @@ declare function AutoGridInner<TItem>({ service, model, itemIdProperty, experime
117
30
  type AutoGrid = <TItem>(props: AutoGridProps<TItem> & {
118
31
  ref?: ForwardedRef<AutoGridRef<TItem>>;
119
32
  }) => ReturnType<typeof AutoGridInner>;
120
- /**
121
- * Auto Grid is a component for displaying tabular data based on a Java backend
122
- * service. It automatically generates columns based on the properties of a
123
- * Java class and provides features such as lazy-loading, sorting and filtering.
124
- *
125
- * Example usage:
126
- * ```tsx
127
- * import { AutoGrid } from '@vaadin/hilla-react-crud';
128
- * import PersonService from 'Frontend/generated/endpoints';
129
- * import PersonModel from 'Frontend/generated/com/example/application/Person';
130
- *
131
- * <AutoGrid service={PersonService} model={PersonModel} />
132
- * ```
133
- */
134
33
  export declare const AutoGrid: AutoGrid;
135
34
  export type { ColumnOptions, HeaderFilterRendererProps };
136
- //# sourceMappingURL=autogrid.d.ts.map