mirror of
https://github.com/strapi/strapi.git
synced 2026-01-08 05:04:10 +00:00
Merge pull request #2664 from derrickmehaffy/enhancement/bigint
Add Big Integer to adminUI
This commit is contained in:
commit
768ad2ffcd
@ -14,7 +14,7 @@ class Manager {
|
||||
|
||||
/**
|
||||
* Retrieve the bootstrap col index, name and type of a field
|
||||
* @param {Number} index
|
||||
* @param {Number} index
|
||||
* @returns {Object}
|
||||
*/
|
||||
getAttrInfos(index) {
|
||||
@ -72,7 +72,7 @@ class Manager {
|
||||
/**
|
||||
* Retrieve a field default bootstrap col
|
||||
* NOTE: will change if we add the customisation of an input's width
|
||||
* @param {String} type
|
||||
* @param {String} type
|
||||
* @returns {Number}
|
||||
*/
|
||||
getBootStrapCol(type) {
|
||||
@ -80,7 +80,7 @@ class Manager {
|
||||
case 'checkbox':
|
||||
case 'boolean':
|
||||
case 'date':
|
||||
case 'bigint':
|
||||
case 'biginteger':
|
||||
case 'decimal':
|
||||
case 'float':
|
||||
case 'integer':
|
||||
@ -109,7 +109,7 @@ class Manager {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Retrieve the last element of each line of a bootstrap grid and push it into an array
|
||||
* @returns {Array}
|
||||
*/
|
||||
@ -138,7 +138,7 @@ class Manager {
|
||||
|
||||
if (i < this.list.size - 1) {
|
||||
let { bootstrapCol: nextBootstrapCol, name: nextName, type: nextType } = this.getAttrInfos(i + 1);
|
||||
|
||||
|
||||
if (!nextType && nextName.includes('__col')) {
|
||||
nextBootstrapCol = parseInt(nextName.split('__')[1].split('-')[2], 10);
|
||||
}
|
||||
@ -155,9 +155,9 @@ class Manager {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Retrieve the field's type depending on its name
|
||||
* @param {String} itemName
|
||||
* @param {String} itemName
|
||||
* @returns {String}
|
||||
*/
|
||||
getType(itemName) {
|
||||
@ -177,8 +177,8 @@ class Manager {
|
||||
|
||||
/**
|
||||
* Retrieve the line bootstrap col sum
|
||||
* @param {Number} leftBound
|
||||
* @param {Number} rightBound
|
||||
* @param {Number} leftBound
|
||||
* @param {Number} rightBound
|
||||
* @returns {Number}
|
||||
*/
|
||||
|
||||
@ -237,7 +237,7 @@ class Manager {
|
||||
if (lineSize < 10 && i < this.arrayOfEndLineElements.length - 1) {
|
||||
const colsToAdd = this.getColsToAdd(12 - lineSize);
|
||||
newList = newList.insert(lastLineItem + sum, colsToAdd[0]);
|
||||
|
||||
|
||||
if (colsToAdd.length > 1) {
|
||||
newList = newList.insert(lastLineItem + sum, colsToAdd[1]);
|
||||
}
|
||||
@ -249,4 +249,4 @@ class Manager {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Manager;
|
||||
module.exports = Manager;
|
||||
|
||||
@ -422,12 +422,12 @@ module.exports = function(strapi) {
|
||||
case 'email':
|
||||
type = 'varchar(255)';
|
||||
break;
|
||||
case 'biginteger':
|
||||
type = definition.client === 'pg' ? 'bigint' : 'bigint(53)';
|
||||
break;
|
||||
case 'integer':
|
||||
type = definition.client === 'pg' ? 'integer' : 'int';
|
||||
break;
|
||||
case 'biginteger':
|
||||
type = definition.client === 'pg' ? 'bigint' : 'bigint(53)';
|
||||
break;
|
||||
case 'float':
|
||||
type = definition.client === 'pg' ? 'double precision' : 'double';
|
||||
break;
|
||||
|
||||
@ -27,7 +27,7 @@ const getInputType = (type = '') => {
|
||||
switch (type.toLowerCase()) {
|
||||
case 'boolean':
|
||||
return 'toggle';
|
||||
case 'bigint':
|
||||
case 'biginteger':
|
||||
case 'decimal':
|
||||
case 'float':
|
||||
case 'integer':
|
||||
|
||||
@ -20,7 +20,7 @@ const getInputType = (attrType) => {
|
||||
case 'datetime':
|
||||
return InputDate;
|
||||
case 'integer':
|
||||
case 'bigint':
|
||||
case 'biginteger':
|
||||
case 'decimal':
|
||||
case 'float':
|
||||
return InputNumber;
|
||||
|
||||
@ -47,6 +47,7 @@ const getFilters = (type) => {
|
||||
},
|
||||
];
|
||||
case 'integer':
|
||||
case 'biginteger':
|
||||
case 'float':
|
||||
case 'decimal':
|
||||
case 'date':
|
||||
|
||||
@ -33,7 +33,7 @@ const getBootstrapClass = attrType => {
|
||||
case 'boolean':
|
||||
case 'toggle':
|
||||
case 'date':
|
||||
case 'bigint':
|
||||
case 'biginteger':
|
||||
case 'decimal':
|
||||
case 'float':
|
||||
case 'integer':
|
||||
|
||||
@ -58,7 +58,7 @@ module.exports = {
|
||||
|
||||
const searchInt = Object.keys(this._attributes)
|
||||
.filter(attribute => attribute !== this.primaryKey && !associations.includes(attribute))
|
||||
.filter(attribute => ['integer', 'decimal', 'float'].includes(this._attributes[attribute].type));
|
||||
.filter(attribute => ['integer','biginteger', 'decimal', 'float'].includes(this._attributes[attribute].type));
|
||||
|
||||
const searchBool = Object.keys(this._attributes)
|
||||
.filter(attribute => attribute !== this.primaryKey && !associations.includes(attribute))
|
||||
@ -129,11 +129,11 @@ module.exports = {
|
||||
|
||||
const searchNoText = Object.keys(this._attributes)
|
||||
.filter(attribute => attribute !== this.primaryKey && !associations.includes(attribute))
|
||||
.filter(attribute => !['string', 'text', 'boolean', 'integer', 'decimal', 'float'].includes(this._attributes[attribute].type));
|
||||
.filter(attribute => !['string', 'text', 'boolean', 'integer', 'biginteger', 'decimal', 'float'].includes(this._attributes[attribute].type));
|
||||
|
||||
const searchInt = Object.keys(this._attributes)
|
||||
.filter(attribute => attribute !== this.primaryKey && !associations.includes(attribute))
|
||||
.filter(attribute => ['integer', 'decimal', 'float'].includes(this._attributes[attribute].type));
|
||||
.filter(attribute => ['integer', 'biginteger', 'decimal', 'float'].includes(this._attributes[attribute].type));
|
||||
|
||||
const searchBool = Object.keys(this._attributes)
|
||||
.filter(attribute => attribute !== this.primaryKey && !associations.includes(attribute))
|
||||
|
||||
@ -22,6 +22,7 @@ module.exports = {
|
||||
const $or = Object.keys(this.attributes).reduce((acc, curr) => {
|
||||
switch (this.attributes[curr].type) {
|
||||
case 'integer':
|
||||
case 'biginteger':
|
||||
case 'float':
|
||||
case 'decimal':
|
||||
if (!_.isNaN(_.toNumber(params.search))) {
|
||||
@ -57,6 +58,7 @@ module.exports = {
|
||||
const $or = Object.keys(this.attributes).reduce((acc, curr) => {
|
||||
switch (this.attributes[curr].type) {
|
||||
case 'integer':
|
||||
case 'biginteger':
|
||||
case 'float':
|
||||
case 'decimal':
|
||||
if (!_.isNaN(_.toNumber(params.search))) {
|
||||
|
||||
@ -42,6 +42,7 @@ class AttributeRow extends React.Component {
|
||||
string: IcoString,
|
||||
text: IcoText,
|
||||
integer: IcoNumber,
|
||||
biginteger: IcoNumber,
|
||||
float: IcoNumber,
|
||||
decimal: IcoNumber,
|
||||
email: IcoEmail,
|
||||
|
||||
@ -259,6 +259,7 @@
|
||||
"value": "integer",
|
||||
"items": [
|
||||
{ "name": "content-type-builder.form.attribute.item.number.type.integer", "value": "integer" },
|
||||
{ "name": "content-type-builder.form.attribute.item.number.type.biginteger", "value": "biginteger" },
|
||||
{ "name": "content-type-builder.form.attribute.item.number.type.float", "value": "float" },
|
||||
{ "name": "content-type-builder.form.attribute.item.number.type.decimal", "value": "decimal" }
|
||||
],
|
||||
|
||||
@ -46,7 +46,7 @@ import styles from './styles.scss';
|
||||
|
||||
// Array of attributes that the ctb can handle at the moment
|
||||
const availableAttributes = Object.keys(forms.attribute);
|
||||
availableAttributes.push('integer', 'decimal', 'float');
|
||||
availableAttributes.push('integer', 'biginteger', 'decimal', 'float');
|
||||
|
||||
/* eslint-disable jsx-a11y/no-static-element-interactions */
|
||||
/* eslint-disable react/jsx-wrap-multilines */
|
||||
@ -169,6 +169,7 @@ export class ModelPage extends React.Component { // eslint-disable-line react/pr
|
||||
|
||||
switch (attribute.params.type) {
|
||||
case 'integer':
|
||||
case 'biginteger':
|
||||
case 'float':
|
||||
case 'decimal':
|
||||
attributeType = 'number';
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
"attribute.enumeration": "Enumeration",
|
||||
"attribute.float": "Float",
|
||||
"attribute.integer": "integer",
|
||||
"attribute.biginteger": "big integer",
|
||||
"attribute.json": "JSON",
|
||||
"attribute.media": "Media",
|
||||
"attribute.password": "Password",
|
||||
@ -54,6 +55,7 @@
|
||||
"form.attribute.item.number.type.decimal": "decimal (ex: 2.22)",
|
||||
"form.attribute.item.number.type.float": "float (ex: 3.33333333)",
|
||||
"form.attribute.item.number.type.integer": "integer (ex: 10)",
|
||||
"form.attribute.item.number.type.biginteger": "big integer (ex: 123456789)",
|
||||
"form.attribute.item.requiredField": "Required field",
|
||||
"form.attribute.item.requiredField.description": "You won't be able to create an entry if this field is empty",
|
||||
"form.attribute.item.settings.name": "Settings",
|
||||
|
||||
@ -88,10 +88,10 @@ class Manager {
|
||||
case 'checkbox':
|
||||
case 'boolean':
|
||||
case 'date':
|
||||
case 'bigint':
|
||||
case 'decimal':
|
||||
case 'float':
|
||||
case 'integer':
|
||||
case 'biginteger':
|
||||
case 'number':
|
||||
return 4;
|
||||
case 'json':
|
||||
@ -250,4 +250,4 @@ class Manager {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Manager;
|
||||
module.exports = Manager;
|
||||
|
||||
@ -1313,6 +1313,7 @@ module.exports = {
|
||||
case 'double':
|
||||
return 'number';
|
||||
case 'integer':
|
||||
case 'biginteger':
|
||||
case 'long':
|
||||
return 'integer';
|
||||
default:
|
||||
|
||||
@ -41,6 +41,7 @@ module.exports = {
|
||||
type = 'Boolean';
|
||||
break;
|
||||
case 'integer':
|
||||
case 'biginteger':
|
||||
type = 'Int';
|
||||
break;
|
||||
case 'decimal':
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user