dtable-ui-component 0.3.21 → 0.3.22-beta.2
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.
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
@import url('../css/cell-formatter.css');
|
|
2
|
+
|
|
3
|
+
.department-single-select-formatter {
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
height: 20px;
|
|
7
|
+
width: fit-content !important;
|
|
8
|
+
padding: 0 8px 0 2px;
|
|
9
|
+
font-size: 13px;
|
|
10
|
+
border-radius: 10px;
|
|
11
|
+
background: #eaeaea;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.department-single-select-formatter .department-avatar-container {
|
|
15
|
+
width: 18px;
|
|
16
|
+
height: 18px;
|
|
17
|
+
background: #ff8000;
|
|
18
|
+
border-radius: 50%;
|
|
19
|
+
padding: 2px 2px 3px 2px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.department-single-select-formatter .department-avatar-container span {
|
|
23
|
+
font-size: 12px;
|
|
24
|
+
color: #fff;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.department-single-select-formatter .department-name {
|
|
28
|
+
margin-left: 4px;
|
|
29
|
+
flex: 1 1;
|
|
30
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import './index.css';
|
|
4
|
+
function DepartmentSingleSelectFormatter(props) {
|
|
5
|
+
var value = props.value,
|
|
6
|
+
departments = props.departments,
|
|
7
|
+
containerClassName = props.containerClassName,
|
|
8
|
+
tip = props.tip;
|
|
9
|
+
if (!value) return null;
|
|
10
|
+
var deletedTip = tip || 'Deleted department';
|
|
11
|
+
var department = departments.find(function (department) {
|
|
12
|
+
return department.id === value;
|
|
13
|
+
});
|
|
14
|
+
var name = department ? department.name : deletedTip;
|
|
15
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
16
|
+
className: classnames('dtable-ui cell-formatter-container department-single-select-formatter text-truncate', containerClassName)
|
|
17
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
18
|
+
className: "department-avatar-container d-flex align-items-center justify-content-center"
|
|
19
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
20
|
+
className: "dtable-font dtable-icon-department-single-selection"
|
|
21
|
+
})), /*#__PURE__*/React.createElement("span", {
|
|
22
|
+
className: "department-name text-truncate"
|
|
23
|
+
}, name));
|
|
24
|
+
}
|
|
25
|
+
export default DepartmentSingleSelectFormatter;
|
|
@@ -6,7 +6,7 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
|
6
6
|
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import classnames from 'classnames';
|
|
9
|
-
import { TextFormatter, NumberFormatter, CheckboxFormatter, DateFormatter, SingleSelectFormatter, MultipleSelectFormatter, CollaboratorFormatter, LongTextFormatter, GeolocationFormatter, CTimeFormatter, CreatorFormatter, LastModifierFormatter, MTimeFormatter, AutoNumberFormatter, DurationFormatter, ButtonFormatter, RowExpandUrlFormatter, RowExpandEmailFormatter, RowExpandRateFormatter, RowExpandImageFormatter, RowExpandFileFormatter, RowExpandLinkFormatter, RowExpandFormulaFormatter, DigitalSignFormatter } from '../index';
|
|
9
|
+
import { TextFormatter, NumberFormatter, CheckboxFormatter, DateFormatter, SingleSelectFormatter, MultipleSelectFormatter, CollaboratorFormatter, LongTextFormatter, GeolocationFormatter, CTimeFormatter, CreatorFormatter, LastModifierFormatter, MTimeFormatter, AutoNumberFormatter, DurationFormatter, ButtonFormatter, RowExpandUrlFormatter, RowExpandEmailFormatter, RowExpandRateFormatter, RowExpandImageFormatter, RowExpandFileFormatter, RowExpandLinkFormatter, RowExpandFormulaFormatter, DigitalSignFormatter, DepartmentSingleSelectFormatter } from '../index';
|
|
10
10
|
import { CellType } from '../constants';
|
|
11
11
|
import './index.css';
|
|
12
12
|
var EditorFormatter = /*#__PURE__*/function (_React$Component) {
|
|
@@ -326,6 +326,13 @@ var EditorFormatter = /*#__PURE__*/function (_React$Component) {
|
|
|
326
326
|
config: _this.props.config
|
|
327
327
|
});
|
|
328
328
|
}
|
|
329
|
+
case CellType.DEPARTMENT_SINGLE_SELECT:
|
|
330
|
+
{
|
|
331
|
+
return /*#__PURE__*/React.createElement(DepartmentSingleSelectFormatter, {
|
|
332
|
+
value: cellValue,
|
|
333
|
+
departments: _this.props.departments
|
|
334
|
+
});
|
|
335
|
+
}
|
|
329
336
|
default:
|
|
330
337
|
return null;
|
|
331
338
|
}
|
package/lib/data/dtable-value.js
CHANGED
|
@@ -90,6 +90,7 @@ var DTABLE_VALUE = {
|
|
|
90
90
|
'row_id': 'CU3j3PNyQaetnLWyiizURg',
|
|
91
91
|
'display_value': '第二行'
|
|
92
92
|
}],
|
|
93
|
+
'9zu5': 1,
|
|
93
94
|
'mFuA': {
|
|
94
95
|
'username': 'bing.an@seafile.com',
|
|
95
96
|
'sign_image_url': '/digital-signs/2023-06/bing.an%40seafile.com-1687316234288.png',
|
|
@@ -1259,6 +1260,26 @@ var DTABLE_VALUE = {
|
|
|
1259
1260
|
'props': {},
|
|
1260
1261
|
'_owner': null
|
|
1261
1262
|
}
|
|
1263
|
+
}, {
|
|
1264
|
+
'key': '9zu5',
|
|
1265
|
+
'name': '部门单选',
|
|
1266
|
+
'type': 'department-single-select',
|
|
1267
|
+
'width': 200,
|
|
1268
|
+
'editable': true,
|
|
1269
|
+
'resizable': true,
|
|
1270
|
+
'frozen': false,
|
|
1271
|
+
'editor': {
|
|
1272
|
+
'key': null,
|
|
1273
|
+
'ref': null,
|
|
1274
|
+
'props': {},
|
|
1275
|
+
'_owner': null
|
|
1276
|
+
},
|
|
1277
|
+
'formatter': {
|
|
1278
|
+
'key': null,
|
|
1279
|
+
'ref': null,
|
|
1280
|
+
'props': {},
|
|
1281
|
+
'_owner': null
|
|
1282
|
+
}
|
|
1262
1283
|
}],
|
|
1263
1284
|
'view_structure': {
|
|
1264
1285
|
'folders': [{
|
|
@@ -2688,6 +2709,25 @@ var DTABLE_VALUE = {
|
|
|
2688
2709
|
'header_settings': {}
|
|
2689
2710
|
}]
|
|
2690
2711
|
};
|
|
2712
|
+
var DEPARTMENTS = [{
|
|
2713
|
+
id: 1,
|
|
2714
|
+
id_in_org: 1,
|
|
2715
|
+
name: '海文互知',
|
|
2716
|
+
org_id: -1,
|
|
2717
|
+
parent_id: -1
|
|
2718
|
+
}, {
|
|
2719
|
+
id: 2,
|
|
2720
|
+
id_in_org: 2,
|
|
2721
|
+
name: '产品组',
|
|
2722
|
+
org_id: -1,
|
|
2723
|
+
parent_id: 1
|
|
2724
|
+
}, {
|
|
2725
|
+
id: 3,
|
|
2726
|
+
id_in_org: 3,
|
|
2727
|
+
name: '研发组',
|
|
2728
|
+
org_id: -1,
|
|
2729
|
+
parent_id: 1
|
|
2730
|
+
}];
|
|
2691
2731
|
var COLLABORATORS = [{
|
|
2692
2732
|
'avatar_url': 'https://dev.seatable.cn/image-view/avatars/0/0/916e1e9e7c6184061cb7d96a680292/resized/80/de58ef113a311d390934b06ceafd77cf.png',
|
|
2693
2733
|
'contact_email': '',
|
|
@@ -2722,4 +2762,4 @@ var SIGN_CONFIG = {
|
|
|
2722
2762
|
workspaceID: 3,
|
|
2723
2763
|
dtableUuid: '8327efbf-c9ff-4a14-9010-00e801a7e295'
|
|
2724
2764
|
};
|
|
2725
|
-
export { DTABLE_VALUE, COLLABORATORS, SIGN_CONFIG };
|
|
2765
|
+
export { DTABLE_VALUE, COLLABORATORS, DEPARTMENTS, SIGN_CONFIG };
|
package/lib/index.js
CHANGED
|
@@ -34,6 +34,7 @@ export { default as ImagePreviewerLightbox } from './ImagePreviewerLightbox';
|
|
|
34
34
|
export { default as CollaboratorItem } from './CollaboratorItem';
|
|
35
35
|
export { default as FileItemFormatter } from './FileItemFormatter';
|
|
36
36
|
export { default as DigitalSignFormatter } from './DigitalSignFormatter';
|
|
37
|
+
export { default as DepartmentSingleSelectFormatter } from './DepartmentSingleSelectFormatter';
|
|
37
38
|
export { default as SimpleLongTextFormatter } from './SimpleLongTextFormatter';
|
|
38
39
|
|
|
39
40
|
// row expand formatter
|