@armtek/data 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/dist/dataTableStoreFactory-BTH4XExR.cjs +1 -0
  2. package/dist/dataTableStoreFactory-CTIqHKTT.js +1505 -0
  3. package/dist/dataTableStoreFactory.css +1 -0
  4. package/dist/dictionary.cjs +1 -0
  5. package/dist/dictionary.d.ts +2 -0
  6. package/dist/dictionary.js +6 -0
  7. package/dist/index.cjs +1 -0
  8. package/dist/index.d.ts +2 -0
  9. package/dist/index.js +15 -0
  10. package/dist/search.cjs +1 -0
  11. package/dist/search.d.ts +2 -0
  12. package/dist/search.js +4 -0
  13. package/dist/src/config/tests/changeDateField.d.ts +2 -0
  14. package/dist/src/config/tests/changeSelectField.d.ts +1 -0
  15. package/dist/src/config/tests/changeTextField.d.ts +1 -0
  16. package/dist/src/config/tests/clickBackdropOverlay.d.ts +1 -0
  17. package/dist/src/config/tests/createWrapper.d.ts +6 -0
  18. package/dist/src/index.d.ts +3 -0
  19. package/dist/src/modules/dictionary/config/types.d.ts +1 -0
  20. package/dist/src/modules/dictionary/index.d.ts +3 -0
  21. package/dist/src/modules/dictionary/lib/useDictionary.d.ts +7 -0
  22. package/dist/src/modules/dictionary/lib/useDictionaryFetching.d.ts +1 -0
  23. package/dist/src/modules/dictionary/lib/useDictionaryItems.d.ts +1 -0
  24. package/dist/src/modules/dictionary/lib/useDictionaryRequested.d.ts +1 -0
  25. package/dist/src/modules/dictionary/model/dictionaryStore.d.ts +19 -0
  26. package/dist/src/modules/dictionary/ui/DictInput.d.ts +10 -0
  27. package/dist/src/modules/search/Search.d.ts +21 -0
  28. package/dist/src/modules/search/index.d.ts +1 -0
  29. package/dist/src/modules/table/index.d.ts +11 -0
  30. package/dist/src/modules/table/lib/GetDefaultFilters.d.ts +2 -0
  31. package/dist/src/modules/table/lib/const.d.ts +1 -0
  32. package/dist/src/modules/table/lib/deleteUrlParamByName.d.ts +1 -0
  33. package/dist/src/modules/table/lib/formatDate.d.ts +3 -0
  34. package/dist/src/modules/table/lib/getFilterDisplayValue.d.ts +3 -0
  35. package/dist/src/modules/table/lib/local_storage.d.ts +6 -0
  36. package/dist/src/modules/table/lib/makePaginatedFilterParams.d.ts +12 -0
  37. package/dist/src/modules/table/lib/sortByField.d.ts +3 -0
  38. package/dist/src/modules/table/lib/uuid.d.ts +1 -0
  39. package/dist/src/modules/table/model/dataTableContext.d.ts +36 -0
  40. package/dist/src/modules/table/model/dataTableStoreFactory.d.ts +97 -0
  41. package/dist/src/modules/table/model/types.d.ts +22 -0
  42. package/dist/src/modules/table/model/useDataTable.d.ts +2 -0
  43. package/dist/src/modules/table/ui/ActionList/ActionList.d.ts +13 -0
  44. package/dist/src/modules/table/ui/DataTable.d.ts +54 -0
  45. package/dist/src/modules/table/ui/DataTable.skeleton.d.ts +12 -0
  46. package/dist/src/modules/table/ui/DataTableActions/DataTableActions.d.ts +6 -0
  47. package/dist/src/modules/table/ui/FilterBar/FilterBar.d.ts +71 -0
  48. package/dist/src/modules/table/ui/FilterBar/FilterForm/FilterForm.d.ts +9 -0
  49. package/dist/src/modules/table/ui/FilterBar/FilterForm/FilterFormCheckbox.d.ts +24 -0
  50. package/dist/src/modules/table/ui/FilterBar/FilterForm/FilterFormDate.d.ts +16 -0
  51. package/dist/src/modules/table/ui/FilterBar/FilterForm/FilterFormField.d.ts +10 -0
  52. package/dist/src/modules/table/ui/FilterBar/FilterForm/FilterFormInput.d.ts +19 -0
  53. package/dist/src/modules/table/ui/FilterBar/FilterForm/FilterFormInterval.d.ts +19 -0
  54. package/dist/src/modules/table/ui/FilterBar/FilterForm/FilterFormPeriod.d.ts +24 -0
  55. package/dist/src/modules/table/ui/FilterBar/FilterForm/FilterFormSearch.d.ts +21 -0
  56. package/dist/src/modules/table/ui/FilterBar/FilterForm/FilterFormSelect.d.ts +31 -0
  57. package/dist/src/modules/table/ui/FilterBar/FilterSearch/FilterSearch.d.ts +7 -0
  58. package/dist/src/modules/table/ui/FilterBar/FilterSelector.d.ts +7 -0
  59. package/dist/src/modules/table/ui/FilterBar/TableFilterBar.d.ts +2 -0
  60. package/dist/src/modules/table/ui/Menu/ContextMenu.d.ts +9 -0
  61. package/dist/src/modules/table/ui/Menu/ContextMenuBtn.d.ts +13 -0
  62. package/dist/src/modules/table/ui/Table/Table.d.ts +20 -0
  63. package/dist/src/modules/table/ui/Table/TableBody.d.ts +19 -0
  64. package/dist/src/modules/table/ui/Table/TableHead.d.ts +20 -0
  65. package/dist/src/modules/table/ui/TableActionBar/DataTableActionBar.d.ts +6 -0
  66. package/dist/src/modules/table/ui/TableActionBar/TableActionBar.d.ts +11 -0
  67. package/dist/src/modules/table/ui/TableActionBar/TableRowSelect.d.ts +10 -0
  68. package/dist/src/modules/table/ui/TableActionCol.d.ts +9 -0
  69. package/dist/src/modules/table/ui/TableCell.d.ts +11 -0
  70. package/dist/src/modules/table/ui/TableContextMenu.d.ts +16 -0
  71. package/dist/src/modules/table/ui/TablePagination.d.ts +2 -0
  72. package/dist/src/modules/table/ui/TableSort.d.ts +10 -0
  73. package/dist/table.cjs +1 -0
  74. package/dist/table.d.ts +2 -0
  75. package/dist/table.js +11 -0
  76. package/dist/vite.config.d.ts +2 -0
  77. package/package.json +70 -0
