dtable-ui-component 4.3.7 → 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 (120) 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.js +92 -103
  15. package/lib/DTablePopover/index.js +52 -71
  16. package/lib/DTablePopover/utils.js +1 -1
  17. package/lib/DTableRadio/index.js +9 -7
  18. package/lib/DTableSearchInput/index.js +89 -99
  19. package/lib/DTableSearchInput/utils.js +2 -2
  20. package/lib/DTableSelect/dtable-select-label.js +5 -3
  21. package/lib/DTableSelect/index.js +50 -64
  22. package/lib/DTableSelect/utils.js +36 -41
  23. package/lib/DTableSwitch/index.js +7 -5
  24. package/lib/DateEditor/index.js +88 -94
  25. package/lib/DateEditor/mb-date-editor-popover/index.js +136 -134
  26. package/lib/DateEditor/pc-date-editor-popover.js +70 -77
  27. package/lib/DateFormatter/index.js +15 -28
  28. package/lib/DepartmentSingleSelectFormatter/index.js +9 -9
  29. package/lib/DigitalSignFormatter/index.js +55 -65
  30. package/lib/DigitalSignFormatter/utils.js +9 -8
  31. package/lib/DurationFormatter/index.js +14 -27
  32. package/lib/EditEditorButton/index.js +10 -22
  33. package/lib/EmailFormatter/index.js +11 -24
  34. package/lib/FieldDisplaySetting/field-item.js +18 -20
  35. package/lib/FieldDisplaySetting/index.js +41 -43
  36. package/lib/FileEditor/index.js +18 -29
  37. package/lib/FileFormatter/index.js +29 -43
  38. package/lib/FileItemFormatter/index.js +17 -32
  39. package/lib/FileItemFormatter/utils.js +5 -5
  40. package/lib/FileUploader/index.js +20 -33
  41. package/lib/FormulaFormatter/cell-value-validator.js +23 -8
  42. package/lib/FormulaFormatter/index.js +77 -83
  43. package/lib/FormulaFormatter/utils.js +27 -21
  44. package/lib/GeolocationFormatter/index.js +19 -32
  45. package/lib/HtmlLongTextFormatter/index.js +43 -52
  46. package/lib/HtmlLongTextFormatter/markdown2html.js +2 -2
  47. package/lib/HtmlLongTextFormatter/unified/index.js +1 -1
  48. package/lib/HtmlLongTextFormatter/vfile/core.js +10 -10
  49. package/lib/ImageFormatter/images-lazy-load.js +71 -79
  50. package/lib/ImageFormatter/index.js +86 -97
  51. package/lib/ImageFormatter/utils.js +1 -1
  52. package/lib/ImagePreviewerLightbox/index.js +20 -18
  53. package/lib/ImagePreviewerLightbox/utils.js +3 -3
  54. package/lib/LastModifierFormatter/index.js +24 -40
  55. package/lib/LinkEditor/index.js +163 -167
  56. package/lib/LinkEditor/link-editor-option.js +41 -56
  57. package/lib/LinkEditor/mb-link-editor-popover/index.js +90 -99
  58. package/lib/LinkEditor/pc-link-editor-popover/index.js +63 -71
  59. package/lib/LinkFormatter/index.js +75 -77
  60. package/lib/LongTextFormatter/index.js +5 -3
  61. package/lib/MBEditorHeader/index.js +25 -38
  62. package/lib/MTimeFormatter/index.js +17 -32
  63. package/lib/ModalPortal/index.js +15 -32
  64. package/lib/MultipleSelectEditor/index.js +118 -136
  65. package/lib/MultipleSelectFormatter/index.js +24 -40
  66. package/lib/NotificationPopover/index.js +68 -95
  67. package/lib/NumberEditor/index.js +75 -82
  68. package/lib/NumberFormatter/index.js +15 -28
  69. package/lib/RateFormatter/index.js +29 -45
  70. package/lib/RoleStatusEditor/index.js +20 -22
  71. package/lib/RowExpandEmailFormatter/index.js +24 -37
  72. package/lib/RowExpandFileFormatter/index.js +28 -42
  73. package/lib/RowExpandFileFormatter/row-expand-file-item-formatter.js +66 -82
  74. package/lib/RowExpandFormatter/index.js +92 -96
  75. package/lib/RowExpandFormulaFormatter/index.js +85 -91
  76. package/lib/RowExpandImageFormatter/index.js +65 -82
  77. package/lib/RowExpandImageFormatter/row-expand-image-item-formatter.js +71 -84
  78. package/lib/RowExpandImageFormatter/utils.js +1 -1
  79. package/lib/RowExpandLinkFormatter/collaborator-item-formatter.js +54 -68
  80. package/lib/RowExpandLinkFormatter/index.js +131 -137
  81. package/lib/RowExpandLinkFormatter/utils.js +23 -17
  82. package/lib/RowExpandLinkFormatter/value-display-utils.js +9 -7
  83. package/lib/RowExpandRateFormatter/index.js +27 -42
  84. package/lib/RowExpandUrlFormatter/index.js +27 -40
  85. package/lib/SelectItem/index.js +17 -33
  86. package/lib/SelectOptionGroup/index.js +141 -159
  87. package/lib/SelectOptionGroup/option.js +24 -40
  88. package/lib/SimpleLongTextFormatter/index.js +55 -67
  89. package/lib/SimpleLongTextFormatter/normalize-long-text-value.js +23 -22
  90. package/lib/SimpleLongTextFormatter/widgets/LongTextPreview.js +42 -57
  91. package/lib/SimpleLongTextFormatter/widgets/dtable-markdown-viewer.js +31 -46
  92. package/lib/SingleSelectEditor/index.js +108 -119
  93. package/lib/SingleSelectFormatter/index.js +21 -37
  94. package/lib/TextEditor/index.js +45 -51
  95. package/lib/TextFormatter/index.js +17 -32
  96. package/lib/UrlFormatter/index.js +11 -24
  97. package/lib/cellFormatterFactory/index.js +8 -17
  98. package/lib/common/ClickOutside.js +22 -43
  99. package/lib/common/delete-tip.js +40 -65
  100. package/lib/common/modal-portal.js +15 -33
  101. package/lib/constants/index.js +5 -5
  102. package/lib/data/dtable-value.js +4 -4
  103. package/lib/formatterConfig/base-formatter-config.js +24 -3
  104. package/lib/formatterConfig/index.js +5 -4
  105. package/lib/lang/index.js +6 -6
  106. package/lib/locals/de.js +1 -1
  107. package/lib/locals/en.js +1 -1
  108. package/lib/locals/fr.js +1 -1
  109. package/lib/locals/zh-CN.js +1 -1
  110. package/lib/select-editor/mb-select-editor-popover/index.js +126 -137
  111. package/lib/select-editor/pc-select-editor-popover/index.js +75 -83
  112. package/lib/select-editor/select-editor-option.js +41 -56
  113. package/lib/toaster/alert.js +73 -88
  114. package/lib/toaster/index.js +1 -1
  115. package/lib/toaster/toast.js +75 -102
  116. package/lib/toaster/toastManager.js +55 -91
  117. package/lib/toaster/toaster.js +58 -57
  118. package/lib/utils/editor-utils.js +17 -19
  119. package/lib/utils/utils.js +14 -14
  120. 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,17 +5,10 @@ import TextFormatter from '../TextFormatter';
