@smartsoft001/crud-shell-react 2.193.0 → 2.194.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/package.json +6 -6
- package/src/lib/components/export/export.d.ts +2 -2
- package/src/lib/components/export/export.js +2 -2
- package/src/lib/components/export/export.types.d.ts +1 -1
- package/src/lib/components/export/use-crud-export.d.ts +5 -6
- package/src/lib/components/export/use-crud-export.js +7 -9
- package/src/lib/components/export/use-crud-export.js.map +1 -1
- package/src/lib/components/filter/base/use-crud-filter.d.ts +15 -18
- package/src/lib/components/filter/base/use-crud-filter.js +20 -24
- package/src/lib/components/filter/base/use-crud-filter.js.map +1 -1
- package/src/lib/components/filter/check/filter-check.d.ts +2 -3
- package/src/lib/components/filter/check/filter-check.js +5 -6
- package/src/lib/components/filter/check/filter-check.js.map +1 -1
- package/src/lib/components/filter/date/filter-date.d.ts +2 -3
- package/src/lib/components/filter/date/filter-date.js +4 -5
- package/src/lib/components/filter/date/filter-date.js.map +1 -1
- package/src/lib/components/filter/date/use-crud-filter-date.d.ts +3 -4
- package/src/lib/components/filter/date/use-crud-filter-date.js +3 -4
- package/src/lib/components/filter/date/use-crud-filter-date.js.map +1 -1
- package/src/lib/components/filter/date/use-crud-filter-value.d.ts +6 -0
- package/src/lib/components/filter/date/use-crud-filter-value.js +25 -0
- package/src/lib/components/filter/date/use-crud-filter-value.js.map +1 -0
- package/src/lib/components/filter/date-time/filter-date-time.d.ts +3 -4
- package/src/lib/components/filter/date-time/filter-date-time.js +8 -9
- package/src/lib/components/filter/date-time/filter-date-time.js.map +1 -1
- package/src/lib/components/filter/date-with-edit/filter-date-with-edit.d.ts +3 -4
- package/src/lib/components/filter/date-with-edit/filter-date-with-edit.js +12 -13
- package/src/lib/components/filter/date-with-edit/filter-date-with-edit.js.map +1 -1
- package/src/lib/components/filter/filter.d.ts +3 -4
- package/src/lib/components/filter/filter.js +3 -4
- package/src/lib/components/filter/filter.js.map +1 -1
- package/src/lib/components/filter/filter.types.d.ts +1 -4
- package/src/lib/components/filter/flag/filter-flag.d.ts +2 -3
- package/src/lib/components/filter/flag/filter-flag.js +2 -3
- package/src/lib/components/filter/flag/filter-flag.js.map +1 -1
- package/src/lib/components/filter/index.d.ts +1 -1
- package/src/lib/components/filter/index.js +1 -1
- package/src/lib/components/filter/index.js.map +1 -1
- package/src/lib/components/filter/int/filter-int.d.ts +6 -7
- package/src/lib/components/filter/int/filter-int.js +7 -9
- package/src/lib/components/filter/int/filter-int.js.map +1 -1
- package/src/lib/components/filter/radio/filter-radio.d.ts +3 -3
- package/src/lib/components/filter/radio/filter-radio.js +3 -3
- package/src/lib/components/filter/text/filter-text.d.ts +2 -2
- package/src/lib/components/filter/text/filter-text.js +2 -2
- package/src/lib/components/filters/filters.d.ts +4 -5
- package/src/lib/components/filters/filters.js +4 -5
- package/src/lib/components/filters/filters.js.map +1 -1
- package/src/lib/components/filters/filters.types.d.ts +1 -1
- package/src/lib/components/filters/use-crud-filters.d.ts +4 -5
- package/src/lib/components/filters/use-crud-filters.js +7 -8
- package/src/lib/components/filters/use-crud-filters.js.map +1 -1
- package/src/lib/components/filters-config/filters-config.d.ts +3 -3
- package/src/lib/components/filters-config/filters-config.js +4 -5
- package/src/lib/components/filters-config/filters-config.js.map +1 -1
- package/src/lib/components/group/group.d.ts +4 -5
- package/src/lib/components/group/group.js +4 -5
- package/src/lib/components/group/group.js.map +1 -1
- package/src/lib/components/group/group.types.d.ts +1 -1
- package/src/lib/components/group/use-crud-group.d.ts +5 -6
- package/src/lib/components/group/use-crud-group.js +8 -10
- package/src/lib/components/group/use-crud-group.js.map +1 -1
- package/src/lib/components/multiselect/multiselect.d.ts +2 -3
- package/src/lib/components/multiselect/multiselect.js +3 -4
- package/src/lib/components/multiselect/multiselect.js.map +1 -1
- package/src/lib/components/multiselect/use-crud-multiselect.d.ts +3 -4
- package/src/lib/components/multiselect/use-crud-multiselect.js +3 -4
- package/src/lib/components/multiselect/use-crud-multiselect.js.map +1 -1
- package/src/lib/crud.config.d.ts +1 -2
- package/src/lib/crud.provider.d.ts +2 -2
- package/src/lib/crud.provider.js +4 -5
- package/src/lib/crud.provider.js.map +1 -1
- package/src/lib/factories/form-options.d.ts +2 -2
- package/src/lib/factories/form-options.js +2 -2
- package/src/lib/hooks.d.ts +2 -2
- package/src/lib/hooks.js +2 -2
- package/src/lib/pages/crud-pages.d.ts +7 -8
- package/src/lib/pages/crud-pages.js +9 -10
- package/src/lib/pages/crud-pages.js.map +1 -1
- package/src/lib/pages/item/item-page.d.ts +9 -12
- package/src/lib/pages/item/item-page.js +9 -12
- package/src/lib/pages/item/item-page.js.map +1 -1
- package/src/lib/pages/item/item-page.types.d.ts +8 -12
- package/src/lib/pages/item/standard/item-page-standard.d.ts +2 -4
- package/src/lib/pages/item/standard/item-page-standard.js +2 -4
- package/src/lib/pages/item/standard/item-page-standard.js.map +1 -1
- package/src/lib/pages/item/use-crud-item-page-base.d.ts +5 -6
- package/src/lib/pages/item/use-crud-item-page-base.js +5 -6
- package/src/lib/pages/item/use-crud-item-page-base.js.map +1 -1
- package/src/lib/pages/item/use-crud-item-page.d.ts +4 -4
- package/src/lib/pages/item/use-crud-item-page.js +6 -7
- package/src/lib/pages/item/use-crud-item-page.js.map +1 -1
- package/src/lib/pages/list/list-page.d.ts +8 -11
- package/src/lib/pages/list/list-page.js +8 -11
- package/src/lib/pages/list/list-page.js.map +1 -1
- package/src/lib/pages/list/list-page.types.d.ts +6 -8
- package/src/lib/pages/list/standard/list-page-standard.d.ts +4 -6
- package/src/lib/pages/list/standard/list-page-standard.js +4 -6
- package/src/lib/pages/list/standard/list-page-standard.js.map +1 -1
- package/src/lib/pages/list/use-crud-list-page.d.ts +2 -2
- package/src/lib/pages/list/use-crud-list-page.js +9 -11
- package/src/lib/pages/list/use-crud-list-page.js.map +1 -1
- package/src/lib/pages/use-crud-bound-component.d.ts +2 -3
- package/src/lib/pages/use-crud-bound-component.js +2 -3
- package/src/lib/pages/use-crud-bound-component.js.map +1 -1
- package/src/lib/pages/use-crud-page-config.d.ts +1 -2
- package/src/lib/pages/use-crud-page-config.js +1 -2
- package/src/lib/pages/use-crud-page-config.js.map +1 -1
- package/src/lib/services/crud/crud.service.d.ts +3 -4
- package/src/lib/services/crud/crud.service.js +3 -4
- package/src/lib/services/crud/crud.service.js.map +1 -1
- package/src/lib/services/page/page.service.d.ts +2 -2
- package/src/lib/services/page/page.service.js +2 -2
- package/src/lib/state/crud.effects.d.ts +5 -6
- package/src/lib/state/crud.effects.js +7 -8
- package/src/lib/state/crud.effects.js.map +1 -1
- package/src/lib/state/crud.facade.d.ts +3 -4
- package/src/lib/state/crud.facade.js +3 -4
- package/src/lib/state/crud.facade.js.map +1 -1
- package/src/lib/state/crud.reducer.d.ts +1 -1
- package/src/lib/state/crud.selectors.js +2 -3
- package/src/lib/state/crud.selectors.js.map +1 -1
- package/src/lib/state/crud.store.d.ts +1 -1
- package/src/lib/state/crud.store.js +1 -1
- package/src/lib/components/filter/date/use-crud-filter-ng-model.d.ts +0 -6
- package/src/lib/components/filter/date/use-crud-filter-ng-model.js +0 -25
- package/src/lib/components/filter/date/use-crud-filter-ng-model.js.map +0 -1
package/README.md
CHANGED
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
The React CRUD screens of the smartsoft001 framework: the list and item pages generated from a
|
|
4
4
|
configuration object and the model's metadata, the filters, and the CRUD service with its store and
|
|
5
|
-
facade, speaking the
|
|
5
|
+
facade, speaking the REST contract of
|
|
6
6
|
[`@smartsoft001/crud-shell-nestjs`](https://www.npmjs.com/package/@smartsoft001/crud-shell-nestjs).
|
|
7
|
-
It mirrors [`@smartsoft001/crud-shell-angular`](https://www.npmjs.com/package/@smartsoft001/crud-shell-angular).
|
|
8
7
|
|
|
9
8
|
```bash
|
|
10
9
|
npm install @smartsoft001/crud-shell-react @smartsoft001/react react
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smartsoft001/crud-shell-react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.194.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
|
-
"description": "React CRUD screens driven by model metadata: the list and item pages, filters, the CRUD service and its store
|
|
5
|
+
"description": "React CRUD screens driven by model metadata: the list and item pages, filters, the CRUD service and its store.",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"moment": "^2.31.0"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
|
-
"@smartsoft001/domain-core": "2.
|
|
17
|
-
"@smartsoft001/models": "2.
|
|
18
|
-
"@smartsoft001/react": "2.
|
|
19
|
-
"@smartsoft001/utils": "2.
|
|
16
|
+
"@smartsoft001/domain-core": "2.194.0",
|
|
17
|
+
"@smartsoft001/models": "2.194.0",
|
|
18
|
+
"@smartsoft001/react": "2.194.0",
|
|
19
|
+
"@smartsoft001/utils": "2.194.0",
|
|
20
20
|
"react": "^19.0.0"
|
|
21
21
|
},
|
|
22
22
|
"exports": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IEntity } from '@smartsoft001/domain-core';
|
|
2
2
|
import { SmartCrudExportProps } from './export.types';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* The CSV / XLSX buttons exporting the list of the CRUD feature with its
|
|
5
|
+
* current filter.
|
|
6
6
|
*/
|
|
7
7
|
export declare function SmartCrudExport<T extends IEntity<string>>(props: SmartCrudExportProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,8 +5,8 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("@smartsoft001/react");
|
|
6
6
|
const use_crud_export_1 = require("./use-crud-export");
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* The CSV / XLSX buttons exporting the list of the CRUD feature with its
|
|
9
|
+
* current filter.
|
|
10
10
|
*/
|
|
11
11
|
function SmartCrudExport(props) {
|
|
12
12
|
const { elementRef, buttonExportCsvOptions, buttonExportXlsxOptions } = (0, use_crud_export_1.useCrudExport)(props);
|
|
@@ -2,12 +2,11 @@ import { IEntity } from '@smartsoft001/domain-core';
|
|
|
2
2
|
import { IButtonOptions } from '@smartsoft001/react';
|
|
3
3
|
import { SmartCrudExportProps } from './export.types';
|
|
4
4
|
/**
|
|
5
|
-
* The behaviour of the export buttons
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* Angular `styleService.init(elementRef)`).
|
|
5
|
+
* The behaviour of the export buttons: a click exports the list with the
|
|
6
|
+
* current filter, without paging, in its format, and closes the overlay the
|
|
7
|
+
* component is shown in once the export finished. The buttons are loading
|
|
8
|
+
* while the feature is. Attach `elementRef` to the root element: it gets the
|
|
9
|
+
* application style.
|
|
11
10
|
*/
|
|
12
11
|
export declare function useCrudExport<T extends IEntity<string>>({ dismiss, }?: SmartCrudExportProps): {
|
|
13
12
|
elementRef: import("react").RefObject<HTMLDivElement | null>;
|
|
@@ -6,8 +6,7 @@ const react_2 = require("@smartsoft001/react");
|
|
|
6
6
|
const crud_context_1 = require("../../crud.context");
|
|
7
7
|
const hooks_1 = require("../../hooks");
|
|
8
8
|
/**
|
|
9
|
-
* Runs `callback` once the feature is loaded, now or after a later change
|
|
10
|
-
* (the Angular `toObservable(loaded).pipe(filter(l => !!l), take(1))`).
|
|
9
|
+
* Runs `callback` once the feature is loaded, now or after a later change.
|
|
11
10
|
* Returns the unsubscribe function.
|
|
12
11
|
*/
|
|
13
12
|
function onceLoaded(store, callback) {
|
|
@@ -24,12 +23,11 @@ function onceLoaded(store, callback) {
|
|
|
24
23
|
return unsubscribe;
|
|
25
24
|
}
|
|
26
25
|
/**
|
|
27
|
-
* The behaviour of the export buttons
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* Angular `styleService.init(elementRef)`).
|
|
26
|
+
* The behaviour of the export buttons: a click exports the list with the
|
|
27
|
+
* current filter, without paging, in its format, and closes the overlay the
|
|
28
|
+
* component is shown in once the export finished. The buttons are loading
|
|
29
|
+
* while the feature is. Attach `elementRef` to the root element: it gets the
|
|
30
|
+
* application style.
|
|
33
31
|
*/
|
|
34
32
|
function useCrudExport({ dismiss, } = {}) {
|
|
35
33
|
const { facade, store } = (0, crud_context_1.useCrud)();
|
|
@@ -51,7 +49,7 @@ function useCrudExport({ dismiss, } = {}) {
|
|
|
51
49
|
const current = subscriptions.current;
|
|
52
50
|
return () => current.forEach((unsubscribe) => unsubscribe());
|
|
53
51
|
}, []);
|
|
54
|
-
//
|
|
52
|
+
// Closes the overlay the buttons are shown in.
|
|
55
53
|
const close = () => {
|
|
56
54
|
if (dismissRef.current)
|
|
57
55
|
dismissRef.current();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-crud-export.js","sourceRoot":"","sources":["../../../../../../../../../packages/crud/shell/react/src/lib/components/export/use-crud-export.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"use-crud-export.js","sourceRoot":"","sources":["../../../../../../../../../packages/crud/shell/react/src/lib/components/export/use-crud-export.ts"],"names":[],"mappings":";;AA0CA,sCAkDC;AA5FD,iCAA0C;AAG1C,+CAK6B;AAG7B,qDAA6C;AAC7C,uCAA2C;AAG3C;;;GAGG;AACH,SAAS,UAAU,CAAC,KAAgB,EAAE,QAAoB;IACxD,IAAI,KAAK,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC;QACvB,QAAQ,EAAE,CAAC;QACX,OAAO,GAAG,EAAE,CAAC,SAAS,CAAC;IACzB,CAAC;IAED,MAAM,WAAW,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACvC,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,MAAM;YAAE,OAAO;QAEhC,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EAAE;QACjB,IAAI,UAAU,CAAC,OAAO;YAAE,UAAU,CAAC,OAAO,EAAE,CAAC;;YACxC,KAAK,YAAY,CAAC,OAAO,EAAE,CAAC;IACnC,CAAC,CAAC;IAEF,MAAM,uBAAuB,GAAG,CAAC,MAAc,EAAkB,EAAE,CAAC,CAAC;QACnE,KAAK,EAAE,GAAG,EAAE;YACV,MAAM,CAAC,MAAM,CACX,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,EACzD,MAAM,CACP,CAAC;YAEF,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;QACvD,CAAC;QACD,OAAO;KACR,CAAC,CAAC;IAEH,OAAO;QACL,UAAU;QACV,sBAAsB,EAAE,uBAAuB,CAAC,KAAK,CAAC;QACtD,uBAAuB,EAAE,uBAAuB,CAAC,MAAM,CAAC;KACzD,CAAC;AACJ,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { InputOptions, SmartAbstractControl, SmartFormControl } from '@smartsoft001/react';
|
|
2
2
|
import { ICrudFilter } from '../../../models';
|
|
3
3
|
import { CrudFilterPossibility, SmartCrudFilterProps } from '../filter.types';
|
|
4
|
-
/**
|
|
4
|
+
/** How long `refresh` waits, in ms, before it reads the list. */
|
|
5
5
|
export declare const CRUD_FILTER_REFRESH_DEBOUNCE = 500;
|
|
6
|
-
/** What `useCrudFilter` returns
|
|
6
|
+
/** What `useCrudFilter` returns. */
|
|
7
7
|
export interface UseCrudFilterResult {
|
|
8
8
|
/** The item's value (a list for a check filter); `null` without a query. */
|
|
9
9
|
value: any;
|
|
@@ -11,11 +11,11 @@ export interface UseCrudFilterResult {
|
|
|
11
11
|
minValue: any;
|
|
12
12
|
/** The item's `<=` value (range "to"). */
|
|
13
13
|
maxValue: any;
|
|
14
|
-
/** Debounced `refresh(val)
|
|
14
|
+
/** Debounced `refresh(val)`. */
|
|
15
15
|
setValue: (val: any) => void;
|
|
16
|
-
/** Debounced `refresh(val, '>=')
|
|
16
|
+
/** Debounced `refresh(val, '>=')`. */
|
|
17
17
|
setMinValue: (val: any) => void;
|
|
18
|
-
/** Debounced `refresh(val, '<=')
|
|
18
|
+
/** Debounced `refresh(val, '<=')`. */
|
|
19
19
|
setMaxValue: (val: any) => void;
|
|
20
20
|
/** The item's entry has a non-empty value. */
|
|
21
21
|
hasValue: boolean;
|
|
@@ -46,23 +46,20 @@ export interface UseCrudFilterResult {
|
|
|
46
46
|
buildInputOptions: (control: SmartAbstractControl, withPossibilities?: boolean) => InputOptions<any>;
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
|
-
* The behaviour every filter field shares
|
|
50
|
-
* `
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* the values are read from that copy.
|
|
49
|
+
* The behaviour every filter field shares: the item's values in the current
|
|
50
|
+
* filter, and `refresh` / `clear`, which read the list through the facade
|
|
51
|
+
* with a changed copy of the filter. Until the store's new filter comes back
|
|
52
|
+
* through the `filter` prop, the values are read from that copy.
|
|
54
53
|
*
|
|
55
|
-
* `refresh` is debounced by 500 ms
|
|
56
|
-
*
|
|
57
|
-
* after the field unmounts.
|
|
54
|
+
* `refresh` is debounced by 500 ms: only the last call within the wait is
|
|
55
|
+
* applied, and a pending call still runs after the field unmounts.
|
|
58
56
|
*/
|
|
59
57
|
export declare function useCrudFilter({ item, filter, }: SmartCrudFilterProps): UseCrudFilterResult;
|
|
60
58
|
/**
|
|
61
|
-
* A form control bridged to one query slot of a filter
|
|
62
|
-
*
|
|
63
|
-
* the slot's current value (`null` = `value`, `'>='` = `minValue`, `'<='` =
|
|
59
|
+
* A form control bridged to one query slot of a filter: seeded once with the
|
|
60
|
+
* slot's current value (`null` = `value`, `'>='` = `minValue`, `'<='` =
|
|
64
61
|
* `maxValue`), and every change runs the debounced `refresh` for the slot.
|
|
65
|
-
*
|
|
66
|
-
*
|
|
62
|
+
* The control is not re-synced when the filter changes elsewhere
|
|
63
|
+
* (TODO GAP-19).
|
|
67
64
|
*/
|
|
68
65
|
export declare function useCrudFilterControl({ value, minValue, maxValue, refresh, }: Pick<UseCrudFilterResult, 'value' | 'minValue' | 'maxValue' | 'refresh'>, type?: string | null): SmartFormControl;
|
|
@@ -7,11 +7,11 @@ const react_1 = require("react");
|
|
|
7
7
|
const models_1 = require("@smartsoft001/models");
|
|
8
8
|
const react_2 = require("@smartsoft001/react");
|
|
9
9
|
const crud_context_1 = require("../../../crud.context");
|
|
10
|
-
/**
|
|
10
|
+
/** How long `refresh` waits, in ms, before it reads the list. */
|
|
11
11
|
exports.CRUD_FILTER_REFRESH_DEBOUNCE = 500;
|
|
12
12
|
/**
|
|
13
|
-
* The item's own possibilities:
|
|
14
|
-
* `IModelFilter`) or a plain list.
|
|
13
|
+
* The item's own possibilities: a function returning the list (as
|
|
14
|
+
* `IModelFilter` types it) or a plain list.
|
|
15
15
|
*/
|
|
16
16
|
function readItemPossibilities(source) {
|
|
17
17
|
if (typeof source === 'function')
|
|
@@ -46,9 +46,9 @@ function cloneFilter(source) {
|
|
|
46
46
|
return clone;
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
|
-
* The value of the item's query entry of `type` (
|
|
50
|
-
* `
|
|
51
|
-
*
|
|
49
|
+
* The value of the item's query entry of `type` (`value`, `minValue` and
|
|
50
|
+
* `maxValue`): `null` without a query, the list of matching values for a
|
|
51
|
+
* check filter, otherwise the first match's value.
|
|
52
52
|
*/
|
|
53
53
|
function readQueryValue(filter, item, type) {
|
|
54
54
|
if (!filter || !item || !filter.query)
|
|
@@ -81,9 +81,9 @@ function refreshArrayFilter(filter, item, vals, type) {
|
|
|
81
81
|
return filter;
|
|
82
82
|
}
|
|
83
83
|
/**
|
|
84
|
-
* The filter after `refresh(val, type)
|
|
85
|
-
*
|
|
86
|
-
*
|
|
84
|
+
* The filter after `refresh(val, type)`: back on the first page, with the
|
|
85
|
+
* item's entry of the slot set to `val`, or removed for an empty value.
|
|
86
|
+
* `null` when there is nothing to read.
|
|
87
87
|
*/
|
|
88
88
|
function refreshFilter(source, item, val, type) {
|
|
89
89
|
const filter = cloneFilter(source);
|
|
@@ -121,8 +121,7 @@ function clearFilter(source, item) {
|
|
|
121
121
|
}
|
|
122
122
|
/**
|
|
123
123
|
* The options of the item: the ones the model possibilities provider returns
|
|
124
|
-
* for the model type and the item key
|
|
125
|
-
* deprecated `CRUD_MODEL_POSSIBILITIES_PROVIDER`), otherwise the item's own.
|
|
124
|
+
* for the model type and the item key, otherwise the item's own.
|
|
126
125
|
*/
|
|
127
126
|
function useFilterPossibilities(item, modelType, model) {
|
|
128
127
|
const provider = (0, react_2.useSmart)().modelPossibilitiesProvider;
|
|
@@ -145,15 +144,13 @@ function useFilterPossibilities(item, modelType, model) {
|
|
|
145
144
|
return readItemPossibilities(item?.possibilities);
|
|
146
145
|
}
|
|
147
146
|
/**
|
|
148
|
-
* The behaviour every filter field shares
|
|
149
|
-
* `
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
* the values are read from that copy.
|
|
147
|
+
* The behaviour every filter field shares: the item's values in the current
|
|
148
|
+
* filter, and `refresh` / `clear`, which read the list through the facade
|
|
149
|
+
* with a changed copy of the filter. Until the store's new filter comes back
|
|
150
|
+
* through the `filter` prop, the values are read from that copy.
|
|
153
151
|
*
|
|
154
|
-
* `refresh` is debounced by 500 ms
|
|
155
|
-
*
|
|
156
|
-
* after the field unmounts.
|
|
152
|
+
* `refresh` is debounced by 500 ms: only the last call within the wait is
|
|
153
|
+
* applied, and a pending call still runs after the field unmounts.
|
|
157
154
|
*/
|
|
158
155
|
function useCrudFilter({ item, filter, }) {
|
|
159
156
|
const facade = (0, crud_context_1.useCrudFacade)();
|
|
@@ -230,12 +227,11 @@ function useCrudFilter({ item, filter, }) {
|
|
|
230
227
|
};
|
|
231
228
|
}
|
|
232
229
|
/**
|
|
233
|
-
* A form control bridged to one query slot of a filter
|
|
234
|
-
*
|
|
235
|
-
* the slot's current value (`null` = `value`, `'>='` = `minValue`, `'<='` =
|
|
230
|
+
* A form control bridged to one query slot of a filter: seeded once with the
|
|
231
|
+
* slot's current value (`null` = `value`, `'>='` = `minValue`, `'<='` =
|
|
236
232
|
* `maxValue`), and every change runs the debounced `refresh` for the slot.
|
|
237
|
-
*
|
|
238
|
-
*
|
|
233
|
+
* The control is not re-synced when the filter changes elsewhere
|
|
234
|
+
* (TODO GAP-19).
|
|
239
235
|
*/
|
|
240
236
|
function useCrudFilterControl({ value, minValue, maxValue, refresh, }, type = null) {
|
|
241
237
|
const [control] = (0, react_1.useState)(() => new react_2.SmartFormControl(type === '>=' ? minValue : type === '<=' ? maxValue : value));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-crud-filter.js","sourceRoot":"","sources":["../../../../../../../../../../packages/crud/shell/react/src/lib/components/filter/base/use-crud-filter.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"use-crud-filter.js","sourceRoot":"","sources":["../../../../../../../../../../packages/crud/shell/react/src/lib/components/filter/base/use-crud-filter.ts"],"names":[],"mappings":";;;AA4RA,sCA8GC;AASD,oDAyBC;AA5aD,iCAOe;AAEf,iDAA+D;AAC/D,+CAK6B;AAE7B,wDAAqE;AAIrE,iEAAiE;AACpD,QAAA,4BAA4B,GAAG,GAAG,CAAC;AAwDhD;;;GAGG;AACH,SAAS,qBAAqB,CAC5B,MAAe;IAEf,IAAI,OAAO,MAAM,KAAK,UAAU;QAAE,OAAO,MAAM,EAAE,CAAC;IAClD,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;QAAE,OAAO,MAAM,CAAC;IAEzC,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,mEAAmE;AACnE,SAAS,WAAW,CAAC,IAA8B;IACjD,OAAO,IAAI,EAAE,SAAS,KAAK,kBAAS,CAAC,KAAK,CAAC;AAC7C,CAAC;AAED;;;GAGG;AACH,SAAS,kBAAkB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**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* clear button while any is checked. Each value is its own query entry.
|
|
3
|
+
* The check filter: a checkbox per possibility, checked when its id is among
|
|
4
|
+
* the item's values, and a clear button while any is checked. Each value is its own query entry.
|
|
6
5
|
*/
|
|
7
6
|
export declare function SmartCrudFilterCheck(props: SmartCrudFilterProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -6,9 +6,9 @@ const react_1 = require("react");
|
|
|
6
6
|
const react_2 = require("@smartsoft001/react");
|
|
7
7
|
const use_crud_filter_1 = require("../base/use-crud-filter");
|
|
8
8
|
/**
|
|
9
|
-
* A checkbox
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* A checkbox that follows the user's click right away and gets `checked`
|
|
10
|
+
* written to it whenever it changes (the read is debounced, so the value
|
|
11
|
+
* follows 500 ms later).
|
|
12
12
|
*/
|
|
13
13
|
function FilterCheckbox({ checked, onCheckedChange, }) {
|
|
14
14
|
const ref = (0, react_1.useRef)(null);
|
|
@@ -19,9 +19,8 @@ function FilterCheckbox({ checked, onCheckedChange, }) {
|
|
|
19
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
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* clear button while any is checked. Each value is its own query entry.
|
|
22
|
+
* The check filter: a checkbox per possibility, checked when its id is among
|
|
23
|
+
* the item's values, and a clear button while any is checked. Each value is its own query entry.
|
|
25
24
|
*/
|
|
26
25
|
function SmartCrudFilterCheck(props) {
|
|
27
26
|
const t = (0, react_2.useTranslate)();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter-check.js","sourceRoot":"","sources":["../../../../../../../../../../packages/crud/shell/react/src/lib/components/filter/check/filter-check.tsx"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"filter-check.js","sourceRoot":"","sources":["../../../../../../../../../../packages/crud/shell/react/src/lib/components/filter/check/filter-check.tsx"],"names":[],"mappings":";;AAwCA,oDAyDC;;AAjGD,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;;;GAGG;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,GAAG,EAAE,EAAE,CAAC,CAAC;QAC/C,KAAK,EAAE,GA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,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"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { SmartCrudFilterProps } from '../filter.types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* clear button while it has one.
|
|
3
|
+
* The date filter: the item label, the shared date editor bound to the item's
|
|
4
|
+
* value (`YYYY-MM-DD`) and a clear button while it has one.
|
|
6
5
|
*/
|
|
7
6
|
export declare function SmartCrudFilterDate(props: SmartCrudFilterProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,16 +4,15 @@ exports.SmartCrudFilterDate = SmartCrudFilterDate;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("@smartsoft001/react");
|
|
6
6
|
const use_crud_filter_date_1 = require("./use-crud-filter-date");
|
|
7
|
-
const
|
|
7
|
+
const use_crud_filter_value_1 = require("./use-crud-filter-value");
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* clear button while it has one.
|
|
9
|
+
* The date filter: the item label, the shared date editor bound to the item's
|
|
10
|
+
* value (`YYYY-MM-DD`) and a clear button while it has one.
|
|
12
11
|
*/
|
|
13
12
|
function SmartCrudFilterDate(props) {
|
|
14
13
|
const t = (0, react_1.useTranslate)();
|
|
15
14
|
const { customValue, setCustomValue, hasValue, refresh } = (0, use_crud_filter_date_1.useCrudFilterDate)(props);
|
|
16
|
-
const [date, setDate] = (0,
|
|
15
|
+
const [date, setDate] = (0, use_crud_filter_value_1.useCrudFilterValue)(customValue || '', setCustomValue);
|
|
17
16
|
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
17
|
}
|
|
19
18
|
//# sourceMappingURL=filter-date.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter-date.js","sourceRoot":"","sources":["../../../../../../../../../../packages/crud/shell/react/src/lib/components/filter/date/filter-date.tsx"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"filter-date.js","sourceRoot":"","sources":["../../../../../../../../../../packages/crud/shell/react/src/lib/components/filter/date/filter-date.tsx"],"names":[],"mappings":";;AAUA,kDAgCC;;AA1CD,+CAAkE;AAElE,iEAA2D;AAC3D,mEAA6D;AAG7D;;;GAGG;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,0CAAkB,EAAC,WAAW,IAAI,EAAE,EAAE,cAAc,CAAC,CAAC;IAE9E,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"}
|
|
@@ -15,9 +15,8 @@ export interface UseCrudFilterDateResult extends UseCrudFilterResult {
|
|
|
15
15
|
setCustomMaxValue: (val: any) => void;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
|
-
* What the date filters share
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* setters store a valid date as `YYYY-MM-DD`.
|
|
18
|
+
* What the date, date-time and date-with-edit filters share: `useCrudFilter`
|
|
19
|
+
* with the `customValue` / `customMinValue` / `customMaxValue` accessors,
|
|
20
|
+
* whose setters store a valid date as `YYYY-MM-DD`.
|
|
22
21
|
*/
|
|
23
22
|
export declare function useCrudFilterDate(props: SmartCrudFilterProps): UseCrudFilterDateResult;
|
|
@@ -16,10 +16,9 @@ function toFilterDate(val) {
|
|
|
16
16
|
: val;
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
|
-
* What the date filters share
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* setters store a valid date as `YYYY-MM-DD`.
|
|
19
|
+
* What the date, date-time and date-with-edit filters share: `useCrudFilter`
|
|
20
|
+
* with the `customValue` / `customMinValue` / `customMaxValue` accessors,
|
|
21
|
+
* whose setters store a valid date as `YYYY-MM-DD`.
|
|
23
22
|
*/
|
|
24
23
|
function useCrudFilterDate(props) {
|
|
25
24
|
const filter = (0, use_crud_filter_1.useCrudFilter)(props);
|
|
@@ -1 +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":";;
|
|
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":";;AAqCA,8CA6BC;;AAlED,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;;;;GAIG;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 value a date filter's editor shows: what the user entered (the filter
|
|
3
|
+
* is read 500 ms later) until `value` changes, and then `value`. Every entry
|
|
4
|
+
* is passed on to `onValueChange`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useCrudFilterValue<T>(value: T, onValueChange: (value: T) => void): [T, (value: T) => void];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useCrudFilterValue = useCrudFilterValue;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
/**
|
|
6
|
+
* The value a date filter's editor shows: what the user entered (the filter
|
|
7
|
+
* is read 500 ms later) until `value` changes, and then `value`. Every entry
|
|
8
|
+
* is passed on to `onValueChange`.
|
|
9
|
+
*/
|
|
10
|
+
function useCrudFilterValue(value, onValueChange) {
|
|
11
|
+
const [view, setView] = (0, react_1.useState)(value);
|
|
12
|
+
const [prevValue, setPrevValue] = (0, react_1.useState)(value);
|
|
13
|
+
let current = view;
|
|
14
|
+
if (!Object.is(prevValue, value)) {
|
|
15
|
+
setPrevValue(value);
|
|
16
|
+
setView(value);
|
|
17
|
+
current = value;
|
|
18
|
+
}
|
|
19
|
+
const onViewChange = (0, react_1.useCallback)((next) => {
|
|
20
|
+
setView(next);
|
|
21
|
+
onValueChange(next);
|
|
22
|
+
}, [onValueChange]);
|
|
23
|
+
return [current, onViewChange];
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=use-crud-filter-value.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-crud-filter-value.js","sourceRoot":"","sources":["../../../../../../../../../../packages/crud/shell/react/src/lib/components/filter/date/use-crud-filter-value.ts"],"names":[],"mappings":";;AAOA,gDAuBC;AA9BD,iCAA8C;AAE9C;;;;GAIG;AACH,SAAgB,kBAAkB,CAChC,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,IAAO,EAAE,EAAE;QACV,OAAO,CAAC,IAAI,CAAC,CAAC;QACd,aAAa,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC,EACD,CAAC,aAAa,CAAC,CAChB,CAAC;IAEF,OAAO,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { SmartCrudFilterProps } from '../filter.types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* date-time is stored as its `YYYY-MM-DD` day.
|
|
3
|
+
* The date-time filter: the item label and a "from" / "to" pair of native
|
|
4
|
+
* `datetime-local` inputs for the `>=` / `<=` values, each with its clear
|
|
5
|
+
* button. A valid date-time is stored as its `YYYY-MM-DD` day.
|
|
7
6
|
*/
|
|
8
7
|
export declare function SmartCrudFilterDateTime(props: SmartCrudFilterProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,23 +5,22 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const react_2 = require("@smartsoft001/react");
|
|
7
7
|
const use_crud_filter_date_1 = require("../date/use-crud-filter-date");
|
|
8
|
-
const
|
|
8
|
+
const use_crud_filter_value_1 = require("../date/use-crud-filter-value");
|
|
9
9
|
/** One end of the range: a label, a `datetime-local` input and its clear. */
|
|
10
|
-
function DateTimeRangeRow({ label,
|
|
10
|
+
function DateTimeRangeRow({ label, value, onValueChange, clearLabel, showClear, onClear, }) {
|
|
11
11
|
const t = (0, react_2.useTranslate)();
|
|
12
12
|
const id = (0, react_1.useId)();
|
|
13
|
-
const [
|
|
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:
|
|
13
|
+
const [shown, setShown] = (0, use_crud_filter_value_1.useCrudFilterValue)(value, onValueChange);
|
|
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: shown, onChange: (e) => setShown(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
15
|
}
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* date-time is stored as its `YYYY-MM-DD` day.
|
|
17
|
+
* The date-time filter: the item label and a "from" / "to" pair of native
|
|
18
|
+
* `datetime-local` inputs for the `>=` / `<=` values, each with its clear
|
|
19
|
+
* button. A valid date-time is stored as its `YYYY-MM-DD` day.
|
|
21
20
|
*/
|
|
22
21
|
function SmartCrudFilterDateTime(props) {
|
|
23
22
|
const t = (0, react_2.useTranslate)();
|
|
24
23
|
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",
|
|
24
|
+
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", value: customMinValue || '', onValueChange: setCustomMinValue, clearLabel: "clear-from", showClear: hasMinValue, onClear: () => refresh(null, '>=') }), (0, jsx_runtime_1.jsx)(DateTimeRangeRow, { label: "to", value: customMaxValue || '', onValueChange: setCustomMaxValue, clearLabel: "clear-to", showClear: hasMaxValue, onClear: () => refresh(null, '<=') })] })] }));
|
|
26
25
|
}
|
|
27
26
|
//# sourceMappingURL=filter-date-time.js.map
|
|
@@ -1 +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":";;
|
|
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":";;AA2DA,0DAqCC;;AAhGD,iCAA8B;AAE9B,+CAAmD;AAEnD,uEAAiE;AACjE,yEAAmE;AAGnE,6EAA6E;AAC7E,SAAS,gBAAgB,CAAC,EACxB,KAAK,EACL,KAAK,EACL,aAAa,EACb,UAAU,EACV,SAAS,EACT,OAAO,GAQR;IACC,MAAM,CAAC,GAAG,IAAA,oBAAY,GAAE,CAAC;IACzB,MAAM,EAAE,GAAG,IAAA,aAAK,GAAE,CAAC;IACnB,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,0CAAkB,EAAC,KAAK,EAAE,aAAa,CAAC,CAAC;IAEnE,OAAO,CACL,iCAAK,SAAS,EAAC,qDAAqD,aAClE,kCAAO,OAAO,EAAE,EAAE,EAAE,SAAS,EAAC,eAAe,YAC1C,CAAC,CAAC,KAAK,CAAC,GACH,EACR,kCACE,EAAE,EAAE,EAAE,EACN,IAAI,EAAC,gBAAgB,EACrB,SAAS,EAAC,qFAAqF,EAC/F,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,GACzC,EACD,SAAS,IAAI,CACZ,mCACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,OAAO,gBACJ,UAAU,EACtB,SAAS,EAAC,6FAA6F,uBAGhG,CACV,IACG,CACP,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAgB,uBAAuB,CAAC,KAA2B;IACjE,MAAM,CAAC,GAAG,IAAA,oBAAY,GAAE,CAAC;IACzB,MAAM,EACJ,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACX,WAAW,EACX,OAAO,GACR,GAAG,IAAA,wCAAiB,EAAC,KAAK,CAAC,CAAC;IAE7B,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,oDAAoD,aACjE,uBAAC,gBAAgB,IACf,KAAK,EAAC,MAAM,EACZ,KAAK,EAAE,cAAc,IAAI,EAAE,EAC3B,aAAa,EAAE,iBAAiB,EAChC,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"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { SmartCrudFilterProps } from '../filter.types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* "from" / "to" pair of editors for the `>=` / `<=` values (removing the
|
|
3
|
+
* The date filter with a range editor: the item label and the shared date
|
|
4
|
+
* editor for the item's value; for an `=` item an "advanced" button switches
|
|
5
|
+
* to a "from" / "to" pair of editors for the `>=` / `<=` values (removing the
|
|
7
6
|
* value), shown as well while a range value is set.
|
|
8
7
|
*/
|
|
9
8
|
export declare function SmartCrudFilterDateWithEdit(props: SmartCrudFilterProps): import("react/jsx-runtime").JSX.Element;
|