@react-querybuilder/core 8.22.1 → 8.22.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5671,6 +5671,14 @@ interface QueryManagerOptions<F extends FullField = FullField, O extends FullOpe
5671
5671
  autoSelectOperator?: boolean;
5672
5672
  /** When `false`, an empty placeholder option is prepended to each value list. */
5673
5673
  autoSelectValue?: boolean;
5674
+ /**
5675
+ * Translations, accepting the same shape as the `translations` prop. Only the placeholder
5676
+ * properties of `fields`, `operators`, and `values` are used, and only when the corresponding
5677
+ * `autoSelect*` option is `false`; the remaining keys describe UI elements that have no
5678
+ * meaning outside the `QueryBuilder` component. Labels are typed as `unknown` so the React
5679
+ * `Translations` type, whose labels are `ReactNode`, can be passed as-is.
5680
+ */
5681
+ translations?: Partial<BaseTranslations<unknown>>;
5674
5682
  /** The default `field` for rules created by {@link QueryManager.createRule}. */
5675
5683
  getDefaultField?: string | ((fieldsData: FullOptionList<F>) => string);
5676
5684
  /** The default `operator` for a given field. */
@@ -6817,7 +6817,8 @@ var QueryManager = class QueryManager {
6817
6817
  const { optionList: fields, optionsMap: fieldMap } = prepareOptionList({
6818
6818
  optionList: options.fields,
6819
6819
  baseOption: options.baseField,
6820
- autoSelectOption: options.autoSelectField
6820
+ autoSelectOption: options.autoSelectField,
6821
+ placeholder: options.translations?.fields
6821
6822
  });
6822
6823
  this.#fields = (0, immer.freeze)(fields, true);
6823
6824
  this.#fieldMap = (0, immer.freeze)(fieldMap, true);
@@ -6825,7 +6826,8 @@ var QueryManager = class QueryManager {
6825
6826
  optionList: options.operators ?? defaultOperators,
6826
6827
  baseOption: options.baseOperator,
6827
6828
  labelMap: defaultOperatorLabelMap,
6828
- autoSelectOption: options.autoSelectOperator
6829
+ autoSelectOption: options.autoSelectOperator,
6830
+ placeholder: options.translations?.operators
6829
6831
  }).optionList;
6830
6832
  this.#combinators = (0, immer.freeze)(prepareOptionList({
6831
6833
  optionList: options.combinators ?? defaultCombinators,
@@ -6845,7 +6847,8 @@ var QueryManager = class QueryManager {
6845
6847
  getOperators: this.#options.getOperators,
6846
6848
  operators: this.#operators,
6847
6849
  baseOption: this.#options.baseOperator,
6848
- autoSelectOption: this.#options.autoSelectOperator
6850
+ autoSelectOption: this.#options.autoSelectOperator,
6851
+ placeholder: this.#options.translations?.operators
6849
6852
  });
6850
6853
  }
6851
6854
  /** Resolves the default operator for a field, mirroring `QueryBuilder`'s precedence. */
@@ -6869,7 +6872,8 @@ var QueryManager = class QueryManager {
6869
6872
  operator,
6870
6873
  fieldData: this.#fieldData(field),
6871
6874
  getValues: this.#options.getValues,
6872
- autoSelectOption: this.#options.autoSelectValue
6875
+ autoSelectOption: this.#options.autoSelectValue,
6876
+ placeholder: this.#options.translations?.values
6873
6877
  });
6874
6878
  }
6875
6879
  #valueEditorTypeFor(field, operator) {