mirror of
https://github.com/PanJiaChen/vue-element-admin.git
synced 2025-08-15 00:15:57 +08:00
This is the first commit for changes and integration with ADempiere UI, the pull request have very to long commits, here is a squash and merge, for detail refere to https://github.com/erpcya/adempiere-vue with committers: - [Yamel Senih](https://github.com/yamelsenih) - [Raúl Muñoz](https://github.com/Raul-mz) - [Edwin Betancourt](https://github.com/EdwinBetanc0urt) - [Leonel Matos](https://github.com/leonel1524) - [Elsio Sanchez](https://github.com/elsiosanchez) * add server error message (#571) * Feature/collapse avanced search (#572) * add server error message * add collasep to advanced search * bugfix load data ordered (#573) * Fix share values from panel. (#574) * Fix share values from panel. * Parsed values. * support refresh and field updata (#575) * refresh * bugfix load data ordered * minimal changes * Fix parameters to share data type date and boolean. (#576) * Change search browser. (#577) * read url parameters and load data (#578) * Fix error when search browser list. (#579) * Fix error when search browser list. * Minimal changes. * Update Dictionary and business data client version * bugfix share link with props (#580) * bugfix copy link with uuid * bugfix share link with props * Add support conditions to object list from criteria. (#581) * bugfix record navigation in left table (#582) * add export-browser (#583) * add export browser * minimal changes * wait for service * add window report * bugfix load report with link shared (#584) * bugfix copy link with uuid * bugfix share link with props * bugfix load report with link shared * Rollback support to window. (#585) * Rollback support to window. * Minimal changes. * support Mandatory Field (#586) * support Mandatory Field * delete comment * bugfix share link from avanced query (#588) * bugfix copy link with uuid * bugfix share link with props * bugfix load report with link shared * bugfix share link from avanced query * Fix optional fields showed from user. (#589) * Fix optional fields showed from user. * Remove destructuring assignment. * message error serve (#587) * message error serve * remove console * remove error code * minimal changes * bugfix change records in record navigation (#590) * bugfix record navigation in left table * bugfix change records in record navigation * support process Activity (#592) * support processActivity * minimal changes * Load one group field to advanced query. (#593) * Load one group field to advanced query. * Minimal changes. * bugfix load record with criteria method (#594) * support refrest menu contexto (#595) * Add new version from business data * Fix read only fields. (#591) * Fix read only fields. * Minimal changes. * Add all field list in panel advanced query. (#596) * fix set date with context (#597) * support logs Process Activity (#598) * support for the logs of Process Activity * support logs Process Activity * remove console.log * Update data in main panel when update list from server. (#599) * Update data in main panel when update list from server. * Update comments. * Update conditional to update main panel. * First commit to data load children. (#600) * bugfix change tag view title and rename variables (#601) * Fix add optional fields to advanced query. (#602) * Fix add optional fields to advanced query. * Add attribute to advanced query. * Fix variable name. * Fix change roles in navigation bar and view profile. (#603) * Fix send all parameters by advanced query. (#604) * bugfix close tag after process execute (#605) * bugfix load windows process without fields (#606) * clear fields when the window is closed (#607) * clear field of process * minimal changes * add report type to share link of reports (#608) * Fix context menu. (#609) * bugfix reload parameters after close SB (#610) * bugfix reload parameters after close SB * change condition * add ZoomIn ProcessActivity (#611) * add ZoomIn ProcessActivity * add parameters * Update es.js Fix Variable Name * Update index.vue Fix Variable Name * Update en.js * bugfix close window after process (#613) * bugfix close window after process * bugfix close views after execute SB process * support refresh the SmartBrowser (#614) * Remove data after close view. (#612) * Remove data after close view. * Clear data in tabs children when change uuid in main panel. * Fix load data in tabs children. (#615) * Fix load data in tabs children. * Send where clause. * bugfix load data whith criteria conditions (#616) * bugfix load data whith criteria conditions * remove unnecessary functions * change import function and change component name (#617) * add reference mobile (#618) * fix function calling (#619) * support mobile (#620) * remove advanced query option from child tabs * support mobile * Fix load data tab children and not send row tab (edit mode). (#621) * bugfix execute report formats (#622) * support datatable y and contextmenu (#623) * Fix load display column, record navigation. (#624) * some bugfix in advanced query panel (#625) * support for the range date and the title of the processes and reports (#626) * add option select last week range date * adjust the height of the title of the processes and reports * fix create new action error (#627) * Remove duplicate request to server by Tabs and Fields children. (#628) * Fix display value NULL in TextField component. (#630) * Smart browser support when opening the process Activity (#631) * support to record load in the table * add dispatch isClearSelection * adding conditional * minimal changes * Update contextMenuMixin.js * bugfix in share link report and process properties (#632) * fix open report viewer on process return error (#633) * feat: Add create entity in tab children. (#634) * feat: Add create entity in tab children. * Fix route query action when create entity in tab children. * feat: Add notification after delete selection records in table. (#636) * feat: Add notification after delete selection records in table. * Add destructuring of object. * Fix fields list mandatory empty when create/update in table. (#635) * feat: Add create entity in tab children. * Fix route query action when create entity in tab children. * Fix fields list mandatory empty when create/update in table. * fix: Create entity from main panel. (#637) * add condition (#638) * fix values of date parameters in share link (#639) * Support DateRange week (#640) * Add Summary to logs (#641) * support daterange week (#642) * Support DateRange week * minimal changes * Auto stash before merge of "bugfix/support-date-range-week" and "develop-i18n" * fix: Search browser when change show/hidden field not isQueryCriteria. (#643) * change displayed fields on advanced query (#644) * add summary to logs (#645) * fix create new action query (#646) * fix: Not load tabs not supported (isSortTab and isTranslationTab) (#647) * Change version * remove refresh the tabs children (#648) * remove refresh the tabs children * column top of the table of the select * minimal changes * fix: Create entity in table send server after change field. (#649) * add loading (#650) * add loading * rename isLoaded * add translations * add translations * add message * report control error (#651) * Add mark (*) mandatory fields in table. (#652) * fix: Exception not handled, add message when capturing error in promise. (#653) * fix: Correct loading into table when it has 0 records. (#654) * fix: Correct loading into table when it has 0 records. If the search returns 0 records the DataTable remains loading even when that was its response, giving the confucion that it is still waiting for the response from the server. * Minimal changes. * fix: Hide search notification for language and role. (#655) * add hidden main panel (#656) * fix: Show fields with default values. (#658) * fix load records in left table (#657) * support the hide panel button (#660) * add icon create new (#659) * add icon create new * setting the add button * fix: Delete record and selection in browser after run process. (#661) * fix load parameters of share link (#662) * open report from the window (#663) * open report from the window * resolve Conflicts * fix references disabled * Remove console.log (#664) * fix: Load data tab children after set context main panel. (#665) * add lastrun to the process Activity (#667) * fix: Lookups context. (#668) * fix: Set is load context not report and process. (#669) * fix: Set is load context not report and process. * Minimal changes. * Change evaluate multiple conditions. * feat: Add display column in add new row with value or default values. (#670) * feat: Add display column in add new row with value or default values. * Add comments. * Fixing navigation height between records (#671) * Fixing navigation height between records * minimal changes * support recent intems * fix: Context for window request. TODO: Add AD_User_ID in user info gRPC. (#672) * feat: Add last run to process activity. (#673) * feat: Add last run to process activity. * Change convert parameters to object in vuex store. * fix: Run process error. * Update source packages version * Update access version * fix: Do not show loading when the data request returns error. (#675) * feat: Add support to fields isEncrypted (type password). (#677) * fixing translation (#678) * fix display panel and fields in advanced query (#676) * fix display panel and fields in advanced query * bugfix filter fields in advanced query * fix load values in lookup component (#679) * filter fields exclude buttons on adavanced query (#680) * fix: Add display column to field link in tab. (#681) * feat: Add support to default context. (#682) TODO: Add default context in session info. * feat: Add field length to field text as max length attribute. (#683) * Add support to latest version from access * button setting to close table panel or expand (#684) * fix activities order by date (#685) * add date translations in process activity * fix activities order by date * fix: Handle data request error to leave loading the table. (#686) * fix: Smart Browser, research data when records length > 100. (#687) * fix: Smart Browser, research data when records length > 100. * Correct variable evaluation. * fix close report (#688) * Evaluate server response error by dictionary (#689) * Evaluate server response error by dictionary * Support Smart Browser and Process * minimal changes * fixed color and size of icon datatable (#690) * fixed color and size of icon datatable * minimal changes * add clearable * fix: Create request field mandatory number 0. (#691) * validate edit mode until ready to save (#692) * validate edit mode until ready to save * correcting condition * add child tab to url and share link (#693) * feat: Add support to new session request. (#694) * multiple record support (#695) * fix delete data after close window (#696) * fix load view on reapeted route * fix delete data after close window * feat: Add read only row from table. (#697) * feat: Add read only row from table. * Add read only if client context is different to client record. * add call off record (#698) * date error when executing (#699) * feat: Add validation read only with parent record is read only. (#700) * feat: Add validation read only with parent record is read only. * Minimal changes. * fix: Run process associate with Smart Browser or Window. (#702) * restore create new record of datatable child (#701) * restore create new record of datatable child * restore change * minimal changes * restoring values in the table * fix: Create new main panel, clear records to tabs children. (#703) * validate multiple record (#704) * validate multiple record * validate isEdit datatable children * Add new version for data * Add new version for data * add show to password type field (#705) * validate multiple record * add show to password type field * fix: Change evaluation of conditionals to add new row. (#706) * feat: Keep rows in edit mode after listing by creating record. (#707) * fix: Fix get lookup to window navigation. (#708) * fix: Parse default values to create or update record. (#709) * bugfix set tab child in URL (#710) * support height datable (#711) * fix: Read Only from processed and processing record. (#712) * Support badge and column fixed (#713) * support height datable * support badge * raname badge (#714) * no recharge view on changes (#715) * bugfix style of badge (#717) * change tabNumber query prop for tabParent (#718) * bugfix set tab child in URL * change tabNumber query prop for tabParent * fix: Pagination and total records. (#719) * Support duplicate lookup (#721) * set advanced search (#716) * field auto focus (#720) * field auto focus * bugfix * some changes * change method * remove unused attributes * fix: Add display column from server to add new row. (#723) * set values in main panel to share link (#725) * fix: Add new record data tables. (#726) * support LookupList (#724) * support LookupList * fix: Add display column from server to add new row. * delete isDisabledAddNewIcono * remove highlight current row of data table (#722) * fix: Tag view undefined. (#727) * fix: Get display column from server to add new row. (#729) * remove unused conditions (#730) * support style collapse item (#731) * clear panel values when view is closed (#732) * fix: Get multiple request data. (#733) * bugfix open process activity view (#736) * Evaluate values of the displayColumn with empty string or number at 0 (#737) * Evaluate values of the displayColumn with empty string or number at 0 * documenting evaluation * fix route from process activity to process view (#735) * bugfix conditions of tags views (#738) * bugfix infinity loading in datatable on new record (#734) * bugfix maxlength in process (#739) * feat: Add support to callout. (#741) * feat: Add callout support. * feat: Add support to callout. * Evaluate Column display values with empty string or number in 0u8 evaluation (#740) * bugfix close window after delete record (#742) * bugfix change panel records (#743) * fix: Error input text when show/hidden column DataTables. (#744) * fix: Remove duplicate code to focus field. (#745) * add change value of image (#746) * fix: Disable roles that do not have uuid in the registry (#747) * Add new version for gRPC data client * fix: Remove multiple request data from server. (#748) * Support duplicate or null data lookup (#749) * bugfix (#750) * Bugfix/parsed boolean context (#751) * bugfix * fix: Parsed context convert Boolean values to string values in query. * feat: Add support to callout response. (#752) * bugfix * feat: Add support to callout response to change panel values. * remove concole.log. * fix: Not send callout if is panel change. (#753) * fix: Not request callout when navigation records. (#755) * Update business data client from latest * Reduce time transition menu (#754) * fix: Set null values before reset panel to new. (#756) * fix: Set null values before reset panel to new. * Add oldValue. * add windowNo to callout store (#757) * bugfix record void in tabs (#758) * Update data version * feat: Add callout request to tab children. (#759) * feat: Add callout request to tab children. * Minimal changes. * bugfix context default values (#762) * bugfix void values from gRPC (#763) * feat: Add support for empty gRPC values. (#764) * feat: Add support for empty gRPC values. * Update comments. * tab record load and reduce requests to the server (#765) * tab record load and reduce requests to the server * duplicate keys Lookups * add forget password (#761) * add forget password * remove console * rename translation * minimal changes * Minimal Changes * duplicate data and string type (#766) * Support duplicate data and string type * minimal changes * update grpc-access-client version (#768) * bugfix load values after callout response (#769) * feat: Add support enrollment. (#767) * feat: Add support enrollment. * Update enrollment package version. * Fix language. * feat: Add reset password with token. (#771) * bugfix send panel values to create record (#772) * bugfix convert dates to UTC (#774) * feat: Add persistent vuex state in local storage. (#773) * feat: Add persistent vuex state in local storage. * fix: Error when LogOut session. * validate options list lookup (#776) * feat: Add enrollment user. (#778) * feat: Add create password and join with reset password form view. (#779) * fix: Zoom item process activity, parameters undefined. (#780) * Validate ColumnName in DataTable (#783) * bugfix load list items and callout send (#777) * fix: Search records with uuid url. (#781) * convert ternary operator into computed property (#782) * fix: Remove unused methods and remove watching. (#784) * fix: Remove unused methods and remove watching. * remove watch window view. * fix: Validation in google chrome enroll user. (#785) * fix: Validation in google chrome enroll user. * Update grpc-enrollment-user-client version. * fix: Convert context map to array pairs. (#786) * fix: Delete persistent date. (#788) * fix: Yes -No component value in table when edit mode. (#789) * multiple requests LookupList (#791) * fix: Read only panel parent when set context tab children. (#792) * Change value to displayColumn (#793) * add display column in tables childs (#787) * bugfix load list items and callout send * add display column in tables childs * add dynamic table name * add get default value from server * change comparation * remove request LookupItem (#794) * Change value to displayColumn * minimal changes * bugfix send criteria for get default value (#795) * bugfix load list items and callout send * add display column in tables childs * add dynamic table name * add get default value from server * change comparation * add criteria for get default value * remove parse int * feat: Add undo to create new record. (#796) * bugfix display values in tabs child (#797) * fix: Browser Generate Invoice From Outbound Order not search result. (#798) * add icons to recent items (#799) * bugfix display values in tabs child * add icons to recent items * correct translation and add client when changing rolecorrect translation and add client when changing role (#800) * feat: Add show mandatory columns and show all available columns. (#801) * bugfix recent items and change styles (#802) * change getDefaultValue service implementation (#803) * bugfix display values with sql * change getDefaultValue service implementation * fix: Set empty values to component's base. (#804) * add context info in field (#805) * bugfix context info fields (#806) * feat: Update access client and data client grpc version. (#807) * Add displayColumn to getterValueSelect (#808) * Add displayColumn to getterValueSelect * Update panel.js * fix: Duplicate change panel with record. (#809) * Change license and readme waiting for merge with ADempiere trunk * Add Changes for license and readme * Add commiter
247 lines
7.2 KiB
JavaScript
247 lines
7.2 KiB
JavaScript
// This class is used for evaluate a conditional
|
|
// format := {expression} [{logic} {expression}]<br>
|
|
// expression := @{context}@{operand}{value} or @{context}@{operand}{value}<br>
|
|
// logic := {|}|{&}<br>
|
|
// context := any global or window context <br>
|
|
// value := strings or numbers<br>
|
|
// logic operators := AND or OR with the previous result from left to right <br>
|
|
// operand := eq{=}, gt{>}, le{<}, not{~^!} <br>
|
|
// Examples: <br>
|
|
// @AD_Table_ID@=14 | @Language@!GERGER <br>
|
|
// @PriceLimit@>10 | @PriceList@>@PriceActual@<br>
|
|
// @Name@>J<br>
|
|
// Strings may be in single quotes (optional)
|
|
class evaluator {
|
|
/**
|
|
* Evaluate logic's
|
|
* @param {string} parentUuid Parent (Window / Process / Smart Browser)
|
|
*/
|
|
static evaluateLogic(objectToEvaluate) {
|
|
var defaultUndefined = false
|
|
if (objectToEvaluate.type === 'displayed') {
|
|
defaultUndefined = true
|
|
}
|
|
// empty logic
|
|
if (objectToEvaluate.logic === undefined ||
|
|
objectToEvaluate.logic === null ||
|
|
objectToEvaluate.logic.trim() === '') {
|
|
return defaultUndefined
|
|
}
|
|
var st = objectToEvaluate.logic.trim().replace('\n', '')
|
|
st = st.replace('|', '~')
|
|
var expr = /(~|&)/
|
|
var stList = st.split(expr)
|
|
var it = stList.length
|
|
|
|
if (((it / 2) - ((it + 1) / 2)) === 0) {
|
|
console.info(
|
|
'Logic does not comply with format "<expression> [<logic> <expression>]"' +
|
|
' --> ' + objectToEvaluate.logic
|
|
)
|
|
return defaultUndefined
|
|
}
|
|
|
|
var retValue = null
|
|
var logOp = ''
|
|
stList.forEach(function(element) {
|
|
if (element === '~' || element === '&') {
|
|
logOp = element
|
|
} else if (retValue === null) {
|
|
retValue = evaluator.evaluateLogicTuples({
|
|
...objectToEvaluate,
|
|
conditional: element
|
|
})
|
|
} else {
|
|
if (logOp === '&' && logOp !== '') {
|
|
retValue = retValue & evaluator.evaluateLogicTuples({
|
|
...objectToEvaluate,
|
|
conditional: element
|
|
})
|
|
} else if (logOp === '~' && logOp !== '') {
|
|
retValue = retValue | evaluator.evaluateLogicTuples({
|
|
...objectToEvaluate,
|
|
conditional: element
|
|
})
|
|
} else {
|
|
console.info("Logic operant '|' or '&' expected --> " + objectToEvaluate.logic)
|
|
return defaultUndefined
|
|
}
|
|
}
|
|
})
|
|
return Boolean(retValue)
|
|
} // evaluateLogic
|
|
|
|
/**
|
|
* Evaluate Logic Tuples
|
|
* @param {object} objectToEvaluate Complete object
|
|
* @param {string} logic If is displayed or not (mandatory and readonly)
|
|
* @return {boolean}
|
|
*/
|
|
static evaluateLogicTuples(objectToEvaluate) {
|
|
var _defaultUndefined = false
|
|
if (objectToEvaluate.type === 'displayed') {
|
|
_defaultUndefined = true
|
|
}
|
|
var logic = objectToEvaluate.conditional
|
|
// not context info, not logic
|
|
if (logic === undefined) {
|
|
return _defaultUndefined
|
|
}
|
|
var expr = /^(['"@#$a-zA-Z0-9\-_\s]){0,}((!*={1})|(!{1})|(<{1})|(>{1}))([\s"'@#$a-zA-Z0-9\-_]){0,}$/i
|
|
var st = expr.test(logic)
|
|
|
|
if (!st) {
|
|
console.info(
|
|
".Logic tuple does not comply with format '@context@=value' where operand" +
|
|
" could be one of '=!^><' --> " + logic
|
|
)
|
|
return _defaultUndefined
|
|
}
|
|
expr = /(!{1}|={1})/
|
|
st = logic.split(expr)
|
|
if (st.length === 1) {
|
|
expr = /(<{1})/
|
|
st = logic.split(expr)
|
|
}
|
|
if (st.length === 1) {
|
|
expr = /(>)/
|
|
st = logic.split(expr)
|
|
}
|
|
// First Part (or column name)
|
|
var first = st[0].trim()
|
|
var firstEval = first
|
|
expr = /@/
|
|
if (expr.test(first)) {
|
|
first = first.replace(/@/g, '').trim()
|
|
var isGlobal = first.startsWith('#')
|
|
var isCountable = first.startsWith('$')
|
|
var value = objectToEvaluate.context.getContext({
|
|
parentUuid: (isGlobal || isCountable) ? '' : objectToEvaluate.parentUuid,
|
|
containerUuid: (isGlobal || isCountable) ? '' : objectToEvaluate.containerUuid,
|
|
columnName: first
|
|
})
|
|
// in context exists this column name
|
|
if (value === null || value === undefined) {
|
|
console.info(
|
|
'.The column ' + first + ' not exists in context.'
|
|
)
|
|
return _defaultUndefined
|
|
}
|
|
firstEval = value // replace with it's value
|
|
}
|
|
|
|
if (firstEval === null || firstEval === undefined) {
|
|
return _defaultUndefined
|
|
}
|
|
if (typeof firstEval === 'string') {
|
|
firstEval = firstEval.replace(/['"]/g, '').trim() // strip ' and "
|
|
}
|
|
|
|
// Operator
|
|
var operand = st[1]
|
|
// Second Part
|
|
var second = st[2].trim()
|
|
var secondEval = second.trim()
|
|
if (expr.test(second)) {
|
|
second = second.replace(/@/g, ' ').trim() // strip tag
|
|
secondEval = objectToEvaluate.context.getContext({
|
|
parentUuid: (isGlobal || isCountable) ? null : objectToEvaluate.parentUuid,
|
|
containerUuid: (isGlobal || isCountable) ? null : objectToEvaluate.containerUuid,
|
|
columnName: first
|
|
}) // replace with it's value
|
|
}
|
|
if (typeof secondEval === 'string') {
|
|
secondEval = secondEval.replace(/['"]/g, '').trim() // strip ' and " for string values
|
|
}
|
|
|
|
// Handling of ID compare (null => 0)
|
|
if (first.includes('_ID') && firstEval.length === 0) {
|
|
firstEval = '0'
|
|
}
|
|
if (second.includes('_ID') && secondEval.length === 0) {
|
|
secondEval = '0'
|
|
}
|
|
|
|
// Logical Comparison
|
|
var result = this.evaluateLogicTuple(firstEval, operand, secondEval)
|
|
|
|
return result
|
|
}
|
|
|
|
/**
|
|
* Evuale logic Tuple
|
|
* @param {string|number} value1 Value in Context
|
|
* @param {string} operand Comparison
|
|
* @param {string|number} value2 Value in Logic
|
|
* @return {boolean}
|
|
*/
|
|
static evaluateLogicTuple(value1, operand, value2) {
|
|
// Convert value 1 string value to boolean value
|
|
if (value1 === 'Y') {
|
|
value1 = true
|
|
} else if (value1 === 'N') {
|
|
value1 = false
|
|
}
|
|
|
|
// Convert value 2 string value to boolean value
|
|
if (value2 === 'Y') {
|
|
value2 = true
|
|
} else if (value2 === 'N') {
|
|
value2 = false
|
|
}
|
|
|
|
if (value1 == null || operand == null || value2 == null) {
|
|
return false
|
|
}
|
|
if (operand === '=') {
|
|
return value1 === value2
|
|
} else if (operand === '<') {
|
|
return value1 < value2
|
|
} else if (operand === '>') {
|
|
return value1 > value2
|
|
} else {
|
|
// interpreted as not
|
|
return value1 !== value2
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Parse Depends or relations
|
|
* @param {string} parseString
|
|
* @return {array}
|
|
*/
|
|
static parseDepends(parseString) {
|
|
var listFields = []
|
|
if (parseString === null || parseString === undefined) {
|
|
// return array empty
|
|
return listFields
|
|
}
|
|
|
|
let string = parseString.replace('@SQL=', '')
|
|
// while we have variables
|
|
|
|
while (string.includes('@')) {
|
|
let pos = string.indexOf('@')
|
|
// remove first @: @ExampleColumn@ = ExampleColumn@
|
|
string = string.substring(pos + 1)
|
|
|
|
pos = string.indexOf('@')
|
|
if (pos === -1) {
|
|
continue
|
|
} // error number of @@ not correct
|
|
|
|
// remove second @: ExampleColumn@ = ExampleColumn
|
|
const value = string.substring(0, pos)
|
|
|
|
// delete secodn columnName and @
|
|
string = string.substring(pos + 1)
|
|
|
|
// add column name in array
|
|
listFields.push(value)
|
|
}
|
|
return listFields
|
|
}
|
|
}
|
|
|
|
export default evaluator
|