jb-grid 0.3.3 → 0.4.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 CHANGED
@@ -1,13 +1,26 @@
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 adn Row, Cell.
3
+ [![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://www.webcomponents.org/element/jb-grid)
4
+ [![GitHub license](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://raw.githubusercontent.com/javadbat/jb-grid/main/LICENSE)
5
+ [![NPM Version](https://img.shields.io/npm/v/jb-grid)](https://www.npmjs.com/package/jb-grid)
6
+ ![GitHub Created At](https://img.shields.io/github/created-at/javadbat/jb-grid)
4
7
 
5
- ## using with JS frameworks
8
+ > currently this component only available in react in full mode and web-component is only support parts of the data grid like pagination and Row, Cell.
6
9
 
7
- to use this component in **react** see [`jb-grid/react`](https://github.com/javadbat/jb-grid/tree/main/react);
10
+ ## Using With JS Frameworks
11
+ - [<img src="https://img.shields.io/badge/React.js-jb--grid%2Freact-000.svg?logo=react&logoColor=%2361DAFB" height="30" />](https://github.com/javadbat/jb-grid/tree/main/react)
8
12
 
9
13
  ## Pagination
10
14
  for pagination we use `jb-pagination` web-component
15
+
16
+ ### jb-pagination API
17
+
18
+ | name | type | description |
19
+ | --- | --- | --- |
20
+ | `pageIndex` | property | Current page index. |
21
+ | `min` | property | Minimum page index. |
22
+ | `max` | property | Maximum page index. |
23
+
11
24
  ```html
12
25
  <jb-pagination />
13
26
  ```
@@ -23,8 +36,16 @@ document.querySelector(`jb-pagination`).max = 10;
23
36
  document.querySelector(`jb-pagination`).min = 0;
24
37
  ```
25
38
 
39
+ For the standalone pagination API and CSS variables, see [jb-pagination README](https://javadbat.github.io/design-system/?path=/docs/components-jbgrid-jbpagination-readme--docs).
40
+
41
+ ### jb-pagination CSS variables
42
+
43
+ | CSS variable name | description |
44
+ | --- | --- |
45
+ | --jb-pagination-index-width | Width of each page index button. |
46
+
26
47
  ## 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.
48
+ `jb-row` is a row web-component that imply a grid template based on given config to below cells. it also accept expand row that you can open and close it.
28
49
 
29
50
  here is a code overview:
30
51
  ```html
@@ -36,6 +57,7 @@ here is a code overview:
36
57
  <div slot="expand">expand window content</div>
37
58
  </jb-row>
38
59
  ```
60
+
39
61
  ### Set Column Size
40
62
 
41
63
  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.
@@ -67,4 +89,13 @@ if you want to close and open by js you can use js mode:
67
89
  document.querySelector(`jb-row`).isOpen = true;
68
90
  // to close it
69
91
  document.querySelector(`jb-row`).isOpen = false;
92
+ ```
93
+
94
+ ### Ellipses Cell
95
+
96
+ if your cell content is a long text need to get ellipses on overflow add `ellipsis` attribute to the `jb-cell` and `ellipsis="max line"` for multiline
97
+ ```html
98
+ <jb-cell ellipsis>Put Long Text Here</jb-cell>
99
+ <!-- Limited Browser Support for Multiline -->
100
+ <jb-cell ellipsis="3">Put Long Text Here</jb-cell>
70
101
  ```
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "web component",
15
15
  "react component"
16
16
  ],
17
- "version": "0.3.3",
17
+ "version": "0.4.0",
18
18
  "bugs": "https://github.com/javadbat/jb-grid/issues",
19
19
  "license": "MIT",
20
20
  "files": [
package/react/README.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # jb-grid React component
2
2
 
3
+ [![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://www.webcomponents.org/element/jb-grid)
4
+ [![GitHub license](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://raw.githubusercontent.com/javadbat/jb-grid/main/LICENSE)
5
+ [![NPM Version](https://img.shields.io/npm/v/jb-grid-react)](https://www.npmjs.com/package/jb-grid-react)
6
+ ![GitHub Created At](https://img.shields.io/github/created-at/javadbat/jb-grid)
7
+
3
8
  react mobx table grid with pagination, filtering and sorting functionality.
4
9
 
5
10
  - responsive
@@ -33,7 +38,7 @@ import {filterConfig} from './my-filter-config';
33
38
  ### config
34
39
 
35
40
  config is unique for each data table you want to show and contains information about columns,filters,sort,initData,...
36
- you can create your own config from scratch using Mobx class Stores that implements `JBGridConfigInterface` or just create instance of `JBGridData` and start to config it's fields base on your need.
41
+ you can create your own config from scratch using Mobx class Stores that implements `JBGridConfigInterface` or just create instance of `JBGridData` and start to config it's fields based on your need.
37
42
 
38
43
  ```js
39
44
  import { JBGridData } from "jb-grid/react";
@@ -68,7 +73,7 @@ yourConfig.table.columns = [
68
73
  name: 'age',
69
74
  title: 'سن',
70
75
  sortable: false,
71
- //if you dont set width , it will be '1fr' mean it get 1 share of width from free space
76
+ //if you don't set width , it will be '1fr' mean it get 1 share of width from free space
72
77
  width: '1fr'
73
78
  },
74
79
  {
@@ -191,8 +196,12 @@ jb-grid by default is mobile friendly but when it turns to mobile view it show r
191
196
  </Row>
192
197
  ```
193
198
 
194
- ## styling
195
- | css variable name | description |
199
+ ## Styling
200
+ | CSS variable name | description |
196
201
  | ------------- | ------------- |
197
202
  | --jb-grid-loading-color | list loading color |
198
203
  | --jb-grid-page-active-color | color of active page |
204
+
205
+ ## Shared Documentation
206
+
207
+ For web-component behavior, events, slots, and CSS variables, see [`jb-grid`](https://github.com/javadbat/jb-grid).
@@ -4,7 +4,9 @@ import type { JBPaginationDirectAttributeProps } from "./types";
4
4
  import type { JBCellWebComponent, JBRowWebComponent, JBExpandToggleWebComponent } from 'jb-grid';
5
5
  type JBPaginationAttributes = DetailedHTMLProps<HTMLAttributes<JBPaginationWebComponent>, JBPaginationWebComponent> & JBPaginationDirectAttributeProps;
6
6
  export type JBRowAttributes = DetailedHTMLProps<HTMLAttributes<JBRowWebComponent>, JBRowWebComponent>;
7
- export type JBCellAttributes = DetailedHTMLProps<HTMLAttributes<JBCellWebComponent>, JBCellWebComponent>;
7
+ export type JBCellAttributes = DetailedHTMLProps<HTMLAttributes<JBCellWebComponent>, JBCellWebComponent> & {
8
+ ellipsis: boolean | number;
9
+ };
8
10
  export type JBExpandToggleAttributes = DetailedHTMLProps<HTMLAttributes<JBExpandToggleWebComponent>, JBExpandToggleWebComponent>;
9
11
  declare module "react" {
10
12
  namespace JSX {