Skip to content

Commit 1badbd3

Browse files
committed
wip #912 todo
1 parent 7688936 commit 1badbd3

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

packages/core/modules/export/queryString.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const formatGroup = (item, config, meta, parentField = null) => {
5454

5555
const isRuleGroup = (type === "rule_group");
5656
// TIP: don't cut group for mode == 'struct' and don't do aggr format (maybe later)
57-
const groupField = isRuleGroup && mode == "array" ? properties.get("field") : null;
57+
const groupField = isRuleGroup && mode === "array" ? properties.get("field") : null;
5858
const groupOperator = type === "rule_group" ? properties.get("operator") : null;
5959
const groupOperatorCardinality = groupOperator ? config.operators[groupOperator]?.cardinality ?? 1 : undefined;
6060
const canHaveEmptyChildren = isRuleGroup && mode === "array" && groupOperatorCardinality >= 1;
@@ -71,7 +71,7 @@ const formatGroup = (item, config, meta, parentField = null) => {
7171
conjunction = defaultConjunction(config);
7272
const conjunctionDefinition = config.conjunctions[conjunction];
7373

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

7676
let ret;
7777
if (groupField) {
@@ -245,6 +245,9 @@ const formatRule = (item, config, meta, parentField = null, returnArgs = false)
245245
if (returnArgs) {
246246
return args;
247247
} else {
248+
if (formattedValue === undefined)
249+
return undefined;
250+
248251
//format expr
249252
let ret = fn.call(config.ctx, ...args);
250253

@@ -317,7 +320,7 @@ const formatField = (config, meta, field, parentField = null, cutParentField = t
317320
const fieldLabel2 = fieldDefinition.label2 || fieldFullLabel;
318321
const formatFieldFn = config.settings.formatField;
319322
const fieldName = formatFieldName(field, config, meta, cutParentField ? parentField : null, {useTableName: true});
320-
ret = formatFieldFn(fieldName, fieldParts, fieldLabel2, fieldDefinition, config, isForDisplay);
323+
ret = formatFieldFn(fieldName, fieldParts, fieldLabel2, fieldDefinition, config, isForDisplay, parentField);
321324
} else if(isDebugMode) {
322325
ret = "?";
323326
}

packages/core/modules/index.d.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ export type Widgets<C = Config> = TypedMap<Widget<C>>;
919919
// Conjunctions
920920
/////////////////
921921

922-
type FormatConj = (children: ImmutableList<string>, conj: string, not: boolean, isForDisplay?: boolean) => string;
922+
type FormatConj = (children: ImmutableList<string>, conj: string, not: boolean, isForDisplay?: boolean, groupField?: string) => string;
923923
type SqlFormatConj = (children: ImmutableList<string>, conj: string, not: boolean) => string;
924924
type SpelFormatConj = (children: ImmutableList<string>, conj: string, not: boolean, omitBrackets?: boolean) => string;
925925

@@ -1240,7 +1240,7 @@ type ChangeFieldStrategy = "default" | "keep" | "first" | "none";
12401240
type FormatReverse = (q: string, op: string, reversedOp: string, operatorDefinition: Operator, revOperatorDefinition: Operator, isForDisplay: boolean) => string;
12411241
type SqlFormatReverse = (q: string) => string;
12421242
type SpelFormatReverse = (q: string) => string;
1243-
type FormatField = (field: FieldPath, parts: Array<string>, label2: string, fieldDefinition: Field, config: Config, isForDisplay: boolean) => string;
1243+
type FormatField = (field: FieldPath, parts: Array<string>, label2: string, fieldDefinition: Field, config: Config, isForDisplay: boolean, parentField?: string) => string;
12441244
type FormatSpelField = (field: FieldPath, parentField: FieldPath | null, parts: Array<string>, partsExt: Array<SpelFieldMeta>, fieldDefinition: Field, config: Config) => string;
12451245
type CanCompareFieldWithField = (leftField: FieldPath, leftFieldConfig: Field, rightField: FieldPath, rightFieldConfig: Field, op: string) => boolean;
12461246
type FormatAggr = (whereStr: string, aggrField: FieldPath, operator: string, value: string | ImmutableList<string>, valueSrc: ValueSource, valueType: string, opDef: Operator, operatorOptions: OperatorOptionsI, isForDisplay: boolean, aggrFieldDef: Field) => string;

0 commit comments

Comments
 (0)