ngx-tethys 19.0.13 → 19.1.0-next.0
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/CHANGELOG.md +29 -2
- package/action/action.component.d.ts +12 -20
- package/action/actions.component.d.ts +5 -7
- package/affix/affix.component.d.ts +7 -10
- package/alert/alert.component.d.ts +1 -1
- package/anchor/anchor-link.component.d.ts +8 -8
- package/anchor/anchor.component.d.ts +15 -21
- package/arrow-switcher/arrow-switcher.component.d.ts +15 -22
- package/autocomplete/autocomplete.component.d.ts +10 -17
- package/autocomplete/autocomplete.trigger.directive.d.ts +10 -18
- package/avatar/avatar-list/avatar-list.component.d.ts +8 -14
- package/avatar/avatar.component.d.ts +25 -39
- package/back-top/back-top.component.d.ts +9 -12
- package/badge/badge.component.d.ts +19 -59
- package/breadcrumb/breadcrumb.component.d.ts +15 -20
- package/button/button-icon.component.d.ts +3 -2
- package/button/button.component.d.ts +3 -2
- package/calendar/calendar-header.component.d.ts +9 -8
- package/calendar/calendar.component.d.ts +16 -16
- package/card/card.component.d.ts +5 -11
- package/card/content.component.d.ts +3 -8
- package/card/header.component.d.ts +7 -8
- package/carousel/carousel.component.d.ts +22 -27
- package/cascader/cascader-li.component.d.ts +13 -21
- package/cascader/cascader-search-option.component.d.ts +8 -16
- package/cascader/cascader.component.d.ts +58 -80
- package/checkbox/checkbox.component.d.ts +2 -5
- package/collapse/collapse-item.component.d.ts +12 -19
- package/collapse/collapse.component.d.ts +6 -12
- package/collapse/collapse.token.d.ts +3 -3
- package/color-picker/color-picker-custom-panel.component.d.ts +5 -5
- package/color-picker/color-picker-panel.component.d.ts +7 -11
- package/color-picker/color-picker.component.d.ts +19 -35
- package/color-picker/parts/alpha/alpha.component.d.ts +8 -8
- package/color-picker/parts/hue/hue.component.d.ts +6 -6
- package/color-picker/parts/indicator/indicator.component.d.ts +4 -3
- package/color-picker/parts/inputs/inputs.component.d.ts +9 -9
- package/color-picker/parts/saturation/saturation.component.d.ts +9 -9
- package/comment/comment.component.d.ts +4 -5
- package/copy/copy.directive.d.ts +8 -9
- package/date-picker/abstract-picker.component.d.ts +8 -7
- package/date-picker/lib/calendar/calendar-footer.component.d.ts +2 -1
- package/date-picker/lib/popups/inner-popup.component.d.ts +2 -1
- package/date-picker/picker.component.d.ts +2 -1
- package/date-range/date-range.component.d.ts +2 -2
- package/dialog/body/dialog-body.component.d.ts +2 -6
- package/dialog/confirm/confirm.component.d.ts +2 -2
- package/dialog/footer/dialog-footer.component.d.ts +6 -9
- package/dialog/header/dialog-header.component.d.ts +9 -11
- package/divider/divider.component.d.ts +12 -16
- package/dot/dot.component.d.ts +5 -13
- package/drag-drop/drag-handle.directive.d.ts +2 -1
- package/drag-drop/drag.directive.d.ts +2 -1
- package/drag-drop/drop-container.directive.d.ts +2 -1
- package/dropdown/dropdown-menu-item.directive.d.ts +3 -2
- package/dropdown/dropdown-menu.component.d.ts +2 -1
- package/dropdown/dropdown.directive.d.ts +2 -1
- package/empty/empty.component.d.ts +21 -27
- package/fesm2022/ngx-tethys-action.mjs +54 -91
- package/fesm2022/ngx-tethys-action.mjs.map +1 -1
- package/fesm2022/ngx-tethys-affix.mjs +29 -26
- package/fesm2022/ngx-tethys-affix.mjs.map +1 -1
- package/fesm2022/ngx-tethys-anchor.mjs +91 -118
- package/fesm2022/ngx-tethys-anchor.mjs.map +1 -1
- package/fesm2022/ngx-tethys-arrow-switcher.mjs +51 -77
- package/fesm2022/ngx-tethys-arrow-switcher.mjs.map +1 -1
- package/fesm2022/ngx-tethys-autocomplete.mjs +69 -103
- package/fesm2022/ngx-tethys-autocomplete.mjs.map +1 -1
- package/fesm2022/ngx-tethys-avatar.mjs +117 -162
- package/fesm2022/ngx-tethys-avatar.mjs.map +1 -1
- package/fesm2022/ngx-tethys-back-top.mjs +33 -46
- package/fesm2022/ngx-tethys-back-top.mjs.map +1 -1
- package/fesm2022/ngx-tethys-badge.mjs +104 -208
- package/fesm2022/ngx-tethys-badge.mjs.map +1 -1
- package/fesm2022/ngx-tethys-breadcrumb.mjs +66 -70
- package/fesm2022/ngx-tethys-breadcrumb.mjs.map +1 -1
- package/fesm2022/ngx-tethys-calendar.mjs +85 -87
- package/fesm2022/ngx-tethys-calendar.mjs.map +1 -1
- package/fesm2022/ngx-tethys-card.mjs +72 -77
- package/fesm2022/ngx-tethys-card.mjs.map +1 -1
- package/fesm2022/ngx-tethys-carousel.mjs +82 -99
- package/fesm2022/ngx-tethys-carousel.mjs.map +1 -1
- package/fesm2022/ngx-tethys-cascader.mjs +313 -468
- package/fesm2022/ngx-tethys-cascader.mjs.map +1 -1
- package/fesm2022/ngx-tethys-checkbox.mjs +10 -17
- package/fesm2022/ngx-tethys-checkbox.mjs.map +1 -1
- package/fesm2022/ngx-tethys-collapse.mjs +66 -71
- package/fesm2022/ngx-tethys-collapse.mjs.map +1 -1
- package/fesm2022/ngx-tethys-color-picker.mjs +187 -246
- package/fesm2022/ngx-tethys-color-picker.mjs.map +1 -1
- package/fesm2022/ngx-tethys-comment.mjs +16 -10
- package/fesm2022/ngx-tethys-comment.mjs.map +1 -1
- package/fesm2022/ngx-tethys-copy.mjs +25 -28
- package/fesm2022/ngx-tethys-copy.mjs.map +1 -1
- package/fesm2022/ngx-tethys-dialog.mjs +81 -82
- package/fesm2022/ngx-tethys-dialog.mjs.map +1 -1
- package/fesm2022/ngx-tethys-divider.mjs +49 -58
- package/fesm2022/ngx-tethys-divider.mjs.map +1 -1
- package/fesm2022/ngx-tethys-dot.mjs +45 -68
- package/fesm2022/ngx-tethys-dot.mjs.map +1 -1
- package/fesm2022/ngx-tethys-empty.mjs +107 -95
- package/fesm2022/ngx-tethys-empty.mjs.map +1 -1
- package/fesm2022/ngx-tethys-form.mjs +161 -200
- package/fesm2022/ngx-tethys-form.mjs.map +1 -1
- package/fesm2022/ngx-tethys-fullscreen.mjs +21 -23
- package/fesm2022/ngx-tethys-fullscreen.mjs.map +1 -1
- package/fesm2022/ngx-tethys-grid.mjs +160 -152
- package/fesm2022/ngx-tethys-grid.mjs.map +1 -1
- package/fesm2022/ngx-tethys-i18n.mjs +25 -25
- package/fesm2022/ngx-tethys-i18n.mjs.map +1 -1
- package/fesm2022/ngx-tethys-input-number.mjs +101 -114
- package/fesm2022/ngx-tethys-input-number.mjs.map +1 -1
- package/fesm2022/ngx-tethys-input.mjs +268 -271
- package/fesm2022/ngx-tethys-input.mjs.map +1 -1
- package/fesm2022/ngx-tethys-list.mjs +1 -1
- package/fesm2022/ngx-tethys-list.mjs.map +1 -1
- package/fesm2022/ngx-tethys-loading.mjs +17 -35
- package/fesm2022/ngx-tethys-loading.mjs.map +1 -1
- package/fesm2022/ngx-tethys-mention.mjs +52 -74
- package/fesm2022/ngx-tethys-mention.mjs.map +1 -1
- package/fesm2022/ngx-tethys-menu.mjs +106 -179
- package/fesm2022/ngx-tethys-menu.mjs.map +1 -1
- package/fesm2022/ngx-tethys-nav.mjs +169 -201
- package/fesm2022/ngx-tethys-nav.mjs.map +1 -1
- package/fesm2022/ngx-tethys-pagination.mjs +230 -294
- package/fesm2022/ngx-tethys-pagination.mjs.map +1 -1
- package/fesm2022/ngx-tethys-popover.mjs +67 -70
- package/fesm2022/ngx-tethys-popover.mjs.map +1 -1
- package/fesm2022/ngx-tethys-progress.mjs +196 -244
- package/fesm2022/ngx-tethys-progress.mjs.map +1 -1
- package/fesm2022/ngx-tethys-property.mjs +102 -105
- package/fesm2022/ngx-tethys-property.mjs.map +1 -1
- package/fesm2022/ngx-tethys-radio.mjs +34 -38
- package/fesm2022/ngx-tethys-radio.mjs.map +1 -1
- package/fesm2022/ngx-tethys-result.mjs +46 -28
- package/fesm2022/ngx-tethys-result.mjs.map +1 -1
- package/fesm2022/ngx-tethys-skeleton.mjs +339 -342
- package/fesm2022/ngx-tethys-skeleton.mjs.map +1 -1
- package/fesm2022/ngx-tethys-slider.mjs +75 -108
- package/fesm2022/ngx-tethys-slider.mjs.map +1 -1
- package/fesm2022/ngx-tethys-space.mjs +26 -46
- package/fesm2022/ngx-tethys-space.mjs.map +1 -1
- package/fesm2022/ngx-tethys-statistic.mjs +114 -151
- package/fesm2022/ngx-tethys-statistic.mjs.map +1 -1
- package/fesm2022/ngx-tethys-stepper.mjs +74 -107
- package/fesm2022/ngx-tethys-stepper.mjs.map +1 -1
- package/fesm2022/ngx-tethys-switch.mjs +80 -140
- package/fesm2022/ngx-tethys-switch.mjs.map +1 -1
- package/fesm2022/ngx-tethys-table.mjs +1 -1
- package/fesm2022/ngx-tethys-table.mjs.map +1 -1
- package/fesm2022/ngx-tethys-tabs.mjs +69 -87
- package/fesm2022/ngx-tethys-tabs.mjs.map +1 -1
- package/fesm2022/ngx-tethys-tag.mjs +42 -64
- package/fesm2022/ngx-tethys-tag.mjs.map +1 -1
- package/fesm2022/ngx-tethys-timeline.mjs +104 -129
- package/fesm2022/ngx-tethys-timeline.mjs.map +1 -1
- package/fesm2022/ngx-tethys-typography.mjs +36 -33
- package/fesm2022/ngx-tethys-typography.mjs.map +1 -1
- package/fesm2022/ngx-tethys-upload.mjs +91 -130
- package/fesm2022/ngx-tethys-upload.mjs.map +1 -1
- package/fesm2022/ngx-tethys-util.mjs.map +1 -1
- package/fesm2022/ngx-tethys-watermark.mjs +36 -40
- package/fesm2022/ngx-tethys-watermark.mjs.map +1 -1
- package/fesm2022/ngx-tethys.mjs +1 -1
- package/fesm2022/ngx-tethys.mjs.map +1 -1
- package/form/form-group-error/form-group-error.component.d.ts +2 -3
- package/form/form-group-label.directive.d.ts +2 -1
- package/form/form-group.component.d.ts +17 -24
- package/form/form-submit.directive.d.ts +2 -2
- package/form/form.directive.d.ts +6 -8
- package/form/from-group-footer/form-group-footer.component.d.ts +2 -2
- package/form/validator/confirm-validator.directive.d.ts +2 -2
- package/form/validator/unique-validator.directive.d.ts +2 -2
- package/fullscreen/fullscreen.component.d.ts +7 -7
- package/grid/flex.d.ts +14 -19
- package/grid/thy-col.directive.d.ts +6 -9
- package/grid/thy-grid-item.component.d.ts +3 -4
- package/grid/thy-grid.component.d.ts +11 -12
- package/grid/thy-row.directive.d.ts +12 -12
- package/icon/icon.component.d.ts +3 -2
- package/image/image.directive.d.ts +3 -2
- package/input/input-count.component.d.ts +4 -5
- package/input/input-group.component.d.ts +20 -20
- package/input/input-search.component.d.ts +15 -20
- package/input/input.component.d.ts +20 -21
- package/input/input.directive.d.ts +4 -6
- package/input-number/input-number.component.d.ts +21 -29
- package/layout/header.component.d.ts +4 -9
- package/layout/sidebar-header.component.d.ts +2 -1
- package/layout/sidebar.component.d.ts +8 -7
- package/list/list.component.d.ts +2 -1
- package/list/selection/selection-list.d.ts +4 -3
- package/loading/loading.component.d.ts +4 -10
- package/mention/mention.directive.d.ts +6 -7
- package/mention/suggestions/suggestions.component.d.ts +8 -9
- package/menu/group/menu-group.component.d.ts +16 -33
- package/menu/item/action/menu-item-action.component.d.ts +7 -8
- package/menu/item/icon/menu-item-icon.component.d.ts +2 -2
- package/menu/item/menu-item.component.d.ts +4 -4
- package/menu/item/name/menu-item-name.component.d.ts +2 -3
- package/menu/menu.component.d.ts +3 -7
- package/nav/icon-nav/icon-nav-link.directive.d.ts +3 -7
- package/nav/icon-nav/icon-nav.component.d.ts +3 -8
- package/nav/nav-ink-bar.directive.d.ts +4 -6
- package/nav/nav-item.directive.d.ts +7 -10
- package/nav/nav.component.d.ts +20 -48
- package/package.json +1 -1
- package/pagination/pagination.component.d.ts +48 -109
- package/popover/header/popover-header.component.d.ts +7 -6
- package/popover/popover.directive.d.ts +11 -18
- package/progress/progress-circle.component.d.ts +32 -21
- package/progress/progress-strip.component.d.ts +10 -14
- package/progress/progress.component.d.ts +15 -23
- package/property/examples/single/single.component.scss +6 -0
- package/property/properties.component.d.ts +6 -13
- package/property/property-item.component.d.ts +21 -26
- package/property/styles/properties.scss +124 -52
- package/property-operation/property-operation.component.d.ts +6 -5
- package/radio/button/radio-button.component.d.ts +2 -2
- package/radio/group/radio-group.component.d.ts +8 -7
- package/radio/radio.component.d.ts +2 -2
- package/radio/radio.token.d.ts +2 -2
- package/rate/rate-item.component.d.ts +2 -1
- package/rate/rate.component.d.ts +4 -3
- package/resizable/resizable.directive.d.ts +4 -9
- package/resizable/resize-handle.component.d.ts +2 -1
- package/resizable/resize-handles.component.d.ts +2 -1
- package/result/result.component.d.ts +9 -10
- package/schematics/version.d.ts +1 -1
- package/schematics/version.js +1 -1
- package/segment/segment-item.component.d.ts +2 -1
- package/segment/segment.component.d.ts +2 -1
- package/select/custom-select/custom-select.component.d.ts +11 -10
- package/select/native-select/native-select.component.d.ts +2 -1
- package/shared/base-form-check.component.d.ts +3 -2
- package/shared/directives/thy-autofocus.directive.d.ts +3 -2
- package/shared/directives/thy-scroll.directive.d.ts +2 -1
- package/shared/directives/thy-show.d.ts +2 -1
- package/shared/option/group/option-group.component.d.ts +2 -1
- package/shared/option/list-option/list-option.component.d.ts +2 -7
- package/shared/option/option.component.d.ts +2 -1
- package/shared/select/select-control/select-control.component.d.ts +7 -6
- package/skeleton/skeleton-circle.component.d.ts +16 -19
- package/skeleton/skeleton-rectangle.component.d.ts +20 -23
- package/skeleton/skeleton.component.d.ts +5 -6
- package/skeleton/stylized/bullet-list.component.d.ts +11 -13
- package/skeleton/stylized/list.component.d.ts +10 -12
- package/skeleton/stylized/paragraph.component.d.ts +12 -14
- package/slide/slide-body/slide-body-section.component.d.ts +2 -1
- package/slider/slider.component.d.ts +17 -24
- package/space/space.component.d.ts +8 -8
- package/statistic/statistic.component.d.ts +35 -40
- package/stepper/step-header.component.d.ts +6 -10
- package/stepper/step.component.d.ts +6 -6
- package/stepper/stepper.component.d.ts +15 -20
- package/switch/switch.component.d.ts +24 -35
- package/table/table-column.component.d.ts +6 -5
- package/table/table-skeleton.component.d.ts +3 -10
- package/table/table.component.d.ts +11 -10
- package/tabs/tab-content.component.d.ts +4 -4
- package/tabs/tab.component.d.ts +4 -5
- package/tabs/tabs.component.d.ts +13 -15
- package/tag/tag.component.d.ts +10 -16
- package/time-picker/time-picker-panel.component.d.ts +3 -2
- package/time-picker/time-picker.component.d.ts +6 -5
- package/timeline/timeline-item.component.d.ts +9 -13
- package/timeline/timeline.component.d.ts +13 -17
- package/tooltip/tooltip.directive.d.ts +3 -2
- package/tree/tree-node.component.d.ts +6 -15
- package/tree/tree.component.d.ts +8 -7
- package/tree-select/tree-select.component.d.ts +8 -7
- package/typography/bg-color.directive.d.ts +3 -3
- package/typography/text/text.component.d.ts +2 -2
- package/typography/text-color.directive.d.ts +3 -3
- package/upload/file-drop.directive.d.ts +9 -11
- package/upload/file-select-base.d.ts +6 -10
- package/upload/file-select.component.d.ts +10 -20
- package/util/helpers/helpers.d.ts +2 -1
- package/vote/vote.component.d.ts +4 -3
- package/watermark/watermark.directive.d.ts +7 -9
|
@@ -1,25 +1,11 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { inject, ChangeDetectorRef, viewChild, input, contentChild, ChangeDetectionStrategy, Component, Injectable, signal, computed, contentChildren, effect, ViewEncapsulation, NgModule } from '@angular/core';
|
|
3
3
|
import { NgTemplateOutlet, CommonModule } from '@angular/common';
|
|
4
4
|
import { ThySharedModule } from 'ngx-tethys/shared';
|
|
5
5
|
import { ThyIconModule } from 'ngx-tethys/icon';
|
|
6
|
-
import { takeUntil } from 'rxjs/operators';
|
|
7
6
|
import { Subject } from 'rxjs';
|
|
8
7
|
import { coerceBooleanProperty } from 'ngx-tethys/util';
|
|
9
|
-
|
|
10
|
-
class ThyTimelineService {
|
|
11
|
-
constructor() {
|
|
12
|
-
this.check$ = new Subject();
|
|
13
|
-
}
|
|
14
|
-
markForCheck() {
|
|
15
|
-
this.check$.next();
|
|
16
|
-
}
|
|
17
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyTimelineService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
18
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyTimelineService }); }
|
|
19
|
-
}
|
|
20
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyTimelineService, decorators: [{
|
|
21
|
-
type: Injectable
|
|
22
|
-
}] });
|
|
8
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
23
9
|
|
|
24
10
|
/**
|
|
25
11
|
* 时间轴节点组件
|
|
@@ -29,52 +15,57 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
29
15
|
class ThyTimelineItem {
|
|
30
16
|
constructor() {
|
|
31
17
|
this.cdr = inject(ChangeDetectorRef);
|
|
32
|
-
this.
|
|
33
|
-
this.color = 'primary';
|
|
18
|
+
this.template = viewChild('timelineItem');
|
|
34
19
|
this.isLast = false;
|
|
35
20
|
this.isFirst = false;
|
|
36
21
|
this.reverse = false;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
22
|
+
/**
|
|
23
|
+
* 指定圆圈颜色
|
|
24
|
+
* @type primary | success | warning | danger | info
|
|
25
|
+
* @default primary
|
|
26
|
+
*/
|
|
27
|
+
this.thyColor = input('primary');
|
|
28
|
+
/**
|
|
29
|
+
* 自定义节点位置
|
|
30
|
+
* @type left | right | center
|
|
31
|
+
*/
|
|
32
|
+
this.thyPosition = input(undefined);
|
|
33
|
+
/**
|
|
34
|
+
* 自定义时间轴点模板
|
|
35
|
+
* @type TemplateRef
|
|
36
|
+
*/
|
|
37
|
+
this.dot = contentChild('dot');
|
|
38
|
+
/**
|
|
39
|
+
* 自定义另一侧的模板
|
|
40
|
+
* @type TemplateRef
|
|
41
|
+
*/
|
|
42
|
+
this.description = contentChild('description');
|
|
47
43
|
}
|
|
48
44
|
detectChanges() {
|
|
49
45
|
this.cdr.detectChanges();
|
|
50
46
|
}
|
|
51
|
-
ngOnChanges(changes) {
|
|
52
|
-
this.timelineService.markForCheck();
|
|
53
|
-
}
|
|
54
47
|
ngOnInit() { }
|
|
55
48
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyTimelineItem, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
56
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyTimelineItem, isStandalone: true, selector: "thy-timeline-item", inputs: { thyColor: "thyColor",
|
|
49
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyTimelineItem, isStandalone: true, selector: "thy-timeline-item", inputs: { thyColor: { classPropertyName: "thyColor", publicName: "thyColor", isSignal: true, isRequired: false, transformFunction: null }, thyPosition: { classPropertyName: "thyPosition", publicName: "thyPosition", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "dot", first: true, predicate: ["dot"], descendants: true, isSignal: true }, { propertyName: "description", first: true, predicate: ["description"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "template", first: true, predicate: ["timelineItem"], descendants: true, isSignal: true }], exportAs: ["ThyTimelineItem"], ngImport: i0, template: "<ng-template #timelineItem>\n <div\n class=\"thy-timeline-item\"\n [class.thy-timeline-item-reverse-last]=\"isLast && reverse\"\n [class.thy-timeline-item-last]=\"isLast\"\n [class.thy-timeline-item-reverse-first]=\"isFirst && reverse\"\n [class.thy-timeline-item-right]=\"(thyPosition() || position) === 'right'\"\n [class.thy-timeline-item-left]=\"(thyPosition() || position) === 'left'\">\n <div class=\"thy-timeline-item-tail\"></div>\n <div\n class=\"thy-timeline-item-dot\"\n [class.thy-timeline-item-dot-primary]=\"thyColor() === 'primary'\"\n [class.thy-timeline-item-dot-success]=\"thyColor() === 'success'\"\n [class.thy-timeline-item-dot-warning]=\"thyColor() === 'warning'\"\n [class.thy-timeline-item-dot-danger]=\"thyColor() === 'danger'\"\n [class.thy-timeline-item-dot-info]=\"thyColor() === 'info'\"\n [class.thy-timeline-item-dot-custom]=\"!!dot()\">\n @if (dot()) {\n <ng-template [ngTemplateOutlet]=\"dot()\"></ng-template>\n }\n </div>\n <div class=\"thy-timeline-item-content\">\n <ng-content></ng-content>\n </div>\n <div class=\"thy-timeline-item-content-other-side\">\n @if (description()) {\n <ng-template [ngTemplateOutlet]=\"description()\"></ng-template>\n }\n </div>\n </div>\n</ng-template>\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
57
50
|
}
|
|
58
51
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyTimelineItem, decorators: [{
|
|
59
52
|
type: Component,
|
|
60
|
-
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'thy-timeline-item', exportAs: 'ThyTimelineItem', imports: [NgTemplateOutlet], template: "<ng-template #timelineItem>\n <div\n class=\"thy-timeline-item\"\n [class.thy-timeline-item-reverse-last]=\"isLast && reverse\"\n [class.thy-timeline-item-last]=\"isLast\"\n [class.thy-timeline-item-reverse-first]=\"isFirst && reverse\"\n [class.thy-timeline-item-right]=\"(thyPosition || position) === 'right'\"\n [class.thy-timeline-item-left]=\"(thyPosition || position) === 'left'\"
|
|
61
|
-
}],
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
args: ['description', { static: false }]
|
|
77
|
-
}] } });
|
|
53
|
+
args: [{ changeDetection: ChangeDetectionStrategy.OnPush, selector: 'thy-timeline-item', exportAs: 'ThyTimelineItem', imports: [NgTemplateOutlet], template: "<ng-template #timelineItem>\n <div\n class=\"thy-timeline-item\"\n [class.thy-timeline-item-reverse-last]=\"isLast && reverse\"\n [class.thy-timeline-item-last]=\"isLast\"\n [class.thy-timeline-item-reverse-first]=\"isFirst && reverse\"\n [class.thy-timeline-item-right]=\"(thyPosition() || position) === 'right'\"\n [class.thy-timeline-item-left]=\"(thyPosition() || position) === 'left'\">\n <div class=\"thy-timeline-item-tail\"></div>\n <div\n class=\"thy-timeline-item-dot\"\n [class.thy-timeline-item-dot-primary]=\"thyColor() === 'primary'\"\n [class.thy-timeline-item-dot-success]=\"thyColor() === 'success'\"\n [class.thy-timeline-item-dot-warning]=\"thyColor() === 'warning'\"\n [class.thy-timeline-item-dot-danger]=\"thyColor() === 'danger'\"\n [class.thy-timeline-item-dot-info]=\"thyColor() === 'info'\"\n [class.thy-timeline-item-dot-custom]=\"!!dot()\">\n @if (dot()) {\n <ng-template [ngTemplateOutlet]=\"dot()\"></ng-template>\n }\n </div>\n <div class=\"thy-timeline-item-content\">\n <ng-content></ng-content>\n </div>\n <div class=\"thy-timeline-item-content-other-side\">\n @if (description()) {\n <ng-template [ngTemplateOutlet]=\"description()\"></ng-template>\n }\n </div>\n </div>\n</ng-template>\n" }]
|
|
54
|
+
}], ctorParameters: () => [] });
|
|
55
|
+
|
|
56
|
+
class ThyTimelineService {
|
|
57
|
+
constructor() {
|
|
58
|
+
this.check$ = new Subject();
|
|
59
|
+
}
|
|
60
|
+
markForCheck() {
|
|
61
|
+
this.check$.next();
|
|
62
|
+
}
|
|
63
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyTimelineService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
64
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyTimelineService }); }
|
|
65
|
+
}
|
|
66
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyTimelineService, decorators: [{
|
|
67
|
+
type: Injectable
|
|
68
|
+
}] });
|
|
78
69
|
|
|
79
70
|
var ThyTimeModes;
|
|
80
71
|
(function (ThyTimeModes) {
|
|
@@ -91,79 +82,84 @@ class ThyTimeline {
|
|
|
91
82
|
constructor() {
|
|
92
83
|
this.cdr = inject(ChangeDetectorRef);
|
|
93
84
|
this.timelineService = inject(ThyTimelineService);
|
|
85
|
+
/**
|
|
86
|
+
* 节点排序是否倒序
|
|
87
|
+
* @default false
|
|
88
|
+
*/
|
|
89
|
+
this.thyReverse = input(false, { transform: coerceBooleanProperty });
|
|
90
|
+
/**
|
|
91
|
+
* 改变时间轴和内容的相对位置
|
|
92
|
+
* @type left | right | center
|
|
93
|
+
* @default left
|
|
94
|
+
*/
|
|
95
|
+
this.thyMode = input('left');
|
|
94
96
|
/**
|
|
95
97
|
* 时间轴的方向
|
|
96
98
|
* @type horizontal | vertical
|
|
97
99
|
*/
|
|
98
|
-
this.thyDirection = 'vertical';
|
|
100
|
+
this.thyDirection = input('vertical');
|
|
99
101
|
this.timelineItems = [];
|
|
100
|
-
this.
|
|
101
|
-
this.
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
this.
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
this.centerTimeline = true;
|
|
116
|
-
this.rightTimeline = false;
|
|
102
|
+
this.templateTimeline = signal(false);
|
|
103
|
+
this.horizontal = computed(() => {
|
|
104
|
+
return this.thyDirection() === 'horizontal' ? true : false;
|
|
105
|
+
});
|
|
106
|
+
this.rightTimeline = computed(() => {
|
|
107
|
+
const thyMode = this.thyMode();
|
|
108
|
+
const horizontal = this.horizontal();
|
|
109
|
+
const templateTimeline = this.templateTimeline();
|
|
110
|
+
if (thyMode && !horizontal) {
|
|
111
|
+
if (thyMode === 'right') {
|
|
112
|
+
return !templateTimeline;
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
117
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
});
|
|
119
|
+
this.centerTimeline = computed(() => {
|
|
120
|
+
const thyMode = this.thyMode();
|
|
121
|
+
const horizontal = this.horizontal();
|
|
122
|
+
if (thyMode && !horizontal) {
|
|
123
|
+
return thyMode === 'center';
|
|
121
124
|
}
|
|
122
|
-
}
|
|
123
|
-
|
|
125
|
+
});
|
|
126
|
+
this.listOfItems = contentChildren(ThyTimelineItem);
|
|
127
|
+
this.takeUntilDestroyed = takeUntilDestroyed();
|
|
128
|
+
effect(() => {
|
|
124
129
|
this.updateChildren();
|
|
125
|
-
}
|
|
130
|
+
});
|
|
126
131
|
}
|
|
127
132
|
ngOnInit() {
|
|
128
|
-
this.
|
|
129
|
-
this.timelineService.check$.pipe(takeUntil(this.destroy$)).subscribe(() => {
|
|
133
|
+
this.timelineService.check$.pipe(this.takeUntilDestroyed).subscribe(() => {
|
|
130
134
|
this.cdr.markForCheck();
|
|
131
135
|
});
|
|
132
136
|
}
|
|
133
|
-
ngAfterContentInit() {
|
|
134
|
-
this.updateChildren();
|
|
135
|
-
this.listOfItems.changes.subscribe(() => {
|
|
136
|
-
this.updateChildren();
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
ngOnDestroy() {
|
|
140
|
-
this.destroy$.next();
|
|
141
|
-
this.destroy$.complete();
|
|
142
|
-
}
|
|
143
137
|
updateChildren() {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
item.
|
|
150
|
-
|
|
151
|
-
|
|
138
|
+
const listOfItems = this.listOfItems();
|
|
139
|
+
const thyReverse = this.thyReverse();
|
|
140
|
+
if (listOfItems && listOfItems.length) {
|
|
141
|
+
const length = listOfItems.length;
|
|
142
|
+
listOfItems.forEach((item, index) => {
|
|
143
|
+
item.isLast = !thyReverse ? index === length - 1 : index === 0;
|
|
144
|
+
item.isFirst = thyReverse ? index === length - 1 : index === 0;
|
|
145
|
+
item.reverse = thyReverse;
|
|
146
|
+
if (!this.horizontal()) {
|
|
147
|
+
item.position = getTimelineItemPosition(index, this.thyMode());
|
|
152
148
|
}
|
|
153
|
-
if (item.description || (item.thyPosition && !this.horizontal)) {
|
|
154
|
-
this.templateTimeline
|
|
149
|
+
if (item.description() || (item.thyPosition() && !this.horizontal())) {
|
|
150
|
+
this.templateTimeline.set(true);
|
|
155
151
|
}
|
|
156
152
|
item.detectChanges();
|
|
157
153
|
});
|
|
158
|
-
this.timelineItems = this.thyReverse ?
|
|
154
|
+
this.timelineItems = this.thyReverse() ? [...listOfItems].reverse() : [...listOfItems];
|
|
159
155
|
}
|
|
160
156
|
this.cdr.markForCheck();
|
|
161
157
|
}
|
|
162
158
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyTimeline, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
163
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyTimeline, isStandalone: true, selector: "thy-timeline", inputs: { thyReverse:
|
|
159
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyTimeline, isStandalone: true, selector: "thy-timeline", inputs: { thyReverse: { classPropertyName: "thyReverse", publicName: "thyReverse", isSignal: true, isRequired: false, transformFunction: null }, thyMode: { classPropertyName: "thyMode", publicName: "thyMode", isSignal: true, isRequired: false, transformFunction: null }, thyDirection: { classPropertyName: "thyDirection", publicName: "thyDirection", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.thy-timeline-right": "rightTimeline()", "class.thy-timeline-center": "centerTimeline()", "class.thy-timeline-template": "templateTimeline()", "class.thy-timeline-horizontal": "horizontal()" }, classAttribute: "thy-timeline" }, providers: [ThyTimelineService], queries: [{ propertyName: "listOfItems", predicate: ThyTimelineItem, isSignal: true }], ngImport: i0, template: `
|
|
164
160
|
<ng-container>
|
|
165
161
|
@for (item of timelineItems; track $index) {
|
|
166
|
-
<ng-template [ngTemplateOutlet]="item.template"></ng-template>
|
|
162
|
+
<ng-template [ngTemplateOutlet]="item.template()"></ng-template>
|
|
167
163
|
}
|
|
168
164
|
<ng-template>
|
|
169
165
|
<ng-content></ng-content>
|
|
@@ -181,44 +177,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
181
177
|
template: `
|
|
182
178
|
<ng-container>
|
|
183
179
|
@for (item of timelineItems; track $index) {
|
|
184
|
-
<ng-template [ngTemplateOutlet]="item.template"></ng-template>
|
|
180
|
+
<ng-template [ngTemplateOutlet]="item.template()"></ng-template>
|
|
185
181
|
}
|
|
186
182
|
<ng-template>
|
|
187
183
|
<ng-content></ng-content>
|
|
188
184
|
</ng-template>
|
|
189
185
|
</ng-container>
|
|
190
186
|
`,
|
|
187
|
+
host: {
|
|
188
|
+
class: 'thy-timeline',
|
|
189
|
+
'[class.thy-timeline-right]': `rightTimeline()`,
|
|
190
|
+
'[class.thy-timeline-center]': `centerTimeline()`,
|
|
191
|
+
'[class.thy-timeline-template]': `templateTimeline()`,
|
|
192
|
+
'[class.thy-timeline-horizontal]': `horizontal()`
|
|
193
|
+
},
|
|
191
194
|
imports: [NgTemplateOutlet]
|
|
192
195
|
}]
|
|
193
|
-
}],
|
|
194
|
-
type: Input,
|
|
195
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
196
|
-
}], thyMode: [{
|
|
197
|
-
type: Input
|
|
198
|
-
}], thyDirection: [{
|
|
199
|
-
type: Input
|
|
200
|
-
}], isTimeline: [{
|
|
201
|
-
type: HostBinding,
|
|
202
|
-
args: [`class.thy-timeline`]
|
|
203
|
-
}], rightTimeline: [{
|
|
204
|
-
type: HostBinding,
|
|
205
|
-
args: [`class.thy-timeline-right`]
|
|
206
|
-
}], centerTimeline: [{
|
|
207
|
-
type: HostBinding,
|
|
208
|
-
args: [`class.thy-timeline-center`]
|
|
209
|
-
}], templateTimeline: [{
|
|
210
|
-
type: HostBinding,
|
|
211
|
-
args: [`class.thy-timeline-template`]
|
|
212
|
-
}], horizontal: [{
|
|
213
|
-
type: HostBinding,
|
|
214
|
-
args: [`class.thy-timeline-horizontal`]
|
|
215
|
-
}], listOfItems: [{
|
|
216
|
-
type: ContentChildren,
|
|
217
|
-
args: [ThyTimelineItem]
|
|
218
|
-
}] } });
|
|
219
|
-
function simpleChangeActivated(simpleChange) {
|
|
220
|
-
return !!(simpleChange && (simpleChange.previousValue !== simpleChange.currentValue || simpleChange.isFirstChange()));
|
|
221
|
-
}
|
|
196
|
+
}], ctorParameters: () => [] });
|
|
222
197
|
function getTimelineItemPosition(index, mode) {
|
|
223
198
|
return mode === 'left' ? 'left' : mode === 'right' ? 'right' : mode === 'center' && index % 2 === 0 ? 'left' : 'right';
|
|
224
199
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngx-tethys-timeline.mjs","sources":["../../../src/timeline/timeline.service.ts","../../../src/timeline/timeline-item.component.ts","../../../src/timeline/timeline-item.component.html","../../../src/timeline/timeline.component.ts","../../../src/timeline/timeline.module.ts","../../../src/timeline/ngx-tethys-timeline.ts"],"sourcesContent":["import { Injectable } from '@angular/core';\nimport { Subject } from 'rxjs';\n\n@Injectable()\nexport class ThyTimelineService {\n check$ = new Subject<void>();\n markForCheck(): void {\n this.check$.next();\n }\n}\n","import {\n Component,\n Input,\n HostBinding,\n OnInit,\n OnChanges,\n ContentChild,\n TemplateRef,\n ViewChild,\n ChangeDetectorRef,\n ChangeDetectionStrategy,\n SimpleChanges,\n inject\n} from '@angular/core';\nimport { SafeAny } from 'ngx-tethys/types';\nimport { ThyTimeMode } from './timeline.type';\nimport { ThyTimelineService } from './timeline.service';\nimport { NgTemplateOutlet } from '@angular/common';\n\nexport type thyColor = 'primary' | 'success' | 'warning' | 'danger' | 'info';\n\n/**\n * 时间轴节点组件\n * @name thy-timeline-item\n * @order 20\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n selector: 'thy-timeline-item',\n templateUrl: './timeline-item.component.html',\n exportAs: 'ThyTimelineItem',\n imports: [NgTemplateOutlet]\n})\nexport class ThyTimelineItem implements OnInit, OnChanges {\n private cdr = inject(ChangeDetectorRef);\n private timelineService = inject(ThyTimelineService);\n\n @ViewChild('timelineItem', { static: false }) template: TemplateRef<void>;\n\n @HostBinding('class') className: string;\n\n public color: thyColor = 'primary';\n\n public isLast = false;\n\n public isFirst = false;\n\n public position: ThyTimeMode;\n\n public reverse: Boolean = false;\n\n /**\n * 指定圆圈颜色\n * @type primary | success | warning | danger | info\n * @default primary\n */\n @Input()\n set thyColor(value: thyColor) {\n if (value) {\n this.color = value;\n }\n }\n\n /**\n * 自定义节点位置\n * @type left | right | center\n */\n @Input() thyPosition: ThyTimeMode;\n\n /**\n * 自定义时间轴点模板\n * @type TemplateRef\n */\n @ContentChild('dot', { static: false }) dot: TemplateRef<SafeAny>;\n\n /**\n * 自定义另一侧的模板\n * @type TemplateRef\n */\n @ContentChild('description', { static: false }) description: TemplateRef<SafeAny>;\n\n detectChanges(): void {\n this.cdr.detectChanges();\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n this.timelineService.markForCheck();\n }\n\n ngOnInit() {}\n}\n","<ng-template #timelineItem>\n <div\n class=\"thy-timeline-item\"\n [class.thy-timeline-item-reverse-last]=\"isLast && reverse\"\n [class.thy-timeline-item-last]=\"isLast\"\n [class.thy-timeline-item-reverse-first]=\"isFirst && reverse\"\n [class.thy-timeline-item-right]=\"(thyPosition || position) === 'right'\"\n [class.thy-timeline-item-left]=\"(thyPosition || position) === 'left'\"\n >\n <div class=\"thy-timeline-item-tail\"></div>\n <div\n class=\"thy-timeline-item-dot\"\n [class.thy-timeline-item-dot-primary]=\"color === 'primary'\"\n [class.thy-timeline-item-dot-success]=\"color === 'success'\"\n [class.thy-timeline-item-dot-warning]=\"color === 'warning'\"\n [class.thy-timeline-item-dot-danger]=\"color === 'danger'\"\n [class.thy-timeline-item-dot-info]=\"color === 'info'\"\n [class.thy-timeline-item-dot-custom]=\"!!dot\"\n >\n @if (dot) {\n <ng-template [ngTemplateOutlet]=\"dot\"></ng-template>\n }\n </div>\n <div class=\"thy-timeline-item-content\">\n <ng-content></ng-content>\n </div>\n <div class=\"thy-timeline-item-content-other-side\">\n @if (description) {\n <ng-template [ngTemplateOutlet]=\"description\"></ng-template>\n }\n </div>\n </div>\n</ng-template>\n","import {\n Component,\n Input,\n HostBinding,\n ContentChildren,\n QueryList,\n AfterContentInit,\n OnChanges,\n OnDestroy,\n OnInit,\n SimpleChanges,\n SimpleChange,\n ChangeDetectorRef,\n ViewEncapsulation,\n ChangeDetectionStrategy,\n inject\n} from '@angular/core';\nimport { takeUntil } from 'rxjs/operators';\nimport { ThyTimelineItem } from './timeline-item.component';\nimport { ThyTimelineService } from './timeline.service';\nimport { Subject } from 'rxjs';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { coerceBooleanProperty } from 'ngx-tethys/util';\nimport { ThyTimeMode } from './timeline.type';\n\nexport enum ThyTimeModes {\n left = 'left',\n right = 'right',\n center = 'center'\n}\n\nexport type ThyTimeDirection = 'horizontal' | 'vertical';\n\n/**\n * 时间轴组件\n * @name thy-timeline\n * @order 10\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n selector: 'thy-timeline',\n providers: [ThyTimelineService],\n template: `\n <ng-container>\n @for (item of timelineItems; track $index) {\n <ng-template [ngTemplateOutlet]=\"item.template\"></ng-template>\n }\n <ng-template>\n <ng-content></ng-content>\n </ng-template>\n </ng-container>\n `,\n imports: [NgTemplateOutlet]\n})\nexport class ThyTimeline implements OnInit, AfterContentInit, OnChanges, OnDestroy {\n private cdr = inject(ChangeDetectorRef);\n private timelineService = inject(ThyTimelineService);\n\n /**\n * 节点排序是否倒序\n * @default false\n */\n @Input({ transform: coerceBooleanProperty }) thyReverse: boolean;\n\n /**\n * 改变时间轴和内容的相对位置\n * @type left | right | center\n * @default left\n */\n @Input() thyMode: ThyTimeMode;\n\n /**\n * 时间轴的方向\n * @type horizontal | vertical\n */\n @Input() thyDirection: ThyTimeDirection = 'vertical';\n\n public timelineItems: ThyTimelineItem[] = [];\n\n private destroy$ = new Subject<void>();\n\n @HostBinding(`class.thy-timeline`) isTimeline = true;\n @HostBinding(`class.thy-timeline-right`) rightTimeline = false;\n @HostBinding(`class.thy-timeline-center`) centerTimeline = false;\n @HostBinding(`class.thy-timeline-template`) templateTimeline = false;\n @HostBinding(`class.thy-timeline-horizontal`) horizontal = false;\n\n @ContentChildren(ThyTimelineItem)\n listOfItems: QueryList<ThyTimelineItem>;\n\n ngOnChanges(changes: SimpleChanges): void {\n const { thyMode, thyReverse } = changes;\n if (thyMode && !this.horizontal) {\n if (thyMode.currentValue === 'right') {\n this.rightTimeline = !this.templateTimeline;\n this.centerTimeline = false;\n } else if (thyMode.currentValue === 'center') {\n this.centerTimeline = true;\n this.rightTimeline = false;\n } else {\n this.rightTimeline = false;\n this.centerTimeline = false;\n }\n }\n if ((simpleChangeActivated(thyMode) && !this.horizontal) || simpleChangeActivated(thyReverse)) {\n this.updateChildren();\n }\n }\n\n ngOnInit() {\n this.horizontal = this.thyDirection === 'horizontal' ? true : false;\n this.timelineService.check$.pipe(takeUntil(this.destroy$)).subscribe(() => {\n this.cdr.markForCheck();\n });\n }\n\n ngAfterContentInit() {\n this.updateChildren();\n this.listOfItems.changes.subscribe(() => {\n this.updateChildren();\n });\n }\n\n ngOnDestroy(): void {\n this.destroy$.next();\n this.destroy$.complete();\n }\n\n private updateChildren(): void {\n if (this.listOfItems && this.listOfItems.length) {\n const length = this.listOfItems.length;\n this.listOfItems.forEach((item, index) => {\n item.isLast = !this.thyReverse ? index === length - 1 : index === 0;\n item.isFirst = this.thyReverse ? index === length - 1 : index === 0;\n item.reverse = this.thyReverse;\n if (!this.horizontal) {\n item.position = getTimelineItemPosition(index, this.thyMode);\n }\n if (item.description || (item.thyPosition && !this.horizontal)) {\n this.templateTimeline = true;\n }\n item.detectChanges();\n });\n this.timelineItems = this.thyReverse ? this.listOfItems.toArray().reverse() : this.listOfItems.toArray();\n }\n this.cdr.markForCheck();\n }\n}\nfunction simpleChangeActivated(simpleChange?: SimpleChange): boolean {\n return !!(simpleChange && (simpleChange.previousValue !== simpleChange.currentValue || simpleChange.isFirstChange()));\n}\n\nfunction getTimelineItemPosition(index: number, mode: ThyTimeMode): ThyTimeMode | undefined {\n return mode === 'left' ? 'left' : mode === 'right' ? 'right' : mode === 'center' && index % 2 === 0 ? 'left' : 'right';\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ThySharedModule } from 'ngx-tethys/shared';\nimport { ThyIconModule } from 'ngx-tethys/icon';\nimport { ThyTimeline } from './timeline.component';\nimport { ThyTimelineItem } from './timeline-item.component';\n\n@NgModule({\n imports: [CommonModule, ThySharedModule, ThyIconModule, ThyTimeline, ThyTimelineItem],\n exports: [ThyTimeline, ThyTimelineItem],\n providers: []\n})\nexport class ThyTimelineModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;MAIa,kBAAkB,CAAA;AAD/B,IAAA,WAAA,GAAA;AAEI,QAAA,IAAA,CAAA,MAAM,GAAG,IAAI,OAAO,EAAQ;AAI/B;IAHG,YAAY,GAAA;AACR,QAAA,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;;8GAHb,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;kHAAlB,kBAAkB,EAAA,CAAA,CAAA;;2FAAlB,kBAAkB,EAAA,UAAA,EAA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AAE,eAAe,EAAE,aAAa,EAAE,WAAW,EAAE,eAAe,CAAC;AACrF,oBAAA,OAAO,EAAE,CAAC,WAAW,EAAE,eAAe,CAAC;AACvC,oBAAA,SAAS,EAAE;AACd,iBAAA;;;ACXD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ngx-tethys-timeline.mjs","sources":["../../../src/timeline/timeline-item.component.ts","../../../src/timeline/timeline-item.component.html","../../../src/timeline/timeline.service.ts","../../../src/timeline/timeline.component.ts","../../../src/timeline/timeline.module.ts","../../../src/timeline/ngx-tethys-timeline.ts"],"sourcesContent":["import {\n Component,\n OnInit,\n TemplateRef,\n ChangeDetectorRef,\n ChangeDetectionStrategy,\n inject,\n input,\n viewChild,\n contentChild\n} from '@angular/core';\nimport { SafeAny } from 'ngx-tethys/types';\nimport { ThyTimeMode } from './timeline.type';\nimport { NgTemplateOutlet } from '@angular/common';\n\nexport type thyColor = 'primary' | 'success' | 'warning' | 'danger' | 'info';\n\n/**\n * 时间轴节点组件\n * @name thy-timeline-item\n * @order 20\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n selector: 'thy-timeline-item',\n templateUrl: './timeline-item.component.html',\n exportAs: 'ThyTimelineItem',\n imports: [NgTemplateOutlet]\n})\nexport class ThyTimelineItem implements OnInit {\n private cdr = inject(ChangeDetectorRef);\n\n readonly template = viewChild<TemplateRef<void>>('timelineItem');\n\n public isLast = false;\n\n public isFirst = false;\n\n public position: ThyTimeMode;\n\n public reverse: Boolean = false;\n\n /**\n * 指定圆圈颜色\n * @type primary | success | warning | danger | info\n * @default primary\n */\n readonly thyColor = input<thyColor>('primary');\n\n /**\n * 自定义节点位置\n * @type left | right | center\n */\n readonly thyPosition = input<ThyTimeMode>(undefined);\n\n /**\n * 自定义时间轴点模板\n * @type TemplateRef\n */\n readonly dot = contentChild<TemplateRef<SafeAny>>('dot');\n\n /**\n * 自定义另一侧的模板\n * @type TemplateRef\n */\n readonly description = contentChild<TemplateRef<SafeAny>>('description');\n\n constructor() {}\n\n detectChanges(): void {\n this.cdr.detectChanges();\n }\n\n ngOnInit() {}\n}\n","<ng-template #timelineItem>\n <div\n class=\"thy-timeline-item\"\n [class.thy-timeline-item-reverse-last]=\"isLast && reverse\"\n [class.thy-timeline-item-last]=\"isLast\"\n [class.thy-timeline-item-reverse-first]=\"isFirst && reverse\"\n [class.thy-timeline-item-right]=\"(thyPosition() || position) === 'right'\"\n [class.thy-timeline-item-left]=\"(thyPosition() || position) === 'left'\">\n <div class=\"thy-timeline-item-tail\"></div>\n <div\n class=\"thy-timeline-item-dot\"\n [class.thy-timeline-item-dot-primary]=\"thyColor() === 'primary'\"\n [class.thy-timeline-item-dot-success]=\"thyColor() === 'success'\"\n [class.thy-timeline-item-dot-warning]=\"thyColor() === 'warning'\"\n [class.thy-timeline-item-dot-danger]=\"thyColor() === 'danger'\"\n [class.thy-timeline-item-dot-info]=\"thyColor() === 'info'\"\n [class.thy-timeline-item-dot-custom]=\"!!dot()\">\n @if (dot()) {\n <ng-template [ngTemplateOutlet]=\"dot()\"></ng-template>\n }\n </div>\n <div class=\"thy-timeline-item-content\">\n <ng-content></ng-content>\n </div>\n <div class=\"thy-timeline-item-content-other-side\">\n @if (description()) {\n <ng-template [ngTemplateOutlet]=\"description()\"></ng-template>\n }\n </div>\n </div>\n</ng-template>\n","import { Injectable } from '@angular/core';\nimport { Subject } from 'rxjs';\n\n@Injectable()\nexport class ThyTimelineService {\n check$ = new Subject<void>();\n markForCheck(): void {\n this.check$.next();\n }\n}\n","import {\n Component,\n OnInit,\n ChangeDetectorRef,\n ViewEncapsulation,\n ChangeDetectionStrategy,\n inject,\n input,\n effect,\n computed,\n signal,\n WritableSignal,\n contentChildren\n} from '@angular/core';\nimport { ThyTimelineItem } from './timeline-item.component';\nimport { ThyTimelineService } from './timeline.service';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { coerceBooleanProperty, ThyBooleanInput } from 'ngx-tethys/util';\nimport { ThyTimeMode } from './timeline.type';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\n\nexport enum ThyTimeModes {\n left = 'left',\n right = 'right',\n center = 'center'\n}\n\nexport type ThyTimeDirection = 'horizontal' | 'vertical';\n\n/**\n * 时间轴组件\n * @name thy-timeline\n * @order 10\n */\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n selector: 'thy-timeline',\n providers: [ThyTimelineService],\n template: `\n <ng-container>\n @for (item of timelineItems; track $index) {\n <ng-template [ngTemplateOutlet]=\"item.template()\"></ng-template>\n }\n <ng-template>\n <ng-content></ng-content>\n </ng-template>\n </ng-container>\n `,\n host: {\n class: 'thy-timeline',\n '[class.thy-timeline-right]': `rightTimeline()`,\n '[class.thy-timeline-center]': `centerTimeline()`,\n '[class.thy-timeline-template]': `templateTimeline()`,\n '[class.thy-timeline-horizontal]': `horizontal()`\n },\n imports: [NgTemplateOutlet]\n})\nexport class ThyTimeline implements OnInit {\n private cdr = inject(ChangeDetectorRef);\n\n private timelineService = inject(ThyTimelineService);\n\n /**\n * 节点排序是否倒序\n * @default false\n */\n readonly thyReverse = input<boolean, ThyBooleanInput>(false, { transform: coerceBooleanProperty });\n\n /**\n * 改变时间轴和内容的相对位置\n * @type left | right | center\n * @default left\n */\n readonly thyMode = input<ThyTimeMode>('left');\n\n /**\n * 时间轴的方向\n * @type horizontal | vertical\n */\n readonly thyDirection = input<ThyTimeDirection>('vertical');\n\n public timelineItems: ThyTimelineItem[] = [];\n\n public templateTimeline: WritableSignal<boolean> = signal(false);\n\n public horizontal = computed(() => {\n return this.thyDirection() === 'horizontal' ? true : false;\n });\n\n public rightTimeline = computed(() => {\n const thyMode = this.thyMode();\n const horizontal = this.horizontal();\n const templateTimeline = this.templateTimeline();\n if (thyMode && !horizontal) {\n if (thyMode === 'right') {\n return !templateTimeline;\n } else {\n return false;\n }\n }\n });\n\n public centerTimeline = computed(() => {\n const thyMode = this.thyMode();\n const horizontal = this.horizontal();\n if (thyMode && !horizontal) {\n return thyMode === 'center';\n }\n });\n\n readonly listOfItems = contentChildren(ThyTimelineItem);\n\n private takeUntilDestroyed = takeUntilDestroyed();\n\n constructor() {\n effect(() => {\n this.updateChildren();\n });\n }\n\n ngOnInit() {\n this.timelineService.check$.pipe(this.takeUntilDestroyed).subscribe(() => {\n this.cdr.markForCheck();\n });\n }\n\n private updateChildren(): void {\n const listOfItems = this.listOfItems();\n const thyReverse = this.thyReverse();\n if (listOfItems && listOfItems.length) {\n const length = listOfItems.length;\n listOfItems.forEach((item, index) => {\n item.isLast = !thyReverse ? index === length - 1 : index === 0;\n item.isFirst = thyReverse ? index === length - 1 : index === 0;\n item.reverse = thyReverse;\n if (!this.horizontal()) {\n item.position = getTimelineItemPosition(index, this.thyMode());\n }\n if (item.description() || (item.thyPosition() && !this.horizontal())) {\n this.templateTimeline.set(true);\n }\n item.detectChanges();\n });\n this.timelineItems = this.thyReverse() ? [...listOfItems].reverse() : [...listOfItems];\n }\n this.cdr.markForCheck();\n }\n}\n\nfunction getTimelineItemPosition(index: number, mode: ThyTimeMode): ThyTimeMode | undefined {\n return mode === 'left' ? 'left' : mode === 'right' ? 'right' : mode === 'center' && index % 2 === 0 ? 'left' : 'right';\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ThySharedModule } from 'ngx-tethys/shared';\nimport { ThyIconModule } from 'ngx-tethys/icon';\nimport { ThyTimeline } from './timeline.component';\nimport { ThyTimelineItem } from './timeline-item.component';\n\n@NgModule({\n imports: [CommonModule, ThySharedModule, ThyIconModule, ThyTimeline, ThyTimelineItem],\n exports: [ThyTimeline, ThyTimelineItem],\n providers: []\n})\nexport class ThyTimelineModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAiBA;;;;AAIG;MAQU,eAAe,CAAA;AAsCxB,IAAA,WAAA,GAAA;AArCQ,QAAA,IAAA,CAAA,GAAG,GAAG,MAAM,CAAC,iBAA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A,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,iBAAiB,EAJhB,OAAA,EAAA,CAAA,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,WAAW,EAAE,eAAe,CAC1E,EAAA,OAAA,EAAA,CAAA,WAAW,EAAE,eAAe,CAAA,EAAA,CAAA,CAAA;AAG7B,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,iBAAiB,EAJhB,OAAA,EAAA,CAAA,YAAY,EAAE,eAAe,EAAE,aAAa,CAAA,EAAA,CAAA,CAAA;;2FAI7C,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAL7B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACN,OAAO,EAAE,CAAC,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,WAAW,EAAE,eAAe,CAAC;AACrF,oBAAA,OAAO,EAAE,CAAC,WAAW,EAAE,eAAe,CAAC;AACvC,oBAAA,SAAS,EAAE;AACd,iBAAA;;;ACXD;;AAEG;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { input, ChangeDetectionStrategy, Component, inject, ElementRef, effect, Directive, NgModule } from '@angular/core';
|
|
3
3
|
import { CommonModule } from '@angular/common';
|
|
4
4
|
import { ThyIcon, ThyIconModule } from 'ngx-tethys/icon';
|
|
5
5
|
import { isThemeColor, isTextColor, isBgColor } from 'ngx-tethys/core';
|
|
@@ -11,19 +11,22 @@ import { useHostRenderer } from '@tethys/cdk/dom';
|
|
|
11
11
|
* @order 10
|
|
12
12
|
*/
|
|
13
13
|
class ThyText {
|
|
14
|
-
constructor() {
|
|
14
|
+
constructor() {
|
|
15
|
+
/**
|
|
16
|
+
* 前置图标
|
|
17
|
+
*/
|
|
18
|
+
this.thyIcon = input(undefined);
|
|
19
|
+
}
|
|
15
20
|
ngOnInit() { }
|
|
16
21
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyText, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
17
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyText, isStandalone: true, selector: "thy-text, [thyText]:not(thy-divider)", inputs: { thyIcon: "thyIcon" }, host: { classAttribute: "thy-text" }, ngImport: i0, template: "@if (thyIcon) {\n <thy-icon [thyIconName]=\"thyIcon\"></thy-icon>\n}\n<ng-content></ng-content>\n", dependencies: [{ kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
22
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyText, isStandalone: true, selector: "thy-text, [thyText]:not(thy-divider)", inputs: { thyIcon: { classPropertyName: "thyIcon", publicName: "thyIcon", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "thy-text" }, ngImport: i0, template: "@if (thyIcon()) {\n <thy-icon [thyIconName]=\"thyIcon()\"></thy-icon>\n}\n<ng-content></ng-content>\n", dependencies: [{ kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
18
23
|
}
|
|
19
24
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyText, decorators: [{
|
|
20
25
|
type: Component,
|
|
21
26
|
args: [{ selector: 'thy-text, [thyText]:not(thy-divider)', changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
22
27
|
class: 'thy-text'
|
|
23
|
-
}, imports: [ThyIcon], template: "@if (thyIcon) {\n <thy-icon [thyIconName]=\"thyIcon\"></thy-icon>\n}\n<ng-content></ng-content>\n" }]
|
|
24
|
-
}], ctorParameters: () => []
|
|
25
|
-
type: Input
|
|
26
|
-
}] } });
|
|
28
|
+
}, imports: [ThyIcon], template: "@if (thyIcon()) {\n <thy-icon [thyIconName]=\"thyIcon()\"></thy-icon>\n}\n<ng-content></ng-content>\n" }]
|
|
29
|
+
}], ctorParameters: () => [] });
|
|
27
30
|
|
|
28
31
|
/**
|
|
29
32
|
* @name thyTextColor
|
|
@@ -34,15 +37,17 @@ class ThyTextColorDirective {
|
|
|
34
37
|
this.elementRef = inject(ElementRef);
|
|
35
38
|
this.color = '';
|
|
36
39
|
this.hostRenderer = useHostRenderer();
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
40
|
+
/**
|
|
41
|
+
* @type ThyThemeColor | ThyTextColor | string
|
|
42
|
+
* @description 文本颜色,支持设置主题色和自定义颜色值,主题色为 `default`、`primary`、`success`、`info`、`warning`、`danger`、`light`、`secondary`、`muted`、`desc`、`placeholder`
|
|
43
|
+
*/
|
|
44
|
+
this.thyTextColor = input(undefined);
|
|
45
|
+
effect(() => {
|
|
46
|
+
const color = this.thyTextColor();
|
|
47
|
+
this.clearColor();
|
|
48
|
+
this.color = color;
|
|
49
|
+
this.setColor();
|
|
50
|
+
});
|
|
46
51
|
}
|
|
47
52
|
ngOnInit() { }
|
|
48
53
|
setColor() {
|
|
@@ -60,7 +65,7 @@ class ThyTextColorDirective {
|
|
|
60
65
|
}
|
|
61
66
|
}
|
|
62
67
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyTextColorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
63
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
68
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: ThyTextColorDirective, isStandalone: true, selector: "[thyTextColor]", inputs: { thyTextColor: { classPropertyName: "thyTextColor", publicName: "thyTextColor", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["thyTextColor"], ngImport: i0 }); }
|
|
64
69
|
}
|
|
65
70
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyTextColorDirective, decorators: [{
|
|
66
71
|
type: Directive,
|
|
@@ -68,9 +73,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
68
73
|
selector: '[thyTextColor]',
|
|
69
74
|
exportAs: 'thyTextColor'
|
|
70
75
|
}]
|
|
71
|
-
}],
|
|
72
|
-
type: Input
|
|
73
|
-
}] } });
|
|
76
|
+
}], ctorParameters: () => [] });
|
|
74
77
|
|
|
75
78
|
/**
|
|
76
79
|
* @name thyBgColor
|
|
@@ -81,15 +84,17 @@ class ThyBackgroundColorDirective {
|
|
|
81
84
|
this.elementRef = inject(ElementRef);
|
|
82
85
|
this.bgColor = '';
|
|
83
86
|
this.hostRenderer = useHostRenderer();
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
87
|
+
/**
|
|
88
|
+
* @type ThyThemeColor | ThyBgColor | string
|
|
89
|
+
* @description 背景颜色,支持设置主题色和自定义颜色值,主题色为 `primary`、`success`、`info`、`danger`、`warning`、`dark`、`secondary`、`light`、`lighter`、`bright`、`content`、`white`、`transparent`
|
|
90
|
+
*/
|
|
91
|
+
this.thyBgColor = input(undefined);
|
|
92
|
+
effect(() => {
|
|
93
|
+
const bgColor = this.thyBgColor();
|
|
94
|
+
this.clearBgColor();
|
|
95
|
+
this.bgColor = bgColor;
|
|
96
|
+
this.setBgColor();
|
|
97
|
+
});
|
|
93
98
|
}
|
|
94
99
|
setBgColor() {
|
|
95
100
|
if (isThemeColor(this.bgColor) || isBgColor(this.bgColor)) {
|
|
@@ -106,7 +111,7 @@ class ThyBackgroundColorDirective {
|
|
|
106
111
|
}
|
|
107
112
|
}
|
|
108
113
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyBackgroundColorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
109
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
114
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: ThyBackgroundColorDirective, isStandalone: true, selector: "[thyBgColor]", inputs: { thyBgColor: { classPropertyName: "thyBgColor", publicName: "thyBgColor", isSignal: true, isRequired: false, transformFunction: null } }, exportAs: ["thyBgColor"], ngImport: i0 }); }
|
|
110
115
|
}
|
|
111
116
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyBackgroundColorDirective, decorators: [{
|
|
112
117
|
type: Directive,
|
|
@@ -114,9 +119,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
114
119
|
selector: '[thyBgColor]',
|
|
115
120
|
exportAs: 'thyBgColor'
|
|
116
121
|
}]
|
|
117
|
-
}],
|
|
118
|
-
type: Input
|
|
119
|
-
}] } });
|
|
122
|
+
}], ctorParameters: () => [] });
|
|
120
123
|
|
|
121
124
|
class ThyTypographyModule {
|
|
122
125
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyTypographyModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngx-tethys-typography.mjs","sources":["../../../src/typography/text/text.component.ts","../../../src/typography/text/text.component.html","../../../src/typography/text-color.directive.ts","../../../src/typography/bg-color.directive.ts","../../../src/typography/module.ts","../../../src/typography/ngx-tethys-typography.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component,
|
|
1
|
+
{"version":3,"file":"ngx-tethys-typography.mjs","sources":["../../../src/typography/text/text.component.ts","../../../src/typography/text/text.component.html","../../../src/typography/text-color.directive.ts","../../../src/typography/bg-color.directive.ts","../../../src/typography/module.ts","../../../src/typography/ngx-tethys-typography.ts"],"sourcesContent":["import { ChangeDetectionStrategy, Component, OnInit, input } from '@angular/core';\nimport { ThyIcon } from 'ngx-tethys/icon';\n\n/**\n * 文本组件\n * @name thy-text,[thyText]\n * @order 10\n */\n@Component({\n selector: 'thy-text, [thyText]:not(thy-divider)',\n templateUrl: './text.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n class: 'thy-text'\n },\n imports: [ThyIcon]\n})\nexport class ThyText implements OnInit {\n /**\n * 前置图标\n */\n readonly thyIcon = input<string>(undefined);\n\n constructor() {}\n\n ngOnInit(): void {}\n}\n","@if (thyIcon()) {\n <thy-icon [thyIconName]=\"thyIcon()\"></thy-icon>\n}\n<ng-content></ng-content>\n","import { Directive, ElementRef, OnInit, effect, inject, input } from '@angular/core';\nimport { isTextColor, isThemeColor, ThyTextColor, ThyThemeColor } from 'ngx-tethys/core';\nimport { useHostRenderer } from '@tethys/cdk/dom';\n\n/**\n * @name thyTextColor\n * @order 20\n */\n@Directive({\n selector: '[thyTextColor]',\n exportAs: 'thyTextColor'\n})\nexport class ThyTextColorDirective implements OnInit {\n private elementRef = inject(ElementRef);\n\n private color: ThyThemeColor | ThyTextColor | string = '';\n\n private hostRenderer = useHostRenderer();\n\n /**\n * @type ThyThemeColor | ThyTextColor | string\n * @description 文本颜色,支持设置主题色和自定义颜色值,主题色为 `default`、`primary`、`success`、`info`、`warning`、`danger`、`light`、`secondary`、`muted`、`desc`、`placeholder`\n */\n readonly thyTextColor = input<ThyThemeColor | ThyTextColor | string>(undefined);\n\n constructor() {\n effect(() => {\n const color = this.thyTextColor();\n this.clearColor();\n this.color = color;\n this.setColor();\n });\n }\n\n ngOnInit(): void {}\n\n private setColor() {\n if (isThemeColor(this.color) || isTextColor(this.color)) {\n this.hostRenderer.addClass(`text-${this.color}`);\n } else {\n this.hostRenderer.setStyle('color', this.color);\n }\n }\n\n private clearColor() {\n this.hostRenderer.setStyle('color', '');\n if (isThemeColor(this.color) || isTextColor(this.color)) {\n this.hostRenderer.removeClass(`text-${this.color}`);\n }\n }\n}\n","import { Directive, ElementRef, effect, inject, input } from '@angular/core';\nimport { isBgColor, isThemeColor, ThyBgColor, ThyThemeColor } from 'ngx-tethys/core';\nimport { useHostRenderer } from '@tethys/cdk/dom';\n\n/**\n * @name thyBgColor\n * @order 30\n */\n@Directive({\n selector: '[thyBgColor]',\n exportAs: 'thyBgColor'\n})\nexport class ThyBackgroundColorDirective {\n private elementRef = inject(ElementRef);\n\n private bgColor: ThyThemeColor | ThyBgColor | string = '';\n\n private hostRenderer = useHostRenderer();\n\n /**\n * @type ThyThemeColor | ThyBgColor | string\n * @description 背景颜色,支持设置主题色和自定义颜色值,主题色为 `primary`、`success`、`info`、`danger`、`warning`、`dark`、`secondary`、`light`、`lighter`、`bright`、`content`、`white`、`transparent`\n */\n readonly thyBgColor = input<ThyThemeColor | ThyBgColor | string>(undefined);\n\n constructor() {\n effect(() => {\n const bgColor = this.thyBgColor();\n this.clearBgColor();\n this.bgColor = bgColor;\n this.setBgColor();\n });\n }\n\n private setBgColor() {\n if (isThemeColor(this.bgColor) || isBgColor(this.bgColor)) {\n this.hostRenderer.addClass(`bg-${this.bgColor}`);\n } else {\n this.hostRenderer.setStyle('background-color', this.bgColor);\n }\n }\n\n private clearBgColor() {\n this.hostRenderer.setStyle('background-color', '');\n if (isThemeColor(this.bgColor) || isBgColor(this.bgColor)) {\n this.hostRenderer.removeClass(`bg-${this.bgColor}`);\n }\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ThyIconModule } from 'ngx-tethys/icon';\nimport { ThyText } from './text/text.component';\nimport { ThyTextColorDirective } from './text-color.directive';\nimport { ThyBackgroundColorDirective } from './bg-color.directive';\n\n@NgModule({\n imports: [CommonModule, ThyIconModule, ThyText, ThyTextColorDirective, ThyBackgroundColorDirective],\n exports: [ThyText, ThyTextColorDirective, ThyBackgroundColorDirective],\n providers: []\n})\nexport class ThyTypographyModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAGA;;;;AAIG;MAUU,OAAO,CAAA;AAMhB,IAAA,WAAA,GAAA;AALA;;AAEG;AACM,QAAA,IAAA,CAAA,OAAO,GAAG,KAAK,CAAS,SAAS,CAAC;;AAI3C,IAAA,QAAQ;8GARC,OAAO,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAAP,OAAO,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,sCAAA,EAAA,MAAA,EAAA,EAAA,OAAA,EAAA,EAAA,iBAAA,EAAA,SAAA,EAAA,UAAA,EAAA,SAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,IAAA,EAAA,EAAA,cAAA,EAAA,UAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECjBpB,wGAIA,EAAA,YAAA,EAAA,CAAA,EAAA,IAAA,EAAA,WAAA,EAAA,IAAA,EDWc,OAAO,EAAA,QAAA,EAAA,sBAAA,EAAA,MAAA,EAAA,CAAA,aAAA,EAAA,iBAAA,EAAA,aAAA,EAAA,eAAA,EAAA,YAAA,EAAA,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