mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Refactor variable names for clarity
This commit is contained in:
		| @@ -27,8 +27,8 @@ export class DocumentListViewService { | |||||||
|   currentPage = 1 |   currentPage = 1 | ||||||
|   currentPageSize: number = this.settings.get(SETTINGS_KEYS.DOCUMENT_LIST_SIZE) |   currentPageSize: number = this.settings.get(SETTINGS_KEYS.DOCUMENT_LIST_SIZE) | ||||||
|   collectionSize: number |   collectionSize: number | ||||||
|   lastSelectedDocumentIndex: number |   rangeSelectionAnchorIndex: number | ||||||
|   lastSelectedDocumentToIndex: number |   lastRangeSelectionToIndex: number | ||||||
|  |  | ||||||
|   /** |   /** | ||||||
|    * This is the current config for the document list. The service will always remember the last settings used for the document list. |    * This is the current config for the document list. The service will always remember the last settings used for the document list. | ||||||
| @@ -110,7 +110,7 @@ export class DocumentListViewService { | |||||||
|           if (onFinish) { |           if (onFinish) { | ||||||
|             onFinish() |             onFinish() | ||||||
|           } |           } | ||||||
|           this.lastSelectedDocumentIndex = this.lastSelectedDocumentToIndex = null |           this.rangeSelectionAnchorIndex = this.lastRangeSelectionToIndex = null | ||||||
|           this.isReloading = false |           this.isReloading = false | ||||||
|         }, |         }, | ||||||
|         error => { |         error => { | ||||||
| @@ -221,7 +221,7 @@ export class DocumentListViewService { | |||||||
|  |  | ||||||
|   selectNone() { |   selectNone() { | ||||||
|     this.selected.clear() |     this.selected.clear() | ||||||
|     this.lastSelectedDocumentIndex = this.lastSelectedDocumentToIndex = null |     this.rangeSelectionAnchorIndex = this.lastRangeSelectionToIndex = null | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   reduceSelectionToFilter() { |   reduceSelectionToFilter() { | ||||||
| @@ -256,22 +256,22 @@ export class DocumentListViewService { | |||||||
|   toggleSelected(d: PaperlessDocument): void { |   toggleSelected(d: PaperlessDocument): void { | ||||||
|     if (this.selected.has(d.id)) this.selected.delete(d.id) |     if (this.selected.has(d.id)) this.selected.delete(d.id) | ||||||
|     else this.selected.add(d.id) |     else this.selected.add(d.id) | ||||||
|     this.lastSelectedDocumentIndex = this.documentIndexInCurrentView(d.id) |     this.rangeSelectionAnchorIndex = this.documentIndexInCurrentView(d.id) | ||||||
|     this.lastSelectedDocumentToIndex = null |     this.lastRangeSelectionToIndex = null | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   selectRangeTo(d: PaperlessDocument) { |   selectRangeTo(d: PaperlessDocument) { | ||||||
|     if (this.lastSelectedDocumentIndex !== null) { |     if (this.rangeSelectionAnchorIndex !== null) { | ||||||
|       const documentToIndex = this.documentIndexInCurrentView(d.id) |       const documentToIndex = this.documentIndexInCurrentView(d.id) | ||||||
|       const fromIndex = Math.min(this.lastSelectedDocumentIndex, documentToIndex) |       const fromIndex = Math.min(this.rangeSelectionAnchorIndex, documentToIndex) | ||||||
|       const toIndex = Math.max(this.lastSelectedDocumentIndex, documentToIndex) |       const toIndex = Math.max(this.rangeSelectionAnchorIndex, documentToIndex) | ||||||
|  |  | ||||||
|       if (this.lastSelectedDocumentToIndex !== null && |       if (this.lastRangeSelectionToIndex !== null && | ||||||
|           ((this.lastSelectedDocumentToIndex > this.lastSelectedDocumentIndex && documentToIndex <= this.lastSelectedDocumentIndex) || |           ((this.lastRangeSelectionToIndex > this.rangeSelectionAnchorIndex && documentToIndex <= this.rangeSelectionAnchorIndex) || | ||||||
|           (this.lastSelectedDocumentToIndex < this.lastSelectedDocumentIndex && documentToIndex >= this.lastSelectedDocumentIndex))) { |           (this.lastRangeSelectionToIndex < this.rangeSelectionAnchorIndex && documentToIndex >= this.rangeSelectionAnchorIndex))) { | ||||||
|  |  | ||||||
|         // new click is "opposite side" of anchor so we invert the old selection |         // new click is "opposite side" of anchor so we invert the old selection | ||||||
|         this.documents.slice(Math.min(this.lastSelectedDocumentIndex, this.lastSelectedDocumentToIndex), Math.max(this.lastSelectedDocumentIndex, this.lastSelectedDocumentToIndex) + 1).forEach(d => { |         this.documents.slice(Math.min(this.rangeSelectionAnchorIndex, this.lastRangeSelectionToIndex), Math.max(this.rangeSelectionAnchorIndex, this.lastRangeSelectionToIndex) + 1).forEach(d => { | ||||||
|           this.selected.delete(d.id) |           this.selected.delete(d.id) | ||||||
|         }) |         }) | ||||||
|       } |       } | ||||||
| @@ -279,7 +279,7 @@ export class DocumentListViewService { | |||||||
|       this.documents.slice(fromIndex, toIndex + 1).forEach(d => { |       this.documents.slice(fromIndex, toIndex + 1).forEach(d => { | ||||||
|         this.selected.add(d.id) |         this.selected.add(d.id) | ||||||
|       }) |       }) | ||||||
|       this.lastSelectedDocumentToIndex = documentToIndex |       this.lastRangeSelectionToIndex = documentToIndex | ||||||
|     } else { // e.g. shift key but was first click |     } else { // e.g. shift key but was first click | ||||||
|       this.toggleSelected(d) |       this.toggleSelected(d) | ||||||
|     } |     } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Michael Shamoon
					Michael Shamoon