diff --git a/packages/core/modules/export/queryString.js b/packages/core/modules/export/queryString.js index 71a18b96a..dc64008f1 100644 --- a/packages/core/modules/export/queryString.js +++ b/packages/core/modules/export/queryString.js @@ -54,7 +54,7 @@ const formatGroup = (item, config, meta, parentField = null) => { const isRuleGroup = (type === "rule_group"); // TIP: don't cut group for mode == 'struct' and don't do aggr format (maybe later) - const groupField = isRuleGroup && mode == "array" ? properties.get("field") : null; + const groupField = isRuleGroup && mode === "array" ? properties.get("field") : null; const groupOperator = type === "rule_group" ? properties.get("operator") : null; const groupOperatorCardinality = groupOperator ? config.operators[groupOperator]?.cardinality ?? 1 : undefined; const canHaveEmptyChildren = isRuleGroup && mode === "array" && groupOperatorCardinality >= 1; @@ -71,7 +71,7 @@ const formatGroup = (item, config, meta, parentField = null) => { conjunction = defaultConjunction(config); const conjunctionDefinition = config.conjunctions[conjunction]; - const conjStr = list.size ? conjunctionDefinition.formatConj(list, conjunction, not, isForDisplay) : null; + const conjStr = list.size ? conjunctionDefinition.formatConj(list, conjunction, not, isForDisplay, groupField) : null; let ret; if (groupField) { @@ -245,6 +245,9 @@ const formatRule = (item, config, meta, parentField = null, returnArgs = false) if (returnArgs) { return args; } else { + if (formattedValue === undefined) + return undefined; + //format expr let ret = fn.call(config.ctx, ...args); @@ -317,7 +320,7 @@ const formatField = (config, meta, field, parentField = null, cutParentField = t const fieldLabel2 = fieldDefinition.label2 || fieldFullLabel; const formatFieldFn = config.settings.formatField; const fieldName = formatFieldName(field, config, meta, cutParentField ? parentField : null, {useTableName: true}); - ret = formatFieldFn(fieldName, fieldParts, fieldLabel2, fieldDefinition, config, isForDisplay); + ret = formatFieldFn(fieldName, fieldParts, fieldLabel2, fieldDefinition, config, isForDisplay, parentField); } else if(isDebugMode) { ret = "?"; } diff --git a/packages/core/modules/index.d.ts b/packages/core/modules/index.d.ts index db094c3c6..2c45462c3 100644 --- a/packages/core/modules/index.d.ts +++ b/packages/core/modules/index.d.ts @@ -919,7 +919,7 @@ export type Widgets = TypedMap>; // Conjunctions ///////////////// -type FormatConj = (children: ImmutableList, conj: string, not: boolean, isForDisplay?: boolean) => string; +type FormatConj = (children: ImmutableList, conj: string, not: boolean, isForDisplay?: boolean, groupField?: string) => string; type SqlFormatConj = (children: ImmutableList, conj: string, not: boolean) => string; type SpelFormatConj = (children: ImmutableList, conj: string, not: boolean, omitBrackets?: boolean) => string; @@ -1240,7 +1240,7 @@ type ChangeFieldStrategy = "default" | "keep" | "first" | "none"; type FormatReverse = (q: string, op: string, reversedOp: string, operatorDefinition: Operator, revOperatorDefinition: Operator, isForDisplay: boolean) => string; type SqlFormatReverse = (q: string) => string; type SpelFormatReverse = (q: string) => string; -type FormatField = (field: FieldPath, parts: Array, label2: string, fieldDefinition: Field, config: Config, isForDisplay: boolean) => string; +type FormatField = (field: FieldPath, parts: Array, label2: string, fieldDefinition: Field, config: Config, isForDisplay: boolean, parentField?: string) => string; type FormatSpelField = (field: FieldPath, parentField: FieldPath | null, parts: Array, partsExt: Array, fieldDefinition: Field, config: Config) => string; type CanCompareFieldWithField = (leftField: FieldPath, leftFieldConfig: Field, rightField: FieldPath, rightFieldConfig: Field, op: string) => boolean; type FormatAggr = (whereStr: string, aggrField: FieldPath, operator: string, value: string | ImmutableList, valueSrc: ValueSource, valueType: string, opDef: Operator, operatorOptions: OperatorOptionsI, isForDisplay: boolean, aggrFieldDef: Field) => string;