dtable-ui-component 4.3.6 → 4.3.8

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.
Files changed (122) hide show
  1. package/lib/AutoNumberFormatter/index.js +11 -24
  2. package/lib/ButtonFormatter/index.js +29 -45
  3. package/lib/CTimeFormatter/index.js +17 -32
  4. package/lib/CheckboxEditor/index.js +42 -49
  5. package/lib/CheckboxFormatter/index.js +17 -30
  6. package/lib/CollaboratorEditor/index.js +118 -135
  7. package/lib/CollaboratorEditor/mb-collaborator-editor-popover/index.js +90 -99
  8. package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +61 -69
  9. package/lib/CollaboratorFormatter/index.js +26 -42
  10. package/lib/CollaboratorItem/index.js +31 -44
  11. package/lib/CreatorFormatter/index.js +24 -40
  12. package/lib/DTableCustomizeCollaboratorSelect/index.js +80 -99
  13. package/lib/DTableCustomizeCollaboratorSelect/utils.js +12 -13
  14. package/lib/DTableCustomizeSelect/index.css +22 -59
  15. package/lib/DTableCustomizeSelect/index.js +99 -95
  16. package/lib/DTablePopover/index.js +52 -71
  17. package/lib/DTablePopover/utils.js +1 -1
  18. package/lib/DTableRadio/index.js +9 -7
  19. package/lib/DTableSearchInput/index.js +89 -99
  20. package/lib/DTableSearchInput/utils.js +2 -2
  21. package/lib/DTableSelect/dtable-select-label.js +5 -3
  22. package/lib/DTableSelect/index.js +50 -64
  23. package/lib/DTableSelect/utils.js +36 -41
  24. package/lib/DTableSwitch/index.js +7 -5
  25. package/lib/DateEditor/index.js +88 -94
  26. package/lib/DateEditor/mb-date-editor-popover/index.js +136 -134
  27. package/lib/DateEditor/pc-date-editor-popover.js +70 -77
  28. package/lib/DateFormatter/index.js +15 -28
  29. package/lib/DepartmentSingleSelectFormatter/index.js +9 -9
  30. package/lib/DigitalSignFormatter/index.js +55 -65
  31. package/lib/DigitalSignFormatter/utils.js +9 -8
  32. package/lib/DurationFormatter/index.js +14 -27
  33. package/lib/EditEditorButton/index.js +10 -22
  34. package/lib/EmailFormatter/index.js +11 -24
  35. package/lib/FieldDisplaySetting/field-item.js +18 -20
  36. package/lib/FieldDisplaySetting/index.js +41 -43
  37. package/lib/FileEditor/index.js +18 -29
  38. package/lib/FileFormatter/index.js +29 -43
  39. package/lib/FileItemFormatter/index.js +17 -32
  40. package/lib/FileItemFormatter/utils.js +5 -5
  41. package/lib/FileUploader/index.js +20 -33
  42. package/lib/FormulaFormatter/cell-value-validator.js +23 -8
  43. package/lib/FormulaFormatter/index.js +77 -83
  44. package/lib/FormulaFormatter/utils.js +27 -21
  45. package/lib/GeolocationFormatter/index.js +19 -32
  46. package/lib/HtmlLongTextFormatter/index.js +43 -52
  47. package/lib/HtmlLongTextFormatter/markdown2html.js +2 -2
  48. package/lib/HtmlLongTextFormatter/unified/index.js +1 -1
  49. package/lib/HtmlLongTextFormatter/vfile/core.js +10 -10
  50. package/lib/ImageFormatter/images-lazy-load.js +71 -79
  51. package/lib/ImageFormatter/index.js +86 -97
  52. package/lib/ImageFormatter/utils.js +1 -1
  53. package/lib/ImagePreviewerLightbox/index.js +20 -18
  54. package/lib/ImagePreviewerLightbox/utils.js +3 -3
  55. package/lib/LastModifierFormatter/index.js +24 -40
  56. package/lib/LinkEditor/index.js +163 -167
  57. package/lib/LinkEditor/link-editor-option.js +41 -56
  58. package/lib/LinkEditor/mb-link-editor-popover/index.js +90 -99
  59. package/lib/LinkEditor/pc-link-editor-popover/index.js +63 -71
  60. package/lib/LinkFormatter/index.js +75 -77
  61. package/lib/LongTextFormatter/index.js +5 -3
  62. package/lib/MBEditorHeader/index.js +25 -38
  63. package/lib/MTimeFormatter/index.js +17 -32
  64. package/lib/ModalPortal/index.js +15 -32
  65. package/lib/MultipleSelectEditor/index.js +118 -136
  66. package/lib/MultipleSelectFormatter/index.js +24 -40
  67. package/lib/NotificationPopover/index.js +68 -95
  68. package/lib/NumberEditor/index.js +75 -82
  69. package/lib/NumberFormatter/index.js +15 -28
  70. package/lib/RateFormatter/index.js +29 -45
  71. package/lib/RoleStatusEditor/index.js +20 -22
  72. package/lib/RowExpandEmailFormatter/index.js +24 -37
  73. package/lib/RowExpandFileFormatter/index.js +28 -42
  74. package/lib/RowExpandFileFormatter/row-expand-file-item-formatter.js +66 -82
  75. package/lib/RowExpandFormatter/index.js +92 -96
  76. package/lib/RowExpandFormulaFormatter/index.js +85 -91
  77. package/lib/RowExpandImageFormatter/index.js +65 -82
  78. package/lib/RowExpandImageFormatter/row-expand-image-item-formatter.js +71 -84
  79. package/lib/RowExpandImageFormatter/utils.js +1 -1
  80. package/lib/RowExpandLinkFormatter/collaborator-item-formatter.js +54 -68
  81. package/lib/RowExpandLinkFormatter/index.js +131 -137
  82. package/lib/RowExpandLinkFormatter/utils.js +23 -17
  83. package/lib/RowExpandLinkFormatter/value-display-utils.js +9 -7
  84. package/lib/RowExpandRateFormatter/index.js +27 -42
  85. package/lib/RowExpandUrlFormatter/index.js +27 -40
  86. package/lib/SelectItem/index.js +17 -33
  87. package/lib/SelectOptionGroup/index.css +103 -0
  88. package/lib/SelectOptionGroup/index.js +157 -135
  89. package/lib/SelectOptionGroup/option.js +31 -38
  90. package/lib/SimpleLongTextFormatter/index.js +55 -67
  91. package/lib/SimpleLongTextFormatter/normalize-long-text-value.js +23 -22
  92. package/lib/SimpleLongTextFormatter/widgets/LongTextPreview.js +42 -57
  93. package/lib/SimpleLongTextFormatter/widgets/dtable-markdown-viewer.js +31 -46
  94. package/lib/SingleSelectEditor/index.js +108 -119
  95. package/lib/SingleSelectFormatter/index.js +21 -37
  96. package/lib/TextEditor/index.js +45 -51
  97. package/lib/TextFormatter/index.js +17 -32
  98. package/lib/UrlFormatter/index.js +11 -24
  99. package/lib/cellFormatterFactory/index.js +8 -17
  100. package/lib/common/ClickOutside.js +28 -0
  101. package/lib/common/delete-tip.js +40 -65
  102. package/lib/common/modal-portal.js +15 -33
  103. package/lib/constants/index.js +5 -5
  104. package/lib/data/dtable-value.js +4 -4
  105. package/lib/formatterConfig/base-formatter-config.js +24 -3
  106. package/lib/formatterConfig/index.js +5 -4
  107. package/lib/lang/index.js +6 -6
  108. package/lib/locals/de.js +1 -1
  109. package/lib/locals/en.js +1 -1
  110. package/lib/locals/fr.js +1 -1
  111. package/lib/locals/zh-CN.js +1 -1
  112. package/lib/select-editor/mb-select-editor-popover/index.js +126 -137
  113. package/lib/select-editor/pc-select-editor-popover/index.js +75 -83
  114. package/lib/select-editor/select-editor-option.js +41 -56
  115. package/lib/toaster/alert.js +73 -88
  116. package/lib/toaster/index.js +1 -1
  117. package/lib/toaster/toast.js +75 -102
  118. package/lib/toaster/toastManager.js +55 -91
  119. package/lib/toaster/toaster.js +58 -57
  120. package/lib/utils/editor-utils.js +17 -19
  121. package/lib/utils/utils.js +14 -14
  122. package/package.json +4 -4
