dtable-ui-component 0.1.84 → 0.1.85

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 (115) 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/DTableSwitch/index.js +27 -0
  5. package/lib/FormulaFormatter/index.js +7 -7
  6. package/lib/index.js +5 -1
  7. package/package.json +2 -1
  8. package/es/app.css +0 -20
  9. package/es/app.js +0 -91
  10. package/es/assets/images/avatar/default_avatar.png +0 -0
  11. package/es/assets/images/file/192/excel.png +0 -0
  12. package/es/assets/images/file/192/file.png +0 -0
  13. package/es/assets/images/file/192/music.png +0 -0
  14. package/es/assets/images/file/192/pdf.png +0 -0
  15. package/es/assets/images/file/192/pic.png +0 -0
  16. package/es/assets/images/file/192/ppt.png +0 -0
  17. package/es/assets/images/file/192/txt.png +0 -0
  18. package/es/assets/images/file/192/video.png +0 -0
  19. package/es/assets/images/file/192/word.png +0 -0
  20. package/es/assets/images/file/24/excel.png +0 -0
  21. package/es/assets/images/file/24/file.png +0 -0
  22. package/es/assets/images/file/24/music.png +0 -0
  23. package/es/assets/images/file/24/pdf.png +0 -0
  24. package/es/assets/images/file/24/pic.png +0 -0
  25. package/es/assets/images/file/24/ppt.png +0 -0
  26. package/es/assets/images/file/24/txt.png +0 -0
  27. package/es/assets/images/file/24/video.png +0 -0
  28. package/es/assets/images/file/24/word.png +0 -0
  29. package/es/assets/images/folder/folder-192.png +0 -0
  30. package/es/assets/images/folder/folder-24.png +0 -0
  31. package/es/components/cell-editor/checkbox-editor.js +0 -104
  32. package/es/components/cell-editor/collaborator-editor.js +0 -236
  33. package/es/components/cell-editor/date-editor.js +0 -151
  34. package/es/components/cell-editor/index.js +0 -9
  35. package/es/components/cell-editor/link-editor.js +0 -303
  36. package/es/components/cell-editor/multiple-select-editor.js +0 -237
  37. package/es/components/cell-editor/number-editor.js +0 -154
  38. package/es/components/cell-editor/single-select-editor.js +0 -202
  39. package/es/components/cell-editor/text-editor.js +0 -122
  40. package/es/components/cell-editor-dialog/pc-file-editor-dialog.js +0 -46
  41. package/es/components/cell-editor-dialog/pc-files-addition/index.js +0 -0
  42. package/es/components/cell-editor-dialog/pc-files-addition/pc-file-uploaded-item.js +0 -0
  43. package/es/components/cell-editor-dialog/pc-files-preview/index.js +0 -0
  44. package/es/components/cell-editor-dialog/pc-files-preview/pc-file-item-preview.js +0 -0
  45. package/es/components/cell-editor-popover/mb-collaborator-editor-popover.js +0 -177
  46. package/es/components/cell-editor-popover/mb-date-editor-popover.js +0 -245
  47. package/es/components/cell-editor-popover/mb-link-editor-popover.js +0 -170
  48. package/es/components/cell-editor-popover/mb-select-editor-popover.js +0 -230
  49. package/es/components/cell-editor-popover/pc-collaborator-editor-popover.js +0 -109
  50. package/es/components/cell-editor-popover/pc-date-editor-popover.js +0 -142
  51. package/es/components/cell-editor-popover/pc-link-editor-popover.js +0 -114
  52. package/es/components/cell-editor-popover/pc-select-editor-popover.js +0 -143
  53. package/es/components/cell-factory/cell-formatter-factory.js +0 -25
  54. package/es/components/cell-formatter/auto-number-formatter.js +0 -35
  55. package/es/components/cell-formatter/button-formatter.js +0 -55
  56. package/es/components/cell-formatter/checkbox-formatter.js +0 -44
  57. package/es/components/cell-formatter/collaborator-formatter.js +0 -91
  58. package/es/components/cell-formatter/creator-formatter.js +0 -87
  59. package/es/components/cell-formatter/ctime-formatter.js +0 -57
  60. package/es/components/cell-formatter/date-formatter.js +0 -59
  61. package/es/components/cell-formatter/duration-formatter.js +0 -37
  62. package/es/components/cell-formatter/email-formatter.js +0 -35
  63. package/es/components/cell-formatter/file-formatter.js +0 -63
  64. package/es/components/cell-formatter/formatter-config.js +0 -31
  65. package/es/components/cell-formatter/formula-formatter.js +0 -164
  66. package/es/components/cell-formatter/geolocation-formatter.js +0 -52
  67. package/es/components/cell-formatter/image-formatter.js +0 -153
  68. package/es/components/cell-formatter/index.js +0 -27
  69. package/es/components/cell-formatter/last-modifier-formatter.js +0 -87
  70. package/es/components/cell-formatter/link-formatter.js +0 -144
  71. package/es/components/cell-formatter/long-text-formatter.js +0 -106
  72. package/es/components/cell-formatter/mtime-formatter.js +0 -57
  73. package/es/components/cell-formatter/multiple-select-formatter.js +0 -69
  74. package/es/components/cell-formatter/number-formatter.js +0 -46
  75. package/es/components/cell-formatter/rate-formatter.js +0 -79
  76. package/es/components/cell-formatter/single-select-formatter.js +0 -69
  77. package/es/components/cell-formatter/text-formatter.js +0 -55
  78. package/es/components/cell-formatter/url-formatter.js +0 -35
  79. package/es/components/cell-formatter/widgets/file-item-formatter.js +0 -50
  80. package/es/components/cell-formatter/widgets/image-previewer-lightbox.js +0 -119
  81. package/es/components/common/collaborator-item.js +0 -63
  82. package/es/components/common/edit-editor-button.js +0 -56
  83. package/es/components/common/images-lazy-load.js +0 -150
  84. package/es/components/common/link-editor-option.js +0 -113
  85. package/es/components/common/mobile/mb-editor-header.js +0 -48
  86. package/es/components/common/modal-portal.js +0 -44
  87. package/es/components/common/select-editor-option.js +0 -106
  88. package/es/components/common/select-item.js +0 -58
  89. package/es/components/file-uploader/index.js +0 -53
  90. package/es/components/loading.js +0 -7
  91. package/es/components/toast/alert.js +0 -150
  92. package/es/components/toast/index.js +0 -3
  93. package/es/components/toast/toast.js +0 -179
  94. package/es/components/toast/toastManager.js +0 -170
  95. package/es/components/toast/toaster.js +0 -76
  96. package/es/constants/cell-types.js +0 -25
  97. package/es/constants/index.js +0 -48
  98. package/es/css/cell-editor.css +0 -614
  99. package/es/css/cell-formatter.css +0 -241
  100. package/es/css/custom-rc-calendar.css +0 -118
  101. package/es/css/image-previewer-ligntbox.css +0 -87
  102. package/es/css/loading.css +0 -54
  103. package/es/index.js +0 -6
  104. package/es/lang/index.js +0 -50
  105. package/es/locals/de.js +0 -2
  106. package/es/locals/en.js +0 -17
  107. package/es/locals/fr.js +0 -2
  108. package/es/locals/zh-CN.js +0 -17
  109. package/es/utils/cell-value-validator.js +0 -32
  110. package/es/utils/column-utils.js +0 -7
  111. package/es/utils/editor-utils.js +0 -71
  112. package/es/utils/normalize-long-text-value.js +0 -68
  113. package/es/utils/number-precision.js +0 -163
  114. package/es/utils/utils.js +0 -116
  115. package/es/utils/value-format-utils.js +0 -495
