@sdcorejs/angular 19.2.15 → 19.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 +9 -7
- package/assets/STYLE-GUIDE.md +6 -3
- package/assets/THEME.md +166 -0
- package/assets/fonts/fonts.scss +1 -1
- package/assets/scss/ckeditor5.scss +2 -2
- package/assets/scss/core/_inline-edit.scss +3 -3
- package/assets/scss/core/_read-state-panel.scss +2 -2
- package/assets/scss/core/color.scss +4 -2
- package/assets/scss/core/form.scss +35 -12
- package/assets/scss/core/scrollbar.scss +3 -3
- package/assets/scss/core/utilities/_base.scss +5 -5
- package/assets/scss/core/utilities/_typography.scss +22 -22
- package/assets/scss/sd-core.scss +12 -0
- package/assets/scss/themes/_component-tokens.scss +261 -0
- package/assets/scss/themes/_presets.scss +3 -0
- package/assets/scss/themes/_ramps.scss +56 -0
- package/assets/scss/themes/_scales.scss +90 -0
- package/assets/scss/themes/_semantic.scss +22 -0
- package/assets/scss/themes/default.scss +113 -10
- package/assets/scss/themes/material-theme.scss +3 -0
- package/components/breadcrumb/src/breadcrumb.component.d.ts +2 -1
- package/components/data-state/src/data-state.component.d.ts +6 -2
- package/components/file-explorer/index.d.ts +1 -0
- package/components/file-explorer/src/components/actions.component.d.ts +40 -0
- package/components/file-explorer/src/components/command-sheet.component.d.ts +49 -0
- package/components/file-explorer/src/components/folder-tree.component.d.ts +41 -11
- package/components/file-explorer/src/components/item-list.component.d.ts +68 -13
- package/components/file-explorer/src/components/menu-trigger.component.d.ts +27 -0
- package/components/file-explorer/src/components/preview-panel.component.d.ts +12 -7
- package/components/file-explorer/src/file-explorer-actions.d.ts +80 -0
- package/components/file-explorer/src/file-explorer-column.directive.d.ts +20 -0
- package/components/file-explorer/src/file-explorer-move.d.ts +12 -0
- package/components/file-explorer/src/file-explorer-normalize.d.ts +72 -0
- package/components/file-explorer/src/file-explorer.component.d.ts +106 -23
- package/components/file-explorer/src/file-explorer.model.d.ts +210 -29
- package/components/file-explorer/src/file-explorer.utils.d.ts +2 -4
- package/components/file-explorer/src/file-explorer.view-model.d.ts +78 -5
- package/components/form-generic/index.d.ts +1 -1
- package/components/form-generic/src/components/form-builder/canvas/canvas.component.d.ts +86 -0
- package/components/form-generic/src/components/form-builder/canvas/drop-feedback.component.d.ts +42 -0
- package/components/form-generic/src/components/form-builder/canvas/field-preview.component.d.ts +43 -0
- package/components/form-generic/src/components/form-builder/components/attribute-expression/attribute-expression.component.d.ts +34 -17
- package/components/form-generic/src/components/form-builder/components/attribute-parameter/attribute-parameter.component.d.ts +12 -31
- package/components/form-generic/src/components/form-builder/components/attribute-selection/components/build-queries/build-queries.component.d.ts +64 -30
- package/components/form-generic/src/components/form-builder/components/attribute-selection/components/build-variables/build-variables.component.d.ts +46 -36
- package/components/form-generic/src/components/form-builder/components/configure-validation/configure-validation.component.d.ts +34 -22
- package/components/form-generic/src/components/form-builder/components/html/attribute/components/build-queries/build-queries.component.d.ts +21 -33
- package/components/form-generic/src/components/form-builder/components/value-box/mapping-box.component.d.ts +12 -0
- package/components/form-generic/src/components/form-builder/components/value-box/mapping-summary.d.ts +17 -0
- package/components/form-generic/src/components/form-builder/components/value-box/value-box.component.d.ts +24 -0
- package/components/form-generic/src/components/form-builder/form-builder.component.d.ts +94 -160
- package/components/form-generic/src/components/form-builder/inspector/inspector.component.d.ts +216 -0
- package/components/form-generic/src/components/form-builder/inspector/options-editor.component.d.ts +32 -0
- package/components/form-generic/src/components/form-builder/inspector/toggle-row.component.d.ts +17 -0
- package/components/form-generic/src/components/form-builder/palette/palette.component.d.ts +50 -0
- package/components/form-generic/src/components/form-builder/palette/structure.component.d.ts +36 -0
- package/components/form-generic/src/components/form-builder/preview/preview.component.d.ts +38 -0
- package/components/form-generic/src/components/form-builder/state/builder-commands.d.ts +63 -0
- package/components/form-generic/src/components/form-builder/state/builder-document.d.ts +85 -0
- package/components/form-generic/src/components/form-builder/state/builder-drag.d.ts +55 -0
- package/components/form-generic/src/components/form-builder/state/builder-history.d.ts +33 -0
- package/components/form-generic/src/components/form-builder/state/builder-html.d.ts +6 -0
- package/components/form-generic/src/components/form-builder/state/builder-layout.d.ts +132 -0
- package/components/form-generic/src/components/form-builder/state/builder-palette.d.ts +39 -0
- package/components/form-generic/src/components/form-builder/state/builder-store.d.ts +142 -0
- package/components/form-generic/src/components/form-render/components/index.d.ts +0 -1
- package/components/form-generic/src/components/form-render/components/item/components/checkbox/checkbox.component.d.ts +10 -29
- package/components/form-generic/src/components/form-render/components/item/components/chip-calendar/chip-calendar.component.d.ts +11 -26
- package/components/form-generic/src/components/form-render/components/item/components/chip-string/chip-string.component.d.ts +11 -26
- package/components/form-generic/src/components/form-render/components/item/components/datetime/datetime.component.d.ts +15 -29
- package/components/form-generic/src/components/form-render/components/item/components/html/html.component.d.ts +14 -28
- package/components/form-generic/src/components/form-render/components/item/components/index.d.ts +0 -1
- package/components/form-generic/src/components/form-render/components/item/components/number/number.component.d.ts +21 -26
- package/components/form-generic/src/components/form-render/components/item/components/radio/radio.component.d.ts +15 -32
- package/components/form-generic/src/components/form-render/components/item/components/select/select.component.d.ts +17 -37
- package/components/form-generic/src/components/form-render/components/item/components/textarea/textarea.component.d.ts +11 -26
- package/components/form-generic/src/components/form-render/components/item/components/textfield/textfield.component.d.ts +29 -28
- package/components/form-generic/src/components/form-render/components/item/components/upload/upload.component.d.ts +15 -32
- package/components/form-generic/src/components/form-render/components/item/item.component.d.ts +19 -28
- package/components/form-generic/src/components/form-render/form-render-catalog.d.ts +19 -0
- package/components/form-generic/src/components/form-render/form-render.component.d.ts +106 -31
- package/components/form-generic/src/components/form-render/form-render.context.d.ts +24 -0
- package/components/form-generic/src/components/index.d.ts +0 -1
- package/components/form-generic/src/configurations/form-generic-breakpoints.d.ts +15 -0
- package/components/form-generic/src/configurations/form-generic-config.token.d.ts +17 -0
- package/components/form-generic/src/configurations/form-generic.provider.d.ts +17 -0
- package/components/form-generic/src/configurations/index.d.ts +3 -2
- package/components/form-generic/src/layout/form-generic-layout.d.ts +29 -0
- package/components/form-generic/src/models/form-generic-config.model.d.ts +83 -0
- package/components/form-generic/src/models/form-generic-field.model.d.ts +148 -0
- package/components/form-generic/src/models/form-generic-schema.d.ts +36 -0
- package/components/form-generic/src/models/form-generic-schema.model.d.ts +73 -0
- package/components/form-generic/src/models/index.d.ts +4 -9
- package/components/form-generic/src/pipes/component-viewed.pipe.d.ts +4 -7
- package/components/form-generic/src/pipes/html.pipe.d.ts +3 -5
- package/components/form-generic/src/pipes/hyperlink.pipe.d.ts +7 -2
- package/components/form-generic/src/pipes/index.d.ts +0 -4
- package/components/form-generic/src/presets/form-generic-presets.d.ts +56 -0
- package/components/form-generic/src/rules/form-generic-display.d.ts +23 -0
- package/components/form-generic/src/rules/form-generic-filter.d.ts +34 -0
- package/components/form-generic/src/rules/form-generic-references.d.ts +15 -0
- package/components/form-generic/src/rules/form-generic-validation.d.ts +24 -0
- package/components/form-generic/src/rules/form-generic-values.d.ts +23 -0
- package/components/form-generic/src/services/form-generic.service.d.ts +14 -18
- package/components/form-generic/src/services/form-render.service.d.ts +8 -5
- package/components/highlight/index.d.ts +1 -0
- package/components/highlight/src/highlight.component.d.ts +23 -0
- package/components/image-editor/index.d.ts +2 -0
- package/components/image-editor/src/image-editor.component.d.ts +194 -0
- package/components/image-editor/src/image-editor.export.d.ts +52 -0
- package/components/image-editor/src/image-editor.geometry.d.ts +113 -0
- package/components/image-editor/src/image-editor.model.d.ts +265 -0
- package/components/image-editor/src/image-editor.source.d.ts +58 -0
- package/components/image-editor/src/image-editor.state.d.ts +64 -0
- package/components/index.d.ts +3 -0
- package/components/inform/src/inform.component.d.ts +5 -2
- package/components/kanban/index.d.ts +3 -0
- package/components/kanban/src/kanban.component.d.ts +83 -0
- package/components/kanban/src/kanban.model.d.ts +65 -0
- package/components/kanban/src/kanban.templates.d.ts +30 -0
- package/components/kanban/src/kanban.utils.d.ts +5 -0
- package/components/mini-editor/src/mini-editor.component.d.ts +1 -1
- package/components/preview/index.d.ts +1 -0
- package/components/preview/src/preview-video/preview-video.component.d.ts +49 -0
- package/components/query-builder/src/query-builder.model.d.ts +1 -1
- package/components/section/src/section-item/section-item.component.d.ts +2 -1
- package/components/section/src/section.component.d.ts +5 -1
- package/components/tab/src/tab-group.component.d.ts +3 -1
- package/components/table/src/models/table-option-export.model.d.ts +6 -0
- package/components/table/src/services/field-value.util.d.ts +14 -0
- package/directives/src/sd-tooltip.directive.d.ts +8 -0
- package/fesm2022/sdcorejs-angular-components-anchor.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-anchor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-api-contract-builder.mjs +6 -6
- package/fesm2022/sdcorejs-angular-components-api-contract-builder.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-audit-diff.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-audit-diff.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-autoid-inspector.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-autoid-inspector.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-avatar.mjs +34 -27
- package/fesm2022/sdcorejs-angular-components-avatar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-badge.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-badge.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-breadcrumb.mjs +35 -5
- package/fesm2022/sdcorejs-angular-components-breadcrumb.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-button.mjs +13 -11
- package/fesm2022/sdcorejs-angular-components-button.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-card.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-card.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-ckeditor-styles.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-ckeditor-styles.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-code-editor.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-code-editor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-data-state.mjs +7 -3
- package/fesm2022/sdcorejs-angular-components-data-state.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-editor.mjs +12 -4
- package/fesm2022/sdcorejs-angular-components-editor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-file-explorer.mjs +2256 -129
- package/fesm2022/sdcorejs-angular-components-file-explorer.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs +6482 -6537
- package/fesm2022/sdcorejs-angular-components-form-generic.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-highlight.mjs +63 -0
- package/fesm2022/sdcorejs-angular-components-highlight.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-components-history.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-history.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-image-editor.mjs +2088 -0
- package/fesm2022/sdcorejs-angular-components-image-editor.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-components-import-excel.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-import-excel.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-inform.mjs +8 -4
- package/fesm2022/sdcorejs-angular-components-inform.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-job-progress.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-job-progress.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-kanban.mjs +441 -0
- package/fesm2022/sdcorejs-angular-components-kanban.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-components-mini-editor.mjs +40 -22
- package/fesm2022/sdcorejs-angular-components-mini-editor.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-modal-resizable.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-modal-resizable.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-modal.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-modal.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-operator.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-operator.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-org-chart.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-org-chart.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-preview.mjs +129 -7
- package/fesm2022/sdcorejs-angular-components-preview.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs +33 -24
- package/fesm2022/sdcorejs-angular-components-query-bar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-query-builder.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-query-builder.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-quick-action.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-quick-action.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-section.mjs +12 -7
- package/fesm2022/sdcorejs-angular-components-section.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-side-drawer.mjs +28 -4
- package/fesm2022/sdcorejs-angular-components-side-drawer.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-splitter.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-splitter.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-stepper.mjs +7 -3
- package/fesm2022/sdcorejs-angular-components-stepper.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tab-router.mjs +4 -4
- package/fesm2022/sdcorejs-angular-components-tab-router.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tab.mjs +11 -3
- package/fesm2022/sdcorejs-angular-components-tab.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-table.mjs +308 -113
- package/fesm2022/sdcorejs-angular-components-table.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-tree.mjs +2 -2
- package/fesm2022/sdcorejs-angular-components-tree.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs +14 -5
- package/fesm2022/sdcorejs-angular-components-upload-file.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-components.mjs +3 -0
- package/fesm2022/sdcorejs-angular-components.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-directives.mjs +98 -12
- package/fesm2022/sdcorejs-angular-directives.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs +148 -5
- package/fesm2022/sdcorejs-angular-forms-autocomplete.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs +18 -3
- package/fesm2022/sdcorejs-angular-forms-chip-calendar.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-chip.mjs +18 -3
- package/fesm2022/sdcorejs-angular-forms-chip.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-date-range.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-date-range.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-date.mjs +16 -6
- package/fesm2022/sdcorejs-angular-forms-date.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-datetime.mjs +16 -6
- package/fesm2022/sdcorejs-angular-forms-datetime.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-entity-picker.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-inline-text.mjs +3 -3
- package/fesm2022/sdcorejs-angular-forms-inline-text.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input-color.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-input-color.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input-number.mjs +17 -3
- package/fesm2022/sdcorejs-angular-forms-input-number.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-input.mjs +28 -4
- package/fesm2022/sdcorejs-angular-forms-input.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-label.mjs +27 -2
- package/fesm2022/sdcorejs-angular-forms-label.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-radio.mjs +1 -1
- package/fesm2022/sdcorejs-angular-forms-radio.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-segmented.mjs +244 -0
- package/fesm2022/sdcorejs-angular-forms-segmented.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-forms-select.mjs +497 -6
- package/fesm2022/sdcorejs-angular-forms-select.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-switch.mjs +1 -1
- package/fesm2022/sdcorejs-angular-forms-switch.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-textarea.mjs +21 -3
- package/fesm2022/sdcorejs-angular-forms-textarea.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-time-range.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-time-range.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-time.mjs +2 -2
- package/fesm2022/sdcorejs-angular-forms-time.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms-tree-select.mjs +1 -1
- package/fesm2022/sdcorejs-angular-forms-tree-select.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-forms.mjs +8 -0
- package/fesm2022/sdcorejs-angular-forms.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-i18n.mjs +1729 -271
- package/fesm2022/sdcorejs-angular-i18n.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-auth.mjs +35 -3
- package/fesm2022/sdcorejs-angular-modules-auth.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-icon.mjs +19 -0
- package/fesm2022/sdcorejs-angular-modules-icon.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-layout.mjs +39 -48
- package/fesm2022/sdcorejs-angular-modules-layout.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-modules-permission.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-api.mjs +196 -8
- package/fesm2022/sdcorejs-angular-services-api.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-confirm.mjs +10 -3
- package/fesm2022/sdcorejs-angular-services-confirm.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-excel.mjs +5 -0
- package/fesm2022/sdcorejs-angular-services-excel.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-loading.mjs +1 -1
- package/fesm2022/sdcorejs-angular-services-loading.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-services-notify.mjs +107 -7
- package/fesm2022/sdcorejs-angular-services-notify.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-utilities-extensions.mjs +458 -1
- package/fesm2022/sdcorejs-angular-utilities-extensions.mjs.map +1 -1
- package/fesm2022/sdcorejs-angular-utilities-theme.mjs +169 -0
- package/fesm2022/sdcorejs-angular-utilities-theme.mjs.map +1 -0
- package/fesm2022/sdcorejs-angular-utilities.mjs +1 -0
- package/fesm2022/sdcorejs-angular-utilities.mjs.map +1 -1
- package/forms/autocomplete/src/autocomplete.component.d.ts +19 -1
- package/forms/chip/src/chip.component.d.ts +13 -1
- package/forms/chip-calendar/src/chip-calendar.component.d.ts +13 -1
- package/forms/date/src/date.component.d.ts +7 -1
- package/forms/datetime/src/datetime.component.d.ts +7 -1
- package/forms/index.d.ts +1 -0
- package/forms/inline-text/src/inline-text.component.d.ts +1 -1
- package/forms/input/src/input.component.d.ts +21 -4
- package/forms/input-number/src/input-number.component.d.ts +12 -1
- package/forms/label/src/label.component.d.ts +16 -1
- package/forms/models/index.d.ts +1 -0
- package/forms/models/src/sd-label-placement.d.ts +14 -0
- package/forms/segmented/index.d.ts +2 -0
- package/forms/segmented/src/segmented.component.d.ts +57 -0
- package/forms/segmented/src/segmented.model.d.ts +28 -0
- package/forms/select/src/select.component.d.ts +66 -3
- package/forms/src/forms.module.d.ts +7 -6
- package/forms/textarea/src/textarea.component.d.ts +9 -1
- package/i18n/src/en.d.ts +339 -54
- package/i18n/src/i18n.service.d.ts +5 -0
- package/modules/auth/configurations/auth.configuration.d.ts +4 -3
- package/modules/icon/src/icon.model.d.ts +10 -0
- package/modules/layout/configurations/layout.configuration.d.ts +2 -2
- package/modules/permission/src/configurations/permission.configuration.d.ts +3 -2
- package/package.json +22 -2
- package/services/api/index.d.ts +1 -0
- package/services/api/src/api-handler-registry.d.ts +49 -0
- package/services/api/src/api-host.d.ts +15 -0
- package/services/api/src/api-route-configurations.d.ts +20 -0
- package/services/confirm/src/lib/components/dialog-confirm/dialog-confirm.component.d.ts +3 -0
- package/services/confirm/src/lib/confirm.service.d.ts +13 -0
- package/services/notify/src/components/toast/toast.component.d.ts +8 -0
- package/services/notify/src/components/toast-container.component.d.ts +11 -2
- package/services/notify/src/notify.model.d.ts +8 -0
- package/utilities/extensions/index.d.ts +2 -0
- package/utilities/extensions/src/editor-html-sanitizer.d.ts +13 -0
- package/utilities/extensions/src/text-search.d.ts +34 -0
- package/utilities/extensions/src/url-safety.d.ts +17 -0
- package/utilities/index.d.ts +1 -0
- package/utilities/theme/index.d.ts +1 -0
- package/utilities/theme/src/theme-tokens.d.ts +22 -0
- package/components/form-generic/src/components/form-builder/components/attribute-expression/form-expression-query-adapter.d.ts +0 -6
- package/components/form-generic/src/components/form-builder/components/attribute-input/attribute-input.component.d.ts +0 -16
- package/components/form-generic/src/components/form-builder/components/attribute-input-number/attribute-input-number.component.d.ts +0 -13
- package/components/form-generic/src/components/form-builder/components/attribute-select/attribute-select.component.d.ts +0 -25
- package/components/form-generic/src/components/form-builder/components/attribute-selection/attribute-selection.component.d.ts +0 -27
- package/components/form-generic/src/components/form-builder/components/attribute-switch/attribute-switch.component.d.ts +0 -13
- package/components/form-generic/src/components/form-builder/components/attribute-table/attribute-table.component.d.ts +0 -33
- package/components/form-generic/src/components/form-builder/components/attribute-template/attribute-template.component.d.ts +0 -12
- package/components/form-generic/src/components/form-builder/components/attribute-textarea/attribute-textarea.component.d.ts +0 -16
- package/components/form-generic/src/components/form-builder/components/checkbox/attribute/checkbox-attribute.component.d.ts +0 -21
- package/components/form-generic/src/components/form-builder/components/checkbox/control/checkbox-control.component.d.ts +0 -8
- package/components/form-generic/src/components/form-builder/components/checkbox/index.d.ts +0 -2
- package/components/form-generic/src/components/form-builder/components/chip-calendar/attribute/chip-calendar-attribute.component.d.ts +0 -22
- package/components/form-generic/src/components/form-builder/components/chip-calendar/control/chip-calendar-control.component.d.ts +0 -16
- package/components/form-generic/src/components/form-builder/components/chip-calendar/index.d.ts +0 -2
- package/components/form-generic/src/components/form-builder/components/chip-string/attribute/chip-string-attribute.component.d.ts +0 -22
- package/components/form-generic/src/components/form-builder/components/chip-string/control/chip-string-control.component.d.ts +0 -16
- package/components/form-generic/src/components/form-builder/components/chip-string/index.d.ts +0 -2
- package/components/form-generic/src/components/form-builder/components/datetime/attribute/datetime-attribute.component.d.ts +0 -21
- package/components/form-generic/src/components/form-builder/components/datetime/control/datetime-control.component.d.ts +0 -18
- package/components/form-generic/src/components/form-builder/components/datetime/index.d.ts +0 -2
- package/components/form-generic/src/components/form-builder/components/expression-builder/expression-builder.component.d.ts +0 -49
- package/components/form-generic/src/components/form-builder/components/group/attribute/group-attribute.component.d.ts +0 -24
- package/components/form-generic/src/components/form-builder/components/group/index.d.ts +0 -1
- package/components/form-generic/src/components/form-builder/components/html/attribute/html-attribute.component.d.ts +0 -29
- package/components/form-generic/src/components/form-builder/components/html/control/html-control.component.d.ts +0 -19
- package/components/form-generic/src/components/form-builder/components/html/index.d.ts +0 -2
- package/components/form-generic/src/components/form-builder/components/index.d.ts +0 -13
- package/components/form-generic/src/components/form-builder/components/number/attribute/number-attribute.component.d.ts +0 -22
- package/components/form-generic/src/components/form-builder/components/number/control/number-control.component.d.ts +0 -17
- package/components/form-generic/src/components/form-builder/components/number/index.d.ts +0 -2
- package/components/form-generic/src/components/form-builder/components/radio/attribute/radio-attribute.component.d.ts +0 -22
- package/components/form-generic/src/components/form-builder/components/radio/control/radio-control.component.d.ts +0 -16
- package/components/form-generic/src/components/form-builder/components/radio/index.d.ts +0 -2
- package/components/form-generic/src/components/form-builder/components/select/attribute/select-attribute.component.d.ts +0 -22
- package/components/form-generic/src/components/form-builder/components/select/control/select-control.component.d.ts +0 -16
- package/components/form-generic/src/components/form-builder/components/select/index.d.ts +0 -2
- package/components/form-generic/src/components/form-builder/components/table/attribute/table-attribute.component.d.ts +0 -22
- package/components/form-generic/src/components/form-builder/components/table/control/table-control.component.d.ts +0 -19
- package/components/form-generic/src/components/form-builder/components/table/index.d.ts +0 -2
- package/components/form-generic/src/components/form-builder/components/textarea/attribute/textarea-attribute.component.d.ts +0 -21
- package/components/form-generic/src/components/form-builder/components/textarea/control/textarea-control.component.d.ts +0 -16
- package/components/form-generic/src/components/form-builder/components/textarea/index.d.ts +0 -2
- package/components/form-generic/src/components/form-builder/components/textfield/attribute/textfield-attribute.component.d.ts +0 -21
- package/components/form-generic/src/components/form-builder/components/textfield/control/textfield-control.component.d.ts +0 -16
- package/components/form-generic/src/components/form-builder/components/textfield/index.d.ts +0 -2
- package/components/form-generic/src/components/form-builder/components/upload/attribute/upload-attribute.component.d.ts +0 -27
- package/components/form-generic/src/components/form-builder/components/upload/control/upload-control.component.d.ts +0 -16
- package/components/form-generic/src/components/form-builder/components/upload/index.d.ts +0 -2
- package/components/form-generic/src/components/form-builder/form-builder-layout.d.ts +0 -22
- package/components/form-generic/src/components/form-builder/services/builder.service.d.ts +0 -11
- package/components/form-generic/src/components/form-builder/services/index.d.ts +0 -1
- package/components/form-generic/src/components/form-render/components/item/components/table/table.component.d.ts +0 -56
- package/components/form-generic/src/components/form-render/components/variable/variable.component.d.ts +0 -22
- package/components/form-generic/src/components/sd-feel-expression/sd-feel-expression.component.d.ts +0 -41
- package/components/form-generic/src/configurations/form-generic.configuration.d.ts +0 -6
- package/components/form-generic/src/configurations/form.configuration.d.ts +0 -12
- package/components/form-generic/src/models/form-generic-component.model.d.ts +0 -319
- package/components/form-generic/src/models/form-generic-definition-html.model.d.ts +0 -28
- package/components/form-generic/src/models/form-generic-definition-selection.model.d.ts +0 -49
- package/components/form-generic/src/models/form-generic-definition-table.model.d.ts +0 -6
- package/components/form-generic/src/models/form-generic-expression.model.d.ts +0 -74
- package/components/form-generic/src/models/form-generic-template.model.d.ts +0 -6
- package/components/form-generic/src/models/form-generic-validation.model.d.ts +0 -30
- package/components/form-generic/src/models/form-generic.model.d.ts +0 -7
- package/components/form-generic/src/models/form-render/form-render-args.model.d.ts +0 -7
- package/components/form-generic/src/models/form-render/form-render-entity.model.d.ts +0 -3
- package/components/form-generic/src/models/form-render/index.d.ts +0 -2
- package/components/form-generic/src/pipes/expression-feel.pipe.d.ts +0 -10
- package/components/form-generic/src/pipes/expression-query.pipe.d.ts +0 -10
- package/components/form-generic/src/pipes/expression-view.pipe.d.ts +0 -8
- package/components/form-generic/src/pipes/when-expression.pipe.d.ts +0 -13
|
@@ -1,12 +1,477 @@
|
|
|
1
|
-
import { NgComponentOutlet, DOCUMENT } from '@angular/common';
|
|
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);
|
|
298
|
+
/** Value handed to `click` and to the state predicates: the selected files, or one item. */
|
|
299
|
+
context = input.required();
|
|
300
|
+
/** Variant of leaves (flat buttons) without `type`. */
|
|
301
|
+
defaultLeafType = input('text');
|
|
302
|
+
/** Variant of group triggers without `type`. */
|
|
303
|
+
defaultGroupType = input('text');
|
|
304
|
+
/** Color of definitions without `color`. */
|
|
305
|
+
defaultColor = input('secondary');
|
|
306
|
+
/** `sd-button` size of every entry. */
|
|
307
|
+
size = input('sm');
|
|
308
|
+
/** Collection name used in dev-mode warnings. */
|
|
309
|
+
source = input('actions');
|
|
310
|
+
/** Prefix of the entries' `data-autoid`, suffixed with the declared index (and the child index in menus). */
|
|
311
|
+
autoId = input(undefined);
|
|
312
|
+
// why: Angular query không dùng được trên field private kiểu ES (#) — dùng `private` của TypeScript.
|
|
313
|
+
buttons = viewChildren(SdButton);
|
|
314
|
+
entries = computed(() => sdFileExplorerResolveActions(this.actions(), this.context(), { leafType: this.defaultLeafType(), groupType: this.defaultGroupType(), color: this.defaultColor() }, this.source()));
|
|
315
|
+
open = computed(() => this.buttons().some(button => button.popover.opened()));
|
|
316
|
+
busy = computed(() => sdFileExplorerActionsBusy(this.entries()));
|
|
317
|
+
loadingLabel = computed(() => this.#i18n.t('core.component.file-explorer.action-loading'));
|
|
318
|
+
run(action, group) {
|
|
319
|
+
const actions = this.actions();
|
|
320
|
+
// A stale rendered button or menu must not dispatch a definition the consumer has withdrawn.
|
|
321
|
+
if (group ? !actions?.includes(group) || !group.children.includes(action) : !actions?.includes(action))
|
|
322
|
+
return;
|
|
323
|
+
const context = this.context();
|
|
324
|
+
// why: trạng thái do consumer giữ có thể đã đổi sau lần render cuối (ví dụ bật loading ngay trong click trước, khi
|
|
325
|
+
// Angular chưa kịp vẽ lại nút) — đánh giá lại lúc bấm để click lặp hay menu cũ không chạy callback lần nữa.
|
|
326
|
+
if ((group && sdFileExplorerActionBlocked(group, context)) || sdFileExplorerActionBlocked(action, context))
|
|
327
|
+
return;
|
|
328
|
+
(action.onClick ?? action.click)?.(context);
|
|
329
|
+
}
|
|
330
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdFileExplorerActions, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
331
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: SdFileExplorerActions, isStandalone: true, selector: "sd-file-explorer-actions", inputs: { actions: { classPropertyName: "actions", publicName: "actions", isSignal: true, isRequired: false, transformFunction: null }, context: { classPropertyName: "context", publicName: "context", isSignal: true, isRequired: true, transformFunction: null }, defaultLeafType: { classPropertyName: "defaultLeafType", publicName: "defaultLeafType", isSignal: true, isRequired: false, transformFunction: null }, defaultGroupType: { classPropertyName: "defaultGroupType", publicName: "defaultGroupType", isSignal: true, isRequired: false, transformFunction: null }, defaultColor: { classPropertyName: "defaultColor", publicName: "defaultColor", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, source: { classPropertyName: "source", publicName: "source", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.sd-file-explorer-actions--open": "open()", "class.sd-file-explorer-actions--busy": "busy()" }, classAttribute: "sd-file-explorer-actions" }, viewQueries: [{ propertyName: "buttons", predicate: SdButton, descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
332
|
+
@let _autoId = autoId();
|
|
333
|
+
@let _size = size();
|
|
334
|
+
@for (entry of entries(); track entry.key) {
|
|
335
|
+
@let _entryAutoId = _autoId ? _autoId + '-' + entry.key : null;
|
|
336
|
+
@if (entry.kind === 'leaf') {
|
|
337
|
+
<sd-button
|
|
338
|
+
class="action"
|
|
339
|
+
[type]="entry.type"
|
|
340
|
+
[color]="entry.color"
|
|
341
|
+
[size]="_size"
|
|
342
|
+
[title]="entry.title"
|
|
343
|
+
[tooltip]="entry.tooltip"
|
|
344
|
+
[prefixIcon]="entry.prefixIcon"
|
|
345
|
+
[suffixIcon]="entry.suffixIcon"
|
|
346
|
+
[fontSet]="entry.fontSet"
|
|
347
|
+
[disabled]="entry.disabled"
|
|
348
|
+
[loading]="entry.loading"
|
|
349
|
+
[attr.data-autoid]="_entryAutoId"
|
|
350
|
+
(click)="run(entry.definition)" />
|
|
351
|
+
} @else {
|
|
352
|
+
<sd-button
|
|
353
|
+
class="action action--group"
|
|
354
|
+
[type]="entry.type"
|
|
355
|
+
[color]="entry.color"
|
|
356
|
+
[size]="_size"
|
|
357
|
+
[title]="entry.title"
|
|
358
|
+
[tooltip]="entry.tooltip"
|
|
359
|
+
[prefixIcon]="entry.prefixIcon"
|
|
360
|
+
[suffixIcon]="entry.suffixIcon"
|
|
361
|
+
[fontSet]="entry.fontSet"
|
|
362
|
+
[disabled]="entry.disabled"
|
|
363
|
+
[loading]="entry.loading"
|
|
364
|
+
[attr.data-autoid]="_entryAutoId">
|
|
365
|
+
@for (child of entry.children; track child.key) {
|
|
366
|
+
<sd-button-item
|
|
367
|
+
[color]="child.color"
|
|
368
|
+
[prefixIcon]="child.prefixIcon"
|
|
369
|
+
[suffixIcon]="child.suffixIcon"
|
|
370
|
+
[fontSet]="child.fontSet"
|
|
371
|
+
[tooltip]="child.tooltip"
|
|
372
|
+
[disabled]="child.disabled"
|
|
373
|
+
[autoId]="_entryAutoId ? _entryAutoId + '-' + child.key : null"
|
|
374
|
+
(click)="run(child.definition, entry.definition)">
|
|
375
|
+
<!-- why: sd-button-item has no loading input; a busy item shows a spinner here and is disabled. -->
|
|
376
|
+
@if (child.loading) {
|
|
377
|
+
<span class="spinner" aria-hidden="true"></span>
|
|
378
|
+
}
|
|
379
|
+
{{ child.label }}
|
|
380
|
+
@if (child.loading) {
|
|
381
|
+
<span class="visually-hidden">{{ loadingLabel() }}</span>
|
|
382
|
+
}
|
|
383
|
+
</sd-button-item>
|
|
384
|
+
}
|
|
385
|
+
</sd-button>
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
`, isInline: true, styles: [":host{display:inline-flex;flex-wrap:wrap;align-items:center;gap:2px;min-width:0;max-width:100%}sd-button{min-width:0;max-width:100%}:host ::ng-deep>sd-button>button.c-button{max-width:100%}.spinner{display:inline-block;width:14px;height:14px;margin-inline-end:8px;vertical-align:-2px;border:2px solid color-mix(in srgb,currentColor 25%,transparent);border-top-color:currentColor;border-radius:50%;animation:sd-file-explorer-actions-spin .8s linear infinite}.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}@keyframes sd-file-explorer-actions-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.spinner{animation-duration:2.4s}}\n"], dependencies: [{ kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "openOnHover", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "component", type: SdButtonItem, selector: "sd-button-item", inputs: ["color", "prefixIcon", "suffixIcon", "fontSet", "disabled", "tooltip", "autoId"], outputs: ["click"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
389
|
+
}
|
|
390
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdFileExplorerActions, decorators: [{
|
|
391
|
+
type: Component,
|
|
392
|
+
args: [{ selector: 'sd-file-explorer-actions', standalone: true, imports: [SdButton, SdButtonItem], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
393
|
+
class: 'sd-file-explorer-actions',
|
|
394
|
+
'[class.sd-file-explorer-actions--open]': 'open()',
|
|
395
|
+
'[class.sd-file-explorer-actions--busy]': 'busy()',
|
|
396
|
+
}, template: `
|
|
397
|
+
@let _autoId = autoId();
|
|
398
|
+
@let _size = size();
|
|
399
|
+
@for (entry of entries(); track entry.key) {
|
|
400
|
+
@let _entryAutoId = _autoId ? _autoId + '-' + entry.key : null;
|
|
401
|
+
@if (entry.kind === 'leaf') {
|
|
402
|
+
<sd-button
|
|
403
|
+
class="action"
|
|
404
|
+
[type]="entry.type"
|
|
405
|
+
[color]="entry.color"
|
|
406
|
+
[size]="_size"
|
|
407
|
+
[title]="entry.title"
|
|
408
|
+
[tooltip]="entry.tooltip"
|
|
409
|
+
[prefixIcon]="entry.prefixIcon"
|
|
410
|
+
[suffixIcon]="entry.suffixIcon"
|
|
411
|
+
[fontSet]="entry.fontSet"
|
|
412
|
+
[disabled]="entry.disabled"
|
|
413
|
+
[loading]="entry.loading"
|
|
414
|
+
[attr.data-autoid]="_entryAutoId"
|
|
415
|
+
(click)="run(entry.definition)" />
|
|
416
|
+
} @else {
|
|
417
|
+
<sd-button
|
|
418
|
+
class="action action--group"
|
|
419
|
+
[type]="entry.type"
|
|
420
|
+
[color]="entry.color"
|
|
421
|
+
[size]="_size"
|
|
422
|
+
[title]="entry.title"
|
|
423
|
+
[tooltip]="entry.tooltip"
|
|
424
|
+
[prefixIcon]="entry.prefixIcon"
|
|
425
|
+
[suffixIcon]="entry.suffixIcon"
|
|
426
|
+
[fontSet]="entry.fontSet"
|
|
427
|
+
[disabled]="entry.disabled"
|
|
428
|
+
[loading]="entry.loading"
|
|
429
|
+
[attr.data-autoid]="_entryAutoId">
|
|
430
|
+
@for (child of entry.children; track child.key) {
|
|
431
|
+
<sd-button-item
|
|
432
|
+
[color]="child.color"
|
|
433
|
+
[prefixIcon]="child.prefixIcon"
|
|
434
|
+
[suffixIcon]="child.suffixIcon"
|
|
435
|
+
[fontSet]="child.fontSet"
|
|
436
|
+
[tooltip]="child.tooltip"
|
|
437
|
+
[disabled]="child.disabled"
|
|
438
|
+
[autoId]="_entryAutoId ? _entryAutoId + '-' + child.key : null"
|
|
439
|
+
(click)="run(child.definition, entry.definition)">
|
|
440
|
+
<!-- why: sd-button-item has no loading input; a busy item shows a spinner here and is disabled. -->
|
|
441
|
+
@if (child.loading) {
|
|
442
|
+
<span class="spinner" aria-hidden="true"></span>
|
|
443
|
+
}
|
|
444
|
+
{{ child.label }}
|
|
445
|
+
@if (child.loading) {
|
|
446
|
+
<span class="visually-hidden">{{ loadingLabel() }}</span>
|
|
447
|
+
}
|
|
448
|
+
</sd-button-item>
|
|
449
|
+
}
|
|
450
|
+
</sd-button>
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
`, styles: [":host{display:inline-flex;flex-wrap:wrap;align-items:center;gap:2px;min-width:0;max-width:100%}sd-button{min-width:0;max-width:100%}:host ::ng-deep>sd-button>button.c-button{max-width:100%}.spinner{display:inline-block;width:14px;height:14px;margin-inline-end:8px;vertical-align:-2px;border:2px solid color-mix(in srgb,currentColor 25%,transparent);border-top-color:currentColor;border-radius:50%;animation:sd-file-explorer-actions-spin .8s linear infinite}.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}@keyframes sd-file-explorer-actions-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.spinner{animation-duration:2.4s}}\n"] }]
|
|
454
|
+
}] });
|
|
455
|
+
|
|
456
|
+
/** List-only custom metadata column. Pass the parent option as its required type anchor. */
|
|
457
|
+
// Public column-definition name follows the reviewed Explorer contract.
|
|
458
|
+
// eslint-disable-next-line @angular-eslint/directive-class-suffix
|
|
459
|
+
class SdFileExplorerColumnDef {
|
|
460
|
+
id = input.required({ alias: 'sdFileExplorerColumnDef' });
|
|
461
|
+
for = input.required({ alias: 'sdFileExplorerColumnFor' });
|
|
462
|
+
title = input.required();
|
|
463
|
+
width = input('160px');
|
|
464
|
+
template = inject(TemplateRef);
|
|
465
|
+
static ngTemplateContextGuard(_directive, _context) {
|
|
466
|
+
return true;
|
|
467
|
+
}
|
|
468
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdFileExplorerColumnDef, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
469
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.21", type: SdFileExplorerColumnDef, isStandalone: true, selector: "ng-template[sdFileExplorerColumnDef]", inputs: { id: { classPropertyName: "id", publicName: "sdFileExplorerColumnDef", isSignal: true, isRequired: true, transformFunction: null }, for: { classPropertyName: "for", publicName: "sdFileExplorerColumnFor", isSignal: true, isRequired: true, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: true, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null } }, ngImport: i0 });
|
|
470
|
+
}
|
|
471
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdFileExplorerColumnDef, decorators: [{
|
|
472
|
+
type: Directive,
|
|
473
|
+
args: [{ selector: 'ng-template[sdFileExplorerColumnDef]', standalone: true }]
|
|
474
|
+
}] });
|
|
10
475
|
|
|
11
476
|
// AUTO-GENERATED by scripts/generate-file-explorer-icons.mjs from ./assets/icons. DO NOT EDIT.
|
|
12
477
|
// Run `npm run generate:file-explorer-icons` at the repo root after changing the SVG files or manifest.json.
|
|
@@ -235,11 +700,6 @@ const EXTENSIONS = {
|
|
|
235
700
|
archive: ['zip', 'rar', '7z', 'tar', 'gz', 'tgz', 'bz2'],
|
|
236
701
|
text: ['txt', 'md', 'json', 'xml', 'log', 'yml', 'yaml', 'html', 'css', 'js', 'ts'],
|
|
237
702
|
};
|
|
238
|
-
const LOCALES = { vi: 'vi-VN', en: 'en-US', ja: 'ja-JP', ko: 'ko-KR', zh: 'zh-CN' };
|
|
239
|
-
/** Maps a Core UI language code to the locale used by `Intl` formatters. */
|
|
240
|
-
function sdFileExplorerLocale(language) {
|
|
241
|
-
return LOCALES[language] ?? 'vi-VN';
|
|
242
|
-
}
|
|
243
703
|
/** Lower-cased extension of a file name, without the dot; empty when there is none. */
|
|
244
704
|
function sdFileExplorerExtension(name) {
|
|
245
705
|
const dot = name.lastIndexOf('.');
|
|
@@ -326,6 +786,8 @@ function sdFileExplorerPreviewKind(type) {
|
|
|
326
786
|
return 'image';
|
|
327
787
|
if (type === 'pdf')
|
|
328
788
|
return 'pdf';
|
|
789
|
+
if (type === 'video')
|
|
790
|
+
return 'video';
|
|
329
791
|
return 'none';
|
|
330
792
|
}
|
|
331
793
|
/**
|
|
@@ -446,25 +908,375 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
446
908
|
}, template: `<img [src]="src()" alt="" draggable="false" />`, styles: [":host{display:inline-flex;flex:none;width:var(--sd-file-explorer-icon-size, 32px);height:var(--sd-file-explorer-icon-size, 32px)}img{display:block;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;user-select:none}\n"] }]
|
|
447
909
|
}] });
|
|
448
910
|
|
|
911
|
+
/** Never the whole viewport: a strip of backdrop stays visible to tap the drawer away. */
|
|
912
|
+
const SHEET_WIDTH = 'min(400px, calc(100vw - 56px))';
|
|
913
|
+
let nextSheetId = 0;
|
|
914
|
+
/**
|
|
915
|
+
* Command drawer of the compact layout (internal): the commands of one item in a Core `<sd-side-drawer>` that covers
|
|
916
|
+
* the viewport — portalled to `<body>`, with its backdrop, `Escape`, close button, focus trap and page scroll lock.
|
|
917
|
+
*
|
|
918
|
+
* The explorer owns the item and decides when the drawer opens and closes: `show()` / `hide()`. The drawer lists the
|
|
919
|
+
* same commands as the desktop buttons, as menu-like entries; a group is a labelled section with its children. A
|
|
920
|
+
* pressed entry is only reported (`activate`): the explorer checks it again, closes the drawer and runs it. `close`
|
|
921
|
+
* reports that the user closed the drawer (close button, `Escape`, backdrop).
|
|
922
|
+
*
|
|
923
|
+
* Content projected into the drawer belongs to this view, so its encapsulated styles still apply in `<body>`; the
|
|
924
|
+
* drawer element itself is styled through the class this component passes as `drawerClass`.
|
|
925
|
+
*/
|
|
926
|
+
class SdFileExplorerCommandSheet {
|
|
927
|
+
#i18n = inject(I18nService);
|
|
928
|
+
/** Content for the item whose commands are shown; `null` while nothing is open. */
|
|
929
|
+
sheet = input(null);
|
|
930
|
+
/** Touch screen: 48 px entries and a 44 px close button. */
|
|
931
|
+
touch = input(false);
|
|
932
|
+
/** E2E scope of the content and its entries. */
|
|
933
|
+
autoId = input(undefined);
|
|
934
|
+
/** An entry was pressed. Nothing has run yet. */
|
|
935
|
+
activate = output();
|
|
936
|
+
/** The user closed the drawer (close button, `Escape` or backdrop). */
|
|
937
|
+
close = output();
|
|
938
|
+
// why: query signal, not an ES private field — Angular queries need a TypeScript `private` member.
|
|
939
|
+
drawer = viewChild.required(SdSideDrawer);
|
|
940
|
+
width = SHEET_WIDTH;
|
|
941
|
+
sheetId = `sd-file-explorer-commands-${nextSheetId++}`;
|
|
942
|
+
// why: sd-side-drawer renders in <body>, out of reach of this view's encapsulated styles. The explorer-owned class
|
|
943
|
+
// scopes the few rules aimed at the drawer itself (the close button size) to this drawer only.
|
|
944
|
+
drawerClass = computed(() => ({
|
|
945
|
+
'sd-file-explorer-command-drawer': true,
|
|
946
|
+
'sd-file-explorer-command-drawer--touch': this.touch(),
|
|
947
|
+
}));
|
|
948
|
+
// why: sd-side-drawer adds its own `components-side-drawer-` prefix; drop the explorer's `components-` to avoid a repeat.
|
|
949
|
+
drawerAutoId = computed(() => this.autoId()?.replace(/^components-/, ''));
|
|
950
|
+
loadingLabel = computed(() => this.#i18n.t('core.component.file-explorer.action-loading'));
|
|
951
|
+
/** Opens the drawer; its content follows `sheet`. */
|
|
952
|
+
show() {
|
|
953
|
+
this.drawer().open();
|
|
954
|
+
}
|
|
955
|
+
/** Closes the drawer at once — focus trap, backdrop and page scroll lock included — without reporting `close`. */
|
|
956
|
+
hide() {
|
|
957
|
+
const drawer = this.drawer();
|
|
958
|
+
if (drawer.isOpened())
|
|
959
|
+
drawer.forceClose();
|
|
960
|
+
}
|
|
961
|
+
accent(color) {
|
|
962
|
+
return color ? `var(--sd-${color})` : null;
|
|
963
|
+
}
|
|
964
|
+
onDrawerClosed() {
|
|
965
|
+
// Closed by the explorer (it has already let go of the item) or by the user: the explorer tells them apart.
|
|
966
|
+
if (this.sheet())
|
|
967
|
+
this.close.emit();
|
|
968
|
+
}
|
|
969
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdFileExplorerCommandSheet, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
970
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: SdFileExplorerCommandSheet, isStandalone: true, selector: "sd-file-explorer-command-sheet", inputs: { sheet: { classPropertyName: "sheet", publicName: "sheet", isSignal: true, isRequired: false, transformFunction: null }, touch: { classPropertyName: "touch", publicName: "touch", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { activate: "activate", close: "close" }, host: { classAttribute: "sd-file-explorer-command-sheet" }, viewQueries: [{ propertyName: "drawer", first: true, predicate: SdSideDrawer, descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
971
|
+
@let _sheet = sheet();
|
|
972
|
+
@let _autoId = autoId();
|
|
973
|
+
<sd-side-drawer
|
|
974
|
+
[width]="width"
|
|
975
|
+
[title]="_sheet?.title ?? ''"
|
|
976
|
+
[drawerClass]="drawerClass()"
|
|
977
|
+
[autoId]="drawerAutoId()"
|
|
978
|
+
(sdClosed)="onDrawerClosed()">
|
|
979
|
+
@if (_sheet) {
|
|
980
|
+
<div class="sheet" [class.sheet--touch]="touch()" [attr.data-autoid]="_autoId ?? null">
|
|
981
|
+
<p class="context">
|
|
982
|
+
<sd-file-explorer-file-icon [icon]="_sheet.icon" [size]="24" />
|
|
983
|
+
<span class="context-text">{{ _sheet.context }}</span>
|
|
984
|
+
</p>
|
|
985
|
+
<div class="entries">
|
|
986
|
+
@for (entry of _sheet.entries; track entry.key) {
|
|
987
|
+
@if (entry.kind === 'group') {
|
|
988
|
+
@let _labelId = sheetId + '-group-' + entry.key;
|
|
989
|
+
<div
|
|
990
|
+
class="group"
|
|
991
|
+
role="group"
|
|
992
|
+
[attr.aria-labelledby]="entry.loading ? _labelId + ' ' + _labelId + '-busy' : _labelId"
|
|
993
|
+
[attr.aria-disabled]="entry.disabled ? true : null"
|
|
994
|
+
[attr.aria-busy]="entry.loading ? true : null">
|
|
995
|
+
<!-- why: the heading is not a control: text only, so it never repeats the icon of a child (a "Share"
|
|
996
|
+
group over a "Share" item). The group's icon stays on its desktop trigger; a busy group still
|
|
997
|
+
shows its spinner and says "in progress". -->
|
|
998
|
+
<p class="group-label">
|
|
999
|
+
@if (entry.loading) {
|
|
1000
|
+
<span class="spinner" aria-hidden="true"></span>
|
|
1001
|
+
}
|
|
1002
|
+
<span class="group-title" [id]="_labelId">{{ entry.label }}</span>
|
|
1003
|
+
@if (entry.loading) {
|
|
1004
|
+
<span class="visually-hidden" [id]="_labelId + '-busy'">{{ loadingLabel() }}</span>
|
|
1005
|
+
}
|
|
1006
|
+
</p>
|
|
1007
|
+
@for (child of entry.children; track child.key) {
|
|
1008
|
+
<ng-container
|
|
1009
|
+
[ngTemplateOutlet]="command"
|
|
1010
|
+
[ngTemplateOutletContext]="{
|
|
1011
|
+
$implicit: child,
|
|
1012
|
+
group: entry,
|
|
1013
|
+
autoId: _autoId ? _autoId + '-' + entry.key + '-' + child.key : null,
|
|
1014
|
+
}" />
|
|
1015
|
+
}
|
|
1016
|
+
</div>
|
|
1017
|
+
} @else {
|
|
1018
|
+
<ng-container
|
|
1019
|
+
[ngTemplateOutlet]="command"
|
|
1020
|
+
[ngTemplateOutletContext]="{ $implicit: entry, group: null, autoId: _autoId ? _autoId + '-' + entry.key : null }" />
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
</div>
|
|
1024
|
+
</div>
|
|
1025
|
+
}
|
|
1026
|
+
</sd-side-drawer>
|
|
1027
|
+
|
|
1028
|
+
<!-- One entry: neutral label, icons in the declared color (as Core menu items), spinner + hidden text while loading. -->
|
|
1029
|
+
<ng-template #command let-command let-group="group" let-entryAutoId="autoId">
|
|
1030
|
+
<button
|
|
1031
|
+
type="button"
|
|
1032
|
+
class="command"
|
|
1033
|
+
[disabled]="command.disabled"
|
|
1034
|
+
[style.--sd-fe-command-accent]="accent(command.color)"
|
|
1035
|
+
[attr.data-autoid]="entryAutoId"
|
|
1036
|
+
(click)="activate.emit({ command, group })">
|
|
1037
|
+
@if (command.loading) {
|
|
1038
|
+
<span class="spinner" aria-hidden="true"></span>
|
|
1039
|
+
} @else if (command.prefixIcon) {
|
|
1040
|
+
<sd-icon class="command-icon" size="20px" [name]="command.prefixIcon" [fontSet]="command.fontSet" />
|
|
1041
|
+
}
|
|
1042
|
+
<span class="command-label">{{ command.label }}</span>
|
|
1043
|
+
@if (command.suffixIcon && !command.loading) {
|
|
1044
|
+
<sd-icon class="command-icon" size="20px" [name]="command.suffixIcon" [fontSet]="command.fontSet" />
|
|
1045
|
+
}
|
|
1046
|
+
@if (command.loading) {
|
|
1047
|
+
<span class="visually-hidden">{{ loadingLabel() }}</span>
|
|
1048
|
+
}
|
|
1049
|
+
</button>
|
|
1050
|
+
</ng-template>
|
|
1051
|
+
`, isInline: true, styles: [".sheet{display:flex;flex-direction:column;gap:12px;padding-bottom:env(safe-area-inset-bottom,0px)}.context{display:flex;align-items:center;gap:8px;margin:0;color:var(--sd-text-secondary, #44474f);font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-18, 18px)}.context-text{min-width:0;overflow-wrap:anywhere}.entries{display:flex;flex-direction:column;gap:2px;margin:0 -8px}.group{display:flex;flex-direction:column;gap:2px;padding-block:4px;border-block:1px solid var(--sd-border, #dde0e5)}.group:first-child{padding-top:0;border-top:0}.group:last-child{padding-bottom:0;border-bottom:0}.group+.group{border-top:0}.group-label{display:flex;align-items:center;gap:8px;margin:0;padding:8px 8px 4px;color:var(--sd-text-secondary, #44474f);font-size:var(--sd-font-size-12, 12px);font-weight:var(--sd-font-weight-semibold, 600);line-height:var(--sd-line-height-16, 16px);overflow-wrap:anywhere}.group-title{min-width:0}.command{display:flex;align-items:center;gap:12px;box-sizing:border-box;width:100%;min-height:44px;padding:10px 8px;border:0;border-radius:var(--sd-radius-8, 8px);background:transparent;color:inherit;font:inherit;font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-line-height-20, 20px);text-align:start;overflow-wrap:anywhere;cursor:pointer;-webkit-tap-highlight-color:transparent}.command:hover:not(:disabled),.command:focus-visible{background:color-mix(in srgb,var(--sd-fe-command-accent, var(--sd-text, #1a1b1f)) 8%,transparent)}.command:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:-2px}.command:disabled{opacity:.45;cursor:default}.sheet--touch .command{min-height:48px}.command-label{flex:1;min-width:0}.command-icon{flex:none;color:var(--sd-fe-command-accent, inherit)}.spinner{flex:none;width:16px;height:16px;margin:2px;box-sizing:border-box;border:2px solid color-mix(in srgb,currentColor 25%,transparent);border-top-color:currentColor;border-radius:50%;animation:sd-file-explorer-command-spin .8s linear infinite}.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}::ng-deep .sd-side-drawer.sd-file-explorer-command-drawer .sd-side-drawer-header{background-color:var(--sd-side-drawer-surface, var(--sd-surface, #ffffff))}::ng-deep .sd-side-drawer.sd-file-explorer-command-drawer--touch .sd-side-drawer-close-btn{width:44px;height:44px}@keyframes sd-file-explorer-command-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.spinner{animation-duration:2.4s}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "component", type: SdSideDrawer, selector: "sd-side-drawer", inputs: ["title", "width", "hideClose", "disableBackdropClose", "beforeClose", "container", "drawerClass", "autoId"], outputs: ["sdClosed", "sdCloseError"] }, { kind: "component", type: SdFileExplorerFileIcon, selector: "sd-file-explorer-file-icon", inputs: ["icon", "size"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1052
|
+
}
|
|
1053
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdFileExplorerCommandSheet, decorators: [{
|
|
1054
|
+
type: Component,
|
|
1055
|
+
args: [{ selector: 'sd-file-explorer-command-sheet', standalone: true, imports: [NgTemplateOutlet, SdIcon, SdSideDrawer, SdFileExplorerFileIcon], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1056
|
+
class: 'sd-file-explorer-command-sheet',
|
|
1057
|
+
}, template: `
|
|
1058
|
+
@let _sheet = sheet();
|
|
1059
|
+
@let _autoId = autoId();
|
|
1060
|
+
<sd-side-drawer
|
|
1061
|
+
[width]="width"
|
|
1062
|
+
[title]="_sheet?.title ?? ''"
|
|
1063
|
+
[drawerClass]="drawerClass()"
|
|
1064
|
+
[autoId]="drawerAutoId()"
|
|
1065
|
+
(sdClosed)="onDrawerClosed()">
|
|
1066
|
+
@if (_sheet) {
|
|
1067
|
+
<div class="sheet" [class.sheet--touch]="touch()" [attr.data-autoid]="_autoId ?? null">
|
|
1068
|
+
<p class="context">
|
|
1069
|
+
<sd-file-explorer-file-icon [icon]="_sheet.icon" [size]="24" />
|
|
1070
|
+
<span class="context-text">{{ _sheet.context }}</span>
|
|
1071
|
+
</p>
|
|
1072
|
+
<div class="entries">
|
|
1073
|
+
@for (entry of _sheet.entries; track entry.key) {
|
|
1074
|
+
@if (entry.kind === 'group') {
|
|
1075
|
+
@let _labelId = sheetId + '-group-' + entry.key;
|
|
1076
|
+
<div
|
|
1077
|
+
class="group"
|
|
1078
|
+
role="group"
|
|
1079
|
+
[attr.aria-labelledby]="entry.loading ? _labelId + ' ' + _labelId + '-busy' : _labelId"
|
|
1080
|
+
[attr.aria-disabled]="entry.disabled ? true : null"
|
|
1081
|
+
[attr.aria-busy]="entry.loading ? true : null">
|
|
1082
|
+
<!-- why: the heading is not a control: text only, so it never repeats the icon of a child (a "Share"
|
|
1083
|
+
group over a "Share" item). The group's icon stays on its desktop trigger; a busy group still
|
|
1084
|
+
shows its spinner and says "in progress". -->
|
|
1085
|
+
<p class="group-label">
|
|
1086
|
+
@if (entry.loading) {
|
|
1087
|
+
<span class="spinner" aria-hidden="true"></span>
|
|
1088
|
+
}
|
|
1089
|
+
<span class="group-title" [id]="_labelId">{{ entry.label }}</span>
|
|
1090
|
+
@if (entry.loading) {
|
|
1091
|
+
<span class="visually-hidden" [id]="_labelId + '-busy'">{{ loadingLabel() }}</span>
|
|
1092
|
+
}
|
|
1093
|
+
</p>
|
|
1094
|
+
@for (child of entry.children; track child.key) {
|
|
1095
|
+
<ng-container
|
|
1096
|
+
[ngTemplateOutlet]="command"
|
|
1097
|
+
[ngTemplateOutletContext]="{
|
|
1098
|
+
$implicit: child,
|
|
1099
|
+
group: entry,
|
|
1100
|
+
autoId: _autoId ? _autoId + '-' + entry.key + '-' + child.key : null,
|
|
1101
|
+
}" />
|
|
1102
|
+
}
|
|
1103
|
+
</div>
|
|
1104
|
+
} @else {
|
|
1105
|
+
<ng-container
|
|
1106
|
+
[ngTemplateOutlet]="command"
|
|
1107
|
+
[ngTemplateOutletContext]="{ $implicit: entry, group: null, autoId: _autoId ? _autoId + '-' + entry.key : null }" />
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
</div>
|
|
1111
|
+
</div>
|
|
1112
|
+
}
|
|
1113
|
+
</sd-side-drawer>
|
|
1114
|
+
|
|
1115
|
+
<!-- One entry: neutral label, icons in the declared color (as Core menu items), spinner + hidden text while loading. -->
|
|
1116
|
+
<ng-template #command let-command let-group="group" let-entryAutoId="autoId">
|
|
1117
|
+
<button
|
|
1118
|
+
type="button"
|
|
1119
|
+
class="command"
|
|
1120
|
+
[disabled]="command.disabled"
|
|
1121
|
+
[style.--sd-fe-command-accent]="accent(command.color)"
|
|
1122
|
+
[attr.data-autoid]="entryAutoId"
|
|
1123
|
+
(click)="activate.emit({ command, group })">
|
|
1124
|
+
@if (command.loading) {
|
|
1125
|
+
<span class="spinner" aria-hidden="true"></span>
|
|
1126
|
+
} @else if (command.prefixIcon) {
|
|
1127
|
+
<sd-icon class="command-icon" size="20px" [name]="command.prefixIcon" [fontSet]="command.fontSet" />
|
|
1128
|
+
}
|
|
1129
|
+
<span class="command-label">{{ command.label }}</span>
|
|
1130
|
+
@if (command.suffixIcon && !command.loading) {
|
|
1131
|
+
<sd-icon class="command-icon" size="20px" [name]="command.suffixIcon" [fontSet]="command.fontSet" />
|
|
1132
|
+
}
|
|
1133
|
+
@if (command.loading) {
|
|
1134
|
+
<span class="visually-hidden">{{ loadingLabel() }}</span>
|
|
1135
|
+
}
|
|
1136
|
+
</button>
|
|
1137
|
+
</ng-template>
|
|
1138
|
+
`, styles: [".sheet{display:flex;flex-direction:column;gap:12px;padding-bottom:env(safe-area-inset-bottom,0px)}.context{display:flex;align-items:center;gap:8px;margin:0;color:var(--sd-text-secondary, #44474f);font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-18, 18px)}.context-text{min-width:0;overflow-wrap:anywhere}.entries{display:flex;flex-direction:column;gap:2px;margin:0 -8px}.group{display:flex;flex-direction:column;gap:2px;padding-block:4px;border-block:1px solid var(--sd-border, #dde0e5)}.group:first-child{padding-top:0;border-top:0}.group:last-child{padding-bottom:0;border-bottom:0}.group+.group{border-top:0}.group-label{display:flex;align-items:center;gap:8px;margin:0;padding:8px 8px 4px;color:var(--sd-text-secondary, #44474f);font-size:var(--sd-font-size-12, 12px);font-weight:var(--sd-font-weight-semibold, 600);line-height:var(--sd-line-height-16, 16px);overflow-wrap:anywhere}.group-title{min-width:0}.command{display:flex;align-items:center;gap:12px;box-sizing:border-box;width:100%;min-height:44px;padding:10px 8px;border:0;border-radius:var(--sd-radius-8, 8px);background:transparent;color:inherit;font:inherit;font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-line-height-20, 20px);text-align:start;overflow-wrap:anywhere;cursor:pointer;-webkit-tap-highlight-color:transparent}.command:hover:not(:disabled),.command:focus-visible{background:color-mix(in srgb,var(--sd-fe-command-accent, var(--sd-text, #1a1b1f)) 8%,transparent)}.command:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-focus-ring-color, var(--sd-primary));outline-offset:-2px}.command:disabled{opacity:.45;cursor:default}.sheet--touch .command{min-height:48px}.command-label{flex:1;min-width:0}.command-icon{flex:none;color:var(--sd-fe-command-accent, inherit)}.spinner{flex:none;width:16px;height:16px;margin:2px;box-sizing:border-box;border:2px solid color-mix(in srgb,currentColor 25%,transparent);border-top-color:currentColor;border-radius:50%;animation:sd-file-explorer-command-spin .8s linear infinite}.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}::ng-deep .sd-side-drawer.sd-file-explorer-command-drawer .sd-side-drawer-header{background-color:var(--sd-side-drawer-surface, var(--sd-surface, #ffffff))}::ng-deep .sd-side-drawer.sd-file-explorer-command-drawer--touch .sd-side-drawer-close-btn{width:44px;height:44px}@keyframes sd-file-explorer-command-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.spinner{animation-duration:2.4s}}\n"] }]
|
|
1139
|
+
}] });
|
|
1140
|
+
|
|
1141
|
+
/**
|
|
1142
|
+
* Compact actions trigger of one row, card or tree node (internal): a `more_vert` icon button that asks the explorer to
|
|
1143
|
+
* open the item's command drawer, emitting itself so focus can come back to it when the drawer closes.
|
|
1144
|
+
*
|
|
1145
|
+
* While one of the item's commands is loading it shows a spinner instead of the icon and stays clickable, so the drawer
|
|
1146
|
+
* can still show which command is busy and run the others.
|
|
1147
|
+
*/
|
|
1148
|
+
class SdFileExplorerMenuTrigger {
|
|
1149
|
+
#i18n = inject(I18nService);
|
|
1150
|
+
/** Accessible name and tooltip: "Actions for {name}" ("… (In progress)" while busy). */
|
|
1151
|
+
label = input.required();
|
|
1152
|
+
/** One of the item's commands is loading. */
|
|
1153
|
+
busy = input(false);
|
|
1154
|
+
/** The item's command drawer is open. */
|
|
1155
|
+
expanded = input(false);
|
|
1156
|
+
/** Touch screen: 48 px target, no tooltip. */
|
|
1157
|
+
touch = input(false);
|
|
1158
|
+
/** `null` keeps the button in the tab order; the tree passes `-1` for every node but its tab stop. */
|
|
1159
|
+
tabIndex = input(null);
|
|
1160
|
+
autoId = input(undefined);
|
|
1161
|
+
/** Pressed: emits the native button, the element focus returns to. */
|
|
1162
|
+
activate = output();
|
|
1163
|
+
accessibleName = computed(() => this.busy() ? `${this.label()} (${this.#i18n.t('core.component.file-explorer.action-loading')})` : this.label());
|
|
1164
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdFileExplorerMenuTrigger, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1165
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: SdFileExplorerMenuTrigger, isStandalone: true, selector: "sd-file-explorer-menu-trigger", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: true, transformFunction: null }, busy: { classPropertyName: "busy", publicName: "busy", isSignal: true, isRequired: false, transformFunction: null }, expanded: { classPropertyName: "expanded", publicName: "expanded", isSignal: true, isRequired: false, transformFunction: null }, touch: { classPropertyName: "touch", publicName: "touch", isSignal: true, isRequired: false, transformFunction: null }, tabIndex: { classPropertyName: "tabIndex", publicName: "tabIndex", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { activate: "activate" }, host: { properties: { "class.sd-file-explorer-menu-trigger--touch": "touch()" }, classAttribute: "sd-file-explorer-menu-trigger" }, ngImport: i0, template: `
|
|
1166
|
+
<!-- why: no tooltip on touch screens — MatTooltip would take over touch gestures (touch-action: none) and block
|
|
1167
|
+
scrolling the list from the button; the accessible name is there either way. The tooltip repeats the name, so
|
|
1168
|
+
Material does not add it as a description read twice. -->
|
|
1169
|
+
<button
|
|
1170
|
+
#button
|
|
1171
|
+
type="button"
|
|
1172
|
+
class="trigger"
|
|
1173
|
+
aria-haspopup="dialog"
|
|
1174
|
+
[attr.aria-expanded]="expanded()"
|
|
1175
|
+
[attr.aria-label]="accessibleName()"
|
|
1176
|
+
[attr.tabindex]="tabIndex()"
|
|
1177
|
+
[attr.data-autoid]="autoId() ?? null"
|
|
1178
|
+
[matTooltip]="accessibleName()"
|
|
1179
|
+
[matTooltipDisabled]="touch()"
|
|
1180
|
+
(click)="activate.emit(button)">
|
|
1181
|
+
@if (busy()) {
|
|
1182
|
+
<span class="spinner" aria-hidden="true"></span>
|
|
1183
|
+
} @else {
|
|
1184
|
+
<sd-icon name="more_vert" size="20px" />
|
|
1185
|
+
}
|
|
1186
|
+
</button>
|
|
1187
|
+
`, isInline: true, styles: [":host{display:inline-flex;flex:none}.trigger{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border:0;border-radius:var(--sd-radius-999, 999px);background:transparent;color:var(--sd-fe-text-secondary, var(--sd-text-secondary, #44474f));cursor:pointer;-webkit-tap-highlight-color:transparent}.trigger:hover,.trigger[aria-expanded=true]{background:var(--sd-fe-hover-strong, rgba(26, 27, 31, .08));color:var(--sd-fe-text, var(--sd-text, #1a1b1f))}.trigger:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-file-explorer-accent, var(--sd-focus-ring-color, var(--sd-primary)));outline-offset:1px}:host(.sd-file-explorer-menu-trigger--touch) .trigger{width:var(--sd-space-48, 48px);height:var(--sd-space-48, 48px)}.spinner{width:16px;height:16px;box-sizing:border-box;border:2px solid color-mix(in srgb,currentColor 25%,transparent);border-top-color:currentColor;border-radius:50%;animation:sd-file-explorer-menu-trigger-spin .8s linear infinite}@keyframes sd-file-explorer-menu-trigger-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.spinner{animation-duration:2.4s}}\n"], dependencies: [{ kind: "directive", type: MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1188
|
+
}
|
|
1189
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdFileExplorerMenuTrigger, decorators: [{
|
|
1190
|
+
type: Component,
|
|
1191
|
+
args: [{ selector: 'sd-file-explorer-menu-trigger', standalone: true, imports: [MatTooltip, SdIcon], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1192
|
+
class: 'sd-file-explorer-menu-trigger',
|
|
1193
|
+
'[class.sd-file-explorer-menu-trigger--touch]': 'touch()',
|
|
1194
|
+
}, template: `
|
|
1195
|
+
<!-- why: no tooltip on touch screens — MatTooltip would take over touch gestures (touch-action: none) and block
|
|
1196
|
+
scrolling the list from the button; the accessible name is there either way. The tooltip repeats the name, so
|
|
1197
|
+
Material does not add it as a description read twice. -->
|
|
1198
|
+
<button
|
|
1199
|
+
#button
|
|
1200
|
+
type="button"
|
|
1201
|
+
class="trigger"
|
|
1202
|
+
aria-haspopup="dialog"
|
|
1203
|
+
[attr.aria-expanded]="expanded()"
|
|
1204
|
+
[attr.aria-label]="accessibleName()"
|
|
1205
|
+
[attr.tabindex]="tabIndex()"
|
|
1206
|
+
[attr.data-autoid]="autoId() ?? null"
|
|
1207
|
+
[matTooltip]="accessibleName()"
|
|
1208
|
+
[matTooltipDisabled]="touch()"
|
|
1209
|
+
(click)="activate.emit(button)">
|
|
1210
|
+
@if (busy()) {
|
|
1211
|
+
<span class="spinner" aria-hidden="true"></span>
|
|
1212
|
+
} @else {
|
|
1213
|
+
<sd-icon name="more_vert" size="20px" />
|
|
1214
|
+
}
|
|
1215
|
+
</button>
|
|
1216
|
+
`, styles: [":host{display:inline-flex;flex:none}.trigger{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border:0;border-radius:var(--sd-radius-999, 999px);background:transparent;color:var(--sd-fe-text-secondary, var(--sd-text-secondary, #44474f));cursor:pointer;-webkit-tap-highlight-color:transparent}.trigger:hover,.trigger[aria-expanded=true]{background:var(--sd-fe-hover-strong, rgba(26, 27, 31, .08));color:var(--sd-fe-text, var(--sd-text, #1a1b1f))}.trigger:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-file-explorer-accent, var(--sd-focus-ring-color, var(--sd-primary)));outline-offset:1px}:host(.sd-file-explorer-menu-trigger--touch) .trigger{width:var(--sd-space-48, 48px);height:var(--sd-space-48, 48px)}.spinner{width:16px;height:16px;box-sizing:border-box;border:2px solid color-mix(in srgb,currentColor 25%,transparent);border-top-color:currentColor;border-radius:50%;animation:sd-file-explorer-menu-trigger-spin .8s linear infinite}@keyframes sd-file-explorer-menu-trigger-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.spinner{animation-duration:2.4s}}\n"] }]
|
|
1217
|
+
}] });
|
|
1218
|
+
|
|
1219
|
+
let nextTreeId = 0;
|
|
1220
|
+
/** Events from a folder command (or the space between them), or from the compact actions trigger, belong to it. */
|
|
1221
|
+
const COMMAND_AREAS = '.node-actions, .sd-file-explorer-menu-trigger';
|
|
449
1222
|
/**
|
|
450
1223
|
* Folder tree of the explorer (internal). Rendered as a flat `role="tree"` list whose depth is carried by
|
|
451
1224
|
* `aria-level`, with a roving tabindex and the WAI-ARIA tree keyboard model.
|
|
1225
|
+
*
|
|
1226
|
+
* Folder commands sit at the end of each folder node. On desktop they are rendered for the hovered or focused node
|
|
1227
|
+
* only — taking no room while hidden, so names keep the full width — and `Tab` from the focused node reaches them
|
|
1228
|
+
* while the tree keeps a single tab stop. A node with commands is named by its label alone and wraps its commands
|
|
1229
|
+
* onto a second line when they do not fit next to the name.
|
|
1230
|
+
*
|
|
1231
|
+
* In the compact layout a folder node carries one actions trigger instead, which asks the explorer for its command
|
|
1232
|
+
* drawer; only the trigger of the tab-stop node is in the tab order.
|
|
452
1233
|
*/
|
|
453
1234
|
class SdFileExplorerFolderTree {
|
|
1235
|
+
moveDropTarget = input();
|
|
454
1236
|
#host = inject(ElementRef);
|
|
455
1237
|
#i18n = inject(I18nService);
|
|
1238
|
+
/** Prefix of the label ids that name nodes with commands. */
|
|
1239
|
+
treeId = `sd-file-explorer-tree-${nextTreeId++}`;
|
|
456
1240
|
/** Visible nodes in display order. */
|
|
457
1241
|
nodes = input.required();
|
|
458
1242
|
/** Accessible name of the tree. */
|
|
459
1243
|
label = input('');
|
|
1244
|
+
/** Commands of every folder node; the root has none. */
|
|
1245
|
+
commands = input(undefined);
|
|
1246
|
+
/** Touch screen: commands always visible, with 48 px buttons (44 px compact trigger). */
|
|
1247
|
+
touch = input(false);
|
|
1248
|
+
/** Compact layout: an actions trigger per folder node instead of its commands. */
|
|
1249
|
+
compact = input(false);
|
|
1250
|
+
/** Id of the folder whose command drawer is open from the tree. */
|
|
1251
|
+
menuOpenId = input(null);
|
|
460
1252
|
/** A node was activated (click, Enter, Space). */
|
|
461
1253
|
select = output();
|
|
462
1254
|
/** Expand / collapse requested. */
|
|
463
1255
|
toggle = output();
|
|
464
1256
|
/** Retry loading the children of a node whose listing failed. */
|
|
465
1257
|
retry = output();
|
|
1258
|
+
/** Compact actions trigger of a folder pressed. */
|
|
1259
|
+
openCommands = output();
|
|
466
1260
|
focusedKey = signal(null);
|
|
467
1261
|
retryLabel = computed(() => this.#i18n.t('core.component.file-explorer.retry'));
|
|
1262
|
+
/**
|
|
1263
|
+
* Compact: trigger state per folder node key, for folders whose drawer would list something; `null` on desktop,
|
|
1264
|
+
* where the nodes render their commands.
|
|
1265
|
+
*/
|
|
1266
|
+
menus = computed(() => {
|
|
1267
|
+
if (!this.compact())
|
|
1268
|
+
return null;
|
|
1269
|
+
const commands = this.commands();
|
|
1270
|
+
const menus = new Map();
|
|
1271
|
+
for (const node of this.nodes()) {
|
|
1272
|
+
if (!node.item)
|
|
1273
|
+
continue;
|
|
1274
|
+
const resolved = sdFileExplorerResolveActions(commands, node.item, SD_FILE_EXPLORER_COMMAND_DEFAULTS, 'folderCommands');
|
|
1275
|
+
if (resolved.length)
|
|
1276
|
+
menus.set(node.key, { busy: sdFileExplorerActionsBusy(resolved) });
|
|
1277
|
+
}
|
|
1278
|
+
return menus;
|
|
1279
|
+
});
|
|
468
1280
|
/** Node owning the roving tabindex: the focused node if still visible, else the selected one. */
|
|
469
1281
|
activeKey = computed(() => {
|
|
470
1282
|
const nodes = this.nodes();
|
|
@@ -477,6 +1289,9 @@ class SdFileExplorerFolderTree {
|
|
|
477
1289
|
const key = node.expanded ? 'core.component.file-explorer.collapse' : 'core.component.file-explorer.expand';
|
|
478
1290
|
return this.#i18n.t(key, { name: node.name });
|
|
479
1291
|
}
|
|
1292
|
+
menuLabel(node) {
|
|
1293
|
+
return this.#i18n.t('core.component.file-explorer.item-actions', { name: node.name });
|
|
1294
|
+
}
|
|
480
1295
|
onToggle(event, node) {
|
|
481
1296
|
// why: nút toggle nằm trong treeitem — chặn bubble để bấm mũi tên không đồng thời điều hướng vào thư mục.
|
|
482
1297
|
event.stopPropagation();
|
|
@@ -486,7 +1301,15 @@ class SdFileExplorerFolderTree {
|
|
|
486
1301
|
event.stopPropagation();
|
|
487
1302
|
this.retry.emit(node);
|
|
488
1303
|
}
|
|
1304
|
+
onClick(event, node) {
|
|
1305
|
+
if (this.#fromCommands(event))
|
|
1306
|
+
return;
|
|
1307
|
+
this.select.emit(node);
|
|
1308
|
+
}
|
|
489
1309
|
onKeydown(event, index) {
|
|
1310
|
+
// why: phím bấm trên nút lệnh thuộc về nút đó — Enter/Space không được mở thư mục, mũi tên không được dời focus khỏi nút.
|
|
1311
|
+
if (this.#fromCommands(event))
|
|
1312
|
+
return;
|
|
490
1313
|
const nodes = this.nodes();
|
|
491
1314
|
const node = nodes[index];
|
|
492
1315
|
if (!node)
|
|
@@ -540,16 +1363,35 @@ class SdFileExplorerFolderTree {
|
|
|
540
1363
|
const element = this.#host.nativeElement.querySelectorAll('[role="treeitem"]')[index];
|
|
541
1364
|
element?.focus();
|
|
542
1365
|
}
|
|
1366
|
+
/** The event started on a folder command (or the space between them) or on the actions trigger of the node. */
|
|
1367
|
+
#fromCommands(event) {
|
|
1368
|
+
const target = event.target instanceof Element ? event.target : null;
|
|
1369
|
+
const area = target?.closest(COMMAND_AREAS);
|
|
1370
|
+
return !!area && event.currentTarget instanceof Element && event.currentTarget.contains(area);
|
|
1371
|
+
}
|
|
543
1372
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdFileExplorerFolderTree, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
544
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: SdFileExplorerFolderTree, isStandalone: true, selector: "sd-file-explorer-folder-tree", inputs: { nodes: { classPropertyName: "nodes", publicName: "nodes", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { select: "select", toggle: "toggle", retry: "retry" }, host: { classAttribute: "sd-file-explorer-folder-tree" }, ngImport: i0, template: `
|
|
1373
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", 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: `
|
|
545
1374
|
@let _nodes = nodes();
|
|
546
1375
|
@let _active = activeKey();
|
|
1376
|
+
@let _commands = commands();
|
|
1377
|
+
@let _hasCommands = !!_commands?.length;
|
|
1378
|
+
@let _touch = touch();
|
|
1379
|
+
@let _commandSize = _touch ? 'lg' : 'sm';
|
|
1380
|
+
@let _menus = menus();
|
|
1381
|
+
@let _menuOpenId = menuOpenId();
|
|
547
1382
|
<ul class="tree" role="tree" [attr.aria-label]="label()">
|
|
548
1383
|
@for (node of _nodes; track node.key; let i = $index) {
|
|
1384
|
+
@let _nodeCommands = _hasCommands && !!node.item;
|
|
1385
|
+
@let _labelId = treeId + '-label-' + i;
|
|
549
1386
|
<li
|
|
550
1387
|
class="node"
|
|
551
1388
|
role="treeitem"
|
|
1389
|
+
[attr.data-move-target]="node.id ?? ''"
|
|
1390
|
+
[class.move-drop-target]="moveDropTarget() === node.id"
|
|
552
1391
|
[class.node--selected]="node.selected"
|
|
1392
|
+
[class.node--commands]="_nodeCommands"
|
|
1393
|
+
[class.node--error]="node.status === 'error'"
|
|
1394
|
+
[attr.aria-labelledby]="_nodeCommands ? _labelId : null"
|
|
553
1395
|
[attr.aria-level]="node.level"
|
|
554
1396
|
[attr.aria-selected]="node.selected"
|
|
555
1397
|
[attr.aria-expanded]="node.expandable ? node.expanded : null"
|
|
@@ -557,7 +1399,7 @@ class SdFileExplorerFolderTree {
|
|
|
557
1399
|
[attr.tabindex]="node.key === _active ? 0 : -1"
|
|
558
1400
|
[attr.data-autoid]="node.autoId"
|
|
559
1401
|
[style.--sd-file-explorer-tree-indent]="(node.level > 1 ? node.level - 2 : 0) * 22 + 'px'"
|
|
560
|
-
(click)="
|
|
1402
|
+
(click)="onClick($event, node)"
|
|
561
1403
|
(keydown)="onKeydown($event, i)"
|
|
562
1404
|
(focus)="focusedKey.set(node.key)">
|
|
563
1405
|
@if (node.level > 1) {
|
|
@@ -577,7 +1419,7 @@ class SdFileExplorerFolderTree {
|
|
|
577
1419
|
}
|
|
578
1420
|
}
|
|
579
1421
|
<sd-file-explorer-file-icon [icon]="node.expanded ? 'folder-open' : 'folder-closed'" [size]="28" />
|
|
580
|
-
<span class="label" [title]="node.name">{{ node.name }}</span>
|
|
1422
|
+
<span class="label" [id]="_labelId" [title]="node.name">{{ node.name }}</span>
|
|
581
1423
|
@if (node.status === 'loading') {
|
|
582
1424
|
<span class="spinner" aria-hidden="true"></span>
|
|
583
1425
|
} @else if (node.status === 'error') {
|
|
@@ -591,22 +1433,64 @@ class SdFileExplorerFolderTree {
|
|
|
591
1433
|
<sd-icon name="refresh" size="16px" />
|
|
592
1434
|
</button>
|
|
593
1435
|
}
|
|
1436
|
+
@if (_nodeCommands) {
|
|
1437
|
+
@if (node.item; as folder) {
|
|
1438
|
+
@if (!_menus) {
|
|
1439
|
+
<sd-file-explorer-actions
|
|
1440
|
+
class="node-actions"
|
|
1441
|
+
source="folderCommands"
|
|
1442
|
+
[actions]="_commands"
|
|
1443
|
+
[context]="folder"
|
|
1444
|
+
[size]="_commandSize"
|
|
1445
|
+
[autoId]="node.autoId ? node.autoId + '-command' : undefined" />
|
|
1446
|
+
} @else {
|
|
1447
|
+
@if (_menus.get(node.key); as menu) {
|
|
1448
|
+
<sd-file-explorer-menu-trigger
|
|
1449
|
+
class="node-menu"
|
|
1450
|
+
[label]="menuLabel(node)"
|
|
1451
|
+
[busy]="menu.busy"
|
|
1452
|
+
[expanded]="folder.id === _menuOpenId"
|
|
1453
|
+
[touch]="_touch"
|
|
1454
|
+
[tabIndex]="node.key === _active ? 0 : -1"
|
|
1455
|
+
[autoId]="node.autoId ? node.autoId + '-commands' : undefined"
|
|
1456
|
+
(activate)="openCommands.emit({ item: folder, trigger: $event })" />
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
594
1461
|
</li>
|
|
595
1462
|
}
|
|
596
1463
|
</ul>
|
|
597
|
-
`, isInline: true, styles: ["
|
|
1464
|
+
`, isInline: true, styles: ["@charset \"UTF-8\";:host{display:block}.tree{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px}.node{display:flex;align-items:center;gap:8px;min-height:40px;padding:0 10px;border-radius:var(--sd-radius-8, 8px);color:var(--sd-fe-text);font-size:var(--sd-font-size-15, 15px);line-height:var(--sd-line-height-20, 20px);cursor:pointer;-webkit-user-select:none;user-select:none;outline:none}.node:hover{background:var(--sd-fe-hover)}.node:focus-visible{box-shadow:inset 0 0 0 2px var(--sd-fe-accent)}.node--selected{background:var(--sd-fe-accent-soft);color:var(--sd-fe-accent);font-weight:var(--sd-font-weight-semibold, 600)}.node--selected:hover{background:var(--sd-fe-accent-soft)}.indent{flex:none;width:var(--sd-file-explorer-tree-indent, 0);margin-right:-8px}.toggle{flex:none;display:inline-flex;align-items:center;justify-content:center;width:16px;height:24px;margin-right:-1px;padding:0;border:0;border-radius:var(--sd-radius-4, 4px);background:transparent;color:var(--sd-fe-text-secondary);cursor:pointer}.toggle:hover{color:var(--sd-fe-text)}.label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host(.sd-file-explorer-folder-tree--touch) .node{min-height:var(--sd-space-48, 48px)}:host(.sd-file-explorer-folder-tree--touch) .node--error{flex-wrap:wrap}:host(.sd-file-explorer-folder-tree--touch) .node--error .label{flex:1 1 8ch;min-inline-size:min(100%,8ch);white-space:normal;overflow-wrap:anywhere}:host(.sd-file-explorer-folder-tree--touch) .node--error .retry{margin-inline-start:auto}:host(.sd-file-explorer-folder-tree--touch) .toggle,:host(.sd-file-explorer-folder-tree--touch) .retry{width:var(--sd-space-48, 48px);height:var(--sd-space-48, 48px)}.retry{flex:none;display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:0;border-radius:var(--sd-radius-6, 6px);background:transparent;color:var(--sd-fe-error);cursor:pointer}.retry:hover{background:color-mix(in srgb,var(--sd-fe-error) 10%,transparent)}.node-actions{display:none;flex:0 1 auto;min-width:0;margin-inline:auto -6px}.node:hover .node-actions,.node:focus-within .node-actions,.node-actions.sd-file-explorer-actions--open,.node-actions.sd-file-explorer-actions--busy,:host(.sd-file-explorer-folder-tree--touch) .node-actions{display:inline-flex}.node--commands{flex-wrap:wrap;row-gap:2px;padding-block:2px}:host(.sd-file-explorer-folder-tree--touch) .node--commands .label{flex:1 1 auto}.node-menu{flex:none;margin-inline:auto -6px}:host(.sd-file-explorer-folder-tree--compact) .node--commands:not(.node--error){flex-wrap:nowrap}:host(.sd-file-explorer-folder-tree--compact) .node--commands:not(.node--error) .label{flex:1 1 0}.spinner{flex:none;width:14px;height:14px;border:2px solid color-mix(in srgb,var(--sd-fe-accent) 25%,transparent);border-top-color:var(--sd-fe-accent);border-radius:50%;animation:sd-file-explorer-tree-spin .8s linear infinite}@keyframes sd-file-explorer-tree-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.spinner{animation-duration:2.4s}}.move-drop-target:after{content:\"\\21b3\";font-weight:700;color:var(--sd-fe-text)}.move-drop-target{outline:2px solid var(--sd-fe-accent);outline-offset:-2px}\n"], dependencies: [{ kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "component", type: SdFileExplorerActions, selector: "sd-file-explorer-actions", inputs: ["actions", "context", "defaultLeafType", "defaultGroupType", "defaultColor", "size", "source", "autoId"] }, { kind: "component", type: SdFileExplorerFileIcon, selector: "sd-file-explorer-file-icon", inputs: ["icon", "size"] }, { kind: "component", type: SdFileExplorerMenuTrigger, selector: "sd-file-explorer-menu-trigger", inputs: ["label", "busy", "expanded", "touch", "tabIndex", "autoId"], outputs: ["activate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
598
1465
|
}
|
|
599
1466
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdFileExplorerFolderTree, decorators: [{
|
|
600
1467
|
type: Component,
|
|
601
|
-
args: [{ selector: 'sd-file-explorer-folder-tree', standalone: true, imports: [SdIcon, SdFileExplorerFileIcon], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1468
|
+
args: [{ selector: 'sd-file-explorer-folder-tree', standalone: true, imports: [SdIcon, SdFileExplorerActions, SdFileExplorerFileIcon, SdFileExplorerMenuTrigger], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1469
|
+
class: 'sd-file-explorer-folder-tree',
|
|
1470
|
+
'[class.sd-file-explorer-folder-tree--touch]': 'touch()',
|
|
1471
|
+
'[class.sd-file-explorer-folder-tree--compact]': 'compact()',
|
|
1472
|
+
}, template: `
|
|
602
1473
|
@let _nodes = nodes();
|
|
603
1474
|
@let _active = activeKey();
|
|
1475
|
+
@let _commands = commands();
|
|
1476
|
+
@let _hasCommands = !!_commands?.length;
|
|
1477
|
+
@let _touch = touch();
|
|
1478
|
+
@let _commandSize = _touch ? 'lg' : 'sm';
|
|
1479
|
+
@let _menus = menus();
|
|
1480
|
+
@let _menuOpenId = menuOpenId();
|
|
604
1481
|
<ul class="tree" role="tree" [attr.aria-label]="label()">
|
|
605
1482
|
@for (node of _nodes; track node.key; let i = $index) {
|
|
1483
|
+
@let _nodeCommands = _hasCommands && !!node.item;
|
|
1484
|
+
@let _labelId = treeId + '-label-' + i;
|
|
606
1485
|
<li
|
|
607
1486
|
class="node"
|
|
608
1487
|
role="treeitem"
|
|
1488
|
+
[attr.data-move-target]="node.id ?? ''"
|
|
1489
|
+
[class.move-drop-target]="moveDropTarget() === node.id"
|
|
609
1490
|
[class.node--selected]="node.selected"
|
|
1491
|
+
[class.node--commands]="_nodeCommands"
|
|
1492
|
+
[class.node--error]="node.status === 'error'"
|
|
1493
|
+
[attr.aria-labelledby]="_nodeCommands ? _labelId : null"
|
|
610
1494
|
[attr.aria-level]="node.level"
|
|
611
1495
|
[attr.aria-selected]="node.selected"
|
|
612
1496
|
[attr.aria-expanded]="node.expandable ? node.expanded : null"
|
|
@@ -614,7 +1498,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
614
1498
|
[attr.tabindex]="node.key === _active ? 0 : -1"
|
|
615
1499
|
[attr.data-autoid]="node.autoId"
|
|
616
1500
|
[style.--sd-file-explorer-tree-indent]="(node.level > 1 ? node.level - 2 : 0) * 22 + 'px'"
|
|
617
|
-
(click)="
|
|
1501
|
+
(click)="onClick($event, node)"
|
|
618
1502
|
(keydown)="onKeydown($event, i)"
|
|
619
1503
|
(focus)="focusedKey.set(node.key)">
|
|
620
1504
|
@if (node.level > 1) {
|
|
@@ -634,7 +1518,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
634
1518
|
}
|
|
635
1519
|
}
|
|
636
1520
|
<sd-file-explorer-file-icon [icon]="node.expanded ? 'folder-open' : 'folder-closed'" [size]="28" />
|
|
637
|
-
<span class="label" [title]="node.name">{{ node.name }}</span>
|
|
1521
|
+
<span class="label" [id]="_labelId" [title]="node.name">{{ node.name }}</span>
|
|
638
1522
|
@if (node.status === 'loading') {
|
|
639
1523
|
<span class="spinner" aria-hidden="true"></span>
|
|
640
1524
|
} @else if (node.status === 'error') {
|
|
@@ -648,17 +1532,56 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
648
1532
|
<sd-icon name="refresh" size="16px" />
|
|
649
1533
|
</button>
|
|
650
1534
|
}
|
|
1535
|
+
@if (_nodeCommands) {
|
|
1536
|
+
@if (node.item; as folder) {
|
|
1537
|
+
@if (!_menus) {
|
|
1538
|
+
<sd-file-explorer-actions
|
|
1539
|
+
class="node-actions"
|
|
1540
|
+
source="folderCommands"
|
|
1541
|
+
[actions]="_commands"
|
|
1542
|
+
[context]="folder"
|
|
1543
|
+
[size]="_commandSize"
|
|
1544
|
+
[autoId]="node.autoId ? node.autoId + '-command' : undefined" />
|
|
1545
|
+
} @else {
|
|
1546
|
+
@if (_menus.get(node.key); as menu) {
|
|
1547
|
+
<sd-file-explorer-menu-trigger
|
|
1548
|
+
class="node-menu"
|
|
1549
|
+
[label]="menuLabel(node)"
|
|
1550
|
+
[busy]="menu.busy"
|
|
1551
|
+
[expanded]="folder.id === _menuOpenId"
|
|
1552
|
+
[touch]="_touch"
|
|
1553
|
+
[tabIndex]="node.key === _active ? 0 : -1"
|
|
1554
|
+
[autoId]="node.autoId ? node.autoId + '-commands' : undefined"
|
|
1555
|
+
(activate)="openCommands.emit({ item: folder, trigger: $event })" />
|
|
1556
|
+
}
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
651
1560
|
</li>
|
|
652
1561
|
}
|
|
653
1562
|
</ul>
|
|
654
|
-
`, styles: ["
|
|
1563
|
+
`, styles: ["@charset \"UTF-8\";:host{display:block}.tree{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px}.node{display:flex;align-items:center;gap:8px;min-height:40px;padding:0 10px;border-radius:var(--sd-radius-8, 8px);color:var(--sd-fe-text);font-size:var(--sd-font-size-15, 15px);line-height:var(--sd-line-height-20, 20px);cursor:pointer;-webkit-user-select:none;user-select:none;outline:none}.node:hover{background:var(--sd-fe-hover)}.node:focus-visible{box-shadow:inset 0 0 0 2px var(--sd-fe-accent)}.node--selected{background:var(--sd-fe-accent-soft);color:var(--sd-fe-accent);font-weight:var(--sd-font-weight-semibold, 600)}.node--selected:hover{background:var(--sd-fe-accent-soft)}.indent{flex:none;width:var(--sd-file-explorer-tree-indent, 0);margin-right:-8px}.toggle{flex:none;display:inline-flex;align-items:center;justify-content:center;width:16px;height:24px;margin-right:-1px;padding:0;border:0;border-radius:var(--sd-radius-4, 4px);background:transparent;color:var(--sd-fe-text-secondary);cursor:pointer}.toggle:hover{color:var(--sd-fe-text)}.label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host(.sd-file-explorer-folder-tree--touch) .node{min-height:var(--sd-space-48, 48px)}:host(.sd-file-explorer-folder-tree--touch) .node--error{flex-wrap:wrap}:host(.sd-file-explorer-folder-tree--touch) .node--error .label{flex:1 1 8ch;min-inline-size:min(100%,8ch);white-space:normal;overflow-wrap:anywhere}:host(.sd-file-explorer-folder-tree--touch) .node--error .retry{margin-inline-start:auto}:host(.sd-file-explorer-folder-tree--touch) .toggle,:host(.sd-file-explorer-folder-tree--touch) .retry{width:var(--sd-space-48, 48px);height:var(--sd-space-48, 48px)}.retry{flex:none;display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;border:0;border-radius:var(--sd-radius-6, 6px);background:transparent;color:var(--sd-fe-error);cursor:pointer}.retry:hover{background:color-mix(in srgb,var(--sd-fe-error) 10%,transparent)}.node-actions{display:none;flex:0 1 auto;min-width:0;margin-inline:auto -6px}.node:hover .node-actions,.node:focus-within .node-actions,.node-actions.sd-file-explorer-actions--open,.node-actions.sd-file-explorer-actions--busy,:host(.sd-file-explorer-folder-tree--touch) .node-actions{display:inline-flex}.node--commands{flex-wrap:wrap;row-gap:2px;padding-block:2px}:host(.sd-file-explorer-folder-tree--touch) .node--commands .label{flex:1 1 auto}.node-menu{flex:none;margin-inline:auto -6px}:host(.sd-file-explorer-folder-tree--compact) .node--commands:not(.node--error){flex-wrap:nowrap}:host(.sd-file-explorer-folder-tree--compact) .node--commands:not(.node--error) .label{flex:1 1 0}.spinner{flex:none;width:14px;height:14px;border:2px solid color-mix(in srgb,var(--sd-fe-accent) 25%,transparent);border-top-color:var(--sd-fe-accent);border-radius:50%;animation:sd-file-explorer-tree-spin .8s linear infinite}@keyframes sd-file-explorer-tree-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.spinner{animation-duration:2.4s}}.move-drop-target:after{content:\"\\21b3\";font-weight:700;color:var(--sd-fe-text)}.move-drop-target{outline:2px solid var(--sd-fe-accent);outline-offset:-2px}\n"] }]
|
|
655
1564
|
}] });
|
|
656
1565
|
|
|
1566
|
+
/** Rows and cards ignore clicks and Enter / Space coming from these areas: they belong to a checkbox or a command. */
|
|
1567
|
+
const CONTROL_AREAS = '.cell--select, .card-top, .commands, .sd-file-explorer-menu-trigger';
|
|
657
1568
|
/**
|
|
658
1569
|
* Items of the current folder (or search results) as a list or a grid (internal).
|
|
659
|
-
* Rows and cards are focusable; `Enter` / `Space` activate them like a click.
|
|
1570
|
+
* Rows and cards are focusable; `Enter` / `Space` activate them like a click. Selection checkboxes and commands sit
|
|
1571
|
+
* next to the name and never activate the item.
|
|
1572
|
+
*
|
|
1573
|
+
* In the compact layout a row or card carries one actions trigger instead of its commands and row shortcuts: the
|
|
1574
|
+
* explorer lists them in its command drawer.
|
|
660
1575
|
*/
|
|
661
1576
|
class SdFileExplorerItemList {
|
|
1577
|
+
canMove = input(false);
|
|
1578
|
+
moveDropTarget = input();
|
|
1579
|
+
movePending = input(false);
|
|
1580
|
+
move = output();
|
|
1581
|
+
columns = input([]);
|
|
1582
|
+
columnWidths = computed(() => this.columns()
|
|
1583
|
+
.map(column => column.width())
|
|
1584
|
+
.join(' '));
|
|
662
1585
|
/** Items to render, already formatted. */
|
|
663
1586
|
items = input.required();
|
|
664
1587
|
/** `list` or `grid`. */
|
|
@@ -667,43 +1590,133 @@ class SdFileExplorerItemList {
|
|
|
667
1590
|
canDownload = input(false);
|
|
668
1591
|
/** Show share buttons for files. */
|
|
669
1592
|
canShare = input(false);
|
|
670
|
-
/** Narrow layout: hides the modified column. */
|
|
1593
|
+
/** Narrow layout: hides the modified column and replaces commands and row shortcuts with an actions trigger. */
|
|
671
1594
|
compact = input(false);
|
|
1595
|
+
/** Touch screen: commands always visible, with 48 px touch targets. */
|
|
1596
|
+
touch = input(false);
|
|
672
1597
|
/** Id of the file currently shown in the preview panel. */
|
|
673
1598
|
activeId = input(null);
|
|
674
1599
|
/** Accessible name of the list. */
|
|
675
1600
|
label = input('');
|
|
1601
|
+
/** Selection state; `null` hides every checkbox. */
|
|
1602
|
+
selection = input(null);
|
|
1603
|
+
/** Commands of file rows and cards. */
|
|
1604
|
+
fileCommands = input(undefined);
|
|
1605
|
+
/** Commands of folder rows and cards. */
|
|
1606
|
+
folderCommands = input(undefined);
|
|
1607
|
+
/** Id of the item whose command drawer is open from this list. */
|
|
1608
|
+
menuOpenId = input(null);
|
|
676
1609
|
/** Row / card activated. */
|
|
677
1610
|
activate = output();
|
|
1611
|
+
/** Compact actions trigger pressed. */
|
|
1612
|
+
openCommands = output();
|
|
678
1613
|
/** Download button pressed. */
|
|
679
1614
|
download = output();
|
|
680
1615
|
/** Share button pressed. */
|
|
681
1616
|
share = output();
|
|
682
|
-
/**
|
|
1617
|
+
/** Checkbox of a file toggled. */
|
|
1618
|
+
toggleSelect = output();
|
|
1619
|
+
/** Select-all checkbox toggled. */
|
|
1620
|
+
toggleSelectAll = output();
|
|
1621
|
+
/**
|
|
1622
|
+
* Width of the row action column: one 32 px icon button per row shortcut on desktop; the actions trigger (32 px,
|
|
1623
|
+
* 48 px on touch) in compact.
|
|
1624
|
+
*/
|
|
683
1625
|
actionsWidth = computed(() => {
|
|
1626
|
+
if (this.compact())
|
|
1627
|
+
return this.menuColumn() ? `${(this.touch() ? 48 : 32) + 4}px` : null;
|
|
684
1628
|
const count = (this.canDownload() ? 1 : 0) + (this.canShare() ? 1 : 0);
|
|
685
1629
|
if (!count)
|
|
686
1630
|
return null;
|
|
687
|
-
return `${count * 32 + (count - 1) * 2 +
|
|
1631
|
+
return `${count * 32 + (count - 1) * 2 + 12}px`;
|
|
688
1632
|
});
|
|
1633
|
+
hasCommands = computed(() => !!(this.fileCommands()?.length || this.folderCommands()?.length));
|
|
1634
|
+
rows = computed(() => {
|
|
1635
|
+
const selection = this.selection();
|
|
1636
|
+
const fileCommands = this.fileCommands();
|
|
1637
|
+
const folderCommands = this.folderCommands();
|
|
1638
|
+
const compact = this.compact();
|
|
1639
|
+
// why: only list rows carry the download / share shortcuts — grid cards never did — so only they bring them into
|
|
1640
|
+
// the drawer. The explorer turns them off as soon as fileCommands is declared.
|
|
1641
|
+
const shortcuts = this.view() === 'list' && (this.canDownload() || this.canShare());
|
|
1642
|
+
return this.items().map(view => {
|
|
1643
|
+
const isFile = view.item.kind === 'file';
|
|
1644
|
+
const commands = isFile ? fileCommands : folderCommands;
|
|
1645
|
+
const source = isFile ? 'fileCommands' : 'folderCommands';
|
|
1646
|
+
return {
|
|
1647
|
+
view,
|
|
1648
|
+
selectable: !!selection && isFile,
|
|
1649
|
+
selected: !!selection?.selectedIds.has(view.item.id),
|
|
1650
|
+
selectDisabled: !!selection?.disabledIds.has(view.item.id),
|
|
1651
|
+
commands: !compact && commands?.length ? commands : null,
|
|
1652
|
+
source,
|
|
1653
|
+
menu: compact ? this.#menu(commands, view.item, source, isFile && shortcuts) : null,
|
|
1654
|
+
};
|
|
1655
|
+
});
|
|
1656
|
+
});
|
|
1657
|
+
/** Compact list with at least one actions trigger: the action column holds them. */
|
|
1658
|
+
menuColumn = computed(() => this.rows().some(row => row.menu));
|
|
1659
|
+
/** Trigger state of one item: `null` when its drawer would be empty. Same filtering as the drawer and the buttons. */
|
|
1660
|
+
#menu(commands, item, source, shortcuts) {
|
|
1661
|
+
const resolved = sdFileExplorerResolveActions(commands, item, SD_FILE_EXPLORER_COMMAND_DEFAULTS, source);
|
|
1662
|
+
return resolved.length || shortcuts ? { busy: sdFileExplorerActionsBusy(resolved) } : null;
|
|
1663
|
+
}
|
|
1664
|
+
onClick(event, view) {
|
|
1665
|
+
if (this.#fromControl(event))
|
|
1666
|
+
return;
|
|
1667
|
+
this.activate.emit(view);
|
|
1668
|
+
}
|
|
689
1669
|
onKeydown(event, view) {
|
|
690
1670
|
if (event.key !== 'Enter' && event.key !== ' ')
|
|
691
1671
|
return;
|
|
1672
|
+
if (this.#fromControl(event))
|
|
1673
|
+
return;
|
|
692
1674
|
event.preventDefault();
|
|
693
1675
|
this.activate.emit(view);
|
|
694
1676
|
}
|
|
1677
|
+
/** The event started on a checkbox or a command (or the space around it) inside the row / card. */
|
|
1678
|
+
#fromControl(event) {
|
|
1679
|
+
const target = event.target instanceof Element ? event.target : null;
|
|
1680
|
+
const area = target?.closest(CONTROL_AREAS);
|
|
1681
|
+
return !!area && event.currentTarget instanceof Element && event.currentTarget.contains(area);
|
|
1682
|
+
}
|
|
695
1683
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdFileExplorerItemList, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
696
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", 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: `
|
|
697
|
-
@let
|
|
1684
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: SdFileExplorerItemList, isStandalone: true, selector: "sd-file-explorer-item-list", inputs: { canMove: { classPropertyName: "canMove", publicName: "canMove", isSignal: true, isRequired: false, transformFunction: null }, moveDropTarget: { classPropertyName: "moveDropTarget", publicName: "moveDropTarget", isSignal: true, isRequired: false, transformFunction: null }, movePending: { classPropertyName: "movePending", publicName: "movePending", isSignal: true, isRequired: false, transformFunction: null }, columns: { classPropertyName: "columns", publicName: "columns", isSignal: true, isRequired: false, transformFunction: null }, items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: true, transformFunction: null }, view: { classPropertyName: "view", publicName: "view", isSignal: true, isRequired: false, transformFunction: null }, canDownload: { classPropertyName: "canDownload", publicName: "canDownload", isSignal: true, isRequired: false, transformFunction: null }, canShare: { classPropertyName: "canShare", publicName: "canShare", isSignal: true, isRequired: false, transformFunction: null }, compact: { classPropertyName: "compact", publicName: "compact", isSignal: true, isRequired: false, transformFunction: null }, touch: { classPropertyName: "touch", publicName: "touch", isSignal: true, isRequired: false, transformFunction: null }, activeId: { classPropertyName: "activeId", publicName: "activeId", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, selection: { classPropertyName: "selection", publicName: "selection", isSignal: true, isRequired: false, transformFunction: null }, fileCommands: { classPropertyName: "fileCommands", publicName: "fileCommands", isSignal: true, isRequired: false, transformFunction: null }, folderCommands: { classPropertyName: "folderCommands", publicName: "folderCommands", isSignal: true, isRequired: false, transformFunction: null }, menuOpenId: { classPropertyName: "menuOpenId", publicName: "menuOpenId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { move: "move", activate: "activate", openCommands: "openCommands", download: "download", share: "share", toggleSelect: "toggleSelect", toggleSelectAll: "toggleSelectAll" }, host: { properties: { "class.sd-file-explorer-item-list--compact": "compact()", "class.sd-file-explorer-item-list--touch": "touch()", "style.--sd-fe-actions-width": "actionsWidth()" }, classAttribute: "sd-file-explorer-item-list" }, ngImport: i0, template: `
|
|
1685
|
+
@let _rows = rows();
|
|
698
1686
|
@let _canDownload = canDownload();
|
|
699
1687
|
@let _canShare = canShare();
|
|
700
|
-
@let _hasActions = _canDownload || _canShare;
|
|
701
1688
|
@let _compact = compact();
|
|
1689
|
+
@let _touch = touch();
|
|
1690
|
+
@let _actionColumn = _compact ? menuColumn() : _canDownload || _canShare;
|
|
702
1691
|
@let _activeId = activeId();
|
|
1692
|
+
@let _menuOpenId = menuOpenId();
|
|
1693
|
+
@let _selection = selection();
|
|
1694
|
+
@let _commandSize = _touch && !_compact ? 'lg' : 'sm';
|
|
703
1695
|
@if (view() === 'list') {
|
|
704
|
-
<div
|
|
1696
|
+
<div
|
|
1697
|
+
class="list"
|
|
1698
|
+
role="table"
|
|
1699
|
+
[class.list--selectable]="!!_selection"
|
|
1700
|
+
[class.list--custom]="columns().length > 0"
|
|
1701
|
+
[style.--sd-fe-custom-cols]="columnWidths()"
|
|
1702
|
+
[attr.aria-label]="label()"
|
|
1703
|
+
[attr.aria-colcount]="(_selection ? 1 : 0) + (_compact ? 2 : 3) + columns().length + (_actionColumn ? 1 : 0)">
|
|
705
1704
|
<div class="list-head" role="rowgroup">
|
|
706
1705
|
<div class="row row--head" role="row">
|
|
1706
|
+
@if (_selection) {
|
|
1707
|
+
<span class="cell cell--select" role="columnheader">
|
|
1708
|
+
<mat-checkbox
|
|
1709
|
+
class="select-all"
|
|
1710
|
+
color="primary"
|
|
1711
|
+
[checked]="_selection.state === 'all'"
|
|
1712
|
+
[indeterminate]="_selection.state === 'some'"
|
|
1713
|
+
[disabled]="!_selection.eligibleCount"
|
|
1714
|
+
[aria-label]="_selection.allLabel"
|
|
1715
|
+
[matTooltip]="_selection.allLabel"
|
|
1716
|
+
[attr.data-autoid]="_selection.autoId ?? null"
|
|
1717
|
+
(change)="toggleSelectAll.emit()" />
|
|
1718
|
+
</span>
|
|
1719
|
+
}
|
|
707
1720
|
<span class="cell cell--name" role="columnheader">{{ 'core.component.file-explorer.column.name' | sdTranslate }}</span>
|
|
708
1721
|
@if (!_compact) {
|
|
709
1722
|
<span class="cell cell--modified" role="columnheader">{{
|
|
@@ -711,37 +1724,105 @@ class SdFileExplorerItemList {
|
|
|
711
1724
|
}}</span>
|
|
712
1725
|
}
|
|
713
1726
|
<span class="cell cell--size" role="columnheader">{{ 'core.component.file-explorer.column.size' | sdTranslate }}</span>
|
|
714
|
-
@
|
|
715
|
-
<span class="cell cell--
|
|
1727
|
+
@for (column of columns(); track column.id(); let index = $index) {
|
|
1728
|
+
<span class="cell cell--custom" role="columnheader" [style.grid-column]="5 + index">{{ column.title() }}</span>
|
|
1729
|
+
}
|
|
1730
|
+
@if (_actionColumn) {
|
|
1731
|
+
<span class="cell cell--action" role="columnheader" [style.grid-column]="5 + columns().length"></span>
|
|
716
1732
|
}
|
|
717
1733
|
</div>
|
|
718
1734
|
</div>
|
|
719
1735
|
<div role="rowgroup">
|
|
720
|
-
@for (
|
|
1736
|
+
@for (row of _rows; track row.view.item.id; let rowIndex = $index) {
|
|
1737
|
+
@let view = row.view;
|
|
721
1738
|
<div
|
|
722
1739
|
class="row"
|
|
723
1740
|
role="row"
|
|
724
1741
|
tabindex="0"
|
|
725
1742
|
[class.row--active]="view.item.id === _activeId"
|
|
1743
|
+
[class.row--selected]="row.selected"
|
|
1744
|
+
[class.row--commands]="!!row.commands"
|
|
1745
|
+
[class.row--movable]="canMove() && view.item.kind === 'file'"
|
|
726
1746
|
[attr.data-item-id]="view.item.id"
|
|
1747
|
+
[attr.data-move-target]="view.item.kind === 'folder' ? view.item.id : null"
|
|
1748
|
+
[class.move-drop-target]="view.item.kind === 'folder' && moveDropTarget() === view.item.id"
|
|
727
1749
|
[attr.data-autoid]="view.autoId"
|
|
728
|
-
(click)="
|
|
1750
|
+
(click)="onClick($event, view)"
|
|
729
1751
|
(keydown)="onKeydown($event, view)">
|
|
1752
|
+
@if (_selection) {
|
|
1753
|
+
<span class="cell cell--select" role="cell">
|
|
1754
|
+
@if (row.selectable) {
|
|
1755
|
+
<mat-checkbox
|
|
1756
|
+
class="select"
|
|
1757
|
+
color="primary"
|
|
1758
|
+
[checked]="row.selected"
|
|
1759
|
+
[disabled]="row.selectDisabled"
|
|
1760
|
+
[aria-label]="view.selectLabel"
|
|
1761
|
+
[attr.data-autoid]="view.autoId ? view.autoId + '-select' : null"
|
|
1762
|
+
(change)="toggleSelect.emit(view.item)" />
|
|
1763
|
+
}
|
|
1764
|
+
</span>
|
|
1765
|
+
}
|
|
730
1766
|
<span class="cell cell--name" role="cell">
|
|
731
1767
|
<sd-file-explorer-file-icon [icon]="view.icon" [size]="32" />
|
|
732
|
-
<span class="name" [title]="view.item.name">{{ view.item.name }}</span>
|
|
1768
|
+
<span class="name" [draggable]="canMove() && view.item.kind === 'file'" [title]="view.item.name">{{ view.item.name }}</span>
|
|
1769
|
+
@if (view.item.kind === 'folder' && moveDropTarget() === view.item.id) {
|
|
1770
|
+
<span class="move-drop-label">{{ 'core.component.file-explorer.move.confirm' | sdTranslate }}</span>
|
|
1771
|
+
}
|
|
1772
|
+
@if (canMove() && view.item.kind === 'file') {
|
|
1773
|
+
<sd-button
|
|
1774
|
+
htmlType="button"
|
|
1775
|
+
class="move-file-button commands"
|
|
1776
|
+
type="text"
|
|
1777
|
+
color="secondary"
|
|
1778
|
+
[size]="_compact ? 'sm' : 'md'"
|
|
1779
|
+
[disabled]="movePending()"
|
|
1780
|
+
[title]="'core.component.file-explorer.move.to' | sdTranslate"
|
|
1781
|
+
[tooltip]="('core.component.file-explorer.move.to' | sdTranslate) + ': ' + view.item.name"
|
|
1782
|
+
(click)="$event.stopPropagation(); move.emit(view.item)"
|
|
1783
|
+
(keydown)="$event.stopPropagation()" />
|
|
1784
|
+
}
|
|
1785
|
+
@if (row.commands) {
|
|
1786
|
+
<sd-file-explorer-actions
|
|
1787
|
+
class="commands"
|
|
1788
|
+
[actions]="row.commands"
|
|
1789
|
+
[context]="view.item"
|
|
1790
|
+
[size]="_commandSize"
|
|
1791
|
+
[source]="row.source"
|
|
1792
|
+
[autoId]="view.autoId ? view.autoId + '-command' : undefined" />
|
|
1793
|
+
}
|
|
733
1794
|
</span>
|
|
734
1795
|
@if (!_compact) {
|
|
735
1796
|
<span class="cell cell--modified" role="cell" [title]="view.modifiedTitle">{{ view.modifiedLabel || '—' }}</span>
|
|
736
1797
|
}
|
|
737
1798
|
<span class="cell cell--size" role="cell">{{ view.sizeLabel || '—' }}</span>
|
|
738
|
-
@
|
|
1799
|
+
@for (column of columns(); track column.id(); let index = $index) {
|
|
1800
|
+
<span class="cell cell--custom" role="cell" [style.grid-column]="5 + index">
|
|
1801
|
+
<ng-container
|
|
1802
|
+
[ngTemplateOutlet]="column.template"
|
|
1803
|
+
[ngTemplateOutletContext]="{ $implicit: view.item, item: view.item, data: view.item.data, index: rowIndex }" />
|
|
1804
|
+
</span>
|
|
1805
|
+
}
|
|
1806
|
+
@if (_actionColumn) {
|
|
739
1807
|
<!-- why: sd-button already keeps its click from reaching the row; Enter/Space are stopped here so the key does not open the file too. -->
|
|
740
|
-
<span class="cell cell--action" role="cell">
|
|
741
|
-
@if (
|
|
1808
|
+
<span class="cell cell--action" role="cell" [style.grid-column]="5 + columns().length">
|
|
1809
|
+
@if (_compact) {
|
|
1810
|
+
@if (row.menu; as menu) {
|
|
1811
|
+
<sd-file-explorer-menu-trigger
|
|
1812
|
+
class="row-menu"
|
|
1813
|
+
[label]="view.actionsLabel"
|
|
1814
|
+
[busy]="menu.busy"
|
|
1815
|
+
[expanded]="view.item.id === _menuOpenId"
|
|
1816
|
+
[touch]="_touch"
|
|
1817
|
+
[autoId]="view.autoId ? view.autoId + '-commands' : undefined"
|
|
1818
|
+
(activate)="openCommands.emit({ item: view.item, trigger: $event })" />
|
|
1819
|
+
}
|
|
1820
|
+
} @else if (view.item.kind === 'file') {
|
|
742
1821
|
@if (_canShare) {
|
|
743
1822
|
<sd-button
|
|
744
1823
|
class="row-action row-share"
|
|
1824
|
+
[disabled]="view.shareDisabled ?? false"
|
|
1825
|
+
[attr.aria-description]="view.shareDisabled ? view.unavailableReason : null"
|
|
745
1826
|
type="text"
|
|
746
1827
|
color="secondary"
|
|
747
1828
|
size="sm"
|
|
@@ -755,6 +1836,8 @@ class SdFileExplorerItemList {
|
|
|
755
1836
|
@if (_canDownload) {
|
|
756
1837
|
<sd-button
|
|
757
1838
|
class="row-action row-download"
|
|
1839
|
+
[disabled]="view.downloadDisabled ?? false"
|
|
1840
|
+
[attr.aria-description]="view.downloadDisabled ? view.unavailableReason : null"
|
|
758
1841
|
type="text"
|
|
759
1842
|
color="secondary"
|
|
760
1843
|
size="sm"
|
|
@@ -773,17 +1856,69 @@ class SdFileExplorerItemList {
|
|
|
773
1856
|
</div>
|
|
774
1857
|
</div>
|
|
775
1858
|
} @else {
|
|
1859
|
+
@let _cardTop = !!_selection || hasCommands();
|
|
1860
|
+
@if (_selection) {
|
|
1861
|
+
<div class="grid-head">
|
|
1862
|
+
<mat-checkbox
|
|
1863
|
+
class="select-all"
|
|
1864
|
+
color="primary"
|
|
1865
|
+
[checked]="_selection.state === 'all'"
|
|
1866
|
+
[indeterminate]="_selection.state === 'some'"
|
|
1867
|
+
[disabled]="!_selection.eligibleCount"
|
|
1868
|
+
[aria-label]="_selection.allLabel"
|
|
1869
|
+
[matTooltip]="_selection.allLabel"
|
|
1870
|
+
[attr.data-autoid]="_selection.autoId ?? null"
|
|
1871
|
+
(change)="toggleSelectAll.emit()" />
|
|
1872
|
+
</div>
|
|
1873
|
+
}
|
|
776
1874
|
<ul class="grid" [attr.aria-label]="label()">
|
|
777
|
-
@for (
|
|
1875
|
+
@for (row of _rows; track row.view.item.id) {
|
|
1876
|
+
@let view = row.view;
|
|
778
1877
|
<li
|
|
779
1878
|
class="card"
|
|
780
1879
|
tabindex="0"
|
|
781
1880
|
[class.card--active]="view.item.id === _activeId"
|
|
1881
|
+
[class.card--selected]="row.selected"
|
|
782
1882
|
[attr.data-item-id]="view.item.id"
|
|
1883
|
+
[attr.data-move-target]="view.item.kind === 'folder' ? view.item.id : null"
|
|
1884
|
+
[class.move-drop-target]="view.item.kind === 'folder' && moveDropTarget() === view.item.id"
|
|
783
1885
|
[attr.data-autoid]="view.autoId"
|
|
784
1886
|
[attr.aria-label]="view.item.name + ', ' + view.typeLabel"
|
|
785
|
-
(click)="
|
|
1887
|
+
(click)="onClick($event, view)"
|
|
786
1888
|
(keydown)="onKeydown($event, view)">
|
|
1889
|
+
@if (_cardTop) {
|
|
1890
|
+
<span class="card-top">
|
|
1891
|
+
@if (row.selectable) {
|
|
1892
|
+
<mat-checkbox
|
|
1893
|
+
class="select"
|
|
1894
|
+
color="primary"
|
|
1895
|
+
[checked]="row.selected"
|
|
1896
|
+
[disabled]="row.selectDisabled"
|
|
1897
|
+
[aria-label]="view.selectLabel"
|
|
1898
|
+
[attr.data-autoid]="view.autoId ? view.autoId + '-select' : null"
|
|
1899
|
+
(change)="toggleSelect.emit(view.item)" />
|
|
1900
|
+
}
|
|
1901
|
+
@if (row.commands) {
|
|
1902
|
+
<sd-file-explorer-actions
|
|
1903
|
+
class="commands"
|
|
1904
|
+
[actions]="row.commands"
|
|
1905
|
+
[context]="view.item"
|
|
1906
|
+
[size]="_commandSize"
|
|
1907
|
+
[source]="row.source"
|
|
1908
|
+
[autoId]="view.autoId ? view.autoId + '-command' : undefined" />
|
|
1909
|
+
}
|
|
1910
|
+
@if (row.menu; as menu) {
|
|
1911
|
+
<sd-file-explorer-menu-trigger
|
|
1912
|
+
class="card-menu"
|
|
1913
|
+
[label]="view.actionsLabel"
|
|
1914
|
+
[busy]="menu.busy"
|
|
1915
|
+
[expanded]="view.item.id === _menuOpenId"
|
|
1916
|
+
[touch]="_touch"
|
|
1917
|
+
[autoId]="view.autoId ? view.autoId + '-commands' : undefined"
|
|
1918
|
+
(activate)="openCommands.emit({ item: view.item, trigger: $event })" />
|
|
1919
|
+
}
|
|
1920
|
+
</span>
|
|
1921
|
+
}
|
|
787
1922
|
<span class="thumb">
|
|
788
1923
|
@if (view.item.thumbnailUrl) {
|
|
789
1924
|
<img [src]="view.item.thumbnailUrl" alt="" loading="lazy" />
|
|
@@ -791,30 +1926,79 @@ class SdFileExplorerItemList {
|
|
|
791
1926
|
<sd-file-explorer-file-icon [icon]="view.icon" [size]="48" />
|
|
792
1927
|
}
|
|
793
1928
|
</span>
|
|
794
|
-
<span class="card-name" [
|
|
1929
|
+
<span class="card-name" [draggable]="canMove() && view.item.kind === 'file'" [title]="view.item.name">{{
|
|
1930
|
+
view.item.name
|
|
1931
|
+
}}</span>
|
|
1932
|
+
@if (canMove() && view.item.kind === 'file') {
|
|
1933
|
+
<sd-button
|
|
1934
|
+
htmlType="button"
|
|
1935
|
+
class="move-file-button commands"
|
|
1936
|
+
type="text"
|
|
1937
|
+
color="secondary"
|
|
1938
|
+
[size]="_compact ? 'sm' : 'md'"
|
|
1939
|
+
[disabled]="movePending()"
|
|
1940
|
+
[title]="'core.component.file-explorer.move.to' | sdTranslate"
|
|
1941
|
+
(click)="$event.stopPropagation(); move.emit(view.item)"
|
|
1942
|
+
(keydown)="$event.stopPropagation()" />
|
|
1943
|
+
}
|
|
795
1944
|
</li>
|
|
796
1945
|
}
|
|
797
1946
|
</ul>
|
|
798
1947
|
}
|
|
799
|
-
`, isInline: true, styles: [":host{display:block}.list{width:100%}.row{display:grid;grid-template-columns:minmax(0,1fr) 128px 88px var(--sd-fe-actions-width,
|
|
1948
|
+
`, isInline: true, styles: [":host{display:block}.list{width:100%}.row{display:grid;grid-template-columns:var(--sd-fe-select-col, 0px) minmax(0,1fr) var(--sd-fe-modified-col, 128px) var(--sd-fe-size-col, 88px) var(--sd-fe-custom-cols, ) var(--sd-fe-actions-width, 0px);align-items:center;min-height:62px;border-bottom:1px solid var(--sd-fe-border);color:var(--sd-fe-text);font-size:var(--sd-font-size-15, 15px);cursor:pointer;outline:none;transition:background-color var(--sd-duration-fast, .12s) ease}.row:hover{background:var(--sd-fe-hover)}.row:focus-visible{box-shadow:inset 0 0 0 2px var(--sd-fe-accent)}.list--selectable{--sd-fe-select-col: 44px}.list--custom{min-width:max-content}.list--custom .cell--name{min-width:180px}.cell--select{grid-column:1}.cell--name{grid-column:2}.cell--modified{grid-column:3}.cell--size{grid-column:4}.cell--action{grid-column:5}.row--head{min-height:34px;color:var(--sd-fe-text-secondary);font-size:var(--sd-font-size-13, 13px);cursor:default}.row--head:hover{background:transparent}.row--active,.row--selected,.row--active:hover,.row--selected:hover{background:var(--sd-fe-accent-soft)}.cell{min-width:0;padding:0 8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cell--name{display:flex;align-items:center;gap:16px}.row:not(.row--head) .cell--modified,.row:not(.row--head) .cell--size{color:var(--sd-fe-text-secondary);font-size:var(--sd-font-size-13, 13px)}.cell--action{display:flex;align-items:center;justify-content:flex-end;gap:2px;padding:0 4px 0 0;overflow:visible}.name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.row--movable .cell--name{flex-wrap:wrap;row-gap:16px;padding-block:8px;overflow:visible}.row--movable .name{flex:1 1 4.5rem}.cell--select{display:flex;align-items:center;justify-content:center;padding:0;overflow:visible}.row--commands .cell--name{flex-wrap:wrap;row-gap:4px;padding-block:8px;overflow:visible}.row--commands .name{flex:1 1 4.5rem}.commands,.card-menu{margin-inline-start:auto}.commands{opacity:0}.row:hover .commands,.row:focus-within .commands,.card:hover .commands,.card:focus-within .commands,.commands.sd-file-explorer-actions--open,.commands.sd-file-explorer-actions--busy,:host(.sd-file-explorer-item-list--touch) .commands{opacity:1}:host(.sd-file-explorer-item-list--compact){--sd-fe-modified-col: 0px;--sd-fe-size-col: 66px}:host(.sd-file-explorer-item-list--compact) .row{min-height:55px;font-size:var(--sd-font-size-14, 14px)}:host(.sd-file-explorer-item-list--compact) .row--head{min-height:30px;font-size:var(--sd-font-size-12, 12px)}:host(.sd-file-explorer-item-list--compact) .cell--name{gap:12px}:host(.sd-file-explorer-item-list--compact) .cell{padding:0 4px}:host(.sd-file-explorer-item-list--compact) .cell--action{padding:0}.grid{list-style:none;margin:0;padding:4px 0 0;display:grid;grid-template-columns:repeat(auto-fill,minmax(248px,1fr));gap:18px 20px}.card{display:flex;flex-direction:column;gap:12px;min-width:0;padding:12px 12px 14px;border:1px solid var(--sd-fe-border);border-radius:var(--sd-radius-12, 12px);background:var(--sd-fe-surface);color:var(--sd-fe-text);cursor:pointer;outline:none;transition:border-color var(--sd-duration-fast, .12s) ease,box-shadow var(--sd-duration-fast, .12s) ease}.card:hover{border-color:var(--sd-fe-border-strong);box-shadow:0 2px 8px #0f172a0f}.card:focus-visible{box-shadow:0 0 0 2px var(--sd-fe-accent)}.card--active{border-color:var(--sd-fe-accent)}.card--selected{border-color:var(--sd-fe-accent);background:var(--sd-fe-accent-soft)}.card-top{display:flex;flex-wrap:wrap;align-items:center;gap:4px;min-height:40px;margin-block:-4px}.grid-head{display:flex;align-items:center;margin-bottom:12px;padding:0 0 4px 13px;border-bottom:1px solid var(--sd-fe-border)}.thumb{display:flex;align-items:center;justify-content:center;height:104px;overflow:hidden;border-radius:var(--sd-radius-8, 8px);background:var(--sd-fe-muted-surface)}.thumb img{width:100%;height:100%;object-fit:cover}.card-name{padding:0 2px;overflow:hidden;font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-semibold, 600);text-overflow:ellipsis;white-space:nowrap}:host(.sd-file-explorer-item-list--compact) .grid{grid-template-columns:repeat(auto-fill,minmax(148px,1fr));gap:12px}@media(prefers-reduced-motion:reduce){.row,.card{transition:none}}.move-file-button{flex-shrink:0}.move-drop-target{outline:2px solid var(--sd-fe-accent);outline-offset:-2px}.move-drop-label{color:var(--sd-fe-text);font-weight:600}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: MatCheckbox, selector: "mat-checkbox", inputs: ["aria-label", "aria-labelledby", "aria-describedby", "aria-expanded", "aria-controls", "aria-owns", "id", "required", "labelPosition", "name", "value", "disableRipple", "tabIndex", "color", "disabledInteractive", "checked", "disabled", "indeterminate"], outputs: ["change", "indeterminateChange"], exportAs: ["matCheckbox"] }, { kind: "directive", type: MatTooltip, selector: "[matTooltip]", inputs: ["matTooltipPosition", "matTooltipPositionAtOrigin", "matTooltipDisabled", "matTooltipShowDelay", "matTooltipHideDelay", "matTooltipTouchGestures", "matTooltip", "matTooltipClass"], exportAs: ["matTooltip"] }, { kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "openOnHover", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }, { 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 });
|
|
800
1949
|
}
|
|
801
1950
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdFileExplorerItemList, decorators: [{
|
|
802
1951
|
type: Component,
|
|
803
|
-
args: [{ selector: 'sd-file-explorer-item-list', standalone: true, imports: [
|
|
1952
|
+
args: [{ selector: 'sd-file-explorer-item-list', standalone: true, imports: [
|
|
1953
|
+
NgTemplateOutlet,
|
|
1954
|
+
MatCheckbox,
|
|
1955
|
+
MatTooltip,
|
|
1956
|
+
SdButton,
|
|
1957
|
+
SdTranslatePipe,
|
|
1958
|
+
SdFileExplorerActions,
|
|
1959
|
+
SdFileExplorerFileIcon,
|
|
1960
|
+
SdFileExplorerMenuTrigger,
|
|
1961
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
804
1962
|
class: 'sd-file-explorer-item-list',
|
|
805
1963
|
'[class.sd-file-explorer-item-list--compact]': 'compact()',
|
|
1964
|
+
'[class.sd-file-explorer-item-list--touch]': 'touch()',
|
|
806
1965
|
'[style.--sd-fe-actions-width]': 'actionsWidth()',
|
|
807
1966
|
}, template: `
|
|
808
|
-
@let
|
|
1967
|
+
@let _rows = rows();
|
|
809
1968
|
@let _canDownload = canDownload();
|
|
810
1969
|
@let _canShare = canShare();
|
|
811
|
-
@let _hasActions = _canDownload || _canShare;
|
|
812
1970
|
@let _compact = compact();
|
|
1971
|
+
@let _touch = touch();
|
|
1972
|
+
@let _actionColumn = _compact ? menuColumn() : _canDownload || _canShare;
|
|
813
1973
|
@let _activeId = activeId();
|
|
1974
|
+
@let _menuOpenId = menuOpenId();
|
|
1975
|
+
@let _selection = selection();
|
|
1976
|
+
@let _commandSize = _touch && !_compact ? 'lg' : 'sm';
|
|
814
1977
|
@if (view() === 'list') {
|
|
815
|
-
<div
|
|
1978
|
+
<div
|
|
1979
|
+
class="list"
|
|
1980
|
+
role="table"
|
|
1981
|
+
[class.list--selectable]="!!_selection"
|
|
1982
|
+
[class.list--custom]="columns().length > 0"
|
|
1983
|
+
[style.--sd-fe-custom-cols]="columnWidths()"
|
|
1984
|
+
[attr.aria-label]="label()"
|
|
1985
|
+
[attr.aria-colcount]="(_selection ? 1 : 0) + (_compact ? 2 : 3) + columns().length + (_actionColumn ? 1 : 0)">
|
|
816
1986
|
<div class="list-head" role="rowgroup">
|
|
817
1987
|
<div class="row row--head" role="row">
|
|
1988
|
+
@if (_selection) {
|
|
1989
|
+
<span class="cell cell--select" role="columnheader">
|
|
1990
|
+
<mat-checkbox
|
|
1991
|
+
class="select-all"
|
|
1992
|
+
color="primary"
|
|
1993
|
+
[checked]="_selection.state === 'all'"
|
|
1994
|
+
[indeterminate]="_selection.state === 'some'"
|
|
1995
|
+
[disabled]="!_selection.eligibleCount"
|
|
1996
|
+
[aria-label]="_selection.allLabel"
|
|
1997
|
+
[matTooltip]="_selection.allLabel"
|
|
1998
|
+
[attr.data-autoid]="_selection.autoId ?? null"
|
|
1999
|
+
(change)="toggleSelectAll.emit()" />
|
|
2000
|
+
</span>
|
|
2001
|
+
}
|
|
818
2002
|
<span class="cell cell--name" role="columnheader">{{ 'core.component.file-explorer.column.name' | sdTranslate }}</span>
|
|
819
2003
|
@if (!_compact) {
|
|
820
2004
|
<span class="cell cell--modified" role="columnheader">{{
|
|
@@ -822,37 +2006,105 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
822
2006
|
}}</span>
|
|
823
2007
|
}
|
|
824
2008
|
<span class="cell cell--size" role="columnheader">{{ 'core.component.file-explorer.column.size' | sdTranslate }}</span>
|
|
825
|
-
@
|
|
826
|
-
<span class="cell cell--
|
|
2009
|
+
@for (column of columns(); track column.id(); let index = $index) {
|
|
2010
|
+
<span class="cell cell--custom" role="columnheader" [style.grid-column]="5 + index">{{ column.title() }}</span>
|
|
2011
|
+
}
|
|
2012
|
+
@if (_actionColumn) {
|
|
2013
|
+
<span class="cell cell--action" role="columnheader" [style.grid-column]="5 + columns().length"></span>
|
|
827
2014
|
}
|
|
828
2015
|
</div>
|
|
829
2016
|
</div>
|
|
830
2017
|
<div role="rowgroup">
|
|
831
|
-
@for (
|
|
2018
|
+
@for (row of _rows; track row.view.item.id; let rowIndex = $index) {
|
|
2019
|
+
@let view = row.view;
|
|
832
2020
|
<div
|
|
833
2021
|
class="row"
|
|
834
2022
|
role="row"
|
|
835
2023
|
tabindex="0"
|
|
836
2024
|
[class.row--active]="view.item.id === _activeId"
|
|
2025
|
+
[class.row--selected]="row.selected"
|
|
2026
|
+
[class.row--commands]="!!row.commands"
|
|
2027
|
+
[class.row--movable]="canMove() && view.item.kind === 'file'"
|
|
837
2028
|
[attr.data-item-id]="view.item.id"
|
|
2029
|
+
[attr.data-move-target]="view.item.kind === 'folder' ? view.item.id : null"
|
|
2030
|
+
[class.move-drop-target]="view.item.kind === 'folder' && moveDropTarget() === view.item.id"
|
|
838
2031
|
[attr.data-autoid]="view.autoId"
|
|
839
|
-
(click)="
|
|
2032
|
+
(click)="onClick($event, view)"
|
|
840
2033
|
(keydown)="onKeydown($event, view)">
|
|
2034
|
+
@if (_selection) {
|
|
2035
|
+
<span class="cell cell--select" role="cell">
|
|
2036
|
+
@if (row.selectable) {
|
|
2037
|
+
<mat-checkbox
|
|
2038
|
+
class="select"
|
|
2039
|
+
color="primary"
|
|
2040
|
+
[checked]="row.selected"
|
|
2041
|
+
[disabled]="row.selectDisabled"
|
|
2042
|
+
[aria-label]="view.selectLabel"
|
|
2043
|
+
[attr.data-autoid]="view.autoId ? view.autoId + '-select' : null"
|
|
2044
|
+
(change)="toggleSelect.emit(view.item)" />
|
|
2045
|
+
}
|
|
2046
|
+
</span>
|
|
2047
|
+
}
|
|
841
2048
|
<span class="cell cell--name" role="cell">
|
|
842
2049
|
<sd-file-explorer-file-icon [icon]="view.icon" [size]="32" />
|
|
843
|
-
<span class="name" [title]="view.item.name">{{ view.item.name }}</span>
|
|
2050
|
+
<span class="name" [draggable]="canMove() && view.item.kind === 'file'" [title]="view.item.name">{{ view.item.name }}</span>
|
|
2051
|
+
@if (view.item.kind === 'folder' && moveDropTarget() === view.item.id) {
|
|
2052
|
+
<span class="move-drop-label">{{ 'core.component.file-explorer.move.confirm' | sdTranslate }}</span>
|
|
2053
|
+
}
|
|
2054
|
+
@if (canMove() && view.item.kind === 'file') {
|
|
2055
|
+
<sd-button
|
|
2056
|
+
htmlType="button"
|
|
2057
|
+
class="move-file-button commands"
|
|
2058
|
+
type="text"
|
|
2059
|
+
color="secondary"
|
|
2060
|
+
[size]="_compact ? 'sm' : 'md'"
|
|
2061
|
+
[disabled]="movePending()"
|
|
2062
|
+
[title]="'core.component.file-explorer.move.to' | sdTranslate"
|
|
2063
|
+
[tooltip]="('core.component.file-explorer.move.to' | sdTranslate) + ': ' + view.item.name"
|
|
2064
|
+
(click)="$event.stopPropagation(); move.emit(view.item)"
|
|
2065
|
+
(keydown)="$event.stopPropagation()" />
|
|
2066
|
+
}
|
|
2067
|
+
@if (row.commands) {
|
|
2068
|
+
<sd-file-explorer-actions
|
|
2069
|
+
class="commands"
|
|
2070
|
+
[actions]="row.commands"
|
|
2071
|
+
[context]="view.item"
|
|
2072
|
+
[size]="_commandSize"
|
|
2073
|
+
[source]="row.source"
|
|
2074
|
+
[autoId]="view.autoId ? view.autoId + '-command' : undefined" />
|
|
2075
|
+
}
|
|
844
2076
|
</span>
|
|
845
2077
|
@if (!_compact) {
|
|
846
2078
|
<span class="cell cell--modified" role="cell" [title]="view.modifiedTitle">{{ view.modifiedLabel || '—' }}</span>
|
|
847
2079
|
}
|
|
848
2080
|
<span class="cell cell--size" role="cell">{{ view.sizeLabel || '—' }}</span>
|
|
849
|
-
@
|
|
2081
|
+
@for (column of columns(); track column.id(); let index = $index) {
|
|
2082
|
+
<span class="cell cell--custom" role="cell" [style.grid-column]="5 + index">
|
|
2083
|
+
<ng-container
|
|
2084
|
+
[ngTemplateOutlet]="column.template"
|
|
2085
|
+
[ngTemplateOutletContext]="{ $implicit: view.item, item: view.item, data: view.item.data, index: rowIndex }" />
|
|
2086
|
+
</span>
|
|
2087
|
+
}
|
|
2088
|
+
@if (_actionColumn) {
|
|
850
2089
|
<!-- why: sd-button already keeps its click from reaching the row; Enter/Space are stopped here so the key does not open the file too. -->
|
|
851
|
-
<span class="cell cell--action" role="cell">
|
|
852
|
-
@if (
|
|
2090
|
+
<span class="cell cell--action" role="cell" [style.grid-column]="5 + columns().length">
|
|
2091
|
+
@if (_compact) {
|
|
2092
|
+
@if (row.menu; as menu) {
|
|
2093
|
+
<sd-file-explorer-menu-trigger
|
|
2094
|
+
class="row-menu"
|
|
2095
|
+
[label]="view.actionsLabel"
|
|
2096
|
+
[busy]="menu.busy"
|
|
2097
|
+
[expanded]="view.item.id === _menuOpenId"
|
|
2098
|
+
[touch]="_touch"
|
|
2099
|
+
[autoId]="view.autoId ? view.autoId + '-commands' : undefined"
|
|
2100
|
+
(activate)="openCommands.emit({ item: view.item, trigger: $event })" />
|
|
2101
|
+
}
|
|
2102
|
+
} @else if (view.item.kind === 'file') {
|
|
853
2103
|
@if (_canShare) {
|
|
854
2104
|
<sd-button
|
|
855
2105
|
class="row-action row-share"
|
|
2106
|
+
[disabled]="view.shareDisabled ?? false"
|
|
2107
|
+
[attr.aria-description]="view.shareDisabled ? view.unavailableReason : null"
|
|
856
2108
|
type="text"
|
|
857
2109
|
color="secondary"
|
|
858
2110
|
size="sm"
|
|
@@ -866,6 +2118,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
866
2118
|
@if (_canDownload) {
|
|
867
2119
|
<sd-button
|
|
868
2120
|
class="row-action row-download"
|
|
2121
|
+
[disabled]="view.downloadDisabled ?? false"
|
|
2122
|
+
[attr.aria-description]="view.downloadDisabled ? view.unavailableReason : null"
|
|
869
2123
|
type="text"
|
|
870
2124
|
color="secondary"
|
|
871
2125
|
size="sm"
|
|
@@ -884,17 +2138,69 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
884
2138
|
</div>
|
|
885
2139
|
</div>
|
|
886
2140
|
} @else {
|
|
2141
|
+
@let _cardTop = !!_selection || hasCommands();
|
|
2142
|
+
@if (_selection) {
|
|
2143
|
+
<div class="grid-head">
|
|
2144
|
+
<mat-checkbox
|
|
2145
|
+
class="select-all"
|
|
2146
|
+
color="primary"
|
|
2147
|
+
[checked]="_selection.state === 'all'"
|
|
2148
|
+
[indeterminate]="_selection.state === 'some'"
|
|
2149
|
+
[disabled]="!_selection.eligibleCount"
|
|
2150
|
+
[aria-label]="_selection.allLabel"
|
|
2151
|
+
[matTooltip]="_selection.allLabel"
|
|
2152
|
+
[attr.data-autoid]="_selection.autoId ?? null"
|
|
2153
|
+
(change)="toggleSelectAll.emit()" />
|
|
2154
|
+
</div>
|
|
2155
|
+
}
|
|
887
2156
|
<ul class="grid" [attr.aria-label]="label()">
|
|
888
|
-
@for (
|
|
2157
|
+
@for (row of _rows; track row.view.item.id) {
|
|
2158
|
+
@let view = row.view;
|
|
889
2159
|
<li
|
|
890
2160
|
class="card"
|
|
891
2161
|
tabindex="0"
|
|
892
2162
|
[class.card--active]="view.item.id === _activeId"
|
|
2163
|
+
[class.card--selected]="row.selected"
|
|
893
2164
|
[attr.data-item-id]="view.item.id"
|
|
2165
|
+
[attr.data-move-target]="view.item.kind === 'folder' ? view.item.id : null"
|
|
2166
|
+
[class.move-drop-target]="view.item.kind === 'folder' && moveDropTarget() === view.item.id"
|
|
894
2167
|
[attr.data-autoid]="view.autoId"
|
|
895
2168
|
[attr.aria-label]="view.item.name + ', ' + view.typeLabel"
|
|
896
|
-
(click)="
|
|
2169
|
+
(click)="onClick($event, view)"
|
|
897
2170
|
(keydown)="onKeydown($event, view)">
|
|
2171
|
+
@if (_cardTop) {
|
|
2172
|
+
<span class="card-top">
|
|
2173
|
+
@if (row.selectable) {
|
|
2174
|
+
<mat-checkbox
|
|
2175
|
+
class="select"
|
|
2176
|
+
color="primary"
|
|
2177
|
+
[checked]="row.selected"
|
|
2178
|
+
[disabled]="row.selectDisabled"
|
|
2179
|
+
[aria-label]="view.selectLabel"
|
|
2180
|
+
[attr.data-autoid]="view.autoId ? view.autoId + '-select' : null"
|
|
2181
|
+
(change)="toggleSelect.emit(view.item)" />
|
|
2182
|
+
}
|
|
2183
|
+
@if (row.commands) {
|
|
2184
|
+
<sd-file-explorer-actions
|
|
2185
|
+
class="commands"
|
|
2186
|
+
[actions]="row.commands"
|
|
2187
|
+
[context]="view.item"
|
|
2188
|
+
[size]="_commandSize"
|
|
2189
|
+
[source]="row.source"
|
|
2190
|
+
[autoId]="view.autoId ? view.autoId + '-command' : undefined" />
|
|
2191
|
+
}
|
|
2192
|
+
@if (row.menu; as menu) {
|
|
2193
|
+
<sd-file-explorer-menu-trigger
|
|
2194
|
+
class="card-menu"
|
|
2195
|
+
[label]="view.actionsLabel"
|
|
2196
|
+
[busy]="menu.busy"
|
|
2197
|
+
[expanded]="view.item.id === _menuOpenId"
|
|
2198
|
+
[touch]="_touch"
|
|
2199
|
+
[autoId]="view.autoId ? view.autoId + '-commands' : undefined"
|
|
2200
|
+
(activate)="openCommands.emit({ item: view.item, trigger: $event })" />
|
|
2201
|
+
}
|
|
2202
|
+
</span>
|
|
2203
|
+
}
|
|
898
2204
|
<span class="thumb">
|
|
899
2205
|
@if (view.item.thumbnailUrl) {
|
|
900
2206
|
<img [src]="view.item.thumbnailUrl" alt="" loading="lazy" />
|
|
@@ -902,12 +2208,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
902
2208
|
<sd-file-explorer-file-icon [icon]="view.icon" [size]="48" />
|
|
903
2209
|
}
|
|
904
2210
|
</span>
|
|
905
|
-
<span class="card-name" [
|
|
2211
|
+
<span class="card-name" [draggable]="canMove() && view.item.kind === 'file'" [title]="view.item.name">{{
|
|
2212
|
+
view.item.name
|
|
2213
|
+
}}</span>
|
|
2214
|
+
@if (canMove() && view.item.kind === 'file') {
|
|
2215
|
+
<sd-button
|
|
2216
|
+
htmlType="button"
|
|
2217
|
+
class="move-file-button commands"
|
|
2218
|
+
type="text"
|
|
2219
|
+
color="secondary"
|
|
2220
|
+
[size]="_compact ? 'sm' : 'md'"
|
|
2221
|
+
[disabled]="movePending()"
|
|
2222
|
+
[title]="'core.component.file-explorer.move.to' | sdTranslate"
|
|
2223
|
+
(click)="$event.stopPropagation(); move.emit(view.item)"
|
|
2224
|
+
(keydown)="$event.stopPropagation()" />
|
|
2225
|
+
}
|
|
906
2226
|
</li>
|
|
907
2227
|
}
|
|
908
2228
|
</ul>
|
|
909
2229
|
}
|
|
910
|
-
`, styles: [":host{display:block}.list{width:100%}.row{display:grid;grid-template-columns:minmax(0,1fr) 128px 88px var(--sd-fe-actions-width,
|
|
2230
|
+
`, styles: [":host{display:block}.list{width:100%}.row{display:grid;grid-template-columns:var(--sd-fe-select-col, 0px) minmax(0,1fr) var(--sd-fe-modified-col, 128px) var(--sd-fe-size-col, 88px) var(--sd-fe-custom-cols, ) var(--sd-fe-actions-width, 0px);align-items:center;min-height:62px;border-bottom:1px solid var(--sd-fe-border);color:var(--sd-fe-text);font-size:var(--sd-font-size-15, 15px);cursor:pointer;outline:none;transition:background-color var(--sd-duration-fast, .12s) ease}.row:hover{background:var(--sd-fe-hover)}.row:focus-visible{box-shadow:inset 0 0 0 2px var(--sd-fe-accent)}.list--selectable{--sd-fe-select-col: 44px}.list--custom{min-width:max-content}.list--custom .cell--name{min-width:180px}.cell--select{grid-column:1}.cell--name{grid-column:2}.cell--modified{grid-column:3}.cell--size{grid-column:4}.cell--action{grid-column:5}.row--head{min-height:34px;color:var(--sd-fe-text-secondary);font-size:var(--sd-font-size-13, 13px);cursor:default}.row--head:hover{background:transparent}.row--active,.row--selected,.row--active:hover,.row--selected:hover{background:var(--sd-fe-accent-soft)}.cell{min-width:0;padding:0 8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cell--name{display:flex;align-items:center;gap:16px}.row:not(.row--head) .cell--modified,.row:not(.row--head) .cell--size{color:var(--sd-fe-text-secondary);font-size:var(--sd-font-size-13, 13px)}.cell--action{display:flex;align-items:center;justify-content:flex-end;gap:2px;padding:0 4px 0 0;overflow:visible}.name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.row--movable .cell--name{flex-wrap:wrap;row-gap:16px;padding-block:8px;overflow:visible}.row--movable .name{flex:1 1 4.5rem}.cell--select{display:flex;align-items:center;justify-content:center;padding:0;overflow:visible}.row--commands .cell--name{flex-wrap:wrap;row-gap:4px;padding-block:8px;overflow:visible}.row--commands .name{flex:1 1 4.5rem}.commands,.card-menu{margin-inline-start:auto}.commands{opacity:0}.row:hover .commands,.row:focus-within .commands,.card:hover .commands,.card:focus-within .commands,.commands.sd-file-explorer-actions--open,.commands.sd-file-explorer-actions--busy,:host(.sd-file-explorer-item-list--touch) .commands{opacity:1}:host(.sd-file-explorer-item-list--compact){--sd-fe-modified-col: 0px;--sd-fe-size-col: 66px}:host(.sd-file-explorer-item-list--compact) .row{min-height:55px;font-size:var(--sd-font-size-14, 14px)}:host(.sd-file-explorer-item-list--compact) .row--head{min-height:30px;font-size:var(--sd-font-size-12, 12px)}:host(.sd-file-explorer-item-list--compact) .cell--name{gap:12px}:host(.sd-file-explorer-item-list--compact) .cell{padding:0 4px}:host(.sd-file-explorer-item-list--compact) .cell--action{padding:0}.grid{list-style:none;margin:0;padding:4px 0 0;display:grid;grid-template-columns:repeat(auto-fill,minmax(248px,1fr));gap:18px 20px}.card{display:flex;flex-direction:column;gap:12px;min-width:0;padding:12px 12px 14px;border:1px solid var(--sd-fe-border);border-radius:var(--sd-radius-12, 12px);background:var(--sd-fe-surface);color:var(--sd-fe-text);cursor:pointer;outline:none;transition:border-color var(--sd-duration-fast, .12s) ease,box-shadow var(--sd-duration-fast, .12s) ease}.card:hover{border-color:var(--sd-fe-border-strong);box-shadow:0 2px 8px #0f172a0f}.card:focus-visible{box-shadow:0 0 0 2px var(--sd-fe-accent)}.card--active{border-color:var(--sd-fe-accent)}.card--selected{border-color:var(--sd-fe-accent);background:var(--sd-fe-accent-soft)}.card-top{display:flex;flex-wrap:wrap;align-items:center;gap:4px;min-height:40px;margin-block:-4px}.grid-head{display:flex;align-items:center;margin-bottom:12px;padding:0 0 4px 13px;border-bottom:1px solid var(--sd-fe-border)}.thumb{display:flex;align-items:center;justify-content:center;height:104px;overflow:hidden;border-radius:var(--sd-radius-8, 8px);background:var(--sd-fe-muted-surface)}.thumb img{width:100%;height:100%;object-fit:cover}.card-name{padding:0 2px;overflow:hidden;font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-semibold, 600);text-overflow:ellipsis;white-space:nowrap}:host(.sd-file-explorer-item-list--compact) .grid{grid-template-columns:repeat(auto-fill,minmax(148px,1fr));gap:12px}@media(prefers-reduced-motion:reduce){.row,.card{transition:none}}.move-file-button{flex-shrink:0}.move-drop-target{outline:2px solid var(--sd-fe-accent);outline-offset:-2px}.move-drop-label{color:var(--sd-fe-text);font-weight:600}\n"] }]
|
|
911
2231
|
}] });
|
|
912
2232
|
|
|
913
2233
|
/**
|
|
@@ -918,8 +2238,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
918
2238
|
* The explorer owns the open file: a non-null `view` opens the drawer, `null` closes it. When the user closes
|
|
919
2239
|
* the drawer (close button, `Escape`, backdrop) the panel emits `close`.
|
|
920
2240
|
*
|
|
921
|
-
* PDFs render with `<sd-preview-pdf
|
|
922
|
-
*
|
|
2241
|
+
* PDFs render with `<sd-preview-pdf>` and videos with `<sd-preview-video>`. Both come from
|
|
2242
|
+
* `@sdcorejs/angular/components/preview`, imported on demand: that chunk (PDF.js included) is only fetched the
|
|
2243
|
+
* first time a PDF or a video is previewed.
|
|
923
2244
|
*/
|
|
924
2245
|
class SdFileExplorerPreviewPanel {
|
|
925
2246
|
/** File shown in the drawer; `null` closes the drawer. */
|
|
@@ -932,6 +2253,8 @@ class SdFileExplorerPreviewPanel {
|
|
|
932
2253
|
canDownload = input(false);
|
|
933
2254
|
/** Show the share button. */
|
|
934
2255
|
canShare = input(false);
|
|
2256
|
+
/** Matches the explorer's narrow layout; footer buttons retain Core's 48 px touch span. */
|
|
2257
|
+
compact = input(false);
|
|
935
2258
|
/** Element the drawer opens inside: the explorer's item area, right of the folder tree. */
|
|
936
2259
|
container = input(null);
|
|
937
2260
|
/** E2E scope of the detail content and its buttons. */
|
|
@@ -951,8 +2274,9 @@ class SdFileExplorerPreviewPanel {
|
|
|
951
2274
|
// why: sd-side-drawer tự thêm tiền tố `components-side-drawer-`; bỏ `components-` của autoId explorer cho khỏi lặp.
|
|
952
2275
|
drawerAutoId = computed(() => this.autoId()?.replace(/^components-/, ''));
|
|
953
2276
|
pdfComponent = signal(null);
|
|
954
|
-
|
|
955
|
-
|
|
2277
|
+
videoComponent = signal(null);
|
|
2278
|
+
viewerFailed = signal(false);
|
|
2279
|
+
#viewersRequested = false;
|
|
956
2280
|
pdfInputs = computed(() => {
|
|
957
2281
|
const state = this.state();
|
|
958
2282
|
if (state.status !== 'pdf')
|
|
@@ -969,6 +2293,18 @@ class SdFileExplorerPreviewPanel {
|
|
|
969
2293
|
initialZoom: 'page-width',
|
|
970
2294
|
};
|
|
971
2295
|
});
|
|
2296
|
+
videoInputs = computed(() => {
|
|
2297
|
+
const state = this.state();
|
|
2298
|
+
if (state.status !== 'video')
|
|
2299
|
+
return {};
|
|
2300
|
+
return {
|
|
2301
|
+
source: state.source,
|
|
2302
|
+
fileName: this.view()?.item.name ?? '',
|
|
2303
|
+
// why: the drawer footer already downloads through option.download, so the player hides its own button.
|
|
2304
|
+
downloadable: false,
|
|
2305
|
+
autoId: this.drawerAutoId(),
|
|
2306
|
+
};
|
|
2307
|
+
});
|
|
972
2308
|
constructor() {
|
|
973
2309
|
effect(() => {
|
|
974
2310
|
const drawer = this.drawer();
|
|
@@ -983,9 +2319,10 @@ class SdFileExplorerPreviewPanel {
|
|
|
983
2319
|
});
|
|
984
2320
|
});
|
|
985
2321
|
effect(() => {
|
|
986
|
-
|
|
2322
|
+
const status = this.state().status;
|
|
2323
|
+
if (status !== 'pdf' && status !== 'video')
|
|
987
2324
|
return;
|
|
988
|
-
untracked(() => this.#
|
|
2325
|
+
untracked(() => this.#loadViewers());
|
|
989
2326
|
});
|
|
990
2327
|
}
|
|
991
2328
|
onDrawerClosed() {
|
|
@@ -993,22 +2330,23 @@ class SdFileExplorerPreviewPanel {
|
|
|
993
2330
|
if (this.view())
|
|
994
2331
|
this.close.emit();
|
|
995
2332
|
}
|
|
996
|
-
async #
|
|
997
|
-
if (this.#
|
|
2333
|
+
async #loadViewers() {
|
|
2334
|
+
if (this.#viewersRequested)
|
|
998
2335
|
return;
|
|
999
|
-
this.#
|
|
2336
|
+
this.#viewersRequested = true;
|
|
1000
2337
|
try {
|
|
1001
|
-
// why: import động để PDF.js (+ worker inline ~1.4 MB) tách chunk riêng — consumer không xem PDF thì không tải.
|
|
2338
|
+
// why: import động để PDF.js (+ worker inline ~1.4 MB) tách chunk riêng — consumer không xem PDF/video thì không tải.
|
|
1002
2339
|
const module = await import('@sdcorejs/angular/components/preview');
|
|
1003
2340
|
this.pdfComponent.set(module.SdPreviewPdf);
|
|
2341
|
+
this.videoComponent.set(module.SdPreviewVideo);
|
|
1004
2342
|
}
|
|
1005
2343
|
catch {
|
|
1006
|
-
this.#
|
|
1007
|
-
this.
|
|
2344
|
+
this.#viewersRequested = false;
|
|
2345
|
+
this.viewerFailed.set(true);
|
|
1008
2346
|
}
|
|
1009
2347
|
}
|
|
1010
2348
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdFileExplorerPreviewPanel, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1011
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", type: SdFileExplorerPreviewPanel, isStandalone: true, selector: "sd-file-explorer-preview-panel", inputs: { view: { classPropertyName: "view", publicName: "view", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: true, transformFunction: null }, meta: { classPropertyName: "meta", publicName: "meta", isSignal: true, isRequired: false, transformFunction: null }, canDownload: { classPropertyName: "canDownload", publicName: "canDownload", isSignal: true, isRequired: false, transformFunction: null }, canShare: { classPropertyName: "canShare", publicName: "canShare", isSignal: true, isRequired: false, transformFunction: null }, container: { classPropertyName: "container", publicName: "container", isSignal: true, isRequired: false, transformFunction: null }, autoId: { classPropertyName: "autoId", publicName: "autoId", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { close: "close", download: "download", share: "share", retry: "retry", imageError: "imageError" }, host: { classAttribute: "sd-file-explorer-preview-panel" }, viewQueries: [{ propertyName: "drawer", first: true, predicate: SdSideDrawer, descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
2349
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", 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: `
|
|
1012
2350
|
@let _view = view();
|
|
1013
2351
|
@let _state = state();
|
|
1014
2352
|
@let _autoId = autoId();
|
|
@@ -1017,7 +2355,11 @@ class SdFileExplorerPreviewPanel {
|
|
|
1017
2355
|
<sd-side-drawer width="420px" [container]="container()" [title]="drawerTitle()" [autoId]="drawerAutoId()" (sdClosed)="onDrawerClosed()">
|
|
1018
2356
|
@if (_view) {
|
|
1019
2357
|
<div class="detail" [attr.data-autoid]="_autoId ?? null">
|
|
1020
|
-
<div
|
|
2358
|
+
<div
|
|
2359
|
+
class="stage"
|
|
2360
|
+
[class.stage--pdf]="_state.status === 'pdf'"
|
|
2361
|
+
[class.stage--video]="_state.status === 'video'"
|
|
2362
|
+
[attr.aria-busy]="_state.status === 'loading' ? true : null">
|
|
1021
2363
|
@switch (_state.status) {
|
|
1022
2364
|
@case ('image') {
|
|
1023
2365
|
<img class="image" [src]="_state.url" [alt]="_view.item.name" (error)="imageError.emit()" />
|
|
@@ -1026,16 +2368,16 @@ class SdFileExplorerPreviewPanel {
|
|
|
1026
2368
|
@let _pdf = pdfComponent();
|
|
1027
2369
|
@if (_pdf) {
|
|
1028
2370
|
<ng-container *ngComponentOutlet="_pdf; inputs: pdfInputs()" />
|
|
1029
|
-
} @else if (pdfFailed()) {
|
|
1030
|
-
<div class="placeholder placeholder--error">
|
|
1031
|
-
<sd-icon name="error_outline" size="32px" />
|
|
1032
|
-
<p class="placeholder-title">{{ 'core.component.file-explorer.preview.error' | sdTranslate }}</p>
|
|
1033
|
-
</div>
|
|
1034
2371
|
} @else {
|
|
1035
|
-
<
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
2372
|
+
<ng-container [ngTemplateOutlet]="viewerPending" />
|
|
2373
|
+
}
|
|
2374
|
+
}
|
|
2375
|
+
@case ('video') {
|
|
2376
|
+
@let _video = videoComponent();
|
|
2377
|
+
@if (_video) {
|
|
2378
|
+
<ng-container *ngComponentOutlet="_video; inputs: videoInputs()" />
|
|
2379
|
+
} @else {
|
|
2380
|
+
<ng-container [ngTemplateOutlet]="viewerPending" />
|
|
1039
2381
|
}
|
|
1040
2382
|
}
|
|
1041
2383
|
@case ('loading') {
|
|
@@ -1089,6 +2431,9 @@ class SdFileExplorerPreviewPanel {
|
|
|
1089
2431
|
<sd-button
|
|
1090
2432
|
sdFooterRight
|
|
1091
2433
|
class="share-button"
|
|
2434
|
+
[size]="compact() ? 'sm' : 'md'"
|
|
2435
|
+
[disabled]="_view?.shareDisabled ?? false"
|
|
2436
|
+
[attr.aria-description]="_view?.shareDisabled ? _view?.unavailableReason : null"
|
|
1092
2437
|
[type]="_canDownload ? 'outline' : 'fill'"
|
|
1093
2438
|
[color]="_canDownload ? 'secondary' : 'primary'"
|
|
1094
2439
|
prefixIcon="share"
|
|
@@ -1100,6 +2445,9 @@ class SdFileExplorerPreviewPanel {
|
|
|
1100
2445
|
<sd-button
|
|
1101
2446
|
sdFooterRight
|
|
1102
2447
|
class="download-button"
|
|
2448
|
+
[size]="compact() ? 'sm' : 'md'"
|
|
2449
|
+
[disabled]="_view?.downloadDisabled ?? false"
|
|
2450
|
+
[attr.aria-description]="_view?.downloadDisabled ? _view?.unavailableReason : null"
|
|
1103
2451
|
type="fill"
|
|
1104
2452
|
color="primary"
|
|
1105
2453
|
prefixIcon="file_download"
|
|
@@ -1108,11 +2456,26 @@ class SdFileExplorerPreviewPanel {
|
|
|
1108
2456
|
(click)="download.emit()" />
|
|
1109
2457
|
}
|
|
1110
2458
|
</sd-side-drawer>
|
|
1111
|
-
|
|
2459
|
+
|
|
2460
|
+
<!-- Stage of a PDF or video while its viewer chunk loads, or when that import failed. -->
|
|
2461
|
+
<ng-template #viewerPending>
|
|
2462
|
+
@if (viewerFailed()) {
|
|
2463
|
+
<div class="placeholder placeholder--error">
|
|
2464
|
+
<sd-icon name="error_outline" size="32px" />
|
|
2465
|
+
<p class="placeholder-title">{{ 'core.component.file-explorer.preview.error' | sdTranslate }}</p>
|
|
2466
|
+
</div>
|
|
2467
|
+
} @else {
|
|
2468
|
+
<div class="placeholder">
|
|
2469
|
+
<span class="spinner" aria-hidden="true"></span>
|
|
2470
|
+
<p class="placeholder-hint">{{ 'core.component.file-explorer.preview.loading' | sdTranslate }}</p>
|
|
2471
|
+
</div>
|
|
2472
|
+
}
|
|
2473
|
+
</ng-template>
|
|
2474
|
+
`, isInline: true, styles: [":host{display:none}.detail{display:flex;flex-direction:column;height:100%}.stage{display:flex;flex:0 1 216px;align-items:center;justify-content:center;min-height:140px;padding:14px;overflow:hidden;border-radius:var(--sd-radius-12, 12px);background:var(--sd-fe-preview-bg)}.stage--pdf{flex-basis:380px;min-height:240px;padding:0;background:var(--sd-fe-muted-surface)}.stage--pdf>*{width:100%;height:100%;min-height:0}.stage--video{flex:none;min-height:216px;padding:0;background:var(--sd-fe-muted-surface)}.stage--video>*{width:100%}.image{display:block;max-width:100%;max-height:100%;border-radius:var(--sd-radius-6, 6px);object-fit:contain}.placeholder{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:16px;text-align:center;color:var(--sd-fe-text-secondary)}.placeholder--error{color:var(--sd-fe-error)}.placeholder--error sd-button{margin-top:4px}.placeholder-title{margin:4px 0 0;color:var(--sd-fe-text);font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-semibold, 600)}.placeholder-hint{margin:0;font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-18, 18px);color:var(--sd-fe-text-secondary)}.spinner{width:28px;height:28px;border:3px solid color-mix(in srgb,var(--sd-fe-accent) 20%,transparent);border-top-color:var(--sd-fe-accent);border-radius:50%;animation:sd-file-explorer-preview-spin .8s linear infinite}.meta{flex:none;margin:20px 0 0;padding:4px 0 0;border-top:1px solid var(--sd-fe-border)}.meta-row{display:grid;grid-template-columns:84px minmax(0,1fr);align-items:baseline;gap:12px;padding:10px 0;font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-18, 18px)}.meta-row dt{color:var(--sd-fe-text-secondary)}.meta-row dd{margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}@keyframes sd-file-explorer-preview-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.spinner{animation-duration:2.4s}}\n"], dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"], exportAs: ["ngComponentOutlet"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "openOnHover", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "component", type: SdSideDrawer, selector: "sd-side-drawer", inputs: ["title", "width", "hideClose", "disableBackdropClose", "beforeClose", "container", "drawerClass", "autoId"], outputs: ["sdClosed", "sdCloseError"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }, { kind: "component", type: SdFileExplorerFileIcon, selector: "sd-file-explorer-file-icon", inputs: ["icon", "size"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1112
2475
|
}
|
|
1113
2476
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdFileExplorerPreviewPanel, decorators: [{
|
|
1114
2477
|
type: Component,
|
|
1115
|
-
args: [{ selector: 'sd-file-explorer-preview-panel', standalone: true, imports: [NgComponentOutlet, SdButton, SdIcon, SdSideDrawer, SdTranslatePipe, SdFileExplorerFileIcon], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
2478
|
+
args: [{ selector: 'sd-file-explorer-preview-panel', standalone: true, imports: [NgComponentOutlet, NgTemplateOutlet, SdButton, SdIcon, SdSideDrawer, SdTranslatePipe, SdFileExplorerFileIcon], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1116
2479
|
class: 'sd-file-explorer-preview-panel',
|
|
1117
2480
|
}, template: `
|
|
1118
2481
|
@let _view = view();
|
|
@@ -1123,7 +2486,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
1123
2486
|
<sd-side-drawer width="420px" [container]="container()" [title]="drawerTitle()" [autoId]="drawerAutoId()" (sdClosed)="onDrawerClosed()">
|
|
1124
2487
|
@if (_view) {
|
|
1125
2488
|
<div class="detail" [attr.data-autoid]="_autoId ?? null">
|
|
1126
|
-
<div
|
|
2489
|
+
<div
|
|
2490
|
+
class="stage"
|
|
2491
|
+
[class.stage--pdf]="_state.status === 'pdf'"
|
|
2492
|
+
[class.stage--video]="_state.status === 'video'"
|
|
2493
|
+
[attr.aria-busy]="_state.status === 'loading' ? true : null">
|
|
1127
2494
|
@switch (_state.status) {
|
|
1128
2495
|
@case ('image') {
|
|
1129
2496
|
<img class="image" [src]="_state.url" [alt]="_view.item.name" (error)="imageError.emit()" />
|
|
@@ -1132,16 +2499,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
1132
2499
|
@let _pdf = pdfComponent();
|
|
1133
2500
|
@if (_pdf) {
|
|
1134
2501
|
<ng-container *ngComponentOutlet="_pdf; inputs: pdfInputs()" />
|
|
1135
|
-
} @else if (pdfFailed()) {
|
|
1136
|
-
<div class="placeholder placeholder--error">
|
|
1137
|
-
<sd-icon name="error_outline" size="32px" />
|
|
1138
|
-
<p class="placeholder-title">{{ 'core.component.file-explorer.preview.error' | sdTranslate }}</p>
|
|
1139
|
-
</div>
|
|
1140
2502
|
} @else {
|
|
1141
|
-
<
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
2503
|
+
<ng-container [ngTemplateOutlet]="viewerPending" />
|
|
2504
|
+
}
|
|
2505
|
+
}
|
|
2506
|
+
@case ('video') {
|
|
2507
|
+
@let _video = videoComponent();
|
|
2508
|
+
@if (_video) {
|
|
2509
|
+
<ng-container *ngComponentOutlet="_video; inputs: videoInputs()" />
|
|
2510
|
+
} @else {
|
|
2511
|
+
<ng-container [ngTemplateOutlet]="viewerPending" />
|
|
1145
2512
|
}
|
|
1146
2513
|
}
|
|
1147
2514
|
@case ('loading') {
|
|
@@ -1195,6 +2562,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
1195
2562
|
<sd-button
|
|
1196
2563
|
sdFooterRight
|
|
1197
2564
|
class="share-button"
|
|
2565
|
+
[size]="compact() ? 'sm' : 'md'"
|
|
2566
|
+
[disabled]="_view?.shareDisabled ?? false"
|
|
2567
|
+
[attr.aria-description]="_view?.shareDisabled ? _view?.unavailableReason : null"
|
|
1198
2568
|
[type]="_canDownload ? 'outline' : 'fill'"
|
|
1199
2569
|
[color]="_canDownload ? 'secondary' : 'primary'"
|
|
1200
2570
|
prefixIcon="share"
|
|
@@ -1206,6 +2576,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
1206
2576
|
<sd-button
|
|
1207
2577
|
sdFooterRight
|
|
1208
2578
|
class="download-button"
|
|
2579
|
+
[size]="compact() ? 'sm' : 'md'"
|
|
2580
|
+
[disabled]="_view?.downloadDisabled ?? false"
|
|
2581
|
+
[attr.aria-description]="_view?.downloadDisabled ? _view?.unavailableReason : null"
|
|
1209
2582
|
type="fill"
|
|
1210
2583
|
color="primary"
|
|
1211
2584
|
prefixIcon="file_download"
|
|
@@ -1214,7 +2587,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
1214
2587
|
(click)="download.emit()" />
|
|
1215
2588
|
}
|
|
1216
2589
|
</sd-side-drawer>
|
|
1217
|
-
|
|
2590
|
+
|
|
2591
|
+
<!-- Stage of a PDF or video while its viewer chunk loads, or when that import failed. -->
|
|
2592
|
+
<ng-template #viewerPending>
|
|
2593
|
+
@if (viewerFailed()) {
|
|
2594
|
+
<div class="placeholder placeholder--error">
|
|
2595
|
+
<sd-icon name="error_outline" size="32px" />
|
|
2596
|
+
<p class="placeholder-title">{{ 'core.component.file-explorer.preview.error' | sdTranslate }}</p>
|
|
2597
|
+
</div>
|
|
2598
|
+
} @else {
|
|
2599
|
+
<div class="placeholder">
|
|
2600
|
+
<span class="spinner" aria-hidden="true"></span>
|
|
2601
|
+
<p class="placeholder-hint">{{ 'core.component.file-explorer.preview.loading' | sdTranslate }}</p>
|
|
2602
|
+
</div>
|
|
2603
|
+
}
|
|
2604
|
+
</ng-template>
|
|
2605
|
+
`, styles: [":host{display:none}.detail{display:flex;flex-direction:column;height:100%}.stage{display:flex;flex:0 1 216px;align-items:center;justify-content:center;min-height:140px;padding:14px;overflow:hidden;border-radius:var(--sd-radius-12, 12px);background:var(--sd-fe-preview-bg)}.stage--pdf{flex-basis:380px;min-height:240px;padding:0;background:var(--sd-fe-muted-surface)}.stage--pdf>*{width:100%;height:100%;min-height:0}.stage--video{flex:none;min-height:216px;padding:0;background:var(--sd-fe-muted-surface)}.stage--video>*{width:100%}.image{display:block;max-width:100%;max-height:100%;border-radius:var(--sd-radius-6, 6px);object-fit:contain}.placeholder{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:16px;text-align:center;color:var(--sd-fe-text-secondary)}.placeholder--error{color:var(--sd-fe-error)}.placeholder--error sd-button{margin-top:4px}.placeholder-title{margin:4px 0 0;color:var(--sd-fe-text);font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-semibold, 600)}.placeholder-hint{margin:0;font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-18, 18px);color:var(--sd-fe-text-secondary)}.spinner{width:28px;height:28px;border:3px solid color-mix(in srgb,var(--sd-fe-accent) 20%,transparent);border-top-color:var(--sd-fe-accent);border-radius:50%;animation:sd-file-explorer-preview-spin .8s linear infinite}.meta{flex:none;margin:20px 0 0;padding:4px 0 0;border-top:1px solid var(--sd-fe-border)}.meta-row{display:grid;grid-template-columns:84px minmax(0,1fr);align-items:baseline;gap:12px;padding:10px 0;font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-18, 18px)}.meta-row dt{color:var(--sd-fe-text-secondary)}.meta-row dd{margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}@keyframes sd-file-explorer-preview-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.spinner{animation-duration:2.4s}}\n"] }]
|
|
1218
2606
|
}], ctorParameters: () => [] });
|
|
1219
2607
|
|
|
1220
2608
|
let nextTransferPanelId = 0;
|
|
@@ -1349,7 +2737,7 @@ class SdFileExplorerTransferPanel {
|
|
|
1349
2737
|
}
|
|
1350
2738
|
</ul>
|
|
1351
2739
|
</section>
|
|
1352
|
-
`, isInline: true, styles: [":host{display:block}.panel{padding:12px 20px 18px}:host(.sd-file-explorer-transfer-panel--compact) .panel{padding:10px 14px 14px}.head{display:flex;align-items:center;gap:10px;min-height:32px}.head-icon{flex:none;width:22px;height:22px;color:var(--sd-fe-accent)}.title{flex:1;min-width:0;margin:0;overflow:hidden;font-size:16px;font-weight:600;line-height:22px;color:var(--sd-fe-text);text-overflow:ellipsis;white-space:nowrap}.cards{list-style:none;margin:12px 0 0;padding:0;display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,320px),1fr));gap:12px 20px;max-height:188px;overflow-y:auto}.cards[hidden]{display:none}.card{display:flex;flex-direction:column;gap:11px;min-width:0;padding:12px 14px;border:1px solid var(--sd-fe-border);border-radius:10px;background:var(--sd-fe-surface)}.card-row{display:flex;align-items:center;gap:10px;min-height:22px}.direction{flex:none;color:var(--sd-fe-accent)}.name{flex:1;min-width:0;overflow:hidden;font-size:14px;font-weight:600;color:var(--sd-fe-text);text-overflow:ellipsis;white-space:nowrap}.status{flex:none;font-size:13px;color:var(--sd-fe-text-secondary);font-variant-numeric:tabular-nums}.bar{position:relative;height:6px;overflow:hidden;border-radius:999px;background:var(--sd-fe-track)}.bar-fill{position:absolute;inset:0 auto 0 0;border-radius:inherit;background:var(--sd-fe-accent);transition:width .2s ease}.bar--indeterminate .bar-fill{width:36%!important;animation:sd-file-explorer-indeterminate 1.3s ease-in-out infinite}.card--success .bar-fill{background:var(--sd-fe-success)}.card--error{border-color:color-mix(in srgb,var(--sd-fe-error) 35%,var(--sd-fe-border))}.card--error .bar-fill{background:var(--sd-fe-error)}.card--error .status{color:var(--sd-fe-error);font-weight:600}.card--muted .bar-fill{background:var(--sd-fe-border-strong)}.error{margin:-4px 0 0;overflow:hidden;font-size:12px;color:var(--sd-fe-error);text-overflow:ellipsis;white-space:nowrap}.icon-button{flex:none;display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border:0;border-radius: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:2px solid var(--sd-
|
|
2740
|
+
`, isInline: true, styles: [":host{display:block}.panel{padding:12px 20px 18px}:host(.sd-file-explorer-transfer-panel--compact) .panel{padding:10px 14px 14px}.head{display:flex;align-items:center;gap:10px;min-height:32px}.head-icon{flex:none;width:22px;height:22px;color:var(--sd-fe-accent)}.title{flex:1;min-width:0;margin:0;overflow:hidden;font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-semibold, 600);line-height:var(--sd-line-height-22, 22px);color:var(--sd-fe-text);text-overflow:ellipsis;white-space:nowrap}.cards{list-style:none;margin:12px 0 0;padding:0;display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,320px),1fr));gap:12px 20px;max-height:188px;overflow-y:auto}.cards[hidden]{display:none}.card{display:flex;flex-direction:column;gap:11px;min-width:0;padding:12px 14px;border:1px solid var(--sd-fe-border);border-radius:var(--sd-radius-10, 10px);background:var(--sd-fe-surface)}.card-row{display:flex;align-items:center;gap:10px;min-height:22px}.direction{flex:none;color:var(--sd-fe-accent)}.name{flex:1;min-width:0;overflow:hidden;font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-semibold, 600);color:var(--sd-fe-text);text-overflow:ellipsis;white-space:nowrap}.status{flex:none;font-size:var(--sd-font-size-13, 13px);color:var(--sd-fe-text-secondary);font-variant-numeric:tabular-nums}.bar{position:relative;height:6px;overflow:hidden;border-radius:var(--sd-radius-999, 999px);background:var(--sd-fe-track)}.bar-fill{position:absolute;inset:0 auto 0 0;border-radius:inherit;background:var(--sd-fe-accent);transition:width var(--sd-duration-base, .2s) ease}.bar--indeterminate .bar-fill{width:36%!important;animation:sd-file-explorer-indeterminate 1.3s ease-in-out infinite}.card--success .bar-fill{background:var(--sd-fe-success)}.card--error{border-color:color-mix(in srgb,var(--sd-fe-error) 35%,var(--sd-fe-border))}.card--error .bar-fill{background:var(--sd-fe-error)}.card--error .status{color:var(--sd-fe-error);font-weight:var(--sd-font-weight-semibold, 600)}.card--muted .bar-fill{background:var(--sd-fe-border-strong)}.error{margin:-4px 0 0;overflow:hidden;font-size:var(--sd-font-size-12, 12px);color:var(--sd-fe-error);text-overflow:ellipsis;white-space:nowrap}.icon-button{flex:none;display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border:0;border-radius:var(--sd-radius-999, 999px);background:transparent;color:var(--sd-fe-text-secondary);cursor:pointer}.icon-button:hover{background:var(--sd-fe-hover-strong);color:var(--sd-fe-text)}.icon-button:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-file-explorer-accent, var(--sd-focus-ring-color, var(--sd-primary)));outline-offset:1px}.card-action{flex:none;margin:-5px -6px -5px -2px}.clear-button{flex:none}@keyframes sd-file-explorer-indeterminate{0%{left:-36%}to{left:100%}}@media(prefers-reduced-motion:reduce){.bar--indeterminate .bar-fill{animation-duration:3s}.bar-fill{transition:none}}\n"], dependencies: [{ kind: "component", type: SdButton, selector: "sd-button", inputs: ["autoId", "type", "color", "size", "fontSet", "title", "width", "tooltip", "prefixIcon", "suffixIcon", "disabled", "openOnHover", "loading", "block", "htmlType"], outputs: ["click"] }, { kind: "component", type: SdIcon, selector: "sd-icon", inputs: ["name", "fontIcon", "color", "set", "fontSet", "size", "strokeWidth", "absoluteStrokeWidth", "ariaLabel"] }, { kind: "pipe", type: SdTranslatePipe, name: "sdTranslate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1353
2741
|
}
|
|
1354
2742
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdFileExplorerTransferPanel, decorators: [{
|
|
1355
2743
|
type: Component,
|
|
@@ -1459,7 +2847,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
1459
2847
|
}
|
|
1460
2848
|
</ul>
|
|
1461
2849
|
</section>
|
|
1462
|
-
`, styles: [":host{display:block}.panel{padding:12px 20px 18px}:host(.sd-file-explorer-transfer-panel--compact) .panel{padding:10px 14px 14px}.head{display:flex;align-items:center;gap:10px;min-height:32px}.head-icon{flex:none;width:22px;height:22px;color:var(--sd-fe-accent)}.title{flex:1;min-width:0;margin:0;overflow:hidden;font-size:16px;font-weight:600;line-height:22px;color:var(--sd-fe-text);text-overflow:ellipsis;white-space:nowrap}.cards{list-style:none;margin:12px 0 0;padding:0;display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,320px),1fr));gap:12px 20px;max-height:188px;overflow-y:auto}.cards[hidden]{display:none}.card{display:flex;flex-direction:column;gap:11px;min-width:0;padding:12px 14px;border:1px solid var(--sd-fe-border);border-radius:10px;background:var(--sd-fe-surface)}.card-row{display:flex;align-items:center;gap:10px;min-height:22px}.direction{flex:none;color:var(--sd-fe-accent)}.name{flex:1;min-width:0;overflow:hidden;font-size:14px;font-weight:600;color:var(--sd-fe-text);text-overflow:ellipsis;white-space:nowrap}.status{flex:none;font-size:13px;color:var(--sd-fe-text-secondary);font-variant-numeric:tabular-nums}.bar{position:relative;height:6px;overflow:hidden;border-radius:999px;background:var(--sd-fe-track)}.bar-fill{position:absolute;inset:0 auto 0 0;border-radius:inherit;background:var(--sd-fe-accent);transition:width .2s ease}.bar--indeterminate .bar-fill{width:36%!important;animation:sd-file-explorer-indeterminate 1.3s ease-in-out infinite}.card--success .bar-fill{background:var(--sd-fe-success)}.card--error{border-color:color-mix(in srgb,var(--sd-fe-error) 35%,var(--sd-fe-border))}.card--error .bar-fill{background:var(--sd-fe-error)}.card--error .status{color:var(--sd-fe-error);font-weight:600}.card--muted .bar-fill{background:var(--sd-fe-border-strong)}.error{margin:-4px 0 0;overflow:hidden;font-size:12px;color:var(--sd-fe-error);text-overflow:ellipsis;white-space:nowrap}.icon-button{flex:none;display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border:0;border-radius: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:2px solid var(--sd-
|
|
2850
|
+
`, styles: [":host{display:block}.panel{padding:12px 20px 18px}:host(.sd-file-explorer-transfer-panel--compact) .panel{padding:10px 14px 14px}.head{display:flex;align-items:center;gap:10px;min-height:32px}.head-icon{flex:none;width:22px;height:22px;color:var(--sd-fe-accent)}.title{flex:1;min-width:0;margin:0;overflow:hidden;font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-semibold, 600);line-height:var(--sd-line-height-22, 22px);color:var(--sd-fe-text);text-overflow:ellipsis;white-space:nowrap}.cards{list-style:none;margin:12px 0 0;padding:0;display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,320px),1fr));gap:12px 20px;max-height:188px;overflow-y:auto}.cards[hidden]{display:none}.card{display:flex;flex-direction:column;gap:11px;min-width:0;padding:12px 14px;border:1px solid var(--sd-fe-border);border-radius:var(--sd-radius-10, 10px);background:var(--sd-fe-surface)}.card-row{display:flex;align-items:center;gap:10px;min-height:22px}.direction{flex:none;color:var(--sd-fe-accent)}.name{flex:1;min-width:0;overflow:hidden;font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-semibold, 600);color:var(--sd-fe-text);text-overflow:ellipsis;white-space:nowrap}.status{flex:none;font-size:var(--sd-font-size-13, 13px);color:var(--sd-fe-text-secondary);font-variant-numeric:tabular-nums}.bar{position:relative;height:6px;overflow:hidden;border-radius:var(--sd-radius-999, 999px);background:var(--sd-fe-track)}.bar-fill{position:absolute;inset:0 auto 0 0;border-radius:inherit;background:var(--sd-fe-accent);transition:width var(--sd-duration-base, .2s) ease}.bar--indeterminate .bar-fill{width:36%!important;animation:sd-file-explorer-indeterminate 1.3s ease-in-out infinite}.card--success .bar-fill{background:var(--sd-fe-success)}.card--error{border-color:color-mix(in srgb,var(--sd-fe-error) 35%,var(--sd-fe-border))}.card--error .bar-fill{background:var(--sd-fe-error)}.card--error .status{color:var(--sd-fe-error);font-weight:var(--sd-font-weight-semibold, 600)}.card--muted .bar-fill{background:var(--sd-fe-border-strong)}.error{margin:-4px 0 0;overflow:hidden;font-size:var(--sd-font-size-12, 12px);color:var(--sd-fe-error);text-overflow:ellipsis;white-space:nowrap}.icon-button{flex:none;display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;padding:0;border:0;border-radius:var(--sd-radius-999, 999px);background:transparent;color:var(--sd-fe-text-secondary);cursor:pointer}.icon-button:hover{background:var(--sd-fe-hover-strong);color:var(--sd-fe-text)}.icon-button:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-file-explorer-accent, var(--sd-focus-ring-color, var(--sd-primary)));outline-offset:1px}.card-action{flex:none;margin:-5px -6px -5px -2px}.clear-button{flex:none}@keyframes sd-file-explorer-indeterminate{0%{left:-36%}to{left:100%}}@media(prefers-reduced-motion:reduce){.bar--indeterminate .bar-fill{animation-duration:3s}.bar-fill{transition:none}}\n"] }]
|
|
1463
2851
|
}] });
|
|
1464
2852
|
|
|
1465
2853
|
/** Delay between the last keystroke and the `search` callback. */
|
|
@@ -1468,6 +2856,8 @@ const SEARCH_DEBOUNCE_MS = 300;
|
|
|
1468
2856
|
const MAX_PARALLEL_UPLOADS = 3;
|
|
1469
2857
|
/** Below this host width the explorer switches to the compact (mobile) layout. */
|
|
1470
2858
|
const COMPACT_MAX_WIDTH = 720;
|
|
2859
|
+
/** Primary pointer is a finger: commands stay visible and use 48 px targets. */
|
|
2860
|
+
const TOUCH_QUERY = '(pointer: coarse)';
|
|
1471
2861
|
/** How long a saved download's object URL stays alive before it is revoked. */
|
|
1472
2862
|
const DOWNLOAD_URL_TTL_MS = 40_000;
|
|
1473
2863
|
const ACTIVE_STATUSES = new Set(['queued', 'preparing', 'transferring']);
|
|
@@ -1477,7 +2867,7 @@ let nextExplorerId = 0;
|
|
|
1477
2867
|
* Google-Drive-like file browser: folder tree, breadcrumb, list / grid, search, file detail drawer, uploads with
|
|
1478
2868
|
* drag-and-drop, downloads and a transfer queue — all inside one element.
|
|
1479
2869
|
*
|
|
1480
|
-
* Storage-agnostic: every read and write goes through the callbacks of `SdFileExplorerOption
|
|
2870
|
+
* Storage-agnostic: every read and write goes through the callbacks of `SdFileExplorerOption<T>`.
|
|
1481
2871
|
*
|
|
1482
2872
|
* @example
|
|
1483
2873
|
* ```html
|
|
@@ -1485,13 +2875,51 @@ let nextExplorerId = 0;
|
|
|
1485
2875
|
* ```
|
|
1486
2876
|
*/
|
|
1487
2877
|
class SdFileExplorer {
|
|
2878
|
+
#moveDrag = new SdFileExplorerDragSession();
|
|
2879
|
+
#moveController = null;
|
|
2880
|
+
#moveRefreshFolders = [];
|
|
2881
|
+
#moveReturnFocus = null;
|
|
2882
|
+
#moveDragSelectionRequired = false;
|
|
2883
|
+
#movePickerSelectionRequired = false;
|
|
2884
|
+
movePending = signal(false);
|
|
2885
|
+
moveStatus = signal('');
|
|
2886
|
+
moveRefreshError = signal(false);
|
|
2887
|
+
movePickerItems = signal(null);
|
|
2888
|
+
moveTarget = signal(null);
|
|
2889
|
+
moveDropTarget = signal(undefined);
|
|
2890
|
+
canMove = computed(() => typeof this.#config().move?.onMove === 'function');
|
|
2891
|
+
movePickerNodes = computed(() => this.treeNodes().map(node => ({ ...node, selected: node.id === (this.moveTarget()?.id ?? null) })));
|
|
2892
|
+
canSubmitMove = computed(() => {
|
|
2893
|
+
const items = this.movePickerItems();
|
|
2894
|
+
if (!items || this.movePending())
|
|
2895
|
+
return false;
|
|
2896
|
+
return this.#moveAllowed(items, this.moveTarget(), 'menu', new AbortController().signal, this.#movePickerSelectionRequired);
|
|
2897
|
+
});
|
|
2898
|
+
columnDefs = contentChildren(SdFileExplorerColumnDef);
|
|
2899
|
+
#warnedColumns = new WeakSet();
|
|
2900
|
+
columns = computed(() => {
|
|
2901
|
+
const seen = new Set();
|
|
2902
|
+
return this.columnDefs().filter(column => {
|
|
2903
|
+
const id = column.id().trim();
|
|
2904
|
+
if (!id || seen.has(id)) {
|
|
2905
|
+
if (isDevMode() && !this.#warnedColumns.has(column)) {
|
|
2906
|
+
this.#warnedColumns.add(column);
|
|
2907
|
+
console.warn(`[sd-file-explorer] ignored empty or duplicate column id: ${id}`);
|
|
2908
|
+
}
|
|
2909
|
+
return false;
|
|
2910
|
+
}
|
|
2911
|
+
seen.add(id);
|
|
2912
|
+
return true;
|
|
2913
|
+
});
|
|
2914
|
+
});
|
|
1488
2915
|
#i18n = inject(I18nService);
|
|
1489
2916
|
#host = inject(ElementRef);
|
|
1490
2917
|
#document = inject(DOCUMENT);
|
|
1491
2918
|
#injector = inject(Injector);
|
|
1492
2919
|
#zone = inject(NgZone);
|
|
1493
|
-
/** Data callbacks and display settings. See `SdFileExplorerOption
|
|
2920
|
+
/** Data callbacks and display settings. See `SdFileExplorerOption<T>`. */
|
|
1494
2921
|
option = input.required();
|
|
2922
|
+
#config = computed(() => sdFileExplorerNormalizeConfig(this.option()));
|
|
1495
2923
|
/**
|
|
1496
2924
|
* Emitted exactly once each time the user opens a file (click, `Enter` or `Space` on a file in the list,
|
|
1497
2925
|
* grid or search results), right before the detail drawer starts loading. Never emitted for folders.
|
|
@@ -1506,6 +2934,14 @@ class SdFileExplorer {
|
|
|
1506
2934
|
#previewItem = signal(null);
|
|
1507
2935
|
#transfers = signal([]);
|
|
1508
2936
|
#width = signal(0);
|
|
2937
|
+
#touch = signal(false);
|
|
2938
|
+
/**
|
|
2939
|
+
* Ids the user selected. Only those still visible and eligible count — see `selectedItems` — and the others are
|
|
2940
|
+
* forgotten once the view settles, so a file that leaves the view or gets disabled is never selected again by itself.
|
|
2941
|
+
*/
|
|
2942
|
+
#selectedIds = signal(new Set());
|
|
2943
|
+
/** Item whose commands the compact drawer shows; `null` while it is closed. */
|
|
2944
|
+
#commandTarget = signal(null);
|
|
1509
2945
|
view = signal('list');
|
|
1510
2946
|
keyword = signal('');
|
|
1511
2947
|
previewState = signal({ status: 'idle' });
|
|
@@ -1536,6 +2972,7 @@ class SdFileExplorer {
|
|
|
1536
2972
|
shareInput = viewChild('shareInput');
|
|
1537
2973
|
shareDialog = viewChild('shareDialog');
|
|
1538
2974
|
sidebar = viewChild('sidebar');
|
|
2975
|
+
commandDrawer = viewChild(SdFileExplorerCommandSheet);
|
|
1539
2976
|
// ---- Non-reactive bookkeeping ----
|
|
1540
2977
|
#listControllers = new Map();
|
|
1541
2978
|
#jobs = new Map();
|
|
@@ -1549,6 +2986,8 @@ class SdFileExplorer {
|
|
|
1549
2986
|
#previewObjectUrl = null;
|
|
1550
2987
|
#shareController = null;
|
|
1551
2988
|
#shareReturnFocus = null;
|
|
2989
|
+
/** Command pressed in the compact drawer, waiting for the drawer to finish closing; any context change drops it. */
|
|
2990
|
+
#pendingCommand = null;
|
|
1552
2991
|
#dragDepth = 0;
|
|
1553
2992
|
#listFn = null;
|
|
1554
2993
|
#resizeObserver = null;
|
|
@@ -1559,17 +2998,20 @@ class SdFileExplorer {
|
|
|
1559
2998
|
const width = this.#width();
|
|
1560
2999
|
return width > 0 && width < COMPACT_MAX_WIDTH;
|
|
1561
3000
|
});
|
|
3001
|
+
touch = this.#touch.asReadonly();
|
|
1562
3002
|
autoId = computed(() => {
|
|
1563
|
-
const scope = this
|
|
3003
|
+
const scope = this.#config().autoId;
|
|
1564
3004
|
return scope ? `components-file-explorer-${scope}` : undefined;
|
|
1565
3005
|
});
|
|
1566
|
-
locale =
|
|
1567
|
-
rootLabel = computed(() => this
|
|
1568
|
-
canUpload = computed(() => typeof this
|
|
1569
|
-
canDownload = computed(() => typeof this
|
|
1570
|
-
canCreateFolder = computed(() => typeof this
|
|
1571
|
-
canShare = computed(() => typeof this
|
|
1572
|
-
|
|
3006
|
+
locale = this.#i18n.locale;
|
|
3007
|
+
rootLabel = computed(() => this.#config().rootLabel || this.#i18n.t('core.component.file-explorer.root'));
|
|
3008
|
+
canUpload = computed(() => typeof this.#config().upload === 'function');
|
|
3009
|
+
canDownload = computed(() => typeof this.#config().download === 'function');
|
|
3010
|
+
canCreateFolder = computed(() => typeof this.#config().createFolder === 'function');
|
|
3011
|
+
canShare = computed(() => typeof this.#config().share === 'function');
|
|
3012
|
+
uploadDisabled = computed(() => this.movePending() || !sdFileExplorerEligible(this.#config().uploadable, { parentId: this.#currentId() }));
|
|
3013
|
+
createDisabled = computed(() => this.movePending() || !sdFileExplorerEligible(this.#config().creatable, { parentId: this.#currentId() }));
|
|
3014
|
+
#serverSearch = computed(() => typeof this.#config().search === 'function');
|
|
1573
3015
|
currentName = computed(() => {
|
|
1574
3016
|
const path = this.#path();
|
|
1575
3017
|
return path.length ? path[path.length - 1].name : this.rootLabel();
|
|
@@ -1604,6 +3046,188 @@ class SdFileExplorer {
|
|
|
1604
3046
|
const format = this.#itemFormatter();
|
|
1605
3047
|
return sdFileExplorerFoldersFirst(this.#visibleItems()).map(format);
|
|
1606
3048
|
});
|
|
3049
|
+
// ---- Selection ----
|
|
3050
|
+
/** The row download / share shortcuts stay until the consumer declares `fileCommands` (even `[]`). */
|
|
3051
|
+
rowShortcuts = computed(() => this.#config().fileCommands == null);
|
|
3052
|
+
#configuredSelector = computed(() => {
|
|
3053
|
+
const selector = this.#config().selector;
|
|
3054
|
+
return selector && selector.visible !== false ? selector : null;
|
|
3055
|
+
});
|
|
3056
|
+
#pickerSelection = computed(() => {
|
|
3057
|
+
const selector = this.#configuredSelector();
|
|
3058
|
+
return (!!selector &&
|
|
3059
|
+
(selector.mode === 'picker' ||
|
|
3060
|
+
(selector.mode === undefined && (typeof selector.onSelect === 'function' || typeof selector.onSelectAll === 'function'))));
|
|
3061
|
+
});
|
|
3062
|
+
/** Selection actions remain caller-owned when declared, including an intentional empty array. */
|
|
3063
|
+
selectionActions = computed(() => {
|
|
3064
|
+
const selector = this.#configuredSelector();
|
|
3065
|
+
if (!selector)
|
|
3066
|
+
return [];
|
|
3067
|
+
if (selector.actions !== undefined)
|
|
3068
|
+
return selector.actions ?? [];
|
|
3069
|
+
if (this.#pickerSelection())
|
|
3070
|
+
return [];
|
|
3071
|
+
const config = this.#config();
|
|
3072
|
+
const actions = [];
|
|
3073
|
+
if (typeof config.move?.onMove === 'function')
|
|
3074
|
+
actions.push({
|
|
3075
|
+
title: this.#i18n.t('core.component.file-explorer.move.to'),
|
|
3076
|
+
prefixIcon: 'drive_file_move',
|
|
3077
|
+
type: 'outline',
|
|
3078
|
+
disabled: () => this.movePending() || this.moveRefreshError(),
|
|
3079
|
+
onClick: items => this.openMovePicker(items),
|
|
3080
|
+
});
|
|
3081
|
+
if (typeof config.share === 'function')
|
|
3082
|
+
actions.push({
|
|
3083
|
+
title: this.#i18n.t('core.component.file-explorer.share'),
|
|
3084
|
+
prefixIcon: 'share',
|
|
3085
|
+
disabled: items => items.length !== 1 || !sdFileExplorerEligible(config.shareable, items[0]),
|
|
3086
|
+
onClick: items => {
|
|
3087
|
+
if (items.length === 1)
|
|
3088
|
+
this.openShare(items[0]);
|
|
3089
|
+
},
|
|
3090
|
+
});
|
|
3091
|
+
if (typeof config.download === 'function')
|
|
3092
|
+
actions.push({
|
|
3093
|
+
title: this.#i18n.t('core.component.file-explorer.download'),
|
|
3094
|
+
prefixIcon: 'file_download',
|
|
3095
|
+
disabled: items => !items.length || items.some(item => !sdFileExplorerEligible(config.downloadable, item)),
|
|
3096
|
+
onClick: items => {
|
|
3097
|
+
for (const item of items)
|
|
3098
|
+
this.downloadItem(item);
|
|
3099
|
+
},
|
|
3100
|
+
});
|
|
3101
|
+
return actions;
|
|
3102
|
+
});
|
|
3103
|
+
#selector = computed(() => {
|
|
3104
|
+
const selector = this.#configuredSelector();
|
|
3105
|
+
if (!selector || this.#pickerSelection())
|
|
3106
|
+
return selector;
|
|
3107
|
+
// Keep intermediate selections reachable even when actions are hidden until a particular combination is selected.
|
|
3108
|
+
return sdFileExplorerHasActionCapability(this.selectionActions()) ? selector : null;
|
|
3109
|
+
});
|
|
3110
|
+
/** Files of the current folder or search results, in display order. Folders are never selectable. */
|
|
3111
|
+
#visibleFiles = computed(() => this.#visibleItems().filter(item => item.kind === 'file'));
|
|
3112
|
+
#selectionCandidates = computed(() => {
|
|
3113
|
+
const selector = this.#configuredSelector();
|
|
3114
|
+
if (!selector)
|
|
3115
|
+
return [];
|
|
3116
|
+
const disabled = selector.disabled;
|
|
3117
|
+
return disabled ? this.#visibleFiles().filter(item => !disabled(item)) : this.#visibleFiles();
|
|
3118
|
+
});
|
|
3119
|
+
#eligibleFiles = computed(() => (this.#selector() ? this.#selectionCandidates() : []));
|
|
3120
|
+
/**
|
|
3121
|
+
* Frozen snapshot of the selection handed to callbacks and actions: selected files that are still visible and
|
|
3122
|
+
* eligible, in display order. A file that a refresh drops, or that becomes disabled, leaves it.
|
|
3123
|
+
*/
|
|
3124
|
+
selectedItems = computed(() => {
|
|
3125
|
+
const ids = this.#selectedIds();
|
|
3126
|
+
return Object.freeze(this.#eligibleFiles().filter(item => ids.has(item.id)));
|
|
3127
|
+
});
|
|
3128
|
+
/** Selection state of the item list; `null` (no checkbox, no band) without selector or without files in view. */
|
|
3129
|
+
selectionView = computed(() => {
|
|
3130
|
+
const files = this.#visibleFiles();
|
|
3131
|
+
if (!this.#selector() || !files.length)
|
|
3132
|
+
return null;
|
|
3133
|
+
const eligible = this.#eligibleFiles();
|
|
3134
|
+
const selected = this.selectedItems();
|
|
3135
|
+
const eligibleIds = new Set(eligible.map(item => item.id));
|
|
3136
|
+
const autoId = this.autoId();
|
|
3137
|
+
return {
|
|
3138
|
+
selectedIds: new Set(selected.map(item => item.id)),
|
|
3139
|
+
disabledIds: new Set(files.filter(item => !eligibleIds.has(item.id)).map(item => item.id)),
|
|
3140
|
+
state: !selected.length ? 'none' : selected.length === eligible.length ? 'all' : 'some',
|
|
3141
|
+
eligibleCount: eligible.length,
|
|
3142
|
+
allLabel: this.#i18n.t('core.component.file-explorer.selection.select-all', { count: eligible.length }),
|
|
3143
|
+
autoId: autoId ? `${autoId}-select-all` : undefined,
|
|
3144
|
+
};
|
|
3145
|
+
});
|
|
3146
|
+
/**
|
|
3147
|
+
* Status sentence of the band, split around the number so the template can set it in semibold: "2 tệp đã chọn",
|
|
3148
|
+
* "已选择 2 个文件". Nothing selected: `count` is 0 and `before` holds the whole sentence.
|
|
3149
|
+
*/
|
|
3150
|
+
selectionSummary = computed(() => {
|
|
3151
|
+
const count = this.selectedItems().length;
|
|
3152
|
+
if (!count)
|
|
3153
|
+
return { count, before: this.#i18n.t('core.component.file-explorer.selection.none'), after: '' };
|
|
3154
|
+
// why: không truyền params thì I18nService giữ nguyên `{count}` — tách câu đã dịch tại đó, đúng vị trí của từng ngôn ngữ.
|
|
3155
|
+
const message = this.#i18n.t(`core.component.file-explorer.selection.${count === 1 ? 'selected-one' : 'selected'}`);
|
|
3156
|
+
const placeholder = '{count}';
|
|
3157
|
+
const at = message.indexOf(placeholder);
|
|
3158
|
+
if (at < 0)
|
|
3159
|
+
return { count, before: '', after: ` ${message}` };
|
|
3160
|
+
return { count, before: message.slice(0, at), after: message.slice(at + placeholder.length) };
|
|
3161
|
+
});
|
|
3162
|
+
// ---- Compact command drawer ----
|
|
3163
|
+
// why: mỗi lối tắt là một computed riêng — định nghĩa giữ nguyên object khi chỉ lối tắt kia đổi, nên lần kiểm tra ngay
|
|
3164
|
+
// trước khi chạy lệnh (definition còn được khai không) không hủy nhầm "Chia sẻ" chỉ vì `download` vừa đổi.
|
|
3165
|
+
#shareShortcut = computed(() => this.canShare()
|
|
3166
|
+
? {
|
|
3167
|
+
title: this.#i18n.t('core.component.file-explorer.share'),
|
|
3168
|
+
prefixIcon: 'share',
|
|
3169
|
+
disabled: item => this.movePending() || !sdFileExplorerEligible(this.#config().shareable, item),
|
|
3170
|
+
click: item => this.openShare(item),
|
|
3171
|
+
}
|
|
3172
|
+
: null);
|
|
3173
|
+
#downloadShortcut = computed(() => this.canDownload()
|
|
3174
|
+
? {
|
|
3175
|
+
title: this.#i18n.t('core.component.file-explorer.download'),
|
|
3176
|
+
prefixIcon: 'file_download',
|
|
3177
|
+
disabled: item => this.movePending() || !sdFileExplorerEligible(this.#config().downloadable, item),
|
|
3178
|
+
click: item => this.downloadItem(item),
|
|
3179
|
+
}
|
|
3180
|
+
: null);
|
|
3181
|
+
/** Row shortcuts as commands, for the drawer while `fileCommands` is undeclared: share, then download, as on the row. */
|
|
3182
|
+
#shortcuts = computed(() => {
|
|
3183
|
+
const commands = [];
|
|
3184
|
+
const keys = [];
|
|
3185
|
+
const share = this.#shareShortcut();
|
|
3186
|
+
const download = this.#downloadShortcut();
|
|
3187
|
+
if (share) {
|
|
3188
|
+
commands.push(share);
|
|
3189
|
+
keys.push('share');
|
|
3190
|
+
}
|
|
3191
|
+
if (download) {
|
|
3192
|
+
commands.push(download);
|
|
3193
|
+
keys.push('download');
|
|
3194
|
+
}
|
|
3195
|
+
return { commands, keys };
|
|
3196
|
+
});
|
|
3197
|
+
/** Current version of the drawer's item — looked up by id in the list it was opened from; `null` once it is gone. */
|
|
3198
|
+
#commandItem = computed(() => {
|
|
3199
|
+
const target = this.#commandTarget();
|
|
3200
|
+
return target ? this.#findCommandItem(target.id, target.origin) : null;
|
|
3201
|
+
});
|
|
3202
|
+
/** Content of the drawer: the item's commands resolved for it now; `null` when nothing is left to show. */
|
|
3203
|
+
// why: kiểu tường minh như contentState — d.ts ổn định giữa các máy build.
|
|
3204
|
+
commandSheet = computed(() => {
|
|
3205
|
+
const target = this.#commandTarget();
|
|
3206
|
+
const item = this.#commandItem();
|
|
3207
|
+
if (!target || !item)
|
|
3208
|
+
return null;
|
|
3209
|
+
const definitions = this.#commandDefinitions(item, target.origin);
|
|
3210
|
+
const source = item.kind === 'folder' ? 'folderCommands' : 'fileCommands';
|
|
3211
|
+
const resolved = sdFileExplorerResolveActions(definitions, item, SD_FILE_EXPLORER_COMMAND_DEFAULTS, source);
|
|
3212
|
+
if (!resolved.length)
|
|
3213
|
+
return null;
|
|
3214
|
+
const shortcuts = this.#shortcuts();
|
|
3215
|
+
const view = this.#itemFormatter()(item);
|
|
3216
|
+
return {
|
|
3217
|
+
title: item.name,
|
|
3218
|
+
context: [view.typeLabel, view.sizeLabel].filter(Boolean).join(' · '),
|
|
3219
|
+
icon: view.icon,
|
|
3220
|
+
entries: sdFileExplorerSheetEntries(resolved, definitions === shortcuts.commands ? shortcuts.keys : undefined),
|
|
3221
|
+
};
|
|
3222
|
+
});
|
|
3223
|
+
itemsMenuOpenId = computed(() => {
|
|
3224
|
+
const target = this.#commandTarget();
|
|
3225
|
+
return target && target.origin !== 'tree' ? target.id : null;
|
|
3226
|
+
});
|
|
3227
|
+
treeMenuOpenId = computed(() => {
|
|
3228
|
+
const target = this.#commandTarget();
|
|
3229
|
+
return target?.origin === 'tree' ? target.id : null;
|
|
3230
|
+
});
|
|
1607
3231
|
// why: như shareFeedback — kiểu tường minh để d.ts ổn định giữa các máy build.
|
|
1608
3232
|
contentState = computed(() => {
|
|
1609
3233
|
const keyword = this.#trimmedKeyword();
|
|
@@ -1810,6 +3434,9 @@ class SdFileExplorer {
|
|
|
1810
3434
|
const type = sdFileExplorerFileType(item);
|
|
1811
3435
|
return {
|
|
1812
3436
|
item,
|
|
3437
|
+
downloadDisabled: this.movePending() || !sdFileExplorerEligible(this.#config().downloadable, item),
|
|
3438
|
+
shareDisabled: this.movePending() || !sdFileExplorerEligible(this.#config().shareable, item),
|
|
3439
|
+
unavailableReason: t('action-unavailable'),
|
|
1813
3440
|
type,
|
|
1814
3441
|
icon: sdFileExplorerIconName(item),
|
|
1815
3442
|
typeLabel: t(`type.${type}`),
|
|
@@ -1818,26 +3445,88 @@ class SdFileExplorer {
|
|
|
1818
3445
|
modifiedTitle: sdFileExplorerFormatDateTime(item.modifiedAt, locale),
|
|
1819
3446
|
downloadLabel: t('download-item', { name: item.name }),
|
|
1820
3447
|
shareLabel: t('share-item', { name: item.name }),
|
|
3448
|
+
selectLabel: t('selection.select-item', { name: item.name }),
|
|
3449
|
+
actionsLabel: t('item-actions', { name: item.name }),
|
|
1821
3450
|
autoId: autoId ? `${autoId}-item-${sdFileExplorerSafeId(item.id)}` : undefined,
|
|
1822
3451
|
};
|
|
1823
3452
|
};
|
|
1824
3453
|
});
|
|
1825
3454
|
constructor() {
|
|
3455
|
+
const destroyRef = inject(DestroyRef);
|
|
3456
|
+
let previewProvider;
|
|
3457
|
+
let shareProvider;
|
|
3458
|
+
let moveProvider;
|
|
3459
|
+
let searchProvider;
|
|
3460
|
+
effect(() => {
|
|
3461
|
+
const config = this.#config();
|
|
3462
|
+
const previewChanged = previewProvider !== config.preview;
|
|
3463
|
+
const shareChanged = shareProvider !== config.share;
|
|
3464
|
+
const moveChanged = moveProvider?.onMove !== config.move?.onMove;
|
|
3465
|
+
const searchChanged = searchProvider !== config.search;
|
|
3466
|
+
previewProvider = config.preview;
|
|
3467
|
+
shareProvider = config.share;
|
|
3468
|
+
moveProvider = config.move;
|
|
3469
|
+
searchProvider = config.search;
|
|
3470
|
+
untracked(() => {
|
|
3471
|
+
const item = this.#previewItem();
|
|
3472
|
+
if (previewChanged && item)
|
|
3473
|
+
void this.#loadPreview(item);
|
|
3474
|
+
const shareItem = this.shareItem();
|
|
3475
|
+
if (shareChanged && shareItem) {
|
|
3476
|
+
this.#shareController?.abort();
|
|
3477
|
+
if (config.share && sdFileExplorerEligible(config.shareable, shareItem))
|
|
3478
|
+
void this.#loadShareLink(shareItem);
|
|
3479
|
+
else
|
|
3480
|
+
this.closeShare();
|
|
3481
|
+
}
|
|
3482
|
+
if (moveChanged && this.#moveController)
|
|
3483
|
+
this.cancelMove();
|
|
3484
|
+
if (searchChanged && this.#listFn === config.list)
|
|
3485
|
+
this.#scheduleSearch(true);
|
|
3486
|
+
});
|
|
3487
|
+
});
|
|
3488
|
+
// why: trên màn hình cảm ứng không có hover — lệnh của hàng/thẻ/cây luôn hiện và dùng vùng chạm 48px.
|
|
3489
|
+
// Đọc ngay trong constructor (không đợi render) để lần vẽ đầu đã đúng cỡ, rồi theo dõi khi thiết bị đổi con trỏ.
|
|
3490
|
+
const touchQuery = this.#document.defaultView?.matchMedia?.(TOUCH_QUERY);
|
|
3491
|
+
if (touchQuery) {
|
|
3492
|
+
this.#touch.set(touchQuery.matches);
|
|
3493
|
+
const onTouchChange = (event) => this.#touch.set(event.matches);
|
|
3494
|
+
touchQuery.addEventListener?.('change', onTouchChange);
|
|
3495
|
+
destroyRef.onDestroy(() => touchQuery.removeEventListener?.('change', onTouchChange));
|
|
3496
|
+
}
|
|
1826
3497
|
// why: chỉ reset khi hàm `list` đổi (đổi nguồn lưu trữ). Consumer tạo lại object option với cùng callback
|
|
1827
3498
|
// (ví dụ đổi title) không được xoá cache/điều hướng của người dùng.
|
|
1828
3499
|
effect(() => {
|
|
1829
|
-
const option = this
|
|
3500
|
+
const option = this.#config();
|
|
3501
|
+
const selecting = !!this.#selector();
|
|
1830
3502
|
untracked(() => {
|
|
3503
|
+
if (!selecting)
|
|
3504
|
+
this.#clearSelection();
|
|
1831
3505
|
if (this.#listFn === option.list)
|
|
1832
3506
|
return;
|
|
1833
3507
|
const firstRun = this.#listFn === null;
|
|
1834
3508
|
this.#listFn = option.list;
|
|
3509
|
+
if (this.#moveController)
|
|
3510
|
+
this.cancelMove();
|
|
3511
|
+
this.moveRefreshError.set(false);
|
|
3512
|
+
this.#moveRefreshFolders = [];
|
|
3513
|
+
this.#moveDrag.clear();
|
|
1835
3514
|
if (firstRun)
|
|
1836
3515
|
this.view.set(option.defaultView ?? 'list');
|
|
1837
3516
|
this.#resetNavigation();
|
|
1838
3517
|
this.#ensureLoaded(null);
|
|
1839
3518
|
});
|
|
1840
3519
|
});
|
|
3520
|
+
// why: tệp bị lần tải lại bỏ khỏi danh sách hoặc bị consumer khóa (selector.disabled) rời lựa chọn hẳn — không
|
|
3521
|
+
// được tự chọn lại khi xuất hiện/mở khóa lần sau. Chỉ dọn khi nội dung đã ổn định (không dọn lúc đang tải) và không
|
|
3522
|
+
// gọi callback: đây không phải thao tác của người dùng hay một lần đổi phạm vi. Tạo SAU effect option để khi
|
|
3523
|
+
// selector bị ẩn, #clearSelection (có onClear) chạy trước lần dọn im lặng này.
|
|
3524
|
+
effect(() => {
|
|
3525
|
+
const eligible = this.#eligibleFiles();
|
|
3526
|
+
if (this.contentState() === 'loading')
|
|
3527
|
+
return;
|
|
3528
|
+
untracked(() => this.#keepEligibleSelection(eligible));
|
|
3529
|
+
});
|
|
1841
3530
|
afterNextRender(() => {
|
|
1842
3531
|
const host = this.#host.nativeElement;
|
|
1843
3532
|
this.#width.set(host.getBoundingClientRect().width);
|
|
@@ -1850,19 +3539,213 @@ class SdFileExplorer {
|
|
|
1850
3539
|
});
|
|
1851
3540
|
this.#resizeObserver.observe(host);
|
|
1852
3541
|
});
|
|
1853
|
-
// why: rời khỏi layout compact thì drawer không còn ý nghĩa — đóng để lần thu nhỏ sau không bật lại scrim.
|
|
3542
|
+
// why: rời khỏi layout compact thì drawer không còn ý nghĩa — đóng để lần thu nhỏ sau không bật lại scrim. Drawer
|
|
3543
|
+
// lệnh cũng đóng: hàng/thẻ/cây lại hiện lệnh của chúng (xoay ngang máy, kéo rộng cửa sổ).
|
|
1854
3544
|
effect(() => {
|
|
1855
|
-
if (
|
|
1856
|
-
|
|
3545
|
+
if (this.compact())
|
|
3546
|
+
return;
|
|
3547
|
+
untracked(() => {
|
|
3548
|
+
this.sidebarOpen.set(false);
|
|
3549
|
+
this.#closeCommands();
|
|
3550
|
+
});
|
|
3551
|
+
});
|
|
3552
|
+
// why: mục của drawer lệnh rời danh sách (lần tải lại bỏ nó, kết quả tìm kiếm đổi) hoặc không còn lệnh nào hiện —
|
|
3553
|
+
// đóng drawer thay vì giữ một ảnh chụp cũ có thể chạy lệnh trên mục đã mất.
|
|
3554
|
+
effect(() => {
|
|
3555
|
+
if (this.#commandTarget() && !this.commandSheet())
|
|
3556
|
+
untracked(() => this.#closeCommands());
|
|
1857
3557
|
});
|
|
1858
|
-
|
|
3558
|
+
// why: nút Back của trình duyệt / Android khi drawer lệnh đang mở — đóng drawer theo điều hướng của trang. Drawer không
|
|
3559
|
+
// giữ mục lịch sử nào (không pushState, không history.back): Back vẫn điều hướng như bình thường.
|
|
3560
|
+
const view = this.#document.defaultView;
|
|
3561
|
+
if (view) {
|
|
3562
|
+
const onPopState = () => this.#closeCommands();
|
|
3563
|
+
view.addEventListener('popstate', onPopState);
|
|
3564
|
+
destroyRef.onDestroy(() => view.removeEventListener('popstate', onPopState));
|
|
3565
|
+
}
|
|
3566
|
+
destroyRef.onDestroy(() => this.#teardown());
|
|
1859
3567
|
}
|
|
1860
3568
|
// ---- Public API ----
|
|
3569
|
+
/** Moves visible files through the caller's storage callback. False includes cancellation, rejection or refresh failure. */
|
|
3570
|
+
async moveFiles(items, targetFolder, source = 'api') {
|
|
3571
|
+
return this.#performMove(items, targetFolder, source, false);
|
|
3572
|
+
}
|
|
3573
|
+
async #performMove(items, targetFolder, source, selectionRequired) {
|
|
3574
|
+
const move = this.#config().move;
|
|
3575
|
+
if (!move ||
|
|
3576
|
+
this.movePending() ||
|
|
3577
|
+
this.moveRefreshError() ||
|
|
3578
|
+
this.folderSubmitting() ||
|
|
3579
|
+
this.#transfers().some(transfer => transfer.direction === 'upload' && ACTIVE_STATUSES.has(transfer.status)) ||
|
|
3580
|
+
this.#destroyed)
|
|
3581
|
+
return false;
|
|
3582
|
+
const controller = new AbortController();
|
|
3583
|
+
if (!this.#moveAllowed(items, targetFolder, source, controller.signal, selectionRequired))
|
|
3584
|
+
return false;
|
|
3585
|
+
const request = Object.freeze({
|
|
3586
|
+
items: Object.freeze([...items]),
|
|
3587
|
+
targetFolder,
|
|
3588
|
+
source,
|
|
3589
|
+
signal: controller.signal,
|
|
3590
|
+
});
|
|
3591
|
+
const sourceParents = items.map(item => item.parentId);
|
|
3592
|
+
const movedIds = new Set(items.map(item => item.id));
|
|
3593
|
+
const cachedSources = [...this.#folders()].filter(([, folder]) => folder.items.some(item => movedIds.has(item.id))).map(([id]) => id);
|
|
3594
|
+
this.#moveController = controller;
|
|
3595
|
+
this.movePending.set(true);
|
|
3596
|
+
this.moveStatus.set(this.#i18n.t('core.component.file-explorer.move.pending'));
|
|
3597
|
+
try {
|
|
3598
|
+
const accepted = await move.onMove(request);
|
|
3599
|
+
if (controller.signal.aborted || this.#destroyed || this.#config().move?.onMove !== move.onMove)
|
|
3600
|
+
return false;
|
|
3601
|
+
if (accepted === false) {
|
|
3602
|
+
this.moveStatus.set(this.#i18n.t('core.component.file-explorer.move.cancelled'));
|
|
3603
|
+
return false;
|
|
3604
|
+
}
|
|
3605
|
+
this.#moveRefreshFolders = [...new Set([...sourceParents, ...cachedSources, targetFolder?.id ?? null])].filter(id => this.#folders().has(id));
|
|
3606
|
+
this.#clearSelection();
|
|
3607
|
+
return await this.#refreshMove(controller);
|
|
3608
|
+
}
|
|
3609
|
+
catch (error) {
|
|
3610
|
+
if (!controller.signal.aborted && !this.#destroyed)
|
|
3611
|
+
this.moveStatus.set(sdFileExplorerErrorMessage(error) || this.#i18n.t('core.component.file-explorer.move.error'));
|
|
3612
|
+
return false;
|
|
3613
|
+
}
|
|
3614
|
+
finally {
|
|
3615
|
+
if (this.#moveController === controller) {
|
|
3616
|
+
this.#moveController = null;
|
|
3617
|
+
this.movePending.set(false);
|
|
3618
|
+
}
|
|
3619
|
+
}
|
|
3620
|
+
}
|
|
3621
|
+
/** Cooperatively aborts the current mutation. A consumer may already have committed its storage change. */
|
|
3622
|
+
cancelMove() {
|
|
3623
|
+
this.#moveController?.abort();
|
|
3624
|
+
this.#moveController = null;
|
|
3625
|
+
this.movePending.set(false);
|
|
3626
|
+
this.moveStatus.set(this.#i18n.t('core.component.file-explorer.move.cancelled'));
|
|
3627
|
+
this.#moveDrag.clear();
|
|
3628
|
+
}
|
|
3629
|
+
/** Repeats failed listing only; never calls onMove again. */
|
|
3630
|
+
async retryMoveRefresh() {
|
|
3631
|
+
if (!this.moveRefreshError() || this.movePending() || this.#destroyed)
|
|
3632
|
+
return false;
|
|
3633
|
+
const controller = new AbortController();
|
|
3634
|
+
this.#moveController = controller;
|
|
3635
|
+
this.movePending.set(true);
|
|
3636
|
+
try {
|
|
3637
|
+
return await this.#refreshMove(controller);
|
|
3638
|
+
}
|
|
3639
|
+
finally {
|
|
3640
|
+
if (this.#moveController === controller) {
|
|
3641
|
+
this.#moveController = null;
|
|
3642
|
+
this.movePending.set(false);
|
|
3643
|
+
}
|
|
3644
|
+
}
|
|
3645
|
+
}
|
|
3646
|
+
async #refreshMove(controller) {
|
|
3647
|
+
await Promise.all(this.#moveRefreshFolders.map(id => this.#load(id)));
|
|
3648
|
+
if (controller.signal.aborted || this.#destroyed)
|
|
3649
|
+
return false;
|
|
3650
|
+
const failed = this.#moveRefreshFolders.some(id => this.#folders().get(id)?.status !== 'loaded');
|
|
3651
|
+
this.moveRefreshError.set(failed);
|
|
3652
|
+
this.moveStatus.set(this.#i18n.t(failed ? 'core.component.file-explorer.move.refresh-error' : 'core.component.file-explorer.move.done'));
|
|
3653
|
+
if (!failed) {
|
|
3654
|
+
this.#moveRefreshFolders = [];
|
|
3655
|
+
if (this.searching())
|
|
3656
|
+
this.#scheduleSearch(true);
|
|
3657
|
+
}
|
|
3658
|
+
return !failed;
|
|
3659
|
+
}
|
|
3660
|
+
#moveAllowed(items, target, source, signal, selectionRequired = false) {
|
|
3661
|
+
const move = this.#config().move;
|
|
3662
|
+
const visible = this.#visibleItems();
|
|
3663
|
+
const known = [...this.#folders().values()].flatMap(folder => folder.items.filter(item => item.kind === 'folder'));
|
|
3664
|
+
if (!move || !sdFileExplorerValidateMove(items, target, known, visible))
|
|
3665
|
+
return false;
|
|
3666
|
+
if (selectionRequired && items.some(item => !this.#eligibleFiles().includes(item)))
|
|
3667
|
+
return false;
|
|
3668
|
+
return sdFileExplorerEligible(move.movable, { items: Object.freeze([...items]), targetFolder: target, source, signal });
|
|
3669
|
+
}
|
|
3670
|
+
openMovePicker(items, event) {
|
|
3671
|
+
if (!this.canMove() || this.movePending() || !items.length)
|
|
3672
|
+
return;
|
|
3673
|
+
const active = this.#document.activeElement;
|
|
3674
|
+
this.#moveReturnFocus = active instanceof HTMLElement ? active : null;
|
|
3675
|
+
const selected = this.selectedItems();
|
|
3676
|
+
this.#movePickerSelectionRequired = items.every(item => selected.includes(item));
|
|
3677
|
+
this.moveTarget.set(null);
|
|
3678
|
+
this.movePickerItems.set(Object.freeze([...items]));
|
|
3679
|
+
event?.stopPropagation();
|
|
3680
|
+
}
|
|
3681
|
+
closeMovePicker() {
|
|
3682
|
+
if (this.movePending())
|
|
3683
|
+
this.cancelMove();
|
|
3684
|
+
this.movePickerItems.set(null);
|
|
3685
|
+
this.#movePickerSelectionRequired = false;
|
|
3686
|
+
const focus = this.#moveReturnFocus;
|
|
3687
|
+
this.#moveReturnFocus = null;
|
|
3688
|
+
if (focus?.isConnected)
|
|
3689
|
+
afterNextRender(() => focus.focus({ preventScroll: true }), { injector: this.#injector });
|
|
3690
|
+
}
|
|
3691
|
+
submitMoveFromEvent(event) {
|
|
3692
|
+
void this.submitMove(event instanceof MouseEvent && event.detail === 0 ? 'keyboard' : 'menu');
|
|
3693
|
+
}
|
|
3694
|
+
async submitMove(source = 'menu') {
|
|
3695
|
+
const items = this.movePickerItems();
|
|
3696
|
+
if (!items)
|
|
3697
|
+
return;
|
|
3698
|
+
if (await this.#performMove(items, this.moveTarget(), source, this.#movePickerSelectionRequired))
|
|
3699
|
+
this.closeMovePicker();
|
|
3700
|
+
}
|
|
3701
|
+
onMoveDragStart(event) {
|
|
3702
|
+
const element = event.target instanceof Element ? event.target : null;
|
|
3703
|
+
if (!element?.closest('.name, .card-name') ||
|
|
3704
|
+
element.closest('button,input,a,.commands,.card-top,.cell--select') ||
|
|
3705
|
+
!event.dataTransfer ||
|
|
3706
|
+
!this.canMove() ||
|
|
3707
|
+
this.movePending()) {
|
|
3708
|
+
event.preventDefault();
|
|
3709
|
+
return;
|
|
3710
|
+
}
|
|
3711
|
+
const id = element.closest('[data-item-id]')?.dataset['itemId'];
|
|
3712
|
+
const file = this.#visibleItems().find(item => item.id === id && item.kind === 'file');
|
|
3713
|
+
if (!file) {
|
|
3714
|
+
event.preventDefault();
|
|
3715
|
+
return;
|
|
3716
|
+
}
|
|
3717
|
+
const selected = this.selectedItems();
|
|
3718
|
+
this.#moveDragSelectionRequired = selected.includes(file);
|
|
3719
|
+
const items = selected.includes(file) ? selected : [file];
|
|
3720
|
+
event.dataTransfer.setData(SD_FILE_EXPLORER_MOVE_MIME, this.#moveDrag.start(items));
|
|
3721
|
+
event.dataTransfer.effectAllowed = 'move';
|
|
3722
|
+
}
|
|
3723
|
+
onMoveDragEnd() {
|
|
3724
|
+
this.#moveDrag.clear();
|
|
3725
|
+
this.#moveDragSelectionRequired = false;
|
|
3726
|
+
this.moveDropTarget.set(undefined);
|
|
3727
|
+
}
|
|
3728
|
+
#internalDropTarget(event) {
|
|
3729
|
+
const element = event.target instanceof Element ? event.target : null;
|
|
3730
|
+
if (element?.closest('sd-file-explorer') !== this.#host.nativeElement)
|
|
3731
|
+
return null;
|
|
3732
|
+
const node = element.closest('[data-move-target]');
|
|
3733
|
+
if (!node)
|
|
3734
|
+
return null;
|
|
3735
|
+
const id = node.dataset['moveTarget'];
|
|
3736
|
+
if (id === '')
|
|
3737
|
+
return { folder: null };
|
|
3738
|
+
const folder = [...this.#itemById().values()].find(item => item.id === id && item.kind === 'folder');
|
|
3739
|
+
return folder ? { folder } : null;
|
|
3740
|
+
}
|
|
1861
3741
|
/**
|
|
1862
3742
|
* Lists the current folder again and drops the cached children of folders that are neither open in the
|
|
1863
|
-
* tree nor on the current path. Re-runs the active search, if any.
|
|
3743
|
+
* tree nor on the current path. Re-runs the active search, if any. Clears the file selection and closes the command
|
|
3744
|
+
* drawer of the compact layout.
|
|
1864
3745
|
*/
|
|
1865
3746
|
reload() {
|
|
3747
|
+
this.#clearSelection();
|
|
3748
|
+
this.#closeCommands();
|
|
1866
3749
|
const keep = new Set([null, this.#currentId(), ...this.#expanded(), ...this.#path().map(folder => folder.id)]);
|
|
1867
3750
|
const folders = new Map(this.#folders());
|
|
1868
3751
|
for (const key of [...folders.keys()]) {
|
|
@@ -1882,6 +3765,9 @@ class SdFileExplorer {
|
|
|
1882
3765
|
// ---- Navigation ----
|
|
1883
3766
|
navigate(folder) {
|
|
1884
3767
|
const id = folder?.id ?? null;
|
|
3768
|
+
if (id !== this.#currentId())
|
|
3769
|
+
this.#clearSelection();
|
|
3770
|
+
this.#closeCommands();
|
|
1885
3771
|
const path = folder ? this.#buildPath(folder) : [];
|
|
1886
3772
|
this.#currentId.set(id);
|
|
1887
3773
|
this.#path.set(path);
|
|
@@ -1977,10 +3863,14 @@ class SdFileExplorer {
|
|
|
1977
3863
|
this.previewState.set({ status: 'error', message: '' });
|
|
1978
3864
|
}
|
|
1979
3865
|
downloadItem(item) {
|
|
1980
|
-
const download = this
|
|
1981
|
-
if (!download)
|
|
3866
|
+
const download = this.#config().download;
|
|
3867
|
+
if (!download || !sdFileExplorerEligible(this.#config().downloadable, item))
|
|
1982
3868
|
return;
|
|
1983
|
-
this.#enqueue('download', item.name, item.parentId, args =>
|
|
3869
|
+
this.#enqueue('download', item.name, item.parentId, args => {
|
|
3870
|
+
if (!sdFileExplorerEligible(this.#config().downloadable, item))
|
|
3871
|
+
throw new Error(this.#i18n.t('core.component.file-explorer.action-unavailable'));
|
|
3872
|
+
return download({ item, ...args });
|
|
3873
|
+
});
|
|
1984
3874
|
this.transfersCollapsed.set(false);
|
|
1985
3875
|
}
|
|
1986
3876
|
downloadPreview() {
|
|
@@ -1993,9 +3883,176 @@ class SdFileExplorer {
|
|
|
1993
3883
|
if (item)
|
|
1994
3884
|
this.openShare(item);
|
|
1995
3885
|
}
|
|
3886
|
+
// ---- Selection ----
|
|
3887
|
+
toggleSelection(item) {
|
|
3888
|
+
const selector = this.#selector();
|
|
3889
|
+
if (!selector || !this.#eligibleFiles().some(file => file.id === item.id))
|
|
3890
|
+
return;
|
|
3891
|
+
// why: dựng lại từ selectedItems (không từ #selectedIds) để bỏ luôn id của tệp đã rời khỏi danh sách.
|
|
3892
|
+
const next = new Set(this.selectedItems().map(file => file.id));
|
|
3893
|
+
if (next.has(item.id))
|
|
3894
|
+
next.delete(item.id);
|
|
3895
|
+
else
|
|
3896
|
+
next.add(item.id);
|
|
3897
|
+
this.#selectedIds.set(next);
|
|
3898
|
+
selector.onSelect?.(item, this.selectedItems());
|
|
3899
|
+
}
|
|
3900
|
+
toggleSelectAll() {
|
|
3901
|
+
const selector = this.#selector();
|
|
3902
|
+
const eligible = this.#eligibleFiles();
|
|
3903
|
+
if (!selector || !eligible.length)
|
|
3904
|
+
return;
|
|
3905
|
+
const all = this.selectedItems().length === eligible.length;
|
|
3906
|
+
this.#selectedIds.set(new Set(all ? [] : eligible.map(item => item.id)));
|
|
3907
|
+
selector.onSelectAll?.(this.selectedItems());
|
|
3908
|
+
}
|
|
3909
|
+
clearSelection() {
|
|
3910
|
+
const active = this.#document.activeElement;
|
|
3911
|
+
if (active instanceof HTMLElement && active.classList.contains('selection-clear') && this.#host.nativeElement.contains(active)) {
|
|
3912
|
+
// Move owned focus before removing the toolbar. A consumer's onClear callback
|
|
3913
|
+
// remains free to move focus elsewhere after the selection is cleared.
|
|
3914
|
+
this.#host.nativeElement.querySelector('.select-all input')?.focus({ preventScroll: true });
|
|
3915
|
+
}
|
|
3916
|
+
this.#clearSelection();
|
|
3917
|
+
}
|
|
3918
|
+
/** Empties the selection, calling `onClear` once when something was selected. */
|
|
3919
|
+
#clearSelection() {
|
|
3920
|
+
if (!this.#selectedIds().size)
|
|
3921
|
+
return;
|
|
3922
|
+
this.#selectedIds.set(new Set());
|
|
3923
|
+
this.#config().selector?.onClear?.();
|
|
3924
|
+
}
|
|
3925
|
+
/** Forgets selected ids that are no longer visible and eligible. Silent: no callback. */
|
|
3926
|
+
#keepEligibleSelection(eligible) {
|
|
3927
|
+
const ids = this.#selectedIds();
|
|
3928
|
+
if (!ids.size)
|
|
3929
|
+
return;
|
|
3930
|
+
const kept = new Set(eligible.filter(item => ids.has(item.id)).map(item => item.id));
|
|
3931
|
+
if (kept.size !== ids.size)
|
|
3932
|
+
this.#selectedIds.set(kept);
|
|
3933
|
+
}
|
|
3934
|
+
// ---- Compact command drawer ----
|
|
3935
|
+
openCommands(item, origin, trigger) {
|
|
3936
|
+
this.#pendingCommand = null;
|
|
3937
|
+
// why: bẫy focus của sd-side-drawer trả focus về phần tử đang giữ focus lúc nó mở. Chạm vào nút trên iOS không
|
|
3938
|
+
// focus nút, nên focus nút trước khi mở để đóng drawer xong focus về đúng hàng / thẻ / nút cây.
|
|
3939
|
+
trigger.focus({ preventScroll: true });
|
|
3940
|
+
this.#commandTarget.set({ id: item.id, origin, trigger });
|
|
3941
|
+
this.commandDrawer()?.show();
|
|
3942
|
+
}
|
|
3943
|
+
/** The user closed the drawer (close button, `Escape`, backdrop). */
|
|
3944
|
+
onCommandsClosed() {
|
|
3945
|
+
const target = this.#commandTarget();
|
|
3946
|
+
if (!target)
|
|
3947
|
+
return;
|
|
3948
|
+
this.#commandTarget.set(null);
|
|
3949
|
+
afterNextRender(() => this.#restoreCommandFocus(target), { injector: this.#injector });
|
|
3950
|
+
}
|
|
3951
|
+
/**
|
|
3952
|
+
* Runs a command pressed in the drawer. The press is checked against the current item, definitions and states: a
|
|
3953
|
+
* stale entry, a state the consumer changed since the last render or a second press runs nothing.
|
|
3954
|
+
*
|
|
3955
|
+
* The drawer closes first, at once. The command runs after the next render: by then the drawer's focus trap is gone
|
|
3956
|
+
* and has handed focus back, so it cannot pull focus away from a dialog or a preview the command opens. Right before
|
|
3957
|
+
* it runs, the same check is made again, and `click` receives the item as listed at that moment.
|
|
3958
|
+
*/
|
|
3959
|
+
runCommand({ command, group }) {
|
|
3960
|
+
const target = this.#commandTarget();
|
|
3961
|
+
if (this.#pendingCommand || !target)
|
|
3962
|
+
return;
|
|
3963
|
+
const pending = { id: target.id, origin: target.origin, leaf: command.definition, group: group?.definition ?? null };
|
|
3964
|
+
if (!this.#runnableItem(pending)) {
|
|
3965
|
+
// why: trạng thái do consumer giữ ngoài signal đã đổi từ lần render trước — tính lại để drawer hiện đúng trạng thái.
|
|
3966
|
+
this.#commandTarget.set({ ...target });
|
|
3967
|
+
return;
|
|
3968
|
+
}
|
|
3969
|
+
this.#pendingCommand = pending;
|
|
3970
|
+
this.#commandTarget.set(null);
|
|
3971
|
+
this.commandDrawer()?.hide();
|
|
3972
|
+
afterNextRender(() => {
|
|
3973
|
+
if (this.#pendingCommand !== pending)
|
|
3974
|
+
return;
|
|
3975
|
+
this.#pendingCommand = null;
|
|
3976
|
+
this.#restoreCommandFocus(target);
|
|
3977
|
+
// why: giữa lúc bấm và lần render này consumer vẫn có thể đổi trạng thái, rút định nghĩa hay làm mới danh sách
|
|
3978
|
+
// (drawer đã đóng nên effect "mục biến mất" không còn canh) — kiểm lại ngay trước khi chạy, với bản hiện tại của mục.
|
|
3979
|
+
const item = this.#runnableItem(pending);
|
|
3980
|
+
if (item)
|
|
3981
|
+
(pending.leaf.onClick ?? pending.leaf.click)?.(item);
|
|
3982
|
+
}, { injector: this.#injector });
|
|
3983
|
+
}
|
|
3984
|
+
/** Current version of an item, by id, in the list a drawer was opened from (list / grid items or tree folders). */
|
|
3985
|
+
#findCommandItem(id, origin) {
|
|
3986
|
+
if (origin === 'tree')
|
|
3987
|
+
return this.treeNodes().find(node => node.id === id)?.item ?? null;
|
|
3988
|
+
return this.#visibleItems().find(item => item.id === id) ?? null;
|
|
3989
|
+
}
|
|
3990
|
+
/**
|
|
3991
|
+
* The current item when `command` may run now — the item is still listed where the drawer was opened, the pressed
|
|
3992
|
+
* definition and its group are still declared for it, and neither is hidden, disabled or loading — else `null`.
|
|
3993
|
+
*/
|
|
3994
|
+
#runnableItem(command) {
|
|
3995
|
+
const item = this.#findCommandItem(command.id, command.origin);
|
|
3996
|
+
if (!item)
|
|
3997
|
+
return null;
|
|
3998
|
+
const { leaf, group } = command;
|
|
3999
|
+
const definitions = this.#commandDefinitions(item, command.origin);
|
|
4000
|
+
const declared = group ? definitions.includes(group) && group.children.includes(leaf) : definitions.includes(leaf);
|
|
4001
|
+
const blocked = (group !== null && sdFileExplorerActionBlocked(group, item)) || sdFileExplorerActionBlocked(leaf, item);
|
|
4002
|
+
return declared && !blocked ? item : null;
|
|
4003
|
+
}
|
|
4004
|
+
/** Commands of one item in the drawer: the declared ones, or the row shortcuts while `fileCommands` is undeclared. */
|
|
4005
|
+
#commandDefinitions(item, origin) {
|
|
4006
|
+
const option = this.#config();
|
|
4007
|
+
if (item.kind === 'folder')
|
|
4008
|
+
return option.folderCommands ?? [];
|
|
4009
|
+
if (option.fileCommands != null)
|
|
4010
|
+
return option.fileCommands;
|
|
4011
|
+
// why: lối tắt tải xuống / chia sẻ chỉ có trên hàng danh sách — thẻ lưới chưa từng có — nên chỉ hàng mang chúng vào drawer.
|
|
4012
|
+
return origin === 'list' ? this.#shortcuts().commands : [];
|
|
4013
|
+
}
|
|
4014
|
+
/** Closes the drawer without running anything and drops a pressed command that has not run yet. */
|
|
4015
|
+
#closeCommands() {
|
|
4016
|
+
this.#pendingCommand = null;
|
|
4017
|
+
const target = this.#commandTarget();
|
|
4018
|
+
if (!target)
|
|
4019
|
+
return;
|
|
4020
|
+
this.#commandTarget.set(null);
|
|
4021
|
+
this.commandDrawer()?.hide();
|
|
4022
|
+
afterNextRender(() => this.#restoreCommandFocus(target), { injector: this.#injector });
|
|
4023
|
+
}
|
|
4024
|
+
/**
|
|
4025
|
+
* After the drawer closed: when its focus trap could not give focus back — the trigger left the page with its row,
|
|
4026
|
+
* or the layout changed — focus the item's row, card or tree tab stop, the first item, or the search box.
|
|
4027
|
+
*/
|
|
4028
|
+
#restoreCommandFocus(target) {
|
|
4029
|
+
const active = this.#document.activeElement;
|
|
4030
|
+
if (this.#destroyed || (active && active !== this.#document.body))
|
|
4031
|
+
return;
|
|
4032
|
+
const host = this.#host.nativeElement;
|
|
4033
|
+
const items = Array.from(host.querySelectorAll('[data-item-id]'));
|
|
4034
|
+
const candidates = [
|
|
4035
|
+
target.trigger.isConnected ? target.trigger : null,
|
|
4036
|
+
target.origin === 'tree'
|
|
4037
|
+
? host.querySelector('[role="treeitem"][tabindex="0"]')
|
|
4038
|
+
: (items.find(element => element.dataset['itemId'] === target.id) ?? null),
|
|
4039
|
+
items[0] ?? null,
|
|
4040
|
+
this.searchInput()?.nativeElement ?? null,
|
|
4041
|
+
];
|
|
4042
|
+
for (const candidate of candidates) {
|
|
4043
|
+
candidate?.focus({ preventScroll: true });
|
|
4044
|
+
if (candidate && this.#document.activeElement === candidate)
|
|
4045
|
+
return;
|
|
4046
|
+
}
|
|
4047
|
+
}
|
|
1996
4048
|
// ---- Search ----
|
|
1997
4049
|
onKeywordInput(value) {
|
|
4050
|
+
const before = this.#trimmedKeyword();
|
|
1998
4051
|
this.keyword.set(value);
|
|
4052
|
+
if (this.#trimmedKeyword() !== before) {
|
|
4053
|
+
this.#clearSelection();
|
|
4054
|
+
this.#closeCommands();
|
|
4055
|
+
}
|
|
1999
4056
|
this.#scheduleSearch(false);
|
|
2000
4057
|
}
|
|
2001
4058
|
clearSearch() {
|
|
@@ -2010,16 +4067,26 @@ class SdFileExplorer {
|
|
|
2010
4067
|
this.uploadFiles(files);
|
|
2011
4068
|
}
|
|
2012
4069
|
uploadFiles(files) {
|
|
2013
|
-
|
|
2014
|
-
|
|
4070
|
+
if (this.movePending())
|
|
4071
|
+
return;
|
|
4072
|
+
const upload = this.#config().upload;
|
|
4073
|
+
if (!upload || files.length === 0 || !sdFileExplorerEligible(this.#config().uploadable, { parentId: this.#currentId() }))
|
|
2015
4074
|
return;
|
|
2016
4075
|
const parentId = this.#currentId();
|
|
2017
4076
|
for (const file of files) {
|
|
2018
|
-
this.#enqueue('upload', file.name, parentId, args =>
|
|
4077
|
+
this.#enqueue('upload', file.name, parentId, args => {
|
|
4078
|
+
if (!sdFileExplorerEligible(this.#config().uploadable, { parentId }))
|
|
4079
|
+
throw new Error(this.#i18n.t('core.component.file-explorer.action-unavailable'));
|
|
4080
|
+
return upload({ file, parentId, ...args });
|
|
4081
|
+
});
|
|
2019
4082
|
}
|
|
2020
4083
|
this.transfersCollapsed.set(false);
|
|
2021
4084
|
}
|
|
2022
4085
|
onDragEnter(event) {
|
|
4086
|
+
if (event.dataTransfer?.types.includes(SD_FILE_EXPLORER_MOVE_MIME)) {
|
|
4087
|
+
this.onDragOver(event);
|
|
4088
|
+
return;
|
|
4089
|
+
}
|
|
2023
4090
|
if (!this.#acceptsDrag(event))
|
|
2024
4091
|
return;
|
|
2025
4092
|
event.preventDefault();
|
|
@@ -2027,6 +4094,20 @@ class SdFileExplorer {
|
|
|
2027
4094
|
this.dragActive.set(true);
|
|
2028
4095
|
}
|
|
2029
4096
|
onDragOver(event) {
|
|
4097
|
+
if (event.dataTransfer?.types.includes(SD_FILE_EXPLORER_MOVE_MIME)) {
|
|
4098
|
+
const target = this.#internalDropTarget(event);
|
|
4099
|
+
const items = this.#moveDrag.activeItems;
|
|
4100
|
+
const allowed = !event.dataTransfer.types.includes('Files') &&
|
|
4101
|
+
!!items &&
|
|
4102
|
+
!!target &&
|
|
4103
|
+
!this.movePending() &&
|
|
4104
|
+
this.#moveAllowed(items, target.folder, 'drag', new AbortController().signal, this.#moveDragSelectionRequired);
|
|
4105
|
+
if (target && items && allowed)
|
|
4106
|
+
event.preventDefault();
|
|
4107
|
+
event.dataTransfer.dropEffect = allowed ? 'move' : 'none';
|
|
4108
|
+
this.moveDropTarget.set(allowed ? (target.folder?.id ?? null) : undefined);
|
|
4109
|
+
return;
|
|
4110
|
+
}
|
|
2030
4111
|
if (!this.#acceptsDrag(event))
|
|
2031
4112
|
return;
|
|
2032
4113
|
event.preventDefault();
|
|
@@ -2042,6 +4123,17 @@ class SdFileExplorer {
|
|
|
2042
4123
|
this.dragActive.set(false);
|
|
2043
4124
|
}
|
|
2044
4125
|
onDrop(event) {
|
|
4126
|
+
if (event.dataTransfer?.types.includes(SD_FILE_EXPLORER_MOVE_MIME)) {
|
|
4127
|
+
event.preventDefault();
|
|
4128
|
+
const target = this.#internalDropTarget(event);
|
|
4129
|
+
const items = this.#moveDrag.resolve(event.dataTransfer.getData(SD_FILE_EXPLORER_MOVE_MIME));
|
|
4130
|
+
const mixed = event.dataTransfer.types.includes('Files') || event.dataTransfer.files.length > 0;
|
|
4131
|
+
const selectionRequired = this.#moveDragSelectionRequired;
|
|
4132
|
+
this.onMoveDragEnd();
|
|
4133
|
+
if (items && target && !mixed)
|
|
4134
|
+
void this.#performMove(items, target.folder, 'drag', selectionRequired);
|
|
4135
|
+
return;
|
|
4136
|
+
}
|
|
2045
4137
|
if (!this.#acceptsDrag(event))
|
|
2046
4138
|
return;
|
|
2047
4139
|
event.preventDefault();
|
|
@@ -2063,6 +4155,8 @@ class SdFileExplorer {
|
|
|
2063
4155
|
}
|
|
2064
4156
|
retryTransfer(id) {
|
|
2065
4157
|
const job = this.#jobs.get(id);
|
|
4158
|
+
if (job?.direction === 'upload' && this.movePending())
|
|
4159
|
+
return;
|
|
2066
4160
|
const status = this.#statusOf(id);
|
|
2067
4161
|
if (!job || (status !== 'error' && status !== 'cancelled'))
|
|
2068
4162
|
return;
|
|
@@ -2099,7 +4193,7 @@ class SdFileExplorer {
|
|
|
2099
4193
|
}
|
|
2100
4194
|
// ---- Share ----
|
|
2101
4195
|
openShare(item) {
|
|
2102
|
-
if (!this
|
|
4196
|
+
if (!this.#config().share || !sdFileExplorerEligible(this.#config().shareable, item))
|
|
2103
4197
|
return;
|
|
2104
4198
|
const active = this.#document.activeElement;
|
|
2105
4199
|
this.#shareReturnFocus = active instanceof HTMLElement && this.#host.nativeElement.contains(active) ? active : null;
|
|
@@ -2149,8 +4243,8 @@ class SdFileExplorer {
|
|
|
2149
4243
|
}
|
|
2150
4244
|
}
|
|
2151
4245
|
async #loadShareLink(item) {
|
|
2152
|
-
const share = this
|
|
2153
|
-
if (!share)
|
|
4246
|
+
const share = this.#config().share;
|
|
4247
|
+
if (!share || !sdFileExplorerEligible(this.#config().shareable, item))
|
|
2154
4248
|
return;
|
|
2155
4249
|
this.#shareController?.abort();
|
|
2156
4250
|
const controller = new AbortController();
|
|
@@ -2189,9 +4283,11 @@ class SdFileExplorer {
|
|
|
2189
4283
|
}
|
|
2190
4284
|
async submitFolder(event) {
|
|
2191
4285
|
event.preventDefault();
|
|
2192
|
-
|
|
4286
|
+
if (this.movePending())
|
|
4287
|
+
return;
|
|
4288
|
+
const create = this.#config().createFolder;
|
|
2193
4289
|
const name = this.folderName().trim();
|
|
2194
|
-
if (!create || !name || this.folderSubmitting())
|
|
4290
|
+
if (!create || !name || this.folderSubmitting() || !sdFileExplorerEligible(this.#config().creatable, { parentId: this.#currentId() }))
|
|
2195
4291
|
return;
|
|
2196
4292
|
const parentId = this.#currentId();
|
|
2197
4293
|
this.folderSubmitting.set(true);
|
|
@@ -2218,7 +4314,11 @@ class SdFileExplorer {
|
|
|
2218
4314
|
onEscape(event) {
|
|
2219
4315
|
if (event.defaultPrevented)
|
|
2220
4316
|
return;
|
|
2221
|
-
if (this.
|
|
4317
|
+
if (this.movePickerItems())
|
|
4318
|
+
this.closeMovePicker();
|
|
4319
|
+
else if (this.movePending())
|
|
4320
|
+
this.cancelMove();
|
|
4321
|
+
else if (this.folderDialogOpen())
|
|
2222
4322
|
this.closeFolderDialog();
|
|
2223
4323
|
else if (this.shareItem())
|
|
2224
4324
|
this.closeShare();
|
|
@@ -2237,6 +4337,8 @@ class SdFileExplorer {
|
|
|
2237
4337
|
}
|
|
2238
4338
|
// ---- Internals: folders ----
|
|
2239
4339
|
#resetNavigation() {
|
|
4340
|
+
this.#clearSelection();
|
|
4341
|
+
this.#closeCommands();
|
|
2240
4342
|
for (const controller of this.#listControllers.values())
|
|
2241
4343
|
controller.abort();
|
|
2242
4344
|
this.#listControllers.clear();
|
|
@@ -2265,7 +4367,7 @@ class SdFileExplorer {
|
|
|
2265
4367
|
const previous = this.#folders().get(parentId);
|
|
2266
4368
|
this.#setFolder(parentId, { status: 'loading', items: previous?.loaded ? previous.items : [], loaded: !!previous?.loaded });
|
|
2267
4369
|
try {
|
|
2268
|
-
const items = await this
|
|
4370
|
+
const items = await this.#config().list({ parentId, signal: controller.signal });
|
|
2269
4371
|
if (controller.signal.aborted || this.#destroyed)
|
|
2270
4372
|
return;
|
|
2271
4373
|
this.#setFolder(parentId, { status: 'loaded', items: Array.isArray(items) ? items : [], loaded: true });
|
|
@@ -2310,7 +4412,7 @@ class SdFileExplorer {
|
|
|
2310
4412
|
this.#searchController?.abort();
|
|
2311
4413
|
this.#searchController = null;
|
|
2312
4414
|
const keyword = this.#trimmedKeyword();
|
|
2313
|
-
const search = this
|
|
4415
|
+
const search = this.#config().search;
|
|
2314
4416
|
if (!keyword || !search) {
|
|
2315
4417
|
this.#search.set(null);
|
|
2316
4418
|
return;
|
|
@@ -2324,19 +4426,19 @@ class SdFileExplorer {
|
|
|
2324
4426
|
}
|
|
2325
4427
|
async #runSearch(keyword, parentId) {
|
|
2326
4428
|
this.#searchTimer = null;
|
|
2327
|
-
const search = this
|
|
4429
|
+
const search = this.#config().search;
|
|
2328
4430
|
if (!search)
|
|
2329
4431
|
return;
|
|
2330
4432
|
const controller = new AbortController();
|
|
2331
4433
|
this.#searchController = controller;
|
|
2332
4434
|
try {
|
|
2333
4435
|
const items = await search({ parentId, keyword, signal: controller.signal });
|
|
2334
|
-
if (controller.signal.aborted || this.#destroyed)
|
|
4436
|
+
if (controller.signal.aborted || this.#destroyed || this.#config().search !== search)
|
|
2335
4437
|
return;
|
|
2336
4438
|
this.#search.set({ keyword, parentId, status: 'loaded', items: Array.isArray(items) ? items : [] });
|
|
2337
4439
|
}
|
|
2338
4440
|
catch (error) {
|
|
2339
|
-
if (controller.signal.aborted || this.#destroyed)
|
|
4441
|
+
if (controller.signal.aborted || this.#destroyed || this.#config().search !== search)
|
|
2340
4442
|
return;
|
|
2341
4443
|
this.#search.set({ keyword, parentId, status: 'error', items: [], error });
|
|
2342
4444
|
}
|
|
@@ -2346,6 +4448,10 @@ class SdFileExplorer {
|
|
|
2346
4448
|
}
|
|
2347
4449
|
}
|
|
2348
4450
|
#clearSearch() {
|
|
4451
|
+
if (this.#trimmedKeyword()) {
|
|
4452
|
+
this.#clearSelection();
|
|
4453
|
+
this.#closeCommands();
|
|
4454
|
+
}
|
|
2349
4455
|
this.keyword.set('');
|
|
2350
4456
|
this.#scheduleSearch(false);
|
|
2351
4457
|
}
|
|
@@ -2354,9 +4460,9 @@ class SdFileExplorer {
|
|
|
2354
4460
|
this.#releasePreview();
|
|
2355
4461
|
const kind = sdFileExplorerPreviewKind(sdFileExplorerFileType(item));
|
|
2356
4462
|
const fallback = () => kind === 'image' && item.thumbnailUrl ? { status: 'image', url: item.thumbnailUrl } : { status: 'unavailable' };
|
|
2357
|
-
const preview = this
|
|
4463
|
+
const preview = this.#config().preview;
|
|
2358
4464
|
// why: định dạng không có renderer thì KHÔNG gọi callback — tránh tải cả file chỉ để hiện fallback.
|
|
2359
|
-
if (kind === 'none' || !preview) {
|
|
4465
|
+
if (kind === 'none' || !preview || !sdFileExplorerEligible(this.#config().previewable, item)) {
|
|
2360
4466
|
this.previewState.set(kind === 'none' ? { status: 'unavailable' } : fallback());
|
|
2361
4467
|
return;
|
|
2362
4468
|
}
|
|
@@ -2373,6 +4479,10 @@ class SdFileExplorer {
|
|
|
2373
4479
|
else if (kind === 'pdf') {
|
|
2374
4480
|
this.previewState.set({ status: 'pdf', source });
|
|
2375
4481
|
}
|
|
4482
|
+
else if (kind === 'video') {
|
|
4483
|
+
// why: sd-preview-video owns the object URL of a Blob and refuses unsafe URL schemes itself.
|
|
4484
|
+
this.previewState.set({ status: 'video', source });
|
|
4485
|
+
}
|
|
2376
4486
|
else if (typeof source === 'string') {
|
|
2377
4487
|
this.previewState.set({ status: 'image', url: source });
|
|
2378
4488
|
}
|
|
@@ -2502,7 +4612,11 @@ class SdFileExplorer {
|
|
|
2502
4612
|
// ---- Internals: DOM helpers ----
|
|
2503
4613
|
#acceptsDrag(event) {
|
|
2504
4614
|
const types = event.dataTransfer?.types;
|
|
2505
|
-
return this.canUpload() &&
|
|
4615
|
+
return (this.canUpload() &&
|
|
4616
|
+
!this.uploadDisabled() &&
|
|
4617
|
+
!!types &&
|
|
4618
|
+
!Array.from(types).includes(SD_FILE_EXPLORER_MOVE_MIME) &&
|
|
4619
|
+
Array.from(types).includes('Files'));
|
|
2506
4620
|
}
|
|
2507
4621
|
#droppedFiles(transfer) {
|
|
2508
4622
|
if (!transfer)
|
|
@@ -2529,6 +4643,10 @@ class SdFileExplorer {
|
|
|
2529
4643
|
}
|
|
2530
4644
|
#teardown() {
|
|
2531
4645
|
this.#destroyed = true;
|
|
4646
|
+
this.#moveController?.abort();
|
|
4647
|
+
this.#moveDrag.clear();
|
|
4648
|
+
// A command pressed right before the explorer goes away never runs; sd-side-drawer releases its own scroll lock.
|
|
4649
|
+
this.#pendingCommand = null;
|
|
2532
4650
|
this.#resizeObserver?.disconnect();
|
|
2533
4651
|
for (const controller of this.#listControllers.values())
|
|
2534
4652
|
controller.abort();
|
|
@@ -2547,16 +4665,22 @@ class SdFileExplorer {
|
|
|
2547
4665
|
this.#shareController?.abort();
|
|
2548
4666
|
}
|
|
2549
4667
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdFileExplorer, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2550
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", 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%, #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%, #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%, #ffffff));--sd-fe-border: var(--sd-file-explorer-border, color-mix(in srgb, var(--sd-border, #c4c6d0) 55%, #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%, #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:14px;line-height: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%,#ffffff);color:var(--sd-fe-accent)}.brand-text{min-width:0}.brand-title{margin:0;overflow:hidden;font-size:16px;font-weight:600;line-height:22px;text-overflow:ellipsis;white-space:nowrap}.brand-description{margin:0;overflow:hidden;font-size:12px;line-height: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:999px;background:var(--sd-fe-muted-surface);transition:border-color .12s ease,box-shadow .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: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: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:12px;font-weight:700;line-height: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:15px;font-weight:600}.view-toggle{flex:none;display:flex;gap:2px;padding:2px;border:1px solid var(--sd-fe-border);border-radius: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: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:2px solid var(--sd-fe-accent);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:18px;font-weight:700;line-height:26px;text-overflow:ellipsis;white-space:nowrap}.count{flex:none;padding-bottom:12px;font-size: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:16px;font-weight: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:600;line-height:24px}.field-label{font-size:13px;color:var(--sd-fe-text-secondary)}.field-input{height:40px;padding:0 12px;border:1px solid var(--sd-fe-border-strong);border-radius:8px;background:var(--sd-fe-surface);color:var(--sd-fe-text);font:inherit;font-size: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: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:14px;color:var(--sd-fe-text-secondary)}.share-feedback{min-height:18px;margin:0;font-size:13px;line-height: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 .2s ease,visibility .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: "pipe", type: SdTranslatePipe, name: "sdTranslate" }, { 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", "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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
4668
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.21", 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: "pipe", type: SdTranslatePipe, name: "sdTranslate" }, { 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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2551
4669
|
}
|
|
2552
4670
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImport: i0, type: SdFileExplorer, decorators: [{
|
|
2553
4671
|
type: Component,
|
|
2554
4672
|
args: [{ selector: 'sd-file-explorer', standalone: true, imports: [
|
|
4673
|
+
A11yModule,
|
|
4674
|
+
MatTooltip,
|
|
2555
4675
|
SdIcon,
|
|
2556
4676
|
SdTranslatePipe,
|
|
2557
4677
|
SdBreadcrumb,
|
|
2558
4678
|
SdButton,
|
|
4679
|
+
SdInform,
|
|
4680
|
+
SdInformActionDirective,
|
|
2559
4681
|
SdDataState,
|
|
4682
|
+
SdFileExplorerActions,
|
|
4683
|
+
SdFileExplorerCommandSheet,
|
|
2560
4684
|
SdFileExplorerFolderTree,
|
|
2561
4685
|
SdFileExplorerItemList,
|
|
2562
4686
|
SdFileExplorerPreviewPanel,
|
|
@@ -2564,19 +4688,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.21", ngImpo
|
|
|
2564
4688
|
], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
2565
4689
|
class: 'sd-file-explorer',
|
|
2566
4690
|
'[class.sd-file-explorer--compact]': 'compact()',
|
|
4691
|
+
'[class.sd-file-explorer--touch]': 'touch()',
|
|
2567
4692
|
'[class.sd-file-explorer--dragging]': 'dragActive()',
|
|
2568
4693
|
'[attr.data-autoid]': 'autoId()',
|
|
2569
4694
|
'(dragenter)': 'onDragEnter($event)',
|
|
2570
4695
|
'(dragover)': 'onDragOver($event)',
|
|
2571
4696
|
'(dragleave)': 'onDragLeave()',
|
|
2572
4697
|
'(drop)': 'onDrop($event)',
|
|
4698
|
+
'(dragstart)': 'onMoveDragStart($event)',
|
|
4699
|
+
'(dragend)': 'onMoveDragEnd()',
|
|
2573
4700
|
'(keydown.escape)': 'onEscape($event)',
|
|
2574
|
-
}, 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%, #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%, #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%, #ffffff));--sd-fe-border: var(--sd-file-explorer-border, color-mix(in srgb, var(--sd-border, #c4c6d0) 55%, #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%, #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:14px;line-height: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%,#ffffff);color:var(--sd-fe-accent)}.brand-text{min-width:0}.brand-title{margin:0;overflow:hidden;font-size:16px;font-weight:600;line-height:22px;text-overflow:ellipsis;white-space:nowrap}.brand-description{margin:0;overflow:hidden;font-size:12px;line-height: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:999px;background:var(--sd-fe-muted-surface);transition:border-color .12s ease,box-shadow .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: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: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:12px;font-weight:700;line-height: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:15px;font-weight:600}.view-toggle{flex:none;display:flex;gap:2px;padding:2px;border:1px solid var(--sd-fe-border);border-radius: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: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:2px solid var(--sd-fe-accent);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:18px;font-weight:700;line-height:26px;text-overflow:ellipsis;white-space:nowrap}.count{flex:none;padding-bottom:12px;font-size: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:16px;font-weight: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:600;line-height:24px}.field-label{font-size:13px;color:var(--sd-fe-text-secondary)}.field-input{height:40px;padding:0 12px;border:1px solid var(--sd-fe-border-strong);border-radius:8px;background:var(--sd-fe-surface);color:var(--sd-fe-text);font:inherit;font-size: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: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:14px;color:var(--sd-fe-text-secondary)}.share-feedback{min-height:18px;margin:0;font-size:13px;line-height: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 .2s ease,visibility .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"] }]
|
|
4701
|
+
}, template: "@let _option = option();\n@let _compact = compact();\n@let _autoId = autoId();\n@let _canUpload = canUpload();\n@let _canDownload = canDownload();\n@let _view = view();\n@let _state = contentState();\n@let _keyword = keyword();\n@let _sidebarOpen = sidebarOpen();\n@let _preview = previewView();\n@let _transfers = transferViews();\n@let _heading = heading();\n@let _searching = searching();\n@let _collapsed = transfersCollapsed();\n@let _dialogOpen = folderDialogOpen();\n@let _shareItem = shareItem();\n@let _canShare = canShare();\n@let _modalOpen = _dialogOpen || !!_shareItem || !!movePickerItems();\n@let _touch = touch();\n@let _rowShortcuts = rowShortcuts();\n\n<header class=\"header\" [attr.inert]=\"_modalOpen ? '' : null\">\n @if (_option.title) {\n <div class=\"brand\">\n <span class=\"brand-icon\" aria-hidden=\"true\">\n <sd-icon name=\"folder\" size=\"20px\" />\n </span>\n <div class=\"brand-text\">\n <h2 class=\"brand-title\" [title]=\"_option.title\">{{ _option.title }}</h2>\n @if (_option.description) {\n <p class=\"brand-description\">{{ _option.description }}</p>\n }\n </div>\n </div>\n }\n\n <div class=\"search\" role=\"search\">\n <sd-icon class=\"search-icon\" name=\"search\" size=\"20px\" />\n <input\n #searchInput\n type=\"search\"\n class=\"search-input\"\n autocomplete=\"off\"\n [value]=\"_keyword\"\n [placeholder]=\"'core.component.file-explorer.search-placeholder' | sdTranslate\"\n [attr.aria-label]=\"'core.component.file-explorer.search-placeholder' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-search' : null\"\n (input)=\"onKeywordInput(searchInput.value)\" />\n @if (_keyword) {\n <button\n type=\"button\"\n class=\"search-clear\"\n [attr.aria-label]=\"'core.component.file-explorer.search-clear' | sdTranslate\"\n [title]=\"'core.component.file-explorer.search-clear' | sdTranslate\"\n (click)=\"clearSearch()\">\n <sd-icon name=\"close\" size=\"18px\" />\n </button>\n }\n </div>\n\n @if (_canUpload) {\n <sd-button\n class=\"upload-button\"\n [disabled]=\"uploadDisabled()\"\n [attr.aria-description]=\"uploadDisabled() ? ('core.component.file-explorer.action-unavailable' | sdTranslate) : null\"\n type=\"fill\"\n color=\"primary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n prefixIcon=\"file_upload\"\n [title]=\"_compact ? undefined : ('core.component.file-explorer.upload' | sdTranslate)\"\n [tooltip]=\"_compact ? ('core.component.file-explorer.upload' | sdTranslate) : undefined\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-upload' : null\"\n (click)=\"fileInput.click()\" />\n <input\n #fileInput\n type=\"file\"\n class=\"file-input\"\n multiple\n tabindex=\"-1\"\n aria-hidden=\"true\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-file-input' : null\"\n (change)=\"onFilesPicked(fileInput)\" />\n }\n</header>\n\n@if (moveStatus()) {\n <sd-inform class=\"move-status\" color=\"secondary\" [hideIcon]=\"true\" [title]=\"moveStatus()!\">\n @if (moveRefreshError()) {\n <sd-button\n sdInformAction\n class=\"move-retry-button\"\n type=\"light\"\n color=\"primary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n htmlType=\"button\"\n [title]=\"'core.component.file-explorer.move.retry-refresh' | sdTranslate\"\n [disabled]=\"movePending()\"\n (click)=\"retryMoveRefresh()\" />\n }\n </sd-inform>\n}\n\n<!-- why: dialog ph\u1EE7 c\u1EA3 explorer n\u00EAn l\u00E0m inert c\u1EA3 v\u00F9ng n\u00E0y, k\u1EC3 c\u1EA3 drawer chi ti\u1EBFt \u0111ang n\u1EB1m trong .main. -->\n<div class=\"body\" [attr.inert]=\"_modalOpen ? '' : null\">\n @if (_compact && _sidebarOpen) {\n <div class=\"scrim scrim--sidebar\" aria-hidden=\"true\" (click)=\"sidebarOpen.set(false)\"></div>\n }\n <aside\n #sidebar\n class=\"sidebar\"\n [class.sidebar--open]=\"_sidebarOpen\"\n [id]=\"instanceId + '-sidebar'\"\n [attr.aria-label]=\"'core.component.file-explorer.folders' | sdTranslate\"\n [attr.inert]=\"_compact && !_sidebarOpen ? '' : null\">\n <p class=\"sidebar-label\">{{ 'core.component.file-explorer.folders' | sdTranslate }}</p>\n <div class=\"sidebar-tree\">\n <sd-file-explorer-folder-tree\n [nodes]=\"treeNodes()\"\n [moveDropTarget]=\"moveDropTarget()\"\n [label]=\"'core.component.file-explorer.tree-label' | sdTranslate\"\n [commands]=\"_option.folderCommands\"\n [touch]=\"_touch\"\n [compact]=\"_compact\"\n [menuOpenId]=\"treeMenuOpenId()\"\n (select)=\"onTreeSelect($event)\"\n (toggle)=\"onTreeToggle($event)\"\n (retry)=\"onTreeRetry($event)\"\n (openCommands)=\"openCommands($event.item, 'tree', $event.trigger)\" />\n </div>\n @if (canCreateFolder()) {\n <div class=\"sidebar-footer\">\n <sd-button\n #newFolderButton\n class=\"new-folder-button\"\n [disabled]=\"createDisabled()\"\n [attr.aria-description]=\"createDisabled() ? ('core.component.file-explorer.action-unavailable' | sdTranslate) : null\"\n type=\"outline\"\n color=\"secondary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n prefixIcon=\"add\"\n block\n [title]=\"'core.component.file-explorer.new-folder' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-new-folder' : null\"\n (click)=\"openFolderDialog()\" />\n </div>\n }\n </aside>\n\n <!-- why: .main l\u00E0 [container] c\u1EE7a drawer chi ti\u1EBFt \u2014 backdrop ch\u1EC9 ph\u1EE7 v\u00F9ng b\u00EAn ph\u1EA3i, c\u00E2y th\u01B0 m\u1EE5c v\u1EABn d\u00F9ng \u0111\u01B0\u1EE3c.\n Drawer n\u1EB1m TRONG ph\u1EA7n t\u1EED n\u00E0y n\u00EAn inert \u0111\u1EB7t tr\u00EAn t\u1EEBng kh\u1ED1i con, kh\u00F4ng \u0111\u1EB7t tr\u00EAn .main. -->\n <section #mainRegion class=\"main\" [attr.aria-label]=\"_heading\">\n @if (refreshing()) {\n <div class=\"refresh-bar\" aria-hidden=\"true\"></div>\n }\n <div class=\"toolbar\" [attr.inert]=\"_preview ? '' : null\">\n @if (_compact) {\n <button\n type=\"button\"\n class=\"icon-button\"\n [attr.aria-expanded]=\"_sidebarOpen\"\n [attr.aria-controls]=\"instanceId + '-sidebar'\"\n [attr.aria-label]=\"\n (_sidebarOpen ? 'core.component.file-explorer.close-folders' : 'core.component.file-explorer.open-folders') | sdTranslate\n \"\n [attr.data-autoid]=\"_autoId ? _autoId + '-menu' : null\"\n (click)=\"toggleSidebar()\">\n <sd-icon name=\"menu\" size=\"24px\" />\n </button>\n }\n <sd-breadcrumb\n class=\"breadcrumb\"\n [items]=\"breadcrumb().items\"\n [maxItems]=\"_compact ? 3 : 5\"\n [ariaLabel]=\"'core.component.file-explorer.breadcrumb' | sdTranslate\"\n (sdItemActivate)=\"onBreadcrumb($event)\" />\n @if (_state === 'items') {\n <span class=\"count\">{{ itemCountLabel() }}</span>\n }\n <div class=\"view-toggle\" role=\"group\" [attr.aria-label]=\"'core.component.file-explorer.view' | sdTranslate\">\n <button\n type=\"button\"\n class=\"icon-button icon-button--toggle\"\n [class.icon-button--active]=\"_view === 'list'\"\n [attr.aria-pressed]=\"_view === 'list'\"\n [attr.aria-label]=\"'core.component.file-explorer.view-list' | sdTranslate\"\n [title]=\"'core.component.file-explorer.view-list' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-view-list' : null\"\n (click)=\"setView('list')\">\n <sd-icon name=\"format_list_bulleted\" size=\"24px\" />\n </button>\n <button\n type=\"button\"\n class=\"icon-button icon-button--toggle\"\n [class.icon-button--active]=\"_view === 'grid'\"\n [attr.aria-pressed]=\"_view === 'grid'\"\n [attr.aria-label]=\"'core.component.file-explorer.view-grid' | sdTranslate\"\n [title]=\"'core.component.file-explorer.view-grid' | sdTranslate\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-view-grid' : null\"\n (click)=\"setView('grid')\">\n <sd-icon name=\"grid_view\" size=\"24px\" />\n </button>\n </div>\n </div>\n\n @let _selection = selectionView();\n @if (_selection && selectedItems().length) {\n @let _selected = selectedItems();\n @let _selectedCount = _selected.length;\n @let _summary = selectionSummary();\n @let _clearLabel = 'core.component.file-explorer.selection.clear' | sdTranslate;\n <!-- why: one band for list and grid. The select-all checkbox lives in the list header / above the grid, not here. -->\n <div\n class=\"selection\"\n role=\"group\"\n [class.selection--active]=\"_selectedCount > 0\"\n [attr.aria-label]=\"'core.component.file-explorer.selection.label' | sdTranslate\"\n [attr.inert]=\"_preview ? '' : null\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-selection' : null\">\n <div class=\"selection-summary\">\n <!-- why: one plain sentence in the translated word order (\"2 t\u1EC7p \u0111\u00E3 ch\u1ECDn\", \"\u5DF2\u9009\u62E9 2 \u4E2A\u6587\u4EF6\"); only the number is\n heavier. Each part sits in its own span: the markup whitespace between spans is dropped, so the sentence\n keeps exactly the spaces of its translation (\"2\u4EF6\u2026\" stays joined). -->\n <span class=\"selection-status\" role=\"status\">\n <span>{{ _summary.before }}</span>\n @if (_summary.count) {\n <span class=\"selection-count\">{{ _summary.count }}</span>\n }\n <span>{{ _summary.after }}</span>\n </span>\n <button\n type=\"button\"\n class=\"icon-button selection-clear\"\n [disabled]=\"!_selectedCount\"\n [attr.aria-label]=\"_clearLabel\"\n [matTooltip]=\"_clearLabel\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-selection-clear' : null\"\n (click)=\"clearSelection()\">\n <sd-icon name=\"close\" size=\"20px\" />\n </button>\n </div>\n @if (_selectedCount && selectionActions().length) {\n <!-- why: unset types follow the kind (light flat action, text group trigger). sd-button's own sizes: 32 px like the\n row commands, 48 px only on a wide touch layout; a narrow layout keeps 32 px and spaces the lines instead. -->\n <sd-file-explorer-actions\n class=\"selection-actions\"\n source=\"selector.actions\"\n defaultLeafType=\"light\"\n defaultGroupType=\"text\"\n defaultColor=\"primary\"\n [actions]=\"selectionActions()\"\n [context]=\"_selected\"\n [size]=\"_touch && !_compact ? 'lg' : 'sm'\"\n [autoId]=\"_autoId ? _autoId + '-selection-action' : undefined\" />\n }\n </div>\n }\n\n <div class=\"scroller\" [attr.inert]=\"_preview ? '' : null\">\n @switch (_state) {\n @case ('loading') {\n <sd-data-state\n state=\"loading\"\n compact\n [title]=\"(_searching ? 'core.component.file-explorer.search-loading' : 'core.component.file-explorer.loading') | sdTranslate\" />\n }\n @case ('error') {\n <sd-data-state\n state=\"error\"\n retryable\n [title]=\"(_searching ? 'core.component.file-explorer.search-error' : 'core.component.file-explorer.load-error') | sdTranslate\"\n [message]=\"errorMessage()\"\n [retryLabel]=\"'core.component.file-explorer.retry' | sdTranslate\"\n (sdRetry)=\"retryContent()\" />\n }\n @case ('empty') {\n <sd-data-state\n state=\"empty\"\n [icon]=\"_searching ? 'search_off' : 'folder_open'\"\n [title]=\"emptyTitle()\"\n [message]=\"emptyMessage()\" />\n }\n @default {\n <sd-file-explorer-item-list\n [columns]=\"columns()\"\n [moveDropTarget]=\"moveDropTarget()\"\n [canMove]=\"canMove()\"\n [movePending]=\"movePending()\"\n (move)=\"openMovePicker([$event])\"\n [items]=\"itemViews()\"\n [view]=\"_view\"\n [canDownload]=\"_canDownload && _rowShortcuts\"\n [canShare]=\"_canShare && _rowShortcuts\"\n [compact]=\"_compact\"\n [touch]=\"_touch\"\n [activeId]=\"_preview ? _preview.item.id : null\"\n [label]=\"_heading\"\n [selection]=\"_selection\"\n [fileCommands]=\"_option.fileCommands\"\n [folderCommands]=\"_option.folderCommands\"\n [menuOpenId]=\"itemsMenuOpenId()\"\n (activate)=\"onActivate($event)\"\n (download)=\"downloadItem($event.item)\"\n (share)=\"openShare($event.item)\"\n (toggleSelect)=\"toggleSelection($event)\"\n (toggleSelectAll)=\"toggleSelectAll()\"\n (openCommands)=\"openCommands($event.item, _view, $event.trigger)\" />\n }\n }\n </div>\n </section>\n</div>\n\n@if (_transfers.length) {\n <sd-file-explorer-transfer-panel\n class=\"transfers\"\n [attr.inert]=\"_modalOpen ? '' : null\"\n [transfers]=\"_transfers\"\n [title]=\"transfersTitle()\"\n [collapsed]=\"_collapsed\"\n [canClear]=\"canClearTransfers()\"\n [compact]=\"_compact\"\n [autoId]=\"_autoId ? _autoId + '-transfers' : undefined\"\n (toggleCollapsed)=\"transfersCollapsed.set(!_collapsed)\"\n (clear)=\"clearFinishedTransfers()\"\n (cancel)=\"cancelTransfer($event)\"\n (retry)=\"retryTransfer($event)\"\n (dismiss)=\"dismissTransfer($event)\" />\n}\n\n<!-- why: chi ti\u1EBFt file l\u00E0 sd-side-drawer th\u1EADt, m\u1EDF g\u1ECDn trong v\u00F9ng danh s\u00E1ch b\u00EAn ph\u1EA3i nh\u1EDD [container]:\n header (t\u00ECm ki\u1EBFm, t\u1EA3i l\u00EAn), c\u00E2y th\u01B0 m\u1EE5c v\u00E0 h\u00E0ng ch\u1EDD truy\u1EC1n t\u1EA3i v\u1EABn d\u00F9ng \u0111\u01B0\u1EE3c khi drawer m\u1EDF. -->\n<sd-file-explorer-preview-panel\n [view]=\"_preview\"\n [compact]=\"_compact\"\n [state]=\"previewState()\"\n [meta]=\"previewMeta()\"\n [canDownload]=\"_canDownload\"\n [canShare]=\"_canShare\"\n [container]=\"mainRegion\"\n [autoId]=\"_autoId ? _autoId + '-preview' : undefined\"\n (close)=\"closePreview()\"\n (download)=\"downloadPreview()\"\n (share)=\"sharePreview()\"\n (retry)=\"retryPreview()\"\n (imageError)=\"onPreviewImageError()\" />\n\n<!-- why: l\u1EC7nh c\u1EE7a m\u1ED9t m\u1EE5c tr\u00EAn layout h\u1EB9p m\u1EDF trong sd-side-drawer th\u1EADt c\u1EE7a Core (g\u1EAFn v\u00E0o <body>: backdrop, Esc, b\u1EABy focus,\n kho\u00E1 scroll trang) thay cho c\u00E1c n\u00FAt tr\u00EAn h\u00E0ng / th\u1EBB / n\u00FAt c\u00E2y. -->\n<sd-file-explorer-command-sheet\n [sheet]=\"commandSheet()\"\n [touch]=\"_touch\"\n [autoId]=\"_autoId ? _autoId + '-commands' : undefined\"\n (activate)=\"runCommand($event)\"\n (close)=\"onCommandsClosed()\" />\n\n@if (dragActive()) {\n <div class=\"drop-overlay\" aria-hidden=\"true\">\n <div class=\"drop-card\">\n <sd-icon name=\"file_upload\" size=\"40px\" />\n <p class=\"drop-title\">{{ dropTitle() }}</p>\n </div>\n </div>\n}\n\n@if (_dialogOpen) {\n @let _folderName = folderName();\n @let _folderError = folderError();\n <div class=\"dialog-backdrop\" aria-hidden=\"true\" (click)=\"closeFolderDialog()\"></div>\n <form\n class=\"dialog\"\n role=\"dialog\"\n aria-modal=\"true\"\n novalidate\n [attr.aria-labelledby]=\"instanceId + '-folder-title'\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-folder-dialog' : null\"\n (submit)=\"submitFolder($event)\">\n <h3 class=\"dialog-title\" [id]=\"instanceId + '-folder-title'\">{{ folderDialogTitle() }}</h3>\n <label class=\"field-label\" [for]=\"instanceId + '-folder-name'\">{{\n 'core.component.file-explorer.new-folder-name' | sdTranslate\n }}</label>\n <input\n #folderInput\n class=\"field-input\"\n autocomplete=\"off\"\n maxlength=\"255\"\n [id]=\"instanceId + '-folder-name'\"\n [value]=\"_folderName\"\n [attr.aria-invalid]=\"_folderError ? true : null\"\n [attr.aria-describedby]=\"_folderError ? instanceId + '-folder-error' : null\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-folder-name' : null\"\n (input)=\"folderName.set(folderInput.value)\" />\n @if (_folderError) {\n <sd-inform class=\"field-error\" color=\"error\" [hideIcon]=\"true\" [id]=\"instanceId + '-folder-error'\" [title]=\"_folderError\" />\n }\n <div class=\"dialog-actions\">\n <sd-button\n class=\"cancel-button\"\n type=\"text\"\n color=\"secondary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n [title]=\"'core.component.file-explorer.cancel' | sdTranslate\"\n (click)=\"closeFolderDialog()\" />\n <sd-button\n class=\"submit-button\"\n type=\"fill\"\n color=\"primary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n htmlType=\"submit\"\n [title]=\"'core.component.file-explorer.create' | sdTranslate\"\n [disabled]=\"!_folderName.trim()\"\n [loading]=\"folderSubmitting()\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-folder-submit' : null\" />\n </div>\n </form>\n}\n\n@if (movePickerItems()) {\n <div class=\"dialog-backdrop\" aria-hidden=\"true\" (click)=\"closeMovePicker()\"></div>\n <section\n class=\"dialog move-picker\"\n role=\"dialog\"\n aria-modal=\"true\"\n cdkTrapFocus\n [cdkTrapFocusAutoCapture]=\"true\"\n (keydown.tab)=\"$event.stopPropagation()\"\n (keydown.shift.tab)=\"$event.stopPropagation()\"\n [attr.aria-labelledby]=\"instanceId + '-move-title'\">\n <h3 cdkFocusInitial tabindex=\"-1\" [id]=\"instanceId + '-move-title'\">{{ 'core.component.file-explorer.move.to' | sdTranslate }}</h3>\n <sd-file-explorer-folder-tree\n [nodes]=\"movePickerNodes()\"\n [label]=\"'core.component.file-explorer.folders' | sdTranslate\"\n [touch]=\"_touch\"\n [compact]=\"false\"\n (select)=\"moveTarget.set($event.item)\"\n (toggle)=\"onTreeToggle($event)\"\n (retry)=\"onTreeRetry($event)\" />\n @if (!canSubmitMove() && !movePending()) {\n <sd-inform\n class=\"field-error move-destination-tip\"\n type=\"tip\"\n color=\"secondary\"\n [hideIcon]=\"true\"\n [title]=\"'core.component.file-explorer.move.destination-tip' | sdTranslate\" />\n }\n <div class=\"dialog-actions\">\n <sd-button\n class=\"move-cancel-button\"\n type=\"text\"\n color=\"secondary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n htmlType=\"button\"\n [title]=\"'core.component.file-explorer.cancel' | sdTranslate\"\n (click)=\"closeMovePicker()\" />\n <sd-button\n class=\"move-submit-button\"\n type=\"fill\"\n color=\"primary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n htmlType=\"button\"\n [title]=\"'core.component.file-explorer.move.confirm' | sdTranslate\"\n [disabled]=\"!canSubmitMove()\"\n (click)=\"submitMoveFromEvent($event)\" />\n </div>\n </section>\n}\n\n@if (_shareItem) {\n @let _shareState = shareState();\n <div class=\"dialog-backdrop\" aria-hidden=\"true\" (click)=\"closeShare()\"></div>\n <div\n #shareDialog\n class=\"dialog\"\n role=\"dialog\"\n aria-modal=\"true\"\n tabindex=\"-1\"\n [attr.aria-labelledby]=\"instanceId + '-share-title'\"\n [attr.aria-busy]=\"_shareState.status === 'loading' ? true : null\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-share-dialog' : null\">\n <h3 class=\"dialog-title\" [id]=\"instanceId + '-share-title'\" [title]=\"_shareItem.name\">{{ shareTitle() }}</h3>\n @switch (_shareState.status) {\n @case ('loading') {\n <p class=\"share-status\" role=\"status\">\n <span class=\"spinner\" aria-hidden=\"true\"></span>\n {{ 'core.component.file-explorer.share.loading' | sdTranslate }}\n </p>\n }\n @case ('error') {\n <sd-inform class=\"field-error\" color=\"error\" [hideIcon]=\"true\" [title]=\"_shareState.message\" />\n }\n @case ('ready') {\n <label class=\"field-label\" [for]=\"instanceId + '-share-link'\">{{ 'core.component.file-explorer.share.link' | sdTranslate }}</label>\n <input\n #shareInput\n class=\"field-input\"\n readonly\n [id]=\"instanceId + '-share-link'\"\n [value]=\"_shareState.url\"\n [attr.aria-describedby]=\"instanceId + '-share-feedback'\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-share-link' : null\"\n (focus)=\"shareInput.select()\" />\n <p class=\"share-feedback\" role=\"status\" aria-live=\"polite\" [id]=\"instanceId + '-share-feedback'\">{{ shareFeedbackLabel() }}</p>\n }\n }\n <div class=\"dialog-actions\">\n <sd-button\n class=\"close-button\"\n type=\"text\"\n color=\"secondary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n [title]=\"'core.component.file-explorer.close' | sdTranslate\"\n (click)=\"closeShare()\" />\n @if (_shareState.status === 'error') {\n <sd-button\n class=\"retry-button\"\n type=\"outline\"\n color=\"primary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n prefixIcon=\"refresh\"\n [title]=\"'core.component.file-explorer.retry' | sdTranslate\"\n (click)=\"retryShare()\" />\n } @else {\n <sd-button\n #copyButton\n class=\"copy-button\"\n type=\"fill\"\n color=\"primary\"\n [size]=\"_compact ? 'sm' : 'md'\"\n prefixIcon=\"content_copy\"\n [title]=\"\n (shareFeedback() === 'copied' ? 'core.component.file-explorer.share.copied' : 'core.component.file-explorer.share.copy')\n | sdTranslate\n \"\n [disabled]=\"_shareState.status !== 'ready'\"\n [attr.data-autoid]=\"_autoId ? _autoId + '-share-copy' : null\"\n (click)=\"copyShareLink()\" />\n }\n </div>\n </div>\n}\n", styles: [":host{--sd-fe-accent: var(--sd-file-explorer-accent, var(--sd-primary, #005cbb));--sd-fe-accent-strong: var( --sd-file-explorer-accent-strong, color-mix(in srgb, var(--sd-fe-accent) 84%, var(--sd-file-explorer-mix-shade, #000000)) );--sd-fe-accent-contrast: var(--sd-file-explorer-accent-contrast, var(--sd-primary-contrast, #ffffff));--sd-fe-accent-soft: var( --sd-file-explorer-accent-soft, color-mix(in srgb, var(--sd-fe-accent) 10%, var(--sd-file-explorer-mix-tint, var(--sd-fe-surface))) );--sd-fe-surface: var(--sd-file-explorer-surface, var(--sd-surface, #ffffff));--sd-fe-sidebar-bg: var(--sd-file-explorer-sidebar-bg, color-mix(in srgb, var(--sd-surface-muted, #e7e8ed) 26%, var(--sd-fe-surface)));--sd-fe-muted-surface: var( --sd-file-explorer-muted-surface, color-mix(in srgb, var(--sd-surface-muted, #e7e8ed) 50%, var(--sd-fe-surface)) );--sd-fe-preview-bg: var( --sd-file-explorer-preview-bg, color-mix(in srgb, var(--sd-fe-accent) 9%, var(--sd-file-explorer-mix-tint, var(--sd-fe-surface))) );--sd-fe-border: var( --sd-file-explorer-border, color-mix(in srgb, var(--sd-border, #c4c6d0) 55%, var(--sd-file-explorer-mix-tint, var(--sd-fe-surface))) );--sd-fe-border-strong: var(--sd-file-explorer-border-strong, var(--sd-border, #c4c6d0));--sd-fe-text: var(--sd-file-explorer-text, var(--sd-text, #1a1b1f));--sd-fe-text-secondary: var( --sd-file-explorer-text-secondary, color-mix(in srgb, var(--sd-text-secondary, #44474f) 84%, var(--sd-file-explorer-mix-tint, var(--sd-fe-surface))) );--sd-fe-hover: color-mix(in srgb, var(--sd-fe-text) 4%, transparent);--sd-fe-hover-strong: color-mix(in srgb, var(--sd-fe-text) 8%, transparent);--sd-fe-track: color-mix(in srgb, var(--sd-fe-text) 7%, var(--sd-fe-surface));--sd-fe-success: var(--sd-file-explorer-success, var(--sd-success, #2e7d32));--sd-fe-error: var(--sd-file-explorer-error, var(--sd-error, #ba1a1a));--sd-fe-radius: var(--sd-file-explorer-radius, 16px);--sd-fe-scrim: var(--sd-file-explorer-scrim, rgba(0, 0, 0, .4));--sd-side-drawer-contained-z-index: 9;position:relative;display:flex;flex-direction:column;height:100%;min-height:480px;overflow:hidden;border:1px solid var(--sd-fe-border);border-radius:var(--sd-fe-radius);background:var(--sd-fe-surface);color:var(--sd-fe-text);font-size:var(--sd-font-size-14, 14px);line-height:var(--sd-line-height-20, 20px)}.header{display:grid;grid-template-columns:fit-content(320px) minmax(0,1fr) auto;align-items:center;gap:12px 20px;padding:16px 20px;border-bottom:1px solid var(--sd-fe-border)}.brand{grid-column:1;display:flex;align-items:center;gap:10px;min-width:0}.brand-icon{flex:none;display:grid;place-items:center;width:32px;height:32px;border-radius:50%;background:color-mix(in srgb,var(--sd-fe-accent) 14%,var(--sd-file-explorer-mix-tint, var(--sd-fe-surface)));color:var(--sd-fe-accent)}.brand-text{min-width:0}.brand-title{margin:0;overflow:hidden;font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-semibold, 600);line-height:var(--sd-line-height-22, 22px);text-overflow:ellipsis;white-space:nowrap}.brand-description{margin:0;overflow:hidden;font-size:var(--sd-font-size-12, 12px);line-height:var(--sd-line-height-16, 16px);color:var(--sd-fe-text-secondary);text-overflow:ellipsis;white-space:nowrap}.search{grid-column:2;justify-self:center;display:flex;align-items:center;gap:8px;width:100%;max-width:520px;height:36px;padding:0 6px 0 12px;border:1px solid var(--sd-fe-border);border-radius:var(--sd-radius-999, 999px);background:var(--sd-fe-muted-surface);transition:border-color var(--sd-duration-fast, .12s) ease,box-shadow var(--sd-duration-fast, .12s) ease}.search:focus-within{border-color:var(--sd-fe-accent);background:var(--sd-fe-surface);box-shadow:0 0 0 3px var(--sd-fe-accent-soft)}.search-icon{flex:none;color:var(--sd-fe-text-secondary)}.search-input{flex:1;min-width:0;height:100%;padding:0;border:0;outline:none;background:transparent;color:var(--sd-fe-text);font:inherit;font-size:var(--sd-font-size-14, 14px)}.search-input::placeholder{color:var(--sd-fe-text-secondary)}.search-input::-webkit-search-cancel-button{display:none}.search-clear{flex:none;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;border:0;border-radius:var(--sd-radius-999, 999px);background:transparent;color:var(--sd-fe-text-secondary);cursor:pointer}.search-clear:hover{background:var(--sd-fe-hover-strong)}.upload-button{grid-column:3;justify-self:end}.file-input{display:none}.body{position:relative;flex:1;min-height:0;display:grid;grid-template-columns:238px minmax(0,1fr)}.sidebar{display:flex;flex-direction:column;min-height:0;padding:22px 14px 32px 12px;border-right:1px solid var(--sd-fe-border);background:var(--sd-fe-sidebar-bg)}.sidebar-label{margin:0 0 6px 10px;font-size:var(--sd-font-size-12, 12px);font-weight:var(--sd-font-weight-bold, 700);line-height:var(--sd-line-height-16, 16px);letter-spacing:.04em;text-transform:uppercase;color:var(--sd-fe-text-secondary)}.sidebar-tree{flex:1;min-height:0;margin:0 -4px;padding:2px 4px;overflow-y:auto}.sidebar-footer{margin:12px 4px 0;padding-top:18px;border-top:1px solid var(--sd-fe-border)}.new-folder-button{display:block}.main{position:relative;display:flex;flex-direction:column;min-width:0;min-height:0;padding-top:14px}.refresh-bar{position:absolute;top:0;left:0;right:0;height:2px;overflow:hidden;background:var(--sd-fe-accent-soft)}.refresh-bar:after{content:\"\";position:absolute;top:0;bottom:0;width:30%;background:var(--sd-fe-accent);animation:sd-file-explorer-refresh 1.2s ease-in-out infinite}.toolbar{display:flex;align-items:center;gap:12px;min-height:40px;padding:0 32px}.breadcrumb{flex:1;min-width:0;margin-left:-4px;font-size:var(--sd-font-size-15, 15px);font-weight:var(--sd-font-weight-semibold, 600)}.view-toggle{flex:none;display:flex;gap:2px;padding:2px;border:1px solid var(--sd-fe-border);border-radius:var(--sd-radius-999, 999px);background:var(--sd-fe-surface)}.icon-button{flex:none;display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;padding:0;border:0;border-radius:var(--sd-radius-999, 999px);background:transparent;color:var(--sd-fe-text-secondary);cursor:pointer}.icon-button:hover{background:var(--sd-fe-hover-strong);color:var(--sd-fe-text)}.icon-button:focus-visible{outline:var(--sd-focus-ring-width, 2px) solid var(--sd-file-explorer-accent, var(--sd-focus-ring-color, var(--sd-primary)));outline-offset:1px}.icon-button--toggle{width:40px;height:32px}.icon-button--active,.icon-button--active:hover{background:var(--sd-fe-accent-soft);color:var(--sd-fe-accent)}.count{flex:none;font-size:var(--sd-font-size-13, 13px);color:var(--sd-fe-text-secondary)}.selection{flex:none;display:flex;flex-wrap:wrap;align-items:center;gap:8px 16px;margin:10px 28px 0;padding:6px 8px 6px 10px;border:1px solid var(--sd-fe-border);border-radius:var(--sd-radius-12, 12px);background:var(--sd-file-explorer-muted-surface, color-mix(in srgb, var(--sd-surface-muted, #e7e8ed) 50%, var(--sd-file-explorer-mix-tint, var(--sd-fe-surface))))}.selection-summary{display:flex;align-items:center;gap:4px;min-width:0}.selection-status{min-width:0;color:var(--sd-fe-text);font-size:var(--sd-font-size-14, 14px);font-weight:var(--sd-font-weight-regular, 400);line-height:var(--sd-line-height-20, 20px);overflow-wrap:anywhere}.selection-count{font-weight:var(--sd-font-weight-semibold, 600)}.icon-button.selection-clear{width:32px;height:32px}.icon-button.selection-clear:disabled{cursor:default;opacity:.45}.icon-button.selection-clear:disabled:hover{background:transparent}:host(.sd-file-explorer--touch) .icon-button.selection-clear{width:var(--sd-space-48, 48px);height:var(--sd-space-48, 48px)}.selection-actions{flex:0 1 auto;justify-content:flex-end;gap:16px 8px;margin-inline-start:auto}.selection-actions:empty{display:none}:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-success.c-light,:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-success.c-text{color:var(--sd-status-success-fg, var(--sd-success-dark))}:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-success.c-light .mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic circle,:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-success.c-text .mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic circle{stroke:var(--sd-status-success-fg, var(--sd-success-dark))!important}:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-warning.c-light,:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-warning.c-text{color:var(--sd-status-warning-fg, var(--sd-warning-dark))}:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-warning.c-light .mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic circle,:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-warning.c-text .mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic circle{stroke:var(--sd-status-warning-fg, var(--sd-warning-dark))!important}:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-primary.c-text{--mat-text-button-state-layer-color: var(--sd-file-explorer-mix-tint, var(--sd-fe-surface));--mat-button-text-state-layer-color: var(--mat-text-button-state-layer-color)}:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-success.c-text{--mat-text-button-state-layer-color: var(--sd-file-explorer-mix-tint, var(--sd-fe-surface));--mat-button-text-state-layer-color: var(--mat-text-button-state-layer-color)}:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-info.c-text{--mat-text-button-state-layer-color: var(--sd-file-explorer-mix-tint, var(--sd-fe-surface));--mat-button-text-state-layer-color: var(--mat-text-button-state-layer-color)}:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-warning.c-text{--mat-text-button-state-layer-color: var(--sd-file-explorer-mix-tint, var(--sd-fe-surface));--mat-button-text-state-layer-color: var(--mat-text-button-state-layer-color)}:host .selection-actions ::ng-deep sd-button>button.c-button:not([disabled]).mat-error.c-text{--mat-text-button-state-layer-color: var(--sd-file-explorer-mix-tint, var(--sd-fe-surface));--mat-button-text-state-layer-color: var(--mat-text-button-state-layer-color)}.scroller{flex:1;min-height:0;padding:8px 28px 16px;overflow-y:auto}.scrim{position:absolute;inset:0;background:var(--sd-fe-scrim);animation:sd-file-explorer-fade .18s ease}.transfers{flex:none;border-top:1px solid var(--sd-fe-border);background:var(--sd-fe-surface)}.drop-overlay{position:absolute;inset:0;z-index:10;display:flex;align-items:center;justify-content:center;padding:16px;border:2px dashed var(--sd-fe-accent);border-radius:var(--sd-fe-radius);background:color-mix(in srgb,var(--sd-fe-accent) 8%,color-mix(in srgb,var(--sd-fe-surface) 86%,transparent));pointer-events:none}.drop-card{display:flex;flex-direction:column;align-items:center;gap:10px;color:var(--sd-fe-accent);text-align:center}.drop-title{margin:0;font-size:var(--sd-font-size-16, 16px);font-weight:var(--sd-font-weight-semibold, 600)}.dialog-backdrop{position:absolute;inset:0;z-index:20;background:var(--sd-fe-scrim)}.dialog{position:absolute;top:50%;left:50%;z-index:21;display:flex;flex-direction:column;gap:8px;width:min(400px,100% - 32px);padding:20px;border-radius:14px;background:var(--sd-fe-surface);box-shadow:0 18px 48px #0f172a2e;transform:translate(-50%,-50%)}.dialog:focus{outline:none}.dialog-title{margin:0 0 8px;font-size:17px;font-weight:var(--sd-font-weight-semibold, 600);line-height:var(--sd-line-height-24, 24px)}.field-label{font-size:var(--sd-font-size-13, 13px);color:var(--sd-fe-text-secondary)}.field-input{height:40px;padding:0 12px;border:1px solid var(--sd-fe-border-strong);border-radius:var(--sd-radius-8, 8px);background:var(--sd-fe-surface);color:var(--sd-fe-text);font:inherit;font-size:var(--sd-font-size-15, 15px);outline:none}.field-input:focus{border-color:var(--sd-fe-accent);box-shadow:0 0 0 3px var(--sd-fe-accent-soft)}.field-input[aria-invalid=true]{border-color:var(--sd-fe-error)}.field-error{margin:0;font-size:var(--sd-font-size-13, 13px);color:var(--sd-fe-error)}.dialog-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:12px}.share-status{display:flex;align-items:center;gap:10px;margin:4px 0;font-size:var(--sd-font-size-14, 14px);color:var(--sd-fe-text-secondary)}.share-feedback{min-height:18px;margin:0;font-size:var(--sd-font-size-13, 13px);line-height:var(--sd-line-height-18, 18px);color:var(--sd-fe-success)}.spinner{flex:none;width:18px;height:18px;border:2px solid color-mix(in srgb,var(--sd-fe-accent) 20%,transparent);border-top-color:var(--sd-fe-accent);border-radius:50%;animation:sd-file-explorer-spin .8s linear infinite}:host(.sd-file-explorer--compact) .header{grid-template-columns:minmax(0,1fr) auto;gap:10px 12px;padding:12px 14px}:host(.sd-file-explorer--compact) .brand{grid-row:1;gap:10px}:host(.sd-file-explorer--compact) .upload-button{grid-column:2;grid-row:1}:host(.sd-file-explorer--compact) .search{grid-column:1/-1;grid-row:2;max-width:none}:host(.sd-file-explorer--compact) .header:not(:has(.brand)) .search{grid-column:1;grid-row:1}:host(.sd-file-explorer--compact) .body{grid-template-columns:minmax(0,1fr)}:host(.sd-file-explorer--compact) .sidebar{position:absolute;top:0;bottom:0;left:0;z-index:5;width:min(300px,86%);border-right:1px solid var(--sd-fe-border);box-shadow:12px 0 32px #0f172a1f;visibility:hidden;transform:translate(-100%);transition:transform var(--sd-duration-base, .2s) ease,visibility var(--sd-duration-base, .2s)}:host(.sd-file-explorer--compact) .sidebar--open{visibility:visible;transform:none}:host(.sd-file-explorer--compact) .scrim--sidebar{z-index:4}:host(.sd-file-explorer--compact) .main{padding-top:8px}:host(.sd-file-explorer--compact) .toolbar{gap:6px;min-height:36px;padding:0 12px 0 10px}:host(.sd-file-explorer--compact) .breadcrumb{margin-left:0}:host(.sd-file-explorer--compact) .icon-button--toggle{width:36px}:host(.sd-file-explorer--compact) .heading-row{margin-top:13px;padding:0 14px}:host(.sd-file-explorer--compact) .count{padding-bottom:8px}:host(.sd-file-explorer--compact) .selection{margin:8px 12px 4px}:host(.sd-file-explorer--compact) .selection-summary{flex:1 1 100%;justify-content:space-between}:host(.sd-file-explorer--compact) .selection-actions{flex-basis:100%;justify-content:flex-start;margin-inline-start:0;padding-top:8px;border-top:1px solid var(--sd-fe-border)}:host(.sd-file-explorer--compact) .scroller{padding:0 12px 12px}@keyframes sd-file-explorer-spin{to{transform:rotate(360deg)}}@keyframes sd-file-explorer-fade{0%{opacity:0}}@keyframes sd-file-explorer-refresh{0%{left:-30%}to{left:100%}}@media(prefers-reduced-motion:reduce){.scrim{animation:none}.search,:host(.sd-file-explorer--compact) .sidebar{transition:none}}.move-status{display:block;margin:8px 16px;color:var(--sd-fe-text-secondary)}.move-picker{box-sizing:border-box;max-height:min(80vh,100% - 32px);overflow-y:auto}\n"] }]
|
|
2575
4702
|
}], ctorParameters: () => [] });
|
|
2576
4703
|
|
|
2577
4704
|
/**
|
|
2578
4705
|
* Generated bundle index. Do not edit.
|
|
2579
4706
|
*/
|
|
2580
4707
|
|
|
2581
|
-
export { SdFileExplorer };
|
|
4708
|
+
export { SdFileExplorer, SdFileExplorerColumnDef };
|
|
2582
4709
|
//# sourceMappingURL=sdcorejs-angular-components-file-explorer.mjs.map
|