jb-grid 0.0.1 → 0.0.2
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/package.json +5 -2
- package/react/dist/{web-component/jb-grid/react/lib/Components → Components}/Cell.d.ts +10 -10
- package/react/dist/{web-component/jb-grid/react/lib/Components → Components}/ExpandRow.d.ts +11 -11
- package/react/dist/{web-component/jb-grid/react/lib/Components → Components}/JBLoading.d.ts +6 -6
- package/react/dist/{web-component/jb-grid/react/lib/Components → Components}/Row.d.ts +5 -5
- package/react/dist/{web-component/jb-grid/react/lib/Components → Components}/content-error/ContentError.d.ts +10 -10
- package/react/dist/{web-component/jb-grid/react/lib/Content.d.ts → Content.d.ts} +16 -16
- package/react/dist/{web-component/jb-grid/react/lib/Footer.d.ts → Footer.d.ts} +9 -9
- package/react/dist/{web-component/jb-grid/react/lib/Header.d.ts → Header.d.ts} +22 -22
- package/react/dist/JBGrid.cjs.js +2 -17989
- package/react/dist/JBGrid.cjs.js.map +1 -1
- package/react/dist/{web-component/jb-grid/react/lib/JBGrid.d.ts → JBGrid.d.ts} +25 -24
- package/react/dist/JBGrid.js +2 -17983
- package/react/dist/JBGrid.js.map +1 -1
- package/react/dist/JBGrid.umd.js +2 -17989
- package/react/dist/JBGrid.umd.js.map +1 -1
- package/react/dist/{web-component/jb-grid/react/lib/JBGridData.d.ts → JBGridData.d.ts} +16 -16
- package/react/dist/{web-component/jb-grid/react/lib/JBGridViewModel.d.ts → JBGridViewModel.d.ts} +70 -71
- package/react/dist/{web-component/jb-grid/react/lib/Types.d.ts → Types.d.ts} +124 -124
- package/react/dist/{web-component/jb-grid/react/lib/i18n.d.ts → i18n.d.ts} +2 -2
- package/react/lib/Content.tsx +1 -1
- package/react/lib/JBGrid.tsx +6 -6
- package/react/lib/JBGridData.ts +1 -1
- package/react/lib/JBGridViewModel.ts +2 -3
- package/react/lib/i18n.ts +1 -1
- package/react/lib/{Types.ts → types.ts} +1 -1
- package/react/package.json +1 -1
- package/react/tsconfig.json +3 -4
- package/react/dist/common/hooks/use-event.d.ts +0 -3
- package/react/dist/common/hooks/useLazyRef.d.ts +0 -4
- package/react/dist/common/hooks/useMobx.d.ts +0 -4
- package/react/dist/common/scripts/device-detection.d.ts +0 -1
- package/react/dist/common/scripts/persian-helper.d.ts +0 -3
- package/react/dist/web-component/jb-searchbar/types.d.ts +0 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { JBGridConfigStates, JBGridDataPage, JBGridTableConfig, JBGridCallbackConfig, JBGridDataConfig, JBGridConfigInterface, AnyObject } from './
|
|
2
|
-
declare class JBGridData<T extends AnyObject> implements JBGridConfigInterface<T> {
|
|
3
|
-
constructor();
|
|
4
|
-
table: JBGridTableConfig;
|
|
5
|
-
data: JBGridDataConfig<T>;
|
|
6
|
-
page: JBGridDataPage;
|
|
7
|
-
states: JBGridConfigStates;
|
|
8
|
-
callbacks: JBGridCallbackConfig<any>;
|
|
9
|
-
/**
|
|
10
|
-
* @deprecated provide it as a prop
|
|
11
|
-
*/
|
|
12
|
-
customComponents: {
|
|
13
|
-
headerEnd: any[];
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
export { JBGridData };
|
|
1
|
+
import { JBGridConfigStates, JBGridDataPage, JBGridTableConfig, JBGridCallbackConfig, JBGridDataConfig, JBGridConfigInterface, AnyObject } from './types.js';
|
|
2
|
+
declare class JBGridData<T extends AnyObject> implements JBGridConfigInterface<T> {
|
|
3
|
+
constructor();
|
|
4
|
+
table: JBGridTableConfig;
|
|
5
|
+
data: JBGridDataConfig<T>;
|
|
6
|
+
page: JBGridDataPage;
|
|
7
|
+
states: JBGridConfigStates;
|
|
8
|
+
callbacks: JBGridCallbackConfig<any>;
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated provide it as a prop
|
|
11
|
+
*/
|
|
12
|
+
customComponents: {
|
|
13
|
+
headerEnd: any[];
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export { JBGridData };
|
package/react/dist/{web-component/jb-grid/react/lib/JBGridViewModel.d.ts → JBGridViewModel.d.ts}
RENAMED
|
@@ -1,71 +1,70 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { AnyObject, JBGridBridgeClassInterface, JBGridBridgeInterface, JBGridCallbacks, JBGridColumnDef, JBGridConfig, JBGridConfigInterface, JBGridFilter, JBGridI18nConfig, JBGridResponseData, JBGridRowData, JBGridStyles, SearchbarConfig } from './
|
|
3
|
-
import { JBSearchbarWebComponent } from 'jb-searchbar';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
export
|
|
70
|
-
export declare const
|
|
71
|
-
export declare const useJBGridVM: () => JBGridViewModel<AnyObject>;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AnyObject, JBGridBridgeClassInterface, JBGridBridgeInterface, JBGridCallbacks, JBGridColumnDef, JBGridConfig, JBGridConfigInterface, JBGridFilter, JBGridI18nConfig, JBGridResponseData, JBGridRowData, JBGridStyles, SearchbarConfig } from './types.js';
|
|
3
|
+
import { JBSearchbarWebComponent, type JBSearchbarValue } from 'jb-searchbar';
|
|
4
|
+
declare class JBGridViewModel<T extends AnyObject> {
|
|
5
|
+
styles: JBGridStyles;
|
|
6
|
+
elements: {
|
|
7
|
+
refreshIcon: React.RefObject<SVGElement>;
|
|
8
|
+
searchbar: React.RefObject<JBSearchbarWebComponent>;
|
|
9
|
+
};
|
|
10
|
+
JBGridComponentDom: HTMLDivElement | null;
|
|
11
|
+
gridWrapperElement: HTMLElement | null;
|
|
12
|
+
isLoading: boolean;
|
|
13
|
+
dataBridge: JBGridBridgeInterface;
|
|
14
|
+
paginationDebounce: any;
|
|
15
|
+
isErrorOccurred: boolean;
|
|
16
|
+
filter: JBGridFilter;
|
|
17
|
+
callBacks: JBGridCallbacks;
|
|
18
|
+
config: JBGridConfig<T>;
|
|
19
|
+
i18n: JBGridI18nConfig;
|
|
20
|
+
constructor(onFullscreenChange: (isFullScreen: boolean) => void, config: JBGridConfigInterface<T>, bridge: JBGridBridgeClassInterface);
|
|
21
|
+
setI18n(newValue: JBGridI18nConfig): void;
|
|
22
|
+
InitGrid(): void;
|
|
23
|
+
onComponentDidMount(searchbarConfig: SearchbarConfig | null): void;
|
|
24
|
+
mergeObject(inputConfig: JBGridConfig<any>, defaultConfig: JBGridConfig<any>): JBGridConfig<any>;
|
|
25
|
+
sendFirstRequest(): void;
|
|
26
|
+
initFilter(searchbarConfig: SearchbarConfig | null): void;
|
|
27
|
+
InitSize(): void;
|
|
28
|
+
getScrollbarWidth(): number;
|
|
29
|
+
fetchGridData(): Promise<unknown>;
|
|
30
|
+
onFetchSuccess(data: JBGridResponseData<T>): void;
|
|
31
|
+
standardData(data: AnyObject[]): Promise<JBGridRowData<T>[]>;
|
|
32
|
+
CreateRequestBody(): any;
|
|
33
|
+
goToNextPage(): void;
|
|
34
|
+
goToPrevPage(): void;
|
|
35
|
+
goToLastPage(): void;
|
|
36
|
+
goToFirstPage(): void;
|
|
37
|
+
refreshBtnClick(): void;
|
|
38
|
+
playRefreshBtnAnimation(): Animation;
|
|
39
|
+
stopRefreshBtnAnimation(anime: Animation): void;
|
|
40
|
+
goToPage(destinationPageIndex: number): Promise<unknown>;
|
|
41
|
+
debounce(func: (...args: any[]) => any, delay: number): (...inputs: any[]) => Promise<unknown>;
|
|
42
|
+
refreshData(): Promise<void>;
|
|
43
|
+
onSearch(filterList: JBSearchbarValue): Promise<unknown>;
|
|
44
|
+
onPageSizeChange(e: any): void;
|
|
45
|
+
onFullScreenBtnClicked(currentValue: boolean): void;
|
|
46
|
+
onFullscreenChanged(newValue: boolean): void;
|
|
47
|
+
fullScreenGrid(): void;
|
|
48
|
+
exitFullScreenGrid(): void;
|
|
49
|
+
setSortColumn(column: JBGridColumnDef): void;
|
|
50
|
+
changePageNumberToInput(): void;
|
|
51
|
+
openSearchHeaderSection(): void;
|
|
52
|
+
openMainHeaderSection(): void;
|
|
53
|
+
showErrorPanel(): void;
|
|
54
|
+
hideErrorPanel(): void;
|
|
55
|
+
get paginationDisplayNumbers(): {
|
|
56
|
+
currentPage: string | number;
|
|
57
|
+
nextPage: string | number;
|
|
58
|
+
next2Page: string | number;
|
|
59
|
+
prevPage: string | number;
|
|
60
|
+
prev2Page: string | number;
|
|
61
|
+
totalItemsCount: string | number;
|
|
62
|
+
startItemIndex: string | number;
|
|
63
|
+
endItemIndex: string | number;
|
|
64
|
+
pageSizes: (string | number)[];
|
|
65
|
+
};
|
|
66
|
+
toPersianNumber(input: string | number): string | number;
|
|
67
|
+
}
|
|
68
|
+
export default JBGridViewModel;
|
|
69
|
+
export declare const JBGridContext: React.Context<JBGridViewModel<AnyObject>>;
|
|
70
|
+
export declare const useJBGridVM: () => JBGridViewModel<AnyObject>;
|
|
@@ -1,124 +1,124 @@
|
|
|
1
|
-
import { FilterColumn, JBSearchbarValue } from "jb-searchbar
|
|
2
|
-
export type JBGridRowDataDetail = {
|
|
3
|
-
isDeleting: boolean;
|
|
4
|
-
isDeleted: boolean;
|
|
5
|
-
isRecovering: boolean;
|
|
6
|
-
isExpanded: boolean;
|
|
7
|
-
};
|
|
8
|
-
export type JBGridRowDetail = {
|
|
9
|
-
jbGridDetail: JBGridRowDataDetail;
|
|
10
|
-
};
|
|
11
|
-
export type AnyObject = {
|
|
12
|
-
[key: string]: any;
|
|
13
|
-
};
|
|
14
|
-
export type JBGridStyles = {
|
|
15
|
-
table: {
|
|
16
|
-
generalCols: {
|
|
17
|
-
gridTemplateColumns: string;
|
|
18
|
-
};
|
|
19
|
-
fullWidthCol: {
|
|
20
|
-
gridColumn: string;
|
|
21
|
-
};
|
|
22
|
-
scrollIndent: {
|
|
23
|
-
width: string;
|
|
24
|
-
};
|
|
25
|
-
mainRowStyle: {
|
|
26
|
-
gridTemplateColumns: string;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
searchBar: any;
|
|
30
|
-
contentWrapper: any;
|
|
31
|
-
};
|
|
32
|
-
export type JBGridRowData<T extends AnyObject> = T & JBGridRowDetail;
|
|
33
|
-
export type JBGridResponseData<T extends AnyObject> = {
|
|
34
|
-
pageIndex: number;
|
|
35
|
-
startItemIndex: number;
|
|
36
|
-
endItemIndex: number;
|
|
37
|
-
totalItemsCount: number;
|
|
38
|
-
totalPages: number;
|
|
39
|
-
content: JBGridRowData<T>[];
|
|
40
|
-
};
|
|
41
|
-
export type JBGridFilter = {
|
|
42
|
-
config: SearchbarConfig | null;
|
|
43
|
-
value: JBSearchbarValue;
|
|
44
|
-
};
|
|
45
|
-
export type SearchbarConfig = {
|
|
46
|
-
columnList: FilterColumn[];
|
|
47
|
-
searchOnChange: boolean;
|
|
48
|
-
};
|
|
49
|
-
export interface JBGridBridgeInterface {
|
|
50
|
-
mapServerResponseDataToGridData: (data: any) => JBGridResponseData<any>;
|
|
51
|
-
getData: (data: JBGridConfigRequestParams, requestBody: any) => Promise<any>;
|
|
52
|
-
createRequestBody: (page: JBGridDataPage, filter?: JBSearchbarValue, sortColumn?: JBGridColumnDef | null, requestConfig?: JBGridConfigRequestParams) => any;
|
|
53
|
-
}
|
|
54
|
-
type ClassBuilder<I, Args extends any[] = any[]> = new (...args: Args) => I;
|
|
55
|
-
export type JBGridBridgeClassInterface = ClassBuilder<JBGridBridgeInterface, []>;
|
|
56
|
-
export type JBGridDataPage = {
|
|
57
|
-
index: number;
|
|
58
|
-
size: number;
|
|
59
|
-
totalPages: number;
|
|
60
|
-
};
|
|
61
|
-
export type JBGridColumnDef = {
|
|
62
|
-
width?: string | number;
|
|
63
|
-
sort?: "ASC" | "DESC" | undefined;
|
|
64
|
-
sortable?: boolean;
|
|
65
|
-
id: number;
|
|
66
|
-
title: string;
|
|
67
|
-
name: string;
|
|
68
|
-
};
|
|
69
|
-
export type JBGridConfigRequestParams = {
|
|
70
|
-
method?: "POST" | "GET";
|
|
71
|
-
url?: string;
|
|
72
|
-
[key: string]: any;
|
|
73
|
-
};
|
|
74
|
-
export type JBGridDataConfig<T extends AnyObject> = {
|
|
75
|
-
data: JBGridRowData<T>[];
|
|
76
|
-
requestParams: JBGridConfigRequestParams;
|
|
77
|
-
metaData: {
|
|
78
|
-
startItemIndex: number;
|
|
79
|
-
endItemIndex: number;
|
|
80
|
-
totalItemsCount: number;
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
export type JBGridTableConfig = {
|
|
84
|
-
columns: JBGridColumnDef[];
|
|
85
|
-
};
|
|
86
|
-
export type JBGridConfigStates = {
|
|
87
|
-
headerSection: 'MAIN' | "SEARCH";
|
|
88
|
-
isFullScreen: boolean;
|
|
89
|
-
};
|
|
90
|
-
export type JBGridCallbackConfig<T extends AnyObject> = {
|
|
91
|
-
onDataStandardizing: ((data: JBGridRowData<AnyObject>[]) => JBGridRowData<T>[]) | (<T extends AnyObject>(data: JBGridRowData<AnyObject>[]) => Promise<JBGridRowData<T>[]>) | null | undefined;
|
|
92
|
-
onPageIndexChange: ((newPageIndex: number) => unknown) | null | undefined;
|
|
93
|
-
};
|
|
94
|
-
export type JBGridI18nMessage = {
|
|
95
|
-
serverErrorText?: string;
|
|
96
|
-
serverErrorTitle?: string;
|
|
97
|
-
serverErrorRefreshButtonTitle?: string;
|
|
98
|
-
EnterPageNumberMessage?: string;
|
|
99
|
-
currentAvailableItem?: string;
|
|
100
|
-
pageItemCount?: string;
|
|
101
|
-
from?: string;
|
|
102
|
-
};
|
|
103
|
-
export type JBGridI18nConfig = {
|
|
104
|
-
messages?: JBGridI18nMessage;
|
|
105
|
-
showPersianNumber?: boolean;
|
|
106
|
-
};
|
|
107
|
-
export type ActionDispatchers = Readonly<{
|
|
108
|
-
refreshData: () => Promise<void>;
|
|
109
|
-
fullScreenGrid: () => void;
|
|
110
|
-
exitFullScreenGrid: () => void;
|
|
111
|
-
}>;
|
|
112
|
-
export interface JBGridConfigInterface<T extends AnyObject> {
|
|
113
|
-
table: JBGridTableConfig;
|
|
114
|
-
data: JBGridDataConfig<T>;
|
|
115
|
-
page: JBGridDataPage;
|
|
116
|
-
callbacks: JBGridCallbackConfig<T>;
|
|
117
|
-
actionDispatchers?: ActionDispatchers;
|
|
118
|
-
states: JBGridConfigStates;
|
|
119
|
-
}
|
|
120
|
-
export type JBGridConfig<T extends AnyObject> = JBGridConfigInterface<T>;
|
|
121
|
-
export type JBGridCallbacks = {
|
|
122
|
-
onFullscreenChange: (isFullscreen: boolean) => void;
|
|
123
|
-
};
|
|
124
|
-
export {};
|
|
1
|
+
import { FilterColumn, JBSearchbarValue } from "jb-searchbar";
|
|
2
|
+
export type JBGridRowDataDetail = {
|
|
3
|
+
isDeleting: boolean;
|
|
4
|
+
isDeleted: boolean;
|
|
5
|
+
isRecovering: boolean;
|
|
6
|
+
isExpanded: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type JBGridRowDetail = {
|
|
9
|
+
jbGridDetail: JBGridRowDataDetail;
|
|
10
|
+
};
|
|
11
|
+
export type AnyObject = {
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
};
|
|
14
|
+
export type JBGridStyles = {
|
|
15
|
+
table: {
|
|
16
|
+
generalCols: {
|
|
17
|
+
gridTemplateColumns: string;
|
|
18
|
+
};
|
|
19
|
+
fullWidthCol: {
|
|
20
|
+
gridColumn: string;
|
|
21
|
+
};
|
|
22
|
+
scrollIndent: {
|
|
23
|
+
width: string;
|
|
24
|
+
};
|
|
25
|
+
mainRowStyle: {
|
|
26
|
+
gridTemplateColumns: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
searchBar: any;
|
|
30
|
+
contentWrapper: any;
|
|
31
|
+
};
|
|
32
|
+
export type JBGridRowData<T extends AnyObject> = T & JBGridRowDetail;
|
|
33
|
+
export type JBGridResponseData<T extends AnyObject> = {
|
|
34
|
+
pageIndex: number;
|
|
35
|
+
startItemIndex: number;
|
|
36
|
+
endItemIndex: number;
|
|
37
|
+
totalItemsCount: number;
|
|
38
|
+
totalPages: number;
|
|
39
|
+
content: JBGridRowData<T>[];
|
|
40
|
+
};
|
|
41
|
+
export type JBGridFilter = {
|
|
42
|
+
config: SearchbarConfig | null;
|
|
43
|
+
value: JBSearchbarValue;
|
|
44
|
+
};
|
|
45
|
+
export type SearchbarConfig = {
|
|
46
|
+
columnList: FilterColumn[];
|
|
47
|
+
searchOnChange: boolean;
|
|
48
|
+
};
|
|
49
|
+
export interface JBGridBridgeInterface {
|
|
50
|
+
mapServerResponseDataToGridData: (data: any) => JBGridResponseData<any>;
|
|
51
|
+
getData: (data: JBGridConfigRequestParams, requestBody: any) => Promise<any>;
|
|
52
|
+
createRequestBody: (page: JBGridDataPage, filter?: JBSearchbarValue, sortColumn?: JBGridColumnDef | null, requestConfig?: JBGridConfigRequestParams) => any;
|
|
53
|
+
}
|
|
54
|
+
type ClassBuilder<I, Args extends any[] = any[]> = new (...args: Args) => I;
|
|
55
|
+
export type JBGridBridgeClassInterface = ClassBuilder<JBGridBridgeInterface, []>;
|
|
56
|
+
export type JBGridDataPage = {
|
|
57
|
+
index: number;
|
|
58
|
+
size: number;
|
|
59
|
+
totalPages: number;
|
|
60
|
+
};
|
|
61
|
+
export type JBGridColumnDef = {
|
|
62
|
+
width?: string | number;
|
|
63
|
+
sort?: "ASC" | "DESC" | undefined;
|
|
64
|
+
sortable?: boolean;
|
|
65
|
+
id: number;
|
|
66
|
+
title: string;
|
|
67
|
+
name: string;
|
|
68
|
+
};
|
|
69
|
+
export type JBGridConfigRequestParams = {
|
|
70
|
+
method?: "POST" | "GET";
|
|
71
|
+
url?: string;
|
|
72
|
+
[key: string]: any;
|
|
73
|
+
};
|
|
74
|
+
export type JBGridDataConfig<T extends AnyObject> = {
|
|
75
|
+
data: JBGridRowData<T>[];
|
|
76
|
+
requestParams: JBGridConfigRequestParams;
|
|
77
|
+
metaData: {
|
|
78
|
+
startItemIndex: number;
|
|
79
|
+
endItemIndex: number;
|
|
80
|
+
totalItemsCount: number;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
export type JBGridTableConfig = {
|
|
84
|
+
columns: JBGridColumnDef[];
|
|
85
|
+
};
|
|
86
|
+
export type JBGridConfigStates = {
|
|
87
|
+
headerSection: 'MAIN' | "SEARCH";
|
|
88
|
+
isFullScreen: boolean;
|
|
89
|
+
};
|
|
90
|
+
export type JBGridCallbackConfig<T extends AnyObject> = {
|
|
91
|
+
onDataStandardizing: ((data: JBGridRowData<AnyObject>[]) => JBGridRowData<T>[]) | (<T extends AnyObject>(data: JBGridRowData<AnyObject>[]) => Promise<JBGridRowData<T>[]>) | null | undefined;
|
|
92
|
+
onPageIndexChange: ((newPageIndex: number) => unknown) | null | undefined;
|
|
93
|
+
};
|
|
94
|
+
export type JBGridI18nMessage = {
|
|
95
|
+
serverErrorText?: string;
|
|
96
|
+
serverErrorTitle?: string;
|
|
97
|
+
serverErrorRefreshButtonTitle?: string;
|
|
98
|
+
EnterPageNumberMessage?: string;
|
|
99
|
+
currentAvailableItem?: string;
|
|
100
|
+
pageItemCount?: string;
|
|
101
|
+
from?: string;
|
|
102
|
+
};
|
|
103
|
+
export type JBGridI18nConfig = {
|
|
104
|
+
messages?: JBGridI18nMessage;
|
|
105
|
+
showPersianNumber?: boolean;
|
|
106
|
+
};
|
|
107
|
+
export type ActionDispatchers = Readonly<{
|
|
108
|
+
refreshData: () => Promise<void>;
|
|
109
|
+
fullScreenGrid: () => void;
|
|
110
|
+
exitFullScreenGrid: () => void;
|
|
111
|
+
}>;
|
|
112
|
+
export interface JBGridConfigInterface<T extends AnyObject> {
|
|
113
|
+
table: JBGridTableConfig;
|
|
114
|
+
data: JBGridDataConfig<T>;
|
|
115
|
+
page: JBGridDataPage;
|
|
116
|
+
callbacks: JBGridCallbackConfig<T>;
|
|
117
|
+
actionDispatchers?: ActionDispatchers;
|
|
118
|
+
states: JBGridConfigStates;
|
|
119
|
+
}
|
|
120
|
+
export type JBGridConfig<T extends AnyObject> = JBGridConfigInterface<T>;
|
|
121
|
+
export type JBGridCallbacks = {
|
|
122
|
+
onFullscreenChange: (isFullscreen: boolean) => void;
|
|
123
|
+
};
|
|
124
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { JBGridI18nConfig } from "./
|
|
2
|
-
export declare const defaultI18n: JBGridI18nConfig;
|
|
1
|
+
import { JBGridI18nConfig } from "./types.js";
|
|
2
|
+
export declare const defaultI18n: JBGridI18nConfig;
|
package/react/lib/Content.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { observer } from 'mobx-react';
|
|
2
2
|
import React, { ReactNode } from 'react';
|
|
3
3
|
import JBLoading from './Components/JBLoading.js';
|
|
4
|
-
import { JBGridColumnDef, JBGridConfig, JBGridI18nConfig, JBGridStyles } from './
|
|
4
|
+
import { JBGridColumnDef, JBGridConfig, JBGridI18nConfig, JBGridStyles } from './types.js';
|
|
5
5
|
import ContentError from './Components/content-error/ContentError.js';
|
|
6
6
|
export type ContentProps = {
|
|
7
7
|
children:React.ReactNode | React.ReactNode[],
|
package/react/lib/JBGrid.tsx
CHANGED
|
@@ -4,16 +4,16 @@ import { observer } from 'mobx-react';
|
|
|
4
4
|
import './JBGrid.scss';
|
|
5
5
|
export { JBGridData } from './JBGridData.js';
|
|
6
6
|
import 'jb-searchbar';
|
|
7
|
-
import { AnyObject, JBGridBridgeClassInterface, JBGridConfig, JBGridI18nConfig, SearchbarConfig } from './
|
|
7
|
+
import { AnyObject, JBGridBridgeClassInterface, JBGridConfig, JBGridI18nConfig, SearchbarConfig } from './types.js';
|
|
8
8
|
import Footer from './Footer.js';
|
|
9
9
|
import Header from './Header.js';
|
|
10
10
|
import Content from './Content.js';
|
|
11
|
-
import {
|
|
11
|
+
import { useInstance } from 'jb-core/react';
|
|
12
12
|
export { Row } from './Components/Row.js';
|
|
13
13
|
export { Cell } from './Components/Cell.js';
|
|
14
14
|
export { ExpandRow } from './Components/ExpandRow.js';
|
|
15
|
-
|
|
16
|
-
export type
|
|
15
|
+
export * from './types.js';
|
|
16
|
+
export type Props<T extends AnyObject> = {
|
|
17
17
|
searchbarConfig?: SearchbarConfig | null | undefined,
|
|
18
18
|
config: JBGridConfig<T>,
|
|
19
19
|
bridge: JBGridBridgeClassInterface,
|
|
@@ -28,8 +28,8 @@ export type JBGridProps<T extends AnyObject> = {
|
|
|
28
28
|
children?: React.ReactNode | React.ReactNode[]
|
|
29
29
|
|
|
30
30
|
}
|
|
31
|
-
function JBGridComponent<T extends AnyObject>(props:
|
|
32
|
-
const vm =
|
|
31
|
+
function JBGridComponent<T extends AnyObject>(props: Props<T>) {
|
|
32
|
+
const vm = useInstance(JBGridViewModel<AnyObject>, [props.onFullscreenChange, props.config, props.bridge]);
|
|
33
33
|
useEffect(() => {
|
|
34
34
|
vm.onComponentDidMount(props.searchbarConfig || null);
|
|
35
35
|
}, []);
|
package/react/lib/JBGridData.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { makeObservable, observable } from 'mobx';
|
|
2
|
-
import { JBGridConfigStates, JBGridDataPage, JBGridTableConfig,JBGridCallbackConfig, JBGridI18nConfig, JBGridDataConfig, JBGridConfigInterface, AnyObject } from './
|
|
2
|
+
import { JBGridConfigStates, JBGridDataPage, JBGridTableConfig,JBGridCallbackConfig, JBGridI18nConfig, JBGridDataConfig, JBGridConfigInterface, AnyObject } from './types.js';
|
|
3
3
|
|
|
4
4
|
class JBGridData<T extends AnyObject> implements JBGridConfigInterface<T> {
|
|
5
5
|
constructor(){
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React, { createContext, useContext } from 'react';
|
|
2
2
|
import { observable, extendObservable, makeObservable, action, computed } from 'mobx';
|
|
3
|
-
import { ActionDispatchers, AnyObject, JBGridBridgeClassInterface, JBGridBridgeInterface, JBGridCallbacks, JBGridColumnDef, JBGridConfig, JBGridConfigInterface, JBGridFilter, JBGridI18nConfig, JBGridResponseData, JBGridRowData, JBGridRowDetail, JBGridStyles, SearchbarConfig } from './
|
|
4
|
-
import { JBSearchbarWebComponent } from 'jb-searchbar';
|
|
3
|
+
import { ActionDispatchers, AnyObject, JBGridBridgeClassInterface, JBGridBridgeInterface, JBGridCallbacks, JBGridColumnDef, JBGridConfig, JBGridConfigInterface, JBGridFilter, JBGridI18nConfig, JBGridResponseData, JBGridRowData, JBGridRowDetail, JBGridStyles, SearchbarConfig } from './types.js';
|
|
4
|
+
import { JBSearchbarWebComponent, type JBSearchbarValue } from 'jb-searchbar';
|
|
5
5
|
import { defaultI18n } from './i18n.js';
|
|
6
|
-
import { JBSearchbarValue } from 'jb-searchbar/types.js';
|
|
7
6
|
import { assign } from 'lodash';
|
|
8
7
|
class JBGridViewModel<T extends AnyObject> {
|
|
9
8
|
//we write computed style of grid here
|
package/react/lib/i18n.ts
CHANGED
package/react/package.json
CHANGED
package/react/tsconfig.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"baseUrl": ".",
|
|
4
|
+
"rootDir": "./lib",
|
|
5
|
+
"declarationDir": "./dist"
|
|
4
6
|
},
|
|
5
7
|
"include": [
|
|
6
|
-
"../../../common/scripts/**/*.ts",
|
|
7
|
-
"../../../common/hooks/**/*.ts",
|
|
8
|
-
"../../../common/hooks/**/*.js",
|
|
9
8
|
"lib/**/*.ts",
|
|
10
9
|
"lib/**/*.tsx"
|
|
11
10
|
],
|
|
@@ -14,5 +13,5 @@
|
|
|
14
13
|
"**/*.spec.ts",
|
|
15
14
|
"dist",
|
|
16
15
|
],
|
|
17
|
-
"extends":"
|
|
16
|
+
"extends":"jb-core/configs/tsconfig-react.json"
|
|
18
17
|
}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" resolution-mode="require"/>
|
|
2
|
-
export declare function useEvent(dom: HTMLElement, event: any, handler: any, passive?: boolean): void;
|
|
3
|
-
export declare function useBindEvent<TRef extends React.MutableRefObject<any | null>, TEvent>(ref: TRef, event: string, handler: (e: TEvent) => void, passive?: boolean): void;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const isMobile: () => boolean;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './dist/web-component/jb-searchbar/lib/types.js';
|