@sdcorejs/angular 20.3.0 → 20.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/components/file-explorer/index.d.ts +447 -57
- package/components/form-generic/index.d.ts +58 -5
- package/components/index.d.ts +1 -0
- package/components/kanban/index.d.ts +179 -0
- package/components/section/index.d.ts +2 -1
- package/components/tab/index.d.ts +3 -1
- package/fesm2022/sdcorejs-angular-components-button.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-button.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-file-explorer.mjs +2162 -90
- package/fesm2022/sdcorejs-angular-components-file-explorer.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs +638 -35
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-kanban.mjs +441 -0
- package/fesm2022/sdcorejs-angular-components-kanban.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-components-section.mjs +5 -4
- package/fesm2022/sdcorejs-angular-components-section.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.mjs +12 -4
- package/fesm2022/sdcorejs-angular-components-tab.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components.mjs +1 -0
- package/fesm2022/sdcorejs-angular-components.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-segmented.mjs +244 -0
- package/fesm2022/sdcorejs-angular-forms-segmented.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-forms.mjs +8 -0
- package/fesm2022/sdcorejs-angular-forms.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-i18n.mjs +300 -0
- package/fesm2022/sdcorejs-angular-i18n.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-confirm.mjs +2 -2
- package/forms/index.d.ts +8 -6
- package/forms/segmented/index.d.ts +90 -0
- package/i18n/index.d.ts +59 -0
- package/package.json +9 -1
|
@@ -1,12 +1,477 @@
|
|
|
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';
|
|
8
12
|
import { SdIcon } from '@sdcorejs/angular/modules/icon';
|
|
9
13
|
import { SdSideDrawer } from '@sdcorejs/angular/components/side-drawer';
|
|
14
|
+
import { MatCheckbox } from '@angular/material/checkbox';
|
|
15
|
+
|
|
16
|
+
/** Resolves original callbacks without wrappers; canonical groups win as a whole. */
|
|
17
|
+
function sdFileExplorerNormalizeConfig(config) {
|
|
18
|
+
const capabilities = config.capabilities;
|
|
19
|
+
const legacy = config;
|
|
20
|
+
return {
|
|
21
|
+
...config,
|
|
22
|
+
list: config.dataSource ? config.dataSource.onList : legacy.list,
|
|
23
|
+
search: config.dataSource ? config.dataSource.onSearch : legacy.search,
|
|
24
|
+
share: capabilities?.share ? capabilities.share.onShare : legacy.share,
|
|
25
|
+
download: capabilities?.download ? capabilities.download.onDownload : legacy.download,
|
|
26
|
+
preview: capabilities?.preview ? capabilities.preview.onPreview : legacy.preview,
|
|
27
|
+
upload: capabilities?.upload ? capabilities.upload.onUpload : legacy.upload,
|
|
28
|
+
createFolder: capabilities?.createFolder ? capabilities.createFolder.onCreateFolder : legacy.createFolder,
|
|
29
|
+
shareable: capabilities?.share?.shareable,
|
|
30
|
+
downloadable: capabilities?.download?.downloadable,
|
|
31
|
+
previewable: capabilities?.preview?.previewable,
|
|
32
|
+
uploadable: capabilities?.upload?.uploadable,
|
|
33
|
+
creatable: capabilities?.createFolder?.creatable,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/** Eligibility defaults true for a supported callback and is checked again at dispatch. */
|
|
37
|
+
function sdFileExplorerEligible(state, context) {
|
|
38
|
+
return typeof state === 'function' ? !!state(context) : state !== false;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const SD_FILE_EXPLORER_MOVE_MIME = 'application/x-sd-file-explorer-move';
|
|
42
|
+
/** Whole-batch validation keeps original caller objects and rejects stale destinations. */
|
|
43
|
+
function sdFileExplorerValidateMove(items, target, known, visible = known) {
|
|
44
|
+
if (!items.length || (target !== null && (target.kind !== 'folder' || !known.includes(target))))
|
|
45
|
+
return false;
|
|
46
|
+
const ids = new Set();
|
|
47
|
+
const knownIds = new Map();
|
|
48
|
+
for (const item of known) {
|
|
49
|
+
if (knownIds.has(item.id) && knownIds.get(item.id) !== item)
|
|
50
|
+
return false;
|
|
51
|
+
knownIds.set(item.id, item);
|
|
52
|
+
}
|
|
53
|
+
const visibleIds = new Map();
|
|
54
|
+
for (const item of visible) {
|
|
55
|
+
if (visibleIds.has(item.id) && visibleIds.get(item.id) !== item)
|
|
56
|
+
return false;
|
|
57
|
+
visibleIds.set(item.id, item);
|
|
58
|
+
}
|
|
59
|
+
for (const item of items) {
|
|
60
|
+
if (item.kind !== 'file' ||
|
|
61
|
+
!visible.includes(item) ||
|
|
62
|
+
knownIds.get(item.id)?.kind === 'folder' ||
|
|
63
|
+
ids.has(item.id) ||
|
|
64
|
+
item.parentId === (target?.id ?? null))
|
|
65
|
+
return false;
|
|
66
|
+
ids.add(item.id);
|
|
67
|
+
}
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
/** Tokens resolve only inside the originating instance and only during its current gesture. */
|
|
71
|
+
class SdFileExplorerDragSession {
|
|
72
|
+
#token = null;
|
|
73
|
+
#items = [];
|
|
74
|
+
get activeItems() {
|
|
75
|
+
return this.#token === null ? null : this.#items;
|
|
76
|
+
}
|
|
77
|
+
start(items) {
|
|
78
|
+
this.#token = crypto.randomUUID();
|
|
79
|
+
this.#items = Object.freeze([...items]);
|
|
80
|
+
return this.#token;
|
|
81
|
+
}
|
|
82
|
+
resolve(token) {
|
|
83
|
+
return this.#token !== null && token === this.#token ? this.#items : null;
|
|
84
|
+
}
|
|
85
|
+
clear() {
|
|
86
|
+
this.#token = null;
|
|
87
|
+
this.#items = [];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** Defaults of `fileCommands` and `folderCommands`: `text` and `secondary`, flat or grouped. */
|
|
92
|
+
const SD_FILE_EXPLORER_COMMAND_DEFAULTS = { leafType: 'text', groupType: 'text', color: 'secondary' };
|
|
93
|
+
/** Trigger icon of a group that declares no `prefixIcon`. */
|
|
94
|
+
const GROUP_ICON = 'more_vert';
|
|
95
|
+
// 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
|
|
96
|
+
// 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.
|
|
97
|
+
const warnedDefinitions = new WeakSet();
|
|
98
|
+
const warnedMessages = new Set();
|
|
99
|
+
function text(value) {
|
|
100
|
+
return typeof value === 'string' && value.trim() ? value : undefined;
|
|
101
|
+
}
|
|
102
|
+
function evaluate(state, context) {
|
|
103
|
+
return typeof state === 'function' ? !!state(context) : !!state;
|
|
104
|
+
}
|
|
105
|
+
function warn(definition, message) {
|
|
106
|
+
if (!isDevMode())
|
|
107
|
+
return;
|
|
108
|
+
if (definition !== null && typeof definition === 'object') {
|
|
109
|
+
if (warnedDefinitions.has(definition))
|
|
110
|
+
return;
|
|
111
|
+
warnedDefinitions.add(definition);
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
if (warnedMessages.has(message))
|
|
115
|
+
return;
|
|
116
|
+
warnedMessages.add(message);
|
|
117
|
+
}
|
|
118
|
+
console.warn(message);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Why a definition cannot be rendered, or `null` when it is a usable leaf or group. TypeScript already rejects these
|
|
122
|
+
* shapes; this guards plain JavaScript and loosely typed configuration.
|
|
123
|
+
*/
|
|
124
|
+
function problem(definition, inGroup) {
|
|
125
|
+
if (definition === null || typeof definition !== 'object')
|
|
126
|
+
return 'is not an action object';
|
|
127
|
+
const { click, onClick, children, title, tooltip } = definition;
|
|
128
|
+
if (children !== undefined && children !== null && !Array.isArray(children))
|
|
129
|
+
return '`children` must be an array';
|
|
130
|
+
if (Array.isArray(children)) {
|
|
131
|
+
if (inGroup)
|
|
132
|
+
return 'is a group inside a group; groups are one level deep';
|
|
133
|
+
if (typeof click === 'function' || typeof onClick === 'function')
|
|
134
|
+
return 'declares both `click` and `children`; a group only opens its menu';
|
|
135
|
+
}
|
|
136
|
+
else if (typeof click !== 'function' && typeof onClick !== 'function') {
|
|
137
|
+
return 'needs `click` (an action) or `children` (a group)';
|
|
138
|
+
}
|
|
139
|
+
if (!text(title) && !text(tooltip))
|
|
140
|
+
return 'needs a `title` or a `tooltip` as its accessible name';
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
/** Selection capability is configuration-level. A context predicate cannot prove that every future selection is hidden. */
|
|
144
|
+
function sdFileExplorerHasActionCapability(actions) {
|
|
145
|
+
if (!Array.isArray(actions))
|
|
146
|
+
return false;
|
|
147
|
+
return actions.some((definition) => {
|
|
148
|
+
if (problem(definition, false) || definition.hidden === true)
|
|
149
|
+
return false;
|
|
150
|
+
return Array.isArray(definition.children)
|
|
151
|
+
? definition.children.some((child) => !problem(child, true) && child.hidden !== true)
|
|
152
|
+
: true;
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
function resolveMenu(group, context, path) {
|
|
156
|
+
const items = [];
|
|
157
|
+
group.children.forEach((child, index) => {
|
|
158
|
+
const reason = problem(child, true);
|
|
159
|
+
if (reason) {
|
|
160
|
+
warn(child, `[sd-file-explorer] ${path}.children[${index}] ignored: ${reason}.`);
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
if (evaluate(child.hidden, context))
|
|
164
|
+
return;
|
|
165
|
+
const title = text(child.title);
|
|
166
|
+
const tooltip = text(child.tooltip);
|
|
167
|
+
const loading = evaluate(child.loading, context);
|
|
168
|
+
items.push({
|
|
169
|
+
key: String(index),
|
|
170
|
+
definition: child,
|
|
171
|
+
label: (title ?? tooltip),
|
|
172
|
+
tooltip: title ? tooltip : undefined,
|
|
173
|
+
prefixIcon: child.prefixIcon ?? undefined,
|
|
174
|
+
suffixIcon: child.suffixIcon ?? undefined,
|
|
175
|
+
fontSet: child.fontSet ?? undefined,
|
|
176
|
+
color: child.color ?? undefined,
|
|
177
|
+
disabled: evaluate(child.disabled, context) || loading,
|
|
178
|
+
loading,
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
return items;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Visible actions of one collection for one context (the selected files, or one item), in declared order.
|
|
185
|
+
*
|
|
186
|
+
* Hidden entries, groups without a visible child and definitions that cannot be rendered are left out; nothing is
|
|
187
|
+
* regrouped or moved into an overflow menu. `source` names the collection in dev-mode warnings.
|
|
188
|
+
*/
|
|
189
|
+
function sdFileExplorerResolveActions(actions, context, defaults, source = 'actions') {
|
|
190
|
+
if (!Array.isArray(actions))
|
|
191
|
+
return [];
|
|
192
|
+
const resolved = [];
|
|
193
|
+
actions.forEach((definition, index) => {
|
|
194
|
+
const path = `${source}[${index}]`;
|
|
195
|
+
const reason = problem(definition, false);
|
|
196
|
+
if (reason) {
|
|
197
|
+
warn(definition, `[sd-file-explorer] ${path} ignored: ${reason}.`);
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
if (evaluate(definition.hidden, context))
|
|
201
|
+
return;
|
|
202
|
+
const isGroup = Array.isArray(definition.children);
|
|
203
|
+
const button = {
|
|
204
|
+
key: String(index),
|
|
205
|
+
title: text(definition.title),
|
|
206
|
+
tooltip: text(definition.tooltip),
|
|
207
|
+
prefixIcon: definition.prefixIcon ?? undefined,
|
|
208
|
+
suffixIcon: definition.suffixIcon ?? undefined,
|
|
209
|
+
fontSet: definition.fontSet ?? undefined,
|
|
210
|
+
color: definition.color ?? defaults.color,
|
|
211
|
+
type: definition.type ?? (isGroup ? defaults.groupType : defaults.leafType),
|
|
212
|
+
disabled: evaluate(definition.disabled, context),
|
|
213
|
+
loading: evaluate(definition.loading, context),
|
|
214
|
+
};
|
|
215
|
+
if (!isGroup) {
|
|
216
|
+
resolved.push({ ...button, kind: 'leaf', definition: definition });
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
const group = definition;
|
|
220
|
+
const children = resolveMenu(group, context, path);
|
|
221
|
+
if (children.length) {
|
|
222
|
+
resolved.push({ ...button, kind: 'group', definition: group, prefixIcon: group.prefixIcon ?? GROUP_ICON, children });
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
return resolved;
|
|
226
|
+
}
|
|
227
|
+
/** `true` when the action must not run now: hidden, disabled or loading for `context`, evaluated at call time. */
|
|
228
|
+
function sdFileExplorerActionBlocked(action, context) {
|
|
229
|
+
return evaluate(action.hidden, context) || evaluate(action.disabled, context) || evaluate(action.loading, context);
|
|
230
|
+
}
|
|
231
|
+
/** `true` while an entry, or an item of one of its groups, is loading: the compact trigger of the item shows it. */
|
|
232
|
+
function sdFileExplorerActionsBusy(resolved) {
|
|
233
|
+
return resolved.some(entry => entry.loading || (entry.kind === 'group' && entry.children.some(child => child.loading)));
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Entries of the compact command drawer, from the commands resolved for its item: same order, filtering and states as
|
|
237
|
+
* the desktop buttons, shown as menu-like entries. The drawer has no button variants, so `type` is dropped; a color is
|
|
238
|
+
* kept only when declared, for the icons. A group becomes a section with a text-only heading — its icon and color stay
|
|
239
|
+
* on the desktop trigger — whose children are disabled while the group itself is disabled or loading. `keys` renames
|
|
240
|
+
* entries by declared index (the row shortcuts: `share`, `download`).
|
|
241
|
+
*/
|
|
242
|
+
function sdFileExplorerSheetEntries(resolved, keys) {
|
|
243
|
+
return resolved.map(entry => {
|
|
244
|
+
const key = keys?.[Number(entry.key)] ?? entry.key;
|
|
245
|
+
if (entry.kind === 'leaf') {
|
|
246
|
+
return {
|
|
247
|
+
kind: 'leaf',
|
|
248
|
+
key,
|
|
249
|
+
label: (entry.title ?? entry.tooltip),
|
|
250
|
+
prefixIcon: entry.prefixIcon,
|
|
251
|
+
suffixIcon: entry.suffixIcon,
|
|
252
|
+
fontSet: entry.fontSet,
|
|
253
|
+
color: entry.definition.color ?? undefined,
|
|
254
|
+
disabled: entry.disabled || entry.loading,
|
|
255
|
+
loading: entry.loading,
|
|
256
|
+
definition: entry.definition,
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
const blocked = entry.disabled || entry.loading;
|
|
260
|
+
const children = entry.children.map((child) => ({
|
|
261
|
+
kind: 'leaf',
|
|
262
|
+
key: child.key,
|
|
263
|
+
label: child.label,
|
|
264
|
+
prefixIcon: child.prefixIcon,
|
|
265
|
+
suffixIcon: child.suffixIcon,
|
|
266
|
+
fontSet: child.fontSet,
|
|
267
|
+
color: child.color,
|
|
268
|
+
disabled: child.disabled || blocked,
|
|
269
|
+
loading: child.loading,
|
|
270
|
+
definition: child.definition,
|
|
271
|
+
}));
|
|
272
|
+
return {
|
|
273
|
+
kind: 'group',
|
|
274
|
+
key,
|
|
275
|
+
label: (entry.title ?? entry.tooltip),
|
|
276
|
+
disabled: entry.disabled,
|
|
277
|
+
loading: entry.loading,
|
|
278
|
+
definition: entry.definition,
|
|
279
|
+
children,
|
|
280
|
+
};
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Action area of the explorer (internal): `selector.actions`, `fileCommands` or `folderCommands` for one context.
|
|
286
|
+
*
|
|
287
|
+
* A leaf renders as an `sd-button` that runs its `click`; a group as an `sd-button` whose projected
|
|
288
|
+
* `sd-button-item`s open in the button's own Action Popover. Siblings keep their declared order and wrap onto another
|
|
289
|
+
* line when the area is narrow — nothing is folded into an automatic overflow menu.
|
|
290
|
+
*
|
|
291
|
+
* The host carries `sd-file-explorer-actions--open` while one of its menus is open and `--busy` while an entry is
|
|
292
|
+
* loading, so the row, card or tree node can keep an area that is otherwise revealed on hover visible.
|
|
293
|
+
*/
|
|
294
|
+
class SdFileExplorerActions {
|
|
295
|
+
#i18n = inject(I18nService);
|
|
296
|
+
/** Definitions to render. */
|
|
297
|
+
actions = input(undefined, ...(ngDevMode ? [{ debugName: "actions" }] : []));
|
|
298
|
+
/** Value handed to `click` and to the state predicates: the selected files, or one item. */
|
|
299
|
+
context = input.required(...(ngDevMode ? [{ debugName: "context" }] : []));
|
|
300
|
+
/** Variant of leaves (flat buttons) without `type`. */
|
|
301
|
+
defaultLeafType = input('text', ...(ngDevMode ? [{ debugName: "defaultLeafType" }] : []));
|
|
302
|
+
/** Variant of group triggers without `type`. */
|
|
303
|
+
defaultGroupType = input('text', ...(ngDevMode ? [{ debugName: "defaultGroupType" }] : []));
|
|
304
|
+
/** Color of definitions without `color`. */
|
|
305
|
+
defaultColor = input('secondary', ...(ngDevMode ? [{ debugName: "defaultColor" }] : []));
|
|
306
|
+
/** `sd-button` size of every entry. */
|
|
307
|
+
size = input('sm', ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
308
|
+
/** Collection name used in dev-mode warnings. */
|
|
309
|
+
source = input('actions', ...(ngDevMode ? [{ debugName: "source" }] : []));
|
|
310
|
+
/** Prefix of the entries' `data-autoid`, suffixed with the declared index (and the child index in menus). */
|
|
311
|
+
autoId = input(undefined, ...(ngDevMode ? [{ debugName: "autoId" }] : []));
|
|
312
|
+
// why: Angular query không dùng được trên field private kiểu ES (#) — dùng `private` của TypeScript.
|
|
313
|
+
buttons = viewChildren(SdButton, ...(ngDevMode ? [{ debugName: "buttons" }] : []));
|
|
314
|
+
entries = computed(() => sdFileExplorerResolveActions(this.actions(), this.context(), { leafType: this.defaultLeafType(), groupType: this.defaultGroupType(), color: this.defaultColor() }, this.source()), ...(ngDevMode ? [{ debugName: "entries" }] : []));
|
|
315
|
+
open = computed(() => this.buttons().some(button => button.popover.opened()), ...(ngDevMode ? [{ debugName: "open" }] : []));
|
|
316
|
+
busy = computed(() => sdFileExplorerActionsBusy(this.entries()), ...(ngDevMode ? [{ debugName: "busy" }] : []));
|
|
317
|
+
loadingLabel = computed(() => this.#i18n.t('core.component.file-explorer.action-loading'), ...(ngDevMode ? [{ debugName: "loadingLabel" }] : []));
|
|
318
|
+
run(action, group) {
|
|
319
|
+
const actions = this.actions();
|
|
320
|
+
// A stale rendered button or menu must not dispatch a definition the consumer has withdrawn.
|
|
321
|
+
if (group ? !actions?.includes(group) || !group.children.includes(action) : !actions?.includes(action))
|
|
322
|
+
return;
|
|
323
|
+
const context = this.context();
|
|
324
|
+
// 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
|
|
325
|
+
// 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.
|
|
326
|
+
if ((group && sdFileExplorerActionBlocked(group, context)) || sdFileExplorerActionBlocked(action, context))
|
|
327
|
+
return;
|
|
328
|
+
(action.onClick ?? action.click)?.(context);
|
|
329
|
+
}
|
|
330
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdFileExplorerActions, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
331
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", 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: `
|
|
332
|
+
@let _autoId = autoId();
|
|
333
|
+
@let _size = size();
|
|
334
|
+
@for (entry of entries(); track entry.key) {
|
|
335
|
+
@let _entryAutoId = _autoId ? _autoId + '-' + entry.key : null;
|
|
336
|
+
@if (entry.kind === 'leaf') {
|
|
337
|
+
<sd-button
|
|
338
|
+
class="action"
|
|
339
|
+
[type]="entry.type"
|
|
340
|
+
[color]="entry.color"
|
|
341
|
+
[size]="_size"
|
|
342
|
+
[title]="entry.title"
|
|
343
|
+
[tooltip]="entry.tooltip"
|
|
344
|
+
[prefixIcon]="entry.prefixIcon"
|
|
345
|
+
[suffixIcon]="entry.suffixIcon"
|
|
346
|
+
[fontSet]="entry.fontSet"
|
|
347
|
+
[disabled]="entry.disabled"
|
|
348
|
+
[loading]="entry.loading"
|
|
349
|
+
[attr.data-autoid]="_entryAutoId"
|
|
350
|
+
(click)="run(entry.definition)" />
|
|
351
|
+
} @else {
|
|
352
|
+
<sd-button
|
|
353
|
+
class="action action--group"
|
|
354
|
+
[type]="entry.type"
|
|
355
|
+
[color]="entry.color"
|
|
356
|
+
[size]="_size"
|
|
357
|
+
[title]="entry.title"
|
|
358
|
+
[tooltip]="entry.tooltip"
|
|
359
|
+
[prefixIcon]="entry.prefixIcon"
|
|
360
|
+
[suffixIcon]="entry.suffixIcon"
|
|
361
|
+
[fontSet]="entry.fontSet"
|
|
362
|
+
[disabled]="entry.disabled"
|
|
363
|
+
[loading]="entry.loading"
|
|
364
|
+
[attr.data-autoid]="_entryAutoId">
|
|
365
|
+
@for (child of entry.children; track child.key) {
|
|
366
|
+
<sd-button-item
|
|
367
|
+
[color]="child.color"
|
|
368
|
+
[prefixIcon]="child.prefixIcon"
|
|
369
|
+
[suffixIcon]="child.suffixIcon"
|
|
370
|
+
[fontSet]="child.fontSet"
|
|
371
|
+
[tooltip]="child.tooltip"
|
|
372
|
+
[disabled]="child.disabled"
|
|
373
|
+
[autoId]="_entryAutoId ? _entryAutoId + '-' + child.key : null"
|
|
374
|
+
(click)="run(child.definition, entry.definition)">
|
|
375
|
+
<!-- why: sd-button-item has no loading input; a busy item shows a spinner here and is disabled. -->
|
|
376
|
+
@if (child.loading) {
|
|
377
|
+
<span class="spinner" aria-hidden="true"></span>
|
|
378
|
+
}
|
|
379
|
+
{{ child.label }}
|
|
380
|
+
@if (child.loading) {
|
|
381
|
+
<span class="visually-hidden">{{ loadingLabel() }}</span>
|
|
382
|
+
}
|
|
383
|
+
</sd-button-item>
|
|
384
|
+
}
|
|
385
|
+
</sd-button>
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
`, 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%}.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"], outputs: ["click"] }, { kind: "component", type: SdButtonItem, selector: "sd-button-item", inputs: ["color", "prefixIcon", "suffixIcon", "fontSet", "disabled", "tooltip", "autoId"], outputs: ["click"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
389
|
+
}
|
|
390
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdFileExplorerActions, decorators: [{
|
|
391
|
+
type: Component,
|
|
392
|
+
args: [{ selector: 'sd-file-explorer-actions', standalone: true, imports: [SdButton, SdButtonItem], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
393
|
+
class: 'sd-file-explorer-actions',
|
|
394
|
+
'[class.sd-file-explorer-actions--open]': 'open()',
|
|
395
|
+
'[class.sd-file-explorer-actions--busy]': 'busy()',
|
|
396
|
+
}, template: `
|
|
397
|
+
@let _autoId = autoId();
|
|
398
|
+
@let _size = size();
|
|
399
|
+
@for (entry of entries(); track entry.key) {
|
|
400
|
+
@let _entryAutoId = _autoId ? _autoId + '-' + entry.key : null;
|
|
401
|
+
@if (entry.kind === 'leaf') {
|
|
402
|
+
<sd-button
|
|
403
|
+
class="action"
|
|
404
|
+
[type]="entry.type"
|
|
405
|
+
[color]="entry.color"
|
|
406
|
+
[size]="_size"
|
|
407
|
+
[title]="entry.title"
|
|
408
|
+
[tooltip]="entry.tooltip"
|
|
409
|
+
[prefixIcon]="entry.prefixIcon"
|
|
410
|
+
[suffixIcon]="entry.suffixIcon"
|
|
411
|
+
[fontSet]="entry.fontSet"
|
|
412
|
+
[disabled]="entry.disabled"
|
|
413
|
+
[loading]="entry.loading"
|
|
414
|
+
[attr.data-autoid]="_entryAutoId"
|
|
415
|
+
(click)="run(entry.definition)" />
|
|
416
|
+
} @else {
|
|
417
|
+
<sd-button
|
|
418
|
+
class="action action--group"
|
|
419
|
+
[type]="entry.type"
|
|
420
|
+
[color]="entry.color"
|
|
421
|
+
[size]="_size"
|
|
422
|
+
[title]="entry.title"
|
|
423
|
+
[tooltip]="entry.tooltip"
|
|
424
|
+
[prefixIcon]="entry.prefixIcon"
|
|
425
|
+
[suffixIcon]="entry.suffixIcon"
|
|
426
|
+
[fontSet]="entry.fontSet"
|
|
427
|
+
[disabled]="entry.disabled"
|
|
428
|
+
[loading]="entry.loading"
|
|
429
|
+
[attr.data-autoid]="_entryAutoId">
|
|
430
|
+
@for (child of entry.children; track child.key) {
|
|
431
|
+
<sd-button-item
|
|
432
|
+
[color]="child.color"
|
|
433
|
+
[prefixIcon]="child.prefixIcon"
|
|
434
|
+
[suffixIcon]="child.suffixIcon"
|
|
435
|
+
[fontSet]="child.fontSet"
|
|
436
|
+
[tooltip]="child.tooltip"
|
|
437
|
+
[disabled]="child.disabled"
|
|
438
|
+
[autoId]="_entryAutoId ? _entryAutoId + '-' + child.key : null"
|
|
439
|
+
(click)="run(child.definition, entry.definition)">
|
|
440
|
+
<!-- why: sd-button-item has no loading input; a busy item shows a spinner here and is disabled. -->
|
|
441
|
+
@if (child.loading) {
|
|
442
|
+
<span class="spinner" aria-hidden="true"></span>
|
|
443
|
+
}
|
|
444
|
+
{{ child.label }}
|
|
445
|
+
@if (child.loading) {
|
|
446
|
+
<span class="visually-hidden">{{ loadingLabel() }}</span>
|
|
447
|
+
}
|
|
448
|
+
</sd-button-item>
|
|
449
|
+
}
|
|
450
|
+
</sd-button>
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
`, 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%}.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"] }]
|
|
454
|
+
}], 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 }] }] } });
|
|
455
|
+
|
|
456
|
+
/** List-only custom metadata column. Pass the parent option as its required type anchor. */
|
|
457
|
+
// Public column-definition name follows the reviewed Explorer contract.
|
|
458
|
+
// eslint-disable-next-line @angular-eslint/directive-class-suffix
|
|
459
|
+
class SdFileExplorerColumnDef {
|
|
460
|
+
id = input.required(...(ngDevMode ? [{ debugName: "id", alias: 'sdFileExplorerColumnDef' }] : [{ alias: 'sdFileExplorerColumnDef' }]));
|
|
461
|
+
for = input.required(...(ngDevMode ? [{ debugName: "for", alias: 'sdFileExplorerColumnFor' }] : [{ alias: 'sdFileExplorerColumnFor' }]));
|
|
462
|
+
title = input.required(...(ngDevMode ? [{ debugName: "title" }] : []));
|
|
463
|
+
width = input('160px', ...(ngDevMode ? [{ debugName: "width" }] : []));
|
|
464
|
+
template = inject(TemplateRef);
|
|
465
|
+
static ngTemplateContextGuard(_directive, _context) {
|
|
466
|
+
return true;
|
|
467
|
+
}
|
|
468
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdFileExplorerColumnDef, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
469
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.25", 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 });
|
|
470
|
+
}
|
|
471
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdFileExplorerColumnDef, decorators: [{
|
|
472
|
+
type: Directive,
|
|
473
|
+
args: [{ selector: 'ng-template[sdFileExplorerColumnDef]', standalone: true }]
|
|
474
|
+
}], 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
475
|
|
|
11
476
|
// AUTO-GENERATED by scripts/generate-file-explorer-icons.mjs from ./assets/icons. DO NOT EDIT.
|
|
12
477
|
// Run `npm run generate:file-explorer-icons` at the repo root after changing the SVG files or manifest.json.
|
|
@@ -443,25 +908,375 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
|
|
|
443
908
|
}, 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"] }]
|
|
444
909
|
}], propDecorators: { icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: true }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }] } });
|
|
445
910
|
|
|
911
|
+
/** Never the whole viewport: a strip of backdrop stays visible to tap the drawer away. */
|
|
912
|
+
const SHEET_WIDTH = 'min(400px, calc(100vw - 56px))';
|
|
913
|
+
let nextSheetId = 0;
|
|
914
|
+
/**
|
|
915
|
+
* Command drawer of the compact layout (internal): the commands of one item in a Core `<sd-side-drawer>` that covers
|
|
916
|
+
* the viewport — portalled to `<body>`, with its backdrop, `Escape`, close button, focus trap and page scroll lock.
|
|
917
|
+
*
|
|
918
|
+
* The explorer owns the item and decides when the drawer opens and closes: `show()` / `hide()`. The drawer lists the
|
|
919
|
+
* same commands as the desktop buttons, as menu-like entries; a group is a labelled section with its children. A
|
|
920
|
+
* pressed entry is only reported (`activate`): the explorer checks it again, closes the drawer and runs it. `close`
|
|
921
|
+
* reports that the user closed the drawer (close button, `Escape`, backdrop).
|
|
922
|
+
*
|
|
923
|
+
* Content projected into the drawer belongs to this view, so its encapsulated styles still apply in `<body>`; the
|
|
924
|
+
* drawer element itself is styled through the class this component passes as `drawerClass`.
|
|
925
|
+
*/
|
|
926
|
+
class SdFileExplorerCommandSheet {
|
|
927
|
+
#i18n = inject(I18nService);
|
|
928
|
+
/** Content for the item whose commands are shown; `null` while nothing is open. */
|
|
929
|
+
sheet = input(null, ...(ngDevMode ? [{ debugName: "sheet" }] : []));
|
|
930
|
+
/** Touch screen: 48 px entries and a 44 px close button. */
|
|
931
|
+
touch = input(false, ...(ngDevMode ? [{ debugName: "touch" }] : []));
|
|
932
|
+
/** E2E scope of the content and its entries. */
|
|
933
|
+
autoId = input(undefined, ...(ngDevMode ? [{ debugName: "autoId" }] : []));
|
|
934
|
+
/** An entry was pressed. Nothing has run yet. */
|
|
935
|
+
activate = output();
|
|
936
|
+
/** The user closed the drawer (close button, `Escape` or backdrop). */
|
|
937
|
+
close = output();
|
|
938
|
+
// why: query signal, not an ES private field — Angular queries need a TypeScript `private` member.
|
|
939
|
+
drawer = viewChild.required(SdSideDrawer);
|
|
940
|
+
width = SHEET_WIDTH;
|
|
941
|
+
sheetId = `sd-file-explorer-commands-${nextSheetId++}`;
|
|
942
|
+
// why: sd-side-drawer renders in <body>, out of reach of this view's encapsulated styles. The explorer-owned class
|
|
943
|
+
// scopes the few rules aimed at the drawer itself (the close button size) to this drawer only.
|
|
944
|
+
drawerClass = computed(() => ({
|
|
945
|
+
'sd-file-explorer-command-drawer': true,
|
|
946
|
+
'sd-file-explorer-command-drawer--touch': this.touch(),
|
|
947
|
+
}), ...(ngDevMode ? [{ debugName: "drawerClass" }] : []));
|
|
948
|
+
// why: sd-side-drawer adds its own `components-side-drawer-` prefix; drop the explorer's `components-` to avoid a repeat.
|
|
949
|
+
drawerAutoId = computed(() => this.autoId()?.replace(/^components-/, ''), ...(ngDevMode ? [{ debugName: "drawerAutoId" }] : []));
|
|
950
|
+
loadingLabel = computed(() => this.#i18n.t('core.component.file-explorer.action-loading'), ...(ngDevMode ? [{ debugName: "loadingLabel" }] : []));
|
|
951
|
+
/** Opens the drawer; its content follows `sheet`. */
|
|
952
|
+
show() {
|
|
953
|
+
this.drawer().open();
|
|
954
|
+
}
|
|
955
|
+
/** Closes the drawer at once — focus trap, backdrop and page scroll lock included — without reporting `close`. */
|
|
956
|
+
hide() {
|
|
957
|
+
const drawer = this.drawer();
|
|
958
|
+
if (drawer.isOpened())
|
|
959
|
+
drawer.forceClose();
|
|
960
|
+
}
|
|
961
|
+
accent(color) {
|
|
962
|
+
return color ? `var(--sd-${color})` : null;
|
|
963
|
+
}
|
|
964
|
+
onDrawerClosed() {
|
|
965
|
+
// Closed by the explorer (it has already let go of the item) or by the user: the explorer tells them apart.
|
|
966
|
+
if (this.sheet())
|
|
967
|
+
this.close.emit();
|
|
968
|
+
}
|
|
969
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdFileExplorerCommandSheet, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
970
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", 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: `
|
|
971
|
+
@let _sheet = sheet();
|
|
972
|
+
@let _autoId = autoId();
|
|
973
|
+
<sd-side-drawer
|
|
974
|
+
[width]="width"
|
|
975
|
+
[title]="_sheet?.title ?? ''"
|
|
976
|
+
[drawerClass]="drawerClass()"
|
|
977
|
+
[autoId]="drawerAutoId()"
|
|
978
|
+
(sdClosed)="onDrawerClosed()">
|
|
979
|
+
@if (_sheet) {
|
|
980
|
+
<div class="sheet" [class.sheet--touch]="touch()" [attr.data-autoid]="_autoId ?? null">
|
|
981
|
+
<p class="context">
|
|
982
|
+
<sd-file-explorer-file-icon [icon]="_sheet.icon" [size]="24" />
|
|
983
|
+
<span class="context-text">{{ _sheet.context }}</span>
|
|
984
|
+
</p>
|
|
985
|
+
<div class="entries">
|
|
986
|
+
@for (entry of _sheet.entries; track entry.key) {
|
|
987
|
+
@if (entry.kind === 'group') {
|
|
988
|
+
@let _labelId = sheetId + '-group-' + entry.key;
|
|
989
|
+
<div
|
|
990
|
+
class="group"
|
|
991
|
+
role="group"
|
|
992
|
+
[attr.aria-labelledby]="entry.loading ? _labelId + ' ' + _labelId + '-busy' : _labelId"
|
|
993
|
+
[attr.aria-disabled]="entry.disabled ? true : null"
|
|
994
|
+
[attr.aria-busy]="entry.loading ? true : null">
|
|
995
|
+
<!-- why: the heading is not a control: text only, so it never repeats the icon of a child (a "Share"
|
|
996
|
+
group over a "Share" item). The group's icon stays on its desktop trigger; a busy group still
|
|
997
|
+
shows its spinner and says "in progress". -->
|
|
998
|
+
<p class="group-label">
|
|
999
|
+
@if (entry.loading) {
|
|
1000
|
+
<span class="spinner" aria-hidden="true"></span>
|
|
1001
|
+
}
|
|
1002
|
+
<span class="group-title" [id]="_labelId">{{ entry.label }}</span>
|
|
1003
|
+
@if (entry.loading) {
|
|
1004
|
+
<span class="visually-hidden" [id]="_labelId + '-busy'">{{ loadingLabel() }}</span>
|
|
1005
|
+
}
|
|
1006
|
+
</p>
|
|
1007
|
+
@for (child of entry.children; track child.key) {
|
|
1008
|
+
<ng-container
|
|
1009
|
+
[ngTemplateOutlet]="command"
|
|
1010
|
+
[ngTemplateOutletContext]="{
|
|
1011
|
+
$implicit: child,
|
|
1012
|
+
group: entry,
|
|
1013
|
+
autoId: _autoId ? _autoId + '-' + entry.key + '-' + child.key : null,
|
|
1014
|
+
}" />
|
|
1015
|
+
}
|
|
1016
|
+
</div>
|
|
1017
|
+
} @else {
|
|
1018
|
+
<ng-container
|
|
1019
|
+
[ngTemplateOutlet]="command"
|
|
1020
|
+
[ngTemplateOutletContext]="{ $implicit: entry, group: null, autoId: _autoId ? _autoId + '-' + entry.key : null }" />
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
</div>
|
|
1024
|
+
</div>
|
|
1025
|
+
}
|
|
1026
|
+
</sd-side-drawer>
|
|
1027
|
+
|
|
1028
|
+
<!-- One entry: neutral label, icons in the declared color (as Core menu items), spinner + hidden text while loading. -->
|
|
1029
|
+
<ng-template #command let-command let-group="group" let-entryAutoId="autoId">
|
|
1030
|
+
<button
|
|
1031
|
+
type="button"
|
|
1032
|
+
class="command"
|
|
1033
|
+
[disabled]="command.disabled"
|
|
1034
|
+
[style.--sd-fe-command-accent]="accent(command.color)"
|
|
1035
|
+
[attr.data-autoid]="entryAutoId"
|
|
1036
|
+
(click)="activate.emit({ command, group })">
|
|
1037
|
+
@if (command.loading) {
|
|
1038
|
+
<span class="spinner" aria-hidden="true"></span>
|
|
1039
|
+
} @else if (command.prefixIcon) {
|
|
1040
|
+
<sd-icon class="command-icon" size="20px" [name]="command.prefixIcon" [fontSet]="command.fontSet" />
|
|
1041
|
+
}
|
|
1042
|
+
<span class="command-label">{{ command.label }}</span>
|
|
1043
|
+
@if (command.suffixIcon && !command.loading) {
|
|
1044
|
+
<sd-icon class="command-icon" size="20px" [name]="command.suffixIcon" [fontSet]="command.fontSet" />
|
|
1045
|
+
}
|
|
1046
|
+
@if (command.loading) {
|
|
1047
|
+
<span class="visually-hidden">{{ loadingLabel() }}</span>
|
|
1048
|
+
}
|
|
1049
|
+
</button>
|
|
1050
|
+
</ng-template>
|
|
1051
|
+
`, 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 });
|
|
1052
|
+
}
|
|
1053
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdFileExplorerCommandSheet, decorators: [{
|
|
1054
|
+
type: Component,
|
|
1055
|
+
args: [{ selector: 'sd-file-explorer-command-sheet', standalone: true, imports: [NgTemplateOutlet, SdIcon, SdSideDrawer, SdFileExplorerFileIcon], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1056
|
+
class: 'sd-file-explorer-command-sheet',
|
|
1057
|
+
}, template: `
|
|
1058
|
+
@let _sheet = sheet();
|
|
1059
|
+
@let _autoId = autoId();
|
|
1060
|
+
<sd-side-drawer
|
|
1061
|
+
[width]="width"
|
|
1062
|
+
[title]="_sheet?.title ?? ''"
|
|
1063
|
+
[drawerClass]="drawerClass()"
|
|
1064
|
+
[autoId]="drawerAutoId()"
|
|
1065
|
+
(sdClosed)="onDrawerClosed()">
|
|
1066
|
+
@if (_sheet) {
|
|
1067
|
+
<div class="sheet" [class.sheet--touch]="touch()" [attr.data-autoid]="_autoId ?? null">
|
|
1068
|
+
<p class="context">
|
|
1069
|
+
<sd-file-explorer-file-icon [icon]="_sheet.icon" [size]="24" />
|
|
1070
|
+
<span class="context-text">{{ _sheet.context }}</span>
|
|
1071
|
+
</p>
|
|
1072
|
+
<div class="entries">
|
|
1073
|
+
@for (entry of _sheet.entries; track entry.key) {
|
|
1074
|
+
@if (entry.kind === 'group') {
|
|
1075
|
+
@let _labelId = sheetId + '-group-' + entry.key;
|
|
1076
|
+
<div
|
|
1077
|
+
class="group"
|
|
1078
|
+
role="group"
|
|
1079
|
+
[attr.aria-labelledby]="entry.loading ? _labelId + ' ' + _labelId + '-busy' : _labelId"
|
|
1080
|
+
[attr.aria-disabled]="entry.disabled ? true : null"
|
|
1081
|
+
[attr.aria-busy]="entry.loading ? true : null">
|
|
1082
|
+
<!-- why: the heading is not a control: text only, so it never repeats the icon of a child (a "Share"
|
|
1083
|
+
group over a "Share" item). The group's icon stays on its desktop trigger; a busy group still
|
|
1084
|
+
shows its spinner and says "in progress". -->
|
|
1085
|
+
<p class="group-label">
|
|
1086
|
+
@if (entry.loading) {
|
|
1087
|
+
<span class="spinner" aria-hidden="true"></span>
|
|
1088
|
+
}
|
|
1089
|
+
<span class="group-title" [id]="_labelId">{{ entry.label }}</span>
|
|
1090
|
+
@if (entry.loading) {
|
|
1091
|
+
<span class="visually-hidden" [id]="_labelId + '-busy'">{{ loadingLabel() }}</span>
|
|
1092
|
+
}
|
|
1093
|
+
</p>
|
|
1094
|
+
@for (child of entry.children; track child.key) {
|
|
1095
|
+
<ng-container
|
|
1096
|
+
[ngTemplateOutlet]="command"
|
|
1097
|
+
[ngTemplateOutletContext]="{
|
|
1098
|
+
$implicit: child,
|
|
1099
|
+
group: entry,
|
|
1100
|
+
autoId: _autoId ? _autoId + '-' + entry.key + '-' + child.key : null,
|
|
1101
|
+
}" />
|
|
1102
|
+
}
|
|
1103
|
+
</div>
|
|
1104
|
+
} @else {
|
|
1105
|
+
<ng-container
|
|
1106
|
+
[ngTemplateOutlet]="command"
|
|
1107
|
+
[ngTemplateOutletContext]="{ $implicit: entry, group: null, autoId: _autoId ? _autoId + '-' + entry.key : null }" />
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
</div>
|
|
1111
|
+
</div>
|
|
1112
|
+
}
|
|
1113
|
+
</sd-side-drawer>
|
|
1114
|
+
|
|
1115
|
+
<!-- One entry: neutral label, icons in the declared color (as Core menu items), spinner + hidden text while loading. -->
|
|
1116
|
+
<ng-template #command let-command let-group="group" let-entryAutoId="autoId">
|
|
1117
|
+
<button
|
|
1118
|
+
type="button"
|
|
1119
|
+
class="command"
|
|
1120
|
+
[disabled]="command.disabled"
|
|
1121
|
+
[style.--sd-fe-command-accent]="accent(command.color)"
|
|
1122
|
+
[attr.data-autoid]="entryAutoId"
|
|
1123
|
+
(click)="activate.emit({ command, group })">
|
|
1124
|
+
@if (command.loading) {
|
|
1125
|
+
<span class="spinner" aria-hidden="true"></span>
|
|
1126
|
+
} @else if (command.prefixIcon) {
|
|
1127
|
+
<sd-icon class="command-icon" size="20px" [name]="command.prefixIcon" [fontSet]="command.fontSet" />
|
|
1128
|
+
}
|
|
1129
|
+
<span class="command-label">{{ command.label }}</span>
|
|
1130
|
+
@if (command.suffixIcon && !command.loading) {
|
|
1131
|
+
<sd-icon class="command-icon" size="20px" [name]="command.suffixIcon" [fontSet]="command.fontSet" />
|
|
1132
|
+
}
|
|
1133
|
+
@if (command.loading) {
|
|
1134
|
+
<span class="visually-hidden">{{ loadingLabel() }}</span>
|
|
1135
|
+
}
|
|
1136
|
+
</button>
|
|
1137
|
+
</ng-template>
|
|
1138
|
+
`, 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"] }]
|
|
1139
|
+
}], 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 }] }] } });
|
|
1140
|
+
|
|
1141
|
+
/**
|
|
1142
|
+
* Compact actions trigger of one row, card or tree node (internal): a `more_vert` icon button that asks the explorer to
|
|
1143
|
+
* open the item's command drawer, emitting itself so focus can come back to it when the drawer closes.
|
|
1144
|
+
*
|
|
1145
|
+
* While one of the item's commands is loading it shows a spinner instead of the icon and stays clickable, so the drawer
|
|
1146
|
+
* can still show which command is busy and run the others.
|
|
1147
|
+
*/
|
|
1148
|
+
class SdFileExplorerMenuTrigger {
|
|
1149
|
+
#i18n = inject(I18nService);
|
|
1150
|
+
/** Accessible name and tooltip: "Actions for {name}" ("… (In progress)" while busy). */
|
|
1151
|
+
label = input.required(...(ngDevMode ? [{ debugName: "label" }] : []));
|
|
1152
|
+
/** One of the item's commands is loading. */
|
|
1153
|
+
busy = input(false, ...(ngDevMode ? [{ debugName: "busy" }] : []));
|
|
1154
|
+
/** The item's command drawer is open. */
|
|
1155
|
+
expanded = input(false, ...(ngDevMode ? [{ debugName: "expanded" }] : []));
|
|
1156
|
+
/** Touch screen: 48 px target, no tooltip. */
|
|
1157
|
+
touch = input(false, ...(ngDevMode ? [{ debugName: "touch" }] : []));
|
|
1158
|
+
/** `null` keeps the button in the tab order; the tree passes `-1` for every node but its tab stop. */
|
|
1159
|
+
tabIndex = input(null, ...(ngDevMode ? [{ debugName: "tabIndex" }] : []));
|
|
1160
|
+
autoId = input(undefined, ...(ngDevMode ? [{ debugName: "autoId" }] : []));
|
|
1161
|
+
/** Pressed: emits the native button, the element focus returns to. */
|
|
1162
|
+
activate = output();
|
|
1163
|
+
accessibleName = computed(() => this.busy() ? `${this.label()} (${this.#i18n.t('core.component.file-explorer.action-loading')})` : this.label(), ...(ngDevMode ? [{ debugName: "accessibleName" }] : []));
|
|
1164
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdFileExplorerMenuTrigger, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1165
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", 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: `
|
|
1166
|
+
<!-- why: no tooltip on touch screens — MatTooltip would take over touch gestures (touch-action: none) and block
|
|
1167
|
+
scrolling the list from the button; the accessible name is there either way. The tooltip repeats the name, so
|
|
1168
|
+
Material does not add it as a description read twice. -->
|
|
1169
|
+
<button
|
|
1170
|
+
#button
|
|
1171
|
+
type="button"
|
|
1172
|
+
class="trigger"
|
|
1173
|
+
aria-haspopup="dialog"
|
|
1174
|
+
[attr.aria-expanded]="expanded()"
|
|
1175
|
+
[attr.aria-label]="accessibleName()"
|
|
1176
|
+
[attr.tabindex]="tabIndex()"
|
|
1177
|
+
[attr.data-autoid]="autoId() ?? null"
|
|
1178
|
+
[matTooltip]="accessibleName()"
|
|
1179
|
+
[matTooltipDisabled]="touch()"
|
|
1180
|
+
(click)="activate.emit(button)">
|
|
1181
|
+
@if (busy()) {
|
|
1182
|
+
<span class="spinner" aria-hidden="true"></span>
|
|
1183
|
+
} @else {
|
|
1184
|
+
<sd-icon name="more_vert" size="20px" />
|
|
1185
|
+
}
|
|
1186
|
+
</button>
|
|
1187
|
+
`, 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 });
|
|
1188
|
+
}
|
|
1189
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdFileExplorerMenuTrigger, decorators: [{
|
|
1190
|
+
type: Component,
|
|
1191
|
+
args: [{ selector: 'sd-file-explorer-menu-trigger', standalone: true, imports: [MatTooltip, SdIcon], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1192
|
+
class: 'sd-file-explorer-menu-trigger',
|
|
1193
|
+
'[class.sd-file-explorer-menu-trigger--touch]': 'touch()',
|
|
1194
|
+
}, template: `
|
|
1195
|
+
<!-- why: no tooltip on touch screens — MatTooltip would take over touch gestures (touch-action: none) and block
|
|
1196
|
+
scrolling the list from the button; the accessible name is there either way. The tooltip repeats the name, so
|
|
1197
|
+
Material does not add it as a description read twice. -->
|
|
1198
|
+
<button
|
|
1199
|
+
#button
|
|
1200
|
+
type="button"
|
|
1201
|
+
class="trigger"
|
|
1202
|
+
aria-haspopup="dialog"
|
|
1203
|
+
[attr.aria-expanded]="expanded()"
|
|
1204
|
+
[attr.aria-label]="accessibleName()"
|
|
1205
|
+
[attr.tabindex]="tabIndex()"
|
|
1206
|
+
[attr.data-autoid]="autoId() ?? null"
|
|
1207
|
+
[matTooltip]="accessibleName()"
|
|
1208
|
+
[matTooltipDisabled]="touch()"
|
|
1209
|
+
(click)="activate.emit(button)">
|
|
1210
|
+
@if (busy()) {
|
|
1211
|
+
<span class="spinner" aria-hidden="true"></span>
|
|
1212
|
+
} @else {
|
|
1213
|
+
<sd-icon name="more_vert" size="20px" />
|
|
1214
|
+
}
|
|
1215
|
+
</button>
|
|
1216
|
+
`, 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"] }]
|
|
1217
|
+
}], 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"] }] } });
|
|
1218
|
+
|
|
1219
|
+
let nextTreeId = 0;
|
|
1220
|
+
/** Events from a folder command (or the space between them), or from the compact actions trigger, belong to it. */
|
|
1221
|
+
const COMMAND_AREAS = '.node-actions, .sd-file-explorer-menu-trigger';
|
|
446
1222
|
/**
|
|
447
1223
|
* Folder tree of the explorer (internal). Rendered as a flat `role="tree"` list whose depth is carried by
|
|
448
1224
|
* `aria-level`, with a roving tabindex and the WAI-ARIA tree keyboard model.
|
|
1225
|
+
*
|
|
1226
|
+
* Folder commands sit at the end of each folder node. On desktop they are rendered for the hovered or focused node
|
|
1227
|
+
* only — taking no room while hidden, so names keep the full width — and `Tab` from the focused node reaches them
|
|
1228
|
+
* while the tree keeps a single tab stop. A node with commands is named by its label alone and wraps its commands
|
|
1229
|
+
* onto a second line when they do not fit next to the name.
|
|
1230
|
+
*
|
|
1231
|
+
* In the compact layout a folder node carries one actions trigger instead, which asks the explorer for its command
|
|
1232
|
+
* drawer; only the trigger of the tab-stop node is in the tab order.
|
|
449
1233
|
*/
|
|
450
1234
|
class SdFileExplorerFolderTree {
|
|
1235
|
+
moveDropTarget = input(...(ngDevMode ? [undefined, { debugName: "moveDropTarget" }] : []));
|
|
451
1236
|
#host = inject(ElementRef);
|
|
452
1237
|
#i18n = inject(I18nService);
|
|
1238
|
+
/** Prefix of the label ids that name nodes with commands. */
|
|
1239
|
+
treeId = `sd-file-explorer-tree-${nextTreeId++}`;
|
|
453
1240
|
/** Visible nodes in display order. */
|
|
454
1241
|
nodes = input.required(...(ngDevMode ? [{ debugName: "nodes" }] : []));
|
|
455
1242
|
/** Accessible name of the tree. */
|
|
456
1243
|
label = input('', ...(ngDevMode ? [{ debugName: "label" }] : []));
|
|
1244
|
+
/** Commands of every folder node; the root has none. */
|
|
1245
|
+
commands = input(undefined, ...(ngDevMode ? [{ debugName: "commands" }] : []));
|
|
1246
|
+
/** Touch screen: commands always visible, with 48 px buttons (44 px compact trigger). */
|
|
1247
|
+
touch = input(false, ...(ngDevMode ? [{ debugName: "touch" }] : []));
|
|
1248
|
+
/** Compact layout: an actions trigger per folder node instead of its commands. */
|
|
1249
|
+
compact = input(false, ...(ngDevMode ? [{ debugName: "compact" }] : []));
|
|
1250
|
+
/** Id of the folder whose command drawer is open from the tree. */
|
|
1251
|
+
menuOpenId = input(null, ...(ngDevMode ? [{ debugName: "menuOpenId" }] : []));
|
|
457
1252
|
/** A node was activated (click, Enter, Space). */
|
|
458
1253
|
select = output();
|
|
459
1254
|
/** Expand / collapse requested. */
|
|
460
1255
|
toggle = output();
|
|
461
1256
|
/** Retry loading the children of a node whose listing failed. */
|
|
462
1257
|
retry = output();
|
|
1258
|
+
/** Compact actions trigger of a folder pressed. */
|
|
1259
|
+
openCommands = output();
|
|
463
1260
|
focusedKey = signal(null, ...(ngDevMode ? [{ debugName: "focusedKey" }] : []));
|
|
464
1261
|
retryLabel = computed(() => this.#i18n.t('core.component.file-explorer.retry'), ...(ngDevMode ? [{ debugName: "retryLabel" }] : []));
|
|
1262
|
+
/**
|
|
1263
|
+
* Compact: trigger state per folder node key, for folders whose drawer would list something; `null` on desktop,
|
|
1264
|
+
* where the nodes render their commands.
|
|
1265
|
+
*/
|
|
1266
|
+
menus = computed(() => {
|
|
1267
|
+
if (!this.compact())
|
|
1268
|
+
return null;
|
|
1269
|
+
const commands = this.commands();
|
|
1270
|
+
const menus = new Map();
|
|
1271
|
+
for (const node of this.nodes()) {
|
|
1272
|
+
if (!node.item)
|
|
1273
|
+
continue;
|
|
1274
|
+
const resolved = sdFileExplorerResolveActions(commands, node.item, SD_FILE_EXPLORER_COMMAND_DEFAULTS, 'folderCommands');
|
|
1275
|
+
if (resolved.length)
|
|
1276
|
+
menus.set(node.key, { busy: sdFileExplorerActionsBusy(resolved) });
|
|
1277
|
+
}
|
|
1278
|
+
return menus;
|
|
1279
|
+
}, ...(ngDevMode ? [{ debugName: "menus" }] : []));
|
|
465
1280
|
/** Node owning the roving tabindex: the focused node if still visible, else the selected one. */
|
|
466
1281
|
activeKey = computed(() => {
|
|
467
1282
|
const nodes = this.nodes();
|
|
@@ -474,6 +1289,9 @@ class SdFileExplorerFolderTree {
|
|
|
474
1289
|
const key = node.expanded ? 'core.component.file-explorer.collapse' : 'core.component.file-explorer.expand';
|
|
475
1290
|
return this.#i18n.t(key, { name: node.name });
|
|
476
1291
|
}
|
|
1292
|
+
menuLabel(node) {
|
|
1293
|
+
return this.#i18n.t('core.component.file-explorer.item-actions', { name: node.name });
|
|
1294
|
+
}
|
|
477
1295
|
onToggle(event, node) {
|
|
478
1296
|
// 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.
|
|
479
1297
|
event.stopPropagation();
|
|
@@ -483,7 +1301,15 @@ class SdFileExplorerFolderTree {
|
|
|
483
1301
|
event.stopPropagation();
|
|
484
1302
|
this.retry.emit(node);
|
|
485
1303
|
}
|
|
1304
|
+
onClick(event, node) {
|
|
1305
|
+
if (this.#fromCommands(event))
|
|
1306
|
+
return;
|
|
1307
|
+
this.select.emit(node);
|
|
1308
|
+
}
|
|
486
1309
|
onKeydown(event, index) {
|
|
1310
|
+
// 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.
|
|
1311
|
+
if (this.#fromCommands(event))
|
|
1312
|
+
return;
|
|
487
1313
|
const nodes = this.nodes();
|
|
488
1314
|
const node = nodes[index];
|
|
489
1315
|
if (!node)
|
|
@@ -537,16 +1363,35 @@ class SdFileExplorerFolderTree {
|
|
|
537
1363
|
const element = this.#host.nativeElement.querySelectorAll('[role="treeitem"]')[index];
|
|
538
1364
|
element?.focus();
|
|
539
1365
|
}
|
|
1366
|
+
/** The event started on a folder command (or the space between them) or on the actions trigger of the node. */
|
|
1367
|
+
#fromCommands(event) {
|
|
1368
|
+
const target = event.target instanceof Element ? event.target : null;
|
|
1369
|
+
const area = target?.closest(COMMAND_AREAS);
|
|
1370
|
+
return !!area && event.currentTarget instanceof Element && event.currentTarget.contains(area);
|
|
1371
|
+
}
|
|
540
1372
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdFileExplorerFolderTree, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
541
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", 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: `
|
|
1373
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", 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: `
|
|
542
1374
|
@let _nodes = nodes();
|
|
543
1375
|
@let _active = activeKey();
|
|
1376
|
+
@let _commands = commands();
|
|
1377
|
+
@let _hasCommands = !!_commands?.length;
|
|
1378
|
+
@let _touch = touch();
|
|
1379
|
+
@let _commandSize = _touch ? 'lg' : 'sm';
|
|
1380
|
+
@let _menus = menus();
|
|
1381
|
+
@let _menuOpenId = menuOpenId();
|
|
544
1382
|
<ul class="tree" role="tree" [attr.aria-label]="label()">
|
|
545
1383
|
@for (node of _nodes; track node.key; let i = $index) {
|
|
1384
|
+
@let _nodeCommands = _hasCommands && !!node.item;
|
|
1385
|
+
@let _labelId = treeId + '-label-' + i;
|
|
546
1386
|
<li
|
|
547
1387
|
class="node"
|
|
548
1388
|
role="treeitem"
|
|
1389
|
+
[attr.data-move-target]="node.id ?? ''"
|
|
1390
|
+
[class.move-drop-target]="moveDropTarget() === node.id"
|
|
549
1391
|
[class.node--selected]="node.selected"
|
|
1392
|
+
[class.node--commands]="_nodeCommands"
|
|
1393
|
+
[class.node--error]="node.status === 'error'"
|
|
1394
|
+
[attr.aria-labelledby]="_nodeCommands ? _labelId : null"
|
|
550
1395
|
[attr.aria-level]="node.level"
|
|
551
1396
|
[attr.aria-selected]="node.selected"
|
|
552
1397
|
[attr.aria-expanded]="node.expandable ? node.expanded : null"
|
|
@@ -554,7 +1399,7 @@ class SdFileExplorerFolderTree {
|
|
|
554
1399
|
[attr.tabindex]="node.key === _active ? 0 : -1"
|
|
555
1400
|
[attr.data-autoid]="node.autoId"
|
|
556
1401
|
[style.--sd-file-explorer-tree-indent]="(node.level > 1 ? node.level - 2 : 0) * 22 + 'px'"
|
|
557
|
-
(click)="
|
|
1402
|
+
(click)="onClick($event, node)"
|
|
558
1403
|
(keydown)="onKeydown($event, i)"
|
|
559
1404
|
(focus)="focusedKey.set(node.key)">
|
|
560
1405
|
@if (node.level > 1) {
|
|
@@ -574,7 +1419,7 @@ class SdFileExplorerFolderTree {
|
|
|
574
1419
|
}
|
|
575
1420
|
}
|
|
576
1421
|
<sd-file-explorer-file-icon [icon]="node.expanded ? 'folder-open' : 'folder-closed'" [size]="28" />
|
|
577
|
-
<span class="label" [title]="node.name">{{ node.name }}</span>
|
|
1422
|
+
<span class="label" [id]="_labelId" [title]="node.name">{{ node.name }}</span>
|
|
578
1423
|
@if (node.status === 'loading') {
|
|
579
1424
|
<span class="spinner" aria-hidden="true"></span>
|
|
580
1425
|
} @else if (node.status === 'error') {
|
|
@@ -588,22 +1433,64 @@ class SdFileExplorerFolderTree {
|
|
|
588
1433
|
<sd-icon name="refresh" size="16px" />
|
|
589
1434
|
</button>
|
|
590
1435
|
}
|
|
1436
|
+
@if (_nodeCommands) {
|
|
1437
|
+
@if (node.item; as folder) {
|
|
1438
|
+
@if (!_menus) {
|
|
1439
|
+
<sd-file-explorer-actions
|
|
1440
|
+
class="node-actions"
|
|
1441
|
+
source="folderCommands"
|
|
1442
|
+
[actions]="_commands"
|
|
1443
|
+
[context]="folder"
|
|
1444
|
+
[size]="_commandSize"
|
|
1445
|
+
[autoId]="node.autoId ? node.autoId + '-command' : undefined" />
|
|
1446
|
+
} @else {
|
|
1447
|
+
@if (_menus.get(node.key); as menu) {
|
|
1448
|
+
<sd-file-explorer-menu-trigger
|
|
1449
|
+
class="node-menu"
|
|
1450
|
+
[label]="menuLabel(node)"
|
|
1451
|
+
[busy]="menu.busy"
|
|
1452
|
+
[expanded]="folder.id === _menuOpenId"
|
|
1453
|
+
[touch]="_touch"
|
|
1454
|
+
[tabIndex]="node.key === _active ? 0 : -1"
|
|
1455
|
+
[autoId]="node.autoId ? node.autoId + '-commands' : undefined"
|
|
1456
|
+
(activate)="openCommands.emit({ item: folder, trigger: $event })" />
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
591
1461
|
</li>
|
|
592
1462
|
}
|
|
593
1463
|
</ul>
|
|
594
|
-
`, isInline: true, styles: ["
|
|
1464
|
+
`, 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 });
|
|
595
1465
|
}
|
|
596
1466
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdFileExplorerFolderTree, decorators: [{
|
|
597
1467
|
type: Component,
|
|
598
|
-
args: [{ selector: 'sd-file-explorer-folder-tree', standalone: true, imports: [SdIcon, SdFileExplorerFileIcon], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1468
|
+
args: [{ selector: 'sd-file-explorer-folder-tree', standalone: true, imports: [SdIcon, SdFileExplorerActions, SdFileExplorerFileIcon, SdFileExplorerMenuTrigger], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1469
|
+
class: 'sd-file-explorer-folder-tree',
|
|
1470
|
+
'[class.sd-file-explorer-folder-tree--touch]': 'touch()',
|
|
1471
|
+
'[class.sd-file-explorer-folder-tree--compact]': 'compact()',
|
|
1472
|
+
}, template: `
|
|
599
1473
|
@let _nodes = nodes();
|
|
600
1474
|
@let _active = activeKey();
|
|
1475
|
+
@let _commands = commands();
|
|
1476
|
+
@let _hasCommands = !!_commands?.length;
|
|
1477
|
+
@let _touch = touch();
|
|
1478
|
+
@let _commandSize = _touch ? 'lg' : 'sm';
|
|
1479
|
+
@let _menus = menus();
|
|
1480
|
+
@let _menuOpenId = menuOpenId();
|
|
601
1481
|
<ul class="tree" role="tree" [attr.aria-label]="label()">
|
|
602
1482
|
@for (node of _nodes; track node.key; let i = $index) {
|
|
1483
|
+
@let _nodeCommands = _hasCommands && !!node.item;
|
|
1484
|
+
@let _labelId = treeId + '-label-' + i;
|
|
603
1485
|
<li
|
|
604
1486
|
class="node"
|
|
605
1487
|
role="treeitem"
|
|
1488
|
+
[attr.data-move-target]="node.id ?? ''"
|
|
1489
|
+
[class.move-drop-target]="moveDropTarget() === node.id"
|
|
606
1490
|
[class.node--selected]="node.selected"
|
|
1491
|
+
[class.node--commands]="_nodeCommands"
|
|
1492
|
+
[class.node--error]="node.status === 'error'"
|
|
1493
|
+
[attr.aria-labelledby]="_nodeCommands ? _labelId : null"
|
|
607
1494
|
[attr.aria-level]="node.level"
|
|
608
1495
|
[attr.aria-selected]="node.selected"
|
|
609
1496
|
[attr.aria-expanded]="node.expandable ? node.expanded : null"
|
|
@@ -611,7 +1498,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
|
|
|
611
1498
|
[attr.tabindex]="node.key === _active ? 0 : -1"
|
|
612
1499
|
[attr.data-autoid]="node.autoId"
|
|
613
1500
|
[style.--sd-file-explorer-tree-indent]="(node.level > 1 ? node.level - 2 : 0) * 22 + 'px'"
|
|
614
|
-
(click)="
|
|
1501
|
+
(click)="onClick($event, node)"
|
|
615
1502
|
(keydown)="onKeydown($event, i)"
|
|
616
1503
|
(focus)="focusedKey.set(node.key)">
|
|
617
1504
|
@if (node.level > 1) {
|
|
@@ -631,7 +1518,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
|
|
|
631
1518
|
}
|
|
632
1519
|
}
|
|
633
1520
|
<sd-file-explorer-file-icon [icon]="node.expanded ? 'folder-open' : 'folder-closed'" [size]="28" />
|
|
634
|
-
<span class="label" [title]="node.name">{{ node.name }}</span>
|
|
1521
|
+
<span class="label" [id]="_labelId" [title]="node.name">{{ node.name }}</span>
|
|
635
1522
|
@if (node.status === 'loading') {
|
|
636
1523
|
<span class="spinner" aria-hidden="true"></span>
|
|
637
1524
|
} @else if (node.status === 'error') {
|
|
@@ -645,17 +1532,56 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
|
|
|
645
1532
|
<sd-icon name="refresh" size="16px" />
|
|
646
1533
|
</button>
|
|
647
1534
|
}
|
|
1535
|
+
@if (_nodeCommands) {
|
|
1536
|
+
@if (node.item; as folder) {
|
|
1537
|
+
@if (!_menus) {
|
|
1538
|
+
<sd-file-explorer-actions
|
|
1539
|
+
class="node-actions"
|
|
1540
|
+
source="folderCommands"
|
|
1541
|
+
[actions]="_commands"
|
|
1542
|
+
[context]="folder"
|
|
1543
|
+
[size]="_commandSize"
|
|
1544
|
+
[autoId]="node.autoId ? node.autoId + '-command' : undefined" />
|
|
1545
|
+
} @else {
|
|
1546
|
+
@if (_menus.get(node.key); as menu) {
|
|
1547
|
+
<sd-file-explorer-menu-trigger
|
|
1548
|
+
class="node-menu"
|
|
1549
|
+
[label]="menuLabel(node)"
|
|
1550
|
+
[busy]="menu.busy"
|
|
1551
|
+
[expanded]="folder.id === _menuOpenId"
|
|
1552
|
+
[touch]="_touch"
|
|
1553
|
+
[tabIndex]="node.key === _active ? 0 : -1"
|
|
1554
|
+
[autoId]="node.autoId ? node.autoId + '-commands' : undefined"
|
|
1555
|
+
(activate)="openCommands.emit({ item: folder, trigger: $event })" />
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
648
1560
|
</li>
|
|
649
1561
|
}
|
|
650
1562
|
</ul>
|
|
651
|
-
`, styles: ["
|
|
652
|
-
}], 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"] }] } });
|
|
1563
|
+
`, 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"] }]
|
|
1564
|
+
}], 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"] }] } });
|
|
653
1565
|
|
|
1566
|
+
/** Rows and cards ignore clicks and Enter / Space coming from these areas: they belong to a checkbox or a command. */
|
|
1567
|
+
const CONTROL_AREAS = '.cell--select, .card-top, .commands, .sd-file-explorer-menu-trigger';
|
|
654
1568
|
/**
|
|
655
1569
|
* Items of the current folder (or search results) as a list or a grid (internal).
|
|
656
|
-
* Rows and cards are focusable; `Enter` / `Space` activate them like a click.
|
|
1570
|
+
* Rows and cards are focusable; `Enter` / `Space` activate them like a click. Selection checkboxes and commands sit
|
|
1571
|
+
* next to the name and never activate the item.
|
|
1572
|
+
*
|
|
1573
|
+
* In the compact layout a row or card carries one actions trigger instead of its commands and row shortcuts: the
|
|
1574
|
+
* explorer lists them in its command drawer.
|
|
657
1575
|
*/
|
|
658
1576
|
class SdFileExplorerItemList {
|
|
1577
|
+
canMove = input(false, ...(ngDevMode ? [{ debugName: "canMove" }] : []));
|
|
1578
|
+
moveDropTarget = input(...(ngDevMode ? [undefined, { debugName: "moveDropTarget" }] : []));
|
|
1579
|
+
movePending = input(false, ...(ngDevMode ? [{ debugName: "movePending" }] : []));
|
|
1580
|
+
move = output();
|
|
1581
|
+
columns = input([], ...(ngDevMode ? [{ debugName: "columns" }] : []));
|
|
1582
|
+
columnWidths = computed(() => this.columns()
|
|
1583
|
+
.map(column => column.width())
|
|
1584
|
+
.join(' '), ...(ngDevMode ? [{ debugName: "columnWidths" }] : []));
|
|
659
1585
|
/** Items to render, already formatted. */
|
|
660
1586
|
items = input.required(...(ngDevMode ? [{ debugName: "items" }] : []));
|
|
661
1587
|
/** `list` or `grid`. */
|
|
@@ -664,43 +1590,133 @@ class SdFileExplorerItemList {
|
|
|
664
1590
|
canDownload = input(false, ...(ngDevMode ? [{ debugName: "canDownload" }] : []));
|
|
665
1591
|
/** Show share buttons for files. */
|
|
666
1592
|
canShare = input(false, ...(ngDevMode ? [{ debugName: "canShare" }] : []));
|
|
667
|
-
/** Narrow layout: hides the modified column. */
|
|
1593
|
+
/** Narrow layout: hides the modified column and replaces commands and row shortcuts with an actions trigger. */
|
|
668
1594
|
compact = input(false, ...(ngDevMode ? [{ debugName: "compact" }] : []));
|
|
1595
|
+
/** Touch screen: commands always visible, with 48 px touch targets. */
|
|
1596
|
+
touch = input(false, ...(ngDevMode ? [{ debugName: "touch" }] : []));
|
|
669
1597
|
/** Id of the file currently shown in the preview panel. */
|
|
670
1598
|
activeId = input(null, ...(ngDevMode ? [{ debugName: "activeId" }] : []));
|
|
671
1599
|
/** Accessible name of the list. */
|
|
672
1600
|
label = input('', ...(ngDevMode ? [{ debugName: "label" }] : []));
|
|
1601
|
+
/** Selection state; `null` hides every checkbox. */
|
|
1602
|
+
selection = input(null, ...(ngDevMode ? [{ debugName: "selection" }] : []));
|
|
1603
|
+
/** Commands of file rows and cards. */
|
|
1604
|
+
fileCommands = input(undefined, ...(ngDevMode ? [{ debugName: "fileCommands" }] : []));
|
|
1605
|
+
/** Commands of folder rows and cards. */
|
|
1606
|
+
folderCommands = input(undefined, ...(ngDevMode ? [{ debugName: "folderCommands" }] : []));
|
|
1607
|
+
/** Id of the item whose command drawer is open from this list. */
|
|
1608
|
+
menuOpenId = input(null, ...(ngDevMode ? [{ debugName: "menuOpenId" }] : []));
|
|
673
1609
|
/** Row / card activated. */
|
|
674
1610
|
activate = output();
|
|
1611
|
+
/** Compact actions trigger pressed. */
|
|
1612
|
+
openCommands = output();
|
|
675
1613
|
/** Download button pressed. */
|
|
676
1614
|
download = output();
|
|
677
1615
|
/** Share button pressed. */
|
|
678
1616
|
share = output();
|
|
679
|
-
/**
|
|
1617
|
+
/** Checkbox of a file toggled. */
|
|
1618
|
+
toggleSelect = output();
|
|
1619
|
+
/** Select-all checkbox toggled. */
|
|
1620
|
+
toggleSelectAll = output();
|
|
1621
|
+
/**
|
|
1622
|
+
* Width of the row action column: one 32 px icon button per row shortcut on desktop; the actions trigger (32 px,
|
|
1623
|
+
* 48 px on touch) in compact.
|
|
1624
|
+
*/
|
|
680
1625
|
actionsWidth = computed(() => {
|
|
1626
|
+
if (this.compact())
|
|
1627
|
+
return this.menuColumn() ? `${(this.touch() ? 48 : 32) + 4}px` : null;
|
|
681
1628
|
const count = (this.canDownload() ? 1 : 0) + (this.canShare() ? 1 : 0);
|
|
682
1629
|
if (!count)
|
|
683
1630
|
return null;
|
|
684
|
-
return `${count * 32 + (count - 1) * 2 +
|
|
1631
|
+
return `${count * 32 + (count - 1) * 2 + 12}px`;
|
|
685
1632
|
}, ...(ngDevMode ? [{ debugName: "actionsWidth" }] : []));
|
|
1633
|
+
hasCommands = computed(() => !!(this.fileCommands()?.length || this.folderCommands()?.length), ...(ngDevMode ? [{ debugName: "hasCommands" }] : []));
|
|
1634
|
+
rows = computed(() => {
|
|
1635
|
+
const selection = this.selection();
|
|
1636
|
+
const fileCommands = this.fileCommands();
|
|
1637
|
+
const folderCommands = this.folderCommands();
|
|
1638
|
+
const compact = this.compact();
|
|
1639
|
+
// why: only list rows carry the download / share shortcuts — grid cards never did — so only they bring them into
|
|
1640
|
+
// the drawer. The explorer turns them off as soon as fileCommands is declared.
|
|
1641
|
+
const shortcuts = this.view() === 'list' && (this.canDownload() || this.canShare());
|
|
1642
|
+
return this.items().map(view => {
|
|
1643
|
+
const isFile = view.item.kind === 'file';
|
|
1644
|
+
const commands = isFile ? fileCommands : folderCommands;
|
|
1645
|
+
const source = isFile ? 'fileCommands' : 'folderCommands';
|
|
1646
|
+
return {
|
|
1647
|
+
view,
|
|
1648
|
+
selectable: !!selection && isFile,
|
|
1649
|
+
selected: !!selection?.selectedIds.has(view.item.id),
|
|
1650
|
+
selectDisabled: !!selection?.disabledIds.has(view.item.id),
|
|
1651
|
+
commands: !compact && commands?.length ? commands : null,
|
|
1652
|
+
source,
|
|
1653
|
+
menu: compact ? this.#menu(commands, view.item, source, isFile && shortcuts) : null,
|
|
1654
|
+
};
|
|
1655
|
+
});
|
|
1656
|
+
}, ...(ngDevMode ? [{ debugName: "rows" }] : []));
|
|
1657
|
+
/** Compact list with at least one actions trigger: the action column holds them. */
|
|
1658
|
+
menuColumn = computed(() => this.rows().some(row => row.menu), ...(ngDevMode ? [{ debugName: "menuColumn" }] : []));
|
|
1659
|
+
/** Trigger state of one item: `null` when its drawer would be empty. Same filtering as the drawer and the buttons. */
|
|
1660
|
+
#menu(commands, item, source, shortcuts) {
|
|
1661
|
+
const resolved = sdFileExplorerResolveActions(commands, item, SD_FILE_EXPLORER_COMMAND_DEFAULTS, source);
|
|
1662
|
+
return resolved.length || shortcuts ? { busy: sdFileExplorerActionsBusy(resolved) } : null;
|
|
1663
|
+
}
|
|
1664
|
+
onClick(event, view) {
|
|
1665
|
+
if (this.#fromControl(event))
|
|
1666
|
+
return;
|
|
1667
|
+
this.activate.emit(view);
|
|
1668
|
+
}
|
|
686
1669
|
onKeydown(event, view) {
|
|
687
1670
|
if (event.key !== 'Enter' && event.key !== ' ')
|
|
688
1671
|
return;
|
|
1672
|
+
if (this.#fromControl(event))
|
|
1673
|
+
return;
|
|
689
1674
|
event.preventDefault();
|
|
690
1675
|
this.activate.emit(view);
|
|
691
1676
|
}
|
|
1677
|
+
/** The event started on a checkbox or a command (or the space around it) inside the row / card. */
|
|
1678
|
+
#fromControl(event) {
|
|
1679
|
+
const target = event.target instanceof Element ? event.target : null;
|
|
1680
|
+
const area = target?.closest(CONTROL_AREAS);
|
|
1681
|
+
return !!area && event.currentTarget instanceof Element && event.currentTarget.contains(area);
|
|
1682
|
+
}
|
|
692
1683
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdFileExplorerItemList, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
693
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", 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: `
|
|
694
|
-
@let
|
|
1684
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", 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: `
|
|
1685
|
+
@let _rows = rows();
|
|
695
1686
|
@let _canDownload = canDownload();
|
|
696
1687
|
@let _canShare = canShare();
|
|
697
|
-
@let _hasActions = _canDownload || _canShare;
|
|
698
1688
|
@let _compact = compact();
|
|
1689
|
+
@let _touch = touch();
|
|
1690
|
+
@let _actionColumn = _compact ? menuColumn() : _canDownload || _canShare;
|
|
699
1691
|
@let _activeId = activeId();
|
|
1692
|
+
@let _menuOpenId = menuOpenId();
|
|
1693
|
+
@let _selection = selection();
|
|
1694
|
+
@let _commandSize = _touch && !_compact ? 'lg' : 'sm';
|
|
700
1695
|
@if (view() === 'list') {
|
|
701
|
-
<div
|
|
1696
|
+
<div
|
|
1697
|
+
class="list"
|
|
1698
|
+
role="table"
|
|
1699
|
+
[class.list--selectable]="!!_selection"
|
|
1700
|
+
[class.list--custom]="columns().length > 0"
|
|
1701
|
+
[style.--sd-fe-custom-cols]="columnWidths()"
|
|
1702
|
+
[attr.aria-label]="label()"
|
|
1703
|
+
[attr.aria-colcount]="(_selection ? 1 : 0) + (_compact ? 2 : 3) + columns().length + (_actionColumn ? 1 : 0)">
|
|
702
1704
|
<div class="list-head" role="rowgroup">
|
|
703
1705
|
<div class="row row--head" role="row">
|
|
1706
|
+
@if (_selection) {
|
|
1707
|
+
<span class="cell cell--select" role="columnheader">
|
|
1708
|
+
<mat-checkbox
|
|
1709
|
+
class="select-all"
|
|
1710
|
+
color="primary"
|
|
1711
|
+
[checked]="_selection.state === 'all'"
|
|
1712
|
+
[indeterminate]="_selection.state === 'some'"
|
|
1713
|
+
[disabled]="!_selection.eligibleCount"
|
|
1714
|
+
[aria-label]="_selection.allLabel"
|
|
1715
|
+
[matTooltip]="_selection.allLabel"
|
|
1716
|
+
[attr.data-autoid]="_selection.autoId ?? null"
|
|
1717
|
+
(change)="toggleSelectAll.emit()" />
|
|
1718
|
+
</span>
|
|
1719
|
+
}
|
|
704
1720
|
<span class="cell cell--name" role="columnheader">{{ 'core.component.file-explorer.column.name' | sdTranslate }}</span>
|
|
705
1721
|
@if (!_compact) {
|
|
706
1722
|
<span class="cell cell--modified" role="columnheader">{{
|
|
@@ -708,37 +1724,105 @@ class SdFileExplorerItemList {
|
|
|
708
1724
|
}}</span>
|
|
709
1725
|
}
|
|
710
1726
|
<span class="cell cell--size" role="columnheader">{{ 'core.component.file-explorer.column.size' | sdTranslate }}</span>
|
|
711
|
-
@
|
|
712
|
-
<span class="cell cell--
|
|
1727
|
+
@for (column of columns(); track column.id(); let index = $index) {
|
|
1728
|
+
<span class="cell cell--custom" role="columnheader" [style.grid-column]="5 + index">{{ column.title() }}</span>
|
|
1729
|
+
}
|
|
1730
|
+
@if (_actionColumn) {
|
|
1731
|
+
<span class="cell cell--action" role="columnheader" [style.grid-column]="5 + columns().length"></span>
|
|
713
1732
|
}
|
|
714
1733
|
</div>
|
|
715
1734
|
</div>
|
|
716
1735
|
<div role="rowgroup">
|
|
717
|
-
@for (
|
|
1736
|
+
@for (row of _rows; track row.view.item.id; let rowIndex = $index) {
|
|
1737
|
+
@let view = row.view;
|
|
718
1738
|
<div
|
|
719
1739
|
class="row"
|
|
720
1740
|
role="row"
|
|
721
1741
|
tabindex="0"
|
|
722
1742
|
[class.row--active]="view.item.id === _activeId"
|
|
1743
|
+
[class.row--selected]="row.selected"
|
|
1744
|
+
[class.row--commands]="!!row.commands"
|
|
1745
|
+
[class.row--movable]="canMove() && view.item.kind === 'file'"
|
|
723
1746
|
[attr.data-item-id]="view.item.id"
|
|
1747
|
+
[attr.data-move-target]="view.item.kind === 'folder' ? view.item.id : null"
|
|
1748
|
+
[class.move-drop-target]="view.item.kind === 'folder' && moveDropTarget() === view.item.id"
|
|
724
1749
|
[attr.data-autoid]="view.autoId"
|
|
725
|
-
(click)="
|
|
1750
|
+
(click)="onClick($event, view)"
|
|
726
1751
|
(keydown)="onKeydown($event, view)">
|
|
1752
|
+
@if (_selection) {
|
|
1753
|
+
<span class="cell cell--select" role="cell">
|
|
1754
|
+
@if (row.selectable) {
|
|
1755
|
+
<mat-checkbox
|
|
1756
|
+
class="select"
|
|
1757
|
+
color="primary"
|
|
1758
|
+
[checked]="row.selected"
|
|
1759
|
+
[disabled]="row.selectDisabled"
|
|
1760
|
+
[aria-label]="view.selectLabel"
|
|
1761
|
+
[attr.data-autoid]="view.autoId ? view.autoId + '-select' : null"
|
|
1762
|
+
(change)="toggleSelect.emit(view.item)" />
|
|
1763
|
+
}
|
|
1764
|
+
</span>
|
|
1765
|
+
}
|
|
727
1766
|
<span class="cell cell--name" role="cell">
|
|
728
1767
|
<sd-file-explorer-file-icon [icon]="view.icon" [size]="32" />
|
|
729
|
-
<span class="name" [title]="view.item.name">{{ view.item.name }}</span>
|
|
1768
|
+
<span class="name" [draggable]="canMove() && view.item.kind === 'file'" [title]="view.item.name">{{ view.item.name }}</span>
|
|
1769
|
+
@if (view.item.kind === 'folder' && moveDropTarget() === view.item.id) {
|
|
1770
|
+
<span class="move-drop-label">{{ 'core.component.file-explorer.move.confirm' | sdTranslate }}</span>
|
|
1771
|
+
}
|
|
1772
|
+
@if (canMove() && view.item.kind === 'file') {
|
|
1773
|
+
<sd-button
|
|
1774
|
+
htmlType="button"
|
|
1775
|
+
class="move-file-button commands"
|
|
1776
|
+
type="text"
|
|
1777
|
+
color="secondary"
|
|
1778
|
+
[size]="_compact ? 'sm' : 'md'"
|
|
1779
|
+
[disabled]="movePending()"
|
|
1780
|
+
[title]="'core.component.file-explorer.move.to' | sdTranslate"
|
|
1781
|
+
[tooltip]="('core.component.file-explorer.move.to' | sdTranslate) + ': ' + view.item.name"
|
|
1782
|
+
(click)="$event.stopPropagation(); move.emit(view.item)"
|
|
1783
|
+
(keydown)="$event.stopPropagation()" />
|
|
1784
|
+
}
|
|
1785
|
+
@if (row.commands) {
|
|
1786
|
+
<sd-file-explorer-actions
|
|
1787
|
+
class="commands"
|
|
1788
|
+
[actions]="row.commands"
|
|
1789
|
+
[context]="view.item"
|
|
1790
|
+
[size]="_commandSize"
|
|
1791
|
+
[source]="row.source"
|
|
1792
|
+
[autoId]="view.autoId ? view.autoId + '-command' : undefined" />
|
|
1793
|
+
}
|
|
730
1794
|
</span>
|
|
731
1795
|
@if (!_compact) {
|
|
732
1796
|
<span class="cell cell--modified" role="cell" [title]="view.modifiedTitle">{{ view.modifiedLabel || '—' }}</span>
|
|
733
1797
|
}
|
|
734
1798
|
<span class="cell cell--size" role="cell">{{ view.sizeLabel || '—' }}</span>
|
|
735
|
-
@
|
|
1799
|
+
@for (column of columns(); track column.id(); let index = $index) {
|
|
1800
|
+
<span class="cell cell--custom" role="cell" [style.grid-column]="5 + index">
|
|
1801
|
+
<ng-container
|
|
1802
|
+
[ngTemplateOutlet]="column.template"
|
|
1803
|
+
[ngTemplateOutletContext]="{ $implicit: view.item, item: view.item, data: view.item.data, index: rowIndex }" />
|
|
1804
|
+
</span>
|
|
1805
|
+
}
|
|
1806
|
+
@if (_actionColumn) {
|
|
736
1807
|
<!-- 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. -->
|
|
737
|
-
<span class="cell cell--action" role="cell">
|
|
738
|
-
@if (
|
|
1808
|
+
<span class="cell cell--action" role="cell" [style.grid-column]="5 + columns().length">
|
|
1809
|
+
@if (_compact) {
|
|
1810
|
+
@if (row.menu; as menu) {
|
|
1811
|
+
<sd-file-explorer-menu-trigger
|
|
1812
|
+
class="row-menu"
|
|
1813
|
+
[label]="view.actionsLabel"
|
|
1814
|
+
[busy]="menu.busy"
|
|
1815
|
+
[expanded]="view.item.id === _menuOpenId"
|
|
1816
|
+
[touch]="_touch"
|
|
1817
|
+
[autoId]="view.autoId ? view.autoId + '-commands' : undefined"
|
|
1818
|
+
(activate)="openCommands.emit({ item: view.item, trigger: $event })" />
|
|
1819
|
+
}
|
|
1820
|
+
} @else if (view.item.kind === 'file') {
|
|
739
1821
|
@if (_canShare) {
|
|
740
1822
|
<sd-button
|
|
741
1823
|
class="row-action row-share"
|
|
1824
|
+
[disabled]="view.shareDisabled ?? false"
|
|
1825
|
+
[attr.aria-description]="view.shareDisabled ? view.unavailableReason : null"
|
|
742
1826
|
type="text"
|
|
743
1827
|
color="secondary"
|
|
744
1828
|
size="sm"
|
|
@@ -752,6 +1836,8 @@ class SdFileExplorerItemList {
|
|
|
752
1836
|
@if (_canDownload) {
|
|
753
1837
|
<sd-button
|
|
754
1838
|
class="row-action row-download"
|
|
1839
|
+
[disabled]="view.downloadDisabled ?? false"
|
|
1840
|
+
[attr.aria-description]="view.downloadDisabled ? view.unavailableReason : null"
|
|
755
1841
|
type="text"
|
|
756
1842
|
color="secondary"
|
|
757
1843
|
size="sm"
|
|
@@ -770,17 +1856,69 @@ class SdFileExplorerItemList {
|
|
|
770
1856
|
</div>
|
|
771
1857
|
</div>
|
|
772
1858
|
} @else {
|
|
1859
|
+
@let _cardTop = !!_selection || hasCommands();
|
|
1860
|
+
@if (_selection) {
|
|
1861
|
+
<div class="grid-head">
|
|
1862
|
+
<mat-checkbox
|
|
1863
|
+
class="select-all"
|
|
1864
|
+
color="primary"
|
|
1865
|
+
[checked]="_selection.state === 'all'"
|
|
1866
|
+
[indeterminate]="_selection.state === 'some'"
|
|
1867
|
+
[disabled]="!_selection.eligibleCount"
|
|
1868
|
+
[aria-label]="_selection.allLabel"
|
|
1869
|
+
[matTooltip]="_selection.allLabel"
|
|
1870
|
+
[attr.data-autoid]="_selection.autoId ?? null"
|
|
1871
|
+
(change)="toggleSelectAll.emit()" />
|
|
1872
|
+
</div>
|
|
1873
|
+
}
|
|
773
1874
|
<ul class="grid" [attr.aria-label]="label()">
|
|
774
|
-
@for (
|
|
1875
|
+
@for (row of _rows; track row.view.item.id) {
|
|
1876
|
+
@let view = row.view;
|
|
775
1877
|
<li
|
|
776
1878
|
class="card"
|
|
777
1879
|
tabindex="0"
|
|
778
1880
|
[class.card--active]="view.item.id === _activeId"
|
|
1881
|
+
[class.card--selected]="row.selected"
|
|
779
1882
|
[attr.data-item-id]="view.item.id"
|
|
1883
|
+
[attr.data-move-target]="view.item.kind === 'folder' ? view.item.id : null"
|
|
1884
|
+
[class.move-drop-target]="view.item.kind === 'folder' && moveDropTarget() === view.item.id"
|
|
780
1885
|
[attr.data-autoid]="view.autoId"
|
|
781
1886
|
[attr.aria-label]="view.item.name + ', ' + view.typeLabel"
|
|
782
|
-
(click)="
|
|
1887
|
+
(click)="onClick($event, view)"
|
|
783
1888
|
(keydown)="onKeydown($event, view)">
|
|
1889
|
+
@if (_cardTop) {
|
|
1890
|
+
<span class="card-top">
|
|
1891
|
+
@if (row.selectable) {
|
|
1892
|
+
<mat-checkbox
|
|
1893
|
+
class="select"
|
|
1894
|
+
color="primary"
|
|
1895
|
+
[checked]="row.selected"
|
|
1896
|
+
[disabled]="row.selectDisabled"
|
|
1897
|
+
[aria-label]="view.selectLabel"
|
|
1898
|
+
[attr.data-autoid]="view.autoId ? view.autoId + '-select' : null"
|
|
1899
|
+
(change)="toggleSelect.emit(view.item)" />
|
|
1900
|
+
}
|
|
1901
|
+
@if (row.commands) {
|
|
1902
|
+
<sd-file-explorer-actions
|
|
1903
|
+
class="commands"
|
|
1904
|
+
[actions]="row.commands"
|
|
1905
|
+
[context]="view.item"
|
|
1906
|
+
[size]="_commandSize"
|
|
1907
|
+
[source]="row.source"
|
|
1908
|
+
[autoId]="view.autoId ? view.autoId + '-command' : undefined" />
|
|
1909
|
+
}
|
|
1910
|
+
@if (row.menu; as menu) {
|
|
1911
|
+
<sd-file-explorer-menu-trigger
|
|
1912
|
+
class="card-menu"
|
|
1913
|
+
[label]="view.actionsLabel"
|
|
1914
|
+
[busy]="menu.busy"
|
|
1915
|
+
[expanded]="view.item.id === _menuOpenId"
|
|
1916
|
+
[touch]="_touch"
|
|
1917
|
+
[autoId]="view.autoId ? view.autoId + '-commands' : undefined"
|
|
1918
|
+
(activate)="openCommands.emit({ item: view.item, trigger: $event })" />
|
|
1919
|
+
}
|
|
1920
|
+
</span>
|
|
1921
|
+
}
|
|
784
1922
|
<span class="thumb">
|
|
785
1923
|
@if (view.item.thumbnailUrl) {
|
|
786
1924
|
<img [src]="view.item.thumbnailUrl" alt="" loading="lazy" />
|
|
@@ -788,30 +1926,79 @@ class SdFileExplorerItemList {
|
|
|
788
1926
|
<sd-file-explorer-file-icon [icon]="view.icon" [size]="48" />
|
|
789
1927
|
}
|
|
790
1928
|
</span>
|
|
791
|
-
<span class="card-name" [
|
|
1929
|
+
<span class="card-name" [draggable]="canMove() && view.item.kind === 'file'" [title]="view.item.name">{{
|
|
1930
|
+
view.item.name
|
|
1931
|
+
}}</span>
|
|
1932
|
+
@if (canMove() && view.item.kind === 'file') {
|
|
1933
|
+
<sd-button
|
|
1934
|
+
htmlType="button"
|
|
1935
|
+
class="move-file-button commands"
|
|
1936
|
+
type="text"
|
|
1937
|
+
color="secondary"
|
|
1938
|
+
[size]="_compact ? 'sm' : 'md'"
|
|
1939
|
+
[disabled]="movePending()"
|
|
1940
|
+
[title]="'core.component.file-explorer.move.to' | sdTranslate"
|
|
1941
|
+
(click)="$event.stopPropagation(); move.emit(view.item)"
|
|
1942
|
+
(keydown)="$event.stopPropagation()" />
|
|
1943
|
+
}
|
|
792
1944
|
</li>
|
|
793
1945
|
}
|
|
794
1946
|
</ul>
|
|
795
1947
|
}
|
|
796
|
-
`, 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,
|
|
1948
|
+
`, 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"], 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 });
|
|
797
1949
|
}
|
|
798
1950
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdFileExplorerItemList, decorators: [{
|
|
799
1951
|
type: Component,
|
|
800
|
-
args: [{ selector: 'sd-file-explorer-item-list', standalone: true, imports: [
|
|
1952
|
+
args: [{ selector: 'sd-file-explorer-item-list', standalone: true, imports: [
|
|
1953
|
+
NgTemplateOutlet,
|
|
1954
|
+
MatCheckbox,
|
|
1955
|
+
MatTooltip,
|
|
1956
|
+
SdButton,
|
|
1957
|
+
SdTranslatePipe,
|
|
1958
|
+
SdFileExplorerActions,
|
|
1959
|
+
SdFileExplorerFileIcon,
|
|
1960
|
+
SdFileExplorerMenuTrigger,
|
|
1961
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
801
1962
|
class: 'sd-file-explorer-item-list',
|
|
802
1963
|
'[class.sd-file-explorer-item-list--compact]': 'compact()',
|
|
1964
|
+
'[class.sd-file-explorer-item-list--touch]': 'touch()',
|
|
803
1965
|
'[style.--sd-fe-actions-width]': 'actionsWidth()',
|
|
804
1966
|
}, template: `
|
|
805
|
-
@let
|
|
1967
|
+
@let _rows = rows();
|
|
806
1968
|
@let _canDownload = canDownload();
|
|
807
1969
|
@let _canShare = canShare();
|
|
808
|
-
@let _hasActions = _canDownload || _canShare;
|
|
809
1970
|
@let _compact = compact();
|
|
1971
|
+
@let _touch = touch();
|
|
1972
|
+
@let _actionColumn = _compact ? menuColumn() : _canDownload || _canShare;
|
|
810
1973
|
@let _activeId = activeId();
|
|
1974
|
+
@let _menuOpenId = menuOpenId();
|
|
1975
|
+
@let _selection = selection();
|
|
1976
|
+
@let _commandSize = _touch && !_compact ? 'lg' : 'sm';
|
|
811
1977
|
@if (view() === 'list') {
|
|
812
|
-
<div
|
|
1978
|
+
<div
|
|
1979
|
+
class="list"
|
|
1980
|
+
role="table"
|
|
1981
|
+
[class.list--selectable]="!!_selection"
|
|
1982
|
+
[class.list--custom]="columns().length > 0"
|
|
1983
|
+
[style.--sd-fe-custom-cols]="columnWidths()"
|
|
1984
|
+
[attr.aria-label]="label()"
|
|
1985
|
+
[attr.aria-colcount]="(_selection ? 1 : 0) + (_compact ? 2 : 3) + columns().length + (_actionColumn ? 1 : 0)">
|
|
813
1986
|
<div class="list-head" role="rowgroup">
|
|
814
1987
|
<div class="row row--head" role="row">
|
|
1988
|
+
@if (_selection) {
|
|
1989
|
+
<span class="cell cell--select" role="columnheader">
|
|
1990
|
+
<mat-checkbox
|
|
1991
|
+
class="select-all"
|
|
1992
|
+
color="primary"
|
|
1993
|
+
[checked]="_selection.state === 'all'"
|
|
1994
|
+
[indeterminate]="_selection.state === 'some'"
|
|
1995
|
+
[disabled]="!_selection.eligibleCount"
|
|
1996
|
+
[aria-label]="_selection.allLabel"
|
|
1997
|
+
[matTooltip]="_selection.allLabel"
|
|
1998
|
+
[attr.data-autoid]="_selection.autoId ?? null"
|
|
1999
|
+
(change)="toggleSelectAll.emit()" />
|
|
2000
|
+
</span>
|
|
2001
|
+
}
|
|
815
2002
|
<span class="cell cell--name" role="columnheader">{{ 'core.component.file-explorer.column.name' | sdTranslate }}</span>
|
|
816
2003
|
@if (!_compact) {
|
|
817
2004
|
<span class="cell cell--modified" role="columnheader">{{
|
|
@@ -819,37 +2006,105 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
|
|
|
819
2006
|
}}</span>
|
|
820
2007
|
}
|
|
821
2008
|
<span class="cell cell--size" role="columnheader">{{ 'core.component.file-explorer.column.size' | sdTranslate }}</span>
|
|
822
|
-
@
|
|
823
|
-
<span class="cell cell--
|
|
2009
|
+
@for (column of columns(); track column.id(); let index = $index) {
|
|
2010
|
+
<span class="cell cell--custom" role="columnheader" [style.grid-column]="5 + index">{{ column.title() }}</span>
|
|
2011
|
+
}
|
|
2012
|
+
@if (_actionColumn) {
|
|
2013
|
+
<span class="cell cell--action" role="columnheader" [style.grid-column]="5 + columns().length"></span>
|
|
824
2014
|
}
|
|
825
2015
|
</div>
|
|
826
2016
|
</div>
|
|
827
2017
|
<div role="rowgroup">
|
|
828
|
-
@for (
|
|
2018
|
+
@for (row of _rows; track row.view.item.id; let rowIndex = $index) {
|
|
2019
|
+
@let view = row.view;
|
|
829
2020
|
<div
|
|
830
2021
|
class="row"
|
|
831
2022
|
role="row"
|
|
832
2023
|
tabindex="0"
|
|
833
2024
|
[class.row--active]="view.item.id === _activeId"
|
|
2025
|
+
[class.row--selected]="row.selected"
|
|
2026
|
+
[class.row--commands]="!!row.commands"
|
|
2027
|
+
[class.row--movable]="canMove() && view.item.kind === 'file'"
|
|
834
2028
|
[attr.data-item-id]="view.item.id"
|
|
2029
|
+
[attr.data-move-target]="view.item.kind === 'folder' ? view.item.id : null"
|
|
2030
|
+
[class.move-drop-target]="view.item.kind === 'folder' && moveDropTarget() === view.item.id"
|
|
835
2031
|
[attr.data-autoid]="view.autoId"
|
|
836
|
-
(click)="
|
|
2032
|
+
(click)="onClick($event, view)"
|
|
837
2033
|
(keydown)="onKeydown($event, view)">
|
|
2034
|
+
@if (_selection) {
|
|
2035
|
+
<span class="cell cell--select" role="cell">
|
|
2036
|
+
@if (row.selectable) {
|
|
2037
|
+
<mat-checkbox
|
|
2038
|
+
class="select"
|
|
2039
|
+
color="primary"
|
|
2040
|
+
[checked]="row.selected"
|
|
2041
|
+
[disabled]="row.selectDisabled"
|
|
2042
|
+
[aria-label]="view.selectLabel"
|
|
2043
|
+
[attr.data-autoid]="view.autoId ? view.autoId + '-select' : null"
|
|
2044
|
+
(change)="toggleSelect.emit(view.item)" />
|
|
2045
|
+
}
|
|
2046
|
+
</span>
|
|
2047
|
+
}
|
|
838
2048
|
<span class="cell cell--name" role="cell">
|
|
839
2049
|
<sd-file-explorer-file-icon [icon]="view.icon" [size]="32" />
|
|
840
|
-
<span class="name" [title]="view.item.name">{{ view.item.name }}</span>
|
|
2050
|
+
<span class="name" [draggable]="canMove() && view.item.kind === 'file'" [title]="view.item.name">{{ view.item.name }}</span>
|
|
2051
|
+
@if (view.item.kind === 'folder' && moveDropTarget() === view.item.id) {
|
|
2052
|
+
<span class="move-drop-label">{{ 'core.component.file-explorer.move.confirm' | sdTranslate }}</span>
|
|
2053
|
+
}
|
|
2054
|
+
@if (canMove() && view.item.kind === 'file') {
|
|
2055
|
+
<sd-button
|
|
2056
|
+
htmlType="button"
|
|
2057
|
+
class="move-file-button commands"
|
|
2058
|
+
type="text"
|
|
2059
|
+
color="secondary"
|
|
2060
|
+
[size]="_compact ? 'sm' : 'md'"
|
|
2061
|
+
[disabled]="movePending()"
|
|
2062
|
+
[title]="'core.component.file-explorer.move.to' | sdTranslate"
|
|
2063
|
+
[tooltip]="('core.component.file-explorer.move.to' | sdTranslate) + ': ' + view.item.name"
|
|
2064
|
+
(click)="$event.stopPropagation(); move.emit(view.item)"
|
|
2065
|
+
(keydown)="$event.stopPropagation()" />
|
|
2066
|
+
}
|
|
2067
|
+
@if (row.commands) {
|
|
2068
|
+
<sd-file-explorer-actions
|
|
2069
|
+
class="commands"
|
|
2070
|
+
[actions]="row.commands"
|
|
2071
|
+
[context]="view.item"
|
|
2072
|
+
[size]="_commandSize"
|
|
2073
|
+
[source]="row.source"
|
|
2074
|
+
[autoId]="view.autoId ? view.autoId + '-command' : undefined" />
|
|
2075
|
+
}
|
|
841
2076
|
</span>
|
|
842
2077
|
@if (!_compact) {
|
|
843
2078
|
<span class="cell cell--modified" role="cell" [title]="view.modifiedTitle">{{ view.modifiedLabel || '—' }}</span>
|
|
844
2079
|
}
|
|
845
2080
|
<span class="cell cell--size" role="cell">{{ view.sizeLabel || '—' }}</span>
|
|
846
|
-
@
|
|
2081
|
+
@for (column of columns(); track column.id(); let index = $index) {
|
|
2082
|
+
<span class="cell cell--custom" role="cell" [style.grid-column]="5 + index">
|
|
2083
|
+
<ng-container
|
|
2084
|
+
[ngTemplateOutlet]="column.template"
|
|
2085
|
+
[ngTemplateOutletContext]="{ $implicit: view.item, item: view.item, data: view.item.data, index: rowIndex }" />
|
|
2086
|
+
</span>
|
|
2087
|
+
}
|
|
2088
|
+
@if (_actionColumn) {
|
|
847
2089
|
<!-- 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. -->
|
|
848
|
-
<span class="cell cell--action" role="cell">
|
|
849
|
-
@if (
|
|
2090
|
+
<span class="cell cell--action" role="cell" [style.grid-column]="5 + columns().length">
|
|
2091
|
+
@if (_compact) {
|
|
2092
|
+
@if (row.menu; as menu) {
|
|
2093
|
+
<sd-file-explorer-menu-trigger
|
|
2094
|
+
class="row-menu"
|
|
2095
|
+
[label]="view.actionsLabel"
|
|
2096
|
+
[busy]="menu.busy"
|
|
2097
|
+
[expanded]="view.item.id === _menuOpenId"
|
|
2098
|
+
[touch]="_touch"
|
|
2099
|
+
[autoId]="view.autoId ? view.autoId + '-commands' : undefined"
|
|
2100
|
+
(activate)="openCommands.emit({ item: view.item, trigger: $event })" />
|
|
2101
|
+
}
|
|
2102
|
+
} @else if (view.item.kind === 'file') {
|
|
850
2103
|
@if (_canShare) {
|
|
851
2104
|
<sd-button
|
|
852
2105
|
class="row-action row-share"
|
|
2106
|
+
[disabled]="view.shareDisabled ?? false"
|
|
2107
|
+
[attr.aria-description]="view.shareDisabled ? view.unavailableReason : null"
|
|
853
2108
|
type="text"
|
|
854
2109
|
color="secondary"
|
|
855
2110
|
size="sm"
|
|
@@ -863,6 +2118,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
|
|
|
863
2118
|
@if (_canDownload) {
|
|
864
2119
|
<sd-button
|
|
865
2120
|
class="row-action row-download"
|
|
2121
|
+
[disabled]="view.downloadDisabled ?? false"
|
|
2122
|
+
[attr.aria-description]="view.downloadDisabled ? view.unavailableReason : null"
|
|
866
2123
|
type="text"
|
|
867
2124
|
color="secondary"
|
|
868
2125
|
size="sm"
|
|
@@ -881,17 +2138,69 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
|
|
|
881
2138
|
</div>
|
|
882
2139
|
</div>
|
|
883
2140
|
} @else {
|
|
2141
|
+
@let _cardTop = !!_selection || hasCommands();
|
|
2142
|
+
@if (_selection) {
|
|
2143
|
+
<div class="grid-head">
|
|
2144
|
+
<mat-checkbox
|
|
2145
|
+
class="select-all"
|
|
2146
|
+
color="primary"
|
|
2147
|
+
[checked]="_selection.state === 'all'"
|
|
2148
|
+
[indeterminate]="_selection.state === 'some'"
|
|
2149
|
+
[disabled]="!_selection.eligibleCount"
|
|
2150
|
+
[aria-label]="_selection.allLabel"
|
|
2151
|
+
[matTooltip]="_selection.allLabel"
|
|
2152
|
+
[attr.data-autoid]="_selection.autoId ?? null"
|
|
2153
|
+
(change)="toggleSelectAll.emit()" />
|
|
2154
|
+
</div>
|
|
2155
|
+
}
|
|
884
2156
|
<ul class="grid" [attr.aria-label]="label()">
|
|
885
|
-
@for (
|
|
2157
|
+
@for (row of _rows; track row.view.item.id) {
|
|
2158
|
+
@let view = row.view;
|
|
886
2159
|
<li
|
|
887
2160
|
class="card"
|
|
888
2161
|
tabindex="0"
|
|
889
2162
|
[class.card--active]="view.item.id === _activeId"
|
|
2163
|
+
[class.card--selected]="row.selected"
|
|
890
2164
|
[attr.data-item-id]="view.item.id"
|
|
2165
|
+
[attr.data-move-target]="view.item.kind === 'folder' ? view.item.id : null"
|
|
2166
|
+
[class.move-drop-target]="view.item.kind === 'folder' && moveDropTarget() === view.item.id"
|
|
891
2167
|
[attr.data-autoid]="view.autoId"
|
|
892
2168
|
[attr.aria-label]="view.item.name + ', ' + view.typeLabel"
|
|
893
|
-
(click)="
|
|
2169
|
+
(click)="onClick($event, view)"
|
|
894
2170
|
(keydown)="onKeydown($event, view)">
|
|
2171
|
+
@if (_cardTop) {
|
|
2172
|
+
<span class="card-top">
|
|
2173
|
+
@if (row.selectable) {
|
|
2174
|
+
<mat-checkbox
|
|
2175
|
+
class="select"
|
|
2176
|
+
color="primary"
|
|
2177
|
+
[checked]="row.selected"
|
|
2178
|
+
[disabled]="row.selectDisabled"
|
|
2179
|
+
[aria-label]="view.selectLabel"
|
|
2180
|
+
[attr.data-autoid]="view.autoId ? view.autoId + '-select' : null"
|
|
2181
|
+
(change)="toggleSelect.emit(view.item)" />
|
|
2182
|
+
}
|
|
2183
|
+
@if (row.commands) {
|
|
2184
|
+
<sd-file-explorer-actions
|
|
2185
|
+
class="commands"
|
|
2186
|
+
[actions]="row.commands"
|
|
2187
|
+
[context]="view.item"
|
|
2188
|
+
[size]="_commandSize"
|
|
2189
|
+
[source]="row.source"
|
|
2190
|
+
[autoId]="view.autoId ? view.autoId + '-command' : undefined" />
|
|
2191
|
+
}
|
|
2192
|
+
@if (row.menu; as menu) {
|
|
2193
|
+
<sd-file-explorer-menu-trigger
|
|
2194
|
+
class="card-menu"
|
|
2195
|
+
[label]="view.actionsLabel"
|
|
2196
|
+
[busy]="menu.busy"
|
|
2197
|
+
[expanded]="view.item.id === _menuOpenId"
|
|
2198
|
+
[touch]="_touch"
|
|
2199
|
+
[autoId]="view.autoId ? view.autoId + '-commands' : undefined"
|
|
2200
|
+
(activate)="openCommands.emit({ item: view.item, trigger: $event })" />
|
|
2201
|
+
}
|
|
2202
|
+
</span>
|
|
2203
|
+
}
|
|
895
2204
|
<span class="thumb">
|
|
896
2205
|
@if (view.item.thumbnailUrl) {
|
|
897
2206
|
<img [src]="view.item.thumbnailUrl" alt="" loading="lazy" />
|
|
@@ -899,13 +2208,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
|
|
|
899
2208
|
<sd-file-explorer-file-icon [icon]="view.icon" [size]="48" />
|
|
900
2209
|
}
|
|
901
2210
|
</span>
|
|
902
|
-
<span class="card-name" [
|
|
2211
|
+
<span class="card-name" [draggable]="canMove() && view.item.kind === 'file'" [title]="view.item.name">{{
|
|
2212
|
+
view.item.name
|
|
2213
|
+
}}</span>
|
|
2214
|
+
@if (canMove() && view.item.kind === 'file') {
|
|
2215
|
+
<sd-button
|
|
2216
|
+
htmlType="button"
|
|
2217
|
+
class="move-file-button commands"
|
|
2218
|
+
type="text"
|
|
2219
|
+
color="secondary"
|
|
2220
|
+
[size]="_compact ? 'sm' : 'md'"
|
|
2221
|
+
[disabled]="movePending()"
|
|
2222
|
+
[title]="'core.component.file-explorer.move.to' | sdTranslate"
|
|
2223
|
+
(click)="$event.stopPropagation(); move.emit(view.item)"
|
|
2224
|
+
(keydown)="$event.stopPropagation()" />
|
|
2225
|
+
}
|
|
903
2226
|
</li>
|
|
904
2227
|
}
|
|
905
2228
|
</ul>
|
|
906
2229
|
}
|
|
907
|
-
`, styles: [":host{display:block}.list{width:100%}.row{display:grid;grid-template-columns:minmax(0,1fr) 128px 88px var(--sd-fe-actions-width,
|
|
908
|
-
}], 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"] }] } });
|
|
2230
|
+
`, 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"] }]
|
|
2231
|
+
}], 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"] }] } });
|
|
909
2232
|
|
|
910
2233
|
/**
|
|
911
2234
|
* File detail of the explorer (internal): an `<sd-side-drawer>` opened in the explorer's item area (right of the
|
|
@@ -930,6 +2253,8 @@ class SdFileExplorerPreviewPanel {
|
|
|
930
2253
|
canDownload = input(false, ...(ngDevMode ? [{ debugName: "canDownload" }] : []));
|
|
931
2254
|
/** Show the share button. */
|
|
932
2255
|
canShare = input(false, ...(ngDevMode ? [{ debugName: "canShare" }] : []));
|
|
2256
|
+
/** Matches the explorer's narrow layout; footer buttons retain Core's 48 px touch span. */
|
|
2257
|
+
compact = input(false, ...(ngDevMode ? [{ debugName: "compact" }] : []));
|
|
933
2258
|
/** Element the drawer opens inside: the explorer's item area, right of the folder tree. */
|
|
934
2259
|
container = input(null, ...(ngDevMode ? [{ debugName: "container" }] : []));
|
|
935
2260
|
/** E2E scope of the detail content and its buttons. */
|
|
@@ -1021,7 +2346,7 @@ class SdFileExplorerPreviewPanel {
|
|
|
1021
2346
|
}
|
|
1022
2347
|
}
|
|
1023
2348
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdFileExplorerPreviewPanel, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1024
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", 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: `
|
|
2349
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", 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: `
|
|
1025
2350
|
@let _view = view();
|
|
1026
2351
|
@let _state = state();
|
|
1027
2352
|
@let _autoId = autoId();
|
|
@@ -1106,6 +2431,9 @@ class SdFileExplorerPreviewPanel {
|
|
|
1106
2431
|
<sd-button
|
|
1107
2432
|
sdFooterRight
|
|
1108
2433
|
class="share-button"
|
|
2434
|
+
[size]="compact() ? 'sm' : 'md'"
|
|
2435
|
+
[disabled]="_view?.shareDisabled ?? false"
|
|
2436
|
+
[attr.aria-description]="_view?.shareDisabled ? _view?.unavailableReason : null"
|
|
1109
2437
|
[type]="_canDownload ? 'outline' : 'fill'"
|
|
1110
2438
|
[color]="_canDownload ? 'secondary' : 'primary'"
|
|
1111
2439
|
prefixIcon="share"
|
|
@@ -1117,6 +2445,9 @@ class SdFileExplorerPreviewPanel {
|
|
|
1117
2445
|
<sd-button
|
|
1118
2446
|
sdFooterRight
|
|
1119
2447
|
class="download-button"
|
|
2448
|
+
[size]="compact() ? 'sm' : 'md'"
|
|
2449
|
+
[disabled]="_view?.downloadDisabled ?? false"
|
|
2450
|
+
[attr.aria-description]="_view?.downloadDisabled ? _view?.unavailableReason : null"
|
|
1120
2451
|
type="fill"
|
|
1121
2452
|
color="primary"
|
|
1122
2453
|
prefixIcon="file_download"
|
|
@@ -1231,6 +2562,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
|
|
|
1231
2562
|
<sd-button
|
|
1232
2563
|
sdFooterRight
|
|
1233
2564
|
class="share-button"
|
|
2565
|
+
[size]="compact() ? 'sm' : 'md'"
|
|
2566
|
+
[disabled]="_view?.shareDisabled ?? false"
|
|
2567
|
+
[attr.aria-description]="_view?.shareDisabled ? _view?.unavailableReason : null"
|
|
1234
2568
|
[type]="_canDownload ? 'outline' : 'fill'"
|
|
1235
2569
|
[color]="_canDownload ? 'secondary' : 'primary'"
|
|
1236
2570
|
prefixIcon="share"
|
|
@@ -1242,6 +2576,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
|
|
|
1242
2576
|
<sd-button
|
|
1243
2577
|
sdFooterRight
|
|
1244
2578
|
class="download-button"
|
|
2579
|
+
[size]="compact() ? 'sm' : 'md'"
|
|
2580
|
+
[disabled]="_view?.downloadDisabled ?? false"
|
|
2581
|
+
[attr.aria-description]="_view?.downloadDisabled ? _view?.unavailableReason : null"
|
|
1245
2582
|
type="fill"
|
|
1246
2583
|
color="primary"
|
|
1247
2584
|
prefixIcon="file_download"
|
|
@@ -1266,7 +2603,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
|
|
|
1266
2603
|
}
|
|
1267
2604
|
</ng-template>
|
|
1268
2605
|
`, 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"] }]
|
|
1269
|
-
}], 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 }] }] } });
|
|
2606
|
+
}], 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 }] }] } });
|
|
1270
2607
|
|
|
1271
2608
|
let nextTransferPanelId = 0;
|
|
1272
2609
|
/**
|
|
@@ -1519,6 +2856,8 @@ const SEARCH_DEBOUNCE_MS = 300;
|
|
|
1519
2856
|
const MAX_PARALLEL_UPLOADS = 3;
|
|
1520
2857
|
/** Below this host width the explorer switches to the compact (mobile) layout. */
|
|
1521
2858
|
const COMPACT_MAX_WIDTH = 720;
|
|
2859
|
+
/** Primary pointer is a finger: commands stay visible and use 48 px targets. */
|
|
2860
|
+
const TOUCH_QUERY = '(pointer: coarse)';
|
|
1522
2861
|
/** How long a saved download's object URL stays alive before it is revoked. */
|
|
1523
2862
|
const DOWNLOAD_URL_TTL_MS = 40_000;
|
|
1524
2863
|
const ACTIVE_STATUSES = new Set(['queued', 'preparing', 'transferring']);
|
|
@@ -1528,7 +2867,7 @@ let nextExplorerId = 0;
|
|
|
1528
2867
|
* Google-Drive-like file browser: folder tree, breadcrumb, list / grid, search, file detail drawer, uploads with
|
|
1529
2868
|
* drag-and-drop, downloads and a transfer queue — all inside one element.
|
|
1530
2869
|
*
|
|
1531
|
-
* Storage-agnostic: every read and write goes through the callbacks of `SdFileExplorerOption
|
|
2870
|
+
* Storage-agnostic: every read and write goes through the callbacks of `SdFileExplorerOption<T>`.
|
|
1532
2871
|
*
|
|
1533
2872
|
* @example
|
|
1534
2873
|
* ```html
|
|
@@ -1536,13 +2875,51 @@ let nextExplorerId = 0;
|
|
|
1536
2875
|
* ```
|
|
1537
2876
|
*/
|
|
1538
2877
|
class SdFileExplorer {
|
|
2878
|
+
#moveDrag = new SdFileExplorerDragSession();
|
|
2879
|
+
#moveController = null;
|
|
2880
|
+
#moveRefreshFolders = [];
|
|
2881
|
+
#moveReturnFocus = null;
|
|
2882
|
+
#moveDragSelectionRequired = false;
|
|
2883
|
+
#movePickerSelectionRequired = false;
|
|
2884
|
+
movePending = signal(false, ...(ngDevMode ? [{ debugName: "movePending" }] : []));
|
|
2885
|
+
moveStatus = signal('', ...(ngDevMode ? [{ debugName: "moveStatus" }] : []));
|
|
2886
|
+
moveRefreshError = signal(false, ...(ngDevMode ? [{ debugName: "moveRefreshError" }] : []));
|
|
2887
|
+
movePickerItems = signal(null, ...(ngDevMode ? [{ debugName: "movePickerItems" }] : []));
|
|
2888
|
+
moveTarget = signal(null, ...(ngDevMode ? [{ debugName: "moveTarget" }] : []));
|
|
2889
|
+
moveDropTarget = signal(undefined, ...(ngDevMode ? [{ debugName: "moveDropTarget" }] : []));
|
|
2890
|
+
canMove = computed(() => typeof this.#config().move?.onMove === 'function', ...(ngDevMode ? [{ debugName: "canMove" }] : []));
|
|
2891
|
+
movePickerNodes = computed(() => this.treeNodes().map(node => ({ ...node, selected: node.id === (this.moveTarget()?.id ?? null) })), ...(ngDevMode ? [{ debugName: "movePickerNodes" }] : []));
|
|
2892
|
+
canSubmitMove = computed(() => {
|
|
2893
|
+
const items = this.movePickerItems();
|
|
2894
|
+
if (!items || this.movePending())
|
|
2895
|
+
return false;
|
|
2896
|
+
return this.#moveAllowed(items, this.moveTarget(), 'menu', new AbortController().signal, this.#movePickerSelectionRequired);
|
|
2897
|
+
}, ...(ngDevMode ? [{ debugName: "canSubmitMove" }] : []));
|
|
2898
|
+
columnDefs = contentChildren(SdFileExplorerColumnDef, ...(ngDevMode ? [{ debugName: "columnDefs" }] : []));
|
|
2899
|
+
#warnedColumns = new WeakSet();
|
|
2900
|
+
columns = computed(() => {
|
|
2901
|
+
const seen = new Set();
|
|
2902
|
+
return this.columnDefs().filter(column => {
|
|
2903
|
+
const id = column.id().trim();
|
|
2904
|
+
if (!id || seen.has(id)) {
|
|
2905
|
+
if (isDevMode() && !this.#warnedColumns.has(column)) {
|
|
2906
|
+
this.#warnedColumns.add(column);
|
|
2907
|
+
console.warn(`[sd-file-explorer] ignored empty or duplicate column id: ${id}`);
|
|
2908
|
+
}
|
|
2909
|
+
return false;
|
|
2910
|
+
}
|
|
2911
|
+
seen.add(id);
|
|
2912
|
+
return true;
|
|
2913
|
+
});
|
|
2914
|
+
}, ...(ngDevMode ? [{ debugName: "columns" }] : []));
|
|
1539
2915
|
#i18n = inject(I18nService);
|
|
1540
2916
|
#host = inject(ElementRef);
|
|
1541
2917
|
#document = inject(DOCUMENT);
|
|
1542
2918
|
#injector = inject(Injector);
|
|
1543
2919
|
#zone = inject(NgZone);
|
|
1544
|
-
/** Data callbacks and display settings. See `SdFileExplorerOption
|
|
2920
|
+
/** Data callbacks and display settings. See `SdFileExplorerOption<T>`. */
|
|
1545
2921
|
option = input.required(...(ngDevMode ? [{ debugName: "option" }] : []));
|
|
2922
|
+
#config = computed(() => sdFileExplorerNormalizeConfig(this.option()), ...(ngDevMode ? [{ debugName: "#config" }] : []));
|
|
1546
2923
|
/**
|
|
1547
2924
|
* Emitted exactly once each time the user opens a file (click, `Enter` or `Space` on a file in the list,
|
|
1548
2925
|
* grid or search results), right before the detail drawer starts loading. Never emitted for folders.
|
|
@@ -1557,6 +2934,14 @@ class SdFileExplorer {
|
|
|
1557
2934
|
#previewItem = signal(null, ...(ngDevMode ? [{ debugName: "#previewItem" }] : []));
|
|
1558
2935
|
#transfers = signal([], ...(ngDevMode ? [{ debugName: "#transfers" }] : []));
|
|
1559
2936
|
#width = signal(0, ...(ngDevMode ? [{ debugName: "#width" }] : []));
|
|
2937
|
+
#touch = signal(false, ...(ngDevMode ? [{ debugName: "#touch" }] : []));
|
|
2938
|
+
/**
|
|
2939
|
+
* Ids the user selected. Only those still visible and eligible count — see `selectedItems` — and the others are
|
|
2940
|
+
* forgotten once the view settles, so a file that leaves the view or gets disabled is never selected again by itself.
|
|
2941
|
+
*/
|
|
2942
|
+
#selectedIds = signal(new Set(), ...(ngDevMode ? [{ debugName: "#selectedIds" }] : []));
|
|
2943
|
+
/** Item whose commands the compact drawer shows; `null` while it is closed. */
|
|
2944
|
+
#commandTarget = signal(null, ...(ngDevMode ? [{ debugName: "#commandTarget" }] : []));
|
|
1560
2945
|
view = signal('list', ...(ngDevMode ? [{ debugName: "view" }] : []));
|
|
1561
2946
|
keyword = signal('', ...(ngDevMode ? [{ debugName: "keyword" }] : []));
|
|
1562
2947
|
previewState = signal({ status: 'idle' }, ...(ngDevMode ? [{ debugName: "previewState" }] : []));
|
|
@@ -1587,6 +2972,7 @@ class SdFileExplorer {
|
|
|
1587
2972
|
shareInput = viewChild('shareInput', ...(ngDevMode ? [{ debugName: "shareInput" }] : []));
|
|
1588
2973
|
shareDialog = viewChild('shareDialog', ...(ngDevMode ? [{ debugName: "shareDialog" }] : []));
|
|
1589
2974
|
sidebar = viewChild('sidebar', ...(ngDevMode ? [{ debugName: "sidebar" }] : []));
|
|
2975
|
+
commandDrawer = viewChild(SdFileExplorerCommandSheet, ...(ngDevMode ? [{ debugName: "commandDrawer" }] : []));
|
|
1590
2976
|
// ---- Non-reactive bookkeeping ----
|
|
1591
2977
|
#listControllers = new Map();
|
|
1592
2978
|
#jobs = new Map();
|
|
@@ -1600,6 +2986,8 @@ class SdFileExplorer {
|
|
|
1600
2986
|
#previewObjectUrl = null;
|
|
1601
2987
|
#shareController = null;
|
|
1602
2988
|
#shareReturnFocus = null;
|
|
2989
|
+
/** Command pressed in the compact drawer, waiting for the drawer to finish closing; any context change drops it. */
|
|
2990
|
+
#pendingCommand = null;
|
|
1603
2991
|
#dragDepth = 0;
|
|
1604
2992
|
#listFn = null;
|
|
1605
2993
|
#resizeObserver = null;
|
|
@@ -1610,17 +2998,20 @@ class SdFileExplorer {
|
|
|
1610
2998
|
const width = this.#width();
|
|
1611
2999
|
return width > 0 && width < COMPACT_MAX_WIDTH;
|
|
1612
3000
|
}, ...(ngDevMode ? [{ debugName: "compact" }] : []));
|
|
3001
|
+
touch = this.#touch.asReadonly();
|
|
1613
3002
|
autoId = computed(() => {
|
|
1614
|
-
const scope = this
|
|
3003
|
+
const scope = this.#config().autoId;
|
|
1615
3004
|
return scope ? `components-file-explorer-${scope}` : undefined;
|
|
1616
3005
|
}, ...(ngDevMode ? [{ debugName: "autoId" }] : []));
|
|
1617
3006
|
locale = this.#i18n.locale;
|
|
1618
|
-
rootLabel = computed(() => this
|
|
1619
|
-
canUpload = computed(() => typeof this
|
|
1620
|
-
canDownload = computed(() => typeof this
|
|
1621
|
-
canCreateFolder = computed(() => typeof this
|
|
1622
|
-
canShare = computed(() => typeof this
|
|
1623
|
-
|
|
3007
|
+
rootLabel = computed(() => this.#config().rootLabel || this.#i18n.t('core.component.file-explorer.root'), ...(ngDevMode ? [{ debugName: "rootLabel" }] : []));
|
|
3008
|
+
canUpload = computed(() => typeof this.#config().upload === 'function', ...(ngDevMode ? [{ debugName: "canUpload" }] : []));
|
|
3009
|
+
canDownload = computed(() => typeof this.#config().download === 'function', ...(ngDevMode ? [{ debugName: "canDownload" }] : []));
|
|
3010
|
+
canCreateFolder = computed(() => typeof this.#config().createFolder === 'function', ...(ngDevMode ? [{ debugName: "canCreateFolder" }] : []));
|
|
3011
|
+
canShare = computed(() => typeof this.#config().share === 'function', ...(ngDevMode ? [{ debugName: "canShare" }] : []));
|
|
3012
|
+
uploadDisabled = computed(() => this.movePending() || !sdFileExplorerEligible(this.#config().uploadable, { parentId: this.#currentId() }), ...(ngDevMode ? [{ debugName: "uploadDisabled" }] : []));
|
|
3013
|
+
createDisabled = computed(() => this.movePending() || !sdFileExplorerEligible(this.#config().creatable, { parentId: this.#currentId() }), ...(ngDevMode ? [{ debugName: "createDisabled" }] : []));
|
|
3014
|
+
#serverSearch = computed(() => typeof this.#config().search === 'function', ...(ngDevMode ? [{ debugName: "#serverSearch" }] : []));
|
|
1624
3015
|
currentName = computed(() => {
|
|
1625
3016
|
const path = this.#path();
|
|
1626
3017
|
return path.length ? path[path.length - 1].name : this.rootLabel();
|
|
@@ -1655,6 +3046,188 @@ class SdFileExplorer {
|
|
|
1655
3046
|
const format = this.#itemFormatter();
|
|
1656
3047
|
return sdFileExplorerFoldersFirst(this.#visibleItems()).map(format);
|
|
1657
3048
|
}, ...(ngDevMode ? [{ debugName: "itemViews" }] : []));
|
|
3049
|
+
// ---- Selection ----
|
|
3050
|
+
/** The row download / share shortcuts stay until the consumer declares `fileCommands` (even `[]`). */
|
|
3051
|
+
rowShortcuts = computed(() => this.#config().fileCommands == null, ...(ngDevMode ? [{ debugName: "rowShortcuts" }] : []));
|
|
3052
|
+
#configuredSelector = computed(() => {
|
|
3053
|
+
const selector = this.#config().selector;
|
|
3054
|
+
return selector && selector.visible !== false ? selector : null;
|
|
3055
|
+
}, ...(ngDevMode ? [{ debugName: "#configuredSelector" }] : []));
|
|
3056
|
+
#pickerSelection = computed(() => {
|
|
3057
|
+
const selector = this.#configuredSelector();
|
|
3058
|
+
return (!!selector &&
|
|
3059
|
+
(selector.mode === 'picker' ||
|
|
3060
|
+
(selector.mode === undefined && (typeof selector.onSelect === 'function' || typeof selector.onSelectAll === 'function'))));
|
|
3061
|
+
}, ...(ngDevMode ? [{ debugName: "#pickerSelection" }] : []));
|
|
3062
|
+
/** Selection actions remain caller-owned when declared, including an intentional empty array. */
|
|
3063
|
+
selectionActions = computed(() => {
|
|
3064
|
+
const selector = this.#configuredSelector();
|
|
3065
|
+
if (!selector)
|
|
3066
|
+
return [];
|
|
3067
|
+
if (selector.actions !== undefined)
|
|
3068
|
+
return selector.actions ?? [];
|
|
3069
|
+
if (this.#pickerSelection())
|
|
3070
|
+
return [];
|
|
3071
|
+
const config = this.#config();
|
|
3072
|
+
const actions = [];
|
|
3073
|
+
if (typeof config.move?.onMove === 'function')
|
|
3074
|
+
actions.push({
|
|
3075
|
+
title: this.#i18n.t('core.component.file-explorer.move.to'),
|
|
3076
|
+
prefixIcon: 'drive_file_move',
|
|
3077
|
+
type: 'outline',
|
|
3078
|
+
disabled: () => this.movePending() || this.moveRefreshError(),
|
|
3079
|
+
onClick: items => this.openMovePicker(items),
|
|
3080
|
+
});
|
|
3081
|
+
if (typeof config.share === 'function')
|
|
3082
|
+
actions.push({
|
|
3083
|
+
title: this.#i18n.t('core.component.file-explorer.share'),
|
|
3084
|
+
prefixIcon: 'share',
|
|
3085
|
+
disabled: items => items.length !== 1 || !sdFileExplorerEligible(config.shareable, items[0]),
|
|
3086
|
+
onClick: items => {
|
|
3087
|
+
if (items.length === 1)
|
|
3088
|
+
this.openShare(items[0]);
|
|
3089
|
+
},
|
|
3090
|
+
});
|
|
3091
|
+
if (typeof config.download === 'function')
|
|
3092
|
+
actions.push({
|
|
3093
|
+
title: this.#i18n.t('core.component.file-explorer.download'),
|
|
3094
|
+
prefixIcon: 'file_download',
|
|
3095
|
+
disabled: items => !items.length || items.some(item => !sdFileExplorerEligible(config.downloadable, item)),
|
|
3096
|
+
onClick: items => {
|
|
3097
|
+
for (const item of items)
|
|
3098
|
+
this.downloadItem(item);
|
|
3099
|
+
},
|
|
3100
|
+
});
|
|
3101
|
+
return actions;
|
|
3102
|
+
}, ...(ngDevMode ? [{ debugName: "selectionActions" }] : []));
|
|
3103
|
+
#selector = computed(() => {
|
|
3104
|
+
const selector = this.#configuredSelector();
|
|
3105
|
+
if (!selector || this.#pickerSelection())
|
|
3106
|
+
return selector;
|
|
3107
|
+
// Keep intermediate selections reachable even when actions are hidden until a particular combination is selected.
|
|
3108
|
+
return sdFileExplorerHasActionCapability(this.selectionActions()) ? selector : null;
|
|
3109
|
+
}, ...(ngDevMode ? [{ debugName: "#selector" }] : []));
|
|
3110
|
+
/** Files of the current folder or search results, in display order. Folders are never selectable. */
|
|
3111
|
+
#visibleFiles = computed(() => this.#visibleItems().filter(item => item.kind === 'file'), ...(ngDevMode ? [{ debugName: "#visibleFiles" }] : []));
|
|
3112
|
+
#selectionCandidates = computed(() => {
|
|
3113
|
+
const selector = this.#configuredSelector();
|
|
3114
|
+
if (!selector)
|
|
3115
|
+
return [];
|
|
3116
|
+
const disabled = selector.disabled;
|
|
3117
|
+
return disabled ? this.#visibleFiles().filter(item => !disabled(item)) : this.#visibleFiles();
|
|
3118
|
+
}, ...(ngDevMode ? [{ debugName: "#selectionCandidates" }] : []));
|
|
3119
|
+
#eligibleFiles = computed(() => (this.#selector() ? this.#selectionCandidates() : []), ...(ngDevMode ? [{ debugName: "#eligibleFiles" }] : []));
|
|
3120
|
+
/**
|
|
3121
|
+
* Frozen snapshot of the selection handed to callbacks and actions: selected files that are still visible and
|
|
3122
|
+
* eligible, in display order. A file that a refresh drops, or that becomes disabled, leaves it.
|
|
3123
|
+
*/
|
|
3124
|
+
selectedItems = computed(() => {
|
|
3125
|
+
const ids = this.#selectedIds();
|
|
3126
|
+
return Object.freeze(this.#eligibleFiles().filter(item => ids.has(item.id)));
|
|
3127
|
+
}, ...(ngDevMode ? [{ debugName: "selectedItems" }] : []));
|
|
3128
|
+
/** Selection state of the item list; `null` (no checkbox, no band) without selector or without files in view. */
|
|
3129
|
+
selectionView = computed(() => {
|
|
3130
|
+
const files = this.#visibleFiles();
|
|
3131
|
+
if (!this.#selector() || !files.length)
|
|
3132
|
+
return null;
|
|
3133
|
+
const eligible = this.#eligibleFiles();
|
|
3134
|
+
const selected = this.selectedItems();
|
|
3135
|
+
const eligibleIds = new Set(eligible.map(item => item.id));
|
|
3136
|
+
const autoId = this.autoId();
|
|
3137
|
+
return {
|
|
3138
|
+
selectedIds: new Set(selected.map(item => item.id)),
|
|
3139
|
+
disabledIds: new Set(files.filter(item => !eligibleIds.has(item.id)).map(item => item.id)),
|
|
3140
|
+
state: !selected.length ? 'none' : selected.length === eligible.length ? 'all' : 'some',
|
|
3141
|
+
eligibleCount: eligible.length,
|
|
3142
|
+
allLabel: this.#i18n.t('core.component.file-explorer.selection.select-all', { count: eligible.length }),
|
|
3143
|
+
autoId: autoId ? `${autoId}-select-all` : undefined,
|
|
3144
|
+
};
|
|
3145
|
+
}, ...(ngDevMode ? [{ debugName: "selectionView" }] : []));
|
|
3146
|
+
/**
|
|
3147
|
+
* Status sentence of the band, split around the number so the template can set it in semibold: "2 tệp đã chọn",
|
|
3148
|
+
* "已选择 2 个文件". Nothing selected: `count` is 0 and `before` holds the whole sentence.
|
|
3149
|
+
*/
|
|
3150
|
+
selectionSummary = computed(() => {
|
|
3151
|
+
const count = this.selectedItems().length;
|
|
3152
|
+
if (!count)
|
|
3153
|
+
return { count, before: this.#i18n.t('core.component.file-explorer.selection.none'), after: '' };
|
|
3154
|
+
// 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ữ.
|
|
3155
|
+
const message = this.#i18n.t(`core.component.file-explorer.selection.${count === 1 ? 'selected-one' : 'selected'}`);
|
|
3156
|
+
const placeholder = '{count}';
|
|
3157
|
+
const at = message.indexOf(placeholder);
|
|
3158
|
+
if (at < 0)
|
|
3159
|
+
return { count, before: '', after: ` ${message}` };
|
|
3160
|
+
return { count, before: message.slice(0, at), after: message.slice(at + placeholder.length) };
|
|
3161
|
+
}, ...(ngDevMode ? [{ debugName: "selectionSummary" }] : []));
|
|
3162
|
+
// ---- Compact command drawer ----
|
|
3163
|
+
// 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
|
|
3164
|
+
// 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.
|
|
3165
|
+
#shareShortcut = computed(() => this.canShare()
|
|
3166
|
+
? {
|
|
3167
|
+
title: this.#i18n.t('core.component.file-explorer.share'),
|
|
3168
|
+
prefixIcon: 'share',
|
|
3169
|
+
disabled: item => this.movePending() || !sdFileExplorerEligible(this.#config().shareable, item),
|
|
3170
|
+
click: item => this.openShare(item),
|
|
3171
|
+
}
|
|
3172
|
+
: null, ...(ngDevMode ? [{ debugName: "#shareShortcut" }] : []));
|
|
3173
|
+
#downloadShortcut = computed(() => this.canDownload()
|
|
3174
|
+
? {
|
|
3175
|
+
title: this.#i18n.t('core.component.file-explorer.download'),
|
|
3176
|
+
prefixIcon: 'file_download',
|
|
3177
|
+
disabled: item => this.movePending() || !sdFileExplorerEligible(this.#config().downloadable, item),
|
|
3178
|
+
click: item => this.downloadItem(item),
|
|
3179
|
+
}
|
|
3180
|
+
: null, ...(ngDevMode ? [{ debugName: "#downloadShortcut" }] : []));
|
|
3181
|
+
/** Row shortcuts as commands, for the drawer while `fileCommands` is undeclared: share, then download, as on the row. */
|
|
3182
|
+
#shortcuts = computed(() => {
|
|
3183
|
+
const commands = [];
|
|
3184
|
+
const keys = [];
|
|
3185
|
+
const share = this.#shareShortcut();
|
|
3186
|
+
const download = this.#downloadShortcut();
|
|
3187
|
+
if (share) {
|
|
3188
|
+
commands.push(share);
|
|
3189
|
+
keys.push('share');
|
|
3190
|
+
}
|
|
3191
|
+
if (download) {
|
|
3192
|
+
commands.push(download);
|
|
3193
|
+
keys.push('download');
|
|
3194
|
+
}
|
|
3195
|
+
return { commands, keys };
|
|
3196
|
+
}, ...(ngDevMode ? [{ debugName: "#shortcuts" }] : []));
|
|
3197
|
+
/** Current version of the drawer's item — looked up by id in the list it was opened from; `null` once it is gone. */
|
|
3198
|
+
#commandItem = computed(() => {
|
|
3199
|
+
const target = this.#commandTarget();
|
|
3200
|
+
return target ? this.#findCommandItem(target.id, target.origin) : null;
|
|
3201
|
+
}, ...(ngDevMode ? [{ debugName: "#commandItem" }] : []));
|
|
3202
|
+
/** Content of the drawer: the item's commands resolved for it now; `null` when nothing is left to show. */
|
|
3203
|
+
// why: kiểu tường minh như contentState — d.ts ổn định giữa các máy build.
|
|
3204
|
+
commandSheet = computed(() => {
|
|
3205
|
+
const target = this.#commandTarget();
|
|
3206
|
+
const item = this.#commandItem();
|
|
3207
|
+
if (!target || !item)
|
|
3208
|
+
return null;
|
|
3209
|
+
const definitions = this.#commandDefinitions(item, target.origin);
|
|
3210
|
+
const source = item.kind === 'folder' ? 'folderCommands' : 'fileCommands';
|
|
3211
|
+
const resolved = sdFileExplorerResolveActions(definitions, item, SD_FILE_EXPLORER_COMMAND_DEFAULTS, source);
|
|
3212
|
+
if (!resolved.length)
|
|
3213
|
+
return null;
|
|
3214
|
+
const shortcuts = this.#shortcuts();
|
|
3215
|
+
const view = this.#itemFormatter()(item);
|
|
3216
|
+
return {
|
|
3217
|
+
title: item.name,
|
|
3218
|
+
context: [view.typeLabel, view.sizeLabel].filter(Boolean).join(' · '),
|
|
3219
|
+
icon: view.icon,
|
|
3220
|
+
entries: sdFileExplorerSheetEntries(resolved, definitions === shortcuts.commands ? shortcuts.keys : undefined),
|
|
3221
|
+
};
|
|
3222
|
+
}, ...(ngDevMode ? [{ debugName: "commandSheet" }] : []));
|
|
3223
|
+
itemsMenuOpenId = computed(() => {
|
|
3224
|
+
const target = this.#commandTarget();
|
|
3225
|
+
return target && target.origin !== 'tree' ? target.id : null;
|
|
3226
|
+
}, ...(ngDevMode ? [{ debugName: "itemsMenuOpenId" }] : []));
|
|
3227
|
+
treeMenuOpenId = computed(() => {
|
|
3228
|
+
const target = this.#commandTarget();
|
|
3229
|
+
return target?.origin === 'tree' ? target.id : null;
|
|
3230
|
+
}, ...(ngDevMode ? [{ debugName: "treeMenuOpenId" }] : []));
|
|
1658
3231
|
// why: như shareFeedback — kiểu tường minh để d.ts ổn định giữa các máy build.
|
|
1659
3232
|
contentState = computed(() => {
|
|
1660
3233
|
const keyword = this.#trimmedKeyword();
|
|
@@ -1861,6 +3434,9 @@ class SdFileExplorer {
|
|
|
1861
3434
|
const type = sdFileExplorerFileType(item);
|
|
1862
3435
|
return {
|
|
1863
3436
|
item,
|
|
3437
|
+
downloadDisabled: this.movePending() || !sdFileExplorerEligible(this.#config().downloadable, item),
|
|
3438
|
+
shareDisabled: this.movePending() || !sdFileExplorerEligible(this.#config().shareable, item),
|
|
3439
|
+
unavailableReason: t('action-unavailable'),
|
|
1864
3440
|
type,
|
|
1865
3441
|
icon: sdFileExplorerIconName(item),
|
|
1866
3442
|
typeLabel: t(`type.${type}`),
|
|
@@ -1869,26 +3445,88 @@ class SdFileExplorer {
|
|
|
1869
3445
|
modifiedTitle: sdFileExplorerFormatDateTime(item.modifiedAt, locale),
|
|
1870
3446
|
downloadLabel: t('download-item', { name: item.name }),
|
|
1871
3447
|
shareLabel: t('share-item', { name: item.name }),
|
|
3448
|
+
selectLabel: t('selection.select-item', { name: item.name }),
|
|
3449
|
+
actionsLabel: t('item-actions', { name: item.name }),
|
|
1872
3450
|
autoId: autoId ? `${autoId}-item-${sdFileExplorerSafeId(item.id)}` : undefined,
|
|
1873
3451
|
};
|
|
1874
3452
|
};
|
|
1875
3453
|
}, ...(ngDevMode ? [{ debugName: "#itemFormatter" }] : []));
|
|
1876
3454
|
constructor() {
|
|
3455
|
+
const destroyRef = inject(DestroyRef);
|
|
3456
|
+
let previewProvider;
|
|
3457
|
+
let shareProvider;
|
|
3458
|
+
let moveProvider;
|
|
3459
|
+
let searchProvider;
|
|
3460
|
+
effect(() => {
|
|
3461
|
+
const config = this.#config();
|
|
3462
|
+
const previewChanged = previewProvider !== config.preview;
|
|
3463
|
+
const shareChanged = shareProvider !== config.share;
|
|
3464
|
+
const moveChanged = moveProvider?.onMove !== config.move?.onMove;
|
|
3465
|
+
const searchChanged = searchProvider !== config.search;
|
|
3466
|
+
previewProvider = config.preview;
|
|
3467
|
+
shareProvider = config.share;
|
|
3468
|
+
moveProvider = config.move;
|
|
3469
|
+
searchProvider = config.search;
|
|
3470
|
+
untracked(() => {
|
|
3471
|
+
const item = this.#previewItem();
|
|
3472
|
+
if (previewChanged && item)
|
|
3473
|
+
void this.#loadPreview(item);
|
|
3474
|
+
const shareItem = this.shareItem();
|
|
3475
|
+
if (shareChanged && shareItem) {
|
|
3476
|
+
this.#shareController?.abort();
|
|
3477
|
+
if (config.share && sdFileExplorerEligible(config.shareable, shareItem))
|
|
3478
|
+
void this.#loadShareLink(shareItem);
|
|
3479
|
+
else
|
|
3480
|
+
this.closeShare();
|
|
3481
|
+
}
|
|
3482
|
+
if (moveChanged && this.#moveController)
|
|
3483
|
+
this.cancelMove();
|
|
3484
|
+
if (searchChanged && this.#listFn === config.list)
|
|
3485
|
+
this.#scheduleSearch(true);
|
|
3486
|
+
});
|
|
3487
|
+
});
|
|
3488
|
+
// 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.
|
|
3489
|
+
// Đọ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ỏ.
|
|
3490
|
+
const touchQuery = this.#document.defaultView?.matchMedia?.(TOUCH_QUERY);
|
|
3491
|
+
if (touchQuery) {
|
|
3492
|
+
this.#touch.set(touchQuery.matches);
|
|
3493
|
+
const onTouchChange = (event) => this.#touch.set(event.matches);
|
|
3494
|
+
touchQuery.addEventListener?.('change', onTouchChange);
|
|
3495
|
+
destroyRef.onDestroy(() => touchQuery.removeEventListener?.('change', onTouchChange));
|
|
3496
|
+
}
|
|
1877
3497
|
// 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
|
|
1878
3498
|
// (ví dụ đổi title) không được xoá cache/điều hướng của người dùng.
|
|
1879
3499
|
effect(() => {
|
|
1880
|
-
const option = this
|
|
3500
|
+
const option = this.#config();
|
|
3501
|
+
const selecting = !!this.#selector();
|
|
1881
3502
|
untracked(() => {
|
|
3503
|
+
if (!selecting)
|
|
3504
|
+
this.#clearSelection();
|
|
1882
3505
|
if (this.#listFn === option.list)
|
|
1883
3506
|
return;
|
|
1884
3507
|
const firstRun = this.#listFn === null;
|
|
1885
3508
|
this.#listFn = option.list;
|
|
3509
|
+
if (this.#moveController)
|
|
3510
|
+
this.cancelMove();
|
|
3511
|
+
this.moveRefreshError.set(false);
|
|
3512
|
+
this.#moveRefreshFolders = [];
|
|
3513
|
+
this.#moveDrag.clear();
|
|
1886
3514
|
if (firstRun)
|
|
1887
3515
|
this.view.set(option.defaultView ?? 'list');
|
|
1888
3516
|
this.#resetNavigation();
|
|
1889
3517
|
this.#ensureLoaded(null);
|
|
1890
3518
|
});
|
|
1891
3519
|
});
|
|
3520
|
+
// 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
|
|
3521
|
+
// đượ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
|
|
3522
|
+
// 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
|
|
3523
|
+
// selector bị ẩn, #clearSelection (có onClear) chạy trước lần dọn im lặng này.
|
|
3524
|
+
effect(() => {
|
|
3525
|
+
const eligible = this.#eligibleFiles();
|
|
3526
|
+
if (this.contentState() === 'loading')
|
|
3527
|
+
return;
|
|
3528
|
+
untracked(() => this.#keepEligibleSelection(eligible));
|
|
3529
|
+
});
|
|
1892
3530
|
afterNextRender(() => {
|
|
1893
3531
|
const host = this.#host.nativeElement;
|
|
1894
3532
|
this.#width.set(host.getBoundingClientRect().width);
|
|
@@ -1901,19 +3539,213 @@ class SdFileExplorer {
|
|
|
1901
3539
|
});
|
|
1902
3540
|
this.#resizeObserver.observe(host);
|
|
1903
3541
|
});
|
|
1904
|
-
// 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.
|
|
3542
|
+
// 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
|
|
3543
|
+
// 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ổ).
|
|
3544
|
+
effect(() => {
|
|
3545
|
+
if (this.compact())
|
|
3546
|
+
return;
|
|
3547
|
+
untracked(() => {
|
|
3548
|
+
this.sidebarOpen.set(false);
|
|
3549
|
+
this.#closeCommands();
|
|
3550
|
+
});
|
|
3551
|
+
});
|
|
3552
|
+
// 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 —
|
|
3553
|
+
// đóng drawer thay vì giữ một ảnh chụp cũ có thể chạy lệnh trên mục đã mất.
|
|
1905
3554
|
effect(() => {
|
|
1906
|
-
if (!this.
|
|
1907
|
-
untracked(() => this
|
|
3555
|
+
if (this.#commandTarget() && !this.commandSheet())
|
|
3556
|
+
untracked(() => this.#closeCommands());
|
|
1908
3557
|
});
|
|
1909
|
-
|
|
3558
|
+
// 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
|
|
3559
|
+
// 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.
|
|
3560
|
+
const view = this.#document.defaultView;
|
|
3561
|
+
if (view) {
|
|
3562
|
+
const onPopState = () => this.#closeCommands();
|
|
3563
|
+
view.addEventListener('popstate', onPopState);
|
|
3564
|
+
destroyRef.onDestroy(() => view.removeEventListener('popstate', onPopState));
|
|
3565
|
+
}
|
|
3566
|
+
destroyRef.onDestroy(() => this.#teardown());
|
|
1910
3567
|
}
|
|
1911
3568
|
// ---- Public API ----
|
|
3569
|
+
/** Moves visible files through the caller's storage callback. False includes cancellation, rejection or refresh failure. */
|
|
3570
|
+
async moveFiles(items, targetFolder, source = 'api') {
|
|
3571
|
+
return this.#performMove(items, targetFolder, source, false);
|
|
3572
|
+
}
|
|
3573
|
+
async #performMove(items, targetFolder, source, selectionRequired) {
|
|
3574
|
+
const move = this.#config().move;
|
|
3575
|
+
if (!move ||
|
|
3576
|
+
this.movePending() ||
|
|
3577
|
+
this.moveRefreshError() ||
|
|
3578
|
+
this.folderSubmitting() ||
|
|
3579
|
+
this.#transfers().some(transfer => transfer.direction === 'upload' && ACTIVE_STATUSES.has(transfer.status)) ||
|
|
3580
|
+
this.#destroyed)
|
|
3581
|
+
return false;
|
|
3582
|
+
const controller = new AbortController();
|
|
3583
|
+
if (!this.#moveAllowed(items, targetFolder, source, controller.signal, selectionRequired))
|
|
3584
|
+
return false;
|
|
3585
|
+
const request = Object.freeze({
|
|
3586
|
+
items: Object.freeze([...items]),
|
|
3587
|
+
targetFolder,
|
|
3588
|
+
source,
|
|
3589
|
+
signal: controller.signal,
|
|
3590
|
+
});
|
|
3591
|
+
const sourceParents = items.map(item => item.parentId);
|
|
3592
|
+
const movedIds = new Set(items.map(item => item.id));
|
|
3593
|
+
const cachedSources = [...this.#folders()].filter(([, folder]) => folder.items.some(item => movedIds.has(item.id))).map(([id]) => id);
|
|
3594
|
+
this.#moveController = controller;
|
|
3595
|
+
this.movePending.set(true);
|
|
3596
|
+
this.moveStatus.set(this.#i18n.t('core.component.file-explorer.move.pending'));
|
|
3597
|
+
try {
|
|
3598
|
+
const accepted = await move.onMove(request);
|
|
3599
|
+
if (controller.signal.aborted || this.#destroyed || this.#config().move?.onMove !== move.onMove)
|
|
3600
|
+
return false;
|
|
3601
|
+
if (accepted === false) {
|
|
3602
|
+
this.moveStatus.set(this.#i18n.t('core.component.file-explorer.move.cancelled'));
|
|
3603
|
+
return false;
|
|
3604
|
+
}
|
|
3605
|
+
this.#moveRefreshFolders = [...new Set([...sourceParents, ...cachedSources, targetFolder?.id ?? null])].filter(id => this.#folders().has(id));
|
|
3606
|
+
this.#clearSelection();
|
|
3607
|
+
return await this.#refreshMove(controller);
|
|
3608
|
+
}
|
|
3609
|
+
catch (error) {
|
|
3610
|
+
if (!controller.signal.aborted && !this.#destroyed)
|
|
3611
|
+
this.moveStatus.set(sdFileExplorerErrorMessage(error) || this.#i18n.t('core.component.file-explorer.move.error'));
|
|
3612
|
+
return false;
|
|
3613
|
+
}
|
|
3614
|
+
finally {
|
|
3615
|
+
if (this.#moveController === controller) {
|
|
3616
|
+
this.#moveController = null;
|
|
3617
|
+
this.movePending.set(false);
|
|
3618
|
+
}
|
|
3619
|
+
}
|
|
3620
|
+
}
|
|
3621
|
+
/** Cooperatively aborts the current mutation. A consumer may already have committed its storage change. */
|
|
3622
|
+
cancelMove() {
|
|
3623
|
+
this.#moveController?.abort();
|
|
3624
|
+
this.#moveController = null;
|
|
3625
|
+
this.movePending.set(false);
|
|
3626
|
+
this.moveStatus.set(this.#i18n.t('core.component.file-explorer.move.cancelled'));
|
|
3627
|
+
this.#moveDrag.clear();
|
|
3628
|
+
}
|
|
3629
|
+
/** Repeats failed listing only; never calls onMove again. */
|
|
3630
|
+
async retryMoveRefresh() {
|
|
3631
|
+
if (!this.moveRefreshError() || this.movePending() || this.#destroyed)
|
|
3632
|
+
return false;
|
|
3633
|
+
const controller = new AbortController();
|
|
3634
|
+
this.#moveController = controller;
|
|
3635
|
+
this.movePending.set(true);
|
|
3636
|
+
try {
|
|
3637
|
+
return await this.#refreshMove(controller);
|
|
3638
|
+
}
|
|
3639
|
+
finally {
|
|
3640
|
+
if (this.#moveController === controller) {
|
|
3641
|
+
this.#moveController = null;
|
|
3642
|
+
this.movePending.set(false);
|
|
3643
|
+
}
|
|
3644
|
+
}
|
|
3645
|
+
}
|
|
3646
|
+
async #refreshMove(controller) {
|
|
3647
|
+
await Promise.all(this.#moveRefreshFolders.map(id => this.#load(id)));
|
|
3648
|
+
if (controller.signal.aborted || this.#destroyed)
|
|
3649
|
+
return false;
|
|
3650
|
+
const failed = this.#moveRefreshFolders.some(id => this.#folders().get(id)?.status !== 'loaded');
|
|
3651
|
+
this.moveRefreshError.set(failed);
|
|
3652
|
+
this.moveStatus.set(this.#i18n.t(failed ? 'core.component.file-explorer.move.refresh-error' : 'core.component.file-explorer.move.done'));
|
|
3653
|
+
if (!failed) {
|
|
3654
|
+
this.#moveRefreshFolders = [];
|
|
3655
|
+
if (this.searching())
|
|
3656
|
+
this.#scheduleSearch(true);
|
|
3657
|
+
}
|
|
3658
|
+
return !failed;
|
|
3659
|
+
}
|
|
3660
|
+
#moveAllowed(items, target, source, signal, selectionRequired = false) {
|
|
3661
|
+
const move = this.#config().move;
|
|
3662
|
+
const visible = this.#visibleItems();
|
|
3663
|
+
const known = [...this.#folders().values()].flatMap(folder => folder.items.filter(item => item.kind === 'folder'));
|
|
3664
|
+
if (!move || !sdFileExplorerValidateMove(items, target, known, visible))
|
|
3665
|
+
return false;
|
|
3666
|
+
if (selectionRequired && items.some(item => !this.#eligibleFiles().includes(item)))
|
|
3667
|
+
return false;
|
|
3668
|
+
return sdFileExplorerEligible(move.movable, { items: Object.freeze([...items]), targetFolder: target, source, signal });
|
|
3669
|
+
}
|
|
3670
|
+
openMovePicker(items, event) {
|
|
3671
|
+
if (!this.canMove() || this.movePending() || !items.length)
|
|
3672
|
+
return;
|
|
3673
|
+
const active = this.#document.activeElement;
|
|
3674
|
+
this.#moveReturnFocus = active instanceof HTMLElement ? active : null;
|
|
3675
|
+
const selected = this.selectedItems();
|
|
3676
|
+
this.#movePickerSelectionRequired = items.every(item => selected.includes(item));
|
|
3677
|
+
this.moveTarget.set(null);
|
|
3678
|
+
this.movePickerItems.set(Object.freeze([...items]));
|
|
3679
|
+
event?.stopPropagation();
|
|
3680
|
+
}
|
|
3681
|
+
closeMovePicker() {
|
|
3682
|
+
if (this.movePending())
|
|
3683
|
+
this.cancelMove();
|
|
3684
|
+
this.movePickerItems.set(null);
|
|
3685
|
+
this.#movePickerSelectionRequired = false;
|
|
3686
|
+
const focus = this.#moveReturnFocus;
|
|
3687
|
+
this.#moveReturnFocus = null;
|
|
3688
|
+
if (focus?.isConnected)
|
|
3689
|
+
afterNextRender(() => focus.focus({ preventScroll: true }), { injector: this.#injector });
|
|
3690
|
+
}
|
|
3691
|
+
submitMoveFromEvent(event) {
|
|
3692
|
+
void this.submitMove(event instanceof MouseEvent && event.detail === 0 ? 'keyboard' : 'menu');
|
|
3693
|
+
}
|
|
3694
|
+
async submitMove(source = 'menu') {
|
|
3695
|
+
const items = this.movePickerItems();
|
|
3696
|
+
if (!items)
|
|
3697
|
+
return;
|
|
3698
|
+
if (await this.#performMove(items, this.moveTarget(), source, this.#movePickerSelectionRequired))
|
|
3699
|
+
this.closeMovePicker();
|
|
3700
|
+
}
|
|
3701
|
+
onMoveDragStart(event) {
|
|
3702
|
+
const element = event.target instanceof Element ? event.target : null;
|
|
3703
|
+
if (!element?.closest('.name, .card-name') ||
|
|
3704
|
+
element.closest('button,input,a,.commands,.card-top,.cell--select') ||
|
|
3705
|
+
!event.dataTransfer ||
|
|
3706
|
+
!this.canMove() ||
|
|
3707
|
+
this.movePending()) {
|
|
3708
|
+
event.preventDefault();
|
|
3709
|
+
return;
|
|
3710
|
+
}
|
|
3711
|
+
const id = element.closest('[data-item-id]')?.dataset['itemId'];
|
|
3712
|
+
const file = this.#visibleItems().find(item => item.id === id && item.kind === 'file');
|
|
3713
|
+
if (!file) {
|
|
3714
|
+
event.preventDefault();
|
|
3715
|
+
return;
|
|
3716
|
+
}
|
|
3717
|
+
const selected = this.selectedItems();
|
|
3718
|
+
this.#moveDragSelectionRequired = selected.includes(file);
|
|
3719
|
+
const items = selected.includes(file) ? selected : [file];
|
|
3720
|
+
event.dataTransfer.setData(SD_FILE_EXPLORER_MOVE_MIME, this.#moveDrag.start(items));
|
|
3721
|
+
event.dataTransfer.effectAllowed = 'move';
|
|
3722
|
+
}
|
|
3723
|
+
onMoveDragEnd() {
|
|
3724
|
+
this.#moveDrag.clear();
|
|
3725
|
+
this.#moveDragSelectionRequired = false;
|
|
3726
|
+
this.moveDropTarget.set(undefined);
|
|
3727
|
+
}
|
|
3728
|
+
#internalDropTarget(event) {
|
|
3729
|
+
const element = event.target instanceof Element ? event.target : null;
|
|
3730
|
+
if (element?.closest('sd-file-explorer') !== this.#host.nativeElement)
|
|
3731
|
+
return null;
|
|
3732
|
+
const node = element.closest('[data-move-target]');
|
|
3733
|
+
if (!node)
|
|
3734
|
+
return null;
|
|
3735
|
+
const id = node.dataset['moveTarget'];
|
|
3736
|
+
if (id === '')
|
|
3737
|
+
return { folder: null };
|
|
3738
|
+
const folder = [...this.#itemById().values()].find(item => item.id === id && item.kind === 'folder');
|
|
3739
|
+
return folder ? { folder } : null;
|
|
3740
|
+
}
|
|
1912
3741
|
/**
|
|
1913
3742
|
* Lists the current folder again and drops the cached children of folders that are neither open in the
|
|
1914
|
-
* tree nor on the current path. Re-runs the active search, if any.
|
|
3743
|
+
* tree nor on the current path. Re-runs the active search, if any. Clears the file selection and closes the command
|
|
3744
|
+
* drawer of the compact layout.
|
|
1915
3745
|
*/
|
|
1916
3746
|
reload() {
|
|
3747
|
+
this.#clearSelection();
|
|
3748
|
+
this.#closeCommands();
|
|
1917
3749
|
const keep = new Set([null, this.#currentId(), ...this.#expanded(), ...this.#path().map(folder => folder.id)]);
|
|
1918
3750
|
const folders = new Map(this.#folders());
|
|
1919
3751
|
for (const key of [...folders.keys()]) {
|
|
@@ -1933,6 +3765,9 @@ class SdFileExplorer {
|
|
|
1933
3765
|
// ---- Navigation ----
|
|
1934
3766
|
navigate(folder) {
|
|
1935
3767
|
const id = folder?.id ?? null;
|
|
3768
|
+
if (id !== this.#currentId())
|
|
3769
|
+
this.#clearSelection();
|
|
3770
|
+
this.#closeCommands();
|
|
1936
3771
|
const path = folder ? this.#buildPath(folder) : [];
|
|
1937
3772
|
this.#currentId.set(id);
|
|
1938
3773
|
this.#path.set(path);
|
|
@@ -2028,10 +3863,14 @@ class SdFileExplorer {
|
|
|
2028
3863
|
this.previewState.set({ status: 'error', message: '' });
|
|
2029
3864
|
}
|
|
2030
3865
|
downloadItem(item) {
|
|
2031
|
-
const download = this
|
|
2032
|
-
if (!download)
|
|
3866
|
+
const download = this.#config().download;
|
|
3867
|
+
if (!download || !sdFileExplorerEligible(this.#config().downloadable, item))
|
|
2033
3868
|
return;
|
|
2034
|
-
this.#enqueue('download', item.name, item.parentId, args =>
|
|
3869
|
+
this.#enqueue('download', item.name, item.parentId, args => {
|
|
3870
|
+
if (!sdFileExplorerEligible(this.#config().downloadable, item))
|
|
3871
|
+
throw new Error(this.#i18n.t('core.component.file-explorer.action-unavailable'));
|
|
3872
|
+
return download({ item, ...args });
|
|
3873
|
+
});
|
|
2035
3874
|
this.transfersCollapsed.set(false);
|
|
2036
3875
|
}
|
|
2037
3876
|
downloadPreview() {
|
|
@@ -2044,9 +3883,176 @@ class SdFileExplorer {
|
|
|
2044
3883
|
if (item)
|
|
2045
3884
|
this.openShare(item);
|
|
2046
3885
|
}
|
|
3886
|
+
// ---- Selection ----
|
|
3887
|
+
toggleSelection(item) {
|
|
3888
|
+
const selector = this.#selector();
|
|
3889
|
+
if (!selector || !this.#eligibleFiles().some(file => file.id === item.id))
|
|
3890
|
+
return;
|
|
3891
|
+
// 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.
|
|
3892
|
+
const next = new Set(this.selectedItems().map(file => file.id));
|
|
3893
|
+
if (next.has(item.id))
|
|
3894
|
+
next.delete(item.id);
|
|
3895
|
+
else
|
|
3896
|
+
next.add(item.id);
|
|
3897
|
+
this.#selectedIds.set(next);
|
|
3898
|
+
selector.onSelect?.(item, this.selectedItems());
|
|
3899
|
+
}
|
|
3900
|
+
toggleSelectAll() {
|
|
3901
|
+
const selector = this.#selector();
|
|
3902
|
+
const eligible = this.#eligibleFiles();
|
|
3903
|
+
if (!selector || !eligible.length)
|
|
3904
|
+
return;
|
|
3905
|
+
const all = this.selectedItems().length === eligible.length;
|
|
3906
|
+
this.#selectedIds.set(new Set(all ? [] : eligible.map(item => item.id)));
|
|
3907
|
+
selector.onSelectAll?.(this.selectedItems());
|
|
3908
|
+
}
|
|
3909
|
+
clearSelection() {
|
|
3910
|
+
const active = this.#document.activeElement;
|
|
3911
|
+
if (active instanceof HTMLElement && active.classList.contains('selection-clear') && this.#host.nativeElement.contains(active)) {
|
|
3912
|
+
// Move owned focus before removing the toolbar. A consumer's onClear callback
|
|
3913
|
+
// remains free to move focus elsewhere after the selection is cleared.
|
|
3914
|
+
this.#host.nativeElement.querySelector('.select-all input')?.focus({ preventScroll: true });
|
|
3915
|
+
}
|
|
3916
|
+
this.#clearSelection();
|
|
3917
|
+
}
|
|
3918
|
+
/** Empties the selection, calling `onClear` once when something was selected. */
|
|
3919
|
+
#clearSelection() {
|
|
3920
|
+
if (!this.#selectedIds().size)
|
|
3921
|
+
return;
|
|
3922
|
+
this.#selectedIds.set(new Set());
|
|
3923
|
+
this.#config().selector?.onClear?.();
|
|
3924
|
+
}
|
|
3925
|
+
/** Forgets selected ids that are no longer visible and eligible. Silent: no callback. */
|
|
3926
|
+
#keepEligibleSelection(eligible) {
|
|
3927
|
+
const ids = this.#selectedIds();
|
|
3928
|
+
if (!ids.size)
|
|
3929
|
+
return;
|
|
3930
|
+
const kept = new Set(eligible.filter(item => ids.has(item.id)).map(item => item.id));
|
|
3931
|
+
if (kept.size !== ids.size)
|
|
3932
|
+
this.#selectedIds.set(kept);
|
|
3933
|
+
}
|
|
3934
|
+
// ---- Compact command drawer ----
|
|
3935
|
+
openCommands(item, origin, trigger) {
|
|
3936
|
+
this.#pendingCommand = null;
|
|
3937
|
+
// 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
|
|
3938
|
+
// 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.
|
|
3939
|
+
trigger.focus({ preventScroll: true });
|
|
3940
|
+
this.#commandTarget.set({ id: item.id, origin, trigger });
|
|
3941
|
+
this.commandDrawer()?.show();
|
|
3942
|
+
}
|
|
3943
|
+
/** The user closed the drawer (close button, `Escape`, backdrop). */
|
|
3944
|
+
onCommandsClosed() {
|
|
3945
|
+
const target = this.#commandTarget();
|
|
3946
|
+
if (!target)
|
|
3947
|
+
return;
|
|
3948
|
+
this.#commandTarget.set(null);
|
|
3949
|
+
afterNextRender(() => this.#restoreCommandFocus(target), { injector: this.#injector });
|
|
3950
|
+
}
|
|
3951
|
+
/**
|
|
3952
|
+
* Runs a command pressed in the drawer. The press is checked against the current item, definitions and states: a
|
|
3953
|
+
* stale entry, a state the consumer changed since the last render or a second press runs nothing.
|
|
3954
|
+
*
|
|
3955
|
+
* The drawer closes first, at once. The command runs after the next render: by then the drawer's focus trap is gone
|
|
3956
|
+
* and has handed focus back, so it cannot pull focus away from a dialog or a preview the command opens. Right before
|
|
3957
|
+
* it runs, the same check is made again, and `click` receives the item as listed at that moment.
|
|
3958
|
+
*/
|
|
3959
|
+
runCommand({ command, group }) {
|
|
3960
|
+
const target = this.#commandTarget();
|
|
3961
|
+
if (this.#pendingCommand || !target)
|
|
3962
|
+
return;
|
|
3963
|
+
const pending = { id: target.id, origin: target.origin, leaf: command.definition, group: group?.definition ?? null };
|
|
3964
|
+
if (!this.#runnableItem(pending)) {
|
|
3965
|
+
// 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.
|
|
3966
|
+
this.#commandTarget.set({ ...target });
|
|
3967
|
+
return;
|
|
3968
|
+
}
|
|
3969
|
+
this.#pendingCommand = pending;
|
|
3970
|
+
this.#commandTarget.set(null);
|
|
3971
|
+
this.commandDrawer()?.hide();
|
|
3972
|
+
afterNextRender(() => {
|
|
3973
|
+
if (this.#pendingCommand !== pending)
|
|
3974
|
+
return;
|
|
3975
|
+
this.#pendingCommand = null;
|
|
3976
|
+
this.#restoreCommandFocus(target);
|
|
3977
|
+
// 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
|
|
3978
|
+
// (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.
|
|
3979
|
+
const item = this.#runnableItem(pending);
|
|
3980
|
+
if (item)
|
|
3981
|
+
(pending.leaf.onClick ?? pending.leaf.click)?.(item);
|
|
3982
|
+
}, { injector: this.#injector });
|
|
3983
|
+
}
|
|
3984
|
+
/** Current version of an item, by id, in the list a drawer was opened from (list / grid items or tree folders). */
|
|
3985
|
+
#findCommandItem(id, origin) {
|
|
3986
|
+
if (origin === 'tree')
|
|
3987
|
+
return this.treeNodes().find(node => node.id === id)?.item ?? null;
|
|
3988
|
+
return this.#visibleItems().find(item => item.id === id) ?? null;
|
|
3989
|
+
}
|
|
3990
|
+
/**
|
|
3991
|
+
* The current item when `command` may run now — the item is still listed where the drawer was opened, the pressed
|
|
3992
|
+
* definition and its group are still declared for it, and neither is hidden, disabled or loading — else `null`.
|
|
3993
|
+
*/
|
|
3994
|
+
#runnableItem(command) {
|
|
3995
|
+
const item = this.#findCommandItem(command.id, command.origin);
|
|
3996
|
+
if (!item)
|
|
3997
|
+
return null;
|
|
3998
|
+
const { leaf, group } = command;
|
|
3999
|
+
const definitions = this.#commandDefinitions(item, command.origin);
|
|
4000
|
+
const declared = group ? definitions.includes(group) && group.children.includes(leaf) : definitions.includes(leaf);
|
|
4001
|
+
const blocked = (group !== null && sdFileExplorerActionBlocked(group, item)) || sdFileExplorerActionBlocked(leaf, item);
|
|
4002
|
+
return declared && !blocked ? item : null;
|
|
4003
|
+
}
|
|
4004
|
+
/** Commands of one item in the drawer: the declared ones, or the row shortcuts while `fileCommands` is undeclared. */
|
|
4005
|
+
#commandDefinitions(item, origin) {
|
|
4006
|
+
const option = this.#config();
|
|
4007
|
+
if (item.kind === 'folder')
|
|
4008
|
+
return option.folderCommands ?? [];
|
|
4009
|
+
if (option.fileCommands != null)
|
|
4010
|
+
return option.fileCommands;
|
|
4011
|
+
// 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.
|
|
4012
|
+
return origin === 'list' ? this.#shortcuts().commands : [];
|
|
4013
|
+
}
|
|
4014
|
+
/** Closes the drawer without running anything and drops a pressed command that has not run yet. */
|
|
4015
|
+
#closeCommands() {
|
|
4016
|
+
this.#pendingCommand = null;
|
|
4017
|
+
const target = this.#commandTarget();
|
|
4018
|
+
if (!target)
|
|
4019
|
+
return;
|
|
4020
|
+
this.#commandTarget.set(null);
|
|
4021
|
+
this.commandDrawer()?.hide();
|
|
4022
|
+
afterNextRender(() => this.#restoreCommandFocus(target), { injector: this.#injector });
|
|
4023
|
+
}
|
|
4024
|
+
/**
|
|
4025
|
+
* After the drawer closed: when its focus trap could not give focus back — the trigger left the page with its row,
|
|
4026
|
+
* or the layout changed — focus the item's row, card or tree tab stop, the first item, or the search box.
|
|
4027
|
+
*/
|
|
4028
|
+
#restoreCommandFocus(target) {
|
|
4029
|
+
const active = this.#document.activeElement;
|
|
4030
|
+
if (this.#destroyed || (active && active !== this.#document.body))
|
|
4031
|
+
return;
|
|
4032
|
+
const host = this.#host.nativeElement;
|
|
4033
|
+
const items = Array.from(host.querySelectorAll('[data-item-id]'));
|
|
4034
|
+
const candidates = [
|
|
4035
|
+
target.trigger.isConnected ? target.trigger : null,
|
|
4036
|
+
target.origin === 'tree'
|
|
4037
|
+
? host.querySelector('[role="treeitem"][tabindex="0"]')
|
|
4038
|
+
: (items.find(element => element.dataset['itemId'] === target.id) ?? null),
|
|
4039
|
+
items[0] ?? null,
|
|
4040
|
+
this.searchInput()?.nativeElement ?? null,
|
|
4041
|
+
];
|
|
4042
|
+
for (const candidate of candidates) {
|
|
4043
|
+
candidate?.focus({ preventScroll: true });
|
|
4044
|
+
if (candidate && this.#document.activeElement === candidate)
|
|
4045
|
+
return;
|
|
4046
|
+
}
|
|
4047
|
+
}
|
|
2047
4048
|
// ---- Search ----
|
|
2048
4049
|
onKeywordInput(value) {
|
|
4050
|
+
const before = this.#trimmedKeyword();
|
|
2049
4051
|
this.keyword.set(value);
|
|
4052
|
+
if (this.#trimmedKeyword() !== before) {
|
|
4053
|
+
this.#clearSelection();
|
|
4054
|
+
this.#closeCommands();
|
|
4055
|
+
}
|
|
2050
4056
|
this.#scheduleSearch(false);
|
|
2051
4057
|
}
|
|
2052
4058
|
clearSearch() {
|
|
@@ -2061,16 +4067,26 @@ class SdFileExplorer {
|
|
|
2061
4067
|
this.uploadFiles(files);
|
|
2062
4068
|
}
|
|
2063
4069
|
uploadFiles(files) {
|
|
2064
|
-
|
|
2065
|
-
|
|
4070
|
+
if (this.movePending())
|
|
4071
|
+
return;
|
|
4072
|
+
const upload = this.#config().upload;
|
|
4073
|
+
if (!upload || files.length === 0 || !sdFileExplorerEligible(this.#config().uploadable, { parentId: this.#currentId() }))
|
|
2066
4074
|
return;
|
|
2067
4075
|
const parentId = this.#currentId();
|
|
2068
4076
|
for (const file of files) {
|
|
2069
|
-
this.#enqueue('upload', file.name, parentId, args =>
|
|
4077
|
+
this.#enqueue('upload', file.name, parentId, args => {
|
|
4078
|
+
if (!sdFileExplorerEligible(this.#config().uploadable, { parentId }))
|
|
4079
|
+
throw new Error(this.#i18n.t('core.component.file-explorer.action-unavailable'));
|
|
4080
|
+
return upload({ file, parentId, ...args });
|
|
4081
|
+
});
|
|
2070
4082
|
}
|
|
2071
4083
|
this.transfersCollapsed.set(false);
|
|
2072
4084
|
}
|
|
2073
4085
|
onDragEnter(event) {
|
|
4086
|
+
if (event.dataTransfer?.types.includes(SD_FILE_EXPLORER_MOVE_MIME)) {
|
|
4087
|
+
this.onDragOver(event);
|
|
4088
|
+
return;
|
|
4089
|
+
}
|
|
2074
4090
|
if (!this.#acceptsDrag(event))
|
|
2075
4091
|
return;
|
|
2076
4092
|
event.preventDefault();
|
|
@@ -2078,6 +4094,20 @@ class SdFileExplorer {
|
|
|
2078
4094
|
this.dragActive.set(true);
|
|
2079
4095
|
}
|
|
2080
4096
|
onDragOver(event) {
|
|
4097
|
+
if (event.dataTransfer?.types.includes(SD_FILE_EXPLORER_MOVE_MIME)) {
|
|
4098
|
+
const target = this.#internalDropTarget(event);
|
|
4099
|
+
const items = this.#moveDrag.activeItems;
|
|
4100
|
+
const allowed = !event.dataTransfer.types.includes('Files') &&
|
|
4101
|
+
!!items &&
|
|
4102
|
+
!!target &&
|
|
4103
|
+
!this.movePending() &&
|
|
4104
|
+
this.#moveAllowed(items, target.folder, 'drag', new AbortController().signal, this.#moveDragSelectionRequired);
|
|
4105
|
+
if (target && items && allowed)
|
|
4106
|
+
event.preventDefault();
|
|
4107
|
+
event.dataTransfer.dropEffect = allowed ? 'move' : 'none';
|
|
4108
|
+
this.moveDropTarget.set(allowed ? (target.folder?.id ?? null) : undefined);
|
|
4109
|
+
return;
|
|
4110
|
+
}
|
|
2081
4111
|
if (!this.#acceptsDrag(event))
|
|
2082
4112
|
return;
|
|
2083
4113
|
event.preventDefault();
|
|
@@ -2093,6 +4123,17 @@ class SdFileExplorer {
|
|
|
2093
4123
|
this.dragActive.set(false);
|
|
2094
4124
|
}
|
|
2095
4125
|
onDrop(event) {
|
|
4126
|
+
if (event.dataTransfer?.types.includes(SD_FILE_EXPLORER_MOVE_MIME)) {
|
|
4127
|
+
event.preventDefault();
|
|
4128
|
+
const target = this.#internalDropTarget(event);
|
|
4129
|
+
const items = this.#moveDrag.resolve(event.dataTransfer.getData(SD_FILE_EXPLORER_MOVE_MIME));
|
|
4130
|
+
const mixed = event.dataTransfer.types.includes('Files') || event.dataTransfer.files.length > 0;
|
|
4131
|
+
const selectionRequired = this.#moveDragSelectionRequired;
|
|
4132
|
+
this.onMoveDragEnd();
|
|
4133
|
+
if (items && target && !mixed)
|
|
4134
|
+
void this.#performMove(items, target.folder, 'drag', selectionRequired);
|
|
4135
|
+
return;
|
|
4136
|
+
}
|
|
2096
4137
|
if (!this.#acceptsDrag(event))
|
|
2097
4138
|
return;
|
|
2098
4139
|
event.preventDefault();
|
|
@@ -2114,6 +4155,8 @@ class SdFileExplorer {
|
|
|
2114
4155
|
}
|
|
2115
4156
|
retryTransfer(id) {
|
|
2116
4157
|
const job = this.#jobs.get(id);
|
|
4158
|
+
if (job?.direction === 'upload' && this.movePending())
|
|
4159
|
+
return;
|
|
2117
4160
|
const status = this.#statusOf(id);
|
|
2118
4161
|
if (!job || (status !== 'error' && status !== 'cancelled'))
|
|
2119
4162
|
return;
|
|
@@ -2150,7 +4193,7 @@ class SdFileExplorer {
|
|
|
2150
4193
|
}
|
|
2151
4194
|
// ---- Share ----
|
|
2152
4195
|
openShare(item) {
|
|
2153
|
-
if (!this
|
|
4196
|
+
if (!this.#config().share || !sdFileExplorerEligible(this.#config().shareable, item))
|
|
2154
4197
|
return;
|
|
2155
4198
|
const active = this.#document.activeElement;
|
|
2156
4199
|
this.#shareReturnFocus = active instanceof HTMLElement && this.#host.nativeElement.contains(active) ? active : null;
|
|
@@ -2200,8 +4243,8 @@ class SdFileExplorer {
|
|
|
2200
4243
|
}
|
|
2201
4244
|
}
|
|
2202
4245
|
async #loadShareLink(item) {
|
|
2203
|
-
const share = this
|
|
2204
|
-
if (!share)
|
|
4246
|
+
const share = this.#config().share;
|
|
4247
|
+
if (!share || !sdFileExplorerEligible(this.#config().shareable, item))
|
|
2205
4248
|
return;
|
|
2206
4249
|
this.#shareController?.abort();
|
|
2207
4250
|
const controller = new AbortController();
|
|
@@ -2240,9 +4283,11 @@ class SdFileExplorer {
|
|
|
2240
4283
|
}
|
|
2241
4284
|
async submitFolder(event) {
|
|
2242
4285
|
event.preventDefault();
|
|
2243
|
-
|
|
4286
|
+
if (this.movePending())
|
|
4287
|
+
return;
|
|
4288
|
+
const create = this.#config().createFolder;
|
|
2244
4289
|
const name = this.folderName().trim();
|
|
2245
|
-
if (!create || !name || this.folderSubmitting())
|
|
4290
|
+
if (!create || !name || this.folderSubmitting() || !sdFileExplorerEligible(this.#config().creatable, { parentId: this.#currentId() }))
|
|
2246
4291
|
return;
|
|
2247
4292
|
const parentId = this.#currentId();
|
|
2248
4293
|
this.folderSubmitting.set(true);
|
|
@@ -2269,7 +4314,11 @@ class SdFileExplorer {
|
|
|
2269
4314
|
onEscape(event) {
|
|
2270
4315
|
if (event.defaultPrevented)
|
|
2271
4316
|
return;
|
|
2272
|
-
if (this.
|
|
4317
|
+
if (this.movePickerItems())
|
|
4318
|
+
this.closeMovePicker();
|
|
4319
|
+
else if (this.movePending())
|
|
4320
|
+
this.cancelMove();
|
|
4321
|
+
else if (this.folderDialogOpen())
|
|
2273
4322
|
this.closeFolderDialog();
|
|
2274
4323
|
else if (this.shareItem())
|
|
2275
4324
|
this.closeShare();
|
|
@@ -2288,6 +4337,8 @@ class SdFileExplorer {
|
|
|
2288
4337
|
}
|
|
2289
4338
|
// ---- Internals: folders ----
|
|
2290
4339
|
#resetNavigation() {
|
|
4340
|
+
this.#clearSelection();
|
|
4341
|
+
this.#closeCommands();
|
|
2291
4342
|
for (const controller of this.#listControllers.values())
|
|
2292
4343
|
controller.abort();
|
|
2293
4344
|
this.#listControllers.clear();
|
|
@@ -2316,7 +4367,7 @@ class SdFileExplorer {
|
|
|
2316
4367
|
const previous = this.#folders().get(parentId);
|
|
2317
4368
|
this.#setFolder(parentId, { status: 'loading', items: previous?.loaded ? previous.items : [], loaded: !!previous?.loaded });
|
|
2318
4369
|
try {
|
|
2319
|
-
const items = await this
|
|
4370
|
+
const items = await this.#config().list({ parentId, signal: controller.signal });
|
|
2320
4371
|
if (controller.signal.aborted || this.#destroyed)
|
|
2321
4372
|
return;
|
|
2322
4373
|
this.#setFolder(parentId, { status: 'loaded', items: Array.isArray(items) ? items : [], loaded: true });
|
|
@@ -2361,7 +4412,7 @@ class SdFileExplorer {
|
|
|
2361
4412
|
this.#searchController?.abort();
|
|
2362
4413
|
this.#searchController = null;
|
|
2363
4414
|
const keyword = this.#trimmedKeyword();
|
|
2364
|
-
const search = this
|
|
4415
|
+
const search = this.#config().search;
|
|
2365
4416
|
if (!keyword || !search) {
|
|
2366
4417
|
this.#search.set(null);
|
|
2367
4418
|
return;
|
|
@@ -2375,19 +4426,19 @@ class SdFileExplorer {
|
|
|
2375
4426
|
}
|
|
2376
4427
|
async #runSearch(keyword, parentId) {
|
|
2377
4428
|
this.#searchTimer = null;
|
|
2378
|
-
const search = this
|
|
4429
|
+
const search = this.#config().search;
|
|
2379
4430
|
if (!search)
|
|
2380
4431
|
return;
|
|
2381
4432
|
const controller = new AbortController();
|
|
2382
4433
|
this.#searchController = controller;
|
|
2383
4434
|
try {
|
|
2384
4435
|
const items = await search({ parentId, keyword, signal: controller.signal });
|
|
2385
|
-
if (controller.signal.aborted || this.#destroyed)
|
|
4436
|
+
if (controller.signal.aborted || this.#destroyed || this.#config().search !== search)
|
|
2386
4437
|
return;
|
|
2387
4438
|
this.#search.set({ keyword, parentId, status: 'loaded', items: Array.isArray(items) ? items : [] });
|
|
2388
4439
|
}
|
|
2389
4440
|
catch (error) {
|
|
2390
|
-
if (controller.signal.aborted || this.#destroyed)
|
|
4441
|
+
if (controller.signal.aborted || this.#destroyed || this.#config().search !== search)
|
|
2391
4442
|
return;
|
|
2392
4443
|
this.#search.set({ keyword, parentId, status: 'error', items: [], error });
|
|
2393
4444
|
}
|
|
@@ -2397,6 +4448,10 @@ class SdFileExplorer {
|
|
|
2397
4448
|
}
|
|
2398
4449
|
}
|
|
2399
4450
|
#clearSearch() {
|
|
4451
|
+
if (this.#trimmedKeyword()) {
|
|
4452
|
+
this.#clearSelection();
|
|
4453
|
+
this.#closeCommands();
|
|
4454
|
+
}
|
|
2400
4455
|
this.keyword.set('');
|
|
2401
4456
|
this.#scheduleSearch(false);
|
|
2402
4457
|
}
|
|
@@ -2405,9 +4460,9 @@ class SdFileExplorer {
|
|
|
2405
4460
|
this.#releasePreview();
|
|
2406
4461
|
const kind = sdFileExplorerPreviewKind(sdFileExplorerFileType(item));
|
|
2407
4462
|
const fallback = () => kind === 'image' && item.thumbnailUrl ? { status: 'image', url: item.thumbnailUrl } : { status: 'unavailable' };
|
|
2408
|
-
const preview = this
|
|
4463
|
+
const preview = this.#config().preview;
|
|
2409
4464
|
// why: định dạng không có renderer thì KHÔNG gọi callback — tránh tải cả file chỉ để hiện fallback.
|
|
2410
|
-
if (kind === 'none' || !preview) {
|
|
4465
|
+
if (kind === 'none' || !preview || !sdFileExplorerEligible(this.#config().previewable, item)) {
|
|
2411
4466
|
this.previewState.set(kind === 'none' ? { status: 'unavailable' } : fallback());
|
|
2412
4467
|
return;
|
|
2413
4468
|
}
|
|
@@ -2557,7 +4612,11 @@ class SdFileExplorer {
|
|
|
2557
4612
|
// ---- Internals: DOM helpers ----
|
|
2558
4613
|
#acceptsDrag(event) {
|
|
2559
4614
|
const types = event.dataTransfer?.types;
|
|
2560
|
-
return this.canUpload() &&
|
|
4615
|
+
return (this.canUpload() &&
|
|
4616
|
+
!this.uploadDisabled() &&
|
|
4617
|
+
!!types &&
|
|
4618
|
+
!Array.from(types).includes(SD_FILE_EXPLORER_MOVE_MIME) &&
|
|
4619
|
+
Array.from(types).includes('Files'));
|
|
2561
4620
|
}
|
|
2562
4621
|
#droppedFiles(transfer) {
|
|
2563
4622
|
if (!transfer)
|
|
@@ -2584,6 +4643,10 @@ class SdFileExplorer {
|
|
|
2584
4643
|
}
|
|
2585
4644
|
#teardown() {
|
|
2586
4645
|
this.#destroyed = true;
|
|
4646
|
+
this.#moveController?.abort();
|
|
4647
|
+
this.#moveDrag.clear();
|
|
4648
|
+
// A command pressed right before the explorer goes away never runs; sd-side-drawer releases its own scroll lock.
|
|
4649
|
+
this.#pendingCommand = null;
|
|
2587
4650
|
this.#resizeObserver?.disconnect();
|
|
2588
4651
|
for (const controller of this.#listControllers.values())
|
|
2589
4652
|
controller.abort();
|
|
@@ -2602,16 +4665,22 @@ class SdFileExplorer {
|
|
|
2602
4665
|
this.#shareController?.abort();
|
|
2603
4666
|
}
|
|
2604
4667
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdFileExplorer, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2605
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", 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 });
|
|
4668
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", 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-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) .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"], 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 });
|
|
2606
4669
|
}
|
|
2607
4670
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: SdFileExplorer, decorators: [{
|
|
2608
4671
|
type: Component,
|
|
2609
4672
|
args: [{ selector: 'sd-file-explorer', standalone: true, imports: [
|
|
4673
|
+
A11yModule,
|
|
4674
|
+
MatTooltip,
|
|
2610
4675
|
SdIcon,
|
|
2611
4676
|
SdTranslatePipe,
|
|
2612
4677
|
SdBreadcrumb,
|
|
2613
4678
|
SdButton,
|
|
4679
|
+
SdInform,
|
|
4680
|
+
SdInformActionDirective,
|
|
2614
4681
|
SdDataState,
|
|
4682
|
+
SdFileExplorerActions,
|
|
4683
|
+
SdFileExplorerCommandSheet,
|
|
2615
4684
|
SdFileExplorerFolderTree,
|
|
2616
4685
|
SdFileExplorerItemList,
|
|
2617
4686
|
SdFileExplorerPreviewPanel,
|
|
@@ -2619,19 +4688,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
|
|
|
2619
4688
|
], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
2620
4689
|
class: 'sd-file-explorer',
|
|
2621
4690
|
'[class.sd-file-explorer--compact]': 'compact()',
|
|
4691
|
+
'[class.sd-file-explorer--touch]': 'touch()',
|
|
2622
4692
|
'[class.sd-file-explorer--dragging]': 'dragActive()',
|
|
2623
4693
|
'[attr.data-autoid]': 'autoId()',
|
|
2624
4694
|
'(dragenter)': 'onDragEnter($event)',
|
|
2625
4695
|
'(dragover)': 'onDragOver($event)',
|
|
2626
4696
|
'(dragleave)': 'onDragLeave()',
|
|
2627
4697
|
'(drop)': 'onDrop($event)',
|
|
4698
|
+
'(dragstart)': 'onMoveDragStart($event)',
|
|
4699
|
+
'(dragend)': 'onMoveDragEnd()',
|
|
2628
4700
|
'(keydown.escape)': 'onEscape($event)',
|
|
2629
|
-
}, 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"] }]
|
|
2630
|
-
}], 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 }] }] } });
|
|
4701
|
+
}, 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-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) .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"] }]
|
|
4702
|
+
}], 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 }] }] } });
|
|
2631
4703
|
|
|
2632
4704
|
/**
|
|
2633
4705
|
* Generated bundle index. Do not edit.
|
|
2634
4706
|
*/
|
|
2635
4707
|
|
|
2636
|
-
export { SdFileExplorer };
|
|
4708
|
+
export { SdFileExplorer, SdFileExplorerColumnDef };
|
|
2637
4709
|
//# sourceMappingURL=sdcorejs-angular-components-file-explorer.mjs.map
|