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.
Files changed (280) hide show
  1. package/CHANGELOG.md +29 -2
  2. package/action/action.component.d.ts +12 -20
  3. package/action/actions.component.d.ts +5 -7
  4. package/affix/affix.component.d.ts +7 -10
  5. package/alert/alert.component.d.ts +1 -1
  6. package/anchor/anchor-link.component.d.ts +8 -8
  7. package/anchor/anchor.component.d.ts +15 -21
  8. package/arrow-switcher/arrow-switcher.component.d.ts +15 -22
  9. package/autocomplete/autocomplete.component.d.ts +10 -17
  10. package/autocomplete/autocomplete.trigger.directive.d.ts +10 -18
  11. package/avatar/avatar-list/avatar-list.component.d.ts +8 -14
  12. package/avatar/avatar.component.d.ts +25 -39
  13. package/back-top/back-top.component.d.ts +9 -12
  14. package/badge/badge.component.d.ts +19 -59
  15. package/breadcrumb/breadcrumb.component.d.ts +15 -20
  16. package/button/button-icon.component.d.ts +3 -2
  17. package/button/button.component.d.ts +3 -2
  18. package/calendar/calendar-header.component.d.ts +9 -8
  19. package/calendar/calendar.component.d.ts +16 -16
  20. package/card/card.component.d.ts +5 -11
  21. package/card/content.component.d.ts +3 -8
  22. package/card/header.component.d.ts +7 -8
  23. package/carousel/carousel.component.d.ts +22 -27
  24. package/cascader/cascader-li.component.d.ts +13 -21
  25. package/cascader/cascader-search-option.component.d.ts +8 -16
  26. package/cascader/cascader.component.d.ts +58 -80
  27. package/checkbox/checkbox.component.d.ts +2 -5
  28. package/collapse/collapse-item.component.d.ts +12 -19
  29. package/collapse/collapse.component.d.ts +6 -12
  30. package/collapse/collapse.token.d.ts +3 -3
  31. package/color-picker/color-picker-custom-panel.component.d.ts +5 -5
  32. package/color-picker/color-picker-panel.component.d.ts +7 -11
  33. package/color-picker/color-picker.component.d.ts +19 -35
  34. package/color-picker/parts/alpha/alpha.component.d.ts +8 -8
  35. package/color-picker/parts/hue/hue.component.d.ts +6 -6
  36. package/color-picker/parts/indicator/indicator.component.d.ts +4 -3
  37. package/color-picker/parts/inputs/inputs.component.d.ts +9 -9
  38. package/color-picker/parts/saturation/saturation.component.d.ts +9 -9
  39. package/comment/comment.component.d.ts +4 -5
  40. package/copy/copy.directive.d.ts +8 -9
  41. package/date-picker/abstract-picker.component.d.ts +8 -7
  42. package/date-picker/lib/calendar/calendar-footer.component.d.ts +2 -1
  43. package/date-picker/lib/popups/inner-popup.component.d.ts +2 -1
  44. package/date-picker/picker.component.d.ts +2 -1
  45. package/date-range/date-range.component.d.ts +2 -2
  46. package/dialog/body/dialog-body.component.d.ts +2 -6
  47. package/dialog/confirm/confirm.component.d.ts +2 -2
  48. package/dialog/footer/dialog-footer.component.d.ts +6 -9
  49. package/dialog/header/dialog-header.component.d.ts +9 -11
  50. package/divider/divider.component.d.ts +12 -16
  51. package/dot/dot.component.d.ts +5 -13
  52. package/drag-drop/drag-handle.directive.d.ts +2 -1
  53. package/drag-drop/drag.directive.d.ts +2 -1
  54. package/drag-drop/drop-container.directive.d.ts +2 -1
  55. package/dropdown/dropdown-menu-item.directive.d.ts +3 -2
  56. package/dropdown/dropdown-menu.component.d.ts +2 -1
  57. package/dropdown/dropdown.directive.d.ts +2 -1
  58. package/empty/empty.component.d.ts +21 -27
  59. package/fesm2022/ngx-tethys-action.mjs +54 -91
  60. package/fesm2022/ngx-tethys-action.mjs.map +1 -1
  61. package/fesm2022/ngx-tethys-affix.mjs +29 -26
  62. package/fesm2022/ngx-tethys-affix.mjs.map +1 -1
  63. package/fesm2022/ngx-tethys-anchor.mjs +91 -118
  64. package/fesm2022/ngx-tethys-anchor.mjs.map +1 -1
  65. package/fesm2022/ngx-tethys-arrow-switcher.mjs +51 -77
  66. package/fesm2022/ngx-tethys-arrow-switcher.mjs.map +1 -1
  67. package/fesm2022/ngx-tethys-autocomplete.mjs +69 -103
  68. package/fesm2022/ngx-tethys-autocomplete.mjs.map +1 -1
  69. package/fesm2022/ngx-tethys-avatar.mjs +117 -162
  70. package/fesm2022/ngx-tethys-avatar.mjs.map +1 -1
  71. package/fesm2022/ngx-tethys-back-top.mjs +33 -46
  72. package/fesm2022/ngx-tethys-back-top.mjs.map +1 -1
  73. package/fesm2022/ngx-tethys-badge.mjs +104 -208
  74. package/fesm2022/ngx-tethys-badge.mjs.map +1 -1
  75. package/fesm2022/ngx-tethys-breadcrumb.mjs +66 -70
  76. package/fesm2022/ngx-tethys-breadcrumb.mjs.map +1 -1
  77. package/fesm2022/ngx-tethys-calendar.mjs +85 -87
  78. package/fesm2022/ngx-tethys-calendar.mjs.map +1 -1
  79. package/fesm2022/ngx-tethys-card.mjs +72 -77
  80. package/fesm2022/ngx-tethys-card.mjs.map +1 -1
  81. package/fesm2022/ngx-tethys-carousel.mjs +82 -99
  82. package/fesm2022/ngx-tethys-carousel.mjs.map +1 -1
  83. package/fesm2022/ngx-tethys-cascader.mjs +313 -468
  84. package/fesm2022/ngx-tethys-cascader.mjs.map +1 -1
  85. package/fesm2022/ngx-tethys-checkbox.mjs +10 -17
  86. package/fesm2022/ngx-tethys-checkbox.mjs.map +1 -1
  87. package/fesm2022/ngx-tethys-collapse.mjs +66 -71
  88. package/fesm2022/ngx-tethys-collapse.mjs.map +1 -1
  89. package/fesm2022/ngx-tethys-color-picker.mjs +187 -246
  90. package/fesm2022/ngx-tethys-color-picker.mjs.map +1 -1
  91. package/fesm2022/ngx-tethys-comment.mjs +16 -10
  92. package/fesm2022/ngx-tethys-comment.mjs.map +1 -1
  93. package/fesm2022/ngx-tethys-copy.mjs +25 -28
  94. package/fesm2022/ngx-tethys-copy.mjs.map +1 -1
  95. package/fesm2022/ngx-tethys-dialog.mjs +81 -82
  96. package/fesm2022/ngx-tethys-dialog.mjs.map +1 -1
  97. package/fesm2022/ngx-tethys-divider.mjs +49 -58
  98. package/fesm2022/ngx-tethys-divider.mjs.map +1 -1
  99. package/fesm2022/ngx-tethys-dot.mjs +45 -68
  100. package/fesm2022/ngx-tethys-dot.mjs.map +1 -1
  101. package/fesm2022/ngx-tethys-empty.mjs +107 -95
  102. package/fesm2022/ngx-tethys-empty.mjs.map +1 -1
  103. package/fesm2022/ngx-tethys-form.mjs +161 -200
  104. package/fesm2022/ngx-tethys-form.mjs.map +1 -1
  105. package/fesm2022/ngx-tethys-fullscreen.mjs +21 -23
  106. package/fesm2022/ngx-tethys-fullscreen.mjs.map +1 -1
  107. package/fesm2022/ngx-tethys-grid.mjs +160 -152
  108. package/fesm2022/ngx-tethys-grid.mjs.map +1 -1
  109. package/fesm2022/ngx-tethys-i18n.mjs +25 -25
  110. package/fesm2022/ngx-tethys-i18n.mjs.map +1 -1
  111. package/fesm2022/ngx-tethys-input-number.mjs +101 -114
  112. package/fesm2022/ngx-tethys-input-number.mjs.map +1 -1
  113. package/fesm2022/ngx-tethys-input.mjs +268 -271
  114. package/fesm2022/ngx-tethys-input.mjs.map +1 -1
  115. package/fesm2022/ngx-tethys-list.mjs +1 -1
  116. package/fesm2022/ngx-tethys-list.mjs.map +1 -1
  117. package/fesm2022/ngx-tethys-loading.mjs +17 -35
  118. package/fesm2022/ngx-tethys-loading.mjs.map +1 -1
  119. package/fesm2022/ngx-tethys-mention.mjs +52 -74
  120. package/fesm2022/ngx-tethys-mention.mjs.map +1 -1
  121. package/fesm2022/ngx-tethys-menu.mjs +106 -179
  122. package/fesm2022/ngx-tethys-menu.mjs.map +1 -1
  123. package/fesm2022/ngx-tethys-nav.mjs +169 -201
  124. package/fesm2022/ngx-tethys-nav.mjs.map +1 -1
  125. package/fesm2022/ngx-tethys-pagination.mjs +230 -294
  126. package/fesm2022/ngx-tethys-pagination.mjs.map +1 -1
  127. package/fesm2022/ngx-tethys-popover.mjs +67 -70
  128. package/fesm2022/ngx-tethys-popover.mjs.map +1 -1
  129. package/fesm2022/ngx-tethys-progress.mjs +196 -244
  130. package/fesm2022/ngx-tethys-progress.mjs.map +1 -1
  131. package/fesm2022/ngx-tethys-property.mjs +102 -105
  132. package/fesm2022/ngx-tethys-property.mjs.map +1 -1
  133. package/fesm2022/ngx-tethys-radio.mjs +34 -38
  134. package/fesm2022/ngx-tethys-radio.mjs.map +1 -1
  135. package/fesm2022/ngx-tethys-result.mjs +46 -28
  136. package/fesm2022/ngx-tethys-result.mjs.map +1 -1
  137. package/fesm2022/ngx-tethys-skeleton.mjs +339 -342
  138. package/fesm2022/ngx-tethys-skeleton.mjs.map +1 -1
  139. package/fesm2022/ngx-tethys-slider.mjs +75 -108
  140. package/fesm2022/ngx-tethys-slider.mjs.map +1 -1
  141. package/fesm2022/ngx-tethys-space.mjs +26 -46
  142. package/fesm2022/ngx-tethys-space.mjs.map +1 -1
  143. package/fesm2022/ngx-tethys-statistic.mjs +114 -151
  144. package/fesm2022/ngx-tethys-statistic.mjs.map +1 -1
  145. package/fesm2022/ngx-tethys-stepper.mjs +74 -107
  146. package/fesm2022/ngx-tethys-stepper.mjs.map +1 -1
  147. package/fesm2022/ngx-tethys-switch.mjs +80 -140
  148. package/fesm2022/ngx-tethys-switch.mjs.map +1 -1
  149. package/fesm2022/ngx-tethys-table.mjs +1 -1
  150. package/fesm2022/ngx-tethys-table.mjs.map +1 -1
  151. package/fesm2022/ngx-tethys-tabs.mjs +69 -87
  152. package/fesm2022/ngx-tethys-tabs.mjs.map +1 -1
  153. package/fesm2022/ngx-tethys-tag.mjs +42 -64
  154. package/fesm2022/ngx-tethys-tag.mjs.map +1 -1
  155. package/fesm2022/ngx-tethys-timeline.mjs +104 -129
  156. package/fesm2022/ngx-tethys-timeline.mjs.map +1 -1
  157. package/fesm2022/ngx-tethys-typography.mjs +36 -33
  158. package/fesm2022/ngx-tethys-typography.mjs.map +1 -1
  159. package/fesm2022/ngx-tethys-upload.mjs +91 -130
  160. package/fesm2022/ngx-tethys-upload.mjs.map +1 -1
  161. package/fesm2022/ngx-tethys-util.mjs.map +1 -1
  162. package/fesm2022/ngx-tethys-watermark.mjs +36 -40
  163. package/fesm2022/ngx-tethys-watermark.mjs.map +1 -1
  164. package/fesm2022/ngx-tethys.mjs +1 -1
  165. package/fesm2022/ngx-tethys.mjs.map +1 -1
  166. package/form/form-group-error/form-group-error.component.d.ts +2 -3
  167. package/form/form-group-label.directive.d.ts +2 -1
  168. package/form/form-group.component.d.ts +17 -24
  169. package/form/form-submit.directive.d.ts +2 -2
  170. package/form/form.directive.d.ts +6 -8
  171. package/form/from-group-footer/form-group-footer.component.d.ts +2 -2
  172. package/form/validator/confirm-validator.directive.d.ts +2 -2
  173. package/form/validator/unique-validator.directive.d.ts +2 -2
  174. package/fullscreen/fullscreen.component.d.ts +7 -7
  175. package/grid/flex.d.ts +14 -19
  176. package/grid/thy-col.directive.d.ts +6 -9
  177. package/grid/thy-grid-item.component.d.ts +3 -4
  178. package/grid/thy-grid.component.d.ts +11 -12
  179. package/grid/thy-row.directive.d.ts +12 -12
  180. package/icon/icon.component.d.ts +3 -2
  181. package/image/image.directive.d.ts +3 -2
  182. package/input/input-count.component.d.ts +4 -5
  183. package/input/input-group.component.d.ts +20 -20
  184. package/input/input-search.component.d.ts +15 -20
  185. package/input/input.component.d.ts +20 -21
  186. package/input/input.directive.d.ts +4 -6
  187. package/input-number/input-number.component.d.ts +21 -29
  188. package/layout/header.component.d.ts +4 -9
  189. package/layout/sidebar-header.component.d.ts +2 -1
  190. package/layout/sidebar.component.d.ts +8 -7
  191. package/list/list.component.d.ts +2 -1
  192. package/list/selection/selection-list.d.ts +4 -3
  193. package/loading/loading.component.d.ts +4 -10
  194. package/mention/mention.directive.d.ts +6 -7
  195. package/mention/suggestions/suggestions.component.d.ts +8 -9
  196. package/menu/group/menu-group.component.d.ts +16 -33
  197. package/menu/item/action/menu-item-action.component.d.ts +7 -8
  198. package/menu/item/icon/menu-item-icon.component.d.ts +2 -2
  199. package/menu/item/menu-item.component.d.ts +4 -4
  200. package/menu/item/name/menu-item-name.component.d.ts +2 -3
  201. package/menu/menu.component.d.ts +3 -7
  202. package/nav/icon-nav/icon-nav-link.directive.d.ts +3 -7
  203. package/nav/icon-nav/icon-nav.component.d.ts +3 -8
  204. package/nav/nav-ink-bar.directive.d.ts +4 -6
  205. package/nav/nav-item.directive.d.ts +7 -10
  206. package/nav/nav.component.d.ts +20 -48
  207. package/package.json +1 -1
  208. package/pagination/pagination.component.d.ts +48 -109
  209. package/popover/header/popover-header.component.d.ts +7 -6
  210. package/popover/popover.directive.d.ts +11 -18
  211. package/progress/progress-circle.component.d.ts +32 -21
  212. package/progress/progress-strip.component.d.ts +10 -14
  213. package/progress/progress.component.d.ts +15 -23
  214. package/property/examples/single/single.component.scss +6 -0
  215. package/property/properties.component.d.ts +6 -13
  216. package/property/property-item.component.d.ts +21 -26
  217. package/property/styles/properties.scss +124 -52
  218. package/property-operation/property-operation.component.d.ts +6 -5
  219. package/radio/button/radio-button.component.d.ts +2 -2
  220. package/radio/group/radio-group.component.d.ts +8 -7
  221. package/radio/radio.component.d.ts +2 -2
  222. package/radio/radio.token.d.ts +2 -2
  223. package/rate/rate-item.component.d.ts +2 -1
  224. package/rate/rate.component.d.ts +4 -3
  225. package/resizable/resizable.directive.d.ts +4 -9
  226. package/resizable/resize-handle.component.d.ts +2 -1
  227. package/resizable/resize-handles.component.d.ts +2 -1
  228. package/result/result.component.d.ts +9 -10
  229. package/schematics/version.d.ts +1 -1
  230. package/schematics/version.js +1 -1
  231. package/segment/segment-item.component.d.ts +2 -1
  232. package/segment/segment.component.d.ts +2 -1
  233. package/select/custom-select/custom-select.component.d.ts +11 -10
  234. package/select/native-select/native-select.component.d.ts +2 -1
  235. package/shared/base-form-check.component.d.ts +3 -2
  236. package/shared/directives/thy-autofocus.directive.d.ts +3 -2
  237. package/shared/directives/thy-scroll.directive.d.ts +2 -1
  238. package/shared/directives/thy-show.d.ts +2 -1
  239. package/shared/option/group/option-group.component.d.ts +2 -1
  240. package/shared/option/list-option/list-option.component.d.ts +2 -7
  241. package/shared/option/option.component.d.ts +2 -1
  242. package/shared/select/select-control/select-control.component.d.ts +7 -6
  243. package/skeleton/skeleton-circle.component.d.ts +16 -19
  244. package/skeleton/skeleton-rectangle.component.d.ts +20 -23
  245. package/skeleton/skeleton.component.d.ts +5 -6
  246. package/skeleton/stylized/bullet-list.component.d.ts +11 -13
  247. package/skeleton/stylized/list.component.d.ts +10 -12
  248. package/skeleton/stylized/paragraph.component.d.ts +12 -14
  249. package/slide/slide-body/slide-body-section.component.d.ts +2 -1
  250. package/slider/slider.component.d.ts +17 -24
  251. package/space/space.component.d.ts +8 -8
  252. package/statistic/statistic.component.d.ts +35 -40
  253. package/stepper/step-header.component.d.ts +6 -10
  254. package/stepper/step.component.d.ts +6 -6
  255. package/stepper/stepper.component.d.ts +15 -20
  256. package/switch/switch.component.d.ts +24 -35
  257. package/table/table-column.component.d.ts +6 -5
  258. package/table/table-skeleton.component.d.ts +3 -10
  259. package/table/table.component.d.ts +11 -10
  260. package/tabs/tab-content.component.d.ts +4 -4
  261. package/tabs/tab.component.d.ts +4 -5
  262. package/tabs/tabs.component.d.ts +13 -15
  263. package/tag/tag.component.d.ts +10 -16
  264. package/time-picker/time-picker-panel.component.d.ts +3 -2
  265. package/time-picker/time-picker.component.d.ts +6 -5
  266. package/timeline/timeline-item.component.d.ts +9 -13
  267. package/timeline/timeline.component.d.ts +13 -17
  268. package/tooltip/tooltip.directive.d.ts +3 -2
  269. package/tree/tree-node.component.d.ts +6 -15
  270. package/tree/tree.component.d.ts +8 -7
  271. package/tree-select/tree-select.component.d.ts +8 -7
  272. package/typography/bg-color.directive.d.ts +3 -3
  273. package/typography/text/text.component.d.ts +2 -2
  274. package/typography/text-color.directive.d.ts +3 -3
  275. package/upload/file-drop.directive.d.ts +9 -11
  276. package/upload/file-select-base.d.ts +6 -10
  277. package/upload/file-select.component.d.ts +10 -20
  278. package/util/helpers/helpers.d.ts +2 -1
  279. package/vote/vote.component.d.ts +4 -3
  280. 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, Input, HostBinding, Directive, forwardRef, NgZone, EventEmitter, ViewChild, ContentChild, Output, ViewEncapsulation, Component, ChangeDetectorRef, DestroyRef, ChangeDetectionStrategy, NgModule } from '@angular/core';
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
- ngOnInit() {
56
- this.initialized = true;
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: "14.0.0", version: "19.2.8", type: ThyInputDirective, isStandalone: true, selector: "input[thyInput], select[thyInput], textarea[thyInput]", inputs: { thySize: "thySize" }, host: { properties: { "class.form-control": "this.isFormControl" } }, exportAs: ["thyInput"], ngImport: i0 }); }
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 = new EventEmitter();
121
+ this.focus = output();
106
122
  /**
107
123
  * blur 失焦事件
108
124
  */
