dtable-ui-component 0.1.82-beta → 0.1.84-beta

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 (114) hide show
  1. package/lib/DtablePopover/index.js +115 -0
  2. package/lib/DtablePopover/utils.js +5 -0
  3. package/lib/DtableSelect/index.js +140 -0
  4. package/lib/FormulaFormatter/index.js +7 -7
  5. package/lib/index.js +4 -1
  6. package/package.json +2 -2
  7. package/es/app.css +0 -20
  8. package/es/app.js +0 -91
  9. package/es/assets/images/avatar/default_avatar.png +0 -0
  10. package/es/assets/images/file/192/excel.png +0 -0
  11. package/es/assets/images/file/192/file.png +0 -0
  12. package/es/assets/images/file/192/music.png +0 -0
  13. package/es/assets/images/file/192/pdf.png +0 -0
  14. package/es/assets/images/file/192/pic.png +0 -0
  15. package/es/assets/images/file/192/ppt.png +0 -0
  16. package/es/assets/images/file/192/txt.png +0 -0
  17. package/es/assets/images/file/192/video.png +0 -0
  18. package/es/assets/images/file/192/word.png +0 -0
  19. package/es/assets/images/file/24/excel.png +0 -0
  20. package/es/assets/images/file/24/file.png +0 -0
  21. package/es/assets/images/file/24/music.png +0 -0
  22. package/es/assets/images/file/24/pdf.png +0 -0
  23. package/es/assets/images/file/24/pic.png +0 -0
  24. package/es/assets/images/file/24/ppt.png +0 -0
  25. package/es/assets/images/file/24/txt.png +0 -0
  26. package/es/assets/images/file/24/video.png +0 -0
  27. package/es/assets/images/file/24/word.png +0 -0
  28. package/es/assets/images/folder/folder-192.png +0 -0
  29. package/es/assets/images/folder/folder-24.png +0 -0
  30. package/es/components/cell-editor/checkbox-editor.js +0 -104
  31. package/es/components/cell-editor/collaborator-editor.js +0 -236
  32. package/es/components/cell-editor/date-editor.js +0 -151
  33. package/es/components/cell-editor/index.js +0 -9
  34. package/es/components/cell-editor/link-editor.js +0 -303
  35. package/es/components/cell-editor/multiple-select-editor.js +0 -237
  36. package/es/components/cell-editor/number-editor.js +0 -154
  37. package/es/components/cell-editor/single-select-editor.js +0 -202
  38. package/es/components/cell-editor/text-editor.js +0 -122
  39. package/es/components/cell-editor-dialog/pc-file-editor-dialog.js +0 -46
  40. package/es/components/cell-editor-dialog/pc-files-addition/index.js +0 -0
  41. package/es/components/cell-editor-dialog/pc-files-addition/pc-file-uploaded-item.js +0 -0
  42. package/es/components/cell-editor-dialog/pc-files-preview/index.js +0 -0
  43. package/es/components/cell-editor-dialog/pc-files-preview/pc-file-item-preview.js +0 -0
  44. package/es/components/cell-editor-popover/mb-collaborator-editor-popover.js +0 -177
  45. package/es/components/cell-editor-popover/mb-date-editor-popover.js +0 -245
  46. package/es/components/cell-editor-popover/mb-link-editor-popover.js +0 -170
  47. package/es/components/cell-editor-popover/mb-select-editor-popover.js +0 -230
  48. package/es/components/cell-editor-popover/pc-collaborator-editor-popover.js +0 -109
  49. package/es/components/cell-editor-popover/pc-date-editor-popover.js +0 -142
  50. package/es/components/cell-editor-popover/pc-link-editor-popover.js +0 -114
  51. package/es/components/cell-editor-popover/pc-select-editor-popover.js +0 -143
  52. package/es/components/cell-factory/cell-formatter-factory.js +0 -25
  53. package/es/components/cell-formatter/auto-number-formatter.js +0 -35
  54. package/es/components/cell-formatter/button-formatter.js +0 -55
  55. package/es/components/cell-formatter/checkbox-formatter.js +0 -44
  56. package/es/components/cell-formatter/collaborator-formatter.js +0 -91
  57. package/es/components/cell-formatter/creator-formatter.js +0 -87
  58. package/es/components/cell-formatter/ctime-formatter.js +0 -57
  59. package/es/components/cell-formatter/date-formatter.js +0 -59
  60. package/es/components/cell-formatter/duration-formatter.js +0 -37
  61. package/es/components/cell-formatter/email-formatter.js +0 -35
  62. package/es/components/cell-formatter/file-formatter.js +0 -63
  63. package/es/components/cell-formatter/formatter-config.js +0 -31
  64. package/es/components/cell-formatter/formula-formatter.js +0 -164
  65. package/es/components/cell-formatter/geolocation-formatter.js +0 -52
  66. package/es/components/cell-formatter/image-formatter.js +0 -153
  67. package/es/components/cell-formatter/index.js +0 -27
  68. package/es/components/cell-formatter/last-modifier-formatter.js +0 -87
  69. package/es/components/cell-formatter/link-formatter.js +0 -144
  70. package/es/components/cell-formatter/long-text-formatter.js +0 -106
  71. package/es/components/cell-formatter/mtime-formatter.js +0 -57
  72. package/es/components/cell-formatter/multiple-select-formatter.js +0 -69
  73. package/es/components/cell-formatter/number-formatter.js +0 -46
  74. package/es/components/cell-formatter/rate-formatter.js +0 -79
  75. package/es/components/cell-formatter/single-select-formatter.js +0 -69
  76. package/es/components/cell-formatter/text-formatter.js +0 -55
  77. package/es/components/cell-formatter/url-formatter.js +0 -35
  78. package/es/components/cell-formatter/widgets/file-item-formatter.js +0 -50
  79. package/es/components/cell-formatter/widgets/image-previewer-lightbox.js +0 -119
  80. package/es/components/common/collaborator-item.js +0 -63
  81. package/es/components/common/edit-editor-button.js +0 -56
  82. package/es/components/common/images-lazy-load.js +0 -150
  83. package/es/components/common/link-editor-option.js +0 -113
  84. package/es/components/common/mobile/mb-editor-header.js +0 -48
  85. package/es/components/common/modal-portal.js +0 -44
  86. package/es/components/common/select-editor-option.js +0 -106
  87. package/es/components/common/select-item.js +0 -58
  88. package/es/components/file-uploader/index.js +0 -53
  89. package/es/components/loading.js +0 -7
  90. package/es/components/toast/alert.js +0 -150
  91. package/es/components/toast/index.js +0 -3
  92. package/es/components/toast/toast.js +0 -179
  93. package/es/components/toast/toastManager.js +0 -170
  94. package/es/components/toast/toaster.js +0 -76
  95. package/es/constants/cell-types.js +0 -25
  96. package/es/constants/index.js +0 -48
  97. package/es/css/cell-editor.css +0 -614
  98. package/es/css/cell-formatter.css +0 -241
  99. package/es/css/custom-rc-calendar.css +0 -118
  100. package/es/css/image-previewer-ligntbox.css +0 -87
  101. package/es/css/loading.css +0 -54
  102. package/es/index.js +0 -6
  103. package/es/lang/index.js +0 -50
  104. package/es/locals/de.js +0 -2
  105. package/es/locals/en.js +0 -17
  106. package/es/locals/fr.js +0 -2
  107. package/es/locals/zh-CN.js +0 -17
  108. package/es/utils/cell-value-validator.js +0 -32
  109. package/es/utils/column-utils.js +0 -7
  110. package/es/utils/editor-utils.js +0 -71
  111. package/es/utils/normalize-long-text-value.js +0 -68
  112. package/es/utils/number-precision.js +0 -163
  113. package/es/utils/utils.js +0 -116
  114. package/es/utils/value-format-utils.js +0 -495
