@sdcorejs/angular 22.3.0 → 22.3.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.
- package/README.md +2 -2
- package/assets/STYLE-GUIDE.md +25 -5
- package/assets/THEME.md +237 -5
- package/assets/licenses/tiptap-oss-NOTICES.txt +332 -0
- package/assets/scss/ckeditor5.scss +2 -88
- package/assets/scss/core/_control.scss +39 -0
- package/assets/scss/core/form.scss +156 -45
- package/assets/scss/core/view.scss +24 -0
- package/assets/scss/editor-content.scss +173 -0
- package/assets/scss/sd-core.scss +1 -0
- package/assets/scss/themes/_component-tokens.scss +93 -31
- package/assets/scss/themes/_material-tokens.scss +112 -0
- package/assets/scss/themes/_presets.scss +25 -0
- package/assets/scss/themes/_scales.scss +10 -0
- package/assets/scss/themes/_semantic.scss +13 -0
- package/assets/scss/themes/default.scss +8 -2
- package/fesm2022/sdcorejs-angular-components-api-contract-builder.mjs +5 -5
- package/fesm2022/sdcorejs-angular-components-api-contract-builder.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-avatar.mjs +166 -11
- package/fesm2022/sdcorejs-angular-components-avatar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-badge.mjs +590 -24
- package/fesm2022/sdcorejs-angular-components-badge.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-button.mjs +35 -3
- package/fesm2022/sdcorejs-angular-components-button.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-ckeditor-styles.mjs +5 -20
- package/fesm2022/sdcorejs-angular-components-ckeditor-styles.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-data-state.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-data-state.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-editor-engine.mjs +1906 -0
- package/fesm2022/sdcorejs-angular-components-editor-engine.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-components-editor.mjs +461 -757
- package/fesm2022/sdcorejs-angular-components-editor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-file-explorer.mjs +2295 -106
- package/fesm2022/sdcorejs-angular-components-file-explorer.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs +2686 -1050
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-history.mjs +5 -2
- package/fesm2022/sdcorejs-angular-components-history.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-image-editor.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-image-editor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-import-excel.mjs +21 -6
- package/fesm2022/sdcorejs-angular-components-import-excel.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-inform.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-inform.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-kanban.mjs +474 -0
- package/fesm2022/sdcorejs-angular-components-kanban.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-components-mini-editor.mjs +182 -284
- package/fesm2022/sdcorejs-angular-components-mini-editor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-modal-resizable.mjs +1 -316
- package/fesm2022/sdcorejs-angular-components-modal-resizable.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-modal.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-modal.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-operator.mjs +274 -44
- package/fesm2022/sdcorejs-angular-components-operator.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs +12 -12
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-query-builder.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-query-builder.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-section.mjs +5 -4
- package/fesm2022/sdcorejs-angular-components-section.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-side-drawer.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-side-drawer.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-stepper.mjs +5 -1
- package/fesm2022/sdcorejs-angular-components-stepper.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tab-router.mjs +202 -43
- package/fesm2022/sdcorejs-angular-components-tab-router.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tab.mjs +12 -4
- package/fesm2022/sdcorejs-angular-components-tab.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-table.mjs +581 -110
- package/fesm2022/sdcorejs-angular-components-table.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tree.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-tree.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs +1 -1
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-view.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-view.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-window.mjs +498 -0
- package/fesm2022/sdcorejs-angular-components-window.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-components.mjs +2 -0
- package/fesm2022/sdcorejs-angular-components.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-configurations.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-directives.mjs +18 -1
- package/fesm2022/sdcorejs-angular-directives.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs +15 -2
- package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-checkbox.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-checkbox.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs +480 -126
- package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-date-range.mjs +82 -13
- package/fesm2022/sdcorejs-angular-forms-date-range.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-date.mjs +77 -18
- package/fesm2022/sdcorejs-angular-forms-date.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-datetime.mjs +75 -16
- package/fesm2022/sdcorejs-angular-forms-datetime.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-directives.mjs +90 -2
- package/fesm2022/sdcorejs-angular-forms-directives.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input-color.mjs +1 -1
- package/fesm2022/sdcorejs-angular-forms-input-color.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input-number.mjs +46 -5
- package/fesm2022/sdcorejs-angular-forms-input-number.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input.mjs +56 -7
- package/fesm2022/sdcorejs-angular-forms-input.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-models.mjs +88 -5
- package/fesm2022/sdcorejs-angular-forms-models.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-radio.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-radio.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-segmented.mjs +263 -0
- package/fesm2022/sdcorejs-angular-forms-segmented.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-forms-select.mjs +71 -15
- package/fesm2022/sdcorejs-angular-forms-select.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-switch.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-switch.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-textarea.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-textarea.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-time.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-time.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-tree-select.mjs +1 -1
- package/fesm2022/sdcorejs-angular-forms-tree-select.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms.mjs +8 -0
- package/fesm2022/sdcorejs-angular-forms.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-i18n.mjs +1830 -17
- package/fesm2022/sdcorejs-angular-i18n.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-interceptors.mjs +1 -1
- package/fesm2022/sdcorejs-angular-interceptors.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-generic-generic-configuration.page-BrJfOTWy.mjs +509 -0
- package/fesm2022/sdcorejs-angular-modules-generic-generic-configuration.page-BrJfOTWy.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-generic-generic-form-host.page-DQYXx2nr.mjs +232 -0
- package/fesm2022/sdcorejs-angular-modules-generic-generic-form-host.page-DQYXx2nr.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-generic-generic-list.page-Cjg3Dfq1.mjs +294 -0
- package/fesm2022/sdcorejs-angular-modules-generic-generic-list.page-Cjg3Dfq1.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-DpXg2yI7.mjs +1556 -0
- package/fesm2022/sdcorejs-angular-modules-generic-sdcorejs-angular-modules-generic-DpXg2yI7.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-generic.mjs +2 -0
- package/fesm2022/sdcorejs-angular-modules-generic.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-modules-icon.mjs +96 -3
- package/fesm2022/sdcorejs-angular-modules-icon.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-layout.mjs +1908 -46
- package/fesm2022/sdcorejs-angular-modules-layout.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules.mjs +1 -0
- package/fesm2022/sdcorejs-angular-modules.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-pipes.mjs +27 -7
- package/fesm2022/sdcorejs-angular-pipes.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-confirm.mjs +2 -2
- package/fesm2022/sdcorejs-angular-services-confirm.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-date-time.mjs +143 -0
- package/fesm2022/sdcorejs-angular-services-date-time.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-services-storage.mjs +44 -8
- package/fesm2022/sdcorejs-angular-services-storage.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services.mjs +1 -0
- package/fesm2022/sdcorejs-angular-services.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-utilities-read-state.mjs +4 -0
- package/fesm2022/sdcorejs-angular-utilities-read-state.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-utilities-theme.mjs +10 -0
- package/fesm2022/sdcorejs-angular-utilities-theme.mjs.map +1 -1
- package/package.json +48 -7
- package/types/sdcorejs-angular-components-avatar.d.ts +67 -2
- package/types/sdcorejs-angular-components-badge.d.ts +188 -6
- package/types/sdcorejs-angular-components-button.d.ts +20 -1
- package/types/sdcorejs-angular-components-ckeditor-styles.d.ts +3 -18
- package/types/sdcorejs-angular-components-editor-engine.d.ts +246 -0
- package/types/sdcorejs-angular-components-editor.d.ts +20 -17
- package/types/sdcorejs-angular-components-file-explorer.d.ts +449 -57
- package/types/sdcorejs-angular-components-form-generic.d.ts +301 -37
- package/types/sdcorejs-angular-components-kanban.d.ts +179 -0
- package/types/sdcorejs-angular-components-mini-editor.d.ts +33 -70
- package/types/sdcorejs-angular-components-modal-resizable.d.ts +1 -124
- package/types/sdcorejs-angular-components-operator.d.ts +137 -8
- package/types/sdcorejs-angular-components-section.d.ts +2 -1
- package/types/sdcorejs-angular-components-tab-router.d.ts +31 -18
- package/types/sdcorejs-angular-components-tab.d.ts +3 -1
- package/types/sdcorejs-angular-components-table.d.ts +84 -6
- package/types/sdcorejs-angular-components-window.d.ts +81 -0
- package/types/sdcorejs-angular-components.d.ts +2 -0
- package/types/sdcorejs-angular-configurations.d.ts +8 -1
- package/types/sdcorejs-angular-forms-autocomplete.d.ts +5 -0
- package/types/sdcorejs-angular-forms-chip-calendar.d.ts +163 -18
- package/types/sdcorejs-angular-forms-date-range.d.ts +24 -2
- package/types/sdcorejs-angular-forms-date.d.ts +23 -2
- package/types/sdcorejs-angular-forms-directives.d.ts +47 -2
- package/types/sdcorejs-angular-forms-input-number.d.ts +23 -2
- package/types/sdcorejs-angular-forms-input.d.ts +23 -2
- package/types/sdcorejs-angular-forms-models.d.ts +38 -3
- package/types/sdcorejs-angular-forms-segmented.d.ts +90 -0
- package/types/sdcorejs-angular-forms-select.d.ts +32 -2
- package/types/sdcorejs-angular-forms.d.ts +8 -6
- package/types/sdcorejs-angular-i18n.d.ts +360 -1
- package/types/sdcorejs-angular-modules-generic.d.ts +316 -0
- package/types/sdcorejs-angular-modules-icon.d.ts +37 -6
- package/types/sdcorejs-angular-modules-layout.d.ts +536 -86
- package/types/sdcorejs-angular-modules.d.ts +1 -0
- package/types/sdcorejs-angular-pipes.d.ts +2 -0
- package/types/sdcorejs-angular-services-date-time.d.ts +57 -0
- package/types/sdcorejs-angular-services-storage.d.ts +8 -1
- package/types/sdcorejs-angular-services.d.ts +1 -0
- package/types/sdcorejs-angular-utilities-read-state.d.ts +2 -0
- package/types/sdcorejs-angular-utilities-theme.d.ts +1 -1
|
@@ -1,12 +1,504 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NgTemplateOutlet, NgComponentOutlet, DOCUMENT } from '@angular/common';
|
|
2
|
+
import * as i1 from '@angular/cdk/a11y';
|
|
3
|
+
import { A11yModule } from '@angular/cdk/a11y';
|
|
2
4
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { input, computed, ChangeDetectionStrategy, Component,
|
|
5
|
+
import { isDevMode, inject, input, viewChildren, computed, ChangeDetectionStrategy, Component, TemplateRef, Directive, output, viewChild, ElementRef, signal, effect, untracked, contentChildren, Injector, NgZone, DestroyRef, afterNextRender } from '@angular/core';
|
|
6
|
+
import { MatTooltip } from '@angular/material/tooltip';
|
|
4
7
|
import { SdBreadcrumb } from '@sdcorejs/angular/components/breadcrumb';
|
|
5
|
-
import { SdButton } from '@sdcorejs/angular/components/button';
|
|
8
|
+
import { SdButton, SdButtonItem } from '@sdcorejs/angular/components/button';
|
|
9
|
+
import { SdInform, SdInformActionDirective } from '@sdcorejs/angular/components/inform';
|
|
6
10
|
import { SdDataState } from '@sdcorejs/angular/components/data-state';
|
|
7
11
|
import { I18nService, SdTranslatePipe } from '@sdcorejs/angular/i18n';
|
|
12
|
+
import { SdDateTimeService } from '@sdcorejs/angular/services/date-time';
|
|
8
13
|
import { SdIcon } from '@sdcorejs/angular/modules/icon';
|
|
9
14
|
import { SdSideDrawer } from '@sdcorejs/angular/components/side-drawer';
|
|
15
|
+
import { MatCheckbox } from '@angular/material/checkbox';
|
|
16
|
+
|
|
17
|
+
/** Resolves original callbacks without wrappers; canonical groups win as a whole. */
|
|
18
|
+
function sdFileExplorerNormalizeConfig(config) {
|
|
19
|
+
const capabilities = config.capabilities;
|
|
20
|
+
const legacy = config;
|
|
21
|
+
return {
|
|
22
|
+
...config,
|
|
23
|
+
list: config.dataSource ? config.dataSource.onList : legacy.list,
|
|
24
|
+
search: config.dataSource ? config.dataSource.onSearch : legacy.search,
|
|
25
|
+
share: capabilities?.share ? capabilities.share.onShare : legacy.share,
|
|
26
|
+
download: capabilities?.download ? capabilities.download.onDownload : legacy.download,
|
|
27
|
+
preview: capabilities?.preview ? capabilities.preview.onPreview : legacy.preview,
|
|
28
|
+
upload: capabilities?.upload ? capabilities.upload.onUpload : legacy.upload,
|
|
29
|
+
createFolder: capabilities?.createFolder ? capabilities.createFolder.onCreateFolder : legacy.createFolder,
|
|
30
|
+
shareable: capabilities?.share?.shareable,
|
|
31
|
+
downloadable: capabilities?.download?.downloadable,
|
|
32
|
+
previewable: capabilities?.preview?.previewable,
|
|
33
|
+
uploadable: capabilities?.upload?.uploadable,
|
|
34
|
+
creatable: capabilities?.createFolder?.creatable,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/** Eligibility defaults true for a supported callback and is checked again at dispatch. */
|
|
38
|
+
function sdFileExplorerEligible(state, context) {
|
|
39
|
+
return typeof state === 'function' ? !!state(context) : state !== false;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const SD_FILE_EXPLORER_MOVE_MIME = 'application/x-sd-file-explorer-move';
|
|
43
|
+
/** Whole-batch validation keeps original caller objects and rejects stale destinations. */
|
|
44
|
+
function sdFileExplorerValidateMove(items, target, known, visible = known) {
|
|
45
|
+
if (!items.length || (target !== null && (target.kind !== 'folder' || !known.includes(target))))
|
|
46
|
+
return false;
|
|
47
|
+
const ids = new Set();
|
|
48
|
+
const knownIds = new Map();
|
|
49
|
+
for (const item of known) {
|
|
50
|
+
if (knownIds.has(item.id) && knownIds.get(item.id) !== item)
|
|
51
|
+
return false;
|
|
52
|
+
knownIds.set(item.id, item);
|
|
53
|
+
}
|
|
54
|
+
const visibleIds = new Map();
|
|
55
|
+
for (const item of visible) {
|
|
56
|
+
if (visibleIds.has(item.id) && visibleIds.get(item.id) !== item)
|
|
57
|
+
return false;
|
|
58
|
+
visibleIds.set(item.id, item);
|
|
59
|
+
}
|
|
60
|
+
for (const item of items) {
|
|
61
|
+
if (item.kind !== 'file' ||
|
|
62
|
+
!visible.includes(item) ||
|
|
63
|
+
knownIds.get(item.id)?.kind === 'folder' ||
|
|
64
|
+
ids.has(item.id) ||
|
|
65
|
+
item.parentId === (target?.id ?? null))
|
|
66
|
+
return false;
|
|
67
|
+
ids.add(item.id);
|
|
68
|
+
}
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
/** Tokens resolve only inside the originating instance and only during its current gesture. */
|
|
72
|
+
class SdFileExplorerDragSession {
|
|
73
|
+
#token = null;
|
|
74
|
+
#items = [];
|
|
75
|
+
get activeItems() {
|
|
76
|
+
return this.#token === null ? null : this.#items;
|
|
77
|
+
}
|
|
78
|
+
start(items) {
|
|
79
|
+
this.#token = crypto.randomUUID();
|
|
80
|
+
this.#items = Object.freeze([...items]);
|
|
81
|
+
return this.#token;
|
|
82
|
+
}
|
|
83
|
+
resolve(token) {
|
|
84
|
+
return this.#token !== null && token === this.#token ? this.#items : null;
|
|
85
|
+
}
|
|
86
|
+
clear() {
|
|
87
|
+
this.#token = null;
|
|
88
|
+
this.#items = [];
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Defaults of `fileCommands` and `folderCommands`: `text` and `secondary`, flat or grouped. */
|
|
93
|
+
const SD_FILE_EXPLORER_COMMAND_DEFAULTS = { leafType: 'text', groupType: 'text', color: 'secondary' };
|
|
94
|
+
/** Trigger icon of a group that declares no `prefixIcon`. */
|
|
95
|
+
const GROUP_ICON = 'more_vert';
|
|
96
|
+
// why: mỗi hàng của danh sách resolve lại cùng một bộ định nghĩa — cảnh báo theo định nghĩa (hoặc theo nội dung
|
|
97
|
+
// với giá trị không phải object) để console chỉ nhắc một lần, không phải một lần cho mỗi tệp.
|
|
98
|
+
const warnedDefinitions = new WeakSet();
|
|
99
|
+
const warnedMessages = new Set();
|
|
100
|
+
function text(value) {
|
|
101
|
+
return typeof value === 'string' && value.trim() ? value : undefined;
|
|
102
|
+
}
|
|
103
|
+
function evaluate(state, context) {
|
|
104
|
+
return typeof state === 'function' ? !!state(context) : !!state;
|
|
105
|
+
}
|
|
106
|
+
function warn(definition, message) {
|
|
107
|
+
if (!isDevMode())
|
|
108
|
+
return;
|
|
109
|
+
if (definition !== null && typeof definition === 'object') {
|
|
110
|
+
if (warnedDefinitions.has(definition))
|
|
111
|
+
return;
|
|
112
|
+
warnedDefinitions.add(definition);
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
if (warnedMessages.has(message))
|
|
116
|
+
return;
|
|
117
|
+
warnedMessages.add(message);
|
|
118
|
+
}
|
|
119
|
+
console.warn(message);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Why a definition cannot be rendered, or `null` when it is a usable leaf or group. TypeScript already rejects these
|
|
123
|
+
* shapes; this guards plain JavaScript and loosely typed configuration.
|
|
124
|
+
*/
|
|
125
|
+
function problem(definition, inGroup) {
|
|
126
|
+
if (definition === null || typeof definition !== 'object')
|
|
127
|
+
return 'is not an action object';
|
|
128
|
+
const { click, onClick, children, title, tooltip } = definition;
|
|
129
|
+
if (children !== undefined && children !== null && !Array.isArray(children))
|
|
130
|
+
return '`children` must be an array';
|
|
131
|
+
if (Array.isArray(children)) {
|
|
132
|
+
if (inGroup)
|
|
133
|
+
return 'is a group inside a group; groups are one level deep';
|
|
134
|
+
if (typeof click === 'function' || typeof onClick === 'function')
|
|
135
|
+
return 'declares both `click` and `children`; a group only opens its menu';
|
|
136
|
+
}
|
|
137
|
+
else if (typeof click !== 'function' && typeof onClick !== 'function') {
|
|
138
|
+
return 'needs `click` (an action) or `children` (a group)';
|
|
139
|
+
}
|
|
140
|
+
if (!text(title) && !text(tooltip))
|
|
141
|
+
return 'needs a `title` or a `tooltip` as its accessible name';
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
/** Selection capability is configuration-level. A context predicate cannot prove that every future selection is hidden. */
|
|
145
|
+
function sdFileExplorerHasActionCapability(actions) {
|
|
146
|
+
if (!Array.isArray(actions))
|
|
147
|
+
return false;
|
|
148
|
+
return actions.some((definition) => {
|
|
149
|
+
if (problem(definition, false) || definition.hidden === true)
|
|
150
|
+
return false;
|
|
151
|
+
return Array.isArray(definition.children)
|
|
152
|
+
? definition.children.some((child) => !problem(child, true) && child.hidden !== true)
|
|
153
|
+
: true;
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
function resolveMenu(group, context, path) {
|
|
157
|
+
const items = [];
|
|
158
|
+
group.children.forEach((child, index) => {
|
|
159
|
+
const reason = problem(child, true);
|
|
160
|
+
if (reason) {
|
|
161
|
+
warn(child, `[sd-file-explorer] ${path}.children[${index}] ignored: ${reason}.`);
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
if (evaluate(child.hidden, context))
|
|
165
|
+
return;
|
|
166
|
+
const title = text(child.title);
|
|
167
|
+
const tooltip = text(child.tooltip);
|
|
168
|
+
const loading = evaluate(child.loading, context);
|
|
169
|
+
items.push({
|
|
170
|
+
key: String(index),
|
|
171
|
+
definition: child,
|
|
172
|
+
label: (title ?? tooltip),
|
|
173
|
+
tooltip: title ? tooltip : undefined,
|
|
174
|
+
prefixIcon: child.prefixIcon ?? undefined,
|
|
175
|
+
suffixIcon: child.suffixIcon ?? undefined,
|
|
176
|
+
fontSet: child.fontSet ?? undefined,
|
|
177
|
+
color: child.color ?? undefined,
|
|
178
|
+
disabled: evaluate(child.disabled, context) || loading,
|
|
179
|
+
loading,
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
return items;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Visible actions of one collection for one context (the selected files, or one item), in declared order.
|
|
186
|
+
*
|
|
187
|
+
* Hidden entries, groups without a visible child and definitions that cannot be rendered are left out; nothing is
|
|
188
|
+
* regrouped or moved into an overflow menu. `source` names the collection in dev-mode warnings.
|
|
189
|
+
*/
|
|
190
|
+
function sdFileExplorerResolveActions(actions, context, defaults, source = 'actions') {
|
|
191
|
+
if (!Array.isArray(actions))
|
|
192
|
+
return [];
|
|
193
|
+
const resolved = [];
|
|
194
|
+
actions.forEach((definition, index) => {
|
|
195
|
+
const path = `${source}[${index}]`;
|
|
196
|
+
const reason = problem(definition, false);
|
|
197
|
+
if (reason) {
|
|
198
|
+
warn(definition, `[sd-file-explorer] ${path} ignored: ${reason}.`);
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
if (evaluate(definition.hidden, context))
|
|
202
|
+
return;
|
|
203
|
+
const isGroup = Array.isArray(definition.children);
|
|
204
|
+
const button = {
|
|
205
|
+
key: String(index),
|
|
206
|
+
title: text(definition.title),
|
|
207
|
+
tooltip: text(definition.tooltip),
|
|
208
|
+
prefixIcon: definition.prefixIcon ?? undefined,
|
|
209
|
+
suffixIcon: definition.suffixIcon ?? undefined,
|
|
210
|
+
fontSet: definition.fontSet ?? undefined,
|
|
211
|
+
color: definition.color ?? defaults.color,
|
|
212
|
+
type: definition.type ?? (isGroup ? defaults.groupType : defaults.leafType),
|
|
213
|
+
disabled: evaluate(definition.disabled, context),
|
|
214
|
+
loading: evaluate(definition.loading, context),
|
|
215
|
+
};
|
|
216
|
+
if (!isGroup) {
|
|
217
|
+
resolved.push({ ...button, kind: 'leaf', definition: definition });
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
const group = definition;
|
|
221
|
+
const children = resolveMenu(group, context, path);
|
|
222
|
+
if (children.length) {
|
|
223
|
+
resolved.push({ ...button, kind: 'group', definition: group, prefixIcon: group.prefixIcon ?? GROUP_ICON, children });
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
return resolved;
|
|
227
|
+
}
|
|
228
|
+
/** `true` when the action must not run now: hidden, disabled or loading for `context`, evaluated at call time. */
|
|
229
|
+
function sdFileExplorerActionBlocked(action, context) {
|
|
230
|
+
return evaluate(action.hidden, context) || evaluate(action.disabled, context) || evaluate(action.loading, context);
|
|
231
|
+
}
|
|
232
|
+
/** `true` while an entry, or an item of one of its groups, is loading: the compact trigger of the item shows it. */
|
|
233
|
+
function sdFileExplorerActionsBusy(resolved) {
|
|
234
|
+
return resolved.some(entry => entry.loading || (entry.kind === 'group' && entry.children.some(child => child.loading)));
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Entries of the compact command drawer, from the commands resolved for its item: same order, filtering and states as
|
|
238
|
+
* the desktop buttons, shown as menu-like entries. The drawer has no button variants, so `type` is dropped; a color is
|
|
239
|
+
* kept only when declared, for the icons. A group becomes a section with a text-only heading — its icon and color stay
|
|
240
|
+
* on the desktop trigger — whose children are disabled while the group itself is disabled or loading. `keys` renames
|
|
241
|
+
* entries by declared index (the row shortcuts: `share`, `download`).
|
|
242
|
+
*/
|
|
243
|
+
function sdFileExplorerSheetEntries(resolved, keys) {
|
|
244
|
+
return resolved.map(entry => {
|
|
245
|
+
const key = keys?.[Number(entry.key)] ?? entry.key;
|
|
246
|
+
if (entry.kind === 'leaf') {
|
|
247
|
+
return {
|
|
248
|
+
kind: 'leaf',
|
|
249
|
+
key,
|
|
250
|
+
label: (entry.title ?? entry.tooltip),
|
|
251
|
+
prefixIcon: entry.prefixIcon,
|
|
252
|
+
suffixIcon: entry.suffixIcon,
|
|
253
|
+
fontSet: entry.fontSet,
|
|
254
|
+
color: entry.definition.color ?? undefined,
|
|
255
|
+
disabled: entry.disabled || entry.loading,
|
|
256
|
+
loading: entry.loading,
|
|
257
|
+
definition: entry.definition,
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
const blocked = entry.disabled || entry.loading;
|
|
261
|
+
const children = entry.children.map((child) => ({
|
|
262
|
+
kind: 'leaf',
|
|
263
|
+
key: child.key,
|
|
264
|
+
label: child.label,
|
|
265
|
+
prefixIcon: child.prefixIcon,
|
|
266
|
+
suffixIcon: child.suffixIcon,
|
|
267
|
+
fontSet: child.fontSet,
|
|
268
|
+
color: child.color,
|
|
269
|
+
disabled: child.disabled || blocked,
|
|
270
|
+
loading: child.loading,
|
|
271
|
+
definition: child.definition,
|
|
272
|
+
}));
|
|
273
|
+
return {
|
|
274
|
+
kind: 'group',
|
|
275
|
+
key,
|
|
276
|
+
label: (entry.title ?? entry.tooltip),
|
|
277
|
+
disabled: entry.disabled,
|
|
278
|
+
loading: entry.loading,
|
|
279
|
+
definition: entry.definition,
|
|
280
|
+
children,
|
|
281
|
+
};
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Action area of the explorer (internal): `selector.actions`, `fileCommands` or `folderCommands` for one context.
|
|
287
|
+
*
|
|
288
|
+
* A leaf renders as an `sd-button` that runs its `click`; a group as an `sd-button` whose projected
|
|
289
|
+
* `sd-button-item`s open in the button's own Action Popover. Siblings keep their declared order and wrap onto another
|
|
290
|
+
* line when the area is narrow — nothing is folded into an automatic overflow menu.
|
|
291
|
+
*
|
|
292
|
+
* The host carries `sd-file-explorer-actions--open` while one of its menus is open and `--busy` while an entry is
|
|
293
|
+
* loading, so the row, card or tree node can keep an area that is otherwise revealed on hover visible.
|
|
294
|
+
*/
|
|
295
|
+
class SdFileExplorerActions {
|
|
296
|
+
#i18n = inject(I18nService);
|
|
297
|
+
/** Definitions to render. */
|
|
298
|
+
actions = input(undefined, /* @ts-ignore */
|
|
299
|
+
...(ngDevMode ? [{ debugName: "actions" }] : /* istanbul ignore next */ []));
|
|
300
|
+
/** Value handed to `click` and to the state predicates: the selected files, or one item. */
|
|
301
|
+
context = input.required(/* @ts-ignore */
|
|
302
|
+
...(ngDevMode ? [{ debugName: "context" }] : /* istanbul ignore next */ []));
|
|
303
|
+
/** Variant of leaves (flat buttons) without `type`. */
|
|
304
|
+
defaultLeafType = input('text', /* @ts-ignore */
|
|
305
|
+
...(ngDevMode ? [{ debugName: "defaultLeafType" }] : /* istanbul ignore next */ []));
|
|
306
|
+
/** Variant of group triggers without `type`. */
|
|
307
|
+
defaultGroupType = input('text', /* @ts-ignore */
|
|
308
|
+
...(ngDevMode ? [{ debugName: "defaultGroupType" }] : /* istanbul ignore next */ []));
|
|
309
|
+
/** Color of definitions without `color`. */
|
|
310
|
+
defaultColor = input('secondary', /* @ts-ignore */
|
|
311
|
+
...(ngDevMode ? [{ debugName: "defaultColor" }] : /* istanbul ignore next */ []));
|
|
312
|
+
/** `sd-button` size of every entry. */
|
|
313
|
+
size = input('sm', /* @ts-ignore */
|
|
314
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
315
|
+
/** Collection name used in dev-mode warnings. */
|
|
316
|
+
source = input('actions', /* @ts-ignore */
|
|
317
|
+
...(ngDevMode ? [{ debugName: "source" }] : /* istanbul ignore next */ []));
|
|
318
|
+
/** Prefix of the entries' `data-autoid`, suffixed with the declared index (and the child index in menus). */
|
|
319
|
+
autoId = input(undefined, /* @ts-ignore */
|
|
320
|
+
...(ngDevMode ? [{ debugName: "autoId" }] : /* istanbul ignore next */ []));
|
|
321
|
+
// why: Angular query không dùng được trên field private kiểu ES (#) — dùng `private` của TypeScript.
|
|
322
|
+
buttons = viewChildren(SdButton, /* @ts-ignore */
|
|
323
|
+
...(ngDevMode ? [{ debugName: "buttons" }] : /* istanbul ignore next */ []));
|
|
324
|
+
entries = computed(() => sdFileExplorerResolveActions(this.actions(), this.context(), { leafType: this.defaultLeafType(), groupType: this.defaultGroupType(), color: this.defaultColor() }, this.source()), /* @ts-ignore */
|
|
325
|
+
...(ngDevMode ? [{ debugName: "entries" }] : /* istanbul ignore next */ []));
|
|
326
|
+
// why: lệnh theo item cần gọn; giữ definition gốc để menu/drawer vẫn có nhãn và selector vẫn có title.
|
|
327
|
+
iconOnlyCommands = computed(() => this.source() === 'fileCommands' || this.source() === 'folderCommands', /* @ts-ignore */
|
|
328
|
+
...(ngDevMode ? [{ debugName: "iconOnlyCommands" }] : /* istanbul ignore next */ []));
|
|
329
|
+
open = computed(() => this.buttons().some(button => button.popover.opened()), /* @ts-ignore */
|
|
330
|
+
...(ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []));
|
|
331
|
+
busy = computed(() => sdFileExplorerActionsBusy(this.entries()), /* @ts-ignore */
|
|
332
|
+
...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
|
|
333
|
+
loadingLabel = computed(() => this.#i18n.t('core.component.file-explorer.action-loading'), /* @ts-ignore */
|
|
334
|
+
...(ngDevMode ? [{ debugName: "loadingLabel" }] : /* istanbul ignore next */ []));
|
|
335
|
+
run(action, group) {
|
|
336
|
+
const actions = this.actions();
|
|
337
|
+
// A stale rendered button or menu must not dispatch a definition the consumer has withdrawn.
|
|
338
|
+
if (group ? !actions?.includes(group) || !group.children.includes(action) : !actions?.includes(action))
|
|
339
|
+
return;
|
|
340
|
+
const context = this.context();
|
|
341
|
+
// why: trạng thái do consumer giữ có thể đã đổi sau lần render cuối (ví dụ bật loading ngay trong click trước, khi
|
|
342
|
+
// Angular chưa kịp vẽ lại nút) — đánh giá lại lúc bấm để click lặp hay menu cũ không chạy callback lần nữa.
|
|
343
|
+
if ((group && sdFileExplorerActionBlocked(group, context)) || sdFileExplorerActionBlocked(action, context))
|
|
344
|
+
return;
|
|
345
|
+
(action.onClick ?? action.click)?.(context);
|
|
346
|
+
}
|
|
347
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdFileExplorerActions, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
348
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdFileExplorerActions, isStandalone: true, selector: "sd-file-explorer-actions", inputs: { actions: { classPropertyName: "actions", publicName: "actions", isSignal: true, isRequired: false, transformFunction: null }, context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: true, transformFunction: null }, defaultLeafType: { classPropertyName: "defaultLeafType", publicName: "defaultLeafType", isSignal: true, isRequired: false, transformFunction: null }, defaultGroupType: { classPropertyName: "defaultGroupType", publicName: "defaultGroupType", isSignal: true, isRequired: false, transformFunction: null }, defaultColor: { classPropertyName: "defaultColor", publicName: "defaultColor", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.sd-file-explorer-actions--open": "open()", "class.sd-file-explorer-actions--busy": "busy()" }, classAttribute: "sd-file-explorer-actions" }, viewQueries: [{ propertyName: "buttons", predicate: SdButton, descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
349
|
+
@let _autoId = autoId();
|
|
350
|
+
@let _size = size();
|
|
351
|
+
@for (entry of entries(); track entry.key) {
|
|
352
|
+
@let _entryAutoId = _autoId ? _autoId + '-' + entry.key : null;
|
|
353
|
+
@let _iconOnly = iconOnlyCommands() && !!(entry.prefixIcon || entry.suffixIcon);
|
|
354
|
+
@let _title = iconOnlyCommands() ? (entry.title ?? entry.tooltip) : entry.title;
|
|
355
|
+
@if (entry.kind === 'leaf') {
|
|
356
|
+
<sd-button
|
|
357
|
+
class="action"
|
|
358
|
+
[class.action--dual-icon]="_iconOnly && !!entry.prefixIcon && !!entry.suffixIcon"
|
|
359
|
+
[type]="entry.type"
|
|
360
|
+
[color]="entry.color"
|
|
361
|
+
[size]="_size"
|
|
362
|
+
[title]="_iconOnly ? undefined : _title"
|
|
363
|
+
[tooltip]="_iconOnly ? (entry.tooltip ?? entry.title) : entry.tooltip"
|
|
364
|
+
[prefixIcon]="entry.prefixIcon"
|
|
365
|
+
[suffixIcon]="entry.suffixIcon"
|
|
366
|
+
[fontSet]="entry.fontSet"
|
|
367
|
+
[disabled]="entry.disabled"
|
|
368
|
+
[loading]="entry.loading"
|
|
369
|
+
[attr.data-autoid]="_entryAutoId"
|
|
370
|
+
(click)="run(entry.definition)" />
|
|
371
|
+
} @else {
|
|
372
|
+
<sd-button
|
|
373
|
+
class="action action--group"
|
|
374
|
+
[class.action--dual-icon]="_iconOnly && !!entry.prefixIcon && !!entry.suffixIcon"
|
|
375
|
+
[type]="entry.type"
|
|
376
|
+
[color]="entry.color"
|
|
377
|
+
[size]="_size"
|
|
378
|
+
[title]="_iconOnly ? undefined : _title"
|
|
379
|
+
[tooltip]="_iconOnly ? (entry.tooltip ?? entry.title) : entry.tooltip"
|
|
380
|
+
[prefixIcon]="entry.prefixIcon"
|
|
381
|
+
[suffixIcon]="entry.suffixIcon"
|
|
382
|
+
[fontSet]="entry.fontSet"
|
|
383
|
+
[disabled]="entry.disabled"
|
|
384
|
+
[loading]="entry.loading"
|
|
385
|
+
[attr.data-autoid]="_entryAutoId">
|
|
386
|
+
@for (child of entry.children; track child.key) {
|
|
387
|
+
<sd-button-item
|
|
388
|
+
[color]="child.color"
|
|
389
|
+
[prefixIcon]="child.prefixIcon"
|
|
390
|
+
[suffixIcon]="child.suffixIcon"
|
|
391
|
+
[fontSet]="child.fontSet"
|
|
392
|
+
[tooltip]="child.tooltip"
|
|
393
|
+
[disabled]="child.disabled"
|
|
394
|
+
[autoId]="_entryAutoId ? _entryAutoId + '-' + child.key : null"
|
|
395
|
+
(click)="run(child.definition, entry.definition)">
|
|
396
|
+
<!-- why: sd-button-item has no loading input; a busy item shows a spinner here and is disabled. -->
|
|
397
|
+
@if (child.loading) {
|
|
398
|
+
<span class="spinner" aria-hidden="true"></span>
|
|
399
|
+
}
|
|
400
|
+
{{ child.label }}
|
|
401
|
+
@if (child.loading) {
|
|
402
|
+
<span class="visually-hidden">{{ loadingLabel() }}</span>
|
|
403
|
+
}
|
|
404
|
+
</sd-button-item>
|
|
405
|
+
}
|
|
406
|
+
</sd-button>
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
`, isInline: true, styles: [":host{display:inline-flex;flex-wrap:wrap;align-items:center;gap:2px;min-width:0;max-width:100%}sd-button{min-width:0;max-width:100%}:host ::ng-deep>sd-button>button.c-button{max-width:100%}:host ::ng-deep>sd-button.action--dual-icon>button.c-button.c-square{width:auto!important;padding-inline:6px!important}.spinner{display:inline-block;width:14px;height:14px;margin-inline-end:8px;vertical-align:-2px;border:2px solid color-mix(in srgb,currentColor 25%,transparent);border-top-color:currentColor;border-radius:50%;animation:sd-file-explorer-actions-spin .8s linear infinite}.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}@keyframes sd-file-explorer-actions-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.spinner{animation-duration:2.4s}}\n"], dependencies: [{ kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "openOnHover", "loading", "block", "htmlType", "indicator", "indicatorColor", "indicatorMax", "indicatorLabel"], outputs: ["click"] }, { kind: "component", type: SdButtonItem, selector: "sd-button-item", inputs: ["color", "prefixIcon", "suffixIcon", "fontSet", "disabled", "tooltip", "autoId"], outputs: ["click"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
410
|
+
}
|
|
411
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdFileExplorerActions, decorators: [{
|
|
412
|
+
type: Component,
|
|
413
|
+
args: [{ selector: 'sd-file-explorer-actions', standalone: true, imports: [SdButton, SdButtonItem], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
414
|
+
class: 'sd-file-explorer-actions',
|
|
415
|
+
'[class.sd-file-explorer-actions--open]': 'open()',
|
|
416
|
+
'[class.sd-file-explorer-actions--busy]': 'busy()',
|
|
417
|
+
}, template: `
|
|
418
|
+
@let _autoId = autoId();
|
|
419
|
+
@let _size = size();
|
|
420
|
+
@for (entry of entries(); track entry.key) {
|
|
421
|
+
@let _entryAutoId = _autoId ? _autoId + '-' + entry.key : null;
|
|
422
|
+
@let _iconOnly = iconOnlyCommands() && !!(entry.prefixIcon || entry.suffixIcon);
|
|
423
|
+
@let _title = iconOnlyCommands() ? (entry.title ?? entry.tooltip) : entry.title;
|
|
424
|
+
@if (entry.kind === 'leaf') {
|
|
425
|
+
<sd-button
|
|
426
|
+
class="action"
|
|
427
|
+
[class.action--dual-icon]="_iconOnly && !!entry.prefixIcon && !!entry.suffixIcon"
|
|
428
|
+
[type]="entry.type"
|
|
429
|
+
[color]="entry.color"
|
|
430
|
+
[size]="_size"
|
|
431
|
+
[title]="_iconOnly ? undefined : _title"
|
|
432
|
+
[tooltip]="_iconOnly ? (entry.tooltip ?? entry.title) : entry.tooltip"
|
|
433
|
+
[prefixIcon]="entry.prefixIcon"
|
|
434
|
+
[suffixIcon]="entry.suffixIcon"
|
|
435
|
+
[fontSet]="entry.fontSet"
|
|
436
|
+
[disabled]="entry.disabled"
|
|
437
|
+
[loading]="entry.loading"
|
|
438
|
+
[attr.data-autoid]="_entryAutoId"
|
|
439
|
+
(click)="run(entry.definition)" />
|
|
440
|
+
} @else {
|
|
441
|
+
<sd-button
|
|
442
|
+
class="action action--group"
|
|
443
|
+
[class.action--dual-icon]="_iconOnly && !!entry.prefixIcon && !!entry.suffixIcon"
|
|
444
|
+
[type]="entry.type"
|
|
445
|
+
[color]="entry.color"
|
|
446
|
+
[size]="_size"
|
|
447
|
+
[title]="_iconOnly ? undefined : _title"
|
|
448
|
+
[tooltip]="_iconOnly ? (entry.tooltip ?? entry.title) : entry.tooltip"
|
|
449
|
+
[prefixIcon]="entry.prefixIcon"
|
|
450
|
+
[suffixIcon]="entry.suffixIcon"
|
|
451
|
+
[fontSet]="entry.fontSet"
|
|
452
|
+
[disabled]="entry.disabled"
|
|
453
|
+
[loading]="entry.loading"
|
|
454
|
+
[attr.data-autoid]="_entryAutoId">
|
|
455
|
+
@for (child of entry.children; track child.key) {
|
|
456
|
+
<sd-button-item
|
|
457
|
+
[color]="child.color"
|
|
458
|
+
[prefixIcon]="child.prefixIcon"
|
|
459
|
+
[suffixIcon]="child.suffixIcon"
|
|
460
|
+
[fontSet]="child.fontSet"
|
|
461
|
+
[tooltip]="child.tooltip"
|
|
462
|
+
[disabled]="child.disabled"
|
|
463
|
+
[autoId]="_entryAutoId ? _entryAutoId + '-' + child.key : null"
|
|
464
|
+
(click)="run(child.definition, entry.definition)">
|
|
465
|
+
<!-- why: sd-button-item has no loading input; a busy item shows a spinner here and is disabled. -->
|
|
466
|
+
@if (child.loading) {
|
|
467
|
+
<span class="spinner" aria-hidden="true"></span>
|
|
468
|
+
}
|
|
469
|
+
{{ child.label }}
|
|
470
|
+
@if (child.loading) {
|
|
471
|
+
<span class="visually-hidden">{{ loadingLabel() }}</span>
|
|
472
|
+
}
|
|
473
|
+
</sd-button-item>
|
|
474
|
+
}
|
|
475
|
+
</sd-button>
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
`, styles: [":host{display:inline-flex;flex-wrap:wrap;align-items:center;gap:2px;min-width:0;max-width:100%}sd-button{min-width:0;max-width:100%}:host ::ng-deep>sd-button>button.c-button{max-width:100%}:host ::ng-deep>sd-button.action--dual-icon>button.c-button.c-square{width:auto!important;padding-inline:6px!important}.spinner{display:inline-block;width:14px;height:14px;margin-inline-end:8px;vertical-align:-2px;border:2px solid color-mix(in srgb,currentColor 25%,transparent);border-top-color:currentColor;border-radius:50%;animation:sd-file-explorer-actions-spin .8s linear infinite}.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}@keyframes sd-file-explorer-actions-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.spinner{animation-duration:2.4s}}\n"] }]
|
|
479
|
+
}], propDecorators: { actions: [{ type: i0.Input, args: [{ isSignal: true, alias: "actions", required: false }] }], context: [{ type: i0.Input, args: [{ isSignal: true, alias: "context", required: true }] }], defaultLeafType: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultLeafType", required: false }] }], defaultGroupType: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultGroupType", required: false }] }], defaultColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultColor", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], source: [{ type: i0.Input, args: [{ isSignal: true, alias: "source", required: false }] }], autoId: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], buttons: [{ type: i0.ViewChildren, args: [i0.forwardRef(() => SdButton), { isSignal: true }] }] } });
|
|
480
|
+
|
|
481
|
+
/** List-only custom metadata column. Pass the parent option as its required type anchor. */
|
|
482
|
+
// Public column-definition name follows the reviewed Explorer contract.
|
|
483
|
+
// eslint-disable-next-line @angular-eslint/directive-class-suffix
|
|
484
|
+
class SdFileExplorerColumnDef {
|
|
485
|
+
id = input.required({ ...(ngDevMode ? { debugName: "id" } : /* istanbul ignore next */ {}), alias: 'sdFileExplorerColumnDef' });
|
|
486
|
+
for = input.required({ ...(ngDevMode ? { debugName: "for" } : /* istanbul ignore next */ {}), alias: 'sdFileExplorerColumnFor' });
|
|
487
|
+
title = input.required(/* @ts-ignore */
|
|
488
|
+
...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
|
|
489
|
+
width = input('160px', /* @ts-ignore */
|
|
490
|
+
...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []));
|
|
491
|
+
template = inject(TemplateRef);
|
|
492
|
+
static ngTemplateContextGuard(_directive, _context) {
|
|
493
|
+
return true;
|
|
494
|
+
}
|
|
495
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdFileExplorerColumnDef, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
496
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.5", type: SdFileExplorerColumnDef, isStandalone: true, selector: "ng-template[sdFileExplorerColumnDef]", inputs: { id: { classPropertyName: "id", publicName: "sdFileExplorerColumnDef", isSignal: true, isRequired: true, transformFunction: null }, for: { classPropertyName: "for", publicName: "sdFileExplorerColumnFor", isSignal: true, isRequired: true, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: true, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
497
|
+
}
|
|
498
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdFileExplorerColumnDef, decorators: [{
|
|
499
|
+
type: Directive,
|
|
500
|
+
args: [{ selector: 'ng-template[sdFileExplorerColumnDef]', standalone: true }]
|
|
501
|
+
}], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "sdFileExplorerColumnDef", required: true }] }], for: [{ type: i0.Input, args: [{ isSignal: true, alias: "sdFileExplorerColumnFor", required: true }] }], title: [{ type: i0.Input, args: [{ isSignal: true, alias: "title", required: true }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }] } });
|
|
10
502
|
|
|
11
503
|
// AUTO-GENERATED by scripts/generate-file-explorer-icons.mjs from ./assets/icons. DO NOT EDIT.
|
|
12
504
|
// Run `npm run generate:file-explorer-icons` at the repo root after changing the SVG files or manifest.json.
|
|
@@ -351,11 +843,15 @@ function sdFileExplorerParseDate(value) {
|
|
|
351
843
|
const date = value instanceof Date ? value : new Date(value);
|
|
352
844
|
return Number.isNaN(date.getTime()) ? null : date;
|
|
353
845
|
}
|
|
846
|
+
const zonedOf = (dateTime) => (dateTime && dateTime.timeZone !== 'local' ? dateTime : undefined);
|
|
354
847
|
/**
|
|
355
848
|
* Compact modification date: "today" / "yesterday" labels, day + month within the current year,
|
|
356
849
|
* full date otherwise. Order of day and month follows the locale.
|
|
357
850
|
*/
|
|
358
|
-
function sdFileExplorerFormatDate(value, now, locale, labels) {
|
|
851
|
+
function sdFileExplorerFormatDate(value, now, locale, labels, dateTime) {
|
|
852
|
+
const zoned = zonedOf(dateTime);
|
|
853
|
+
if (zoned)
|
|
854
|
+
return formatZonedDate(value, now, locale, labels, zoned);
|
|
359
855
|
const date = sdFileExplorerParseDate(value);
|
|
360
856
|
if (!date)
|
|
361
857
|
return '';
|
|
@@ -366,26 +862,39 @@ function sdFileExplorerFormatDate(value, now, locale, labels) {
|
|
|
366
862
|
return labels.today;
|
|
367
863
|
if (day === new Date(now.getFullYear(), now.getMonth(), now.getDate() - 1).getTime())
|
|
368
864
|
return labels.yesterday;
|
|
369
|
-
|
|
865
|
+
return dayMonthYear(date, locale, date.getFullYear() === now.getFullYear());
|
|
866
|
+
}
|
|
867
|
+
/** Calendar days of the configured zone; yesterday is the day of the last millisecond before today began there. */
|
|
868
|
+
function formatZonedDate(value, now, locale, labels, zoned) {
|
|
869
|
+
const date = value === null || value === undefined || value === '' ? null : zoned.parse(value);
|
|
870
|
+
if (!date)
|
|
871
|
+
return '';
|
|
872
|
+
const day = zoned.toFormat(date, 'yyyy/MM/dd');
|
|
873
|
+
if (day === zoned.toFormat(now, 'yyyy/MM/dd'))
|
|
874
|
+
return labels.today;
|
|
875
|
+
if (day === zoned.toFormat(zoned.begin(now).getTime() - 1, 'yyyy/MM/dd'))
|
|
876
|
+
return labels.yesterday;
|
|
877
|
+
return dayMonthYear(date, locale, zoned.toFormat(date, 'yyyy') === zoned.toFormat(now, 'yyyy'), zoned.timeZone);
|
|
878
|
+
}
|
|
879
|
+
function dayMonthYear(date, locale, sameYear, timeZone) {
|
|
880
|
+
const options = sameYear
|
|
881
|
+
? { day: '2-digit', month: '2-digit' }
|
|
882
|
+
: { day: '2-digit', month: '2-digit', year: 'numeric' };
|
|
370
883
|
// why: lấy THỨ TỰ ngày/tháng theo locale nhưng luôn nối bằng "/" — Chrome format vi-VN ngày+tháng thành "21-09".
|
|
371
|
-
return new Intl.DateTimeFormat(locale, options)
|
|
884
|
+
return new Intl.DateTimeFormat(locale, timeZone ? { ...options, timeZone } : options)
|
|
372
885
|
.formatToParts(date)
|
|
373
886
|
.filter(part => part.type === 'day' || part.type === 'month' || part.type === 'year')
|
|
374
887
|
.map(part => part.value)
|
|
375
888
|
.join('/');
|
|
376
889
|
}
|
|
377
890
|
/** Full date and time, used as tooltip and in the preview metadata. */
|
|
378
|
-
function sdFileExplorerFormatDateTime(value, locale) {
|
|
379
|
-
const
|
|
891
|
+
function sdFileExplorerFormatDateTime(value, locale, dateTime) {
|
|
892
|
+
const zoned = zonedOf(dateTime);
|
|
893
|
+
const date = zoned ? (value === null || value === undefined || value === '' ? null : zoned.parse(value)) : sdFileExplorerParseDate(value);
|
|
380
894
|
if (!date)
|
|
381
895
|
return '';
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
month: '2-digit',
|
|
385
|
-
year: 'numeric',
|
|
386
|
-
hour: '2-digit',
|
|
387
|
-
minute: '2-digit',
|
|
388
|
-
}).format(date);
|
|
896
|
+
const options = { day: '2-digit', month: '2-digit', year: 'numeric', hour: '2-digit', minute: '2-digit' };
|
|
897
|
+
return new Intl.DateTimeFormat(locale, zoned ? { ...options, timeZone: zoned.timeZone } : options).format(date);
|
|
389
898
|
}
|
|
390
899
|
/** Lower-cases and strips Vietnamese accents so "tai lieu" matches "Tài liệu". */
|
|
391
900
|
function sdFileExplorerNormalize(value) {
|
|
@@ -446,29 +955,399 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
446
955
|
}, template: `<img [src]="src()" alt="" draggable="false" />`, styles: [":host{display:inline-flex;flex:none;width:var(--sd-file-explorer-icon-size, 32px);height:var(--sd-file-explorer-icon-size, 32px)}img{display:block;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;user-select:none}\n"] }]
|
|
447
956
|
}], propDecorators: { icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: true }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }] } });
|
|
448
957
|
|
|
958
|
+
/** Never the whole viewport: a strip of backdrop stays visible to tap the drawer away. */
|
|
959
|
+
const SHEET_WIDTH = 'min(400px, calc(100vw - 56px))';
|
|
960
|
+
let nextSheetId = 0;
|
|
961
|
+
/**
|
|
962
|
+
* Command drawer of the compact layout (internal): the commands of one item in a Core `<sd-side-drawer>` that covers
|
|
963
|
+
* the viewport — portalled to `<body>`, with its backdrop, `Escape`, close button, focus trap and page scroll lock.
|
|
964
|
+
*
|
|
965
|
+
* The explorer owns the item and decides when the drawer opens and closes: `show()` / `hide()`. The drawer lists the
|
|
966
|
+
* same commands as the desktop buttons, as menu-like entries; a group is a labelled section with its children. A
|
|
967
|
+
* pressed entry is only reported (`activate`): the explorer checks it again, closes the drawer and runs it. `close`
|
|
968
|
+
* reports that the user closed the drawer (close button, `Escape`, backdrop).
|
|
969
|
+
*
|
|
970
|
+
* Content projected into the drawer belongs to this view, so its encapsulated styles still apply in `<body>`; the
|
|
971
|
+
* drawer element itself is styled through the class this component passes as `drawerClass`.
|
|
972
|
+
*/
|
|
973
|
+
class SdFileExplorerCommandSheet {
|
|
974
|
+
#i18n = inject(I18nService);
|
|
975
|
+
/** Content for the item whose commands are shown; `null` while nothing is open. */
|
|
976
|
+
sheet = input(null, /* @ts-ignore */
|
|
977
|
+
...(ngDevMode ? [{ debugName: "sheet" }] : /* istanbul ignore next */ []));
|
|
978
|
+
/** Touch screen: 48 px entries and a 44 px close button. */
|
|
979
|
+
touch = input(false, /* @ts-ignore */
|
|
980
|
+
...(ngDevMode ? [{ debugName: "touch" }] : /* istanbul ignore next */ []));
|
|
981
|
+
/** E2E scope of the content and its entries. */
|
|
982
|
+
autoId = input(undefined, /* @ts-ignore */
|
|
983
|
+
...(ngDevMode ? [{ debugName: "autoId" }] : /* istanbul ignore next */ []));
|
|
984
|
+
/** An entry was pressed. Nothing has run yet. */
|
|
985
|
+
activate = output();
|
|
986
|
+
/** The user closed the drawer (close button, `Escape` or backdrop). */
|
|
987
|
+
close = output();
|
|
988
|
+
// why: query signal, not an ES private field — Angular queries need a TypeScript `private` member.
|
|
989
|
+
drawer = viewChild.required(SdSideDrawer, /* @ts-ignore */
|
|
990
|
+
...(ngDevMode ? [{ debugName: "drawer" }] : /* istanbul ignore next */ []));
|
|
991
|
+
width = SHEET_WIDTH;
|
|
992
|
+
sheetId = `sd-file-explorer-commands-${nextSheetId++}`;
|
|
993
|
+
// why: sd-side-drawer renders in <body>, out of reach of this view's encapsulated styles. The explorer-owned class
|
|
994
|
+
// scopes the few rules aimed at the drawer itself (the close button size) to this drawer only.
|
|
995
|
+
drawerClass = computed(() => ({
|
|
996
|
+
'sd-file-explorer-command-drawer': true,
|
|
997
|
+
'sd-file-explorer-command-drawer--touch': this.touch(),
|
|
998
|
+
}), /* @ts-ignore */
|
|
999
|
+
...(ngDevMode ? [{ debugName: "drawerClass" }] : /* istanbul ignore next */ []));
|
|
1000
|
+
// why: sd-side-drawer adds its own `components-side-drawer-` prefix; drop the explorer's `components-` to avoid a repeat.
|
|
1001
|
+
drawerAutoId = computed(() => this.autoId()?.replace(/^components-/, ''), /* @ts-ignore */
|
|
1002
|
+
...(ngDevMode ? [{ debugName: "drawerAutoId" }] : /* istanbul ignore next */ []));
|
|
1003
|
+
loadingLabel = computed(() => this.#i18n.t('core.component.file-explorer.action-loading'), /* @ts-ignore */
|
|
1004
|
+
...(ngDevMode ? [{ debugName: "loadingLabel" }] : /* istanbul ignore next */ []));
|
|
1005
|
+
/** Opens the drawer; its content follows `sheet`. */
|
|
1006
|
+
show() {
|
|
1007
|
+
this.drawer().open();
|
|
1008
|
+
}
|
|
1009
|
+
/** Closes the drawer at once — focus trap, backdrop and page scroll lock included — without reporting `close`. */
|
|
1010
|
+
hide() {
|
|
1011
|
+
const drawer = this.drawer();
|
|
1012
|
+
if (drawer.isOpened())
|
|
1013
|
+
drawer.forceClose();
|
|
1014
|
+
}
|
|
1015
|
+
accent(color) {
|
|
1016
|
+
return color ? `var(--sd-${color})` : null;
|
|
1017
|
+
}
|
|
1018
|
+
onDrawerClosed() {
|
|
1019
|
+
// Closed by the explorer (it has already let go of the item) or by the user: the explorer tells them apart.
|
|
1020
|
+
if (this.sheet())
|
|
1021
|
+
this.close.emit();
|
|
1022
|
+
}
|
|
1023
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdFileExplorerCommandSheet, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1024
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdFileExplorerCommandSheet, isStandalone: true, selector: "sd-file-explorer-command-sheet", inputs: { sheet: { classPropertyName: "sheet", publicName: "sheet", isSignal: true, isRequired: false, transformFunction: null }, touch: { classPropertyName: "touch", publicName: "touch", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { activate: "activate", close: "close" }, host: { classAttribute: "sd-file-explorer-command-sheet" }, viewQueries: [{ propertyName: "drawer", first: true, predicate: SdSideDrawer, descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
1025
|
+
@let _sheet = sheet();
|
|
1026
|
+
@let _autoId = autoId();
|
|
1027
|
+
<sd-side-drawer
|
|
1028
|
+
[width]="width"
|
|
1029
|
+
[title]="_sheet?.title ?? ''"
|
|
1030
|
+
[drawerClass]="drawerClass()"
|
|
1031
|
+
[autoId]="drawerAutoId()"
|
|
1032
|
+
(sdClosed)="onDrawerClosed()">
|
|
1033
|
+
@if (_sheet) {
|
|
1034
|
+
<div class="sheet" [class.sheet--touch]="touch()" [attr.data-autoid]="_autoId ?? null">
|
|
1035
|
+
<p class="context">
|
|
1036
|
+
<sd-file-explorer-file-icon [icon]="_sheet.icon" [size]="24" />
|
|
1037
|
+
<span class="context-text">{{ _sheet.context }}</span>
|
|
1038
|
+
</p>
|
|
1039
|
+
<div class="entries">
|
|
1040
|
+
@for (entry of _sheet.entries; track entry.key) {
|
|
1041
|
+
@if (entry.kind === 'group') {
|
|
1042
|
+
@let _labelId = sheetId + '-group-' + entry.key;
|
|
1043
|
+
<div
|
|
1044
|
+
class="group"
|
|
1045
|
+
role="group"
|
|
1046
|
+
[attr.aria-labelledby]="entry.loading ? _labelId + ' ' + _labelId + '-busy' : _labelId"
|
|
1047
|
+
[attr.aria-disabled]="entry.disabled ? true : null"
|
|
1048
|
+
[attr.aria-busy]="entry.loading ? true : null">
|
|
1049
|
+
<!-- why: the heading is not a control: text only, so it never repeats the icon of a child (a "Share"
|
|
1050
|
+
group over a "Share" item). The group's icon stays on its desktop trigger; a busy group still
|
|
1051
|
+
shows its spinner and says "in progress". -->
|
|
1052
|
+
<p class="group-label">
|
|
1053
|
+
@if (entry.loading) {
|
|
1054
|
+
<span class="spinner" aria-hidden="true"></span>
|
|
1055
|
+
}
|
|
1056
|
+
<span class="group-title" [id]="_labelId">{{ entry.label }}</span>
|
|
1057
|
+
@if (entry.loading) {
|
|
1058
|
+
<span class="visually-hidden" [id]="_labelId + '-busy'">{{ loadingLabel() }}</span>
|
|
1059
|
+
}
|
|
1060
|
+
</p>
|
|
1061
|
+
@for (child of entry.children; track child.key) {
|
|
1062
|
+
<ng-container
|
|
1063
|
+
[ngTemplateOutlet]="command"
|
|
1064
|
+
[ngTemplateOutletContext]="{
|
|
1065
|
+
$implicit: child,
|
|
1066
|
+
group: entry,
|
|
1067
|
+
autoId: _autoId ? _autoId + '-' + entry.key + '-' + child.key : null,
|
|
1068
|
+
}" />
|
|
1069
|
+
}
|
|
1070
|
+
</div>
|
|
1071
|
+
} @else {
|
|
1072
|
+
<ng-container
|
|
1073
|
+
[ngTemplateOutlet]="command"
|
|
1074
|
+
[ngTemplateOutletContext]="{ $implicit: entry, group: null, autoId: _autoId ? _autoId + '-' + entry.key : null }" />
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
</div>
|
|
1078
|
+
</div>
|
|
1079
|
+
}
|
|
1080
|
+
</sd-side-drawer>
|
|
1081
|
+
|
|
1082
|
+
<!-- One entry: neutral label, icons in the declared color (as Core menu items), spinner + hidden text while loading. -->
|
|
1083
|
+
<ng-template #command let-command let-group="group" let-entryAutoId="autoId">
|
|
1084
|
+
<button
|
|
1085
|
+
type="button"
|
|
1086
|
+
class="command"
|
|
1087
|
+
[disabled]="command.disabled"
|
|
1088
|
+
[style.--sd-fe-command-accent]="accent(command.color)"
|
|
1089
|
+
[attr.data-autoid]="entryAutoId"
|
|
1090
|
+
(click)="activate.emit({ command, group })">
|
|
1091
|
+
@if (command.loading) {
|
|
1092
|
+
<span class="spinner" aria-hidden="true"></span>
|
|
1093
|
+
} @else if (command.prefixIcon) {
|
|
1094
|
+
<sd-icon class="command-icon" size="20px" [name]="command.prefixIcon" [fontSet]="command.fontSet" />
|
|
1095
|
+
}
|
|
1096
|
+
<span class="command-label">{{ command.label }}</span>
|
|
1097
|
+
@if (command.suffixIcon && !command.loading) {
|
|
1098
|
+
<sd-icon class="command-icon" size="20px" [name]="command.suffixIcon" [fontSet]="command.fontSet" />
|
|
1099
|
+
}
|
|
1100
|
+
@if (command.loading) {
|
|
1101
|
+
<span class="visually-hidden">{{ loadingLabel() }}</span>
|
|
1102
|
+
}
|
|
1103
|
+
</button>
|
|
1104
|
+
</ng-template>
|
|
1105
|
+
`, isInline: true, styles: [".sheet{display:flex;flex-direction:column;gap:12px;padding-bottom:env(safe-area-inset-bottom,0px)}.context{display:flex;align-items:center;gap:8px;margin:0;color:var(--sd-text-secondary, #44474f);font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-18, 18px)}.context-text{min-width:0;overflow-wrap:anywhere}.entries{display:flex;flex-direction:column;gap:2px;margin:0 -8px}.group{display:flex;flex-direction:column;gap:2px;padding-block:4px;border-block:1px solid var(--sd-border, #dde0e5)}.group:first-child{padding-top:0;border-top:0}.group:last-child{padding-bottom:0;border-bottom:0}.group+.group{border-top:0}.group-label{display:flex;align-items:center;gap:8px;margin:0;padding:8px 8px 4px;color:var(--sd-text-secondary, #44474f);font-size:var(--sd-font-size-12, 12px);font-weight:var(--sd-font-weight-semibold, 600);line-height:var(--sd-line-height-16, 16px);overflow-wrap:anywhere}.group-title{min-width:0}.command{display:flex;align-items:center;gap:12px;box-sizing:border-box;width:100%;min-height:44px;padding:10px 8px;border:0;border-radius:var(--sd-radius-8, 8px);background:transparent;color:inherit;font:inherit;font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-line-height-20, 20px);text-align:start;overflow-wrap:anywhere;cursor:pointer;-webkit-tap-highlight-color:transparent}.command:hover:not(:disabled),.command:focus-visible{background:color-mix(in srgb,var(--sd-fe-command-accent, var(--sd-text, #1a1b1f)) 8%,transparent)}.command:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:-2px}.command:disabled{opacity:.45;cursor:default}.sheet--touch .command{min-height:48px}.command-label{flex:1;min-width:0}.command-icon{flex:none;color:var(--sd-fe-command-accent, inherit)}.spinner{flex:none;width:16px;height:16px;margin:2px;box-sizing:border-box;border:2px solid color-mix(in srgb,currentColor 25%,transparent);border-top-color:currentColor;border-radius:50%;animation:sd-file-explorer-command-spin .8s linear infinite}.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}::ng-deep .sd-side-drawer.sd-file-explorer-command-drawer .sd-side-drawer-header{background-color:var(--sd-side-drawer-surface, var(--sd-surface, #ffffff))}::ng-deep .sd-side-drawer.sd-file-explorer-command-drawer--touch .sd-side-drawer-close-btn{width:44px;height:44px}@keyframes sd-file-explorer-command-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.spinner{animation-duration:2.4s}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "component", type: SdSideDrawer, selector: "sd-side-drawer", inputs: ["title", "width", "hideClose", "disableBackdropClose", "beforeClose", "container", "drawerClass", "autoId"], outputs: ["sdClosed", "sdCloseError"] }, { kind: "component", type: SdFileExplorerFileIcon, selector: "sd-file-explorer-file-icon", inputs: ["icon", "size"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1106
|
+
}
|
|
1107
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdFileExplorerCommandSheet, decorators: [{
|
|
1108
|
+
type: Component,
|
|
1109
|
+
args: [{ selector: 'sd-file-explorer-command-sheet', standalone: true, imports: [NgTemplateOutlet, SdIcon, SdSideDrawer, SdFileExplorerFileIcon], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1110
|
+
class: 'sd-file-explorer-command-sheet',
|
|
1111
|
+
}, template: `
|
|
1112
|
+
@let _sheet = sheet();
|
|
1113
|
+
@let _autoId = autoId();
|
|
1114
|
+
<sd-side-drawer
|
|
1115
|
+
[width]="width"
|
|
1116
|
+
[title]="_sheet?.title ?? ''"
|
|
1117
|
+
[drawerClass]="drawerClass()"
|
|
1118
|
+
[autoId]="drawerAutoId()"
|
|
1119
|
+
(sdClosed)="onDrawerClosed()">
|
|
1120
|
+
@if (_sheet) {
|
|
1121
|
+
<div class="sheet" [class.sheet--touch]="touch()" [attr.data-autoid]="_autoId ?? null">
|
|
1122
|
+
<p class="context">
|
|
1123
|
+
<sd-file-explorer-file-icon [icon]="_sheet.icon" [size]="24" />
|
|
1124
|
+
<span class="context-text">{{ _sheet.context }}</span>
|
|
1125
|
+
</p>
|
|
1126
|
+
<div class="entries">
|
|
1127
|
+
@for (entry of _sheet.entries; track entry.key) {
|
|
1128
|
+
@if (entry.kind === 'group') {
|
|
1129
|
+
@let _labelId = sheetId + '-group-' + entry.key;
|
|
1130
|
+
<div
|
|
1131
|
+
class="group"
|
|
1132
|
+
role="group"
|
|
1133
|
+
[attr.aria-labelledby]="entry.loading ? _labelId + ' ' + _labelId + '-busy' : _labelId"
|
|
1134
|
+
[attr.aria-disabled]="entry.disabled ? true : null"
|
|
1135
|
+
[attr.aria-busy]="entry.loading ? true : null">
|
|
1136
|
+
<!-- why: the heading is not a control: text only, so it never repeats the icon of a child (a "Share"
|
|
1137
|
+
group over a "Share" item). The group's icon stays on its desktop trigger; a busy group still
|
|
1138
|
+
shows its spinner and says "in progress". -->
|
|
1139
|
+
<p class="group-label">
|
|
1140
|
+
@if (entry.loading) {
|
|
1141
|
+
<span class="spinner" aria-hidden="true"></span>
|
|
1142
|
+
}
|
|
1143
|
+
<span class="group-title" [id]="_labelId">{{ entry.label }}</span>
|
|
1144
|
+
@if (entry.loading) {
|
|
1145
|
+
<span class="visually-hidden" [id]="_labelId + '-busy'">{{ loadingLabel() }}</span>
|
|
1146
|
+
}
|
|
1147
|
+
</p>
|
|
1148
|
+
@for (child of entry.children; track child.key) {
|
|
1149
|
+
<ng-container
|
|
1150
|
+
[ngTemplateOutlet]="command"
|
|
1151
|
+
[ngTemplateOutletContext]="{
|
|
1152
|
+
$implicit: child,
|
|
1153
|
+
group: entry,
|
|
1154
|
+
autoId: _autoId ? _autoId + '-' + entry.key + '-' + child.key : null,
|
|
1155
|
+
}" />
|
|
1156
|
+
}
|
|
1157
|
+
</div>
|
|
1158
|
+
} @else {
|
|
1159
|
+
<ng-container
|
|
1160
|
+
[ngTemplateOutlet]="command"
|
|
1161
|
+
[ngTemplateOutletContext]="{ $implicit: entry, group: null, autoId: _autoId ? _autoId + '-' + entry.key : null }" />
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1164
|
+
</div>
|
|
1165
|
+
</div>
|
|
1166
|
+
}
|
|
1167
|
+
</sd-side-drawer>
|
|
1168
|
+
|
|
1169
|
+
<!-- One entry: neutral label, icons in the declared color (as Core menu items), spinner + hidden text while loading. -->
|
|
1170
|
+
<ng-template #command let-command let-group="group" let-entryAutoId="autoId">
|
|
1171
|
+
<button
|
|
1172
|
+
type="button"
|
|
1173
|
+
class="command"
|
|
1174
|
+
[disabled]="command.disabled"
|
|
1175
|
+
[style.--sd-fe-command-accent]="accent(command.color)"
|
|
1176
|
+
[attr.data-autoid]="entryAutoId"
|
|
1177
|
+
(click)="activate.emit({ command, group })">
|
|
1178
|
+
@if (command.loading) {
|
|
1179
|
+
<span class="spinner" aria-hidden="true"></span>
|
|
1180
|
+
} @else if (command.prefixIcon) {
|
|
1181
|
+
<sd-icon class="command-icon" size="20px" [name]="command.prefixIcon" [fontSet]="command.fontSet" />
|
|
1182
|
+
}
|
|
1183
|
+
<span class="command-label">{{ command.label }}</span>
|
|
1184
|
+
@if (command.suffixIcon && !command.loading) {
|
|
1185
|
+
<sd-icon class="command-icon" size="20px" [name]="command.suffixIcon" [fontSet]="command.fontSet" />
|
|
1186
|
+
}
|
|
1187
|
+
@if (command.loading) {
|
|
1188
|
+
<span class="visually-hidden">{{ loadingLabel() }}</span>
|
|
1189
|
+
}
|
|
1190
|
+
</button>
|
|
1191
|
+
</ng-template>
|
|
1192
|
+
`, styles: [".sheet{display:flex;flex-direction:column;gap:12px;padding-bottom:env(safe-area-inset-bottom,0px)}.context{display:flex;align-items:center;gap:8px;margin:0;color:var(--sd-text-secondary, #44474f);font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-18, 18px)}.context-text{min-width:0;overflow-wrap:anywhere}.entries{display:flex;flex-direction:column;gap:2px;margin:0 -8px}.group{display:flex;flex-direction:column;gap:2px;padding-block:4px;border-block:1px solid var(--sd-border, #dde0e5)}.group:first-child{padding-top:0;border-top:0}.group:last-child{padding-bottom:0;border-bottom:0}.group+.group{border-top:0}.group-label{display:flex;align-items:center;gap:8px;margin:0;padding:8px 8px 4px;color:var(--sd-text-secondary, #44474f);font-size:var(--sd-font-size-12, 12px);font-weight:var(--sd-font-weight-semibold, 600);line-height:var(--sd-line-height-16, 16px);overflow-wrap:anywhere}.group-title{min-width:0}.command{display:flex;align-items:center;gap:12px;box-sizing:border-box;width:100%;min-height:44px;padding:10px 8px;border:0;border-radius:var(--sd-radius-8, 8px);background:transparent;color:inherit;font:inherit;font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-line-height-20, 20px);text-align:start;overflow-wrap:anywhere;cursor:pointer;-webkit-tap-highlight-color:transparent}.command:hover:not(:disabled),.command:focus-visible{background:color-mix(in srgb,var(--sd-fe-command-accent, var(--sd-text, #1a1b1f)) 8%,transparent)}.command:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:-2px}.command:disabled{opacity:.45;cursor:default}.sheet--touch .command{min-height:48px}.command-label{flex:1;min-width:0}.command-icon{flex:none;color:var(--sd-fe-command-accent, inherit)}.spinner{flex:none;width:16px;height:16px;margin:2px;box-sizing:border-box;border:2px solid color-mix(in srgb,currentColor 25%,transparent);border-top-color:currentColor;border-radius:50%;animation:sd-file-explorer-command-spin .8s linear infinite}.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}::ng-deep .sd-side-drawer.sd-file-explorer-command-drawer .sd-side-drawer-header{background-color:var(--sd-side-drawer-surface, var(--sd-surface, #ffffff))}::ng-deep .sd-side-drawer.sd-file-explorer-command-drawer--touch .sd-side-drawer-close-btn{width:44px;height:44px}@keyframes sd-file-explorer-command-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.spinner{animation-duration:2.4s}}\n"] }]
|
|
1193
|
+
}], propDecorators: { sheet: [{ type: i0.Input, args: [{ isSignal: true, alias: "sheet", required: false }] }], touch: [{ type: i0.Input, args: [{ isSignal: true, alias: "touch", required: false }] }], autoId: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], activate: [{ type: i0.Output, args: ["activate"] }], close: [{ type: i0.Output, args: ["close"] }], drawer: [{ type: i0.ViewChild, args: [i0.forwardRef(() => SdSideDrawer), { isSignal: true }] }] } });
|
|
1194
|
+
|
|
1195
|
+
/**
|
|
1196
|
+
* Compact actions trigger of one row, card or tree node (internal): a `more_vert` icon button that asks the explorer to
|
|
1197
|
+
* open the item's command drawer, emitting itself so focus can come back to it when the drawer closes.
|
|
1198
|
+
*
|
|
1199
|
+
* While one of the item's commands is loading it shows a spinner instead of the icon and stays clickable, so the drawer
|
|
1200
|
+
* can still show which command is busy and run the others.
|
|
1201
|
+
*/
|
|
1202
|
+
class SdFileExplorerMenuTrigger {
|
|
1203
|
+
#i18n = inject(I18nService);
|
|
1204
|
+
/** Accessible name and tooltip: "Actions for {name}" ("… (In progress)" while busy). */
|
|
1205
|
+
label = input.required(/* @ts-ignore */
|
|
1206
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
1207
|
+
/** One of the item's commands is loading. */
|
|
1208
|
+
busy = input(false, /* @ts-ignore */
|
|
1209
|
+
...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
|
|
1210
|
+
/** The item's command drawer is open. */
|
|
1211
|
+
expanded = input(false, /* @ts-ignore */
|
|
1212
|
+
...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
|
|
1213
|
+
/** Touch screen: 48 px target, no tooltip. */
|
|
1214
|
+
touch = input(false, /* @ts-ignore */
|
|
1215
|
+
...(ngDevMode ? [{ debugName: "touch" }] : /* istanbul ignore next */ []));
|
|
1216
|
+
/** `null` keeps the button in the tab order; the tree passes `-1` for every node but its tab stop. */
|
|
1217
|
+
tabIndex = input(null, /* @ts-ignore */
|
|
1218
|
+
...(ngDevMode ? [{ debugName: "tabIndex" }] : /* istanbul ignore next */ []));
|
|
1219
|
+
autoId = input(undefined, /* @ts-ignore */
|
|
1220
|
+
...(ngDevMode ? [{ debugName: "autoId" }] : /* istanbul ignore next */ []));
|
|
1221
|
+
/** Pressed: emits the native button, the element focus returns to. */
|
|
1222
|
+
activate = output();
|
|
1223
|
+
accessibleName = computed(() => this.busy() ? `${this.label()} (${this.#i18n.t('core.component.file-explorer.action-loading')})` : this.label(), /* @ts-ignore */
|
|
1224
|
+
...(ngDevMode ? [{ debugName: "accessibleName" }] : /* istanbul ignore next */ []));
|
|
1225
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdFileExplorerMenuTrigger, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1226
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdFileExplorerMenuTrigger, isStandalone: true, selector: "sd-file-explorer-menu-trigger", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: true, transformFunction: null }, busy: { classPropertyName: "busy", publicName: "busy", isSignal: true, isRequired: false, transformFunction: null }, expanded: { classPropertyName: "expanded", publicName: "expanded", isSignal: true, isRequired: false, transformFunction: null }, touch: { classPropertyName: "touch", publicName: "touch", isSignal: true, isRequired: false, transformFunction: null }, tabIndex: { classPropertyName: "tabIndex", publicName: "tabIndex", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { activate: "activate" }, host: { properties: { "class.sd-file-explorer-menu-trigger--touch": "touch()" }, classAttribute: "sd-file-explorer-menu-trigger" }, ngImport: i0, template: `
|
|
1227
|
+
<!-- why: no tooltip on touch screens — MatTooltip would take over touch gestures (touch-action: none) and block
|
|
1228
|
+
scrolling the list from the button; the accessible name is there either way. The tooltip repeats the name, so
|
|
1229
|
+
Material does not add it as a description read twice. -->
|
|
1230
|
+
<button
|
|
1231
|
+
#button
|
|
1232
|
+
type="button"
|
|
1233
|
+
class="trigger"
|
|
1234
|
+
aria-haspopup="dialog"
|
|
1235
|
+
[attr.aria-expanded]="expanded()"
|
|
1236
|
+
[attr.aria-label]="accessibleName()"
|
|
1237
|
+
[attr.tabindex]="tabIndex()"
|
|
1238
|
+
[attr.data-autoid]="autoId() ?? null"
|
|
1239
|
+
[matTooltip]="accessibleName()"
|
|
1240
|
+
[matTooltipDisabled]="touch()"
|
|
1241
|
+
(click)="activate.emit(button)">
|
|
1242
|
+
@if (busy()) {
|
|
1243
|
+
<span class="spinner" aria-hidden="true"></span>
|
|
1244
|
+
} @else {
|
|
1245
|
+
<sd-icon name="more_vert" size="20px" />
|
|
1246
|
+
}
|
|
1247
|
+
</button>
|
|
1248
|
+
`, isInline: true, styles: [":host{display:inline-flex;flex:none}.trigger{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border:0;border-radius:var(--sd-radius-999, 999px);background:transparent;color:var(--sd-fe-text-secondary, var(--sd-text-secondary, #44474f));cursor:pointer;-webkit-tap-highlight-color:transparent}.trigger:hover,.trigger[aria-expanded=true]{background:var(--sd-fe-hover-strong, rgba(26, 27, 31, .08));color:var(--sd-fe-text, var(--sd-text, #1a1b1f))}.trigger:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-file-explorer-accent, var(--sd-focus-ring-color, var(--sd-primary)));outline-offset:1px}:host(.sd-file-explorer-menu-trigger--touch) .trigger{width:var(--sd-space-48, 48px);height:var(--sd-space-48, 48px)}.spinner{width:16px;height:16px;box-sizing:border-box;border:2px solid color-mix(in srgb,currentColor 25%,transparent);border-top-color:currentColor;border-radius:50%;animation:sd-file-explorer-menu-trigger-spin .8s linear infinite}@keyframes sd-file-explorer-menu-trigger-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.spinner{animation-duration:2.4s}}\n"], dependencies: [{ kind: "directive", type: MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1249
|
+
}
|
|
1250
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdFileExplorerMenuTrigger, decorators: [{
|
|
1251
|
+
type: Component,
|
|
1252
|
+
args: [{ selector: 'sd-file-explorer-menu-trigger', standalone: true, imports: [MatTooltip, SdIcon], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1253
|
+
class: 'sd-file-explorer-menu-trigger',
|
|
1254
|
+
'[class.sd-file-explorer-menu-trigger--touch]': 'touch()',
|
|
1255
|
+
}, template: `
|
|
1256
|
+
<!-- why: no tooltip on touch screens — MatTooltip would take over touch gestures (touch-action: none) and block
|
|
1257
|
+
scrolling the list from the button; the accessible name is there either way. The tooltip repeats the name, so
|
|
1258
|
+
Material does not add it as a description read twice. -->
|
|
1259
|
+
<button
|
|
1260
|
+
#button
|
|
1261
|
+
type="button"
|
|
1262
|
+
class="trigger"
|
|
1263
|
+
aria-haspopup="dialog"
|
|
1264
|
+
[attr.aria-expanded]="expanded()"
|
|
1265
|
+
[attr.aria-label]="accessibleName()"
|
|
1266
|
+
[attr.tabindex]="tabIndex()"
|
|
1267
|
+
[attr.data-autoid]="autoId() ?? null"
|
|
1268
|
+
[matTooltip]="accessibleName()"
|
|
1269
|
+
[matTooltipDisabled]="touch()"
|
|
1270
|
+
(click)="activate.emit(button)">
|
|
1271
|
+
@if (busy()) {
|
|
1272
|
+
<span class="spinner" aria-hidden="true"></span>
|
|
1273
|
+
} @else {
|
|
1274
|
+
<sd-icon name="more_vert" size="20px" />
|
|
1275
|
+
}
|
|
1276
|
+
</button>
|
|
1277
|
+
`, styles: [":host{display:inline-flex;flex:none}.trigger{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border:0;border-radius:var(--sd-radius-999, 999px);background:transparent;color:var(--sd-fe-text-secondary, var(--sd-text-secondary, #44474f));cursor:pointer;-webkit-tap-highlight-color:transparent}.trigger:hover,.trigger[aria-expanded=true]{background:var(--sd-fe-hover-strong, rgba(26, 27, 31, .08));color:var(--sd-fe-text, var(--sd-text, #1a1b1f))}.trigger:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-file-explorer-accent, var(--sd-focus-ring-color, var(--sd-primary)));outline-offset:1px}:host(.sd-file-explorer-menu-trigger--touch) .trigger{width:var(--sd-space-48, 48px);height:var(--sd-space-48, 48px)}.spinner{width:16px;height:16px;box-sizing:border-box;border:2px solid color-mix(in srgb,currentColor 25%,transparent);border-top-color:currentColor;border-radius:50%;animation:sd-file-explorer-menu-trigger-spin .8s linear infinite}@keyframes sd-file-explorer-menu-trigger-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.spinner{animation-duration:2.4s}}\n"] }]
|
|
1278
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: true }] }], busy: [{ type: i0.Input, args: [{ isSignal: true, alias: "busy", required: false }] }], expanded: [{ type: i0.Input, args: [{ isSignal: true, alias: "expanded", required: false }] }], touch: [{ type: i0.Input, args: [{ isSignal: true, alias: "touch", required: false }] }], tabIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabIndex", required: false }] }], autoId: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], activate: [{ type: i0.Output, args: ["activate"] }] } });
|
|
1279
|
+
|
|
1280
|
+
let nextTreeId = 0;
|
|
1281
|
+
/** Events from a folder command (or the space between them), or from the compact actions trigger, belong to it. */
|
|
1282
|
+
const COMMAND_AREAS = '.node-actions, .sd-file-explorer-menu-trigger';
|
|
449
1283
|
/**
|
|
450
1284
|
* Folder tree of the explorer (internal). Rendered as a flat `role="tree"` list whose depth is carried by
|
|
451
1285
|
* `aria-level`, with a roving tabindex and the WAI-ARIA tree keyboard model.
|
|
1286
|
+
*
|
|
1287
|
+
* Folder commands sit at the end of each folder node. On desktop they are rendered for the hovered or focused node
|
|
1288
|
+
* only — taking no room while hidden, so names keep the full width — and `Tab` from the focused node reaches them
|
|
1289
|
+
* while the tree keeps a single tab stop. A node with commands is named by its label alone and wraps its commands
|
|
1290
|
+
* onto a second line when they do not fit next to the name.
|
|
1291
|
+
*
|
|
1292
|
+
* In the compact layout a folder node carries one actions trigger instead, which asks the explorer for its command
|
|
1293
|
+
* drawer; only the trigger of the tab-stop node is in the tab order.
|
|
452
1294
|
*/
|
|
453
1295
|
class SdFileExplorerFolderTree {
|
|
1296
|
+
moveDropTarget = input(/* @ts-ignore */
|
|
1297
|
+
...(ngDevMode ? [undefined, { debugName: "moveDropTarget" }] : /* istanbul ignore next */ []));
|
|
454
1298
|
#host = inject(ElementRef);
|
|
455
1299
|
#i18n = inject(I18nService);
|
|
1300
|
+
/** Prefix of the label ids that name nodes with commands. */
|
|
1301
|
+
treeId = `sd-file-explorer-tree-${nextTreeId++}`;
|
|
456
1302
|
/** Visible nodes in display order. */
|
|
457
1303
|
nodes = input.required(/* @ts-ignore */
|
|
458
1304
|
...(ngDevMode ? [{ debugName: "nodes" }] : /* istanbul ignore next */ []));
|
|
459
1305
|
/** Accessible name of the tree. */
|
|
460
1306
|
label = input('', /* @ts-ignore */
|
|
461
1307
|
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
1308
|
+
/** Commands of every folder node; the root has none. */
|
|
1309
|
+
commands = input(undefined, /* @ts-ignore */
|
|
1310
|
+
...(ngDevMode ? [{ debugName: "commands" }] : /* istanbul ignore next */ []));
|
|
1311
|
+
/** Touch screen: commands always visible, with 48 px buttons (44 px compact trigger). */
|
|
1312
|
+
touch = input(false, /* @ts-ignore */
|
|
1313
|
+
...(ngDevMode ? [{ debugName: "touch" }] : /* istanbul ignore next */ []));
|
|
1314
|
+
/** Compact layout: an actions trigger per folder node instead of its commands. */
|
|
1315
|
+
compact = input(false, /* @ts-ignore */
|
|
1316
|
+
...(ngDevMode ? [{ debugName: "compact" }] : /* istanbul ignore next */ []));
|
|
1317
|
+
/** Id of the folder whose command drawer is open from the tree. */
|
|
1318
|
+
menuOpenId = input(null, /* @ts-ignore */
|
|
1319
|
+
...(ngDevMode ? [{ debugName: "menuOpenId" }] : /* istanbul ignore next */ []));
|
|
462
1320
|
/** A node was activated (click, Enter, Space). */
|
|
463
1321
|
select = output();
|
|
464
1322
|
/** Expand / collapse requested. */
|
|
465
1323
|
toggle = output();
|
|
466
1324
|
/** Retry loading the children of a node whose listing failed. */
|
|
467
1325
|
retry = output();
|
|
1326
|
+
/** Compact actions trigger of a folder pressed. */
|
|
1327
|
+
openCommands = output();
|
|
468
1328
|
focusedKey = signal(null, /* @ts-ignore */
|
|
469
1329
|
...(ngDevMode ? [{ debugName: "focusedKey" }] : /* istanbul ignore next */ []));
|
|
470
1330
|
retryLabel = computed(() => this.#i18n.t('core.component.file-explorer.retry'), /* @ts-ignore */
|
|
471
1331
|
...(ngDevMode ? [{ debugName: "retryLabel" }] : /* istanbul ignore next */ []));
|
|
1332
|
+
/**
|
|
1333
|
+
* Compact: trigger state per folder node key, for folders whose drawer would list something; `null` on desktop,
|
|
1334
|
+
* where the nodes render their commands.
|
|
1335
|
+
*/
|
|
1336
|
+
menus = computed(() => {
|
|
1337
|
+
if (!this.compact())
|
|
1338
|
+
return null;
|
|
1339
|
+
const commands = this.commands();
|
|
1340
|
+
const menus = new Map();
|
|
1341
|
+
for (const node of this.nodes()) {
|
|
1342
|
+
if (!node.item)
|
|
1343
|
+
continue;
|
|
1344
|
+
const resolved = sdFileExplorerResolveActions(commands, node.item, SD_FILE_EXPLORER_COMMAND_DEFAULTS, 'folderCommands');
|
|
1345
|
+
if (resolved.length)
|
|
1346
|
+
menus.set(node.key, { busy: sdFileExplorerActionsBusy(resolved) });
|
|
1347
|
+
}
|
|
1348
|
+
return menus;
|
|
1349
|
+
}, /* @ts-ignore */
|
|
1350
|
+
...(ngDevMode ? [{ debugName: "menus" }] : /* istanbul ignore next */ []));
|
|
472
1351
|
/** Node owning the roving tabindex: the focused node if still visible, else the selected one. */
|
|
473
1352
|
activeKey = computed(() => {
|
|
474
1353
|
const nodes = this.nodes();
|
|
@@ -482,6 +1361,9 @@ class SdFileExplorerFolderTree {
|
|
|
482
1361
|
const key = node.expanded ? 'core.component.file-explorer.collapse' : 'core.component.file-explorer.expand';
|
|
483
1362
|
return this.#i18n.t(key, { name: node.name });
|
|
484
1363
|
}
|
|
1364
|
+
menuLabel(node) {
|
|
1365
|
+
return this.#i18n.t('core.component.file-explorer.item-actions', { name: node.name });
|
|
1366
|
+
}
|
|
485
1367
|
onToggle(event, node) {
|
|
486
1368
|
// why: nút toggle nằm trong treeitem — chặn bubble để bấm mũi tên không đồng thời điều hướng vào thư mục.
|
|
487
1369
|
event.stopPropagation();
|
|
@@ -491,7 +1373,15 @@ class SdFileExplorerFolderTree {
|
|
|
491
1373
|
event.stopPropagation();
|
|
492
1374
|
this.retry.emit(node);
|
|
493
1375
|
}
|
|
1376
|
+
onClick(event, node) {
|
|
1377
|
+
if (this.#fromCommands(event))
|
|
1378
|
+
return;
|
|
1379
|
+
this.select.emit(node);
|
|
1380
|
+
}
|
|
494
1381
|
onKeydown(event, index) {
|
|
1382
|
+
// why: phím bấm trên nút lệnh thuộc về nút đó — Enter/Space không được mở thư mục, mũi tên không được dời focus khỏi nút.
|
|
1383
|
+
if (this.#fromCommands(event))
|
|
1384
|
+
return;
|
|
495
1385
|
const nodes = this.nodes();
|
|
496
1386
|
const node = nodes[index];
|
|
497
1387
|
if (!node)
|
|
@@ -545,16 +1435,35 @@ class SdFileExplorerFolderTree {
|
|
|
545
1435
|
const element = this.#host.nativeElement.querySelectorAll('[role="treeitem"]')[index];
|
|
546
1436
|
element?.focus();
|
|
547
1437
|
}
|
|
1438
|
+
/** The event started on a folder command (or the space between them) or on the actions trigger of the node. */
|
|
1439
|
+
#fromCommands(event) {
|
|
1440
|
+
const target = event.target instanceof Element ? event.target : null;
|
|
1441
|
+
const area = target?.closest(COMMAND_AREAS);
|
|
1442
|
+
return !!area && event.currentTarget instanceof Element && event.currentTarget.contains(area);
|
|
1443
|
+
}
|
|
548
1444
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdFileExplorerFolderTree, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
549
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdFileExplorerFolderTree, isStandalone: true, selector: "sd-file-explorer-folder-tree", inputs: { nodes: { classPropertyName: "nodes", publicName: "nodes", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { select: "select", toggle: "toggle", retry: "retry" }, host: { classAttribute: "sd-file-explorer-folder-tree" }, ngImport: i0, template: `
|
|
1445
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdFileExplorerFolderTree, isStandalone: true, selector: "sd-file-explorer-folder-tree", inputs: { moveDropTarget: { classPropertyName: "moveDropTarget", publicName: "moveDropTarget", isSignal: true, isRequired: false, transformFunction: null }, nodes: { classPropertyName: "nodes", publicName: "nodes", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, commands: { classPropertyName: "commands", publicName: "commands", isSignal: true, isRequired: false, transformFunction: null }, touch: { classPropertyName: "touch", publicName: "touch", isSignal: true, isRequired: false, transformFunction: null }, compact: { classPropertyName: "compact", publicName: "compact", isSignal: true, isRequired: false, transformFunction: null }, menuOpenId: { classPropertyName: "menuOpenId", publicName: "menuOpenId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { select: "select", toggle: "toggle", retry: "retry", openCommands: "openCommands" }, host: { properties: { "class.sd-file-explorer-folder-tree--touch": "touch()", "class.sd-file-explorer-folder-tree--compact": "compact()" }, classAttribute: "sd-file-explorer-folder-tree" }, ngImport: i0, template: `
|
|
550
1446
|
@let _nodes = nodes();
|
|
551
1447
|
@let _active = activeKey();
|
|
1448
|
+
@let _commands = commands();
|
|
1449
|
+
@let _hasCommands = !!_commands?.length;
|
|
1450
|
+
@let _touch = touch();
|
|
1451
|
+
@let _commandSize = _touch ? 'lg' : 'sm';
|
|
1452
|
+
@let _menus = menus();
|
|
1453
|
+
@let _menuOpenId = menuOpenId();
|
|
552
1454
|
<ul class="tree" role="tree" [attr.aria-label]="label()">
|
|
553
1455
|
@for (node of _nodes; track node.key; let i = $index) {
|
|
1456
|
+
@let _nodeCommands = _hasCommands && !!node.item;
|
|
1457
|
+
@let _labelId = treeId + '-label-' + i;
|
|
554
1458
|
<li
|
|
555
1459
|
class="node"
|
|
556
1460
|
role="treeitem"
|
|
1461
|
+
[attr.data-move-target]="node.id ?? ''"
|
|
1462
|
+
[class.move-drop-target]="moveDropTarget() === node.id"
|
|
557
1463
|
[class.node--selected]="node.selected"
|
|
1464
|
+
[class.node--commands]="_nodeCommands"
|
|
1465
|
+
[class.node--error]="node.status === 'error'"
|
|
1466
|
+
[attr.aria-labelledby]="_nodeCommands ? _labelId : null"
|
|
558
1467
|
[attr.aria-level]="node.level"
|
|
559
1468
|
[attr.aria-selected]="node.selected"
|
|
560
1469
|
[attr.aria-expanded]="node.expandable ? node.expanded : null"
|
|
@@ -562,7 +1471,7 @@ class SdFileExplorerFolderTree {
|
|
|
562
1471
|
[attr.tabindex]="node.key === _active ? 0 : -1"
|
|
563
1472
|
[attr.data-autoid]="node.autoId"
|
|
564
1473
|
[style.--sd-file-explorer-tree-indent]="(node.level > 1 ? node.level - 2 : 0) * 22 + 'px'"
|
|
565
|
-
(click)="
|
|
1474
|
+
(click)="onClick($event, node)"
|
|
566
1475
|
(keydown)="onKeydown($event, i)"
|
|
567
1476
|
(focus)="focusedKey.set(node.key)">
|
|
568
1477
|
@if (node.level > 1) {
|
|
@@ -582,7 +1491,7 @@ class SdFileExplorerFolderTree {
|
|
|
582
1491
|
}
|
|
583
1492
|
}
|
|
584
1493
|
<sd-file-explorer-file-icon [icon]="node.expanded ? 'folder-open' : 'folder-closed'" [size]="28" />
|
|
585
|
-
<span class="label" [title]="node.name">{{ node.name }}</span>
|
|
1494
|
+
<span class="label" [id]="_labelId" [title]="node.name">{{ node.name }}</span>
|
|
586
1495
|
@if (node.status === 'loading') {
|
|
587
1496
|
<span class="spinner" aria-hidden="true"></span>
|
|
588
1497
|
} @else if (node.status === 'error') {
|
|
@@ -596,22 +1505,64 @@ class SdFileExplorerFolderTree {
|
|
|
596
1505
|
<sd-icon name="refresh" size="16px" />
|
|
597
1506
|
</button>
|
|
598
1507
|
}
|
|
1508
|
+
@if (_nodeCommands) {
|
|
1509
|
+
@if (node.item; as folder) {
|
|
1510
|
+
@if (!_menus) {
|
|
1511
|
+
<sd-file-explorer-actions
|
|
1512
|
+
class="node-actions"
|
|
1513
|
+
source="folderCommands"
|
|
1514
|
+
[actions]="_commands"
|
|
1515
|
+
[context]="folder"
|
|
1516
|
+
[size]="_commandSize"
|
|
1517
|
+
[autoId]="node.autoId ? node.autoId + '-command' : undefined" />
|
|
1518
|
+
} @else {
|
|
1519
|
+
@if (_menus.get(node.key); as menu) {
|
|
1520
|
+
<sd-file-explorer-menu-trigger
|
|
1521
|
+
class="node-menu"
|
|
1522
|
+
[label]="menuLabel(node)"
|
|
1523
|
+
[busy]="menu.busy"
|
|
1524
|
+
[expanded]="folder.id === _menuOpenId"
|
|
1525
|
+
[touch]="_touch"
|
|
1526
|
+
[tabIndex]="node.key === _active ? 0 : -1"
|
|
1527
|
+
[autoId]="node.autoId ? node.autoId + '-commands' : undefined"
|
|
1528
|
+
(activate)="openCommands.emit({ item: folder, trigger: $event })" />
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
}
|
|
599
1533
|
</li>
|
|
600
1534
|
}
|
|
601
1535
|
</ul>
|
|
602
|
-
`, isInline: true, styles: ["
|
|
1536
|
+
`, isInline: true, styles: ["@charset \"UTF-8\";:host{display:block}.tree{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px}.node{display:flex;align-items:center;gap:8px;min-height:40px;padding:0 10px;border-radius:var(--sd-radius-8, 8px);color:var(--sd-fe-text);font-size:var(--sd-font-size-15, 15px);line-height:var(--sd-line-height-20, 20px);cursor:pointer;-webkit-user-select:none;user-select:none;outline:none}.node:hover{background:var(--sd-fe-hover)}.node:focus-visible{box-shadow:inset 0 0 0 2px var(--sd-fe-accent)}.node--selected{background:var(--sd-fe-accent-soft);color:var(--sd-fe-accent);font-weight:var(--sd-font-weight-semibold, 600)}.node--selected:hover{background:var(--sd-fe-accent-soft)}.indent{flex:none;width:var(--sd-file-explorer-tree-indent, 0);margin-right:-8px}.toggle{flex:none;display:inline-flex;align-items:center;justify-content:center;width:16px;height:24px;margin-right:-1px;padding:0;border:0;border-radius:var(--sd-radius-4, 4px);background:transparent;color:var(--sd-fe-text-secondary);cursor:pointer}.toggle:hover{color:var(--sd-fe-text)}.label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host(.sd-file-explorer-folder-tree--touch) .node{min-height:var(--sd-space-48, 48px)}:host(.sd-file-explorer-folder-tree--touch) .node--error{flex-wrap:wrap}:host(.sd-file-explorer-folder-tree--touch) .node--error .label{flex:1 1 8ch;min-inline-size:min(100%,8ch);white-space:normal;overflow-wrap:anywhere}:host(.sd-file-explorer-folder-tree--touch) .node--error .retry{margin-inline-start:auto}:host(.sd-file-explorer-folder-tree--touch) .toggle,:host(.sd-file-explorer-folder-tree--touch) .retry{width:var(--sd-space-48, 48px);height:var(--sd-space-48, 48px)}.retry{flex:none;display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:0;border-radius:var(--sd-radius-6, 6px);background:transparent;color:var(--sd-fe-error);cursor:pointer}.retry:hover{background:color-mix(in srgb,var(--sd-fe-error) 10%,transparent)}.node-actions{display:none;flex:0 1 auto;min-width:0;margin-inline:auto -6px}.node:hover .node-actions,.node:focus-within .node-actions,.node-actions.sd-file-explorer-actions--open,.node-actions.sd-file-explorer-actions--busy,:host(.sd-file-explorer-folder-tree--touch) .node-actions{display:inline-flex}.node--commands{flex-wrap:wrap;row-gap:2px;padding-block:2px}:host(.sd-file-explorer-folder-tree--touch) .node--commands .label{flex:1 1 auto}.node-menu{flex:none;margin-inline:auto -6px}:host(.sd-file-explorer-folder-tree--compact) .node--commands:not(.node--error){flex-wrap:nowrap}:host(.sd-file-explorer-folder-tree--compact) .node--commands:not(.node--error) .label{flex:1 1 0}.spinner{flex:none;width:14px;height:14px;border:2px solid color-mix(in srgb,var(--sd-fe-accent) 25%,transparent);border-top-color:var(--sd-fe-accent);border-radius:50%;animation:sd-file-explorer-tree-spin .8s linear infinite}@keyframes sd-file-explorer-tree-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.spinner{animation-duration:2.4s}}.move-drop-target:after{content:\"\\21b3\";font-weight:700;color:var(--sd-fe-text)}.move-drop-target{outline:2px solid var(--sd-fe-accent);outline-offset:-2px}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "component", type: SdFileExplorerActions, selector: "sd-file-explorer-actions", inputs: ["actions", "context", "defaultLeafType", "defaultGroupType", "defaultColor", "size", "source", "autoId"] }, { kind: "component", type: SdFileExplorerFileIcon, selector: "sd-file-explorer-file-icon", inputs: ["icon", "size"] }, { kind: "component", type: SdFileExplorerMenuTrigger, selector: "sd-file-explorer-menu-trigger", inputs: ["label", "busy", "expanded", "touch", "tabIndex", "autoId"], outputs: ["activate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
603
1537
|
}
|
|
604
1538
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdFileExplorerFolderTree, decorators: [{
|
|
605
1539
|
type: Component,
|
|
606
|
-
args: [{ selector: 'sd-file-explorer-folder-tree', standalone: true, imports: [SdIcon, SdFileExplorerFileIcon], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1540
|
+
args: [{ selector: 'sd-file-explorer-folder-tree', standalone: true, imports: [SdIcon, SdFileExplorerActions, SdFileExplorerFileIcon, SdFileExplorerMenuTrigger], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1541
|
+
class: 'sd-file-explorer-folder-tree',
|
|
1542
|
+
'[class.sd-file-explorer-folder-tree--touch]': 'touch()',
|
|
1543
|
+
'[class.sd-file-explorer-folder-tree--compact]': 'compact()',
|
|
1544
|
+
}, template: `
|
|
607
1545
|
@let _nodes = nodes();
|
|
608
1546
|
@let _active = activeKey();
|
|
1547
|
+
@let _commands = commands();
|
|
1548
|
+
@let _hasCommands = !!_commands?.length;
|
|
1549
|
+
@let _touch = touch();
|
|
1550
|
+
@let _commandSize = _touch ? 'lg' : 'sm';
|
|
1551
|
+
@let _menus = menus();
|
|
1552
|
+
@let _menuOpenId = menuOpenId();
|
|
609
1553
|
<ul class="tree" role="tree" [attr.aria-label]="label()">
|
|
610
1554
|
@for (node of _nodes; track node.key; let i = $index) {
|
|
1555
|
+
@let _nodeCommands = _hasCommands && !!node.item;
|
|
1556
|
+
@let _labelId = treeId + '-label-' + i;
|
|
611
1557
|
<li
|
|
612
1558
|
class="node"
|
|
613
1559
|
role="treeitem"
|
|
1560
|
+
[attr.data-move-target]="node.id ?? ''"
|
|
1561
|
+
[class.move-drop-target]="moveDropTarget() === node.id"
|
|
614
1562
|
[class.node--selected]="node.selected"
|
|
1563
|
+
[class.node--commands]="_nodeCommands"
|
|
1564
|
+
[class.node--error]="node.status === 'error'"
|
|
1565
|
+
[attr.aria-labelledby]="_nodeCommands ? _labelId : null"
|
|
615
1566
|
[attr.aria-level]="node.level"
|
|
616
1567
|
[attr.aria-selected]="node.selected"
|
|
617
1568
|
[attr.aria-expanded]="node.expandable ? node.expanded : null"
|
|
@@ -619,7 +1570,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
619
1570
|
[attr.tabindex]="node.key === _active ? 0 : -1"
|
|
620
1571
|
[attr.data-autoid]="node.autoId"
|
|
621
1572
|
[style.--sd-file-explorer-tree-indent]="(node.level > 1 ? node.level - 2 : 0) * 22 + 'px'"
|
|
622
|
-
(click)="
|
|
1573
|
+
(click)="onClick($event, node)"
|
|
623
1574
|
(keydown)="onKeydown($event, i)"
|
|
624
1575
|
(focus)="focusedKey.set(node.key)">
|
|
625
1576
|
@if (node.level > 1) {
|
|
@@ -639,7 +1590,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
639
1590
|
}
|
|
640
1591
|
}
|
|
641
1592
|
<sd-file-explorer-file-icon [icon]="node.expanded ? 'folder-open' : 'folder-closed'" [size]="28" />
|
|
642
|
-
<span class="label" [title]="node.name">{{ node.name }}</span>
|
|
1593
|
+
<span class="label" [id]="_labelId" [title]="node.name">{{ node.name }}</span>
|
|
643
1594
|
@if (node.status === 'loading') {
|
|
644
1595
|
<span class="spinner" aria-hidden="true"></span>
|
|
645
1596
|
} @else if (node.status === 'error') {
|
|
@@ -653,17 +1604,61 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
653
1604
|
<sd-icon name="refresh" size="16px" />
|
|
654
1605
|
</button>
|
|
655
1606
|
}
|
|
1607
|
+
@if (_nodeCommands) {
|
|
1608
|
+
@if (node.item; as folder) {
|
|
1609
|
+
@if (!_menus) {
|
|
1610
|
+
<sd-file-explorer-actions
|
|
1611
|
+
class="node-actions"
|
|
1612
|
+
source="folderCommands"
|
|
1613
|
+
[actions]="_commands"
|
|
1614
|
+
[context]="folder"
|
|
1615
|
+
[size]="_commandSize"
|
|
1616
|
+
[autoId]="node.autoId ? node.autoId + '-command' : undefined" />
|
|
1617
|
+
} @else {
|
|
1618
|
+
@if (_menus.get(node.key); as menu) {
|
|
1619
|
+
<sd-file-explorer-menu-trigger
|
|
1620
|
+
class="node-menu"
|
|
1621
|
+
[label]="menuLabel(node)"
|
|
1622
|
+
[busy]="menu.busy"
|
|
1623
|
+
[expanded]="folder.id === _menuOpenId"
|
|
1624
|
+
[touch]="_touch"
|
|
1625
|
+
[tabIndex]="node.key === _active ? 0 : -1"
|
|
1626
|
+
[autoId]="node.autoId ? node.autoId + '-commands' : undefined"
|
|
1627
|
+
(activate)="openCommands.emit({ item: folder, trigger: $event })" />
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
656
1632
|
</li>
|
|
657
1633
|
}
|
|
658
1634
|
</ul>
|
|
659
|
-
`, styles: ["
|
|
660
|
-
}], propDecorators: { nodes: [{ type: i0.Input, args: [{ isSignal: true, alias: "nodes", required: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], select: [{ type: i0.Output, args: ["select"] }], toggle: [{ type: i0.Output, args: ["toggle"] }], retry: [{ type: i0.Output, args: ["retry"] }] } });
|
|
1635
|
+
`, styles: ["@charset \"UTF-8\";:host{display:block}.tree{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px}.node{display:flex;align-items:center;gap:8px;min-height:40px;padding:0 10px;border-radius:var(--sd-radius-8, 8px);color:var(--sd-fe-text);font-size:var(--sd-font-size-15, 15px);line-height:var(--sd-line-height-20, 20px);cursor:pointer;-webkit-user-select:none;user-select:none;outline:none}.node:hover{background:var(--sd-fe-hover)}.node:focus-visible{box-shadow:inset 0 0 0 2px var(--sd-fe-accent)}.node--selected{background:var(--sd-fe-accent-soft);color:var(--sd-fe-accent);font-weight:var(--sd-font-weight-semibold, 600)}.node--selected:hover{background:var(--sd-fe-accent-soft)}.indent{flex:none;width:var(--sd-file-explorer-tree-indent, 0);margin-right:-8px}.toggle{flex:none;display:inline-flex;align-items:center;justify-content:center;width:16px;height:24px;margin-right:-1px;padding:0;border:0;border-radius:var(--sd-radius-4, 4px);background:transparent;color:var(--sd-fe-text-secondary);cursor:pointer}.toggle:hover{color:var(--sd-fe-text)}.label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host(.sd-file-explorer-folder-tree--touch) .node{min-height:var(--sd-space-48, 48px)}:host(.sd-file-explorer-folder-tree--touch) .node--error{flex-wrap:wrap}:host(.sd-file-explorer-folder-tree--touch) .node--error .label{flex:1 1 8ch;min-inline-size:min(100%,8ch);white-space:normal;overflow-wrap:anywhere}:host(.sd-file-explorer-folder-tree--touch) .node--error .retry{margin-inline-start:auto}:host(.sd-file-explorer-folder-tree--touch) .toggle,:host(.sd-file-explorer-folder-tree--touch) .retry{width:var(--sd-space-48, 48px);height:var(--sd-space-48, 48px)}.retry{flex:none;display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:0;border-radius:var(--sd-radius-6, 6px);background:transparent;color:var(--sd-fe-error);cursor:pointer}.retry:hover{background:color-mix(in srgb,var(--sd-fe-error) 10%,transparent)}.node-actions{display:none;flex:0 1 auto;min-width:0;margin-inline:auto -6px}.node:hover .node-actions,.node:focus-within .node-actions,.node-actions.sd-file-explorer-actions--open,.node-actions.sd-file-explorer-actions--busy,:host(.sd-file-explorer-folder-tree--touch) .node-actions{display:inline-flex}.node--commands{flex-wrap:wrap;row-gap:2px;padding-block:2px}:host(.sd-file-explorer-folder-tree--touch) .node--commands .label{flex:1 1 auto}.node-menu{flex:none;margin-inline:auto -6px}:host(.sd-file-explorer-folder-tree--compact) .node--commands:not(.node--error){flex-wrap:nowrap}:host(.sd-file-explorer-folder-tree--compact) .node--commands:not(.node--error) .label{flex:1 1 0}.spinner{flex:none;width:14px;height:14px;border:2px solid color-mix(in srgb,var(--sd-fe-accent) 25%,transparent);border-top-color:var(--sd-fe-accent);border-radius:50%;animation:sd-file-explorer-tree-spin .8s linear infinite}@keyframes sd-file-explorer-tree-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.spinner{animation-duration:2.4s}}.move-drop-target:after{content:\"\\21b3\";font-weight:700;color:var(--sd-fe-text)}.move-drop-target{outline:2px solid var(--sd-fe-accent);outline-offset:-2px}\n"] }]
|
|
1636
|
+
}], propDecorators: { moveDropTarget: [{ type: i0.Input, args: [{ isSignal: true, alias: "moveDropTarget", required: false }] }], nodes: [{ type: i0.Input, args: [{ isSignal: true, alias: "nodes", required: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], commands: [{ type: i0.Input, args: [{ isSignal: true, alias: "commands", required: false }] }], touch: [{ type: i0.Input, args: [{ isSignal: true, alias: "touch", required: false }] }], compact: [{ type: i0.Input, args: [{ isSignal: true, alias: "compact", required: false }] }], menuOpenId: [{ type: i0.Input, args: [{ isSignal: true, alias: "menuOpenId", required: false }] }], select: [{ type: i0.Output, args: ["select"] }], toggle: [{ type: i0.Output, args: ["toggle"] }], retry: [{ type: i0.Output, args: ["retry"] }], openCommands: [{ type: i0.Output, args: ["openCommands"] }] } });
|
|
661
1637
|
|
|
1638
|
+
/** Rows and cards ignore clicks and Enter / Space coming from these areas: they belong to a checkbox or a command. */
|
|
1639
|
+
const CONTROL_AREAS = '.cell--select, .card-top, .commands, .sd-file-explorer-menu-trigger';
|
|
662
1640
|
/**
|
|
663
1641
|
* Items of the current folder (or search results) as a list or a grid (internal).
|
|
664
|
-
* Rows and cards are focusable; `Enter` / `Space` activate them like a click.
|
|
1642
|
+
* Rows and cards are focusable; `Enter` / `Space` activate them like a click. Selection checkboxes and commands sit
|
|
1643
|
+
* next to the name and never activate the item.
|
|
1644
|
+
*
|
|
1645
|
+
* In the compact layout a row or card carries one actions trigger instead of its commands and row shortcuts: the
|
|
1646
|
+
* explorer lists them in its command drawer.
|
|
665
1647
|
*/
|
|
666
1648
|
class SdFileExplorerItemList {
|
|
1649
|
+
canMove = input(false, /* @ts-ignore */
|
|
1650
|
+
...(ngDevMode ? [{ debugName: "canMove" }] : /* istanbul ignore next */ []));
|
|
1651
|
+
moveDropTarget = input(/* @ts-ignore */
|
|
1652
|
+
...(ngDevMode ? [undefined, { debugName: "moveDropTarget" }] : /* istanbul ignore next */ []));
|
|
1653
|
+
movePending = input(false, /* @ts-ignore */
|
|
1654
|
+
...(ngDevMode ? [{ debugName: "movePending" }] : /* istanbul ignore next */ []));
|
|
1655
|
+
move = output();
|
|
1656
|
+
columns = input([], /* @ts-ignore */
|
|
1657
|
+
...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
|
|
1658
|
+
columnWidths = computed(() => this.columns()
|
|
1659
|
+
.map(column => column.width())
|
|
1660
|
+
.join(' '), /* @ts-ignore */
|
|
1661
|
+
...(ngDevMode ? [{ debugName: "columnWidths" }] : /* istanbul ignore next */ []));
|
|
667
1662
|
/** Items to render, already formatted. */
|
|
668
1663
|
items = input.required(/* @ts-ignore */
|
|
669
1664
|
...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
@@ -676,47 +1671,145 @@ class SdFileExplorerItemList {
|
|
|
676
1671
|
/** Show share buttons for files. */
|
|
677
1672
|
canShare = input(false, /* @ts-ignore */
|
|
678
1673
|
...(ngDevMode ? [{ debugName: "canShare" }] : /* istanbul ignore next */ []));
|
|
679
|
-
/** Narrow layout: hides the modified column. */
|
|
1674
|
+
/** Narrow layout: hides the modified column and replaces commands and row shortcuts with an actions trigger. */
|
|
680
1675
|
compact = input(false, /* @ts-ignore */
|
|
681
1676
|
...(ngDevMode ? [{ debugName: "compact" }] : /* istanbul ignore next */ []));
|
|
1677
|
+
/** Touch screen: commands always visible, with 48 px touch targets. */
|
|
1678
|
+
touch = input(false, /* @ts-ignore */
|
|
1679
|
+
...(ngDevMode ? [{ debugName: "touch" }] : /* istanbul ignore next */ []));
|
|
682
1680
|
/** Id of the file currently shown in the preview panel. */
|
|
683
1681
|
activeId = input(null, /* @ts-ignore */
|
|
684
1682
|
...(ngDevMode ? [{ debugName: "activeId" }] : /* istanbul ignore next */ []));
|
|
685
1683
|
/** Accessible name of the list. */
|
|
686
1684
|
label = input('', /* @ts-ignore */
|
|
687
1685
|
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
1686
|
+
/** Selection state; `null` hides every checkbox. */
|
|
1687
|
+
selection = input(null, /* @ts-ignore */
|
|
1688
|
+
...(ngDevMode ? [{ debugName: "selection" }] : /* istanbul ignore next */ []));
|
|
1689
|
+
/** Commands of file rows and cards. */
|
|
1690
|
+
fileCommands = input(undefined, /* @ts-ignore */
|
|
1691
|
+
...(ngDevMode ? [{ debugName: "fileCommands" }] : /* istanbul ignore next */ []));
|
|
1692
|
+
/** Commands of folder rows and cards. */
|
|
1693
|
+
folderCommands = input(undefined, /* @ts-ignore */
|
|
1694
|
+
...(ngDevMode ? [{ debugName: "folderCommands" }] : /* istanbul ignore next */ []));
|
|
1695
|
+
/** Id of the item whose command drawer is open from this list. */
|
|
1696
|
+
menuOpenId = input(null, /* @ts-ignore */
|
|
1697
|
+
...(ngDevMode ? [{ debugName: "menuOpenId" }] : /* istanbul ignore next */ []));
|
|
688
1698
|
/** Row / card activated. */
|
|
689
1699
|
activate = output();
|
|
1700
|
+
/** Compact actions trigger pressed. */
|
|
1701
|
+
openCommands = output();
|
|
690
1702
|
/** Download button pressed. */
|
|
691
1703
|
download = output();
|
|
692
1704
|
/** Share button pressed. */
|
|
693
1705
|
share = output();
|
|
694
|
-
/**
|
|
1706
|
+
/** Checkbox of a file toggled. */
|
|
1707
|
+
toggleSelect = output();
|
|
1708
|
+
/** Select-all checkbox toggled. */
|
|
1709
|
+
toggleSelectAll = output();
|
|
1710
|
+
/**
|
|
1711
|
+
* Width of the row action column: one 32 px icon button per row shortcut on desktop; the actions trigger (32 px,
|
|
1712
|
+
* 48 px on touch) in compact.
|
|
1713
|
+
*/
|
|
695
1714
|
actionsWidth = computed(() => {
|
|
1715
|
+
if (this.compact())
|
|
1716
|
+
return this.menuColumn() ? `${(this.touch() ? 48 : 32) + 4}px` : null;
|
|
696
1717
|
const count = (this.canDownload() ? 1 : 0) + (this.canShare() ? 1 : 0);
|
|
697
1718
|
if (!count)
|
|
698
1719
|
return null;
|
|
699
|
-
return `${count * 32 + (count - 1) * 2 +
|
|
1720
|
+
return `${count * 32 + (count - 1) * 2 + 12}px`;
|
|
700
1721
|
}, /* @ts-ignore */
|
|
701
1722
|
...(ngDevMode ? [{ debugName: "actionsWidth" }] : /* istanbul ignore next */ []));
|
|
1723
|
+
hasCommands = computed(() => !!(this.fileCommands()?.length || this.folderCommands()?.length), /* @ts-ignore */
|
|
1724
|
+
...(ngDevMode ? [{ debugName: "hasCommands" }] : /* istanbul ignore next */ []));
|
|
1725
|
+
rows = computed(() => {
|
|
1726
|
+
const selection = this.selection();
|
|
1727
|
+
const fileCommands = this.fileCommands();
|
|
1728
|
+
const folderCommands = this.folderCommands();
|
|
1729
|
+
const compact = this.compact();
|
|
1730
|
+
// why: only list rows carry the download / share shortcuts — grid cards never did — so only they bring them into
|
|
1731
|
+
// the drawer. The explorer turns them off as soon as fileCommands is declared.
|
|
1732
|
+
const shortcuts = this.view() === 'list' && (this.canDownload() || this.canShare());
|
|
1733
|
+
return this.items().map(view => {
|
|
1734
|
+
const isFile = view.item.kind === 'file';
|
|
1735
|
+
const commands = isFile ? fileCommands : folderCommands;
|
|
1736
|
+
const source = isFile ? 'fileCommands' : 'folderCommands';
|
|
1737
|
+
return {
|
|
1738
|
+
view,
|
|
1739
|
+
selectable: !!selection && isFile,
|
|
1740
|
+
selected: !!selection?.selectedIds.has(view.item.id),
|
|
1741
|
+
selectDisabled: !!selection?.disabledIds.has(view.item.id),
|
|
1742
|
+
commands: !compact && commands?.length ? commands : null,
|
|
1743
|
+
source,
|
|
1744
|
+
menu: compact ? this.#menu(commands, view.item, source, isFile && shortcuts) : null,
|
|
1745
|
+
};
|
|
1746
|
+
});
|
|
1747
|
+
}, /* @ts-ignore */
|
|
1748
|
+
...(ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []));
|
|
1749
|
+
/** Compact list with at least one actions trigger: the action column holds them. */
|
|
1750
|
+
menuColumn = computed(() => this.rows().some(row => row.menu), /* @ts-ignore */
|
|
1751
|
+
...(ngDevMode ? [{ debugName: "menuColumn" }] : /* istanbul ignore next */ []));
|
|
1752
|
+
/** Trigger state of one item: `null` when its drawer would be empty. Same filtering as the drawer and the buttons. */
|
|
1753
|
+
#menu(commands, item, source, shortcuts) {
|
|
1754
|
+
const resolved = sdFileExplorerResolveActions(commands, item, SD_FILE_EXPLORER_COMMAND_DEFAULTS, source);
|
|
1755
|
+
return resolved.length || shortcuts ? { busy: sdFileExplorerActionsBusy(resolved) } : null;
|
|
1756
|
+
}
|
|
1757
|
+
onClick(event, view) {
|
|
1758
|
+
if (this.#fromControl(event))
|
|
1759
|
+
return;
|
|
1760
|
+
this.activate.emit(view);
|
|
1761
|
+
}
|
|
702
1762
|
onKeydown(event, view) {
|
|
703
1763
|
if (event.key !== 'Enter' && event.key !== ' ')
|
|
704
1764
|
return;
|
|
1765
|
+
if (this.#fromControl(event))
|
|
1766
|
+
return;
|
|
705
1767
|
event.preventDefault();
|
|
706
1768
|
this.activate.emit(view);
|
|
707
1769
|
}
|
|
1770
|
+
/** The event started on a checkbox or a command (or the space around it) inside the row / card. */
|
|
1771
|
+
#fromControl(event) {
|
|
1772
|
+
const target = event.target instanceof Element ? event.target : null;
|
|
1773
|
+
const area = target?.closest(CONTROL_AREAS);
|
|
1774
|
+
return !!area && event.currentTarget instanceof Element && event.currentTarget.contains(area);
|
|
1775
|
+
}
|
|
708
1776
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdFileExplorerItemList, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
709
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdFileExplorerItemList, isStandalone: true, selector: "sd-file-explorer-item-list", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: true, transformFunction: null }, view: { classPropertyName: "view", publicName: "view", isSignal: true, isRequired: false, transformFunction: null }, canDownload: { classPropertyName: "canDownload", publicName: "canDownload", isSignal: true, isRequired: false, transformFunction: null }, canShare: { classPropertyName: "canShare", publicName: "canShare", isSignal: true, isRequired: false, transformFunction: null }, compact: { classPropertyName: "compact", publicName: "compact", isSignal: true, isRequired: false, transformFunction: null }, activeId: { classPropertyName: "activeId", publicName: "activeId", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { activate: "activate", download: "download", share: "share" }, host: { properties: { "class.sd-file-explorer-item-list--compact": "compact()", "style.--sd-fe-actions-width": "actionsWidth()" }, classAttribute: "sd-file-explorer-item-list" }, ngImport: i0, template: `
|
|
710
|
-
@let
|
|
1777
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdFileExplorerItemList, isStandalone: true, selector: "sd-file-explorer-item-list", inputs: { canMove: { classPropertyName: "canMove", publicName: "canMove", isSignal: true, isRequired: false, transformFunction: null }, moveDropTarget: { classPropertyName: "moveDropTarget", publicName: "moveDropTarget", isSignal: true, isRequired: false, transformFunction: null }, movePending: { classPropertyName: "movePending", publicName: "movePending", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: true, transformFunction: null }, view: { classPropertyName: "view", publicName: "view", isSignal: true, isRequired: false, transformFunction: null }, canDownload: { classPropertyName: "canDownload", publicName: "canDownload", isSignal: true, isRequired: false, transformFunction: null }, canShare: { classPropertyName: "canShare", publicName: "canShare", isSignal: true, isRequired: false, transformFunction: null }, compact: { classPropertyName: "compact", publicName: "compact", isSignal: true, isRequired: false, transformFunction: null }, touch: { classPropertyName: "touch", publicName: "touch", isSignal: true, isRequired: false, transformFunction: null }, activeId: { classPropertyName: "activeId", publicName: "activeId", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, selection: { classPropertyName: "selection", publicName: "selection", isSignal: true, isRequired: false, transformFunction: null }, fileCommands: { classPropertyName: "fileCommands", publicName: "fileCommands", isSignal: true, isRequired: false, transformFunction: null }, folderCommands: { classPropertyName: "folderCommands", publicName: "folderCommands", isSignal: true, isRequired: false, transformFunction: null }, menuOpenId: { classPropertyName: "menuOpenId", publicName: "menuOpenId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { move: "move", activate: "activate", openCommands: "openCommands", download: "download", share: "share", toggleSelect: "toggleSelect", toggleSelectAll: "toggleSelectAll" }, host: { properties: { "class.sd-file-explorer-item-list--compact": "compact()", "class.sd-file-explorer-item-list--touch": "touch()", "style.--sd-fe-actions-width": "actionsWidth()" }, classAttribute: "sd-file-explorer-item-list" }, ngImport: i0, template: `
|
|
1778
|
+
@let _rows = rows();
|
|
711
1779
|
@let _canDownload = canDownload();
|
|
712
1780
|
@let _canShare = canShare();
|
|
713
|
-
@let _hasActions = _canDownload || _canShare;
|
|
714
1781
|
@let _compact = compact();
|
|
1782
|
+
@let _touch = touch();
|
|
1783
|
+
@let _actionColumn = _compact ? menuColumn() : _canDownload || _canShare;
|
|
715
1784
|
@let _activeId = activeId();
|
|
1785
|
+
@let _menuOpenId = menuOpenId();
|
|
1786
|
+
@let _selection = selection();
|
|
1787
|
+
@let _commandSize = _touch && !_compact ? 'lg' : 'sm';
|
|
716
1788
|
@if (view() === 'list') {
|
|
717
|
-
<div
|
|
1789
|
+
<div
|
|
1790
|
+
class="list"
|
|
1791
|
+
role="table"
|
|
1792
|
+
[class.list--selectable]="!!_selection"
|
|
1793
|
+
[class.list--custom]="columns().length > 0"
|
|
1794
|
+
[style.--sd-fe-custom-cols]="columnWidths()"
|
|
1795
|
+
[attr.aria-label]="label()"
|
|
1796
|
+
[attr.aria-colcount]="(_selection ? 1 : 0) + (_compact ? 2 : 3) + columns().length + (_actionColumn ? 1 : 0)">
|
|
718
1797
|
<div class="list-head" role="rowgroup">
|
|
719
1798
|
<div class="row row--head" role="row">
|
|
1799
|
+
@if (_selection) {
|
|
1800
|
+
<span class="cell cell--select" role="columnheader">
|
|
1801
|
+
<mat-checkbox
|
|
1802
|
+
class="select-all"
|
|
1803
|
+
color="primary"
|
|
1804
|
+
[checked]="_selection.state === 'all'"
|
|
1805
|
+
[indeterminate]="_selection.state === 'some'"
|
|
1806
|
+
[disabled]="!_selection.eligibleCount"
|
|
1807
|
+
[aria-label]="_selection.allLabel"
|
|
1808
|
+
[matTooltip]="_selection.allLabel"
|
|
1809
|
+
[attr.data-autoid]="_selection.autoId ?? null"
|
|
1810
|
+
(change)="toggleSelectAll.emit()" />
|
|
1811
|
+
</span>
|
|
1812
|
+
}
|
|
720
1813
|
<span class="cell cell--name" role="columnheader">{{ 'core.component.file-explorer.column.name' | sdTranslate }}</span>
|
|
721
1814
|
@if (!_compact) {
|
|
722
1815
|
<span class="cell cell--modified" role="columnheader">{{
|
|
@@ -724,37 +1817,105 @@ class SdFileExplorerItemList {
|
|
|
724
1817
|
}}</span>
|
|
725
1818
|
}
|
|
726
1819
|
<span class="cell cell--size" role="columnheader">{{ 'core.component.file-explorer.column.size' | sdTranslate }}</span>
|
|
727
|
-
@
|
|
728
|
-
<span class="cell cell--
|
|
1820
|
+
@for (column of columns(); track column.id(); let index = $index) {
|
|
1821
|
+
<span class="cell cell--custom" role="columnheader" [style.grid-column]="5 + index">{{ column.title() }}</span>
|
|
1822
|
+
}
|
|
1823
|
+
@if (_actionColumn) {
|
|
1824
|
+
<span class="cell cell--action" role="columnheader" [style.grid-column]="5 + columns().length"></span>
|
|
729
1825
|
}
|
|
730
1826
|
</div>
|
|
731
1827
|
</div>
|
|
732
1828
|
<div role="rowgroup">
|
|
733
|
-
@for (
|
|
1829
|
+
@for (row of _rows; track row.view.item.id; let rowIndex = $index) {
|
|
1830
|
+
@let view = row.view;
|
|
734
1831
|
<div
|
|
735
1832
|
class="row"
|
|
736
1833
|
role="row"
|
|
737
1834
|
tabindex="0"
|
|
738
1835
|
[class.row--active]="view.item.id === _activeId"
|
|
1836
|
+
[class.row--selected]="row.selected"
|
|
1837
|
+
[class.row--commands]="!!row.commands"
|
|
1838
|
+
[class.row--movable]="canMove() && view.item.kind === 'file'"
|
|
739
1839
|
[attr.data-item-id]="view.item.id"
|
|
1840
|
+
[attr.data-move-target]="view.item.kind === 'folder' ? view.item.id : null"
|
|
1841
|
+
[class.move-drop-target]="view.item.kind === 'folder' && moveDropTarget() === view.item.id"
|
|
740
1842
|
[attr.data-autoid]="view.autoId"
|
|
741
|
-
(click)="
|
|
1843
|
+
(click)="onClick($event, view)"
|
|
742
1844
|
(keydown)="onKeydown($event, view)">
|
|
1845
|
+
@if (_selection) {
|
|
1846
|
+
<span class="cell cell--select" role="cell">
|
|
1847
|
+
@if (row.selectable) {
|
|
1848
|
+
<mat-checkbox
|
|
1849
|
+
class="select"
|
|
1850
|
+
color="primary"
|
|
1851
|
+
[checked]="row.selected"
|
|
1852
|
+
[disabled]="row.selectDisabled"
|
|
1853
|
+
[aria-label]="view.selectLabel"
|
|
1854
|
+
[attr.data-autoid]="view.autoId ? view.autoId + '-select' : null"
|
|
1855
|
+
(change)="toggleSelect.emit(view.item)" />
|
|
1856
|
+
}
|
|
1857
|
+
</span>
|
|
1858
|
+
}
|
|
743
1859
|
<span class="cell cell--name" role="cell">
|
|
744
1860
|
<sd-file-explorer-file-icon [icon]="view.icon" [size]="32" />
|
|
745
|
-
<span class="name" [title]="view.item.name">{{ view.item.name }}</span>
|
|
1861
|
+
<span class="name" [draggable]="canMove() && view.item.kind === 'file'" [title]="view.item.name">{{ view.item.name }}</span>
|
|
1862
|
+
@if (view.item.kind === 'folder' && moveDropTarget() === view.item.id) {
|
|
1863
|
+
<span class="move-drop-label">{{ 'core.component.file-explorer.move.confirm' | sdTranslate }}</span>
|
|
1864
|
+
}
|
|
1865
|
+
@if (canMove() && view.item.kind === 'file') {
|
|
1866
|
+
<sd-button
|
|
1867
|
+
htmlType="button"
|
|
1868
|
+
class="move-file-button commands"
|
|
1869
|
+
type="text"
|
|
1870
|
+
color="secondary"
|
|
1871
|
+
size="sm"
|
|
1872
|
+
prefixIcon="drive_file_move"
|
|
1873
|
+
[disabled]="movePending()"
|
|
1874
|
+
[tooltip]="('core.component.file-explorer.move.to' | sdTranslate) + ': ' + view.item.name"
|
|
1875
|
+
(click)="$event.stopPropagation(); move.emit(view.item)"
|
|
1876
|
+
(keydown)="$event.stopPropagation()" />
|
|
1877
|
+
}
|
|
1878
|
+
@if (row.commands) {
|
|
1879
|
+
<sd-file-explorer-actions
|
|
1880
|
+
class="commands"
|
|
1881
|
+
[actions]="row.commands"
|
|
1882
|
+
[context]="view.item"
|
|
1883
|
+
[size]="_commandSize"
|
|
1884
|
+
[source]="row.source"
|
|
1885
|
+
[autoId]="view.autoId ? view.autoId + '-command' : undefined" />
|
|
1886
|
+
}
|
|
746
1887
|
</span>
|
|
747
1888
|
@if (!_compact) {
|
|
748
1889
|
<span class="cell cell--modified" role="cell" [title]="view.modifiedTitle">{{ view.modifiedLabel || '—' }}</span>
|
|
749
1890
|
}
|
|
750
1891
|
<span class="cell cell--size" role="cell">{{ view.sizeLabel || '—' }}</span>
|
|
751
|
-
@
|
|
1892
|
+
@for (column of columns(); track column.id(); let index = $index) {
|
|
1893
|
+
<span class="cell cell--custom" role="cell" [style.grid-column]="5 + index">
|
|
1894
|
+
<ng-container
|
|
1895
|
+
[ngTemplateOutlet]="column.template"
|
|
1896
|
+
[ngTemplateOutletContext]="{ $implicit: view.item, item: view.item, data: view.item.data, index: rowIndex }" />
|
|
1897
|
+
</span>
|
|
1898
|
+
}
|
|
1899
|
+
@if (_actionColumn) {
|
|
752
1900
|
<!-- why: sd-button already keeps its click from reaching the row; Enter/Space are stopped here so the key does not open the file too. -->
|
|
753
|
-
<span class="cell cell--action" role="cell">
|
|
754
|
-
@if (
|
|
1901
|
+
<span class="cell cell--action" role="cell" [style.grid-column]="5 + columns().length">
|
|
1902
|
+
@if (_compact) {
|
|
1903
|
+
@if (row.menu; as menu) {
|
|
1904
|
+
<sd-file-explorer-menu-trigger
|
|
1905
|
+
class="row-menu"
|
|
1906
|
+
[label]="view.actionsLabel"
|
|
1907
|
+
[busy]="menu.busy"
|
|
1908
|
+
[expanded]="view.item.id === _menuOpenId"
|
|
1909
|
+
[touch]="_touch"
|
|
1910
|
+
[autoId]="view.autoId ? view.autoId + '-commands' : undefined"
|
|
1911
|
+
(activate)="openCommands.emit({ item: view.item, trigger: $event })" />
|
|
1912
|
+
}
|
|
1913
|
+
} @else if (view.item.kind === 'file') {
|
|
755
1914
|
@if (_canShare) {
|
|
756
1915
|
<sd-button
|
|
757
1916
|
class="row-action row-share"
|
|
1917
|
+
[disabled]="view.shareDisabled ?? false"
|
|
1918
|
+
[attr.aria-description]="view.shareDisabled ? view.unavailableReason : null"
|
|
758
1919
|
type="text"
|
|
759
1920
|
color="secondary"
|
|
760
1921
|
size="sm"
|
|
@@ -768,6 +1929,8 @@ class SdFileExplorerItemList {
|
|
|
768
1929
|
@if (_canDownload) {
|
|
769
1930
|
<sd-button
|
|
770
1931
|
class="row-action row-download"
|
|
1932
|
+
[disabled]="view.downloadDisabled ?? false"
|
|
1933
|
+
[attr.aria-description]="view.downloadDisabled ? view.unavailableReason : null"
|
|
771
1934
|
type="text"
|
|
772
1935
|
color="secondary"
|
|
773
1936
|
size="sm"
|
|
@@ -786,17 +1949,69 @@ class SdFileExplorerItemList {
|
|
|
786
1949
|
</div>
|
|
787
1950
|
</div>
|
|
788
1951
|
} @else {
|
|
1952
|
+
@let _cardTop = !!_selection || hasCommands();
|
|
1953
|
+
@if (_selection) {
|
|
1954
|
+
<div class="grid-head">
|
|
1955
|
+
<mat-checkbox
|
|
1956
|
+
class="select-all"
|
|
1957
|
+
color="primary"
|
|
1958
|
+
[checked]="_selection.state === 'all'"
|
|
1959
|
+
[indeterminate]="_selection.state === 'some'"
|
|
1960
|
+
[disabled]="!_selection.eligibleCount"
|
|
1961
|
+
[aria-label]="_selection.allLabel"
|
|
1962
|
+
[matTooltip]="_selection.allLabel"
|
|
1963
|
+
[attr.data-autoid]="_selection.autoId ?? null"
|
|
1964
|
+
(change)="toggleSelectAll.emit()" />
|
|
1965
|
+
</div>
|
|
1966
|
+
}
|
|
789
1967
|
<ul class="grid" [attr.aria-label]="label()">
|
|
790
|
-
@for (
|
|
1968
|
+
@for (row of _rows; track row.view.item.id) {
|
|
1969
|
+
@let view = row.view;
|
|
791
1970
|
<li
|
|
792
1971
|
class="card"
|
|
793
1972
|
tabindex="0"
|
|
794
1973
|
[class.card--active]="view.item.id === _activeId"
|
|
1974
|
+
[class.card--selected]="row.selected"
|
|
795
1975
|
[attr.data-item-id]="view.item.id"
|
|
1976
|
+
[attr.data-move-target]="view.item.kind === 'folder' ? view.item.id : null"
|
|
1977
|
+
[class.move-drop-target]="view.item.kind === 'folder' && moveDropTarget() === view.item.id"
|
|
796
1978
|
[attr.data-autoid]="view.autoId"
|
|
797
1979
|
[attr.aria-label]="view.item.name + ', ' + view.typeLabel"
|
|
798
|
-
(click)="
|
|
1980
|
+
(click)="onClick($event, view)"
|
|
799
1981
|
(keydown)="onKeydown($event, view)">
|
|
1982
|
+
@if (_cardTop) {
|
|
1983
|
+
<span class="card-top">
|
|
1984
|
+
@if (row.selectable) {
|
|
1985
|
+
<mat-checkbox
|
|
1986
|
+
class="select"
|
|
1987
|
+
color="primary"
|
|
1988
|
+
[checked]="row.selected"
|
|
1989
|
+
[disabled]="row.selectDisabled"
|
|
1990
|
+
[aria-label]="view.selectLabel"
|
|
1991
|
+
[attr.data-autoid]="view.autoId ? view.autoId + '-select' : null"
|
|
1992
|
+
(change)="toggleSelect.emit(view.item)" />
|
|
1993
|
+
}
|
|
1994
|
+
@if (row.commands) {
|
|
1995
|
+
<sd-file-explorer-actions
|
|
1996
|
+
class="commands"
|
|
1997
|
+
[actions]="row.commands"
|
|
1998
|
+
[context]="view.item"
|
|
1999
|
+
[size]="_commandSize"
|
|
2000
|
+
[source]="row.source"
|
|
2001
|
+
[autoId]="view.autoId ? view.autoId + '-command' : undefined" />
|
|
2002
|
+
}
|
|
2003
|
+
@if (row.menu; as menu) {
|
|
2004
|
+
<sd-file-explorer-menu-trigger
|
|
2005
|
+
class="card-menu"
|
|
2006
|
+
[label]="view.actionsLabel"
|
|
2007
|
+
[busy]="menu.busy"
|
|
2008
|
+
[expanded]="view.item.id === _menuOpenId"
|
|
2009
|
+
[touch]="_touch"
|
|
2010
|
+
[autoId]="view.autoId ? view.autoId + '-commands' : undefined"
|
|
2011
|
+
(activate)="openCommands.emit({ item: view.item, trigger: $event })" />
|
|
2012
|
+
}
|
|
2013
|
+
</span>
|
|
2014
|
+
}
|
|
800
2015
|
<span class="thumb">
|
|
801
2016
|
@if (view.item.thumbnailUrl) {
|
|
802
2017
|
<img [src]="view.item.thumbnailUrl" alt="" loading="lazy" />
|
|
@@ -804,30 +2019,80 @@ class SdFileExplorerItemList {
|
|
|
804
2019
|
<sd-file-explorer-file-icon [icon]="view.icon" [size]="48" />
|
|
805
2020
|
}
|
|
806
2021
|
</span>
|
|
807
|
-
<span class="card-name" [
|
|
2022
|
+
<span class="card-name" [draggable]="canMove() && view.item.kind === 'file'" [title]="view.item.name">{{
|
|
2023
|
+
view.item.name
|
|
2024
|
+
}}</span>
|
|
2025
|
+
@if (canMove() && view.item.kind === 'file') {
|
|
2026
|
+
<sd-button
|
|
2027
|
+
htmlType="button"
|
|
2028
|
+
class="move-file-button commands"
|
|
2029
|
+
type="text"
|
|
2030
|
+
color="secondary"
|
|
2031
|
+
size="sm"
|
|
2032
|
+
prefixIcon="drive_file_move"
|
|
2033
|
+
[disabled]="movePending()"
|
|
2034
|
+
[tooltip]="('core.component.file-explorer.move.to' | sdTranslate) + ': ' + view.item.name"
|
|
2035
|
+
(click)="$event.stopPropagation(); move.emit(view.item)"
|
|
2036
|
+
(keydown)="$event.stopPropagation()" />
|
|
2037
|
+
}
|
|
808
2038
|
</li>
|
|
809
2039
|
}
|
|
810
2040
|
</ul>
|
|
811
2041
|
}
|
|
812
|
-
`, isInline: true, styles: [":host{display:block}.list{width:100%}.row{display:grid;grid-template-columns:minmax(0,1fr) 128px 88px var(--sd-fe-actions-width,
|
|
2042
|
+
`, isInline: true, styles: [":host{display:block}.list{width:100%}.row{display:grid;grid-template-columns:var(--sd-fe-select-col, 0px) minmax(0,1fr) var(--sd-fe-modified-col, 128px) var(--sd-fe-size-col, 88px) var(--sd-fe-custom-cols, ) var(--sd-fe-actions-width, 0px);align-items:center;min-height:62px;border-bottom:1px solid var(--sd-fe-border);color:var(--sd-fe-text);font-size:var(--sd-font-size-15, 15px);cursor:pointer;outline:none;transition:background-color var(--sd-duration-fast, .12s) ease}.row:hover{background:var(--sd-fe-hover)}.row:focus-visible{box-shadow:inset 0 0 0 2px var(--sd-fe-accent)}.list--selectable{--sd-fe-select-col: 44px}.list--custom{min-width:max-content}.list--custom .cell--name{min-width:180px}.cell--select{grid-column:1}.cell--name{grid-column:2}.cell--modified{grid-column:3}.cell--size{grid-column:4}.cell--action{grid-column:5}.row--head{min-height:34px;color:var(--sd-fe-text-secondary);font-size:var(--sd-font-size-13, 13px);cursor:default}.row--head:hover{background:transparent}.row--active,.row--selected,.row--active:hover,.row--selected:hover{background:var(--sd-fe-accent-soft)}.cell{min-width:0;padding:0 8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cell--name{display:flex;align-items:center;gap:16px}.row:not(.row--head) .cell--modified,.row:not(.row--head) .cell--size{color:var(--sd-fe-text-secondary);font-size:var(--sd-font-size-13, 13px)}.cell--action{display:flex;align-items:center;justify-content:flex-end;gap:2px;padding:0 4px 0 0;overflow:visible}.name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.row--movable .cell--name{flex-wrap:wrap;row-gap:16px;padding-block:8px;overflow:visible}.row--movable .name{flex:1 1 4.5rem}.cell--select{display:flex;align-items:center;justify-content:center;padding:0;overflow:visible}.row--commands .cell--name{flex-wrap:wrap;row-gap:4px;padding-block:8px;overflow:visible}.row--commands .name{flex:1 1 4.5rem}.commands,.card-menu{margin-inline-start:auto}.commands{opacity:0}.row:hover .commands,.row:focus-within .commands,.card:hover .commands,.card:focus-within .commands,.commands.sd-file-explorer-actions--open,.commands.sd-file-explorer-actions--busy,:host(.sd-file-explorer-item-list--touch) .commands{opacity:1}:host(.sd-file-explorer-item-list--compact){--sd-fe-modified-col: 0px;--sd-fe-size-col: 66px}:host(.sd-file-explorer-item-list--compact) .row{min-height:55px;font-size:var(--sd-font-size-14, 14px)}:host(.sd-file-explorer-item-list--compact) .row--head{min-height:30px;font-size:var(--sd-font-size-12, 12px)}:host(.sd-file-explorer-item-list--compact) .cell--name{gap:12px}:host(.sd-file-explorer-item-list--compact) .cell{padding:0 4px}:host(.sd-file-explorer-item-list--compact) .cell--action{padding:0}.grid{list-style:none;margin:0;padding:4px 0 0;display:grid;grid-template-columns:repeat(auto-fill,minmax(248px,1fr));gap:18px 20px}.card{display:flex;flex-direction:column;gap:12px;min-width:0;padding:12px 12px 14px;border:1px solid var(--sd-fe-border);border-radius:var(--sd-radius-12, 12px);background:var(--sd-fe-surface);color:var(--sd-fe-text);cursor:pointer;outline:none;transition:border-color var(--sd-duration-fast, .12s) ease,box-shadow var(--sd-duration-fast, .12s) ease}.card:hover{border-color:var(--sd-fe-border-strong);box-shadow:0 2px 8px #0f172a0f}.card:focus-visible{box-shadow:0 0 0 2px var(--sd-fe-accent)}.card--active{border-color:var(--sd-fe-accent)}.card--selected{border-color:var(--sd-fe-accent);background:var(--sd-fe-accent-soft)}.card-top{display:flex;flex-wrap:wrap;align-items:center;gap:4px;min-height:40px;margin-block:-4px}.grid-head{display:flex;align-items:center;margin-bottom:12px;padding:0 0 4px 13px;border-bottom:1px solid var(--sd-fe-border)}.thumb{display:flex;align-items:center;justify-content:center;height:104px;overflow:hidden;border-radius:var(--sd-radius-8, 8px);background:var(--sd-fe-muted-surface)}.thumb img{width:100%;height:100%;object-fit:cover}.card-name{padding:0 2px;overflow:hidden;font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-semibold, 600);text-overflow:ellipsis;white-space:nowrap}:host(.sd-file-explorer-item-list--compact) .grid{grid-template-columns:repeat(auto-fill,minmax(148px,1fr));gap:12px}@media(prefers-reduced-motion:reduce){.row,.card{transition:none}}.move-file-button{flex-shrink:0}.move-drop-target{outline:2px solid var(--sd-fe-accent);outline-offset:-2px}.move-drop-label{color:var(--sd-fe-text);font-weight:600}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "directive", type: MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "openOnHover", "loading", "block", "htmlType", "indicator", "indicatorColor", "indicatorMax", "indicatorLabel"], outputs: ["click"] }, { kind: "component", type: SdFileExplorerActions, selector: "sd-file-explorer-actions", inputs: ["actions", "context", "defaultLeafType", "defaultGroupType", "defaultColor", "size", "source", "autoId"] }, { kind: "component", type: SdFileExplorerFileIcon, selector: "sd-file-explorer-file-icon", inputs: ["icon", "size"] }, { kind: "component", type: SdFileExplorerMenuTrigger, selector: "sd-file-explorer-menu-trigger", inputs: ["label", "busy", "expanded", "touch", "tabIndex", "autoId"], outputs: ["activate"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
813
2043
|
}
|
|
814
2044
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdFileExplorerItemList, decorators: [{
|
|
815
2045
|
type: Component,
|
|
816
|
-
args: [{ selector: 'sd-file-explorer-item-list', standalone: true, imports: [
|
|
2046
|
+
args: [{ selector: 'sd-file-explorer-item-list', standalone: true, imports: [
|
|
2047
|
+
NgTemplateOutlet,
|
|
2048
|
+
MatCheckbox,
|
|
2049
|
+
MatTooltip,
|
|
2050
|
+
SdButton,
|
|
2051
|
+
SdTranslatePipe,
|
|
2052
|
+
SdFileExplorerActions,
|
|
2053
|
+
SdFileExplorerFileIcon,
|
|
2054
|
+
SdFileExplorerMenuTrigger,
|
|
2055
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
817
2056
|
class: 'sd-file-explorer-item-list',
|
|
818
2057
|
'[class.sd-file-explorer-item-list--compact]': 'compact()',
|
|
2058
|
+
'[class.sd-file-explorer-item-list--touch]': 'touch()',
|
|
819
2059
|
'[style.--sd-fe-actions-width]': 'actionsWidth()',
|
|
820
2060
|
}, template: `
|
|
821
|
-
@let
|
|
2061
|
+
@let _rows = rows();
|
|
822
2062
|
@let _canDownload = canDownload();
|
|
823
2063
|
@let _canShare = canShare();
|
|
824
|
-
@let _hasActions = _canDownload || _canShare;
|
|
825
2064
|
@let _compact = compact();
|
|
2065
|
+
@let _touch = touch();
|
|
2066
|
+
@let _actionColumn = _compact ? menuColumn() : _canDownload || _canShare;
|
|
826
2067
|
@let _activeId = activeId();
|
|
2068
|
+
@let _menuOpenId = menuOpenId();
|
|
2069
|
+
@let _selection = selection();
|
|
2070
|
+
@let _commandSize = _touch && !_compact ? 'lg' : 'sm';
|
|
827
2071
|
@if (view() === 'list') {
|
|
828
|
-
<div
|
|
2072
|
+
<div
|
|
2073
|
+
class="list"
|
|
2074
|
+
role="table"
|
|
2075
|
+
[class.list--selectable]="!!_selection"
|
|
2076
|
+
[class.list--custom]="columns().length > 0"
|
|
2077
|
+
[style.--sd-fe-custom-cols]="columnWidths()"
|
|
2078
|
+
[attr.aria-label]="label()"
|
|
2079
|
+
[attr.aria-colcount]="(_selection ? 1 : 0) + (_compact ? 2 : 3) + columns().length + (_actionColumn ? 1 : 0)">
|
|
829
2080
|
<div class="list-head" role="rowgroup">
|
|
830
2081
|
<div class="row row--head" role="row">
|
|
2082
|
+
@if (_selection) {
|
|
2083
|
+
<span class="cell cell--select" role="columnheader">
|
|
2084
|
+
<mat-checkbox
|
|
2085
|
+
class="select-all"
|
|
2086
|
+
color="primary"
|
|
2087
|
+
[checked]="_selection.state === 'all'"
|
|
2088
|
+
[indeterminate]="_selection.state === 'some'"
|
|
2089
|
+
[disabled]="!_selection.eligibleCount"
|
|
2090
|
+
[aria-label]="_selection.allLabel"
|
|
2091
|
+
[matTooltip]="_selection.allLabel"
|
|
2092
|
+
[attr.data-autoid]="_selection.autoId ?? null"
|
|
2093
|
+
(change)="toggleSelectAll.emit()" />
|
|
2094
|
+
</span>
|
|
2095
|
+
}
|
|
831
2096
|
<span class="cell cell--name" role="columnheader">{{ 'core.component.file-explorer.column.name' | sdTranslate }}</span>
|
|
832
2097
|
@if (!_compact) {
|
|
833
2098
|
<span class="cell cell--modified" role="columnheader">{{
|
|
@@ -835,37 +2100,105 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
835
2100
|
}}</span>
|
|
836
2101
|
}
|
|
837
2102
|
<span class="cell cell--size" role="columnheader">{{ 'core.component.file-explorer.column.size' | sdTranslate }}</span>
|
|
838
|
-
@
|
|
839
|
-
<span class="cell cell--
|
|
2103
|
+
@for (column of columns(); track column.id(); let index = $index) {
|
|
2104
|
+
<span class="cell cell--custom" role="columnheader" [style.grid-column]="5 + index">{{ column.title() }}</span>
|
|
2105
|
+
}
|
|
2106
|
+
@if (_actionColumn) {
|
|
2107
|
+
<span class="cell cell--action" role="columnheader" [style.grid-column]="5 + columns().length"></span>
|
|
840
2108
|
}
|
|
841
2109
|
</div>
|
|
842
2110
|
</div>
|
|
843
2111
|
<div role="rowgroup">
|
|
844
|
-
@for (
|
|
2112
|
+
@for (row of _rows; track row.view.item.id; let rowIndex = $index) {
|
|
2113
|
+
@let view = row.view;
|
|
845
2114
|
<div
|
|
846
2115
|
class="row"
|
|
847
2116
|
role="row"
|
|
848
2117
|
tabindex="0"
|
|
849
2118
|
[class.row--active]="view.item.id === _activeId"
|
|
2119
|
+
[class.row--selected]="row.selected"
|
|
2120
|
+
[class.row--commands]="!!row.commands"
|
|
2121
|
+
[class.row--movable]="canMove() && view.item.kind === 'file'"
|
|
850
2122
|
[attr.data-item-id]="view.item.id"
|
|
2123
|
+
[attr.data-move-target]="view.item.kind === 'folder' ? view.item.id : null"
|
|
2124
|
+
[class.move-drop-target]="view.item.kind === 'folder' && moveDropTarget() === view.item.id"
|
|
851
2125
|
[attr.data-autoid]="view.autoId"
|
|
852
|
-
(click)="
|
|
2126
|
+
(click)="onClick($event, view)"
|
|
853
2127
|
(keydown)="onKeydown($event, view)">
|
|
2128
|
+
@if (_selection) {
|
|
2129
|
+
<span class="cell cell--select" role="cell">
|
|
2130
|
+
@if (row.selectable) {
|
|
2131
|
+
<mat-checkbox
|
|
2132
|
+
class="select"
|
|
2133
|
+
color="primary"
|
|
2134
|
+
[checked]="row.selected"
|
|
2135
|
+
[disabled]="row.selectDisabled"
|
|
2136
|
+
[aria-label]="view.selectLabel"
|
|
2137
|
+
[attr.data-autoid]="view.autoId ? view.autoId + '-select' : null"
|
|
2138
|
+
(change)="toggleSelect.emit(view.item)" />
|
|
2139
|
+
}
|
|
2140
|
+
</span>
|
|
2141
|
+
}
|
|
854
2142
|
<span class="cell cell--name" role="cell">
|
|
855
2143
|
<sd-file-explorer-file-icon [icon]="view.icon" [size]="32" />
|
|
856
|
-
<span class="name" [title]="view.item.name">{{ view.item.name }}</span>
|
|
2144
|
+
<span class="name" [draggable]="canMove() && view.item.kind === 'file'" [title]="view.item.name">{{ view.item.name }}</span>
|
|
2145
|
+
@if (view.item.kind === 'folder' && moveDropTarget() === view.item.id) {
|
|
2146
|
+
<span class="move-drop-label">{{ 'core.component.file-explorer.move.confirm' | sdTranslate }}</span>
|
|
2147
|
+
}
|
|
2148
|
+
@if (canMove() && view.item.kind === 'file') {
|
|
2149
|
+
<sd-button
|
|
2150
|
+
htmlType="button"
|
|
2151
|
+
class="move-file-button commands"
|
|
2152
|
+
type="text"
|
|
2153
|
+
color="secondary"
|
|
2154
|
+
size="sm"
|
|
2155
|
+
prefixIcon="drive_file_move"
|
|
2156
|
+
[disabled]="movePending()"
|
|
2157
|
+
[tooltip]="('core.component.file-explorer.move.to' | sdTranslate) + ': ' + view.item.name"
|
|
2158
|
+
(click)="$event.stopPropagation(); move.emit(view.item)"
|
|
2159
|
+
(keydown)="$event.stopPropagation()" />
|
|
2160
|
+
}
|
|
2161
|
+
@if (row.commands) {
|
|
2162
|
+
<sd-file-explorer-actions
|
|
2163
|
+
class="commands"
|
|
2164
|
+
[actions]="row.commands"
|
|
2165
|
+
[context]="view.item"
|
|
2166
|
+
[size]="_commandSize"
|
|
2167
|
+
[source]="row.source"
|
|
2168
|
+
[autoId]="view.autoId ? view.autoId + '-command' : undefined" />
|
|
2169
|
+
}
|
|
857
2170
|
</span>
|
|
858
2171
|
@if (!_compact) {
|
|
859
2172
|
<span class="cell cell--modified" role="cell" [title]="view.modifiedTitle">{{ view.modifiedLabel || '—' }}</span>
|
|
860
2173
|
}
|
|
861
2174
|
<span class="cell cell--size" role="cell">{{ view.sizeLabel || '—' }}</span>
|
|
862
|
-
@
|
|
2175
|
+
@for (column of columns(); track column.id(); let index = $index) {
|
|
2176
|
+
<span class="cell cell--custom" role="cell" [style.grid-column]="5 + index">
|
|
2177
|
+
<ng-container
|
|
2178
|
+
[ngTemplateOutlet]="column.template"
|
|
2179
|
+
[ngTemplateOutletContext]="{ $implicit: view.item, item: view.item, data: view.item.data, index: rowIndex }" />
|
|
2180
|
+
</span>
|
|
2181
|
+
}
|
|
2182
|
+
@if (_actionColumn) {
|
|
863
2183
|
<!-- why: sd-button already keeps its click from reaching the row; Enter/Space are stopped here so the key does not open the file too. -->
|
|
864
|
-
<span class="cell cell--action" role="cell">
|
|
865
|
-
@if (
|
|
2184
|
+
<span class="cell cell--action" role="cell" [style.grid-column]="5 + columns().length">
|
|
2185
|
+
@if (_compact) {
|
|
2186
|
+
@if (row.menu; as menu) {
|
|
2187
|
+
<sd-file-explorer-menu-trigger
|
|
2188
|
+
class="row-menu"
|
|
2189
|
+
[label]="view.actionsLabel"
|
|
2190
|
+
[busy]="menu.busy"
|
|
2191
|
+
[expanded]="view.item.id === _menuOpenId"
|
|
2192
|
+
[touch]="_touch"
|
|
2193
|
+
[autoId]="view.autoId ? view.autoId + '-commands' : undefined"
|
|
2194
|
+
(activate)="openCommands.emit({ item: view.item, trigger: $event })" />
|
|
2195
|
+
}
|
|
2196
|
+
} @else if (view.item.kind === 'file') {
|
|
866
2197
|
@if (_canShare) {
|
|
867
2198
|
<sd-button
|
|
868
2199
|
class="row-action row-share"
|
|
2200
|
+
[disabled]="view.shareDisabled ?? false"
|
|
2201
|
+
[attr.aria-description]="view.shareDisabled ? view.unavailableReason : null"
|
|
869
2202
|
type="text"
|
|
870
2203
|
color="secondary"
|
|
871
2204
|
size="sm"
|
|
@@ -879,6 +2212,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
879
2212
|
@if (_canDownload) {
|
|
880
2213
|
<sd-button
|
|
881
2214
|
class="row-action row-download"
|
|
2215
|
+
[disabled]="view.downloadDisabled ?? false"
|
|
2216
|
+
[attr.aria-description]="view.downloadDisabled ? view.unavailableReason : null"
|
|
882
2217
|
type="text"
|
|
883
2218
|
color="secondary"
|
|
884
2219
|
size="sm"
|
|
@@ -897,17 +2232,69 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
897
2232
|
</div>
|
|
898
2233
|
</div>
|
|
899
2234
|
} @else {
|
|
2235
|
+
@let _cardTop = !!_selection || hasCommands();
|
|
2236
|
+
@if (_selection) {
|
|
2237
|
+
<div class="grid-head">
|
|
2238
|
+
<mat-checkbox
|
|
2239
|
+
class="select-all"
|
|
2240
|
+
color="primary"
|
|
2241
|
+
[checked]="_selection.state === 'all'"
|
|
2242
|
+
[indeterminate]="_selection.state === 'some'"
|
|
2243
|
+
[disabled]="!_selection.eligibleCount"
|
|
2244
|
+
[aria-label]="_selection.allLabel"
|
|
2245
|
+
[matTooltip]="_selection.allLabel"
|
|
2246
|
+
[attr.data-autoid]="_selection.autoId ?? null"
|
|
2247
|
+
(change)="toggleSelectAll.emit()" />
|
|
2248
|
+
</div>
|
|
2249
|
+
}
|
|
900
2250
|
<ul class="grid" [attr.aria-label]="label()">
|
|
901
|
-
@for (
|
|
2251
|
+
@for (row of _rows; track row.view.item.id) {
|
|
2252
|
+
@let view = row.view;
|
|
902
2253
|
<li
|
|
903
2254
|
class="card"
|
|
904
2255
|
tabindex="0"
|
|
905
2256
|
[class.card--active]="view.item.id === _activeId"
|
|
2257
|
+
[class.card--selected]="row.selected"
|
|
906
2258
|
[attr.data-item-id]="view.item.id"
|
|
2259
|
+
[attr.data-move-target]="view.item.kind === 'folder' ? view.item.id : null"
|
|
2260
|
+
[class.move-drop-target]="view.item.kind === 'folder' && moveDropTarget() === view.item.id"
|
|
907
2261
|
[attr.data-autoid]="view.autoId"
|
|
908
2262
|
[attr.aria-label]="view.item.name + ', ' + view.typeLabel"
|
|
909
|
-
(click)="
|
|
2263
|
+
(click)="onClick($event, view)"
|
|
910
2264
|
(keydown)="onKeydown($event, view)">
|
|
2265
|
+
@if (_cardTop) {
|
|
2266
|
+
<span class="card-top">
|
|
2267
|
+
@if (row.selectable) {
|
|
2268
|
+
<mat-checkbox
|
|
2269
|
+
class="select"
|
|
2270
|
+
color="primary"
|
|
2271
|
+
[checked]="row.selected"
|
|
2272
|
+
[disabled]="row.selectDisabled"
|
|
2273
|
+
[aria-label]="view.selectLabel"
|
|
2274
|
+
[attr.data-autoid]="view.autoId ? view.autoId + '-select' : null"
|
|
2275
|
+
(change)="toggleSelect.emit(view.item)" />
|
|
2276
|
+
}
|
|
2277
|
+
@if (row.commands) {
|
|
2278
|
+
<sd-file-explorer-actions
|
|
2279
|
+
class="commands"
|
|
2280
|
+
[actions]="row.commands"
|
|
2281
|
+
[context]="view.item"
|
|
2282
|
+
[size]="_commandSize"
|
|
2283
|
+
[source]="row.source"
|
|
2284
|
+
[autoId]="view.autoId ? view.autoId + '-command' : undefined" />
|
|
2285
|
+
}
|
|
2286
|
+
@if (row.menu; as menu) {
|
|
2287
|
+
<sd-file-explorer-menu-trigger
|
|
2288
|
+
class="card-menu"
|
|
2289
|
+
[label]="view.actionsLabel"
|
|
2290
|
+
[busy]="menu.busy"
|
|
2291
|
+
[expanded]="view.item.id === _menuOpenId"
|
|
2292
|
+
[touch]="_touch"
|
|
2293
|
+
[autoId]="view.autoId ? view.autoId + '-commands' : undefined"
|
|
2294
|
+
(activate)="openCommands.emit({ item: view.item, trigger: $event })" />
|
|
2295
|
+
}
|
|
2296
|
+
</span>
|
|
2297
|
+
}
|
|
911
2298
|
<span class="thumb">
|
|
912
2299
|
@if (view.item.thumbnailUrl) {
|
|
913
2300
|
<img [src]="view.item.thumbnailUrl" alt="" loading="lazy" />
|
|
@@ -915,13 +2302,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
915
2302
|
<sd-file-explorer-file-icon [icon]="view.icon" [size]="48" />
|
|
916
2303
|
}
|
|
917
2304
|
</span>
|
|
918
|
-
<span class="card-name" [
|
|
2305
|
+
<span class="card-name" [draggable]="canMove() && view.item.kind === 'file'" [title]="view.item.name">{{
|
|
2306
|
+
view.item.name
|
|
2307
|
+
}}</span>
|
|
2308
|
+
@if (canMove() && view.item.kind === 'file') {
|
|
2309
|
+
<sd-button
|
|
2310
|
+
htmlType="button"
|
|
2311
|
+
class="move-file-button commands"
|
|
2312
|
+
type="text"
|
|
2313
|
+
color="secondary"
|
|
2314
|
+
size="sm"
|
|
2315
|
+
prefixIcon="drive_file_move"
|
|
2316
|
+
[disabled]="movePending()"
|
|
2317
|
+
[tooltip]="('core.component.file-explorer.move.to' | sdTranslate) + ': ' + view.item.name"
|
|
2318
|
+
(click)="$event.stopPropagation(); move.emit(view.item)"
|
|
2319
|
+
(keydown)="$event.stopPropagation()" />
|
|
2320
|
+
}
|
|
919
2321
|
</li>
|
|
920
2322
|
}
|
|
921
2323
|
</ul>
|
|
922
2324
|
}
|
|
923
|
-
`, styles: [":host{display:block}.list{width:100%}.row{display:grid;grid-template-columns:minmax(0,1fr) 128px 88px var(--sd-fe-actions-width,
|
|
924
|
-
}], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: true }] }], view: [{ type: i0.Input, args: [{ isSignal: true, alias: "view", required: false }] }], canDownload: [{ type: i0.Input, args: [{ isSignal: true, alias: "canDownload", required: false }] }], canShare: [{ type: i0.Input, args: [{ isSignal: true, alias: "canShare", required: false }] }], compact: [{ type: i0.Input, args: [{ isSignal: true, alias: "compact", required: false }] }], activeId: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeId", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], activate: [{ type: i0.Output, args: ["activate"] }], download: [{ type: i0.Output, args: ["download"] }], share: [{ type: i0.Output, args: ["share"] }] } });
|
|
2325
|
+
`, styles: [":host{display:block}.list{width:100%}.row{display:grid;grid-template-columns:var(--sd-fe-select-col, 0px) minmax(0,1fr) var(--sd-fe-modified-col, 128px) var(--sd-fe-size-col, 88px) var(--sd-fe-custom-cols, ) var(--sd-fe-actions-width, 0px);align-items:center;min-height:62px;border-bottom:1px solid var(--sd-fe-border);color:var(--sd-fe-text);font-size:var(--sd-font-size-15, 15px);cursor:pointer;outline:none;transition:background-color var(--sd-duration-fast, .12s) ease}.row:hover{background:var(--sd-fe-hover)}.row:focus-visible{box-shadow:inset 0 0 0 2px var(--sd-fe-accent)}.list--selectable{--sd-fe-select-col: 44px}.list--custom{min-width:max-content}.list--custom .cell--name{min-width:180px}.cell--select{grid-column:1}.cell--name{grid-column:2}.cell--modified{grid-column:3}.cell--size{grid-column:4}.cell--action{grid-column:5}.row--head{min-height:34px;color:var(--sd-fe-text-secondary);font-size:var(--sd-font-size-13, 13px);cursor:default}.row--head:hover{background:transparent}.row--active,.row--selected,.row--active:hover,.row--selected:hover{background:var(--sd-fe-accent-soft)}.cell{min-width:0;padding:0 8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cell--name{display:flex;align-items:center;gap:16px}.row:not(.row--head) .cell--modified,.row:not(.row--head) .cell--size{color:var(--sd-fe-text-secondary);font-size:var(--sd-font-size-13, 13px)}.cell--action{display:flex;align-items:center;justify-content:flex-end;gap:2px;padding:0 4px 0 0;overflow:visible}.name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.row--movable .cell--name{flex-wrap:wrap;row-gap:16px;padding-block:8px;overflow:visible}.row--movable .name{flex:1 1 4.5rem}.cell--select{display:flex;align-items:center;justify-content:center;padding:0;overflow:visible}.row--commands .cell--name{flex-wrap:wrap;row-gap:4px;padding-block:8px;overflow:visible}.row--commands .name{flex:1 1 4.5rem}.commands,.card-menu{margin-inline-start:auto}.commands{opacity:0}.row:hover .commands,.row:focus-within .commands,.card:hover .commands,.card:focus-within .commands,.commands.sd-file-explorer-actions--open,.commands.sd-file-explorer-actions--busy,:host(.sd-file-explorer-item-list--touch) .commands{opacity:1}:host(.sd-file-explorer-item-list--compact){--sd-fe-modified-col: 0px;--sd-fe-size-col: 66px}:host(.sd-file-explorer-item-list--compact) .row{min-height:55px;font-size:var(--sd-font-size-14, 14px)}:host(.sd-file-explorer-item-list--compact) .row--head{min-height:30px;font-size:var(--sd-font-size-12, 12px)}:host(.sd-file-explorer-item-list--compact) .cell--name{gap:12px}:host(.sd-file-explorer-item-list--compact) .cell{padding:0 4px}:host(.sd-file-explorer-item-list--compact) .cell--action{padding:0}.grid{list-style:none;margin:0;padding:4px 0 0;display:grid;grid-template-columns:repeat(auto-fill,minmax(248px,1fr));gap:18px 20px}.card{display:flex;flex-direction:column;gap:12px;min-width:0;padding:12px 12px 14px;border:1px solid var(--sd-fe-border);border-radius:var(--sd-radius-12, 12px);background:var(--sd-fe-surface);color:var(--sd-fe-text);cursor:pointer;outline:none;transition:border-color var(--sd-duration-fast, .12s) ease,box-shadow var(--sd-duration-fast, .12s) ease}.card:hover{border-color:var(--sd-fe-border-strong);box-shadow:0 2px 8px #0f172a0f}.card:focus-visible{box-shadow:0 0 0 2px var(--sd-fe-accent)}.card--active{border-color:var(--sd-fe-accent)}.card--selected{border-color:var(--sd-fe-accent);background:var(--sd-fe-accent-soft)}.card-top{display:flex;flex-wrap:wrap;align-items:center;gap:4px;min-height:40px;margin-block:-4px}.grid-head{display:flex;align-items:center;margin-bottom:12px;padding:0 0 4px 13px;border-bottom:1px solid var(--sd-fe-border)}.thumb{display:flex;align-items:center;justify-content:center;height:104px;overflow:hidden;border-radius:var(--sd-radius-8, 8px);background:var(--sd-fe-muted-surface)}.thumb img{width:100%;height:100%;object-fit:cover}.card-name{padding:0 2px;overflow:hidden;font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-semibold, 600);text-overflow:ellipsis;white-space:nowrap}:host(.sd-file-explorer-item-list--compact) .grid{grid-template-columns:repeat(auto-fill,minmax(148px,1fr));gap:12px}@media(prefers-reduced-motion:reduce){.row,.card{transition:none}}.move-file-button{flex-shrink:0}.move-drop-target{outline:2px solid var(--sd-fe-accent);outline-offset:-2px}.move-drop-label{color:var(--sd-fe-text);font-weight:600}\n"] }]
|
|
2326
|
+
}], propDecorators: { canMove: [{ type: i0.Input, args: [{ isSignal: true, alias: "canMove", required: false }] }], moveDropTarget: [{ type: i0.Input, args: [{ isSignal: true, alias: "moveDropTarget", required: false }] }], movePending: [{ type: i0.Input, args: [{ isSignal: true, alias: "movePending", required: false }] }], move: [{ type: i0.Output, args: ["move"] }], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }], items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: true }] }], view: [{ type: i0.Input, args: [{ isSignal: true, alias: "view", required: false }] }], canDownload: [{ type: i0.Input, args: [{ isSignal: true, alias: "canDownload", required: false }] }], canShare: [{ type: i0.Input, args: [{ isSignal: true, alias: "canShare", required: false }] }], compact: [{ type: i0.Input, args: [{ isSignal: true, alias: "compact", required: false }] }], touch: [{ type: i0.Input, args: [{ isSignal: true, alias: "touch", required: false }] }], activeId: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeId", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], selection: [{ type: i0.Input, args: [{ isSignal: true, alias: "selection", required: false }] }], fileCommands: [{ type: i0.Input, args: [{ isSignal: true, alias: "fileCommands", required: false }] }], folderCommands: [{ type: i0.Input, args: [{ isSignal: true, alias: "folderCommands", required: false }] }], menuOpenId: [{ type: i0.Input, args: [{ isSignal: true, alias: "menuOpenId", required: false }] }], activate: [{ type: i0.Output, args: ["activate"] }], openCommands: [{ type: i0.Output, args: ["openCommands"] }], download: [{ type: i0.Output, args: ["download"] }], share: [{ type: i0.Output, args: ["share"] }], toggleSelect: [{ type: i0.Output, args: ["toggleSelect"] }], toggleSelectAll: [{ type: i0.Output, args: ["toggleSelectAll"] }] } });
|
|
925
2327
|
|
|
926
2328
|
/**
|
|
927
2329
|
* File detail of the explorer (internal): an `<sd-side-drawer>` opened in the explorer's item area (right of the
|
|
@@ -951,6 +2353,9 @@ class SdFileExplorerPreviewPanel {
|
|
|
951
2353
|
/** Show the share button. */
|
|
952
2354
|
canShare = input(false, /* @ts-ignore */
|
|
953
2355
|
...(ngDevMode ? [{ debugName: "canShare" }] : /* istanbul ignore next */ []));
|
|
2356
|
+
/** Matches the explorer's narrow layout; footer buttons retain Core's 48 px touch span. */
|
|
2357
|
+
compact = input(false, /* @ts-ignore */
|
|
2358
|
+
...(ngDevMode ? [{ debugName: "compact" }] : /* istanbul ignore next */ []));
|
|
954
2359
|
/** Element the drawer opens inside: the explorer's item area, right of the folder tree. */
|
|
955
2360
|
container = input(null, /* @ts-ignore */
|
|
956
2361
|
...(ngDevMode ? [{ debugName: "container" }] : /* istanbul ignore next */ []));
|
|
@@ -1052,7 +2457,7 @@ class SdFileExplorerPreviewPanel {
|
|
|
1052
2457
|
}
|
|
1053
2458
|
}
|
|
1054
2459
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdFileExplorerPreviewPanel, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1055
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdFileExplorerPreviewPanel, isStandalone: true, selector: "sd-file-explorer-preview-panel", inputs: { view: { classPropertyName: "view", publicName: "view", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: true, transformFunction: null }, meta: { classPropertyName: "meta", publicName: "meta", isSignal: true, isRequired: false, transformFunction: null }, canDownload: { classPropertyName: "canDownload", publicName: "canDownload", isSignal: true, isRequired: false, transformFunction: null }, canShare: { classPropertyName: "canShare", publicName: "canShare", isSignal: true, isRequired: false, transformFunction: null }, container: { classPropertyName: "container", publicName: "container", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { close: "close", download: "download", share: "share", retry: "retry", imageError: "imageError" }, host: { classAttribute: "sd-file-explorer-preview-panel" }, viewQueries: [{ propertyName: "drawer", first: true, predicate: SdSideDrawer, descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
2460
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdFileExplorerPreviewPanel, isStandalone: true, selector: "sd-file-explorer-preview-panel", inputs: { view: { classPropertyName: "view", publicName: "view", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: true, transformFunction: null }, meta: { classPropertyName: "meta", publicName: "meta", isSignal: true, isRequired: false, transformFunction: null }, canDownload: { classPropertyName: "canDownload", publicName: "canDownload", isSignal: true, isRequired: false, transformFunction: null }, canShare: { classPropertyName: "canShare", publicName: "canShare", isSignal: true, isRequired: false, transformFunction: null }, compact: { classPropertyName: "compact", publicName: "compact", isSignal: true, isRequired: false, transformFunction: null }, container: { classPropertyName: "container", publicName: "container", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { close: "close", download: "download", share: "share", retry: "retry", imageError: "imageError" }, host: { classAttribute: "sd-file-explorer-preview-panel" }, viewQueries: [{ propertyName: "drawer", first: true, predicate: SdSideDrawer, descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
1056
2461
|
@let _view = view();
|
|
1057
2462
|
@let _state = state();
|
|
1058
2463
|
@let _autoId = autoId();
|
|
@@ -1137,6 +2542,9 @@ class SdFileExplorerPreviewPanel {
|
|
|
1137
2542
|
<sd-button
|
|
1138
2543
|
sdFooterRight
|
|
1139
2544
|
class="share-button"
|
|
2545
|
+
[size]="compact() ? 'sm' : 'md'"
|
|
2546
|
+
[disabled]="_view?.shareDisabled ?? false"
|
|
2547
|
+
[attr.aria-description]="_view?.shareDisabled ? _view?.unavailableReason : null"
|
|
1140
2548
|
[type]="_canDownload ? 'outline' : 'fill'"
|
|
1141
2549
|
[color]="_canDownload ? 'secondary' : 'primary'"
|
|
1142
2550
|
prefixIcon="share"
|
|
@@ -1148,6 +2556,9 @@ class SdFileExplorerPreviewPanel {
|
|
|
1148
2556
|
<sd-button
|
|
1149
2557
|
sdFooterRight
|
|
1150
2558
|
class="download-button"
|
|
2559
|
+
[size]="compact() ? 'sm' : 'md'"
|
|
2560
|
+
[disabled]="_view?.downloadDisabled ?? false"
|
|
2561
|
+
[attr.aria-description]="_view?.downloadDisabled ? _view?.unavailableReason : null"
|
|
1151
2562
|
type="fill"
|
|
1152
2563
|
color="primary"
|
|
1153
2564
|
prefixIcon="file_download"
|
|
@@ -1171,7 +2582,7 @@ class SdFileExplorerPreviewPanel {
|
|
|
1171
2582
|
</div>
|
|
1172
2583
|
}
|
|
1173
2584
|
</ng-template>
|
|
1174
|
-
`, isInline: true, styles: [":host{display:none}.detail{display:flex;flex-direction:column;height:100%}.stage{display:flex;flex:0 1 216px;align-items:center;justify-content:center;min-height:140px;padding:14px;overflow:hidden;border-radius:var(--sd-radius-12, 12px);background:var(--sd-fe-preview-bg)}.stage--pdf{flex-basis:380px;min-height:240px;padding:0;background:var(--sd-fe-muted-surface)}.stage--pdf>*{width:100%;height:100%;min-height:0}.stage--video{flex:none;min-height:216px;padding:0;background:var(--sd-fe-muted-surface)}.stage--video>*{width:100%}.image{display:block;max-width:100%;max-height:100%;border-radius:var(--sd-radius-6, 6px);object-fit:contain}.placeholder{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:16px;text-align:center;color:var(--sd-fe-text-secondary)}.placeholder--error{color:var(--sd-fe-error)}.placeholder--error sd-button{margin-top:4px}.placeholder-title{margin:4px 0 0;color:var(--sd-fe-text);font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-semibold, 600)}.placeholder-hint{margin:0;font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-18, 18px);color:var(--sd-fe-text-secondary)}.spinner{width:28px;height:28px;border:3px solid color-mix(in srgb,var(--sd-fe-accent) 20%,transparent);border-top-color:var(--sd-fe-accent);border-radius:50%;animation:sd-file-explorer-preview-spin .8s linear infinite}.meta{flex:none;margin:20px 0 0;padding:4px 0 0;border-top:1px solid var(--sd-fe-border)}.meta-row{display:grid;grid-template-columns:84px minmax(0,1fr);align-items:baseline;gap:12px;padding:10px 0;font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-18, 18px)}.meta-row dt{color:var(--sd-fe-text-secondary)}.meta-row dd{margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}@keyframes sd-file-explorer-preview-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.spinner{animation-duration:2.4s}}\n"], dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "openOnHover", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "component", type: SdSideDrawer, selector: "sd-side-drawer", inputs: ["title", "width", "hideClose", "disableBackdropClose", "beforeClose", "container", "drawerClass", "autoId"], outputs: ["sdClosed", "sdCloseError"] }, { kind: "component", type: SdFileExplorerFileIcon, selector: "sd-file-explorer-file-icon", inputs: ["icon", "size"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2585
|
+
`, isInline: true, styles: [":host{display:none}.detail{display:flex;flex-direction:column;height:100%}.stage{display:flex;flex:0 1 216px;align-items:center;justify-content:center;min-height:140px;padding:14px;overflow:hidden;border-radius:var(--sd-radius-12, 12px);background:var(--sd-fe-preview-bg)}.stage--pdf{flex-basis:380px;min-height:240px;padding:0;background:var(--sd-fe-muted-surface)}.stage--pdf>*{width:100%;height:100%;min-height:0}.stage--video{flex:none;min-height:216px;padding:0;background:var(--sd-fe-muted-surface)}.stage--video>*{width:100%}.image{display:block;max-width:100%;max-height:100%;border-radius:var(--sd-radius-6, 6px);object-fit:contain}.placeholder{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:16px;text-align:center;color:var(--sd-fe-text-secondary)}.placeholder--error{color:var(--sd-fe-error)}.placeholder--error sd-button{margin-top:4px}.placeholder-title{margin:4px 0 0;color:var(--sd-fe-text);font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-semibold, 600)}.placeholder-hint{margin:0;font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-18, 18px);color:var(--sd-fe-text-secondary)}.spinner{width:28px;height:28px;border:3px solid color-mix(in srgb,var(--sd-fe-accent) 20%,transparent);border-top-color:var(--sd-fe-accent);border-radius:50%;animation:sd-file-explorer-preview-spin .8s linear infinite}.meta{flex:none;margin:20px 0 0;padding:4px 0 0;border-top:1px solid var(--sd-fe-border)}.meta-row{display:grid;grid-template-columns:84px minmax(0,1fr);align-items:baseline;gap:12px;padding:10px 0;font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-18, 18px)}.meta-row dt{color:var(--sd-fe-text-secondary)}.meta-row dd{margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}@keyframes sd-file-explorer-preview-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.spinner{animation-duration:2.4s}}\n"], dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "openOnHover", "loading", "block", "htmlType", "indicator", "indicatorColor", "indicatorMax", "indicatorLabel"], outputs: ["click"] }, { kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "component", type: SdSideDrawer, selector: "sd-side-drawer", inputs: ["title", "width", "hideClose", "disableBackdropClose", "beforeClose", "container", "drawerClass", "autoId"], outputs: ["sdClosed", "sdCloseError"] }, { kind: "component", type: SdFileExplorerFileIcon, selector: "sd-file-explorer-file-icon", inputs: ["icon", "size"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1175
2586
|
}
|
|
1176
2587
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdFileExplorerPreviewPanel, decorators: [{
|
|
1177
2588
|
type: Component,
|
|
@@ -1262,6 +2673,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
1262
2673
|
<sd-button
|
|
1263
2674
|
sdFooterRight
|
|
1264
2675
|
class="share-button"
|
|
2676
|
+
[size]="compact() ? 'sm' : 'md'"
|
|
2677
|
+
[disabled]="_view?.shareDisabled ?? false"
|
|
2678
|
+
[attr.aria-description]="_view?.shareDisabled ? _view?.unavailableReason : null"
|
|
1265
2679
|
[type]="_canDownload ? 'outline' : 'fill'"
|
|
1266
2680
|
[color]="_canDownload ? 'secondary' : 'primary'"
|
|
1267
2681
|
prefixIcon="share"
|
|
@@ -1273,6 +2687,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
1273
2687
|
<sd-button
|
|
1274
2688
|
sdFooterRight
|
|
1275
2689
|
class="download-button"
|
|
2690
|
+
[size]="compact() ? 'sm' : 'md'"
|
|
2691
|
+
[disabled]="_view?.downloadDisabled ?? false"
|
|
2692
|
+
[attr.aria-description]="_view?.downloadDisabled ? _view?.unavailableReason : null"
|
|
1276
2693
|
type="fill"
|
|
1277
2694
|
color="primary"
|
|
1278
2695
|
prefixIcon="file_download"
|
|
@@ -1297,7 +2714,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
1297
2714
|
}
|
|
1298
2715
|
</ng-template>
|
|
1299
2716
|
`, styles: [":host{display:none}.detail{display:flex;flex-direction:column;height:100%}.stage{display:flex;flex:0 1 216px;align-items:center;justify-content:center;min-height:140px;padding:14px;overflow:hidden;border-radius:var(--sd-radius-12, 12px);background:var(--sd-fe-preview-bg)}.stage--pdf{flex-basis:380px;min-height:240px;padding:0;background:var(--sd-fe-muted-surface)}.stage--pdf>*{width:100%;height:100%;min-height:0}.stage--video{flex:none;min-height:216px;padding:0;background:var(--sd-fe-muted-surface)}.stage--video>*{width:100%}.image{display:block;max-width:100%;max-height:100%;border-radius:var(--sd-radius-6, 6px);object-fit:contain}.placeholder{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:16px;text-align:center;color:var(--sd-fe-text-secondary)}.placeholder--error{color:var(--sd-fe-error)}.placeholder--error sd-button{margin-top:4px}.placeholder-title{margin:4px 0 0;color:var(--sd-fe-text);font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-semibold, 600)}.placeholder-hint{margin:0;font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-18, 18px);color:var(--sd-fe-text-secondary)}.spinner{width:28px;height:28px;border:3px solid color-mix(in srgb,var(--sd-fe-accent) 20%,transparent);border-top-color:var(--sd-fe-accent);border-radius:50%;animation:sd-file-explorer-preview-spin .8s linear infinite}.meta{flex:none;margin:20px 0 0;padding:4px 0 0;border-top:1px solid var(--sd-fe-border)}.meta-row{display:grid;grid-template-columns:84px minmax(0,1fr);align-items:baseline;gap:12px;padding:10px 0;font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-18, 18px)}.meta-row dt{color:var(--sd-fe-text-secondary)}.meta-row dd{margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}@keyframes sd-file-explorer-preview-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.spinner{animation-duration:2.4s}}\n"] }]
|
|
1300
|
-
}], ctorParameters: () => [], propDecorators: { view: [{ type: i0.Input, args: [{ isSignal: true, alias: "view", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: true }] }], meta: [{ type: i0.Input, args: [{ isSignal: true, alias: "meta", required: false }] }], canDownload: [{ type: i0.Input, args: [{ isSignal: true, alias: "canDownload", required: false }] }], canShare: [{ type: i0.Input, args: [{ isSignal: true, alias: "canShare", required: false }] }], container: [{ type: i0.Input, args: [{ isSignal: true, alias: "container", required: false }] }], autoId: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], close: [{ type: i0.Output, args: ["close"] }], download: [{ type: i0.Output, args: ["download"] }], share: [{ type: i0.Output, args: ["share"] }], retry: [{ type: i0.Output, args: ["retry"] }], imageError: [{ type: i0.Output, args: ["imageError"] }], drawer: [{ type: i0.ViewChild, args: [i0.forwardRef(() => SdSideDrawer), { isSignal: true }] }] } });
|
|
2717
|
+
}], ctorParameters: () => [], propDecorators: { view: [{ type: i0.Input, args: [{ isSignal: true, alias: "view", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: true }] }], meta: [{ type: i0.Input, args: [{ isSignal: true, alias: "meta", required: false }] }], canDownload: [{ type: i0.Input, args: [{ isSignal: true, alias: "canDownload", required: false }] }], canShare: [{ type: i0.Input, args: [{ isSignal: true, alias: "canShare", required: false }] }], compact: [{ type: i0.Input, args: [{ isSignal: true, alias: "compact", required: false }] }], container: [{ type: i0.Input, args: [{ isSignal: true, alias: "container", required: false }] }], autoId: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], close: [{ type: i0.Output, args: ["close"] }], download: [{ type: i0.Output, args: ["download"] }], share: [{ type: i0.Output, args: ["share"] }], retry: [{ type: i0.Output, args: ["retry"] }], imageError: [{ type: i0.Output, args: ["imageError"] }], drawer: [{ type: i0.ViewChild, args: [i0.forwardRef(() => SdSideDrawer), { isSignal: true }] }] } });
|
|
1301
2718
|
|
|
1302
2719
|
let nextTransferPanelId = 0;
|
|
1303
2720
|
/**
|
|
@@ -1437,7 +2854,7 @@ class SdFileExplorerTransferPanel {
|
|
|
1437
2854
|
}
|
|
1438
2855
|
</ul>
|
|
1439
2856
|
</section>
|
|
1440
|
-
`, isInline: true, styles: [":host{display:block}.panel{padding:12px 20px 18px}:host(.sd-file-explorer-transfer-panel--compact) .panel{padding:10px 14px 14px}.head{display:flex;align-items:center;gap:10px;min-height:32px}.head-icon{flex:none;width:22px;height:22px;color:var(--sd-fe-accent)}.title{flex:1;min-width:0;margin:0;overflow:hidden;font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-semibold, 600);line-height:var(--sd-line-height-22, 22px);color:var(--sd-fe-text);text-overflow:ellipsis;white-space:nowrap}.cards{list-style:none;margin:12px 0 0;padding:0;display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,320px),1fr));gap:12px 20px;max-height:188px;overflow-y:auto}.cards[hidden]{display:none}.card{display:flex;flex-direction:column;gap:11px;min-width:0;padding:12px 14px;border:1px solid var(--sd-fe-border);border-radius:var(--sd-radius-10, 10px);background:var(--sd-fe-surface)}.card-row{display:flex;align-items:center;gap:10px;min-height:22px}.direction{flex:none;color:var(--sd-fe-accent)}.name{flex:1;min-width:0;overflow:hidden;font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-semibold, 600);color:var(--sd-fe-text);text-overflow:ellipsis;white-space:nowrap}.status{flex:none;font-size:var(--sd-font-size-13, 13px);color:var(--sd-fe-text-secondary);font-variant-numeric:tabular-nums}.bar{position:relative;height:6px;overflow:hidden;border-radius:var(--sd-radius-999, 999px);background:var(--sd-fe-track)}.bar-fill{position:absolute;inset:0 auto 0 0;border-radius:inherit;background:var(--sd-fe-accent);transition:width var(--sd-duration-base, .2s) ease}.bar--indeterminate .bar-fill{width:36%!important;animation:sd-file-explorer-indeterminate 1.3s ease-in-out infinite}.card--success .bar-fill{background:var(--sd-fe-success)}.card--error{border-color:color-mix(in srgb,var(--sd-fe-error) 35%,var(--sd-fe-border))}.card--error .bar-fill{background:var(--sd-fe-error)}.card--error .status{color:var(--sd-fe-error);font-weight:var(--sd-font-weight-semibold, 600)}.card--muted .bar-fill{background:var(--sd-fe-border-strong)}.error{margin:-4px 0 0;overflow:hidden;font-size:var(--sd-font-size-12, 12px);color:var(--sd-fe-error);text-overflow:ellipsis;white-space:nowrap}.icon-button{flex:none;display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border:0;border-radius:var(--sd-radius-999, 999px);background:transparent;color:var(--sd-fe-text-secondary);cursor:pointer}.icon-button:hover{background:var(--sd-fe-hover-strong);color:var(--sd-fe-text)}.icon-button:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-file-explorer-accent, var(--sd-focus-ring-color, var(--sd-primary)));outline-offset:1px}.card-action{flex:none;margin:-5px -6px -5px -2px}.clear-button{flex:none}@keyframes sd-file-explorer-indeterminate{0%{left:-36%}to{left:100%}}@media(prefers-reduced-motion:reduce){.bar--indeterminate .bar-fill{animation-duration:3s}.bar-fill{transition:none}}\n"], dependencies: [{ kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "openOnHover", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2857
|
+
`, isInline: true, styles: [":host{display:block}.panel{padding:12px 20px 18px}:host(.sd-file-explorer-transfer-panel--compact) .panel{padding:10px 14px 14px}.head{display:flex;align-items:center;gap:10px;min-height:32px}.head-icon{flex:none;width:22px;height:22px;color:var(--sd-fe-accent)}.title{flex:1;min-width:0;margin:0;overflow:hidden;font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-semibold, 600);line-height:var(--sd-line-height-22, 22px);color:var(--sd-fe-text);text-overflow:ellipsis;white-space:nowrap}.cards{list-style:none;margin:12px 0 0;padding:0;display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,320px),1fr));gap:12px 20px;max-height:188px;overflow-y:auto}.cards[hidden]{display:none}.card{display:flex;flex-direction:column;gap:11px;min-width:0;padding:12px 14px;border:1px solid var(--sd-fe-border);border-radius:var(--sd-radius-10, 10px);background:var(--sd-fe-surface)}.card-row{display:flex;align-items:center;gap:10px;min-height:22px}.direction{flex:none;color:var(--sd-fe-accent)}.name{flex:1;min-width:0;overflow:hidden;font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-semibold, 600);color:var(--sd-fe-text);text-overflow:ellipsis;white-space:nowrap}.status{flex:none;font-size:var(--sd-font-size-13, 13px);color:var(--sd-fe-text-secondary);font-variant-numeric:tabular-nums}.bar{position:relative;height:6px;overflow:hidden;border-radius:var(--sd-radius-999, 999px);background:var(--sd-fe-track)}.bar-fill{position:absolute;inset:0 auto 0 0;border-radius:inherit;background:var(--sd-fe-accent);transition:width var(--sd-duration-base, .2s) ease}.bar--indeterminate .bar-fill{width:36%!important;animation:sd-file-explorer-indeterminate 1.3s ease-in-out infinite}.card--success .bar-fill{background:var(--sd-fe-success)}.card--error{border-color:color-mix(in srgb,var(--sd-fe-error) 35%,var(--sd-fe-border))}.card--error .bar-fill{background:var(--sd-fe-error)}.card--error .status{color:var(--sd-fe-error);font-weight:var(--sd-font-weight-semibold, 600)}.card--muted .bar-fill{background:var(--sd-fe-border-strong)}.error{margin:-4px 0 0;overflow:hidden;font-size:var(--sd-font-size-12, 12px);color:var(--sd-fe-error);text-overflow:ellipsis;white-space:nowrap}.icon-button{flex:none;display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border:0;border-radius:var(--sd-radius-999, 999px);background:transparent;color:var(--sd-fe-text-secondary);cursor:pointer}.icon-button:hover{background:var(--sd-fe-hover-strong);color:var(--sd-fe-text)}.icon-button:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-file-explorer-accent, var(--sd-focus-ring-color, var(--sd-primary)));outline-offset:1px}.card-action{flex:none;margin:-5px -6px -5px -2px}.clear-button{flex:none}@keyframes sd-file-explorer-indeterminate{0%{left:-36%}to{left:100%}}@media(prefers-reduced-motion:reduce){.bar--indeterminate .bar-fill{animation-duration:3s}.bar-fill{transition:none}}\n"], dependencies: [{ kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "openOnHover", "loading", "block", "htmlType", "indicator", "indicatorColor", "indicatorMax", "indicatorLabel"], outputs: ["click"] }, { kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1441
2858
|
}
|
|
1442
2859
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdFileExplorerTransferPanel, decorators: [{
|
|
1443
2860
|
type: Component,
|
|
@@ -1556,6 +2973,8 @@ const SEARCH_DEBOUNCE_MS = 300;
|
|
|
1556
2973
|
const MAX_PARALLEL_UPLOADS = 3;
|
|
1557
2974
|
/** Below this host width the explorer switches to the compact (mobile) layout. */
|
|
1558
2975
|
const COMPACT_MAX_WIDTH = 720;
|
|
2976
|
+
/** Primary pointer is a finger: commands stay visible and use 48 px targets. */
|
|
2977
|
+
const TOUCH_QUERY = '(pointer: coarse)';
|
|
1559
2978
|
/** How long a saved download's object URL stays alive before it is revoked. */
|
|
1560
2979
|
const DOWNLOAD_URL_TTL_MS = 40_000;
|
|
1561
2980
|
const ACTIVE_STATUSES = new Set(['queued', 'preparing', 'transferring']);
|
|
@@ -1565,7 +2984,7 @@ let nextExplorerId = 0;
|
|
|
1565
2984
|
* Google-Drive-like file browser: folder tree, breadcrumb, list / grid, search, file detail drawer, uploads with
|
|
1566
2985
|
* drag-and-drop, downloads and a transfer queue — all inside one element.
|
|
1567
2986
|
*
|
|
1568
|
-
* Storage-agnostic: every read and write goes through the callbacks of `SdFileExplorerOption
|
|
2987
|
+
* Storage-agnostic: every read and write goes through the callbacks of `SdFileExplorerOption<T>`.
|
|
1569
2988
|
*
|
|
1570
2989
|
* @example
|
|
1571
2990
|
* ```html
|
|
@@ -1573,14 +2992,65 @@ let nextExplorerId = 0;
|
|
|
1573
2992
|
* ```
|
|
1574
2993
|
*/
|
|
1575
2994
|
class SdFileExplorer {
|
|
2995
|
+
#moveDrag = new SdFileExplorerDragSession();
|
|
2996
|
+
#moveController = null;
|
|
2997
|
+
#moveRefreshFolders = [];
|
|
2998
|
+
#moveReturnFocus = null;
|
|
2999
|
+
#moveDragSelectionRequired = false;
|
|
3000
|
+
#movePickerSelectionRequired = false;
|
|
3001
|
+
movePending = signal(false, /* @ts-ignore */
|
|
3002
|
+
...(ngDevMode ? [{ debugName: "movePending" }] : /* istanbul ignore next */ []));
|
|
3003
|
+
moveStatus = signal('', /* @ts-ignore */
|
|
3004
|
+
...(ngDevMode ? [{ debugName: "moveStatus" }] : /* istanbul ignore next */ []));
|
|
3005
|
+
moveRefreshError = signal(false, /* @ts-ignore */
|
|
3006
|
+
...(ngDevMode ? [{ debugName: "moveRefreshError" }] : /* istanbul ignore next */ []));
|
|
3007
|
+
movePickerItems = signal(null, /* @ts-ignore */
|
|
3008
|
+
...(ngDevMode ? [{ debugName: "movePickerItems" }] : /* istanbul ignore next */ []));
|
|
3009
|
+
moveTarget = signal(null, /* @ts-ignore */
|
|
3010
|
+
...(ngDevMode ? [{ debugName: "moveTarget" }] : /* istanbul ignore next */ []));
|
|
3011
|
+
moveDropTarget = signal(undefined, /* @ts-ignore */
|
|
3012
|
+
...(ngDevMode ? [{ debugName: "moveDropTarget" }] : /* istanbul ignore next */ []));
|
|
3013
|
+
canMove = computed(() => typeof this.#config().move?.onMove === 'function', /* @ts-ignore */
|
|
3014
|
+
...(ngDevMode ? [{ debugName: "canMove" }] : /* istanbul ignore next */ []));
|
|
3015
|
+
movePickerNodes = computed(() => this.treeNodes().map(node => ({ ...node, selected: node.id === (this.moveTarget()?.id ?? null) })), /* @ts-ignore */
|
|
3016
|
+
...(ngDevMode ? [{ debugName: "movePickerNodes" }] : /* istanbul ignore next */ []));
|
|
3017
|
+
canSubmitMove = computed(() => {
|
|
3018
|
+
const items = this.movePickerItems();
|
|
3019
|
+
if (!items || this.movePending())
|
|
3020
|
+
return false;
|
|
3021
|
+
return this.#moveAllowed(items, this.moveTarget(), 'menu', new AbortController().signal, this.#movePickerSelectionRequired);
|
|
3022
|
+
}, /* @ts-ignore */
|
|
3023
|
+
...(ngDevMode ? [{ debugName: "canSubmitMove" }] : /* istanbul ignore next */ []));
|
|
3024
|
+
columnDefs = contentChildren(SdFileExplorerColumnDef, /* @ts-ignore */
|
|
3025
|
+
...(ngDevMode ? [{ debugName: "columnDefs" }] : /* istanbul ignore next */ []));
|
|
3026
|
+
#warnedColumns = new WeakSet();
|
|
3027
|
+
columns = computed(() => {
|
|
3028
|
+
const seen = new Set();
|
|
3029
|
+
return this.columnDefs().filter(column => {
|
|
3030
|
+
const id = column.id().trim();
|
|
3031
|
+
if (!id || seen.has(id)) {
|
|
3032
|
+
if (isDevMode() && !this.#warnedColumns.has(column)) {
|
|
3033
|
+
this.#warnedColumns.add(column);
|
|
3034
|
+
console.warn(`[sd-file-explorer] ignored empty or duplicate column id: ${id}`);
|
|
3035
|
+
}
|
|
3036
|
+
return false;
|
|
3037
|
+
}
|
|
3038
|
+
seen.add(id);
|
|
3039
|
+
return true;
|
|
3040
|
+
});
|
|
3041
|
+
}, /* @ts-ignore */
|
|
3042
|
+
...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
|
|
1576
3043
|
#i18n = inject(I18nService);
|
|
3044
|
+
#dateTime = inject(SdDateTimeService);
|
|
1577
3045
|
#host = inject(ElementRef);
|
|
1578
3046
|
#document = inject(DOCUMENT);
|
|
1579
3047
|
#injector = inject(Injector);
|
|
1580
3048
|
#zone = inject(NgZone);
|
|
1581
|
-
/** Data callbacks and display settings. See `SdFileExplorerOption
|
|
3049
|
+
/** Data callbacks and display settings. See `SdFileExplorerOption<T>`. */
|
|
1582
3050
|
option = input.required(/* @ts-ignore */
|
|
1583
3051
|
...(ngDevMode ? [{ debugName: "option" }] : /* istanbul ignore next */ []));
|
|
3052
|
+
#config = computed(() => sdFileExplorerNormalizeConfig(this.option()), /* @ts-ignore */
|
|
3053
|
+
...(ngDevMode ? [{ debugName: "#config" }] : /* istanbul ignore next */ []));
|
|
1584
3054
|
/**
|
|
1585
3055
|
* Emitted exactly once each time the user opens a file (click, `Enter` or `Space` on a file in the list,
|
|
1586
3056
|
* grid or search results), right before the detail drawer starts loading. Never emitted for folders.
|
|
@@ -1603,6 +3073,17 @@ class SdFileExplorer {
|
|
|
1603
3073
|
...(ngDevMode ? [{ debugName: "#transfers" }] : /* istanbul ignore next */ []));
|
|
1604
3074
|
#width = signal(0, /* @ts-ignore */
|
|
1605
3075
|
...(ngDevMode ? [{ debugName: "#width" }] : /* istanbul ignore next */ []));
|
|
3076
|
+
#touch = signal(false, /* @ts-ignore */
|
|
3077
|
+
...(ngDevMode ? [{ debugName: "#touch" }] : /* istanbul ignore next */ []));
|
|
3078
|
+
/**
|
|
3079
|
+
* Ids the user selected. Only those still visible and eligible count — see `selectedItems` — and the others are
|
|
3080
|
+
* forgotten once the view settles, so a file that leaves the view or gets disabled is never selected again by itself.
|
|
3081
|
+
*/
|
|
3082
|
+
#selectedIds = signal(new Set(), /* @ts-ignore */
|
|
3083
|
+
...(ngDevMode ? [{ debugName: "#selectedIds" }] : /* istanbul ignore next */ []));
|
|
3084
|
+
/** Item whose commands the compact drawer shows; `null` while it is closed. */
|
|
3085
|
+
#commandTarget = signal(null, /* @ts-ignore */
|
|
3086
|
+
...(ngDevMode ? [{ debugName: "#commandTarget" }] : /* istanbul ignore next */ []));
|
|
1606
3087
|
view = signal('list', /* @ts-ignore */
|
|
1607
3088
|
...(ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []));
|
|
1608
3089
|
keyword = signal('', /* @ts-ignore */
|
|
@@ -1651,6 +3132,8 @@ class SdFileExplorer {
|
|
|
1651
3132
|
...(ngDevMode ? [{ debugName: "shareDialog" }] : /* istanbul ignore next */ []));
|
|
1652
3133
|
sidebar = viewChild('sidebar', /* @ts-ignore */
|
|
1653
3134
|
...(ngDevMode ? [{ debugName: "sidebar" }] : /* istanbul ignore next */ []));
|
|
3135
|
+
commandDrawer = viewChild(SdFileExplorerCommandSheet, /* @ts-ignore */
|
|
3136
|
+
...(ngDevMode ? [{ debugName: "commandDrawer" }] : /* istanbul ignore next */ []));
|
|
1654
3137
|
// ---- Non-reactive bookkeeping ----
|
|
1655
3138
|
#listControllers = new Map();
|
|
1656
3139
|
#jobs = new Map();
|
|
@@ -1664,6 +3147,8 @@ class SdFileExplorer {
|
|
|
1664
3147
|
#previewObjectUrl = null;
|
|
1665
3148
|
#shareController = null;
|
|
1666
3149
|
#shareReturnFocus = null;
|
|
3150
|
+
/** Command pressed in the compact drawer, waiting for the drawer to finish closing; any context change drops it. */
|
|
3151
|
+
#pendingCommand = null;
|
|
1667
3152
|
#dragDepth = 0;
|
|
1668
3153
|
#listFn = null;
|
|
1669
3154
|
#resizeObserver = null;
|
|
@@ -1675,23 +3160,28 @@ class SdFileExplorer {
|
|
|
1675
3160
|
return width > 0 && width < COMPACT_MAX_WIDTH;
|
|
1676
3161
|
}, /* @ts-ignore */
|
|
1677
3162
|
...(ngDevMode ? [{ debugName: "compact" }] : /* istanbul ignore next */ []));
|
|
3163
|
+
touch = this.#touch.asReadonly();
|
|
1678
3164
|
autoId = computed(() => {
|
|
1679
|
-
const scope = this
|
|
3165
|
+
const scope = this.#config().autoId;
|
|
1680
3166
|
return scope ? `components-file-explorer-${scope}` : undefined;
|
|
1681
3167
|
}, /* @ts-ignore */
|
|
1682
3168
|
...(ngDevMode ? [{ debugName: "autoId" }] : /* istanbul ignore next */ []));
|
|
1683
3169
|
locale = this.#i18n.locale;
|
|
1684
|
-
rootLabel = computed(() => this
|
|
3170
|
+
rootLabel = computed(() => this.#config().rootLabel || this.#i18n.t('core.component.file-explorer.root'), /* @ts-ignore */
|
|
1685
3171
|
...(ngDevMode ? [{ debugName: "rootLabel" }] : /* istanbul ignore next */ []));
|
|
1686
|
-
canUpload = computed(() => typeof this
|
|
3172
|
+
canUpload = computed(() => typeof this.#config().upload === 'function', /* @ts-ignore */
|
|
1687
3173
|
...(ngDevMode ? [{ debugName: "canUpload" }] : /* istanbul ignore next */ []));
|
|
1688
|
-
canDownload = computed(() => typeof this
|
|
3174
|
+
canDownload = computed(() => typeof this.#config().download === 'function', /* @ts-ignore */
|
|
1689
3175
|
...(ngDevMode ? [{ debugName: "canDownload" }] : /* istanbul ignore next */ []));
|
|
1690
|
-
canCreateFolder = computed(() => typeof this
|
|
3176
|
+
canCreateFolder = computed(() => typeof this.#config().createFolder === 'function', /* @ts-ignore */
|
|
1691
3177
|
...(ngDevMode ? [{ debugName: "canCreateFolder" }] : /* istanbul ignore next */ []));
|
|
1692
|
-
canShare = computed(() => typeof this
|
|
3178
|
+
canShare = computed(() => typeof this.#config().share === 'function', /* @ts-ignore */
|
|
1693
3179
|
...(ngDevMode ? [{ debugName: "canShare" }] : /* istanbul ignore next */ []));
|
|
1694
|
-
|
|
3180
|
+
uploadDisabled = computed(() => this.movePending() || !sdFileExplorerEligible(this.#config().uploadable, { parentId: this.#currentId() }), /* @ts-ignore */
|
|
3181
|
+
...(ngDevMode ? [{ debugName: "uploadDisabled" }] : /* istanbul ignore next */ []));
|
|
3182
|
+
createDisabled = computed(() => this.movePending() || !sdFileExplorerEligible(this.#config().creatable, { parentId: this.#currentId() }), /* @ts-ignore */
|
|
3183
|
+
...(ngDevMode ? [{ debugName: "createDisabled" }] : /* istanbul ignore next */ []));
|
|
3184
|
+
#serverSearch = computed(() => typeof this.#config().search === 'function', /* @ts-ignore */
|
|
1695
3185
|
...(ngDevMode ? [{ debugName: "#serverSearch" }] : /* istanbul ignore next */ []));
|
|
1696
3186
|
currentName = computed(() => {
|
|
1697
3187
|
const path = this.#path();
|
|
@@ -1734,6 +3224,206 @@ class SdFileExplorer {
|
|
|
1734
3224
|
return sdFileExplorerFoldersFirst(this.#visibleItems()).map(format);
|
|
1735
3225
|
}, /* @ts-ignore */
|
|
1736
3226
|
...(ngDevMode ? [{ debugName: "itemViews" }] : /* istanbul ignore next */ []));
|
|
3227
|
+
// ---- Selection ----
|
|
3228
|
+
/** The row download / share shortcuts stay until the consumer declares `fileCommands` (even `[]`). */
|
|
3229
|
+
rowShortcuts = computed(() => this.#config().fileCommands == null, /* @ts-ignore */
|
|
3230
|
+
...(ngDevMode ? [{ debugName: "rowShortcuts" }] : /* istanbul ignore next */ []));
|
|
3231
|
+
#configuredSelector = computed(() => {
|
|
3232
|
+
const selector = this.#config().selector;
|
|
3233
|
+
return selector && selector.visible !== false ? selector : null;
|
|
3234
|
+
}, /* @ts-ignore */
|
|
3235
|
+
...(ngDevMode ? [{ debugName: "#configuredSelector" }] : /* istanbul ignore next */ []));
|
|
3236
|
+
#pickerSelection = computed(() => {
|
|
3237
|
+
const selector = this.#configuredSelector();
|
|
3238
|
+
return (!!selector &&
|
|
3239
|
+
(selector.mode === 'picker' ||
|
|
3240
|
+
(selector.mode === undefined && (typeof selector.onSelect === 'function' || typeof selector.onSelectAll === 'function'))));
|
|
3241
|
+
}, /* @ts-ignore */
|
|
3242
|
+
...(ngDevMode ? [{ debugName: "#pickerSelection" }] : /* istanbul ignore next */ []));
|
|
3243
|
+
/** Selection actions remain caller-owned when declared, including an intentional empty array. */
|
|
3244
|
+
selectionActions = computed(() => {
|
|
3245
|
+
const selector = this.#configuredSelector();
|
|
3246
|
+
if (!selector)
|
|
3247
|
+
return [];
|
|
3248
|
+
if (selector.actions !== undefined)
|
|
3249
|
+
return selector.actions ?? [];
|
|
3250
|
+
if (this.#pickerSelection())
|
|
3251
|
+
return [];
|
|
3252
|
+
const config = this.#config();
|
|
3253
|
+
const actions = [];
|
|
3254
|
+
if (typeof config.move?.onMove === 'function')
|
|
3255
|
+
actions.push({
|
|
3256
|
+
title: this.#i18n.t('core.component.file-explorer.move.to'),
|
|
3257
|
+
prefixIcon: 'drive_file_move',
|
|
3258
|
+
type: 'outline',
|
|
3259
|
+
disabled: () => this.movePending() || this.moveRefreshError(),
|
|
3260
|
+
onClick: items => this.openMovePicker(items),
|
|
3261
|
+
});
|
|
3262
|
+
if (typeof config.share === 'function')
|
|
3263
|
+
actions.push({
|
|
3264
|
+
title: this.#i18n.t('core.component.file-explorer.share'),
|
|
3265
|
+
prefixIcon: 'share',
|
|
3266
|
+
disabled: items => items.length !== 1 || !sdFileExplorerEligible(config.shareable, items[0]),
|
|
3267
|
+
onClick: items => {
|
|
3268
|
+
if (items.length === 1)
|
|
3269
|
+
this.openShare(items[0]);
|
|
3270
|
+
},
|
|
3271
|
+
});
|
|
3272
|
+
if (typeof config.download === 'function')
|
|
3273
|
+
actions.push({
|
|
3274
|
+
title: this.#i18n.t('core.component.file-explorer.download'),
|
|
3275
|
+
prefixIcon: 'file_download',
|
|
3276
|
+
disabled: items => !items.length || items.some(item => !sdFileExplorerEligible(config.downloadable, item)),
|
|
3277
|
+
onClick: items => {
|
|
3278
|
+
for (const item of items)
|
|
3279
|
+
this.downloadItem(item);
|
|
3280
|
+
},
|
|
3281
|
+
});
|
|
3282
|
+
return actions;
|
|
3283
|
+
}, /* @ts-ignore */
|
|
3284
|
+
...(ngDevMode ? [{ debugName: "selectionActions" }] : /* istanbul ignore next */ []));
|
|
3285
|
+
#selector = computed(() => {
|
|
3286
|
+
const selector = this.#configuredSelector();
|
|
3287
|
+
if (!selector || this.#pickerSelection())
|
|
3288
|
+
return selector;
|
|
3289
|
+
// Keep intermediate selections reachable even when actions are hidden until a particular combination is selected.
|
|
3290
|
+
return sdFileExplorerHasActionCapability(this.selectionActions()) ? selector : null;
|
|
3291
|
+
}, /* @ts-ignore */
|
|
3292
|
+
...(ngDevMode ? [{ debugName: "#selector" }] : /* istanbul ignore next */ []));
|
|
3293
|
+
/** Files of the current folder or search results, in display order. Folders are never selectable. */
|
|
3294
|
+
#visibleFiles = computed(() => this.#visibleItems().filter(item => item.kind === 'file'), /* @ts-ignore */
|
|
3295
|
+
...(ngDevMode ? [{ debugName: "#visibleFiles" }] : /* istanbul ignore next */ []));
|
|
3296
|
+
#selectionCandidates = computed(() => {
|
|
3297
|
+
const selector = this.#configuredSelector();
|
|
3298
|
+
if (!selector)
|
|
3299
|
+
return [];
|
|
3300
|
+
const disabled = selector.disabled;
|
|
3301
|
+
return disabled ? this.#visibleFiles().filter(item => !disabled(item)) : this.#visibleFiles();
|
|
3302
|
+
}, /* @ts-ignore */
|
|
3303
|
+
...(ngDevMode ? [{ debugName: "#selectionCandidates" }] : /* istanbul ignore next */ []));
|
|
3304
|
+
#eligibleFiles = computed(() => (this.#selector() ? this.#selectionCandidates() : []), /* @ts-ignore */
|
|
3305
|
+
...(ngDevMode ? [{ debugName: "#eligibleFiles" }] : /* istanbul ignore next */ []));
|
|
3306
|
+
/**
|
|
3307
|
+
* Frozen snapshot of the selection handed to callbacks and actions: selected files that are still visible and
|
|
3308
|
+
* eligible, in display order. A file that a refresh drops, or that becomes disabled, leaves it.
|
|
3309
|
+
*/
|
|
3310
|
+
selectedItems = computed(() => {
|
|
3311
|
+
const ids = this.#selectedIds();
|
|
3312
|
+
return Object.freeze(this.#eligibleFiles().filter(item => ids.has(item.id)));
|
|
3313
|
+
}, /* @ts-ignore */
|
|
3314
|
+
...(ngDevMode ? [{ debugName: "selectedItems" }] : /* istanbul ignore next */ []));
|
|
3315
|
+
/** Selection state of the item list; `null` (no checkbox, no band) without selector or without files in view. */
|
|
3316
|
+
selectionView = computed(() => {
|
|
3317
|
+
const files = this.#visibleFiles();
|
|
3318
|
+
if (!this.#selector() || !files.length)
|
|
3319
|
+
return null;
|
|
3320
|
+
const eligible = this.#eligibleFiles();
|
|
3321
|
+
const selected = this.selectedItems();
|
|
3322
|
+
const eligibleIds = new Set(eligible.map(item => item.id));
|
|
3323
|
+
const autoId = this.autoId();
|
|
3324
|
+
return {
|
|
3325
|
+
selectedIds: new Set(selected.map(item => item.id)),
|
|
3326
|
+
disabledIds: new Set(files.filter(item => !eligibleIds.has(item.id)).map(item => item.id)),
|
|
3327
|
+
state: !selected.length ? 'none' : selected.length === eligible.length ? 'all' : 'some',
|
|
3328
|
+
eligibleCount: eligible.length,
|
|
3329
|
+
allLabel: this.#i18n.t('core.component.file-explorer.selection.select-all', { count: eligible.length }),
|
|
3330
|
+
autoId: autoId ? `${autoId}-select-all` : undefined,
|
|
3331
|
+
};
|
|
3332
|
+
}, /* @ts-ignore */
|
|
3333
|
+
...(ngDevMode ? [{ debugName: "selectionView" }] : /* istanbul ignore next */ []));
|
|
3334
|
+
/**
|
|
3335
|
+
* Status sentence of the band, split around the number so the template can set it in semibold: "2 tệp đã chọn",
|
|
3336
|
+
* "已选择 2 个文件". Nothing selected: `count` is 0 and `before` holds the whole sentence.
|
|
3337
|
+
*/
|
|
3338
|
+
selectionSummary = computed(() => {
|
|
3339
|
+
const count = this.selectedItems().length;
|
|
3340
|
+
if (!count)
|
|
3341
|
+
return { count, before: this.#i18n.t('core.component.file-explorer.selection.none'), after: '' };
|
|
3342
|
+
// why: không truyền params thì I18nService giữ nguyên `{count}` — tách câu đã dịch tại đó, đúng vị trí của từng ngôn ngữ.
|
|
3343
|
+
const message = this.#i18n.t(`core.component.file-explorer.selection.${count === 1 ? 'selected-one' : 'selected'}`);
|
|
3344
|
+
const placeholder = '{count}';
|
|
3345
|
+
const at = message.indexOf(placeholder);
|
|
3346
|
+
if (at < 0)
|
|
3347
|
+
return { count, before: '', after: ` ${message}` };
|
|
3348
|
+
return { count, before: message.slice(0, at), after: message.slice(at + placeholder.length) };
|
|
3349
|
+
}, /* @ts-ignore */
|
|
3350
|
+
...(ngDevMode ? [{ debugName: "selectionSummary" }] : /* istanbul ignore next */ []));
|
|
3351
|
+
// ---- Compact command drawer ----
|
|
3352
|
+
// why: mỗi lối tắt là một computed riêng — định nghĩa giữ nguyên object khi chỉ lối tắt kia đổi, nên lần kiểm tra ngay
|
|
3353
|
+
// trước khi chạy lệnh (definition còn được khai không) không hủy nhầm "Chia sẻ" chỉ vì `download` vừa đổi.
|
|
3354
|
+
#shareShortcut = computed(() => this.canShare()
|
|
3355
|
+
? {
|
|
3356
|
+
title: this.#i18n.t('core.component.file-explorer.share'),
|
|
3357
|
+
prefixIcon: 'share',
|
|
3358
|
+
disabled: item => this.movePending() || !sdFileExplorerEligible(this.#config().shareable, item),
|
|
3359
|
+
click: item => this.openShare(item),
|
|
3360
|
+
}
|
|
3361
|
+
: null, /* @ts-ignore */
|
|
3362
|
+
...(ngDevMode ? [{ debugName: "#shareShortcut" }] : /* istanbul ignore next */ []));
|
|
3363
|
+
#downloadShortcut = computed(() => this.canDownload()
|
|
3364
|
+
? {
|
|
3365
|
+
title: this.#i18n.t('core.component.file-explorer.download'),
|
|
3366
|
+
prefixIcon: 'file_download',
|
|
3367
|
+
disabled: item => this.movePending() || !sdFileExplorerEligible(this.#config().downloadable, item),
|
|
3368
|
+
click: item => this.downloadItem(item),
|
|
3369
|
+
}
|
|
3370
|
+
: null, /* @ts-ignore */
|
|
3371
|
+
...(ngDevMode ? [{ debugName: "#downloadShortcut" }] : /* istanbul ignore next */ []));
|
|
3372
|
+
/** Row shortcuts as commands, for the drawer while `fileCommands` is undeclared: share, then download, as on the row. */
|
|
3373
|
+
#shortcuts = computed(() => {
|
|
3374
|
+
const commands = [];
|
|
3375
|
+
const keys = [];
|
|
3376
|
+
const share = this.#shareShortcut();
|
|
3377
|
+
const download = this.#downloadShortcut();
|
|
3378
|
+
if (share) {
|
|
3379
|
+
commands.push(share);
|
|
3380
|
+
keys.push('share');
|
|
3381
|
+
}
|
|
3382
|
+
if (download) {
|
|
3383
|
+
commands.push(download);
|
|
3384
|
+
keys.push('download');
|
|
3385
|
+
}
|
|
3386
|
+
return { commands, keys };
|
|
3387
|
+
}, /* @ts-ignore */
|
|
3388
|
+
...(ngDevMode ? [{ debugName: "#shortcuts" }] : /* istanbul ignore next */ []));
|
|
3389
|
+
/** Current version of the drawer's item — looked up by id in the list it was opened from; `null` once it is gone. */
|
|
3390
|
+
#commandItem = computed(() => {
|
|
3391
|
+
const target = this.#commandTarget();
|
|
3392
|
+
return target ? this.#findCommandItem(target.id, target.origin) : null;
|
|
3393
|
+
}, /* @ts-ignore */
|
|
3394
|
+
...(ngDevMode ? [{ debugName: "#commandItem" }] : /* istanbul ignore next */ []));
|
|
3395
|
+
/** Content of the drawer: the item's commands resolved for it now; `null` when nothing is left to show. */
|
|
3396
|
+
// why: kiểu tường minh như contentState — d.ts ổn định giữa các máy build.
|
|
3397
|
+
commandSheet = computed(() => {
|
|
3398
|
+
const target = this.#commandTarget();
|
|
3399
|
+
const item = this.#commandItem();
|
|
3400
|
+
if (!target || !item)
|
|
3401
|
+
return null;
|
|
3402
|
+
const definitions = this.#commandDefinitions(item, target.origin);
|
|
3403
|
+
const source = item.kind === 'folder' ? 'folderCommands' : 'fileCommands';
|
|
3404
|
+
const resolved = sdFileExplorerResolveActions(definitions, item, SD_FILE_EXPLORER_COMMAND_DEFAULTS, source);
|
|
3405
|
+
if (!resolved.length)
|
|
3406
|
+
return null;
|
|
3407
|
+
const shortcuts = this.#shortcuts();
|
|
3408
|
+
const view = this.#itemFormatter()(item);
|
|
3409
|
+
return {
|
|
3410
|
+
title: item.name,
|
|
3411
|
+
context: [view.typeLabel, view.sizeLabel].filter(Boolean).join(' · '),
|
|
3412
|
+
icon: view.icon,
|
|
3413
|
+
entries: sdFileExplorerSheetEntries(resolved, definitions === shortcuts.commands ? shortcuts.keys : undefined),
|
|
3414
|
+
};
|
|
3415
|
+
}, /* @ts-ignore */
|
|
3416
|
+
...(ngDevMode ? [{ debugName: "commandSheet" }] : /* istanbul ignore next */ []));
|
|
3417
|
+
itemsMenuOpenId = computed(() => {
|
|
3418
|
+
const target = this.#commandTarget();
|
|
3419
|
+
return target && target.origin !== 'tree' ? target.id : null;
|
|
3420
|
+
}, /* @ts-ignore */
|
|
3421
|
+
...(ngDevMode ? [{ debugName: "itemsMenuOpenId" }] : /* istanbul ignore next */ []));
|
|
3422
|
+
treeMenuOpenId = computed(() => {
|
|
3423
|
+
const target = this.#commandTarget();
|
|
3424
|
+
return target?.origin === 'tree' ? target.id : null;
|
|
3425
|
+
}, /* @ts-ignore */
|
|
3426
|
+
...(ngDevMode ? [{ debugName: "treeMenuOpenId" }] : /* istanbul ignore next */ []));
|
|
1737
3427
|
// why: như shareFeedback — kiểu tường minh để d.ts ổn định giữa các máy build.
|
|
1738
3428
|
contentState = computed(() => {
|
|
1739
3429
|
const keyword = this.#trimmedKeyword();
|
|
@@ -1958,35 +3648,100 @@ class SdFileExplorer {
|
|
|
1958
3648
|
const type = sdFileExplorerFileType(item);
|
|
1959
3649
|
return {
|
|
1960
3650
|
item,
|
|
3651
|
+
downloadDisabled: this.movePending() || !sdFileExplorerEligible(this.#config().downloadable, item),
|
|
3652
|
+
shareDisabled: this.movePending() || !sdFileExplorerEligible(this.#config().shareable, item),
|
|
3653
|
+
unavailableReason: t('action-unavailable'),
|
|
1961
3654
|
type,
|
|
1962
3655
|
icon: sdFileExplorerIconName(item),
|
|
1963
3656
|
typeLabel: t(`type.${type}`),
|
|
1964
3657
|
sizeLabel: item.kind === 'file' ? sdFileExplorerFormatSize(item.size, locale) : '',
|
|
1965
|
-
modifiedLabel: sdFileExplorerFormatDate(item.modifiedAt, now, locale, labels),
|
|
1966
|
-
modifiedTitle: sdFileExplorerFormatDateTime(item.modifiedAt, locale),
|
|
3658
|
+
modifiedLabel: sdFileExplorerFormatDate(item.modifiedAt, now, locale, labels, this.#dateTime),
|
|
3659
|
+
modifiedTitle: sdFileExplorerFormatDateTime(item.modifiedAt, locale, this.#dateTime),
|
|
1967
3660
|
downloadLabel: t('download-item', { name: item.name }),
|
|
1968
3661
|
shareLabel: t('share-item', { name: item.name }),
|
|
3662
|
+
selectLabel: t('selection.select-item', { name: item.name }),
|
|
3663
|
+
actionsLabel: t('item-actions', { name: item.name }),
|
|
1969
3664
|
autoId: autoId ? `${autoId}-item-${sdFileExplorerSafeId(item.id)}` : undefined,
|
|
1970
3665
|
};
|
|
1971
3666
|
};
|
|
1972
3667
|
}, /* @ts-ignore */
|
|
1973
3668
|
...(ngDevMode ? [{ debugName: "#itemFormatter" }] : /* istanbul ignore next */ []));
|
|
1974
3669
|
constructor() {
|
|
3670
|
+
const destroyRef = inject(DestroyRef);
|
|
3671
|
+
let previewProvider;
|
|
3672
|
+
let shareProvider;
|
|
3673
|
+
let moveProvider;
|
|
3674
|
+
let searchProvider;
|
|
3675
|
+
effect(() => {
|
|
3676
|
+
const config = this.#config();
|
|
3677
|
+
const previewChanged = previewProvider !== config.preview;
|
|
3678
|
+
const shareChanged = shareProvider !== config.share;
|
|
3679
|
+
const moveChanged = moveProvider?.onMove !== config.move?.onMove;
|
|
3680
|
+
const searchChanged = searchProvider !== config.search;
|
|
3681
|
+
previewProvider = config.preview;
|
|
3682
|
+
shareProvider = config.share;
|
|
3683
|
+
moveProvider = config.move;
|
|
3684
|
+
searchProvider = config.search;
|
|
3685
|
+
untracked(() => {
|
|
3686
|
+
const item = this.#previewItem();
|
|
3687
|
+
if (previewChanged && item)
|
|
3688
|
+
void this.#loadPreview(item);
|
|
3689
|
+
const shareItem = this.shareItem();
|
|
3690
|
+
if (shareChanged && shareItem) {
|
|
3691
|
+
this.#shareController?.abort();
|
|
3692
|
+
if (config.share && sdFileExplorerEligible(config.shareable, shareItem))
|
|
3693
|
+
void this.#loadShareLink(shareItem);
|
|
3694
|
+
else
|
|
3695
|
+
this.closeShare();
|
|
3696
|
+
}
|
|
3697
|
+
if (moveChanged && this.#moveController)
|
|
3698
|
+
this.cancelMove();
|
|
3699
|
+
if (searchChanged && this.#listFn === config.list)
|
|
3700
|
+
this.#scheduleSearch(true);
|
|
3701
|
+
});
|
|
3702
|
+
});
|
|
3703
|
+
// why: trên màn hình cảm ứng không có hover — lệnh của hàng/thẻ/cây luôn hiện và dùng vùng chạm 48px.
|
|
3704
|
+
// Đọc ngay trong constructor (không đợi render) để lần vẽ đầu đã đúng cỡ, rồi theo dõi khi thiết bị đổi con trỏ.
|
|
3705
|
+
const touchQuery = this.#document.defaultView?.matchMedia?.(TOUCH_QUERY);
|
|
3706
|
+
if (touchQuery) {
|
|
3707
|
+
this.#touch.set(touchQuery.matches);
|
|
3708
|
+
const onTouchChange = (event) => this.#touch.set(event.matches);
|
|
3709
|
+
touchQuery.addEventListener?.('change', onTouchChange);
|
|
3710
|
+
destroyRef.onDestroy(() => touchQuery.removeEventListener?.('change', onTouchChange));
|
|
3711
|
+
}
|
|
1975
3712
|
// why: chỉ reset khi hàm `list` đổi (đổi nguồn lưu trữ). Consumer tạo lại object option với cùng callback
|
|
1976
3713
|
// (ví dụ đổi title) không được xoá cache/điều hướng của người dùng.
|
|
1977
3714
|
effect(() => {
|
|
1978
|
-
const option = this
|
|
3715
|
+
const option = this.#config();
|
|
3716
|
+
const selecting = !!this.#selector();
|
|
1979
3717
|
untracked(() => {
|
|
3718
|
+
if (!selecting)
|
|
3719
|
+
this.#clearSelection();
|
|
1980
3720
|
if (this.#listFn === option.list)
|
|
1981
3721
|
return;
|
|
1982
3722
|
const firstRun = this.#listFn === null;
|
|
1983
3723
|
this.#listFn = option.list;
|
|
3724
|
+
if (this.#moveController)
|
|
3725
|
+
this.cancelMove();
|
|
3726
|
+
this.moveRefreshError.set(false);
|
|
3727
|
+
this.#moveRefreshFolders = [];
|
|
3728
|
+
this.#moveDrag.clear();
|
|
1984
3729
|
if (firstRun)
|
|
1985
3730
|
this.view.set(option.defaultView ?? 'list');
|
|
1986
3731
|
this.#resetNavigation();
|
|
1987
3732
|
this.#ensureLoaded(null);
|
|
1988
3733
|
});
|
|
1989
3734
|
});
|
|
3735
|
+
// why: tệp bị lần tải lại bỏ khỏi danh sách hoặc bị consumer khóa (selector.disabled) rời lựa chọn hẳn — không
|
|
3736
|
+
// được tự chọn lại khi xuất hiện/mở khóa lần sau. Chỉ dọn khi nội dung đã ổn định (không dọn lúc đang tải) và không
|
|
3737
|
+
// gọi callback: đây không phải thao tác của người dùng hay một lần đổi phạm vi. Tạo SAU effect option để khi
|
|
3738
|
+
// selector bị ẩn, #clearSelection (có onClear) chạy trước lần dọn im lặng này.
|
|
3739
|
+
effect(() => {
|
|
3740
|
+
const eligible = this.#eligibleFiles();
|
|
3741
|
+
if (this.contentState() === 'loading')
|
|
3742
|
+
return;
|
|
3743
|
+
untracked(() => this.#keepEligibleSelection(eligible));
|
|
3744
|
+
});
|
|
1990
3745
|
afterNextRender(() => {
|
|
1991
3746
|
const host = this.#host.nativeElement;
|
|
1992
3747
|
this.#width.set(host.getBoundingClientRect().width);
|
|
@@ -1999,19 +3754,213 @@ class SdFileExplorer {
|
|
|
1999
3754
|
});
|
|
2000
3755
|
this.#resizeObserver.observe(host);
|
|
2001
3756
|
});
|
|
2002
|
-
// why: rời khỏi layout compact thì drawer không còn ý nghĩa — đóng để lần thu nhỏ sau không bật lại scrim.
|
|
3757
|
+
// why: rời khỏi layout compact thì drawer không còn ý nghĩa — đóng để lần thu nhỏ sau không bật lại scrim. Drawer
|
|
3758
|
+
// lệnh cũng đóng: hàng/thẻ/cây lại hiện lệnh của chúng (xoay ngang máy, kéo rộng cửa sổ).
|
|
2003
3759
|
effect(() => {
|
|
2004
|
-
if (
|
|
2005
|
-
|
|
3760
|
+
if (this.compact())
|
|
3761
|
+
return;
|
|
3762
|
+
untracked(() => {
|
|
3763
|
+
this.sidebarOpen.set(false);
|
|
3764
|
+
this.#closeCommands();
|
|
3765
|
+
});
|
|
3766
|
+
});
|
|
3767
|
+
// why: mục của drawer lệnh rời danh sách (lần tải lại bỏ nó, kết quả tìm kiếm đổi) hoặc không còn lệnh nào hiện —
|
|
3768
|
+
// đóng drawer thay vì giữ một ảnh chụp cũ có thể chạy lệnh trên mục đã mất.
|
|
3769
|
+
effect(() => {
|
|
3770
|
+
if (this.#commandTarget() && !this.commandSheet())
|
|
3771
|
+
untracked(() => this.#closeCommands());
|
|
2006
3772
|
});
|
|
2007
|
-
|
|
3773
|
+
// why: nút Back của trình duyệt / Android khi drawer lệnh đang mở — đóng drawer theo điều hướng của trang. Drawer không
|
|
3774
|
+
// giữ mục lịch sử nào (không pushState, không history.back): Back vẫn điều hướng như bình thường.
|
|
3775
|
+
const view = this.#document.defaultView;
|
|
3776
|
+
if (view) {
|
|
3777
|
+
const onPopState = () => this.#closeCommands();
|
|
3778
|
+
view.addEventListener('popstate', onPopState);
|
|
3779
|
+
destroyRef.onDestroy(() => view.removeEventListener('popstate', onPopState));
|
|
3780
|
+
}
|
|
3781
|
+
destroyRef.onDestroy(() => this.#teardown());
|
|
2008
3782
|
}
|
|
2009
3783
|
// ---- Public API ----
|
|
3784
|
+
/** Moves visible files through the caller's storage callback. False includes cancellation, rejection or refresh failure. */
|
|
3785
|
+
async moveFiles(items, targetFolder, source = 'api') {
|
|
3786
|
+
return this.#performMove(items, targetFolder, source, false);
|
|
3787
|
+
}
|
|
3788
|
+
async #performMove(items, targetFolder, source, selectionRequired) {
|
|
3789
|
+
const move = this.#config().move;
|
|
3790
|
+
if (!move ||
|
|
3791
|
+
this.movePending() ||
|
|
3792
|
+
this.moveRefreshError() ||
|
|
3793
|
+
this.folderSubmitting() ||
|
|
3794
|
+
this.#transfers().some(transfer => transfer.direction === 'upload' && ACTIVE_STATUSES.has(transfer.status)) ||
|
|
3795
|
+
this.#destroyed)
|
|
3796
|
+
return false;
|
|
3797
|
+
const controller = new AbortController();
|
|
3798
|
+
if (!this.#moveAllowed(items, targetFolder, source, controller.signal, selectionRequired))
|
|
3799
|
+
return false;
|
|
3800
|
+
const request = Object.freeze({
|
|
3801
|
+
items: Object.freeze([...items]),
|
|
3802
|
+
targetFolder,
|
|
3803
|
+
source,
|
|
3804
|
+
signal: controller.signal,
|
|
3805
|
+
});
|
|
3806
|
+
const sourceParents = items.map(item => item.parentId);
|
|
3807
|
+
const movedIds = new Set(items.map(item => item.id));
|
|
3808
|
+
const cachedSources = [...this.#folders()].filter(([, folder]) => folder.items.some(item => movedIds.has(item.id))).map(([id]) => id);
|
|
3809
|
+
this.#moveController = controller;
|
|
3810
|
+
this.movePending.set(true);
|
|
3811
|
+
this.moveStatus.set(this.#i18n.t('core.component.file-explorer.move.pending'));
|
|
3812
|
+
try {
|
|
3813
|
+
const accepted = await move.onMove(request);
|
|
3814
|
+
if (controller.signal.aborted || this.#destroyed || this.#config().move?.onMove !== move.onMove)
|
|
3815
|
+
return false;
|
|
3816
|
+
if (accepted === false) {
|
|
3817
|
+
this.moveStatus.set(this.#i18n.t('core.component.file-explorer.move.cancelled'));
|
|
3818
|
+
return false;
|
|
3819
|
+
}
|
|
3820
|
+
this.#moveRefreshFolders = [...new Set([...sourceParents, ...cachedSources, targetFolder?.id ?? null])].filter(id => this.#folders().has(id));
|
|
3821
|
+
this.#clearSelection();
|
|
3822
|
+
return await this.#refreshMove(controller);
|
|
3823
|
+
}
|
|
3824
|
+
catch (error) {
|
|
3825
|
+
if (!controller.signal.aborted && !this.#destroyed)
|
|
3826
|
+
this.moveStatus.set(sdFileExplorerErrorMessage(error) || this.#i18n.t('core.component.file-explorer.move.error'));
|
|
3827
|
+
return false;
|
|
3828
|
+
}
|
|
3829
|
+
finally {
|
|
3830
|
+
if (this.#moveController === controller) {
|
|
3831
|
+
this.#moveController = null;
|
|
3832
|
+
this.movePending.set(false);
|
|
3833
|
+
}
|
|
3834
|
+
}
|
|
3835
|
+
}
|
|
3836
|
+
/** Cooperatively aborts the current mutation. A consumer may already have committed its storage change. */
|
|
3837
|
+
cancelMove() {
|
|
3838
|
+
this.#moveController?.abort();
|
|
3839
|
+
this.#moveController = null;
|
|
3840
|
+
this.movePending.set(false);
|
|
3841
|
+
this.moveStatus.set(this.#i18n.t('core.component.file-explorer.move.cancelled'));
|
|
3842
|
+
this.#moveDrag.clear();
|
|
3843
|
+
}
|
|
3844
|
+
/** Repeats failed listing only; never calls onMove again. */
|
|
3845
|
+
async retryMoveRefresh() {
|
|
3846
|
+
if (!this.moveRefreshError() || this.movePending() || this.#destroyed)
|
|
3847
|
+
return false;
|
|
3848
|
+
const controller = new AbortController();
|
|
3849
|
+
this.#moveController = controller;
|
|
3850
|
+
this.movePending.set(true);
|
|
3851
|
+
try {
|
|
3852
|
+
return await this.#refreshMove(controller);
|
|
3853
|
+
}
|
|
3854
|
+
finally {
|
|
3855
|
+
if (this.#moveController === controller) {
|
|
3856
|
+
this.#moveController = null;
|
|
3857
|
+
this.movePending.set(false);
|
|
3858
|
+
}
|
|
3859
|
+
}
|
|
3860
|
+
}
|
|
3861
|
+
async #refreshMove(controller) {
|
|
3862
|
+
await Promise.all(this.#moveRefreshFolders.map(id => this.#load(id)));
|
|
3863
|
+
if (controller.signal.aborted || this.#destroyed)
|
|
3864
|
+
return false;
|
|
3865
|
+
const failed = this.#moveRefreshFolders.some(id => this.#folders().get(id)?.status !== 'loaded');
|
|
3866
|
+
this.moveRefreshError.set(failed);
|
|
3867
|
+
this.moveStatus.set(this.#i18n.t(failed ? 'core.component.file-explorer.move.refresh-error' : 'core.component.file-explorer.move.done'));
|
|
3868
|
+
if (!failed) {
|
|
3869
|
+
this.#moveRefreshFolders = [];
|
|
3870
|
+
if (this.searching())
|
|
3871
|
+
this.#scheduleSearch(true);
|
|
3872
|
+
}
|
|
3873
|
+
return !failed;
|
|
3874
|
+
}
|
|
3875
|
+
#moveAllowed(items, target, source, signal, selectionRequired = false) {
|
|
3876
|
+
const move = this.#config().move;
|
|
3877
|
+
const visible = this.#visibleItems();
|
|
3878
|
+
const known = [...this.#folders().values()].flatMap(folder => folder.items.filter(item => item.kind === 'folder'));
|
|
3879
|
+
if (!move || !sdFileExplorerValidateMove(items, target, known, visible))
|
|
3880
|
+
return false;
|
|
3881
|
+
if (selectionRequired && items.some(item => !this.#eligibleFiles().includes(item)))
|
|
3882
|
+
return false;
|
|
3883
|
+
return sdFileExplorerEligible(move.movable, { items: Object.freeze([...items]), targetFolder: target, source, signal });
|
|
3884
|
+
}
|
|
3885
|
+
openMovePicker(items, event) {
|
|
3886
|
+
if (!this.canMove() || this.movePending() || !items.length)
|
|
3887
|
+
return;
|
|
3888
|
+
const active = this.#document.activeElement;
|
|
3889
|
+
this.#moveReturnFocus = active instanceof HTMLElement ? active : null;
|
|
3890
|
+
const selected = this.selectedItems();
|
|
3891
|
+
this.#movePickerSelectionRequired = items.every(item => selected.includes(item));
|
|
3892
|
+
this.moveTarget.set(null);
|
|
3893
|
+
this.movePickerItems.set(Object.freeze([...items]));
|
|
3894
|
+
event?.stopPropagation();
|
|
3895
|
+
}
|
|
3896
|
+
closeMovePicker() {
|
|
3897
|
+
if (this.movePending())
|
|
3898
|
+
this.cancelMove();
|
|
3899
|
+
this.movePickerItems.set(null);
|
|
3900
|
+
this.#movePickerSelectionRequired = false;
|
|
3901
|
+
const focus = this.#moveReturnFocus;
|
|
3902
|
+
this.#moveReturnFocus = null;
|
|
3903
|
+
if (focus?.isConnected)
|
|
3904
|
+
afterNextRender(() => focus.focus({ preventScroll: true }), { injector: this.#injector });
|
|
3905
|
+
}
|
|
3906
|
+
submitMoveFromEvent(event) {
|
|
3907
|
+
void this.submitMove(event instanceof MouseEvent && event.detail === 0 ? 'keyboard' : 'menu');
|
|
3908
|
+
}
|
|
3909
|
+
async submitMove(source = 'menu') {
|
|
3910
|
+
const items = this.movePickerItems();
|
|
3911
|
+
if (!items)
|
|
3912
|
+
return;
|
|
3913
|
+
if (await this.#performMove(items, this.moveTarget(), source, this.#movePickerSelectionRequired))
|
|
3914
|
+
this.closeMovePicker();
|
|
3915
|
+
}
|
|
3916
|
+
onMoveDragStart(event) {
|
|
3917
|
+
const element = event.target instanceof Element ? event.target : null;
|
|
3918
|
+
if (!element?.closest('.name, .card-name') ||
|
|
3919
|
+
element.closest('button,input,a,.commands,.card-top,.cell--select') ||
|
|
3920
|
+
!event.dataTransfer ||
|
|
3921
|
+
!this.canMove() ||
|
|
3922
|
+
this.movePending()) {
|
|
3923
|
+
event.preventDefault();
|
|
3924
|
+
return;
|
|
3925
|
+
}
|
|
3926
|
+
const id = element.closest('[data-item-id]')?.dataset['itemId'];
|
|
3927
|
+
const file = this.#visibleItems().find(item => item.id === id && item.kind === 'file');
|
|
3928
|
+
if (!file) {
|
|
3929
|
+
event.preventDefault();
|
|
3930
|
+
return;
|
|
3931
|
+
}
|
|
3932
|
+
const selected = this.selectedItems();
|
|
3933
|
+
this.#moveDragSelectionRequired = selected.includes(file);
|
|
3934
|
+
const items = selected.includes(file) ? selected : [file];
|
|
3935
|
+
event.dataTransfer.setData(SD_FILE_EXPLORER_MOVE_MIME, this.#moveDrag.start(items));
|
|
3936
|
+
event.dataTransfer.effectAllowed = 'move';
|
|
3937
|
+
}
|
|
3938
|
+
onMoveDragEnd() {
|
|
3939
|
+
this.#moveDrag.clear();
|
|
3940
|
+
this.#moveDragSelectionRequired = false;
|
|
3941
|
+
this.moveDropTarget.set(undefined);
|
|
3942
|
+
}
|
|
3943
|
+
#internalDropTarget(event) {
|
|
3944
|
+
const element = event.target instanceof Element ? event.target : null;
|
|
3945
|
+
if (element?.closest('sd-file-explorer') !== this.#host.nativeElement)
|
|
3946
|
+
return null;
|
|
3947
|
+
const node = element.closest('[data-move-target]');
|
|
3948
|
+
if (!node)
|
|
3949
|
+
return null;
|
|
3950
|
+
const id = node.dataset['moveTarget'];
|
|
3951
|
+
if (id === '')
|
|
3952
|
+
return { folder: null };
|
|
3953
|
+
const folder = [...this.#itemById().values()].find(item => item.id === id && item.kind === 'folder');
|
|
3954
|
+
return folder ? { folder } : null;
|
|
3955
|
+
}
|
|
2010
3956
|
/**
|
|
2011
3957
|
* Lists the current folder again and drops the cached children of folders that are neither open in the
|
|
2012
|
-
* tree nor on the current path. Re-runs the active search, if any.
|
|
3958
|
+
* tree nor on the current path. Re-runs the active search, if any. Clears the file selection and closes the command
|
|
3959
|
+
* drawer of the compact layout.
|
|
2013
3960
|
*/
|
|
2014
3961
|
reload() {
|
|
3962
|
+
this.#clearSelection();
|
|
3963
|
+
this.#closeCommands();
|
|
2015
3964
|
const keep = new Set([null, this.#currentId(), ...this.#expanded(), ...this.#path().map(folder => folder.id)]);
|
|
2016
3965
|
const folders = new Map(this.#folders());
|
|
2017
3966
|
for (const key of [...folders.keys()]) {
|
|
@@ -2031,6 +3980,9 @@ class SdFileExplorer {
|
|
|
2031
3980
|
// ---- Navigation ----
|
|
2032
3981
|
navigate(folder) {
|
|
2033
3982
|
const id = folder?.id ?? null;
|
|
3983
|
+
if (id !== this.#currentId())
|
|
3984
|
+
this.#clearSelection();
|
|
3985
|
+
this.#closeCommands();
|
|
2034
3986
|
const path = folder ? this.#buildPath(folder) : [];
|
|
2035
3987
|
this.#currentId.set(id);
|
|
2036
3988
|
this.#path.set(path);
|
|
@@ -2126,10 +4078,14 @@ class SdFileExplorer {
|
|
|
2126
4078
|
this.previewState.set({ status: 'error', message: '' });
|
|
2127
4079
|
}
|
|
2128
4080
|
downloadItem(item) {
|
|
2129
|
-
const download = this
|
|
2130
|
-
if (!download)
|
|
4081
|
+
const download = this.#config().download;
|
|
4082
|
+
if (!download || !sdFileExplorerEligible(this.#config().downloadable, item))
|
|
2131
4083
|
return;
|
|
2132
|
-
this.#enqueue('download', item.name, item.parentId, args =>
|
|
4084
|
+
this.#enqueue('download', item.name, item.parentId, args => {
|
|
4085
|
+
if (!sdFileExplorerEligible(this.#config().downloadable, item))
|
|
4086
|
+
throw new Error(this.#i18n.t('core.component.file-explorer.action-unavailable'));
|
|
4087
|
+
return download({ item, ...args });
|
|
4088
|
+
});
|
|
2133
4089
|
this.transfersCollapsed.set(false);
|
|
2134
4090
|
}
|
|
2135
4091
|
downloadPreview() {
|
|
@@ -2142,9 +4098,176 @@ class SdFileExplorer {
|
|
|
2142
4098
|
if (item)
|
|
2143
4099
|
this.openShare(item);
|
|
2144
4100
|
}
|
|
4101
|
+
// ---- Selection ----
|
|
4102
|
+
toggleSelection(item) {
|
|
4103
|
+
const selector = this.#selector();
|
|
4104
|
+
if (!selector || !this.#eligibleFiles().some(file => file.id === item.id))
|
|
4105
|
+
return;
|
|
4106
|
+
// why: dựng lại từ selectedItems (không từ #selectedIds) để bỏ luôn id của tệp đã rời khỏi danh sách.
|
|
4107
|
+
const next = new Set(this.selectedItems().map(file => file.id));
|
|
4108
|
+
if (next.has(item.id))
|
|
4109
|
+
next.delete(item.id);
|
|
4110
|
+
else
|
|
4111
|
+
next.add(item.id);
|
|
4112
|
+
this.#selectedIds.set(next);
|
|
4113
|
+
selector.onSelect?.(item, this.selectedItems());
|
|
4114
|
+
}
|
|
4115
|
+
toggleSelectAll() {
|
|
4116
|
+
const selector = this.#selector();
|
|
4117
|
+
const eligible = this.#eligibleFiles();
|
|
4118
|
+
if (!selector || !eligible.length)
|
|
4119
|
+
return;
|
|
4120
|
+
const all = this.selectedItems().length === eligible.length;
|
|
4121
|
+
this.#selectedIds.set(new Set(all ? [] : eligible.map(item => item.id)));
|
|
4122
|
+
selector.onSelectAll?.(this.selectedItems());
|
|
4123
|
+
}
|
|
4124
|
+
clearSelection() {
|
|
4125
|
+
const active = this.#document.activeElement;
|
|
4126
|
+
if (active instanceof HTMLElement && active.classList.contains('selection-clear') && this.#host.nativeElement.contains(active)) {
|
|
4127
|
+
// Move owned focus before removing the toolbar. A consumer's onClear callback
|
|
4128
|
+
// remains free to move focus elsewhere after the selection is cleared.
|
|
4129
|
+
this.#host.nativeElement.querySelector('.select-all input')?.focus({ preventScroll: true });
|
|
4130
|
+
}
|
|
4131
|
+
this.#clearSelection();
|
|
4132
|
+
}
|
|
4133
|
+
/** Empties the selection, calling `onClear` once when something was selected. */
|
|
4134
|
+
#clearSelection() {
|
|
4135
|
+
if (!this.#selectedIds().size)
|
|
4136
|
+
return;
|
|
4137
|
+
this.#selectedIds.set(new Set());
|
|
4138
|
+
this.#config().selector?.onClear?.();
|
|
4139
|
+
}
|
|
4140
|
+
/** Forgets selected ids that are no longer visible and eligible. Silent: no callback. */
|
|
4141
|
+
#keepEligibleSelection(eligible) {
|
|
4142
|
+
const ids = this.#selectedIds();
|
|
4143
|
+
if (!ids.size)
|
|
4144
|
+
return;
|
|
4145
|
+
const kept = new Set(eligible.filter(item => ids.has(item.id)).map(item => item.id));
|
|
4146
|
+
if (kept.size !== ids.size)
|
|
4147
|
+
this.#selectedIds.set(kept);
|
|
4148
|
+
}
|
|
4149
|
+
// ---- Compact command drawer ----
|
|
4150
|
+
openCommands(item, origin, trigger) {
|
|
4151
|
+
this.#pendingCommand = null;
|
|
4152
|
+
// why: bẫy focus của sd-side-drawer trả focus về phần tử đang giữ focus lúc nó mở. Chạm vào nút trên iOS không
|
|
4153
|
+
// focus nút, nên focus nút trước khi mở để đóng drawer xong focus về đúng hàng / thẻ / nút cây.
|
|
4154
|
+
trigger.focus({ preventScroll: true });
|
|
4155
|
+
this.#commandTarget.set({ id: item.id, origin, trigger });
|
|
4156
|
+
this.commandDrawer()?.show();
|
|
4157
|
+
}
|
|
4158
|
+
/** The user closed the drawer (close button, `Escape`, backdrop). */
|
|
4159
|
+
onCommandsClosed() {
|
|
4160
|
+
const target = this.#commandTarget();
|
|
4161
|
+
if (!target)
|
|
4162
|
+
return;
|
|
4163
|
+
this.#commandTarget.set(null);
|
|
4164
|
+
afterNextRender(() => this.#restoreCommandFocus(target), { injector: this.#injector });
|
|
4165
|
+
}
|
|
4166
|
+
/**
|
|
4167
|
+
* Runs a command pressed in the drawer. The press is checked against the current item, definitions and states: a
|
|
4168
|
+
* stale entry, a state the consumer changed since the last render or a second press runs nothing.
|
|
4169
|
+
*
|
|
4170
|
+
* The drawer closes first, at once. The command runs after the next render: by then the drawer's focus trap is gone
|
|
4171
|
+
* and has handed focus back, so it cannot pull focus away from a dialog or a preview the command opens. Right before
|
|
4172
|
+
* it runs, the same check is made again, and `click` receives the item as listed at that moment.
|
|
4173
|
+
*/
|
|
4174
|
+
runCommand({ command, group }) {
|
|
4175
|
+
const target = this.#commandTarget();
|
|
4176
|
+
if (this.#pendingCommand || !target)
|
|
4177
|
+
return;
|
|
4178
|
+
const pending = { id: target.id, origin: target.origin, leaf: command.definition, group: group?.definition ?? null };
|
|
4179
|
+
if (!this.#runnableItem(pending)) {
|
|
4180
|
+
// why: trạng thái do consumer giữ ngoài signal đã đổi từ lần render trước — tính lại để drawer hiện đúng trạng thái.
|
|
4181
|
+
this.#commandTarget.set({ ...target });
|
|
4182
|
+
return;
|
|
4183
|
+
}
|
|
4184
|
+
this.#pendingCommand = pending;
|
|
4185
|
+
this.#commandTarget.set(null);
|
|
4186
|
+
this.commandDrawer()?.hide();
|
|
4187
|
+
afterNextRender(() => {
|
|
4188
|
+
if (this.#pendingCommand !== pending)
|
|
4189
|
+
return;
|
|
4190
|
+
this.#pendingCommand = null;
|
|
4191
|
+
this.#restoreCommandFocus(target);
|
|
4192
|
+
// why: giữa lúc bấm và lần render này consumer vẫn có thể đổi trạng thái, rút định nghĩa hay làm mới danh sách
|
|
4193
|
+
// (drawer đã đóng nên effect "mục biến mất" không còn canh) — kiểm lại ngay trước khi chạy, với bản hiện tại của mục.
|
|
4194
|
+
const item = this.#runnableItem(pending);
|
|
4195
|
+
if (item)
|
|
4196
|
+
(pending.leaf.onClick ?? pending.leaf.click)?.(item);
|
|
4197
|
+
}, { injector: this.#injector });
|
|
4198
|
+
}
|
|
4199
|
+
/** Current version of an item, by id, in the list a drawer was opened from (list / grid items or tree folders). */
|
|
4200
|
+
#findCommandItem(id, origin) {
|
|
4201
|
+
if (origin === 'tree')
|
|
4202
|
+
return this.treeNodes().find(node => node.id === id)?.item ?? null;
|
|
4203
|
+
return this.#visibleItems().find(item => item.id === id) ?? null;
|
|
4204
|
+
}
|
|
4205
|
+
/**
|
|
4206
|
+
* The current item when `command` may run now — the item is still listed where the drawer was opened, the pressed
|
|
4207
|
+
* definition and its group are still declared for it, and neither is hidden, disabled or loading — else `null`.
|
|
4208
|
+
*/
|
|
4209
|
+
#runnableItem(command) {
|
|
4210
|
+
const item = this.#findCommandItem(command.id, command.origin);
|
|
4211
|
+
if (!item)
|
|
4212
|
+
return null;
|
|
4213
|
+
const { leaf, group } = command;
|
|
4214
|
+
const definitions = this.#commandDefinitions(item, command.origin);
|
|
4215
|
+
const declared = group ? definitions.includes(group) && group.children.includes(leaf) : definitions.includes(leaf);
|
|
4216
|
+
const blocked = (group !== null && sdFileExplorerActionBlocked(group, item)) || sdFileExplorerActionBlocked(leaf, item);
|
|
4217
|
+
return declared && !blocked ? item : null;
|
|
4218
|
+
}
|
|
4219
|
+
/** Commands of one item in the drawer: the declared ones, or the row shortcuts while `fileCommands` is undeclared. */
|
|
4220
|
+
#commandDefinitions(item, origin) {
|
|
4221
|
+
const option = this.#config();
|
|
4222
|
+
if (item.kind === 'folder')
|
|
4223
|
+
return option.folderCommands ?? [];
|
|
4224
|
+
if (option.fileCommands != null)
|
|
4225
|
+
return option.fileCommands;
|
|
4226
|
+
// why: lối tắt tải xuống / chia sẻ chỉ có trên hàng danh sách — thẻ lưới chưa từng có — nên chỉ hàng mang chúng vào drawer.
|
|
4227
|
+
return origin === 'list' ? this.#shortcuts().commands : [];
|
|
4228
|
+
}
|
|
4229
|
+
/** Closes the drawer without running anything and drops a pressed command that has not run yet. */
|
|
4230
|
+
#closeCommands() {
|
|
4231
|
+
this.#pendingCommand = null;
|
|
4232
|
+
const target = this.#commandTarget();
|
|
4233
|
+
if (!target)
|
|
4234
|
+
return;
|
|
4235
|
+
this.#commandTarget.set(null);
|
|
4236
|
+
this.commandDrawer()?.hide();
|
|
4237
|
+
afterNextRender(() => this.#restoreCommandFocus(target), { injector: this.#injector });
|
|
4238
|
+
}
|
|
4239
|
+
/**
|
|
4240
|
+
* After the drawer closed: when its focus trap could not give focus back — the trigger left the page with its row,
|
|
4241
|
+
* or the layout changed — focus the item's row, card or tree tab stop, the first item, or the search box.
|
|
4242
|
+
*/
|
|
4243
|
+
#restoreCommandFocus(target) {
|
|
4244
|
+
const active = this.#document.activeElement;
|
|
4245
|
+
if (this.#destroyed || (active && active !== this.#document.body))
|
|
4246
|
+
return;
|
|
4247
|
+
const host = this.#host.nativeElement;
|
|
4248
|
+
const items = Array.from(host.querySelectorAll('[data-item-id]'));
|
|
4249
|
+
const candidates = [
|
|
4250
|
+
target.trigger.isConnected ? target.trigger : null,
|
|
4251
|
+
target.origin === 'tree'
|
|
4252
|
+
? host.querySelector('[role="treeitem"][tabindex="0"]')
|
|
4253
|
+
: (items.find(element => element.dataset['itemId'] === target.id) ?? null),
|
|
4254
|
+
items[0] ?? null,
|
|
4255
|
+
this.searchInput()?.nativeElement ?? null,
|
|
4256
|
+
];
|
|
4257
|
+
for (const candidate of candidates) {
|
|
4258
|
+
candidate?.focus({ preventScroll: true });
|
|
4259
|
+
if (candidate && this.#document.activeElement === candidate)
|
|
4260
|
+
return;
|
|
4261
|
+
}
|
|
4262
|
+
}
|
|
2145
4263
|
// ---- Search ----
|
|
2146
4264
|
onKeywordInput(value) {
|
|
4265
|
+
const before = this.#trimmedKeyword();
|
|
2147
4266
|
this.keyword.set(value);
|
|
4267
|
+
if (this.#trimmedKeyword() !== before) {
|
|
4268
|
+
this.#clearSelection();
|
|
4269
|
+
this.#closeCommands();
|
|
4270
|
+
}
|
|
2148
4271
|
this.#scheduleSearch(false);
|
|
2149
4272
|
}
|
|
2150
4273
|
clearSearch() {
|
|
@@ -2159,16 +4282,26 @@ class SdFileExplorer {
|
|
|
2159
4282
|
this.uploadFiles(files);
|
|
2160
4283
|
}
|
|
2161
4284
|
uploadFiles(files) {
|
|
2162
|
-
|
|
2163
|
-
|
|
4285
|
+
if (this.movePending())
|
|
4286
|
+
return;
|
|
4287
|
+
const upload = this.#config().upload;
|
|
4288
|
+
if (!upload || files.length === 0 || !sdFileExplorerEligible(this.#config().uploadable, { parentId: this.#currentId() }))
|
|
2164
4289
|
return;
|
|
2165
4290
|
const parentId = this.#currentId();
|
|
2166
4291
|
for (const file of files) {
|
|
2167
|
-
this.#enqueue('upload', file.name, parentId, args =>
|
|
4292
|
+
this.#enqueue('upload', file.name, parentId, args => {
|
|
4293
|
+
if (!sdFileExplorerEligible(this.#config().uploadable, { parentId }))
|
|
4294
|
+
throw new Error(this.#i18n.t('core.component.file-explorer.action-unavailable'));
|
|
4295
|
+
return upload({ file, parentId, ...args });
|
|
4296
|
+
});
|
|
2168
4297
|
}
|
|
2169
4298
|
this.transfersCollapsed.set(false);
|
|
2170
4299
|
}
|
|
2171
4300
|
onDragEnter(event) {
|
|
4301
|
+
if (event.dataTransfer?.types.includes(SD_FILE_EXPLORER_MOVE_MIME)) {
|
|
4302
|
+
this.onDragOver(event);
|
|
4303
|
+
return;
|
|
4304
|
+
}
|
|
2172
4305
|
if (!this.#acceptsDrag(event))
|
|
2173
4306
|
return;
|
|
2174
4307
|
event.preventDefault();
|
|
@@ -2176,6 +4309,20 @@ class SdFileExplorer {
|
|
|
2176
4309
|
this.dragActive.set(true);
|
|
2177
4310
|
}
|
|
2178
4311
|
onDragOver(event) {
|
|
4312
|
+
if (event.dataTransfer?.types.includes(SD_FILE_EXPLORER_MOVE_MIME)) {
|
|
4313
|
+
const target = this.#internalDropTarget(event);
|
|
4314
|
+
const items = this.#moveDrag.activeItems;
|
|
4315
|
+
const allowed = !event.dataTransfer.types.includes('Files') &&
|
|
4316
|
+
!!items &&
|
|
4317
|
+
!!target &&
|
|
4318
|
+
!this.movePending() &&
|
|
4319
|
+
this.#moveAllowed(items, target.folder, 'drag', new AbortController().signal, this.#moveDragSelectionRequired);
|
|
4320
|
+
if (target && items && allowed)
|
|
4321
|
+
event.preventDefault();
|
|
4322
|
+
event.dataTransfer.dropEffect = allowed ? 'move' : 'none';
|
|
4323
|
+
this.moveDropTarget.set(allowed ? (target.folder?.id ?? null) : undefined);
|
|
4324
|
+
return;
|
|
4325
|
+
}
|
|
2179
4326
|
if (!this.#acceptsDrag(event))
|
|
2180
4327
|
return;
|
|
2181
4328
|
event.preventDefault();
|
|
@@ -2191,6 +4338,17 @@ class SdFileExplorer {
|
|
|
2191
4338
|
this.dragActive.set(false);
|
|
2192
4339
|
}
|
|
2193
4340
|
onDrop(event) {
|
|
4341
|
+
if (event.dataTransfer?.types.includes(SD_FILE_EXPLORER_MOVE_MIME)) {
|
|
4342
|
+
event.preventDefault();
|
|
4343
|
+
const target = this.#internalDropTarget(event);
|
|
4344
|
+
const items = this.#moveDrag.resolve(event.dataTransfer.getData(SD_FILE_EXPLORER_MOVE_MIME));
|
|
4345
|
+
const mixed = event.dataTransfer.types.includes('Files') || event.dataTransfer.files.length > 0;
|
|
4346
|
+
const selectionRequired = this.#moveDragSelectionRequired;
|
|
4347
|
+
this.onMoveDragEnd();
|
|
4348
|
+
if (items && target && !mixed)
|
|
4349
|
+
void this.#performMove(items, target.folder, 'drag', selectionRequired);
|
|
4350
|
+
return;
|
|
4351
|
+
}
|
|
2194
4352
|
if (!this.#acceptsDrag(event))
|
|
2195
4353
|
return;
|
|
2196
4354
|
event.preventDefault();
|
|
@@ -2212,6 +4370,8 @@ class SdFileExplorer {
|
|
|
2212
4370
|
}
|
|
2213
4371
|
retryTransfer(id) {
|
|
2214
4372
|
const job = this.#jobs.get(id);
|
|
4373
|
+
if (job?.direction === 'upload' && this.movePending())
|
|
4374
|
+
return;
|
|
2215
4375
|
const status = this.#statusOf(id);
|
|
2216
4376
|
if (!job || (status !== 'error' && status !== 'cancelled'))
|
|
2217
4377
|
return;
|
|
@@ -2248,7 +4408,7 @@ class SdFileExplorer {
|
|
|
2248
4408
|
}
|
|
2249
4409
|
// ---- Share ----
|
|
2250
4410
|
openShare(item) {
|
|
2251
|
-
if (!this
|
|
4411
|
+
if (!this.#config().share || !sdFileExplorerEligible(this.#config().shareable, item))
|
|
2252
4412
|
return;
|
|
2253
4413
|
const active = this.#document.activeElement;
|
|
2254
4414
|
this.#shareReturnFocus = active instanceof HTMLElement && this.#host.nativeElement.contains(active) ? active : null;
|
|
@@ -2298,8 +4458,8 @@ class SdFileExplorer {
|
|
|
2298
4458
|
}
|
|
2299
4459
|
}
|
|
2300
4460
|
async #loadShareLink(item) {
|
|
2301
|
-
const share = this
|
|
2302
|
-
if (!share)
|
|
4461
|
+
const share = this.#config().share;
|
|
4462
|
+
if (!share || !sdFileExplorerEligible(this.#config().shareable, item))
|
|
2303
4463
|
return;
|
|
2304
4464
|
this.#shareController?.abort();
|
|
2305
4465
|
const controller = new AbortController();
|
|
@@ -2338,9 +4498,11 @@ class SdFileExplorer {
|
|
|
2338
4498
|
}
|
|
2339
4499
|
async submitFolder(event) {
|
|
2340
4500
|
event.preventDefault();
|
|
2341
|
-
|
|
4501
|
+
if (this.movePending())
|
|
4502
|
+
return;
|
|
4503
|
+
const create = this.#config().createFolder;
|
|
2342
4504
|
const name = this.folderName().trim();
|
|
2343
|
-
if (!create || !name || this.folderSubmitting())
|
|
4505
|
+
if (!create || !name || this.folderSubmitting() || !sdFileExplorerEligible(this.#config().creatable, { parentId: this.#currentId() }))
|
|
2344
4506
|
return;
|
|
2345
4507
|
const parentId = this.#currentId();
|
|
2346
4508
|
this.folderSubmitting.set(true);
|
|
@@ -2367,7 +4529,11 @@ class SdFileExplorer {
|
|
|
2367
4529
|
onEscape(event) {
|
|
2368
4530
|
if (event.defaultPrevented)
|
|
2369
4531
|
return;
|
|
2370
|
-
if (this.
|
|
4532
|
+
if (this.movePickerItems())
|
|
4533
|
+
this.closeMovePicker();
|
|
4534
|
+
else if (this.movePending())
|
|
4535
|
+
this.cancelMove();
|
|
4536
|
+
else if (this.folderDialogOpen())
|
|
2371
4537
|
this.closeFolderDialog();
|
|
2372
4538
|
else if (this.shareItem())
|
|
2373
4539
|
this.closeShare();
|
|
@@ -2386,6 +4552,8 @@ class SdFileExplorer {
|
|
|
2386
4552
|
}
|
|
2387
4553
|
// ---- Internals: folders ----
|
|
2388
4554
|
#resetNavigation() {
|
|
4555
|
+
this.#clearSelection();
|
|
4556
|
+
this.#closeCommands();
|
|
2389
4557
|
for (const controller of this.#listControllers.values())
|
|
2390
4558
|
controller.abort();
|
|
2391
4559
|
this.#listControllers.clear();
|
|
@@ -2414,7 +4582,7 @@ class SdFileExplorer {
|
|
|
2414
4582
|
const previous = this.#folders().get(parentId);
|
|
2415
4583
|
this.#setFolder(parentId, { status: 'loading', items: previous?.loaded ? previous.items : [], loaded: !!previous?.loaded });
|
|
2416
4584
|
try {
|
|
2417
|
-
const items = await this
|
|
4585
|
+
const items = await this.#config().list({ parentId, signal: controller.signal });
|
|
2418
4586
|
if (controller.signal.aborted || this.#destroyed)
|
|
2419
4587
|
return;
|
|
2420
4588
|
this.#setFolder(parentId, { status: 'loaded', items: Array.isArray(items) ? items : [], loaded: true });
|
|
@@ -2459,7 +4627,7 @@ class SdFileExplorer {
|
|
|
2459
4627
|
this.#searchController?.abort();
|
|
2460
4628
|
this.#searchController = null;
|
|
2461
4629
|
const keyword = this.#trimmedKeyword();
|
|
2462
|
-
const search = this
|
|
4630
|
+
const search = this.#config().search;
|
|
2463
4631
|
if (!keyword || !search) {
|
|
2464
4632
|
this.#search.set(null);
|
|
2465
4633
|
return;
|
|
@@ -2473,19 +4641,19 @@ class SdFileExplorer {
|
|
|
2473
4641
|
}
|
|
2474
4642
|
async #runSearch(keyword, parentId) {
|
|
2475
4643
|
this.#searchTimer = null;
|
|
2476
|
-
const search = this
|
|
4644
|
+
const search = this.#config().search;
|
|
2477
4645
|
if (!search)
|
|
2478
4646
|
return;
|
|
2479
4647
|
const controller = new AbortController();
|
|
2480
4648
|
this.#searchController = controller;
|
|
2481
4649
|
try {
|
|
2482
4650
|
const items = await search({ parentId, keyword, signal: controller.signal });
|
|
2483
|
-
if (controller.signal.aborted || this.#destroyed)
|
|
4651
|
+
if (controller.signal.aborted || this.#destroyed || this.#config().search !== search)
|
|
2484
4652
|
return;
|
|
2485
4653
|
this.#search.set({ keyword, parentId, status: 'loaded', items: Array.isArray(items) ? items : [] });
|
|
2486
4654
|
}
|
|
2487
4655
|
catch (error) {
|
|
2488
|
-
if (controller.signal.aborted || this.#destroyed)
|
|
4656
|
+
if (controller.signal.aborted || this.#destroyed || this.#config().search !== search)
|
|
2489
4657
|
return;
|
|
2490
4658
|
this.#search.set({ keyword, parentId, status: 'error', items: [], error });
|
|
2491
4659
|
}
|
|
@@ -2495,6 +4663,10 @@ class SdFileExplorer {
|
|
|
2495
4663
|
}
|
|
2496
4664
|
}
|
|
2497
4665
|
#clearSearch() {
|
|
4666
|
+
if (this.#trimmedKeyword()) {
|
|
4667
|
+
this.#clearSelection();
|
|
4668
|
+
this.#closeCommands();
|
|
4669
|
+
}
|
|
2498
4670
|
this.keyword.set('');
|
|
2499
4671
|
this.#scheduleSearch(false);
|
|
2500
4672
|
}
|
|
@@ -2503,9 +4675,9 @@ class SdFileExplorer {
|
|
|
2503
4675
|
this.#releasePreview();
|
|
2504
4676
|
const kind = sdFileExplorerPreviewKind(sdFileExplorerFileType(item));
|
|
2505
4677
|
const fallback = () => kind === 'image' && item.thumbnailUrl ? { status: 'image', url: item.thumbnailUrl } : { status: 'unavailable' };
|
|
2506
|
-
const preview = this
|
|
4678
|
+
const preview = this.#config().preview;
|
|
2507
4679
|
// why: định dạng không có renderer thì KHÔNG gọi callback — tránh tải cả file chỉ để hiện fallback.
|
|
2508
|
-
if (kind === 'none' || !preview) {
|
|
4680
|
+
if (kind === 'none' || !preview || !sdFileExplorerEligible(this.#config().previewable, item)) {
|
|
2509
4681
|
this.previewState.set(kind === 'none' ? { status: 'unavailable' } : fallback());
|
|
2510
4682
|
return;
|
|
2511
4683
|
}
|
|
@@ -2655,7 +4827,11 @@ class SdFileExplorer {
|
|
|
2655
4827
|
// ---- Internals: DOM helpers ----
|
|
2656
4828
|
#acceptsDrag(event) {
|
|
2657
4829
|
const types = event.dataTransfer?.types;
|
|
2658
|
-
return this.canUpload() &&
|
|
4830
|
+
return (this.canUpload() &&
|
|
4831
|
+
!this.uploadDisabled() &&
|
|
4832
|
+
!!types &&
|
|
4833
|
+
!Array.from(types).includes(SD_FILE_EXPLORER_MOVE_MIME) &&
|
|
4834
|
+
Array.from(types).includes('Files'));
|
|
2659
4835
|
}
|
|
2660
4836
|
#droppedFiles(transfer) {
|
|
2661
4837
|
if (!transfer)
|
|
@@ -2682,6 +4858,10 @@ class SdFileExplorer {
|
|
|
2682
4858
|
}
|
|
2683
4859
|
#teardown() {
|
|
2684
4860
|
this.#destroyed = true;
|
|
4861
|
+
this.#moveController?.abort();
|
|
4862
|
+
this.#moveDrag.clear();
|
|
4863
|
+
// A command pressed right before the explorer goes away never runs; sd-side-drawer releases its own scroll lock.
|
|
4864
|
+
this.#pendingCommand = null;
|
|
2685
4865
|
this.#resizeObserver?.disconnect();
|
|
2686
4866
|
for (const controller of this.#listControllers.values())
|
|
2687
4867
|
controller.abort();
|
|
@@ -2700,16 +4880,22 @@ class SdFileExplorer {
|
|
|
2700
4880
|
this.#shareController?.abort();
|
|
2701
4881
|
}
|
|
2702
4882
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdFileExplorer, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2703
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdFileExplorer, isStandalone: true, selector: "sd-file-explorer", inputs: { option: { classPropertyName: "option", publicName: "option", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { open: "open" }, host: { listeners: { "dragenter": "onDragEnter($event)", "dragover": "onDragOver($event)", "dragleave": "onDragLeave()", "drop": "onDrop($event)", "keydown.escape": "onEscape($event)" }, properties: { "class.sd-file-explorer--compact": "compact()", "class.sd-file-explorer--dragging": "dragActive()", "attr.data-autoid": "autoId()" }, classAttribute: "sd-file-explorer" }, viewQueries: [{ propertyName: "searchInput", first: true, predicate: ["searchInput"], descendants: true, isSignal: true }, { propertyName: "folderInput", first: true, predicate: ["folderInput"], descendants: true, isSignal: true }, { propertyName: "newFolderButton", first: true, predicate: ["newFolderButton"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "copyButton", first: true, predicate: ["copyButton"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "shareInput", first: true, predicate: ["shareInput"], descendants: true, isSignal: true }, { propertyName: "shareDialog", first: true, predicate: ["shareDialog"], descendants: true, isSignal: true }, { propertyName: "sidebar", first: true, predicate: ["sidebar"], descendants: true, isSignal: true }], ngImport: i0, template: "@let _option = option();\n@let _compact = compact();\n@let _autoId = autoId();\n@let _canUpload = canUpload();\n@let _canDownload = canDownload();\n@let _view = view();\n@let _state = contentState();\n@let _keyword = keyword();\n@let _sidebarOpen = sidebarOpen();\n@let _preview = previewView();\n@let _transfers = transferViews();\n@let _heading = heading();\n@let _searching = searching();\n@let _collapsed = transfersCollapsed();\n@let _dialogOpen = folderDialogOpen();\n@let _shareItem = shareItem();\n@let _canShare = canShare();\n@let _modalOpen = _dialogOpen || !!_shareItem;\n\n<header class=\"header\" [attr.inert]=\"_modalOpen ? '' : null\">\n @if (_option.title) {\n <div class=\"brand\">\n <span class=\"brand-icon\" aria-hidden=\"true\">\n <sd-icon name=\"folder\" size=\"20px\" />\n </span>\n <div class=\"brand-text\">\n <h2 class=\"brand-title\" [title]=\"_option.title\">{{ _option.title }}</h2>\n @if (_option.description) {\n <p class=\"brand-description\">{{ _option.description }}</p>\n }\n </div>\n </div>\n }\n\n <div class=\"search\" role=\"search\">\n <sd-icon class=\"search-icon\" name=\"search\" size=\"20px\" />\n <input\n #searchInput\n type=\"search\"\n class=\"search-input\"\n autocomplete=\"off\"\n [value]=\"_keyword\"\n [placeholder]=\"'core.component.file-explorer.search-placeholder' | sdTranslate\"\n [attr.aria-label]=\"'core.component.file-explorer.search-placeholder' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-search' : null\"\n (input)=\"onKeywordInput(searchInput.value)\" />\n @if (_keyword) {\n <button\n type=\"button\"\n class=\"search-clear\"\n [attr.aria-label]=\"'core.component.file-explorer.search-clear' | sdTranslate\"\n [title]=\"'core.component.file-explorer.search-clear' | sdTranslate\"\n (click)=\"clearSearch()\">\n <sd-icon name=\"close\" size=\"18px\" />\n </button>\n }\n </div>\n\n @if (_canUpload) {\n <sd-button\n class=\"upload-button\"\n type=\"fill\"\n color=\"primary\"\n size=\"md\"\n prefixIcon=\"file_upload\"\n [title]=\"_compact ? undefined : ('core.component.file-explorer.upload' | sdTranslate)\"\n [tooltip]=\"_compact ? ('core.component.file-explorer.upload' | sdTranslate) : undefined\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-upload' : null\"\n (click)=\"fileInput.click()\" />\n <input\n #fileInput\n type=\"file\"\n class=\"file-input\"\n multiple\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-file-input' : null\"\n (change)=\"onFilesPicked(fileInput)\" />\n }\n</header>\n\n<!-- why: dialog ph\u1EE7 c\u1EA3 explorer n\u00EAn l\u00E0m inert c\u1EA3 v\u00F9ng n\u00E0y, k\u1EC3 c\u1EA3 drawer chi ti\u1EBFt \u0111ang n\u1EB1m trong .main. -->\n<div class=\"body\" [attr.inert]=\"_modalOpen ? '' : null\">\n @if (_compact && _sidebarOpen) {\n <div class=\"scrim scrim--sidebar\" aria-hidden=\"true\" (click)=\"sidebarOpen.set(false)\"></div>\n }\n <aside\n #sidebar\n class=\"sidebar\"\n [class.sidebar--open]=\"_sidebarOpen\"\n [id]=\"instanceId + '-sidebar'\"\n [attr.aria-label]=\"'core.component.file-explorer.folders' | sdTranslate\"\n [attr.inert]=\"_compact && !_sidebarOpen ? '' : null\">\n <p class=\"sidebar-label\">{{ 'core.component.file-explorer.folders' | sdTranslate }}</p>\n <div class=\"sidebar-tree\">\n <sd-file-explorer-folder-tree\n [nodes]=\"treeNodes()\"\n [label]=\"'core.component.file-explorer.tree-label' | sdTranslate\"\n (select)=\"onTreeSelect($event)\"\n (toggle)=\"onTreeToggle($event)\"\n (retry)=\"onTreeRetry($event)\" />\n </div>\n @if (canCreateFolder()) {\n <div class=\"sidebar-footer\">\n <sd-button\n #newFolderButton\n class=\"new-folder-button\"\n type=\"outline\"\n color=\"secondary\"\n size=\"md\"\n prefixIcon=\"add\"\n block\n [title]=\"'core.component.file-explorer.new-folder' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-new-folder' : null\"\n (click)=\"openFolderDialog()\" />\n </div>\n }\n </aside>\n\n <!-- why: .main l\u00E0 [container] c\u1EE7a drawer chi ti\u1EBFt \u2014 backdrop ch\u1EC9 ph\u1EE7 v\u00F9ng b\u00EAn ph\u1EA3i, c\u00E2y th\u01B0 m\u1EE5c v\u1EABn d\u00F9ng \u0111\u01B0\u1EE3c.\n Drawer n\u1EB1m TRONG ph\u1EA7n t\u1EED n\u00E0y n\u00EAn inert \u0111\u1EB7t tr\u00EAn t\u1EEBng kh\u1ED1i con, kh\u00F4ng \u0111\u1EB7t tr\u00EAn .main. -->\n <section #mainRegion class=\"main\" [attr.aria-label]=\"_heading\">\n @if (refreshing()) {\n <div class=\"refresh-bar\" aria-hidden=\"true\"></div>\n }\n <div class=\"toolbar\" [attr.inert]=\"_preview ? '' : null\">\n @if (_compact) {\n <button\n type=\"button\"\n class=\"icon-button\"\n [attr.aria-expanded]=\"_sidebarOpen\"\n [attr.aria-controls]=\"instanceId + '-sidebar'\"\n [attr.aria-label]=\"\n (_sidebarOpen ? 'core.component.file-explorer.close-folders' : 'core.component.file-explorer.open-folders') | sdTranslate\n \"\n [attr.data-autoid]=\"_autoId ? _autoId + '-menu' : null\"\n (click)=\"toggleSidebar()\">\n <sd-icon name=\"menu\" size=\"24px\" />\n </button>\n }\n <sd-breadcrumb\n class=\"breadcrumb\"\n [items]=\"breadcrumb().items\"\n [maxItems]=\"_compact ? 3 : 5\"\n [ariaLabel]=\"'core.component.file-explorer.breadcrumb' | sdTranslate\"\n (sdItemActivate)=\"onBreadcrumb($event)\" />\n <div class=\"view-toggle\" role=\"group\" [attr.aria-label]=\"'core.component.file-explorer.view' | sdTranslate\">\n <button\n type=\"button\"\n class=\"icon-button icon-button--toggle\"\n [class.icon-button--active]=\"_view === 'list'\"\n [attr.aria-pressed]=\"_view === 'list'\"\n [attr.aria-label]=\"'core.component.file-explorer.view-list' | sdTranslate\"\n [title]=\"'core.component.file-explorer.view-list' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-view-list' : null\"\n (click)=\"setView('list')\">\n <sd-icon name=\"format_list_bulleted\" size=\"24px\" />\n </button>\n <button\n type=\"button\"\n class=\"icon-button icon-button--toggle\"\n [class.icon-button--active]=\"_view === 'grid'\"\n [attr.aria-pressed]=\"_view === 'grid'\"\n [attr.aria-label]=\"'core.component.file-explorer.view-grid' | sdTranslate\"\n [title]=\"'core.component.file-explorer.view-grid' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-view-grid' : null\"\n (click)=\"setView('grid')\">\n <sd-icon name=\"grid_view\" size=\"24px\" />\n </button>\n </div>\n </div>\n\n <div class=\"heading-row\" [attr.inert]=\"_preview ? '' : null\">\n <h3 class=\"heading\" [title]=\"_heading\">{{ _heading }}</h3>\n @if (_state === 'items') {\n <span class=\"count\">{{ itemCountLabel() }}</span>\n }\n </div>\n\n <div class=\"scroller\" [attr.inert]=\"_preview ? '' : null\">\n @switch (_state) {\n @case ('loading') {\n <sd-data-state\n state=\"loading\"\n compact\n [title]=\"(_searching ? 'core.component.file-explorer.search-loading' : 'core.component.file-explorer.loading') | sdTranslate\" />\n }\n @case ('error') {\n <sd-data-state\n state=\"error\"\n retryable\n [title]=\"(_searching ? 'core.component.file-explorer.search-error' : 'core.component.file-explorer.load-error') | sdTranslate\"\n [message]=\"errorMessage()\"\n [retryLabel]=\"'core.component.file-explorer.retry' | sdTranslate\"\n (sdRetry)=\"retryContent()\" />\n }\n @case ('empty') {\n <sd-data-state\n state=\"empty\"\n [icon]=\"_searching ? 'search_off' : 'folder_open'\"\n [title]=\"emptyTitle()\"\n [message]=\"emptyMessage()\" />\n }\n @default {\n <sd-file-explorer-item-list\n [items]=\"itemViews()\"\n [view]=\"_view\"\n [canDownload]=\"_canDownload\"\n [canShare]=\"_canShare\"\n [compact]=\"_compact\"\n [activeId]=\"_preview ? _preview.item.id : null\"\n [label]=\"_heading\"\n (activate)=\"onActivate($event)\"\n (download)=\"downloadItem($event.item)\"\n (share)=\"openShare($event.item)\" />\n }\n }\n </div>\n </section>\n</div>\n\n@if (_transfers.length) {\n <sd-file-explorer-transfer-panel\n class=\"transfers\"\n [attr.inert]=\"_modalOpen ? '' : null\"\n [transfers]=\"_transfers\"\n [title]=\"transfersTitle()\"\n [collapsed]=\"_collapsed\"\n [canClear]=\"canClearTransfers()\"\n [compact]=\"_compact\"\n [autoId]=\"_autoId ? _autoId + '-transfers' : undefined\"\n (toggleCollapsed)=\"transfersCollapsed.set(!_collapsed)\"\n (clear)=\"clearFinishedTransfers()\"\n (cancel)=\"cancelTransfer($event)\"\n (retry)=\"retryTransfer($event)\"\n (dismiss)=\"dismissTransfer($event)\" />\n}\n\n<!-- why: chi ti\u1EBFt file l\u00E0 sd-side-drawer th\u1EADt, m\u1EDF g\u1ECDn trong v\u00F9ng danh s\u00E1ch b\u00EAn ph\u1EA3i nh\u1EDD [container]:\n header (t\u00ECm ki\u1EBFm, t\u1EA3i l\u00EAn), c\u00E2y th\u01B0 m\u1EE5c v\u00E0 h\u00E0ng ch\u1EDD truy\u1EC1n t\u1EA3i v\u1EABn d\u00F9ng \u0111\u01B0\u1EE3c khi drawer m\u1EDF. -->\n<sd-file-explorer-preview-panel\n [view]=\"_preview\"\n [state]=\"previewState()\"\n [meta]=\"previewMeta()\"\n [canDownload]=\"_canDownload\"\n [canShare]=\"_canShare\"\n [container]=\"mainRegion\"\n [autoId]=\"_autoId ? _autoId + '-preview' : undefined\"\n (close)=\"closePreview()\"\n (download)=\"downloadPreview()\"\n (share)=\"sharePreview()\"\n (retry)=\"retryPreview()\"\n (imageError)=\"onPreviewImageError()\" />\n\n@if (dragActive()) {\n <div class=\"drop-overlay\" aria-hidden=\"true\">\n <div class=\"drop-card\">\n <sd-icon name=\"file_upload\" size=\"40px\" />\n <p class=\"drop-title\">{{ dropTitle() }}</p>\n </div>\n </div>\n}\n\n@if (_dialogOpen) {\n @let _folderName = folderName();\n @let _folderError = folderError();\n <div class=\"dialog-backdrop\" aria-hidden=\"true\" (click)=\"closeFolderDialog()\"></div>\n <form\n class=\"dialog\"\n role=\"dialog\"\n aria-modal=\"true\"\n novalidate\n [attr.aria-labelledby]=\"instanceId + '-folder-title'\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-folder-dialog' : null\"\n (submit)=\"submitFolder($event)\">\n <h3 class=\"dialog-title\" [id]=\"instanceId + '-folder-title'\">{{ folderDialogTitle() }}</h3>\n <label class=\"field-label\" [for]=\"instanceId + '-folder-name'\">{{\n 'core.component.file-explorer.new-folder-name' | sdTranslate\n }}</label>\n <input\n #folderInput\n class=\"field-input\"\n autocomplete=\"off\"\n maxlength=\"255\"\n [id]=\"instanceId + '-folder-name'\"\n [value]=\"_folderName\"\n [attr.aria-invalid]=\"_folderError ? true : null\"\n [attr.aria-describedby]=\"_folderError ? instanceId + '-folder-error' : null\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-folder-name' : null\"\n (input)=\"folderName.set(folderInput.value)\" />\n @if (_folderError) {\n <p class=\"field-error\" role=\"alert\" [id]=\"instanceId + '-folder-error'\">{{ _folderError }}</p>\n }\n <div class=\"dialog-actions\">\n <sd-button\n class=\"cancel-button\"\n type=\"text\"\n color=\"secondary\"\n size=\"md\"\n [title]=\"'core.component.file-explorer.cancel' | sdTranslate\"\n (click)=\"closeFolderDialog()\" />\n <sd-button\n class=\"submit-button\"\n type=\"fill\"\n color=\"primary\"\n size=\"md\"\n htmlType=\"submit\"\n [title]=\"'core.component.file-explorer.create' | sdTranslate\"\n [disabled]=\"!_folderName.trim()\"\n [loading]=\"folderSubmitting()\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-folder-submit' : null\" />\n </div>\n </form>\n}\n\n@if (_shareItem) {\n @let _shareState = shareState();\n <div class=\"dialog-backdrop\" aria-hidden=\"true\" (click)=\"closeShare()\"></div>\n <div\n #shareDialog\n class=\"dialog\"\n role=\"dialog\"\n aria-modal=\"true\"\n tabindex=\"-1\"\n [attr.aria-labelledby]=\"instanceId + '-share-title'\"\n [attr.aria-busy]=\"_shareState.status === 'loading' ? true : null\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-share-dialog' : null\">\n <h3 class=\"dialog-title\" [id]=\"instanceId + '-share-title'\" [title]=\"_shareItem.name\">{{ shareTitle() }}</h3>\n @switch (_shareState.status) {\n @case ('loading') {\n <p class=\"share-status\" role=\"status\">\n <span class=\"spinner\" aria-hidden=\"true\"></span>\n {{ 'core.component.file-explorer.share.loading' | sdTranslate }}\n </p>\n }\n @case ('error') {\n <p class=\"field-error\" role=\"alert\">{{ _shareState.message }}</p>\n }\n @case ('ready') {\n <label class=\"field-label\" [for]=\"instanceId + '-share-link'\">{{ 'core.component.file-explorer.share.link' | sdTranslate }}</label>\n <input\n #shareInput\n class=\"field-input\"\n readonly\n [id]=\"instanceId + '-share-link'\"\n [value]=\"_shareState.url\"\n [attr.aria-describedby]=\"instanceId + '-share-feedback'\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-share-link' : null\"\n (focus)=\"shareInput.select()\" />\n <p class=\"share-feedback\" role=\"status\" aria-live=\"polite\" [id]=\"instanceId + '-share-feedback'\">{{ shareFeedbackLabel() }}</p>\n }\n }\n <div class=\"dialog-actions\">\n <sd-button\n class=\"close-button\"\n type=\"text\"\n color=\"secondary\"\n size=\"md\"\n [title]=\"'core.component.file-explorer.close' | sdTranslate\"\n (click)=\"closeShare()\" />\n @if (_shareState.status === 'error') {\n <sd-button\n class=\"retry-button\"\n type=\"outline\"\n color=\"primary\"\n size=\"md\"\n prefixIcon=\"refresh\"\n [title]=\"'core.component.file-explorer.retry' | sdTranslate\"\n (click)=\"retryShare()\" />\n } @else {\n <sd-button\n #copyButton\n class=\"copy-button\"\n type=\"fill\"\n color=\"primary\"\n size=\"md\"\n prefixIcon=\"content_copy\"\n [title]=\"\n (shareFeedback() === 'copied' ? 'core.component.file-explorer.share.copied' : 'core.component.file-explorer.share.copy')\n | sdTranslate\n \"\n [disabled]=\"_shareState.status !== 'ready'\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-share-copy' : null\"\n (click)=\"copyShareLink()\" />\n }\n </div>\n </div>\n}\n", styles: [":host{--sd-fe-accent: var(--sd-file-explorer-accent, var(--sd-primary, #005cbb));--sd-fe-accent-strong: var(--sd-file-explorer-accent-strong, color-mix(in srgb, var(--sd-fe-accent) 84%, var(--sd-file-explorer-mix-shade, #000000)));--sd-fe-accent-contrast: var(--sd-file-explorer-accent-contrast, var(--sd-primary-contrast, #ffffff));--sd-fe-accent-soft: var(--sd-file-explorer-accent-soft, color-mix(in srgb, var(--sd-fe-accent) 10%, var(--sd-file-explorer-mix-tint, #ffffff)));--sd-fe-surface: var(--sd-file-explorer-surface, #ffffff);--sd-fe-sidebar-bg: var(--sd-file-explorer-sidebar-bg, color-mix(in srgb, var(--sd-surface-muted, #e7e8ed) 26%, var(--sd-fe-surface)));--sd-fe-muted-surface: var( --sd-file-explorer-muted-surface, color-mix(in srgb, var(--sd-surface-muted, #e7e8ed) 50%, var(--sd-fe-surface)) );--sd-fe-preview-bg: var(--sd-file-explorer-preview-bg, color-mix(in srgb, var(--sd-fe-accent) 9%, var(--sd-file-explorer-mix-tint, #ffffff)));--sd-fe-border: var(--sd-file-explorer-border, color-mix(in srgb, var(--sd-border, #c4c6d0) 55%, var(--sd-file-explorer-mix-tint, #ffffff)));--sd-fe-border-strong: var(--sd-file-explorer-border-strong, var(--sd-border, #c4c6d0));--sd-fe-text: var(--sd-file-explorer-text, var(--sd-text, #1a1b1f));--sd-fe-text-secondary: var(--sd-file-explorer-text-secondary, color-mix(in srgb, var(--sd-text-secondary, #44474f) 84%, var(--sd-file-explorer-mix-tint, #ffffff)));--sd-fe-hover: color-mix(in srgb, var(--sd-fe-text) 4%, transparent);--sd-fe-hover-strong: color-mix(in srgb, var(--sd-fe-text) 8%, transparent);--sd-fe-track: color-mix(in srgb, var(--sd-fe-text) 7%, var(--sd-fe-surface));--sd-fe-success: var(--sd-file-explorer-success, var(--sd-success, #2e7d32));--sd-fe-error: var(--sd-file-explorer-error, var(--sd-error, #ba1a1a));--sd-fe-radius: var(--sd-file-explorer-radius, 16px);--sd-fe-scrim: var(--sd-file-explorer-scrim, rgba(0, 0, 0, .4));--sd-side-drawer-contained-z-index: 9;position:relative;display:flex;flex-direction:column;height:100%;min-height:480px;overflow:hidden;border:1px solid var(--sd-fe-border);border-radius:var(--sd-fe-radius);background:var(--sd-fe-surface);color:var(--sd-fe-text);font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-line-height-20, 20px)}.header{display:grid;grid-template-columns:fit-content(320px) minmax(0,1fr) auto;align-items:center;gap:12px 20px;padding:16px 20px;border-bottom:1px solid var(--sd-fe-border)}.brand{grid-column:1;display:flex;align-items:center;gap:10px;min-width:0}.brand-icon{flex:none;display:grid;place-items:center;width:32px;height:32px;border-radius:50%;background:color-mix(in srgb,var(--sd-fe-accent) 14%,var(--sd-file-explorer-mix-tint, #ffffff));color:var(--sd-fe-accent)}.brand-text{min-width:0}.brand-title{margin:0;overflow:hidden;font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-semibold, 600);line-height:var(--sd-line-height-22, 22px);text-overflow:ellipsis;white-space:nowrap}.brand-description{margin:0;overflow:hidden;font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-line-height-16, 16px);color:var(--sd-fe-text-secondary);text-overflow:ellipsis;white-space:nowrap}.search{grid-column:2;justify-self:center;display:flex;align-items:center;gap:8px;width:100%;max-width:520px;height:36px;padding:0 6px 0 12px;border:1px solid var(--sd-fe-border);border-radius:var(--sd-radius-999, 999px);background:var(--sd-fe-muted-surface);transition:border-color var(--sd-duration-fast, .12s) ease,box-shadow var(--sd-duration-fast, .12s) ease}.search:focus-within{border-color:var(--sd-fe-accent);background:var(--sd-fe-surface);box-shadow:0 0 0 3px var(--sd-fe-accent-soft)}.search-icon{flex:none;color:var(--sd-fe-text-secondary)}.search-input{flex:1;min-width:0;height:100%;padding:0;border:0;outline:none;background:transparent;color:var(--sd-fe-text);font:inherit;font-size:var(--sd-font-size-14, 14px)}.search-input::placeholder{color:var(--sd-fe-text-secondary)}.search-input::-webkit-search-cancel-button{display:none}.search-clear{flex:none;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;border:0;border-radius:var(--sd-radius-999, 999px);background:transparent;color:var(--sd-fe-text-secondary);cursor:pointer}.search-clear:hover{background:var(--sd-fe-hover-strong)}.upload-button{grid-column:3;justify-self:end}.file-input{display:none}.body{position:relative;flex:1;min-height:0;display:grid;grid-template-columns:238px minmax(0,1fr)}.sidebar{display:flex;flex-direction:column;min-height:0;padding:22px 14px 32px 12px;border-right:1px solid var(--sd-fe-border);background:var(--sd-fe-sidebar-bg)}.sidebar-label{margin:0 0 6px 10px;font-size:var(--sd-font-size-12, 12px);font-weight:var(--sd-font-weight-bold, 700);line-height:var(--sd-line-height-16, 16px);letter-spacing:.04em;text-transform:uppercase;color:var(--sd-fe-text-secondary)}.sidebar-tree{flex:1;min-height:0;margin:0 -4px;padding:2px 4px;overflow-y:auto}.sidebar-footer{margin:12px 4px 0;padding-top:18px;border-top:1px solid var(--sd-fe-border)}.new-folder-button{display:block}.main{position:relative;display:flex;flex-direction:column;min-width:0;min-height:0;padding-top:14px}.refresh-bar{position:absolute;top:0;left:0;right:0;height:2px;overflow:hidden;background:var(--sd-fe-accent-soft)}.refresh-bar:after{content:\"\";position:absolute;top:0;bottom:0;width:30%;background:var(--sd-fe-accent);animation:sd-file-explorer-refresh 1.2s ease-in-out infinite}.toolbar{display:flex;align-items:center;gap:12px;min-height:40px;padding:0 32px}.breadcrumb{flex:1;min-width:0;margin-left:-4px;font-size:var(--sd-font-size-15, 15px);font-weight:var(--sd-font-weight-semibold, 600)}.view-toggle{flex:none;display:flex;gap:2px;padding:2px;border:1px solid var(--sd-fe-border);border-radius:var(--sd-radius-999, 999px);background:var(--sd-fe-surface)}.icon-button{flex:none;display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;padding:0;border:0;border-radius:var(--sd-radius-999, 999px);background:transparent;color:var(--sd-fe-text-secondary);cursor:pointer}.icon-button:hover{background:var(--sd-fe-hover-strong);color:var(--sd-fe-text)}.icon-button:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-file-explorer-accent, var(--sd-focus-ring-color, var(--sd-primary)));outline-offset:1px}.icon-button--toggle{width:40px;height:32px}.icon-button--active,.icon-button--active:hover{background:var(--sd-fe-accent-soft);color:var(--sd-fe-accent)}.heading-row{display:flex;align-items:flex-end;justify-content:space-between;gap:12px;margin-top:10px;padding:0 32px}.heading{min-width:0;margin:0;overflow:hidden;font-size:var(--sd-font-size-18, 18px);font-weight:var(--sd-font-weight-bold, 700);line-height:26px;text-overflow:ellipsis;white-space:nowrap}.count{flex:none;padding-bottom:12px;font-size:var(--sd-font-size-13, 13px);color:var(--sd-fe-text-secondary)}.scroller{flex:1;min-height:0;padding:8px 28px 16px;overflow-y:auto}.scrim{position:absolute;inset:0;background:var(--sd-fe-scrim);animation:sd-file-explorer-fade .18s ease}.transfers{flex:none;border-top:1px solid var(--sd-fe-border);background:var(--sd-fe-surface)}.drop-overlay{position:absolute;inset:0;z-index:10;display:flex;align-items:center;justify-content:center;padding:16px;border:2px dashed var(--sd-fe-accent);border-radius:var(--sd-fe-radius);background:color-mix(in srgb,var(--sd-fe-accent) 8%,rgba(255,255,255,.86));pointer-events:none}.drop-card{display:flex;flex-direction:column;align-items:center;gap:10px;color:var(--sd-fe-accent);text-align:center}.drop-title{margin:0;font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-semibold, 600)}.dialog-backdrop{position:absolute;inset:0;z-index:20;background:var(--sd-fe-scrim)}.dialog{position:absolute;top:50%;left:50%;z-index:21;display:flex;flex-direction:column;gap:8px;width:min(400px,100% - 32px);padding:20px;border-radius:14px;background:var(--sd-fe-surface);box-shadow:0 18px 48px #0f172a2e;transform:translate(-50%,-50%)}.dialog:focus{outline:none}.dialog-title{margin:0 0 8px;font-size:17px;font-weight:var(--sd-font-weight-semibold, 600);line-height:var(--sd-line-height-24, 24px)}.field-label{font-size:var(--sd-font-size-13, 13px);color:var(--sd-fe-text-secondary)}.field-input{height:40px;padding:0 12px;border:1px solid var(--sd-fe-border-strong);border-radius:var(--sd-radius-8, 8px);background:var(--sd-fe-surface);color:var(--sd-fe-text);font:inherit;font-size:var(--sd-font-size-15, 15px);outline:none}.field-input:focus{border-color:var(--sd-fe-accent);box-shadow:0 0 0 3px var(--sd-fe-accent-soft)}.field-input[aria-invalid=true]{border-color:var(--sd-fe-error)}.field-error{margin:0;font-size:var(--sd-font-size-13, 13px);color:var(--sd-fe-error)}.dialog-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:12px}.share-status{display:flex;align-items:center;gap:10px;margin:4px 0;font-size:var(--sd-font-size-14, 14px);color:var(--sd-fe-text-secondary)}.share-feedback{min-height:18px;margin:0;font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-18, 18px);color:var(--sd-fe-success)}.spinner{flex:none;width:18px;height:18px;border:2px solid color-mix(in srgb,var(--sd-fe-accent) 20%,transparent);border-top-color:var(--sd-fe-accent);border-radius:50%;animation:sd-file-explorer-spin .8s linear infinite}:host(.sd-file-explorer--compact) .header{grid-template-columns:minmax(0,1fr) auto;gap:10px 12px;padding:12px 14px}:host(.sd-file-explorer--compact) .brand{grid-row:1;gap:10px}:host(.sd-file-explorer--compact) .upload-button{grid-column:2;grid-row:1}:host(.sd-file-explorer--compact) .search{grid-column:1/-1;grid-row:2;max-width:none}:host(.sd-file-explorer--compact) .header:not(:has(.brand)) .search{grid-column:1;grid-row:1}:host(.sd-file-explorer--compact) .body{grid-template-columns:minmax(0,1fr)}:host(.sd-file-explorer--compact) .sidebar{position:absolute;top:0;bottom:0;left:0;z-index:5;width:min(300px,86%);border-right:1px solid var(--sd-fe-border);box-shadow:12px 0 32px #0f172a1f;visibility:hidden;transform:translate(-100%);transition:transform var(--sd-duration-base, .2s) ease,visibility var(--sd-duration-base, .2s)}:host(.sd-file-explorer--compact) .sidebar--open{visibility:visible;transform:none}:host(.sd-file-explorer--compact) .scrim--sidebar{z-index:4}:host(.sd-file-explorer--compact) .main{padding-top:8px}:host(.sd-file-explorer--compact) .toolbar{gap:6px;min-height:36px;padding:0 12px 0 10px}:host(.sd-file-explorer--compact) .breadcrumb{margin-left:0}:host(.sd-file-explorer--compact) .icon-button--toggle{width:36px}:host(.sd-file-explorer--compact) .heading-row{margin-top:13px;padding:0 14px}:host(.sd-file-explorer--compact) .count{padding-bottom:8px}:host(.sd-file-explorer--compact) .scroller{padding:0 12px 12px}@keyframes sd-file-explorer-spin{to{transform:rotate(360deg)}}@keyframes sd-file-explorer-fade{0%{opacity:0}}@keyframes sd-file-explorer-refresh{0%{left:-30%}to{left:100%}}@media(prefers-reduced-motion:reduce){.scrim{animation:none}.search,:host(.sd-file-explorer--compact) .sidebar{transition:none}}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "component", type: SdBreadcrumb, selector: "sd-breadcrumb", inputs: ["items", "maxItems", "ariaLabel", "separator"], outputs: ["sdItemActivate"] }, { kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "openOnHover", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "component", type: SdDataState, selector: "sd-data-state", inputs: ["state", "title", "message", "icon", "fontSet", "iconShape", "retryable", "retryLabel", "actionLabel", "compact", "fullPage"], outputs: ["sdRetry", "sdAction"] }, { kind: "component", type: SdFileExplorerFolderTree, selector: "sd-file-explorer-folder-tree", inputs: ["nodes", "label"], outputs: ["select", "toggle", "retry"] }, { kind: "component", type: SdFileExplorerItemList, selector: "sd-file-explorer-item-list", inputs: ["items", "view", "canDownload", "canShare", "compact", "activeId", "label"], outputs: ["activate", "download", "share"] }, { kind: "component", type: SdFileExplorerPreviewPanel, selector: "sd-file-explorer-preview-panel", inputs: ["view", "state", "meta", "canDownload", "canShare", "container", "autoId"], outputs: ["close", "download", "share", "retry", "imageError"] }, { kind: "component", type: SdFileExplorerTransferPanel, selector: "sd-file-explorer-transfer-panel", inputs: ["transfers", "title", "collapsed", "canClear", "compact", "autoId"], outputs: ["toggleCollapsed", "clear", "cancel", "retry", "dismiss"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
4883
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdFileExplorer, isStandalone: true, selector: "sd-file-explorer", inputs: { option: { classPropertyName: "option", publicName: "option", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { open: "open" }, host: { listeners: { "dragenter": "onDragEnter($event)", "dragover": "onDragOver($event)", "dragleave": "onDragLeave()", "drop": "onDrop($event)", "dragstart": "onMoveDragStart($event)", "dragend": "onMoveDragEnd()", "keydown.escape": "onEscape($event)" }, properties: { "class.sd-file-explorer--compact": "compact()", "class.sd-file-explorer--touch": "touch()", "class.sd-file-explorer--dragging": "dragActive()", "attr.data-autoid": "autoId()" }, classAttribute: "sd-file-explorer" }, queries: [{ propertyName: "columnDefs", predicate: SdFileExplorerColumnDef, isSignal: true }], viewQueries: [{ propertyName: "searchInput", first: true, predicate: ["searchInput"], descendants: true, isSignal: true }, { propertyName: "folderInput", first: true, predicate: ["folderInput"], descendants: true, isSignal: true }, { propertyName: "newFolderButton", first: true, predicate: ["newFolderButton"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "copyButton", first: true, predicate: ["copyButton"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "shareInput", first: true, predicate: ["shareInput"], descendants: true, isSignal: true }, { propertyName: "shareDialog", first: true, predicate: ["shareDialog"], descendants: true, isSignal: true }, { propertyName: "sidebar", first: true, predicate: ["sidebar"], descendants: true, isSignal: true }, { propertyName: "commandDrawer", first: true, predicate: SdFileExplorerCommandSheet, descendants: true, isSignal: true }], ngImport: i0, template: "@let _option = option();\n@let _compact = compact();\n@let _autoId = autoId();\n@let _canUpload = canUpload();\n@let _canDownload = canDownload();\n@let _view = view();\n@let _state = contentState();\n@let _keyword = keyword();\n@let _sidebarOpen = sidebarOpen();\n@let _preview = previewView();\n@let _transfers = transferViews();\n@let _heading = heading();\n@let _searching = searching();\n@let _collapsed = transfersCollapsed();\n@let _dialogOpen = folderDialogOpen();\n@let _shareItem = shareItem();\n@let _canShare = canShare();\n@let _modalOpen = _dialogOpen || !!_shareItem || !!movePickerItems();\n@let _touch = touch();\n@let _rowShortcuts = rowShortcuts();\n\n<header class=\"header\" [attr.inert]=\"_modalOpen ? '' : null\">\n @if (_option.title) {\n <div class=\"brand\">\n <span class=\"brand-icon\" aria-hidden=\"true\">\n <sd-icon name=\"folder\" size=\"20px\" />\n </span>\n <div class=\"brand-text\">\n <h2 class=\"brand-title\" [title]=\"_option.title\">{{ _option.title }}</h2>\n @if (_option.description) {\n <p class=\"brand-description\">{{ _option.description }}</p>\n }\n </div>\n </div>\n }\n\n <div class=\"search\" role=\"search\">\n <sd-icon class=\"search-icon\" name=\"search\" size=\"20px\" />\n <input\n #searchInput\n type=\"search\"\n class=\"search-input\"\n autocomplete=\"off\"\n [value]=\"_keyword\"\n [placeholder]=\"'core.component.file-explorer.search-placeholder' | sdTranslate\"\n [attr.aria-label]=\"'core.component.file-explorer.search-placeholder' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-search' : null\"\n (input)=\"onKeywordInput(searchInput.value)\" />\n @if (_keyword) {\n <button\n type=\"button\"\n class=\"search-clear\"\n [attr.aria-label]=\"'core.component.file-explorer.search-clear' | sdTranslate\"\n [title]=\"'core.component.file-explorer.search-clear' | sdTranslate\"\n (click)=\"clearSearch()\">\n <sd-icon name=\"close\" size=\"18px\" />\n </button>\n }\n </div>\n\n @if (_canUpload) {\n <sd-button\n class=\"upload-button\"\n [disabled]=\"uploadDisabled()\"\n [attr.aria-description]=\"uploadDisabled() ? ('core.component.file-explorer.action-unavailable' | sdTranslate) : null\"\n type=\"fill\"\n color=\"primary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n prefixIcon=\"file_upload\"\n [title]=\"_compact ? undefined : ('core.component.file-explorer.upload' | sdTranslate)\"\n [tooltip]=\"_compact ? ('core.component.file-explorer.upload' | sdTranslate) : undefined\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-upload' : null\"\n (click)=\"fileInput.click()\" />\n <input\n #fileInput\n type=\"file\"\n class=\"file-input\"\n multiple\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-file-input' : null\"\n (change)=\"onFilesPicked(fileInput)\" />\n }\n</header>\n\n@if (moveStatus()) {\n <sd-inform class=\"move-status\" color=\"secondary\" [hideIcon]=\"true\" [title]=\"moveStatus()!\">\n @if (moveRefreshError()) {\n <sd-button\n sdInformAction\n class=\"move-retry-button\"\n type=\"light\"\n color=\"primary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n htmlType=\"button\"\n [title]=\"'core.component.file-explorer.move.retry-refresh' | sdTranslate\"\n [disabled]=\"movePending()\"\n (click)=\"retryMoveRefresh()\" />\n }\n </sd-inform>\n}\n\n<!-- why: dialog ph\u1EE7 c\u1EA3 explorer n\u00EAn l\u00E0m inert c\u1EA3 v\u00F9ng n\u00E0y, k\u1EC3 c\u1EA3 drawer chi ti\u1EBFt \u0111ang n\u1EB1m trong .main. -->\n<div class=\"body\" [attr.inert]=\"_modalOpen ? '' : null\">\n @if (_compact && _sidebarOpen) {\n <div class=\"scrim scrim--sidebar\" aria-hidden=\"true\" (click)=\"sidebarOpen.set(false)\"></div>\n }\n <aside\n #sidebar\n class=\"sidebar\"\n [class.sidebar--open]=\"_sidebarOpen\"\n [id]=\"instanceId + '-sidebar'\"\n [attr.aria-label]=\"'core.component.file-explorer.folders' | sdTranslate\"\n [attr.inert]=\"_compact && !_sidebarOpen ? '' : null\">\n <p class=\"sidebar-label\">{{ 'core.component.file-explorer.folders' | sdTranslate }}</p>\n <div class=\"sidebar-tree\">\n <sd-file-explorer-folder-tree\n [nodes]=\"treeNodes()\"\n [moveDropTarget]=\"moveDropTarget()\"\n [label]=\"'core.component.file-explorer.tree-label' | sdTranslate\"\n [commands]=\"_option.folderCommands\"\n [touch]=\"_touch\"\n [compact]=\"_compact\"\n [menuOpenId]=\"treeMenuOpenId()\"\n (select)=\"onTreeSelect($event)\"\n (toggle)=\"onTreeToggle($event)\"\n (retry)=\"onTreeRetry($event)\"\n (openCommands)=\"openCommands($event.item, 'tree', $event.trigger)\" />\n </div>\n @if (canCreateFolder()) {\n <div class=\"sidebar-footer\">\n <sd-button\n #newFolderButton\n class=\"new-folder-button\"\n [disabled]=\"createDisabled()\"\n [attr.aria-description]=\"createDisabled() ? ('core.component.file-explorer.action-unavailable' | sdTranslate) : null\"\n type=\"outline\"\n color=\"secondary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n prefixIcon=\"add\"\n block\n [title]=\"'core.component.file-explorer.new-folder' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-new-folder' : null\"\n (click)=\"openFolderDialog()\" />\n </div>\n }\n </aside>\n\n <!-- why: .main l\u00E0 [container] c\u1EE7a drawer chi ti\u1EBFt \u2014 backdrop ch\u1EC9 ph\u1EE7 v\u00F9ng b\u00EAn ph\u1EA3i, c\u00E2y th\u01B0 m\u1EE5c v\u1EABn d\u00F9ng \u0111\u01B0\u1EE3c.\n Drawer n\u1EB1m TRONG ph\u1EA7n t\u1EED n\u00E0y n\u00EAn inert \u0111\u1EB7t tr\u00EAn t\u1EEBng kh\u1ED1i con, kh\u00F4ng \u0111\u1EB7t tr\u00EAn .main. -->\n <section #mainRegion class=\"main\" [attr.aria-label]=\"_heading\">\n @if (refreshing()) {\n <div class=\"refresh-bar\" aria-hidden=\"true\"></div>\n }\n <div class=\"toolbar\" [attr.inert]=\"_preview ? '' : null\">\n @if (_compact) {\n <button\n type=\"button\"\n class=\"icon-button\"\n [attr.aria-expanded]=\"_sidebarOpen\"\n [attr.aria-controls]=\"instanceId + '-sidebar'\"\n [attr.aria-label]=\"\n (_sidebarOpen ? 'core.component.file-explorer.close-folders' : 'core.component.file-explorer.open-folders') | sdTranslate\n \"\n [attr.data-autoid]=\"_autoId ? _autoId + '-menu' : null\"\n (click)=\"toggleSidebar()\">\n <sd-icon name=\"menu\" size=\"24px\" />\n </button>\n }\n <sd-breadcrumb\n class=\"breadcrumb\"\n [items]=\"breadcrumb().items\"\n [maxItems]=\"_compact ? 3 : 5\"\n [ariaLabel]=\"'core.component.file-explorer.breadcrumb' | sdTranslate\"\n (sdItemActivate)=\"onBreadcrumb($event)\" />\n @if (_state === 'items') {\n <span class=\"count\">{{ itemCountLabel() }}</span>\n }\n <div class=\"view-toggle\" role=\"group\" [attr.aria-label]=\"'core.component.file-explorer.view' | sdTranslate\">\n <button\n type=\"button\"\n class=\"icon-button icon-button--toggle\"\n [class.icon-button--active]=\"_view === 'list'\"\n [attr.aria-pressed]=\"_view === 'list'\"\n [attr.aria-label]=\"'core.component.file-explorer.view-list' | sdTranslate\"\n [title]=\"'core.component.file-explorer.view-list' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-view-list' : null\"\n (click)=\"setView('list')\">\n <sd-icon name=\"format_list_bulleted\" size=\"24px\" />\n </button>\n <button\n type=\"button\"\n class=\"icon-button icon-button--toggle\"\n [class.icon-button--active]=\"_view === 'grid'\"\n [attr.aria-pressed]=\"_view === 'grid'\"\n [attr.aria-label]=\"'core.component.file-explorer.view-grid' | sdTranslate\"\n [title]=\"'core.component.file-explorer.view-grid' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-view-grid' : null\"\n (click)=\"setView('grid')\">\n <sd-icon name=\"grid_view\" size=\"24px\" />\n </button>\n </div>\n </div>\n\n @let _selection = selectionView();\n @if (_selection && selectedItems().length) {\n @let _selected = selectedItems();\n @let _selectedCount = _selected.length;\n @let _summary = selectionSummary();\n @let _clearLabel = 'core.component.file-explorer.selection.clear' | sdTranslate;\n <!-- why: one band for list and grid. The select-all checkbox lives in the list header / above the grid, not here. -->\n <div\n class=\"selection\"\n role=\"group\"\n [class.selection--active]=\"_selectedCount > 0\"\n [attr.aria-label]=\"'core.component.file-explorer.selection.label' | sdTranslate\"\n [attr.inert]=\"_preview ? '' : null\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-selection' : null\">\n <div class=\"selection-summary\">\n <!-- why: one plain sentence in the translated word order (\"2 t\u1EC7p \u0111\u00E3 ch\u1ECDn\", \"\u5DF2\u9009\u62E9 2 \u4E2A\u6587\u4EF6\"); only the number is\n heavier. Each part sits in its own span: the markup whitespace between spans is dropped, so the sentence\n keeps exactly the spaces of its translation (\"2\u4EF6\u2026\" stays joined). -->\n <span class=\"selection-status\" role=\"status\">\n <span>{{ _summary.before }}</span>\n @if (_summary.count) {\n <span class=\"selection-count\">{{ _summary.count }}</span>\n }\n <span>{{ _summary.after }}</span>\n </span>\n <button\n type=\"button\"\n class=\"icon-button selection-clear\"\n [disabled]=\"!_selectedCount\"\n [attr.aria-label]=\"_clearLabel\"\n [matTooltip]=\"_clearLabel\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-selection-clear' : null\"\n (click)=\"clearSelection()\">\n <sd-icon name=\"close\" size=\"20px\" />\n </button>\n </div>\n @if (_selectedCount && selectionActions().length) {\n <!-- why: unset types follow the kind (light flat action, text group trigger). sd-button's own sizes: 32 px like the\n row commands, 48 px only on a wide touch layout; a narrow layout keeps 32 px and spaces the lines instead. -->\n <sd-file-explorer-actions\n class=\"selection-actions\"\n source=\"selector.actions\"\n defaultLeafType=\"light\"\n defaultGroupType=\"text\"\n defaultColor=\"primary\"\n [actions]=\"selectionActions()\"\n [context]=\"_selected\"\n [size]=\"_touch && !_compact ? 'lg' : 'sm'\"\n [autoId]=\"_autoId ? _autoId + '-selection-action' : undefined\" />\n }\n </div>\n }\n\n <div class=\"scroller\" [attr.inert]=\"_preview ? '' : null\">\n @switch (_state) {\n @case ('loading') {\n <sd-data-state\n state=\"loading\"\n compact\n [title]=\"(_searching ? 'core.component.file-explorer.search-loading' : 'core.component.file-explorer.loading') | sdTranslate\" />\n }\n @case ('error') {\n <sd-data-state\n state=\"error\"\n retryable\n [title]=\"(_searching ? 'core.component.file-explorer.search-error' : 'core.component.file-explorer.load-error') | sdTranslate\"\n [message]=\"errorMessage()\"\n [retryLabel]=\"'core.component.file-explorer.retry' | sdTranslate\"\n (sdRetry)=\"retryContent()\" />\n }\n @case ('empty') {\n <sd-data-state\n state=\"empty\"\n [icon]=\"_searching ? 'search_off' : 'folder_open'\"\n [title]=\"emptyTitle()\"\n [message]=\"emptyMessage()\" />\n }\n @default {\n <sd-file-explorer-item-list\n [columns]=\"columns()\"\n [moveDropTarget]=\"moveDropTarget()\"\n [canMove]=\"canMove()\"\n [movePending]=\"movePending()\"\n (move)=\"openMovePicker([$event])\"\n [items]=\"itemViews()\"\n [view]=\"_view\"\n [canDownload]=\"_canDownload && _rowShortcuts\"\n [canShare]=\"_canShare && _rowShortcuts\"\n [compact]=\"_compact\"\n [touch]=\"_touch\"\n [activeId]=\"_preview ? _preview.item.id : null\"\n [label]=\"_heading\"\n [selection]=\"_selection\"\n [fileCommands]=\"_option.fileCommands\"\n [folderCommands]=\"_option.folderCommands\"\n [menuOpenId]=\"itemsMenuOpenId()\"\n (activate)=\"onActivate($event)\"\n (download)=\"downloadItem($event.item)\"\n (share)=\"openShare($event.item)\"\n (toggleSelect)=\"toggleSelection($event)\"\n (toggleSelectAll)=\"toggleSelectAll()\"\n (openCommands)=\"openCommands($event.item, _view, $event.trigger)\" />\n }\n }\n </div>\n </section>\n</div>\n\n@if (_transfers.length) {\n <sd-file-explorer-transfer-panel\n class=\"transfers\"\n [attr.inert]=\"_modalOpen ? '' : null\"\n [transfers]=\"_transfers\"\n [title]=\"transfersTitle()\"\n [collapsed]=\"_collapsed\"\n [canClear]=\"canClearTransfers()\"\n [compact]=\"_compact\"\n [autoId]=\"_autoId ? _autoId + '-transfers' : undefined\"\n (toggleCollapsed)=\"transfersCollapsed.set(!_collapsed)\"\n (clear)=\"clearFinishedTransfers()\"\n (cancel)=\"cancelTransfer($event)\"\n (retry)=\"retryTransfer($event)\"\n (dismiss)=\"dismissTransfer($event)\" />\n}\n\n<!-- why: chi ti\u1EBFt file l\u00E0 sd-side-drawer th\u1EADt, m\u1EDF g\u1ECDn trong v\u00F9ng danh s\u00E1ch b\u00EAn ph\u1EA3i nh\u1EDD [container]:\n header (t\u00ECm ki\u1EBFm, t\u1EA3i l\u00EAn), c\u00E2y th\u01B0 m\u1EE5c v\u00E0 h\u00E0ng ch\u1EDD truy\u1EC1n t\u1EA3i v\u1EABn d\u00F9ng \u0111\u01B0\u1EE3c khi drawer m\u1EDF. -->\n<sd-file-explorer-preview-panel\n [view]=\"_preview\"\n [compact]=\"_compact\"\n [state]=\"previewState()\"\n [meta]=\"previewMeta()\"\n [canDownload]=\"_canDownload\"\n [canShare]=\"_canShare\"\n [container]=\"mainRegion\"\n [autoId]=\"_autoId ? _autoId + '-preview' : undefined\"\n (close)=\"closePreview()\"\n (download)=\"downloadPreview()\"\n (share)=\"sharePreview()\"\n (retry)=\"retryPreview()\"\n (imageError)=\"onPreviewImageError()\" />\n\n<!-- why: l\u1EC7nh c\u1EE7a m\u1ED9t m\u1EE5c tr\u00EAn layout h\u1EB9p m\u1EDF trong sd-side-drawer th\u1EADt c\u1EE7a Core (g\u1EAFn v\u00E0o <body>: backdrop, Esc, b\u1EABy focus,\n kho\u00E1 scroll trang) thay cho c\u00E1c n\u00FAt tr\u00EAn h\u00E0ng / th\u1EBB / n\u00FAt c\u00E2y. -->\n<sd-file-explorer-command-sheet\n [sheet]=\"commandSheet()\"\n [touch]=\"_touch\"\n [autoId]=\"_autoId ? _autoId + '-commands' : undefined\"\n (activate)=\"runCommand($event)\"\n (close)=\"onCommandsClosed()\" />\n\n@if (dragActive()) {\n <div class=\"drop-overlay\" aria-hidden=\"true\">\n <div class=\"drop-card\">\n <sd-icon name=\"file_upload\" size=\"40px\" />\n <p class=\"drop-title\">{{ dropTitle() }}</p>\n </div>\n </div>\n}\n\n@if (_dialogOpen) {\n @let _folderName = folderName();\n @let _folderError = folderError();\n <div class=\"dialog-backdrop\" aria-hidden=\"true\" (click)=\"closeFolderDialog()\"></div>\n <form\n class=\"dialog\"\n role=\"dialog\"\n aria-modal=\"true\"\n novalidate\n [attr.aria-labelledby]=\"instanceId + '-folder-title'\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-folder-dialog' : null\"\n (submit)=\"submitFolder($event)\">\n <h3 class=\"dialog-title\" [id]=\"instanceId + '-folder-title'\">{{ folderDialogTitle() }}</h3>\n <label class=\"field-label\" [for]=\"instanceId + '-folder-name'\">{{\n 'core.component.file-explorer.new-folder-name' | sdTranslate\n }}</label>\n <input\n #folderInput\n class=\"field-input\"\n autocomplete=\"off\"\n maxlength=\"255\"\n [id]=\"instanceId + '-folder-name'\"\n [value]=\"_folderName\"\n [attr.aria-invalid]=\"_folderError ? true : null\"\n [attr.aria-describedby]=\"_folderError ? instanceId + '-folder-error' : null\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-folder-name' : null\"\n (input)=\"folderName.set(folderInput.value)\" />\n @if (_folderError) {\n <sd-inform class=\"field-error\" color=\"error\" [hideIcon]=\"true\" [id]=\"instanceId + '-folder-error'\" [title]=\"_folderError\" />\n }\n <div class=\"dialog-actions\">\n <sd-button\n class=\"cancel-button\"\n type=\"text\"\n color=\"secondary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n [title]=\"'core.component.file-explorer.cancel' | sdTranslate\"\n (click)=\"closeFolderDialog()\" />\n <sd-button\n class=\"submit-button\"\n type=\"fill\"\n color=\"primary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n htmlType=\"submit\"\n [title]=\"'core.component.file-explorer.create' | sdTranslate\"\n [disabled]=\"!_folderName.trim()\"\n [loading]=\"folderSubmitting()\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-folder-submit' : null\" />\n </div>\n </form>\n}\n\n@if (movePickerItems()) {\n <div class=\"dialog-backdrop\" aria-hidden=\"true\" (click)=\"closeMovePicker()\"></div>\n <section\n class=\"dialog move-picker\"\n role=\"dialog\"\n aria-modal=\"true\"\n cdkTrapFocus\n [cdkTrapFocusAutoCapture]=\"true\"\n (keydown.tab)=\"$event.stopPropagation()\"\n (keydown.shift.tab)=\"$event.stopPropagation()\"\n [attr.aria-labelledby]=\"instanceId + '-move-title'\">\n <h3 cdkFocusInitial tabindex=\"-1\" [id]=\"instanceId + '-move-title'\">{{ 'core.component.file-explorer.move.to' | sdTranslate }}</h3>\n <sd-file-explorer-folder-tree\n [nodes]=\"movePickerNodes()\"\n [label]=\"'core.component.file-explorer.folders' | sdTranslate\"\n [touch]=\"_touch\"\n [compact]=\"false\"\n (select)=\"moveTarget.set($event.item)\"\n (toggle)=\"onTreeToggle($event)\"\n (retry)=\"onTreeRetry($event)\" />\n @if (!canSubmitMove() && !movePending()) {\n <sd-inform\n class=\"field-error move-destination-tip\"\n type=\"tip\"\n color=\"secondary\"\n [hideIcon]=\"true\"\n [title]=\"'core.component.file-explorer.move.destination-tip' | sdTranslate\" />\n }\n <div class=\"dialog-actions\">\n <sd-button\n class=\"move-cancel-button\"\n type=\"text\"\n color=\"secondary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n htmlType=\"button\"\n [title]=\"'core.component.file-explorer.cancel' | sdTranslate\"\n (click)=\"closeMovePicker()\" />\n <sd-button\n class=\"move-submit-button\"\n type=\"fill\"\n color=\"primary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n htmlType=\"button\"\n [title]=\"'core.component.file-explorer.move.confirm' | sdTranslate\"\n [disabled]=\"!canSubmitMove()\"\n (click)=\"submitMoveFromEvent($event)\" />\n </div>\n </section>\n}\n\n@if (_shareItem) {\n @let _shareState = shareState();\n <div class=\"dialog-backdrop\" aria-hidden=\"true\" (click)=\"closeShare()\"></div>\n <div\n #shareDialog\n class=\"dialog\"\n role=\"dialog\"\n aria-modal=\"true\"\n tabindex=\"-1\"\n [attr.aria-labelledby]=\"instanceId + '-share-title'\"\n [attr.aria-busy]=\"_shareState.status === 'loading' ? true : null\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-share-dialog' : null\">\n <h3 class=\"dialog-title\" [id]=\"instanceId + '-share-title'\" [title]=\"_shareItem.name\">{{ shareTitle() }}</h3>\n @switch (_shareState.status) {\n @case ('loading') {\n <p class=\"share-status\" role=\"status\">\n <span class=\"spinner\" aria-hidden=\"true\"></span>\n {{ 'core.component.file-explorer.share.loading' | sdTranslate }}\n </p>\n }\n @case ('error') {\n <sd-inform class=\"field-error\" color=\"error\" [hideIcon]=\"true\" [title]=\"_shareState.message\" />\n }\n @case ('ready') {\n <label class=\"field-label\" [for]=\"instanceId + '-share-link'\">{{ 'core.component.file-explorer.share.link' | sdTranslate }}</label>\n <input\n #shareInput\n class=\"field-input\"\n readonly\n [id]=\"instanceId + '-share-link'\"\n [value]=\"_shareState.url\"\n [attr.aria-describedby]=\"instanceId + '-share-feedback'\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-share-link' : null\"\n (focus)=\"shareInput.select()\" />\n <p class=\"share-feedback\" role=\"status\" aria-live=\"polite\" [id]=\"instanceId + '-share-feedback'\">{{ shareFeedbackLabel() }}</p>\n }\n }\n <div class=\"dialog-actions\">\n <sd-button\n class=\"close-button\"\n type=\"text\"\n color=\"secondary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n [title]=\"'core.component.file-explorer.close' | sdTranslate\"\n (click)=\"closeShare()\" />\n @if (_shareState.status === 'error') {\n <sd-button\n class=\"retry-button\"\n type=\"outline\"\n color=\"primary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n prefixIcon=\"refresh\"\n [title]=\"'core.component.file-explorer.retry' | sdTranslate\"\n (click)=\"retryShare()\" />\n } @else {\n <sd-button\n #copyButton\n class=\"copy-button\"\n type=\"fill\"\n color=\"primary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n prefixIcon=\"content_copy\"\n [title]=\"\n (shareFeedback() === 'copied' ? 'core.component.file-explorer.share.copied' : 'core.component.file-explorer.share.copy')\n | sdTranslate\n \"\n [disabled]=\"_shareState.status !== 'ready'\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-share-copy' : null\"\n (click)=\"copyShareLink()\" />\n }\n </div>\n </div>\n}\n", styles: [":host{--sd-fe-accent: var(--sd-file-explorer-accent, var(--sd-primary, #005cbb));--sd-fe-accent-strong: var( --sd-file-explorer-accent-strong, color-mix(in srgb, var(--sd-fe-accent) 84%, var(--sd-file-explorer-mix-shade, #000000)) );--sd-fe-accent-contrast: var(--sd-file-explorer-accent-contrast, var(--sd-primary-contrast, #ffffff));--sd-fe-accent-soft: var( --sd-file-explorer-accent-soft, color-mix(in srgb, var(--sd-fe-accent) 10%, var(--sd-file-explorer-mix-tint, var(--sd-fe-surface))) );--sd-fe-surface: var(--sd-file-explorer-surface, var(--sd-surface, #ffffff));--sd-fe-sidebar-bg: var(--sd-file-explorer-sidebar-bg, color-mix(in srgb, var(--sd-surface-muted, #e7e8ed) 26%, var(--sd-fe-surface)));--sd-fe-muted-surface: var( --sd-file-explorer-muted-surface, color-mix(in srgb, var(--sd-surface-muted, #e7e8ed) 50%, var(--sd-fe-surface)) );--sd-fe-preview-bg: var( --sd-file-explorer-preview-bg, color-mix(in srgb, var(--sd-fe-accent) 9%, var(--sd-file-explorer-mix-tint, var(--sd-fe-surface))) );--sd-fe-border: var( --sd-file-explorer-border, color-mix(in srgb, var(--sd-border, #c4c6d0) 55%, var(--sd-file-explorer-mix-tint, var(--sd-fe-surface))) );--sd-fe-border-strong: var(--sd-file-explorer-border-strong, var(--sd-border, #c4c6d0));--sd-fe-text: var(--sd-file-explorer-text, var(--sd-text, #1a1b1f));--sd-fe-text-secondary: var( --sd-file-explorer-text-secondary, color-mix(in srgb, var(--sd-text-secondary, #44474f) 84%, var(--sd-file-explorer-mix-tint, var(--sd-fe-surface))) );--sd-fe-hover: color-mix(in srgb, var(--sd-fe-text) 4%, transparent);--sd-fe-hover-strong: color-mix(in srgb, var(--sd-fe-text) 8%, transparent);--sd-fe-track: color-mix(in srgb, var(--sd-fe-text) 7%, var(--sd-fe-surface));--sd-fe-success: var(--sd-file-explorer-success, var(--sd-success, #2e7d32));--sd-fe-error: var(--sd-file-explorer-error, var(--sd-error, #ba1a1a));--sd-fe-radius: var(--sd-file-explorer-radius, 16px);--sd-fe-scrim: var(--sd-file-explorer-scrim, rgba(0, 0, 0, .4));--sd-side-drawer-contained-z-index: 9;position:relative;display:flex;flex-direction:column;height:100%;min-height:480px;overflow:hidden;border:1px solid var(--sd-fe-border);border-radius:var(--sd-fe-radius);background:var(--sd-fe-surface);color:var(--sd-fe-text);font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-line-height-20, 20px)}.header{display:grid;grid-template-columns:fit-content(320px) minmax(0,1fr) auto;align-items:center;gap:12px 20px;padding:16px 20px;border-bottom:1px solid var(--sd-fe-border)}.brand{grid-column:1;display:flex;align-items:center;gap:10px;min-width:0}.brand-icon{flex:none;display:grid;place-items:center;width:32px;height:32px;border-radius:50%;background:color-mix(in srgb,var(--sd-fe-accent) 14%,var(--sd-file-explorer-mix-tint, var(--sd-fe-surface)));color:var(--sd-fe-accent)}.brand-text{min-width:0}.brand-title{margin:0;overflow:hidden;font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-semibold, 600);line-height:var(--sd-line-height-22, 22px);text-overflow:ellipsis;white-space:nowrap}.brand-description{margin:0;overflow:hidden;font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-line-height-16, 16px);color:var(--sd-fe-text-secondary);text-overflow:ellipsis;white-space:nowrap}.search{grid-column:2;justify-self:center;display:flex;align-items:center;gap:8px;width:100%;max-width:520px;height:36px;padding:0 6px 0 12px;border:1px solid var(--sd-fe-border);border-radius:var(--sd-radius-999, 999px);background:var(--sd-fe-muted-surface);transition:border-color var(--sd-duration-fast, .12s) ease,box-shadow var(--sd-duration-fast, .12s) ease}.search:focus-within{border-color:var(--sd-fe-accent);background:var(--sd-fe-surface);box-shadow:0 0 0 3px var(--sd-fe-accent-soft)}.search-icon{flex:none;color:var(--sd-fe-text-secondary)}.search-input{flex:1;min-width:0;height:100%;padding:0;border:0;outline:none;background:transparent;color:var(--sd-fe-text);font:inherit;font-size:var(--sd-font-size-14, 14px)}.search-input::placeholder{color:var(--sd-fe-text-secondary)}.search-input::-webkit-search-cancel-button{display:none}.search-clear{flex:none;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;border:0;border-radius:var(--sd-radius-999, 999px);background:transparent;color:var(--sd-fe-text-secondary);cursor:pointer}.search-clear:hover{background:var(--sd-fe-hover-strong)}.upload-button{grid-column:3;justify-self:end}.file-input{display:none}.body{position:relative;flex:1;min-height:0;display:grid;grid-template-columns:238px minmax(0,1fr)}.sidebar{display:flex;flex-direction:column;min-height:0;padding:22px 14px 32px 12px;border-right:1px solid var(--sd-fe-border);background:var(--sd-fe-sidebar-bg)}.sidebar-label{margin:0 0 6px 10px;font-size:var(--sd-font-size-12, 12px);font-weight:var(--sd-font-weight-bold, 700);line-height:var(--sd-line-height-16, 16px);letter-spacing:.04em;text-transform:uppercase;color:var(--sd-fe-text-secondary)}.sidebar-tree{flex:1;min-height:0;margin:0 -4px;padding:2px 4px;overflow-y:auto}.sidebar-footer{margin:12px 4px 0;padding-top:18px;border-top:1px solid var(--sd-fe-border)}.new-folder-button{display:block}.main{position:relative;display:flex;flex-direction:column;min-width:0;min-height:0;padding-top:14px}.refresh-bar{position:absolute;top:0;left:0;right:0;height:2px;overflow:hidden;background:var(--sd-fe-accent-soft)}.refresh-bar:after{content:\"\";position:absolute;top:0;bottom:0;width:30%;background:var(--sd-fe-accent);animation:sd-file-explorer-refresh 1.2s ease-in-out infinite}.toolbar{display:flex;align-items:center;gap:12px;min-height:40px;padding:0 32px}.breadcrumb{flex:1;min-width:0;margin-left:-4px;font-size:var(--sd-font-size-15, 15px);font-weight:var(--sd-font-weight-semibold, 600)}.view-toggle{flex:none;display:flex;gap:2px;padding:2px;border:1px solid var(--sd-fe-border);border-radius:var(--sd-radius-999, 999px);background:var(--sd-fe-surface)}.icon-button{flex:none;display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;padding:0;border:0;border-radius:var(--sd-radius-999, 999px);background:transparent;color:var(--sd-fe-text-secondary);cursor:pointer}.icon-button:hover{background:var(--sd-fe-hover-strong);color:var(--sd-fe-text)}.icon-button:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-file-explorer-accent, var(--sd-focus-ring-color, var(--sd-primary)));outline-offset:1px}.icon-button--toggle{width:40px;height:32px}.icon-button--active,.icon-button--active:hover{background:var(--sd-fe-accent-soft);color:var(--sd-fe-accent)}.count{flex:none;font-size:var(--sd-font-size-13, 13px);color:var(--sd-fe-text-secondary)}.selection{flex:none;display:flex;flex-wrap:wrap;align-items:center;gap:8px 16px;margin:10px 28px 0;padding:6px 8px 6px 10px;border:1px solid var(--sd-fe-border);border-radius:var(--sd-radius-12, 12px);background:var(--sd-file-explorer-muted-surface, color-mix(in srgb, var(--sd-surface-muted, #e7e8ed) 50%, var(--sd-file-explorer-mix-tint, var(--sd-fe-surface))))}.selection-summary{display:flex;align-items:center;gap:4px;min-width:0}.selection-status{min-width:0;color:var(--sd-fe-text);font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-regular, 400);line-height:var(--sd-line-height-20, 20px);overflow-wrap:anywhere}.selection-count{font-weight:var(--sd-font-weight-semibold, 600)}.icon-button.selection-clear{width:32px;height:32px}.icon-button.selection-clear:disabled{cursor:default;opacity:.45}.icon-button.selection-clear:disabled:hover{background:transparent}:host(.sd-file-explorer--touch) .icon-button.selection-clear{width:var(--sd-space-48, 48px);height:var(--sd-space-48, 48px)}.selection-actions{flex:0 1 auto;justify-content:flex-end;gap:16px 8px;margin-inline-start:auto}.selection-actions:empty{display:none}:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-success.c-light,:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-success.c-text{color:var(--sd-status-success-fg, var(--sd-success-dark))}:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-success.c-light .mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic circle,:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-success.c-text .mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic circle{stroke:var(--sd-status-success-fg, var(--sd-success-dark))!important}:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-warning.c-light,:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-warning.c-text{color:var(--sd-status-warning-fg, var(--sd-warning-dark))}:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-warning.c-light .mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic circle,:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-warning.c-text .mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic circle{stroke:var(--sd-status-warning-fg, var(--sd-warning-dark))!important}:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-primary.c-text{--mat-text-button-state-layer-color: var(--sd-file-explorer-mix-tint, var(--sd-fe-surface));--mat-button-text-state-layer-color: var(--mat-text-button-state-layer-color)}:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-success.c-text{--mat-text-button-state-layer-color: var(--sd-file-explorer-mix-tint, var(--sd-fe-surface));--mat-button-text-state-layer-color: var(--mat-text-button-state-layer-color)}:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-info.c-text{--mat-text-button-state-layer-color: var(--sd-file-explorer-mix-tint, var(--sd-fe-surface));--mat-button-text-state-layer-color: var(--mat-text-button-state-layer-color)}:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-warning.c-text{--mat-text-button-state-layer-color: var(--sd-file-explorer-mix-tint, var(--sd-fe-surface));--mat-button-text-state-layer-color: var(--mat-text-button-state-layer-color)}:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-error.c-text{--mat-text-button-state-layer-color: var(--sd-file-explorer-mix-tint, var(--sd-fe-surface));--mat-button-text-state-layer-color: var(--mat-text-button-state-layer-color)}.scroller{flex:1;min-height:0;padding:8px 28px 16px;overflow-y:auto}.scrim{position:absolute;inset:0;background:var(--sd-fe-scrim);animation:sd-file-explorer-fade .18s ease}.transfers{flex:none;border-top:1px solid var(--sd-fe-border);background:var(--sd-fe-surface)}.drop-overlay{position:absolute;inset:0;z-index:10;display:flex;align-items:center;justify-content:center;padding:16px;border:2px dashed var(--sd-fe-accent);border-radius:var(--sd-fe-radius);background:color-mix(in srgb,var(--sd-fe-accent) 8%,color-mix(in srgb,var(--sd-fe-surface) 86%,transparent));pointer-events:none}.drop-card{display:flex;flex-direction:column;align-items:center;gap:10px;color:var(--sd-fe-accent);text-align:center}.drop-title{margin:0;font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-semibold, 600)}.dialog-backdrop{position:absolute;inset:0;z-index:20;background:var(--sd-fe-scrim)}.dialog{position:absolute;top:50%;left:50%;z-index:21;display:flex;flex-direction:column;gap:8px;width:min(400px,100% - 32px);padding:20px;border-radius:14px;background:var(--sd-fe-surface);box-shadow:0 18px 48px #0f172a2e;transform:translate(-50%,-50%)}.dialog:focus{outline:none}.dialog-title{margin:0 0 8px;font-size:17px;font-weight:var(--sd-font-weight-semibold, 600);line-height:var(--sd-line-height-24, 24px)}.field-label{font-size:var(--sd-font-size-13, 13px);color:var(--sd-fe-text-secondary)}.field-input{height:40px;padding:0 12px;border:1px solid var(--sd-file-explorer-border-strong, var(--sd-control-border, var(--sd-fe-border-strong)));border-radius:var(--sd-control-radius, 8px);background:var(--sd-fe-surface);color:var(--sd-fe-text);font:inherit;font-size:var(--sd-font-size-15, 15px);outline:none}.field-input:hover{border-color:var(--sd-control-border-hover, var(--sd-fe-border-strong))}.field-input:focus{border-color:var(--sd-fe-accent);box-shadow:0 0 0 3px var(--sd-fe-accent-soft)}@media(forced-colors:active){.field-input:focus{--sd-fe-focus-ring: Highlight;outline:2px solid var(--sd-fe-focus-ring);outline-offset:2px}}.field-input[aria-invalid=true]{border-color:var(--sd-fe-error)}.field-error{margin:0;font-size:var(--sd-font-size-13, 13px);color:var(--sd-fe-error)}.dialog-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:12px}.share-status{display:flex;align-items:center;gap:10px;margin:4px 0;font-size:var(--sd-font-size-14, 14px);color:var(--sd-fe-text-secondary)}.share-feedback{min-height:18px;margin:0;font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-18, 18px);color:var(--sd-fe-success)}.spinner{flex:none;width:18px;height:18px;border:2px solid color-mix(in srgb,var(--sd-fe-accent) 20%,transparent);border-top-color:var(--sd-fe-accent);border-radius:50%;animation:sd-file-explorer-spin .8s linear infinite}:host(.sd-file-explorer--compact) .header{grid-template-columns:minmax(0,1fr) auto;gap:10px 12px;padding:12px 14px}:host(.sd-file-explorer--compact) .brand{grid-row:1;gap:10px}:host(.sd-file-explorer--compact) .upload-button{grid-column:2;grid-row:1}:host(.sd-file-explorer--compact) .search{grid-column:1/-1;grid-row:2;max-width:none}:host(.sd-file-explorer--compact) .header:not(:has(.brand)) .search{grid-column:1;grid-row:1}:host(.sd-file-explorer--compact) .body{grid-template-columns:minmax(0,1fr)}:host(.sd-file-explorer--compact) .sidebar{position:absolute;top:0;bottom:0;left:0;z-index:5;width:min(300px,86%);border-right:1px solid var(--sd-fe-border);box-shadow:12px 0 32px #0f172a1f;visibility:hidden;transform:translate(-100%);transition:transform var(--sd-duration-base, .2s) ease,visibility var(--sd-duration-base, .2s)}:host(.sd-file-explorer--compact) .sidebar--open{visibility:visible;transform:none}:host(.sd-file-explorer--compact) .scrim--sidebar{z-index:4}:host(.sd-file-explorer--compact) .main{padding-top:8px}:host(.sd-file-explorer--compact) .toolbar{gap:6px;min-height:36px;padding:0 12px 0 10px}:host(.sd-file-explorer--compact) .breadcrumb{margin-left:0}:host(.sd-file-explorer--compact) .icon-button--toggle{width:36px}:host(.sd-file-explorer--compact) .heading-row{margin-top:13px;padding:0 14px}:host(.sd-file-explorer--compact) .count{padding-bottom:8px}:host(.sd-file-explorer--compact) .selection{margin:8px 12px 4px}:host(.sd-file-explorer--compact) .selection-summary{flex:1 1 100%;justify-content:space-between}:host(.sd-file-explorer--compact) .selection-actions{flex-basis:100%;justify-content:flex-start;margin-inline-start:0;padding-top:8px;border-top:1px solid var(--sd-fe-border)}:host(.sd-file-explorer--compact) .scroller{padding:0 12px 12px}@keyframes sd-file-explorer-spin{to{transform:rotate(360deg)}}@keyframes sd-file-explorer-fade{0%{opacity:0}}@keyframes sd-file-explorer-refresh{0%{left:-30%}to{left:100%}}@media(prefers-reduced-motion:reduce){.scrim{animation:none}.search,:host(.sd-file-explorer--compact) .sidebar{transition:none}}.move-status{display:block;margin:8px 16px;color:var(--sd-fe-text-secondary)}.move-picker{box-sizing:border-box;max-height:min(80vh,100% - 32px);overflow-y:auto}\n"], dependencies: [{ kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i1.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "directive", type: MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "component", type: SdBreadcrumb, selector: "sd-breadcrumb", inputs: ["items", "maxItems", "ariaLabel", "separator"], outputs: ["sdItemActivate"] }, { kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "openOnHover", "loading", "block", "htmlType", "indicator", "indicatorColor", "indicatorMax", "indicatorLabel"], outputs: ["click"] }, { kind: "component", type: SdInform, selector: "sd-inform", inputs: ["type", "color", "primary", "secondary", "info", "success", "warning", "error", "title", "description", "icon", "hideIcon", "iconShape", "fontSet", "closable", "actionLabel", "lineClamp", "autoId"], outputs: ["sdClosed", "sdAction"] }, { kind: "directive", type: SdInformActionDirective, selector: "[sdInformAction]" }, { kind: "component", type: SdDataState, selector: "sd-data-state", inputs: ["state", "title", "message", "icon", "fontSet", "iconShape", "retryable", "retryLabel", "actionLabel", "compact", "fullPage"], outputs: ["sdRetry", "sdAction"] }, { kind: "component", type: SdFileExplorerActions, selector: "sd-file-explorer-actions", inputs: ["actions", "context", "defaultLeafType", "defaultGroupType", "defaultColor", "size", "source", "autoId"] }, { kind: "component", type: SdFileExplorerCommandSheet, selector: "sd-file-explorer-command-sheet", inputs: ["sheet", "touch", "autoId"], outputs: ["activate", "close"] }, { kind: "component", type: SdFileExplorerFolderTree, selector: "sd-file-explorer-folder-tree", inputs: ["moveDropTarget", "nodes", "label", "commands", "touch", "compact", "menuOpenId"], outputs: ["select", "toggle", "retry", "openCommands"] }, { kind: "component", type: SdFileExplorerItemList, selector: "sd-file-explorer-item-list", inputs: ["canMove", "moveDropTarget", "movePending", "columns", "items", "view", "canDownload", "canShare", "compact", "touch", "activeId", "label", "selection", "fileCommands", "folderCommands", "menuOpenId"], outputs: ["move", "activate", "openCommands", "download", "share", "toggleSelect", "toggleSelectAll"] }, { kind: "component", type: SdFileExplorerPreviewPanel, selector: "sd-file-explorer-preview-panel", inputs: ["view", "state", "meta", "canDownload", "canShare", "compact", "container", "autoId"], outputs: ["close", "download", "share", "retry", "imageError"] }, { kind: "component", type: SdFileExplorerTransferPanel, selector: "sd-file-explorer-transfer-panel", inputs: ["transfers", "title", "collapsed", "canClear", "compact", "autoId"], outputs: ["toggleCollapsed", "clear", "cancel", "retry", "dismiss"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2704
4884
|
}
|
|
2705
4885
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdFileExplorer, decorators: [{
|
|
2706
4886
|
type: Component,
|
|
2707
4887
|
args: [{ selector: 'sd-file-explorer', standalone: true, imports: [
|
|
4888
|
+
A11yModule,
|
|
4889
|
+
MatTooltip,
|
|
2708
4890
|
SdIcon,
|
|
2709
4891
|
SdTranslatePipe,
|
|
2710
4892
|
SdBreadcrumb,
|
|
2711
4893
|
SdButton,
|
|
4894
|
+
SdInform,
|
|
4895
|
+
SdInformActionDirective,
|
|
2712
4896
|
SdDataState,
|
|
4897
|
+
SdFileExplorerActions,
|
|
4898
|
+
SdFileExplorerCommandSheet,
|
|
2713
4899
|
SdFileExplorerFolderTree,
|
|
2714
4900
|
SdFileExplorerItemList,
|
|
2715
4901
|
SdFileExplorerPreviewPanel,
|
|
@@ -2717,19 +4903,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
2717
4903
|
], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
2718
4904
|
class: 'sd-file-explorer',
|
|
2719
4905
|
'[class.sd-file-explorer--compact]': 'compact()',
|
|
4906
|
+
'[class.sd-file-explorer--touch]': 'touch()',
|
|
2720
4907
|
'[class.sd-file-explorer--dragging]': 'dragActive()',
|
|
2721
4908
|
'[attr.data-autoid]': 'autoId()',
|
|
2722
4909
|
'(dragenter)': 'onDragEnter($event)',
|
|
2723
4910
|
'(dragover)': 'onDragOver($event)',
|
|
2724
4911
|
'(dragleave)': 'onDragLeave()',
|
|
2725
4912
|
'(drop)': 'onDrop($event)',
|
|
4913
|
+
'(dragstart)': 'onMoveDragStart($event)',
|
|
4914
|
+
'(dragend)': 'onMoveDragEnd()',
|
|
2726
4915
|
'(keydown.escape)': 'onEscape($event)',
|
|
2727
|
-
}, template: "@let _option = option();\n@let _compact = compact();\n@let _autoId = autoId();\n@let _canUpload = canUpload();\n@let _canDownload = canDownload();\n@let _view = view();\n@let _state = contentState();\n@let _keyword = keyword();\n@let _sidebarOpen = sidebarOpen();\n@let _preview = previewView();\n@let _transfers = transferViews();\n@let _heading = heading();\n@let _searching = searching();\n@let _collapsed = transfersCollapsed();\n@let _dialogOpen = folderDialogOpen();\n@let _shareItem = shareItem();\n@let _canShare = canShare();\n@let _modalOpen = _dialogOpen || !!_shareItem;\n\n<header class=\"header\" [attr.inert]=\"_modalOpen ? '' : null\">\n @if (_option.title) {\n <div class=\"brand\">\n <span class=\"brand-icon\" aria-hidden=\"true\">\n <sd-icon name=\"folder\" size=\"20px\" />\n </span>\n <div class=\"brand-text\">\n <h2 class=\"brand-title\" [title]=\"_option.title\">{{ _option.title }}</h2>\n @if (_option.description) {\n <p class=\"brand-description\">{{ _option.description }}</p>\n }\n </div>\n </div>\n }\n\n <div class=\"search\" role=\"search\">\n <sd-icon class=\"search-icon\" name=\"search\" size=\"20px\" />\n <input\n #searchInput\n type=\"search\"\n class=\"search-input\"\n autocomplete=\"off\"\n [value]=\"_keyword\"\n [placeholder]=\"'core.component.file-explorer.search-placeholder' | sdTranslate\"\n [attr.aria-label]=\"'core.component.file-explorer.search-placeholder' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-search' : null\"\n (input)=\"onKeywordInput(searchInput.value)\" />\n @if (_keyword) {\n <button\n type=\"button\"\n class=\"search-clear\"\n [attr.aria-label]=\"'core.component.file-explorer.search-clear' | sdTranslate\"\n [title]=\"'core.component.file-explorer.search-clear' | sdTranslate\"\n (click)=\"clearSearch()\">\n <sd-icon name=\"close\" size=\"18px\" />\n </button>\n }\n </div>\n\n @if (_canUpload) {\n <sd-button\n class=\"upload-button\"\n type=\"fill\"\n color=\"primary\"\n size=\"md\"\n prefixIcon=\"file_upload\"\n [title]=\"_compact ? undefined : ('core.component.file-explorer.upload' | sdTranslate)\"\n [tooltip]=\"_compact ? ('core.component.file-explorer.upload' | sdTranslate) : undefined\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-upload' : null\"\n (click)=\"fileInput.click()\" />\n <input\n #fileInput\n type=\"file\"\n class=\"file-input\"\n multiple\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-file-input' : null\"\n (change)=\"onFilesPicked(fileInput)\" />\n }\n</header>\n\n<!-- why: dialog ph\u1EE7 c\u1EA3 explorer n\u00EAn l\u00E0m inert c\u1EA3 v\u00F9ng n\u00E0y, k\u1EC3 c\u1EA3 drawer chi ti\u1EBFt \u0111ang n\u1EB1m trong .main. -->\n<div class=\"body\" [attr.inert]=\"_modalOpen ? '' : null\">\n @if (_compact && _sidebarOpen) {\n <div class=\"scrim scrim--sidebar\" aria-hidden=\"true\" (click)=\"sidebarOpen.set(false)\"></div>\n }\n <aside\n #sidebar\n class=\"sidebar\"\n [class.sidebar--open]=\"_sidebarOpen\"\n [id]=\"instanceId + '-sidebar'\"\n [attr.aria-label]=\"'core.component.file-explorer.folders' | sdTranslate\"\n [attr.inert]=\"_compact && !_sidebarOpen ? '' : null\">\n <p class=\"sidebar-label\">{{ 'core.component.file-explorer.folders' | sdTranslate }}</p>\n <div class=\"sidebar-tree\">\n <sd-file-explorer-folder-tree\n [nodes]=\"treeNodes()\"\n [label]=\"'core.component.file-explorer.tree-label' | sdTranslate\"\n (select)=\"onTreeSelect($event)\"\n (toggle)=\"onTreeToggle($event)\"\n (retry)=\"onTreeRetry($event)\" />\n </div>\n @if (canCreateFolder()) {\n <div class=\"sidebar-footer\">\n <sd-button\n #newFolderButton\n class=\"new-folder-button\"\n type=\"outline\"\n color=\"secondary\"\n size=\"md\"\n prefixIcon=\"add\"\n block\n [title]=\"'core.component.file-explorer.new-folder' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-new-folder' : null\"\n (click)=\"openFolderDialog()\" />\n </div>\n }\n </aside>\n\n <!-- why: .main l\u00E0 [container] c\u1EE7a drawer chi ti\u1EBFt \u2014 backdrop ch\u1EC9 ph\u1EE7 v\u00F9ng b\u00EAn ph\u1EA3i, c\u00E2y th\u01B0 m\u1EE5c v\u1EABn d\u00F9ng \u0111\u01B0\u1EE3c.\n Drawer n\u1EB1m TRONG ph\u1EA7n t\u1EED n\u00E0y n\u00EAn inert \u0111\u1EB7t tr\u00EAn t\u1EEBng kh\u1ED1i con, kh\u00F4ng \u0111\u1EB7t tr\u00EAn .main. -->\n <section #mainRegion class=\"main\" [attr.aria-label]=\"_heading\">\n @if (refreshing()) {\n <div class=\"refresh-bar\" aria-hidden=\"true\"></div>\n }\n <div class=\"toolbar\" [attr.inert]=\"_preview ? '' : null\">\n @if (_compact) {\n <button\n type=\"button\"\n class=\"icon-button\"\n [attr.aria-expanded]=\"_sidebarOpen\"\n [attr.aria-controls]=\"instanceId + '-sidebar'\"\n [attr.aria-label]=\"\n (_sidebarOpen ? 'core.component.file-explorer.close-folders' : 'core.component.file-explorer.open-folders') | sdTranslate\n \"\n [attr.data-autoid]=\"_autoId ? _autoId + '-menu' : null\"\n (click)=\"toggleSidebar()\">\n <sd-icon name=\"menu\" size=\"24px\" />\n </button>\n }\n <sd-breadcrumb\n class=\"breadcrumb\"\n [items]=\"breadcrumb().items\"\n [maxItems]=\"_compact ? 3 : 5\"\n [ariaLabel]=\"'core.component.file-explorer.breadcrumb' | sdTranslate\"\n (sdItemActivate)=\"onBreadcrumb($event)\" />\n <div class=\"view-toggle\" role=\"group\" [attr.aria-label]=\"'core.component.file-explorer.view' | sdTranslate\">\n <button\n type=\"button\"\n class=\"icon-button icon-button--toggle\"\n [class.icon-button--active]=\"_view === 'list'\"\n [attr.aria-pressed]=\"_view === 'list'\"\n [attr.aria-label]=\"'core.component.file-explorer.view-list' | sdTranslate\"\n [title]=\"'core.component.file-explorer.view-list' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-view-list' : null\"\n (click)=\"setView('list')\">\n <sd-icon name=\"format_list_bulleted\" size=\"24px\" />\n </button>\n <button\n type=\"button\"\n class=\"icon-button icon-button--toggle\"\n [class.icon-button--active]=\"_view === 'grid'\"\n [attr.aria-pressed]=\"_view === 'grid'\"\n [attr.aria-label]=\"'core.component.file-explorer.view-grid' | sdTranslate\"\n [title]=\"'core.component.file-explorer.view-grid' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-view-grid' : null\"\n (click)=\"setView('grid')\">\n <sd-icon name=\"grid_view\" size=\"24px\" />\n </button>\n </div>\n </div>\n\n <div class=\"heading-row\" [attr.inert]=\"_preview ? '' : null\">\n <h3 class=\"heading\" [title]=\"_heading\">{{ _heading }}</h3>\n @if (_state === 'items') {\n <span class=\"count\">{{ itemCountLabel() }}</span>\n }\n </div>\n\n <div class=\"scroller\" [attr.inert]=\"_preview ? '' : null\">\n @switch (_state) {\n @case ('loading') {\n <sd-data-state\n state=\"loading\"\n compact\n [title]=\"(_searching ? 'core.component.file-explorer.search-loading' : 'core.component.file-explorer.loading') | sdTranslate\" />\n }\n @case ('error') {\n <sd-data-state\n state=\"error\"\n retryable\n [title]=\"(_searching ? 'core.component.file-explorer.search-error' : 'core.component.file-explorer.load-error') | sdTranslate\"\n [message]=\"errorMessage()\"\n [retryLabel]=\"'core.component.file-explorer.retry' | sdTranslate\"\n (sdRetry)=\"retryContent()\" />\n }\n @case ('empty') {\n <sd-data-state\n state=\"empty\"\n [icon]=\"_searching ? 'search_off' : 'folder_open'\"\n [title]=\"emptyTitle()\"\n [message]=\"emptyMessage()\" />\n }\n @default {\n <sd-file-explorer-item-list\n [items]=\"itemViews()\"\n [view]=\"_view\"\n [canDownload]=\"_canDownload\"\n [canShare]=\"_canShare\"\n [compact]=\"_compact\"\n [activeId]=\"_preview ? _preview.item.id : null\"\n [label]=\"_heading\"\n (activate)=\"onActivate($event)\"\n (download)=\"downloadItem($event.item)\"\n (share)=\"openShare($event.item)\" />\n }\n }\n </div>\n </section>\n</div>\n\n@if (_transfers.length) {\n <sd-file-explorer-transfer-panel\n class=\"transfers\"\n [attr.inert]=\"_modalOpen ? '' : null\"\n [transfers]=\"_transfers\"\n [title]=\"transfersTitle()\"\n [collapsed]=\"_collapsed\"\n [canClear]=\"canClearTransfers()\"\n [compact]=\"_compact\"\n [autoId]=\"_autoId ? _autoId + '-transfers' : undefined\"\n (toggleCollapsed)=\"transfersCollapsed.set(!_collapsed)\"\n (clear)=\"clearFinishedTransfers()\"\n (cancel)=\"cancelTransfer($event)\"\n (retry)=\"retryTransfer($event)\"\n (dismiss)=\"dismissTransfer($event)\" />\n}\n\n<!-- why: chi ti\u1EBFt file l\u00E0 sd-side-drawer th\u1EADt, m\u1EDF g\u1ECDn trong v\u00F9ng danh s\u00E1ch b\u00EAn ph\u1EA3i nh\u1EDD [container]:\n header (t\u00ECm ki\u1EBFm, t\u1EA3i l\u00EAn), c\u00E2y th\u01B0 m\u1EE5c v\u00E0 h\u00E0ng ch\u1EDD truy\u1EC1n t\u1EA3i v\u1EABn d\u00F9ng \u0111\u01B0\u1EE3c khi drawer m\u1EDF. -->\n<sd-file-explorer-preview-panel\n [view]=\"_preview\"\n [state]=\"previewState()\"\n [meta]=\"previewMeta()\"\n [canDownload]=\"_canDownload\"\n [canShare]=\"_canShare\"\n [container]=\"mainRegion\"\n [autoId]=\"_autoId ? _autoId + '-preview' : undefined\"\n (close)=\"closePreview()\"\n (download)=\"downloadPreview()\"\n (share)=\"sharePreview()\"\n (retry)=\"retryPreview()\"\n (imageError)=\"onPreviewImageError()\" />\n\n@if (dragActive()) {\n <div class=\"drop-overlay\" aria-hidden=\"true\">\n <div class=\"drop-card\">\n <sd-icon name=\"file_upload\" size=\"40px\" />\n <p class=\"drop-title\">{{ dropTitle() }}</p>\n </div>\n </div>\n}\n\n@if (_dialogOpen) {\n @let _folderName = folderName();\n @let _folderError = folderError();\n <div class=\"dialog-backdrop\" aria-hidden=\"true\" (click)=\"closeFolderDialog()\"></div>\n <form\n class=\"dialog\"\n role=\"dialog\"\n aria-modal=\"true\"\n novalidate\n [attr.aria-labelledby]=\"instanceId + '-folder-title'\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-folder-dialog' : null\"\n (submit)=\"submitFolder($event)\">\n <h3 class=\"dialog-title\" [id]=\"instanceId + '-folder-title'\">{{ folderDialogTitle() }}</h3>\n <label class=\"field-label\" [for]=\"instanceId + '-folder-name'\">{{\n 'core.component.file-explorer.new-folder-name' | sdTranslate\n }}</label>\n <input\n #folderInput\n class=\"field-input\"\n autocomplete=\"off\"\n maxlength=\"255\"\n [id]=\"instanceId + '-folder-name'\"\n [value]=\"_folderName\"\n [attr.aria-invalid]=\"_folderError ? true : null\"\n [attr.aria-describedby]=\"_folderError ? instanceId + '-folder-error' : null\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-folder-name' : null\"\n (input)=\"folderName.set(folderInput.value)\" />\n @if (_folderError) {\n <p class=\"field-error\" role=\"alert\" [id]=\"instanceId + '-folder-error'\">{{ _folderError }}</p>\n }\n <div class=\"dialog-actions\">\n <sd-button\n class=\"cancel-button\"\n type=\"text\"\n color=\"secondary\"\n size=\"md\"\n [title]=\"'core.component.file-explorer.cancel' | sdTranslate\"\n (click)=\"closeFolderDialog()\" />\n <sd-button\n class=\"submit-button\"\n type=\"fill\"\n color=\"primary\"\n size=\"md\"\n htmlType=\"submit\"\n [title]=\"'core.component.file-explorer.create' | sdTranslate\"\n [disabled]=\"!_folderName.trim()\"\n [loading]=\"folderSubmitting()\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-folder-submit' : null\" />\n </div>\n </form>\n}\n\n@if (_shareItem) {\n @let _shareState = shareState();\n <div class=\"dialog-backdrop\" aria-hidden=\"true\" (click)=\"closeShare()\"></div>\n <div\n #shareDialog\n class=\"dialog\"\n role=\"dialog\"\n aria-modal=\"true\"\n tabindex=\"-1\"\n [attr.aria-labelledby]=\"instanceId + '-share-title'\"\n [attr.aria-busy]=\"_shareState.status === 'loading' ? true : null\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-share-dialog' : null\">\n <h3 class=\"dialog-title\" [id]=\"instanceId + '-share-title'\" [title]=\"_shareItem.name\">{{ shareTitle() }}</h3>\n @switch (_shareState.status) {\n @case ('loading') {\n <p class=\"share-status\" role=\"status\">\n <span class=\"spinner\" aria-hidden=\"true\"></span>\n {{ 'core.component.file-explorer.share.loading' | sdTranslate }}\n </p>\n }\n @case ('error') {\n <p class=\"field-error\" role=\"alert\">{{ _shareState.message }}</p>\n }\n @case ('ready') {\n <label class=\"field-label\" [for]=\"instanceId + '-share-link'\">{{ 'core.component.file-explorer.share.link' | sdTranslate }}</label>\n <input\n #shareInput\n class=\"field-input\"\n readonly\n [id]=\"instanceId + '-share-link'\"\n [value]=\"_shareState.url\"\n [attr.aria-describedby]=\"instanceId + '-share-feedback'\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-share-link' : null\"\n (focus)=\"shareInput.select()\" />\n <p class=\"share-feedback\" role=\"status\" aria-live=\"polite\" [id]=\"instanceId + '-share-feedback'\">{{ shareFeedbackLabel() }}</p>\n }\n }\n <div class=\"dialog-actions\">\n <sd-button\n class=\"close-button\"\n type=\"text\"\n color=\"secondary\"\n size=\"md\"\n [title]=\"'core.component.file-explorer.close' | sdTranslate\"\n (click)=\"closeShare()\" />\n @if (_shareState.status === 'error') {\n <sd-button\n class=\"retry-button\"\n type=\"outline\"\n color=\"primary\"\n size=\"md\"\n prefixIcon=\"refresh\"\n [title]=\"'core.component.file-explorer.retry' | sdTranslate\"\n (click)=\"retryShare()\" />\n } @else {\n <sd-button\n #copyButton\n class=\"copy-button\"\n type=\"fill\"\n color=\"primary\"\n size=\"md\"\n prefixIcon=\"content_copy\"\n [title]=\"\n (shareFeedback() === 'copied' ? 'core.component.file-explorer.share.copied' : 'core.component.file-explorer.share.copy')\n | sdTranslate\n \"\n [disabled]=\"_shareState.status !== 'ready'\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-share-copy' : null\"\n (click)=\"copyShareLink()\" />\n }\n </div>\n </div>\n}\n", styles: [":host{--sd-fe-accent: var(--sd-file-explorer-accent, var(--sd-primary, #005cbb));--sd-fe-accent-strong: var(--sd-file-explorer-accent-strong, color-mix(in srgb, var(--sd-fe-accent) 84%, var(--sd-file-explorer-mix-shade, #000000)));--sd-fe-accent-contrast: var(--sd-file-explorer-accent-contrast, var(--sd-primary-contrast, #ffffff));--sd-fe-accent-soft: var(--sd-file-explorer-accent-soft, color-mix(in srgb, var(--sd-fe-accent) 10%, var(--sd-file-explorer-mix-tint, #ffffff)));--sd-fe-surface: var(--sd-file-explorer-surface, #ffffff);--sd-fe-sidebar-bg: var(--sd-file-explorer-sidebar-bg, color-mix(in srgb, var(--sd-surface-muted, #e7e8ed) 26%, var(--sd-fe-surface)));--sd-fe-muted-surface: var( --sd-file-explorer-muted-surface, color-mix(in srgb, var(--sd-surface-muted, #e7e8ed) 50%, var(--sd-fe-surface)) );--sd-fe-preview-bg: var(--sd-file-explorer-preview-bg, color-mix(in srgb, var(--sd-fe-accent) 9%, var(--sd-file-explorer-mix-tint, #ffffff)));--sd-fe-border: var(--sd-file-explorer-border, color-mix(in srgb, var(--sd-border, #c4c6d0) 55%, var(--sd-file-explorer-mix-tint, #ffffff)));--sd-fe-border-strong: var(--sd-file-explorer-border-strong, var(--sd-border, #c4c6d0));--sd-fe-text: var(--sd-file-explorer-text, var(--sd-text, #1a1b1f));--sd-fe-text-secondary: var(--sd-file-explorer-text-secondary, color-mix(in srgb, var(--sd-text-secondary, #44474f) 84%, var(--sd-file-explorer-mix-tint, #ffffff)));--sd-fe-hover: color-mix(in srgb, var(--sd-fe-text) 4%, transparent);--sd-fe-hover-strong: color-mix(in srgb, var(--sd-fe-text) 8%, transparent);--sd-fe-track: color-mix(in srgb, var(--sd-fe-text) 7%, var(--sd-fe-surface));--sd-fe-success: var(--sd-file-explorer-success, var(--sd-success, #2e7d32));--sd-fe-error: var(--sd-file-explorer-error, var(--sd-error, #ba1a1a));--sd-fe-radius: var(--sd-file-explorer-radius, 16px);--sd-fe-scrim: var(--sd-file-explorer-scrim, rgba(0, 0, 0, .4));--sd-side-drawer-contained-z-index: 9;position:relative;display:flex;flex-direction:column;height:100%;min-height:480px;overflow:hidden;border:1px solid var(--sd-fe-border);border-radius:var(--sd-fe-radius);background:var(--sd-fe-surface);color:var(--sd-fe-text);font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-line-height-20, 20px)}.header{display:grid;grid-template-columns:fit-content(320px) minmax(0,1fr) auto;align-items:center;gap:12px 20px;padding:16px 20px;border-bottom:1px solid var(--sd-fe-border)}.brand{grid-column:1;display:flex;align-items:center;gap:10px;min-width:0}.brand-icon{flex:none;display:grid;place-items:center;width:32px;height:32px;border-radius:50%;background:color-mix(in srgb,var(--sd-fe-accent) 14%,var(--sd-file-explorer-mix-tint, #ffffff));color:var(--sd-fe-accent)}.brand-text{min-width:0}.brand-title{margin:0;overflow:hidden;font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-semibold, 600);line-height:var(--sd-line-height-22, 22px);text-overflow:ellipsis;white-space:nowrap}.brand-description{margin:0;overflow:hidden;font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-line-height-16, 16px);color:var(--sd-fe-text-secondary);text-overflow:ellipsis;white-space:nowrap}.search{grid-column:2;justify-self:center;display:flex;align-items:center;gap:8px;width:100%;max-width:520px;height:36px;padding:0 6px 0 12px;border:1px solid var(--sd-fe-border);border-radius:var(--sd-radius-999, 999px);background:var(--sd-fe-muted-surface);transition:border-color var(--sd-duration-fast, .12s) ease,box-shadow var(--sd-duration-fast, .12s) ease}.search:focus-within{border-color:var(--sd-fe-accent);background:var(--sd-fe-surface);box-shadow:0 0 0 3px var(--sd-fe-accent-soft)}.search-icon{flex:none;color:var(--sd-fe-text-secondary)}.search-input{flex:1;min-width:0;height:100%;padding:0;border:0;outline:none;background:transparent;color:var(--sd-fe-text);font:inherit;font-size:var(--sd-font-size-14, 14px)}.search-input::placeholder{color:var(--sd-fe-text-secondary)}.search-input::-webkit-search-cancel-button{display:none}.search-clear{flex:none;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;border:0;border-radius:var(--sd-radius-999, 999px);background:transparent;color:var(--sd-fe-text-secondary);cursor:pointer}.search-clear:hover{background:var(--sd-fe-hover-strong)}.upload-button{grid-column:3;justify-self:end}.file-input{display:none}.body{position:relative;flex:1;min-height:0;display:grid;grid-template-columns:238px minmax(0,1fr)}.sidebar{display:flex;flex-direction:column;min-height:0;padding:22px 14px 32px 12px;border-right:1px solid var(--sd-fe-border);background:var(--sd-fe-sidebar-bg)}.sidebar-label{margin:0 0 6px 10px;font-size:var(--sd-font-size-12, 12px);font-weight:var(--sd-font-weight-bold, 700);line-height:var(--sd-line-height-16, 16px);letter-spacing:.04em;text-transform:uppercase;color:var(--sd-fe-text-secondary)}.sidebar-tree{flex:1;min-height:0;margin:0 -4px;padding:2px 4px;overflow-y:auto}.sidebar-footer{margin:12px 4px 0;padding-top:18px;border-top:1px solid var(--sd-fe-border)}.new-folder-button{display:block}.main{position:relative;display:flex;flex-direction:column;min-width:0;min-height:0;padding-top:14px}.refresh-bar{position:absolute;top:0;left:0;right:0;height:2px;overflow:hidden;background:var(--sd-fe-accent-soft)}.refresh-bar:after{content:\"\";position:absolute;top:0;bottom:0;width:30%;background:var(--sd-fe-accent);animation:sd-file-explorer-refresh 1.2s ease-in-out infinite}.toolbar{display:flex;align-items:center;gap:12px;min-height:40px;padding:0 32px}.breadcrumb{flex:1;min-width:0;margin-left:-4px;font-size:var(--sd-font-size-15, 15px);font-weight:var(--sd-font-weight-semibold, 600)}.view-toggle{flex:none;display:flex;gap:2px;padding:2px;border:1px solid var(--sd-fe-border);border-radius:var(--sd-radius-999, 999px);background:var(--sd-fe-surface)}.icon-button{flex:none;display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;padding:0;border:0;border-radius:var(--sd-radius-999, 999px);background:transparent;color:var(--sd-fe-text-secondary);cursor:pointer}.icon-button:hover{background:var(--sd-fe-hover-strong);color:var(--sd-fe-text)}.icon-button:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-file-explorer-accent, var(--sd-focus-ring-color, var(--sd-primary)));outline-offset:1px}.icon-button--toggle{width:40px;height:32px}.icon-button--active,.icon-button--active:hover{background:var(--sd-fe-accent-soft);color:var(--sd-fe-accent)}.heading-row{display:flex;align-items:flex-end;justify-content:space-between;gap:12px;margin-top:10px;padding:0 32px}.heading{min-width:0;margin:0;overflow:hidden;font-size:var(--sd-font-size-18, 18px);font-weight:var(--sd-font-weight-bold, 700);line-height:26px;text-overflow:ellipsis;white-space:nowrap}.count{flex:none;padding-bottom:12px;font-size:var(--sd-font-size-13, 13px);color:var(--sd-fe-text-secondary)}.scroller{flex:1;min-height:0;padding:8px 28px 16px;overflow-y:auto}.scrim{position:absolute;inset:0;background:var(--sd-fe-scrim);animation:sd-file-explorer-fade .18s ease}.transfers{flex:none;border-top:1px solid var(--sd-fe-border);background:var(--sd-fe-surface)}.drop-overlay{position:absolute;inset:0;z-index:10;display:flex;align-items:center;justify-content:center;padding:16px;border:2px dashed var(--sd-fe-accent);border-radius:var(--sd-fe-radius);background:color-mix(in srgb,var(--sd-fe-accent) 8%,rgba(255,255,255,.86));pointer-events:none}.drop-card{display:flex;flex-direction:column;align-items:center;gap:10px;color:var(--sd-fe-accent);text-align:center}.drop-title{margin:0;font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-semibold, 600)}.dialog-backdrop{position:absolute;inset:0;z-index:20;background:var(--sd-fe-scrim)}.dialog{position:absolute;top:50%;left:50%;z-index:21;display:flex;flex-direction:column;gap:8px;width:min(400px,100% - 32px);padding:20px;border-radius:14px;background:var(--sd-fe-surface);box-shadow:0 18px 48px #0f172a2e;transform:translate(-50%,-50%)}.dialog:focus{outline:none}.dialog-title{margin:0 0 8px;font-size:17px;font-weight:var(--sd-font-weight-semibold, 600);line-height:var(--sd-line-height-24, 24px)}.field-label{font-size:var(--sd-font-size-13, 13px);color:var(--sd-fe-text-secondary)}.field-input{height:40px;padding:0 12px;border:1px solid var(--sd-fe-border-strong);border-radius:var(--sd-radius-8, 8px);background:var(--sd-fe-surface);color:var(--sd-fe-text);font:inherit;font-size:var(--sd-font-size-15, 15px);outline:none}.field-input:focus{border-color:var(--sd-fe-accent);box-shadow:0 0 0 3px var(--sd-fe-accent-soft)}.field-input[aria-invalid=true]{border-color:var(--sd-fe-error)}.field-error{margin:0;font-size:var(--sd-font-size-13, 13px);color:var(--sd-fe-error)}.dialog-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:12px}.share-status{display:flex;align-items:center;gap:10px;margin:4px 0;font-size:var(--sd-font-size-14, 14px);color:var(--sd-fe-text-secondary)}.share-feedback{min-height:18px;margin:0;font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-18, 18px);color:var(--sd-fe-success)}.spinner{flex:none;width:18px;height:18px;border:2px solid color-mix(in srgb,var(--sd-fe-accent) 20%,transparent);border-top-color:var(--sd-fe-accent);border-radius:50%;animation:sd-file-explorer-spin .8s linear infinite}:host(.sd-file-explorer--compact) .header{grid-template-columns:minmax(0,1fr) auto;gap:10px 12px;padding:12px 14px}:host(.sd-file-explorer--compact) .brand{grid-row:1;gap:10px}:host(.sd-file-explorer--compact) .upload-button{grid-column:2;grid-row:1}:host(.sd-file-explorer--compact) .search{grid-column:1/-1;grid-row:2;max-width:none}:host(.sd-file-explorer--compact) .header:not(:has(.brand)) .search{grid-column:1;grid-row:1}:host(.sd-file-explorer--compact) .body{grid-template-columns:minmax(0,1fr)}:host(.sd-file-explorer--compact) .sidebar{position:absolute;top:0;bottom:0;left:0;z-index:5;width:min(300px,86%);border-right:1px solid var(--sd-fe-border);box-shadow:12px 0 32px #0f172a1f;visibility:hidden;transform:translate(-100%);transition:transform var(--sd-duration-base, .2s) ease,visibility var(--sd-duration-base, .2s)}:host(.sd-file-explorer--compact) .sidebar--open{visibility:visible;transform:none}:host(.sd-file-explorer--compact) .scrim--sidebar{z-index:4}:host(.sd-file-explorer--compact) .main{padding-top:8px}:host(.sd-file-explorer--compact) .toolbar{gap:6px;min-height:36px;padding:0 12px 0 10px}:host(.sd-file-explorer--compact) .breadcrumb{margin-left:0}:host(.sd-file-explorer--compact) .icon-button--toggle{width:36px}:host(.sd-file-explorer--compact) .heading-row{margin-top:13px;padding:0 14px}:host(.sd-file-explorer--compact) .count{padding-bottom:8px}:host(.sd-file-explorer--compact) .scroller{padding:0 12px 12px}@keyframes sd-file-explorer-spin{to{transform:rotate(360deg)}}@keyframes sd-file-explorer-fade{0%{opacity:0}}@keyframes sd-file-explorer-refresh{0%{left:-30%}to{left:100%}}@media(prefers-reduced-motion:reduce){.scrim{animation:none}.search,:host(.sd-file-explorer--compact) .sidebar{transition:none}}\n"] }]
|
|
2728
|
-
}], ctorParameters: () => [], propDecorators: { option: [{ type: i0.Input, args: [{ isSignal: true, alias: "option", required: true }] }], open: [{ type: i0.Output, args: ["open"] }], searchInput: [{ type: i0.ViewChild, args: ['searchInput', { isSignal: true }] }], folderInput: [{ type: i0.ViewChild, args: ['folderInput', { isSignal: true }] }], newFolderButton: [{ type: i0.ViewChild, args: ['newFolderButton', { ...{ read: ElementRef }, isSignal: true }] }], copyButton: [{ type: i0.ViewChild, args: ['copyButton', { ...{ read: ElementRef }, isSignal: true }] }], shareInput: [{ type: i0.ViewChild, args: ['shareInput', { isSignal: true }] }], shareDialog: [{ type: i0.ViewChild, args: ['shareDialog', { isSignal: true }] }], sidebar: [{ type: i0.ViewChild, args: ['sidebar', { isSignal: true }] }] } });
|
|
4916
|
+
}, template: "@let _option = option();\n@let _compact = compact();\n@let _autoId = autoId();\n@let _canUpload = canUpload();\n@let _canDownload = canDownload();\n@let _view = view();\n@let _state = contentState();\n@let _keyword = keyword();\n@let _sidebarOpen = sidebarOpen();\n@let _preview = previewView();\n@let _transfers = transferViews();\n@let _heading = heading();\n@let _searching = searching();\n@let _collapsed = transfersCollapsed();\n@let _dialogOpen = folderDialogOpen();\n@let _shareItem = shareItem();\n@let _canShare = canShare();\n@let _modalOpen = _dialogOpen || !!_shareItem || !!movePickerItems();\n@let _touch = touch();\n@let _rowShortcuts = rowShortcuts();\n\n<header class=\"header\" [attr.inert]=\"_modalOpen ? '' : null\">\n @if (_option.title) {\n <div class=\"brand\">\n <span class=\"brand-icon\" aria-hidden=\"true\">\n <sd-icon name=\"folder\" size=\"20px\" />\n </span>\n <div class=\"brand-text\">\n <h2 class=\"brand-title\" [title]=\"_option.title\">{{ _option.title }}</h2>\n @if (_option.description) {\n <p class=\"brand-description\">{{ _option.description }}</p>\n }\n </div>\n </div>\n }\n\n <div class=\"search\" role=\"search\">\n <sd-icon class=\"search-icon\" name=\"search\" size=\"20px\" />\n <input\n #searchInput\n type=\"search\"\n class=\"search-input\"\n autocomplete=\"off\"\n [value]=\"_keyword\"\n [placeholder]=\"'core.component.file-explorer.search-placeholder' | sdTranslate\"\n [attr.aria-label]=\"'core.component.file-explorer.search-placeholder' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-search' : null\"\n (input)=\"onKeywordInput(searchInput.value)\" />\n @if (_keyword) {\n <button\n type=\"button\"\n class=\"search-clear\"\n [attr.aria-label]=\"'core.component.file-explorer.search-clear' | sdTranslate\"\n [title]=\"'core.component.file-explorer.search-clear' | sdTranslate\"\n (click)=\"clearSearch()\">\n <sd-icon name=\"close\" size=\"18px\" />\n </button>\n }\n </div>\n\n @if (_canUpload) {\n <sd-button\n class=\"upload-button\"\n [disabled]=\"uploadDisabled()\"\n [attr.aria-description]=\"uploadDisabled() ? ('core.component.file-explorer.action-unavailable' | sdTranslate) : null\"\n type=\"fill\"\n color=\"primary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n prefixIcon=\"file_upload\"\n [title]=\"_compact ? undefined : ('core.component.file-explorer.upload' | sdTranslate)\"\n [tooltip]=\"_compact ? ('core.component.file-explorer.upload' | sdTranslate) : undefined\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-upload' : null\"\n (click)=\"fileInput.click()\" />\n <input\n #fileInput\n type=\"file\"\n class=\"file-input\"\n multiple\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-file-input' : null\"\n (change)=\"onFilesPicked(fileInput)\" />\n }\n</header>\n\n@if (moveStatus()) {\n <sd-inform class=\"move-status\" color=\"secondary\" [hideIcon]=\"true\" [title]=\"moveStatus()!\">\n @if (moveRefreshError()) {\n <sd-button\n sdInformAction\n class=\"move-retry-button\"\n type=\"light\"\n color=\"primary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n htmlType=\"button\"\n [title]=\"'core.component.file-explorer.move.retry-refresh' | sdTranslate\"\n [disabled]=\"movePending()\"\n (click)=\"retryMoveRefresh()\" />\n }\n </sd-inform>\n}\n\n<!-- why: dialog ph\u1EE7 c\u1EA3 explorer n\u00EAn l\u00E0m inert c\u1EA3 v\u00F9ng n\u00E0y, k\u1EC3 c\u1EA3 drawer chi ti\u1EBFt \u0111ang n\u1EB1m trong .main. -->\n<div class=\"body\" [attr.inert]=\"_modalOpen ? '' : null\">\n @if (_compact && _sidebarOpen) {\n <div class=\"scrim scrim--sidebar\" aria-hidden=\"true\" (click)=\"sidebarOpen.set(false)\"></div>\n }\n <aside\n #sidebar\n class=\"sidebar\"\n [class.sidebar--open]=\"_sidebarOpen\"\n [id]=\"instanceId + '-sidebar'\"\n [attr.aria-label]=\"'core.component.file-explorer.folders' | sdTranslate\"\n [attr.inert]=\"_compact && !_sidebarOpen ? '' : null\">\n <p class=\"sidebar-label\">{{ 'core.component.file-explorer.folders' | sdTranslate }}</p>\n <div class=\"sidebar-tree\">\n <sd-file-explorer-folder-tree\n [nodes]=\"treeNodes()\"\n [moveDropTarget]=\"moveDropTarget()\"\n [label]=\"'core.component.file-explorer.tree-label' | sdTranslate\"\n [commands]=\"_option.folderCommands\"\n [touch]=\"_touch\"\n [compact]=\"_compact\"\n [menuOpenId]=\"treeMenuOpenId()\"\n (select)=\"onTreeSelect($event)\"\n (toggle)=\"onTreeToggle($event)\"\n (retry)=\"onTreeRetry($event)\"\n (openCommands)=\"openCommands($event.item, 'tree', $event.trigger)\" />\n </div>\n @if (canCreateFolder()) {\n <div class=\"sidebar-footer\">\n <sd-button\n #newFolderButton\n class=\"new-folder-button\"\n [disabled]=\"createDisabled()\"\n [attr.aria-description]=\"createDisabled() ? ('core.component.file-explorer.action-unavailable' | sdTranslate) : null\"\n type=\"outline\"\n color=\"secondary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n prefixIcon=\"add\"\n block\n [title]=\"'core.component.file-explorer.new-folder' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-new-folder' : null\"\n (click)=\"openFolderDialog()\" />\n </div>\n }\n </aside>\n\n <!-- why: .main l\u00E0 [container] c\u1EE7a drawer chi ti\u1EBFt \u2014 backdrop ch\u1EC9 ph\u1EE7 v\u00F9ng b\u00EAn ph\u1EA3i, c\u00E2y th\u01B0 m\u1EE5c v\u1EABn d\u00F9ng \u0111\u01B0\u1EE3c.\n Drawer n\u1EB1m TRONG ph\u1EA7n t\u1EED n\u00E0y n\u00EAn inert \u0111\u1EB7t tr\u00EAn t\u1EEBng kh\u1ED1i con, kh\u00F4ng \u0111\u1EB7t tr\u00EAn .main. -->\n <section #mainRegion class=\"main\" [attr.aria-label]=\"_heading\">\n @if (refreshing()) {\n <div class=\"refresh-bar\" aria-hidden=\"true\"></div>\n }\n <div class=\"toolbar\" [attr.inert]=\"_preview ? '' : null\">\n @if (_compact) {\n <button\n type=\"button\"\n class=\"icon-button\"\n [attr.aria-expanded]=\"_sidebarOpen\"\n [attr.aria-controls]=\"instanceId + '-sidebar'\"\n [attr.aria-label]=\"\n (_sidebarOpen ? 'core.component.file-explorer.close-folders' : 'core.component.file-explorer.open-folders') | sdTranslate\n \"\n [attr.data-autoid]=\"_autoId ? _autoId + '-menu' : null\"\n (click)=\"toggleSidebar()\">\n <sd-icon name=\"menu\" size=\"24px\" />\n </button>\n }\n <sd-breadcrumb\n class=\"breadcrumb\"\n [items]=\"breadcrumb().items\"\n [maxItems]=\"_compact ? 3 : 5\"\n [ariaLabel]=\"'core.component.file-explorer.breadcrumb' | sdTranslate\"\n (sdItemActivate)=\"onBreadcrumb($event)\" />\n @if (_state === 'items') {\n <span class=\"count\">{{ itemCountLabel() }}</span>\n }\n <div class=\"view-toggle\" role=\"group\" [attr.aria-label]=\"'core.component.file-explorer.view' | sdTranslate\">\n <button\n type=\"button\"\n class=\"icon-button icon-button--toggle\"\n [class.icon-button--active]=\"_view === 'list'\"\n [attr.aria-pressed]=\"_view === 'list'\"\n [attr.aria-label]=\"'core.component.file-explorer.view-list' | sdTranslate\"\n [title]=\"'core.component.file-explorer.view-list' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-view-list' : null\"\n (click)=\"setView('list')\">\n <sd-icon name=\"format_list_bulleted\" size=\"24px\" />\n </button>\n <button\n type=\"button\"\n class=\"icon-button icon-button--toggle\"\n [class.icon-button--active]=\"_view === 'grid'\"\n [attr.aria-pressed]=\"_view === 'grid'\"\n [attr.aria-label]=\"'core.component.file-explorer.view-grid' | sdTranslate\"\n [title]=\"'core.component.file-explorer.view-grid' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-view-grid' : null\"\n (click)=\"setView('grid')\">\n <sd-icon name=\"grid_view\" size=\"24px\" />\n </button>\n </div>\n </div>\n\n @let _selection = selectionView();\n @if (_selection && selectedItems().length) {\n @let _selected = selectedItems();\n @let _selectedCount = _selected.length;\n @let _summary = selectionSummary();\n @let _clearLabel = 'core.component.file-explorer.selection.clear' | sdTranslate;\n <!-- why: one band for list and grid. The select-all checkbox lives in the list header / above the grid, not here. -->\n <div\n class=\"selection\"\n role=\"group\"\n [class.selection--active]=\"_selectedCount > 0\"\n [attr.aria-label]=\"'core.component.file-explorer.selection.label' | sdTranslate\"\n [attr.inert]=\"_preview ? '' : null\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-selection' : null\">\n <div class=\"selection-summary\">\n <!-- why: one plain sentence in the translated word order (\"2 t\u1EC7p \u0111\u00E3 ch\u1ECDn\", \"\u5DF2\u9009\u62E9 2 \u4E2A\u6587\u4EF6\"); only the number is\n heavier. Each part sits in its own span: the markup whitespace between spans is dropped, so the sentence\n keeps exactly the spaces of its translation (\"2\u4EF6\u2026\" stays joined). -->\n <span class=\"selection-status\" role=\"status\">\n <span>{{ _summary.before }}</span>\n @if (_summary.count) {\n <span class=\"selection-count\">{{ _summary.count }}</span>\n }\n <span>{{ _summary.after }}</span>\n </span>\n <button\n type=\"button\"\n class=\"icon-button selection-clear\"\n [disabled]=\"!_selectedCount\"\n [attr.aria-label]=\"_clearLabel\"\n [matTooltip]=\"_clearLabel\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-selection-clear' : null\"\n (click)=\"clearSelection()\">\n <sd-icon name=\"close\" size=\"20px\" />\n </button>\n </div>\n @if (_selectedCount && selectionActions().length) {\n <!-- why: unset types follow the kind (light flat action, text group trigger). sd-button's own sizes: 32 px like the\n row commands, 48 px only on a wide touch layout; a narrow layout keeps 32 px and spaces the lines instead. -->\n <sd-file-explorer-actions\n class=\"selection-actions\"\n source=\"selector.actions\"\n defaultLeafType=\"light\"\n defaultGroupType=\"text\"\n defaultColor=\"primary\"\n [actions]=\"selectionActions()\"\n [context]=\"_selected\"\n [size]=\"_touch && !_compact ? 'lg' : 'sm'\"\n [autoId]=\"_autoId ? _autoId + '-selection-action' : undefined\" />\n }\n </div>\n }\n\n <div class=\"scroller\" [attr.inert]=\"_preview ? '' : null\">\n @switch (_state) {\n @case ('loading') {\n <sd-data-state\n state=\"loading\"\n compact\n [title]=\"(_searching ? 'core.component.file-explorer.search-loading' : 'core.component.file-explorer.loading') | sdTranslate\" />\n }\n @case ('error') {\n <sd-data-state\n state=\"error\"\n retryable\n [title]=\"(_searching ? 'core.component.file-explorer.search-error' : 'core.component.file-explorer.load-error') | sdTranslate\"\n [message]=\"errorMessage()\"\n [retryLabel]=\"'core.component.file-explorer.retry' | sdTranslate\"\n (sdRetry)=\"retryContent()\" />\n }\n @case ('empty') {\n <sd-data-state\n state=\"empty\"\n [icon]=\"_searching ? 'search_off' : 'folder_open'\"\n [title]=\"emptyTitle()\"\n [message]=\"emptyMessage()\" />\n }\n @default {\n <sd-file-explorer-item-list\n [columns]=\"columns()\"\n [moveDropTarget]=\"moveDropTarget()\"\n [canMove]=\"canMove()\"\n [movePending]=\"movePending()\"\n (move)=\"openMovePicker([$event])\"\n [items]=\"itemViews()\"\n [view]=\"_view\"\n [canDownload]=\"_canDownload && _rowShortcuts\"\n [canShare]=\"_canShare && _rowShortcuts\"\n [compact]=\"_compact\"\n [touch]=\"_touch\"\n [activeId]=\"_preview ? _preview.item.id : null\"\n [label]=\"_heading\"\n [selection]=\"_selection\"\n [fileCommands]=\"_option.fileCommands\"\n [folderCommands]=\"_option.folderCommands\"\n [menuOpenId]=\"itemsMenuOpenId()\"\n (activate)=\"onActivate($event)\"\n (download)=\"downloadItem($event.item)\"\n (share)=\"openShare($event.item)\"\n (toggleSelect)=\"toggleSelection($event)\"\n (toggleSelectAll)=\"toggleSelectAll()\"\n (openCommands)=\"openCommands($event.item, _view, $event.trigger)\" />\n }\n }\n </div>\n </section>\n</div>\n\n@if (_transfers.length) {\n <sd-file-explorer-transfer-panel\n class=\"transfers\"\n [attr.inert]=\"_modalOpen ? '' : null\"\n [transfers]=\"_transfers\"\n [title]=\"transfersTitle()\"\n [collapsed]=\"_collapsed\"\n [canClear]=\"canClearTransfers()\"\n [compact]=\"_compact\"\n [autoId]=\"_autoId ? _autoId + '-transfers' : undefined\"\n (toggleCollapsed)=\"transfersCollapsed.set(!_collapsed)\"\n (clear)=\"clearFinishedTransfers()\"\n (cancel)=\"cancelTransfer($event)\"\n (retry)=\"retryTransfer($event)\"\n (dismiss)=\"dismissTransfer($event)\" />\n}\n\n<!-- why: chi ti\u1EBFt file l\u00E0 sd-side-drawer th\u1EADt, m\u1EDF g\u1ECDn trong v\u00F9ng danh s\u00E1ch b\u00EAn ph\u1EA3i nh\u1EDD [container]:\n header (t\u00ECm ki\u1EBFm, t\u1EA3i l\u00EAn), c\u00E2y th\u01B0 m\u1EE5c v\u00E0 h\u00E0ng ch\u1EDD truy\u1EC1n t\u1EA3i v\u1EABn d\u00F9ng \u0111\u01B0\u1EE3c khi drawer m\u1EDF. -->\n<sd-file-explorer-preview-panel\n [view]=\"_preview\"\n [compact]=\"_compact\"\n [state]=\"previewState()\"\n [meta]=\"previewMeta()\"\n [canDownload]=\"_canDownload\"\n [canShare]=\"_canShare\"\n [container]=\"mainRegion\"\n [autoId]=\"_autoId ? _autoId + '-preview' : undefined\"\n (close)=\"closePreview()\"\n (download)=\"downloadPreview()\"\n (share)=\"sharePreview()\"\n (retry)=\"retryPreview()\"\n (imageError)=\"onPreviewImageError()\" />\n\n<!-- why: l\u1EC7nh c\u1EE7a m\u1ED9t m\u1EE5c tr\u00EAn layout h\u1EB9p m\u1EDF trong sd-side-drawer th\u1EADt c\u1EE7a Core (g\u1EAFn v\u00E0o <body>: backdrop, Esc, b\u1EABy focus,\n kho\u00E1 scroll trang) thay cho c\u00E1c n\u00FAt tr\u00EAn h\u00E0ng / th\u1EBB / n\u00FAt c\u00E2y. -->\n<sd-file-explorer-command-sheet\n [sheet]=\"commandSheet()\"\n [touch]=\"_touch\"\n [autoId]=\"_autoId ? _autoId + '-commands' : undefined\"\n (activate)=\"runCommand($event)\"\n (close)=\"onCommandsClosed()\" />\n\n@if (dragActive()) {\n <div class=\"drop-overlay\" aria-hidden=\"true\">\n <div class=\"drop-card\">\n <sd-icon name=\"file_upload\" size=\"40px\" />\n <p class=\"drop-title\">{{ dropTitle() }}</p>\n </div>\n </div>\n}\n\n@if (_dialogOpen) {\n @let _folderName = folderName();\n @let _folderError = folderError();\n <div class=\"dialog-backdrop\" aria-hidden=\"true\" (click)=\"closeFolderDialog()\"></div>\n <form\n class=\"dialog\"\n role=\"dialog\"\n aria-modal=\"true\"\n novalidate\n [attr.aria-labelledby]=\"instanceId + '-folder-title'\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-folder-dialog' : null\"\n (submit)=\"submitFolder($event)\">\n <h3 class=\"dialog-title\" [id]=\"instanceId + '-folder-title'\">{{ folderDialogTitle() }}</h3>\n <label class=\"field-label\" [for]=\"instanceId + '-folder-name'\">{{\n 'core.component.file-explorer.new-folder-name' | sdTranslate\n }}</label>\n <input\n #folderInput\n class=\"field-input\"\n autocomplete=\"off\"\n maxlength=\"255\"\n [id]=\"instanceId + '-folder-name'\"\n [value]=\"_folderName\"\n [attr.aria-invalid]=\"_folderError ? true : null\"\n [attr.aria-describedby]=\"_folderError ? instanceId + '-folder-error' : null\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-folder-name' : null\"\n (input)=\"folderName.set(folderInput.value)\" />\n @if (_folderError) {\n <sd-inform class=\"field-error\" color=\"error\" [hideIcon]=\"true\" [id]=\"instanceId + '-folder-error'\" [title]=\"_folderError\" />\n }\n <div class=\"dialog-actions\">\n <sd-button\n class=\"cancel-button\"\n type=\"text\"\n color=\"secondary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n [title]=\"'core.component.file-explorer.cancel' | sdTranslate\"\n (click)=\"closeFolderDialog()\" />\n <sd-button\n class=\"submit-button\"\n type=\"fill\"\n color=\"primary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n htmlType=\"submit\"\n [title]=\"'core.component.file-explorer.create' | sdTranslate\"\n [disabled]=\"!_folderName.trim()\"\n [loading]=\"folderSubmitting()\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-folder-submit' : null\" />\n </div>\n </form>\n}\n\n@if (movePickerItems()) {\n <div class=\"dialog-backdrop\" aria-hidden=\"true\" (click)=\"closeMovePicker()\"></div>\n <section\n class=\"dialog move-picker\"\n role=\"dialog\"\n aria-modal=\"true\"\n cdkTrapFocus\n [cdkTrapFocusAutoCapture]=\"true\"\n (keydown.tab)=\"$event.stopPropagation()\"\n (keydown.shift.tab)=\"$event.stopPropagation()\"\n [attr.aria-labelledby]=\"instanceId + '-move-title'\">\n <h3 cdkFocusInitial tabindex=\"-1\" [id]=\"instanceId + '-move-title'\">{{ 'core.component.file-explorer.move.to' | sdTranslate }}</h3>\n <sd-file-explorer-folder-tree\n [nodes]=\"movePickerNodes()\"\n [label]=\"'core.component.file-explorer.folders' | sdTranslate\"\n [touch]=\"_touch\"\n [compact]=\"false\"\n (select)=\"moveTarget.set($event.item)\"\n (toggle)=\"onTreeToggle($event)\"\n (retry)=\"onTreeRetry($event)\" />\n @if (!canSubmitMove() && !movePending()) {\n <sd-inform\n class=\"field-error move-destination-tip\"\n type=\"tip\"\n color=\"secondary\"\n [hideIcon]=\"true\"\n [title]=\"'core.component.file-explorer.move.destination-tip' | sdTranslate\" />\n }\n <div class=\"dialog-actions\">\n <sd-button\n class=\"move-cancel-button\"\n type=\"text\"\n color=\"secondary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n htmlType=\"button\"\n [title]=\"'core.component.file-explorer.cancel' | sdTranslate\"\n (click)=\"closeMovePicker()\" />\n <sd-button\n class=\"move-submit-button\"\n type=\"fill\"\n color=\"primary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n htmlType=\"button\"\n [title]=\"'core.component.file-explorer.move.confirm' | sdTranslate\"\n [disabled]=\"!canSubmitMove()\"\n (click)=\"submitMoveFromEvent($event)\" />\n </div>\n </section>\n}\n\n@if (_shareItem) {\n @let _shareState = shareState();\n <div class=\"dialog-backdrop\" aria-hidden=\"true\" (click)=\"closeShare()\"></div>\n <div\n #shareDialog\n class=\"dialog\"\n role=\"dialog\"\n aria-modal=\"true\"\n tabindex=\"-1\"\n [attr.aria-labelledby]=\"instanceId + '-share-title'\"\n [attr.aria-busy]=\"_shareState.status === 'loading' ? true : null\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-share-dialog' : null\">\n <h3 class=\"dialog-title\" [id]=\"instanceId + '-share-title'\" [title]=\"_shareItem.name\">{{ shareTitle() }}</h3>\n @switch (_shareState.status) {\n @case ('loading') {\n <p class=\"share-status\" role=\"status\">\n <span class=\"spinner\" aria-hidden=\"true\"></span>\n {{ 'core.component.file-explorer.share.loading' | sdTranslate }}\n </p>\n }\n @case ('error') {\n <sd-inform class=\"field-error\" color=\"error\" [hideIcon]=\"true\" [title]=\"_shareState.message\" />\n }\n @case ('ready') {\n <label class=\"field-label\" [for]=\"instanceId + '-share-link'\">{{ 'core.component.file-explorer.share.link' | sdTranslate }}</label>\n <input\n #shareInput\n class=\"field-input\"\n readonly\n [id]=\"instanceId + '-share-link'\"\n [value]=\"_shareState.url\"\n [attr.aria-describedby]=\"instanceId + '-share-feedback'\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-share-link' : null\"\n (focus)=\"shareInput.select()\" />\n <p class=\"share-feedback\" role=\"status\" aria-live=\"polite\" [id]=\"instanceId + '-share-feedback'\">{{ shareFeedbackLabel() }}</p>\n }\n }\n <div class=\"dialog-actions\">\n <sd-button\n class=\"close-button\"\n type=\"text\"\n color=\"secondary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n [title]=\"'core.component.file-explorer.close' | sdTranslate\"\n (click)=\"closeShare()\" />\n @if (_shareState.status === 'error') {\n <sd-button\n class=\"retry-button\"\n type=\"outline\"\n color=\"primary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n prefixIcon=\"refresh\"\n [title]=\"'core.component.file-explorer.retry' | sdTranslate\"\n (click)=\"retryShare()\" />\n } @else {\n <sd-button\n #copyButton\n class=\"copy-button\"\n type=\"fill\"\n color=\"primary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n prefixIcon=\"content_copy\"\n [title]=\"\n (shareFeedback() === 'copied' ? 'core.component.file-explorer.share.copied' : 'core.component.file-explorer.share.copy')\n | sdTranslate\n \"\n [disabled]=\"_shareState.status !== 'ready'\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-share-copy' : null\"\n (click)=\"copyShareLink()\" />\n }\n </div>\n </div>\n}\n", styles: [":host{--sd-fe-accent: var(--sd-file-explorer-accent, var(--sd-primary, #005cbb));--sd-fe-accent-strong: var( --sd-file-explorer-accent-strong, color-mix(in srgb, var(--sd-fe-accent) 84%, var(--sd-file-explorer-mix-shade, #000000)) );--sd-fe-accent-contrast: var(--sd-file-explorer-accent-contrast, var(--sd-primary-contrast, #ffffff));--sd-fe-accent-soft: var( --sd-file-explorer-accent-soft, color-mix(in srgb, var(--sd-fe-accent) 10%, var(--sd-file-explorer-mix-tint, var(--sd-fe-surface))) );--sd-fe-surface: var(--sd-file-explorer-surface, var(--sd-surface, #ffffff));--sd-fe-sidebar-bg: var(--sd-file-explorer-sidebar-bg, color-mix(in srgb, var(--sd-surface-muted, #e7e8ed) 26%, var(--sd-fe-surface)));--sd-fe-muted-surface: var( --sd-file-explorer-muted-surface, color-mix(in srgb, var(--sd-surface-muted, #e7e8ed) 50%, var(--sd-fe-surface)) );--sd-fe-preview-bg: var( --sd-file-explorer-preview-bg, color-mix(in srgb, var(--sd-fe-accent) 9%, var(--sd-file-explorer-mix-tint, var(--sd-fe-surface))) );--sd-fe-border: var( --sd-file-explorer-border, color-mix(in srgb, var(--sd-border, #c4c6d0) 55%, var(--sd-file-explorer-mix-tint, var(--sd-fe-surface))) );--sd-fe-border-strong: var(--sd-file-explorer-border-strong, var(--sd-border, #c4c6d0));--sd-fe-text: var(--sd-file-explorer-text, var(--sd-text, #1a1b1f));--sd-fe-text-secondary: var( --sd-file-explorer-text-secondary, color-mix(in srgb, var(--sd-text-secondary, #44474f) 84%, var(--sd-file-explorer-mix-tint, var(--sd-fe-surface))) );--sd-fe-hover: color-mix(in srgb, var(--sd-fe-text) 4%, transparent);--sd-fe-hover-strong: color-mix(in srgb, var(--sd-fe-text) 8%, transparent);--sd-fe-track: color-mix(in srgb, var(--sd-fe-text) 7%, var(--sd-fe-surface));--sd-fe-success: var(--sd-file-explorer-success, var(--sd-success, #2e7d32));--sd-fe-error: var(--sd-file-explorer-error, var(--sd-error, #ba1a1a));--sd-fe-radius: var(--sd-file-explorer-radius, 16px);--sd-fe-scrim: var(--sd-file-explorer-scrim, rgba(0, 0, 0, .4));--sd-side-drawer-contained-z-index: 9;position:relative;display:flex;flex-direction:column;height:100%;min-height:480px;overflow:hidden;border:1px solid var(--sd-fe-border);border-radius:var(--sd-fe-radius);background:var(--sd-fe-surface);color:var(--sd-fe-text);font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-line-height-20, 20px)}.header{display:grid;grid-template-columns:fit-content(320px) minmax(0,1fr) auto;align-items:center;gap:12px 20px;padding:16px 20px;border-bottom:1px solid var(--sd-fe-border)}.brand{grid-column:1;display:flex;align-items:center;gap:10px;min-width:0}.brand-icon{flex:none;display:grid;place-items:center;width:32px;height:32px;border-radius:50%;background:color-mix(in srgb,var(--sd-fe-accent) 14%,var(--sd-file-explorer-mix-tint, var(--sd-fe-surface)));color:var(--sd-fe-accent)}.brand-text{min-width:0}.brand-title{margin:0;overflow:hidden;font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-semibold, 600);line-height:var(--sd-line-height-22, 22px);text-overflow:ellipsis;white-space:nowrap}.brand-description{margin:0;overflow:hidden;font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-line-height-16, 16px);color:var(--sd-fe-text-secondary);text-overflow:ellipsis;white-space:nowrap}.search{grid-column:2;justify-self:center;display:flex;align-items:center;gap:8px;width:100%;max-width:520px;height:36px;padding:0 6px 0 12px;border:1px solid var(--sd-fe-border);border-radius:var(--sd-radius-999, 999px);background:var(--sd-fe-muted-surface);transition:border-color var(--sd-duration-fast, .12s) ease,box-shadow var(--sd-duration-fast, .12s) ease}.search:focus-within{border-color:var(--sd-fe-accent);background:var(--sd-fe-surface);box-shadow:0 0 0 3px var(--sd-fe-accent-soft)}.search-icon{flex:none;color:var(--sd-fe-text-secondary)}.search-input{flex:1;min-width:0;height:100%;padding:0;border:0;outline:none;background:transparent;color:var(--sd-fe-text);font:inherit;font-size:var(--sd-font-size-14, 14px)}.search-input::placeholder{color:var(--sd-fe-text-secondary)}.search-input::-webkit-search-cancel-button{display:none}.search-clear{flex:none;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;border:0;border-radius:var(--sd-radius-999, 999px);background:transparent;color:var(--sd-fe-text-secondary);cursor:pointer}.search-clear:hover{background:var(--sd-fe-hover-strong)}.upload-button{grid-column:3;justify-self:end}.file-input{display:none}.body{position:relative;flex:1;min-height:0;display:grid;grid-template-columns:238px minmax(0,1fr)}.sidebar{display:flex;flex-direction:column;min-height:0;padding:22px 14px 32px 12px;border-right:1px solid var(--sd-fe-border);background:var(--sd-fe-sidebar-bg)}.sidebar-label{margin:0 0 6px 10px;font-size:var(--sd-font-size-12, 12px);font-weight:var(--sd-font-weight-bold, 700);line-height:var(--sd-line-height-16, 16px);letter-spacing:.04em;text-transform:uppercase;color:var(--sd-fe-text-secondary)}.sidebar-tree{flex:1;min-height:0;margin:0 -4px;padding:2px 4px;overflow-y:auto}.sidebar-footer{margin:12px 4px 0;padding-top:18px;border-top:1px solid var(--sd-fe-border)}.new-folder-button{display:block}.main{position:relative;display:flex;flex-direction:column;min-width:0;min-height:0;padding-top:14px}.refresh-bar{position:absolute;top:0;left:0;right:0;height:2px;overflow:hidden;background:var(--sd-fe-accent-soft)}.refresh-bar:after{content:\"\";position:absolute;top:0;bottom:0;width:30%;background:var(--sd-fe-accent);animation:sd-file-explorer-refresh 1.2s ease-in-out infinite}.toolbar{display:flex;align-items:center;gap:12px;min-height:40px;padding:0 32px}.breadcrumb{flex:1;min-width:0;margin-left:-4px;font-size:var(--sd-font-size-15, 15px);font-weight:var(--sd-font-weight-semibold, 600)}.view-toggle{flex:none;display:flex;gap:2px;padding:2px;border:1px solid var(--sd-fe-border);border-radius:var(--sd-radius-999, 999px);background:var(--sd-fe-surface)}.icon-button{flex:none;display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;padding:0;border:0;border-radius:var(--sd-radius-999, 999px);background:transparent;color:var(--sd-fe-text-secondary);cursor:pointer}.icon-button:hover{background:var(--sd-fe-hover-strong);color:var(--sd-fe-text)}.icon-button:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-file-explorer-accent, var(--sd-focus-ring-color, var(--sd-primary)));outline-offset:1px}.icon-button--toggle{width:40px;height:32px}.icon-button--active,.icon-button--active:hover{background:var(--sd-fe-accent-soft);color:var(--sd-fe-accent)}.count{flex:none;font-size:var(--sd-font-size-13, 13px);color:var(--sd-fe-text-secondary)}.selection{flex:none;display:flex;flex-wrap:wrap;align-items:center;gap:8px 16px;margin:10px 28px 0;padding:6px 8px 6px 10px;border:1px solid var(--sd-fe-border);border-radius:var(--sd-radius-12, 12px);background:var(--sd-file-explorer-muted-surface, color-mix(in srgb, var(--sd-surface-muted, #e7e8ed) 50%, var(--sd-file-explorer-mix-tint, var(--sd-fe-surface))))}.selection-summary{display:flex;align-items:center;gap:4px;min-width:0}.selection-status{min-width:0;color:var(--sd-fe-text);font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-regular, 400);line-height:var(--sd-line-height-20, 20px);overflow-wrap:anywhere}.selection-count{font-weight:var(--sd-font-weight-semibold, 600)}.icon-button.selection-clear{width:32px;height:32px}.icon-button.selection-clear:disabled{cursor:default;opacity:.45}.icon-button.selection-clear:disabled:hover{background:transparent}:host(.sd-file-explorer--touch) .icon-button.selection-clear{width:var(--sd-space-48, 48px);height:var(--sd-space-48, 48px)}.selection-actions{flex:0 1 auto;justify-content:flex-end;gap:16px 8px;margin-inline-start:auto}.selection-actions:empty{display:none}:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-success.c-light,:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-success.c-text{color:var(--sd-status-success-fg, var(--sd-success-dark))}:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-success.c-light .mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic circle,:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-success.c-text .mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic circle{stroke:var(--sd-status-success-fg, var(--sd-success-dark))!important}:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-warning.c-light,:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-warning.c-text{color:var(--sd-status-warning-fg, var(--sd-warning-dark))}:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-warning.c-light .mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic circle,:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-warning.c-text .mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic circle{stroke:var(--sd-status-warning-fg, var(--sd-warning-dark))!important}:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-primary.c-text{--mat-text-button-state-layer-color: var(--sd-file-explorer-mix-tint, var(--sd-fe-surface));--mat-button-text-state-layer-color: var(--mat-text-button-state-layer-color)}:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-success.c-text{--mat-text-button-state-layer-color: var(--sd-file-explorer-mix-tint, var(--sd-fe-surface));--mat-button-text-state-layer-color: var(--mat-text-button-state-layer-color)}:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-info.c-text{--mat-text-button-state-layer-color: var(--sd-file-explorer-mix-tint, var(--sd-fe-surface));--mat-button-text-state-layer-color: var(--mat-text-button-state-layer-color)}:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-warning.c-text{--mat-text-button-state-layer-color: var(--sd-file-explorer-mix-tint, var(--sd-fe-surface));--mat-button-text-state-layer-color: var(--mat-text-button-state-layer-color)}:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-error.c-text{--mat-text-button-state-layer-color: var(--sd-file-explorer-mix-tint, var(--sd-fe-surface));--mat-button-text-state-layer-color: var(--mat-text-button-state-layer-color)}.scroller{flex:1;min-height:0;padding:8px 28px 16px;overflow-y:auto}.scrim{position:absolute;inset:0;background:var(--sd-fe-scrim);animation:sd-file-explorer-fade .18s ease}.transfers{flex:none;border-top:1px solid var(--sd-fe-border);background:var(--sd-fe-surface)}.drop-overlay{position:absolute;inset:0;z-index:10;display:flex;align-items:center;justify-content:center;padding:16px;border:2px dashed var(--sd-fe-accent);border-radius:var(--sd-fe-radius);background:color-mix(in srgb,var(--sd-fe-accent) 8%,color-mix(in srgb,var(--sd-fe-surface) 86%,transparent));pointer-events:none}.drop-card{display:flex;flex-direction:column;align-items:center;gap:10px;color:var(--sd-fe-accent);text-align:center}.drop-title{margin:0;font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-semibold, 600)}.dialog-backdrop{position:absolute;inset:0;z-index:20;background:var(--sd-fe-scrim)}.dialog{position:absolute;top:50%;left:50%;z-index:21;display:flex;flex-direction:column;gap:8px;width:min(400px,100% - 32px);padding:20px;border-radius:14px;background:var(--sd-fe-surface);box-shadow:0 18px 48px #0f172a2e;transform:translate(-50%,-50%)}.dialog:focus{outline:none}.dialog-title{margin:0 0 8px;font-size:17px;font-weight:var(--sd-font-weight-semibold, 600);line-height:var(--sd-line-height-24, 24px)}.field-label{font-size:var(--sd-font-size-13, 13px);color:var(--sd-fe-text-secondary)}.field-input{height:40px;padding:0 12px;border:1px solid var(--sd-file-explorer-border-strong, var(--sd-control-border, var(--sd-fe-border-strong)));border-radius:var(--sd-control-radius, 8px);background:var(--sd-fe-surface);color:var(--sd-fe-text);font:inherit;font-size:var(--sd-font-size-15, 15px);outline:none}.field-input:hover{border-color:var(--sd-control-border-hover, var(--sd-fe-border-strong))}.field-input:focus{border-color:var(--sd-fe-accent);box-shadow:0 0 0 3px var(--sd-fe-accent-soft)}@media(forced-colors:active){.field-input:focus{--sd-fe-focus-ring: Highlight;outline:2px solid var(--sd-fe-focus-ring);outline-offset:2px}}.field-input[aria-invalid=true]{border-color:var(--sd-fe-error)}.field-error{margin:0;font-size:var(--sd-font-size-13, 13px);color:var(--sd-fe-error)}.dialog-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:12px}.share-status{display:flex;align-items:center;gap:10px;margin:4px 0;font-size:var(--sd-font-size-14, 14px);color:var(--sd-fe-text-secondary)}.share-feedback{min-height:18px;margin:0;font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-18, 18px);color:var(--sd-fe-success)}.spinner{flex:none;width:18px;height:18px;border:2px solid color-mix(in srgb,var(--sd-fe-accent) 20%,transparent);border-top-color:var(--sd-fe-accent);border-radius:50%;animation:sd-file-explorer-spin .8s linear infinite}:host(.sd-file-explorer--compact) .header{grid-template-columns:minmax(0,1fr) auto;gap:10px 12px;padding:12px 14px}:host(.sd-file-explorer--compact) .brand{grid-row:1;gap:10px}:host(.sd-file-explorer--compact) .upload-button{grid-column:2;grid-row:1}:host(.sd-file-explorer--compact) .search{grid-column:1/-1;grid-row:2;max-width:none}:host(.sd-file-explorer--compact) .header:not(:has(.brand)) .search{grid-column:1;grid-row:1}:host(.sd-file-explorer--compact) .body{grid-template-columns:minmax(0,1fr)}:host(.sd-file-explorer--compact) .sidebar{position:absolute;top:0;bottom:0;left:0;z-index:5;width:min(300px,86%);border-right:1px solid var(--sd-fe-border);box-shadow:12px 0 32px #0f172a1f;visibility:hidden;transform:translate(-100%);transition:transform var(--sd-duration-base, .2s) ease,visibility var(--sd-duration-base, .2s)}:host(.sd-file-explorer--compact) .sidebar--open{visibility:visible;transform:none}:host(.sd-file-explorer--compact) .scrim--sidebar{z-index:4}:host(.sd-file-explorer--compact) .main{padding-top:8px}:host(.sd-file-explorer--compact) .toolbar{gap:6px;min-height:36px;padding:0 12px 0 10px}:host(.sd-file-explorer--compact) .breadcrumb{margin-left:0}:host(.sd-file-explorer--compact) .icon-button--toggle{width:36px}:host(.sd-file-explorer--compact) .heading-row{margin-top:13px;padding:0 14px}:host(.sd-file-explorer--compact) .count{padding-bottom:8px}:host(.sd-file-explorer--compact) .selection{margin:8px 12px 4px}:host(.sd-file-explorer--compact) .selection-summary{flex:1 1 100%;justify-content:space-between}:host(.sd-file-explorer--compact) .selection-actions{flex-basis:100%;justify-content:flex-start;margin-inline-start:0;padding-top:8px;border-top:1px solid var(--sd-fe-border)}:host(.sd-file-explorer--compact) .scroller{padding:0 12px 12px}@keyframes sd-file-explorer-spin{to{transform:rotate(360deg)}}@keyframes sd-file-explorer-fade{0%{opacity:0}}@keyframes sd-file-explorer-refresh{0%{left:-30%}to{left:100%}}@media(prefers-reduced-motion:reduce){.scrim{animation:none}.search,:host(.sd-file-explorer--compact) .sidebar{transition:none}}.move-status{display:block;margin:8px 16px;color:var(--sd-fe-text-secondary)}.move-picker{box-sizing:border-box;max-height:min(80vh,100% - 32px);overflow-y:auto}\n"] }]
|
|
4917
|
+
}], ctorParameters: () => [], propDecorators: { columnDefs: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => SdFileExplorerColumnDef), { isSignal: true }] }], option: [{ type: i0.Input, args: [{ isSignal: true, alias: "option", required: true }] }], open: [{ type: i0.Output, args: ["open"] }], searchInput: [{ type: i0.ViewChild, args: ['searchInput', { isSignal: true }] }], folderInput: [{ type: i0.ViewChild, args: ['folderInput', { isSignal: true }] }], newFolderButton: [{ type: i0.ViewChild, args: ['newFolderButton', { ...{ read: ElementRef }, isSignal: true }] }], copyButton: [{ type: i0.ViewChild, args: ['copyButton', { ...{ read: ElementRef }, isSignal: true }] }], shareInput: [{ type: i0.ViewChild, args: ['shareInput', { isSignal: true }] }], shareDialog: [{ type: i0.ViewChild, args: ['shareDialog', { isSignal: true }] }], sidebar: [{ type: i0.ViewChild, args: ['sidebar', { isSignal: true }] }], commandDrawer: [{ type: i0.ViewChild, args: [i0.forwardRef(() => SdFileExplorerCommandSheet), { isSignal: true }] }] } });
|
|
2729
4918
|
|
|
2730
4919
|
/**
|
|
2731
4920
|
* Generated bundle index. Do not edit.
|
|
2732
4921
|
*/
|
|
2733
4922
|
|
|
2734
|
-
export { SdFileExplorer };
|
|
4923
|
+
export { SdFileExplorer, SdFileExplorerColumnDef };
|
|
2735
4924
|
//# sourceMappingURL=sdcorejs-angular-components-file-explorer.mjs.map
|