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 { numberAttribute, HostBinding, Input, Component, InjectionToken, inject, TemplateRef, ViewChild, EventEmitter, ContentChildren, ViewChildren, Output, HostListener, Directive, NgModule } from '@angular/core';
2
+ import { input, numberAttribute, ChangeDetectionStrategy, Component, InjectionToken, inject, viewChild, TemplateRef, output, contentChildren, signal, computed, effect, untracked, HostListener, Directive, NgModule } from '@angular/core';
3
3
  import { NgTemplateOutlet, CommonModule } from '@angular/common';
4
4
  import { ThyIcon } from 'ngx-tethys/icon';
5
5
  import { coerceBooleanProperty } from 'ngx-tethys/util';
@@ -11,34 +11,19 @@ import { coerceBooleanProperty } from 'ngx-tethys/util';
11
11
  */
12
12
  class ThyStepHeader {
13
13
  constructor() {
14
- this.thyStepHeader = true;
14
+ this.label = input();
15
+ this.icon = input();
16
+ this.index = input(undefined, { transform: numberAttribute });
17
+ this.selected = input(false, { transform: coerceBooleanProperty });
18
+ this.active = input(false, { transform: coerceBooleanProperty });
15
19
  }
16
20
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyStepHeader, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
17
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "19.2.8", type: ThyStepHeader, isStandalone: true, selector: "thy-step-header", inputs: { label: "label", icon: "icon", index: ["index", "index", numberAttribute], selected: ["selected", "selected", coerceBooleanProperty], active: ["active", "active", coerceBooleanProperty] }, host: { properties: { "class.thy-stepper-header-selected": "this.selected", "class.thy-stepper-header": "this.thyStepHeader" } }, ngImport: i0, template: "<div class=\"thy-step-number\">\n <span>{{ index + 1 }}</span>\n</div>\n<thy-icon class=\"thy-step-icon\" [thyIconName]=\"icon || 'check-circle'\"></thy-icon>\n<div class=\"thy-step-label\">{{ label }}</div>\n", dependencies: [{ kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }] }); }
21
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.8", type: ThyStepHeader, isStandalone: true, selector: "thy-step-header", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, index: { classPropertyName: "index", publicName: "index", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null }, active: { classPropertyName: "active", publicName: "active", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "thy-stepper-header" }, ngImport: i0, template: "<div class=\"thy-step-number\">\n <span>{{ index() + 1 }}</span>\n</div>\n<thy-icon class=\"thy-step-icon\" [thyIconName]=\"icon() || 'check-circle'\"></thy-icon>\n<div class=\"thy-step-label\">{{ label() }}</div>\n", dependencies: [{ kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
18
22
  }
19
23
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyStepHeader, decorators: [{
20
24
  type: Component,
21
- args: [{ selector: 'thy-step-header', imports: [ThyIcon], template: "<div class=\"thy-step-number\">\n <span>{{ index + 1 }}</span>\n</div>\n<thy-icon class=\"thy-step-icon\" [thyIconName]=\"icon || 'check-circle'\"></thy-icon>\n<div class=\"thy-step-label\">{{ label }}</div>\n" }]
22
- }], propDecorators: { label: [{
23
- type: Input
24
- }], icon: [{
25
- type: Input
26
- }], index: [{
27
- type: Input,
28
- args: [{ transform: numberAttribute }]
29
- }], selected: [{
30
- type: HostBinding,
31
- args: ['class.thy-stepper-header-selected']
32
- }, {
33
- type: Input,
34
- args: [{ transform: coerceBooleanProperty }]
35
- }], active: [{
36
- type: Input,
37
- args: [{ transform: coerceBooleanProperty }]
38
- }], thyStepHeader: [{
39
- type: HostBinding,
40
- args: ['class.thy-stepper-header']
41
- }] } });
25
+ args: [{ selector: 'thy-step-header', imports: [ThyIcon], changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'thy-stepper-header' }, template: "<div class=\"thy-step-number\">\n <span>{{ index() + 1 }}</span>\n</div>\n<thy-icon class=\"thy-step-icon\" [thyIconName]=\"icon() || 'check-circle'\"></thy-icon>\n<div class=\"thy-step-label\">{{ label() }}</div>\n" }]
26
+ }] });
42
27
 
43
28
  const THY_STEPPER_COMPONENT = new InjectionToken('THY_STEPPER_COMPONENT');
44
29
  /**
@@ -49,26 +34,28 @@ const THY_STEPPER_COMPONENT = new InjectionToken('THY_STEPPER_COMPONENT');
49
34
  class ThyStep {
50
35
  constructor() {
51
36
  this.stepper = inject(THY_STEPPER_COMPONENT, { optional: true });
37
+ this.content = viewChild(TemplateRef);
38
+ this.label = input();
39
+ /**
40
+ * 步骤条中每个步骤的label文本
41
+ */
42
+ this.thyLabel = input();
43
+ /**
44
+ * 步骤条中每个步骤完成的图标
45
+ * @default check-circle
46
+ */
47
+ this.thyIcon = input();
52
48
  }
53
49
  select() {
54
- this.stepper.selected = this;
50
+ this.stepper.updateSelected(this);
55
51
  }
56
52
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyStep, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
57
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.8", type: ThyStep, isStandalone: true, selector: "thy-step", inputs: { label: "label", thyLabel: "thyLabel", thyIcon: "thyIcon" }, viewQueries: [{ propertyName: "content", first: true, predicate: TemplateRef, descendants: true, static: true }], ngImport: i0, template: "<ng-template><ng-content></ng-content></ng-template>\n" }); }
53
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "19.2.8", type: ThyStep, isStandalone: true, selector: "thy-step", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, thyLabel: { classPropertyName: "thyLabel", publicName: "thyLabel", isSignal: true, isRequired: false, transformFunction: null }, thyIcon: { classPropertyName: "thyIcon", publicName: "thyIcon", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "content", first: true, predicate: TemplateRef, descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template><ng-content></ng-content></ng-template>\n" }); }
58
54
  }
59
55
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyStep, decorators: [{
60
56
  type: Component,
61
57
  args: [{ selector: 'thy-step', template: "<ng-template><ng-content></ng-content></ng-template>\n" }]
62
- }], propDecorators: { content: [{
63
- type: ViewChild,
64
- args: [TemplateRef, { static: true }]
65
- }], label: [{
66
- type: Input
67
- }], thyLabel: [{
68
- type: Input
69
- }], thyIcon: [{
70
- type: Input
71
- }] } });
58
+ }] });
72
59
 
73
60
  /**
74
61
  * 步骤条组件
@@ -77,97 +64,77 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
77
64
  */
