dtable-ui-component 0.3.4 → 0.3.6-beta.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.
Files changed (47) hide show
  1. package/lib/AutoNumberFormatter/index.js +2 -2
  2. package/lib/ButtonFormatter/index.js +2 -2
  3. package/lib/CTimeFormatter/index.js +2 -2
  4. package/lib/CheckboxFormatter/index.js +2 -2
  5. package/lib/CollaboratorFormatter/index.js +2 -2
  6. package/lib/CreatorFormatter/index.js +2 -2
  7. package/lib/DTableSearchInput/index.js +2 -2
  8. package/lib/DateEditor/index.js +1 -1
  9. package/lib/DateFormatter/index.js +5 -17
  10. package/lib/DigitalSignFormatter/index.js +2 -2
  11. package/lib/DurationFormatter/index.js +3 -3
  12. package/lib/EmailFormatter/index.js +2 -2
  13. package/lib/FileFormatter/index.js +2 -2
  14. package/lib/FormulaFormatter/index.js +25 -7
  15. package/lib/FormulaFormatter/utils.js +91 -0
  16. package/lib/GeolocationFormatter/index.js +11 -6
  17. package/lib/HtmlLongTextFormatter/index.js +2 -2
  18. package/lib/ImageFormatter/images-lazy-load.js +1 -1
  19. package/lib/ImageFormatter/index.js +2 -2
  20. package/lib/ImagePreviewerLightbox/index.js +3 -3
  21. package/lib/LastModifierFormatter/index.js +2 -2
  22. package/lib/LinkEditor/index.js +1 -1
  23. package/lib/LinkFormatter/index.js +7 -8
  24. package/lib/MTimeFormatter/index.js +2 -2
  25. package/lib/MultipleSelectFormatter/index.js +2 -2
  26. package/lib/NumberEditor/index.js +1 -1
  27. package/lib/NumberFormatter/index.js +3 -3
  28. package/lib/RateFormatter/index.js +2 -2
  29. package/lib/RowExpandFormatter/index.js +7 -5
  30. package/lib/RowExpandLinkFormatter/collaborator-item-formatter.js +2 -6
  31. package/lib/RowExpandLinkFormatter/value-display-utils.js +10 -398
  32. package/lib/SimpleLongTextFormatter/index.js +2 -2
  33. package/lib/SingleSelectFormatter/index.js +2 -2
  34. package/lib/TextFormatter/index.js +2 -2
  35. package/lib/UrlFormatter/index.js +2 -2
  36. package/lib/constants/index.js +2 -33
  37. package/lib/data/dtable-value.js +1 -6
  38. package/lib/index.js +1 -3
  39. package/lib/utils/utils.js +0 -14
  40. package/package.json +4 -4
  41. package/lib/RowExpandLinkFormatter/column-data-constants.js +0 -20
  42. package/lib/RowExpandLinkFormatter/date-utils.js +0 -127
  43. package/lib/RowExpandLinkFormatter/formula-constants.js +0 -9
  44. package/lib/RowExpandLinkFormatter/number-precision.js +0 -116
  45. package/lib/constants/cell-types.js +0 -29
  46. package/lib/utils/number-precision.js +0 -164
  47. package/lib/utils/value-format-utils.js +0 -587
@@ -3,7 +3,7 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
3
  import _inherits from "@babel/runtime/helpers/esm/inherits";
4
4
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React from 'react';
6
- import cn from 'astro-classname';
6
+ import classnames from 'classnames';
7
7
  import './index.css';
8
8
 