@@ -1,144 +0,0 @@
1
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
- import _createClass from "@babel/runtime/helpers/esm/createClass";
3
- import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
4
- import _inherits from "@babel/runtime/helpers/esm/inherits";
5
- import _createSuper from "@babel/runtime/helpers/esm/createSuper";
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';
10
-
11
- // link value is get form parant's interface
12
- var LinkFormatter = /*#__PURE__*/function (_React$Component) {
13
- _inherits(LinkFormatter, _React$Component);
14
-
15
- var _super = _createSuper(LinkFormatter);
16
-
17
- function LinkFormatter(props) {
18
- var _this;
19
-
20
- _classCallCheck(this, LinkFormatter);
21
-
22
- _this = _super.call(this, props);
23
-
24
- _this.getLinkedCellValue = function (row) {
25
- if (!row) return [];
26
- var _this$props = _this.props,
27
- column = _this$props.column,
28
- currentTableId = _this$props.currentTableId,
29
- linkMetaData = _this$props.linkMetaData;
30
-
31
- var _ref = column.data || {},
32
- link_id = _ref.link_id,
33
- table_id = _ref.table_id,
34
- other_table_id = _ref.other_table_id;
35
-
36
- _this.linkID = link_id;
37
- _this.tableID = currentTableId === table_id ? table_id : other_table_id;
38
- _this.otherTableID = _this.tableID === table_id ? other_table_id : table_id;
39
- return linkMetaData.getLinkedCellValue(_this.linkID, _this.tableID, _this.otherTableID, row._id);
40
- };
41
-
42
- _this.expandLinkedTableRow = function (row) {
43
- var _this$props2 = _this.props,
44
- enableOpenLinkedRow = _this$props2.enableOpenLinkedRow,
45
- linkMetaData = _this$props2.linkMetaData;
46
-
47
- if (enableOpenLinkedRow) {
48
- linkMetaData.expandLinkedTableRow(row, _this.otherTableID);
49
- }
50
- };
51
-
52
- _this.getDisplayValues = function () {
53
- var _this$props3 = _this.props,
54
- column = _this$props3.column,
55
- linkMetaData = _this$props3.linkMetaData;
56
- var rowIds = _this.state.value;
57
-
58
- if (rowIds && Array.isArray(rowIds) && rowIds.length > 0) {
59
- var linkedTable = linkMetaData.getLinkedTable(_this.otherTableID);
60
- var linkedRows = linkMetaData.getLinkedRows(_this.otherTableID, rowIds);
61
- var result = linkedRows.map(function (row, index) {
62
- var displayColumnKey = column.data.display_column_key;
63
-
64
- var displayValue = _this.getDisplayValue(linkedTable, row, displayColumnKey);
65
-
66
- return /*#__PURE__*/React.createElement("div", {
67
- key: index,
68
- className: "link-item",
69
- onClick: _this.expandLinkedTableRow.bind(_assertThisInitialized(_this), row)
70
- }, /*#__PURE__*/React.createElement("div", {
71
- className: "link-name"
72
- }, displayValue));
73
- });
74
- return result;
75
- }
76
-
77
- return null;
78
- };
79
-
80
- _this.getDisplayValue = function (linkedTable, row, displayColumnKey) {
81
- var value = row[displayColumnKey];
82
- var linkedColumn = linkedTable.columns.find(function (column) {
83
- return column.key === displayColumnKey;
84
- });
85
- var type = linkedColumn.type,
86
- data = linkedColumn.data; // todo: improve
87
-
88
- switch (type) {
89
- case CellTypes.NUMBER:
90
- {
91
- return getNumberDisplayString(value, data);
92
- }
93
-
94
- case CellTypes.DATE:
95
- {
96
- var format = data.format;
97
- return getDateDisplayString(value, format);
98
- }
99
-
100
- default:
101
- return value;
102
- }
103
- };
104
-
105
- _this.linkID = '';
106
- _this.tableID = '';
107
- _this.otherTableID = '';
108
- _this.state = {
109
- value: _this.getLinkedCellValue(props.row)
110
- };
111
- return _this;
112
- }
113
-
114
- _createClass(LinkFormatter, [{
115
- key: "componentWillReceiveProps",
116
- value: function componentWillReceiveProps(nextProps) {
117
- var nextRow = nextProps.row;
118
-
119
- if (nextRow._id !== this.props.row._id) {
120
- this.setState({
121
- value: this.getLinkedCellValue(nextRow)
122
- });
123
- }
124
- }
125
- }, {
126
- key: "render",
127
- value: function render() {
128
- var containerClassName = this.props.containerClassName;
129
- var classname = cn('dtable-ui cell-formatter-container link-formatter', containerClassName);
130
- var displayValues = this.getDisplayValues();
131
- return /*#__PURE__*/React.createElement("div", {
132
- className: classname
133
- }, displayValues);
134
- }
135
- }]);
136
-
137
- return LinkFormatter;
138
- }(React.Component);
139
-
140
- LinkFormatter.defaultProps = {
141
- enableOpenLinkedRow: false,
142
- value: []
143
- };
144
- export default LinkFormatter;
@@ -1,106 +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 cn from 'astro-classname';
7
- import getPreviewContent from '../../utils/normalize-long-text-value';
8
-
9
- var LongTextFormatter = /*#__PURE__*/function (_React$Component) {
10
- _inherits(LongTextFormatter, _React$Component);
11
-
12
- var _super = _createSuper(LongTextFormatter);
13
-
14
- function LongTextFormatter() {
15
- var _this;
16
-
17
- _classCallCheck(this, LongTextFormatter);
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.renderLinks = function (value) {
26
- var links = value.links;
27
- if (!Array.isArray(links) || links.length === 0) return null;
28
- return /*#__PURE__*/React.createElement("span", {
29
- className: "long-text-links"
30
- }, /*#__PURE__*/React.createElement("i", {
31
- className: "dtable-font dtable-icon-url"
32
- }), links.length);
33
- };
34
-
35
- _this.renderCheckList = function (value) {
36
- var checkList = value.checklist;
37
- if (!checkList || checkList.total === 0) return null;
38
- return /*#__PURE__*/React.createElement("span", {
39
- className: "long-text-check-list"
40
- }, /*#__PURE__*/React.createElement("i", {
41
- className: "dtable-font dtable-icon-check-square-solid ".concat(checkList.completed === checkList.total ? 'long-text-check-list-completed' : '')
42
- }), "".concat(checkList.completed, "/").concat(checkList.total));
43
- };
44
-
45
- _this.renderImages = function (value) {
46
- var images = value.images;
47
- if (!Array.isArray(images) || images.length === 0) return null;
48
- return /*#__PURE__*/React.createElement("span", {
49
- className: "long-text-images"
50
- }, /*#__PURE__*/React.createElement("img", {
51
- src: images[0],
52
- alt: ""
53
- }), /*#__PURE__*/React.createElement("i", {
54
- className: "image-number"
55
- }, images.length > 1 ? '+' + images.length : null));
56
- };
57
-
58
- _this.renderContent = function (value) {
59
- return /*#__PURE__*/React.createElement("span", {
60
- className: "long-text-content"
61
- }, value.preview);
62
- };
63
-
64
- _this.translateValue = function () {
65
- var value = _this.props.value;
66
- if (!value) return {};
67
- var valueType = Object.prototype.toString.call(value);
68
-
69
- if (valueType === '[object String]') {
70
- return getPreviewContent(value);
71
- }
72
-
73
- if (valueType === '[object Object]') {
74
- return value;
75
- }
76
-
77
- return {};
78
- };
79
-
80
- return _this;
81
- }
82
-
83
- _createClass(LongTextFormatter, [{
84
- key: "render",
85
- value: function render() {
86
- var containerClassName = this.props.containerClassName;
87
- var className = cn('dtable-ui cell-formatter-container long-text-formatter', containerClassName);
88
- var value = this.translateValue();
89
- return /*#__PURE__*/React.createElement("div", {
90
- className: className
91
- }, this.renderLinks(value), this.renderCheckList(value), this.renderImages(value), this.renderContent(value));
92
- }
93
- }]);
94
-
95
- return LongTextFormatter;
96
- }(React.Component);
97
-
98
- LongTextFormatter.defaultProps = {
99
- value: {
100
- text: '',
101
- images: [],
102
- links: [],
103
- preview: ''
104
- }
105
- };
106
- export default LongTextFormatter;
@@ -1,57 +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 cn from 'astro-classname';
7
- import moment from 'moment';
8
-
9
- var MTimeFormatter = /*#__PURE__*/function (_React$Component) {
10
- _inherits(MTimeFormatter, _React$Component);
11
-
12
- var _super = _createSuper(MTimeFormatter);
13
-
14
- function MTimeFormatter() {
15
- var _this;
16
-
17
- _classCallCheck(this, MTimeFormatter);
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.formatDate = function (date) {
26
- return moment(date).format('YYYY-MM-DD HH:mm:ss');
27
- };
28
-
29
- return _this;
30
- }
31
-
32
- _createClass(MTimeFormatter, [{
33
- key: "render",
34
- value: function render() {
35
- var _this$props = this.props,
36
- date = _this$props.value,
37
- containerClassName = _this$props.containerClassName;
38
- var classname = cn('dtable-ui cell-formatter-container ctime-formatter', containerClassName);
39
-
40
- if (date !== '') {
41
- date = this.formatDate(date);
42
- }
43
-
44
- return /*#__PURE__*/React.createElement("div", {
45
- className: classname
46
- }, date);
47
- }
48
- }]);
49
-
50
- return MTimeFormatter;
51
- }(React.Component);
52
-
53
- MTimeFormatter.defaultProps = {
54
- value: '',
55
- containerClassName: ''
56
- };
57
- export default MTimeFormatter;
@@ -1,69 +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 cn from 'astro-classname';
7
- import SelectItem from '../common/select-item';
8
-
9
- var MultipleSelectFormatter = /*#__PURE__*/function (_React$PureComponent) {
10
- _inherits(MultipleSelectFormatter, _React$PureComponent);
11
-
12
- var _super = _createSuper(MultipleSelectFormatter);
13
-
14
- function MultipleSelectFormatter() {
15
- var _this;
16
-
17
- _classCallCheck(this, MultipleSelectFormatter);
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.getOptions = function () {
26
- var _this$props = _this.props,
27
- value = _this$props.value,
28
- options = _this$props.options;
29
- if (!Array.isArray(value) || !Array.isArray(options)) return [];
30
- var selectedOptions = options.filter(function (option) {
31
- return value.includes(option.id) || value.includes(option.name);
32
- });
33
- if (selectedOptions.length === 0) return [];
34
- return selectedOptions.map(function (option) {
35
- return /*#__PURE__*/React.createElement(SelectItem, {
36
- key: "multiple-".concat(option.id),
37
- option: option
38
- });
39
- });
40
- };
41
-
42
- return _this;
43
- }
44
-
45
- _createClass(MultipleSelectFormatter, [{
46
- key: "render",
47
- value: function render() {
48
- var _this$props2 = this.props,
49
- value = _this$props2.value,
50
- containerClassName = _this$props2.containerClassName;
51
- var classname = cn('dtable-ui cell-formatter-container multiple-select-formatter', containerClassName);
52
-
53
- if (!value || Array.isArray(value) && value.length === 0) {
54
- return /*#__PURE__*/React.createElement("div", {
55
- className: classname
56
- });
57
- }
58
-
59
- var options = this.getOptions();
60
- return /*#__PURE__*/React.createElement("div", {
61
- className: classname
62
- }, options);
63
- }
64
- }]);
65
-
66
- return MultipleSelectFormatter;
67
- }(React.PureComponent);
68
-
69
- export default MultipleSelectFormatter;
@@ -1,46 +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 cn from 'astro-classname';
7
- import { getNumberDisplayString } from '../../utils/value-format-utils';
8
-
9
- var NumberFormatter = /*#__PURE__*/function (_React$Component) {
10
- _inherits(NumberFormatter, _React$Component);
11
-
12
- var _super = _createSuper(NumberFormatter);
13
-
14
- function NumberFormatter() {
15
- _classCallCheck(this, NumberFormatter);
16
-
17
- return _super.apply(this, arguments);
18
- }
19
-
20
- _createClass(NumberFormatter, [{
21
- key: "render",
22
- value: function render() {
23
- var _this$props = this.props,
24
- number = _this$props.value,
25
- data = _this$props.data,
26
- containerClassName = _this$props.containerClassName;
27
- var classname = cn('dtable-ui cell-formatter-container number-formatter', containerClassName);
28
-
29
- if (number || number === 0) {
30
- number = getNumberDisplayString(number, data);
31
- }
32
-
33
- return /*#__PURE__*/React.createElement("div", {
34
- className: classname
35
- }, number);
36
- }
37
- }]);
38
-
39
- return NumberFormatter;
40
- }(React.Component);
41
-
42
- NumberFormatter.defaultProps = {
43
- value: '',
44
- containerClassName: ''
45
- };
46
- export default NumberFormatter;
@@ -1,79 +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 cn from 'astro-classname';
7
-
8
- var RateFormatter = /*#__PURE__*/function (_React$Component) {
9
- _inherits(RateFormatter, _React$Component);
10
-
11
- var _super = _createSuper(RateFormatter);
12
-
13
- function RateFormatter() {
14
- var _this;
15
-
16
- _classCallCheck(this, RateFormatter);
17
-
18
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
19
- args[_key] = arguments[_key];
20
- }
21
-
22
- _this = _super.call.apply(_super, [this].concat(args));
23
-
24
- _this.getRateList = function () {
25
- var _this$props = _this.props,
26
- data = _this$props.data,
27
- value = _this$props.value;
28
-
29
- var _ref = data || {},
30
- _ref$rate_max_number = _ref.rate_max_number,
31
- rate_max_number = _ref$rate_max_number === void 0 ? 5 : _ref$rate_max_number,
32
- _ref$rate_style_color = _ref.rate_style_color,
33
- rate_style_color = _ref$rate_style_color === void 0 ? '#e5e5e5' : _ref$rate_style_color;
34
-
35
- var validValue = Math.min(rate_max_number, value);
36
- var rateList = [];
37
-
38
- for (var i = 0; i < validValue; i++) {
39
- rateList.push( /*#__PURE__*/React.createElement("i", {
40
- key: "dtable-ui-component-rate-".concat(i),
41
- className: "dtable-font dtable-icon-star",
42
- style: {
43
- color: rate_style_color || '#e5e5e5'
44
- }
45
- }));
46
- }
47
-
48
- return rateList;
49
- };
50
-
51
- return _this;
52
- }
53
-
54
- _createClass(RateFormatter, [{
55
- key: "render",
56
- value: function render() {
57
- var _this$props2 = this.props,
58
- number = _this$props2.value,
59
- containerClassName = _this$props2.containerClassName;
60
- var className = cn('dtable-ui cell-formatter-container rate-formatter', containerClassName);
61
- if (!number) return null;
62
- var rateList = this.getRateList();
63
- return /*#__PURE__*/React.createElement("div", {
64
- className: className
65
- }, rateList);
66
- }
67
- }]);
68
-
69
- return RateFormatter;
70
- }(React.Component);
71
-
72
- RateFormatter.defaultProps = {
73
- value: '',
74
- containerClassName: ''
75
- };
76
- RateFormatter.defaultProps = {
77
- editable: true
78
- };
79
- export default RateFormatter;
@@ -1,69 +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 cn from 'astro-classname';
7
- import SelectItem from '../common/select-item';
8
-
9
- var SingleSelectFormatter = /*#__PURE__*/function (_React$PureComponent) {
10
- _inherits(SingleSelectFormatter, _React$PureComponent);
11
-
12
- var _super = _createSuper(SingleSelectFormatter);
13
-
14
- function SingleSelectFormatter() {
15
- var _this;
16
-
17
- _classCallCheck(this, SingleSelectFormatter);
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.getOption = function () {
26
- var _this$props = _this.props,
27
- value = _this$props.value,
28
- options = _this$props.options,
29
- fontSize = _this$props.fontSize;
30
- var option = options.find(function (item) {
31
- return item.id === value || item.name === value;
32
- });
33
-
34
- if (option) {
35
- return /*#__PURE__*/React.createElement(SelectItem, {
36
- option: option,
37
- fontSize: fontSize
38
- });
39
- }
40
- };
41
-
42
- return _this;
43
- }
44
-
45
- _createClass(SingleSelectFormatter, [{
46
- key: "render",
47
- value: function render() {
48
- var _this$props2 = this.props,
49
- containerClassName = _this$props2.containerClassName,
50
- value = _this$props2.value;
51
- var classname = cn('dtable-ui cell-formatter-container single-select-formatter', containerClassName);
52
-
53
- if (!value) {
54
- return /*#__PURE__*/React.createElement("div", {
55
- className: classname
56
- });
57
- }
58
-
59
- var option = this.getOption();
60
- return /*#__PURE__*/React.createElement("div", {
61
- className: classname
62
- }, option);
63
- }
64
- }]);
65
-
66
- return SingleSelectFormatter;
67
- }(React.PureComponent);
68
-
69
- export default SingleSelectFormatter;
@@ -1,55 +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 cn from 'astro-classname';
7
-
8
- var TextFormatter = /*#__PURE__*/function (_React$Component) {
9
- _inherits(TextFormatter, _React$Component);
10
-
11
- var _super = _createSuper(TextFormatter);
12
-
13
- function TextFormatter() {
14
- var _this;
15
-
16
- _classCallCheck(this, TextFormatter);
17
-
18
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
19
- args[_key] = arguments[_key];
20
- }
21
-
22
- _this = _super.call.apply(_super, [this].concat(args));
23
-
24
- _this.getFormattedValue = function (val) {
25
- if (typeof val === 'object') {
26
- return null;
27
- }
28
-
29
- if (Object.prototype.toString.call(val) === '[object Boolean]') {
30
- return val + '';
31
- }
32
-
33
- return val;
34
- };
35
-
36
- return _this;
37
- }
38
-
39
- _createClass(TextFormatter, [{
40
- key: "render",
41
- value: function render() {
42
- var _this$props = this.props,
43
- containerClassName = _this$props.containerClassName,
44
- value = _this$props.value;
45
- var classname = cn('dtable-ui cell-formatter-container text-formatter', containerClassName);
46
- return /*#__PURE__*/React.createElement("div", {
47
- className: classname
48
- }, this.getFormattedValue(value));
49
- }
50
- }]);
51
-
52
- return TextFormatter;
53
- }(React.Component);
54
-
55
- export default TextFormatter;
@@ -1,35 +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 cn from 'astro-classname';
7
-
8
- var UrlFormatter = /*#__PURE__*/function (_React$Component) {
9
- _inherits(UrlFormatter, _React$Component);
10
-
11
- var _super = _createSuper(UrlFormatter);
12
-
13
- function UrlFormatter() {
14
- _classCallCheck(this, UrlFormatter);
15
-
16
- return _super.apply(this, arguments);
17
- }
18
-
19
- _createClass(UrlFormatter, [{
20
- key: "render",
21
- value: function render() {
22
- var _this$props = this.props,
23
- containerClassName = _this$props.containerClassName,
24
- value = _this$props.value;
25
- var classname = cn('dtable-ui cell-formatter-container url-formatter', containerClassName);
26
- return /*#__PURE__*/React.createElement("div", {
27
- className: classname
28
- }, value);
29
- }
30
- }]);
31
-
32
- return UrlFormatter;
33
- }(React.Component);
34
-
35
- export default UrlFormatter;