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 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