@internetarchive/collection-browser 2.7.6-alpha3 → 2.7.6-alpha4
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/src/app-root.js +4 -4
- package/dist/src/app-root.js.map +1 -1
- package/dist/src/collection-browser.d.ts +9 -1
- package/dist/src/collection-browser.js +23 -13
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/manage/manage-bar.d.ts +7 -8
- package/dist/src/manage/manage-bar.js +5 -18
- package/dist/src/manage/manage-bar.js.map +1 -1
- package/package.json +1 -1
- package/src/app-root.ts +5 -5
- package/src/collection-browser.ts +30 -16
- package/src/manage/manage-bar.ts +9 -30
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LitElement, TemplateResult, CSSResultGroup
|
|
1
|
+
import { LitElement, TemplateResult, CSSResultGroup } from 'lit';
|
|
2
2
|
import { type ModalManagerInterface } from '@internetarchive/modal-manager';
|
|
3
3
|
import type { ManageableItem } from '../models';
|
|
4
4
|
import './remove-items-modal-content';
|
|
@@ -19,6 +19,10 @@ export declare class ManageBar extends LitElement {
|
|
|
19
19
|
* Array of items that have been selected for management
|
|
20
20
|
*/
|
|
21
21
|
selectedItems: Array<ManageableItem>;
|
|
22
|
+
/**
|
|
23
|
+
* Message shows as note in the modal when removing items
|
|
24
|
+
*/
|
|
25
|
+
manageViewModelMsg?: string;
|
|
22
26
|
/**
|
|
23
27
|
* Whether to show the "Select All" button (default false)
|
|
24
28
|
*/
|
|
@@ -27,10 +31,6 @@ export declare class ManageBar extends LitElement {
|
|
|
27
31
|
* Whether to show the "Unselect All" button (default false)
|
|
28
32
|
*/
|
|
29
33
|
showUnselectAll: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* Whether item has deleted or not (default true)
|
|
32
|
-
*/
|
|
33
|
-
hasItemsDeleted: boolean;
|
|
34
34
|
/**
|
|
35
35
|
* Whether to show "Item Manager the items" button (default false)
|
|
36
36
|
*/
|
|
@@ -39,7 +39,6 @@ export declare class ManageBar extends LitElement {
|
|
|
39
39
|
* Whether to active delete button for selectable items
|
|
40
40
|
*/
|
|
41
41
|
removeAllowed: boolean;
|
|
42
|
-
updated(changed: PropertyValues): void;
|
|
43
42
|
render(): TemplateResult;
|
|
44
43
|
private cancelClicked;
|
|
45
44
|
private removeItemsClicked;
|
|
@@ -54,10 +53,10 @@ export declare class ManageBar extends LitElement {
|
|
|
54
53
|
/**
|
|
55
54
|
* Shows a modal dialog indicating that item removal is being processed
|
|
56
55
|
*/
|
|
57
|
-
|
|
56
|
+
showRemoveItemsProcessingModal(): void;
|
|
58
57
|
/**
|
|
59
58
|
* Shows a modal dialog indicating that an error occurred while removing items
|
|
60
59
|
*/
|
|
61
|
-
|
|
60
|
+
showRemoveItemsErrorModal(): void;
|
|
62
61
|
static get styles(): CSSResultGroup;
|
|
63
62
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { msg } from '@lit/localize';
|
|
3
|
-
import { LitElement, html, css
|
|
3
|
+
import { LitElement, html, css } from 'lit';
|
|
4
4
|
import { customElement, property } from 'lit/decorators.js';
|
|
5
5
|
import { when } from 'lit/directives/when.js';
|
|
6
6
|
import { ModalConfig, } from '@internetarchive/modal-manager';
|
|
@@ -25,10 +25,6 @@ let ManageBar = class ManageBar extends LitElement {
|
|
|
25
25
|
* Whether to show the "Unselect All" button (default false)
|
|
26
26
|
*/
|
|
27
27
|
this.showUnselectAll = false;
|
|
28
|
-
/**
|
|
29
|
-
* Whether item has deleted or not (default true)
|
|
30
|
-
*/
|
|
31
|
-
this.hasItemsDeleted = true;
|
|
32
28
|
/**
|
|
33
29
|
* Whether to show "Item Manager the items" button (default false)
|
|
34
30
|
*/
|
|
@@ -38,11 +34,6 @@ let ManageBar = class ManageBar extends LitElement {
|
|
|
38
34
|
*/
|
|
39
35
|
this.removeAllowed = false;
|
|
40
36
|
}
|
|
41
|
-
updated(changed) {
|
|
42
|
-
if (changed.has('hasItemsDeleted') && !this.hasItemsDeleted) {
|
|
43
|
-
this.showRemoveItemsErrorModal();
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
37
|
render() {
|
|
47
38
|
return html `
|
|
48
39
|
<div class="manage-container">
|
|
@@ -87,7 +78,6 @@ let ManageBar = class ManageBar extends LitElement {
|
|
|
87
78
|
this.dispatchEvent(new CustomEvent('cancel'));
|
|
88
79
|
}
|
|
89
80
|
removeItemsClicked() {
|
|
90
|
-
this.showRemoveItemsProcessingModal();
|
|
91
81
|
this.dispatchEvent(new CustomEvent('removeItems'));
|
|
92
82
|
}
|
|
93
83
|
manageItemsClicked() {
|
|
@@ -105,13 +95,10 @@ let ManageBar = class ManageBar extends LitElement {
|
|
|
105
95
|
*/
|
|
106
96
|
showRemoveItemsModal() {
|
|
107
97
|
var _a, _b;
|
|
108
|
-
const delayMessage = this.activeTabId === 'uploads'
|
|
109
|
-
? msg('Note: it may take a few minutes for these items to stop appearing in your uploads list.')
|
|
110
|
-
: undefined;
|
|
111
98
|
const customModalContent = html `
|
|
112
99
|
<remove-items-modal-content
|
|
113
100
|
.items=${this.selectedItems}
|
|
114
|
-
.message=${
|
|
101
|
+
.message=${this.manageViewModelMsg}
|
|
115
102
|
@confirm=${() => this.removeItemsClicked()}
|
|
116
103
|
></remove-items-modal-content>
|
|
117
104
|
`;
|
|
@@ -231,15 +218,15 @@ __decorate([
|
|
|
231
218
|
__decorate([
|
|
232
219
|
property({ type: Object })
|
|
233
220
|
], ManageBar.prototype, "selectedItems", void 0);
|
|
221
|
+
__decorate([
|
|
222
|
+
property({ type: String })
|
|
223
|
+
], ManageBar.prototype, "manageViewModelMsg", void 0);
|
|
234
224
|
__decorate([
|
|
235
225
|
property({ type: Boolean })
|
|
236
226
|
], ManageBar.prototype, "showSelectAll", void 0);
|
|
237
227
|
__decorate([
|
|
238
228
|
property({ type: Boolean })
|
|
239
229
|
], ManageBar.prototype, "showUnselectAll", void 0);
|
|
240
|
-
__decorate([
|
|
241
|
-
property({ type: Boolean })
|
|
242
|
-
], ManageBar.prototype, "hasItemsDeleted", void 0);
|
|
243
230
|
__decorate([
|
|
244
231
|
property({ type: Boolean })
|
|
245
232
|
], ManageBar.prototype, "showItemManageButton", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manage-bar.js","sourceRoot":"","sources":["../../../src/manage/manage-bar.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EACL,UAAU,EACV,IAAI,EACJ,GAAG,GAIJ,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EACL,WAAW,GAEZ,MAAM,gCAAgC,CAAC;AAExC,OAAO,aAAa,MAAM,qBAAqB,CAAC;AAChD,OAAO,8BAA8B,CAAC;AAGtC,IAAa,SAAS,GAAtB,MAAa,SAAU,SAAQ,UAAU;IAAzC;;QACE;;WAEG;QACyB,UAAK,GAAG,GAAG,CAAC,wBAAwB,CAAC,CAAC;QAYlE;;WAEG;QACyB,kBAAa,GAA0B,EAAE,CAAC;QAEtE;;WAEG;QAC0B,kBAAa,GAAG,KAAK,CAAC;QAEnD;;WAEG;QAC0B,oBAAe,GAAG,KAAK,CAAC;QAErD;;WAEG;QAC0B,oBAAe,GAAG,IAAI,CAAC;QAEpD;;WAEG;QAC0B,yBAAoB,GAAG,KAAK,CAAC;QAE1D;;WAEG;QAC0B,kBAAa,GAAG,KAAK,CAAC;IA6MrD,CAAC;IA3MC,OAAO,CAAC,OAAuB;QAC7B,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;YAC3D,IAAI,CAAC,yBAAyB,EAAE,CAAC;SAClC;IACH,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,C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AQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAsC;AAKrC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAA2C;AAKzC;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAAuB;AAKtB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;kDAAyB;AAKxB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;kDAAwB;AAKvB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uDAA8B;AAK7B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAAuB;AA5CxC,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CAyPrB;SAzPY,SAAS","sourcesContent":["import { msg } from '@lit/localize';\nimport {\n LitElement,\n html,\n css,\n TemplateResult,\n CSSResultGroup,\n PropertyValues,\n} from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { when } from 'lit/directives/when.js';\nimport {\n ModalConfig,\n type ModalManagerInterface,\n} from '@internetarchive/modal-manager';\nimport type { ManageableItem } from '../models';\nimport iaButtonStyle from '../styles/ia-button';\nimport './remove-items-modal-content';\n\n@customElement('manage-bar')\nexport class ManageBar extends LitElement {\n /**\n * The label displayed in front of the management buttons\n */\n @property({ type: String }) label = msg('Select items to remove');\n\n /**\n * Specifies the context in which the collection browser is being used\n */\n @property({ type: String }) activeTabId?: string;\n\n /**\n * The shared modal manager component for displaying modal dialogs on this page\n */\n @property({ type: Object }) modalManager?: ModalManagerInterface;\n\n /**\n * Array of items that have been selected for management\n */\n @property({ type: Object }) selectedItems: Array<ManageableItem> = [];\n\n /**\n * Whether to show the \"Select All\" button (default false)\n */\n @property({ type: Boolean }) showSelectAll = false;\n\n /**\n * Whether to show the \"Unselect All\" button (default false)\n */\n @property({ type: Boolean }) showUnselectAll = false;\n\n /**\n * Whether item has deleted or not (default true)\n */\n @property({ type: Boolean }) hasItemsDeleted = true;\n\n /**\n * Whether to show \"Item Manager the items\" button (default false)\n */\n @property({ type: Boolean }) showItemManageButton = false;\n\n /**\n * Whether to active delete button for selectable items\n */\n @property({ type: Boolean }) removeAllowed = false;\n\n updated(changed: PropertyValues): void {\n if (changed.has('hasItemsDeleted') && !this.hasItemsDeleted) {\n this.showRemoveItemsErrorModal();\n }\n }\n\n render(): TemplateResult {\n return html`\n <div class=\"manage-container\">\n <span class=\"manage-label\">${this.label}</span>\n <div class=\"manage-buttons\">\n <button class=\"ia-button dark\" @click=${this.cancelClicked}>\n ${msg('Cancel')}\n </button>\n <button\n class=\"ia-button danger\"\n ?disabled=${!this.removeAllowed}\n @click=${this.showRemoveItemsModal}\n >\n ${msg('Remove selected items')}\n </button>\n ${when(\n this.showItemManageButton,\n () => html` <button\n class=\"ia-button warning\"\n ?disabled=${!this.removeAllowed}\n @click=${this.manageItemsClicked}\n >\n ${msg('Item Manager the items')}\n </button>`\n )}\n <div class=\"selection-buttons\">\n ${when(\n this.showSelectAll,\n () => html` <button\n class=\"ia-button link select-all-btn\"\n @click=${this.selectAllClicked}\n >\n ${msg('Select all')}\n </button>`\n )}\n ${when(\n this.showUnselectAll,\n () => html` <button\n class=\"ia-button link unselect-all-btn\"\n @click=${this.unselectAllClicked}\n >\n ${msg('Unselect all')}\n </button>`\n )}\n </div>\n </div>\n </div>\n `;\n }\n\n private cancelClicked(): void {\n this.dispatchEvent(new CustomEvent('cancel'));\n }\n\n private removeItemsClicked(): void {\n this.showRemoveItemsProcessingModal();\n this.dispatchEvent(new CustomEvent('removeItems'));\n }\n\n private manageItemsClicked(): void {\n this.dispatchEvent(new CustomEvent('manageItems'));\n }\n\n private selectAllClicked(): void {\n this.dispatchEvent(new CustomEvent('selectAll'));\n }\n\n private unselectAllClicked(): void {\n this.dispatchEvent(new CustomEvent('unselectAll'));\n }\n\n /**\n * Shows a modal dialog confirming the list of items to be removed\n * @param items Which items to list in the modal\n */\n private showRemoveItemsModal(): void {\n const delayMessage =\n this.activeTabId === 'uploads'\n ? msg(\n 'Note: it may take a few minutes for these items to stop appearing in your uploads list.'\n )\n : undefined;\n\n const customModalContent = html`\n <remove-items-modal-content\n .items=${this.selectedItems}\n .message=${delayMessage}\n @confirm=${() => this.removeItemsClicked()}\n ></remove-items-modal-content>\n `;\n\n const config = new ModalConfig({\n showProcessingIndicator: false,\n processingImageMode: 'processing',\n bodyColor: '#fff',\n headerColor: '#194880',\n showHeaderLogo: false,\n closeOnBackdropClick: true,\n title: html`${msg('Are you sure you want to remove these items?')}`,\n });\n\n this.modalManager?.classList.add('remove-items');\n this.modalManager?.showModal({\n config,\n customModalContent,\n userClosedModalCallback: () => {\n this.modalManager?.classList.remove('remove-items');\n },\n });\n }\n\n /**\n * Shows a modal dialog indicating that item removal is being processed\n */\n private showRemoveItemsProcessingModal(): void {\n const config = new ModalConfig({\n showProcessingIndicator: true,\n processingImageMode: 'processing',\n bodyColor: '#fff',\n headerColor: '#194880',\n showHeaderLogo: false,\n closeOnBackdropClick: true,\n title: html`${msg('Removing selected items...')}`,\n });\n\n this.modalManager?.classList.add('remove-items');\n this.modalManager?.showModal({\n config,\n userClosedModalCallback: () => {\n this.modalManager?.classList.remove('remove-items');\n },\n });\n }\n\n /**\n * Shows a modal dialog indicating that an error occurred while removing items\n */\n private showRemoveItemsErrorModal(): void {\n const config = new ModalConfig({\n showProcessingIndicator: false,\n processingImageMode: 'processing',\n bodyColor: '#fff',\n headerColor: '#691916',\n showHeaderLogo: false,\n closeOnBackdropClick: true,\n title: html`${msg('Error: unable to remove items')}`,\n message: html`${msg(\n 'An error occurred while removing items. Please try again in a few minutes.'\n )}`,\n });\n\n this.modalManager?.classList.add('remove-items');\n this.modalManager?.showModal({\n config,\n userClosedModalCallback: () => {\n this.modalManager?.classList.remove('remove-items');\n },\n });\n }\n\n static get styles(): CSSResultGroup {\n return css`\n ${iaButtonStyle}\n .manage-container {\n display: flex;\n align-items: center;\n column-gap: 5px;\n padding: 20px 0 20px;\n flex-wrap: wrap;\n }\n\n .manage-label {\n display: inline-block;\n font-weight: bold;\n font-size: 1.8rem;\n padding-right: 10px;\n }\n\n .manage-buttons {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n column-gap: 5px;\n }\n\n .selection-buttons {\n display: inherit;\n }\n\n .ia-button,\n button {\n padding: 6px 12px;\n font-size: 1.4rem;\n margin: 3px 0;\n }\n `;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"manage-bar.js","sourceRoot":"","sources":["../../../src/manage/manage-bar.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAkC,MAAM,KAAK,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EACL,WAAW,GAEZ,MAAM,gCAAgC,CAAC;AAExC,OAAO,aAAa,MAAM,qBAAqB,CAAC;AAChD,OAAO,8BAA8B,CAAC;AAGtC,IAAa,SAAS,GAAtB,MAAa,SAAU,SAAQ,UAAU;IAAzC;;QACE;;WAEG;QACyB,UAAK,GAAG,GAAG,CAAC,wBAAwB,CAAC,CAAC;QAYlE;;WAEG;QACyB,kBAAa,GAA0B,EAAE,CAAC;QAOtE;;WAEG;QAC0B,kBAAa,GAAG,KAAK,CAAC;QAEnD;;WAEG;QAC0B,oBAAe,GAAG,KAAK,CAAC;QAErD;;WAEG;QAC0B,yBAAoB,GAAG,KAAK,CAAC;QAE1D;;WAEG;QAC0B,kBAAa,GAAG,KAAK,CAAC;IA+LrD,CAAC;IA7LC,MAAM;QACJ,OAAO,IAAI,CAAA;;qCAEsB,IAAI,CAAC,KAAK;;kDAEG,IAAI,CAAC,aA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AA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAAuB;AAKtB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;kDAAyB;AAKxB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uDAA8B;AAK7B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAAuB;AA5CxC,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CA2OrB;SA3OY,SAAS","sourcesContent":["import { msg } from '@lit/localize';\nimport { LitElement, html, css, TemplateResult, CSSResultGroup } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { when } from 'lit/directives/when.js';\nimport {\n ModalConfig,\n type ModalManagerInterface,\n} from '@internetarchive/modal-manager';\nimport type { ManageableItem } from '../models';\nimport iaButtonStyle from '../styles/ia-button';\nimport './remove-items-modal-content';\n\n@customElement('manage-bar')\nexport class ManageBar extends LitElement {\n /**\n * The label displayed in front of the management buttons\n */\n @property({ type: String }) label = msg('Select items to remove');\n\n /**\n * Specifies the context in which the collection browser is being used\n */\n @property({ type: String }) activeTabId?: string;\n\n /**\n * The shared modal manager component for displaying modal dialogs on this page\n */\n @property({ type: Object }) modalManager?: ModalManagerInterface;\n\n /**\n * Array of items that have been selected for management\n */\n @property({ type: Object }) selectedItems: Array<ManageableItem> = [];\n\n /**\n * Message shows as note in the modal when removing items\n */\n @property({ type: String }) manageViewModelMsg?: string;\n\n /**\n * Whether to show the \"Select All\" button (default false)\n */\n @property({ type: Boolean }) showSelectAll = false;\n\n /**\n * Whether to show the \"Unselect All\" button (default false)\n */\n @property({ type: Boolean }) showUnselectAll = false;\n\n /**\n * Whether to show \"Item Manager the items\" button (default false)\n */\n @property({ type: Boolean }) showItemManageButton = false;\n\n /**\n * Whether to active delete button for selectable items\n */\n @property({ type: Boolean }) removeAllowed = false;\n\n render(): TemplateResult {\n return html`\n <div class=\"manage-container\">\n <span class=\"manage-label\">${this.label}</span>\n <div class=\"manage-buttons\">\n <button class=\"ia-button dark\" @click=${this.cancelClicked}>\n ${msg('Cancel')}\n </button>\n <button\n class=\"ia-button danger\"\n ?disabled=${!this.removeAllowed}\n @click=${this.showRemoveItemsModal}\n >\n ${msg('Remove selected items')}\n </button>\n ${when(\n this.showItemManageButton,\n () => html` <button\n class=\"ia-button warning\"\n ?disabled=${!this.removeAllowed}\n @click=${this.manageItemsClicked}\n >\n ${msg('Item Manager the items')}\n </button>`\n )}\n <div class=\"selection-buttons\">\n ${when(\n this.showSelectAll,\n () => html` <button\n class=\"ia-button link select-all-btn\"\n @click=${this.selectAllClicked}\n >\n ${msg('Select all')}\n </button>`\n )}\n ${when(\n this.showUnselectAll,\n () => html` <button\n class=\"ia-button link unselect-all-btn\"\n @click=${this.unselectAllClicked}\n >\n ${msg('Unselect all')}\n </button>`\n )}\n </div>\n </div>\n </div>\n `;\n }\n\n private cancelClicked(): void {\n this.dispatchEvent(new CustomEvent('cancel'));\n }\n\n private removeItemsClicked(): void {\n this.dispatchEvent(new CustomEvent('removeItems'));\n }\n\n private manageItemsClicked(): void {\n this.dispatchEvent(new CustomEvent('manageItems'));\n }\n\n private selectAllClicked(): void {\n this.dispatchEvent(new CustomEvent('selectAll'));\n }\n\n private unselectAllClicked(): void {\n this.dispatchEvent(new CustomEvent('unselectAll'));\n }\n\n /**\n * Shows a modal dialog confirming the list of items to be removed\n * @param items Which items to list in the modal\n */\n private showRemoveItemsModal(): void {\n const customModalContent = html`\n <remove-items-modal-content\n .items=${this.selectedItems}\n .message=${this.manageViewModelMsg}\n @confirm=${() => this.removeItemsClicked()}\n ></remove-items-modal-content>\n `;\n\n const config = new ModalConfig({\n showProcessingIndicator: false,\n processingImageMode: 'processing',\n bodyColor: '#fff',\n headerColor: '#194880',\n showHeaderLogo: false,\n closeOnBackdropClick: true,\n title: html`${msg('Are you sure you want to remove these items?')}`,\n });\n\n this.modalManager?.classList.add('remove-items');\n this.modalManager?.showModal({\n config,\n customModalContent,\n userClosedModalCallback: () => {\n this.modalManager?.classList.remove('remove-items');\n },\n });\n }\n\n /**\n * Shows a modal dialog indicating that item removal is being processed\n */\n showRemoveItemsProcessingModal(): void {\n const config = new ModalConfig({\n showProcessingIndicator: true,\n processingImageMode: 'processing',\n bodyColor: '#fff',\n headerColor: '#194880',\n showHeaderLogo: false,\n closeOnBackdropClick: true,\n title: html`${msg('Removing selected items...')}`,\n });\n\n this.modalManager?.classList.add('remove-items');\n this.modalManager?.showModal({\n config,\n userClosedModalCallback: () => {\n this.modalManager?.classList.remove('remove-items');\n },\n });\n }\n\n /**\n * Shows a modal dialog indicating that an error occurred while removing items\n */\n showRemoveItemsErrorModal(): void {\n const config = new ModalConfig({\n showProcessingIndicator: false,\n processingImageMode: 'processing',\n bodyColor: '#fff',\n headerColor: '#691916',\n showHeaderLogo: false,\n closeOnBackdropClick: true,\n title: html`${msg('Error: unable to remove items')}`,\n message: html`${msg(\n 'An error occurred while removing items. Please try again in a few minutes.'\n )}`,\n });\n\n this.modalManager?.classList.add('remove-items');\n this.modalManager?.showModal({\n config,\n userClosedModalCallback: () => {\n this.modalManager?.classList.remove('remove-items');\n },\n });\n }\n\n static get styles(): CSSResultGroup {\n return css`\n ${iaButtonStyle}\n .manage-container {\n display: flex;\n align-items: center;\n column-gap: 5px;\n padding: 20px 0 20px;\n flex-wrap: wrap;\n }\n\n .manage-label {\n display: inline-block;\n font-weight: bold;\n font-size: 1.8rem;\n padding-right: 10px;\n }\n\n .manage-buttons {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n column-gap: 5px;\n }\n\n .selection-buttons {\n display: inherit;\n }\n\n .ia-button,\n button {\n padding: 6px 12px;\n font-size: 1.4rem;\n margin: 3px 0;\n }\n `;\n }\n}\n"]}
|
package/package.json
CHANGED
package/src/app-root.ts
CHANGED
|
@@ -485,7 +485,7 @@ export class AppRoot extends LitElement {
|
|
|
485
485
|
.modalManager=${this.modalManager}
|
|
486
486
|
.analyticsHandler=${this.analyticsHandler}
|
|
487
487
|
.pageContext=${'search'}
|
|
488
|
-
.activeTabId=${''}
|
|
488
|
+
.activeTabId=${'uploads'}
|
|
489
489
|
@visiblePageChanged=${this.visiblePageChanged}
|
|
490
490
|
@baseQueryChanged=${this.baseQueryChanged}
|
|
491
491
|
@searchTypeChanged=${this.searchTypeChanged}
|
|
@@ -710,9 +710,10 @@ export class AppRoot extends LitElement {
|
|
|
710
710
|
* Handler for item removal
|
|
711
711
|
*/
|
|
712
712
|
private handleItemRemovalRequest(e: CustomEvent) {
|
|
713
|
-
|
|
714
|
-
|
|
713
|
+
this.collectionBrowser.showRemoveItemsProcessingModal();
|
|
714
|
+
console.log('itemRemovalRequested: ', e.detail.items);
|
|
715
715
|
|
|
716
|
+
setTimeout(() => {
|
|
716
717
|
// execute item-removal-service, and response is successfully deleted
|
|
717
718
|
const status = false;
|
|
718
719
|
|
|
@@ -723,7 +724,7 @@ export class AppRoot extends LitElement {
|
|
|
723
724
|
this.modalManager?.classList.remove('remove-items');
|
|
724
725
|
} else {
|
|
725
726
|
// looking for failure?
|
|
726
|
-
this.collectionBrowser.
|
|
727
|
+
this.collectionBrowser.showRemoveItemsErrorModal();
|
|
727
728
|
}
|
|
728
729
|
}, 2000); // let's wait to see processing modal
|
|
729
730
|
}
|
|
@@ -743,7 +744,6 @@ export class AppRoot extends LitElement {
|
|
|
743
744
|
this.collectionBrowser.isManageView = target.checked;
|
|
744
745
|
this.collectionBrowser.manageViewLabel =
|
|
745
746
|
'Select items to remove (customizable texts)';
|
|
746
|
-
this.collectionBrowser.hasItemsDeleted = true;
|
|
747
747
|
}
|
|
748
748
|
|
|
749
749
|
/**
|
|
@@ -44,7 +44,6 @@ import {
|
|
|
44
44
|
SORT_OPTIONS,
|
|
45
45
|
defaultProfileElementSorts,
|
|
46
46
|
FacetLoadStrategy,
|
|
47
|
-
ManageableItem,
|
|
48
47
|
} from './models';
|
|
49
48
|
import {
|
|
50
49
|
RestorationStateHandlerInterface,
|
|
@@ -66,9 +65,9 @@ import {
|
|
|
66
65
|
import chevronIcon from './assets/img/icons/chevron';
|
|
67
66
|
import { srOnlyStyle } from './styles/sr-only';
|
|
68
67
|
import { sha1 } from './utils/sha1';
|
|
69
|
-
import { formatDate } from './utils/format-date';
|
|
70
68
|
import { log } from './utils/log';
|
|
71
69
|
import type { PlaceholderType } from './empty-placeholder';
|
|
70
|
+
import type { ManageBar } from './manage/manage-bar';
|
|
72
71
|
|
|
73
72
|
import './empty-placeholder';
|
|
74
73
|
import './tiles/tile-dispatcher';
|
|
@@ -247,8 +246,6 @@ export class CollectionBrowser
|
|
|
247
246
|
*/
|
|
248
247
|
@property({ type: Boolean }) isManageView = false;
|
|
249
248
|
|
|
250
|
-
@property({ type: Boolean }) hasItemsDeleted = true;
|
|
251
|
-
|
|
252
249
|
@property({ type: String }) manageViewLabel = 'Select items to remove';
|
|
253
250
|
|
|
254
251
|
/** Whether to replace the default sort options with a slot for customization (default: false) */
|
|
@@ -303,6 +300,8 @@ export class CollectionBrowser
|
|
|
303
300
|
|
|
304
301
|
@query('collection-facets') private collectionFacets?: CollectionFacets;
|
|
305
302
|
|
|
303
|
+
@query('manage-bar') private manageBar?: ManageBar;
|
|
304
|
+
|
|
306
305
|
@property({ type: Object, attribute: false })
|
|
307
306
|
analyticsHandler?: AnalyticsManagerInterface;
|
|
308
307
|
|
|
@@ -778,12 +777,17 @@ export class CollectionBrowser
|
|
|
778
777
|
* showing the management view. This generally replaces the sort bar when present.
|
|
779
778
|
*/
|
|
780
779
|
private get manageBarTemplate(): TemplateResult {
|
|
780
|
+
const manageViewModelMsg =
|
|
781
|
+
this.profileElement === 'uploads'
|
|
782
|
+
? 'Note: it may take a few minutes for these items to stop appearing in your uploads list.'
|
|
783
|
+
: nothing;
|
|
784
|
+
|
|
781
785
|
return html`
|
|
782
786
|
<manage-bar
|
|
783
787
|
.label=${this.manageViewLabel}
|
|
784
788
|
.modalManager=${this.modalManager}
|
|
785
789
|
.selectedItems=${this.dataSource.checkedTileModels}
|
|
786
|
-
.
|
|
790
|
+
.manageViewModelMsg=${manageViewModelMsg}
|
|
787
791
|
showSelectAll
|
|
788
792
|
showUnselectAll
|
|
789
793
|
?showItemManageButton=${this.pageContext === 'search'}
|
|
@@ -805,16 +809,12 @@ export class CollectionBrowser
|
|
|
805
809
|
* Emits an `itemRemovalRequested` event with all checked tile models.
|
|
806
810
|
*/
|
|
807
811
|
private handleRemoveItems(): void {
|
|
808
|
-
this.hasItemsDeleted = true;
|
|
809
|
-
|
|
810
812
|
this.dispatchEvent(
|
|
811
|
-
new CustomEvent<{ items:
|
|
813
|
+
new CustomEvent<{ items: String[] }>('itemRemovalRequested', {
|
|
812
814
|
detail: {
|
|
813
|
-
items: this.dataSource.checkedTileModels.map(model =>
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
return cloned as ManageableItem;
|
|
817
|
-
}),
|
|
815
|
+
items: this.dataSource.checkedTileModels.map(model =>
|
|
816
|
+
model?.identifier ? model.identifier : ''
|
|
817
|
+
),
|
|
818
818
|
},
|
|
819
819
|
})
|
|
820
820
|
);
|
|
@@ -825,16 +825,30 @@ export class CollectionBrowser
|
|
|
825
825
|
*/
|
|
826
826
|
private handleManageItems(): void {
|
|
827
827
|
this.dispatchEvent(
|
|
828
|
-
new CustomEvent<{ items:
|
|
828
|
+
new CustomEvent<{ items: String[] }>('itemManagerRequested', {
|
|
829
829
|
detail: {
|
|
830
|
-
items: this.dataSource.checkedTileModels.map(
|
|
831
|
-
model
|
|
830
|
+
items: this.dataSource.checkedTileModels.map(model =>
|
|
831
|
+
model?.identifier ? model.identifier : ''
|
|
832
832
|
),
|
|
833
833
|
},
|
|
834
834
|
})
|
|
835
835
|
);
|
|
836
836
|
}
|
|
837
837
|
|
|
838
|
+
/**
|
|
839
|
+
* Handler to show processing modal while removing item
|
|
840
|
+
*/
|
|
841
|
+
showRemoveItemsProcessingModal(): void {
|
|
842
|
+
this.manageBar?.showRemoveItemsProcessingModal();
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
/**
|
|
846
|
+
* Handler to show error modal when item removal failed
|
|
847
|
+
*/
|
|
848
|
+
showRemoveItemsErrorModal(): void {
|
|
849
|
+
this.manageBar?.showRemoveItemsErrorModal();
|
|
850
|
+
}
|
|
851
|
+
|
|
838
852
|
/**
|
|
839
853
|
* Removes all tile models that are currently checked & adjusts the paging
|
|
840
854
|
* of the data source to account for any new gaps in the data.
|
package/src/manage/manage-bar.ts
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import { msg } from '@lit/localize';
|
|
2
|
-
import {
|
|
3
|
-
LitElement,
|
|
4
|
-
html,
|
|
5
|
-
css,
|
|
6
|
-
TemplateResult,
|
|
7
|
-
CSSResultGroup,
|
|
8
|
-
PropertyValues,
|
|
9
|
-
} from 'lit';
|
|
2
|
+
import { LitElement, html, css, TemplateResult, CSSResultGroup } from 'lit';
|
|
10
3
|
import { customElement, property } from 'lit/decorators.js';
|
|
11
4
|
import { when } from 'lit/directives/when.js';
|
|
12
5
|
import {
|
|
@@ -39,6 +32,11 @@ export class ManageBar extends LitElement {
|
|
|
39
32
|
*/
|
|
40
33
|
@property({ type: Object }) selectedItems: Array<ManageableItem> = [];
|
|
41
34
|
|
|
35
|
+
/**
|
|
36
|
+
* Message shows as note in the modal when removing items
|
|
37
|
+
*/
|
|
38
|
+
@property({ type: String }) manageViewModelMsg?: string;
|
|
39
|
+
|
|
42
40
|
/**
|
|
43
41
|
* Whether to show the "Select All" button (default false)
|
|
44
42
|
*/
|
|
@@ -49,11 +47,6 @@ export class ManageBar extends LitElement {
|
|
|
49
47
|
*/
|
|
50
48
|
@property({ type: Boolean }) showUnselectAll = false;
|
|
51
49
|
|
|
52
|
-
/**
|
|
53
|
-
* Whether item has deleted or not (default true)
|
|
54
|
-
*/
|
|
55
|
-
@property({ type: Boolean }) hasItemsDeleted = true;
|
|
56
|
-
|
|
57
50
|
/**
|
|
58
51
|
* Whether to show "Item Manager the items" button (default false)
|
|
59
52
|
*/
|
|
@@ -64,12 +57,6 @@ export class ManageBar extends LitElement {
|
|
|
64
57
|
*/
|
|
65
58
|
@property({ type: Boolean }) removeAllowed = false;
|
|
66
59
|
|
|
67
|
-
updated(changed: PropertyValues): void {
|
|
68
|
-
if (changed.has('hasItemsDeleted') && !this.hasItemsDeleted) {
|
|
69
|
-
this.showRemoveItemsErrorModal();
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
60
|
render(): TemplateResult {
|
|
74
61
|
return html`
|
|
75
62
|
<div class="manage-container">
|
|
@@ -125,7 +112,6 @@ export class ManageBar extends LitElement {
|
|
|
125
112
|
}
|
|
126
113
|
|
|
127
114
|
private removeItemsClicked(): void {
|
|
128
|
-
this.showRemoveItemsProcessingModal();
|
|
129
115
|
this.dispatchEvent(new CustomEvent('removeItems'));
|
|
130
116
|
}
|
|
131
117
|
|
|
@@ -146,17 +132,10 @@ export class ManageBar extends LitElement {
|
|
|
146
132
|
* @param items Which items to list in the modal
|
|
147
133
|
*/
|
|
148
134
|
private showRemoveItemsModal(): void {
|
|
149
|
-
const delayMessage =
|
|
150
|
-
this.activeTabId === 'uploads'
|
|
151
|
-
? msg(
|
|
152
|
-
'Note: it may take a few minutes for these items to stop appearing in your uploads list.'
|
|
153
|
-
)
|
|
154
|
-
: undefined;
|
|
155
|
-
|
|
156
135
|
const customModalContent = html`
|
|
157
136
|
<remove-items-modal-content
|
|
158
137
|
.items=${this.selectedItems}
|
|
159
|
-
.message=${
|
|
138
|
+
.message=${this.manageViewModelMsg}
|
|
160
139
|
@confirm=${() => this.removeItemsClicked()}
|
|
161
140
|
></remove-items-modal-content>
|
|
162
141
|
`;
|
|
@@ -184,7 +163,7 @@ export class ManageBar extends LitElement {
|
|
|
184
163
|
/**
|
|
185
164
|
* Shows a modal dialog indicating that item removal is being processed
|
|
186
165
|
*/
|
|
187
|
-
|
|
166
|
+
showRemoveItemsProcessingModal(): void {
|
|
188
167
|
const config = new ModalConfig({
|
|
189
168
|
showProcessingIndicator: true,
|
|
190
169
|
processingImageMode: 'processing',
|
|
@@ -207,7 +186,7 @@ export class ManageBar extends LitElement {
|
|
|
207
186
|
/**
|
|
208
187
|
* Shows a modal dialog indicating that an error occurred while removing items
|
|
209
188
|
*/
|
|
210
|
-
|
|
189
|
+
showRemoveItemsErrorModal(): void {
|
|
211
190
|
const config = new ModalConfig({
|
|
212
191
|
showProcessingIndicator: false,
|
|
213
192
|
processingImageMode: 'processing',
|