jb-grid 0.4.1 → 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/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,23 +1,26 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import CSS from './content-error.css';
|
|
3
|
-
import { injectCss } from 'jb-core';
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import CSS from './content-error.css?inline';
|
|
3
|
+
import { injectCss } from 'jb-core';
|
|
4
|
+
import { JBButton } from 'jb-button/react';
|
|
4
5
|
|
|
5
6
|
injectCss(CSS as unknown as string);
|
|
6
7
|
type ContentErrorProps = {
|
|
7
|
-
onRefreshBtnClick:()=>unknown,
|
|
8
|
-
message?:string,
|
|
9
|
-
title?:string,
|
|
10
|
-
refreshButtonTitle?:string,
|
|
8
|
+
onRefreshBtnClick: () => unknown,
|
|
9
|
+
message?: string,
|
|
10
|
+
title?: string,
|
|
11
|
+
refreshButtonTitle?: string,
|
|
11
12
|
}
|
|
12
|
-
function ContentError(props:ContentErrorProps) {
|
|
13
|
+
function ContentError(props: ContentErrorProps) {
|
|
13
14
|
return (
|
|
14
15
|
<div className="content-error">
|
|
15
|
-
<div className="error-image">😬😓🤔</div>
|
|
16
|
-
<div className="error-text" style={{ padding: " 0 0 0 0" }}>{props.title}</div>
|
|
17
|
-
<div className="error-text">{props.message}</div>
|
|
18
|
-
<div className="error-button"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
<div className="error-image">😬😓🤔</div>
|
|
17
|
+
<div className="error-text" style={{ padding: " 0 0 0 0" }}>{props.title}</div>
|
|
18
|
+
<div className="error-text">{props.message}</div>
|
|
19
|
+
<div className="error-button">
|
|
20
|
+
<JBButton color="positive" onClick={props.onRefreshBtnClick}>{props.refreshButtonTitle}</JBButton>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
22
25
|
|
|
23
|
-
export default ContentError;
|
|
26
|
+
export default ContentError;
|
|
@@ -11,16 +11,10 @@
|
|
|
11
11
|
.error-text {
|
|
12
12
|
font-weight: 100;
|
|
13
13
|
font-size: 1.5em;
|
|
14
|
-
padding:
|
|
14
|
+
padding: 1rem 0;
|
|
15
15
|
color: #333;
|
|
16
16
|
}
|
|
17
|
-
.error-button
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
border: none;
|
|
22
|
-
border-radius: 150px;
|
|
23
|
-
cursor: pointer;
|
|
24
|
-
font-family: inherit;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
17
|
+
.error-button {
|
|
18
|
+
margin-top: 0.5rem;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -1,22 +1,70 @@
|
|
|
1
|
-
import type { DetailedHTMLProps, HTMLAttributes } from "react";
|
|
2
|
-
import type { JBPaginationWebComponent } from "jb-grid";
|
|
3
|
-
import type { JBPaginationDirectAttributeProps } from "./types";
|
|
4
|
-
import type {JBCellWebComponent, JBRowWebComponent, JBExpandToggleWebComponent} from 'jb-grid'
|
|
5
|
-
type
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import type { DetailedHTMLProps, HTMLAttributes } from "react";
|
|
2
|
+
import type { JBPaginationWebComponent } from "jb-grid";
|
|
3
|
+
import type { JBPaginationDirectAttributeProps } from "./types";
|
|
4
|
+
import type {JBCellWebComponent, JBRowWebComponent, JBExpandToggleWebComponent} from 'jb-grid'
|
|
5
|
+
type TableHeaderTemplate = Array<{name: string, size?: string | number}>
|
|
6
|
+
type JBTableHeaderWebComponent = HTMLElement & {
|
|
7
|
+
headerTemplate: TableHeaderTemplate
|
|
8
|
+
}
|
|
9
|
+
type JBColumnHeaderSort = "asc" | "desc";
|
|
10
|
+
type JBColumnHeaderWebComponent = HTMLElement & {
|
|
11
|
+
name: string,
|
|
12
|
+
sortable: boolean,
|
|
13
|
+
sort: JBColumnHeaderSort | null
|
|
14
|
+
}
|
|
15
|
+
type JBPaginationInfoWebComponent = HTMLElement & {
|
|
16
|
+
pageSize: number,
|
|
17
|
+
pageSizes: number[],
|
|
18
|
+
startItemIndex: number,
|
|
19
|
+
endItemIndex: number,
|
|
20
|
+
totalItemsCount: number,
|
|
21
|
+
pageItemCountTitle: string,
|
|
22
|
+
fromLabel: string,
|
|
23
|
+
currentAvailableItemTitle: string,
|
|
24
|
+
showPersianNumber: boolean
|
|
25
|
+
}
|
|
26
|
+
export type JBRefreshIconWebComponent = HTMLElement & {
|
|
27
|
+
play: () => void,
|
|
28
|
+
pause: () => void,
|
|
29
|
+
stop: () => void
|
|
30
|
+
}
|
|
31
|
+
type JBFullscreenIconState = "enter" | "exit";
|
|
32
|
+
type JBFullscreenIconWebComponent = HTMLElement & {
|
|
33
|
+
state: JBFullscreenIconState
|
|
34
|
+
}
|
|
35
|
+
type JBPaginationAttributes = DetailedHTMLProps<HTMLAttributes<JBPaginationWebComponent>, JBPaginationWebComponent> & JBPaginationDirectAttributeProps
|
|
36
|
+
export type JBPaginationInfoAttributes = DetailedHTMLProps<HTMLAttributes<JBPaginationInfoWebComponent>, JBPaginationInfoWebComponent>
|
|
37
|
+
export type JBRefreshIconAttributes = DetailedHTMLProps<HTMLAttributes<JBRefreshIconWebComponent>, JBRefreshIconWebComponent>
|
|
38
|
+
export type JBFullscreenIconAttributes = DetailedHTMLProps<HTMLAttributes<JBFullscreenIconWebComponent>, JBFullscreenIconWebComponent> & {
|
|
39
|
+
state?: JBFullscreenIconState
|
|
40
|
+
}
|
|
41
|
+
export type JBRowAttributes = DetailedHTMLProps<HTMLAttributes<JBRowWebComponent>, JBRowWebComponent>
|
|
42
|
+
export type JBTableHeaderAttributes = DetailedHTMLProps<HTMLAttributes<JBTableHeaderWebComponent>, JBTableHeaderWebComponent> & {
|
|
43
|
+
headerTemplate?: TableHeaderTemplate
|
|
44
|
+
}
|
|
45
|
+
export type JBColumnHeaderAttributes = DetailedHTMLProps<HTMLAttributes<JBColumnHeaderWebComponent>, JBColumnHeaderWebComponent> & {
|
|
46
|
+
name: string,
|
|
47
|
+
sortable?: boolean,
|
|
48
|
+
sort?: JBColumnHeaderSort
|
|
49
|
+
}
|
|
50
|
+
export type JBCellAttributes = DetailedHTMLProps<HTMLAttributes<JBCellWebComponent>, JBCellWebComponent> & {
|
|
51
|
+
ellipsis?: boolean | number
|
|
52
|
+
}
|
|
10
53
|
export type JBExpandToggleAttributes = DetailedHTMLProps<HTMLAttributes<JBExpandToggleWebComponent>, JBExpandToggleWebComponent>
|
|
11
54
|
|
|
12
55
|
declare module "react" {
|
|
13
56
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
14
57
|
namespace JSX {
|
|
15
58
|
interface IntrinsicElements {
|
|
16
|
-
'jb-pagination': JBPaginationAttributes;
|
|
17
|
-
'jb-
|
|
18
|
-
'jb-
|
|
19
|
-
'jb-
|
|
59
|
+
'jb-pagination': JBPaginationAttributes;
|
|
60
|
+
'jb-pagination-info': JBPaginationInfoAttributes;
|
|
61
|
+
'jb-refresh-icon': JBRefreshIconAttributes;
|
|
62
|
+
'jb-fullscreen-icon': JBFullscreenIconAttributes;
|
|
63
|
+
'jb-row': JBRowAttributes;
|
|
64
|
+
'jb-table-header': JBTableHeaderAttributes;
|
|
65
|
+
'jb-col-header': JBColumnHeaderAttributes;
|
|
66
|
+
'jb-cell': JBCellAttributes;
|
|
67
|
+
'jb-expand-toggle': JBExpandToggleAttributes;
|
|
20
68
|
}
|
|
21
69
|
}
|
|
22
70
|
}
|
package/react/lib/Content.tsx
CHANGED
|
@@ -1,55 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<section key={'jb-grid-content'} className="jb-grid-content">
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
import JBLoading from './Components/JBLoading.js';
|
|
3
|
+
import type { JBGridI18nConfig } from './types.js';
|
|
4
|
+
import ContentError from './Components/content-error/ContentError.js';
|
|
5
|
+
export type ContentProps = {
|
|
6
|
+
children:React.ReactNode | React.ReactNode[],
|
|
7
|
+
refreshBtnClick:()=>void,
|
|
8
|
+
isErrorOccurred:boolean,
|
|
9
|
+
isLoading:boolean,
|
|
10
|
+
i18n:JBGridI18nConfig,
|
|
11
|
+
errorComponent?:ReactNode,
|
|
12
|
+
tableHeader?:ReactNode,
|
|
13
|
+
}
|
|
14
|
+
function Content(props:ContentProps) {
|
|
15
|
+
const {refreshBtnClick,isErrorOccurred,isLoading,i18n} = props;
|
|
16
|
+
const ErrorComponent = props.errorComponent || <ContentError onRefreshBtnClick={refreshBtnClick} message={i18n.messages?.serverErrorText} title={i18n.messages?.serverErrorTitle} refreshButtonTitle={i18n.messages!.serverErrorRefreshButtonTitle}></ContentError>;
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<section key={'jb-grid-content'} className={`jb-grid-content ${props.tableHeader ? "" : "without-table-header"}`}>
|
|
23
20
|
{
|
|
24
21
|
isErrorOccurred &&
|
|
25
22
|
ErrorComponent
|
|
26
23
|
}
|
|
27
24
|
{
|
|
28
25
|
!isErrorOccurred &&
|
|
29
|
-
[
|
|
30
|
-
<section className="table-header" key='table-header'>
|
|
31
|
-
|
|
32
|
-
{
|
|
33
|
-
config.table.columns.map((item) => {
|
|
34
|
-
return (
|
|
35
|
-
<div onClick={() => setSortColumn(item)} key={item.name + '-' + item.id + '-' + "jb-grid-table-header"} title={item.name} className={'header-item ' + (item.sortable ? 'sortable-col' : '')}>
|
|
36
|
-
<div className="caption-wrapper">{item.title}</div>
|
|
37
|
-
{
|
|
38
|
-
item.sort && (
|
|
39
|
-
<div className={"sort-icon-wrapper"}>
|
|
40
|
-
<svg className={'--' + item.sort.toLowerCase()} version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 31.479 31.479">
|
|
41
|
-
<path d="M26.477,10.274c0.444,0.444,0.444,1.143,0,1.587c-0.429,0.429-1.143,0.429-1.571,0l-8.047-8.047 v26.555c0,0.619-0.492,1.111-1.111,1.111c-0.619,0-1.127-0.492-1.127-1.111V3.813l-8.031,8.047c-0.444,0.429-1.159,0.429-1.587,0 c-0.444-0.444-0.444-1.143,0-1.587l9.952-9.952c0.429-0.429,1.143-0.429,1.571,0L26.477,10.274z" />
|
|
42
|
-
</svg>
|
|
43
|
-
|
|
44
|
-
</div>
|
|
45
|
-
)}
|
|
46
|
-
</div>
|
|
47
|
-
);
|
|
48
|
-
})
|
|
49
|
-
}
|
|
50
|
-
</div>
|
|
51
|
-
</section>
|
|
52
|
-
,
|
|
26
|
+
[
|
|
27
|
+
props.tableHeader && <section className="table-header" key='table-header'>{props.tableHeader}</section>
|
|
28
|
+
,
|
|
53
29
|
<section className="table-content" key='table-content'>
|
|
54
30
|
<div className="table-content-wrapper">
|
|
55
31
|
{props.children}
|
|
@@ -73,4 +49,4 @@ function Content(props:ContentProps) {
|
|
|
73
49
|
);
|
|
74
50
|
}
|
|
75
51
|
|
|
76
|
-
export default
|
|
52
|
+
export default Content;
|
package/react/lib/Footer.tsx
CHANGED
|
@@ -1,79 +1,52 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
injectCss(CSS as unknown as string);
|
|
9
|
-
type FooterProps = {
|
|
10
|
-
vm:JBGridViewModel
|
|
11
|
-
isFullscreen:boolean
|
|
12
|
-
}
|
|
13
|
-
function Footer(props:FooterProps) {
|
|
14
|
-
const {vm,isFullscreen} = props;
|
|
15
|
-
return (
|
|
16
|
-
<section key={'jb-grid-footer'} className="jb-grid-footer">
|
|
17
|
-
<section className="btn-wrapper-section">
|
|
18
|
-
{
|
|
19
|
-
isFullscreen !== null && isFullscreen !== undefined && (
|
|
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
|
-
<select value={vm.config.page.size} className="page-size-select" onChange={(e) => vm.onPageSizeChange(e)}>
|
|
54
|
-
<option value={20}>{vm.paginationDisplayNumbers.pageSizes[0]}</option>
|
|
55
|
-
<option value={30}>{vm.paginationDisplayNumbers.pageSizes[1]}</option>
|
|
56
|
-
<option value={50}>{vm.paginationDisplayNumbers.pageSizes[2]}</option>
|
|
57
|
-
<option value={100}>{vm.paginationDisplayNumbers.pageSizes[3]}</option>
|
|
58
|
-
</select>
|
|
59
|
-
</section>
|
|
60
|
-
<section className="items-information-section">
|
|
61
|
-
<span>{vm.paginationDisplayNumbers.startItemIndex}</span>
|
|
62
|
-
<span>-</span>
|
|
63
|
-
<span> {vm.paginationDisplayNumbers.endItemIndex} </span>
|
|
64
|
-
<span> {vm.i18n.messages!.from}</span>
|
|
65
|
-
<span title={vm.i18n.messages!.currentAvailableItem}> {vm.paginationDisplayNumbers.totalItemsCount} </span>
|
|
66
|
-
|
|
67
|
-
</section>
|
|
68
|
-
<section className="navigation-section nav-btn">
|
|
69
|
-
<nav>
|
|
70
|
-
<JBPagination pageIndex={vm.config.page.index} max={vm.config.page.totalPages} min={1} onChange={(e)=>vm.goToPage((e.target as JBPaginationWebComponent).pageIndex)} showPersianNumber={vm.i18n.showPersianNumber}/>
|
|
71
|
-
</nav>
|
|
72
|
-
</section>
|
|
73
|
-
</section>
|
|
74
|
-
|
|
75
|
-
</section>
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export default observer(Footer) ;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type JBGridViewModel from './JBGridViewModel.js';
|
|
3
|
+
import CSS from './footer.css?inline';
|
|
4
|
+
import { injectCss } from 'jb-core';
|
|
5
|
+
import { JBFullscreenIcon, JBPagination, JBPaginationInfo, JBRefreshIcon } from './JBGrid.js';
|
|
6
|
+
import type { JBPaginationWebComponent } from 'jb-grid';
|
|
7
|
+
import { JBButton } from 'jb-button/react';
|
|
8
|
+
injectCss(CSS as unknown as string);
|
|
9
|
+
type FooterProps = {
|
|
10
|
+
vm:JBGridViewModel,
|
|
11
|
+
isFullscreen:boolean
|
|
12
|
+
}
|
|
13
|
+
function Footer(props:FooterProps) {
|
|
14
|
+
const {vm,isFullscreen} = props;
|
|
15
|
+
return (
|
|
16
|
+
<section key={'jb-grid-footer'} className="jb-grid-footer">
|
|
17
|
+
<section className="btn-wrapper-section">
|
|
18
|
+
{
|
|
19
|
+
isFullscreen !== null && isFullscreen !== undefined && (
|
|
20
|
+
<JBButton className="btn full-screen-button" variant="text" onClick={() => vm.onFullScreenBtnClicked(isFullscreen)}>
|
|
21
|
+
<JBFullscreenIcon state={isFullscreen ? "exit" : "enter"} />
|
|
22
|
+
</JBButton>
|
|
23
|
+
)}
|
|
24
|
+
<JBButton className="btn refresh-btn" variant="text" onClick={() => vm.refreshBtnClick()}>
|
|
25
|
+
<JBRefreshIcon ref={vm.elements.refreshIcon} />
|
|
26
|
+
</JBButton>
|
|
27
|
+
</section>
|
|
28
|
+
<section className="page-section">
|
|
29
|
+
<JBPaginationInfo
|
|
30
|
+
pageSize={vm.page.size}
|
|
31
|
+
pageSizes={[20, 30, 50, 100]}
|
|
32
|
+
startItemIndex={vm.metaData.startItemIndex}
|
|
33
|
+
endItemIndex={vm.metaData.endItemIndex}
|
|
34
|
+
totalItemsCount={vm.metaData.totalItemsCount}
|
|
35
|
+
pageItemCountTitle={vm.i18n.messages!.pageItemCount}
|
|
36
|
+
fromLabel={vm.i18n.messages!.from}
|
|
37
|
+
currentAvailableItemTitle={vm.i18n.messages!.currentAvailableItem}
|
|
38
|
+
showPersianNumber={vm.i18n.showPersianNumber}
|
|
39
|
+
onPageSizeChange={(e) => vm.setPageSize(e.detail.pageSize)}
|
|
40
|
+
/>
|
|
41
|
+
<section className="navigation-section nav-btn">
|
|
42
|
+
<nav>
|
|
43
|
+
<JBPagination pageIndex={vm.page.index} max={vm.page.totalPages} min={1} onChange={(e)=>vm.goToPage((e.target as JBPaginationWebComponent).pageIndex)} showPersianNumber={vm.i18n.showPersianNumber}/>
|
|
44
|
+
</nav>
|
|
45
|
+
</section>
|
|
46
|
+
</section>
|
|
47
|
+
|
|
48
|
+
</section>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export default Footer;
|
package/react/lib/Header.tsx
CHANGED
|
@@ -1,35 +1,21 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import JBGridViewModel from './JBGridViewModel.js';
|
|
3
|
-
import
|
|
4
|
-
import 'jb-searchbar/react/lib/module-declaration.js';
|
|
5
|
-
import { observer } from 'mobx-react';
|
|
6
|
-
import CSS from './header.css';
|
|
2
|
+
import type JBGridViewModel from './JBGridViewModel.js';
|
|
3
|
+
import CSS from './header.css?inline';
|
|
7
4
|
import { injectCss } from 'jb-core';
|
|
8
5
|
|
|
9
6
|
injectCss(CSS as unknown as string);
|
|
10
7
|
|
|
11
8
|
type HeaderProps = {
|
|
12
|
-
vm: JBGridViewModel
|
|
9
|
+
vm: JBGridViewModel,
|
|
13
10
|
title: string,
|
|
14
|
-
|
|
11
|
+
searchbarComponent?: ReactNode,
|
|
15
12
|
headerEndComponents?: React.ReactNode[] | ReactNode
|
|
16
13
|
}
|
|
17
|
-
declare global {
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
19
|
-
namespace JSX {
|
|
20
|
-
interface IntrinsicElements {
|
|
21
|
-
'jb-searchbar': JBSearchbarType;
|
|
22
|
-
}
|
|
23
|
-
interface JBSearchbarType extends React.DetailedHTMLProps<React.HTMLAttributes<JBSearchbarWebComponent>, JBSearchbarWebComponent> {
|
|
24
|
-
class?: string,
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
14
|
function Header(props: HeaderProps) {
|
|
29
15
|
const { vm } = props;
|
|
30
16
|
return (
|
|
31
17
|
<section key={'jb-grid-header'} className="jb-grid-header">
|
|
32
|
-
<section className={
|
|
18
|
+
<section className={`main-section ${vm.headerSection == "MAIN" ? "" : "hidden"}`}>
|
|
33
19
|
<section className="jb-grid-title">{props.title}</section>
|
|
34
20
|
<section className="button-container">
|
|
35
21
|
{
|
|
@@ -44,9 +30,10 @@ function Header(props: HeaderProps) {
|
|
|
44
30
|
}
|
|
45
31
|
{
|
|
46
32
|
|
|
47
|
-
props.
|
|
33
|
+
props.searchbarComponent && (
|
|
48
34
|
<div className="filter-btn btn" onClick={() => { vm.openSearchHeaderSection(); }}>
|
|
49
35
|
<svg xmlns="http://www.w3.org/2000/svg" height="30" viewBox="0 0 24 24" fill="none">
|
|
36
|
+
<title>filter button</title>
|
|
50
37
|
<g>
|
|
51
38
|
<path d="M4.00001 3C3.62123 3 3.27497 3.214 3.10558 3.55279C2.93619 3.89157 2.97274 4.29698 3.20001 4.6L8.80001 12.0667C8.92983 12.2398 9.00001 12.4503 9.00001 12.6667V20C9.00001 20.3466 9.17946 20.6684 9.47427 20.8507C9.76909 21.0329 10.1372 21.0494 10.4472 20.8944L14.4472 18.8944C14.786 18.725 15 18.3788 15 18V12.6667C15 12.4503 15.0702 12.2398 15.2 12.0667L20.8 4.6C21.0273 4.29698 21.0638 3.89157 20.8944 3.55279C20.725 3.214 20.3788 3 20 3H4.00001Z" />
|
|
52
39
|
</g>
|
|
@@ -55,17 +42,17 @@ function Header(props: HeaderProps) {
|
|
|
55
42
|
)}
|
|
56
43
|
</section>
|
|
57
44
|
</section>
|
|
58
|
-
<section className={
|
|
45
|
+
<section className={`search-section ${vm.headerSection == "SEARCH" ? "" : "hidden"}`}>
|
|
59
46
|
<div className="close-btn" onClick={() => { vm.openMainHeaderSection(); }}>
|
|
60
47
|
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" x="0px" y="0px" viewBox="0 0 224.512 224.512">
|
|
48
|
+
<title>close filter button</title>
|
|
61
49
|
<g>
|
|
62
50
|
<polygon points="224.507,6.997 217.521,0 112.256,105.258 6.998,0 0.005,6.997 105.263,112.254 0.005,217.512 6.998,224.512 112.256,119.24 217.521,224.512 224.507,217.512 119.249,112.254 " />
|
|
63
51
|
</g>
|
|
64
52
|
</svg>
|
|
65
53
|
</div>
|
|
66
54
|
<div className="search-bar-wrapper">{
|
|
67
|
-
props.
|
|
68
|
-
<jb-searchbar ref={vm.elements.searchbar}></jb-searchbar>
|
|
55
|
+
props.searchbarComponent
|
|
69
56
|
}
|
|
70
57
|
</div>
|
|
71
58
|
</section>
|
|
@@ -73,4 +60,4 @@ function Header(props: HeaderProps) {
|
|
|
73
60
|
);
|
|
74
61
|
}
|
|
75
62
|
|
|
76
|
-
export default
|
|
63
|
+
export default Header;
|