ngx-tethys 19.1.0-next.4 → 19.1.0-next.6

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 (83) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/date-picker/abstract-picker.component.d.ts +50 -52
  3. package/date-picker/abstract-picker.directive.d.ts +15 -40
  4. package/date-picker/base-picker.component.d.ts +11 -40
  5. package/date-picker/date-picker.config.d.ts +1 -0
  6. package/date-picker/lib/calendar/calendar-footer.component.d.ts +24 -19
  7. package/date-picker/lib/calendar/calendar-header.component.d.ts +15 -15
  8. package/date-picker/lib/calendar/calendar-table.component.d.ts +15 -16
  9. package/date-picker/lib/date/date-table-cell.component.d.ts +2 -3
  10. package/date-picker/lib/date/date-table.component.d.ts +2 -3
  11. package/date-picker/lib/date-carousel/date-carousel.component.d.ts +2 -3
  12. package/date-picker/lib/decade/decade-header.component.d.ts +2 -5
  13. package/date-picker/lib/decade/decade-table.component.d.ts +3 -5
  14. package/date-picker/lib/month/month-table.component.d.ts +1 -2
  15. package/date-picker/lib/popups/date-popup.component.d.ts +33 -34
  16. package/date-picker/lib/popups/inner-popup.component.d.ts +22 -29
  17. package/date-picker/lib/quarter/quarter-table.component.d.ts +1 -4
  18. package/date-picker/lib/year/year-header.component.d.ts +2 -4
  19. package/date-picker/lib/year/year-table.component.d.ts +2 -4
  20. package/date-picker/month-picker.component.d.ts +2 -2
  21. package/date-picker/picker.component.d.ts +30 -34
  22. package/date-picker/picker.pipes.d.ts +4 -5
  23. package/date-picker/picker.util.d.ts +5 -5
  24. package/date-picker/picker.validators.d.ts +4 -8
  25. package/date-picker/quarter-picker.component.d.ts +2 -3
  26. package/date-picker/week-picker.component.d.ts +0 -1
  27. package/date-picker/year-picker.component.d.ts +2 -3
  28. package/dropdown/dropdown.directive.d.ts +2 -1
  29. package/fesm2022/ngx-tethys-autocomplete.mjs +4 -4
  30. package/fesm2022/ngx-tethys-autocomplete.mjs.map +1 -1
  31. package/fesm2022/ngx-tethys-checkbox.mjs +2 -2
  32. package/fesm2022/ngx-tethys-checkbox.mjs.map +1 -1
  33. package/fesm2022/ngx-tethys-date-picker.mjs +833 -1060
  34. package/fesm2022/ngx-tethys-date-picker.mjs.map +1 -1
  35. package/fesm2022/ngx-tethys-divider.mjs +5 -5
  36. package/fesm2022/ngx-tethys-divider.mjs.map +1 -1
  37. package/fesm2022/ngx-tethys-dropdown.mjs +2 -1
  38. package/fesm2022/ngx-tethys-dropdown.mjs.map +1 -1
  39. package/fesm2022/ngx-tethys-i18n.mjs +11 -6
  40. package/fesm2022/ngx-tethys-i18n.mjs.map +1 -1
  41. package/fesm2022/ngx-tethys-layout.mjs +291 -334
  42. package/fesm2022/ngx-tethys-layout.mjs.map +1 -1
  43. package/fesm2022/ngx-tethys-list.mjs +11 -10
  44. package/fesm2022/ngx-tethys-list.mjs.map +1 -1
  45. package/fesm2022/ngx-tethys-radio.mjs +4 -4
  46. package/fesm2022/ngx-tethys-radio.mjs.map +1 -1
  47. package/fesm2022/ngx-tethys-select.mjs +164 -228
  48. package/fesm2022/ngx-tethys-select.mjs.map +1 -1
  49. package/fesm2022/ngx-tethys-shared.mjs +371 -523
  50. package/fesm2022/ngx-tethys-shared.mjs.map +1 -1
  51. package/fesm2022/ngx-tethys-tree-select.mjs +215 -281
  52. package/fesm2022/ngx-tethys-tree-select.mjs.map +1 -1
  53. package/fesm2022/ngx-tethys.mjs +1 -1
  54. package/fesm2022/ngx-tethys.mjs.map +1 -1
  55. package/i18n/i18n.d.ts +2 -1
  56. package/i18n/locales/de-de.d.ts +2 -1
  57. package/i18n/locales/en-us.d.ts +2 -1
  58. package/i18n/locales/ja-jp.d.ts +2 -1
  59. package/i18n/locales/zh-hans.d.ts +2 -1
  60. package/i18n/locales/zh-hant.d.ts +2 -1
  61. package/layout/header.component.d.ts +15 -19
  62. package/layout/layout.component.d.ts +3 -2
  63. package/layout/sidebar-header.component.d.ts +7 -8
  64. package/layout/sidebar.component.d.ts +32 -62
  65. package/package.json +54 -54
  66. package/schematics/version.d.ts +1 -1
  67. package/schematics/version.js +1 -1
  68. package/select/custom-select/custom-select.component.d.ts +33 -56
  69. package/select/native-select/native-select.component.d.ts +7 -13
  70. package/shared/base-form-check.component.d.ts +6 -8
  71. package/shared/directives/string-or-template-outlet.directive.d.ts +5 -6
  72. package/shared/directives/thy-autofocus.directive.d.ts +4 -6
  73. package/shared/directives/thy-scroll.directive.d.ts +5 -8
  74. package/shared/directives/thy-show.d.ts +3 -4
  75. package/shared/directives/thy-stop-propagation.directive.d.ts +4 -4
  76. package/shared/directives/view-outlet.directive.d.ts +6 -7
  77. package/shared/ng-transclude.directive.d.ts +2 -3
  78. package/shared/option/group/option-group.component.d.ts +5 -9
  79. package/shared/option/list-option/list-option.component.d.ts +4 -8
  80. package/shared/option/option.component.d.ts +10 -17
  81. package/shared/option/options-container.component.d.ts +1 -1
  82. package/shared/select/select-control/select-control.component.d.ts +27 -47
  83. package/tree-select/tree-select.component.d.ts +53 -70
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Directive, ChangeDetectionStrategy, Component, Input, ContentChild, inject, HostBinding, ElementRef, EventEmitter, numberAttribute, Output, HostListener, NgModule } from '@angular/core';
2
+ import { signal, computed, Directive, ChangeDetectionStrategy, Component, input, contentChild, inject, linkedSignal, ElementRef, numberAttribute, output, effect, HostListener, NgModule } from '@angular/core';
3
3
  import { NgTemplateOutlet, NgClass, CommonModule } from '@angular/common';
4
4
  import { ThyIcon, ThyIconModule } from 'ngx-tethys/icon';
5
5
  import { coerceBooleanProperty } from 'ngx-tethys/util';
@@ -17,11 +17,13 @@ import { DragDropModule } from '@angular/cdk/drag-drop';
17
17
  */
18
18
  class ThyLayoutDirective {
19
19
  constructor() {
20
- this.hasSidebar = false;
21
- this.isSidebarRight = false;
20
+ this.sidebarDirection = signal(null);
21
+ this.isSidebarRight = computed(() => {
22
+ return this.sidebarDirection() === 'right';
23
+ });
22
24
  }
23
25
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyLayoutDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
24
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.8", type: ThyLayoutDirective, isStandalone: true, selector: "[thyLayout]:not([thyForm]):not(thy-form):not(thy-radio-group):not(thy-properties):not(thy-selection-list):not(thy-vote):not([thyVote])", host: { properties: { "class.thy-layout--has-sidebar": "hasSidebar", "class.thy-layout--is-sidebar-right": "isSidebarRight" }, classAttribute: "thy-layout" }, ngImport: i0 }); }
26
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.8", type: ThyLayoutDirective, isStandalone: true, selector: "[thyLayout]:not([thyForm]):not(thy-form):not(thy-radio-group):not(thy-properties):not(thy-selection-list):not(thy-vote):not([thyVote])", host: { properties: { "class.thy-layout--has-sidebar": "sidebarDirection()", "class.thy-layout--is-sidebar-right": "isSidebarRight()" }, classAttribute: "thy-layout" }, ngImport: i0 }); }
25
27
  }
