@react-querybuilder/core 8.22.1 → 8.22.3
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.
- package/dist/cjs/react-querybuilder_core.cjs.development.d.ts +52 -0
- package/dist/cjs/react-querybuilder_core.cjs.development.js +93 -5
- package/dist/cjs/react-querybuilder_core.cjs.development.js.map +1 -1
- package/dist/cjs/react-querybuilder_core.cjs.production.d.ts +52 -0
- package/dist/cjs/react-querybuilder_core.cjs.production.js +1 -1
- package/dist/cjs/react-querybuilder_core.cjs.production.js.map +1 -1
- package/dist/react-querybuilder_core.d.mts +52 -0
- package/dist/react-querybuilder_core.legacy-esm.d.ts +52 -0
- package/dist/react-querybuilder_core.legacy-esm.js +132 -40
- package/dist/react-querybuilder_core.legacy-esm.js.map +1 -1
- package/dist/react-querybuilder_core.mjs +93 -5
- package/dist/react-querybuilder_core.mjs.map +1 -1
- package/dist/react-querybuilder_core.production.d.mts +52 -0
- package/dist/react-querybuilder_core.production.mjs +1 -1
- package/dist/react-querybuilder_core.production.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -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. */
|
|
@@ -5885,6 +5893,50 @@ declare class QueryManager<RG extends RuleGroupTypeAny = RuleGroupType, F extend
|
|
|
5885
5893
|
* `targetPathOrID` and `sourcePathOrID`.
|
|
5886
5894
|
*/
|
|
5887
5895
|
group(sourcePathOrID: Path | string, targetPathOrID: Path | string, options?: GroupOptions & StrictOptions): this;
|
|
5896
|
+
/**
|
|
5897
|
+
* The options currently in effect, as a frozen shallow copy. Reflects everything applied by
|
|
5898
|
+
* the constructor and any subsequent {@link QueryManager.reconfigure} calls, but not the
|
|
5899
|
+
* defaults filled in for options that were never provided.
|
|
5900
|
+
*/
|
|
5901
|
+
getOptions(): Readonly<QueryManagerOptions<F, O, C>>;
|
|
5902
|
+
/**
|
|
5903
|
+
* Updates the manager's configuration in place, keeping the current query, the undo/redo
|
|
5904
|
+
* history, and every subscriber. Use this to propagate new `translations`, `fields`,
|
|
5905
|
+
* `operators`, and so on without discarding state:
|
|
5906
|
+
*
|
|
5907
|
+
* ```ts
|
|
5908
|
+
* q.reconfigure({ translations: { fields: { placeholderLabel: 'Choisir un champ' } } });
|
|
5909
|
+
* ```
|
|
5910
|
+
*
|
|
5911
|
+
* The incoming options are shallow-merged over the current ones, so keys left out are
|
|
5912
|
+
* preserved. Passing a key explicitly as `undefined` resets it to its default. Object-valued
|
|
5913
|
+
* options like `translations` are replaced wholesale rather than deep-merged — spread the
|
|
5914
|
+
* current value in yourself to patch one key. Pass `{ replace: true }` to discard the
|
|
5915
|
+
* existing options entirely and start from the incoming set.
|
|
5916
|
+
*
|
|
5917
|
+
* The query is never rewritten, even when the new options no longer describe it: a rule whose
|
|
5918
|
+
* `field` is not in the new `fields` list is left as-is. Call
|
|
5919
|
+
* {@link QueryManager.validate validate} to detect that, or `setQuery(getQuery())` to
|
|
5920
|
+
* re-normalize.
|
|
5921
|
+
*
|
|
5922
|
+
* History options are honored immediately: lowering `maxHistory` trims the undo stack, and
|
|
5923
|
+
* turning history off clears both stacks. Subscribers are notified once, and
|
|
5924
|
+
* {@link QueryManager.getConfigVersion} is incremented, even inside a
|
|
5925
|
+
* {@link QueryManager.batch batch} — configuration is not part of a batch's rollback.
|
|
5926
|
+
*/
|
|
5927
|
+
reconfigure(options: Partial<QueryManagerOptions<F, O, C>>, config?: {
|
|
5928
|
+
replace?: boolean;
|
|
5929
|
+
}): this;
|
|
5930
|
+
/**
|
|
5931
|
+
* A counter incremented by every {@link QueryManager.reconfigure} call. Because reconfiguring
|
|
5932
|
+
* leaves the query object untouched, subscribers that compare query identity alone cannot see
|
|
5933
|
+
* it; this provides a snapshot that does change.
|
|
5934
|
+
*
|
|
5935
|
+
* Bound to the instance, so it can be passed directly to `useSyncExternalStore` alongside
|
|
5936
|
+
* {@link QueryManager.subscribe}. The `useQueryManager` hook from `react-querybuilder`
|
|
5937
|
+
* already does this.
|
|
5938
|
+
*/
|
|
5939
|
+
getConfigVersion: () => number;
|
|
5888
5940
|
/**
|
|
5889
5941
|
* Creates an independent manager with the same configuration and the current query.
|
|
5890
5942
|
*
|
|
@@ -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. */
|
|
@@ -5885,6 +5893,50 @@ declare class QueryManager<RG extends RuleGroupTypeAny = RuleGroupType, F extend
|
|
|
5885
5893
|
* `targetPathOrID` and `sourcePathOrID`.
|
|
5886
5894
|
*/
|
|
5887
5895
|
group(sourcePathOrID: Path | string, targetPathOrID: Path | string, options?: GroupOptions & StrictOptions): this;
|
|
5896
|
+
/**
|
|
5897
|
+
* The options currently in effect, as a frozen shallow copy. Reflects everything applied by
|
|
5898
|
+
* the constructor and any subsequent {@link QueryManager.reconfigure} calls, but not the
|
|
5899
|
+
* defaults filled in for options that were never provided.
|
|
5900
|
+
*/
|
|
5901
|
+
getOptions(): Readonly<QueryManagerOptions<F, O, C>>;
|
|
5902
|
+
/**
|
|
5903
|
+
* Updates the manager's configuration in place, keeping the current query, the undo/redo
|
|
5904
|
+
* history, and every subscriber. Use this to propagate new `translations`, `fields`,
|
|
5905
|
+
* `operators`, and so on without discarding state:
|
|
5906
|
+
*
|
|
5907
|
+
* ```ts
|
|
5908
|
+
* q.reconfigure({ translations: { fields: { placeholderLabel: 'Choisir un champ' } } });
|
|
5909
|
+
* ```
|
|
5910
|
+
*
|
|
5911
|
+
* The incoming options are shallow-merged over the current ones, so keys left out are
|
|
5912
|
+
* preserved. Passing a key explicitly as `undefined` resets it to its default. Object-valued
|
|
5913
|
+
* options like `translations` are replaced wholesale rather than deep-merged — spread the
|
|
5914
|
+
* current value in yourself to patch one key. Pass `{ replace: true }` to discard the
|
|
5915
|
+
* existing options entirely and start from the incoming set.
|
|
5916
|
+
*
|
|
5917
|
+
* The query is never rewritten, even when the new options no longer describe it: a rule whose
|
|
5918
|
+
* `field` is not in the new `fields` list is left as-is. Call
|
|
5919
|
+
* {@link QueryManager.validate validate} to detect that, or `setQuery(getQuery())` to
|
|
5920
|
+
* re-normalize.
|
|
5921
|
+
*
|
|
5922
|
+
* History options are honored immediately: lowering `maxHistory` trims the undo stack, and
|
|
5923
|
+
* turning history off clears both stacks. Subscribers are notified once, and
|
|
5924
|
+
* {@link QueryManager.getConfigVersion} is incremented, even inside a
|
|
5925
|
+
* {@link QueryManager.batch batch} — configuration is not part of a batch's rollback.
|
|
5926
|
+
*/
|
|
5927
|
+
reconfigure(options: Partial<QueryManagerOptions<F, O, C>>, config?: {
|
|
5928
|
+
replace?: boolean;
|
|
5929
|
+
}): this;
|
|
5930
|
+
/**
|
|
5931
|
+
* A counter incremented by every {@link QueryManager.reconfigure} call. Because reconfiguring
|
|
5932
|
+
* leaves the query object untouched, subscribers that compare query identity alone cannot see
|
|
5933
|
+
* it; this provides a snapshot that does change.
|
|
5934
|
+
*
|
|
5935
|
+
* Bound to the instance, so it can be passed directly to `useSyncExternalStore` alongside
|
|
5936
|
+
* {@link QueryManager.subscribe}. The `useQueryManager` hook from `react-querybuilder`
|
|
5937
|
+
* already does this.
|
|
5938
|
+
*/
|
|
5939
|
+
getConfigVersion: () => number;
|
|
5888
5940
|
/**
|
|
5889
5941
|
* Creates an independent manager with the same configuration and the current query.
|
|
5890
5942
|
*
|
|
@@ -6891,6 +6891,7 @@ var _historyEnabled = /* @__PURE__ */ new WeakMap();
|
|
|
6891
6891
|
var _maxHistory = /* @__PURE__ */ new WeakMap();
|
|
6892
6892
|
var _coalesceMs = /* @__PURE__ */ new WeakMap();
|
|
6893
6893
|
var _now = /* @__PURE__ */ new WeakMap();
|
|
6894
|
+
var _configVersion = /* @__PURE__ */ new WeakMap();
|
|
6894
6895
|
var _past = /* @__PURE__ */ new WeakMap();
|
|
6895
6896
|
var _future = /* @__PURE__ */ new WeakMap();
|
|
6896
6897
|
var _lastSig = /* @__PURE__ */ new WeakMap();
|
|
@@ -6928,7 +6929,6 @@ _Symbol$iterator = Symbol.iterator;
|
|
|
6928
6929
|
*/
|
|
6929
6930
|
var QueryManager = class QueryManager {
|
|
6930
6931
|
constructor(query, options = {}) {
|
|
6931
|
-
var _options$idGenerator, _options$validator, _options$strict, _options$respectDisab, _options$history, _historyOptions$maxHi, _historyOptions$coale, _options$now, _options$operators, _options$combinators;
|
|
6932
6932
|
_classPrivateMethodInitSpec(this, _QueryManager_brand);
|
|
6933
6933
|
_classPrivateFieldInitSpec(this, _query, void 0);
|
|
6934
6934
|
_classPrivateFieldInitSpec(this, _options, void 0);
|
|
@@ -6946,6 +6946,7 @@ var QueryManager = class QueryManager {
|
|
|
6946
6946
|
_classPrivateFieldInitSpec(this, _maxHistory, void 0);
|
|
6947
6947
|
_classPrivateFieldInitSpec(this, _coalesceMs, void 0);
|
|
6948
6948
|
_classPrivateFieldInitSpec(this, _now, void 0);
|
|
6949
|
+
_classPrivateFieldInitSpec(this, _configVersion, 0);
|
|
6949
6950
|
_classPrivateFieldInitSpec(this, _past, []);
|
|
6950
6951
|
_classPrivateFieldInitSpec(this, _future, []);
|
|
6951
6952
|
_classPrivateFieldInitSpec(this, _lastSig, void 0);
|
|
@@ -6968,6 +6969,20 @@ var QueryManager = class QueryManager {
|
|
|
6968
6969
|
"getQuery",
|
|
6969
6970
|
() => _classPrivateFieldGet2(_query, this)
|
|
6970
6971
|
);
|
|
6972
|
+
_defineProperty(
|
|
6973
|
+
this,
|
|
6974
|
+
/**
|
|
6975
|
+
* A counter incremented by every {@link QueryManager.reconfigure} call. Because reconfiguring
|
|
6976
|
+
* leaves the query object untouched, subscribers that compare query identity alone cannot see
|
|
6977
|
+
* it; this provides a snapshot that does change.
|
|
6978
|
+
*
|
|
6979
|
+
* Bound to the instance, so it can be passed directly to `useSyncExternalStore` alongside
|
|
6980
|
+
* {@link QueryManager.subscribe}. The `useQueryManager` hook from `react-querybuilder`
|
|
6981
|
+
* already does this.
|
|
6982
|
+
*/
|
|
6983
|
+
"getConfigVersion",
|
|
6984
|
+
() => _classPrivateFieldGet2(_configVersion, this)
|
|
6985
|
+
);
|
|
6971
6986
|
_defineProperty(
|
|
6972
6987
|
this,
|
|
6973
6988
|
/**
|
|
@@ -6993,35 +7008,7 @@ var QueryManager = class QueryManager {
|
|
|
6993
7008
|
};
|
|
6994
7009
|
}
|
|
6995
7010
|
);
|
|
6996
|
-
|
|
6997
|
-
_classPrivateFieldSet2(_idGenerator, this, (_options$idGenerator = options.idGenerator) !== null && _options$idGenerator !== void 0 ? _options$idGenerator : generateID);
|
|
6998
|
-
_classPrivateFieldSet2(_validator, this, (_options$validator = options.validator) !== null && _options$validator !== void 0 ? _options$validator : defaultValidator);
|
|
6999
|
-
_classPrivateFieldSet2(_strict, this, (_options$strict = options.strict) !== null && _options$strict !== void 0 ? _options$strict : false);
|
|
7000
|
-
_classPrivateFieldSet2(_respectDisabled, this, (_options$respectDisab = options.respectDisabled) !== null && _options$respectDisab !== void 0 ? _options$respectDisab : true);
|
|
7001
|
-
_classPrivateFieldSet2(_onInvalidTarget, this, options.onInvalidTarget);
|
|
7002
|
-
const history = (_options$history = options.history) !== null && _options$history !== void 0 ? _options$history : false;
|
|
7003
|
-
const historyOptions = typeof history === "object" ? history : {};
|
|
7004
|
-
_classPrivateFieldSet2(_historyEnabled, this, history !== false);
|
|
7005
|
-
_classPrivateFieldSet2(_maxHistory, this, (_historyOptions$maxHi = historyOptions.maxHistory) !== null && _historyOptions$maxHi !== void 0 ? _historyOptions$maxHi : 50);
|
|
7006
|
-
_classPrivateFieldSet2(_coalesceMs, this, (_historyOptions$coale = historyOptions.coalesceMs) !== null && _historyOptions$coale !== void 0 ? _historyOptions$coale : 500);
|
|
7007
|
-
_classPrivateFieldSet2(_now, this, (_options$now = options.now) !== null && _options$now !== void 0 ? _options$now : Date.now);
|
|
7008
|
-
const { optionList: fields, optionsMap: fieldMap } = prepareOptionList({
|
|
7009
|
-
optionList: options.fields,
|
|
7010
|
-
baseOption: options.baseField,
|
|
7011
|
-
autoSelectOption: options.autoSelectField
|
|
7012
|
-
});
|
|
7013
|
-
_classPrivateFieldSet2(_fields, this, freeze(fields, true));
|
|
7014
|
-
_classPrivateFieldSet2(_fieldMap, this, freeze(fieldMap, true));
|
|
7015
|
-
_classPrivateFieldSet2(_operators, this, prepareOptionList({
|
|
7016
|
-
optionList: (_options$operators = options.operators) !== null && _options$operators !== void 0 ? _options$operators : defaultOperators,
|
|
7017
|
-
baseOption: options.baseOperator,
|
|
7018
|
-
labelMap: defaultOperatorLabelMap,
|
|
7019
|
-
autoSelectOption: options.autoSelectOperator
|
|
7020
|
-
}).optionList);
|
|
7021
|
-
_classPrivateFieldSet2(_combinators, this, freeze(prepareOptionList({
|
|
7022
|
-
optionList: (_options$combinators = options.combinators) !== null && _options$combinators !== void 0 ? _options$combinators : defaultCombinators,
|
|
7023
|
-
baseOption: options.baseCombinator
|
|
7024
|
-
}).optionList, true));
|
|
7011
|
+
_assertClassBrand(_QueryManager_brand, this, _applyOptions).call(this, options);
|
|
7025
7012
|
_classPrivateFieldSet2(_query, this, freeze(query ? prepareRuleGroup(query, { idGenerator: _classPrivateFieldGet2(_idGenerator, this) }) : this.createRuleGroup(), true));
|
|
7026
7013
|
}
|
|
7027
7014
|
/** Replaces the current query, ensuring every rule and group has an `id`. */
|
|
@@ -7128,6 +7115,48 @@ var QueryManager = class QueryManager {
|
|
|
7128
7115
|
return this;
|
|
7129
7116
|
}
|
|
7130
7117
|
/**
|
|
7118
|
+
* The options currently in effect, as a frozen shallow copy. Reflects everything applied by
|
|
7119
|
+
* the constructor and any subsequent {@link QueryManager.reconfigure} calls, but not the
|
|
7120
|
+
* defaults filled in for options that were never provided.
|
|
7121
|
+
*/
|
|
7122
|
+
getOptions() {
|
|
7123
|
+
return freeze(_objectSpread2({}, _classPrivateFieldGet2(_options, this)));
|
|
7124
|
+
}
|
|
7125
|
+
/**
|
|
7126
|
+
* Updates the manager's configuration in place, keeping the current query, the undo/redo
|
|
7127
|
+
* history, and every subscriber. Use this to propagate new `translations`, `fields`,
|
|
7128
|
+
* `operators`, and so on without discarding state:
|
|
7129
|
+
*
|
|
7130
|
+
* ```ts
|
|
7131
|
+
* q.reconfigure({ translations: { fields: { placeholderLabel: 'Choisir un champ' } } });
|
|
7132
|
+
* ```
|
|
7133
|
+
*
|
|
7134
|
+
* The incoming options are shallow-merged over the current ones, so keys left out are
|
|
7135
|
+
* preserved. Passing a key explicitly as `undefined` resets it to its default. Object-valued
|
|
7136
|
+
* options like `translations` are replaced wholesale rather than deep-merged — spread the
|
|
7137
|
+
* current value in yourself to patch one key. Pass `{ replace: true }` to discard the
|
|
7138
|
+
* existing options entirely and start from the incoming set.
|
|
7139
|
+
*
|
|
7140
|
+
* The query is never rewritten, even when the new options no longer describe it: a rule whose
|
|
7141
|
+
* `field` is not in the new `fields` list is left as-is. Call
|
|
7142
|
+
* {@link QueryManager.validate validate} to detect that, or `setQuery(getQuery())` to
|
|
7143
|
+
* re-normalize.
|
|
7144
|
+
*
|
|
7145
|
+
* History options are honored immediately: lowering `maxHistory` trims the undo stack, and
|
|
7146
|
+
* turning history off clears both stacks. Subscribers are notified once, and
|
|
7147
|
+
* {@link QueryManager.getConfigVersion} is incremented, even inside a
|
|
7148
|
+
* {@link QueryManager.batch batch} — configuration is not part of a batch's rollback.
|
|
7149
|
+
*/
|
|
7150
|
+
reconfigure(options, config) {
|
|
7151
|
+
var _this$configVersion;
|
|
7152
|
+
_assertClassBrand(_QueryManager_brand, this, _applyOptions).call(this, freeze((config === null || config === void 0 ? void 0 : config.replace) ? _objectSpread2({}, options) : _objectSpread2(_objectSpread2({}, _classPrivateFieldGet2(_options, this)), options)));
|
|
7153
|
+
_classPrivateFieldSet2(_validation, this, void 0);
|
|
7154
|
+
_assertClassBrand(_QueryManager_brand, this, _reconcileHistoryConfig).call(this);
|
|
7155
|
+
_classPrivateFieldSet2(_configVersion, this, (_this$configVersion = _classPrivateFieldGet2(_configVersion, this), ++_this$configVersion));
|
|
7156
|
+
_assertClassBrand(_QueryManager_brand, this, _notify).call(this);
|
|
7157
|
+
return this;
|
|
7158
|
+
}
|
|
7159
|
+
/**
|
|
7131
7160
|
* Creates an independent manager with the same configuration and the current query.
|
|
7132
7161
|
*
|
|
7133
7162
|
* Subscribers and history are _not_ carried over: the clone starts with no listeners and an
|
|
@@ -7175,6 +7204,7 @@ var QueryManager = class QueryManager {
|
|
|
7175
7204
|
_classPrivateFieldSet2(_future, this, snapshot.future);
|
|
7176
7205
|
_classPrivateFieldSet2(_lastSig, this, snapshot.lastSig);
|
|
7177
7206
|
_classPrivateFieldSet2(_lastAt, this, snapshot.lastAt);
|
|
7207
|
+
_assertClassBrand(_QueryManager_brand, this, _reconcileHistoryConfig).call(this);
|
|
7178
7208
|
}
|
|
7179
7209
|
throw error;
|
|
7180
7210
|
} finally {
|
|
@@ -7245,9 +7275,9 @@ var QueryManager = class QueryManager {
|
|
|
7245
7275
|
* one that depends on anything other than the query) may run fewer times than expected.
|
|
7246
7276
|
*/
|
|
7247
7277
|
validate() {
|
|
7248
|
-
var
|
|
7278
|
+
var _classPrivateFieldGet6;
|
|
7249
7279
|
_assertClassBrand(_QueryManager_brand, this, _ensureCache).call(this);
|
|
7250
|
-
(
|
|
7280
|
+
(_classPrivateFieldGet6 = _classPrivateFieldGet2(_validation, this)) !== null && _classPrivateFieldGet6 !== void 0 || _classPrivateFieldSet2(_validation, this, _classPrivateFieldGet2(_validator, this).call(this, _classPrivateFieldGet2(_query, this)));
|
|
7251
7281
|
return _classPrivateFieldGet2(_validation, this);
|
|
7252
7282
|
}
|
|
7253
7283
|
format(options) {
|
|
@@ -7437,8 +7467,8 @@ var QueryManager = class QueryManager {
|
|
|
7437
7467
|
fields: _classPrivateFieldGet2(_fields, this),
|
|
7438
7468
|
fieldMap: _classPrivateFieldGet2(_fieldMap, this),
|
|
7439
7469
|
getInputType: (f, o, misc) => {
|
|
7440
|
-
var _this$options$getInpu,
|
|
7441
|
-
return (_this$options$getInpu = (
|
|
7470
|
+
var _this$options$getInpu, _classPrivateFieldGet7, _classPrivateFieldGet8;
|
|
7471
|
+
return (_this$options$getInpu = (_classPrivateFieldGet7 = (_classPrivateFieldGet8 = _classPrivateFieldGet2(_options, this)).getInputType) === null || _classPrivateFieldGet7 === void 0 ? void 0 : _classPrivateFieldGet7.call(_classPrivateFieldGet8, f, o, misc)) !== null && _this$options$getInpu !== void 0 ? _this$options$getInpu : null;
|
|
7442
7472
|
},
|
|
7443
7473
|
getMatchModes: (f) => _assertClassBrand(_QueryManager_brand, this, _matchModesFor).call(this, f),
|
|
7444
7474
|
getOperators: (f) => _assertClassBrand(_QueryManager_brand, this, _operatorsFor).call(this, f),
|
|
@@ -7447,8 +7477,8 @@ var QueryManager = class QueryManager {
|
|
|
7447
7477
|
getValues: (f, o) => _assertClassBrand(_QueryManager_brand, this, _valuesFor).call(this, f, o),
|
|
7448
7478
|
getValueSources: (f, o) => this.getValueSources(f, o),
|
|
7449
7479
|
getSubQueryBuilderProps: (f, misc) => {
|
|
7450
|
-
var _this$options$getSubQ,
|
|
7451
|
-
return (_this$options$getSubQ = (
|
|
7480
|
+
var _this$options$getSubQ, _classPrivateFieldGet9, _classPrivateFieldGet10;
|
|
7481
|
+
return (_this$options$getSubQ = (_classPrivateFieldGet9 = (_classPrivateFieldGet10 = _classPrivateFieldGet2(_options, this)).getSubQueryBuilderProps) === null || _classPrivateFieldGet9 === void 0 ? void 0 : _classPrivateFieldGet9.call(_classPrivateFieldGet10, f, misc)) !== null && _this$options$getSubQ !== void 0 ? _this$options$getSubQ : {};
|
|
7452
7482
|
}
|
|
7453
7483
|
}, {
|
|
7454
7484
|
validationMap: typeof validation === "boolean" ? {} : validation,
|
|
@@ -7519,6 +7549,45 @@ var QueryManager = class QueryManager {
|
|
|
7519
7549
|
return transformQuery(_classPrivateFieldGet2(_query, this), options);
|
|
7520
7550
|
}
|
|
7521
7551
|
};
|
|
7552
|
+
/**
|
|
7553
|
+
* Assigns `#options` and every field derived from it. Shared by the constructor and
|
|
7554
|
+
* {@link QueryManager.reconfigure}, so the two can never drift apart. Does not touch the
|
|
7555
|
+
* query, the history stacks, the caches, or the subscriber list.
|
|
7556
|
+
*/
|
|
7557
|
+
function _applyOptions(options) {
|
|
7558
|
+
var _options$idGenerator, _options$validator, _options$strict, _options$respectDisab, _options$history, _historyOptions$maxHi, _historyOptions$coale, _options$now, _options$translations, _options$operators, _options$translations2, _options$combinators;
|
|
7559
|
+
_classPrivateFieldSet2(_options, this, options);
|
|
7560
|
+
_classPrivateFieldSet2(_idGenerator, this, (_options$idGenerator = options.idGenerator) !== null && _options$idGenerator !== void 0 ? _options$idGenerator : generateID);
|
|
7561
|
+
_classPrivateFieldSet2(_validator, this, (_options$validator = options.validator) !== null && _options$validator !== void 0 ? _options$validator : defaultValidator);
|
|
7562
|
+
_classPrivateFieldSet2(_strict, this, (_options$strict = options.strict) !== null && _options$strict !== void 0 ? _options$strict : false);
|
|
7563
|
+
_classPrivateFieldSet2(_respectDisabled, this, (_options$respectDisab = options.respectDisabled) !== null && _options$respectDisab !== void 0 ? _options$respectDisab : true);
|
|
7564
|
+
_classPrivateFieldSet2(_onInvalidTarget, this, options.onInvalidTarget);
|
|
7565
|
+
const history = (_options$history = options.history) !== null && _options$history !== void 0 ? _options$history : false;
|
|
7566
|
+
const historyOptions = typeof history === "object" ? history : {};
|
|
7567
|
+
_classPrivateFieldSet2(_historyEnabled, this, history !== false);
|
|
7568
|
+
_classPrivateFieldSet2(_maxHistory, this, (_historyOptions$maxHi = historyOptions.maxHistory) !== null && _historyOptions$maxHi !== void 0 ? _historyOptions$maxHi : 50);
|
|
7569
|
+
_classPrivateFieldSet2(_coalesceMs, this, (_historyOptions$coale = historyOptions.coalesceMs) !== null && _historyOptions$coale !== void 0 ? _historyOptions$coale : 500);
|
|
7570
|
+
_classPrivateFieldSet2(_now, this, (_options$now = options.now) !== null && _options$now !== void 0 ? _options$now : Date.now);
|
|
7571
|
+
const { optionList: fields, optionsMap: fieldMap } = prepareOptionList({
|
|
7572
|
+
optionList: options.fields,
|
|
7573
|
+
baseOption: options.baseField,
|
|
7574
|
+
autoSelectOption: options.autoSelectField,
|
|
7575
|
+
placeholder: (_options$translations = options.translations) === null || _options$translations === void 0 ? void 0 : _options$translations.fields
|
|
7576
|
+
});
|
|
7577
|
+
_classPrivateFieldSet2(_fields, this, freeze(fields, true));
|
|
7578
|
+
_classPrivateFieldSet2(_fieldMap, this, freeze(fieldMap, true));
|
|
7579
|
+
_classPrivateFieldSet2(_operators, this, prepareOptionList({
|
|
7580
|
+
optionList: (_options$operators = options.operators) !== null && _options$operators !== void 0 ? _options$operators : defaultOperators,
|
|
7581
|
+
baseOption: options.baseOperator,
|
|
7582
|
+
labelMap: defaultOperatorLabelMap,
|
|
7583
|
+
autoSelectOption: options.autoSelectOperator,
|
|
7584
|
+
placeholder: (_options$translations2 = options.translations) === null || _options$translations2 === void 0 ? void 0 : _options$translations2.operators
|
|
7585
|
+
}).optionList);
|
|
7586
|
+
_classPrivateFieldSet2(_combinators, this, freeze(prepareOptionList({
|
|
7587
|
+
optionList: (_options$combinators = options.combinators) !== null && _options$combinators !== void 0 ? _options$combinators : defaultCombinators,
|
|
7588
|
+
baseOption: options.baseCombinator
|
|
7589
|
+
}).optionList, true));
|
|
7590
|
+
}
|
|
7522
7591
|
/** Resolves the field configuration for a field name. */
|
|
7523
7592
|
function _fieldData(field) {
|
|
7524
7593
|
var _this$fieldMap$field;
|
|
@@ -7526,13 +7595,15 @@ function _fieldData(field) {
|
|
|
7526
7595
|
}
|
|
7527
7596
|
/** Resolves the operator list for a field, mirroring `QueryBuilder`'s precedence. */
|
|
7528
7597
|
function _operatorsFor(field) {
|
|
7598
|
+
var _classPrivateFieldGet2$1;
|
|
7529
7599
|
return resolveOperatorList({
|
|
7530
7600
|
field,
|
|
7531
7601
|
fieldData: _assertClassBrand(_QueryManager_brand, this, _fieldData).call(this, field),
|
|
7532
7602
|
getOperators: _classPrivateFieldGet2(_options, this).getOperators,
|
|
7533
7603
|
operators: _classPrivateFieldGet2(_operators, this),
|
|
7534
7604
|
baseOption: _classPrivateFieldGet2(_options, this).baseOperator,
|
|
7535
|
-
autoSelectOption: _classPrivateFieldGet2(_options, this).autoSelectOperator
|
|
7605
|
+
autoSelectOption: _classPrivateFieldGet2(_options, this).autoSelectOperator,
|
|
7606
|
+
placeholder: (_classPrivateFieldGet2$1 = _classPrivateFieldGet2(_options, this).translations) === null || _classPrivateFieldGet2$1 === void 0 ? void 0 : _classPrivateFieldGet2$1.operators
|
|
7536
7607
|
});
|
|
7537
7608
|
}
|
|
7538
7609
|
/** Resolves the default operator for a field, mirroring `QueryBuilder`'s precedence. */
|
|
@@ -7551,12 +7622,14 @@ function _matchModesFor(field) {
|
|
|
7551
7622
|
return getMatchModesUtil(_assertClassBrand(_QueryManager_brand, this, _fieldData).call(this, field), _classPrivateFieldGet2(_options, this).getMatchModes);
|
|
7552
7623
|
}
|
|
7553
7624
|
function _valuesFor(field, operator) {
|
|
7625
|
+
var _classPrivateFieldGet3;
|
|
7554
7626
|
return resolveValueList({
|
|
7555
7627
|
field,
|
|
7556
7628
|
operator,
|
|
7557
7629
|
fieldData: _assertClassBrand(_QueryManager_brand, this, _fieldData).call(this, field),
|
|
7558
7630
|
getValues: _classPrivateFieldGet2(_options, this).getValues,
|
|
7559
|
-
autoSelectOption: _classPrivateFieldGet2(_options, this).autoSelectValue
|
|
7631
|
+
autoSelectOption: _classPrivateFieldGet2(_options, this).autoSelectValue,
|
|
7632
|
+
placeholder: (_classPrivateFieldGet3 = _classPrivateFieldGet2(_options, this).translations) === null || _classPrivateFieldGet3 === void 0 ? void 0 : _classPrivateFieldGet3.values
|
|
7560
7633
|
});
|
|
7561
7634
|
}
|
|
7562
7635
|
function _valueEditorTypeFor(field, operator) {
|
|
@@ -7586,9 +7659,9 @@ function _defaultValue(rule) {
|
|
|
7586
7659
|
* {@link QueryManager.getRuleContext} so both see the same shape.
|
|
7587
7660
|
*/
|
|
7588
7661
|
function _parametersFor(field, operator, misc) {
|
|
7589
|
-
var _this$options$getPara,
|
|
7662
|
+
var _this$options$getPara, _classPrivateFieldGet4, _classPrivateFieldGet5;
|
|
7590
7663
|
return prepareOptionList({
|
|
7591
|
-
optionList: (_this$options$getPara = (
|
|
7664
|
+
optionList: (_this$options$getPara = (_classPrivateFieldGet4 = (_classPrivateFieldGet5 = _classPrivateFieldGet2(_options, this)).getParameters) === null || _classPrivateFieldGet4 === void 0 ? void 0 : _classPrivateFieldGet4.call(_classPrivateFieldGet5, field, operator, misc)) !== null && _this$options$getPara !== void 0 ? _this$options$getPara : [],
|
|
7592
7665
|
autoSelectOption: _classPrivateFieldGet2(_options, this).autoSelectValue
|
|
7593
7666
|
}).optionList;
|
|
7594
7667
|
}
|
|
@@ -7717,6 +7790,25 @@ function _toPath(pathOrID) {
|
|
|
7717
7790
|
var _this$index$get;
|
|
7718
7791
|
return typeof pathOrID === "string" ? (_this$index$get = _assertClassBrand(_QueryManager_brand, this, _index).call(this).get(pathOrID)) !== null && _this$index$get !== void 0 ? _this$index$get : null : pathOrID;
|
|
7719
7792
|
}
|
|
7793
|
+
/**
|
|
7794
|
+
* Brings the history stacks in line with the current history configuration. Unlike
|
|
7795
|
+
* {@link QueryManager.clearHistory}, this does _not_ set `#historyBypassed`: it reflects a
|
|
7796
|
+
* configuration change rather than a deliberate history repositioning, so a later mutation in
|
|
7797
|
+
* the same batch must still be recorded normally.
|
|
7798
|
+
*
|
|
7799
|
+
* Called by {@link QueryManager.reconfigure} and again after a failed
|
|
7800
|
+
* {@link QueryManager.batch batch} restores its snapshot, since that snapshot predates the
|
|
7801
|
+
* configuration change (configuration is not part of a batch's rollback).
|
|
7802
|
+
*/
|
|
7803
|
+
function _reconcileHistoryConfig() {
|
|
7804
|
+
if (_classPrivateFieldGet2(_historyEnabled, this)) {
|
|
7805
|
+
if (_classPrivateFieldGet2(_past, this).length > _classPrivateFieldGet2(_maxHistory, this)) _classPrivateFieldGet2(_past, this).splice(0, _classPrivateFieldGet2(_past, this).length - _classPrivateFieldGet2(_maxHistory, this));
|
|
7806
|
+
} else {
|
|
7807
|
+
_classPrivateFieldSet2(_past, this, []);
|
|
7808
|
+
_classPrivateFieldSet2(_future, this, []);
|
|
7809
|
+
_classPrivateFieldSet2(_lastSig, this, void 0);
|
|
7810
|
+
}
|
|
7811
|
+
}
|
|
7720
7812
|
//#endregion
|
|
7721
7813
|
export { LogType, QueryManager, QueryManagerError, TestID, add, addInPlace, betweenOperators, bigIntJsonParseReviver, bigIntJsonStringifyReplacer, celCombinatorMap, clsx, coerceBigIntValue, coerceInputType, convertFromIC, convertQuery, convertToIC, createQueryActions, createRule, createRuleGroup, cypherCombinatorMap, defaultCELValueProcessor, defaultCoalesceMs, defaultCombinatorLabelMap, defaultCombinators, defaultCombinatorsExtended, defaultControlClassnames, defaultExportOperatorMap, defaultJoinChar, defaultMatchModes, defaultMaxHistory, defaultMongoDBValueProcessor, defaultNLTranslations, defaultOperatorLabelMap, defaultOperatorNegationMap, defaultOperatorProcessorNL, defaultOperatorProcessorSQL, defaultOperators, defaultPlaceholderFieldGroupLabel, defaultPlaceholderFieldLabel, defaultPlaceholderFieldName, defaultPlaceholderLabel, defaultPlaceholderName, defaultPlaceholderOperatorGroupLabel, defaultPlaceholderOperatorLabel, defaultPlaceholderOperatorName, defaultPlaceholderValueGroupLabel, defaultPlaceholderValueLabel, defaultPlaceholderValueName, defaultRuleGroupProcessorCEL, defaultRuleGroupProcessorCypher, defaultRuleGroupProcessorDiagnostics, defaultRuleGroupProcessorDrizzle, defaultRuleGroupProcessorElasticSearch, defaultRuleGroupProcessorGremlin, defaultRuleGroupProcessorJSONata, defaultRuleGroupProcessorJsonLogic, defaultRuleGroupProcessorLDAP, defaultRuleGroupProcessorMongoDB, defaultRuleGroupProcessorMongoDBQuery, defaultRuleGroupProcessorNL, defaultRuleGroupProcessorParameterized, defaultRuleGroupProcessorPrisma, defaultRuleGroupProcessorSPARQL, defaultRuleGroupProcessorSQL, defaultRuleGroupProcessorSequelize, defaultRuleGroupProcessorSpEL, defaultRuleGroupProcessorTanStackDB, defaultRuleProcessorCEL, defaultRuleProcessorCypher, defaultRuleProcessorDrizzle, defaultRuleProcessorElasticSearch, defaultRuleProcessorGremlin, defaultRuleProcessorJSONata, defaultRuleProcessorJsonLogic, defaultRuleProcessorLDAP, defaultRuleProcessorMongoDB, defaultRuleProcessorMongoDBQuery, defaultRuleProcessorNL, defaultRuleProcessorParameterized, defaultRuleProcessorPrisma, defaultRuleProcessorSPARQL, defaultRuleProcessorSQL, defaultRuleProcessorSequelize, defaultRuleProcessorSpEL, defaultRuleProcessorTanStackDB, defaultSpELValueProcessor, defaultTranslations, defaultValidator, defaultValueProcessor, defaultValueProcessorByRule, defaultValueProcessorCELByRule, defaultValueProcessorMongoDBByRule, defaultValueProcessorNL, defaultValueProcessorSpELByRule, derivePathInfo, deriveQueryBuilderClassNames, deriveRuleClassName, deriveRuleClassNames, deriveRuleContext, deriveRuleGroupClassNames, deriveRuleGroupContext, deriveRuleGroupOuterClassName, deriveRuleOuterClassName, exceedsMaxLevels, filterFieldsByComparator, findID, findPath, formatQuery, formatQueryOptionPresets, generateAccessibleDescription, generateID, getCommonAncestorPath, getFieldData, getFirstOption, getGuardAbortReason, getLikeWildcards, getMatchModesUtil, getMultiValueUpdate, getNLTranslataion, getOption, getParametersAsList, getParentPath, getParseNumberMethod, getPathOfID, getQuoteFieldNamesWithArray, getQuotedFieldName, getRuleDefaultValue, getRuleGroupCombinator, getRuleInputType, getRuleValidationResult, getRuleValueEditorType, getRuleValueSourceOptions, getRuleValues, getSQLConcat, getSubqueryElementAlias, getValidationClassNames, getValueEditorReset, getValueSelectorUpdate, getValueSourcesUtil, group, groupInPlace, groupInvalidReasons, hideValueControlsForOperator, inOperators, insert, insertInPlace, isAncestor, isBetweenOperator, isFlexibleOptionArray, isFlexibleOptionGroupArray, isFullOptionArray, isFullOptionGroupArray, isOptionGroupArray, isPojo, isRuleGroup, isRuleGroupType, isRuleGroupTypeIC, isRuleOrGroupValid, isRuleType, isUnsafeKey, isValidValue, isValidationResult, isValueProcessorLegacy, joinWith, jsonLogicAdditionalOperators, lc, mapSQLOperator, mergeAnyTranslation, mergeAnyTranslations, mergeClassnames, mongoDbFallback, mongoOperators, move, moveInPlace, normalizeConstituentWordOrder, normalizeValueSelectorValue, nullFreeArray, nullOperators, nullOrUndefinedOrEmpty, numericRegex, numerifyValues, objectEntries, objectKeys, parseNumber, pathIsDisabled, pathIsDisabledByPaths, pathsAreEqual, preferAnyProp, preferFlagProps, preferProp, prepareOptionList, prepareRule, prepareRuleGroup, prepareRuleOrGroup, prismaFallback, prismaOperators, processMatchMode, queryBuilderFlagDefaults, regenerateID, regenerateIDs, relationalOperators, remove, removeInPlace, resolveCandidateQuery, resolveDefaultOperator, resolveOperatorList, resolveValueEditorType, resolveValueList, rootPath, shouldRenderAsNumber, signatureOf, sparqlVar, splitBy, sqlDialectPresets, standardClassnames, strictAbortReasons, stripParamPrefix, structuralSignature, subqueryElementAliasBase, substringOperators, toArray, toFlatOptionArray, toFullOption, toFullOptionList, toFullOptionMap, transformQuery, trimIfString, unchangedSignature, uniqByIdentifier, uniqByName, uniqOptGroups, uniqOptList, update, updateInPlace, uuidV4regex, withParamPrefix, wrapLikeFragment };
|
|
7722
7814
|
|