dtable-ui-component 4.3.6 → 4.3.8
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.
- package/lib/AutoNumberFormatter/index.js +11 -24
- package/lib/ButtonFormatter/index.js +29 -45
- package/lib/CTimeFormatter/index.js +17 -32
- package/lib/CheckboxEditor/index.js +42 -49
- package/lib/CheckboxFormatter/index.js +17 -30
- package/lib/CollaboratorEditor/index.js +118 -135
- package/lib/CollaboratorEditor/mb-collaborator-editor-popover/index.js +90 -99
- package/lib/CollaboratorEditor/pc-collaborator-editor-popover/index.js +61 -69
- package/lib/CollaboratorFormatter/index.js +26 -42
- package/lib/CollaboratorItem/index.js +31 -44
- package/lib/CreatorFormatter/index.js +24 -40
- package/lib/DTableCustomizeCollaboratorSelect/index.js +80 -99
- package/lib/DTableCustomizeCollaboratorSelect/utils.js +12 -13
- package/lib/DTableCustomizeSelect/index.css +22 -59
- package/lib/DTableCustomizeSelect/index.js +99 -95
- package/lib/DTablePopover/index.js +52 -71
- package/lib/DTablePopover/utils.js +1 -1
- package/lib/DTableRadio/index.js +9 -7
- package/lib/DTableSearchInput/index.js +89 -99
- package/lib/DTableSearchInput/utils.js +2 -2
- package/lib/DTableSelect/dtable-select-label.js +5 -3
- package/lib/DTableSelect/index.js +50 -64
- package/lib/DTableSelect/utils.js +36 -41
- package/lib/DTableSwitch/index.js +7 -5
- package/lib/DateEditor/index.js +88 -94
- package/lib/DateEditor/mb-date-editor-popover/index.js +136 -134
- package/lib/DateEditor/pc-date-editor-popover.js +70 -77
- package/lib/DateFormatter/index.js +15 -28
- package/lib/DepartmentSingleSelectFormatter/index.js +9 -9
- package/lib/DigitalSignFormatter/index.js +55 -65
- package/lib/DigitalSignFormatter/utils.js +9 -8
- package/lib/DurationFormatter/index.js +14 -27
- package/lib/EditEditorButton/index.js +10 -22
- package/lib/EmailFormatter/index.js +11 -24
- package/lib/FieldDisplaySetting/field-item.js +18 -20
- package/lib/FieldDisplaySetting/index.js +41 -43
- package/lib/FileEditor/index.js +18 -29
- package/lib/FileFormatter/index.js +29 -43
- package/lib/FileItemFormatter/index.js +17 -32
- package/lib/FileItemFormatter/utils.js +5 -5
- package/lib/FileUploader/index.js +20 -33
- package/lib/FormulaFormatter/cell-value-validator.js +23 -8
- package/lib/FormulaFormatter/index.js +77 -83
- package/lib/FormulaFormatter/utils.js +27 -21
- package/lib/GeolocationFormatter/index.js +19 -32
- package/lib/HtmlLongTextFormatter/index.js +43 -52
- package/lib/HtmlLongTextFormatter/markdown2html.js +2 -2
- package/lib/HtmlLongTextFormatter/unified/index.js +1 -1
- package/lib/HtmlLongTextFormatter/vfile/core.js +10 -10
- package/lib/ImageFormatter/images-lazy-load.js +71 -79
- package/lib/ImageFormatter/index.js +86 -97
- package/lib/ImageFormatter/utils.js +1 -1
- package/lib/ImagePreviewerLightbox/index.js +20 -18
- package/lib/ImagePreviewerLightbox/utils.js +3 -3
- package/lib/LastModifierFormatter/index.js +24 -40
- package/lib/LinkEditor/index.js +163 -167
- package/lib/LinkEditor/link-editor-option.js +41 -56
- package/lib/LinkEditor/mb-link-editor-popover/index.js +90 -99
- package/lib/LinkEditor/pc-link-editor-popover/index.js +63 -71
- package/lib/LinkFormatter/index.js +75 -77
- package/lib/LongTextFormatter/index.js +5 -3
- package/lib/MBEditorHeader/index.js +25 -38
- package/lib/MTimeFormatter/index.js +17 -32
- package/lib/ModalPortal/index.js +15 -32
- package/lib/MultipleSelectEditor/index.js +118 -136
- package/lib/MultipleSelectFormatter/index.js +24 -40
- package/lib/NotificationPopover/index.js +68 -95
- package/lib/NumberEditor/index.js +75 -82
- package/lib/NumberFormatter/index.js +15 -28
- package/lib/RateFormatter/index.js +29 -45
- package/lib/RoleStatusEditor/index.js +20 -22
- package/lib/RowExpandEmailFormatter/index.js +24 -37
- package/lib/RowExpandFileFormatter/index.js +28 -42
- package/lib/RowExpandFileFormatter/row-expand-file-item-formatter.js +66 -82
- package/lib/RowExpandFormatter/index.js +92 -96
- package/lib/RowExpandFormulaFormatter/index.js +85 -91
- package/lib/RowExpandImageFormatter/index.js +65 -82
- package/lib/RowExpandImageFormatter/row-expand-image-item-formatter.js +71 -84
- package/lib/RowExpandImageFormatter/utils.js +1 -1
- package/lib/RowExpandLinkFormatter/collaborator-item-formatter.js +54 -68
- package/lib/RowExpandLinkFormatter/index.js +131 -137
- package/lib/RowExpandLinkFormatter/utils.js +23 -17
- package/lib/RowExpandLinkFormatter/value-display-utils.js +9 -7
- package/lib/RowExpandRateFormatter/index.js +27 -42
- package/lib/RowExpandUrlFormatter/index.js +27 -40
- package/lib/SelectItem/index.js +17 -33
- package/lib/SelectOptionGroup/index.css +103 -0
- package/lib/SelectOptionGroup/index.js +157 -135
- package/lib/SelectOptionGroup/option.js +31 -38
- package/lib/SimpleLongTextFormatter/index.js +55 -67
- package/lib/SimpleLongTextFormatter/normalize-long-text-value.js +23 -22
- package/lib/SimpleLongTextFormatter/widgets/LongTextPreview.js +42 -57
- package/lib/SimpleLongTextFormatter/widgets/dtable-markdown-viewer.js +31 -46
- package/lib/SingleSelectEditor/index.js +108 -119
- package/lib/SingleSelectFormatter/index.js +21 -37
- package/lib/TextEditor/index.js +45 -51
- package/lib/TextFormatter/index.js +17 -32
- package/lib/UrlFormatter/index.js +11 -24
- package/lib/cellFormatterFactory/index.js +8 -17
- package/lib/common/ClickOutside.js +28 -0
- package/lib/common/delete-tip.js +40 -65
- package/lib/common/modal-portal.js +15 -33
- package/lib/constants/index.js +5 -5
- package/lib/data/dtable-value.js +4 -4
- package/lib/formatterConfig/base-formatter-config.js +24 -3
- package/lib/formatterConfig/index.js +5 -4
- package/lib/lang/index.js +6 -6
- package/lib/locals/de.js +1 -1
- package/lib/locals/en.js +1 -1
- package/lib/locals/fr.js +1 -1
- package/lib/locals/zh-CN.js +1 -1
- package/lib/select-editor/mb-select-editor-popover/index.js +126 -137
- package/lib/select-editor/pc-select-editor-popover/index.js +75 -83
- package/lib/select-editor/select-editor-option.js +41 -56
- package/lib/toaster/alert.js +73 -88
- package/lib/toaster/index.js +1 -1
- package/lib/toaster/toast.js +75 -102
- package/lib/toaster/toastManager.js +55 -91
- package/lib/toaster/toaster.js +58 -57
- package/lib/utils/editor-utils.js +17 -19
- package/lib/utils/utils.js +14 -14
- package/package.json +4 -4
|
@@ -1,63 +1,56 @@
|
|
|
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
1
|
import React, { Component } from 'react';
|
|
6
2
|
import { isValidEmail } from 'dtable-utils';
|
|
7
3
|
import CollaboratorItem from '../CollaboratorItem';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var cellValue = props.cellValue;
|
|
4
|
+
export default class CollaboratorItemFormatter extends Component {
|
|
5
|
+
constructor(_props) {
|
|
6
|
+
super(_props);
|
|
7
|
+
this.calculateCollaboratorData = props => {
|
|
8
|
+
const {
|
|
9
|
+
context,
|
|
10
|
+
collaborators
|
|
11
|
+
} = this.props;
|
|
12
|
+
const {
|
|
13
|
+
cellValue
|
|
14
|
+
} = props;
|
|
20
15
|
if (!cellValue) {
|
|
21
|
-
|
|
16
|
+
this.setState({
|
|
22
17
|
isDataLoaded: true,
|
|
23
18
|
collaborator: null
|
|
24
19
|
});
|
|
25
20
|
return;
|
|
26
21
|
}
|
|
27
|
-
|
|
22
|
+
this.setState({
|
|
28
23
|
isDataLoaded: false,
|
|
29
24
|
collaborator: null
|
|
30
25
|
});
|
|
31
|
-
|
|
32
|
-
return c.name === cellValue;
|
|
33
|
-
});
|
|
26
|
+
let collaborator = collaborators && collaborators.find(c => c.name === cellValue);
|
|
34
27
|
if (collaborator) {
|
|
35
|
-
|
|
28
|
+
this.setState({
|
|
36
29
|
isDataLoaded: true,
|
|
37
|
-
collaborator
|
|
30
|
+
collaborator
|
|
38
31
|
});
|
|
39
32
|
return;
|
|
40
33
|
}
|
|
41
34
|
if (!context) return;
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
const mediaUrl = context.getSetting('mediaUrl');
|
|
36
|
+
const defaultAvatarUrl = "".concat(mediaUrl, "/avatars/default.png");
|
|
44
37
|
if (cellValue === 'anonymous') {
|
|
45
38
|
collaborator = {
|
|
46
39
|
name: 'anonymous',
|
|
47
40
|
avatar_url: defaultAvatarUrl
|
|
48
41
|
};
|
|
49
|
-
|
|
42
|
+
this.setState({
|
|
50
43
|
isDataLoaded: true,
|
|
51
|
-
collaborator
|
|
44
|
+
collaborator
|
|
52
45
|
});
|
|
53
46
|
return;
|
|
54
47
|
}
|
|
55
|
-
|
|
48
|
+
let collaboratorsCache = context.getSetting('collaboratorsCache');
|
|
56
49
|
collaborator = collaboratorsCache[cellValue];
|
|
57
50
|
if (collaborator) {
|
|
58
|
-
|
|
51
|
+
this.setState({
|
|
59
52
|
isDataLoaded: true,
|
|
60
|
-
collaborator
|
|
53
|
+
collaborator
|
|
61
54
|
});
|
|
62
55
|
return;
|
|
63
56
|
}
|
|
@@ -67,63 +60,56 @@ var CollaboratorItemFormatter = /*#__PURE__*/function (_Component) {
|
|
|
67
60
|
avatar_url: defaultAvatarUrl
|
|
68
61
|
};
|
|
69
62
|
collaboratorsCache[cellValue] = collaborator;
|
|
70
|
-
|
|
63
|
+
this.setState({
|
|
71
64
|
isDataLoaded: true,
|
|
72
|
-
collaborator
|
|
65
|
+
collaborator
|
|
73
66
|
});
|
|
74
67
|
return;
|
|
75
68
|
}
|
|
76
|
-
|
|
69
|
+
this.props.context.getUserCommonInfo(cellValue).then(res => {
|
|
77
70
|
collaborator = res.data;
|
|
78
71
|
collaboratorsCache[cellValue] = collaborator;
|
|
79
|
-
|
|
72
|
+
this.setState({
|
|
80
73
|
isDataLoaded: true,
|
|
81
|
-
collaborator
|
|
74
|
+
collaborator
|
|
82
75
|
});
|
|
83
|
-
}).catch(
|
|
76
|
+
}).catch(() => {
|
|
84
77
|
collaborator = {
|
|
85
78
|
name: cellValue,
|
|
86
79
|
avatar_url: defaultAvatarUrl
|
|
87
80
|
};
|
|
88
81
|
collaboratorsCache[cellValue] = collaborator;
|
|
89
|
-
|
|
82
|
+
this.setState({
|
|
90
83
|
isDataLoaded: true,
|
|
91
|
-
collaborator
|
|
84
|
+
collaborator
|
|
92
85
|
});
|
|
93
86
|
});
|
|
94
87
|
};
|
|
95
|
-
|
|
88
|
+
this.state = {
|
|
96
89
|
isDataLoaded: false,
|
|
97
90
|
collaborator: null
|
|
98
91
|
};
|
|
99
|
-
return _this;
|
|
100
92
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
isDataLoaded = _this$state.isDataLoaded;
|
|
118
|
-
if (!isDataLoaded || !cellValue || !collaborator) {
|
|
119
|
-
return this.props.renderEmpty();
|
|
120
|
-
}
|
|
121
|
-
return /*#__PURE__*/React.createElement(CollaboratorItem, {
|
|
122
|
-
collaborator: collaborator,
|
|
123
|
-
enableDeleteCollaborator: false
|
|
124
|
-
});
|
|
93
|
+
componentDidMount() {
|
|
94
|
+
this.calculateCollaboratorData(this.props);
|
|
95
|
+
}
|
|
96
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
97
|
+
this.calculateCollaboratorData(nextProps);
|
|
98
|
+
}
|
|
99
|
+
render() {
|
|
100
|
+
const {
|
|
101
|
+
cellValue
|
|
102
|
+
} = this.props;
|
|
103
|
+
const {
|
|
104
|
+
collaborator,
|
|
105
|
+
isDataLoaded
|
|
106
|
+
} = this.state;
|
|
107
|
+
if (!isDataLoaded || !cellValue || !collaborator) {
|
|
108
|
+
return this.props.renderEmpty();
|
|
125
109
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
110
|
+
return /*#__PURE__*/React.createElement(CollaboratorItem, {
|
|
111
|
+
collaborator: collaborator,
|
|
112
|
+
enableDeleteCollaborator: false
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
-
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
-
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
5
|
-
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
6
1
|
import React, { Component } from 'react';
|
|
7
2
|
import { CellType } from '../constants';
|
|
8
3
|
import { MultipleSelectFormatter, DateFormatter, CTimeFormatter, MTimeFormatter } from '../index';
|
|
@@ -10,139 +5,138 @@ import CollaboratorItemFormatter from './collaborator-item-formatter';
|
|
|
10
5
|
import { getFormulaArrayValue, isArrayFormatColumn } from './utils';
|
|
11
6
|
import { getCellDisplayValue } from './value-display-utils';
|
|
12
7
|
import './index.css';
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
{
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (!value) return null;
|
|
55
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
56
|
-
key: "link-".concat(displayColumnType, "-").concat(index),
|
|
57
|
-
className: "row-expand-link-item"
|
|
58
|
-
}, value);
|
|
59
|
-
}));
|
|
60
|
-
}
|
|
61
|
-
case CellType.DATE:
|
|
62
|
-
{
|
|
63
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
64
|
-
className: containerClassName
|
|
65
|
-
}, cellValue.map(function (value, index) {
|
|
66
|
-
if (!value || typeof value !== 'string') return null;
|
|
67
|
-
var _ref2 = displayColumnData || {},
|
|
68
|
-
format = _ref2.format;
|
|
69
|
-
return /*#__PURE__*/React.createElement(DateFormatter, {
|
|
70
|
-
key: "link-".concat(displayColumnType, "-").concat(index),
|
|
71
|
-
value: value,
|
|
72
|
-
format: format,
|
|
73
|
-
containerClassName: "row-expand-link-item"
|
|
74
|
-
});
|
|
75
|
-
}));
|
|
76
|
-
}
|
|
77
|
-
case CellType.CTIME:
|
|
78
|
-
{
|
|
79
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
80
|
-
className: containerClassName
|
|
81
|
-
}, cellValue.map(function (value, index) {
|
|
82
|
-
if (!value) return null;
|
|
83
|
-
return /*#__PURE__*/React.createElement(CTimeFormatter, {
|
|
84
|
-
key: "link-".concat(displayColumnType, "-").concat(index),
|
|
85
|
-
value: value,
|
|
86
|
-
containerClassName: "row-expand-link-item"
|
|
87
|
-
});
|
|
88
|
-
}));
|
|
89
|
-
}
|
|
90
|
-
case CellType.MTIME:
|
|
91
|
-
{
|
|
92
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
93
|
-
className: containerClassName
|
|
94
|
-
}, cellValue.map(function (value, index) {
|
|
95
|
-
if (!value) return null;
|
|
96
|
-
return /*#__PURE__*/React.createElement(MTimeFormatter, {
|
|
97
|
-
key: "link-".concat(displayColumnType, "-").concat(index),
|
|
98
|
-
value: value,
|
|
99
|
-
containerClassName: "row-expand-link-item"
|
|
100
|
-
});
|
|
101
|
-
}));
|
|
102
|
-
}
|
|
103
|
-
case CellType.CREATOR:
|
|
104
|
-
case CellType.LAST_MODIFIER:
|
|
105
|
-
{
|
|
8
|
+
export default class RowExpandLinkFormatter extends Component {
|
|
9
|
+
render() {
|
|
10
|
+
const props = this.props;
|
|
11
|
+
const {
|
|
12
|
+
column,
|
|
13
|
+
value,
|
|
14
|
+
containerClassName,
|
|
15
|
+
collaborators
|
|
16
|
+
} = props;
|
|
17
|
+
const {
|
|
18
|
+
data
|
|
19
|
+
} = column;
|
|
20
|
+
if (!Array.isArray(value) || value.length === 0) {
|
|
21
|
+
return props.renderEmpty();
|
|
22
|
+
}
|
|
23
|
+
let {
|
|
24
|
+
display_column: displayColumn
|
|
25
|
+
} = data || {};
|
|
26
|
+
if (!displayColumn) {
|
|
27
|
+
return props.renderEmpty();
|
|
28
|
+
}
|
|
29
|
+
const {
|
|
30
|
+
type: displayColumnType,
|
|
31
|
+
data: displayColumnData
|
|
32
|
+
} = displayColumn;
|
|
33
|
+
const cellValue = getFormulaArrayValue(value, !isArrayFormatColumn(displayColumnType));
|
|
34
|
+
if (!Array.isArray(cellValue) || cellValue.length === 0) {
|
|
35
|
+
return props.renderEmpty();
|
|
36
|
+
}
|
|
37
|
+
switch (displayColumnType) {
|
|
38
|
+
case CellType.TEXT:
|
|
39
|
+
case CellType.AUTO_NUMBER:
|
|
40
|
+
case CellType.EMAIL:
|
|
41
|
+
case CellType.URL:
|
|
42
|
+
case CellType.DURATION:
|
|
43
|
+
case CellType.NUMBER:
|
|
44
|
+
{
|
|
45
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
46
|
+
className: containerClassName
|
|
47
|
+
}, cellValue.map((value, index) => {
|
|
48
|
+
if (!value) return null;
|
|
106
49
|
return /*#__PURE__*/React.createElement("div", {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
value:
|
|
124
|
-
|
|
50
|
+
key: "link-".concat(displayColumnType, "-").concat(index),
|
|
51
|
+
className: "row-expand-link-item"
|
|
52
|
+
}, value);
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
case CellType.DATE:
|
|
56
|
+
{
|
|
57
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
58
|
+
className: containerClassName
|
|
59
|
+
}, cellValue.map((value, index) => {
|
|
60
|
+
if (!value || typeof value !== 'string') return null;
|
|
61
|
+
const {
|
|
62
|
+
format
|
|
63
|
+
} = displayColumnData || {};
|
|
64
|
+
return /*#__PURE__*/React.createElement(DateFormatter, {
|
|
65
|
+
key: "link-".concat(displayColumnType, "-").concat(index),
|
|
66
|
+
value: value,
|
|
67
|
+
format: format,
|
|
68
|
+
containerClassName: "row-expand-link-item"
|
|
69
|
+
});
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
case CellType.CTIME:
|
|
73
|
+
{
|
|
74
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
75
|
+
className: containerClassName
|
|
76
|
+
}, cellValue.map((value, index) => {
|
|
77
|
+
if (!value) return null;
|
|
78
|
+
return /*#__PURE__*/React.createElement(CTimeFormatter, {
|
|
79
|
+
key: "link-".concat(displayColumnType, "-").concat(index),
|
|
80
|
+
value: value,
|
|
81
|
+
containerClassName: "row-expand-link-item"
|
|
125
82
|
});
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
|
|
83
|
+
}));
|
|
84
|
+
}
|
|
85
|
+
case CellType.MTIME:
|
|
86
|
+
{
|
|
87
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
88
|
+
className: containerClassName
|
|
89
|
+
}, cellValue.map((value, index) => {
|
|
90
|
+
if (!value) return null;
|
|
91
|
+
return /*#__PURE__*/React.createElement(MTimeFormatter, {
|
|
92
|
+
key: "link-".concat(displayColumnType, "-").concat(index),
|
|
93
|
+
value: value,
|
|
94
|
+
containerClassName: "row-expand-link-item"
|
|
95
|
+
});
|
|
96
|
+
}));
|
|
97
|
+
}
|
|
98
|
+
case CellType.CREATOR:
|
|
99
|
+
case CellType.LAST_MODIFIER:
|
|
100
|
+
{
|
|
101
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
102
|
+
className: "dtable-ui cell-formatter-container collaborator-formatter sql-query-collaborator-formatter"
|
|
103
|
+
}, cellValue.map((value, index) => {
|
|
104
|
+
if (!value) return null;
|
|
105
|
+
return /*#__PURE__*/React.createElement(CollaboratorItemFormatter, {
|
|
106
|
+
key: "link-".concat(displayColumnType, "-").concat(index),
|
|
107
|
+
cellValue: value,
|
|
108
|
+
collaborators: collaborators,
|
|
109
|
+
context: props.context,
|
|
110
|
+
renderEmpty: props.renderEmpty
|
|
111
|
+
});
|
|
112
|
+
}));
|
|
113
|
+
}
|
|
114
|
+
case CellType.SINGLE_SELECT:
|
|
115
|
+
{
|
|
116
|
+
const options = displayColumnData && Array.isArray(displayColumnData.options) ? displayColumnData.options : [];
|
|
117
|
+
return /*#__PURE__*/React.createElement(MultipleSelectFormatter, {
|
|
118
|
+
value: cellValue,
|
|
119
|
+
options: options || []
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
case CellType.FORMULA:
|
|
123
|
+
{
|
|
124
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
125
|
+
className: containerClassName
|
|
126
|
+
}, cellValue.map((value, index) => {
|
|
127
|
+
if (!value) return null;
|
|
129
128
|
return /*#__PURE__*/React.createElement("div", {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
return props.renderEmpty();
|
|
142
|
-
}
|
|
143
|
-
}
|
|
129
|
+
key: "link-".concat(displayColumnType, "-").concat(index),
|
|
130
|
+
className: "row-expand-link-item"
|
|
131
|
+
}, getCellDisplayValue({
|
|
132
|
+
[displayColumn.key]: value
|
|
133
|
+
}, displayColumn, collaborators));
|
|
134
|
+
}));
|
|
135
|
+
}
|
|
136
|
+
default:
|
|
137
|
+
{
|
|
138
|
+
return props.renderEmpty();
|
|
139
|
+
}
|
|
144
140
|
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
}(Component);
|
|
148
|
-
export { RowExpandLinkFormatter as default };
|
|
141
|
+
}
|
|
142
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CellType } from '../constants';
|
|
2
|
-
export
|
|
2
|
+
export const isValidCellValue = value => {
|
|
3
3
|
if (value === undefined) return false;
|
|
4
4
|
if (value === null) return false;
|
|
5
5
|
if (value === '') return false;
|
|
@@ -7,43 +7,49 @@ export var isValidCellValue = function isValidCellValue(value) {
|
|
|
7
7
|
if (JSON.stringify(value) === '[]') return false;
|
|
8
8
|
return true;
|
|
9
9
|
};
|
|
10
|
-
export
|
|
11
|
-
|
|
10
|
+
export const getFormulaArrayValue = function (value) {
|
|
11
|
+
let isFlat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
12
12
|
if (!Array.isArray(value)) return [];
|
|
13
13
|
if (!isFlat) return getTwoDimensionArrayValue(value);
|
|
14
|
-
return value.map(
|
|
14
|
+
return value.map(item => {
|
|
15
15
|
if (Object.prototype.toString.call(item) !== '[object Object]') {
|
|
16
16
|
return item;
|
|
17
17
|
}
|
|
18
18
|
if (!Object.prototype.hasOwnProperty.call(item, 'display_value')) return item;
|
|
19
|
-
|
|
19
|
+
const {
|
|
20
|
+
display_value
|
|
21
|
+
} = item;
|
|
20
22
|
if (!Array.isArray(display_value) || display_value.length === 0) return display_value;
|
|
21
|
-
return display_value.map(
|
|
23
|
+
return display_value.map(i => {
|
|
22
24
|
if (Object.prototype.toString.call(i) === '[object Object]') {
|
|
23
25
|
if (!Object.prototype.hasOwnProperty.call(i, 'display_value')) return i;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
const {
|
|
27
|
+
display_value
|
|
28
|
+
} = i;
|
|
29
|
+
return display_value;
|
|
26
30
|
}
|
|
27
31
|
return i;
|
|
28
32
|
});
|
|
29
|
-
}).flat().filter(
|
|
30
|
-
return isValidCellValue(item);
|
|
31
|
-
});
|
|
33
|
+
}).flat().filter(item => isValidCellValue(item));
|
|
32
34
|
};
|
|
33
|
-
export
|
|
35
|
+
export const getTwoDimensionArrayValue = value => {
|
|
34
36
|
if (!Array.isArray(value)) return [];
|
|
35
|
-
return value.map(
|
|
37
|
+
return value.map(item => {
|
|
36
38
|
if (Object.prototype.toString.call(item) !== '[object Object]') {
|
|
37
39
|
return item;
|
|
38
40
|
}
|
|
39
41
|
if (!Object.prototype.hasOwnProperty.call(item, 'display_value')) return item;
|
|
40
|
-
|
|
42
|
+
const {
|
|
43
|
+
display_value
|
|
44
|
+
} = item;
|
|
41
45
|
if (!Array.isArray(display_value) || display_value.length === 0) return display_value;
|
|
42
|
-
return display_value.map(
|
|
46
|
+
return display_value.map(i => {
|
|
43
47
|
if (Object.prototype.toString.call(i) === '[object Object]') {
|
|
44
48
|
if (!Object.prototype.hasOwnProperty.call(i, 'display_value')) return i;
|
|
45
|
-
|
|
46
|
-
|
|
49
|
+
const {
|
|
50
|
+
display_value
|
|
51
|
+
} = i;
|
|
52
|
+
return display_value;
|
|
47
53
|
}
|
|
48
54
|
return i;
|
|
49
55
|
});
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { CellType, getCellValueDisplayString } from 'dtable-utils';
|
|
2
|
-
|
|
3
|
-
export
|
|
2
|
+
const DOWNLOAD_NAME_COLUMN_TYPES = [CellType.TEXT, CellType.NUMBER, CellType.DATE, CellType.COLLABORATOR, CellType.CREATOR, CellType.AUTO_NUMBER];
|
|
3
|
+
export const getCellDisplayValue = (record, column, collaborators) => {
|
|
4
4
|
if (!column || !DOWNLOAD_NAME_COLUMN_TYPES.includes(column.type)) return '';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const {
|
|
6
|
+
key,
|
|
7
|
+
type,
|
|
8
|
+
data
|
|
9
|
+
} = column;
|
|
8
10
|
return getCellValueDisplayString(record, type, key, {
|
|
9
|
-
data
|
|
10
|
-
collaborators
|
|
11
|
+
data,
|
|
12
|
+
collaborators,
|
|
11
13
|
geolocationHyphen: ' '
|
|
12
14
|
});
|
|
13
15
|
};
|
|
@@ -1,34 +1,22 @@
|
|
|
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
1
|
import React from 'react';
|
|
6
2
|
import classnames from 'classnames';
|
|
7
3
|
import './index.css';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
rate_max_number = _ref$rate_max_number === void 0 ? 5 : _ref$rate_max_number,
|
|
25
|
-
_ref$rate_style_color = _ref.rate_style_color,
|
|
26
|
-
rate_style_color = _ref$rate_style_color === void 0 ? '#e5e5e5' : _ref$rate_style_color,
|
|
27
|
-
_ref$rate_style_type = _ref.rate_style_type,
|
|
28
|
-
rate_style_type = _ref$rate_style_type === void 0 ? 'dtable-icon-rate' : _ref$rate_style_type;
|
|
29
|
-
var rateList = [];
|
|
30
|
-
for (var i = 0; i < rate_max_number; i++) {
|
|
31
|
-
var style = {
|
|
4
|
+
class RateExpendRateFormatter extends React.Component {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
this.getRateList = () => {
|
|
8
|
+
const {
|
|
9
|
+
data,
|
|
10
|
+
value
|
|
11
|
+
} = this.props;
|
|
12
|
+
const {
|
|
13
|
+
rate_max_number = 5,
|
|
14
|
+
rate_style_color = '#e5e5e5',
|
|
15
|
+
rate_style_type = 'dtable-icon-rate'
|
|
16
|
+
} = data || {};
|
|
17
|
+
let rateList = [];
|
|
18
|
+
for (let i = 0; i < rate_max_number; i++) {
|
|
19
|
+
let style = {
|
|
32
20
|
color: value >= i + 1 ? rate_style_color : '#e5e5e5'
|
|
33
21
|
};
|
|
34
22
|
rateList.push( /*#__PURE__*/React.createElement("i", {
|
|
@@ -39,21 +27,18 @@ var RateExpendRateFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
39
27
|
}
|
|
40
28
|
return rateList;
|
|
41
29
|
};
|
|
42
|
-
return _this;
|
|
43
30
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return RateExpendRateFormatter;
|
|
56
|
-
}(React.Component);
|
|
31
|
+
render() {
|
|
32
|
+
const {
|
|
33
|
+
containerClassName
|
|
34
|
+
} = this.props;
|
|
35
|
+
const className = classnames('dtable-ui cell-formatter-container rate-formatter', containerClassName);
|
|
36
|
+
const rateList = this.getRateList();
|
|
37
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
38
|
+
className: className
|
|
39
|
+
}, rateList);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
57
42
|
RateExpendRateFormatter.defaultProps = {
|
|
58
43
|
value: '',
|
|
59
44
|
containerClassName: ''
|