jb-grid 0.2.4 → 0.3.1
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 +46 -1
- package/package.json +4 -3
- package/react/dist/Components/Cell.d.ts +8 -7
- package/react/dist/Components/ExpandRow.d.ts +4 -6
- package/react/dist/Components/ExpandToggle.d.ts +5 -0
- package/react/dist/Components/Pagination.d.ts +4 -18
- package/react/dist/Components/Row.d.ts +10 -4
- package/react/dist/Components/module-declaration.d.ts +19 -0
- package/react/dist/Components/types.d.ts +9 -0
- package/react/dist/JBGrid.cjs.js +1 -1
- package/react/dist/JBGrid.cjs.js.map +1 -1
- package/react/dist/JBGrid.d.ts +3 -2
- package/react/dist/JBGrid.js +1 -1
- package/react/dist/JBGrid.js.map +1 -1
- package/react/dist/JBGrid.umd.js +1 -1
- package/react/dist/JBGrid.umd.js.map +1 -1
- package/react/dist/JBGridData.d.ts +1 -1
- package/react/dist/JBGridViewModel.d.ts +6 -6
- package/react/dist/types.d.ts +2 -2
- package/react/lib/Components/Cell.tsx +10 -17
- package/react/lib/Components/ExpandRow.tsx +5 -14
- package/react/lib/Components/ExpandToggle.tsx +10 -0
- package/react/lib/Components/Pagination.tsx +3 -18
- package/react/lib/Components/Row.tsx +11 -17
- package/react/lib/Components/module-declaration.ts +20 -0
- package/react/lib/Components/types.ts +10 -0
- package/react/lib/Content.tsx +1 -1
- package/react/lib/Footer.tsx +4 -4
- package/react/lib/JBGrid.tsx +5 -2
- package/react/lib/JBGridViewModel.ts +11 -11
- package/react/lib/types.ts +2 -2
- package/react/package.json +1 -1
- package/react/tsconfig.json +1 -1
- package/react/lib/Components/expand-row.css +0 -38
- package/react/lib/Components/row.css +0 -25
|
@@ -4,10 +4,10 @@ import type { JBSearchbarWebComponent, JBSearchbarValue } from 'jb-searchbar';
|
|
|
4
4
|
declare class JBGridViewModel<T extends AnyObject> {
|
|
5
5
|
styles: JBGridStyles;
|
|
6
6
|
elements: {
|
|
7
|
-
refreshIcon: React.RefObject<SVGElement>;
|
|
8
|
-
searchbar: React.RefObject<JBSearchbarWebComponent>;
|
|
7
|
+
refreshIcon: React.RefObject<SVGElement | null>;
|
|
8
|
+
searchbar: React.RefObject<JBSearchbarWebComponent | null>;
|
|
9
9
|
};
|
|
10
|
-
JBGridComponentDom: RefObject<HTMLDivElement>;
|
|
10
|
+
JBGridComponentDom: RefObject<HTMLDivElement | null>;
|
|
11
11
|
gridWrapperElement: HTMLElement | null;
|
|
12
12
|
isLoading: boolean;
|
|
13
13
|
dataBridge: JBGridBridgeInterface;
|
|
@@ -17,7 +17,7 @@ declare class JBGridViewModel<T extends AnyObject> {
|
|
|
17
17
|
callBacks: JBGridCallbacks;
|
|
18
18
|
config: JBGridConfig<T>;
|
|
19
19
|
i18n: JBGridI18nConfig;
|
|
20
|
-
constructor(onFullscreenChange: (isFullScreen: boolean) => void, config: JBGridConfigInterface<T>, bridge: JBGridBridgeClassInterface);
|
|
20
|
+
constructor(onFullscreenChange: ((isFullScreen: boolean) => void) | undefined, config: JBGridConfigInterface<T>, bridge: JBGridBridgeClassInterface);
|
|
21
21
|
setI18n(newValue: JBGridI18nConfig): void;
|
|
22
22
|
InitGrid(): void;
|
|
23
23
|
onComponentDidMount(searchbarConfig: SearchbarConfig | null): void;
|
|
@@ -63,5 +63,5 @@ declare class JBGridViewModel<T extends AnyObject> {
|
|
|
63
63
|
toPersianNumber(input: string | number): string | number;
|
|
64
64
|
}
|
|
65
65
|
export default JBGridViewModel;
|
|
66
|
-
export declare const JBGridContext: React.Context<JBGridViewModel<AnyObject
|
|
67
|
-
export declare const useJBGridVM: () => JBGridViewModel<AnyObject
|
|
66
|
+
export declare const JBGridContext: React.Context<JBGridViewModel<AnyObject> | null>;
|
|
67
|
+
export declare const useJBGridVM: () => JBGridViewModel<AnyObject> | null;
|
package/react/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { FilterItem, JBSearchbarValue } from "jb-searchbar";
|
|
2
2
|
export type JBGridRowDataDetail = {
|
|
3
3
|
isDeleting: boolean;
|
|
4
4
|
isDeleted: boolean;
|
|
@@ -41,7 +41,7 @@ export type JBGridFilter = {
|
|
|
41
41
|
value: JBSearchbarValue;
|
|
42
42
|
};
|
|
43
43
|
export type SearchbarConfig = {
|
|
44
|
-
columnList:
|
|
44
|
+
columnList: FilterItem[];
|
|
45
45
|
searchOnChange?: boolean;
|
|
46
46
|
};
|
|
47
47
|
export interface JBGridBridgeInterface {
|
|
@@ -1,22 +1,15 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import React, { type ForwardedRef } from 'react';
|
|
2
|
+
import type {JBCellAttributes} from './module-declaration.js';
|
|
3
|
+
import type { JBCellWebComponent } from 'jb-grid';
|
|
4
4
|
|
|
5
|
-
type
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
flex?:boolean;
|
|
5
|
+
type RowProps = JBCellAttributes & {
|
|
6
|
+
ref?:ForwardedRef<JBCellWebComponent | null>,
|
|
7
|
+
name:string,
|
|
8
|
+
label?:string,
|
|
10
9
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const { children, label, className, flex } = props;
|
|
10
|
+
export function JBCell(props:RowProps) {
|
|
11
|
+
const { children, ...otherProps} = props;
|
|
14
12
|
return (
|
|
15
|
-
<
|
|
16
|
-
<div className="cell-label">{label}</div>
|
|
17
|
-
<div className={"cell-value " + (flex?'flex-cell':'')}>{children}</div>
|
|
18
|
-
</div>
|
|
13
|
+
<jb-cell slot="cell" {...otherProps}>{children}</jb-cell>
|
|
19
14
|
);
|
|
20
15
|
}
|
|
21
|
-
|
|
22
|
-
export { Cell };
|
|
@@ -1,19 +1,10 @@
|
|
|
1
|
-
import React, { type PropsWithChildren } from 'react';
|
|
2
|
-
import CSS from './expand-row.css';
|
|
3
|
-
import { injectCss } from 'jb-core';
|
|
1
|
+
import React, { type HTMLAttributes, type PropsWithChildren } from 'react';
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
export function ExpandRow(props:Props) {
|
|
4
|
+
const {children,...otherProps} = props;
|
|
7
5
|
return (
|
|
8
|
-
|
|
9
|
-
<div className={'expand-row-content' + (props.show?'':' --hidden')}>
|
|
10
|
-
{props.children}
|
|
11
|
-
</div>
|
|
12
|
-
</section>
|
|
6
|
+
<div slot="expand" {...otherProps}>{children}</div>
|
|
13
7
|
);
|
|
14
8
|
}
|
|
15
|
-
type Props= PropsWithChildren<
|
|
16
|
-
show:boolean,
|
|
17
|
-
}>
|
|
9
|
+
type Props= PropsWithChildren<React.DetailedHTMLProps<HTMLAttributes<HTMLDivElement>,HTMLDivElement>>
|
|
18
10
|
|
|
19
|
-
export {ExpandRow};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { type PropsWithChildren } from 'react';
|
|
2
|
+
import type {JBExpandToggleAttributes} from './module-declaration.js';
|
|
3
|
+
|
|
4
|
+
type ToggleProps = JBExpandToggleAttributes
|
|
5
|
+
export function JBExpandToggle(props:ToggleProps) {
|
|
6
|
+
const { children, ...otherProps} = props;
|
|
7
|
+
return (
|
|
8
|
+
<jb-expand-toggle {...otherProps}>{children}</jb-expand-toggle>
|
|
9
|
+
);
|
|
10
|
+
}
|
|
@@ -2,28 +2,13 @@ import React, { type DetailedHTMLProps, type FormEventHandler, type HTMLAttribut
|
|
|
2
2
|
import 'jb-grid'
|
|
3
3
|
import type {JBPaginationWebComponent} from 'jb-grid'
|
|
4
4
|
import type { JBElementStandardProps } from 'jb-core/react';
|
|
5
|
+
import type { JBPaginationDirectAttributeProps } from './types';
|
|
6
|
+
import './module-declaration.js';
|
|
5
7
|
|
|
6
8
|
export function JBPagination(props:Props){
|
|
7
9
|
const {pageIndex, max, min, onChange,showPersianNumber, ...otherProps } = props;
|
|
8
10
|
return(<jb-pagination pageIndex={pageIndex} max={max} min={min} onChange={onChange} showPersianNumber={showPersianNumber} {...otherProps}></jb-pagination>)
|
|
9
11
|
}
|
|
10
12
|
|
|
11
|
-
type JBPaginationAttributes = DetailedHTMLProps<HTMLAttributes<JBPaginationWebComponent>, JBPaginationWebComponent> & DirectAttributeProps
|
|
12
|
-
declare module "react" {
|
|
13
|
-
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
14
|
-
namespace JSX {
|
|
15
|
-
interface IntrinsicElements {
|
|
16
|
-
'jb-pagination': JBPaginationAttributes;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
type DirectAttributeProps = {
|
|
22
|
-
pageIndex?:number,
|
|
23
|
-
max?:number,
|
|
24
|
-
min?:number,
|
|
25
|
-
onChange?:FormEventHandler<JBPaginationWebComponent>
|
|
26
|
-
showPersianNumber?:boolean,
|
|
27
|
-
}
|
|
28
13
|
|
|
29
|
-
export type Props = JBElementStandardProps<JBPaginationWebComponent, keyof
|
|
14
|
+
export type Props = JBElementStandardProps<JBPaginationWebComponent, keyof JBPaginationDirectAttributeProps> & JBPaginationDirectAttributeProps
|
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { injectCss } from 'jb-core';
|
|
1
|
+
import React, { type ForwardedRef } from 'react';
|
|
2
|
+
import type {JBRowAttributes} from './module-declaration.js';
|
|
3
|
+
import type { JBCellWebComponent, RowTemplate } from 'jb-grid';
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
5
|
+
type RowProps = JBRowAttributes & {
|
|
6
|
+
ref?:ForwardedRef<JBCellWebComponent | null>,
|
|
7
|
+
rowTemplate:RowTemplate,
|
|
8
|
+
isOpen?:boolean
|
|
9
|
+
}
|
|
10
|
+
export function JBRow(props:RowProps) {
|
|
11
|
+
const { children, ...otherProps} = props;
|
|
14
12
|
return (
|
|
15
|
-
<
|
|
16
|
-
{children}
|
|
17
|
-
</div>
|
|
13
|
+
<jb-row {...otherProps}>{children}</jb-row>
|
|
18
14
|
);
|
|
19
15
|
}
|
|
20
|
-
|
|
21
|
-
export {Row};
|
|
@@ -0,0 +1,20 @@
|
|
|
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 JBPaginationAttributes = DetailedHTMLProps<HTMLAttributes<JBPaginationWebComponent>, JBPaginationWebComponent> & JBPaginationDirectAttributeProps
|
|
6
|
+
export type JBRowAttributes = DetailedHTMLProps<HTMLAttributes<JBRowWebComponent>, JBRowWebComponent>
|
|
7
|
+
export type JBCellAttributes = DetailedHTMLProps<HTMLAttributes<JBCellWebComponent>, JBCellWebComponent>
|
|
8
|
+
export type JBExpandToggleAttributes = DetailedHTMLProps<HTMLAttributes<JBExpandToggleWebComponent>, JBExpandToggleWebComponent>
|
|
9
|
+
|
|
10
|
+
declare module "react" {
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
12
|
+
namespace JSX {
|
|
13
|
+
interface IntrinsicElements {
|
|
14
|
+
'jb-pagination': JBPaginationAttributes;
|
|
15
|
+
'jb-row': JBRowAttributes;
|
|
16
|
+
'jb-cell': JBCellAttributes;
|
|
17
|
+
'jb-expand-toggle': JBExpandToggleAttributes;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { JBPaginationWebComponent } from "jb-grid"
|
|
2
|
+
import type { FormEventHandler } from "react"
|
|
3
|
+
|
|
4
|
+
export type JBPaginationDirectAttributeProps = {
|
|
5
|
+
pageIndex?:number,
|
|
6
|
+
max?:number,
|
|
7
|
+
min?:number,
|
|
8
|
+
onChange?:FormEventHandler<JBPaginationWebComponent>
|
|
9
|
+
showPersianNumber?:boolean,
|
|
10
|
+
}
|
package/react/lib/Content.tsx
CHANGED
|
@@ -16,7 +16,7 @@ export type ContentProps = {
|
|
|
16
16
|
}
|
|
17
17
|
function Content(props:ContentProps) {
|
|
18
18
|
const {refreshBtnClick,config,isErrorOccurred,styles,isLoading,setSortColumn,i18n} = props;
|
|
19
|
-
const ErrorComponent = props.errorComponent || <ContentError onRefreshBtnClick={refreshBtnClick} message={i18n.messages?.serverErrorText} title={i18n.messages?.serverErrorTitle} refreshButtonTitle={i18n.messages
|
|
19
|
+
const ErrorComponent = props.errorComponent || <ContentError onRefreshBtnClick={refreshBtnClick} message={i18n.messages?.serverErrorText} title={i18n.messages?.serverErrorTitle} refreshButtonTitle={i18n.messages!.serverErrorRefreshButtonTitle}></ContentError>;
|
|
20
20
|
|
|
21
21
|
return (
|
|
22
22
|
<section key={'jb-grid-content'} className="jb-grid-content">
|
package/react/lib/Footer.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import type JBGridViewModel from './JBGridViewModel.js';
|
|
|
4
4
|
import CSS from './footer.css';
|
|
5
5
|
import { injectCss } from 'jb-core';
|
|
6
6
|
import { JBPagination } from './JBGrid.js';
|
|
7
|
-
import type { JBPaginationWebComponent } from '
|
|
7
|
+
import type { JBPaginationWebComponent } from 'jb-grid';
|
|
8
8
|
injectCss(CSS as unknown as string);
|
|
9
9
|
type FooterProps = {
|
|
10
10
|
vm:JBGridViewModel<any>,
|
|
@@ -49,7 +49,7 @@ function Footer(props:FooterProps) {
|
|
|
49
49
|
</div>
|
|
50
50
|
</section>
|
|
51
51
|
<section className="page-section">
|
|
52
|
-
<section className="page-size-section" title={vm.i18n.messages
|
|
52
|
+
<section className="page-size-section" title={vm.i18n.messages!.pageItemCount}>
|
|
53
53
|
<select value={vm.config.page.size} className="page-size-select" onChange={(e) => vm.onPageSizeChange(e)}>
|
|
54
54
|
<option value={20}>{vm.paginationDisplayNumbers.pageSizes[0]}</option>
|
|
55
55
|
<option value={30}>{vm.paginationDisplayNumbers.pageSizes[1]}</option>
|
|
@@ -61,8 +61,8 @@ function Footer(props:FooterProps) {
|
|
|
61
61
|
<span>{vm.paginationDisplayNumbers.startItemIndex}</span>
|
|
62
62
|
<span>-</span>
|
|
63
63
|
<span> {vm.paginationDisplayNumbers.endItemIndex} </span>
|
|
64
|
-
<span> {vm.i18n.messages
|
|
65
|
-
<span title={vm.i18n.messages
|
|
64
|
+
<span> {vm.i18n.messages!.from}</span>
|
|
65
|
+
<span title={vm.i18n.messages!.currentAvailableItem}> {vm.paginationDisplayNumbers.totalItemsCount} </span>
|
|
66
66
|
|
|
67
67
|
</section>
|
|
68
68
|
<section className="navigation-section nav-btn">
|
package/react/lib/JBGrid.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import React, { type ReactNode, useEffect } from 'react';
|
|
|
2
2
|
import JBGridViewModel, { JBGridContext } from './JBGridViewModel.js';
|
|
3
3
|
import { observer } from 'mobx-react';
|
|
4
4
|
import CSS from './jb-grid.css';
|
|
5
|
+
import BlobCSS from './Components/blob-loading.css';
|
|
5
6
|
export { JBGridData } from './JBGridData.js';
|
|
6
7
|
import 'jb-searchbar';
|
|
7
8
|
import type { AnyObject, JBGridBridgeClassInterface, JBGridConfig, JBGridI18nConfig, SearchbarConfig } from './types.js';
|
|
@@ -12,9 +13,10 @@ import { useInstance } from 'jb-core/react';
|
|
|
12
13
|
import { injectCss } from 'jb-core';
|
|
13
14
|
|
|
14
15
|
export {JBPagination, type Props as PaginationProps} from './Components/Pagination.js';
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
16
|
+
export { JBRow } from './Components/Row.js';
|
|
17
|
+
export { JBCell } from './Components/Cell.js';
|
|
17
18
|
export { ExpandRow } from './Components/ExpandRow.js';
|
|
19
|
+
export { JBExpandToggle } from './Components/ExpandToggle.js';
|
|
18
20
|
export * from './types.js';
|
|
19
21
|
export type Props<T extends AnyObject> = {
|
|
20
22
|
searchbarConfig?: SearchbarConfig | null | undefined,
|
|
@@ -32,6 +34,7 @@ export type Props<T extends AnyObject> = {
|
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
injectCss(CSS as unknown as string);
|
|
37
|
+
injectCss(BlobCSS as unknown as string);
|
|
35
38
|
|
|
36
39
|
function JBGridComponent<T extends AnyObject>(props: Props<T>) {
|
|
37
40
|
const vm = useInstance(JBGridViewModel<AnyObject>, [props.onFullscreenChange, props.config, props.bridge]);
|
|
@@ -32,7 +32,7 @@ class JBGridViewModel<T extends AnyObject> {
|
|
|
32
32
|
searchbar: React.createRef<JBSearchbarWebComponent>()
|
|
33
33
|
}
|
|
34
34
|
//the whole component DOM store(referenced) in this variable
|
|
35
|
-
JBGridComponentDom: RefObject<HTMLDivElement> = React.createRef();
|
|
35
|
+
JBGridComponentDom: RefObject<HTMLDivElement | null> = React.createRef();
|
|
36
36
|
//keep wrapper DOM element for some purpose like wrapper changing in full screen functionality
|
|
37
37
|
gridWrapperElement: HTMLElement | null = null;
|
|
38
38
|
//when we start fetch new data from server it get true until load data is finished
|
|
@@ -51,8 +51,8 @@ class JBGridViewModel<T extends AnyObject> {
|
|
|
51
51
|
onFullscreenChange: () => { console.error('you must set onFullscreenChange callback to jb-grid component if you want it to work'); }
|
|
52
52
|
}
|
|
53
53
|
config: JBGridConfig<T>;
|
|
54
|
-
i18n
|
|
55
|
-
constructor(onFullscreenChange: (isFullScreen: boolean) => void, config: JBGridConfigInterface<T>, bridge: JBGridBridgeClassInterface) {
|
|
54
|
+
i18n!: JBGridI18nConfig;
|
|
55
|
+
constructor(onFullscreenChange: ((isFullScreen: boolean) => void) | undefined, config: JBGridConfigInterface<T>, bridge: JBGridBridgeClassInterface) {
|
|
56
56
|
makeObservable(this, {
|
|
57
57
|
styles: observable,
|
|
58
58
|
isLoading: observable,
|
|
@@ -138,7 +138,7 @@ class JBGridViewModel<T extends AnyObject> {
|
|
|
138
138
|
}
|
|
139
139
|
initFilter(searchbarConfig: SearchbarConfig | null) {
|
|
140
140
|
if (searchbarConfig && this.elements.searchbar.current) {
|
|
141
|
-
this.elements.searchbar.current.
|
|
141
|
+
this.elements.searchbar.current.filterList = searchbarConfig.columnList;
|
|
142
142
|
this.elements.searchbar.current.searchOnChange = searchbarConfig.searchOnChange === true ? searchbarConfig.searchOnChange : false;
|
|
143
143
|
this.elements.searchbar.current.addEventListener('search', (e) => {
|
|
144
144
|
this.elements.searchbar.current!.isLoading = true;
|
|
@@ -171,7 +171,7 @@ class JBGridViewModel<T extends AnyObject> {
|
|
|
171
171
|
}
|
|
172
172
|
});
|
|
173
173
|
this.styles.table.generalCols.gridTemplateColumns = gridTemplateColumns;
|
|
174
|
-
this.styles.table.fullWidthCol.gridColumn =
|
|
174
|
+
this.styles.table.fullWidthCol.gridColumn = `1 / ${this.config.table.columns.length + 1}`;
|
|
175
175
|
}
|
|
176
176
|
getScrollbarWidth() {
|
|
177
177
|
const outer = document.createElement("div");
|
|
@@ -370,7 +370,7 @@ class JBGridViewModel<T extends AnyObject> {
|
|
|
370
370
|
this.JBGridComponentDom;
|
|
371
371
|
const child = document.createElement('div');
|
|
372
372
|
child.innerHTML = "";
|
|
373
|
-
this.gridWrapperElement = this.JBGridComponentDom!.current
|
|
373
|
+
this.gridWrapperElement = this.JBGridComponentDom!.current!.parentElement!;
|
|
374
374
|
container.append(this.JBGridComponentDom.current as Node);
|
|
375
375
|
//TODO:call on full screen call back
|
|
376
376
|
}
|
|
@@ -378,7 +378,7 @@ class JBGridViewModel<T extends AnyObject> {
|
|
|
378
378
|
const container = document.querySelector('.jb-grid-full-screen-container') as HTMLDivElement;
|
|
379
379
|
if (this.gridWrapperElement) {
|
|
380
380
|
//put grid element back to their orginal place
|
|
381
|
-
this.gridWrapperElement.append(this.JBGridComponentDom.current);
|
|
381
|
+
this.gridWrapperElement.append(this.JBGridComponentDom.current!);
|
|
382
382
|
//remove added temp fullscreen container
|
|
383
383
|
}
|
|
384
384
|
container[0].remove();
|
|
@@ -402,9 +402,9 @@ class JBGridViewModel<T extends AnyObject> {
|
|
|
402
402
|
changePageNumberToInput() {
|
|
403
403
|
//when user click on page number
|
|
404
404
|
//TODO: change page Input method to text input
|
|
405
|
-
const pageNumber: string | null = prompt(this.i18n.messages
|
|
406
|
-
if (pageNumber &&
|
|
407
|
-
this.goToPage(
|
|
405
|
+
const pageNumber: string | null = prompt(this.i18n.messages?.EnterPageNumberMessage, this.config.page.totalPages.toString());
|
|
406
|
+
if (pageNumber && Number(pageNumber) > 0 && Number(pageNumber) < this.config.page.totalPages) {
|
|
407
|
+
this.goToPage(Number(pageNumber));
|
|
408
408
|
}
|
|
409
409
|
}
|
|
410
410
|
openSearchHeaderSection() {
|
|
@@ -438,7 +438,7 @@ class JBGridViewModel<T extends AnyObject> {
|
|
|
438
438
|
if (this.i18n.showPersianNumber) {
|
|
439
439
|
const inputString = input.toString();
|
|
440
440
|
const correctedString = inputString.replace(/[0-9]/g, function (word) {
|
|
441
|
-
return String.fromCharCode(1776 +
|
|
441
|
+
return String.fromCharCode(1776 + Number(word));
|
|
442
442
|
});
|
|
443
443
|
return correctedString;
|
|
444
444
|
}
|
package/react/lib/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { FilterItem, JBSearchbarValue } from "jb-searchbar";
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
// export type JBGridRowData = {
|
|
@@ -52,7 +52,7 @@ export type JBGridFilter = {
|
|
|
52
52
|
value: JBSearchbarValue
|
|
53
53
|
}
|
|
54
54
|
export type SearchbarConfig = {
|
|
55
|
-
columnList:
|
|
55
|
+
columnList: FilterItem[],
|
|
56
56
|
searchOnChange?: boolean
|
|
57
57
|
}
|
|
58
58
|
export interface JBGridBridgeInterface {
|
package/react/package.json
CHANGED
package/react/tsconfig.json
CHANGED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
@custom-media --tablet-until (max-width: 768px);
|
|
2
|
-
|
|
3
|
-
.jb-grid-wrapper .jb-grid-content{
|
|
4
|
-
.jb-grid-expand-row{
|
|
5
|
-
width: 100%;
|
|
6
|
-
min-height: 4rem;
|
|
7
|
-
padding-block: 1rem;
|
|
8
|
-
padding-inline: 2rem;
|
|
9
|
-
border-bottom: 1px solid #ebebeb;
|
|
10
|
-
box-sizing: border-box;
|
|
11
|
-
overflow: auto;
|
|
12
|
-
transition: all 500ms 0s linear;
|
|
13
|
-
max-height: 100%;
|
|
14
|
-
/* TODO: change this to nth-child(even of .jb-grid-expand-row) when supported in future. Done:) i just comment it for test
|
|
15
|
-
&:nth-of-type(even) {
|
|
16
|
-
background: #f9f9f9;
|
|
17
|
-
} */
|
|
18
|
-
@media (--tablet-until){
|
|
19
|
-
border-bottom:none;
|
|
20
|
-
}
|
|
21
|
-
&:nth-child(even of .jb-grid-expand-row){
|
|
22
|
-
background: #f9f9f9;
|
|
23
|
-
}
|
|
24
|
-
&.--hidden{
|
|
25
|
-
max-height: 0;
|
|
26
|
-
padding-block: 0;
|
|
27
|
-
min-height: 0;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.expand-row-content{
|
|
31
|
-
transition: all 500ms 0s ease;
|
|
32
|
-
clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 100%);
|
|
33
|
-
&.--hidden{
|
|
34
|
-
clip-path: polygon(0 0, 100% 0, 100% 0%, 0% 0%);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
@custom-media --tablet-until (max-width: 768px);
|
|
2
|
-
|
|
3
|
-
.jb-grid-wrapper .jb-grid-content{
|
|
4
|
-
.jb-grid-table-row {
|
|
5
|
-
width: 100%;
|
|
6
|
-
display: grid;
|
|
7
|
-
grid-template-columns: auto;
|
|
8
|
-
background-color: #fff;
|
|
9
|
-
box-sizing: border-box;
|
|
10
|
-
grid-auto-rows: minmax(48px, auto);
|
|
11
|
-
@media(--tablet-until) {
|
|
12
|
-
grid-template-columns: auto !important;
|
|
13
|
-
grid-template-rows: auto;
|
|
14
|
-
border-radius: 24px;
|
|
15
|
-
box-shadow: 0px 0px 1px 0px #d8d8d8;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
&:nth-of-type(even) {
|
|
19
|
-
background: var(--base-grid-row-color);
|
|
20
|
-
@media(--tablet-until) {
|
|
21
|
-
background: #fff;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|