Skip to content

Commit 86c43c9

Browse files
authored
Merge pull request #359 from seatable/fix-link-error
add DepartmentSingleSelectFormatter
2 parents 189b118 + 14f3e95 commit 86c43c9

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

src/RowExpandFormatter/formula-formatter/index.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export default class RowExpandFormulaFormatter extends React.Component {
2121
column: PropTypes.object,
2222
containerClassName: PropTypes.string,
2323
collaborators: PropTypes.array,
24+
departments: PropTypes.array,
2425
};
2526

2627
getGridCellClassName = (resultType) => {
@@ -80,13 +81,13 @@ export default class RowExpandFormulaFormatter extends React.Component {
8081
};
8182

8283
renderOtherColumnFormatter = () => {
83-
const { value, column, collaborators } = this.props;
84+
const { value, column, collaborators, departments } = this.props;
8485
const { array_type, array_data } = column.data;
8586
if (!array_type || array_type === CellType.LINK) {
8687
return null;
8788
}
8889
const Formatter = BaseFormatterConfig[array_type];
89-
let formatterProps = this.getFormatterProps(array_type, array_data, collaborators);
90+
let formatterProps = this.getFormatterProps(array_type, array_data, collaborators, departments);
9091

9192
if (isArrayFormatColumn(array_type)) {
9293
formatterProps.value = value;
@@ -146,14 +147,17 @@ export default class RowExpandFormulaFormatter extends React.Component {
146147
}
147148
}
148149

149-
getFormatterProps = (array_type, array_data, collaborators) => {
150+
getFormatterProps = (array_type, array_data, collaborators, departments) => {
150151
switch (array_type) {
151152
case CellType.DURATION: {
152153
const { duration_format } = array_data;
153154
return { format: duration_format };
154155
}
155156
case CellType.NUMBER:
156157
case CellType.RATE:
158+
case CellType.DEPARTMENT_SINGLE_SELECT: {
159+
return { column: { data: array_data }, readOnly: true, departments };
160+
}
157161
case CellType.GEOLOCATION: {
158162
return { data: array_data };
159163
}

src/RowExpandFormatter/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ class RowExpandFormatter extends React.Component {
235235
column={column}
236236
collaborators={collaborators}
237237
containerClassName={containerClassName}
238+
departments={this.props.departments}
238239
/>
239240
);
240241
}

src/formatterConfig/base-formatter-config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import EmailFormatter from '../EmailFormatter';
2121
import DurationFormatter from '../DurationFormatter';
2222
import RateFormatter from '../RateFormatter';
2323
import ButtonFormatter from '../ButtonFormatter';
24+
import DepartmentSingleSelectFormatter from '../DepartmentSingleSelectFormatter';
2425

2526
const BaseFormatterConfig = {
2627
[CellType.DEFAULT]: <TextCellFormatter />,
@@ -45,6 +46,7 @@ const BaseFormatterConfig = {
4546
[CellType.DURATION]: <DurationFormatter />,
4647
[CellType.RATE]: <RateFormatter />,
4748
[CellType.BUTTON]: <ButtonFormatter />,
49+
[CellType.DEPARTMENT_SINGLE_SELECT]: <DepartmentSingleSelectFormatter />,
4850
};
4951

5052
export default BaseFormatterConfig;

0 commit comments

Comments
 (0)