@@ -0,0 +1,115 @@
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
+ import React from 'react';
6
+ import { Popover } from 'reactstrap';
7
+ import { getEventClassName } from './utils';
8
+
9
+ var DTablePopover = /*#__PURE__*/function (_React$Component) {
10
+ _inherits(DTablePopover, _React$Component);
11
+
12
+ var _super = _createSuper(DTablePopover);
13
+
14
+ function DTablePopover() {
15
+ var _this;
16
+
17
+ _classCallCheck(this, DTablePopover);
18
+
19
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
20
+ args[_key] = arguments[_key];
21
+ }
22
+
23
+ _this = _super.call.apply(_super, [this].concat(args));
24
+ _this.dtablePopoverRef = null;
25
+
26
+ _this.onHistoryState = function (e) {
27
+ e.preventDefault();
28
+
29
+ _this.props.hideDTablePopover(e);
30
+ };
31
+
32
+ _this.onKeyDown = function (e) {
33
+ var _this$props = _this.props,
34
+ canHideDTablePopover = _this$props.canHideDTablePopover,
35
+ hideDTablePopoverWithEsc = _this$props.hideDTablePopoverWithEsc;
36
+
37
+ if (e.keyCode === 27 && typeof hideDTablePopoverWithEsc === 'function') {
38
+ e.preventDefault();
39
+ hideDTablePopoverWithEsc();
40
+ } else if (e.keyCode === 13) {
41
+ // Resolve the default behavior of the enter key when entering formulas is blocked
42
+ if (canHideDTablePopover) return;
43
+ e.stopImmediatePropagation();
44
+ }
45
+ };
46
+
47
+ _this.onMouseDown = function (e) {
48
+ var canHideDTablePopover = _this.props.canHideDTablePopover;
49
+ if (!canHideDTablePopover) return;
50
+
51
+ if (_this.dtablePopoverRef && e && getEventClassName(e).indexOf('popover') === -1 && !_this.dtablePopoverRef.contains(e.target)) {
52
+ _this.props.hideDTablePopover(e);
53
+ }
54
+ };
55
+
56
+ _this.onPopoverInsideClick = function (e) {
57
+ e.stopPropagation();
58
+ };
59
+
60
+ return _this;
61
+ }
62
+
63
+ _createClass(DTablePopover, [{
64
+ key: "componentDidMount",
65
+ value: function componentDidMount() {
66
+ document.addEventListener('mousedown', this.onMouseDown);
67
+ document.addEventListener('keydown', this.onKeyDown);
68
+ window.addEventListener('popstate', this.onHistoryState);
69
+ }
70
+ }, {
71
+ key: "componentWillUnmount",
72
+ value: function componentWillUnmount() {
73
+ document.removeEventListener('mousedown', this.onMouseDown);
74
+ document.removeEventListener('keydown', this.onKeyDown);
75
+ window.removeEventListener('popstate', this.onHistoryState);
76
+ }
77
+ }, {
78
+ key: "render",
79
+ value: function render() {
80
+ var _this2 = this;
81
+
82
+ var _this$props2 = this.props,
83
+ target = _this$props2.target,
84
+ innerClassName = _this$props2.innerClassName,
85
+ popoverClassName = _this$props2.popoverClassName,
86
+ hideArrow = _this$props2.hideArrow,
87
+ modifiers = _this$props2.modifiers,
88
+ placement = _this$props2.placement;
89
+ return /*#__PURE__*/React.createElement(Popover, {
90
+ placement: placement,
91
+ isOpen: true,
92
+ target: target,
93
+ fade: false,
94
+ hideArrow: hideArrow,
95
+ innerClassName: innerClassName,
96
+ className: popoverClassName,
97
+ modifiers: modifiers
98
+ }, /*#__PURE__*/React.createElement("div", {
99
+ ref: function ref(_ref) {
100
+ return _this2.dtablePopoverRef = _ref;
101
+ },
102
+ onClick: this.onPopoverInsideClick
103
+ }, this.props.children));
104
+ }
105
+ }]);
106
+
107
+ return DTablePopover;
108
+ }(React.Component);
109
+
110
+ DTablePopover.defaultProps = {
111
+ placement: 'bottom-start',
112
+ hideArrow: true,
113
+ canHideDTablePopover: true
114
+ };
115
+ export default DTablePopover;
@@ -0,0 +1,5 @@
1
+ export var getEventClassName = function getEventClassName(e) {
2
+ // svg mouseEvent event.target.className is an object
3
+ if (!e || !e.target) return '';
4
+ return e.target.getAttribute('class') || '';
5
+ };
@@ -0,0 +1,140 @@
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
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
6
+ import React from 'react';
7
+ import Select, { components } from 'react-select';
8
+ var MenuSelectStyle = {
9
+ option: function option(provided, state) {
10
+ var isDisabled = state.isDisabled,
11
+ isSelected = state.isSelected,
12
+ isFocused = state.isFocused;
13
+ return _objectSpread(_objectSpread({}, provided), {}, {
14
+ cursor: isDisabled ? 'default' : 'pointer',
15
+ backgroundColor: isSelected ? '#20a0ff' : isFocused ? '#f5f5f5' : '#fff',
16
+ '.header-icon .dtable-font': {
17
+ color: isSelected ? '#fff' : '#aaa'
18
+ }
19
+ });
20
+ },
21
+ control: function control(provided) {
22
+ return _objectSpread(_objectSpread({}, provided), {}, {
23
+ fontSize: '14px',
24
+ cursor: 'pointer',
25
+ lineHeight: '1.5'
26
+ });
27
+ },
28
+ menuPortal: function menuPortal(base) {
29
+ return _objectSpread(_objectSpread({}, base), {}, {
30
+ zIndex: 9999
31
+ });
32
+ },
33
+ indicatorSeparator: function indicatorSeparator() {}
34
+ };
35
+
36
+ var DropdownIndicator = function DropdownIndicator(props) {
37
+ return components.DropdownIndicator && /*#__PURE__*/React.createElement(components.DropdownIndicator, props, /*#__PURE__*/React.createElement("span", {
38
+ className: "dtable-font dtable-icon-drop-down",
39
+ style: {
40
+ fontSize: '12px'
41
+ }
42
+ }));
43
+ };
44
+
45
+ var MenuList = function MenuList(props) {
46
+ return /*#__PURE__*/React.createElement("div", {
47
+ onClick: function onClick(e) {
48
+ return e.nativeEvent.stopImmediatePropagation();
49
+ },
50
+ onMouseDown: function onMouseDown(e) {
51
+ return e.nativeEvent.stopImmediatePropagation();
52
+ }
53
+ }, /*#__PURE__*/React.createElement(components.MenuList, props, props.children));
54
+ };
55
+
56
+ var Option = function Option(props) {
57
+ return /*#__PURE__*/React.createElement("div", {
58
+ style: props.data.style
59
+ }, /*#__PURE__*/React.createElement(components.Option, props));
60
+ };
61
+
62
+ var DtableSelect = /*#__PURE__*/function (_React$Component) {
63
+ _inherits(DtableSelect, _React$Component);
64
+
65
+ var _super = _createSuper(DtableSelect);
66
+
67
+ function DtableSelect() {
68
+ var _this;
69
+
70
+ _classCallCheck(this, DtableSelect);
71
+
72
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
73
+ args[_key] = arguments[_key];
74
+ }
75
+
76
+ _this = _super.call.apply(_super, [this].concat(args));
77
+
78
+ _this.getMenuPortalTarget = function () {
79
+ var menuPortalTarget = _this.props.menuPortalTarget;
80
+ return document.querySelector(menuPortalTarget);
81
+ };
82
+
83
+ return _this;
84
+ }
85
+
86
+ _createClass(DtableSelect, [{
87
+ key: "render",
88
+ value: function render() {
89
+ var _this$props = this.props,
90
+ options = _this$props.options,
91
+ onChange = _this$props.onChange,
92
+ value = _this$props.value,
93
+ isSearchable = _this$props.isSearchable,
94
+ placeholder = _this$props.placeholder,
95
+ isMulti = _this$props.isMulti,
96
+ menuPosition = _this$props.menuPosition,
97
+ isClearable = _this$props.isClearable,
98
+ noOptionsMessage = _this$props.noOptionsMessage,
99
+ classNamePrefix = _this$props.classNamePrefix;
100
+ return /*#__PURE__*/React.createElement(Select, {
101
+ value: value,
102
+ onChange: onChange,
103
+ options: options,
104
+ isMulti: isMulti,
105
+ classNamePrefix: classNamePrefix,
106
+ styles: MenuSelectStyle,
107
+ components: {
108
+ Option: Option,
109
+ DropdownIndicator: DropdownIndicator,
110
+ MenuList: MenuList
111
+ },
112
+ placeholder: placeholder,
113
+ isSearchable: isSearchable,
114
+ isClearable: isClearable,
115
+ menuPosition: menuPosition || 'fixed' // when use default menuPosition(absolute), menuPortalTarget is unnecessary.
116
+ ,
117
+ menuShouldScrollIntoView: true,
118
+ menuPortalTarget: this.getMenuPortalTarget(),
119
+ captureMenuScroll: false,
120
+ noOptionsMessage: noOptionsMessage
121
+ });
122
+ }
123
+ }]);
124
+
125
+ return DtableSelect;
126
+ }(React.Component);
127
+
128
+ DtableSelect.defaultProps = {
129
+ options: [],
130
+ value: {},
131
+ isSearchable: false,
132
+ isClearable: false,
133
+ placeholder: '',
134
+ isMulti: false,
135
+ menuPortalTarget: '.modal',
136
+ noOptionsMessage: function noOptionsMessage() {
137
+ return null;
138
+ }
139
+ };
140
+ export default DtableSelect;
@@ -59,19 +59,19 @@ var FormulaFormatter = /*#__PURE__*/function (_React$Component) {
59
59
 
60
60
  var formatterProps = _this.getFormatterProps(array_type, array_data, collaborators);
61
61
 
62
- if (isArrayFormalColumn(array_type)) {
63
- formatterProps.value = value;
64
- return _this.createColumnFormatter(Formatter, formatterProps);
65
- }
66
-
67
- var _isSimpleCellFormatterColumn = isSimpleCellFormatter(array_type);
68
-
69
62
  var cellValue = value;
70
63
 
71
64
  if (!Array.isArray(value)) {
72
65
  cellValue = cellValueValidator(value, array_type) ? [value] : [];
73
66
  }
74
67
 
68
+ if (isArrayFormalColumn(array_type)) {
69
+ formatterProps.value = cellValue.filter(Boolean);
70
+ return _this.createColumnFormatter(Formatter, formatterProps);
71
+ }
72
+
73
+ var _isSimpleCellFormatterColumn = isSimpleCellFormatter(array_type);
74
+
75
75
  var contentItemClassName = "formula-formatter-content-item ".concat(_isSimpleCellFormatterColumn ? 'simple-cell-formatter' : '');
76
76
  return /*#__PURE__*/React.createElement("div", {
77
77
  className: "dtable-ui formula-formatter multiple"
package/lib/index.js CHANGED
@@ -41,4 +41,7 @@ export { default as SingleSelectEditor } from './SingleSelectEditor';
41
41
  export { default as MultipleSelectEditor } from './MultipleSelectEditor';
42
42
  export { default as CollaboratorEditor } from './CollaboratorEditor';
43
43
  export { default as DateEditor } from './DateEditor';
44
- export { default as LinkEditor } from './LinkEditor';
44
+ export { default as LinkEditor } from './LinkEditor'; // common
45
+
46
+ export { default as DTablePopover } from './DtablePopover';
47
+ export { default as DTableSelect } from './DtableSelect';
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "dtable-ui-component",
3
- "version": "0.1.82beta",
3
+ "version": "0.1.84beta",
4
4
  "main": "./lib/index.js",
5
5
  "dependencies": {
6
6
  "@seafile/react-image-lightbox": "0.0.9",
7
- "@seafile/seafile-calendar": "^0.0.17-beta",
7
+ "@seafile/seafile-calendar": "^0.0.19",
8
8
  "antd-mobile": "^2.3.3",
9
9
  "astro-classname": "^2.1.0",
10
10
  "bail": "1.0.5",
package/es/app.css DELETED
@@ -1,20 +0,0 @@
1
- html, body, #root {
2
- width: 100%;
3
- height: 100%;
4
- }
5
-
6
- .app {
7
- width: 100%;
8
- height: 100%;
9
- display: flex;
10
- flex-direction: column;
11
- }
12
-
13
- .app .app-body {
14
- flex: 1;
15
- }
16
-
17
- .app .app-body .collaborator-container {
18
- padding: 5px;
19
- border: 1px solid;
20
- }
package/es/app.js DELETED
@@ -1,91 +0,0 @@
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
- import React from 'react';
6
- import { CollaboratorFormatter, SingleSelectFormatter } from './components/cell-formatter';
7
- import './app.css';
8
-
9
- var App = /*#__PURE__*/function (_React$Component) {
10
- _inherits(App, _React$Component);
11
-
12
- var _super = _createSuper(App);
13
-
14
- function App() {
15
- var _this;
16
-
17
- _classCallCheck(this, App);
18
-
19
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
20
- args[_key] = arguments[_key];
21
- }
22
-
23
- _this = _super.call.apply(_super, [this].concat(args));
24
-
25
- _this.onDeleteCollaborator = function () {//
26
- };
27
-
28
- return _this;
29
- }
30
-
31
- _createClass(App, [{
32
- key: "render",
33
- value: function render() {
34
- var collaborators = [{
35
- name: '小强',
36
- email: '214402@qq.com',
37
- avatar_url: '你好饿',
38
- contact_email: 'adbd'
39
- }];
40
- var options = [{
41
- id: '1111',
42
- name: '未开始',
43
- color: '#e3f9f6'
44
- }, {
45
- id: '2222',
46
- name: '进行中',
47
- color: '#ff7500'
48
- }, {
49
- id: '3333',
50
- name: '待评审',
51
- color: '#eaff56'
52
- }, {
53
- id: '4444',
54
- name: '已评审',
55
- color: '#faff72'
56
- }, {
57
- id: '5555',
58
- name: '完成',
59
- color: '#00e500'
60
- }];
61
- return /*#__PURE__*/React.createElement("div", {
62
- className: "app"
63
- }, /*#__PURE__*/React.createElement("header", {
64
- className: "app-header"
65
- }, /*#__PURE__*/React.createElement("h1", {
66
- className: "text-center"
67
- }, 'seatable ui component test')), /*#__PURE__*/React.createElement("div", {
68
- className: "app-body"
69
- }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h2", null, "collaborators\u6D4B\u8BD5"), /*#__PURE__*/React.createElement("div", null, "\u5355\u4E2Acollaborators\u6D4B\u8BD5"), /*#__PURE__*/React.createElement(CollaboratorFormatter, {
70
- value: '123',
71
- collaborators: collaborators
72
- }), /*#__PURE__*/React.createElement("div", null, "\u591A\u4E2Acollaborators\u6D4B\u8BD5"), /*#__PURE__*/React.createElement(CollaboratorFormatter, {
73
- value: ['123', '4567'],
74
- collaborators: collaborators
75
- }), /*#__PURE__*/React.createElement("div", null, "\u5E26\u5220\u9664\u6309\u94AE\u6D4B\u8BD5"), /*#__PURE__*/React.createElement(CollaboratorFormatter, {
76
- containerClassName: "collaborator-container",
77
- value: ['123', '4567'],
78
- collaborators: collaborators,
79
- enableDeleteCollaborator: true,
80
- onDeleteCollaborator: this.onDeleteCollaborator
81
- })), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("h2", null, "single-select\u6D4B\u8BD5"), /*#__PURE__*/React.createElement(SingleSelectFormatter, {
82
- value: '3333',
83
- options: options
84
- }))));
85
- }
86
- }]);
87
-
88
- return App;
89
- }(React.Component);
90
-
91
- export default App;
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,104 +0,0 @@
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
- import React from 'react';
6
-
7
- var CheckboxEditor = /*#__PURE__*/function (_React$Component) {
8
- _inherits(CheckboxEditor, _React$Component);
9
-
10
- var _super = _createSuper(CheckboxEditor);
11
-
12
- function CheckboxEditor(props) {
13
- var _this;
14
-
15
- _classCallCheck(this, CheckboxEditor);
16
-
17
- _this = _super.call(this, props);
18
-
19
- _this.getValue = function () {
20
- var updated = {};
21
- var column = _this.props.column;
22
- updated[column.key] = _this.state.value;
23
- return updated;
24
- };
25
-
26
- _this.onCommit = function () {
27
- var updated = _this.getValue();
28
-
29
- _this.props.onCommit(updated);
30
- };
31
-
32
- _this.onChange = function (event) {
33
- if (_this.props.isReadOnly) {
34
- return;
35
- }
36
-
37
- var value = event.target.checked;
38
-
39
- if (value === _this.state.value) {
40
- return;
41
- }
42
-
43
- _this.setState({
44
- value: value
45
- }, function () {
46
- _this.onCommit();
47
- });
48
- };
49
-
50
- _this.onKeyDown = function (event) {
51
- event.stopPropagation();
52
- };
53
-
54
- _this.onBlur = function () {// this.onCommit();
55
- };
56
-
57
- _this.setInputRef = function (input) {
58
- _this.input = input;
59
- };
60
-
61
- _this.getStyle = function () {
62
- return {
63
- marginLeft: 0,
64
- transform: 'scale(1.1)'
65
- };
66
- };
67
-
68
- _this.state = {
69
- value: props.value ? props.value : false
70
- };
71
- return _this;
72
- }
73
-
74
- _createClass(CheckboxEditor, [{
75
- key: "render",
76
- value: function render() {
77
- var style = this.getStyle();
78
- return /*#__PURE__*/React.createElement("div", {
79
- className: "cell-editor checkbox-editor"
80
- }, /*#__PURE__*/React.createElement("div", {
81
- className: "checkbox-editor-container"
82
- }, /*#__PURE__*/React.createElement("input", {
83
- ref: this.setInputRef,
84
- type: "checkbox",
85
- className: "checkbox",
86
- checked: this.state.value,
87
- onBlur: this.onBlur,
88
- onPaste: this.onPaste,
89
- onKeyDown: this.onKeyDown,
90
- onChange: this.onChange,
91
- style: style,
92
- readOnly: this.props.isReadOnly
93
- })));
94
- }
95
- }]);
96
-
97
- return CheckboxEditor;
98
- }(React.Component);
99
-
100
- CheckboxEditor.defaultProps = {
101
- isReadOnly: false,
102
- value: false
103
- };
104
- export default CheckboxEditor;