109
- this.blur = new EventEmitter();
110
- this._type = 'text';
111
- this.focused = false;
112
- this.disabled = false;
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
- * @type 'number' | 'input'
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
- if (this.isPassword(this.type)) {
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 = 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 = isDisabled;
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 = true;
147
- this.showLabel = true;
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 = false;
156
- this.showLabel = false;
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 = this.isPassword(this.type) ? 'text' : 'password';
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: ["thyAutofocus", "thyAutofocus", coerceBooleanProperty], thyType: "thyType", type: "type", thyLabelText: "thyLabelText", readonly: ["readonly", "readonly", coerceBooleanProperty] }, 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 }, { propertyName: "prependTemplate", first: true, predicate: ["prepend"], descendants: true }], viewQueries: [{ propertyName: "eyeTemplate", first: true, predicate: ["eye"], descendants: true, static: 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@if (appendTemplate) {\n <div #append class=\"input-append\">\n <ng-template *ngTemplateOutlet=\"appendTemplate\"></ng-template>\n </div>\n}\n\n<ng-template #eye>\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</ng-template>\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 }); }
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 <ng-template *ngTemplateOutlet=\"appendTemplate\"></ng-template>\n </div>\n}\n\n<ng-template #eye>\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</ng-template>\n" }]
175
- }], propDecorators: { placeholder: [{
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.disabled = false;
225
- }
226
- /**
227
- * 输入框上添加的后置文本
228
- */
229
- set thyAppendText(value) {
230
- this.appendText = value;
231
- }
232
- /**
233
- * 输入框上添加的后置文本多语言 Key
234
- */
235
- set thyAppendTextTranslateKey(value) {
236
- if (value) {
237
- this.appendText = this.thyTranslate.instant(value);
238
- }
239
- }
240
- /**
241
- * 输入框上添加的前置文本
242
- */
243
- set thyPrependText(value) {
244
- this.prependText = value;
245
- }
246
- /**
247
- * 输入框上添加的前置文本多语言 Key
248
- */
249
- set thyPrependTextTranslateKey(value) {
250
- if (value) {
251
- this.prependText = this.thyTranslate.instant(value);
252
- }
253
- }
254
- /**
255
- * 输入框分组大小
256
- * @type 'sm' | 'lg' | 'md' | ''
257
- * @default ''
258
- */
259
- set thySize(size) {
260
- if (size && inputGroupSizeMap[size]) {
261
- this.hostRenderer.updateClass(inputGroupSizeMap[size]);
262
- }
263
- else {
264
- this.hostRenderer.updateClass([]);
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 = 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": "this.disabled" }, classAttribute: "thy-input-group" }, queries: [{ propertyName: "appendTemplate", first: true, predicate: ["append"], descendants: true }, { propertyName: "prependTemplate", first: true, predicate: ["prepend"], descendants: true }, { propertyName: "prefixTemplate", first: true, predicate: ["prefix"], descendants: true }, { propertyName: "suffixTemplate", first: true, predicate: ["suffix"], descendants: true }, { propertyName: "inputDirective", first: true, predicate: ThyInputDirective, descendants: 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 }); }
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
- }, 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" }]
328
- }], propDecorators: { disabled: [{
329
- type: HostBinding,
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.autoFocus = false;
395
- this.iconPosition = 'before';
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 = new EventEmitter();
425
+ this.clear = output();
409
426
  /**
410
427
  * 清除搜索事件
411
428
  */
412
- this.thyClear = new EventEmitter();
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 = false;
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 = value;
442
- this.cdr.markForCheck();
458
+ this.searchText.set(value);
443
459
  }
444
460
  setDisabledState(isDisabled) {
445
- this.disabled = isDisabled;
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", thySearchFocus: ["thySearchFocus", "thySearchFocus", coerceBooleanProperty], thyIconPosition: "thyIconPosition", thySize: "thySize" }, 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, static: 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 = 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 }); }
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 = 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" }]
478
- }], ctorParameters: () => [], propDecorators: { inputElement: [{
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
- this.inputLength = 0;
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 = input.nativeElement.getAttribute('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 = value?.length || 0;
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
- if (!this.hasInput && this.inputGroup && this.inputGroup.inputDirective) {
540
- this.thyInput$.next(this.inputGroup.inputDirective);
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: "14.0.0", version: "19.2.8", type: ThyInputCount, isStandalone: true, selector: "thy-input-count", inputs: { thyInput: "thyInput" }, host: { classAttribute: "thy-input-count text-muted" }, ngImport: i0, template: '{{inputLength}} / {{maxLength}}', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
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: () => [], propDecorators: { thyInput: [{
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 }); }