carbon-components-angular 5.72.1 → 5.72.2
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/combobox/combobox.component.d.ts +3 -0
- package/docs/documentation/components/ComboBox.html +214 -67
- package/docs/documentation/components/Dropdown.html +322 -134
- package/docs/documentation/components/DropdownList.html +6 -2
- package/docs/documentation/components/RadioGroup.html +166 -77
- package/docs/documentation/coverage.html +10 -10
- package/docs/documentation/js/search/search_index.js +2 -2
- package/docs/documentation/modules/DialogModule/dependencies.svg +34 -34
- package/docs/documentation/modules/DialogModule.html +34 -34
- package/docs/documentation/modules/DocumentationModule/dependencies.svg +4 -4
- package/docs/documentation/modules/DocumentationModule.html +4 -4
- package/docs/documentation/modules/FileUploaderModule/dependencies.svg +37 -37
- package/docs/documentation/modules/FileUploaderModule.html +37 -37
- package/docs/documentation/modules/GridModule/dependencies.svg +63 -63
- package/docs/documentation/modules/GridModule.html +63 -63
- package/docs/documentation/modules/HeaderModule/dependencies.svg +4 -4
- package/docs/documentation/modules/HeaderModule.html +4 -4
- package/docs/documentation/modules/I18nModule/dependencies.svg +13 -13
- package/docs/documentation/modules/I18nModule.html +13 -13
- package/docs/documentation/modules/IconModule/dependencies.svg +4 -4
- package/docs/documentation/modules/IconModule.html +4 -4
- package/docs/documentation/modules/InlineLoadingModule/dependencies.svg +15 -15
- package/docs/documentation/modules/InlineLoadingModule.html +15 -15
- package/docs/documentation/modules/InputModule/dependencies.svg +76 -76
- package/docs/documentation/modules/InputModule.html +76 -76
- package/docs/documentation/modules/ListModule/dependencies.svg +4 -4
- package/docs/documentation/modules/ListModule.html +4 -4
- package/docs/documentation/modules/LoadingModule/dependencies.svg +4 -4
- package/docs/documentation/modules/LoadingModule.html +4 -4
- package/docs/documentation/modules/MenuButtonModule/dependencies.svg +28 -28
- package/docs/documentation/modules/MenuButtonModule.html +28 -28
- package/docs/documentation/modules/ModalModule/dependencies.svg +113 -113
- package/docs/documentation/modules/ModalModule.html +113 -113
- package/docs/documentation/modules/NFormsModule/dependencies.svg +4 -4
- package/docs/documentation/modules/NFormsModule.html +4 -4
- package/docs/documentation/modules/NotificationModule/dependencies.svg +4 -4
- package/docs/documentation/modules/NotificationModule.html +4 -4
- package/docs/documentation/modules/NumberModule/dependencies.svg +24 -24
- package/docs/documentation/modules/NumberModule.html +24 -24
- package/docs/documentation/modules/PaginationModule/dependencies.svg +57 -57
- package/docs/documentation/modules/PaginationModule.html +57 -57
- package/docs/documentation/modules/PanelModule/dependencies.svg +36 -36
- package/docs/documentation/modules/PanelModule.html +36 -36
- package/docs/documentation/modules/PlaceholderModule/dependencies.svg +4 -4
- package/docs/documentation/modules/PlaceholderModule.html +4 -4
- package/docs/documentation/modules/PopoverModule/dependencies.svg +4 -4
- package/docs/documentation/modules/PopoverModule.html +4 -4
- package/docs/documentation/modules/ProgressBarModule/dependencies.svg +4 -4
- package/docs/documentation/modules/ProgressBarModule.html +4 -4
- package/docs/documentation/modules/ProgressIndicatorModule/dependencies.svg +4 -4
- package/docs/documentation/modules/ProgressIndicatorModule.html +4 -4
- package/docs/documentation/modules/RadioModule/dependencies.svg +61 -57
- package/docs/documentation/modules/RadioModule.html +61 -57
- package/docs/documentation/modules/SearchModule/dependencies.svg +48 -44
- package/docs/documentation/modules/SearchModule.html +48 -44
- package/docs/documentation/modules/SelectModule/dependencies.svg +60 -60
- package/docs/documentation/modules/SelectModule.html +60 -60
- package/docs/documentation/modules/SideNavModule/dependencies.svg +40 -40
- package/docs/documentation/modules/SideNavModule.html +40 -40
- package/docs/documentation/modules/SliderModule/dependencies.svg +41 -45
- package/docs/documentation/modules/SliderModule.html +41 -45
- package/docs/documentation/modules/TabsModule/dependencies.svg +120 -120
- package/docs/documentation/modules/TabsModule.html +120 -120
- package/docs/documentation/modules/ThemeModule/dependencies.svg +13 -13
- package/docs/documentation/modules/ThemeModule.html +13 -13
- package/docs/documentation/modules/TilesModule/dependencies.svg +106 -106
- package/docs/documentation/modules/TilesModule.html +106 -106
- package/docs/documentation/modules/TimePickerModule/dependencies.svg +41 -45
- package/docs/documentation/modules/TimePickerModule.html +41 -45
- package/docs/documentation/modules/TimePickerSelectModule/dependencies.svg +46 -42
- package/docs/documentation/modules/TimePickerSelectModule.html +46 -42
- package/docs/documentation/modules/ToggleModule/dependencies.svg +17 -17
- package/docs/documentation/modules/ToggleModule.html +17 -17
- package/docs/documentation/modules/ToggletipModule/dependencies.svg +4 -4
- package/docs/documentation/modules/ToggletipModule.html +4 -4
- package/docs/documentation/modules/TooltipModule/dependencies.svg +28 -28
- package/docs/documentation/modules/TooltipModule.html +28 -28
- package/docs/documentation/modules/TreeviewModule/dependencies.svg +4 -4
- package/docs/documentation/modules/TreeviewModule.html +4 -4
- package/docs/documentation/modules/UIShellModule/dependencies.svg +4 -4
- package/docs/documentation/modules/UIShellModule.html +4 -4
- package/docs/documentation.json +261 -231
- package/docs/storybook/3224.14e2c79a.iframe.bundle.js +1 -0
- package/docs/storybook/557.d4341469.iframe.bundle.js +1 -0
- package/docs/storybook/955.7522f55b.iframe.bundle.js +1 -0
- package/docs/storybook/combobox-combobox-stories.e3d08f7d.iframe.bundle.js +1 -0
- package/docs/storybook/dropdown-dropdown-stories.cf59b2ab.iframe.bundle.js +1 -0
- package/docs/storybook/iframe.html +2 -2
- package/docs/storybook/{main.d2b9abb3.iframe.bundle.js → main.a1247bb8.iframe.bundle.js} +1 -1
- package/docs/storybook/modal-modal-stories.cc2d04cb.iframe.bundle.js +1 -0
- package/docs/storybook/{pagination-pagination-nav-stories.547eede3.iframe.bundle.js → pagination-pagination-nav-stories.01637d11.iframe.bundle.js} +1 -1
- package/docs/storybook/{pagination-pagination-stories.fa7c9094.iframe.bundle.js → pagination-pagination-stories.40d17ebd.iframe.bundle.js} +1 -1
- package/docs/storybook/{patterns-filtering-single-selection-stories.ec91f833.iframe.bundle.js → patterns-filtering-multi-selection-stories.a46a1d6e.iframe.bundle.js} +1 -1
- package/docs/storybook/{patterns-filtering-multiple-categories-stories.531f27d7.iframe.bundle.js → patterns-filtering-multiple-categories-stories.740c719e.iframe.bundle.js} +1 -1
- package/docs/storybook/{patterns-filtering-multi-selection-stories.9086f77f.iframe.bundle.js → patterns-filtering-single-selection-stories.cc647b4a.iframe.bundle.js} +1 -1
- package/docs/storybook/{patterns-forms-multi-step-form-stories.8696062a.iframe.bundle.js → patterns-forms-multi-step-form-stories.2ea46e56.iframe.bundle.js} +1 -1
- package/docs/storybook/{patterns-loading-large-loading-stories.734fb9bc.iframe.bundle.js → patterns-loading-large-loading-stories.e6ae3e31.iframe.bundle.js} +1 -1
- package/docs/storybook/{patterns-loading-progressive-loading-stories.10bcf9f2.iframe.bundle.js → patterns-loading-progressive-loading-stories.63165c09.iframe.bundle.js} +1 -1
- package/docs/storybook/project.json +1 -1
- package/docs/storybook/radio-radio-stories.8ff73370.iframe.bundle.js +1 -0
- package/docs/storybook/runtime~main.b11c471e.iframe.bundle.js +1 -0
- package/dropdown/dropdown.component.d.ts +8 -1
- package/dropdown/list/dropdown-list.component.d.ts +1 -1
- package/esm2020/combobox/combobox.component.mjs +19 -9
- package/esm2020/dropdown/dropdown.component.mjs +31 -15
- package/esm2020/dropdown/list/dropdown-list.component.mjs +1 -1
- package/esm2020/radio/radio-group.component.mjs +19 -7
- package/fesm2015/carbon-components-angular-combobox.mjs +18 -8
- package/fesm2015/carbon-components-angular-combobox.mjs.map +1 -1
- package/fesm2015/carbon-components-angular-dropdown.mjs +31 -14
- package/fesm2015/carbon-components-angular-dropdown.mjs.map +1 -1
- package/fesm2015/carbon-components-angular-radio.mjs +18 -6
- package/fesm2015/carbon-components-angular-radio.mjs.map +1 -1
- package/fesm2020/carbon-components-angular-combobox.mjs +18 -8
- package/fesm2020/carbon-components-angular-combobox.mjs.map +1 -1
- package/fesm2020/carbon-components-angular-dropdown.mjs +30 -14
- package/fesm2020/carbon-components-angular-dropdown.mjs.map +1 -1
- package/fesm2020/carbon-components-angular-radio.mjs +18 -6
- package/fesm2020/carbon-components-angular-radio.mjs.map +1 -1
- package/package.json +1 -1
- package/radio/radio-group.component.d.ts +4 -2
- package/docs/storybook/1250.47c381c1.iframe.bundle.js +0 -1
- package/docs/storybook/3224.3e279e46.iframe.bundle.js +0 -1
- package/docs/storybook/955.99b6ac85.iframe.bundle.js +0 -1
- package/docs/storybook/combobox-combobox-stories.e7427226.iframe.bundle.js +0 -1
- package/docs/storybook/dropdown-dropdown-stories.a76101be.iframe.bundle.js +0 -1
- package/docs/storybook/modal-modal-stories.0a864a6a.iframe.bundle.js +0 -1
- package/docs/storybook/radio-radio-stories.444fc044.iframe.bundle.js +0 -1
- package/docs/storybook/runtime~main.86875b86.iframe.bundle.js +0 -1
|
@@ -2,6 +2,7 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { Directive, Input, Output, Injectable, EventEmitter, TemplateRef, Component, HostBinding, ContentChild, ViewChild, HostListener, ViewChildren, NgModule } from '@angular/core';
|
|
3
3
|
import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
|
|
4
4
|
import { Subscription, of, fromEvent, isObservable, Observable } from 'rxjs';
|
|
5
|
+
import { isUndefined, isNull } from 'lodash-es';
|
|
5
6
|
import * as i2 from 'carbon-components-angular/utils';
|
|
6
7
|
import { closestAttr, hasScrollableParents, getScrollableParents, UtilsModule } from 'carbon-components-angular/utils';
|
|
7
8
|
import * as i1$1 from 'carbon-components-angular/i18n';
|
|
@@ -347,6 +348,10 @@ class Dropdown {
|
|
|
347
348
|
* Defaults to the `DROPDOWN.SELECTED` value from the i18n service.
|
|
348
349
|
*/
|
|
349
350
|
this.selectedLabel = this.i18n.get().DROPDOWN.SELECTED;
|
|
351
|
+
/**
|
|
352
|
+
* Set to `true` to allow null values in the dropdown ListItems.
|
|
353
|
+
*/
|
|
354
|
+
this.allowNullValues = false;
|
|
350
355
|
/**
|
|
351
356
|
* Emits selection events.
|
|
352
357
|
*/
|
|
@@ -384,6 +389,7 @@ class Dropdown {
|
|
|
384
389
|
this._isFocused = false;
|
|
385
390
|
// primarily used to capture and propagate input to `writeValue` before the content is available
|
|
386
391
|
this._writtenValue = [];
|
|
392
|
+
this._isUsingNgControl = false;
|
|
387
393
|
/**
|
|
388
394
|
* function passed in by `registerOnChange`
|
|
389
395
|
*/
|
|
@@ -423,37 +429,34 @@ class Dropdown {
|
|
|
423
429
|
if (!this.view) {
|
|
424
430
|
return;
|
|
425
431
|
}
|
|
426
|
-
if ((this.writtenValue && this.writtenValue.length) || typeof this.writtenValue === "number") {
|
|
427
|
-
this.writeValue(this.writtenValue);
|
|
428
|
-
}
|
|
429
432
|
this.view.type = this.type;
|
|
430
433
|
this.view.size = this.size;
|
|
431
434
|
// function to check if the event is organic (isUpdate === false) or programmatic
|
|
432
435
|
const isUpdate = event => event && event.isUpdate;
|
|
433
|
-
this.view.select.subscribe(event => {
|
|
436
|
+
this.selectionSubscription = this.view.select.subscribe(event => {
|
|
434
437
|
if (this.type === "single" && !isUpdate(event) && !Array.isArray(event)) {
|
|
435
438
|
this.closeMenu();
|
|
436
439
|
if (event.item && event.item.selected) {
|
|
437
440
|
if (this.itemValueKey) {
|
|
438
|
-
this.
|
|
441
|
+
this._propagateChange(event.item[this.itemValueKey]);
|
|
439
442
|
}
|
|
440
443
|
else {
|
|
441
|
-
this.
|
|
444
|
+
this._propagateChange(event.item);
|
|
442
445
|
}
|
|
443
446
|
}
|
|
444
447
|
else {
|
|
445
|
-
this.
|
|
448
|
+
this._propagateChange(null);
|
|
446
449
|
}
|
|
447
450
|
}
|
|
448
451
|
if (this.type === "multi" && !isUpdate(event)) {
|
|
449
452
|
// if we have a `value` selector and selected items map them appropriately
|
|
450
453
|
if (this.itemValueKey && this.view.getSelected()) {
|
|
451
454
|
const values = this.view.getSelected().map(item => item[this.itemValueKey]);
|
|
452
|
-
this.
|
|
455
|
+
this._propagateChange(values);
|
|
453
456
|
// otherwise just pass up the values from `getSelected`
|
|
454
457
|
}
|
|
455
458
|
else {
|
|
456
|
-
this.
|
|
459
|
+
this._propagateChange(this.view.getSelected());
|
|
457
460
|
}
|
|
458
461
|
}
|
|
459
462
|
// only emit selected for "organic" selections
|
|
@@ -461,6 +464,9 @@ class Dropdown {
|
|
|
461
464
|
this.checkForReorder();
|
|
462
465
|
this.selected.emit(event);
|
|
463
466
|
}
|
|
467
|
+
else if (this._isUsingNgControl) {
|
|
468
|
+
this.writeValue(this.writtenValue);
|
|
469
|
+
}
|
|
464
470
|
});
|
|
465
471
|
}
|
|
466
472
|
ngAfterViewInit() {
|
|
@@ -484,6 +490,8 @@ class Dropdown {
|
|
|
484
490
|
if (!this.appendInline) {
|
|
485
491
|
this._appendToDropdown();
|
|
486
492
|
}
|
|
493
|
+
this.visibilitySubscription?.unsubscribe();
|
|
494
|
+
this.selectionSubscription?.unsubscribe();
|
|
487
495
|
}
|
|
488
496
|
/**
|
|
489
497
|
* Propagates the injected `value`.
|
|
@@ -492,8 +500,8 @@ class Dropdown {
|
|
|
492
500
|
// cache the written value so we can use it in `AfterContentInit`
|
|
493
501
|
this.writtenValue = value;
|
|
494
502
|
this.view.onItemsReady(() => {
|
|
495
|
-
// propagate null/
|
|
496
|
-
if (
|
|
503
|
+
// propagate null/undefined as an array (deselect everything) unless `allowNullValues` is true
|
|
504
|
+
if (isUndefined(value) || (isNull(value) && !this.allowNullValues)) {
|
|
497
505
|
this.view.propagateSelected([value]);
|
|
498
506
|
}
|
|
499
507
|
else if (this.type === "single") {
|
|
@@ -524,7 +532,7 @@ class Dropdown {
|
|
|
524
532
|
}
|
|
525
533
|
else {
|
|
526
534
|
// we can safely assume we're passing an array of `ListItem`s
|
|
527
|
-
this.view.propagateSelected(value);
|
|
535
|
+
this.view.propagateSelected(value || [value]);
|
|
528
536
|
}
|
|
529
537
|
}
|
|
530
538
|
this.checkForReorder();
|
|
@@ -534,6 +542,7 @@ class Dropdown {
|
|
|
534
542
|
this.onTouchedCallback();
|
|
535
543
|
}
|
|
536
544
|
registerOnChange(fn) {
|
|
545
|
+
this._isUsingNgControl = true;
|
|
537
546
|
this.propagateChange = fn;
|
|
538
547
|
}
|
|
539
548
|
/**
|
|
@@ -542,6 +551,11 @@ class Dropdown {
|
|
|
542
551
|
registerOnTouched(fn) {
|
|
543
552
|
this.onTouchedCallback = fn;
|
|
544
553
|
}
|
|
554
|
+
// used only to update writtenValue
|
|
555
|
+
_propagateChange(value) {
|
|
556
|
+
this.writtenValue = value;
|
|
557
|
+
this.propagateChange(value);
|
|
558
|
+
}
|
|
545
559
|
/**
|
|
546
560
|
* `ControlValueAccessor` method to programmatically disable the dropdown.
|
|
547
561
|
*
|
|
@@ -659,7 +673,7 @@ class Dropdown {
|
|
|
659
673
|
item.selected = false;
|
|
660
674
|
}
|
|
661
675
|
this.selected.emit([]);
|
|
662
|
-
this.
|
|
676
|
+
this._propagateChange([]);
|
|
663
677
|
}
|
|
664
678
|
/**
|
|
665
679
|
* Returns `true` if there is a value selected.
|
|
@@ -841,7 +855,7 @@ class Dropdown {
|
|
|
841
855
|
}
|
|
842
856
|
Dropdown.dropdownCount = 0;
|
|
843
857
|
Dropdown.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: Dropdown, deps: [{ token: i0.ElementRef }, { token: i1$1.I18n }, { token: DropdownService }, { token: i2.ElementService }], target: i0.ɵɵFactoryTarget.Component });
|
|
844
|
-
Dropdown.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: Dropdown, selector: "cds-dropdown, ibm-dropdown", inputs: { id: "id", label: "label", hideLabel: "hideLabel", helperText: "helperText", decorator: "decorator", placeholder: "placeholder", displayValue: "displayValue", clearText: "clearText", size: "size", type: "type", theme: "theme", disabled: "disabled", readonly: "readonly", skeleton: "skeleton", inline: "inline", disableArrowKeys: "disableArrowKeys", invalid: "invalid", invalidText: "invalidText", warn: "warn", warnText: "warnText", appendInline: "appendInline", scrollableContainer: "scrollableContainer", itemValueKey: "itemValueKey", selectionFeedback: "selectionFeedback", menuButtonLabel: "menuButtonLabel", selectedLabel: "selectedLabel", dropUp: "dropUp", fluid: "fluid" }, outputs: { selected: "selected", onClose: "onClose", close: "close" }, host: { listeners: { "keydown": "onKeyDown($event)" }, properties: { "class.cds--list-box__wrapper--fluid--invalid": "this.fluidInvalidClass", "class.cds--list-box__wrapper--fluid--focus": "this.fluidFocusClass", "class.cds--dropdown__wrapper": "this.hostClass", "class.cds--list-box__wrapper": "this.hostWrapperClass", "class.cds--list-box__wrapper--decorator": "this.hasDecorator", "class.cds--list-box__wrapper--fluid": "this.fluid" } }, providers: [
|
|
858
|
+
Dropdown.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: Dropdown, selector: "cds-dropdown, ibm-dropdown", inputs: { id: "id", label: "label", hideLabel: "hideLabel", helperText: "helperText", decorator: "decorator", placeholder: "placeholder", displayValue: "displayValue", clearText: "clearText", size: "size", type: "type", theme: "theme", disabled: "disabled", readonly: "readonly", skeleton: "skeleton", inline: "inline", disableArrowKeys: "disableArrowKeys", invalid: "invalid", invalidText: "invalidText", warn: "warn", warnText: "warnText", appendInline: "appendInline", scrollableContainer: "scrollableContainer", itemValueKey: "itemValueKey", selectionFeedback: "selectionFeedback", menuButtonLabel: "menuButtonLabel", selectedLabel: "selectedLabel", dropUp: "dropUp", allowNullValues: "allowNullValues", fluid: "fluid" }, outputs: { selected: "selected", onClose: "onClose", close: "close" }, host: { listeners: { "keydown": "onKeyDown($event)" }, properties: { "class.cds--list-box__wrapper--fluid--invalid": "this.fluidInvalidClass", "class.cds--list-box__wrapper--fluid--focus": "this.fluidFocusClass", "class.cds--dropdown__wrapper": "this.hostClass", "class.cds--list-box__wrapper": "this.hostWrapperClass", "class.cds--list-box__wrapper--decorator": "this.hasDecorator", "class.cds--list-box__wrapper--fluid": "this.fluid" } }, providers: [
|
|
845
859
|
{
|
|
846
860
|
provide: NG_VALUE_ACCESSOR,
|
|
847
861
|
useExisting: Dropdown,
|
|
@@ -1175,6 +1189,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
|
1175
1189
|
type: Input
|
|
1176
1190
|
}], dropUp: [{
|
|
1177
1191
|
type: Input
|
|
1192
|
+
}], allowNullValues: [{
|
|
1193
|
+
type: Input
|
|
1178
1194
|
}], selected: [{
|
|
1179
1195
|
type: Output
|
|
1180
1196
|
}], onClose: [{
|