dtable-ui-component 0.3.2 → 0.3.4-alpha1

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 (65) hide show
  1. package/assets/dtable-font/dtable-font.eot +0 -0
  2. package/assets/dtable-font/dtable-font.svg +319 -11
  3. package/assets/dtable-font/dtable-font.ttf +0 -0
  4. package/assets/dtable-font/dtable-font.woff +0 -0
  5. package/assets/dtable-font/dtable-font.woff2 +0 -0
  6. package/assets/dtable-font.css +630 -14
  7. package/lib/AutoNumberFormatter/index.js +2 -2
  8. package/lib/ButtonFormatter/index.js +4 -8
  9. package/lib/CTimeFormatter/index.js +2 -2
  10. package/lib/CheckboxFormatter/index.js +2 -2
  11. package/lib/CollaboratorFormatter/index.js +2 -2
  12. package/lib/CreatorFormatter/index.js +2 -2
  13. package/lib/DTableCustomizeCollaboratorSelect/index.css +1 -1
  14. package/lib/DTableSearchInput/index.js +2 -2
  15. package/lib/DateFormatter/index.js +2 -2
  16. package/lib/DigitalSignFormatter/index.js +2 -2
  17. package/lib/DurationFormatter/index.js +2 -2
  18. package/lib/EmailFormatter/index.js +2 -2
  19. package/lib/FileFormatter/index.js +4 -3
  20. package/lib/FileItemFormatter/index.js +1 -1
  21. package/lib/FormulaFormatter/index.js +24 -5
  22. package/lib/FormulaFormatter/utils.js +91 -0
  23. package/lib/GeolocationFormatter/index.js +2 -2
  24. package/lib/HtmlLongTextFormatter/index.js +2 -2
  25. package/lib/ImageFormatter/images-lazy-load.js +12 -16
  26. package/lib/ImageFormatter/index.js +2 -2
  27. package/lib/ImagePreviewerLightbox/index.js +3 -3
  28. package/lib/LastModifierFormatter/index.js +2 -2
  29. package/lib/LinkFormatter/index.js +4 -4
  30. package/lib/MTimeFormatter/index.js +2 -2
  31. package/lib/MultipleSelectFormatter/index.js +2 -2
  32. package/lib/NumberFormatter/index.js +2 -2
  33. package/lib/RateFormatter/index.js +2 -2
  34. package/lib/RowExpandFileFormatter/index.css +72 -0
  35. package/lib/RowExpandFileFormatter/index.js +59 -0
  36. package/lib/RowExpandFileFormatter/row-expand-file-item-formatter.js +125 -0
  37. package/lib/RowExpandFormatter/index.css +73 -0
  38. package/lib/RowExpandFormatter/index.js +441 -0
  39. package/lib/RowExpandImageFormatter/index.css +79 -0
  40. package/lib/RowExpandImageFormatter/index.js +127 -0
  41. package/lib/RowExpandImageFormatter/row-expand-image-item-formatter.js +128 -0
  42. package/lib/RowExpandImageFormatter/utils.js +7 -0
  43. package/lib/RowExpandLinkFormatter/collaborator-item-formatter.js +164 -0
  44. package/lib/RowExpandLinkFormatter/column-data-constants.js +20 -0
  45. package/lib/RowExpandLinkFormatter/date-utils.js +127 -0
  46. package/lib/RowExpandLinkFormatter/formula-constants.js +9 -0
  47. package/lib/RowExpandLinkFormatter/index.css +25 -0
  48. package/lib/RowExpandLinkFormatter/index.js +170 -0
  49. package/lib/RowExpandLinkFormatter/number-precision.js +116 -0
  50. package/lib/RowExpandLinkFormatter/utils.js +58 -0
  51. package/lib/RowExpandLinkFormatter/value-display-utils.js +401 -0
  52. package/lib/SimpleLongTextFormatter/index.js +2 -2
  53. package/lib/SingleSelectFormatter/index.js +2 -2
  54. package/lib/TextFormatter/index.js +2 -2
  55. package/lib/UrlFormatter/index.js +2 -2
  56. package/lib/common/delete-tip.css +16 -0
  57. package/lib/common/delete-tip.js +84 -0
  58. package/lib/common/modal-portal.js +44 -0
  59. package/lib/constants/cell-types.js +5 -1
  60. package/lib/data/dtable-value.js +2731 -0
  61. package/lib/index.js +7 -1
  62. package/lib/lang/index.js +1 -1
  63. package/lib/locals/en.js +17 -13
  64. package/lib/locals/zh-CN.js +16 -12
  65. package/package.json +5 -4
