@updevs/components 1.0.0-alpha.1 → 1.0.0-alpha.3
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 +5 -22
- package/assets/styles/_bootstrap-components.scss +38 -0
- package/assets/styles/_bootstrap-config.scss +7 -0
- package/assets/styles/_bootstrap-override.scss +78 -0
- package/assets/styles/_config.scss +9 -0
- package/assets/styles/_core.scss +71 -0
- package/assets/styles/_mixins.scss +2 -0
- package/assets/styles/_updevs.scss +9 -0
- package/assets/styles/_utilities.scss +98 -0
- package/assets/styles/_variables-dark.scss +17 -0
- package/assets/styles/_variables.scss +934 -0
- package/assets/styles/fonts/_webfonts.scss +15 -0
- package/assets/styles/layout/_animations.scss +62 -0
- package/assets/styles/layout/_core.scss +61 -0
- package/assets/styles/layout/_dark.scss +72 -0
- package/assets/styles/layout/_footer.scss +12 -0
- package/assets/styles/layout/_navbar.scss +380 -0
- package/assets/styles/layout/_page.scss +169 -0
- package/assets/styles/layout/_root.scss +72 -0
- package/assets/styles/mixins/_functions.scss +43 -0
- package/assets/styles/mixins/_mixins.scss +68 -0
- package/assets/styles/ui/_accordion.scss +24 -0
- package/assets/styles/ui/_alerts.scss +59 -0
- package/assets/styles/ui/_avatars.scss +118 -0
- package/assets/styles/ui/_badges.scss +79 -0
- package/assets/styles/ui/_breadcrumbs.scss +50 -0
- package/assets/styles/ui/_button-group.scss +16 -0
- package/assets/styles/ui/_buttons.scss +265 -0
- package/assets/styles/ui/_calendars.scss +104 -0
- package/assets/styles/ui/_cards.scss +586 -0
- package/assets/styles/ui/_carousel.scss +68 -0
- package/assets/styles/ui/_charts.scss +61 -0
- package/assets/styles/ui/_chips.scss +0 -0
- package/assets/styles/ui/_close.scss +7 -0
- package/assets/styles/ui/_datagrid.scss +17 -0
- package/assets/styles/ui/_dropdowns.scss +117 -0
- package/assets/styles/ui/_empty.scss +65 -0
- package/assets/styles/ui/_flags.scss +31 -0
- package/assets/styles/ui/_forms.scss +224 -0
- package/assets/styles/ui/_grid.scss +115 -0
- package/assets/styles/ui/_icons.scss +72 -0
- package/assets/styles/ui/_images.scss +15 -0
- package/assets/styles/ui/_legend.scss +12 -0
- package/assets/styles/ui/_lists.scss +127 -0
- package/assets/styles/ui/_loaders.scss +72 -0
- package/assets/styles/ui/_login.scss +3 -0
- package/assets/styles/ui/_markdown.scss +42 -0
- package/assets/styles/ui/_modals.scss +67 -0
- package/assets/styles/ui/_nav.scss +92 -0
- package/assets/styles/ui/_offcanvas.scss +17 -0
- package/assets/styles/ui/_pagination.scss +56 -0
- package/assets/styles/ui/_payments.scss +28 -0
- package/assets/styles/ui/_placeholder.scss +9 -0
- package/assets/styles/ui/_popovers.scss +2 -0
- package/assets/styles/ui/_progress.scss +107 -0
- package/assets/styles/ui/_ribbons.scss +156 -0
- package/assets/styles/ui/_stars.scss +13 -0
- package/assets/styles/ui/_status.scss +163 -0
- package/assets/styles/ui/_steps.scss +152 -0
- package/assets/styles/ui/_switch-icon.scss +211 -0
- package/assets/styles/ui/_tables.scss +150 -0
- package/assets/styles/ui/_tags.scss +57 -0
- package/assets/styles/ui/_timeline.scss +61 -0
- package/assets/styles/ui/_toasts.scss +19 -0
- package/assets/styles/ui/_toolbar.scss +10 -0
- package/assets/styles/ui/_tracking.scss +29 -0
- package/assets/styles/ui/_type.scss +169 -0
- package/assets/styles/ui/forms/_form-check.scss +91 -0
- package/assets/styles/ui/forms/_form-colorinput.scss +54 -0
- package/assets/styles/ui/forms/_form-custom.scss +28 -0
- package/assets/styles/ui/forms/_form-icon.scss +35 -0
- package/assets/styles/ui/forms/_form-imagecheck.scss +104 -0
- package/assets/styles/ui/forms/_form-selectgroup.scss +153 -0
- package/assets/styles/ui/forms/_validation.scss +13 -0
- package/assets/styles/ui/typo/_hr.scss +74 -0
- package/assets/styles/utils/_background.scss +15 -0
- package/assets/styles/utils/_colors.scss +40 -0
- package/assets/styles/utils/_opacity.scss +7 -0
- package/assets/styles/utils/_scroll.scss +47 -0
- package/assets/styles/utils/_shadow.scss +17 -0
- package/assets/styles/utils/_sizing.scss +10 -0
- package/assets/styles/utils/_text.scss +15 -0
- package/button/ng-package.json +7 -0
- package/button/src/button.component.html +8 -0
- package/button/src/button.component.scss +5 -0
- package/button/src/button.component.spec.ts +23 -0
- package/button/src/button.component.ts +154 -0
- package/button/src/index.ts +1 -0
- package/button/src/public-api.ts +2 -0
- package/button/src/upd-button.module.ts +17 -0
- package/card/ng-package.json +7 -0
- package/card/src/card.component.html +105 -0
- package/card/src/card.component.scss +47 -0
- package/card/src/card.component.spec.ts +23 -0
- package/card/src/card.component.ts +112 -0
- package/card/src/directives/card-actions.directive.spec.ts +8 -0
- package/card/src/directives/card-actions.directive.ts +11 -0
- package/card/src/directives/card-footer.directive.spec.ts +8 -0
- package/card/src/directives/card-footer.directive.ts +11 -0
- package/card/src/directives/card-header.directive.spec.ts +8 -0
- package/card/src/directives/card-header.directive.ts +11 -0
- package/card/src/directives/card-image.directive.spec.ts +8 -0
- package/card/src/directives/card-image.directive.ts +11 -0
- package/card/src/directives/public-api.ts +4 -0
- package/card/src/index.ts +1 -0
- package/card/src/public-api.ts +3 -0
- package/card/src/types/card-state.type.ts +1 -0
- package/card/src/types/card-style.type.ts +1 -0
- package/card/src/types/hover-effect.type.ts +1 -0
- package/card/src/types/public-api.ts +5 -0
- package/card/src/types/ribbon-style.type.ts +1 -0
- package/card/src/types/status-position.type.ts +1 -0
- package/card/src/upd-card.module.ts +32 -0
- package/dropdown/ng-package.json +7 -0
- package/dropdown/src/dropdown.component.html +32 -0
- package/dropdown/src/dropdown.component.scss +19 -0
- package/dropdown/src/dropdown.component.spec.ts +23 -0
- package/dropdown/src/dropdown.component.ts +182 -0
- package/dropdown/src/index.ts +1 -0
- package/dropdown/src/models/dropdown-item.ts +22 -0
- package/dropdown/src/models/dropdown-item.type.ts +1 -0
- package/dropdown/src/models/public-api.ts +2 -0
- package/dropdown/src/public-api.ts +3 -0
- package/dropdown/src/upd-dropdown.module.ts +25 -0
- package/form/ng-package.json +7 -0
- package/form/src/form.module.ts +10 -0
- package/form/src/index.ts +1 -0
- package/form/src/public-api.ts +1 -0
- package/form-controls/checkbox/ng-package.json +7 -0
- package/form-controls/checkbox/src/checkbox.component.html +7 -0
- package/form-controls/checkbox/src/checkbox.component.scss +0 -0
- package/form-controls/checkbox/src/checkbox.component.spec.ts +23 -0
- package/form-controls/checkbox/src/checkbox.component.ts +48 -0
- package/form-controls/checkbox/src/index.ts +1 -0
- package/form-controls/checkbox/src/public-api.ts +3 -0
- package/form-controls/checkbox/src/upd-checkbox.module.ts +19 -0
- package/form-controls/input/ng-package.json +7 -0
- package/form-controls/input/src/directives/input-append.directive.spec.ts +8 -0
- package/form-controls/input/src/directives/input-append.directive.ts +11 -0
- package/form-controls/input/src/directives/input-prepend.directive.spec.ts +8 -0
- package/form-controls/input/src/directives/input-prepend.directive.ts +11 -0
- package/form-controls/input/src/directives/public-api.ts +2 -0
- package/form-controls/input/src/index.ts +1 -0
- package/form-controls/input/src/input.component.html +82 -0
- package/form-controls/input/src/input.component.scss +13 -0
- package/form-controls/input/src/input.component.spec.ts +23 -0
- package/form-controls/input/src/input.component.ts +124 -0
- package/form-controls/input/src/public-api.ts +4 -0
- package/form-controls/input/src/types/input.type.ts +1 -0
- package/form-controls/input/src/types/loader-position.type.ts +1 -0
- package/form-controls/input/src/types/public-api.ts +2 -0
- package/form-controls/input/src/upd-input.module.ts +29 -0
- package/form-controls/radio/ng-package.json +7 -0
- package/form-controls/radio/src/index.ts +1 -0
- package/form-controls/radio/src/public-api.ts +2 -0
- package/form-controls/radio/src/radio.component.html +7 -0
- package/form-controls/radio/src/radio.component.scss +0 -0
- package/form-controls/radio/src/radio.component.spec.ts +23 -0
- package/form-controls/radio/src/radio.component.ts +47 -0
- package/form-controls/radio/src/upd-radio.module.ts +17 -0
- package/form-controls/select/ng-package.json +7 -0
- package/form-controls/select/src/components/multiple/select-multiple.component.html +41 -0
- package/form-controls/select/src/components/multiple/select-multiple.component.scss +6 -0
- package/form-controls/select/src/components/multiple/select-multiple.component.spec.ts +21 -0
- package/form-controls/select/src/components/multiple/select-multiple.component.ts +69 -0
- package/form-controls/select/src/components/shared.scss +40 -0
- package/form-controls/select/src/components/single/select.component.html +53 -0
- package/form-controls/select/src/components/single/select.component.scss +3 -0
- package/form-controls/select/src/components/single/select.component.spec.ts +23 -0
- package/form-controls/select/src/components/single/select.component.ts +58 -0
- package/form-controls/select/src/index.ts +1 -0
- package/form-controls/select/src/models/abstractions/base-select.component.ts +259 -0
- package/form-controls/select/src/models/public-api.ts +1 -0
- package/form-controls/select/src/models/select-item.ts +26 -0
- package/form-controls/select/src/public-api.ts +4 -0
- package/form-controls/select/src/upd-select.module.ts +32 -0
- package/form-controls/textarea/ng-package.json +7 -0
- package/form-controls/textarea/src/index.ts +1 -0
- package/form-controls/textarea/src/public-api.ts +2 -0
- package/form-controls/textarea/src/textarea.component.html +8 -0
- package/form-controls/textarea/src/textarea.component.scss +0 -0
- package/form-controls/textarea/src/textarea.component.spec.ts +23 -0
- package/form-controls/textarea/src/textarea.component.ts +47 -0
- package/form-controls/textarea/src/upd-textarea.module.ts +17 -0
- package/form-controls/time-picker/ng-package.json +7 -0
- package/form-controls/time-picker/src/assets/i18n/en.json +5 -0
- package/form-controls/time-picker/src/assets/i18n/pt.json +5 -0
- package/form-controls/time-picker/src/index.ts +1 -0
- package/form-controls/time-picker/src/public-api.ts +3 -0
- package/form-controls/time-picker/src/time-picker.component.html +17 -0
- package/form-controls/time-picker/src/time-picker.component.scss +10 -0
- package/form-controls/time-picker/src/time-picker.component.spec.ts +21 -0
- package/form-controls/time-picker/src/time-picker.component.ts +110 -0
- package/form-controls/time-picker/src/time-selector/time-selector.component.html +44 -0
- package/form-controls/time-picker/src/time-selector/time-selector.component.scss +47 -0
- package/form-controls/time-picker/src/time-selector/time-selector.component.spec.ts +21 -0
- package/form-controls/time-picker/src/time-selector/time-selector.component.ts +107 -0
- package/form-controls/time-picker/src/upd-time-picker.module.ts +39 -0
- package/layout/ng-package.json +7 -0
- package/layout/src/abstractions/base-page.component.ts +21 -0
- package/layout/src/abstractions/public-api.ts +1 -0
- package/layout/src/assets/i18n/en.json +5 -0
- package/layout/src/assets/i18n/pt.json +5 -0
- package/layout/src/index.ts +1 -0
- package/layout/src/layouts/blank-layout/blank-layout.component.html +1 -0
- package/layout/src/layouts/blank-layout/blank-layout.component.scss +0 -0
- package/layout/src/layouts/blank-layout/blank-layout.component.spec.ts +23 -0
- package/layout/src/layouts/blank-layout/blank-layout.component.ts +10 -0
- package/layout/src/layouts/blank-layout/blank-layout.module.ts +17 -0
- package/layout/src/layouts/public-api.ts +4 -0
- package/layout/src/layouts/vertical-sidebar-layout/vertical-sidebar-layout.component.html +14 -0
- package/layout/src/layouts/vertical-sidebar-layout/vertical-sidebar-layout.component.scss +0 -0
- package/layout/src/layouts/vertical-sidebar-layout/vertical-sidebar-layout.component.spec.ts +23 -0
- package/layout/src/layouts/vertical-sidebar-layout/vertical-sidebar-layout.component.ts +31 -0
- package/layout/src/layouts/vertical-sidebar-layout/vertical-sidebar-layout.module.ts +52 -0
- package/layout/src/models/public-api.ts +1 -0
- package/layout/src/models/upd-layout-config.model.ts +71 -0
- package/layout/src/models/upd-layout.config.ts +37 -0
- package/layout/src/pages/auth-flow/auth-flow-routing.module.ts +21 -0
- package/layout/src/pages/auth-flow/auth-flow.module.ts +29 -0
- package/layout/src/pages/auth-flow/logged-out/logged-out.component.html +1 -0
- package/layout/src/pages/auth-flow/logged-out/logged-out.component.scss +0 -0
- package/layout/src/pages/auth-flow/logged-out/logged-out.component.spec.ts +23 -0
- package/layout/src/pages/auth-flow/logged-out/logged-out.component.ts +10 -0
- package/layout/src/pages/auth-flow/login/login.component.html +96 -0
- package/layout/src/pages/auth-flow/login/login.component.scss +0 -0
- package/layout/src/pages/auth-flow/login/login.component.spec.ts +23 -0
- package/layout/src/pages/auth-flow/login/login.component.ts +26 -0
- package/layout/src/pages/auth-flow/oauth-callback/oauth-callback.component.html +1 -0
- package/layout/src/pages/auth-flow/oauth-callback/oauth-callback.component.scss +0 -0
- package/layout/src/pages/auth-flow/oauth-callback/oauth-callback.component.spec.ts +23 -0
- package/layout/src/pages/auth-flow/oauth-callback/oauth-callback.component.ts +10 -0
- package/layout/src/pages/auth-flow/public-api.ts +5 -0
- package/layout/src/pages/public-api.ts +1 -0
- package/layout/src/partials/footer/footer-copyright.directive.spec.ts +8 -0
- package/layout/src/partials/footer/footer-copyright.directive.ts +9 -0
- package/layout/src/partials/footer/footer.component.html +30 -0
- package/layout/src/partials/footer/footer.component.scss +0 -0
- package/{src/lib/components.component.spec.ts → layout/src/partials/footer/footer.component.spec.ts} +6 -6
- package/layout/src/partials/footer/footer.component.ts +73 -0
- package/layout/src/partials/footer/public-api.ts +2 -0
- package/layout/src/partials/header/header-style.type.ts +1 -0
- package/layout/src/partials/header/header.component.html +163 -0
- package/layout/src/partials/header/header.component.scss +0 -0
- package/layout/src/partials/header/header.component.spec.ts +23 -0
- package/layout/src/partials/header/header.component.ts +86 -0
- package/layout/src/partials/header/public-api.ts +2 -0
- package/layout/src/partials/page-header/page-header.component.html +19 -0
- package/layout/src/partials/page-header/page-header.component.scss +0 -0
- package/layout/src/partials/page-header/page-header.component.spec.ts +23 -0
- package/layout/src/partials/page-header/page-header.component.ts +11 -0
- package/layout/src/partials/page-header/public-api.ts +1 -0
- package/layout/src/partials/public-api.ts +4 -0
- package/layout/src/partials/sidebar/public-api.ts +1 -0
- package/layout/src/partials/sidebar/sidebar.component.html +62 -0
- package/layout/src/partials/sidebar/sidebar.component.scss +0 -0
- package/layout/src/partials/sidebar/sidebar.component.spec.ts +23 -0
- package/layout/src/partials/sidebar/sidebar.component.ts +161 -0
- package/layout/src/public-api.ts +7 -0
- package/layout/src/services/public-api.ts +1 -0
- package/{src/lib/components.service.spec.ts → layout/src/services/upd-layout-config.service.spec.ts} +4 -4
- package/layout/src/services/upd-layout-config.service.ts +20 -0
- package/layout/src/tools/layout.constants.ts +18 -0
- package/layout/src/upd-layout.module.ts +34 -0
- package/link/ng-package.json +7 -0
- package/link/src/index.ts +1 -0
- package/link/src/link.component.html +3 -0
- package/link/src/link.component.scss +3 -0
- package/link/src/link.component.spec.ts +23 -0
- package/link/src/link.component.ts +48 -0
- package/link/src/public-api.ts +3 -0
- package/link/src/target.type.ts +1 -0
- package/link/src/upd-link.module.ts +17 -0
- package/list/ng-package.json +7 -0
- package/list/src/assets/i18n/en.json +5 -0
- package/list/src/assets/i18n/pt.json +5 -0
- package/list/src/index.ts +1 -0
- package/list/src/list.component.html +58 -0
- package/list/src/list.component.scss +21 -0
- package/list/src/list.component.spec.ts +23 -0
- package/list/src/list.component.ts +147 -0
- package/list/src/models/badge-position.type.ts +1 -0
- package/list/src/models/list-item.model.ts +35 -0
- package/list/src/models/list-item.ts +21 -0
- package/list/src/models/public-api.ts +2 -0
- package/list/src/public-api.ts +3 -0
- package/list/src/upd-list.module.ts +30 -0
- package/ng-package.json +9 -6
- package/package.json +8 -5
- package/popover/ng-package.json +7 -0
- package/popover/src/index.ts +1 -0
- package/popover/src/popover.component.html +20 -0
- package/popover/src/popover.component.scss +8 -0
- package/popover/src/popover.component.spec.ts +23 -0
- package/popover/src/popover.component.ts +53 -0
- package/popover/src/popover.directive.spec.ts +8 -0
- package/popover/src/popover.directive.ts +128 -0
- package/popover/src/public-api.ts +3 -0
- package/popover/src/upd-popover.module.ts +20 -0
- package/src/lib/index.ts +1 -0
- package/src/lib/public-api.ts +2 -0
- package/src/lib/types/component-size.type.ts +1 -0
- package/src/lib/types/public-api.ts +2 -0
- package/src/lib/types/validation-status.type.ts +1 -0
- package/src/lib/upd-components.module.ts +6 -0
- package/src/public-api.ts +1 -7
- package/tsconfig.lib.json +11 -11
- package/src/lib/components.component.ts +0 -14
- package/src/lib/components.module.ts +0 -17
- package/src/lib/components.service.ts +0 -9
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<ng-container *ngIf="listItems.length > 0; else noDataTpl">
|
|
2
|
+
<ng-container *ngFor="let item of listItems">
|
|
3
|
+
<ng-container *ngIf="(item.children?.length || 0) > 0; else rowTpl">
|
|
4
|
+
<div class="list-group-header sticky-top">{{item.text}}</div>
|
|
5
|
+
<ng-container *ngFor="let child of item.children">
|
|
6
|
+
<ng-container [ngTemplateOutlet]="listItemTpl" [ngTemplateOutletContext]="{item:child}"></ng-container>
|
|
7
|
+
</ng-container>
|
|
8
|
+
</ng-container>
|
|
9
|
+
<ng-template #rowTpl>
|
|
10
|
+
<ng-container [ngTemplateOutlet]="listItemTpl" [ngTemplateOutletContext]="{item:item}"></ng-container>
|
|
11
|
+
</ng-template>
|
|
12
|
+
</ng-container>
|
|
13
|
+
</ng-container>
|
|
14
|
+
<ng-template #noDataTpl>
|
|
15
|
+
<div class="list-group-item">
|
|
16
|
+
<upd-icon tablerIcon="alert-triangle" wrapperClasses="text-yellow"></upd-icon>
|
|
17
|
+
{{noRecordsFoundKey | transloco}}
|
|
18
|
+
</div>
|
|
19
|
+
</ng-template>
|
|
20
|
+
|
|
21
|
+
<div *ngIf="shouldDisplayItemsCounter" class="list-items-counter bg-muted text-muted-fg">
|
|
22
|
+
{{listItems.length}} {{(listItems.length === 1 ? itemFoundKey : itemsFoundKey) | transloco}}
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<ng-template #listItemTpl let-item="item">
|
|
26
|
+
<div class="list-group-item" [class.list-group-item-action]="!item.hasLeftBox" [class.active]="item.isActive"
|
|
27
|
+
[class.disabled]="item.isDisabled" (click)="onSelectItem($event, item)">
|
|
28
|
+
<span *ngIf="!item.hasLeftBox; else customContentTpl">{{item.text}}</span>
|
|
29
|
+
<ng-template #customContentTpl>
|
|
30
|
+
<div class="row">
|
|
31
|
+
<ng-container [ngTemplateOutlet]="leftBoxTpl" [ngTemplateOutletContext]="{item:item}"></ng-container>
|
|
32
|
+
<div class="col text-truncate">
|
|
33
|
+
<div *ngIf="!!item.text" class="text-body d-block">{{item.text}}</div>
|
|
34
|
+
<div *ngIf="!!item.description" class="text-muted text-truncate mt-n1">{{item.description}}</div>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</ng-template>
|
|
38
|
+
</div>
|
|
39
|
+
</ng-template>
|
|
40
|
+
|
|
41
|
+
<ng-template #leftBoxTpl let-item="item">
|
|
42
|
+
<div *ngIf="item.hasCheckbox" class="col-auto">
|
|
43
|
+
<upd-checkbox (changed)="onCheckboxChange(item, $event)" [isChecked]="item.isChecked || false"
|
|
44
|
+
[isSwitch]="item.isSwitch || false"></upd-checkbox>
|
|
45
|
+
<!-- [wrapperClasses]="'dropdown-item' + (item.isDisabled ? ' disabled' : '') +(item.isActive ? ' active' : '')"-->
|
|
46
|
+
</div>
|
|
47
|
+
<div *ngIf="item.hasLeftBadge" class="col-auto">
|
|
48
|
+
<span class="badge bg-{{item.badgeColor}} ms-auto">{{item.badgeText}}</span>
|
|
49
|
+
</div>
|
|
50
|
+
<div *ngIf="!!item.leftBoxImage || !!item.leftBoxText" class="col-auto">
|
|
51
|
+
<a href="#"> <!-- TODO: change. -->
|
|
52
|
+
<span class="avatar" style="background-image: url({{item.leftBoxImage}})">{{item.leftBoxText}}
|
|
53
|
+
<span *ngIf="item.hasBottomRightBadge"
|
|
54
|
+
class="badge bg-{{item.badgeColor}} ms-auto">{{item.badgeText}}</span>
|
|
55
|
+
</span>
|
|
56
|
+
</a>
|
|
57
|
+
</div>
|
|
58
|
+
</ng-template>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
upd-list {
|
|
2
|
+
width: 100%;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.list-group-item {
|
|
6
|
+
cursor: pointer;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.list-hidden {
|
|
10
|
+
display: none !important;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.list-items-counter {
|
|
14
|
+
position: sticky;
|
|
15
|
+
bottom: 0;
|
|
16
|
+
right: 0;
|
|
17
|
+
float: right;
|
|
18
|
+
border-top-left-radius: 2px;
|
|
19
|
+
opacity: .6;
|
|
20
|
+
padding: 2px 12px;
|
|
21
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { ListComponent } from './list.component';
|
|
4
|
+
|
|
5
|
+
describe('ListComponent', () => {
|
|
6
|
+
let component: ListComponent;
|
|
7
|
+
let fixture: ComponentFixture<ListComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ ListComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(ListComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Component,
|
|
3
|
+
HostBinding,
|
|
4
|
+
Input,
|
|
5
|
+
Renderer2,
|
|
6
|
+
ElementRef,
|
|
7
|
+
OnInit,
|
|
8
|
+
RendererStyleFlags2,
|
|
9
|
+
ViewEncapsulation,
|
|
10
|
+
Output,
|
|
11
|
+
EventEmitter,
|
|
12
|
+
OnChanges,
|
|
13
|
+
SimpleChanges
|
|
14
|
+
} from '@angular/core';
|
|
15
|
+
|
|
16
|
+
import { ListItem } from './models/list-item';
|
|
17
|
+
import { ListItemModel } from './models/list-item.model';
|
|
18
|
+
|
|
19
|
+
@Component({
|
|
20
|
+
selector: 'upd-list',
|
|
21
|
+
templateUrl: './list.component.html',
|
|
22
|
+
styleUrls: ['./list.component.scss'],
|
|
23
|
+
encapsulation: ViewEncapsulation.None
|
|
24
|
+
})
|
|
25
|
+
export class ListComponent implements OnInit, OnChanges {
|
|
26
|
+
@HostBinding('class') localWrapperClasses = '';
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* List items.
|
|
30
|
+
* If provided, the single will be considered static.
|
|
31
|
+
*/
|
|
32
|
+
@Input() items?: ListItem[];
|
|
33
|
+
/**
|
|
34
|
+
* Whether the content should overflow or not.
|
|
35
|
+
*/
|
|
36
|
+
@Input() shouldOverflow = false;
|
|
37
|
+
/**
|
|
38
|
+
* Whether the list will fit the layout of the container.
|
|
39
|
+
* If set to false, the list's round borders will be visible. It'll have a detached behavior.
|
|
40
|
+
*/
|
|
41
|
+
@Input() isFlush = true;
|
|
42
|
+
@Input() isVisible = true;
|
|
43
|
+
@Input() isHoverable = false;
|
|
44
|
+
@Input() shouldDisplayItemsCounter = false;
|
|
45
|
+
@Input() wrapperClasses = '';
|
|
46
|
+
/**
|
|
47
|
+
* Maximum height of the component.
|
|
48
|
+
* Note: The unit should also be provided, i.e.: 350px, 35rem, etc.
|
|
49
|
+
*/
|
|
50
|
+
@Input() maxHeight?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Translation key used to inform no records have been found.
|
|
53
|
+
* If translation is not being used, you can insert the custom text here as well.
|
|
54
|
+
*/
|
|
55
|
+
@Input() noRecordsFoundKey?: string = 'NoRecordsFound';
|
|
56
|
+
/**
|
|
57
|
+
* Translation key used to describe 1 item found.
|
|
58
|
+
* If translation is not being used, you can insert the custom text here as well.
|
|
59
|
+
*/
|
|
60
|
+
@Input() itemFoundKey?: string = 'Item';
|
|
61
|
+
/**
|
|
62
|
+
* Translation key used to describe items (plural) found.
|
|
63
|
+
* If translation is not being used, you can insert the custom text here as well.
|
|
64
|
+
*/
|
|
65
|
+
@Input() itemsFoundKey?: string = 'Items';
|
|
66
|
+
|
|
67
|
+
@Output() readonly checkboxChanged = new EventEmitter<ListItem>();
|
|
68
|
+
@Output() readonly selectedItem = new EventEmitter<ListItem>();
|
|
69
|
+
|
|
70
|
+
listItems: ListItemModel[] = [];
|
|
71
|
+
currentSelection: ListItem[] = [];
|
|
72
|
+
|
|
73
|
+
private localBackupItems: ListItem[] = [];
|
|
74
|
+
|
|
75
|
+
constructor(
|
|
76
|
+
private renderer: Renderer2,
|
|
77
|
+
private elementRef: ElementRef
|
|
78
|
+
) {
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
ngOnInit(): void {
|
|
82
|
+
this.setupStyle();
|
|
83
|
+
this.updateWrapperClasses();
|
|
84
|
+
this.setupItems();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
ngOnChanges(changes: SimpleChanges): void {
|
|
88
|
+
this.updateWrapperClasses();
|
|
89
|
+
|
|
90
|
+
if (!!changes['items']) {
|
|
91
|
+
this.setupItems();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
onCheckboxChange(item: ListItem, isChecked: boolean): void {
|
|
96
|
+
item.isChecked = isChecked;
|
|
97
|
+
this.checkboxChanged.emit(item);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
onSelectItem(evt: any, item: ListItem): void {
|
|
101
|
+
evt.stopPropagation();
|
|
102
|
+
this.selectedItem.emit(item);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
private setupItems(): void {
|
|
106
|
+
const tempItems: ListItemModel[] = [];
|
|
107
|
+
|
|
108
|
+
this.items?.forEach(it => {
|
|
109
|
+
const parent = new ListItemModel(it);
|
|
110
|
+
|
|
111
|
+
if ((it.children?.length || 0) > 0) {
|
|
112
|
+
parent.children = [];
|
|
113
|
+
it.children?.forEach(child => parent.children!.push(new ListItemModel(child)));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
tempItems.push(parent);
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
this.listItems = [...tempItems];
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
private setupStyle(): void {
|
|
123
|
+
if (!!this.maxHeight) {
|
|
124
|
+
this.renderer.setStyle(this.elementRef.nativeElement, 'max-height', this.maxHeight, RendererStyleFlags2.Important);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
private updateWrapperClasses(): void {
|
|
129
|
+
this.localWrapperClasses = 'list-group' + ` ${this.wrapperClasses}`;
|
|
130
|
+
|
|
131
|
+
if (this.isFlush) {
|
|
132
|
+
this.localWrapperClasses += ' list-group-flush';
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (this.isHoverable) {
|
|
136
|
+
this.localWrapperClasses += ' list-group-hoverable';
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (this.shouldOverflow) {
|
|
140
|
+
this.localWrapperClasses += ' overflow-auto';
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (!this.isVisible) {
|
|
144
|
+
this.localWrapperClasses += ' list-hidden';
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type BadgePositionType = 'left' | 'left-box-bottom-right';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { BgColorStyleType } from '@updevs/sdk/layout';
|
|
2
|
+
|
|
3
|
+
import { ListItem } from './list-item';
|
|
4
|
+
import { BadgePositionType } from './badge-position.type';
|
|
5
|
+
|
|
6
|
+
export class ListItemModel implements ListItem {
|
|
7
|
+
id?: any;
|
|
8
|
+
text?: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
icon?: string;
|
|
11
|
+
isChecked?: boolean;
|
|
12
|
+
isSwitch?: boolean;
|
|
13
|
+
hasCheckbox?: boolean;
|
|
14
|
+
isDisabled?: boolean;
|
|
15
|
+
isActive?: boolean;
|
|
16
|
+
leftBoxText?: string;
|
|
17
|
+
leftBoxImage?: string;
|
|
18
|
+
badgeColor?: BgColorStyleType;
|
|
19
|
+
badgeText?: string;
|
|
20
|
+
badgePosition?: BadgePositionType;
|
|
21
|
+
children?: ListItemModel[];
|
|
22
|
+
get hasLeftBox(): boolean {
|
|
23
|
+
return !!this.leftBoxImage || !!this.leftBoxText || !!this.badgeColor || this.hasCheckbox === true;
|
|
24
|
+
}
|
|
25
|
+
get hasLeftBadge(): boolean {
|
|
26
|
+
return !!this.badgeColor && this.badgePosition === 'left';
|
|
27
|
+
}
|
|
28
|
+
get hasBottomRightBadge(): boolean {
|
|
29
|
+
return !!this.badgeColor && this.badgePosition === 'left-box-bottom-right';
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
constructor(init?: ListItem) {
|
|
33
|
+
Object.assign(this, init);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BgColorStyleType } from '@updevs/sdk/layout';
|
|
2
|
+
|
|
3
|
+
import { BadgePositionType } from './badge-position.type';
|
|
4
|
+
|
|
5
|
+
export interface ListItem {
|
|
6
|
+
id?: any;
|
|
7
|
+
text?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
icon?: string;
|
|
10
|
+
isChecked?: boolean;
|
|
11
|
+
isSwitch?: boolean;
|
|
12
|
+
hasCheckbox?: boolean;
|
|
13
|
+
isDisabled?: boolean;
|
|
14
|
+
isActive?: boolean;
|
|
15
|
+
leftBoxText?: string;
|
|
16
|
+
leftBoxImage?: string;
|
|
17
|
+
badgeColor?: BgColorStyleType;
|
|
18
|
+
badgeText?: string;
|
|
19
|
+
badgePosition?: BadgePositionType;
|
|
20
|
+
children?: ListItem[];
|
|
21
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { CommonModule } from '@angular/common';
|
|
3
|
+
import { TranslocoService, TranslocoModule } from '@ngneat/transloco';
|
|
4
|
+
import { UpdCheckboxModule } from '@updevs/components/form-controls/checkbox';
|
|
5
|
+
import { UpdIconsModule } from '@updevs/icons';
|
|
6
|
+
|
|
7
|
+
import * as en from './assets/i18n/en.json';
|
|
8
|
+
import * as pt from './assets/i18n/pt.json';
|
|
9
|
+
import { ListComponent } from './list.component';
|
|
10
|
+
|
|
11
|
+
@NgModule({
|
|
12
|
+
imports: [
|
|
13
|
+
CommonModule,
|
|
14
|
+
TranslocoModule,
|
|
15
|
+
UpdCheckboxModule,
|
|
16
|
+
UpdIconsModule
|
|
17
|
+
],
|
|
18
|
+
declarations: [
|
|
19
|
+
ListComponent
|
|
20
|
+
],
|
|
21
|
+
exports: [
|
|
22
|
+
ListComponent
|
|
23
|
+
]
|
|
24
|
+
})
|
|
25
|
+
export class UpdListModule {
|
|
26
|
+
constructor(translocoService: TranslocoService) {
|
|
27
|
+
translocoService.setTranslation(en, 'en');
|
|
28
|
+
translocoService.setTranslation(pt, 'pt');
|
|
29
|
+
}
|
|
30
|
+
}
|
package/ng-package.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
"$schema": "../../../node_modules/ng-packagr/ng-package.schema.json",
|
|
3
|
+
"dest": "../../../node_modules/@updevs/components",
|
|
4
|
+
"lib": {
|
|
5
|
+
"entryFile": "src/public-api.ts"
|
|
6
|
+
},
|
|
7
|
+
"assets": [
|
|
8
|
+
"assets"
|
|
9
|
+
]
|
|
10
|
+
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@updevs/components",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.3",
|
|
4
4
|
"scripts": {
|
|
5
|
-
"build": "ng
|
|
5
|
+
"build": "ng build @updevs/components"
|
|
6
6
|
},
|
|
7
7
|
"peerDependencies": {
|
|
8
|
-
"@angular/common": "^
|
|
9
|
-
"@angular/core": "^
|
|
8
|
+
"@angular/common": "^16.2.7",
|
|
9
|
+
"@angular/core": "^16.2.7",
|
|
10
|
+
"@ngneat/transloco": "^6.0.0",
|
|
11
|
+
"@updevs/icons": "^1.0.2",
|
|
12
|
+
"@updevs/sdk": "^1.0.0-alpha.13"
|
|
10
13
|
},
|
|
11
14
|
"dependencies": {
|
|
12
15
|
"tslib": "^2.3.0"
|
|
@@ -15,5 +18,5 @@
|
|
|
15
18
|
"access": "public"
|
|
16
19
|
},
|
|
17
20
|
"sideEffects": false,
|
|
18
|
-
"gitHead": "
|
|
21
|
+
"gitHead": "a9f29d8ca7d1c7acc424d82c1a7b00620e496d1c"
|
|
19
22
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './public-api';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<div class="popover-arrow upd-popover-arrow -{{placement}}"></div>
|
|
2
|
+
<ng-container *ngIf="!!title || !!titleTemplate">
|
|
3
|
+
<h3 *ngIf="title; else titleTpl" [innerHTML]="title" class="popover-header"></h3>
|
|
4
|
+
<ng-template #titleTpl>
|
|
5
|
+
<div class="popover-header">
|
|
6
|
+
<ng-template [ngTemplateOutlet]="titleTemplate!"></ng-template>
|
|
7
|
+
</div>
|
|
8
|
+
</ng-template>
|
|
9
|
+
</ng-container>
|
|
10
|
+
<div class="popover-body">
|
|
11
|
+
<ng-container *ngIf="!!text; else contentTpl">
|
|
12
|
+
<span [innerHTML]="text"></span>
|
|
13
|
+
</ng-container>
|
|
14
|
+
<ng-template #contentTpl>
|
|
15
|
+
<ng-container *ngIf="!template; else customContentTpl">
|
|
16
|
+
<ng-content></ng-content>
|
|
17
|
+
</ng-container>
|
|
18
|
+
<ng-template #customContentTpl [ngTemplateOutlet]="template!"></ng-template>
|
|
19
|
+
</ng-template>
|
|
20
|
+
</div>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
|
|
3
|
+
import { PopoverComponent } from './popover.component';
|
|
4
|
+
|
|
5
|
+
describe('PopoverComponent', () => {
|
|
6
|
+
let component: PopoverComponent;
|
|
7
|
+
let fixture: ComponentFixture<PopoverComponent>;
|
|
8
|
+
|
|
9
|
+
beforeEach(async () => {
|
|
10
|
+
await TestBed.configureTestingModule({
|
|
11
|
+
declarations: [ PopoverComponent ]
|
|
12
|
+
})
|
|
13
|
+
.compileComponents();
|
|
14
|
+
|
|
15
|
+
fixture = TestBed.createComponent(PopoverComponent);
|
|
16
|
+
component = fixture.componentInstance;
|
|
17
|
+
fixture.detectChanges();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should create', () => {
|
|
21
|
+
expect(component).toBeTruthy();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Component, Input, HostBinding, SimpleChanges, OnInit, OnChanges, ViewEncapsulation, TemplateRef } from '@angular/core';
|
|
2
|
+
import { TopBottomLeftRightType } from '@updevs/sdk/types';
|
|
3
|
+
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'upd-popover',
|
|
6
|
+
templateUrl: './popover.component.html',
|
|
7
|
+
styleUrls: ['./popover.component.scss'],
|
|
8
|
+
encapsulation: ViewEncapsulation.None
|
|
9
|
+
})
|
|
10
|
+
export class PopoverComponent implements OnInit, OnChanges {
|
|
11
|
+
@HostBinding('class') classes = '';
|
|
12
|
+
@HostBinding('attr.data-popper-placement') popperPlacement = '';
|
|
13
|
+
@HostBinding('role') readonly role = 'tooltip';
|
|
14
|
+
|
|
15
|
+
@Input() title?: string;
|
|
16
|
+
@Input() text?: string;
|
|
17
|
+
@Input() titleTemplate?: TemplateRef<any>;
|
|
18
|
+
@Input() template?: TemplateRef<any>;
|
|
19
|
+
@Input() placement: TopBottomLeftRightType = 'top';
|
|
20
|
+
@Input() customClasses?: string;
|
|
21
|
+
|
|
22
|
+
get isVisible(): boolean {
|
|
23
|
+
return this._isVisible;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
private _isVisible = false;
|
|
27
|
+
|
|
28
|
+
ngOnInit(): void {
|
|
29
|
+
this.updateClasses();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
ngOnChanges(changes: SimpleChanges): void {
|
|
33
|
+
this.updateClasses();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
setVisible(isVisible: boolean): void {
|
|
37
|
+
this._isVisible = isVisible;
|
|
38
|
+
this.updateClasses();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
private updateClasses(): void {
|
|
42
|
+
this.popperPlacement = this.placement;
|
|
43
|
+
this.classes = [
|
|
44
|
+
'popover',
|
|
45
|
+
'bs-popover-auto',
|
|
46
|
+
!this._isVisible ? 'fade' : '',
|
|
47
|
+
this._isVisible ? 'show' : '',
|
|
48
|
+
'upd-popover',
|
|
49
|
+
`-${this.placement}`,
|
|
50
|
+
...(this.customClasses?.split(' ') || [])
|
|
51
|
+
].join(' ');
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Directive,
|
|
3
|
+
Input,
|
|
4
|
+
TemplateRef,
|
|
5
|
+
ViewContainerRef,
|
|
6
|
+
Renderer2,
|
|
7
|
+
ElementRef,
|
|
8
|
+
Injector,
|
|
9
|
+
NgZone,
|
|
10
|
+
ComponentRef,
|
|
11
|
+
HostListener
|
|
12
|
+
} from '@angular/core';
|
|
13
|
+
import { TopBottomLeftRightType } from '@updevs/sdk/types';
|
|
14
|
+
import { PositioningService, ComputePositionResult, DynamicComponentLoaderService } from '@updevs/sdk/layout';
|
|
15
|
+
|
|
16
|
+
import { PopoverComponent } from './popover.component';
|
|
17
|
+
|
|
18
|
+
@Directive({
|
|
19
|
+
selector: '[updPopover]'
|
|
20
|
+
})
|
|
21
|
+
export class PopoverDirective {
|
|
22
|
+
@Input('updPopover') text?: string;
|
|
23
|
+
@Input('updPopoverTitle') title?: string;
|
|
24
|
+
@Input('updPopoverTitleTemplate') popoverTitleTemplate?: TemplateRef<any>;
|
|
25
|
+
@Input('updPopoverTemplate') popoverTemplate?: TemplateRef<any>;
|
|
26
|
+
@Input('updPopoverPlacement') placement: TopBottomLeftRightType = 'top';
|
|
27
|
+
@Input('updPopoverCustomClasses') customClasses?: string;
|
|
28
|
+
/**
|
|
29
|
+
* This makes the popover behave like a tooltip.
|
|
30
|
+
* It means it'll show/hide depending on whether the mouse is over or not the element.
|
|
31
|
+
*/
|
|
32
|
+
@Input('updPopoverActAsTooltip') actAsTooltip = false;
|
|
33
|
+
|
|
34
|
+
private popoverComponentRef?: ComponentRef<PopoverComponent>;
|
|
35
|
+
|
|
36
|
+
constructor(
|
|
37
|
+
private elementRef: ElementRef,
|
|
38
|
+
private renderer: Renderer2,
|
|
39
|
+
private viewContainerRef: ViewContainerRef,
|
|
40
|
+
private ngZone: NgZone,
|
|
41
|
+
private injector: Injector,
|
|
42
|
+
private positioningService: PositioningService,
|
|
43
|
+
private dynamicComponentLoaderService: DynamicComponentLoaderService
|
|
44
|
+
) {
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@HostListener('mouseenter')
|
|
48
|
+
onMouseEnter(): void {
|
|
49
|
+
if (this.actAsTooltip) {
|
|
50
|
+
this.initPopover();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@HostListener('mouseleave')
|
|
55
|
+
onMouseLeave(): void {
|
|
56
|
+
if (this.actAsTooltip) {
|
|
57
|
+
this.disposePopover();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@HostListener('click')
|
|
62
|
+
onClick(): void {
|
|
63
|
+
if (!this.actAsTooltip) {
|
|
64
|
+
if (this.popoverComponentRef?.instance.isVisible) {
|
|
65
|
+
this.disposePopover();
|
|
66
|
+
} else {
|
|
67
|
+
this.initPopover();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
private initPopover(): void {
|
|
73
|
+
this.setupPopover();
|
|
74
|
+
this.popoverComponentRef!.instance.setVisible(true);
|
|
75
|
+
this.ngZone.runOutsideAngular(() =>
|
|
76
|
+
this.positioningService
|
|
77
|
+
.computePosition(this.elementRef, this.popoverComponentRef!.location, { placement: this.placement })
|
|
78
|
+
.subscribe(resp => this.updatePosition(resp))
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
private disposePopover(): void {
|
|
83
|
+
this.viewContainerRef.clear();
|
|
84
|
+
this.popoverComponentRef!.instance.setVisible(false);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
private setupPopover(): void {
|
|
88
|
+
this.viewContainerRef.clear();
|
|
89
|
+
|
|
90
|
+
this.popoverComponentRef = this.dynamicComponentLoaderService.load(PopoverComponent, this.viewContainerRef, this.injector);
|
|
91
|
+
this.popoverComponentRef!.instance.title = this.title;
|
|
92
|
+
this.popoverComponentRef!.instance.text = this.text;
|
|
93
|
+
this.popoverComponentRef!.instance.titleTemplate = this.popoverTitleTemplate;
|
|
94
|
+
this.popoverComponentRef!.instance.template = this.popoverTemplate;
|
|
95
|
+
this.popoverComponentRef!.instance.placement = this.placement;
|
|
96
|
+
this.popoverComponentRef!.instance.customClasses = this.customClasses;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
private updatePosition(result: ComputePositionResult): void {
|
|
100
|
+
const nativeElement = this.popoverComponentRef!.location.nativeElement;
|
|
101
|
+
const arrowElement = this.popoverComponentRef!.location.nativeElement.querySelector('.popover-arrow');
|
|
102
|
+
const popoverBox = nativeElement.getBoundingClientRect();
|
|
103
|
+
const arrowBox = arrowElement.getBoundingClientRect();
|
|
104
|
+
|
|
105
|
+
switch (this.placement) {
|
|
106
|
+
case 'top':
|
|
107
|
+
this.renderer.setStyle(nativeElement, 'top', `${result.y - arrowBox.height}px`);
|
|
108
|
+
this.renderer.setStyle(nativeElement, 'left', `${result.x}px`);
|
|
109
|
+
this.renderer.setStyle(arrowElement, 'left', `${(popoverBox.width / 2) - (arrowBox.width / 2)}px`);
|
|
110
|
+
break;
|
|
111
|
+
case 'bottom':
|
|
112
|
+
this.renderer.setStyle(nativeElement, 'top', `${result.y + arrowBox.height}px`);
|
|
113
|
+
this.renderer.setStyle(nativeElement, 'left', `${result.x}px`);
|
|
114
|
+
this.renderer.setStyle(arrowElement, 'left', `${(popoverBox.width / 2) - (arrowBox.width / 2)}px`);
|
|
115
|
+
break;
|
|
116
|
+
case 'left':
|
|
117
|
+
this.renderer.setStyle(nativeElement, 'top', `${result.y}px`);
|
|
118
|
+
this.renderer.setStyle(nativeElement, 'left', `${result.x - arrowBox.width}px`);
|
|
119
|
+
this.renderer.setStyle(arrowElement, 'top', `${(popoverBox.height / 2) - (arrowBox.height / 2)}px`);
|
|
120
|
+
break;
|
|
121
|
+
case 'right':
|
|
122
|
+
this.renderer.setStyle(nativeElement, 'top', `${result.y}px`);
|
|
123
|
+
this.renderer.setStyle(nativeElement, 'left', `${result.x + arrowBox.width}px`);
|
|
124
|
+
this.renderer.setStyle(arrowElement, 'top', `${(popoverBox.height / 2) - (arrowBox.height / 2)}px`);
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|