10
5
  import { isArrayFormatColumn, isSimpleCellFormatter, isFunction, getFormulaArrayValue, convertValueToDtableLongTextValue } from './utils';
11
6
  import cellValueValidator from './cell-value-validator';
12
7
  import './index.css';
13
- var FormulaFormatter = /*#__PURE__*/function (_React$Component) {
14
- _inherits(FormulaFormatter, _React$Component);
15
- var _super = _createSuper(FormulaFormatter);
16
- function FormulaFormatter() {
17
- var _this;
18
- _classCallCheck(this, FormulaFormatter);
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.getGridCellClassName = function (resultType) {
8
+ class FormulaFormatter extends React.Component {
9
+ constructor() {
10
+ super(...arguments);
11
+ this.getGridCellClassName = resultType => {
24
12
  switch (resultType) {
25
13
  case FORMULA_RESULT_TYPE.NUMBER:
26
14
  {
@@ -32,44 +20,51 @@ var FormulaFormatter = /*#__PURE__*/function (_React$Component) {
32
20
  }
33
21
  }
34
22
  };
35
- _this.renderOtherColumnFormatter = function () {
36
- var _this$props = _this.props,
37
- value = _this$props.value,
38
- column = _this$props.column,
39
- collaborators = _this$props.collaborators;
40
- var columnData = column.data;
41
- var array_type = columnData.array_type,
42
- array_data = columnData.array_data;
23
+ this.renderOtherColumnFormatter = () => {
24
+ const {
25
+ value,
26
+ column,
27
+ collaborators
28
+ } = this.props;
29
+ const {
30
+ data: columnData
31
+ } = column;
32
+ const {
33
+ array_type,
34
+ array_data
35
+ } = columnData;
43
36
  if (!array_type || array_type === CellType.LINK) {
44
37
  return null;
45
38
  }
46
- var Formatter = BaseFormatterConfig[array_type];
47
- var formatterProps = _this.getFormatterProps(array_type, array_data, collaborators);
39
+ const Formatter = BaseFormatterConfig[array_type];
40
+ let formatterProps = this.getFormatterProps(array_type, array_data, collaborators);
48
41
  if (isArrayFormatColumn(array_type)) {
49
42
  formatterProps.value = value;
50
- return _this.createColumnFormatter(Formatter, formatterProps);
43
+ return this.createColumnFormatter(Formatter, formatterProps);
51
44
  }
52
- var _isSimpleCellFormatterColumn = isSimpleCellFormatter(array_type);
53
- var cellValue = value;
45
+ const _isSimpleCellFormatterColumn = isSimpleCellFormatter(array_type);
46
+ let cellValue = value;
54
47
  if (!Array.isArray(value)) {
55
48
  cellValue = cellValueValidator(value, array_type) ? [value] : [];
56
49
  }
57
- var contentItemClassName = "formula-formatter-content-item ".concat(_isSimpleCellFormatterColumn ? 'simple-cell-formatter' : '');
50
+ const contentItemClassName = "formula-formatter-content-item ".concat(_isSimpleCellFormatterColumn ? 'simple-cell-formatter' : '');
58
51
  return /*#__PURE__*/React.createElement("div", {
59
52
  className: "dtable-ui formula-formatter multiple"
60
- }, cellValue.map(function (v, index) {
53
+ }, cellValue.map((v, index) => {
61
54
  formatterProps.value = v;
62
55
  return /*#__PURE__*/React.createElement("div", {
63
56
  className: contentItemClassName,
64
57
  key: "formula-formatter-content-item-".concat(index)
65
- }, _this.createColumnFormatter(Formatter, formatterProps));
58
+ }, this.createColumnFormatter(Formatter, formatterProps));
66
59
  }));
67
60
  };
68
- _this.getFormatterProps = function (array_type, array_data, collaborators) {
61
+ this.getFormatterProps = (array_type, array_data, collaborators) => {
69
62
  switch (array_type) {
70
63
  case CellType.DURATION:
71
64
  {
72
- var duration_format = array_data.duration_format;
65
+ const {
66
+ duration_format
67
+ } = array_data;
73
68
  return {
74
69
  format: duration_format
75
70
  };
@@ -84,60 +79,59 @@ var FormulaFormatter = /*#__PURE__*/function (_React$Component) {
84
79
  }
85
80
  default:
86
81
  {
87
- return _objectSpread(_objectSpread({}, array_data), {}, {
88
- collaborators: collaborators
89
- });
82
+ return {
83
+ ...array_data,
84
+ collaborators
85
+ };
90
86
  }
91
87
  }
92
88
  };
93
- return _this;
94
89
  }
95
- _createClass(FormulaFormatter, [{
96
- key: "createColumnFormatter",
97
- value: function createColumnFormatter(Formatter, formatterProps) {
98
- if (React.isValidElement(Formatter)) {
99
- return React.cloneElement(Formatter, _objectSpread({}, formatterProps));
100
- } else if (isFunction(Formatter)) {
101
- return /*#__PURE__*/React.createElement(Formatter, formatterProps);
102
- }
103
- return /*#__PURE__*/React.createElement(TextFormatter, formatterProps);
90
+ createColumnFormatter(Formatter, formatterProps) {
91
+ if (React.isValidElement(Formatter)) {
92
+ return React.cloneElement(Formatter, {
93
+ ...formatterProps
94
+ });
95
+ } else if (isFunction(Formatter)) {
96
+ return /*#__PURE__*/React.createElement(Formatter, formatterProps);
104
97
  }
105
- }, {
106
- key: "render",
107
- value: function render() {
108
- var _this$props2 = this.props,
109
- containerClassName = _this$props2.containerClassName,
110
- column = _this$props2.column,
111
- collaborators = _this$props2.collaborators;
112
- var data = column.data;
113
- var array_type = data.array_type,
114
- resultType = data.result_type;
115
- var value = this.props.value;
116
- if (Array.isArray(value)) {
117
- value = getFormulaArrayValue(value);
118
- if (array_type === CellType.LONG_TEXT) {
119
- value = value.map(function (item) {
120
- return convertValueToDtableLongTextValue(item);
121
- });
122
- }
123
- }
124
- if (resultType === FORMULA_RESULT_TYPE.ARRAY) {
125
- return this.renderOtherColumnFormatter();
126
- }
127
- if (typeof value === 'object') {
128
- return null;
98
+ return /*#__PURE__*/React.createElement(TextFormatter, formatterProps);
99
+ }
100
+ render() {
101
+ const {
102
+ containerClassName,
103
+ column,
104
+ collaborators
105
+ } = this.props;
106
+ const {
107
+ data
108
+ } = column;
109
+ const {
110
+ array_type,
111
+ result_type: resultType
112
+ } = data;
113
+ let value = this.props.value;
114
+ if (Array.isArray(value)) {
115
+ value = getFormulaArrayValue(value);
116
+ if (array_type === CellType.LONG_TEXT) {
117
+ value = value.map(item => convertValueToDtableLongTextValue(item));
129
118
  }
130
- var gridCellClassName = this.getGridCellClassName(resultType);
131
- var formattedValue = getFormulaDisplayString(value, data, {
132
- collaborators: collaborators
133
- });
134
- return /*#__PURE__*/React.createElement("div", {
135
- className: "dtable-ui cell-formatter-container formula-formatter ".concat(containerClassName, " ").concat(gridCellClassName),
136
- title: formattedValue,
137
- "aria-label": formattedValue
138
- }, formattedValue);
139
119
  }
140
- }]);
141
- return FormulaFormatter;
142
- }(React.Component);
120
+ if (resultType === FORMULA_RESULT_TYPE.ARRAY) {
121
+ return this.renderOtherColumnFormatter();
122
+ }
123
+ if (typeof value === 'object') {
124
+ return null;
125
+ }
126
+ const gridCellClassName = this.getGridCellClassName(resultType);
127
+ const formattedValue = getFormulaDisplayString(value, data, {
128
+ collaborators
129
+ });
130
+ return /*#__PURE__*/React.createElement("div", {
131
+ className: "dtable-ui cell-formatter-container formula-formatter ".concat(containerClassName, " ").concat(gridCellClassName),
132
+ title: formattedValue,
133
+ "aria-label": formattedValue
134
+ }, formattedValue);
135
+ }
136
+ }
143
137
  export default FormulaFormatter;
@@ -6,11 +6,11 @@ export function isSimpleCellFormatter(type) {
6
6
  export function isArrayFormatColumn(columnType) {
7
7
  return ARRAY_FORMAT_COLUMNS.includes(columnType);
8
8
  }
9
- export var isFunction = function isFunction(functionToCheck) {
10
- var getType = {};
9
+ export const isFunction = functionToCheck => {
10
+ const getType = {};
11
11
  return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
12
12
  };
13
- export var isValidCellValue = function isValidCellValue(value) {
13
+ export const isValidCellValue = value => {
14
14
  if (value === undefined) return false;
15
15
  if (value === null) return false;
16
16
  if (value === '') return false;
@@ -18,63 +18,69 @@ export var isValidCellValue = function isValidCellValue(value) {
18
18
  if (JSON.stringify(value) === '[]') return false;
19
19
  return true;
20
20
  };
21
- export var getFormulaArrayValue = function getFormulaArrayValue(value) {
22
- var isFlat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
21
+ export const getFormulaArrayValue = function (value) {
22
+ let isFlat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
23
23
  if (!Array.isArray(value)) {
24
24
  return [];
25
25
  }
26
26
  if (!isFlat) {
27
27
  return getTwoDimensionArrayValue(value);
28
28
  }
29
- return value.map(function (item) {
29
+ return value.map(item => {
30
30
  if (Object.prototype.toString.call(item) !== '[object Object]' || !Object.prototype.hasOwnProperty.call(item, 'display_value')) {
31
31
  return item;
32
32
  }
33
- var display_value = item.display_value;
33
+ const {
34
+ display_value
35
+ } = item;
34
36
  if (!Array.isArray(display_value) || display_value.length === 0) {
35
37
  return display_value;
36
38
  }
37
- return display_value.map(function (i) {
39
+ return display_value.map(i => {
38
40
  if (Object.prototype.toString.call(i) === '[object Object]') {
39
41
  if (!Object.prototype.hasOwnProperty.call(i, 'display_value')) {
40
42
  return i;
41
43
  }
42
- var _display_value = i.display_value;
43
- return _display_value;
44
+ const {
45
+ display_value
46
+ } = i;
47
+ return display_value;
44
48
  }
45
49
  return i;
46
50
  });
47
- }).flat().filter(function (item) {
48
- return isValidCellValue(item);
49
- });
51
+ }).flat().filter(item => isValidCellValue(item));
50
52
  };
51
- export var getTwoDimensionArrayValue = function getTwoDimensionArrayValue(value) {
53
+ export const getTwoDimensionArrayValue = value => {
52
54
  if (!Array.isArray(value)) return [];
53
- return value.map(function (item) {
55
+ return value.map(item => {
54
56
  if (Object.prototype.toString.call(item) !== '[object Object]') {
55
57
  return item;
56
58
  }
57
59
  if (!Object.prototype.hasOwnProperty.call(item, 'display_value')) {
58
60
  return item;
59
61
  }
60
- var display_value = item.display_value;
62
+ const {
63
+ display_value
64
+ } = item;
61
65
  if (!Array.isArray(display_value) || display_value.length === 0) {
62
66
  return display_value;
63
67
  }
64
- return display_value.map(function (i) {
68
+ return display_value.map(i => {
65
69
  if (Object.prototype.toString.call(i) === '[object Object]') {
66
70
  if (!Object.prototype.hasOwnProperty.call(i, 'display_value')) {
67
71
  return i;
68
72
  }
69
- var _display_value2 = i.display_value;
70
- return _display_value2;
73
+ const {
74
+ display_value
75
+ } = i;
76
+ return display_value;
71
77
  }
72
78
  return i;
73
79
  });
74
80
  });
75
81
  };
76
- export var convertValueToDtableLongTextValue = function convertValueToDtableLongTextValue(value) {
77
- var valueType = Object.prototype.toString.call(value);
82
+ export const convertValueToDtableLongTextValue = value => {
83
+ const valueType = Object.prototype.toString.call(value);
78
84
  if (value && valueType === '[object String]') {
79
85
  return getPreviewContent(value);
80
86
  }
@@ -1,40 +1,27 @@
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 from 'react';
6
2
  import classnames from 'classnames';
7
3
  import { getGeolocationDisplayString } from 'dtable-utils';
8
4
  import './index.css';
9
- var GeolocationFormatter = /*#__PURE__*/function (_React$Component) {
10
- _inherits(GeolocationFormatter, _React$Component);
11
- var _super = _createSuper(GeolocationFormatter);
12
- function GeolocationFormatter() {
13
- _classCallCheck(this, GeolocationFormatter);
14
- return _super.apply(this, arguments);
15
- }
16
- _createClass(GeolocationFormatter, [{
17
- key: "render",
18
- value: function render() {
19
- var _this$props = this.props,
20
- value = _this$props.value,
21
- data = _this$props.data,
22
- containerClassName = _this$props.containerClassName,
23
- isBaiduMap = _this$props.isBaiduMap;
24
- var className = classnames('dtable-ui cell-formatter-container geolocation-formatter', containerClassName);
25
- if (typeof value !== 'object') {
26
- return null;
27
- }
28
- return /*#__PURE__*/React.createElement("div", {
29
- className: className
30
- }, getGeolocationDisplayString(value, data, {
31
- isBaiduMap: isBaiduMap,
32
- hyphen: ' '
33
- }));
5
+ class GeolocationFormatter extends React.Component {
6
+ render() {
7
+ let {
8
+ value,
9
+ data,
10
+ containerClassName,
11
+ isBaiduMap
12
+ } = this.props;
13
+ let className = classnames('dtable-ui cell-formatter-container geolocation-formatter', containerClassName);
14
+ if (typeof value !== 'object') {
15
+ return null;
34
16
  }
35
- }]);
36
- return GeolocationFormatter;
37
- }(React.Component);
17
+ return /*#__PURE__*/React.createElement("div", {
18
+ className: className
19
+ }, getGeolocationDisplayString(value, data, {
20
+ isBaiduMap,
21
+ hyphen: ' '
22
+ }));
23
+ }
24
+ }
38
25
  GeolocationFormatter.defaultProps = {
39
26
  value: {
40
27
  province: '',
@@ -1,78 +1,69 @@
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 classnames from 'classnames';
7
3
  import { processor } from './markdown2html';
8
4
  import './index.css';
9
- var HtmlLongTextFormatter = /*#__PURE__*/function (_Component) {
10
- _inherits(HtmlLongTextFormatter, _Component);
11
- var _super = _createSuper(HtmlLongTextFormatter);
12
- function HtmlLongTextFormatter(_props) {
13
- var _this;
14
- _classCallCheck(this, HtmlLongTextFormatter);
15
- _this = _super.call(this, _props);
16
- _this.translateValue = function (props) {
17
- var value = props.value;
5
+ class HtmlLongTextFormatter extends Component {
6
+ constructor(_props) {
7
+ super(_props);
8
+ this.translateValue = props => {
9
+ const {
10
+ value
11
+ } = props;
18
12
  if (!value) {
19
- _this.setState({
13
+ this.setState({
20
14
  innerHtml: null
21
15
  });
22
16
  return;
23
17
  }
24
- var valueType = Object.prototype.toString.call(value);
18
+ const valueType = Object.prototype.toString.call(value);
25
19
  if (valueType === '[object String]') {
26
- _this.convertMarkdown(value);
20
+ this.convertMarkdown(value);
27
21
  return;
28
22
  }
29
23
  if (valueType === '[object Object]') {
30
- _this.convertMarkdown(value.text);
24
+ this.convertMarkdown(value.text);
31
25
  return;
32
26
  }
33
27
  return;
34
28
  };
35
- _this.convertMarkdown = function (mdFile) {
36
- processor.process(mdFile).then(function (result) {
37
- var innerHtml = String(result).replace(/<a /ig, '<a target="_blank" ');
38
- _this.setState({
39
- innerHtml: innerHtml
29
+ this.convertMarkdown = mdFile => {
30
+ processor.process(mdFile).then(result => {
31
+ let innerHtml = String(result).replace(/<a /ig, '<a target="_blank" ');
32
+ this.setState({
33
+ innerHtml
40
34
  });
41
35
  });
42
36
  };
43
- _this.state = {
37
+ this.state = {
44
38
  innerHtml: null
45
39
  };
46
- return _this;
47
40
  }
48
- _createClass(HtmlLongTextFormatter, [{
49
- key: "componentDidMount",
50
- value: function componentDidMount() {
51
- this.translateValue(this.props);
41
+ componentDidMount() {
42
+ this.translateValue(this.props);
43
+ }
44
+ UNSAFE_componentWillReceiveProps(nextProps) {
45
+ const {
46
+ value
47
+ } = this.props;
48
+ if (nextProps.value !== value) {
49
+ this.translateValue(nextProps);
52
50
  }
53
- }, {
54
- key: "UNSAFE_componentWillReceiveProps",
55
- value: function UNSAFE_componentWillReceiveProps(nextProps) {
56
- var value = this.props.value;
57
- if (nextProps.value !== value) {
58
- this.translateValue(nextProps);
51
+ }
52
+ render() {
53
+ const {
54
+ innerHtml
55
+ } = this.state;
56
+ const {
57
+ containerClassName
58
+ } = this.props;
59
+ const className = classnames('dtable-ui cell-formatter-container long-text-formatter', containerClassName);
60
+ if (!innerHtml) return null;
61
+ return /*#__PURE__*/React.createElement("div", {
62
+ className: "".concat(className, " article"),
63
+ dangerouslySetInnerHTML: {
64
+ __html: innerHtml
59
65
  }
60
- }
61
- }, {
62
- key: "render",
63
- value: function render() {
64
- var innerHtml = this.state.innerHtml;
65
- var containerClassName = this.props.containerClassName;
66
- var className = classnames('dtable-ui cell-formatter-container long-text-formatter', containerClassName);
67
- if (!innerHtml) return null;
68
- return /*#__PURE__*/React.createElement("div", {
69
- className: "".concat(className, " article"),
70
- dangerouslySetInnerHTML: {
71
- __html: innerHtml
72
- }
73
- });
74
- }
75
- }]);
76
- return HtmlLongTextFormatter;
77
- }(Component);
66
+ });
67
+ }
68
+ }
78
69
  export default HtmlLongTextFormatter;
@@ -9,8 +9,8 @@ var toHTML = require('hast-util-to-html');
9
9
  var sanitize = require('hast-util-sanitize');
10
10
  var gh = require('hast-util-sanitize/lib/github');
11
11
  var deepmerge = require('deepmerge').default;
12
- var mathjax = require('rehype-mathjax/browser');
13
- var math = require('remark-math/block');
12
+ const mathjax = require('rehype-mathjax/browser');
13
+ const math = require('remark-math/block');
14
14
  var unified = require('./unified').default;
15
15
  function stringify(config) {
16
16
  var settings = xtend(config, this.data('settings'));
@@ -396,5 +396,5 @@ function assertDone(name, asyncName, complete) {
396
396
  }
397
397
 
398
398
  /* Expose a frozen processor. */
399
- var unified_freeze = unified().freeze();
399
+ const unified_freeze = unified().freeze();
400
400
  export default unified_freeze;
@@ -58,10 +58,10 @@ function VFile(options) {
58
58
 
59
59
  /* Access full path (`~/index.min.js`). */
60
60
  Object.defineProperty(proto, 'path', {
61
- get: function get() {
61
+ get: function () {
62
62
  return this.history[this.history.length - 1];
63
63
  },
64
- set: function set(path) {
64
+ set: function (path) {
65
65
  assertNonEmpty(path, 'path');
66
66
  if (path !== this.path) {
67
67
  this.history.push(path);
@@ -71,10 +71,10 @@ Object.defineProperty(proto, 'path', {
71
71
 
72
72
  /* Access parent path (`~`). */
73
73
  Object.defineProperty(proto, 'dirname', {
74
- get: function get() {
74
+ get: function () {
75
75
  return typeof this.path === 'string' ? path.dirname(this.path) : undefined;
76
76
  },
77
- set: function set(dirname) {
77
+ set: function (dirname) {
78
78
  assertPath(this.path, 'dirname');
79
79
  this.path = path.join(dirname || '', this.basename);
80
80
  }
@@ -82,10 +82,10 @@ Object.defineProperty(proto, 'dirname', {
82
82
 
83
83
  /* Access basename (`index.min.js`). */
84
84
  Object.defineProperty(proto, 'basename', {
85
- get: function get() {
85
+ get: function () {
86
86
  return typeof this.path === 'string' ? path.basename(this.path) : undefined;
87
87
  },
88
- set: function set(basename) {
88
+ set: function (basename) {
89
89
  assertNonEmpty(basename, 'basename');
90
90
  assertPart(basename, 'basename');
91
91
  this.path = path.join(this.dirname || '', basename);
@@ -94,10 +94,10 @@ Object.defineProperty(proto, 'basename', {
94
94
 
95
95
  /* Access extname (`.js`). */
96
96
  Object.defineProperty(proto, 'extname', {
97
- get: function get() {
97
+ get: function () {
98
98
  return typeof this.path === 'string' ? path.extname(this.path) : undefined;
99
99
  },
100
- set: function set(extname) {
100
+ set: function (extname) {
101
101
  var ext = extname || '';
102
102
  assertPart(ext, 'extname');
103
103
  assertPath(this.path, 'extname');
@@ -115,10 +115,10 @@ Object.defineProperty(proto, 'extname', {
115
115
 
116
116
  /* Access stem (`index.min`). */
117
117
  Object.defineProperty(proto, 'stem', {
118
- get: function get() {
118
+ get: function () {
119
119
  return typeof this.path === 'string' ? path.basename(this.path, this.extname) : undefined;
120
120
  },
121
- set: function set(stem) {
121
+ set: function (stem) {
122
122
  assertNonEmpty(stem, 'stem');
123
123
  assertPart(stem, 'stem');
124
124
  this.path = path.join(this.dirname || '', stem + (this.extname || ''));