@@ -0,0 +1,72 @@
1
+ @import url('../css/cell-formatter.css');
2
+
3
+ .dtable-ui.row-expand-file-formatter {
4
+ display: flex;
5
+ flex-wrap: wrap;
6
+ justify-content: flex-start;
7
+ width: 550px;
8
+ }
9
+
10
+ .dtable-ui.row-expand-file-formatter .row-expand-item-file {
11
+ height: 100px;
12
+ width: 100px;
13
+ border: 2px solid #ededed;
14
+ border-radius: 4px;
15
+ cursor: pointer;
16
+ display: flex;
17
+ align-items: center;
18
+ justify-content: center;
19
+ margin: 5px;
20
+ position: relative;
21
+ }
22
+
23
+ .dtable-ui.row-expand-file-formatter .row-expand-item-file:nth-child(5n + 1) {
24
+ margin-left: 0;
25
+ }
26
+
27
+ .dtable-ui.row-expand-file-formatter .row-expand-item-file:hover {
28
+ border-color: #c9c9c9;
29
+ }
30
+
31
+ .dtable-ui.row-expand-file-formatter .row-expand-item-file .dtable-file-icons-choice {
32
+ height: 20px;
33
+ width: 100%;
34
+ top: 0;
35
+ position: absolute;
36
+ color: #fff;
37
+ display: none;
38
+ padding: 0 3px;
39
+ justify-content: flex-end;
40
+ align-items: center;
41
+ }
42
+
43
+ .dtable-ui.row-expand-file-formatter .row-expand-item-file:hover .dtable-file-icons-choice {
44
+ display: flex;
45
+ }
46
+
47
+ .dtable-ui.row-expand-file-formatter .row-expand-item-file .dtable-file-icons-choice .file-icon {
48
+ height: 16px;
49
+ width: 16px;
50
+ border-radius: 50%;
51
+ background: rgba(0, 0, 0, 0.5);
52
+ color: #fff;
53
+ cursor: pointer;
54
+ display: flex;
55
+ justify-content: center;
56
+ align-items: center;
57
+ }
58
+
59
+ .dtable-ui.row-expand-file-formatter .row-expand-item-file .dtable-file-icons-choice .file-icon:nth-child(2) {
60
+ margin-left: 5px;
61
+ }
62
+
63
+ .dtable-ui.row-expand-file-formatter .row-expand-item-file .dtable-file-icons-choice .file-icon .dtable-font {
64
+ font-size: 12px;
65
+ transform: scale(.7);
66
+ }
67
+
68
+ .tooltip-inner {
69
+ font-weight: lighter;
70
+ text-align: justify;
71
+ background-color: #303133;
72
+ }
@@ -0,0 +1,59 @@
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 classname from 'classnames';
7
+ import RowExpandFileItemFormatter from './row-expand-file-item-formatter';
8
+ import './index.css';
9
+
10
+ var RowExpandFileFormatter = /*#__PURE__*/function (_React$PureComponent) {
11
+ _inherits(RowExpandFileFormatter, _React$PureComponent);
12
+
13
+ var _super = _createSuper(RowExpandFileFormatter);
14
+
15
+ function RowExpandFileFormatter() {
16
+ _classCallCheck(this, RowExpandFileFormatter);
17
+
18
+ return _super.apply(this, arguments);
19
+ }
20
+
21
+ _createClass(RowExpandFileFormatter, [{
22
+ key: "render",
23
+ value: function render() {
24
+ var _this$props = this.props,
25
+ value = _this$props.value,
26
+ containerClassName = _this$props.containerClassName,
27
+ column = _this$props.column,
28
+ downloadFile = _this$props.downloadFile,
29
+ deleteFile = _this$props.deleteFile,
30
+ readOnly = _this$props.readOnly;
31
+
32
+ if (!Array.isArray(value) || value.length === 0) {
33
+ return null;
34
+ }
35
+
36
+ return /*#__PURE__*/React.createElement("div", {
37
+ className: classname('dtable-ui cell-formatter-container row-expand-file-formatter', containerClassName)
38
+ }, value.map(function (item, index) {
39
+ return /*#__PURE__*/React.createElement(RowExpandFileItemFormatter, {
40
+ file: item,
41
+ key: index,
42
+ index: index,
43
+ column: column,
44
+ downloadFile: downloadFile,
45
+ deleteFile: deleteFile,
46
+ readOnly: readOnly
47
+ });
48
+ }));
49
+ }
50
+ }]);
51
+
52
+ return RowExpandFileFormatter;
53
+ }(React.PureComponent);
54
+
55
+ RowExpandFileFormatter.defaultProps = {
56
+ value: [],
57
+ containerClassName: ''
58
+ };
59
+ export { RowExpandFileFormatter as default };
@@ -0,0 +1,125 @@
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, { Component } from 'react';
6
+ import { Tooltip } from 'reactstrap';
7
+ import { getLocale } from '../lang';
8
+ import { getFileIconUrl } from '../FileItemFormatter/utils';
9
+ import DeleteTip from '../common/delete-tip';
10
+
11
+ var RowExpandFileItemFormatter = /*#__PURE__*/function (_Component) {
12
+ _inherits(RowExpandFileItemFormatter, _Component);
13
+
14
+ var _super = _createSuper(RowExpandFileItemFormatter);
15
+
16
+ function RowExpandFileItemFormatter(props) {
17
+ var _this;
18
+
19
+ _classCallCheck(this, RowExpandFileItemFormatter);
20
+
21
+ _this = _super.call(this, props);
22
+
23
+ _this.toggleTooltip = function () {
24
+ _this.setState({
25
+ isTooltipOpen: !_this.state.isTooltipOpen
26
+ });
27
+ };
28
+
29
+ _this.closeDeleteTip = function () {
30
+ _this.setState({
31
+ isDeleteTipOpen: false
32
+ });
33
+ };
34
+
35
+ _this.onClickDelete = function (e) {
36
+ e.stopPropagation();
37
+ _this.position = {
38
+ top: e.clientY,
39
+ left: e.clientX
40
+ };
41
+
42
+ _this.setState({
43
+ isDeleteTipOpen: true
44
+ });
45
+ };
46
+
47
+ _this.onDelete = function (e) {
48
+ e.stopPropagation();
49
+
50
+ _this.closeDeleteTip();
51
+
52
+ _this.props.deleteFile(_this.props.index);
53
+ };
54
+
55
+ _this.getFileIconData = function (item) {
56
+ var fileIconUrl = getFileIconUrl(item.name, item.type);
57
+ return require('../FileItemFormatter/' + fileIconUrl);
58
+ };
59
+
60
+ _this.state = {
61
+ isTooltipOpen: false,
62
+ isDeleteTipOpen: false
63
+ };
64
+ return _this;
65
+ }
66
+
67
+ _createClass(RowExpandFileItemFormatter, [{
68
+ key: "render",
69
+ value: function render() {
70
+ var _this2 = this;
71
+
72
+ var _this$props = this.props,
73
+ file = _this$props.file,
74
+ column = _this$props.column,
75
+ index = _this$props.index,
76
+ readOnly = _this$props.readOnly,
77
+ downloadFile = _this$props.downloadFile,
78
+ deleteFile = _this$props.deleteFile;
79
+ var id = 'file-list-preview-item' + column.key + index;
80
+ var url = this.getFileIconData(file);
81
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
82
+ key: "file-".concat(index),
83
+ className: "row-expand-item-file",
84
+ id: id
85
+ }, /*#__PURE__*/React.createElement("img", {
86
+ src: url,
87
+ id: "item-file-".concat(index),
88
+ alt: file.name
89
+ }), /*#__PURE__*/React.createElement("div", {
90
+ className: "dtable-file-icons-choice"
91
+ }, downloadFile && /*#__PURE__*/React.createElement("span", {
92
+ className: "file-icon",
93
+ onClick: function onClick(e) {
94
+ return _this2.props.downloadFile(file, e);
95
+ }
96
+ }, /*#__PURE__*/React.createElement("i", {
97
+ className: "dtable-font dtable-icon-download"
98
+ })), !readOnly && deleteFile && /*#__PURE__*/React.createElement("span", {
99
+ className: "file-icon",
100
+ onClick: this.onClickDelete
101
+ }, /*#__PURE__*/React.createElement("i", {
102
+ className: "dtable-font dtable-icon-fork-number"
103
+ })))), this.state.isDeleteTipOpen && /*#__PURE__*/React.createElement(DeleteTip, {
104
+ position: this.position,
105
+ toggle: this.closeDeleteTip,
106
+ onDelete: this.onDelete,
107
+ deleteTip: getLocale('Are_you_sure_you_want_to_delete_this_file')
108
+ }), /*#__PURE__*/React.createElement(Tooltip, {
109
+ placement: "bottom",
110
+ isOpen: this.state.isTooltipOpen,
111
+ toggle: this.toggleTooltip,
112
+ target: id,
113
+ delay: {
114
+ show: 0,
115
+ hide: 0
116
+ },
117
+ fade: false
118
+ }, file.name));
119
+ }
120
+ }]);
121
+
122
+ return RowExpandFileItemFormatter;
123
+ }(Component);
124
+
125
+ export { RowExpandFileItemFormatter as default };
@@ -0,0 +1,73 @@
1
+ .dtable-ui.dtable-row-expand-formatter {
2
+ width: 100%;
3
+ max-width: 100%;
4
+ }
5
+
6
+ .dtable-ui.dtable-row-expand-formatter .row-cell-empty {
7
+ height: 8px;
8
+ width: 20px;
9
+ background-color: #f1f1f1;
10
+ border-radius: 4px;
11
+ display: inline-block;
12
+ }
13
+
14
+ .dtable-ui.dtable-row-expand-formatter .dtable-ui.collaborator-item {
15
+ margin: 5px 10px 5px 0;
16
+ }
17
+
18
+ .dtable-ui.dtable-row-expand-formatter .dtable-ui.text-formatter,
19
+ .dtable-ui.dtable-row-expand-formatter .dtable-ui.url-formatter,
20
+ .dtable-ui.dtable-row-expand-formatter .dtable-ui.email-formatter {
21
+ overflow: hidden;
22
+ text-overflow: ellipsis;
23
+ white-space: nowrap;
24
+ }
25
+
26
+ .dtable-ui.dtable-row-expand-formatter .dtable-ui.multiple-select-formatter .dtable-ui.select-item {
27
+ margin: 5px 0;
28
+ }
29
+
30
+ .dtable-ui.dtable-row-expand-formatter .dtable-ui.geolocation-formatter {
31
+ width: fit-content;
32
+ min-width: 80px;
33
+ max-width: 100%;
34
+ height: 28px;
35
+ line-height: 24px;
36
+ border: 2px solid transparent;
37
+ padding: 0 10px;
38
+ background-color: #f0f0f0;
39
+ border-radius: 3px;
40
+ font-size: 14px;
41
+ text-align: center;
42
+ }
43
+
44
+ .dtable-ui.dtable-row-expand-formatter .form-control {
45
+ background-color: #f8f9fa;
46
+ }
47
+
48
+ .dtable-ui.dtable-row-expand-formatter .checkbox-formatter-container {
49
+ width: 24px;
50
+ height: 24px;
51
+ border: 2px solid #e0e0e0;
52
+ border-radius: 3px;
53
+ display: flex;
54
+ justify-content: center;
55
+ }
56
+
57
+ .dtable-ui.dtable-row-expand-formatter .longtext-formatter-container {
58
+ border: 1px solid rgba(0, 40, 100, 0.12);
59
+ border-radius: 3px;
60
+ padding: 0.375rem 0.75rem;
61
+ height: auto;
62
+ background-color: #fff;
63
+ }
64
+
65
+ .dtable-ui.dtable-row-expand-formatter .geolocation-formatter-container {
66
+ height: 38px;
67
+ display: flex;
68
+ align-items: center;
69
+ }
70
+
71
+ .dtable-ui.dtable-row-expand-formatter .dtable-link-formatter {
72
+ padding-top: 8px;
73
+ }