@sinequa/atomic-angular 0.2.1 → 0.2.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.
@@ -96,16 +96,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.7", ngImpor
96
96
 
97
97
  const AggregationsStore = signalStore(
98
98
  // providing store at the root level
99
- { providedIn: 'root' }, withDevtools('Aggregations'), withAggregationsFeatures());
99
+ { providedIn: "root" }, withDevtools("Aggregations"), withAggregationsFeatures());
100
100
  function withAggregationsFeatures() {
101
- return signalStoreFeature(withState({ aggregations: [] }), withMethods(store => ({
101
+ return signalStoreFeature(withState({ aggregations: [] }), withMethods((store) => ({
102
102
  /**
103
103
  * Updates the state with the provided aggregations.
104
104
  *
105
105
  * @param {Aggregation[]} aggregations - The new aggregations to update the state with.
106
106
  */
107
107
  update(aggregations) {
108
- patchState(store, state => {
108
+ patchState(store, (state) => {
109
109
  return { ...state, aggregations };
110
110
  });
111
111
  },
@@ -116,13 +116,13 @@ function withAggregationsFeatures() {
116
116
  * @returns void
117
117
  */
118
118
  updateAggregation(aggregation) {
119
- patchState(store, state => {
119
+ patchState(store, (state) => {
120
120
  // aggregation name/column lookup must be case insensitive
121
- const index = state.aggregations.findIndex(a => a.name.toLocaleLowerCase() === aggregation.name.toLocaleLowerCase());
121
+ const index = state.aggregations.findIndex((a) => a.name.toLocaleLowerCase() === aggregation.name.toLocaleLowerCase());
122
122
  if (index !== -1) {
123
123
  state.aggregations[index] = aggregation;
124
124
  }
125
- return { ...state };
125
+ return { ...state, aggregations: [...state.aggregations] };
126
126
  });
127
127
  },
128
128
  /**
@@ -132,7 +132,7 @@ function withAggregationsFeatures() {
132
132
  * This method uses the `patchState` function to update the state of the store.
133
133
  */
134
134
  clear() {
135
- patchState(store, state => {
135
+ patchState(store, (state) => {
136
136
  return { ...state, aggregations: [] };
137
137
  });
138
138
  },
@@ -146,12 +146,12 @@ function withAggregationsFeatures() {
146
146
  * Defaults to 'name'.
147
147
  * @returns The matching aggregation object if found, otherwise `undefined`.
148
148
  */
149
- getAggregation(name, kind = 'name') {
149
+ getAggregation(name, kind = "name") {
150
150
  // aggregation name/column lookup must be case insensitive
151
151
  const aggregations = store.aggregations();
152
152
  if (!aggregations)
153
153
  return undefined;
154
- return aggregations.find(aggregation => kind === 'column'
154
+ return aggregations.find((aggregation) => kind === "column"
155
155
  ? aggregation.column?.toLocaleLowerCase() === name.toLocaleLowerCase()
156
156
  : aggregation.name.toLocaleLowerCase() === name.toLocaleLowerCase());
157
157
  }