dtable-ui-component 0.2.0 → 0.2.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.
@@ -33,4 +33,7 @@ var AutoNumberFormatter = /*#__PURE__*/function (_React$Component) {
33
33
  return AutoNumberFormatter;
34
34
  }(React.Component);
35
35
 
36
+ AutoNumberFormatter.defaultProps = {
37
+ value: ''
38
+ };
36
39
  export default AutoNumberFormatter;
@@ -27,7 +27,7 @@ var ButtonFormatter = /*#__PURE__*/function (_React$Component) {
27
27
  button_type = _this$props$data.button_type,
28
28
  url_address = _this$props$data.url_address;
29
29
 
30
- if (button_type == 'open_url' && url_address) {
30
+ if (button_type === 'open_url' && url_address) {
31
31
  window.open(url_address);
32
32
  }
33
33
  };
@@ -88,4 +88,7 @@ var CollaboratorFormatter = /*#__PURE__*/function (_React$PureComponent) {
88
88
  return CollaboratorFormatter;
89
89
  }(React.PureComponent);
90
90
 
91
+ CollaboratorFormatter.defaultProps = {
92
+ value: []
93
+ };
91
94
  export default CollaboratorFormatter;
@@ -84,4 +84,7 @@ var CreatorFormatter = /*#__PURE__*/function (_React$PureComponent) {
84
84
  return CreatorFormatter;
85
85
  }(React.PureComponent);
86
86
 
87
+ CreatorFormatter.defaultProps = {
88
+ value: ''
89
+ };
87
90
  export default CreatorFormatter;
@@ -30,7 +30,7 @@ var CollaboratorSelect = /*#__PURE__*/function (_Component) {
30
30
 
31
31
  if (_this.state.isShowSelectOptions) event.nativeEvent.stopImmediatePropagation();
32
32
  var eventClassName = event.target.className;
33
- if (_this.props.isLocked || eventClassName.indexOf('option-search-control') > -1 || eventClassName === 'option-group-search') return; //Prevent closing by pressing the spacebar in the search input
33
+ if (_this.props.isLocked || eventClassName.indexOf('option-search-control') > -1 || eventClassName === 'option-group-search') return; //Prevent closing by pressing the spacebar in the search input
34
34
 
35
35
  if (event.target.value === '') return;
36
36
  _this.selectedOptionWidth = _this.selectedOptionRef.clientWidth;
@@ -28,7 +28,7 @@ var DTableCustomizeSelect = /*#__PURE__*/function (_Component) {
28
28
 
29
29
  if (_this.state.isShowSelectOptions) event.nativeEvent.stopImmediatePropagation();
30
30
  var eventClassName = event.target.className;
31
- if (_this.props.isLocked || eventClassName.indexOf('option-search-control') > -1 || eventClassName === 'option-group-search') return; //Prevent closing by pressing the spacebar in the search input
31
+ if (_this.props.isLocked || eventClassName.indexOf('option-search-control') > -1 || eventClassName === 'option-group-search') return; //Prevent closing by pressing the spacebar in the search input
32
32
 
33
33
  if (event.target.value === '') return;
34
34
 
@@ -113,7 +113,7 @@ var DtableSelect = /*#__PURE__*/function (_React$Component) {
113
113
  placeholder: placeholder,
114
114
  isSearchable: isSearchable,
115
115
  isClearable: isClearable,
116
- menuPosition: menuPosition || 'fixed' // when use default menuPosition(absolute), menuPortalTarget is unnecessary.
116
+ menuPosition: menuPosition || 'fixed' // when use default menuPosition(absolute), menuPortalTarget is unnecessary.
117
117
  ,
118
118
  menuShouldScrollIntoView: true,
119
119
  menuPortalTarget: this.getMenuPortalTarget(),
@@ -5,7 +5,7 @@ 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
7
  import { FORMULA_RESULT_TYPE, CellType } from '../constants';
8
- import cellFormatterFactory from '../cellFormatterFactory';
8
+ import BaseFormatterConfig from '../formatterConfig/base-formatter-config';
9
9
  import TextFormatter from '../TextFormatter';
10
10
  import { isArrayFormalColumn, isSimpleCellFormatter, isFunction } from './utils';
11
11
  import cellValueValidator from './cell-value-validator';
@@ -55,7 +55,7 @@ var FormulaFormatter = /*#__PURE__*/function (_React$Component) {
55
55
  return null;
56
56
  }
57
57
 
58
- var Formatter = cellFormatterFactory.createFormatter(array_type);
58
+ var Formatter = BaseFormatterConfig[array_type];
59
59
 
60
60
  var formatterProps = _this.getFormatterProps(array_type, array_data, collaborators);
61
61
 
@@ -1,5 +1,3 @@
1
- 'use strict';
2
-
3
1
  var VMessage = require('vfile-message');
4
2
 
5
3
  var VFile = require('./core.js').default;
@@ -84,4 +84,7 @@ var LastModifierFormatter = /*#__PURE__*/function (_React$PureComponent) {
84
84
  return LastModifierFormatter;
85
85
  }(React.PureComponent);
86
86
 
87
+ LastModifierFormatter.defaultProps = {
88
+ value: ''
89
+ };
87
90
  export default LastModifierFormatter;
@@ -140,6 +140,9 @@ var LinkFormatter = /*#__PURE__*/function (_React$Component) {
140
140
 
141
141
  LinkFormatter.defaultProps = {
142
142
  enableOpenLinkedRow: false,
143
- value: []
143
+ currentTableId: '',
144
+ value: [],
145
+ column: {},
146
+ row: {}
144
147
  };
145
148
  export default LinkFormatter;
@@ -67,4 +67,7 @@ var MultipleSelectFormatter = /*#__PURE__*/function (_React$PureComponent) {
67
67
  return MultipleSelectFormatter;
68
68
  }(React.PureComponent);
69
69
 
70
+ MultipleSelectFormatter.defaultProps = {
71
+ options: []
72
+ };
70
73
  export default MultipleSelectFormatter;
@@ -1,4 +1,4 @@
1
- module.exports = {
1
+ export default {
2
2
  LeftArrow: 37,
3
3
  UpArrow: 38,
4
4
  RightArrow: 39,
@@ -59,4 +59,7 @@ var SingleSelectFormatter = /*#__PURE__*/function (_React$PureComponent) {
59
59
  return SingleSelectFormatter;
60
60
  }(React.PureComponent);
61
61
 
62
+ SingleSelectFormatter.defaultProps = {
63
+ options: []
64
+ };
62
65
  export default SingleSelectFormatter;
@@ -1,6 +1,6 @@
1
1
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- import formatterConfig from '../formatterConfig';
3
+ import FormatterConfig from '../formatterConfig';
4
4
 
5
5
  var CellFormatterFactory = /*#__PURE__*/function () {
6
6
  function CellFormatterFactory() {
@@ -10,8 +10,8 @@ var CellFormatterFactory = /*#__PURE__*/function () {
10
10
  _createClass(CellFormatterFactory, [{
11
11
  key: "createFormatter",
12
12
  value: function createFormatter(formatterType) {
13
- if (formatterConfig[formatterType]) {
14
- return formatterConfig[formatterType];
13
+ if (FormatterConfig[formatterType]) {
14
+ return FormatterConfig[formatterType];
15
15
  }
16
16
 
17
17
  return null;
@@ -0,0 +1,28 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+
3
+ var _CellType$DEFAULT$Cel;
4
+
5
+ import React from 'react';
6
+ import { CellType } from '../constants';
7
+ import CheckboxFormatter from '../CheckboxFormatter';
8
+ import ImageFormatter from '../ImageFormatter';
9
+ import SimpleLongTextFormatter from '../SimpleLongTextFormatter';
10
+ import TextCellFormatter from '../TextFormatter';
11
+ import SingleSelectFormatter from '../SingleSelectFormatter';
12
+ import MultipleSelectFormatter from '../MultipleSelectFormatter';
13
+ import FileFormatter from '../FileFormatter';
14
+ import CollaboratorFormatter from '../CollaboratorFormatter';
15
+ import NumberFormatter from '../NumberFormatter';
16
+ import DateFormatter from '../DateFormatter';
17
+ import CreatorFormatter from '../CreatorFormatter';
18
+ import CTimeFormatter from '../CTimeFormatter';
19
+ import LastModifierFormatter from '../LastModifierFormatter';
20
+ import MTimeFormatter from '../MTimeFormatter';
21
+ import GeolocationFormatter from '../GeolocationFormatter';
22
+ import AutoNumberFormatter from '../AutoNumberFormatter';
23
+ import UrlFormatter from '../UrlFormatter';
24
+ import EmailFormatter from '../EmailFormatter';
25
+ import DurationFormatter from '../DurationFormatter';
26
+ import RateFormatter from '../RateFormatter';
27
+ import ButtonFormatter from '../ButtonFormatter';
28
+ export default (_CellType$DEFAULT$Cel = {}, _defineProperty(_CellType$DEFAULT$Cel, CellType.DEFAULT, /*#__PURE__*/React.createElement(TextCellFormatter, null)), _defineProperty(_CellType$DEFAULT$Cel, CellType.TEXT, /*#__PURE__*/React.createElement(TextCellFormatter, null)), _defineProperty(_CellType$DEFAULT$Cel, CellType.CHECKBOX, /*#__PURE__*/React.createElement(CheckboxFormatter, null)), _defineProperty(_CellType$DEFAULT$Cel, CellType.LONG_TEXT, /*#__PURE__*/React.createElement(SimpleLongTextFormatter, null)), _defineProperty(_CellType$DEFAULT$Cel, CellType.SINGLE_SELECT, /*#__PURE__*/React.createElement(SingleSelectFormatter, null)), _defineProperty(_CellType$DEFAULT$Cel, CellType.IMAGE, /*#__PURE__*/React.createElement(ImageFormatter, null)), _defineProperty(_CellType$DEFAULT$Cel, CellType.FILE, /*#__PURE__*/React.createElement(FileFormatter, null)), _defineProperty(_CellType$DEFAULT$Cel, CellType.MULTIPLE_SELECT, /*#__PURE__*/React.createElement(MultipleSelectFormatter, null)), _defineProperty(_CellType$DEFAULT$Cel, CellType.COLLABORATOR, /*#__PURE__*/React.createElement(CollaboratorFormatter, null)), _defineProperty(_CellType$DEFAULT$Cel, CellType.NUMBER, /*#__PURE__*/React.createElement(NumberFormatter, null)), _defineProperty(_CellType$DEFAULT$Cel, CellType.DATE, /*#__PURE__*/React.createElement(DateFormatter, null)), _defineProperty(_CellType$DEFAULT$Cel, CellType.CREATOR, /*#__PURE__*/React.createElement(CreatorFormatter, null)), _defineProperty(_CellType$DEFAULT$Cel, CellType.CTIME, /*#__PURE__*/React.createElement(CTimeFormatter, null)), _defineProperty(_CellType$DEFAULT$Cel, CellType.LAST_MODIFIER, /*#__PURE__*/React.createElement(LastModifierFormatter, null)), _defineProperty(_CellType$DEFAULT$Cel, CellType.MTIME, /*#__PURE__*/React.createElement(MTimeFormatter, null)), _defineProperty(_CellType$DEFAULT$Cel, CellType.GEOLOCATION, /*#__PURE__*/React.createElement(GeolocationFormatter, null)), _defineProperty(_CellType$DEFAULT$Cel, CellType.AUTO_NUMBER, /*#__PURE__*/React.createElement(AutoNumberFormatter, null)), _defineProperty(_CellType$DEFAULT$Cel, CellType.URL, /*#__PURE__*/React.createElement(UrlFormatter, null)), _defineProperty(_CellType$DEFAULT$Cel, CellType.EMAIL, /*#__PURE__*/React.createElement(EmailFormatter, null)), _defineProperty(_CellType$DEFAULT$Cel, CellType.DURATION, /*#__PURE__*/React.createElement(DurationFormatter, null)), _defineProperty(_CellType$DEFAULT$Cel, CellType.RATE, /*#__PURE__*/React.createElement(RateFormatter, null)), _defineProperty(_CellType$DEFAULT$Cel, CellType.BUTTON, /*#__PURE__*/React.createElement(ButtonFormatter, null)), _CellType$DEFAULT$Cel);
@@ -1,31 +1,14 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
3
 
3
- var _FormatterConfig;
4
+ var _objectSpread2;
4
5
 
5
6
  import React from 'react';
6
7
  import { CellType } from '../constants';
7
- import CheckboxFormatter from '../CheckboxFormatter';
8
- import ImageFormatter from '../ImageFormatter';
9
- import SimpleLongTextFormatter from '../SimpleLongTextFormatter';
10
- import TextCellFormatter from '../TextFormatter';
11
- import SingleSelectFormatter from '../SingleSelectFormatter';
12
- import MultipleSelectFormatter from '../MultipleSelectFormatter';
13
- import FileFormatter from '../FileFormatter';
8
+ import BaseFormatterConfig from './base-formatter-config';
14
9
  import LinkFormatter from '../LinkFormatter';
15
- import CollaboratorFormatter from '../CollaboratorFormatter';
16
- import NumberFormatter from '../NumberFormatter';
17
- import DateFormatter from '../DateFormatter';
18
- import CreatorFormatter from '../CreatorFormatter';
19
- import CTimeFormatter from '../CTimeFormatter';
20
- import LastModifierFormatter from '../LastModifierFormatter';
21
- import MTimeFormatter from '../MTimeFormatter';
22
- import GeolocationFormatter from '../GeolocationFormatter';
23
10
  import FormulaFormatter from '../FormulaFormatter';
24
- import AutoNumberFormatter from '../AutoNumberFormatter';
25
- import UrlFormatter from '../UrlFormatter';
26
- import EmailFormatter from '../EmailFormatter';
27
- import DurationFormatter from '../DurationFormatter';
28
- import RateFormatter from '../RateFormatter';
29
- import ButtonFormatter from '../ButtonFormatter';
30
- var FormatterConfig = (_FormatterConfig = {}, _defineProperty(_FormatterConfig, CellType.DEFAULT, /*#__PURE__*/React.createElement(TextCellFormatter, null)), _defineProperty(_FormatterConfig, CellType.TEXT, /*#__PURE__*/React.createElement(TextCellFormatter, null)), _defineProperty(_FormatterConfig, CellType.CHECKBOX, /*#__PURE__*/React.createElement(CheckboxFormatter, null)), _defineProperty(_FormatterConfig, CellType.LONG_TEXT, /*#__PURE__*/React.createElement(SimpleLongTextFormatter, null)), _defineProperty(_FormatterConfig, CellType.SINGLE_SELECT, /*#__PURE__*/React.createElement(SingleSelectFormatter, null)), _defineProperty(_FormatterConfig, CellType.IMAGE, /*#__PURE__*/React.createElement(ImageFormatter, null)), _defineProperty(_FormatterConfig, CellType.FILE, /*#__PURE__*/React.createElement(FileFormatter, null)), _defineProperty(_FormatterConfig, CellType.MULTIPLE_SELECT, /*#__PURE__*/React.createElement(MultipleSelectFormatter, null)), _defineProperty(_FormatterConfig, CellType.COLLABORATOR, /*#__PURE__*/React.createElement(CollaboratorFormatter, null)), _defineProperty(_FormatterConfig, CellType.NUMBER, /*#__PURE__*/React.createElement(NumberFormatter, null)), _defineProperty(_FormatterConfig, CellType.DATE, /*#__PURE__*/React.createElement(DateFormatter, null)), _defineProperty(_FormatterConfig, CellType.LINK, /*#__PURE__*/React.createElement(LinkFormatter, null)), _defineProperty(_FormatterConfig, CellType.CREATOR, /*#__PURE__*/React.createElement(CreatorFormatter, null)), _defineProperty(_FormatterConfig, CellType.CTIME, /*#__PURE__*/React.createElement(CTimeFormatter, null)), _defineProperty(_FormatterConfig, CellType.LAST_MODIFIER, /*#__PURE__*/React.createElement(LastModifierFormatter, null)), _defineProperty(_FormatterConfig, CellType.MTIME, /*#__PURE__*/React.createElement(MTimeFormatter, null)), _defineProperty(_FormatterConfig, CellType.GEOLOCATION, /*#__PURE__*/React.createElement(GeolocationFormatter, null)), _defineProperty(_FormatterConfig, CellType.FORMULA, /*#__PURE__*/React.createElement(FormulaFormatter, null)), _defineProperty(_FormatterConfig, CellType.AUTO_NUMBER, /*#__PURE__*/React.createElement(AutoNumberFormatter, null)), _defineProperty(_FormatterConfig, CellType.URL, /*#__PURE__*/React.createElement(UrlFormatter, null)), _defineProperty(_FormatterConfig, CellType.EMAIL, /*#__PURE__*/React.createElement(EmailFormatter, null)), _defineProperty(_FormatterConfig, CellType.DURATION, /*#__PURE__*/React.createElement(DurationFormatter, null)), _defineProperty(_FormatterConfig, CellType.RATE, /*#__PURE__*/React.createElement(RateFormatter, null)), _defineProperty(_FormatterConfig, CellType.BUTTON, /*#__PURE__*/React.createElement(ButtonFormatter, null)), _FormatterConfig);
11
+
12
+ var FormatterConfig = _objectSpread(_objectSpread({}, BaseFormatterConfig), {}, (_objectSpread2 = {}, _defineProperty(_objectSpread2, CellType.FORMULA, /*#__PURE__*/React.createElement(FormulaFormatter, null)), _defineProperty(_objectSpread2, CellType.LINK, /*#__PURE__*/React.createElement(LinkFormatter, null)), _objectSpread2));
13
+
31
14
  export default FormatterConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtable-ui-component",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "main": "./lib/index.js",
5
5
  "dependencies": {
6
6
  "@seafile/react-image-lightbox": "0.0.9",