26
28
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyLayoutDirective, decorators: [{
27
29
  type: Directive,
@@ -29,8 +31,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
29
31
  selector: '[thyLayout]:not([thyForm]):not(thy-form):not(thy-radio-group):not(thy-properties):not(thy-selection-list):not(thy-vote):not([thyVote])',
30
32
  host: {
31
33
  class: 'thy-layout',
32
- '[class.thy-layout--has-sidebar]': 'hasSidebar',
33
- '[class.thy-layout--is-sidebar-right]': 'isSidebarRight'
34
+ '[class.thy-layout--has-sidebar]': 'sidebarDirection()',
35
+ '[class.thy-layout--is-sidebar-right]': 'isSidebarRight()'
34
36
  }
35
37
  }]
36
38
  }] });
@@ -64,29 +66,31 @@ class ThyHeaderDirective {
64
66
  * 头部大小
65
67
  * @type sm | md | lg | xlg
66
68
  */
67
- this.thySize = 'md';
69
+ this.thySize = input('md');
68
70
  /**
69
71
  * 底部是否有阴影
70
72
  * @default false
71
73
  */
72
- this.thyShadow = false;
73
- this.divided = false;
74
- }
75
- /**
76
- * 底部是否有分割线
77
- */
78
- set thyDivided(value) {
79
- this.divided = value;
80
- }
81
- /**
82
- * 底部是否有分割线,已废弃,请使用 thyDivided
83
- * @deprecated please use thyDivided
84
- */
85
- set thyHasBorder(value) {
86
- this.divided = value;
74
+ this.thyShadow = input(false, { transform: coerceBooleanProperty });
75
+ /**
76
+ * 底部是否有分割线
77
+ */
78
+ this.thyDivided = input(false, { transform: coerceBooleanProperty });
79
+ /**
80
+ * 底部是否有分割线,已废弃,请使用 thyDivided
81
+ * @deprecated please use thyDivided
82
+ */
83
+ this.thyHasBorder = input(false, { transform: coerceBooleanProperty });
84
+ this.divided = computed(() => {
85
+ const value = this.thyDivided();
86
+ if (value !== undefined) {
87
+ return value;
88
+ }
89
+ return this.thyHasBorder();
90
+ });
87
91
  }
88
92
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyHeaderDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
89
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "19.2.8", type: ThyHeaderDirective, isStandalone: true, selector: "[thyHeader]", inputs: { thySize: "thySize", thyShadow: ["thyShadow", "thyShadow", coerceBooleanProperty], thyDivided: ["thyDivided", "thyDivided", coerceBooleanProperty], thyHasBorder: ["thyHasBorder", "thyHasBorder", coerceBooleanProperty] }, host: { properties: { "class.thy-layout-header-sm": "thySize === 'sm'", "class.thy-layout-header-lg": "thySize === 'lg'", "class.thy-layout-header-xlg": "thySize === 'xlg'", "class.thy-layout-header-shadow": "thyShadow", "class.thy-layout-header-divided": "divided" }, classAttribute: "thy-layout-header" }, ngImport: i0 }); }
93
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: ThyHeaderDirective, isStandalone: true, selector: "[thyHeader]", inputs: { thySize: { classPropertyName: "thySize", publicName: "thySize", isSignal: true, isRequired: false, transformFunction: null }, thyShadow: { classPropertyName: "thyShadow", publicName: "thyShadow", isSignal: true, isRequired: false, transformFunction: null }, thyDivided: { classPropertyName: "thyDivided", publicName: "thyDivided", isSignal: true, isRequired: false, transformFunction: null }, thyHasBorder: { classPropertyName: "thyHasBorder", publicName: "thyHasBorder", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.thy-layout-header-sm": "thySize() === 'sm'", "class.thy-layout-header-lg": "thySize() === 'lg'", "class.thy-layout-header-xlg": "thySize() === 'xlg'", "class.thy-layout-header-shadow": "thyShadow()", "class.thy-layout-header-divided": "divided()" }, classAttribute: "thy-layout-header" }, ngImport: i0 }); }
90
94
  }
91
95
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyHeaderDirective, decorators: [{
92
96
  type: Directive,
@@ -94,26 +98,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
94
98
  selector: '[thyHeader]',
95
99
  host: {
96
100
  class: `thy-layout-header`,
97
- '[class.thy-layout-header-sm]': `thySize === 'sm'`,
98
- '[class.thy-layout-header-lg]': `thySize === 'lg'`,
99
- '[class.thy-layout-header-xlg]': `thySize === 'xlg'`,
100
- '[class.thy-layout-header-shadow]': `thyShadow`,
101
- '[class.thy-layout-header-divided]': `divided`
101
+ '[class.thy-layout-header-sm]': `thySize() === 'sm'`,
102
+ '[class.thy-layout-header-lg]': `thySize() === 'lg'`,
103
+ '[class.thy-layout-header-xlg]': `thySize() === 'xlg'`,
104
+ '[class.thy-layout-header-shadow]': `thyShadow()`,
105
+ '[class.thy-layout-header-divided]': `divided()`
102
106
  }
103
107
  }]
104
- }], propDecorators: { thySize: [{
105
- type: Input,
106
- args: ['thySize']
107
- }], thyShadow: [{
108
- type: Input,
109
- args: [{ transform: coerceBooleanProperty }]
110
- }], thyDivided: [{
111
- type: Input,
112
- args: [{ transform: coerceBooleanProperty }]
113
- }], thyHasBorder: [{
114
- type: Input,
115
- args: [{ transform: coerceBooleanProperty }]
116
- }] } });
108
+ }] });
117
109
  /**
118
110
  * 头部布局组件
119
111
  * @name thy-header
@@ -121,30 +113,56 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
121
113
  */
