dtable-ui-component 5.0.10 → 5.0.11-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.
@@ -24,7 +24,7 @@ class CollaboratorSelect extends _react.Component {
24
24
  if (this.state.isShowSelectOptions) event.nativeEvent.stopImmediatePropagation();
25
25
  let eventClassName = event.target.className;
26
26
  if (this.props.isLocked || eventClassName.indexOf('option-search-control') > -1 || eventClassName === 'option-group-search') return;
27
- //Prevent closing by pressing the spacebar in the search input
27
+ // Prevent closing by pressing the spacebar in the search input
28
28
  if (event.target.value === '') return;
29
29
  this.selectedOptionWidth = this.selectedOptionRef.clientWidth;
30
30
  this.setState({
@@ -23,7 +23,7 @@ class DTableCustomizeSelect extends _react.Component {
23
23
  if (this.state.isShowSelectOptions) event.stopPropagation();
24
24
  let eventClassName = event.target.className;
25
25
  if (this.props.isLocked || eventClassName.indexOf('option-search-control') > -1 || eventClassName === 'option-group-search') return;
26
- //Prevent closing by pressing the spacebar in the search input
26
+ // Prevent closing by pressing the spacebar in the search input
27
27
  if (event.target.value === '') return;
28
28
  this.setState({
29
29
  isShowSelectOptions: !this.state.isShowSelectOptions
@@ -81,7 +81,7 @@ class FilterCalendar extends _react.Component {
81
81
  value: null
82
82
  };
83
83
  const DataFormat = (0, _utils.getDateColumnFormat)(props.filterColumn).trim();
84
- //Minutes and seconds are not supported at present
84
+ // Minutes and seconds are not supported at present
85
85
  this.columnDataFormat = DataFormat.split(' ')[0];
86
86
  this.calendarContainerRef = /*#__PURE__*/_react.default.createRef();
87
87
  this.defaultCalendarValue = null;
@@ -274,7 +274,7 @@ class FilterItem extends _react.default.Component {
274
274
  filter_predicate
275
275
  } = filter;
276
276
  let isSupportMultipleSelect = false;
277
- //The first two options are used for single selection, and the last four options are used for multiple selection
277
+ // The first two options are used for single selection, and the last four options are used for multiple selection
278
278
  const supportMultipleSelectOptions = [_dtableUtils.FILTER_PREDICATE_TYPE.IS_ANY_OF, _dtableUtils.FILTER_PREDICATE_TYPE.IS_NONE_OF, _dtableUtils.FILTER_PREDICATE_TYPE.HAS_ANY_OF, _dtableUtils.FILTER_PREDICATE_TYPE.HAS_ALL_OF, _dtableUtils.FILTER_PREDICATE_TYPE.HAS_NONE_OF, _dtableUtils.FILTER_PREDICATE_TYPE.IS_EXACTLY];
279
279
  if (supportMultipleSelectOptions.includes(filter_predicate)) {
280
280
  isSupportMultipleSelect = true;
@@ -7,15 +7,14 @@
7
7
  background-clip: padding-box;
8
8
  border: 1px solid rgba(0, 40, 100, 0.12);
9
9
  border-radius: 3px;
10
- transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
10
+ padding: 4px;
11
11
  }
12
12
 
13
13
  .radio-group-options {
14
14
  height: 100%;
15
15
  display: flex;
16
16
  align-items: center;
17
- justify-content: center;
18
- padding: 4px;
17
+ position: relative;
19
18
  }
20
19
 
21
20
  .radio-group-options .radio-group-button {
@@ -29,20 +28,42 @@
29
28
  text-overflow: ellipsis;
30
29
  white-space: nowrap;
31
30
  border-radius: 3px;
31
+ z-index: 2;
32
32
  }
33
33
 
34
34
  .radio-group-options .radio-group-button:hover {
35
35
  cursor: pointer;
36
+ }
37
+
38
+ .radio-group-options .radio-group-button:not(.active):hover {
36
39
  background-color: #f0f0f0;
37
40
  }
38
41
 
39
- .radio-group-options .radio-group-button.readOnly {
40
- cursor: default;
41
- opacity: 0.6;
42
+ .radio-group-options .radio-group-button.active {
43
+ color:#fff;
44
+ }
45
+
46
+ .radio-group-options .radio-group-slider {
47
+ display: inline-flex;
48
+ position: absolute;
49
+ height: 100%;
50
+ transition: 150ms cubic-bezier(.4, 0, .2, 1);
51
+ border-radius: 3px;
52
+ z-index: 1;
53
+ }
54
+
55
+ .radio-group-options .radio-group-button:nth-of-type(1).active ~ .radio-group-slider {
56
+ transform:translateX(0%);
57
+ }
58
+
59
+ .radio-group-options .radio-group-button:nth-of-type(2).active ~ .radio-group-slider {
60
+ transform:translateX(100%);
61
+ }
62
+
63
+ .radio-group-options .radio-group-button:nth-of-type(3).active ~ .radio-group-slider {
64
+ transform:translateX(200%);
42
65
  }
43
66
 
44
- .radio-group-options .radio-group-button.btn-primary:hover {
45
- color: #fff;
46
- background-color: #ED7109;
47
- border-color: #ED7109;
67
+ .radio-group-options .radio-group-button:nth-of-type(4).active ~ .radio-group-slider {
68
+ transform:translateX(300%);
48
69
  }
@@ -24,6 +24,13 @@ class DTableRadioGroup extends _react.default.Component {
24
24
  activeOption: props.activeOption
25
25
  };
26
26
  }
27
+ componentDidMount() {
28
+ if (!this.btn) return;
29
+ const {
30
+ width
31
+ } = this.btn.getBoundingClientRect();
32
+ this.slider.style.width = "".concat(width, "px");
33
+ }
27
34
  componentDidUpdate(prevProps) {
28
35
  if (this.props.activeOption !== prevProps.activeOption) {
29
36
  this.setState({
@@ -48,10 +55,14 @@ class DTableRadioGroup extends _react.default.Component {
48
55
  const displayOption = optionsDisplay && optionsDisplay[option] || '';
49
56
  return /*#__PURE__*/_react.default.createElement("div", {
50
57
  key: option,
51
- className: "radio-group-button ".concat(isActive ? 'btn-primary' : ''),
58
+ ref: ref => this.btn = ref,
59
+ className: "radio-group-button ".concat(isActive ? 'active' : ''),
52
60
  "data-option": option,
53
61
  onClick: this.onSelectChanged
54
62
  }, displayOption);
63
+ }), /*#__PURE__*/_react.default.createElement("span", {
64
+ className: "radio-group-slider btn-primary",
65
+ ref: ref => this.slider = ref
55
66
  })));
56
67
  }
57
68
  }
@@ -26,5 +26,4 @@ function DepartmentSelectFilter(props) {
26
26
  };
27
27
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isMultiple ? /*#__PURE__*/_react.default.createElement(_departmentMultipleSelectFilter.default, filterProps) : /*#__PURE__*/_react.default.createElement(_departmentSingleSelectFilter.default, filterProps));
28
28
  }
29
- ;
30
29
  var _default = exports.default = DepartmentSelectFilter;
@@ -60,7 +60,8 @@ class DigitalSignFormatter extends _react.Component {
60
60
  containerClassName,
61
61
  readOnly,
62
62
  config,
63
- isSample
63
+ isSample,
64
+ renderItem
64
65
  } = this.props;
65
66
  const className = (0, _classnames.default)('dtable-ui cell-formatter-container digital-sign-formatter', containerClassName);
66
67
  const signImages = this.getSignImages();
@@ -74,7 +75,8 @@ class DigitalSignFormatter extends _react.Component {
74
75
  }, /*#__PURE__*/_react.default.createElement(_imagesLazyLoad.default, {
75
76
  images: signImages,
76
77
  server: config.server,
77
- onImageClick: this.onClickSignImage
78
+ onImageClick: this.onClickSignImage,
79
+ renderItem: renderItem
78
80
  })), isPreviewSignImage && /*#__PURE__*/_react.default.createElement(_ImagePreviewerLightbox.default, {
79
81
  className: "digital-sign-formatter-image-previewer",
80
82
  readOnly: readOnly,
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.default = void 0;
8
- var _react = _interopRequireDefault(require("react"));
9
+ var _react = _interopRequireWildcard(require("react"));
9
10
  var _classnames = _interopRequireDefault(require("classnames"));
10
11
  var _FileItemFormatter = _interopRequireDefault(require("../FileItemFormatter"));
11
12
  require("./index.css");
@@ -14,7 +15,8 @@ class FileFormatter extends _react.default.PureComponent {
14
15
  let {
15
16
  isSample,
16
17
  value,
17
- containerClassName
18
+ containerClassName,
19
+ renderItem
18
20
  } = this.props;
19
21
  if (!Array.isArray(value) || value.length === 0) {
20
22
  return null;
@@ -33,10 +35,15 @@ class FileFormatter extends _react.default.PureComponent {
33
35
  return /*#__PURE__*/_react.default.createElement("div", {
34
36
  className: className
35
37
  }, value.map((item, index) => {
36
- return /*#__PURE__*/_react.default.createElement(_FileItemFormatter.default, {
37
- file: item,
38
- key: index
38
+ const dom = /*#__PURE__*/_react.default.createElement(_FileItemFormatter.default, {
39
+ file: item
39
40
  });
41
+ if (renderItem) return /*#__PURE__*/_react.default.createElement(_react.Fragment, {
42
+ key: index
43
+ }, renderItem(dom));
44
+ return /*#__PURE__*/_react.default.createElement(_react.Fragment, {
45
+ key: index
46
+ }, dom);
40
47
  }));
41
48
  }
42
49
  }
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.default = void 0;
8
- var _react = _interopRequireDefault(require("react"));
9
+ var _react = _interopRequireWildcard(require("react"));
9
10
  var _Loading = _interopRequireDefault(require("../Loading"));
10
11
  var _utils = require("./utils");
11
12
  class ImagesLazyLoad extends _react.default.Component {
@@ -97,6 +98,9 @@ class ImagesLazyLoad extends _react.default.Component {
97
98
  loadedImages,
98
99
  loadedCount
99
100
  } = this.state;
101
+ const {
102
+ renderItem
103
+ } = this.props;
100
104
  if (!Array.isArray(images) || images.length === 0) {
101
105
  return '';
102
106
  }
@@ -110,14 +114,19 @@ class ImagesLazyLoad extends _react.default.Component {
110
114
  }, /*#__PURE__*/_react.default.createElement(_Loading.default, null));
111
115
  }
112
116
  return loadedImages.map((image, index) => {
113
- return /*#__PURE__*/_react.default.createElement("img", {
114
- key: index,
117
+ const imgDom = /*#__PURE__*/_react.default.createElement("img", {
115
118
  className: "image-item",
116
119
  src: image.src,
117
120
  onMouseDown: this.onMouseDown,
118
121
  onClick: event => this.onImageClick(event, index),
119
122
  alt: ""
120
123
  });
124
+ if (renderItem) return /*#__PURE__*/_react.default.createElement(_react.Fragment, {
125
+ key: index
126
+ }, renderItem(imgDom));
127
+ return /*#__PURE__*/_react.default.createElement(_react.Fragment, {
128
+ key: index
129
+ }, imgDom);
121
130
  });
122
131
  }
123
132
  }
@@ -95,7 +95,8 @@ class ImageFormatter extends _react.default.Component {
95
95
  }, /*#__PURE__*/_react.default.createElement(_imagesLazyLoad.default, {
96
96
  images: value,
97
97
  server: server,
98
- onImageClick: this.onImageClick
98
+ onImageClick: this.onImageClick,
99
+ renderItem: this.props.renderItem
99
100
  })), isPreviewImage && /*#__PURE__*/_react.default.createElement(_ImagePreviewerLightbox.default, {
100
101
  imageItems: value,
101
102
  imageIndex: previewImageIndex,
@@ -49,7 +49,7 @@ class NumberEditor extends _react.default.Component {
49
49
  currency_symbol = data['currency_symbol'];
50
50
  }
51
51
 
52
- //Prevent the repetition of periods bug in the Chinese input method of the Windows system
52
+ // Prevent the repetition of periods bug in the Chinese input method of the Windows system
53
53
  if (!(0, _utils.isMac)() && value.indexOf('.。') > -1) return;
54
54
  value = (0, _dtableUtils.replaceNumberNotAllowInput)(value, this.dataFormat, currency_symbol);
55
55
  if (value === this.state.inputValue) return;
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = exports.default = {
7
+ const KeyCodes = {
8
8
  LeftArrow: 37,
9
9
  UpArrow: 38,
10
10
  RightArrow: 39,
@@ -13,4 +13,5 @@ var _default = exports.default = {
13
13
  Tab: 9,
14
14
  Escape: 27,
15
15
  Esc: 27
16
- };
16
+ };
17
+ var _default = exports.default = KeyCodes;
@@ -31,4 +31,5 @@ class EventBus {
31
31
  }
32
32
  }
33
33
  }
34
- var _default = exports.default = new EventBus();
34
+ const eventBus = new EventBus();
35
+ var _default = exports.default = eventBus;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtable-ui-component",
3
- "version": "5.0.10",
3
+ "version": "5.0.11beta",
4
4
  "main": "./lib/index.js",
5
5
  "dependencies": {
6
6
  "@seafile/react-image-lightbox": "2.0.5",