@smartsoft001/crud-shell-react 0.0.0-stage → 2.193.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/README.md +12 -3
  2. package/package.json +29 -4
  3. package/src/index.d.ts +19 -0
  4. package/src/index.js +23 -0
  5. package/src/index.js.map +1 -0
  6. package/src/lib/components/export/export.d.ts +7 -0
  7. package/src/lib/components/export/export.js +15 -0
  8. package/src/lib/components/export/export.js.map +1 -0
  9. package/src/lib/components/export/export.types.d.ts +8 -0
  10. package/src/lib/components/export/export.types.js +3 -0
  11. package/src/lib/components/export/export.types.js.map +1 -0
  12. package/src/lib/components/export/index.d.ts +3 -0
  13. package/src/lib/components/export/index.js +7 -0
  14. package/src/lib/components/export/index.js.map +1 -0
  15. package/src/lib/components/export/use-crud-export.d.ts +16 -0
  16. package/src/lib/components/export/use-crud-export.js +74 -0
  17. package/src/lib/components/export/use-crud-export.js.map +1 -0
  18. package/src/lib/components/filter/base/use-crud-filter.d.ts +68 -0
  19. package/src/lib/components/filter/base/use-crud-filter.js +248 -0
  20. package/src/lib/components/filter/base/use-crud-filter.js.map +1 -0
  21. package/src/lib/components/filter/check/filter-check.d.ts +7 -0
  22. package/src/lib/components/filter/check/filter-check.js +45 -0
  23. package/src/lib/components/filter/check/filter-check.js.map +1 -0
  24. package/src/lib/components/filter/date/filter-date.d.ts +7 -0
  25. package/src/lib/components/filter/date/filter-date.js +19 -0
  26. package/src/lib/components/filter/date/filter-date.js.map +1 -0
  27. package/src/lib/components/filter/date/use-crud-filter-date.d.ts +23 -0
  28. package/src/lib/components/filter/date/use-crud-filter-date.js +41 -0
  29. package/src/lib/components/filter/date/use-crud-filter-date.js.map +1 -0
  30. package/src/lib/components/filter/date/use-crud-filter-ng-model.d.ts +6 -0
  31. package/src/lib/components/filter/date/use-crud-filter-ng-model.js +25 -0
  32. package/src/lib/components/filter/date/use-crud-filter-ng-model.js.map +1 -0
  33. package/src/lib/components/filter/date-time/filter-date-time.d.ts +8 -0
  34. package/src/lib/components/filter/date-time/filter-date-time.js +27 -0
  35. package/src/lib/components/filter/date-time/filter-date-time.js.map +1 -0
  36. package/src/lib/components/filter/date-with-edit/filter-date-with-edit.d.ts +9 -0
  37. package/src/lib/components/filter/date-with-edit/filter-date-with-edit.js +42 -0
  38. package/src/lib/components/filter/date-with-edit/filter-date-with-edit.js.map +1 -0
  39. package/src/lib/components/filter/filter.d.ts +8 -0
  40. package/src/lib/components/filter/filter.js +43 -0
  41. package/src/lib/components/filter/filter.js.map +1 -0
  42. package/src/lib/components/filter/filter.types.d.ts +17 -0
  43. package/src/lib/components/filter/filter.types.js +3 -0
  44. package/src/lib/components/filter/filter.types.js.map +1 -0
  45. package/src/lib/components/filter/flag/filter-flag.d.ts +7 -0
  46. package/src/lib/components/filter/flag/filter-flag.js +20 -0
  47. package/src/lib/components/filter/flag/filter-flag.js.map +1 -0
  48. package/src/lib/components/filter/index.d.ts +13 -0
  49. package/src/lib/components/filter/index.js +17 -0
  50. package/src/lib/components/filter/index.js.map +1 -0
  51. package/src/lib/components/filter/int/filter-int.d.ts +12 -0
  52. package/src/lib/components/filter/int/filter-int.js +47 -0
  53. package/src/lib/components/filter/int/filter-int.js.map +1 -0
  54. package/src/lib/components/filter/radio/filter-radio.d.ts +7 -0
  55. package/src/lib/components/filter/radio/filter-radio.js +20 -0
  56. package/src/lib/components/filter/radio/filter-radio.js.map +1 -0
  57. package/src/lib/components/filter/text/filter-text.d.ts +7 -0
  58. package/src/lib/components/filter/text/filter-text.js +20 -0
  59. package/src/lib/components/filter/text/filter-text.js.map +1 -0
  60. package/src/lib/components/filters/filters.d.ts +10 -0
  61. package/src/lib/components/filters/filters.js +20 -0
  62. package/src/lib/components/filters/filters.js.map +1 -0
  63. package/src/lib/components/filters/filters.types.d.ts +5 -0
  64. package/src/lib/components/filters/filters.types.js +3 -0
  65. package/src/lib/components/filters/filters.types.js.map +1 -0
  66. package/src/lib/components/filters/index.d.ts +3 -0
  67. package/src/lib/components/filters/index.js +7 -0
  68. package/src/lib/components/filters/index.js.map +1 -0
  69. package/src/lib/components/filters/use-crud-filters.d.ts +17 -0
  70. package/src/lib/components/filters/use-crud-filters.js +63 -0
  71. package/src/lib/components/filters/use-crud-filters.js.map +1 -0
  72. package/src/lib/components/filters-config/filters-config.d.ts +6 -0
  73. package/src/lib/components/filters-config/filters-config.js +38 -0
  74. package/src/lib/components/filters-config/filters-config.js.map +1 -0
  75. package/src/lib/components/filters-config/index.d.ts +1 -0
  76. package/src/lib/components/filters-config/index.js +5 -0
  77. package/src/lib/components/filters-config/index.js.map +1 -0
  78. package/src/lib/components/group/group.d.ts +10 -0
  79. package/src/lib/components/group/group.js +19 -0
  80. package/src/lib/components/group/group.js.map +1 -0
  81. package/src/lib/components/group/group.types.d.ts +8 -0
  82. package/src/lib/components/group/group.types.js +3 -0
  83. package/src/lib/components/group/group.types.js.map +1 -0
  84. package/src/lib/components/group/index.d.ts +3 -0
  85. package/src/lib/components/group/index.js +7 -0
  86. package/src/lib/components/group/index.js.map +1 -0
  87. package/src/lib/components/group/use-crud-group.d.ts +17 -0
  88. package/src/lib/components/group/use-crud-group.js +50 -0
  89. package/src/lib/components/group/use-crud-group.js.map +1 -0
  90. package/src/lib/components/multiselect/index.d.ts +2 -0
  91. package/src/lib/components/multiselect/index.js +6 -0
  92. package/src/lib/components/multiselect/index.js.map +1 -0
  93. package/src/lib/components/multiselect/multiselect.d.ts +10 -0
  94. package/src/lib/components/multiselect/multiselect.js +25 -0
  95. package/src/lib/components/multiselect/multiselect.js.map +1 -0
  96. package/src/lib/components/multiselect/use-crud-multiselect.d.ts +24 -0
  97. package/src/lib/components/multiselect/use-crud-multiselect.js +72 -0
  98. package/src/lib/components/multiselect/use-crud-multiselect.js.map +1 -0
  99. package/src/lib/crud.config.d.ts +67 -0
  100. package/src/lib/crud.config.js +3 -0
  101. package/src/lib/crud.config.js.map +1 -0
  102. package/src/lib/crud.context.d.ts +23 -0
  103. package/src/lib/crud.context.js +25 -0
  104. package/src/lib/crud.context.js.map +1 -0
  105. package/src/lib/crud.provider.d.ts +16 -0
  106. package/src/lib/crud.provider.js +69 -0
  107. package/src/lib/crud.provider.js.map +1 -0
  108. package/src/lib/factories/form-options.d.ts +10 -0
  109. package/src/lib/factories/form-options.js +26 -0
  110. package/src/lib/factories/form-options.js.map +1 -0
  111. package/src/lib/hooks.d.ts +15 -0
  112. package/src/lib/hooks.js +66 -0
  113. package/src/lib/hooks.js.map +1 -0
  114. package/src/lib/models/index.d.ts +1 -0
  115. package/src/lib/models/index.js +5 -0
  116. package/src/lib/models/index.js.map +1 -0
  117. package/src/lib/models/interfaces.d.ts +29 -0
  118. package/src/lib/models/interfaces.js +3 -0
  119. package/src/lib/models/interfaces.js.map +1 -0
  120. package/src/lib/pages/crud-pages.d.ts +32 -0
  121. package/src/lib/pages/crud-pages.js +64 -0
  122. package/src/lib/pages/crud-pages.js.map +1 -0
  123. package/src/lib/pages/index.d.ts +12 -0
  124. package/src/lib/pages/index.js +16 -0
  125. package/src/lib/pages/index.js.map +1 -0
  126. package/src/lib/pages/item/item-page.d.ts +18 -0
  127. package/src/lib/pages/item/item-page.js +31 -0
  128. package/src/lib/pages/item/item-page.js.map +1 -0
  129. package/src/lib/pages/item/item-page.types.d.ts +47 -0
  130. package/src/lib/pages/item/item-page.types.js +3 -0
  131. package/src/lib/pages/item/item-page.types.js.map +1 -0
  132. package/src/lib/pages/item/standard/item-page-standard.d.ts +10 -0
  133. package/src/lib/pages/item/standard/item-page-standard.js +19 -0
  134. package/src/lib/pages/item/standard/item-page-standard.js.map +1 -0
  135. package/src/lib/pages/item/use-crud-item-page-base.d.ts +22 -0
  136. package/src/lib/pages/item/use-crud-item-page-base.js +47 -0
  137. package/src/lib/pages/item/use-crud-item-page-base.js.map +1 -0
  138. package/src/lib/pages/item/use-crud-item-page.d.ts +44 -0
  139. package/src/lib/pages/item/use-crud-item-page.js +297 -0
  140. package/src/lib/pages/item/use-crud-item-page.js.map +1 -0
  141. package/src/lib/pages/list/list-page.d.ts +17 -0
  142. package/src/lib/pages/list/list-page.js +32 -0
  143. package/src/lib/pages/list/list-page.js.map +1 -0
  144. package/src/lib/pages/list/list-page.types.d.ts +27 -0
  145. package/src/lib/pages/list/list-page.types.js +3 -0
  146. package/src/lib/pages/list/list-page.types.js.map +1 -0
  147. package/src/lib/pages/list/standard/list-page-standard.d.ts +13 -0
  148. package/src/lib/pages/list/standard/list-page-standard.js +28 -0
  149. package/src/lib/pages/list/standard/list-page-standard.js.map +1 -0
  150. package/src/lib/pages/list/use-crud-list-page.d.ts +35 -0
  151. package/src/lib/pages/list/use-crud-list-page.js +309 -0
  152. package/src/lib/pages/list/use-crud-list-page.js.map +1 -0
  153. package/src/lib/pages/use-crud-bound-component.d.ts +10 -0
  154. package/src/lib/pages/use-crud-bound-component.js +28 -0
  155. package/src/lib/pages/use-crud-bound-component.js.map +1 -0
  156. package/src/lib/pages/use-crud-page-config.d.ts +9 -0
  157. package/src/lib/pages/use-crud-page-config.js +19 -0
  158. package/src/lib/pages/use-crud-page-config.js.map +1 -0
  159. package/src/lib/providers/model-label.provider.d.ts +11 -0
  160. package/src/lib/providers/model-label.provider.js +27 -0
  161. package/src/lib/providers/model-label.provider.js.map +1 -0
  162. package/src/lib/services/crud/crud.service.d.ts +44 -0
  163. package/src/lib/services/crud/crud.service.js +113 -0
  164. package/src/lib/services/crud/crud.service.js.map +1 -0
  165. package/src/lib/services/list-group/list-group.service.d.ts +18 -0
  166. package/src/lib/services/list-group/list-group.service.js +52 -0
  167. package/src/lib/services/list-group/list-group.service.js.map +1 -0
  168. package/src/lib/services/page/page.service.d.ts +8 -0
  169. package/src/lib/services/page/page.service.js +33 -0
  170. package/src/lib/services/page/page.service.js.map +1 -0
  171. package/src/lib/services/search/search.service.d.ts +14 -0
  172. package/src/lib/services/search/search.service.js +28 -0
  173. package/src/lib/services/search/search.service.js.map +1 -0
  174. package/src/lib/state/crud.actions.d.ts +157 -0
  175. package/src/lib/state/crud.actions.js +257 -0
  176. package/src/lib/state/crud.actions.js.map +1 -0
  177. package/src/lib/state/crud.effects.d.ts +20 -0
  178. package/src/lib/state/crud.effects.js +128 -0
  179. package/src/lib/state/crud.effects.js.map +1 -0
  180. package/src/lib/state/crud.facade.d.ts +43 -0
  181. package/src/lib/state/crud.facade.js +93 -0
  182. package/src/lib/state/crud.facade.js.map +1 -0
  183. package/src/lib/state/crud.reducer.d.ts +20 -0
  184. package/src/lib/state/crud.reducer.js +218 -0
  185. package/src/lib/state/crud.reducer.js.map +1 -0
  186. package/src/lib/state/crud.selectors.d.ts +9 -0
  187. package/src/lib/state/crud.selectors.js +25 -0
  188. package/src/lib/state/crud.selectors.js.map +1 -0
  189. package/src/lib/state/crud.store.d.ts +17 -0
  190. package/src/lib/state/crud.store.js +33 -0
  191. package/src/lib/state/crud.store.js.map +1 -0
  192. package/src/lib/state/index.d.ts +6 -0
  193. package/src/lib/state/index.js +10 -0
  194. package/src/lib/state/index.js.map +1 -0
  195. package/styles.css +6001 -0
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SmartCrudFilterCheck = SmartCrudFilterCheck;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const react_2 = require("@smartsoft001/react");
7
+ const use_crud_filter_1 = require("../base/use-crud-filter");
8
+ /**
9
+ * A checkbox with the Angular `[checked]` property binding: the box follows
10
+ * the user's click right away, and `checked` is written to it whenever it
11
+ * changes (the read is debounced, so the value follows 500 ms later).
12
+ */
13
+ function FilterCheckbox({ checked, onCheckedChange, }) {
14
+ const ref = (0, react_1.useRef)(null);
15
+ (0, react_1.useEffect)(() => {
16
+ if (ref.current)
17
+ ref.current.checked = checked;
18
+ }, [checked]);
19
+ return ((0, jsx_runtime_1.jsx)("input", { ref: ref, type: "checkbox", defaultChecked: checked, onChange: (e) => onCheckedChange(e.target.checked), className: "smart:h-4 smart:w-4 smart:rounded smart:border-gray-300 smart:text-indigo-600 smart:focus:ring-indigo-500" }));
20
+ }
21
+ /**
22
+ * `<smart-crud-filter-check>` (Angular `FilterCheckComponent`): a checkbox
23
+ * per possibility, checked when its id is among the item's values, and a
24
+ * clear button while any is checked. Each value is its own query entry.
25
+ */
26
+ function SmartCrudFilterCheck(props) {
27
+ const t = (0, react_2.useTranslate)();
28
+ const { value, possibilities, setValue, refresh } = (0, use_crud_filter_1.useCrudFilter)(props);
29
+ const values = value ?? [];
30
+ const hasCheckedValues = Array.isArray(value) && value.length > 0;
31
+ const list = (possibilities ?? []).map((pos) => ({
32
+ value: pos,
33
+ isCheck: values.some((r) => r === pos.id),
34
+ }));
35
+ const onCheckChange = (checked, entry) => {
36
+ if (checked && !values.some((r) => r === entry.id)) {
37
+ setValue([...values, entry.id]);
38
+ }
39
+ if (!checked && values.some((r) => r === entry.id)) {
40
+ setValue(value?.filter((r) => r !== entry.id));
41
+ }
42
+ };
43
+ return ((0, jsx_runtime_1.jsx)("div", { className: "smart:block smart:w-full", children: (0, jsx_runtime_1.jsxs)("fieldset", { className: "smart:w-full", children: [(0, jsx_runtime_1.jsxs)("legend", { className: "smart:flex smart:items-center smart:justify-between smart:text-sm smart:font-medium smart:text-gray-900", children: [(0, jsx_runtime_1.jsx)("span", { children: t(props.item?.label || '') }), hasCheckedValues && ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: () => refresh([]), "aria-label": "clear", className: "smart:rounded smart:px-2 smart:py-1 smart:text-red-600 smart:hover:bg-red-50", children: "\u00D7" }))] }), (0, jsx_runtime_1.jsx)("div", { className: "smart:mt-2 smart:space-y-2", children: list.map((entry) => ((0, jsx_runtime_1.jsxs)("label", { className: "smart:flex smart:items-center smart:gap-x-2", children: [(0, jsx_runtime_1.jsx)(FilterCheckbox, { checked: entry.isCheck, onCheckedChange: (checked) => onCheckChange(checked, entry.value) }), (0, jsx_runtime_1.jsx)("span", { className: "smart:text-sm smart:text-gray-900", children: t(entry.value.text) })] }, entry.value.id))) })] }) }));
44
+ }
45
+ //# sourceMappingURL=filter-check.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter-check.js","sourceRoot":"","sources":["../../../../../../../../../../packages/crud/shell/react/src/lib/components/filter/check/filter-check.tsx"],"names":[],"mappings":";;AAyCA,oDAyDC;;AAlGD,iCAA0C;AAE1C,+CAAmD;AAEnD,6DAAwD;AAGxD;;;;GAIG;AACH,SAAS,cAAc,CAAC,EACtB,OAAO,EACP,eAAe,GAIhB;IACC,MAAM,GAAG,GAAG,IAAA,cAAM,EAAmB,IAAI,CAAC,CAAC;IAE3C,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,GAAG,CAAC,OAAO;YAAE,GAAG,CAAC,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC;IACjD,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,OAAO,CACL,kCACE,GAAG,EAAE,GAAG,EACR,IAAI,EAAC,UAAU,EACf,cAAc,EAAE,OAAO,EACvB,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EAClD,SAAS,EAAC,2GAA2G,GACrH,CACH,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAgB,oBAAoB,CAAC,KAA2B;IAC9D,MAAM,CAAC,GAAG,IAAA,oBAAY,GAAE,CAAC;IACzB,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAA,+BAAa,EAAC,KAAK,CAAC,CAAC;IACzE,MAAM,MAAM,GAAU,KAAK,IAAI,EAAE,CAAC;IAClC,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IAClE,MAAM,IAAI,GAAG,CAAC,aAAa,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC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C,6CAA6C,aAEvD,uBAAC,cAAc,IACb,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,eAAe,EAAE,CAAC,OAAO,EAAE,EAAE,CAC3B,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,GAErC,EACF,iCAAM,SAAS,EAAC,mCAAmC,YAChD,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,GACf,KAXF,KAAK,CAAC,KAAK,CAAC,EAAE,CAYb,CACT,CAAC,GACE,IACG,GACP,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { SmartCrudFilterProps } from '../filter.types';
2
+ /**
3
+ * `<smart-crud-filter-date>` (Angular `FilterDateComponent`): the item label,
4
+ * the shared date editor bound to the item's value (`YYYY-MM-DD`) and a
5
+ * clear button while it has one.
6
+ */
7
+ export declare function SmartCrudFilterDate(props: SmartCrudFilterProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SmartCrudFilterDate = SmartCrudFilterDate;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("@smartsoft001/react");
6
+ const use_crud_filter_date_1 = require("./use-crud-filter-date");
7
+ const use_crud_filter_ng_model_1 = require("./use-crud-filter-ng-model");
8
+ /**
9
+ * `<smart-crud-filter-date>` (Angular `FilterDateComponent`): the item label,
10
+ * the shared date editor bound to the item's value (`YYYY-MM-DD`) and a
11
+ * clear button while it has one.
12
+ */
13
+ function SmartCrudFilterDate(props) {
14
+ const t = (0, react_1.useTranslate)();
15
+ const { customValue, setCustomValue, hasValue, refresh } = (0, use_crud_filter_date_1.useCrudFilterDate)(props);
16
+ const [date, setDate] = (0, use_crud_filter_ng_model_1.useCrudFilterNgModel)(customValue || '', setCustomValue);
17
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "smart:block smart:w-full", children: [(0, jsx_runtime_1.jsx)("label", { className: "smart:mb-1 smart:block smart:text-sm smart:font-medium", children: t(props.item?.label || '') }), (0, jsx_runtime_1.jsxs)("div", { className: "smart:flex smart:w-full smart:items-end smart:gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "smart:flex-1", children: (0, jsx_runtime_1.jsx)(react_1.SmartDateEdit, { className: "smart:flex-1", value: date, onValueChange: setDate }) }), hasValue && ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: () => refresh(null), "aria-label": "clear", className: "smart:shrink-0 smart:rounded smart:px-2 smart:py-2 smart:text-red-600 smart:hover:bg-red-50", children: "\u00D7" }))] })] }));
18
+ }
19
+ //# sourceMappingURL=filter-date.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter-date.js","sourceRoot":"","sources":["../../../../../../../../../../packages/crud/shell/react/src/lib/components/filter/date/filter-date.tsx"],"names":[],"mappings":";;AAWA,kDAmCC;;AA9CD,+CAAkE;AAElE,iEAA2D;AAC3D,yEAAkE;AAGlE;;;;GAIG;AACH,SAAgB,mBAAmB,CAAC,KAA2B;IAC7D,MAAM,CAAC,GAAG,IAAA,oBAAY,GAAE,CAAC;IACzB,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO,EAAE,GACtD,IAAA,wCAAiB,EAAC,KAAK,CAAC,CAAC;IAC3B,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,IAAA,+CAAoB,EAC1C,WAAW,IAAI,EAAE,EACjB,cAAc,CACf,CAAC;IAEF,OAAO,CACL,iCAAK,SAAS,EAAC,0BAA0B,aACvC,kCAAO,SAAS,EAAC,wDAAwD,YACtE,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC,GACrB,EACR,iCAAK,SAAS,EAAC,qDAAqD,aAClE,gCAAK,SAAS,EAAC,cAAc,YAC3B,uBAAC,qBAAa,IACZ,SAAS,EAAC,cAAc,EACxB,KAAK,EAAE,IAAI,EACX,aAAa,EAAE,OAAO,GACtB,GACE,EACL,QAAQ,IAAI,CACX,mCACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,gBACjB,OAAO,EAClB,SAAS,EAAC,6FAA6F,uBAGhG,CACV,IACG,IACF,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { UseCrudFilterResult } from '../base/use-crud-filter';
2
+ import { SmartCrudFilterProps } from '../filter.types';
3
+ /** What `useCrudFilterDate` returns. */
4
+ export interface UseCrudFilterDateResult extends UseCrudFilterResult {
5
+ /** The advanced from / to range is offered for an `=` item. */
6
+ allowAdvanced: boolean;
7
+ customValue: any;
8
+ customMinValue: any;
9
+ customMaxValue: any;
10
+ /** Sets the value as a `YYYY-MM-DD` date (debounced). */
11
+ setCustomValue: (val: any) => void;
12
+ /** Sets the `>=` value as a `YYYY-MM-DD` date (debounced). */
13
+ setCustomMinValue: (val: any) => void;
14
+ /** Sets the `<=` value as a `YYYY-MM-DD` date (debounced). */
15
+ setCustomMaxValue: (val: any) => void;
16
+ }
17
+ /**
18
+ * What the date filters share (the Angular `FilterDateComponent`, which the
19
+ * date-time and date-with-edit filters extend): `useCrudFilter` with the
20
+ * `customValue` / `customMinValue` / `customMaxValue` accessors, whose
21
+ * setters store a valid date as `YYYY-MM-DD`.
22
+ */
23
+ export declare function useCrudFilterDate(props: SmartCrudFilterProps): UseCrudFilterDateResult;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useCrudFilterDate = useCrudFilterDate;
4
+ const tslib_1 = require("tslib");
5
+ const moment_1 = tslib_1.__importDefault(require("moment"));
6
+ const react_1 = require("react");
7
+ const use_crud_filter_1 = require("../base/use-crud-filter");
8
+ /**
9
+ * A date the user entered as the filter stores it: a valid date of at least
10
+ * ten characters (e.g. a `datetime-local` value) as `YYYY-MM-DD`, anything
11
+ * else as it is.
12
+ */
13
+ function toFilterDate(val) {
14
+ return val?.length >= 10 && (0, moment_1.default)(val).isValid()
15
+ ? (0, moment_1.default)(val).format('YYYY-MM-DD')
16
+ : val;
17
+ }
18
+ /**
19
+ * What the date filters share (the Angular `FilterDateComponent`, which the
20
+ * date-time and date-with-edit filters extend): `useCrudFilter` with the
21
+ * `customValue` / `customMinValue` / `customMaxValue` accessors, whose
22
+ * setters store a valid date as `YYYY-MM-DD`.
23
+ */
24
+ function useCrudFilterDate(props) {
25
+ const filter = (0, use_crud_filter_1.useCrudFilter)(props);
26
+ const { setValue, setMinValue, setMaxValue } = filter;
27
+ const setCustomValue = (0, react_1.useCallback)((val) => setValue(toFilterDate(val)), [setValue]);
28
+ const setCustomMinValue = (0, react_1.useCallback)((val) => setMinValue(toFilterDate(val)), [setMinValue]);
29
+ const setCustomMaxValue = (0, react_1.useCallback)((val) => setMaxValue(toFilterDate(val)), [setMaxValue]);
30
+ return {
31
+ ...filter,
32
+ allowAdvanced: props.item?.type === '=',
33
+ customValue: filter.value,
34
+ customMinValue: filter.minValue,
35
+ customMaxValue: filter.maxValue,
36
+ setCustomValue,
37
+ setCustomMinValue,
38
+ setCustomMaxValue,
39
+ };
40
+ }
41
+ //# sourceMappingURL=use-crud-filter-date.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-crud-filter-date.js","sourceRoot":"","sources":["../../../../../../../../../../packages/crud/shell/react/src/lib/components/filter/date/use-crud-filter-date.ts"],"names":[],"mappings":";;AAsCA,8CA6BC;;AAnED,4DAA4B;AAC5B,iCAAoC;AAEpC,6DAA6E;AAG7E;;;;GAIG;AACH,SAAS,YAAY,CAAC,GAAQ;IAC5B,OAAO,GAAG,EAAE,MAAM,IAAI,EAAE,IAAI,IAAA,gBAAM,EAAC,GAAG,CAAC,CAAC,OAAO,EAAE;QAC/C,CAAC,CAAC,IAAA,gBAAM,EAAC,GAAG,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC;QAClC,CAAC,CAAC,GAAG,CAAC;AACV,CAAC;AAiBD;;;;;GAKG;AACH,SAAgB,iBAAiB,CAC/B,KAA2B;IAE3B,MAAM,MAAM,GAAG,IAAA,+BAAa,EAAC,KAAK,CAAC,CAAC;IACpC,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC;IAEtD,MAAM,cAAc,GAAG,IAAA,mBAAW,EAChC,CAAC,GAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,EACzC,CAAC,QAAQ,CAAC,CACX,CAAC;IACF,MAAM,iBAAiB,GAAG,IAAA,mBAAW,EACnC,CAAC,GAAQ,EAAE,EAAE,CAAC,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,EAC5C,CAAC,WAAW,CAAC,CACd,CAAC;IACF,MAAM,iBAAiB,GAAG,IAAA,mBAAW,EACnC,CAAC,GAAQ,EAAE,EAAE,CAAC,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,EAC5C,CAAC,WAAW,CAAC,CACd,CAAC;IAEF,OAAO;QACL,GAAG,MAAM;QACT,aAAa,EAAE,KAAK,CAAC,IAAI,EAAE,IAAI,KAAK,GAAG;QACvC,WAAW,EAAE,MAAM,CAAC,KAAK;QACzB,cAAc,EAAE,MAAM,CAAC,QAAQ;QAC/B,cAAc,EAAE,MAAM,CAAC,QAAQ;QAC/B,cAAc;QACd,iBAAiB;QACjB,iBAAiB;KAClB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The `[ngModel]="model"` + `(ngModelChange)` binding of the Angular date
3
+ * filters: the editor shows what the user entered (the filter is read 500 ms
4
+ * later) until the bound model changes, and then shows the model.
5
+ */
6
+ export declare function useCrudFilterNgModel<T>(model: T, onModelChange: (value: T) => void): [T, (value: T) => void];
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useCrudFilterNgModel = useCrudFilterNgModel;
4
+ const react_1 = require("react");
5
+ /**
6
+ * The `[ngModel]="model"` + `(ngModelChange)` binding of the Angular date
7
+ * filters: the editor shows what the user entered (the filter is read 500 ms
8
+ * later) until the bound model changes, and then shows the model.
9
+ */
10
+ function useCrudFilterNgModel(model, onModelChange) {
11
+ const [view, setView] = (0, react_1.useState)(model);
12
+ const [prevModel, setPrevModel] = (0, react_1.useState)(model);
13
+ let current = view;
14
+ if (!Object.is(prevModel, model)) {
15
+ setPrevModel(model);
16
+ setView(model);
17
+ current = model;
18
+ }
19
+ const onViewChange = (0, react_1.useCallback)((value) => {
20
+ setView(value);
21
+ onModelChange(value);
22
+ }, [onModelChange]);
23
+ return [current, onViewChange];
24
+ }
25
+ //# sourceMappingURL=use-crud-filter-ng-model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-crud-filter-ng-model.js","sourceRoot":"","sources":["../../../../../../../../../../packages/crud/shell/react/src/lib/components/filter/date/use-crud-filter-ng-model.ts"],"names":[],"mappings":";;AAOA,oDAuBC;AA9BD,iCAA8C;AAE9C;;;;GAIG;AACH,SAAgB,oBAAoB,CAClC,KAAQ,EACR,aAAiC;IAEjC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IACxC,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAClD,IAAI,OAAO,GAAG,IAAI,CAAC;IAEnB,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC;QACjC,YAAY,CAAC,KAAK,CAAC,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,CAAC;QACf,OAAO,GAAG,KAAK,CAAC;IAClB,CAAC;IAED,MAAM,YAAY,GAAG,IAAA,mBAAW,EAC9B,CAAC,KAAQ,EAAE,EAAE;QACX,OAAO,CAAC,KAAK,CAAC,CAAC;QACf,aAAa,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC,EACD,CAAC,aAAa,CAAC,CAChB,CAAC;IAEF,OAAO,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AACjC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { SmartCrudFilterProps } from '../filter.types';
2
+ /**
3
+ * `<smart-crud-filter-date-time>` (Angular `FilterDateTimeComponent`): the
4
+ * item label and a "from" / "to" pair of native `datetime-local` inputs for
5
+ * the `>=` / `<=` values, each with its clear button. As in Angular, a valid
6
+ * date-time is stored as its `YYYY-MM-DD` day.
7
+ */
8
+ export declare function SmartCrudFilterDateTime(props: SmartCrudFilterProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SmartCrudFilterDateTime = SmartCrudFilterDateTime;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const react_2 = require("@smartsoft001/react");
7
+ const use_crud_filter_date_1 = require("../date/use-crud-filter-date");
8
+ const use_crud_filter_ng_model_1 = require("../date/use-crud-filter-ng-model");
9
+ /** One end of the range: a label, a `datetime-local` input and its clear. */
10
+ function DateTimeRangeRow({ label, model, onModelChange, clearLabel, showClear, onClear, }) {
11
+ const t = (0, react_2.useTranslate)();
12
+ const id = (0, react_1.useId)();
13
+ const [value, setValue] = (0, use_crud_filter_ng_model_1.useCrudFilterNgModel)(model, onModelChange);
14
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "smart:flex smart:w-full smart:items-end smart:gap-2", children: [(0, jsx_runtime_1.jsx)("label", { htmlFor: id, className: "smart:text-sm", children: t(label) }), (0, jsx_runtime_1.jsx)("input", { id: id, type: "datetime-local", className: "smart:flex-1 smart:rounded smart:border smart:border-gray-300 smart:px-2 smart:py-1", value: value, onChange: (e) => setValue(e.target.value) }), showClear && ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: onClear, "aria-label": clearLabel, className: "smart:shrink-0 smart:rounded smart:px-2 smart:py-2 smart:text-red-600 smart:hover:bg-red-50", children: "\u00D7" }))] }));
15
+ }
16
+ /**
17
+ * `<smart-crud-filter-date-time>` (Angular `FilterDateTimeComponent`): the
18
+ * item label and a "from" / "to" pair of native `datetime-local` inputs for
19
+ * the `>=` / `<=` values, each with its clear button. As in Angular, a valid
20
+ * date-time is stored as its `YYYY-MM-DD` day.
21
+ */
22
+ function SmartCrudFilterDateTime(props) {
23
+ const t = (0, react_2.useTranslate)();
24
+ const { customMinValue, customMaxValue, setCustomMinValue, setCustomMaxValue, hasMinValue, hasMaxValue, refresh, } = (0, use_crud_filter_date_1.useCrudFilterDate)(props);
25
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "smart:block smart:w-full", children: [(0, jsx_runtime_1.jsx)("label", { className: "smart:mb-1 smart:block smart:text-sm smart:font-medium", children: t(props.item?.label || '') }), (0, jsx_runtime_1.jsxs)("div", { className: "smart:flex smart:w-full smart:flex-col smart:gap-2", children: [(0, jsx_runtime_1.jsx)(DateTimeRangeRow, { label: "from", model: customMinValue || '', onModelChange: setCustomMinValue, clearLabel: "clear-from", showClear: hasMinValue, onClear: () => refresh(null, '>=') }), (0, jsx_runtime_1.jsx)(DateTimeRangeRow, { label: "to", model: customMaxValue || '', onModelChange: setCustomMaxValue, clearLabel: "clear-to", showClear: hasMaxValue, onClear: () => refresh(null, '<=') })] })] }));
26
+ }
27
+ //# sourceMappingURL=filter-date-time.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter-date-time.js","sourceRoot":"","sources":["../../../../../../../../../../packages/crud/shell/react/src/lib/components/filter/date-time/filter-date-time.tsx"],"names":[],"mappings":";;AA4DA,0DAqCC;;AAjGD,iCAA8B;AAE9B,+CAAmD;AAEnD,uEAAiE;AACjE,+EAAwE;AAGxE,6EAA6E;AAC7E,SAAS,gBAAgB,CAAC,EACxB,KAAK,EACL,KAAK,EACL,aAAa,EACb,UAAU,EACV,SAAS,EACT,OAAO,GAQR;IACC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,UAAU,EAAC,YAAY,EACvB,SAAS,EAAE,WAAW,EACtB,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,GAClC,EACF,uBAAC,gBAAgB,IACf,KAAK,EAAC,IAAI,EACV,KAAK,EAAE,cAAc,IAAI,EAAE,EAC3B,aAAa,EAAE,iBAAiB,EAChC,UAAU,EAAC,UAAU,EACrB,SAAS,EAAE,WAAW,EACtB,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,GAClC,IACE,IACF,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { SmartCrudFilterProps } from '../filter.types';
2
+ /**
3
+ * `<smart-crud-filter-date-with-edit>` (Angular
4
+ * `FilterDateWithEditComponent`): the item label and the shared date editor
5
+ * for the item's value; for an `=` item an "advanced" button switches to a
6
+ * "from" / "to" pair of editors for the `>=` / `<=` values (removing the
7
+ * value), shown as well while a range value is set.
8
+ */
9
+ export declare function SmartCrudFilterDateWithEdit(props: SmartCrudFilterProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SmartCrudFilterDateWithEdit = SmartCrudFilterDateWithEdit;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const react_2 = require("@smartsoft001/react");
7
+ const use_crud_filter_date_1 = require("../date/use-crud-filter-date");
8
+ const use_crud_filter_ng_model_1 = require("../date/use-crud-filter-ng-model");
9
+ const CLEAR_CLASSES = 'smart:shrink-0 smart:rounded smart:px-2 smart:py-2 smart:text-red-600 smart:hover:bg-red-50';
10
+ /**
11
+ * `<smart-date-edit class="smart:flex-1" [ngModel] (ngModelChange)>`: the
12
+ * shared date editor showing what the user entered until `model` changes.
13
+ */
14
+ function BoundDateEdit({ model, onModelChange, }) {
15
+ const [value, setValue] = (0, use_crud_filter_ng_model_1.useCrudFilterNgModel)(model, onModelChange);
16
+ return ((0, jsx_runtime_1.jsx)("div", { className: "smart:flex-1", children: (0, jsx_runtime_1.jsx)(react_2.SmartDateEdit, { className: "smart:flex-1", value: value, onValueChange: setValue }) }));
17
+ }
18
+ /** One end of the advanced range: a label, a date editor and its clear. */
19
+ function DateRangeRow({ label, model, onModelChange, clearLabel, showClear, onClear, }) {
20
+ const t = (0, react_2.useTranslate)();
21
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "smart:flex smart:w-full smart:items-end smart:gap-2", children: [(0, jsx_runtime_1.jsx)("label", { className: "smart:text-sm", children: t(label) }), (0, jsx_runtime_1.jsx)(BoundDateEdit, { model: model, onModelChange: onModelChange }), showClear && ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: onClear, "aria-label": clearLabel, className: CLEAR_CLASSES, children: "\u00D7" }))] }));
22
+ }
23
+ /**
24
+ * `<smart-crud-filter-date-with-edit>` (Angular
25
+ * `FilterDateWithEditComponent`): the item label and the shared date editor
26
+ * for the item's value; for an `=` item an "advanced" button switches to a
27
+ * "from" / "to" pair of editors for the `>=` / `<=` values (removing the
28
+ * value), shown as well while a range value is set.
29
+ */
30
+ function SmartCrudFilterDateWithEdit(props) {
31
+ const t = (0, react_2.useTranslate)();
32
+ const { allowAdvanced, customValue, customMinValue, customMaxValue, setCustomValue, setCustomMinValue, setCustomMaxValue, hasValue, hasMinValue, hasMaxValue, setValue, refresh, } = (0, use_crud_filter_date_1.useCrudFilterDate)(props);
33
+ const [advanced, setAdvanced] = (0, react_1.useState)(false);
34
+ const toggleAdvanced = () => {
35
+ const next = !advanced;
36
+ setAdvanced(next);
37
+ if (next)
38
+ setValue(null);
39
+ };
40
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "smart:block smart:w-full", children: [(0, jsx_runtime_1.jsx)("label", { className: "smart:mb-1 smart:block smart:text-sm smart:font-medium", children: t(props.item?.label || '') }), !advanced ? ((0, jsx_runtime_1.jsxs)("div", { className: "smart:flex smart:w-full smart:items-end smart:gap-2", children: [(0, jsx_runtime_1.jsx)(BoundDateEdit, { model: customValue || '', onModelChange: setCustomValue }), allowAdvanced && ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: toggleAdvanced, "aria-label": "advanced", className: "smart:shrink-0 smart:rounded smart:px-2 smart:py-2 smart:hover:bg-gray-100", children: "\u2699" })), hasValue && ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: () => refresh(null), "aria-label": "clear", className: CLEAR_CLASSES, children: "\u00D7" }))] })) : (allowAdvanced && ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: toggleAdvanced, "aria-label": "advanced", className: "smart:mb-2 smart:rounded smart:px-2 smart:py-2 smart:hover:bg-gray-100", children: "\u2699" }))), (advanced || hasMinValue || hasMaxValue) && allowAdvanced && ((0, jsx_runtime_1.jsxs)("div", { className: "smart:flex smart:w-full smart:flex-col smart:gap-2", children: [(0, jsx_runtime_1.jsx)(DateRangeRow, { label: "from", model: customMinValue || '', onModelChange: setCustomMinValue, clearLabel: "clear-from", showClear: hasMinValue, onClear: () => refresh(null, '>=') }), (0, jsx_runtime_1.jsx)(DateRangeRow, { label: "to", model: customMaxValue || '', onModelChange: setCustomMaxValue, clearLabel: "clear-to", showClear: hasMaxValue, onClear: () => refresh(null, '<=') })] }))] }));
41
+ }
42
+ //# sourceMappingURL=filter-date-with-edit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter-date-with-edit.js","sourceRoot":"","sources":["../../../../../../../../../../packages/crud/shell/react/src/lib/components/filter/date-with-edit/filter-date-with-edit.tsx"],"names":[],"mappings":";;AA8EA,kEA6FC;;AA3KD,iCAAiC;AAEjC,+CAAkE;AAElE,uEAAiE;AACjE,+EAAwE;AAGxE,MAAM,aAAa,GACjB,6FAA6F,CAAC;AAEhG;;;GAGG;AACH,SAAS,aAAa,CAAC,EACrB,KAAK,EACL,aAAa,GAId;IACC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IA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Aa,EAAE,iBAAiB,EAChC,UAAU,EAAC,UAAU,EACrB,SAAS,EAAE,WAAW,EACtB,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,GAClC,IACE,CACP,IACG,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { SmartCrudFilterProps } from './filter.types';
2
+ /**
3
+ * `<smart-crud-filter>` (Angular `FilterComponent`): the filter field of the
4
+ * item's field type (date, date with edit, date-time, radio, check, flag,
5
+ * int; text otherwise), reading and writing the list filter through the
6
+ * feature's facade.
7
+ */
8
+ export declare function SmartCrudFilter(props: SmartCrudFilterProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SmartCrudFilter = SmartCrudFilter;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const models_1 = require("@smartsoft001/models");
6
+ const filter_check_1 = require("./check/filter-check");
7
+ const filter_date_1 = require("./date/filter-date");
8
+ const filter_date_time_1 = require("./date-time/filter-date-time");
9
+ const filter_date_with_edit_1 = require("./date-with-edit/filter-date-with-edit");
10
+ const filter_flag_1 = require("./flag/filter-flag");
11
+ const filter_int_1 = require("./int/filter-int");
12
+ const filter_radio_1 = require("./radio/filter-radio");
13
+ const filter_text_1 = require("./text/filter-text");
14
+ function SmartCrudFilterField(props) {
15
+ switch (props.item?.fieldType) {
16
+ case models_1.FieldType.date:
17
+ return (0, jsx_runtime_1.jsx)(filter_date_1.SmartCrudFilterDate, { ...props });
18
+ case models_1.FieldType.dateWithEdit:
19
+ return (0, jsx_runtime_1.jsx)(filter_date_with_edit_1.SmartCrudFilterDateWithEdit, { ...props });
20
+ case models_1.FieldType.dateTime:
21
+ return (0, jsx_runtime_1.jsx)(filter_date_time_1.SmartCrudFilterDateTime, { ...props });
22
+ case models_1.FieldType.radio:
23
+ return (0, jsx_runtime_1.jsx)(filter_radio_1.SmartCrudFilterRadio, { ...props });
24
+ case models_1.FieldType.check:
25
+ return (0, jsx_runtime_1.jsx)(filter_check_1.SmartCrudFilterCheck, { ...props });
26
+ case models_1.FieldType.flag:
27
+ return (0, jsx_runtime_1.jsx)(filter_flag_1.SmartCrudFilterFlag, { ...props });
28
+ case models_1.FieldType.int:
29
+ return (0, jsx_runtime_1.jsx)(filter_int_1.SmartCrudFilterInt, { ...props });
30
+ default:
31
+ return (0, jsx_runtime_1.jsx)(filter_text_1.SmartCrudFilterText, { ...props });
32
+ }
33
+ }
34
+ /**
35
+ * `<smart-crud-filter>` (Angular `FilterComponent`): the filter field of the
36
+ * item's field type (date, date with edit, date-time, radio, check, flag,
37
+ * int; text otherwise), reading and writing the list filter through the
38
+ * feature's facade.
39
+ */
40
+ function SmartCrudFilter(props) {
41
+ return ((0, jsx_runtime_1.jsx)("div", { className: "smart:py-1", children: (0, jsx_runtime_1.jsx)(SmartCrudFilterField, { ...props }) }));
42
+ }
43
+ //# sourceMappingURL=filter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter.js","sourceRoot":"","sources":["../../../../../../../../../packages/crud/shell/react/src/lib/components/filter/filter.tsx"],"names":[],"mappings":";;AAuCA,0CAMC;;AA7CD,iDAAiD;AAEjD,uDAA4D;AAC5D,oDAAyD;AACzD,mEAAuE;AACvE,kFAAqF;AAErF,oDAAyD;AACzD,iDAAsD;AACtD,uDAA4D;AAC5D,oDAAyD;AAEzD,SAAS,oBAAoB,CAAC,KAA2B;IACvD,QAAQ,KAAK,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC;QAC9B,KAAK,kBAAS,CAAC,IAAI;YACjB,OAAO,uBAAC,iCAAmB,OAAK,KAAK,GAAI,CAAC;QAC5C,KAAK,kBAAS,CAAC,YAAY;YACzB,OAAO,uBAAC,mDAA2B,OAAK,KAAK,GAAI,CAAC;QACpD,KAAK,kBAAS,CAAC,QAAQ;YACrB,OAAO,uBAAC,0CAAuB,OAAK,KAAK,GAAI,CAAC;QAChD,KAAK,kBAAS,CAAC,KAAK;YAClB,OAAO,uBAAC,mCAAoB,OAAK,KAAK,GAAI,CAAC;QAC7C,KAAK,kBAAS,CAAC,KAAK;YAClB,OAAO,uBAAC,mCAAoB,OAAK,KAAK,GAAI,CAAC;QAC7C,KAAK,kBAAS,CAAC,IAAI;YACjB,OAAO,uBAAC,iCAAmB,OAAK,KAAK,GAAI,CAAC;QAC5C,KAAK,kBAAS,CAAC,GAAG;YAChB,OAAO,uBAAC,+BAAkB,OAAK,KAAK,GAAI,CAAC;QAC3C;YACE,OAAO,uBAAC,iCAAmB,OAAK,KAAK,GAAI,CAAC;IAC9C,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,KAA2B;IACzD,OAAO,CACL,gCAAK,SAAS,EAAC,YAAY,YACzB,uBAAC,oBAAoB,OAAK,KAAK,GAAI,GAC/B,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { IModelFilter } from '@smartsoft001/models';
2
+ import { ICrudFilter } from '../../models';
3
+ /**
4
+ * The props of `SmartCrudFilter` and of every filter field (the inputs of the
5
+ * Angular filter `BaseComponent`).
6
+ */
7
+ export interface SmartCrudFilterProps {
8
+ /** The filter definition of the model (`IModelOptions.filters` item). */
9
+ item?: IModelFilter;
10
+ /** The current filter of the list, e.g. `useCrudState(s => s.filter)`. */
11
+ filter?: ICrudFilter | null;
12
+ }
13
+ /** An option of a radio / check filter. */
14
+ export interface CrudFilterPossibility {
15
+ id: any;
16
+ text: string;
17
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=filter.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter.types.js","sourceRoot":"","sources":["../../../../../../../../../packages/crud/shell/react/src/lib/components/filter/filter.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import { SmartCrudFilterProps } from '../filter.types';
2
+ /**
3
+ * `<smart-crud-filter-flag>` (Angular `FilterFlagComponent`): the shared flag
4
+ * field bound to the item's value, and a clear button while the value is
5
+ * `true` or `false`.
6
+ */
7
+ export declare function SmartCrudFilterFlag(props: SmartCrudFilterProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SmartCrudFilterFlag = SmartCrudFilterFlag;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const react_2 = require("@smartsoft001/react");
7
+ const use_crud_filter_1 = require("../base/use-crud-filter");
8
+ /**
9
+ * `<smart-crud-filter-flag>` (Angular `FilterFlagComponent`): the shared flag
10
+ * field bound to the item's value, and a clear button while the value is
11
+ * `true` or `false`.
12
+ */
13
+ function SmartCrudFilterFlag(props) {
14
+ const filter = (0, use_crud_filter_1.useCrudFilter)(props);
15
+ const control = (0, use_crud_filter_1.useCrudFilterControl)(filter);
16
+ const { buildInputOptions, value, refresh } = filter;
17
+ const options = (0, react_1.useMemo)(() => buildInputOptions(control), [buildInputOptions, control]);
18
+ return ((0, jsx_runtime_1.jsx)("div", { className: "smart:block smart:w-full", children: (0, jsx_runtime_1.jsxs)("div", { className: "smart:flex smart:w-full smart:items-center smart:gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "smart:flex-1", children: (0, jsx_runtime_1.jsx)(react_2.SmartInputFlag, { className: "smart:flex-1", options: options }) }), (value === true || value === false) && ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: () => refresh(null), "aria-label": "clear", className: "smart:shrink-0 smart:rounded smart:px-2 smart:py-2 smart:text-red-600 smart:hover:bg-red-50", children: "\u00D7" }))] }) }));
19
+ }
20
+ //# sourceMappingURL=filter-flag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter-flag.js","sourceRoot":"","sources":["../../../../../../../../../../packages/crud/shell/react/src/lib/components/filter/flag/filter-flag.tsx"],"names":[],"mappings":";;AAYA,kDA4BC;;AAxCD,iCAAgC;AAEhC,+CAAqD;AAErD,6DAA8E;AAG9E;;;;GAIG;AACH,SAAgB,mBAAmB,CAAC,KAA2B;IAC7D,MAAM,MAAM,GAAG,IAAA,+BAAa,EAAC,KAAK,CAAC,CAAC;IACpC,MAAM,OAAO,GAAG,IAAA,sCAAoB,EAAC,MAAM,CAAC,CAAC;IAC7C,MAAM,EAAE,iBAAiB,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IACrD,MAAM,OAAO,GAAG,IAAA,eAAO,EACrB,GAAG,EAAE,CAAC,iBAAiB,CAAC,OAAO,CAAC,EAChC,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAC7B,CAAC;IAEF,OAAO,CACL,gCAAK,SAAS,EAAC,0BAA0B,YACvC,iCAAK,SAAS,EAAC,wDAAwD,aACrE,gCAAK,SAAS,EAAC,cAAc,YAC3B,uBAAC,sBAAc,IAAC,SAAS,EAAC,cAAc,EAAC,OAAO,EAAE,OAAO,GAAI,GACzD,EACL,CAAC,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,KAAK,CAAC,IAAI,CACtC,mCACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,gBACjB,OAAO,EAClB,SAAS,EAAC,6FAA6F,uBAGhG,CACV,IACG,GACF,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,13 @@
1
+ export * from './base/use-crud-filter';
2
+ export * from './check/filter-check';
3
+ export * from './date/filter-date';
4
+ export * from './date/use-crud-filter-date';
5
+ export * from './date/use-crud-filter-ng-model';
6
+ export * from './date-time/filter-date-time';
7
+ export * from './date-with-edit/filter-date-with-edit';
8
+ export * from './filter';
9
+ export * from './filter.types';
10
+ export * from './flag/filter-flag';
11
+ export * from './int/filter-int';
12
+ export * from './radio/filter-radio';
13
+ export * from './text/filter-text';
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./base/use-crud-filter"), exports);
5
+ tslib_1.__exportStar(require("./check/filter-check"), exports);
6
+ tslib_1.__exportStar(require("./date/filter-date"), exports);
7
+ tslib_1.__exportStar(require("./date/use-crud-filter-date"), exports);
8
+ tslib_1.__exportStar(require("./date/use-crud-filter-ng-model"), exports);
9
+ tslib_1.__exportStar(require("./date-time/filter-date-time"), exports);
10
+ tslib_1.__exportStar(require("./date-with-edit/filter-date-with-edit"), exports);
11
+ tslib_1.__exportStar(require("./filter"), exports);
12
+ tslib_1.__exportStar(require("./filter.types"), exports);
13
+ tslib_1.__exportStar(require("./flag/filter-flag"), exports);
14
+ tslib_1.__exportStar(require("./int/filter-int"), exports);
15
+ tslib_1.__exportStar(require("./radio/filter-radio"), exports);
16
+ tslib_1.__exportStar(require("./text/filter-text"), exports);
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/crud/shell/react/src/lib/components/filter/index.ts"],"names":[],"mappings":";;;AAAA,iEAAuC;AACvC,+DAAqC;AACrC,6DAAmC;AACnC,sEAA4C;AAC5C,0EAAgD;AAChD,uEAA6C;AAC7C,iFAAuD;AACvD,mDAAyB;AACzB,yDAA+B;AAC/B,6DAAmC;AACnC,2DAAiC;AACjC,+DAAqC;AACrC,6DAAmC"}
@@ -0,0 +1,12 @@
1
+ import { SmartCrudFilterProps } from '../filter.types';
2
+ /**
3
+ * `<smart-crud-filter-int>` (Angular `FilterIntComponent`): the shared int
4
+ * field for the item's value; for an `=` item a settings button switches to
5
+ * the advanced "from" / "to" range (removing the value), shown as well while
6
+ * a range value is set. The clear button removes every entry of the item at
7
+ * once, the range ones only their own.
8
+ *
9
+ * As in Angular, the range controls are seeded once and not re-synced when
10
+ * the filter changes elsewhere (TODO GAP-19).
11
+ */
12
+ export declare function SmartCrudFilterInt(props: SmartCrudFilterProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SmartCrudFilterInt = SmartCrudFilterInt;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const react_2 = require("@smartsoft001/react");
7
+ const use_crud_filter_1 = require("../base/use-crud-filter");
8
+ const CLEAR_CLASSES = 'smart:shrink-0 smart:rounded smart:px-2 smart:py-2 smart:text-red-600 smart:hover:bg-red-50';
9
+ /**
10
+ * One end of the advanced range: a translated label and a native number
11
+ * input bound to the slot's control (Angular `[formControl]`: an emptied
12
+ * input is `null`).
13
+ */
14
+ function RangeInput({ label, control, }) {
15
+ const t = (0, react_2.useTranslate)();
16
+ const id = (0, react_1.useId)();
17
+ const { value, onChange, onBlur } = (0, react_2.useControlBinding)(control);
18
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "smart:flex-1", children: [(0, jsx_runtime_1.jsx)("label", { htmlFor: id, className: "smart:block smart:text-sm/6 smart:font-medium smart:text-gray-900 smart:dark:text-white", children: t(label) }), (0, jsx_runtime_1.jsx)("input", { id: id, type: "number", step: "1", value: value ?? '', onChange: (e) => onChange((0, react_2.toNumberValue)(e.target.value)), onBlur: onBlur, className: "smart:mt-2 smart:block smart:w-full smart:rounded-md smart:bg-white smart:px-3 smart:py-1.5 smart:text-base smart:text-gray-900 smart:outline-1 -outline-offset-1 smart:outline-gray-300 smart:focus:outline-2 smart:focus:outline-offset-2 smart:focus:outline-indigo-600 smart:dark:bg-white/5 smart:dark:text-white smart:dark:outline-white/10" })] }));
19
+ }
20
+ /**
21
+ * `<smart-crud-filter-int>` (Angular `FilterIntComponent`): the shared int
22
+ * field for the item's value; for an `=` item a settings button switches to
23
+ * the advanced "from" / "to" range (removing the value), shown as well while
24
+ * a range value is set. The clear button removes every entry of the item at
25
+ * once, the range ones only their own.
26
+ *
27
+ * As in Angular, the range controls are seeded once and not re-synced when
28
+ * the filter changes elsewhere (TODO GAP-19).
29
+ */
30
+ function SmartCrudFilterInt(props) {
31
+ const filter = (0, use_crud_filter_1.useCrudFilter)(props);
32
+ const valueControl = (0, use_crud_filter_1.useCrudFilterControl)(filter, null);
33
+ const minControl = (0, use_crud_filter_1.useCrudFilterControl)(filter, '>=');
34
+ const maxControl = (0, use_crud_filter_1.useCrudFilterControl)(filter, '<=');
35
+ const [advanced, setAdvanced] = (0, react_1.useState)(false);
36
+ const { buildInputOptions, hasValue, hasMinValue, hasMaxValue, setValue, refresh, clear, } = filter;
37
+ const valueOptions = (0, react_1.useMemo)(() => buildInputOptions(valueControl), [buildInputOptions, valueControl]);
38
+ const allowAdvanced = props.item?.type === '=';
39
+ const toggleAdvanced = () => {
40
+ const next = !advanced;
41
+ setAdvanced(next);
42
+ if (next)
43
+ setValue(null);
44
+ };
45
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "smart:block smart:w-full", children: [(0, jsx_runtime_1.jsxs)("div", { className: "smart:flex smart:w-full smart:items-end smart:gap-2", children: [!advanced && ((0, jsx_runtime_1.jsx)("div", { className: "smart:flex-1", children: (0, jsx_runtime_1.jsx)(react_2.SmartInputInt, { className: "smart:flex-1", options: valueOptions }) })), allowAdvanced && ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: toggleAdvanced, disabled: hasMinValue || hasMaxValue, "aria-label": "settings", className: "smart:shrink-0 smart:rounded smart:px-2 smart:py-2 smart:text-gray-600 smart:hover:bg-gray-100 smart:disabled:opacity-40", children: "\u2699" })), (hasValue || hasMinValue || hasMaxValue) && ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: clear, "aria-label": "clear", className: CLEAR_CLASSES, children: "\u00D7" }))] }), (advanced || hasMinValue || hasMaxValue) && allowAdvanced && ((0, jsx_runtime_1.jsxs)("div", { className: "smart:mt-2 smart:flex smart:w-full smart:items-end smart:gap-2", children: [(0, jsx_runtime_1.jsx)(RangeInput, { label: "from", control: minControl }), hasMinValue && ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: () => refresh(null, '>='), "aria-label": "clear-from", className: CLEAR_CLASSES, children: "\u00D7" })), (0, jsx_runtime_1.jsx)(RangeInput, { label: "to", control: maxControl }), hasMaxValue && ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: () => refresh(null, '<='), "aria-label": "clear-to", className: CLEAR_CLASSES, children: "\u00D7" }))] }))] }));
46
+ }
47
+ //# sourceMappingURL=filter-int.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter-int.js","sourceRoot":"","sources":["../../../../../../../../../../packages/crud/shell/react/src/lib/components/filter/int/filter-int.tsx"],"names":[],"mappings":";;AA+DA,gDA0FC;;AAzJD,iCAAiD;AAEjD,+CAM6B;AAE7B,6DAA8E;AAG9E,MAAM,aAAa,GACjB,6FAA6F,CAAC;AAEhG;;;;GAIG;AACH,SAAS,UAAU,CAAC,EAClB,KAAK,EACL,OAAO,GAIR;IACC,MAAM,CAAC,GAAG,IAAA,oBAAY,GAAE,CAAC;IACzB,MAAM,EAAE,GAAG,IAAA,aAAK,GAAE,CAAC;IACnB,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAA,yBAAiB,EAAC,OAAO,CAAC,CAAC;IAE/D,OAAO,CACL,iCAAK,SAAS,EAAC,cAAc,aAC3B,kCACE,OAAO,EAAE,EAAE,EACX,SAAS,EAAC,yFAAyF,YAElG,CAAC,CAAC,KAAK,CAAC,GACH,EACR,kCACE,EAAE,EAAE,EAAE,EACN,IAAI,EAAC,QAAQ,EACb,IAAI,EAAC,GAAG,EACR,KAAK,EAAE,KAAK,IAAI,EAAE,EAClB,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAA,qBAAa,EAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EACxD,MAAM,EAAE,MAAM,EACd,SAAS,EAAC,oVAAoV,GAC9V,IACE,CACP,CAAC;AACJ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OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,WAAW,IAAI,WAAW,gBACzB,UAAU,EACrB,SAAS,EAAC,0HAA0H,uBAG7H,CACV,EAEA,CAAC,QAAQ,IAAI,WAAW,IAAI,WAAW,CAAC,IAAI,CAC3C,mCACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,KAAK,gBACH,OAAO,EAClB,SAAS,EAAE,aAAa,uBAGjB,CACV,IACG,EAEL,CAAC,QAAQ,IAAI,WAAW,IAAI,WAAW,CAAC,IAAI,aAAa,IAAI,CAC5D,iCAAK,SAAS,EAAC,gEAAgE,aAC7E,uBAAC,UAAU,IAAC,KAAK,EAAC,MAAM,EAAC,OAAO,EAAE,UAAU,GAAI,EAC/C,WAAW,IAAI,CACd,mCACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,gBACvB,YAAY,EACvB,SAAS,EAAE,aAAa,uBAGjB,CACV,EAED,uBAAC,UAAU,IAAC,KAAK,EAAC,IAAI,EAAC,OAAO,EAAE,UAAU,GAAI,EAC7C,WAAW,IAAI,CACd,mCACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,gBACvB,UAAU,EACrB,SAAS,EAAE,aAAa,uBAGjB,CACV,IACG,CACP,IACG,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { SmartCrudFilterProps } from '../filter.types';
2
+ /**
3
+ * `<smart-crud-filter-radio>` (Angular `FilterRadioComponent`): the shared
4
+ * radio field with the filter's possibilities, bound to the item's value, and
5
+ * a clear button while the value is truthy or `false`.
6
+ */
7
+ export declare function SmartCrudFilterRadio(props: SmartCrudFilterProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SmartCrudFilterRadio = SmartCrudFilterRadio;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const react_2 = require("@smartsoft001/react");
7
+ const use_crud_filter_1 = require("../base/use-crud-filter");
8
+ /**
9
+ * `<smart-crud-filter-radio>` (Angular `FilterRadioComponent`): the shared
10
+ * radio field with the filter's possibilities, bound to the item's value, and
11
+ * a clear button while the value is truthy or `false`.
12
+ */
13
+ function SmartCrudFilterRadio(props) {
14
+ const filter = (0, use_crud_filter_1.useCrudFilter)(props);
15
+ const control = (0, use_crud_filter_1.useCrudFilterControl)(filter);
16
+ const { buildInputOptions, value, refresh } = filter;
17
+ const options = (0, react_1.useMemo)(() => buildInputOptions(control, true), [buildInputOptions, control]);
18
+ return ((0, jsx_runtime_1.jsx)("div", { className: "smart:mb-5 smart:block smart:w-full", children: (0, jsx_runtime_1.jsxs)("div", { className: "smart:flex smart:w-full smart:items-start smart:gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "smart:flex-1", children: (0, jsx_runtime_1.jsx)(react_2.SmartInputRadio, { className: "smart:flex-1", options: options }) }), (value || value === false) && ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: () => refresh(null), "aria-label": "clear", className: "smart:shrink-0 smart:rounded smart:px-2 smart:py-1 smart:text-red-600 smart:hover:bg-red-50", children: "\u00D7" }))] }) }));
19
+ }
20
+ //# sourceMappingURL=filter-radio.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter-radio.js","sourceRoot":"","sources":["../../../../../../../../../../packages/crud/shell/react/src/lib/components/filter/radio/filter-radio.tsx"],"names":[],"mappings":";;AAYA,oDA4BC;;AAxCD,iCAAgC;AAEhC,+CAAsD;AAEtD,6DAA8E;AAG9E;;;;GAIG;AACH,SAAgB,oBAAoB,CAAC,KAA2B;IAC9D,MAAM,MAAM,GAAG,IAAA,+BAAa,EAAC,KAAK,CAAC,CAAC;IACpC,MAAM,OAAO,GAAG,IAAA,sCAAoB,EAAC,MAAM,CAAC,CAAC;IAC7C,MAAM,EAAE,iBAAiB,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IACrD,MAAM,OAAO,GAAG,IAAA,eAAO,EACrB,GAAG,EAAE,CAAC,iBAAiB,CAAC,OAAO,EAAE,IAAI,CAAC,EACtC,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAC7B,CAAC;IAEF,OAAO,CACL,gCAAK,SAAS,EAAC,qCAAqC,YAClD,iCAAK,SAAS,EAAC,uDAAuD,aACpE,gCAAK,SAAS,EAAC,cAAc,YAC3B,uBAAC,uBAAe,IAAC,SAAS,EAAC,cAAc,EAAC,OAAO,EAAE,OAAO,GAAI,GAC1D,EACL,CAAC,KAAK,IAAI,KAAK,KAAK,KAAK,CAAC,IAAI,CAC7B,mCACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,gBACjB,OAAO,EAClB,SAAS,EAAC,6FAA6F,uBAGhG,CACV,IACG,GACF,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { SmartCrudFilterProps } from '../filter.types';
2
+ /**
3
+ * `<smart-crud-filter-text>` (Angular `FilterTextComponent`): the shared text
4
+ * field bound to the item's value, and a clear button while it has one.
5
+ * Typing reads the list 500 ms after the last change.
6
+ */
7
+ export declare function SmartCrudFilterText(props: SmartCrudFilterProps): import("react/jsx-runtime").JSX.Element;