Skip to content

Commit b9c31c3

Browse files
committed
wip #912 todo
1 parent d0a452c commit b9c31c3

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

packages/core/modules/export/queryString.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const formatGroup = (item, config, meta, isForDisplay = false, parentField = nul
4949

5050
const isRuleGroup = (type === "rule_group");
5151
// TIP: don't cut group for mode == 'struct' and don't do aggr format (maybe later)
52-
const groupField = isRuleGroup && mode == "array" ? properties.get("field") : null;
52+
const groupField = isRuleGroup && mode != "struct" ? properties.get("field") : null;
5353
const canHaveEmptyChildren = isRuleGroup && mode == "array";
5454
const not = properties.get("not");
5555
const list = children
@@ -63,7 +63,7 @@ const formatGroup = (item, config, meta, isForDisplay = false, parentField = nul
6363
conjunction = defaultConjunction(config);
6464
const conjunctionDefinition = config.conjunctions[conjunction];
6565

66-
const conjStr = list.size ? conjunctionDefinition.formatConj(list, conjunction, not, isForDisplay) : null;
66+
const conjStr = list.size ? conjunctionDefinition.formatConj(list, conjunction, not, isForDisplay, groupField) : null;
6767

6868
let ret;
6969
if (groupField) {
@@ -192,8 +192,6 @@ const formatRule = (item, config, meta, isForDisplay = false, parentField = null
192192
const [formattedValue, valueSrc, valueType] = formatItemValue(
193193
config, properties, meta, operator, isForDisplay, parentField
194194
);
195-
if (formattedValue === undefined)
196-
return undefined;
197195

198196
const args = [
199197
formattedField,
@@ -211,6 +209,9 @@ const formatRule = (item, config, meta, isForDisplay = false, parentField = null
211209
if (returnArgs) {
212210
return args;
213211
} else {
212+
if (formattedValue === undefined)
213+
return undefined;
214+
214215
//format expr
215216
let ret = fn.call(config.ctx, ...args);
216217

@@ -274,7 +275,7 @@ const formatField = (config, meta, field, isForDisplay, parentField = null, cutP
274275
const fieldLabel2 = fieldDefinition.label2 || fieldFullLabel;
275276
const formatFieldFn = config.settings.formatField;
276277
const fieldName = formatFieldName(field, config, meta, cutParentField ? parentField : null, {useTableName: true});
277-
ret = formatFieldFn(fieldName, fieldParts, fieldLabel2, fieldDefinition, config, isForDisplay);
278+
ret = formatFieldFn(fieldName, fieldParts, fieldLabel2, fieldDefinition, config, isForDisplay, parentField);
278279
}
279280
return ret;
280281
};

packages/core/modules/index.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ export type Widgets<C = Config> = TypedMap<Widget<C>>;
534534
// Conjunctions
535535
/////////////////
536536

537-
type FormatConj = (children: ImmutableList<string>, conj: string, not: boolean, isForDisplay?: boolean) => string;
537+
type FormatConj = (children: ImmutableList<string>, conj: string, not: boolean, isForDisplay?: boolean, groupField?: string) => string;
538538
type SqlFormatConj = (children: ImmutableList<string>, conj: string, not: boolean) => string;
539539
type SpelFormatConj = (children: ImmutableList<string>, conj: string, not: boolean, omitBrackets?: boolean) => string;
540540

@@ -841,7 +841,7 @@ type ChangeFieldStrategy = "default" | "keep" | "first" | "none";
841841
type FormatReverse = (q: string, op: string, reversedOp: string, operatorDefinition: Operator, revOperatorDefinition: Operator, isForDisplay: boolean) => string;
842842
type SqlFormatReverse = (q: string) => string;
843843
type SpelFormatReverse = (q: string) => string;
844-
type FormatField = (field: string, parts: Array<string>, label2: string, fieldDefinition: Field, config: Config, isForDisplay: boolean) => string;
844+
type FormatField = (field: string, parts: Array<string>, label2: string, fieldDefinition: Field, config: Config, isForDisplay: boolean, parentField?: string) => string;
845845
type FormatSpelField = (field: string, parentField: string | null, parts: Array<string>, partsExt: Array<SpelFieldMeta>, fieldDefinition: Field, config: Config) => string;
846846
type CanCompareFieldWithField = (leftField: string, leftFieldConfig: Field, rightField: string, rightFieldConfig: Field, op: string) => boolean;
847847
type FormatAggr = (whereStr: string, aggrField: string, operator: string, value: string | ImmutableList<string>, valueSrc: ValueSource, valueType: string, opDef: Operator, operatorOptions: AnyObject, isForDisplay: boolean, aggrFieldDef: Field) => string;

0 commit comments

Comments
 (0)