@zohodesk/dot 1.0.0-temp-225 → 1.0.0-temp-225.1npm

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.
@@ -80,8 +80,9 @@ export default class AttachmentViewer extends Component {
80
80
  selectedIndex
81
81
  } = this.state;
82
82
  let indexChanged = previewObj.selectedIndex != prevProps.previewObj.selectedIndex;
83
+ const attachmentPreviewUrlChanged = previewObj.previewData[0]?.viewUrl !== prevState.data[0]?.viewUrl; // Triggers an update if the previewed attachment is edited by the Attachment Annotator.
83
84
 
84
- if (previewObj.previewData.length != prevProps.previewObj.previewData.length || indexChanged) {
85
+ if (previewObj.previewData.length != prevProps.previewObj.previewData.length || indexChanged || attachmentPreviewUrlChanged) {
85
86
  let objChanged = previewObj.previewData.some((value, index) => {
86
87
  return shallowDiff(value, prevProps.previewObj[index]);
87
88
  });
@@ -100,7 +101,7 @@ export default class AttachmentViewer extends Component {
100
101
  }
101
102
  }
102
103
 
103
- if (prevState.selectedIndex != selectedIndex) {
104
+ if (prevState.selectedIndex != selectedIndex || attachmentPreviewUrlChanged) {
104
105
  this.handleMenuValidation();
105
106
  }
106
107
  }
@@ -424,9 +425,10 @@ export default class AttachmentViewer extends Component {
424
425
  $ui_weight: "semibold"
425
426
  }, previewUnsupportedText), downloadUrl ? /*#__PURE__*/React.createElement(Link, {
426
427
  href: downloadUrl,
428
+ download: true,
429
+ downloadName: name,
427
430
  className: style.downloadLink,
428
- hasReload: true,
429
- download: true
431
+ hasReload: true
430
432
  }, /*#__PURE__*/React.createElement(Button, {
431
433
  palette: "primaryFilled",
432
434
  text: downloadText
@@ -561,6 +563,7 @@ export default class AttachmentViewer extends Component {
561
563
  className: uptoTablet ? style.mobileMenu : style.menu
562
564
  }, /*#__PURE__*/React.createElement(Link, {
563
565
  href: downloadUrl,
566
+ downloadName: selectedAttachment.name,
564
567
  target: "_parent",
565
568
  hasReload: true,
566
569
  download: true,
package/es/Link/Link.js CHANGED
@@ -61,7 +61,8 @@ export default class Link extends React.Component {
61
61
  rel,
62
62
  dataId,
63
63
  customProps,
64
- ariaLabel
64
+ ariaLabel,
65
+ downloadName
65
66
  } = this.props;
66
67
  let {
67
68
  isLink,
@@ -71,7 +72,7 @@ export default class Link extends React.Component {
71
72
  let option = {};
72
73
 
73
74
  if (download) {
74
- option.download = true;
75
+ option.download = downloadName || true;
75
76
  }
76
77
 
77
78
  let ignoreKeys = ['children', 'href', 'target', 'urlData', 'urlName', 'className', 'title', 'download', 'rel', 'dataId', 'hasReload', 'customProps', 'option', 'ariaLabel'];
@@ -92,7 +93,8 @@ export default class Link extends React.Component {
92
93
  }, others, {
93
94
  onClick: this.onCallBack.bind(this, urlOutput, href)
94
95
  }, customProps, {
95
- "aria-label": ariaLabel
96
+ "aria-label": ariaLabel,
97
+ download: downloadName
96
98
  }), children);
97
99
  }
98
100
 
@@ -13,6 +13,7 @@ export const propTypes = {
13
13
  customProps: PropTypes.object,
14
14
  onClick: PropTypes.func,
15
15
  download: PropTypes.bool,
16
+ downloadName: PropTypes.string,
16
17
  ariaLabel: PropTypes.string,
17
18
  key: PropTypes.string
18
19
  };
@@ -159,11 +159,14 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
159
159
  }, {
160
160
  key: "componentDidUpdate",
161
161
  value: function componentDidUpdate(prevProps, prevState) {
162
+ var _previewObj$previewDa, _prevState$data$;
163
+
162
164
  var previewObj = this.props.previewObj;
163
165
  var selectedIndex = this.state.selectedIndex;
164
166
  var indexChanged = previewObj.selectedIndex != prevProps.previewObj.selectedIndex;
167
+ var attachmentPreviewUrlChanged = ((_previewObj$previewDa = previewObj.previewData[0]) === null || _previewObj$previewDa === void 0 ? void 0 : _previewObj$previewDa.viewUrl) !== ((_prevState$data$ = prevState.data[0]) === null || _prevState$data$ === void 0 ? void 0 : _prevState$data$.viewUrl); // Triggers an update if the previewed attachment is edited by the Attachment Annotator.
165
168
 
166
- if (previewObj.previewData.length != prevProps.previewObj.previewData.length || indexChanged) {
169
+ if (previewObj.previewData.length != prevProps.previewObj.previewData.length || indexChanged || attachmentPreviewUrlChanged) {
167
170
  var objChanged = previewObj.previewData.some(function (value, index) {
168
171
  return (0, _General.shallowDiff)(value, prevProps.previewObj[index]);
169
172
  });
@@ -182,7 +185,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
182
185
  }
183
186
  }
184
187
 
185
- if (prevState.selectedIndex != selectedIndex) {
188
+ if (prevState.selectedIndex != selectedIndex || attachmentPreviewUrlChanged) {
186
189
  this.handleMenuValidation();
187
190
  }
188
191
  }
@@ -516,9 +519,10 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
516
519
  $ui_weight: "semibold"
517
520
  }, previewUnsupportedText), downloadUrl ? /*#__PURE__*/_react["default"].createElement(_Link["default"], {
518
521
  href: downloadUrl,
522
+ download: true,
523
+ downloadName: name,
519
524
  className: _AttachmentViewerModule["default"].downloadLink,
520
- hasReload: true,
521
- download: true
525
+ hasReload: true
522
526
  }, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
523
527
  palette: "primaryFilled",
524
528
  text: downloadText
@@ -653,6 +657,7 @@ var AttachmentViewer = /*#__PURE__*/function (_Component) {
653
657
  className: uptoTablet ? _AttachmentViewerModule["default"].mobileMenu : _AttachmentViewerModule["default"].menu
654
658
  }, /*#__PURE__*/_react["default"].createElement(_Link["default"], {
655
659
  href: downloadUrl,
660
+ downloadName: selectedAttachment.name,
656
661
  target: "_parent",
657
662
  hasReload: true,
658
663
  download: true,
package/lib/Link/Link.js CHANGED
@@ -110,7 +110,8 @@ var Link = /*#__PURE__*/function (_React$Component) {
110
110
  rel = _this$props2.rel,
111
111
  dataId = _this$props2.dataId,
112
112
  customProps = _this$props2.customProps,
113
- ariaLabel = _this$props2.ariaLabel;
113
+ ariaLabel = _this$props2.ariaLabel,
114
+ downloadName = _this$props2.downloadName;
114
115
  var _this$context$options = this.context.options,
115
116
  isLink = _this$context$options.isLink,
116
117
  constructURL = _this$context$options.constructURL;
@@ -118,7 +119,7 @@ var Link = /*#__PURE__*/function (_React$Component) {
118
119
  var option = {};
119
120
 
120
121
  if (download) {
121
- option.download = true;
122
+ option.download = downloadName || true;
122
123
  }
123
124
 
124
125
  var ignoreKeys = ['children', 'href', 'target', 'urlData', 'urlName', 'className', 'title', 'download', 'rel', 'dataId', 'hasReload', 'customProps', 'option', 'ariaLabel'];
@@ -141,7 +142,8 @@ var Link = /*#__PURE__*/function (_React$Component) {
141
142
  }, others, {
142
143
  onClick: this.onCallBack.bind(this, urlOutput, href)
143
144
  }, customProps, {
144
- "aria-label": ariaLabel
145
+ "aria-label": ariaLabel,
146
+ download: downloadName
145
147
  }), children);
146
148
  }
147
149
  }]);
@@ -23,6 +23,7 @@ var propTypes = {
23
23
  customProps: _propTypes["default"].object,
24
24
  onClick: _propTypes["default"].func,
25
25
  download: _propTypes["default"].bool,
26
+ downloadName: _propTypes["default"].string,
26
27
  ariaLabel: _propTypes["default"].string,
27
28
  key: _propTypes["default"].string
28
29
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/dot",
3
- "version": "1.0.0-temp-225",
3
+ "version": "1.0.0-temp-225.1npm",
4
4
  "main": "lib/index",
5
5
  "module": "es/index.js",
6
6
  "private": false,
@@ -72,13 +72,13 @@
72
72
  "@zohodesk/hooks": "2.0.8",
73
73
  "@zohodesk/icons": "1.2.5",
74
74
  "@zohodesk/layout": "^3.1.0",
75
- "@zohodesk/svg": "1.3.2",
75
+ "@zohodesk/svg": "1.3.3",
76
76
  "@zohodesk/utils": "1.3.16",
77
77
  "@zohodesk/variables": "1.2.0",
78
78
  "@zohodesk/virtualizer": "1.0.13",
79
79
  "react-sortable-hoc": "^0.8.3",
80
80
  "velocity-react": "1.4.3",
81
- "@zohodesk/dotkit": "1.0.8",
81
+ "@zohodesk/dotkit": "1.0.9",
82
82
  "@zohodesk/react-cli": "1.1.27",
83
83
  "@zohodesk/client_build_tool": "0.0.20"
84
84
  },
@@ -87,7 +87,7 @@
87
87
  "@zohodesk/variables": "1.2.0",
88
88
  "@zohodesk/components": "1.6.4",
89
89
  "@zohodesk/icons": "1.2.5",
90
- "@zohodesk/svg": "1.3.2",
90
+ "@zohodesk/svg": "1.3.3",
91
91
  "@zohodesk/virtualizer": "1.0.13",
92
92
  "react-sortable-hoc": "^0.8.3",
93
93
  "@zohodesk/hooks": "2.0.8",