@elice/material-pdf 1.240718.0-trasncript.2 → 1.240718.1
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/cjs/components/material-pdf/MaterialPdf.js +16 -21
- package/cjs/components/material-pdf/MaterialPdf.styled.js +1 -5
- package/cjs/components/material-pdf/MaterialPdfContent.js +24 -30
- package/es/components/material-pdf/MaterialPdf.js +16 -17
- package/es/components/material-pdf/MaterialPdf.styled.js +1 -1
- package/es/components/material-pdf/MaterialPdfContent.js +24 -26
- package/package.json +12 -9
- package/cjs/components/material-pdf/index.js +0 -7
- package/cjs/components/material-pdf/locales/index.js +0 -13
- package/es/components/material-pdf/index.js +0 -1
- package/es/components/material-pdf/locales/index.js +0 -4
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var React = require('react');
|
|
6
6
|
var intl = require('@elice/intl');
|
|
7
7
|
var classnames = require('classnames');
|
|
8
8
|
var en = require('./locales/en.json.js');
|
|
@@ -10,29 +10,24 @@ var ko = require('./locales/ko.json.js');
|
|
|
10
10
|
var MaterialPdfContent = require('./MaterialPdfContent.js');
|
|
11
11
|
var MaterialPdf_styled = require('./MaterialPdf.styled.js');
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
cMapUrl = _ref.cMapUrl,
|
|
21
|
-
__intl = _ref.__intl;
|
|
22
|
-
var prefixCls = 'em-material-pdf';
|
|
13
|
+
const MaterialPdf = ({
|
|
14
|
+
className,
|
|
15
|
+
materialPdfId,
|
|
16
|
+
cMapUrl,
|
|
17
|
+
__intl
|
|
18
|
+
}) => {
|
|
19
|
+
const prefixCls = 'em-material-pdf';
|
|
23
20
|
//
|
|
24
21
|
//
|
|
25
22
|
//
|
|
26
|
-
return
|
|
27
|
-
value: __intl
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
})
|
|
35
|
-
});
|
|
23
|
+
return React.createElement(intl.RawEliceIntlProvider, {
|
|
24
|
+
value: __intl
|
|
25
|
+
}, React.createElement(MaterialPdf_styled.StyledMaterialPdfWrapper, {
|
|
26
|
+
className: classnames(prefixCls, className)
|
|
27
|
+
}, React.createElement(MaterialPdfContent.default, {
|
|
28
|
+
materialPdfId: materialPdfId,
|
|
29
|
+
cMapUrl: cMapUrl
|
|
30
|
+
})));
|
|
36
31
|
};
|
|
37
32
|
var MaterialPdf$1 = new intl.IntlComponentBuilder(MaterialPdf).add('en', en.default).add('ko', ko.default).addAsync('th', Promise.resolve().then(function () { return require('./locales/th.json.js'); })).addAsync('ja', Promise.resolve().then(function () { return require('./locales/ja.json.js'); })).build();
|
|
38
33
|
|
|
@@ -2,11 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var styled = require('styled-components');
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
|
|
8
|
-
|
|
9
|
-
var StyledMaterialPdfWrapper = styled__default.default.div.withConfig({
|
|
5
|
+
const StyledMaterialPdfWrapper = styled.div.withConfig({
|
|
10
6
|
componentId: "sc-hovq54-0"
|
|
11
7
|
})(["margin:0;flex:2 1;height:100%;background-color:#22222c;"]);
|
|
12
8
|
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
6
5
|
var React = require('react');
|
|
7
6
|
var apiClient = require('@elice/api-client');
|
|
8
7
|
var blocks = require('@elice/blocks');
|
|
@@ -10,39 +9,34 @@ var intl = require('@elice/intl');
|
|
|
10
9
|
var materialSharedUtils = require('@elice/material-shared-utils');
|
|
11
10
|
var types = require('@elice/types');
|
|
12
11
|
|
|
13
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
14
|
-
|
|
15
|
-
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
16
|
-
|
|
17
12
|
//
|
|
18
13
|
//
|
|
19
14
|
//
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
15
|
+
const POWERPOINT_EXTENSIONS = ['ppt', 'pptx', 'pps', 'ppsx'];
|
|
16
|
+
const MaterialPdfContent = ({
|
|
17
|
+
materialPdfId,
|
|
18
|
+
cMapUrl
|
|
19
|
+
}) => {
|
|
20
|
+
const intl$1 = intl.useRawEliceIntl();
|
|
21
|
+
const {
|
|
22
|
+
materialPdf,
|
|
23
|
+
status: materialPdfStatus
|
|
24
|
+
} = materialSharedUtils.useMaterialFetch(types.enums.LectureMaterialType.PDF, React.useCallback(signal => apiClient.getOrgMaterialPdfGet({
|
|
25
|
+
materialPdfId: materialPdfId
|
|
26
|
+
}, {
|
|
27
|
+
signal
|
|
28
|
+
}), [materialPdfId]), apiClient.config.init);
|
|
29
|
+
const isPowerPointFile = React.useMemo(() => {
|
|
35
30
|
var _a, _b;
|
|
36
31
|
if (!(materialPdf === null || materialPdf === void 0 ? void 0 : materialPdf.attachment.url)) return false;
|
|
37
|
-
|
|
38
|
-
pathname
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
});
|
|
32
|
+
const {
|
|
33
|
+
pathname
|
|
34
|
+
} = new URL(materialPdf.attachment.url);
|
|
35
|
+
const currentFileName = (_a = pathname.split('/').pop()) !== null && _a !== void 0 ? _a : '';
|
|
36
|
+
const currentFileExtension = (_b = currentFileName.split('.').pop()) !== null && _b !== void 0 ? _b : '';
|
|
37
|
+
return POWERPOINT_EXTENSIONS.some(extension => currentFileExtension.toLowerCase().includes(extension));
|
|
44
38
|
}, [materialPdf === null || materialPdf === void 0 ? void 0 : materialPdf.attachment.url]);
|
|
45
|
-
|
|
39
|
+
const componentProps = React.useMemo(() => {
|
|
46
40
|
var _a;
|
|
47
41
|
return isPowerPointFile ? {
|
|
48
42
|
type: 'powerpoint',
|
|
@@ -76,9 +70,9 @@ var MaterialPdfContent = function MaterialPdfContent(_ref) {
|
|
|
76
70
|
};
|
|
77
71
|
}, [cMapUrl, intl$1, isPowerPointFile, materialPdf === null || materialPdf === void 0 ? void 0 : materialPdf.attachment.url, materialPdf === null || materialPdf === void 0 ? void 0 : materialPdf.title, materialPdfStatus]);
|
|
78
72
|
if (materialPdfStatus === 'pending') {
|
|
79
|
-
return
|
|
73
|
+
return React.createElement(blocks.Spinner, null);
|
|
80
74
|
}
|
|
81
|
-
return
|
|
75
|
+
return React.createElement(blocks.DocumentRenderer, Object.assign({}, componentProps));
|
|
82
76
|
};
|
|
83
77
|
|
|
84
78
|
exports.default = MaterialPdfContent;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
2
|
import { IntlComponentBuilder, RawEliceIntlProvider } from '@elice/intl';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import messageEn from './locales/en.json.js';
|
|
@@ -6,25 +6,24 @@ import messageKo from './locales/ko.json.js';
|
|
|
6
6
|
import MaterialPdfContent from './MaterialPdfContent.js';
|
|
7
7
|
import { StyledMaterialPdfWrapper } from './MaterialPdf.styled.js';
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
const MaterialPdf = ({
|
|
10
|
+
className,
|
|
11
|
+
materialPdfId,
|
|
12
|
+
cMapUrl,
|
|
13
|
+
__intl
|
|
14
|
+
}) => {
|
|
15
|
+
const prefixCls = 'em-material-pdf';
|
|
15
16
|
//
|
|
16
17
|
//
|
|
17
18
|
//
|
|
18
|
-
return
|
|
19
|
-
value: __intl
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
})
|
|
27
|
-
});
|
|
19
|
+
return React.createElement(RawEliceIntlProvider, {
|
|
20
|
+
value: __intl
|
|
21
|
+
}, React.createElement(StyledMaterialPdfWrapper, {
|
|
22
|
+
className: classnames(prefixCls, className)
|
|
23
|
+
}, React.createElement(MaterialPdfContent, {
|
|
24
|
+
materialPdfId: materialPdfId,
|
|
25
|
+
cMapUrl: cMapUrl
|
|
26
|
+
})));
|
|
28
27
|
};
|
|
29
28
|
var MaterialPdf$1 = new IntlComponentBuilder(MaterialPdf).add('en', messageEn).add('ko', messageKo).addAsync('th', import('./locales/th.json.js')).addAsync('ja', import('./locales/ja.json.js')).build();
|
|
30
29
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
1
|
import React, { useMemo } from 'react';
|
|
3
2
|
import { getOrgMaterialPdfGet, config } from '@elice/api-client';
|
|
4
3
|
import { Spinner, DocumentRenderer } from '@elice/blocks';
|
|
@@ -9,32 +8,31 @@ import { enums } from '@elice/types';
|
|
|
9
8
|
//
|
|
10
9
|
//
|
|
11
10
|
//
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
11
|
+
const POWERPOINT_EXTENSIONS = ['ppt', 'pptx', 'pps', 'ppsx'];
|
|
12
|
+
const MaterialPdfContent = ({
|
|
13
|
+
materialPdfId,
|
|
14
|
+
cMapUrl
|
|
15
|
+
}) => {
|
|
16
|
+
const intl = useRawEliceIntl();
|
|
17
|
+
const {
|
|
18
|
+
materialPdf,
|
|
19
|
+
status: materialPdfStatus
|
|
20
|
+
} = useMaterialFetch(enums.LectureMaterialType.PDF, React.useCallback(signal => getOrgMaterialPdfGet({
|
|
21
|
+
materialPdfId: materialPdfId
|
|
22
|
+
}, {
|
|
23
|
+
signal
|
|
24
|
+
}), [materialPdfId]), config.init);
|
|
25
|
+
const isPowerPointFile = useMemo(() => {
|
|
27
26
|
var _a, _b;
|
|
28
27
|
if (!(materialPdf === null || materialPdf === void 0 ? void 0 : materialPdf.attachment.url)) return false;
|
|
29
|
-
|
|
30
|
-
pathname
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
});
|
|
28
|
+
const {
|
|
29
|
+
pathname
|
|
30
|
+
} = new URL(materialPdf.attachment.url);
|
|
31
|
+
const currentFileName = (_a = pathname.split('/').pop()) !== null && _a !== void 0 ? _a : '';
|
|
32
|
+
const currentFileExtension = (_b = currentFileName.split('.').pop()) !== null && _b !== void 0 ? _b : '';
|
|
33
|
+
return POWERPOINT_EXTENSIONS.some(extension => currentFileExtension.toLowerCase().includes(extension));
|
|
36
34
|
}, [materialPdf === null || materialPdf === void 0 ? void 0 : materialPdf.attachment.url]);
|
|
37
|
-
|
|
35
|
+
const componentProps = useMemo(() => {
|
|
38
36
|
var _a;
|
|
39
37
|
return isPowerPointFile ? {
|
|
40
38
|
type: 'powerpoint',
|
|
@@ -68,9 +66,9 @@ var MaterialPdfContent = function MaterialPdfContent(_ref) {
|
|
|
68
66
|
};
|
|
69
67
|
}, [cMapUrl, intl, isPowerPointFile, materialPdf === null || materialPdf === void 0 ? void 0 : materialPdf.attachment.url, materialPdf === null || materialPdf === void 0 ? void 0 : materialPdf.title, materialPdfStatus]);
|
|
70
68
|
if (materialPdfStatus === 'pending') {
|
|
71
|
-
return
|
|
69
|
+
return React.createElement(Spinner, null);
|
|
72
70
|
}
|
|
73
|
-
return
|
|
71
|
+
return React.createElement(DocumentRenderer, Object.assign({}, componentProps));
|
|
74
72
|
};
|
|
75
73
|
|
|
76
74
|
export { MaterialPdfContent as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elice/material-pdf",
|
|
3
|
-
"version": "1.240718.
|
|
3
|
+
"version": "1.240718.1",
|
|
4
4
|
"description": "User view and editing components of Elice material PDF",
|
|
5
5
|
"repository": "https://git.elicer.io/elice/frontend/library/elice-material",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -17,8 +17,10 @@
|
|
|
17
17
|
"scripts": {
|
|
18
18
|
"start": "run-s watch",
|
|
19
19
|
"prebuild": "run-s clean",
|
|
20
|
-
"build": "
|
|
21
|
-
"
|
|
20
|
+
"build": "run-p build:es build:cjs",
|
|
21
|
+
"build:es": "rollup -c ../../rollup.config.ts --configPlugin typescript -f es",
|
|
22
|
+
"build:cjs": "rollup -c ../../rollup.config.ts --configPlugin typescript -f cjs",
|
|
23
|
+
"watch": "rollup -c ../../rollup.config.ts --configPlugin typescript -f es -w",
|
|
22
24
|
"lint": "eslint --ext .ts,.tsx ./src --max-warnings=0",
|
|
23
25
|
"clean": "del-cli \"es/*\" \"cjs/*\" \"dist/*\""
|
|
24
26
|
},
|
|
@@ -42,20 +44,21 @@
|
|
|
42
44
|
},
|
|
43
45
|
"devDependencies": {
|
|
44
46
|
"@elice/api-client": "^1.240619.0",
|
|
45
|
-
"@elice/blocks": "
|
|
47
|
+
"@elice/blocks": "1.240529.0",
|
|
46
48
|
"@elice/design-tokens": "^1.220803.0",
|
|
47
49
|
"@elice/icons": "^1.230814.0",
|
|
48
50
|
"@elice/icons-legacy": "npm:@elice/icons@0.230814.0",
|
|
49
51
|
"@elice/intl": "0.240425.0-rc.2",
|
|
50
|
-
"@elice/markdown": "^1.
|
|
51
|
-
"@elice/material-shared-types": "1.240718.
|
|
52
|
-
"@elice/material-shared-utils": "1.240718.
|
|
53
|
-
"@elice/types": "1.
|
|
52
|
+
"@elice/markdown": "^1.220815.0",
|
|
53
|
+
"@elice/material-shared-types": "1.240718.1",
|
|
54
|
+
"@elice/material-shared-utils": "1.240718.1",
|
|
55
|
+
"@elice/types": "^1.240619.0",
|
|
54
56
|
"@types/classnames": "^2.3.1",
|
|
55
57
|
"@types/react": "~17.0.9",
|
|
56
58
|
"@types/styled-components": "^5.1.21",
|
|
57
59
|
"react": "^17.0.2",
|
|
58
60
|
"react-use": "^17.2.4",
|
|
59
61
|
"styled-components": "^5.3.0"
|
|
60
|
-
}
|
|
62
|
+
},
|
|
63
|
+
"gitHead": "c1b2b8f98c5eed547941a327188a09f6ed21f6e4"
|
|
61
64
|
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var en = require('./en.json.js');
|
|
4
|
-
var ko = require('./ko.json.js');
|
|
5
|
-
var th = require('./th.json.js');
|
|
6
|
-
var ja = require('./ja.json.js');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
exports.messageEn = en.default;
|
|
11
|
-
exports.messageKo = ko.default;
|
|
12
|
-
exports.messageTh = th.default;
|
|
13
|
-
exports.messageJa = ja.default;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as MaterialPdf } from './MaterialPdf.js';
|