122
114
  class ThyHeader {
123
115
  constructor() {
116
+ /**
117
+ * 头部标题
118
+ */
119
+ this.thyTitle = input(undefined);
124
120
  /**
125
121
  * 图标前缀,被弃用,图标使用 SVG 图标
126
122
  */
127
- this.thyIconPrefix = 'wtf';
128
- }
129
- /**
130
- * 图标,SVG 图标名称
131
- */
132
- set thyIcon(value) {
133
- if (value) {
134
- if (value.includes('wtf')) {
135
- this.iconClass = `${this.thyIconPrefix} ${value}`;
123
+ this.thyIconPrefix = input('wtf');
124
+ /**
125
+ * 图标,SVG 图标名称
126
+ */
127
+ this.thyIcon = input(undefined);
128
+ this.svgIconName = computed(() => {
129
+ const icon = this.thyIcon();
130
+ if (icon && !icon.includes('wtf')) {
131
+ return icon;
132
+ }
133
+ return null;
134
+ });
135
+ this.iconClass = computed(() => {
136
+ const icon = this.svgIconName();
137
+ if (icon) {
138
+ return null;
136
139
  }
137
140
  else {
138
- this.svgIconName = value;
141
+ const icon = this.thyIcon();
142
+ if (icon && icon.includes('wtf')) {
143
+ return `${this.thyIconPrefix()} ${icon}`;
144
+ }
139
145
  }
140
- }
141
- else {
142
- this.iconClass = null;
143
- this.svgIconName = null;
144
- }
146
+ return null;
147
+ });
148
+ /**
149
+ * 头部自定义标题模板,`<ng-template #headerTitle></ng-template>`
150
+ * @type TemplateRef
151
+ */
152
+ this.titleTemplateRef = contentChild('headerTitle');
153
+ /**
154
+ * 头部自定义内容模板,`<ng-template #headerContent></ng-template>`
155
+ * @type TemplateRef
156
+ */
157
+ this.contentTemplateRef = contentChild('headerContent');
158
+ /**
159
+ * 头部自定义操作模板,`<ng-template #headerOperation></ng-template>`
160
+ * @type TemplateRef
161
+ */
162
+ this.operationTemplateRef = contentChild('headerOperation');
145
163
  }
146
164
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyHeader, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
147
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyHeader, isStandalone: true, selector: "thy-header", inputs: { thyTitle: "thyTitle", thyIconPrefix: "thyIconPrefix", thyIcon: "thyIcon" }, queries: [{ propertyName: "titleTemplateRef", first: true, predicate: ["headerTitle"], descendants: true }, { propertyName: "contentTemplateRef", first: true, predicate: ["headerContent"], descendants: true }, { propertyName: "operationTemplateRef", first: true, predicate: ["headerOperation"], descendants: true }], hostDirectives: [{ directive: ThyHeaderDirective, inputs: ["thySize", "thySize", "thyShadow", "thyShadow", "thyHasBorder", "thyHasBorder", "thyDivided", "thyDivided"] }], ngImport: i0, template: "<div class=\"layout-header-title\">\n <ng-template [ngTemplateOutlet]=\"titleTemplateRef\"></ng-template>\n @if (!titleTemplateRef) {\n @if (svgIconName) {\n <thy-icon class=\"prefix-icon\" [thyIconName]=\"svgIconName\"></thy-icon>\n } @else {\n @if (iconClass) {\n <i class=\"prefix-icon\" [ngClass]=\"iconClass\"></i>\n }\n }\n <span class=\"title-name\">{{ thyTitle }}</span>\n }\n</div>\n<div class=\"layout-header-content\">\n <ng-template [ngTemplateOutlet]=\"contentTemplateRef\"></ng-template>\n</div>\n<div class=\"layout-header-operation\">\n <ng-template [ngTemplateOutlet]=\"operationTemplateRef\"></ng-template>\n</div>\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { 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 }); }
165
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyHeader, isStandalone: true, selector: "thy-header", inputs: { thyTitle: { classPropertyName: "thyTitle", publicName: "thyTitle", isSignal: true, isRequired: false, transformFunction: null }, thyIconPrefix: { classPropertyName: "thyIconPrefix", publicName: "thyIconPrefix", isSignal: true, isRequired: false, transformFunction: null }, thyIcon: { classPropertyName: "thyIcon", publicName: "thyIcon", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "titleTemplateRef", first: true, predicate: ["headerTitle"], descendants: true, isSignal: true }, { propertyName: "contentTemplateRef", first: true, predicate: ["headerContent"], descendants: true, isSignal: true }, { propertyName: "operationTemplateRef", first: true, predicate: ["headerOperation"], descendants: true, isSignal: true }], hostDirectives: [{ directive: ThyHeaderDirective, inputs: ["thySize", "thySize", "thyShadow", "thyShadow", "thyHasBorder", "thyHasBorder", "thyDivided", "thyDivided"] }], ngImport: i0, template: "<div class=\"layout-header-title\">\n @if (titleTemplateRef()) {\n <ng-template [ngTemplateOutlet]=\"titleTemplateRef()\"></ng-template>\n } @else {\n @if (svgIconName()) {\n <thy-icon class=\"prefix-icon\" [thyIconName]=\"svgIconName()\"></thy-icon>\n } @else {\n @if (iconClass()) {\n <i class=\"prefix-icon\" [ngClass]=\"iconClass()\"></i>\n }\n }\n <span class=\"title-name\">{{ thyTitle() }}</span>\n }\n</div>\n<div class=\"layout-header-content\">\n <ng-template [ngTemplateOutlet]=\"contentTemplateRef()\"></ng-template>\n</div>\n<div class=\"layout-header-operation\">\n <ng-template [ngTemplateOutlet]=\"operationTemplateRef()\"></ng-template>\n</div>\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { 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 }); }
148
166
  }
149
167
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyHeader, decorators: [{
150
168
  type: Component,
@@ -153,24 +171,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
153
171
  directive: ThyHeaderDirective,
154
172
  inputs: ['thySize', 'thyShadow', 'thyHasBorder', 'thyDivided']
155
173
  }
156
- ], imports: [NgTemplateOutlet, ThyIcon, NgClass], template: "<div class=\"layout-header-title\">\n <ng-template [ngTemplateOutlet]=\"titleTemplateRef\"></ng-template>\n @if (!titleTemplateRef) {\n @if (svgIconName) {\n <thy-icon class=\"prefix-icon\" [thyIconName]=\"svgIconName\"></thy-icon>\n } @else {\n @if (iconClass) {\n <i class=\"prefix-icon\" [ngClass]=\"iconClass\"></i>\n }\n }\n <span class=\"title-name\">{{ thyTitle }}</span>\n }\n</div>\n<div class=\"layout-header-content\">\n <ng-template [ngTemplateOutlet]=\"contentTemplateRef\"></ng-template>\n</div>\n<div class=\"layout-header-operation\">\n <ng-template [ngTemplateOutlet]=\"operationTemplateRef\"></ng-template>\n</div>\n" }]
157
- }], propDecorators: { thyTitle: [{
158
- type: Input
159
- }], thyIconPrefix: [{
160
- type: Input
161
- }], thyIcon: [{
162
- type: Input,
163
- args: ['thyIcon']
164
- }], titleTemplateRef: [{
165
- type: ContentChild,
166
- args: ['headerTitle']
167
- }], contentTemplateRef: [{
168
- type: ContentChild,
169
- args: ['headerContent']
170
- }], operationTemplateRef: [{
171
- type: ContentChild,
172
- args: ['headerOperation']
173
- }] } });
174
+ ], imports: [NgTemplateOutlet, ThyIcon, NgClass], template: "<div class=\"layout-header-title\">\n @if (titleTemplateRef()) {\n <ng-template [ngTemplateOutlet]=\"titleTemplateRef()\"></ng-template>\n } @else {\n @if (svgIconName()) {\n <thy-icon class=\"prefix-icon\" [thyIconName]=\"svgIconName()\"></thy-icon>\n } @else {\n @if (iconClass()) {\n <i class=\"prefix-icon\" [ngClass]=\"iconClass()\"></i>\n }\n }\n <span class=\"title-name\">{{ thyTitle() }}</span>\n }\n</div>\n<div class=\"layout-header-content\">\n <ng-template [ngTemplateOutlet]=\"contentTemplateRef()\"></ng-template>\n</div>\n<div class=\"layout-header-operation\">\n <ng-template [ngTemplateOutlet]=\"operationTemplateRef()\"></ng-template>\n</div>\n" }]
175
+ }] });
174
176
 
175
177
  /**
176
178
  * 内容布局指令
@@ -221,63 +223,49 @@ const SIDEBAR_COLLAPSED_WIDTH = 20;
221
223
  class ThySidebarDirective {
222
224
  constructor() {
223
225
  this.thyLayoutDirective = inject(ThyLayoutDirective, { optional: true, host: true });
224
- this.sidebarIsolated = false;
225
- this.isDivided = true;
226
226
  /**
227
227
  * sidebar 位置,默认在左侧
228
228
  */
