advanced interface can contain places, fallback to string type

This commit is contained in:
j 2023-07-06 14:13:55 +05:30
parent b7c201a74f
commit eeb0b68037

View file

@ -87,6 +87,16 @@ Ox.Filter = function(options, self) {
{id: '=,', title: Ox._('is between')}, {id: '=,', title: Ox._('is between')},
{id: '!=,', title: Ox._('is not 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: [ string: [
{id: '==', title: Ox._('is')}, {id: '==', title: Ox._('is')},
{id: '!==', title: Ox._('is not')}, {id: '!==', title: Ox._('is not')},
@ -121,6 +131,7 @@ Ox.Filter = function(options, self) {
integer: 0, integer: 0,
item: void 0, item: void 0,
list: '', list: '',
place: '',
string: '', string: '',
text: '', text: '',
time: '00:00:00', time: '00:00:00',
@ -300,7 +311,7 @@ Ox.Filter = function(options, self) {
condition = { condition = {
key: key.id, key: key.id,
operator: condition.operator, operator: condition.operator,
value: self.defaultValue[key.type] value: self.defaultValue[key.type] || ''
}; };
if (isGroup) { if (isGroup) {
Ox.Log('Form', 'isGroup', self.options.value.operator) Ox.Log('Form', 'isGroup', self.options.value.operator)
@ -346,7 +357,7 @@ Ox.Filter = function(options, self) {
) { ) {
condition.value = newFindKey.type == 'item' condition.value = newFindKey.type == 'item'
? newFindKey.values[0].id ? newFindKey.values[0].id
: self.defaultValue[newFindKey.type]; : (self.defaultValue[newFindKey.type] || '');
} }
renderConditions(); renderConditions();
} }
@ -576,13 +587,12 @@ Ox.Filter = function(options, self) {
} }
function renderConditionOperator(condition) { function renderConditionOperator(condition) {
Ox.Log('FILTER', 'rCO', condition, self.conditionOperators[getConditionType( var key = Ox.getObjectById(self.options.findKeys, condition.key),
Ox.getObjectById(self.options.findKeys, condition.key).type conditionType = getConditionType(key.type),
)]) conditionOperators = self.conditionOperators[conditionType] || self.conditionOperators["string"];
Ox.Log('FILTER', 'rCO', condition, conditionType, conditionOperators)
return Ox.Select({ return Ox.Select({
items: self.conditionOperators[getConditionType( items: conditionOperators,
Ox.getObjectById(self.options.findKeys, condition.key).type
)],
overlap: 'right', overlap: 'right',
value: condition.operator + (isBetweenCondition(condition) ? ',' : ''), value: condition.operator + (isBetweenCondition(condition) ? ',' : ''),
width: 128 width: 128