@sdcorejs/angular 22.3.0 → 22.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/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 +2247 -90
- package/fesm2022/sdcorejs-angular-components-file-explorer.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs +659 -36
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-kanban.mjs +464 -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 +262 -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/package.json +9 -1
- package/types/sdcorejs-angular-components-file-explorer.d.ts +447 -57
- package/types/sdcorejs-angular-components-form-generic.d.ts +58 -5
- package/types/sdcorejs-angular-components-kanban.d.ts +179 -0
- package/types/sdcorejs-angular-components-section.d.ts +2 -1
- package/types/sdcorejs-angular-components-tab.d.ts +3 -1
- package/types/sdcorejs-angular-components.d.ts +1 -0
- package/types/sdcorejs-angular-forms-segmented.d.ts +90 -0
- package/types/sdcorejs-angular-forms.d.ts +8 -6
- package/types/sdcorejs-angular-i18n.d.ts +59 -0
|
@@ -1,12 +1,492 @@
|
|
|
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, /* @ts-ignore */
|
|
298
|
+
...(ngDevMode ? [{ debugName: "actions" }] : /* istanbul ignore next */ []));
|
|
299
|
+
/** Value handed to `click` and to the state predicates: the selected files, or one item. */
|
|
300
|
+
context = input.required(/* @ts-ignore */
|
|
301
|
+
...(ngDevMode ? [{ debugName: "context" }] : /* istanbul ignore next */ []));
|
|
302
|
+
/** Variant of leaves (flat buttons) without `type`. */
|
|
303
|
+
defaultLeafType = input('text', /* @ts-ignore */
|
|
304
|
+
...(ngDevMode ? [{ debugName: "defaultLeafType" }] : /* istanbul ignore next */ []));
|
|
305
|
+
/** Variant of group triggers without `type`. */
|
|
306
|
+
defaultGroupType = input('text', /* @ts-ignore */
|
|
307
|
+
...(ngDevMode ? [{ debugName: "defaultGroupType" }] : /* istanbul ignore next */ []));
|
|
308
|
+
/** Color of definitions without `color`. */
|
|
309
|
+
defaultColor = input('secondary', /* @ts-ignore */
|
|
310
|
+
...(ngDevMode ? [{ debugName: "defaultColor" }] : /* istanbul ignore next */ []));
|
|
311
|
+
/** `sd-button` size of every entry. */
|
|
312
|
+
size = input('sm', /* @ts-ignore */
|
|
313
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
314
|
+
/** Collection name used in dev-mode warnings. */
|
|
315
|
+
source = input('actions', /* @ts-ignore */
|
|
316
|
+
...(ngDevMode ? [{ debugName: "source" }] : /* istanbul ignore next */ []));
|
|
317
|
+
/** Prefix of the entries' `data-autoid`, suffixed with the declared index (and the child index in menus). */
|
|
318
|
+
autoId = input(undefined, /* @ts-ignore */
|
|
319
|
+
...(ngDevMode ? [{ debugName: "autoId" }] : /* istanbul ignore next */ []));
|
|
320
|
+
// why: Angular query không dùng được trên field private kiểu ES (#) — dùng `private` của TypeScript.
|
|
321
|
+
buttons = viewChildren(SdButton, /* @ts-ignore */
|
|
322
|
+
...(ngDevMode ? [{ debugName: "buttons" }] : /* istanbul ignore next */ []));
|
|
323
|
+
entries = computed(() => sdFileExplorerResolveActions(this.actions(), this.context(), { leafType: this.defaultLeafType(), groupType: this.defaultGroupType(), color: this.defaultColor() }, this.source()), /* @ts-ignore */
|
|
324
|
+
...(ngDevMode ? [{ debugName: "entries" }] : /* istanbul ignore next */ []));
|
|
325
|
+
open = computed(() => this.buttons().some(button => button.popover.opened()), /* @ts-ignore */
|
|
326
|
+
...(ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []));
|
|
327
|
+
busy = computed(() => sdFileExplorerActionsBusy(this.entries()), /* @ts-ignore */
|
|
328
|
+
...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
|
|
329
|
+
loadingLabel = computed(() => this.#i18n.t('core.component.file-explorer.action-loading'), /* @ts-ignore */
|
|
330
|
+
...(ngDevMode ? [{ debugName: "loadingLabel" }] : /* istanbul ignore next */ []));
|
|
331
|
+
run(action, group) {
|
|
332
|
+
const actions = this.actions();
|
|
333
|
+
// A stale rendered button or menu must not dispatch a definition the consumer has withdrawn.
|
|
334
|
+
if (group ? !actions?.includes(group) || !group.children.includes(action) : !actions?.includes(action))
|
|
335
|
+
return;
|
|
336
|
+
const context = this.context();
|
|
337
|
+
// 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
|
|
338
|
+
// 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.
|
|
339
|
+
if ((group && sdFileExplorerActionBlocked(group, context)) || sdFileExplorerActionBlocked(action, context))
|
|
340
|
+
return;
|
|
341
|
+
(action.onClick ?? action.click)?.(context);
|
|
342
|
+
}
|
|
343
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdFileExplorerActions, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
344
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdFileExplorerActions, isStandalone: true, selector: "sd-file-explorer-actions", inputs: { actions: { classPropertyName: "actions", publicName: "actions", isSignal: true, isRequired: false, transformFunction: null }, context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: true, transformFunction: null }, defaultLeafType: { classPropertyName: "defaultLeafType", publicName: "defaultLeafType", isSignal: true, isRequired: false, transformFunction: null }, defaultGroupType: { classPropertyName: "defaultGroupType", publicName: "defaultGroupType", isSignal: true, isRequired: false, transformFunction: null }, defaultColor: { classPropertyName: "defaultColor", publicName: "defaultColor", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.sd-file-explorer-actions--open": "open()", "class.sd-file-explorer-actions--busy": "busy()" }, classAttribute: "sd-file-explorer-actions" }, viewQueries: [{ propertyName: "buttons", predicate: SdButton, descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
345
|
+
@let _autoId = autoId();
|
|
346
|
+
@let _size = size();
|
|
347
|
+
@for (entry of entries(); track entry.key) {
|
|
348
|
+
@let _entryAutoId = _autoId ? _autoId + '-' + entry.key : null;
|
|
349
|
+
@if (entry.kind === 'leaf') {
|
|
350
|
+
<sd-button
|
|
351
|
+
class="action"
|
|
352
|
+
[type]="entry.type"
|
|
353
|
+
[color]="entry.color"
|
|
354
|
+
[size]="_size"
|
|
355
|
+
[title]="entry.title"
|
|
356
|
+
[tooltip]="entry.tooltip"
|
|
357
|
+
[prefixIcon]="entry.prefixIcon"
|
|
358
|
+
[suffixIcon]="entry.suffixIcon"
|
|
359
|
+
[fontSet]="entry.fontSet"
|
|
360
|
+
[disabled]="entry.disabled"
|
|
361
|
+
[loading]="entry.loading"
|
|
362
|
+
[attr.data-autoid]="_entryAutoId"
|
|
363
|
+
(click)="run(entry.definition)" />
|
|
364
|
+
} @else {
|
|
365
|
+
<sd-button
|
|
366
|
+
class="action action--group"
|
|
367
|
+
[type]="entry.type"
|
|
368
|
+
[color]="entry.color"
|
|
369
|
+
[size]="_size"
|
|
370
|
+
[title]="entry.title"
|
|
371
|
+
[tooltip]="entry.tooltip"
|
|
372
|
+
[prefixIcon]="entry.prefixIcon"
|
|
373
|
+
[suffixIcon]="entry.suffixIcon"
|
|
374
|
+
[fontSet]="entry.fontSet"
|
|
375
|
+
[disabled]="entry.disabled"
|
|
376
|
+
[loading]="entry.loading"
|
|
377
|
+
[attr.data-autoid]="_entryAutoId">
|
|
378
|
+
@for (child of entry.children; track child.key) {
|
|
379
|
+
<sd-button-item
|
|
380
|
+
[color]="child.color"
|
|
381
|
+
[prefixIcon]="child.prefixIcon"
|
|
382
|
+
[suffixIcon]="child.suffixIcon"
|
|
383
|
+
[fontSet]="child.fontSet"
|
|
384
|
+
[tooltip]="child.tooltip"
|
|
385
|
+
[disabled]="child.disabled"
|
|
386
|
+
[autoId]="_entryAutoId ? _entryAutoId + '-' + child.key : null"
|
|
387
|
+
(click)="run(child.definition, entry.definition)">
|
|
388
|
+
<!-- why: sd-button-item has no loading input; a busy item shows a spinner here and is disabled. -->
|
|
389
|
+
@if (child.loading) {
|
|
390
|
+
<span class="spinner" aria-hidden="true"></span>
|
|
391
|
+
}
|
|
392
|
+
{{ child.label }}
|
|
393
|
+
@if (child.loading) {
|
|
394
|
+
<span class="visually-hidden">{{ loadingLabel() }}</span>
|
|
395
|
+
}
|
|
396
|
+
</sd-button-item>
|
|
397
|
+
}
|
|
398
|
+
</sd-button>
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
`, 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 });
|
|
402
|
+
}
|
|
403
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdFileExplorerActions, decorators: [{
|
|
404
|
+
type: Component,
|
|
405
|
+
args: [{ selector: 'sd-file-explorer-actions', standalone: true, imports: [SdButton, SdButtonItem], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
406
|
+
class: 'sd-file-explorer-actions',
|
|
407
|
+
'[class.sd-file-explorer-actions--open]': 'open()',
|
|
408
|
+
'[class.sd-file-explorer-actions--busy]': 'busy()',
|
|
409
|
+
}, template: `
|
|
410
|
+
@let _autoId = autoId();
|
|
411
|
+
@let _size = size();
|
|
412
|
+
@for (entry of entries(); track entry.key) {
|
|
413
|
+
@let _entryAutoId = _autoId ? _autoId + '-' + entry.key : null;
|
|
414
|
+
@if (entry.kind === 'leaf') {
|
|
415
|
+
<sd-button
|
|
416
|
+
class="action"
|
|
417
|
+
[type]="entry.type"
|
|
418
|
+
[color]="entry.color"
|
|
419
|
+
[size]="_size"
|
|
420
|
+
[title]="entry.title"
|
|
421
|
+
[tooltip]="entry.tooltip"
|
|
422
|
+
[prefixIcon]="entry.prefixIcon"
|
|
423
|
+
[suffixIcon]="entry.suffixIcon"
|
|
424
|
+
[fontSet]="entry.fontSet"
|
|
425
|
+
[disabled]="entry.disabled"
|
|
426
|
+
[loading]="entry.loading"
|
|
427
|
+
[attr.data-autoid]="_entryAutoId"
|
|
428
|
+
(click)="run(entry.definition)" />
|
|
429
|
+
} @else {
|
|
430
|
+
<sd-button
|
|
431
|
+
class="action action--group"
|
|
432
|
+
[type]="entry.type"
|
|
433
|
+
[color]="entry.color"
|
|
434
|
+
[size]="_size"
|
|
435
|
+
[title]="entry.title"
|
|
436
|
+
[tooltip]="entry.tooltip"
|
|
437
|
+
[prefixIcon]="entry.prefixIcon"
|
|
438
|
+
[suffixIcon]="entry.suffixIcon"
|
|
439
|
+
[fontSet]="entry.fontSet"
|
|
440
|
+
[disabled]="entry.disabled"
|
|
441
|
+
[loading]="entry.loading"
|
|
442
|
+
[attr.data-autoid]="_entryAutoId">
|
|
443
|
+
@for (child of entry.children; track child.key) {
|
|
444
|
+
<sd-button-item
|
|
445
|
+
[color]="child.color"
|
|
446
|
+
[prefixIcon]="child.prefixIcon"
|
|
447
|
+
[suffixIcon]="child.suffixIcon"
|
|
448
|
+
[fontSet]="child.fontSet"
|
|
449
|
+
[tooltip]="child.tooltip"
|
|
450
|
+
[disabled]="child.disabled"
|
|
451
|
+
[autoId]="_entryAutoId ? _entryAutoId + '-' + child.key : null"
|
|
452
|
+
(click)="run(child.definition, entry.definition)">
|
|
453
|
+
<!-- why: sd-button-item has no loading input; a busy item shows a spinner here and is disabled. -->
|
|
454
|
+
@if (child.loading) {
|
|
455
|
+
<span class="spinner" aria-hidden="true"></span>
|
|
456
|
+
}
|
|
457
|
+
{{ child.label }}
|
|
458
|
+
@if (child.loading) {
|
|
459
|
+
<span class="visually-hidden">{{ loadingLabel() }}</span>
|
|
460
|
+
}
|
|
461
|
+
</sd-button-item>
|
|
462
|
+
}
|
|
463
|
+
</sd-button>
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
`, 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"] }]
|
|
467
|
+
}], 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 }] }] } });
|
|
468
|
+
|
|
469
|
+
/** List-only custom metadata column. Pass the parent option as its required type anchor. */
|
|
470
|
+
// Public column-definition name follows the reviewed Explorer contract.
|
|
471
|
+
// eslint-disable-next-line @angular-eslint/directive-class-suffix
|
|
472
|
+
class SdFileExplorerColumnDef {
|
|
473
|
+
id = input.required({ ...(ngDevMode ? { debugName: "id" } : /* istanbul ignore next */ {}), alias: 'sdFileExplorerColumnDef' });
|
|
474
|
+
for = input.required({ ...(ngDevMode ? { debugName: "for" } : /* istanbul ignore next */ {}), alias: 'sdFileExplorerColumnFor' });
|
|
475
|
+
title = input.required(/* @ts-ignore */
|
|
476
|
+
...(ngDevMode ? [{ debugName: "title" }] : /* istanbul ignore next */ []));
|
|
477
|
+
width = input('160px', /* @ts-ignore */
|
|
478
|
+
...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []));
|
|
479
|
+
template = inject(TemplateRef);
|
|
480
|
+
static ngTemplateContextGuard(_directive, _context) {
|
|
481
|
+
return true;
|
|
482
|
+
}
|
|
483
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdFileExplorerColumnDef, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
484
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.5", type: SdFileExplorerColumnDef, isStandalone: true, selector: "ng-template[sdFileExplorerColumnDef]", inputs: { id: { classPropertyName: "id", publicName: "sdFileExplorerColumnDef", isSignal: true, isRequired: true, transformFunction: null }, for: { classPropertyName: "for", publicName: "sdFileExplorerColumnFor", isSignal: true, isRequired: true, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: true, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
485
|
+
}
|
|
486
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdFileExplorerColumnDef, decorators: [{
|
|
487
|
+
type: Directive,
|
|
488
|
+
args: [{ selector: 'ng-template[sdFileExplorerColumnDef]', standalone: true }]
|
|
489
|
+
}], 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
490
|
|
|
11
491
|
// AUTO-GENERATED by scripts/generate-file-explorer-icons.mjs from ./assets/icons. DO NOT EDIT.
|
|
12
492
|
// Run `npm run generate:file-explorer-icons` at the repo root after changing the SVG files or manifest.json.
|
|
@@ -446,29 +926,399 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
446
926
|
}, template: `<img [src]="src()" alt="" draggable="false" />`, styles: [":host{display:inline-flex;flex:none;width:var(--sd-file-explorer-icon-size, 32px);height:var(--sd-file-explorer-icon-size, 32px)}img{display:block;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;user-select:none}\n"] }]
|
|
447
927
|
}], propDecorators: { icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: true }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }] } });
|
|
448
928
|
|
|
929
|
+
/** Never the whole viewport: a strip of backdrop stays visible to tap the drawer away. */
|
|
930
|
+
const SHEET_WIDTH = 'min(400px, calc(100vw - 56px))';
|
|
931
|
+
let nextSheetId = 0;
|
|
932
|
+
/**
|
|
933
|
+
* Command drawer of the compact layout (internal): the commands of one item in a Core `<sd-side-drawer>` that covers
|
|
934
|
+
* the viewport — portalled to `<body>`, with its backdrop, `Escape`, close button, focus trap and page scroll lock.
|
|
935
|
+
*
|
|
936
|
+
* The explorer owns the item and decides when the drawer opens and closes: `show()` / `hide()`. The drawer lists the
|
|
937
|
+
* same commands as the desktop buttons, as menu-like entries; a group is a labelled section with its children. A
|
|
938
|
+
* pressed entry is only reported (`activate`): the explorer checks it again, closes the drawer and runs it. `close`
|
|
939
|
+
* reports that the user closed the drawer (close button, `Escape`, backdrop).
|
|
940
|
+
*
|
|
941
|
+
* Content projected into the drawer belongs to this view, so its encapsulated styles still apply in `<body>`; the
|
|
942
|
+
* drawer element itself is styled through the class this component passes as `drawerClass`.
|
|
943
|
+
*/
|
|
944
|
+
class SdFileExplorerCommandSheet {
|
|
945
|
+
#i18n = inject(I18nService);
|
|
946
|
+
/** Content for the item whose commands are shown; `null` while nothing is open. */
|
|
947
|
+
sheet = input(null, /* @ts-ignore */
|
|
948
|
+
...(ngDevMode ? [{ debugName: "sheet" }] : /* istanbul ignore next */ []));
|
|
949
|
+
/** Touch screen: 48 px entries and a 44 px close button. */
|
|
950
|
+
touch = input(false, /* @ts-ignore */
|
|
951
|
+
...(ngDevMode ? [{ debugName: "touch" }] : /* istanbul ignore next */ []));
|
|
952
|
+
/** E2E scope of the content and its entries. */
|
|
953
|
+
autoId = input(undefined, /* @ts-ignore */
|
|
954
|
+
...(ngDevMode ? [{ debugName: "autoId" }] : /* istanbul ignore next */ []));
|
|
955
|
+
/** An entry was pressed. Nothing has run yet. */
|
|
956
|
+
activate = output();
|
|
957
|
+
/** The user closed the drawer (close button, `Escape` or backdrop). */
|
|
958
|
+
close = output();
|
|
959
|
+
// why: query signal, not an ES private field — Angular queries need a TypeScript `private` member.
|
|
960
|
+
drawer = viewChild.required(SdSideDrawer, /* @ts-ignore */
|
|
961
|
+
...(ngDevMode ? [{ debugName: "drawer" }] : /* istanbul ignore next */ []));
|
|
962
|
+
width = SHEET_WIDTH;
|
|
963
|
+
sheetId = `sd-file-explorer-commands-${nextSheetId++}`;
|
|
964
|
+
// why: sd-side-drawer renders in <body>, out of reach of this view's encapsulated styles. The explorer-owned class
|
|
965
|
+
// scopes the few rules aimed at the drawer itself (the close button size) to this drawer only.
|
|
966
|
+
drawerClass = computed(() => ({
|
|
967
|
+
'sd-file-explorer-command-drawer': true,
|
|
968
|
+
'sd-file-explorer-command-drawer--touch': this.touch(),
|
|
969
|
+
}), /* @ts-ignore */
|
|
970
|
+
...(ngDevMode ? [{ debugName: "drawerClass" }] : /* istanbul ignore next */ []));
|
|
971
|
+
// why: sd-side-drawer adds its own `components-side-drawer-` prefix; drop the explorer's `components-` to avoid a repeat.
|
|
972
|
+
drawerAutoId = computed(() => this.autoId()?.replace(/^components-/, ''), /* @ts-ignore */
|
|
973
|
+
...(ngDevMode ? [{ debugName: "drawerAutoId" }] : /* istanbul ignore next */ []));
|
|
974
|
+
loadingLabel = computed(() => this.#i18n.t('core.component.file-explorer.action-loading'), /* @ts-ignore */
|
|
975
|
+
...(ngDevMode ? [{ debugName: "loadingLabel" }] : /* istanbul ignore next */ []));
|
|
976
|
+
/** Opens the drawer; its content follows `sheet`. */
|
|
977
|
+
show() {
|
|
978
|
+
this.drawer().open();
|
|
979
|
+
}
|
|
980
|
+
/** Closes the drawer at once — focus trap, backdrop and page scroll lock included — without reporting `close`. */
|
|
981
|
+
hide() {
|
|
982
|
+
const drawer = this.drawer();
|
|
983
|
+
if (drawer.isOpened())
|
|
984
|
+
drawer.forceClose();
|
|
985
|
+
}
|
|
986
|
+
accent(color) {
|
|
987
|
+
return color ? `var(--sd-${color})` : null;
|
|
988
|
+
}
|
|
989
|
+
onDrawerClosed() {
|
|
990
|
+
// Closed by the explorer (it has already let go of the item) or by the user: the explorer tells them apart.
|
|
991
|
+
if (this.sheet())
|
|
992
|
+
this.close.emit();
|
|
993
|
+
}
|
|
994
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdFileExplorerCommandSheet, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
995
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdFileExplorerCommandSheet, isStandalone: true, selector: "sd-file-explorer-command-sheet", inputs: { sheet: { classPropertyName: "sheet", publicName: "sheet", isSignal: true, isRequired: false, transformFunction: null }, touch: { classPropertyName: "touch", publicName: "touch", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { activate: "activate", close: "close" }, host: { classAttribute: "sd-file-explorer-command-sheet" }, viewQueries: [{ propertyName: "drawer", first: true, predicate: SdSideDrawer, descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
996
|
+
@let _sheet = sheet();
|
|
997
|
+
@let _autoId = autoId();
|
|
998
|
+
<sd-side-drawer
|
|
999
|
+
[width]="width"
|
|
1000
|
+
[title]="_sheet?.title ?? ''"
|
|
1001
|
+
[drawerClass]="drawerClass()"
|
|
1002
|
+
[autoId]="drawerAutoId()"
|
|
1003
|
+
(sdClosed)="onDrawerClosed()">
|
|
1004
|
+
@if (_sheet) {
|
|
1005
|
+
<div class="sheet" [class.sheet--touch]="touch()" [attr.data-autoid]="_autoId ?? null">
|
|
1006
|
+
<p class="context">
|
|
1007
|
+
<sd-file-explorer-file-icon [icon]="_sheet.icon" [size]="24" />
|
|
1008
|
+
<span class="context-text">{{ _sheet.context }}</span>
|
|
1009
|
+
</p>
|
|
1010
|
+
<div class="entries">
|
|
1011
|
+
@for (entry of _sheet.entries; track entry.key) {
|
|
1012
|
+
@if (entry.kind === 'group') {
|
|
1013
|
+
@let _labelId = sheetId + '-group-' + entry.key;
|
|
1014
|
+
<div
|
|
1015
|
+
class="group"
|
|
1016
|
+
role="group"
|
|
1017
|
+
[attr.aria-labelledby]="entry.loading ? _labelId + ' ' + _labelId + '-busy' : _labelId"
|
|
1018
|
+
[attr.aria-disabled]="entry.disabled ? true : null"
|
|
1019
|
+
[attr.aria-busy]="entry.loading ? true : null">
|
|
1020
|
+
<!-- why: the heading is not a control: text only, so it never repeats the icon of a child (a "Share"
|
|
1021
|
+
group over a "Share" item). The group's icon stays on its desktop trigger; a busy group still
|
|
1022
|
+
shows its spinner and says "in progress". -->
|
|
1023
|
+
<p class="group-label">
|
|
1024
|
+
@if (entry.loading) {
|
|
1025
|
+
<span class="spinner" aria-hidden="true"></span>
|
|
1026
|
+
}
|
|
1027
|
+
<span class="group-title" [id]="_labelId">{{ entry.label }}</span>
|
|
1028
|
+
@if (entry.loading) {
|
|
1029
|
+
<span class="visually-hidden" [id]="_labelId + '-busy'">{{ loadingLabel() }}</span>
|
|
1030
|
+
}
|
|
1031
|
+
</p>
|
|
1032
|
+
@for (child of entry.children; track child.key) {
|
|
1033
|
+
<ng-container
|
|
1034
|
+
[ngTemplateOutlet]="command"
|
|
1035
|
+
[ngTemplateOutletContext]="{
|
|
1036
|
+
$implicit: child,
|
|
1037
|
+
group: entry,
|
|
1038
|
+
autoId: _autoId ? _autoId + '-' + entry.key + '-' + child.key : null,
|
|
1039
|
+
}" />
|
|
1040
|
+
}
|
|
1041
|
+
</div>
|
|
1042
|
+
} @else {
|
|
1043
|
+
<ng-container
|
|
1044
|
+
[ngTemplateOutlet]="command"
|
|
1045
|
+
[ngTemplateOutletContext]="{ $implicit: entry, group: null, autoId: _autoId ? _autoId + '-' + entry.key : null }" />
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
</div>
|
|
1049
|
+
</div>
|
|
1050
|
+
}
|
|
1051
|
+
</sd-side-drawer>
|
|
1052
|
+
|
|
1053
|
+
<!-- One entry: neutral label, icons in the declared color (as Core menu items), spinner + hidden text while loading. -->
|
|
1054
|
+
<ng-template #command let-command let-group="group" let-entryAutoId="autoId">
|
|
1055
|
+
<button
|
|
1056
|
+
type="button"
|
|
1057
|
+
class="command"
|
|
1058
|
+
[disabled]="command.disabled"
|
|
1059
|
+
[style.--sd-fe-command-accent]="accent(command.color)"
|
|
1060
|
+
[attr.data-autoid]="entryAutoId"
|
|
1061
|
+
(click)="activate.emit({ command, group })">
|
|
1062
|
+
@if (command.loading) {
|
|
1063
|
+
<span class="spinner" aria-hidden="true"></span>
|
|
1064
|
+
} @else if (command.prefixIcon) {
|
|
1065
|
+
<sd-icon class="command-icon" size="20px" [name]="command.prefixIcon" [fontSet]="command.fontSet" />
|
|
1066
|
+
}
|
|
1067
|
+
<span class="command-label">{{ command.label }}</span>
|
|
1068
|
+
@if (command.suffixIcon && !command.loading) {
|
|
1069
|
+
<sd-icon class="command-icon" size="20px" [name]="command.suffixIcon" [fontSet]="command.fontSet" />
|
|
1070
|
+
}
|
|
1071
|
+
@if (command.loading) {
|
|
1072
|
+
<span class="visually-hidden">{{ loadingLabel() }}</span>
|
|
1073
|
+
}
|
|
1074
|
+
</button>
|
|
1075
|
+
</ng-template>
|
|
1076
|
+
`, 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 });
|
|
1077
|
+
}
|
|
1078
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdFileExplorerCommandSheet, decorators: [{
|
|
1079
|
+
type: Component,
|
|
1080
|
+
args: [{ selector: 'sd-file-explorer-command-sheet', standalone: true, imports: [NgTemplateOutlet, SdIcon, SdSideDrawer, SdFileExplorerFileIcon], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1081
|
+
class: 'sd-file-explorer-command-sheet',
|
|
1082
|
+
}, template: `
|
|
1083
|
+
@let _sheet = sheet();
|
|
1084
|
+
@let _autoId = autoId();
|
|
1085
|
+
<sd-side-drawer
|
|
1086
|
+
[width]="width"
|
|
1087
|
+
[title]="_sheet?.title ?? ''"
|
|
1088
|
+
[drawerClass]="drawerClass()"
|
|
1089
|
+
[autoId]="drawerAutoId()"
|
|
1090
|
+
(sdClosed)="onDrawerClosed()">
|
|
1091
|
+
@if (_sheet) {
|
|
1092
|
+
<div class="sheet" [class.sheet--touch]="touch()" [attr.data-autoid]="_autoId ?? null">
|
|
1093
|
+
<p class="context">
|
|
1094
|
+
<sd-file-explorer-file-icon [icon]="_sheet.icon" [size]="24" />
|
|
1095
|
+
<span class="context-text">{{ _sheet.context }}</span>
|
|
1096
|
+
</p>
|
|
1097
|
+
<div class="entries">
|
|
1098
|
+
@for (entry of _sheet.entries; track entry.key) {
|
|
1099
|
+
@if (entry.kind === 'group') {
|
|
1100
|
+
@let _labelId = sheetId + '-group-' + entry.key;
|
|
1101
|
+
<div
|
|
1102
|
+
class="group"
|
|
1103
|
+
role="group"
|
|
1104
|
+
[attr.aria-labelledby]="entry.loading ? _labelId + ' ' + _labelId + '-busy' : _labelId"
|
|
1105
|
+
[attr.aria-disabled]="entry.disabled ? true : null"
|
|
1106
|
+
[attr.aria-busy]="entry.loading ? true : null">
|
|
1107
|
+
<!-- why: the heading is not a control: text only, so it never repeats the icon of a child (a "Share"
|
|
1108
|
+
group over a "Share" item). The group's icon stays on its desktop trigger; a busy group still
|
|
1109
|
+
shows its spinner and says "in progress". -->
|
|
1110
|
+
<p class="group-label">
|
|
1111
|
+
@if (entry.loading) {
|
|
1112
|
+
<span class="spinner" aria-hidden="true"></span>
|
|
1113
|
+
}
|
|
1114
|
+
<span class="group-title" [id]="_labelId">{{ entry.label }}</span>
|
|
1115
|
+
@if (entry.loading) {
|
|
1116
|
+
<span class="visually-hidden" [id]="_labelId + '-busy'">{{ loadingLabel() }}</span>
|
|
1117
|
+
}
|
|
1118
|
+
</p>
|
|
1119
|
+
@for (child of entry.children; track child.key) {
|
|
1120
|
+
<ng-container
|
|
1121
|
+
[ngTemplateOutlet]="command"
|
|
1122
|
+
[ngTemplateOutletContext]="{
|
|
1123
|
+
$implicit: child,
|
|
1124
|
+
group: entry,
|
|
1125
|
+
autoId: _autoId ? _autoId + '-' + entry.key + '-' + child.key : null,
|
|
1126
|
+
}" />
|
|
1127
|
+
}
|
|
1128
|
+
</div>
|
|
1129
|
+
} @else {
|
|
1130
|
+
<ng-container
|
|
1131
|
+
[ngTemplateOutlet]="command"
|
|
1132
|
+
[ngTemplateOutletContext]="{ $implicit: entry, group: null, autoId: _autoId ? _autoId + '-' + entry.key : null }" />
|
|
1133
|
+
}
|
|
1134
|
+
}
|
|
1135
|
+
</div>
|
|
1136
|
+
</div>
|
|
1137
|
+
}
|
|
1138
|
+
</sd-side-drawer>
|
|
1139
|
+
|
|
1140
|
+
<!-- One entry: neutral label, icons in the declared color (as Core menu items), spinner + hidden text while loading. -->
|
|
1141
|
+
<ng-template #command let-command let-group="group" let-entryAutoId="autoId">
|
|
1142
|
+
<button
|
|
1143
|
+
type="button"
|
|
1144
|
+
class="command"
|
|
1145
|
+
[disabled]="command.disabled"
|
|
1146
|
+
[style.--sd-fe-command-accent]="accent(command.color)"
|
|
1147
|
+
[attr.data-autoid]="entryAutoId"
|
|
1148
|
+
(click)="activate.emit({ command, group })">
|
|
1149
|
+
@if (command.loading) {
|
|
1150
|
+
<span class="spinner" aria-hidden="true"></span>
|
|
1151
|
+
} @else if (command.prefixIcon) {
|
|
1152
|
+
<sd-icon class="command-icon" size="20px" [name]="command.prefixIcon" [fontSet]="command.fontSet" />
|
|
1153
|
+
}
|
|
1154
|
+
<span class="command-label">{{ command.label }}</span>
|
|
1155
|
+
@if (command.suffixIcon && !command.loading) {
|
|
1156
|
+
<sd-icon class="command-icon" size="20px" [name]="command.suffixIcon" [fontSet]="command.fontSet" />
|
|
1157
|
+
}
|
|
1158
|
+
@if (command.loading) {
|
|
1159
|
+
<span class="visually-hidden">{{ loadingLabel() }}</span>
|
|
1160
|
+
}
|
|
1161
|
+
</button>
|
|
1162
|
+
</ng-template>
|
|
1163
|
+
`, 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"] }]
|
|
1164
|
+
}], 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 }] }] } });
|
|
1165
|
+
|
|
1166
|
+
/**
|
|
1167
|
+
* Compact actions trigger of one row, card or tree node (internal): a `more_vert` icon button that asks the explorer to
|
|
1168
|
+
* open the item's command drawer, emitting itself so focus can come back to it when the drawer closes.
|
|
1169
|
+
*
|
|
1170
|
+
* While one of the item's commands is loading it shows a spinner instead of the icon and stays clickable, so the drawer
|
|
1171
|
+
* can still show which command is busy and run the others.
|
|
1172
|
+
*/
|
|
1173
|
+
class SdFileExplorerMenuTrigger {
|
|
1174
|
+
#i18n = inject(I18nService);
|
|
1175
|
+
/** Accessible name and tooltip: "Actions for {name}" ("… (In progress)" while busy). */
|
|
1176
|
+
label = input.required(/* @ts-ignore */
|
|
1177
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
1178
|
+
/** One of the item's commands is loading. */
|
|
1179
|
+
busy = input(false, /* @ts-ignore */
|
|
1180
|
+
...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
|
|
1181
|
+
/** The item's command drawer is open. */
|
|
1182
|
+
expanded = input(false, /* @ts-ignore */
|
|
1183
|
+
...(ngDevMode ? [{ debugName: "expanded" }] : /* istanbul ignore next */ []));
|
|
1184
|
+
/** Touch screen: 48 px target, no tooltip. */
|
|
1185
|
+
touch = input(false, /* @ts-ignore */
|
|
1186
|
+
...(ngDevMode ? [{ debugName: "touch" }] : /* istanbul ignore next */ []));
|
|
1187
|
+
/** `null` keeps the button in the tab order; the tree passes `-1` for every node but its tab stop. */
|
|
1188
|
+
tabIndex = input(null, /* @ts-ignore */
|
|
1189
|
+
...(ngDevMode ? [{ debugName: "tabIndex" }] : /* istanbul ignore next */ []));
|
|
1190
|
+
autoId = input(undefined, /* @ts-ignore */
|
|
1191
|
+
...(ngDevMode ? [{ debugName: "autoId" }] : /* istanbul ignore next */ []));
|
|
1192
|
+
/** Pressed: emits the native button, the element focus returns to. */
|
|
1193
|
+
activate = output();
|
|
1194
|
+
accessibleName = computed(() => this.busy() ? `${this.label()} (${this.#i18n.t('core.component.file-explorer.action-loading')})` : this.label(), /* @ts-ignore */
|
|
1195
|
+
...(ngDevMode ? [{ debugName: "accessibleName" }] : /* istanbul ignore next */ []));
|
|
1196
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdFileExplorerMenuTrigger, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1197
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdFileExplorerMenuTrigger, isStandalone: true, selector: "sd-file-explorer-menu-trigger", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: true, transformFunction: null }, busy: { classPropertyName: "busy", publicName: "busy", isSignal: true, isRequired: false, transformFunction: null }, expanded: { classPropertyName: "expanded", publicName: "expanded", isSignal: true, isRequired: false, transformFunction: null }, touch: { classPropertyName: "touch", publicName: "touch", isSignal: true, isRequired: false, transformFunction: null }, tabIndex: { classPropertyName: "tabIndex", publicName: "tabIndex", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { activate: "activate" }, host: { properties: { "class.sd-file-explorer-menu-trigger--touch": "touch()" }, classAttribute: "sd-file-explorer-menu-trigger" }, ngImport: i0, template: `
|
|
1198
|
+
<!-- why: no tooltip on touch screens — MatTooltip would take over touch gestures (touch-action: none) and block
|
|
1199
|
+
scrolling the list from the button; the accessible name is there either way. The tooltip repeats the name, so
|
|
1200
|
+
Material does not add it as a description read twice. -->
|
|
1201
|
+
<button
|
|
1202
|
+
#button
|
|
1203
|
+
type="button"
|
|
1204
|
+
class="trigger"
|
|
1205
|
+
aria-haspopup="dialog"
|
|
1206
|
+
[attr.aria-expanded]="expanded()"
|
|
1207
|
+
[attr.aria-label]="accessibleName()"
|
|
1208
|
+
[attr.tabindex]="tabIndex()"
|
|
1209
|
+
[attr.data-autoid]="autoId() ?? null"
|
|
1210
|
+
[matTooltip]="accessibleName()"
|
|
1211
|
+
[matTooltipDisabled]="touch()"
|
|
1212
|
+
(click)="activate.emit(button)">
|
|
1213
|
+
@if (busy()) {
|
|
1214
|
+
<span class="spinner" aria-hidden="true"></span>
|
|
1215
|
+
} @else {
|
|
1216
|
+
<sd-icon name="more_vert" size="20px" />
|
|
1217
|
+
}
|
|
1218
|
+
</button>
|
|
1219
|
+
`, 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 });
|
|
1220
|
+
}
|
|
1221
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdFileExplorerMenuTrigger, decorators: [{
|
|
1222
|
+
type: Component,
|
|
1223
|
+
args: [{ selector: 'sd-file-explorer-menu-trigger', standalone: true, imports: [MatTooltip, SdIcon], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1224
|
+
class: 'sd-file-explorer-menu-trigger',
|
|
1225
|
+
'[class.sd-file-explorer-menu-trigger--touch]': 'touch()',
|
|
1226
|
+
}, template: `
|
|
1227
|
+
<!-- why: no tooltip on touch screens — MatTooltip would take over touch gestures (touch-action: none) and block
|
|
1228
|
+
scrolling the list from the button; the accessible name is there either way. The tooltip repeats the name, so
|
|
1229
|
+
Material does not add it as a description read twice. -->
|
|
1230
|
+
<button
|
|
1231
|
+
#button
|
|
1232
|
+
type="button"
|
|
1233
|
+
class="trigger"
|
|
1234
|
+
aria-haspopup="dialog"
|
|
1235
|
+
[attr.aria-expanded]="expanded()"
|
|
1236
|
+
[attr.aria-label]="accessibleName()"
|
|
1237
|
+
[attr.tabindex]="tabIndex()"
|
|
1238
|
+
[attr.data-autoid]="autoId() ?? null"
|
|
1239
|
+
[matTooltip]="accessibleName()"
|
|
1240
|
+
[matTooltipDisabled]="touch()"
|
|
1241
|
+
(click)="activate.emit(button)">
|
|
1242
|
+
@if (busy()) {
|
|
1243
|
+
<span class="spinner" aria-hidden="true"></span>
|
|
1244
|
+
} @else {
|
|
1245
|
+
<sd-icon name="more_vert" size="20px" />
|
|
1246
|
+
}
|
|
1247
|
+
</button>
|
|
1248
|
+
`, 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"] }]
|
|
1249
|
+
}], 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"] }] } });
|
|
1250
|
+
|
|
1251
|
+
let nextTreeId = 0;
|
|
1252
|
+
/** Events from a folder command (or the space between them), or from the compact actions trigger, belong to it. */
|
|
1253
|
+
const COMMAND_AREAS = '.node-actions, .sd-file-explorer-menu-trigger';
|
|
449
1254
|
/**
|
|
450
1255
|
* Folder tree of the explorer (internal). Rendered as a flat `role="tree"` list whose depth is carried by
|
|
451
1256
|
* `aria-level`, with a roving tabindex and the WAI-ARIA tree keyboard model.
|
|
1257
|
+
*
|
|
1258
|
+
* Folder commands sit at the end of each folder node. On desktop they are rendered for the hovered or focused node
|
|
1259
|
+
* only — taking no room while hidden, so names keep the full width — and `Tab` from the focused node reaches them
|
|
1260
|
+
* while the tree keeps a single tab stop. A node with commands is named by its label alone and wraps its commands
|
|
1261
|
+
* onto a second line when they do not fit next to the name.
|
|
1262
|
+
*
|
|
1263
|
+
* In the compact layout a folder node carries one actions trigger instead, which asks the explorer for its command
|
|
1264
|
+
* drawer; only the trigger of the tab-stop node is in the tab order.
|
|
452
1265
|
*/
|
|
453
1266
|
class SdFileExplorerFolderTree {
|
|
1267
|
+
moveDropTarget = input(/* @ts-ignore */
|
|
1268
|
+
...(ngDevMode ? [undefined, { debugName: "moveDropTarget" }] : /* istanbul ignore next */ []));
|
|
454
1269
|
#host = inject(ElementRef);
|
|
455
1270
|
#i18n = inject(I18nService);
|
|
1271
|
+
/** Prefix of the label ids that name nodes with commands. */
|
|
1272
|
+
treeId = `sd-file-explorer-tree-${nextTreeId++}`;
|
|
456
1273
|
/** Visible nodes in display order. */
|
|
457
1274
|
nodes = input.required(/* @ts-ignore */
|
|
458
1275
|
...(ngDevMode ? [{ debugName: "nodes" }] : /* istanbul ignore next */ []));
|
|
459
1276
|
/** Accessible name of the tree. */
|
|
460
1277
|
label = input('', /* @ts-ignore */
|
|
461
1278
|
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
1279
|
+
/** Commands of every folder node; the root has none. */
|
|
1280
|
+
commands = input(undefined, /* @ts-ignore */
|
|
1281
|
+
...(ngDevMode ? [{ debugName: "commands" }] : /* istanbul ignore next */ []));
|
|
1282
|
+
/** Touch screen: commands always visible, with 48 px buttons (44 px compact trigger). */
|
|
1283
|
+
touch = input(false, /* @ts-ignore */
|
|
1284
|
+
...(ngDevMode ? [{ debugName: "touch" }] : /* istanbul ignore next */ []));
|
|
1285
|
+
/** Compact layout: an actions trigger per folder node instead of its commands. */
|
|
1286
|
+
compact = input(false, /* @ts-ignore */
|
|
1287
|
+
...(ngDevMode ? [{ debugName: "compact" }] : /* istanbul ignore next */ []));
|
|
1288
|
+
/** Id of the folder whose command drawer is open from the tree. */
|
|
1289
|
+
menuOpenId = input(null, /* @ts-ignore */
|
|
1290
|
+
...(ngDevMode ? [{ debugName: "menuOpenId" }] : /* istanbul ignore next */ []));
|
|
462
1291
|
/** A node was activated (click, Enter, Space). */
|
|
463
1292
|
select = output();
|
|
464
1293
|
/** Expand / collapse requested. */
|
|
465
1294
|
toggle = output();
|
|
466
1295
|
/** Retry loading the children of a node whose listing failed. */
|
|
467
1296
|
retry = output();
|
|
1297
|
+
/** Compact actions trigger of a folder pressed. */
|
|
1298
|
+
openCommands = output();
|
|
468
1299
|
focusedKey = signal(null, /* @ts-ignore */
|
|
469
1300
|
...(ngDevMode ? [{ debugName: "focusedKey" }] : /* istanbul ignore next */ []));
|
|
470
1301
|
retryLabel = computed(() => this.#i18n.t('core.component.file-explorer.retry'), /* @ts-ignore */
|
|
471
1302
|
...(ngDevMode ? [{ debugName: "retryLabel" }] : /* istanbul ignore next */ []));
|
|
1303
|
+
/**
|
|
1304
|
+
* Compact: trigger state per folder node key, for folders whose drawer would list something; `null` on desktop,
|
|
1305
|
+
* where the nodes render their commands.
|
|
1306
|
+
*/
|
|
1307
|
+
menus = computed(() => {
|
|
1308
|
+
if (!this.compact())
|
|
1309
|
+
return null;
|
|
1310
|
+
const commands = this.commands();
|
|
1311
|
+
const menus = new Map();
|
|
1312
|
+
for (const node of this.nodes()) {
|
|
1313
|
+
if (!node.item)
|
|
1314
|
+
continue;
|
|
1315
|
+
const resolved = sdFileExplorerResolveActions(commands, node.item, SD_FILE_EXPLORER_COMMAND_DEFAULTS, 'folderCommands');
|
|
1316
|
+
if (resolved.length)
|
|
1317
|
+
menus.set(node.key, { busy: sdFileExplorerActionsBusy(resolved) });
|
|
1318
|
+
}
|
|
1319
|
+
return menus;
|
|
1320
|
+
}, /* @ts-ignore */
|
|
1321
|
+
...(ngDevMode ? [{ debugName: "menus" }] : /* istanbul ignore next */ []));
|
|
472
1322
|
/** Node owning the roving tabindex: the focused node if still visible, else the selected one. */
|
|
473
1323
|
activeKey = computed(() => {
|
|
474
1324
|
const nodes = this.nodes();
|
|
@@ -482,6 +1332,9 @@ class SdFileExplorerFolderTree {
|
|
|
482
1332
|
const key = node.expanded ? 'core.component.file-explorer.collapse' : 'core.component.file-explorer.expand';
|
|
483
1333
|
return this.#i18n.t(key, { name: node.name });
|
|
484
1334
|
}
|
|
1335
|
+
menuLabel(node) {
|
|
1336
|
+
return this.#i18n.t('core.component.file-explorer.item-actions', { name: node.name });
|
|
1337
|
+
}
|
|
485
1338
|
onToggle(event, node) {
|
|
486
1339
|
// why: nút toggle nằm trong treeitem — chặn bubble để bấm mũi tên không đồng thời điều hướng vào thư mục.
|
|
487
1340
|
event.stopPropagation();
|
|
@@ -491,7 +1344,15 @@ class SdFileExplorerFolderTree {
|
|
|
491
1344
|
event.stopPropagation();
|
|
492
1345
|
this.retry.emit(node);
|
|
493
1346
|
}
|
|
1347
|
+
onClick(event, node) {
|
|
1348
|
+
if (this.#fromCommands(event))
|
|
1349
|
+
return;
|
|
1350
|
+
this.select.emit(node);
|
|
1351
|
+
}
|
|
494
1352
|
onKeydown(event, index) {
|
|
1353
|
+
// 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.
|
|
1354
|
+
if (this.#fromCommands(event))
|
|
1355
|
+
return;
|
|
495
1356
|
const nodes = this.nodes();
|
|
496
1357
|
const node = nodes[index];
|
|
497
1358
|
if (!node)
|
|
@@ -545,16 +1406,35 @@ class SdFileExplorerFolderTree {
|
|
|
545
1406
|
const element = this.#host.nativeElement.querySelectorAll('[role="treeitem"]')[index];
|
|
546
1407
|
element?.focus();
|
|
547
1408
|
}
|
|
1409
|
+
/** The event started on a folder command (or the space between them) or on the actions trigger of the node. */
|
|
1410
|
+
#fromCommands(event) {
|
|
1411
|
+
const target = event.target instanceof Element ? event.target : null;
|
|
1412
|
+
const area = target?.closest(COMMAND_AREAS);
|
|
1413
|
+
return !!area && event.currentTarget instanceof Element && event.currentTarget.contains(area);
|
|
1414
|
+
}
|
|
548
1415
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdFileExplorerFolderTree, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
549
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdFileExplorerFolderTree, isStandalone: true, selector: "sd-file-explorer-folder-tree", inputs: { nodes: { classPropertyName: "nodes", publicName: "nodes", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { select: "select", toggle: "toggle", retry: "retry" }, host: { classAttribute: "sd-file-explorer-folder-tree" }, ngImport: i0, template: `
|
|
1416
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdFileExplorerFolderTree, isStandalone: true, selector: "sd-file-explorer-folder-tree", inputs: { moveDropTarget: { classPropertyName: "moveDropTarget", publicName: "moveDropTarget", isSignal: true, isRequired: false, transformFunction: null }, nodes: { classPropertyName: "nodes", publicName: "nodes", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, commands: { classPropertyName: "commands", publicName: "commands", isSignal: true, isRequired: false, transformFunction: null }, touch: { classPropertyName: "touch", publicName: "touch", isSignal: true, isRequired: false, transformFunction: null }, compact: { classPropertyName: "compact", publicName: "compact", isSignal: true, isRequired: false, transformFunction: null }, menuOpenId: { classPropertyName: "menuOpenId", publicName: "menuOpenId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { select: "select", toggle: "toggle", retry: "retry", openCommands: "openCommands" }, host: { properties: { "class.sd-file-explorer-folder-tree--touch": "touch()", "class.sd-file-explorer-folder-tree--compact": "compact()" }, classAttribute: "sd-file-explorer-folder-tree" }, ngImport: i0, template: `
|
|
550
1417
|
@let _nodes = nodes();
|
|
551
1418
|
@let _active = activeKey();
|
|
1419
|
+
@let _commands = commands();
|
|
1420
|
+
@let _hasCommands = !!_commands?.length;
|
|
1421
|
+
@let _touch = touch();
|
|
1422
|
+
@let _commandSize = _touch ? 'lg' : 'sm';
|
|
1423
|
+
@let _menus = menus();
|
|
1424
|
+
@let _menuOpenId = menuOpenId();
|
|
552
1425
|
<ul class="tree" role="tree" [attr.aria-label]="label()">
|
|
553
1426
|
@for (node of _nodes; track node.key; let i = $index) {
|
|
1427
|
+
@let _nodeCommands = _hasCommands && !!node.item;
|
|
1428
|
+
@let _labelId = treeId + '-label-' + i;
|
|
554
1429
|
<li
|
|
555
1430
|
class="node"
|
|
556
1431
|
role="treeitem"
|
|
1432
|
+
[attr.data-move-target]="node.id ?? ''"
|
|
1433
|
+
[class.move-drop-target]="moveDropTarget() === node.id"
|
|
557
1434
|
[class.node--selected]="node.selected"
|
|
1435
|
+
[class.node--commands]="_nodeCommands"
|
|
1436
|
+
[class.node--error]="node.status === 'error'"
|
|
1437
|
+
[attr.aria-labelledby]="_nodeCommands ? _labelId : null"
|
|
558
1438
|
[attr.aria-level]="node.level"
|
|
559
1439
|
[attr.aria-selected]="node.selected"
|
|
560
1440
|
[attr.aria-expanded]="node.expandable ? node.expanded : null"
|
|
@@ -562,7 +1442,7 @@ class SdFileExplorerFolderTree {
|
|
|
562
1442
|
[attr.tabindex]="node.key === _active ? 0 : -1"
|
|
563
1443
|
[attr.data-autoid]="node.autoId"
|
|
564
1444
|
[style.--sd-file-explorer-tree-indent]="(node.level > 1 ? node.level - 2 : 0) * 22 + 'px'"
|
|
565
|
-
(click)="
|
|
1445
|
+
(click)="onClick($event, node)"
|
|
566
1446
|
(keydown)="onKeydown($event, i)"
|
|
567
1447
|
(focus)="focusedKey.set(node.key)">
|
|
568
1448
|
@if (node.level > 1) {
|
|
@@ -582,7 +1462,7 @@ class SdFileExplorerFolderTree {
|
|
|
582
1462
|
}
|
|
583
1463
|
}
|
|
584
1464
|
<sd-file-explorer-file-icon [icon]="node.expanded ? 'folder-open' : 'folder-closed'" [size]="28" />
|
|
585
|
-
<span class="label" [title]="node.name">{{ node.name }}</span>
|
|
1465
|
+
<span class="label" [id]="_labelId" [title]="node.name">{{ node.name }}</span>
|
|
586
1466
|
@if (node.status === 'loading') {
|
|
587
1467
|
<span class="spinner" aria-hidden="true"></span>
|
|
588
1468
|
} @else if (node.status === 'error') {
|
|
@@ -596,22 +1476,64 @@ class SdFileExplorerFolderTree {
|
|
|
596
1476
|
<sd-icon name="refresh" size="16px" />
|
|
597
1477
|
</button>
|
|
598
1478
|
}
|
|
1479
|
+
@if (_nodeCommands) {
|
|
1480
|
+
@if (node.item; as folder) {
|
|
1481
|
+
@if (!_menus) {
|
|
1482
|
+
<sd-file-explorer-actions
|
|
1483
|
+
class="node-actions"
|
|
1484
|
+
source="folderCommands"
|
|
1485
|
+
[actions]="_commands"
|
|
1486
|
+
[context]="folder"
|
|
1487
|
+
[size]="_commandSize"
|
|
1488
|
+
[autoId]="node.autoId ? node.autoId + '-command' : undefined" />
|
|
1489
|
+
} @else {
|
|
1490
|
+
@if (_menus.get(node.key); as menu) {
|
|
1491
|
+
<sd-file-explorer-menu-trigger
|
|
1492
|
+
class="node-menu"
|
|
1493
|
+
[label]="menuLabel(node)"
|
|
1494
|
+
[busy]="menu.busy"
|
|
1495
|
+
[expanded]="folder.id === _menuOpenId"
|
|
1496
|
+
[touch]="_touch"
|
|
1497
|
+
[tabIndex]="node.key === _active ? 0 : -1"
|
|
1498
|
+
[autoId]="node.autoId ? node.autoId + '-commands' : undefined"
|
|
1499
|
+
(activate)="openCommands.emit({ item: folder, trigger: $event })" />
|
|
1500
|
+
}
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
599
1504
|
</li>
|
|
600
1505
|
}
|
|
601
1506
|
</ul>
|
|
602
|
-
`, isInline: true, styles: ["
|
|
1507
|
+
`, isInline: true, styles: ["@charset \"UTF-8\";:host{display:block}.tree{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px}.node{display:flex;align-items:center;gap:8px;min-height:40px;padding:0 10px;border-radius:var(--sd-radius-8, 8px);color:var(--sd-fe-text);font-size:var(--sd-font-size-15, 15px);line-height:var(--sd-line-height-20, 20px);cursor:pointer;-webkit-user-select:none;user-select:none;outline:none}.node:hover{background:var(--sd-fe-hover)}.node:focus-visible{box-shadow:inset 0 0 0 2px var(--sd-fe-accent)}.node--selected{background:var(--sd-fe-accent-soft);color:var(--sd-fe-accent);font-weight:var(--sd-font-weight-semibold, 600)}.node--selected:hover{background:var(--sd-fe-accent-soft)}.indent{flex:none;width:var(--sd-file-explorer-tree-indent, 0);margin-right:-8px}.toggle{flex:none;display:inline-flex;align-items:center;justify-content:center;width:16px;height:24px;margin-right:-1px;padding:0;border:0;border-radius:var(--sd-radius-4, 4px);background:transparent;color:var(--sd-fe-text-secondary);cursor:pointer}.toggle:hover{color:var(--sd-fe-text)}.label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host(.sd-file-explorer-folder-tree--touch) .node{min-height:var(--sd-space-48, 48px)}:host(.sd-file-explorer-folder-tree--touch) .node--error{flex-wrap:wrap}:host(.sd-file-explorer-folder-tree--touch) .node--error .label{flex:1 1 8ch;min-inline-size:min(100%,8ch);white-space:normal;overflow-wrap:anywhere}:host(.sd-file-explorer-folder-tree--touch) .node--error .retry{margin-inline-start:auto}:host(.sd-file-explorer-folder-tree--touch) .toggle,:host(.sd-file-explorer-folder-tree--touch) .retry{width:var(--sd-space-48, 48px);height:var(--sd-space-48, 48px)}.retry{flex:none;display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:0;border-radius:var(--sd-radius-6, 6px);background:transparent;color:var(--sd-fe-error);cursor:pointer}.retry:hover{background:color-mix(in srgb,var(--sd-fe-error) 10%,transparent)}.node-actions{display:none;flex:0 1 auto;min-width:0;margin-inline:auto -6px}.node:hover .node-actions,.node:focus-within .node-actions,.node-actions.sd-file-explorer-actions--open,.node-actions.sd-file-explorer-actions--busy,:host(.sd-file-explorer-folder-tree--touch) .node-actions{display:inline-flex}.node--commands{flex-wrap:wrap;row-gap:2px;padding-block:2px}:host(.sd-file-explorer-folder-tree--touch) .node--commands .label{flex:1 1 auto}.node-menu{flex:none;margin-inline:auto -6px}:host(.sd-file-explorer-folder-tree--compact) .node--commands:not(.node--error){flex-wrap:nowrap}:host(.sd-file-explorer-folder-tree--compact) .node--commands:not(.node--error) .label{flex:1 1 0}.spinner{flex:none;width:14px;height:14px;border:2px solid color-mix(in srgb,var(--sd-fe-accent) 25%,transparent);border-top-color:var(--sd-fe-accent);border-radius:50%;animation:sd-file-explorer-tree-spin .8s linear infinite}@keyframes sd-file-explorer-tree-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.spinner{animation-duration:2.4s}}.move-drop-target:after{content:\"\\21b3\";font-weight:700;color:var(--sd-fe-text)}.move-drop-target{outline:2px solid var(--sd-fe-accent);outline-offset:-2px}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "component", type: SdFileExplorerActions, selector: "sd-file-explorer-actions", inputs: ["actions", "context", "defaultLeafType", "defaultGroupType", "defaultColor", "size", "source", "autoId"] }, { kind: "component", type: SdFileExplorerFileIcon, selector: "sd-file-explorer-file-icon", inputs: ["icon", "size"] }, { kind: "component", type: SdFileExplorerMenuTrigger, selector: "sd-file-explorer-menu-trigger", inputs: ["label", "busy", "expanded", "touch", "tabIndex", "autoId"], outputs: ["activate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
603
1508
|
}
|
|
604
1509
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdFileExplorerFolderTree, decorators: [{
|
|
605
1510
|
type: Component,
|
|
606
|
-
args: [{ selector: 'sd-file-explorer-folder-tree', standalone: true, imports: [SdIcon, SdFileExplorerFileIcon], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1511
|
+
args: [{ selector: 'sd-file-explorer-folder-tree', standalone: true, imports: [SdIcon, SdFileExplorerActions, SdFileExplorerFileIcon, SdFileExplorerMenuTrigger], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1512
|
+
class: 'sd-file-explorer-folder-tree',
|
|
1513
|
+
'[class.sd-file-explorer-folder-tree--touch]': 'touch()',
|
|
1514
|
+
'[class.sd-file-explorer-folder-tree--compact]': 'compact()',
|
|
1515
|
+
}, template: `
|
|
607
1516
|
@let _nodes = nodes();
|
|
608
1517
|
@let _active = activeKey();
|
|
1518
|
+
@let _commands = commands();
|
|
1519
|
+
@let _hasCommands = !!_commands?.length;
|
|
1520
|
+
@let _touch = touch();
|
|
1521
|
+
@let _commandSize = _touch ? 'lg' : 'sm';
|
|
1522
|
+
@let _menus = menus();
|
|
1523
|
+
@let _menuOpenId = menuOpenId();
|
|
609
1524
|
<ul class="tree" role="tree" [attr.aria-label]="label()">
|
|
610
1525
|
@for (node of _nodes; track node.key; let i = $index) {
|
|
1526
|
+
@let _nodeCommands = _hasCommands && !!node.item;
|
|
1527
|
+
@let _labelId = treeId + '-label-' + i;
|
|
611
1528
|
<li
|
|
612
1529
|
class="node"
|
|
613
1530
|
role="treeitem"
|
|
1531
|
+
[attr.data-move-target]="node.id ?? ''"
|
|
1532
|
+
[class.move-drop-target]="moveDropTarget() === node.id"
|
|
614
1533
|
[class.node--selected]="node.selected"
|
|
1534
|
+
[class.node--commands]="_nodeCommands"
|
|
1535
|
+
[class.node--error]="node.status === 'error'"
|
|
1536
|
+
[attr.aria-labelledby]="_nodeCommands ? _labelId : null"
|
|
615
1537
|
[attr.aria-level]="node.level"
|
|
616
1538
|
[attr.aria-selected]="node.selected"
|
|
617
1539
|
[attr.aria-expanded]="node.expandable ? node.expanded : null"
|
|
@@ -619,7 +1541,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
619
1541
|
[attr.tabindex]="node.key === _active ? 0 : -1"
|
|
620
1542
|
[attr.data-autoid]="node.autoId"
|
|
621
1543
|
[style.--sd-file-explorer-tree-indent]="(node.level > 1 ? node.level - 2 : 0) * 22 + 'px'"
|
|
622
|
-
(click)="
|
|
1544
|
+
(click)="onClick($event, node)"
|
|
623
1545
|
(keydown)="onKeydown($event, i)"
|
|
624
1546
|
(focus)="focusedKey.set(node.key)">
|
|
625
1547
|
@if (node.level > 1) {
|
|
@@ -639,7 +1561,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
639
1561
|
}
|
|
640
1562
|
}
|
|
641
1563
|
<sd-file-explorer-file-icon [icon]="node.expanded ? 'folder-open' : 'folder-closed'" [size]="28" />
|
|
642
|
-
<span class="label" [title]="node.name">{{ node.name }}</span>
|
|
1564
|
+
<span class="label" [id]="_labelId" [title]="node.name">{{ node.name }}</span>
|
|
643
1565
|
@if (node.status === 'loading') {
|
|
644
1566
|
<span class="spinner" aria-hidden="true"></span>
|
|
645
1567
|
} @else if (node.status === 'error') {
|
|
@@ -653,17 +1575,61 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
653
1575
|
<sd-icon name="refresh" size="16px" />
|
|
654
1576
|
</button>
|
|
655
1577
|
}
|
|
1578
|
+
@if (_nodeCommands) {
|
|
1579
|
+
@if (node.item; as folder) {
|
|
1580
|
+
@if (!_menus) {
|
|
1581
|
+
<sd-file-explorer-actions
|
|
1582
|
+
class="node-actions"
|
|
1583
|
+
source="folderCommands"
|
|
1584
|
+
[actions]="_commands"
|
|
1585
|
+
[context]="folder"
|
|
1586
|
+
[size]="_commandSize"
|
|
1587
|
+
[autoId]="node.autoId ? node.autoId + '-command' : undefined" />
|
|
1588
|
+
} @else {
|
|
1589
|
+
@if (_menus.get(node.key); as menu) {
|
|
1590
|
+
<sd-file-explorer-menu-trigger
|
|
1591
|
+
class="node-menu"
|
|
1592
|
+
[label]="menuLabel(node)"
|
|
1593
|
+
[busy]="menu.busy"
|
|
1594
|
+
[expanded]="folder.id === _menuOpenId"
|
|
1595
|
+
[touch]="_touch"
|
|
1596
|
+
[tabIndex]="node.key === _active ? 0 : -1"
|
|
1597
|
+
[autoId]="node.autoId ? node.autoId + '-commands' : undefined"
|
|
1598
|
+
(activate)="openCommands.emit({ item: folder, trigger: $event })" />
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
656
1603
|
</li>
|
|
657
1604
|
}
|
|
658
1605
|
</ul>
|
|
659
|
-
`, styles: ["
|
|
660
|
-
}], propDecorators: { nodes: [{ type: i0.Input, args: [{ isSignal: true, alias: "nodes", required: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], select: [{ type: i0.Output, args: ["select"] }], toggle: [{ type: i0.Output, args: ["toggle"] }], retry: [{ type: i0.Output, args: ["retry"] }] } });
|
|
1606
|
+
`, 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"] }]
|
|
1607
|
+
}], propDecorators: { moveDropTarget: [{ type: i0.Input, args: [{ isSignal: true, alias: "moveDropTarget", required: false }] }], nodes: [{ type: i0.Input, args: [{ isSignal: true, alias: "nodes", required: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], commands: [{ type: i0.Input, args: [{ isSignal: true, alias: "commands", required: false }] }], touch: [{ type: i0.Input, args: [{ isSignal: true, alias: "touch", required: false }] }], compact: [{ type: i0.Input, args: [{ isSignal: true, alias: "compact", required: false }] }], menuOpenId: [{ type: i0.Input, args: [{ isSignal: true, alias: "menuOpenId", required: false }] }], select: [{ type: i0.Output, args: ["select"] }], toggle: [{ type: i0.Output, args: ["toggle"] }], retry: [{ type: i0.Output, args: ["retry"] }], openCommands: [{ type: i0.Output, args: ["openCommands"] }] } });
|
|
661
1608
|
|
|
1609
|
+
/** Rows and cards ignore clicks and Enter / Space coming from these areas: they belong to a checkbox or a command. */
|
|
1610
|
+
const CONTROL_AREAS = '.cell--select, .card-top, .commands, .sd-file-explorer-menu-trigger';
|
|
662
1611
|
/**
|
|
663
1612
|
* Items of the current folder (or search results) as a list or a grid (internal).
|
|
664
|
-
* Rows and cards are focusable; `Enter` / `Space` activate them like a click.
|
|
1613
|
+
* Rows and cards are focusable; `Enter` / `Space` activate them like a click. Selection checkboxes and commands sit
|
|
1614
|
+
* next to the name and never activate the item.
|
|
1615
|
+
*
|
|
1616
|
+
* In the compact layout a row or card carries one actions trigger instead of its commands and row shortcuts: the
|
|
1617
|
+
* explorer lists them in its command drawer.
|
|
665
1618
|
*/
|
|
666
1619
|
class SdFileExplorerItemList {
|
|
1620
|
+
canMove = input(false, /* @ts-ignore */
|
|
1621
|
+
...(ngDevMode ? [{ debugName: "canMove" }] : /* istanbul ignore next */ []));
|
|
1622
|
+
moveDropTarget = input(/* @ts-ignore */
|
|
1623
|
+
...(ngDevMode ? [undefined, { debugName: "moveDropTarget" }] : /* istanbul ignore next */ []));
|
|
1624
|
+
movePending = input(false, /* @ts-ignore */
|
|
1625
|
+
...(ngDevMode ? [{ debugName: "movePending" }] : /* istanbul ignore next */ []));
|
|
1626
|
+
move = output();
|
|
1627
|
+
columns = input([], /* @ts-ignore */
|
|
1628
|
+
...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
|
|
1629
|
+
columnWidths = computed(() => this.columns()
|
|
1630
|
+
.map(column => column.width())
|
|
1631
|
+
.join(' '), /* @ts-ignore */
|
|
1632
|
+
...(ngDevMode ? [{ debugName: "columnWidths" }] : /* istanbul ignore next */ []));
|
|
667
1633
|
/** Items to render, already formatted. */
|
|
668
1634
|
items = input.required(/* @ts-ignore */
|
|
669
1635
|
...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
@@ -676,47 +1642,145 @@ class SdFileExplorerItemList {
|
|
|
676
1642
|
/** Show share buttons for files. */
|
|
677
1643
|
canShare = input(false, /* @ts-ignore */
|
|
678
1644
|
...(ngDevMode ? [{ debugName: "canShare" }] : /* istanbul ignore next */ []));
|
|
679
|
-
/** Narrow layout: hides the modified column. */
|
|
1645
|
+
/** Narrow layout: hides the modified column and replaces commands and row shortcuts with an actions trigger. */
|
|
680
1646
|
compact = input(false, /* @ts-ignore */
|
|
681
1647
|
...(ngDevMode ? [{ debugName: "compact" }] : /* istanbul ignore next */ []));
|
|
1648
|
+
/** Touch screen: commands always visible, with 48 px touch targets. */
|
|
1649
|
+
touch = input(false, /* @ts-ignore */
|
|
1650
|
+
...(ngDevMode ? [{ debugName: "touch" }] : /* istanbul ignore next */ []));
|
|
682
1651
|
/** Id of the file currently shown in the preview panel. */
|
|
683
1652
|
activeId = input(null, /* @ts-ignore */
|
|
684
1653
|
...(ngDevMode ? [{ debugName: "activeId" }] : /* istanbul ignore next */ []));
|
|
685
1654
|
/** Accessible name of the list. */
|
|
686
1655
|
label = input('', /* @ts-ignore */
|
|
687
1656
|
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
1657
|
+
/** Selection state; `null` hides every checkbox. */
|
|
1658
|
+
selection = input(null, /* @ts-ignore */
|
|
1659
|
+
...(ngDevMode ? [{ debugName: "selection" }] : /* istanbul ignore next */ []));
|
|
1660
|
+
/** Commands of file rows and cards. */
|
|
1661
|
+
fileCommands = input(undefined, /* @ts-ignore */
|
|
1662
|
+
...(ngDevMode ? [{ debugName: "fileCommands" }] : /* istanbul ignore next */ []));
|
|
1663
|
+
/** Commands of folder rows and cards. */
|
|
1664
|
+
folderCommands = input(undefined, /* @ts-ignore */
|
|
1665
|
+
...(ngDevMode ? [{ debugName: "folderCommands" }] : /* istanbul ignore next */ []));
|
|
1666
|
+
/** Id of the item whose command drawer is open from this list. */
|
|
1667
|
+
menuOpenId = input(null, /* @ts-ignore */
|
|
1668
|
+
...(ngDevMode ? [{ debugName: "menuOpenId" }] : /* istanbul ignore next */ []));
|
|
688
1669
|
/** Row / card activated. */
|
|
689
1670
|
activate = output();
|
|
1671
|
+
/** Compact actions trigger pressed. */
|
|
1672
|
+
openCommands = output();
|
|
690
1673
|
/** Download button pressed. */
|
|
691
1674
|
download = output();
|
|
692
1675
|
/** Share button pressed. */
|
|
693
1676
|
share = output();
|
|
694
|
-
/**
|
|
1677
|
+
/** Checkbox of a file toggled. */
|
|
1678
|
+
toggleSelect = output();
|
|
1679
|
+
/** Select-all checkbox toggled. */
|
|
1680
|
+
toggleSelectAll = output();
|
|
1681
|
+
/**
|
|
1682
|
+
* Width of the row action column: one 32 px icon button per row shortcut on desktop; the actions trigger (32 px,
|
|
1683
|
+
* 48 px on touch) in compact.
|
|
1684
|
+
*/
|
|
695
1685
|
actionsWidth = computed(() => {
|
|
1686
|
+
if (this.compact())
|
|
1687
|
+
return this.menuColumn() ? `${(this.touch() ? 48 : 32) + 4}px` : null;
|
|
696
1688
|
const count = (this.canDownload() ? 1 : 0) + (this.canShare() ? 1 : 0);
|
|
697
1689
|
if (!count)
|
|
698
1690
|
return null;
|
|
699
|
-
return `${count * 32 + (count - 1) * 2 +
|
|
1691
|
+
return `${count * 32 + (count - 1) * 2 + 12}px`;
|
|
700
1692
|
}, /* @ts-ignore */
|
|
701
1693
|
...(ngDevMode ? [{ debugName: "actionsWidth" }] : /* istanbul ignore next */ []));
|
|
1694
|
+
hasCommands = computed(() => !!(this.fileCommands()?.length || this.folderCommands()?.length), /* @ts-ignore */
|
|
1695
|
+
...(ngDevMode ? [{ debugName: "hasCommands" }] : /* istanbul ignore next */ []));
|
|
1696
|
+
rows = computed(() => {
|
|
1697
|
+
const selection = this.selection();
|
|
1698
|
+
const fileCommands = this.fileCommands();
|
|
1699
|
+
const folderCommands = this.folderCommands();
|
|
1700
|
+
const compact = this.compact();
|
|
1701
|
+
// why: only list rows carry the download / share shortcuts — grid cards never did — so only they bring them into
|
|
1702
|
+
// the drawer. The explorer turns them off as soon as fileCommands is declared.
|
|
1703
|
+
const shortcuts = this.view() === 'list' && (this.canDownload() || this.canShare());
|
|
1704
|
+
return this.items().map(view => {
|
|
1705
|
+
const isFile = view.item.kind === 'file';
|
|
1706
|
+
const commands = isFile ? fileCommands : folderCommands;
|
|
1707
|
+
const source = isFile ? 'fileCommands' : 'folderCommands';
|
|
1708
|
+
return {
|
|
1709
|
+
view,
|
|
1710
|
+
selectable: !!selection && isFile,
|
|
1711
|
+
selected: !!selection?.selectedIds.has(view.item.id),
|
|
1712
|
+
selectDisabled: !!selection?.disabledIds.has(view.item.id),
|
|
1713
|
+
commands: !compact && commands?.length ? commands : null,
|
|
1714
|
+
source,
|
|
1715
|
+
menu: compact ? this.#menu(commands, view.item, source, isFile && shortcuts) : null,
|
|
1716
|
+
};
|
|
1717
|
+
});
|
|
1718
|
+
}, /* @ts-ignore */
|
|
1719
|
+
...(ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []));
|
|
1720
|
+
/** Compact list with at least one actions trigger: the action column holds them. */
|
|
1721
|
+
menuColumn = computed(() => this.rows().some(row => row.menu), /* @ts-ignore */
|
|
1722
|
+
...(ngDevMode ? [{ debugName: "menuColumn" }] : /* istanbul ignore next */ []));
|
|
1723
|
+
/** Trigger state of one item: `null` when its drawer would be empty. Same filtering as the drawer and the buttons. */
|
|
1724
|
+
#menu(commands, item, source, shortcuts) {
|
|
1725
|
+
const resolved = sdFileExplorerResolveActions(commands, item, SD_FILE_EXPLORER_COMMAND_DEFAULTS, source);
|
|
1726
|
+
return resolved.length || shortcuts ? { busy: sdFileExplorerActionsBusy(resolved) } : null;
|
|
1727
|
+
}
|
|
1728
|
+
onClick(event, view) {
|
|
1729
|
+
if (this.#fromControl(event))
|
|
1730
|
+
return;
|
|
1731
|
+
this.activate.emit(view);
|
|
1732
|
+
}
|
|
702
1733
|
onKeydown(event, view) {
|
|
703
1734
|
if (event.key !== 'Enter' && event.key !== ' ')
|
|
704
1735
|
return;
|
|
1736
|
+
if (this.#fromControl(event))
|
|
1737
|
+
return;
|
|
705
1738
|
event.preventDefault();
|
|
706
1739
|
this.activate.emit(view);
|
|
707
1740
|
}
|
|
1741
|
+
/** The event started on a checkbox or a command (or the space around it) inside the row / card. */
|
|
1742
|
+
#fromControl(event) {
|
|
1743
|
+
const target = event.target instanceof Element ? event.target : null;
|
|
1744
|
+
const area = target?.closest(CONTROL_AREAS);
|
|
1745
|
+
return !!area && event.currentTarget instanceof Element && event.currentTarget.contains(area);
|
|
1746
|
+
}
|
|
708
1747
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdFileExplorerItemList, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
709
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdFileExplorerItemList, isStandalone: true, selector: "sd-file-explorer-item-list", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: true, transformFunction: null }, view: { classPropertyName: "view", publicName: "view", isSignal: true, isRequired: false, transformFunction: null }, canDownload: { classPropertyName: "canDownload", publicName: "canDownload", isSignal: true, isRequired: false, transformFunction: null }, canShare: { classPropertyName: "canShare", publicName: "canShare", isSignal: true, isRequired: false, transformFunction: null }, compact: { classPropertyName: "compact", publicName: "compact", isSignal: true, isRequired: false, transformFunction: null }, activeId: { classPropertyName: "activeId", publicName: "activeId", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { activate: "activate", download: "download", share: "share" }, host: { properties: { "class.sd-file-explorer-item-list--compact": "compact()", "style.--sd-fe-actions-width": "actionsWidth()" }, classAttribute: "sd-file-explorer-item-list" }, ngImport: i0, template: `
|
|
710
|
-
@let
|
|
1748
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdFileExplorerItemList, isStandalone: true, selector: "sd-file-explorer-item-list", inputs: { canMove: { classPropertyName: "canMove", publicName: "canMove", isSignal: true, isRequired: false, transformFunction: null }, moveDropTarget: { classPropertyName: "moveDropTarget", publicName: "moveDropTarget", isSignal: true, isRequired: false, transformFunction: null }, movePending: { classPropertyName: "movePending", publicName: "movePending", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: true, transformFunction: null }, view: { classPropertyName: "view", publicName: "view", isSignal: true, isRequired: false, transformFunction: null }, canDownload: { classPropertyName: "canDownload", publicName: "canDownload", isSignal: true, isRequired: false, transformFunction: null }, canShare: { classPropertyName: "canShare", publicName: "canShare", isSignal: true, isRequired: false, transformFunction: null }, compact: { classPropertyName: "compact", publicName: "compact", isSignal: true, isRequired: false, transformFunction: null }, touch: { classPropertyName: "touch", publicName: "touch", isSignal: true, isRequired: false, transformFunction: null }, activeId: { classPropertyName: "activeId", publicName: "activeId", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, selection: { classPropertyName: "selection", publicName: "selection", isSignal: true, isRequired: false, transformFunction: null }, fileCommands: { classPropertyName: "fileCommands", publicName: "fileCommands", isSignal: true, isRequired: false, transformFunction: null }, folderCommands: { classPropertyName: "folderCommands", publicName: "folderCommands", isSignal: true, isRequired: false, transformFunction: null }, menuOpenId: { classPropertyName: "menuOpenId", publicName: "menuOpenId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { move: "move", activate: "activate", openCommands: "openCommands", download: "download", share: "share", toggleSelect: "toggleSelect", toggleSelectAll: "toggleSelectAll" }, host: { properties: { "class.sd-file-explorer-item-list--compact": "compact()", "class.sd-file-explorer-item-list--touch": "touch()", "style.--sd-fe-actions-width": "actionsWidth()" }, classAttribute: "sd-file-explorer-item-list" }, ngImport: i0, template: `
|
|
1749
|
+
@let _rows = rows();
|
|
711
1750
|
@let _canDownload = canDownload();
|
|
712
1751
|
@let _canShare = canShare();
|
|
713
|
-
@let _hasActions = _canDownload || _canShare;
|
|
714
1752
|
@let _compact = compact();
|
|
1753
|
+
@let _touch = touch();
|
|
1754
|
+
@let _actionColumn = _compact ? menuColumn() : _canDownload || _canShare;
|
|
715
1755
|
@let _activeId = activeId();
|
|
1756
|
+
@let _menuOpenId = menuOpenId();
|
|
1757
|
+
@let _selection = selection();
|
|
1758
|
+
@let _commandSize = _touch && !_compact ? 'lg' : 'sm';
|
|
716
1759
|
@if (view() === 'list') {
|
|
717
|
-
<div
|
|
1760
|
+
<div
|
|
1761
|
+
class="list"
|
|
1762
|
+
role="table"
|
|
1763
|
+
[class.list--selectable]="!!_selection"
|
|
1764
|
+
[class.list--custom]="columns().length > 0"
|
|
1765
|
+
[style.--sd-fe-custom-cols]="columnWidths()"
|
|
1766
|
+
[attr.aria-label]="label()"
|
|
1767
|
+
[attr.aria-colcount]="(_selection ? 1 : 0) + (_compact ? 2 : 3) + columns().length + (_actionColumn ? 1 : 0)">
|
|
718
1768
|
<div class="list-head" role="rowgroup">
|
|
719
1769
|
<div class="row row--head" role="row">
|
|
1770
|
+
@if (_selection) {
|
|
1771
|
+
<span class="cell cell--select" role="columnheader">
|
|
1772
|
+
<mat-checkbox
|
|
1773
|
+
class="select-all"
|
|
1774
|
+
color="primary"
|
|
1775
|
+
[checked]="_selection.state === 'all'"
|
|
1776
|
+
[indeterminate]="_selection.state === 'some'"
|
|
1777
|
+
[disabled]="!_selection.eligibleCount"
|
|
1778
|
+
[aria-label]="_selection.allLabel"
|
|
1779
|
+
[matTooltip]="_selection.allLabel"
|
|
1780
|
+
[attr.data-autoid]="_selection.autoId ?? null"
|
|
1781
|
+
(change)="toggleSelectAll.emit()" />
|
|
1782
|
+
</span>
|
|
1783
|
+
}
|
|
720
1784
|
<span class="cell cell--name" role="columnheader">{{ 'core.component.file-explorer.column.name' | sdTranslate }}</span>
|
|
721
1785
|
@if (!_compact) {
|
|
722
1786
|
<span class="cell cell--modified" role="columnheader">{{
|
|
@@ -724,37 +1788,105 @@ class SdFileExplorerItemList {
|
|
|
724
1788
|
}}</span>
|
|
725
1789
|
}
|
|
726
1790
|
<span class="cell cell--size" role="columnheader">{{ 'core.component.file-explorer.column.size' | sdTranslate }}</span>
|
|
727
|
-
@
|
|
728
|
-
<span class="cell cell--
|
|
1791
|
+
@for (column of columns(); track column.id(); let index = $index) {
|
|
1792
|
+
<span class="cell cell--custom" role="columnheader" [style.grid-column]="5 + index">{{ column.title() }}</span>
|
|
1793
|
+
}
|
|
1794
|
+
@if (_actionColumn) {
|
|
1795
|
+
<span class="cell cell--action" role="columnheader" [style.grid-column]="5 + columns().length"></span>
|
|
729
1796
|
}
|
|
730
1797
|
</div>
|
|
731
1798
|
</div>
|
|
732
1799
|
<div role="rowgroup">
|
|
733
|
-
@for (
|
|
1800
|
+
@for (row of _rows; track row.view.item.id; let rowIndex = $index) {
|
|
1801
|
+
@let view = row.view;
|
|
734
1802
|
<div
|
|
735
1803
|
class="row"
|
|
736
1804
|
role="row"
|
|
737
1805
|
tabindex="0"
|
|
738
1806
|
[class.row--active]="view.item.id === _activeId"
|
|
1807
|
+
[class.row--selected]="row.selected"
|
|
1808
|
+
[class.row--commands]="!!row.commands"
|
|
1809
|
+
[class.row--movable]="canMove() && view.item.kind === 'file'"
|
|
739
1810
|
[attr.data-item-id]="view.item.id"
|
|
1811
|
+
[attr.data-move-target]="view.item.kind === 'folder' ? view.item.id : null"
|
|
1812
|
+
[class.move-drop-target]="view.item.kind === 'folder' && moveDropTarget() === view.item.id"
|
|
740
1813
|
[attr.data-autoid]="view.autoId"
|
|
741
|
-
(click)="
|
|
1814
|
+
(click)="onClick($event, view)"
|
|
742
1815
|
(keydown)="onKeydown($event, view)">
|
|
1816
|
+
@if (_selection) {
|
|
1817
|
+
<span class="cell cell--select" role="cell">
|
|
1818
|
+
@if (row.selectable) {
|
|
1819
|
+
<mat-checkbox
|
|
1820
|
+
class="select"
|
|
1821
|
+
color="primary"
|
|
1822
|
+
[checked]="row.selected"
|
|
1823
|
+
[disabled]="row.selectDisabled"
|
|
1824
|
+
[aria-label]="view.selectLabel"
|
|
1825
|
+
[attr.data-autoid]="view.autoId ? view.autoId + '-select' : null"
|
|
1826
|
+
(change)="toggleSelect.emit(view.item)" />
|
|
1827
|
+
}
|
|
1828
|
+
</span>
|
|
1829
|
+
}
|
|
743
1830
|
<span class="cell cell--name" role="cell">
|
|
744
1831
|
<sd-file-explorer-file-icon [icon]="view.icon" [size]="32" />
|
|
745
|
-
<span class="name" [title]="view.item.name">{{ view.item.name }}</span>
|
|
1832
|
+
<span class="name" [draggable]="canMove() && view.item.kind === 'file'" [title]="view.item.name">{{ view.item.name }}</span>
|
|
1833
|
+
@if (view.item.kind === 'folder' && moveDropTarget() === view.item.id) {
|
|
1834
|
+
<span class="move-drop-label">{{ 'core.component.file-explorer.move.confirm' | sdTranslate }}</span>
|
|
1835
|
+
}
|
|
1836
|
+
@if (canMove() && view.item.kind === 'file') {
|
|
1837
|
+
<sd-button
|
|
1838
|
+
htmlType="button"
|
|
1839
|
+
class="move-file-button commands"
|
|
1840
|
+
type="text"
|
|
1841
|
+
color="secondary"
|
|
1842
|
+
[size]="_compact ? 'sm' : 'md'"
|
|
1843
|
+
[disabled]="movePending()"
|
|
1844
|
+
[title]="'core.component.file-explorer.move.to' | sdTranslate"
|
|
1845
|
+
[tooltip]="('core.component.file-explorer.move.to' | sdTranslate) + ': ' + view.item.name"
|
|
1846
|
+
(click)="$event.stopPropagation(); move.emit(view.item)"
|
|
1847
|
+
(keydown)="$event.stopPropagation()" />
|
|
1848
|
+
}
|
|
1849
|
+
@if (row.commands) {
|
|
1850
|
+
<sd-file-explorer-actions
|
|
1851
|
+
class="commands"
|
|
1852
|
+
[actions]="row.commands"
|
|
1853
|
+
[context]="view.item"
|
|
1854
|
+
[size]="_commandSize"
|
|
1855
|
+
[source]="row.source"
|
|
1856
|
+
[autoId]="view.autoId ? view.autoId + '-command' : undefined" />
|
|
1857
|
+
}
|
|
746
1858
|
</span>
|
|
747
1859
|
@if (!_compact) {
|
|
748
1860
|
<span class="cell cell--modified" role="cell" [title]="view.modifiedTitle">{{ view.modifiedLabel || '—' }}</span>
|
|
749
1861
|
}
|
|
750
1862
|
<span class="cell cell--size" role="cell">{{ view.sizeLabel || '—' }}</span>
|
|
751
|
-
@
|
|
1863
|
+
@for (column of columns(); track column.id(); let index = $index) {
|
|
1864
|
+
<span class="cell cell--custom" role="cell" [style.grid-column]="5 + index">
|
|
1865
|
+
<ng-container
|
|
1866
|
+
[ngTemplateOutlet]="column.template"
|
|
1867
|
+
[ngTemplateOutletContext]="{ $implicit: view.item, item: view.item, data: view.item.data, index: rowIndex }" />
|
|
1868
|
+
</span>
|
|
1869
|
+
}
|
|
1870
|
+
@if (_actionColumn) {
|
|
752
1871
|
<!-- why: sd-button already keeps its click from reaching the row; Enter/Space are stopped here so the key does not open the file too. -->
|
|
753
|
-
<span class="cell cell--action" role="cell">
|
|
754
|
-
@if (
|
|
1872
|
+
<span class="cell cell--action" role="cell" [style.grid-column]="5 + columns().length">
|
|
1873
|
+
@if (_compact) {
|
|
1874
|
+
@if (row.menu; as menu) {
|
|
1875
|
+
<sd-file-explorer-menu-trigger
|
|
1876
|
+
class="row-menu"
|
|
1877
|
+
[label]="view.actionsLabel"
|
|
1878
|
+
[busy]="menu.busy"
|
|
1879
|
+
[expanded]="view.item.id === _menuOpenId"
|
|
1880
|
+
[touch]="_touch"
|
|
1881
|
+
[autoId]="view.autoId ? view.autoId + '-commands' : undefined"
|
|
1882
|
+
(activate)="openCommands.emit({ item: view.item, trigger: $event })" />
|
|
1883
|
+
}
|
|
1884
|
+
} @else if (view.item.kind === 'file') {
|
|
755
1885
|
@if (_canShare) {
|
|
756
1886
|
<sd-button
|
|
757
1887
|
class="row-action row-share"
|
|
1888
|
+
[disabled]="view.shareDisabled ?? false"
|
|
1889
|
+
[attr.aria-description]="view.shareDisabled ? view.unavailableReason : null"
|
|
758
1890
|
type="text"
|
|
759
1891
|
color="secondary"
|
|
760
1892
|
size="sm"
|
|
@@ -768,6 +1900,8 @@ class SdFileExplorerItemList {
|
|
|
768
1900
|
@if (_canDownload) {
|
|
769
1901
|
<sd-button
|
|
770
1902
|
class="row-action row-download"
|
|
1903
|
+
[disabled]="view.downloadDisabled ?? false"
|
|
1904
|
+
[attr.aria-description]="view.downloadDisabled ? view.unavailableReason : null"
|
|
771
1905
|
type="text"
|
|
772
1906
|
color="secondary"
|
|
773
1907
|
size="sm"
|
|
@@ -786,17 +1920,69 @@ class SdFileExplorerItemList {
|
|
|
786
1920
|
</div>
|
|
787
1921
|
</div>
|
|
788
1922
|
} @else {
|
|
1923
|
+
@let _cardTop = !!_selection || hasCommands();
|
|
1924
|
+
@if (_selection) {
|
|
1925
|
+
<div class="grid-head">
|
|
1926
|
+
<mat-checkbox
|
|
1927
|
+
class="select-all"
|
|
1928
|
+
color="primary"
|
|
1929
|
+
[checked]="_selection.state === 'all'"
|
|
1930
|
+
[indeterminate]="_selection.state === 'some'"
|
|
1931
|
+
[disabled]="!_selection.eligibleCount"
|
|
1932
|
+
[aria-label]="_selection.allLabel"
|
|
1933
|
+
[matTooltip]="_selection.allLabel"
|
|
1934
|
+
[attr.data-autoid]="_selection.autoId ?? null"
|
|
1935
|
+
(change)="toggleSelectAll.emit()" />
|
|
1936
|
+
</div>
|
|
1937
|
+
}
|
|
789
1938
|
<ul class="grid" [attr.aria-label]="label()">
|
|
790
|
-
@for (
|
|
1939
|
+
@for (row of _rows; track row.view.item.id) {
|
|
1940
|
+
@let view = row.view;
|
|
791
1941
|
<li
|
|
792
1942
|
class="card"
|
|
793
1943
|
tabindex="0"
|
|
794
1944
|
[class.card--active]="view.item.id === _activeId"
|
|
1945
|
+
[class.card--selected]="row.selected"
|
|
795
1946
|
[attr.data-item-id]="view.item.id"
|
|
1947
|
+
[attr.data-move-target]="view.item.kind === 'folder' ? view.item.id : null"
|
|
1948
|
+
[class.move-drop-target]="view.item.kind === 'folder' && moveDropTarget() === view.item.id"
|
|
796
1949
|
[attr.data-autoid]="view.autoId"
|
|
797
1950
|
[attr.aria-label]="view.item.name + ', ' + view.typeLabel"
|
|
798
|
-
(click)="
|
|
1951
|
+
(click)="onClick($event, view)"
|
|
799
1952
|
(keydown)="onKeydown($event, view)">
|
|
1953
|
+
@if (_cardTop) {
|
|
1954
|
+
<span class="card-top">
|
|
1955
|
+
@if (row.selectable) {
|
|
1956
|
+
<mat-checkbox
|
|
1957
|
+
class="select"
|
|
1958
|
+
color="primary"
|
|
1959
|
+
[checked]="row.selected"
|
|
1960
|
+
[disabled]="row.selectDisabled"
|
|
1961
|
+
[aria-label]="view.selectLabel"
|
|
1962
|
+
[attr.data-autoid]="view.autoId ? view.autoId + '-select' : null"
|
|
1963
|
+
(change)="toggleSelect.emit(view.item)" />
|
|
1964
|
+
}
|
|
1965
|
+
@if (row.commands) {
|
|
1966
|
+
<sd-file-explorer-actions
|
|
1967
|
+
class="commands"
|
|
1968
|
+
[actions]="row.commands"
|
|
1969
|
+
[context]="view.item"
|
|
1970
|
+
[size]="_commandSize"
|
|
1971
|
+
[source]="row.source"
|
|
1972
|
+
[autoId]="view.autoId ? view.autoId + '-command' : undefined" />
|
|
1973
|
+
}
|
|
1974
|
+
@if (row.menu; as menu) {
|
|
1975
|
+
<sd-file-explorer-menu-trigger
|
|
1976
|
+
class="card-menu"
|
|
1977
|
+
[label]="view.actionsLabel"
|
|
1978
|
+
[busy]="menu.busy"
|
|
1979
|
+
[expanded]="view.item.id === _menuOpenId"
|
|
1980
|
+
[touch]="_touch"
|
|
1981
|
+
[autoId]="view.autoId ? view.autoId + '-commands' : undefined"
|
|
1982
|
+
(activate)="openCommands.emit({ item: view.item, trigger: $event })" />
|
|
1983
|
+
}
|
|
1984
|
+
</span>
|
|
1985
|
+
}
|
|
800
1986
|
<span class="thumb">
|
|
801
1987
|
@if (view.item.thumbnailUrl) {
|
|
802
1988
|
<img [src]="view.item.thumbnailUrl" alt="" loading="lazy" />
|
|
@@ -804,30 +1990,79 @@ class SdFileExplorerItemList {
|
|
|
804
1990
|
<sd-file-explorer-file-icon [icon]="view.icon" [size]="48" />
|
|
805
1991
|
}
|
|
806
1992
|
</span>
|
|
807
|
-
<span class="card-name" [
|
|
1993
|
+
<span class="card-name" [draggable]="canMove() && view.item.kind === 'file'" [title]="view.item.name">{{
|
|
1994
|
+
view.item.name
|
|
1995
|
+
}}</span>
|
|
1996
|
+
@if (canMove() && view.item.kind === 'file') {
|
|
1997
|
+
<sd-button
|
|
1998
|
+
htmlType="button"
|
|
1999
|
+
class="move-file-button commands"
|
|
2000
|
+
type="text"
|
|
2001
|
+
color="secondary"
|
|
2002
|
+
[size]="_compact ? 'sm' : 'md'"
|
|
2003
|
+
[disabled]="movePending()"
|
|
2004
|
+
[title]="'core.component.file-explorer.move.to' | sdTranslate"
|
|
2005
|
+
(click)="$event.stopPropagation(); move.emit(view.item)"
|
|
2006
|
+
(keydown)="$event.stopPropagation()" />
|
|
2007
|
+
}
|
|
808
2008
|
</li>
|
|
809
2009
|
}
|
|
810
2010
|
</ul>
|
|
811
2011
|
}
|
|
812
|
-
`, isInline: true, styles: [":host{display:block}.list{width:100%}.row{display:grid;grid-template-columns:minmax(0,1fr) 128px 88px var(--sd-fe-actions-width,
|
|
2012
|
+
`, 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 });
|
|
813
2013
|
}
|
|
814
2014
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdFileExplorerItemList, decorators: [{
|
|
815
2015
|
type: Component,
|
|
816
|
-
args: [{ selector: 'sd-file-explorer-item-list', standalone: true, imports: [
|
|
2016
|
+
args: [{ selector: 'sd-file-explorer-item-list', standalone: true, imports: [
|
|
2017
|
+
NgTemplateOutlet,
|
|
2018
|
+
MatCheckbox,
|
|
2019
|
+
MatTooltip,
|
|
2020
|
+
SdButton,
|
|
2021
|
+
SdTranslatePipe,
|
|
2022
|
+
SdFileExplorerActions,
|
|
2023
|
+
SdFileExplorerFileIcon,
|
|
2024
|
+
SdFileExplorerMenuTrigger,
|
|
2025
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
817
2026
|
class: 'sd-file-explorer-item-list',
|
|
818
2027
|
'[class.sd-file-explorer-item-list--compact]': 'compact()',
|
|
2028
|
+
'[class.sd-file-explorer-item-list--touch]': 'touch()',
|
|
819
2029
|
'[style.--sd-fe-actions-width]': 'actionsWidth()',
|
|
820
2030
|
}, template: `
|
|
821
|
-
@let
|
|
2031
|
+
@let _rows = rows();
|
|
822
2032
|
@let _canDownload = canDownload();
|
|
823
2033
|
@let _canShare = canShare();
|
|
824
|
-
@let _hasActions = _canDownload || _canShare;
|
|
825
2034
|
@let _compact = compact();
|
|
2035
|
+
@let _touch = touch();
|
|
2036
|
+
@let _actionColumn = _compact ? menuColumn() : _canDownload || _canShare;
|
|
826
2037
|
@let _activeId = activeId();
|
|
2038
|
+
@let _menuOpenId = menuOpenId();
|
|
2039
|
+
@let _selection = selection();
|
|
2040
|
+
@let _commandSize = _touch && !_compact ? 'lg' : 'sm';
|
|
827
2041
|
@if (view() === 'list') {
|
|
828
|
-
<div
|
|
2042
|
+
<div
|
|
2043
|
+
class="list"
|
|
2044
|
+
role="table"
|
|
2045
|
+
[class.list--selectable]="!!_selection"
|
|
2046
|
+
[class.list--custom]="columns().length > 0"
|
|
2047
|
+
[style.--sd-fe-custom-cols]="columnWidths()"
|
|
2048
|
+
[attr.aria-label]="label()"
|
|
2049
|
+
[attr.aria-colcount]="(_selection ? 1 : 0) + (_compact ? 2 : 3) + columns().length + (_actionColumn ? 1 : 0)">
|
|
829
2050
|
<div class="list-head" role="rowgroup">
|
|
830
2051
|
<div class="row row--head" role="row">
|
|
2052
|
+
@if (_selection) {
|
|
2053
|
+
<span class="cell cell--select" role="columnheader">
|
|
2054
|
+
<mat-checkbox
|
|
2055
|
+
class="select-all"
|
|
2056
|
+
color="primary"
|
|
2057
|
+
[checked]="_selection.state === 'all'"
|
|
2058
|
+
[indeterminate]="_selection.state === 'some'"
|
|
2059
|
+
[disabled]="!_selection.eligibleCount"
|
|
2060
|
+
[aria-label]="_selection.allLabel"
|
|
2061
|
+
[matTooltip]="_selection.allLabel"
|
|
2062
|
+
[attr.data-autoid]="_selection.autoId ?? null"
|
|
2063
|
+
(change)="toggleSelectAll.emit()" />
|
|
2064
|
+
</span>
|
|
2065
|
+
}
|
|
831
2066
|
<span class="cell cell--name" role="columnheader">{{ 'core.component.file-explorer.column.name' | sdTranslate }}</span>
|
|
832
2067
|
@if (!_compact) {
|
|
833
2068
|
<span class="cell cell--modified" role="columnheader">{{
|
|
@@ -835,37 +2070,105 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
835
2070
|
}}</span>
|
|
836
2071
|
}
|
|
837
2072
|
<span class="cell cell--size" role="columnheader">{{ 'core.component.file-explorer.column.size' | sdTranslate }}</span>
|
|
838
|
-
@
|
|
839
|
-
<span class="cell cell--
|
|
2073
|
+
@for (column of columns(); track column.id(); let index = $index) {
|
|
2074
|
+
<span class="cell cell--custom" role="columnheader" [style.grid-column]="5 + index">{{ column.title() }}</span>
|
|
2075
|
+
}
|
|
2076
|
+
@if (_actionColumn) {
|
|
2077
|
+
<span class="cell cell--action" role="columnheader" [style.grid-column]="5 + columns().length"></span>
|
|
840
2078
|
}
|
|
841
2079
|
</div>
|
|
842
2080
|
</div>
|
|
843
2081
|
<div role="rowgroup">
|
|
844
|
-
@for (
|
|
2082
|
+
@for (row of _rows; track row.view.item.id; let rowIndex = $index) {
|
|
2083
|
+
@let view = row.view;
|
|
845
2084
|
<div
|
|
846
2085
|
class="row"
|
|
847
2086
|
role="row"
|
|
848
2087
|
tabindex="0"
|
|
849
2088
|
[class.row--active]="view.item.id === _activeId"
|
|
2089
|
+
[class.row--selected]="row.selected"
|
|
2090
|
+
[class.row--commands]="!!row.commands"
|
|
2091
|
+
[class.row--movable]="canMove() && view.item.kind === 'file'"
|
|
850
2092
|
[attr.data-item-id]="view.item.id"
|
|
2093
|
+
[attr.data-move-target]="view.item.kind === 'folder' ? view.item.id : null"
|
|
2094
|
+
[class.move-drop-target]="view.item.kind === 'folder' && moveDropTarget() === view.item.id"
|
|
851
2095
|
[attr.data-autoid]="view.autoId"
|
|
852
|
-
(click)="
|
|
2096
|
+
(click)="onClick($event, view)"
|
|
853
2097
|
(keydown)="onKeydown($event, view)">
|
|
2098
|
+
@if (_selection) {
|
|
2099
|
+
<span class="cell cell--select" role="cell">
|
|
2100
|
+
@if (row.selectable) {
|
|
2101
|
+
<mat-checkbox
|
|
2102
|
+
class="select"
|
|
2103
|
+
color="primary"
|
|
2104
|
+
[checked]="row.selected"
|
|
2105
|
+
[disabled]="row.selectDisabled"
|
|
2106
|
+
[aria-label]="view.selectLabel"
|
|
2107
|
+
[attr.data-autoid]="view.autoId ? view.autoId + '-select' : null"
|
|
2108
|
+
(change)="toggleSelect.emit(view.item)" />
|
|
2109
|
+
}
|
|
2110
|
+
</span>
|
|
2111
|
+
}
|
|
854
2112
|
<span class="cell cell--name" role="cell">
|
|
855
2113
|
<sd-file-explorer-file-icon [icon]="view.icon" [size]="32" />
|
|
856
|
-
<span class="name" [title]="view.item.name">{{ view.item.name }}</span>
|
|
2114
|
+
<span class="name" [draggable]="canMove() && view.item.kind === 'file'" [title]="view.item.name">{{ view.item.name }}</span>
|
|
2115
|
+
@if (view.item.kind === 'folder' && moveDropTarget() === view.item.id) {
|
|
2116
|
+
<span class="move-drop-label">{{ 'core.component.file-explorer.move.confirm' | sdTranslate }}</span>
|
|
2117
|
+
}
|
|
2118
|
+
@if (canMove() && view.item.kind === 'file') {
|
|
2119
|
+
<sd-button
|
|
2120
|
+
htmlType="button"
|
|
2121
|
+
class="move-file-button commands"
|
|
2122
|
+
type="text"
|
|
2123
|
+
color="secondary"
|
|
2124
|
+
[size]="_compact ? 'sm' : 'md'"
|
|
2125
|
+
[disabled]="movePending()"
|
|
2126
|
+
[title]="'core.component.file-explorer.move.to' | sdTranslate"
|
|
2127
|
+
[tooltip]="('core.component.file-explorer.move.to' | sdTranslate) + ': ' + view.item.name"
|
|
2128
|
+
(click)="$event.stopPropagation(); move.emit(view.item)"
|
|
2129
|
+
(keydown)="$event.stopPropagation()" />
|
|
2130
|
+
}
|
|
2131
|
+
@if (row.commands) {
|
|
2132
|
+
<sd-file-explorer-actions
|
|
2133
|
+
class="commands"
|
|
2134
|
+
[actions]="row.commands"
|
|
2135
|
+
[context]="view.item"
|
|
2136
|
+
[size]="_commandSize"
|
|
2137
|
+
[source]="row.source"
|
|
2138
|
+
[autoId]="view.autoId ? view.autoId + '-command' : undefined" />
|
|
2139
|
+
}
|
|
857
2140
|
</span>
|
|
858
2141
|
@if (!_compact) {
|
|
859
2142
|
<span class="cell cell--modified" role="cell" [title]="view.modifiedTitle">{{ view.modifiedLabel || '—' }}</span>
|
|
860
2143
|
}
|
|
861
2144
|
<span class="cell cell--size" role="cell">{{ view.sizeLabel || '—' }}</span>
|
|
862
|
-
@
|
|
2145
|
+
@for (column of columns(); track column.id(); let index = $index) {
|
|
2146
|
+
<span class="cell cell--custom" role="cell" [style.grid-column]="5 + index">
|
|
2147
|
+
<ng-container
|
|
2148
|
+
[ngTemplateOutlet]="column.template"
|
|
2149
|
+
[ngTemplateOutletContext]="{ $implicit: view.item, item: view.item, data: view.item.data, index: rowIndex }" />
|
|
2150
|
+
</span>
|
|
2151
|
+
}
|
|
2152
|
+
@if (_actionColumn) {
|
|
863
2153
|
<!-- why: sd-button already keeps its click from reaching the row; Enter/Space are stopped here so the key does not open the file too. -->
|
|
864
|
-
<span class="cell cell--action" role="cell">
|
|
865
|
-
@if (
|
|
2154
|
+
<span class="cell cell--action" role="cell" [style.grid-column]="5 + columns().length">
|
|
2155
|
+
@if (_compact) {
|
|
2156
|
+
@if (row.menu; as menu) {
|
|
2157
|
+
<sd-file-explorer-menu-trigger
|
|
2158
|
+
class="row-menu"
|
|
2159
|
+
[label]="view.actionsLabel"
|
|
2160
|
+
[busy]="menu.busy"
|
|
2161
|
+
[expanded]="view.item.id === _menuOpenId"
|
|
2162
|
+
[touch]="_touch"
|
|
2163
|
+
[autoId]="view.autoId ? view.autoId + '-commands' : undefined"
|
|
2164
|
+
(activate)="openCommands.emit({ item: view.item, trigger: $event })" />
|
|
2165
|
+
}
|
|
2166
|
+
} @else if (view.item.kind === 'file') {
|
|
866
2167
|
@if (_canShare) {
|
|
867
2168
|
<sd-button
|
|
868
2169
|
class="row-action row-share"
|
|
2170
|
+
[disabled]="view.shareDisabled ?? false"
|
|
2171
|
+
[attr.aria-description]="view.shareDisabled ? view.unavailableReason : null"
|
|
869
2172
|
type="text"
|
|
870
2173
|
color="secondary"
|
|
871
2174
|
size="sm"
|
|
@@ -879,6 +2182,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
879
2182
|
@if (_canDownload) {
|
|
880
2183
|
<sd-button
|
|
881
2184
|
class="row-action row-download"
|
|
2185
|
+
[disabled]="view.downloadDisabled ?? false"
|
|
2186
|
+
[attr.aria-description]="view.downloadDisabled ? view.unavailableReason : null"
|
|
882
2187
|
type="text"
|
|
883
2188
|
color="secondary"
|
|
884
2189
|
size="sm"
|
|
@@ -897,17 +2202,69 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
897
2202
|
</div>
|
|
898
2203
|
</div>
|
|
899
2204
|
} @else {
|
|
2205
|
+
@let _cardTop = !!_selection || hasCommands();
|
|
2206
|
+
@if (_selection) {
|
|
2207
|
+
<div class="grid-head">
|
|
2208
|
+
<mat-checkbox
|
|
2209
|
+
class="select-all"
|
|
2210
|
+
color="primary"
|
|
2211
|
+
[checked]="_selection.state === 'all'"
|
|
2212
|
+
[indeterminate]="_selection.state === 'some'"
|
|
2213
|
+
[disabled]="!_selection.eligibleCount"
|
|
2214
|
+
[aria-label]="_selection.allLabel"
|
|
2215
|
+
[matTooltip]="_selection.allLabel"
|
|
2216
|
+
[attr.data-autoid]="_selection.autoId ?? null"
|
|
2217
|
+
(change)="toggleSelectAll.emit()" />
|
|
2218
|
+
</div>
|
|
2219
|
+
}
|
|
900
2220
|
<ul class="grid" [attr.aria-label]="label()">
|
|
901
|
-
@for (
|
|
2221
|
+
@for (row of _rows; track row.view.item.id) {
|
|
2222
|
+
@let view = row.view;
|
|
902
2223
|
<li
|
|
903
2224
|
class="card"
|
|
904
2225
|
tabindex="0"
|
|
905
2226
|
[class.card--active]="view.item.id === _activeId"
|
|
2227
|
+
[class.card--selected]="row.selected"
|
|
906
2228
|
[attr.data-item-id]="view.item.id"
|
|
2229
|
+
[attr.data-move-target]="view.item.kind === 'folder' ? view.item.id : null"
|
|
2230
|
+
[class.move-drop-target]="view.item.kind === 'folder' && moveDropTarget() === view.item.id"
|
|
907
2231
|
[attr.data-autoid]="view.autoId"
|
|
908
2232
|
[attr.aria-label]="view.item.name + ', ' + view.typeLabel"
|
|
909
|
-
(click)="
|
|
2233
|
+
(click)="onClick($event, view)"
|
|
910
2234
|
(keydown)="onKeydown($event, view)">
|
|
2235
|
+
@if (_cardTop) {
|
|
2236
|
+
<span class="card-top">
|
|
2237
|
+
@if (row.selectable) {
|
|
2238
|
+
<mat-checkbox
|
|
2239
|
+
class="select"
|
|
2240
|
+
color="primary"
|
|
2241
|
+
[checked]="row.selected"
|
|
2242
|
+
[disabled]="row.selectDisabled"
|
|
2243
|
+
[aria-label]="view.selectLabel"
|
|
2244
|
+
[attr.data-autoid]="view.autoId ? view.autoId + '-select' : null"
|
|
2245
|
+
(change)="toggleSelect.emit(view.item)" />
|
|
2246
|
+
}
|
|
2247
|
+
@if (row.commands) {
|
|
2248
|
+
<sd-file-explorer-actions
|
|
2249
|
+
class="commands"
|
|
2250
|
+
[actions]="row.commands"
|
|
2251
|
+
[context]="view.item"
|
|
2252
|
+
[size]="_commandSize"
|
|
2253
|
+
[source]="row.source"
|
|
2254
|
+
[autoId]="view.autoId ? view.autoId + '-command' : undefined" />
|
|
2255
|
+
}
|
|
2256
|
+
@if (row.menu; as menu) {
|
|
2257
|
+
<sd-file-explorer-menu-trigger
|
|
2258
|
+
class="card-menu"
|
|
2259
|
+
[label]="view.actionsLabel"
|
|
2260
|
+
[busy]="menu.busy"
|
|
2261
|
+
[expanded]="view.item.id === _menuOpenId"
|
|
2262
|
+
[touch]="_touch"
|
|
2263
|
+
[autoId]="view.autoId ? view.autoId + '-commands' : undefined"
|
|
2264
|
+
(activate)="openCommands.emit({ item: view.item, trigger: $event })" />
|
|
2265
|
+
}
|
|
2266
|
+
</span>
|
|
2267
|
+
}
|
|
911
2268
|
<span class="thumb">
|
|
912
2269
|
@if (view.item.thumbnailUrl) {
|
|
913
2270
|
<img [src]="view.item.thumbnailUrl" alt="" loading="lazy" />
|
|
@@ -915,13 +2272,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
915
2272
|
<sd-file-explorer-file-icon [icon]="view.icon" [size]="48" />
|
|
916
2273
|
}
|
|
917
2274
|
</span>
|
|
918
|
-
<span class="card-name" [
|
|
2275
|
+
<span class="card-name" [draggable]="canMove() && view.item.kind === 'file'" [title]="view.item.name">{{
|
|
2276
|
+
view.item.name
|
|
2277
|
+
}}</span>
|
|
2278
|
+
@if (canMove() && view.item.kind === 'file') {
|
|
2279
|
+
<sd-button
|
|
2280
|
+
htmlType="button"
|
|
2281
|
+
class="move-file-button commands"
|
|
2282
|
+
type="text"
|
|
2283
|
+
color="secondary"
|
|
2284
|
+
[size]="_compact ? 'sm' : 'md'"
|
|
2285
|
+
[disabled]="movePending()"
|
|
2286
|
+
[title]="'core.component.file-explorer.move.to' | sdTranslate"
|
|
2287
|
+
(click)="$event.stopPropagation(); move.emit(view.item)"
|
|
2288
|
+
(keydown)="$event.stopPropagation()" />
|
|
2289
|
+
}
|
|
919
2290
|
</li>
|
|
920
2291
|
}
|
|
921
2292
|
</ul>
|
|
922
2293
|
}
|
|
923
|
-
`, styles: [":host{display:block}.list{width:100%}.row{display:grid;grid-template-columns:minmax(0,1fr) 128px 88px var(--sd-fe-actions-width,
|
|
924
|
-
}], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: true }] }], view: [{ type: i0.Input, args: [{ isSignal: true, alias: "view", required: false }] }], canDownload: [{ type: i0.Input, args: [{ isSignal: true, alias: "canDownload", required: false }] }], canShare: [{ type: i0.Input, args: [{ isSignal: true, alias: "canShare", required: false }] }], compact: [{ type: i0.Input, args: [{ isSignal: true, alias: "compact", required: false }] }], activeId: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeId", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], activate: [{ type: i0.Output, args: ["activate"] }], download: [{ type: i0.Output, args: ["download"] }], share: [{ type: i0.Output, args: ["share"] }] } });
|
|
2294
|
+
`, 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"] }]
|
|
2295
|
+
}], propDecorators: { canMove: [{ type: i0.Input, args: [{ isSignal: true, alias: "canMove", required: false }] }], moveDropTarget: [{ type: i0.Input, args: [{ isSignal: true, alias: "moveDropTarget", required: false }] }], movePending: [{ type: i0.Input, args: [{ isSignal: true, alias: "movePending", required: false }] }], move: [{ type: i0.Output, args: ["move"] }], columns: [{ type: i0.Input, args: [{ isSignal: true, alias: "columns", required: false }] }], items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: true }] }], view: [{ type: i0.Input, args: [{ isSignal: true, alias: "view", required: false }] }], canDownload: [{ type: i0.Input, args: [{ isSignal: true, alias: "canDownload", required: false }] }], canShare: [{ type: i0.Input, args: [{ isSignal: true, alias: "canShare", required: false }] }], compact: [{ type: i0.Input, args: [{ isSignal: true, alias: "compact", required: false }] }], touch: [{ type: i0.Input, args: [{ isSignal: true, alias: "touch", required: false }] }], activeId: [{ type: i0.Input, args: [{ isSignal: true, alias: "activeId", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], selection: [{ type: i0.Input, args: [{ isSignal: true, alias: "selection", required: false }] }], fileCommands: [{ type: i0.Input, args: [{ isSignal: true, alias: "fileCommands", required: false }] }], folderCommands: [{ type: i0.Input, args: [{ isSignal: true, alias: "folderCommands", required: false }] }], menuOpenId: [{ type: i0.Input, args: [{ isSignal: true, alias: "menuOpenId", required: false }] }], activate: [{ type: i0.Output, args: ["activate"] }], openCommands: [{ type: i0.Output, args: ["openCommands"] }], download: [{ type: i0.Output, args: ["download"] }], share: [{ type: i0.Output, args: ["share"] }], toggleSelect: [{ type: i0.Output, args: ["toggleSelect"] }], toggleSelectAll: [{ type: i0.Output, args: ["toggleSelectAll"] }] } });
|
|
925
2296
|
|
|
926
2297
|
/**
|
|
927
2298
|
* File detail of the explorer (internal): an `<sd-side-drawer>` opened in the explorer's item area (right of the
|
|
@@ -951,6 +2322,9 @@ class SdFileExplorerPreviewPanel {
|
|
|
951
2322
|
/** Show the share button. */
|
|
952
2323
|
canShare = input(false, /* @ts-ignore */
|
|
953
2324
|
...(ngDevMode ? [{ debugName: "canShare" }] : /* istanbul ignore next */ []));
|
|
2325
|
+
/** Matches the explorer's narrow layout; footer buttons retain Core's 48 px touch span. */
|
|
2326
|
+
compact = input(false, /* @ts-ignore */
|
|
2327
|
+
...(ngDevMode ? [{ debugName: "compact" }] : /* istanbul ignore next */ []));
|
|
954
2328
|
/** Element the drawer opens inside: the explorer's item area, right of the folder tree. */
|
|
955
2329
|
container = input(null, /* @ts-ignore */
|
|
956
2330
|
...(ngDevMode ? [{ debugName: "container" }] : /* istanbul ignore next */ []));
|
|
@@ -1052,7 +2426,7 @@ class SdFileExplorerPreviewPanel {
|
|
|
1052
2426
|
}
|
|
1053
2427
|
}
|
|
1054
2428
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdFileExplorerPreviewPanel, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1055
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdFileExplorerPreviewPanel, isStandalone: true, selector: "sd-file-explorer-preview-panel", inputs: { view: { classPropertyName: "view", publicName: "view", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: true, transformFunction: null }, meta: { classPropertyName: "meta", publicName: "meta", isSignal: true, isRequired: false, transformFunction: null }, canDownload: { classPropertyName: "canDownload", publicName: "canDownload", isSignal: true, isRequired: false, transformFunction: null }, canShare: { classPropertyName: "canShare", publicName: "canShare", isSignal: true, isRequired: false, transformFunction: null }, container: { classPropertyName: "container", publicName: "container", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { close: "close", download: "download", share: "share", retry: "retry", imageError: "imageError" }, host: { classAttribute: "sd-file-explorer-preview-panel" }, viewQueries: [{ propertyName: "drawer", first: true, predicate: SdSideDrawer, descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
2429
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdFileExplorerPreviewPanel, isStandalone: true, selector: "sd-file-explorer-preview-panel", inputs: { view: { classPropertyName: "view", publicName: "view", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: true, transformFunction: null }, meta: { classPropertyName: "meta", publicName: "meta", isSignal: true, isRequired: false, transformFunction: null }, canDownload: { classPropertyName: "canDownload", publicName: "canDownload", isSignal: true, isRequired: false, transformFunction: null }, canShare: { classPropertyName: "canShare", publicName: "canShare", isSignal: true, isRequired: false, transformFunction: null }, compact: { classPropertyName: "compact", publicName: "compact", isSignal: true, isRequired: false, transformFunction: null }, container: { classPropertyName: "container", publicName: "container", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { close: "close", download: "download", share: "share", retry: "retry", imageError: "imageError" }, host: { classAttribute: "sd-file-explorer-preview-panel" }, viewQueries: [{ propertyName: "drawer", first: true, predicate: SdSideDrawer, descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
1056
2430
|
@let _view = view();
|
|
1057
2431
|
@let _state = state();
|
|
1058
2432
|
@let _autoId = autoId();
|
|
@@ -1137,6 +2511,9 @@ class SdFileExplorerPreviewPanel {
|
|
|
1137
2511
|
<sd-button
|
|
1138
2512
|
sdFooterRight
|
|
1139
2513
|
class="share-button"
|
|
2514
|
+
[size]="compact() ? 'sm' : 'md'"
|
|
2515
|
+
[disabled]="_view?.shareDisabled ?? false"
|
|
2516
|
+
[attr.aria-description]="_view?.shareDisabled ? _view?.unavailableReason : null"
|
|
1140
2517
|
[type]="_canDownload ? 'outline' : 'fill'"
|
|
1141
2518
|
[color]="_canDownload ? 'secondary' : 'primary'"
|
|
1142
2519
|
prefixIcon="share"
|
|
@@ -1148,6 +2525,9 @@ class SdFileExplorerPreviewPanel {
|
|
|
1148
2525
|
<sd-button
|
|
1149
2526
|
sdFooterRight
|
|
1150
2527
|
class="download-button"
|
|
2528
|
+
[size]="compact() ? 'sm' : 'md'"
|
|
2529
|
+
[disabled]="_view?.downloadDisabled ?? false"
|
|
2530
|
+
[attr.aria-description]="_view?.downloadDisabled ? _view?.unavailableReason : null"
|
|
1151
2531
|
type="fill"
|
|
1152
2532
|
color="primary"
|
|
1153
2533
|
prefixIcon="file_download"
|
|
@@ -1262,6 +2642,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
1262
2642
|
<sd-button
|
|
1263
2643
|
sdFooterRight
|
|
1264
2644
|
class="share-button"
|
|
2645
|
+
[size]="compact() ? 'sm' : 'md'"
|
|
2646
|
+
[disabled]="_view?.shareDisabled ?? false"
|
|
2647
|
+
[attr.aria-description]="_view?.shareDisabled ? _view?.unavailableReason : null"
|
|
1265
2648
|
[type]="_canDownload ? 'outline' : 'fill'"
|
|
1266
2649
|
[color]="_canDownload ? 'secondary' : 'primary'"
|
|
1267
2650
|
prefixIcon="share"
|
|
@@ -1273,6 +2656,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
1273
2656
|
<sd-button
|
|
1274
2657
|
sdFooterRight
|
|
1275
2658
|
class="download-button"
|
|
2659
|
+
[size]="compact() ? 'sm' : 'md'"
|
|
2660
|
+
[disabled]="_view?.downloadDisabled ?? false"
|
|
2661
|
+
[attr.aria-description]="_view?.downloadDisabled ? _view?.unavailableReason : null"
|
|
1276
2662
|
type="fill"
|
|
1277
2663
|
color="primary"
|
|
1278
2664
|
prefixIcon="file_download"
|
|
@@ -1297,7 +2683,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
1297
2683
|
}
|
|
1298
2684
|
</ng-template>
|
|
1299
2685
|
`, styles: [":host{display:none}.detail{display:flex;flex-direction:column;height:100%}.stage{display:flex;flex:0 1 216px;align-items:center;justify-content:center;min-height:140px;padding:14px;overflow:hidden;border-radius:var(--sd-radius-12, 12px);background:var(--sd-fe-preview-bg)}.stage--pdf{flex-basis:380px;min-height:240px;padding:0;background:var(--sd-fe-muted-surface)}.stage--pdf>*{width:100%;height:100%;min-height:0}.stage--video{flex:none;min-height:216px;padding:0;background:var(--sd-fe-muted-surface)}.stage--video>*{width:100%}.image{display:block;max-width:100%;max-height:100%;border-radius:var(--sd-radius-6, 6px);object-fit:contain}.placeholder{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:16px;text-align:center;color:var(--sd-fe-text-secondary)}.placeholder--error{color:var(--sd-fe-error)}.placeholder--error sd-button{margin-top:4px}.placeholder-title{margin:4px 0 0;color:var(--sd-fe-text);font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-semibold, 600)}.placeholder-hint{margin:0;font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-18, 18px);color:var(--sd-fe-text-secondary)}.spinner{width:28px;height:28px;border:3px solid color-mix(in srgb,var(--sd-fe-accent) 20%,transparent);border-top-color:var(--sd-fe-accent);border-radius:50%;animation:sd-file-explorer-preview-spin .8s linear infinite}.meta{flex:none;margin:20px 0 0;padding:4px 0 0;border-top:1px solid var(--sd-fe-border)}.meta-row{display:grid;grid-template-columns:84px minmax(0,1fr);align-items:baseline;gap:12px;padding:10px 0;font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-18, 18px)}.meta-row dt{color:var(--sd-fe-text-secondary)}.meta-row dd{margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}@keyframes sd-file-explorer-preview-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.spinner{animation-duration:2.4s}}\n"] }]
|
|
1300
|
-
}], ctorParameters: () => [], propDecorators: { view: [{ type: i0.Input, args: [{ isSignal: true, alias: "view", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: true }] }], meta: [{ type: i0.Input, args: [{ isSignal: true, alias: "meta", required: false }] }], canDownload: [{ type: i0.Input, args: [{ isSignal: true, alias: "canDownload", required: false }] }], canShare: [{ type: i0.Input, args: [{ isSignal: true, alias: "canShare", required: false }] }], container: [{ type: i0.Input, args: [{ isSignal: true, alias: "container", required: false }] }], autoId: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], close: [{ type: i0.Output, args: ["close"] }], download: [{ type: i0.Output, args: ["download"] }], share: [{ type: i0.Output, args: ["share"] }], retry: [{ type: i0.Output, args: ["retry"] }], imageError: [{ type: i0.Output, args: ["imageError"] }], drawer: [{ type: i0.ViewChild, args: [i0.forwardRef(() => SdSideDrawer), { isSignal: true }] }] } });
|
|
2686
|
+
}], ctorParameters: () => [], propDecorators: { view: [{ type: i0.Input, args: [{ isSignal: true, alias: "view", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: true }] }], meta: [{ type: i0.Input, args: [{ isSignal: true, alias: "meta", required: false }] }], canDownload: [{ type: i0.Input, args: [{ isSignal: true, alias: "canDownload", required: false }] }], canShare: [{ type: i0.Input, args: [{ isSignal: true, alias: "canShare", required: false }] }], compact: [{ type: i0.Input, args: [{ isSignal: true, alias: "compact", required: false }] }], container: [{ type: i0.Input, args: [{ isSignal: true, alias: "container", required: false }] }], autoId: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoId", required: false }] }], close: [{ type: i0.Output, args: ["close"] }], download: [{ type: i0.Output, args: ["download"] }], share: [{ type: i0.Output, args: ["share"] }], retry: [{ type: i0.Output, args: ["retry"] }], imageError: [{ type: i0.Output, args: ["imageError"] }], drawer: [{ type: i0.ViewChild, args: [i0.forwardRef(() => SdSideDrawer), { isSignal: true }] }] } });
|
|
1301
2687
|
|
|
1302
2688
|
let nextTransferPanelId = 0;
|
|
1303
2689
|
/**
|
|
@@ -1556,6 +2942,8 @@ const SEARCH_DEBOUNCE_MS = 300;
|
|
|
1556
2942
|
const MAX_PARALLEL_UPLOADS = 3;
|
|
1557
2943
|
/** Below this host width the explorer switches to the compact (mobile) layout. */
|
|
1558
2944
|
const COMPACT_MAX_WIDTH = 720;
|
|
2945
|
+
/** Primary pointer is a finger: commands stay visible and use 48 px targets. */
|
|
2946
|
+
const TOUCH_QUERY = '(pointer: coarse)';
|
|
1559
2947
|
/** How long a saved download's object URL stays alive before it is revoked. */
|
|
1560
2948
|
const DOWNLOAD_URL_TTL_MS = 40_000;
|
|
1561
2949
|
const ACTIVE_STATUSES = new Set(['queued', 'preparing', 'transferring']);
|
|
@@ -1565,7 +2953,7 @@ let nextExplorerId = 0;
|
|
|
1565
2953
|
* Google-Drive-like file browser: folder tree, breadcrumb, list / grid, search, file detail drawer, uploads with
|
|
1566
2954
|
* drag-and-drop, downloads and a transfer queue — all inside one element.
|
|
1567
2955
|
*
|
|
1568
|
-
* Storage-agnostic: every read and write goes through the callbacks of `SdFileExplorerOption
|
|
2956
|
+
* Storage-agnostic: every read and write goes through the callbacks of `SdFileExplorerOption<T>`.
|
|
1569
2957
|
*
|
|
1570
2958
|
* @example
|
|
1571
2959
|
* ```html
|
|
@@ -1573,14 +2961,64 @@ let nextExplorerId = 0;
|
|
|
1573
2961
|
* ```
|
|
1574
2962
|
*/
|
|
1575
2963
|
class SdFileExplorer {
|
|
2964
|
+
#moveDrag = new SdFileExplorerDragSession();
|
|
2965
|
+
#moveController = null;
|
|
2966
|
+
#moveRefreshFolders = [];
|
|
2967
|
+
#moveReturnFocus = null;
|
|
2968
|
+
#moveDragSelectionRequired = false;
|
|
2969
|
+
#movePickerSelectionRequired = false;
|
|
2970
|
+
movePending = signal(false, /* @ts-ignore */
|
|
2971
|
+
...(ngDevMode ? [{ debugName: "movePending" }] : /* istanbul ignore next */ []));
|
|
2972
|
+
moveStatus = signal('', /* @ts-ignore */
|
|
2973
|
+
...(ngDevMode ? [{ debugName: "moveStatus" }] : /* istanbul ignore next */ []));
|
|
2974
|
+
moveRefreshError = signal(false, /* @ts-ignore */
|
|
2975
|
+
...(ngDevMode ? [{ debugName: "moveRefreshError" }] : /* istanbul ignore next */ []));
|
|
2976
|
+
movePickerItems = signal(null, /* @ts-ignore */
|
|
2977
|
+
...(ngDevMode ? [{ debugName: "movePickerItems" }] : /* istanbul ignore next */ []));
|
|
2978
|
+
moveTarget = signal(null, /* @ts-ignore */
|
|
2979
|
+
...(ngDevMode ? [{ debugName: "moveTarget" }] : /* istanbul ignore next */ []));
|
|
2980
|
+
moveDropTarget = signal(undefined, /* @ts-ignore */
|
|
2981
|
+
...(ngDevMode ? [{ debugName: "moveDropTarget" }] : /* istanbul ignore next */ []));
|
|
2982
|
+
canMove = computed(() => typeof this.#config().move?.onMove === 'function', /* @ts-ignore */
|
|
2983
|
+
...(ngDevMode ? [{ debugName: "canMove" }] : /* istanbul ignore next */ []));
|
|
2984
|
+
movePickerNodes = computed(() => this.treeNodes().map(node => ({ ...node, selected: node.id === (this.moveTarget()?.id ?? null) })), /* @ts-ignore */
|
|
2985
|
+
...(ngDevMode ? [{ debugName: "movePickerNodes" }] : /* istanbul ignore next */ []));
|
|
2986
|
+
canSubmitMove = computed(() => {
|
|
2987
|
+
const items = this.movePickerItems();
|
|
2988
|
+
if (!items || this.movePending())
|
|
2989
|
+
return false;
|
|
2990
|
+
return this.#moveAllowed(items, this.moveTarget(), 'menu', new AbortController().signal, this.#movePickerSelectionRequired);
|
|
2991
|
+
}, /* @ts-ignore */
|
|
2992
|
+
...(ngDevMode ? [{ debugName: "canSubmitMove" }] : /* istanbul ignore next */ []));
|
|
2993
|
+
columnDefs = contentChildren(SdFileExplorerColumnDef, /* @ts-ignore */
|
|
2994
|
+
...(ngDevMode ? [{ debugName: "columnDefs" }] : /* istanbul ignore next */ []));
|
|
2995
|
+
#warnedColumns = new WeakSet();
|
|
2996
|
+
columns = computed(() => {
|
|
2997
|
+
const seen = new Set();
|
|
2998
|
+
return this.columnDefs().filter(column => {
|
|
2999
|
+
const id = column.id().trim();
|
|
3000
|
+
if (!id || seen.has(id)) {
|
|
3001
|
+
if (isDevMode() && !this.#warnedColumns.has(column)) {
|
|
3002
|
+
this.#warnedColumns.add(column);
|
|
3003
|
+
console.warn(`[sd-file-explorer] ignored empty or duplicate column id: ${id}`);
|
|
3004
|
+
}
|
|
3005
|
+
return false;
|
|
3006
|
+
}
|
|
3007
|
+
seen.add(id);
|
|
3008
|
+
return true;
|
|
3009
|
+
});
|
|
3010
|
+
}, /* @ts-ignore */
|
|
3011
|
+
...(ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []));
|
|
1576
3012
|
#i18n = inject(I18nService);
|
|
1577
3013
|
#host = inject(ElementRef);
|
|
1578
3014
|
#document = inject(DOCUMENT);
|
|
1579
3015
|
#injector = inject(Injector);
|
|
1580
3016
|
#zone = inject(NgZone);
|
|
1581
|
-
/** Data callbacks and display settings. See `SdFileExplorerOption
|
|
3017
|
+
/** Data callbacks and display settings. See `SdFileExplorerOption<T>`. */
|
|
1582
3018
|
option = input.required(/* @ts-ignore */
|
|
1583
3019
|
...(ngDevMode ? [{ debugName: "option" }] : /* istanbul ignore next */ []));
|
|
3020
|
+
#config = computed(() => sdFileExplorerNormalizeConfig(this.option()), /* @ts-ignore */
|
|
3021
|
+
...(ngDevMode ? [{ debugName: "#config" }] : /* istanbul ignore next */ []));
|
|
1584
3022
|
/**
|
|
1585
3023
|
* Emitted exactly once each time the user opens a file (click, `Enter` or `Space` on a file in the list,
|
|
1586
3024
|
* grid or search results), right before the detail drawer starts loading. Never emitted for folders.
|
|
@@ -1603,6 +3041,17 @@ class SdFileExplorer {
|
|
|
1603
3041
|
...(ngDevMode ? [{ debugName: "#transfers" }] : /* istanbul ignore next */ []));
|
|
1604
3042
|
#width = signal(0, /* @ts-ignore */
|
|
1605
3043
|
...(ngDevMode ? [{ debugName: "#width" }] : /* istanbul ignore next */ []));
|
|
3044
|
+
#touch = signal(false, /* @ts-ignore */
|
|
3045
|
+
...(ngDevMode ? [{ debugName: "#touch" }] : /* istanbul ignore next */ []));
|
|
3046
|
+
/**
|
|
3047
|
+
* Ids the user selected. Only those still visible and eligible count — see `selectedItems` — and the others are
|
|
3048
|
+
* forgotten once the view settles, so a file that leaves the view or gets disabled is never selected again by itself.
|
|
3049
|
+
*/
|
|
3050
|
+
#selectedIds = signal(new Set(), /* @ts-ignore */
|
|
3051
|
+
...(ngDevMode ? [{ debugName: "#selectedIds" }] : /* istanbul ignore next */ []));
|
|
3052
|
+
/** Item whose commands the compact drawer shows; `null` while it is closed. */
|
|
3053
|
+
#commandTarget = signal(null, /* @ts-ignore */
|
|
3054
|
+
...(ngDevMode ? [{ debugName: "#commandTarget" }] : /* istanbul ignore next */ []));
|
|
1606
3055
|
view = signal('list', /* @ts-ignore */
|
|
1607
3056
|
...(ngDevMode ? [{ debugName: "view" }] : /* istanbul ignore next */ []));
|
|
1608
3057
|
keyword = signal('', /* @ts-ignore */
|
|
@@ -1651,6 +3100,8 @@ class SdFileExplorer {
|
|
|
1651
3100
|
...(ngDevMode ? [{ debugName: "shareDialog" }] : /* istanbul ignore next */ []));
|
|
1652
3101
|
sidebar = viewChild('sidebar', /* @ts-ignore */
|
|
1653
3102
|
...(ngDevMode ? [{ debugName: "sidebar" }] : /* istanbul ignore next */ []));
|
|
3103
|
+
commandDrawer = viewChild(SdFileExplorerCommandSheet, /* @ts-ignore */
|
|
3104
|
+
...(ngDevMode ? [{ debugName: "commandDrawer" }] : /* istanbul ignore next */ []));
|
|
1654
3105
|
// ---- Non-reactive bookkeeping ----
|
|
1655
3106
|
#listControllers = new Map();
|
|
1656
3107
|
#jobs = new Map();
|
|
@@ -1664,6 +3115,8 @@ class SdFileExplorer {
|
|
|
1664
3115
|
#previewObjectUrl = null;
|
|
1665
3116
|
#shareController = null;
|
|
1666
3117
|
#shareReturnFocus = null;
|
|
3118
|
+
/** Command pressed in the compact drawer, waiting for the drawer to finish closing; any context change drops it. */
|
|
3119
|
+
#pendingCommand = null;
|
|
1667
3120
|
#dragDepth = 0;
|
|
1668
3121
|
#listFn = null;
|
|
1669
3122
|
#resizeObserver = null;
|
|
@@ -1675,23 +3128,28 @@ class SdFileExplorer {
|
|
|
1675
3128
|
return width > 0 && width < COMPACT_MAX_WIDTH;
|
|
1676
3129
|
}, /* @ts-ignore */
|
|
1677
3130
|
...(ngDevMode ? [{ debugName: "compact" }] : /* istanbul ignore next */ []));
|
|
3131
|
+
touch = this.#touch.asReadonly();
|
|
1678
3132
|
autoId = computed(() => {
|
|
1679
|
-
const scope = this
|
|
3133
|
+
const scope = this.#config().autoId;
|
|
1680
3134
|
return scope ? `components-file-explorer-${scope}` : undefined;
|
|
1681
3135
|
}, /* @ts-ignore */
|
|
1682
3136
|
...(ngDevMode ? [{ debugName: "autoId" }] : /* istanbul ignore next */ []));
|
|
1683
3137
|
locale = this.#i18n.locale;
|
|
1684
|
-
rootLabel = computed(() => this
|
|
3138
|
+
rootLabel = computed(() => this.#config().rootLabel || this.#i18n.t('core.component.file-explorer.root'), /* @ts-ignore */
|
|
1685
3139
|
...(ngDevMode ? [{ debugName: "rootLabel" }] : /* istanbul ignore next */ []));
|
|
1686
|
-
canUpload = computed(() => typeof this
|
|
3140
|
+
canUpload = computed(() => typeof this.#config().upload === 'function', /* @ts-ignore */
|
|
1687
3141
|
...(ngDevMode ? [{ debugName: "canUpload" }] : /* istanbul ignore next */ []));
|
|
1688
|
-
canDownload = computed(() => typeof this
|
|
3142
|
+
canDownload = computed(() => typeof this.#config().download === 'function', /* @ts-ignore */
|
|
1689
3143
|
...(ngDevMode ? [{ debugName: "canDownload" }] : /* istanbul ignore next */ []));
|
|
1690
|
-
canCreateFolder = computed(() => typeof this
|
|
3144
|
+
canCreateFolder = computed(() => typeof this.#config().createFolder === 'function', /* @ts-ignore */
|
|
1691
3145
|
...(ngDevMode ? [{ debugName: "canCreateFolder" }] : /* istanbul ignore next */ []));
|
|
1692
|
-
canShare = computed(() => typeof this
|
|
3146
|
+
canShare = computed(() => typeof this.#config().share === 'function', /* @ts-ignore */
|
|
1693
3147
|
...(ngDevMode ? [{ debugName: "canShare" }] : /* istanbul ignore next */ []));
|
|
1694
|
-
|
|
3148
|
+
uploadDisabled = computed(() => this.movePending() || !sdFileExplorerEligible(this.#config().uploadable, { parentId: this.#currentId() }), /* @ts-ignore */
|
|
3149
|
+
...(ngDevMode ? [{ debugName: "uploadDisabled" }] : /* istanbul ignore next */ []));
|
|
3150
|
+
createDisabled = computed(() => this.movePending() || !sdFileExplorerEligible(this.#config().creatable, { parentId: this.#currentId() }), /* @ts-ignore */
|
|
3151
|
+
...(ngDevMode ? [{ debugName: "createDisabled" }] : /* istanbul ignore next */ []));
|
|
3152
|
+
#serverSearch = computed(() => typeof this.#config().search === 'function', /* @ts-ignore */
|
|
1695
3153
|
...(ngDevMode ? [{ debugName: "#serverSearch" }] : /* istanbul ignore next */ []));
|
|
1696
3154
|
currentName = computed(() => {
|
|
1697
3155
|
const path = this.#path();
|
|
@@ -1734,6 +3192,206 @@ class SdFileExplorer {
|
|
|
1734
3192
|
return sdFileExplorerFoldersFirst(this.#visibleItems()).map(format);
|
|
1735
3193
|
}, /* @ts-ignore */
|
|
1736
3194
|
...(ngDevMode ? [{ debugName: "itemViews" }] : /* istanbul ignore next */ []));
|
|
3195
|
+
// ---- Selection ----
|
|
3196
|
+
/** The row download / share shortcuts stay until the consumer declares `fileCommands` (even `[]`). */
|
|
3197
|
+
rowShortcuts = computed(() => this.#config().fileCommands == null, /* @ts-ignore */
|
|
3198
|
+
...(ngDevMode ? [{ debugName: "rowShortcuts" }] : /* istanbul ignore next */ []));
|
|
3199
|
+
#configuredSelector = computed(() => {
|
|
3200
|
+
const selector = this.#config().selector;
|
|
3201
|
+
return selector && selector.visible !== false ? selector : null;
|
|
3202
|
+
}, /* @ts-ignore */
|
|
3203
|
+
...(ngDevMode ? [{ debugName: "#configuredSelector" }] : /* istanbul ignore next */ []));
|
|
3204
|
+
#pickerSelection = computed(() => {
|
|
3205
|
+
const selector = this.#configuredSelector();
|
|
3206
|
+
return (!!selector &&
|
|
3207
|
+
(selector.mode === 'picker' ||
|
|
3208
|
+
(selector.mode === undefined && (typeof selector.onSelect === 'function' || typeof selector.onSelectAll === 'function'))));
|
|
3209
|
+
}, /* @ts-ignore */
|
|
3210
|
+
...(ngDevMode ? [{ debugName: "#pickerSelection" }] : /* istanbul ignore next */ []));
|
|
3211
|
+
/** Selection actions remain caller-owned when declared, including an intentional empty array. */
|
|
3212
|
+
selectionActions = computed(() => {
|
|
3213
|
+
const selector = this.#configuredSelector();
|
|
3214
|
+
if (!selector)
|
|
3215
|
+
return [];
|
|
3216
|
+
if (selector.actions !== undefined)
|
|
3217
|
+
return selector.actions ?? [];
|
|
3218
|
+
if (this.#pickerSelection())
|
|
3219
|
+
return [];
|
|
3220
|
+
const config = this.#config();
|
|
3221
|
+
const actions = [];
|
|
3222
|
+
if (typeof config.move?.onMove === 'function')
|
|
3223
|
+
actions.push({
|
|
3224
|
+
title: this.#i18n.t('core.component.file-explorer.move.to'),
|
|
3225
|
+
prefixIcon: 'drive_file_move',
|
|
3226
|
+
type: 'outline',
|
|
3227
|
+
disabled: () => this.movePending() || this.moveRefreshError(),
|
|
3228
|
+
onClick: items => this.openMovePicker(items),
|
|
3229
|
+
});
|
|
3230
|
+
if (typeof config.share === 'function')
|
|
3231
|
+
actions.push({
|
|
3232
|
+
title: this.#i18n.t('core.component.file-explorer.share'),
|
|
3233
|
+
prefixIcon: 'share',
|
|
3234
|
+
disabled: items => items.length !== 1 || !sdFileExplorerEligible(config.shareable, items[0]),
|
|
3235
|
+
onClick: items => {
|
|
3236
|
+
if (items.length === 1)
|
|
3237
|
+
this.openShare(items[0]);
|
|
3238
|
+
},
|
|
3239
|
+
});
|
|
3240
|
+
if (typeof config.download === 'function')
|
|
3241
|
+
actions.push({
|
|
3242
|
+
title: this.#i18n.t('core.component.file-explorer.download'),
|
|
3243
|
+
prefixIcon: 'file_download',
|
|
3244
|
+
disabled: items => !items.length || items.some(item => !sdFileExplorerEligible(config.downloadable, item)),
|
|
3245
|
+
onClick: items => {
|
|
3246
|
+
for (const item of items)
|
|
3247
|
+
this.downloadItem(item);
|
|
3248
|
+
},
|
|
3249
|
+
});
|
|
3250
|
+
return actions;
|
|
3251
|
+
}, /* @ts-ignore */
|
|
3252
|
+
...(ngDevMode ? [{ debugName: "selectionActions" }] : /* istanbul ignore next */ []));
|
|
3253
|
+
#selector = computed(() => {
|
|
3254
|
+
const selector = this.#configuredSelector();
|
|
3255
|
+
if (!selector || this.#pickerSelection())
|
|
3256
|
+
return selector;
|
|
3257
|
+
// Keep intermediate selections reachable even when actions are hidden until a particular combination is selected.
|
|
3258
|
+
return sdFileExplorerHasActionCapability(this.selectionActions()) ? selector : null;
|
|
3259
|
+
}, /* @ts-ignore */
|
|
3260
|
+
...(ngDevMode ? [{ debugName: "#selector" }] : /* istanbul ignore next */ []));
|
|
3261
|
+
/** Files of the current folder or search results, in display order. Folders are never selectable. */
|
|
3262
|
+
#visibleFiles = computed(() => this.#visibleItems().filter(item => item.kind === 'file'), /* @ts-ignore */
|
|
3263
|
+
...(ngDevMode ? [{ debugName: "#visibleFiles" }] : /* istanbul ignore next */ []));
|
|
3264
|
+
#selectionCandidates = computed(() => {
|
|
3265
|
+
const selector = this.#configuredSelector();
|
|
3266
|
+
if (!selector)
|
|
3267
|
+
return [];
|
|
3268
|
+
const disabled = selector.disabled;
|
|
3269
|
+
return disabled ? this.#visibleFiles().filter(item => !disabled(item)) : this.#visibleFiles();
|
|
3270
|
+
}, /* @ts-ignore */
|
|
3271
|
+
...(ngDevMode ? [{ debugName: "#selectionCandidates" }] : /* istanbul ignore next */ []));
|
|
3272
|
+
#eligibleFiles = computed(() => (this.#selector() ? this.#selectionCandidates() : []), /* @ts-ignore */
|
|
3273
|
+
...(ngDevMode ? [{ debugName: "#eligibleFiles" }] : /* istanbul ignore next */ []));
|
|
3274
|
+
/**
|
|
3275
|
+
* Frozen snapshot of the selection handed to callbacks and actions: selected files that are still visible and
|
|
3276
|
+
* eligible, in display order. A file that a refresh drops, or that becomes disabled, leaves it.
|
|
3277
|
+
*/
|
|
3278
|
+
selectedItems = computed(() => {
|
|
3279
|
+
const ids = this.#selectedIds();
|
|
3280
|
+
return Object.freeze(this.#eligibleFiles().filter(item => ids.has(item.id)));
|
|
3281
|
+
}, /* @ts-ignore */
|
|
3282
|
+
...(ngDevMode ? [{ debugName: "selectedItems" }] : /* istanbul ignore next */ []));
|
|
3283
|
+
/** Selection state of the item list; `null` (no checkbox, no band) without selector or without files in view. */
|
|
3284
|
+
selectionView = computed(() => {
|
|
3285
|
+
const files = this.#visibleFiles();
|
|
3286
|
+
if (!this.#selector() || !files.length)
|
|
3287
|
+
return null;
|
|
3288
|
+
const eligible = this.#eligibleFiles();
|
|
3289
|
+
const selected = this.selectedItems();
|
|
3290
|
+
const eligibleIds = new Set(eligible.map(item => item.id));
|
|
3291
|
+
const autoId = this.autoId();
|
|
3292
|
+
return {
|
|
3293
|
+
selectedIds: new Set(selected.map(item => item.id)),
|
|
3294
|
+
disabledIds: new Set(files.filter(item => !eligibleIds.has(item.id)).map(item => item.id)),
|
|
3295
|
+
state: !selected.length ? 'none' : selected.length === eligible.length ? 'all' : 'some',
|
|
3296
|
+
eligibleCount: eligible.length,
|
|
3297
|
+
allLabel: this.#i18n.t('core.component.file-explorer.selection.select-all', { count: eligible.length }),
|
|
3298
|
+
autoId: autoId ? `${autoId}-select-all` : undefined,
|
|
3299
|
+
};
|
|
3300
|
+
}, /* @ts-ignore */
|
|
3301
|
+
...(ngDevMode ? [{ debugName: "selectionView" }] : /* istanbul ignore next */ []));
|
|
3302
|
+
/**
|
|
3303
|
+
* Status sentence of the band, split around the number so the template can set it in semibold: "2 tệp đã chọn",
|
|
3304
|
+
* "已选择 2 个文件". Nothing selected: `count` is 0 and `before` holds the whole sentence.
|
|
3305
|
+
*/
|
|
3306
|
+
selectionSummary = computed(() => {
|
|
3307
|
+
const count = this.selectedItems().length;
|
|
3308
|
+
if (!count)
|
|
3309
|
+
return { count, before: this.#i18n.t('core.component.file-explorer.selection.none'), after: '' };
|
|
3310
|
+
// 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ữ.
|
|
3311
|
+
const message = this.#i18n.t(`core.component.file-explorer.selection.${count === 1 ? 'selected-one' : 'selected'}`);
|
|
3312
|
+
const placeholder = '{count}';
|
|
3313
|
+
const at = message.indexOf(placeholder);
|
|
3314
|
+
if (at < 0)
|
|
3315
|
+
return { count, before: '', after: ` ${message}` };
|
|
3316
|
+
return { count, before: message.slice(0, at), after: message.slice(at + placeholder.length) };
|
|
3317
|
+
}, /* @ts-ignore */
|
|
3318
|
+
...(ngDevMode ? [{ debugName: "selectionSummary" }] : /* istanbul ignore next */ []));
|
|
3319
|
+
// ---- Compact command drawer ----
|
|
3320
|
+
// 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
|
|
3321
|
+
// 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.
|
|
3322
|
+
#shareShortcut = computed(() => this.canShare()
|
|
3323
|
+
? {
|
|
3324
|
+
title: this.#i18n.t('core.component.file-explorer.share'),
|
|
3325
|
+
prefixIcon: 'share',
|
|
3326
|
+
disabled: item => this.movePending() || !sdFileExplorerEligible(this.#config().shareable, item),
|
|
3327
|
+
click: item => this.openShare(item),
|
|
3328
|
+
}
|
|
3329
|
+
: null, /* @ts-ignore */
|
|
3330
|
+
...(ngDevMode ? [{ debugName: "#shareShortcut" }] : /* istanbul ignore next */ []));
|
|
3331
|
+
#downloadShortcut = computed(() => this.canDownload()
|
|
3332
|
+
? {
|
|
3333
|
+
title: this.#i18n.t('core.component.file-explorer.download'),
|
|
3334
|
+
prefixIcon: 'file_download',
|
|
3335
|
+
disabled: item => this.movePending() || !sdFileExplorerEligible(this.#config().downloadable, item),
|
|
3336
|
+
click: item => this.downloadItem(item),
|
|
3337
|
+
}
|
|
3338
|
+
: null, /* @ts-ignore */
|
|
3339
|
+
...(ngDevMode ? [{ debugName: "#downloadShortcut" }] : /* istanbul ignore next */ []));
|
|
3340
|
+
/** Row shortcuts as commands, for the drawer while `fileCommands` is undeclared: share, then download, as on the row. */
|
|
3341
|
+
#shortcuts = computed(() => {
|
|
3342
|
+
const commands = [];
|
|
3343
|
+
const keys = [];
|
|
3344
|
+
const share = this.#shareShortcut();
|
|
3345
|
+
const download = this.#downloadShortcut();
|
|
3346
|
+
if (share) {
|
|
3347
|
+
commands.push(share);
|
|
3348
|
+
keys.push('share');
|
|
3349
|
+
}
|
|
3350
|
+
if (download) {
|
|
3351
|
+
commands.push(download);
|
|
3352
|
+
keys.push('download');
|
|
3353
|
+
}
|
|
3354
|
+
return { commands, keys };
|
|
3355
|
+
}, /* @ts-ignore */
|
|
3356
|
+
...(ngDevMode ? [{ debugName: "#shortcuts" }] : /* istanbul ignore next */ []));
|
|
3357
|
+
/** Current version of the drawer's item — looked up by id in the list it was opened from; `null` once it is gone. */
|
|
3358
|
+
#commandItem = computed(() => {
|
|
3359
|
+
const target = this.#commandTarget();
|
|
3360
|
+
return target ? this.#findCommandItem(target.id, target.origin) : null;
|
|
3361
|
+
}, /* @ts-ignore */
|
|
3362
|
+
...(ngDevMode ? [{ debugName: "#commandItem" }] : /* istanbul ignore next */ []));
|
|
3363
|
+
/** Content of the drawer: the item's commands resolved for it now; `null` when nothing is left to show. */
|
|
3364
|
+
// why: kiểu tường minh như contentState — d.ts ổn định giữa các máy build.
|
|
3365
|
+
commandSheet = computed(() => {
|
|
3366
|
+
const target = this.#commandTarget();
|
|
3367
|
+
const item = this.#commandItem();
|
|
3368
|
+
if (!target || !item)
|
|
3369
|
+
return null;
|
|
3370
|
+
const definitions = this.#commandDefinitions(item, target.origin);
|
|
3371
|
+
const source = item.kind === 'folder' ? 'folderCommands' : 'fileCommands';
|
|
3372
|
+
const resolved = sdFileExplorerResolveActions(definitions, item, SD_FILE_EXPLORER_COMMAND_DEFAULTS, source);
|
|
3373
|
+
if (!resolved.length)
|
|
3374
|
+
return null;
|
|
3375
|
+
const shortcuts = this.#shortcuts();
|
|
3376
|
+
const view = this.#itemFormatter()(item);
|
|
3377
|
+
return {
|
|
3378
|
+
title: item.name,
|
|
3379
|
+
context: [view.typeLabel, view.sizeLabel].filter(Boolean).join(' · '),
|
|
3380
|
+
icon: view.icon,
|
|
3381
|
+
entries: sdFileExplorerSheetEntries(resolved, definitions === shortcuts.commands ? shortcuts.keys : undefined),
|
|
3382
|
+
};
|
|
3383
|
+
}, /* @ts-ignore */
|
|
3384
|
+
...(ngDevMode ? [{ debugName: "commandSheet" }] : /* istanbul ignore next */ []));
|
|
3385
|
+
itemsMenuOpenId = computed(() => {
|
|
3386
|
+
const target = this.#commandTarget();
|
|
3387
|
+
return target && target.origin !== 'tree' ? target.id : null;
|
|
3388
|
+
}, /* @ts-ignore */
|
|
3389
|
+
...(ngDevMode ? [{ debugName: "itemsMenuOpenId" }] : /* istanbul ignore next */ []));
|
|
3390
|
+
treeMenuOpenId = computed(() => {
|
|
3391
|
+
const target = this.#commandTarget();
|
|
3392
|
+
return target?.origin === 'tree' ? target.id : null;
|
|
3393
|
+
}, /* @ts-ignore */
|
|
3394
|
+
...(ngDevMode ? [{ debugName: "treeMenuOpenId" }] : /* istanbul ignore next */ []));
|
|
1737
3395
|
// why: như shareFeedback — kiểu tường minh để d.ts ổn định giữa các máy build.
|
|
1738
3396
|
contentState = computed(() => {
|
|
1739
3397
|
const keyword = this.#trimmedKeyword();
|
|
@@ -1958,6 +3616,9 @@ class SdFileExplorer {
|
|
|
1958
3616
|
const type = sdFileExplorerFileType(item);
|
|
1959
3617
|
return {
|
|
1960
3618
|
item,
|
|
3619
|
+
downloadDisabled: this.movePending() || !sdFileExplorerEligible(this.#config().downloadable, item),
|
|
3620
|
+
shareDisabled: this.movePending() || !sdFileExplorerEligible(this.#config().shareable, item),
|
|
3621
|
+
unavailableReason: t('action-unavailable'),
|
|
1961
3622
|
type,
|
|
1962
3623
|
icon: sdFileExplorerIconName(item),
|
|
1963
3624
|
typeLabel: t(`type.${type}`),
|
|
@@ -1966,27 +3627,89 @@ class SdFileExplorer {
|
|
|
1966
3627
|
modifiedTitle: sdFileExplorerFormatDateTime(item.modifiedAt, locale),
|
|
1967
3628
|
downloadLabel: t('download-item', { name: item.name }),
|
|
1968
3629
|
shareLabel: t('share-item', { name: item.name }),
|
|
3630
|
+
selectLabel: t('selection.select-item', { name: item.name }),
|
|
3631
|
+
actionsLabel: t('item-actions', { name: item.name }),
|
|
1969
3632
|
autoId: autoId ? `${autoId}-item-${sdFileExplorerSafeId(item.id)}` : undefined,
|
|
1970
3633
|
};
|
|
1971
3634
|
};
|
|
1972
3635
|
}, /* @ts-ignore */
|
|
1973
3636
|
...(ngDevMode ? [{ debugName: "#itemFormatter" }] : /* istanbul ignore next */ []));
|
|
1974
3637
|
constructor() {
|
|
3638
|
+
const destroyRef = inject(DestroyRef);
|
|
3639
|
+
let previewProvider;
|
|
3640
|
+
let shareProvider;
|
|
3641
|
+
let moveProvider;
|
|
3642
|
+
let searchProvider;
|
|
3643
|
+
effect(() => {
|
|
3644
|
+
const config = this.#config();
|
|
3645
|
+
const previewChanged = previewProvider !== config.preview;
|
|
3646
|
+
const shareChanged = shareProvider !== config.share;
|
|
3647
|
+
const moveChanged = moveProvider?.onMove !== config.move?.onMove;
|
|
3648
|
+
const searchChanged = searchProvider !== config.search;
|
|
3649
|
+
previewProvider = config.preview;
|
|
3650
|
+
shareProvider = config.share;
|
|
3651
|
+
moveProvider = config.move;
|
|
3652
|
+
searchProvider = config.search;
|
|
3653
|
+
untracked(() => {
|
|
3654
|
+
const item = this.#previewItem();
|
|
3655
|
+
if (previewChanged && item)
|
|
3656
|
+
void this.#loadPreview(item);
|
|
3657
|
+
const shareItem = this.shareItem();
|
|
3658
|
+
if (shareChanged && shareItem) {
|
|
3659
|
+
this.#shareController?.abort();
|
|
3660
|
+
if (config.share && sdFileExplorerEligible(config.shareable, shareItem))
|
|
3661
|
+
void this.#loadShareLink(shareItem);
|
|
3662
|
+
else
|
|
3663
|
+
this.closeShare();
|
|
3664
|
+
}
|
|
3665
|
+
if (moveChanged && this.#moveController)
|
|
3666
|
+
this.cancelMove();
|
|
3667
|
+
if (searchChanged && this.#listFn === config.list)
|
|
3668
|
+
this.#scheduleSearch(true);
|
|
3669
|
+
});
|
|
3670
|
+
});
|
|
3671
|
+
// 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.
|
|
3672
|
+
// Đọ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ỏ.
|
|
3673
|
+
const touchQuery = this.#document.defaultView?.matchMedia?.(TOUCH_QUERY);
|
|
3674
|
+
if (touchQuery) {
|
|
3675
|
+
this.#touch.set(touchQuery.matches);
|
|
3676
|
+
const onTouchChange = (event) => this.#touch.set(event.matches);
|
|
3677
|
+
touchQuery.addEventListener?.('change', onTouchChange);
|
|
3678
|
+
destroyRef.onDestroy(() => touchQuery.removeEventListener?.('change', onTouchChange));
|
|
3679
|
+
}
|
|
1975
3680
|
// why: chỉ reset khi hàm `list` đổi (đổi nguồn lưu trữ). Consumer tạo lại object option với cùng callback
|
|
1976
3681
|
// (ví dụ đổi title) không được xoá cache/điều hướng của người dùng.
|
|
1977
3682
|
effect(() => {
|
|
1978
|
-
const option = this
|
|
3683
|
+
const option = this.#config();
|
|
3684
|
+
const selecting = !!this.#selector();
|
|
1979
3685
|
untracked(() => {
|
|
3686
|
+
if (!selecting)
|
|
3687
|
+
this.#clearSelection();
|
|
1980
3688
|
if (this.#listFn === option.list)
|
|
1981
3689
|
return;
|
|
1982
3690
|
const firstRun = this.#listFn === null;
|
|
1983
3691
|
this.#listFn = option.list;
|
|
3692
|
+
if (this.#moveController)
|
|
3693
|
+
this.cancelMove();
|
|
3694
|
+
this.moveRefreshError.set(false);
|
|
3695
|
+
this.#moveRefreshFolders = [];
|
|
3696
|
+
this.#moveDrag.clear();
|
|
1984
3697
|
if (firstRun)
|
|
1985
3698
|
this.view.set(option.defaultView ?? 'list');
|
|
1986
3699
|
this.#resetNavigation();
|
|
1987
3700
|
this.#ensureLoaded(null);
|
|
1988
3701
|
});
|
|
1989
3702
|
});
|
|
3703
|
+
// 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
|
|
3704
|
+
// đượ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
|
|
3705
|
+
// 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
|
|
3706
|
+
// selector bị ẩn, #clearSelection (có onClear) chạy trước lần dọn im lặng này.
|
|
3707
|
+
effect(() => {
|
|
3708
|
+
const eligible = this.#eligibleFiles();
|
|
3709
|
+
if (this.contentState() === 'loading')
|
|
3710
|
+
return;
|
|
3711
|
+
untracked(() => this.#keepEligibleSelection(eligible));
|
|
3712
|
+
});
|
|
1990
3713
|
afterNextRender(() => {
|
|
1991
3714
|
const host = this.#host.nativeElement;
|
|
1992
3715
|
this.#width.set(host.getBoundingClientRect().width);
|
|
@@ -1999,19 +3722,213 @@ class SdFileExplorer {
|
|
|
1999
3722
|
});
|
|
2000
3723
|
this.#resizeObserver.observe(host);
|
|
2001
3724
|
});
|
|
2002
|
-
// why: rời khỏi layout compact thì drawer không còn ý nghĩa — đóng để lần thu nhỏ sau không bật lại scrim.
|
|
3725
|
+
// 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
|
|
3726
|
+
// 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ổ).
|
|
3727
|
+
effect(() => {
|
|
3728
|
+
if (this.compact())
|
|
3729
|
+
return;
|
|
3730
|
+
untracked(() => {
|
|
3731
|
+
this.sidebarOpen.set(false);
|
|
3732
|
+
this.#closeCommands();
|
|
3733
|
+
});
|
|
3734
|
+
});
|
|
3735
|
+
// 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 —
|
|
3736
|
+
// đóng drawer thay vì giữ một ảnh chụp cũ có thể chạy lệnh trên mục đã mất.
|
|
2003
3737
|
effect(() => {
|
|
2004
|
-
if (!this.
|
|
2005
|
-
untracked(() => this
|
|
3738
|
+
if (this.#commandTarget() && !this.commandSheet())
|
|
3739
|
+
untracked(() => this.#closeCommands());
|
|
2006
3740
|
});
|
|
2007
|
-
|
|
3741
|
+
// 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
|
|
3742
|
+
// 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.
|
|
3743
|
+
const view = this.#document.defaultView;
|
|
3744
|
+
if (view) {
|
|
3745
|
+
const onPopState = () => this.#closeCommands();
|
|
3746
|
+
view.addEventListener('popstate', onPopState);
|
|
3747
|
+
destroyRef.onDestroy(() => view.removeEventListener('popstate', onPopState));
|
|
3748
|
+
}
|
|
3749
|
+
destroyRef.onDestroy(() => this.#teardown());
|
|
2008
3750
|
}
|
|
2009
3751
|
// ---- Public API ----
|
|
3752
|
+
/** Moves visible files through the caller's storage callback. False includes cancellation, rejection or refresh failure. */
|
|
3753
|
+
async moveFiles(items, targetFolder, source = 'api') {
|
|
3754
|
+
return this.#performMove(items, targetFolder, source, false);
|
|
3755
|
+
}
|
|
3756
|
+
async #performMove(items, targetFolder, source, selectionRequired) {
|
|
3757
|
+
const move = this.#config().move;
|
|
3758
|
+
if (!move ||
|
|
3759
|
+
this.movePending() ||
|
|
3760
|
+
this.moveRefreshError() ||
|
|
3761
|
+
this.folderSubmitting() ||
|
|
3762
|
+
this.#transfers().some(transfer => transfer.direction === 'upload' && ACTIVE_STATUSES.has(transfer.status)) ||
|
|
3763
|
+
this.#destroyed)
|
|
3764
|
+
return false;
|
|
3765
|
+
const controller = new AbortController();
|
|
3766
|
+
if (!this.#moveAllowed(items, targetFolder, source, controller.signal, selectionRequired))
|
|
3767
|
+
return false;
|
|
3768
|
+
const request = Object.freeze({
|
|
3769
|
+
items: Object.freeze([...items]),
|
|
3770
|
+
targetFolder,
|
|
3771
|
+
source,
|
|
3772
|
+
signal: controller.signal,
|
|
3773
|
+
});
|
|
3774
|
+
const sourceParents = items.map(item => item.parentId);
|
|
3775
|
+
const movedIds = new Set(items.map(item => item.id));
|
|
3776
|
+
const cachedSources = [...this.#folders()].filter(([, folder]) => folder.items.some(item => movedIds.has(item.id))).map(([id]) => id);
|
|
3777
|
+
this.#moveController = controller;
|
|
3778
|
+
this.movePending.set(true);
|
|
3779
|
+
this.moveStatus.set(this.#i18n.t('core.component.file-explorer.move.pending'));
|
|
3780
|
+
try {
|
|
3781
|
+
const accepted = await move.onMove(request);
|
|
3782
|
+
if (controller.signal.aborted || this.#destroyed || this.#config().move?.onMove !== move.onMove)
|
|
3783
|
+
return false;
|
|
3784
|
+
if (accepted === false) {
|
|
3785
|
+
this.moveStatus.set(this.#i18n.t('core.component.file-explorer.move.cancelled'));
|
|
3786
|
+
return false;
|
|
3787
|
+
}
|
|
3788
|
+
this.#moveRefreshFolders = [...new Set([...sourceParents, ...cachedSources, targetFolder?.id ?? null])].filter(id => this.#folders().has(id));
|
|
3789
|
+
this.#clearSelection();
|
|
3790
|
+
return await this.#refreshMove(controller);
|
|
3791
|
+
}
|
|
3792
|
+
catch (error) {
|
|
3793
|
+
if (!controller.signal.aborted && !this.#destroyed)
|
|
3794
|
+
this.moveStatus.set(sdFileExplorerErrorMessage(error) || this.#i18n.t('core.component.file-explorer.move.error'));
|
|
3795
|
+
return false;
|
|
3796
|
+
}
|
|
3797
|
+
finally {
|
|
3798
|
+
if (this.#moveController === controller) {
|
|
3799
|
+
this.#moveController = null;
|
|
3800
|
+
this.movePending.set(false);
|
|
3801
|
+
}
|
|
3802
|
+
}
|
|
3803
|
+
}
|
|
3804
|
+
/** Cooperatively aborts the current mutation. A consumer may already have committed its storage change. */
|
|
3805
|
+
cancelMove() {
|
|
3806
|
+
this.#moveController?.abort();
|
|
3807
|
+
this.#moveController = null;
|
|
3808
|
+
this.movePending.set(false);
|
|
3809
|
+
this.moveStatus.set(this.#i18n.t('core.component.file-explorer.move.cancelled'));
|
|
3810
|
+
this.#moveDrag.clear();
|
|
3811
|
+
}
|
|
3812
|
+
/** Repeats failed listing only; never calls onMove again. */
|
|
3813
|
+
async retryMoveRefresh() {
|
|
3814
|
+
if (!this.moveRefreshError() || this.movePending() || this.#destroyed)
|
|
3815
|
+
return false;
|
|
3816
|
+
const controller = new AbortController();
|
|
3817
|
+
this.#moveController = controller;
|
|
3818
|
+
this.movePending.set(true);
|
|
3819
|
+
try {
|
|
3820
|
+
return await this.#refreshMove(controller);
|
|
3821
|
+
}
|
|
3822
|
+
finally {
|
|
3823
|
+
if (this.#moveController === controller) {
|
|
3824
|
+
this.#moveController = null;
|
|
3825
|
+
this.movePending.set(false);
|
|
3826
|
+
}
|
|
3827
|
+
}
|
|
3828
|
+
}
|
|
3829
|
+
async #refreshMove(controller) {
|
|
3830
|
+
await Promise.all(this.#moveRefreshFolders.map(id => this.#load(id)));
|
|
3831
|
+
if (controller.signal.aborted || this.#destroyed)
|
|
3832
|
+
return false;
|
|
3833
|
+
const failed = this.#moveRefreshFolders.some(id => this.#folders().get(id)?.status !== 'loaded');
|
|
3834
|
+
this.moveRefreshError.set(failed);
|
|
3835
|
+
this.moveStatus.set(this.#i18n.t(failed ? 'core.component.file-explorer.move.refresh-error' : 'core.component.file-explorer.move.done'));
|
|
3836
|
+
if (!failed) {
|
|
3837
|
+
this.#moveRefreshFolders = [];
|
|
3838
|
+
if (this.searching())
|
|
3839
|
+
this.#scheduleSearch(true);
|
|
3840
|
+
}
|
|
3841
|
+
return !failed;
|
|
3842
|
+
}
|
|
3843
|
+
#moveAllowed(items, target, source, signal, selectionRequired = false) {
|
|
3844
|
+
const move = this.#config().move;
|
|
3845
|
+
const visible = this.#visibleItems();
|
|
3846
|
+
const known = [...this.#folders().values()].flatMap(folder => folder.items.filter(item => item.kind === 'folder'));
|
|
3847
|
+
if (!move || !sdFileExplorerValidateMove(items, target, known, visible))
|
|
3848
|
+
return false;
|
|
3849
|
+
if (selectionRequired && items.some(item => !this.#eligibleFiles().includes(item)))
|
|
3850
|
+
return false;
|
|
3851
|
+
return sdFileExplorerEligible(move.movable, { items: Object.freeze([...items]), targetFolder: target, source, signal });
|
|
3852
|
+
}
|
|
3853
|
+
openMovePicker(items, event) {
|
|
3854
|
+
if (!this.canMove() || this.movePending() || !items.length)
|
|
3855
|
+
return;
|
|
3856
|
+
const active = this.#document.activeElement;
|
|
3857
|
+
this.#moveReturnFocus = active instanceof HTMLElement ? active : null;
|
|
3858
|
+
const selected = this.selectedItems();
|
|
3859
|
+
this.#movePickerSelectionRequired = items.every(item => selected.includes(item));
|
|
3860
|
+
this.moveTarget.set(null);
|
|
3861
|
+
this.movePickerItems.set(Object.freeze([...items]));
|
|
3862
|
+
event?.stopPropagation();
|
|
3863
|
+
}
|
|
3864
|
+
closeMovePicker() {
|
|
3865
|
+
if (this.movePending())
|
|
3866
|
+
this.cancelMove();
|
|
3867
|
+
this.movePickerItems.set(null);
|
|
3868
|
+
this.#movePickerSelectionRequired = false;
|
|
3869
|
+
const focus = this.#moveReturnFocus;
|
|
3870
|
+
this.#moveReturnFocus = null;
|
|
3871
|
+
if (focus?.isConnected)
|
|
3872
|
+
afterNextRender(() => focus.focus({ preventScroll: true }), { injector: this.#injector });
|
|
3873
|
+
}
|
|
3874
|
+
submitMoveFromEvent(event) {
|
|
3875
|
+
void this.submitMove(event instanceof MouseEvent && event.detail === 0 ? 'keyboard' : 'menu');
|
|
3876
|
+
}
|
|
3877
|
+
async submitMove(source = 'menu') {
|
|
3878
|
+
const items = this.movePickerItems();
|
|
3879
|
+
if (!items)
|
|
3880
|
+
return;
|
|
3881
|
+
if (await this.#performMove(items, this.moveTarget(), source, this.#movePickerSelectionRequired))
|
|
3882
|
+
this.closeMovePicker();
|
|
3883
|
+
}
|
|
3884
|
+
onMoveDragStart(event) {
|
|
3885
|
+
const element = event.target instanceof Element ? event.target : null;
|
|
3886
|
+
if (!element?.closest('.name, .card-name') ||
|
|
3887
|
+
element.closest('button,input,a,.commands,.card-top,.cell--select') ||
|
|
3888
|
+
!event.dataTransfer ||
|
|
3889
|
+
!this.canMove() ||
|
|
3890
|
+
this.movePending()) {
|
|
3891
|
+
event.preventDefault();
|
|
3892
|
+
return;
|
|
3893
|
+
}
|
|
3894
|
+
const id = element.closest('[data-item-id]')?.dataset['itemId'];
|
|
3895
|
+
const file = this.#visibleItems().find(item => item.id === id && item.kind === 'file');
|
|
3896
|
+
if (!file) {
|
|
3897
|
+
event.preventDefault();
|
|
3898
|
+
return;
|
|
3899
|
+
}
|
|
3900
|
+
const selected = this.selectedItems();
|
|
3901
|
+
this.#moveDragSelectionRequired = selected.includes(file);
|
|
3902
|
+
const items = selected.includes(file) ? selected : [file];
|
|
3903
|
+
event.dataTransfer.setData(SD_FILE_EXPLORER_MOVE_MIME, this.#moveDrag.start(items));
|
|
3904
|
+
event.dataTransfer.effectAllowed = 'move';
|
|
3905
|
+
}
|
|
3906
|
+
onMoveDragEnd() {
|
|
3907
|
+
this.#moveDrag.clear();
|
|
3908
|
+
this.#moveDragSelectionRequired = false;
|
|
3909
|
+
this.moveDropTarget.set(undefined);
|
|
3910
|
+
}
|
|
3911
|
+
#internalDropTarget(event) {
|
|
3912
|
+
const element = event.target instanceof Element ? event.target : null;
|
|
3913
|
+
if (element?.closest('sd-file-explorer') !== this.#host.nativeElement)
|
|
3914
|
+
return null;
|
|
3915
|
+
const node = element.closest('[data-move-target]');
|
|
3916
|
+
if (!node)
|
|
3917
|
+
return null;
|
|
3918
|
+
const id = node.dataset['moveTarget'];
|
|
3919
|
+
if (id === '')
|
|
3920
|
+
return { folder: null };
|
|
3921
|
+
const folder = [...this.#itemById().values()].find(item => item.id === id && item.kind === 'folder');
|
|
3922
|
+
return folder ? { folder } : null;
|
|
3923
|
+
}
|
|
2010
3924
|
/**
|
|
2011
3925
|
* Lists the current folder again and drops the cached children of folders that are neither open in the
|
|
2012
|
-
* tree nor on the current path. Re-runs the active search, if any.
|
|
3926
|
+
* tree nor on the current path. Re-runs the active search, if any. Clears the file selection and closes the command
|
|
3927
|
+
* drawer of the compact layout.
|
|
2013
3928
|
*/
|
|
2014
3929
|
reload() {
|
|
3930
|
+
this.#clearSelection();
|
|
3931
|
+
this.#closeCommands();
|
|
2015
3932
|
const keep = new Set([null, this.#currentId(), ...this.#expanded(), ...this.#path().map(folder => folder.id)]);
|
|
2016
3933
|
const folders = new Map(this.#folders());
|
|
2017
3934
|
for (const key of [...folders.keys()]) {
|
|
@@ -2031,6 +3948,9 @@ class SdFileExplorer {
|
|
|
2031
3948
|
// ---- Navigation ----
|
|
2032
3949
|
navigate(folder) {
|
|
2033
3950
|
const id = folder?.id ?? null;
|
|
3951
|
+
if (id !== this.#currentId())
|
|
3952
|
+
this.#clearSelection();
|
|
3953
|
+
this.#closeCommands();
|
|
2034
3954
|
const path = folder ? this.#buildPath(folder) : [];
|
|
2035
3955
|
this.#currentId.set(id);
|
|
2036
3956
|
this.#path.set(path);
|
|
@@ -2126,10 +4046,14 @@ class SdFileExplorer {
|
|
|
2126
4046
|
this.previewState.set({ status: 'error', message: '' });
|
|
2127
4047
|
}
|
|
2128
4048
|
downloadItem(item) {
|
|
2129
|
-
const download = this
|
|
2130
|
-
if (!download)
|
|
4049
|
+
const download = this.#config().download;
|
|
4050
|
+
if (!download || !sdFileExplorerEligible(this.#config().downloadable, item))
|
|
2131
4051
|
return;
|
|
2132
|
-
this.#enqueue('download', item.name, item.parentId, args =>
|
|
4052
|
+
this.#enqueue('download', item.name, item.parentId, args => {
|
|
4053
|
+
if (!sdFileExplorerEligible(this.#config().downloadable, item))
|
|
4054
|
+
throw new Error(this.#i18n.t('core.component.file-explorer.action-unavailable'));
|
|
4055
|
+
return download({ item, ...args });
|
|
4056
|
+
});
|
|
2133
4057
|
this.transfersCollapsed.set(false);
|
|
2134
4058
|
}
|
|
2135
4059
|
downloadPreview() {
|
|
@@ -2142,9 +4066,176 @@ class SdFileExplorer {
|
|
|
2142
4066
|
if (item)
|
|
2143
4067
|
this.openShare(item);
|
|
2144
4068
|
}
|
|
4069
|
+
// ---- Selection ----
|
|
4070
|
+
toggleSelection(item) {
|
|
4071
|
+
const selector = this.#selector();
|
|
4072
|
+
if (!selector || !this.#eligibleFiles().some(file => file.id === item.id))
|
|
4073
|
+
return;
|
|
4074
|
+
// 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.
|
|
4075
|
+
const next = new Set(this.selectedItems().map(file => file.id));
|
|
4076
|
+
if (next.has(item.id))
|
|
4077
|
+
next.delete(item.id);
|
|
4078
|
+
else
|
|
4079
|
+
next.add(item.id);
|
|
4080
|
+
this.#selectedIds.set(next);
|
|
4081
|
+
selector.onSelect?.(item, this.selectedItems());
|
|
4082
|
+
}
|
|
4083
|
+
toggleSelectAll() {
|
|
4084
|
+
const selector = this.#selector();
|
|
4085
|
+
const eligible = this.#eligibleFiles();
|
|
4086
|
+
if (!selector || !eligible.length)
|
|
4087
|
+
return;
|
|
4088
|
+
const all = this.selectedItems().length === eligible.length;
|
|
4089
|
+
this.#selectedIds.set(new Set(all ? [] : eligible.map(item => item.id)));
|
|
4090
|
+
selector.onSelectAll?.(this.selectedItems());
|
|
4091
|
+
}
|
|
4092
|
+
clearSelection() {
|
|
4093
|
+
const active = this.#document.activeElement;
|
|
4094
|
+
if (active instanceof HTMLElement && active.classList.contains('selection-clear') && this.#host.nativeElement.contains(active)) {
|
|
4095
|
+
// Move owned focus before removing the toolbar. A consumer's onClear callback
|
|
4096
|
+
// remains free to move focus elsewhere after the selection is cleared.
|
|
4097
|
+
this.#host.nativeElement.querySelector('.select-all input')?.focus({ preventScroll: true });
|
|
4098
|
+
}
|
|
4099
|
+
this.#clearSelection();
|
|
4100
|
+
}
|
|
4101
|
+
/** Empties the selection, calling `onClear` once when something was selected. */
|
|
4102
|
+
#clearSelection() {
|
|
4103
|
+
if (!this.#selectedIds().size)
|
|
4104
|
+
return;
|
|
4105
|
+
this.#selectedIds.set(new Set());
|
|
4106
|
+
this.#config().selector?.onClear?.();
|
|
4107
|
+
}
|
|
4108
|
+
/** Forgets selected ids that are no longer visible and eligible. Silent: no callback. */
|
|
4109
|
+
#keepEligibleSelection(eligible) {
|
|
4110
|
+
const ids = this.#selectedIds();
|
|
4111
|
+
if (!ids.size)
|
|
4112
|
+
return;
|
|
4113
|
+
const kept = new Set(eligible.filter(item => ids.has(item.id)).map(item => item.id));
|
|
4114
|
+
if (kept.size !== ids.size)
|
|
4115
|
+
this.#selectedIds.set(kept);
|
|
4116
|
+
}
|
|
4117
|
+
// ---- Compact command drawer ----
|
|
4118
|
+
openCommands(item, origin, trigger) {
|
|
4119
|
+
this.#pendingCommand = null;
|
|
4120
|
+
// 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
|
|
4121
|
+
// 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.
|
|
4122
|
+
trigger.focus({ preventScroll: true });
|
|
4123
|
+
this.#commandTarget.set({ id: item.id, origin, trigger });
|
|
4124
|
+
this.commandDrawer()?.show();
|
|
4125
|
+
}
|
|
4126
|
+
/** The user closed the drawer (close button, `Escape`, backdrop). */
|
|
4127
|
+
onCommandsClosed() {
|
|
4128
|
+
const target = this.#commandTarget();
|
|
4129
|
+
if (!target)
|
|
4130
|
+
return;
|
|
4131
|
+
this.#commandTarget.set(null);
|
|
4132
|
+
afterNextRender(() => this.#restoreCommandFocus(target), { injector: this.#injector });
|
|
4133
|
+
}
|
|
4134
|
+
/**
|
|
4135
|
+
* Runs a command pressed in the drawer. The press is checked against the current item, definitions and states: a
|
|
4136
|
+
* stale entry, a state the consumer changed since the last render or a second press runs nothing.
|
|
4137
|
+
*
|
|
4138
|
+
* The drawer closes first, at once. The command runs after the next render: by then the drawer's focus trap is gone
|
|
4139
|
+
* and has handed focus back, so it cannot pull focus away from a dialog or a preview the command opens. Right before
|
|
4140
|
+
* it runs, the same check is made again, and `click` receives the item as listed at that moment.
|
|
4141
|
+
*/
|
|
4142
|
+
runCommand({ command, group }) {
|
|
4143
|
+
const target = this.#commandTarget();
|
|
4144
|
+
if (this.#pendingCommand || !target)
|
|
4145
|
+
return;
|
|
4146
|
+
const pending = { id: target.id, origin: target.origin, leaf: command.definition, group: group?.definition ?? null };
|
|
4147
|
+
if (!this.#runnableItem(pending)) {
|
|
4148
|
+
// 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.
|
|
4149
|
+
this.#commandTarget.set({ ...target });
|
|
4150
|
+
return;
|
|
4151
|
+
}
|
|
4152
|
+
this.#pendingCommand = pending;
|
|
4153
|
+
this.#commandTarget.set(null);
|
|
4154
|
+
this.commandDrawer()?.hide();
|
|
4155
|
+
afterNextRender(() => {
|
|
4156
|
+
if (this.#pendingCommand !== pending)
|
|
4157
|
+
return;
|
|
4158
|
+
this.#pendingCommand = null;
|
|
4159
|
+
this.#restoreCommandFocus(target);
|
|
4160
|
+
// 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
|
|
4161
|
+
// (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.
|
|
4162
|
+
const item = this.#runnableItem(pending);
|
|
4163
|
+
if (item)
|
|
4164
|
+
(pending.leaf.onClick ?? pending.leaf.click)?.(item);
|
|
4165
|
+
}, { injector: this.#injector });
|
|
4166
|
+
}
|
|
4167
|
+
/** Current version of an item, by id, in the list a drawer was opened from (list / grid items or tree folders). */
|
|
4168
|
+
#findCommandItem(id, origin) {
|
|
4169
|
+
if (origin === 'tree')
|
|
4170
|
+
return this.treeNodes().find(node => node.id === id)?.item ?? null;
|
|
4171
|
+
return this.#visibleItems().find(item => item.id === id) ?? null;
|
|
4172
|
+
}
|
|
4173
|
+
/**
|
|
4174
|
+
* The current item when `command` may run now — the item is still listed where the drawer was opened, the pressed
|
|
4175
|
+
* definition and its group are still declared for it, and neither is hidden, disabled or loading — else `null`.
|
|
4176
|
+
*/
|
|
4177
|
+
#runnableItem(command) {
|
|
4178
|
+
const item = this.#findCommandItem(command.id, command.origin);
|
|
4179
|
+
if (!item)
|
|
4180
|
+
return null;
|
|
4181
|
+
const { leaf, group } = command;
|
|
4182
|
+
const definitions = this.#commandDefinitions(item, command.origin);
|
|
4183
|
+
const declared = group ? definitions.includes(group) && group.children.includes(leaf) : definitions.includes(leaf);
|
|
4184
|
+
const blocked = (group !== null && sdFileExplorerActionBlocked(group, item)) || sdFileExplorerActionBlocked(leaf, item);
|
|
4185
|
+
return declared && !blocked ? item : null;
|
|
4186
|
+
}
|
|
4187
|
+
/** Commands of one item in the drawer: the declared ones, or the row shortcuts while `fileCommands` is undeclared. */
|
|
4188
|
+
#commandDefinitions(item, origin) {
|
|
4189
|
+
const option = this.#config();
|
|
4190
|
+
if (item.kind === 'folder')
|
|
4191
|
+
return option.folderCommands ?? [];
|
|
4192
|
+
if (option.fileCommands != null)
|
|
4193
|
+
return option.fileCommands;
|
|
4194
|
+
// 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.
|
|
4195
|
+
return origin === 'list' ? this.#shortcuts().commands : [];
|
|
4196
|
+
}
|
|
4197
|
+
/** Closes the drawer without running anything and drops a pressed command that has not run yet. */
|
|
4198
|
+
#closeCommands() {
|
|
4199
|
+
this.#pendingCommand = null;
|
|
4200
|
+
const target = this.#commandTarget();
|
|
4201
|
+
if (!target)
|
|
4202
|
+
return;
|
|
4203
|
+
this.#commandTarget.set(null);
|
|
4204
|
+
this.commandDrawer()?.hide();
|
|
4205
|
+
afterNextRender(() => this.#restoreCommandFocus(target), { injector: this.#injector });
|
|
4206
|
+
}
|
|
4207
|
+
/**
|
|
4208
|
+
* After the drawer closed: when its focus trap could not give focus back — the trigger left the page with its row,
|
|
4209
|
+
* or the layout changed — focus the item's row, card or tree tab stop, the first item, or the search box.
|
|
4210
|
+
*/
|
|
4211
|
+
#restoreCommandFocus(target) {
|
|
4212
|
+
const active = this.#document.activeElement;
|
|
4213
|
+
if (this.#destroyed || (active && active !== this.#document.body))
|
|
4214
|
+
return;
|
|
4215
|
+
const host = this.#host.nativeElement;
|
|
4216
|
+
const items = Array.from(host.querySelectorAll('[data-item-id]'));
|
|
4217
|
+
const candidates = [
|
|
4218
|
+
target.trigger.isConnected ? target.trigger : null,
|
|
4219
|
+
target.origin === 'tree'
|
|
4220
|
+
? host.querySelector('[role="treeitem"][tabindex="0"]')
|
|
4221
|
+
: (items.find(element => element.dataset['itemId'] === target.id) ?? null),
|
|
4222
|
+
items[0] ?? null,
|
|
4223
|
+
this.searchInput()?.nativeElement ?? null,
|
|
4224
|
+
];
|
|
4225
|
+
for (const candidate of candidates) {
|
|
4226
|
+
candidate?.focus({ preventScroll: true });
|
|
4227
|
+
if (candidate && this.#document.activeElement === candidate)
|
|
4228
|
+
return;
|
|
4229
|
+
}
|
|
4230
|
+
}
|
|
2145
4231
|
// ---- Search ----
|
|
2146
4232
|
onKeywordInput(value) {
|
|
4233
|
+
const before = this.#trimmedKeyword();
|
|
2147
4234
|
this.keyword.set(value);
|
|
4235
|
+
if (this.#trimmedKeyword() !== before) {
|
|
4236
|
+
this.#clearSelection();
|
|
4237
|
+
this.#closeCommands();
|
|
4238
|
+
}
|
|
2148
4239
|
this.#scheduleSearch(false);
|
|
2149
4240
|
}
|
|
2150
4241
|
clearSearch() {
|
|
@@ -2159,16 +4250,26 @@ class SdFileExplorer {
|
|
|
2159
4250
|
this.uploadFiles(files);
|
|
2160
4251
|
}
|
|
2161
4252
|
uploadFiles(files) {
|
|
2162
|
-
|
|
2163
|
-
|
|
4253
|
+
if (this.movePending())
|
|
4254
|
+
return;
|
|
4255
|
+
const upload = this.#config().upload;
|
|
4256
|
+
if (!upload || files.length === 0 || !sdFileExplorerEligible(this.#config().uploadable, { parentId: this.#currentId() }))
|
|
2164
4257
|
return;
|
|
2165
4258
|
const parentId = this.#currentId();
|
|
2166
4259
|
for (const file of files) {
|
|
2167
|
-
this.#enqueue('upload', file.name, parentId, args =>
|
|
4260
|
+
this.#enqueue('upload', file.name, parentId, args => {
|
|
4261
|
+
if (!sdFileExplorerEligible(this.#config().uploadable, { parentId }))
|
|
4262
|
+
throw new Error(this.#i18n.t('core.component.file-explorer.action-unavailable'));
|
|
4263
|
+
return upload({ file, parentId, ...args });
|
|
4264
|
+
});
|
|
2168
4265
|
}
|
|
2169
4266
|
this.transfersCollapsed.set(false);
|
|
2170
4267
|
}
|
|
2171
4268
|
onDragEnter(event) {
|
|
4269
|
+
if (event.dataTransfer?.types.includes(SD_FILE_EXPLORER_MOVE_MIME)) {
|
|
4270
|
+
this.onDragOver(event);
|
|
4271
|
+
return;
|
|
4272
|
+
}
|
|
2172
4273
|
if (!this.#acceptsDrag(event))
|
|
2173
4274
|
return;
|
|
2174
4275
|
event.preventDefault();
|
|
@@ -2176,6 +4277,20 @@ class SdFileExplorer {
|
|
|
2176
4277
|
this.dragActive.set(true);
|
|
2177
4278
|
}
|
|
2178
4279
|
onDragOver(event) {
|
|
4280
|
+
if (event.dataTransfer?.types.includes(SD_FILE_EXPLORER_MOVE_MIME)) {
|
|
4281
|
+
const target = this.#internalDropTarget(event);
|
|
4282
|
+
const items = this.#moveDrag.activeItems;
|
|
4283
|
+
const allowed = !event.dataTransfer.types.includes('Files') &&
|
|
4284
|
+
!!items &&
|
|
4285
|
+
!!target &&
|
|
4286
|
+
!this.movePending() &&
|
|
4287
|
+
this.#moveAllowed(items, target.folder, 'drag', new AbortController().signal, this.#moveDragSelectionRequired);
|
|
4288
|
+
if (target && items && allowed)
|
|
4289
|
+
event.preventDefault();
|
|
4290
|
+
event.dataTransfer.dropEffect = allowed ? 'move' : 'none';
|
|
4291
|
+
this.moveDropTarget.set(allowed ? (target.folder?.id ?? null) : undefined);
|
|
4292
|
+
return;
|
|
4293
|
+
}
|
|
2179
4294
|
if (!this.#acceptsDrag(event))
|
|
2180
4295
|
return;
|
|
2181
4296
|
event.preventDefault();
|
|
@@ -2191,6 +4306,17 @@ class SdFileExplorer {
|
|
|
2191
4306
|
this.dragActive.set(false);
|
|
2192
4307
|
}
|
|
2193
4308
|
onDrop(event) {
|
|
4309
|
+
if (event.dataTransfer?.types.includes(SD_FILE_EXPLORER_MOVE_MIME)) {
|
|
4310
|
+
event.preventDefault();
|
|
4311
|
+
const target = this.#internalDropTarget(event);
|
|
4312
|
+
const items = this.#moveDrag.resolve(event.dataTransfer.getData(SD_FILE_EXPLORER_MOVE_MIME));
|
|
4313
|
+
const mixed = event.dataTransfer.types.includes('Files') || event.dataTransfer.files.length > 0;
|
|
4314
|
+
const selectionRequired = this.#moveDragSelectionRequired;
|
|
4315
|
+
this.onMoveDragEnd();
|
|
4316
|
+
if (items && target && !mixed)
|
|
4317
|
+
void this.#performMove(items, target.folder, 'drag', selectionRequired);
|
|
4318
|
+
return;
|
|
4319
|
+
}
|
|
2194
4320
|
if (!this.#acceptsDrag(event))
|
|
2195
4321
|
return;
|
|
2196
4322
|
event.preventDefault();
|
|
@@ -2212,6 +4338,8 @@ class SdFileExplorer {
|
|
|
2212
4338
|
}
|
|
2213
4339
|
retryTransfer(id) {
|
|
2214
4340
|
const job = this.#jobs.get(id);
|
|
4341
|
+
if (job?.direction === 'upload' && this.movePending())
|
|
4342
|
+
return;
|
|
2215
4343
|
const status = this.#statusOf(id);
|
|
2216
4344
|
if (!job || (status !== 'error' && status !== 'cancelled'))
|
|
2217
4345
|
return;
|
|
@@ -2248,7 +4376,7 @@ class SdFileExplorer {
|
|
|
2248
4376
|
}
|
|
2249
4377
|
// ---- Share ----
|
|
2250
4378
|
openShare(item) {
|
|
2251
|
-
if (!this
|
|
4379
|
+
if (!this.#config().share || !sdFileExplorerEligible(this.#config().shareable, item))
|
|
2252
4380
|
return;
|
|
2253
4381
|
const active = this.#document.activeElement;
|
|
2254
4382
|
this.#shareReturnFocus = active instanceof HTMLElement && this.#host.nativeElement.contains(active) ? active : null;
|
|
@@ -2298,8 +4426,8 @@ class SdFileExplorer {
|
|
|
2298
4426
|
}
|
|
2299
4427
|
}
|
|
2300
4428
|
async #loadShareLink(item) {
|
|
2301
|
-
const share = this
|
|
2302
|
-
if (!share)
|
|
4429
|
+
const share = this.#config().share;
|
|
4430
|
+
if (!share || !sdFileExplorerEligible(this.#config().shareable, item))
|
|
2303
4431
|
return;
|
|
2304
4432
|
this.#shareController?.abort();
|
|
2305
4433
|
const controller = new AbortController();
|
|
@@ -2338,9 +4466,11 @@ class SdFileExplorer {
|
|
|
2338
4466
|
}
|
|
2339
4467
|
async submitFolder(event) {
|
|
2340
4468
|
event.preventDefault();
|
|
2341
|
-
|
|
4469
|
+
if (this.movePending())
|
|
4470
|
+
return;
|
|
4471
|
+
const create = this.#config().createFolder;
|
|
2342
4472
|
const name = this.folderName().trim();
|
|
2343
|
-
if (!create || !name || this.folderSubmitting())
|
|
4473
|
+
if (!create || !name || this.folderSubmitting() || !sdFileExplorerEligible(this.#config().creatable, { parentId: this.#currentId() }))
|
|
2344
4474
|
return;
|
|
2345
4475
|
const parentId = this.#currentId();
|
|
2346
4476
|
this.folderSubmitting.set(true);
|
|
@@ -2367,7 +4497,11 @@ class SdFileExplorer {
|
|
|
2367
4497
|
onEscape(event) {
|
|
2368
4498
|
if (event.defaultPrevented)
|
|
2369
4499
|
return;
|
|
2370
|
-
if (this.
|
|
4500
|
+
if (this.movePickerItems())
|
|
4501
|
+
this.closeMovePicker();
|
|
4502
|
+
else if (this.movePending())
|
|
4503
|
+
this.cancelMove();
|
|
4504
|
+
else if (this.folderDialogOpen())
|
|
2371
4505
|
this.closeFolderDialog();
|
|
2372
4506
|
else if (this.shareItem())
|
|
2373
4507
|
this.closeShare();
|
|
@@ -2386,6 +4520,8 @@ class SdFileExplorer {
|
|
|
2386
4520
|
}
|
|
2387
4521
|
// ---- Internals: folders ----
|
|
2388
4522
|
#resetNavigation() {
|
|
4523
|
+
this.#clearSelection();
|
|
4524
|
+
this.#closeCommands();
|
|
2389
4525
|
for (const controller of this.#listControllers.values())
|
|
2390
4526
|
controller.abort();
|
|
2391
4527
|
this.#listControllers.clear();
|
|
@@ -2414,7 +4550,7 @@ class SdFileExplorer {
|
|
|
2414
4550
|
const previous = this.#folders().get(parentId);
|
|
2415
4551
|
this.#setFolder(parentId, { status: 'loading', items: previous?.loaded ? previous.items : [], loaded: !!previous?.loaded });
|
|
2416
4552
|
try {
|
|
2417
|
-
const items = await this
|
|
4553
|
+
const items = await this.#config().list({ parentId, signal: controller.signal });
|
|
2418
4554
|
if (controller.signal.aborted || this.#destroyed)
|
|
2419
4555
|
return;
|
|
2420
4556
|
this.#setFolder(parentId, { status: 'loaded', items: Array.isArray(items) ? items : [], loaded: true });
|
|
@@ -2459,7 +4595,7 @@ class SdFileExplorer {
|
|
|
2459
4595
|
this.#searchController?.abort();
|
|
2460
4596
|
this.#searchController = null;
|
|
2461
4597
|
const keyword = this.#trimmedKeyword();
|
|
2462
|
-
const search = this
|
|
4598
|
+
const search = this.#config().search;
|
|
2463
4599
|
if (!keyword || !search) {
|
|
2464
4600
|
this.#search.set(null);
|
|
2465
4601
|
return;
|
|
@@ -2473,19 +4609,19 @@ class SdFileExplorer {
|
|
|
2473
4609
|
}
|
|
2474
4610
|
async #runSearch(keyword, parentId) {
|
|
2475
4611
|
this.#searchTimer = null;
|
|
2476
|
-
const search = this
|
|
4612
|
+
const search = this.#config().search;
|
|
2477
4613
|
if (!search)
|
|
2478
4614
|
return;
|
|
2479
4615
|
const controller = new AbortController();
|
|
2480
4616
|
this.#searchController = controller;
|
|
2481
4617
|
try {
|
|
2482
4618
|
const items = await search({ parentId, keyword, signal: controller.signal });
|
|
2483
|
-
if (controller.signal.aborted || this.#destroyed)
|
|
4619
|
+
if (controller.signal.aborted || this.#destroyed || this.#config().search !== search)
|
|
2484
4620
|
return;
|
|
2485
4621
|
this.#search.set({ keyword, parentId, status: 'loaded', items: Array.isArray(items) ? items : [] });
|
|
2486
4622
|
}
|
|
2487
4623
|
catch (error) {
|
|
2488
|
-
if (controller.signal.aborted || this.#destroyed)
|
|
4624
|
+
if (controller.signal.aborted || this.#destroyed || this.#config().search !== search)
|
|
2489
4625
|
return;
|
|
2490
4626
|
this.#search.set({ keyword, parentId, status: 'error', items: [], error });
|
|
2491
4627
|
}
|
|
@@ -2495,6 +4631,10 @@ class SdFileExplorer {
|
|
|
2495
4631
|
}
|
|
2496
4632
|
}
|
|
2497
4633
|
#clearSearch() {
|
|
4634
|
+
if (this.#trimmedKeyword()) {
|
|
4635
|
+
this.#clearSelection();
|
|
4636
|
+
this.#closeCommands();
|
|
4637
|
+
}
|
|
2498
4638
|
this.keyword.set('');
|
|
2499
4639
|
this.#scheduleSearch(false);
|
|
2500
4640
|
}
|
|
@@ -2503,9 +4643,9 @@ class SdFileExplorer {
|
|
|
2503
4643
|
this.#releasePreview();
|
|
2504
4644
|
const kind = sdFileExplorerPreviewKind(sdFileExplorerFileType(item));
|
|
2505
4645
|
const fallback = () => kind === 'image' && item.thumbnailUrl ? { status: 'image', url: item.thumbnailUrl } : { status: 'unavailable' };
|
|
2506
|
-
const preview = this
|
|
4646
|
+
const preview = this.#config().preview;
|
|
2507
4647
|
// why: định dạng không có renderer thì KHÔNG gọi callback — tránh tải cả file chỉ để hiện fallback.
|
|
2508
|
-
if (kind === 'none' || !preview) {
|
|
4648
|
+
if (kind === 'none' || !preview || !sdFileExplorerEligible(this.#config().previewable, item)) {
|
|
2509
4649
|
this.previewState.set(kind === 'none' ? { status: 'unavailable' } : fallback());
|
|
2510
4650
|
return;
|
|
2511
4651
|
}
|
|
@@ -2655,7 +4795,11 @@ class SdFileExplorer {
|
|
|
2655
4795
|
// ---- Internals: DOM helpers ----
|
|
2656
4796
|
#acceptsDrag(event) {
|
|
2657
4797
|
const types = event.dataTransfer?.types;
|
|
2658
|
-
return this.canUpload() &&
|
|
4798
|
+
return (this.canUpload() &&
|
|
4799
|
+
!this.uploadDisabled() &&
|
|
4800
|
+
!!types &&
|
|
4801
|
+
!Array.from(types).includes(SD_FILE_EXPLORER_MOVE_MIME) &&
|
|
4802
|
+
Array.from(types).includes('Files'));
|
|
2659
4803
|
}
|
|
2660
4804
|
#droppedFiles(transfer) {
|
|
2661
4805
|
if (!transfer)
|
|
@@ -2682,6 +4826,10 @@ class SdFileExplorer {
|
|
|
2682
4826
|
}
|
|
2683
4827
|
#teardown() {
|
|
2684
4828
|
this.#destroyed = true;
|
|
4829
|
+
this.#moveController?.abort();
|
|
4830
|
+
this.#moveDrag.clear();
|
|
4831
|
+
// A command pressed right before the explorer goes away never runs; sd-side-drawer releases its own scroll lock.
|
|
4832
|
+
this.#pendingCommand = null;
|
|
2685
4833
|
this.#resizeObserver?.disconnect();
|
|
2686
4834
|
for (const controller of this.#listControllers.values())
|
|
2687
4835
|
controller.abort();
|
|
@@ -2700,16 +4848,22 @@ class SdFileExplorer {
|
|
|
2700
4848
|
this.#shareController?.abort();
|
|
2701
4849
|
}
|
|
2702
4850
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdFileExplorer, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2703
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdFileExplorer, isStandalone: true, selector: "sd-file-explorer", inputs: { option: { classPropertyName: "option", publicName: "option", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { open: "open" }, host: { listeners: { "dragenter": "onDragEnter($event)", "dragover": "onDragOver($event)", "dragleave": "onDragLeave()", "drop": "onDrop($event)", "keydown.escape": "onEscape($event)" }, properties: { "class.sd-file-explorer--compact": "compact()", "class.sd-file-explorer--dragging": "dragActive()", "attr.data-autoid": "autoId()" }, classAttribute: "sd-file-explorer" }, viewQueries: [{ propertyName: "searchInput", first: true, predicate: ["searchInput"], descendants: true, isSignal: true }, { propertyName: "folderInput", first: true, predicate: ["folderInput"], descendants: true, isSignal: true }, { propertyName: "newFolderButton", first: true, predicate: ["newFolderButton"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "copyButton", first: true, predicate: ["copyButton"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "shareInput", first: true, predicate: ["shareInput"], descendants: true, isSignal: true }, { propertyName: "shareDialog", first: true, predicate: ["shareDialog"], descendants: true, isSignal: true }, { propertyName: "sidebar", first: true, predicate: ["sidebar"], descendants: true, isSignal: true }], ngImport: i0, template: "@let _option = option();\n@let _compact = compact();\n@let _autoId = autoId();\n@let _canUpload = canUpload();\n@let _canDownload = canDownload();\n@let _view = view();\n@let _state = contentState();\n@let _keyword = keyword();\n@let _sidebarOpen = sidebarOpen();\n@let _preview = previewView();\n@let _transfers = transferViews();\n@let _heading = heading();\n@let _searching = searching();\n@let _collapsed = transfersCollapsed();\n@let _dialogOpen = folderDialogOpen();\n@let _shareItem = shareItem();\n@let _canShare = canShare();\n@let _modalOpen = _dialogOpen || !!_shareItem;\n\n<header class=\"header\" [attr.inert]=\"_modalOpen ? '' : null\">\n @if (_option.title) {\n <div class=\"brand\">\n <span class=\"brand-icon\" aria-hidden=\"true\">\n <sd-icon name=\"folder\" size=\"20px\" />\n </span>\n <div class=\"brand-text\">\n <h2 class=\"brand-title\" [title]=\"_option.title\">{{ _option.title }}</h2>\n @if (_option.description) {\n <p class=\"brand-description\">{{ _option.description }}</p>\n }\n </div>\n </div>\n }\n\n <div class=\"search\" role=\"search\">\n <sd-icon class=\"search-icon\" name=\"search\" size=\"20px\" />\n <input\n #searchInput\n type=\"search\"\n class=\"search-input\"\n autocomplete=\"off\"\n [value]=\"_keyword\"\n [placeholder]=\"'core.component.file-explorer.search-placeholder' | sdTranslate\"\n [attr.aria-label]=\"'core.component.file-explorer.search-placeholder' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-search' : null\"\n (input)=\"onKeywordInput(searchInput.value)\" />\n @if (_keyword) {\n <button\n type=\"button\"\n class=\"search-clear\"\n [attr.aria-label]=\"'core.component.file-explorer.search-clear' | sdTranslate\"\n [title]=\"'core.component.file-explorer.search-clear' | sdTranslate\"\n (click)=\"clearSearch()\">\n <sd-icon name=\"close\" size=\"18px\" />\n </button>\n }\n </div>\n\n @if (_canUpload) {\n <sd-button\n class=\"upload-button\"\n type=\"fill\"\n color=\"primary\"\n size=\"md\"\n prefixIcon=\"file_upload\"\n [title]=\"_compact ? undefined : ('core.component.file-explorer.upload' | sdTranslate)\"\n [tooltip]=\"_compact ? ('core.component.file-explorer.upload' | sdTranslate) : undefined\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-upload' : null\"\n (click)=\"fileInput.click()\" />\n <input\n #fileInput\n type=\"file\"\n class=\"file-input\"\n multiple\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-file-input' : null\"\n (change)=\"onFilesPicked(fileInput)\" />\n }\n</header>\n\n<!-- why: dialog ph\u1EE7 c\u1EA3 explorer n\u00EAn l\u00E0m inert c\u1EA3 v\u00F9ng n\u00E0y, k\u1EC3 c\u1EA3 drawer chi ti\u1EBFt \u0111ang n\u1EB1m trong .main. -->\n<div class=\"body\" [attr.inert]=\"_modalOpen ? '' : null\">\n @if (_compact && _sidebarOpen) {\n <div class=\"scrim scrim--sidebar\" aria-hidden=\"true\" (click)=\"sidebarOpen.set(false)\"></div>\n }\n <aside\n #sidebar\n class=\"sidebar\"\n [class.sidebar--open]=\"_sidebarOpen\"\n [id]=\"instanceId + '-sidebar'\"\n [attr.aria-label]=\"'core.component.file-explorer.folders' | sdTranslate\"\n [attr.inert]=\"_compact && !_sidebarOpen ? '' : null\">\n <p class=\"sidebar-label\">{{ 'core.component.file-explorer.folders' | sdTranslate }}</p>\n <div class=\"sidebar-tree\">\n <sd-file-explorer-folder-tree\n [nodes]=\"treeNodes()\"\n [label]=\"'core.component.file-explorer.tree-label' | sdTranslate\"\n (select)=\"onTreeSelect($event)\"\n (toggle)=\"onTreeToggle($event)\"\n (retry)=\"onTreeRetry($event)\" />\n </div>\n @if (canCreateFolder()) {\n <div class=\"sidebar-footer\">\n <sd-button\n #newFolderButton\n class=\"new-folder-button\"\n type=\"outline\"\n color=\"secondary\"\n size=\"md\"\n prefixIcon=\"add\"\n block\n [title]=\"'core.component.file-explorer.new-folder' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-new-folder' : null\"\n (click)=\"openFolderDialog()\" />\n </div>\n }\n </aside>\n\n <!-- why: .main l\u00E0 [container] c\u1EE7a drawer chi ti\u1EBFt \u2014 backdrop ch\u1EC9 ph\u1EE7 v\u00F9ng b\u00EAn ph\u1EA3i, c\u00E2y th\u01B0 m\u1EE5c v\u1EABn d\u00F9ng \u0111\u01B0\u1EE3c.\n Drawer n\u1EB1m TRONG ph\u1EA7n t\u1EED n\u00E0y n\u00EAn inert \u0111\u1EB7t tr\u00EAn t\u1EEBng kh\u1ED1i con, kh\u00F4ng \u0111\u1EB7t tr\u00EAn .main. -->\n <section #mainRegion class=\"main\" [attr.aria-label]=\"_heading\">\n @if (refreshing()) {\n <div class=\"refresh-bar\" aria-hidden=\"true\"></div>\n }\n <div class=\"toolbar\" [attr.inert]=\"_preview ? '' : null\">\n @if (_compact) {\n <button\n type=\"button\"\n class=\"icon-button\"\n [attr.aria-expanded]=\"_sidebarOpen\"\n [attr.aria-controls]=\"instanceId + '-sidebar'\"\n [attr.aria-label]=\"\n (_sidebarOpen ? 'core.component.file-explorer.close-folders' : 'core.component.file-explorer.open-folders') | sdTranslate\n \"\n [attr.data-autoid]=\"_autoId ? _autoId + '-menu' : null\"\n (click)=\"toggleSidebar()\">\n <sd-icon name=\"menu\" size=\"24px\" />\n </button>\n }\n <sd-breadcrumb\n class=\"breadcrumb\"\n [items]=\"breadcrumb().items\"\n [maxItems]=\"_compact ? 3 : 5\"\n [ariaLabel]=\"'core.component.file-explorer.breadcrumb' | sdTranslate\"\n (sdItemActivate)=\"onBreadcrumb($event)\" />\n <div class=\"view-toggle\" role=\"group\" [attr.aria-label]=\"'core.component.file-explorer.view' | sdTranslate\">\n <button\n type=\"button\"\n class=\"icon-button icon-button--toggle\"\n [class.icon-button--active]=\"_view === 'list'\"\n [attr.aria-pressed]=\"_view === 'list'\"\n [attr.aria-label]=\"'core.component.file-explorer.view-list' | sdTranslate\"\n [title]=\"'core.component.file-explorer.view-list' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-view-list' : null\"\n (click)=\"setView('list')\">\n <sd-icon name=\"format_list_bulleted\" size=\"24px\" />\n </button>\n <button\n type=\"button\"\n class=\"icon-button icon-button--toggle\"\n [class.icon-button--active]=\"_view === 'grid'\"\n [attr.aria-pressed]=\"_view === 'grid'\"\n [attr.aria-label]=\"'core.component.file-explorer.view-grid' | sdTranslate\"\n [title]=\"'core.component.file-explorer.view-grid' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-view-grid' : null\"\n (click)=\"setView('grid')\">\n <sd-icon name=\"grid_view\" size=\"24px\" />\n </button>\n </div>\n </div>\n\n <div class=\"heading-row\" [attr.inert]=\"_preview ? '' : null\">\n <h3 class=\"heading\" [title]=\"_heading\">{{ _heading }}</h3>\n @if (_state === 'items') {\n <span class=\"count\">{{ itemCountLabel() }}</span>\n }\n </div>\n\n <div class=\"scroller\" [attr.inert]=\"_preview ? '' : null\">\n @switch (_state) {\n @case ('loading') {\n <sd-data-state\n state=\"loading\"\n compact\n [title]=\"(_searching ? 'core.component.file-explorer.search-loading' : 'core.component.file-explorer.loading') | sdTranslate\" />\n }\n @case ('error') {\n <sd-data-state\n state=\"error\"\n retryable\n [title]=\"(_searching ? 'core.component.file-explorer.search-error' : 'core.component.file-explorer.load-error') | sdTranslate\"\n [message]=\"errorMessage()\"\n [retryLabel]=\"'core.component.file-explorer.retry' | sdTranslate\"\n (sdRetry)=\"retryContent()\" />\n }\n @case ('empty') {\n <sd-data-state\n state=\"empty\"\n [icon]=\"_searching ? 'search_off' : 'folder_open'\"\n [title]=\"emptyTitle()\"\n [message]=\"emptyMessage()\" />\n }\n @default {\n <sd-file-explorer-item-list\n [items]=\"itemViews()\"\n [view]=\"_view\"\n [canDownload]=\"_canDownload\"\n [canShare]=\"_canShare\"\n [compact]=\"_compact\"\n [activeId]=\"_preview ? _preview.item.id : null\"\n [label]=\"_heading\"\n (activate)=\"onActivate($event)\"\n (download)=\"downloadItem($event.item)\"\n (share)=\"openShare($event.item)\" />\n }\n }\n </div>\n </section>\n</div>\n\n@if (_transfers.length) {\n <sd-file-explorer-transfer-panel\n class=\"transfers\"\n [attr.inert]=\"_modalOpen ? '' : null\"\n [transfers]=\"_transfers\"\n [title]=\"transfersTitle()\"\n [collapsed]=\"_collapsed\"\n [canClear]=\"canClearTransfers()\"\n [compact]=\"_compact\"\n [autoId]=\"_autoId ? _autoId + '-transfers' : undefined\"\n (toggleCollapsed)=\"transfersCollapsed.set(!_collapsed)\"\n (clear)=\"clearFinishedTransfers()\"\n (cancel)=\"cancelTransfer($event)\"\n (retry)=\"retryTransfer($event)\"\n (dismiss)=\"dismissTransfer($event)\" />\n}\n\n<!-- why: chi ti\u1EBFt file l\u00E0 sd-side-drawer th\u1EADt, m\u1EDF g\u1ECDn trong v\u00F9ng danh s\u00E1ch b\u00EAn ph\u1EA3i nh\u1EDD [container]:\n header (t\u00ECm ki\u1EBFm, t\u1EA3i l\u00EAn), c\u00E2y th\u01B0 m\u1EE5c v\u00E0 h\u00E0ng ch\u1EDD truy\u1EC1n t\u1EA3i v\u1EABn d\u00F9ng \u0111\u01B0\u1EE3c khi drawer m\u1EDF. -->\n<sd-file-explorer-preview-panel\n [view]=\"_preview\"\n [state]=\"previewState()\"\n [meta]=\"previewMeta()\"\n [canDownload]=\"_canDownload\"\n [canShare]=\"_canShare\"\n [container]=\"mainRegion\"\n [autoId]=\"_autoId ? _autoId + '-preview' : undefined\"\n (close)=\"closePreview()\"\n (download)=\"downloadPreview()\"\n (share)=\"sharePreview()\"\n (retry)=\"retryPreview()\"\n (imageError)=\"onPreviewImageError()\" />\n\n@if (dragActive()) {\n <div class=\"drop-overlay\" aria-hidden=\"true\">\n <div class=\"drop-card\">\n <sd-icon name=\"file_upload\" size=\"40px\" />\n <p class=\"drop-title\">{{ dropTitle() }}</p>\n </div>\n </div>\n}\n\n@if (_dialogOpen) {\n @let _folderName = folderName();\n @let _folderError = folderError();\n <div class=\"dialog-backdrop\" aria-hidden=\"true\" (click)=\"closeFolderDialog()\"></div>\n <form\n class=\"dialog\"\n role=\"dialog\"\n aria-modal=\"true\"\n novalidate\n [attr.aria-labelledby]=\"instanceId + '-folder-title'\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-folder-dialog' : null\"\n (submit)=\"submitFolder($event)\">\n <h3 class=\"dialog-title\" [id]=\"instanceId + '-folder-title'\">{{ folderDialogTitle() }}</h3>\n <label class=\"field-label\" [for]=\"instanceId + '-folder-name'\">{{\n 'core.component.file-explorer.new-folder-name' | sdTranslate\n }}</label>\n <input\n #folderInput\n class=\"field-input\"\n autocomplete=\"off\"\n maxlength=\"255\"\n [id]=\"instanceId + '-folder-name'\"\n [value]=\"_folderName\"\n [attr.aria-invalid]=\"_folderError ? true : null\"\n [attr.aria-describedby]=\"_folderError ? instanceId + '-folder-error' : null\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-folder-name' : null\"\n (input)=\"folderName.set(folderInput.value)\" />\n @if (_folderError) {\n <p class=\"field-error\" role=\"alert\" [id]=\"instanceId + '-folder-error'\">{{ _folderError }}</p>\n }\n <div class=\"dialog-actions\">\n <sd-button\n class=\"cancel-button\"\n type=\"text\"\n color=\"secondary\"\n size=\"md\"\n [title]=\"'core.component.file-explorer.cancel' | sdTranslate\"\n (click)=\"closeFolderDialog()\" />\n <sd-button\n class=\"submit-button\"\n type=\"fill\"\n color=\"primary\"\n size=\"md\"\n htmlType=\"submit\"\n [title]=\"'core.component.file-explorer.create' | sdTranslate\"\n [disabled]=\"!_folderName.trim()\"\n [loading]=\"folderSubmitting()\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-folder-submit' : null\" />\n </div>\n </form>\n}\n\n@if (_shareItem) {\n @let _shareState = shareState();\n <div class=\"dialog-backdrop\" aria-hidden=\"true\" (click)=\"closeShare()\"></div>\n <div\n #shareDialog\n class=\"dialog\"\n role=\"dialog\"\n aria-modal=\"true\"\n tabindex=\"-1\"\n [attr.aria-labelledby]=\"instanceId + '-share-title'\"\n [attr.aria-busy]=\"_shareState.status === 'loading' ? true : null\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-share-dialog' : null\">\n <h3 class=\"dialog-title\" [id]=\"instanceId + '-share-title'\" [title]=\"_shareItem.name\">{{ shareTitle() }}</h3>\n @switch (_shareState.status) {\n @case ('loading') {\n <p class=\"share-status\" role=\"status\">\n <span class=\"spinner\" aria-hidden=\"true\"></span>\n {{ 'core.component.file-explorer.share.loading' | sdTranslate }}\n </p>\n }\n @case ('error') {\n <p class=\"field-error\" role=\"alert\">{{ _shareState.message }}</p>\n }\n @case ('ready') {\n <label class=\"field-label\" [for]=\"instanceId + '-share-link'\">{{ 'core.component.file-explorer.share.link' | sdTranslate }}</label>\n <input\n #shareInput\n class=\"field-input\"\n readonly\n [id]=\"instanceId + '-share-link'\"\n [value]=\"_shareState.url\"\n [attr.aria-describedby]=\"instanceId + '-share-feedback'\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-share-link' : null\"\n (focus)=\"shareInput.select()\" />\n <p class=\"share-feedback\" role=\"status\" aria-live=\"polite\" [id]=\"instanceId + '-share-feedback'\">{{ shareFeedbackLabel() }}</p>\n }\n }\n <div class=\"dialog-actions\">\n <sd-button\n class=\"close-button\"\n type=\"text\"\n color=\"secondary\"\n size=\"md\"\n [title]=\"'core.component.file-explorer.close' | sdTranslate\"\n (click)=\"closeShare()\" />\n @if (_shareState.status === 'error') {\n <sd-button\n class=\"retry-button\"\n type=\"outline\"\n color=\"primary\"\n size=\"md\"\n prefixIcon=\"refresh\"\n [title]=\"'core.component.file-explorer.retry' | sdTranslate\"\n (click)=\"retryShare()\" />\n } @else {\n <sd-button\n #copyButton\n class=\"copy-button\"\n type=\"fill\"\n color=\"primary\"\n size=\"md\"\n prefixIcon=\"content_copy\"\n [title]=\"\n (shareFeedback() === 'copied' ? 'core.component.file-explorer.share.copied' : 'core.component.file-explorer.share.copy')\n | sdTranslate\n \"\n [disabled]=\"_shareState.status !== 'ready'\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-share-copy' : null\"\n (click)=\"copyShareLink()\" />\n }\n </div>\n </div>\n}\n", styles: [":host{--sd-fe-accent: var(--sd-file-explorer-accent, var(--sd-primary, #005cbb));--sd-fe-accent-strong: var(--sd-file-explorer-accent-strong, color-mix(in srgb, var(--sd-fe-accent) 84%, var(--sd-file-explorer-mix-shade, #000000)));--sd-fe-accent-contrast: var(--sd-file-explorer-accent-contrast, var(--sd-primary-contrast, #ffffff));--sd-fe-accent-soft: var(--sd-file-explorer-accent-soft, color-mix(in srgb, var(--sd-fe-accent) 10%, var(--sd-file-explorer-mix-tint, #ffffff)));--sd-fe-surface: var(--sd-file-explorer-surface, #ffffff);--sd-fe-sidebar-bg: var(--sd-file-explorer-sidebar-bg, color-mix(in srgb, var(--sd-surface-muted, #e7e8ed) 26%, var(--sd-fe-surface)));--sd-fe-muted-surface: var( --sd-file-explorer-muted-surface, color-mix(in srgb, var(--sd-surface-muted, #e7e8ed) 50%, var(--sd-fe-surface)) );--sd-fe-preview-bg: var(--sd-file-explorer-preview-bg, color-mix(in srgb, var(--sd-fe-accent) 9%, var(--sd-file-explorer-mix-tint, #ffffff)));--sd-fe-border: var(--sd-file-explorer-border, color-mix(in srgb, var(--sd-border, #c4c6d0) 55%, var(--sd-file-explorer-mix-tint, #ffffff)));--sd-fe-border-strong: var(--sd-file-explorer-border-strong, var(--sd-border, #c4c6d0));--sd-fe-text: var(--sd-file-explorer-text, var(--sd-text, #1a1b1f));--sd-fe-text-secondary: var(--sd-file-explorer-text-secondary, color-mix(in srgb, var(--sd-text-secondary, #44474f) 84%, var(--sd-file-explorer-mix-tint, #ffffff)));--sd-fe-hover: color-mix(in srgb, var(--sd-fe-text) 4%, transparent);--sd-fe-hover-strong: color-mix(in srgb, var(--sd-fe-text) 8%, transparent);--sd-fe-track: color-mix(in srgb, var(--sd-fe-text) 7%, var(--sd-fe-surface));--sd-fe-success: var(--sd-file-explorer-success, var(--sd-success, #2e7d32));--sd-fe-error: var(--sd-file-explorer-error, var(--sd-error, #ba1a1a));--sd-fe-radius: var(--sd-file-explorer-radius, 16px);--sd-fe-scrim: var(--sd-file-explorer-scrim, rgba(0, 0, 0, .4));--sd-side-drawer-contained-z-index: 9;position:relative;display:flex;flex-direction:column;height:100%;min-height:480px;overflow:hidden;border:1px solid var(--sd-fe-border);border-radius:var(--sd-fe-radius);background:var(--sd-fe-surface);color:var(--sd-fe-text);font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-line-height-20, 20px)}.header{display:grid;grid-template-columns:fit-content(320px) minmax(0,1fr) auto;align-items:center;gap:12px 20px;padding:16px 20px;border-bottom:1px solid var(--sd-fe-border)}.brand{grid-column:1;display:flex;align-items:center;gap:10px;min-width:0}.brand-icon{flex:none;display:grid;place-items:center;width:32px;height:32px;border-radius:50%;background:color-mix(in srgb,var(--sd-fe-accent) 14%,var(--sd-file-explorer-mix-tint, #ffffff));color:var(--sd-fe-accent)}.brand-text{min-width:0}.brand-title{margin:0;overflow:hidden;font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-semibold, 600);line-height:var(--sd-line-height-22, 22px);text-overflow:ellipsis;white-space:nowrap}.brand-description{margin:0;overflow:hidden;font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-line-height-16, 16px);color:var(--sd-fe-text-secondary);text-overflow:ellipsis;white-space:nowrap}.search{grid-column:2;justify-self:center;display:flex;align-items:center;gap:8px;width:100%;max-width:520px;height:36px;padding:0 6px 0 12px;border:1px solid var(--sd-fe-border);border-radius:var(--sd-radius-999, 999px);background:var(--sd-fe-muted-surface);transition:border-color var(--sd-duration-fast, .12s) ease,box-shadow var(--sd-duration-fast, .12s) ease}.search:focus-within{border-color:var(--sd-fe-accent);background:var(--sd-fe-surface);box-shadow:0 0 0 3px var(--sd-fe-accent-soft)}.search-icon{flex:none;color:var(--sd-fe-text-secondary)}.search-input{flex:1;min-width:0;height:100%;padding:0;border:0;outline:none;background:transparent;color:var(--sd-fe-text);font:inherit;font-size:var(--sd-font-size-14, 14px)}.search-input::placeholder{color:var(--sd-fe-text-secondary)}.search-input::-webkit-search-cancel-button{display:none}.search-clear{flex:none;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;border:0;border-radius:var(--sd-radius-999, 999px);background:transparent;color:var(--sd-fe-text-secondary);cursor:pointer}.search-clear:hover{background:var(--sd-fe-hover-strong)}.upload-button{grid-column:3;justify-self:end}.file-input{display:none}.body{position:relative;flex:1;min-height:0;display:grid;grid-template-columns:238px minmax(0,1fr)}.sidebar{display:flex;flex-direction:column;min-height:0;padding:22px 14px 32px 12px;border-right:1px solid var(--sd-fe-border);background:var(--sd-fe-sidebar-bg)}.sidebar-label{margin:0 0 6px 10px;font-size:var(--sd-font-size-12, 12px);font-weight:var(--sd-font-weight-bold, 700);line-height:var(--sd-line-height-16, 16px);letter-spacing:.04em;text-transform:uppercase;color:var(--sd-fe-text-secondary)}.sidebar-tree{flex:1;min-height:0;margin:0 -4px;padding:2px 4px;overflow-y:auto}.sidebar-footer{margin:12px 4px 0;padding-top:18px;border-top:1px solid var(--sd-fe-border)}.new-folder-button{display:block}.main{position:relative;display:flex;flex-direction:column;min-width:0;min-height:0;padding-top:14px}.refresh-bar{position:absolute;top:0;left:0;right:0;height:2px;overflow:hidden;background:var(--sd-fe-accent-soft)}.refresh-bar:after{content:\"\";position:absolute;top:0;bottom:0;width:30%;background:var(--sd-fe-accent);animation:sd-file-explorer-refresh 1.2s ease-in-out infinite}.toolbar{display:flex;align-items:center;gap:12px;min-height:40px;padding:0 32px}.breadcrumb{flex:1;min-width:0;margin-left:-4px;font-size:var(--sd-font-size-15, 15px);font-weight:var(--sd-font-weight-semibold, 600)}.view-toggle{flex:none;display:flex;gap:2px;padding:2px;border:1px solid var(--sd-fe-border);border-radius:var(--sd-radius-999, 999px);background:var(--sd-fe-surface)}.icon-button{flex:none;display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;padding:0;border:0;border-radius:var(--sd-radius-999, 999px);background:transparent;color:var(--sd-fe-text-secondary);cursor:pointer}.icon-button:hover{background:var(--sd-fe-hover-strong);color:var(--sd-fe-text)}.icon-button:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-file-explorer-accent, var(--sd-focus-ring-color, var(--sd-primary)));outline-offset:1px}.icon-button--toggle{width:40px;height:32px}.icon-button--active,.icon-button--active:hover{background:var(--sd-fe-accent-soft);color:var(--sd-fe-accent)}.heading-row{display:flex;align-items:flex-end;justify-content:space-between;gap:12px;margin-top:10px;padding:0 32px}.heading{min-width:0;margin:0;overflow:hidden;font-size:var(--sd-font-size-18, 18px);font-weight:var(--sd-font-weight-bold, 700);line-height:26px;text-overflow:ellipsis;white-space:nowrap}.count{flex:none;padding-bottom:12px;font-size:var(--sd-font-size-13, 13px);color:var(--sd-fe-text-secondary)}.scroller{flex:1;min-height:0;padding:8px 28px 16px;overflow-y:auto}.scrim{position:absolute;inset:0;background:var(--sd-fe-scrim);animation:sd-file-explorer-fade .18s ease}.transfers{flex:none;border-top:1px solid var(--sd-fe-border);background:var(--sd-fe-surface)}.drop-overlay{position:absolute;inset:0;z-index:10;display:flex;align-items:center;justify-content:center;padding:16px;border:2px dashed var(--sd-fe-accent);border-radius:var(--sd-fe-radius);background:color-mix(in srgb,var(--sd-fe-accent) 8%,rgba(255,255,255,.86));pointer-events:none}.drop-card{display:flex;flex-direction:column;align-items:center;gap:10px;color:var(--sd-fe-accent);text-align:center}.drop-title{margin:0;font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-semibold, 600)}.dialog-backdrop{position:absolute;inset:0;z-index:20;background:var(--sd-fe-scrim)}.dialog{position:absolute;top:50%;left:50%;z-index:21;display:flex;flex-direction:column;gap:8px;width:min(400px,100% - 32px);padding:20px;border-radius:14px;background:var(--sd-fe-surface);box-shadow:0 18px 48px #0f172a2e;transform:translate(-50%,-50%)}.dialog:focus{outline:none}.dialog-title{margin:0 0 8px;font-size:17px;font-weight:var(--sd-font-weight-semibold, 600);line-height:var(--sd-line-height-24, 24px)}.field-label{font-size:var(--sd-font-size-13, 13px);color:var(--sd-fe-text-secondary)}.field-input{height:40px;padding:0 12px;border:1px solid var(--sd-fe-border-strong);border-radius:var(--sd-radius-8, 8px);background:var(--sd-fe-surface);color:var(--sd-fe-text);font:inherit;font-size:var(--sd-font-size-15, 15px);outline:none}.field-input:focus{border-color:var(--sd-fe-accent);box-shadow:0 0 0 3px var(--sd-fe-accent-soft)}.field-input[aria-invalid=true]{border-color:var(--sd-fe-error)}.field-error{margin:0;font-size:var(--sd-font-size-13, 13px);color:var(--sd-fe-error)}.dialog-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:12px}.share-status{display:flex;align-items:center;gap:10px;margin:4px 0;font-size:var(--sd-font-size-14, 14px);color:var(--sd-fe-text-secondary)}.share-feedback{min-height:18px;margin:0;font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-18, 18px);color:var(--sd-fe-success)}.spinner{flex:none;width:18px;height:18px;border:2px solid color-mix(in srgb,var(--sd-fe-accent) 20%,transparent);border-top-color:var(--sd-fe-accent);border-radius:50%;animation:sd-file-explorer-spin .8s linear infinite}:host(.sd-file-explorer--compact) .header{grid-template-columns:minmax(0,1fr) auto;gap:10px 12px;padding:12px 14px}:host(.sd-file-explorer--compact) .brand{grid-row:1;gap:10px}:host(.sd-file-explorer--compact) .upload-button{grid-column:2;grid-row:1}:host(.sd-file-explorer--compact) .search{grid-column:1/-1;grid-row:2;max-width:none}:host(.sd-file-explorer--compact) .header:not(:has(.brand)) .search{grid-column:1;grid-row:1}:host(.sd-file-explorer--compact) .body{grid-template-columns:minmax(0,1fr)}:host(.sd-file-explorer--compact) .sidebar{position:absolute;top:0;bottom:0;left:0;z-index:5;width:min(300px,86%);border-right:1px solid var(--sd-fe-border);box-shadow:12px 0 32px #0f172a1f;visibility:hidden;transform:translate(-100%);transition:transform var(--sd-duration-base, .2s) ease,visibility var(--sd-duration-base, .2s)}:host(.sd-file-explorer--compact) .sidebar--open{visibility:visible;transform:none}:host(.sd-file-explorer--compact) .scrim--sidebar{z-index:4}:host(.sd-file-explorer--compact) .main{padding-top:8px}:host(.sd-file-explorer--compact) .toolbar{gap:6px;min-height:36px;padding:0 12px 0 10px}:host(.sd-file-explorer--compact) .breadcrumb{margin-left:0}:host(.sd-file-explorer--compact) .icon-button--toggle{width:36px}:host(.sd-file-explorer--compact) .heading-row{margin-top:13px;padding:0 14px}:host(.sd-file-explorer--compact) .count{padding-bottom:8px}:host(.sd-file-explorer--compact) .scroller{padding:0 12px 12px}@keyframes sd-file-explorer-spin{to{transform:rotate(360deg)}}@keyframes sd-file-explorer-fade{0%{opacity:0}}@keyframes sd-file-explorer-refresh{0%{left:-30%}to{left:100%}}@media(prefers-reduced-motion:reduce){.scrim{animation:none}.search,:host(.sd-file-explorer--compact) .sidebar{transition:none}}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "component", type: SdBreadcrumb, selector: "sd-breadcrumb", inputs: ["items", "maxItems", "ariaLabel", "separator"], outputs: ["sdItemActivate"] }, { kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "openOnHover", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "component", type: SdDataState, selector: "sd-data-state", inputs: ["state", "title", "message", "icon", "fontSet", "iconShape", "retryable", "retryLabel", "actionLabel", "compact", "fullPage"], outputs: ["sdRetry", "sdAction"] }, { kind: "component", type: SdFileExplorerFolderTree, selector: "sd-file-explorer-folder-tree", inputs: ["nodes", "label"], outputs: ["select", "toggle", "retry"] }, { kind: "component", type: SdFileExplorerItemList, selector: "sd-file-explorer-item-list", inputs: ["items", "view", "canDownload", "canShare", "compact", "activeId", "label"], outputs: ["activate", "download", "share"] }, { kind: "component", type: SdFileExplorerPreviewPanel, selector: "sd-file-explorer-preview-panel", inputs: ["view", "state", "meta", "canDownload", "canShare", "container", "autoId"], outputs: ["close", "download", "share", "retry", "imageError"] }, { kind: "component", type: SdFileExplorerTransferPanel, selector: "sd-file-explorer-transfer-panel", inputs: ["transfers", "title", "collapsed", "canClear", "compact", "autoId"], outputs: ["toggleCollapsed", "clear", "cancel", "retry", "dismiss"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
4851
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.5", type: SdFileExplorer, isStandalone: true, selector: "sd-file-explorer", inputs: { option: { classPropertyName: "option", publicName: "option", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { open: "open" }, host: { listeners: { "dragenter": "onDragEnter($event)", "dragover": "onDragOver($event)", "dragleave": "onDragLeave()", "drop": "onDrop($event)", "dragstart": "onMoveDragStart($event)", "dragend": "onMoveDragEnd()", "keydown.escape": "onEscape($event)" }, properties: { "class.sd-file-explorer--compact": "compact()", "class.sd-file-explorer--touch": "touch()", "class.sd-file-explorer--dragging": "dragActive()", "attr.data-autoid": "autoId()" }, classAttribute: "sd-file-explorer" }, queries: [{ propertyName: "columnDefs", predicate: SdFileExplorerColumnDef, isSignal: true }], viewQueries: [{ propertyName: "searchInput", first: true, predicate: ["searchInput"], descendants: true, isSignal: true }, { propertyName: "folderInput", first: true, predicate: ["folderInput"], descendants: true, isSignal: true }, { propertyName: "newFolderButton", first: true, predicate: ["newFolderButton"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "copyButton", first: true, predicate: ["copyButton"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "shareInput", first: true, predicate: ["shareInput"], descendants: true, isSignal: true }, { propertyName: "shareDialog", first: true, predicate: ["shareDialog"], descendants: true, isSignal: true }, { propertyName: "sidebar", first: true, predicate: ["sidebar"], descendants: true, isSignal: true }, { propertyName: "commandDrawer", first: true, predicate: SdFileExplorerCommandSheet, descendants: true, isSignal: true }], ngImport: i0, template: "@let _option = option();\n@let _compact = compact();\n@let _autoId = autoId();\n@let _canUpload = canUpload();\n@let _canDownload = canDownload();\n@let _view = view();\n@let _state = contentState();\n@let _keyword = keyword();\n@let _sidebarOpen = sidebarOpen();\n@let _preview = previewView();\n@let _transfers = transferViews();\n@let _heading = heading();\n@let _searching = searching();\n@let _collapsed = transfersCollapsed();\n@let _dialogOpen = folderDialogOpen();\n@let _shareItem = shareItem();\n@let _canShare = canShare();\n@let _modalOpen = _dialogOpen || !!_shareItem || !!movePickerItems();\n@let _touch = touch();\n@let _rowShortcuts = rowShortcuts();\n\n<header class=\"header\" [attr.inert]=\"_modalOpen ? '' : null\">\n @if (_option.title) {\n <div class=\"brand\">\n <span class=\"brand-icon\" aria-hidden=\"true\">\n <sd-icon name=\"folder\" size=\"20px\" />\n </span>\n <div class=\"brand-text\">\n <h2 class=\"brand-title\" [title]=\"_option.title\">{{ _option.title }}</h2>\n @if (_option.description) {\n <p class=\"brand-description\">{{ _option.description }}</p>\n }\n </div>\n </div>\n }\n\n <div class=\"search\" role=\"search\">\n <sd-icon class=\"search-icon\" name=\"search\" size=\"20px\" />\n <input\n #searchInput\n type=\"search\"\n class=\"search-input\"\n autocomplete=\"off\"\n [value]=\"_keyword\"\n [placeholder]=\"'core.component.file-explorer.search-placeholder' | sdTranslate\"\n [attr.aria-label]=\"'core.component.file-explorer.search-placeholder' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-search' : null\"\n (input)=\"onKeywordInput(searchInput.value)\" />\n @if (_keyword) {\n <button\n type=\"button\"\n class=\"search-clear\"\n [attr.aria-label]=\"'core.component.file-explorer.search-clear' | sdTranslate\"\n [title]=\"'core.component.file-explorer.search-clear' | sdTranslate\"\n (click)=\"clearSearch()\">\n <sd-icon name=\"close\" size=\"18px\" />\n </button>\n }\n </div>\n\n @if (_canUpload) {\n <sd-button\n class=\"upload-button\"\n [disabled]=\"uploadDisabled()\"\n [attr.aria-description]=\"uploadDisabled() ? ('core.component.file-explorer.action-unavailable' | sdTranslate) : null\"\n type=\"fill\"\n color=\"primary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n prefixIcon=\"file_upload\"\n [title]=\"_compact ? undefined : ('core.component.file-explorer.upload' | sdTranslate)\"\n [tooltip]=\"_compact ? ('core.component.file-explorer.upload' | sdTranslate) : undefined\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-upload' : null\"\n (click)=\"fileInput.click()\" />\n <input\n #fileInput\n type=\"file\"\n class=\"file-input\"\n multiple\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-file-input' : null\"\n (change)=\"onFilesPicked(fileInput)\" />\n }\n</header>\n\n@if (moveStatus()) {\n <sd-inform class=\"move-status\" color=\"secondary\" [hideIcon]=\"true\" [title]=\"moveStatus()!\">\n @if (moveRefreshError()) {\n <sd-button\n sdInformAction\n class=\"move-retry-button\"\n type=\"light\"\n color=\"primary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n htmlType=\"button\"\n [title]=\"'core.component.file-explorer.move.retry-refresh' | sdTranslate\"\n [disabled]=\"movePending()\"\n (click)=\"retryMoveRefresh()\" />\n }\n </sd-inform>\n}\n\n<!-- why: dialog ph\u1EE7 c\u1EA3 explorer n\u00EAn l\u00E0m inert c\u1EA3 v\u00F9ng n\u00E0y, k\u1EC3 c\u1EA3 drawer chi ti\u1EBFt \u0111ang n\u1EB1m trong .main. -->\n<div class=\"body\" [attr.inert]=\"_modalOpen ? '' : null\">\n @if (_compact && _sidebarOpen) {\n <div class=\"scrim scrim--sidebar\" aria-hidden=\"true\" (click)=\"sidebarOpen.set(false)\"></div>\n }\n <aside\n #sidebar\n class=\"sidebar\"\n [class.sidebar--open]=\"_sidebarOpen\"\n [id]=\"instanceId + '-sidebar'\"\n [attr.aria-label]=\"'core.component.file-explorer.folders' | sdTranslate\"\n [attr.inert]=\"_compact && !_sidebarOpen ? '' : null\">\n <p class=\"sidebar-label\">{{ 'core.component.file-explorer.folders' | sdTranslate }}</p>\n <div class=\"sidebar-tree\">\n <sd-file-explorer-folder-tree\n [nodes]=\"treeNodes()\"\n [moveDropTarget]=\"moveDropTarget()\"\n [label]=\"'core.component.file-explorer.tree-label' | sdTranslate\"\n [commands]=\"_option.folderCommands\"\n [touch]=\"_touch\"\n [compact]=\"_compact\"\n [menuOpenId]=\"treeMenuOpenId()\"\n (select)=\"onTreeSelect($event)\"\n (toggle)=\"onTreeToggle($event)\"\n (retry)=\"onTreeRetry($event)\"\n (openCommands)=\"openCommands($event.item, 'tree', $event.trigger)\" />\n </div>\n @if (canCreateFolder()) {\n <div class=\"sidebar-footer\">\n <sd-button\n #newFolderButton\n class=\"new-folder-button\"\n [disabled]=\"createDisabled()\"\n [attr.aria-description]=\"createDisabled() ? ('core.component.file-explorer.action-unavailable' | sdTranslate) : null\"\n type=\"outline\"\n color=\"secondary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n prefixIcon=\"add\"\n block\n [title]=\"'core.component.file-explorer.new-folder' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-new-folder' : null\"\n (click)=\"openFolderDialog()\" />\n </div>\n }\n </aside>\n\n <!-- why: .main l\u00E0 [container] c\u1EE7a drawer chi ti\u1EBFt \u2014 backdrop ch\u1EC9 ph\u1EE7 v\u00F9ng b\u00EAn ph\u1EA3i, c\u00E2y th\u01B0 m\u1EE5c v\u1EABn d\u00F9ng \u0111\u01B0\u1EE3c.\n Drawer n\u1EB1m TRONG ph\u1EA7n t\u1EED n\u00E0y n\u00EAn inert \u0111\u1EB7t tr\u00EAn t\u1EEBng kh\u1ED1i con, kh\u00F4ng \u0111\u1EB7t tr\u00EAn .main. -->\n <section #mainRegion class=\"main\" [attr.aria-label]=\"_heading\">\n @if (refreshing()) {\n <div class=\"refresh-bar\" aria-hidden=\"true\"></div>\n }\n <div class=\"toolbar\" [attr.inert]=\"_preview ? '' : null\">\n @if (_compact) {\n <button\n type=\"button\"\n class=\"icon-button\"\n [attr.aria-expanded]=\"_sidebarOpen\"\n [attr.aria-controls]=\"instanceId + '-sidebar'\"\n [attr.aria-label]=\"\n (_sidebarOpen ? 'core.component.file-explorer.close-folders' : 'core.component.file-explorer.open-folders') | sdTranslate\n \"\n [attr.data-autoid]=\"_autoId ? _autoId + '-menu' : null\"\n (click)=\"toggleSidebar()\">\n <sd-icon name=\"menu\" size=\"24px\" />\n </button>\n }\n <sd-breadcrumb\n class=\"breadcrumb\"\n [items]=\"breadcrumb().items\"\n [maxItems]=\"_compact ? 3 : 5\"\n [ariaLabel]=\"'core.component.file-explorer.breadcrumb' | sdTranslate\"\n (sdItemActivate)=\"onBreadcrumb($event)\" />\n @if (_state === 'items') {\n <span class=\"count\">{{ itemCountLabel() }}</span>\n }\n <div class=\"view-toggle\" role=\"group\" [attr.aria-label]=\"'core.component.file-explorer.view' | sdTranslate\">\n <button\n type=\"button\"\n class=\"icon-button icon-button--toggle\"\n [class.icon-button--active]=\"_view === 'list'\"\n [attr.aria-pressed]=\"_view === 'list'\"\n [attr.aria-label]=\"'core.component.file-explorer.view-list' | sdTranslate\"\n [title]=\"'core.component.file-explorer.view-list' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-view-list' : null\"\n (click)=\"setView('list')\">\n <sd-icon name=\"format_list_bulleted\" size=\"24px\" />\n </button>\n <button\n type=\"button\"\n class=\"icon-button icon-button--toggle\"\n [class.icon-button--active]=\"_view === 'grid'\"\n [attr.aria-pressed]=\"_view === 'grid'\"\n [attr.aria-label]=\"'core.component.file-explorer.view-grid' | sdTranslate\"\n [title]=\"'core.component.file-explorer.view-grid' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-view-grid' : null\"\n (click)=\"setView('grid')\">\n <sd-icon name=\"grid_view\" size=\"24px\" />\n </button>\n </div>\n </div>\n\n @let _selection = selectionView();\n @if (_selection && selectedItems().length) {\n @let _selected = selectedItems();\n @let _selectedCount = _selected.length;\n @let _summary = selectionSummary();\n @let _clearLabel = 'core.component.file-explorer.selection.clear' | sdTranslate;\n <!-- why: one band for list and grid. The select-all checkbox lives in the list header / above the grid, not here. -->\n <div\n class=\"selection\"\n role=\"group\"\n [class.selection--active]=\"_selectedCount > 0\"\n [attr.aria-label]=\"'core.component.file-explorer.selection.label' | sdTranslate\"\n [attr.inert]=\"_preview ? '' : null\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-selection' : null\">\n <div class=\"selection-summary\">\n <!-- why: one plain sentence in the translated word order (\"2 t\u1EC7p \u0111\u00E3 ch\u1ECDn\", \"\u5DF2\u9009\u62E9 2 \u4E2A\u6587\u4EF6\"); only the number is\n heavier. Each part sits in its own span: the markup whitespace between spans is dropped, so the sentence\n keeps exactly the spaces of its translation (\"2\u4EF6\u2026\" stays joined). -->\n <span class=\"selection-status\" role=\"status\">\n <span>{{ _summary.before }}</span>\n @if (_summary.count) {\n <span class=\"selection-count\">{{ _summary.count }}</span>\n }\n <span>{{ _summary.after }}</span>\n </span>\n <button\n type=\"button\"\n class=\"icon-button selection-clear\"\n [disabled]=\"!_selectedCount\"\n [attr.aria-label]=\"_clearLabel\"\n [matTooltip]=\"_clearLabel\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-selection-clear' : null\"\n (click)=\"clearSelection()\">\n <sd-icon name=\"close\" size=\"20px\" />\n </button>\n </div>\n @if (_selectedCount && selectionActions().length) {\n <!-- why: unset types follow the kind (light flat action, text group trigger). sd-button's own sizes: 32 px like the\n row commands, 48 px only on a wide touch layout; a narrow layout keeps 32 px and spaces the lines instead. -->\n <sd-file-explorer-actions\n class=\"selection-actions\"\n source=\"selector.actions\"\n defaultLeafType=\"light\"\n defaultGroupType=\"text\"\n defaultColor=\"primary\"\n [actions]=\"selectionActions()\"\n [context]=\"_selected\"\n [size]=\"_touch && !_compact ? 'lg' : 'sm'\"\n [autoId]=\"_autoId ? _autoId + '-selection-action' : undefined\" />\n }\n </div>\n }\n\n <div class=\"scroller\" [attr.inert]=\"_preview ? '' : null\">\n @switch (_state) {\n @case ('loading') {\n <sd-data-state\n state=\"loading\"\n compact\n [title]=\"(_searching ? 'core.component.file-explorer.search-loading' : 'core.component.file-explorer.loading') | sdTranslate\" />\n }\n @case ('error') {\n <sd-data-state\n state=\"error\"\n retryable\n [title]=\"(_searching ? 'core.component.file-explorer.search-error' : 'core.component.file-explorer.load-error') | sdTranslate\"\n [message]=\"errorMessage()\"\n [retryLabel]=\"'core.component.file-explorer.retry' | sdTranslate\"\n (sdRetry)=\"retryContent()\" />\n }\n @case ('empty') {\n <sd-data-state\n state=\"empty\"\n [icon]=\"_searching ? 'search_off' : 'folder_open'\"\n [title]=\"emptyTitle()\"\n [message]=\"emptyMessage()\" />\n }\n @default {\n <sd-file-explorer-item-list\n [columns]=\"columns()\"\n [moveDropTarget]=\"moveDropTarget()\"\n [canMove]=\"canMove()\"\n [movePending]=\"movePending()\"\n (move)=\"openMovePicker([$event])\"\n [items]=\"itemViews()\"\n [view]=\"_view\"\n [canDownload]=\"_canDownload && _rowShortcuts\"\n [canShare]=\"_canShare && _rowShortcuts\"\n [compact]=\"_compact\"\n [touch]=\"_touch\"\n [activeId]=\"_preview ? _preview.item.id : null\"\n [label]=\"_heading\"\n [selection]=\"_selection\"\n [fileCommands]=\"_option.fileCommands\"\n [folderCommands]=\"_option.folderCommands\"\n [menuOpenId]=\"itemsMenuOpenId()\"\n (activate)=\"onActivate($event)\"\n (download)=\"downloadItem($event.item)\"\n (share)=\"openShare($event.item)\"\n (toggleSelect)=\"toggleSelection($event)\"\n (toggleSelectAll)=\"toggleSelectAll()\"\n (openCommands)=\"openCommands($event.item, _view, $event.trigger)\" />\n }\n }\n </div>\n </section>\n</div>\n\n@if (_transfers.length) {\n <sd-file-explorer-transfer-panel\n class=\"transfers\"\n [attr.inert]=\"_modalOpen ? '' : null\"\n [transfers]=\"_transfers\"\n [title]=\"transfersTitle()\"\n [collapsed]=\"_collapsed\"\n [canClear]=\"canClearTransfers()\"\n [compact]=\"_compact\"\n [autoId]=\"_autoId ? _autoId + '-transfers' : undefined\"\n (toggleCollapsed)=\"transfersCollapsed.set(!_collapsed)\"\n (clear)=\"clearFinishedTransfers()\"\n (cancel)=\"cancelTransfer($event)\"\n (retry)=\"retryTransfer($event)\"\n (dismiss)=\"dismissTransfer($event)\" />\n}\n\n<!-- why: chi ti\u1EBFt file l\u00E0 sd-side-drawer th\u1EADt, m\u1EDF g\u1ECDn trong v\u00F9ng danh s\u00E1ch b\u00EAn ph\u1EA3i nh\u1EDD [container]:\n header (t\u00ECm ki\u1EBFm, t\u1EA3i l\u00EAn), c\u00E2y th\u01B0 m\u1EE5c v\u00E0 h\u00E0ng ch\u1EDD truy\u1EC1n t\u1EA3i v\u1EABn d\u00F9ng \u0111\u01B0\u1EE3c khi drawer m\u1EDF. -->\n<sd-file-explorer-preview-panel\n [view]=\"_preview\"\n [compact]=\"_compact\"\n [state]=\"previewState()\"\n [meta]=\"previewMeta()\"\n [canDownload]=\"_canDownload\"\n [canShare]=\"_canShare\"\n [container]=\"mainRegion\"\n [autoId]=\"_autoId ? _autoId + '-preview' : undefined\"\n (close)=\"closePreview()\"\n (download)=\"downloadPreview()\"\n (share)=\"sharePreview()\"\n (retry)=\"retryPreview()\"\n (imageError)=\"onPreviewImageError()\" />\n\n<!-- why: l\u1EC7nh c\u1EE7a m\u1ED9t m\u1EE5c tr\u00EAn layout h\u1EB9p m\u1EDF trong sd-side-drawer th\u1EADt c\u1EE7a Core (g\u1EAFn v\u00E0o <body>: backdrop, Esc, b\u1EABy focus,\n kho\u00E1 scroll trang) thay cho c\u00E1c n\u00FAt tr\u00EAn h\u00E0ng / th\u1EBB / n\u00FAt c\u00E2y. -->\n<sd-file-explorer-command-sheet\n [sheet]=\"commandSheet()\"\n [touch]=\"_touch\"\n [autoId]=\"_autoId ? _autoId + '-commands' : undefined\"\n (activate)=\"runCommand($event)\"\n (close)=\"onCommandsClosed()\" />\n\n@if (dragActive()) {\n <div class=\"drop-overlay\" aria-hidden=\"true\">\n <div class=\"drop-card\">\n <sd-icon name=\"file_upload\" size=\"40px\" />\n <p class=\"drop-title\">{{ dropTitle() }}</p>\n </div>\n </div>\n}\n\n@if (_dialogOpen) {\n @let _folderName = folderName();\n @let _folderError = folderError();\n <div class=\"dialog-backdrop\" aria-hidden=\"true\" (click)=\"closeFolderDialog()\"></div>\n <form\n class=\"dialog\"\n role=\"dialog\"\n aria-modal=\"true\"\n novalidate\n [attr.aria-labelledby]=\"instanceId + '-folder-title'\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-folder-dialog' : null\"\n (submit)=\"submitFolder($event)\">\n <h3 class=\"dialog-title\" [id]=\"instanceId + '-folder-title'\">{{ folderDialogTitle() }}</h3>\n <label class=\"field-label\" [for]=\"instanceId + '-folder-name'\">{{\n 'core.component.file-explorer.new-folder-name' | sdTranslate\n }}</label>\n <input\n #folderInput\n class=\"field-input\"\n autocomplete=\"off\"\n maxlength=\"255\"\n [id]=\"instanceId + '-folder-name'\"\n [value]=\"_folderName\"\n [attr.aria-invalid]=\"_folderError ? true : null\"\n [attr.aria-describedby]=\"_folderError ? instanceId + '-folder-error' : null\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-folder-name' : null\"\n (input)=\"folderName.set(folderInput.value)\" />\n @if (_folderError) {\n <sd-inform class=\"field-error\" color=\"error\" [hideIcon]=\"true\" [id]=\"instanceId + '-folder-error'\" [title]=\"_folderError\" />\n }\n <div class=\"dialog-actions\">\n <sd-button\n class=\"cancel-button\"\n type=\"text\"\n color=\"secondary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n [title]=\"'core.component.file-explorer.cancel' | sdTranslate\"\n (click)=\"closeFolderDialog()\" />\n <sd-button\n class=\"submit-button\"\n type=\"fill\"\n color=\"primary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n htmlType=\"submit\"\n [title]=\"'core.component.file-explorer.create' | sdTranslate\"\n [disabled]=\"!_folderName.trim()\"\n [loading]=\"folderSubmitting()\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-folder-submit' : null\" />\n </div>\n </form>\n}\n\n@if (movePickerItems()) {\n <div class=\"dialog-backdrop\" aria-hidden=\"true\" (click)=\"closeMovePicker()\"></div>\n <section\n class=\"dialog move-picker\"\n role=\"dialog\"\n aria-modal=\"true\"\n cdkTrapFocus\n [cdkTrapFocusAutoCapture]=\"true\"\n (keydown.tab)=\"$event.stopPropagation()\"\n (keydown.shift.tab)=\"$event.stopPropagation()\"\n [attr.aria-labelledby]=\"instanceId + '-move-title'\">\n <h3 cdkFocusInitial tabindex=\"-1\" [id]=\"instanceId + '-move-title'\">{{ 'core.component.file-explorer.move.to' | sdTranslate }}</h3>\n <sd-file-explorer-folder-tree\n [nodes]=\"movePickerNodes()\"\n [label]=\"'core.component.file-explorer.folders' | sdTranslate\"\n [touch]=\"_touch\"\n [compact]=\"false\"\n (select)=\"moveTarget.set($event.item)\"\n (toggle)=\"onTreeToggle($event)\"\n (retry)=\"onTreeRetry($event)\" />\n @if (!canSubmitMove() && !movePending()) {\n <sd-inform\n class=\"field-error move-destination-tip\"\n type=\"tip\"\n color=\"secondary\"\n [hideIcon]=\"true\"\n [title]=\"'core.component.file-explorer.move.destination-tip' | sdTranslate\" />\n }\n <div class=\"dialog-actions\">\n <sd-button\n class=\"move-cancel-button\"\n type=\"text\"\n color=\"secondary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n htmlType=\"button\"\n [title]=\"'core.component.file-explorer.cancel' | sdTranslate\"\n (click)=\"closeMovePicker()\" />\n <sd-button\n class=\"move-submit-button\"\n type=\"fill\"\n color=\"primary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n htmlType=\"button\"\n [title]=\"'core.component.file-explorer.move.confirm' | sdTranslate\"\n [disabled]=\"!canSubmitMove()\"\n (click)=\"submitMoveFromEvent($event)\" />\n </div>\n </section>\n}\n\n@if (_shareItem) {\n @let _shareState = shareState();\n <div class=\"dialog-backdrop\" aria-hidden=\"true\" (click)=\"closeShare()\"></div>\n <div\n #shareDialog\n class=\"dialog\"\n role=\"dialog\"\n aria-modal=\"true\"\n tabindex=\"-1\"\n [attr.aria-labelledby]=\"instanceId + '-share-title'\"\n [attr.aria-busy]=\"_shareState.status === 'loading' ? true : null\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-share-dialog' : null\">\n <h3 class=\"dialog-title\" [id]=\"instanceId + '-share-title'\" [title]=\"_shareItem.name\">{{ shareTitle() }}</h3>\n @switch (_shareState.status) {\n @case ('loading') {\n <p class=\"share-status\" role=\"status\">\n <span class=\"spinner\" aria-hidden=\"true\"></span>\n {{ 'core.component.file-explorer.share.loading' | sdTranslate }}\n </p>\n }\n @case ('error') {\n <sd-inform class=\"field-error\" color=\"error\" [hideIcon]=\"true\" [title]=\"_shareState.message\" />\n }\n @case ('ready') {\n <label class=\"field-label\" [for]=\"instanceId + '-share-link'\">{{ 'core.component.file-explorer.share.link' | sdTranslate }}</label>\n <input\n #shareInput\n class=\"field-input\"\n readonly\n [id]=\"instanceId + '-share-link'\"\n [value]=\"_shareState.url\"\n [attr.aria-describedby]=\"instanceId + '-share-feedback'\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-share-link' : null\"\n (focus)=\"shareInput.select()\" />\n <p class=\"share-feedback\" role=\"status\" aria-live=\"polite\" [id]=\"instanceId + '-share-feedback'\">{{ shareFeedbackLabel() }}</p>\n }\n }\n <div class=\"dialog-actions\">\n <sd-button\n class=\"close-button\"\n type=\"text\"\n color=\"secondary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n [title]=\"'core.component.file-explorer.close' | sdTranslate\"\n (click)=\"closeShare()\" />\n @if (_shareState.status === 'error') {\n <sd-button\n class=\"retry-button\"\n type=\"outline\"\n color=\"primary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n prefixIcon=\"refresh\"\n [title]=\"'core.component.file-explorer.retry' | sdTranslate\"\n (click)=\"retryShare()\" />\n } @else {\n <sd-button\n #copyButton\n class=\"copy-button\"\n type=\"fill\"\n color=\"primary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n prefixIcon=\"content_copy\"\n [title]=\"\n (shareFeedback() === 'copied' ? 'core.component.file-explorer.share.copied' : 'core.component.file-explorer.share.copy')\n | sdTranslate\n \"\n [disabled]=\"_shareState.status !== 'ready'\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-share-copy' : null\"\n (click)=\"copyShareLink()\" />\n }\n </div>\n </div>\n}\n", styles: [":host{--sd-fe-accent: var(--sd-file-explorer-accent, var(--sd-primary, #005cbb));--sd-fe-accent-strong: var( --sd-file-explorer-accent-strong, color-mix(in srgb, var(--sd-fe-accent) 84%, var(--sd-file-explorer-mix-shade, #000000)) );--sd-fe-accent-contrast: var(--sd-file-explorer-accent-contrast, var(--sd-primary-contrast, #ffffff));--sd-fe-accent-soft: var( --sd-file-explorer-accent-soft, color-mix(in srgb, var(--sd-fe-accent) 10%, var(--sd-file-explorer-mix-tint, var(--sd-fe-surface))) );--sd-fe-surface: var(--sd-file-explorer-surface, var(--sd-surface, #ffffff));--sd-fe-sidebar-bg: var(--sd-file-explorer-sidebar-bg, color-mix(in srgb, var(--sd-surface-muted, #e7e8ed) 26%, var(--sd-fe-surface)));--sd-fe-muted-surface: var( --sd-file-explorer-muted-surface, color-mix(in srgb, var(--sd-surface-muted, #e7e8ed) 50%, var(--sd-fe-surface)) );--sd-fe-preview-bg: var( --sd-file-explorer-preview-bg, color-mix(in srgb, var(--sd-fe-accent) 9%, var(--sd-file-explorer-mix-tint, var(--sd-fe-surface))) );--sd-fe-border: var( --sd-file-explorer-border, color-mix(in srgb, var(--sd-border, #c4c6d0) 55%, var(--sd-file-explorer-mix-tint, var(--sd-fe-surface))) );--sd-fe-border-strong: var(--sd-file-explorer-border-strong, var(--sd-border, #c4c6d0));--sd-fe-text: var(--sd-file-explorer-text, var(--sd-text, #1a1b1f));--sd-fe-text-secondary: var( --sd-file-explorer-text-secondary, color-mix(in srgb, var(--sd-text-secondary, #44474f) 84%, var(--sd-file-explorer-mix-tint, var(--sd-fe-surface))) );--sd-fe-hover: color-mix(in srgb, var(--sd-fe-text) 4%, transparent);--sd-fe-hover-strong: color-mix(in srgb, var(--sd-fe-text) 8%, transparent);--sd-fe-track: color-mix(in srgb, var(--sd-fe-text) 7%, var(--sd-fe-surface));--sd-fe-success: var(--sd-file-explorer-success, var(--sd-success, #2e7d32));--sd-fe-error: var(--sd-file-explorer-error, var(--sd-error, #ba1a1a));--sd-fe-radius: var(--sd-file-explorer-radius, 16px);--sd-fe-scrim: var(--sd-file-explorer-scrim, rgba(0, 0, 0, .4));--sd-side-drawer-contained-z-index: 9;position:relative;display:flex;flex-direction:column;height:100%;min-height:480px;overflow:hidden;border:1px solid var(--sd-fe-border);border-radius:var(--sd-fe-radius);background:var(--sd-fe-surface);color:var(--sd-fe-text);font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-line-height-20, 20px)}.header{display:grid;grid-template-columns:fit-content(320px) minmax(0,1fr) auto;align-items:center;gap:12px 20px;padding:16px 20px;border-bottom:1px solid var(--sd-fe-border)}.brand{grid-column:1;display:flex;align-items:center;gap:10px;min-width:0}.brand-icon{flex:none;display:grid;place-items:center;width:32px;height:32px;border-radius:50%;background:color-mix(in srgb,var(--sd-fe-accent) 14%,var(--sd-file-explorer-mix-tint, var(--sd-fe-surface)));color:var(--sd-fe-accent)}.brand-text{min-width:0}.brand-title{margin:0;overflow:hidden;font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-semibold, 600);line-height:var(--sd-line-height-22, 22px);text-overflow:ellipsis;white-space:nowrap}.brand-description{margin:0;overflow:hidden;font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-line-height-16, 16px);color:var(--sd-fe-text-secondary);text-overflow:ellipsis;white-space:nowrap}.search{grid-column:2;justify-self:center;display:flex;align-items:center;gap:8px;width:100%;max-width:520px;height:36px;padding:0 6px 0 12px;border:1px solid var(--sd-fe-border);border-radius:var(--sd-radius-999, 999px);background:var(--sd-fe-muted-surface);transition:border-color var(--sd-duration-fast, .12s) ease,box-shadow var(--sd-duration-fast, .12s) ease}.search:focus-within{border-color:var(--sd-fe-accent);background:var(--sd-fe-surface);box-shadow:0 0 0 3px var(--sd-fe-accent-soft)}.search-icon{flex:none;color:var(--sd-fe-text-secondary)}.search-input{flex:1;min-width:0;height:100%;padding:0;border:0;outline:none;background:transparent;color:var(--sd-fe-text);font:inherit;font-size:var(--sd-font-size-14, 14px)}.search-input::placeholder{color:var(--sd-fe-text-secondary)}.search-input::-webkit-search-cancel-button{display:none}.search-clear{flex:none;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;border:0;border-radius:var(--sd-radius-999, 999px);background:transparent;color:var(--sd-fe-text-secondary);cursor:pointer}.search-clear:hover{background:var(--sd-fe-hover-strong)}.upload-button{grid-column:3;justify-self:end}.file-input{display:none}.body{position:relative;flex:1;min-height:0;display:grid;grid-template-columns:238px minmax(0,1fr)}.sidebar{display:flex;flex-direction:column;min-height:0;padding:22px 14px 32px 12px;border-right:1px solid var(--sd-fe-border);background:var(--sd-fe-sidebar-bg)}.sidebar-label{margin:0 0 6px 10px;font-size:var(--sd-font-size-12, 12px);font-weight:var(--sd-font-weight-bold, 700);line-height:var(--sd-line-height-16, 16px);letter-spacing:.04em;text-transform:uppercase;color:var(--sd-fe-text-secondary)}.sidebar-tree{flex:1;min-height:0;margin:0 -4px;padding:2px 4px;overflow-y:auto}.sidebar-footer{margin:12px 4px 0;padding-top:18px;border-top:1px solid var(--sd-fe-border)}.new-folder-button{display:block}.main{position:relative;display:flex;flex-direction:column;min-width:0;min-height:0;padding-top:14px}.refresh-bar{position:absolute;top:0;left:0;right:0;height:2px;overflow:hidden;background:var(--sd-fe-accent-soft)}.refresh-bar:after{content:\"\";position:absolute;top:0;bottom:0;width:30%;background:var(--sd-fe-accent);animation:sd-file-explorer-refresh 1.2s ease-in-out infinite}.toolbar{display:flex;align-items:center;gap:12px;min-height:40px;padding:0 32px}.breadcrumb{flex:1;min-width:0;margin-left:-4px;font-size:var(--sd-font-size-15, 15px);font-weight:var(--sd-font-weight-semibold, 600)}.view-toggle{flex:none;display:flex;gap:2px;padding:2px;border:1px solid var(--sd-fe-border);border-radius:var(--sd-radius-999, 999px);background:var(--sd-fe-surface)}.icon-button{flex:none;display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;padding:0;border:0;border-radius:var(--sd-radius-999, 999px);background:transparent;color:var(--sd-fe-text-secondary);cursor:pointer}.icon-button:hover{background:var(--sd-fe-hover-strong);color:var(--sd-fe-text)}.icon-button:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-file-explorer-accent, var(--sd-focus-ring-color, var(--sd-primary)));outline-offset:1px}.icon-button--toggle{width:40px;height:32px}.icon-button--active,.icon-button--active:hover{background:var(--sd-fe-accent-soft);color:var(--sd-fe-accent)}.count{flex:none;font-size:var(--sd-font-size-13, 13px);color:var(--sd-fe-text-secondary)}.selection{flex:none;display:flex;flex-wrap:wrap;align-items:center;gap:8px 16px;margin:10px 28px 0;padding:6px 8px 6px 10px;border:1px solid var(--sd-fe-border);border-radius:var(--sd-radius-12, 12px);background:var(--sd-file-explorer-muted-surface, color-mix(in srgb, var(--sd-surface-muted, #e7e8ed) 50%, var(--sd-file-explorer-mix-tint, var(--sd-fe-surface))))}.selection-summary{display:flex;align-items:center;gap:4px;min-width:0}.selection-status{min-width:0;color:var(--sd-fe-text);font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-regular, 400);line-height:var(--sd-line-height-20, 20px);overflow-wrap:anywhere}.selection-count{font-weight:var(--sd-font-weight-semibold, 600)}.icon-button.selection-clear{width:32px;height:32px}.icon-button.selection-clear:disabled{cursor:default;opacity:.45}.icon-button.selection-clear:disabled:hover{background:transparent}:host(.sd-file-explorer--touch) .icon-button.selection-clear{width:var(--sd-space-48, 48px);height:var(--sd-space-48, 48px)}.selection-actions{flex:0 1 auto;justify-content:flex-end;gap:16px 8px;margin-inline-start:auto}.selection-actions:empty{display:none}:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-success.c-light,:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-success.c-text{color:var(--sd-status-success-fg, var(--sd-success-dark))}:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-success.c-light .mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic circle,:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-success.c-text .mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic circle{stroke:var(--sd-status-success-fg, var(--sd-success-dark))!important}:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-warning.c-light,:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-warning.c-text{color:var(--sd-status-warning-fg, var(--sd-warning-dark))}:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-warning.c-light .mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic circle,:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-warning.c-text .mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic circle{stroke:var(--sd-status-warning-fg, var(--sd-warning-dark))!important}:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-primary.c-text{--mat-text-button-state-layer-color: var(--sd-file-explorer-mix-tint, var(--sd-fe-surface));--mat-button-text-state-layer-color: var(--mat-text-button-state-layer-color)}:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-success.c-text{--mat-text-button-state-layer-color: var(--sd-file-explorer-mix-tint, var(--sd-fe-surface));--mat-button-text-state-layer-color: var(--mat-text-button-state-layer-color)}:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-info.c-text{--mat-text-button-state-layer-color: var(--sd-file-explorer-mix-tint, var(--sd-fe-surface));--mat-button-text-state-layer-color: var(--mat-text-button-state-layer-color)}:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-warning.c-text{--mat-text-button-state-layer-color: var(--sd-file-explorer-mix-tint, var(--sd-fe-surface));--mat-button-text-state-layer-color: var(--mat-text-button-state-layer-color)}:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-error.c-text{--mat-text-button-state-layer-color: var(--sd-file-explorer-mix-tint, var(--sd-fe-surface));--mat-button-text-state-layer-color: var(--mat-text-button-state-layer-color)}.scroller{flex:1;min-height:0;padding:8px 28px 16px;overflow-y:auto}.scrim{position:absolute;inset:0;background:var(--sd-fe-scrim);animation:sd-file-explorer-fade .18s ease}.transfers{flex:none;border-top:1px solid var(--sd-fe-border);background:var(--sd-fe-surface)}.drop-overlay{position:absolute;inset:0;z-index:10;display:flex;align-items:center;justify-content:center;padding:16px;border:2px dashed var(--sd-fe-accent);border-radius:var(--sd-fe-radius);background:color-mix(in srgb,var(--sd-fe-accent) 8%,color-mix(in srgb,var(--sd-fe-surface) 86%,transparent));pointer-events:none}.drop-card{display:flex;flex-direction:column;align-items:center;gap:10px;color:var(--sd-fe-accent);text-align:center}.drop-title{margin:0;font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-semibold, 600)}.dialog-backdrop{position:absolute;inset:0;z-index:20;background:var(--sd-fe-scrim)}.dialog{position:absolute;top:50%;left:50%;z-index:21;display:flex;flex-direction:column;gap:8px;width:min(400px,100% - 32px);padding:20px;border-radius:14px;background:var(--sd-fe-surface);box-shadow:0 18px 48px #0f172a2e;transform:translate(-50%,-50%)}.dialog:focus{outline:none}.dialog-title{margin:0 0 8px;font-size:17px;font-weight:var(--sd-font-weight-semibold, 600);line-height:var(--sd-line-height-24, 24px)}.field-label{font-size:var(--sd-font-size-13, 13px);color:var(--sd-fe-text-secondary)}.field-input{height:40px;padding:0 12px;border:1px solid var(--sd-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 });
|
|
2704
4852
|
}
|
|
2705
4853
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImport: i0, type: SdFileExplorer, decorators: [{
|
|
2706
4854
|
type: Component,
|
|
2707
4855
|
args: [{ selector: 'sd-file-explorer', standalone: true, imports: [
|
|
4856
|
+
A11yModule,
|
|
4857
|
+
MatTooltip,
|
|
2708
4858
|
SdIcon,
|
|
2709
4859
|
SdTranslatePipe,
|
|
2710
4860
|
SdBreadcrumb,
|
|
2711
4861
|
SdButton,
|
|
4862
|
+
SdInform,
|
|
4863
|
+
SdInformActionDirective,
|
|
2712
4864
|
SdDataState,
|
|
4865
|
+
SdFileExplorerActions,
|
|
4866
|
+
SdFileExplorerCommandSheet,
|
|
2713
4867
|
SdFileExplorerFolderTree,
|
|
2714
4868
|
SdFileExplorerItemList,
|
|
2715
4869
|
SdFileExplorerPreviewPanel,
|
|
@@ -2717,19 +4871,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.5", ngImpor
|
|
|
2717
4871
|
], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
2718
4872
|
class: 'sd-file-explorer',
|
|
2719
4873
|
'[class.sd-file-explorer--compact]': 'compact()',
|
|
4874
|
+
'[class.sd-file-explorer--touch]': 'touch()',
|
|
2720
4875
|
'[class.sd-file-explorer--dragging]': 'dragActive()',
|
|
2721
4876
|
'[attr.data-autoid]': 'autoId()',
|
|
2722
4877
|
'(dragenter)': 'onDragEnter($event)',
|
|
2723
4878
|
'(dragover)': 'onDragOver($event)',
|
|
2724
4879
|
'(dragleave)': 'onDragLeave()',
|
|
2725
4880
|
'(drop)': 'onDrop($event)',
|
|
4881
|
+
'(dragstart)': 'onMoveDragStart($event)',
|
|
4882
|
+
'(dragend)': 'onMoveDragEnd()',
|
|
2726
4883
|
'(keydown.escape)': 'onEscape($event)',
|
|
2727
|
-
}, template: "@let _option = option();\n@let _compact = compact();\n@let _autoId = autoId();\n@let _canUpload = canUpload();\n@let _canDownload = canDownload();\n@let _view = view();\n@let _state = contentState();\n@let _keyword = keyword();\n@let _sidebarOpen = sidebarOpen();\n@let _preview = previewView();\n@let _transfers = transferViews();\n@let _heading = heading();\n@let _searching = searching();\n@let _collapsed = transfersCollapsed();\n@let _dialogOpen = folderDialogOpen();\n@let _shareItem = shareItem();\n@let _canShare = canShare();\n@let _modalOpen = _dialogOpen || !!_shareItem;\n\n<header class=\"header\" [attr.inert]=\"_modalOpen ? '' : null\">\n @if (_option.title) {\n <div class=\"brand\">\n <span class=\"brand-icon\" aria-hidden=\"true\">\n <sd-icon name=\"folder\" size=\"20px\" />\n </span>\n <div class=\"brand-text\">\n <h2 class=\"brand-title\" [title]=\"_option.title\">{{ _option.title }}</h2>\n @if (_option.description) {\n <p class=\"brand-description\">{{ _option.description }}</p>\n }\n </div>\n </div>\n }\n\n <div class=\"search\" role=\"search\">\n <sd-icon class=\"search-icon\" name=\"search\" size=\"20px\" />\n <input\n #searchInput\n type=\"search\"\n class=\"search-input\"\n autocomplete=\"off\"\n [value]=\"_keyword\"\n [placeholder]=\"'core.component.file-explorer.search-placeholder' | sdTranslate\"\n [attr.aria-label]=\"'core.component.file-explorer.search-placeholder' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-search' : null\"\n (input)=\"onKeywordInput(searchInput.value)\" />\n @if (_keyword) {\n <button\n type=\"button\"\n class=\"search-clear\"\n [attr.aria-label]=\"'core.component.file-explorer.search-clear' | sdTranslate\"\n [title]=\"'core.component.file-explorer.search-clear' | sdTranslate\"\n (click)=\"clearSearch()\">\n <sd-icon name=\"close\" size=\"18px\" />\n </button>\n }\n </div>\n\n @if (_canUpload) {\n <sd-button\n class=\"upload-button\"\n type=\"fill\"\n color=\"primary\"\n size=\"md\"\n prefixIcon=\"file_upload\"\n [title]=\"_compact ? undefined : ('core.component.file-explorer.upload' | sdTranslate)\"\n [tooltip]=\"_compact ? ('core.component.file-explorer.upload' | sdTranslate) : undefined\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-upload' : null\"\n (click)=\"fileInput.click()\" />\n <input\n #fileInput\n type=\"file\"\n class=\"file-input\"\n multiple\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-file-input' : null\"\n (change)=\"onFilesPicked(fileInput)\" />\n }\n</header>\n\n<!-- why: dialog ph\u1EE7 c\u1EA3 explorer n\u00EAn l\u00E0m inert c\u1EA3 v\u00F9ng n\u00E0y, k\u1EC3 c\u1EA3 drawer chi ti\u1EBFt \u0111ang n\u1EB1m trong .main. -->\n<div class=\"body\" [attr.inert]=\"_modalOpen ? '' : null\">\n @if (_compact && _sidebarOpen) {\n <div class=\"scrim scrim--sidebar\" aria-hidden=\"true\" (click)=\"sidebarOpen.set(false)\"></div>\n }\n <aside\n #sidebar\n class=\"sidebar\"\n [class.sidebar--open]=\"_sidebarOpen\"\n [id]=\"instanceId + '-sidebar'\"\n [attr.aria-label]=\"'core.component.file-explorer.folders' | sdTranslate\"\n [attr.inert]=\"_compact && !_sidebarOpen ? '' : null\">\n <p class=\"sidebar-label\">{{ 'core.component.file-explorer.folders' | sdTranslate }}</p>\n <div class=\"sidebar-tree\">\n <sd-file-explorer-folder-tree\n [nodes]=\"treeNodes()\"\n [label]=\"'core.component.file-explorer.tree-label' | sdTranslate\"\n (select)=\"onTreeSelect($event)\"\n (toggle)=\"onTreeToggle($event)\"\n (retry)=\"onTreeRetry($event)\" />\n </div>\n @if (canCreateFolder()) {\n <div class=\"sidebar-footer\">\n <sd-button\n #newFolderButton\n class=\"new-folder-button\"\n type=\"outline\"\n color=\"secondary\"\n size=\"md\"\n prefixIcon=\"add\"\n block\n [title]=\"'core.component.file-explorer.new-folder' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-new-folder' : null\"\n (click)=\"openFolderDialog()\" />\n </div>\n }\n </aside>\n\n <!-- why: .main l\u00E0 [container] c\u1EE7a drawer chi ti\u1EBFt \u2014 backdrop ch\u1EC9 ph\u1EE7 v\u00F9ng b\u00EAn ph\u1EA3i, c\u00E2y th\u01B0 m\u1EE5c v\u1EABn d\u00F9ng \u0111\u01B0\u1EE3c.\n Drawer n\u1EB1m TRONG ph\u1EA7n t\u1EED n\u00E0y n\u00EAn inert \u0111\u1EB7t tr\u00EAn t\u1EEBng kh\u1ED1i con, kh\u00F4ng \u0111\u1EB7t tr\u00EAn .main. -->\n <section #mainRegion class=\"main\" [attr.aria-label]=\"_heading\">\n @if (refreshing()) {\n <div class=\"refresh-bar\" aria-hidden=\"true\"></div>\n }\n <div class=\"toolbar\" [attr.inert]=\"_preview ? '' : null\">\n @if (_compact) {\n <button\n type=\"button\"\n class=\"icon-button\"\n [attr.aria-expanded]=\"_sidebarOpen\"\n [attr.aria-controls]=\"instanceId + '-sidebar'\"\n [attr.aria-label]=\"\n (_sidebarOpen ? 'core.component.file-explorer.close-folders' : 'core.component.file-explorer.open-folders') | sdTranslate\n \"\n [attr.data-autoid]=\"_autoId ? _autoId + '-menu' : null\"\n (click)=\"toggleSidebar()\">\n <sd-icon name=\"menu\" size=\"24px\" />\n </button>\n }\n <sd-breadcrumb\n class=\"breadcrumb\"\n [items]=\"breadcrumb().items\"\n [maxItems]=\"_compact ? 3 : 5\"\n [ariaLabel]=\"'core.component.file-explorer.breadcrumb' | sdTranslate\"\n (sdItemActivate)=\"onBreadcrumb($event)\" />\n <div class=\"view-toggle\" role=\"group\" [attr.aria-label]=\"'core.component.file-explorer.view' | sdTranslate\">\n <button\n type=\"button\"\n class=\"icon-button icon-button--toggle\"\n [class.icon-button--active]=\"_view === 'list'\"\n [attr.aria-pressed]=\"_view === 'list'\"\n [attr.aria-label]=\"'core.component.file-explorer.view-list' | sdTranslate\"\n [title]=\"'core.component.file-explorer.view-list' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-view-list' : null\"\n (click)=\"setView('list')\">\n <sd-icon name=\"format_list_bulleted\" size=\"24px\" />\n </button>\n <button\n type=\"button\"\n class=\"icon-button icon-button--toggle\"\n [class.icon-button--active]=\"_view === 'grid'\"\n [attr.aria-pressed]=\"_view === 'grid'\"\n [attr.aria-label]=\"'core.component.file-explorer.view-grid' | sdTranslate\"\n [title]=\"'core.component.file-explorer.view-grid' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-view-grid' : null\"\n (click)=\"setView('grid')\">\n <sd-icon name=\"grid_view\" size=\"24px\" />\n </button>\n </div>\n </div>\n\n <div class=\"heading-row\" [attr.inert]=\"_preview ? '' : null\">\n <h3 class=\"heading\" [title]=\"_heading\">{{ _heading }}</h3>\n @if (_state === 'items') {\n <span class=\"count\">{{ itemCountLabel() }}</span>\n }\n </div>\n\n <div class=\"scroller\" [attr.inert]=\"_preview ? '' : null\">\n @switch (_state) {\n @case ('loading') {\n <sd-data-state\n state=\"loading\"\n compact\n [title]=\"(_searching ? 'core.component.file-explorer.search-loading' : 'core.component.file-explorer.loading') | sdTranslate\" />\n }\n @case ('error') {\n <sd-data-state\n state=\"error\"\n retryable\n [title]=\"(_searching ? 'core.component.file-explorer.search-error' : 'core.component.file-explorer.load-error') | sdTranslate\"\n [message]=\"errorMessage()\"\n [retryLabel]=\"'core.component.file-explorer.retry' | sdTranslate\"\n (sdRetry)=\"retryContent()\" />\n }\n @case ('empty') {\n <sd-data-state\n state=\"empty\"\n [icon]=\"_searching ? 'search_off' : 'folder_open'\"\n [title]=\"emptyTitle()\"\n [message]=\"emptyMessage()\" />\n }\n @default {\n <sd-file-explorer-item-list\n [items]=\"itemViews()\"\n [view]=\"_view\"\n [canDownload]=\"_canDownload\"\n [canShare]=\"_canShare\"\n [compact]=\"_compact\"\n [activeId]=\"_preview ? _preview.item.id : null\"\n [label]=\"_heading\"\n (activate)=\"onActivate($event)\"\n (download)=\"downloadItem($event.item)\"\n (share)=\"openShare($event.item)\" />\n }\n }\n </div>\n </section>\n</div>\n\n@if (_transfers.length) {\n <sd-file-explorer-transfer-panel\n class=\"transfers\"\n [attr.inert]=\"_modalOpen ? '' : null\"\n [transfers]=\"_transfers\"\n [title]=\"transfersTitle()\"\n [collapsed]=\"_collapsed\"\n [canClear]=\"canClearTransfers()\"\n [compact]=\"_compact\"\n [autoId]=\"_autoId ? _autoId + '-transfers' : undefined\"\n (toggleCollapsed)=\"transfersCollapsed.set(!_collapsed)\"\n (clear)=\"clearFinishedTransfers()\"\n (cancel)=\"cancelTransfer($event)\"\n (retry)=\"retryTransfer($event)\"\n (dismiss)=\"dismissTransfer($event)\" />\n}\n\n<!-- why: chi ti\u1EBFt file l\u00E0 sd-side-drawer th\u1EADt, m\u1EDF g\u1ECDn trong v\u00F9ng danh s\u00E1ch b\u00EAn ph\u1EA3i nh\u1EDD [container]:\n header (t\u00ECm ki\u1EBFm, t\u1EA3i l\u00EAn), c\u00E2y th\u01B0 m\u1EE5c v\u00E0 h\u00E0ng ch\u1EDD truy\u1EC1n t\u1EA3i v\u1EABn d\u00F9ng \u0111\u01B0\u1EE3c khi drawer m\u1EDF. -->\n<sd-file-explorer-preview-panel\n [view]=\"_preview\"\n [state]=\"previewState()\"\n [meta]=\"previewMeta()\"\n [canDownload]=\"_canDownload\"\n [canShare]=\"_canShare\"\n [container]=\"mainRegion\"\n [autoId]=\"_autoId ? _autoId + '-preview' : undefined\"\n (close)=\"closePreview()\"\n (download)=\"downloadPreview()\"\n (share)=\"sharePreview()\"\n (retry)=\"retryPreview()\"\n (imageError)=\"onPreviewImageError()\" />\n\n@if (dragActive()) {\n <div class=\"drop-overlay\" aria-hidden=\"true\">\n <div class=\"drop-card\">\n <sd-icon name=\"file_upload\" size=\"40px\" />\n <p class=\"drop-title\">{{ dropTitle() }}</p>\n </div>\n </div>\n}\n\n@if (_dialogOpen) {\n @let _folderName = folderName();\n @let _folderError = folderError();\n <div class=\"dialog-backdrop\" aria-hidden=\"true\" (click)=\"closeFolderDialog()\"></div>\n <form\n class=\"dialog\"\n role=\"dialog\"\n aria-modal=\"true\"\n novalidate\n [attr.aria-labelledby]=\"instanceId + '-folder-title'\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-folder-dialog' : null\"\n (submit)=\"submitFolder($event)\">\n <h3 class=\"dialog-title\" [id]=\"instanceId + '-folder-title'\">{{ folderDialogTitle() }}</h3>\n <label class=\"field-label\" [for]=\"instanceId + '-folder-name'\">{{\n 'core.component.file-explorer.new-folder-name' | sdTranslate\n }}</label>\n <input\n #folderInput\n class=\"field-input\"\n autocomplete=\"off\"\n maxlength=\"255\"\n [id]=\"instanceId + '-folder-name'\"\n [value]=\"_folderName\"\n [attr.aria-invalid]=\"_folderError ? true : null\"\n [attr.aria-describedby]=\"_folderError ? instanceId + '-folder-error' : null\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-folder-name' : null\"\n (input)=\"folderName.set(folderInput.value)\" />\n @if (_folderError) {\n <p class=\"field-error\" role=\"alert\" [id]=\"instanceId + '-folder-error'\">{{ _folderError }}</p>\n }\n <div class=\"dialog-actions\">\n <sd-button\n class=\"cancel-button\"\n type=\"text\"\n color=\"secondary\"\n size=\"md\"\n [title]=\"'core.component.file-explorer.cancel' | sdTranslate\"\n (click)=\"closeFolderDialog()\" />\n <sd-button\n class=\"submit-button\"\n type=\"fill\"\n color=\"primary\"\n size=\"md\"\n htmlType=\"submit\"\n [title]=\"'core.component.file-explorer.create' | sdTranslate\"\n [disabled]=\"!_folderName.trim()\"\n [loading]=\"folderSubmitting()\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-folder-submit' : null\" />\n </div>\n </form>\n}\n\n@if (_shareItem) {\n @let _shareState = shareState();\n <div class=\"dialog-backdrop\" aria-hidden=\"true\" (click)=\"closeShare()\"></div>\n <div\n #shareDialog\n class=\"dialog\"\n role=\"dialog\"\n aria-modal=\"true\"\n tabindex=\"-1\"\n [attr.aria-labelledby]=\"instanceId + '-share-title'\"\n [attr.aria-busy]=\"_shareState.status === 'loading' ? true : null\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-share-dialog' : null\">\n <h3 class=\"dialog-title\" [id]=\"instanceId + '-share-title'\" [title]=\"_shareItem.name\">{{ shareTitle() }}</h3>\n @switch (_shareState.status) {\n @case ('loading') {\n <p class=\"share-status\" role=\"status\">\n <span class=\"spinner\" aria-hidden=\"true\"></span>\n {{ 'core.component.file-explorer.share.loading' | sdTranslate }}\n </p>\n }\n @case ('error') {\n <p class=\"field-error\" role=\"alert\">{{ _shareState.message }}</p>\n }\n @case ('ready') {\n <label class=\"field-label\" [for]=\"instanceId + '-share-link'\">{{ 'core.component.file-explorer.share.link' | sdTranslate }}</label>\n <input\n #shareInput\n class=\"field-input\"\n readonly\n [id]=\"instanceId + '-share-link'\"\n [value]=\"_shareState.url\"\n [attr.aria-describedby]=\"instanceId + '-share-feedback'\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-share-link' : null\"\n (focus)=\"shareInput.select()\" />\n <p class=\"share-feedback\" role=\"status\" aria-live=\"polite\" [id]=\"instanceId + '-share-feedback'\">{{ shareFeedbackLabel() }}</p>\n }\n }\n <div class=\"dialog-actions\">\n <sd-button\n class=\"close-button\"\n type=\"text\"\n color=\"secondary\"\n size=\"md\"\n [title]=\"'core.component.file-explorer.close' | sdTranslate\"\n (click)=\"closeShare()\" />\n @if (_shareState.status === 'error') {\n <sd-button\n class=\"retry-button\"\n type=\"outline\"\n color=\"primary\"\n size=\"md\"\n prefixIcon=\"refresh\"\n [title]=\"'core.component.file-explorer.retry' | sdTranslate\"\n (click)=\"retryShare()\" />\n } @else {\n <sd-button\n #copyButton\n class=\"copy-button\"\n type=\"fill\"\n color=\"primary\"\n size=\"md\"\n prefixIcon=\"content_copy\"\n [title]=\"\n (shareFeedback() === 'copied' ? 'core.component.file-explorer.share.copied' : 'core.component.file-explorer.share.copy')\n | sdTranslate\n \"\n [disabled]=\"_shareState.status !== 'ready'\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-share-copy' : null\"\n (click)=\"copyShareLink()\" />\n }\n </div>\n </div>\n}\n", styles: [":host{--sd-fe-accent: var(--sd-file-explorer-accent, var(--sd-primary, #005cbb));--sd-fe-accent-strong: var(--sd-file-explorer-accent-strong, color-mix(in srgb, var(--sd-fe-accent) 84%, var(--sd-file-explorer-mix-shade, #000000)));--sd-fe-accent-contrast: var(--sd-file-explorer-accent-contrast, var(--sd-primary-contrast, #ffffff));--sd-fe-accent-soft: var(--sd-file-explorer-accent-soft, color-mix(in srgb, var(--sd-fe-accent) 10%, var(--sd-file-explorer-mix-tint, #ffffff)));--sd-fe-surface: var(--sd-file-explorer-surface, #ffffff);--sd-fe-sidebar-bg: var(--sd-file-explorer-sidebar-bg, color-mix(in srgb, var(--sd-surface-muted, #e7e8ed) 26%, var(--sd-fe-surface)));--sd-fe-muted-surface: var( --sd-file-explorer-muted-surface, color-mix(in srgb, var(--sd-surface-muted, #e7e8ed) 50%, var(--sd-fe-surface)) );--sd-fe-preview-bg: var(--sd-file-explorer-preview-bg, color-mix(in srgb, var(--sd-fe-accent) 9%, var(--sd-file-explorer-mix-tint, #ffffff)));--sd-fe-border: var(--sd-file-explorer-border, color-mix(in srgb, var(--sd-border, #c4c6d0) 55%, var(--sd-file-explorer-mix-tint, #ffffff)));--sd-fe-border-strong: var(--sd-file-explorer-border-strong, var(--sd-border, #c4c6d0));--sd-fe-text: var(--sd-file-explorer-text, var(--sd-text, #1a1b1f));--sd-fe-text-secondary: var(--sd-file-explorer-text-secondary, color-mix(in srgb, var(--sd-text-secondary, #44474f) 84%, var(--sd-file-explorer-mix-tint, #ffffff)));--sd-fe-hover: color-mix(in srgb, var(--sd-fe-text) 4%, transparent);--sd-fe-hover-strong: color-mix(in srgb, var(--sd-fe-text) 8%, transparent);--sd-fe-track: color-mix(in srgb, var(--sd-fe-text) 7%, var(--sd-fe-surface));--sd-fe-success: var(--sd-file-explorer-success, var(--sd-success, #2e7d32));--sd-fe-error: var(--sd-file-explorer-error, var(--sd-error, #ba1a1a));--sd-fe-radius: var(--sd-file-explorer-radius, 16px);--sd-fe-scrim: var(--sd-file-explorer-scrim, rgba(0, 0, 0, .4));--sd-side-drawer-contained-z-index: 9;position:relative;display:flex;flex-direction:column;height:100%;min-height:480px;overflow:hidden;border:1px solid var(--sd-fe-border);border-radius:var(--sd-fe-radius);background:var(--sd-fe-surface);color:var(--sd-fe-text);font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-line-height-20, 20px)}.header{display:grid;grid-template-columns:fit-content(320px) minmax(0,1fr) auto;align-items:center;gap:12px 20px;padding:16px 20px;border-bottom:1px solid var(--sd-fe-border)}.brand{grid-column:1;display:flex;align-items:center;gap:10px;min-width:0}.brand-icon{flex:none;display:grid;place-items:center;width:32px;height:32px;border-radius:50%;background:color-mix(in srgb,var(--sd-fe-accent) 14%,var(--sd-file-explorer-mix-tint, #ffffff));color:var(--sd-fe-accent)}.brand-text{min-width:0}.brand-title{margin:0;overflow:hidden;font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-semibold, 600);line-height:var(--sd-line-height-22, 22px);text-overflow:ellipsis;white-space:nowrap}.brand-description{margin:0;overflow:hidden;font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-line-height-16, 16px);color:var(--sd-fe-text-secondary);text-overflow:ellipsis;white-space:nowrap}.search{grid-column:2;justify-self:center;display:flex;align-items:center;gap:8px;width:100%;max-width:520px;height:36px;padding:0 6px 0 12px;border:1px solid var(--sd-fe-border);border-radius:var(--sd-radius-999, 999px);background:var(--sd-fe-muted-surface);transition:border-color var(--sd-duration-fast, .12s) ease,box-shadow var(--sd-duration-fast, .12s) ease}.search:focus-within{border-color:var(--sd-fe-accent);background:var(--sd-fe-surface);box-shadow:0 0 0 3px var(--sd-fe-accent-soft)}.search-icon{flex:none;color:var(--sd-fe-text-secondary)}.search-input{flex:1;min-width:0;height:100%;padding:0;border:0;outline:none;background:transparent;color:var(--sd-fe-text);font:inherit;font-size:var(--sd-font-size-14, 14px)}.search-input::placeholder{color:var(--sd-fe-text-secondary)}.search-input::-webkit-search-cancel-button{display:none}.search-clear{flex:none;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;border:0;border-radius:var(--sd-radius-999, 999px);background:transparent;color:var(--sd-fe-text-secondary);cursor:pointer}.search-clear:hover{background:var(--sd-fe-hover-strong)}.upload-button{grid-column:3;justify-self:end}.file-input{display:none}.body{position:relative;flex:1;min-height:0;display:grid;grid-template-columns:238px minmax(0,1fr)}.sidebar{display:flex;flex-direction:column;min-height:0;padding:22px 14px 32px 12px;border-right:1px solid var(--sd-fe-border);background:var(--sd-fe-sidebar-bg)}.sidebar-label{margin:0 0 6px 10px;font-size:var(--sd-font-size-12, 12px);font-weight:var(--sd-font-weight-bold, 700);line-height:var(--sd-line-height-16, 16px);letter-spacing:.04em;text-transform:uppercase;color:var(--sd-fe-text-secondary)}.sidebar-tree{flex:1;min-height:0;margin:0 -4px;padding:2px 4px;overflow-y:auto}.sidebar-footer{margin:12px 4px 0;padding-top:18px;border-top:1px solid var(--sd-fe-border)}.new-folder-button{display:block}.main{position:relative;display:flex;flex-direction:column;min-width:0;min-height:0;padding-top:14px}.refresh-bar{position:absolute;top:0;left:0;right:0;height:2px;overflow:hidden;background:var(--sd-fe-accent-soft)}.refresh-bar:after{content:\"\";position:absolute;top:0;bottom:0;width:30%;background:var(--sd-fe-accent);animation:sd-file-explorer-refresh 1.2s ease-in-out infinite}.toolbar{display:flex;align-items:center;gap:12px;min-height:40px;padding:0 32px}.breadcrumb{flex:1;min-width:0;margin-left:-4px;font-size:var(--sd-font-size-15, 15px);font-weight:var(--sd-font-weight-semibold, 600)}.view-toggle{flex:none;display:flex;gap:2px;padding:2px;border:1px solid var(--sd-fe-border);border-radius:var(--sd-radius-999, 999px);background:var(--sd-fe-surface)}.icon-button{flex:none;display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;padding:0;border:0;border-radius:var(--sd-radius-999, 999px);background:transparent;color:var(--sd-fe-text-secondary);cursor:pointer}.icon-button:hover{background:var(--sd-fe-hover-strong);color:var(--sd-fe-text)}.icon-button:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-file-explorer-accent, var(--sd-focus-ring-color, var(--sd-primary)));outline-offset:1px}.icon-button--toggle{width:40px;height:32px}.icon-button--active,.icon-button--active:hover{background:var(--sd-fe-accent-soft);color:var(--sd-fe-accent)}.heading-row{display:flex;align-items:flex-end;justify-content:space-between;gap:12px;margin-top:10px;padding:0 32px}.heading{min-width:0;margin:0;overflow:hidden;font-size:var(--sd-font-size-18, 18px);font-weight:var(--sd-font-weight-bold, 700);line-height:26px;text-overflow:ellipsis;white-space:nowrap}.count{flex:none;padding-bottom:12px;font-size:var(--sd-font-size-13, 13px);color:var(--sd-fe-text-secondary)}.scroller{flex:1;min-height:0;padding:8px 28px 16px;overflow-y:auto}.scrim{position:absolute;inset:0;background:var(--sd-fe-scrim);animation:sd-file-explorer-fade .18s ease}.transfers{flex:none;border-top:1px solid var(--sd-fe-border);background:var(--sd-fe-surface)}.drop-overlay{position:absolute;inset:0;z-index:10;display:flex;align-items:center;justify-content:center;padding:16px;border:2px dashed var(--sd-fe-accent);border-radius:var(--sd-fe-radius);background:color-mix(in srgb,var(--sd-fe-accent) 8%,rgba(255,255,255,.86));pointer-events:none}.drop-card{display:flex;flex-direction:column;align-items:center;gap:10px;color:var(--sd-fe-accent);text-align:center}.drop-title{margin:0;font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-semibold, 600)}.dialog-backdrop{position:absolute;inset:0;z-index:20;background:var(--sd-fe-scrim)}.dialog{position:absolute;top:50%;left:50%;z-index:21;display:flex;flex-direction:column;gap:8px;width:min(400px,100% - 32px);padding:20px;border-radius:14px;background:var(--sd-fe-surface);box-shadow:0 18px 48px #0f172a2e;transform:translate(-50%,-50%)}.dialog:focus{outline:none}.dialog-title{margin:0 0 8px;font-size:17px;font-weight:var(--sd-font-weight-semibold, 600);line-height:var(--sd-line-height-24, 24px)}.field-label{font-size:var(--sd-font-size-13, 13px);color:var(--sd-fe-text-secondary)}.field-input{height:40px;padding:0 12px;border:1px solid var(--sd-fe-border-strong);border-radius:var(--sd-radius-8, 8px);background:var(--sd-fe-surface);color:var(--sd-fe-text);font:inherit;font-size:var(--sd-font-size-15, 15px);outline:none}.field-input:focus{border-color:var(--sd-fe-accent);box-shadow:0 0 0 3px var(--sd-fe-accent-soft)}.field-input[aria-invalid=true]{border-color:var(--sd-fe-error)}.field-error{margin:0;font-size:var(--sd-font-size-13, 13px);color:var(--sd-fe-error)}.dialog-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:12px}.share-status{display:flex;align-items:center;gap:10px;margin:4px 0;font-size:var(--sd-font-size-14, 14px);color:var(--sd-fe-text-secondary)}.share-feedback{min-height:18px;margin:0;font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-18, 18px);color:var(--sd-fe-success)}.spinner{flex:none;width:18px;height:18px;border:2px solid color-mix(in srgb,var(--sd-fe-accent) 20%,transparent);border-top-color:var(--sd-fe-accent);border-radius:50%;animation:sd-file-explorer-spin .8s linear infinite}:host(.sd-file-explorer--compact) .header{grid-template-columns:minmax(0,1fr) auto;gap:10px 12px;padding:12px 14px}:host(.sd-file-explorer--compact) .brand{grid-row:1;gap:10px}:host(.sd-file-explorer--compact) .upload-button{grid-column:2;grid-row:1}:host(.sd-file-explorer--compact) .search{grid-column:1/-1;grid-row:2;max-width:none}:host(.sd-file-explorer--compact) .header:not(:has(.brand)) .search{grid-column:1;grid-row:1}:host(.sd-file-explorer--compact) .body{grid-template-columns:minmax(0,1fr)}:host(.sd-file-explorer--compact) .sidebar{position:absolute;top:0;bottom:0;left:0;z-index:5;width:min(300px,86%);border-right:1px solid var(--sd-fe-border);box-shadow:12px 0 32px #0f172a1f;visibility:hidden;transform:translate(-100%);transition:transform var(--sd-duration-base, .2s) ease,visibility var(--sd-duration-base, .2s)}:host(.sd-file-explorer--compact) .sidebar--open{visibility:visible;transform:none}:host(.sd-file-explorer--compact) .scrim--sidebar{z-index:4}:host(.sd-file-explorer--compact) .main{padding-top:8px}:host(.sd-file-explorer--compact) .toolbar{gap:6px;min-height:36px;padding:0 12px 0 10px}:host(.sd-file-explorer--compact) .breadcrumb{margin-left:0}:host(.sd-file-explorer--compact) .icon-button--toggle{width:36px}:host(.sd-file-explorer--compact) .heading-row{margin-top:13px;padding:0 14px}:host(.sd-file-explorer--compact) .count{padding-bottom:8px}:host(.sd-file-explorer--compact) .scroller{padding:0 12px 12px}@keyframes sd-file-explorer-spin{to{transform:rotate(360deg)}}@keyframes sd-file-explorer-fade{0%{opacity:0}}@keyframes sd-file-explorer-refresh{0%{left:-30%}to{left:100%}}@media(prefers-reduced-motion:reduce){.scrim{animation:none}.search,:host(.sd-file-explorer--compact) .sidebar{transition:none}}\n"] }]
|
|
2728
|
-
}], ctorParameters: () => [], propDecorators: { option: [{ type: i0.Input, args: [{ isSignal: true, alias: "option", required: true }] }], open: [{ type: i0.Output, args: ["open"] }], searchInput: [{ type: i0.ViewChild, args: ['searchInput', { isSignal: true }] }], folderInput: [{ type: i0.ViewChild, args: ['folderInput', { isSignal: true }] }], newFolderButton: [{ type: i0.ViewChild, args: ['newFolderButton', { ...{ read: ElementRef }, isSignal: true }] }], copyButton: [{ type: i0.ViewChild, args: ['copyButton', { ...{ read: ElementRef }, isSignal: true }] }], shareInput: [{ type: i0.ViewChild, args: ['shareInput', { isSignal: true }] }], shareDialog: [{ type: i0.ViewChild, args: ['shareDialog', { isSignal: true }] }], sidebar: [{ type: i0.ViewChild, args: ['sidebar', { isSignal: true }] }] } });
|
|
4884
|
+
}, 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"] }]
|
|
4885
|
+
}], ctorParameters: () => [], propDecorators: { columnDefs: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => SdFileExplorerColumnDef), { isSignal: true }] }], option: [{ type: i0.Input, args: [{ isSignal: true, alias: "option", required: true }] }], open: [{ type: i0.Output, args: ["open"] }], searchInput: [{ type: i0.ViewChild, args: ['searchInput', { isSignal: true }] }], folderInput: [{ type: i0.ViewChild, args: ['folderInput', { isSignal: true }] }], newFolderButton: [{ type: i0.ViewChild, args: ['newFolderButton', { ...{ read: ElementRef }, isSignal: true }] }], copyButton: [{ type: i0.ViewChild, args: ['copyButton', { ...{ read: ElementRef }, isSignal: true }] }], shareInput: [{ type: i0.ViewChild, args: ['shareInput', { isSignal: true }] }], shareDialog: [{ type: i0.ViewChild, args: ['shareDialog', { isSignal: true }] }], sidebar: [{ type: i0.ViewChild, args: ['sidebar', { isSignal: true }] }], commandDrawer: [{ type: i0.ViewChild, args: [i0.forwardRef(() => SdFileExplorerCommandSheet), { isSignal: true }] }] } });
|
|
2729
4886
|
|
|
2730
4887
|
/**
|
|
2731
4888
|
* Generated bundle index. Do not edit.
|
|
2732
4889
|
*/
|
|
2733
4890
|
|
|
2734
|
-
export { SdFileExplorer };
|
|
4891
|
+
export { SdFileExplorer, SdFileExplorerColumnDef };
|
|
2735
4892
|
//# sourceMappingURL=sdcorejs-angular-components-file-explorer.mjs.map
|