jb-grid 0.4.0 → 0.5.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 +138 -11
- package/package.json +5 -8
- package/react/README.md +207 -202
- package/react/dist/Components/module-declaration.d.ts +1 -1
- package/react/dist/Content.d.ts +1 -2
- package/react/dist/Footer.d.ts +1 -2
- package/react/dist/Header.d.ts +3 -16
- package/react/dist/JBGrid.cjs.js +3631 -1
- package/react/dist/JBGrid.cjs.js.map +1 -1
- package/react/dist/JBGrid.d.ts +288 -26
- package/react/dist/JBGrid.js +3624 -1
- package/react/dist/JBGrid.js.map +1 -1
- package/react/dist/JBGrid.umd.js +3641 -1
- package/react/dist/JBGrid.umd.js.map +1 -1
- package/react/dist/JBGridData.d.ts +1 -5
- package/react/dist/JBGridViewModel.d.ts +28 -25
- package/react/dist/types.d.ts +17 -49
- package/react/lib/Components/Cell.tsx +17 -15
- package/react/lib/Components/ColumnHeader.tsx +44 -0
- package/react/lib/Components/ExpandToggle.tsx +14 -10
- package/react/lib/Components/FullscreenIcon.tsx +28 -0
- package/react/lib/Components/JBLoading.tsx +5 -4
- package/react/lib/Components/Pagination.tsx +1 -1
- package/react/lib/Components/PaginationInfo.tsx +71 -0
- package/react/lib/Components/RefreshIcon.tsx +11 -0
- package/react/lib/Components/Row.tsx +17 -15
- package/react/lib/Components/TableHeader.tsx +21 -0
- package/react/lib/Components/blob-loading.css +27 -23
- package/react/lib/Components/cell.css +7 -7
- package/react/lib/Components/content-error/ContentError.tsx +19 -16
- package/react/lib/Components/content-error/content-error.css +5 -11
- package/react/lib/Components/module-declaration.ts +61 -13
- package/react/lib/Content.tsx +23 -47
- package/react/lib/Footer.tsx +52 -79
- package/react/lib/Header.tsx +11 -24
- package/react/lib/JBGrid.tsx +129 -70
- package/react/lib/JBGridViewModel.ts +189 -452
- package/react/lib/footer.css +25 -55
- package/react/lib/header.css +20 -20
- package/react/lib/jb-grid.css +69 -55
- package/react/lib/types.ts +32 -129
- package/react/lib/variables.css +6 -0
- package/react/package.json +14 -10
- package/react/tsconfig.json +5 -4
- package/web-component/dist/index.cjs.js +559 -1
- package/web-component/dist/index.cjs.js.br +0 -0
- package/web-component/dist/index.cjs.js.gz +0 -0
- package/web-component/dist/index.cjs.js.map +1 -1
- package/web-component/dist/index.d.ts +161 -4
- package/web-component/dist/index.d.ts.map +1 -1
- package/web-component/dist/index.js +561 -1
- package/web-component/dist/index.js.br +0 -0
- package/web-component/dist/index.js.gz +0 -0
- package/web-component/dist/index.js.map +1 -1
- package/web-component/dist/index.umd.js +567 -1
- package/web-component/dist/index.umd.js.br +0 -0
- package/web-component/dist/index.umd.js.gz +0 -0
- package/web-component/dist/index.umd.js.map +1 -1
- package/web-component/dist/row/row.d.ts.map +1 -1
- package/web-component/dist/row/types.d.ts +3 -5
- package/web-component/dist/row/types.d.ts.map +1 -1
- package/web-component/dist/row/utils.d.ts +1 -2
- package/web-component/dist/row/utils.d.ts.map +1 -1
- package/web-component/dist/table-header/render.d.ts +2 -0
- package/web-component/dist/table-header/render.d.ts.map +1 -0
- package/web-component/dist/table-header/table-header.d.ts +9 -0
- package/web-component/dist/table-header/table-header.d.ts.map +1 -0
- package/web-component/dist/table-header/types.d.ts +4 -0
- package/web-component/dist/table-header/types.d.ts.map +1 -0
- package/web-component/dist/types.d.ts +6 -0
- package/web-component/dist/types.d.ts.map +1 -0
- package/web-component/dist/utils.d.ts +8 -0
- package/web-component/dist/utils.d.ts.map +1 -0
- package/web-component/lib/cell/cell.ts +10 -5
- package/web-component/lib/cell/style.css +2 -1
- package/web-component/lib/column-header/column-header.ts +117 -0
- package/web-component/lib/column-header/render.ts +14 -0
- package/web-component/lib/column-header/style.css +60 -0
- package/web-component/lib/column-header/types.ts +10 -0
- package/web-component/lib/fullscreen-icon/fullscreen-icon.ts +72 -0
- package/web-component/lib/fullscreen-icon/render.ts +23 -0
- package/web-component/lib/fullscreen-icon/style.css +44 -0
- package/web-component/lib/fullscreen-icon/types.ts +1 -0
- package/web-component/lib/i18n.ts +38 -0
- package/web-component/lib/index.ts +9 -4
- package/web-component/lib/pagination/README.md +4 -0
- package/web-component/lib/pagination/pagination.ts +25 -15
- package/web-component/lib/pagination/render.ts +13 -10
- package/web-component/lib/pagination/style.css +43 -31
- package/web-component/lib/pagination/types.ts +1 -1
- package/web-component/lib/pagination/variables.css +10 -0
- package/web-component/lib/pagination-info/pagination-info.ts +191 -0
- package/web-component/lib/pagination-info/render.ts +16 -0
- package/web-component/lib/pagination-info/style.css +47 -0
- package/web-component/lib/pagination-info/types.ts +12 -0
- package/web-component/lib/refresh-icon/refresh-icon.ts +79 -0
- package/web-component/lib/refresh-icon/render.ts +10 -0
- package/web-component/lib/refresh-icon/style.css +21 -0
- package/web-component/lib/row/render.ts +3 -3
- package/web-component/lib/row/row.ts +29 -15
- package/web-component/lib/row/style.css +30 -30
- package/web-component/lib/row/types.ts +7 -8
- package/web-component/lib/row/utils.ts +1 -40
- package/web-component/lib/row/variables.css +13 -0
- package/web-component/lib/table-header/render.ts +9 -0
- package/web-component/lib/table-header/style.css +29 -0
- package/web-component/lib/table-header/table-header.ts +50 -0
- package/web-component/lib/table-header/types.ts +4 -0
- package/web-component/lib/toggle/expand-toggle.ts +17 -13
- package/web-component/lib/toggle/render.ts +18 -13
- package/web-component/lib/toggle/style.css +18 -5
- package/web-component/lib/types.ts +6 -0
- package/web-component/lib/utils.ts +46 -0
- package/react/lib/JBGridBridgeExample.js +0 -90
- package/react/lib/JBGridData.ts +0 -51
- package/react/lib/global.d.ts +0 -15
- package/web-component/lib/global.d.ts +0 -15
- package/web-component/tsconfig.json +0 -17
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import { JBGridConfigStates,
|
|
1
|
+
import { JBGridConfigStates, JBGridTableConfig, JBGridConfigInterface, AnyObject } from './types.js';
|
|
2
2
|
declare class JBGridData<T extends AnyObject> implements JBGridConfigInterface<T> {
|
|
3
|
-
constructor();
|
|
4
3
|
table: JBGridTableConfig;
|
|
5
|
-
data: JBGridDataConfig<T>;
|
|
6
|
-
page: JBGridDataPage;
|
|
7
4
|
states: JBGridConfigStates;
|
|
8
|
-
callbacks: JBGridCallbackConfig<any>;
|
|
9
5
|
/**
|
|
10
6
|
* @deprecated provide it as a prop
|
|
11
7
|
*/
|
|
@@ -1,44 +1,48 @@
|
|
|
1
1
|
import React, { type RefObject } from 'react';
|
|
2
|
-
import type { AnyObject,
|
|
3
|
-
|
|
2
|
+
import type { AnyObject, JBGridCallbacks, JBGridColumnDef, JBGridConfig, JBGridI18nConfig, JBGridPaginationMeta, JBGridRowData, JBGridStyles } from './types.js';
|
|
3
|
+
type StateChangeCallback = (() => void) | undefined;
|
|
4
|
+
export type JBGridState<T extends AnyObject> = {
|
|
5
|
+
config: JBGridConfig<T>;
|
|
6
|
+
data: JBGridRowData<T>[];
|
|
7
|
+
pageIndex: number;
|
|
8
|
+
pageSize: number;
|
|
9
|
+
totalPages: number;
|
|
10
|
+
metaData: JBGridPaginationMeta;
|
|
11
|
+
};
|
|
4
12
|
declare class JBGridViewModel<T extends AnyObject> {
|
|
13
|
+
#private;
|
|
5
14
|
styles: JBGridStyles;
|
|
6
15
|
elements: {
|
|
7
16
|
refreshIcon: React.RefObject<SVGElement | null>;
|
|
8
|
-
searchbar: React.RefObject<JBSearchbarWebComponent | null>;
|
|
9
17
|
};
|
|
10
18
|
JBGridComponentDom: RefObject<HTMLDivElement | null>;
|
|
11
19
|
gridWrapperElement: HTMLElement | null;
|
|
12
|
-
isLoading: boolean;
|
|
13
|
-
dataBridge: JBGridBridgeInterface;
|
|
14
|
-
paginationDebounce: any;
|
|
15
|
-
isErrorOccurred: boolean;
|
|
16
|
-
filter: JBGridFilter;
|
|
17
20
|
callBacks: JBGridCallbacks;
|
|
18
21
|
config: JBGridConfig<T>;
|
|
22
|
+
data: JBGridRowData<T>[];
|
|
23
|
+
page: {
|
|
24
|
+
index: number;
|
|
25
|
+
size: number;
|
|
26
|
+
totalPages: number;
|
|
27
|
+
};
|
|
28
|
+
metaData: JBGridPaginationMeta;
|
|
19
29
|
i18n: JBGridI18nConfig;
|
|
20
|
-
constructor(
|
|
21
|
-
|
|
30
|
+
constructor(callBacks: JBGridCallbacks | undefined, config: JBGridConfig<T>, onStateChange?: () => void);
|
|
31
|
+
bindMethods(): void;
|
|
32
|
+
setStateChangeCallback(callback: StateChangeCallback): void;
|
|
33
|
+
setCallbacks(callBacks: JBGridCallbacks | undefined): void;
|
|
34
|
+
setGridState(state: JBGridState<T>): void;
|
|
35
|
+
notifyStateChange(): void;
|
|
36
|
+
setI18n(newValue: JBGridI18nConfig, notifyStateChange?: boolean): void;
|
|
22
37
|
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
38
|
InitSize(): void;
|
|
28
39
|
getScrollbarWidth(): number;
|
|
29
|
-
fetchGridData(): Promise<unknown>;
|
|
30
|
-
onFetchSuccess(data: JBGridResponseData<T>): void;
|
|
31
|
-
standardData(data: AnyObject[]): Promise<JBGridRowData<T>[]>;
|
|
32
|
-
CreateRequestBody(): any;
|
|
33
40
|
goToFirstPage(): void;
|
|
34
41
|
refreshBtnClick(): void;
|
|
35
42
|
playRefreshBtnAnimation(): Animation;
|
|
36
43
|
stopRefreshBtnAnimation(anime: Animation): void;
|
|
37
|
-
goToPage(destinationPageIndex: number):
|
|
38
|
-
|
|
39
|
-
refreshData(): Promise<void>;
|
|
40
|
-
onSearch(filterList: JBSearchbarValue): Promise<unknown>;
|
|
41
|
-
onPageSizeChange(e: any): void;
|
|
44
|
+
goToPage(destinationPageIndex: number): void;
|
|
45
|
+
onPageSizeChange(e: React.ChangeEvent<HTMLSelectElement>): void;
|
|
42
46
|
onFullScreenBtnClicked(currentValue: boolean): void;
|
|
43
47
|
onFullscreenChanged(newValue: boolean): void;
|
|
44
48
|
fullScreenGrid(): void;
|
|
@@ -47,8 +51,6 @@ declare class JBGridViewModel<T extends AnyObject> {
|
|
|
47
51
|
changePageNumberToInput(): void;
|
|
48
52
|
openSearchHeaderSection(): void;
|
|
49
53
|
openMainHeaderSection(): void;
|
|
50
|
-
showErrorPanel(): void;
|
|
51
|
-
hideErrorPanel(): void;
|
|
52
54
|
get paginationDisplayNumbers(): {
|
|
53
55
|
currentPage: string | number;
|
|
54
56
|
nextPage: string | number;
|
|
@@ -61,6 +63,7 @@ declare class JBGridViewModel<T extends AnyObject> {
|
|
|
61
63
|
pageSizes: (string | number)[];
|
|
62
64
|
};
|
|
63
65
|
toPersianNumber(input: string | number): string | number;
|
|
66
|
+
private createConfig;
|
|
64
67
|
}
|
|
65
68
|
export default JBGridViewModel;
|
|
66
69
|
export declare const JBGridContext: React.Context<JBGridViewModel<AnyObject> | null>;
|
package/react/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { FilterItem, JBSearchbarValue } from "jb-searchbar";
|
|
2
1
|
export type JBGridRowDataDetail = {
|
|
3
2
|
isDeleting: boolean;
|
|
4
3
|
isDeleted: boolean;
|
|
@@ -36,25 +35,10 @@ export type JBGridResponseData<T extends AnyObject> = {
|
|
|
36
35
|
totalPages: number;
|
|
37
36
|
content: JBGridRowData<T>[];
|
|
38
37
|
};
|
|
39
|
-
export type
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
export type SearchbarConfig = {
|
|
44
|
-
columnList: FilterItem[];
|
|
45
|
-
searchOnChange?: boolean;
|
|
46
|
-
};
|
|
47
|
-
export interface JBGridBridgeInterface {
|
|
48
|
-
mapServerResponseDataToGridData: (data: any) => JBGridResponseData<any>;
|
|
49
|
-
getData: (data: JBGridConfigRequestParams, requestBody: any) => Promise<any>;
|
|
50
|
-
createRequestBody: (page: JBGridDataPage, filter?: JBSearchbarValue, sortColumn?: JBGridColumnDef | null, requestConfig?: JBGridConfigRequestParams) => any;
|
|
51
|
-
}
|
|
52
|
-
type ClassBuilder<I, Args extends any[] = any[]> = new (...args: Args) => I;
|
|
53
|
-
export type JBGridBridgeClassInterface = ClassBuilder<JBGridBridgeInterface, []>;
|
|
54
|
-
export type JBGridDataPage = {
|
|
55
|
-
index: number;
|
|
56
|
-
size: number;
|
|
57
|
-
totalPages: number;
|
|
38
|
+
export type JBGridPaginationMeta = {
|
|
39
|
+
startItemIndex: number;
|
|
40
|
+
endItemIndex: number;
|
|
41
|
+
totalItemsCount: number;
|
|
58
42
|
};
|
|
59
43
|
export type JBGridColumnDef = {
|
|
60
44
|
width?: string | number;
|
|
@@ -64,20 +48,6 @@ export type JBGridColumnDef = {
|
|
|
64
48
|
title: string;
|
|
65
49
|
name: string;
|
|
66
50
|
};
|
|
67
|
-
export type JBGridConfigRequestParams = {
|
|
68
|
-
method?: "POST" | "GET";
|
|
69
|
-
url?: string;
|
|
70
|
-
[key: string]: any;
|
|
71
|
-
};
|
|
72
|
-
export type JBGridDataConfig<T extends AnyObject> = {
|
|
73
|
-
data: JBGridRowData<T>[];
|
|
74
|
-
requestParams: JBGridConfigRequestParams;
|
|
75
|
-
metaData: {
|
|
76
|
-
startItemIndex: number;
|
|
77
|
-
endItemIndex: number;
|
|
78
|
-
totalItemsCount: number;
|
|
79
|
-
};
|
|
80
|
-
};
|
|
81
51
|
export type JBGridTableConfig = {
|
|
82
52
|
columns: JBGridColumnDef[];
|
|
83
53
|
};
|
|
@@ -85,10 +55,6 @@ export type JBGridConfigStates = {
|
|
|
85
55
|
headerSection: 'MAIN' | "SEARCH";
|
|
86
56
|
isFullScreen: boolean;
|
|
87
57
|
};
|
|
88
|
-
export type JBGridCallbackConfig<T extends AnyObject> = {
|
|
89
|
-
onDataStandardizing: ((data: JBGridRowData<AnyObject>[]) => JBGridRowData<T>[]) | (<T extends AnyObject>(data: JBGridRowData<AnyObject>[]) => Promise<JBGridRowData<T>[]>) | null | undefined;
|
|
90
|
-
onPageIndexChange: ((newPageIndex: number) => unknown) | null | undefined;
|
|
91
|
-
};
|
|
92
58
|
export type JBGridI18nMessage = {
|
|
93
59
|
serverErrorText?: string;
|
|
94
60
|
serverErrorTitle?: string;
|
|
@@ -102,21 +68,23 @@ export type JBGridI18nConfig = {
|
|
|
102
68
|
messages?: JBGridI18nMessage;
|
|
103
69
|
showPersianNumber?: boolean;
|
|
104
70
|
};
|
|
105
|
-
export type
|
|
106
|
-
|
|
107
|
-
fullScreenGrid: () => void;
|
|
108
|
-
exitFullScreenGrid: () => void;
|
|
71
|
+
export type JBGridRenderContext = Readonly<{
|
|
72
|
+
refreshView: () => void;
|
|
109
73
|
}>;
|
|
110
74
|
export interface JBGridConfigInterface<T extends AnyObject> {
|
|
111
75
|
table: JBGridTableConfig;
|
|
112
|
-
|
|
113
|
-
page: JBGridDataPage;
|
|
114
|
-
callbacks: JBGridCallbackConfig<T>;
|
|
115
|
-
actionDispatchers?: ActionDispatchers;
|
|
116
|
-
states: JBGridConfigStates;
|
|
76
|
+
states?: JBGridConfigStates;
|
|
117
77
|
}
|
|
118
78
|
export type JBGridConfig<T extends AnyObject> = JBGridConfigInterface<T>;
|
|
119
79
|
export type JBGridCallbacks = {
|
|
120
|
-
|
|
80
|
+
/**
|
|
81
|
+
* @deprecated use onFullscreen and onExitFullscreen instead
|
|
82
|
+
*/
|
|
83
|
+
onFullscreenChange?: (isFullscreen: boolean) => unknown;
|
|
84
|
+
onFullscreen?: () => unknown;
|
|
85
|
+
onPageIndexChange?: (newPageIndex: number) => unknown;
|
|
86
|
+
onPageSizeChange?: (newPageSize: number) => unknown;
|
|
87
|
+
onRefresh?: () => unknown | Promise<unknown>;
|
|
88
|
+
onExitFullscreen?: () => unknown;
|
|
89
|
+
onSortChange?: (column: JBGridColumnDef) => unknown;
|
|
121
90
|
};
|
|
122
|
-
export {};
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
name:string,
|
|
8
|
-
label?:string,
|
|
9
|
-
}
|
|
10
|
-
export
|
|
11
|
-
const { children, ...otherProps} = props;
|
|
12
|
-
return (
|
|
13
|
-
<jb-cell slot="cell" {...otherProps}>{children}</jb-cell>
|
|
14
|
-
);
|
|
15
|
-
}
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import 'jb-grid';
|
|
3
|
+
import type {JBCellAttributes} from './module-declaration.js';
|
|
4
|
+
import type { JBCellWebComponent } from 'jb-grid';
|
|
5
|
+
|
|
6
|
+
export type CellProps = Omit<JBCellAttributes, "ref" | "name"> & {
|
|
7
|
+
name:string,
|
|
8
|
+
label?:string,
|
|
9
|
+
}
|
|
10
|
+
export const JBCell = React.forwardRef<JBCellWebComponent | null, CellProps>((props, ref) => {
|
|
11
|
+
const { children, ...otherProps} = props;
|
|
12
|
+
return (
|
|
13
|
+
<jb-cell ref={ref} slot="cell" {...otherProps}>{children}</jb-cell>
|
|
14
|
+
);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
JBCell.displayName = "JBCell";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React, { useEffect, useImperativeHandle, useRef } from 'react';
|
|
2
|
+
import 'jb-grid';
|
|
3
|
+
import { useEvent } from 'jb-core/react';
|
|
4
|
+
import type { JBColumnHeaderAttributes } from './module-declaration.js';
|
|
5
|
+
|
|
6
|
+
type JBColumnHeaderSort = "asc" | "desc";
|
|
7
|
+
type JBColumnHeaderWebComponent = HTMLElement & {
|
|
8
|
+
name: string,
|
|
9
|
+
sortable: boolean,
|
|
10
|
+
sort: JBColumnHeaderSort | null
|
|
11
|
+
}
|
|
12
|
+
type JBColumnHeaderSortEvent = CustomEvent<{
|
|
13
|
+
name: string,
|
|
14
|
+
sort: JBColumnHeaderSort
|
|
15
|
+
}>
|
|
16
|
+
|
|
17
|
+
export type ColumnHeaderProps = Omit<JBColumnHeaderAttributes, "name" | "onSort" | "ref" | "sort" | "sortable"> & {
|
|
18
|
+
name: string,
|
|
19
|
+
sortable?: boolean,
|
|
20
|
+
sort?: JBColumnHeaderSort,
|
|
21
|
+
onSort?: (event: JBColumnHeaderSortEvent) => void
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const JBColumnHeader = React.forwardRef<JBColumnHeaderWebComponent | null, ColumnHeaderProps>((props, ref) => {
|
|
25
|
+
const { children, name, sortable, sort, onSort, ...otherProps } = props;
|
|
26
|
+
const element = useRef<JBColumnHeaderWebComponent | null>(null);
|
|
27
|
+
useImperativeHandle(ref, () => element.current as JBColumnHeaderWebComponent, [element]);
|
|
28
|
+
useEvent(element, 'sort', onSort);
|
|
29
|
+
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (element.current) {
|
|
32
|
+
element.current.sortable = sortable === true;
|
|
33
|
+
element.current.sort = sort ?? null;
|
|
34
|
+
}
|
|
35
|
+
}, [sortable, sort]);
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<jb-col-header ref={element} name={name} {...otherProps}>
|
|
39
|
+
<span slot="title">{children}</span>
|
|
40
|
+
</jb-col-header>
|
|
41
|
+
);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
JBColumnHeader.displayName = "JBColumnHeader";
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import 'jb-grid';
|
|
3
|
+
import type {JBExpandToggleAttributes} from './module-declaration.js';
|
|
4
|
+
import type { JBExpandToggleWebComponent } from 'jb-grid';
|
|
5
|
+
|
|
6
|
+
export type ToggleProps = Omit<JBExpandToggleAttributes, "ref">
|
|
7
|
+
export const JBExpandToggle = React.forwardRef<JBExpandToggleWebComponent | null, ToggleProps>((props, ref) => {
|
|
8
|
+
const { children, ...otherProps} = props;
|
|
9
|
+
return (
|
|
10
|
+
<jb-expand-toggle ref={ref} {...otherProps}>{children}</jb-expand-toggle>
|
|
11
|
+
);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
JBExpandToggle.displayName = "JBExpandToggle";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React, { useEffect, useImperativeHandle, useRef } from 'react';
|
|
2
|
+
import 'jb-grid';
|
|
3
|
+
import type { JBFullscreenIconAttributes } from './module-declaration.js';
|
|
4
|
+
|
|
5
|
+
type JBFullscreenIconState = "enter" | "exit";
|
|
6
|
+
type JBFullscreenIconWebComponent = HTMLElement & {
|
|
7
|
+
state: JBFullscreenIconState
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type FullscreenIconProps = Omit<JBFullscreenIconAttributes, "ref" | "state"> & {
|
|
11
|
+
state?: JBFullscreenIconState
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const JBFullscreenIcon = React.forwardRef<JBFullscreenIconWebComponent | null, FullscreenIconProps>((props, ref) => {
|
|
15
|
+
const { state, ...otherProps } = props;
|
|
16
|
+
const element = useRef<JBFullscreenIconWebComponent | null>(null);
|
|
17
|
+
useImperativeHandle(ref, () => element.current as JBFullscreenIconWebComponent, [element]);
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (element.current) {
|
|
21
|
+
element.current.state = state ?? "enter";
|
|
22
|
+
}
|
|
23
|
+
}, [state]);
|
|
24
|
+
|
|
25
|
+
return <jb-fullscreen-icon ref={element} {...otherProps}></jb-fullscreen-icon>;
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
JBFullscreenIcon.displayName = "JBFullscreenIcon";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import CSS from './blob-loading.css';
|
|
2
|
+
import CSS from './blob-loading.css?inline';
|
|
3
3
|
import { injectCss } from 'jb-core';
|
|
4
4
|
|
|
5
5
|
injectCss(CSS as unknown as string);
|
|
6
6
|
class JBLoading extends React.Component {
|
|
7
7
|
render() {
|
|
8
8
|
const renderDom = (
|
|
9
|
-
<
|
|
9
|
+
<output className="jb-loading" aria-label="Loading">
|
|
10
10
|
<div className="blobs">
|
|
11
11
|
<div className="blob-center"></div>
|
|
12
12
|
<div className="blob"></div>
|
|
@@ -17,6 +17,7 @@ class JBLoading extends React.Component {
|
|
|
17
17
|
<div className="blob"></div>
|
|
18
18
|
</div>
|
|
19
19
|
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" className="style-svg">
|
|
20
|
+
<title>loading svg</title>
|
|
20
21
|
<defs>
|
|
21
22
|
<filter id="goo">
|
|
22
23
|
<feGaussianBlur in="SourceGraphic" stdDeviation="10" result="blur" />
|
|
@@ -25,9 +26,9 @@ class JBLoading extends React.Component {
|
|
|
25
26
|
</filter>
|
|
26
27
|
</defs>
|
|
27
28
|
</svg>
|
|
28
|
-
</
|
|
29
|
+
</output>
|
|
29
30
|
);
|
|
30
31
|
return (renderDom);
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
|
-
export default JBLoading;
|
|
34
|
+
export default JBLoading;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { type
|
|
1
|
+
import React, { type FormEventHandler, type HTMLAttributes } from 'react';
|
|
2
2
|
import 'jb-grid'
|
|
3
3
|
import type {JBPaginationWebComponent} from 'jb-grid'
|
|
4
4
|
import type { JBElementStandardProps } from 'jb-core/react';
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React, { useEffect, useImperativeHandle, useRef } from 'react';
|
|
2
|
+
import 'jb-grid';
|
|
3
|
+
import { useEvent } from 'jb-core/react';
|
|
4
|
+
import type { JBPaginationInfoAttributes } from './module-declaration.js';
|
|
5
|
+
|
|
6
|
+
type JBPaginationInfoWebComponent = HTMLElement & {
|
|
7
|
+
pageSize: number,
|
|
8
|
+
pageSizes: number[],
|
|
9
|
+
startItemIndex: number,
|
|
10
|
+
endItemIndex: number,
|
|
11
|
+
totalItemsCount: number,
|
|
12
|
+
pageItemCountTitle: string,
|
|
13
|
+
fromLabel: string,
|
|
14
|
+
currentAvailableItemTitle: string,
|
|
15
|
+
showPersianNumber: boolean
|
|
16
|
+
}
|
|
17
|
+
type JBPaginationInfoPageSizeChangeEvent = CustomEvent<{
|
|
18
|
+
pageSize: number
|
|
19
|
+
}>
|
|
20
|
+
|
|
21
|
+
export type PaginationInfoProps = Omit<JBPaginationInfoAttributes, "onPageSizeChange" | "ref"> & {
|
|
22
|
+
pageSize: number,
|
|
23
|
+
pageSizes?: number[],
|
|
24
|
+
startItemIndex: number,
|
|
25
|
+
endItemIndex: number,
|
|
26
|
+
totalItemsCount: number,
|
|
27
|
+
pageItemCountTitle?: string,
|
|
28
|
+
fromLabel?: string,
|
|
29
|
+
currentAvailableItemTitle?: string,
|
|
30
|
+
showPersianNumber?: boolean,
|
|
31
|
+
onPageSizeChange?: (event: JBPaginationInfoPageSizeChangeEvent) => void
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const JBPaginationInfo = React.forwardRef<JBPaginationInfoWebComponent | null, PaginationInfoProps>((props, ref) => {
|
|
35
|
+
const {
|
|
36
|
+
pageSize,
|
|
37
|
+
pageSizes,
|
|
38
|
+
startItemIndex,
|
|
39
|
+
endItemIndex,
|
|
40
|
+
totalItemsCount,
|
|
41
|
+
pageItemCountTitle,
|
|
42
|
+
fromLabel,
|
|
43
|
+
currentAvailableItemTitle,
|
|
44
|
+
showPersianNumber,
|
|
45
|
+
onPageSizeChange,
|
|
46
|
+
...otherProps
|
|
47
|
+
} = props;
|
|
48
|
+
const element = useRef<JBPaginationInfoWebComponent | null>(null);
|
|
49
|
+
useImperativeHandle(ref, () => element.current as JBPaginationInfoWebComponent, [element]);
|
|
50
|
+
useEvent(element, 'page-size-change', onPageSizeChange);
|
|
51
|
+
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
if (element.current) {
|
|
54
|
+
element.current.showPersianNumber = showPersianNumber === true;
|
|
55
|
+
element.current.pageSize = pageSize;
|
|
56
|
+
element.current.pageSizes = pageSizes ?? [20, 30, 50, 100];
|
|
57
|
+
element.current.startItemIndex = startItemIndex;
|
|
58
|
+
element.current.endItemIndex = endItemIndex;
|
|
59
|
+
element.current.totalItemsCount = totalItemsCount;
|
|
60
|
+
element.current.pageItemCountTitle = pageItemCountTitle ?? "";
|
|
61
|
+
element.current.fromLabel = fromLabel ?? "";
|
|
62
|
+
element.current.currentAvailableItemTitle = currentAvailableItemTitle ?? "";
|
|
63
|
+
}
|
|
64
|
+
}, [pageSize, pageSizes, startItemIndex, endItemIndex, totalItemsCount, pageItemCountTitle, fromLabel, currentAvailableItemTitle, showPersianNumber]);
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<jb-pagination-info ref={element} {...otherProps}></jb-pagination-info>
|
|
68
|
+
);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
JBPaginationInfo.displayName = "JBPaginationInfo";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import 'jb-grid';
|
|
3
|
+
import type { JBRefreshIconAttributes, JBRefreshIconWebComponent } from './module-declaration.js';
|
|
4
|
+
|
|
5
|
+
export type RefreshIconProps = Omit<JBRefreshIconAttributes, "ref">
|
|
6
|
+
|
|
7
|
+
export const JBRefreshIcon = React.forwardRef<JBRefreshIconWebComponent | null, RefreshIconProps>((props, ref) => {
|
|
8
|
+
return <jb-refresh-icon ref={ref} {...props}></jb-refresh-icon>;
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
JBRefreshIcon.displayName = "JBRefreshIcon";
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
rowTemplate?:RowTemplate,
|
|
8
|
-
isOpen?:boolean
|
|
9
|
-
}
|
|
10
|
-
export
|
|
11
|
-
const { children, ...otherProps} = props;
|
|
12
|
-
return (
|
|
13
|
-
<jb-row {...otherProps}>{children}</jb-row>
|
|
14
|
-
);
|
|
15
|
-
}
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import 'jb-grid';
|
|
3
|
+
import type {JBRowAttributes} from './module-declaration.js';
|
|
4
|
+
import type { JBRowWebComponent, RowTemplate } from 'jb-grid';
|
|
5
|
+
|
|
6
|
+
export type RowProps = Omit<JBRowAttributes, "ref" | "rowTemplate" | "isOpen"> & {
|
|
7
|
+
rowTemplate?:RowTemplate,
|
|
8
|
+
isOpen?:boolean
|
|
9
|
+
}
|
|
10
|
+
export const JBRow = React.forwardRef<JBRowWebComponent | null, RowProps>((props, ref) => {
|
|
11
|
+
const { children, ...otherProps} = props;
|
|
12
|
+
return (
|
|
13
|
+
<jb-row ref={ref} {...otherProps}>{children}</jb-row>
|
|
14
|
+
);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
JBRow.displayName = "JBRow";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import 'jb-grid';
|
|
3
|
+
import type { JBTableHeaderAttributes } from './module-declaration.js';
|
|
4
|
+
|
|
5
|
+
type TableHeaderTemplate = Array<{name: string, size?: string | number}>
|
|
6
|
+
type JBTableHeaderWebComponent = HTMLElement & {
|
|
7
|
+
headerTemplate: TableHeaderTemplate
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type TableHeaderProps = Omit<JBTableHeaderAttributes, "headerTemplate" | "ref"> & {
|
|
11
|
+
headerTemplate?: TableHeaderTemplate
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const JBTableHeader = React.forwardRef<JBTableHeaderWebComponent | null, TableHeaderProps>((props, ref) => {
|
|
15
|
+
const { children, ...otherProps } = props;
|
|
16
|
+
return (
|
|
17
|
+
<jb-table-header ref={ref} {...otherProps}>{children}</jb-table-header>
|
|
18
|
+
);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
JBTableHeader.displayName = "JBTableHeader";
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
.jb-loading{
|
|
4
|
-
--blob-color:var(--
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
.jb-loading{
|
|
4
|
+
--blob-color: var(--loading-color);
|
|
5
|
+
width: 100%;
|
|
6
|
+
height: 100%;
|
|
7
|
+
display: block;
|
|
8
|
+
/* Loader */
|
|
9
|
+
.blobs {
|
|
10
|
+
filter: url(#goo);
|
|
11
|
+
width: 100%;
|
|
12
|
+
height: 100%;
|
|
13
|
+
position: relative;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
border-radius: 4.375rem;
|
|
13
16
|
transform-style: preserve-3d;
|
|
14
17
|
|
|
15
18
|
/* Blob center item */
|
|
@@ -19,8 +22,8 @@
|
|
|
19
22
|
background: var(--blob-color);
|
|
20
23
|
top: 50%;
|
|
21
24
|
left: 50%;
|
|
22
|
-
width:
|
|
23
|
-
height:
|
|
25
|
+
width: 1.875rem;
|
|
26
|
+
height: 1.875rem;
|
|
24
27
|
transform-origin: left top;
|
|
25
28
|
transform: scale(.9) translate(-50%, -50%);
|
|
26
29
|
animation: blob-grow
|
|
@@ -28,7 +31,7 @@
|
|
|
28
31
|
3.4s
|
|
29
32
|
infinite;
|
|
30
33
|
border-radius: 50%;
|
|
31
|
-
box-shadow: 0 -
|
|
34
|
+
box-shadow: 0 -0.625rem 2.5rem -5px var(--blob-color);
|
|
32
35
|
}
|
|
33
36
|
}
|
|
34
37
|
.style-svg{
|
|
@@ -41,8 +44,8 @@
|
|
|
41
44
|
background: var(--blob-color);
|
|
42
45
|
top: 50%;
|
|
43
46
|
left: 50%;
|
|
44
|
-
width:
|
|
45
|
-
height:
|
|
47
|
+
width: 1.875rem;
|
|
48
|
+
height: 1.875rem;
|
|
46
49
|
border-radius: 50%;
|
|
47
50
|
animation: blobs
|
|
48
51
|
ease-out
|
|
@@ -53,16 +56,17 @@
|
|
|
53
56
|
opacity: 0;
|
|
54
57
|
|
|
55
58
|
/* Set animation delay for each of type */
|
|
56
|
-
&:nth-child(
|
|
57
|
-
&:nth-child(
|
|
58
|
-
&:nth-child(
|
|
59
|
-
&:nth-child(
|
|
60
|
-
&:nth-child(
|
|
59
|
+
&:nth-child(2) { animation-delay: 0.2s; }
|
|
60
|
+
&:nth-child(3) { animation-delay: 0.4s; }
|
|
61
|
+
&:nth-child(4) { animation-delay: 0.6s; }
|
|
62
|
+
&:nth-child(5) { animation-delay: 0.8s; }
|
|
63
|
+
&:nth-child(6) { animation-delay: 1.0s; }
|
|
64
|
+
&:nth-child(7) { animation-delay: 1.2s; }
|
|
61
65
|
}
|
|
62
66
|
|
|
63
67
|
/* Keyframes variables */
|
|
64
|
-
--left: calc(-
|
|
65
|
-
--right: calc(
|
|
68
|
+
--left: calc(-20.625rem - 50%);
|
|
69
|
+
--right: calc(20.625rem - 50%);
|
|
66
70
|
|
|
67
71
|
|
|
68
72
|
}
|
|
@@ -138,4 +142,4 @@
|
|
|
138
142
|
92%, 100% {
|
|
139
143
|
transform: scale(0) translate(-50%, -50%);
|
|
140
144
|
}
|
|
141
|
-
}
|
|
145
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
@custom-media --tablet-until (max-width:
|
|
1
|
+
@custom-media --tablet-until (max-width: 48rem);
|
|
2
2
|
|
|
3
3
|
.jb-grid-wrapper .jb-grid-content {
|
|
4
4
|
.jb-grid-table-cell {
|
|
5
|
-
padding: 4px
|
|
5
|
+
padding: 4px 1rem;
|
|
6
6
|
overflow-x: hidden;
|
|
7
|
-
grid-auto-rows: minmax(
|
|
7
|
+
grid-auto-rows: minmax(3rem, auto);
|
|
8
8
|
align-self: center;
|
|
9
9
|
display: grid;
|
|
10
10
|
align-items: center;
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
&.with-collapse-cell {
|
|
25
|
-
grid-template-columns:
|
|
25
|
+
grid-template-columns: 1.5rem auto;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
@media(--tablet-until) {
|
|
29
29
|
&:first-child {
|
|
30
|
-
box-shadow: 0px
|
|
30
|
+
box-shadow: 0px 0.375rem 0.375rem #dadada;
|
|
31
31
|
border-radius: 1rem;
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
.jb-grid-wrapper .jb-grid-content .collapse-btn {
|
|
46
46
|
float: right;
|
|
47
47
|
cursor: pointer;
|
|
48
|
-
margin-left:
|
|
48
|
+
margin-left: 0.5rem;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
.jb-grid-wrapper .jb-grid-content .collapse-btn svg {
|
|
52
|
-
width:
|
|
52
|
+
width: 0.75rem;
|
|
53
53
|
height: 100%;
|
|
54
54
|
}
|
|
55
55
|
|