From eeb0b68037384bb54394c3cd2e79c1a8c764d1be Mon Sep 17 00:00:00 2001 From: j Date: Thu, 6 Jul 2023 14:13:55 +0530 Subject: [PATCH] advanced interface can contain places, fallback to string type --- source/UI/js/Form/Filter.js | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/source/UI/js/Form/Filter.js b/source/UI/js/Form/Filter.js index 3a0f6814..f3215ffe 100644 --- a/source/UI/js/Form/Filter.js +++ b/source/UI/js/Form/Filter.js @@ -87,6 +87,16 @@ Ox.Filter = function(options, self) { {id: '=,', title: Ox._('is between')}, {id: '!=,', title: Ox._('is not between')} ], + place: [ + {id: '==', title: Ox._('is')}, + {id: '!==', title: Ox._('is not')}, + {id: '=', title: Ox._('contains')}, + {id: '!=', title: Ox._('does not contain')}, + {id: '^', title: Ox._('starts with')}, + {id: '!^', title: Ox._('does not start with')}, + {id: '$', title: Ox._('ends with')}, + {id: '!$', title: Ox._('does not end with')} + ], string: [ {id: '==', title: Ox._('is')}, {id: '!==', title: Ox._('is not')}, @@ -121,6 +131,7 @@ Ox.Filter = function(options, self) { integer: 0, item: void 0, list: '', + place: '', string: '', text: '', time: '00:00:00', @@ -300,7 +311,7 @@ Ox.Filter = function(options, self) { condition = { key: key.id, operator: condition.operator, - value: self.defaultValue[key.type] + value: self.defaultValue[key.type] || '' }; if (isGroup) { Ox.Log('Form', 'isGroup', self.options.value.operator) @@ -346,7 +357,7 @@ Ox.Filter = function(options, self) { ) { condition.value = newFindKey.type == 'item' ? newFindKey.values[0].id - : self.defaultValue[newFindKey.type]; + : (self.defaultValue[newFindKey.type] || ''); } renderConditions(); } @@ -576,13 +587,12 @@ Ox.Filter = function(options, self) { } function renderConditionOperator(condition) { - Ox.Log('FILTER', 'rCO', condition, self.conditionOperators[getConditionType( - Ox.getObjectById(self.options.findKeys, condition.key).type - )]) + var key = Ox.getObjectById(self.options.findKeys, condition.key), + conditionType = getConditionType(key.type), + conditionOperators = self.conditionOperators[conditionType] || self.conditionOperators["string"]; + Ox.Log('FILTER', 'rCO', condition, conditionType, conditionOperators) return Ox.Select({ - items: self.conditionOperators[getConditionType( - Ox.getObjectById(self.options.findKeys, condition.key).type - )], + items: conditionOperators, overlap: 'right', value: condition.operator + (isBetweenCondition(condition) ? ',' : ''), width: 128