mig-schema-table 3.0.25 → 3.0.26

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
@@ -3,78 +3,88 @@
3
3
  This component will render fields dynamically based on openApi schema JSON. Styling can be done using Bootstrap 5 compatible classes
4
4
 
5
5
  # Install
6
+
6
7
  ```
7
8
  npm install mig-schema-table
8
9
  ```
9
10
 
10
11
  ## Usage
12
+
11
13
  #### Schema Example:
14
+
12
15
  ```ts
13
- const userSchema ={
14
- "properties": {
15
- "id":{
16
- "type":"string",
17
- "readOnly": true
18
- },
19
- "name": {
20
- "type": "string",
21
- "minLength": 3
16
+ const userSchema = {
17
+ properties: {
18
+ id: {
19
+ type: "string",
20
+ readOnly: true,
21
+ },
22
+ name: {
23
+ type: "string",
24
+ minLength: 3,
22
25
  },
23
- "dob": {
24
- "type": "string",
25
- "format": "date"
26
+ dob: {
27
+ type: "string",
28
+ format: "date",
29
+ },
30
+ address: {
31
+ type: "string",
32
+ maxLength: 250,
26
33
  },
27
- "address": {
28
- "type": "string",
29
- "maxLength": 250
30
- }
31
34
  },
32
- "required":["name"]
33
- }
35
+ required: ["name"],
36
+ };
34
37
  ```
38
+
35
39
  ```typescript jsx
36
- import React from 'react';
37
- import { SchemaTable, IColumnConfig } from "mig-schema-table";
38
- import "mig-schema-table/dist/index.css";
40
+ import React from "react";
41
+ import { SchemaTable, IColumnConfig } from "mig-schema-table";
42
+ import "mig-schema-table/dist/index.css";
43
+ // Add this for default datepicker styling
44
+ import "react-datepicker/dist/react-datepicker.css";
45
+
46
+ const config: { [keyName: string]: IColumnConfig } = {
47
+ id: {
48
+ hidden: true,
49
+ },
50
+ dob: {
51
+ title: "Date of Birth",
52
+ },
53
+ };
39
54
 
40
- const config:{[keyName: string]: IColumnConfig} ={
41
- "id":{
42
- hidden:true
43
- },
44
- "dob":{
45
- title:"Date of Birth"
46
- }
47
- }
48
-
49
- const Table=()=>{
50
- const [users, setUsers]= useState();
51
-
52
- return <SchemaTableComponent
53
- data={users || []}
54
- schema={userSchema}
55
- width={window.innerWidth}
56
- height={window.innerHeight - 150}
57
- config={config}
58
- />
59
- }
55
+ const Table = () => {
56
+ const [users, setUsers] = useState();
57
+
58
+ return (
59
+ <SchemaTableComponent
60
+ data={users || []}
61
+ schema={userSchema}
62
+ width={window.innerWidth}
63
+ height={window.innerHeight - 150}
64
+ config={config}
65
+ />
66
+ );
67
+ };
60
68
  ```
61
69
 
62
70
  ## Component Props
63
- Prop | Type | Description |
64
- --- |----------------|-------------------------------------------------------------------------|
65
- schema | ```object``` | schemaObject to be rendered as a set of fields(example openapi schema). |
66
- config | ```object``` | custom UI config {[keyName: string]: IColumnConfig;}. |
67
- data | ```array``` | data props will be rendered from api |
68
- onRowClick | ```function``` | it will be navigate to detail of row data |
69
- width | ```number``` | this props will be calculated width of table |
70
- height | ```number``` | this props will be calculated height of table |
71
- tableTitle | ```string``` | custom title for table your own |
72
- isSearchable | ```boolean``` | if this props is ```true``` then the search filed will shown |
73
- isSortable | ```boolean``` | if this props is ```true``` then the table to be able to shorting the data |
71
+
72
+ | Prop | Type | Description |
73
+ | ------------ | ---------- | ----------------------------------------------------------------------- |
74
+ | schema | `object` | schemaObject to be rendered as a set of fields(example openapi schema). |
75
+ | config | `object` | custom UI config {[keyName: string]: IColumnConfig;}. |
76
+ | data | `array` | data props will be rendered from api |
77
+ | onRowClick | `function` | it will be navigate to detail of row data |
78
+ | width | `number` | this props will be calculated width of table |
79
+ | height | `number` | this props will be calculated height of table |
80
+ | tableTitle | `string` | custom title for table your own |
81
+ | isSearchable | `boolean` | if this props is `true` then the search filed will shown |
82
+ | isSortable | `boolean` | if this props is `true` then the table to be able to shorting the data |
74
83
 
75
84
  ## Config
85
+
76
86
  #### you can import the type of config from the IFieldConfig.
87
+
77
88
  ```ts
78
- const config: { [keyName: string]: IColumnConfig } = {}
89
+ const config: { [keyName: string]: IColumnConfig } = {};
79
90
  ```
80
-
package/dist/index.css CHANGED
@@ -1,4 +1,3 @@
1
- @import "../../node_modules/react-datepicker/dist/react-datepicker.min.css";
2
1
  .react-datepicker {
3
2
  display: flex;
4
3
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mig-schema-table",
3
- "version": "3.0.25",
3
+ "version": "3.0.26",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/"