78
65
  class ThyStepper {
79
66
  constructor() {
67
+ /**
68
+ * 当前处于激活状态的步骤 index
69
+ */
70
+ this.thySelectedIndex = input(0, { transform: numberAttribute });
71
+ /**
72
+ * 当前处于激活状态的步骤实例
73
+ */
74
+ this.thySelected = input();
80
75
  /**
81
76
  * 步骤条导航是否展示,默认展示
82
77
  */
83
- this.thyShowStepHeader = true;
84
- this._selectedIndex = 0;
85
- this.selectionChange = new EventEmitter();
86
- this.thyStepper = true;
87
- }
88
- /**
89
- * 当前处于激活状态的步骤index
90
- * @default 0
91
- */
92
- set thySelectedIndex(value) {
93
- this.selectedIndex = value;
94
- }
95
- set thySelected(value) {
96
- this.selected = value;
97
- }
98
- set selected(step) {
99
- this.selectedIndex = this.steps ? this.steps.toArray().indexOf(step) : -1;
100
- }
101
- get selected() {
102
- return this.steps ? this.steps.toArray()[this.selectedIndex] : null;
78
+ this.thyShowStepHeader = input(true, { transform: coerceBooleanProperty });
79
+ this.selectionChange = output();
80
+ this.steps = contentChildren(ThyStep);
81
+ this.selectedIndex = signal(0);
82
+ this.selected = computed(() => this.steps()?.[this.selectedIndex()]);
83
+ effect(() => {
84
+ const newIndex = this.thySelectedIndex();
85
+ if (newIndex) {
86
+ untracked(() => {
87
+ this.updateSelectedIndex(newIndex);
88
+ });
89
+ }
90
+ });
91
+ effect(() => {
92
+ const selected = this.thySelected();
93
+ if (selected) {
94
+ untracked(() => {
95
+ const index = this.steps()?.indexOf(selected);
96
+ if (index > -1) {
97
+ this.updateSelectedIndex(index);
98
+ }
99
+ });
100
+ }
101
+ });
103
102
  }
104
- set selectedIndex(index) {
105
- if (this.steps) {
106
- this._updateSelectedItemIndex(index);
103
+ updateSelectedIndex(newIndex) {
104
+ if (!this.steps()?.[newIndex]) {
105
+ return;
107
106
  }
108
- else {
109
- this._selectedIndex = index;
110
- }
111
- }
112
- get selectedIndex() {
113
- return this._selectedIndex;
114
- }
115
- _updateSelectedItemIndex(newIndex) {
116
- const stepsArray = this.steps.toArray();
107
+ const previouslySelectedIndex = this.selectedIndex();
108
+ const previouslySelectedStep = this.steps() ? this.steps()[previouslySelectedIndex] : null;
109
+ this.selectedIndex.set(newIndex);
117
110
  this.selectionChange.emit({
118
111
  selectedIndex: newIndex,
119
- previouslySelectedIndex: this._selectedIndex,
120
- selectedStep: stepsArray[newIndex],
121
- previouslySelectedStep: stepsArray[this._selectedIndex]
112
+ previouslySelectedIndex: previouslySelectedIndex,
113
+ selectedStep: this.selected(),
114
+ previouslySelectedStep: previouslySelectedStep
122
115
  });
123
- this._selectedIndex = newIndex;
116
+ }
117
+ updateSelected(step) {
118
+ const index = this.steps().indexOf(step);
119
+ this.updateSelectedIndex(index);
124
120
  }
125
121
  to(index) {
126
- this.selectedIndex = Math.min(index, this.steps.length - 1);
122
+ this.updateSelectedIndex(Math.min(index, this.steps().length - 1));
127
123
  }
128
124
  next() {
129
- this.selectedIndex = Math.min(this._selectedIndex + 1, this.steps.length - 1);
125
+ this.updateSelectedIndex(Math.min(this.selectedIndex() + 1, this.steps().length - 1));
130
126
  }
131
127
  /** Selects and focuses the previous step in list. */
132
128
  previous() {
133
- this.selectedIndex = Math.max(this._selectedIndex - 1, 0);
129
+ this.updateSelectedIndex(Math.max(this.selectedIndex() - 1, 0));
134
130
  }
135
131
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyStepper, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
136
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyStepper, isStandalone: true, selector: "thy-stepper", inputs: { thySelectedIndex: ["thySelectedIndex", "thySelectedIndex", numberAttribute], thySelected: "thySelected", thyShowStepHeader: ["thyShowStepHeader", "thyShowStepHeader", coerceBooleanProperty] }, outputs: { selectionChange: "selectionChange" }, host: { properties: { "class.thy-stepper": "this.thyStepper" } }, providers: [
137
- {
138
- provide: THY_STEPPER_COMPONENT,
139
- useExisting: ThyStepper
140
- }
141
- ], queries: [{ propertyName: "steps", predicate: ThyStep }], viewQueries: [{ propertyName: "stepHeaders", predicate: ThyStepHeader, descendants: true }], ngImport: i0, template: "@if (thyShowStepHeader) {\n <div class=\"thy-stepper-header-container\">\n @for (step of steps; track $index; let i = $index; let isLast = $last) {\n <thy-step-header\n [index]=\"i\"\n [label]=\"step.thyLabel || step.label\"\n [icon]=\"step.thyIcon\"\n [selected]=\"selectedIndex === i\"\n [class.thy-stepper-header-active]=\"i <= selectedIndex\"\n [active]=\"i <= selectedIndex\">\n </thy-step-header>\n @if (!isLast) {\n <div class=\"thy-stepper-line\" [class.thy-stepper-line-active]=\"i < selectedIndex\"></div>\n }\n }\n </div>\n}\n\n<div class=\"thy-stepper-content-container\">\n <ng-container [ngTemplateOutlet]=\"selected?.content\"></ng-container>\n</div>\n", dependencies: [{ kind: "component", type: ThyStepHeader, selector: "thy-step-header", inputs: ["label", "icon", "index", "selected", "active"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] }); }
132
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyStepper, isStandalone: true, selector: "thy-stepper", inputs: { thySelectedIndex: { classPropertyName: "thySelectedIndex", publicName: "thySelectedIndex", isSignal: true, isRequired: false, transformFunction: null }, thySelected: { classPropertyName: "thySelected", publicName: "thySelected", isSignal: true, isRequired: false, transformFunction: null }, thyShowStepHeader: { classPropertyName: "thyShowStepHeader", publicName: "thyShowStepHeader", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectionChange: "selectionChange" }, host: { classAttribute: "thy-stepper" }, providers: [{ provide: THY_STEPPER_COMPONENT, useExisting: ThyStepper }], queries: [{ propertyName: "steps", predicate: ThyStep, isSignal: true }], ngImport: i0, template: "@if (thyShowStepHeader()) {\n <div class=\"thy-stepper-header-container\">\n @for (step of steps(); track $index; let i = $index; let isLast = $last) {\n <thy-step-header\n [index]=\"i\"\n [label]=\"step.thyLabel() || step.label()\"\n [icon]=\"step.thyIcon()\"\n [selected]=\"selectedIndex() === i\"\n [class.thy-stepper-header-active]=\"i <= selectedIndex()\"\n [active]=\"i <= selectedIndex()\">\n </thy-step-header>\n @if (!isLast) {\n <div class=\"thy-stepper-line\" [class.thy-stepper-line-active]=\"i < selectedIndex()\"></div>\n }\n }\n </div>\n}\n\n<div class=\"thy-stepper-content-container\">\n <ng-container [ngTemplateOutlet]=\"selected()?.content()\"></ng-container>\n</div>\n\n ", dependencies: [{ kind: "component", type: ThyStepHeader, selector: "thy-step-header", inputs: ["label", "icon", "index", "selected", "active"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
142
133
  }
143
134
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyStepper, decorators: [{
144
135
  type: Component,
145
- args: [{ selector: 'thy-stepper', providers: [
146
- {
147
- provide: THY_STEPPER_COMPONENT,
148
- useExisting: ThyStepper
149
- }
150
- ], imports: [ThyStepHeader, NgTemplateOutlet], template: "@if (thyShowStepHeader) {\n <div class=\"thy-stepper-header-container\">\n @for (step of steps; track $index; let i = $index; let isLast = $last) {\n <thy-step-header\n [index]=\"i\"\n [label]=\"step.thyLabel || step.label\"\n [icon]=\"step.thyIcon\"\n [selected]=\"selectedIndex === i\"\n [class.thy-stepper-header-active]=\"i <= selectedIndex\"\n [active]=\"i <= selectedIndex\">\n </thy-step-header>\n @if (!isLast) {\n <div class=\"thy-stepper-line\" [class.thy-stepper-line-active]=\"i < selectedIndex\"></div>\n }\n }\n </div>\n}\n\n<div class=\"thy-stepper-content-container\">\n <ng-container [ngTemplateOutlet]=\"selected?.content\"></ng-container>\n</div>\n" }]
151
- }], propDecorators: { thySelectedIndex: [{
152
- type: Input,
153
- args: [{ transform: numberAttribute }]
154
- }], thySelected: [{
155
- type: Input
156
- }], thyShowStepHeader: [{
157
- type: Input,
158
- args: [{ transform: coerceBooleanProperty }]
159
- }], selectionChange: [{
160
- type: Output
161
- }], stepHeaders: [{
162
- type: ViewChildren,
163
- args: [ThyStepHeader]
164
- }], steps: [{
165
- type: ContentChildren,
166
- args: [ThyStep]
167
- }], thyStepper: [{
168
- type: HostBinding,
169
- args: ['class.thy-stepper']
170
- }] } });
136
+ args: [{ selector: 'thy-stepper', providers: [{ provide: THY_STEPPER_COMPONENT, useExisting: ThyStepper }], imports: [ThyStepHeader, NgTemplateOutlet], changeDetection: ChangeDetectionStrategy.OnPush, host: { class: 'thy-stepper' }, template: "@if (thyShowStepHeader()) {\n <div class=\"thy-stepper-header-container\">\n @for (step of steps(); track $index; let i = $index; let isLast = $last) {\n <thy-step-header\n [index]=\"i\"\n [label]=\"step.thyLabel() || step.label()\"\n [icon]=\"step.thyIcon()\"\n [selected]=\"selectedIndex() === i\"\n [class.thy-stepper-header-active]=\"i <= selectedIndex()\"\n [active]=\"i <= selectedIndex()\">\n </thy-step-header>\n @if (!isLast) {\n <div class=\"thy-stepper-line\" [class.thy-stepper-line-active]=\"i < selectedIndex()\"></div>\n }\n }\n </div>\n}\n\n<div class=\"thy-stepper-content-container\">\n <ng-container [ngTemplateOutlet]=\"selected()?.content()\"></ng-container>\n</div>\n\n " }]
137
+ }], ctorParameters: () => [] });
171
138
 
