techsbcn-storybook 0.14.1 → 0.14.2

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.
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ interface ImageTableComponentProps {
3
+ readFile: (guid: string) => Promise<any>;
4
+ guid: string;
5
+ convertImage?: (result: any) => string;
6
+ }
7
+ declare const ImageTableComponent: React.FC<ImageTableComponentProps>;
8
+ export default ImageTableComponent;
@@ -42,8 +42,8 @@ interface ColumnProps {
42
42
  isImage?: {
43
43
  isUrl?: boolean;
44
44
  isGuid?: {
45
- guid: boolean;
46
- action: (guid: string) => string;
45
+ readFile: (guid: string) => Promise<any>;
46
+ convertImage?: (content: any) => string;
47
47
  };
48
48
  };
49
49
  isActiveFunction?: {
@@ -44,8 +44,8 @@ interface ColumnProps {
44
44
  isImage?: {
45
45
  isUrl?: boolean;
46
46
  isGuid?: {
47
- guid: boolean;
48
- action: (guid: string) => string;
47
+ readFile: (guid: string) => Promise<any>;
48
+ convertImage?: (content: any) => string;
49
49
  };
50
50
  };
51
51
  isActiveFunction?: {
@@ -0,0 +1,5 @@
1
+ export declare const downloadFileBlob: (binaryString: any) => void;
2
+ export declare const redirectDownload: (url: any, fileName: string) => void;
3
+ export declare const getImageByBlob: (binaryString: any) => string;
4
+ export declare const getImageByBase64: (content: string) => string;
5
+ export declare const toBase64: (file: Blob) => Promise<string>;
@@ -1,2 +1,3 @@
1
1
  export * from './CheckPermission';
2
2
  export * from './GroupBy';
3
+ export * from './FileDownloader';
@@ -363,6 +363,36 @@ TextFieldComponent.defaultProps = {
363
363
  type: 'text'
364
364
  };
365
365
 
366
+ var ImageTableComponent = function ImageTableComponent(props) {
367
+ var _useState = React.useState(false),
368
+ loading = _useState[0],
369
+ setLoading = _useState[1];
370
+
371
+ var _useState2 = React.useState(),
372
+ image = _useState2[0],
373
+ setImage = _useState2[1];
374
+
375
+ React.useEffect(function () {
376
+ setLoading(true);
377
+ props.readFile(props.guid).then(function (result) {
378
+ setImage(props.convertImage ? props.convertImage(result) : result);
379
+ setLoading(false);
380
+ });
381
+ }, [props]);
382
+ return React__default.createElement(material.Box, {
383
+ className: "images-table-component"
384
+ }, loading ? React__default.createElement(material.Box, {
385
+ textAlign: "center"
386
+ }, React__default.createElement(material.CircularProgress, {
387
+ className: "main-color"
388
+ })) : React__default.createElement(material.Avatar, {
389
+ alt: "-",
390
+ src: image,
391
+ className: "img-table",
392
+ variant: "square"
393
+ }));
394
+ };
395
+
366
396
  var TableComponent = function TableComponent(props) {
367
397
  var _props$isCheckTable7, _props$isCheckTable8, _props$isCheckTable9;
368
398
 
@@ -491,6 +521,12 @@ var TableComponent = function TableComponent(props) {
491
521
  className: "img-table",
492
522
  variant: "square"
493
523
  });
524
+ } else if (column.isImage.isGuid) {
525
+ return React__default.createElement(ImageTableComponent, {
526
+ guid: value,
527
+ readFile: column.isImage.isGuid.readFile,
528
+ convertImage: column.isImage.isGuid.convertImage
529
+ });
494
530
  }
495
531
  }
496
532
 
@@ -866,6 +902,12 @@ var SimpleTableComponent = function SimpleTableComponent(props) {
866
902
  className: "img-table",
867
903
  variant: "square"
868
904
  });
905
+ } else if (column.isImage.isGuid) {
906
+ return React__default.createElement(ImageTableComponent, {
907
+ guid: value,
908
+ readFile: column.isImage.isGuid.readFile,
909
+ convertImage: column.isImage.isGuid.convertImage
910
+ });
869
911
  }
870
912
  }
871
913