@tachybase/client 1.6.23 → 1.6.25
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/es/built-in/attachment-preview/index.mjs +2 -1
- package/es/built-in/attachment-preview/previewers/file-docx.d.ts +6 -0
- package/es/built-in/attachment-preview/previewers/file-docx.mjs +51 -0
- package/es/built-in/attachment-preview/previewers/file-docx.style.d.ts +3 -0
- package/es/built-in/attachment-preview/previewers/file-docx.style.mjs +25 -0
- package/es/built-in/attachment-preview/previewers/index.d.ts +1 -0
- package/es/built-in/attachment-preview/previewers/index.mjs +1 -0
- package/es/schema-component/antd/table-v2/Table.Column.ActionBar.mjs +1 -1
- package/lib/built-in/attachment-preview/index.js +1 -0
- package/lib/built-in/attachment-preview/previewers/file-docx.js +85 -0
- package/lib/built-in/attachment-preview/previewers/file-docx.style.js +59 -0
- package/lib/built-in/attachment-preview/previewers/index.js +9 -0
- package/lib/schema-component/antd/table-v2/Table.Column.ActionBar.js +1 -1
- package/package.json +2 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Plugin } from "../../application/Plugin.mjs";
|
|
2
|
-
import { fileCSV, fileDef, filePdf, fileXLS, fileXLSX, imagePng, imageSvg, imagejpeg } from "./previewers/index.mjs";
|
|
2
|
+
import { fileCSV, fileDef, fileDocx, filePdf, fileXLS, fileXLSX, imagePng, imageSvg, imagejpeg } from "./previewers/index.mjs";
|
|
3
3
|
class AttachmentPreviewPlugin extends Plugin {
|
|
4
4
|
async load() {
|
|
5
5
|
this.app.AttachmentPreviewManager.add(imagePng);
|
|
@@ -10,6 +10,7 @@ class AttachmentPreviewPlugin extends Plugin {
|
|
|
10
10
|
this.app.AttachmentPreviewManager.add(fileXLS);
|
|
11
11
|
this.app.AttachmentPreviewManager.add(fileXLSX);
|
|
12
12
|
this.app.AttachmentPreviewManager.add(fileCSV);
|
|
13
|
+
this.app.AttachmentPreviewManager.add(fileDocx);
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
16
|
export { AttachmentPreviewPlugin };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
import { renderAsync } from "docx-preview";
|
|
4
|
+
import { useAPIClient } from "../../../api-client/index.mjs";
|
|
5
|
+
import { useStyles } from "./file-docx.style.mjs";
|
|
6
|
+
const ViewComponent = (props)=>{
|
|
7
|
+
const { file, prefixCls } = props;
|
|
8
|
+
return file.imageUrl && /*#__PURE__*/ jsx("img", {
|
|
9
|
+
src: "".concat(file.imageUrl).concat(file.thumbnailRule || ''),
|
|
10
|
+
style: {
|
|
11
|
+
width: '100%',
|
|
12
|
+
height: '100%'
|
|
13
|
+
},
|
|
14
|
+
alt: file.title,
|
|
15
|
+
className: "".concat(prefixCls, "-list-item-image")
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
const CheckedComponent = (props)=>{
|
|
19
|
+
const { file } = props;
|
|
20
|
+
const api = useAPIClient();
|
|
21
|
+
const ref = useRef(null);
|
|
22
|
+
const { styles } = useStyles();
|
|
23
|
+
var _file_url;
|
|
24
|
+
let fileUrl = null != (_file_url = file.url) ? _file_url : '';
|
|
25
|
+
if (fileUrl.startsWith('/storage') && window.location.origin) fileUrl = window.location.origin + fileUrl;
|
|
26
|
+
useEffect(()=>{
|
|
27
|
+
api.request({
|
|
28
|
+
url: fileUrl,
|
|
29
|
+
responseType: 'arraybuffer'
|
|
30
|
+
}).then((res)=>{
|
|
31
|
+
renderAsync(res.data, ref.current);
|
|
32
|
+
});
|
|
33
|
+
}, [
|
|
34
|
+
file.url
|
|
35
|
+
]);
|
|
36
|
+
return /*#__PURE__*/ jsx("div", {
|
|
37
|
+
className: styles.container,
|
|
38
|
+
ref: ref
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
const fileDocx = {
|
|
42
|
+
key: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
43
|
+
type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
44
|
+
viewComponet: (props)=>/*#__PURE__*/ jsx(ViewComponent, {
|
|
45
|
+
...props
|
|
46
|
+
}),
|
|
47
|
+
checkedComponent: (props)=>/*#__PURE__*/ jsx(CheckedComponent, {
|
|
48
|
+
...props
|
|
49
|
+
})
|
|
50
|
+
};
|
|
51
|
+
export { fileDocx };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createStyles } from "antd-style";
|
|
2
|
+
function _tagged_template_literal(strings, raw) {
|
|
3
|
+
if (!raw) raw = strings.slice(0);
|
|
4
|
+
return Object.freeze(Object.defineProperties(strings, {
|
|
5
|
+
raw: {
|
|
6
|
+
value: Object.freeze(raw)
|
|
7
|
+
}
|
|
8
|
+
}));
|
|
9
|
+
}
|
|
10
|
+
function _templateObject() {
|
|
11
|
+
const data = _tagged_template_literal([
|
|
12
|
+
"\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 90vh;\n overflow-x: scroll;\n overflow-y: scroll;\n .docx-wrapper {\n background: none;\n padding: 0;\n .docx {\n width: 100% !important;\n margin-bottom: 0;\n }\n }\n "
|
|
13
|
+
]);
|
|
14
|
+
_templateObject = function() {
|
|
15
|
+
return data;
|
|
16
|
+
};
|
|
17
|
+
return data;
|
|
18
|
+
}
|
|
19
|
+
const useStyles = createStyles((param)=>{
|
|
20
|
+
let { css } = param;
|
|
21
|
+
return {
|
|
22
|
+
container: css(_templateObject())
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
export { useStyles };
|
|
@@ -16,7 +16,7 @@ function _templateObject() {
|
|
|
16
16
|
const data = _tagged_template_literal([
|
|
17
17
|
"\n position: relative;\n margin: ",
|
|
18
18
|
";\n padding: ",
|
|
19
|
-
";\n
|
|
19
|
+
";\n text-align: center;\n &:hover {\n > .general-schema-designer {\n display: block;\n }\n }\n > .general-schema-designer {\n position: absolute;\n z-index: 999;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: none;\n background: var(--colorBgSettingsHover) !important;\n border: 0 !important;\n pointer-events: none;\n > .general-schema-designer-icons {\n position: absolute;\n right: 2px;\n top: 2px;\n line-height: 16px;\n pointer-events: all;\n .ant-space-item {\n background-color: var(--colorSettings);\n color: #fff;\n line-height: 16px;\n width: 16px;\n padding-left: 1px;\n align-self: stretch;\n }\n }\n }\n "
|
|
20
20
|
]);
|
|
21
21
|
_templateObject = function() {
|
|
22
22
|
return data;
|
|
@@ -38,6 +38,7 @@ class AttachmentPreviewPlugin extends Plugin_js_namespaceObject.Plugin {
|
|
|
38
38
|
this.app.AttachmentPreviewManager.add(index_js_namespaceObject.fileXLS);
|
|
39
39
|
this.app.AttachmentPreviewManager.add(index_js_namespaceObject.fileXLSX);
|
|
40
40
|
this.app.AttachmentPreviewManager.add(index_js_namespaceObject.fileCSV);
|
|
41
|
+
this.app.AttachmentPreviewManager.add(index_js_namespaceObject.fileDocx);
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
44
|
exports.AttachmentPreviewPlugin = __webpack_exports__.AttachmentPreviewPlugin;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
fileDocx: ()=>fileDocx
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const external_react_namespaceObject = require("react");
|
|
31
|
+
const external_docx_preview_namespaceObject = require("docx-preview");
|
|
32
|
+
const index_js_namespaceObject = require("../../../api-client/index.js");
|
|
33
|
+
const external_file_docx_style_js_namespaceObject = require("./file-docx.style.js");
|
|
34
|
+
const ViewComponent = (props)=>{
|
|
35
|
+
const { file, prefixCls } = props;
|
|
36
|
+
return file.imageUrl && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("img", {
|
|
37
|
+
src: "".concat(file.imageUrl).concat(file.thumbnailRule || ''),
|
|
38
|
+
style: {
|
|
39
|
+
width: '100%',
|
|
40
|
+
height: '100%'
|
|
41
|
+
},
|
|
42
|
+
alt: file.title,
|
|
43
|
+
className: "".concat(prefixCls, "-list-item-image")
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
const CheckedComponent = (props)=>{
|
|
47
|
+
const { file } = props;
|
|
48
|
+
const api = (0, index_js_namespaceObject.useAPIClient)();
|
|
49
|
+
const ref = (0, external_react_namespaceObject.useRef)(null);
|
|
50
|
+
const { styles } = (0, external_file_docx_style_js_namespaceObject.useStyles)();
|
|
51
|
+
var _file_url;
|
|
52
|
+
let fileUrl = null != (_file_url = file.url) ? _file_url : '';
|
|
53
|
+
if (fileUrl.startsWith('/storage') && window.location.origin) fileUrl = window.location.origin + fileUrl;
|
|
54
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
55
|
+
api.request({
|
|
56
|
+
url: fileUrl,
|
|
57
|
+
responseType: 'arraybuffer'
|
|
58
|
+
}).then((res)=>{
|
|
59
|
+
(0, external_docx_preview_namespaceObject.renderAsync)(res.data, ref.current);
|
|
60
|
+
});
|
|
61
|
+
}, [
|
|
62
|
+
file.url
|
|
63
|
+
]);
|
|
64
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
65
|
+
className: styles.container,
|
|
66
|
+
ref: ref
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
const fileDocx = {
|
|
70
|
+
key: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
71
|
+
type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
72
|
+
viewComponet: (props)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ViewComponent, {
|
|
73
|
+
...props
|
|
74
|
+
}),
|
|
75
|
+
checkedComponent: (props)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(CheckedComponent, {
|
|
76
|
+
...props
|
|
77
|
+
})
|
|
78
|
+
};
|
|
79
|
+
exports.fileDocx = __webpack_exports__.fileDocx;
|
|
80
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
81
|
+
"fileDocx"
|
|
82
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
83
|
+
Object.defineProperty(exports, '__esModule', {
|
|
84
|
+
value: true
|
|
85
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
useStyles: ()=>useStyles
|
|
28
|
+
});
|
|
29
|
+
const external_antd_style_namespaceObject = require("antd-style");
|
|
30
|
+
function _tagged_template_literal(strings, raw) {
|
|
31
|
+
if (!raw) raw = strings.slice(0);
|
|
32
|
+
return Object.freeze(Object.defineProperties(strings, {
|
|
33
|
+
raw: {
|
|
34
|
+
value: Object.freeze(raw)
|
|
35
|
+
}
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
function _templateObject() {
|
|
39
|
+
const data = _tagged_template_literal([
|
|
40
|
+
"\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 90vh;\n overflow-x: scroll;\n overflow-y: scroll;\n .docx-wrapper {\n background: none;\n padding: 0;\n .docx {\n width: 100% !important;\n margin-bottom: 0;\n }\n }\n "
|
|
41
|
+
]);
|
|
42
|
+
_templateObject = function() {
|
|
43
|
+
return data;
|
|
44
|
+
};
|
|
45
|
+
return data;
|
|
46
|
+
}
|
|
47
|
+
const useStyles = (0, external_antd_style_namespaceObject.createStyles)((param)=>{
|
|
48
|
+
let { css } = param;
|
|
49
|
+
return {
|
|
50
|
+
container: css(_templateObject())
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
exports.useStyles = __webpack_exports__.useStyles;
|
|
54
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
55
|
+
"useStyles"
|
|
56
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
57
|
+
Object.defineProperty(exports, '__esModule', {
|
|
58
|
+
value: true
|
|
59
|
+
});
|
|
@@ -3,6 +3,9 @@ var __webpack_modules__ = {
|
|
|
3
3
|
"./file-default": function(module) {
|
|
4
4
|
module.exports = require("./file-default.js");
|
|
5
5
|
},
|
|
6
|
+
"./file-docx": function(module) {
|
|
7
|
+
module.exports = require("./file-docx.js");
|
|
8
|
+
},
|
|
6
9
|
"./file-pdf": function(module) {
|
|
7
10
|
module.exports = require("./file-pdf.js");
|
|
8
11
|
},
|
|
@@ -98,6 +101,12 @@ var __webpack_exports__ = {};
|
|
|
98
101
|
return _image_svg__WEBPACK_IMPORTED_MODULE_5__[key];
|
|
99
102
|
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
100
103
|
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
104
|
+
var _file_docx__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("./file-docx");
|
|
105
|
+
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
106
|
+
for(var __WEBPACK_IMPORT_KEY__ in _file_docx__WEBPACK_IMPORTED_MODULE_6__)if ("default" !== __WEBPACK_IMPORT_KEY__) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
107
|
+
return _file_docx__WEBPACK_IMPORTED_MODULE_6__[key];
|
|
108
|
+
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
109
|
+
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
101
110
|
})();
|
|
102
111
|
for(var __webpack_i__ in __webpack_exports__)exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
103
112
|
Object.defineProperty(exports, '__esModule', {
|
|
@@ -45,7 +45,7 @@ function _templateObject() {
|
|
|
45
45
|
const data = _tagged_template_literal([
|
|
46
46
|
"\n position: relative;\n margin: ",
|
|
47
47
|
";\n padding: ",
|
|
48
|
-
";\n
|
|
48
|
+
";\n text-align: center;\n &:hover {\n > .general-schema-designer {\n display: block;\n }\n }\n > .general-schema-designer {\n position: absolute;\n z-index: 999;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: none;\n background: var(--colorBgSettingsHover) !important;\n border: 0 !important;\n pointer-events: none;\n > .general-schema-designer-icons {\n position: absolute;\n right: 2px;\n top: 2px;\n line-height: 16px;\n pointer-events: all;\n .ant-space-item {\n background-color: var(--colorSettings);\n color: #fff;\n line-height: 16px;\n width: 16px;\n padding-left: 1px;\n align-self: stretch;\n }\n }\n }\n "
|
|
49
49
|
]);
|
|
50
50
|
_templateObject = function() {
|
|
51
51
|
return data;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tachybase/client",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.25",
|
|
4
4
|
"homepage": "https://github.com/tegojs/tego-standard#readme",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/tegojs/tego-standard/issues"
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"d3-format": "^3.1.0",
|
|
45
45
|
"dayjs": "1.11.13",
|
|
46
46
|
"deepmerge": "^4.3.1",
|
|
47
|
+
"docx-preview": "^0.3.7",
|
|
47
48
|
"file-saver": "^2.0.5",
|
|
48
49
|
"flat": "^5.0.2",
|
|
49
50
|
"i18next": "25.10.10",
|