@@ -0,0 +1 @@
1
+ ._rowCell_e90xa_1{padding:5px!important}._rowCell__inner_e90xa_7{display:flex;align-items:center;min-height:48px;padding:0 8px}._rowHead_e90xa_21{padding:0!important;font-size:13px}._rowHead__inner_e90xa_29{padding:9px 8px}._rowCellInnerControls_e90xa_37{transition:.5s all ease;transform:translateY(0);display:block;transform-origin:left}._rowCellInnerControls_e90xa_37{position:absolute;top:50%;left:5px;transform:translateY(-50%)}._DataTableRow_actions_beneath_e90xa_61:hover ._rowCellInnerControls_e90xa_37{transform:translateY(0) scale(.8);top:4px}._DataTableRow_actions_over_e90xa_69:hover ._rowCellInnerControls_e90xa_37{opacity:0}._TableSort__btn_e90xa_75{opacity:0;transition:.5s all ease}._TableSort__btn_active_e90xa_83,._TableSort_e90xa_75:hover ._TableSort__btn_e90xa_75{opacity:1}._dtactions_1taex_1{height:22px;bottom:4px;display:flex;justify-content:flex-start;z-index:10}._dtactions_1taex_1 ._dtactions__actions_1taex_8{opacity:1;justify-content:flex-start;visibility:visible}._SearchResult_1uw6b_1{position:absolute;top:100%;left:0;z-index:1001;width:100%;max-height:378px;overflow:auto;padding:var(--size-step) 0;background-color:#fff;box-sizing:border-box;box-shadow:var(--box-shadow)}._SearchNoResult_1uw6b_15{bottom:0;position:sticky;left:0;margin-top:var(--size-step);margin-bottom:var(--size-step);background:#fff}._filter_close_o8fvt_1{position:absolute;top:50%;right:calc(var(--size-step) * 2);transform:translateY(-50%)}._filter_search_input_1rpsv_1{outline:none;border:none;font-size:14px}._filter_search_input_1rpsv_1::placeholder{color:var(--color-gray-500)}._filter_search_input_1rpsv_1:-ms-input-placeholder{color:var(--color-gray-500)}._filter_search_input_1rpsv_1::-ms-input-placeholder{color:var(--color-gray-500)}._filter_search_loader_1rpsv_16{position:absolute;right:5px;top:50%;transform:translateY(-50%)}
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./dataTableStoreFactory-BTH4XExR.cjs");exports.DictInput=t.DictInput;exports.useDictionary=t.useDictionary;exports.useDictionaryItems=t.useDictionaryItems;
@@ -0,0 +1,2 @@
1
+ export * from './src/modules/dictionary/index'
2
+ export {}
@@ -0,0 +1,6 @@
1
+ import { b as a, u as e, e as i } from "./dataTableStoreFactory-CTIqHKTT.js";
2
+ export {
3
+ a as DictInput,
4
+ e as useDictionary,
5
+ i as useDictionaryItems
6
+ };
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./dataTableStoreFactory-BTH4XExR.cjs");exports.DataTable=e.DataTable;exports.DataTableSkeleton=e.DataTable_skeleton;exports.DictInput=e.DictInput;exports.FilterBar=e.FilterBar;exports.FilterFormField=e.FilterFormField;exports.SearchAnything=e.SearchAnything;exports.TableActionCol=e.TableActionCol;exports.createDataTable=e.createDataTable;exports.makePaginatedFilterParams=e.makePaginatedFilterParams;exports.sortByField=e.sortByField;exports.useDictionary=e.useDictionary;exports.useDictionaryItems=e.useDictionaryItems;
@@ -0,0 +1,2 @@
1
+ export * from './src/index'
2
+ export {}
package/dist/index.js ADDED
@@ -0,0 +1,15 @@
1
+ import { D as s, a as t, b as i, F as r, c as l, S as o, T as n, d as c, m as D, s as F, u as m, e as b } from "./dataTableStoreFactory-CTIqHKTT.js";
2
+ export {
3
+ s as DataTable,
4
+ t as DataTableSkeleton,
5
+ i as DictInput,
6
+ r as FilterBar,
7
+ l as FilterFormField,
8
+ o as SearchAnything,
9
+ n as TableActionCol,
10
+ c as createDataTable,
11
+ D as makePaginatedFilterParams,
12
+ F as sortByField,
13
+ m as useDictionary,
14
+ b as useDictionaryItems
15
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./dataTableStoreFactory-BTH4XExR.cjs");exports.SearchAnything=e.SearchAnything;
@@ -0,0 +1,2 @@
1
+ export * from './src/modules/search/index'
2
+ export {}
package/dist/search.js ADDED
@@ -0,0 +1,4 @@
1
+ import { S as e } from "./dataTableStoreFactory-CTIqHKTT.js";
2
+ export {
3
+ e as SearchAnything
4
+ };
@@ -0,0 +1,2 @@
1
+ export declare const changeDateField: (field: HTMLElement) => Promise<void>;
2
+ export declare const changePeriodField: (field: HTMLElement) => Promise<void>;
@@ -0,0 +1 @@
1
+ export declare const changeSelectField: (field: HTMLElement, label?: string) => Promise<void>;
@@ -0,0 +1 @@
1
+ export declare const changeTextField: (field: HTMLElement, value: string | number | boolean) => Promise<void>;
@@ -0,0 +1 @@
1
+ export declare const clickBackdropOverlay: (container: Element) => Promise<void>;
@@ -0,0 +1,6 @@
1
+ import { ReactNode } from 'react';
2
+ import { Scope } from 'effector';
3
+ export declare const renderWithScope: (ui: ReactNode, scope?: Scope) => import('@testing-library/react').RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement, HTMLElement>;
4
+ export declare function createWrapper(scope: Scope): ({ children }: {
5
+ children: ReactNode;
6
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ export * from './modules/table';
2
+ export * from './modules/dictionary';
3
+ export { SearchAnything, type SearchAnythingProps } from './modules/search/Search';
@@ -0,0 +1 @@
1
+ export type GetDataArg = () => Promise<any>;
@@ -0,0 +1,3 @@
1
+ export { useDictionaryItems } from './lib/useDictionaryItems';
2
+ export { useDictionary } from './lib/useDictionary';
3
+ export { DictInput } from './ui/DictInput';
@@ -0,0 +1,7 @@
1
+ import { GetDataArg } from '../config/types';
2
+ type ReturnType = {
3
+ isFetching: boolean;
4
+ items: any[];
5
+ };
6
+ export declare function useDictionary<T extends Record<string, any> = Record<string, any>>(code: string, getData: GetDataArg): ReturnType;
7
+ export {};
@@ -0,0 +1 @@
1
+ export declare function useDictionaryFetching(code: string): boolean;
@@ -0,0 +1 @@
1
+ export declare function useDictionaryItems<T extends Record<string, any>>(code: string): any[];
@@ -0,0 +1 @@
1
+ export declare const useDictionaryRequested: (code: string) => boolean;
@@ -0,0 +1,19 @@
1
+ import { DataTableGetListType } from '../../table';
2
+ import { GetDataArg } from '../config/types';
3
+ type SingleDictionaryStore = {
4
+ code: string;
5
+ getData: () => Promise<any>;
6
+ requested: boolean;
7
+ isFetching: boolean;
8
+ items: any[];
9
+ };
10
+ export declare const $dictionaries: import('effector').StoreWritable<Record<string, SingleDictionaryStore>>;
11
+ export declare const dictDataFetched: import('effector').EventCallable<{
12
+ code: string;
13
+ getData: GetDataArg;
14
+ } & DataTableGetListType>;
15
+ export declare const fetchDictionaryDataFx: import('effector').Effect<{
16
+ getData: () => Promise<any>;
17
+ code: string;
18
+ } & DataTableGetListType, any, Error>;
19
+ export {};
@@ -0,0 +1,10 @@
1
+ import { ComponentProps, ElementType } from 'react';
2
+ type Props<E extends ElementType = ElementType> = {
3
+ getData: () => Promise<any>;
4
+ code: string;
5
+ value_key?: string;
6
+ label_key?: string;
7
+ Component: E;
8
+ } & ComponentProps<E>;
9
+ export declare function DictInput<E extends ElementType>(props: Omit<Props<E>, 'options'>): import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,21 @@
1
+ import { ReactNode } from 'react';
2
+ import { TextFieldProps } from 'armtek-uikit-react/ui/Form/TextField';
3
+ export type SearchAnythingProps<T extends Record<string, any>> = {
4
+ getData: () => Promise<any>;
5
+ code: string;
6
+ endpoint: string | ((value: string) => string);
7
+ getValue?: (item: T) => string | ReactNode;
8
+ getOption?: (item: T) => string | ReactNode;
9
+ getTitle?: (item: T) => string;
10
+ noResultNode?: string | ReactNode;
11
+ defaultValue?: string;
12
+ onSelect?: (value: string, item: T) => void;
13
+ onChange?: (value: string) => void;
14
+ onReset?: () => void;
15
+ onClickAway?: () => void;
16
+ recommendations?: T[];
17
+ label__recommendations?: string;
18
+ inputProps?: TextFieldProps;
19
+ value?: string;
20
+ };
21
+ export declare function SearchAnything<T extends Record<string, any>>(props: SearchAnythingProps<T> & Omit<TextFieldProps, keyof SearchAnythingProps<T>>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export { SearchAnything, type SearchAnythingProps } from './Search';
@@ -0,0 +1,11 @@
1
+ export { DataTable } from './model/dataTableContext';
2
+ export { createDataTable } from './model/dataTableStoreFactory';
3
+ export { type DataTableColType, type TableRowType2 } from './ui/DataTable';
4
+ export { type FilterItemType, FilterBar } from './ui/FilterBar/FilterBar';
5
+ export { FilterFormField } from './ui/FilterBar/FilterForm/FilterFormField';
6
+ export { default as DataTableSkeleton } from './ui/DataTable.skeleton';
7
+ export { sortByField } from './lib/sortByField';
8
+ export { type TableContextActionType } from './ui/TableContextMenu';
9
+ export { type TableRowActionType } from './ui/Table/Table';
10
+ export { TableActionCol } from './ui/TableActionCol';
11
+ export { makePaginatedFilterParams, type DataTableGetListType } from './lib/makePaginatedFilterParams';
@@ -0,0 +1,2 @@
1
+ import { FilterItemType } from '../ui/FilterBar/FilterBar';
2
+ export declare const getDefaultFilters: (filters: FilterItemType<any>[]) => FilterItemType<any>[];
@@ -0,0 +1 @@
1
+ export declare const DATA_TABLE_PAGE_SIZES: number[];
@@ -0,0 +1 @@
1
+ export declare const deleteUrlParamByName: (name: string, url: string) => string;
@@ -0,0 +1,3 @@
1
+ type DateInput = string | Date;
2
+ export declare const formatDate: (date: DateInput, format?: string) => string;
3
+ export {};
@@ -0,0 +1,3 @@
1
+ import { FilterItemType } from '../ui/FilterBar/FilterBar';
2
+ import { TableRowType2 } from '../ui/DataTable';
3
+ export declare const getFilterDisplayValue: <T extends TableRowType2>(item: FilterItemType<T>, value: any, config?: Record<string, any>) => string;
@@ -0,0 +1,6 @@
1
+ export declare const LocalStorage: {
2
+ getArray<R = any>(key: string): R[];
3
+ setItem(key: string, value: any): void;
4
+ getItem(key: string): string | null;
5
+ pushValue<R = any>(key: string, value: R, limit?: number, id_key?: keyof R | null, unique?: boolean): void;
6
+ };
@@ -0,0 +1,12 @@
1
+ import { SortOrderType } from '../model/types';
2
+ import { FilterItemType } from '../ui/FilterBar/FilterBar';
3
+ export type DataTableGetListType = {
4
+ searchFields?: string[];
5
+ searchQuery?: string;
6
+ filter?: FilterItemType[];
7
+ page?: number | string;
8
+ pageSize?: number;
9
+ sort?: string | null;
10
+ order?: SortOrderType;
11
+ };
12
+ export declare function makePaginatedFilterParams(config: DataTableGetListType): URLSearchParams;
@@ -0,0 +1,3 @@
1
+ import { SortOrderType } from '../model/types';
2
+ import { TableRowType2 } from '../ui/DataTable';
3
+ export declare const sortByField: (field: string, order?: SortOrderType) => (a: TableRowType2, b: TableRowType2) => any;
@@ -0,0 +1 @@
1
+ export declare const uuidv4: () => string;
@@ -0,0 +1,36 @@
1
+ import { MouseEvent, ReactNode } from 'react';
2
+ import { SortOrderType } from './types';
3
+ import { FilterItemType } from '../ui/FilterBar/FilterBar';
4
+ import { DataTableActionType } from '../ui/TableActionBar/DataTableActionBar';
5
+ import { TableRowActionType } from '../ui/Table/Table';
6
+ import { TableContextActionType } from '../ui/TableContextMenu';
7
+ import { DataTableColType, TableRowType2 } from '../ui/DataTable';
8
+ import { DataTableCombinedStore } from './dataTableStoreFactory';
9
+ export declare const DataTableContext: import('react').Context<any>;
10
+ type DataTableProps<T extends TableRowType2> = {
11
+ endpoint?: string;
12
+ items?: T[];
13
+ filters?: FilterItemType<T>[];
14
+ structure?: DataTableColType<T>[];
15
+ tableActions?: DataTableActionType<T>[];
16
+ rowActions?: TableRowActionType<T>[];
17
+ contextActions?: TableContextActionType<T>[];
18
+ onActionClick?: (row: T, code: string) => void;
19
+ onContextMenu?: (e: MouseEvent<any>, row: T) => void;
20
+ onRowClick?: (e: MouseEvent, row: T) => void;
21
+ displayActionCol?: boolean;
22
+ displaySummary?: boolean;
23
+ displayIndex?: boolean;
24
+ sort?: keyof T;
25
+ order?: SortOrderType;
26
+ page?: number;
27
+ pageSize?: number;
28
+ emptyResult?: string | ReactNode;
29
+ getIsRowActive?: (row: T) => boolean;
30
+ getRowStyles?: (row: T) => any;
31
+ search?: Array<keyof T>;
32
+ rowClassName?: ((row: T) => string) | string;
33
+ store: DataTableCombinedStore;
34
+ };
35
+ export declare function DataTable<T extends TableRowType2>(props: DataTableProps<T>): import("react/jsx-runtime").JSX.Element;
36
+ export {};
@@ -0,0 +1,97 @@
1
+ import { DataTableColType, TableRowType2 } from '../ui/DataTable';
2
+ import { SortOrderType } from './types';
3
+ import { Effect, EventCallable, StoreWritable } from 'effector';
4
+ import { FilterItemType } from '../ui/FilterBar/FilterBar';
5
+ import { DataTableActionType } from '../ui/TableActionBar/DataTableActionBar';
6
+ import { TableContextActionType } from '../ui/TableContextMenu';
7
+ import { TableRowActionType } from '../ui/Table/Table';
8
+ type Page = number;
9
+ type PageSize = number;
10
+ type Sort = string;
11
+ type Endpoint = string;
12
+ type SearchQuery = string;
13
+ type SearchFields = string[];
14
+ type GetResults = (result: any) => any[];
15
+ type GetCount = (result: any) => number;
16
+ type Mapper = (item: any) => any;
17
+ type FetchArgs = {
18
+ endpoint: Endpoint;
19
+ currentFilter: FilterItemType<any>[];
20
+ page: Page;
21
+ pageSize: PageSize;
22
+ sort: Sort;
23
+ order: SortOrderType;
24
+ searchQuery: SearchQuery;
25
+ searchFields: SearchFields;
26
+ local: boolean;
27
+ };
28
+ type DataTableInitialValues = {
29
+ getData: (url: string) => Promise<any[]>;
30
+ endpoint: string;
31
+ structure?: DataTableColType<any>[];
32
+ pageSize?: PageSize;
33
+ page?: Page;
34
+ filters?: FilterItemType<any>[];
35
+ items?: TableRowType2[];
36
+ count?: number;
37
+ enableRowClick?: boolean;
38
+ local?: boolean;
39
+ displayIndex?: boolean;
40
+ displayActionCol?: boolean;
41
+ tableActions?: DataTableActionType<any>[];
42
+ contextActions?: TableContextActionType<any>[];
43
+ rowActions?: TableRowActionType<any>[];
44
+ sort?: Sort;
45
+ order?: SortOrderType;
46
+ search?: string[];
47
+ getResult?: GetResults;
48
+ getCount?: GetCount;
49
+ mapper?: Mapper;
50
+ cacheTime?: number;
51
+ };
52
+ export type DataTableCombinedStore = {
53
+ dataTableInitialized: EventCallable<DataTableInitialValues>;
54
+ itemsSet: EventCallable<{
55
+ items: TableRowType2[];
56
+ applyFilters?: boolean;
57
+ }>;
58
+ dataFetched: EventCallable<void>;
59
+ searchQuerySet: EventCallable<string>;
60
+ currentFilterDeleted: EventCallable<string>;
61
+ currentFilterSet: EventCallable<FilterItemType>;
62
+ rowsSelected: EventCallable<{
63
+ rows: string[];
64
+ flag: boolean;
65
+ }>;
66
+ sortSet: EventCallable<string>;
67
+ pageSet: EventCallable<number>;
68
+ pageSizeSet: EventCallable<number>;
69
+ itemAdded: EventCallable<TableRowType2>;
70
+ itemUpdated: EventCallable<TableRowType2>;
71
+ itemDeleted: EventCallable<string>;
72
+ $endpoint: StoreWritable<string>;
73
+ $tableActions: StoreWritable<DataTableActionType<any>[]>;
74
+ $isReady: StoreWritable<boolean>;
75
+ $items: StoreWritable<TableRowType2[]>;
76
+ $search: StoreWritable<string[]>;
77
+ $filters: StoreWritable<FilterItemType[]>;
78
+ $currentFilter: StoreWritable<FilterItemType[]>;
79
+ $searchQuery: StoreWritable<string>;
80
+ $isFetching: StoreWritable<boolean>;
81
+ $sort: StoreWritable<string>;
82
+ $order: StoreWritable<SortOrderType>;
83
+ $displayActionCol: StoreWritable<boolean>;
84
+ $displayIndex: StoreWritable<boolean>;
85
+ $local: StoreWritable<boolean>;
86
+ $structure: StoreWritable<DataTableColType<any>[]>;
87
+ $pageSize: StoreWritable<number>;
88
+ $page: StoreWritable<number>;
89
+ $count: StoreWritable<number>;
90
+ $requested: StoreWritable<boolean>;
91
+ $rowActions: StoreWritable<TableRowActionType<any>[]>;
92
+ $contextActions: StoreWritable<TableContextActionType<any>[]>;
93
+ fetchDataFx: Effect<FetchArgs, any>;
94
+ };
95
+ type DataTableFactory = (args: DataTableInitialValues) => DataTableCombinedStore;
96
+ export declare const createDataTable: DataTableFactory;
97
+ export {};
@@ -0,0 +1,22 @@
1
+ export type SortOrderType = 'asc' | 'desc';
2
+ export type apiMatchModeType = 'range' | 'date' | 'iexact' | 'exact' | 'icontains' | 'contains' | 'isnull' | 'in' | 'id' | 'gt' | 'lt' | 'gte' | 'lte' | 'interval';
3
+ export type FilterObjectItemType = {
4
+ type: 'string' | 'select' | 'period' | 'checkbox' | 'date_period';
5
+ matchMode?: apiMatchModeType;
6
+ is_numeric?: boolean;
7
+ value: any;
8
+ displayValue?: string;
9
+ label?: string;
10
+ };
11
+ export type GetListResponseType<T = any> = {
12
+ count: number;
13
+ previous: string | null;
14
+ next: string | null;
15
+ results: Array<T>;
16
+ };
17
+ export type DictType<T extends {
18
+ [key: string]: any;
19
+ } = Record<string, any>> = {
20
+ id: string;
21
+ name: string;
22
+ } & T;
@@ -0,0 +1,2 @@
1
+ import { DataTableCombinedStore } from './dataTableStoreFactory';
2
+ export declare const useDataTable: () => DataTableCombinedStore;
@@ -0,0 +1,13 @@
1
+ export type ActionListItemType = {
2
+ label: string;
3
+ value?: string;
4
+ onClick?: (item: ActionListItemType) => void;
5
+ };
6
+ type PropsType = {
7
+ minWidth?: string;
8
+ wrapperClassName?: string;
9
+ items: ActionListItemType[];
10
+ onButtonClick?: (item: ActionListItemType) => void;
11
+ };
12
+ export declare const ActionList: (props: PropsType) => import("react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -0,0 +1,54 @@
1
+ import { FilterItemType } from './FilterBar/FilterBar';
2
+ import { DataTableActionType } from './TableActionBar/DataTableActionBar';
3
+ import { MouseEvent, ReactNode } from 'react';
4
+ import { TableRowActionType } from './Table/Table';
5
+ import { SortOrderType } from '../model/types';
6
+ import { TableContextActionType } from './TableContextMenu';
7
+ export type TableRowType2<T = {
8
+ [key: string]: any;
9
+ }> = {
10
+ dt_selected?: boolean;
11
+ dt_hidden?: boolean;
12
+ dt_id?: string;
13
+ } & T;
14
+ export type DataTableColType<T extends TableRowType2> = {
15
+ id: string | keyof T;
16
+ label: string;
17
+ sort?: boolean;
18
+ getValue?: (row: T) => ReactNode | string;
19
+ getTitle?: () => ReactNode | string;
20
+ getSum?: (rows: T[]) => string | number;
21
+ is_numeric?: boolean;
22
+ displayActions?: boolean;
23
+ style?: Record<string, any>;
24
+ className?: string | ((row: T) => string);
25
+ };
26
+ export declare const mapDataTableResult: (result: TableRowType2[]) => TableRowType2[];
27
+ type PropsType<T extends TableRowType2> = {
28
+ local?: boolean;
29
+ endpoint?: string;
30
+ items?: T[];
31
+ uniqueKey?: keyof T | string;
32
+ filters?: FilterItemType<T>[];
33
+ structure?: DataTableColType<T>[];
34
+ tableActions?: DataTableActionType<T>[];
35
+ rowActions?: TableRowActionType<T>[];
36
+ contextActions?: TableContextActionType<T>[];
37
+ onActionClick?: (row: T, code: string) => void;
38
+ onContextMenu?: (e: MouseEvent<any>, row: T) => void;
39
+ onRowClick?: (e: MouseEvent, row: T) => void;
40
+ displayActionCol?: boolean;
41
+ displaySummary?: boolean;
42
+ displayIndex?: boolean;
43
+ sort?: keyof T;
44
+ order?: SortOrderType;
45
+ page?: number;
46
+ pageSize?: number;
47
+ emptyResult?: string | ReactNode;
48
+ getIsRowActive?: (row: T) => boolean;
49
+ getRowStyles?: (row: T) => any;
50
+ search?: Array<keyof T>;
51
+ rowClassName?: ((row: T) => string) | string;
52
+ };
53
+ export declare function DataTableInner<T extends TableRowType2>(props: PropsType<T>): import("react/jsx-runtime").JSX.Element | null;
54
+ export {};
@@ -0,0 +1,12 @@
1
+ import { DataTableColType } from './DataTable';
2
+ export declare const DataTableFilterSkeleton: () => import("react/jsx-runtime").JSX.Element;
3
+ type DTBodyPropsType = {
4
+ structure: DataTableColType<any>[];
5
+ pageSize: number;
6
+ useSelection?: boolean;
7
+ useIndexes?: boolean;
8
+ useActionCol?: boolean;
9
+ };
10
+ export declare const TableBodySkeleton: (props: DTBodyPropsType) => import("react/jsx-runtime").JSX.Element;
11
+ declare const _default: import('react').MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
12
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import { ActionListItemType } from '../ActionList/ActionList';
2
+ type TableActionsProps = {
3
+ actions: ActionListItemType[];
4
+ };
5
+ export declare const TableActions: (props: TableActionsProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,71 @@
1
+ import { apiMatchModeType } from '../../model/types';
2
+ import { TableRowType2 } from '../DataTable';
3
+ import { StringFilterType } from './FilterForm/FilterFormInput';
4
+ import { SelectFilterType } from './FilterForm/FilterFormSelect';
5
+ import { DateFilterType } from './FilterForm/FilterFormDate';
6
+ import { PeriodFilterType } from './FilterForm/FilterFormPeriod';
7
+ import { CheckboxFilterType } from './FilterForm/FilterFormCheckbox';
8
+ import { SearchFilterType } from './FilterForm/FilterFormSearch';
9
+ import { IntervalFilterType } from './FilterForm/FilterFormInterval';
10
+ type FilterValueType = {
11
+ value: any;
12
+ displayValue?: string;
13
+ matchMode: apiMatchModeType;
14
+ };
15
+ type FilterAND = {
16
+ [key: string]: FilterValueType;
17
+ };
18
+ type FilterOR = FilterAND;
19
+ type FilterSUB = {
20
+ sys_name: FilterValueType;
21
+ value: FilterValueType;
22
+ sub_values_list: string;
23
+ sub_app: string;
24
+ sub_model: string;
25
+ };
26
+ type AsyncFilterReturnType = {
27
+ and: FilterAND;
28
+ or: FilterOR;
29
+ sub: FilterSUB[];
30
+ };
31
+ export declare const makeAsyncFilter: (filters: FilterItemType[], searchFields?: string[], searchQuery?: string) => AsyncFilterReturnType | false;
32
+ export declare function applyFilters<T extends TableRowType2>(items: T[], filters: FilterItemType[], searchFields?: Array<keyof T>, query?: string): TableRowType2<T>[];
33
+ export interface ButtonFilterType<T extends TableRowType2 = TableRowType2> extends FilterType<T> {
34
+ type: 'button';
35
+ value: string | number;
36
+ getDisplayValue?: (item: ButtonFilterType, value: string) => string;
37
+ }
38
+ export type FilterItemType<T extends TableRowType2 = TableRowType2> = StringFilterType<T> | SelectFilterType<T> | DateFilterType<T> | PeriodFilterType<T> | CheckboxFilterType<T> | SearchFilterType<T> | ButtonFilterType<T> | IntervalFilterType<T>;
39
+ type LogicType = 'and' | 'sub';
40
+ export interface FilterType<T extends TableRowType2 = TableRowType2> {
41
+ code: keyof T | string;
42
+ compareKey?: string | keyof T;
43
+ label: string;
44
+ matchMode?: apiMatchModeType;
45
+ active?: boolean;
46
+ hidden?: boolean;
47
+ displayValue?: string;
48
+ logic?: LogicType;
49
+ getValid?: (row: T, f: FilterItemType) => boolean;
50
+ getDisplayValue?: (item: any, value: any) => string;
51
+ getCompareValue?: (row: T) => string;
52
+ type: 'string' | 'period' | 'checkbox' | 'search' | 'select' | 'filter' | 'date' | 'button' | 'interval';
53
+ subLogic?: {
54
+ sub_app: string;
55
+ sub_model: string;
56
+ sub_values_list: string;
57
+ };
58
+ }
59
+ export type FilterBarPropsType<T extends TableRowType2> = {
60
+ items: FilterItemType<T>[];
61
+ searchItems?: Array<keyof T>;
62
+ selected?: FilterItemType<T>[];
63
+ onSubmit?: (item: FilterItemType<any>, value: any, displayValue: string) => void;
64
+ onDelete?: (code: string) => void;
65
+ onSearch?: (value: string) => void;
66
+ onChange?: (filters: FilterItemType<any>[]) => void;
67
+ searchDelay?: number;
68
+ searchQuery?: string;
69
+ };
70
+ export declare function FilterBar<T extends TableRowType2>(props: FilterBarPropsType<T>): import("react/jsx-runtime").JSX.Element;
71
+ export default FilterBar;
@@ -0,0 +1,9 @@
1
+ import { FilterItemType } from '../FilterBar';
2
+ import { TableRowType2 } from '../../DataTable';
3
+ type PropsType<T extends TableRowType2> = {
4
+ filter: FilterItemType<T>;
5
+ onClose: () => void;
6
+ onSubmit: (value: any, displayValue: string) => void;
7
+ };
8
+ declare function FilterForm<T extends TableRowType2>(props: PropsType<T>): import("react/jsx-runtime").JSX.Element;
9
+ export default FilterForm;
@@ -0,0 +1,24 @@
1
+ import { FilterType } from '../FilterBar';
2
+ import { TableRowType2 } from '../../DataTable';
3
+ import { OptionType } from 'armtek-uikit-react/ui/Form/Select';
4
+ export interface CheckboxFilterType<T extends TableRowType2> extends FilterType<T> {
5
+ type: 'checkbox';
6
+ value?: string[];
7
+ options: OptionType[];
8
+ getValue?: (value: string) => any;
9
+ getDisplayValue?: (item: CheckboxFilterType<any>, value: string[]) => string;
10
+ multiple?: boolean;
11
+ async?: {
12
+ endpoint: string;
13
+ valueKey?: string;
14
+ labelKey?: string;
15
+ };
16
+ }
17
+ type PropsType = {
18
+ item: CheckboxFilterType<any>;
19
+ onChange: (value: string[], displayValue: string) => void;
20
+ value: string[];
21
+ options: OptionType[];
22
+ };
23
+ declare const CheckboxFilterContainer: (props: PropsType) => import("react/jsx-runtime").JSX.Element;
24
+ export default CheckboxFilterContainer;
@@ -0,0 +1,16 @@
1
+ import { FilterType } from '../FilterBar';
2
+ import { TableRowType2 } from '../../DataTable';
3
+ export interface DateFilterType<T extends TableRowType2> extends FilterType<T> {
4
+ type: 'date';
5
+ variant?: 'date' | 'datetime';
6
+ value?: Date | null;
7
+ getDisplayValue?: (item: DateFilterType<any>, date: Date) => string;
8
+ getValue?: (value: Date) => string;
9
+ }
10
+ type PropsType = {
11
+ item: DateFilterType<any>;
12
+ onChange: (value: Date, displayValue: string) => void;
13
+ value: Date;
14
+ };
15
+ declare const FilterFormDate: (props: PropsType) => import("react/jsx-runtime").JSX.Element;
16
+ export default FilterFormDate;
@@ -0,0 +1,10 @@
1
+ import { FilterItemType } from '../FilterBar';
2
+ type PropsType = {
3
+ item: FilterItemType<any>;
4
+ onChange: (value: any, displayValue: string) => void;
5
+ value: any;
6
+ error?: string;
7
+ clear?: boolean;
8
+ };
9
+ export declare const FilterFormField: (props: PropsType) => import("react/jsx-runtime").JSX.Element;
10
+ export default FilterFormField;