mirror of
https://github.com/strapi/strapi.git
synced 2025-09-19 21:38:05 +00:00
Prevent all bugs from strings
This commit is contained in:
parent
93b190eada
commit
69ae95726f
@ -7,7 +7,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { isEmpty, isNull, isObject, toString } from 'lodash';
|
import { isEmpty, isNull, isObject, toLower, toString } from 'lodash';
|
||||||
import cn from 'classnames';
|
import cn from 'classnames';
|
||||||
|
|
||||||
import CustomInputCheckbox from 'components/CustomInputCheckbox';
|
import CustomInputCheckbox from 'components/CustomInputCheckbox';
|
||||||
@ -31,21 +31,17 @@ class TableRow extends React.Component {
|
|||||||
* @returns {*}
|
* @returns {*}
|
||||||
*/
|
*/
|
||||||
getDisplayedValue(type, value, name) {
|
getDisplayedValue(type, value, name) {
|
||||||
if (!value) {
|
switch (toLower(type)) {
|
||||||
return '-';
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (type.toLowerCase()) {
|
|
||||||
case 'string':
|
case 'string':
|
||||||
case 'text':
|
case 'text':
|
||||||
case 'email':
|
case 'email':
|
||||||
case 'enumeration':
|
case 'enumeration':
|
||||||
return (value && !isEmpty(value.toString())) || name === 'id' ? value.toString() : '-';
|
return (value && !isEmpty(toString(value))) || name === 'id' ? toString(value) : '-';
|
||||||
case 'float':
|
case 'float':
|
||||||
case 'integer':
|
case 'integer':
|
||||||
case 'biginteger':
|
case 'biginteger':
|
||||||
case 'decimal':
|
case 'decimal':
|
||||||
return !isNull(value) ? value.toString() : '-';
|
return !isNull(value) ? toString(value) : '-';
|
||||||
case 'boolean':
|
case 'boolean':
|
||||||
return value !== null ? toString(value) : '-';
|
return value !== null ? toString(value) : '-';
|
||||||
case 'date':
|
case 'date':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user