229
- this.thyDirection = 'left';
230
- }
231
- /**
232
- * 宽度,默认是 240px,传入 `lg` 大小时宽度是300px
233
- * @default 240px
234
- */
235
- set thyWidth(value) {
236
- if (value === 'lg') {
237
- value = LG_WIDTH;
238
- }
239
- this.thyLayoutSidebarWidth = value || SIDEBAR_DEFAULT_WIDTH;
240
- }
241
- /**
242
- * 是否和右侧 /左侧隔离,当为 true 时距右侧 /左侧会有 margin,同时边框会去掉
243
- * @default false
244
- */
245
- set thyIsolated(value) {
246
- this.sidebarIsolated = value;
247
- }
248
- /**
249
- * sidebar 是否有分割线。当`thyDirection`值为`left`时,控制右侧是否有分割线;当`thyDirection`值为`right`时,控制左侧是否有分割线。
250
- * @default true
251
- */
252
- set thyDivided(value) {
253
- this.isDivided = value;
254
- }
255
- /**
256
- * 右侧是否有边框,已废弃,请使用 thyDivided
257
- * @deprecated please use thyDivided
258
- * @default true
259
- */
260
- set thyHasBorderRight(value) {
261
- this.thyDivided = value;
262
- }
263
- /**
264
- * 左侧是否有边框,已废弃,请使用 thyDivided
265
- * @deprecated please use thyDivided
266
- * @default true
267
- */
268
- set thyHasBorderLeft(value) {
269
- this.thyDivided = value;
229
+ this.thyDirection = input('left');
230
+ /**
231
+ * 主题
232
+ * @type white | light | dark
233
+ * @default white
234
+ */
235
+ this.thyTheme = input(undefined);
236
+ /**
237
+ * 宽度,默认是 240px,传入 `lg` 大小时宽度是300px
238
+ * @default 240px
239
+ */
240
+ this.thyWidth = input(SIDEBAR_DEFAULT_WIDTH, {
241
+ transform: (value) => {
242
+ if (value === 'lg') {
243
+ return LG_WIDTH;
244
+ }
245
+ return value || SIDEBAR_DEFAULT_WIDTH;
246
+ }
247
+ });
248
+ this.sidebarWidth = linkedSignal(() => {
249
+ return this.thyWidth();
250
+ });
251
+ /**
252
+ * 是否和右侧 /左侧隔离,当为 true 时距右侧 /左侧会有 margin,同时边框会去掉
253
+ * @default false
254
+ */
255
+ this.thyIsolated = input(false, { transform: coerceBooleanProperty });
256
+ /**
257
+ * sidebar 是否有分割线。当`thyDirection`值为`left`时,控制右侧是否有分割线;当`thyDirection`值为`right`时,控制左侧是否有分割线。
258
+ * @default true
259
+ */
260
+ this.thyDivided = input(true, { transform: coerceBooleanProperty });
270
261
  }
271
262
  ngOnInit() {
272
263
  if (this.thyLayoutDirective) {
273
- this.thyLayoutDirective.hasSidebar = true;
274
- }
275
- if (this.thyDirection === 'right') {
276
- this.thyLayoutDirective.isSidebarRight = true;
264
+ this.thyLayoutDirective.sidebarDirection.set(this.thyDirection());
277
265
  }
278
266
  }
279
267
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThySidebarDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
280
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "19.2.8", type: ThySidebarDirective, isStandalone: true, selector: "[thySidebar]", inputs: { thyDirection: "thyDirection", thyTheme: "thyTheme", thyWidth: "thyWidth", thyIsolated: ["thyIsolated", "thyIsolated", coerceBooleanProperty], thyDivided: ["thyDivided", "thyDivided", coerceBooleanProperty], thyHasBorderRight: ["thyHasBorderRight", "thyHasBorderRight", coerceBooleanProperty], thyHasBorderLeft: ["thyHasBorderLeft", "thyHasBorderLeft", coerceBooleanProperty] }, host: { properties: { "class.thy-layout-sidebar-right": "thyDirection === \"right\"", "class.thy-layout-sidebar--clear-border-right": "thyDirection === \"left\" && !isDivided", "class.thy-layout-sidebar--clear-border-left": "thyDirection === \"right\" && !isDivided", "class.sidebar-theme-light": "thyTheme === \"light\"", "class.sidebar-theme-dark": "thyTheme === \"dark\"", "class.thy-layout-sidebar-isolated": "sidebarIsolated", "style.width.px": "this.thyLayoutSidebarWidth" }, classAttribute: "thy-layout-sidebar" }, ngImport: i0 }); }
268
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: ThySidebarDirective, isStandalone: true, selector: "[thySidebar]", inputs: { thyDirection: { classPropertyName: "thyDirection", publicName: "thyDirection", isSignal: true, isRequired: false, transformFunction: null }, thyTheme: { classPropertyName: "thyTheme", publicName: "thyTheme", isSignal: true, isRequired: false, transformFunction: null }, thyWidth: { classPropertyName: "thyWidth", publicName: "thyWidth", isSignal: true, isRequired: false, transformFunction: null }, thyIsolated: { classPropertyName: "thyIsolated", publicName: "thyIsolated", isSignal: true, isRequired: false, transformFunction: null }, thyDivided: { classPropertyName: "thyDivided", publicName: "thyDivided", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.thy-layout-sidebar-right": "thyDirection() === \"right\"", "class.thy-layout-sidebar--clear-border-right": "thyDirection() === \"left\" && !thyDivided()", "class.thy-layout-sidebar--clear-border-left": "thyDirection() === \"right\" && !thyDivided()", "class.sidebar-theme-light": "thyTheme() === \"light\"", "class.sidebar-theme-dark": "thyTheme() === \"dark\"", "class.thy-layout-sidebar-isolated": "thyIsolated()", "style.width.px": "sidebarWidth()" }, classAttribute: "thy-layout-sidebar" }, ngImport: i0 }); }
281
269
  }
282
270
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThySidebarDirective, decorators: [{
283
271
  type: Directive,
@@ -285,200 +273,185 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
285
273
  selector: '[thySidebar]',
286
274
  host: {
287
275
  class: 'thy-layout-sidebar',
288
- '[class.thy-layout-sidebar-right]': 'thyDirection === "right"',
289
- '[class.thy-layout-sidebar--clear-border-right]': 'thyDirection === "left" && !isDivided',
290
- '[class.thy-layout-sidebar--clear-border-left]': 'thyDirection === "right" && !isDivided',
291
- '[class.sidebar-theme-light]': 'thyTheme === "light"',
292
- '[class.sidebar-theme-dark]': 'thyTheme === "dark"',
293
- '[class.thy-layout-sidebar-isolated]': 'sidebarIsolated'
276
+ '[class.thy-layout-sidebar-right]': 'thyDirection() === "right"',
277
+ '[class.thy-layout-sidebar--clear-border-right]': 'thyDirection() === "left" && !thyDivided()',
278
+ '[class.thy-layout-sidebar--clear-border-left]': 'thyDirection() === "right" && !thyDivided()',
279
+ '[class.sidebar-theme-light]': 'thyTheme() === "light"',
280
+ '[class.sidebar-theme-dark]': 'thyTheme() === "dark"',
281
+ '[class.thy-layout-sidebar-isolated]': 'thyIsolated()',
282
+ '[style.width.px]': 'sidebarWidth()'
294
283
  }
295
284
  }]
