ngx-tethys 19.0.13 → 19.1.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -2
- package/action/action.component.d.ts +12 -20
- package/action/actions.component.d.ts +5 -7
- package/affix/affix.component.d.ts +7 -10
- package/alert/alert.component.d.ts +1 -1
- package/anchor/anchor-link.component.d.ts +8 -8
- package/anchor/anchor.component.d.ts +15 -21
- package/arrow-switcher/arrow-switcher.component.d.ts +15 -22
- package/autocomplete/autocomplete.component.d.ts +10 -17
- package/autocomplete/autocomplete.trigger.directive.d.ts +10 -18
- package/avatar/avatar-list/avatar-list.component.d.ts +8 -14
- package/avatar/avatar.component.d.ts +25 -39
- package/back-top/back-top.component.d.ts +9 -12
- package/badge/badge.component.d.ts +19 -59
- package/breadcrumb/breadcrumb.component.d.ts +15 -20
- package/button/button-icon.component.d.ts +3 -2
- package/button/button.component.d.ts +3 -2
- package/calendar/calendar-header.component.d.ts +9 -8
- package/calendar/calendar.component.d.ts +16 -16
- package/card/card.component.d.ts +5 -11
- package/card/content.component.d.ts +3 -8
- package/card/header.component.d.ts +7 -8
- package/carousel/carousel.component.d.ts +22 -27
- package/cascader/cascader-li.component.d.ts +13 -21
- package/cascader/cascader-search-option.component.d.ts +8 -16
- package/cascader/cascader.component.d.ts +58 -80
- package/checkbox/checkbox.component.d.ts +2 -5
- package/collapse/collapse-item.component.d.ts +12 -19
- package/collapse/collapse.component.d.ts +6 -12
- package/collapse/collapse.token.d.ts +3 -3
- package/color-picker/color-picker-custom-panel.component.d.ts +5 -5
- package/color-picker/color-picker-panel.component.d.ts +7 -11
- package/color-picker/color-picker.component.d.ts +19 -35
- package/color-picker/parts/alpha/alpha.component.d.ts +8 -8
- package/color-picker/parts/hue/hue.component.d.ts +6 -6
- package/color-picker/parts/indicator/indicator.component.d.ts +4 -3
- package/color-picker/parts/inputs/inputs.component.d.ts +9 -9
- package/color-picker/parts/saturation/saturation.component.d.ts +9 -9
- package/comment/comment.component.d.ts +4 -5
- package/copy/copy.directive.d.ts +8 -9
- package/date-picker/abstract-picker.component.d.ts +8 -7
- package/date-picker/lib/calendar/calendar-footer.component.d.ts +2 -1
- package/date-picker/lib/popups/inner-popup.component.d.ts +2 -1
- package/date-picker/picker.component.d.ts +2 -1
- package/date-range/date-range.component.d.ts +2 -2
- package/dialog/body/dialog-body.component.d.ts +2 -6
- package/dialog/confirm/confirm.component.d.ts +2 -2
- package/dialog/footer/dialog-footer.component.d.ts +6 -9
- package/dialog/header/dialog-header.component.d.ts +9 -11
- package/divider/divider.component.d.ts +12 -16
- package/dot/dot.component.d.ts +5 -13
- package/drag-drop/drag-handle.directive.d.ts +2 -1
- package/drag-drop/drag.directive.d.ts +2 -1
- package/drag-drop/drop-container.directive.d.ts +2 -1
- package/dropdown/dropdown-menu-item.directive.d.ts +3 -2
- package/dropdown/dropdown-menu.component.d.ts +2 -1
- package/dropdown/dropdown.directive.d.ts +2 -1
- package/empty/empty.component.d.ts +21 -27
- package/fesm2022/ngx-tethys-action.mjs +54 -91
- package/fesm2022/ngx-tethys-action.mjs.map +1 -1
- package/fesm2022/ngx-tethys-affix.mjs +29 -26
- package/fesm2022/ngx-tethys-affix.mjs.map +1 -1
- package/fesm2022/ngx-tethys-anchor.mjs +91 -118
- package/fesm2022/ngx-tethys-anchor.mjs.map +1 -1
- package/fesm2022/ngx-tethys-arrow-switcher.mjs +51 -77
- package/fesm2022/ngx-tethys-arrow-switcher.mjs.map +1 -1
- package/fesm2022/ngx-tethys-autocomplete.mjs +69 -103
- package/fesm2022/ngx-tethys-autocomplete.mjs.map +1 -1
- package/fesm2022/ngx-tethys-avatar.mjs +117 -162
- package/fesm2022/ngx-tethys-avatar.mjs.map +1 -1
- package/fesm2022/ngx-tethys-back-top.mjs +33 -46
- package/fesm2022/ngx-tethys-back-top.mjs.map +1 -1
- package/fesm2022/ngx-tethys-badge.mjs +104 -208
- package/fesm2022/ngx-tethys-badge.mjs.map +1 -1
- package/fesm2022/ngx-tethys-breadcrumb.mjs +66 -70
- package/fesm2022/ngx-tethys-breadcrumb.mjs.map +1 -1
- package/fesm2022/ngx-tethys-calendar.mjs +85 -87
- package/fesm2022/ngx-tethys-calendar.mjs.map +1 -1
- package/fesm2022/ngx-tethys-card.mjs +72 -77
- package/fesm2022/ngx-tethys-card.mjs.map +1 -1
- package/fesm2022/ngx-tethys-carousel.mjs +82 -99
- package/fesm2022/ngx-tethys-carousel.mjs.map +1 -1
- package/fesm2022/ngx-tethys-cascader.mjs +313 -468
- package/fesm2022/ngx-tethys-cascader.mjs.map +1 -1
- package/fesm2022/ngx-tethys-checkbox.mjs +10 -17
- package/fesm2022/ngx-tethys-checkbox.mjs.map +1 -1
- package/fesm2022/ngx-tethys-collapse.mjs +66 -71
- package/fesm2022/ngx-tethys-collapse.mjs.map +1 -1
- package/fesm2022/ngx-tethys-color-picker.mjs +187 -246
- package/fesm2022/ngx-tethys-color-picker.mjs.map +1 -1
- package/fesm2022/ngx-tethys-comment.mjs +16 -10
- package/fesm2022/ngx-tethys-comment.mjs.map +1 -1
- package/fesm2022/ngx-tethys-copy.mjs +25 -28
- package/fesm2022/ngx-tethys-copy.mjs.map +1 -1
- package/fesm2022/ngx-tethys-dialog.mjs +81 -82
- package/fesm2022/ngx-tethys-dialog.mjs.map +1 -1
- package/fesm2022/ngx-tethys-divider.mjs +49 -58
- package/fesm2022/ngx-tethys-divider.mjs.map +1 -1
- package/fesm2022/ngx-tethys-dot.mjs +45 -68
- package/fesm2022/ngx-tethys-dot.mjs.map +1 -1
- package/fesm2022/ngx-tethys-empty.mjs +107 -95
- package/fesm2022/ngx-tethys-empty.mjs.map +1 -1
- package/fesm2022/ngx-tethys-form.mjs +161 -200
- package/fesm2022/ngx-tethys-form.mjs.map +1 -1
- package/fesm2022/ngx-tethys-fullscreen.mjs +21 -23
- package/fesm2022/ngx-tethys-fullscreen.mjs.map +1 -1
- package/fesm2022/ngx-tethys-grid.mjs +160 -152
- package/fesm2022/ngx-tethys-grid.mjs.map +1 -1
- package/fesm2022/ngx-tethys-i18n.mjs +25 -25
- package/fesm2022/ngx-tethys-i18n.mjs.map +1 -1
- package/fesm2022/ngx-tethys-input-number.mjs +101 -114
- package/fesm2022/ngx-tethys-input-number.mjs.map +1 -1
- package/fesm2022/ngx-tethys-input.mjs +268 -271
- package/fesm2022/ngx-tethys-input.mjs.map +1 -1
- package/fesm2022/ngx-tethys-list.mjs +1 -1
- package/fesm2022/ngx-tethys-list.mjs.map +1 -1
- package/fesm2022/ngx-tethys-loading.mjs +17 -35
- package/fesm2022/ngx-tethys-loading.mjs.map +1 -1
- package/fesm2022/ngx-tethys-mention.mjs +52 -74
- package/fesm2022/ngx-tethys-mention.mjs.map +1 -1
- package/fesm2022/ngx-tethys-menu.mjs +106 -179
- package/fesm2022/ngx-tethys-menu.mjs.map +1 -1
- package/fesm2022/ngx-tethys-nav.mjs +169 -201
- package/fesm2022/ngx-tethys-nav.mjs.map +1 -1
- package/fesm2022/ngx-tethys-pagination.mjs +230 -294
- package/fesm2022/ngx-tethys-pagination.mjs.map +1 -1
- package/fesm2022/ngx-tethys-popover.mjs +67 -70
- package/fesm2022/ngx-tethys-popover.mjs.map +1 -1
- package/fesm2022/ngx-tethys-progress.mjs +196 -244
- package/fesm2022/ngx-tethys-progress.mjs.map +1 -1
- package/fesm2022/ngx-tethys-property.mjs +102 -105
- package/fesm2022/ngx-tethys-property.mjs.map +1 -1
- package/fesm2022/ngx-tethys-radio.mjs +34 -38
- package/fesm2022/ngx-tethys-radio.mjs.map +1 -1
- package/fesm2022/ngx-tethys-result.mjs +46 -28
- package/fesm2022/ngx-tethys-result.mjs.map +1 -1
- package/fesm2022/ngx-tethys-skeleton.mjs +339 -342
- package/fesm2022/ngx-tethys-skeleton.mjs.map +1 -1
- package/fesm2022/ngx-tethys-slider.mjs +75 -108
- package/fesm2022/ngx-tethys-slider.mjs.map +1 -1
- package/fesm2022/ngx-tethys-space.mjs +26 -46
- package/fesm2022/ngx-tethys-space.mjs.map +1 -1
- package/fesm2022/ngx-tethys-statistic.mjs +114 -151
- package/fesm2022/ngx-tethys-statistic.mjs.map +1 -1
- package/fesm2022/ngx-tethys-stepper.mjs +74 -107
- package/fesm2022/ngx-tethys-stepper.mjs.map +1 -1
- package/fesm2022/ngx-tethys-switch.mjs +80 -140
- package/fesm2022/ngx-tethys-switch.mjs.map +1 -1
- package/fesm2022/ngx-tethys-table.mjs +1 -1
- package/fesm2022/ngx-tethys-table.mjs.map +1 -1
- package/fesm2022/ngx-tethys-tabs.mjs +69 -87
- package/fesm2022/ngx-tethys-tabs.mjs.map +1 -1
- package/fesm2022/ngx-tethys-tag.mjs +42 -64
- package/fesm2022/ngx-tethys-tag.mjs.map +1 -1
- package/fesm2022/ngx-tethys-timeline.mjs +104 -129
- package/fesm2022/ngx-tethys-timeline.mjs.map +1 -1
- package/fesm2022/ngx-tethys-typography.mjs +36 -33
- package/fesm2022/ngx-tethys-typography.mjs.map +1 -1
- package/fesm2022/ngx-tethys-upload.mjs +91 -130
- package/fesm2022/ngx-tethys-upload.mjs.map +1 -1
- package/fesm2022/ngx-tethys-util.mjs.map +1 -1
- package/fesm2022/ngx-tethys-watermark.mjs +36 -40
- package/fesm2022/ngx-tethys-watermark.mjs.map +1 -1
- package/fesm2022/ngx-tethys.mjs +1 -1
- package/fesm2022/ngx-tethys.mjs.map +1 -1
- package/form/form-group-error/form-group-error.component.d.ts +2 -3
- package/form/form-group-label.directive.d.ts +2 -1
- package/form/form-group.component.d.ts +17 -24
- package/form/form-submit.directive.d.ts +2 -2
- package/form/form.directive.d.ts +6 -8
- package/form/from-group-footer/form-group-footer.component.d.ts +2 -2
- package/form/validator/confirm-validator.directive.d.ts +2 -2
- package/form/validator/unique-validator.directive.d.ts +2 -2
- package/fullscreen/fullscreen.component.d.ts +7 -7
- package/grid/flex.d.ts +14 -19
- package/grid/thy-col.directive.d.ts +6 -9
- package/grid/thy-grid-item.component.d.ts +3 -4
- package/grid/thy-grid.component.d.ts +11 -12
- package/grid/thy-row.directive.d.ts +12 -12
- package/icon/icon.component.d.ts +3 -2
- package/image/image.directive.d.ts +3 -2
- package/input/input-count.component.d.ts +4 -5
- package/input/input-group.component.d.ts +20 -20
- package/input/input-search.component.d.ts +15 -20
- package/input/input.component.d.ts +20 -21
- package/input/input.directive.d.ts +4 -6
- package/input-number/input-number.component.d.ts +21 -29
- package/layout/header.component.d.ts +4 -9
- package/layout/sidebar-header.component.d.ts +2 -1
- package/layout/sidebar.component.d.ts +8 -7
- package/list/list.component.d.ts +2 -1
- package/list/selection/selection-list.d.ts +4 -3
- package/loading/loading.component.d.ts +4 -10
- package/mention/mention.directive.d.ts +6 -7
- package/mention/suggestions/suggestions.component.d.ts +8 -9
- package/menu/group/menu-group.component.d.ts +16 -33
- package/menu/item/action/menu-item-action.component.d.ts +7 -8
- package/menu/item/icon/menu-item-icon.component.d.ts +2 -2
- package/menu/item/menu-item.component.d.ts +4 -4
- package/menu/item/name/menu-item-name.component.d.ts +2 -3
- package/menu/menu.component.d.ts +3 -7
- package/nav/icon-nav/icon-nav-link.directive.d.ts +3 -7
- package/nav/icon-nav/icon-nav.component.d.ts +3 -8
- package/nav/nav-ink-bar.directive.d.ts +4 -6
- package/nav/nav-item.directive.d.ts +7 -10
- package/nav/nav.component.d.ts +20 -48
- package/package.json +1 -1
- package/pagination/pagination.component.d.ts +48 -109
- package/popover/header/popover-header.component.d.ts +7 -6
- package/popover/popover.directive.d.ts +11 -18
- package/progress/progress-circle.component.d.ts +32 -21
- package/progress/progress-strip.component.d.ts +10 -14
- package/progress/progress.component.d.ts +15 -23
- package/property/examples/single/single.component.scss +6 -0
- package/property/properties.component.d.ts +6 -13
- package/property/property-item.component.d.ts +21 -26
- package/property/styles/properties.scss +124 -52
- package/property-operation/property-operation.component.d.ts +6 -5
- package/radio/button/radio-button.component.d.ts +2 -2
- package/radio/group/radio-group.component.d.ts +8 -7
- package/radio/radio.component.d.ts +2 -2
- package/radio/radio.token.d.ts +2 -2
- package/rate/rate-item.component.d.ts +2 -1
- package/rate/rate.component.d.ts +4 -3
- package/resizable/resizable.directive.d.ts +4 -9
- package/resizable/resize-handle.component.d.ts +2 -1
- package/resizable/resize-handles.component.d.ts +2 -1
- package/result/result.component.d.ts +9 -10
- package/schematics/version.d.ts +1 -1
- package/schematics/version.js +1 -1
- package/segment/segment-item.component.d.ts +2 -1
- package/segment/segment.component.d.ts +2 -1
- package/select/custom-select/custom-select.component.d.ts +11 -10
- package/select/native-select/native-select.component.d.ts +2 -1
- package/shared/base-form-check.component.d.ts +3 -2
- package/shared/directives/thy-autofocus.directive.d.ts +3 -2
- package/shared/directives/thy-scroll.directive.d.ts +2 -1
- package/shared/directives/thy-show.d.ts +2 -1
- package/shared/option/group/option-group.component.d.ts +2 -1
- package/shared/option/list-option/list-option.component.d.ts +2 -7
- package/shared/option/option.component.d.ts +2 -1
- package/shared/select/select-control/select-control.component.d.ts +7 -6
- package/skeleton/skeleton-circle.component.d.ts +16 -19
- package/skeleton/skeleton-rectangle.component.d.ts +20 -23
- package/skeleton/skeleton.component.d.ts +5 -6
- package/skeleton/stylized/bullet-list.component.d.ts +11 -13
- package/skeleton/stylized/list.component.d.ts +10 -12
- package/skeleton/stylized/paragraph.component.d.ts +12 -14
- package/slide/slide-body/slide-body-section.component.d.ts +2 -1
- package/slider/slider.component.d.ts +17 -24
- package/space/space.component.d.ts +8 -8
- package/statistic/statistic.component.d.ts +35 -40
- package/stepper/step-header.component.d.ts +6 -10
- package/stepper/step.component.d.ts +6 -6
- package/stepper/stepper.component.d.ts +15 -20
- package/switch/switch.component.d.ts +24 -35
- package/table/table-column.component.d.ts +6 -5
- package/table/table-skeleton.component.d.ts +3 -10
- package/table/table.component.d.ts +11 -10
- package/tabs/tab-content.component.d.ts +4 -4
- package/tabs/tab.component.d.ts +4 -5
- package/tabs/tabs.component.d.ts +13 -15
- package/tag/tag.component.d.ts +10 -16
- package/time-picker/time-picker-panel.component.d.ts +3 -2
- package/time-picker/time-picker.component.d.ts +6 -5
- package/timeline/timeline-item.component.d.ts +9 -13
- package/timeline/timeline.component.d.ts +13 -17
- package/tooltip/tooltip.directive.d.ts +3 -2
- package/tree/tree-node.component.d.ts +6 -15
- package/tree/tree.component.d.ts +8 -7
- package/tree-select/tree-select.component.d.ts +8 -7
- package/typography/bg-color.directive.d.ts +3 -3
- package/typography/text/text.component.d.ts +2 -2
- package/typography/text-color.directive.d.ts +3 -3
- package/upload/file-drop.directive.d.ts +9 -11
- package/upload/file-select-base.d.ts +6 -10
- package/upload/file-select.component.d.ts +10 -20
- package/util/helpers/helpers.d.ts +2 -1
- package/vote/vote.component.d.ts +4 -3
- package/watermark/watermark.directive.d.ts +7 -9
|
@@ -4,7 +4,7 @@ import { ThyInputModule } from 'ngx-tethys/input';
|
|
|
4
4
|
import { ThyTooltipDirective, ThyTooltipModule } from 'ngx-tethys/tooltip';
|
|
5
5
|
import { NgClass, NgTemplateOutlet, CommonModule } from '@angular/common';
|
|
6
6
|
import * as i0 from '@angular/core';
|
|
7
|
-
import { InjectionToken, Optional, Inject, Injectable, inject, ElementRef, Renderer2, NgZone, ContentChildren, HostBinding,
|
|
7
|
+
import { InjectionToken, Optional, Inject, Injectable, inject, ElementRef, Renderer2, NgZone, input, effect, ContentChildren, HostBinding, Directive, Input, ViewEncapsulation, Component, signal, computed, ContentChild, ChangeDetectionStrategy, output, HostListener, forwardRef, NgModule } from '@angular/core';
|
|
8
8
|
import { NgForm, FormGroupDirective, ControlContainer, NgControl, NG_ASYNC_VALIDATORS, Validators, NG_VALIDATORS, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
9
9
|
import { helpers, isUndefinedOrNull, keycodes, coerceBooleanProperty as coerceBooleanProperty$1 } from 'ngx-tethys/util';
|
|
10
10
|
import { useHostRenderer } from '@tethys/cdk/dom';
|
|
@@ -411,30 +411,11 @@ var ThyEnterKeyMode;
|
|
|
411
411
|
* @order 10
|
|
412
412
|
*/
|
|
413
413
|
class ThyFormDirective {
|
|
414
|
-
/**
|
|
415
|
-
* 布局,默认水平居中 horizontal,其他2种布局待开发
|
|
416
|
-
* @type horizontal | vertical | inline
|
|
417
|
-
* @default horizontal
|
|
418
|
-
*/
|
|
419
|
-
set thyLayout(value) {
|
|
420
|
-
if (value) {
|
|
421
|
-
this.layout = value;
|
|
422
|
-
if (this.initialized) {
|
|
423
|
-
this.updateClasses();
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
get thyLayout() {
|
|
428
|
-
return this.layout;
|
|
429
|
-
}
|
|
430
414
|
get isHorizontal() {
|
|
431
415
|
return this.layout === 'horizontal';
|
|
432
416
|
}
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
*/
|
|
436
|
-
set thyFormValidatorConfig(config) {
|
|
437
|
-
this.validator.setValidatorConfig(config);
|
|
417
|
+
get layout() {
|
|
418
|
+
return this.thyLayout() || this.config.layout;
|
|
438
419
|
}
|
|
439
420
|
constructor() {
|
|
440
421
|
this.ngForm = inject(ControlContainer);
|
|
@@ -443,17 +424,46 @@ class ThyFormDirective {
|
|
|
443
424
|
this.ngZone = inject(NgZone);
|
|
444
425
|
this.validator = inject(ThyFormValidatorService);
|
|
445
426
|
this.config = inject(THY_FORM_CONFIG);
|
|
446
|
-
this.initialized = false;
|
|
447
427
|
this.hostRenderer = useHostRenderer();
|
|
428
|
+
/**
|
|
429
|
+
* 布局,默认水平居中 horizontal,其他2种布局待开发
|
|
430
|
+
* @type horizontal | vertical | inline
|
|
431
|
+
* @default horizontal
|
|
432
|
+
*/
|
|
433
|
+
this.thyLayout = input(undefined);
|
|
434
|
+
/**
|
|
435
|
+
* Enter 键提交模式。`submit`: Textarea 需要 Ctrl | Command + Enter 提交,其他元素直接 Enter 提交; `alwaysSubmit`: 不管是什么元素 Enter 都提交; `forbidSubmit`: Enter 不提交
|
|
436
|
+
* @type submit | alwaysSubmit | forbidSubmit
|
|
437
|
+
* @default submit
|
|
438
|
+
*/
|
|
439
|
+
this.thyEnterKeyMode = input(undefined);
|
|
440
|
+
/**
|
|
441
|
+
* 表单验证规则配置项 (更多内容查看:thyFormValidatorConfig)
|
|
442
|
+
*/
|
|
443
|
+
this.thyFormValidatorConfig = input();
|
|
448
444
|
this.wasValidated = false;
|
|
449
|
-
|
|
445
|
+
effect(() => {
|
|
446
|
+
this.updateClasses();
|
|
447
|
+
});
|
|
448
|
+
effect(() => {
|
|
449
|
+
const config = this.thyFormValidatorConfig();
|
|
450
|
+
if (config) {
|
|
451
|
+
this.validator.setValidatorConfig(config);
|
|
452
|
+
}
|
|
453
|
+
});
|
|
454
|
+
// TODO:: replace ngAfterViewInit with afterNextRender
|
|
455
|
+
// afterNextRender(() => {
|
|
456
|
+
// this.validator.initialize(this.ngForm as NgForm, this.elementRef.nativeElement);
|
|
457
|
+
// this.validator.initializeFormControlsValidation(this.controls.toArray());
|
|
458
|
+
// this.controls.changes.subscribe(controls => {
|
|
459
|
+
// this.validator.initializeFormControlsValidation(this.controls.toArray());
|
|
460
|
+
// });
|
|
461
|
+
// });
|
|
450
462
|
}
|
|
451
463
|
ngOnInit() {
|
|
452
464
|
this.ngZone.runOutsideAngular(() => {
|
|
453
465
|
this._unsubscribe = this.renderer.listen(this.elementRef.nativeElement, 'keydown', this.onKeydown.bind(this));
|
|
454
466
|
});
|
|
455
|
-
this.updateClasses();
|
|
456
|
-
this.initialized = true;
|
|
457
467
|
}
|
|
458
468
|
ngAfterViewInit() {
|
|
459
469
|
this.validator.initialize(this.ngForm, this.elementRef.nativeElement);
|
|
@@ -473,9 +483,7 @@ class ThyFormDirective {
|
|
|
473
483
|
}
|
|
474
484
|
}
|
|
475
485
|
updateClasses() {
|
|
476
|
-
this.hostRenderer.updateClassByMap({
|
|
477
|
-
[`thy-form-${this.thyLayout}`]: true
|
|
478
|
-
});
|
|
486
|
+
this.hostRenderer.updateClassByMap({ [`thy-form-${this.layout}`]: true });
|
|
479
487
|
}
|
|
480
488
|
submitRunInZone($event) {
|
|
481
489
|
this.ngZone.run(() => {
|
|
@@ -486,7 +494,8 @@ class ThyFormDirective {
|
|
|
486
494
|
const currentInput = document.activeElement;
|
|
487
495
|
const key = $event.which || $event.keyCode;
|
|
488
496
|
if (key === keycodes.ENTER && currentInput.tagName) {
|
|
489
|
-
|
|
497
|
+
const thyEnterKeyMode = this.thyEnterKeyMode();
|
|
498
|
+
if (!thyEnterKeyMode || thyEnterKeyMode === ThyEnterKeyMode.submit) {
|
|
490
499
|
// TEXTAREA或包含[contenteditable]属性的元素 Ctrl + Enter 或者 Command + Enter 阻止默认行为并提交
|
|
491
500
|
if (currentInput.tagName === 'TEXTAREA' || coerceBooleanProperty(currentInput.getAttribute('contenteditable'))) {
|
|
492
501
|
if ($event.ctrlKey || $event.metaKey) {
|
|
@@ -500,7 +509,7 @@ class ThyFormDirective {
|
|
|
500
509
|
this.submitRunInZone($event);
|
|
501
510
|
}
|
|
502
511
|
}
|
|
503
|
-
else if (
|
|
512
|
+
else if (thyEnterKeyMode === ThyEnterKeyMode.alwaysSubmit) {
|
|
504
513
|
$event.preventDefault();
|
|
505
514
|
this.submitRunInZone($event);
|
|
506
515
|
}
|
|
@@ -516,32 +525,17 @@ class ThyFormDirective {
|
|
|
516
525
|
}
|
|
517
526
|
}
|
|
518
527
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyFormDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
519
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
528
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: ThyFormDirective, isStandalone: true, selector: "[thyForm],[thy-form]", inputs: { thyLayout: { classPropertyName: "thyLayout", publicName: "thyLayout", isSignal: true, isRequired: false, transformFunction: null }, thyEnterKeyMode: { classPropertyName: "thyEnterKeyMode", publicName: "thyEnterKeyMode", isSignal: true, isRequired: false, transformFunction: null }, thyFormValidatorConfig: { classPropertyName: "thyFormValidatorConfig", publicName: "thyFormValidatorConfig", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.was-validated": "this.wasValidated" }, classAttribute: "thy-form" }, providers: [ThyFormValidatorService], queries: [{ propertyName: "controls", predicate: NgControl, descendants: true }], exportAs: ["thyForm"], ngImport: i0 }); }
|
|
520
529
|
}
|
|
521
530
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyFormDirective, decorators: [{
|
|
522
531
|
type: Directive,
|
|
523
|
-
args: [{
|
|
524
|
-
|
|
525
|
-
providers: [ThyFormValidatorService],
|
|
526
|
-
exportAs: 'thyForm',
|
|
527
|
-
host: {
|
|
528
|
-
class: 'thy-form'
|
|
529
|
-
}
|
|
530
|
-
}]
|
|
531
|
-
}], ctorParameters: () => [], propDecorators: { thyLayout: [{
|
|
532
|
-
type: Input
|
|
533
|
-
}], thyEnterKeyMode: [{
|
|
534
|
-
type: Input
|
|
535
|
-
}], thyFormValidatorConfig: [{
|
|
536
|
-
type: Input
|
|
537
|
-
}], wasValidated: [{
|
|
532
|
+
args: [{ selector: '[thyForm],[thy-form]', providers: [ThyFormValidatorService], exportAs: 'thyForm', host: { class: 'thy-form' } }]
|
|
533
|
+
}], ctorParameters: () => [], propDecorators: { wasValidated: [{
|
|
538
534
|
type: HostBinding,
|
|
539
535
|
args: ['class.was-validated']
|
|
540
536
|
}], controls: [{
|
|
541
537
|
type: ContentChildren,
|
|
542
|
-
args: [NgControl, {
|
|
543
|
-
descendants: true
|
|
544
|
-
}]
|
|
538
|
+
args: [NgControl, { descendants: true }]
|
|
545
539
|
}] } });
|
|
546
540
|
|
|
547
541
|
/**
|
|
@@ -551,7 +545,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
551
545
|
class ThyFormGroupError {
|
|
552
546
|
constructor() {
|
|
553
547
|
this.thyParentForm = inject(ThyFormDirective, { optional: true });
|
|
554
|
-
this.thyShowFirst = true;
|
|
548
|
+
this.thyShowFirst = input(true, { transform: coerceBooleanProperty$1 });
|
|
555
549
|
this.isHorizontal = true;
|
|
556
550
|
}
|
|
557
551
|
/**
|
|
@@ -562,7 +556,7 @@ class ThyFormGroupError {
|
|
|
562
556
|
}
|
|
563
557
|
get thyErrors() {
|
|
564
558
|
const errors = this.errors || this.thyParentForm.validator.errors;
|
|
565
|
-
return errors && errors.length > 0 && this.thyShowFirst ? [errors[0]] : errors;
|
|
559
|
+
return errors && errors.length > 0 && this.thyShowFirst() ? [errors[0]] : errors;
|
|
566
560
|
}
|
|
567
561
|
get _isFormGroup() {
|
|
568
562
|
return this.thyErrors && this.thyErrors.length > 0;
|
|
@@ -573,15 +567,12 @@ class ThyFormGroupError {
|
|
|
573
567
|
}
|
|
574
568
|
}
|
|
575
569
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyFormGroupError, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
576
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyFormGroupError, isStandalone: true, selector: "thy-form-group-error", inputs: { thyShowFirst:
|
|
570
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyFormGroupError, isStandalone: true, selector: "thy-form-group-error", inputs: { thyShowFirst: { classPropertyName: "thyShowFirst", publicName: "thyShowFirst", isSignal: true, isRequired: false, transformFunction: null }, thyErrors: { classPropertyName: "thyErrors", publicName: "thyErrors", isSignal: false, isRequired: false, transformFunction: null } }, host: { properties: { "class.form-group": "this._isFormGroup", "class.row": "this.isHorizontal" } }, ngImport: i0, template: "<div [ngClass]=\"{ 'col-sm-10 offset-sm-2 col-form-control': isHorizontal }\">\n @for (error of thyErrors; track $index) {\n <thy-alert thyType=\"danger\" [thyMessage]=\"error\"></thy-alert>\n }\n</div>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: ThyAlert, selector: "thy-alert", inputs: ["thyType", "thyTheme", "thyMessage", "thyIcon", "thyCloseable"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
577
571
|
}
|
|
578
572
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyFormGroupError, decorators: [{
|
|
579
573
|
type: Component,
|
|
580
574
|
args: [{ selector: 'thy-form-group-error', encapsulation: ViewEncapsulation.None, imports: [NgClass, ThyAlert], template: "<div [ngClass]=\"{ 'col-sm-10 offset-sm-2 col-form-control': isHorizontal }\">\n @for (error of thyErrors; track $index) {\n <thy-alert thyType=\"danger\" [thyMessage]=\"error\"></thy-alert>\n }\n</div>\n" }]
|
|
581
|
-
}], propDecorators: {
|
|
582
|
-
type: Input,
|
|
583
|
-
args: [{ transform: coerceBooleanProperty$1 }]
|
|
584
|
-
}], thyErrors: [{
|
|
575
|
+
}], propDecorators: { thyErrors: [{
|
|
585
576
|
type: Input
|
|
586
577
|
}], _isFormGroup: [{
|
|
587
578
|
type: HostBinding,
|
|
@@ -636,7 +627,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
636
627
|
}] } });
|
|
637
628
|
|
|
638
629
|
const internalIconMap = {
|
|
639
|
-
date: '
|
|
630
|
+
date: 'calendar'
|
|
640
631
|
};
|
|
641
632
|
/**
|
|
642
633
|
* 表单分组组件
|
|
@@ -647,124 +638,100 @@ class ThyFormGroup {
|
|
|
647
638
|
constructor() {
|
|
648
639
|
this.thyParentForm = inject(ThyFormDirective, { optional: true });
|
|
649
640
|
this.thyTranslate = inject(ThyTranslate);
|
|
650
|
-
this.
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
this.
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
this.
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
641
|
+
this.isHorizontalSignal = signal(true);
|
|
642
|
+
/**
|
|
643
|
+
* Label 文本
|
|
644
|
+
*/
|
|
645
|
+
this.thyLabelText = input();
|
|
646
|
+
/**
|
|
647
|
+
* Label 文本多语言 Key
|
|
648
|
+
*/
|
|
649
|
+
this.thyLabelTextTranslateKey = input();
|
|
650
|
+
this.labelTextSignal = computed(() => {
|
|
651
|
+
const labelTextTranslateKey = this.thyLabelTextTranslateKey();
|
|
652
|
+
const labelText = this.thyLabelText();
|
|
653
|
+
if (labelText) {
|
|
654
|
+
return labelText;
|
|
655
|
+
}
|
|
656
|
+
else if (labelTextTranslateKey) {
|
|
657
|
+
return this.thyTranslate.instant(labelTextTranslateKey);
|
|
658
|
+
}
|
|
659
|
+
return '';
|
|
660
|
+
});
|
|
661
|
+
/**
|
|
662
|
+
* Label 是否显示必填项样式
|
|
663
|
+
*/
|
|
664
|
+
this.thyLabelRequired = input(false, {
|
|
665
|
+
transform: coerceBooleanProperty$1
|
|
666
|
+
});
|
|
667
|
+
/**
|
|
668
|
+
* 清楚 Label padding 间距
|
|
669
|
+
*/
|
|
670
|
+
this.thyLabelPaddingTopClear = input(false, {
|
|
671
|
+
transform: coerceBooleanProperty$1
|
|
672
|
+
});
|
|
673
|
+
/**
|
|
674
|
+
* 反馈图标,比如日期输入框显示日期的图标,常用输入 date 表示时间 wtf wtf-schedule-o
|
|
675
|
+
*/
|
|
676
|
+
this.thyFeedbackIcon = input('', {
|
|
677
|
+
transform: (value) => {
|
|
678
|
+
if (internalIconMap[value]) {
|
|
679
|
+
return internalIconMap[value];
|
|
680
|
+
}
|
|
681
|
+
return value;
|
|
682
|
+
}
|
|
683
|
+
});
|
|
684
|
+
/**
|
|
685
|
+
* 提示文字的显示模式,`label`模式表示在 label 后通过图标+Tooltip 提示, `default`模式在 Form Control 下方直接显示
|
|
686
|
+
* @type default | label
|
|
687
|
+
* @default default
|
|
688
|
+
*/
|
|
689
|
+
this.thyTipsMode = input('default');
|
|
690
|
+
/**
|
|
691
|
+
* 提示文案
|
|
692
|
+
*/
|
|
693
|
+
this.thyTips = input('');
|
|
694
|
+
/**
|
|
695
|
+
* 提示文案的多语言 Key
|
|
696
|
+
*/
|
|
697
|
+
this.thyTipsTranslateKey = input('');
|
|
698
|
+
this.tipsSignal = computed(() => {
|
|
699
|
+
const key = this.thyTipsTranslateKey();
|
|
700
|
+
const tips = this.thyTips();
|
|
701
|
+
if (key) {
|
|
702
|
+
return this.thyTranslate.instant(key);
|
|
703
|
+
}
|
|
704
|
+
if (tips) {
|
|
705
|
+
return tips;
|
|
706
|
+
}
|
|
707
|
+
return '';
|
|
708
|
+
});
|
|
709
|
+
/**
|
|
710
|
+
* 是否填充整行, 没有 Label 文本,只有输入框
|
|
711
|
+
* @default false
|
|
712
|
+
*/
|
|
713
|
+
this.thyRowFill = input(false, { transform: coerceBooleanProperty$1 });
|
|
714
|
+
// effect(() => {
|
|
715
|
+
// const isHorizontal = this.thyParentForm ? this.thyParentForm.isHorizontal : true;
|
|
716
|
+
// this.isHorizontal.set(isHorizontal);
|
|
717
|
+
// });
|
|
724
718
|
}
|
|
725
719
|
ngOnInit() {
|
|
726
|
-
|
|
720
|
+
const isHorizontal = this.thyParentForm ? this.thyParentForm.isHorizontal : true;
|
|
721
|
+
this.isHorizontalSignal.set(isHorizontal);
|
|
727
722
|
}
|
|
728
723
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyFormGroup, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
729
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyFormGroup, isStandalone: true, selector: "thy-form-group", inputs: { thyLabelText: "thyLabelText", thyLabelTextTranslateKey: "thyLabelTextTranslateKey", thyLabelRequired:
|
|
724
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyFormGroup, isStandalone: true, selector: "thy-form-group", inputs: { thyLabelText: { classPropertyName: "thyLabelText", publicName: "thyLabelText", isSignal: true, isRequired: false, transformFunction: null }, thyLabelTextTranslateKey: { classPropertyName: "thyLabelTextTranslateKey", publicName: "thyLabelTextTranslateKey", isSignal: true, isRequired: false, transformFunction: null }, thyLabelRequired: { classPropertyName: "thyLabelRequired", publicName: "thyLabelRequired", isSignal: true, isRequired: false, transformFunction: null }, thyLabelPaddingTopClear: { classPropertyName: "thyLabelPaddingTopClear", publicName: "thyLabelPaddingTopClear", isSignal: true, isRequired: false, transformFunction: null }, thyFeedbackIcon: { classPropertyName: "thyFeedbackIcon", publicName: "thyFeedbackIcon", isSignal: true, isRequired: false, transformFunction: null }, thyTipsMode: { classPropertyName: "thyTipsMode", publicName: "thyTipsMode", isSignal: true, isRequired: false, transformFunction: null }, thyTips: { classPropertyName: "thyTips", publicName: "thyTips", isSignal: true, isRequired: false, transformFunction: null }, thyTipsTranslateKey: { classPropertyName: "thyTipsTranslateKey", publicName: "thyTipsTranslateKey", isSignal: true, isRequired: false, transformFunction: null }, thyRowFill: { classPropertyName: "thyRowFill", publicName: "thyRowFill", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.row-fill": "thyRowFill()", "class.row": "isHorizontalSignal()", "class.has-feedback": "thyFeedbackIcon()" }, classAttribute: "form-group" }, queries: [{ propertyName: "contentTemplateRef", first: true, predicate: ["formGroup"], descendants: true }, { propertyName: "contentTemplate", first: true, predicate: ["content"], descendants: true }], ngImport: i0, template: "@let tips = tipsSignal();\n@let labelText = labelTextSignal();\n@let isHorizontal = isHorizontalSignal();\n@let feedbackIcon = thyFeedbackIcon();\n@if (contentTemplate || contentTemplateRef) {\n <ng-container [ngTemplateOutlet]=\"contentTemplate || contentTemplateRef\"></ng-container>\n @if (feedbackIcon) {\n <thy-icon class=\"form-control-feedback\" [thyIconName]=\"feedbackIcon\"></thy-icon>\n }\n} @else {\n @if (!(!isHorizontal && !labelText)) {\n <label\n class=\"form-label \"\n [ngClass]=\"{\n 'col-sm-2 col-form-label': isHorizontal,\n 'pt-0': thyLabelPaddingTopClear()\n }\"\n >\n <span\n [ngClass]=\"{\n 'label-required': thyLabelRequired()\n }\"\n >{{ labelText }}</span\n >\n @if (thyTipsMode() === 'label' && tips) {\n <thy-icon class=\"label-tips-icon\" thyIconName=\"question-circle\" [thyTooltip]=\"tips\"></thy-icon>\n }\n </label>\n }\n <div [ngClass]=\"{ 'col-sm-10 col-form-control': isHorizontal, 'position-relative': !isHorizontal }\">\n <ng-content></ng-content>\n @if (feedbackIcon) {\n <thy-icon class=\"form-control-feedback\" [thyIconName]=\"feedbackIcon\"></thy-icon>\n }\n @if (thyTipsMode() === 'default' && tips) {\n <span class=\"form-text text-desc\">{{ tips }}</span>\n }\n </div>\n }\n\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"] }, { kind: "directive", type: ThyTooltipDirective, selector: "[thyTooltip],[thy-tooltip]", inputs: ["thyTooltip", "thyTooltipPlacement", "thyTooltipClass", "thyTooltipShowDelay", "thyTooltipHideDelay", "thyTooltipTrigger", "thyTooltipDisabled", "thyTooltipTemplateContext", "thyTooltipOffset", "thyTooltipPin"], exportAs: ["thyTooltip"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
730
725
|
}
|
|
731
726
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyFormGroup, decorators: [{
|
|
732
727
|
type: Component,
|
|
733
|
-
args: [{ selector: 'thy-form-group', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgTemplateOutlet, ThyIcon, NgClass, ThyTooltipDirective],
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
}], isHorizontal: [{
|
|
741
|
-
type: HostBinding,
|
|
742
|
-
args: ['class.row']
|
|
743
|
-
}], hasFeedback: [{
|
|
744
|
-
type: HostBinding,
|
|
745
|
-
args: ['class.has-feedback']
|
|
746
|
-
}], thyLabelText: [{
|
|
747
|
-
type: Input
|
|
748
|
-
}], thyLabelTextTranslateKey: [{
|
|
749
|
-
type: Input
|
|
750
|
-
}], thyLabelRequired: [{
|
|
751
|
-
type: Input,
|
|
752
|
-
args: [{ transform: coerceBooleanProperty$1 }]
|
|
753
|
-
}], thyLabelPaddingTopClear: [{
|
|
754
|
-
type: Input,
|
|
755
|
-
args: [{ transform: coerceBooleanProperty$1 }]
|
|
756
|
-
}], thyFeedbackIcon: [{
|
|
757
|
-
type: Input
|
|
758
|
-
}], thyTipsMode: [{
|
|
759
|
-
type: Input
|
|
760
|
-
}], thyTips: [{
|
|
761
|
-
type: Input
|
|
762
|
-
}], thyTipsTranslateKey: [{
|
|
763
|
-
type: Input
|
|
764
|
-
}], thyRowFill: [{
|
|
765
|
-
type: Input,
|
|
766
|
-
args: [{ transform: coerceBooleanProperty$1 }]
|
|
767
|
-
}], contentTemplateRef: [{
|
|
728
|
+
args: [{ selector: 'thy-form-group', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgTemplateOutlet, ThyIcon, NgClass, ThyTooltipDirective], host: {
|
|
729
|
+
class: 'form-group',
|
|
730
|
+
'[class.row-fill]': 'thyRowFill()',
|
|
731
|
+
'[class.row]': 'isHorizontalSignal()',
|
|
732
|
+
'[class.has-feedback]': 'thyFeedbackIcon()'
|
|
733
|
+
}, template: "@let tips = tipsSignal();\n@let labelText = labelTextSignal();\n@let isHorizontal = isHorizontalSignal();\n@let feedbackIcon = thyFeedbackIcon();\n@if (contentTemplate || contentTemplateRef) {\n <ng-container [ngTemplateOutlet]=\"contentTemplate || contentTemplateRef\"></ng-container>\n @if (feedbackIcon) {\n <thy-icon class=\"form-control-feedback\" [thyIconName]=\"feedbackIcon\"></thy-icon>\n }\n} @else {\n @if (!(!isHorizontal && !labelText)) {\n <label\n class=\"form-label \"\n [ngClass]=\"{\n 'col-sm-2 col-form-label': isHorizontal,\n 'pt-0': thyLabelPaddingTopClear()\n }\"\n >\n <span\n [ngClass]=\"{\n 'label-required': thyLabelRequired()\n }\"\n >{{ labelText }}</span\n >\n @if (thyTipsMode() === 'label' && tips) {\n <thy-icon class=\"label-tips-icon\" thyIconName=\"question-circle\" [thyTooltip]=\"tips\"></thy-icon>\n }\n </label>\n }\n <div [ngClass]=\"{ 'col-sm-10 col-form-control': isHorizontal, 'position-relative': !isHorizontal }\">\n <ng-content></ng-content>\n @if (feedbackIcon) {\n <thy-icon class=\"form-control-feedback\" [thyIconName]=\"feedbackIcon\"></thy-icon>\n }\n @if (thyTipsMode() === 'default' && tips) {\n <span class=\"form-text text-desc\">{{ tips }}</span>\n }\n </div>\n }\n\n" }]
|
|
734
|
+
}], ctorParameters: () => [], propDecorators: { contentTemplateRef: [{
|
|
768
735
|
type: ContentChild,
|
|
769
736
|
args: ['formGroup']
|
|
770
737
|
}], contentTemplate: [{
|
|
@@ -783,7 +750,7 @@ class ThyFormSubmitDirective {
|
|
|
783
750
|
/**
|
|
784
751
|
* Form 验证通过的提交函数
|
|
785
752
|
*/
|
|
786
|
-
this.thyFormSubmit =
|
|
753
|
+
this.thyFormSubmit = output();
|
|
787
754
|
}
|
|
788
755
|
ngOnInit() {
|
|
789
756
|
this.thyFormDirective.onSubmitSuccess = ($event) => {
|
|
@@ -801,9 +768,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
801
768
|
args: [{
|
|
802
769
|
selector: '[thyFormSubmit],[thy-form-submit]'
|
|
803
770
|
}]
|
|
804
|
-
}], propDecorators: {
|
|
805
|
-
type: Output
|
|
806
|
-
}], onSubmit: [{
|
|
771
|
+
}], propDecorators: { onSubmit: [{
|
|
807
772
|
type: HostListener,
|
|
808
773
|
args: ['click', ['$event']]
|
|
809
774
|
}] } });
|
|
@@ -819,10 +784,17 @@ class ThyFormGroupFooter {
|
|
|
819
784
|
this.defaultConfig = inject(THY_FORM_CONFIG);
|
|
820
785
|
this._isFormGroup = true;
|
|
821
786
|
this.isHorizontal = true;
|
|
787
|
+
/**
|
|
788
|
+
* 对齐方式
|
|
789
|
+
* @type left | right | center
|
|
790
|
+
* @default left
|
|
791
|
+
*/
|
|
792
|
+
this.thyAlign = input(undefined);
|
|
822
793
|
this.footerClassMap = {};
|
|
823
794
|
}
|
|
824
795
|
get align() {
|
|
825
|
-
|
|
796
|
+
const thyAlign = this.thyAlign();
|
|
797
|
+
return !!thyAlign ? thyAlign : this.defaultConfig.footerAlign;
|
|
826
798
|
}
|
|
827
799
|
ngOnInit() {
|
|
828
800
|
if (this.thyParentForm) {
|
|
@@ -838,7 +810,7 @@ class ThyFormGroupFooter {
|
|
|
838
810
|
};
|
|
839
811
|
}
|
|
840
812
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyFormGroupFooter, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
841
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyFormGroupFooter, isStandalone: true, selector: "thy-form-group-footer", inputs: { thyAlign: "thyAlign" }, host: { properties: { "class.form-group": "this._isFormGroup", "class.row": "this.isHorizontal" } }, queries: [{ propertyName: "description", first: true, predicate: ["description"], descendants: true }], ngImport: i0, template: "<div [ngClass]=\"footerClassMap\">\n <div class=\"btn-pair form-footer-actions\">\n <ng-content></ng-content>\n </div>\n\n @if (description) {\n <div class=\"form-footer-description\">\n <ng-container [ngTemplateOutlet]=\"description\"></ng-container>\n </div>\n }\n</div>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
813
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.8", type: ThyFormGroupFooter, isStandalone: true, selector: "thy-form-group-footer", inputs: { thyAlign: { classPropertyName: "thyAlign", publicName: "thyAlign", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class.form-group": "this._isFormGroup", "class.row": "this.isHorizontal" } }, queries: [{ propertyName: "description", first: true, predicate: ["description"], descendants: true }], ngImport: i0, template: "<div [ngClass]=\"footerClassMap\">\n <div class=\"btn-pair form-footer-actions\">\n <ng-content></ng-content>\n </div>\n\n @if (description) {\n <div class=\"form-footer-description\">\n <ng-container [ngTemplateOutlet]=\"description\"></ng-container>\n </div>\n }\n</div>\n", dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], encapsulation: i0.ViewEncapsulation.None }); }
|
|
842
814
|
}
|
|
843
815
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyFormGroupFooter, decorators: [{
|
|
844
816
|
type: Component,
|
|
@@ -852,8 +824,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
852
824
|
}], description: [{
|
|
853
825
|
type: ContentChild,
|
|
854
826
|
args: ['description']
|
|
855
|
-
}], thyAlign: [{
|
|
856
|
-
type: Input
|
|
857
827
|
}] } });
|
|
858
828
|
|
|
859
829
|
/**
|
|
@@ -865,9 +835,10 @@ class ThyUniqueCheckValidator {
|
|
|
865
835
|
constructor() {
|
|
866
836
|
this.elementRef = inject(ElementRef);
|
|
867
837
|
this.thyForm = inject(ThyFormDirective, { optional: true });
|
|
838
|
+
this.thyUniqueCheck = input(undefined);
|
|
868
839
|
}
|
|
869
840
|
validate(ctrl) {
|
|
870
|
-
return this.thyUniqueCheck(ctrl.value).pipe(map((failed) => {
|
|
841
|
+
return this.thyUniqueCheck()(ctrl.value).pipe(map((failed) => {
|
|
871
842
|
setTimeout(() => {
|
|
872
843
|
if (failed && this.thyForm && this.elementRef.nativeElement.name) {
|
|
873
844
|
this.thyForm.validator.validateControl(this.elementRef.nativeElement.name);
|
|
@@ -877,29 +848,15 @@ class ThyUniqueCheckValidator {
|
|
|
877
848
|
}), catchError(() => of(null)));
|
|
878
849
|
}
|
|
879
850
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyUniqueCheckValidator, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
880
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
881
|
-
{
|
|
882
|
-
provide: NG_ASYNC_VALIDATORS,
|
|
883
|
-
useExisting: ThyUniqueCheckValidator,
|
|
884
|
-
multi: true
|
|
885
|
-
}
|
|
886
|
-
], ngImport: i0 }); }
|
|
851
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: ThyUniqueCheckValidator, isStandalone: true, selector: "[thyUniqueCheck]", inputs: { thyUniqueCheck: { classPropertyName: "thyUniqueCheck", publicName: "thyUniqueCheck", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: NG_ASYNC_VALIDATORS, useExisting: ThyUniqueCheckValidator, multi: true }], ngImport: i0 }); }
|
|
887
852
|
}
|
|
888
853
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyUniqueCheckValidator, decorators: [{
|
|
889
854
|
type: Directive,
|
|
890
855
|
args: [{
|
|
891
856
|
selector: '[thyUniqueCheck]',
|
|
892
|
-
providers: [
|
|
893
|
-
{
|
|
894
|
-
provide: NG_ASYNC_VALIDATORS,
|
|
895
|
-
useExisting: ThyUniqueCheckValidator,
|
|
896
|
-
multi: true
|
|
897
|
-
}
|
|
898
|
-
]
|
|
857
|
+
providers: [{ provide: NG_ASYNC_VALIDATORS, useExisting: ThyUniqueCheckValidator, multi: true }]
|
|
899
858
|
}]
|
|
900
|
-
}]
|
|
901
|
-
type: Input
|
|
902
|
-
}] } });
|
|
859
|
+
}] });
|
|
903
860
|
|
|
904
861
|
/**
|
|
905
862
|
* @name min
|
|
@@ -987,11 +944,17 @@ function confirmValidator(value) {
|
|
|
987
944
|
* @order 25
|
|
988
945
|
*/
|
|
989
946
|
class ThyConfirmValidatorDirective {
|
|
947
|
+
constructor() {
|
|
948
|
+
/**
|
|
949
|
+
* 表单控件的校验值
|
|
950
|
+
*/
|
|
951
|
+
this.confirm = input(undefined);
|
|
952
|
+
}
|
|
990
953
|
validate(control) {
|
|
991
|
-
return confirmValidator(this.confirm)(control);
|
|
954
|
+
return confirmValidator(this.confirm())(control);
|
|
992
955
|
}
|
|
993
956
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyConfirmValidatorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
994
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
|
957
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.2.8", type: ThyConfirmValidatorDirective, isStandalone: true, selector: "[confirm]", inputs: { confirm: { classPropertyName: "confirm", publicName: "confirm", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: NG_VALIDATORS, useExisting: ThyConfirmValidatorDirective, multi: true }], ngImport: i0 }); }
|
|
995
958
|
}
|
|
996
959
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImport: i0, type: ThyConfirmValidatorDirective, decorators: [{
|
|
997
960
|
type: Directive,
|
|
@@ -1000,9 +963,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.8", ngImpor
|
|
|
1000
963
|
selector: '[confirm]',
|
|
1001
964
|
providers: [{ provide: NG_VALIDATORS, useExisting: ThyConfirmValidatorDirective, multi: true }]
|
|
1002
965
|
}]
|
|
1003
|
-
}]
|
|
1004
|
-
type: Input
|
|
1005
|
-
}] } });
|
|
966
|
+
}] });
|
|
1006
967
|
|
|
1007
968
|
class ThyFormModule {
|
|
1008
969
|
static forRoot(config) {
|