techsbcn-storybook 0.14.7 → 0.15.0
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/SearchComponent/SearchComponent.d.ts +1 -0
- package/dist/components/tables/TableComponent/TableComponent.d.ts +1 -0
- package/dist/data/Routes.d.ts +2 -0
- package/dist/data/SelectMock.d.ts +2 -0
- package/dist/data/index.d.ts +1 -0
- package/dist/techsbcn-storybook.cjs.development.js +46 -34
- 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 +47 -35
- package/dist/techsbcn-storybook.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/fields/TextSimpleComponent/TextSimpleComponent.tsx +5 -11
- package/src/components/tables/ImageTableComponent/ImageTableComponent.tsx +11 -6
- package/src/components/tables/SearchComponent/SearchComponent.tsx +3 -1
- package/src/components/tables/SimpleTableComponent/SimpleTableComponent.tsx +6 -3
- package/src/components/tables/TableComponent/TableComponent.tsx +46 -40
- package/src/data/Routes.tsx +6 -0
- package/src/data/SelectMock.tsx +26 -0
- package/src/data/UserList.tsx +6 -0
- package/src/data/index.ts +1 -0
- package/src/stories/MainWrapper/MainWrapper.stories.tsx +8 -0
- package/src/stories/Tables/Tables.stories.tsx +13 -2
|
@@ -6,4 +6,6 @@ interface ColourOption {
|
|
|
6
6
|
export declare const colourOptions: ColourOption[];
|
|
7
7
|
export declare const ResponseHandler: (response: any) => any;
|
|
8
8
|
export declare const SearchSimple: (_filters: SearchFilters) => Promise<SearchSimpleResult[]>;
|
|
9
|
+
export declare const ResponseBlobHandler: (response: any) => any;
|
|
10
|
+
export declare const readFile: (guid: string) => Promise<any>;
|
|
9
11
|
export {};
|
package/dist/data/index.d.ts
CHANGED
|
@@ -229,13 +229,15 @@ var SearchComponent = function SearchComponent(props) {
|
|
|
229
229
|
}, React__default.createElement(material.Grid, {
|
|
230
230
|
container: true,
|
|
231
231
|
spacing: 3
|
|
232
|
-
}, props.filters && props.filters.map(function (filter, i) {
|
|
232
|
+
}, props.filters && props.filters.length > 0 && props.filters.map(function (filter, i) {
|
|
233
|
+
var _props$filtersSize, _props$filtersSize2;
|
|
234
|
+
|
|
233
235
|
return React__default.createElement(material.Grid, {
|
|
234
236
|
item: true,
|
|
235
237
|
key: i,
|
|
236
238
|
xs: 12,
|
|
237
|
-
sm: 6,
|
|
238
|
-
xl: 4
|
|
239
|
+
sm: (_props$filtersSize = props.filtersSize) != null ? _props$filtersSize : 6,
|
|
240
|
+
xl: (_props$filtersSize2 = props.filtersSize) != null ? _props$filtersSize2 : 4
|
|
239
241
|
}, filter.doubleFilter ? DoubleFilter(filter.doubleFilter) : filter.singleFilter);
|
|
240
242
|
})))));
|
|
241
243
|
};
|
|
@@ -373,12 +375,16 @@ var ImageTableComponent = function ImageTableComponent(props) {
|
|
|
373
375
|
setImage = _useState2[1];
|
|
374
376
|
|
|
375
377
|
React.useEffect(function () {
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
378
|
+
if (!image) {
|
|
379
|
+
setLoading(true);
|
|
380
|
+
props.readFile(props.guid).then(function (result) {
|
|
381
|
+
setImage(props.convertImage ? props.convertImage(result) : result);
|
|
382
|
+
setLoading(false);
|
|
383
|
+
})["catch"](function () {
|
|
384
|
+
return setLoading(false);
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
}, [props, image]);
|
|
382
388
|
return React__default.createElement(material.Box, {
|
|
383
389
|
className: "images-table-component"
|
|
384
390
|
}, loading ? React__default.createElement(material.Box, {
|
|
@@ -553,7 +559,9 @@ var TableComponent = function TableComponent(props) {
|
|
|
553
559
|
return String(value);
|
|
554
560
|
}
|
|
555
561
|
|
|
556
|
-
return
|
|
562
|
+
return React__default.createElement(_.Typography, {
|
|
563
|
+
whiteSpace: "break-spaces"
|
|
564
|
+
}, value);
|
|
557
565
|
};
|
|
558
566
|
|
|
559
567
|
var ObjectbyString = function ObjectbyString(o, s) {
|
|
@@ -631,11 +639,12 @@ var TableComponent = function TableComponent(props) {
|
|
|
631
639
|
}, React__default.createElement(_.Hidden, {
|
|
632
640
|
smDown: true
|
|
633
641
|
}, React__default.createElement(_.TableHead, null, React__default.createElement(_.TableRow, null, props.columns.map(function (column) {
|
|
634
|
-
var _props$isCheckTable10, _props$isCheckTable11, _props$isCheckTable12;
|
|
642
|
+
var _ref, _props$isCheckTable10, _props$isCheckTable11, _props$isCheckTable12;
|
|
635
643
|
|
|
644
|
+
var guid = Math.random().toString(36).substring(7);
|
|
636
645
|
return React__default.createElement(_.TableCell, {
|
|
637
646
|
className: "table-column",
|
|
638
|
-
key: column.isUnique ?
|
|
647
|
+
key: column.isUnique ? guid : column.id,
|
|
639
648
|
align: column.align ? column.align : 'center',
|
|
640
649
|
style: {
|
|
641
650
|
minWidth: column.minWidth,
|
|
@@ -643,10 +652,12 @@ var TableComponent = function TableComponent(props) {
|
|
|
643
652
|
}
|
|
644
653
|
}, column.id !== 'actions' && !column.isCheck && !column.isActiveFunction && !column.noSort ? React__default.createElement(_.TableSortLabel, {
|
|
645
654
|
className: "table-header-cell",
|
|
646
|
-
active: filters.orderBy === column.id,
|
|
655
|
+
active: (_ref = filters.orderBy === column.orderBy) != null ? _ref : column.id,
|
|
647
656
|
direction: filters.orderAsc ? 'asc' : 'desc',
|
|
648
657
|
onClick: function onClick() {
|
|
649
|
-
|
|
658
|
+
var _column$orderBy;
|
|
659
|
+
|
|
660
|
+
return createSortHandler((_column$orderBy = column.orderBy) != null ? _column$orderBy : column.id);
|
|
650
661
|
},
|
|
651
662
|
hideSortIcon: true
|
|
652
663
|
}, column.label) : column.isCheck ? React__default.createElement(_.Box, {
|
|
@@ -679,9 +690,10 @@ var TableComponent = function TableComponent(props) {
|
|
|
679
690
|
}, props.columns.map(function (column) {
|
|
680
691
|
var value = ObjectbyString(row, column.id);
|
|
681
692
|
var isItemSelected = column.isCheck && isSelected(row.id);
|
|
693
|
+
var guid = Math.random().toString(36).substring(7);
|
|
682
694
|
return React__default.createElement(_.TableCell, {
|
|
683
695
|
className: "table-cell",
|
|
684
|
-
key: column.isUnique ?
|
|
696
|
+
key: column.isUnique ? guid : column.id,
|
|
685
697
|
sx: {
|
|
686
698
|
textAlign: {
|
|
687
699
|
xs: 'left',
|
|
@@ -745,10 +757,10 @@ var TableComponent = function TableComponent(props) {
|
|
|
745
757
|
count: props.totalCount,
|
|
746
758
|
rowsPerPage: props.baseFilters.limit,
|
|
747
759
|
labelRowsPerPage: props.values.SHOWING,
|
|
748
|
-
labelDisplayedRows: function labelDisplayedRows(
|
|
749
|
-
var from =
|
|
750
|
-
to =
|
|
751
|
-
count =
|
|
760
|
+
labelDisplayedRows: function labelDisplayedRows(_ref2) {
|
|
761
|
+
var from = _ref2.from,
|
|
762
|
+
to = _ref2.to,
|
|
763
|
+
count = _ref2.count;
|
|
752
764
|
return props.values.TABLE_LABEL_DISPLAY(from, to, count);
|
|
753
765
|
},
|
|
754
766
|
page: props.baseFilters.page - 1,
|
|
@@ -931,7 +943,9 @@ var SimpleTableComponent = function SimpleTableComponent(props) {
|
|
|
931
943
|
return String(value);
|
|
932
944
|
}
|
|
933
945
|
|
|
934
|
-
return
|
|
946
|
+
return React__default.createElement(_.Typography, {
|
|
947
|
+
whiteSpace: "break-spaces"
|
|
948
|
+
}, value);
|
|
935
949
|
};
|
|
936
950
|
|
|
937
951
|
var ObjectbyString = function ObjectbyString(o, s) {
|
|
@@ -1005,9 +1019,10 @@ var SimpleTableComponent = function SimpleTableComponent(props) {
|
|
|
1005
1019
|
if (column.id) {
|
|
1006
1020
|
var _props$isCheckTable13, _props$isCheckTable14, _props$isCheckTable15, _props$isCheckTable16;
|
|
1007
1021
|
|
|
1022
|
+
var guid = Math.random().toString(36).substring(7);
|
|
1008
1023
|
return React__default.createElement(_.TableCell, {
|
|
1009
1024
|
className: "table-column",
|
|
1010
|
-
key: column.isUnique ?
|
|
1025
|
+
key: column.isUnique ? guid : column.id,
|
|
1011
1026
|
align: column.align ? column.align : 'center',
|
|
1012
1027
|
style: {
|
|
1013
1028
|
minWidth: column.minWidth,
|
|
@@ -1051,9 +1066,10 @@ var SimpleTableComponent = function SimpleTableComponent(props) {
|
|
|
1051
1066
|
if (column.id) {
|
|
1052
1067
|
var value = ObjectbyString(row, column.id);
|
|
1053
1068
|
var isItemSelected = column.isCheck && isSelected(row.id);
|
|
1069
|
+
var guid = Math.random().toString(36).substring(7);
|
|
1054
1070
|
return React__default.createElement(_.TableCell, {
|
|
1055
1071
|
className: "table-cell",
|
|
1056
|
-
key: column.isUnique ?
|
|
1072
|
+
key: column.isUnique ? guid : column.id,
|
|
1057
1073
|
sx: {
|
|
1058
1074
|
textAlign: {
|
|
1059
1075
|
xs: 'left',
|
|
@@ -1519,17 +1535,6 @@ var TextSimpleComponent = function TextSimpleComponent(props) {
|
|
|
1519
1535
|
});
|
|
1520
1536
|
}
|
|
1521
1537
|
|
|
1522
|
-
var ChildrenValues = function ChildrenValues() {
|
|
1523
|
-
return React__default.createElement(React__default.Fragment, null, props.startIcon && React__default.createElement(_.Box, {
|
|
1524
|
-
mr: 1
|
|
1525
|
-
}, props.startIcon), props.isLoading ? React__default.createElement(_.CircularProgress, {
|
|
1526
|
-
className: "circular-progress-main-color",
|
|
1527
|
-
size: 20
|
|
1528
|
-
}) : props.value, props.endIcon && React__default.createElement(_.Box, {
|
|
1529
|
-
ml: "" + (props.fullWidth ? 'auto' : 1)
|
|
1530
|
-
}, props.endIcon));
|
|
1531
|
-
};
|
|
1532
|
-
|
|
1533
1538
|
return React__default.createElement(_.Box, {
|
|
1534
1539
|
className: "text-simple-component",
|
|
1535
1540
|
display: "flex",
|
|
@@ -1546,7 +1551,14 @@ var TextSimpleComponent = function TextSimpleComponent(props) {
|
|
|
1546
1551
|
alignItems: "center",
|
|
1547
1552
|
className: "text-simple-box " + ((_props$className = props.className) != null ? _props$className : '') + " " + (props.noMargin ? 'no-margin' : '') + " " + (props.noBorders || props.skeletonValue && props.skeletonValue.useSkeleton ? 'no-border' : '') + " " + (props.error ? 'has-error-border' : ''),
|
|
1548
1553
|
width: "" + (props.fullWidth ? 'auto' : 'fit-content')
|
|
1549
|
-
}, props.skeletonValue && props.skeletonValue.useSkeleton ? React__default.createElement(SkeletonCompleteDefault, Object.assign({}, props.skeletonValue)) : React__default.createElement(
|
|
1554
|
+
}, props.skeletonValue && props.skeletonValue.useSkeleton ? React__default.createElement(SkeletonCompleteDefault, Object.assign({}, props.skeletonValue)) : React__default.createElement(React__default.Fragment, null, props.startIcon && React__default.createElement(_.Box, {
|
|
1555
|
+
mr: 1
|
|
1556
|
+
}, props.startIcon), props.isLoading ? React__default.createElement(_.CircularProgress, {
|
|
1557
|
+
className: "circular-progress-main-color",
|
|
1558
|
+
size: 20
|
|
1559
|
+
}) : props.value, props.endIcon && React__default.createElement(_.Box, {
|
|
1560
|
+
ml: "" + (props.fullWidth ? 'auto' : 1)
|
|
1561
|
+
}, props.endIcon))), props.helperText && React__default.createElement(_.Box, {
|
|
1550
1562
|
className: "helper-text " + (props.error ? 'has-error' : '')
|
|
1551
1563
|
}, props.skeletonValue && props.skeletonValue.useSkeleton ? React__default.createElement(_.Skeleton, {
|
|
1552
1564
|
width: "15%",
|