@yuuvis/client-framework 0.6.5
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 +62 -0
- package/actions/README.md +3 -0
- package/actions/index.d.ts +6 -0
- package/actions/lib/actions/copy-action/copy-action.d.ts +17 -0
- package/actions/lib/actions/cut-action/cut-action.d.ts +17 -0
- package/actions/lib/actions/delete-action/delete/delete.component.d.ts +22 -0
- package/actions/lib/actions/delete-action/delete-action.d.ts +17 -0
- package/actions/lib/actions/download-action/download-action.d.ts +17 -0
- package/actions/lib/actions.icon.d.ts +7 -0
- package/actions/lib/actions.interface.d.ts +86 -0
- package/actions/lib/actions.module.d.ts +8 -0
- package/actions/lib/actions.service.d.ts +38 -0
- package/actions/lib/components/contextmenu/contextmenu.component.d.ts +11 -0
- package/app-bar/README.md +3 -0
- package/app-bar/index.d.ts +1 -0
- package/app-bar/lib/app-bar.component.d.ts +47 -0
- package/clipboard/README.md +3 -0
- package/clipboard/index.d.ts +1 -0
- package/clipboard/lib/clipboard.component.d.ts +16 -0
- package/common/README.md +3 -0
- package/common/index.d.ts +5 -0
- package/common/lib/components/focus-indicator/focus-indicator.component.d.ts +7 -0
- package/common/lib/components/token-input/token-input.component.d.ts +55 -0
- package/common/lib/components/token-input/token-input.interface.d.ts +8 -0
- package/common/lib/directives/busy-overlay.directive.d.ts +25 -0
- package/common/lib/directives/click-double.directive.d.ts +17 -0
- package/common/lib/directives/container-size.directive.d.ts +30 -0
- package/common/lib/directives/drag-select.directive.d.ts +21 -0
- package/common/lib/directives/file-drop-zone/file-drop-zone.directive.d.ts +18 -0
- package/common/lib/directives/file-drop-zone/file-drop-zone.interface.d.ts +5 -0
- package/common/lib/directives/focus-within.directive.d.ts +36 -0
- package/common/lib/directives/index.d.ts +8 -0
- package/common/lib/directives/light-dismiss.directive.d.ts +19 -0
- package/common/lib/directives/longpress.directive.d.ts +13 -0
- package/common/lib/directives/noop-value-accessor.directive.d.ts +10 -0
- package/esm2022/actions/index.mjs +7 -0
- package/esm2022/actions/lib/actions/copy-action/copy-action.mjs +31 -0
- package/esm2022/actions/lib/actions/cut-action/cut-action.mjs +30 -0
- package/esm2022/actions/lib/actions/delete-action/delete/delete.component.mjs +67 -0
- package/esm2022/actions/lib/actions/delete-action/delete-action.mjs +44 -0
- package/esm2022/actions/lib/actions/download-action/download-action.mjs +33 -0
- package/esm2022/actions/lib/actions.icon.mjs +8 -0
- package/esm2022/actions/lib/actions.interface.mjs +19 -0
- package/esm2022/actions/lib/actions.module.mjs +16 -0
- package/esm2022/actions/lib/actions.service.mjs +89 -0
- package/esm2022/actions/lib/components/contextmenu/contextmenu.component.mjs +27 -0
- package/esm2022/actions/yuuvis-client-framework-actions.mjs +5 -0
- package/esm2022/app-bar/index.mjs +2 -0
- package/esm2022/app-bar/lib/app-bar.component.mjs +89 -0
- package/esm2022/app-bar/yuuvis-client-framework-app-bar.mjs +5 -0
- package/esm2022/clipboard/index.mjs +2 -0
- package/esm2022/clipboard/lib/clipboard.component.mjs +48 -0
- package/esm2022/clipboard/yuuvis-client-framework-clipboard.mjs +5 -0
- package/esm2022/common/index.mjs +6 -0
- package/esm2022/common/lib/components/focus-indicator/focus-indicator.component.mjs +41 -0
- package/esm2022/common/lib/components/token-input/token-input.component.mjs +324 -0
- package/esm2022/common/lib/components/token-input/token-input.interface.mjs +2 -0
- package/esm2022/common/lib/directives/busy-overlay.directive.mjs +88 -0
- package/esm2022/common/lib/directives/click-double.directive.mjs +61 -0
- package/esm2022/common/lib/directives/container-size.directive.mjs +56 -0
- package/esm2022/common/lib/directives/drag-select.directive.mjs +114 -0
- package/esm2022/common/lib/directives/file-drop-zone/file-drop-zone.directive.mjs +153 -0
- package/esm2022/common/lib/directives/file-drop-zone/file-drop-zone.interface.mjs +2 -0
- package/esm2022/common/lib/directives/focus-within.directive.mjs +81 -0
- package/esm2022/common/lib/directives/index.mjs +9 -0
- package/esm2022/common/lib/directives/light-dismiss.directive.mjs +44 -0
- package/esm2022/common/lib/directives/longpress.directive.mjs +36 -0
- package/esm2022/common/lib/directives/noop-value-accessor.directive.mjs +42 -0
- package/esm2022/common/yuuvis-client-framework-common.mjs +5 -0
- package/esm2022/forms/index.mjs +19 -0
- package/esm2022/forms/lib/elements/catalog/catalog.component.mjs +118 -0
- package/esm2022/forms/lib/elements/datetime/datetime.component.mjs +82 -0
- package/esm2022/forms/lib/elements/datetime-range/datetime-range.component.mjs +166 -0
- package/esm2022/forms/lib/elements/number/number.component.mjs +195 -0
- package/esm2022/forms/lib/elements/number-range/number-range.component.mjs +176 -0
- package/esm2022/forms/lib/elements/organization/organization.component.mjs +268 -0
- package/esm2022/forms/lib/elements/string/string.component.mjs +254 -0
- package/esm2022/forms/lib/form-input/form-input.component.mjs +88 -0
- package/esm2022/forms/lib/forms.module.mjs +58 -0
- package/esm2022/forms/yuuvis-client-framework-forms.mjs +5 -0
- package/esm2022/icons/index.mjs +4 -0
- package/esm2022/icons/lib/icon.service.mjs +59 -0
- package/esm2022/icons/lib/icons.mjs +31 -0
- package/esm2022/icons/lib/object-type-icon/object-type-icon.component.mjs +29 -0
- package/esm2022/icons/yuuvis-client-framework-icons.mjs +5 -0
- package/esm2022/index.mjs +2 -0
- package/esm2022/lib/yuuvis-client-framework.module.mjs +15 -0
- package/esm2022/list/index.mjs +3 -0
- package/esm2022/list/lib/list-item.directive.mjs +72 -0
- package/esm2022/list/lib/list.component.mjs +133 -0
- package/esm2022/list/yuuvis-client-framework-list.mjs +5 -0
- package/esm2022/metadata-form/index.mjs +4 -0
- package/esm2022/metadata-form/lib/metadata-default-templates/metadata-default-templates.component.mjs +31 -0
- package/esm2022/metadata-form/lib/metadata-form-element-registry.service.mjs +99 -0
- package/esm2022/metadata-form/lib/metadata-form-field/metadata-form-field.component.mjs +126 -0
- package/esm2022/metadata-form/lib/object-metadata-element-template.directive.mjs +52 -0
- package/esm2022/metadata-form/yuuvis-client-framework-metadata-form.mjs +5 -0
- package/esm2022/object-details/index.mjs +7 -0
- package/esm2022/object-details/lib/object-audit/object-audit.component.mjs +195 -0
- package/esm2022/object-details/lib/object-details-shell/object-details-shell.component.mjs +127 -0
- package/esm2022/object-details/lib/object-details.component.mjs +61 -0
- package/esm2022/object-details/lib/object-metadata/form-section-group.pipe.mjs +17 -0
- package/esm2022/object-details/lib/object-metadata/object-metadata.component.mjs +201 -0
- package/esm2022/object-details/lib/object-metadata/object-metadata.interface.mjs +2 -0
- package/esm2022/object-details/yuuvis-client-framework-object-details.mjs +5 -0
- package/esm2022/object-flavor/index.mjs +6 -0
- package/esm2022/object-flavor/lib/abstract-apply-create-flavor/abstract-apply-create-flavor.component.mjs +25 -0
- package/esm2022/object-flavor/lib/abstract-apply-object-flavor/abstract-apply-object-flavor.component.mjs +21 -0
- package/esm2022/object-flavor/lib/flavor-chip/flavor-chip.component.mjs +35 -0
- package/esm2022/object-flavor/lib/object-flavor/object-flavor.component.mjs +93 -0
- package/esm2022/object-flavor/lib/object-flavor-picker/object-flavor-picker.component.mjs +43 -0
- package/esm2022/object-flavor/yuuvis-client-framework-object-flavor.mjs +5 -0
- package/esm2022/object-form/index.mjs +5 -0
- package/esm2022/object-form/lib/form-scripting.api.interface.mjs +2 -0
- package/esm2022/object-form/lib/form-scripting.service.mjs +160 -0
- package/esm2022/object-form/lib/object-form-element/object-form-element.component.mjs +87 -0
- package/esm2022/object-form/lib/object-form-extension.interface.mjs +36 -0
- package/esm2022/object-form/lib/object-form-group/object-form-group.component.mjs +85 -0
- package/esm2022/object-form/lib/object-form-script/form-scripting-element-extension/form-scripting-element-extension.component.mjs +23 -0
- package/esm2022/object-form/lib/object-form-script/object-form-script.service.mjs +115 -0
- package/esm2022/object-form/lib/object-form-script/object-form-scripting-scope.mjs +251 -0
- package/esm2022/object-form/lib/object-form-translate.service.mjs +73 -0
- package/esm2022/object-form/lib/object-form.component.mjs +627 -0
- package/esm2022/object-form/lib/object-form.interface.mjs +9 -0
- package/esm2022/object-form/lib/object-form.model.mjs +20 -0
- package/esm2022/object-form/lib/object-form.service.mjs +127 -0
- package/esm2022/object-form/lib/object-form.utils.mjs +55 -0
- package/esm2022/object-form/lib/object-form.validation.mjs +48 -0
- package/esm2022/object-form/yuuvis-client-framework-object-form.mjs +5 -0
- package/esm2022/object-preview/index.mjs +3 -0
- package/esm2022/object-preview/lib/components/index.mjs +3 -0
- package/esm2022/object-preview/lib/components/object-email-preview/object-email-preview.component.mjs +45 -0
- package/esm2022/object-preview/lib/components/object-preview/object-preview.component.mjs +78 -0
- package/esm2022/object-preview/lib/services/object-preview.service.mjs +92 -0
- package/esm2022/object-preview/yuuvis-client-framework-object-preview.mjs +5 -0
- package/esm2022/object-summary/index.mjs +5 -0
- package/esm2022/object-summary/lib/multi-object-summary/multi-object-summary.component.mjs +33 -0
- package/esm2022/object-summary/lib/object-summary/object-summary.component.mjs +273 -0
- package/esm2022/object-summary/lib/object-summary-data/object-summary-data.component.mjs +80 -0
- package/esm2022/object-summary/lib/object-summary.module.mjs +15 -0
- package/esm2022/object-summary/yuuvis-client-framework-object-summary.mjs +5 -0
- package/esm2022/pagination/index.mjs +3 -0
- package/esm2022/pagination/lib/pagination.component.mjs +48 -0
- package/esm2022/pagination/lib/pagination.interface.mjs +2 -0
- package/esm2022/pagination/yuuvis-client-framework-pagination.mjs +5 -0
- package/esm2022/panel/index.mjs +2 -0
- package/esm2022/panel/lib/panel.component.mjs +20 -0
- package/esm2022/panel/yuuvis-client-framework-panel.mjs +5 -0
- package/esm2022/renderer/index.mjs +11 -0
- package/esm2022/renderer/lib/property-renderer/abstract.renderer.mjs +29 -0
- package/esm2022/renderer/lib/property-renderer/datetime.renderer.mjs +13 -0
- package/esm2022/renderer/lib/property-renderer/decimal.renderer.component.mjs +12 -0
- package/esm2022/renderer/lib/property-renderer/filesize.renderer.component.mjs +28 -0
- package/esm2022/renderer/lib/property-renderer/icon.renderer.component.mjs +23 -0
- package/esm2022/renderer/lib/property-renderer/integer.renderer.component.mjs +12 -0
- package/esm2022/renderer/lib/property-renderer/organization.renderer.mjs +19 -0
- package/esm2022/renderer/lib/property-renderer/string.renderer.component.mjs +12 -0
- package/esm2022/renderer/lib/property-renderer/unknown.renderer.mjs +12 -0
- package/esm2022/renderer/lib/renderer.directive.mjs +51 -0
- package/esm2022/renderer/lib/services/renderer/renderer.interface.mjs +2 -0
- package/esm2022/renderer/lib/services/renderer/renderer.service.mjs +84 -0
- package/esm2022/renderer/yuuvis-client-framework-renderer.mjs +5 -0
- package/esm2022/sequence-list/index.mjs +6 -0
- package/esm2022/sequence-list/lib/due-date-picker/due-date-picker.component.mjs +99 -0
- package/esm2022/sequence-list/lib/sequence-list-template-manage/sequence-list-template-manage.component.mjs +183 -0
- package/esm2022/sequence-list/lib/sequence-list-templates/sequence-list-templates.component.mjs +114 -0
- package/esm2022/sequence-list/lib/sequence-list.component.mjs +146 -0
- package/esm2022/sequence-list/lib/sequence-list.interface.mjs +2 -0
- package/esm2022/sequence-list/yuuvis-client-framework-sequence-list.mjs +5 -0
- package/esm2022/simple-search/index.mjs +3 -0
- package/esm2022/simple-search/lib/simple-search/simple-search.component.mjs +111 -0
- package/esm2022/simple-search/lib/simple-search/simple-search.interface.mjs +2 -0
- package/esm2022/simple-search/yuuvis-client-framework-simple-search.mjs +5 -0
- package/esm2022/tile-list/index.mjs +11 -0
- package/esm2022/tile-list/lib/tile/tile.component.mjs +53 -0
- package/esm2022/tile-list/lib/tile-config/action-select/action-select.component.mjs +22 -0
- package/esm2022/tile-list/lib/tile-config/icon-select/icon-select.component.mjs +33 -0
- package/esm2022/tile-list/lib/tile-config/property-select/property-select.component.mjs +91 -0
- package/esm2022/tile-list/lib/tile-config/tile-config-tile/tile-config-tile.component.mjs +66 -0
- package/esm2022/tile-list/lib/tile-config/tile-config-trigger/tile-config-trigger.component.mjs +46 -0
- package/esm2022/tile-list/lib/tile-config/tile-config.component.mjs +156 -0
- package/esm2022/tile-list/lib/tile-extension/directive/tile-extension.directive.mjs +37 -0
- package/esm2022/tile-list/lib/tile-extension/extensions/email.extension.mjs +42 -0
- package/esm2022/tile-list/lib/tile-extension/tile-extension.service.mjs +35 -0
- package/esm2022/tile-list/lib/tile-list/tile-list.component.mjs +510 -0
- package/esm2022/tile-list/lib/tile-list/tile-list.interface.mjs +2 -0
- package/esm2022/tile-list/yuuvis-client-framework-tile-list.mjs +5 -0
- package/esm2022/token-search/index.mjs +3 -0
- package/esm2022/token-search/token-search.component.mjs +78 -0
- package/esm2022/token-search/token-search.interface.mjs +2 -0
- package/esm2022/token-search/yuuvis-client-framework-token-search.mjs +5 -0
- package/esm2022/tree/index.mjs +3 -0
- package/esm2022/tree/lib/tree-node/tree-node.component.mjs +65 -0
- package/esm2022/tree/lib/tree.component.mjs +148 -0
- package/esm2022/tree/lib/tree.interface.mjs +2 -0
- package/esm2022/tree/lib/tree.service.mjs +95 -0
- package/esm2022/tree/yuuvis-client-framework-tree.mjs +5 -0
- package/esm2022/upload-progress/index.mjs +2 -0
- package/esm2022/upload-progress/lib/upload-progress/upload-progress-overlay/upload-progress-overlay.component.mjs +49 -0
- package/esm2022/upload-progress/lib/upload-progress/upload-progress.component.mjs +37 -0
- package/esm2022/upload-progress/yuuvis-client-framework-upload-progress.mjs +5 -0
- package/esm2022/user-avatar/index.mjs +3 -0
- package/esm2022/user-avatar/lib/user-avatar.component.mjs +69 -0
- package/esm2022/user-avatar/lib/user-avatar.module.mjs +24 -0
- package/esm2022/user-avatar/yuuvis-client-framework-user-avatar.mjs +5 -0
- package/esm2022/yuuvis-client-framework.mjs +5 -0
- package/fesm2022/yuuvis-client-framework-actions.mjs +333 -0
- package/fesm2022/yuuvis-client-framework-actions.mjs.map +1 -0
- package/fesm2022/yuuvis-client-framework-app-bar.mjs +96 -0
- package/fesm2022/yuuvis-client-framework-app-bar.mjs.map +1 -0
- package/fesm2022/yuuvis-client-framework-clipboard.mjs +55 -0
- package/fesm2022/yuuvis-client-framework-clipboard.mjs.map +1 -0
- package/fesm2022/yuuvis-client-framework-common.mjs +1020 -0
- package/fesm2022/yuuvis-client-framework-common.mjs.map +1 -0
- package/fesm2022/yuuvis-client-framework-forms.mjs +1355 -0
- package/fesm2022/yuuvis-client-framework-forms.mjs.map +1 -0
- package/fesm2022/yuuvis-client-framework-icons.mjs +123 -0
- package/fesm2022/yuuvis-client-framework-icons.mjs.map +1 -0
- package/fesm2022/yuuvis-client-framework-list.mjs +209 -0
- package/fesm2022/yuuvis-client-framework-list.mjs.map +1 -0
- package/fesm2022/yuuvis-client-framework-metadata-form.mjs +302 -0
- package/fesm2022/yuuvis-client-framework-metadata-form.mjs.map +1 -0
- package/fesm2022/yuuvis-client-framework-object-details.mjs +583 -0
- package/fesm2022/yuuvis-client-framework-object-details.mjs.map +1 -0
- package/fesm2022/yuuvis-client-framework-object-flavor.mjs +200 -0
- package/fesm2022/yuuvis-client-framework-object-flavor.mjs.map +1 -0
- package/fesm2022/yuuvis-client-framework-object-form.mjs +1664 -0
- package/fesm2022/yuuvis-client-framework-object-form.mjs.map +1 -0
- package/fesm2022/yuuvis-client-framework-object-preview.mjs +213 -0
- package/fesm2022/yuuvis-client-framework-object-preview.mjs.map +1 -0
- package/fesm2022/yuuvis-client-framework-object-summary.mjs +397 -0
- package/fesm2022/yuuvis-client-framework-object-summary.mjs.map +1 -0
- package/fesm2022/yuuvis-client-framework-pagination.mjs +55 -0
- package/fesm2022/yuuvis-client-framework-pagination.mjs.map +1 -0
- package/fesm2022/yuuvis-client-framework-panel.mjs +27 -0
- package/fesm2022/yuuvis-client-framework-panel.mjs.map +1 -0
- package/fesm2022/yuuvis-client-framework-renderer.mjs +262 -0
- package/fesm2022/yuuvis-client-framework-renderer.mjs.map +1 -0
- package/fesm2022/yuuvis-client-framework-sequence-list.mjs +519 -0
- package/fesm2022/yuuvis-client-framework-sequence-list.mjs.map +1 -0
- package/fesm2022/yuuvis-client-framework-simple-search.mjs +118 -0
- package/fesm2022/yuuvis-client-framework-simple-search.mjs.map +1 -0
- package/fesm2022/yuuvis-client-framework-tile-list.mjs +1036 -0
- package/fesm2022/yuuvis-client-framework-tile-list.mjs.map +1 -0
- package/fesm2022/yuuvis-client-framework-token-search.mjs +85 -0
- package/fesm2022/yuuvis-client-framework-token-search.mjs.map +1 -0
- package/fesm2022/yuuvis-client-framework-tree.mjs +307 -0
- package/fesm2022/yuuvis-client-framework-tree.mjs.map +1 -0
- package/fesm2022/yuuvis-client-framework-upload-progress.mjs +84 -0
- package/fesm2022/yuuvis-client-framework-upload-progress.mjs.map +1 -0
- package/fesm2022/yuuvis-client-framework-user-avatar.mjs +96 -0
- package/fesm2022/yuuvis-client-framework-user-avatar.mjs.map +1 -0
- package/fesm2022/yuuvis-client-framework.mjs +22 -0
- package/fesm2022/yuuvis-client-framework.mjs.map +1 -0
- package/forms/README.md +3 -0
- package/forms/index.d.ts +9 -0
- package/forms/lib/elements/catalog/catalog.component.d.ts +68 -0
- package/forms/lib/elements/datetime/datetime.component.d.ts +32 -0
- package/forms/lib/elements/datetime-range/datetime-range.component.d.ts +51 -0
- package/forms/lib/elements/number/number.component.d.ts +77 -0
- package/forms/lib/elements/number-range/number-range.component.d.ts +66 -0
- package/forms/lib/elements/organization/organization.component.d.ts +93 -0
- package/forms/lib/elements/string/string.component.d.ts +104 -0
- package/forms/lib/form-input/form-input.component.d.ts +48 -0
- package/forms/lib/forms.module.d.ts +16 -0
- package/icons/README.md +5 -0
- package/icons/index.d.ts +3 -0
- package/icons/lib/icon.service.d.ts +38 -0
- package/icons/lib/icons.d.ts +1 -0
- package/icons/lib/object-type-icon/object-type-icon.component.d.ts +11 -0
- package/index.d.ts +1 -0
- package/lib/yuuvis-client-framework.module.d.ts +7 -0
- package/list/README.md +3 -0
- package/list/index.d.ts +2 -0
- package/list/lib/list-item.directive.d.ts +15 -0
- package/list/lib/list.component.d.ts +36 -0
- package/metadata-form/README.md +21 -0
- package/metadata-form/index.d.ts +3 -0
- package/metadata-form/lib/metadata-default-templates/metadata-default-templates.component.d.ts +5 -0
- package/metadata-form/lib/metadata-form-element-registry.service.d.ts +47 -0
- package/metadata-form/lib/metadata-form-field/metadata-form-field.component.d.ts +31 -0
- package/metadata-form/lib/object-metadata-element-template.directive.d.ts +27 -0
- package/object-details/README.md +28 -0
- package/object-details/index.d.ts +6 -0
- package/object-details/lib/object-audit/object-audit.component.d.ts +59 -0
- package/object-details/lib/object-details-shell/object-details-shell.component.d.ts +51 -0
- package/object-details/lib/object-details.component.d.ts +36 -0
- package/object-details/lib/object-metadata/form-section-group.pipe.d.ts +8 -0
- package/object-details/lib/object-metadata/object-metadata.component.d.ts +48 -0
- package/object-details/lib/object-metadata/object-metadata.interface.d.ts +26 -0
- package/object-flavor/README.md +3 -0
- package/object-flavor/index.d.ts +5 -0
- package/object-flavor/lib/abstract-apply-create-flavor/abstract-apply-create-flavor.component.d.ts +12 -0
- package/object-flavor/lib/abstract-apply-object-flavor/abstract-apply-object-flavor.component.d.ts +12 -0
- package/object-flavor/lib/flavor-chip/flavor-chip.component.d.ts +17 -0
- package/object-flavor/lib/object-flavor/object-flavor.component.d.ts +26 -0
- package/object-flavor/lib/object-flavor-picker/object-flavor-picker.component.d.ts +10 -0
- package/object-form/README.md +3 -0
- package/object-form/index.d.ts +4 -0
- package/object-form/lib/form-scripting.api.interface.d.ts +131 -0
- package/object-form/lib/form-scripting.service.d.ts +30 -0
- package/object-form/lib/object-form-element/object-form-element.component.d.ts +22 -0
- package/object-form/lib/object-form-extension.interface.d.ts +22 -0
- package/object-form/lib/object-form-group/object-form-group.component.d.ts +22 -0
- package/object-form/lib/object-form-script/form-scripting-element-extension/form-scripting-element-extension.component.d.ts +10 -0
- package/object-form/lib/object-form-script/object-form-script.service.d.ts +45 -0
- package/object-form/lib/object-form-script/object-form-scripting-scope.d.ts +50 -0
- package/object-form/lib/object-form-translate.service.d.ts +15 -0
- package/object-form/lib/object-form.component.d.ts +60 -0
- package/object-form/lib/object-form.interface.d.ts +113 -0
- package/object-form/lib/object-form.model.d.ts +18 -0
- package/object-form/lib/object-form.service.d.ts +39 -0
- package/object-form/lib/object-form.utils.d.ts +20 -0
- package/object-form/lib/object-form.validation.d.ts +21 -0
- package/object-preview/README.md +3 -0
- package/object-preview/index.d.ts +2 -0
- package/object-preview/lib/components/index.d.ts +2 -0
- package/object-preview/lib/components/object-email-preview/object-email-preview.component.d.ts +16 -0
- package/object-preview/lib/components/object-preview/object-preview.component.d.ts +13 -0
- package/object-preview/lib/services/object-preview.service.d.ts +37 -0
- package/object-summary/README.md +3 -0
- package/object-summary/index.d.ts +4 -0
- package/object-summary/lib/multi-object-summary/multi-object-summary.component.d.ts +7 -0
- package/object-summary/lib/object-summary/object-summary.component.d.ts +73 -0
- package/object-summary/lib/object-summary-data/object-summary-data.component.d.ts +11 -0
- package/object-summary/lib/object-summary.module.d.ts +7 -0
- package/package.json +173 -0
- package/pagination/README.md +3 -0
- package/pagination/index.d.ts +2 -0
- package/pagination/lib/pagination.component.d.ts +18 -0
- package/pagination/lib/pagination.interface.d.ts +5 -0
- package/panel/README.md +3 -0
- package/panel/index.d.ts +1 -0
- package/panel/lib/panel.component.d.ts +12 -0
- package/renderer/README.md +5 -0
- package/renderer/index.d.ts +10 -0
- package/renderer/lib/property-renderer/abstract.renderer.d.ts +14 -0
- package/renderer/lib/property-renderer/datetime.renderer.d.ts +6 -0
- package/renderer/lib/property-renderer/decimal.renderer.component.d.ts +6 -0
- package/renderer/lib/property-renderer/filesize.renderer.component.d.ts +7 -0
- package/renderer/lib/property-renderer/icon.renderer.component.d.ts +6 -0
- package/renderer/lib/property-renderer/integer.renderer.component.d.ts +6 -0
- package/renderer/lib/property-renderer/organization.renderer.d.ts +7 -0
- package/renderer/lib/property-renderer/string.renderer.component.d.ts +6 -0
- package/renderer/lib/property-renderer/unknown.renderer.d.ts +6 -0
- package/renderer/lib/renderer.directive.d.ts +17 -0
- package/renderer/lib/services/renderer/renderer.interface.d.ts +8 -0
- package/renderer/lib/services/renderer/renderer.service.d.ts +35 -0
- package/sequence-list/README.md +3 -0
- package/sequence-list/index.d.ts +5 -0
- package/sequence-list/lib/due-date-picker/due-date-picker.component.d.ts +28 -0
- package/sequence-list/lib/sequence-list-template-manage/sequence-list-template-manage.component.d.ts +52 -0
- package/sequence-list/lib/sequence-list-templates/sequence-list-templates.component.d.ts +36 -0
- package/sequence-list/lib/sequence-list.component.d.ts +43 -0
- package/sequence-list/lib/sequence-list.interface.d.ts +16 -0
- package/simple-search/README.md +3 -0
- package/simple-search/index.d.ts +2 -0
- package/simple-search/lib/simple-search/simple-search.component.d.ts +55 -0
- package/simple-search/lib/simple-search/simple-search.interface.d.ts +4 -0
- package/styles/client-framework.scss +27 -0
- package/tile-list/README.md +3 -0
- package/tile-list/index.d.ts +10 -0
- package/tile-list/lib/tile/tile.component.d.ts +22 -0
- package/tile-list/lib/tile-config/action-select/action-select.component.d.ts +13 -0
- package/tile-list/lib/tile-config/icon-select/icon-select.component.d.ts +11 -0
- package/tile-list/lib/tile-config/property-select/property-select.component.d.ts +25 -0
- package/tile-list/lib/tile-config/tile-config-tile/tile-config-tile.component.d.ts +20 -0
- package/tile-list/lib/tile-config/tile-config-trigger/tile-config-trigger.component.d.ts +17 -0
- package/tile-list/lib/tile-config/tile-config.component.d.ts +47 -0
- package/tile-list/lib/tile-extension/directive/tile-extension.directive.d.ts +11 -0
- package/tile-list/lib/tile-extension/extensions/email.extension.d.ts +10 -0
- package/tile-list/lib/tile-extension/tile-extension.service.d.ts +16 -0
- package/tile-list/lib/tile-list/tile-list.component.d.ts +116 -0
- package/tile-list/lib/tile-list/tile-list.interface.d.ts +18 -0
- package/token-search/README.md +3 -0
- package/token-search/index.d.ts +2 -0
- package/token-search/token-search.component.d.ts +22 -0
- package/token-search/token-search.interface.d.ts +4 -0
- package/tree/README.md +3 -0
- package/tree/index.d.ts +2 -0
- package/tree/lib/tree-node/tree-node.component.d.ts +21 -0
- package/tree/lib/tree.component.d.ts +53 -0
- package/tree/lib/tree.interface.d.ts +11 -0
- package/tree/lib/tree.service.d.ts +35 -0
- package/upload-progress/README.md +3 -0
- package/upload-progress/index.d.ts +1 -0
- package/upload-progress/lib/upload-progress/upload-progress-overlay/upload-progress-overlay.component.d.ts +17 -0
- package/upload-progress/lib/upload-progress/upload-progress.component.d.ts +16 -0
- package/user-avatar/README.md +3 -0
- package/user-avatar/index.d.ts +2 -0
- package/user-avatar/lib/user-avatar.component.d.ts +44 -0
- package/user-avatar/lib/user-avatar.module.d.ts +8 -0
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import * as i1 from '@angular/common';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { Injectable, inject, input, effect, Component, HostBinding, ElementRef, HostAttributeToken, output, Input, HostListener } from '@angular/core';
|
|
5
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
6
|
+
import * as i2 from '@yuuvis/components/icon';
|
|
7
|
+
import { YvcIconModule } from '@yuuvis/components/icon';
|
|
8
|
+
import { ReplaySubject, Subject } from 'rxjs';
|
|
9
|
+
|
|
10
|
+
class TreeService {
|
|
11
|
+
constructor() {
|
|
12
|
+
this._selection = [];
|
|
13
|
+
this._selectionSource = new ReplaySubject();
|
|
14
|
+
this.selection$ = this._selectionSource.asObservable();
|
|
15
|
+
this._nodeClickSource = new Subject();
|
|
16
|
+
this.nodeClick$ = this._nodeClickSource.asObservable();
|
|
17
|
+
this._nodeFocusSource = new ReplaySubject();
|
|
18
|
+
this.nodeFocus$ = this._nodeFocusSource.asObservable();
|
|
19
|
+
this.multiselect = false;
|
|
20
|
+
}
|
|
21
|
+
setTree(tree) {
|
|
22
|
+
this._tree = tree;
|
|
23
|
+
}
|
|
24
|
+
focusNode(id) {
|
|
25
|
+
this._nodeFocusSource.next(id);
|
|
26
|
+
}
|
|
27
|
+
toggleNode(id) {
|
|
28
|
+
if (id) {
|
|
29
|
+
const node = this._getNodeById(id);
|
|
30
|
+
if (node)
|
|
31
|
+
node.expanded = !node.expanded;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
selectNodeByID(id, ctrlKey = false) {
|
|
35
|
+
const node = this._getNodeById(id);
|
|
36
|
+
if (node)
|
|
37
|
+
this.selectNode(node, ctrlKey);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Select a tree node. If the node has already been selected it'll be
|
|
41
|
+
* removed from the selection. Otherwise it will be added. By default selection
|
|
42
|
+
* will only contain a single node. If `multiselect` is set to true and CTRL is
|
|
43
|
+
* pressed the current collection will be extended.
|
|
44
|
+
* @param node The tree node to be added/removed
|
|
45
|
+
* @param ctrlKey Whether or not the CTRL key has been pressed
|
|
46
|
+
* @returns The updated list of selected tree nodes
|
|
47
|
+
*/
|
|
48
|
+
selectNode(node, ctrlKey = false) {
|
|
49
|
+
if (node.selectable) {
|
|
50
|
+
if (!this.multiselect || !ctrlKey) {
|
|
51
|
+
this._selection = [node];
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
const ids = this._selection.map((n) => n.id);
|
|
55
|
+
if (ids.includes(node.id))
|
|
56
|
+
this._selection = this._selection.filter((n) => n.id !== node.id);
|
|
57
|
+
else
|
|
58
|
+
this._selection.push(node);
|
|
59
|
+
}
|
|
60
|
+
this._selectionSource.next(this._selection);
|
|
61
|
+
}
|
|
62
|
+
this._nodeClickSource.next(node);
|
|
63
|
+
}
|
|
64
|
+
setSelection(nodeIds) {
|
|
65
|
+
this._resolveSelectedNodes(nodeIds);
|
|
66
|
+
this._selectionSource.next(this._selection);
|
|
67
|
+
}
|
|
68
|
+
_getNodeById(id) {
|
|
69
|
+
return this._tree ? this._getChildNodeById(id, this._tree.nodes) : undefined;
|
|
70
|
+
}
|
|
71
|
+
_getChildNodeById(id, nodes) {
|
|
72
|
+
let match;
|
|
73
|
+
nodes.forEach((n) => {
|
|
74
|
+
if (n.id === id)
|
|
75
|
+
match = n;
|
|
76
|
+
if (!match && n.children)
|
|
77
|
+
match = this._getChildNodeById(id, n.children);
|
|
78
|
+
});
|
|
79
|
+
return match;
|
|
80
|
+
}
|
|
81
|
+
_resolveSelectedNodes(nodeIDs) {
|
|
82
|
+
this._selection = [];
|
|
83
|
+
if (!this._tree)
|
|
84
|
+
return;
|
|
85
|
+
this._resolveChildren(nodeIDs, this._tree.nodes);
|
|
86
|
+
}
|
|
87
|
+
_resolveChildren(nodeIDs, nodes) {
|
|
88
|
+
nodes.forEach((n) => {
|
|
89
|
+
if (nodeIDs.includes(n.id))
|
|
90
|
+
this._selection.push(n);
|
|
91
|
+
if (n.children?.length)
|
|
92
|
+
this._resolveChildren(nodeIDs, n.children);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TreeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
96
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TreeService }); }
|
|
97
|
+
}
|
|
98
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TreeService, decorators: [{
|
|
99
|
+
type: Injectable
|
|
100
|
+
}] });
|
|
101
|
+
|
|
102
|
+
class TreeNodeComponent {
|
|
103
|
+
constructor() {
|
|
104
|
+
this.treeService = inject(TreeService);
|
|
105
|
+
this.node = input.required();
|
|
106
|
+
this.toggleIcon = input('<svg xmlns="http://www.w3.org/2000/svg" height="18px" viewBox="0 -960 960 960" width="18px"><path d="M522-480 333-669l51-51 240 240-240 240-51-51 189-189Z"/></svg>');
|
|
107
|
+
this.focused = false;
|
|
108
|
+
this.selected = false;
|
|
109
|
+
this.expanded = false;
|
|
110
|
+
this._selectedNodes = [];
|
|
111
|
+
this._subs = [];
|
|
112
|
+
this.treeSelectEffect = effect(() => {
|
|
113
|
+
this._setSelection();
|
|
114
|
+
this.expanded = !!this.node().expanded;
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
select(evt) {
|
|
118
|
+
this.treeService.selectNode(this.node(), evt.ctrlKey);
|
|
119
|
+
}
|
|
120
|
+
toggleExpanded() {
|
|
121
|
+
this.node().expanded = !this.node().expanded;
|
|
122
|
+
this.expanded = !!this.node().expanded;
|
|
123
|
+
}
|
|
124
|
+
_setSelection() {
|
|
125
|
+
if (!this.node())
|
|
126
|
+
return;
|
|
127
|
+
this.selected = this._selectedNodes.includes(this.node().id);
|
|
128
|
+
}
|
|
129
|
+
ngOnInit() {
|
|
130
|
+
this._subs.push(this.treeService.selection$.subscribe((selection) => {
|
|
131
|
+
this._selectedNodes = selection.map((n) => n.id);
|
|
132
|
+
this._setSelection();
|
|
133
|
+
}));
|
|
134
|
+
this._subs.push(this.treeService.nodeFocus$.subscribe((id) => {
|
|
135
|
+
this.focused = this.node().id === id;
|
|
136
|
+
}));
|
|
137
|
+
}
|
|
138
|
+
ngOnDestroy() {
|
|
139
|
+
this._subs.forEach((s) => s.unsubscribe());
|
|
140
|
+
}
|
|
141
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TreeNodeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
142
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: TreeNodeComponent, isStandalone: true, selector: "yuv-tree-node", inputs: { node: { classPropertyName: "node", publicName: "node", isSignal: true, isRequired: true, transformFunction: null }, toggleIcon: { classPropertyName: "toggleIcon", publicName: "toggleIcon", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "treeitem" }, properties: { "class.focused": "this.focused", "attr.aria-selected": "this.selected", "attr.aria-expanded": "this.expanded" } }, ngImport: i0, template: "@if (node().children?.length) {\n <!-- toggle children button-->\n <!-- TODO: title should be i18n -->\n <button class=\"toggle\" (click)=\"toggleExpanded()\" title=\"toggle Expand\">\n <yvc-icon [svg]=\"toggleIcon()\"></yvc-icon>\n </button>\n}\n<div class=\"node-label\" [attr.node-id]=\"node().id\" [ngClass]=\"{ selectable: node().selectable }\" (click)=\"select($event)\">\n @if (node().icon) {\n <yvc-icon class=\"node-icon\" [svg]=\"node().icon!\"></yvc-icon>\n }\n <div class=\"label\">{{ node().label }}</div>\n</div>\n\n@if (node().expanded) {\n <div class=\"children\">\n @for (childNode of node().children; track $index) {\n <yuv-tree-node [toggleIcon]=\"toggleIcon()\" [node]=\"childNode\"></yuv-tree-node>\n }\n </div>\n}\n", styles: [":host-context(:focus).focused>.node-label{background-color:var(--item-focus-background-color);outline:1px solid var(--text-color-hint);outline-offset:-3px}:host-context([selectable])[aria-selected=true]>.node-label{background-color:var(--item-selected-background-color)}:host-context([selectable])[aria-selected=true]>.node-label:hover{background-color:var(--item-selected-background-color)}:host{display:grid;grid-template-rows:auto auto;grid-template-columns:var(--toggle-icon-size) 1fr;grid-template-areas:\"toggle label\" \"child child\";align-items:center}:host .node-label{grid-area:label;display:flex;flex-flow:row nowrap;align-items:center}:host .node-label.selectable{cursor:pointer}:host .node-label:hover{background-color:var(--item-focus-background-color)}:host .node-label .label{padding:var(--node-padding);text-align:start;color:var(--text-color-body);background-color:transparent;-webkit-user-select:none;user-select:none;flex:1}:host .node-label .node-icon{color:var(--text-color-caption)}:host .children{grid-area:child;padding-inline-start:var(--node-indent)}:host[aria-expanded=true] button.toggle{rotate:90deg}:host button.toggle{grid-area:toggle;border:0;padding:2px;border-radius:50%;justify-self:center;align-self:center}:host button.toggle yvc-icon{--icon-size: var(--toggle-icon-size)}\n"], dependencies: [{ kind: "component", type: TreeNodeComponent, selector: "yuv-tree-node", inputs: ["node", "toggleIcon"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: YvcIconModule }, { kind: "component", type: i2.Icon, selector: "yvc-icon", inputs: ["label", "svg", "svgSrc"] }] }); }
|
|
143
|
+
}
|
|
144
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TreeNodeComponent, decorators: [{
|
|
145
|
+
type: Component,
|
|
146
|
+
args: [{ selector: 'yuv-tree-node', standalone: true, imports: [CommonModule, YvcIconModule], host: {
|
|
147
|
+
role: 'treeitem'
|
|
148
|
+
}, template: "@if (node().children?.length) {\n <!-- toggle children button-->\n <!-- TODO: title should be i18n -->\n <button class=\"toggle\" (click)=\"toggleExpanded()\" title=\"toggle Expand\">\n <yvc-icon [svg]=\"toggleIcon()\"></yvc-icon>\n </button>\n}\n<div class=\"node-label\" [attr.node-id]=\"node().id\" [ngClass]=\"{ selectable: node().selectable }\" (click)=\"select($event)\">\n @if (node().icon) {\n <yvc-icon class=\"node-icon\" [svg]=\"node().icon!\"></yvc-icon>\n }\n <div class=\"label\">{{ node().label }}</div>\n</div>\n\n@if (node().expanded) {\n <div class=\"children\">\n @for (childNode of node().children; track $index) {\n <yuv-tree-node [toggleIcon]=\"toggleIcon()\" [node]=\"childNode\"></yuv-tree-node>\n }\n </div>\n}\n", styles: [":host-context(:focus).focused>.node-label{background-color:var(--item-focus-background-color);outline:1px solid var(--text-color-hint);outline-offset:-3px}:host-context([selectable])[aria-selected=true]>.node-label{background-color:var(--item-selected-background-color)}:host-context([selectable])[aria-selected=true]>.node-label:hover{background-color:var(--item-selected-background-color)}:host{display:grid;grid-template-rows:auto auto;grid-template-columns:var(--toggle-icon-size) 1fr;grid-template-areas:\"toggle label\" \"child child\";align-items:center}:host .node-label{grid-area:label;display:flex;flex-flow:row nowrap;align-items:center}:host .node-label.selectable{cursor:pointer}:host .node-label:hover{background-color:var(--item-focus-background-color)}:host .node-label .label{padding:var(--node-padding);text-align:start;color:var(--text-color-body);background-color:transparent;-webkit-user-select:none;user-select:none;flex:1}:host .node-label .node-icon{color:var(--text-color-caption)}:host .children{grid-area:child;padding-inline-start:var(--node-indent)}:host[aria-expanded=true] button.toggle{rotate:90deg}:host button.toggle{grid-area:toggle;border:0;padding:2px;border-radius:50%;justify-self:center;align-self:center}:host button.toggle yvc-icon{--icon-size: var(--toggle-icon-size)}\n"] }]
|
|
149
|
+
}], propDecorators: { focused: [{
|
|
150
|
+
type: HostBinding,
|
|
151
|
+
args: ['class.focused']
|
|
152
|
+
}], selected: [{
|
|
153
|
+
type: HostBinding,
|
|
154
|
+
args: ['attr.aria-selected']
|
|
155
|
+
}], expanded: [{
|
|
156
|
+
type: HostBinding,
|
|
157
|
+
args: ['attr.aria-expanded']
|
|
158
|
+
}] } });
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Component rendering a tree.
|
|
162
|
+
*/
|
|
163
|
+
class TreeComponent {
|
|
164
|
+
set _focusedIndex(idx) {
|
|
165
|
+
this.__focusedIndex = idx;
|
|
166
|
+
this.treeService.focusNode(this.items?.item(idx).getAttribute('node-id'));
|
|
167
|
+
}
|
|
168
|
+
get _focusedIndex() {
|
|
169
|
+
return this.__focusedIndex;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* IDs of nodes that should be set 'selected'.
|
|
173
|
+
*/
|
|
174
|
+
set selectedNodes(nodeIds) {
|
|
175
|
+
this.treeService.setSelection(nodeIds);
|
|
176
|
+
}
|
|
177
|
+
onKeydown(event) {
|
|
178
|
+
switch (event.code) {
|
|
179
|
+
case 'ArrowDown': {
|
|
180
|
+
if ((this.items && this._focusedIndex === this.items.length - 1) || this.__focusedIndex === -1) {
|
|
181
|
+
this._focusedIndex = 0;
|
|
182
|
+
}
|
|
183
|
+
else
|
|
184
|
+
this._focusedIndex++;
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
case 'ArrowUp': {
|
|
188
|
+
if (this.items && (this._focusedIndex === 0 || this.__focusedIndex === -1)) {
|
|
189
|
+
this._focusedIndex = this.items.length - 1;
|
|
190
|
+
}
|
|
191
|
+
else
|
|
192
|
+
this._focusedIndex--;
|
|
193
|
+
break;
|
|
194
|
+
}
|
|
195
|
+
case 'ArrowRight': {
|
|
196
|
+
this._toggle();
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
case 'ArrowLeft': {
|
|
200
|
+
this._toggle();
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
203
|
+
case 'Space': {
|
|
204
|
+
this._selectFocusedNode(event.ctrlKey);
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
case 'Enter': {
|
|
208
|
+
this._selectFocusedNode(event.ctrlKey);
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
constructor() {
|
|
214
|
+
this.treeService = inject(TreeService);
|
|
215
|
+
this.elRef = inject(ElementRef);
|
|
216
|
+
this._observer = new MutationObserver(() => {
|
|
217
|
+
this._getVisibleNodes();
|
|
218
|
+
});
|
|
219
|
+
/**
|
|
220
|
+
* The tree to be rendered
|
|
221
|
+
*/
|
|
222
|
+
this.tree = input.required();
|
|
223
|
+
/**
|
|
224
|
+
* Whether or not multiple nodes should be selectable. Only works when selection is enableed by
|
|
225
|
+
* setting 'selectable' attribute:
|
|
226
|
+
*
|
|
227
|
+
* ```html
|
|
228
|
+
* <yuv-tree selectable [multiselect]="true"></yuv-tree
|
|
229
|
+
* ```
|
|
230
|
+
*/
|
|
231
|
+
this.multiselect = input(false);
|
|
232
|
+
/**
|
|
233
|
+
* Host attribute to enable persistent selection of nodes.
|
|
234
|
+
*/
|
|
235
|
+
this.selectable = inject(new HostAttributeToken('selectable'), { optional: true });
|
|
236
|
+
this.__focusedIndex = -1;
|
|
237
|
+
/**
|
|
238
|
+
* Emitted when selection changes
|
|
239
|
+
*/
|
|
240
|
+
this.selectionChange = output();
|
|
241
|
+
this.tabindex = '0';
|
|
242
|
+
this.setTreeEffect = effect(() => {
|
|
243
|
+
this.treeService.setTree(this.tree());
|
|
244
|
+
// if (this.tree()) this.selectedNodes = [];
|
|
245
|
+
});
|
|
246
|
+
this.setTreeMultiselectEffect = effect(() => (this.treeService.multiselect = this.multiselect()));
|
|
247
|
+
this.treeService.nodeClick$.pipe(takeUntilDestroyed()).subscribe((node) => {
|
|
248
|
+
const idx = Array.from(this.items || []).findIndex((i) => i.getAttribute('node-id') === node.id);
|
|
249
|
+
if (idx !== -1)
|
|
250
|
+
this._focusedIndex = idx;
|
|
251
|
+
});
|
|
252
|
+
this.treeService.selection$.pipe(takeUntilDestroyed()).subscribe((selection) => {
|
|
253
|
+
this.selectionChange.emit(selection);
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
_toggle() {
|
|
257
|
+
this.treeService.toggleNode(this._getFocusedNodeId());
|
|
258
|
+
}
|
|
259
|
+
_selectFocusedNode(ctrlKey = false) {
|
|
260
|
+
const fid = this._getFocusedNodeId();
|
|
261
|
+
if (fid)
|
|
262
|
+
this.treeService.selectNodeByID(fid, ctrlKey);
|
|
263
|
+
}
|
|
264
|
+
_getFocusedNodeId() {
|
|
265
|
+
return Array.from(this.items || [])[this.__focusedIndex].getAttribute('node-id');
|
|
266
|
+
}
|
|
267
|
+
_getVisibleNodes() {
|
|
268
|
+
this.items = this.elRef.nativeElement.querySelectorAll('.node-label');
|
|
269
|
+
}
|
|
270
|
+
ngAfterViewInit() {
|
|
271
|
+
this._getVisibleNodes();
|
|
272
|
+
this._observer.observe(this.elRef.nativeElement, {
|
|
273
|
+
childList: true,
|
|
274
|
+
subtree: true
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
ngOnDestroy() {
|
|
278
|
+
this._observer.disconnect();
|
|
279
|
+
}
|
|
280
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TreeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
281
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: TreeComponent, isStandalone: true, selector: "yuv-tree", inputs: { tree: { classPropertyName: "tree", publicName: "tree", isSignal: true, isRequired: true, transformFunction: null }, multiselect: { classPropertyName: "multiselect", publicName: "multiselect", isSignal: true, isRequired: false, transformFunction: null }, selectedNodes: { classPropertyName: "selectedNodes", publicName: "selectedNodes", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { selectionChange: "selectionChange" }, host: { attributes: { "role": "tree" }, listeners: { "keydown": "onKeydown($event)" }, properties: { "class.selectable": "this.selectable", "attr.tabindex": "this.tabindex" }, classAttribute: "yuv-tree" }, providers: [TreeService], ngImport: i0, template: "@for (node of tree().nodes; track node.id) {\n <yuv-tree-node [node]=\"node\"></yuv-tree-node>\n}\n", styles: [":host{--toggle-icon-size: 18px;--node-padding: calc(var(--app-pane-padding) / 2);--node-indent: var(--toggle-icon-size)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: TreeNodeComponent, selector: "yuv-tree-node", inputs: ["node", "toggleIcon"] }] }); }
|
|
282
|
+
}
|
|
283
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TreeComponent, decorators: [{
|
|
284
|
+
type: Component,
|
|
285
|
+
args: [{ selector: 'yuv-tree', standalone: true, imports: [CommonModule, TreeNodeComponent], providers: [TreeService], host: {
|
|
286
|
+
class: 'yuv-tree',
|
|
287
|
+
role: 'tree'
|
|
288
|
+
}, template: "@for (node of tree().nodes; track node.id) {\n <yuv-tree-node [node]=\"node\"></yuv-tree-node>\n}\n", styles: [":host{--toggle-icon-size: 18px;--node-padding: calc(var(--app-pane-padding) / 2);--node-indent: var(--toggle-icon-size)}\n"] }]
|
|
289
|
+
}], ctorParameters: () => [], propDecorators: { selectable: [{
|
|
290
|
+
type: HostBinding,
|
|
291
|
+
args: ['class.selectable']
|
|
292
|
+
}], selectedNodes: [{
|
|
293
|
+
type: Input
|
|
294
|
+
}], tabindex: [{
|
|
295
|
+
type: HostBinding,
|
|
296
|
+
args: ['attr.tabindex']
|
|
297
|
+
}], onKeydown: [{
|
|
298
|
+
type: HostListener,
|
|
299
|
+
args: ['keydown', ['$event']]
|
|
300
|
+
}] } });
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Generated bundle index. Do not edit.
|
|
304
|
+
*/
|
|
305
|
+
|
|
306
|
+
export { TreeComponent };
|
|
307
|
+
//# sourceMappingURL=yuuvis-client-framework-tree.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yuuvis-client-framework-tree.mjs","sources":["../../../../../libs/yuuvis/client-framework/tree/src/lib/tree.service.ts","../../../../../libs/yuuvis/client-framework/tree/src/lib/tree-node/tree-node.component.ts","../../../../../libs/yuuvis/client-framework/tree/src/lib/tree-node/tree-node.component.html","../../../../../libs/yuuvis/client-framework/tree/src/lib/tree.component.ts","../../../../../libs/yuuvis/client-framework/tree/src/lib/tree.component.html","../../../../../libs/yuuvis/client-framework/tree/src/yuuvis-client-framework-tree.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { Observable, ReplaySubject, Subject } from 'rxjs';\nimport { Tree, TreeNode } from './tree.interface';\n\n@Injectable()\nexport class TreeService {\n private _tree?: Tree;\n private _selection: TreeNode[] = [];\n private _selectionSource = new ReplaySubject<TreeNode[]>();\n selection$: Observable<TreeNode[]> = this._selectionSource.asObservable();\n\n private _nodeClickSource = new Subject<TreeNode>();\n nodeClick$: Observable<TreeNode> = this._nodeClickSource.asObservable();\n\n private _nodeFocusSource = new ReplaySubject<string | null | undefined>();\n nodeFocus$: Observable<string | null | undefined> = this._nodeFocusSource.asObservable();\n\n multiselect = false;\n\n setTree(tree: Tree) {\n this._tree = tree;\n }\n\n focusNode(id: string | null | undefined) {\n this._nodeFocusSource.next(id);\n }\n\n toggleNode(id: string | null) {\n if (id) {\n const node = this._getNodeById(id);\n if (node) node.expanded = !node.expanded;\n }\n }\n\n selectNodeByID(id: string, ctrlKey = false) {\n const node = this._getNodeById(id);\n if (node) this.selectNode(node, ctrlKey);\n }\n\n /**\n * Select a tree node. If the node has already been selected it'll be\n * removed from the selection. Otherwise it will be added. By default selection\n * will only contain a single node. If `multiselect` is set to true and CTRL is\n * pressed the current collection will be extended.\n * @param node The tree node to be added/removed\n * @param ctrlKey Whether or not the CTRL key has been pressed\n * @returns The updated list of selected tree nodes\n */\n selectNode(node: TreeNode, ctrlKey = false): void {\n if (node.selectable) {\n if (!this.multiselect || !ctrlKey) {\n this._selection = [node];\n } else {\n const ids = this._selection.map((n) => n.id);\n if (ids.includes(node.id)) this._selection = this._selection.filter((n) => n.id !== node.id);\n else this._selection.push(node);\n }\n this._selectionSource.next(this._selection);\n }\n this._nodeClickSource.next(node);\n }\n\n setSelection(nodeIds: string[]) {\n this._resolveSelectedNodes(nodeIds);\n this._selectionSource.next(this._selection);\n }\n\n private _getNodeById(id: string): TreeNode | undefined {\n return this._tree ? this._getChildNodeById(id, this._tree.nodes) : undefined;\n }\n private _getChildNodeById(id: string, nodes: TreeNode[]): TreeNode | undefined {\n let match: TreeNode | undefined;\n nodes.forEach((n) => {\n if (n.id === id) match = n;\n if (!match && n.children) match = this._getChildNodeById(id, n.children);\n });\n return match;\n }\n\n private _resolveSelectedNodes(nodeIDs: string[]): void {\n this._selection = [];\n if (!this._tree) return;\n this._resolveChildren(nodeIDs, this._tree.nodes);\n }\n\n private _resolveChildren(nodeIDs: string[], nodes: TreeNode[]): void {\n nodes.forEach((n) => {\n if (nodeIDs.includes(n.id)) this._selection.push(n);\n if (n.children?.length) this._resolveChildren(nodeIDs, n.children);\n });\n }\n}\n","import { CommonModule } from '@angular/common';\nimport { Component, HostBinding, OnDestroy, OnInit, effect, inject, input } from '@angular/core';\nimport { YvcIconModule } from '@yuuvis/components/icon';\nimport { Subscription } from 'rxjs';\nimport { TreeNode } from '../tree.interface';\nimport { TreeService } from '../tree.service';\n\n@Component({\n selector: 'yuv-tree-node',\n standalone: true,\n imports: [CommonModule, YvcIconModule],\n templateUrl: './tree-node.component.html',\n styleUrl: './tree-node.component.scss',\n host: {\n role: 'treeitem'\n }\n})\nexport class TreeNodeComponent implements OnInit, OnDestroy {\n private treeService = inject(TreeService);\n\n node = input.required<TreeNode>();\n toggleIcon = input<string>(\n '<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"18px\" viewBox=\"0 -960 960 960\" width=\"18px\"><path d=\"M522-480 333-669l51-51 240 240-240 240-51-51 189-189Z\"/></svg>'\n );\n @HostBinding('class.focused') focused = false;\n @HostBinding('attr.aria-selected') selected = false;\n @HostBinding('attr.aria-expanded') expanded = false;\n\n private _selectedNodes: string[] = [];\n private _subs: Subscription[] = [];\n\n treeSelectEffect = effect(() => {\n this._setSelection();\n this.expanded = !!this.node().expanded;\n });\n\n select(evt: MouseEvent | KeyboardEvent) {\n this.treeService.selectNode(this.node(), evt.ctrlKey);\n }\n\n toggleExpanded() {\n this.node().expanded = !this.node().expanded;\n this.expanded = !!this.node().expanded;\n }\n\n private _setSelection() {\n if (!this.node()) return;\n this.selected = this._selectedNodes.includes(this.node().id);\n }\n\n ngOnInit(): void {\n this._subs.push(\n this.treeService.selection$.subscribe((selection: TreeNode[]) => {\n this._selectedNodes = selection.map((n) => n.id);\n this._setSelection();\n })\n );\n this._subs.push(\n this.treeService.nodeFocus$.subscribe((id: string | null | undefined) => {\n this.focused = this.node().id === id;\n })\n );\n }\n\n ngOnDestroy(): void {\n this._subs.forEach((s) => s.unsubscribe());\n }\n}\n","@if (node().children?.length) {\n <!-- toggle children button-->\n <!-- TODO: title should be i18n -->\n <button class=\"toggle\" (click)=\"toggleExpanded()\" title=\"toggle Expand\">\n <yvc-icon [svg]=\"toggleIcon()\"></yvc-icon>\n </button>\n}\n<div class=\"node-label\" [attr.node-id]=\"node().id\" [ngClass]=\"{ selectable: node().selectable }\" (click)=\"select($event)\">\n @if (node().icon) {\n <yvc-icon class=\"node-icon\" [svg]=\"node().icon!\"></yvc-icon>\n }\n <div class=\"label\">{{ node().label }}</div>\n</div>\n\n@if (node().expanded) {\n <div class=\"children\">\n @for (childNode of node().children; track $index) {\n <yuv-tree-node [toggleIcon]=\"toggleIcon()\" [node]=\"childNode\"></yuv-tree-node>\n }\n </div>\n}\n","import { CommonModule } from '@angular/common';\nimport {\n AfterViewInit,\n Component,\n ElementRef,\n HostAttributeToken,\n HostBinding,\n HostListener,\n Input,\n OnDestroy,\n effect,\n inject,\n input,\n output\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { TreeNodeComponent } from './tree-node/tree-node.component';\nimport { Tree, TreeNode } from './tree.interface';\nimport { TreeService } from './tree.service';\n\n/**\n * Component rendering a tree. \n */\n@Component({\n selector: 'yuv-tree',\n standalone: true,\n imports: [CommonModule, TreeNodeComponent],\n providers: [TreeService],\n templateUrl: './tree.component.html',\n styleUrl: './tree.component.scss',\n host: {\n class: 'yuv-tree',\n role: 'tree'\n }\n})\nexport class TreeComponent implements AfterViewInit, OnDestroy {\n private treeService = inject(TreeService);\n private elRef = inject(ElementRef);\n\n private items?: NodeListOf<HTMLElement>;\n\n private _observer = new MutationObserver(() => {\n this._getVisibleNodes();\n });\n\n /**\n * The tree to be rendered\n */\n tree = input.required<Tree>();\n\n /**\n * Whether or not multiple nodes should be selectable. Only works when selection is enableed by \n * setting 'selectable' attribute:\n * \n * ```html\n * <yuv-tree selectable [multiselect]=\"true\"></yuv-tree\n * ```\n */\n multiselect = input<boolean>(false);\n\n /**\n * Host attribute to enable persistent selection of nodes. \n */\n @HostBinding('class.selectable')\n selectable: string | null = inject(new HostAttributeToken('selectable'), { optional: true });\n\n private __focusedIndex = -1;\n private set _focusedIndex(idx: number) {\n this.__focusedIndex = idx;\n this.treeService.focusNode(this.items?.item(idx).getAttribute('node-id'));\n }\n get _focusedIndex() {\n return this.__focusedIndex;\n }\n\n /**\n * IDs of nodes that should be set 'selected'.\n */\n @Input() set selectedNodes(nodeIds: string[]) {\n this.treeService.setSelection(nodeIds);\n }\n\n /**\n * Emitted when selection changes\n */\n selectionChange = output<TreeNode[]>();\n\n @HostBinding('attr.tabindex') readonly tabindex = '0';\n @HostListener('keydown', ['$event']) onKeydown(event: KeyboardEvent) {\n switch (event.code) {\n case 'ArrowDown': {\n if ((this.items && this._focusedIndex === this.items.length - 1) || this.__focusedIndex === -1) {\n this._focusedIndex = 0;\n } else this._focusedIndex++;\n break;\n }\n case 'ArrowUp': {\n if (this.items && (this._focusedIndex === 0 || this.__focusedIndex === -1)) {\n this._focusedIndex = this.items.length - 1;\n } else this._focusedIndex--;\n break;\n }\n case 'ArrowRight': {\n this._toggle();\n break;\n }\n case 'ArrowLeft': {\n this._toggle();\n break;\n }\n case 'Space': {\n this._selectFocusedNode(event.ctrlKey);\n break;\n }\n case 'Enter': {\n this._selectFocusedNode(event.ctrlKey);\n break;\n }\n }\n }\n setTreeEffect = effect(() => {\n this.treeService.setTree(this.tree());\n // if (this.tree()) this.selectedNodes = [];\n });\n setTreeMultiselectEffect = effect(() => (this.treeService.multiselect = this.multiselect()));\n\n constructor() {\n this.treeService.nodeClick$.pipe(takeUntilDestroyed()).subscribe((node) => {\n const idx = Array.from(this.items || []).findIndex((i) => i.getAttribute('node-id') === node.id);\n if (idx !== -1) this._focusedIndex = idx;\n });\n this.treeService.selection$.pipe(takeUntilDestroyed()).subscribe((selection) => {\n this.selectionChange.emit(selection);\n });\n }\n\n private _toggle() {\n this.treeService.toggleNode(this._getFocusedNodeId());\n }\n\n private _selectFocusedNode(ctrlKey = false) {\n const fid = this._getFocusedNodeId();\n if (fid) this.treeService.selectNodeByID(fid, ctrlKey);\n }\n\n private _getFocusedNodeId(): string | null {\n return Array.from(this.items || [])[this.__focusedIndex].getAttribute('node-id');\n }\n\n private _getVisibleNodes() {\n this.items = (this.elRef.nativeElement as HTMLElement).querySelectorAll<HTMLElement>('.node-label');\n }\n\n ngAfterViewInit(): void {\n this._getVisibleNodes();\n this._observer.observe(this.elRef.nativeElement, {\n childList: true,\n subtree: true\n });\n }\n\n ngOnDestroy(): void {\n this._observer.disconnect();\n }\n}\n","@for (node of tree().nodes; track node.id) {\n <yuv-tree-node [node]=\"node\"></yuv-tree-node>\n}\n","/**\n * Generated bundle index. Do not edit.\n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,CAAC,WAAW,CAAC,EAGlB,IAAA,EAAA;AACJ,wBAAA,KAAK,EAAE,UAAU;AACjB,wBAAA,IAAI,EAAE,MAAM;AACb,qBAAA,EAAA,QAAA,EAAA,sGAAA,EAAA,MAAA,EAAA,CAAA,4HAAA,CAAA,EAAA,CAAA;wDA+BD,UAAU,EAAA,CAAA;sBADT,WAAW;uBAAC,kBAAkB,CAAA;gBAelB,aAAa,EAAA,CAAA;sBAAzB,KAAK;gBASiC,QAAQ,EAAA,CAAA;sBAA9C,WAAW;uBAAC,eAAe,CAAA;gBACS,SAAS,EAAA,CAAA;sBAA7C,YAAY;uBAAC,SAAS,EAAE,CAAC,QAAQ,CAAC,CAAA;;;AExFrC;;AAEG;;;;"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import * as i1 from '@angular/common';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { inject, input, computed, output, Component, HostBinding } from '@angular/core';
|
|
5
|
+
import * as i3 from '@yuuvis/client-core';
|
|
6
|
+
import { UploadService, TranslateService, TranslateModule } from '@yuuvis/client-core';
|
|
7
|
+
import { YUV_ICONS } from '@yuuvis/client-framework/icons';
|
|
8
|
+
import * as i2 from '@yuuvis/components/icon';
|
|
9
|
+
import { ICONS, YvcIconModule } from '@yuuvis/components/icon';
|
|
10
|
+
|
|
11
|
+
class UploadProgressOverlayComponent {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.#uploadService = inject(UploadService);
|
|
14
|
+
this.translate = inject(TranslateService);
|
|
15
|
+
this.items = input();
|
|
16
|
+
this._items = computed(() => {
|
|
17
|
+
const items = this.items() || [];
|
|
18
|
+
items.forEach((item) => {
|
|
19
|
+
if (item.err) {
|
|
20
|
+
item.err.message = this.#getErrorMessage(item.err.code);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
return items;
|
|
24
|
+
});
|
|
25
|
+
this.itemClick = output();
|
|
26
|
+
this.icons = {
|
|
27
|
+
remove: ICONS.clear,
|
|
28
|
+
done: YUV_ICONS.check,
|
|
29
|
+
err: YUV_ICONS.attention
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
#uploadService;
|
|
33
|
+
remove(id) {
|
|
34
|
+
this.#uploadService.cancelItem(id);
|
|
35
|
+
}
|
|
36
|
+
#getErrorMessage(status) {
|
|
37
|
+
switch (status) {
|
|
38
|
+
case 403:
|
|
39
|
+
return this.translate.instant('yuv.upload-progress-overlay.error.403');
|
|
40
|
+
default:
|
|
41
|
+
return this.translate.instant('yuv.upload-progress-overlay.error.default');
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: UploadProgressOverlayComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
45
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: UploadProgressOverlayComponent, isStandalone: true, selector: "yuv-upload-progress-overlay", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { itemClick: "itemClick" }, ngImport: i0, template: "<ul>\n @for (item of _items(); track item.id) {\n @let progress = item.progress | async;\n <li [ngClass]=\"{ err: !!item.err, done: !!item.result }\" [style.--progress]=\"progress + '%'\">\n <button class=\"remove\" (click)=\"remove(item.id)\">\n <yvc-icon [svg]=\"icons.remove\" [ngClass]=\"{ err: !!item.err }\"></yvc-icon>\n </button>\n\n @if (!item.result) {\n <div class=\"name\">{{ item.filename }}\n @if(item.err) {\n <span class=\"error\">{{item.err.message}}</span>\n }\n </div>\n <div class=\"progress\">\n @if (progress && progress < 100) {\n <div class=\"percentage\">{{ progress }}</div>\n } \n @else if(item.err) {\n <yvc-icon class=\"error\" [svg]=\"icons.err\"></yvc-icon>\n }\n @else {\n <div class=\"yuv-loader-straight\"></div>\n }\n </div>\n } @else {\n <div class=\"result-items\">\n @for (res of item.result; track $index) {\n <div class=\"result-item\">\n <div class=\"name\" (click)=\"itemClick.emit(res)\">\n {{ res.label }}\n </div>\n </div>\n }\n </div>\n <yvc-icon class=\"done\" [svg]=\"icons.done\"></yvc-icon>\n }\n </li>\n }\n</ul>\n", styles: [":host ul{list-style:none;padding:0;margin:calc(var(--app-pane-padding) / 2) 0}:host li{--hover-background: transparent;display:grid;grid-template-columns:1fr auto auto;grid-template-rows:auto;cursor:default;grid-template-areas:\"result progress action\";align-items:center;padding:calc(var(--app-pane-padding) / 4) calc(var(--app-pane-padding) / 4) calc(var(--app-pane-padding) / 4) calc(var(--app-pane-padding) / 2);gap:.5em;margin-block-end:1px;background:linear-gradient(90deg,rgba(var(--color-accent-rgb),.1) 0%,rgba(var(--color-accent-rgb),.3) var(--progress),var(--hover-background) var(--progress));transition:background-color .3s ease-in-out}:host li.done{background:var(--hover-background)}:host li:hover{--hover-background: var(--item-focus-background-color)}:host li .name{grid-area:result;max-width:35ch;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host li .name .error{color:var(--text-color-caption);display:block;font-style:italic;max-width:35ch}:host li .yuv-loader-straight{scale:-.5}:host li .progress{grid-area:progress}:host li .percentage{font-family:monospace;padding:calc(var(--app-pane-padding) / 4) var(--app-pane-padding);font-size:var(--font-hint);color:var(--text-color-caption);align-self:center}:host li .percentage:after{content:\"%\"}:host li yvc-icon.done{--icon-size: 18px;fill:var(--color-accent)}:host li .remove{grid-area:action;padding:0}:host li .remove yvc-icon{color:var(--text-color-hint)}:host .result-items{grid-area:result}:host .result-items .result-item{cursor:pointer}:host yvc-icon{--icon-size: 18px;border-radius:4px}:host yvc-icon.done{background-color:var(--color-accent);color:var(--color-accent-tone)}:host yvc-icon.error{color:var(--color-error)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "ngmodule", type: YvcIconModule }, { kind: "component", type: i2.Icon, selector: "yvc-icon", inputs: ["label", "svg", "svgSrc"] }, { kind: "ngmodule", type: TranslateModule }] }); }
|
|
46
|
+
}
|
|
47
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: UploadProgressOverlayComponent, decorators: [{
|
|
48
|
+
type: Component,
|
|
49
|
+
args: [{ selector: 'yuv-upload-progress-overlay', standalone: true, imports: [CommonModule, YvcIconModule, TranslateModule], template: "<ul>\n @for (item of _items(); track item.id) {\n @let progress = item.progress | async;\n <li [ngClass]=\"{ err: !!item.err, done: !!item.result }\" [style.--progress]=\"progress + '%'\">\n <button class=\"remove\" (click)=\"remove(item.id)\">\n <yvc-icon [svg]=\"icons.remove\" [ngClass]=\"{ err: !!item.err }\"></yvc-icon>\n </button>\n\n @if (!item.result) {\n <div class=\"name\">{{ item.filename }}\n @if(item.err) {\n <span class=\"error\">{{item.err.message}}</span>\n }\n </div>\n <div class=\"progress\">\n @if (progress && progress < 100) {\n <div class=\"percentage\">{{ progress }}</div>\n } \n @else if(item.err) {\n <yvc-icon class=\"error\" [svg]=\"icons.err\"></yvc-icon>\n }\n @else {\n <div class=\"yuv-loader-straight\"></div>\n }\n </div>\n } @else {\n <div class=\"result-items\">\n @for (res of item.result; track $index) {\n <div class=\"result-item\">\n <div class=\"name\" (click)=\"itemClick.emit(res)\">\n {{ res.label }}\n </div>\n </div>\n }\n </div>\n <yvc-icon class=\"done\" [svg]=\"icons.done\"></yvc-icon>\n }\n </li>\n }\n</ul>\n", styles: [":host ul{list-style:none;padding:0;margin:calc(var(--app-pane-padding) / 2) 0}:host li{--hover-background: transparent;display:grid;grid-template-columns:1fr auto auto;grid-template-rows:auto;cursor:default;grid-template-areas:\"result progress action\";align-items:center;padding:calc(var(--app-pane-padding) / 4) calc(var(--app-pane-padding) / 4) calc(var(--app-pane-padding) / 4) calc(var(--app-pane-padding) / 2);gap:.5em;margin-block-end:1px;background:linear-gradient(90deg,rgba(var(--color-accent-rgb),.1) 0%,rgba(var(--color-accent-rgb),.3) var(--progress),var(--hover-background) var(--progress));transition:background-color .3s ease-in-out}:host li.done{background:var(--hover-background)}:host li:hover{--hover-background: var(--item-focus-background-color)}:host li .name{grid-area:result;max-width:35ch;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host li .name .error{color:var(--text-color-caption);display:block;font-style:italic;max-width:35ch}:host li .yuv-loader-straight{scale:-.5}:host li .progress{grid-area:progress}:host li .percentage{font-family:monospace;padding:calc(var(--app-pane-padding) / 4) var(--app-pane-padding);font-size:var(--font-hint);color:var(--text-color-caption);align-self:center}:host li .percentage:after{content:\"%\"}:host li yvc-icon.done{--icon-size: 18px;fill:var(--color-accent)}:host li .remove{grid-area:action;padding:0}:host li .remove yvc-icon{color:var(--text-color-hint)}:host .result-items{grid-area:result}:host .result-items .result-item{cursor:pointer}:host yvc-icon{--icon-size: 18px;border-radius:4px}:host yvc-icon.done{background-color:var(--color-accent);color:var(--color-accent-tone)}:host yvc-icon.error{color:var(--color-error)}\n"] }]
|
|
50
|
+
}] });
|
|
51
|
+
|
|
52
|
+
class UploadProgressComponent {
|
|
53
|
+
constructor() {
|
|
54
|
+
this.#uploadService = inject(UploadService);
|
|
55
|
+
this.progressStatus$ = this.#uploadService.status$;
|
|
56
|
+
this.completedUp$ = this.#uploadService.uploadStatus$;
|
|
57
|
+
this.icons = {
|
|
58
|
+
toggle: YUV_ICONS.arrowDown,
|
|
59
|
+
close: ICONS.clear
|
|
60
|
+
};
|
|
61
|
+
this.expanded = true;
|
|
62
|
+
this.resultItemClick = output();
|
|
63
|
+
}
|
|
64
|
+
#uploadService;
|
|
65
|
+
close() {
|
|
66
|
+
this.#uploadService.cancelItem();
|
|
67
|
+
}
|
|
68
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: UploadProgressComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
69
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: UploadProgressComponent, isStandalone: true, selector: "yuv-upload-progress", outputs: { resultItemClick: "resultItemClick" }, host: { properties: { "class.expanded": "this.expanded" } }, ngImport: i0, template: "@let ps = progressStatus$ | async;\n@if (ps && ps.items.length) {\n @let completed = completedUp$ | async;\n\n <div class=\"upload-progress\">\n <header>\n <h4>\n @if (!completed) {\n {{ 'yuv.upload-progress.header.uploading' | translate: { count: ps.items.length } }}\n } @else {\n {{ 'yuv.upload-progress.header.uploaded' | translate: { count: ps.items.length } }}\n }\n </h4>\n <button (click)=\"expanded = !expanded\"><yvc-icon class=\"toggle\" [svg]=\"icons.toggle\"></yvc-icon></button>\n <button (click)=\"close()\"><yvc-icon [svg]=\"icons.close\"></yvc-icon></button>\n </header>\n @if (expanded) {\n <yuv-upload-progress-overlay [items]=\"ps.items\" (itemClick)=\"resultItemClick.emit($event)\"></yuv-upload-progress-overlay>\n }\n </div>\n}\n", styles: [":host{--upload-progress-background-header: var(--panel-background-grey);--upload-progress-background-main: var(--panel-background);--upload-progress-border-color: var(--panel-background);--upload-progress-outline: 4px solid rgb(from var(--panel-divider-color) r g b / .9);--upload-progress-border-radius: calc(var(--app-pane-padding) / 4);position:absolute;inset-block-end:var(--app-pane-padding);inset-inline-end:var(--app-pane-padding);z-index:1000}:host .upload-progress{display:flex;flex-flow:column;background-color:var(--upload-progress-background-main);border:1px solid var(--upload-progress-border-color);border-radius:var(--upload-progress-border-radius);outline:var(--upload-progress-outline);min-width:250px;max-height:30vh;overflow:hidden;animation:appear .3s ease-in-out}:host .toggle{rotate:180deg}:host.expanded .toggle{rotate:0deg}:host header{display:flex;align-items:center;gap:calc(var(--app-pane-padding) / 4);background-color:var(--upload-progress-background-header);padding:calc(var(--app-pane-padding) / 4)}:host header h4{margin:0;padding:0 calc(var(--app-pane-padding) / 2);flex:1}:host header button{padding:0;border-radius:4px;--icon-size: 18px}:host yuv-upload-progress-overlay{overflow-y:auto}@keyframes appear{0%{opacity:0;transform:translateY(var(--app-pane-padding))}to{opacity:1;transform:translateY(0)}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i1.AsyncPipe, name: "async" }, { kind: "ngmodule", type: YvcIconModule }, { kind: "component", type: i2.Icon, selector: "yvc-icon", inputs: ["label", "svg", "svgSrc"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i3.TranslatePipe, name: "translate" }, { kind: "component", type: UploadProgressOverlayComponent, selector: "yuv-upload-progress-overlay", inputs: ["items"], outputs: ["itemClick"] }] }); }
|
|
70
|
+
}
|
|
71
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: UploadProgressComponent, decorators: [{
|
|
72
|
+
type: Component,
|
|
73
|
+
args: [{ selector: 'yuv-upload-progress', standalone: true, imports: [CommonModule, YvcIconModule, TranslateModule, UploadProgressOverlayComponent], template: "@let ps = progressStatus$ | async;\n@if (ps && ps.items.length) {\n @let completed = completedUp$ | async;\n\n <div class=\"upload-progress\">\n <header>\n <h4>\n @if (!completed) {\n {{ 'yuv.upload-progress.header.uploading' | translate: { count: ps.items.length } }}\n } @else {\n {{ 'yuv.upload-progress.header.uploaded' | translate: { count: ps.items.length } }}\n }\n </h4>\n <button (click)=\"expanded = !expanded\"><yvc-icon class=\"toggle\" [svg]=\"icons.toggle\"></yvc-icon></button>\n <button (click)=\"close()\"><yvc-icon [svg]=\"icons.close\"></yvc-icon></button>\n </header>\n @if (expanded) {\n <yuv-upload-progress-overlay [items]=\"ps.items\" (itemClick)=\"resultItemClick.emit($event)\"></yuv-upload-progress-overlay>\n }\n </div>\n}\n", styles: [":host{--upload-progress-background-header: var(--panel-background-grey);--upload-progress-background-main: var(--panel-background);--upload-progress-border-color: var(--panel-background);--upload-progress-outline: 4px solid rgb(from var(--panel-divider-color) r g b / .9);--upload-progress-border-radius: calc(var(--app-pane-padding) / 4);position:absolute;inset-block-end:var(--app-pane-padding);inset-inline-end:var(--app-pane-padding);z-index:1000}:host .upload-progress{display:flex;flex-flow:column;background-color:var(--upload-progress-background-main);border:1px solid var(--upload-progress-border-color);border-radius:var(--upload-progress-border-radius);outline:var(--upload-progress-outline);min-width:250px;max-height:30vh;overflow:hidden;animation:appear .3s ease-in-out}:host .toggle{rotate:180deg}:host.expanded .toggle{rotate:0deg}:host header{display:flex;align-items:center;gap:calc(var(--app-pane-padding) / 4);background-color:var(--upload-progress-background-header);padding:calc(var(--app-pane-padding) / 4)}:host header h4{margin:0;padding:0 calc(var(--app-pane-padding) / 2);flex:1}:host header button{padding:0;border-radius:4px;--icon-size: 18px}:host yuv-upload-progress-overlay{overflow-y:auto}@keyframes appear{0%{opacity:0;transform:translateY(var(--app-pane-padding))}to{opacity:1;transform:translateY(0)}}\n"] }]
|
|
74
|
+
}], propDecorators: { expanded: [{
|
|
75
|
+
type: HostBinding,
|
|
76
|
+
args: ['class.expanded']
|
|
77
|
+
}] } });
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Generated bundle index. Do not edit.
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
export { UploadProgressComponent };
|
|
84
|
+
//# sourceMappingURL=yuuvis-client-framework-upload-progress.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yuuvis-client-framework-upload-progress.mjs","sources":["../../../../../libs/yuuvis/client-framework/upload-progress/src/lib/upload-progress/upload-progress-overlay/upload-progress-overlay.component.ts","../../../../../libs/yuuvis/client-framework/upload-progress/src/lib/upload-progress/upload-progress-overlay/upload-progress-overlay.component.html","../../../../../libs/yuuvis/client-framework/upload-progress/src/lib/upload-progress/upload-progress.component.ts","../../../../../libs/yuuvis/client-framework/upload-progress/src/lib/upload-progress/upload-progress.component.html","../../../../../libs/yuuvis/client-framework/upload-progress/src/yuuvis-client-framework-upload-progress.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport { Component, computed, inject, input, output } from '@angular/core';\nimport { ProgressStatusItem, TranslateModule, TranslateService, UploadResult, UploadService } from '@yuuvis/client-core';\nimport { YUV_ICONS } from '@yuuvis/client-framework/icons';\nimport { ICONS, YvcIconModule } from '@yuuvis/components/icon';\n\n@Component({\n selector: 'yuv-upload-progress-overlay',\n standalone: true,\n imports: [CommonModule, YvcIconModule, TranslateModule],\n templateUrl: './upload-progress-overlay.component.html',\n styleUrl: './upload-progress-overlay.component.scss'\n})\nexport class UploadProgressOverlayComponent {\n #uploadService = inject(UploadService);\n translate = inject(TranslateService);\n\n items = input<ProgressStatusItem[]>();\n _items = computed(() => {\n const items = this.items() || [];\n items.forEach((item) => {\n if (item.err) {\n item.err.message = this.#getErrorMessage(item.err.code);\n }\n });\n return items;\n });\n itemClick = output<UploadResult>();\n\n icons = {\n remove: ICONS.clear,\n done: YUV_ICONS.check,\n err: YUV_ICONS.attention\n };\n\n remove(id?: string) {\n this.#uploadService.cancelItem(id);\n }\n\n #getErrorMessage(status: number): string {\n switch (status) {\n case 403:\n return this.translate.instant('yuv.upload-progress-overlay.error.403');\n default:\n return this.translate.instant('yuv.upload-progress-overlay.error.default');\n }\n }\n}\n","<ul>\n @for (item of _items(); track item.id) {\n @let progress = item.progress | async;\n <li [ngClass]=\"{ err: !!item.err, done: !!item.result }\" [style.--progress]=\"progress + '%'\">\n <button class=\"remove\" (click)=\"remove(item.id)\">\n <yvc-icon [svg]=\"icons.remove\" [ngClass]=\"{ err: !!item.err }\"></yvc-icon>\n </button>\n\n @if (!item.result) {\n <div class=\"name\">{{ item.filename }}\n @if(item.err) {\n <span class=\"error\">{{item.err.message}}</span>\n }\n </div>\n <div class=\"progress\">\n @if (progress && progress < 100) {\n <div class=\"percentage\">{{ progress }}</div>\n } \n @else if(item.err) {\n <yvc-icon class=\"error\" [svg]=\"icons.err\"></yvc-icon>\n }\n @else {\n <div class=\"yuv-loader-straight\"></div>\n }\n </div>\n } @else {\n <div class=\"result-items\">\n @for (res of item.result; track $index) {\n <div class=\"result-item\">\n <div class=\"name\" (click)=\"itemClick.emit(res)\">\n {{ res.label }}\n </div>\n </div>\n }\n </div>\n <yvc-icon class=\"done\" [svg]=\"icons.done\"></yvc-icon>\n }\n </li>\n }\n</ul>\n","import { CommonModule } from '@angular/common';\nimport { Component, HostBinding, inject, output } from '@angular/core';\nimport { TranslateModule, UploadResult, UploadService } from '@yuuvis/client-core';\nimport { YUV_ICONS } from '@yuuvis/client-framework/icons';\nimport { ICONS, YvcIconModule } from '@yuuvis/components/icon';\nimport { UploadProgressOverlayComponent } from './upload-progress-overlay/upload-progress-overlay.component';\n\n@Component({\n selector: 'yuv-upload-progress',\n standalone: true,\n imports: [CommonModule, YvcIconModule, TranslateModule, UploadProgressOverlayComponent],\n templateUrl: './upload-progress.component.html',\n styleUrl: './upload-progress.component.scss'\n})\nexport class UploadProgressComponent {\n #uploadService = inject(UploadService);\n progressStatus$ = this.#uploadService.status$;\n completedUp$ = this.#uploadService.uploadStatus$;\n\n icons = {\n toggle: YUV_ICONS.arrowDown,\n close: ICONS.clear\n };\n\n @HostBinding('class.expanded') expanded = true;\n resultItemClick = output<UploadResult>();\n\n close() {\n this.#uploadService.cancelItem();\n }\n}\n","@let ps = progressStatus$ | async;\n@if (ps && ps.items.length) {\n @let completed = completedUp$ | async;\n\n <div class=\"upload-progress\">\n <header>\n <h4>\n @if (!completed) {\n {{ 'yuv.upload-progress.header.uploading' | translate: { count: ps.items.length } }}\n } @else {\n {{ 'yuv.upload-progress.header.uploaded' | translate: { count: ps.items.length } }}\n }\n </h4>\n <button (click)=\"expanded = !expanded\"><yvc-icon class=\"toggle\" [svg]=\"icons.toggle\"></yvc-icon></button>\n <button (click)=\"close()\"><yvc-icon [svg]=\"icons.close\"></yvc-icon></button>\n </header>\n @if (expanded) {\n <yuv-upload-progress-overlay [items]=\"ps.items\" (itemClick)=\"resultItemClick.emit($event)\"></yuv-upload-progress-overlay>\n }\n </div>\n}\n","/**\n * Generated bundle index. Do not edit.\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BAA8B,EAAA,QAAA,EAAA,6BAAA,EAAA,MAAA,EAAA,CAAA,OAAA,CAAA,EAAA,OAAA,EAAA,CAAA,WAAA,CAAA,EAAA,CAAA,EAAA,CAAA,CAAA,EAAA;;4FAI3E,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBAPnC,SAAS;+BACE,qBAAqB,EAAA,UAAA,EACnB,IAAI,EAAA,OAAA,EACP,CAAC,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,8BAA8B,CAAC,EAAA,QAAA,EAAA,i0BAAA,EAAA,MAAA,EAAA,CAAA,6zCAAA,CAAA,EAAA,CAAA;8BAcxD,QAAQ,EAAA,CAAA;sBAAtC,WAAW;uBAAC,gBAAgB,CAAA;;;AExB/B;;AAEG;;;;"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Component, Input, HostBinding, NgModule } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/platform-browser';
|
|
4
|
+
import { CommonModule } from '@angular/common';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Component rendering a users avatar. If there is no avatar image availbale, the
|
|
8
|
+
* component will render the initials of the user, but only if we can fetch a first-
|
|
9
|
+
* and lastname. Otherwise there will be a fallback image.
|
|
10
|
+
*
|
|
11
|
+
* [Screenshot](../assets/images/yuv-user-avatar.gif)
|
|
12
|
+
*
|
|
13
|
+
*
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
class UserAvatarComponent {
|
|
17
|
+
/**
|
|
18
|
+
* The user to display the avatar image for.
|
|
19
|
+
*/
|
|
20
|
+
set user(u) {
|
|
21
|
+
if (!!u && !this.currentUserId || u?.id !== this.currentUserId) {
|
|
22
|
+
this.getUserImage(u);
|
|
23
|
+
}
|
|
24
|
+
this.currentUserId = u?.id;
|
|
25
|
+
}
|
|
26
|
+
constructor(sanitizer, elRef, renderer) {
|
|
27
|
+
this.sanitizer = sanitizer;
|
|
28
|
+
this.elRef = elRef;
|
|
29
|
+
this.renderer = renderer;
|
|
30
|
+
this.defaultUserImage = 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="rgba(0,0,0,.2)"><path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/></svg>';
|
|
31
|
+
this.img = null;
|
|
32
|
+
this.setDefaulUserImage();
|
|
33
|
+
}
|
|
34
|
+
getUserImage(user) {
|
|
35
|
+
if (user && user.image) {
|
|
36
|
+
this.img = this.sanitizer.bypassSecurityTrustStyle(`url('${user.image}')`);
|
|
37
|
+
}
|
|
38
|
+
else if (user && !user.image && user.firstname && user.lastname) {
|
|
39
|
+
this.img = null;
|
|
40
|
+
this.elRef.nativeElement.classList.add('initials');
|
|
41
|
+
const initials = document.createElement('div');
|
|
42
|
+
// scale initials font-size based on the containers size
|
|
43
|
+
const rect = this.elRef.nativeElement.getBoundingClientRect();
|
|
44
|
+
// when rendered invisible the width will be 0px
|
|
45
|
+
if (rect.width > 0) {
|
|
46
|
+
initials.style.fontSize = `${rect.width * 0.5}px`;
|
|
47
|
+
}
|
|
48
|
+
initials.innerText = `${user.firstname.substr(0, 1)}${user.lastname.substr(0, 1)}`;
|
|
49
|
+
this.renderer.appendChild(this.elRef.nativeElement, initials);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
this.setDefaulUserImage();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
setDefaulUserImage() {
|
|
56
|
+
this.img = this.sanitizer.bypassSecurityTrustStyle(`url('${this.defaultUserImage}')`);
|
|
57
|
+
}
|
|
58
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: UserAvatarComponent, deps: [{ token: i1.DomSanitizer }, { token: i0.ElementRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
59
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.13", type: UserAvatarComponent, selector: "yuv-user-avatar", inputs: { user: "user" }, host: { properties: { "style.backgroundImage": "this.img" }, classAttribute: "yuv-user-avatar" }, ngImport: i0, template: '', isInline: true, styles: [":host{display:flex;flex-flow:column;align-items:center;justify-content:center;height:100%;box-sizing:border-box;background-repeat:no-repeat;background-size:cover;background-position:center center}:host.initials{background-color:var(--color-accent);color:var(--color-accent-tone)}:host.initials>div{font-weight:var(--font-weight-bold);opacity:.8}\n"] }); }
|
|
60
|
+
}
|
|
61
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: UserAvatarComponent, decorators: [{
|
|
62
|
+
type: Component,
|
|
63
|
+
args: [{ selector: 'yuv-user-avatar', template: '', host: { class: 'yuv-user-avatar' }, styles: [":host{display:flex;flex-flow:column;align-items:center;justify-content:center;height:100%;box-sizing:border-box;background-repeat:no-repeat;background-size:cover;background-position:center center}:host.initials{background-color:var(--color-accent);color:var(--color-accent-tone)}:host.initials>div{font-weight:var(--font-weight-bold);opacity:.8}\n"] }]
|
|
64
|
+
}], ctorParameters: () => [{ type: i1.DomSanitizer }, { type: i0.ElementRef }, { type: i0.Renderer2 }], propDecorators: { user: [{
|
|
65
|
+
type: Input
|
|
66
|
+
}], img: [{
|
|
67
|
+
type: HostBinding,
|
|
68
|
+
args: ['style.backgroundImage']
|
|
69
|
+
}] } });
|
|
70
|
+
|
|
71
|
+
class YuvUserAvatarModule {
|
|
72
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: YuvUserAvatarModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
73
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: YuvUserAvatarModule, declarations: [UserAvatarComponent], imports: [CommonModule], exports: [UserAvatarComponent] }); }
|
|
74
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: YuvUserAvatarModule, imports: [CommonModule] }); }
|
|
75
|
+
}
|
|
76
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: YuvUserAvatarModule, decorators: [{
|
|
77
|
+
type: NgModule,
|
|
78
|
+
args: [{
|
|
79
|
+
declarations: [
|
|
80
|
+
UserAvatarComponent
|
|
81
|
+
],
|
|
82
|
+
imports: [
|
|
83
|
+
CommonModule
|
|
84
|
+
],
|
|
85
|
+
exports: [
|
|
86
|
+
UserAvatarComponent
|
|
87
|
+
]
|
|
88
|
+
}]
|
|
89
|
+
}] });
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Generated bundle index. Do not edit.
|
|
93
|
+
*/
|
|
94
|
+
|
|
95
|
+
export { UserAvatarComponent, YuvUserAvatarModule };
|
|
96
|
+
//# sourceMappingURL=yuuvis-client-framework-user-avatar.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"yuuvis-client-framework-user-avatar.mjs","sources":["../../../../../libs/yuuvis/client-framework/user-avatar/src/lib/user-avatar.component.ts","../../../../../libs/yuuvis/client-framework/user-avatar/src/lib/user-avatar.module.ts","../../../../../libs/yuuvis/client-framework/user-avatar/src/yuuvis-client-framework-user-avatar.ts"],"sourcesContent":["import { Component, ElementRef, HostBinding, Input, Renderer2 } from '@angular/core';\nimport { DomSanitizer, SafeStyle } from '@angular/platform-browser';\n// import { YuvUser } from '@yuuvis/client-core';\n\n\nexport interface YuvUser {\n id: string;\n username: string;\n firstname: string;\n lastname: string;\n title: string;\n email: string;\n image: string;\n tenant: string;\n domain: string;\n authorities: string[];\n substituteOf: string[];\n enabled: boolean;\n}\n\n/**\n * Component rendering a users avatar. If there is no avatar image availbale, the\n * component will render the initials of the user, but only if we can fetch a first-\n * and lastname. Otherwise there will be a fallback image.\n *\n * [Screenshot](../assets/images/yuv-user-avatar.gif)\n *\n *\n *\n */\n@Component({\n selector: 'yuv-user-avatar',\n template: '',\n styleUrls: ['./user-avatar.component.scss'],\n host: { class: 'yuv-user-avatar' }\n})\nexport class UserAvatarComponent {\n private currentUserId?: string;\n private defaultUserImage =\n 'data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"rgba(0,0,0,.2)\"><path d=\"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z\"/></svg>';\n\n /**\n * The user to display the avatar image for.\n */\n @Input()\n set user(u: YuvUser | undefined) {\n if (!!u && !this.currentUserId || u?.id !== this.currentUserId) {\n this.getUserImage(u!);\n }\n this.currentUserId = u?.id;\n }\n @HostBinding('style.backgroundImage') img: SafeStyle | null = null;\n\n constructor(private sanitizer: DomSanitizer, private elRef: ElementRef, private renderer: Renderer2) {\n this.setDefaulUserImage();\n }\n\n getUserImage(user: YuvUser) {\n if (user && user.image) {\n this.img = this.sanitizer.bypassSecurityTrustStyle(`url('${user.image}')`);\n } else if (user && !user.image && user.firstname && user.lastname) {\n this.img = null;\n this.elRef.nativeElement.classList.add('initials');\n const initials: HTMLElement = document.createElement('div');\n // scale initials font-size based on the containers size\n const rect = this.elRef.nativeElement.getBoundingClientRect();\n // when rendered invisible the width will be 0px\n if (rect.width > 0) {\n initials.style.fontSize = `${rect.width * 0.5}px`;\n }\n initials.innerText = `${user.firstname.substr(0, 1)}${user.lastname.substr(0, 1)}`;\n this.renderer.appendChild(this.elRef.nativeElement, initials);\n } else {\n this.setDefaulUserImage();\n }\n }\n\n private setDefaulUserImage() {\n this.img = this.sanitizer.bypassSecurityTrustStyle(`url('${this.defaultUserImage}')`);\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { UserAvatarComponent } from './user-avatar.component';\n\n@NgModule({\n declarations: [\n UserAvatarComponent\n ],\n imports: [\n CommonModule\n ],\n exports: [\n UserAvatarComponent\n ]\n})\nexport class YuvUserAvatarModule { }\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAoBA;;;;;;;;;AASG;MAOU,mBAAmB,CAAA;AAK9B;;AAEG;IACH,IACI,IAAI,CAAC,CAAsB,EAAA;AAC7B,QAAA,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,IAAI,CAAC,EAAE,EAAE,KAAK,IAAI,CAAC,aAAa,EAAE;AAC9D,YAAA,IAAI,CAAC,YAAY,CAAC,CAAE,CAAC,CAAC;SACvB;AACD,QAAA,IAAI,CAAC,aAAa,GAAG,CAAC,EAAE,EAAE,CAAC;KAC5B;AAGD,IAAA,WAAA,CAAoB,SAAuB,EAAU,KAAiB,EAAU,QAAmB,EAAA;QAA/E,IAAS,CAAA,SAAA,GAAT,SAAS,CAAc;QAAU,IAAK,CAAA,KAAA,GAAL,KAAK,CAAY;QAAU,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAW;QAf3F,IAAgB,CAAA,gBAAA,GACtB,kQAAkQ,CAAC;QAY/N,IAAG,CAAA,GAAA,GAAqB,IAAI,CAAC;QAGjE,IAAI,CAAC,kBAAkB,EAAE,CAAC;KAC3B;AAED,IAAA,YAAY,CAAC,IAAa,EAAA;AACxB,QAAA,IAAI,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE;AACtB,YAAA,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,wBAAwB,CAAC,QAAQ,IAAI,CAAC,KAAK,CAAA,EAAA,CAAI,CAAC,CAAC;SAC5E;AAAM,aAAA,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,SAA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