@smartsoft001/crud-shell-react 0.0.0-stage → 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 +11 -3
- package/package.json +29 -4
- package/src/index.d.ts +19 -0
- package/src/index.js +23 -0
- package/src/index.js.map +1 -0
- package/src/lib/components/export/export.d.ts +7 -0
- package/src/lib/components/export/export.js +15 -0
- package/src/lib/components/export/export.js.map +1 -0
- package/src/lib/components/export/export.types.d.ts +8 -0
- package/src/lib/components/export/export.types.js +3 -0
- package/src/lib/components/export/export.types.js.map +1 -0
- package/src/lib/components/export/index.d.ts +3 -0
- package/src/lib/components/export/index.js +7 -0
- package/src/lib/components/export/index.js.map +1 -0
- package/src/lib/components/export/use-crud-export.d.ts +15 -0
- package/src/lib/components/export/use-crud-export.js +72 -0
- package/src/lib/components/export/use-crud-export.js.map +1 -0
- package/src/lib/components/filter/base/use-crud-filter.d.ts +65 -0
- package/src/lib/components/filter/base/use-crud-filter.js +244 -0
- package/src/lib/components/filter/base/use-crud-filter.js.map +1 -0
- package/src/lib/components/filter/check/filter-check.d.ts +6 -0
- package/src/lib/components/filter/check/filter-check.js +44 -0
- package/src/lib/components/filter/check/filter-check.js.map +1 -0
- package/src/lib/components/filter/date/filter-date.d.ts +6 -0
- package/src/lib/components/filter/date/filter-date.js +18 -0
- package/src/lib/components/filter/date/filter-date.js.map +1 -0
- package/src/lib/components/filter/date/use-crud-filter-date.d.ts +22 -0
- package/src/lib/components/filter/date/use-crud-filter-date.js +40 -0
- package/src/lib/components/filter/date/use-crud-filter-date.js.map +1 -0
- 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 +7 -0
- package/src/lib/components/filter/date-time/filter-date-time.js +26 -0
- package/src/lib/components/filter/date-time/filter-date-time.js.map +1 -0
- package/src/lib/components/filter/date-with-edit/filter-date-with-edit.d.ts +8 -0
- package/src/lib/components/filter/date-with-edit/filter-date-with-edit.js +41 -0
- package/src/lib/components/filter/date-with-edit/filter-date-with-edit.js.map +1 -0
- package/src/lib/components/filter/filter.d.ts +7 -0
- package/src/lib/components/filter/filter.js +42 -0
- package/src/lib/components/filter/filter.js.map +1 -0
- package/src/lib/components/filter/filter.types.d.ts +14 -0
- package/src/lib/components/filter/filter.types.js +3 -0
- package/src/lib/components/filter/filter.types.js.map +1 -0
- package/src/lib/components/filter/flag/filter-flag.d.ts +6 -0
- package/src/lib/components/filter/flag/filter-flag.js +19 -0
- package/src/lib/components/filter/flag/filter-flag.js.map +1 -0
- package/src/lib/components/filter/index.d.ts +13 -0
- package/src/lib/components/filter/index.js +17 -0
- package/src/lib/components/filter/index.js.map +1 -0
- package/src/lib/components/filter/int/filter-int.d.ts +11 -0
- package/src/lib/components/filter/int/filter-int.js +45 -0
- package/src/lib/components/filter/int/filter-int.js.map +1 -0
- package/src/lib/components/filter/radio/filter-radio.d.ts +7 -0
- package/src/lib/components/filter/radio/filter-radio.js +20 -0
- package/src/lib/components/filter/radio/filter-radio.js.map +1 -0
- package/src/lib/components/filter/text/filter-text.d.ts +7 -0
- package/src/lib/components/filter/text/filter-text.js +20 -0
- package/src/lib/components/filter/text/filter-text.js.map +1 -0
- package/src/lib/components/filters/filters.d.ts +9 -0
- package/src/lib/components/filters/filters.js +19 -0
- package/src/lib/components/filters/filters.js.map +1 -0
- package/src/lib/components/filters/filters.types.d.ts +5 -0
- package/src/lib/components/filters/filters.types.js +3 -0
- package/src/lib/components/filters/filters.types.js.map +1 -0
- package/src/lib/components/filters/index.d.ts +3 -0
- package/src/lib/components/filters/index.js +7 -0
- package/src/lib/components/filters/index.js.map +1 -0
- package/src/lib/components/filters/use-crud-filters.d.ts +16 -0
- package/src/lib/components/filters/use-crud-filters.js +62 -0
- package/src/lib/components/filters/use-crud-filters.js.map +1 -0
- package/src/lib/components/filters-config/filters-config.d.ts +6 -0
- package/src/lib/components/filters-config/filters-config.js +37 -0
- package/src/lib/components/filters-config/filters-config.js.map +1 -0
- package/src/lib/components/filters-config/index.d.ts +1 -0
- package/src/lib/components/filters-config/index.js +5 -0
- package/src/lib/components/filters-config/index.js.map +1 -0
- package/src/lib/components/group/group.d.ts +9 -0
- package/src/lib/components/group/group.js +18 -0
- package/src/lib/components/group/group.js.map +1 -0
- package/src/lib/components/group/group.types.d.ts +8 -0
- package/src/lib/components/group/group.types.js +3 -0
- package/src/lib/components/group/group.types.js.map +1 -0
- package/src/lib/components/group/index.d.ts +3 -0
- package/src/lib/components/group/index.js +7 -0
- package/src/lib/components/group/index.js.map +1 -0
- package/src/lib/components/group/use-crud-group.d.ts +16 -0
- package/src/lib/components/group/use-crud-group.js +48 -0
- package/src/lib/components/group/use-crud-group.js.map +1 -0
- package/src/lib/components/multiselect/index.d.ts +2 -0
- package/src/lib/components/multiselect/index.js +6 -0
- package/src/lib/components/multiselect/index.js.map +1 -0
- package/src/lib/components/multiselect/multiselect.d.ts +9 -0
- package/src/lib/components/multiselect/multiselect.js +24 -0
- package/src/lib/components/multiselect/multiselect.js.map +1 -0
- package/src/lib/components/multiselect/use-crud-multiselect.d.ts +23 -0
- package/src/lib/components/multiselect/use-crud-multiselect.js +71 -0
- package/src/lib/components/multiselect/use-crud-multiselect.js.map +1 -0
- package/src/lib/crud.config.d.ts +66 -0
- package/src/lib/crud.config.js +3 -0
- package/src/lib/crud.config.js.map +1 -0
- package/src/lib/crud.context.d.ts +23 -0
- package/src/lib/crud.context.js +25 -0
- package/src/lib/crud.context.js.map +1 -0
- package/src/lib/crud.provider.d.ts +16 -0
- package/src/lib/crud.provider.js +68 -0
- package/src/lib/crud.provider.js.map +1 -0
- package/src/lib/factories/form-options.d.ts +10 -0
- package/src/lib/factories/form-options.js +26 -0
- package/src/lib/factories/form-options.js.map +1 -0
- package/src/lib/hooks.d.ts +15 -0
- package/src/lib/hooks.js +66 -0
- package/src/lib/hooks.js.map +1 -0
- package/src/lib/models/index.d.ts +1 -0
- package/src/lib/models/index.js +5 -0
- package/src/lib/models/index.js.map +1 -0
- package/src/lib/models/interfaces.d.ts +29 -0
- package/src/lib/models/interfaces.js +3 -0
- package/src/lib/models/interfaces.js.map +1 -0
- package/src/lib/pages/crud-pages.d.ts +31 -0
- package/src/lib/pages/crud-pages.js +63 -0
- package/src/lib/pages/crud-pages.js.map +1 -0
- package/src/lib/pages/index.d.ts +12 -0
- package/src/lib/pages/index.js +16 -0
- package/src/lib/pages/index.js.map +1 -0
- package/src/lib/pages/item/item-page.d.ts +15 -0
- package/src/lib/pages/item/item-page.js +28 -0
- package/src/lib/pages/item/item-page.js.map +1 -0
- package/src/lib/pages/item/item-page.types.d.ts +43 -0
- package/src/lib/pages/item/item-page.types.js +3 -0
- package/src/lib/pages/item/item-page.types.js.map +1 -0
- package/src/lib/pages/item/standard/item-page-standard.d.ts +8 -0
- package/src/lib/pages/item/standard/item-page-standard.js +17 -0
- package/src/lib/pages/item/standard/item-page-standard.js.map +1 -0
- package/src/lib/pages/item/use-crud-item-page-base.d.ts +21 -0
- package/src/lib/pages/item/use-crud-item-page-base.js +46 -0
- package/src/lib/pages/item/use-crud-item-page-base.js.map +1 -0
- package/src/lib/pages/item/use-crud-item-page.d.ts +44 -0
- package/src/lib/pages/item/use-crud-item-page.js +296 -0
- package/src/lib/pages/item/use-crud-item-page.js.map +1 -0
- package/src/lib/pages/list/list-page.d.ts +14 -0
- package/src/lib/pages/list/list-page.js +29 -0
- package/src/lib/pages/list/list-page.js.map +1 -0
- package/src/lib/pages/list/list-page.types.d.ts +25 -0
- package/src/lib/pages/list/list-page.types.js +3 -0
- package/src/lib/pages/list/list-page.types.js.map +1 -0
- package/src/lib/pages/list/standard/list-page-standard.d.ts +11 -0
- package/src/lib/pages/list/standard/list-page-standard.js +26 -0
- package/src/lib/pages/list/standard/list-page-standard.js.map +1 -0
- package/src/lib/pages/list/use-crud-list-page.d.ts +35 -0
- package/src/lib/pages/list/use-crud-list-page.js +307 -0
- package/src/lib/pages/list/use-crud-list-page.js.map +1 -0
- package/src/lib/pages/use-crud-bound-component.d.ts +9 -0
- package/src/lib/pages/use-crud-bound-component.js +27 -0
- package/src/lib/pages/use-crud-bound-component.js.map +1 -0
- package/src/lib/pages/use-crud-page-config.d.ts +8 -0
- package/src/lib/pages/use-crud-page-config.js +18 -0
- package/src/lib/pages/use-crud-page-config.js.map +1 -0
- package/src/lib/providers/model-label.provider.d.ts +11 -0
- package/src/lib/providers/model-label.provider.js +27 -0
- package/src/lib/providers/model-label.provider.js.map +1 -0
- package/src/lib/services/crud/crud.service.d.ts +43 -0
- package/src/lib/services/crud/crud.service.js +112 -0
- package/src/lib/services/crud/crud.service.js.map +1 -0
- package/src/lib/services/list-group/list-group.service.d.ts +18 -0
- package/src/lib/services/list-group/list-group.service.js +52 -0
- package/src/lib/services/list-group/list-group.service.js.map +1 -0
- package/src/lib/services/page/page.service.d.ts +8 -0
- package/src/lib/services/page/page.service.js +33 -0
- package/src/lib/services/page/page.service.js.map +1 -0
- package/src/lib/services/search/search.service.d.ts +14 -0
- package/src/lib/services/search/search.service.js +28 -0
- package/src/lib/services/search/search.service.js.map +1 -0
- package/src/lib/state/crud.actions.d.ts +157 -0
- package/src/lib/state/crud.actions.js +257 -0
- package/src/lib/state/crud.actions.js.map +1 -0
- package/src/lib/state/crud.effects.d.ts +19 -0
- package/src/lib/state/crud.effects.js +127 -0
- package/src/lib/state/crud.effects.js.map +1 -0
- package/src/lib/state/crud.facade.d.ts +42 -0
- package/src/lib/state/crud.facade.js +92 -0
- package/src/lib/state/crud.facade.js.map +1 -0
- package/src/lib/state/crud.reducer.d.ts +20 -0
- package/src/lib/state/crud.reducer.js +218 -0
- package/src/lib/state/crud.reducer.js.map +1 -0
- package/src/lib/state/crud.selectors.d.ts +9 -0
- package/src/lib/state/crud.selectors.js +24 -0
- package/src/lib/state/crud.selectors.js.map +1 -0
- package/src/lib/state/crud.store.d.ts +17 -0
- package/src/lib/state/crud.store.js +33 -0
- package/src/lib/state/crud.store.js.map +1 -0
- package/src/lib/state/index.d.ts +6 -0
- package/src/lib/state/index.js +10 -0
- package/src/lib/state/index.js.map +1 -0
- package/styles.css +6001 -0
|
@@ -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":";;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,CA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,SAAS,EAAC,4BAA4B,YACxC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CACnB,mCAEE,SAAS,EAAC,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,6 @@
|
|
|
1
|
+
import { SmartCrudFilterProps } from '../filter.types';
|
|
2
|
+
/**
|
|
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.
|
|
5
|
+
*/
|
|
6
|
+
export declare function SmartCrudFilterDate(props: SmartCrudFilterProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
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_value_1 = require("./use-crud-filter-value");
|
|
8
|
+
/**
|
|
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.
|
|
11
|
+
*/
|
|
12
|
+
function SmartCrudFilterDate(props) {
|
|
13
|
+
const t = (0, react_1.useTranslate)();
|
|
14
|
+
const { customValue, setCustomValue, hasValue, refresh } = (0, use_crud_filter_date_1.useCrudFilterDate)(props);
|
|
15
|
+
const [date, setDate] = (0, use_crud_filter_value_1.useCrudFilterValue)(customValue || '', setCustomValue);
|
|
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" }))] })] }));
|
|
17
|
+
}
|
|
18
|
+
//# 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":";;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"}
|
|
@@ -0,0 +1,22 @@
|
|
|
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, 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`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function useCrudFilterDate(props: SmartCrudFilterProps): UseCrudFilterDateResult;
|
|
@@ -0,0 +1,40 @@
|
|
|
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, 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`.
|
|
22
|
+
*/
|
|
23
|
+
function useCrudFilterDate(props) {
|
|
24
|
+
const filter = (0, use_crud_filter_1.useCrudFilter)(props);
|
|
25
|
+
const { setValue, setMinValue, setMaxValue } = filter;
|
|
26
|
+
const setCustomValue = (0, react_1.useCallback)((val) => setValue(toFilterDate(val)), [setValue]);
|
|
27
|
+
const setCustomMinValue = (0, react_1.useCallback)((val) => setMinValue(toFilterDate(val)), [setMinValue]);
|
|
28
|
+
const setCustomMaxValue = (0, react_1.useCallback)((val) => setMaxValue(toFilterDate(val)), [setMaxValue]);
|
|
29
|
+
return {
|
|
30
|
+
...filter,
|
|
31
|
+
allowAdvanced: props.item?.type === '=',
|
|
32
|
+
customValue: filter.value,
|
|
33
|
+
customMinValue: filter.minValue,
|
|
34
|
+
customMaxValue: filter.maxValue,
|
|
35
|
+
setCustomValue,
|
|
36
|
+
setCustomMinValue,
|
|
37
|
+
setCustomMaxValue,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
//# 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":";;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"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SmartCrudFilterProps } from '../filter.types';
|
|
2
|
+
/**
|
|
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.
|
|
6
|
+
*/
|
|
7
|
+
export declare function SmartCrudFilterDateTime(props: SmartCrudFilterProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
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_value_1 = require("../date/use-crud-filter-value");
|
|
9
|
+
/** One end of the range: a label, a `datetime-local` input and its clear. */
|
|
10
|
+
function DateTimeRangeRow({ label, value, onValueChange, clearLabel, showClear, onClear, }) {
|
|
11
|
+
const t = (0, react_2.useTranslate)();
|
|
12
|
+
const id = (0, react_1.useId)();
|
|
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
|
+
}
|
|
16
|
+
/**
|
|
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.
|
|
20
|
+
*/
|
|
21
|
+
function SmartCrudFilterDateTime(props) {
|
|
22
|
+
const t = (0, react_2.useTranslate)();
|
|
23
|
+
const { customMinValue, customMaxValue, setCustomMinValue, setCustomMaxValue, hasMinValue, hasMaxValue, refresh, } = (0, use_crud_filter_date_1.useCrudFilterDate)(props);
|
|
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, '<=') })] })] }));
|
|
25
|
+
}
|
|
26
|
+
//# 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":";;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,EAA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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,8 @@
|
|
|
1
|
+
import { SmartCrudFilterProps } from '../filter.types';
|
|
2
|
+
/**
|
|
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
|
|
6
|
+
* value), shown as well while a range value is set.
|
|
7
|
+
*/
|
|
8
|
+
export declare function SmartCrudFilterDateWithEdit(props: SmartCrudFilterProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
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_value_1 = require("../date/use-crud-filter-value");
|
|
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
|
+
* The shared date editor showing what the user entered until `value`
|
|
12
|
+
* changes.
|
|
13
|
+
*/
|
|
14
|
+
function BoundDateEdit({ value, onValueChange, }) {
|
|
15
|
+
const [shown, setShown] = (0, use_crud_filter_value_1.useCrudFilterValue)(value, onValueChange);
|
|
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: shown, onValueChange: setShown }) }));
|
|
17
|
+
}
|
|
18
|
+
/** One end of the advanced range: a label, a date editor and its clear. */
|
|
19
|
+
function DateRangeRow({ label, value, onValueChange, 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, { value: value, onValueChange: onValueChange }), showClear && ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: onClear, "aria-label": clearLabel, className: CLEAR_CLASSES, children: "\u00D7" }))] }));
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The date filter with a range editor: the item label and the shared date
|
|
25
|
+
* editor for the item's value; for an `=` item an "advanced" button switches
|
|
26
|
+
* to a "from" / "to" pair of editors for the `>=` / `<=` values (removing the
|
|
27
|
+
* value), shown as well while a range value is set.
|
|
28
|
+
*/
|
|
29
|
+
function SmartCrudFilterDateWithEdit(props) {
|
|
30
|
+
const t = (0, react_2.useTranslate)();
|
|
31
|
+
const { allowAdvanced, customValue, customMinValue, customMaxValue, setCustomValue, setCustomMinValue, setCustomMaxValue, hasValue, hasMinValue, hasMaxValue, setValue, refresh, } = (0, use_crud_filter_date_1.useCrudFilterDate)(props);
|
|
32
|
+
const [advanced, setAdvanced] = (0, react_1.useState)(false);
|
|
33
|
+
const toggleAdvanced = () => {
|
|
34
|
+
const next = !advanced;
|
|
35
|
+
setAdvanced(next);
|
|
36
|
+
if (next)
|
|
37
|
+
setValue(null);
|
|
38
|
+
};
|
|
39
|
+
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, { value: customValue || '', onValueChange: 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", value: customMinValue || '', onValueChange: setCustomMinValue, clearLabel: "clear-from", showClear: hasMinValue, onClear: () => refresh(null, '>=') }), (0, jsx_runtime_1.jsx)(DateRangeRow, { label: "to", value: customMaxValue || '', onValueChange: setCustomMaxValue, clearLabel: "clear-to", showClear: hasMaxValue, onClear: () => refresh(null, '<=') })] }))] }));
|
|
40
|
+
}
|
|
41
|
+
//# 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":";;AA6EA,kEA6FC;;AA1KD,iCAAiC;AAEjC,+CAAkE;AAElE,uEAAiE;AACjE,yEAAmE;AAGnE,MAAM,aAAa,GACjB,6FAA6F,CAAC;AAEhG;;;GAGG;AACH,SAAS,aAAa,CAAC,EACrB,KAAK,EACL,aAAa,GAId;IACC,MAAM,CAAC,KAAK,EAAE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,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,CACP,IACG,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SmartCrudFilterProps } from './filter.types';
|
|
2
|
+
/**
|
|
3
|
+
* The filter field of the item's field type (date, date with edit,
|
|
4
|
+
* date-time, radio, check, flag, int; text otherwise), reading and writing
|
|
5
|
+
* the list filter through the feature's facade.
|
|
6
|
+
*/
|
|
7
|
+
export declare function SmartCrudFilter(props: SmartCrudFilterProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
* The filter field of the item's field type (date, date with edit,
|
|
36
|
+
* date-time, radio, check, flag, int; text otherwise), reading and writing
|
|
37
|
+
* the list filter through the feature's facade.
|
|
38
|
+
*/
|
|
39
|
+
function SmartCrudFilter(props) {
|
|
40
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "smart:py-1", children: (0, jsx_runtime_1.jsx)(SmartCrudFilterField, { ...props }) }));
|
|
41
|
+
}
|
|
42
|
+
//# 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":";;AAsCA,0CAMC;;AA5CD,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;;;;GAIG;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,14 @@
|
|
|
1
|
+
import { IModelFilter } from '@smartsoft001/models';
|
|
2
|
+
import { ICrudFilter } from '../../models';
|
|
3
|
+
/** The props of `SmartCrudFilter` and of every filter field. */
|
|
4
|
+
export interface SmartCrudFilterProps {
|
|
5
|
+
/** The filter definition of the model (`IModelOptions.filters` item). */
|
|
6
|
+
item?: IModelFilter;
|
|
7
|
+
/** The current filter of the list, e.g. `useCrudState(s => s.filter)`. */
|
|
8
|
+
filter?: ICrudFilter | null;
|
|
9
|
+
}
|
|
10
|
+
/** An option of a radio / check filter. */
|
|
11
|
+
export interface CrudFilterPossibility {
|
|
12
|
+
id: any;
|
|
13
|
+
text: string;
|
|
14
|
+
}
|
|
@@ -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,6 @@
|
|
|
1
|
+
import { SmartCrudFilterProps } from '../filter.types';
|
|
2
|
+
/**
|
|
3
|
+
* The flag filter: the shared flag field bound to the item's value, and a
|
|
4
|
+
* clear button while the value is `true` or `false`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function SmartCrudFilterFlag(props: SmartCrudFilterProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
* The flag filter: the shared flag field bound to the item's value, and a
|
|
10
|
+
* clear button while the value is `true` or `false`.
|
|
11
|
+
*/
|
|
12
|
+
function SmartCrudFilterFlag(props) {
|
|
13
|
+
const filter = (0, use_crud_filter_1.useCrudFilter)(props);
|
|
14
|
+
const control = (0, use_crud_filter_1.useCrudFilterControl)(filter);
|
|
15
|
+
const { buildInputOptions, value, refresh } = filter;
|
|
16
|
+
const options = (0, react_1.useMemo)(() => buildInputOptions(control), [buildInputOptions, control]);
|
|
17
|
+
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" }))] }) }));
|
|
18
|
+
}
|
|
19
|
+
//# 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":";;AAWA,kDA4BC;;AAvCD,iCAAgC;AAEhC,+CAAqD;AAErD,6DAA8E;AAG9E;;;GAGG;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-value';
|
|
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-value"), 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,uEAA6C;AAC7C,uEAA6C;AAC7C,iFAAuD;AACvD,mDAAyB;AACzB,yDAA+B;AAC/B,6DAAmC;AACnC,2DAAiC;AACjC,+DAAqC;AACrC,6DAAmC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SmartCrudFilterProps } from '../filter.types';
|
|
2
|
+
/**
|
|
3
|
+
* The int filter: the shared int field for the item's value; for an `=` item
|
|
4
|
+
* a settings button switches to the advanced "from" / "to" range (removing
|
|
5
|
+
* the value), shown as well while a range value is set. The clear button
|
|
6
|
+
* removes every entry of the item at once, the range ones only their own.
|
|
7
|
+
*
|
|
8
|
+
* The range controls are seeded once and not re-synced when the filter
|
|
9
|
+
* changes elsewhere (TODO GAP-19).
|
|
10
|
+
*/
|
|
11
|
+
export declare function SmartCrudFilterInt(props: SmartCrudFilterProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,45 @@
|
|
|
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 (an emptied input is `null`).
|
|
12
|
+
*/
|
|
13
|
+
function RangeInput({ label, control, }) {
|
|
14
|
+
const t = (0, react_2.useTranslate)();
|
|
15
|
+
const id = (0, react_1.useId)();
|
|
16
|
+
const { value, onChange, onBlur } = (0, react_2.useControlBinding)(control);
|
|
17
|
+
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" })] }));
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The int filter: the shared int field for the item's value; for an `=` item
|
|
21
|
+
* a settings button switches to the advanced "from" / "to" range (removing
|
|
22
|
+
* the value), shown as well while a range value is set. The clear button
|
|
23
|
+
* removes every entry of the item at once, the range ones only their own.
|
|
24
|
+
*
|
|
25
|
+
* The range controls are seeded once and not re-synced when the filter
|
|
26
|
+
* changes elsewhere (TODO GAP-19).
|
|
27
|
+
*/
|
|
28
|
+
function SmartCrudFilterInt(props) {
|
|
29
|
+
const filter = (0, use_crud_filter_1.useCrudFilter)(props);
|
|
30
|
+
const valueControl = (0, use_crud_filter_1.useCrudFilterControl)(filter, null);
|
|
31
|
+
const minControl = (0, use_crud_filter_1.useCrudFilterControl)(filter, '>=');
|
|
32
|
+
const maxControl = (0, use_crud_filter_1.useCrudFilterControl)(filter, '<=');
|
|
33
|
+
const [advanced, setAdvanced] = (0, react_1.useState)(false);
|
|
34
|
+
const { buildInputOptions, hasValue, hasMinValue, hasMaxValue, setValue, refresh, clear, } = filter;
|
|
35
|
+
const valueOptions = (0, react_1.useMemo)(() => buildInputOptions(valueControl), [buildInputOptions, valueControl]);
|
|
36
|
+
const allowAdvanced = props.item?.type === '=';
|
|
37
|
+
const toggleAdvanced = () => {
|
|
38
|
+
const next = !advanced;
|
|
39
|
+
setAdvanced(next);
|
|
40
|
+
if (next)
|
|
41
|
+
setValue(null);
|
|
42
|
+
};
|
|
43
|
+
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" }))] }))] }));
|
|
44
|
+
}
|
|
45
|
+
//# 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":";;AA6DA,gDA0FC;;AAvJD,iCAAiD;AAEjD,+CAM6B;AAE7B,6DAA8E;AAG9E,MAAM,aAAa,GACjB,6FAA6F,CAAC;AAEhG;;;GAGG;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,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,kBAAkB,CAAC,KAA2B;IAC5D,MAAM,MAAM,GAAG,IAAA,+BAAa,EAAC,KAAK,CAAC,CAAC;IACpC,MAAM,YAAY,GAAG,IAAA,sCAAoB,EAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACxD,MAAM,U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,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
|
+
* The radio filter: the shared radio field with the filter's possibilities,
|
|
4
|
+
* bound to the item's value, and a clear button while the value is truthy or
|
|
5
|
+
* `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
|
+
* The radio filter: the shared radio field with the filter's possibilities,
|
|
10
|
+
* bound to the item's value, and a clear button while the value is truthy or
|
|
11
|
+
* `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
|
+
* The text filter: the shared text field bound to the item's value, and a
|
|
4
|
+
* 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;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SmartCrudFilterText = SmartCrudFilterText;
|
|
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
|
+
* The text filter: the shared text field bound to the item's value, and a
|
|
10
|
+
* clear button while it has one.
|
|
11
|
+
* Typing reads the list 500 ms after the last change.
|
|
12
|
+
*/
|
|
13
|
+
function SmartCrudFilterText(props) {
|
|
14
|
+
const filter = (0, use_crud_filter_1.useCrudFilter)(props);
|
|
15
|
+
const control = (0, use_crud_filter_1.useCrudFilterControl)(filter);
|
|
16
|
+
const { buildInputOptions, hasValue, 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-end smart:gap-2", children: [(0, jsx_runtime_1.jsx)("div", { className: "smart:flex-1", children: (0, jsx_runtime_1.jsx)(react_2.SmartInputText, { className: "smart:flex-1", options: options }) }), 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" }))] }) }));
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=filter-text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-text.js","sourceRoot":"","sources":["../../../../../../../../../../packages/crud/shell/react/src/lib/components/filter/text/filter-text.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,QAAQ,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC;IACxD,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,qDAAqD,aAClE,gCAAK,SAAS,EAAC,cAAc,YAC3B,uBAAC,sBAAc,IAAC,SAAS,EAAC,cAAc,EAAC,OAAO,EAAE,OAAO,GAAI,GACzD,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,GACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IEntity } from '@smartsoft001/domain-core';
|
|
2
|
+
import { SmartCrudFiltersProps } from './filters.types';
|
|
3
|
+
/**
|
|
4
|
+
* The filters panel of the CRUD feature, opened in the end menu — a header
|
|
5
|
+
* with the title and a close button (unless `hideMenu`), then a
|
|
6
|
+
* `SmartCrudFilter` for every filter of the model: the `filters` of `@Model`
|
|
7
|
+
* and the fields with `list.filter`. Render it inside `<CrudProvider>`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function SmartCrudFilters<T extends IEntity<string>>(props: SmartCrudFiltersProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SmartCrudFilters = SmartCrudFilters;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("@smartsoft001/react");
|
|
6
|
+
const use_crud_filters_1 = require("./use-crud-filters");
|
|
7
|
+
const filter_1 = require("../filter/filter");
|
|
8
|
+
/**
|
|
9
|
+
* The filters panel of the CRUD feature, opened in the end menu — a header
|
|
10
|
+
* with the title and a close button (unless `hideMenu`), then a
|
|
11
|
+
* `SmartCrudFilter` for every filter of the model: the `filters` of `@Model`
|
|
12
|
+
* and the fields with `list.filter`. Render it inside `<CrudProvider>`.
|
|
13
|
+
*/
|
|
14
|
+
function SmartCrudFilters(props) {
|
|
15
|
+
const t = (0, react_1.useTranslate)();
|
|
16
|
+
const { elementRef, hideMenu, list, filter, onClose } = (0, use_crud_filters_1.useCrudFilters)(props);
|
|
17
|
+
return ((0, jsx_runtime_1.jsxs)("div", { ref: elementRef, className: "smart:flex smart:h-full smart:flex-col", children: [!hideMenu && ((0, jsx_runtime_1.jsxs)("header", { className: "smart:flex smart:items-center smart:justify-between smart:border-b smart:border-gray-200 smart:px-4 smart:py-3", children: [(0, jsx_runtime_1.jsx)("h2", { className: "smart:text-lg smart:font-semibold smart:text-gray-900", children: t('filters') }), (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: onClose, "aria-label": "close", className: "smart:rounded smart:p-1 smart:text-gray-500 smart:hover:bg-gray-100", children: "\u2715" })] })), (0, jsx_runtime_1.jsx)("div", { className: "smart:flex-1 smart:overflow-y-auto smart:px-4 smart:py-3", children: list.map((item, index) => ((0, jsx_runtime_1.jsx)(filter_1.SmartCrudFilter, { item: item, filter: filter }, `${index}:${item.key}`))) })] }));
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=filters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filters.js","sourceRoot":"","sources":["../../../../../../../../../packages/crud/shell/react/src/lib/components/filters/filters.tsx"],"names":[],"mappings":";;AAaA,4CAoCC;;AAhDD,+CAAmD;AAGnD,yDAAoD;AACpD,6CAAmD;AAEnD;;;;;GAKG;AACH,SAAgB,gBAAgB,CAC9B,KAA4B;IAE5B,MAAM,CAAC,GAAG,IAAA,oBAAY,GAAE,CAAC;IACzB,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GACnD,IAAA,iCAAc,EAAI,KAAK,CAAC,CAAC;IAE3B,OAAO,CACL,iCAAK,GAAG,EAAE,UAAU,EAAE,SAAS,EAAC,wCAAwC,aACrE,CAAC,QAAQ,IAAI,CACZ,oCAAQ,SAAS,EAAC,gHAAgH,aAChI,+BAAI,SAAS,EAAC,uDAAuD,YAClE,CAAC,CAAC,SAAS,CAAC,GACV,EACL,mCACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,OAAO,gBACL,OAAO,EAClB,SAAS,EAAC,qEAAqE,uBAGxE,IACF,CACV,EAED,gCAAK,SAAS,EAAC,0DAA0D,YACtE,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CACzB,uBAAC,wBAAe,IAEd,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,IAFT,GAAG,KAAK,IAAI,IAAI,CAAC,GAAG,EAAE,CAG3B,CACH,CAAC,GACE,IACF,CACP,CAAC;AACJ,CAAC"}
|