carbon-components-angular 5.72.2 → 5.72.3
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 +1 -1
- package/datepicker/datepicker.component.d.ts +1 -1
- package/docs/documentation/components/ComboBox.html +49 -49
- package/docs/documentation/components/DatePicker.html +34 -34
- package/docs/documentation/components/Dropdown.html +161 -160
- package/docs/documentation/components/ProgressIndicator.html +13 -9
- package/docs/documentation/coverage.html +36 -0
- package/docs/documentation/js/menu-wc_es5.js +1 -1
- package/docs/documentation/js/search/search_index.js +2 -2
- package/docs/documentation/miscellaneous/functions.html +257 -1
- package/docs/documentation/modules/CheckboxModule/dependencies.svg +42 -42
- package/docs/documentation/modules/CheckboxModule.html +42 -42
- package/docs/documentation/modules/CodeSnippetModule/dependencies.svg +4 -4
- package/docs/documentation/modules/CodeSnippetModule.html +4 -4
- package/docs/documentation/modules/ComboBoxModule/dependencies.svg +6 -6
- package/docs/documentation/modules/ComboBoxModule.html +6 -6
- package/docs/documentation/modules/ContentSwitcherModule/dependencies.svg +4 -4
- package/docs/documentation/modules/ContentSwitcherModule.html +4 -4
- package/docs/documentation/modules/ContextMenuModule/dependencies.svg +67 -67
- package/docs/documentation/modules/ContextMenuModule.html +67 -67
- package/docs/documentation/modules/DatePickerInputModule/dependencies.svg +4 -4
- package/docs/documentation/modules/DatePickerInputModule.html +4 -4
- package/docs/documentation/modules/DatePickerModule/dependencies.svg +6 -6
- package/docs/documentation/modules/DatePickerModule.html +6 -6
- package/docs/documentation/modules/DialogModule/dependencies.svg +33 -33
- package/docs/documentation/modules/DialogModule.html +33 -33
- package/docs/documentation/modules/DocumentationModule/dependencies.svg +4 -4
- package/docs/documentation/modules/DocumentationModule.html +4 -4
- package/docs/documentation/modules/DropdownModule/dependencies.svg +68 -68
- package/docs/documentation/modules/DropdownModule.html +68 -68
- package/docs/documentation/modules/GridModule/dependencies.svg +64 -64
- package/docs/documentation/modules/GridModule.html +64 -64
- package/docs/documentation/modules/HeaderModule/dependencies.svg +4 -4
- package/docs/documentation/modules/HeaderModule.html +4 -4
- package/docs/documentation/modules/I18nModule/dependencies.svg +4 -4
- package/docs/documentation/modules/I18nModule.html +4 -4
- package/docs/documentation/modules/InputModule/dependencies.svg +4 -4
- package/docs/documentation/modules/InputModule.html +4 -4
- package/docs/documentation/modules/LayoutModule/dependencies.svg +4 -4
- package/docs/documentation/modules/LayoutModule.html +4 -4
- package/docs/documentation/modules/LinkModule/dependencies.svg +4 -4
- package/docs/documentation/modules/LinkModule.html +4 -4
- 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 +4 -4
- package/docs/documentation/modules/MenuButtonModule.html +4 -4
- package/docs/documentation/modules/ModalModule/dependencies.svg +116 -116
- package/docs/documentation/modules/ModalModule.html +116 -116
- package/docs/documentation/modules/NotificationModule/dependencies.svg +124 -124
- package/docs/documentation/modules/NotificationModule.html +124 -124
- package/docs/documentation/modules/PaginationModule/dependencies.svg +4 -4
- package/docs/documentation/modules/PaginationModule.html +4 -4
- package/docs/documentation/modules/PanelModule/dependencies.svg +36 -36
- package/docs/documentation/modules/PanelModule.html +36 -36
- package/docs/documentation/modules/ProgressBarModule/dependencies.svg +12 -12
- package/docs/documentation/modules/ProgressBarModule.html +12 -12
- package/docs/documentation/modules/ProgressIndicatorModule/dependencies.svg +24 -24
- package/docs/documentation/modules/ProgressIndicatorModule.html +24 -24
- package/docs/documentation/modules/RadioModule/dependencies.svg +47 -47
- package/docs/documentation/modules/RadioModule.html +47 -47
- package/docs/documentation/modules/SearchModule/dependencies.svg +44 -48
- package/docs/documentation/modules/SearchModule.html +44 -48
- package/docs/documentation/modules/SideNavModule/dependencies.svg +4 -4
- package/docs/documentation/modules/SideNavModule.html +4 -4
- package/docs/documentation/modules/SkeletonModule/dependencies.svg +4 -4
- package/docs/documentation/modules/SkeletonModule.html +4 -4
- package/docs/documentation/modules/SliderModule/dependencies.svg +4 -4
- package/docs/documentation/modules/SliderModule.html +4 -4
- package/docs/documentation/modules/StructuredListModule/dependencies.svg +4 -4
- package/docs/documentation/modules/StructuredListModule.html +4 -4
- package/docs/documentation/modules/TableModule/dependencies.svg +4 -4
- package/docs/documentation/modules/TableModule.html +4 -4
- package/docs/documentation/modules/TabsModule/dependencies.svg +72 -72
- package/docs/documentation/modules/TabsModule.html +72 -72
- package/docs/documentation/modules/TagModule/dependencies.svg +4 -4
- package/docs/documentation/modules/TagModule.html +4 -4
- package/docs/documentation/modules/ThemeModule/dependencies.svg +13 -13
- package/docs/documentation/modules/ThemeModule.html +13 -13
- package/docs/documentation/modules/TilesModule/dependencies.svg +31 -31
- package/docs/documentation/modules/TilesModule.html +31 -31
- package/docs/documentation/modules/TimePickerModule/dependencies.svg +42 -38
- package/docs/documentation/modules/TimePickerModule.html +42 -38
- package/docs/documentation/modules/TimePickerSelectModule/dependencies.svg +23 -23
- package/docs/documentation/modules/TimePickerSelectModule.html +23 -23
- package/docs/documentation/modules/ToggleModule/dependencies.svg +4 -4
- package/docs/documentation/modules/ToggleModule.html +4 -4
- package/docs/documentation/modules/ToggletipModule/dependencies.svg +37 -37
- package/docs/documentation/modules/ToggletipModule.html +37 -37
- package/docs/documentation/modules/TooltipModule/dependencies.svg +28 -28
- package/docs/documentation/modules/TooltipModule.html +28 -28
- package/docs/documentation/modules/TreeviewModule/dependencies.svg +28 -28
- package/docs/documentation/modules/TreeviewModule.html +28 -28
- package/docs/documentation.json +127 -632
- package/docs/storybook/{3224.14e2c79a.iframe.bundle.js → 3224.3c2075c3.iframe.bundle.js} +1 -1
- package/docs/storybook/{combobox-combobox-stories.e3d08f7d.iframe.bundle.js → combobox-combobox-stories.49ceebb5.iframe.bundle.js} +1 -1
- package/docs/storybook/{datepicker-datepicker-stories.559a71ec.iframe.bundle.js → datepicker-datepicker-stories.71ef84d0.iframe.bundle.js} +1 -1
- package/docs/storybook/iframe.html +2 -2
- package/docs/storybook/main.5e4c090e.iframe.bundle.js +1 -0
- package/docs/storybook/{patterns-dialogs-modal-with-table-stories.b72796c6.iframe.bundle.js → patterns-dialogs-modal-with-table-stories.8acaa07a.iframe.bundle.js} +1 -1
- package/docs/storybook/{patterns-forms-multi-step-form-stories.2ea46e56.iframe.bundle.js → patterns-forms-multi-step-form-stories.495d62f5.iframe.bundle.js} +1 -1
- package/docs/storybook/{patterns-loading-large-loading-stories.e6ae3e31.iframe.bundle.js → patterns-loading-large-loading-stories.564e9ea6.iframe.bundle.js} +1 -1
- package/docs/storybook/{progress-indicator-progress-indicator-stories.dae29927.iframe.bundle.js → progress-indicator-progress-indicator-stories.f7da9e42.iframe.bundle.js} +1 -1
- package/docs/storybook/project.json +1 -1
- package/docs/storybook/{runtime~main.b11c471e.iframe.bundle.js → runtime~main.b2adb95b.iframe.bundle.js} +1 -1
- package/docs/storybook/sb-addons/essentials-controls-1/manager-bundle.js +30 -30
- package/dropdown/dropdown.component.d.ts +3 -3
- package/esm2020/combobox/combobox.component.mjs +5 -5
- package/esm2020/datepicker/datepicker.component.mjs +9 -9
- package/esm2020/dropdown/dropdown.component.mjs +13 -13
- package/esm2020/progress-indicator/progress-indicator.component.mjs +8 -5
- package/fesm2015/carbon-components-angular-combobox.mjs +4 -4
- package/fesm2015/carbon-components-angular-combobox.mjs.map +1 -1
- package/fesm2015/carbon-components-angular-datepicker.mjs +8 -8
- package/fesm2015/carbon-components-angular-datepicker.mjs.map +1 -1
- package/fesm2015/carbon-components-angular-dropdown.mjs +12 -12
- package/fesm2015/carbon-components-angular-dropdown.mjs.map +1 -1
- package/fesm2015/carbon-components-angular-progress-indicator.mjs +7 -4
- package/fesm2015/carbon-components-angular-progress-indicator.mjs.map +1 -1
- package/fesm2020/carbon-components-angular-combobox.mjs +4 -4
- package/fesm2020/carbon-components-angular-combobox.mjs.map +1 -1
- package/fesm2020/carbon-components-angular-datepicker.mjs +8 -8
- package/fesm2020/carbon-components-angular-datepicker.mjs.map +1 -1
- package/fesm2020/carbon-components-angular-dropdown.mjs +12 -12
- package/fesm2020/carbon-components-angular-dropdown.mjs.map +1 -1
- package/fesm2020/carbon-components-angular-progress-indicator.mjs +7 -4
- package/fesm2020/carbon-components-angular-progress-indicator.mjs.map +1 -1
- package/package.json +1 -1
- package/docs/storybook/main.a1247bb8.iframe.bundle.js +0 -1
package/docs/documentation.json
CHANGED
|
@@ -5401,333 +5401,6 @@
|
|
|
5401
5401
|
"guards": [],
|
|
5402
5402
|
"interceptors": [],
|
|
5403
5403
|
"classes": [
|
|
5404
|
-
{
|
|
5405
|
-
"name": "CheckboxExportedTests",
|
|
5406
|
-
"id": "class-CheckboxExportedTests-8affd6b64e31427d567ce5cccb33165a969637d1cc13fac2ac2a4f784ec79f065e254ab87629c3fff06f3492a5402c0b72dab3b809dcc985a6569f5cc5272ebb",
|
|
5407
|
-
"file": "src/checkbox/checkbox-exported-tests.ts",
|
|
5408
|
-
"deprecated": false,
|
|
5409
|
-
"deprecationMessage": "",
|
|
5410
|
-
"type": "class",
|
|
5411
|
-
"sourceCode": "import { expect } from \"chai\";\nimport merge from \"lodash-es/merge\";\nimport ComponentTests from \"../exported-tests/component-tests\";\n\nconst defaults = {\n\tselectors: {\n\t\troot: \"cds-checkbox\",\n\t\tinput: \"input\"\n\t}\n};\n\nclass CheckboxExportedTests extends ComponentTests {\n\tconstructor(configs) {\n\t\tsuper(merge({}, defaults, configs));\n\t\tthis.tests = this.tests.concat(this.structure());\n\t}\n\n\tstructure() {\n\t\tconst tests = [\n\t\t\t{\n\t\t\t\tname: \"initially be unchecked, be checked on click\",\n\t\t\t\tgetActual: fragment =>\n\t\t\t\t\tnew Promise(resolve => {\n\t\t\t\t\t\tconst component = this.getComponent(\n\t\t\t\t\t\t\tfragment,\n\t\t\t\t\t\t\t`${this.settings.selectors.root} ${this.settings.selectors.input}`\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst initialState = component.checked;\n\t\t\t\t\t\tcomponent.click();\n\t\t\t\t\t\tconst afterClickState = component.checked;\n\t\t\t\t\t\tresolve({\n\t\t\t\t\t\t\tinitialState,\n\t\t\t\t\t\t\tafterClickState\n\t\t\t\t\t\t});\n\t\t\t\t\t}),\n\t\t\t\t\trunComparison: results => {\n\t\t\t\t\t// tslint:disable-next-line\n\t\t\t\t\texpect(results.initialState).to.be.false;\n\t\t\t\t\t// tslint:disable-next-line\n\t\t\t\t\texpect(results.afterClickState).to.be.true;\n\t\t\t\t}\n\t\t\t}\n\t\t];\n\t\treturn [{\n\t\t\tname: \"Basic checkbox tests\",\n\t\t\ttests: this.getTests(tests)\n\t\t}];\n\t}\n}\n\nexport default CheckboxExportedTests;\n",
|
|
5412
|
-
"constructorObj": {
|
|
5413
|
-
"name": "constructor",
|
|
5414
|
-
"description": "",
|
|
5415
|
-
"deprecated": false,
|
|
5416
|
-
"deprecationMessage": "",
|
|
5417
|
-
"args": [
|
|
5418
|
-
{
|
|
5419
|
-
"name": "configs",
|
|
5420
|
-
"type": "",
|
|
5421
|
-
"deprecated": false,
|
|
5422
|
-
"deprecationMessage": ""
|
|
5423
|
-
}
|
|
5424
|
-
],
|
|
5425
|
-
"line": 12,
|
|
5426
|
-
"jsdoctags": [
|
|
5427
|
-
{
|
|
5428
|
-
"name": "configs",
|
|
5429
|
-
"type": "",
|
|
5430
|
-
"deprecated": false,
|
|
5431
|
-
"deprecationMessage": "",
|
|
5432
|
-
"tagName": {
|
|
5433
|
-
"text": "param"
|
|
5434
|
-
}
|
|
5435
|
-
}
|
|
5436
|
-
]
|
|
5437
|
-
},
|
|
5438
|
-
"inputsClass": [],
|
|
5439
|
-
"outputsClass": [],
|
|
5440
|
-
"properties": [
|
|
5441
|
-
{
|
|
5442
|
-
"name": "defaults",
|
|
5443
|
-
"defaultValue": "{\n\t\tselectors: {\n\t\t\troot: \"\"\n\t\t},\n\t\tclasses: {}\n\t}",
|
|
5444
|
-
"deprecated": false,
|
|
5445
|
-
"deprecationMessage": "",
|
|
5446
|
-
"type": "object",
|
|
5447
|
-
"optional": false,
|
|
5448
|
-
"description": "",
|
|
5449
|
-
"line": 11,
|
|
5450
|
-
"modifierKind": [
|
|
5451
|
-
126
|
|
5452
|
-
],
|
|
5453
|
-
"inheritance": {
|
|
5454
|
-
"file": "ComponentTests"
|
|
5455
|
-
}
|
|
5456
|
-
},
|
|
5457
|
-
{
|
|
5458
|
-
"name": "settings",
|
|
5459
|
-
"defaultValue": "{}",
|
|
5460
|
-
"deprecated": false,
|
|
5461
|
-
"deprecationMessage": "",
|
|
5462
|
-
"type": "any",
|
|
5463
|
-
"optional": false,
|
|
5464
|
-
"description": "",
|
|
5465
|
-
"line": 17,
|
|
5466
|
-
"inheritance": {
|
|
5467
|
-
"file": "ComponentTests"
|
|
5468
|
-
}
|
|
5469
|
-
},
|
|
5470
|
-
{
|
|
5471
|
-
"name": "tests",
|
|
5472
|
-
"defaultValue": "[]",
|
|
5473
|
-
"deprecated": false,
|
|
5474
|
-
"deprecationMessage": "",
|
|
5475
|
-
"type": "any[]",
|
|
5476
|
-
"optional": false,
|
|
5477
|
-
"description": "",
|
|
5478
|
-
"line": 18,
|
|
5479
|
-
"inheritance": {
|
|
5480
|
-
"file": "ComponentTests"
|
|
5481
|
-
}
|
|
5482
|
-
}
|
|
5483
|
-
],
|
|
5484
|
-
"methods": [
|
|
5485
|
-
{
|
|
5486
|
-
"name": "structure",
|
|
5487
|
-
"args": [],
|
|
5488
|
-
"optional": false,
|
|
5489
|
-
"returnType": "{}",
|
|
5490
|
-
"typeParameters": [],
|
|
5491
|
-
"line": 18,
|
|
5492
|
-
"deprecated": false,
|
|
5493
|
-
"deprecationMessage": ""
|
|
5494
|
-
},
|
|
5495
|
-
{
|
|
5496
|
-
"name": "getComponent",
|
|
5497
|
-
"args": [
|
|
5498
|
-
{
|
|
5499
|
-
"name": "fragment",
|
|
5500
|
-
"type": "",
|
|
5501
|
-
"deprecated": false,
|
|
5502
|
-
"deprecationMessage": ""
|
|
5503
|
-
},
|
|
5504
|
-
{
|
|
5505
|
-
"name": "selector",
|
|
5506
|
-
"type": "",
|
|
5507
|
-
"deprecated": false,
|
|
5508
|
-
"deprecationMessage": ""
|
|
5509
|
-
}
|
|
5510
|
-
],
|
|
5511
|
-
"optional": false,
|
|
5512
|
-
"returnType": "any",
|
|
5513
|
-
"typeParameters": [],
|
|
5514
|
-
"line": 31,
|
|
5515
|
-
"deprecated": false,
|
|
5516
|
-
"deprecationMessage": "",
|
|
5517
|
-
"jsdoctags": [
|
|
5518
|
-
{
|
|
5519
|
-
"name": "fragment",
|
|
5520
|
-
"type": "",
|
|
5521
|
-
"deprecated": false,
|
|
5522
|
-
"deprecationMessage": "",
|
|
5523
|
-
"tagName": {
|
|
5524
|
-
"text": "param"
|
|
5525
|
-
}
|
|
5526
|
-
},
|
|
5527
|
-
{
|
|
5528
|
-
"name": "selector",
|
|
5529
|
-
"type": "",
|
|
5530
|
-
"deprecated": false,
|
|
5531
|
-
"deprecationMessage": "",
|
|
5532
|
-
"tagName": {
|
|
5533
|
-
"text": "param"
|
|
5534
|
-
}
|
|
5535
|
-
}
|
|
5536
|
-
],
|
|
5537
|
-
"inheritance": {
|
|
5538
|
-
"file": "ComponentTests"
|
|
5539
|
-
}
|
|
5540
|
-
},
|
|
5541
|
-
{
|
|
5542
|
-
"name": "getTests",
|
|
5543
|
-
"args": [
|
|
5544
|
-
{
|
|
5545
|
-
"name": "tests",
|
|
5546
|
-
"type": "",
|
|
5547
|
-
"deprecated": false,
|
|
5548
|
-
"deprecationMessage": ""
|
|
5549
|
-
}
|
|
5550
|
-
],
|
|
5551
|
-
"optional": false,
|
|
5552
|
-
"returnType": "any",
|
|
5553
|
-
"typeParameters": [],
|
|
5554
|
-
"line": 24,
|
|
5555
|
-
"deprecated": false,
|
|
5556
|
-
"deprecationMessage": "",
|
|
5557
|
-
"jsdoctags": [
|
|
5558
|
-
{
|
|
5559
|
-
"name": "tests",
|
|
5560
|
-
"type": "",
|
|
5561
|
-
"deprecated": false,
|
|
5562
|
-
"deprecationMessage": "",
|
|
5563
|
-
"tagName": {
|
|
5564
|
-
"text": "param"
|
|
5565
|
-
}
|
|
5566
|
-
}
|
|
5567
|
-
],
|
|
5568
|
-
"inheritance": {
|
|
5569
|
-
"file": "ComponentTests"
|
|
5570
|
-
}
|
|
5571
|
-
}
|
|
5572
|
-
],
|
|
5573
|
-
"indexSignatures": [],
|
|
5574
|
-
"extends": [
|
|
5575
|
-
"ComponentTests"
|
|
5576
|
-
],
|
|
5577
|
-
"hostBindings": [],
|
|
5578
|
-
"hostListeners": []
|
|
5579
|
-
},
|
|
5580
|
-
{
|
|
5581
|
-
"name": "ComponentTests",
|
|
5582
|
-
"id": "class-ComponentTests-570443a7237adc3e663bcb3ca106de54f8e8cc0ebfcc230b0e3b5b7b379888a1916d9e4633ef24e1c9784c6da4ffe0c94b041f3768bd78ad27029c63a5fe0802",
|
|
5583
|
-
"file": "src/exported-tests/component-tests.ts",
|
|
5584
|
-
"deprecated": false,
|
|
5585
|
-
"deprecationMessage": "",
|
|
5586
|
-
"type": "class",
|
|
5587
|
-
"sourceCode": "import merge from \"lodash-es/merge\";\n\nfunction isObject(val) {\n\tif (val === null) {\n\t\treturn false;\n\t}\n\treturn typeof val === \"function\" || typeof val === \"object\";\n}\n\nclass ComponentTests {\n\tstatic defaults = {\n\t\tselectors: {\n\t\t\troot: \"\"\n\t\t},\n\t\tclasses: {}\n\t};\n\tsettings: any = {};\n\ttests: any[] = [];\n\n\tconstructor(configs = {}) {\n\t\tthis.settings = merge({}, ComponentTests.defaults, configs);\n\t}\n\n\tgetTests(tests) {\n\t\tif (isObject(tests)) {\n\t\t\treturn Object.keys(tests).map(i => tests[i]);\n\t\t}\n\t\treturn tests;\n\t}\n\n\tgetComponent(fragment, selector) {\n\t\tconst root = fragment.querySelector(selector);\n\t\treturn root;\n\t}\n}\n\nexport default ComponentTests;\n",
|
|
5588
|
-
"constructorObj": {
|
|
5589
|
-
"name": "constructor",
|
|
5590
|
-
"description": "",
|
|
5591
|
-
"deprecated": false,
|
|
5592
|
-
"deprecationMessage": "",
|
|
5593
|
-
"args": [
|
|
5594
|
-
{
|
|
5595
|
-
"name": "configs",
|
|
5596
|
-
"type": "object",
|
|
5597
|
-
"deprecated": false,
|
|
5598
|
-
"deprecationMessage": "",
|
|
5599
|
-
"defaultValue": "{}"
|
|
5600
|
-
}
|
|
5601
|
-
],
|
|
5602
|
-
"line": 18,
|
|
5603
|
-
"jsdoctags": [
|
|
5604
|
-
{
|
|
5605
|
-
"name": "configs",
|
|
5606
|
-
"type": "object",
|
|
5607
|
-
"deprecated": false,
|
|
5608
|
-
"deprecationMessage": "",
|
|
5609
|
-
"defaultValue": "{}",
|
|
5610
|
-
"tagName": {
|
|
5611
|
-
"text": "param"
|
|
5612
|
-
}
|
|
5613
|
-
}
|
|
5614
|
-
]
|
|
5615
|
-
},
|
|
5616
|
-
"inputsClass": [],
|
|
5617
|
-
"outputsClass": [],
|
|
5618
|
-
"properties": [
|
|
5619
|
-
{
|
|
5620
|
-
"name": "defaults",
|
|
5621
|
-
"defaultValue": "{\n\t\tselectors: {\n\t\t\troot: \"\"\n\t\t},\n\t\tclasses: {}\n\t}",
|
|
5622
|
-
"deprecated": false,
|
|
5623
|
-
"deprecationMessage": "",
|
|
5624
|
-
"type": "object",
|
|
5625
|
-
"optional": false,
|
|
5626
|
-
"description": "",
|
|
5627
|
-
"line": 11,
|
|
5628
|
-
"modifierKind": [
|
|
5629
|
-
126
|
|
5630
|
-
]
|
|
5631
|
-
},
|
|
5632
|
-
{
|
|
5633
|
-
"name": "settings",
|
|
5634
|
-
"defaultValue": "{}",
|
|
5635
|
-
"deprecated": false,
|
|
5636
|
-
"deprecationMessage": "",
|
|
5637
|
-
"type": "any",
|
|
5638
|
-
"optional": false,
|
|
5639
|
-
"description": "",
|
|
5640
|
-
"line": 17
|
|
5641
|
-
},
|
|
5642
|
-
{
|
|
5643
|
-
"name": "tests",
|
|
5644
|
-
"defaultValue": "[]",
|
|
5645
|
-
"deprecated": false,
|
|
5646
|
-
"deprecationMessage": "",
|
|
5647
|
-
"type": "any[]",
|
|
5648
|
-
"optional": false,
|
|
5649
|
-
"description": "",
|
|
5650
|
-
"line": 18
|
|
5651
|
-
}
|
|
5652
|
-
],
|
|
5653
|
-
"methods": [
|
|
5654
|
-
{
|
|
5655
|
-
"name": "getComponent",
|
|
5656
|
-
"args": [
|
|
5657
|
-
{
|
|
5658
|
-
"name": "fragment",
|
|
5659
|
-
"type": "",
|
|
5660
|
-
"deprecated": false,
|
|
5661
|
-
"deprecationMessage": ""
|
|
5662
|
-
},
|
|
5663
|
-
{
|
|
5664
|
-
"name": "selector",
|
|
5665
|
-
"type": "",
|
|
5666
|
-
"deprecated": false,
|
|
5667
|
-
"deprecationMessage": ""
|
|
5668
|
-
}
|
|
5669
|
-
],
|
|
5670
|
-
"optional": false,
|
|
5671
|
-
"returnType": "any",
|
|
5672
|
-
"typeParameters": [],
|
|
5673
|
-
"line": 31,
|
|
5674
|
-
"deprecated": false,
|
|
5675
|
-
"deprecationMessage": "",
|
|
5676
|
-
"jsdoctags": [
|
|
5677
|
-
{
|
|
5678
|
-
"name": "fragment",
|
|
5679
|
-
"type": "",
|
|
5680
|
-
"deprecated": false,
|
|
5681
|
-
"deprecationMessage": "",
|
|
5682
|
-
"tagName": {
|
|
5683
|
-
"text": "param"
|
|
5684
|
-
}
|
|
5685
|
-
},
|
|
5686
|
-
{
|
|
5687
|
-
"name": "selector",
|
|
5688
|
-
"type": "",
|
|
5689
|
-
"deprecated": false,
|
|
5690
|
-
"deprecationMessage": "",
|
|
5691
|
-
"tagName": {
|
|
5692
|
-
"text": "param"
|
|
5693
|
-
}
|
|
5694
|
-
}
|
|
5695
|
-
]
|
|
5696
|
-
},
|
|
5697
|
-
{
|
|
5698
|
-
"name": "getTests",
|
|
5699
|
-
"args": [
|
|
5700
|
-
{
|
|
5701
|
-
"name": "tests",
|
|
5702
|
-
"type": "",
|
|
5703
|
-
"deprecated": false,
|
|
5704
|
-
"deprecationMessage": ""
|
|
5705
|
-
}
|
|
5706
|
-
],
|
|
5707
|
-
"optional": false,
|
|
5708
|
-
"returnType": "any",
|
|
5709
|
-
"typeParameters": [],
|
|
5710
|
-
"line": 24,
|
|
5711
|
-
"deprecated": false,
|
|
5712
|
-
"deprecationMessage": "",
|
|
5713
|
-
"jsdoctags": [
|
|
5714
|
-
{
|
|
5715
|
-
"name": "tests",
|
|
5716
|
-
"type": "",
|
|
5717
|
-
"deprecated": false,
|
|
5718
|
-
"deprecationMessage": "",
|
|
5719
|
-
"tagName": {
|
|
5720
|
-
"text": "param"
|
|
5721
|
-
}
|
|
5722
|
-
}
|
|
5723
|
-
]
|
|
5724
|
-
}
|
|
5725
|
-
],
|
|
5726
|
-
"indexSignatures": [],
|
|
5727
|
-
"extends": [],
|
|
5728
|
-
"hostBindings": [],
|
|
5729
|
-
"hostListeners": []
|
|
5730
|
-
},
|
|
5731
5404
|
{
|
|
5732
5405
|
"name": "CustomHeaderItem",
|
|
5733
5406
|
"id": "class-CustomHeaderItem-43dec1fee39d015661af87a2e0758230b3fe81f583b813b9295a920fa61c1f02e93d480424afab37673e46ee64fddb53093c74715a7b4269e5e642504d5fa75b",
|
|
@@ -26053,7 +25726,7 @@
|
|
|
26053
25726
|
},
|
|
26054
25727
|
{
|
|
26055
25728
|
"name": "ComboBox",
|
|
26056
|
-
"id": "component-ComboBox-
|
|
25729
|
+
"id": "component-ComboBox-efa282052e0cf1f3c3085852368cf9ab633555f4a730773591e42493ec4569bcb4bf3ca55391c4827e6ab2f1940bb941c81bbde8fa326e6f0e291512c7a9d8b4",
|
|
26057
25730
|
"file": "src/combobox/combobox.component.ts",
|
|
26058
25731
|
"encapsulation": [],
|
|
26059
25732
|
"entryComponents": [],
|
|
@@ -26654,7 +26327,7 @@
|
|
|
26654
26327
|
"optional": false,
|
|
26655
26328
|
"returnType": "void",
|
|
26656
26329
|
"typeParameters": [],
|
|
26657
|
-
"line":
|
|
26330
|
+
"line": 878,
|
|
26658
26331
|
"deprecated": false,
|
|
26659
26332
|
"deprecationMessage": "",
|
|
26660
26333
|
"rawdescription": "\n\nCreates the `Dropdown` list as an element that is appended to the DOM body.\n",
|
|
@@ -26666,7 +26339,7 @@
|
|
|
26666
26339
|
"optional": false,
|
|
26667
26340
|
"returnType": "void",
|
|
26668
26341
|
"typeParameters": [],
|
|
26669
|
-
"line":
|
|
26342
|
+
"line": 889,
|
|
26670
26343
|
"deprecated": false,
|
|
26671
26344
|
"deprecationMessage": "",
|
|
26672
26345
|
"rawdescription": "\n\nCreates the `Dropdown` list appending it to the dropdown parent object instead of the body.\n",
|
|
@@ -26685,7 +26358,7 @@
|
|
|
26685
26358
|
"optional": false,
|
|
26686
26359
|
"returnType": "void",
|
|
26687
26360
|
"typeParameters": [],
|
|
26688
|
-
"line":
|
|
26361
|
+
"line": 858,
|
|
26689
26362
|
"deprecated": false,
|
|
26690
26363
|
"deprecationMessage": "",
|
|
26691
26364
|
"rawdescription": "\n\nHandles keyboard events so users are controlling the `Dropdown` instead of unintentionally controlling outside elements.\n",
|
|
@@ -26725,7 +26398,7 @@
|
|
|
26725
26398
|
"optional": false,
|
|
26726
26399
|
"returnType": "void",
|
|
26727
26400
|
"typeParameters": [],
|
|
26728
|
-
"line":
|
|
26401
|
+
"line": 918,
|
|
26729
26402
|
"deprecated": false,
|
|
26730
26403
|
"deprecationMessage": "",
|
|
26731
26404
|
"rawdescription": "\n\nHandles clicks outside of the `Dropdown` list.\n",
|
|
@@ -26748,7 +26421,7 @@
|
|
|
26748
26421
|
"optional": false,
|
|
26749
26422
|
"returnType": "any",
|
|
26750
26423
|
"typeParameters": [],
|
|
26751
|
-
"line":
|
|
26424
|
+
"line": 898,
|
|
26752
26425
|
"deprecated": false,
|
|
26753
26426
|
"deprecationMessage": "",
|
|
26754
26427
|
"rawdescription": "\n\nDetects whether or not the `Dropdown` list is visible within all scrollable parents.\nThis can be overridden by passing in a value to the `dropUp` input.\n",
|
|
@@ -26767,7 +26440,7 @@
|
|
|
26767
26440
|
"optional": false,
|
|
26768
26441
|
"returnType": "void",
|
|
26769
26442
|
"typeParameters": [],
|
|
26770
|
-
"line":
|
|
26443
|
+
"line": 830,
|
|
26771
26444
|
"deprecated": false,
|
|
26772
26445
|
"deprecationMessage": "",
|
|
26773
26446
|
"jsdoctags": [
|
|
@@ -26795,7 +26468,7 @@
|
|
|
26795
26468
|
"optional": false,
|
|
26796
26469
|
"returnType": "void",
|
|
26797
26470
|
"typeParameters": [],
|
|
26798
|
-
"line":
|
|
26471
|
+
"line": 704,
|
|
26799
26472
|
"deprecated": false,
|
|
26800
26473
|
"deprecationMessage": "",
|
|
26801
26474
|
"modifierKind": [
|
|
@@ -26819,7 +26492,7 @@
|
|
|
26819
26492
|
"optional": false,
|
|
26820
26493
|
"returnType": "void",
|
|
26821
26494
|
"typeParameters": [],
|
|
26822
|
-
"line":
|
|
26495
|
+
"line": 738,
|
|
26823
26496
|
"deprecated": false,
|
|
26824
26497
|
"deprecationMessage": "",
|
|
26825
26498
|
"rawdescription": "\n\nCloses the dropdown and emits the close event.\n",
|
|
@@ -26841,7 +26514,7 @@
|
|
|
26841
26514
|
"optional": false,
|
|
26842
26515
|
"returnType": "void",
|
|
26843
26516
|
"typeParameters": [],
|
|
26844
|
-
"line":
|
|
26517
|
+
"line": 927,
|
|
26845
26518
|
"deprecated": false,
|
|
26846
26519
|
"deprecationMessage": "",
|
|
26847
26520
|
"jsdoctags": [
|
|
@@ -26908,7 +26581,7 @@
|
|
|
26908
26581
|
"optional": false,
|
|
26909
26582
|
"returnType": "boolean",
|
|
26910
26583
|
"typeParameters": [],
|
|
26911
|
-
"line":
|
|
26584
|
+
"line": 851,
|
|
26912
26585
|
"deprecated": false,
|
|
26913
26586
|
"deprecationMessage": "",
|
|
26914
26587
|
"modifierKind": [
|
|
@@ -26932,7 +26605,7 @@
|
|
|
26932
26605
|
"optional": false,
|
|
26933
26606
|
"returnType": "void",
|
|
26934
26607
|
"typeParameters": [],
|
|
26935
|
-
"line":
|
|
26608
|
+
"line": 674,
|
|
26936
26609
|
"deprecated": false,
|
|
26937
26610
|
"deprecationMessage": ""
|
|
26938
26611
|
},
|
|
@@ -26956,7 +26629,7 @@
|
|
|
26956
26629
|
"optional": false,
|
|
26957
26630
|
"returnType": "void",
|
|
26958
26631
|
"typeParameters": [],
|
|
26959
|
-
"line":
|
|
26632
|
+
"line": 786,
|
|
26960
26633
|
"deprecated": false,
|
|
26961
26634
|
"deprecationMessage": "",
|
|
26962
26635
|
"rawdescription": "\n\nSets the list group filter, and manages single select item selection.\n",
|
|
@@ -26999,7 +26672,7 @@
|
|
|
26999
26672
|
"optional": false,
|
|
27000
26673
|
"returnType": "void",
|
|
27001
26674
|
"typeParameters": [],
|
|
27002
|
-
"line":
|
|
26675
|
+
"line": 819,
|
|
27003
26676
|
"deprecated": false,
|
|
27004
26677
|
"deprecationMessage": "",
|
|
27005
26678
|
"rawdescription": "\n\nIntended to be used to add items to the list.\n",
|
|
@@ -27025,7 +26698,7 @@
|
|
|
27025
26698
|
"optional": false,
|
|
27026
26699
|
"returnType": "void",
|
|
27027
26700
|
"typeParameters": [],
|
|
27028
|
-
"line":
|
|
26701
|
+
"line": 752,
|
|
27029
26702
|
"deprecated": false,
|
|
27030
26703
|
"deprecationMessage": "",
|
|
27031
26704
|
"rawdescription": "\n\nOpens the dropdown.\n",
|
|
@@ -27047,7 +26720,7 @@
|
|
|
27047
26720
|
"optional": false,
|
|
27048
26721
|
"returnType": "void",
|
|
27049
26722
|
"typeParameters": [],
|
|
27050
|
-
"line":
|
|
26723
|
+
"line": 678,
|
|
27051
26724
|
"deprecated": false,
|
|
27052
26725
|
"deprecationMessage": "",
|
|
27053
26726
|
"jsdoctags": [
|
|
@@ -27075,7 +26748,7 @@
|
|
|
27075
26748
|
"optional": false,
|
|
27076
26749
|
"returnType": "void",
|
|
27077
26750
|
"typeParameters": [],
|
|
27078
|
-
"line":
|
|
26751
|
+
"line": 683,
|
|
27079
26752
|
"deprecated": false,
|
|
27080
26753
|
"deprecationMessage": "",
|
|
27081
26754
|
"jsdoctags": [
|
|
@@ -27103,7 +26776,7 @@
|
|
|
27103
26776
|
"optional": false,
|
|
27104
26777
|
"returnType": "void",
|
|
27105
26778
|
"typeParameters": [],
|
|
27106
|
-
"line":
|
|
26779
|
+
"line": 692,
|
|
27107
26780
|
"deprecated": false,
|
|
27108
26781
|
"deprecationMessage": "",
|
|
27109
26782
|
"rawdescription": "\n\n`ControlValueAccessor` method to programmatically disable the combobox.\n\nex: `this.formGroup.get(\"myCoolCombobox\").disable();`\n",
|
|
@@ -27126,7 +26799,7 @@
|
|
|
27126
26799
|
"optional": false,
|
|
27127
26800
|
"returnType": "void",
|
|
27128
26801
|
"typeParameters": [],
|
|
27129
|
-
"line":
|
|
26802
|
+
"line": 775,
|
|
27130
26803
|
"deprecated": false,
|
|
27131
26804
|
"deprecationMessage": "",
|
|
27132
26805
|
"rawdescription": "\n\nToggles the dropdown.\n",
|
|
@@ -27141,7 +26814,7 @@
|
|
|
27141
26814
|
"optional": false,
|
|
27142
26815
|
"returnType": "void",
|
|
27143
26816
|
"typeParameters": [],
|
|
27144
|
-
"line":
|
|
26817
|
+
"line": 699,
|
|
27145
26818
|
"deprecated": false,
|
|
27146
26819
|
"deprecationMessage": "",
|
|
27147
26820
|
"rawdescription": "\n\nCalled by `n-pill-input` when the selected pills have changed.\n",
|
|
@@ -27218,7 +26891,7 @@
|
|
|
27218
26891
|
"description": "<p>Get started with importing the module:</p>\n<b>Example :</b><div><pre class=\"line-numbers\"><code class=\"language-typescript\">import { ComboBoxModule } from 'carbon-components-angular';</code></pre></div><p>ComboBoxes are similar to dropdowns, except a combobox provides an input field for users to search items and (optionally) add their own.\nMulti-select comboboxes also provide "pills" of selected items.</p>\n<p><a href=\"../../?path=/story/components-combobox--basic\">See demo</a></p>\n",
|
|
27219
26892
|
"rawdescription": "\n\nGet started with importing the module:\n\n```typescript\nimport { ComboBoxModule } from 'carbon-components-angular';\n```\n\nComboBoxes are similar to dropdowns, except a combobox provides an input field for users to search items and (optionally) add their own.\nMulti-select comboboxes also provide \"pills\" of selected items.\n\n[See demo](../../?path=/story/components-combobox--basic)\n",
|
|
27220
26893
|
"type": "component",
|
|
27221
|
-
"sourceCode": "import {\n\tComponent,\n\tOnChanges,\n\tContentChild,\n\tInput,\n\tOutput,\n\tHostListener,\n\tElementRef,\n\tViewChild,\n\tEventEmitter,\n\tAfterViewInit,\n\tAfterContentInit,\n\tHostBinding,\n\tTemplateRef,\n\tOnDestroy\n} from \"@angular/core\";\nimport { AbstractDropdownView, DropdownService } from \"carbon-components-angular/dropdown\";\nimport { ListItem } from \"carbon-components-angular/dropdown\";\nimport { NG_VALUE_ACCESSOR } from \"@angular/forms\";\nimport { filter } from \"rxjs/operators\";\nimport {\n\tgetScrollableParents,\n\thasScrollableParents\n} from \"carbon-components-angular/utils\";\nimport { I18n, Overridable } from \"carbon-components-angular/i18n\";\nimport { Observable } from \"rxjs\";\n\n/**\n * Get started with importing the module:\n *\n * ```typescript\n * import { ComboBoxModule } from 'carbon-components-angular';\n * ```\n *\n * ComboBoxes are similar to dropdowns, except a combobox provides an input field for users to search items and (optionally) add their own.\n * Multi-select comboboxes also provide \"pills\" of selected items.\n *\n * [See demo](../../?path=/story/components-combobox--basic)\n */\n@Component({\n\tselector: \"cds-combo-box, ibm-combo-box\",\n\ttemplate: `\n\t\t<div\n\t\t\tclass=\"cds--list-box__wrapper\"\n\t\t\t[ngClass]=\"{\n\t\t\t\t'cds--list-box__wrapper--fluid': fluid,\n\t\t\t\t'cds--list-box__wrapper--fluid--invalid': fluid && invalid,\n\t\t\t\t'cds--list-box__wrapper--fluid--focus': fluid && _isFocused,\n\t\t\t\t'cds--list-box__wrapper--decorator': !!decorator\n\t\t\t}\">\n\t\t\t<label\n\t\t\t\t*ngIf=\"label\"\n\t\t\t\t[for]=\"id\"\n\t\t\t\t[id]=\"labelId\"\n\t\t\t\tclass=\"cds--label\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--label--disabled': disabled,\n\t\t\t\t\t'cds--visually-hidden': hideLabel\n\t\t\t\t}\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(label)\">{{label}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(label)\" [ngTemplateOutlet]=\"label\"></ng-template>\n\t\t\t</label>\n\t\t\t<div\n\t\t\t\t#listbox\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--multi-select cds--multi-select--filterable': type === 'multi',\n\t\t\t\t\t'cds--list-box--light': theme === 'light',\n\t\t\t\t\t'cds--list-box--expanded': open,\n\t\t\t\t\t'cds--list-box--sm': size === 'sm',\n\t\t\t\t\t'cds--list-box--md': size === 'md',\n\t\t\t\t\t'cds--list-box--lg': size === 'lg',\n\t\t\t\t\t'cds--list-box--disabled': disabled,\n\t\t\t\t\t'cds--combo-box--readonly': readonly,\n\t\t\t\t\t'cds--combo-box--warning cds--list-box--warning': warn,\n\t\t\t\t\t'cds--list-box--invalid': invalid\n\t\t\t\t}\"\n\t\t\t\tclass=\"cds--list-box cds--combo-box\"\n\t\t\t\t[attr.data-invalid]=\"(invalid ? true : null)\">\n\t\t\t\t<div\n\t\t\t\t\tclass=\"cds--list-box__field\"\n\t\t\t\t\t(click)=\"toggleDropdown()\"\n\t\t\t\t\t(blur)=\"onBlur()\">\n\t\t\t\t\t<div\n\t\t\t\t\t\t*ngIf=\"type === 'multi' && pills.length > 0\"\n\t\t\t\t\t\tclass=\"cds--tag cds--tag--filter cds--tag--high-contrast\"\n\t\t\t\t\t\t[ngClass]=\"{'cds--tag--disabled': disabled || readonly}\">\n\t\t\t\t\t\t<span class=\"cds--tag__label\">{{ pills.length }}</span>\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t(click)=\"clearSelected($event)\"\n\t\t\t\t\t\t\t(blur)=\"onBlur()\"\n\t\t\t\t\t\t\t(keydown.enter)=\"clearSelected($event)\"\n\t\t\t\t\t\t\tclass=\"cds--tag__close-icon\"\n\t\t\t\t\t\t\ttabindex=\"0\"\n\t\t\t\t\t\t\t[title]=\"clearSelectionsTitle\"\n\t\t\t\t\t\t\t[disabled]=\"disabled || readonly\"\n\t\t\t\t\t\t\t[attr.aria-label]=\"clearSelectionAria\">\n\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\tfocusable=\"false\"\n\t\t\t\t\t\t\t\tpreserveAspectRatio=\"xMidYMid meet\"\n\t\t\t\t\t\t\t\tstyle=\"will-change: transform;\"\n\t\t\t\t\t\t\t\trole=\"img\"\n\t\t\t\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\t\t\t\twidth=\"16\"\n\t\t\t\t\t\t\t\theight=\"16\"\n\t\t\t\t\t\t\t\tviewBox=\"0 0 16 16\"\n\t\t\t\t\t\t\t\taria-hidden=\"true\">\n\t\t\t\t\t\t\t\t<path d=\"M12 4.7l-.7-.7L8 7.3 4.7 4l-.7.7L7.3 8 4 11.3l.7.7L8 8.7l3.3 3.3.7-.7L8.7 8z\"></path>\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</div>\n\t\t\t\t\t<input\n\t\t\t\t\t\t#input\n\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\tautocomplete=\"off\"\n\t\t\t\t\t\trole=\"combobox\"\n\t\t\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t\t\t[readOnly]=\"readonly\"\n\t\t\t\t\t\t(input)=\"onSearch($event.target.value)\"\n\t\t\t\t\t\t(focus)=\"fluid ? handleFocus($event) : null\"\n\t\t\t\t\t\t(blur)=\"fluid ? handleFocus($event) : onBlur()\"\n\t\t\t\t\t\t(keydown.enter)=\"onSubmit($event)\"\n\t\t\t\t\t\t[value]=\"selectedValue\"\n\t\t\t\t\t\tclass=\"cds--text-input\"\n\t\t\t\t\t\t[ngClass]=\"{'cds--text-input--empty': !showClearButton}\"\n\t\t\t\t\t\ttabindex=\"0\"\n\t\t\t\t\t\t[id]=\"id\"\n\t\t\t\t\t\t[attr.aria-labelledby]=\"labelId\"\n\t\t\t\t\t\t[attr.aria-expanded]=\"open\"\n\t\t\t\t\t\taria-haspopup=\"listbox\"\n\t\t\t\t\t\t[attr.maxlength]=\"maxLength\"\n\t\t\t\t\t\t[attr.aria-controls]=\"open ? view?.listId : null\"\n\t\t\t\t\t\t[attr.aria-autocomplete]=\"autocomplete\"\n\t\t\t\t\t\t[placeholder]=\"placeholder\"/>\n\t\t\t\t\t<svg\n\t\t\t\t\t\t*ngIf=\"invalid\"\n\t\t\t\t\t\tcdsIcon=\"warning--filled\"\n\t\t\t\t\t\tsize=\"16\"\n\t\t\t\t\t\tclass=\"cds--list-box__invalid-icon\">\n\t\t\t\t\t</svg>\n\t\t\t\t\t<svg\n\t\t\t\t\t\t*ngIf=\"!invalid && warn\"\n\t\t\t\t\t\tcdsIcon=\"warning--alt--filled\"\n\t\t\t\t\t\tsize=\"16\"\n\t\t\t\t\t\tclass=\"cds--list-box__invalid-icon cds--list-box__invalid-icon--warning\">\n\t\t\t\t\t</svg>\n\t\t\t\t\t<div\n\t\t\t\t\t\t*ngIf=\"showClearButton\"\n\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\tclass=\"cds--list-box__selection\"\n\t\t\t\t\t\ttabindex=\"0\"\n\t\t\t\t\t\t[attr.aria-label]=\"clearSelectionAria\"\n\t\t\t\t\t\t[title]=\"clearSelectionTitle\"\n\t\t\t\t\t\t(keyup.enter)=\"clearInput($event)\"\n\t\t\t\t\t\t(click)=\"clearInput($event)\"\n\t\t\t\t\t\t(blur)=\"onBlur()\">\n\t\t\t\t\t\t<svg cdsIcon=\"close\" size=\"16\"></svg>\n\t\t\t\t\t</div>\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\tclass=\"cds--list-box__menu-icon\"\n\t\t\t\t\t\ttabindex=\"-1\"\n\t\t\t\t\t\t[title]=\"open ? closeMenuAria : openMenuAria\"\n\t\t\t\t\t\t[attr.aria-label]=\"open ? closeMenuAria : openMenuAria\"\n\t\t\t\t\t\t[ngClass]=\"{'cds--list-box__menu-icon--open': open}\">\n\t\t\t\t\t\t<svg cdsIcon=\"chevron--down\" size=\"16\"></svg>\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t\t<ng-container *ngIf=\"decorator\">\n\t\t\t\t\t<div class=\"cds--list-box__inner-wrapper--decorator\">\n\t\t\t\t\t\t<ng-template [ngTemplateOutlet]=\"decorator\"></ng-template>\n\t\t\t\t\t</div>\n\t\t\t\t</ng-container>\n\t\t\t\t<div\n\t\t\t\t\t#dropdownMenu\n\t\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t\t'cds--list-box--up': this.dropUp !== null && this.dropUp !== undefined ? dropUp : _dropUp\n\t\t\t\t\t}\">\n\t\t\t\t\t<ng-content *ngIf=\"open\"></ng-content>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<hr *ngIf=\"fluid\" class=\"cds--list-box__divider\" />\n\t\t\t<div\n\t\t\t\t*ngIf=\"helperText && !invalid && !warn && !fluid\"\n\t\t\t\tclass=\"cds--form__helper-text\"\n\t\t\t\t[ngClass]=\"{'cds--form__helper-text--disabled': disabled}\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(helperText)\">{{helperText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(helperText)\" [ngTemplateOutlet]=\"helperText\"></ng-template>\n\t\t\t</div>\n\t\t\t<div *ngIf=\"invalid\" class=\"cds--form-requirement\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(invalidText)\">{{ invalidText }}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(invalidText)\" [ngTemplateOutlet]=\"invalidText\"></ng-template>\n\t\t\t</div>\n\t\t\t<div *ngIf=\"!invalid && warn\" class=\"cds--form-requirement\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(warnText)\">{{warnText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(warnText)\" [ngTemplateOutlet]=\"warnText\"></ng-template>\n\t\t\t</div>\n\t\t</div>\n\t`,\n\tproviders: [\n\t\t{\n\t\t\tprovide: NG_VALUE_ACCESSOR,\n\t\t\tuseExisting: ComboBox,\n\t\t\tmulti: true\n\t\t}\n\t]\n})\nexport class ComboBox implements OnChanges, AfterViewInit, AfterContentInit, OnDestroy {\n\t/**\n\t * Text to show when nothing is selected.\n\t */\n\t@Input() set placeholder(value: string | Observable<string>) {\n\t\tthis._placeholder.override(value);\n\t}\n\n\tget placeholder() {\n\t\treturn this._placeholder.value;\n\t}\n\t/**\n\t * Value to display for accessibility purposes on the combobox control menu when closed\n\t */\n\t@Input() set openMenuAria(value: string | Observable<string>) {\n\t\tthis._openMenuAria.override(value);\n\t}\n\n\tget openMenuAria() {\n\t\treturn this._openMenuAria.value;\n\t}\n\t/**\n\t * Value to display for accessibility purposes on the combobox control menu when opened\n\t */\n\t@Input() set closeMenuAria(value: string | Observable<string>) {\n\t\tthis._closeMenuAria.override(value);\n\t}\n\n\tget closeMenuAria() {\n\t\treturn this._closeMenuAria.value;\n\t}\n\t/**\n\t * Value to display on the clear selections icon, when multi is selected\n\t */\n\t@Input() set clearSelectionsTitle(value: string | Observable<string>) {\n\t\tthis._clearSelectionsTitle.override(value);\n\t}\n\n\tget clearSelectionsTitle() {\n\t\treturn this._clearSelectionsTitle.value;\n\t}\n\t/**\n\t * Value to display for accessibility purposes to clear selections, when multi is selected\n\t */\n\t@Input() set clearSelectionsAria(value: string | Observable<string>) {\n\t\tthis._clearSelectionsAria.override(value);\n\t}\n\n\tget clearSelectionsAria() {\n\t\treturn this._clearSelectionsAria.value;\n\t}\n\t/**\n\t * Value to display on the clear the selected item icon, when single is selected\n\t */\n\t@Input() set clearSelectionTitle(value: string | Observable<string>) {\n\t\tthis._clearSelectionTitle.override(value);\n\t}\n\n\tget clearSelectionTitle() {\n\t\treturn this._clearSelectionTitle.value;\n\t}\n\t/**\n\t * Value to display for accessibility purposes on the clear the selected item icon, when single is selected\n\t */\n\t@Input() set clearSelectionAria(value: string | Observable<string>) {\n\t\tthis._clearSelectionAria.override(value);\n\t}\n\n\tget clearSelectionAria() {\n\t\treturn this._clearSelectionAria.value;\n\t}\n\tstatic comboBoxCount = 0;\n\t@Input() id = `combobox-${ComboBox.comboBoxCount++}`;\n\t@Input() labelId = `combobox-label-${ComboBox.comboBoxCount++}`;\n\t/**\n\t * List of items to fill the content with.\n\t *\n\t * **Example:**\n\t * ```javascript\n\t * items = [\n\t *\t\t{\n\t *\t\t\tcontent: \"Abacus\",\n\t *\t\t\tselected: false\n\t *\t\t},\n\t *\t\t{\n\t *\t\t\tcontent: \"Byte\",\n\t *\t\t\tselected: false,\n\t *\t\t},\n\t *\t\t{\n\t *\t\t\tcontent: \"Computer\",\n\t *\t\t\tselected: false\n\t *\t\t},\n\t *\t\t{\n\t *\t\t\tcontent: \"Digital\",\n\t *\t\t\tselected: false\n\t *\t\t}\n\t * ];\n\t * ```\n\t *\n\t */\n\t@Input() items: Array<ListItem> = [];\n\t/**\n\t * Combo box type (supporting single or multi selection of items).\n\t */\n\t@Input() type: \"single\" | \"multi\" = \"single\";\n\t/**\n\t * Combo box render size.\n\t */\n\t@Input() size: \"sm\" | \"md\" | \"lg\" = \"md\";\n\t/**\n\t * Specifies the property to be used as the return value to `ngModel`\n\t */\n\t@Input() itemValueKey: string;\n\t/**\n\t * Label for the combobox.\n\t */\n\t@Input() label: string | TemplateRef<any>;\n\t/**\n\t * Hide label while keeping it accessible for screen readers\n\t */\n\t@Input() hideLabel = false;\n\t/**\n\t * Sets the optional helper text.\n\t */\n\t@Input() helperText: string | TemplateRef<any>;\n\n\t/**\n\t * **Experimental**: Optional decorator (e.g. AI label).\n\t */\n\t@Input() decorator: TemplateRef<any>;\n\t/**\n\t * set to `true` to place the dropdown view inline with the component\n\t */\n\t@Input() appendInline: boolean = null;\n\t/**\n\t * Set to `true` to show the invalid state.\n\t */\n\t@Input() invalid = false;\n\t/**\n\t * Value displayed if combobox is in an invalid state.\n\t */\n\t@Input() invalidText: string | TemplateRef<any>;\n\t/**\n\t* Set to `true` to show a warning (contents set by warnText)\n\t*/\n\t@Input() warn = false;\n\t/**\n\t * Sets the warning text\n\t */\n\t@Input() warnText: string | TemplateRef<any>;\n\t/**\n\t * Max length value to limit input characters\n\t */\n\t@Input() maxLength: number = null;\n\t/**\n\t * @deprecated since v5 - Use `cdsLayer` directive instead\n\t */\n\t@Input() theme: \"light\" | \"dark\" = \"dark\";\n\t/**\n\t * Specify feedback (mode) of the selection.\n\t * `top`: selected item jumps to top\n\t * `fixed`: selected item stays at its position\n\t * `top-after-reopen`: selected item jump to top after reopen dropdown\n\t */\n\t@Input() selectionFeedback: \"top\" | \"fixed\" | \"top-after-reopen\" = \"top-after-reopen\";\n\t/**\n\t * Specify aria-autocomplete attribute of text input.\n\t * \"list\", is the expected value for a combobox that invokes a drop-down list\n\t */\n\t@Input() autocomplete = \"list\";\n\t/**\n\t * Overrides the automatic dropUp.\n\t */\n\t@Input() dropUp: boolean;\n\t/**\n\t * Set to `true` to disable combobox.\n\t */\n\t@Input() disabled = false;\n\t/**\n\t * Set to `true` for readonly state.\n\t */\n\t@Input() readonly = false;\n\t/**\n\t * Experimental: enable fluid state\n\t */\n\t@Input() fluid = false;\n\t/**\n\t * Emits a ListItem\n\t *\n\t * Example:\n\t * ```javascript\n\t * {\n\t * \t\tcontent: \"one\",\n\t * \t\tselected: true\n\t * }\n\t * ```\n\t */\n\t@Output() selected = new EventEmitter<ListItem | ListItem[]>();\n\t/**\n\t * Intended to be used to add items to the list.\n\t *\n\t * Emits an event that includes the current item list, the suggested index for the new item, and a simple ListItem\n\t *\n\t * Example:\n\t * ```javascript\n\t *\t{\n\t *\t\titems: [{content: \"one\", selected: true}, {content: \"two\", selected: true}],\n\t *\t\tindex: 1,\n\t *\t\tvalue: {\n\t *\t\t\tcontent: \"some user string\",\n\t *\t\t\tselected: false\n\t *\t\t}\n\t *\t}\n\t * ```\n\t *\n\t *\n\t * Example:\n\t * ```javascript\n\t * {\n\t *\tafter: 1,\n\t *\tvalue: \"some user string\"\n\t * }\n\t * ```\n\t */\n\t@Output() submit = new EventEmitter<{\n\t\titems: ListItem[],\n\t\tindex: number,\n\t\tvalue: {\n\t\t\tcontent: string,\n\t\t\tselected: boolean\n\t\t}\n\t}>();\n\t/** Emits an empty event when the menu is closed */\n\t@Output() close = new EventEmitter<void>();\n\t/** Emits the search string from the input */\n\t@Output() search = new EventEmitter<string>();\n\t/** Emits an event when the clear button is clicked. */\n\t@Output() clear = new EventEmitter<Event>();\n\t/** ContentChild reference to the instantiated dropdown list */\n\t@ContentChild(AbstractDropdownView, { static: true }) view: AbstractDropdownView;\n\t@ViewChild(\"dropdownMenu\") dropdownMenu;\n\t@ViewChild(\"input\", { static: true }) input: ElementRef;\n\t@ViewChild(\"listbox\", { static: true }) listbox: ElementRef;\n\t@HostBinding(\"class.cds--list-box__wrapper\") hostClass = true;\n\n\tpublic open = false;\n\n\tpublic showClearButton = false;\n\n\t/** Selected items for multi-select combo-boxes. */\n\tpublic pills = [];\n\t/** used to update the displayValue */\n\tpublic selectedValue = \"\";\n\n\toutsideClick = this._outsideClick.bind(this);\n\tkeyboardNav = this._keyboardNav.bind(this);\n\t/**\n\t * controls whether the `drop-up` class is applied\n\t */\n\t_dropUp = false;\n\n\tprotected noop = this._noop.bind(this);\n\tprotected onTouchedCallback: () => void = this._noop;\n\tprotected propagateChangeCallback: (_: any) => void = this._noop;\n\n\tprotected _placeholder = this.i18n.getOverridable(\"COMBOBOX.PLACEHOLDER\");\n\tprotected _closeMenuAria = this.i18n.getOverridable(\"COMBOBOX.A11Y.CLOSE_MENU\");\n\tprotected _openMenuAria = this.i18n.getOverridable(\"COMBOBOX.A11Y.OPEN_MENU\");\n\tprotected _clearSelectionsTitle = this.i18n.getOverridable(\"COMBOBOX.CLEAR_SELECTIONS\");\n\tprotected _clearSelectionsAria = this.i18n.getOverridable(\"COMBOBOX.A11Y.CLEAR_SELECTIONS\");\n\tprotected _clearSelectionTitle = this.i18n.getOverridable(\"COMBOBOX.CLEAR_SELECTED\");\n\tprotected _clearSelectionAria = this.i18n.getOverridable(\"COMBOBOX.A11Y.CLEAR_SELECTED\");\n\n\tprotected _isFocused = false;\n\n\tprivate _writtenValue: any;\n\tprivate _isUsingNgControl = false;\n\n\t/**\n\t * Creates an instance of ComboBox.\n\t */\n\tconstructor(\n\t\tprotected elementRef: ElementRef,\n\t\tprotected dropdownService: DropdownService,\n\t\tprotected i18n: I18n\n\t) {}\n\n\t/**\n\t * Lifecycle hook.\n\t * Updates pills if necessary.\n\t *\n\t */\n\tngOnChanges(changes) {\n\t\tif (changes.items) {\n\t\t\tthis.view.items = changes.items.currentValue;\n\t\t\tthis.updateSelected();\n\t\t\t// If new items are added into the combobox while there is search input,\n\t\t\t// repeat the search. Search should only trigger for type 'single' when there is no value selected.\n\t\t\tif (this.type === \"multi\" || (this.type === \"single\" && !this.selectedValue)) {\n\t\t\t\tthis.onSearch(this.input.nativeElement.value, false);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Sets initial state that depends on child components\n\t * Subscribes to select events and handles focus/filtering/initial list updates\n\t */\n\tngAfterContentInit() {\n\t\tif (this.view) {\n\t\t\tthis.view.type = this.type;\n\n\t\t\t// function to check if the event is organic (isUpdate === false) or programmatic\n\t\t\tconst isUpdate = event => event && event.isUpdate;\n\n\t\t\tthis.view.select.subscribe(event => {\n\t\t\t\tif (Array.isArray(event)) {\n\t\t\t\t\tthis.updatePills();\n\t\t\t\t\tif (!isUpdate(event)) {\n\t\t\t\t\t\tif (this.itemValueKey && this.view.getSelected()) {\n\t\t\t\t\t\t\tconst values = this.view.getSelected().map(item => item[this.itemValueKey]);\n\t\t\t\t\t\t\tthis._propagateChange(values);\n\t\t\t\t\t\t// otherwise just pass up the values from `getSelected`\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis._propagateChange(this.view.getSelected());\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.selected.emit(event);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// If type is single, dropdown list will emit an object\n\t\t\t\t\tif (event.item && event.item.selected) {\n\t\t\t\t\t\tthis.showClearButton = true;\n\t\t\t\t\t\tthis.selectedValue = event.item.content;\n\n\t\t\t\t\t\tif (!isUpdate(event)) {\n\t\t\t\t\t\t\tif (this.itemValueKey) {\n\t\t\t\t\t\t\t\tthis._propagateChange(event.item[this.itemValueKey]);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthis._propagateChange(event.item);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.selectedValue = \"\";\n\t\t\t\t\t\tif (!isUpdate(event)) {\n\t\t\t\t\t\t\tthis._propagateChange(null);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// not guarding these since the nativeElement has to be loaded\n\t\t\t\t\t// for select to even fire\n\t\t\t\t\t// only focus for \"organic\" selections\n\t\t\t\t\tif (!isUpdate(event)) {\n\t\t\t\t\t\tthis.elementRef.nativeElement.querySelector(\"input\").focus();\n\t\t\t\t\t\tthis.view.filterBy(\"\");\n\t\t\t\t\t\tthis.selected.emit(event.item);\n\t\t\t\t\t\tthis.closeDropdown();\n\t\t\t\t\t} else if (this._isUsingNgControl) {\n\t\t\t\t\t\tthis.writeValue(this._writtenValue);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t\t// update the rest of combobox with any pre-selected items\n\t\t\t// setTimeout just defers the call to the next check cycle\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.updateSelected();\n\t\t\t});\n\n\t\t\tthis.view.blurIntent.pipe(filter(v => v === \"top\")).subscribe(() => {\n\t\t\t\tthis.elementRef.nativeElement.querySelector(\".cds--text-input\").focus();\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Binds event handlers against the rendered view\n\t */\n\tngAfterViewInit() {\n\t\t// if appendInline is default valued (null) we should:\n\t\t// 1. if there are scrollable parents (not including body) don't append inline\n\t\t// this should also cover the case where the dropdown is in a modal\n\t\t// (where we _do_ want to append to the placeholder)\n\t\tif (this.appendInline === null && hasScrollableParents(this.elementRef.nativeElement)) {\n\t\t\tthis.appendInline = false;\n\t\t// 2. otherwise we should append inline\n\t\t} else if (this.appendInline === null) {\n\t\t\tthis.appendInline = true;\n\t\t}\n\t}\n\n\t/**\n\t * Removing the `Dropdown` from the body if it is appended to the body.\n\t */\n\tngOnDestroy() {\n\t\tif (!this.appendInline) {\n\t\t\tthis._appendToDropdown();\n\t\t}\n\t}\n\n\t/**\n\t * Handles `Escape/Tab` key closing the dropdown, and arrow up/down focus to/from the dropdown list.\n\t */\n\t@HostListener(\"keydown\", [\"$event\"])\n\thostkeys(ev: KeyboardEvent) {\n\t\tif (ev.key === \"Escape\") {\n\t\t\tthis.closeDropdown();\n\t\t} else if ((ev.key === \"ArrowDown\")\n\t\t\t&& (!this.dropdownMenu || !this.dropdownMenu.nativeElement.contains(ev.target))) {\n\t\t\tev.preventDefault();\n\t\t\tthis.openDropdown();\n\t\t\tsetTimeout(() => { this.view.initFocus(); }, 0);\n\t\t}\n\n\t\tif (\n\t\t\tthis.open && ev.key === \"Tab\" &&\n\t\t\t(this.dropdownMenu.nativeElement.contains(ev.target as Node) || ev.target === this.input.nativeElement)\n\t\t) {\n\t\t\tthis.closeDropdown();\n\t\t}\n\n\t\tif (this.open && ev.key === \"Tab\" && ev.shiftKey) {\n\t\t\tthis.closeDropdown();\n\t\t}\n\t}\n\n\t/*\n\t * no-op method for null event listeners, and other no op calls\n\t */\n\t_noop() {}\n\n\t/*\n\t * propagates the value provided from ngModel\n\t */\n\twriteValue(value: any) {\n\t\tthis._writtenValue = value;\n\n\t\tif (this.type === \"single\") {\n\t\t\tif (this.itemValueKey) {\n\t\t\t\t// clone the specified item and update its state\n\t\t\t\tconst newValue = Object.assign({}, this.view.getListItems().find(item => item[this.itemValueKey] === value));\n\t\t\t\tnewValue.selected = true;\n\t\t\t\tthis.view.propagateSelected([newValue]);\n\t\t\t} else {\n\t\t\t\t// all items in propagateSelected must be iterable\n\t\t\t\tthis.view.propagateSelected([value || \"\"]);\n\t\t\t}\n\t\t\tthis.showClearButton = !!(value && this.view.getSelected().length);\n\t\t} else {\n\t\t\tif (this.itemValueKey) {\n\t\t\t\t// clone the items and update their state based on the received value array\n\t\t\t\t// this way we don't lose any additional metadata that may be passed in via the `items` Input\n\t\t\t\tlet newValues = [];\n\t\t\t\tfor (const v of value ?? []) {\n\t\t\t\t\tfor (const item of this.view.getListItems()) {\n\t\t\t\t\t\tif (item[this.itemValueKey] === v) {\n\t\t\t\t\t\t\tnewValues.push(Object.assign({}, item, { selected: true }));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.view.propagateSelected(newValues);\n\t\t\t} else {\n\t\t\t\tthis.view.propagateSelected(value ? value : [\"\"]);\n\t\t\t}\n\t\t}\n\t\tthis.updateSelected();\n\t}\n\n\tprivate _propagateChange(value: any) {\n\t\tthis._writtenValue = value;\n\t\tthis.propagateChangeCallback(value);\n\t}\n\n\tonBlur() {\n\t\tthis.onTouchedCallback();\n\t}\n\n\tregisterOnChange(fn: any) {\n\t\tthis._isUsingNgControl = true;\n\t\tthis.propagateChangeCallback = fn;\n\t}\n\n\tregisterOnTouched(fn: any) {\n\t\tthis.onTouchedCallback = fn;\n\t}\n\n\t/**\n\t * `ControlValueAccessor` method to programmatically disable the combobox.\n\t *\n\t * ex: `this.formGroup.get(\"myCoolCombobox\").disable();`\n\t */\n\tsetDisabledState(isDisabled: boolean) {\n\t\tthis.disabled = isDisabled;\n\t}\n\n\t/**\n\t * Called by `n-pill-input` when the selected pills have changed.\n\t */\n\tpublic updatePills() {\n\t\tthis.pills = this.view.getSelected() || [];\n\t\tthis.checkForReorder();\n\t}\n\n\tpublic clearSelected(event) {\n\t\tthis.items = this.items.map(item => {\n\t\t\tif (!item.disabled) {\n\t\t\t\titem.selected = false;\n\t\t\t}\n\t\t\treturn item;\n\t\t});\n\t\tthis.view.propagateSelected([]);\n\t\tthis.updatePills();\n\t\t/**\n\t\t * @todo - In next major version update to the following:\n\t\t * const selected = this.type === \"multi\" ? this.view.getSelected() : undefined;\n\t\t *\n\t\t * Previously it returned an empty array even for type === 'single'\n\t\t * Also resolve #ref-1245723\n\t\t */\n\t\t// On type=multi we just emit getSelected() (just in case there's any disabled but selected items)\n\t\tconst selected = this.view.getSelected();\n\n\t\t// in case there are disabled items they should be mapped according to itemValueKey\n\t\tif (this.itemValueKey && selected) {\n\t\t\tconst values = selected.map((item) => item[this.itemValueKey]);\n\t\t\tthis._propagateChange(values);\n\t\t} else {\n\t\t\tthis._propagateChange(selected);\n\t\t}\n\n\t\tthis.selected.emit(selected as any);\n\t\tthis.clear.emit(event);\n\t}\n\n\t/**\n\t * Closes the dropdown and emits the close event.\n\t */\n\tpublic closeDropdown() {\n\t\tthis.open = false;\n\t\tthis.checkForReorder();\n\t\tthis.close.emit();\n\t\tif (!this.appendInline) {\n\t\t\tthis._appendToDropdown();\n\t\t}\n\n\t\tdocument.removeEventListener(\"click\", this.outsideClick, true);\n\t}\n\n\t/**\n\t * Opens the dropdown.\n\t */\n\tpublic openDropdown() {\n\t\tif (this.disabled || this.readonly) { return; }\n\t\tthis.open = true;\n\t\tthis._dropUp = false;\n\n\t\tif (!this.appendInline) {\n\t\t\tthis._appendToBody();\n\t\t}\n\n\t\tdocument.addEventListener(\"click\", this.outsideClick, true);\n\n\t\t// set the dropdown menu to drop up if it is near the bottom of the screen\n\t\t// setTimeout lets us do the calculations after it is visible in the DOM\n\t\tsetTimeout(() => {\n\t\t\tif (this.dropUp === null || this.dropUp === undefined) {\n\t\t\t\tthis._dropUp = this._shouldDropUp();\n\t\t\t}\n\t\t}, 0);\n\t}\n\n\t/**\n\t * Toggles the dropdown.\n\t */\n\tpublic toggleDropdown() {\n\t\tif (this.open) {\n\t\t\tthis.closeDropdown();\n\t\t} else {\n\t\t\tthis.openDropdown();\n\t\t}\n\t}\n\n\t/**\n\t * Sets the list group filter, and manages single select item selection.\n\t */\n\tpublic onSearch(searchString, shouldEmitSearch = true) {\n\t\tif (shouldEmitSearch) {\n\t\t\tthis.search.emit(searchString);\n\t\t}\n\t\tthis.showClearButton = !!searchString;\n\t\tthis.view.filterBy(searchString);\n\t\tif (searchString !== \"\") {\n\t\t\tif (!this.open) {\n\t\t\t\tthis.openDropdown();\n\t\t\t}\n\t\t} else {\n\t\t\tthis.selectedValue = \"\";\n\t\t\tif (this.type === \"multi\" &&\n\t\t\t\t(this.selectionFeedback === \"top\" || this.selectionFeedback === \"top-after-reopen\")) {\n\t\t\t\tthis.view.reorderSelected();\n\t\t\t}\n\t\t}\n\t\tif (this.type === \"single\") {\n\t\t\t// deselect if the input doesn't match the content\n\t\t\t// of any given item\n\t\t\tconst matches = this.view.getListItems().some(item => item.content.toLowerCase().includes(searchString.toLowerCase()));\n\t\t\tif (!matches) {\n\t\t\t\tconst selected = this.view.getSelected();\n\t\t\t\tif (!selected || !selected[0]) {\n\t\t\t\t\tthis.view.filterBy(searchString);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Intended to be used to add items to the list.\n\t */\n\tpublic onSubmit(event: KeyboardEvent) {\n\t\tthis.submit.emit({\n\t\t\titems: this.view.getListItems(),\n\t\t\tindex: 0,\n\t\t\tvalue: {\n\t\t\t\tcontent: (event.target as HTMLInputElement).value,\n\t\t\t\tselected: false\n\t\t\t}\n\t\t});\n\t}\n\n\tclearInput(event) {\n\t\tevent.stopPropagation();\n\t\tevent.preventDefault();\n\n\t\tif (this.disabled || this.readonly) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.type === \"single\") { // don't want to clear selected or close if multi\n\t\t\tthis.clearSelected(event);\n\t\t\tthis.closeDropdown();\n\t\t}\n\n\t\tthis.selectedValue = \"\";\n\t\tthis.input.nativeElement.value = \"\";\n\n\t\tthis.showClearButton = false;\n\t\tthis.input.nativeElement.focus();\n\t\tthis.onSearch(this.input.nativeElement.value);\n\t}\n\n\tpublic isTemplate(value) {\n\t\treturn value instanceof TemplateRef;\n\t}\n\n\t/**\n\t * Handles keyboard events so users are controlling the `Dropdown` instead of unintentionally controlling outside elements.\n\t */\n\t_keyboardNav(event: KeyboardEvent) {\n\t\tif ((event.key === \"Escape\") && this.open) {\n\t\t\tevent.stopImmediatePropagation(); // don't unintentionally close modal if inside of it\n\t\t}\n\t\tif (event.key === \"Escape\") {\n\t\t\tevent.preventDefault();\n\t\t\tthis.closeDropdown();\n\t\t\tthis.input.nativeElement.focus();\n\t\t} else if (this.open && event.key === \"Tab\") {\n\t\t\t// this way focus will start on the next focusable item from the dropdown\n\t\t\t// not the top of the body!\n\t\t\tthis.input.nativeElement.focus();\n\t\t\tthis.input.nativeElement.dispatchEvent(new KeyboardEvent(\"keydown\", { bubbles: true, cancelable: true, key: \"Tab\" }));\n\t\t\tthis.closeDropdown();\n\t\t}\n\t}\n\n\t/**\n\t * Creates the `Dropdown` list as an element that is appended to the DOM body.\n\t */\n\t_appendToBody() {\n\t\tthis.dropdownService.appendToBody(\n\t\t\tthis.listbox.nativeElement,\n\t\t\tthis.dropdownMenu.nativeElement,\n\t\t\t`${this.elementRef.nativeElement.className}${this.open ? \" cds--list-box--expanded\" : \"\"}`);\n\t\tthis.dropdownMenu.nativeElement.addEventListener(\"keydown\", this.keyboardNav, true);\n\t}\n\n\t/**\n\t * Creates the `Dropdown` list appending it to the dropdown parent object instead of the body.\n\t */\n\t_appendToDropdown() {\n\t\tthis.dropdownService.appendToDropdown(this.elementRef.nativeElement);\n\t\tthis.dropdownMenu.nativeElement.removeEventListener(\"keydown\", this.keyboardNav, true);\n\t}\n\n\t/**\n\t * Detects whether or not the `Dropdown` list is visible within all scrollable parents.\n\t * This can be overridden by passing in a value to the `dropUp` input.\n\t */\n\t_shouldDropUp() {\n\t\t// check if dropdownMenu exists first.\n\t\tconst menu = this.dropdownMenu && this.dropdownMenu.nativeElement.querySelector(\".cds--list-box__menu\");\n\t\t// check if menu exists first.\n\t\tconst menuRect = menu && menu.getBoundingClientRect();\n\t\tif (menu && menuRect) {\n\t\t\tconst scrollableParents = getScrollableParents(menu);\n\t\t\treturn scrollableParents.reduce((shouldDropUp: boolean, parent: HTMLElement) => {\n\t\t\t\tconst parentRect = parent.getBoundingClientRect();\n\t\t\t\tconst isBelowParent = !(menuRect.bottom <= parentRect.bottom);\n\t\t\t\treturn shouldDropUp || isBelowParent;\n\t\t\t}, false);\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * Handles clicks outside of the `Dropdown` list.\n\t */\n\t_outsideClick(event) {\n\t\tif (!this.elementRef.nativeElement.contains(event.target) &&\n\t\t\t// if we're appendToBody the list isn't within the _elementRef,\n\t\t\t// so we've got to check if our target is possibly in there too.\n\t\t\t!this.dropdownMenu.nativeElement.contains(event.target)) {\n\t\t\tthis.closeDropdown();\n\t\t}\n\t}\n\n\thandleFocus(event: FocusEvent) {\n\t\tthis._isFocused = event.type === \"focus\";\n\t}\n\n\tprotected updateSelected() {\n\t\tconst selected = this.view.getSelected();\n\t\tif (this.type === \"multi\") {\n\t\t\tthis.updatePills();\n\t\t} else if (selected) {\n\t\t\tconst value = selected[0] ? selected[0].content : \"\";\n\t\t\tconst changeCallbackValue = selected[0] ? selected[0] : \"\";\n\t\t\tthis.selectedValue = value;\n\t\t\tthis.showClearButton = !!value;\n\t\t}\n\t}\n\n\tprotected checkForReorder() {\n\t\tconst topAfterReopen = !this.open && this.selectionFeedback === \"top-after-reopen\";\n\t\tif ((this.type === \"multi\") && (topAfterReopen || this.selectionFeedback === \"top\")) {\n\t\t\tthis.view.reorderSelected(true);\n\t\t}\n\t}\n}\n",
|
|
26894
|
+
"sourceCode": "import {\n\tComponent,\n\tOnChanges,\n\tContentChild,\n\tInput,\n\tOutput,\n\tHostListener,\n\tElementRef,\n\tViewChild,\n\tEventEmitter,\n\tAfterViewInit,\n\tAfterContentInit,\n\tHostBinding,\n\tTemplateRef,\n\tOnDestroy\n} from \"@angular/core\";\nimport { AbstractDropdownView, DropdownService } from \"carbon-components-angular/dropdown\";\nimport { ListItem } from \"carbon-components-angular/dropdown\";\nimport { NG_VALUE_ACCESSOR } from \"@angular/forms\";\nimport { filter } from \"rxjs/operators\";\nimport {\n\tgetScrollableParents,\n\thasScrollableParents\n} from \"carbon-components-angular/utils\";\nimport { I18n, Overridable } from \"carbon-components-angular/i18n\";\nimport { Observable } from \"rxjs\";\n\n/**\n * Get started with importing the module:\n *\n * ```typescript\n * import { ComboBoxModule } from 'carbon-components-angular';\n * ```\n *\n * ComboBoxes are similar to dropdowns, except a combobox provides an input field for users to search items and (optionally) add their own.\n * Multi-select comboboxes also provide \"pills\" of selected items.\n *\n * [See demo](../../?path=/story/components-combobox--basic)\n */\n@Component({\n\tselector: \"cds-combo-box, ibm-combo-box\",\n\ttemplate: `\n\t\t<div\n\t\t\tclass=\"cds--list-box__wrapper\"\n\t\t\t[ngClass]=\"{\n\t\t\t\t'cds--list-box__wrapper--fluid': fluid,\n\t\t\t\t'cds--list-box__wrapper--fluid--invalid': fluid && invalid,\n\t\t\t\t'cds--list-box__wrapper--fluid--focus': fluid && _isFocused,\n\t\t\t\t'cds--list-box__wrapper--decorator': !!decorator\n\t\t\t}\">\n\t\t\t<label\n\t\t\t\t*ngIf=\"label\"\n\t\t\t\t[for]=\"id\"\n\t\t\t\t[id]=\"labelId\"\n\t\t\t\tclass=\"cds--label\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--label--disabled': disabled,\n\t\t\t\t\t'cds--visually-hidden': hideLabel\n\t\t\t\t}\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(label)\">{{label}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(label)\" [ngTemplateOutlet]=\"label\"></ng-template>\n\t\t\t</label>\n\t\t\t<div\n\t\t\t\t#listbox\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--multi-select cds--multi-select--filterable': type === 'multi',\n\t\t\t\t\t'cds--list-box--light': theme === 'light',\n\t\t\t\t\t'cds--list-box--expanded': open,\n\t\t\t\t\t'cds--list-box--sm': size === 'sm',\n\t\t\t\t\t'cds--list-box--md': size === 'md',\n\t\t\t\t\t'cds--list-box--lg': size === 'lg',\n\t\t\t\t\t'cds--list-box--disabled': disabled,\n\t\t\t\t\t'cds--combo-box--readonly': readonly,\n\t\t\t\t\t'cds--combo-box--warning cds--list-box--warning': warn,\n\t\t\t\t\t'cds--list-box--invalid': invalid\n\t\t\t\t}\"\n\t\t\t\tclass=\"cds--list-box cds--combo-box\"\n\t\t\t\t[attr.data-invalid]=\"(invalid ? true : null)\">\n\t\t\t\t<div\n\t\t\t\t\tclass=\"cds--list-box__field\"\n\t\t\t\t\t(click)=\"toggleDropdown()\"\n\t\t\t\t\t(blur)=\"onBlur()\">\n\t\t\t\t\t<div\n\t\t\t\t\t\t*ngIf=\"type === 'multi' && pills.length > 0\"\n\t\t\t\t\t\tclass=\"cds--tag cds--tag--filter cds--tag--high-contrast\"\n\t\t\t\t\t\t[ngClass]=\"{'cds--tag--disabled': disabled || readonly}\">\n\t\t\t\t\t\t<span class=\"cds--tag__label\">{{ pills.length }}</span>\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t(click)=\"clearSelected($event)\"\n\t\t\t\t\t\t\t(blur)=\"onBlur()\"\n\t\t\t\t\t\t\t(keydown.enter)=\"clearSelected($event)\"\n\t\t\t\t\t\t\tclass=\"cds--tag__close-icon\"\n\t\t\t\t\t\t\ttabindex=\"0\"\n\t\t\t\t\t\t\t[title]=\"clearSelectionsTitle\"\n\t\t\t\t\t\t\t[disabled]=\"disabled || readonly\"\n\t\t\t\t\t\t\t[attr.aria-label]=\"clearSelectionAria\">\n\t\t\t\t\t\t\t<svg\n\t\t\t\t\t\t\t\tfocusable=\"false\"\n\t\t\t\t\t\t\t\tpreserveAspectRatio=\"xMidYMid meet\"\n\t\t\t\t\t\t\t\tstyle=\"will-change: transform;\"\n\t\t\t\t\t\t\t\trole=\"img\"\n\t\t\t\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\t\t\t\twidth=\"16\"\n\t\t\t\t\t\t\t\theight=\"16\"\n\t\t\t\t\t\t\t\tviewBox=\"0 0 16 16\"\n\t\t\t\t\t\t\t\taria-hidden=\"true\">\n\t\t\t\t\t\t\t\t<path d=\"M12 4.7l-.7-.7L8 7.3 4.7 4l-.7.7L7.3 8 4 11.3l.7.7L8 8.7l3.3 3.3.7-.7L8.7 8z\"></path>\n\t\t\t\t\t\t\t</svg>\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</div>\n\t\t\t\t\t<input\n\t\t\t\t\t\t#input\n\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\tautocomplete=\"off\"\n\t\t\t\t\t\trole=\"combobox\"\n\t\t\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t\t\t[readOnly]=\"readonly\"\n\t\t\t\t\t\t(input)=\"onSearch($event.target.value)\"\n\t\t\t\t\t\t(focus)=\"fluid ? handleFocus($event) : null\"\n\t\t\t\t\t\t(blur)=\"fluid ? handleFocus($event) : onBlur()\"\n\t\t\t\t\t\t(keydown.enter)=\"onSubmit($event)\"\n\t\t\t\t\t\t[value]=\"selectedValue\"\n\t\t\t\t\t\tclass=\"cds--text-input\"\n\t\t\t\t\t\t[ngClass]=\"{'cds--text-input--empty': !showClearButton}\"\n\t\t\t\t\t\ttabindex=\"0\"\n\t\t\t\t\t\t[id]=\"id\"\n\t\t\t\t\t\t[attr.aria-labelledby]=\"labelId\"\n\t\t\t\t\t\t[attr.aria-expanded]=\"open\"\n\t\t\t\t\t\taria-haspopup=\"listbox\"\n\t\t\t\t\t\t[attr.maxlength]=\"maxLength\"\n\t\t\t\t\t\t[attr.aria-controls]=\"open ? view?.listId : null\"\n\t\t\t\t\t\t[attr.aria-autocomplete]=\"autocomplete\"\n\t\t\t\t\t\t[placeholder]=\"placeholder\"/>\n\t\t\t\t\t<svg\n\t\t\t\t\t\t*ngIf=\"invalid\"\n\t\t\t\t\t\tcdsIcon=\"warning--filled\"\n\t\t\t\t\t\tsize=\"16\"\n\t\t\t\t\t\tclass=\"cds--list-box__invalid-icon\">\n\t\t\t\t\t</svg>\n\t\t\t\t\t<svg\n\t\t\t\t\t\t*ngIf=\"!invalid && warn\"\n\t\t\t\t\t\tcdsIcon=\"warning--alt--filled\"\n\t\t\t\t\t\tsize=\"16\"\n\t\t\t\t\t\tclass=\"cds--list-box__invalid-icon cds--list-box__invalid-icon--warning\">\n\t\t\t\t\t</svg>\n\t\t\t\t\t<div\n\t\t\t\t\t\t*ngIf=\"showClearButton\"\n\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\tclass=\"cds--list-box__selection\"\n\t\t\t\t\t\ttabindex=\"0\"\n\t\t\t\t\t\t[attr.aria-label]=\"clearSelectionAria\"\n\t\t\t\t\t\t[title]=\"clearSelectionTitle\"\n\t\t\t\t\t\t(keyup.enter)=\"clearInput($event)\"\n\t\t\t\t\t\t(click)=\"clearInput($event)\"\n\t\t\t\t\t\t(blur)=\"onBlur()\">\n\t\t\t\t\t\t<svg cdsIcon=\"close\" size=\"16\"></svg>\n\t\t\t\t\t</div>\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\tclass=\"cds--list-box__menu-icon\"\n\t\t\t\t\t\ttabindex=\"-1\"\n\t\t\t\t\t\t[title]=\"open ? closeMenuAria : openMenuAria\"\n\t\t\t\t\t\t[attr.aria-label]=\"open ? closeMenuAria : openMenuAria\"\n\t\t\t\t\t\t[ngClass]=\"{'cds--list-box__menu-icon--open': open}\">\n\t\t\t\t\t\t<svg cdsIcon=\"chevron--down\" size=\"16\"></svg>\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t\t<ng-container *ngIf=\"decorator\">\n\t\t\t\t\t<div class=\"cds--list-box__inner-wrapper--decorator\">\n\t\t\t\t\t\t<ng-template [ngTemplateOutlet]=\"decorator\"></ng-template>\n\t\t\t\t\t</div>\n\t\t\t\t</ng-container>\n\t\t\t\t<div\n\t\t\t\t\t#dropdownMenu\n\t\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t\t'cds--list-box--up': this.dropUp !== null && this.dropUp !== undefined ? dropUp : _dropUp\n\t\t\t\t\t}\">\n\t\t\t\t\t<ng-content *ngIf=\"open\"></ng-content>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<hr *ngIf=\"fluid\" class=\"cds--list-box__divider\" />\n\t\t\t<div\n\t\t\t\t*ngIf=\"helperText && !invalid && !warn && !fluid\"\n\t\t\t\tclass=\"cds--form__helper-text\"\n\t\t\t\t[ngClass]=\"{'cds--form__helper-text--disabled': disabled}\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(helperText)\">{{helperText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(helperText)\" [ngTemplateOutlet]=\"helperText\"></ng-template>\n\t\t\t</div>\n\t\t\t<div *ngIf=\"invalid\" class=\"cds--form-requirement\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(invalidText)\">{{ invalidText }}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(invalidText)\" [ngTemplateOutlet]=\"invalidText\"></ng-template>\n\t\t\t</div>\n\t\t\t<div *ngIf=\"!invalid && warn\" class=\"cds--form-requirement\">\n\t\t\t\t<ng-container *ngIf=\"!isTemplate(warnText)\">{{warnText}}</ng-container>\n\t\t\t\t<ng-template *ngIf=\"isTemplate(warnText)\" [ngTemplateOutlet]=\"warnText\"></ng-template>\n\t\t\t</div>\n\t\t</div>\n\t`,\n\tproviders: [\n\t\t{\n\t\t\tprovide: NG_VALUE_ACCESSOR,\n\t\t\tuseExisting: ComboBox,\n\t\t\tmulti: true\n\t\t}\n\t]\n})\nexport class ComboBox implements OnChanges, AfterViewInit, AfterContentInit, OnDestroy {\n\t/**\n\t * Text to show when nothing is selected.\n\t */\n\t@Input() set placeholder(value: string | Observable<string>) {\n\t\tthis._placeholder.override(value);\n\t}\n\n\tget placeholder() {\n\t\treturn this._placeholder.value;\n\t}\n\t/**\n\t * Value to display for accessibility purposes on the combobox control menu when closed\n\t */\n\t@Input() set openMenuAria(value: string | Observable<string>) {\n\t\tthis._openMenuAria.override(value);\n\t}\n\n\tget openMenuAria() {\n\t\treturn this._openMenuAria.value;\n\t}\n\t/**\n\t * Value to display for accessibility purposes on the combobox control menu when opened\n\t */\n\t@Input() set closeMenuAria(value: string | Observable<string>) {\n\t\tthis._closeMenuAria.override(value);\n\t}\n\n\tget closeMenuAria() {\n\t\treturn this._closeMenuAria.value;\n\t}\n\t/**\n\t * Value to display on the clear selections icon, when multi is selected\n\t */\n\t@Input() set clearSelectionsTitle(value: string | Observable<string>) {\n\t\tthis._clearSelectionsTitle.override(value);\n\t}\n\n\tget clearSelectionsTitle() {\n\t\treturn this._clearSelectionsTitle.value;\n\t}\n\t/**\n\t * Value to display for accessibility purposes to clear selections, when multi is selected\n\t */\n\t@Input() set clearSelectionsAria(value: string | Observable<string>) {\n\t\tthis._clearSelectionsAria.override(value);\n\t}\n\n\tget clearSelectionsAria() {\n\t\treturn this._clearSelectionsAria.value;\n\t}\n\t/**\n\t * Value to display on the clear the selected item icon, when single is selected\n\t */\n\t@Input() set clearSelectionTitle(value: string | Observable<string>) {\n\t\tthis._clearSelectionTitle.override(value);\n\t}\n\n\tget clearSelectionTitle() {\n\t\treturn this._clearSelectionTitle.value;\n\t}\n\t/**\n\t * Value to display for accessibility purposes on the clear the selected item icon, when single is selected\n\t */\n\t@Input() set clearSelectionAria(value: string | Observable<string>) {\n\t\tthis._clearSelectionAria.override(value);\n\t}\n\n\tget clearSelectionAria() {\n\t\treturn this._clearSelectionAria.value;\n\t}\n\tstatic comboBoxCount = 0;\n\t@Input() id = `combobox-${ComboBox.comboBoxCount++}`;\n\t@Input() labelId = `combobox-label-${ComboBox.comboBoxCount++}`;\n\t/**\n\t * List of items to fill the content with.\n\t *\n\t * **Example:**\n\t * ```javascript\n\t * items = [\n\t *\t\t{\n\t *\t\t\tcontent: \"Abacus\",\n\t *\t\t\tselected: false\n\t *\t\t},\n\t *\t\t{\n\t *\t\t\tcontent: \"Byte\",\n\t *\t\t\tselected: false,\n\t *\t\t},\n\t *\t\t{\n\t *\t\t\tcontent: \"Computer\",\n\t *\t\t\tselected: false\n\t *\t\t},\n\t *\t\t{\n\t *\t\t\tcontent: \"Digital\",\n\t *\t\t\tselected: false\n\t *\t\t}\n\t * ];\n\t * ```\n\t *\n\t */\n\t@Input() items: Array<ListItem> = [];\n\t/**\n\t * Combo box type (supporting single or multi selection of items).\n\t */\n\t@Input() type: \"single\" | \"multi\" = \"single\";\n\t/**\n\t * Combo box render size.\n\t */\n\t@Input() size: \"sm\" | \"md\" | \"lg\" = \"md\";\n\t/**\n\t * Specifies the property to be used as the return value to `ngModel`\n\t */\n\t@Input() itemValueKey: string;\n\t/**\n\t * Label for the combobox.\n\t */\n\t@Input() label: string | TemplateRef<any>;\n\t/**\n\t * Hide label while keeping it accessible for screen readers\n\t */\n\t@Input() hideLabel = false;\n\t/**\n\t * Sets the optional helper text.\n\t */\n\t@Input() helperText: string | TemplateRef<any>;\n\n\t/**\n\t * **Experimental**: Optional decorator (e.g. AI label).\n\t */\n\t@Input() decorator: TemplateRef<any>;\n\t/**\n\t * set to `true` to place the dropdown view inline with the component\n\t */\n\t@Input() appendInline: boolean = null;\n\t/**\n\t * Set to `true` to show the invalid state.\n\t */\n\t@Input() invalid = false;\n\t/**\n\t * Value displayed if combobox is in an invalid state.\n\t */\n\t@Input() invalidText: string | TemplateRef<any>;\n\t/**\n\t* Set to `true` to show a warning (contents set by warnText)\n\t*/\n\t@Input() warn = false;\n\t/**\n\t * Sets the warning text\n\t */\n\t@Input() warnText: string | TemplateRef<any>;\n\t/**\n\t * Max length value to limit input characters\n\t */\n\t@Input() maxLength: number = null;\n\t/**\n\t * @deprecated since v5 - Use `cdsLayer` directive instead\n\t */\n\t@Input() theme: \"light\" | \"dark\" = \"dark\";\n\t/**\n\t * Specify feedback (mode) of the selection.\n\t * `top`: selected item jumps to top\n\t * `fixed`: selected item stays at its position\n\t * `top-after-reopen`: selected item jump to top after reopen dropdown\n\t */\n\t@Input() selectionFeedback: \"top\" | \"fixed\" | \"top-after-reopen\" = \"top-after-reopen\";\n\t/**\n\t * Specify aria-autocomplete attribute of text input.\n\t * \"list\", is the expected value for a combobox that invokes a drop-down list\n\t */\n\t@Input() autocomplete = \"list\";\n\t/**\n\t * Overrides the automatic dropUp.\n\t */\n\t@Input() dropUp: boolean;\n\t/**\n\t * Set to `true` to disable combobox.\n\t */\n\t@Input() disabled = false;\n\t/**\n\t * Set to `true` for readonly state.\n\t */\n\t@Input() readonly = false;\n\t/**\n\t * Experimental: enable fluid state\n\t */\n\t@Input() fluid = false;\n\t/**\n\t * Emits a ListItem\n\t *\n\t * Example:\n\t * ```javascript\n\t * {\n\t * \t\tcontent: \"one\",\n\t * \t\tselected: true\n\t * }\n\t * ```\n\t */\n\t@Output() selected = new EventEmitter<ListItem | ListItem[]>();\n\t/**\n\t * Intended to be used to add items to the list.\n\t *\n\t * Emits an event that includes the current item list, the suggested index for the new item, and a simple ListItem\n\t *\n\t * Example:\n\t * ```javascript\n\t *\t{\n\t *\t\titems: [{content: \"one\", selected: true}, {content: \"two\", selected: true}],\n\t *\t\tindex: 1,\n\t *\t\tvalue: {\n\t *\t\t\tcontent: \"some user string\",\n\t *\t\t\tselected: false\n\t *\t\t}\n\t *\t}\n\t * ```\n\t *\n\t *\n\t * Example:\n\t * ```javascript\n\t * {\n\t *\tafter: 1,\n\t *\tvalue: \"some user string\"\n\t * }\n\t * ```\n\t */\n\t@Output() submit = new EventEmitter<{\n\t\titems: ListItem[],\n\t\tindex: number,\n\t\tvalue: {\n\t\t\tcontent: string,\n\t\t\tselected: boolean\n\t\t}\n\t}>();\n\t/** Emits an empty event when the menu is closed */\n\t@Output() close = new EventEmitter<void>();\n\t/** Emits the search string from the input */\n\t@Output() search = new EventEmitter<string>();\n\t/** Emits an event when the clear button is clicked. */\n\t@Output() clear = new EventEmitter<Event>();\n\t/** ContentChild reference to the instantiated dropdown list */\n\t@ContentChild(AbstractDropdownView, { static: true }) view: AbstractDropdownView;\n\t@ViewChild(\"dropdownMenu\") dropdownMenu;\n\t@ViewChild(\"input\", { static: true }) input: ElementRef;\n\t@ViewChild(\"listbox\", { static: true }) listbox: ElementRef;\n\t@HostBinding(\"class.cds--list-box__wrapper\") hostClass = true;\n\n\tpublic open = false;\n\n\tpublic showClearButton = false;\n\n\t/** Selected items for multi-select combo-boxes. */\n\tpublic pills = [];\n\t/** used to update the displayValue */\n\tpublic selectedValue = \"\";\n\n\toutsideClick = this._outsideClick.bind(this);\n\tkeyboardNav = this._keyboardNav.bind(this);\n\t/**\n\t * controls whether the `drop-up` class is applied\n\t */\n\t_dropUp = false;\n\n\tprotected noop = this._noop.bind(this);\n\tprotected onTouchedCallback: () => void = this._noop;\n\tprotected propagateChangeCallback: (_: any) => void = this._noop;\n\n\tprotected _placeholder = this.i18n.getOverridable(\"COMBOBOX.PLACEHOLDER\");\n\tprotected _closeMenuAria = this.i18n.getOverridable(\"COMBOBOX.A11Y.CLOSE_MENU\");\n\tprotected _openMenuAria = this.i18n.getOverridable(\"COMBOBOX.A11Y.OPEN_MENU\");\n\tprotected _clearSelectionsTitle = this.i18n.getOverridable(\"COMBOBOX.CLEAR_SELECTIONS\");\n\tprotected _clearSelectionsAria = this.i18n.getOverridable(\"COMBOBOX.A11Y.CLEAR_SELECTIONS\");\n\tprotected _clearSelectionTitle = this.i18n.getOverridable(\"COMBOBOX.CLEAR_SELECTED\");\n\tprotected _clearSelectionAria = this.i18n.getOverridable(\"COMBOBOX.A11Y.CLEAR_SELECTED\");\n\n\tprotected _isFocused = false;\n\n\tprivate _writtenValue: any;\n\tprivate _isUsingNgControl = false;\n\n\t/**\n\t * Creates an instance of ComboBox.\n\t */\n\tconstructor(\n\t\tprotected elementRef: ElementRef,\n\t\tprotected dropdownService: DropdownService,\n\t\tprotected i18n: I18n\n\t) {}\n\n\t/**\n\t * Lifecycle hook.\n\t * Updates pills if necessary.\n\t *\n\t */\n\tngOnChanges(changes) {\n\t\tif (changes.items) {\n\t\t\tthis.view.items = changes.items.currentValue;\n\t\t\tthis.updateSelected();\n\t\t\t// If new items are added into the combobox while there is search input,\n\t\t\t// repeat the search. Search should only trigger for type 'single' when there is no value selected.\n\t\t\tif (this.type === \"multi\" || (this.type === \"single\" && !this.selectedValue)) {\n\t\t\t\tthis.onSearch(this.input.nativeElement.value, false);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Sets initial state that depends on child components\n\t * Subscribes to select events and handles focus/filtering/initial list updates\n\t */\n\tngAfterContentInit() {\n\t\tif (this.view) {\n\t\t\tthis.view.type = this.type;\n\n\t\t\t// function to check if the event is organic (isUpdate === false) or programmatic\n\t\t\tconst isUpdate = event => event && event.isUpdate;\n\n\t\t\tthis.view.select.subscribe(event => {\n\t\t\t\tif (Array.isArray(event)) {\n\t\t\t\t\tthis.updatePills();\n\t\t\t\t\tif (!isUpdate(event)) {\n\t\t\t\t\t\tif (this.itemValueKey && this.view.getSelected()) {\n\t\t\t\t\t\t\tconst values = this.view.getSelected().map(item => item[this.itemValueKey]);\n\t\t\t\t\t\t\tthis._propagateChange(values);\n\t\t\t\t\t\t// otherwise just pass up the values from `getSelected`\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis._propagateChange(this.view.getSelected());\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.selected.emit(event);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// If type is single, dropdown list will emit an object\n\t\t\t\t\tif (event.item && event.item.selected) {\n\t\t\t\t\t\tthis.showClearButton = true;\n\t\t\t\t\t\tthis.selectedValue = event.item.content;\n\n\t\t\t\t\t\tif (!isUpdate(event)) {\n\t\t\t\t\t\t\tif (this.itemValueKey) {\n\t\t\t\t\t\t\t\tthis._propagateChange(event.item[this.itemValueKey]);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthis._propagateChange(event.item);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.selectedValue = \"\";\n\t\t\t\t\t\tif (!isUpdate(event)) {\n\t\t\t\t\t\t\tthis._propagateChange(null);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// not guarding these since the nativeElement has to be loaded\n\t\t\t\t\t// for select to even fire\n\t\t\t\t\t// only focus for \"organic\" selections\n\t\t\t\t\tif (!isUpdate(event)) {\n\t\t\t\t\t\tthis.elementRef.nativeElement.querySelector(\"input\").focus();\n\t\t\t\t\t\tthis.view.filterBy(\"\");\n\t\t\t\t\t\tthis.selected.emit(event.item);\n\t\t\t\t\t\tthis.closeDropdown();\n\t\t\t\t\t} else if (this._isUsingNgControl) {\n\t\t\t\t\t\tthis.writeValue(this._writtenValue);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t\t// update the rest of combobox with any pre-selected items\n\t\t\t// setTimeout just defers the call to the next check cycle\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.updateSelected();\n\t\t\t});\n\n\t\t\tthis.view.blurIntent.pipe(filter(v => v === \"top\")).subscribe(() => {\n\t\t\t\tthis.elementRef.nativeElement.querySelector(\".cds--text-input\").focus();\n\t\t\t});\n\t\t}\n\t}\n\n\t/**\n\t * Binds event handlers against the rendered view\n\t */\n\tngAfterViewInit() {\n\t\t// if appendInline is default valued (null) we should:\n\t\t// 1. if there are scrollable parents (not including body) don't append inline\n\t\t// this should also cover the case where the dropdown is in a modal\n\t\t// (where we _do_ want to append to the placeholder)\n\t\tif (this.appendInline === null && hasScrollableParents(this.elementRef.nativeElement)) {\n\t\t\tthis.appendInline = false;\n\t\t// 2. otherwise we should append inline\n\t\t} else if (this.appendInline === null) {\n\t\t\tthis.appendInline = true;\n\t\t}\n\t}\n\n\t/**\n\t * Removing the `Dropdown` from the body if it is appended to the body.\n\t */\n\tngOnDestroy() {\n\t\tif (!this.appendInline) {\n\t\t\tthis._appendToDropdown();\n\t\t}\n\t}\n\n\t/**\n\t * Handles `Escape/Tab` key closing the dropdown, and arrow up/down focus to/from the dropdown list.\n\t */\n\t@HostListener(\"keydown\", [\"$event\"])\n\thostkeys(ev: KeyboardEvent) {\n\t\tif (ev.key === \"Escape\") {\n\t\t\tthis.closeDropdown();\n\t\t} else if ((ev.key === \"ArrowDown\")\n\t\t\t&& (!this.dropdownMenu || !this.dropdownMenu.nativeElement.contains(ev.target))) {\n\t\t\tev.preventDefault();\n\t\t\tthis.openDropdown();\n\t\t\tsetTimeout(() => { this.view.initFocus(); }, 0);\n\t\t}\n\n\t\tif (\n\t\t\tthis.open && ev.key === \"Tab\" &&\n\t\t\t(this.dropdownMenu.nativeElement.contains(ev.target as Node) || ev.target === this.input.nativeElement)\n\t\t) {\n\t\t\tthis.closeDropdown();\n\t\t}\n\n\t\tif (this.open && ev.key === \"Tab\" && ev.shiftKey) {\n\t\t\tthis.closeDropdown();\n\t\t}\n\t}\n\n\t/*\n\t * no-op method for null event listeners, and other no op calls\n\t */\n\t_noop() {}\n\n\t/*\n\t * propagates the value provided from ngModel\n\t */\n\twriteValue(value: any) {\n\t\tthis._writtenValue = value;\n\n\t\tif (this.type === \"single\") {\n\t\t\tif (this.itemValueKey) {\n\t\t\t\t// clone the specified item and update its state\n\t\t\t\tconst newValue = Object.assign({}, this.view.getListItems().find(item => item[this.itemValueKey] === value));\n\t\t\t\tnewValue.selected = true;\n\t\t\t\tthis.view.propagateSelected([newValue]);\n\t\t\t} else {\n\t\t\t\t// all items in propagateSelected must be iterable\n\t\t\t\tthis.view.propagateSelected([value || \"\"]);\n\t\t\t}\n\t\t\tthis.showClearButton = !!(value && this.view.getSelected().length);\n\t\t} else {\n\t\t\tif (this.itemValueKey) {\n\t\t\t\t// clone the items and update their state based on the received value array\n\t\t\t\t// this way we don't lose any additional metadata that may be passed in via the `items` Input\n\t\t\t\tlet newValues = [];\n\t\t\t\tfor (const v of value ?? []) {\n\t\t\t\t\tfor (const item of this.view.getListItems()) {\n\t\t\t\t\t\tif (item[this.itemValueKey] === v) {\n\t\t\t\t\t\t\tnewValues.push(Object.assign({}, item, { selected: true }));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.view.propagateSelected(newValues);\n\t\t\t} else {\n\t\t\t\tthis.view.propagateSelected(value ? value : [\"\"]);\n\t\t\t}\n\t\t}\n\t\tthis.updateSelected();\n\t}\n\n\tonBlur() {\n\t\tthis.onTouchedCallback();\n\t}\n\n\tregisterOnChange(fn: any) {\n\t\tthis._isUsingNgControl = true;\n\t\tthis.propagateChangeCallback = fn;\n\t}\n\n\tregisterOnTouched(fn: any) {\n\t\tthis.onTouchedCallback = fn;\n\t}\n\n\t/**\n\t * `ControlValueAccessor` method to programmatically disable the combobox.\n\t *\n\t * ex: `this.formGroup.get(\"myCoolCombobox\").disable();`\n\t */\n\tsetDisabledState(isDisabled: boolean) {\n\t\tthis.disabled = isDisabled;\n\t}\n\n\t/**\n\t * Called by `n-pill-input` when the selected pills have changed.\n\t */\n\tpublic updatePills() {\n\t\tthis.pills = this.view.getSelected() || [];\n\t\tthis.checkForReorder();\n\t}\n\n\tpublic clearSelected(event) {\n\t\tthis.items = this.items.map(item => {\n\t\t\tif (!item.disabled) {\n\t\t\t\titem.selected = false;\n\t\t\t}\n\t\t\treturn item;\n\t\t});\n\t\tthis.view.propagateSelected([]);\n\t\tthis.updatePills();\n\t\t/**\n\t\t * @todo - In next major version update to the following:\n\t\t * const selected = this.type === \"multi\" ? this.view.getSelected() : undefined;\n\t\t *\n\t\t * Previously it returned an empty array even for type === 'single'\n\t\t * Also resolve #ref-1245723\n\t\t */\n\t\t// On type=multi we just emit getSelected() (just in case there's any disabled but selected items)\n\t\tconst selected = this.view.getSelected();\n\n\t\t// in case there are disabled items they should be mapped according to itemValueKey\n\t\tif (this.itemValueKey && selected) {\n\t\t\tconst values = selected.map((item) => item[this.itemValueKey]);\n\t\t\tthis._propagateChange(values);\n\t\t} else {\n\t\t\tthis._propagateChange(selected);\n\t\t}\n\n\t\tthis.selected.emit(selected as any);\n\t\tthis.clear.emit(event);\n\t}\n\n\t/**\n\t * Closes the dropdown and emits the close event.\n\t */\n\tpublic closeDropdown() {\n\t\tthis.open = false;\n\t\tthis.checkForReorder();\n\t\tthis.close.emit();\n\t\tif (!this.appendInline) {\n\t\t\tthis._appendToDropdown();\n\t\t}\n\n\t\tdocument.removeEventListener(\"click\", this.outsideClick, true);\n\t}\n\n\t/**\n\t * Opens the dropdown.\n\t */\n\tpublic openDropdown() {\n\t\tif (this.disabled || this.readonly) { return; }\n\t\tthis.open = true;\n\t\tthis._dropUp = false;\n\n\t\tif (!this.appendInline) {\n\t\t\tthis._appendToBody();\n\t\t}\n\n\t\tdocument.addEventListener(\"click\", this.outsideClick, true);\n\n\t\t// set the dropdown menu to drop up if it is near the bottom of the screen\n\t\t// setTimeout lets us do the calculations after it is visible in the DOM\n\t\tsetTimeout(() => {\n\t\t\tif (this.dropUp === null || this.dropUp === undefined) {\n\t\t\t\tthis._dropUp = this._shouldDropUp();\n\t\t\t}\n\t\t}, 0);\n\t}\n\n\t/**\n\t * Toggles the dropdown.\n\t */\n\tpublic toggleDropdown() {\n\t\tif (this.open) {\n\t\t\tthis.closeDropdown();\n\t\t} else {\n\t\t\tthis.openDropdown();\n\t\t}\n\t}\n\n\t/**\n\t * Sets the list group filter, and manages single select item selection.\n\t */\n\tpublic onSearch(searchString, shouldEmitSearch = true) {\n\t\tif (shouldEmitSearch) {\n\t\t\tthis.search.emit(searchString);\n\t\t}\n\t\tthis.showClearButton = !!searchString;\n\t\tthis.view.filterBy(searchString);\n\t\tif (searchString !== \"\") {\n\t\t\tif (!this.open) {\n\t\t\t\tthis.openDropdown();\n\t\t\t}\n\t\t} else {\n\t\t\tthis.selectedValue = \"\";\n\t\t\tif (this.type === \"multi\" &&\n\t\t\t\t(this.selectionFeedback === \"top\" || this.selectionFeedback === \"top-after-reopen\")) {\n\t\t\t\tthis.view.reorderSelected();\n\t\t\t}\n\t\t}\n\t\tif (this.type === \"single\") {\n\t\t\t// deselect if the input doesn't match the content\n\t\t\t// of any given item\n\t\t\tconst matches = this.view.getListItems().some(item => item.content.toLowerCase().includes(searchString.toLowerCase()));\n\t\t\tif (!matches) {\n\t\t\t\tconst selected = this.view.getSelected();\n\t\t\t\tif (!selected || !selected[0]) {\n\t\t\t\t\tthis.view.filterBy(searchString);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Intended to be used to add items to the list.\n\t */\n\tpublic onSubmit(event: KeyboardEvent) {\n\t\tthis.submit.emit({\n\t\t\titems: this.view.getListItems(),\n\t\t\tindex: 0,\n\t\t\tvalue: {\n\t\t\t\tcontent: (event.target as HTMLInputElement).value,\n\t\t\t\tselected: false\n\t\t\t}\n\t\t});\n\t}\n\n\tclearInput(event) {\n\t\tevent.stopPropagation();\n\t\tevent.preventDefault();\n\n\t\tif (this.disabled || this.readonly) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.type === \"single\") { // don't want to clear selected or close if multi\n\t\t\tthis.clearSelected(event);\n\t\t\tthis.closeDropdown();\n\t\t}\n\n\t\tthis.selectedValue = \"\";\n\t\tthis.input.nativeElement.value = \"\";\n\n\t\tthis.showClearButton = false;\n\t\tthis.input.nativeElement.focus();\n\t\tthis.onSearch(this.input.nativeElement.value);\n\t}\n\n\tpublic isTemplate(value) {\n\t\treturn value instanceof TemplateRef;\n\t}\n\n\t/**\n\t * Handles keyboard events so users are controlling the `Dropdown` instead of unintentionally controlling outside elements.\n\t */\n\t_keyboardNav(event: KeyboardEvent) {\n\t\tif ((event.key === \"Escape\") && this.open) {\n\t\t\tevent.stopImmediatePropagation(); // don't unintentionally close modal if inside of it\n\t\t}\n\t\tif (event.key === \"Escape\") {\n\t\t\tevent.preventDefault();\n\t\t\tthis.closeDropdown();\n\t\t\tthis.input.nativeElement.focus();\n\t\t} else if (this.open && event.key === \"Tab\") {\n\t\t\t// this way focus will start on the next focusable item from the dropdown\n\t\t\t// not the top of the body!\n\t\t\tthis.input.nativeElement.focus();\n\t\t\tthis.input.nativeElement.dispatchEvent(new KeyboardEvent(\"keydown\", { bubbles: true, cancelable: true, key: \"Tab\" }));\n\t\t\tthis.closeDropdown();\n\t\t}\n\t}\n\n\t/**\n\t * Creates the `Dropdown` list as an element that is appended to the DOM body.\n\t */\n\t_appendToBody() {\n\t\tthis.dropdownService.appendToBody(\n\t\t\tthis.listbox.nativeElement,\n\t\t\tthis.dropdownMenu.nativeElement,\n\t\t\t`${this.elementRef.nativeElement.className}${this.open ? \" cds--list-box--expanded\" : \"\"}`);\n\t\tthis.dropdownMenu.nativeElement.addEventListener(\"keydown\", this.keyboardNav, true);\n\t}\n\n\t/**\n\t * Creates the `Dropdown` list appending it to the dropdown parent object instead of the body.\n\t */\n\t_appendToDropdown() {\n\t\tthis.dropdownService.appendToDropdown(this.elementRef.nativeElement);\n\t\tthis.dropdownMenu.nativeElement.removeEventListener(\"keydown\", this.keyboardNav, true);\n\t}\n\n\t/**\n\t * Detects whether or not the `Dropdown` list is visible within all scrollable parents.\n\t * This can be overridden by passing in a value to the `dropUp` input.\n\t */\n\t_shouldDropUp() {\n\t\t// check if dropdownMenu exists first.\n\t\tconst menu = this.dropdownMenu && this.dropdownMenu.nativeElement.querySelector(\".cds--list-box__menu\");\n\t\t// check if menu exists first.\n\t\tconst menuRect = menu && menu.getBoundingClientRect();\n\t\tif (menu && menuRect) {\n\t\t\tconst scrollableParents = getScrollableParents(menu);\n\t\t\treturn scrollableParents.reduce((shouldDropUp: boolean, parent: HTMLElement) => {\n\t\t\t\tconst parentRect = parent.getBoundingClientRect();\n\t\t\t\tconst isBelowParent = !(menuRect.bottom <= parentRect.bottom);\n\t\t\t\treturn shouldDropUp || isBelowParent;\n\t\t\t}, false);\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * Handles clicks outside of the `Dropdown` list.\n\t */\n\t_outsideClick(event) {\n\t\tif (!this.elementRef.nativeElement.contains(event.target) &&\n\t\t\t// if we're appendToBody the list isn't within the _elementRef,\n\t\t\t// so we've got to check if our target is possibly in there too.\n\t\t\t!this.dropdownMenu.nativeElement.contains(event.target)) {\n\t\t\tthis.closeDropdown();\n\t\t}\n\t}\n\n\thandleFocus(event: FocusEvent) {\n\t\tthis._isFocused = event.type === \"focus\";\n\t}\n\n\tprotected updateSelected() {\n\t\tconst selected = this.view.getSelected();\n\t\tif (this.type === \"multi\") {\n\t\t\tthis.updatePills();\n\t\t} else if (selected) {\n\t\t\tconst value = selected[0] ? selected[0].content : \"\";\n\t\t\tconst changeCallbackValue = selected[0] ? selected[0] : \"\";\n\t\t\tthis.selectedValue = value;\n\t\t\tthis.showClearButton = !!value;\n\t\t}\n\t}\n\n\tprotected checkForReorder() {\n\t\tconst topAfterReopen = !this.open && this.selectionFeedback === \"top-after-reopen\";\n\t\tif ((this.type === \"multi\") && (topAfterReopen || this.selectionFeedback === \"top\")) {\n\t\t\tthis.view.reorderSelected(true);\n\t\t}\n\t}\n\n\tprivate _propagateChange(value: any) {\n\t\tthis._writtenValue = value;\n\t\tthis.propagateChangeCallback(value);\n\t}\n}\n",
|
|
27222
26895
|
"assetsDirs": [],
|
|
27223
26896
|
"styleUrlsData": "",
|
|
27224
26897
|
"stylesData": "",
|
|
@@ -30188,7 +29861,7 @@
|
|
|
30188
29861
|
},
|
|
30189
29862
|
{
|
|
30190
29863
|
"name": "DatePicker",
|
|
30191
|
-
"id": "component-DatePicker-
|
|
29864
|
+
"id": "component-DatePicker-888a30fe120d96225c6a7fcadfcb5ba65c8e1845f4807690fca88204bfbaabaf05c65bff52447830231cc6c43a86257227c91a2554180e98ad4e4e8aedba7763",
|
|
30192
29865
|
"file": "src/datepicker/datepicker.component.ts",
|
|
30193
29866
|
"encapsulation": [
|
|
30194
29867
|
"ViewEncapsulation.None"
|
|
@@ -30906,7 +30579,7 @@
|
|
|
30906
30579
|
"description": "<p>Get started with importing the module:</p>\n<b>Example :</b><div><pre class=\"line-numbers\"><code class=\"language-typescript\">import { DatePickerModule } from 'carbon-components-angular';</code></pre></div><p><a href=\"../../?path=/story/components-date-picker--single\">See demo</a></p>\n",
|
|
30907
30580
|
"rawdescription": "\n\nGet started with importing the module:\n\n```typescript\nimport { DatePickerModule } from 'carbon-components-angular';\n```\n\n[See demo](../../?path=/story/components-date-picker--single)\n",
|
|
30908
30581
|
"type": "component",
|
|
30909
|
-
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tOutput,\n\tEventEmitter,\n\tViewEncapsulation,\n\tElementRef,\n\tOnDestroy,\n\tHostListener,\n\tTemplateRef,\n\tOnChanges,\n\tSimpleChanges,\n\tAfterViewChecked,\n\tAfterViewInit,\n\tViewChild,\n\tOnInit,\n\tSimpleChange\n} from \"@angular/core\";\nimport rangePlugin from \"flatpickr/dist/plugins/rangePlugin\";\nimport flatpickr from \"flatpickr\";\nimport { NG_VALUE_ACCESSOR } from \"@angular/forms\";\nimport { carbonFlatpickrMonthSelectPlugin } from \"./carbon-flatpickr-month-select\";\nimport * as languages from \"flatpickr/dist/l10n/index\";\nimport { Options } from \"flatpickr/dist/types/options\";\nimport { DatePickerInput } from \"carbon-components-angular/datepicker-input\";\nimport { I18n } from \"carbon-components-angular/i18n\";\n\n/**\n * Due to type error, we have to use square brackets property accessor\n * There is a webpack issue when attempting to access exported languages from flatpickr l10n Angular 14+ apps\n * languages.default[locale] fails in app consuming CCA library but passes in test\n * languages.default.default[locale] fails in test but works in app consuming CCA library.\n *\n * To please both scenarios, we are adding a condition to prevent tests from failing\n */\nif (languages.default?.default[\"en\"]?.weekdays) {\n\t(languages.default.default[\"en\"].weekdays.shorthand as string[]) = languages.default.default[\"en\"].weekdays.longhand.map(day => {\n\t\tif (day === \"Thursday\") {\n\t\t\treturn \"Th\";\n\t\t}\n\t\treturn day.charAt(0);\n\t});\n}\n\n/**\n * Get started with importing the module:\n *\n * ```typescript\n * import { DatePickerModule } from 'carbon-components-angular';\n * ```\n *\n * [See demo](../../?path=/story/components-date-picker--single)\n */\n@Component({\n\tselector: \"cds-date-picker, ibm-date-picker\",\n\ttemplate: `\n\t<div class=\"cds--form-item\">\n\t\t<div\n\t\t\tclass=\"cds--date-picker\"\n\t\t\t[ngClass]=\"{\n\t\t\t\t'cds--date-picker--range' : range,\n\t\t\t\t'cds--date-picker--single' : !range,\n\t\t\t\t'cds--date-picker--light' : theme === 'light',\n\t\t\t\t'cds--skeleton' : skeleton\n\t\t\t}\">\n\t\t\t<div class=\"cds--date-picker-container\">\n\t\t\t\t<cds-date-picker-input\n\t\t\t\t\t#input\n\t\t\t\t\t[label]=\"label\"\n\t\t\t\t\t[placeholder]=\"placeholder\"\n\t\t\t\t\t[pattern]=\"inputPattern\"\n\t\t\t\t\t[id]=\"id + '-input'\"\n\t\t\t\t\t[size]=\"size\"\n\t\t\t\t\t[type]=\"(range ? 'range' : 'single')\"\n\t\t\t\t\t[hasIcon]=\"(range ? false : true)\"\n\t\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t\t[readonly]=\"readonly\"\n\t\t\t\t\t[invalid]=\"invalid\"\n\t\t\t\t\t[invalidText]=\"invalidText\"\n\t\t\t\t\t[warn]=\"warn\"\n\t\t\t\t\t[warnText]=\"warnText\"\n\t\t\t\t\t[skeleton]=\"skeleton\"\n\t\t\t\t\t[helperText]=\"helperText\"\n\t\t\t\t\t[decorator]=\"decorator\"\n\t\t\t\t\t(valueChange)=\"onValueChange($event)\"\n\t\t\t\t\t(click)=\"openCalendar(input, $event)\">\n\t\t\t\t</cds-date-picker-input>\n\t\t\t</div>\n\n\t\t\t<div *ngIf=\"range\" class=\"cds--date-picker-container\">\n\t\t\t\t<cds-date-picker-input\n\t\t\t\t\t#rangeInput\n\t\t\t\t\t[label]=\"rangeLabel\"\n\t\t\t\t\t[placeholder]=\"placeholder\"\n\t\t\t\t\t[pattern]=\"inputPattern\"\n\t\t\t\t\t[id]=\"id + '-rangeInput'\"\n\t\t\t\t\t[size]=\"size\"\n\t\t\t\t\t[type]=\"(range ? 'range' : 'single')\"\n\t\t\t\t\t[hasIcon]=\"(range ? true : null)\"\n\t\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t\t[readonly]=\"readonly\"\n\t\t\t\t\t[invalid]=\"rangeInvalid\"\n\t\t\t\t\t[invalidText]=\"rangeInvalidText\"\n\t\t\t\t\t[warn]=\"rangeWarn\"\n\t\t\t\t\t[warnText]=\"rangeWarnText\"\n\t\t\t\t\t[skeleton]=\"skeleton\"\n\t\t\t\t\t[helperText]=\"rangeHelperText\"\n\t\t\t\t\t[decorator]=\"rangeDecorator\"\n\t\t\t\t\t(valueChange)=\"onRangeValueChange($event)\"\n\t\t\t\t\t(click)=\"openCalendar(rangeInput, $event)\">\n\t\t\t\t</cds-date-picker-input>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n\t`,\n\tproviders: [\n\t\t{\n\t\t\tprovide: NG_VALUE_ACCESSOR,\n\t\t\tuseExisting: DatePicker,\n\t\t\tmulti: true\n\t\t}\n\t],\n\tencapsulation: ViewEncapsulation.None\n})\nexport class DatePicker implements\n\tOnInit,\n\tOnDestroy,\n\tOnChanges,\n\tAfterViewChecked,\n\tAfterViewInit {\n\tprivate static datePickerCount = 0;\n\n\t/**\n\t * Select calendar range mode\n\t */\n\t@Input() range = false;\n\n\t/**\n\t * Format of date\n\t *\n\t * For reference: https://flatpickr.js.org/formatting/\n\t */\n\t@Input() dateFormat = \"m/d/Y\";\n\n\t/**\n\t * Language of the flatpickr calendar.\n\t *\n\t * For reference of the possible locales:\n\t * https://github.com/flatpickr/flatpickr/blob/master/src/l10n/index.ts\n\t */\n\t@Input() language = \"en\";\n\n\t@Input() label: string | TemplateRef<any>;\n\t@Input() helperText: string | TemplateRef<any>;\n\t/**\n\t * **Experimental**: Optional decorator (e.g. AI label).\n\t */\n\t@Input() decorator: TemplateRef<any>;\n\t/**\n\t * **Experimental**: Optional decorator (e.g. AI label) on the range end field when `range` is `true`.\n\t */\n\t@Input() rangeDecorator: TemplateRef<any>;\n\t@Input() rangeHelperText: string | TemplateRef<any>;\n\t@Input() rangeLabel: string;\n\n\t@Input() placeholder = \"mm/dd/yyyy\";\n\n\t/**\n\t * Aria label added to datepicker's calendar container.\n\t */\n\t@Input() ariaLabel = \"calendar container\";\n\n\t/**\n\t * The pattern for the underlying input element\n\t */\n\t@Input() inputPattern = \"^\\\\d{1,2}/\\\\d{1,2}/\\\\d{4}$\";\n\n\t@Input() id = `datepicker-${DatePicker.datePickerCount++}`;\n\n\t@Input() set value(v: (Date | string)[]) {\n\t\tif (!v) {\n\t\t\tv = [];\n\t\t}\n\t\tthis._value = v;\n\t}\n\n\tget value() {\n\t\treturn this._value;\n\t}\n\n\t/**\n\t * @deprecated since v5 - Use `cdsLayer` directive instead\n\t * Set to `\"light\"` to apply the light style\n\t */\n\t@Input() theme: \"light\" | \"dark\" = \"dark\";\n\n\t@Input() disabled = false;\n\n\t@Input() readonly = false;\n\t/**\n\t * Set to `true` to display the invalid state.\n\t */\n\t@Input() invalid = false;\n\t/**\n\t * Value displayed if datepicker is in an invalid state.\n\t */\n\t@Input() invalidText: string | TemplateRef<any>;\n\t/**\n\t * Set to `true` to show a warning (contents set by warningText)\n\t */\n\t@Input() warn = false;\n\t/**\n\t * Sets the warning text\n\t */\n\t@Input() warnText: string | TemplateRef<any>;\n\n\t@Input() size: \"sm\" | \"md\" | \"lg\" = \"md\";\n\t/**\n\t * Set to `true` to display the invalid state for the second datepicker input.\n\t */\n\t@Input() rangeInvalid = false;\n\t/**\n\t * Value displayed if the second datepicker input is in an invalid state.\n\t */\n\t@Input() rangeInvalidText: string | TemplateRef<any>;\n\t/**\n\t * Set to `true` to show a warning in the second datepicker input (contents set by rangeWarningText)\n\t */\n\t@Input() rangeWarn = false;\n\t/**\n\t * Sets the warning text for the second datepicker input\n\t */\n\t@Input() rangeWarnText: string | TemplateRef<any>;\n\n\t@Input() skeleton = false;\n\n\t@Input() plugins = [];\n\n\t@Input()\n\tset flatpickrOptions(options: Partial<Options>) {\n\t\tthis._flatpickrOptions = Object.assign({}, this._flatpickrOptions, options);\n\t}\n\tget flatpickrOptions(): Partial<Options> {\n\t\tconst plugins = [...this.plugins, carbonFlatpickrMonthSelectPlugin];\n\t\tif (this.range) {\n\t\t\tplugins.push(rangePlugin({ input: `#${this.id}-rangeInput`, position: \"left\" }));\n\t\t}\n\t\treturn Object.assign({}, this._flatpickrOptions, this.flatpickrBaseOptions, {\n\t\t\tmode: this.range ? \"range\" : \"single\",\n\t\t\tplugins,\n\t\t\tdateFormat: this.dateFormat,\n\t\t\tlocale: languages.default?.default[this.language] || languages.default[this.language],\n\t\t\t// Little trick force \"readonly mode\" on datepicker input.\n\t\t\t// Docs: Whether clicking on the input should open the picker.\n\t\t\t// You could disable this if you wish to open the calendar manually with.open().\n\t\t\tclickOpens: !this.readonly\n\t\t});\n\t}\n\n\t@ViewChild(\"input\", { static: true }) input: DatePickerInput;\n\t@ViewChild(\"rangeInput\") rangeInput: DatePickerInput;\n\n\t@Output() valueChange: EventEmitter<any> = new EventEmitter();\n\n\t/**\n\t * We are overriding onClose event even if users pass it via flatpickr options\n\t * Emits an event when date picker closes\n\t */\n\t@Output() onClose: EventEmitter<any> = new EventEmitter();\n\n\tprotected _value = [];\n\n\tprotected _flatpickrOptions: Partial<Options> = {\n\t\tallowInput: true\n\t};\n\n\tprotected flatpickrBaseOptions = {\n\t\tmode: \"single\",\n\t\tdateFormat: \"m/d/Y\",\n\t\tplugins: this.plugins,\n\t\tonOpen: () => {\n\t\t\tthis.updateClassNames();\n\t\t\tthis.updateAttributes();\n\t\t\tthis.updateCalendarListeners();\n\t\t},\n\t\tonClose: (date) => {\n\t\t\t// This makes sure that the `flatpickrInstance selectedDates` are in sync with the values of\n\t\t\t// the inputs when the calendar closes.\n\t\t\tif (this.range && this.flatpickrInstance) {\n\t\t\t\tconst inputValue = this.input.input.nativeElement.value;\n\t\t\t\tconst rangeInputValue = this.rangeInput.input.nativeElement.value;\n\t\t\t\tif (inputValue || rangeInputValue) {\n\t\t\t\t\tconst parseDate = (date: string) => this.flatpickrInstance.parseDate(date, this.dateFormat);\n\t\t\t\t\tthis.setDateValues([parseDate(inputValue), parseDate(rangeInputValue || inputValue)]);\n\t\t\t\t\tthis.doSelect(this.flatpickrInstance.selectedDates);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.onClose.emit(date);\n\t\t},\n\t\tonDayCreate: (_dObj, _dStr, _fp, dayElem) => {\n\t\t\tdayElem.classList.add(\"cds--date-picker__day\");\n\t\t},\n\t\tnextArrow: this.rightArrowHTML(),\n\t\tprevArrow: this.leftArrowHTML(),\n\t\tvalue: this.value\n\t};\n\n\tprotected flatpickrInstance = null;\n\n\tconstructor(\n\t\tprotected elementRef: ElementRef,\n\t\tprotected i18n: I18n\n\t) { }\n\n\tngOnInit() {\n\t\t// if i18n is set to anything other than en we'll want to change the language\n\t\t// otherwise we'll just use the local setting\n\t\tif (this.i18n.getLocale() !== \"en\") {\n\t\t\tthis.i18n.getLocaleObservable().subscribe(locale => {\n\t\t\t\tthis.language = locale;\n\t\t\t\tthis.resetFlatpickrInstance();\n\t\t\t});\n\t\t}\n\t}\n\n\tngOnChanges(changes: SimpleChanges) {\n\t\t// Reset the flatpickr instance on input changes that affect flatpickr.\n\t\tconst flatpickrChangeKeys = [\n\t\t\t\"range\",\n\t\t\t\"dateFormat\",\n\t\t\t\"language\",\n\t\t\t\"id\",\n\t\t\t\"value\",\n\t\t\t\"plugins\",\n\t\t\t\"flatpickrOptions\",\n\t\t\t\"readonly\"\n\t\t];\n\t\tconst changeKeys = Object.keys(changes);\n\t\tif (changeKeys.some(key => flatpickrChangeKeys.includes(key))) {\n\t\t\tthis.resetFlatpickrInstance(changes.value);\n\t\t}\n\t}\n\n\tngAfterViewInit() {\n\t\tif (!this.skeleton) {\n\t\t\tthis.input.input.nativeElement.value = this._value[0] ?? \"\";\n\t\t\tif (this.range) {\n\t\t\t\tthis.rangeInput.input.nativeElement.value = this._value[1] ?? \"\";\n\t\t\t}\n\t\t}\n\t\tsetTimeout(() => {\n\t\t\tthis.addInputListeners();\n\t\t}, 0);\n\t}\n\n\t// because the actual view may be delayed in loading (think projection into a tab pane)\n\t// and because we rely on a library that operates outside the Angular view of the world\n\t// we need to keep trying to load the library, until the relevant DOM is actually live\n\tngAfterViewChecked() {\n\t\tif (!this.isFlatpickrLoaded()) {\n\t\t\t// @ts-ignore ts is unhappy with the below call to `flatpickr`\n\t\t\tthis.flatpickrInstance = flatpickr(`#${this.id}-input`, this.flatpickrOptions);\n\t\t\t// if (and only if) the initialization succeeded, we can set the date values\n\t\t\tif (this.isFlatpickrLoaded()) {\n\t\t\t\tif (this.value.length > 0) {\n\t\t\t\t\tthis.setDateValues(this.value);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t@HostListener(\"focusin\")\n\tonFocus() {\n\t\t// Updates the month manually when calendar mode is range because month\n\t\t// will not update properly without manually updating them on focus.\n\t\tif (this.range) {\n\t\t\tif (this.rangeInput.input.nativeElement === document.activeElement && this.flatpickrInstance.selectedDates[1]) {\n\t\t\t\tconst currentMonth = this.flatpickrInstance.selectedDates[1].getMonth();\n\t\t\t\tthis.flatpickrInstance.changeMonth(currentMonth, false);\n\t\t\t} else if (this.input.input.nativeElement === document.activeElement && this.flatpickrInstance.selectedDates[0]) {\n\t\t\t\tconst currentMonth = this.flatpickrInstance.selectedDates[0].getMonth();\n\t\t\t\tthis.flatpickrInstance.changeMonth(currentMonth, false);\n\t\t\t}\n\t\t}\n\t}\n\n\t@HostListener(\"focusout\")\n\tonFocusOut() {\n\t\tthis.onTouched();\n\t}\n\n\t/**\n\t * Writes a value from the model to the component. Expects the value to be `null` or `(Date | string)[]`\n\t * @param value value received from the model\n\t */\n\twriteValue(value: (Date | string)[]) {\n\t\tthis.value = value;\n\t\tsetTimeout(() => {\n\t\t\tif (this.isFlatpickrLoaded() && this.flatpickrInstance.config) {\n\t\t\t\tthis.setDateValues(this.value);\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * `ControlValueAccessor` method to programmatically disable the DatePicker.\n\t *\n\t * ex: `this.formGroup.get(\"myDatePicker\").disable();`\n\t *\n\t * @param isDisabled `true` to disable the DatePicker\n\t */\n\tsetDisabledState(isDisabled: boolean) {\n\t\tthis.disabled = isDisabled;\n\t}\n\n\tregisterOnChange(fn: any) {\n\t\tthis.propagateChange = fn;\n\t}\n\n\tregisterOnTouched(fn: any) {\n\t\tthis.onTouched = fn;\n\t}\n\n\tonTouched: () => any = () => { };\n\n\tpropagateChange = (_: any) => { };\n\n\t/**\n\t * Cleans up our flatpickr instance\n\t */\n\tngOnDestroy() {\n\t\tif (!this.isFlatpickrLoaded()) { return; }\n\t\tthis.flatpickrInstance.destroy();\n\t}\n\n\t/**\n\t * Handles the `valueChange` event from the primary/single input\n\t */\n\tonValueChange(event: string) {\n\t\tif (this.isFlatpickrLoaded()) {\n\t\t\tconst date = this.flatpickrInstance.parseDate(event, this.dateFormat);\n\t\t\tif (this.range) {\n\t\t\t\tthis.setDateValues([date, this.flatpickrInstance.selectedDates[1]]);\n\t\t\t} else {\n\t\t\t\tthis.setDateValues([date]);\n\t\t\t}\n\t\t\tthis.doSelect(this.flatpickrInstance.selectedDates);\n\t\t}\n\t}\n\n\t/**\n\t * Handles the `valueChange` event from the range input\n\t */\n\tonRangeValueChange(event: string) {\n\t\tif (this.isFlatpickrLoaded() && this.flatpickrInstance.isOpen) {\n\t\t\tconst date = this.flatpickrInstance.parseDate(event, this.dateFormat);\n\t\t\tthis.setDateValues([this.flatpickrInstance.selectedDates[0], date]);\n\t\t\tthis.doSelect(this.flatpickrInstance.selectedDates);\n\t\t}\n\t}\n\n\t/**\n\t * Opens the calendar \"properly\" when the calendar if it was already open.\n\t */\n\topenCalendar(datepickerInput: DatePickerInput, event?: Event) {\n\t\tif (this.readonly || this.skeleton) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Skips opening when the click is on the decorator region so the AI label triggers\n\t\tif (this.isDecoratorClick(event)) {\n\t\t\tif (this.isFlatpickrLoaded() && this.flatpickrInstance.isOpen) {\n\t\t\t\tthis.flatpickrInstance.close();\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.range) {\n\t\t\tdatepickerInput.input.nativeElement.click();\n\n\t\t\t// If the first input's calendar icon is clicked when calendar is in range mode, then\n\t\t\t// the month and year needs to be manually changed to the current selected month and\n\t\t\t// year otherwise the calendar view will not be updated upon opening.\n\t\t\tif (datepickerInput === this.input && this.flatpickrInstance.selectedDates[0]) {\n\t\t\t\tconst currentMonth = this.flatpickrInstance.selectedDates[0].getMonth();\n\n\t\t\t\tthis.flatpickrInstance.currentYear = this.flatpickrInstance.selectedDates[0].getFullYear();\n\t\t\t\tthis.flatpickrInstance.changeMonth(currentMonth, false);\n\t\t\t}\n\t\t} else {\n\t\t\t// Single-mode flatpickr handles mousedown but not click, so nativeElement.click() won't\n\t\t\t// work when the calendar icon is clicked. In this case we simply use flatpickr.open().\n\t\t\tthis.flatpickrInstance.open();\n\t\t}\n\t}\n\n\tprivate isDecoratorClick(event: Event | undefined): boolean {\n\t\tif (!event?.target) {\n\t\t\treturn false;\n\t\t}\n\t\tconst t = event.target;\n\t\tconst el = t instanceof Element ? t : (t as Node).parentElement;\n\t\treturn el?.closest(\".cds--date-picker-input-inner-wrapper--decorator\") != null;\n\t}\n\n\tprotected updateCalendarListeners() {\n\t\tconst calendarContainer = document.querySelectorAll(\".flatpickr-calendar\");\n\t\tArray.from(calendarContainer).forEach(calendar => {\n\t\t\tcalendar.removeEventListener(\"click\", this.preventCalendarClose);\n\t\t\tcalendar.addEventListener(\"click\", this.preventCalendarClose);\n\t\t});\n\t}\n\n\t/**\n\t * Handles the initialization of event listeners for the datepicker input and range input fields.\n\t */\n\tprotected addInputListeners() {\n\t\tif (!this.isFlatpickrLoaded()) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Allows focus transition from the datepicker input or range input field to\n\t\t// flatpickr calendar using a keyboard.\n\t\tconst addFocusCalendarListener = (element: HTMLInputElement) => {\n\t\t\telement.addEventListener(\"keydown\", (event: KeyboardEvent) => {\n\t\t\t\t// Listeners are added just once, so a check is needed here.\n\t\t\t\tif (this.readonly) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (event.key === \"Escape\") {\n\t\t\t\t\tthis.flatpickrInstance.close();\n\t\t\t\t}\n\t\t\t\tif (event.key === \"ArrowDown\") {\n\t\t\t\t\tif (!this.flatpickrInstance.isOpen) {\n\t\t\t\t\t\tthis.flatpickrInstance.open();\n\t\t\t\t\t}\n\n\t\t\t\t\tconst calendarContainer = this.flatpickrInstance.calendarContainer;\n\t\t\t\t\tconst dayElement = calendarContainer && calendarContainer.querySelector(\".flatpickr-day[tabindex]\");\n\t\t\t\t\tconst selectedDateElem = calendarContainer && calendarContainer.querySelector(\".selected\");\n\t\t\t\t\tconst todayDateElem = calendarContainer && calendarContainer.querySelector(\".today\");\n\n\t\t\t\t\tif (dayElement) {\n\t\t\t\t\t\t(todayDateElem || selectedDateElem || dayElement).focus();\n\n\t\t\t\t\t\t// If the user manually inputs a value into the date field and presses arrow down,\n\t\t\t\t\t\t// datepicker input onchange will be triggered when focus is removed from it and\n\t\t\t\t\t\t// `flatpickrInstance.setDate` and `flatpickrInstance.changeMonth` will be invoked\n\t\t\t\t\t\t// which will automatically change focus to the beginning of the document.\n\t\t\t\t\t\tif (document.activeElement !== dayElement && this.flatpickrInstance.selectedDateElem) {\n\t\t\t\t\t\t\tthis.flatpickrInstance.selectedDateElem.focus();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t};\n\n\t\tif (this.input && this.input.input) {\n\t\t\taddFocusCalendarListener(this.input.input.nativeElement);\n\t\t}\n\n\t\tif (this.rangeInput && this.rangeInput.input) {\n\t\t\taddFocusCalendarListener(this.rangeInput.input.nativeElement);\n\t\t}\n\t}\n\n\t/**\n\t * Resets the flatpickr instance while keeping the date values (or updating them if newDates is provided)\n\t *\n\t * Used to pick up input changes or locale changes.\n\t *\n\t * @param newDates An optional SimpleChange of date values\n\t */\n\tprotected resetFlatpickrInstance(newDates?: SimpleChange) {\n\t\tif (this.isFlatpickrLoaded()) {\n\t\t\tlet dates = this.flatpickrInstance.selectedDates;\n\t\t\tif (newDates && this.didDateValueChange(newDates.currentValue, newDates.previousValue)) {\n\t\t\t\tdates = newDates.currentValue;\n\t\t\t}\n\t\t\t// only reset the flatpickr instance on Input changes\n\t\t\t// @ts-ignore ts is unhappy with the below call to `flatpickr`\n\t\t\tthis.flatpickrInstance = flatpickr(`#${this.id}-input`, this.flatpickrOptions);\n\t\t\tthis.setDateValues(dates);\n\t\t}\n\t}\n\n\t/**\n\t * Carbon uses a number of specific classnames for parts of the flatpickr - this idempotent method applies them if needed.\n\t */\n\tprotected updateClassNames() {\n\t\tif (!this.elementRef) { return; }\n\t\t// get all the possible flatpickrs in the document - we need to add classes to (potentially) all of them\n\t\tconst calendarContainer = document.querySelectorAll(\".flatpickr-calendar\");\n\t\tconst monthContainer = document.querySelectorAll(\".flatpickr-month\");\n\t\tconst weekdaysContainer = document.querySelectorAll(\".flatpickr-weekdays\");\n\t\tconst weekdayContainer = document.querySelectorAll(\".flatpickr-weekday\");\n\t\tconst daysContainer = document.querySelectorAll(\".flatpickr-days\");\n\t\tconst dayContainer = document.querySelectorAll(\".flatpickr-day\");\n\n\t\t// add classes to lists of elements\n\t\tconst addClassIfNotExists = (classname: string, elementList: NodeListOf<Element>) => {\n\t\t\tArray.from(elementList).forEach(element => {\n\t\t\t\tif (!element.classList.contains(classname)) {\n\t\t\t\t\telement.classList.add(classname);\n\t\t\t\t}\n\t\t\t});\n\t\t};\n\n\t\t// add classes (but only if they don't exist, small perf win)\n\t\taddClassIfNotExists(\"cds--date-picker__calendar\", calendarContainer);\n\t\taddClassIfNotExists(\"cds--date-picker__month\", monthContainer);\n\t\taddClassIfNotExists(\"cds--date-picker__weekdays\", weekdaysContainer);\n\t\taddClassIfNotExists(\"cds--date-picker__days\", daysContainer);\n\n\t\t// add weekday classes and format the text\n\t\tArray.from(weekdayContainer).forEach(element => {\n\t\t\telement.innerHTML = element.innerHTML.replace(/\\s+/g, \"\");\n\t\t\telement.classList.add(\"cds--date-picker__weekday\");\n\t\t});\n\n\t\t// add day classes and special case the \"today\" element based on `this.value`\n\t\tArray.from(dayContainer).forEach(element => {\n\t\t\telement.setAttribute(\"role\", \"button\");\n\t\t\telement.classList.add(\"cds--date-picker__day\");\n\t\t\tif (!this.value) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (element.classList.contains(\"today\") && this.value.length > 0) {\n\t\t\t\telement.classList.add(\"no-border\");\n\t\t\t} else if (element.classList.contains(\"today\") && this.value.length === 0) {\n\t\t\t\telement.classList.remove(\"no-border\");\n\t\t\t}\n\t\t});\n\t}\n\n\tprotected updateAttributes() {\n\t\tconst calendarContainer = document.querySelectorAll(\".flatpickr-calendar\");\n\t\tArray.from(calendarContainer).forEach(calendar => {\n\t\t\tcalendar.setAttribute(\"role\", \"application\");\n\t\t\tcalendar.setAttribute(\"aria-label\", this.ariaLabel);\n\t\t});\n\t}\n\n\t/**\n\t * Applies the given date value array to both the flatpickr instance and the `input`(s)\n\t * @param dates the date values to apply\n\t */\n\tprotected setDateValues(dates: (Date | string)[]) {\n\t\tif (this.isFlatpickrLoaded()) {\n\t\t\tconst singleInput = this.elementRef.nativeElement.querySelector(`#${this.id}-input`);\n\t\t\tconst rangeInput = this.elementRef.nativeElement.querySelector(`#${this.id}-rangeInput`);\n\n\t\t\t// `flatpickrInstance.setDate` removes the focus on the selected date element and will\n\t\t\t// automatically change focus to the beginning of the document. If a selected date is\n\t\t\t// focused before `flatpickrInstance.setDate` is invoked then it should remain focused.\n\t\t\tlet shouldRefocusDateElement = this.flatpickrInstance.selectedDateElem === document.activeElement;\n\n\t\t\t// set the date on the instance\n\t\t\tthis.flatpickrInstance.setDate(dates);\n\n\t\t\tif (shouldRefocusDateElement) {\n\t\t\t\tthis.flatpickrInstance.selectedDateElem.focus();\n\t\t\t}\n\n\t\t\t// we can either set a date value or an empty string, so we start with an empty string\n\t\t\tlet singleDate = \"\";\n\t\t\t// if date is a string, parse and format\n\t\t\tif (typeof this.flatpickrInstance.selectedDates[0] === \"string\") {\n\t\t\t\tsingleDate = this.flatpickrInstance.parseDate(this.flatpickrInstance.selectedDates[0], this.dateFormat);\n\t\t\t\tsingleDate = this.flatpickrInstance.formatDate(singleDate, this.dateFormat);\n\t\t\t// if date is not a string we can assume it's a Date and we should format\n\t\t\t} else if (!!this.flatpickrInstance.selectedDates[0]) {\n\t\t\t\tsingleDate = this.flatpickrInstance.formatDate(this.flatpickrInstance.selectedDates[0], this.dateFormat);\n\t\t\t}\n\n\t\t\tif (rangeInput) {\n\t\t\t\t// we can either set a date value or an empty string, so we start with an empty string\n\t\t\t\tlet rangeDate = \"\";\n\t\t\t\t// if date is a string, parse and format\n\t\t\t\tif (typeof this.flatpickrInstance.selectedDates[1] === \"string\") {\n\t\t\t\t\trangeDate = this.flatpickrInstance.parseDate(this.flatpickrInstance.selectedDates[1].toString(), this.dateFormat);\n\t\t\t\t\trangeDate = this.flatpickrInstance.formatDate(rangeDate, this.dateFormat);\n\t\t\t\t// if date is not a string we can assume it's a Date and we should format\n\t\t\t\t} else if (!!this.flatpickrInstance.selectedDates[1]) {\n\t\t\t\t\trangeDate = this.flatpickrInstance.formatDate(this.flatpickrInstance.selectedDates[1], this.dateFormat);\n\t\t\t\t}\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t// apply the values\n\t\t\t\t\trangeInput.value = rangeDate;\n\t\t\t\t\tsingleInput.value = singleDate;\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected preventCalendarClose = event => event.stopPropagation();\n\n\tprotected doSelect(selectedValue: (Date | string)[]) {\n\t\t// In range mode, if a date is selected from the first calendar that is from the previous month,\n\t\t// the month will not be updated on the calendar until the calendar is re-opened.\n\t\t// This will make sure the calendar is updated with the correct month.\n\t\tif (this.range && this.flatpickrInstance.selectedDates[0]) {\n\t\t\tconst currentMonth = this.flatpickrInstance.selectedDates[0].getMonth();\n\n\t\t\t// `flatpickrInstance.changeMonth` removes the focus on the selected date element and will\n\t\t\t// automatically change focus to the beginning of the document. If a selected date is\n\t\t\t// focused before `flatpickrInstance.changeMonth` is invoked then it should remain focused.\n\t\t\tlet shouldRefocusDateElement = this.flatpickrInstance.selectedDateElem === document.activeElement;\n\n\t\t\tthis.flatpickrInstance.changeMonth(currentMonth, false);\n\n\t\t\tif (shouldRefocusDateElement) {\n\t\t\t\tthis.flatpickrInstance.selectedDateElem.focus();\n\t\t\t}\n\n\t\t}\n\t\tthis.valueChange.emit(selectedValue);\n\t\tthis.propagateChange(selectedValue);\n\t}\n\n\tprotected didDateValueChange(currentValue, previousValue) {\n\t\treturn currentValue[0] !== previousValue[0] || currentValue[1] !== previousValue[1];\n\t}\n\n\t/**\n\t * More advanced checking of the loaded state of flatpickr\n\t */\n\tprotected isFlatpickrLoaded() {\n\t\t// cast the instance to a boolean, and some method that has to exist for the library to be loaded in this case `setDate`\n\t\treturn !!this.flatpickrInstance && !!this.flatpickrInstance.setDate;\n\t}\n\n\t/**\n\t * Right arrow HTML passed to flatpickr\n\t */\n\tprotected rightArrowHTML() {\n\t\treturn `\n\t\t\t<svg width=\"16px\" height=\"16px\" viewBox=\"0 0 16 16\">\n\t\t\t\t<polygon points=\"11,8 6,13 5.3,12.3 9.6,8 5.3,3.7 6,3 \"/>\n\t\t\t\t<rect width=\"16\" height=\"16\" style=\"fill:none\" />\n\t\t\t</svg>`;\n\t}\n\n\t/**\n\t * Left arrow HTML passed to flatpickr\n\t */\n\tprotected leftArrowHTML() {\n\t\treturn `\n\t\t\t<svg width=\"16px\" height=\"16px\" viewBox=\"0 0 16 16\">\n\t\t\t\t<polygon points=\"5,8 10,3 10.7,3.7 6.4,8 10.7,12.3 10,13 \"/>\n\t\t\t\t<rect width=\"16\" height=\"16\" style=\"fill:none\" />\n\t\t\t</svg>`;\n\t}\n}\n",
|
|
30582
|
+
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tOutput,\n\tEventEmitter,\n\tViewEncapsulation,\n\tElementRef,\n\tOnDestroy,\n\tHostListener,\n\tTemplateRef,\n\tOnChanges,\n\tSimpleChanges,\n\tAfterViewChecked,\n\tAfterViewInit,\n\tViewChild,\n\tOnInit,\n\tSimpleChange\n} from \"@angular/core\";\nimport rangePlugin from \"flatpickr/dist/plugins/rangePlugin\";\nimport flatpickr from \"flatpickr\";\nimport { NG_VALUE_ACCESSOR } from \"@angular/forms\";\nimport { carbonFlatpickrMonthSelectPlugin } from \"./carbon-flatpickr-month-select\";\nimport * as languages from \"flatpickr/dist/l10n/index\";\nimport { Options } from \"flatpickr/dist/types/options\";\nimport { DatePickerInput } from \"carbon-components-angular/datepicker-input\";\nimport { I18n } from \"carbon-components-angular/i18n\";\n\n/**\n * Due to type error, we have to use square brackets property accessor\n * There is a webpack issue when attempting to access exported languages from flatpickr l10n Angular 14+ apps\n * languages.default[locale] fails in app consuming CCA library but passes in test\n * languages.default.default[locale] fails in test but works in app consuming CCA library.\n *\n * To please both scenarios, we are adding a condition to prevent tests from failing\n */\nif (languages.default?.default[\"en\"]?.weekdays) {\n\t(languages.default.default[\"en\"].weekdays.shorthand as string[]) = languages.default.default[\"en\"].weekdays.longhand.map(day => {\n\t\tif (day === \"Thursday\") {\n\t\t\treturn \"Th\";\n\t\t}\n\t\treturn day.charAt(0);\n\t});\n}\n\n/**\n * Get started with importing the module:\n *\n * ```typescript\n * import { DatePickerModule } from 'carbon-components-angular';\n * ```\n *\n * [See demo](../../?path=/story/components-date-picker--single)\n */\n@Component({\n\tselector: \"cds-date-picker, ibm-date-picker\",\n\ttemplate: `\n\t<div class=\"cds--form-item\">\n\t\t<div\n\t\t\tclass=\"cds--date-picker\"\n\t\t\t[ngClass]=\"{\n\t\t\t\t'cds--date-picker--range' : range,\n\t\t\t\t'cds--date-picker--single' : !range,\n\t\t\t\t'cds--date-picker--light' : theme === 'light',\n\t\t\t\t'cds--skeleton' : skeleton\n\t\t\t}\">\n\t\t\t<div class=\"cds--date-picker-container\">\n\t\t\t\t<cds-date-picker-input\n\t\t\t\t\t#input\n\t\t\t\t\t[label]=\"label\"\n\t\t\t\t\t[placeholder]=\"placeholder\"\n\t\t\t\t\t[pattern]=\"inputPattern\"\n\t\t\t\t\t[id]=\"id + '-input'\"\n\t\t\t\t\t[size]=\"size\"\n\t\t\t\t\t[type]=\"(range ? 'range' : 'single')\"\n\t\t\t\t\t[hasIcon]=\"(range ? false : true)\"\n\t\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t\t[readonly]=\"readonly\"\n\t\t\t\t\t[invalid]=\"invalid\"\n\t\t\t\t\t[invalidText]=\"invalidText\"\n\t\t\t\t\t[warn]=\"warn\"\n\t\t\t\t\t[warnText]=\"warnText\"\n\t\t\t\t\t[skeleton]=\"skeleton\"\n\t\t\t\t\t[helperText]=\"helperText\"\n\t\t\t\t\t[decorator]=\"decorator\"\n\t\t\t\t\t(valueChange)=\"onValueChange($event)\"\n\t\t\t\t\t(click)=\"openCalendar(input, $event)\">\n\t\t\t\t</cds-date-picker-input>\n\t\t\t</div>\n\n\t\t\t<div *ngIf=\"range\" class=\"cds--date-picker-container\">\n\t\t\t\t<cds-date-picker-input\n\t\t\t\t\t#rangeInput\n\t\t\t\t\t[label]=\"rangeLabel\"\n\t\t\t\t\t[placeholder]=\"placeholder\"\n\t\t\t\t\t[pattern]=\"inputPattern\"\n\t\t\t\t\t[id]=\"id + '-rangeInput'\"\n\t\t\t\t\t[size]=\"size\"\n\t\t\t\t\t[type]=\"(range ? 'range' : 'single')\"\n\t\t\t\t\t[hasIcon]=\"(range ? true : null)\"\n\t\t\t\t\t[disabled]=\"disabled\"\n\t\t\t\t\t[readonly]=\"readonly\"\n\t\t\t\t\t[invalid]=\"rangeInvalid\"\n\t\t\t\t\t[invalidText]=\"rangeInvalidText\"\n\t\t\t\t\t[warn]=\"rangeWarn\"\n\t\t\t\t\t[warnText]=\"rangeWarnText\"\n\t\t\t\t\t[skeleton]=\"skeleton\"\n\t\t\t\t\t[helperText]=\"rangeHelperText\"\n\t\t\t\t\t[decorator]=\"rangeDecorator\"\n\t\t\t\t\t(valueChange)=\"onRangeValueChange($event)\"\n\t\t\t\t\t(click)=\"openCalendar(rangeInput, $event)\">\n\t\t\t\t</cds-date-picker-input>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n\t`,\n\tproviders: [\n\t\t{\n\t\t\tprovide: NG_VALUE_ACCESSOR,\n\t\t\tuseExisting: DatePicker,\n\t\t\tmulti: true\n\t\t}\n\t],\n\tencapsulation: ViewEncapsulation.None\n})\nexport class DatePicker implements\n\tOnInit,\n\tOnDestroy,\n\tOnChanges,\n\tAfterViewChecked,\n\tAfterViewInit {\n\tprivate static datePickerCount = 0;\n\n\t/**\n\t * Select calendar range mode\n\t */\n\t@Input() range = false;\n\n\t/**\n\t * Format of date\n\t *\n\t * For reference: https://flatpickr.js.org/formatting/\n\t */\n\t@Input() dateFormat = \"m/d/Y\";\n\n\t/**\n\t * Language of the flatpickr calendar.\n\t *\n\t * For reference of the possible locales:\n\t * https://github.com/flatpickr/flatpickr/blob/master/src/l10n/index.ts\n\t */\n\t@Input() language = \"en\";\n\n\t@Input() label: string | TemplateRef<any>;\n\t@Input() helperText: string | TemplateRef<any>;\n\t/**\n\t * **Experimental**: Optional decorator (e.g. AI label).\n\t */\n\t@Input() decorator: TemplateRef<any>;\n\t/**\n\t * **Experimental**: Optional decorator (e.g. AI label) on the range end field when `range` is `true`.\n\t */\n\t@Input() rangeDecorator: TemplateRef<any>;\n\t@Input() rangeHelperText: string | TemplateRef<any>;\n\t@Input() rangeLabel: string;\n\n\t@Input() placeholder = \"mm/dd/yyyy\";\n\n\t/**\n\t * Aria label added to datepicker's calendar container.\n\t */\n\t@Input() ariaLabel = \"calendar container\";\n\n\t/**\n\t * The pattern for the underlying input element\n\t */\n\t@Input() inputPattern = \"^\\\\d{1,2}/\\\\d{1,2}/\\\\d{4}$\";\n\n\t@Input() id = `datepicker-${DatePicker.datePickerCount++}`;\n\n\t@Input() set value(v: (Date | string)[]) {\n\t\tif (!v) {\n\t\t\tv = [];\n\t\t}\n\t\tthis._value = v;\n\t}\n\n\tget value() {\n\t\treturn this._value;\n\t}\n\n\t/**\n\t * @deprecated since v5 - Use `cdsLayer` directive instead\n\t * Set to `\"light\"` to apply the light style\n\t */\n\t@Input() theme: \"light\" | \"dark\" = \"dark\";\n\n\t@Input() disabled = false;\n\n\t@Input() readonly = false;\n\t/**\n\t * Set to `true` to display the invalid state.\n\t */\n\t@Input() invalid = false;\n\t/**\n\t * Value displayed if datepicker is in an invalid state.\n\t */\n\t@Input() invalidText: string | TemplateRef<any>;\n\t/**\n\t * Set to `true` to show a warning (contents set by warningText)\n\t */\n\t@Input() warn = false;\n\t/**\n\t * Sets the warning text\n\t */\n\t@Input() warnText: string | TemplateRef<any>;\n\n\t@Input() size: \"sm\" | \"md\" | \"lg\" = \"md\";\n\t/**\n\t * Set to `true` to display the invalid state for the second datepicker input.\n\t */\n\t@Input() rangeInvalid = false;\n\t/**\n\t * Value displayed if the second datepicker input is in an invalid state.\n\t */\n\t@Input() rangeInvalidText: string | TemplateRef<any>;\n\t/**\n\t * Set to `true` to show a warning in the second datepicker input (contents set by rangeWarningText)\n\t */\n\t@Input() rangeWarn = false;\n\t/**\n\t * Sets the warning text for the second datepicker input\n\t */\n\t@Input() rangeWarnText: string | TemplateRef<any>;\n\n\t@Input() skeleton = false;\n\n\t@Input() plugins = [];\n\n\t@Input()\n\tset flatpickrOptions(options: Partial<Options>) {\n\t\tthis._flatpickrOptions = Object.assign({}, this._flatpickrOptions, options);\n\t}\n\tget flatpickrOptions(): Partial<Options> {\n\t\tconst plugins = [...this.plugins, carbonFlatpickrMonthSelectPlugin];\n\t\tif (this.range) {\n\t\t\tplugins.push(rangePlugin({ input: `#${this.id}-rangeInput`, position: \"left\" }));\n\t\t}\n\t\treturn Object.assign({}, this._flatpickrOptions, this.flatpickrBaseOptions, {\n\t\t\tmode: this.range ? \"range\" : \"single\",\n\t\t\tplugins,\n\t\t\tdateFormat: this.dateFormat,\n\t\t\tlocale: languages.default?.default[this.language] || languages.default[this.language],\n\t\t\t// Little trick force \"readonly mode\" on datepicker input.\n\t\t\t// Docs: Whether clicking on the input should open the picker.\n\t\t\t// You could disable this if you wish to open the calendar manually with.open().\n\t\t\tclickOpens: !this.readonly\n\t\t});\n\t}\n\n\t@ViewChild(\"input\", { static: true }) input: DatePickerInput;\n\t@ViewChild(\"rangeInput\") rangeInput: DatePickerInput;\n\n\t@Output() valueChange: EventEmitter<any> = new EventEmitter();\n\n\t/**\n\t * We are overriding onClose event even if users pass it via flatpickr options\n\t * Emits an event when date picker closes\n\t */\n\t@Output() onClose: EventEmitter<any> = new EventEmitter();\n\n\tprotected _value = [];\n\n\tprotected _flatpickrOptions: Partial<Options> = {\n\t\tallowInput: true\n\t};\n\n\tprotected flatpickrBaseOptions = {\n\t\tmode: \"single\",\n\t\tdateFormat: \"m/d/Y\",\n\t\tplugins: this.plugins,\n\t\tonOpen: () => {\n\t\t\tthis.updateClassNames();\n\t\t\tthis.updateAttributes();\n\t\t\tthis.updateCalendarListeners();\n\t\t},\n\t\tonClose: (date) => {\n\t\t\t// This makes sure that the `flatpickrInstance selectedDates` are in sync with the values of\n\t\t\t// the inputs when the calendar closes.\n\t\t\tif (this.range && this.flatpickrInstance) {\n\t\t\t\tconst inputValue = this.input.input.nativeElement.value;\n\t\t\t\tconst rangeInputValue = this.rangeInput.input.nativeElement.value;\n\t\t\t\tif (inputValue || rangeInputValue) {\n\t\t\t\t\tconst parseDate = (date: string) => this.flatpickrInstance.parseDate(date, this.dateFormat);\n\t\t\t\t\tthis.setDateValues([parseDate(inputValue), parseDate(rangeInputValue || inputValue)]);\n\t\t\t\t\tthis.doSelect(this.flatpickrInstance.selectedDates);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.onClose.emit(date);\n\t\t},\n\t\tonDayCreate: (_dObj, _dStr, _fp, dayElem) => {\n\t\t\tdayElem.classList.add(\"cds--date-picker__day\");\n\t\t},\n\t\tnextArrow: this.rightArrowHTML(),\n\t\tprevArrow: this.leftArrowHTML(),\n\t\tvalue: this.value\n\t};\n\n\tprotected flatpickrInstance = null;\n\n\tconstructor(\n\t\tprotected elementRef: ElementRef,\n\t\tprotected i18n: I18n\n\t) { }\n\n\tngOnInit() {\n\t\t// if i18n is set to anything other than en we'll want to change the language\n\t\t// otherwise we'll just use the local setting\n\t\tif (this.i18n.getLocale() !== \"en\") {\n\t\t\tthis.i18n.getLocaleObservable().subscribe(locale => {\n\t\t\t\tthis.language = locale;\n\t\t\t\tthis.resetFlatpickrInstance();\n\t\t\t});\n\t\t}\n\t}\n\n\tngOnChanges(changes: SimpleChanges) {\n\t\t// Reset the flatpickr instance on input changes that affect flatpickr.\n\t\tconst flatpickrChangeKeys = [\n\t\t\t\"range\",\n\t\t\t\"dateFormat\",\n\t\t\t\"language\",\n\t\t\t\"id\",\n\t\t\t\"value\",\n\t\t\t\"plugins\",\n\t\t\t\"flatpickrOptions\",\n\t\t\t\"readonly\"\n\t\t];\n\t\tconst changeKeys = Object.keys(changes);\n\t\tif (changeKeys.some(key => flatpickrChangeKeys.includes(key))) {\n\t\t\tthis.resetFlatpickrInstance(changes.value);\n\t\t}\n\t}\n\n\tngAfterViewInit() {\n\t\tif (!this.skeleton) {\n\t\t\tthis.input.input.nativeElement.value = this._value[0] ?? \"\";\n\t\t\tif (this.range) {\n\t\t\t\tthis.rangeInput.input.nativeElement.value = this._value[1] ?? \"\";\n\t\t\t}\n\t\t}\n\t\tsetTimeout(() => {\n\t\t\tthis.addInputListeners();\n\t\t}, 0);\n\t}\n\n\t// because the actual view may be delayed in loading (think projection into a tab pane)\n\t// and because we rely on a library that operates outside the Angular view of the world\n\t// we need to keep trying to load the library, until the relevant DOM is actually live\n\tngAfterViewChecked() {\n\t\tif (!this.isFlatpickrLoaded()) {\n\t\t\t// @ts-ignore ts is unhappy with the below call to `flatpickr`\n\t\t\tthis.flatpickrInstance = flatpickr(`#${this.id}-input`, this.flatpickrOptions);\n\t\t\t// if (and only if) the initialization succeeded, we can set the date values\n\t\t\tif (this.isFlatpickrLoaded()) {\n\t\t\t\tif (this.value.length > 0) {\n\t\t\t\t\tthis.setDateValues(this.value);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t@HostListener(\"focusin\")\n\tonFocus() {\n\t\t// Updates the month manually when calendar mode is range because month\n\t\t// will not update properly without manually updating them on focus.\n\t\tif (this.range) {\n\t\t\tif (this.rangeInput.input.nativeElement === document.activeElement && this.flatpickrInstance.selectedDates[1]) {\n\t\t\t\tconst currentMonth = this.flatpickrInstance.selectedDates[1].getMonth();\n\t\t\t\tthis.flatpickrInstance.changeMonth(currentMonth, false);\n\t\t\t} else if (this.input.input.nativeElement === document.activeElement && this.flatpickrInstance.selectedDates[0]) {\n\t\t\t\tconst currentMonth = this.flatpickrInstance.selectedDates[0].getMonth();\n\t\t\t\tthis.flatpickrInstance.changeMonth(currentMonth, false);\n\t\t\t}\n\t\t}\n\t}\n\n\t@HostListener(\"focusout\")\n\tonFocusOut() {\n\t\tthis.onTouched();\n\t}\n\n\t/**\n\t * Writes a value from the model to the component. Expects the value to be `null` or `(Date | string)[]`\n\t * @param value value received from the model\n\t */\n\twriteValue(value: (Date | string)[]) {\n\t\tthis.value = value;\n\t\tsetTimeout(() => {\n\t\t\tif (this.isFlatpickrLoaded() && this.flatpickrInstance.config) {\n\t\t\t\tthis.setDateValues(this.value);\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * `ControlValueAccessor` method to programmatically disable the DatePicker.\n\t *\n\t * ex: `this.formGroup.get(\"myDatePicker\").disable();`\n\t *\n\t * @param isDisabled `true` to disable the DatePicker\n\t */\n\tsetDisabledState(isDisabled: boolean) {\n\t\tthis.disabled = isDisabled;\n\t}\n\n\tregisterOnChange(fn: any) {\n\t\tthis.propagateChange = fn;\n\t}\n\n\tregisterOnTouched(fn: any) {\n\t\tthis.onTouched = fn;\n\t}\n\n\tonTouched: () => any = () => { };\n\n\tpropagateChange = (_: any) => { };\n\n\t/**\n\t * Cleans up our flatpickr instance\n\t */\n\tngOnDestroy() {\n\t\tif (!this.isFlatpickrLoaded()) { return; }\n\t\tthis.flatpickrInstance.destroy();\n\t}\n\n\t/**\n\t * Handles the `valueChange` event from the primary/single input\n\t */\n\tonValueChange(event: string) {\n\t\tif (this.isFlatpickrLoaded()) {\n\t\t\tconst date = this.flatpickrInstance.parseDate(event, this.dateFormat);\n\t\t\tif (this.range) {\n\t\t\t\tthis.setDateValues([date, this.flatpickrInstance.selectedDates[1]]);\n\t\t\t} else {\n\t\t\t\tthis.setDateValues([date]);\n\t\t\t}\n\t\t\tthis.doSelect(this.flatpickrInstance.selectedDates);\n\t\t}\n\t}\n\n\t/**\n\t * Handles the `valueChange` event from the range input\n\t */\n\tonRangeValueChange(event: string) {\n\t\tif (this.isFlatpickrLoaded() && this.flatpickrInstance.isOpen) {\n\t\t\tconst date = this.flatpickrInstance.parseDate(event, this.dateFormat);\n\t\t\tthis.setDateValues([this.flatpickrInstance.selectedDates[0], date]);\n\t\t\tthis.doSelect(this.flatpickrInstance.selectedDates);\n\t\t}\n\t}\n\n\t/**\n\t * Opens the calendar \"properly\" when the calendar if it was already open.\n\t */\n\topenCalendar(datepickerInput: DatePickerInput, event?: Event) {\n\t\tif (this.readonly || this.skeleton) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Skips opening when the click is on the decorator region so the AI label triggers\n\t\tif (this.isDecoratorClick(event)) {\n\t\t\tif (this.isFlatpickrLoaded() && this.flatpickrInstance.isOpen) {\n\t\t\t\tthis.flatpickrInstance.close();\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.range) {\n\t\t\tdatepickerInput.input.nativeElement.click();\n\n\t\t\t// If the first input's calendar icon is clicked when calendar is in range mode, then\n\t\t\t// the month and year needs to be manually changed to the current selected month and\n\t\t\t// year otherwise the calendar view will not be updated upon opening.\n\t\t\tif (datepickerInput === this.input && this.flatpickrInstance.selectedDates[0]) {\n\t\t\t\tconst currentMonth = this.flatpickrInstance.selectedDates[0].getMonth();\n\n\t\t\t\tthis.flatpickrInstance.currentYear = this.flatpickrInstance.selectedDates[0].getFullYear();\n\t\t\t\tthis.flatpickrInstance.changeMonth(currentMonth, false);\n\t\t\t}\n\t\t} else {\n\t\t\t// Single-mode flatpickr handles mousedown but not click, so nativeElement.click() won't\n\t\t\t// work when the calendar icon is clicked. In this case we simply use flatpickr.open().\n\t\t\tthis.flatpickrInstance.open();\n\t\t}\n\t}\n\n\tprotected updateCalendarListeners() {\n\t\tconst calendarContainer = document.querySelectorAll(\".flatpickr-calendar\");\n\t\tArray.from(calendarContainer).forEach(calendar => {\n\t\t\tcalendar.removeEventListener(\"click\", this.preventCalendarClose);\n\t\t\tcalendar.addEventListener(\"click\", this.preventCalendarClose);\n\t\t});\n\t}\n\n\t/**\n\t * Handles the initialization of event listeners for the datepicker input and range input fields.\n\t */\n\tprotected addInputListeners() {\n\t\tif (!this.isFlatpickrLoaded()) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Allows focus transition from the datepicker input or range input field to\n\t\t// flatpickr calendar using a keyboard.\n\t\tconst addFocusCalendarListener = (element: HTMLInputElement) => {\n\t\t\telement.addEventListener(\"keydown\", (event: KeyboardEvent) => {\n\t\t\t\t// Listeners are added just once, so a check is needed here.\n\t\t\t\tif (this.readonly) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (event.key === \"Escape\") {\n\t\t\t\t\tthis.flatpickrInstance.close();\n\t\t\t\t}\n\t\t\t\tif (event.key === \"ArrowDown\") {\n\t\t\t\t\tif (!this.flatpickrInstance.isOpen) {\n\t\t\t\t\t\tthis.flatpickrInstance.open();\n\t\t\t\t\t}\n\n\t\t\t\t\tconst calendarContainer = this.flatpickrInstance.calendarContainer;\n\t\t\t\t\tconst dayElement = calendarContainer && calendarContainer.querySelector(\".flatpickr-day[tabindex]\");\n\t\t\t\t\tconst selectedDateElem = calendarContainer && calendarContainer.querySelector(\".selected\");\n\t\t\t\t\tconst todayDateElem = calendarContainer && calendarContainer.querySelector(\".today\");\n\n\t\t\t\t\tif (dayElement) {\n\t\t\t\t\t\t(todayDateElem || selectedDateElem || dayElement).focus();\n\n\t\t\t\t\t\t// If the user manually inputs a value into the date field and presses arrow down,\n\t\t\t\t\t\t// datepicker input onchange will be triggered when focus is removed from it and\n\t\t\t\t\t\t// `flatpickrInstance.setDate` and `flatpickrInstance.changeMonth` will be invoked\n\t\t\t\t\t\t// which will automatically change focus to the beginning of the document.\n\t\t\t\t\t\tif (document.activeElement !== dayElement && this.flatpickrInstance.selectedDateElem) {\n\t\t\t\t\t\t\tthis.flatpickrInstance.selectedDateElem.focus();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t};\n\n\t\tif (this.input && this.input.input) {\n\t\t\taddFocusCalendarListener(this.input.input.nativeElement);\n\t\t}\n\n\t\tif (this.rangeInput && this.rangeInput.input) {\n\t\t\taddFocusCalendarListener(this.rangeInput.input.nativeElement);\n\t\t}\n\t}\n\n\t/**\n\t * Resets the flatpickr instance while keeping the date values (or updating them if newDates is provided)\n\t *\n\t * Used to pick up input changes or locale changes.\n\t *\n\t * @param newDates An optional SimpleChange of date values\n\t */\n\tprotected resetFlatpickrInstance(newDates?: SimpleChange) {\n\t\tif (this.isFlatpickrLoaded()) {\n\t\t\tlet dates = this.flatpickrInstance.selectedDates;\n\t\t\tif (newDates && this.didDateValueChange(newDates.currentValue, newDates.previousValue)) {\n\t\t\t\tdates = newDates.currentValue;\n\t\t\t}\n\t\t\t// only reset the flatpickr instance on Input changes\n\t\t\t// @ts-ignore ts is unhappy with the below call to `flatpickr`\n\t\t\tthis.flatpickrInstance = flatpickr(`#${this.id}-input`, this.flatpickrOptions);\n\t\t\tthis.setDateValues(dates);\n\t\t}\n\t}\n\n\t/**\n\t * Carbon uses a number of specific classnames for parts of the flatpickr - this idempotent method applies them if needed.\n\t */\n\tprotected updateClassNames() {\n\t\tif (!this.elementRef) { return; }\n\t\t// get all the possible flatpickrs in the document - we need to add classes to (potentially) all of them\n\t\tconst calendarContainer = document.querySelectorAll(\".flatpickr-calendar\");\n\t\tconst monthContainer = document.querySelectorAll(\".flatpickr-month\");\n\t\tconst weekdaysContainer = document.querySelectorAll(\".flatpickr-weekdays\");\n\t\tconst weekdayContainer = document.querySelectorAll(\".flatpickr-weekday\");\n\t\tconst daysContainer = document.querySelectorAll(\".flatpickr-days\");\n\t\tconst dayContainer = document.querySelectorAll(\".flatpickr-day\");\n\n\t\t// add classes to lists of elements\n\t\tconst addClassIfNotExists = (classname: string, elementList: NodeListOf<Element>) => {\n\t\t\tArray.from(elementList).forEach(element => {\n\t\t\t\tif (!element.classList.contains(classname)) {\n\t\t\t\t\telement.classList.add(classname);\n\t\t\t\t}\n\t\t\t});\n\t\t};\n\n\t\t// add classes (but only if they don't exist, small perf win)\n\t\taddClassIfNotExists(\"cds--date-picker__calendar\", calendarContainer);\n\t\taddClassIfNotExists(\"cds--date-picker__month\", monthContainer);\n\t\taddClassIfNotExists(\"cds--date-picker__weekdays\", weekdaysContainer);\n\t\taddClassIfNotExists(\"cds--date-picker__days\", daysContainer);\n\n\t\t// add weekday classes and format the text\n\t\tArray.from(weekdayContainer).forEach(element => {\n\t\t\telement.innerHTML = element.innerHTML.replace(/\\s+/g, \"\");\n\t\t\telement.classList.add(\"cds--date-picker__weekday\");\n\t\t});\n\n\t\t// add day classes and special case the \"today\" element based on `this.value`\n\t\tArray.from(dayContainer).forEach(element => {\n\t\t\telement.setAttribute(\"role\", \"button\");\n\t\t\telement.classList.add(\"cds--date-picker__day\");\n\t\t\tif (!this.value) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (element.classList.contains(\"today\") && this.value.length > 0) {\n\t\t\t\telement.classList.add(\"no-border\");\n\t\t\t} else if (element.classList.contains(\"today\") && this.value.length === 0) {\n\t\t\t\telement.classList.remove(\"no-border\");\n\t\t\t}\n\t\t});\n\t}\n\n\tprotected updateAttributes() {\n\t\tconst calendarContainer = document.querySelectorAll(\".flatpickr-calendar\");\n\t\tArray.from(calendarContainer).forEach(calendar => {\n\t\t\tcalendar.setAttribute(\"role\", \"application\");\n\t\t\tcalendar.setAttribute(\"aria-label\", this.ariaLabel);\n\t\t});\n\t}\n\n\t/**\n\t * Applies the given date value array to both the flatpickr instance and the `input`(s)\n\t * @param dates the date values to apply\n\t */\n\tprotected setDateValues(dates: (Date | string)[]) {\n\t\tif (this.isFlatpickrLoaded()) {\n\t\t\tconst singleInput = this.elementRef.nativeElement.querySelector(`#${this.id}-input`);\n\t\t\tconst rangeInput = this.elementRef.nativeElement.querySelector(`#${this.id}-rangeInput`);\n\n\t\t\t// `flatpickrInstance.setDate` removes the focus on the selected date element and will\n\t\t\t// automatically change focus to the beginning of the document. If a selected date is\n\t\t\t// focused before `flatpickrInstance.setDate` is invoked then it should remain focused.\n\t\t\tlet shouldRefocusDateElement = this.flatpickrInstance.selectedDateElem === document.activeElement;\n\n\t\t\t// set the date on the instance\n\t\t\tthis.flatpickrInstance.setDate(dates);\n\n\t\t\tif (shouldRefocusDateElement) {\n\t\t\t\tthis.flatpickrInstance.selectedDateElem.focus();\n\t\t\t}\n\n\t\t\t// we can either set a date value or an empty string, so we start with an empty string\n\t\t\tlet singleDate = \"\";\n\t\t\t// if date is a string, parse and format\n\t\t\tif (typeof this.flatpickrInstance.selectedDates[0] === \"string\") {\n\t\t\t\tsingleDate = this.flatpickrInstance.parseDate(this.flatpickrInstance.selectedDates[0], this.dateFormat);\n\t\t\t\tsingleDate = this.flatpickrInstance.formatDate(singleDate, this.dateFormat);\n\t\t\t// if date is not a string we can assume it's a Date and we should format\n\t\t\t} else if (!!this.flatpickrInstance.selectedDates[0]) {\n\t\t\t\tsingleDate = this.flatpickrInstance.formatDate(this.flatpickrInstance.selectedDates[0], this.dateFormat);\n\t\t\t}\n\n\t\t\tif (rangeInput) {\n\t\t\t\t// we can either set a date value or an empty string, so we start with an empty string\n\t\t\t\tlet rangeDate = \"\";\n\t\t\t\t// if date is a string, parse and format\n\t\t\t\tif (typeof this.flatpickrInstance.selectedDates[1] === \"string\") {\n\t\t\t\t\trangeDate = this.flatpickrInstance.parseDate(this.flatpickrInstance.selectedDates[1].toString(), this.dateFormat);\n\t\t\t\t\trangeDate = this.flatpickrInstance.formatDate(rangeDate, this.dateFormat);\n\t\t\t\t// if date is not a string we can assume it's a Date and we should format\n\t\t\t\t} else if (!!this.flatpickrInstance.selectedDates[1]) {\n\t\t\t\t\trangeDate = this.flatpickrInstance.formatDate(this.flatpickrInstance.selectedDates[1], this.dateFormat);\n\t\t\t\t}\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t// apply the values\n\t\t\t\t\trangeInput.value = rangeDate;\n\t\t\t\t\tsingleInput.value = singleDate;\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected preventCalendarClose = event => event.stopPropagation();\n\n\tprotected doSelect(selectedValue: (Date | string)[]) {\n\t\t// In range mode, if a date is selected from the first calendar that is from the previous month,\n\t\t// the month will not be updated on the calendar until the calendar is re-opened.\n\t\t// This will make sure the calendar is updated with the correct month.\n\t\tif (this.range && this.flatpickrInstance.selectedDates[0]) {\n\t\t\tconst currentMonth = this.flatpickrInstance.selectedDates[0].getMonth();\n\n\t\t\t// `flatpickrInstance.changeMonth` removes the focus on the selected date element and will\n\t\t\t// automatically change focus to the beginning of the document. If a selected date is\n\t\t\t// focused before `flatpickrInstance.changeMonth` is invoked then it should remain focused.\n\t\t\tlet shouldRefocusDateElement = this.flatpickrInstance.selectedDateElem === document.activeElement;\n\n\t\t\tthis.flatpickrInstance.changeMonth(currentMonth, false);\n\n\t\t\tif (shouldRefocusDateElement) {\n\t\t\t\tthis.flatpickrInstance.selectedDateElem.focus();\n\t\t\t}\n\n\t\t}\n\t\tthis.valueChange.emit(selectedValue);\n\t\tthis.propagateChange(selectedValue);\n\t}\n\n\tprotected didDateValueChange(currentValue, previousValue) {\n\t\treturn currentValue[0] !== previousValue[0] || currentValue[1] !== previousValue[1];\n\t}\n\n\t/**\n\t * More advanced checking of the loaded state of flatpickr\n\t */\n\tprotected isFlatpickrLoaded() {\n\t\t// cast the instance to a boolean, and some method that has to exist for the library to be loaded in this case `setDate`\n\t\treturn !!this.flatpickrInstance && !!this.flatpickrInstance.setDate;\n\t}\n\n\t/**\n\t * Right arrow HTML passed to flatpickr\n\t */\n\tprotected rightArrowHTML() {\n\t\treturn `\n\t\t\t<svg width=\"16px\" height=\"16px\" viewBox=\"0 0 16 16\">\n\t\t\t\t<polygon points=\"11,8 6,13 5.3,12.3 9.6,8 5.3,3.7 6,3 \"/>\n\t\t\t\t<rect width=\"16\" height=\"16\" style=\"fill:none\" />\n\t\t\t</svg>`;\n\t}\n\n\t/**\n\t * Left arrow HTML passed to flatpickr\n\t */\n\tprotected leftArrowHTML() {\n\t\treturn `\n\t\t\t<svg width=\"16px\" height=\"16px\" viewBox=\"0 0 16 16\">\n\t\t\t\t<polygon points=\"5,8 10,3 10.7,3.7 6.4,8 10.7,12.3 10,13 \"/>\n\t\t\t\t<rect width=\"16\" height=\"16\" style=\"fill:none\" />\n\t\t\t</svg>`;\n\t}\n\n\tprivate isDecoratorClick(event: Event | undefined): boolean {\n\t\tif (!event?.target) {\n\t\t\treturn false;\n\t\t}\n\t\tconst t = event.target;\n\t\tconst el = t instanceof Element ? t : (t as Node).parentElement;\n\t\treturn el?.closest(\".cds--date-picker-input-inner-wrapper--decorator\") != null;\n\t}\n}\n",
|
|
30910
30583
|
"assetsDirs": [],
|
|
30911
30584
|
"styleUrlsData": "",
|
|
30912
30585
|
"stylesData": "",
|
|
@@ -32255,7 +31928,7 @@
|
|
|
32255
31928
|
},
|
|
32256
31929
|
{
|
|
32257
31930
|
"name": "Dropdown",
|
|
32258
|
-
"id": "component-Dropdown-
|
|
31931
|
+
"id": "component-Dropdown-6b9e2cdd9844cc409f8d3c73a2ead60c179267581b4417fe63c25f9f8eb69066569e9fed868dfb2e09f719807b92fd01313b7705917c25178e12a3de30f1816a",
|
|
32259
31932
|
"file": "src/dropdown/dropdown.component.ts",
|
|
32260
31933
|
"encapsulation": [],
|
|
32261
31934
|
"entryComponents": [],
|
|
@@ -32281,7 +31954,7 @@
|
|
|
32281
31954
|
"deprecationMessage": "",
|
|
32282
31955
|
"rawdescription": "\n\nSet to `true` to allow null values in the dropdown ListItems.\n",
|
|
32283
31956
|
"description": "<p>Set to <code>true</code> to allow null values in the dropdown ListItems.</p>\n",
|
|
32284
|
-
"line":
|
|
31957
|
+
"line": 336,
|
|
32285
31958
|
"type": "boolean",
|
|
32286
31959
|
"decorators": []
|
|
32287
31960
|
},
|
|
@@ -32292,7 +31965,7 @@
|
|
|
32292
31965
|
"deprecationMessage": "",
|
|
32293
31966
|
"rawdescription": "\n\nset to `true` to place the dropdown view inline with the component\n",
|
|
32294
31967
|
"description": "<p>set to <code>true</code> to place the dropdown view inline with the component</p>\n",
|
|
32295
|
-
"line":
|
|
31968
|
+
"line": 302,
|
|
32296
31969
|
"type": "boolean",
|
|
32297
31970
|
"decorators": []
|
|
32298
31971
|
},
|
|
@@ -32303,7 +31976,7 @@
|
|
|
32303
31976
|
"deprecationMessage": "",
|
|
32304
31977
|
"rawdescription": "\n\nSets the optional clear button tooltip text.\n",
|
|
32305
31978
|
"description": "<p>Sets the optional clear button tooltip text.</p>\n",
|
|
32306
|
-
"line":
|
|
31979
|
+
"line": 248,
|
|
32307
31980
|
"type": "string",
|
|
32308
31981
|
"decorators": []
|
|
32309
31982
|
},
|
|
@@ -32313,7 +31986,7 @@
|
|
|
32313
31986
|
"deprecationMessage": "",
|
|
32314
31987
|
"rawdescription": "\n\n**Experimental**: Optional decorator (e.g. AI label).\n",
|
|
32315
31988
|
"description": "<p><strong>Experimental</strong>: Optional decorator (e.g. AI label).</p>\n",
|
|
32316
|
-
"line":
|
|
31989
|
+
"line": 236,
|
|
32317
31990
|
"type": "TemplateRef<any>",
|
|
32318
31991
|
"decorators": []
|
|
32319
31992
|
},
|
|
@@ -32324,7 +31997,7 @@
|
|
|
32324
31997
|
"deprecationMessage": "",
|
|
32325
31998
|
"rawdescription": "\n\nSet to `true` for a dropdown without arrow key activation.\n",
|
|
32326
31999
|
"description": "<p>Set to <code>true</code> for a dropdown without arrow key activation.</p>\n",
|
|
32327
|
-
"line":
|
|
32000
|
+
"line": 282,
|
|
32328
32001
|
"type": "boolean",
|
|
32329
32002
|
"decorators": []
|
|
32330
32003
|
},
|
|
@@ -32335,7 +32008,7 @@
|
|
|
32335
32008
|
"deprecationMessage": "",
|
|
32336
32009
|
"rawdescription": "\n\nSet to `true` to disable the dropdown.\n",
|
|
32337
32010
|
"description": "<p>Set to <code>true</code> to disable the dropdown.</p>\n",
|
|
32338
|
-
"line":
|
|
32011
|
+
"line": 266,
|
|
32339
32012
|
"type": "boolean",
|
|
32340
32013
|
"decorators": []
|
|
32341
32014
|
},
|
|
@@ -32346,7 +32019,7 @@
|
|
|
32346
32019
|
"deprecationMessage": "",
|
|
32347
32020
|
"rawdescription": "\n\nThe selected value from the `Dropdown`. Can be a string or template.\n",
|
|
32348
32021
|
"description": "<p>The selected value from the <code>Dropdown</code>. Can be a string or template.</p>\n",
|
|
32349
|
-
"line":
|
|
32022
|
+
"line": 244,
|
|
32350
32023
|
"type": "string | TemplateRef<any>",
|
|
32351
32024
|
"decorators": []
|
|
32352
32025
|
},
|
|
@@ -32356,7 +32029,7 @@
|
|
|
32356
32029
|
"deprecationMessage": "",
|
|
32357
32030
|
"rawdescription": "\n\nOverrides the automatic dropUp.\n",
|
|
32358
32031
|
"description": "<p>Overrides the automatic dropUp.</p>\n",
|
|
32359
|
-
"line":
|
|
32032
|
+
"line": 332,
|
|
32360
32033
|
"type": "boolean",
|
|
32361
32034
|
"decorators": []
|
|
32362
32035
|
},
|
|
@@ -32367,7 +32040,7 @@
|
|
|
32367
32040
|
"deprecationMessage": "",
|
|
32368
32041
|
"rawdescription": "\n\nExperimental: enable fluid state\n",
|
|
32369
32042
|
"description": "<p>Experimental: enable fluid state</p>\n",
|
|
32370
|
-
"line":
|
|
32043
|
+
"line": 370,
|
|
32371
32044
|
"type": "boolean",
|
|
32372
32045
|
"decorators": []
|
|
32373
32046
|
},
|
|
@@ -32377,7 +32050,7 @@
|
|
|
32377
32050
|
"deprecationMessage": "",
|
|
32378
32051
|
"rawdescription": "\n\nSets the optional helper text.\n",
|
|
32379
32052
|
"description": "<p>Sets the optional helper text.</p>\n",
|
|
32380
|
-
"line":
|
|
32053
|
+
"line": 232,
|
|
32381
32054
|
"type": "string | TemplateRef<any>",
|
|
32382
32055
|
"decorators": []
|
|
32383
32056
|
},
|
|
@@ -32388,7 +32061,7 @@
|
|
|
32388
32061
|
"deprecationMessage": "",
|
|
32389
32062
|
"rawdescription": "\n\nHide label while keeping it accessible for screen readers\n",
|
|
32390
32063
|
"description": "<p>Hide label while keeping it accessible for screen readers</p>\n",
|
|
32391
|
-
"line":
|
|
32064
|
+
"line": 228,
|
|
32392
32065
|
"type": "boolean",
|
|
32393
32066
|
"decorators": []
|
|
32394
32067
|
},
|
|
@@ -32397,7 +32070,7 @@
|
|
|
32397
32070
|
"defaultValue": "`dropdown-${Dropdown.dropdownCount++}`",
|
|
32398
32071
|
"deprecated": false,
|
|
32399
32072
|
"deprecationMessage": "",
|
|
32400
|
-
"line":
|
|
32073
|
+
"line": 220,
|
|
32401
32074
|
"type": "string",
|
|
32402
32075
|
"decorators": []
|
|
32403
32076
|
},
|
|
@@ -32408,7 +32081,7 @@
|
|
|
32408
32081
|
"deprecationMessage": "",
|
|
32409
32082
|
"rawdescription": "\n\nSet to `true` for an inline dropdown.\n",
|
|
32410
32083
|
"description": "<p>Set to <code>true</code> for an inline dropdown.</p>\n",
|
|
32411
|
-
"line":
|
|
32084
|
+
"line": 278,
|
|
32412
32085
|
"type": "boolean",
|
|
32413
32086
|
"decorators": []
|
|
32414
32087
|
},
|
|
@@ -32419,7 +32092,7 @@
|
|
|
32419
32092
|
"deprecationMessage": "",
|
|
32420
32093
|
"rawdescription": "\n\nSet to `true` for invalid state.\n",
|
|
32421
32094
|
"description": "<p>Set to <code>true</code> for invalid state.</p>\n",
|
|
32422
|
-
"line":
|
|
32095
|
+
"line": 286,
|
|
32423
32096
|
"type": "boolean",
|
|
32424
32097
|
"decorators": []
|
|
32425
32098
|
},
|
|
@@ -32429,7 +32102,7 @@
|
|
|
32429
32102
|
"deprecationMessage": "",
|
|
32430
32103
|
"rawdescription": "\n\nValue displayed if dropdown is in invalid state.\n",
|
|
32431
32104
|
"description": "<p>Value displayed if dropdown is in invalid state.</p>\n",
|
|
32432
|
-
"line":
|
|
32105
|
+
"line": 290,
|
|
32433
32106
|
"type": "string | TemplateRef<any>",
|
|
32434
32107
|
"decorators": []
|
|
32435
32108
|
},
|
|
@@ -32439,7 +32112,7 @@
|
|
|
32439
32112
|
"deprecationMessage": "",
|
|
32440
32113
|
"rawdescription": "\n\nSpecifies the property to be used as the return value to `ngModel`\n",
|
|
32441
32114
|
"description": "<p>Specifies the property to be used as the return value to <code>ngModel</code></p>\n",
|
|
32442
|
-
"line":
|
|
32115
|
+
"line": 311,
|
|
32443
32116
|
"type": "string",
|
|
32444
32117
|
"decorators": []
|
|
32445
32118
|
},
|
|
@@ -32449,7 +32122,7 @@
|
|
|
32449
32122
|
"deprecationMessage": "",
|
|
32450
32123
|
"rawdescription": "\n\nLabel for the dropdown.\n",
|
|
32451
32124
|
"description": "<p>Label for the dropdown.</p>\n",
|
|
32452
|
-
"line":
|
|
32125
|
+
"line": 224,
|
|
32453
32126
|
"type": "string | TemplateRef<any>",
|
|
32454
32127
|
"decorators": []
|
|
32455
32128
|
},
|
|
@@ -32460,7 +32133,7 @@
|
|
|
32460
32133
|
"deprecationMessage": "",
|
|
32461
32134
|
"rawdescription": "\n\nAccessible label for the button that opens the dropdown list.\nDefaults to the `DROPDOWN.OPEN` value from the i18n service.\n",
|
|
32462
32135
|
"description": "<p>Accessible label for the button that opens the dropdown list.\nDefaults to the <code>DROPDOWN.OPEN</code> value from the i18n service.</p>\n",
|
|
32463
|
-
"line":
|
|
32136
|
+
"line": 323,
|
|
32464
32137
|
"type": "any",
|
|
32465
32138
|
"decorators": []
|
|
32466
32139
|
},
|
|
@@ -32471,7 +32144,7 @@
|
|
|
32471
32144
|
"deprecationMessage": "",
|
|
32472
32145
|
"rawdescription": "\n\nValue displayed if no item is selected.\n",
|
|
32473
32146
|
"description": "<p>Value displayed if no item is selected.</p>\n",
|
|
32474
|
-
"line":
|
|
32147
|
+
"line": 240,
|
|
32475
32148
|
"type": "string",
|
|
32476
32149
|
"decorators": []
|
|
32477
32150
|
},
|
|
@@ -32482,7 +32155,7 @@
|
|
|
32482
32155
|
"deprecationMessage": "",
|
|
32483
32156
|
"rawdescription": "\n\nSet to `true` for a readonly state.\n",
|
|
32484
32157
|
"description": "<p>Set to <code>true</code> for a readonly state.</p>\n",
|
|
32485
|
-
"line":
|
|
32158
|
+
"line": 270,
|
|
32486
32159
|
"type": "boolean",
|
|
32487
32160
|
"decorators": []
|
|
32488
32161
|
},
|
|
@@ -32492,7 +32165,7 @@
|
|
|
32492
32165
|
"deprecationMessage": "",
|
|
32493
32166
|
"rawdescription": "\n\nQuery string for the element that contains the `Dropdown`.\nUsed to trigger closing the dropdown if it scrolls outside of the viewport of the `scrollableContainer`.\n",
|
|
32494
32167
|
"description": "<p>Query string for the element that contains the <code>Dropdown</code>.\nUsed to trigger closing the dropdown if it scrolls outside of the viewport of the <code>scrollableContainer</code>.</p>\n",
|
|
32495
|
-
"line":
|
|
32168
|
+
"line": 307,
|
|
32496
32169
|
"type": "string",
|
|
32497
32170
|
"decorators": []
|
|
32498
32171
|
},
|
|
@@ -32503,7 +32176,7 @@
|
|
|
32503
32176
|
"deprecationMessage": "",
|
|
32504
32177
|
"rawdescription": "\n\nProvides the label for the \"# selected\" text.\nDefaults to the `DROPDOWN.SELECTED` value from the i18n service.\n",
|
|
32505
32178
|
"description": "<p>Provides the label for the "# selected" text.\nDefaults to the <code>DROPDOWN.SELECTED</code> value from the i18n service.</p>\n",
|
|
32506
|
-
"line":
|
|
32179
|
+
"line": 328,
|
|
32507
32180
|
"type": "any",
|
|
32508
32181
|
"decorators": []
|
|
32509
32182
|
},
|
|
@@ -32514,7 +32187,7 @@
|
|
|
32514
32187
|
"deprecationMessage": "",
|
|
32515
32188
|
"rawdescription": "\n\nSpecify feedback (mode) of the selection.\n`top`: selected item jumps to top\n`fixed`: selected item stays at it's position\n`top-after-reopen`: selected item jump to top after reopen dropdown\n",
|
|
32516
32189
|
"description": "<p>Specify feedback (mode) of the selection.\n<code>top</code>: selected item jumps to top\n<code>fixed</code>: selected item stays at it's position\n<code>top-after-reopen</code>: selected item jump to top after reopen dropdown</p>\n",
|
|
32517
|
-
"line":
|
|
32190
|
+
"line": 318,
|
|
32518
32191
|
"type": "\"top\" | \"fixed\" | \"top-after-reopen\"",
|
|
32519
32192
|
"decorators": []
|
|
32520
32193
|
},
|
|
@@ -32525,7 +32198,7 @@
|
|
|
32525
32198
|
"deprecationMessage": "",
|
|
32526
32199
|
"rawdescription": "\n\nSize to render the dropdown field.\n",
|
|
32527
32200
|
"description": "<p>Size to render the dropdown field.</p>\n",
|
|
32528
|
-
"line":
|
|
32201
|
+
"line": 252,
|
|
32529
32202
|
"type": "\"sm\" | \"md\" | \"lg\"",
|
|
32530
32203
|
"decorators": []
|
|
32531
32204
|
},
|
|
@@ -32536,7 +32209,7 @@
|
|
|
32536
32209
|
"deprecationMessage": "",
|
|
32537
32210
|
"rawdescription": "\n\nSet to `true` for a loading dropdown.\n",
|
|
32538
32211
|
"description": "<p>Set to <code>true</code> for a loading dropdown.</p>\n",
|
|
32539
|
-
"line":
|
|
32212
|
+
"line": 274,
|
|
32540
32213
|
"type": "boolean",
|
|
32541
32214
|
"decorators": []
|
|
32542
32215
|
},
|
|
@@ -32547,15 +32220,15 @@
|
|
|
32547
32220
|
"deprecationMessage": "since v5 - Use `cdsLayer` directive instead\n`light` or `dark` dropdown theme",
|
|
32548
32221
|
"jsdoctags": [
|
|
32549
32222
|
{
|
|
32550
|
-
"pos":
|
|
32551
|
-
"end":
|
|
32223
|
+
"pos": 8190,
|
|
32224
|
+
"end": 8285,
|
|
32552
32225
|
"flags": 16842752,
|
|
32553
32226
|
"modifierFlagsCache": 0,
|
|
32554
32227
|
"transformFlags": 0,
|
|
32555
32228
|
"kind": 338,
|
|
32556
32229
|
"tagName": {
|
|
32557
|
-
"pos":
|
|
32558
|
-
"end":
|
|
32230
|
+
"pos": 8191,
|
|
32231
|
+
"end": 8201,
|
|
32559
32232
|
"flags": 16842752,
|
|
32560
32233
|
"modifierFlagsCache": 0,
|
|
32561
32234
|
"transformFlags": 0,
|
|
@@ -32565,7 +32238,7 @@
|
|
|
32565
32238
|
"comment": "<p>since v5 - Use <code>cdsLayer</code> directive instead\n<code>light</code> or <code>dark</code> dropdown theme</p>\n"
|
|
32566
32239
|
}
|
|
32567
32240
|
],
|
|
32568
|
-
"line":
|
|
32241
|
+
"line": 262,
|
|
32569
32242
|
"type": "\"light\" | \"dark\"",
|
|
32570
32243
|
"decorators": []
|
|
32571
32244
|
},
|
|
@@ -32576,7 +32249,7 @@
|
|
|
32576
32249
|
"deprecationMessage": "",
|
|
32577
32250
|
"rawdescription": "\n\nDefines whether or not the `Dropdown` supports selecting multiple items as opposed to single\nitem selection.\n",
|
|
32578
32251
|
"description": "<p>Defines whether or not the <code>Dropdown</code> supports selecting multiple items as opposed to single\nitem selection.</p>\n",
|
|
32579
|
-
"line":
|
|
32252
|
+
"line": 257,
|
|
32580
32253
|
"type": "\"single\" | \"multi\"",
|
|
32581
32254
|
"decorators": []
|
|
32582
32255
|
},
|
|
@@ -32587,7 +32260,7 @@
|
|
|
32587
32260
|
"deprecationMessage": "",
|
|
32588
32261
|
"rawdescription": "\n\nSet to `true` to show a warning (contents set by warningText)\n",
|
|
32589
32262
|
"description": "<p>Set to <code>true</code> to show a warning (contents set by warningText)</p>\n",
|
|
32590
|
-
"line":
|
|
32263
|
+
"line": 294,
|
|
32591
32264
|
"type": "boolean",
|
|
32592
32265
|
"decorators": []
|
|
32593
32266
|
},
|
|
@@ -32597,7 +32270,7 @@
|
|
|
32597
32270
|
"deprecationMessage": "",
|
|
32598
32271
|
"rawdescription": "\n\nSets the warning text\n",
|
|
32599
32272
|
"description": "<p>Sets the warning text</p>\n",
|
|
32600
|
-
"line":
|
|
32273
|
+
"line": 298,
|
|
32601
32274
|
"type": "string | TemplateRef<any>",
|
|
32602
32275
|
"decorators": []
|
|
32603
32276
|
}
|
|
@@ -32610,7 +32283,7 @@
|
|
|
32610
32283
|
"deprecationMessage": "",
|
|
32611
32284
|
"rawdescription": "\n\nEmits event notifying to other classes that the `Dropdown` has been closed (collapsed).\n",
|
|
32612
32285
|
"description": "<p>Emits event notifying to other classes that the <code>Dropdown</code> has been closed (collapsed).</p>\n",
|
|
32613
|
-
"line":
|
|
32286
|
+
"line": 348,
|
|
32614
32287
|
"type": "EventEmitter<any>"
|
|
32615
32288
|
},
|
|
32616
32289
|
{
|
|
@@ -32620,7 +32293,7 @@
|
|
|
32620
32293
|
"deprecationMessage": "",
|
|
32621
32294
|
"rawdescription": "\n\nEmits event notifying to other classes that the `Dropdown` has been closed (collapsed).\n",
|
|
32622
32295
|
"description": "<p>Emits event notifying to other classes that the <code>Dropdown</code> has been closed (collapsed).</p>\n",
|
|
32623
|
-
"line":
|
|
32296
|
+
"line": 344,
|
|
32624
32297
|
"type": "EventEmitter<any>"
|
|
32625
32298
|
},
|
|
32626
32299
|
{
|
|
@@ -32630,7 +32303,7 @@
|
|
|
32630
32303
|
"deprecationMessage": "",
|
|
32631
32304
|
"rawdescription": "\n\nEmits selection events.\n",
|
|
32632
32305
|
"description": "<p>Emits selection events.</p>\n",
|
|
32633
|
-
"line":
|
|
32306
|
+
"line": 340,
|
|
32634
32307
|
"type": "EventEmitter<Object>"
|
|
32635
32308
|
}
|
|
32636
32309
|
],
|
|
@@ -32643,7 +32316,7 @@
|
|
|
32643
32316
|
"type": "",
|
|
32644
32317
|
"optional": false,
|
|
32645
32318
|
"description": "<p>controls whether the <code>drop-up</code> class is applied</p>\n",
|
|
32646
|
-
"line":
|
|
32319
|
+
"line": 380,
|
|
32647
32320
|
"rawdescription": "\n\ncontrols whether the `drop-up` class is applied\n"
|
|
32648
32321
|
},
|
|
32649
32322
|
{
|
|
@@ -32653,7 +32326,7 @@
|
|
|
32653
32326
|
"type": "",
|
|
32654
32327
|
"optional": false,
|
|
32655
32328
|
"description": "<p>Maintains a reference to the view DOM element of the <code>Dropdown</code> button.</p>\n",
|
|
32656
|
-
"line":
|
|
32329
|
+
"line": 357,
|
|
32657
32330
|
"rawdescription": "\n\nMaintains a reference to the view DOM element of the `Dropdown` button.\n",
|
|
32658
32331
|
"decorators": [
|
|
32659
32332
|
{
|
|
@@ -32673,7 +32346,7 @@
|
|
|
32673
32346
|
"type": "number",
|
|
32674
32347
|
"optional": false,
|
|
32675
32348
|
"description": "",
|
|
32676
|
-
"line":
|
|
32349
|
+
"line": 218,
|
|
32677
32350
|
"modifierKind": [
|
|
32678
32351
|
126
|
|
32679
32352
|
]
|
|
@@ -32685,7 +32358,7 @@
|
|
|
32685
32358
|
"type": "",
|
|
32686
32359
|
"optional": false,
|
|
32687
32360
|
"description": "<p>ViewChid of the dropdown view.</p>\n",
|
|
32688
|
-
"line":
|
|
32361
|
+
"line": 361,
|
|
32689
32362
|
"rawdescription": "\n\nViewChid of the dropdown view.\n",
|
|
32690
32363
|
"decorators": [
|
|
32691
32364
|
{
|
|
@@ -32705,7 +32378,7 @@
|
|
|
32705
32378
|
"type": "",
|
|
32706
32379
|
"optional": false,
|
|
32707
32380
|
"description": "",
|
|
32708
|
-
"line":
|
|
32381
|
+
"line": 363,
|
|
32709
32382
|
"decorators": [
|
|
32710
32383
|
{
|
|
32711
32384
|
"name": "HostBinding",
|
|
@@ -32724,7 +32397,7 @@
|
|
|
32724
32397
|
"type": "",
|
|
32725
32398
|
"optional": false,
|
|
32726
32399
|
"description": "",
|
|
32727
|
-
"line":
|
|
32400
|
+
"line": 365,
|
|
32728
32401
|
"decorators": [
|
|
32729
32402
|
{
|
|
32730
32403
|
"name": "HostBinding",
|
|
@@ -32743,7 +32416,7 @@
|
|
|
32743
32416
|
"type": "",
|
|
32744
32417
|
"optional": false,
|
|
32745
32418
|
"description": "",
|
|
32746
|
-
"line":
|
|
32419
|
+
"line": 387
|
|
32747
32420
|
},
|
|
32748
32421
|
{
|
|
32749
32422
|
"name": "menuIsClosed",
|
|
@@ -32753,7 +32426,7 @@
|
|
|
32753
32426
|
"type": "",
|
|
32754
32427
|
"optional": false,
|
|
32755
32428
|
"description": "<p>Set to <code>true</code> if the dropdown is closed (not expanded).</p>\n",
|
|
32756
|
-
"line":
|
|
32429
|
+
"line": 375,
|
|
32757
32430
|
"rawdescription": "\n\nSet to `true` if the dropdown is closed (not expanded).\n"
|
|
32758
32431
|
},
|
|
32759
32432
|
{
|
|
@@ -32764,7 +32437,7 @@
|
|
|
32764
32437
|
"type": "",
|
|
32765
32438
|
"optional": false,
|
|
32766
32439
|
"description": "",
|
|
32767
|
-
"line":
|
|
32440
|
+
"line": 384
|
|
32768
32441
|
},
|
|
32769
32442
|
{
|
|
32770
32443
|
"name": "outsideClick",
|
|
@@ -32774,7 +32447,7 @@
|
|
|
32774
32447
|
"type": "",
|
|
32775
32448
|
"optional": false,
|
|
32776
32449
|
"description": "",
|
|
32777
|
-
"line":
|
|
32450
|
+
"line": 385
|
|
32778
32451
|
},
|
|
32779
32452
|
{
|
|
32780
32453
|
"name": "outsideKey",
|
|
@@ -32784,7 +32457,7 @@
|
|
|
32784
32457
|
"type": "",
|
|
32785
32458
|
"optional": false,
|
|
32786
32459
|
"description": "",
|
|
32787
|
-
"line":
|
|
32460
|
+
"line": 386
|
|
32788
32461
|
},
|
|
32789
32462
|
{
|
|
32790
32463
|
"name": "propagateChange",
|
|
@@ -32794,7 +32467,7 @@
|
|
|
32794
32467
|
"type": "",
|
|
32795
32468
|
"optional": false,
|
|
32796
32469
|
"description": "<p>function passed in by <code>registerOnChange</code></p>\n",
|
|
32797
|
-
"line":
|
|
32470
|
+
"line": 556,
|
|
32798
32471
|
"rawdescription": "\n\nfunction passed in by `registerOnChange`\n"
|
|
32799
32472
|
},
|
|
32800
32473
|
{
|
|
@@ -32804,7 +32477,7 @@
|
|
|
32804
32477
|
"type": "AbstractDropdownView",
|
|
32805
32478
|
"optional": false,
|
|
32806
32479
|
"description": "<p>Maintains a reference to the <code>AbstractDropdownView</code> object within the content DOM.</p>\n",
|
|
32807
|
-
"line":
|
|
32480
|
+
"line": 353,
|
|
32808
32481
|
"rawdescription": "\n\nMaintains a reference to the `AbstractDropdownView` object within the content DOM.\n",
|
|
32809
32482
|
"decorators": [
|
|
32810
32483
|
{
|
|
@@ -32824,7 +32497,7 @@
|
|
|
32824
32497
|
"optional": false,
|
|
32825
32498
|
"returnType": "void",
|
|
32826
32499
|
"typeParameters": [],
|
|
32827
|
-
"line":
|
|
32500
|
+
"line": 735,
|
|
32828
32501
|
"deprecated": false,
|
|
32829
32502
|
"deprecationMessage": "",
|
|
32830
32503
|
"rawdescription": "\n\nCreates the `Dropdown` list as an element that is appended to the DOM body.\n",
|
|
@@ -32836,7 +32509,7 @@
|
|
|
32836
32509
|
"optional": false,
|
|
32837
32510
|
"returnType": "void",
|
|
32838
32511
|
"typeParameters": [],
|
|
32839
|
-
"line":
|
|
32512
|
+
"line": 727,
|
|
32840
32513
|
"deprecated": false,
|
|
32841
32514
|
"deprecationMessage": "",
|
|
32842
32515
|
"rawdescription": "\n\nCreates the `Dropdown` list appending it to the dropdown parent object instead of the body.\n",
|
|
@@ -32855,7 +32528,7 @@
|
|
|
32855
32528
|
"optional": false,
|
|
32856
32529
|
"returnType": "void",
|
|
32857
32530
|
"typeParameters": [],
|
|
32858
|
-
"line":
|
|
32531
|
+
"line": 707,
|
|
32859
32532
|
"deprecated": false,
|
|
32860
32533
|
"deprecationMessage": "",
|
|
32861
32534
|
"rawdescription": "\n\nHandles keyboard events so users are controlling the `Dropdown` instead of unintentionally controlling outside elements.\n",
|
|
@@ -32878,7 +32551,7 @@
|
|
|
32878
32551
|
"optional": false,
|
|
32879
32552
|
"returnType": "void",
|
|
32880
32553
|
"typeParameters": [],
|
|
32881
|
-
"line":
|
|
32554
|
+
"line": 687,
|
|
32882
32555
|
"deprecated": false,
|
|
32883
32556
|
"deprecationMessage": ""
|
|
32884
32557
|
},
|
|
@@ -32895,7 +32568,7 @@
|
|
|
32895
32568
|
"optional": false,
|
|
32896
32569
|
"returnType": "void",
|
|
32897
32570
|
"typeParameters": [],
|
|
32898
|
-
"line":
|
|
32571
|
+
"line": 691,
|
|
32899
32572
|
"deprecated": false,
|
|
32900
32573
|
"deprecationMessage": "",
|
|
32901
32574
|
"rawdescription": "\n\nHandles clicks outside of the `Dropdown`.\n",
|
|
@@ -32925,7 +32598,7 @@
|
|
|
32925
32598
|
"optional": false,
|
|
32926
32599
|
"returnType": "void",
|
|
32927
32600
|
"typeParameters": [],
|
|
32928
|
-
"line":
|
|
32601
|
+
"line": 699,
|
|
32929
32602
|
"deprecated": false,
|
|
32930
32603
|
"deprecationMessage": "",
|
|
32931
32604
|
"jsdoctags": [
|
|
@@ -32946,7 +32619,7 @@
|
|
|
32946
32619
|
"optional": false,
|
|
32947
32620
|
"returnType": "any",
|
|
32948
32621
|
"typeParameters": [],
|
|
32949
|
-
"line":
|
|
32622
|
+
"line": 749,
|
|
32950
32623
|
"deprecated": false,
|
|
32951
32624
|
"deprecationMessage": "",
|
|
32952
32625
|
"rawdescription": "\n\nDetects whether or not the `Dropdown` list is visible within all scrollable parents.\nThis can be overridden by passing in a value to the `dropUp` input.\n",
|
|
@@ -32958,7 +32631,7 @@
|
|
|
32958
32631
|
"optional": false,
|
|
32959
32632
|
"returnType": "void",
|
|
32960
32633
|
"typeParameters": [],
|
|
32961
|
-
"line":
|
|
32634
|
+
"line": 668,
|
|
32962
32635
|
"deprecated": false,
|
|
32963
32636
|
"deprecationMessage": ""
|
|
32964
32637
|
},
|
|
@@ -32975,7 +32648,7 @@
|
|
|
32975
32648
|
"optional": false,
|
|
32976
32649
|
"returnType": "void",
|
|
32977
32650
|
"typeParameters": [],
|
|
32978
|
-
"line":
|
|
32651
|
+
"line": 608,
|
|
32979
32652
|
"deprecated": false,
|
|
32980
32653
|
"deprecationMessage": "",
|
|
32981
32654
|
"jsdoctags": [
|
|
@@ -32996,7 +32669,7 @@
|
|
|
32996
32669
|
"optional": false,
|
|
32997
32670
|
"returnType": "void",
|
|
32998
32671
|
"typeParameters": [],
|
|
32999
|
-
"line":
|
|
32672
|
+
"line": 813,
|
|
33000
32673
|
"deprecated": false,
|
|
33001
32674
|
"deprecationMessage": "",
|
|
33002
32675
|
"rawdescription": "\n\nCollapsing the dropdown menu and removing unnecessary `EventListeners`.\n",
|
|
@@ -33008,7 +32681,7 @@
|
|
|
33008
32681
|
"optional": false,
|
|
33009
32682
|
"returnType": "Observable<string>",
|
|
33010
32683
|
"typeParameters": [],
|
|
33011
|
-
"line":
|
|
32684
|
+
"line": 627,
|
|
33012
32685
|
"deprecated": false,
|
|
33013
32686
|
"deprecationMessage": "",
|
|
33014
32687
|
"rawdescription": "\n\nReturns the display value if there is a selection and displayValue is set,\nif there is just a selection the ListItem content property will be returned,\notherwise the placeholder will be returned.\n",
|
|
@@ -33020,7 +32693,7 @@
|
|
|
33020
32693
|
"optional": false,
|
|
33021
32694
|
"returnType": "{ items: any; item?: undefined; } | { item: any; items?: undefined; } | { items?: undefined; item?: undefined; }",
|
|
33022
32695
|
"typeParameters": [],
|
|
33023
|
-
"line":
|
|
32696
|
+
"line": 648,
|
|
33024
32697
|
"deprecated": false,
|
|
33025
32698
|
"deprecationMessage": ""
|
|
33026
32699
|
},
|
|
@@ -33030,7 +32703,7 @@
|
|
|
33030
32703
|
"optional": false,
|
|
33031
32704
|
"returnType": "number",
|
|
33032
32705
|
"typeParameters": [],
|
|
33033
|
-
"line":
|
|
32706
|
+
"line": 662,
|
|
33034
32707
|
"deprecated": false,
|
|
33035
32708
|
"deprecationMessage": ""
|
|
33036
32709
|
},
|
|
@@ -33047,7 +32720,7 @@
|
|
|
33047
32720
|
"optional": false,
|
|
33048
32721
|
"returnType": "void",
|
|
33049
32722
|
"typeParameters": [],
|
|
33050
|
-
"line":
|
|
32723
|
+
"line": 855,
|
|
33051
32724
|
"deprecated": false,
|
|
33052
32725
|
"deprecationMessage": "",
|
|
33053
32726
|
"jsdoctags": [
|
|
@@ -33068,7 +32741,7 @@
|
|
|
33068
32741
|
"optional": false,
|
|
33069
32742
|
"returnType": "boolean",
|
|
33070
32743
|
"typeParameters": [],
|
|
33071
|
-
"line":
|
|
32744
|
+
"line": 644,
|
|
33072
32745
|
"deprecated": false,
|
|
33073
32746
|
"deprecationMessage": ""
|
|
33074
32747
|
},
|
|
@@ -33085,7 +32758,7 @@
|
|
|
33085
32758
|
"optional": false,
|
|
33086
32759
|
"returnType": "boolean",
|
|
33087
32760
|
"typeParameters": [],
|
|
33088
|
-
"line":
|
|
32761
|
+
"line": 851,
|
|
33089
32762
|
"deprecated": false,
|
|
33090
32763
|
"deprecationMessage": "",
|
|
33091
32764
|
"modifierKind": [
|
|
@@ -33109,7 +32782,7 @@
|
|
|
33109
32782
|
"optional": false,
|
|
33110
32783
|
"returnType": "void",
|
|
33111
32784
|
"typeParameters": [],
|
|
33112
|
-
"line":
|
|
32785
|
+
"line": 537,
|
|
33113
32786
|
"deprecated": false,
|
|
33114
32787
|
"deprecationMessage": ""
|
|
33115
32788
|
},
|
|
@@ -33126,7 +32799,7 @@
|
|
|
33126
32799
|
"optional": false,
|
|
33127
32800
|
"returnType": "void",
|
|
33128
32801
|
"typeParameters": [],
|
|
33129
|
-
"line":
|
|
32802
|
+
"line": 573,
|
|
33130
32803
|
"deprecated": false,
|
|
33131
32804
|
"deprecationMessage": "",
|
|
33132
32805
|
"rawdescription": "\n\nAdds keyboard functionality for navigation, selection and closing of the `Dropdown`.\n",
|
|
@@ -33158,7 +32831,7 @@
|
|
|
33158
32831
|
"optional": false,
|
|
33159
32832
|
"returnType": "void",
|
|
33160
32833
|
"typeParameters": [],
|
|
33161
|
-
"line":
|
|
32834
|
+
"line": 769,
|
|
33162
32835
|
"deprecated": false,
|
|
33163
32836
|
"deprecationMessage": "",
|
|
33164
32837
|
"rawdescription": "\n\nExpands the dropdown menu in the view.\n",
|
|
@@ -33177,7 +32850,7 @@
|
|
|
33177
32850
|
"optional": false,
|
|
33178
32851
|
"returnType": "void",
|
|
33179
32852
|
"typeParameters": [],
|
|
33180
|
-
"line":
|
|
32853
|
+
"line": 541,
|
|
33181
32854
|
"deprecated": false,
|
|
33182
32855
|
"deprecationMessage": "",
|
|
33183
32856
|
"jsdoctags": [
|
|
@@ -33205,7 +32878,7 @@
|
|
|
33205
32878
|
"optional": false,
|
|
33206
32879
|
"returnType": "void",
|
|
33207
32880
|
"typeParameters": [],
|
|
33208
|
-
"line":
|
|
32881
|
+
"line": 549,
|
|
33209
32882
|
"deprecated": false,
|
|
33210
32883
|
"deprecationMessage": "",
|
|
33211
32884
|
"rawdescription": "\n\nRegistering the function injected to control the touch use of the `Dropdown`.\n",
|
|
@@ -33235,7 +32908,7 @@
|
|
|
33235
32908
|
"optional": false,
|
|
33236
32909
|
"returnType": "void",
|
|
33237
32910
|
"typeParameters": [],
|
|
33238
|
-
"line":
|
|
32911
|
+
"line": 565,
|
|
33239
32912
|
"deprecated": false,
|
|
33240
32913
|
"deprecationMessage": "",
|
|
33241
32914
|
"rawdescription": "\n\n`ControlValueAccessor` method to programmatically disable the dropdown.\n\nex: `this.formGroup.get(\"myDropdown\").disable();`\n\n",
|
|
@@ -33243,8 +32916,8 @@
|
|
|
33243
32916
|
"jsdoctags": [
|
|
33244
32917
|
{
|
|
33245
32918
|
"name": {
|
|
33246
|
-
"pos":
|
|
33247
|
-
"end":
|
|
32919
|
+
"pos": 17201,
|
|
32920
|
+
"end": 17211,
|
|
33248
32921
|
"flags": 16842752,
|
|
33249
32922
|
"modifierFlagsCache": 0,
|
|
33250
32923
|
"transformFlags": 0,
|
|
@@ -33255,8 +32928,8 @@
|
|
|
33255
32928
|
"deprecated": false,
|
|
33256
32929
|
"deprecationMessage": "",
|
|
33257
32930
|
"tagName": {
|
|
33258
|
-
"pos":
|
|
33259
|
-
"end":
|
|
32931
|
+
"pos": 17195,
|
|
32932
|
+
"end": 17200,
|
|
33260
32933
|
"flags": 16842752,
|
|
33261
32934
|
"modifierFlagsCache": 0,
|
|
33262
32935
|
"transformFlags": 0,
|
|
@@ -33273,7 +32946,7 @@
|
|
|
33273
32946
|
"optional": false,
|
|
33274
32947
|
"returnType": "void",
|
|
33275
32948
|
"typeParameters": [],
|
|
33276
|
-
"line":
|
|
32949
|
+
"line": 843,
|
|
33277
32950
|
"deprecated": false,
|
|
33278
32951
|
"deprecationMessage": "",
|
|
33279
32952
|
"rawdescription": "\n\nControls toggling menu states between open/expanded and closed/collapsed.\n",
|
|
@@ -33285,7 +32958,7 @@
|
|
|
33285
32958
|
"optional": false,
|
|
33286
32959
|
"returnType": "boolean",
|
|
33287
32960
|
"typeParameters": [],
|
|
33288
|
-
"line":
|
|
32961
|
+
"line": 682,
|
|
33289
32962
|
"deprecated": false,
|
|
33290
32963
|
"deprecationMessage": "",
|
|
33291
32964
|
"rawdescription": "\n\nReturns `true` if there is a value selected.\n",
|
|
@@ -33304,7 +32977,7 @@
|
|
|
33304
32977
|
"optional": false,
|
|
33305
32978
|
"returnType": "void",
|
|
33306
32979
|
"typeParameters": [],
|
|
33307
|
-
"line":
|
|
32980
|
+
"line": 498,
|
|
33308
32981
|
"deprecated": false,
|
|
33309
32982
|
"deprecationMessage": "",
|
|
33310
32983
|
"rawdescription": "\n\nPropagates the injected `value`.\n",
|
|
@@ -33330,7 +33003,7 @@
|
|
|
33330
33003
|
"defaultValue": "true",
|
|
33331
33004
|
"deprecated": false,
|
|
33332
33005
|
"deprecationMessage": "",
|
|
33333
|
-
"line":
|
|
33006
|
+
"line": 363,
|
|
33334
33007
|
"type": "boolean",
|
|
33335
33008
|
"decorators": []
|
|
33336
33009
|
},
|
|
@@ -33339,7 +33012,7 @@
|
|
|
33339
33012
|
"defaultValue": "true",
|
|
33340
33013
|
"deprecated": false,
|
|
33341
33014
|
"deprecationMessage": "",
|
|
33342
|
-
"line":
|
|
33015
|
+
"line": 365,
|
|
33343
33016
|
"type": "boolean",
|
|
33344
33017
|
"decorators": []
|
|
33345
33018
|
},
|
|
@@ -33347,7 +33020,7 @@
|
|
|
33347
33020
|
"name": "class.cds--list-box__wrapper--decorator",
|
|
33348
33021
|
"deprecated": false,
|
|
33349
33022
|
"deprecationMessage": "",
|
|
33350
|
-
"line":
|
|
33023
|
+
"line": 203,
|
|
33351
33024
|
"type": "boolean",
|
|
33352
33025
|
"decorators": []
|
|
33353
33026
|
},
|
|
@@ -33355,7 +33028,7 @@
|
|
|
33355
33028
|
"name": "class.cds--list-box__wrapper--fluid--focus",
|
|
33356
33029
|
"deprecated": false,
|
|
33357
33030
|
"deprecationMessage": "",
|
|
33358
|
-
"line":
|
|
33031
|
+
"line": 199,
|
|
33359
33032
|
"type": "boolean",
|
|
33360
33033
|
"decorators": []
|
|
33361
33034
|
},
|
|
@@ -33363,7 +33036,7 @@
|
|
|
33363
33036
|
"name": "class.cds--list-box__wrapper--fluid--invalid",
|
|
33364
33037
|
"deprecated": false,
|
|
33365
33038
|
"deprecationMessage": "",
|
|
33366
|
-
"line":
|
|
33039
|
+
"line": 195,
|
|
33367
33040
|
"type": "boolean",
|
|
33368
33041
|
"decorators": []
|
|
33369
33042
|
}
|
|
@@ -33386,7 +33059,7 @@
|
|
|
33386
33059
|
"deprecationMessage": "",
|
|
33387
33060
|
"rawdescription": "\n\nAdds keyboard functionality for navigation, selection and closing of the `Dropdown`.\n",
|
|
33388
33061
|
"description": "<p>Adds keyboard functionality for navigation, selection and closing of the <code>Dropdown</code>.</p>\n",
|
|
33389
|
-
"line":
|
|
33062
|
+
"line": 573
|
|
33390
33063
|
}
|
|
33391
33064
|
],
|
|
33392
33065
|
"standalone": false,
|
|
@@ -33394,7 +33067,7 @@
|
|
|
33394
33067
|
"description": "<p>Drop-down lists enable users to select one or more items from a list.</p>\n<h4>Opening behavior/List DOM placement</h4>\n<p>By default the dropdown will try to figure out the best placement for the dropdown list.</p>\n<p>If it's not contained within any scrolling elements, it will open inline, if it <em>is</em>\ncontained within a scrolling container it will try to open in the body, or an <code>cds-placeholder</code>.</p>\n<p>To control this behavior you can use the <code>appendInline</code> input:</p>\n<ul>\n<li><code>[appendInline]="null"</code> is the default (auto detection)</li>\n<li><code>[appendInline]="false"</code> will always append to the body/<code>cds-placeholder</code></li>\n<li><code>[appendInline]="true"</code> will always append inline (next to the dropdown button)</li>\n</ul>\n<p>Get started with importing the module:</p>\n<b>Example :</b><div><pre class=\"line-numbers\"><code class=\"language-typescript\">import { DropdownModule } from 'carbon-components-angular';</code></pre></div><p><a href=\"../../?path=/story/components-dropdown--basic\">See demo</a></p>\n",
|
|
33395
33068
|
"rawdescription": "\n\nDrop-down lists enable users to select one or more items from a list.\n\n#### Opening behavior/List DOM placement\nBy default the dropdown will try to figure out the best placement for the dropdown list.\n\nIf it's not contained within any scrolling elements, it will open inline, if it _is_\ncontained within a scrolling container it will try to open in the body, or an `cds-placeholder`.\n\nTo control this behavior you can use the `appendInline` input:\n- `[appendInline]=\"null\"` is the default (auto detection)\n- `[appendInline]=\"false\"` will always append to the body/`cds-placeholder`\n- `[appendInline]=\"true\"` will always append inline (next to the dropdown button)\n\nGet started with importing the module:\n\n```typescript\nimport { DropdownModule } from 'carbon-components-angular';\n```\n\n[See demo](../../?path=/story/components-dropdown--basic)\n",
|
|
33396
33069
|
"type": "component",
|
|
33397
|
-
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tOutput,\n\tEventEmitter,\n\tElementRef,\n\tContentChild,\n\tOnInit,\n\tViewChild,\n\tAfterContentInit,\n\tHostListener,\n\tOnDestroy,\n\tHostBinding,\n\tTemplateRef,\n\tAfterViewInit\n} from \"@angular/core\";\nimport { NG_VALUE_ACCESSOR, ControlValueAccessor } from \"@angular/forms\";\n\n// Observable import is required here so typescript can compile correctly\nimport {\n\tObservable,\n\tof,\n\tSubscription\n} from \"rxjs\";\nimport { isNull, isUndefined } from \"lodash-es\";\n\nimport { AbstractDropdownView } from \"./abstract-dropdown-view.class\";\nimport { I18n } from \"carbon-components-angular/i18n\";\nimport { ListItem } from \"./list-item.interface\";\nimport { DropdownService } from \"./dropdown.service\";\nimport { ElementService, getScrollableParents } from \"carbon-components-angular/utils\";\nimport { hasScrollableParents } from \"carbon-components-angular/utils\";\n\n/**\n * Drop-down lists enable users to select one or more items from a list.\n *\n * #### Opening behavior/List DOM placement\n * By default the dropdown will try to figure out the best placement for the dropdown list.\n *\n * If it's not contained within any scrolling elements, it will open inline, if it _is_\n * contained within a scrolling container it will try to open in the body, or an `cds-placeholder`.\n *\n * To control this behavior you can use the `appendInline` input:\n * - `[appendInline]=\"null\"` is the default (auto detection)\n * - `[appendInline]=\"false\"` will always append to the body/`cds-placeholder`\n * - `[appendInline]=\"true\"` will always append inline (next to the dropdown button)\n *\n * Get started with importing the module:\n *\n * ```typescript\n * import { DropdownModule } from 'carbon-components-angular';\n * ```\n *\n * [See demo](../../?path=/story/components-dropdown--basic)\n */\n@Component({\n\tselector: \"cds-dropdown, ibm-dropdown\",\n\ttemplate: `\n\t<label\n\t\t*ngIf=\"label && !skeleton\"\n\t\t[for]=\"id\"\n\t\tclass=\"cds--label\"\n\t\t[ngClass]=\"{\n\t\t\t'cds--label--disabled': disabled,\n\t\t\t'cds--visually-hidden': hideLabel\n\t\t}\">\n\t\t<ng-container *ngIf=\"!isTemplate(label)\">{{label}}</ng-container>\n\t\t<ng-template *ngIf=\"isTemplate(label)\" [ngTemplateOutlet]=\"label\"></ng-template>\n\t</label>\n\t<div\n\t\tclass=\"cds--list-box\"\n\t\t[ngClass]=\"{\n\t\t\t'cds--dropdown': type !== 'multi' && !(skeleton && fluid),\n\t\t\t'cds--multiselect': type === 'multi',\n\t\t\t'cds--multi-select--selected': type === 'multi' && getSelectedCount() > 0,\n\t\t\t'cds--dropdown--light': theme === 'light',\n\t\t\t'cds--list-box--light': theme === 'light',\n\t\t\t'cds--list-box--inline': inline,\n\t\t\t'cds--skeleton': skeleton,\n\t\t\t'cds--dropdown--disabled cds--list-box--disabled': disabled,\n\t\t\t'cds--dropdown--readonly': readonly,\n\t\t\t'cds--dropdown--invalid': invalid,\n\t\t\t'cds--dropdown--warning cds--list-box--warning': warn,\n\t\t\t'cds--dropdown--sm cds--list-box--sm': size === 'sm',\n\t\t\t'cds--dropdown--md cds--list-box--md': size === 'md',\n\t\t\t'cds--dropdown--lg cds--list-box--lg': size === 'lg',\n\t\t\t'cds--list-box--expanded': !menuIsClosed,\n\t\t\t'cds--list-box--invalid': invalid\n\t\t}\"\n\t\t[attr.data-invalid]=\"invalid ? true : null\">\n\t\t<div *ngIf=\"skeleton && fluid\" class=\"cds--list-box__label\"></div>\n\t\t<button\n\t\t\t#dropdownButton\n\t\t\t[id]=\"id\"\n\t\t\ttype=\"button\"\n\t\t\tclass=\"cds--list-box__field\"\n\t\t\t[ngClass]=\"{'a': !menuIsClosed}\"\n\t\t\t[attr.aria-expanded]=\"!menuIsClosed\"\n\t\t\t[attr.aria-disabled]=\"disabled\"\n\t\t\taria-haspopup=\"listbox\"\n\t\t\t(click)=\"disabled || readonly ? $event.stopPropagation() : toggleMenu()\"\n\t\t\t(focus)=\"fluid ? handleFocus($event) : null\"\n\t\t\t(blur)=\"fluid ? handleFocus($event) : onBlur()\"\n\t\t\t[attr.disabled]=\"disabled ? true : null\">\n\t\t\t<div\n\t\t\t\t(click)=\"clearSelected()\"\n\t\t\t\t(keydown.enter)=\"clearSelected()\"\n\t\t\t\t*ngIf=\"type === 'multi' && getSelectedCount() > 0\"\n\t\t\t\tclass=\"cds--list-box__selection cds--tag--filter cds--list-box__selection--multi\"\n\t\t\t\ttabindex=\"0\"\n\t\t\t\t[title]=\"clearText\">\n\t\t\t\t{{getSelectedCount()}}\n\t\t\t\t<svg\n\t\t\t\t\tfocusable=\"false\"\n\t\t\t\t\tpreserveAspectRatio=\"xMidYMid meet\"\n\t\t\t\t\tstyle=\"will-change: transform;\"\n\t\t\t\t\trole=\"img\"\n\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\twidth=\"16\"\n\t\t\t\t\theight=\"16\"\n\t\t\t\t\tviewBox=\"0 0 16 16\"\n\t\t\t\t\taria-hidden=\"true\">\n\t\t\t\t\t<path d=\"M12 4.7l-.7-.7L8 7.3 4.7 4l-.7.7L7.3 8 4 11.3l.7.7L8 8.7l3.3 3.3.7-.7L8.7 8z\"></path>\n\t\t\t\t</svg>\n\t\t\t</div>\n\t\t\t<span *ngIf=\"isRenderString()\" class=\"cds--list-box__label\">{{getDisplayStringValue() | async}}</span>\n\t\t\t<ng-template\n\t\t\t\t*ngIf=\"!isRenderString()\"\n\t\t\t\t[ngTemplateOutletContext]=\"getRenderTemplateContext()\"\n\t\t\t\t[ngTemplateOutlet]=\"displayValue\">\n\t\t\t</ng-template>\n\t\t\t<span class=\"cds--list-box__menu-icon\">\n\t\t\t\t<svg\n\t\t\t\t\t*ngIf=\"!skeleton\"\n\t\t\t\t\tcdsIcon=\"chevron--down\"\n\t\t\t\t\tsize=\"16\"\n\t\t\t\t\t[attr.aria-label]=\"menuButtonLabel\"\n\t\t\t\t\t[ngClass]=\"{'cds--list-box__menu-icon--open': !menuIsClosed }\">\n\t\t\t\t</svg>\n\t\t\t</span>\n\t\t</button>\n\t\t<ng-container *ngIf=\"decorator\">\n\t\t\t<div class=\"cds--list-box__inner-wrapper--decorator\">\n\t\t\t\t<ng-template [ngTemplateOutlet]=\"decorator\"></ng-template>\n\t\t\t</div>\n\t\t</ng-container>\n\t\t<svg\n\t\t\t*ngIf=\"invalid\"\n\t\t\tclass=\"cds--list-box__invalid-icon\"\n\t\t\tcdsIcon=\"warning--filled\"\n\t\t\tsize=\"16\">\n\t\t</svg>\n\t\t<svg\n\t\t\t*ngIf=\"!invalid && warn\"\n\t\t\tcdsIcon=\"warning--alt--filled\"\n\t\t\tsize=\"16\"\n\t\t\tclass=\"cds--list-box__invalid-icon cds--list-box__invalid-icon--warning\">\n\t\t</svg>\n\t\t<div\n\t\t\t#dropdownMenu\n\t\t\t[ngClass]=\"{\n\t\t\t\t'cds--list-box--up': this.dropUp !== null && this.dropUp !== undefined ? dropUp : _dropUp\n\t\t\t}\">\n\t\t\t<ng-content *ngIf=\"!menuIsClosed\"></ng-content>\n\t\t</div>\n\t</div>\n\t<hr *ngIf=\"fluid\" class=\"cds--list-box__divider\" />\n\t<div\n\t\t*ngIf=\"helperText && !invalid && !warn && !skeleton && !fluid\"\n\t\tclass=\"cds--form__helper-text\"\n\t\t[ngClass]=\"{\n\t\t\t'cds--form__helper-text--disabled': disabled\n\t\t}\">\n\t\t<ng-container *ngIf=\"!isTemplate(helperText)\">{{helperText}}</ng-container>\n\t\t<ng-template *ngIf=\"isTemplate(helperText)\" [ngTemplateOutlet]=\"helperText\"></ng-template>\n\t</div>\n\t<div *ngIf=\"invalid\" class=\"cds--form-requirement\">\n\t\t<ng-container *ngIf=\"!isTemplate(invalidText)\">{{ invalidText }}</ng-container>\n\t\t<ng-template *ngIf=\"isTemplate(invalidText)\" [ngTemplateOutlet]=\"invalidText\"></ng-template>\n\t</div>\n\t<div *ngIf=\"!invalid && warn\" class=\"cds--form-requirement\">\n\t\t<ng-container *ngIf=\"!isTemplate(warnText)\">{{warnText}}</ng-container>\n\t\t<ng-template *ngIf=\"isTemplate(warnText)\" [ngTemplateOutlet]=\"warnText\"></ng-template>\n\t</div>\n\t`,\n\tproviders: [\n\t\t{\n\t\t\tprovide: NG_VALUE_ACCESSOR,\n\t\t\tuseExisting: Dropdown,\n\t\t\tmulti: true\n\t\t}\n\t]\n})\nexport class Dropdown implements OnInit, AfterContentInit, AfterViewInit, OnDestroy, ControlValueAccessor {\n\tstatic dropdownCount = 0;\n\t@HostBinding(\"class.cds--list-box__wrapper--fluid--invalid\") get fluidInvalidClass() {\n\t\treturn this.invalid && this.fluid;\n\t}\n\n\t@HostBinding(\"class.cds--list-box__wrapper--fluid--focus\") get fluidFocusClass() {\n\t\treturn this.fluid && this._isFocused && this.menuIsClosed;\n\t}\n\n\tprotected get writtenValue() {\n\t\treturn this._writtenValue;\n\t}\n\n\tprotected set writtenValue(val: any[]) {\n\t\tif (val && val.length === 0) {\n\t\t\tthis.clearSelected();\n\t\t}\n\t\tthis._writtenValue = val;\n\t}\n\n\t@Input() id = `dropdown-${Dropdown.dropdownCount++}`;\n\t/**\n\t * Label for the dropdown.\n\t */\n\t@Input() label: string | TemplateRef<any>;\n\t/**\n\t * Hide label while keeping it accessible for screen readers\n\t */\n\t@Input() hideLabel = false;\n\t/**\n\t * Sets the optional helper text.\n\t */\n\t@Input() helperText: string | TemplateRef<any>;\n\t/**\n\t * **Experimental**: Optional decorator (e.g. AI label).\n\t */\n\t@Input() decorator: TemplateRef<any>;\n\t/**\n\t * Value displayed if no item is selected.\n\t */\n\t@Input() placeholder = \"\";\n\t/**\n\t * The selected value from the `Dropdown`. Can be a string or template.\n\t */\n\t@Input() displayValue: string | TemplateRef<any> = \"\";\n\t/**\n\t * Sets the optional clear button tooltip text.\n\t */\n\t@Input() clearText: string = this.i18n.get().DROPDOWN.CLEAR;\n\t/**\n\t * Size to render the dropdown field.\n\t */\n\t@Input() size: \"sm\" | \"md\" | \"lg\" = \"md\";\n\t/**\n\t * Defines whether or not the `Dropdown` supports selecting multiple items as opposed to single\n\t * item selection.\n\t */\n\t@Input() type: \"single\" | \"multi\" = \"single\";\n\t/**\n\t * @deprecated since v5 - Use `cdsLayer` directive instead\n\t * `light` or `dark` dropdown theme\n\t */\n\t@Input() theme: \"light\" | \"dark\" = \"dark\";\n\t/**\n\t * Set to `true` to disable the dropdown.\n\t */\n\t@Input() disabled = false;\n\t/**\n\t * Set to `true` for a readonly state.\n\t */\n\t@Input() readonly = false;\n\t/**\n\t * Set to `true` for a loading dropdown.\n\t */\n\t@Input() skeleton = false;\n\t/**\n\t * Set to `true` for an inline dropdown.\n\t */\n\t@Input() inline = false;\n\t/**\n\t * Set to `true` for a dropdown without arrow key activation.\n\t */\n\t@Input() disableArrowKeys = false;\n\t/**\n\t * Set to `true` for invalid state.\n\t */\n\t@Input() invalid = false;\n\t/**\n\t * Value displayed if dropdown is in invalid state.\n\t */\n\t@Input() invalidText: string | TemplateRef<any>;\n\t/**\n\t * Set to `true` to show a warning (contents set by warningText)\n\t */\n\t@Input() warn = false;\n\t/**\n\t * Sets the warning text\n\t */\n\t@Input() warnText: string | TemplateRef<any>;\n\t/**\n\t * set to `true` to place the dropdown view inline with the component\n\t */\n\t@Input() appendInline: boolean = null;\n\t/**\n\t * Query string for the element that contains the `Dropdown`.\n\t * Used to trigger closing the dropdown if it scrolls outside of the viewport of the `scrollableContainer`.\n\t */\n\t@Input() scrollableContainer: string;\n\t/**\n\t * Specifies the property to be used as the return value to `ngModel`\n\t */\n\t@Input() itemValueKey: string;\n\t/**\n\t * Specify feedback (mode) of the selection.\n\t * `top`: selected item jumps to top\n\t * `fixed`: selected item stays at it's position\n\t * `top-after-reopen`: selected item jump to top after reopen dropdown\n\t */\n\t@Input() selectionFeedback: \"top\" | \"fixed\" | \"top-after-reopen\" = \"top-after-reopen\";\n\t/**\n\t * Accessible label for the button that opens the dropdown list.\n\t * Defaults to the `DROPDOWN.OPEN` value from the i18n service.\n\t */\n\t@Input() menuButtonLabel = this.i18n.get().DROPDOWN.OPEN;\n\t/**\n\t * Provides the label for the \"# selected\" text.\n\t * Defaults to the `DROPDOWN.SELECTED` value from the i18n service.\n\t */\n\t@Input() selectedLabel = this.i18n.get().DROPDOWN.SELECTED;\n\t/**\n\t * Overrides the automatic dropUp.\n\t */\n\t@Input() dropUp: boolean;\n\t/**\n\t * Set to `true` to allow null values in the dropdown ListItems.\n\t */\n\t@Input() allowNullValues = false;\n\t/**\n\t * Emits selection events.\n\t */\n\t@Output() selected: EventEmitter<Object> = new EventEmitter<Object>();\n\t/**\n\t * Emits event notifying to other classes that the `Dropdown` has been closed (collapsed).\n\t */\n\t@Output() onClose: EventEmitter<any> = new EventEmitter<any>();\n\t/**\n\t * Emits event notifying to other classes that the `Dropdown` has been closed (collapsed).\n\t */\n\t@Output() close: EventEmitter<any> = new EventEmitter<any>();\n\n\t/**\n\t * Maintains a reference to the `AbstractDropdownView` object within the content DOM.\n\t */\n\t@ContentChild(AbstractDropdownView, { static: true }) view: AbstractDropdownView;\n\t/**\n\t * Maintains a reference to the view DOM element of the `Dropdown` button.\n\t */\n\t@ViewChild(\"dropdownButton\", { static: true }) dropdownButton;\n\t/**\n\t * ViewChid of the dropdown view.\n\t */\n\t@ViewChild(\"dropdownMenu\", { static: true }) dropdownMenu;\n\n\t@HostBinding(\"class.cds--dropdown__wrapper\") hostClass = true;\n\n\t@HostBinding(\"class.cds--list-box__wrapper\") hostWrapperClass = true;\n\n\t@HostBinding(\"class.cds--list-box__wrapper--decorator\") get hasDecorator() {\n\t\treturn !!this.decorator;\n\t}\n\n\t/**\n\t * Experimental: enable fluid state\n\t */\n\t@HostBinding(\"class.cds--list-box__wrapper--fluid\") @Input() fluid = false;\n\n\t/**\n\t * Set to `true` if the dropdown is closed (not expanded).\n\t */\n\tmenuIsClosed = true;\n\n\t/**\n\t * controls whether the `drop-up` class is applied\n\t */\n\t_dropUp = false;\n\n\t// .bind creates a new function, so we declare the methods below\n\t// but .bind them up here\n\tnoop = this._noop.bind(this);\n\toutsideClick = this._outsideClick.bind(this);\n\toutsideKey = this._outsideKey.bind(this);\n\tkeyboardNav = this._keyboardNav.bind(this);\n\n\tprotected visibilitySubscription = new Subscription();\n\n\tprotected onTouchedCallback: () => void = this._noop;\n\n\tprotected _isFocused = false;\n\n\t// primarily used to capture and propagate input to `writeValue` before the content is available\n\tprivate _writtenValue: any = [];\n\n\tprivate _isUsingNgControl = false;\n\n\tprivate selectionSubscription: Subscription;\n\n\t/**\n\t * Creates an instance of Dropdown.\n\t */\n\tconstructor(\n\t\tprotected elementRef: ElementRef,\n\t\tprotected i18n: I18n,\n\t\tprotected dropdownService: DropdownService,\n\t\tprotected elementService: ElementService) {}\n\n\t/**\n\t * Updates the `type` property in the `@ContentChild`.\n\t * The `type` property specifies whether the `Dropdown` allows single selection or multi selection.\n\t */\n\tngOnInit() {\n\t\tif (this.view) {\n\t\t\tthis.view.type = this.type;\n\t\t}\n\t}\n\n\t/**\n\t * Initializes classes and subscribes to events for single or multi selection.\n\t */\n\tngAfterContentInit() {\n\t\tif (!this.view) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.view.type = this.type;\n\t\tthis.view.size = this.size;\n\n\t\t// function to check if the event is organic (isUpdate === false) or programmatic\n\t\tconst isUpdate = event => event && event.isUpdate;\n\n\t\tthis.selectionSubscription = this.view.select.subscribe(event => {\n\t\t\tif (this.type === \"single\" && !isUpdate(event) && !Array.isArray(event)) {\n\t\t\t\tthis.closeMenu();\n\t\t\t\tif (event.item && event.item.selected) {\n\t\t\t\t\tif (this.itemValueKey) {\n\t\t\t\t\t\tthis._propagateChange(event.item[this.itemValueKey]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis._propagateChange(event.item);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthis._propagateChange(null);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.type === \"multi\" && !isUpdate(event)) {\n\t\t\t\t// if we have a `value` selector and selected items map them appropriately\n\t\t\t\tif (this.itemValueKey && this.view.getSelected()) {\n\t\t\t\t\tconst values = this.view.getSelected().map(item => item[this.itemValueKey]);\n\t\t\t\t\tthis._propagateChange(values);\n\t\t\t\t\t// otherwise just pass up the values from `getSelected`\n\t\t\t\t} else {\n\t\t\t\t\tthis._propagateChange(this.view.getSelected());\n\t\t\t\t}\n\t\t\t}\n\t\t\t// only emit selected for \"organic\" selections\n\t\t\tif (!isUpdate(event)) {\n\t\t\t\tthis.checkForReorder();\n\t\t\t\tthis.selected.emit(event);\n\t\t\t} else if (this._isUsingNgControl) {\n\t\t\t\tthis.writeValue(this.writtenValue);\n\t\t\t}\n\t\t});\n\t}\n\n\tngAfterViewInit() {\n\t\t// if appendInline is default valued (null) we should:\n\t\t// 1. if there are scrollable parents (not including body) don't append inline\n\t\t// this should also cover the case where the dropdown is in a modal\n\t\t// (where we _do_ want to append to the placeholder)\n\t\tif (this.appendInline === null && hasScrollableParents(this.elementRef.nativeElement)) {\n\t\t\tthis.appendInline = false;\n\t\t\t// 2. otherwise we should append inline\n\t\t} else if (this.appendInline === null) {\n\t\t\tthis.appendInline = true;\n\t\t}\n\t\tthis.checkForReorder();\n\t}\n\n\t/**\n\t * Removing the `Dropdown` from the body if it is appended to the body.\n\t */\n\tngOnDestroy() {\n\t\tif (!this.appendInline) {\n\t\t\tthis._appendToDropdown();\n\t\t}\n\n\t\tthis.visibilitySubscription?.unsubscribe();\n\t\tthis.selectionSubscription?.unsubscribe();\n\t}\n\n\t/**\n\t * Propagates the injected `value`.\n\t */\n\twriteValue(value: any) {\n\t\t// cache the written value so we can use it in `AfterContentInit`\n\t\tthis.writtenValue = value;\n\t\tthis.view.onItemsReady(() => {\n\t\t\t// propagate null/undefined as an array (deselect everything) unless `allowNullValues` is true\n\t\t\tif (isUndefined(value) || (isNull(value) && !this.allowNullValues)) {\n\t\t\t\tthis.view.propagateSelected([value]);\n\t\t\t} else if (this.type === \"single\") {\n\t\t\t\tif (this.itemValueKey) {\n\t\t\t\t\t// clone the specified item and update its state\n\t\t\t\t\tconst newValue = Object.assign({}, this.view.getListItems().find(item => item[this.itemValueKey] === value));\n\t\t\t\t\tnewValue.selected = true;\n\t\t\t\t\tthis.view.propagateSelected([newValue]);\n\t\t\t\t} else {\n\t\t\t\t\t// pass the singular value as an array of ListItem\n\t\t\t\t\tthis.view.propagateSelected([value]);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (this.itemValueKey) {\n\t\t\t\t\t// clone the items and update their state based on the received value array\n\t\t\t\t\t// this way we don't lose any additional metadata that may be passed in via the `items` Input\n\t\t\t\t\tlet newValues = [];\n\t\t\t\t\tfor (const v of value) {\n\t\t\t\t\t\tfor (const item of this.view.getListItems()) {\n\t\t\t\t\t\t\tif (item[this.itemValueKey] === v) {\n\t\t\t\t\t\t\t\tnewValues.push(Object.assign({}, item, { selected: true }));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tthis.view.propagateSelected(newValues);\n\t\t\t\t} else {\n\t\t\t\t\t// we can safely assume we're passing an array of `ListItem`s\n\t\t\t\t\tthis.view.propagateSelected(value || [value]);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.checkForReorder();\n\t\t});\n\t}\n\n\tonBlur() {\n\t\tthis.onTouchedCallback();\n\t}\n\n\tregisterOnChange(fn: any) {\n\t\tthis._isUsingNgControl = true;\n\t\tthis.propagateChange = fn;\n\t}\n\n\t/**\n\t * Registering the function injected to control the touch use of the `Dropdown`.\n\t */\n\tregisterOnTouched(fn: any) {\n\t\tthis.onTouchedCallback = fn;\n\t}\n\n\t/**\n\t * function passed in by `registerOnChange`\n\t */\n\tpropagateChange = (_: any) => { };\n\n\t// used only to update writtenValue\n\tprivate _propagateChange(value: any) {\n\t\tthis.writtenValue = value;\n\t\tthis.propagateChange(value);\n\t}\n\n\t/**\n\t * `ControlValueAccessor` method to programmatically disable the dropdown.\n\t *\n\t * ex: `this.formGroup.get(\"myDropdown\").disable();`\n\t *\n\t * @param isDisabled `true` to disable the input\n\t */\n\tsetDisabledState(isDisabled: boolean) {\n\t\tthis.disabled = isDisabled;\n\t}\n\n\t/**\n\t * Adds keyboard functionality for navigation, selection and closing of the `Dropdown`.\n\t */\n\t@HostListener(\"keydown\", [\"$event\"])\n\tonKeyDown(event: KeyboardEvent) {\n\t\tif (this.readonly) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ((event.key === \"Escape\") && !this.menuIsClosed) {\n\t\t\tevent.stopImmediatePropagation(); // don't unintentionally close other widgets that listen for Escape\n\t\t}\n\t\tif (event.key === \"Escape\") {\n\t\t\tevent.preventDefault();\n\t\t\tthis.closeMenu();\n\t\t\tthis.dropdownButton.nativeElement.focus();\n\t\t} else if (this.menuIsClosed && (event.key === \" \" || event.key === \"ArrowDown\" || event.key === \"ArrowUp\")) {\n\t\t\tif (this.disableArrowKeys && (event.key === \"ArrowDown\" || event.key === \"ArrowUp\")) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tevent.preventDefault();\n\t\t\tthis.openMenu();\n\t\t}\n\n\t\tif (!this.menuIsClosed && event.key === \"Tab\" && this.dropdownMenu.nativeElement.contains(event.target as Node)) {\n\t\t\tthis.closeMenu();\n\t\t}\n\n\t\tif (!this.menuIsClosed && event.key === \"Tab\" && event.shiftKey) {\n\t\t\tthis.closeMenu();\n\t\t}\n\n\t\tif (this.type === \"multi\") { return; }\n\n\t\tif (this.menuIsClosed) {\n\t\t\tthis.closedDropdownNavigation(event);\n\t\t}\n\t}\n\n\tclosedDropdownNavigation(event) {\n\t\tif (event.key === \"ArrowDown\") {\n\t\t\tevent.preventDefault();\n\t\t\tthis.view.getCurrentItem().selected = false;\n\t\t\tlet item = this.view.getNextItem();\n\t\t\tif (item) { item.selected = true; }\n\t\t} else if (event.key === \"ArrowUp\") {\n\t\t\tevent.preventDefault();\n\t\t\tthis.view.getCurrentItem().selected = false;\n\t\t\tlet item = this.view.getPrevItem();\n\t\t\tif (item) { item.selected = true; }\n\t\t}\n\t}\n\n\t/**\n\t * Returns the display value if there is a selection and displayValue is set,\n\t * if there is just a selection the ListItem content property will be returned,\n\t * otherwise the placeholder will be returned.\n\t */\n\tgetDisplayStringValue(): Observable<string> {\n\t\tif (!this.view || this.skeleton) {\n\t\t\treturn;\n\t\t}\n\t\tlet selected = this.view.getSelected();\n\t\tif (selected.length && (!this.displayValue || !this.isRenderString())) {\n\t\t\tif (this.type === \"multi\") {\n\t\t\t\treturn of(this.placeholder);\n\t\t\t} else {\n\t\t\t\treturn of(selected[0].content);\n\t\t\t}\n\t\t} else if (selected.length && this.isRenderString()) {\n\t\t\treturn of(this.displayValue as string);\n\t\t}\n\t\treturn of(this.placeholder);\n\t}\n\n\tisRenderString(): boolean {\n\t\treturn typeof this.displayValue === \"string\";\n\t}\n\n\tgetRenderTemplateContext() {\n\t\tif (!this.view) {\n\t\t\treturn;\n\t\t}\n\t\tlet selected = this.view.getSelected();\n\t\tif (this.type === \"multi\") {\n\t\t\treturn { items: selected };\n\t\t} else if (selected && selected.length > 0) {\n\t\t\treturn { item: selected[0] }; // this is to be compatible with the dropdown-list template\n\t\t} else {\n\t\t\treturn {};\n\t\t}\n\t}\n\n\tgetSelectedCount(): number {\n\t\tif (this.view.getSelected()) {\n\t\t\treturn this.view.getSelected().length;\n\t\t}\n\t}\n\n\tclearSelected() {\n\t\tif (this.disabled || this.getSelectedCount() === 0) {\n\t\t\treturn;\n\t\t}\n\t\tfor (const item of this.view.getListItems()) {\n\t\t\titem.selected = false;\n\t\t}\n\t\tthis.selected.emit([]);\n\t\tthis._propagateChange([]);\n\t}\n\n\t/**\n\t * Returns `true` if there is a value selected.\n\t */\n\tvalueSelected(): boolean {\n\t\tif (this.view.getSelected()) { return true; }\n\t\treturn false;\n\t}\n\n\t_noop() { }\n\t/**\n\t * Handles clicks outside of the `Dropdown`.\n\t */\n\t_outsideClick(event) {\n\t\tif (!this.elementRef.nativeElement.contains(event.target) &&\n\t\t\t// if we're appendToBody the list isn't within the _elementRef,\n\t\t\t// so we've got to check if our target is possibly in there too.\n\t\t\t!this.dropdownMenu.nativeElement.contains(event.target)) {\n\t\t\tthis.closeMenu();\n\t\t}\n\t}\n\t_outsideKey(event) {\n\t\tif (!this.menuIsClosed && event.key === \"Tab\" && this.dropdownMenu.nativeElement.contains(event.target as Node)) {\n\t\t\tthis.closeMenu();\n\t\t}\n\t}\n\t/**\n\t * Handles keyboard events so users are controlling the `Dropdown` instead of unintentionally controlling outside elements.\n\t */\n\t_keyboardNav(event: KeyboardEvent) {\n\t\tif (event.key === \"Escape\" && !this.menuIsClosed) {\n\t\t\tevent.stopImmediatePropagation(); // don't unintentionally close modal if inside of it\n\t\t}\n\t\tif (event.key === \"Escape\") {\n\t\t\tevent.preventDefault();\n\t\t\tthis.closeMenu();\n\t\t\tthis.dropdownButton.nativeElement.focus();\n\t\t} else if (!this.menuIsClosed && event.key === \"Tab\") {\n\t\t\t// this way focus will start on the next focusable item from the dropdown\n\t\t\t// not the top of the body!\n\t\t\tthis.dropdownButton.nativeElement.focus();\n\t\t\tthis.dropdownButton.nativeElement.dispatchEvent(new KeyboardEvent(\"keydown\", { bubbles: true, cancelable: true, key: \"Tab\" }));\n\t\t\tthis.closeMenu();\n\t\t}\n\t}\n\n\t/**\n\t * Creates the `Dropdown` list appending it to the dropdown parent object instead of the body.\n\t */\n\t_appendToDropdown() {\n\t\tthis.dropdownService.appendToDropdown(this.elementRef.nativeElement);\n\t\tthis.dropdownMenu.nativeElement.removeEventListener(\"keydown\", this.keyboardNav, true);\n\t}\n\n\t/**\n\t * Creates the `Dropdown` list as an element that is appended to the DOM body.\n\t */\n\t_appendToBody() {\n\t\tconst lightClass = this.theme === \"light\" ? \" cds--list-box--light\" : \"\";\n\t\tconst expandedClass = !this.menuIsClosed ? \" cds--list-box--expanded\" : \"\";\n\t\tthis.dropdownService.appendToBody(\n\t\t\tthis.dropdownButton.nativeElement,\n\t\t\tthis.dropdownMenu.nativeElement,\n\t\t\t`${this.elementRef.nativeElement.className}${lightClass}${expandedClass}`);\n\t\tthis.dropdownMenu.nativeElement.addEventListener(\"keydown\", this.keyboardNav, true);\n\t}\n\n\t/**\n\t * Detects whether or not the `Dropdown` list is visible within all scrollable parents.\n\t * This can be overridden by passing in a value to the `dropUp` input.\n\t */\n\t_shouldDropUp() {\n\t\t// check if dropdownMenu exists first.\n\t\tconst menu = this.dropdownMenu && this.dropdownMenu.nativeElement.querySelector(\".cds--list-box__menu\");\n\t\t// check if menu exists first.\n\t\tconst menuRect = menu && menu.getBoundingClientRect();\n\t\tif (menu && menuRect) {\n\t\t\tconst scrollableParents = getScrollableParents(menu);\n\t\t\treturn scrollableParents.reduce((shouldDropUp: boolean, parent: HTMLElement) => {\n\t\t\t\tconst parentRect = parent.getBoundingClientRect();\n\t\t\t\tconst isBelowParent = !(menuRect.bottom <= parentRect.bottom);\n\t\t\t\treturn shouldDropUp || isBelowParent;\n\t\t\t}, false);\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * Expands the dropdown menu in the view.\n\t */\n\topenMenu() {\n\t\t// prevents the dropdown from opening when list of items is empty\n\t\tif (this.view.getListItems().length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._dropUp = false;\n\t\tthis.menuIsClosed = false;\n\n\t\t// move the dropdown list to the body if we're not appending inline\n\t\t// and position it relative to the dropdown wrapper\n\t\tif (!this.appendInline) {\n\t\t\tconst target = this.dropdownButton.nativeElement;\n\t\t\tconst parent = this.elementRef.nativeElement;\n\t\t\tthis.visibilitySubscription = this.elementService\n\t\t\t\t.visibility(target, parent)\n\t\t\t\t.subscribe(value => {\n\t\t\t\t\tif (!value.visible) {\n\t\t\t\t\t\tthis.closeMenu();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\tthis._appendToBody();\n\t\t}\n\n\t\t// set the dropdown menu to drop up if it's near the bottom of the screen\n\t\t// setTimeout lets us measure after it's visible in the DOM\n\t\tsetTimeout(() => {\n\t\t\tif (this.dropUp === null || this.dropUp === undefined) {\n\t\t\t\tthis._dropUp = this._shouldDropUp();\n\t\t\t}\n\t\t}, 0);\n\n\t\t// we bind noop to document.body.firstElementChild to allow safari to fire events\n\t\t// from document. Then we unbind everything later to keep things light.\n\t\tdocument.body.firstElementChild.addEventListener(\"click\", this.noop, true);\n\t\tdocument.body.firstElementChild.addEventListener(\"keydown\", this.noop, true);\n\t\tdocument.addEventListener(\"click\", this.outsideClick, true);\n\t\tdocument.addEventListener(\"keydown\", this.outsideKey, true);\n\t\tsetTimeout(() => this.view.initFocus(), 0);\n\t}\n\n\t/**\n\t * Collapsing the dropdown menu and removing unnecessary `EventListeners`.\n\t */\n\tcloseMenu() {\n\t\t// return early if the menu is already closed\n\t\tif (this.menuIsClosed) { return; }\n\t\tthis.menuIsClosed = true;\n\t\tthis.checkForReorder();\n\t\tthis.onClose.emit();\n\t\tthis.close.emit();\n\n\t\t// focus the trigger button when we close ...\n\t\tthis.dropdownButton.nativeElement.focus();\n\n\t\t// remove the conditional once this api is settled and part of abstract-dropdown-view.class\n\t\tif (this.view[\"disableScroll\"]) {\n\t\t\tthis.view[\"disableScroll\"]();\n\t\t}\n\n\t\t// move the list back in the component on close\n\t\tif (!this.appendInline) {\n\t\t\tthis.visibilitySubscription.unsubscribe();\n\t\t\tthis._appendToDropdown();\n\t\t}\n\t\tdocument.body.firstElementChild.removeEventListener(\"click\", this.noop, true);\n\t\tdocument.body.firstElementChild.removeEventListener(\"keydown\", this.noop, true);\n\t\tdocument.removeEventListener(\"click\", this.outsideClick, true);\n\t\tdocument.removeEventListener(\"keydown\", this.outsideKey, true);\n\t}\n\n\t/**\n\t * Controls toggling menu states between open/expanded and closed/collapsed.\n\t */\n\ttoggleMenu() {\n\t\tif (this.menuIsClosed) {\n\t\t\tthis.openMenu();\n\t\t} else {\n\t\t\tthis.closeMenu();\n\t\t}\n\t}\n\n\tpublic isTemplate(value) {\n\t\treturn value instanceof TemplateRef;\n\t}\n\n\thandleFocus(event: FocusEvent) {\n\t\tthis._isFocused = event.type === \"focus\";\n\t\tif (event.type === \"blur\") {\n\t\t\tthis.onBlur();\n\t\t}\n\t}\n\n\t/**\n\t * Controls when it's needed to apply the selection feedback\n\t */\n\tprotected checkForReorder() {\n\t\tconst topAfterReopen = this.menuIsClosed && this.selectionFeedback === \"top-after-reopen\";\n\t\tif ((this.type === \"multi\") && (topAfterReopen || this.selectionFeedback === \"top\")) {\n\t\t\tthis.view.reorderSelected();\n\t\t}\n\t}\n}\n",
|
|
33070
|
+
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tOutput,\n\tEventEmitter,\n\tElementRef,\n\tContentChild,\n\tOnInit,\n\tViewChild,\n\tAfterContentInit,\n\tHostListener,\n\tOnDestroy,\n\tHostBinding,\n\tTemplateRef,\n\tAfterViewInit\n} from \"@angular/core\";\nimport { NG_VALUE_ACCESSOR, ControlValueAccessor } from \"@angular/forms\";\n\n// Observable import is required here so typescript can compile correctly\nimport {\n\tObservable,\n\tof,\n\tSubscription\n} from \"rxjs\";\nimport { isNull, isUndefined } from \"lodash-es\";\n\nimport { AbstractDropdownView } from \"./abstract-dropdown-view.class\";\nimport { I18n } from \"carbon-components-angular/i18n\";\nimport { ListItem } from \"./list-item.interface\";\nimport { DropdownService } from \"./dropdown.service\";\nimport { ElementService, getScrollableParents } from \"carbon-components-angular/utils\";\nimport { hasScrollableParents } from \"carbon-components-angular/utils\";\n\n/**\n * Drop-down lists enable users to select one or more items from a list.\n *\n * #### Opening behavior/List DOM placement\n * By default the dropdown will try to figure out the best placement for the dropdown list.\n *\n * If it's not contained within any scrolling elements, it will open inline, if it _is_\n * contained within a scrolling container it will try to open in the body, or an `cds-placeholder`.\n *\n * To control this behavior you can use the `appendInline` input:\n * - `[appendInline]=\"null\"` is the default (auto detection)\n * - `[appendInline]=\"false\"` will always append to the body/`cds-placeholder`\n * - `[appendInline]=\"true\"` will always append inline (next to the dropdown button)\n *\n * Get started with importing the module:\n *\n * ```typescript\n * import { DropdownModule } from 'carbon-components-angular';\n * ```\n *\n * [See demo](../../?path=/story/components-dropdown--basic)\n */\n@Component({\n\tselector: \"cds-dropdown, ibm-dropdown\",\n\ttemplate: `\n\t<label\n\t\t*ngIf=\"label && !skeleton\"\n\t\t[for]=\"id\"\n\t\tclass=\"cds--label\"\n\t\t[ngClass]=\"{\n\t\t\t'cds--label--disabled': disabled,\n\t\t\t'cds--visually-hidden': hideLabel\n\t\t}\">\n\t\t<ng-container *ngIf=\"!isTemplate(label)\">{{label}}</ng-container>\n\t\t<ng-template *ngIf=\"isTemplate(label)\" [ngTemplateOutlet]=\"label\"></ng-template>\n\t</label>\n\t<div\n\t\tclass=\"cds--list-box\"\n\t\t[ngClass]=\"{\n\t\t\t'cds--dropdown': type !== 'multi' && !(skeleton && fluid),\n\t\t\t'cds--multiselect': type === 'multi',\n\t\t\t'cds--multi-select--selected': type === 'multi' && getSelectedCount() > 0,\n\t\t\t'cds--dropdown--light': theme === 'light',\n\t\t\t'cds--list-box--light': theme === 'light',\n\t\t\t'cds--list-box--inline': inline,\n\t\t\t'cds--skeleton': skeleton,\n\t\t\t'cds--dropdown--disabled cds--list-box--disabled': disabled,\n\t\t\t'cds--dropdown--readonly': readonly,\n\t\t\t'cds--dropdown--invalid': invalid,\n\t\t\t'cds--dropdown--warning cds--list-box--warning': warn,\n\t\t\t'cds--dropdown--sm cds--list-box--sm': size === 'sm',\n\t\t\t'cds--dropdown--md cds--list-box--md': size === 'md',\n\t\t\t'cds--dropdown--lg cds--list-box--lg': size === 'lg',\n\t\t\t'cds--list-box--expanded': !menuIsClosed,\n\t\t\t'cds--list-box--invalid': invalid\n\t\t}\"\n\t\t[attr.data-invalid]=\"invalid ? true : null\">\n\t\t<div *ngIf=\"skeleton && fluid\" class=\"cds--list-box__label\"></div>\n\t\t<button\n\t\t\t#dropdownButton\n\t\t\t[id]=\"id\"\n\t\t\ttype=\"button\"\n\t\t\tclass=\"cds--list-box__field\"\n\t\t\t[ngClass]=\"{'a': !menuIsClosed}\"\n\t\t\t[attr.aria-expanded]=\"!menuIsClosed\"\n\t\t\t[attr.aria-disabled]=\"disabled\"\n\t\t\taria-haspopup=\"listbox\"\n\t\t\t(click)=\"disabled || readonly ? $event.stopPropagation() : toggleMenu()\"\n\t\t\t(focus)=\"fluid ? handleFocus($event) : null\"\n\t\t\t(blur)=\"fluid ? handleFocus($event) : onBlur()\"\n\t\t\t[attr.disabled]=\"disabled ? true : null\">\n\t\t\t<div\n\t\t\t\t(click)=\"clearSelected()\"\n\t\t\t\t(keydown.enter)=\"clearSelected()\"\n\t\t\t\t*ngIf=\"type === 'multi' && getSelectedCount() > 0\"\n\t\t\t\tclass=\"cds--list-box__selection cds--tag--filter cds--list-box__selection--multi\"\n\t\t\t\ttabindex=\"0\"\n\t\t\t\t[title]=\"clearText\">\n\t\t\t\t{{getSelectedCount()}}\n\t\t\t\t<svg\n\t\t\t\t\tfocusable=\"false\"\n\t\t\t\t\tpreserveAspectRatio=\"xMidYMid meet\"\n\t\t\t\t\tstyle=\"will-change: transform;\"\n\t\t\t\t\trole=\"img\"\n\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t\twidth=\"16\"\n\t\t\t\t\theight=\"16\"\n\t\t\t\t\tviewBox=\"0 0 16 16\"\n\t\t\t\t\taria-hidden=\"true\">\n\t\t\t\t\t<path d=\"M12 4.7l-.7-.7L8 7.3 4.7 4l-.7.7L7.3 8 4 11.3l.7.7L8 8.7l3.3 3.3.7-.7L8.7 8z\"></path>\n\t\t\t\t</svg>\n\t\t\t</div>\n\t\t\t<span *ngIf=\"isRenderString()\" class=\"cds--list-box__label\">{{getDisplayStringValue() | async}}</span>\n\t\t\t<ng-template\n\t\t\t\t*ngIf=\"!isRenderString()\"\n\t\t\t\t[ngTemplateOutletContext]=\"getRenderTemplateContext()\"\n\t\t\t\t[ngTemplateOutlet]=\"displayValue\">\n\t\t\t</ng-template>\n\t\t\t<span class=\"cds--list-box__menu-icon\">\n\t\t\t\t<svg\n\t\t\t\t\t*ngIf=\"!skeleton\"\n\t\t\t\t\tcdsIcon=\"chevron--down\"\n\t\t\t\t\tsize=\"16\"\n\t\t\t\t\t[attr.aria-label]=\"menuButtonLabel\"\n\t\t\t\t\t[ngClass]=\"{'cds--list-box__menu-icon--open': !menuIsClosed }\">\n\t\t\t\t</svg>\n\t\t\t</span>\n\t\t</button>\n\t\t<ng-container *ngIf=\"decorator\">\n\t\t\t<div class=\"cds--list-box__inner-wrapper--decorator\">\n\t\t\t\t<ng-template [ngTemplateOutlet]=\"decorator\"></ng-template>\n\t\t\t</div>\n\t\t</ng-container>\n\t\t<svg\n\t\t\t*ngIf=\"invalid\"\n\t\t\tclass=\"cds--list-box__invalid-icon\"\n\t\t\tcdsIcon=\"warning--filled\"\n\t\t\tsize=\"16\">\n\t\t</svg>\n\t\t<svg\n\t\t\t*ngIf=\"!invalid && warn\"\n\t\t\tcdsIcon=\"warning--alt--filled\"\n\t\t\tsize=\"16\"\n\t\t\tclass=\"cds--list-box__invalid-icon cds--list-box__invalid-icon--warning\">\n\t\t</svg>\n\t\t<div\n\t\t\t#dropdownMenu\n\t\t\t[ngClass]=\"{\n\t\t\t\t'cds--list-box--up': this.dropUp !== null && this.dropUp !== undefined ? dropUp : _dropUp\n\t\t\t}\">\n\t\t\t<ng-content *ngIf=\"!menuIsClosed\"></ng-content>\n\t\t</div>\n\t</div>\n\t<hr *ngIf=\"fluid\" class=\"cds--list-box__divider\" />\n\t<div\n\t\t*ngIf=\"helperText && !invalid && !warn && !skeleton && !fluid\"\n\t\tclass=\"cds--form__helper-text\"\n\t\t[ngClass]=\"{\n\t\t\t'cds--form__helper-text--disabled': disabled\n\t\t}\">\n\t\t<ng-container *ngIf=\"!isTemplate(helperText)\">{{helperText}}</ng-container>\n\t\t<ng-template *ngIf=\"isTemplate(helperText)\" [ngTemplateOutlet]=\"helperText\"></ng-template>\n\t</div>\n\t<div *ngIf=\"invalid\" class=\"cds--form-requirement\">\n\t\t<ng-container *ngIf=\"!isTemplate(invalidText)\">{{ invalidText }}</ng-container>\n\t\t<ng-template *ngIf=\"isTemplate(invalidText)\" [ngTemplateOutlet]=\"invalidText\"></ng-template>\n\t</div>\n\t<div *ngIf=\"!invalid && warn\" class=\"cds--form-requirement\">\n\t\t<ng-container *ngIf=\"!isTemplate(warnText)\">{{warnText}}</ng-container>\n\t\t<ng-template *ngIf=\"isTemplate(warnText)\" [ngTemplateOutlet]=\"warnText\"></ng-template>\n\t</div>\n\t`,\n\tproviders: [\n\t\t{\n\t\t\tprovide: NG_VALUE_ACCESSOR,\n\t\t\tuseExisting: Dropdown,\n\t\t\tmulti: true\n\t\t}\n\t]\n})\nexport class Dropdown implements OnInit, AfterContentInit, AfterViewInit, OnDestroy, ControlValueAccessor {\n\t@HostBinding(\"class.cds--list-box__wrapper--fluid--invalid\") get fluidInvalidClass() {\n\t\treturn this.invalid && this.fluid;\n\t}\n\n\t@HostBinding(\"class.cds--list-box__wrapper--fluid--focus\") get fluidFocusClass() {\n\t\treturn this.fluid && this._isFocused && this.menuIsClosed;\n\t}\n\n\t@HostBinding(\"class.cds--list-box__wrapper--decorator\") get hasDecorator() {\n\t\treturn !!this.decorator;\n\t}\n\n\tprotected get writtenValue() {\n\t\treturn this._writtenValue;\n\t}\n\n\tprotected set writtenValue(val: any[]) {\n\t\tif (val && val.length === 0) {\n\t\t\tthis.clearSelected();\n\t\t}\n\t\tthis._writtenValue = val;\n\t}\n\n\tstatic dropdownCount = 0;\n\n\t@Input() id = `dropdown-${Dropdown.dropdownCount++}`;\n\t/**\n\t * Label for the dropdown.\n\t */\n\t@Input() label: string | TemplateRef<any>;\n\t/**\n\t * Hide label while keeping it accessible for screen readers\n\t */\n\t@Input() hideLabel = false;\n\t/**\n\t * Sets the optional helper text.\n\t */\n\t@Input() helperText: string | TemplateRef<any>;\n\t/**\n\t * **Experimental**: Optional decorator (e.g. AI label).\n\t */\n\t@Input() decorator: TemplateRef<any>;\n\t/**\n\t * Value displayed if no item is selected.\n\t */\n\t@Input() placeholder = \"\";\n\t/**\n\t * The selected value from the `Dropdown`. Can be a string or template.\n\t */\n\t@Input() displayValue: string | TemplateRef<any> = \"\";\n\t/**\n\t * Sets the optional clear button tooltip text.\n\t */\n\t@Input() clearText: string = this.i18n.get().DROPDOWN.CLEAR;\n\t/**\n\t * Size to render the dropdown field.\n\t */\n\t@Input() size: \"sm\" | \"md\" | \"lg\" = \"md\";\n\t/**\n\t * Defines whether or not the `Dropdown` supports selecting multiple items as opposed to single\n\t * item selection.\n\t */\n\t@Input() type: \"single\" | \"multi\" = \"single\";\n\t/**\n\t * @deprecated since v5 - Use `cdsLayer` directive instead\n\t * `light` or `dark` dropdown theme\n\t */\n\t@Input() theme: \"light\" | \"dark\" = \"dark\";\n\t/**\n\t * Set to `true` to disable the dropdown.\n\t */\n\t@Input() disabled = false;\n\t/**\n\t * Set to `true` for a readonly state.\n\t */\n\t@Input() readonly = false;\n\t/**\n\t * Set to `true` for a loading dropdown.\n\t */\n\t@Input() skeleton = false;\n\t/**\n\t * Set to `true` for an inline dropdown.\n\t */\n\t@Input() inline = false;\n\t/**\n\t * Set to `true` for a dropdown without arrow key activation.\n\t */\n\t@Input() disableArrowKeys = false;\n\t/**\n\t * Set to `true` for invalid state.\n\t */\n\t@Input() invalid = false;\n\t/**\n\t * Value displayed if dropdown is in invalid state.\n\t */\n\t@Input() invalidText: string | TemplateRef<any>;\n\t/**\n\t * Set to `true` to show a warning (contents set by warningText)\n\t */\n\t@Input() warn = false;\n\t/**\n\t * Sets the warning text\n\t */\n\t@Input() warnText: string | TemplateRef<any>;\n\t/**\n\t * set to `true` to place the dropdown view inline with the component\n\t */\n\t@Input() appendInline: boolean = null;\n\t/**\n\t * Query string for the element that contains the `Dropdown`.\n\t * Used to trigger closing the dropdown if it scrolls outside of the viewport of the `scrollableContainer`.\n\t */\n\t@Input() scrollableContainer: string;\n\t/**\n\t * Specifies the property to be used as the return value to `ngModel`\n\t */\n\t@Input() itemValueKey: string;\n\t/**\n\t * Specify feedback (mode) of the selection.\n\t * `top`: selected item jumps to top\n\t * `fixed`: selected item stays at it's position\n\t * `top-after-reopen`: selected item jump to top after reopen dropdown\n\t */\n\t@Input() selectionFeedback: \"top\" | \"fixed\" | \"top-after-reopen\" = \"top-after-reopen\";\n\t/**\n\t * Accessible label for the button that opens the dropdown list.\n\t * Defaults to the `DROPDOWN.OPEN` value from the i18n service.\n\t */\n\t@Input() menuButtonLabel = this.i18n.get().DROPDOWN.OPEN;\n\t/**\n\t * Provides the label for the \"# selected\" text.\n\t * Defaults to the `DROPDOWN.SELECTED` value from the i18n service.\n\t */\n\t@Input() selectedLabel = this.i18n.get().DROPDOWN.SELECTED;\n\t/**\n\t * Overrides the automatic dropUp.\n\t */\n\t@Input() dropUp: boolean;\n\t/**\n\t * Set to `true` to allow null values in the dropdown ListItems.\n\t */\n\t@Input() allowNullValues = false;\n\t/**\n\t * Emits selection events.\n\t */\n\t@Output() selected: EventEmitter<Object> = new EventEmitter<Object>();\n\t/**\n\t * Emits event notifying to other classes that the `Dropdown` has been closed (collapsed).\n\t */\n\t@Output() onClose: EventEmitter<any> = new EventEmitter<any>();\n\t/**\n\t * Emits event notifying to other classes that the `Dropdown` has been closed (collapsed).\n\t */\n\t@Output() close: EventEmitter<any> = new EventEmitter<any>();\n\n\t/**\n\t * Maintains a reference to the `AbstractDropdownView` object within the content DOM.\n\t */\n\t@ContentChild(AbstractDropdownView, { static: true }) view: AbstractDropdownView;\n\t/**\n\t * Maintains a reference to the view DOM element of the `Dropdown` button.\n\t */\n\t@ViewChild(\"dropdownButton\", { static: true }) dropdownButton;\n\t/**\n\t * ViewChid of the dropdown view.\n\t */\n\t@ViewChild(\"dropdownMenu\", { static: true }) dropdownMenu;\n\n\t@HostBinding(\"class.cds--dropdown__wrapper\") hostClass = true;\n\n\t@HostBinding(\"class.cds--list-box__wrapper\") hostWrapperClass = true;\n\n\t/**\n\t * Experimental: enable fluid state\n\t */\n\t@HostBinding(\"class.cds--list-box__wrapper--fluid\") @Input() fluid = false;\n\n\t/**\n\t * Set to `true` if the dropdown is closed (not expanded).\n\t */\n\tmenuIsClosed = true;\n\n\t/**\n\t * controls whether the `drop-up` class is applied\n\t */\n\t_dropUp = false;\n\n\t// .bind creates a new function, so we declare the methods below\n\t// but .bind them up here\n\tnoop = this._noop.bind(this);\n\toutsideClick = this._outsideClick.bind(this);\n\toutsideKey = this._outsideKey.bind(this);\n\tkeyboardNav = this._keyboardNav.bind(this);\n\n\tprotected visibilitySubscription = new Subscription();\n\n\tprotected onTouchedCallback: () => void = this._noop;\n\n\tprotected _isFocused = false;\n\n\t// primarily used to capture and propagate input to `writeValue` before the content is available\n\tprivate _writtenValue: any = [];\n\n\tprivate _isUsingNgControl = false;\n\n\tprivate selectionSubscription: Subscription;\n\n\t/**\n\t * Creates an instance of Dropdown.\n\t */\n\tconstructor(\n\t\tprotected elementRef: ElementRef,\n\t\tprotected i18n: I18n,\n\t\tprotected dropdownService: DropdownService,\n\t\tprotected elementService: ElementService) {}\n\n\t/**\n\t * Updates the `type` property in the `@ContentChild`.\n\t * The `type` property specifies whether the `Dropdown` allows single selection or multi selection.\n\t */\n\tngOnInit() {\n\t\tif (this.view) {\n\t\t\tthis.view.type = this.type;\n\t\t}\n\t}\n\n\t/**\n\t * Initializes classes and subscribes to events for single or multi selection.\n\t */\n\tngAfterContentInit() {\n\t\tif (!this.view) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.view.type = this.type;\n\t\tthis.view.size = this.size;\n\n\t\t// function to check if the event is organic (isUpdate === false) or programmatic\n\t\tconst isUpdate = event => event && event.isUpdate;\n\n\t\tthis.selectionSubscription = this.view.select.subscribe(event => {\n\t\t\tif (this.type === \"single\" && !isUpdate(event) && !Array.isArray(event)) {\n\t\t\t\tthis.closeMenu();\n\t\t\t\tif (event.item && event.item.selected) {\n\t\t\t\t\tif (this.itemValueKey) {\n\t\t\t\t\t\tthis._propagateChange(event.item[this.itemValueKey]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis._propagateChange(event.item);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthis._propagateChange(null);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (this.type === \"multi\" && !isUpdate(event)) {\n\t\t\t\t// if we have a `value` selector and selected items map them appropriately\n\t\t\t\tif (this.itemValueKey && this.view.getSelected()) {\n\t\t\t\t\tconst values = this.view.getSelected().map(item => item[this.itemValueKey]);\n\t\t\t\t\tthis._propagateChange(values);\n\t\t\t\t\t// otherwise just pass up the values from `getSelected`\n\t\t\t\t} else {\n\t\t\t\t\tthis._propagateChange(this.view.getSelected());\n\t\t\t\t}\n\t\t\t}\n\t\t\t// only emit selected for \"organic\" selections\n\t\t\tif (!isUpdate(event)) {\n\t\t\t\tthis.checkForReorder();\n\t\t\t\tthis.selected.emit(event);\n\t\t\t} else if (this._isUsingNgControl) {\n\t\t\t\tthis.writeValue(this.writtenValue);\n\t\t\t}\n\t\t});\n\t}\n\n\tngAfterViewInit() {\n\t\t// if appendInline is default valued (null) we should:\n\t\t// 1. if there are scrollable parents (not including body) don't append inline\n\t\t// this should also cover the case where the dropdown is in a modal\n\t\t// (where we _do_ want to append to the placeholder)\n\t\tif (this.appendInline === null && hasScrollableParents(this.elementRef.nativeElement)) {\n\t\t\tthis.appendInline = false;\n\t\t\t// 2. otherwise we should append inline\n\t\t} else if (this.appendInline === null) {\n\t\t\tthis.appendInline = true;\n\t\t}\n\t\tthis.checkForReorder();\n\t}\n\n\t/**\n\t * Removing the `Dropdown` from the body if it is appended to the body.\n\t */\n\tngOnDestroy() {\n\t\tif (!this.appendInline) {\n\t\t\tthis._appendToDropdown();\n\t\t}\n\n\t\tthis.visibilitySubscription?.unsubscribe();\n\t\tthis.selectionSubscription?.unsubscribe();\n\t}\n\n\t/**\n\t * Propagates the injected `value`.\n\t */\n\twriteValue(value: any) {\n\t\t// cache the written value so we can use it in `AfterContentInit`\n\t\tthis.writtenValue = value;\n\t\tthis.view.onItemsReady(() => {\n\t\t\t// propagate null/undefined as an array (deselect everything) unless `allowNullValues` is true\n\t\t\tif (isUndefined(value) || (isNull(value) && !this.allowNullValues)) {\n\t\t\t\tthis.view.propagateSelected([value]);\n\t\t\t} else if (this.type === \"single\") {\n\t\t\t\tif (this.itemValueKey) {\n\t\t\t\t\t// clone the specified item and update its state\n\t\t\t\t\tconst newValue = Object.assign({}, this.view.getListItems().find(item => item[this.itemValueKey] === value));\n\t\t\t\t\tnewValue.selected = true;\n\t\t\t\t\tthis.view.propagateSelected([newValue]);\n\t\t\t\t} else {\n\t\t\t\t\t// pass the singular value as an array of ListItem\n\t\t\t\t\tthis.view.propagateSelected([value]);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (this.itemValueKey) {\n\t\t\t\t\t// clone the items and update their state based on the received value array\n\t\t\t\t\t// this way we don't lose any additional metadata that may be passed in via the `items` Input\n\t\t\t\t\tlet newValues = [];\n\t\t\t\t\tfor (const v of value) {\n\t\t\t\t\t\tfor (const item of this.view.getListItems()) {\n\t\t\t\t\t\t\tif (item[this.itemValueKey] === v) {\n\t\t\t\t\t\t\t\tnewValues.push(Object.assign({}, item, { selected: true }));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tthis.view.propagateSelected(newValues);\n\t\t\t\t} else {\n\t\t\t\t\t// we can safely assume we're passing an array of `ListItem`s\n\t\t\t\t\tthis.view.propagateSelected(value || [value]);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.checkForReorder();\n\t\t});\n\t}\n\n\tonBlur() {\n\t\tthis.onTouchedCallback();\n\t}\n\n\tregisterOnChange(fn: any) {\n\t\tthis._isUsingNgControl = true;\n\t\tthis.propagateChange = fn;\n\t}\n\n\t/**\n\t * Registering the function injected to control the touch use of the `Dropdown`.\n\t */\n\tregisterOnTouched(fn: any) {\n\t\tthis.onTouchedCallback = fn;\n\t}\n\n\t/**\n\t * function passed in by `registerOnChange`\n\t */\n\tpropagateChange = (_: any) => { };\n\n\t/**\n\t * `ControlValueAccessor` method to programmatically disable the dropdown.\n\t *\n\t * ex: `this.formGroup.get(\"myDropdown\").disable();`\n\t *\n\t * @param isDisabled `true` to disable the input\n\t */\n\tsetDisabledState(isDisabled: boolean) {\n\t\tthis.disabled = isDisabled;\n\t}\n\n\t/**\n\t * Adds keyboard functionality for navigation, selection and closing of the `Dropdown`.\n\t */\n\t@HostListener(\"keydown\", [\"$event\"])\n\tonKeyDown(event: KeyboardEvent) {\n\t\tif (this.readonly) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ((event.key === \"Escape\") && !this.menuIsClosed) {\n\t\t\tevent.stopImmediatePropagation(); // don't unintentionally close other widgets that listen for Escape\n\t\t}\n\t\tif (event.key === \"Escape\") {\n\t\t\tevent.preventDefault();\n\t\t\tthis.closeMenu();\n\t\t\tthis.dropdownButton.nativeElement.focus();\n\t\t} else if (this.menuIsClosed && (event.key === \" \" || event.key === \"ArrowDown\" || event.key === \"ArrowUp\")) {\n\t\t\tif (this.disableArrowKeys && (event.key === \"ArrowDown\" || event.key === \"ArrowUp\")) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tevent.preventDefault();\n\t\t\tthis.openMenu();\n\t\t}\n\n\t\tif (!this.menuIsClosed && event.key === \"Tab\" && this.dropdownMenu.nativeElement.contains(event.target as Node)) {\n\t\t\tthis.closeMenu();\n\t\t}\n\n\t\tif (!this.menuIsClosed && event.key === \"Tab\" && event.shiftKey) {\n\t\t\tthis.closeMenu();\n\t\t}\n\n\t\tif (this.type === \"multi\") { return; }\n\n\t\tif (this.menuIsClosed) {\n\t\t\tthis.closedDropdownNavigation(event);\n\t\t}\n\t}\n\n\tclosedDropdownNavigation(event) {\n\t\tif (event.key === \"ArrowDown\") {\n\t\t\tevent.preventDefault();\n\t\t\tthis.view.getCurrentItem().selected = false;\n\t\t\tlet item = this.view.getNextItem();\n\t\t\tif (item) { item.selected = true; }\n\t\t} else if (event.key === \"ArrowUp\") {\n\t\t\tevent.preventDefault();\n\t\t\tthis.view.getCurrentItem().selected = false;\n\t\t\tlet item = this.view.getPrevItem();\n\t\t\tif (item) { item.selected = true; }\n\t\t}\n\t}\n\n\t/**\n\t * Returns the display value if there is a selection and displayValue is set,\n\t * if there is just a selection the ListItem content property will be returned,\n\t * otherwise the placeholder will be returned.\n\t */\n\tgetDisplayStringValue(): Observable<string> {\n\t\tif (!this.view || this.skeleton) {\n\t\t\treturn;\n\t\t}\n\t\tlet selected = this.view.getSelected();\n\t\tif (selected.length && (!this.displayValue || !this.isRenderString())) {\n\t\t\tif (this.type === \"multi\") {\n\t\t\t\treturn of(this.placeholder);\n\t\t\t} else {\n\t\t\t\treturn of(selected[0].content);\n\t\t\t}\n\t\t} else if (selected.length && this.isRenderString()) {\n\t\t\treturn of(this.displayValue as string);\n\t\t}\n\t\treturn of(this.placeholder);\n\t}\n\n\tisRenderString(): boolean {\n\t\treturn typeof this.displayValue === \"string\";\n\t}\n\n\tgetRenderTemplateContext() {\n\t\tif (!this.view) {\n\t\t\treturn;\n\t\t}\n\t\tlet selected = this.view.getSelected();\n\t\tif (this.type === \"multi\") {\n\t\t\treturn { items: selected };\n\t\t} else if (selected && selected.length > 0) {\n\t\t\treturn { item: selected[0] }; // this is to be compatible with the dropdown-list template\n\t\t} else {\n\t\t\treturn {};\n\t\t}\n\t}\n\n\tgetSelectedCount(): number {\n\t\tif (this.view.getSelected()) {\n\t\t\treturn this.view.getSelected().length;\n\t\t}\n\t}\n\n\tclearSelected() {\n\t\tif (this.disabled || this.getSelectedCount() === 0) {\n\t\t\treturn;\n\t\t}\n\t\tfor (const item of this.view.getListItems()) {\n\t\t\titem.selected = false;\n\t\t}\n\t\tthis.selected.emit([]);\n\t\tthis._propagateChange([]);\n\t}\n\n\t/**\n\t * Returns `true` if there is a value selected.\n\t */\n\tvalueSelected(): boolean {\n\t\tif (this.view.getSelected()) { return true; }\n\t\treturn false;\n\t}\n\n\t_noop() { }\n\t/**\n\t * Handles clicks outside of the `Dropdown`.\n\t */\n\t_outsideClick(event) {\n\t\tif (!this.elementRef.nativeElement.contains(event.target) &&\n\t\t\t// if we're appendToBody the list isn't within the _elementRef,\n\t\t\t// so we've got to check if our target is possibly in there too.\n\t\t\t!this.dropdownMenu.nativeElement.contains(event.target)) {\n\t\t\tthis.closeMenu();\n\t\t}\n\t}\n\t_outsideKey(event) {\n\t\tif (!this.menuIsClosed && event.key === \"Tab\" && this.dropdownMenu.nativeElement.contains(event.target as Node)) {\n\t\t\tthis.closeMenu();\n\t\t}\n\t}\n\t/**\n\t * Handles keyboard events so users are controlling the `Dropdown` instead of unintentionally controlling outside elements.\n\t */\n\t_keyboardNav(event: KeyboardEvent) {\n\t\tif (event.key === \"Escape\" && !this.menuIsClosed) {\n\t\t\tevent.stopImmediatePropagation(); // don't unintentionally close modal if inside of it\n\t\t}\n\t\tif (event.key === \"Escape\") {\n\t\t\tevent.preventDefault();\n\t\t\tthis.closeMenu();\n\t\t\tthis.dropdownButton.nativeElement.focus();\n\t\t} else if (!this.menuIsClosed && event.key === \"Tab\") {\n\t\t\t// this way focus will start on the next focusable item from the dropdown\n\t\t\t// not the top of the body!\n\t\t\tthis.dropdownButton.nativeElement.focus();\n\t\t\tthis.dropdownButton.nativeElement.dispatchEvent(new KeyboardEvent(\"keydown\", { bubbles: true, cancelable: true, key: \"Tab\" }));\n\t\t\tthis.closeMenu();\n\t\t}\n\t}\n\n\t/**\n\t * Creates the `Dropdown` list appending it to the dropdown parent object instead of the body.\n\t */\n\t_appendToDropdown() {\n\t\tthis.dropdownService.appendToDropdown(this.elementRef.nativeElement);\n\t\tthis.dropdownMenu.nativeElement.removeEventListener(\"keydown\", this.keyboardNav, true);\n\t}\n\n\t/**\n\t * Creates the `Dropdown` list as an element that is appended to the DOM body.\n\t */\n\t_appendToBody() {\n\t\tconst lightClass = this.theme === \"light\" ? \" cds--list-box--light\" : \"\";\n\t\tconst expandedClass = !this.menuIsClosed ? \" cds--list-box--expanded\" : \"\";\n\t\tthis.dropdownService.appendToBody(\n\t\t\tthis.dropdownButton.nativeElement,\n\t\t\tthis.dropdownMenu.nativeElement,\n\t\t\t`${this.elementRef.nativeElement.className}${lightClass}${expandedClass}`);\n\t\tthis.dropdownMenu.nativeElement.addEventListener(\"keydown\", this.keyboardNav, true);\n\t}\n\n\t/**\n\t * Detects whether or not the `Dropdown` list is visible within all scrollable parents.\n\t * This can be overridden by passing in a value to the `dropUp` input.\n\t */\n\t_shouldDropUp() {\n\t\t// check if dropdownMenu exists first.\n\t\tconst menu = this.dropdownMenu && this.dropdownMenu.nativeElement.querySelector(\".cds--list-box__menu\");\n\t\t// check if menu exists first.\n\t\tconst menuRect = menu && menu.getBoundingClientRect();\n\t\tif (menu && menuRect) {\n\t\t\tconst scrollableParents = getScrollableParents(menu);\n\t\t\treturn scrollableParents.reduce((shouldDropUp: boolean, parent: HTMLElement) => {\n\t\t\t\tconst parentRect = parent.getBoundingClientRect();\n\t\t\t\tconst isBelowParent = !(menuRect.bottom <= parentRect.bottom);\n\t\t\t\treturn shouldDropUp || isBelowParent;\n\t\t\t}, false);\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * Expands the dropdown menu in the view.\n\t */\n\topenMenu() {\n\t\t// prevents the dropdown from opening when list of items is empty\n\t\tif (this.view.getListItems().length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._dropUp = false;\n\t\tthis.menuIsClosed = false;\n\n\t\t// move the dropdown list to the body if we're not appending inline\n\t\t// and position it relative to the dropdown wrapper\n\t\tif (!this.appendInline) {\n\t\t\tconst target = this.dropdownButton.nativeElement;\n\t\t\tconst parent = this.elementRef.nativeElement;\n\t\t\tthis.visibilitySubscription = this.elementService\n\t\t\t\t.visibility(target, parent)\n\t\t\t\t.subscribe(value => {\n\t\t\t\t\tif (!value.visible) {\n\t\t\t\t\t\tthis.closeMenu();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\tthis._appendToBody();\n\t\t}\n\n\t\t// set the dropdown menu to drop up if it's near the bottom of the screen\n\t\t// setTimeout lets us measure after it's visible in the DOM\n\t\tsetTimeout(() => {\n\t\t\tif (this.dropUp === null || this.dropUp === undefined) {\n\t\t\t\tthis._dropUp = this._shouldDropUp();\n\t\t\t}\n\t\t}, 0);\n\n\t\t// we bind noop to document.body.firstElementChild to allow safari to fire events\n\t\t// from document. Then we unbind everything later to keep things light.\n\t\tdocument.body.firstElementChild.addEventListener(\"click\", this.noop, true);\n\t\tdocument.body.firstElementChild.addEventListener(\"keydown\", this.noop, true);\n\t\tdocument.addEventListener(\"click\", this.outsideClick, true);\n\t\tdocument.addEventListener(\"keydown\", this.outsideKey, true);\n\t\tsetTimeout(() => this.view.initFocus(), 0);\n\t}\n\n\t/**\n\t * Collapsing the dropdown menu and removing unnecessary `EventListeners`.\n\t */\n\tcloseMenu() {\n\t\t// return early if the menu is already closed\n\t\tif (this.menuIsClosed) { return; }\n\t\tthis.menuIsClosed = true;\n\t\tthis.checkForReorder();\n\t\tthis.onClose.emit();\n\t\tthis.close.emit();\n\n\t\t// focus the trigger button when we close ...\n\t\tthis.dropdownButton.nativeElement.focus();\n\n\t\t// remove the conditional once this api is settled and part of abstract-dropdown-view.class\n\t\tif (this.view[\"disableScroll\"]) {\n\t\t\tthis.view[\"disableScroll\"]();\n\t\t}\n\n\t\t// move the list back in the component on close\n\t\tif (!this.appendInline) {\n\t\t\tthis.visibilitySubscription.unsubscribe();\n\t\t\tthis._appendToDropdown();\n\t\t}\n\t\tdocument.body.firstElementChild.removeEventListener(\"click\", this.noop, true);\n\t\tdocument.body.firstElementChild.removeEventListener(\"keydown\", this.noop, true);\n\t\tdocument.removeEventListener(\"click\", this.outsideClick, true);\n\t\tdocument.removeEventListener(\"keydown\", this.outsideKey, true);\n\t}\n\n\t/**\n\t * Controls toggling menu states between open/expanded and closed/collapsed.\n\t */\n\ttoggleMenu() {\n\t\tif (this.menuIsClosed) {\n\t\t\tthis.openMenu();\n\t\t} else {\n\t\t\tthis.closeMenu();\n\t\t}\n\t}\n\n\tpublic isTemplate(value) {\n\t\treturn value instanceof TemplateRef;\n\t}\n\n\thandleFocus(event: FocusEvent) {\n\t\tthis._isFocused = event.type === \"focus\";\n\t\tif (event.type === \"blur\") {\n\t\t\tthis.onBlur();\n\t\t}\n\t}\n\n\t/**\n\t * Controls when it's needed to apply the selection feedback\n\t */\n\tprotected checkForReorder() {\n\t\tconst topAfterReopen = this.menuIsClosed && this.selectionFeedback === \"top-after-reopen\";\n\t\tif ((this.type === \"multi\") && (topAfterReopen || this.selectionFeedback === \"top\")) {\n\t\t\tthis.view.reorderSelected();\n\t\t}\n\t}\n\n\t// used only to update writtenValue\n\tprivate _propagateChange(value: any) {\n\t\tthis.writtenValue = value;\n\t\tthis.propagateChange(value);\n\t}\n}\n",
|
|
33398
33071
|
"assetsDirs": [],
|
|
33399
33072
|
"styleUrlsData": "",
|
|
33400
33073
|
"stylesData": "",
|
|
@@ -33429,7 +33102,7 @@
|
|
|
33429
33102
|
"deprecationMessage": ""
|
|
33430
33103
|
}
|
|
33431
33104
|
],
|
|
33432
|
-
"line":
|
|
33105
|
+
"line": 400,
|
|
33433
33106
|
"rawdescription": "\n\nCreates an instance of Dropdown.\n",
|
|
33434
33107
|
"jsdoctags": [
|
|
33435
33108
|
{
|
|
@@ -33485,7 +33158,7 @@
|
|
|
33485
33158
|
"name": "fluidInvalidClass",
|
|
33486
33159
|
"type": "",
|
|
33487
33160
|
"returnType": "",
|
|
33488
|
-
"line":
|
|
33161
|
+
"line": 195
|
|
33489
33162
|
}
|
|
33490
33163
|
},
|
|
33491
33164
|
"fluidFocusClass": {
|
|
@@ -33494,7 +33167,7 @@
|
|
|
33494
33167
|
"name": "fluidFocusClass",
|
|
33495
33168
|
"type": "",
|
|
33496
33169
|
"returnType": "",
|
|
33497
|
-
"line":
|
|
33170
|
+
"line": 199
|
|
33498
33171
|
}
|
|
33499
33172
|
},
|
|
33500
33173
|
"hasDecorator": {
|
|
@@ -33503,7 +33176,7 @@
|
|
|
33503
33176
|
"name": "hasDecorator",
|
|
33504
33177
|
"type": "",
|
|
33505
33178
|
"returnType": "",
|
|
33506
|
-
"line":
|
|
33179
|
+
"line": 203
|
|
33507
33180
|
}
|
|
33508
33181
|
}
|
|
33509
33182
|
}
|
|
@@ -50152,7 +49825,7 @@
|
|
|
50152
49825
|
},
|
|
50153
49826
|
{
|
|
50154
49827
|
"name": "ProgressIndicator",
|
|
50155
|
-
"id": "component-ProgressIndicator-
|
|
49828
|
+
"id": "component-ProgressIndicator-a46722d410fe1612c8313d1b19c5e0b94e8a7cee9733cadb64b03c7327f17dc1c0feb2173b1b215e69050f1885316ea85b5eab41fa19b781919e2328cd82e999",
|
|
50156
49829
|
"file": "src/progress-indicator/progress-indicator.component.ts",
|
|
50157
49830
|
"encapsulation": [],
|
|
50158
49831
|
"entryComponents": [],
|
|
@@ -50162,7 +49835,7 @@
|
|
|
50162
49835
|
"selector": "cds-progress-indicator, ibm-progress-indicator",
|
|
50163
49836
|
"styleUrls": [],
|
|
50164
49837
|
"styles": [],
|
|
50165
|
-
"template": "<ul\n\tdata-progress\n\tdata-progress-current\n\tclass=\"cds--progress\"\n\t[ngClass]=\"{\n\t\t'cds--skeleton': skeleton,\n\t\t'cds--progress--vertical': (orientation === 'vertical'),\n\t\t'cds--progress--space-equal': spacing === 'equal' && orientation !== 'vertical'\n\t}\">\n\t<li\n\t\tclass=\"cds--progress-step\"\n\t\t*ngFor=\"let step of steps; let i = index\"\n\t\t[ngClass]=\"{\n\t\t\t'cds--progress-step--disabled' : step.disabled,\n\t\t\t'cds--progress-step--complete' : step.complete,\n\t\t\t'cds--progress-step--incomplete' : !step.complete && i !== current,\n\t\t\t'cds--progress-step--current': i === current\n\t\t}\">\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tclass=\"cds--progress-step-button\"\n\t\t\t[ngClass]=\"{\n\t\t\t\t'cds--progress-step-button--unclickable': !step.onClick || current === i\n\t\t\t}\"\n\t\t\t[disabled]=\"step.disabled\"\n\t\t\t[attr.aria-disabled]=\"step.disabled\"\n\t\t\t[tabindex]=\"(current !== i && step.onClick && !step.disabled) ? 0 : -1\"\n\t\t\t[title]=\"step.label\"\n\t\t\t(click)=\"onClick(i)\">\n\t\t\t<span class=\"cds--assistive-text\">\n\t\t\t\t{{this.translations[getCurrentState(i)?.toUpperCase()]}}\n\t\t\t</span>\n\t\t\t<svg\n\t\t\t\t[cdsIcon]=\"statusIcons[getCurrentState(i)]\"\n\t\t\t\tsize=\"16\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--progress__warning': step.invalid && i !== current\n\t\t\t\t}\">\n\t\t\t\t<title *ngIf=\"step.description\">{{step.description}}</title>\n\t\t\t</svg>\n\t\t\t<div class=\"cds--progress-text\">\n\t\t\t\t<p class=\"cds--progress-label\">{{step.label}}</p>\n\t\t\t\t<p *ngIf=\"step.secondaryLabel\" class=\"cds--progress-optional\">{{step.secondaryLabel}}</p>\n\t\t\t</div>\n\t\t\t<span class=\"cds--progress-line\"></span>\n\t\t</button>\n\t</li>\n</ul>\n",
|
|
49838
|
+
"template": "<ul\n\tdata-progress\n\tdata-progress-current\n\tclass=\"cds--progress\"\n\t[ngClass]=\"{\n\t\t'cds--skeleton': skeleton,\n\t\t'cds--progress--vertical': (orientation === 'vertical'),\n\t\t'cds--progress--space-equal': spacing === 'equal' && orientation !== 'vertical'\n\t}\">\n\t<li\n\t\tclass=\"cds--progress-step\"\n\t\t*ngFor=\"let step of steps; let i = index\"\n\t\t[ngClass]=\"{\n\t\t\t'cds--progress-step--disabled' : step.disabled,\n\t\t\t'cds--progress-step--complete' : step.complete,\n\t\t\t'cds--progress-step--incomplete' : !step.complete && i !== current,\n\t\t\t'cds--progress-step--current': i === current\n\t\t}\">\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tclass=\"cds--progress-step-button\"\n\t\t\t[ngClass]=\"{\n\t\t\t\t'cds--progress-step-button--unclickable': !step.onClick || current === i || skeleton\n\t\t\t}\"\n\t\t\t[disabled]=\"step.disabled\"\n\t\t\t[attr.aria-disabled]=\"step.disabled\"\n\t\t\t[tabindex]=\"(current !== i && step.onClick && !step.disabled) ? 0 : -1\"\n\t\t\t[title]=\"step.label\"\n\t\t\t(click)=\"onClick(i)\">\n\t\t\t<span class=\"cds--assistive-text\">\n\t\t\t\t{{this.translations[getCurrentState(i)?.toUpperCase()]}}\n\t\t\t</span>\n\t\t\t<svg\n\t\t\t\t[cdsIcon]=\"statusIcons[getCurrentState(i)]\"\n\t\t\t\tsize=\"16\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--progress__warning': step.invalid && i !== current\n\t\t\t\t}\">\n\t\t\t\t<title *ngIf=\"step.description\">{{step.description}}</title>\n\t\t\t</svg>\n\t\t\t<div class=\"cds--progress-text\">\n\t\t\t\t<p class=\"cds--progress-label\">{{step.label}}</p>\n\t\t\t\t<p *ngIf=\"step.secondaryLabel && !skeleton\" class=\"cds--progress-optional\">{{step.secondaryLabel}}</p>\n\t\t\t</div>\n\t\t\t<span class=\"cds--progress-line\"></span>\n\t\t</button>\n\t</li>\n</ul>\n",
|
|
50166
49839
|
"templateUrl": [],
|
|
50167
49840
|
"viewProviders": [],
|
|
50168
49841
|
"hostDirectives": [],
|
|
@@ -50259,7 +49932,7 @@
|
|
|
50259
49932
|
"optional": false,
|
|
50260
49933
|
"returnType": "\"current\" | \"invalid\" | \"complete\" | \"incomplete\"",
|
|
50261
49934
|
"typeParameters": [],
|
|
50262
|
-
"line":
|
|
49935
|
+
"line": 133,
|
|
50263
49936
|
"deprecated": false,
|
|
50264
49937
|
"deprecationMessage": "",
|
|
50265
49938
|
"rawdescription": "\n\nGets current state based on weight of the state\nWeight of state goes from error, incomplete, current, and complete\n\nThis function is used to determine which icon & translation string to display\n",
|
|
@@ -50267,8 +49940,8 @@
|
|
|
50267
49940
|
"jsdoctags": [
|
|
50268
49941
|
{
|
|
50269
49942
|
"name": {
|
|
50270
|
-
"pos":
|
|
50271
|
-
"end":
|
|
49943
|
+
"pos": 3645,
|
|
49944
|
+
"end": 3650,
|
|
50272
49945
|
"flags": 16842752,
|
|
50273
49946
|
"modifierFlagsCache": 0,
|
|
50274
49947
|
"transformFlags": 0,
|
|
@@ -50279,8 +49952,8 @@
|
|
|
50279
49952
|
"deprecated": false,
|
|
50280
49953
|
"deprecationMessage": "",
|
|
50281
49954
|
"tagName": {
|
|
50282
|
-
"pos":
|
|
50283
|
-
"end":
|
|
49955
|
+
"pos": 3639,
|
|
49956
|
+
"end": 3644,
|
|
50284
49957
|
"flags": 16842752,
|
|
50285
49958
|
"modifierFlagsCache": 0,
|
|
50286
49959
|
"transformFlags": 0,
|
|
@@ -50291,8 +49964,8 @@
|
|
|
50291
49964
|
},
|
|
50292
49965
|
{
|
|
50293
49966
|
"tagName": {
|
|
50294
|
-
"pos":
|
|
50295
|
-
"end":
|
|
49967
|
+
"pos": 3663,
|
|
49968
|
+
"end": 3670,
|
|
50296
49969
|
"flags": 16842752,
|
|
50297
49970
|
"modifierFlagsCache": 0,
|
|
50298
49971
|
"transformFlags": 0,
|
|
@@ -50324,8 +49997,8 @@
|
|
|
50324
49997
|
"jsdoctags": [
|
|
50325
49998
|
{
|
|
50326
49999
|
"name": {
|
|
50327
|
-
"pos":
|
|
50328
|
-
"end":
|
|
50000
|
+
"pos": 3152,
|
|
50001
|
+
"end": 3157,
|
|
50329
50002
|
"flags": 16842752,
|
|
50330
50003
|
"modifierFlagsCache": 0,
|
|
50331
50004
|
"transformFlags": 0,
|
|
@@ -50336,8 +50009,8 @@
|
|
|
50336
50009
|
"deprecated": false,
|
|
50337
50010
|
"deprecationMessage": "",
|
|
50338
50011
|
"tagName": {
|
|
50339
|
-
"pos":
|
|
50340
|
-
"end":
|
|
50012
|
+
"pos": 3146,
|
|
50013
|
+
"end": 3151,
|
|
50341
50014
|
"flags": 16842752,
|
|
50342
50015
|
"modifierFlagsCache": 0,
|
|
50343
50016
|
"transformFlags": 0,
|
|
@@ -50389,7 +50062,7 @@
|
|
|
50389
50062
|
"description": "<p>Get started with importing the module:</p>\n<b>Example :</b><div><pre class=\"line-numbers\"><code class=\"language-typescript\">import { ProgressIndicatorModule } from 'carbon-components-angular';</code></pre></div><p><a href=\"../../?path=/story/components-progress-indicator--basic\">See demo</a></p>\n",
|
|
50390
50063
|
"rawdescription": "\n\nGet started with importing the module:\n\n```typescript\nimport { ProgressIndicatorModule } from 'carbon-components-angular';\n```\n\n[See demo](../../?path=/story/components-progress-indicator--basic)\n",
|
|
50391
50064
|
"type": "component",
|
|
50392
|
-
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tOutput,\n\tEventEmitter\n} from \"@angular/core\";\nimport { I18n } from \"carbon-components-angular/i18n\";\nimport { Step } from \"./progress-indicator-step.interface\";\n\n/**\n * Get started with importing the module:\n *\n * ```typescript\n * import { ProgressIndicatorModule } from 'carbon-components-angular';\n * ```\n *\n * [See demo](../../?path=/story/components-progress-indicator--basic)\n */\n@Component({\n\tselector: \"cds-progress-indicator, ibm-progress-indicator\",\n\ttemplate: `\n\t<ul\n\t\tdata-progress\n\t\tdata-progress-current\n\t\tclass=\"cds--progress\"\n\t\t[ngClass]=\"{\n\t\t\t'cds--skeleton': skeleton,\n\t\t\t'cds--progress--vertical': (orientation === 'vertical'),\n\t\t\t'cds--progress--space-equal': spacing === 'equal' && orientation !== 'vertical'\n\t\t}\">\n\t\t<li\n\t\t\tclass=\"cds--progress-step\"\n\t\t\t*ngFor=\"let step of steps; let i = index\"\n\t\t\t[ngClass]=\"{\n\t\t\t\t'cds--progress-step--disabled' : step.disabled,\n\t\t\t\t'cds--progress-step--complete' : step.complete,\n\t\t\t\t'cds--progress-step--incomplete' : !step.complete && i !== current,\n\t\t\t\t'cds--progress-step--current': i === current\n\t\t\t}\">\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"cds--progress-step-button\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--progress-step-button--unclickable': !step.onClick || current === i\n\t\t\t\t}\"\n\t\t\t\t[disabled]=\"step.disabled\"\n\t\t\t\t[attr.aria-disabled]=\"step.disabled\"\n\t\t\t\t[tabindex]=\"(current !== i && step.onClick && !step.disabled) ? 0 : -1\"\n\t\t\t\t[title]=\"step.label\"\n\t\t\t\t(click)=\"onClick(i)\">\n\t\t\t\t<span class=\"cds--assistive-text\">\n\t\t\t\t\t{{this.translations[getCurrentState(i)?.toUpperCase()]}}\n\t\t\t\t</span>\n\t\t\t\t<svg\n\t\t\t\t\t[cdsIcon]=\"statusIcons[getCurrentState(i)]\"\n\t\t\t\t\tsize=\"16\"\n\t\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t\t'cds--progress__warning': step.invalid && i !== current\n\t\t\t\t\t}\">\n\t\t\t\t\t<title *ngIf=\"step.description\">{{step.description}}</title>\n\t\t\t\t</svg>\n\t\t\t\t<div class=\"cds--progress-text\">\n\t\t\t\t\t<p class=\"cds--progress-label\">{{step.label}}</p>\n\t\t\t\t\t<p *ngIf=\"step.secondaryLabel\" class=\"cds--progress-optional\">{{step.secondaryLabel}}</p>\n\t\t\t\t</div>\n\t\t\t\t<span class=\"cds--progress-line\"></span>\n\t\t\t</button>\n\t\t</li>\n\t</ul>\n\t`\n})\nexport class ProgressIndicator {\n\t@Input() get current() {\n\t\treturn this._current;\n\t}\n\tset current(current: number) {\n\t\tthis._current = current;\n\t\tthis.setProgressIndicatorStates();\n\t}\n\tstatic skeletonSteps(stepCount: number) {\n\t\tconst steps = [];\n\t\tfor (let i = 0; i < stepCount; i++) {\n\t\t\tsteps.push({ complete: false });\n\t\t}\n\n\t\treturn steps;\n\t}\n\n\t@Input() steps: Array<Step>;\n\t@Output() stepSelected = new EventEmitter<{ step: Step, index: number }>();\n\n\t@Input() translations = this.i18n.get().PROGRESS_INDICATOR;\n\t@Input() orientation: \"horizontal\" | \"vertical\" = \"horizontal\";\n\t@Input() skeleton = false;\n\t@Input() spacing: \"default\" | \"equal\" = \"default\";\n\n\t// Get icon names based for each status\n\treadonly statusIcons = {\n\t\tcurrent: \"incomplete\",\n\t\tcomplete: \"checkmark--outline\",\n\t\tinvalid: \"warning\",\n\t\tincomplete: \"circle-dash\"\n\t};\n\n\tprivate _current: number;\n\n\tconstructor(protected i18n: I18n) { }\n\n\t/**\n\t * Executes click function if `onClick` exists for step\n\t * `Current` step functions will not be executed\n\t * @param index number\n\t */\n\tonClick(index: number) {\n\t\tif (index !== this.current && typeof this.steps[index].onClick === \"function\") {\n\t\t\tthis.steps[index].onClick();\n\t\t}\n\t\tthis.stepSelected.emit({ step: this.steps[index], index });\n\t}\n\n\t/**\n\t * Gets current state based on weight of the state\n\t * Weight of state goes from error, incomplete, current, and complete\n\t *\n\t * This function is used to determine which icon & translation string to display\n\t * @param index number\n\t * @returns string\n\t */\n\tgetCurrentState(index: number) {\n\t\tif (index === this.current) {\n\t\t\treturn \"current\";\n\t\t} else if (this.steps[index].invalid) {\n\t\t\treturn \"invalid\";\n\t\t} else if (this.steps[index].complete) {\n\t\t\treturn \"complete\";\n\t\t}\n\n\t\treturn \"incomplete\";\n\t}\n\n\tprivate setProgressIndicatorStates() {\n\t\tif (this.steps === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Set all preceding steps to `complete` & following to `incomplete`\n\t\tthis.steps.forEach((step: Step, index) => {\n\t\t\tif (index < this.current) {\n\t\t\t\tstep.complete = true;\n\t\t\t} else {\n\t\t\t\tstep.complete = false;\n\t\t\t}\n\t\t});\n\t}\n}\n",
|
|
50065
|
+
"sourceCode": "import {\n\tComponent,\n\tInput,\n\tOutput,\n\tEventEmitter\n} from \"@angular/core\";\nimport { I18n } from \"carbon-components-angular/i18n\";\nimport { Step } from \"./progress-indicator-step.interface\";\n\n/**\n * Get started with importing the module:\n *\n * ```typescript\n * import { ProgressIndicatorModule } from 'carbon-components-angular';\n * ```\n *\n * [See demo](../../?path=/story/components-progress-indicator--basic)\n */\n@Component({\n\tselector: \"cds-progress-indicator, ibm-progress-indicator\",\n\ttemplate: `\n\t<ul\n\t\tdata-progress\n\t\tdata-progress-current\n\t\tclass=\"cds--progress\"\n\t\t[ngClass]=\"{\n\t\t\t'cds--skeleton': skeleton,\n\t\t\t'cds--progress--vertical': (orientation === 'vertical'),\n\t\t\t'cds--progress--space-equal': spacing === 'equal' && orientation !== 'vertical'\n\t\t}\">\n\t\t<li\n\t\t\tclass=\"cds--progress-step\"\n\t\t\t*ngFor=\"let step of steps; let i = index\"\n\t\t\t[ngClass]=\"{\n\t\t\t\t'cds--progress-step--disabled' : step.disabled,\n\t\t\t\t'cds--progress-step--complete' : step.complete,\n\t\t\t\t'cds--progress-step--incomplete' : !step.complete && i !== current,\n\t\t\t\t'cds--progress-step--current': i === current\n\t\t\t}\">\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"cds--progress-step-button\"\n\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t'cds--progress-step-button--unclickable': !step.onClick || current === i || skeleton\n\t\t\t\t}\"\n\t\t\t\t[disabled]=\"step.disabled\"\n\t\t\t\t[attr.aria-disabled]=\"step.disabled\"\n\t\t\t\t[tabindex]=\"(current !== i && step.onClick && !step.disabled) ? 0 : -1\"\n\t\t\t\t[title]=\"step.label\"\n\t\t\t\t(click)=\"onClick(i)\">\n\t\t\t\t<span class=\"cds--assistive-text\">\n\t\t\t\t\t{{this.translations[getCurrentState(i)?.toUpperCase()]}}\n\t\t\t\t</span>\n\t\t\t\t<svg\n\t\t\t\t\t[cdsIcon]=\"statusIcons[getCurrentState(i)]\"\n\t\t\t\t\tsize=\"16\"\n\t\t\t\t\t[ngClass]=\"{\n\t\t\t\t\t\t'cds--progress__warning': step.invalid && i !== current\n\t\t\t\t\t}\">\n\t\t\t\t\t<title *ngIf=\"step.description\">{{step.description}}</title>\n\t\t\t\t</svg>\n\t\t\t\t<div class=\"cds--progress-text\">\n\t\t\t\t\t<p class=\"cds--progress-label\">{{step.label}}</p>\n\t\t\t\t\t<p *ngIf=\"step.secondaryLabel && !skeleton\" class=\"cds--progress-optional\">{{step.secondaryLabel}}</p>\n\t\t\t\t</div>\n\t\t\t\t<span class=\"cds--progress-line\"></span>\n\t\t\t</button>\n\t\t</li>\n\t</ul>\n\t`\n})\nexport class ProgressIndicator {\n\t@Input() get current() {\n\t\treturn this._current;\n\t}\n\tset current(current: number) {\n\t\tthis._current = current;\n\t\tthis.setProgressIndicatorStates();\n\t}\n\tstatic skeletonSteps(stepCount: number) {\n\t\tconst steps = [];\n\t\tfor (let i = 0; i < stepCount; i++) {\n\t\t\tsteps.push({ complete: false });\n\t\t}\n\n\t\treturn steps;\n\t}\n\n\t@Input() steps: Array<Step>;\n\t@Output() stepSelected = new EventEmitter<{ step: Step, index: number }>();\n\n\t@Input() translations = this.i18n.get().PROGRESS_INDICATOR;\n\t@Input() orientation: \"horizontal\" | \"vertical\" = \"horizontal\";\n\t@Input() skeleton = false;\n\t@Input() spacing: \"default\" | \"equal\" = \"default\";\n\n\t// Get icon names based for each status\n\treadonly statusIcons = {\n\t\tcurrent: \"incomplete\",\n\t\tcomplete: \"checkmark--outline\",\n\t\tinvalid: \"warning\",\n\t\tincomplete: \"circle-dash\"\n\t};\n\n\tprivate _current: number;\n\n\tconstructor(protected i18n: I18n) { }\n\n\t/**\n\t * Executes click function if `onClick` exists for step\n\t * `Current` step functions will not be executed\n\t * @param index number\n\t */\n\tonClick(index: number) {\n\t\tif (this.skeleton) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (index !== this.current && typeof this.steps[index].onClick === \"function\") {\n\t\t\tthis.steps[index].onClick();\n\t\t}\n\t\tthis.stepSelected.emit({ step: this.steps[index], index });\n\t}\n\n\t/**\n\t * Gets current state based on weight of the state\n\t * Weight of state goes from error, incomplete, current, and complete\n\t *\n\t * This function is used to determine which icon & translation string to display\n\t * @param index number\n\t * @returns string\n\t */\n\tgetCurrentState(index: number) {\n\t\tif (index === this.current) {\n\t\t\treturn \"current\";\n\t\t} else if (this.steps[index].invalid) {\n\t\t\treturn \"invalid\";\n\t\t} else if (this.steps[index].complete) {\n\t\t\treturn \"complete\";\n\t\t}\n\n\t\treturn \"incomplete\";\n\t}\n\n\tprivate setProgressIndicatorStates() {\n\t\tif (this.steps === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Set all preceding steps to `complete` & following to `incomplete`\n\t\tthis.steps.forEach((step: Step, index) => {\n\t\t\tif (index < this.current) {\n\t\t\t\tstep.complete = true;\n\t\t\t} else {\n\t\t\t\tstep.complete = false;\n\t\t\t}\n\t\t});\n\t}\n}\n",
|
|
50393
50066
|
"assetsDirs": [],
|
|
50394
50067
|
"styleUrlsData": "",
|
|
50395
50068
|
"stylesData": "",
|
|
@@ -85963,16 +85636,6 @@
|
|
|
85963
85636
|
"type": "",
|
|
85964
85637
|
"defaultValue": "(args) => ({\n\tprops: args,\n\ttemplate: `\n\t\t<cds-tabs type=\"contained\">\n\t\t\t<cds-tab heading=\"Engage\" secondaryLabel=\"(21/25)\">Tab Content 1</cds-tab>\n\t\t\t<cds-tab heading=\"Analyze\" secondaryLabel=\"(12/16)\">Tab Content 2</cds-tab>\n\t\t\t<cds-tab heading=\"Remediate\" secondaryLabel=\"(0/7)\">Tab Content 3</cds-tab>\n\t\t\t<cds-tab heading=\"Assets\" secondaryLabel=\"(4/12)\">Tab Content 4</cds-tab>\n\t\t\t<cds-tab heading=\"Monitoring\" secondaryLabel=\"(0/10)\" [disabled]=\"true\">Tab Content 5</cds-tab>\n\t\t</cds-tabs>\n\t`\n})"
|
|
85965
85638
|
},
|
|
85966
|
-
{
|
|
85967
|
-
"name": "context",
|
|
85968
|
-
"ctype": "miscellaneous",
|
|
85969
|
-
"subtype": "variable",
|
|
85970
|
-
"file": "src/test.ts",
|
|
85971
|
-
"deprecated": false,
|
|
85972
|
-
"deprecationMessage": "",
|
|
85973
|
-
"type": "",
|
|
85974
|
-
"defaultValue": "require.context(\"./\", true, /\\.spec\\.ts$/)"
|
|
85975
|
-
},
|
|
85976
85639
|
{
|
|
85977
85640
|
"name": "createBreadcrumbItems",
|
|
85978
85641
|
"ctype": "miscellaneous",
|
|
@@ -86165,16 +85828,6 @@
|
|
|
86165
85828
|
"type": "object",
|
|
86166
85829
|
"defaultValue": "{ top: 0, left: 0 }"
|
|
86167
85830
|
},
|
|
86168
|
-
{
|
|
86169
|
-
"name": "defaults",
|
|
86170
|
-
"ctype": "miscellaneous",
|
|
86171
|
-
"subtype": "variable",
|
|
86172
|
-
"file": "src/checkbox/checkbox-exported-tests.ts",
|
|
86173
|
-
"deprecated": false,
|
|
86174
|
-
"deprecationMessage": "",
|
|
86175
|
-
"type": "object",
|
|
86176
|
-
"defaultValue": "{\n\tselectors: {\n\t\troot: \"cds-checkbox\",\n\t\tinput: \"input\"\n\t}\n}"
|
|
86177
|
-
},
|
|
86178
85831
|
{
|
|
86179
85832
|
"name": "DEMO_ROWS",
|
|
86180
85833
|
"ctype": "miscellaneous",
|
|
@@ -87885,15 +87538,6 @@
|
|
|
87885
87538
|
"rawdescription": "Takes the `Observable` returned from `i18n.get` and an object of variables to replace.\n\nThe keys specify the variable name in the string.\n\nExample:\n```typescript\nservice.set({ \"TEST\": \"{{foo}} {{bar}}\" });\n\nservice.replace(service.get(\"TEST\"), { foo: \"test\", bar: \"asdf\" })\n```\n\nProduces: `\"test asdf\"`",
|
|
87886
87539
|
"description": "<p>Takes the <code>Observable</code> returned from <code>i18n.get</code> and an object of variables to replace.</p>\n<p>The keys specify the variable name in the string.</p>\n<p>Example:</p>\n<b>Example :</b><div><pre class=\"line-numbers\"><code class=\"language-typescript\">service.set({ "TEST": "{{foo}} {{bar}}" });\n\nservice.replace(service.get("TEST"), { foo: "test", bar: "asdf" })</code></pre></div><p>Produces: <code>"test asdf"</code></p>\n"
|
|
87887
87540
|
},
|
|
87888
|
-
{
|
|
87889
|
-
"name": "require",
|
|
87890
|
-
"ctype": "miscellaneous",
|
|
87891
|
-
"subtype": "variable",
|
|
87892
|
-
"file": "src/test.ts",
|
|
87893
|
-
"deprecated": false,
|
|
87894
|
-
"deprecationMessage": "",
|
|
87895
|
-
"type": "any"
|
|
87896
|
-
},
|
|
87897
87541
|
{
|
|
87898
87542
|
"name": "Responsive",
|
|
87899
87543
|
"ctype": "miscellaneous",
|
|
@@ -90836,34 +90480,6 @@
|
|
|
90836
90480
|
}
|
|
90837
90481
|
]
|
|
90838
90482
|
},
|
|
90839
|
-
{
|
|
90840
|
-
"name": "isObject",
|
|
90841
|
-
"file": "src/exported-tests/component-tests.ts",
|
|
90842
|
-
"ctype": "miscellaneous",
|
|
90843
|
-
"subtype": "function",
|
|
90844
|
-
"deprecated": false,
|
|
90845
|
-
"deprecationMessage": "",
|
|
90846
|
-
"description": "",
|
|
90847
|
-
"args": [
|
|
90848
|
-
{
|
|
90849
|
-
"name": "val",
|
|
90850
|
-
"type": "",
|
|
90851
|
-
"deprecated": false,
|
|
90852
|
-
"deprecationMessage": ""
|
|
90853
|
-
}
|
|
90854
|
-
],
|
|
90855
|
-
"jsdoctags": [
|
|
90856
|
-
{
|
|
90857
|
-
"name": "val",
|
|
90858
|
-
"type": "",
|
|
90859
|
-
"deprecated": false,
|
|
90860
|
-
"deprecationMessage": "",
|
|
90861
|
-
"tagName": {
|
|
90862
|
-
"text": "param"
|
|
90863
|
-
}
|
|
90864
|
-
}
|
|
90865
|
-
]
|
|
90866
|
-
},
|
|
90867
90483
|
{
|
|
90868
90484
|
"name": "isVisible",
|
|
90869
90485
|
"file": "src/common/tab.service.ts",
|
|
@@ -96570,27 +96186,6 @@
|
|
|
96570
96186
|
"defaultValue": "new InjectionToken<CheckboxGroupHost | null>(\"CheckboxGroupHost\")"
|
|
96571
96187
|
}
|
|
96572
96188
|
],
|
|
96573
|
-
"src/test.ts": [
|
|
96574
|
-
{
|
|
96575
|
-
"name": "context",
|
|
96576
|
-
"ctype": "miscellaneous",
|
|
96577
|
-
"subtype": "variable",
|
|
96578
|
-
"file": "src/test.ts",
|
|
96579
|
-
"deprecated": false,
|
|
96580
|
-
"deprecationMessage": "",
|
|
96581
|
-
"type": "",
|
|
96582
|
-
"defaultValue": "require.context(\"./\", true, /\\.spec\\.ts$/)"
|
|
96583
|
-
},
|
|
96584
|
-
{
|
|
96585
|
-
"name": "require",
|
|
96586
|
-
"ctype": "miscellaneous",
|
|
96587
|
-
"subtype": "variable",
|
|
96588
|
-
"file": "src/test.ts",
|
|
96589
|
-
"deprecated": false,
|
|
96590
|
-
"deprecationMessage": "",
|
|
96591
|
-
"type": "any"
|
|
96592
|
-
}
|
|
96593
|
-
],
|
|
96594
96189
|
"src/aspect-ratio/aspect-ratio.stories.ts": [
|
|
96595
96190
|
{
|
|
96596
96191
|
"name": "Default",
|
|
@@ -96639,18 +96234,6 @@
|
|
|
96639
96234
|
"defaultValue": "{ top: 0, left: 0 }"
|
|
96640
96235
|
}
|
|
96641
96236
|
],
|
|
96642
|
-
"src/checkbox/checkbox-exported-tests.ts": [
|
|
96643
|
-
{
|
|
96644
|
-
"name": "defaults",
|
|
96645
|
-
"ctype": "miscellaneous",
|
|
96646
|
-
"subtype": "variable",
|
|
96647
|
-
"file": "src/checkbox/checkbox-exported-tests.ts",
|
|
96648
|
-
"deprecated": false,
|
|
96649
|
-
"deprecationMessage": "",
|
|
96650
|
-
"type": "object",
|
|
96651
|
-
"defaultValue": "{\n\tselectors: {\n\t\troot: \"cds-checkbox\",\n\t\tinput: \"input\"\n\t}\n}"
|
|
96652
|
-
}
|
|
96653
|
-
],
|
|
96654
96237
|
"src/table/stories/app-table-ai-label.component.ts": [
|
|
96655
96238
|
{
|
|
96656
96239
|
"name": "DEMO_ROWS",
|
|
@@ -98199,36 +97782,6 @@
|
|
|
98199
97782
|
]
|
|
98200
97783
|
}
|
|
98201
97784
|
],
|
|
98202
|
-
"src/exported-tests/component-tests.ts": [
|
|
98203
|
-
{
|
|
98204
|
-
"name": "isObject",
|
|
98205
|
-
"file": "src/exported-tests/component-tests.ts",
|
|
98206
|
-
"ctype": "miscellaneous",
|
|
98207
|
-
"subtype": "function",
|
|
98208
|
-
"deprecated": false,
|
|
98209
|
-
"deprecationMessage": "",
|
|
98210
|
-
"description": "",
|
|
98211
|
-
"args": [
|
|
98212
|
-
{
|
|
98213
|
-
"name": "val",
|
|
98214
|
-
"type": "",
|
|
98215
|
-
"deprecated": false,
|
|
98216
|
-
"deprecationMessage": ""
|
|
98217
|
-
}
|
|
98218
|
-
],
|
|
98219
|
-
"jsdoctags": [
|
|
98220
|
-
{
|
|
98221
|
-
"name": "val",
|
|
98222
|
-
"type": "",
|
|
98223
|
-
"deprecated": false,
|
|
98224
|
-
"deprecationMessage": "",
|
|
98225
|
-
"tagName": {
|
|
98226
|
-
"text": "param"
|
|
98227
|
-
}
|
|
98228
|
-
}
|
|
98229
|
-
]
|
|
98230
|
-
}
|
|
98231
|
-
],
|
|
98232
97785
|
"src/placeholder/placeholder.module.ts": [
|
|
98233
97786
|
{
|
|
98234
97787
|
"name": "PLACEHOLDER_SERVICE_PROVIDER_FACTORY",
|
|
@@ -99677,25 +99230,6 @@
|
|
|
99677
99230
|
"coverageCount": "0/1",
|
|
99678
99231
|
"status": "low"
|
|
99679
99232
|
},
|
|
99680
|
-
{
|
|
99681
|
-
"filePath": "src/checkbox/checkbox-exported-tests.ts",
|
|
99682
|
-
"type": "class",
|
|
99683
|
-
"linktype": "classe",
|
|
99684
|
-
"name": "CheckboxExportedTests",
|
|
99685
|
-
"coveragePercent": 0,
|
|
99686
|
-
"coverageCount": "0/8",
|
|
99687
|
-
"status": "low"
|
|
99688
|
-
},
|
|
99689
|
-
{
|
|
99690
|
-
"filePath": "src/checkbox/checkbox-exported-tests.ts",
|
|
99691
|
-
"type": "variable",
|
|
99692
|
-
"linktype": "miscellaneous",
|
|
99693
|
-
"linksubtype": "variable",
|
|
99694
|
-
"name": "defaults",
|
|
99695
|
-
"coveragePercent": 0,
|
|
99696
|
-
"coverageCount": "0/1",
|
|
99697
|
-
"status": "low"
|
|
99698
|
-
},
|
|
99699
99233
|
{
|
|
99700
99234
|
"filePath": "src/checkbox/checkbox-group-host.ts",
|
|
99701
99235
|
"type": "interface",
|
|
@@ -101213,25 +100747,6 @@
|
|
|
101213
100747
|
"coverageCount": "1/2",
|
|
101214
100748
|
"status": "medium"
|
|
101215
100749
|
},
|
|
101216
|
-
{
|
|
101217
|
-
"filePath": "src/exported-tests/component-tests.ts",
|
|
101218
|
-
"type": "class",
|
|
101219
|
-
"linktype": "classe",
|
|
101220
|
-
"name": "ComponentTests",
|
|
101221
|
-
"coveragePercent": 0,
|
|
101222
|
-
"coverageCount": "0/7",
|
|
101223
|
-
"status": "low"
|
|
101224
|
-
},
|
|
101225
|
-
{
|
|
101226
|
-
"filePath": "src/exported-tests/component-tests.ts",
|
|
101227
|
-
"type": "function",
|
|
101228
|
-
"linktype": "miscellaneous",
|
|
101229
|
-
"linksubtype": "function",
|
|
101230
|
-
"name": "isObject",
|
|
101231
|
-
"coveragePercent": 0,
|
|
101232
|
-
"coverageCount": "0/1",
|
|
101233
|
-
"status": "low"
|
|
101234
|
-
},
|
|
101235
100750
|
{
|
|
101236
100751
|
"filePath": "src/file-uploader/file-item.interface.ts",
|
|
101237
100752
|
"type": "interface",
|
|
@@ -106000,26 +105515,6 @@
|
|
|
106000
105515
|
"coverageCount": "0/1",
|
|
106001
105516
|
"status": "low"
|
|
106002
105517
|
},
|
|
106003
|
-
{
|
|
106004
|
-
"filePath": "src/test.ts",
|
|
106005
|
-
"type": "variable",
|
|
106006
|
-
"linktype": "miscellaneous",
|
|
106007
|
-
"linksubtype": "variable",
|
|
106008
|
-
"name": "context",
|
|
106009
|
-
"coveragePercent": 0,
|
|
106010
|
-
"coverageCount": "0/1",
|
|
106011
|
-
"status": "low"
|
|
106012
|
-
},
|
|
106013
|
-
{
|
|
106014
|
-
"filePath": "src/test.ts",
|
|
106015
|
-
"type": "variable",
|
|
106016
|
-
"linktype": "miscellaneous",
|
|
106017
|
-
"linksubtype": "variable",
|
|
106018
|
-
"name": "require",
|
|
106019
|
-
"coveragePercent": 0,
|
|
106020
|
-
"coverageCount": "0/1",
|
|
106021
|
-
"status": "low"
|
|
106022
|
-
},
|
|
106023
105518
|
{
|
|
106024
105519
|
"filePath": "src/theme/theme.directive.ts",
|
|
106025
105520
|
"type": "directive",
|