gbs-add-block 0.0.35 → 0.0.36

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,4 +1,4 @@
1
- # GBS Building Blocks 2.0 (v0.0.35)
1
+ # GBS Building Blocks 2.0 (v0.0.36)
2
2
 
3
3
  Latest and upgraded version of GBS building blocks with headless UI and removed dependencies.
4
4
 
@@ -6,10 +6,10 @@ Latest and upgraded version of GBS building blocks with headless UI and removed
6
6
 
7
7
  For detailed documentation on usage and props, Please visit: [Building Block Documentation v2.0](https://blackmax-designs.gitbook.io/building-block-v2.0)
8
8
 
9
- ## What's New 🎉 (Ver 0.0.35)
9
+ ## What's New 🎉 (Ver 0.0.36)
10
10
 
11
- - Updated Form Renderer (Added Multi Select) with form builder
12
- - Updated Date Picker
11
+ - Updated Form Renderer with form builder and AI support
12
+ - Updated Grid
13
13
 
14
14
  ## Authors
15
15
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gbs-add-block",
3
- "version": "0.0.35",
3
+ "version": "0.0.36",
4
4
  "description": "React Component Library",
5
5
  "files": [
6
6
  "index.js",
@@ -45,6 +45,7 @@ const InputHandles = ({
45
45
  {item?.label && (
46
46
  <label htmlFor={item.name} className="font-medium text-sm">
47
47
  {item.label}
48
+ {item.required && <span className="text-red-500">*</span>}
48
49
  </label>
49
50
  )}
50
51
  <Input
@@ -40,6 +40,7 @@ export default function MultiHandles({
40
40
  {item?.label && (
41
41
  <label htmlFor={item.name} className="font-medium text-sm">
42
42
  {item.label}
43
+ {item.required && <span className="text-red-500">*</span>}
43
44
  </label>
44
45
  )}
45
46
  <MultiSelect
@@ -116,6 +116,7 @@ export default function SelectHandles({
116
116
  {item?.label && (
117
117
  <label htmlFor={item.name} className="font-medium text-sm">
118
118
  {item.label}
119
+ {item.required && <span className="text-red-500">*</span>}
119
120
  </label>
120
121
  )}
121
122
  <Select
@@ -1,4 +1,5 @@
1
1
  export type FormItem = {
2
+ id?: string;
2
3
  name?: string;
3
4
  component?: string;
4
5
  type?: string;
@@ -11,6 +12,7 @@ export type FormItem = {
11
12
  key?: string;
12
13
  dependency?: string;
13
14
  hasDependents?: boolean;
15
+ isReady?: boolean;
14
16
  };
15
17
 
16
18
  interface DependencyConfig {
@@ -232,6 +232,8 @@ export const GridMemoised = forwardRef((props: GridProps, ref) => {
232
232
 
233
233
  // This will render template passed to Grid
234
234
  const renderCell = (rowData: any, column: any, rowIndex: number) => {
235
+ const cellValue = rowData[column.field];
236
+
235
237
  if (column.template) {
236
238
  return (
237
239
  <column.template
@@ -243,7 +245,18 @@ export const GridMemoised = forwardRef((props: GridProps, ref) => {
243
245
  />
244
246
  );
245
247
  }
246
- return rowData[column.field];
248
+
249
+ if (column.tooltip) {
250
+ return (
251
+ <span title={cellValue?.toString()}>
252
+ {cellValue && cellValue.length > 10
253
+ ? `${cellValue.slice(0, 10)}...`
254
+ : cellValue}
255
+ </span>
256
+ );
257
+ }
258
+
259
+ return cellValue;
247
260
  };
248
261
 
249
262
  // *** Filter Handling Functions Starts Here
@@ -0,0 +1,32 @@
1
+ const renderCell = (
2
+ rowData: any,
3
+ column: any,
4
+ rowIndex: number,
5
+ currentPage: number,
6
+ pageSettings: any,
7
+ rowChange?: any
8
+ ) => {
9
+ const cellValue = rowData[column.field];
10
+
11
+ if (column.template) {
12
+ return (
13
+ <column.template
14
+ rowData={rowData}
15
+ rowIndex={rowIndex + currentPage * pageSettings.pageNumber}
16
+ rowChange={(changes: any) => {
17
+ if (rowChange) rowChange(changes);
18
+ }}
19
+ />
20
+ );
21
+ }
22
+
23
+ if (column.tooltip) {
24
+ return (
25
+ <span title={cellValue?.toString()}>
26
+ {column.tooltip ? cellValue.slice(0, 10) : cellValue}
27
+ </span>
28
+ );
29
+ }
30
+
31
+ return cellValue;
32
+ };