ngx-tethys 19.0.16 → 19.1.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -11
- package/README.md +0 -1
- package/action/action.component.d.ts +14 -23
- package/action/actions.component.d.ts +5 -7
- package/affix/affix.component.d.ts +9 -13
- package/alert/alert.component.d.ts +1 -1
- package/anchor/anchor-link.component.d.ts +8 -8
- package/anchor/anchor.component.d.ts +15 -21
- package/arrow-switcher/arrow-switcher.component.d.ts +15 -22
- package/autocomplete/autocomplete.component.d.ts +10 -17
- package/autocomplete/autocomplete.trigger.directive.d.ts +10 -18
- package/avatar/avatar-list/avatar-list.component.d.ts +8 -14
- package/avatar/avatar.component.d.ts +25 -39
- package/back-top/back-top.component.d.ts +9 -12
- package/badge/badge.component.d.ts +19 -59
- package/breadcrumb/breadcrumb.component.d.ts +15 -20
- package/button/button-group.component.d.ts +5 -12
- package/button/button-icon.component.d.ts +14 -27
- package/button/button.component.d.ts +17 -26
- package/calendar/calendar-header.component.d.ts +9 -8
- package/calendar/calendar.component.d.ts +16 -16
- package/card/card.component.d.ts +5 -11
- package/card/content.component.d.ts +3 -8
- package/card/header.component.d.ts +7 -8
- package/carousel/carousel.component.d.ts +22 -27
- package/cascader/cascader-li.component.d.ts +13 -21
- package/cascader/cascader-search-option.component.d.ts +8 -16
- package/cascader/cascader.component.d.ts +58 -80
- package/checkbox/checkbox.component.d.ts +2 -5
- package/collapse/collapse-item.component.d.ts +12 -19
- package/collapse/collapse.component.d.ts +6 -12
- package/collapse/collapse.token.d.ts +3 -3
- package/color-picker/color-picker-custom-panel.component.d.ts +5 -5
- package/color-picker/color-picker-panel.component.d.ts +7 -11
- package/color-picker/color-picker.component.d.ts +19 -35
- package/color-picker/parts/alpha/alpha.component.d.ts +8 -8
- package/color-picker/parts/hue/hue.component.d.ts +6 -6
- package/color-picker/parts/indicator/indicator.component.d.ts +4 -3
- package/color-picker/parts/inputs/inputs.component.d.ts +9 -9
- package/color-picker/parts/saturation/saturation.component.d.ts +9 -9
- package/comment/comment.component.d.ts +4 -5
- package/copy/copy.directive.d.ts +8 -9
- package/date-picker/abstract-picker.component.d.ts +8 -7
- package/date-picker/lib/calendar/calendar-footer.component.d.ts +2 -1
- package/date-picker/lib/popups/inner-popup.component.d.ts +2 -1
- package/date-picker/picker.component.d.ts +2 -1
- package/date-range/date-range.component.d.ts +2 -2
- package/dialog/body/dialog-body.component.d.ts +2 -6
- package/dialog/confirm/confirm.component.d.ts +2 -2
- package/dialog/footer/dialog-footer.component.d.ts +6 -9
- package/dialog/header/dialog-header.component.d.ts +9 -11
- package/divider/divider.component.d.ts +12 -16
- package/dot/dot.component.d.ts +5 -13
- package/drag-drop/drag-handle.directive.d.ts +2 -1
- package/drag-drop/drag.directive.d.ts +2 -1
- package/drag-drop/drop-container.directive.d.ts +2 -1
- package/dropdown/dropdown-active.directive.d.ts +4 -5
- package/dropdown/dropdown-menu-item.directive.d.ts +7 -14
- package/dropdown/dropdown-menu.component.d.ts +6 -12
- package/dropdown/dropdown-submenu.component.d.ts +2 -4
- package/dropdown/dropdown.directive.d.ts +14 -24
- package/empty/empty.component.d.ts +21 -27
- package/fesm2022/ngx-tethys-action.mjs +63 -101
- package/fesm2022/ngx-tethys-action.mjs.map +1 -1
- package/fesm2022/ngx-tethys-affix.mjs +40 -41
- package/fesm2022/ngx-tethys-affix.mjs.map +1 -1
- package/fesm2022/ngx-tethys-anchor.mjs +91 -118
- package/fesm2022/ngx-tethys-anchor.mjs.map +1 -1
- package/fesm2022/ngx-tethys-arrow-switcher.mjs +51 -77
- package/fesm2022/ngx-tethys-arrow-switcher.mjs.map +1 -1
- package/fesm2022/ngx-tethys-autocomplete.mjs +69 -103
- package/fesm2022/ngx-tethys-autocomplete.mjs.map +1 -1
- package/fesm2022/ngx-tethys-avatar.mjs +117 -162
- package/fesm2022/ngx-tethys-avatar.mjs.map +1 -1
- package/fesm2022/ngx-tethys-back-top.mjs +33 -46
- package/fesm2022/ngx-tethys-back-top.mjs.map +1 -1
- package/fesm2022/ngx-tethys-badge.mjs +104 -208
- package/fesm2022/ngx-tethys-badge.mjs.map +1 -1
- package/fesm2022/ngx-tethys-breadcrumb.mjs +66 -70
- package/fesm2022/ngx-tethys-breadcrumb.mjs.map +1 -1
- package/fesm2022/ngx-tethys-button.mjs +225 -322
- package/fesm2022/ngx-tethys-button.mjs.map +1 -1
- package/fesm2022/ngx-tethys-calendar.mjs +85 -87
- package/fesm2022/ngx-tethys-calendar.mjs.map +1 -1
- package/fesm2022/ngx-tethys-card.mjs +72 -77
- package/fesm2022/ngx-tethys-card.mjs.map +1 -1
- package/fesm2022/ngx-tethys-carousel.mjs +83 -99
- package/fesm2022/ngx-tethys-carousel.mjs.map +1 -1
- package/fesm2022/ngx-tethys-cascader.mjs +313 -468
- package/fesm2022/ngx-tethys-cascader.mjs.map +1 -1
- package/fesm2022/ngx-tethys-checkbox.mjs +10 -17
- package/fesm2022/ngx-tethys-checkbox.mjs.map +1 -1
- package/fesm2022/ngx-tethys-collapse.mjs +66 -71
- package/fesm2022/ngx-tethys-collapse.mjs.map +1 -1
- package/fesm2022/ngx-tethys-color-picker.mjs +187 -246
- package/fesm2022/ngx-tethys-color-picker.mjs.map +1 -1
- package/fesm2022/ngx-tethys-comment.mjs +16 -10
- package/fesm2022/ngx-tethys-comment.mjs.map +1 -1
- package/fesm2022/ngx-tethys-copy.mjs +25 -28
- package/fesm2022/ngx-tethys-copy.mjs.map +1 -1
- package/fesm2022/ngx-tethys-dialog.mjs +81 -82
- package/fesm2022/ngx-tethys-dialog.mjs.map +1 -1
- package/fesm2022/ngx-tethys-divider.mjs +49 -58
- package/fesm2022/ngx-tethys-divider.mjs.map +1 -1
- package/fesm2022/ngx-tethys-dot.mjs +45 -68
- package/fesm2022/ngx-tethys-dot.mjs.map +1 -1
- package/fesm2022/ngx-tethys-dropdown.mjs +155 -203
- package/fesm2022/ngx-tethys-dropdown.mjs.map +1 -1
- package/fesm2022/ngx-tethys-empty.mjs +107 -95
- package/fesm2022/ngx-tethys-empty.mjs.map +1 -1
- package/fesm2022/ngx-tethys-flexible-text.mjs +67 -86
- package/fesm2022/ngx-tethys-flexible-text.mjs.map +1 -1
- package/fesm2022/ngx-tethys-form.mjs +161 -200
- package/fesm2022/ngx-tethys-form.mjs.map +1 -1
- package/fesm2022/ngx-tethys-fullscreen.mjs +21 -23
- package/fesm2022/ngx-tethys-fullscreen.mjs.map +1 -1
- package/fesm2022/ngx-tethys-grid.mjs +161 -158
- package/fesm2022/ngx-tethys-grid.mjs.map +1 -1
- package/fesm2022/ngx-tethys-i18n.mjs +25 -25
- package/fesm2022/ngx-tethys-i18n.mjs.map +1 -1
- package/fesm2022/ngx-tethys-icon.mjs +44 -59
- package/fesm2022/ngx-tethys-icon.mjs.map +1 -1
- package/fesm2022/ngx-tethys-image.mjs +40 -36
- package/fesm2022/ngx-tethys-image.mjs.map +1 -1
- package/fesm2022/ngx-tethys-input-number.mjs +101 -114
- package/fesm2022/ngx-tethys-input-number.mjs.map +1 -1
- package/fesm2022/ngx-tethys-input.mjs +268 -271
- package/fesm2022/ngx-tethys-input.mjs.map +1 -1
- package/fesm2022/ngx-tethys-list.mjs +1 -1
- package/fesm2022/ngx-tethys-list.mjs.map +1 -1
- package/fesm2022/ngx-tethys-loading.mjs +17 -35
- package/fesm2022/ngx-tethys-loading.mjs.map +1 -1
- package/fesm2022/ngx-tethys-mention.mjs +52 -74
- package/fesm2022/ngx-tethys-mention.mjs.map +1 -1
- package/fesm2022/ngx-tethys-menu.mjs +106 -179
- package/fesm2022/ngx-tethys-menu.mjs.map +1 -1
- package/fesm2022/ngx-tethys-nav.mjs +169 -201
- package/fesm2022/ngx-tethys-nav.mjs.map +1 -1
- package/fesm2022/ngx-tethys-pagination.mjs +230 -294
- package/fesm2022/ngx-tethys-pagination.mjs.map +1 -1
- package/fesm2022/ngx-tethys-popover.mjs +67 -70
- package/fesm2022/ngx-tethys-popover.mjs.map +1 -1
- package/fesm2022/ngx-tethys-progress.mjs +194 -246
- package/fesm2022/ngx-tethys-progress.mjs.map +1 -1
- package/fesm2022/ngx-tethys-property.mjs +99 -113
- package/fesm2022/ngx-tethys-property.mjs.map +1 -1
- package/fesm2022/ngx-tethys-radio.mjs +60 -76
- package/fesm2022/ngx-tethys-radio.mjs.map +1 -1
- package/fesm2022/ngx-tethys-rate.mjs +115 -157
- package/fesm2022/ngx-tethys-rate.mjs.map +1 -1
- package/fesm2022/ngx-tethys-resizable.mjs +111 -157
- package/fesm2022/ngx-tethys-resizable.mjs.map +1 -1
- package/fesm2022/ngx-tethys-result.mjs +46 -28
- package/fesm2022/ngx-tethys-result.mjs.map +1 -1
- package/fesm2022/ngx-tethys-segment.mjs +84 -103
- package/fesm2022/ngx-tethys-segment.mjs.map +1 -1
- package/fesm2022/ngx-tethys-skeleton.mjs +339 -342
- package/fesm2022/ngx-tethys-skeleton.mjs.map +1 -1
- package/fesm2022/ngx-tethys-slide.mjs +37 -56
- package/fesm2022/ngx-tethys-slide.mjs.map +1 -1
- package/fesm2022/ngx-tethys-slider.mjs +75 -108
- package/fesm2022/ngx-tethys-slider.mjs.map +1 -1
- package/fesm2022/ngx-tethys-space.mjs +25 -51
- package/fesm2022/ngx-tethys-space.mjs.map +1 -1
- package/fesm2022/ngx-tethys-statistic.mjs +114 -151
- package/fesm2022/ngx-tethys-statistic.mjs.map +1 -1
- package/fesm2022/ngx-tethys-stepper.mjs +74 -107
- package/fesm2022/ngx-tethys-stepper.mjs.map +1 -1
- package/fesm2022/ngx-tethys-strength.mjs +52 -66
- package/fesm2022/ngx-tethys-strength.mjs.map +1 -1
- package/fesm2022/ngx-tethys-switch.mjs +80 -140
- package/fesm2022/ngx-tethys-switch.mjs.map +1 -1
- package/fesm2022/ngx-tethys-table.mjs +1 -1
- package/fesm2022/ngx-tethys-table.mjs.map +1 -1
- package/fesm2022/ngx-tethys-tabs.mjs +69 -87
- package/fesm2022/ngx-tethys-tabs.mjs.map +1 -1
- package/fesm2022/ngx-tethys-tag.mjs +42 -64
- package/fesm2022/ngx-tethys-tag.mjs.map +1 -1
- package/fesm2022/ngx-tethys-timeline.mjs +104 -129
- package/fesm2022/ngx-tethys-timeline.mjs.map +1 -1
- package/fesm2022/ngx-tethys-transfer.mjs +98 -119
- package/fesm2022/ngx-tethys-transfer.mjs.map +1 -1
- package/fesm2022/ngx-tethys-tree-select.mjs +2 -4
- package/fesm2022/ngx-tethys-tree-select.mjs.map +1 -1
- package/fesm2022/ngx-tethys-tree.mjs +281 -401
- package/fesm2022/ngx-tethys-tree.mjs.map +1 -1
- package/fesm2022/ngx-tethys-typography.mjs +36 -33
- package/fesm2022/ngx-tethys-typography.mjs.map +1 -1
- package/fesm2022/ngx-tethys-upload.mjs +93 -132
- package/fesm2022/ngx-tethys-upload.mjs.map +1 -1
- package/fesm2022/ngx-tethys-util.mjs.map +1 -1
- package/fesm2022/ngx-tethys-vote.mjs +53 -99
- package/fesm2022/ngx-tethys-vote.mjs.map +1 -1
- package/fesm2022/ngx-tethys-watermark.mjs +36 -40
- package/fesm2022/ngx-tethys-watermark.mjs.map +1 -1
- package/fesm2022/ngx-tethys.mjs +1 -1
- package/fesm2022/ngx-tethys.mjs.map +1 -1
- package/flexible-text/flexible-text.component.d.ts +9 -15
- package/form/form-group-error/form-group-error.component.d.ts +2 -3
- package/form/form-group-label.directive.d.ts +2 -1
- package/form/form-group.component.d.ts +17 -24
- package/form/form-submit.directive.d.ts +2 -2
- package/form/form.directive.d.ts +6 -8
- package/form/from-group-footer/form-group-footer.component.d.ts +2 -2
- package/form/validator/confirm-validator.directive.d.ts +2 -2
- package/form/validator/unique-validator.directive.d.ts +2 -2
- package/fullscreen/fullscreen.component.d.ts +7 -7
- package/grid/flex.d.ts +13 -20
- package/grid/thy-col.directive.d.ts +6 -9
- package/grid/thy-grid-item.component.d.ts +3 -4
- package/grid/thy-grid.component.d.ts +11 -12
- package/grid/thy-row.directive.d.ts +11 -14
- package/icon/icon.component.d.ts +10 -17
- package/image/image.directive.d.ts +10 -12
- package/image/image.token.d.ts +5 -5
- package/input/input-count.component.d.ts +4 -5
- package/input/input-group.component.d.ts +20 -20
- package/input/input-search.component.d.ts +15 -20
- package/input/input.component.d.ts +20 -21
- package/input/input.directive.d.ts +4 -6
- package/input-number/input-number.component.d.ts +21 -29
- package/layout/header.component.d.ts +4 -9
- package/layout/sidebar-header.component.d.ts +2 -1
- package/layout/sidebar.component.d.ts +8 -7
- package/list/list.component.d.ts +2 -1
- package/list/selection/selection-list.d.ts +4 -3
- package/loading/loading.component.d.ts +4 -10
- package/mention/mention.directive.d.ts +6 -7
- package/mention/suggestions/suggestions.component.d.ts +8 -9
- package/menu/group/menu-group.component.d.ts +16 -33
- package/menu/item/action/menu-item-action.component.d.ts +7 -8
- package/menu/item/icon/menu-item-icon.component.d.ts +2 -2
- package/menu/item/menu-item.component.d.ts +4 -4
- package/menu/item/name/menu-item-name.component.d.ts +2 -3
- package/menu/menu.component.d.ts +3 -7
- package/nav/icon-nav/icon-nav-link.directive.d.ts +3 -7
- package/nav/icon-nav/icon-nav.component.d.ts +3 -8
- package/nav/nav-ink-bar.directive.d.ts +4 -6
- package/nav/nav-item.directive.d.ts +7 -10
- package/nav/nav.component.d.ts +20 -48
- package/package.json +1 -1
- package/pagination/pagination.component.d.ts +48 -109
- package/popover/header/popover-header.component.d.ts +7 -6
- package/popover/popover.directive.d.ts +11 -18
- package/progress/progress-circle.component.d.ts +35 -26
- package/progress/progress-strip.component.d.ts +10 -14
- package/progress/progress.component.d.ts +16 -26
- package/property/examples/single/single.component.scss +6 -0
- package/property/properties.component.d.ts +6 -15
- package/property/property-item.component.d.ts +22 -34
- package/property/styles/properties.scss +124 -52
- package/property-operation/property-operation.component.d.ts +6 -5
- package/radio/button/radio-button.component.d.ts +2 -2
- package/radio/group/radio-group.component.d.ts +13 -16
- package/radio/radio.component.d.ts +2 -2
- package/radio/radio.token.d.ts +2 -2
- package/rate/rate-item.component.d.ts +8 -10
- package/rate/rate.component.d.ts +20 -30
- package/resizable/resizable.directive.d.ts +18 -36
- package/resizable/resize-handle.component.d.ts +6 -6
- package/resizable/resize-handles.component.d.ts +5 -8
- package/result/result.component.d.ts +9 -10
- package/schematics/version.d.ts +1 -1
- package/schematics/version.js +1 -1
- package/segment/segment-item.component.d.ts +9 -14
- package/segment/segment.component.d.ts +11 -14
- package/segment/segment.token.d.ts +4 -3
- package/select/custom-select/custom-select.component.d.ts +11 -10
- package/select/native-select/native-select.component.d.ts +2 -1
- package/shared/base-form-check.component.d.ts +3 -2
- package/shared/directives/thy-autofocus.directive.d.ts +3 -2
- package/shared/directives/thy-scroll.directive.d.ts +2 -1
- package/shared/directives/thy-show.d.ts +2 -1
- package/shared/option/group/option-group.component.d.ts +2 -1
- package/shared/option/list-option/list-option.component.d.ts +2 -7
- package/shared/option/option.component.d.ts +2 -1
- package/shared/select/select-control/select-control.component.d.ts +7 -6
- package/skeleton/skeleton-circle.component.d.ts +16 -19
- package/skeleton/skeleton-rectangle.component.d.ts +20 -23
- package/skeleton/skeleton.component.d.ts +5 -6
- package/skeleton/stylized/bullet-list.component.d.ts +11 -13
- package/skeleton/stylized/list.component.d.ts +10 -12
- package/skeleton/stylized/paragraph.component.d.ts +12 -14
- package/slide/slide-body/slide-body-section.component.d.ts +2 -5
- package/slide/slide-header/slide-header.component.d.ts +6 -9
- package/slider/slider.component.d.ts +17 -24
- package/space/space.component.d.ts +10 -16
- package/statistic/statistic.component.d.ts +35 -40
- package/stepper/step-header.component.d.ts +6 -10
- package/stepper/step.component.d.ts +6 -6
- package/stepper/stepper.component.d.ts +15 -20
- package/strength/strength.component.d.ts +8 -13
- package/switch/switch.component.d.ts +24 -35
- package/table/table-column.component.d.ts +6 -5
- package/table/table-skeleton.component.d.ts +3 -10
- package/table/table.component.d.ts +11 -10
- package/tabs/tab-content.component.d.ts +4 -4
- package/tabs/tab.component.d.ts +4 -5
- package/tabs/tabs.component.d.ts +13 -15
- package/tag/tag.component.d.ts +10 -16
- package/time-picker/time-picker-panel.component.d.ts +3 -2
- package/time-picker/time-picker.component.d.ts +6 -5
- package/timeline/timeline-item.component.d.ts +9 -13
- package/timeline/timeline.component.d.ts +13 -17
- package/tooltip/tooltip.directive.d.ts +3 -2
- package/transfer/transfer-list.component.d.ts +15 -15
- package/transfer/transfer.component.d.ts +20 -23
- package/tree/tree-abstract.d.ts +5 -5
- package/tree/tree-node.component.d.ts +24 -46
- package/tree/tree.class.d.ts +4 -4
- package/tree/tree.component.d.ts +47 -74
- package/tree/tree.service.d.ts +3 -4
- package/tree-select/tree-select.component.d.ts +10 -9
- package/typography/bg-color.directive.d.ts +3 -3
- package/typography/text/text.component.d.ts +2 -2
- package/typography/text-color.directive.d.ts +3 -3
- package/upload/file-drop.directive.d.ts +9 -11
- package/upload/file-select-base.d.ts +6 -10
- package/upload/file-select.component.d.ts +10 -20
- package/util/helpers/helpers.d.ts +2 -1
- package/vote/vote.component.d.ts +13 -32
- package/watermark/watermark.directive.d.ts +7 -9
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NgClass, CommonModule } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import {
|
|
3
|
+
import { input, effect, ViewEncapsulation, Component, computed, ChangeDetectionStrategy, inject, ElementRef, Renderer2, afterNextRender, NgModule } from '@angular/core';
|
|
4
4
|
import { ThyIcon, ThyIconModule } from 'ngx-tethys/icon';
|
|
5
5
|
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
6
6
|
import { useHostRenderer } from '@tethys/cdk/dom';
|
|
@@ -18,78 +18,56 @@ const buttonGroupSizeMap = {
|
|
|
18
18
|
* @order 30
|
|
19
19
|
*/
|
|
20
20
|
class ThyButtonGroup {
|
|
21
|
-
/**
|
|
22
|
-
* 大小
|
|
23
|
-
* @type xs | sm | md | lg
|
|
24
|
-
* @default md
|
|
25
|
-
*/
|
|
26
|
-
set thySize(size) {
|
|
27
|
-
this.size = size;
|
|
28
|
-
if (this.initialized) {
|
|
29
|
-
this.setClasses();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* 类型
|
|
34
|
-
* @type outline-default | outline-primary
|
|
35
|
-
* @default outline-default
|
|
36
|
-
*/
|
|
37
|
-
set thyType(type) {
|
|
38
|
-
this.type = type;
|
|
39
|
-
if (this.initialized) {
|
|
40
|
-
this.setClasses();
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* 是否需要最小宽度,默认按钮最小宽度为80px
|
|
45
|
-
* @default false
|
|
46
|
-
*/
|
|
47
|
-
set thyClearMinWidth(value) {
|
|
48
|
-
this.thyClearMinWidthClassName = coerceBooleanProperty(value);
|
|
49
|
-
}
|
|
50
21
|
constructor() {
|
|
51
|
-
this.initialized = false;
|
|
52
22
|
this.hostRenderer = useHostRenderer();
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
this.
|
|
23
|
+
/**
|
|
24
|
+
* 大小
|
|
25
|
+
* @type xs | sm | md | lg
|
|
26
|
+
* @default md
|
|
27
|
+
*/
|
|
28
|
+
this.thySize = input();
|
|
29
|
+
/**
|
|
30
|
+
* 类型
|
|
31
|
+
* @type outline-default | outline-primary
|
|
32
|
+
* @default outline-default
|
|
33
|
+
*/
|
|
34
|
+
this.thyType = input();
|
|
35
|
+
/**
|
|
36
|
+
* 是否需要最小宽度,默认按钮最小宽度为80px
|
|
37
|
+
* @default false
|
|
38
|
+
*/
|
|
39
|
+
this.thyClearMinWidth = input(false, { transform: coerceBooleanProperty });
|
|
40
|
+
effect(() => {
|
|
41
|
+
this.setClasses();
|
|
42
|
+
});
|
|
59
43
|
}
|
|
60
44
|
setClasses() {
|
|
45
|
+
const type = this.thyType();
|
|
46
|
+
const size = this.thySize();
|
|
61
47
|
let classNames = [];
|
|
62
|
-
if (
|
|
63
|
-
classNames.push(`btn-group-${
|
|
48
|
+
if (type) {
|
|
49
|
+
classNames.push(`btn-group-${type}`);
|
|
64
50
|
}
|
|
65
|
-
if (buttonGroupSizeMap[
|
|
66
|
-
classNames.
|
|
51
|
+
if (buttonGroupSizeMap[size]) {
|
|
52
|
+
classNames = classNames.concat(...buttonGroupSizeMap[size]);
|
|
67
53
|
}
|
|
68
54
|
this.hostRenderer.updateClass(classNames);
|
|
69
55
|
}
|
|
70
56
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyButtonGroup, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
71
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
57
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.8", type: ThyButtonGroup, isStandalone: true, selector: "thy-button-group", inputs: { thySize: { classPropertyName: "thySize", publicName: "thySize", isSignal: true, isRequired: false, transformFunction: null }, thyType: { classPropertyName: "thyType", publicName: "thyType", isSignal: true, isRequired: false, transformFunction: null }, thyClearMinWidth: { classPropertyName: "thyClearMinWidth", publicName: "thyClearMinWidth", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.btn-group-clear-min-width": "thyClearMinWidth()" }, classAttribute: "btn-group" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true, encapsulation: i0.ViewEncapsulation.None }); }
|
|
72
58
|
}
|
|
73
59
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyButtonGroup, decorators: [{
|
|
74
60
|
type: Component,
|
|
75
61
|
args: [{
|
|
76
62
|
selector: 'thy-button-group',
|
|
77
63
|
template: '<ng-content></ng-content>',
|
|
64
|
+
host: {
|
|
65
|
+
class: 'btn-group',
|
|
66
|
+
'[class.btn-group-clear-min-width]': 'thyClearMinWidth()'
|
|
67
|
+
},
|
|
78
68
|
encapsulation: ViewEncapsulation.None
|
|
79
69
|
}]
|
|
80
|
-
}], ctorParameters: () => []
|
|
81
|
-
type: Input
|
|
82
|
-
}], thyType: [{
|
|
83
|
-
type: Input
|
|
84
|
-
}], thyClearMinWidth: [{
|
|
85
|
-
type: Input
|
|
86
|
-
}], _isButtonGroup: [{
|
|
87
|
-
type: HostBinding,
|
|
88
|
-
args: ['class.btn-group']
|
|
89
|
-
}], thyClearMinWidthClassName: [{
|
|
90
|
-
type: HostBinding,
|
|
91
|
-
args: [`class.btn-group-clear-min-width`]
|
|
92
|
-
}] } });
|
|
70
|
+
}], ctorParameters: () => [] });
|
|
93
71
|
|
|
94
72
|
const sizeClassesMap = {
|
|
95
73
|
lg: ['btn-icon-lg'],
|
|
@@ -113,143 +91,97 @@ const themeClassesMap = {
|
|
|
113
91
|
* @order 20
|
|
114
92
|
*/
|
|
115
93
|
class ThyButtonIcon {
|
|
116
|
-
/**
|
|
117
|
-
* 大小
|
|
118
|
-
* @type xs | sm | md | lg
|
|
119
|
-
* @default 36px
|
|
120
|
-
*/
|
|
121
|
-
set thySize(size) {
|
|
122
|
-
this.size = size;
|
|
123
|
-
this.setClasses();
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* 图标, 和`thyButtonIcon`相同,当使用`thy-button-icon`时,只能使用 thyIcon 设置图标
|
|
127
|
-
*/
|
|
128
|
-
set thyIcon(icon) {
|
|
129
|
-
this.setIconClass(icon);
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* 图标按钮的图标
|
|
133
|
-
*/
|
|
134
|
-
set thyButtonIcon(icon) {
|
|
135
|
-
this.setIconClass(icon);
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* 展示的形状,默认只显示字体图标图标,circle-dashed, circle-solid 展示成虚线,实线边框圆形图标, circle-thick-dashed, circle-thick-solid 边框加粗
|
|
139
|
-
*/
|
|
140
|
-
set thyShape(value) {
|
|
141
|
-
this.shape = value;
|
|
142
|
-
this.setClasses();
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* 亮色,颜色更浅,适合左侧导航顶部的按钮
|
|
146
|
-
* @default false
|
|
147
|
-
*/
|
|
148
|
-
set thyLight(value) {
|
|
149
|
-
this._isLighted = value;
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* 设置为选中状态
|
|
153
|
-
* @default false
|
|
154
|
-
*/
|
|
155
|
-
set thyActive(value) {
|
|
156
|
-
this._isActive = value;
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* 按钮展示类型,默认图标移上去显示主色, danger-weak 鼠标移上去显示 danger 红色
|
|
160
|
-
*/
|
|
161
|
-
set thyTheme(value) {
|
|
162
|
-
this.theme = value;
|
|
163
|
-
this.setClasses();
|
|
164
|
-
}
|
|
165
94
|
constructor() {
|
|
166
|
-
|
|
95
|
+
/**
|
|
96
|
+
* 大小
|
|
97
|
+
* @type xs | sm | md | lg
|
|
98
|
+
* @default 36px
|
|
99
|
+
*/
|
|
100
|
+
this.thySize = input();
|
|
101
|
+
/**
|
|
102
|
+
* 图标, 和`thyButtonIcon`相同,当使用`thy-button-icon`时,只能使用 thyIcon 设置图标
|
|
103
|
+
*/
|
|
104
|
+
this.thyIcon = input();
|
|
105
|
+
/**
|
|
106
|
+
* 图标按钮的图标
|
|
107
|
+
*/
|
|
108
|
+
this.thyButtonIcon = input();
|
|
109
|
+
/**
|
|
110
|
+
* 展示的形状,默认只显示字体图标图标,circle-dashed, circle-solid 展示成虚线,实线边框圆形图标, circle-thick-dashed, circle-thick-solid 边框加粗
|
|
111
|
+
*/
|
|
112
|
+
this.thyShape = input();
|
|
113
|
+
/**
|
|
114
|
+
* 亮色,颜色更浅,适合左侧导航顶部的按钮
|
|
115
|
+
* @default false
|
|
116
|
+
*/
|
|
117
|
+
this.thyLight = input(false, { transform: coerceBooleanProperty$1 });
|
|
118
|
+
/**
|
|
119
|
+
* 设置为选中状态
|
|
120
|
+
* @default false
|
|
121
|
+
*/
|
|
122
|
+
this.thyActive = input(false, { transform: coerceBooleanProperty$1 });
|
|
123
|
+
/**
|
|
124
|
+
* 按钮展示类型,默认图标移上去显示主色, danger-weak 鼠标移上去显示 danger 红色
|
|
125
|
+
*/
|
|
126
|
+
this.thyTheme = input();
|
|
127
|
+
this.thyColor = input();
|
|
167
128
|
this.hostRenderer = useHostRenderer();
|
|
168
|
-
this.
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
this.
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
if (
|
|
129
|
+
this.icon = computed(() => {
|
|
130
|
+
return this.thyButtonIcon() || this.thyIcon();
|
|
131
|
+
});
|
|
132
|
+
this.isWtfIcon = computed(() => {
|
|
133
|
+
const icon = this.icon();
|
|
134
|
+
return icon && icon.includes('wtf');
|
|
135
|
+
});
|
|
136
|
+
this.svgIconName = computed(() => {
|
|
137
|
+
if (!this.isWtfIcon()) {
|
|
138
|
+
return this.icon();
|
|
139
|
+
}
|
|
140
|
+
return null;
|
|
141
|
+
});
|
|
142
|
+
this.iconClasses = computed(() => {
|
|
143
|
+
const icon = this.icon();
|
|
144
|
+
if (this.isWtfIcon()) {
|
|
177
145
|
const classes = icon.split(' ');
|
|
178
146
|
if (classes.length === 1) {
|
|
179
147
|
classes.unshift('wtf');
|
|
180
148
|
}
|
|
181
|
-
|
|
182
|
-
this.svgIconName = null;
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
this.svgIconName = icon;
|
|
149
|
+
return classes;
|
|
186
150
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
this.
|
|
191
|
-
}
|
|
151
|
+
return null;
|
|
152
|
+
});
|
|
153
|
+
effect(() => {
|
|
154
|
+
this.setClasses();
|
|
155
|
+
});
|
|
192
156
|
}
|
|
193
|
-
setClasses(
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
if (this.shape && shapeClassesMap[this.shape]) {
|
|
201
|
-
shapeClassesMap[this.shape].forEach((className) => {
|
|
157
|
+
setClasses() {
|
|
158
|
+
const size = this.thySize();
|
|
159
|
+
const shape = this.thyShape();
|
|
160
|
+
const theme = this.thyTheme();
|
|
161
|
+
const classes = sizeClassesMap[size] ? [...sizeClassesMap[size]] : [];
|
|
162
|
+
if (shape && shapeClassesMap[shape]) {
|
|
163
|
+
shapeClassesMap[shape].forEach((className) => {
|
|
202
164
|
classes.push(className);
|
|
203
165
|
});
|
|
204
166
|
}
|
|
205
|
-
if (
|
|
206
|
-
themeClassesMap[
|
|
167
|
+
if (theme && themeClassesMap[theme]) {
|
|
168
|
+
themeClassesMap[theme].forEach((className) => {
|
|
207
169
|
classes.push(className);
|
|
208
170
|
});
|
|
209
171
|
}
|
|
210
172
|
this.hostRenderer.updateClass(classes);
|
|
211
173
|
}
|
|
212
|
-
ngOnInit() {
|
|
213
|
-
this.setClasses(true);
|
|
214
|
-
this.initialized = true;
|
|
215
|
-
}
|
|
216
174
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyButtonIcon, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
217
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyButtonIcon, isStandalone: true, selector: "thy-button-icon,[thy-button-icon],[thyButtonIcon]", inputs: { thySize: "thySize", thyIcon: "thyIcon", thyButtonIcon: "thyButtonIcon", thyShape: "thyShape", thyLight:
|
|
175
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyButtonIcon, isStandalone: true, selector: "thy-button-icon,[thy-button-icon],[thyButtonIcon]", inputs: { thySize: { classPropertyName: "thySize", publicName: "thySize", isSignal: true, isRequired: false, transformFunction: null }, thyIcon: { classPropertyName: "thyIcon", publicName: "thyIcon", isSignal: true, isRequired: false, transformFunction: null }, thyButtonIcon: { classPropertyName: "thyButtonIcon", publicName: "thyButtonIcon", isSignal: true, isRequired: false, transformFunction: null }, thyShape: { classPropertyName: "thyShape", publicName: "thyShape", isSignal: true, isRequired: false, transformFunction: null }, thyLight: { classPropertyName: "thyLight", publicName: "thyLight", isSignal: true, isRequired: false, transformFunction: null }, thyActive: { classPropertyName: "thyActive", publicName: "thyActive", isSignal: true, isRequired: false, transformFunction: null }, thyTheme: { classPropertyName: "thyTheme", publicName: "thyTheme", isSignal: true, isRequired: false, transformFunction: null }, thyColor: { classPropertyName: "thyColor", publicName: "thyColor", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.btn-icon-light": "thyLight()", "class.btn-icon-active": "thyActive()" }, classAttribute: "btn btn-icon" }, ngImport: i0, template: "@if (svgIconName()) {\n <thy-icon [thyIconName]=\"svgIconName()\" [style.color]=\"thyColor()\" [style.borderColor]=\"thyColor()\"></thy-icon>\n} @else {\n @if (iconClasses()) {\n <i [ngClass]=\"iconClasses()\" [style.color]=\"thyColor()\" [style.borderColor]=\"thyColor()\"></i>\n }\n}\n<ng-content></ng-content>\n", dependencies: [{ kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
218
176
|
}
|
|
219
177
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyButtonIcon, decorators: [{
|
|
220
178
|
type: Component,
|
|
221
|
-
args: [{ selector: 'thy-button-icon,[thy-button-icon],[thyButtonIcon]', encapsulation: ViewEncapsulation.None,
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
type: Input
|
|
228
|
-
}], thyShape: [{
|
|
229
|
-
type: Input
|
|
230
|
-
}], thyLight: [{
|
|
231
|
-
type: Input,
|
|
232
|
-
args: [{ transform: coerceBooleanProperty$1 }]
|
|
233
|
-
}], thyActive: [{
|
|
234
|
-
type: Input,
|
|
235
|
-
args: [{ transform: coerceBooleanProperty$1 }]
|
|
236
|
-
}], thyTheme: [{
|
|
237
|
-
type: Input
|
|
238
|
-
}], _isBtn: [{
|
|
239
|
-
type: HostBinding,
|
|
240
|
-
args: ['class.btn']
|
|
241
|
-
}], _isBtnIcon: [{
|
|
242
|
-
type: HostBinding,
|
|
243
|
-
args: ['class.btn-icon']
|
|
244
|
-
}], _isLighted: [{
|
|
245
|
-
type: HostBinding,
|
|
246
|
-
args: ['class.btn-icon-light']
|
|
247
|
-
}], _isActive: [{
|
|
248
|
-
type: HostBinding,
|
|
249
|
-
args: ['class.btn-icon-active']
|
|
250
|
-
}], thyColor: [{
|
|
251
|
-
type: Input
|
|
252
|
-
}] } });
|
|
179
|
+
args: [{ selector: 'thy-button-icon,[thy-button-icon],[thyButtonIcon]', encapsulation: ViewEncapsulation.None, host: {
|
|
180
|
+
class: 'btn btn-icon',
|
|
181
|
+
'[class.btn-icon-light]': 'thyLight()',
|
|
182
|
+
'[class.btn-icon-active]': 'thyActive()'
|
|
183
|
+
}, changeDetection: ChangeDetectionStrategy.OnPush, imports: [ThyIcon, NgClass], template: "@if (svgIconName()) {\n <thy-icon [thyIconName]=\"svgIconName()\" [style.color]=\"thyColor()\" [style.borderColor]=\"thyColor()\"></thy-icon>\n} @else {\n @if (iconClasses()) {\n <i [ngClass]=\"iconClasses()\" [style.color]=\"thyColor()\" [style.borderColor]=\"thyColor()\"></i>\n }\n}\n<ng-content></ng-content>\n" }]
|
|
184
|
+
}], ctorParameters: () => [] });
|
|
253
185
|
|
|
254
186
|
const btnTypeClassesMap = {
|
|
255
187
|
primary: ['btn-primary'],
|
|
@@ -273,153 +205,142 @@ const iconOnlyClass = 'thy-btn-icon-only';
|
|
|
273
205
|
* @order 10
|
|
274
206
|
*/
|
|
275
207
|
class ThyButton {
|
|
276
|
-
constructor() {
|
|
277
|
-
this.elementRef = inject(ElementRef);
|
|
278
|
-
this.renderer = inject(Renderer2);
|
|
279
|
-
this._initialized = false;
|
|
280
|
-
// 圆角方形
|
|
281
|
-
this._isRadiusSquare = false;
|
|
282
|
-
this.hostRenderer = useHostRenderer();
|
|
283
|
-
}
|
|
284
208
|
get nativeElement() {
|
|
285
209
|
return this.elementRef.nativeElement;
|
|
286
210
|
}
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
* @type primary | info | warning | danger | success
|
|
290
|
-
* @default primary
|
|
291
|
-
*/
|
|
292
|
-
set thyButton(value) {
|
|
293
|
-
this.setBtnType(value);
|
|
294
|
-
}
|
|
295
|
-
/**
|
|
296
|
-
* 和`thyButton`参数一样,一般使用`thyButton`,为了减少参数输入, 当通过`thy-button`使用时,只能使用该参数控制类型
|
|
297
|
-
* @default primary
|
|
298
|
-
*/
|
|
299
|
-
set thyType(value) {
|
|
300
|
-
this.setBtnType(value);
|
|
301
|
-
}
|
|
302
|
-
/**
|
|
303
|
-
* 加载状态
|
|
304
|
-
* @default false
|
|
305
|
-
*/
|
|
306
|
-
set thyLoading(value) {
|
|
307
|
-
if (!this._loading && value) {
|
|
308
|
-
this._loading = value;
|
|
309
|
-
const textElement = this.nativeElement.querySelector('span');
|
|
310
|
-
this._originalText = textElement ? textElement.innerText : '';
|
|
311
|
-
this.setLoadingStatus();
|
|
312
|
-
}
|
|
313
|
-
else {
|
|
314
|
-
this._loading = value;
|
|
315
|
-
this.setLoadingStatus();
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
/**
|
|
319
|
-
* 加载状态时显示的文案
|
|
320
|
-
*/
|
|
321
|
-
set thyLoadingText(value) {
|
|
322
|
-
if (this._loadingText !== value) {
|
|
323
|
-
this._loadingText = value;
|
|
324
|
-
if (this._loading) {
|
|
325
|
-
this.setLoadingText(this._loadingText);
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* 按钮大小
|
|
331
|
-
* @type xs | sm | md | default | lg
|
|
332
|
-
* @default default
|
|
333
|
-
*/
|
|
334
|
-
set thySize(size) {
|
|
335
|
-
this._size = size;
|
|
336
|
-
if (this._initialized) {
|
|
337
|
-
this.updateClasses();
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
/**
|
|
341
|
-
* 按钮中显示的图标,支持SVG图标名称,比如`angle-left`,也支持传之前的 wtf 字体,比如: wtf-plus
|
|
342
|
-
*/
|
|
343
|
-
set thyIcon(icon) {
|
|
344
|
-
this._icon = icon;
|
|
345
|
-
if (this._icon) {
|
|
346
|
-
if (icon.includes('wtf')) {
|
|
347
|
-
const classes = this._icon.split(' ');
|
|
348
|
-
if (classes.length === 1) {
|
|
349
|
-
classes.unshift('wtf');
|
|
350
|
-
}
|
|
351
|
-
this.iconClass = classes;
|
|
352
|
-
this.svgIconName = null;
|
|
353
|
-
}
|
|
354
|
-
else {
|
|
355
|
-
this.svgIconName = icon;
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
else {
|
|
359
|
-
this.iconClass = null;
|
|
360
|
-
this.svgIconName = null;
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
setBtnType(value) {
|
|
364
|
-
if (value) {
|
|
365
|
-
if (value.includes('-square')) {
|
|
366
|
-
this._type = value.replace('-square', '');
|
|
367
|
-
this._isRadiusSquare = true;
|
|
368
|
-
}
|
|
369
|
-
else {
|
|
370
|
-
this._type = value;
|
|
371
|
-
}
|
|
372
|
-
if (this._initialized) {
|
|
373
|
-
this.updateClasses();
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
setLoadingText(text) {
|
|
211
|
+
setButtonText() {
|
|
212
|
+
const text = this.thyLoading() ? this.thyLoadingText() : this._originalText;
|
|
378
213
|
const spanElement = this.nativeElement.querySelector('span');
|
|
379
|
-
if (spanElement) {
|
|
214
|
+
if (spanElement && text) {
|
|
380
215
|
this.renderer.setProperty(spanElement, 'innerText', text);
|
|
381
216
|
}
|
|
382
217
|
}
|
|
383
|
-
setLoadingStatus() {
|
|
384
|
-
const innerText = this._loading ? this._loadingText : this._originalText;
|
|
385
|
-
this.updateClasses();
|
|
386
|
-
if (innerText) {
|
|
387
|
-
this.setLoadingText(innerText);
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
218
|
updateClasses() {
|
|
219
|
+
const type = this.type();
|
|
220
|
+
if (!type) {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
391
223
|
let classNames = [];
|
|
392
|
-
if (btnTypeClassesMap[
|
|
393
|
-
classNames = [...btnTypeClassesMap[
|
|
224
|
+
if (btnTypeClassesMap[type]) {
|
|
225
|
+
classNames = [...btnTypeClassesMap[type]];
|
|
394
226
|
}
|
|
395
227
|
else {
|
|
396
|
-
if (
|
|
397
|
-
classNames.push(`btn-${
|
|
228
|
+
if (type) {
|
|
229
|
+
classNames.push(`btn-${type}`);
|
|
398
230
|
}
|
|
399
231
|
}
|
|
400
|
-
|
|
401
|
-
|
|
232
|
+
const size = this.thySize();
|
|
233
|
+
if (size) {
|
|
234
|
+
classNames.push(`btn-${size}`);
|
|
402
235
|
}
|
|
403
|
-
if (this.
|
|
236
|
+
if (this.isRadiusSquare()) {
|
|
404
237
|
classNames.push('btn-square');
|
|
405
238
|
}
|
|
406
|
-
|
|
239
|
+
const loading = this.thyLoading();
|
|
240
|
+
if (loading) {
|
|
407
241
|
classNames.push('loading');
|
|
408
242
|
}
|
|
409
243
|
this.hostRenderer.updateClass(classNames);
|
|
410
244
|
}
|
|
411
|
-
|
|
412
|
-
this.
|
|
413
|
-
this.
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
245
|
+
constructor() {
|
|
246
|
+
this.elementRef = inject(ElementRef);
|
|
247
|
+
this.renderer = inject(Renderer2);
|
|
248
|
+
this.hostRenderer = useHostRenderer();
|
|
249
|
+
/**
|
|
250
|
+
* 按钮类型,支持添加前缀`outline-`实现线框按钮,支持添加前缀`link-`实现按钮链接
|
|
251
|
+
* @type primary | info | warning | danger | success
|
|
252
|
+
* @default primary
|
|
253
|
+
*/
|
|
254
|
+
this.thyButton = input();
|
|
255
|
+
/**
|
|
256
|
+
* 和`thyButton`参数一样,一般使用`thyButton`,为了减少参数输入, 当通过`thy-button`使用时,只能使用该参数控制类型
|
|
257
|
+
* @default primary
|
|
258
|
+
*/
|
|
259
|
+
this.thyType = input();
|
|
260
|
+
/**
|
|
261
|
+
* 加载状态
|
|
262
|
+
* @default false
|
|
263
|
+
*/
|
|
264
|
+
this.thyLoading = input(false, {
|
|
265
|
+
transform: value => {
|
|
266
|
+
if (!this.thyLoading() && value) {
|
|
267
|
+
const textElement = this.nativeElement?.querySelector('span');
|
|
268
|
+
this._originalText = textElement ? textElement.innerText : '';
|
|
269
|
+
}
|
|
270
|
+
return coerceBooleanProperty$1(value);
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
/**
|
|
274
|
+
* 加载状态时显示的文案
|
|
275
|
+
*/
|
|
276
|
+
this.thyLoadingText = input();
|
|
277
|
+
/**
|
|
278
|
+
* 按钮大小
|
|
279
|
+
* @type xs | sm | md | default | lg
|
|
280
|
+
* @default default
|
|
281
|
+
*/
|
|
282
|
+
this.thySize = input();
|
|
283
|
+
/**
|
|
284
|
+
* 按钮中显示的图标,支持SVG图标名称,比如`angle-left`,也支持传之前的 wtf 字体,比如: wtf-plus
|
|
285
|
+
*/
|
|
286
|
+
this.thyIcon = input();
|
|
287
|
+
/**
|
|
288
|
+
* 按钮整块展示
|
|
289
|
+
* @default false
|
|
290
|
+
*/
|
|
291
|
+
this.thyBlock = input(false, { transform: coerceBooleanProperty$1 });
|
|
292
|
+
this.isWtfIcon = computed(() => {
|
|
293
|
+
const icon = this.thyIcon();
|
|
294
|
+
return icon && icon.includes('wtf');
|
|
295
|
+
});
|
|
296
|
+
this.svgIconName = computed(() => {
|
|
297
|
+
if (!this.isWtfIcon()) {
|
|
298
|
+
return this.thyIcon();
|
|
299
|
+
}
|
|
300
|
+
return null;
|
|
301
|
+
});
|
|
302
|
+
this.iconClass = computed(() => {
|
|
303
|
+
const icon = this.thyIcon();
|
|
304
|
+
if (this.isWtfIcon()) {
|
|
305
|
+
const classes = icon.split(' ');
|
|
306
|
+
if (classes.length === 1) {
|
|
307
|
+
classes.unshift('wtf');
|
|
308
|
+
}
|
|
309
|
+
return classes;
|
|
310
|
+
}
|
|
311
|
+
return null;
|
|
312
|
+
});
|
|
313
|
+
this.buttonType = computed(() => {
|
|
314
|
+
return this.thyButton() || this.thyType();
|
|
315
|
+
});
|
|
316
|
+
this.isRadiusSquare = computed(() => {
|
|
317
|
+
const type = this.buttonType();
|
|
318
|
+
return !!type?.includes('-square');
|
|
319
|
+
});
|
|
320
|
+
this.type = computed(() => {
|
|
321
|
+
const type = this.buttonType();
|
|
322
|
+
if (this.isRadiusSquare()) {
|
|
323
|
+
return type.replace('-square', '');
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
return type;
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
effect(() => {
|
|
330
|
+
this.updateClasses();
|
|
331
|
+
});
|
|
332
|
+
effect(() => {
|
|
333
|
+
this.setButtonText();
|
|
334
|
+
});
|
|
335
|
+
afterNextRender(() => {
|
|
336
|
+
if (assertIconOnly(this.nativeElement)) {
|
|
337
|
+
this.hostRenderer.addClass(iconOnlyClass);
|
|
338
|
+
}
|
|
339
|
+
else {
|
|
340
|
+
this.hostRenderer.removeClass(iconOnlyClass);
|
|
341
|
+
}
|
|
342
|
+
this.wrapSpanForText(this.nativeElement.childNodes);
|
|
343
|
+
});
|
|
423
344
|
}
|
|
424
345
|
wrapSpanForText(nodes) {
|
|
425
346
|
nodes.forEach(node => {
|
|
@@ -433,33 +354,15 @@ class ThyButton {
|
|
|
433
354
|
});
|
|
434
355
|
}
|
|
435
356
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyButton, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
436
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyButton, isStandalone: true, selector: "thy-button,[thy-button],[thyButton]", inputs: { thyButton: "thyButton", thyType: "thyType", thyLoading:
|
|
357
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyButton, isStandalone: true, selector: "thy-button,[thy-button],[thyButton]", inputs: { thyButton: { classPropertyName: "thyButton", publicName: "thyButton", isSignal: true, isRequired: false, transformFunction: null }, thyType: { classPropertyName: "thyType", publicName: "thyType", isSignal: true, isRequired: false, transformFunction: null }, thyLoading: { classPropertyName: "thyLoading", publicName: "thyLoading", isSignal: true, isRequired: false, transformFunction: null }, thyLoadingText: { classPropertyName: "thyLoadingText", publicName: "thyLoadingText", isSignal: true, isRequired: false, transformFunction: null }, thySize: { classPropertyName: "thySize", publicName: "thySize", isSignal: true, isRequired: false, transformFunction: null }, thyIcon: { classPropertyName: "thyIcon", publicName: "thyIcon", isSignal: true, isRequired: false, transformFunction: null }, thyBlock: { classPropertyName: "thyBlock", publicName: "thyBlock", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.btn-block": "thyBlock()" }, classAttribute: "thy-btn btn" }, ngImport: i0, template: "@if (svgIconName()) {\n <thy-icon [thyIconName]=\"svgIconName()\"></thy-icon>\n} @else {\n @if (iconClass()) {\n <i [ngClass]=\"iconClass()\"></i>\n }\n}\n<ng-content></ng-content>\n", dependencies: [{ kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
437
358
|
}
|
|
438
359
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyButton, decorators: [{
|
|
439
360
|
type: Component,
|
|
440
361
|
args: [{ selector: 'thy-button,[thy-button],[thyButton]', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
441
|
-
class: 'thy-btn btn'
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
}], thyType: [{
|
|
446
|
-
type: Input
|
|
447
|
-
}], thyLoading: [{
|
|
448
|
-
type: Input,
|
|
449
|
-
args: [{ transform: coerceBooleanProperty$1 }]
|
|
450
|
-
}], thyLoadingText: [{
|
|
451
|
-
type: Input
|
|
452
|
-
}], thySize: [{
|
|
453
|
-
type: Input
|
|
454
|
-
}], thyIcon: [{
|
|
455
|
-
type: Input
|
|
456
|
-
}], thyBlock: [{
|
|
457
|
-
type: HostBinding,
|
|
458
|
-
args: [`class.btn-block`]
|
|
459
|
-
}, {
|
|
460
|
-
type: Input,
|
|
461
|
-
args: [{ transform: coerceBooleanProperty$1 }]
|
|
462
|
-
}] } });
|
|
362
|
+
class: 'thy-btn btn',
|
|
363
|
+
'[class.btn-block]': 'thyBlock()'
|
|
364
|
+
}, imports: [ThyIcon, NgClass], template: "@if (svgIconName()) {\n <thy-icon [thyIconName]=\"svgIconName()\"></thy-icon>\n} @else {\n @if (iconClass()) {\n <i [ngClass]=\"iconClass()\"></i>\n }\n}\n<ng-content></ng-content>\n" }]
|
|
365
|
+
}], ctorParameters: () => [] });
|
|
463
366
|
|
|
464
367
|
class ThyButtonModule {
|
|
465
368
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyButtonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|