@internetarchive/collection-browser 4.3.1-alpha-webdev8165.0 → 4.3.1
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/index.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
- package/dist/src/manage/manage-bar.js +77 -77
- package/dist/src/manage/manage-bar.js.map +1 -1
- package/dist/src/models.d.ts +6 -0
- package/dist/src/models.js +16 -7
- package/dist/src/models.js.map +1 -1
- package/dist/src/restoration-state-handler.js +3 -1
- package/dist/src/restoration-state-handler.js.map +1 -1
- package/dist/src/tiles/base-tile-component.js.map +1 -1
- package/dist/src/tiles/grid/item-tile.js +138 -138
- package/dist/src/tiles/grid/item-tile.js.map +1 -1
- package/dist/src/tiles/models.js.map +1 -1
- package/dist/src/tiles/tile-dispatcher.js +216 -216
- package/dist/src/tiles/tile-dispatcher.js.map +1 -1
- package/dist/src/tiles/tile-display-value-provider.js.map +1 -1
- package/dist/test/data-source/collection-browser-data-source.test.js +2 -2
- package/dist/test/data-source/collection-browser-data-source.test.js.map +1 -1
- package/dist/test/manage/manage-bar.test.js +33 -33
- package/dist/test/manage/manage-bar.test.js.map +1 -1
- package/dist/test/restoration-state-handler.test.js +0 -70
- package/dist/test/restoration-state-handler.test.js.map +1 -1
- package/dist/test/tiles/list/tile-list-compact-header.test.js +12 -12
- package/dist/test/tiles/list/tile-list-compact-header.test.js.map +1 -1
- package/dist/test/tiles/list/tile-list.test.js +134 -134
- package/dist/test/tiles/list/tile-list.test.js.map +1 -1
- package/index.ts +28 -28
- package/package.json +2 -2
- package/src/data-source/collection-browser-data-source.ts +1465 -1465
- package/src/manage/manage-bar.ts +276 -276
- package/src/models.ts +895 -879
- package/src/restoration-state-handler.ts +550 -546
- package/src/tiles/base-tile-component.ts +65 -65
- package/src/tiles/grid/item-tile.ts +346 -346
- package/src/tiles/models.ts +8 -8
- package/src/tiles/tile-dispatcher.ts +527 -527
- package/src/tiles/tile-display-value-provider.ts +134 -134
- package/test/data-source/collection-browser-data-source.test.ts +193 -193
- package/test/manage/manage-bar.test.ts +347 -347
- package/test/restoration-state-handler.test.ts +480 -569
- package/test/tiles/list/tile-list-compact-header.test.ts +43 -43
- package/test/tiles/list/tile-list.test.ts +576 -576
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
-
import { property } from 'lit/decorators.js';
|
|
3
|
-
import type { SortParam } from '@internetarchive/search-service';
|
|
4
|
-
import { TileDisplayValueProvider } from './tile-display-value-provider';
|
|
5
|
-
import type { TileModel } from '../models';
|
|
6
|
-
import { DateFormat, formatDate } from '../utils/format-date';
|
|
7
|
-
|
|
8
|
-
export abstract class BaseTileComponent extends LitElement {
|
|
9
|
-
@property({ type: Object }) model?: TileModel;
|
|
10
|
-
|
|
11
|
-
@property({ type: Number }) currentWidth?: number;
|
|
12
|
-
|
|
13
|
-
@property({ type: Number }) currentHeight?: number;
|
|
14
|
-
|
|
15
|
-
@property({ type: String }) baseNavigationUrl?: string;
|
|
16
|
-
|
|
17
|
-
@property({ type: String }) baseImageUrl?: string;
|
|
18
|
-
|
|
19
|
-
@property({ type: String }) collectionPagePath?: string;
|
|
20
|
-
|
|
21
|
-
@property({ type: Object }) sortParam: SortParam | null = null;
|
|
22
|
-
|
|
23
|
-
@property({ type: Object }) defaultSortParam: SortParam | null = null;
|
|
24
|
-
|
|
25
|
-
@property({ type: String }) creatorFilter?: string;
|
|
26
|
-
|
|
27
|
-
@property({ type: Number }) mobileBreakpoint?: number;
|
|
28
|
-
|
|
29
|
-
@property({ type: Boolean }) loggedIn = false;
|
|
30
|
-
|
|
31
|
-
@property({ type: Boolean }) suppressBlurring = false;
|
|
32
|
-
|
|
33
|
-
@property({ type: Boolean }) useLocalTime = false;
|
|
34
|
-
|
|
35
|
-
protected displayValueProvider = new TileDisplayValueProvider();
|
|
36
|
-
|
|
37
|
-
protected willUpdate(changed: PropertyValues<this>) {
|
|
38
|
-
// Ensure the TileDisplayValueProvider stays up-to-date as properties change
|
|
39
|
-
if (
|
|
40
|
-
changed.has('model') ||
|
|
41
|
-
changed.has('baseNavigationUrl') ||
|
|
42
|
-
changed.has('collectionPagePath') ||
|
|
43
|
-
changed.has('sortParam') ||
|
|
44
|
-
changed.has('defaultSortParam') ||
|
|
45
|
-
changed.has('creatorFilter')
|
|
46
|
-
) {
|
|
47
|
-
this.displayValueProvider = new TileDisplayValueProvider({
|
|
48
|
-
model: this.model,
|
|
49
|
-
baseNavigationUrl: this.baseNavigationUrl,
|
|
50
|
-
collectionPagePath: this.collectionPagePath,
|
|
51
|
-
sortParam: this.sortParam ?? this.defaultSortParam ?? undefined,
|
|
52
|
-
creatorFilter: this.creatorFilter,
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* The formatted date string for given date and format type, taking into
|
|
59
|
-
* account whether this tile component should be using local time or UTC.
|
|
60
|
-
*/
|
|
61
|
-
protected getFormattedDate(date?: Date, format?: DateFormat): string {
|
|
62
|
-
const { useLocalTime } = this;
|
|
63
|
-
return formatDate(date, format, { useLocalTime });
|
|
64
|
-
}
|
|
65
|
-
}
|
|
1
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
|
+
import type { SortParam } from '@internetarchive/search-service';
|
|
4
|
+
import { TileDisplayValueProvider } from './tile-display-value-provider';
|
|
5
|
+
import type { TileModel } from '../models';
|
|
6
|
+
import { DateFormat, formatDate } from '../utils/format-date';
|
|
7
|
+
|
|
8
|
+
export abstract class BaseTileComponent extends LitElement {
|
|
9
|
+
@property({ type: Object }) model?: TileModel;
|
|
10
|
+
|
|
11
|
+
@property({ type: Number }) currentWidth?: number;
|
|
12
|
+
|
|
13
|
+
@property({ type: Number }) currentHeight?: number;
|
|
14
|
+
|
|
15
|
+
@property({ type: String }) baseNavigationUrl?: string;
|
|
16
|
+
|
|
17
|
+
@property({ type: String }) baseImageUrl?: string;
|
|
18
|
+
|
|
19
|
+
@property({ type: String }) collectionPagePath?: string;
|
|
20
|
+
|
|
21
|
+
@property({ type: Object }) sortParam: SortParam | null = null;
|
|
22
|
+
|
|
23
|
+
@property({ type: Object }) defaultSortParam: SortParam | null = null;
|
|
24
|
+
|
|
25
|
+
@property({ type: String }) creatorFilter?: string;
|
|
26
|
+
|
|
27
|
+
@property({ type: Number }) mobileBreakpoint?: number;
|
|
28
|
+
|
|
29
|
+
@property({ type: Boolean }) loggedIn = false;
|
|
30
|
+
|
|
31
|
+
@property({ type: Boolean }) suppressBlurring = false;
|
|
32
|
+
|
|
33
|
+
@property({ type: Boolean }) useLocalTime = false;
|
|
34
|
+
|
|
35
|
+
protected displayValueProvider = new TileDisplayValueProvider();
|
|
36
|
+
|
|
37
|
+
protected willUpdate(changed: PropertyValues<this>) {
|
|
38
|
+
// Ensure the TileDisplayValueProvider stays up-to-date as properties change
|
|
39
|
+
if (
|
|
40
|
+
changed.has('model') ||
|
|
41
|
+
changed.has('baseNavigationUrl') ||
|
|
42
|
+
changed.has('collectionPagePath') ||
|
|
43
|
+
changed.has('sortParam') ||
|
|
44
|
+
changed.has('defaultSortParam') ||
|
|
45
|
+
changed.has('creatorFilter')
|
|
46
|
+
) {
|
|
47
|
+
this.displayValueProvider = new TileDisplayValueProvider({
|
|
48
|
+
model: this.model,
|
|
49
|
+
baseNavigationUrl: this.baseNavigationUrl,
|
|
50
|
+
collectionPagePath: this.collectionPagePath,
|
|
51
|
+
sortParam: this.sortParam ?? this.defaultSortParam ?? undefined,
|
|
52
|
+
creatorFilter: this.creatorFilter,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The formatted date string for given date and format type, taking into
|
|
59
|
+
* account whether this tile component should be using local time or UTC.
|
|
60
|
+
*/
|
|
61
|
+
protected getFormattedDate(date?: Date, format?: DateFormat): string {
|
|
62
|
+
const { useLocalTime } = this;
|
|
63
|
+
return formatDate(date, format, { useLocalTime });
|
|
64
|
+
}
|
|
65
|
+
}
|