296
- }], propDecorators: { thyLayoutSidebarWidth: [{
297
- type: HostBinding,
298
- args: ['style.width.px']
299
- }], thyDirection: [{
300
- type: Input
301
- }], thyTheme: [{
302
- type: Input
303
- }], thyWidth: [{
304
- type: Input,
305
- args: ['thyWidth']
306
- }], thyIsolated: [{
307
- type: Input,
308
- args: [{ transform: coerceBooleanProperty }]
309
- }], thyDivided: [{
310
- type: Input,
311
- args: [{ transform: coerceBooleanProperty }]
312
- }], thyHasBorderRight: [{
313
- type: Input,
314
- args: [{ transform: coerceBooleanProperty }]
315
- }], thyHasBorderLeft: [{
316
- type: Input,
317
- args: [{ transform: coerceBooleanProperty }]
318
- }] } });
285
+ }] });
319
286
  /**
320
287
  * 侧边栏布局组件
321
288
  * @name thy-sidebar
322
289
  * @order 21
323
290
  */
324
291
  class ThySidebar {
292
+ mouseenter($event) {
293
+ this.isMouseEnter.set(true);
294
+ }
295
+ mouseleave($event) {
296
+ this.isMouseEnter.set(false);
297
+ }
325
298
  constructor() {
326
299
  this.locale = injectLocale('layout');
327
300
  this.elementRef = inject(ElementRef);
328
301
  this.hotkeyDispatcher = inject(ThyHotkeyDispatcher);
329
302
  this.sidebarDirective = inject(ThySidebarDirective);
303
+ this.isMouseEnter = signal(false);
304
+ this.sidebarWidth = computed(() => {
305
+ if (this.thyCollapsible() && this.collapsed()) {
306
+ return this.thyCollapsedWidth();
307
+ }
308
+ else {
309
+ return this.sidebarDirective.sidebarWidth();
310
+ }
311
+ });
330
312
  /**
331
313
  * 宽度是否可以拖拽
332
314
  * @default false
333
315
  */
334
- this.thyDraggable = false;
316
+ this.thyDraggable = input(false, { transform: coerceBooleanProperty });
317
+ /**
318
+ * 拖拽的最大宽度
319
+ */
320
+ this.thyDragMaxWidth = input(undefined, { transform: numberAttribute });
321
+ /**
322
+ * 拖拽的最小宽度
323
+ */
324
+ this.thyDragMinWidth = input(undefined, { transform: numberAttribute });
335
325
  /**
336
326
  * 展示收起的触发器自定义模板,默认显示展开收起的圆形图标,设置为 null 表示不展示触发元素,手动控制展开收起状态
337
327
  * @type null | undefined | TemplateRef<any>
338
328
  * @default undefined
339
329
  */
340
- this.thyTrigger = undefined;
330
+ this.thyTrigger = input(undefined);
341
331
  /**
342
332
  * 收起状态改变后的事件
343
333
  */
344
- this.thyCollapsedChange = new EventEmitter();
334
+ this.thyCollapsedChange = output();
345
335
  /**
346
336
  * 拖拽宽度的修改事件
347
337
  */
348
- this.thyDragWidthChange = new EventEmitter();
338
+ this.thyDragWidthChange = output();
339
+ /**
340
+ * 开启收起/展开功能
341
+ * @default false
342
+ */
343
+ this.thyCollapsible = input(false, { transform: coerceBooleanProperty });
344
+ /**
345
+ * 是否是收起
346
+ * @default false
347
+ */
348
+ this.thyCollapsed = input(false, { transform: coerceBooleanProperty });
349
+ this.collapsed = linkedSignal(() => this.thyCollapsed());
350
+ this.collapseVisible = computed(() => {
351
+ return this.isMouseEnter() && !this.collapsed() ? true : false;
352
+ });
349
353
  /**
350
354
  * 收起后的宽度
351
355
  */
352
- this.thyCollapsedWidth = SIDEBAR_COLLAPSED_WIDTH;
353
- this.isCollapsed = false;
356
+ this.thyCollapsedWidth = input(SIDEBAR_COLLAPSED_WIDTH, { transform: numberAttribute });
357
+ /**
358
+ * 默认宽度,双击后可恢复到此宽度,默认是 240px,传入 lg 大小时宽度是300px
359
+ */
360
+ this.thyDefaultWidth = input(undefined, {
361
+ transform: (value) => {
362
+ if (value === 'lg') {
363
+ return LG_WIDTH;
364
+ }
365
+ return value;
366
+ }
367
+ });
368
+ this.collapseTip = computed(() => {
369
+ const collapseTip = this.collapsed() ? this.locale().expand : this.locale().collapse;
370
+ return collapseTip + (isMacPlatform() ? `(⌘ + /)` : `(Ctrl + /)`);
371
+ });
354
372
  this.originWidth = SIDEBAR_DEFAULT_WIDTH;
373
+ this.collapseHidden = signal(false);
374
+ this.isRemoveTransition = signal(false);
375
+ this.isResizable = signal(false);
376
+ this.dragMinWidth = computed(() => {
377
+ return this.thyDragMinWidth() || this.thyCollapsedWidth();
378
+ });
379
+ effect(() => {
380
+ const collapsible = this.thyCollapsible();
381
+ if (collapsible) {
382
+ this.subscribeHotkeyEvent();
383
+ }
384
+ else {
385
+ this.hotkeySubscription?.unsubscribe();
386
+ }
387
+ });
355
388
  }
356
- get sidebarWidth() {
357
- if (this.thyCollapsible && this.thyCollapsed) {
358
- return this.thyCollapsedWidth;
359
- }
360
- else {
361
- return this.sidebarDirective.thyLayoutSidebarWidth;
362
- }
363
- }
364
- mouseenter($event) {
365
- this.resizeHandleHover($event, 'enter');
366
- }
367
- mouseleave($event) {
368
- this.resizeHandleHover($event, 'leave');
369
- }
370
- /**
371
- * 开启收起/展开功能
372
- * @default false
373
- */
374
- set thyCollapsible(collapsible) {
375
- this.collapsible = collapsible;
376
- if (this.collapsible) {
377
- this.subscribeHotkeyEvent();
378
- }
379
- else {
380
- this.hotkeySubscription?.unsubscribe();
381
- }
382
- }
383
- get thyCollapsible() {
384
- return this.collapsible;
385
- }
386
- /**
387
- * 是否是收起
388
- * @default false
389
- */
390
- set thyCollapsed(value) {
391
- this.isCollapsed = value;
392
- }
393
- get thyCollapsed() {
394
- return this.isCollapsed;
395
- }
396
- get collapseVisibility() {
397
- return this.thyCollapsed;
398
- }
399
- get removeTransition() {
400
- return this.isRemoveTransition;
401
- }
402
- get dragMinWidth() {
403
- return this.thyDragMinWidth || this.thyCollapsedWidth;
404
- }
405
- ngOnInit() {
406
- this.updateCollapseTip();
407
- }
389
+ ngOnInit() { }
408
390
  subscribeHotkeyEvent() {
409
391
  this.hotkeySubscription = this.hotkeyDispatcher.keydown(['Control+/', 'Meta+/']).subscribe(() => {
410
392
  this.toggleCollapse();
411
393
  });
412
394
  }
413
- updateCollapseTip() {
414
- this.collapseTip = this.thyCollapsed ? this.locale().expand : this.locale().collapse;
415
- this.collapseTip = this.collapseTip + (isMacPlatform() ? `(⌘ + /)` : `(Ctrl + /)`);
416
- }
417
395
  resizeHandler({ width }) {
418
- if (width === this.sidebarDirective.thyLayoutSidebarWidth) {
396
+ if (width === this.sidebarDirective.sidebarWidth()) {
419
397
  return;
420
398
  }
421
- if (this.thyCollapsible && width < this.thyCollapsedWidth) {
399
+ if (this.thyCollapsible() && width < this.thyCollapsedWidth()) {
422
400
  return;
423
401
  }
424
- if (this.thyCollapsible && width === this.thyCollapsedWidth) {
425
- this.thyCollapsed = true;
426
- setTimeout(() => this.updateCollapseTip(), 200);
427
- this.thyCollapsedChange.emit(this.isCollapsed);
428
- this.sidebarDirective.thyLayoutSidebarWidth = this.originWidth;
429
- this.collapseVisible = false;
402
+ if (this.thyCollapsible() && width === this.thyCollapsedWidth()) {
403
+ this.collapsed.set(true);
404
+ this.thyCollapsedChange.emit(this.collapsed());
405
+ this.sidebarDirective.sidebarWidth.set(this.originWidth);
406
+ this.isMouseEnter.set(false);
430
407
  return;
431
408
  }
432
- this.sidebarDirective.thyLayoutSidebarWidth = width;
409
+ this.sidebarDirective.sidebarWidth.set(width);
433
410
  this.thyDragWidthChange.emit(width);
434
411
  }
435
412
  resizeStart() {
436
- this.originWidth = this.sidebarDirective.thyLayoutSidebarWidth;
437
- this.collapseHidden = true;
438
- this.isRemoveTransition = true;
413
+ this.originWidth = this.sidebarDirective.sidebarWidth();
414
+ this.collapseHidden.set(true);
415
+ this.isRemoveTransition.set(true);
439
416
  }
440
417
  resizeEnd() {
441
- this.collapseHidden = false;
442
- this.isRemoveTransition = false;
443
- }
444
- resizeHandleHover(event, type) {
445
- this.collapseVisible = type === 'enter' && !this.thyCollapsed ? true : false;
418
+ this.collapseHidden.set(false);
419
+ this.isRemoveTransition.set(false);
446
420
  }
447
421
  toggleCollapse(event) {
448
- this.thyCollapsed = !this.thyCollapsed;
449
- setTimeout(() => this.updateCollapseTip(), 200);
450
- this.thyCollapsedChange.emit(this.isCollapsed);
422
+ this.collapsed.update((value) => {
423
+ return !value;
424
+ });
425
+ this.thyCollapsedChange.emit(this.collapsed());
451
426
  }
452
427
  toggleResizable(event, type) {
453
- this.isResizable = type === 'enter' ? true : false;
428
+ this.isResizable.set(type === 'enter' ? true : false);
454
429
  }
455
430
  restoreToDefaultWidth() {
456
- if (this.thyDefaultWidth === 'lg') {
457
- this.thyDefaultWidth = LG_WIDTH;
458
- }
459
- this.sidebarDirective.thyLayoutSidebarWidth = this.thyDefaultWidth || SIDEBAR_DEFAULT_WIDTH;
460
- this.thyDragWidthChange.emit(this.sidebarDirective.thyLayoutSidebarWidth);
431
+ const thyDefaultWidth = this.thyDefaultWidth();
432
+ this.sidebarDirective.sidebarWidth.set(thyDefaultWidth || SIDEBAR_DEFAULT_WIDTH);
433
+ this.thyDragWidthChange.emit(this.sidebarDirective.sidebarWidth());
461
434
  }
462
435
  ngOnDestroy() {
463
436
  this.hotkeySubscription?.unsubscribe();
464
437
  }
465
438
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThySidebar, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
466
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThySidebar, isStandalone: true, selector: "thy-sidebar", inputs: { thyDraggable: ["thyDraggable", "thyDraggable", coerceBooleanProperty], thyDragMaxWidth: ["thyDragMaxWidth", "thyDragMaxWidth", numberAttribute], thyDragMinWidth: ["thyDragMinWidth", "thyDragMinWidth", numberAttribute], thyTrigger: "thyTrigger", thyCollapsible: ["thyCollapsible", "thyCollapsible", coerceBooleanProperty], thyCollapsed: ["thyCollapsed", "thyCollapsed", coerceBooleanProperty], thyCollapsedWidth: ["thyCollapsedWidth", "thyCollapsedWidth", numberAttribute], thyDefaultWidth: "thyDefaultWidth" }, outputs: { thyCollapsedChange: "thyCollapsedChange", thyDragWidthChange: "thyDragWidthChange" }, host: { listeners: { "mouseenter": "mouseenter($event)", "mouseleave": "mouseleave($event)" }, properties: { "style.width.px": "this.sidebarWidth", "class.sidebar-collapse-show": "this.collapseVisibility", "class.remove-transition": "this.removeTransition" } }, hostDirectives: [{ directive: ThySidebarDirective, inputs: ["thyTheme", "thyTheme", "thyDirection", "thyDirection", "thyWidth", "thyWidth", "thyIsolated", "thyIsolated", "thyDivided", "thyDivided", "thyHasBorderLeft", "thyHasBorderLeft", "thyHasBorderRight", "thyHasBorderRight"] }], ngImport: i0, template: `
439
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThySidebar, isStandalone: true, selector: "thy-sidebar", inputs: { thyDraggable: { classPropertyName: "thyDraggable", publicName: "thyDraggable", isSignal: true, isRequired: false, transformFunction: null }, thyDragMaxWidth: { classPropertyName: "thyDragMaxWidth", publicName: "thyDragMaxWidth", isSignal: true, isRequired: false, transformFunction: null }, thyDragMinWidth: { classPropertyName: "thyDragMinWidth", publicName: "thyDragMinWidth", isSignal: true, isRequired: false, transformFunction: null }, thyTrigger: { classPropertyName: "thyTrigger", publicName: "thyTrigger", isSignal: true, isRequired: false, transformFunction: null }, thyCollapsible: { classPropertyName: "thyCollapsible", publicName: "thyCollapsible", isSignal: true, isRequired: false, transformFunction: null }, thyCollapsed: { classPropertyName: "thyCollapsed", publicName: "thyCollapsed", isSignal: true, isRequired: false, transformFunction: null }, thyCollapsedWidth: { classPropertyName: "thyCollapsedWidth", publicName: "thyCollapsedWidth", isSignal: true, isRequired: false, transformFunction: null }, thyDefaultWidth: { classPropertyName: "thyDefaultWidth", publicName: "thyDefaultWidth", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { thyCollapsedChange: "thyCollapsedChange", thyDragWidthChange: "thyDragWidthChange" }, host: { listeners: { "mouseenter": "mouseenter($event)", "mouseleave": "mouseleave($event)" }, properties: { "class.sidebar-collapse-show": "collapsed()", "class.remove-transition": "isRemoveTransition()", "style.width.px": "sidebarWidth()" } }, hostDirectives: [{ directive: ThySidebarDirective, inputs: ["thyTheme", "thyTheme", "thyDirection", "thyDirection", "thyWidth", "thyWidth", "thyIsolated", "thyIsolated", "thyDivided", "thyDivided"] }], ngImport: i0, template: `
467
440
  <ng-content></ng-content>
468
- @if (thyDraggable) {
441
+ @if (thyDraggable()) {
469
442
  <div
470
443
  thyResizable
471
444
  class="sidebar-drag"
472
445
  thyBounds="window"
473
- [thyMaxWidth]="thyDragMaxWidth"
474
- [thyMinWidth]="dragMinWidth"
446
+ [thyMaxWidth]="thyDragMaxWidth()"
447
+ [thyMinWidth]="dragMinWidth()"
475
448
  (thyResize)="resizeHandler($event)"
476
449
  (thyResizeStart)="resizeStart()"
477
450
  (thyResizeEnd)="resizeEnd()"
478
- [style.display]="!isResizable ? 'contents' : null">
479
- @if (!thyCollapsed) {
451
+ [style.display]="!isResizable() ? 'contents' : null">
452
+ @if (!collapsed()) {
480
453
  <thy-resize-handle
481
- [thyDirection]="sidebarDirective.thyDirection === 'right' ? 'left' : 'right'"
454
+ [thyDirection]="sidebarDirective.thyDirection() === 'right' ? 'left' : 'right'"
482
455
  class="sidebar-resize-handle"
483
456
  thyLine="true"
484
457
  (mouseenter)="toggleResizable($event, 'enter')"
@@ -488,20 +461,21 @@ class ThySidebar {
488
461
  }
489
462
  </div>
490
463
  }
491
- @if (thyCollapsible) {
464
+ @if (thyCollapsible()) {
492
465
  <div class="sidebar-collapse-line"></div>
493
- }
494
- @if (thyCollapsible && thyTrigger !== null) {
495
- <div
496
- class="sidebar-collapse"
497
- [ngClass]="{ 'collapse-visible': collapseVisible, 'collapse-hidden': collapseHidden }"
498
- (click)="toggleCollapse($event)"
499
- [thyTooltip]="!thyTrigger && collapseTip">
500
- <ng-template [ngTemplateOutlet]="thyTrigger || defaultTrigger"></ng-template>
501
- <ng-template #defaultTrigger>
502
- <thy-icon class="sidebar-collapse-icon" [thyIconName]="this.thyCollapsed ? 'indent' : 'outdent'"></thy-icon>
503
- </ng-template>
504
- </div>
466
+
467
+ @if (thyTrigger() !== null) {
468
+ <div
469
+ class="sidebar-collapse"
470
+ [ngClass]="{ 'collapse-visible': collapseVisible(), 'collapse-hidden': collapseHidden() }"
471
+ (click)="toggleCollapse($event)"
472
+ [thyTooltip]="!thyTrigger() && collapseTip()">
473
+ <ng-template [ngTemplateOutlet]="thyTrigger() || defaultTrigger"></ng-template>
474
+ <ng-template #defaultTrigger>
475
+ <thy-icon class="sidebar-collapse-icon" [thyIconName]="this.collapsed ? 'indent' : 'outdent'"></thy-icon>
476
+ </ng-template>
477
+ </div>
478
+ }
505
479
  }
506
480
  `, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: ThyResizeHandle, selector: "thy-resize-handle, [thy-resize-handle]", inputs: ["thyDirection", "thyLine"], outputs: ["thyMouseDown"], exportAs: ["thyResizeHandle"] }, { kind: "directive", type: ThyResizableDirective, selector: "[thyResizable]", inputs: ["thyBounds", "thyMaxHeight", "thyMaxWidth", "thyMinHeight", "thyMinWidth", "thyGridColumnCount", "thyMaxColumn", "thyMinColumn", "thyLockAspectRatio", "thyPreview", "thyDisabled"], outputs: ["thyResize", "thyResizeStart", "thyResizeEnd"] }, { kind: "component", type: ThyIcon, selector: "thy-icon, [thy-icon]", inputs: ["thyIconType", "thyTwotoneColor", "thyIconName", "thyIconRotate", "thyIconSet", "thyIconLegging", "thyIconLinearGradient"] }, { kind: "directive", type: ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }] }); }
507
481
  }
@@ -512,20 +486,20 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
512
486
  preserveWhitespaces: false,
513
487
  template: `
514
488
  <ng-content></ng-content>
515
- @if (thyDraggable) {
489
+ @if (thyDraggable()) {
516
490
  <div
517
491
  thyResizable
518
492
  class="sidebar-drag"
519
493
  thyBounds="window"
520
- [thyMaxWidth]="thyDragMaxWidth"
521
- [thyMinWidth]="dragMinWidth"
494
+ [thyMaxWidth]="thyDragMaxWidth()"
495
+ [thyMinWidth]="dragMinWidth()"
522
496
  (thyResize)="resizeHandler($event)"
523
497
  (thyResizeStart)="resizeStart()"
524
498
  (thyResizeEnd)="resizeEnd()"
525
- [style.display]="!isResizable ? 'contents' : null">
526
- @if (!thyCollapsed) {
499
+ [style.display]="!isResizable() ? 'contents' : null">
500
+ @if (!collapsed()) {
527
501
  <thy-resize-handle
528
- [thyDirection]="sidebarDirective.thyDirection === 'right' ? 'left' : 'right'"
502
+ [thyDirection]="sidebarDirective.thyDirection() === 'right' ? 'left' : 'right'"
529
503
  class="sidebar-resize-handle"
530
504
  thyLine="true"
531
505
  (mouseenter)="toggleResizable($event, 'enter')"
@@ -535,71 +509,42 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
535
509
  }
536
510
  </div>
537
511
  }
538
- @if (thyCollapsible) {
512
+ @if (thyCollapsible()) {
539
513
  <div class="sidebar-collapse-line"></div>
540
- }
541
- @if (thyCollapsible && thyTrigger !== null) {
542
- <div
543
- class="sidebar-collapse"
544
- [ngClass]="{ 'collapse-visible': collapseVisible, 'collapse-hidden': collapseHidden }"
545
- (click)="toggleCollapse($event)"
546
- [thyTooltip]="!thyTrigger && collapseTip">
547
- <ng-template [ngTemplateOutlet]="thyTrigger || defaultTrigger"></ng-template>
548
- <ng-template #defaultTrigger>
549
- <thy-icon class="sidebar-collapse-icon" [thyIconName]="this.thyCollapsed ? 'indent' : 'outdent'"></thy-icon>
550
- </ng-template>
551
- </div>
514
+
515
+ @if (thyTrigger() !== null) {
516
+ <div
517
+ class="sidebar-collapse"
518
+ [ngClass]="{ 'collapse-visible': collapseVisible(), 'collapse-hidden': collapseHidden() }"
519
+ (click)="toggleCollapse($event)"
520
+ [thyTooltip]="!thyTrigger() && collapseTip()">
521
+ <ng-template [ngTemplateOutlet]="thyTrigger() || defaultTrigger"></ng-template>
522
+ <ng-template #defaultTrigger>
523
+ <thy-icon class="sidebar-collapse-icon" [thyIconName]="this.collapsed ? 'indent' : 'outdent'"></thy-icon>
524
+ </ng-template>
525
+ </div>
526
+ }
552
527
  }
553
528
  `,
554
529
  hostDirectives: [
555
530
  {
556
531
  directive: ThySidebarDirective,
557
- inputs: ['thyTheme', 'thyDirection', 'thyWidth', 'thyIsolated', 'thyDivided', 'thyHasBorderLeft', 'thyHasBorderRight']
532
+ inputs: ['thyTheme', 'thyDirection', 'thyWidth', 'thyIsolated', 'thyDivided']
558
533
  }
559
534
  ],
560
- imports: [NgTemplateOutlet, ThyResizeHandle, ThyResizableDirective, ThyIcon, ThyTooltipDirective, NgClass]
535
+ imports: [NgTemplateOutlet, ThyResizeHandle, ThyResizableDirective, ThyIcon, ThyTooltipDirective, NgClass],
536
+ host: {
537
+ '[class.sidebar-collapse-show]': 'collapsed()',
538
+ '[class.remove-transition]': 'isRemoveTransition()',
539
+ '[style.width.px]': 'sidebarWidth()'
540
+ }
561
541
  }]
562
- }], propDecorators: { sidebarWidth: [{
563
- type: HostBinding,
564
- args: ['style.width.px']
565
- }], mouseenter: [{
542
+ }], ctorParameters: () => [], propDecorators: { mouseenter: [{
566
543
  type: HostListener,
567
544
  args: ['mouseenter', ['$event']]
568
545
  }], mouseleave: [{
569
546
  type: HostListener,
570
547
  args: ['mouseleave', ['$event']]
571
- }], thyDraggable: [{
572
- type: Input,
573
- args: [{ transform: coerceBooleanProperty }]
574
- }], thyDragMaxWidth: [{
575
- type: Input,
576
- args: [{ transform: numberAttribute }]
577
- }], thyDragMinWidth: [{
578
- type: Input,
579
- args: [{ transform: numberAttribute }]
580
- }], thyTrigger: [{
581
- type: Input
582
- }], thyCollapsedChange: [{
583
- type: Output
584
- }], thyDragWidthChange: [{
585
- type: Output
586
- }], thyCollapsible: [{
587
- type: Input,
588
- args: [{ transform: coerceBooleanProperty }]
589
- }], thyCollapsed: [{
590
- type: Input,
591
- args: [{ transform: coerceBooleanProperty }]
592
- }], thyCollapsedWidth: [{
593
- type: Input,
594
- args: [{ transform: numberAttribute }]
595
- }], thyDefaultWidth: [{
596
- type: Input
597
- }], collapseVisibility: [{
598
- type: HostBinding,
599
- args: ['class.sidebar-collapse-show']
600
- }], removeTransition: [{
601
- type: HostBinding,
602
- args: ['class.remove-transition']
603
548
  }] } });
604
549
 
605
550
  /**
@@ -684,8 +629,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
684
629
  * @order 25
685
630
  */
686
631
  class ThySidebarHeaderDirective {
632
+ constructor() {
633
+ /**
634
+ * 是否有分割线
635
+ * @default false
636
+ */
637
+ this.thyDivided = input(false, { transform: coerceBooleanProperty });
638
+ }
687
639
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThySidebarHeaderDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
688
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "19.2.8", type: ThySidebarHeaderDirective, isStandalone: true, selector: "[thySidebarHeader]", inputs: { thyDivided: ["thyDivided", "thyDivided", coerceBooleanProperty] }, host: { properties: { "class.sidebar-header-divided": "thyDivided" }, classAttribute: "sidebar-header" }, ngImport: i0 }); }
640
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: ThySidebarHeaderDirective, isStandalone: true, selector: "[thySidebarHeader]", inputs: { thyDivided: { classPropertyName: "thyDivided", publicName: "thyDivided", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.sidebar-header-divided": "thyDivided()" }, classAttribute: "sidebar-header" }, ngImport: i0 }); }
689
641
  }
690
642
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThySidebarHeaderDirective, decorators: [{
691
643
  type: Directive,
@@ -693,21 +645,34 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
693
645
  selector: '[thySidebarHeader]',
694
646
  host: {
695
647
  class: 'sidebar-header',
696
- '[class.sidebar-header-divided]': 'thyDivided'
648
+ '[class.sidebar-header-divided]': 'thyDivided()'
697
649
  }
698
650
  }]
699
- }], propDecorators: { thyDivided: [{
700
- type: Input,
701
- args: [{ transform: coerceBooleanProperty }]
702
- }] } });
651
+ }], ctorParameters: () => [] });
703
652
  /**
704
653
  * 侧边栏头部布局组件
705
654
  * @name thy-sidebar-header
706
655
  * @order 26
707
656
  */
708
657
  class ThySidebarHeader {
658
+ constructor() {
659
+ /**
660
+ * 头部标题
661
+ */
662
+ this.thyTitle = input(undefined);
663
+ /**
664
+ * 头部自定义操作模板,`<ng-template #headerOperation></ng-template>`
665
+ * @type TemplateRef
666
+ */
667
+ this.operationTemplateRef = contentChild('headerOperation');
668
+ /**
669
+ * 头部自定义标题模板,`<ng-template #headerTitle></ng-template>`
670
+ * @type TemplateRef
671
+ */
672
+ this.titleTemplateRef = contentChild('headerTitle');
673
+ }
709
674
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThySidebarHeader, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
710
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThySidebarHeader, isStandalone: true, selector: "thy-sidebar-header", inputs: { thyTitle: "thyTitle" }, queries: [{ propertyName: "operationTemplateRef", first: true, predicate: ["headerOperation"], descendants: true }, { propertyName: "titleTemplateRef", first: true, predicate: ["headerTitle"], descendants: true }], hostDirectives: [{ directive: ThySidebarHeaderDirective, inputs: ["thyDivided", "thyDivided"] }], ngImport: i0, template: "@if (thyTitle || titleTemplateRef) {\n <span class=\"title\">\n @if (titleTemplateRef) {\n <ng-template [ngTemplateOutlet]=\"titleTemplateRef\"></ng-template>\n } @else {\n {{ thyTitle }}\n }\n </span>\n}\n<ng-content></ng-content>\n<div class=\"operation\">\n <ng-template [ngTemplateOutlet]=\"operationTemplateRef\"></ng-template>\n</div>\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
675
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThySidebarHeader, isStandalone: true, selector: "thy-sidebar-header", inputs: { thyTitle: { classPropertyName: "thyTitle", publicName: "thyTitle", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "operationTemplateRef", first: true, predicate: ["headerOperation"], descendants: true, isSignal: true }, { propertyName: "titleTemplateRef", first: true, predicate: ["headerTitle"], descendants: true, isSignal: true }], hostDirectives: [{ directive: ThySidebarHeaderDirective, inputs: ["thyDivided", "thyDivided"] }], ngImport: i0, template: "@if (thyTitle() || titleTemplateRef()) {\n <span class=\"title\">\n @if (titleTemplateRef()) {\n <ng-template [ngTemplateOutlet]=\"titleTemplateRef()\"></ng-template>\n } @else {\n {{ thyTitle() }}\n }\n </span>\n}\n<ng-content></ng-content>\n<div class=\"operation\">\n <ng-template [ngTemplateOutlet]=\"operationTemplateRef()\"></ng-template>\n</div>\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
711
676
  }
712
677
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThySidebarHeader, decorators: [{
713
678
  type: Component,
@@ -716,16 +681,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
716
681
  directive: ThySidebarHeaderDirective,
717
682
  inputs: ['thyDivided']
718
683
  }
719
- ], imports: [NgTemplateOutlet], template: "@if (thyTitle || titleTemplateRef) {\n <span class=\"title\">\n @if (titleTemplateRef) {\n <ng-template [ngTemplateOutlet]=\"titleTemplateRef\"></ng-template>\n } @else {\n {{ thyTitle }}\n }\n </span>\n}\n<ng-content></ng-content>\n<div class=\"operation\">\n <ng-template [ngTemplateOutlet]=\"operationTemplateRef\"></ng-template>\n</div>\n" }]
720
- }], propDecorators: { thyTitle: [{
721
- type: Input
722
- }], operationTemplateRef: [{
723
- type: ContentChild,
724
- args: ['headerOperation']
725
- }], titleTemplateRef: [{
726
- type: ContentChild,
727
- args: ['headerTitle']
728
- }] } });
684
+ ], imports: [NgTemplateOutlet], template: "@if (thyTitle() || titleTemplateRef()) {\n <span class=\"title\">\n @if (titleTemplateRef()) {\n <ng-template [ngTemplateOutlet]=\"titleTemplateRef()\"></ng-template>\n } @else {\n {{ thyTitle() }}\n }\n </span>\n}\n<ng-content></ng-content>\n<div class=\"operation\">\n <ng-template [ngTemplateOutlet]=\"operationTemplateRef()\"></ng-template>\n</div>\n" }]
685
+ }] });
729
686
 
730
687
  /**
731
688
  * 侧边栏底部布局指令