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,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, ElementRef, Renderer2,
|
|
2
|
+
import { inject, ElementRef, Renderer2, input, effect, HostBinding, Directive, forwardRef, NgZone, output, contentChild, signal, ViewEncapsulation, Component, DestroyRef, computed, ChangeDetectionStrategy, viewChild, NgModule } from '@angular/core';
|
|
3
3
|
import { NgTemplateOutlet, CommonModule } from '@angular/common';
|
|
4
4
|
import * as i1 from '@angular/forms';
|
|
5
5
|
import { NgControl, NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
|
|
@@ -11,6 +11,7 @@ import { coerceBooleanProperty } from 'ngx-tethys/util';
|
|
|
11
11
|
import { ThyTranslate, useHostFocusControl, mixinInitialized, mixinTabIndex, mixinDisabled, AbstractControlValueAccessor } from 'ngx-tethys/core';
|
|
12
12
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
13
13
|
import { of, Observable, Subject } from 'rxjs';
|
|
14
|
+
import { MutationObserverFactory } from '@angular/cdk/observers';
|
|
14
15
|
import { ThyDividerModule } from 'ngx-tethys/divider';
|
|
15
16
|
|
|
16
17
|
const inputGroupSizeMap$1 = {
|
|
@@ -25,38 +26,36 @@ const inputGroupSizeMap$1 = {
|
|
|
25
26
|
* @order 10
|
|
26
27
|
*/
|
|
27
28
|
class ThyInputDirective {
|
|
28
|
-
constructor() {
|
|
29
|
-
this.elementRef = inject(ElementRef);
|
|
30
|
-
this.render = inject(Renderer2);
|
|
31
|
-
this.control = inject(NgControl, { optional: true, self: true });
|
|
32
|
-
this.isFormControl = true;
|
|
33
|
-
this.initialized = false;
|
|
34
|
-
this.hostRenderer = useHostRenderer();
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* 输入框大小
|
|
38
|
-
* @type 'xs' | 'sm' | 'md' | 'default' | 'lg'
|
|
39
|
-
* @default default
|
|
40
|
-
*/
|
|
41
|
-
set thySize(size) {
|
|
42
|
-
if (size && inputGroupSizeMap$1[size]) {
|
|
43
|
-
this.hostRenderer.updateClass(inputGroupSizeMap$1[size]);
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
this.hostRenderer.updateClass([]);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
29
|
get ngControl() {
|
|
50
30
|
return this.control;
|
|
51
31
|
}
|
|
52
32
|
get nativeElement() {
|
|
53
33
|
return this.elementRef.nativeElement;
|
|
54
34
|
}
|
|
55
|
-
|
|
56
|
-
this.
|
|
35
|
+
constructor() {
|
|
36
|
+
this.elementRef = inject(ElementRef);
|
|
37
|
+
this.render = inject(Renderer2);
|
|
38
|
+
this.control = inject(NgControl, { optional: true, self: true });
|
|
39
|
+
this.isFormControl = true;
|
|
40
|
+
this.hostRenderer = useHostRenderer();
|
|
41
|
+
/**
|
|
42
|
+
* 输入框大小
|
|
43
|
+
* @type 'xs' | 'sm' | 'md' | 'default' | 'lg'
|
|
44
|
+
* @default default
|
|
45
|
+
*/
|
|
46
|
+
this.thySize = input(undefined);
|
|
47
|
+
effect(() => {
|
|
48
|
+
const size = this.thySize();
|
|
49
|
+
if (size && inputGroupSizeMap$1[size]) {
|
|
50
|
+
this.hostRenderer.updateClass(inputGroupSizeMap$1[size]);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
this.hostRenderer.updateClass([]);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
57
56
|
}
|
|
58
57
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
59
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
58
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: ThyInputDirective, isStandalone: true, selector: "input[thyInput], select[thyInput], textarea[thyInput]", inputs: { thySize: { classPropertyName: "thySize", publicName: "thySize", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.form-control": "this.isFormControl" } }, exportAs: ["thyInput"], ngImport: i0 }); }
|
|
60
59
|
}
|
|
61
60
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyInputDirective, decorators: [{
|
|
62
61
|
type: Directive,
|
|
@@ -64,11 +63,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
64
63
|
selector: 'input[thyInput], select[thyInput], textarea[thyInput]',
|
|
65
64
|
exportAs: 'thyInput'
|
|
66
65
|
}]
|
|
67
|
-
}], propDecorators: { isFormControl: [{
|
|
66
|
+
}], ctorParameters: () => [], propDecorators: { isFormControl: [{
|
|
68
67
|
type: HostBinding,
|
|
69
68
|
args: ['class.form-control']
|
|
70
|
-
}], thySize: [{
|
|
71
|
-
type: Input
|
|
72
69
|
}] } });
|
|
73
70
|
|
|
74
71
|
const CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR = {
|
|
@@ -90,45 +87,69 @@ class ThyInput {
|
|
|
90
87
|
/**
|
|
91
88
|
* Placeholder
|
|
92
89
|
*/
|
|
93
|
-
this.placeholder = '';
|
|
90
|
+
this.placeholder = input('');
|
|
91
|
+
/**
|
|
92
|
+
* 输入框大小
|
|
93
|
+
* @type 'xs' | 'sm' | 'md' | 'default' | 'lg'
|
|
94
|
+
* @default default
|
|
95
|
+
*/
|
|
96
|
+
this.thySize = input();
|
|
94
97
|
/**
|
|
95
98
|
* 是否自动聚焦
|
|
96
99
|
*/
|
|
97
|
-
this.thyAutofocus = false;
|
|
100
|
+
this.thyAutofocus = input(false, { transform: coerceBooleanProperty });
|
|
101
|
+
/**
|
|
102
|
+
* 输入框类型
|
|
103
|
+
* @type 'number' | 'input'
|
|
104
|
+
*/
|
|
105
|
+
this.thyType = input();
|
|
106
|
+
/**
|
|
107
|
+
* @deprecated please use thyType
|
|
108
|
+
*/
|
|
109
|
+
this._type = input(undefined, { alias: 'type' });
|
|
110
|
+
/**
|
|
111
|
+
* 输入 Label 文本
|
|
112
|
+
*/
|
|
113
|
+
this.thyLabelText = input(undefined);
|
|
98
114
|
/**
|
|
99
115
|
* 是否只读
|
|
100
116
|
*/
|
|
101
|
-
this.readonly = false;
|
|
117
|
+
this.readonly = input(false, { transform: coerceBooleanProperty });
|
|
102
118
|
/**
|
|
103
119
|
* focus 聚焦事件
|
|
104
120
|
*/
|
|
105
|
-
this.focus =
|
|
121
|
+
this.focus = output();
|
|
106
122
|
/**
|
|
107
123
|
* blur 失焦事件
|
|
108
124
|
*/
|
|
109
|
-
this.blur =
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
125
|
+
this.blur = output();
|
|
126
|
+
/**
|
|
127
|
+
* 后置模板
|
|
128
|
+
*/
|
|
129
|
+
this.appendTemplate = contentChild('append');
|
|
130
|
+
/**
|
|
131
|
+
* 前置模板
|
|
132
|
+
*/
|
|
133
|
+
this.prependTemplate = contentChild('prepend');
|
|
134
|
+
this.type = signal(undefined);
|
|
135
|
+
this.value = signal('');
|
|
136
|
+
this.showLabel = signal(false);
|
|
137
|
+
this.focused = signal(false);
|
|
138
|
+
this.disabled = signal(false);
|
|
113
139
|
this.onTouchedCallback = noop$1;
|
|
114
140
|
this.onChangeCallback = noop$1;
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
*/
|
|
120
|
-
set thyType(value) {
|
|
121
|
-
this.type = value;
|
|
141
|
+
this.isPasswordType = signal(false);
|
|
142
|
+
effect(() => {
|
|
143
|
+
this.type.set(this.thyType() || this._type());
|
|
144
|
+
});
|
|
122
145
|
}
|
|
123
146
|
ngOnInit() {
|
|
124
147
|
this.ngZone.onStable.pipe(take(1)).subscribe(() => {
|
|
125
|
-
|
|
126
|
-
this.appendTemplate = this.eyeTemplate;
|
|
127
|
-
}
|
|
148
|
+
this.isPasswordType.set(this.isPassword(this.type()));
|
|
128
149
|
});
|
|
129
150
|
}
|
|
130
151
|
writeValue(value) {
|
|
131
|
-
this.value
|
|
152
|
+
this.value.set(value);
|
|
132
153
|
}
|
|
133
154
|
registerOnChange(fn) {
|
|
134
155
|
this.onChangeCallback = fn;
|
|
@@ -137,14 +158,14 @@ class ThyInput {
|
|
|
137
158
|
this.onTouchedCallback = fn;
|
|
138
159
|
}
|
|
139
160
|
setDisabledState(isDisabled) {
|
|
140
|
-
this.disabled
|
|
161
|
+
this.disabled.set(isDisabled);
|
|
141
162
|
}
|
|
142
163
|
onModelChange() {
|
|
143
|
-
this.onChangeCallback(this.value);
|
|
164
|
+
this.onChangeCallback(this.value());
|
|
144
165
|
}
|
|
145
166
|
onInputFocus(event) {
|
|
146
|
-
this.focused
|
|
147
|
-
this.showLabel
|
|
167
|
+
this.focused.set(true);
|
|
168
|
+
this.showLabel.set(true);
|
|
148
169
|
this.focus.emit(event);
|
|
149
170
|
}
|
|
150
171
|
onInputBlur(event) {
|
|
@@ -152,56 +173,27 @@ class ThyInput {
|
|
|
152
173
|
if (this.elementRef.nativeElement.onblur) {
|
|
153
174
|
this.elementRef.nativeElement.onblur(event);
|
|
154
175
|
}
|
|
155
|
-
this.focused
|
|
156
|
-
this.showLabel
|
|
176
|
+
this.focused.set(false);
|
|
177
|
+
this.showLabel.set(false);
|
|
157
178
|
this.blur.emit(event);
|
|
158
179
|
}
|
|
159
180
|
isPassword(value) {
|
|
160
181
|
return value === password;
|
|
161
182
|
}
|
|
162
183
|
togglePasswordType() {
|
|
163
|
-
this.type
|
|
184
|
+
this.type.set(this.isPassword(this.type()) ? 'text' : 'password');
|
|
164
185
|
}
|
|
165
186
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyInput, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
166
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyInput, isStandalone: true, selector: "thy-input", inputs: { placeholder: "placeholder", thySize: "thySize", thyAutofocus:
|
|
187
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyInput, isStandalone: true, selector: "thy-input", inputs: { placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, thySize: { classPropertyName: "thySize", publicName: "thySize", isSignal: true, isRequired: false, transformFunction: null }, thyAutofocus: { classPropertyName: "thyAutofocus", publicName: "thyAutofocus", isSignal: true, isRequired: false, transformFunction: null }, thyType: { classPropertyName: "thyType", publicName: "thyType", isSignal: true, isRequired: false, transformFunction: null }, _type: { classPropertyName: "_type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, thyLabelText: { classPropertyName: "thyLabelText", publicName: "thyLabelText", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { focus: "focus", blur: "blur" }, host: { properties: { "class.form-control-active": "focused()", "class.disabled": "disabled()" }, classAttribute: "thy-input form-control" }, providers: [CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR], queries: [{ propertyName: "appendTemplate", first: true, predicate: ["append"], descendants: true, isSignal: true }, { propertyName: "prependTemplate", first: true, predicate: ["prepend"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (prependTemplate()) {\n <div #prepend class=\"input-prepend\">\n <ng-template *ngTemplateOutlet=\"prependTemplate()\"></ng-template>\n </div>\n}\n<input\n #input\n thyInput\n [thySize]=\"thySize()\"\n [thyAutofocus]=\"thyAutofocus()\"\n [type]=\"type()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [(ngModel)]=\"value\"\n (ngModelChange)=\"onModelChange()\"\n (focus)=\"onInputFocus($event)\"\n (blur)=\"onInputBlur($event)\"\n [readonly]=\"readonly()\"\n />\n<span class=\"input-label input-label-{{ thySize() }}\" [class.active]=\"showLabel()\">{{ thyLabelText() }}</span>\n\n@if (isPasswordType() || appendTemplate()) {\n <div #append class=\"input-append\">\n @if (isPasswordType()) {\n <a href=\"javascript:;\" class=\"link-secondary input-password-icon\" (click)=\"togglePasswordType()\">\n @if (isPassword(type())) {\n <thy-icon thyIconName=\"eye\"></thy-icon>\n }\n @if (!isPassword(type())) {\n <thy-icon thyIconName=\"eye-invisible\"></thy-icon>\n }\n </a>\n } @else {\n <ng-template *ngTemplateOutlet=\"appendTemplate()\"></ng-template>\n }\n </div>\n}\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: ThyInputDirective, selector: "input[thyInput], select[thyInput], textarea[thyInput]", inputs: ["thySize"], exportAs: ["thyInput"] }, { kind: "directive", type: ThyAutofocusDirective, selector: "input[thyAutofocus],textarea[thyAutofocus]", inputs: ["thyAutofocus", "thyAutoSelect"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
167
188
|
}
|
|
168
189
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyInput, decorators: [{
|
|
169
190
|
type: Component,
|
|
170
191
|
args: [{ selector: 'thy-input', providers: [CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR], encapsulation: ViewEncapsulation.None, host: {
|
|
171
192
|
class: 'thy-input form-control',
|
|
172
|
-
'[class.form-control-active]': 'focused',
|
|
173
|
-
'[class.disabled]': 'disabled'
|
|
174
|
-
}, imports: [NgTemplateOutlet, ThyInputDirective, ThyAutofocusDirective, FormsModule, ThyIcon], template: "@if (prependTemplate) {\n <div #prepend class=\"input-prepend\">\n <ng-template *ngTemplateOutlet=\"prependTemplate\"></ng-template>\n </div>\n}\n<input\n #input\n thyInput\n [thySize]=\"thySize\"\n [thyAutofocus]=\"thyAutofocus\"\n [type]=\"type\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n [(ngModel)]=\"value\"\n (ngModelChange)=\"onModelChange()\"\n (focus)=\"onInputFocus($event)\"\n (blur)=\"onInputBlur($event)\"\n [readonly]=\"readonly\"\n />\n<span class=\"input-label input-label-{{ thySize }}\" [class.active]=\"showLabel\">{{ thyLabelText }}</span>\n@if (appendTemplate) {\n <div #append class=\"input-append\">\n
|
|
175
|
-
}],
|
|
176
|
-
type: Input
|
|
177
|
-
}], thySize: [{
|
|
178
|
-
type: Input
|
|
179
|
-
}], thyAutofocus: [{
|
|
180
|
-
type: Input,
|
|
181
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
182
|
-
}], thyType: [{
|
|
183
|
-
type: Input
|
|
184
|
-
}], type: [{
|
|
185
|
-
type: Input
|
|
186
|
-
}], thyLabelText: [{
|
|
187
|
-
type: Input
|
|
188
|
-
}], readonly: [{
|
|
189
|
-
type: Input,
|
|
190
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
191
|
-
}], focus: [{
|
|
192
|
-
type: Output
|
|
193
|
-
}], blur: [{
|
|
194
|
-
type: Output
|
|
195
|
-
}], appendTemplate: [{
|
|
196
|
-
type: ContentChild,
|
|
197
|
-
args: ['append']
|
|
198
|
-
}], prependTemplate: [{
|
|
199
|
-
type: ContentChild,
|
|
200
|
-
args: ['prepend']
|
|
201
|
-
}], eyeTemplate: [{
|
|
202
|
-
type: ViewChild,
|
|
203
|
-
args: ['eye', { static: true }]
|
|
204
|
-
}] } });
|
|
193
|
+
'[class.form-control-active]': 'focused()',
|
|
194
|
+
'[class.disabled]': 'disabled()'
|
|
195
|
+
}, imports: [NgTemplateOutlet, ThyInputDirective, ThyAutofocusDirective, FormsModule, ThyIcon], template: "@if (prependTemplate()) {\n <div #prepend class=\"input-prepend\">\n <ng-template *ngTemplateOutlet=\"prependTemplate()\"></ng-template>\n </div>\n}\n<input\n #input\n thyInput\n [thySize]=\"thySize()\"\n [thyAutofocus]=\"thyAutofocus()\"\n [type]=\"type()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [(ngModel)]=\"value\"\n (ngModelChange)=\"onModelChange()\"\n (focus)=\"onInputFocus($event)\"\n (blur)=\"onInputBlur($event)\"\n [readonly]=\"readonly()\"\n />\n<span class=\"input-label input-label-{{ thySize() }}\" [class.active]=\"showLabel()\">{{ thyLabelText() }}</span>\n\n@if (isPasswordType() || appendTemplate()) {\n <div #append class=\"input-append\">\n @if (isPasswordType()) {\n <a href=\"javascript:;\" class=\"link-secondary input-password-icon\" (click)=\"togglePasswordType()\">\n @if (isPassword(type())) {\n <thy-icon thyIconName=\"eye\"></thy-icon>\n }\n @if (!isPassword(type())) {\n <thy-icon thyIconName=\"eye-invisible\"></thy-icon>\n }\n </a>\n } @else {\n <ng-template *ngTemplateOutlet=\"appendTemplate()\"></ng-template>\n }\n </div>\n}\n" }]
|
|
196
|
+
}], ctorParameters: () => [] });
|
|
205
197
|
|
|
206
198
|
const inputGroupSizeMap = {
|
|
207
199
|
sm: ['input-group-sm'],
|
|
@@ -217,52 +209,105 @@ class ThyInputGroup {
|
|
|
217
209
|
constructor() {
|
|
218
210
|
this.thyTranslate = inject(ThyTranslate);
|
|
219
211
|
this.ngZone = inject(NgZone);
|
|
220
|
-
this.cdr = inject(ChangeDetectorRef);
|
|
221
212
|
this.hostRenderer = useHostRenderer();
|
|
222
213
|
this.hostFocusControl = useHostFocusControl();
|
|
223
214
|
this.destroyRef = inject(DestroyRef);
|
|
224
|
-
this.
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
this.
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
215
|
+
this.isTextareaSuffix = signal(false);
|
|
216
|
+
this.hasScrollbar = signal(false);
|
|
217
|
+
this.disabled = signal(false);
|
|
218
|
+
/**
|
|
219
|
+
* 输入框上添加的后置文本
|
|
220
|
+
*/
|
|
221
|
+
this.thyAppendText = input();
|
|
222
|
+
/**
|
|
223
|
+
* 输入框上添加的后置文本多语言 Key
|
|
224
|
+
*/
|
|
225
|
+
this.thyAppendTextTranslateKey = input();
|
|
226
|
+
/**
|
|
227
|
+
* 输入框上添加的前置文本
|
|
228
|
+
*/
|
|
229
|
+
this.thyPrependText = input();
|
|
230
|
+
/**
|
|
231
|
+
* 输入框上添加的前置文本多语言 Key
|
|
232
|
+
*/
|
|
233
|
+
this.thyPrependTextTranslateKey = input();
|
|
234
|
+
this.prependText = computed(() => {
|
|
235
|
+
const prependTextTranslateKey = this.thyPrependTextTranslateKey();
|
|
236
|
+
if (prependTextTranslateKey) {
|
|
237
|
+
return this.thyTranslate.instant(prependTextTranslateKey);
|
|
238
|
+
}
|
|
239
|
+
return this.thyPrependText();
|
|
240
|
+
});
|
|
241
|
+
this.appendText = computed(() => {
|
|
242
|
+
const appendTextTranslateKey = this.thyAppendTextTranslateKey();
|
|
243
|
+
if (appendTextTranslateKey) {
|
|
244
|
+
return this.thyTranslate.instant(appendTextTranslateKey);
|
|
245
|
+
}
|
|
246
|
+
return this.thyAppendText();
|
|
247
|
+
});
|
|
248
|
+
/**
|
|
249
|
+
* 输入框分组大小
|
|
250
|
+
* @type 'sm' | 'lg' | 'md' | ''
|
|
251
|
+
* @default ''
|
|
252
|
+
*/
|
|
253
|
+
this.thySize = input();
|
|
254
|
+
/**
|
|
255
|
+
* 后置模板
|
|
256
|
+
*/
|
|
257
|
+
this.appendTemplate = contentChild('append');
|
|
258
|
+
/**
|
|
259
|
+
* 前置模板
|
|
260
|
+
*/
|
|
261
|
+
this.prependTemplate = contentChild('prepend');
|
|
262
|
+
/**
|
|
263
|
+
* 前缀
|
|
264
|
+
*/
|
|
265
|
+
this.prefixTemplate = contentChild('prefix');
|
|
266
|
+
/**
|
|
267
|
+
* 后缀
|
|
268
|
+
*/
|
|
269
|
+
this.suffixTemplate = contentChild('suffix');
|
|
270
|
+
/**
|
|
271
|
+
* @private
|
|
272
|
+
*/
|
|
273
|
+
this.inputDirective = contentChild(ThyInputDirective);
|
|
274
|
+
effect(() => {
|
|
275
|
+
const size = this.thySize();
|
|
276
|
+
if (size && inputGroupSizeMap[size]) {
|
|
277
|
+
this.hostRenderer.updateClass(inputGroupSizeMap[size]);
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
this.hostRenderer.updateClass([]);
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
effect(() => {
|
|
284
|
+
const inputDirective = this.inputDirective();
|
|
285
|
+
if (inputDirective?.nativeElement) {
|
|
286
|
+
this.isTextareaSuffix.set(inputDirective?.nativeElement?.tagName === 'TEXTAREA');
|
|
287
|
+
if (this.isTextareaSuffix()) {
|
|
288
|
+
this.determineHasScrollbar();
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
effect(() => {
|
|
293
|
+
const inputDirective = this.inputDirective();
|
|
294
|
+
this.disabledObservable?.disconnect();
|
|
295
|
+
if (inputDirective?.nativeElement) {
|
|
296
|
+
this.disabledObservable = new MutationObserverFactory().create(mutations => {
|
|
297
|
+
for (const mutation of mutations) {
|
|
298
|
+
if (mutation.type === 'attributes' && mutation.attributeName === 'disabled') {
|
|
299
|
+
this.disabled.set(!!inputDirective.nativeElement.hasAttribute('disabled'));
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
if (this.disabledObservable) {
|
|
304
|
+
this.disabledObservable.observe(inputDirective.nativeElement, {
|
|
305
|
+
attributes: true,
|
|
306
|
+
attributeFilter: ['disabled']
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
});
|
|
266
311
|
}
|
|
267
312
|
ngOnInit() {
|
|
268
313
|
this.hostFocusControl.focusChanged = (origin) => {
|
|
@@ -274,23 +319,15 @@ class ThyInputGroup {
|
|
|
274
319
|
}
|
|
275
320
|
};
|
|
276
321
|
}
|
|
277
|
-
ngAfterContentChecked() {
|
|
278
|
-
this.disabled = !!this.inputDirective?.nativeElement?.hasAttribute('disabled');
|
|
279
|
-
this.isTextareaSuffix = this.inputDirective?.nativeElement?.tagName === 'TEXTAREA';
|
|
280
|
-
if (this.isTextareaSuffix) {
|
|
281
|
-
this.determineHasScrollbar();
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
322
|
determineHasScrollbar() {
|
|
285
323
|
this.ngZone.runOutsideAngular(() => {
|
|
286
|
-
this.resizeObserver(this.inputDirective.nativeElement)
|
|
324
|
+
this.resizeObserver(this.inputDirective().nativeElement)
|
|
287
325
|
.pipe(throttleTime(100), takeUntilDestroyed(this.destroyRef))
|
|
288
326
|
.subscribe(() => {
|
|
289
|
-
const hasScrollbar = this.inputDirective.nativeElement.scrollHeight > this.inputDirective.nativeElement.clientHeight;
|
|
290
|
-
if (this.hasScrollbar !== hasScrollbar) {
|
|
327
|
+
const hasScrollbar = this.inputDirective().nativeElement.scrollHeight > this.inputDirective().nativeElement.clientHeight;
|
|
328
|
+
if (this.hasScrollbar() !== hasScrollbar) {
|
|
291
329
|
this.ngZone.run(() => {
|
|
292
|
-
this.hasScrollbar
|
|
293
|
-
this.cdr.detectChanges();
|
|
330
|
+
this.hasScrollbar.set(hasScrollbar);
|
|
294
331
|
});
|
|
295
332
|
}
|
|
296
333
|
});
|
|
@@ -313,47 +350,20 @@ class ThyInputGroup {
|
|
|
313
350
|
this.hostFocusControl.destroy();
|
|
314
351
|
}
|
|
315
352
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyInputGroup, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
316
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyInputGroup, isStandalone: true, selector: "thy-input-group", inputs: { thyAppendText: "thyAppendText", thyAppendTextTranslateKey: "thyAppendTextTranslateKey", thyPrependText: "thyPrependText", thyPrependTextTranslateKey: "thyPrependTextTranslateKey", thySize: "thySize" }, host: { properties: { "class.form-control": "prefixTemplate || suffixTemplate", "class.thy-input-group-with-prefix": "prefixTemplate", "class.thy-input-group-with-suffix": "suffixTemplate", "class.thy-input-group-with-textarea-suffix": "isTextareaSuffix", "class.thy-input-group-with-scroll-bar": "isTextareaSuffix && hasScrollbar", "class.disabled": "
|
|
353
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyInputGroup, isStandalone: true, selector: "thy-input-group", inputs: { thyAppendText: { classPropertyName: "thyAppendText", publicName: "thyAppendText", isSignal: true, isRequired: false, transformFunction: null }, thyAppendTextTranslateKey: { classPropertyName: "thyAppendTextTranslateKey", publicName: "thyAppendTextTranslateKey", isSignal: true, isRequired: false, transformFunction: null }, thyPrependText: { classPropertyName: "thyPrependText", publicName: "thyPrependText", isSignal: true, isRequired: false, transformFunction: null }, thyPrependTextTranslateKey: { classPropertyName: "thyPrependTextTranslateKey", publicName: "thyPrependTextTranslateKey", isSignal: true, isRequired: false, transformFunction: null }, thySize: { classPropertyName: "thySize", publicName: "thySize", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.form-control": "prefixTemplate() || suffixTemplate()", "class.thy-input-group-with-prefix": "prefixTemplate()", "class.thy-input-group-with-suffix": "suffixTemplate()", "class.thy-input-group-with-textarea-suffix": "isTextareaSuffix()", "class.thy-input-group-with-scroll-bar": "isTextareaSuffix() && hasScrollbar()", "class.disabled": "disabled()" }, classAttribute: "thy-input-group" }, queries: [{ propertyName: "appendTemplate", first: true, predicate: ["append"], descendants: true, isSignal: true }, { propertyName: "prependTemplate", first: true, predicate: ["prepend"], descendants: true, isSignal: true }, { propertyName: "prefixTemplate", first: true, predicate: ["prefix"], descendants: true, isSignal: true }, { propertyName: "suffixTemplate", first: true, predicate: ["suffix"], descendants: true, isSignal: true }, { propertyName: "inputDirective", first: true, predicate: ThyInputDirective, descendants: true, isSignal: true }], ngImport: i0, template: "@if (prependText()) {\n <div class=\"input-group-prepend\">\n <span class=\"input-group-text\">{{ prependText() }}</span>\n </div>\n}\n@if (prependTemplate()) {\n <div class=\"input-group-prepend\">\n <ng-template *ngTemplateOutlet=\"prependTemplate()\"></ng-template>\n </div>\n}\n\n@if (prefixTemplate()) {\n <div class=\"input-group-prefix\">\n <ng-template *ngTemplateOutlet=\"prefixTemplate()\"></ng-template>\n </div>\n}\n\n<ng-content></ng-content>\n\n@if (appendText()) {\n <div class=\"input-group-append\">\n <span class=\"input-group-text\">{{ appendText() }}</span>\n </div>\n}\n@if (appendTemplate()) {\n <div class=\"input-group-append\">\n <ng-template *ngTemplateOutlet=\"appendTemplate()\"></ng-template>\n </div>\n}\n\n@if (suffixTemplate()) {\n <div class=\"input-group-suffix\">\n <ng-template *ngTemplateOutlet=\"suffixTemplate()\"></ng-template>\n </div>\n}\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
317
354
|
}
|
|
318
355
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyInputGroup, decorators: [{
|
|
319
356
|
type: Component,
|
|
320
357
|
args: [{ selector: 'thy-input-group', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
321
358
|
class: 'thy-input-group',
|
|
322
|
-
'[class.form-control]': 'prefixTemplate || suffixTemplate',
|
|
323
|
-
'[class.thy-input-group-with-prefix]': 'prefixTemplate',
|
|
324
|
-
'[class.thy-input-group-with-suffix]': 'suffixTemplate',
|
|
325
|
-
'[class.thy-input-group-with-textarea-suffix]': 'isTextareaSuffix',
|
|
326
|
-
'[class.thy-input-group-with-scroll-bar]': 'isTextareaSuffix && hasScrollbar'
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
args: ['class.disabled']
|
|
331
|
-
}], thyAppendText: [{
|
|
332
|
-
type: Input
|
|
333
|
-
}], thyAppendTextTranslateKey: [{
|
|
334
|
-
type: Input
|
|
335
|
-
}], thyPrependText: [{
|
|
336
|
-
type: Input
|
|
337
|
-
}], thyPrependTextTranslateKey: [{
|
|
338
|
-
type: Input
|
|
339
|
-
}], thySize: [{
|
|
340
|
-
type: Input
|
|
341
|
-
}], appendTemplate: [{
|
|
342
|
-
type: ContentChild,
|
|
343
|
-
args: ['append']
|
|
344
|
-
}], prependTemplate: [{
|
|
345
|
-
type: ContentChild,
|
|
346
|
-
args: ['prepend']
|
|
347
|
-
}], prefixTemplate: [{
|
|
348
|
-
type: ContentChild,
|
|
349
|
-
args: ['prefix']
|
|
350
|
-
}], suffixTemplate: [{
|
|
351
|
-
type: ContentChild,
|
|
352
|
-
args: ['suffix']
|
|
353
|
-
}], inputDirective: [{
|
|
354
|
-
type: ContentChild,
|
|
355
|
-
args: [ThyInputDirective]
|
|
356
|
-
}] } });
|
|
359
|
+
'[class.form-control]': 'prefixTemplate() || suffixTemplate()',
|
|
360
|
+
'[class.thy-input-group-with-prefix]': 'prefixTemplate()',
|
|
361
|
+
'[class.thy-input-group-with-suffix]': 'suffixTemplate()',
|
|
362
|
+
'[class.thy-input-group-with-textarea-suffix]': 'isTextareaSuffix()',
|
|
363
|
+
'[class.thy-input-group-with-scroll-bar]': 'isTextareaSuffix() && hasScrollbar()',
|
|
364
|
+
'[class.disabled]': 'disabled()'
|
|
365
|
+
}, imports: [NgTemplateOutlet], template: "@if (prependText()) {\n <div class=\"input-group-prepend\">\n <span class=\"input-group-text\">{{ prependText() }}</span>\n </div>\n}\n@if (prependTemplate()) {\n <div class=\"input-group-prepend\">\n <ng-template *ngTemplateOutlet=\"prependTemplate()\"></ng-template>\n </div>\n}\n\n@if (prefixTemplate()) {\n <div class=\"input-group-prefix\">\n <ng-template *ngTemplateOutlet=\"prefixTemplate()\"></ng-template>\n </div>\n}\n\n<ng-content></ng-content>\n\n@if (appendText()) {\n <div class=\"input-group-append\">\n <span class=\"input-group-text\">{{ appendText() }}</span>\n </div>\n}\n@if (appendTemplate()) {\n <div class=\"input-group-append\">\n <ng-template *ngTemplateOutlet=\"appendTemplate()\"></ng-template>\n </div>\n}\n\n@if (suffixTemplate()) {\n <div class=\"input-group-suffix\">\n <ng-template *ngTemplateOutlet=\"suffixTemplate()\"></ng-template>\n </div>\n}\n" }]
|
|
366
|
+
}], ctorParameters: () => [] });
|
|
357
367
|
|
|
358
368
|
const CUSTOM_INPUT_SEARCH_CONTROL_VALUE_ACCESSOR = {
|
|
359
369
|
provide: NG_VALUE_ACCESSOR,
|
|
@@ -368,94 +378,100 @@ const _MixinBase = mixinInitialized(mixinTabIndex(mixinDisabled(AbstractControlV
|
|
|
368
378
|
* @order 30
|
|
369
379
|
*/
|
|
370
380
|
class ThyInputSearch extends _MixinBase {
|
|
371
|
-
/**
|
|
372
|
-
* 是否自动聚焦
|
|
373
|
-
* @default false
|
|
374
|
-
*/
|
|
375
|
-
set thySearchFocus(value) {
|
|
376
|
-
this.autoFocus = value;
|
|
377
|
-
this.focused = value;
|
|
378
|
-
}
|
|
379
|
-
/**
|
|
380
|
-
* 搜索图标位置,当传入 after 时,搜索图标在输入框后方显示,有内容时显示为关闭按钮
|
|
381
|
-
* @type
|
|
382
|
-
*/
|
|
383
|
-
set thyIconPosition(value) {
|
|
384
|
-
this.iconPosition = value || 'before';
|
|
385
|
-
this.updateClasses();
|
|
386
|
-
}
|
|
387
381
|
constructor() {
|
|
388
382
|
super();
|
|
389
|
-
this.cdr = inject(ChangeDetectorRef);
|
|
390
383
|
this.elementRef = inject(ElementRef);
|
|
384
|
+
this.inputElement = viewChild('input');
|
|
391
385
|
this.hostRenderer = useHostRenderer();
|
|
392
386
|
this.hostFocusControl = useHostFocusControl();
|
|
393
|
-
this.disabled = false;
|
|
394
|
-
this.
|
|
395
|
-
this.
|
|
396
|
-
this.focused = false;
|
|
387
|
+
this.disabled = signal(false);
|
|
388
|
+
this.searchText = signal('');
|
|
389
|
+
this.focused = signal(false);
|
|
397
390
|
/**
|
|
398
391
|
* 搜索框 name 属性
|
|
399
392
|
*/
|
|
400
|
-
this.name = '';
|
|
393
|
+
this.name = input('');
|
|
401
394
|
/**
|
|
402
395
|
* 搜索框 Placeholder
|
|
403
396
|
*/
|
|
404
|
-
this.placeholder = '';
|
|
397
|
+
this.placeholder = input('');
|
|
398
|
+
/**
|
|
399
|
+
* 搜索框风格
|
|
400
|
+
* @type 'default' | 'ellipse' | 'transparent'
|
|
401
|
+
* @default default
|
|
402
|
+
*/
|
|
403
|
+
this.thyTheme = input();
|
|
404
|
+
/**
|
|
405
|
+
* 是否自动聚焦
|
|
406
|
+
* @default false
|
|
407
|
+
*/
|
|
408
|
+
this.autoFocus = input(false, { alias: 'thySearchFocus', transform: coerceBooleanProperty });
|
|
409
|
+
/**
|
|
410
|
+
* 搜索图标位置,当传入 after 时,搜索图标在输入框后方显示,有内容时显示为关闭按钮
|
|
411
|
+
* @type ThyInputSearchIconPosition
|
|
412
|
+
*/
|
|
413
|
+
this.iconPosition = input('before', {
|
|
414
|
+
alias: 'thyIconPosition',
|
|
415
|
+
transform: (value) => value || 'before'
|
|
416
|
+
});
|
|
417
|
+
/**
|
|
418
|
+
* 输入框大小
|
|
419
|
+
* @type 'xs' | 'sm' | 'md' | 'default' | 'lg'
|
|
420
|
+
*/
|
|
421
|
+
this.thySize = input();
|
|
405
422
|
/**
|
|
406
423
|
* @deprecated please use thyClear
|
|
407
424
|
*/
|
|
408
|
-
this.clear =
|
|
425
|
+
this.clear = output();
|
|
409
426
|
/**
|
|
410
427
|
* 清除搜索事件
|
|
411
428
|
*/
|
|
412
|
-
this.thyClear =
|
|
429
|
+
this.thyClear = output();
|
|
430
|
+
effect(() => {
|
|
431
|
+
this.focused.set(this.autoFocus());
|
|
432
|
+
});
|
|
433
|
+
effect(() => {
|
|
434
|
+
const iconPosition = this.iconPosition();
|
|
435
|
+
this.hostRenderer.updateClass([`thy-input-search-${iconPosition}`]);
|
|
436
|
+
});
|
|
413
437
|
}
|
|
414
438
|
ngOnInit() {
|
|
415
439
|
super.ngOnInit();
|
|
416
|
-
this.updateClasses(true);
|
|
417
440
|
this.hostFocusControl.focusChanged = (origin) => {
|
|
418
|
-
if (this.disabled) {
|
|
441
|
+
if (this.disabled()) {
|
|
419
442
|
return;
|
|
420
443
|
}
|
|
421
444
|
if (origin) {
|
|
422
|
-
if (!this.focused) {
|
|
423
|
-
this.inputElement.nativeElement.focus();
|
|
445
|
+
if (!this.focused()) {
|
|
446
|
+
this.inputElement().nativeElement.focus();
|
|
424
447
|
}
|
|
425
448
|
}
|
|
426
449
|
else {
|
|
427
|
-
if (this.focused) {
|
|
428
|
-
this.focused
|
|
450
|
+
if (this.focused()) {
|
|
451
|
+
this.focused.set(false);
|
|
429
452
|
this.onTouchedFn();
|
|
430
453
|
}
|
|
431
454
|
}
|
|
432
|
-
this.cdr.markForCheck();
|
|
433
455
|
};
|
|
434
456
|
}
|
|
435
|
-
updateClasses(forceUpdate = false) {
|
|
436
|
-
if (this.initialized || forceUpdate) {
|
|
437
|
-
this.hostRenderer.updateClass([`thy-input-search-${this.iconPosition}`]);
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
457
|
writeValue(value) {
|
|
441
|
-
this.searchText
|
|
442
|
-
this.cdr.markForCheck();
|
|
458
|
+
this.searchText.set(value);
|
|
443
459
|
}
|
|
444
460
|
setDisabledState(isDisabled) {
|
|
445
|
-
this.disabled
|
|
461
|
+
this.disabled.set(isDisabled);
|
|
446
462
|
}
|
|
447
463
|
searchModelChange() {
|
|
448
|
-
this.onChangeFn(this.searchText);
|
|
464
|
+
this.onChangeFn(this.searchText());
|
|
449
465
|
}
|
|
450
466
|
clearSearchText(event) {
|
|
451
467
|
const element = this.elementRef.nativeElement.querySelector('.input-search-control');
|
|
452
468
|
element.focus();
|
|
453
469
|
event.stopPropagation();
|
|
454
|
-
if (this.disabled) {
|
|
470
|
+
if (this.disabled()) {
|
|
455
471
|
return;
|
|
456
472
|
}
|
|
457
|
-
this.searchText
|
|
458
|
-
this.onChangeFn(this.searchText);
|
|
473
|
+
this.searchText.set('');
|
|
474
|
+
this.onChangeFn(this.searchText());
|
|
459
475
|
this.clear.emit(event);
|
|
460
476
|
this.thyClear.emit(event);
|
|
461
477
|
}
|
|
@@ -463,39 +479,19 @@ class ThyInputSearch extends _MixinBase {
|
|
|
463
479
|
this.hostFocusControl.destroy();
|
|
464
480
|
}
|
|
465
481
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyInputSearch, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
466
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyInputSearch, isStandalone: true, selector: "thy-input-search", inputs: { name: "name", placeholder: "placeholder", thyTheme: "thyTheme",
|
|
482
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyInputSearch, isStandalone: true, selector: "thy-input-search", inputs: { name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, thyTheme: { classPropertyName: "thyTheme", publicName: "thyTheme", isSignal: true, isRequired: false, transformFunction: null }, autoFocus: { classPropertyName: "autoFocus", publicName: "thySearchFocus", isSignal: true, isRequired: false, transformFunction: null }, iconPosition: { classPropertyName: "iconPosition", publicName: "thyIconPosition", isSignal: true, isRequired: false, transformFunction: null }, thySize: { classPropertyName: "thySize", publicName: "thySize", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { clear: "clear", thyClear: "thyClear" }, host: { properties: { "class.thy-input-search-ellipse": "thyTheme() === \"ellipse\"", "class.thy-input-search-transparent": "thyTheme() === \"transparent\"", "class.thy-input-search-before-with-clear": "searchText() && iconPosition() === \"before\"", "class.form-control-active": "focused()", "attr.tabindex": "tabIndex" }, classAttribute: "thy-input form-control thy-input-search" }, providers: [CUSTOM_INPUT_SEARCH_CONTROL_VALUE_ACCESSOR], viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["input"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "@if (iconPosition() === 'before') {\n <thy-icon class=\"input-prepend\" thyIconName=\"search\"></thy-icon>\n}\n<input\n class=\"input-search-control\"\n #input\n thyInput\n [name]=\"name()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [thyAutofocus]=\"autoFocus()\"\n [(ngModel)]=\"searchText\"\n (ngModelChange)=\"searchModelChange()\"\n (focus)=\"!focused() ? (focused.set(true)) : null\"\n [thySize]=\"thySize()\"\n tabindex=\"-1\" />\n@if (iconPosition() === 'after') {\n <div class=\"input-append input-append-divider\">\n @if (searchText()) {\n <a class=\"close\" href=\"javascript:;\" (click)=\"clearSearchText($event)\">\n <thy-icon thyIconName=\"close\"></thy-icon>\n </a>\n } @else {\n <thy-icon class=\"text-placeholder\" thyIconName=\"search\"></thy-icon>\n }\n </div>\n}\n\n@if (searchText() && iconPosition() === 'before') {\n <a class=\"close input-append\" href=\"javascript:;\" (click)=\"clearSearchText($event)\">\n <thy-icon thyIconName=\"close\"></thy-icon>\n </a>\n}\n", dependencies: [{ kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { kind: "directive", type: ThyInputDirective, selector: "input[thyInput], select[thyInput], textarea[thyInput]", inputs: ["thySize"], exportAs: ["thyInput"] }, { kind: "directive", type: ThyAutofocusDirective, selector: "input[thyAutofocus],textarea[thyAutofocus]", inputs: ["thyAutofocus", "thyAutoSelect"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
467
483
|
}
|
|
468
484
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyInputSearch, decorators: [{
|
|
469
485
|
type: Component,
|
|
470
486
|
args: [{ selector: 'thy-input-search', providers: [CUSTOM_INPUT_SEARCH_CONTROL_VALUE_ACCESSOR], encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
471
487
|
class: 'thy-input form-control thy-input-search',
|
|
472
|
-
'[class.thy-input-search-ellipse]': 'thyTheme === "ellipse"',
|
|
473
|
-
'[class.thy-input-search-transparent]': 'thyTheme === "transparent"',
|
|
474
|
-
'[class.thy-input-search-before-with-clear]': 'searchText && iconPosition === "before"',
|
|
475
|
-
'[class.form-control-active]': 'focused',
|
|
488
|
+
'[class.thy-input-search-ellipse]': 'thyTheme() === "ellipse"',
|
|
489
|
+
'[class.thy-input-search-transparent]': 'thyTheme() === "transparent"',
|
|
490
|
+
'[class.thy-input-search-before-with-clear]': 'searchText() && iconPosition() === "before"',
|
|
491
|
+
'[class.form-control-active]': 'focused()',
|
|
476
492
|
'[attr.tabindex]': 'tabIndex'
|
|
477
|
-
}, imports: [ThyIcon, ThyInputDirective, ThyAutofocusDirective, FormsModule], template: "@if (iconPosition === 'before') {\n <thy-icon class=\"input-prepend\" thyIconName=\"search\"></thy-icon>\n}\n<input\n class=\"input-search-control\"\n #input\n thyInput\n [name]=\"name\"\n [placeholder]=\"placeholder\"\n [disabled]=\"disabled\"\n [thyAutofocus]=\"autoFocus\"\n [(ngModel)]=\"searchText\"\n (ngModelChange)=\"searchModelChange()\"\n (focus)=\"!focused ? (focused
|
|
478
|
-
}], ctorParameters: () => []
|
|
479
|
-
type: ViewChild,
|
|
480
|
-
args: ['input', { static: true }]
|
|
481
|
-
}], name: [{
|
|
482
|
-
type: Input
|
|
483
|
-
}], placeholder: [{
|
|
484
|
-
type: Input
|
|
485
|
-
}], thyTheme: [{
|
|
486
|
-
type: Input
|
|
487
|
-
}], thySearchFocus: [{
|
|
488
|
-
type: Input,
|
|
489
|
-
args: [{ transform: coerceBooleanProperty }]
|
|
490
|
-
}], thyIconPosition: [{
|
|
491
|
-
type: Input
|
|
492
|
-
}], thySize: [{
|
|
493
|
-
type: Input
|
|
494
|
-
}], clear: [{
|
|
495
|
-
type: Output
|
|
496
|
-
}], thyClear: [{
|
|
497
|
-
type: Output
|
|
498
|
-
}] } });
|
|
493
|
+
}, imports: [ThyIcon, ThyInputDirective, ThyAutofocusDirective, FormsModule], template: "@if (iconPosition() === 'before') {\n <thy-icon class=\"input-prepend\" thyIconName=\"search\"></thy-icon>\n}\n<input\n class=\"input-search-control\"\n #input\n thyInput\n [name]=\"name()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [thyAutofocus]=\"autoFocus()\"\n [(ngModel)]=\"searchText\"\n (ngModelChange)=\"searchModelChange()\"\n (focus)=\"!focused() ? (focused.set(true)) : null\"\n [thySize]=\"thySize()\"\n tabindex=\"-1\" />\n@if (iconPosition() === 'after') {\n <div class=\"input-append input-append-divider\">\n @if (searchText()) {\n <a class=\"close\" href=\"javascript:;\" (click)=\"clearSearchText($event)\">\n <thy-icon thyIconName=\"close\"></thy-icon>\n </a>\n } @else {\n <thy-icon class=\"text-placeholder\" thyIconName=\"search\"></thy-icon>\n }\n </div>\n}\n\n@if (searchText() && iconPosition() === 'before') {\n <a class=\"close input-append\" href=\"javascript:;\" (click)=\"clearSearchText($event)\">\n <thy-icon thyIconName=\"close\"></thy-icon>\n </a>\n}\n" }]
|
|
494
|
+
}], ctorParameters: () => [] });
|
|
499
495
|
|
|
500
496
|
/**
|
|
501
497
|
* 输入框输入文字展示
|
|
@@ -503,59 +499,60 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
503
499
|
* @order 40
|
|
504
500
|
*/
|
|
505
501
|
class ThyInputCount {
|
|
506
|
-
/**
|
|
507
|
-
* 输入框组件,如果不传默认会读取外层 thy-input-group 下的 thyInput 指令
|
|
508
|
-
* @type ThyInputDirective
|
|
509
|
-
*/
|
|
510
|
-
set thyInput(value) {
|
|
511
|
-
this.hasInput = true;
|
|
512
|
-
this.thyInput$.next(value);
|
|
513
|
-
}
|
|
514
502
|
constructor() {
|
|
515
|
-
this.changeDetectorRef = inject(ChangeDetectorRef);
|
|
516
503
|
this.inputGroup = inject(ThyInputGroup, { optional: true });
|
|
517
504
|
this.destroyRef = inject(DestroyRef);
|
|
518
505
|
this.hasInput = false;
|
|
519
|
-
|
|
506
|
+
/**
|
|
507
|
+
* 输入框组件,如果不传默认会读取外层 thy-input-group 下的 thyInput 指令
|
|
508
|
+
* @type ThyInputDirective
|
|
509
|
+
*/
|
|
510
|
+
this.thyInput = input();
|
|
511
|
+
this.maxLength = signal(undefined);
|
|
512
|
+
this.inputLength = signal(0);
|
|
520
513
|
this.thyInput$ = new Subject();
|
|
521
514
|
this.setup();
|
|
515
|
+
effect(() => {
|
|
516
|
+
const input = this.thyInput();
|
|
517
|
+
if (input) {
|
|
518
|
+
this.hasInput = true;
|
|
519
|
+
this.thyInput$.next(input);
|
|
520
|
+
}
|
|
521
|
+
});
|
|
522
522
|
}
|
|
523
523
|
setup() {
|
|
524
524
|
this.thyInput$
|
|
525
525
|
.pipe(filter(input => {
|
|
526
526
|
return !!input;
|
|
527
527
|
}), tap(input => {
|
|
528
|
-
this.maxLength
|
|
529
|
-
this.changeDetectorRef.markForCheck();
|
|
528
|
+
this.maxLength.set(input.nativeElement.getAttribute('maxlength'));
|
|
530
529
|
}), takeUntilDestroyed(this.destroyRef), switchMap(input => {
|
|
531
530
|
return input.ngControl.valueChanges;
|
|
532
531
|
}), tap(value => {
|
|
533
|
-
this.inputLength
|
|
534
|
-
this.changeDetectorRef.markForCheck();
|
|
532
|
+
this.inputLength.set(value?.length || 0);
|
|
535
533
|
}), takeUntilDestroyed(this.destroyRef))
|
|
536
534
|
.subscribe();
|
|
537
535
|
}
|
|
538
536
|
ngOnInit() {
|
|
539
|
-
|
|
540
|
-
|
|
537
|
+
const inputDirective = this.inputGroup.inputDirective();
|
|
538
|
+
if (!this.hasInput && this.inputGroup && inputDirective) {
|
|
539
|
+
this.thyInput$.next(inputDirective);
|
|
541
540
|
}
|
|
542
541
|
}
|
|
543
542
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyInputCount, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
544
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
543
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.8", type: ThyInputCount, isStandalone: true, selector: "thy-input-count", inputs: { thyInput: { classPropertyName: "thyInput", publicName: "thyInput", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "thy-input-count text-muted" }, ngImport: i0, template: '{{inputLength()}} / {{maxLength()}}', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
545
544
|
}
|
|
546
545
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyInputCount, decorators: [{
|
|
547
546
|
type: Component,
|
|
548
547
|
args: [{
|
|
549
548
|
selector: 'thy-input-count',
|
|
550
|
-
template: '{{inputLength}} / {{maxLength}}',
|
|
549
|
+
template: '{{inputLength()}} / {{maxLength()}}',
|
|
551
550
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
552
551
|
host: {
|
|
553
552
|
class: 'thy-input-count text-muted'
|
|
554
553
|
}
|
|
555
554
|
}]
|
|
556
|
-
}], ctorParameters: () => []
|
|
557
|
-
type: Input
|
|
558
|
-
}] } });
|
|
555
|
+
}], ctorParameters: () => [] });
|
|
559
556
|
|
|
560
557
|
class ThyInputModule {
|
|
561
558
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|