@coveo/quantic 3.43.5 → 3.44.0

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.
@@ -2666,7 +2666,7 @@
2666
2666
  ],
2667
2667
  "fires": "",
2668
2668
  "examples": [
2669
- "<c-quantic-timeframe-facet engine-id={engineId} field=\"Date\" label=\"Indexed Date\" is-collapsed with-date-picker>\n <c-quantic-timeframe period=\"past\" unit=\"year\" amount=\"10\" label=\"Past decade\"></c-quantic-timeframe>\n</c-quantic-timeframe-facet>"
2669
+ "<c-quantic-timeframe-facet engine-id={engineId} field=\"Date\" label=\"Indexed Date\" is-collapsed with-date-picker generate-automatic-ranges>\n <c-quantic-timeframe period=\"past\" unit=\"year\" amount=\"10\" label=\"Past decade\"></c-quantic-timeframe>\n</c-quantic-timeframe-facet>"
2670
2670
  ],
2671
2671
  "xmlMeta": {
2672
2672
  "apiVersion": "53.0",
@@ -2754,6 +2754,15 @@
2754
2754
  "required": true,
2755
2755
  "defaultValue": "",
2756
2756
  "type": "DependsOn"
2757
+ },
2758
+ {
2759
+ "name": "generateAutomaticRanges",
2760
+ "attribute": "generate-automatic-ranges",
2761
+ "access": "@api",
2762
+ "description": "<p>Whether to generate automatic ranges for the facet in addition to the manually defined <code>c-quantic-timeframe</code> ranges.</p>",
2763
+ "required": false,
2764
+ "defaultValue": "`false`",
2765
+ "type": "boolean"
2757
2766
  }
2758
2767
  ]
2759
2768
  }
@@ -6156,7 +6165,7 @@
6156
6165
  ],
6157
6166
  "fires": "",
6158
6167
  "examples": [
6159
- "<c-quantic-timeframe-facet engine-id={engineId} field=\"Date\" label=\"Indexed Date\" is-collapsed with-date-picker>\n <c-quantic-timeframe period=\"past\" unit=\"year\" amount=\"10\" label=\"Past decade\"></c-quantic-timeframe>\n</c-quantic-timeframe-facet>"
6168
+ "<c-quantic-timeframe-facet engine-id={engineId} field=\"Date\" label=\"Indexed Date\" is-collapsed with-date-picker generate-automatic-ranges>\n <c-quantic-timeframe period=\"past\" unit=\"year\" amount=\"10\" label=\"Past decade\"></c-quantic-timeframe>\n</c-quantic-timeframe-facet>"
6160
6169
  ],
6161
6170
  "xmlMeta": {
6162
6171
  "apiVersion": "53.0",
@@ -6244,6 +6253,15 @@
6244
6253
  "required": true,
6245
6254
  "defaultValue": "",
6246
6255
  "type": "DependsOn"
6256
+ },
6257
+ {
6258
+ "name": "generateAutomaticRanges",
6259
+ "attribute": "generate-automatic-ranges",
6260
+ "access": "@api",
6261
+ "description": "<p>Whether to generate automatic ranges for the facet in addition to the manually defined <code>c-quantic-timeframe</code> ranges.</p>",
6262
+ "required": false,
6263
+ "defaultValue": "`false`",
6264
+ "type": "boolean"
6247
6265
  }
6248
6266
  ]
6249
6267
  },
@@ -252,6 +252,28 @@ describe('c-quantic-timeframe-facet', () => {
252
252
  );
253
253
  });
254
254
 
255
+ it('should build the facet controller with generateAutomaticRanges set to true when the generateAutomaticRanges property is set to true', async () => {
256
+ createTestComponent({
257
+ ...defaultOptions,
258
+ generateAutomaticRanges: true,
259
+ });
260
+ await flushPromises();
261
+
262
+ expect(functionsMocks.buildDateFacet).toHaveBeenCalledTimes(1);
263
+ expect(functionsMocks.buildDateFacet).toHaveBeenCalledWith(
264
+ exampleEngine,
265
+ expect.objectContaining({
266
+ options: expect.objectContaining({
267
+ field: defaultOptions.field,
268
+ facetId: defaultOptions.facetId,
269
+ generateAutomaticRanges: true,
270
+ sortCriteria: 'descending',
271
+ injectionDepth: defaultOptions.injectionDepth,
272
+ }),
273
+ })
274
+ );
275
+ });
276
+
255
277
  it('should register the facet to the quantic store', async () => {
256
278
  const expectedFacetType = 'dateFacets';
257
279
  const element = createTestComponent();
@@ -72,7 +72,7 @@ import {api, LightningElement, track} from 'lwc';
72
72
  * @category Search
73
73
  * @category Insight Panel
74
74
  * @example
75
- * <c-quantic-timeframe-facet engine-id={engineId} field="Date" label="Indexed Date" is-collapsed with-date-picker>
75
+ * <c-quantic-timeframe-facet engine-id={engineId} field="Date" label="Indexed Date" is-collapsed with-date-picker generate-automatic-ranges>
76
76
  * <c-quantic-timeframe period="past" unit="year" amount="10" label="Past decade"></c-quantic-timeframe>
77
77
  * </c-quantic-timeframe-facet>
78
78
  */
@@ -156,6 +156,13 @@ export default class QuanticTimeframeFacet extends LightningElement {
156
156
  * @type {DependsOn}
157
157
  */
158
158
  @api dependsOn;
159
+ /**
160
+ * Whether to generate automatic ranges for the facet in addition to the manually defined `c-quantic-timeframe` ranges.
161
+ * @api
162
+ * @type {boolean}
163
+ * @defaultValue `false`
164
+ */
165
+ @api generateAutomaticRanges = false;
159
166
 
160
167
  static attributes = [
161
168
  'facetId',
@@ -165,6 +172,7 @@ export default class QuanticTimeframeFacet extends LightningElement {
165
172
  'noFilterFacetCount',
166
173
  'injectionDepth',
167
174
  'dependsOn',
175
+ 'generateAutomaticRanges',
168
176
  ];
169
177
 
170
178
  /** @type {DateFacetState} */
@@ -476,7 +484,7 @@ export default class QuanticTimeframeFacet extends LightningElement {
476
484
  options: {
477
485
  field: this.field,
478
486
  currentValues: this.currentValues,
479
- generateAutomaticRanges: false,
487
+ generateAutomaticRanges: this.generateAutomaticRanges,
480
488
  sortCriteria: 'descending',
481
489
  filterFacetCount: !this.noFilterFacetCount,
482
490
  injectionDepth: Number(this.injectionDepth),