@shaxpir/duiduidui-models 1.38.0 → 1.38.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.
@@ -101,7 +101,7 @@ export declare class Device extends Content {
101
101
  get currentSearchState(): SearchState | undefined;
102
102
  /**
103
103
  * Returns true if back navigation is possible.
104
- * Requires at least two entries with a non-empty entry below the top.
104
+ * True whenever there is any previous entry below the top of the stack.
105
105
  */
106
106
  get canGoBack(): boolean;
107
107
  /**
@@ -114,7 +114,6 @@ export declare class Device extends Content {
114
114
  pushSearchState(state: SearchState): SearchState | undefined;
115
115
  /**
116
116
  * Navigates back in search history by popping the top entry.
117
- * Skips over empty entries to find a non-empty one.
118
117
  * @returns The search state at the new top of stack, or undefined if can't go back
119
118
  */
120
119
  goBack(): SearchState | undefined;
@@ -332,18 +332,12 @@ class Device extends Content_1.Content {
332
332
  }
333
333
  /**
334
334
  * Returns true if back navigation is possible.
335
- * Requires at least two entries with a non-empty entry below the top.
335
+ * True whenever there is any previous entry below the top of the stack.
336
336
  */
337
337
  get canGoBack() {
338
338
  this.checkDisposed("Device.canGoBack");
339
339
  const history = this.searchHistory;
340
- // Look for any non-empty entry below the top of the stack
341
- for (let i = history.entries.length - 2; i >= 0; i--) {
342
- if (!(0, SearchState_1.isEmptySearchState)(history.entries[i])) {
343
- return true;
344
- }
345
- }
346
- return false;
340
+ return history.entries.length >= 2;
347
341
  }
348
342
  /**
349
343
  * Pushes a new search state onto the history stack.
@@ -378,7 +372,6 @@ class Device extends Content_1.Content {
378
372
  }
379
373
  /**
380
374
  * Navigates back in search history by popping the top entry.
381
- * Skips over empty entries to find a non-empty one.
382
375
  * @returns The search state at the new top of stack, or undefined if can't go back
383
376
  */
384
377
  goBack() {
@@ -387,16 +380,7 @@ class Device extends Content_1.Content {
387
380
  return undefined;
388
381
  }
389
382
  const history = this.searchHistory;
390
- // Pop entries from the top until we find a non-empty one below
391
- let newEntries = [...history.entries];
392
- newEntries.pop(); // Remove current top
393
- // Skip over any empty entries
394
- while (newEntries.length > 0 && (0, SearchState_1.isEmptySearchState)(newEntries[newEntries.length - 1])) {
395
- newEntries.pop();
396
- }
397
- if (newEntries.length === 0) {
398
- return undefined;
399
- }
383
+ const newEntries = history.entries.slice(0, -1);
400
384
  const batch = new Operation_1.BatchOperation(this);
401
385
  batch.setPathValue(['payload', 'search_history'], {
402
386
  entries: newEntries,
@@ -71,6 +71,7 @@ export declare class Workspace extends Content {
71
71
  hasJourneyDate(journeyKey: string): boolean;
72
72
  getJourneyDate(journeyKey: string): CompactDateTime;
73
73
  setJourneyDate(journeyKey: string, journeyDate: CompactDateTime): void;
74
+ clearJourneyDate(journeyKey: string): void;
74
75
  setGlobalConditions(conditions: Conditions): void;
75
76
  get defaultVoice(): VoicePreference;
76
77
  setDefaultVoice(value: VoicePreference): void;
@@ -233,6 +233,14 @@ class Workspace extends Content_1.Content {
233
233
  batch.setPathValue(['payload', 'journey', journeyKey], journeyDate);
234
234
  batch.commit();
235
235
  }
236
+ clearJourneyDate(journeyKey) {
237
+ this.checkDisposed("Workspace.clearJourneyDate");
238
+ if (this.payload.journey.hasOwnProperty(journeyKey)) {
239
+ const batch = new Operation_1.BatchOperation(this);
240
+ batch.removeValueAtPath(['payload', 'journey', journeyKey]);
241
+ batch.commit();
242
+ }
243
+ }
236
244
  setGlobalConditions(conditions) {
237
245
  this.checkDisposed("Workspace.setGlobalConditions");
238
246
  const batch = new Operation_1.BatchOperation(this);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shaxpir/duiduidui-models",
3
- "version": "1.38.0",
3
+ "version": "1.38.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/shaxpir/duiduidui-models"