172
139
  /**
173
140
  * 在步进工作流中移动到下一个步骤的按钮
@@ -1 +1 @@
1
- {"version":3,"file":"ngx-tethys-stepper.mjs","sources":["../../../src/stepper/step-header.component.ts","../../../src/stepper/step-header.component.html","../../../src/stepper/step.component.ts","../../../src/stepper/step.component.html","../../../src/stepper/stepper.component.ts","../../../src/stepper/stepper.component.html","../../../src/stepper/stepper-button.directive.ts","../../../src/stepper/stepper.module.ts","../../../src/stepper/ngx-tethys-stepper.ts"],"sourcesContent":["import { ThyIcon } from 'ngx-tethys/icon';\nimport { coerceBooleanProperty } from 'ngx-tethys/util';\n\nimport { Component, HostBinding, Input, numberAttribute } from '@angular/core';\n\n/**\n * 步骤条头部组件\n * @name thy-step-header\n * @order 25\n */\n@Component({\n selector: 'thy-step-header',\n templateUrl: './step-header.component.html',\n imports: [ThyIcon]\n})\nexport class ThyStepHeader {\n @Input() label: string;\n\n @Input() icon: string;\n\n @Input({ transform: numberAttribute }) index: number;\n\n @HostBinding('class.thy-stepper-header-selected')\n @Input({ transform: coerceBooleanProperty })\n selected: boolean;\n\n @Input({ transform: coerceBooleanProperty }) active: boolean;\n\n @HostBinding('class.thy-stepper-header') thyStepHeader = true;\n}\n","<div class=\"thy-step-number\">\n <span>{{ index + 1 }}</span>\n</div>\n<thy-icon class=\"thy-step-icon\" [thyIconName]=\"icon || 'check-circle'\"></thy-icon>\n<div class=\"thy-step-label\">{{ label }}</div>\n","import { Component, InjectionToken, Input, TemplateRef, ViewChild, inject } from '@angular/core';\n\nexport interface IThyStepperComponent {\n selected: ThyStep;\n}\n\nexport const THY_STEPPER_COMPONENT = new InjectionToken<IThyStepperComponent>('THY_STEPPER_COMPONENT');\n\n/**\n * 步骤项组件\n * @name thy-step\n * @order 20\n */\n@Component({\n selector: 'thy-step',\n templateUrl: './step.component.html'\n})\nexport class ThyStep {\n stepper = inject(THY_STEPPER_COMPONENT, { optional: true })!;\n\n @ViewChild(TemplateRef, { static: true }) content: TemplateRef<any>;\n\n @Input() label: string;\n\n /**\n * 步骤条中每个步骤的label文本\n */\n @Input() thyLabel: string;\n\n /**\n * 步骤条中每个步骤完成的图标\n * @default check-circle\n */\n @Input() thyIcon: string;\n\n select() {\n this.stepper.selected = this;\n }\n}\n","<ng-template><ng-content></ng-content></ng-template>\n","import {\n Component,\n ViewChildren,\n ContentChildren,\n QueryList,\n HostBinding,\n Input,\n Output,\n EventEmitter,\n numberAttribute\n} from '@angular/core';\nimport { ThyStep, IThyStepperComponent, THY_STEPPER_COMPONENT } from './step.component';\nimport { ThyStepHeader } from './step-header.component';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { coerceBooleanProperty } from 'ngx-tethys/util';\n\n/**\n * 步骤条组件\n * @name thy-stepper\n * @order 10\n */\n@Component({\n selector: 'thy-stepper',\n templateUrl: 'stepper.component.html',\n providers: [\n {\n provide: THY_STEPPER_COMPONENT,\n useExisting: ThyStepper\n }\n ],\n imports: [ThyStepHeader, NgTemplateOutlet]\n})\nexport class ThyStepper implements IThyStepperComponent {\n /**\n * 当前处于激活状态的步骤index\n * @default 0\n */\n @Input({ transform: numberAttribute })\n set thySelectedIndex(value: number) {\n this.selectedIndex = value;\n }\n\n @Input()\n set thySelected(value: ThyStep) {\n this.selected = value;\n }\n\n /**\n * 步骤条导航是否展示,默认展示\n */\n @Input({ transform: coerceBooleanProperty }) thyShowStepHeader = true;\n\n private _selectedIndex = 0;\n\n public set selected(step: ThyStep) {\n this.selectedIndex = this.steps ? this.steps.toArray().indexOf(step) : -1;\n }\n\n public get selected() {\n return this.steps ? this.steps.toArray()[this.selectedIndex] : null;\n }\n\n set selectedIndex(index: number) {\n if (this.steps) {\n this._updateSelectedItemIndex(index);\n } else {\n this._selectedIndex = index;\n }\n }\n\n get selectedIndex() {\n return this._selectedIndex;\n }\n\n @Output() selectionChange: EventEmitter<any> = new EventEmitter<any>();\n\n @ViewChildren(ThyStepHeader) stepHeaders: QueryList<ThyStepHeader>;\n\n @ContentChildren(ThyStep) steps: QueryList<ThyStep>;\n\n @HostBinding('class.thy-stepper') thyStepper = true;\n\n private _updateSelectedItemIndex(newIndex: number): void {\n const stepsArray = this.steps.toArray();\n this.selectionChange.emit({\n selectedIndex: newIndex,\n previouslySelectedIndex: this._selectedIndex,\n selectedStep: stepsArray[newIndex],\n previouslySelectedStep: stepsArray[this._selectedIndex]\n });\n this._selectedIndex = newIndex;\n }\n\n to(index: number): void {\n this.selectedIndex = Math.min(index, this.steps.length - 1);\n }\n\n next(): void {\n this.selectedIndex = Math.min(this._selectedIndex + 1, this.steps.length - 1);\n }\n\n /** Selects and focuses the previous step in list. */\n previous(): void {\n this.selectedIndex = Math.max(this._selectedIndex - 1, 0);\n }\n}\n","@if (thyShowStepHeader) {\n <div class=\"thy-stepper-header-container\">\n @for (step of steps; track $index; let i = $index; let isLast = $last) {\n <thy-step-header\n [index]=\"i\"\n [label]=\"step.thyLabel || step.label\"\n [icon]=\"step.thyIcon\"\n [selected]=\"selectedIndex === i\"\n [class.thy-stepper-header-active]=\"i <= selectedIndex\"\n [active]=\"i <= selectedIndex\">\n </thy-step-header>\n @if (!isLast) {\n <div class=\"thy-stepper-line\" [class.thy-stepper-line-active]=\"i < selectedIndex\"></div>\n }\n }\n </div>\n}\n\n<div class=\"thy-stepper-content-container\">\n <ng-container [ngTemplateOutlet]=\"selected?.content\"></ng-container>\n</div>\n","import { Directive, HostListener, inject } from '@angular/core';\nimport { ThyStepper } from './stepper.component';\n\n/**\n * 在步进工作流中移动到下一个步骤的按钮\n * @description.en-us Button that moves to the next step in a stepper workflow.\n * @name thyStepperNext\n * @order 40\n */\n@Directive({\n selector: '[thyStepperNext]'\n})\nexport class ThyStepperNextDirective {\n private stepper = inject(ThyStepper);\n\n @HostListener('click', ['$event'])\n click($event: any) {\n this.stepper.next();\n }\n}\n\n/**\n * 在步进工作流中移动到上一个步骤的按钮\n * @description.en-us Button that moves to the previous step in a stepper workflow.\n * @name thyStepperPrevious\n * @order 30\n */\n@Directive({\n selector: '[thyStepperPrevious]'\n})\nexport class ThyStepperPreviousDirective {\n private stepper = inject(ThyStepper);\n\n @HostListener('click', ['$event'])\n click($event: any) {\n this.stepper.previous();\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ThyStepHeader } from './step-header.component';\nimport { ThyStep } from './step.component';\nimport { ThyStepper } from './stepper.component';\nimport { ThyStepperNextDirective, ThyStepperPreviousDirective } from './stepper-button.directive';\n\n@NgModule({\n imports: [CommonModule, ThyStepHeader, ThyStepper, ThyStep, ThyStepperNextDirective, ThyStepperPreviousDirective],\n exports: [ThyStepper, ThyStep, ThyStepHeader, ThyStepperNextDirective, ThyStepperPreviousDirective],\n providers: []\n})\nexport class ThyStepperModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAKA;;;;AAIG;MAMU,aAAa,CAAA;AAL1B,IAAA,WAAA,GAAA;QAkB6C,IAAa,CAAA,aAAA,GAAG,IAAI;AAChE;8GAdY,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAAb,aAAa,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,iBAAA,EAAA,MAAA,EAAA,EA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AJf,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,uBAAuB,EAAE,2BAA2B,CAAA,EAAA,OAAA,EAAA,CACtG,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,2BAA2B,CAAA,EAAA,CAAA,CAAA;AAGzF,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,EAJf,OAAA,EAAA,CAAA,YAAY,EAAE,aAAa,EAAE,UAAU,CAAA,EAAA,CAAA,CAAA;;2FAIxC,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAL5B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE,CAAC,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,uBAAuB,EAAE,2BAA2B,CAAC;oBACjH,OAAO,EAAE,CAAC,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,2BAA2B,CAAC;AACnG,oBAAA,SAAS,EAAE;AACd,iBAAA;;;ACXD;;AAEG;;;;"}
1
+ {"version":3,"file":"ngx-tethys-stepper.mjs","sources":["../../../src/stepper/step-header.component.ts","../../../src/stepper/step-header.component.html","../../../src/stepper/step.component.ts","../../../src/stepper/step.component.html","../../../src/stepper/stepper.component.ts","../../../src/stepper/stepper.component.html","../../../src/stepper/stepper-button.directive.ts","../../../src/stepper/stepper.module.ts","../../../src/stepper/ngx-tethys-stepper.ts"],"sourcesContent":["import { ThyIcon } from 'ngx-tethys/icon';\nimport { coerceBooleanProperty } from 'ngx-tethys/util';\n\nimport { Component, HostBinding, Input, numberAttribute, input, ChangeDetectionStrategy } from '@angular/core';\n\n/**\n * 步骤条头部组件\n * @name thy-step-header\n * @order 25\n */\n@Component({\n selector: 'thy-step-header',\n templateUrl: './step-header.component.html',\n imports: [ThyIcon],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { class: 'thy-stepper-header' }\n})\nexport class ThyStepHeader {\n readonly label = input<string>();\n\n readonly icon = input<string>();\n\n readonly index = input<number, unknown>(undefined, { transform: numberAttribute });\n\n readonly selected = input(false, { transform: coerceBooleanProperty });\n\n readonly active = input(false, { transform: coerceBooleanProperty });\n}\n","<div class=\"thy-step-number\">\n <span>{{ index() + 1 }}</span>\n</div>\n<thy-icon class=\"thy-step-icon\" [thyIconName]=\"icon() || 'check-circle'\"></thy-icon>\n<div class=\"thy-step-label\">{{ label() }}</div>\n","import { Component, InjectionToken, TemplateRef, ViewChild, inject, input, WritableSignal, viewChild } from '@angular/core';\n\nexport interface IThyStepperComponent {\n updateSelected(step: ThyStep): void;\n}\n\nexport const THY_STEPPER_COMPONENT = new InjectionToken<IThyStepperComponent>('THY_STEPPER_COMPONENT');\n\n/**\n * 步骤项组件\n * @name thy-step\n * @order 20\n */\n@Component({ selector: 'thy-step', templateUrl: './step.component.html' })\nexport class ThyStep {\n stepper = inject(THY_STEPPER_COMPONENT, { optional: true })!;\n\n readonly content = viewChild<TemplateRef<any>>(TemplateRef);\n\n readonly label = input<string>();\n\n /**\n * 步骤条中每个步骤的label文本\n */\n readonly thyLabel = input<string>();\n\n /**\n * 步骤条中每个步骤完成的图标\n * @default check-circle\n */\n readonly thyIcon = input<string>();\n\n select() {\n this.stepper.updateSelected(this);\n }\n}\n","<ng-template><ng-content></ng-content></ng-template>\n","import {\n Component,\n numberAttribute,\n viewChildren,\n output,\n contentChildren,\n input,\n computed,\n effect,\n ChangeDetectionStrategy,\n signal,\n untracked\n} from '@angular/core';\nimport { ThyStep, IThyStepperComponent, THY_STEPPER_COMPONENT } from './step.component';\nimport { ThyStepHeader } from './step-header.component';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { coerceBooleanProperty } from 'ngx-tethys/util';\n\n/**\n * 步骤条组件\n * @name thy-stepper\n * @order 10\n */\n@Component({\n selector: 'thy-stepper',\n templateUrl: 'stepper.component.html',\n providers: [{ provide: THY_STEPPER_COMPONENT, useExisting: ThyStepper }],\n imports: [ThyStepHeader, NgTemplateOutlet],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { class: 'thy-stepper' }\n})\nexport class ThyStepper implements IThyStepperComponent {\n /**\n * 当前处于激活状态的步骤 index\n */\n readonly thySelectedIndex = input<number, unknown>(0, { transform: numberAttribute });\n\n /**\n * 当前处于激活状态的步骤实例\n */\n readonly thySelected = input<ThyStep>();\n\n /**\n * 步骤条导航是否展示,默认展示\n */\n readonly thyShowStepHeader = input(true, { transform: coerceBooleanProperty });\n\n readonly selectionChange = output<any>();\n\n readonly steps = contentChildren(ThyStep);\n\n protected selectedIndex = signal(0);\n\n protected readonly selected = computed(() => this.steps()?.[this.selectedIndex()]);\n\n constructor() {\n effect(() => {\n const newIndex = this.thySelectedIndex();\n if (newIndex) {\n untracked(() => {\n this.updateSelectedIndex(newIndex);\n });\n }\n });\n\n effect(() => {\n const selected = this.thySelected();\n if (selected) {\n untracked(() => {\n const index = this.steps()?.indexOf(selected);\n if (index > -1) {\n this.updateSelectedIndex(index);\n }\n });\n }\n });\n }\n\n private updateSelectedIndex(newIndex: number): void {\n if (!this.steps()?.[newIndex]) {\n return;\n }\n const previouslySelectedIndex = this.selectedIndex();\n const previouslySelectedStep = this.steps() ? this.steps()[previouslySelectedIndex] : null;\n this.selectedIndex.set(newIndex);\n this.selectionChange.emit({\n selectedIndex: newIndex,\n previouslySelectedIndex: previouslySelectedIndex,\n selectedStep: this.selected(),\n previouslySelectedStep: previouslySelectedStep\n });\n }\n\n updateSelected(step: ThyStep): void {\n const index = this.steps().indexOf(step);\n this.updateSelectedIndex(index);\n }\n\n to(index: number): void {\n this.updateSelectedIndex(Math.min(index, this.steps().length - 1));\n }\n\n next(): void {\n this.updateSelectedIndex(Math.min(this.selectedIndex() + 1, this.steps().length - 1));\n }\n\n /** Selects and focuses the previous step in list. */\n previous(): void {\n this.updateSelectedIndex(Math.max(this.selectedIndex() - 1, 0));\n }\n}\n","@if (thyShowStepHeader()) {\n <div class=\"thy-stepper-header-container\">\n @for (step of steps(); track $index; let i = $index; let isLast = $last) {\n <thy-step-header\n [index]=\"i\"\n [label]=\"step.thyLabel() || step.label()\"\n [icon]=\"step.thyIcon()\"\n [selected]=\"selectedIndex() === i\"\n [class.thy-stepper-header-active]=\"i <= selectedIndex()\"\n [active]=\"i <= selectedIndex()\">\n </thy-step-header>\n @if (!isLast) {\n <div class=\"thy-stepper-line\" [class.thy-stepper-line-active]=\"i < selectedIndex()\"></div>\n }\n }\n </div>\n}\n\n<div class=\"thy-stepper-content-container\">\n <ng-container [ngTemplateOutlet]=\"selected()?.content()\"></ng-container>\n</div>\n\n ","import { Directive, HostListener, inject } from '@angular/core';\nimport { ThyStepper } from './stepper.component';\n\n/**\n * 在步进工作流中移动到下一个步骤的按钮\n * @description.en-us Button that moves to the next step in a stepper workflow.\n * @name thyStepperNext\n * @order 40\n */\n@Directive({\n selector: '[thyStepperNext]'\n})\nexport class ThyStepperNextDirective {\n private stepper = inject(ThyStepper);\n\n @HostListener('click', ['$event'])\n click($event: any) {\n this.stepper.next();\n }\n}\n\n/**\n * 在步进工作流中移动到上一个步骤的按钮\n * @description.en-us Button that moves to the previous step in a stepper workflow.\n * @name thyStepperPrevious\n * @order 30\n */\n@Directive({\n selector: '[thyStepperPrevious]'\n})\nexport class ThyStepperPreviousDirective {\n private stepper = inject(ThyStepper);\n\n @HostListener('click', ['$event'])\n click($event: any) {\n this.stepper.previous();\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ThyStepHeader } from './step-header.component';\nimport { ThyStep } from './step.component';\nimport { ThyStepper } from './stepper.component';\nimport { ThyStepperNextDirective, ThyStepperPreviousDirective } from './stepper-button.directive';\n\n@NgModule({\n imports: [CommonModule, ThyStepHeader, ThyStepper, ThyStep, ThyStepperNextDirective, ThyStepperPreviousDirective],\n exports: [ThyStepper, ThyStep, ThyStepHeader, ThyStepperNextDirective, ThyStepperPreviousDirective],\n providers: []\n})\nexport class ThyStepperModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAKA;;;;AAIG;MAQU,aAAa,CAAA;AAP1B,IAAA,WAAA,GAAA;QAQa,IAAK,CAAA,KAAA,GAAG,KAAK,EAAU;QAEvB,IAAI,CAAA,IAAA,GAAG,KAAK,EAAU;QAEtB,IAAK,CAAA,KAAA,GAAG,KAAK,CAAkB,SAAS,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;QAEzE,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,qBAAqB,EAAE,CAAC;QAE7D,IAAM,CAAA,MAAA,GAAG,KAAK,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,qBAAqB,EAAE,CAAC;AACvE;8GAVY,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAAA,CAAA;kGAAb,aAAa,EAAA,YAAA,EAAA,IAAA,EAAA,QAAA,EAAA,iBAAA,EAAA,MAAA,EAAA,EAAA,KAAA,EAAA,EAAA,iBAAA,EAAA,OAAA,EAAA,UAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,IAAA,EAAA,EAAA,iBAAA,EAAA,MAAA,EAAA,UAAA,EAAA,MAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,KAAA,EAAA,EAAA,iBAAA,EAAA,OAAA,EAAA,UAAA,EAAA,OAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,QAAA,EAAA,E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CAJf,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,uBAAuB,EAAE,2BAA2B,CAAA,EAAA,OAAA,EAAA,CACtG,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,2BAA2B,CAAA,EAAA,CAAA,CAAA;AAGzF,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,gBAAgB,EAJf,OAAA,EAAA,CAAA,YAAY,EAAE,aAAa,EAAE,UAAU,CAAA,EAAA,CAAA,CAAA;;2FAIxC,gBAAgB,EAAA,UAAA,EAAA,CAAA;kBAL5B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE,CAAC,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,uBAAuB,EAAE,2BAA2B,CAAC;oBACjH,OAAO,EAAE,CAAC,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,uBAAuB,EAAE,2BAA2B,CAAC;AACnG,oBAAA,SAAS,EAAE;AACd,iBAAA;;;ACXD;;AAEG;;;;"}
@@ -1,97 +1,101 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, ChangeDetectorRef, EventEmitter, forwardRef, Output, Input, ViewChild, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
2
+ import { input, output, signal, computed, viewChild, ElementRef, inject, ChangeDetectorRef, effect, forwardRef, ChangeDetectionStrategy, Component, NgModule } from '@angular/core';
3
3
  import { NgClass, CommonModule } from '@angular/common';
4
4
  import { NG_VALUE_ACCESSOR } from '@angular/forms';
5
5
  import { TabIndexDisabledControlValueAccessorMixin } from 'ngx-tethys/core';
6
6
  import { coerceBooleanProperty } from 'ngx-tethys/util';
7
7
 
8
+ const supportedTypes = ['primary', 'info', 'warning', 'danger'];
9
+ const supportedSizes = ['', 'sm', 'xs'];
8
10
  /**
9
11
  * 开关组件
10
12
  * @name thy-switch
11
13
  * @order 10
12
14
  */
13
15
  class ThySwitch extends TabIndexDisabledControlValueAccessorMixin {
14
- /**
15
- * 类型,目前分为: 'primary' |'info' | 'warning' | 'danger'
16
- */
17
- set thyType(value) {
18
- if (!this.typeArray.includes(value)) {
19
- value = 'primary';
20
- }
21
- this.type = value;
22
- if (this.initialized) {
23
- this.setClassNames();
24
- }
25
- }
26
- /**
27
- * 大小
28
- * @type xs | sm | md
29
- * @default md
30
- */
31
- set thySize(value) {
32
- if (!this.sizeArray.includes(value)) {
33
- value = '';
34
- }
35
- this.size = value;
36
- if (this.initialized) {
37
- this.setClassNames();
38
- }
39
- if (this.loadingInitialized) {
40
- this.setLoadingCircle();
41
- }
42
- }
43
- /**
44
- * 是否属于禁用状态
45
- */
46
- set thyDisabled(value) {
47
- this.disabled = value;
48
- this.setClassNames();
49
- }
50
16
  get thyDisabled() {
51
- return this.disabled;
52
- }
53
- /**
54
- * 是否加载中
55
- */
56
- set thyLoading(value) {
57
- this.loading = value;
58
- if (this.initialized) {
59
- this.setClassNames();
60
- }
61
- if (this.loading && !this.loadingInitialized) {
62
- this.setLoadingCircle();
63
- this.loadingInitialized = true;
64
- }
17
+ return this.disabled();
65
18
  }
66
19
  constructor() {
67
20
  super();
68
- this.cdr = inject(ChangeDetectorRef);
69
- this.type = 'primary';
70
- this.size = '';
71
- this.disabled = false;
72
- this.loading = false;
73
- this.typeArray = ['primary', 'info', 'warning', 'danger'];
74
- this.sizeArray = ['', 'sm', 'xs'];
75
- this.loadingCircle = {};
76
- this.initialized = false;
77
- this.loadingInitialized = false;
78
- this.isDisabledFirstChange = true;
21
+ /**
22
+ * 类型,目前分为: 'primary' |'info' | 'warning' | 'danger'
23
+ */
24
+ this.thyType = input('primary');
25
+ /**
26
+ * 大小
27
+ * @type xs | sm | md
28
+ * @default md
29
+ */
30
+ this.thySize = input('');
31
+ /**
32
+ * 是否属于禁用状态
33
+ */
34
+ this.inputDisabled = input(false, { transform: coerceBooleanProperty, alias: `thyDisabled` });
35
+ /**
36
+ * 是否加载中
37
+ */
38
+ this.thyLoading = input(false, { transform: coerceBooleanProperty });
79
39
  /**
80
40
  * 数据变化的回调事件,即将被弃用,请使用 ngModelChange
81
41
  * @deprecated
82
42
  */
83
- this.thyChange = new EventEmitter();
43
+ this.thyChange = output();
44
+ this.model = signal(false);
45
+ this.disabled = signal(false);
46
+ this.type = computed(() => {
47
+ if (!supportedTypes.includes(this.thyType())) {
48
+ return 'primary';
49
+ }
50
+ else {
51
+ return this.thyType();
52
+ }
53
+ });
54
+ this.size = computed(() => {
55
+ if (!supportedSizes.includes(this.thySize())) {
56
+ return '';
57
+ }
58
+ else {
59
+ return this.thySize();
60
+ }
61
+ });
62
+ this.classNames = computed(() => {
63
+ const classList = [`thy-switch-${this.type()}`];
64
+ if (this.size()) {
65
+ classList.push(`thy-switch-${this.size()}`);
66
+ }
67
+ if (this.disabled() || this.thyLoading()) {
68
+ classList.push(`thy-switch-disabled`);
69
+ if (this.model()) {
70
+ classList.push(`thy-switch-disabled-true`);
71
+ }
72
+ }
73
+ return classList;
74
+ });
75
+ this.loadingCircle = computed(() => {
76
+ const svgSize = { xs: 12, sm: 16 };
77
+ const circleSize = svgSize[this.size()] ?? 20;
78
+ const centerPoint = circleSize / 2;
79
+ const r = circleSize / 4;
80
+ return {
81
+ viewBox: `0 0 ${circleSize} ${circleSize}`,
82
+ cx: centerPoint,
83
+ cy: centerPoint,
84
+ r: r,
85
+ dasharray: `${2 * Math.PI * r * 0.75} ${2 * Math.PI * r * 0.25}`
86
+ };
87
+ });
84
88
  this.onModelChange = () => { };
85
89
  this.onModelTouched = () => { };
86
- }
87
- ngOnInit() {
88
- this.setClassNames();
89
- this.initialized = true;
90
+ this.switchElementRef = viewChild('switch', { read: (ElementRef) });
91
+ this.cdr = inject(ChangeDetectorRef);
92
+ effect(() => {
93
+ this.disabled.set(this.inputDisabled());
94
+ });
90
95
  }
91
96
  writeValue(value) {
92
- this.model = value;
97
+ this.model.set(value);
93
98
  this.cdr.markForCheck();
94
- // this.setClassNames();
95
99
  }
96
100
  registerOnChange(fn) {
97
101
  this.onModelChange = fn;
@@ -100,85 +104,21 @@ class ThySwitch extends TabIndexDisabledControlValueAccessorMixin {
100
104
  this.onModelTouched = fn;
101
105
  }
102
106
  setDisabledState(isDisabled) {
103
- this.disabled = (this.isDisabledFirstChange && this.thyDisabled) || isDisabled;
104
- this.isDisabledFirstChange = false;
105
- this.setClassNames();
107
+ this.disabled.set(isDisabled);
106
108
  }
107
109
  toggle(event) {
108
- this.model = !this.model;
109
- this.onModelChange(this.model);
110
+ this.model.set(!this.model());
111
+ this.onModelChange(this.model());
110
112
  this.onModelTouched();
111
- this.thyChange.emit(event);
112
- }
113
- setClassNames() {
114
- this.classNames = [`thy-switch-${this.type}`];
115
- if (this.size) {
116
- this.classNames.push(`thy-switch-${this.size}`);
117
- }
118
- if (this.disabled || this.loading) {
119
- this.classNames.push(`thy-switch-disabled`);
120
- if (this.model) {
121
- this.classNames.push(`thy-switch-disabled-true`);
122
- }
123
- }
124
- this.cdr.markForCheck();
125
- }
126
- setLoadingCircle() {
127
- const svgSize = {
128
- ['xs']: 12,
129
- ['sm']: 16,
130
- ['']: 20
131
- };
132
- const circleSize = svgSize[this.size];
133
- const centerPoint = circleSize / 2;
134
- const r = circleSize / 4;
135
- this.loadingCircle = {
136
- viewBox: `0 0 ${circleSize} ${circleSize}`,
137
- cx: centerPoint,
138
- cy: centerPoint,
139
- r: r,
140
- dasharray: `${2 * Math.PI * r * 0.75} ${2 * Math.PI * r * 0.25}`
141
- };
142
- this.cdr.markForCheck();
113
+ this.thyChange?.emit(event);
143
114
  }
144
115
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThySwitch, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
145
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThySwitch, isStandalone: true, selector: "thy-switch", inputs: { thyType: "thyType", thySize: "thySize", thyDisabled: ["thyDisabled", "thyDisabled", coerceBooleanProperty], thyLoading: ["thyLoading", "thyLoading", coerceBooleanProperty] }, outputs: { thyChange: "thyChange" }, host: { properties: { "class.thy-switch-xs": "size === \"xs\"", "class.thy-switch-sm": "size === \"sm\"" }, classAttribute: "thy-switch" }, providers: [
146
- {
147
- provide: NG_VALUE_ACCESSOR,
148
- useExisting: forwardRef(() => ThySwitch),
149
- multi: true
150
- }
151
- ], viewQueries: [{ propertyName: "switchElementRef", first: true, predicate: ["switch"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<label #switch class=\"thy-switch\" [ngClass]=\"classNames\">\n <input\n type=\"checkbox\"\n [attr.tabindex]=\"-1\"\n [disabled]=\"disabled || loading\"\n class=\"thy-switch-input\"\n [checked]=\"model\"\n (change)=\"toggle($event)\" />\n <span class=\"thy-switch-label\" [attr.tabindex]=\"tabIndex\"></span>\n <span class=\"thy-switch-handle\">\n @if (loading) {\n <svg [attr.viewBox]=\"loadingCircle?.viewBox\" [class.mb-1]=\"size === 'xs'\">\n <circle\n class=\"thy-switch-loading\"\n [style.transform-origin]=\"loadingCircle?.cx + 'px ' + loadingCircle?.cy + 'px'\"\n [attr.cx]=\"loadingCircle?.cx\"\n [attr.cy]=\"loadingCircle?.cy\"\n [attr.r]=\"loadingCircle?.r\"\n [attr.stroke]=\"model ? 'rgba(102,152,255,1)' : 'rgba(202,202,202,1)'\"\n stroke-width=\"1\"\n [attr.stroke-dasharray]=\"loadingCircle?.dasharray\"\n fill=\"white\" />\n </svg>\n }\n </span>\n</label>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
116
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThySwitch, isStandalone: true, selector: "thy-switch", inputs: { thyType: { classPropertyName: "thyType", publicName: "thyType", isSignal: true, isRequired: false, transformFunction: null }, thySize: { classPropertyName: "thySize", publicName: "thySize", isSignal: true, isRequired: false, transformFunction: null }, inputDisabled: { classPropertyName: "inputDisabled", publicName: "thyDisabled", isSignal: true, isRequired: false, transformFunction: null }, thyLoading: { classPropertyName: "thyLoading", publicName: "thyLoading", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { thyChange: "thyChange" }, host: { properties: { "class.thy-switch-xs": "size() === \"xs\"", "class.thy-switch-sm": "size() === \"sm\"" }, classAttribute: "thy-switch" }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => ThySwitch), multi: true }], viewQueries: [{ propertyName: "switchElementRef", first: true, predicate: ["switch"], descendants: true, read: ElementRef, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<label #switch class=\"thy-switch\" [ngClass]=\"classNames()\">\n <input\n type=\"checkbox\"\n [attr.tabindex]=\"-1\"\n [disabled]=\"disabled() || thyLoading()\"\n class=\"thy-switch-input\"\n [checked]=\"model()\"\n (change)=\"toggle($event)\" />\n <span class=\"thy-switch-label\" [attr.tabindex]=\"tabIndex\"></span>\n <span class=\"thy-switch-handle\">\n @if (thyLoading()) {\n @let circleConfig = loadingCircle();\n <svg [attr.viewBox]=\"circleConfig?.viewBox\" [class.mb-1]=\"size() === 'xs'\">\n <circle\n class=\"thy-switch-loading\"\n [style.transform-origin]=\"circleConfig?.cx + 'px ' + circleConfig?.cy + 'px'\"\n [attr.cx]=\"circleConfig?.cx\"\n [attr.cy]=\"circleConfig?.cy\"\n [attr.r]=\"circleConfig?.r\"\n [attr.stroke]=\"model() ? 'rgba(102,152,255,1)' : 'rgba(202,202,202,1)'\"\n stroke-width=\"1\"\n [attr.stroke-dasharray]=\"circleConfig?.dasharray\"\n fill=\"white\" />\n </svg>\n }\n </span>\n</label>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
152
117
  }
153
118
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThySwitch, decorators: [{
154
119
  type: Component,
155
- args: [{ selector: 'thy-switch', changeDetection: ChangeDetectionStrategy.OnPush, providers: [
156
- {
157
- provide: NG_VALUE_ACCESSOR,
158
- useExisting: forwardRef(() => ThySwitch),
159
- multi: true
160
- }
161
- ], imports: [NgClass], host: {
162
- class: 'thy-switch',
163
- '[class.thy-switch-xs]': 'size === "xs"',
164
- '[class.thy-switch-sm]': 'size === "sm"'
165
- }, template: "<label #switch class=\"thy-switch\" [ngClass]=\"classNames\">\n <input\n type=\"checkbox\"\n [attr.tabindex]=\"-1\"\n [disabled]=\"disabled || loading\"\n class=\"thy-switch-input\"\n [checked]=\"model\"\n (change)=\"toggle($event)\" />\n <span class=\"thy-switch-label\" [attr.tabindex]=\"tabIndex\"></span>\n <span class=\"thy-switch-handle\">\n @if (loading) {\n <svg [attr.viewBox]=\"loadingCircle?.viewBox\" [class.mb-1]=\"size === 'xs'\">\n <circle\n class=\"thy-switch-loading\"\n [style.transform-origin]=\"loadingCircle?.cx + 'px ' + loadingCircle?.cy + 'px'\"\n [attr.cx]=\"loadingCircle?.cx\"\n [attr.cy]=\"loadingCircle?.cy\"\n [attr.r]=\"loadingCircle?.r\"\n [attr.stroke]=\"model ? 'rgba(102,152,255,1)' : 'rgba(202,202,202,1)'\"\n stroke-width=\"1\"\n [attr.stroke-dasharray]=\"loadingCircle?.dasharray\"\n fill=\"white\" />\n </svg>\n }\n </span>\n</label>\n" }]
166
- }], ctorParameters: () => [], propDecorators: { switchElementRef: [{
167
- type: ViewChild,
168
- args: ['switch', { static: true }]
169
- }], thyType: [{
170
- type: Input
171
- }], thySize: [{
172
- type: Input
173
- }], thyDisabled: [{
174
- type: Input,
175
- args: [{ transform: coerceBooleanProperty }]
176
- }], thyLoading: [{
177
- type: Input,
178
- args: [{ transform: coerceBooleanProperty }]
179
- }], thyChange: [{
180
- type: Output
181
- }] } });
120
+ args: [{ selector: 'thy-switch', changeDetection: ChangeDetectionStrategy.OnPush, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => ThySwitch), multi: true }], imports: [NgClass], host: { class: 'thy-switch', '[class.thy-switch-xs]': 'size() === "xs"', '[class.thy-switch-sm]': 'size() === "sm"' }, template: "<label #switch class=\"thy-switch\" [ngClass]=\"classNames()\">\n <input\n type=\"checkbox\"\n [attr.tabindex]=\"-1\"\n [disabled]=\"disabled() || thyLoading()\"\n class=\"thy-switch-input\"\n [checked]=\"model()\"\n (change)=\"toggle($event)\" />\n <span class=\"thy-switch-label\" [attr.tabindex]=\"tabIndex\"></span>\n <span class=\"thy-switch-handle\">\n @if (thyLoading()) {\n @let circleConfig = loadingCircle();\n <svg [attr.viewBox]=\"circleConfig?.viewBox\" [class.mb-1]=\"size() === 'xs'\">\n <circle\n class=\"thy-switch-loading\"\n [style.transform-origin]=\"circleConfig?.cx + 'px ' + circleConfig?.cy + 'px'\"\n [attr.cx]=\"circleConfig?.cx\"\n [attr.cy]=\"circleConfig?.cy\"\n [attr.r]=\"circleConfig?.r\"\n [attr.stroke]=\"model() ? 'rgba(102,152,255,1)' : 'rgba(202,202,202,1)'\"\n stroke-width=\"1\"\n [attr.stroke-dasharray]=\"circleConfig?.dasharray\"\n fill=\"white\" />\n </svg>\n }\n </span>\n</label>\n" }]
121
+ }], ctorParameters: () => [] });
182
122
 
183
123
  class ThySwitchModule {
184
124
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThySwitchModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }