@vaadin/hilla-react-crud 24.4.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 (172) hide show
  1. package/.lintstagedrc.js +6 -0
  2. package/LICENSE +201 -0
  3. package/README.md +27 -0
  4. package/autocrud-dialog.d.ts +11 -0
  5. package/autocrud-dialog.d.ts.map +1 -0
  6. package/autocrud-dialog.js +24 -0
  7. package/autocrud-dialog.js.map +7 -0
  8. package/autocrud-feature.d.ts +4 -0
  9. package/autocrud-feature.d.ts.map +1 -0
  10. package/autocrud-feature.js +8 -0
  11. package/autocrud-feature.js.map +7 -0
  12. package/autocrud.d.ts +82 -0
  13. package/autocrud.d.ts.map +1 -0
  14. package/autocrud.js +94 -0
  15. package/autocrud.js.map +7 -0
  16. package/autocrud.obj.js +6 -0
  17. package/autocrud.obj.js.map +7 -0
  18. package/autoform-feature.d.ts +4 -0
  19. package/autoform-feature.d.ts.map +1 -0
  20. package/autoform-feature.js +8 -0
  21. package/autoform-feature.js.map +7 -0
  22. package/autoform-field.d.ts +122 -0
  23. package/autoform-field.d.ts.map +1 -0
  24. package/autoform-field.js +118 -0
  25. package/autoform-field.js.map +7 -0
  26. package/autoform.d.ts +228 -0
  27. package/autoform.d.ts.map +1 -0
  28. package/autoform.js +178 -0
  29. package/autoform.js.map +7 -0
  30. package/autoform.obj.js +6 -0
  31. package/autoform.obj.js.map +7 -0
  32. package/autogrid-column-context.d.ts +39 -0
  33. package/autogrid-column-context.d.ts.map +1 -0
  34. package/autogrid-column-context.js +8 -0
  35. package/autogrid-column-context.js.map +7 -0
  36. package/autogrid-columns.d.ts +6 -0
  37. package/autogrid-columns.d.ts.map +1 -0
  38. package/autogrid-columns.js +102 -0
  39. package/autogrid-columns.js.map +7 -0
  40. package/autogrid-feature.d.ts +4 -0
  41. package/autogrid-feature.d.ts.map +1 -0
  42. package/autogrid-feature.js +8 -0
  43. package/autogrid-feature.js.map +7 -0
  44. package/autogrid-renderers.d.ts +28 -0
  45. package/autogrid-renderers.d.ts.map +1 -0
  46. package/autogrid-renderers.js +92 -0
  47. package/autogrid-renderers.js.map +7 -0
  48. package/autogrid.d.ts +130 -0
  49. package/autogrid.d.ts.map +1 -0
  50. package/autogrid.js +234 -0
  51. package/autogrid.js.map +7 -0
  52. package/autogrid.obj.js +6 -0
  53. package/autogrid.obj.js.map +7 -0
  54. package/crud.d.js +1 -0
  55. package/crud.d.js.map +7 -0
  56. package/crud.d.ts +17 -0
  57. package/data-provider.d.ts +56 -0
  58. package/data-provider.d.ts.map +1 -0
  59. package/data-provider.js +121 -0
  60. package/data-provider.js.map +7 -0
  61. package/header-filter.d.ts +54 -0
  62. package/header-filter.d.ts.map +1 -0
  63. package/header-filter.js +258 -0
  64. package/header-filter.js.map +7 -0
  65. package/header-sorter.d.ts +3 -0
  66. package/header-sorter.d.ts.map +1 -0
  67. package/header-sorter.js +28 -0
  68. package/header-sorter.js.map +7 -0
  69. package/i18n.d.ts +2 -0
  70. package/i18n.d.ts.map +1 -0
  71. package/i18n.js +5 -0
  72. package/i18n.js.map +7 -0
  73. package/index.d.ts +5 -0
  74. package/index.d.ts.map +1 -0
  75. package/index.js +13 -0
  76. package/index.js.map +7 -0
  77. package/locale.d.ts +19 -0
  78. package/locale.d.ts.map +1 -0
  79. package/locale.js +123 -0
  80. package/locale.js.map +7 -0
  81. package/media-query.d.ts +2 -0
  82. package/media-query.d.ts.map +1 -0
  83. package/media-query.js +16 -0
  84. package/media-query.js.map +7 -0
  85. package/model-info.d.ts +23 -0
  86. package/model-info.d.ts.map +1 -0
  87. package/model-info.js +137 -0
  88. package/model-info.js.map +7 -0
  89. package/package.json +87 -0
  90. package/types/com/vaadin/hilla/crud/filter/AndFilter.d.js +1 -0
  91. package/types/com/vaadin/hilla/crud/filter/AndFilter.d.js.map +7 -0
  92. package/types/com/vaadin/hilla/crud/filter/AndFilter.d.ts +6 -0
  93. package/types/com/vaadin/hilla/crud/filter/AndFilterModel.d.ts +9 -0
  94. package/types/com/vaadin/hilla/crud/filter/AndFilterModel.d.ts.map +1 -0
  95. package/types/com/vaadin/hilla/crud/filter/AndFilterModel.js +13 -0
  96. package/types/com/vaadin/hilla/crud/filter/AndFilterModel.js.map +7 -0
  97. package/types/com/vaadin/hilla/crud/filter/Filter.d.js +1 -0
  98. package/types/com/vaadin/hilla/crud/filter/Filter.d.js.map +7 -0
  99. package/types/com/vaadin/hilla/crud/filter/Filter.d.ts +3 -0
  100. package/types/com/vaadin/hilla/crud/filter/FilterModel.d.ts +7 -0
  101. package/types/com/vaadin/hilla/crud/filter/FilterModel.d.ts.map +1 -0
  102. package/types/com/vaadin/hilla/crud/filter/FilterModel.js +9 -0
  103. package/types/com/vaadin/hilla/crud/filter/FilterModel.js.map +7 -0
  104. package/types/com/vaadin/hilla/crud/filter/FilterUnion.d.js +1 -0
  105. package/types/com/vaadin/hilla/crud/filter/FilterUnion.d.js.map +7 -0
  106. package/types/com/vaadin/hilla/crud/filter/FilterUnion.d.ts +5 -0
  107. package/types/com/vaadin/hilla/crud/filter/OrFilter.d.js +1 -0
  108. package/types/com/vaadin/hilla/crud/filter/OrFilter.d.js.map +7 -0
  109. package/types/com/vaadin/hilla/crud/filter/OrFilter.d.ts +6 -0
  110. package/types/com/vaadin/hilla/crud/filter/OrFilterModel.d.ts +9 -0
  111. package/types/com/vaadin/hilla/crud/filter/OrFilterModel.d.ts.map +1 -0
  112. package/types/com/vaadin/hilla/crud/filter/OrFilterModel.js +13 -0
  113. package/types/com/vaadin/hilla/crud/filter/OrFilterModel.js.map +7 -0
  114. package/types/com/vaadin/hilla/crud/filter/PropertyStringFilter/Matcher.d.ts +8 -0
  115. package/types/com/vaadin/hilla/crud/filter/PropertyStringFilter/Matcher.d.ts.map +1 -0
  116. package/types/com/vaadin/hilla/crud/filter/PropertyStringFilter/Matcher.js +12 -0
  117. package/types/com/vaadin/hilla/crud/filter/PropertyStringFilter/Matcher.js.map +7 -0
  118. package/types/com/vaadin/hilla/crud/filter/PropertyStringFilter/MatcherModel.d.ts +8 -0
  119. package/types/com/vaadin/hilla/crud/filter/PropertyStringFilter/MatcherModel.d.ts.map +1 -0
  120. package/types/com/vaadin/hilla/crud/filter/PropertyStringFilter/MatcherModel.js +11 -0
  121. package/types/com/vaadin/hilla/crud/filter/PropertyStringFilter/MatcherModel.js.map +7 -0
  122. package/types/com/vaadin/hilla/crud/filter/PropertyStringFilter.d.js +1 -0
  123. package/types/com/vaadin/hilla/crud/filter/PropertyStringFilter.d.js.map +7 -0
  124. package/types/com/vaadin/hilla/crud/filter/PropertyStringFilter.d.ts +9 -0
  125. package/types/com/vaadin/hilla/crud/filter/PropertyStringFilterModel.d.ts +12 -0
  126. package/types/com/vaadin/hilla/crud/filter/PropertyStringFilterModel.d.ts.map +1 -0
  127. package/types/com/vaadin/hilla/crud/filter/PropertyStringFilterModel.js +20 -0
  128. package/types/com/vaadin/hilla/crud/filter/PropertyStringFilterModel.js.map +7 -0
  129. package/types/com/vaadin/hilla/mappedtypes/Order.d.js +1 -0
  130. package/types/com/vaadin/hilla/mappedtypes/Order.d.js.map +7 -0
  131. package/types/com/vaadin/hilla/mappedtypes/Order.d.ts +9 -0
  132. package/types/com/vaadin/hilla/mappedtypes/OrderModel.d.ts +13 -0
  133. package/types/com/vaadin/hilla/mappedtypes/OrderModel.d.ts.map +1 -0
  134. package/types/com/vaadin/hilla/mappedtypes/OrderModel.js +23 -0
  135. package/types/com/vaadin/hilla/mappedtypes/OrderModel.js.map +7 -0
  136. package/types/com/vaadin/hilla/mappedtypes/Pageable.d.js +1 -0
  137. package/types/com/vaadin/hilla/mappedtypes/Pageable.d.js.map +7 -0
  138. package/types/com/vaadin/hilla/mappedtypes/Pageable.d.ts +7 -0
  139. package/types/com/vaadin/hilla/mappedtypes/PageableModel.d.ts +11 -0
  140. package/types/com/vaadin/hilla/mappedtypes/PageableModel.d.ts.map +1 -0
  141. package/types/com/vaadin/hilla/mappedtypes/PageableModel.js +19 -0
  142. package/types/com/vaadin/hilla/mappedtypes/PageableModel.js.map +7 -0
  143. package/types/com/vaadin/hilla/mappedtypes/Sort.d.js +1 -0
  144. package/types/com/vaadin/hilla/mappedtypes/Sort.d.js.map +7 -0
  145. package/types/com/vaadin/hilla/mappedtypes/Sort.d.ts +5 -0
  146. package/types/com/vaadin/hilla/mappedtypes/SortModel.d.ts +9 -0
  147. package/types/com/vaadin/hilla/mappedtypes/SortModel.d.ts.map +1 -0
  148. package/types/com/vaadin/hilla/mappedtypes/SortModel.js +13 -0
  149. package/types/com/vaadin/hilla/mappedtypes/SortModel.js.map +7 -0
  150. package/types/org/springframework/data/domain/Sort/Direction.d.ts +6 -0
  151. package/types/org/springframework/data/domain/Sort/Direction.d.ts.map +1 -0
  152. package/types/org/springframework/data/domain/Sort/Direction.js +10 -0
  153. package/types/org/springframework/data/domain/Sort/Direction.js.map +7 -0
  154. package/types/org/springframework/data/domain/Sort/DirectionModel.d.ts +8 -0
  155. package/types/org/springframework/data/domain/Sort/DirectionModel.d.ts.map +1 -0
  156. package/types/org/springframework/data/domain/Sort/DirectionModel.js +11 -0
  157. package/types/org/springframework/data/domain/Sort/DirectionModel.js.map +7 -0
  158. package/types/org/springframework/data/domain/Sort/NullHandling.d.ts +7 -0
  159. package/types/org/springframework/data/domain/Sort/NullHandling.d.ts.map +1 -0
  160. package/types/org/springframework/data/domain/Sort/NullHandling.js +11 -0
  161. package/types/org/springframework/data/domain/Sort/NullHandling.js.map +7 -0
  162. package/types/org/springframework/data/domain/Sort/NullHandlingModel.d.ts +8 -0
  163. package/types/org/springframework/data/domain/Sort/NullHandlingModel.d.ts.map +1 -0
  164. package/types/org/springframework/data/domain/Sort/NullHandlingModel.js +11 -0
  165. package/types/org/springframework/data/domain/Sort/NullHandlingModel.js.map +7 -0
  166. package/types.d.js +1 -0
  167. package/types.d.js.map +7 -0
  168. package/types.d.ts +12 -0
  169. package/util.d.ts +12 -0
  170. package/util.d.ts.map +1 -0
  171. package/util.js +55 -0
  172. package/util.js.map +7 -0
package/locale.js.map ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["src/locale.ts"],
4
+ "sourcesContent": ["import { DatePickerElement, type DatePickerDate, type DatePickerI18n } from '@vaadin/react-components/DatePicker.js';\nimport { DateTimePickerElement, type DateTimePickerI18n } from '@vaadin/react-components/DateTimePicker.js';\nimport { createContext, useContext, useMemo } from 'react';\n\nexport const LocaleContext = createContext(navigator.language);\n\nfunction getFormatRegex(format: Intl.DateTimeFormat) {\n const sampleDate = new Date(1234, 5 - 1, 6);\n const formattedSample = format.format(sampleDate);\n const pattern = formattedSample\n .replace('1234', '(?<year>\\\\d+)')\n .replace('05', '(?<month>\\\\d+)')\n .replace('5', '(?<month>\\\\d+)')\n .replace('06', '(?<day>\\\\d+)')\n .replace('6', '(?<day>\\\\d+)');\n\n return new RegExp(pattern, 'u');\n}\n\nfunction tryFormatDate(formatter: Intl.DateTimeFormat, value?: string): string {\n try {\n return value ? formatter.format(new Date(value)) : '';\n } catch (e) {\n return '';\n }\n}\n\nexport class LocaleFormatter {\n readonly #date: Intl.DateTimeFormat;\n readonly #localTime: Intl.DateTimeFormat;\n readonly #localDateTime: Intl.DateTimeFormat;\n readonly #integer: Intl.NumberFormat;\n readonly #decimal: Intl.NumberFormat;\n readonly #parsePattern: RegExp;\n\n constructor(locale?: string) {\n this.#date = new Intl.DateTimeFormat(locale);\n\n this.#localTime = new Intl.DateTimeFormat(locale, {\n hour: 'numeric',\n minute: 'numeric',\n });\n\n this.#localDateTime = new Intl.DateTimeFormat(locale, {\n day: 'numeric',\n month: 'numeric',\n year: 'numeric',\n hour: 'numeric',\n minute: 'numeric',\n });\n\n this.#integer = new Intl.NumberFormat(locale, {\n maximumFractionDigits: 0,\n });\n\n this.#decimal = new Intl.NumberFormat(locale, {\n maximumFractionDigits: 2,\n minimumFractionDigits: 2,\n });\n\n this.#parsePattern = getFormatRegex(this.#date);\n }\n\n formatDate(value?: string): string;\n formatDate(value: DatePickerDate): string;\n formatDate(value?: DatePickerDate | string): string {\n if (typeof value === 'object') {\n const { year, month, day } = value;\n const date = new Date();\n date.setFullYear(year);\n date.setMonth(month);\n date.setDate(day);\n return this.#date.format(date);\n }\n\n return tryFormatDate(this.#date, value);\n }\n\n formatLocalTime(value?: string): string {\n return tryFormatDate(this.#localTime, `2000-01-01T${value}`);\n }\n\n formatLocalDateTime(value?: string): string {\n return tryFormatDate(this.#localDateTime, value);\n }\n\n formatInteger(value?: number): string {\n return value && Number.isFinite(value) ? this.#integer.format(value) : '';\n }\n\n formatDecimal(value?: number): string {\n return value && Number.isFinite(value) ? this.#decimal.format(value) : '';\n }\n\n parse(dateString: string): DatePickerDate | undefined {\n const match = this.#parsePattern.exec(dateString);\n const year = Number(match?.groups?.year);\n const month = Number(match?.groups?.month) - 1;\n const day = Number(match?.groups?.day);\n\n // Verify that the parsed date is valid\n const dateInstance = new Date();\n dateInstance.setFullYear(year);\n dateInstance.setMonth(month);\n dateInstance.setDate(day);\n\n if (dateInstance.getFullYear() !== year || dateInstance.getMonth() !== month || dateInstance.getDate() !== day) {\n return undefined;\n }\n\n return { year, month, day };\n }\n}\n\nexport function useLocaleFormatter(): LocaleFormatter {\n const locale = useContext(LocaleContext);\n return useMemo(() => new LocaleFormatter(locale), [locale]);\n}\n\nconst defaultDatePickerI18n = new DatePickerElement().i18n;\n\nexport function useDatePickerI18n(): DatePickerI18n {\n const formatter = useLocaleFormatter();\n\n return useMemo(\n () => ({\n ...defaultDatePickerI18n,\n formatDate(value) {\n return formatter.formatDate(value);\n },\n parseDate(value) {\n return formatter.parse(value);\n },\n }),\n [formatter],\n );\n}\n\nconst defaultDateTimePickerI18n = new DateTimePickerElement().i18n;\n\nexport function useDateTimePickerI18n(): DateTimePickerI18n {\n const datePickerI18n = useDatePickerI18n();\n\n return useMemo(\n () => ({\n ...defaultDateTimePickerI18n,\n ...datePickerI18n,\n }),\n [datePickerI18n],\n );\n}\n"],
5
+ "mappings": "AAAA,SAAS,y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I,gBAAgB,MAAM,GAAG,CAAC,MAAM,CAAC;AAC5D;AAEA,MAAM,wBAAwB,IAAI,kBAAkB,EAAE;AAE/C,SAAS,oBAAoC;AAClD,QAAM,YAAY,mBAAmB;AAErC,SAAO;AAAA,IACL,OAAO;AAAA,MACL,GAAG;AAAA,MACH,WAAW,OAAO;AAChB,eAAO,UAAU,WAAW,KAAK;AAAA,MACnC;AAAA,MACA,UAAU,OAAO;AACf,eAAO,UAAU,MAAM,KAAK;AAAA,MAC9B;AAAA,IACF;AAAA,IACA,CAAC,SAAS;AAAA,EACZ;AACF;AAEA,MAAM,4BAA4B,IAAI,sBAAsB,EAAE;AAEvD,SAAS,wBAA4C;AAC1D,QAAM,iBAAiB,kBAAkB;AAEzC,SAAO;AAAA,IACL,OAAO;AAAA,MACL,GAAG;AAAA,MACH,GAAG;AAAA,IACL;AAAA,IACA,CAAC,cAAc;AAAA,EACjB;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ export declare function useMediaQuery(query: string): boolean;
2
+ //# sourceMappingURL=media-query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media-query.d.ts","sourceRoot":"","sources":["src/media-query.ts"],"names":[],"mappings":"AAEA,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAYpD"}
package/media-query.js ADDED
@@ -0,0 +1,16 @@
1
+ import { useEffect, useState } from "react";
2
+ function useMediaQuery(query) {
3
+ const [matches, setMatches] = useState(() => window.matchMedia(query).matches);
4
+ useEffect(() => {
5
+ const listener = (e) => setMatches(e.matches);
6
+ const mediaQuery = window.matchMedia(query);
7
+ setMatches(mediaQuery.matches);
8
+ mediaQuery.addEventListener("change", listener);
9
+ return () => mediaQuery.removeEventListener("change", listener);
10
+ }, [query]);
11
+ return matches;
12
+ }
13
+ export {
14
+ useMediaQuery
15
+ };
16
+ //# sourceMappingURL=media-query.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["src/media-query.ts"],
4
+ "sourcesContent": ["import { useEffect, useState } from 'react';\n\nexport function useMediaQuery(query: string): boolean {\n const [matches, setMatches] = useState(() => window.matchMedia(query).matches);\n\n useEffect(() => {\n const listener = (e: MediaQueryListEvent) => setMatches(e.matches);\n const mediaQuery = window.matchMedia(query);\n setMatches(mediaQuery.matches);\n mediaQuery.addEventListener('change', listener);\n return () => mediaQuery.removeEventListener('change', listener);\n }, [query]);\n\n return matches;\n}\n"],
5
+ "mappings": "AAAA,SAAS,WAAW,gBAAgB;AAE7B,SAAS,cAAc,OAAwB;AACpD,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,MAAM,OAAO,WAAW,KAAK,EAAE,OAAO;AAE7E,YAAU,MAAM;AACd,UAAM,WAAW,CAAC,MAA2B,WAAW,EAAE,OAAO;AACjE,UAAM,aAAa,OAAO,WAAW,KAAK;AAC1C,eAAW,WAAW,OAAO;AAC7B,eAAW,iBAAiB,UAAU,QAAQ;AAC9C,WAAO,MAAM,WAAW,oBAAoB,UAAU,QAAQ;AAAA,EAChE,GAAG,CAAC,KAAK,CAAC;AAEV,SAAO;AACT;",
6
+ "names": []
7
+ }
@@ -0,0 +1,23 @@
1
+ import { type AbstractModel, type DetachedModelConstructor, type ModelMetadata } from '@vaadin/hilla-lit-form';
2
+ export type PropertyType = 'boolean' | 'date' | 'datetime' | 'decimal' | 'enum' | 'integer' | 'object' | 'string' | 'time' | undefined;
3
+ export interface PropertyInfo {
4
+ name: string;
5
+ humanReadableName: string;
6
+ type: PropertyType;
7
+ meta: ModelMetadata;
8
+ model: AbstractModel;
9
+ }
10
+ export declare function hasAnnotation(meta: ModelMetadata, annotationName: string): boolean;
11
+ export declare function _generateHeader(path: string): string;
12
+ export declare class ModelInfo {
13
+ private readonly modelInstance;
14
+ readonly idProperty?: PropertyInfo;
15
+ constructor(model: DetachedModelConstructor<AbstractModel>, idPropertyName?: string);
16
+ private static resolveIdProperty;
17
+ private static resolvePropertyModel;
18
+ getRootProperties(path?: string): PropertyInfo[];
19
+ getProperty(path: string): PropertyInfo | undefined;
20
+ getProperties(paths: string[]): PropertyInfo[];
21
+ }
22
+ export declare function getDefaultProperties(modelInfo: ModelInfo): PropertyInfo[];
23
+ //# sourceMappingURL=model-info.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-info.d.ts","sourceRoot":"","sources":["src/model-info.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,aAAa,EAClB,KAAK,wBAAwB,EAC7B,KAAK,aAAa,EAGnB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,MAAM,YAAY,GACpB,SAAS,GACT,MAAM,GACN,UAAU,GACV,SAAS,GACT,MAAM,GACN,SAAS,GACT,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,SAAS,CAAC;AA4Cd,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,MAAM,CAAC;IAC1B,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,aAAa,CAAC;IACpB,KAAK,EAAE,aAAa,CAAC;CACtB;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAElF;AAGD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOpD;AAaD,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgB;IAE9C,QAAQ,CAAC,UAAU,CAAC,EAAE,YAAY,CAAC;gBAEvB,KAAK,EAAE,wBAAwB,CAAC,aAAa,CAAC,EAAE,cAAc,CAAC,EAAE,MAAM;IAOnF,OAAO,CAAC,MAAM,CAAC,iBAAiB;IAkBhC,OAAO,CAAC,MAAM,CAAC,oBAAoB;IAanC,iBAAiB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,YAAY,EAAE;IAahD,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS;IAsBnD,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,YAAY,EAAE;CAG/C;AAED,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,SAAS,GAAG,YAAY,EAAE,CAuBzE"}
package/model-info.js ADDED
@@ -0,0 +1,137 @@
1
+ import {
2
+ BooleanModel,
3
+ NumberModel,
4
+ StringModel,
5
+ _meta,
6
+ createDetachedModel,
7
+ EnumModel,
8
+ ObjectModel
9
+ } from "@vaadin/hilla-lit-form";
10
+ const javaTypeMap = {
11
+ byte: "integer",
12
+ "java.lang.Byte": "integer",
13
+ short: "integer",
14
+ "java.lang.Short": "integer",
15
+ int: "integer",
16
+ "java.lang.Integer": "integer",
17
+ long: "integer",
18
+ "java.lang.Long": "integer",
19
+ float: "decimal",
20
+ "java.lang.Float": "decimal",
21
+ double: "decimal",
22
+ "java.lang.Double": "decimal",
23
+ "java.time.LocalDate": "date",
24
+ "java.time.LocalTime": "time",
25
+ "java.time.LocalDateTime": "datetime"
26
+ };
27
+ function determinePropertyType(model) {
28
+ const { javaType } = model[_meta];
29
+ const propertyType = javaType ? javaTypeMap[javaType] : void 0;
30
+ if (propertyType) {
31
+ return propertyType;
32
+ }
33
+ if (model instanceof StringModel) {
34
+ return "string";
35
+ } else if (model instanceof NumberModel) {
36
+ return "decimal";
37
+ } else if (model instanceof BooleanModel) {
38
+ return "boolean";
39
+ } else if (model instanceof EnumModel) {
40
+ return "enum";
41
+ } else if (model instanceof ObjectModel) {
42
+ return "object";
43
+ }
44
+ return void 0;
45
+ }
46
+ function hasAnnotation(meta, annotationName) {
47
+ return meta.annotations?.some((annotation) => annotation.name === annotationName) ?? false;
48
+ }
49
+ function _generateHeader(path) {
50
+ return path.substring(path.lastIndexOf(".") + 1).replace(/([A-Z])/gu, "-$1").toLowerCase().replace(/-/gu, " ").replace(/^./u, (match) => match.toUpperCase());
51
+ }
52
+ const getPropertyNames = (model) => {
53
+ const propertyNames = [];
54
+ for (let proto = model; proto !== ObjectModel; proto = Object.getPrototypeOf(proto)) {
55
+ propertyNames.unshift(...Object.keys(Object.getOwnPropertyDescriptors(proto.prototype)).filter((p) => p !== "new"));
56
+ }
57
+ return propertyNames;
58
+ };
59
+ class ModelInfo {
60
+ modelInstance;
61
+ idProperty;
62
+ constructor(model, idPropertyName) {
63
+ this.modelInstance = createDetachedModel(model);
64
+ this.idProperty = ModelInfo.resolveIdProperty(this, idPropertyName);
65
+ }
66
+ static resolveIdProperty(modelInfo, idPropertyName) {
67
+ if (idPropertyName) {
68
+ return modelInfo.getProperty(idPropertyName);
69
+ }
70
+ const rootProperties = modelInfo.getRootProperties();
71
+ let idProperty = rootProperties.find((propertyInfo) => hasAnnotation(propertyInfo.meta, "jakarta.persistence.Id"));
72
+ if (!idProperty) {
73
+ idProperty = rootProperties.find((propertyInfo) => propertyInfo.name === "id");
74
+ }
75
+ return idProperty;
76
+ }
77
+ static resolvePropertyModel(modelInstance, path) {
78
+ const parts = path.split(".");
79
+ let currentModel = modelInstance;
80
+ for (const part of parts) {
81
+ if (!currentModel || !(currentModel instanceof ObjectModel)) {
82
+ return void 0;
83
+ }
84
+ currentModel = currentModel[part];
85
+ }
86
+ return currentModel;
87
+ }
88
+ getRootProperties(path) {
89
+ const model = path ? ModelInfo.resolvePropertyModel(this.modelInstance, path) : this.modelInstance;
90
+ if (!model) {
91
+ return [];
92
+ }
93
+ return getPropertyNames(model.constructor).map((name) => {
94
+ const effectivePath = path ? `${path}.${name}` : name;
95
+ return this.getProperty(effectivePath);
96
+ }).filter(Boolean);
97
+ }
98
+ getProperty(path) {
99
+ const propertyModel = ModelInfo.resolvePropertyModel(this.modelInstance, path);
100
+ if (!propertyModel?.[_meta]) {
101
+ return void 0;
102
+ }
103
+ const pathParts = path.split(".");
104
+ const name = pathParts[pathParts.length - 1];
105
+ const meta = propertyModel[_meta];
106
+ const humanReadableName = _generateHeader(name);
107
+ const type = determinePropertyType(propertyModel);
108
+ return {
109
+ name: path,
110
+ humanReadableName,
111
+ type,
112
+ meta,
113
+ model: propertyModel
114
+ };
115
+ }
116
+ getProperties(paths) {
117
+ return paths.map((path) => this.getProperty(path)).filter(Boolean);
118
+ }
119
+ }
120
+ function getDefaultProperties(modelInfo) {
121
+ const properties = modelInfo.getRootProperties();
122
+ return properties.flatMap((prop) => {
123
+ if (hasAnnotation(prop.meta, "jakarta.persistence.OneToOne")) {
124
+ return modelInfo.getRootProperties(prop.name);
125
+ }
126
+ return prop;
127
+ }).filter(
128
+ (prop) => !!prop.type && !(hasAnnotation(prop.meta, "jakarta.persistence.Id") || hasAnnotation(prop.meta, "jakarta.persistence.Version"))
129
+ );
130
+ }
131
+ export {
132
+ ModelInfo,
133
+ _generateHeader,
134
+ getDefaultProperties,
135
+ hasAnnotation
136
+ };
137
+ //# sourceMappingURL=model-info.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["src/model-info.ts"],
4
+ "sourcesContent": ["import {\n BooleanModel,\n NumberModel,\n StringModel,\n _meta,\n createDetachedModel,\n type AbstractModel,\n type DetachedModelConstructor,\n type ModelMetadata,\n EnumModel,\n ObjectModel,\n} from '@vaadin/hilla-lit-form';\n\nexport type PropertyType =\n | 'boolean'\n | 'date'\n | 'datetime'\n | 'decimal'\n | 'enum'\n | 'integer'\n | 'object'\n | 'string'\n | 'time'\n | undefined;\n\nconst javaTypeMap: Record<string, PropertyType> = {\n byte: 'integer',\n 'java.lang.Byte': 'integer',\n short: 'integer',\n 'java.lang.Short': 'integer',\n int: 'integer',\n 'java.lang.Integer': 'integer',\n long: 'integer',\n 'java.lang.Long': 'integer',\n float: 'decimal',\n 'java.lang.Float': 'decimal',\n double: 'decimal',\n 'java.lang.Double': 'decimal',\n 'java.time.LocalDate': 'date',\n 'java.time.LocalTime': 'time',\n 'java.time.LocalDateTime': 'datetime',\n};\n\nfunction determinePropertyType(model: AbstractModel): PropertyType {\n // Try detecting by Java type\n const { javaType } = model[_meta];\n const propertyType = javaType ? javaTypeMap[javaType] : undefined;\n if (propertyType) {\n return propertyType;\n }\n\n // Otherwise detect by model instance\n if (model instanceof StringModel) {\n return 'string';\n } else if (model instanceof NumberModel) {\n return 'decimal';\n } else if (model instanceof BooleanModel) {\n return 'boolean';\n } else if (model instanceof EnumModel) {\n return 'enum';\n } else if (model instanceof ObjectModel) {\n return 'object';\n }\n\n return undefined;\n}\n\nexport interface PropertyInfo {\n name: string;\n humanReadableName: string;\n type: PropertyType;\n meta: ModelMetadata;\n model: AbstractModel;\n}\n\nexport function hasAnnotation(meta: ModelMetadata, annotationName: string): boolean {\n return meta.annotations?.some((annotation) => annotation.name === annotationName) ?? false;\n}\n\n// This is from vaadin-grid-column.js, should be used from there maybe. At least we must be 100% sure to match grid and fields\nexport function _generateHeader(path: string): string {\n return path\n .substring(path.lastIndexOf('.') + 1)\n .replace(/([A-Z])/gu, '-$1')\n .toLowerCase()\n .replace(/-/gu, ' ')\n .replace(/^./u, (match) => match.toUpperCase());\n}\n\nconst getPropertyNames = (model: DetachedModelConstructor<AbstractModel>): string[] => {\n const propertyNames: string[] = [];\n\n for (let proto = model; proto !== ObjectModel; proto = Object.getPrototypeOf(proto)) {\n // parent properties are added at the beginning\n propertyNames.unshift(...Object.keys(Object.getOwnPropertyDescriptors(proto.prototype)).filter((p) => p !== 'new'));\n }\n\n return propertyNames;\n};\n\nexport class ModelInfo {\n private readonly modelInstance: AbstractModel;\n\n readonly idProperty?: PropertyInfo;\n\n constructor(model: DetachedModelConstructor<AbstractModel>, idPropertyName?: string) {\n this.modelInstance = createDetachedModel(model);\n\n // Try to find id property\n this.idProperty = ModelInfo.resolveIdProperty(this, idPropertyName);\n }\n\n private static resolveIdProperty(modelInfo: ModelInfo, idPropertyName?: string): PropertyInfo | undefined {\n // Return explicit property if defined\n if (idPropertyName) {\n return modelInfo.getProperty(idPropertyName);\n }\n\n // Otherwise check defaults\n const rootProperties = modelInfo.getRootProperties();\n // Check for @Id annotation\n let idProperty = rootProperties.find((propertyInfo) => hasAnnotation(propertyInfo.meta, 'jakarta.persistence.Id'));\n // Check for id name as fallback\n if (!idProperty) {\n idProperty = rootProperties.find((propertyInfo) => propertyInfo.name === 'id');\n }\n\n return idProperty;\n }\n\n private static resolvePropertyModel(modelInstance: AbstractModel, path: string): AbstractModel | undefined {\n const parts = path.split('.');\n let currentModel: AbstractModel | undefined = modelInstance;\n for (const part of parts) {\n if (!currentModel || !(currentModel instanceof ObjectModel)) {\n return undefined;\n }\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n currentModel = (currentModel as any)[part];\n }\n return currentModel;\n }\n\n getRootProperties(path?: string): PropertyInfo[] {\n const model = path ? ModelInfo.resolvePropertyModel(this.modelInstance, path) : this.modelInstance;\n if (!model) {\n return [];\n }\n return getPropertyNames(model.constructor as any)\n .map((name) => {\n const effectivePath = path ? `${path}.${name}` : name;\n return this.getProperty(effectivePath);\n })\n .filter(Boolean) as PropertyInfo[];\n }\n\n getProperty(path: string): PropertyInfo | undefined {\n const propertyModel = ModelInfo.resolvePropertyModel(this.modelInstance, path);\n if (!propertyModel?.[_meta]) {\n return undefined;\n }\n\n const pathParts = path.split('.');\n const name = pathParts[pathParts.length - 1];\n\n const meta = propertyModel[_meta];\n const humanReadableName = _generateHeader(name);\n const type = determinePropertyType(propertyModel);\n\n return {\n name: path,\n humanReadableName,\n type,\n meta,\n model: propertyModel,\n };\n }\n\n getProperties(paths: string[]): PropertyInfo[] {\n return paths.map((path) => this.getProperty(path)).filter(Boolean) as PropertyInfo[];\n }\n}\n\nexport function getDefaultProperties(modelInfo: ModelInfo): PropertyInfo[] {\n // Start from root properties\n const properties = modelInfo.getRootProperties();\n return (\n properties\n // Auto-expand nested properties of one-to-one relations\n .flatMap((prop) => {\n if (hasAnnotation(prop.meta, 'jakarta.persistence.OneToOne')) {\n return modelInfo.getRootProperties(prop.name);\n }\n return prop;\n })\n // Exclude properties that have an unknown type, or are annotated with id\n // and version\n .filter(\n (prop) =>\n !!prop.type &&\n !(\n hasAnnotation(prop.meta, 'jakarta.persistence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,IAAI,IAAI,KAAK;AACjD,aAAO,KAAK,YAAY,aAAa;AAAA,IACvC,CAAC,EACA,OAAO,OAAO;AAAA,EACnB;AAAA,EAEA,YAAY,MAAwC;AAClD,UAAM,gBAAgB,UAAU,qBAAqB,KAAK,eAAe,IAAI;AAC7E,QAAI,CAAC,gBAAgB,KAAK,GAAG;AAC3B,aAAO;AAAA,IACT;AAEA,UAAM,YAAY,KAAK,MAAM,GAAG;AAChC,UAAM,OAAO,UAAU,UAAU,SAAS,CAAC;AAE3C,UAAM,OAAO,cAAc,KAAK;AAChC,UAAM,oBAAoB,gBAAgB,IAAI;AAC9C,UAAM,OAAO,sBAAsB,aAAa;AAEhD,WAAO;AAAA,MACL,MAAM;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA,MACA,OAAO;AAAA,IACT;AAAA,EACF;AAAA,EAEA,cAAc,OAAiC;AAC7C,WAAO,MAAM,IAAI,CAAC,SAAS,KAAK,YAAY,IAAI,CAAC,EAAE,OAAO,OAAO;AAAA,EACnE;AACF;AAEO,SAAS,qBAAqB,WAAsC;AAEzE,QAAM,aAAa,UAAU,kBAAkB;AAC/C,SACE,WAEG,QAAQ,CAAC,SAAS;AACjB,QAAI,cAAc,KAAK,MAAM,8BAA8B,GAAG;AAC5D,aAAO,UAAU,kBAAkB,KAAK,IAAI;AAAA,IAC9C;AACA,WAAO;AAAA,EACT,CAAC,EAGA;AAAA,IACC,CAAC,SACC,CAAC,CAAC,KAAK,QACP,EACE,cAAc,KAAK,MAAM,wBAAwB,KACjD,cAAc,KAAK,MAAM,6BAA6B;AAAA,EAE5D;AAEN;",
6
+ "names": []
7
+ }
package/package.json ADDED
@@ -0,0 +1,87 @@
1
+ {
2
+ "name": "@vaadin/hilla-react-crud",
3
+ "version": "24.4.0-alpha1",
4
+ "description": "Hilla CRUD utils for React",
5
+ "main": "index.js",
6
+ "module": "index.js",
7
+ "type": "module",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/vaadin/hilla.git",
11
+ "directory": "packages/ts/react-crud"
12
+ },
13
+ "keywords": [
14
+ "Hilla",
15
+ "CRUD",
16
+ "React"
17
+ ],
18
+ "scripts": {
19
+ "clean:build": "git clean -fx . -e .vite -e node_modules",
20
+ "build": "concurrently npm:build:*",
21
+ "build:esbuild": "tsx ../../../scripts/build.ts",
22
+ "build:dts": "tsc --isolatedModules -p tsconfig.build.json",
23
+ "build:copy": "cd src && copyfiles **/*.d.ts ..",
24
+ "lint": "eslint src test",
25
+ "lint:fix": "eslint src test --fix",
26
+ "test": "karma start ../../../karma.config.cjs --port 9879",
27
+ "test:coverage": "npm run test -- --coverage",
28
+ "test:watch": "npm run test -- --watch",
29
+ "typecheck": "tsc --noEmit"
30
+ },
31
+ "exports": {
32
+ ".": {
33
+ "default": "./index.js"
34
+ },
35
+ "./autogrid.obj.js": {
36
+ "default": "./autogrid.obj.js"
37
+ },
38
+ "./autoform.obj.js": {
39
+ "default": "./autoform.obj.js"
40
+ },
41
+ "./autocrud.obj.js": {
42
+ "default": "./autocrud.obj.js"
43
+ }
44
+ },
45
+ "author": "Vaadin Ltd",
46
+ "license": "Apache-2.0",
47
+ "bugs": {
48
+ "url": "https://github.com/vaadin/hilla/issues"
49
+ },
50
+ "homepage": "https://hilla.dev",
51
+ "files": [
52
+ "*.{d.ts.map,d.ts,js.map,js}",
53
+ "types/**"
54
+ ],
55
+ "publishConfig": {
56
+ "access": "public"
57
+ },
58
+ "dependencies": {
59
+ "@vaadin/hilla-lit-form": "24.4.0-alpha1",
60
+ "@vaadin/hilla-core": "24.4.0-alpha1",
61
+ "@vaadin/react-components": "^24.4.0-alpha3",
62
+ "@vaadin/hilla-react-form": "24.4.0-alpha1",
63
+ "@vaadin/vaadin-lumo-styles": "~24.4.0-alpha3"
64
+ },
65
+ "peerDependencies": {
66
+ "react": "^18"
67
+ },
68
+ "devDependencies": {
69
+ "@esm-bundle/chai": "^4.3.4-fix.0",
70
+ "@testing-library/react": "^14.0.0",
71
+ "@testing-library/user-event": "^14.5.1",
72
+ "@types/chai": "^4.3.6",
73
+ "@types/chai-as-promised": "^7.1.6",
74
+ "@types/chai-dom": "^1.11.1",
75
+ "@types/mocha": "^10.0.2",
76
+ "@types/react": "^18.2.23",
77
+ "@types/sinon": "^10.0.17",
78
+ "@types/sinon-chai": "^3.2.10",
79
+ "@types/validator": "^13.11.2",
80
+ "chai-as-promised": "^7.1.1",
81
+ "chai-dom": "^1.11.0",
82
+ "karma-viewport": "^1.0.9",
83
+ "sinon": "^16.0.0",
84
+ "sinon-chai": "^3.7.0",
85
+ "typescript": "5.3.2"
86
+ }
87
+ }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=AndFilter.d.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,6 @@
1
+ import type Filter_1 from "./Filter.js";
2
+ interface AndFilter extends Filter_1 {
3
+ children: Array<Filter_1>;
4
+ "@type": "and";
5
+ }
6
+ export default AndFilter;
@@ -0,0 +1,9 @@
1
+ import { ArrayModel as ArrayModel_1 } from "@vaadin/hilla-lit-form";
2
+ import type AndFilter_1 from "./AndFilter.js";
3
+ import FilterModel_1 from "./FilterModel.js";
4
+ declare class AndFilterModel<T extends AndFilter_1 = AndFilter_1> extends FilterModel_1<T> {
5
+ static createEmptyValue: () => AndFilter_1;
6
+ get children(): ArrayModel_1<FilterModel_1>;
7
+ }
8
+ export default AndFilterModel;
9
+ //# sourceMappingURL=AndFilterModel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AndFilterModel.d.ts","sourceRoot":"","sources":["../../../../../../src/types/com/vaadin/hilla/crud/filter/AndFilterModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4C,UAAU,IAAI,YAAY,EAA8F,MAAM,wBAAwB,CAAC;AAC1M,OAAO,KAAK,WAAW,MAAM,gBAAgB,CAAC;AAC9C,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAC7C,cAAM,cAAc,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,CAAE,SAAQ,aAAa,CAAC,CAAC,CAAC;IAC9E,OAAgB,gBAAgB,oBAAiD;IACjF,IAAI,QAAQ,IAAI,YAAY,CAAC,aAAa,CAAC,CAE1C;CACJ;AACD,eAAe,cAAc,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { _getPropertyModel as _getPropertyModel_1, ArrayModel as ArrayModel_1, makeObjectEmptyValueCreator as makeObjectEmptyValueCreator_1, StringModel as StringModel_1 } from "@vaadin/hilla-lit-form";
2
+ import FilterModel_1 from "./FilterModel.js";
3
+ class AndFilterModel extends FilterModel_1 {
4
+ static createEmptyValue = makeObjectEmptyValueCreator_1(AndFilterModel);
5
+ get children() {
6
+ return this[_getPropertyModel_1]("children", (parent, key) => new ArrayModel_1(parent, key, false, (parent2, key2) => new FilterModel_1(parent2, key2, false), { meta: { javaType: "java.util.List" } }));
7
+ }
8
+ }
9
+ var AndFilterModel_default = AndFilterModel;
10
+ export {
11
+ AndFilterModel_default as default
12
+ };
13
+ //# sourceMappingURL=AndFilterModel.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/types/com/vaadin/hilla/crud/filter/AndFilterModel.ts"],
4
+ "sourcesContent": ["import { _getPropertyModel as _getPropertyModel_1, ArrayModel as ArrayModel_1, makeObjectEmptyValueCreator as makeObjectEmptyValueCreator_1, StringModel as StringModel_1 } from \"@vaadin/hilla-lit-form\";\nimport type AndFilter_1 from \"./AndFilter.js\";\nimport FilterModel_1 from \"./FilterModel.js\";\nclass AndFilterModel<T extends AndFilter_1 = AndFilter_1> extends FilterModel_1<T> {\n static override createEmptyValue = makeObjectEmptyValueCreator_1(AndFilterModel);\n get children(): ArrayModel_1<FilterModel_1> {\n return this[_getPropertyModel_1](\"children\", (parent, key) => new ArrayModel_1(parent, key, false, (parent, key) => new FilterModel_1(parent, key, false), { meta: { javaType: \"java.util.List\" } }));\n }\n}\nexport default AndFilterModel;\n"],
5
+ "mappings": "AAAA,SAAS,qBAAqB,qBAAqB,cAAc,cAAc,+BAA+B,+BAA+B,eAAe,qBAAqB;AAEjL,OAAO,mBAAmB;AAC1B,MAAM,uBAA4D,cAAiB;AAAA,EAC/E,OAAgB,mBAAmB,8BAA8B,cAAc;AAAA,EAC/E,IAAI,WAAwC;AACxC,WAAO,KAAK,mBAAmB,EAAE,YAAY,CAAC,QAAQ,QAAQ,IAAI,aAAa,QAAQ,KAAK,OAAO,CAACA,SAAQC,SAAQ,IAAI,cAAcD,SAAQC,MAAK,KAAK,GAAG,EAAE,MAAM,EAAE,UAAU,iBAAiB,EAAE,CAAC,CAAC;AAAA,EACxM;AACJ;AACA,IAAO,yBAAQ;",
6
+ "names": ["parent", "key"]
7
+ }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=Filter.d.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,3 @@
1
+ interface Filter {
2
+ }
3
+ export default Filter;
@@ -0,0 +1,7 @@
1
+ import { ObjectModel as ObjectModel_1 } from "@vaadin/hilla-lit-form";
2
+ import type Filter_1 from "./Filter.js";
3
+ declare class FilterModel<T extends Filter_1 = Filter_1> extends ObjectModel_1<T> {
4
+ static createEmptyValue: () => Filter_1;
5
+ }
6
+ export default FilterModel;
7
+ //# sourceMappingURL=FilterModel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FilterModel.d.ts","sourceRoot":"","sources":["../../../../../../src/types/com/vaadin/hilla/crud/filter/FilterModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0G,WAAW,IAAI,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC9K,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAC;AACxC,cAAM,WAAW,CAAC,CAAC,SAAS,QAAQ,GAAG,QAAQ,CAAE,SAAQ,aAAa,CAAC,CAAC,CAAC;IACrE,OAAgB,gBAAgB,iBAA8C;CACjF;AACD,eAAe,WAAW,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { _getPropertyModel as _getPropertyModel_1, makeObjectEmptyValueCreator as makeObjectEmptyValueCreator_1, ObjectModel as ObjectModel_1 } from "@vaadin/hilla-lit-form";
2
+ class FilterModel extends ObjectModel_1 {
3
+ static createEmptyValue = makeObjectEmptyValueCreator_1(FilterModel);
4
+ }
5
+ var FilterModel_default = FilterModel;
6
+ export {
7
+ FilterModel_default as default
8
+ };
9
+ //# sourceMappingURL=FilterModel.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/types/com/vaadin/hilla/crud/filter/FilterModel.ts"],
4
+ "sourcesContent": ["import { _getPropertyModel as _getPropertyModel_1, makeObjectEmptyValueCreator as makeObjectEmptyValueCreator_1, ObjectModel as ObjectModel_1 } from \"@vaadin/hilla-lit-form\";\nimport type Filter_1 from \"./Filter.js\";\nclass FilterModel<T extends Filter_1 = Filter_1> extends ObjectModel_1<T> {\n static override createEmptyValue = makeObjectEmptyValueCreator_1(FilterModel);\n}\nexport default FilterModel;\n"],
5
+ "mappings": "AAAA,SAAS,qBAAqB,qBAAqB,+BAA+B,+BAA+B,eAAe,qBAAqB;AAErJ,MAAM,oBAAmD,cAAiB;AAAA,EACtE,OAAgB,mBAAmB,8BAA8B,WAAW;AAChF;AACA,IAAO,sBAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=FilterUnion.d.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,5 @@
1
+ import type AndFilter_1 from "./AndFilter.js";
2
+ import type OrFilter_1 from "./OrFilter.js";
3
+ import type PropertyStringFilter_1 from "./PropertyStringFilter.js";
4
+ type FilterUnion = (OrFilter_1 | AndFilter_1 | PropertyStringFilter_1) & { key?: string }
5
+ export default FilterUnion;
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=OrFilter.d.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,6 @@
1
+ import type Filter_1 from "./Filter.js";
2
+ interface OrFilter extends Filter_1 {
3
+ children: Array<Filter_1>;
4
+ "@type": "or";
5
+ }
6
+ export default OrFilter;
@@ -0,0 +1,9 @@
1
+ import { ArrayModel as ArrayModel_1 } from "@vaadin/hilla-lit-form";
2
+ import FilterModel_1 from "./FilterModel.js";
3
+ import type OrFilter_1 from "./OrFilter.js";
4
+ declare class OrFilterModel<T extends OrFilter_1 = OrFilter_1> extends FilterModel_1<T> {
5
+ static createEmptyValue: () => OrFilter_1;
6
+ get children(): ArrayModel_1<FilterModel_1>;
7
+ }
8
+ export default OrFilterModel;
9
+ //# sourceMappingURL=OrFilterModel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OrFilterModel.d.ts","sourceRoot":"","sources":["../../../../../../src/types/com/vaadin/hilla/crud/filter/OrFilterModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4C,UAAU,IAAI,YAAY,EAA8F,MAAM,wBAAwB,CAAC;AAC1M,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAC5C,cAAM,aAAa,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,CAAE,SAAQ,aAAa,CAAC,CAAC,CAAC;IAC3E,OAAgB,gBAAgB,mBAAgD;IAChF,IAAI,QAAQ,IAAI,YAAY,CAAC,aAAa,CAAC,CAE1C;CACJ;AACD,eAAe,aAAa,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { _getPropertyModel as _getPropertyModel_1, ArrayModel as ArrayModel_1, makeObjectEmptyValueCreator as makeObjectEmptyValueCreator_1, StringModel as StringModel_1 } from "@vaadin/hilla-lit-form";
2
+ import FilterModel_1 from "./FilterModel.js";
3
+ class OrFilterModel extends FilterModel_1 {
4
+ static createEmptyValue = makeObjectEmptyValueCreator_1(OrFilterModel);
5
+ get children() {
6
+ return this[_getPropertyModel_1]("children", (parent, key) => new ArrayModel_1(parent, key, false, (parent2, key2) => new FilterModel_1(parent2, key2, false), { meta: { javaType: "java.util.List" } }));
7
+ }
8
+ }
9
+ var OrFilterModel_default = OrFilterModel;
10
+ export {
11
+ OrFilterModel_default as default
12
+ };
13
+ //# sourceMappingURL=OrFilterModel.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../src/types/com/vaadin/hilla/crud/filter/OrFilterModel.ts"],
4
+ "sourcesContent": ["import { _getPropertyModel as _getPropertyModel_1, ArrayModel as ArrayModel_1, makeObjectEmptyValueCreator as makeObjectEmptyValueCreator_1, StringModel as StringModel_1 } from \"@vaadin/hilla-lit-form\";\nimport FilterModel_1 from \"./FilterModel.js\";\nimport type OrFilter_1 from \"./OrFilter.js\";\nclass OrFilterModel<T extends OrFilter_1 = OrFilter_1> extends FilterModel_1<T> {\n static override createEmptyValue = makeObjectEmptyValueCreator_1(OrFilterModel);\n get children(): ArrayModel_1<FilterModel_1> {\n return this[_getPropertyModel_1](\"children\", (parent, key) => new ArrayModel_1(parent, key, false, (parent, key) => new FilterModel_1(parent, key, false), { meta: { javaType: \"java.util.List\" } }));\n }\n}\nexport default OrFilterModel;\n"],
5
+ "mappings": "AAAA,SAAS,qBAAqB,qBAAqB,cAAc,cAAc,+BAA+B,+BAA+B,eAAe,qBAAqB;AACjL,OAAO,mBAAmB;AAE1B,MAAM,sBAAyD,cAAiB;AAAA,EAC5E,OAAgB,mBAAmB,8BAA8B,aAAa;AAAA,EAC9E,IAAI,WAAwC;AACxC,WAAO,KAAK,mBAAmB,EAAE,YAAY,CAAC,QAAQ,QAAQ,IAAI,aAAa,QAAQ,KAAK,OAAO,CAACA,SAAQC,SAAQ,IAAI,cAAcD,SAAQC,MAAK,KAAK,GAAG,EAAE,MAAM,EAAE,UAAU,iBAAiB,EAAE,CAAC,CAAC;AAAA,EACxM;AACJ;AACA,IAAO,wBAAQ;",
6
+ "names": ["parent", "key"]
7
+ }
@@ -0,0 +1,8 @@
1
+ declare enum Matcher {
2
+ EQUALS = "EQUALS",
3
+ CONTAINS = "CONTAINS",
4
+ LESS_THAN = "LESS_THAN",
5
+ GREATER_THAN = "GREATER_THAN"
6
+ }
7
+ export default Matcher;
8
+ //# sourceMappingURL=Matcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Matcher.d.ts","sourceRoot":"","sources":["../../../../../../../src/types/com/vaadin/hilla/crud/filter/PropertyStringFilter/Matcher.ts"],"names":[],"mappings":"AAAA,aAAK,OAAO;IACR,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,SAAS,cAAc;IACvB,YAAY,iBAAiB;CAChC;AACD,eAAe,OAAO,CAAC"}
@@ -0,0 +1,12 @@
1
+ var Matcher = /* @__PURE__ */ ((Matcher2) => {
2
+ Matcher2["EQUALS"] = "EQUALS";
3
+ Matcher2["CONTAINS"] = "CONTAINS";
4
+ Matcher2["LESS_THAN"] = "LESS_THAN";
5
+ Matcher2["GREATER_THAN"] = "GREATER_THAN";
6
+ return Matcher2;
7
+ })(Matcher || {});
8
+ var Matcher_default = Matcher;
9
+ export {
10
+ Matcher_default as default
11
+ };
12
+ //# sourceMappingURL=Matcher.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/types/com/vaadin/hilla/crud/filter/PropertyStringFilter/Matcher.ts"],
4
+ "sourcesContent": ["enum Matcher {\n EQUALS = \"EQUALS\",\n CONTAINS = \"CONTAINS\",\n LESS_THAN = \"LESS_THAN\",\n GREATER_THAN = \"GREATER_THAN\"\n}\nexport default Matcher;\n"],
5
+ "mappings": "AAAA,IAAK,UAAL,kBAAKA,aAAL;AACI,EAAAA,SAAA,YAAS;AACT,EAAAA,SAAA,cAAW;AACX,EAAAA,SAAA,eAAY;AACZ,EAAAA,SAAA,kBAAe;AAJd,SAAAA;AAAA,GAAA;AAML,IAAO,kBAAQ;",
6
+ "names": ["Matcher"]
7
+ }
@@ -0,0 +1,8 @@
1
+ import { _enum as _enum_1, EnumModel as EnumModel_1 } from "@vaadin/hilla-lit-form";
2
+ import Matcher_1 from "./Matcher.js";
3
+ declare class MatcherModel extends EnumModel_1<typeof Matcher_1> {
4
+ static createEmptyValue: () => Matcher_1;
5
+ readonly [_enum_1]: typeof Matcher_1;
6
+ }
7
+ export default MatcherModel;
8
+ //# sourceMappingURL=MatcherModel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MatcherModel.d.ts","sourceRoot":"","sources":["../../../../../../../src/types/com/vaadin/hilla/crud/filter/PropertyStringFilter/MatcherModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,SAAS,IAAI,WAAW,EAA4D,MAAM,wBAAwB,CAAC;AAC9I,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,cAAM,YAAa,SAAQ,WAAW,CAAC,OAAO,SAAS,CAAC;IACpD,OAAgB,gBAAgB,kBAA6C;IAC7E,QAAQ,CAAC,CAAC,OAAO,CAAC,mBAAa;CAClC;AACD,eAAe,YAAY,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { _enum as _enum_1, EnumModel as EnumModel_1, makeEnumEmptyValueCreator as makeEnumEmptyValueCreator_1 } from "@vaadin/hilla-lit-form";
2
+ import Matcher_1 from "./Matcher.js";
3
+ class MatcherModel extends EnumModel_1 {
4
+ static createEmptyValue = makeEnumEmptyValueCreator_1(MatcherModel);
5
+ [_enum_1] = Matcher_1;
6
+ }
7
+ var MatcherModel_default = MatcherModel;
8
+ export {
9
+ MatcherModel_default as default
10
+ };
11
+ //# sourceMappingURL=MatcherModel.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../../../src/types/com/vaadin/hilla/crud/filter/PropertyStringFilter/MatcherModel.ts"],
4
+ "sourcesContent": ["import { _enum as _enum_1, EnumModel as EnumModel_1, makeEnumEmptyValueCreator as makeEnumEmptyValueCreator_1 } from \"@vaadin/hilla-lit-form\";\nimport Matcher_1 from \"./Matcher.js\";\nclass MatcherModel extends EnumModel_1<typeof Matcher_1> {\n static override createEmptyValue = makeEnumEmptyValueCreator_1(MatcherModel);\n readonly [_enum_1] = Matcher_1;\n}\nexport default MatcherModel;\n"],
5
+ "mappings": "AAAA,SAAS,SAAS,SAAS,aAAa,aAAa,6BAA6B,mCAAmC;AACrH,OAAO,eAAe;AACtB,MAAM,qBAAqB,YAA8B;AAAA,EACrD,OAAgB,mBAAmB,4BAA4B,YAAY;AAAA,EAC3E,CAAU,OAAO,IAAI;AACzB;AACA,IAAO,uBAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=PropertyStringFilter.d.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,9 @@
1
+ import type Filter_1 from "./Filter.js";
2
+ import type Matcher_1 from "./PropertyStringFilter/Matcher.js";
3
+ interface PropertyStringFilter extends Filter_1 {
4
+ propertyId: string;
5
+ filterValue: string;
6
+ matcher: Matcher_1;
7
+ "@type": "propertyString";
8
+ }
9
+ export default PropertyStringFilter;