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
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# jb-grid
|
|
2
2
|
|
|
3
|
-
> currently this component only available in react in full mode and web-component is only support parts of the data grid like pagination.
|
|
3
|
+
> currently this component only available in react in full mode and web-component is only support parts of the data grid like pagination adn Row, Cell.
|
|
4
4
|
|
|
5
5
|
## using with JS frameworks
|
|
6
6
|
|
|
@@ -21,5 +21,50 @@ document.querySelector(`jb-pagination`).pageIndex = 5;
|
|
|
21
21
|
document.querySelector(`jb-pagination`).max = 10;
|
|
22
22
|
//min page number default is 1
|
|
23
23
|
document.querySelector(`jb-pagination`).min = 0;
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Row & Cells
|
|
27
|
+
`jb-row` is a row web-component that imply a grid template base on given config to below cells. it also accept expand row that you can open and close it.
|
|
28
|
+
|
|
29
|
+
here is a code overview:
|
|
30
|
+
```html
|
|
31
|
+
<jb-row>
|
|
32
|
+
<jb-cell name="id">123<jb-cell>
|
|
33
|
+
<jb-cell name="name">Joe<jb-cell>
|
|
34
|
+
<jb-cell name="age">10<jb-cell>
|
|
35
|
+
<jb-cell name="operation"><jb-expand-toggle><button>toggle</button></jb-expand-toggle><jb-cell>
|
|
36
|
+
<div slot="expand">expand window content</div>
|
|
37
|
+
</jb-row>
|
|
38
|
+
```
|
|
39
|
+
### Set Column Size
|
|
24
40
|
|
|
41
|
+
to set column size of the row you can pass a config that tell each column size. remember size is optional(default is `1fr`) but name is mandatory.
|
|
42
|
+
```js
|
|
43
|
+
document.querySelector(""jb-row).rowTemplate = [
|
|
44
|
+
{name:"id",size:"1fr"},
|
|
45
|
+
{name:"name",size:"400px"},
|
|
46
|
+
{name:"age",size:200},
|
|
47
|
+
{name:"operation",size:20%},
|
|
48
|
+
]
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### expand row
|
|
52
|
+
|
|
53
|
+
each row can contain a expand panel that open by user choice to show more data about that row.
|
|
54
|
+
you must set `slot="expand"`in a div to make it as a expand div and set `isOpen` of row to open and close it or use `jb-expand-toggle` to do it automatically for you.
|
|
55
|
+
|
|
56
|
+
```html
|
|
57
|
+
<jb-row>
|
|
58
|
+
<jb-cell name="id">123<jb-cell>
|
|
59
|
+
<jb-cell name="operation"><jb-expand-toggle><button>toggle</button></jb-expand-toggle><jb-cell>
|
|
60
|
+
<div slot="expand">expand window content</div>
|
|
61
|
+
</jb-row>
|
|
25
62
|
```
|
|
63
|
+
> `<jb-expand-toggle>`has a arrow icon designed to be put in first cell by default but you can customize it by passing children to it as you wish
|
|
64
|
+
if you want to close and open by js you can use js mode:
|
|
65
|
+
```js
|
|
66
|
+
//to open it
|
|
67
|
+
document.querySelector(`jb-row`).isOpen = true;
|
|
68
|
+
// to close it
|
|
69
|
+
document.querySelector(`jb-row`).isOpen = false;
|
|
70
|
+
```
|
package/package.json
CHANGED
|
@@ -10,10 +10,11 @@
|
|
|
10
10
|
"jb",
|
|
11
11
|
"jb-grid",
|
|
12
12
|
"table",
|
|
13
|
+
"pagination",
|
|
13
14
|
"web component",
|
|
14
15
|
"react component"
|
|
15
16
|
],
|
|
16
|
-
"version": "0.
|
|
17
|
+
"version": "0.3.1",
|
|
17
18
|
"bugs": "https://github.com/javadbat/jb-grid/issues",
|
|
18
19
|
"license": "MIT",
|
|
19
20
|
"files": [
|
|
@@ -31,9 +32,9 @@
|
|
|
31
32
|
"url": "git@github.com:javadbat/jb-grid.git"
|
|
32
33
|
},
|
|
33
34
|
"dependencies": {
|
|
34
|
-
"jb-core":">=0.
|
|
35
|
+
"jb-core":">=0.27.2",
|
|
35
36
|
"mobx":">=6.0.0",
|
|
36
37
|
"mobx-react":">=7.0.0",
|
|
37
|
-
"jb-searchbar":">=
|
|
38
|
+
"jb-searchbar":">=3.0.2"
|
|
38
39
|
}
|
|
39
40
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
type
|
|
3
|
-
|
|
1
|
+
import React, { type ForwardedRef } from 'react';
|
|
2
|
+
import type { JBCellAttributes } from './module-declaration.js';
|
|
3
|
+
import type { JBCellWebComponent } from 'jb-grid';
|
|
4
|
+
type RowProps = JBCellAttributes & {
|
|
5
|
+
ref?: ForwardedRef<JBCellWebComponent | null>;
|
|
6
|
+
name: string;
|
|
4
7
|
label?: string;
|
|
5
|
-
className?: string;
|
|
6
|
-
flex?: boolean;
|
|
7
8
|
};
|
|
8
|
-
declare function
|
|
9
|
-
export {
|
|
9
|
+
export declare function JBCell(props: RowProps): React.JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import React, { type PropsWithChildren } from 'react';
|
|
2
|
-
declare function ExpandRow(props: Props): React.JSX.Element;
|
|
3
|
-
type Props = PropsWithChildren<
|
|
4
|
-
|
|
5
|
-
}>;
|
|
6
|
-
export { ExpandRow };
|
|
1
|
+
import React, { type HTMLAttributes, type PropsWithChildren } from 'react';
|
|
2
|
+
export declare function ExpandRow(props: Props): React.JSX.Element;
|
|
3
|
+
type Props = PropsWithChildren<React.DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
|
|
4
|
+
export {};
|
|
@@ -1,22 +1,8 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
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
|
export declare function JBPagination(props: Props): React.JSX.Element;
|
|
6
|
-
type
|
|
7
|
-
declare module "react" {
|
|
8
|
-
namespace JSX {
|
|
9
|
-
interface IntrinsicElements {
|
|
10
|
-
'jb-pagination': JBPaginationAttributes;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
type DirectAttributeProps = {
|
|
15
|
-
pageIndex?: number;
|
|
16
|
-
max?: number;
|
|
17
|
-
min?: number;
|
|
18
|
-
onChange?: FormEventHandler<JBPaginationWebComponent>;
|
|
19
|
-
showPersianNumber?: boolean;
|
|
20
|
-
};
|
|
21
|
-
export type Props = JBElementStandardProps<JBPaginationWebComponent, keyof DirectAttributeProps> & DirectAttributeProps;
|
|
22
|
-
export {};
|
|
8
|
+
export type Props = JBElementStandardProps<JBPaginationWebComponent, keyof JBPaginationDirectAttributeProps> & JBPaginationDirectAttributeProps;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
type
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import React, { type ForwardedRef } from 'react';
|
|
2
|
+
import type { JBRowAttributes } from './module-declaration.js';
|
|
3
|
+
import type { JBCellWebComponent, RowTemplate } from 'jb-grid';
|
|
4
|
+
type RowProps = JBRowAttributes & {
|
|
5
|
+
ref?: ForwardedRef<JBCellWebComponent | null>;
|
|
6
|
+
rowTemplate: RowTemplate;
|
|
7
|
+
isOpen?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare function JBRow(props: RowProps): React.JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
declare module "react" {
|
|
10
|
+
namespace JSX {
|
|
11
|
+
interface IntrinsicElements {
|
|
12
|
+
'jb-pagination': JBPaginationAttributes;
|
|
13
|
+
'jb-row': JBRowAttributes;
|
|
14
|
+
'jb-cell': JBCellAttributes;
|
|
15
|
+
'jb-expand-toggle': JBExpandToggleAttributes;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { JBPaginationWebComponent } from "jb-grid";
|
|
2
|
+
import type { FormEventHandler } from "react";
|
|
3
|
+
export type JBPaginationDirectAttributeProps = {
|
|
4
|
+
pageIndex?: number;
|
|
5
|
+
max?: number;
|
|
6
|
+
min?: number;
|
|
7
|
+
onChange?: FormEventHandler<JBPaginationWebComponent>;
|
|
8
|
+
showPersianNumber?: boolean;
|
|
9
|
+
};
|