Skip to content

Commit 51f6d13

Browse files
authored
edit (#1082)
1 parent 1337b37 commit 51f6d13

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

packages/core/modules/index.d.ts

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ export type FuncValueI = ObjectToImmOMap<{
162162
}>;
163163
export type FieldValue = FieldPath | FuncValue;
164164
export type FieldValueI = FieldPath | FuncValueI;
165+
export type AnyFieldValue = FieldValue | FieldValueI;
165166

166167
export type ValueSource = "value" | "field" | "func" | "const";
167168
export type FieldSource = "field" | "func";
@@ -537,33 +538,32 @@ interface ConfigUtils {
537538
decompressConfig(zipConfig: ZipConfig, baseConfig: Config, ctx?: ConfigContext): Config;
538539
compileConfig(config: Config): Config;
539540
extendConfig(config: Config): Config;
540-
getFieldConfig(config: Config, field: FieldValue | FieldValueI): Field | Func | null;
541+
getFieldConfig(config: Config, field: AnyFieldValue): FieldConfig;
541542
getFuncConfig(config: Config, func: string): Func | null;
542543
getFuncArgConfig(config: Config, func: string, arg: string): FuncArg | null;
543-
getOperatorConfig(config: Config, operator: string, field?: FieldValue | FieldValueI): Operator | null;
544-
getFieldWidgetConfig(config: Config, field: FieldValue | FieldValueI, operator: string, widget?: string, valueStr?: ValueSource): Widget | null;
544+
getOperatorConfig(config: Config, operator: string, field?: AnyFieldValue): Operator | null;
545+
getFieldWidgetConfig(config: Config, field: AnyFieldValue, operator: string, widget?: string, valueStr?: ValueSource): Widget | null;
545546
isJSX(jsx: any): boolean;
546547
isDirtyJSX(jsx: any): boolean;
547548
cleanJSX(jsx: any): Object;
548549
applyJsonLogic(logic: any, data?: any): any;
549550
}
550551
interface DefaultUtils {
551-
getDefaultField(config: Config, canGetFirst?: boolean, parentRuleGroupPath?: IdPath): Field;
552-
getDefaultSubField(config: Config, parentRuleGroupPath?: IdPath | null): Field;
552+
getDefaultField(config: Config, canGetFirst?: boolean, parentRuleGroupPath?: IdPath): FieldValueI | null;
553+
getDefaultSubField(config: Config, parentRuleGroupPath?: IdPath): FieldValueI | null;
553554
getDefaultFieldSrc(config: Config, canGetFirst?: boolean): string;
554555
getDefaultOperator(config: Config, field: Field, canGetFirst?: boolean): string;
555-
defaultOperatorOptions(config: Config, field: Field, canGetFirst?: boolean): string;
556-
emptyProperties<K, V>(): ImmutableMap<K, V>;
557-
createListFromArray<TItem>(array: TItem[]): ImmutableList<TItem>;
558-
defaultRule<K, V>(id: string, config: Config): Record<string, ImmutableMap<K, V>>;
559-
defaultRoot<K, V>(config: Config, canAddDefaultRule?: boolean): ImmutableMap<K, V>;
560-
createListWithOneElement<TItem>(el: TItem): ImmutableList<TItem>;
561-
defaultItemProperties(config: Config, item: JsonRule): ImmutableRuleProperties | ImmutableGroupProperties;
562-
defaultGroupProperties(config: Config, fieldConfig: Field | Func | null): ImmutableGroupProperties;
563-
defaultRuleProperties(config: Config, parentRuleGroupPath?: IdPath, item?: JsonRule, canUseDefaultFieldAndOp?: boolean, canGetFirst?: boolean): ImmutableRuleProperties;
556+
defaultRule(id: string, config: Config): Record<string, ImmutableRule>;
557+
defaultRoot(config: Config, canAddDefaultRule?: boolean): ImmutableGroup;
558+
defaultItemProperties(config: Config, item: JsonItem): ImmutableItemProperties;
559+
defaultGroupProperties(config: Config, fieldConfig?: FieldValueOrConfig): ImmutableGroupProperties;
560+
defaultRuleProperties(config: Config, parentRuleGroupPath?: IdPath, item?: JsonItem, canUseDefaultFieldAndOp?: boolean, canGetFirst?: boolean): ImmutableRuleProperties;
564561
defaultConjunction(config: Config): string;
565-
defaultOperatorOptions(config: Config, operator: string, field: Field): string;
566-
defaultGroupConjunction(config: Config, fieldConfig: Field | Func | null): string;
562+
defaultOperatorOptions(config: Config, operator: string, field: Field): OperatorOptionsI | null;
563+
defaultGroupConjunction(config: Config, fieldConfig?: FieldValueOrConfig): string;
564+
565+
// createListWithOneElement<TItem>(el: TItem): ImmutableList<TItem>;
566+
// createListFromArray<TItem>(array: TItem[]): ImmutableList<TItem>;
567567
}
568568
interface ExportUtils {
569569
wrapWithBrackets(val: string): string;
@@ -1280,6 +1280,9 @@ export type Field = SimpleField;
12801280
export type FieldOrGroup = FieldStruct | FieldGroup | FieldGroupExt | Field;
12811281
export type Fields = TypedMap<FieldOrGroup>;
12821282

1283+
export type FieldConfig = Field | Func | null;
1284+
export type FieldValueOrConfig = FieldConfig | AnyFieldValue;
1285+
12831286
export type NumberField = SimpleField<NumberFieldSettings>;
12841287
export type DateTimeField = SimpleField<DateTimeFieldSettings>;
12851288
export type SelectField = SimpleField<SelectFieldSettings>;
@@ -1361,7 +1364,7 @@ export interface LocaleSettings {
13611364
export interface BehaviourSettings {
13621365
reverseOperatorsForNot?: boolean;
13631366
canShortMongoQuery?: boolean;
1364-
defaultField?: FieldValue | FieldValueI;
1367+
defaultField?: AnyFieldValue;
13651368
defaultOperator?: string;
13661369
fieldSources?: Array<FieldSource>;
13671370
valueSourcesInfo?: ValueSourcesInfo;

0 commit comments

Comments
 (0)