diff --git a/packages/mosaic-dev/dateformatter/module.ts b/packages/mosaic-dev/dateformatter/module.ts index bae9e39fc..08570e179 100644 --- a/packages/mosaic-dev/dateformatter/module.ts +++ b/packages/mosaic-dev/dateformatter/module.ts @@ -158,9 +158,7 @@ export class DemoComponent { enRangeShortDateTimeEndsNotCurrentYear: string; // tslint:disable-next-line:max-func-body-length - constructor( - @Inject(DateAdapter) public dateAdapter: DateAdapter - ) { + constructor(private dateAdapter: DateAdapter) { this.populateRuLongDate(); this.populateEnLongDate(); @@ -471,14 +469,8 @@ export class DemoComponent { DemoComponent ], imports: [ - BrowserAnimationsModule, BrowserModule, - FormsModule, - McFormFieldModule, - McDatepickerModule, - McMomentDateModule, - McInputModule, - McIconModule + McMomentDateModule ], bootstrap: [ DemoComponent diff --git a/packages/mosaic-dev/select/template.html b/packages/mosaic-dev/select/template.html index 6e4b09738..0c2eb791b 100644 --- a/packages/mosaic-dev/select/template.html +++ b/packages/mosaic-dev/select/template.html @@ -35,10 +35,12 @@ - + +
Ничего не найдено
+ {{ option }}
@@ -59,6 +61,8 @@ +
Ничего не найдено
+ {{ option }} diff --git a/packages/mosaic/select/select.component.ts b/packages/mosaic/select/select.component.ts index e400f4e21..31021eaef 100644 --- a/packages/mosaic/select/select.component.ts +++ b/packages/mosaic/select/select.component.ts @@ -120,6 +120,7 @@ export class McSelectBase { const McSelectMixinBase: CanDisableCtor & HasTabIndexCtor & CanUpdateErrorStateCtor & typeof McSelectBase = mixinTabIndex(mixinDisabled(mixinErrorState(McSelectBase))); + @Directive({ selector: '[mcSelectSearch]', exportAs: 'mcSelectSearch', @@ -176,6 +177,13 @@ export class McSelectSearch implements AfterContentInit, OnDestroy { } +@Directive({ + selector: '[mc-select-search-empty-result]', + exportAs: 'mcSelectSearchEmptyResult' +}) +export class McSelectSearchEmptyResult {} + + @Directive({ selector: 'mc-select-trigger' }) export class McSelectTrigger {} @@ -217,9 +225,6 @@ export class McSelect extends McSelectMixinBase implements controlType = 'mc-select'; hiddenItems: number = 0; - // todo localization - oneMoreText: string = '...ещё'; - noOptionsText: string = 'Ничего не найдено'; /** The last measured value for the trigger's client bounding rect. */ triggerRect: ClientRect; @@ -297,7 +302,9 @@ export class McSelect extends McSelectMixinBase implements /** All of the defined groups of options. */ @ContentChildren(McOptgroup) optionGroups: QueryList; - @ContentChild(McSelectSearch, {static: false}) search: McSelectSearch; + @ContentChild(McSelectSearch, { static: false }) search: McSelectSearch; + + @Input() hiddenItemsText: string = '...ещё'; /** Classes to be passed to the select panel. Supports the same syntax as `ngClass`. */ @Input() panelClass: string | string[] | Set | { [key: string]: any }; @@ -457,14 +464,12 @@ export class McSelect extends McSelectMixinBase implements return this._panelOpen; } + private _panelOpen = false; + get isEmptySearchResult(): boolean { - return this.search && - this.options.length === 0 && - !!this.search.input.value; + return this.search && this.options.length === 0 && !!this.search.input.value; } - private _panelOpen = false; - /** The scroll position of the overlay panel, calculated to center the selected option. */ private scrollTop = 0; diff --git a/packages/mosaic/select/select.html b/packages/mosaic/select/select.html index 5ec969352..b26582ef4 100644 --- a/packages/mosaic/select/select.html +++ b/packages/mosaic/select/select.html @@ -16,7 +16,7 @@
- {{ oneMoreText }} {{ hiddenItems }} + {{ hiddenItemsText }} {{ hiddenItems }}
@@ -56,13 +56,14 @@ -
+
-
{{noOptionsText}}
+
+ +
diff --git a/packages/mosaic/select/select.module.ts b/packages/mosaic/select/select.module.ts index 195f99122..b1353a87b 100644 --- a/packages/mosaic/select/select.module.ts +++ b/packages/mosaic/select/select.module.ts @@ -6,7 +6,7 @@ import { McFormFieldModule } from '@ptsecurity/mosaic/form-field'; import { McIconModule } from '@ptsecurity/mosaic/icon'; import { McTagsModule } from '@ptsecurity/mosaic/tags'; -import { McSelect, McSelectSearch, McSelectTrigger } from './select.component'; +import { McSelect, McSelectSearch, McSelectSearchEmptyResult, McSelectTrigger } from './select.component'; @NgModule({ @@ -21,6 +21,7 @@ import { McSelect, McSelectSearch, McSelectTrigger } from './select.component'; McFormFieldModule, McSelect, McSelectSearch, + McSelectSearchEmptyResult, McSelectTrigger, McOptionModule, CommonModule @@ -28,6 +29,7 @@ import { McSelect, McSelectSearch, McSelectTrigger } from './select.component'; declarations: [ McSelect, McSelectSearch, + McSelectSearchEmptyResult, McSelectTrigger], providers: [MC_SELECT_SCROLL_STRATEGY_PROVIDER] }) diff --git a/packages/mosaic/tree-select/tree-select.component.ts b/packages/mosaic/tree-select/tree-select.component.ts index 017d1578b..aaaddd219 100644 --- a/packages/mosaic/tree-select/tree-select.component.ts +++ b/packages/mosaic/tree-select/tree-select.component.ts @@ -153,7 +153,6 @@ export class McTreeSelect extends McTreeSelectMixinBase implements controlType = 'mc-select'; hiddenItems: number = 0; - oneMoreText: string = '...ещё'; /** The last measured value for the trigger's client bounding rect. */ triggerRect: ClientRect; @@ -220,6 +219,8 @@ export class McTreeSelect extends McTreeSelectMixinBase implements @ContentChild(McTreeSelection, {static: false}) tree: McTreeSelection; + @Input() hiddenItemsText: string = '...ещё'; + /** Event emitted when the select panel has been toggled. */ @Output() readonly openedChange: EventEmitter = new EventEmitter(); diff --git a/packages/mosaic/tree-select/tree-select.html b/packages/mosaic/tree-select/tree-select.html index 4d60155a7..800cd3dd1 100644 --- a/packages/mosaic/tree-select/tree-select.html +++ b/packages/mosaic/tree-select/tree-select.html @@ -16,7 +16,7 @@
- {{ oneMoreText }} {{ hiddenItems }} + {{ hiddenItemsText }} {{ hiddenItems }}