9
9
  var AutoNumberFormatter = /*#__PURE__*/function (_React$Component) {
@@ -23,7 +23,7 @@ var AutoNumberFormatter = /*#__PURE__*/function (_React$Component) {
23
23
  var _this$props = this.props,
24
24
  containerClassName = _this$props.containerClassName,
25
25
  value = _this$props.value;
26
- var classname = cn('dtable-ui cell-formatter-container auto-number-formatter', containerClassName);
26
+ var classname = classnames('dtable-ui cell-formatter-container auto-number-formatter', containerClassName);
27
27
  return /*#__PURE__*/React.createElement("div", {
28
28
  className: classname
29
29
  }, value);
@@ -3,7 +3,7 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
3
  import _inherits from "@babel/runtime/helpers/esm/inherits";
4
4
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React from 'react';
6
- import cn from 'astro-classname';
6
+ import classnames from 'classnames';
7
7
  import './index.css';
8
8
 
9
9
  var ButtonFormatter = /*#__PURE__*/function (_React$Component) {
@@ -56,7 +56,7 @@ var ButtonFormatter = /*#__PURE__*/function (_React$Component) {
56
56
  color: colorOption.TEXT_COLOR
57
57
  };
58
58
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("button", {
59
- className: cn('dtable-ui cell-formatter-container button-formatter', containerClassName),
59
+ className: classnames('dtable-ui cell-formatter-container button-formatter', containerClassName),
60
60
  style: btnStyle,
61
61
  onClick: this.handleClick
62
62
  }, button_name));
@@ -3,7 +3,7 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
3
  import _inherits from "@babel/runtime/helpers/esm/inherits";
4
4
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React from 'react';
6
- import cn from 'astro-classname';
6
+ import classnames from 'classnames';
7
7
  import dayjs from 'dayjs';
8
8
  import './index.css';
9
9
 
@@ -36,7 +36,7 @@ var CTimeFormatter = /*#__PURE__*/function (_React$Component) {
36
36
  var _this$props = this.props,
37
37
  date = _this$props.value,
38
38
  containerClassName = _this$props.containerClassName;
39
- var classname = cn('dtable-ui cell-formatter-container ctime-formatter', containerClassName);
39
+ var classname = classnames('dtable-ui cell-formatter-container ctime-formatter', containerClassName);
40
40
 
41
41
  if (date !== '') {
42
42
  date = this.formatDate(date);
@@ -3,7 +3,7 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
3
  import _inherits from "@babel/runtime/helpers/esm/inherits";
4
4
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React from 'react';
6
- import cn from 'astro-classname';
6
+ import classnames from 'classnames';
7
7
  import './index.css';
8
8
 
9
9
  var CheckboxFormatter = /*#__PURE__*/function (_React$PureComponent) {
@@ -24,7 +24,7 @@ var CheckboxFormatter = /*#__PURE__*/function (_React$PureComponent) {
24
24
  value = _this$props.value,
25
25
  containerClassName = _this$props.containerClassName;
26
26
  value = value === true ? true : false;
27
- var classname = cn('dtable-ui cell-formatter-container checkbox-formatter d-flex align-items-center justify-content-center', containerClassName);
27
+ var classname = classnames('dtable-ui cell-formatter-container checkbox-formatter d-flex align-items-center justify-content-center', containerClassName);
28
28
 
29
29
  if (value) {
30
30
  return /*#__PURE__*/React.createElement("div", {
@@ -3,7 +3,7 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
3
  import _inherits from "@babel/runtime/helpers/esm/inherits";
4
4
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React from 'react';
6
- import cn from 'astro-classname';
6
+ import classnames from 'classnames';
7
7
  import CollaboratorItem from '../CollaboratorItem';
8
8
  import DefaultAvatar from '../assets/images/avatar/default_avatar.png';
9
9
  import './index.css';
@@ -70,7 +70,7 @@ var CollaboratorFormatter = /*#__PURE__*/function (_React$PureComponent) {
70
70
  var _this$props2 = this.props,
71
71
  containerClassName = _this$props2.containerClassName,
72
72
  value = _this$props2.value;
73
- var classname = cn('dtable-ui cell-formatter-container collaborator-formatter', containerClassName);
73
+ var classname = classnames('dtable-ui cell-formatter-container collaborator-formatter', containerClassName);
74
74
 
75
75
  if (!value || Array.isArray(value) && value.length === 0) {
76
76
  return /*#__PURE__*/React.createElement("div", {
@@ -3,7 +3,7 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
3
  import _inherits from "@babel/runtime/helpers/esm/inherits";
4
4
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React from 'react';
6
- import cn from 'astro-classname';
6
+ import classnames from 'classnames';
7
7
  import CollaboratorItem from '../CollaboratorItem';
8
8
  import DefaultAvatar from '../assets/images/avatar/default_avatar.png';
9
9
  import './index.css';
@@ -66,7 +66,7 @@ var CreatorFormatter = /*#__PURE__*/function (_React$PureComponent) {
66
66
  var _this$props2 = this.props,
67
67
  containerClassName = _this$props2.containerClassName,
68
68
  value = _this$props2.value;
69
- var classname = cn('dtable-ui cell-formatter-container creator-formatter', containerClassName);
69
+ var classname = classnames('dtable-ui cell-formatter-container creator-formatter', containerClassName);
70
70
 
71
71
  if (!value || Array.isArray(value) && value.length === 0) {
72
72
  return /*#__PURE__*/React.createElement("div", {
@@ -103,8 +103,8 @@ var DtableSearchInput = /*#__PURE__*/function (_Component) {
103
103
  }
104
104
 
105
105
  _createClass(DtableSearchInput, [{
106
- key: "componentWillReceiveProps",
107
- value: function componentWillReceiveProps(nextProps) {
106
+ key: "UNSAFE_componentWillReceiveProps",
107
+ value: function UNSAFE_componentWillReceiveProps(nextProps) {
108
108
  if (nextProps.value !== this.props.value) {
109
109
  this.setState({
110
110
  searchValue: nextProps.value
@@ -5,7 +5,7 @@ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React, { Fragment } from 'react';
6
6
  import MediaQuery from 'react-responsive';
7
7
  import dayjs from 'dayjs';
8
- import { getDateDisplayString } from '../utils/value-format-utils';
8
+ import { getDateDisplayString } from '@seafile/dtable-utils';
9
9
  import PCDateEditorPopover from './pc-date-editor-popover';
10
10
  import MBDateEditorPopover from './mb-date-editor-popover';
11
11
  import './index.css';
@@ -3,8 +3,8 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
3
  import _inherits from "@babel/runtime/helpers/esm/inherits";
4
4
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React from 'react';
6
- import cn from 'astro-classname';
7
- import { getDateDisplayString } from '../utils/value-format-utils';
6
+ import classnames from 'classnames';
7
+ import { getDateDisplayString } from '@seafile/dtable-utils';
8
8
  import './index.css';
9
9
 
10
10
  var DateFormatter = /*#__PURE__*/function (_React$Component) {
@@ -13,21 +13,9 @@ var DateFormatter = /*#__PURE__*/function (_React$Component) {
13
13
  var _super = _createSuper(DateFormatter);
14
14
 
15
15
  function DateFormatter() {
16
- var _this;
17
-
18
16
  _classCallCheck(this, DateFormatter);
19
17
 
20
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
21
- args[_key] = arguments[_key];
22
- }
23
-
24
- _this = _super.call.apply(_super, [this].concat(args));
25
-
26
- _this.formatDate = function (date, format) {
27
- return getDateDisplayString(date, format);
28
- };
29
-
30
- return _this;
18
+ return _super.apply(this, arguments);
31
19
  }
32
20
 
33
21
  _createClass(DateFormatter, [{
@@ -37,10 +25,10 @@ var DateFormatter = /*#__PURE__*/function (_React$Component) {
37
25
  date = _this$props.value,
38
26
  format = _this$props.format,
39
27
  containerClassName = _this$props.containerClassName;
40
- var classname = cn('dtable-ui cell-formatter-container date-formatter', containerClassName);
28
+ var classname = classnames('dtable-ui cell-formatter-container date-formatter', containerClassName);
41
29
 
42
30
  if (date !== '') {
43
- date = this.formatDate(date, format);
31
+ date = getDateDisplayString(date, format);
44
32
  }
45
33
 
46
34
  return /*#__PURE__*/React.createElement("div", {
@@ -3,7 +3,7 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
3
  import _inherits from "@babel/runtime/helpers/esm/inherits";
4
4
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React, { Component } from 'react';
6
- import cn from 'astro-classname';
6
+ import classnames from 'classnames';
7
7
  import ImagesLazyLoad from '../ImageFormatter/images-lazy-load';
8
8
  import ImagePreviewerLightbox from '../ImagePreviewerLightbox';
9
9
  import { getDigitalSignImageUrl } from './utils';
@@ -79,7 +79,7 @@ var DigitalSignFormatter = /*#__PURE__*/function (_Component) {
79
79
  readOnly = _this$props2.readOnly,
80
80
  config = _this$props2.config,
81
81
  isSample = _this$props2.isSample;
82
- var className = cn('dtable-ui cell-formatter-container digital-sign-formatter', containerClassName);
82
+ var className = classnames('dtable-ui cell-formatter-container digital-sign-formatter', containerClassName);
83
83
  var signImages = this.getSignImages();
84
84
  if (signImages.length === 0) return null;
85
85
  var _this$state = this.state,
@@ -3,8 +3,8 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
3
  import _inherits from "@babel/runtime/helpers/esm/inherits";
4
4
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React from 'react';
6
- import cn from 'astro-classname';
7
- import { getDurationDisplayString } from '../utils/value-format-utils';
6
+ import classnames from 'classnames';
7
+ import { getDurationDisplayString } from '@seafile/dtable-utils';
8
8
  import './index.css';
9
9
 
10
10
  var DurationFormatter = /*#__PURE__*/function (_React$Component) {
@@ -25,7 +25,7 @@ var DurationFormatter = /*#__PURE__*/function (_React$Component) {
25
25
  value = _this$props.value,
26
26
  containerClassName = _this$props.containerClassName,
27
27
  format = _this$props.format;
28
- var classname = cn('dtable-ui cell-formatter-container duration-formatter', containerClassName);
28
+ var classname = classnames('dtable-ui cell-formatter-container duration-formatter', containerClassName);
29
29
  return /*#__PURE__*/React.createElement("div", {
30
30
  className: classname
31
31
  }, getDurationDisplayString(value, {
@@ -3,7 +3,7 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
3
  import _inherits from "@babel/runtime/helpers/esm/inherits";
4
4
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React from 'react';
6
- import cn from 'astro-classname';
6
+ import classnames from 'classnames';
7
7
  import './index.css';
8
8
 
9
9
  var EmailFormatter = /*#__PURE__*/function (_React$Component) {
@@ -23,7 +23,7 @@ var EmailFormatter = /*#__PURE__*/function (_React$Component) {
23
23
  var _this$props = this.props,
24
24
  containerClassName = _this$props.containerClassName,
25
25
  value = _this$props.value;
26
- var classname = cn('dtable-ui cell-formatter-container email-formatter', containerClassName);
26
+ var classname = classnames('dtable-ui cell-formatter-container email-formatter', containerClassName);
27
27
  return /*#__PURE__*/React.createElement("div", {
28
28
  className: classname
29
29
  }, value);
@@ -3,7 +3,7 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
3
  import _inherits from "@babel/runtime/helpers/esm/inherits";
4
4
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React from 'react';
6
- import cn from 'astro-classname';
6
+ import classnames from 'classnames';
7
7
  import FileItemFormatter from '../FileItemFormatter';
8
8
  import './index.css';
9
9
 
@@ -30,7 +30,7 @@ var FileFormatter = /*#__PURE__*/function (_React$PureComponent) {
30
30
  return null;
31
31
  }
32
32
 
33
- var className = cn('dtable-ui cell-formatter-container file-formatter', containerClassName);
33
+ var className = classnames('dtable-ui cell-formatter-container file-formatter', containerClassName);
34
34
 
35
35
  if (isSample) {
36
36
  var item = value[0];
@@ -4,12 +4,11 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
4
4
  import _inherits from "@babel/runtime/helpers/esm/inherits";
5
5
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
6
  import React from 'react';
7
- import { FORMULA_RESULT_TYPE, CellType } from '../constants';
7
+ import { CellType, FORMULA_RESULT_TYPE, getFormulaDisplayString } from '@seafile/dtable-utils';
8
8
  import BaseFormatterConfig from '../formatterConfig/base-formatter-config';
9
9
  import TextFormatter from '../TextFormatter';
10
- import { isArrayFormalColumn, isSimpleCellFormatter, isFunction } from './utils';
10
+ import { isArrayFormalColumn, isSimpleCellFormatter, isFunction, getFormulaArrayValue, convertValueToDtableLongTextValue } from './utils';
11
11
  import cellValueValidator from './cell-value-validator';
12
- import { getFormulaDisplayString } from '../utils/value-format-utils';
13
12
  import './index.css';
14
13
 
15
14
  var FormulaFormatter = /*#__PURE__*/function (_React$Component) {
@@ -130,12 +129,31 @@ var FormulaFormatter = /*#__PURE__*/function (_React$Component) {
130
129
  key: "render",
131
130
  value: function render() {
132
131
  var _this$props2 = this.props,
133
- value = _this$props2.value,
134
132
  containerClassName = _this$props2.containerClassName,
135
133
  column = _this$props2.column,
136
134
  collaborators = _this$props2.collaborators;
137
- var columnData = column.data;
138
- var resultType = columnData.result_type;
135
+ var data = column.data;
136
+ var array_type = data.array_type,
137
+ resultType = data.result_type;
138
+ var value = this.props.value;
139
+
140
+ if (Array.isArray(value)) {
141
+ value = getFormulaArrayValue(value);
142
+
143
+ if (array_type === CellType.DATE || resultType === FORMULA_RESULT_TYPE.DATE) {
144
+ value = value.map(function (item) {
145
+ return item.replace('T', ' ').replace('Z', '');
146
+ });
147
+ } else if (array_type === CellType.LONG_TEXT) {
148
+ value = value.map(function (item) {
149
+ return convertValueToDtableLongTextValue(item);
150
+ });
151
+ }
152
+ } else {
153
+ if (resultType === FORMULA_RESULT_TYPE.DATE) {
154
+ value = value.replace('T', ' ').replace('Z', '');
155
+ }
156
+ }
139
157
 
140
158
  if (resultType === FORMULA_RESULT_TYPE.ARRAY) {
141
159
  return this.renderOtherColumnFormatter();
@@ -146,7 +164,7 @@ var FormulaFormatter = /*#__PURE__*/function (_React$Component) {
146
164
  }
147
165
 
148
166
  var gridCellClassName = this.getGridCellClassName(resultType);
149
- var formattedValue = getFormulaDisplayString(value, columnData, {
167
+ var formattedValue = getFormulaDisplayString(value, data, {
150
168
  collaborators: collaborators
151
169
  });
152
170
  return /*#__PURE__*/React.createElement("div", {
@@ -1,4 +1,5 @@
1
1
  import { ARRAY_FORMAL_COLUMNS, SIMPLE_CELL_COLUMNS, SIMPLE_CELL_FORMULA_RESULTS } from '../constants';
2
+ import getPreviewContent from '../SimpleLongTextFormatter/normalize-long-text-value';
2
3
  export function isSimpleCellFormatter(type) {
3
4
  return SIMPLE_CELL_COLUMNS.includes(type) || SIMPLE_CELL_FORMULA_RESULTS.includes(type);
4
5
  }
@@ -8,4 +9,94 @@ export function isArrayFormalColumn(columnType) {
8
9
  export var isFunction = function isFunction(functionToCheck) {
9
10
  var getType = {};
10
11
  return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
12
+ };
13
+ export var isValidCellValue = function isValidCellValue(value) {
14
+ if (value === undefined) return false;
15
+ if (value === null) return false;
16
+ if (value === '') return false;
17
+ if (JSON.stringify(value) === '{}') return false;
18
+ if (JSON.stringify(value) === '[]') return false;
19
+ return true;
20
+ };
21
+ export var getFormulaArrayValue = function getFormulaArrayValue(value) {
22
+ var isFlat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
23
+
24
+ if (!Array.isArray(value)) {
25
+ return [];
26
+ }
27
+
28
+ if (!isFlat) {
29
+ return getTwoDimensionArrayValue(value);
30
+ }
31
+
32
+ return value.map(function (item) {
33
+ if (Object.prototype.toString.call(item) !== '[object Object]' || !Object.prototype.hasOwnProperty.call(item, 'display_value')) {
34
+ return item;
35
+ }
36
+
37
+ var display_value = item.display_value;
38
+
39
+ if (!Array.isArray(display_value) || display_value.length === 0) {
40
+ return display_value;
41
+ }
42
+
43
+ return display_value.map(function (i) {
44
+ if (Object.prototype.toString.call(i) === '[object Object]') {
45
+ if (!Object.prototype.hasOwnProperty.call(i, 'display_value')) {
46
+ return i;
47
+ }
48
+
49
+ var _display_value = i.display_value;
50
+ return _display_value;
51
+ }
52
+
53
+ return i;
54
+ });
55
+ }).flat().filter(function (item) {
56
+ return isValidCellValue(item);
57
+ });
58
+ };
59
+ export var getTwoDimensionArrayValue = function getTwoDimensionArrayValue(value) {
60
+ if (!Array.isArray(value)) return [];
61
+ return value.map(function (item) {
62
+ if (Object.prototype.toString.call(item) !== '[object Object]') {
63
+ return item;
64
+ }
65
+
66
+ if (!Object.prototype.hasOwnProperty.call(item, 'display_value')) {
67
+ return item;
68
+ }
69
+
70
+ var display_value = item.display_value;
71
+
72
+ if (!Array.isArray(display_value) || display_value.length === 0) {
73
+ return display_value;
74
+ }
75
+
76
+ return display_value.map(function (i) {
77
+ if (Object.prototype.toString.call(i) === '[object Object]') {
78
+ if (!Object.prototype.hasOwnProperty.call(i, 'display_value')) {
79
+ return i;
80
+ }
81
+
82
+ var _display_value2 = i.display_value;
83
+ return _display_value2;
84
+ }
85
+
86
+ return i;
87
+ });
88
+ });
89
+ };
90
+ export var convertValueToDtableLongTextValue = function convertValueToDtableLongTextValue(value) {
91
+ var valueType = Object.prototype.toString.call(value);
92
+
93
+ if (value && valueType === '[object String]') {
94
+ return getPreviewContent(value);
95
+ }
96
+
97
+ if (valueType === '[object Object]') {
98
+ return value;
99
+ }
100
+
101
+ return '';
11
102
  };
@@ -3,8 +3,8 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
3
  import _inherits from "@babel/runtime/helpers/esm/inherits";
4
4
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React from 'react';
6
- import cn from 'astro-classname';
7
- import { getGeolocationDisplayString } from '../utils/value-format-utils';
6
+ import classnames from 'classnames';
7
+ import { getGeolocationDisplayString } from '@seafile/dtable-utils';
8
8
  import './index.css';
9
9
 
10
10
  var GeolocationFormatter = /*#__PURE__*/function (_React$Component) {
@@ -24,8 +24,9 @@ var GeolocationFormatter = /*#__PURE__*/function (_React$Component) {
24
24
  var _this$props = this.props,
25
25
  value = _this$props.value,
26
26
  data = _this$props.data,
27
- containerClassName = _this$props.containerClassName;
28
- var className = cn('dtable-ui cell-formatter-container geolocation-formatter', containerClassName);
27
+ containerClassName = _this$props.containerClassName,
28
+ isBaiduMap = _this$props.isBaiduMap;
29
+ var className = classnames('dtable-ui cell-formatter-container geolocation-formatter', containerClassName);
29
30
 
30
31
  if (typeof value !== 'object') {
31
32
  return null;
@@ -33,7 +34,10 @@ var GeolocationFormatter = /*#__PURE__*/function (_React$Component) {
33
34
 
34
35
  return /*#__PURE__*/React.createElement("div", {
35
36
  className: className
36
- }, getGeolocationDisplayString(value, data));
37
+ }, getGeolocationDisplayString(value, data, {
38
+ isBaiduMap: isBaiduMap,
39
+ hyphen: ' '
40
+ }));
37
41
  }
38
42
  }]);
39
43
 
@@ -48,6 +52,7 @@ GeolocationFormatter.defaultProps = {
48
52
  detail: ''
49
53
  },
50
54
  data: {},
51
- containerClassName: ''
55
+ containerClassName: '',
56
+ isBaiduMap: false
52
57
  };
53
58
  export default GeolocationFormatter;
@@ -3,7 +3,7 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
3
  import _inherits from "@babel/runtime/helpers/esm/inherits";
4
4
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React, { Component } from 'react';
6
- import cn from 'astro-classname';
6
+ import classnames from 'classnames';
7
7
  import { processor } from './markdown2html';
8
8
  import './index.css';
9
9
 
@@ -82,7 +82,7 @@ var HtmlLongTextFormatter = /*#__PURE__*/function (_Component) {
82
82
  value: function render() {
83
83
  var innerHtml = this.state.innerHtml;
84
84
  var containerClassName = this.props.containerClassName;
85
- var className = cn('dtable-ui cell-formatter-container long-text-formatter', containerClassName);
85
+ var className = classnames('dtable-ui cell-formatter-container long-text-formatter', containerClassName);
86
86
  if (!innerHtml) return null;
87
87
  return /*#__PURE__*/React.createElement("div", {
88
88
  className: "".concat(className, " article"),
@@ -22,7 +22,7 @@ var ImagesLazyLoad = /*#__PURE__*/function (_React$Component) {
22
22
  _this.lazyLoadImages(_this.props);
23
23
  };
24
24
 
25
- _this.componentWillReceiveProps = function (nextProps) {
25
+ _this.UNSAFE_componentWillReceiveProps = function (nextProps) {
26
26
  if (nextProps.images.toString() !== _this.props.images.toString()) {
27
27
  _this.lazyLoadImages(nextProps);
28
28
  }
@@ -3,7 +3,7 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
3
  import _inherits from "@babel/runtime/helpers/esm/inherits";
4
4
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React, { Fragment } from 'react';
6
- import cn from 'astro-classname';
6
+ import classnames from 'classnames';
7
7
  import ImagesLazyLoad from './images-lazy-load';
8
8
  import { getImageThumbnailUrl } from './utils';
9
9
  import ImagePreviewerLightbox from '../ImagePreviewerLightbox';
@@ -101,7 +101,7 @@ var ImageFormatter = /*#__PURE__*/function (_React$Component) {
101
101
  server = _this$props.server,
102
102
  containerClassName = _this$props.containerClassName,
103
103
  readOnly = _this$props.readOnly;
104
- var className = cn('dtable-ui cell-formatter-container image-formatter', containerClassName);
104
+ var className = classnames('dtable-ui cell-formatter-container image-formatter', containerClassName);
105
105
  var _this$state = this.state,
106
106
  isPreviewImage = _this$state.isPreviewImage,
107
107
  previewImageIndex = _this$state.previewImageIndex;
@@ -1,6 +1,6 @@
1
1
  import React, { Fragment } from 'react';
2
2
  import MediaQuery from 'react-responsive';
3
- import cn from 'astro-classname';
3
+ import classnames from 'classnames';
4
4
  import ModalPortal from '../ModalPortal';
5
5
  import Lightbox from '@seafile/react-image-lightbox';
6
6
  import { checkSVGImage, isInternalImg } from './utils';
@@ -71,7 +71,7 @@ function ImagePreviewerLightbox(props) {
71
71
  return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(MediaQuery, {
72
72
  query: "(min-width: 767.8px)"
73
73
  }, /*#__PURE__*/React.createElement(Lightbox, {
74
- wrapperClassName: cn('PC-image-previewer', className),
74
+ wrapperClassName: classnames('PC-image-previewer', className),
75
75
  imageTitle: imageTitleEl,
76
76
  toolbarButtons: toolbarButtons,
77
77
  mainSrc: imageItems[imageIndex],
@@ -93,7 +93,7 @@ function ImagePreviewerLightbox(props) {
93
93
  query: "(max-width: 767.8px)"
94
94
  }, /*#__PURE__*/React.createElement(Lightbox, {
95
95
  isDesktop: false,
96
- wrapperClassName: cn('mobile-image-previewer dtable-ui-component', className),
96
+ wrapperClassName: classnames('mobile-image-previewer dtable-ui-component', className),
97
97
  mainSrc: imageItems[imageIndex],
98
98
  nextSrc: imageItems[(imageIndex + 1) % imageItemsLength],
99
99
  prevSrc: imageItems[(imageIndex + imageItemsLength - 1) % imageItemsLength],
@@ -3,7 +3,7 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
3
  import _inherits from "@babel/runtime/helpers/esm/inherits";
4
4
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React from 'react';
6
- import cn from 'astro-classname';
6
+ import classnames from 'classnames';
7
7
  import CollaboratorItem from '../CollaboratorItem';
8
8
  import DefaultAvatar from '../assets/images/avatar/default_avatar.png';
9
9
  import './index.css';
@@ -66,7 +66,7 @@ var LastModifierFormatter = /*#__PURE__*/function (_React$PureComponent) {
66
66
  var _this$props2 = this.props,
67
67
  containerClassName = _this$props2.containerClassName,
68
68
  value = _this$props2.value;
69
- var classname = cn('dtable-ui cell-formatter-container last-modified-formatter', containerClassName);
69
+ var classname = classnames('dtable-ui cell-formatter-container last-modified-formatter', containerClassName);
70
70
 
71
71
  if (!value || Array.isArray(value) && value.length === 0) {
72
72
  return /*#__PURE__*/React.createElement("div", {
@@ -4,9 +4,9 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
4
4
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React, { Fragment } from 'react';
6
6
  import MediaQuery from 'react-responsive';
7
+ import { getNumberDisplayString, getDateDisplayString } from '@seafile/dtable-utils';
7
8
  import { getLocale } from '../lang';
8
9
  import { CellType } from '../constants';
9
- import { getNumberDisplayString, getDateDisplayString } from '../utils/value-format-utils';
10
10
  import EditEditorButton from '../EditEditorButton';
11
11
  import LinkEditorOption from './link-editor-option';
12
12
  import PCLinkEditorPopover from './pc-link-editor-popover';
@@ -4,9 +4,8 @@ import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitial
4
4
  import _inherits from "@babel/runtime/helpers/esm/inherits";
5
5
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
6
6
  import React from 'react';
7
- import cn from 'astro-classname';
8
- import * as CellTypes from '../constants/cell-types';
9
- import { getNumberDisplayString, getDateDisplayString } from '../utils/value-format-utils';
7
+ import classnames from 'classnames';
8
+ import { CellType, getNumberDisplayString, getDateDisplayString } from '@seafile/dtable-utils';
10
9
 
11
10
  // link value is get form parant's interface
12
11
  var LinkFormatter = /*#__PURE__*/function (_React$Component) {
@@ -87,12 +86,12 @@ var LinkFormatter = /*#__PURE__*/function (_React$Component) {
87
86
  data = linkedColumn.data; // todo: improve
88
87
 
89
88
  switch (type) {
90
- case CellTypes.NUMBER:
89
+ case CellType.NUMBER:
91
90
  {
92
91
  return getNumberDisplayString(value, data);
93
92
  }
94
93
 
95
- case CellTypes.DATE:
94
+ case CellType.DATE:
96
95
  {
97
96
  var format = data.format;
98
97
  return getDateDisplayString(value, format);
@@ -113,8 +112,8 @@ var LinkFormatter = /*#__PURE__*/function (_React$Component) {
113
112
  }
114
113
 
115
114
  _createClass(LinkFormatter, [{
116
- key: "componentWillReceiveProps",
117
- value: function componentWillReceiveProps(nextProps) {
115
+ key: "UNSAFE_componentWillReceiveProps",
116
+ value: function UNSAFE_componentWillReceiveProps(nextProps) {
118
117
  var nextRow = nextProps.row;
119
118
 
120
119
  if (nextRow._id !== this.props.row._id) {
@@ -127,7 +126,7 @@ var LinkFormatter = /*#__PURE__*/function (_React$Component) {
127
126
  key: "render",
128
127
  value: function render() {
129
128
  var containerClassName = this.props.containerClassName;
130
- var classname = cn('dtable-ui cell-formatter-container link-formatter', containerClassName);
129
+ var classname = classnames('dtable-ui cell-formatter-container link-formatter', containerClassName);
131
130
  var displayValues = this.getDisplayValues();
132
131
  return /*#__PURE__*/React.createElement("div", {
133
132
  className: classname
@@ -3,7 +3,7 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
3
  import _inherits from "@babel/runtime/helpers/esm/inherits";
4
4
  import _createSuper from "@babel/runtime/helpers/esm/createSuper";
5
5
  import React from 'react';
6
- import cn from 'astro-classname';
6
+ import classnames from 'classnames';
7
7
  import dayjs from 'dayjs';
8
8
  import './index.css';
9
9
 
@@ -36,7 +36,7 @@ var MTimeFormatter = /*#__PURE__*/function (_React$Component) {
36
36
  var _this$props = this.props,
37
37
  date = _this$props.value,
38
38
  containerClassName = _this$props.containerClassName;
39
- var classname = cn('dtable-ui cell-formatter-container ctime-formatter', containerClassName);
39
+ var classname = classnames('dtable-ui cell-formatter-container ctime-formatter', containerClassName);
40
40
 
41
41
  if (date !== '') {
42
42
  date = this.formatDate(date);