mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-13 07:04:21 +08:00
fix: Empty mandatory and read only fields. (#486)
This commit is contained in:
parent
50bac60614
commit
91f0e9805e
@ -45,7 +45,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@adempiere/grpc-access-client": "^1.2.0",
|
"@adempiere/grpc-access-client": "^1.2.0",
|
||||||
"@adempiere/grpc-data-client": "^2.2.9",
|
"@adempiere/grpc-data-client": "^2.3.2",
|
||||||
"@adempiere/grpc-dictionary-client": "^1.4.1",
|
"@adempiere/grpc-dictionary-client": "^1.4.1",
|
||||||
"@adempiere/grpc-enrollment-client": "^1.1.0",
|
"@adempiere/grpc-enrollment-client": "^1.1.0",
|
||||||
"@adempiere/grpc-pos-client": "^1.1.0",
|
"@adempiere/grpc-pos-client": "^1.1.0",
|
||||||
@ -104,7 +104,7 @@
|
|||||||
"eslint": "^6.8.0",
|
"eslint": "^6.8.0",
|
||||||
"eslint-plugin-vue": "6.2.2",
|
"eslint-plugin-vue": "6.2.2",
|
||||||
"html-webpack-plugin": "4.2.1",
|
"html-webpack-plugin": "4.2.1",
|
||||||
"husky": "4.2.5",
|
"husky": "^4.2.5",
|
||||||
"lint-staged": "10.2.0",
|
"lint-staged": "10.2.0",
|
||||||
"mockjs": "1.1.0",
|
"mockjs": "1.1.0",
|
||||||
"node-sass": "^4.14.0",
|
"node-sass": "^4.14.0",
|
||||||
|
@ -16,6 +16,7 @@ const callOutControl = {
|
|||||||
* @param {Object} row, if callout is activate in table
|
* @param {Object} row, if callout is activate in table
|
||||||
* @param {Mixed} value
|
* @param {Mixed} value
|
||||||
* @param {Mixed} oldValue
|
* @param {Mixed} oldValue
|
||||||
|
* @param {String} valueType
|
||||||
* @return {Promise} values
|
* @return {Promise} values
|
||||||
*/
|
*/
|
||||||
getCallout({ rootGetters, dispatch }, {
|
getCallout({ rootGetters, dispatch }, {
|
||||||
@ -40,11 +41,12 @@ const callOutControl = {
|
|||||||
runCallOutRequest({
|
runCallOutRequest({
|
||||||
windowUuid: parentUuid,
|
windowUuid: parentUuid,
|
||||||
tabUuid: containerUuid,
|
tabUuid: containerUuid,
|
||||||
|
callout,
|
||||||
tableName,
|
tableName,
|
||||||
columnName,
|
columnName,
|
||||||
value,
|
value,
|
||||||
oldValue,
|
oldValue,
|
||||||
callout,
|
valueType,
|
||||||
attributesList,
|
attributesList,
|
||||||
windowNo: window.windowIndex
|
windowNo: window.windowIndex
|
||||||
})
|
})
|
||||||
|
@ -249,16 +249,15 @@ const panel = {
|
|||||||
containerUuid,
|
containerUuid,
|
||||||
fieldsList = []
|
fieldsList = []
|
||||||
}) {
|
}) {
|
||||||
if (fieldsList.length <= 0) {
|
if (isEmptyValue(fieldsList)) {
|
||||||
fieldsList = getters.getFieldsListFromPanel(containerUuid)
|
fieldsList = getters.getFieldsListFromPanel(containerUuid)
|
||||||
}
|
}
|
||||||
const fieldsIncludes = fieldsList.filter(fieldItem => {
|
const fieldsIncludes = []
|
||||||
|
fieldsList.array.forEach(fieldItem => {
|
||||||
const isMandatory = fieldItem.isMandatory || fieldItem.isMandatoryFromLogic
|
const isMandatory = fieldItem.isMandatory || fieldItem.isMandatoryFromLogic
|
||||||
if (isMandatory) {
|
if (isMandatory) {
|
||||||
return true
|
fieldsIncludes.push(fieldItem.columnName)
|
||||||
}
|
}
|
||||||
}).map(fieldItem => {
|
|
||||||
return fieldItem.columnName
|
|
||||||
})
|
})
|
||||||
|
|
||||||
dispatch('changeFieldAttributesBoolean', {
|
dispatch('changeFieldAttributesBoolean', {
|
||||||
@ -276,15 +275,16 @@ const panel = {
|
|||||||
containerUuid,
|
containerUuid,
|
||||||
fieldsList = []
|
fieldsList = []
|
||||||
}) {
|
}) {
|
||||||
if (fieldsList.length <= 0) {
|
if (isEmptyValue(fieldsList)) {
|
||||||
fieldsList = getters.getFieldsListFromPanel(containerUuid)
|
fieldsList = getters.getFieldsListFromPanel(containerUuid)
|
||||||
}
|
}
|
||||||
const fieldsIncludes = fieldsList.filter(fieldItem => {
|
const fieldsIncludes = []
|
||||||
|
fieldsList.foreach(fieldItem => {
|
||||||
const isDisplayed = fieldItem.isDisplayed && fieldItem.isDisplayedFromLogic && !fieldItem.isKey
|
const isDisplayed = fieldItem.isDisplayed && fieldItem.isDisplayedFromLogic && !fieldItem.isKey
|
||||||
// Verify for displayed and is active
|
// Verify for displayed and is active
|
||||||
return fieldItem.isActive && isDisplayed
|
if (fieldItem.isActive && isDisplayed) {
|
||||||
}).map(fieldItem => {
|
fieldsIncludes.push(fieldItem.columnName)
|
||||||
return fieldItem.columnName
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
dispatch('changeFieldAttributesBoolean', {
|
dispatch('changeFieldAttributesBoolean', {
|
||||||
@ -311,6 +311,10 @@ const panel = {
|
|||||||
}) {
|
}) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
const panel = getters.getPanel(containerUuid)
|
const panel = getters.getPanel(containerUuid)
|
||||||
|
if (isEmptyValue(panel)) {
|
||||||
|
resolve()
|
||||||
|
return
|
||||||
|
}
|
||||||
const defaultAttributes = getters.getParsedDefaultValues({
|
const defaultAttributes = getters.getParsedDefaultValues({
|
||||||
parentUuid,
|
parentUuid,
|
||||||
containerUuid,
|
containerUuid,
|
||||||
@ -409,7 +413,7 @@ const panel = {
|
|||||||
isChangedAllValues = false
|
isChangedAllValues = false
|
||||||
}) {
|
}) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
if (!fieldList.length) {
|
if (isEmptyValue(fieldList)) {
|
||||||
fieldList = getters.getFieldsListFromPanel(containerUuid, isAdvancedQuery)
|
fieldList = getters.getFieldsListFromPanel(containerUuid, isAdvancedQuery)
|
||||||
}
|
}
|
||||||
let fieldsShowed = []
|
let fieldsShowed = []
|
||||||
@ -682,10 +686,6 @@ const panel = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isSendToServer) {
|
if (isSendToServer) {
|
||||||
const fieldsEmpty = getters.getFieldListEmptyMandatory({
|
|
||||||
containerUuid,
|
|
||||||
fieldsList
|
|
||||||
})
|
|
||||||
if (panelType === 'table' || isAdvancedQuery) {
|
if (panelType === 'table' || isAdvancedQuery) {
|
||||||
if (field.isShowedFromUser && (field.oldValue !== field.value ||
|
if (field.isShowedFromUser && (field.oldValue !== field.value ||
|
||||||
['NULL', 'NOT_NULL'].includes(field.operator) ||
|
['NULL', 'NOT_NULL'].includes(field.operator) ||
|
||||||
@ -735,95 +735,101 @@ const panel = {
|
|||||||
console.warn(`Error getting Advanced Query (notifyFieldChange): ${error.message}. Code: ${error.code}.`)
|
console.warn(`Error getting Advanced Query (notifyFieldChange): ${error.message}. Code: ${error.code}.`)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else if (isEmptyValue(fieldsEmpty)) {
|
} else {
|
||||||
// TODO: refactory for it and change for a standard method
|
const fieldsEmpty = getters.getFieldListEmptyMandatory({
|
||||||
if (field.panelType === 'browser' && fieldIsDisplayed(field)) {
|
containerUuid,
|
||||||
let isReadyForQuery = true
|
fieldsList
|
||||||
if (field.isSQLValue) {
|
})
|
||||||
let awaitForValuesToQuery = panel.awaitForValuesToQuery
|
|
||||||
awaitForValuesToQuery--
|
if (isEmptyValue(fieldsEmpty)) {
|
||||||
dispatch('changeBrowserAttribute', {
|
// TODO: refactory for it and change for a standard method
|
||||||
containerUuid,
|
if (field.panelType === 'browser' && fieldIsDisplayed(field)) {
|
||||||
attributeName: 'awaitForValuesToQuery',
|
let isReadyForQuery = true
|
||||||
attributeValue: awaitForValuesToQuery
|
if (field.isSQLValue) {
|
||||||
})
|
let awaitForValuesToQuery = panel.awaitForValuesToQuery
|
||||||
if (awaitForValuesToQuery === 0) {
|
awaitForValuesToQuery--
|
||||||
if (panel.isShowedCriteria) {
|
dispatch('changeBrowserAttribute', {
|
||||||
dispatch('changeBrowserAttribute', {
|
containerUuid,
|
||||||
containerUuid,
|
attributeName: 'awaitForValuesToQuery',
|
||||||
attributeName: 'isShowedCriteria',
|
attributeValue: awaitForValuesToQuery
|
||||||
attributeValue: false
|
})
|
||||||
})
|
if (awaitForValuesToQuery === 0) {
|
||||||
|
if (panel.isShowedCriteria) {
|
||||||
|
dispatch('changeBrowserAttribute', {
|
||||||
|
containerUuid,
|
||||||
|
attributeName: 'isShowedCriteria',
|
||||||
|
attributeValue: false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else if (awaitForValuesToQuery > 0) {
|
||||||
|
isReadyForQuery = false
|
||||||
}
|
}
|
||||||
} else if (awaitForValuesToQuery > 0) {
|
}
|
||||||
isReadyForQuery = false
|
if (isReadyForQuery && !field.dependentFieldsList.length) {
|
||||||
|
dispatch('getBrowserSearch', {
|
||||||
|
containerUuid,
|
||||||
|
isClearSelection: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else if (field.panelType === 'window' && fieldIsDisplayed(field)) {
|
||||||
|
const uuid = getters.getUuid(containerUuid)
|
||||||
|
if (isEmptyValue(uuid)) {
|
||||||
|
dispatch('createNewEntity', {
|
||||||
|
parentUuid,
|
||||||
|
containerUuid
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
// change old value so that it is not send in the next update
|
||||||
|
commit('changeFieldValue', {
|
||||||
|
field,
|
||||||
|
newValue,
|
||||||
|
valueTo,
|
||||||
|
displayColumn,
|
||||||
|
isChangedOldValue: true
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
showMessage({
|
||||||
|
message: error.message,
|
||||||
|
type: 'error'
|
||||||
|
})
|
||||||
|
console.warn(`Create Entity Error ${error.code}: ${error.message}.`)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
dispatch('updateCurrentEntity', {
|
||||||
|
containerUuid,
|
||||||
|
recordUuid: uuid
|
||||||
|
})
|
||||||
|
.then(response => {
|
||||||
|
// change old value so that it is not send in the next update
|
||||||
|
showMessage({
|
||||||
|
message: language.t('notifications.updateFields') + field.name,
|
||||||
|
type: 'success'
|
||||||
|
})
|
||||||
|
commit('changeFieldValue', {
|
||||||
|
field,
|
||||||
|
newValue,
|
||||||
|
valueTo,
|
||||||
|
displayColumn,
|
||||||
|
isChangedOldValue: true
|
||||||
|
})
|
||||||
|
|
||||||
|
// change value in table
|
||||||
|
dispatch('notifyRowTableChange', {
|
||||||
|
containerUuid,
|
||||||
|
row: response,
|
||||||
|
isEdit: false,
|
||||||
|
isParent: true
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isReadyForQuery && !field.dependentFieldsList.length) {
|
} else {
|
||||||
dispatch('getBrowserSearch', {
|
showMessage({
|
||||||
containerUuid,
|
message: language.t('notifications.mandatoryFieldMissing') + fieldsEmpty,
|
||||||
isClearSelection: true
|
type: 'info'
|
||||||
})
|
})
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (field.panelType === 'window' && fieldIsDisplayed(field)) {
|
|
||||||
const uuid = getters.getUuid(containerUuid)
|
|
||||||
if (isEmptyValue(uuid)) {
|
|
||||||
dispatch('createNewEntity', {
|
|
||||||
parentUuid,
|
|
||||||
containerUuid
|
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
// change old value so that it is not send in the next update
|
|
||||||
commit('changeFieldValue', {
|
|
||||||
field,
|
|
||||||
newValue,
|
|
||||||
valueTo,
|
|
||||||
displayColumn,
|
|
||||||
isChangedOldValue: true
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
showMessage({
|
|
||||||
message: error.message,
|
|
||||||
type: 'error'
|
|
||||||
})
|
|
||||||
console.warn(`Create Entity Error ${error.code}: ${error.message}.`)
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
dispatch('updateCurrentEntity', {
|
|
||||||
containerUuid,
|
|
||||||
recordUuid: uuid
|
|
||||||
})
|
|
||||||
.then(response => {
|
|
||||||
// change old value so that it is not send in the next update
|
|
||||||
showMessage({
|
|
||||||
message: language.t('notifications.updateFields') + field.name,
|
|
||||||
type: 'success'
|
|
||||||
})
|
|
||||||
commit('changeFieldValue', {
|
|
||||||
field,
|
|
||||||
newValue,
|
|
||||||
valueTo,
|
|
||||||
displayColumn,
|
|
||||||
isChangedOldValue: true
|
|
||||||
})
|
|
||||||
|
|
||||||
// change value in table
|
|
||||||
dispatch('notifyRowTableChange', {
|
|
||||||
containerUuid,
|
|
||||||
row: response,
|
|
||||||
isEdit: false,
|
|
||||||
isParent: true
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
showMessage({
|
|
||||||
message: language.t('notifications.mandatoryFieldMissing') + fieldsEmpty,
|
|
||||||
type: 'info'
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -1066,35 +1072,28 @@ const panel = {
|
|||||||
getFieldListEmptyMandatory: (state, getters) => ({
|
getFieldListEmptyMandatory: (state, getters) => ({
|
||||||
containerUuid,
|
containerUuid,
|
||||||
fieldsList = [],
|
fieldsList = [],
|
||||||
isEvaluateShowed = true,
|
|
||||||
row
|
row
|
||||||
}) => {
|
}) => {
|
||||||
if (fieldsList.length <= 0) {
|
if (fieldsList.length <= 0) {
|
||||||
fieldsList = getters.getFieldsListFromPanel(containerUuid)
|
fieldsList = getters.getFieldsListFromPanel(containerUuid)
|
||||||
}
|
}
|
||||||
|
const fieldsEmpty = []
|
||||||
// all optionals (not mandatory) fields
|
// all optionals (not mandatory) fields
|
||||||
fieldsList = fieldsList.filter(fieldItem => {
|
fieldsList.forEach(fieldItem => {
|
||||||
const isMandatory = fieldItem.isMandatory || fieldItem.isMandatoryFromLogic
|
|
||||||
if (isMandatory) {
|
|
||||||
if (isEvaluateShowed) {
|
|
||||||
return fieldIsDisplayed(fieldItem)
|
|
||||||
}
|
|
||||||
return isMandatory
|
|
||||||
}
|
|
||||||
})
|
|
||||||
fieldsList = fieldsList.filter(fieldItem => {
|
|
||||||
let value = fieldItem.value
|
let value = fieldItem.value
|
||||||
// used when evaluate data in table
|
// used when evaluate data in table
|
||||||
if (row) {
|
if (row) {
|
||||||
value = row[fieldItem.columnName]
|
value = row[fieldItem.columnName]
|
||||||
}
|
}
|
||||||
return isEmptyValue(value)
|
if (isEmptyValue(value)) {
|
||||||
|
const isMandatory = fieldItem.isMandatory || fieldItem.isMandatoryFromLogic
|
||||||
|
if (fieldIsDisplayed(fieldItem) && isMandatory) {
|
||||||
|
fieldsEmpty.push(fieldItem.name)
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return fieldsList.map(fieldItem => {
|
return fieldsEmpty
|
||||||
return fieldItem.name
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Show all available fields not mandatory to show, used in components panel/filterFields.vue
|
* Show all available fields not mandatory to show, used in components panel/filterFields.vue
|
||||||
@ -1264,7 +1263,7 @@ const panel = {
|
|||||||
return {
|
return {
|
||||||
columnName: fieldItem.columnName,
|
columnName: fieldItem.columnName,
|
||||||
value: valueToReturn,
|
value: valueToReturn,
|
||||||
isSQL: isSQL
|
isSQL
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return attributesObject
|
return attributesObject
|
||||||
|
@ -101,43 +101,44 @@ export function generateField({
|
|||||||
}
|
}
|
||||||
|
|
||||||
// VALUE TO
|
// VALUE TO
|
||||||
if (String(parsedDefaultValueTo).includes('@') &&
|
if (fieldToGenerate.isRange) {
|
||||||
String(parsedDefaultValueTo).trim() !== '-1') {
|
if (String(parsedDefaultValueTo).includes('@') &&
|
||||||
parsedDefaultValueTo = parseContext({
|
String(parsedDefaultValueTo).trim() !== '-1') {
|
||||||
...moreAttributes,
|
parsedDefaultValueTo = parseContext({
|
||||||
columnName: `${fieldToGenerate.columnName}_To`,
|
...moreAttributes,
|
||||||
value: parsedDefaultValueTo
|
columnName: `${fieldToGenerate.columnName}_To`,
|
||||||
}).value
|
value: parsedDefaultValueTo
|
||||||
}
|
}).value
|
||||||
|
}
|
||||||
|
|
||||||
if (isEmptyValue(parsedDefaultValueTo) &&
|
if (isEmptyValue(parsedDefaultValueTo) &&
|
||||||
!(fieldToGenerate.isKey || fieldToGenerate.isParent) &&
|
!(fieldToGenerate.isKey || fieldToGenerate.isParent) &&
|
||||||
String(parsedDefaultValueTo).trim() !== '-1') {
|
String(parsedDefaultValueTo).trim() !== '-1') {
|
||||||
parsedDefaultValueTo = getPreference({
|
|
||||||
parentUuid: fieldToGenerate.parentUuid,
|
|
||||||
containerUuid: fieldToGenerate.containerUuid,
|
|
||||||
columnName: `${fieldToGenerate.columnName}_To`
|
|
||||||
})
|
|
||||||
|
|
||||||
// search value preference with elementName
|
|
||||||
if (!isEmptyValue(fieldToGenerate.elementName) &&
|
|
||||||
isEmptyValue(parsedDefaultValueTo)) {
|
|
||||||
parsedDefaultValueTo = getPreference({
|
parsedDefaultValueTo = getPreference({
|
||||||
parentUuid: fieldToGenerate.parentUuid,
|
parentUuid: fieldToGenerate.parentUuid,
|
||||||
containerUuid: fieldToGenerate.containerUuid,
|
containerUuid: fieldToGenerate.containerUuid,
|
||||||
columnName: `${fieldToGenerate.elementName}_To`
|
columnName: `${fieldToGenerate.columnName}_To`
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// search value preference with elementName
|
||||||
|
if (!isEmptyValue(fieldToGenerate.elementName) &&
|
||||||
|
isEmptyValue(parsedDefaultValueTo)) {
|
||||||
|
parsedDefaultValueTo = getPreference({
|
||||||
|
parentUuid: fieldToGenerate.parentUuid,
|
||||||
|
containerUuid: fieldToGenerate.containerUuid,
|
||||||
|
columnName: `${fieldToGenerate.elementName}_To`
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
parsedDefaultValueTo = parsedValueComponent({
|
||||||
|
fieldType: componentReference.componentPath,
|
||||||
|
value: parsedDefaultValueTo,
|
||||||
|
displayType: fieldToGenerate.displayType,
|
||||||
|
isMandatory: fieldToGenerate.isMandatory,
|
||||||
|
isIdentifier: fieldToGenerate.columnName.includes('_ID')
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
parsedDefaultValueTo = parsedValueComponent({
|
|
||||||
fieldType: componentReference.componentPath,
|
|
||||||
value: parsedDefaultValueTo,
|
|
||||||
displayType: fieldToGenerate.displayType,
|
|
||||||
isMandatory: fieldToGenerate.isMandatory,
|
|
||||||
isIdentifier: fieldToGenerate.columnName.includes('_ID')
|
|
||||||
})
|
|
||||||
|
|
||||||
parentFieldsList = getParentFields(fieldToGenerate)
|
parentFieldsList = getParentFields(fieldToGenerate)
|
||||||
|
|
||||||
// evaluate logics
|
// evaluate logics
|
||||||
|
@ -28,7 +28,7 @@ export const NUMBER = {
|
|||||||
id: 12,
|
id: 12,
|
||||||
isSupported: true,
|
isSupported: true,
|
||||||
valueType: 'DECIMAL',
|
valueType: 'DECIMAL',
|
||||||
componentPath: 'FieldText',
|
componentPath: 'FieldNumber',
|
||||||
size: {
|
size: {
|
||||||
xs: 24,
|
xs: 24,
|
||||||
sm: 12,
|
sm: 12,
|
||||||
@ -104,7 +104,7 @@ export const COLOR = {
|
|||||||
id: 27,
|
id: 27,
|
||||||
isSupported: false,
|
isSupported: false,
|
||||||
valueType: 'INTEGER',
|
valueType: 'INTEGER',
|
||||||
componentPath: 'FieldText',
|
componentPath: 'FieldColor',
|
||||||
size: {
|
size: {
|
||||||
xs: 24,
|
xs: 24,
|
||||||
sm: 12,
|
sm: 12,
|
||||||
|
@ -169,6 +169,7 @@ export function convertFieldListToShareLink(fieldList) {
|
|||||||
|
|
||||||
return attributesListLink.slice(0, -1)
|
return attributesListLink.slice(0, -1)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find element in an array recursively
|
* Find element in an array recursively
|
||||||
* @param {object|array} treeData
|
* @param {object|array} treeData
|
||||||
@ -256,7 +257,8 @@ export function parsedValueComponent({
|
|||||||
isMandatory = false,
|
isMandatory = false,
|
||||||
isIdentifier = false
|
isIdentifier = false
|
||||||
}) {
|
}) {
|
||||||
if ((value === undefined || value === null) && !isMandatory) {
|
const isEmpty = isEmptyValue(value)
|
||||||
|
if (isEmpty && !isMandatory) {
|
||||||
if (fieldType === 'FieldYesNo') {
|
if (fieldType === 'FieldYesNo') {
|
||||||
return Boolean(value)
|
return Boolean(value)
|
||||||
}
|
}
|
||||||
@ -267,7 +269,7 @@ export function parsedValueComponent({
|
|||||||
switch (fieldType) {
|
switch (fieldType) {
|
||||||
// data type Number
|
// data type Number
|
||||||
case 'FieldNumber':
|
case 'FieldNumber':
|
||||||
if (String(value).trim() === '' || value === undefined || value === null) {
|
if (isEmpty) {
|
||||||
returnValue = undefined
|
returnValue = undefined
|
||||||
if (isMandatory) {
|
if (isMandatory) {
|
||||||
returnValue = 0
|
returnValue = 0
|
||||||
@ -305,7 +307,7 @@ export function parsedValueComponent({
|
|||||||
// data type Date
|
// data type Date
|
||||||
case 'FieldDate':
|
case 'FieldDate':
|
||||||
case 'FieldTime ':
|
case 'FieldTime ':
|
||||||
if (String(value).trim() === '') {
|
if (isEmpty) {
|
||||||
value = undefined
|
value = undefined
|
||||||
}
|
}
|
||||||
if (!isNaN(value)) {
|
if (!isNaN(value)) {
|
||||||
@ -321,7 +323,7 @@ export function parsedValueComponent({
|
|||||||
break
|
break
|
||||||
|
|
||||||
case 'FieldSelect':
|
case 'FieldSelect':
|
||||||
if (String(value).trim() === '') {
|
if (isEmpty) {
|
||||||
value = undefined
|
value = undefined
|
||||||
}
|
}
|
||||||
if (typeof value === 'boolean') {
|
if (typeof value === 'boolean') {
|
||||||
@ -329,7 +331,7 @@ export function parsedValueComponent({
|
|||||||
}
|
}
|
||||||
// Table (18) or Table Direct (19)
|
// Table (18) or Table Direct (19)
|
||||||
if (displayType === TABLE.id || (displayType === TABLE_DIRECT.id && isIdentifier)) {
|
if (displayType === TABLE.id || (displayType === TABLE_DIRECT.id && isIdentifier)) {
|
||||||
if (value !== '' && value !== null && value !== undefined) {
|
if (!isEmptyValue(value)) {
|
||||||
value = Number(value)
|
value = Number(value)
|
||||||
}
|
}
|
||||||
} // Search or List
|
} // Search or List
|
||||||
@ -342,6 +344,7 @@ export function parsedValueComponent({
|
|||||||
}
|
}
|
||||||
return returnValue
|
return returnValue
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* add a tab depending on the status of the document
|
* add a tab depending on the status of the document
|
||||||
* @param {string} tag, document status key
|
* @param {string} tag, document status key
|
||||||
|
Loading…
x
Reference in New Issue
Block a user