int field: support big int in frontend

This commit is contained in:
Yuri Kuznetsov
2024-08-30 15:40:35 +03:00
parent e1c2203750
commit d7a29fdc71
3 changed files with 56 additions and 2 deletions
@@ -11,11 +11,13 @@
},
{
"name": "min",
"type": "int"
"type": "int",
"view": "views/admin/field-manager/fields/int/max"
},
{
"name": "max",
"type": "int"
"type": "int",
"view": "views/admin/field-manager/fields/int/max"
},
{
"name": "disableFormatting",
@@ -0,0 +1,44 @@
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2024 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
import IntFieldView from 'views/fields/int';
export default class extends IntFieldView {
setupAutoNumericOptions() {
super.setupAutoNumericOptions();
if (this.params.max == null) {
this.autoNumericOptions.maximumValue = '9223372036854775807';
}
if (this.params.min == null) {
this.autoNumericOptions.minimumValue = '-9223372036854775808';
}
}
}
+8
View File
@@ -147,6 +147,14 @@ class IntFieldView extends BaseFieldView {
selectOnFocus: false,
formulaMode: true,
};
if (this.params.max != null && this.params.max > Math.pow(10, 6)) {
this.autoNumericOptions.maximumValue = this.params.max.toString();
}
if (this.params.min != null && this.params.min < - Math.pow(10, 6)) {
this.autoNumericOptions.minimumValue = this.params.min.toString();
}
}
afterRender() {