@evoke-platform/ui-components 1.0.0-dev.148 → 1.0.0-dev.149-test-1056

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.
@@ -18,6 +18,7 @@ export declare type FormFieldProps = {
18
18
  rows?: number;
19
19
  inputMaskPlaceholderChar?: string;
20
20
  queryAddresses?: Function;
21
+ instance?: any;
21
22
  };
22
23
  export declare type ObjectProperty = {
23
24
  id: string;
@@ -50,7 +50,7 @@ const FormField = (props) => {
50
50
  control = React.createElement(Select, Object.assign({}, commonProps));
51
51
  break;
52
52
  default:
53
- control = (React.createElement(InputFieldComponent, Object.assign({}, commonProps, { mask: mask, inputMaskPlaceholderChar: inputMaskPlaceholderChar, isMultiLineText: isMultiLineText, rows: rows })));
53
+ control = (React.createElement(InputFieldComponent, Object.assign({}, commonProps, { instance: props.instance, mask: mask, inputMaskPlaceholderChar: inputMaskPlaceholderChar, isMultiLineText: isMultiLineText, rows: rows })));
54
54
  break;
55
55
  }
56
56
  return control;
@@ -27,13 +27,15 @@ export const NumericFormat = (props) => {
27
27
  };
28
28
  const InputFieldComponent = (props) => {
29
29
  var _a;
30
- const { property, defaultValue, error, errorMessage, onBlur, readOnly, required, size, placeholder, mask, min, max, isMultiLineText, rows, inputMaskPlaceholderChar, } = props;
30
+ const { property, defaultValue, error, errorMessage, onBlur, readOnly, required, size, placeholder, mask, min, max, isMultiLineText, rows, inputMaskPlaceholderChar, instance } = props;
31
31
  const [value, setValue] = useState(defaultValue !== null && defaultValue !== void 0 ? defaultValue : '');
32
32
  const [inputValue, setInputValue] = useState('');
33
33
  const id = property.id;
34
34
  useEffect(() => {
35
+ console.log("DefaultValue (ui-lib)", defaultValue);
36
+ console.log("instance (ui-lib)", instance);
35
37
  setValue(defaultValue !== null && defaultValue !== void 0 ? defaultValue : '');
36
- }, [defaultValue]);
38
+ }, [defaultValue, instance]);
37
39
  const handleChange = (e) => {
38
40
  const inputValue = property.type === 'integer' && /^-?\d+$/.test(e.target.value)
39
41
  ? parseInt(e.target.value, 10)
@@ -0,0 +1,5 @@
1
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
2
+ import { DataGrid as CustomDataGrid } from '../index';
3
+ declare const _default: ComponentMeta<typeof CustomDataGrid>;
4
+ export default _default;
5
+ export declare const DataGrid: ComponentStory<typeof CustomDataGrid>;
@@ -0,0 +1,44 @@
1
+ import React from 'react';
2
+ import { Grid, DataGrid as CustomDataGrid, Typography } from '../index';
3
+ const fetchData = () => {
4
+ return data;
5
+ };
6
+ const data = [
7
+ {
8
+ id: '123',
9
+ name: 'John Smith',
10
+ },
11
+ {
12
+ id: '456',
13
+ name: 'Jane Doe',
14
+ },
15
+ ];
16
+ export default {
17
+ title: 'Data Display/Data Grid',
18
+ component: CustomDataGrid,
19
+ args: {
20
+ columns: [
21
+ { field: 'id', headerName: 'ID', type: 'string', width: 400 },
22
+ { field: 'name', headerName: 'Name', type: 'string', width: 400 },
23
+ ],
24
+ rows: data,
25
+ getRowId: (row) => row.id,
26
+ onRefresh: fetchData,
27
+ sx: {
28
+ height: 'auto',
29
+ },
30
+ },
31
+ };
32
+ const DataGridTemplate = (args) => (React.createElement(Grid, { container: true, width: '100%', display: 'block' },
33
+ React.createElement(Grid, { item: true, xs: 12 },
34
+ React.createElement(Typography, { variant: "h6" }, "With filtering options:"),
35
+ React.createElement(CustomDataGrid, Object.assign({ key: 'data-grid' }, args))),
36
+ React.createElement(Grid, { item: true, xs: 12, sx: { marginTop: '14px' } },
37
+ React.createElement(Typography, { variant: "h6" }, "With title and bulk action:"),
38
+ React.createElement(CustomDataGrid, Object.assign({}, args, { key: 'data-grid-with-bulk-action', title: 'Data Grid', bulkAction: {
39
+ label: 'Bulk Action',
40
+ action: () => {
41
+ console.log('Bulk acion clicked');
42
+ },
43
+ } })))));
44
+ export const DataGrid = DataGridTemplate.bind({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evoke-platform/ui-components",
3
- "version": "1.0.0-dev.148",
3
+ "version": "1.0.0-dev.149-test-1056",
4
4
  "description": "",
5
5
  "main": "dist/published/index.js",
6
6
  "module": "dist/published/index.js",