dtable-ui-component 5.1.11 → 5.1.12-alpha.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,58 @@
|
|
|
1
|
+
.dtable-switch {
|
|
2
|
+
flex: 1;
|
|
3
|
+
display: flex;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.dtable-switch .custom-switch {
|
|
7
|
+
width: 100%;
|
|
8
|
+
justify-content: space-between;
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.dtable-switch .custom-switch .custom-switch-description {
|
|
13
|
+
width: 192px;
|
|
14
|
+
margin: 0;
|
|
15
|
+
padding-right: 5px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.dtable-switch .custom-switch .dtable-font {
|
|
19
|
+
-webkit-transform: scale(.8);
|
|
20
|
+
transform: scale(.8);
|
|
21
|
+
display: inline-block;
|
|
22
|
+
line-height: 24px;
|
|
23
|
+
margin-right: 8px;
|
|
24
|
+
color: #666;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.dtable-switch .custom-switch-indicator {
|
|
28
|
+
width: 22px;
|
|
29
|
+
height: 12px;
|
|
30
|
+
border-radius: 6px;
|
|
31
|
+
margin-right: 10px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.dtable-switch .custom-switch-input:checked~.custom-switch-indicator:before {
|
|
35
|
+
left: 12px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.dtable-switch .custom-switch-indicator:before {
|
|
39
|
+
height: 8px;
|
|
40
|
+
width: 8px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* mobile */
|
|
44
|
+
.dtable-switch.mobile .custom-switch-indicator {
|
|
45
|
+
height: 1.25rem;
|
|
46
|
+
width: 2.25rem;
|
|
47
|
+
border-radius: 50px;
|
|
48
|
+
margin-right: 0px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.dtable-switch.mobile .custom-switch-indicator:before {
|
|
52
|
+
height: calc(1.25rem - 4px);
|
|
53
|
+
width: calc(1.25rem - 4px);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.dtable-switch.mobile .custom-switch-input:checked~.custom-switch-indicator:before {
|
|
57
|
+
left: calc(1rem + 1px);
|
|
58
|
+
}
|
|
@@ -37,38 +37,3 @@
|
|
|
37
37
|
color: #c2c2c2;
|
|
38
38
|
cursor: grab;
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
.field-item-container .dtable-switch .custom-switch {
|
|
42
|
-
width: 100%;
|
|
43
|
-
justify-content: space-between;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.field-item-container .dtable-switch .custom-switch .dtable-font {
|
|
47
|
-
-webkit-transform: scale(.8);
|
|
48
|
-
transform: scale(.8);
|
|
49
|
-
display: inline-block;
|
|
50
|
-
line-height: 24px;
|
|
51
|
-
margin-right: 8px;
|
|
52
|
-
color: #666;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.field-item-container .dtable-switch .custom-switch .custom-switch-description {
|
|
56
|
-
width: 192px;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.field-item-container .dtable-switch .custom-switch .custom-switch-indicator {
|
|
60
|
-
width: 22px;
|
|
61
|
-
height: 12px;
|
|
62
|
-
border-radius: 6px;
|
|
63
|
-
margin-right: .25rem;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.field-item-container .dtable-switch .custom-switch .custom-switch-indicator::before {
|
|
67
|
-
height: 8px;
|
|
68
|
-
width: 8px;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.field-item-container .dtable-switch .custom-switch-input:checked~.custom-switch-indicator:before {
|
|
72
|
-
left: 12px;
|
|
73
|
-
}
|
|
74
|
-
|
|
@@ -8,22 +8,18 @@ exports.default = void 0;
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _utils = require("./utils");
|
|
10
10
|
class FileItemFormatter extends _react.Component {
|
|
11
|
-
constructor() {
|
|
12
|
-
super(...arguments);
|
|
13
|
-
this.getFileIconData = item => {
|
|
14
|
-
let fileIconUrl = (0, _utils.getFileIconUrl)(item.name, item.type);
|
|
15
|
-
let fileIconData = require('./' + fileIconUrl);
|
|
16
|
-
return fileIconData;
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
11
|
render() {
|
|
20
12
|
const {
|
|
21
13
|
file
|
|
22
14
|
} = this.props;
|
|
15
|
+
const {
|
|
16
|
+
fileIconUrl,
|
|
17
|
+
isImage
|
|
18
|
+
} = (0, _utils.getFileThumbnailInfo)(file);
|
|
23
19
|
return /*#__PURE__*/_react.default.createElement("img", {
|
|
24
|
-
className: "file-item-icon",
|
|
25
|
-
src:
|
|
26
|
-
alt: file.name
|
|
20
|
+
className: "file-item-icon ".concat(isImage ? 'img' : ''),
|
|
21
|
+
src: fileIconUrl,
|
|
22
|
+
alt: (file === null || file === void 0 ? void 0 : file.name) || ''
|
|
27
23
|
});
|
|
28
24
|
}
|
|
29
25
|
}
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getFileIconUrl = void 0;
|
|
6
|
+
exports.imageCheck = exports.getFileThumbnailInfo = exports.getFileIconUrl = void 0;
|
|
7
|
+
var _utils = require("../ImageFormatter/utils");
|
|
7
8
|
const FILEEXT_ICON_MAP = {
|
|
8
9
|
// text file
|
|
9
10
|
md: 'txt.png',
|
|
@@ -52,6 +53,26 @@ const FILEEXT_ICON_MAP = {
|
|
|
52
53
|
// default
|
|
53
54
|
default: 'file.png'
|
|
54
55
|
};
|
|
56
|
+
const getFileThumbnailInfo = fileItem => {
|
|
57
|
+
let fileIconUrl;
|
|
58
|
+
let isImage;
|
|
59
|
+
if (!fileItem.name) {
|
|
60
|
+
fileIconUrl = FILEEXT_ICON_MAP['default'];
|
|
61
|
+
isImage = false;
|
|
62
|
+
} else {
|
|
63
|
+
isImage = imageCheck(fileItem.name);
|
|
64
|
+
if (isImage) {
|
|
65
|
+
fileIconUrl = (0, _utils.getImageThumbnailUrl)(fileItem.url);
|
|
66
|
+
} else {
|
|
67
|
+
fileIconUrl = require('./' + getFileIconUrl(fileItem.name, fileItem.type));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
fileIconUrl,
|
|
72
|
+
isImage
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
exports.getFileThumbnailInfo = getFileThumbnailInfo;
|
|
55
76
|
const getFileIconUrl = (filename, direntType) => {
|
|
56
77
|
if (typeof direntType === 'string' && direntType === 'dir') {
|
|
57
78
|
return 'assets/folder/' + FILEEXT_ICON_MAP['folder'];
|
|
@@ -64,4 +85,15 @@ const getFileIconUrl = (filename, direntType) => {
|
|
|
64
85
|
const iconUrl = FILEEXT_ICON_MAP[file_ext] ? 'assets/file/192/' + FILEEXT_ICON_MAP[file_ext] : 'assets/file/192/' + FILEEXT_ICON_MAP['default'];
|
|
65
86
|
return iconUrl;
|
|
66
87
|
};
|
|
67
|
-
exports.getFileIconUrl = getFileIconUrl;
|
|
88
|
+
exports.getFileIconUrl = getFileIconUrl;
|
|
89
|
+
const imageCheck = filename => {
|
|
90
|
+
// no file ext
|
|
91
|
+
if (!filename || typeof filename !== 'string') return false;
|
|
92
|
+
if (filename.lastIndexOf('.') === -1) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
const file_ext = filename.substr(filename.lastIndexOf('.') + 1).toLowerCase();
|
|
96
|
+
const image_exts = ['gif', 'jpeg', 'jpg', 'png', 'ico', 'bmp', 'tif', 'tiff', 'webp'];
|
|
97
|
+
return image_exts.includes(file_ext);
|
|
98
|
+
};
|
|
99
|
+
exports.imageCheck = imageCheck;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dtable-ui-component",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.12-alpha.2",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@seafile/react-image-lightbox": "2.0.5",
|
|
@@ -143,7 +143,7 @@
|
|
|
143
143
|
"terser-webpack-plugin": "^5.2.5",
|
|
144
144
|
"url-loader": "^4.1.1",
|
|
145
145
|
"web-vitals": "2.1.4",
|
|
146
|
-
"webpack": "^5.
|
|
146
|
+
"webpack": "^5.94.0",
|
|
147
147
|
"webpack-dev-server": "^4.6.0",
|
|
148
148
|
"webpack-manifest-plugin": "^4.0.2",
|
|
149
149
|
"workbox-webpack-plugin": "^6.4.1",
|