@atlaskit/media-document-viewer 0.2.3 → 0.3.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/CHANGELOG.md +9 -0
- package/dist/cjs/annotations.js +10 -12
- package/dist/cjs/documentViewer.js +3 -1
- package/dist/cjs/page.js +3 -1
- package/dist/es2019/annotations.js +2 -2
- package/dist/es2019/documentViewer.js +2 -0
- package/dist/es2019/page.js +3 -1
- package/dist/esm/annotations.js +2 -2
- package/dist/esm/documentViewer.js +3 -1
- package/dist/esm/page.js +3 -1
- package/dist/types/documentViewer.d.ts +2 -1
- package/dist/types/page.d.ts +2 -1
- package/dist/types-ts4.5/documentViewer.d.ts +2 -1
- package/dist/types-ts4.5/page.d.ts +2 -1
- package/package.json +1 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/media-document-viewer
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#179532](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/179532)
|
|
8
|
+
[`3102656e971a4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3102656e971a4) -
|
|
9
|
+
Fixed form view by removing unnecessary div and replacing with fragment and added a new
|
|
10
|
+
`onSuccess` callback to enable success analytics
|
|
11
|
+
|
|
3
12
|
## 0.2.3
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/dist/cjs/annotations.js
CHANGED
|
@@ -2,18 +2,16 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
5
|
Object.defineProperty(exports, "__esModule", {
|
|
7
6
|
value: true
|
|
8
7
|
});
|
|
9
8
|
exports.TextInputFormField = exports.ComboBoxFormField = exports.Annotations = void 0;
|
|
10
9
|
require("./annotations.compiled.css");
|
|
11
|
-
var React = _interopRequireWildcard(require("react"));
|
|
12
10
|
var _runtime = require("@compiled/react/runtime");
|
|
13
11
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
14
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
var _react = _interopRequireDefault(require("react"));
|
|
15
14
|
var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/core/chevron-down"));
|
|
16
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
17
15
|
/* eslint-disable @atlaskit/ui-styling-standard/enforce-style-prop */
|
|
18
16
|
var formInputBaseStyles = null;
|
|
19
17
|
var textInputStyles = null;
|
|
@@ -23,13 +21,13 @@ var foreignObjectProps = {
|
|
|
23
21
|
var TextInputFormField = exports.TextInputFormField = function TextInputFormField(_ref) {
|
|
24
22
|
var field = _ref.field,
|
|
25
23
|
dataTestId = _ref.dataTestId;
|
|
26
|
-
return /*#__PURE__*/
|
|
24
|
+
return /*#__PURE__*/_react.default.createElement("foreignObject", {
|
|
27
25
|
x: field.x,
|
|
28
26
|
y: -field.y,
|
|
29
27
|
width: field.w,
|
|
30
28
|
height: field.h,
|
|
31
29
|
"data-testid": dataTestId
|
|
32
|
-
}, /*#__PURE__*/
|
|
30
|
+
}, /*#__PURE__*/_react.default.createElement("input", (0, _extends2.default)({}, foreignObjectProps, {
|
|
33
31
|
style: (0, _defineProperty2.default)({}, 'fontSize', "".concat(field.f, "px")),
|
|
34
32
|
type: "text",
|
|
35
33
|
value: field.text,
|
|
@@ -42,35 +40,35 @@ var comboBoxInputStyles = null;
|
|
|
42
40
|
var ComboBoxFormField = exports.ComboBoxFormField = function ComboBoxFormField(_ref3) {
|
|
43
41
|
var field = _ref3.field,
|
|
44
42
|
dataTestId = _ref3.dataTestId;
|
|
45
|
-
return /*#__PURE__*/
|
|
43
|
+
return /*#__PURE__*/_react.default.createElement("foreignObject", {
|
|
46
44
|
x: field.x,
|
|
47
45
|
y: -field.y,
|
|
48
46
|
width: field.w,
|
|
49
47
|
height: field.h,
|
|
50
48
|
"data-testid": dataTestId
|
|
51
|
-
}, /*#__PURE__*/
|
|
49
|
+
}, /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, foreignObjectProps, {
|
|
52
50
|
className: (0, _runtime.ax)(["_1e0c11p5 _yv0e1ghl _4cvr1h6o _1bah1yb4 _kqswstnw _4t3i1osq _1bsb1osq"])
|
|
53
|
-
}), /*#__PURE__*/
|
|
51
|
+
}), /*#__PURE__*/_react.default.createElement("input", {
|
|
54
52
|
style: (0, _defineProperty2.default)({}, 'fontSize', "".concat(field.f, "px")),
|
|
55
53
|
type: "text",
|
|
56
54
|
value: field.text,
|
|
57
55
|
readOnly: true,
|
|
58
56
|
className: (0, _runtime.ax)(["_19itglyw _ca0qidpf _u5f3idpf _n3tdidpf _19bvidpf _r06hglyw", "_1bsb1osq"])
|
|
59
|
-
}), /*#__PURE__*/
|
|
57
|
+
}), /*#__PURE__*/_react.default.createElement(_chevronDown.default, {
|
|
60
58
|
label: "",
|
|
61
59
|
size: "small"
|
|
62
60
|
})));
|
|
63
61
|
};
|
|
64
62
|
var Annotations = exports.Annotations = function Annotations(_ref5) {
|
|
65
63
|
var annotations = _ref5.annotations;
|
|
66
|
-
return /*#__PURE__*/
|
|
67
|
-
return /*#__PURE__*/
|
|
64
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, annotations.text_form_fields.map(function (field, i) {
|
|
65
|
+
return /*#__PURE__*/_react.default.createElement(TextInputFormField, {
|
|
68
66
|
field: field,
|
|
69
67
|
dataTestId: "text-form-field-".concat(i),
|
|
70
68
|
key: i
|
|
71
69
|
});
|
|
72
70
|
}), annotations.combobox_form_fields.map(function (field, i) {
|
|
73
|
-
return /*#__PURE__*/
|
|
71
|
+
return /*#__PURE__*/_react.default.createElement(ComboBoxFormField, {
|
|
74
72
|
field: field,
|
|
75
73
|
dataTestId: "combobox-form-field-".concat(i),
|
|
76
74
|
key: i
|
|
@@ -19,7 +19,8 @@ var documentViewerStyles = null;
|
|
|
19
19
|
var DEFAULT_PAGINATION_SIZE = 50;
|
|
20
20
|
var DocumentViewer = exports.DocumentViewer = function DocumentViewer(_ref) {
|
|
21
21
|
var _documentMetadata$pag;
|
|
22
|
-
var
|
|
22
|
+
var onSuccess = _ref.onSuccess,
|
|
23
|
+
getContent = _ref.getContent,
|
|
23
24
|
getPageImageUrl = _ref.getPageImageUrl,
|
|
24
25
|
_ref$paginationSize = _ref.paginationSize,
|
|
25
26
|
paginationSize = _ref$paginationSize === void 0 ? DEFAULT_PAGINATION_SIZE : _ref$paginationSize,
|
|
@@ -49,6 +50,7 @@ var DocumentViewer = exports.DocumentViewer = function DocumentViewer(_ref) {
|
|
|
49
50
|
onVisible: function onVisible() {
|
|
50
51
|
return loadPageContent(i);
|
|
51
52
|
},
|
|
53
|
+
onLoad: i === 0 ? onSuccess : undefined,
|
|
52
54
|
fonts: fonts,
|
|
53
55
|
content: page
|
|
54
56
|
});
|
package/dist/cjs/page.js
CHANGED
|
@@ -120,7 +120,8 @@ var Page = exports.Page = function Page(_ref5) {
|
|
|
120
120
|
pageIndex = _ref5.pageIndex,
|
|
121
121
|
zoom = _ref5.zoom,
|
|
122
122
|
defaultDimensions = _ref5.defaultDimensions,
|
|
123
|
-
onVisible = _ref5.onVisible
|
|
123
|
+
onVisible = _ref5.onVisible,
|
|
124
|
+
onLoad = _ref5.onLoad;
|
|
124
125
|
var _useState = (0, _react.useState)(),
|
|
125
126
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
126
127
|
imageSrc = _useState2[0],
|
|
@@ -143,6 +144,7 @@ var Page = exports.Page = function Page(_ref5) {
|
|
|
143
144
|
setDimensions = _useState4[1];
|
|
144
145
|
var onImageLoad = (0, _mediaCommon.useStaticCallback)(function (event) {
|
|
145
146
|
var image = event.currentTarget;
|
|
147
|
+
onLoad === null || onLoad === void 0 || onLoad();
|
|
146
148
|
if (!content) {
|
|
147
149
|
var _zoom = image.dataset.zoom ? Number(image.dataset.zoom) : 1;
|
|
148
150
|
setDimensions({
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/* annotations.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
3
|
import "./annotations.compiled.css";
|
|
4
|
-
import * as React from 'react';
|
|
5
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
6
5
|
/* eslint-disable @atlaskit/ui-styling-standard/enforce-style-prop */
|
|
7
6
|
|
|
7
|
+
import React from 'react';
|
|
8
8
|
import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
|
|
9
9
|
const formInputBaseStyles = null;
|
|
10
10
|
const textInputStyles = null;
|
|
@@ -61,7 +61,7 @@ export const ComboBoxFormField = ({
|
|
|
61
61
|
export const Annotations = ({
|
|
62
62
|
annotations
|
|
63
63
|
}) => {
|
|
64
|
-
return /*#__PURE__*/React.createElement(
|
|
64
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, annotations.text_form_fields.map((field, i) => {
|
|
65
65
|
return /*#__PURE__*/React.createElement(TextInputFormField, {
|
|
66
66
|
field: field,
|
|
67
67
|
dataTestId: `text-form-field-${i}`,
|
|
@@ -8,6 +8,7 @@ import { useCachedGetImage } from './utils/useCachedGetImage';
|
|
|
8
8
|
const documentViewerStyles = null;
|
|
9
9
|
const DEFAULT_PAGINATION_SIZE = 50;
|
|
10
10
|
export const DocumentViewer = ({
|
|
11
|
+
onSuccess,
|
|
11
12
|
getContent,
|
|
12
13
|
getPageImageUrl,
|
|
13
14
|
paginationSize = DEFAULT_PAGINATION_SIZE,
|
|
@@ -39,6 +40,7 @@ export const DocumentViewer = ({
|
|
|
39
40
|
zoom: zoom,
|
|
40
41
|
defaultDimensions: documentMetadata.defaultDimensions,
|
|
41
42
|
onVisible: () => loadPageContent(i),
|
|
43
|
+
onLoad: i === 0 ? onSuccess : undefined,
|
|
42
44
|
fonts: fonts,
|
|
43
45
|
content: page
|
|
44
46
|
});
|
package/dist/es2019/page.js
CHANGED
|
@@ -107,7 +107,8 @@ export const Page = ({
|
|
|
107
107
|
pageIndex,
|
|
108
108
|
zoom,
|
|
109
109
|
defaultDimensions,
|
|
110
|
-
onVisible
|
|
110
|
+
onVisible,
|
|
111
|
+
onLoad
|
|
111
112
|
}) => {
|
|
112
113
|
var _ref;
|
|
113
114
|
const [imageSrc, setImageSrc] = useState();
|
|
@@ -127,6 +128,7 @@ export const Page = ({
|
|
|
127
128
|
const [dimensions, setDimensions] = useState();
|
|
128
129
|
const onImageLoad = useStaticCallback(event => {
|
|
129
130
|
const image = event.currentTarget;
|
|
131
|
+
onLoad === null || onLoad === void 0 ? void 0 : onLoad();
|
|
130
132
|
if (!content) {
|
|
131
133
|
const zoom = image.dataset.zoom ? Number(image.dataset.zoom) : 1;
|
|
132
134
|
setDimensions({
|
package/dist/esm/annotations.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
4
|
import "./annotations.compiled.css";
|
|
5
|
-
import * as React from 'react';
|
|
6
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
7
6
|
/* eslint-disable @atlaskit/ui-styling-standard/enforce-style-prop */
|
|
8
7
|
|
|
8
|
+
import React from 'react';
|
|
9
9
|
import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
|
|
10
10
|
var formInputBaseStyles = null;
|
|
11
11
|
var textInputStyles = null;
|
|
@@ -55,7 +55,7 @@ export var ComboBoxFormField = function ComboBoxFormField(_ref3) {
|
|
|
55
55
|
};
|
|
56
56
|
export var Annotations = function Annotations(_ref5) {
|
|
57
57
|
var annotations = _ref5.annotations;
|
|
58
|
-
return /*#__PURE__*/React.createElement(
|
|
58
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, annotations.text_form_fields.map(function (field, i) {
|
|
59
59
|
return /*#__PURE__*/React.createElement(TextInputFormField, {
|
|
60
60
|
field: field,
|
|
61
61
|
dataTestId: "text-form-field-".concat(i),
|
|
@@ -10,7 +10,8 @@ var documentViewerStyles = null;
|
|
|
10
10
|
var DEFAULT_PAGINATION_SIZE = 50;
|
|
11
11
|
export var DocumentViewer = function DocumentViewer(_ref) {
|
|
12
12
|
var _documentMetadata$pag;
|
|
13
|
-
var
|
|
13
|
+
var onSuccess = _ref.onSuccess,
|
|
14
|
+
getContent = _ref.getContent,
|
|
14
15
|
getPageImageUrl = _ref.getPageImageUrl,
|
|
15
16
|
_ref$paginationSize = _ref.paginationSize,
|
|
16
17
|
paginationSize = _ref$paginationSize === void 0 ? DEFAULT_PAGINATION_SIZE : _ref$paginationSize,
|
|
@@ -40,6 +41,7 @@ export var DocumentViewer = function DocumentViewer(_ref) {
|
|
|
40
41
|
onVisible: function onVisible() {
|
|
41
42
|
return loadPageContent(i);
|
|
42
43
|
},
|
|
44
|
+
onLoad: i === 0 ? onSuccess : undefined,
|
|
43
45
|
fonts: fonts,
|
|
44
46
|
content: page
|
|
45
47
|
});
|
package/dist/esm/page.js
CHANGED
|
@@ -111,7 +111,8 @@ export var Page = function Page(_ref5) {
|
|
|
111
111
|
pageIndex = _ref5.pageIndex,
|
|
112
112
|
zoom = _ref5.zoom,
|
|
113
113
|
defaultDimensions = _ref5.defaultDimensions,
|
|
114
|
-
onVisible = _ref5.onVisible
|
|
114
|
+
onVisible = _ref5.onVisible,
|
|
115
|
+
onLoad = _ref5.onLoad;
|
|
115
116
|
var _useState = useState(),
|
|
116
117
|
_useState2 = _slicedToArray(_useState, 2),
|
|
117
118
|
imageSrc = _useState2[0],
|
|
@@ -134,6 +135,7 @@ export var Page = function Page(_ref5) {
|
|
|
134
135
|
setDimensions = _useState4[1];
|
|
135
136
|
var onImageLoad = useStaticCallback(function (event) {
|
|
136
137
|
var image = event.currentTarget;
|
|
138
|
+
onLoad === null || onLoad === void 0 || onLoad();
|
|
137
139
|
if (!content) {
|
|
138
140
|
var _zoom = image.dataset.zoom ? Number(image.dataset.zoom) : 1;
|
|
139
141
|
setDimensions({
|
|
@@ -5,6 +5,7 @@ type DocumentViewerProps = {
|
|
|
5
5
|
getPageImageUrl: (pageNumber: number, zoom: number) => Promise<string>;
|
|
6
6
|
paginationSize?: number;
|
|
7
7
|
zoom: number;
|
|
8
|
+
onSuccess?: () => void;
|
|
8
9
|
};
|
|
9
|
-
export declare const DocumentViewer: ({ getContent, getPageImageUrl, paginationSize, zoom, }: DocumentViewerProps) => JSX.Element;
|
|
10
|
+
export declare const DocumentViewer: ({ onSuccess, getContent, getPageImageUrl, paginationSize, zoom, }: DocumentViewerProps) => JSX.Element;
|
|
10
11
|
export {};
|
package/dist/types/page.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ type PageProps = {
|
|
|
11
11
|
height: number;
|
|
12
12
|
};
|
|
13
13
|
onVisible: () => void;
|
|
14
|
+
onLoad?: () => void;
|
|
14
15
|
};
|
|
15
|
-
export declare const Page: ({ getPageSrc, content, fonts, pageIndex, zoom, defaultDimensions, onVisible, }: PageProps) => JSX.Element;
|
|
16
|
+
export declare const Page: ({ getPageSrc, content, fonts, pageIndex, zoom, defaultDimensions, onVisible, onLoad, }: PageProps) => JSX.Element;
|
|
16
17
|
export {};
|
|
@@ -5,6 +5,7 @@ type DocumentViewerProps = {
|
|
|
5
5
|
getPageImageUrl: (pageNumber: number, zoom: number) => Promise<string>;
|
|
6
6
|
paginationSize?: number;
|
|
7
7
|
zoom: number;
|
|
8
|
+
onSuccess?: () => void;
|
|
8
9
|
};
|
|
9
|
-
export declare const DocumentViewer: ({ getContent, getPageImageUrl, paginationSize, zoom, }: DocumentViewerProps) => JSX.Element;
|
|
10
|
+
export declare const DocumentViewer: ({ onSuccess, getContent, getPageImageUrl, paginationSize, zoom, }: DocumentViewerProps) => JSX.Element;
|
|
10
11
|
export {};
|
|
@@ -11,6 +11,7 @@ type PageProps = {
|
|
|
11
11
|
height: number;
|
|
12
12
|
};
|
|
13
13
|
onVisible: () => void;
|
|
14
|
+
onLoad?: () => void;
|
|
14
15
|
};
|
|
15
|
-
export declare const Page: ({ getPageSrc, content, fonts, pageIndex, zoom, defaultDimensions, onVisible, }: PageProps) => JSX.Element;
|
|
16
|
+
export declare const Page: ({ getPageSrc, content, fonts, pageIndex, zoom, defaultDimensions, onVisible, onLoad, }: PageProps) => JSX.Element;
|
|
16
17
|
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"atlassian": {
|
|
3
3
|
"team": "Media Exif",
|
|
4
|
-
"runReact18": true,
|
|
5
4
|
"website": {
|
|
6
5
|
"name": "MediaDocumentViewer",
|
|
7
6
|
"category": "Layout and structure"
|
|
@@ -84,7 +83,7 @@
|
|
|
84
83
|
}
|
|
85
84
|
},
|
|
86
85
|
"name": "@atlaskit/media-document-viewer",
|
|
87
|
-
"version": "0.
|
|
86
|
+
"version": "0.3.0",
|
|
88
87
|
"description": "Modern and fast document viewer",
|
|
89
88
|
"author": "Atlassian Pty Ltd",
|
|
90
89
|
"license": "Apache-2.0",
|