@@ -1,8 +1,3 @@
1
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
- import _createClass from "@babel/runtime/helpers/esm/createClass";
4
- import _inherits from "@babel/runtime/helpers/esm/inherits";
5
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
1
  import React from 'react';
7
2
  import { CellType, FORMULA_RESULT_TYPE, getFormulaDisplayString } from 'dtable-utils';
8
3
  import BaseFormatterConfig from '../formatterConfig/base-formatter-config';
@@ -10,20 +5,17 @@ import TextFormatter from '../TextFormatter';
10
5
  import { isArrayFormatColumn, isSimpleCellFormatter, isFunction, getFormulaArrayValue, convertValueToDtableLongTextValue } from '../FormulaFormatter/utils';
11
6
  import cellValueValidator from '../FormulaFormatter/cell-value-validator';
12
7
  import '../FormulaFormatter/index.css';
13
- var RowExpandFormulaFormatter = /*#__PURE__*/function (_React$Component) {
14
- _inherits(RowExpandFormulaFormatter, _React$Component);
15
- var _super = _createSuper(RowExpandFormulaFormatter);
16
- function RowExpandFormulaFormatter() {
17
- var _this;
18
- _classCallCheck(this, RowExpandFormulaFormatter);
19
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
20
- args[_key] = arguments[_key];
21
- }
22
- _this = _super.call.apply(_super, [this].concat(args));
23
- _this.renderBorder = function (dom) {
24
- var column = _this.props.column;
25
- var result_type = column.data.result_type;
26
- var style = {
8
+ export default class RowExpandFormulaFormatter extends React.Component {
9
+ constructor() {
10
+ super(...arguments);
11
+ this.renderBorder = dom => {
12
+ const {
13
+ column
14
+ } = this.props;
15
+ const {
16
+ result_type
17
+ } = column.data;
18
+ let style = {
27
19
  minHeight: '38px'
28
20
  };
29
21
  if (result_type === FORMULA_RESULT_TYPE.DATE || result_type === FORMULA_RESULT_TYPE.NUMBER) {
@@ -36,42 +28,46 @@ var RowExpandFormulaFormatter = /*#__PURE__*/function (_React$Component) {
36
28
  style: style
37
29
  }, dom);
38
30
  };
39
- _this.renderOtherColumnFormatter = function () {
40
- var _this$props = _this.props,
41
- value = _this$props.value,
42
- column = _this$props.column,
43
- collaborators = _this$props.collaborators;
44
- var _column$data = column.data,
45
- array_type = _column$data.array_type,
46
- array_data = _column$data.array_data;
31
+ this.renderOtherColumnFormatter = () => {
32
+ const {
33
+ value,
34
+ column,
35
+ collaborators
36
+ } = this.props;
37
+ const {
38
+ array_type,
39
+ array_data
40
+ } = column.data;
47
41
  if (!array_type || array_type === CellType.LINK) {
48
42
  return null;
49
43
  }
50
- var Formatter = BaseFormatterConfig[array_type];
51
- var formatterProps = _this.getFormatterProps(array_type, array_data, collaborators);
44
+ const Formatter = BaseFormatterConfig[array_type];
45
+ let formatterProps = this.getFormatterProps(array_type, array_data, collaborators);
52
46
  if (isArrayFormatColumn(array_type)) {
53
47
  formatterProps.value = value;
54
- return _this.renderBorder(_this.createColumnFormatter(Formatter, formatterProps));
48
+ return this.renderBorder(this.createColumnFormatter(Formatter, formatterProps));
55
49
  }
56
- var cellValue = value;
50
+ let cellValue = value;
57
51
  if (!Array.isArray(value)) {
58
52
  cellValue = cellValueValidator(value, array_type) ? [value] : [];
59
53
  }
60
- return _this.renderBorder( /*#__PURE__*/React.createElement("div", {
54
+ return this.renderBorder( /*#__PURE__*/React.createElement("div", {
61
55
  className: "dtable-ui formula-formatter multiple"
62
- }, cellValue.map(function (v, index) {
56
+ }, cellValue.map((v, index) => {
63
57
  formatterProps.value = v;
64
58
  return /*#__PURE__*/React.createElement("div", {
65
59
  className: "formula-formatter-content-item ".concat(isSimpleCellFormatter(array_type) ? 'simple-cell-formatter' : ''),
66
60
  key: "formula-formatter-content-item-".concat(index)
67
- }, _this.createColumnFormatter(Formatter, formatterProps));
61
+ }, this.createColumnFormatter(Formatter, formatterProps));
68
62
  })));
69
63
  };
70
- _this.getFormatterProps = function (array_type, array_data, collaborators) {
64
+ this.getFormatterProps = (array_type, array_data, collaborators) => {
71
65
  switch (array_type) {
72
66
  case CellType.DURATION:
73
67
  {
74
- var duration_format = array_data.duration_format;
68
+ const {
69
+ duration_format
70
+ } = array_data;
75
71
  return {
76
72
  format: duration_format
77
73
  };
@@ -86,65 +82,63 @@ var RowExpandFormulaFormatter = /*#__PURE__*/function (_React$Component) {
86
82
  }
87
83
  default:
88
84
  {
89
- return _objectSpread(_objectSpread({}, array_data), {}, {
90
- collaborators: collaborators
91
- });
85
+ return {
86
+ ...array_data,
87
+ collaborators
88
+ };
92
89
  }
93
90
  }
94
91
  };
95
- return _this;
96
92
  }
97
- _createClass(RowExpandFormulaFormatter, [{
98
- key: "createColumnFormatter",
99
- value: function createColumnFormatter(Formatter, formatterProps) {
100
- if (React.isValidElement(Formatter)) {
101
- return React.cloneElement(Formatter, _objectSpread({}, formatterProps));
102
- } else if (isFunction(Formatter)) {
103
- return /*#__PURE__*/React.createElement(Formatter, formatterProps);
104
- } else {
105
- return /*#__PURE__*/React.createElement(TextFormatter, formatterProps);
106
- }
107
- }
108
- }, {
109
- key: "render",
110
- value: function render() {
111
- var _this$props2 = this.props,
112
- containerClassName = _this$props2.containerClassName,
113
- column = _this$props2.column,
114
- collaborators = _this$props2.collaborators,
115
- value = _this$props2.value;
116
- var data = column.data;
117
- var array_type = data.array_type,
118
- result_type = data.result_type;
119
- if (!value) return null;
120
- if (Array.isArray(value)) {
121
- value = getFormulaArrayValue(value);
122
- if (array_type === CellType.LONG_TEXT) {
123
- value = value.map(function (item) {
124
- return convertValueToDtableLongTextValue(item);
125
- });
126
- }
127
- }
128
- if (result_type === FORMULA_RESULT_TYPE.ARRAY) {
129
- return this.renderOtherColumnFormatter();
130
- }
131
- if (typeof value === 'object') {
132
- return null;
133
- }
134
- var formattedValue = getFormulaDisplayString(value, data, {
135
- collaborators: collaborators
93
+ createColumnFormatter(Formatter, formatterProps) {
94
+ if (React.isValidElement(Formatter)) {
95
+ return React.cloneElement(Formatter, {
96
+ ...formatterProps
136
97
  });
137
- var className = "dtable-ui cell-formatter-container formula-formatter ".concat(containerClassName);
138
- if (result_type === FORMULA_RESULT_TYPE.NUMBER) {
139
- className = className + ' text-right';
98
+ } else if (isFunction(Formatter)) {
99
+ return /*#__PURE__*/React.createElement(Formatter, formatterProps);
100
+ } else {
101
+ return /*#__PURE__*/React.createElement(TextFormatter, formatterProps);
102
+ }
103
+ }
104
+ render() {
105
+ let {
106
+ containerClassName,
107
+ column,
108
+ collaborators,
109
+ value
110
+ } = this.props;
111
+ const {
112
+ data
113
+ } = column;
114
+ const {
115
+ array_type,
116
+ result_type
117
+ } = data;
118
+ if (!value) return null;
119
+ if (Array.isArray(value)) {
120
+ value = getFormulaArrayValue(value);
121
+ if (array_type === CellType.LONG_TEXT) {
122
+ value = value.map(item => convertValueToDtableLongTextValue(item));
140
123
  }
141
- return this.renderBorder( /*#__PURE__*/React.createElement("div", {
142
- className: className,
143
- title: formattedValue,
144
- "aria-label": formattedValue
145
- }, formattedValue));
146
124
  }
147
- }]);
148
- return RowExpandFormulaFormatter;
149
- }(React.Component);
150
- export { RowExpandFormulaFormatter as default };
125
+ if (result_type === FORMULA_RESULT_TYPE.ARRAY) {
126
+ return this.renderOtherColumnFormatter();
127
+ }
128
+ if (typeof value === 'object') {
129
+ return null;
130
+ }
131
+ const formattedValue = getFormulaDisplayString(value, data, {
132
+ collaborators
133
+ });
134
+ let className = "dtable-ui cell-formatter-container formula-formatter ".concat(containerClassName);
135
+ if (result_type === FORMULA_RESULT_TYPE.NUMBER) {
136
+ className = className + ' text-right';
137
+ }
138
+ return this.renderBorder( /*#__PURE__*/React.createElement("div", {
139
+ className: className,
140
+ title: formattedValue,
141
+ "aria-label": formattedValue
142
+ }, formattedValue));
143
+ }
144
+ }
@@ -1,108 +1,91 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- import _inherits from "@babel/runtime/helpers/esm/inherits";
4
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
1
  import React, { Fragment } from 'react';
6
2
  import classnames from 'classnames';
7
3
  import RowExpandImageImageFormatter from './row-expand-image-item-formatter';
8
4
  import ImagePreviewerLightbox from '../ImagePreviewerLightbox';
9
5
  import './index.css';
10
- var RowExpandImageFormatter = /*#__PURE__*/function (_React$Component) {
11
- _inherits(RowExpandImageFormatter, _React$Component);
12
- var _super = _createSuper(RowExpandImageFormatter);
13
- function RowExpandImageFormatter(props) {
14
- var _this;
15
- _classCallCheck(this, RowExpandImageFormatter);
16
- _this = _super.call(this, props);
17
- _this.onImageClick = function (index) {
18
- _this.setState({
6
+ export default class RowExpandImageFormatter extends React.Component {
7
+ constructor(props) {
8
+ super(props);
9
+ this.onImageClick = index => {
10
+ this.setState({
19
11
  isPreviewImage: true,
20
12
  previewImageIndex: index
21
13
  });
22
14
  };
23
- _this.closeImagePopup = function () {
24
- if (_this.props.onCloseCallback) {
25
- _this.props.onCloseCallback();
15
+ this.closeImagePopup = () => {
16
+ if (this.props.onCloseCallback) {
17
+ this.props.onCloseCallback();
26
18
  }
27
- _this.setState({
19
+ this.setState({
28
20
  isPreviewImage: false,
29
21
  previewImageIndex: -1
30
22
  });
31
23
  };
32
- _this.movePrev = function () {
33
- var images = _this.props.value;
34
- _this.setState(function (prevState) {
35
- return {
36
- previewImageIndex: (prevState.previewImageIndex + images.length - 1) % images.length
37
- };
38
- });
24
+ this.movePrev = () => {
25
+ let images = this.props.value;
26
+ this.setState(prevState => ({
27
+ previewImageIndex: (prevState.previewImageIndex + images.length - 1) % images.length
28
+ }));
39
29
  };
40
- _this.moveNext = function () {
41
- var images = _this.props.value;
42
- _this.setState(function (prevState) {
43
- return {
44
- previewImageIndex: (prevState.previewImageIndex + 1) % images.length
45
- };
46
- });
30
+ this.moveNext = () => {
31
+ let images = this.props.value;
32
+ this.setState(prevState => ({
33
+ previewImageIndex: (prevState.previewImageIndex + 1) % images.length
34
+ }));
47
35
  };
48
- _this.state = {
36
+ this.state = {
49
37
  isPreviewImage: false,
50
38
  previewImageIndex: -1
51
39
  };
52
- return _this;
53
40
  }
54
- _createClass(RowExpandImageFormatter, [{
55
- key: "render",
56
- value: function render() {
57
- var _this2 = this;
58
- var _this$props = this.props,
59
- value = _this$props.value,
60
- server = _this$props.server,
61
- containerClassName = _this$props.containerClassName,
62
- readOnly = _this$props.readOnly,
63
- column = _this$props.column,
64
- downloadImage = _this$props.downloadImage;
65
- var _this$state = this.state,
66
- isPreviewImage = _this$state.isPreviewImage,
67
- previewImageIndex = _this$state.previewImageIndex;
68
- if (!Array.isArray(value) || value.length === 0) {
69
- return null;
70
- }
71
- return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
72
- className: classnames('dtable-ui cell-formatter-container row-expand-image-formatter', containerClassName)
73
- }, value.map(function (item, index) {
74
- return /*#__PURE__*/React.createElement(RowExpandImageImageFormatter, {
75
- url: item,
76
- key: index,
77
- index: index,
78
- column: column,
79
- downloadFile: downloadImage,
80
- deleteFile: _this2.props.deleteFile,
81
- readOnly: readOnly,
82
- onImageClick: _this2.onImageClick
83
- });
84
- })), isPreviewImage && /*#__PURE__*/React.createElement(ImagePreviewerLightbox, {
85
- imageItems: value,
86
- imageIndex: previewImageIndex,
87
- closeImagePopup: this.closeImagePopup,
88
- moveToPrevImage: this.movePrev,
89
- moveToNextImage: this.moveNext,
90
- deleteImage: this.props.deleteFile,
91
- downloadImage: downloadImage,
92
- onRotateImage: this.props.rotateImage,
93
- readOnly: readOnly,
94
- server: server,
95
- moveToPrevRowImage: this.props.moveToPrevRowImage,
96
- moveToNextRowImage: this.props.moveToNextRowImage
97
- }));
41
+ render() {
42
+ const {
43
+ value,
44
+ server,
45
+ containerClassName,
46
+ readOnly,
47
+ column,
48
+ downloadImage
49
+ } = this.props;
50
+ const {
51
+ isPreviewImage,
52
+ previewImageIndex
53
+ } = this.state;
54
+ if (!Array.isArray(value) || value.length === 0) {
55
+ return null;
98
56
  }
99
- }]);
100
- return RowExpandImageFormatter;
101
- }(React.Component);
57
+ return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
58
+ className: classnames('dtable-ui cell-formatter-container row-expand-image-formatter', containerClassName)
59
+ }, value.map((item, index) => {
60
+ return /*#__PURE__*/React.createElement(RowExpandImageImageFormatter, {
61
+ url: item,
62
+ key: index,
63
+ index: index,
64
+ column: column,
65
+ downloadFile: downloadImage,
66
+ deleteFile: this.props.deleteFile,
67
+ readOnly: readOnly,
68
+ onImageClick: this.onImageClick
69
+ });
70
+ })), isPreviewImage && /*#__PURE__*/React.createElement(ImagePreviewerLightbox, {
71
+ imageItems: value,
72
+ imageIndex: previewImageIndex,
73
+ closeImagePopup: this.closeImagePopup,
74
+ moveToPrevImage: this.movePrev,
75
+ moveToNextImage: this.moveNext,
76
+ deleteImage: this.props.deleteFile,
77
+ downloadImage: downloadImage,
78
+ onRotateImage: this.props.rotateImage,
79
+ readOnly: readOnly,
80
+ server: server,
81
+ moveToPrevRowImage: this.props.moveToPrevRowImage,
82
+ moveToNextRowImage: this.props.moveToNextRowImage
83
+ }));
84
+ }
85
+ }
102
86
  RowExpandImageFormatter.defaultProps = {
103
87
  readOnly: true,
104
88
  value: [],
105
89
  server: '',
106
90
  containerClassName: ''
107
- };
108
- export { RowExpandImageFormatter as default };
91
+ };
@@ -1,112 +1,99 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- import _inherits from "@babel/runtime/helpers/esm/inherits";
4
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
1
  import React, { Component } from 'react';
6
2
  import { Tooltip } from 'reactstrap';
7
3
  import MediaQuery from 'react-responsive';
8
4
  import { getLocale } from '../lang';
9
5
  import DeleteTip from '../common/delete-tip';
10
- var RowExpandImageItemFormatter = /*#__PURE__*/function (_Component) {
11
- _inherits(RowExpandImageItemFormatter, _Component);
12
- var _super = _createSuper(RowExpandImageItemFormatter);
13
- function RowExpandImageItemFormatter(props) {
14
- var _this;
15
- _classCallCheck(this, RowExpandImageItemFormatter);
16
- _this = _super.call(this, props);
17
- _this.toggleTooltip = function () {
18
- _this.setState({
19
- isTooltipOpen: !_this.state.isTooltipOpen
6
+ export default class RowExpandImageItemFormatter extends Component {
7
+ constructor(props) {
8
+ super(props);
9
+ this.toggleTooltip = () => {
10
+ this.setState({
11
+ isTooltipOpen: !this.state.isTooltipOpen
20
12
  });
21
13
  };
22
- _this.closeDeleteTip = function () {
23
- _this.setState({
14
+ this.closeDeleteTip = () => {
15
+ this.setState({
24
16
  isDeleteTipOpen: false
25
17
  });
26
18
  };
27
- _this.onClickDelete = function (e) {
19
+ this.onClickDelete = e => {
28
20
  e.preventDefault();
29
21
  e.stopPropagation();
30
- _this.position = {
22
+ this.position = {
31
23
  top: e.clientY,
32
24
  left: e.clientX
33
25
  };
34
- _this.setState({
26
+ this.setState({
35
27
  isDeleteTipOpen: true
36
28
  });
37
29
  };
38
- _this.onClickDownload = function (e) {
30
+ this.onClickDownload = e => {
39
31
  e.preventDefault();
40
32
  e.stopPropagation();
41
- _this.props.downloadFile(_this.props.url, e);
33
+ this.props.downloadFile(this.props.url, e);
42
34
  };
43
- _this.onDelete = function (e) {
35
+ this.onDelete = e => {
44
36
  e.stopPropagation();
45
- _this.closeDeleteTip();
46
- _this.props.deleteFile(_this.props.index);
37
+ this.closeDeleteTip();
38
+ this.props.deleteFile(this.props.index);
47
39
  };
48
- _this.onClickImage = function () {
49
- _this.props.onImageClick(_this.props.index);
40
+ this.onClickImage = () => {
41
+ this.props.onImageClick(this.props.index);
50
42
  };
51
- _this.state = {
43
+ this.state = {
52
44
  isTooltipOpen: false,
53
45
  isDeleteTipOpen: false
54
46
  };
55
- return _this;
56
47
  }
57
- _createClass(RowExpandImageItemFormatter, [{
58
- key: "render",
59
- value: function render() {
60
- var _this$props = this.props,
61
- url = _this$props.url,
62
- column = _this$props.column,
63
- index = _this$props.index,
64
- readOnly = _this$props.readOnly,
65
- downloadFile = _this$props.downloadFile,
66
- deleteFile = _this$props.deleteFile;
67
- var id = 'image-list-preview-item' + column.key + index;
68
- var name = decodeURI(url.slice(url.lastIndexOf('/') + 1));
69
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
70
- key: "image-".concat(index),
71
- className: "row-expand-item-image",
72
- id: id,
73
- onClick: this.onClickImage
74
- }, /*#__PURE__*/React.createElement("img", {
75
- src: url,
76
- id: "item-image-".concat(index),
77
- alt: name
78
- }), /*#__PURE__*/React.createElement("div", {
79
- className: "dtable-image-icons-choice"
80
- }, downloadFile && /*#__PURE__*/React.createElement("span", {
81
- className: "image-icon",
82
- onClick: this.onClickDownload
83
- }, /*#__PURE__*/React.createElement("i", {
84
- className: "dtable-font dtable-icon-download"
85
- })), !readOnly && deleteFile && /*#__PURE__*/React.createElement("span", {
86
- className: "image-icon",
87
- onClick: this.onClickDelete
88
- }, /*#__PURE__*/React.createElement("i", {
89
- className: "dtable-font dtable-icon-fork-number"
90
- })))), this.state.isDeleteTipOpen && /*#__PURE__*/React.createElement(DeleteTip, {
91
- position: this.position,
92
- toggle: this.closeDeleteTip,
93
- onDelete: this.onDelete,
94
- deleteTip: getLocale('Are_you_sure_you_want_to_delete_this_image')
95
- }), /*#__PURE__*/React.createElement(MediaQuery, {
96
- query: '(min-width: 768px)'
97
- }, /*#__PURE__*/React.createElement(Tooltip, {
98
- placement: "bottom",
99
- isOpen: this.state.isTooltipOpen,
100
- toggle: this.toggleTooltip,
101
- target: id,
102
- delay: {
103
- show: 0,
104
- hide: 0
105
- },
106
- fade: false
107
- }, name)));
108
- }
109
- }]);
110
- return RowExpandImageItemFormatter;
111
- }(Component);
112
- export { RowExpandImageItemFormatter as default };
48
+ render() {
49
+ const {
50
+ url,
51
+ column,
52
+ index,
53
+ readOnly,
54
+ downloadFile,
55
+ deleteFile
56
+ } = this.props;
57
+ const id = 'image-list-preview-item' + column.key + index;
58
+ const name = decodeURI(url.slice(url.lastIndexOf('/') + 1));
59
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
60
+ key: "image-".concat(index),
61
+ className: "row-expand-item-image",
62
+ id: id,
63
+ onClick: this.onClickImage
64
+ }, /*#__PURE__*/React.createElement("img", {
65
+ src: url,
66
+ id: "item-image-".concat(index),
67
+ alt: name
68
+ }), /*#__PURE__*/React.createElement("div", {
69
+ className: "dtable-image-icons-choice"
70
+ }, downloadFile && /*#__PURE__*/React.createElement("span", {
71
+ className: "image-icon",
72
+ onClick: this.onClickDownload
73
+ }, /*#__PURE__*/React.createElement("i", {
74
+ className: "dtable-font dtable-icon-download"
75
+ })), !readOnly && deleteFile && /*#__PURE__*/React.createElement("span", {
76
+ className: "image-icon",
77
+ onClick: this.onClickDelete
78
+ }, /*#__PURE__*/React.createElement("i", {
79
+ className: "dtable-font dtable-icon-fork-number"
80
+ })))), this.state.isDeleteTipOpen && /*#__PURE__*/React.createElement(DeleteTip, {
81
+ position: this.position,
82
+ toggle: this.closeDeleteTip,
83
+ onDelete: this.onDelete,
84
+ deleteTip: getLocale('Are_you_sure_you_want_to_delete_this_image')
85
+ }), /*#__PURE__*/React.createElement(MediaQuery, {
86
+ query: '(min-width: 768px)'
87
+ }, /*#__PURE__*/React.createElement(Tooltip, {
88
+ placement: "bottom",
89
+ isOpen: this.state.isTooltipOpen,
90
+ toggle: this.toggleTooltip,
91
+ target: id,
92
+ delay: {
93
+ show: 0,
94
+ hide: 0
95
+ },
96
+ fade: false
97
+ }, name)));
98
+ }
99
+ }
@@ -1,4 +1,4 @@
1
- export var getImageThumbnailUrl = function getImageThumbnailUrl(url, server) {
1
+ export const getImageThumbnailUrl = (url, server) => {
2
2
  if (server && url.indexOf(server) > -1) {
3
3
  return url.replace('/workspace', '/thumbnail/workspace') + '?size=256';
4
4
  }