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.
- package/dist/components/tables/ImageTableComponent/ImageTableComponent.d.ts +8 -0
- package/dist/components/tables/SimpleTableComponent/SimpleTableComponent.d.ts +2 -2
- package/dist/components/tables/TableComponent/TableComponent.d.ts +2 -2
- package/dist/helpers/FileDownloader.d.ts +5 -0
- package/dist/helpers/index.d.ts +1 -0
- package/dist/techsbcn-storybook.cjs.development.js +42 -0
- package/dist/techsbcn-storybook.cjs.development.js.map +1 -1
- package/dist/techsbcn-storybook.cjs.production.min.js +1 -1
- package/dist/techsbcn-storybook.cjs.production.min.js.map +1 -1
- package/dist/techsbcn-storybook.esm.js +49 -7
- package/dist/techsbcn-storybook.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/tables/ImageTableComponent/ImageTableComponent.tsx +35 -0
- package/src/components/tables/SimpleTableComponent/SimpleTableComponent.tsx +11 -2
- package/src/components/tables/TableComponent/TableComponent.tsx +11 -2
- package/src/data/UserList.tsx +7 -6
- package/src/helpers/FileDownloader.tsx +34 -0
- package/src/helpers/index.tsx +1 -0
- package/src/stories/Forms/Forms.stories.tsx +1 -0
|
@@ -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;
|
|
@@ -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>;
|
package/dist/helpers/index.d.ts
CHANGED
|
@@ -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
|
|