@skyux/lookup 7.0.0 → 7.1.1
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/documentation.json +68 -53
- package/esm2020/lib/modules/autocomplete/autocomplete.component.mjs +4 -3
- package/esm2020/lib/modules/lookup/lookup-show-more-async-modal.component.mjs +1 -1
- package/esm2020/lib/modules/lookup/lookup-show-more-modal.component.mjs +1 -1
- package/fesm2015/skyux-lookup.mjs +5 -4
- package/fesm2015/skyux-lookup.mjs.map +1 -1
- package/fesm2020/skyux-lookup.mjs +5 -4
- package/fesm2020/skyux-lookup.mjs.map +1 -1
- package/package.json +10 -10
package/documentation.json
CHANGED
|
@@ -2847,7 +2847,7 @@
|
|
|
2847
2847
|
"sources": [
|
|
2848
2848
|
{
|
|
2849
2849
|
"fileName": "projects/lookup/src/modules/autocomplete/autocomplete.component.ts",
|
|
2850
|
-
"line":
|
|
2850
|
+
"line": 481,
|
|
2851
2851
|
"character": 2
|
|
2852
2852
|
}
|
|
2853
2853
|
],
|
|
@@ -2984,7 +2984,7 @@
|
|
|
2984
2984
|
"sources": [
|
|
2985
2985
|
{
|
|
2986
2986
|
"fileName": "projects/lookup/src/modules/autocomplete/autocomplete.component.ts",
|
|
2987
|
-
"line":
|
|
2987
|
+
"line": 82,
|
|
2988
2988
|
"character": 9
|
|
2989
2989
|
}
|
|
2990
2990
|
],
|
|
@@ -3004,7 +3004,7 @@
|
|
|
3004
3004
|
"sources": [
|
|
3005
3005
|
{
|
|
3006
3006
|
"fileName": "projects/lookup/src/modules/autocomplete/autocomplete.component.ts",
|
|
3007
|
-
"line":
|
|
3007
|
+
"line": 321,
|
|
3008
3008
|
"character": 9
|
|
3009
3009
|
}
|
|
3010
3010
|
],
|
|
@@ -3025,7 +3025,7 @@
|
|
|
3025
3025
|
"sources": [
|
|
3026
3026
|
{
|
|
3027
3027
|
"fileName": "projects/lookup/src/modules/autocomplete/autocomplete.component.ts",
|
|
3028
|
-
"line":
|
|
3028
|
+
"line": 333,
|
|
3029
3029
|
"character": 9
|
|
3030
3030
|
}
|
|
3031
3031
|
],
|
|
@@ -3067,7 +3067,7 @@
|
|
|
3067
3067
|
"sources": [
|
|
3068
3068
|
{
|
|
3069
3069
|
"fileName": "projects/lookup/src/modules/autocomplete/autocomplete.component.ts",
|
|
3070
|
-
"line":
|
|
3070
|
+
"line": 263,
|
|
3071
3071
|
"character": 9
|
|
3072
3072
|
}
|
|
3073
3073
|
],
|
|
@@ -3087,7 +3087,7 @@
|
|
|
3087
3087
|
"sources": [
|
|
3088
3088
|
{
|
|
3089
3089
|
"fileName": "projects/lookup/src/modules/autocomplete/autocomplete.component.ts",
|
|
3090
|
-
"line":
|
|
3090
|
+
"line": 323,
|
|
3091
3091
|
"character": 9
|
|
3092
3092
|
}
|
|
3093
3093
|
],
|
|
@@ -3122,7 +3122,7 @@
|
|
|
3122
3122
|
"sources": [
|
|
3123
3123
|
{
|
|
3124
3124
|
"fileName": "projects/lookup/src/modules/autocomplete/autocomplete.component.ts",
|
|
3125
|
-
"line":
|
|
3125
|
+
"line": 400,
|
|
3126
3126
|
"character": 9
|
|
3127
3127
|
}
|
|
3128
3128
|
],
|
|
@@ -3150,7 +3150,7 @@
|
|
|
3150
3150
|
"sources": [
|
|
3151
3151
|
{
|
|
3152
3152
|
"fileName": "projects/lookup/src/modules/autocomplete/autocomplete.component.ts",
|
|
3153
|
-
"line":
|
|
3153
|
+
"line": 325,
|
|
3154
3154
|
"character": 9
|
|
3155
3155
|
}
|
|
3156
3156
|
],
|
|
@@ -3185,7 +3185,7 @@
|
|
|
3185
3185
|
"sources": [
|
|
3186
3186
|
{
|
|
3187
3187
|
"fileName": "projects/lookup/src/modules/autocomplete/autocomplete.component.ts",
|
|
3188
|
-
"line":
|
|
3188
|
+
"line": 299,
|
|
3189
3189
|
"character": 9
|
|
3190
3190
|
}
|
|
3191
3191
|
],
|
|
@@ -3215,7 +3215,7 @@
|
|
|
3215
3215
|
"sources": [
|
|
3216
3216
|
{
|
|
3217
3217
|
"fileName": "projects/lookup/src/modules/autocomplete/autocomplete.component.ts",
|
|
3218
|
-
"line":
|
|
3218
|
+
"line": 417,
|
|
3219
3219
|
"character": 9
|
|
3220
3220
|
}
|
|
3221
3221
|
],
|
|
@@ -3251,7 +3251,7 @@
|
|
|
3251
3251
|
"sources": [
|
|
3252
3252
|
{
|
|
3253
3253
|
"fileName": "projects/lookup/src/modules/autocomplete/autocomplete.component.ts",
|
|
3254
|
-
"line":
|
|
3254
|
+
"line": 197,
|
|
3255
3255
|
"character": 9
|
|
3256
3256
|
}
|
|
3257
3257
|
],
|
|
@@ -3279,7 +3279,7 @@
|
|
|
3279
3279
|
"sources": [
|
|
3280
3280
|
{
|
|
3281
3281
|
"fileName": "projects/lookup/src/modules/autocomplete/autocomplete.component.ts",
|
|
3282
|
-
"line":
|
|
3282
|
+
"line": 335,
|
|
3283
3283
|
"character": 9
|
|
3284
3284
|
}
|
|
3285
3285
|
],
|
|
@@ -3299,7 +3299,7 @@
|
|
|
3299
3299
|
"sources": [
|
|
3300
3300
|
{
|
|
3301
3301
|
"fileName": "projects/lookup/src/modules/autocomplete/autocomplete.component.ts",
|
|
3302
|
-
"line":
|
|
3302
|
+
"line": 327,
|
|
3303
3303
|
"character": 9
|
|
3304
3304
|
}
|
|
3305
3305
|
],
|
|
@@ -3335,7 +3335,7 @@
|
|
|
3335
3335
|
"sources": [
|
|
3336
3336
|
{
|
|
3337
3337
|
"fileName": "projects/lookup/src/modules/autocomplete/autocomplete.component.ts",
|
|
3338
|
-
"line":
|
|
3338
|
+
"line": 292,
|
|
3339
3339
|
"character": 9
|
|
3340
3340
|
}
|
|
3341
3341
|
],
|
|
@@ -3377,7 +3377,7 @@
|
|
|
3377
3377
|
"sources": [
|
|
3378
3378
|
{
|
|
3379
3379
|
"fileName": "projects/lookup/src/modules/autocomplete/autocomplete.component.ts",
|
|
3380
|
-
"line":
|
|
3380
|
+
"line": 90,
|
|
3381
3381
|
"character": 13
|
|
3382
3382
|
}
|
|
3383
3383
|
],
|
|
@@ -3456,7 +3456,7 @@
|
|
|
3456
3456
|
"sources": [
|
|
3457
3457
|
{
|
|
3458
3458
|
"fileName": "projects/lookup/src/modules/autocomplete/autocomplete.component.ts",
|
|
3459
|
-
"line":
|
|
3459
|
+
"line": 104,
|
|
3460
3460
|
"character": 13
|
|
3461
3461
|
}
|
|
3462
3462
|
],
|
|
@@ -3541,7 +3541,7 @@
|
|
|
3541
3541
|
"sources": [
|
|
3542
3542
|
{
|
|
3543
3543
|
"fileName": "projects/lookup/src/modules/autocomplete/autocomplete.component.ts",
|
|
3544
|
-
"line":
|
|
3544
|
+
"line": 118,
|
|
3545
3545
|
"character": 13
|
|
3546
3546
|
}
|
|
3547
3547
|
],
|
|
@@ -3614,7 +3614,7 @@
|
|
|
3614
3614
|
"sources": [
|
|
3615
3615
|
{
|
|
3616
3616
|
"fileName": "projects/lookup/src/modules/autocomplete/autocomplete.component.ts",
|
|
3617
|
-
"line":
|
|
3617
|
+
"line": 313,
|
|
3618
3618
|
"character": 13
|
|
3619
3619
|
}
|
|
3620
3620
|
],
|
|
@@ -3689,7 +3689,7 @@
|
|
|
3689
3689
|
"sources": [
|
|
3690
3690
|
{
|
|
3691
3691
|
"fileName": "projects/lookup/src/modules/autocomplete/autocomplete.component.ts",
|
|
3692
|
-
"line":
|
|
3692
|
+
"line": 340,
|
|
3693
3693
|
"character": 13
|
|
3694
3694
|
}
|
|
3695
3695
|
],
|
|
@@ -3758,7 +3758,7 @@
|
|
|
3758
3758
|
"sources": [
|
|
3759
3759
|
{
|
|
3760
3760
|
"fileName": "projects/lookup/src/modules/autocomplete/autocomplete.component.ts",
|
|
3761
|
-
"line":
|
|
3761
|
+
"line": 159,
|
|
3762
3762
|
"character": 13
|
|
3763
3763
|
}
|
|
3764
3764
|
],
|
|
@@ -3860,7 +3860,7 @@
|
|
|
3860
3860
|
"sources": [
|
|
3861
3861
|
{
|
|
3862
3862
|
"fileName": "projects/lookup/src/modules/autocomplete/autocomplete.component.ts",
|
|
3863
|
-
"line":
|
|
3863
|
+
"line": 405,
|
|
3864
3864
|
"character": 13
|
|
3865
3865
|
}
|
|
3866
3866
|
],
|
|
@@ -3943,7 +3943,7 @@
|
|
|
3943
3943
|
"sources": [
|
|
3944
3944
|
{
|
|
3945
3945
|
"fileName": "projects/lookup/src/modules/autocomplete/autocomplete.component.ts",
|
|
3946
|
-
"line":
|
|
3946
|
+
"line": 177,
|
|
3947
3947
|
"character": 13
|
|
3948
3948
|
}
|
|
3949
3949
|
],
|
|
@@ -4030,7 +4030,7 @@
|
|
|
4030
4030
|
"sources": [
|
|
4031
4031
|
{
|
|
4032
4032
|
"fileName": "projects/lookup/src/modules/autocomplete/autocomplete.component.ts",
|
|
4033
|
-
"line":
|
|
4033
|
+
"line": 223,
|
|
4034
4034
|
"character": 13
|
|
4035
4035
|
}
|
|
4036
4036
|
],
|
|
@@ -4111,7 +4111,7 @@
|
|
|
4111
4111
|
"sources": [
|
|
4112
4112
|
{
|
|
4113
4113
|
"fileName": "projects/lookup/src/modules/autocomplete/autocomplete.component.ts",
|
|
4114
|
-
"line":
|
|
4114
|
+
"line": 305,
|
|
4115
4115
|
"character": 13
|
|
4116
4116
|
}
|
|
4117
4117
|
],
|
|
@@ -4184,7 +4184,7 @@
|
|
|
4184
4184
|
"sources": [
|
|
4185
4185
|
{
|
|
4186
4186
|
"fileName": "projects/lookup/src/modules/autocomplete/autocomplete.component.ts",
|
|
4187
|
-
"line":
|
|
4187
|
+
"line": 242,
|
|
4188
4188
|
"character": 13
|
|
4189
4189
|
}
|
|
4190
4190
|
],
|
|
@@ -4257,7 +4257,7 @@
|
|
|
4257
4257
|
"sources": [
|
|
4258
4258
|
{
|
|
4259
4259
|
"fileName": "projects/lookup/src/modules/autocomplete/autocomplete.component.ts",
|
|
4260
|
-
"line":
|
|
4260
|
+
"line": 206,
|
|
4261
4261
|
"character": 13
|
|
4262
4262
|
}
|
|
4263
4263
|
],
|
|
@@ -4330,7 +4330,7 @@
|
|
|
4330
4330
|
"sources": [
|
|
4331
4331
|
{
|
|
4332
4332
|
"fileName": "projects/lookup/src/modules/autocomplete/autocomplete.component.ts",
|
|
4333
|
-
"line":
|
|
4333
|
+
"line": 329,
|
|
4334
4334
|
"character": 13
|
|
4335
4335
|
}
|
|
4336
4336
|
],
|
|
@@ -4359,7 +4359,7 @@
|
|
|
4359
4359
|
"sources": [
|
|
4360
4360
|
{
|
|
4361
4361
|
"fileName": "projects/lookup/src/modules/autocomplete/autocomplete.component.ts",
|
|
4362
|
-
"line":
|
|
4362
|
+
"line": 520,
|
|
4363
4363
|
"character": 9
|
|
4364
4364
|
}
|
|
4365
4365
|
],
|
|
@@ -4388,7 +4388,7 @@
|
|
|
4388
4388
|
"sources": [
|
|
4389
4389
|
{
|
|
4390
4390
|
"fileName": "projects/lookup/src/modules/autocomplete/autocomplete.component.ts",
|
|
4391
|
-
"line":
|
|
4391
|
+
"line": 528,
|
|
4392
4392
|
"character": 9
|
|
4393
4393
|
}
|
|
4394
4394
|
],
|
|
@@ -4432,7 +4432,7 @@
|
|
|
4432
4432
|
"sources": [
|
|
4433
4433
|
{
|
|
4434
4434
|
"fileName": "projects/lookup/src/modules/autocomplete/autocomplete.component.ts",
|
|
4435
|
-
"line":
|
|
4435
|
+
"line": 641,
|
|
4436
4436
|
"character": 9
|
|
4437
4437
|
}
|
|
4438
4438
|
],
|
|
@@ -4476,7 +4476,7 @@
|
|
|
4476
4476
|
"sources": [
|
|
4477
4477
|
{
|
|
4478
4478
|
"fileName": "projects/lookup/src/modules/autocomplete/autocomplete.component.ts",
|
|
4479
|
-
"line":
|
|
4479
|
+
"line": 611,
|
|
4480
4480
|
"character": 9
|
|
4481
4481
|
}
|
|
4482
4482
|
],
|
|
@@ -4505,7 +4505,7 @@
|
|
|
4505
4505
|
"sources": [
|
|
4506
4506
|
{
|
|
4507
4507
|
"fileName": "projects/lookup/src/modules/autocomplete/autocomplete.component.ts",
|
|
4508
|
-
"line":
|
|
4508
|
+
"line": 506,
|
|
4509
4509
|
"character": 9
|
|
4510
4510
|
}
|
|
4511
4511
|
],
|
|
@@ -4542,7 +4542,7 @@
|
|
|
4542
4542
|
"sources": [
|
|
4543
4543
|
{
|
|
4544
4544
|
"fileName": "projects/lookup/src/modules/autocomplete/autocomplete.component.ts",
|
|
4545
|
-
"line":
|
|
4545
|
+
"line": 510,
|
|
4546
4546
|
"character": 9
|
|
4547
4547
|
}
|
|
4548
4548
|
],
|
|
@@ -4579,7 +4579,7 @@
|
|
|
4579
4579
|
"sources": [
|
|
4580
4580
|
{
|
|
4581
4581
|
"fileName": "projects/lookup/src/modules/autocomplete/autocomplete.component.ts",
|
|
4582
|
-
"line":
|
|
4582
|
+
"line": 619,
|
|
4583
4583
|
"character": 9
|
|
4584
4584
|
}
|
|
4585
4585
|
],
|
|
@@ -4634,7 +4634,7 @@
|
|
|
4634
4634
|
"sources": [
|
|
4635
4635
|
{
|
|
4636
4636
|
"fileName": "projects/lookup/src/modules/autocomplete/autocomplete.component.ts",
|
|
4637
|
-
"line":
|
|
4637
|
+
"line": 632,
|
|
4638
4638
|
"character": 9
|
|
4639
4639
|
}
|
|
4640
4640
|
],
|
|
@@ -4730,7 +4730,7 @@
|
|
|
4730
4730
|
"sources": [
|
|
4731
4731
|
{
|
|
4732
4732
|
"fileName": "projects/lookup/src/modules/autocomplete/autocomplete.component.ts",
|
|
4733
|
-
"line":
|
|
4733
|
+
"line": 73,
|
|
4734
4734
|
"character": 13
|
|
4735
4735
|
}
|
|
4736
4736
|
],
|
|
@@ -11591,13 +11591,18 @@
|
|
|
11591
11591
|
{
|
|
11592
11592
|
"fileName": "autocomplete-demo.component.ts",
|
|
11593
11593
|
"filePath": "/projects/lookup/documentation/code-examples/autocomplete/advanced/autocomplete-demo.component.ts",
|
|
11594
|
-
"rawContents": "import { Component
|
|
11594
|
+
"rawContents": "import { Component } from '@angular/core';\nimport {\n UntypedFormBuilder,\n UntypedFormControl,\n UntypedFormGroup,\n} from '@angular/forms';\nimport {\n SkyAutocompleteSearchFunctionFilter,\n SkyAutocompleteSelectionChange,\n} from '@skyux/lookup';\n\nimport { Planet } from './planet';\n\n@Component({\n selector: 'app-autocomplete-demo',\n templateUrl: './autocomplete-demo.component.html',\n})\nexport class AutocompleteDemoComponent {\n public farthestPlanet: UntypedFormControl;\n\n public myForm: UntypedFormGroup;\n\n public planets: Planet[] = [\n {\n name: 'Mercury',\n description: 'Mercury is a planet in our solar system.',\n },\n { name: 'Venus', description: 'Venus is a planet in our solar system.' },\n { name: 'Earth', description: 'Earth is a planet in our solar system.' },\n { name: 'Mars', description: 'Mars is a planet in our solar system.' },\n {\n name: 'Jupiter',\n description: 'Jupiter is a planet in our solar system.',\n },\n { name: 'Saturn', description: 'Saturn is a planet in our solar system.' },\n { name: 'Uranus', description: 'Uranus is a planet in our solar system.' },\n {\n name: 'Neptune',\n description: 'Neptune is a planet in our solar system.',\n },\n ];\n\n public searchFilters: SkyAutocompleteSearchFunctionFilter[] = [\n (searchText: string, item: Planet): boolean => {\n return item.name !== 'Red';\n },\n ];\n\n constructor(formBuilder: UntypedFormBuilder) {\n this.farthestPlanet = formBuilder.control({});\n this.myForm = formBuilder.group({\n farthestPlanet: this.farthestPlanet,\n });\n }\n\n public onPlanetSelection(args: SkyAutocompleteSelectionChange): void {\n alert(`You selected ${args.selectedItem.name}`);\n }\n}\n"
|
|
11595
11595
|
},
|
|
11596
11596
|
{
|
|
11597
11597
|
"fileName": "autocomplete-demo.module.ts",
|
|
11598
11598
|
"filePath": "/projects/lookup/documentation/code-examples/autocomplete/advanced/autocomplete-demo.module.ts",
|
|
11599
11599
|
"rawContents": "import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { SkyIconModule } from '@skyux/indicators';\nimport { SkyAutocompleteModule } from '@skyux/lookup';\n\nimport { AutocompleteDemoComponent } from './autocomplete-demo.component';\n\n@NgModule({\n imports: [\n CommonModule,\n ReactiveFormsModule,\n SkyAutocompleteModule,\n SkyIconModule,\n ],\n declarations: [AutocompleteDemoComponent],\n exports: [AutocompleteDemoComponent],\n})\nexport class AutocompleteDemoModule {}\n"
|
|
11600
11600
|
},
|
|
11601
|
+
{
|
|
11602
|
+
"fileName": "planet.ts",
|
|
11603
|
+
"filePath": "/projects/lookup/documentation/code-examples/autocomplete/advanced/planet.ts",
|
|
11604
|
+
"rawContents": "export interface Planet {\n name?: string;\n description?: string;\n}\n"
|
|
11605
|
+
},
|
|
11601
11606
|
{
|
|
11602
11607
|
"fileName": "autocomplete-demo.component.html",
|
|
11603
11608
|
"filePath": "/projects/lookup/documentation/code-examples/autocomplete/basic/autocomplete-demo.component.html",
|
|
@@ -11606,7 +11611,7 @@
|
|
|
11606
11611
|
{
|
|
11607
11612
|
"fileName": "autocomplete-demo.component.ts",
|
|
11608
11613
|
"filePath": "/projects/lookup/documentation/code-examples/autocomplete/basic/autocomplete-demo.component.ts",
|
|
11609
|
-
"rawContents": "import { Component
|
|
11614
|
+
"rawContents": "import { Component } from '@angular/core';\nimport { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';\n\n@Component({\n selector: 'app-autocomplete-demo',\n templateUrl: './autocomplete-demo.component.html',\n})\nexport class AutocompleteDemoComponent {\n public colors: { name: string }[] = [\n { name: 'Red' },\n { name: 'Blue' },\n { name: 'Green' },\n { name: 'Orange' },\n { name: 'Pink' },\n { name: 'Purple' },\n { name: 'Yellow' },\n { name: 'Brown' },\n { name: 'Turquoise' },\n { name: 'White' },\n { name: 'Black' },\n ];\n\n public myForm: UntypedFormGroup;\n\n constructor(formBuilder: UntypedFormBuilder) {\n this.myForm = formBuilder.group({\n favoriteColor: undefined,\n });\n }\n}\n"
|
|
11610
11615
|
},
|
|
11611
11616
|
{
|
|
11612
11617
|
"fileName": "autocomplete-demo.module.ts",
|
|
@@ -11621,13 +11626,18 @@
|
|
|
11621
11626
|
{
|
|
11622
11627
|
"fileName": "autocomplete-demo.component.ts",
|
|
11623
11628
|
"filePath": "/projects/lookup/documentation/code-examples/autocomplete/custom-search/autocomplete-demo.component.ts",
|
|
11624
|
-
"rawContents": "import { Component
|
|
11629
|
+
"rawContents": "import { Component } from '@angular/core';\nimport {\n UntypedFormBuilder,\n UntypedFormControl,\n UntypedFormGroup,\n} from '@angular/forms';\nimport {\n SkyAutocompleteSearchFunction,\n SkyAutocompleteSearchFunctionResponse,\n} from '@skyux/lookup';\n\nimport { Ocean } from './ocean';\n\n@Component({\n selector: 'app-autocomplete-demo',\n templateUrl: './autocomplete-demo.component.html',\n})\nexport class AutocompleteDemoComponent {\n public myForm: UntypedFormGroup;\n\n public largestOcean: UntypedFormControl;\n\n public oceans: Ocean[] = [\n { title: 'Arctic', id: 1 },\n { title: 'Atlantic', id: 2 },\n { title: 'Indian', id: 3 },\n { title: 'Pacific', id: 4 },\n ];\n\n constructor(formBuilder: UntypedFormBuilder) {\n this.largestOcean = formBuilder.control({ title: 'Arctic', id: 1 });\n this.myForm = formBuilder.group({\n largestOcean: this.largestOcean,\n });\n }\n\n public getOceanSearchFunction(): SkyAutocompleteSearchFunction {\n const searchFunction = (\n searchText: string,\n oceans: Ocean[]\n ): SkyAutocompleteSearchFunctionResponse => {\n return new Promise((resolve) => {\n const searchTextLower = searchText.toLowerCase();\n\n const results = oceans.filter((ocean: Ocean) => {\n const val = ocean.title;\n const isMatch =\n val && val.toString().toLowerCase().indexOf(searchTextLower) > -1;\n return isMatch;\n });\n\n // Simulate an async request.\n setTimeout(() => {\n resolve(results);\n }, 500);\n });\n };\n\n return searchFunction;\n }\n}\n"
|
|
11625
11630
|
},
|
|
11626
11631
|
{
|
|
11627
11632
|
"fileName": "autocomplete-demo.module.ts",
|
|
11628
11633
|
"filePath": "/projects/lookup/documentation/code-examples/autocomplete/custom-search/autocomplete-demo.module.ts",
|
|
11629
11634
|
"rawContents": "import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { SkyIdModule } from '@skyux/core';\nimport { SkyIconModule } from '@skyux/indicators';\nimport { SkyAutocompleteModule } from '@skyux/lookup';\n\nimport { AutocompleteDemoComponent } from './autocomplete-demo.component';\n\n@NgModule({\n imports: [\n CommonModule,\n ReactiveFormsModule,\n SkyAutocompleteModule,\n SkyIconModule,\n SkyIdModule,\n ],\n declarations: [AutocompleteDemoComponent],\n exports: [AutocompleteDemoComponent],\n})\nexport class AutocompleteDemoModule {}\n"
|
|
11630
11635
|
},
|
|
11636
|
+
{
|
|
11637
|
+
"fileName": "ocean.ts",
|
|
11638
|
+
"filePath": "/projects/lookup/documentation/code-examples/autocomplete/custom-search/ocean.ts",
|
|
11639
|
+
"rawContents": "export interface Ocean {\n id: number;\n title: string;\n}\n"
|
|
11640
|
+
},
|
|
11631
11641
|
{
|
|
11632
11642
|
"fileName": "autocomplete-demo.component.html",
|
|
11633
11643
|
"filePath": "/projects/lookup/documentation/code-examples/autocomplete/search-filters/autocomplete-demo.component.html",
|
|
@@ -11636,7 +11646,7 @@
|
|
|
11636
11646
|
{
|
|
11637
11647
|
"fileName": "autocomplete-demo.component.ts",
|
|
11638
11648
|
"filePath": "/projects/lookup/documentation/code-examples/autocomplete/search-filters/autocomplete-demo.component.ts",
|
|
11639
|
-
"rawContents": "import { Component
|
|
11649
|
+
"rawContents": "import { Component } from '@angular/core';\nimport { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';\nimport { SkyAutocompleteSearchFunctionFilter } from '@skyux/lookup';\n\n@Component({\n selector: 'app-autocomplete-demo',\n templateUrl: './autocomplete-demo.component.html',\n})\nexport class AutocompleteDemoComponent {\n public colors: { name: string }[] = [\n { name: 'Red' },\n { name: 'Blue' },\n { name: 'Green' },\n { name: 'Orange' },\n { name: 'Pink' },\n { name: 'Purple' },\n { name: 'Yellow' },\n { name: 'Brown' },\n { name: 'Turquoise' },\n { name: 'White' },\n { name: 'Black' },\n ];\n\n public myForm: UntypedFormGroup;\n\n public searchFilters: SkyAutocompleteSearchFunctionFilter[] = [\n (searchText: string, item: { name: string }): boolean => {\n return item.name !== 'Red';\n },\n ];\n\n constructor(formBuilder: UntypedFormBuilder) {\n this.myForm = formBuilder.group({\n favoriteColor: undefined,\n });\n }\n}\n"
|
|
11640
11650
|
},
|
|
11641
11651
|
{
|
|
11642
11652
|
"fileName": "autocomplete-demo.module.ts",
|
|
@@ -11651,7 +11661,7 @@
|
|
|
11651
11661
|
{
|
|
11652
11662
|
"fileName": "country-field-demo.component.ts",
|
|
11653
11663
|
"filePath": "/projects/lookup/documentation/code-examples/country-field/basic/country-field-demo.component.ts",
|
|
11654
|
-
"rawContents": "import { Component
|
|
11664
|
+
"rawContents": "import { Component } from '@angular/core';\nimport {\n UntypedFormControl,\n UntypedFormGroup,\n Validators,\n} from '@angular/forms';\n\n@Component({\n selector: 'app-country-field-demo',\n templateUrl: './country-field-demo.component.html',\n})\nexport class CountryFieldDemoComponent {\n public countryControl: UntypedFormControl;\n\n public countryForm: UntypedFormGroup;\n\n constructor() {\n this.countryControl = new UntypedFormControl();\n this.countryControl.setValue({\n name: 'Australia',\n iso2: 'au',\n });\n this.countryForm = new UntypedFormGroup({\n countryControl: this.countryControl,\n });\n\n this.countryControl.setValidators([Validators.required]);\n }\n}\n"
|
|
11655
11665
|
},
|
|
11656
11666
|
{
|
|
11657
11667
|
"fileName": "country-field-demo.module.ts",
|
|
@@ -11676,12 +11686,12 @@
|
|
|
11676
11686
|
{
|
|
11677
11687
|
"fileName": "lookup-async-demo.component.spec.ts",
|
|
11678
11688
|
"filePath": "/projects/lookup/documentation/code-examples/lookup/async/lookup-async-demo.component.spec.ts",
|
|
11679
|
-
"rawContents": "import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';\nimport { TestBed } from '@angular/core/testing';\nimport { NoopAnimationsModule } from '@angular/platform-browser/animations';\nimport { SkyInputBoxHarness } from '@skyux/forms/testing';\nimport { SkyLookupHarness } from '@skyux/lookup/testing';\n\nimport { of } from 'rxjs';\n\nimport { LookupAsyncDemoComponent } from './lookup-async-demo.component';\nimport { LookupAsyncDemoModule } from './lookup-async-demo.module';\nimport { LookupAsyncDemoService } from './lookup-async-demo.service';\n\ndescribe('Lookup asynchronous search demo', () => {\n let mockSvc!: jasmine.SpyObj<LookupAsyncDemoService>;\n\n async function setupTest() {\n const fixture = TestBed.createComponent(LookupAsyncDemoComponent);\n const loader = TestbedHarnessEnvironment.loader(fixture);\n\n const lookupHarness = await (\n await loader.getHarness(\n SkyInputBoxHarness.with({ dataSkyId: 'favorite-names-field' })\n )\n ).queryHarness(SkyLookupHarness);\n\n return { lookupHarness, fixture };\n }\n\n beforeEach(() => {\n // Create a mock search service. In a real-world application, the search\n // service would make a web request which should be avoided in unit tests.\n mockSvc = jasmine.createSpyObj('LookupAsyncDemoService', ['search']);\n\n TestBed.configureTestingModule({\n imports: [NoopAnimationsModule, LookupAsyncDemoModule],\n providers: [\n {\n provide: LookupAsyncDemoService,\n useValue: mockSvc,\n },\n ],\n });\n });\n\n it('should set the expected initial value', async () => {\n const { lookupHarness } = await setupTest();\n\n await expectAsync(lookupHarness
|
|
11689
|
+
"rawContents": "import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';\nimport { ComponentFixture, TestBed } from '@angular/core/testing';\nimport { NoopAnimationsModule } from '@angular/platform-browser/animations';\nimport { SkyInputBoxHarness } from '@skyux/forms/testing';\nimport { SkyLookupHarness } from '@skyux/lookup/testing';\n\nimport { of } from 'rxjs';\n\nimport { LookupAsyncDemoComponent } from './lookup-async-demo.component';\nimport { LookupAsyncDemoModule } from './lookup-async-demo.module';\nimport { LookupAsyncDemoService } from './lookup-async-demo.service';\n\ndescribe('Lookup asynchronous search demo', () => {\n let mockSvc!: jasmine.SpyObj<LookupAsyncDemoService>;\n\n async function setupTest(): Promise<{\n lookupHarness: SkyLookupHarness | null;\n fixture: ComponentFixture<LookupAsyncDemoComponent>;\n }> {\n const fixture = TestBed.createComponent(LookupAsyncDemoComponent);\n const loader = TestbedHarnessEnvironment.loader(fixture);\n\n const lookupHarness = await (\n await loader.getHarness(\n SkyInputBoxHarness.with({ dataSkyId: 'favorite-names-field' })\n )\n ).queryHarness(SkyLookupHarness);\n\n return { lookupHarness, fixture };\n }\n\n beforeEach(() => {\n // Create a mock search service. In a real-world application, the search\n // service would make a web request which should be avoided in unit tests.\n mockSvc = jasmine.createSpyObj('LookupAsyncDemoService', ['search']);\n\n TestBed.configureTestingModule({\n imports: [NoopAnimationsModule, LookupAsyncDemoModule],\n providers: [\n {\n provide: LookupAsyncDemoService,\n useValue: mockSvc,\n },\n ],\n });\n });\n\n it('should set the expected initial value', async () => {\n const { lookupHarness } = await setupTest();\n\n await expectAsync(lookupHarness?.getSelectionsText()).toBeResolvedTo([\n 'Shirley',\n ]);\n });\n\n it('should update the form control when a favorite name is selected', async () => {\n const { lookupHarness, fixture } = await setupTest();\n\n mockSvc.search.and.callFake((searchText) =>\n of({\n hasMore: false,\n people:\n searchText === 'b'\n ? [\n {\n name: 'Bernard',\n },\n ]\n : [],\n totalCount: 1,\n })\n );\n\n await lookupHarness?.enterText('b');\n await lookupHarness?.selectSearchResult({\n text: 'Bernard',\n });\n\n expect(fixture.componentInstance.favoritesForm.value.favoriteNames).toEqual(\n [{ name: 'Shirley' }, { name: 'Bernard' }]\n );\n });\n});\n"
|
|
11680
11690
|
},
|
|
11681
11691
|
{
|
|
11682
11692
|
"fileName": "lookup-async-demo.component.ts",
|
|
11683
11693
|
"filePath": "/projects/lookup/documentation/code-examples/lookup/async/lookup-async-demo.component.ts",
|
|
11684
|
-
"rawContents": "import { Component, OnInit } from '@angular/core';\nimport { FormBuilder, FormControl, FormGroup } from '@angular/forms';\nimport { SkyAutocompleteSearchAsyncArgs } from '@skyux/lookup';\n\nimport { map } from 'rxjs/operators';\n\nimport { LookupAsyncDemoService } from './lookup-async-demo.service';\nimport { LookupDemoPerson } from './lookup-demo-person';\n\n@Component({\n selector: 'app-async-lookup-demo',\n templateUrl: './lookup-async-demo.component.html',\n styleUrls: ['./lookup-async-demo.component.scss'],\n})\nexport class LookupAsyncDemoComponent implements OnInit {\n public favoritesForm: FormGroup<{\n favoriteNames: FormControl<LookupDemoPerson[]>;\n }>;\n\n #searchSvc: LookupAsyncDemoService;\n\n constructor(formBuilder: FormBuilder, searchSvc: LookupAsyncDemoService) {\n this.#searchSvc = searchSvc;\n\n this.favoritesForm = formBuilder.group({\n favoriteNames:
|
|
11694
|
+
"rawContents": "import { Component, OnInit } from '@angular/core';\nimport { FormBuilder, FormControl, FormGroup } from '@angular/forms';\nimport { SkyAutocompleteSearchAsyncArgs } from '@skyux/lookup';\n\nimport { map } from 'rxjs/operators';\n\nimport { LookupAsyncDemoService } from './lookup-async-demo.service';\nimport { LookupDemoPerson } from './lookup-demo-person';\n\n@Component({\n selector: 'app-async-lookup-demo',\n templateUrl: './lookup-async-demo.component.html',\n styleUrls: ['./lookup-async-demo.component.scss'],\n})\nexport class LookupAsyncDemoComponent implements OnInit {\n public favoritesForm: FormGroup<{\n favoriteNames: FormControl<LookupDemoPerson[] | null>;\n }>;\n\n #searchSvc: LookupAsyncDemoService;\n\n constructor(formBuilder: FormBuilder, searchSvc: LookupAsyncDemoService) {\n this.#searchSvc = searchSvc;\n\n const names = new FormControl<LookupDemoPerson[]>([{ name: 'Shirley' }]);\n\n this.favoritesForm = formBuilder.group({\n favoriteNames: names,\n });\n }\n\n public ngOnInit(): void {\n // If you need to execute some logic after the lookup values change,\n // subscribe to Angular's built-in value changes observable.\n this.favoritesForm.valueChanges.subscribe((changes) => {\n console.log('Lookup value changes:', changes);\n });\n }\n\n public onSubmit(): void {\n alert('Form submitted with: ' + JSON.stringify(this.favoritesForm.value));\n }\n\n public searchAsync(args: SkyAutocompleteSearchAsyncArgs): void {\n // In a real-world application the search service might return an Observable\n // created by calling HttpClient.get(). Assigning that Observable to the result\n // allows the lookup component to cancel the web request if it does not complete\n // before the user searches again.\n args.result = this.#searchSvc.search(args.searchText).pipe(\n map((result) => ({\n hasMore: result.hasMore,\n items: result.people,\n totalCount: result.totalCount,\n }))\n );\n }\n}\n"
|
|
11685
11695
|
},
|
|
11686
11696
|
{
|
|
11687
11697
|
"fileName": "lookup-async-demo.module.ts",
|
|
@@ -11706,7 +11716,7 @@
|
|
|
11706
11716
|
{
|
|
11707
11717
|
"fileName": "lookup-custom-picker-demo-modal.component.ts",
|
|
11708
11718
|
"filePath": "/projects/lookup/documentation/code-examples/lookup/custom-picker/lookup-custom-picker-demo-modal.component.ts",
|
|
11709
|
-
"rawContents": "import { Component } from '@angular/core';\nimport { FormArray, FormBuilder, FormControl, FormGroup } from '@angular/forms';\nimport { SkyLookupShowMoreCustomPickerContext } from '@skyux/lookup';\nimport { SkyModalInstance } from '@skyux/modals';\n\nimport { LookupDemoPerson } from './lookup-demo-person';\n\n@Component({\n selector: 'app-lookup-demo-modal',\n templateUrl: './lookup-custom-picker-demo-modal.component.html',\n})\nexport class LookupCustomPickerDemoModalComponent {\n public peopleForm: FormGroup<{\n people: FormArray<FormControl<boolean>>;\n }>;\n\n public people: LookupDemoPerson[];\n\n #modalInstance: SkyModalInstance;\n\n constructor(\n context: SkyLookupShowMoreCustomPickerContext,\n modalInstance: SkyModalInstance,\n formBuilder: FormBuilder\n ) {\n this.#modalInstance = modalInstance;\n\n // This list of people will be rendered as selection boxes.\n this.people = context.items;\n\n // Create a control for each selection box.\n this.peopleForm = formBuilder.group({\n people: formBuilder.array(\n context.items.map((item) =>\n formBuilder.control(context.initialValue?.includes(item))\n )\n ),\n });\n }\n\n public save(): void {\n // Return a list of selected people to the lookup component.\n const selectedPeople = this.people.filter(\n (_, index)
|
|
11719
|
+
"rawContents": "import { Component } from '@angular/core';\nimport { FormArray, FormBuilder, FormControl, FormGroup } from '@angular/forms';\nimport { SkyLookupShowMoreCustomPickerContext } from '@skyux/lookup';\nimport { SkyModalInstance } from '@skyux/modals';\n\nimport { LookupDemoPerson } from './lookup-demo-person';\n\n@Component({\n selector: 'app-lookup-demo-modal',\n templateUrl: './lookup-custom-picker-demo-modal.component.html',\n})\nexport class LookupCustomPickerDemoModalComponent {\n public peopleForm: FormGroup<{\n people: FormArray<FormControl<boolean>>;\n }>;\n\n public people: LookupDemoPerson[];\n\n #modalInstance: SkyModalInstance;\n\n constructor(\n context: SkyLookupShowMoreCustomPickerContext,\n modalInstance: SkyModalInstance,\n formBuilder: FormBuilder\n ) {\n this.#modalInstance = modalInstance;\n\n // This list of people will be rendered as selection boxes.\n this.people = context.items;\n\n // Create a control for each selection box.\n this.peopleForm = formBuilder.group({\n people: formBuilder.array(\n context.items.map((item) =>\n formBuilder.control(context.initialValue?.includes(item))\n )\n ),\n });\n }\n\n public save(): void {\n // Return a list of selected people to the lookup component.\n const selectedPeople = this.people.filter(\n (_, index) =>\n this.peopleForm.value.people && this.peopleForm.value.people[index]\n );\n\n this.#modalInstance.save(selectedPeople);\n }\n}\n"
|
|
11710
11720
|
},
|
|
11711
11721
|
{
|
|
11712
11722
|
"fileName": "lookup-custom-picker-demo.component.html",
|
|
@@ -11721,12 +11731,12 @@
|
|
|
11721
11731
|
{
|
|
11722
11732
|
"fileName": "lookup-custom-picker-demo.component.spec.ts",
|
|
11723
11733
|
"filePath": "/projects/lookup/documentation/code-examples/lookup/custom-picker/lookup-custom-picker-demo.component.spec.ts",
|
|
11724
|
-
"rawContents": "import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';\nimport { TestBed } from '@angular/core/testing';\nimport { NoopAnimationsModule } from '@angular/platform-browser/animations';\nimport { SkyInputBoxHarness } from '@skyux/forms/testing';\nimport { SkyLookupHarness } from '@skyux/lookup/testing';\n\nimport { LookupCustomPickerDemoComponent } from './lookup-custom-picker-demo.component';\nimport { LookupCustomPickerDemoModule } from './lookup-custom-picker-demo.module';\nimport { LookupCustomPickerHarness } from './lookup-custom-picker-harness';\n\ndescribe('Lookup custom picker demo', () => {\n async function setupTest() {\n const fixture = TestBed.createComponent(LookupCustomPickerDemoComponent);\n const loader = TestbedHarnessEnvironment.loader(fixture);\n\n const lookupHarness = await (\n await loader.getHarness(\n SkyInputBoxHarness.with({ dataSkyId: 'favorite-names-field' })\n )\n ).queryHarness(SkyLookupHarness);\n\n return { lookupHarness, fixture };\n }\n\n beforeEach(() => {\n TestBed.configureTestingModule({\n imports: [LookupCustomPickerDemoModule, NoopAnimationsModule],\n });\n });\n\n it('should set the expected initial value', async () => {\n const { lookupHarness } = await setupTest();\n\n await expectAsync(lookupHarness
|
|
11734
|
+
"rawContents": "import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';\nimport { ComponentFixture, TestBed } from '@angular/core/testing';\nimport { NoopAnimationsModule } from '@angular/platform-browser/animations';\nimport { SkyInputBoxHarness } from '@skyux/forms/testing';\nimport { SkyLookupHarness } from '@skyux/lookup/testing';\n\nimport { LookupCustomPickerDemoComponent } from './lookup-custom-picker-demo.component';\nimport { LookupCustomPickerDemoModule } from './lookup-custom-picker-demo.module';\nimport { LookupCustomPickerHarness } from './lookup-custom-picker-harness';\n\ndescribe('Lookup custom picker demo', () => {\n async function setupTest(): Promise<{\n lookupHarness: SkyLookupHarness | null;\n fixture: ComponentFixture<LookupCustomPickerDemoComponent>;\n }> {\n const fixture = TestBed.createComponent(LookupCustomPickerDemoComponent);\n const loader = TestbedHarnessEnvironment.loader(fixture);\n\n const lookupHarness = await (\n await loader.getHarness(\n SkyInputBoxHarness.with({ dataSkyId: 'favorite-names-field' })\n )\n ).queryHarness(SkyLookupHarness);\n\n return { lookupHarness, fixture };\n }\n\n beforeEach(() => {\n TestBed.configureTestingModule({\n imports: [LookupCustomPickerDemoModule, NoopAnimationsModule],\n });\n });\n\n it('should set the expected initial value', async () => {\n const { lookupHarness } = await setupTest();\n\n await expectAsync(lookupHarness?.getSelectionsText()).toBeResolvedTo([\n 'Shirley',\n ]);\n });\n\n it('should update the form control when a favorite name is selected', async () => {\n const { lookupHarness, fixture } = await setupTest();\n\n await lookupHarness?.enterText('vick');\n\n const allResultHarnesses = await lookupHarness?.getSearchResults();\n const firstResultHarness = allResultHarnesses && allResultHarnesses[0];\n\n if (firstResultHarness) {\n await firstResultHarness.select();\n }\n\n expect(fixture.componentInstance.favoritesForm.value.favoriteNames).toEqual(\n [\n { name: 'Shirley', formal: 'Ms. Bennett' },\n { name: 'Vicki', formal: 'Ms. Jenkins' },\n ]\n );\n });\n\n it('should use a custom picker', async () => {\n const { lookupHarness, fixture } = await setupTest();\n\n // Show the custom picker.\n await lookupHarness?.clickShowMoreButton();\n\n // Use the custom picker harness to validate that selecting/deslecting items\n // updates the lookup form field.\n const loader = TestbedHarnessEnvironment.documentRootLoader(fixture);\n\n const customPickerHarness = await loader.getHarness(\n LookupCustomPickerHarness\n );\n\n await customPickerHarness.checkItemAt(3); // Britta (Ms. Perry)\n await customPickerHarness.checkItemAt(7); // Garret (Mr. Lambert)\n await customPickerHarness.uncheckItemAt(15); // Shirley (Ms. Bennett)\n\n await customPickerHarness.save();\n\n expect(fixture.componentInstance.favoritesForm.value.favoriteNames).toEqual(\n [\n { name: 'Britta', formal: 'Ms. Perry' },\n { name: 'Garrett', formal: 'Mr. Lambert' },\n ]\n );\n });\n});\n"
|
|
11725
11735
|
},
|
|
11726
11736
|
{
|
|
11727
11737
|
"fileName": "lookup-custom-picker-demo.component.ts",
|
|
11728
11738
|
"filePath": "/projects/lookup/documentation/code-examples/lookup/custom-picker/lookup-custom-picker-demo.component.ts",
|
|
11729
|
-
"rawContents": "import { Component, OnInit } from '@angular/core';\nimport { FormBuilder, FormControl, FormGroup } from '@angular/forms';\nimport {\n SkyAutocompleteSearchFunctionFilter,\n SkyLookupShowMoreConfig,\n SkyLookupShowMoreCustomPickerContext,\n} from '@skyux/lookup';\nimport { SkyModalService } from '@skyux/modals';\n\nimport { LookupCustomPickerDemoModalComponent } from './lookup-custom-picker-demo-modal.component';\nimport { LookupDemoPerson } from './lookup-demo-person';\n\n@Component({\n selector: 'app-lookup-demo',\n templateUrl: './lookup-custom-picker-demo.component.html',\n styleUrls: ['./lookup-custom-picker-demo.component.scss'],\n})\nexport class LookupCustomPickerDemoComponent implements OnInit {\n public favoritesForm: FormGroup<{\n favoriteNames: FormControl<LookupDemoPerson[]>;\n }>;\n\n public showMoreConfig: SkyLookupShowMoreConfig;\n public searchFilters: SkyAutocompleteSearchFunctionFilter[];\n\n public people: LookupDemoPerson[] = [\n {\n name: 'Abed',\n formal: 'Mr. Nadir',\n },\n {\n name: 'Alex',\n formal: 'Mr. Osbourne',\n },\n {\n name: 'Ben',\n formal: 'Mr. Chang',\n },\n {\n name: 'Britta',\n formal: 'Ms. Perry',\n },\n {\n name: 'Buzz',\n formal: 'Mr. Hickey',\n },\n {\n name: 'Craig',\n formal: 'Mr. Pelton',\n },\n {\n name: 'Elroy',\n formal: 'Mr. Patashnik',\n },\n {\n name: 'Garrett',\n formal: 'Mr. Lambert',\n },\n {\n name: 'Ian',\n formal: 'Mr. Duncan',\n },\n {\n name: 'Jeff',\n formal: 'Mr. Winger',\n },\n {\n name: 'Leonard',\n formal: 'Mr. Rodriguez',\n },\n {\n name: 'Neil',\n formal: 'Mr. Neil',\n },\n {\n name: 'Pierce',\n formal: 'Mr. Hawthorne',\n },\n {\n name: 'Preston',\n formal: 'Mr. Koogler',\n },\n {\n name: 'Rachel',\n formal: 'Ms. Rachel',\n },\n {\n name: 'Shirley',\n formal: 'Ms. Bennett',\n },\n {\n name: 'Todd',\n formal: 'Mr. Jacobson',\n },\n {\n name: 'Troy',\n formal: 'Mr. Barnes',\n },\n {\n name: 'Vaughn',\n formal: 'Mr. Miller',\n },\n {\n name: 'Vicki',\n formal: 'Ms. Jenkins',\n },\n ];\n\n constructor(formBuilder: FormBuilder, modalService: SkyModalService) {\n this.favoritesForm = formBuilder.group({\n favoriteNames: [[this.people[15]]],\n });\n\n this.searchFilters = [\n (_, item) => {\n const names = this.favoritesForm.value.favoriteNames;\n\n // Only show people in the search results that have not been chosen already.\n return !names
|
|
11739
|
+
"rawContents": "import { Component, OnInit } from '@angular/core';\nimport { FormBuilder, FormControl, FormGroup } from '@angular/forms';\nimport {\n SkyAutocompleteSearchFunctionFilter,\n SkyLookupShowMoreConfig,\n SkyLookupShowMoreCustomPickerContext,\n} from '@skyux/lookup';\nimport { SkyModalService } from '@skyux/modals';\n\nimport { LookupCustomPickerDemoModalComponent } from './lookup-custom-picker-demo-modal.component';\nimport { LookupDemoPerson } from './lookup-demo-person';\n\n@Component({\n selector: 'app-lookup-demo',\n templateUrl: './lookup-custom-picker-demo.component.html',\n styleUrls: ['./lookup-custom-picker-demo.component.scss'],\n})\nexport class LookupCustomPickerDemoComponent implements OnInit {\n public favoritesForm: FormGroup<{\n favoriteNames: FormControl<LookupDemoPerson[] | null>;\n }>;\n\n public showMoreConfig: SkyLookupShowMoreConfig;\n public searchFilters: SkyAutocompleteSearchFunctionFilter[];\n\n public people: LookupDemoPerson[] = [\n {\n name: 'Abed',\n formal: 'Mr. Nadir',\n },\n {\n name: 'Alex',\n formal: 'Mr. Osbourne',\n },\n {\n name: 'Ben',\n formal: 'Mr. Chang',\n },\n {\n name: 'Britta',\n formal: 'Ms. Perry',\n },\n {\n name: 'Buzz',\n formal: 'Mr. Hickey',\n },\n {\n name: 'Craig',\n formal: 'Mr. Pelton',\n },\n {\n name: 'Elroy',\n formal: 'Mr. Patashnik',\n },\n {\n name: 'Garrett',\n formal: 'Mr. Lambert',\n },\n {\n name: 'Ian',\n formal: 'Mr. Duncan',\n },\n {\n name: 'Jeff',\n formal: 'Mr. Winger',\n },\n {\n name: 'Leonard',\n formal: 'Mr. Rodriguez',\n },\n {\n name: 'Neil',\n formal: 'Mr. Neil',\n },\n {\n name: 'Pierce',\n formal: 'Mr. Hawthorne',\n },\n {\n name: 'Preston',\n formal: 'Mr. Koogler',\n },\n {\n name: 'Rachel',\n formal: 'Ms. Rachel',\n },\n {\n name: 'Shirley',\n formal: 'Ms. Bennett',\n },\n {\n name: 'Todd',\n formal: 'Mr. Jacobson',\n },\n {\n name: 'Troy',\n formal: 'Mr. Barnes',\n },\n {\n name: 'Vaughn',\n formal: 'Mr. Miller',\n },\n {\n name: 'Vicki',\n formal: 'Ms. Jenkins',\n },\n ];\n\n constructor(formBuilder: FormBuilder, modalService: SkyModalService) {\n this.favoritesForm = formBuilder.group({\n favoriteNames: [[this.people[15]]],\n });\n\n this.searchFilters = [\n (_, item): boolean => {\n const names = this.favoritesForm.value.favoriteNames;\n\n // Only show people in the search results that have not been chosen already.\n return !names?.some((option) => option.name === item.name);\n },\n ];\n\n this.showMoreConfig = {\n customPicker: {\n open: (context): void => {\n const instance = modalService.open(\n LookupCustomPickerDemoModalComponent,\n {\n providers: [\n {\n provide: SkyLookupShowMoreCustomPickerContext,\n useValue: context,\n },\n ],\n size: 'large',\n }\n );\n\n instance.closed.subscribe((closeArgs) => {\n if (closeArgs.reason === 'save') {\n this.favoritesForm.controls.favoriteNames.setValue(\n closeArgs.data\n );\n }\n });\n },\n },\n };\n }\n\n public ngOnInit(): void {\n // If you need to execute some logic after the lookup values change,\n // subscribe to Angular's built-in value changes observable.\n this.favoritesForm.valueChanges.subscribe((changes) => {\n console.log('Lookup value changes:', changes);\n });\n }\n\n public onAddButtonClicked(): void {\n alert('Add button clicked!');\n }\n\n public onSubmit(): void {\n alert('Form submitted with: ' + JSON.stringify(this.favoritesForm.value));\n }\n}\n"
|
|
11730
11740
|
},
|
|
11731
11741
|
{
|
|
11732
11742
|
"fileName": "lookup-custom-picker-demo.module.ts",
|
|
@@ -11761,12 +11771,12 @@
|
|
|
11761
11771
|
{
|
|
11762
11772
|
"fileName": "lookup-multiple-demo.component.spec.ts",
|
|
11763
11773
|
"filePath": "/projects/lookup/documentation/code-examples/lookup/multi-select/lookup-multiple-demo.component.spec.ts",
|
|
11764
|
-
"rawContents": "import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';\nimport { TestBed } from '@angular/core/testing';\nimport { NoopAnimationsModule } from '@angular/platform-browser/animations';\nimport { SkyInputBoxHarness } from '@skyux/forms/testing';\nimport { SkyLookupHarness } from '@skyux/lookup/testing';\n\nimport { LookupMultipleSelectDemoComponent } from './lookup-multiple-demo.component';\nimport { LookupMultipleSelectDemoModule } from './lookup-multiple-demo.module';\n\ndescribe('Lookup multi-select demo', () => {\n async function setupTest() {\n const fixture = TestBed.createComponent(LookupMultipleSelectDemoComponent);\n const loader = TestbedHarnessEnvironment.loader(fixture);\n\n const lookupHarness = await (\n await loader.getHarness(\n SkyInputBoxHarness.with({ dataSkyId: 'favorite-names-field' })\n )\n ).queryHarness(SkyLookupHarness);\n\n return { lookupHarness, fixture };\n }\n\n beforeEach(() => {\n TestBed.configureTestingModule({\n imports: [LookupMultipleSelectDemoModule, NoopAnimationsModule],\n });\n });\n\n it('should set the expected initial value', async () => {\n const { lookupHarness } = await setupTest();\n\n await expectAsync(lookupHarness
|
|
11774
|
+
"rawContents": "import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';\nimport { ComponentFixture, TestBed } from '@angular/core/testing';\nimport { NoopAnimationsModule } from '@angular/platform-browser/animations';\nimport { SkyInputBoxHarness } from '@skyux/forms/testing';\nimport { SkyLookupHarness } from '@skyux/lookup/testing';\n\nimport { LookupMultipleSelectDemoComponent } from './lookup-multiple-demo.component';\nimport { LookupMultipleSelectDemoModule } from './lookup-multiple-demo.module';\n\ndescribe('Lookup multi-select demo', () => {\n async function setupTest(): Promise<{\n lookupHarness: SkyLookupHarness | null;\n fixture: ComponentFixture<LookupMultipleSelectDemoComponent>;\n }> {\n const fixture = TestBed.createComponent(LookupMultipleSelectDemoComponent);\n const loader = TestbedHarnessEnvironment.loader(fixture);\n\n const lookupHarness = await (\n await loader.getHarness(\n SkyInputBoxHarness.with({ dataSkyId: 'favorite-names-field' })\n )\n ).queryHarness(SkyLookupHarness);\n\n return { lookupHarness, fixture };\n }\n\n beforeEach(() => {\n TestBed.configureTestingModule({\n imports: [LookupMultipleSelectDemoModule, NoopAnimationsModule],\n });\n });\n\n it('should set the expected initial value', async () => {\n const { lookupHarness } = await setupTest();\n\n await expectAsync(lookupHarness?.getSelectionsText()).toBeResolvedTo([\n 'Shirley',\n ]);\n });\n\n it('should update the form control when a favorite name is selected', async () => {\n const { lookupHarness, fixture } = await setupTest();\n\n await lookupHarness?.enterText('vick');\n await lookupHarness?.selectSearchResult({\n text: 'Vicki',\n });\n\n expect(\n fixture.componentInstance.favoritesForm.controls.favoriteNames.value\n ).toEqual([{ name: 'Shirley' }, { name: 'Vicki' }]);\n });\n});\n"
|
|
11765
11775
|
},
|
|
11766
11776
|
{
|
|
11767
11777
|
"fileName": "lookup-multiple-demo.component.ts",
|
|
11768
11778
|
"filePath": "/projects/lookup/documentation/code-examples/lookup/multi-select/lookup-multiple-demo.component.ts",
|
|
11769
|
-
"rawContents": "import { Component, OnInit } from '@angular/core';\nimport { FormBuilder, FormControl, FormGroup } from '@angular/forms';\nimport { SkyAutocompleteSearchFunctionFilter } from '@skyux/lookup';\n\nimport { LookupDemoPerson } from './lookup-demo-person';\n\n@Component({\n selector: 'app-lookup-demo',\n templateUrl: './lookup-multiple-demo.component.html',\n styleUrls: ['./lookup-multiple-demo.component.scss'],\n})\nexport class LookupMultipleSelectDemoComponent implements OnInit {\n public favoritesForm: FormGroup<{\n favoriteNames: FormControl<LookupDemoPerson[]>;\n }>;\n\n public searchFilters: SkyAutocompleteSearchFunctionFilter[];\n\n public people: LookupDemoPerson[] = [\n { name: 'Abed' },\n { name: 'Alex' },\n { name: 'Ben' },\n { name: 'Britta' },\n { name: 'Buzz' },\n { name: 'Craig' },\n { name: 'Elroy' },\n { name: 'Garrett' },\n { name: 'Ian' },\n { name: 'Jeff' },\n { name: 'Leonard' },\n { name: 'Neil' },\n { name: 'Pierce' },\n { name: 'Preston' },\n { name: 'Rachel' },\n { name: 'Shirley' },\n { name: 'Todd' },\n { name: 'Troy' },\n { name: 'Vaughn' },\n { name: 'Vicki' },\n ];\n\n constructor(formBuilder: FormBuilder) {\n this.favoritesForm = formBuilder.group({\n favoriteNames: [[this.people[15]]],\n });\n }\n\n public ngOnInit(): void {\n // If you need to execute some logic after the lookup values change,\n // subscribe to Angular's built-in value changes observable.\n this.favoritesForm.valueChanges.subscribe((changes) => {\n console.log('Lookup value changes:', changes);\n });\n\n this.searchFilters = [\n (_, item, args) => {\n // When in the modal view, show all people in the search results, regardless if they have been chosen already.\n if (args
|
|
11779
|
+
"rawContents": "import { Component, OnInit } from '@angular/core';\nimport { FormBuilder, FormControl, FormGroup } from '@angular/forms';\nimport { SkyAutocompleteSearchFunctionFilter } from '@skyux/lookup';\n\nimport { LookupDemoPerson } from './lookup-demo-person';\n\n@Component({\n selector: 'app-lookup-demo',\n templateUrl: './lookup-multiple-demo.component.html',\n styleUrls: ['./lookup-multiple-demo.component.scss'],\n})\nexport class LookupMultipleSelectDemoComponent implements OnInit {\n public favoritesForm: FormGroup<{\n favoriteNames: FormControl<LookupDemoPerson[] | null>;\n }>;\n\n public searchFilters: SkyAutocompleteSearchFunctionFilter[] = [];\n\n public people: LookupDemoPerson[] = [\n { name: 'Abed' },\n { name: 'Alex' },\n { name: 'Ben' },\n { name: 'Britta' },\n { name: 'Buzz' },\n { name: 'Craig' },\n { name: 'Elroy' },\n { name: 'Garrett' },\n { name: 'Ian' },\n { name: 'Jeff' },\n { name: 'Leonard' },\n { name: 'Neil' },\n { name: 'Pierce' },\n { name: 'Preston' },\n { name: 'Rachel' },\n { name: 'Shirley' },\n { name: 'Todd' },\n { name: 'Troy' },\n { name: 'Vaughn' },\n { name: 'Vicki' },\n ];\n\n constructor(formBuilder: FormBuilder) {\n this.favoritesForm = formBuilder.group({\n favoriteNames: [[this.people[15]]],\n });\n }\n\n public ngOnInit(): void {\n // If you need to execute some logic after the lookup values change,\n // subscribe to Angular's built-in value changes observable.\n this.favoritesForm.valueChanges.subscribe((changes) => {\n console.log('Lookup value changes:', changes);\n });\n\n this.searchFilters = [\n (_, item, args): boolean => {\n // When in the modal view, show all people in the search results, regardless if they have been chosen already.\n if (args?.context === 'modal') {\n return true;\n }\n\n const names = this.favoritesForm.value.favoriteNames;\n\n // When in the popover view (or in any other view), show people in the search results that have not been chosen already.\n return !names?.some((option) => option.name === item.name);\n },\n ];\n }\n\n public onAddButtonClicked(): void {\n alert('Add button clicked!');\n }\n\n public onSubmit(): void {\n alert('Form submitted with: ' + JSON.stringify(this.favoritesForm.value));\n }\n}\n"
|
|
11770
11780
|
},
|
|
11771
11781
|
{
|
|
11772
11782
|
"fileName": "lookup-multiple-demo.module.ts",
|
|
@@ -11791,12 +11801,12 @@
|
|
|
11791
11801
|
{
|
|
11792
11802
|
"fileName": "lookup-result-templates-demo.component.spec.ts",
|
|
11793
11803
|
"filePath": "/projects/lookup/documentation/code-examples/lookup/result-templates/lookup-result-templates-demo.component.spec.ts",
|
|
11794
|
-
"rawContents": "import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';\nimport { TestBed } from '@angular/core/testing';\nimport { NoopAnimationsModule } from '@angular/platform-browser/animations';\nimport { SkyInputBoxHarness } from '@skyux/forms/testing';\nimport { SkyLookupHarness } from '@skyux/lookup/testing';\n\nimport { LookupResultTemplatesDemoComponent } from './lookup-result-templates-demo.component';\nimport { LookupResultTemplatesDemoModule } from './lookup-result-templates-demo.module';\nimport { LookupResultTemplatesItemHarness } from './lookup-result-templates-item-harness';\n\ndescribe('Lookup result templates demo', () => {\n async function setupTest() {\n const fixture = TestBed.createComponent(LookupResultTemplatesDemoComponent);\n const loader = TestbedHarnessEnvironment.loader(fixture);\n\n const lookupHarness = await (\n await loader.getHarness(\n SkyInputBoxHarness.with({ dataSkyId: 'favorite-names-field' })\n )\n ).queryHarness(SkyLookupHarness);\n\n return { lookupHarness, fixture };\n }\n\n beforeEach(() => {\n TestBed.configureTestingModule({\n imports: [LookupResultTemplatesDemoModule, NoopAnimationsModule],\n });\n });\n\n it('should set the expected initial value', async () => {\n const { lookupHarness } = await setupTest();\n\n await expectAsync(lookupHarness
|
|
11804
|
+
"rawContents": "import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';\nimport { ComponentFixture, TestBed } from '@angular/core/testing';\nimport { NoopAnimationsModule } from '@angular/platform-browser/animations';\nimport { SkyInputBoxHarness } from '@skyux/forms/testing';\nimport { SkyLookupHarness } from '@skyux/lookup/testing';\n\nimport { LookupResultTemplatesDemoComponent } from './lookup-result-templates-demo.component';\nimport { LookupResultTemplatesDemoModule } from './lookup-result-templates-demo.module';\nimport { LookupResultTemplatesItemHarness } from './lookup-result-templates-item-harness';\n\ndescribe('Lookup result templates demo', () => {\n async function setupTest(): Promise<{\n lookupHarness: SkyLookupHarness | null;\n fixture: ComponentFixture<LookupResultTemplatesDemoComponent>;\n }> {\n const fixture = TestBed.createComponent(LookupResultTemplatesDemoComponent);\n const loader = TestbedHarnessEnvironment.loader(fixture);\n\n const lookupHarness = await (\n await loader.getHarness(\n SkyInputBoxHarness.with({ dataSkyId: 'favorite-names-field' })\n )\n ).queryHarness(SkyLookupHarness);\n\n return { lookupHarness, fixture };\n }\n\n beforeEach(() => {\n TestBed.configureTestingModule({\n imports: [LookupResultTemplatesDemoModule, NoopAnimationsModule],\n });\n });\n\n it('should set the expected initial value', async () => {\n const { lookupHarness } = await setupTest();\n\n await expectAsync(lookupHarness?.getSelectionsText()).toBeResolvedTo([\n 'Shirley',\n ]);\n });\n\n it('should use the expected dropdown item template', async () => {\n const { lookupHarness } = await setupTest();\n\n await lookupHarness?.enterText('vick');\n\n const results = await lookupHarness?.getSearchResults();\n const templateItemHarness =\n results &&\n (await results[0].queryHarness(LookupResultTemplatesItemHarness));\n\n await expectAsync(templateItemHarness?.getName()).toBeResolvedTo('Vicki');\n await expectAsync(templateItemHarness?.getFormalName()).toBeResolvedTo(\n 'Ms. Jenkins'\n );\n });\n\n it('should use the expected modal item template', async () => {\n const { lookupHarness } = await setupTest();\n\n await lookupHarness?.clickShowMoreButton();\n\n const pickerHarness = await lookupHarness?.getShowMorePicker();\n await pickerHarness?.enterSearchText('vick');\n\n const results = await pickerHarness?.getSearchResults();\n const templateItemHarness =\n results &&\n (await results[0].queryHarness(LookupResultTemplatesItemHarness));\n\n await expectAsync(templateItemHarness?.getName()).toBeResolvedTo('Vicki');\n await expectAsync(templateItemHarness?.getFormalName()).toBeResolvedTo(\n 'Ms. Jenkins'\n );\n });\n\n it('should update the form control when a favorite name is selected', async () => {\n const { lookupHarness, fixture } = await setupTest();\n\n await lookupHarness?.enterText('vick');\n\n const allResultHarnesses = await lookupHarness?.getSearchResults();\n const firstResultHarness = allResultHarnesses && allResultHarnesses[0];\n await firstResultHarness?.select();\n\n expect(\n fixture.componentInstance.favoritesForm.controls.favoriteNames.value\n ).toEqual([\n { name: 'Shirley', formal: 'Ms. Bennett' },\n { name: 'Vicki', formal: 'Ms. Jenkins' },\n ]);\n });\n});\n"
|
|
11795
11805
|
},
|
|
11796
11806
|
{
|
|
11797
11807
|
"fileName": "lookup-result-templates-demo.component.ts",
|
|
11798
11808
|
"filePath": "/projects/lookup/documentation/code-examples/lookup/result-templates/lookup-result-templates-demo.component.ts",
|
|
11799
|
-
"rawContents": "import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core';\nimport { FormBuilder, FormControl, FormGroup } from '@angular/forms';\nimport {\n SkyAutocompleteSearchFunctionFilter,\n SkyLookupShowMoreConfig,\n} from '@skyux/lookup';\n\nimport { LookupDemoPerson } from './lookup-demo-person';\n\n@Component({\n selector: 'app-lookup-demo',\n templateUrl: './lookup-result-templates-demo.component.html',\n styleUrls: ['./lookup-result-templates-demo.component.scss'],\n})\nexport class LookupResultTemplatesDemoComponent implements OnInit {\n public favoritesForm: FormGroup<{\n favoriteNames: FormControl<LookupDemoPerson[]>;\n }>;\n\n public searchFilters: SkyAutocompleteSearchFunctionFilter[];\n\n public people: LookupDemoPerson[] = [\n {\n name: 'Abed',\n formal: 'Mr. Nadir',\n },\n {\n name: 'Alex',\n formal: 'Mr. Osbourne',\n },\n {\n name: 'Ben',\n formal: 'Mr. Chang',\n },\n {\n name: 'Britta',\n formal: 'Ms. Perry',\n },\n {\n name: 'Buzz',\n formal: 'Mr. Hickey',\n },\n {\n name: 'Craig',\n formal: 'Mr. Pelton',\n },\n {\n name: 'Elroy',\n formal: 'Mr. Patashnik',\n },\n {\n name: 'Garrett',\n formal: 'Mr. Lambert',\n },\n {\n name: 'Ian',\n formal: 'Mr. Duncan',\n },\n {\n name: 'Jeff',\n formal: 'Mr. Winger',\n },\n {\n name: 'Leonard',\n formal: 'Mr. Rodriguez',\n },\n {\n name: 'Neil',\n formal: 'Mr. Neil',\n },\n {\n name: 'Pierce',\n formal: 'Mr. Hawthorne',\n },\n {\n name: 'Preston',\n formal: 'Mr. Koogler',\n },\n {\n name: 'Rachel',\n formal: 'Ms. Rachel',\n },\n {\n name: 'Shirley',\n formal: 'Ms. Bennett',\n },\n {\n name: 'Todd',\n formal: 'Mr. Jacobson',\n },\n {\n name: 'Troy',\n formal: 'Mr. Barnes',\n },\n {\n name: 'Vaughn',\n formal: 'Mr. Miller',\n },\n {\n name: 'Vicki',\n formal: 'Ms. Jenkins',\n },\n ];\n\n public showMoreConfig: SkyLookupShowMoreConfig = {\n nativePickerConfig: {},\n };\n\n @ViewChild('modalItemTemplate')\n public set modalItemTemplate(template: TemplateRef<unknown>) {\n this.showMoreConfig.nativePickerConfig.itemTemplate = template;\n }\n\n constructor(formBuilder: FormBuilder) {\n this.favoritesForm = formBuilder.group({\n favoriteNames: [[this.people[15]]],\n });\n\n this.searchFilters = [\n (_, item) => {\n const names = this.favoritesForm.value.favoriteNames;\n\n // Only show people in the search results that have not been chosen already.\n return !names
|
|
11809
|
+
"rawContents": "import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core';\nimport { FormBuilder, FormControl, FormGroup } from '@angular/forms';\nimport {\n SkyAutocompleteSearchFunctionFilter,\n SkyLookupShowMoreConfig,\n} from '@skyux/lookup';\n\nimport { LookupDemoPerson } from './lookup-demo-person';\n\n@Component({\n selector: 'app-lookup-demo',\n templateUrl: './lookup-result-templates-demo.component.html',\n styleUrls: ['./lookup-result-templates-demo.component.scss'],\n})\nexport class LookupResultTemplatesDemoComponent implements OnInit {\n public favoritesForm: FormGroup<{\n favoriteNames: FormControl<LookupDemoPerson[] | null>;\n }>;\n\n public searchFilters: SkyAutocompleteSearchFunctionFilter[];\n\n public people: LookupDemoPerson[] = [\n {\n name: 'Abed',\n formal: 'Mr. Nadir',\n },\n {\n name: 'Alex',\n formal: 'Mr. Osbourne',\n },\n {\n name: 'Ben',\n formal: 'Mr. Chang',\n },\n {\n name: 'Britta',\n formal: 'Ms. Perry',\n },\n {\n name: 'Buzz',\n formal: 'Mr. Hickey',\n },\n {\n name: 'Craig',\n formal: 'Mr. Pelton',\n },\n {\n name: 'Elroy',\n formal: 'Mr. Patashnik',\n },\n {\n name: 'Garrett',\n formal: 'Mr. Lambert',\n },\n {\n name: 'Ian',\n formal: 'Mr. Duncan',\n },\n {\n name: 'Jeff',\n formal: 'Mr. Winger',\n },\n {\n name: 'Leonard',\n formal: 'Mr. Rodriguez',\n },\n {\n name: 'Neil',\n formal: 'Mr. Neil',\n },\n {\n name: 'Pierce',\n formal: 'Mr. Hawthorne',\n },\n {\n name: 'Preston',\n formal: 'Mr. Koogler',\n },\n {\n name: 'Rachel',\n formal: 'Ms. Rachel',\n },\n {\n name: 'Shirley',\n formal: 'Ms. Bennett',\n },\n {\n name: 'Todd',\n formal: 'Mr. Jacobson',\n },\n {\n name: 'Troy',\n formal: 'Mr. Barnes',\n },\n {\n name: 'Vaughn',\n formal: 'Mr. Miller',\n },\n {\n name: 'Vicki',\n formal: 'Ms. Jenkins',\n },\n ];\n\n public showMoreConfig: SkyLookupShowMoreConfig = {\n nativePickerConfig: {},\n };\n\n @ViewChild('modalItemTemplate')\n public set modalItemTemplate(template: TemplateRef<unknown>) {\n if (this.showMoreConfig.nativePickerConfig) {\n this.showMoreConfig.nativePickerConfig.itemTemplate = template;\n } else {\n this.showMoreConfig.nativePickerConfig = { itemTemplate: template };\n }\n }\n\n constructor(formBuilder: FormBuilder) {\n this.favoritesForm = formBuilder.group({\n favoriteNames: [[this.people[15]]],\n });\n\n this.searchFilters = [\n (_, item): boolean => {\n const names = this.favoritesForm.value.favoriteNames;\n\n // Only show people in the search results that have not been chosen already.\n return !names?.some((option) => option.name === item.name);\n },\n ];\n }\n\n public ngOnInit(): void {\n // If you need to execute some logic after the lookup values change,\n // subscribe to Angular's built-in value changes observable.\n this.favoritesForm.valueChanges.subscribe((changes) => {\n console.log('Lookup value changes:', changes);\n });\n }\n\n public onAddButtonClicked(): void {\n alert('Add button clicked!');\n }\n\n public onSubmit(): void {\n alert('Form submitted with: ' + JSON.stringify(this.favoritesForm.value));\n }\n}\n"
|
|
11800
11810
|
},
|
|
11801
11811
|
{
|
|
11802
11812
|
"fileName": "lookup-result-templates-demo.module.ts",
|
|
@@ -11826,18 +11836,23 @@
|
|
|
11826
11836
|
{
|
|
11827
11837
|
"fileName": "lookup-single-demo.component.spec.ts",
|
|
11828
11838
|
"filePath": "/projects/lookup/documentation/code-examples/lookup/single-select/lookup-single-demo.component.spec.ts",
|
|
11829
|
-
"rawContents": "import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';\nimport { TestBed } from '@angular/core/testing';\nimport { NoopAnimationsModule } from '@angular/platform-browser/animations';\nimport { SkyInputBoxHarness } from '@skyux/forms/testing';\nimport { SkyLookupHarness } from '@skyux/lookup/testing';\n\nimport { LookupSingleSelectDemoComponent } from './lookup-single-demo.component';\nimport { LookupSingleSelectDemoModule } from './lookup-single-demo.module';\n\ndescribe('Lookup single select demo', () => {\n async function setupTest() {\n const fixture = TestBed.createComponent(LookupSingleSelectDemoComponent);\n const loader = TestbedHarnessEnvironment.loader(fixture);\n\n const lookupHarness = await (\n await loader.getHarness(\n SkyInputBoxHarness.with({ dataSkyId: 'favorite-name-field' })\n )\n ).queryHarness(SkyLookupHarness);\n\n return { lookupHarness, fixture };\n }\n\n beforeEach(() => {\n TestBed.configureTestingModule({\n imports: [LookupSingleSelectDemoModule, NoopAnimationsModule],\n });\n });\n\n it('should set the expected initial value', async () => {\n const { lookupHarness } = await setupTest();\n\n await expectAsync(lookupHarness
|
|
11839
|
+
"rawContents": "import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';\nimport { ComponentFixture, TestBed } from '@angular/core/testing';\nimport { NoopAnimationsModule } from '@angular/platform-browser/animations';\nimport { SkyInputBoxHarness } from '@skyux/forms/testing';\nimport { SkyLookupHarness } from '@skyux/lookup/testing';\n\nimport { LookupSingleSelectDemoComponent } from './lookup-single-demo.component';\nimport { LookupSingleSelectDemoModule } from './lookup-single-demo.module';\n\ndescribe('Lookup single select demo', () => {\n async function setupTest(): Promise<{\n lookupHarness: SkyLookupHarness | null;\n fixture: ComponentFixture<LookupSingleSelectDemoComponent>;\n }> {\n const fixture = TestBed.createComponent(LookupSingleSelectDemoComponent);\n const loader = TestbedHarnessEnvironment.loader(fixture);\n\n const lookupHarness = await (\n await loader.getHarness(\n SkyInputBoxHarness.with({ dataSkyId: 'favorite-name-field' })\n )\n ).queryHarness(SkyLookupHarness);\n\n return { lookupHarness, fixture };\n }\n\n beforeEach(() => {\n TestBed.configureTestingModule({\n imports: [LookupSingleSelectDemoModule, NoopAnimationsModule],\n });\n });\n\n it('should set the expected initial value', async () => {\n const { lookupHarness } = await setupTest();\n\n await expectAsync(lookupHarness?.getValue()).toBeResolvedTo('Shirley');\n });\n\n it('should update the form control when a favorite name is selected', async () => {\n const { lookupHarness, fixture } = await setupTest();\n\n await lookupHarness?.enterText('vick');\n await lookupHarness?.selectSearchResult({\n text: 'Vicki',\n });\n\n expect(fixture.componentInstance.favoritesForm.value.favoriteName).toEqual([\n { name: 'Vicki' },\n ]);\n });\n});\n"
|
|
11830
11840
|
},
|
|
11831
11841
|
{
|
|
11832
11842
|
"fileName": "lookup-single-demo.component.ts",
|
|
11833
11843
|
"filePath": "/projects/lookup/documentation/code-examples/lookup/single-select/lookup-single-demo.component.ts",
|
|
11834
|
-
"rawContents": "import { Component, OnInit } from '@angular/core';\nimport { FormBuilder, FormControl, FormGroup } from '@angular/forms';\nimport { SkyAutocompleteSearchFunctionFilter } from '@skyux/lookup';\n\nimport { LookupDemoPerson } from './lookup-demo-person';\n\n@Component({\n selector: 'app-single-select-lookup-demo',\n templateUrl: './lookup-single-demo.component.html',\n styleUrls: ['./lookup-single-demo.component.scss'],\n})\nexport class LookupSingleSelectDemoComponent implements OnInit {\n public favoritesForm: FormGroup<{\n favoriteName: FormControl<LookupDemoPerson[]>;\n }>;\n\n public searchFilters: SkyAutocompleteSearchFunctionFilter[];\n\n public people: LookupDemoPerson[] = [\n { name: 'Abed' },\n { name: 'Alex' },\n { name: 'Ben' },\n { name: 'Britta' },\n { name: 'Buzz' },\n { name: 'Craig' },\n { name: 'Elroy' },\n { name: 'Garrett' },\n { name: 'Ian' },\n { name: 'Jeff' },\n { name: 'Leonard' },\n { name: 'Neil' },\n { name: 'Pierce' },\n { name: 'Preston' },\n { name: 'Rachel' },\n { name: 'Shirley' },\n { name: 'Todd' },\n { name: 'Troy' },\n { name: 'Vaughn' },\n { name: 'Vicki' },\n ];\n\n public name: LookupDemoPerson[] = [this.people[15]];\n\n constructor(formBuilder: FormBuilder) {\n this.favoritesForm = formBuilder.group({\n favoriteName: [[this.people[15]]],\n });\n\n this.searchFilters = [\n (_, item) => {\n const names = this.favoritesForm.value.favoriteName;\n\n // Only show people in the search results that have not been chosen already.\n return !names
|
|
11844
|
+
"rawContents": "import { Component, OnInit } from '@angular/core';\nimport { FormBuilder, FormControl, FormGroup } from '@angular/forms';\nimport { SkyAutocompleteSearchFunctionFilter } from '@skyux/lookup';\n\nimport { LookupDemoPerson } from './lookup-demo-person';\n\n@Component({\n selector: 'app-single-select-lookup-demo',\n templateUrl: './lookup-single-demo.component.html',\n styleUrls: ['./lookup-single-demo.component.scss'],\n})\nexport class LookupSingleSelectDemoComponent implements OnInit {\n public favoritesForm: FormGroup<{\n favoriteName: FormControl<LookupDemoPerson[] | null>;\n }>;\n\n public searchFilters: SkyAutocompleteSearchFunctionFilter[];\n\n public people: LookupDemoPerson[] = [\n { name: 'Abed' },\n { name: 'Alex' },\n { name: 'Ben' },\n { name: 'Britta' },\n { name: 'Buzz' },\n { name: 'Craig' },\n { name: 'Elroy' },\n { name: 'Garrett' },\n { name: 'Ian' },\n { name: 'Jeff' },\n { name: 'Leonard' },\n { name: 'Neil' },\n { name: 'Pierce' },\n { name: 'Preston' },\n { name: 'Rachel' },\n { name: 'Shirley' },\n { name: 'Todd' },\n { name: 'Troy' },\n { name: 'Vaughn' },\n { name: 'Vicki' },\n ];\n\n public name: LookupDemoPerson[] = [this.people[15]];\n\n constructor(formBuilder: FormBuilder) {\n this.favoritesForm = formBuilder.group({\n favoriteName: [[this.people[15]]],\n });\n\n this.searchFilters = [\n (_, item): boolean => {\n const names = this.favoritesForm.value.favoriteName;\n\n // Only show people in the search results that have not been chosen already.\n return !names?.some((option) => option.name === item.name);\n },\n ];\n }\n\n public ngOnInit(): void {\n // If you need to execute some logic after the lookup values change,\n // subscribe to Angular's built-in value changes observable.\n this.favoritesForm.valueChanges.subscribe((changes) => {\n console.log('Lookup value changes:', changes);\n });\n }\n\n public onAddButtonClicked(): void {\n alert('Add button clicked!');\n }\n\n public onSubmit(): void {\n alert('Form submitted with: ' + JSON.stringify(this.favoritesForm.value));\n }\n}\n"
|
|
11835
11845
|
},
|
|
11836
11846
|
{
|
|
11837
11847
|
"fileName": "lookup-single-demo.module.ts",
|
|
11838
11848
|
"filePath": "/projects/lookup/documentation/code-examples/lookup/single-select/lookup-single-demo.module.ts",
|
|
11839
11849
|
"rawContents": "import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { ReactiveFormsModule } from '@angular/forms';\nimport { SkyIdModule } from '@skyux/core';\nimport { SkyInputBoxModule } from '@skyux/forms';\nimport { SkyLookupModule } from '@skyux/lookup';\n\nimport { LookupSingleSelectDemoComponent } from './lookup-single-demo.component';\n\n@NgModule({\n imports: [\n CommonModule,\n ReactiveFormsModule,\n SkyIdModule,\n SkyInputBoxModule,\n SkyLookupModule,\n ],\n declarations: [LookupSingleSelectDemoComponent],\n exports: [LookupSingleSelectDemoComponent],\n})\nexport class LookupSingleSelectDemoModule {}\n"
|
|
11840
11850
|
},
|
|
11851
|
+
{
|
|
11852
|
+
"fileName": "lookup-demo-item.ts",
|
|
11853
|
+
"filePath": "/projects/lookup/documentation/code-examples/search/basic/lookup-demo-item.ts",
|
|
11854
|
+
"rawContents": "export interface LookupDemoItem {\n title: string;\n note: string;\n}\n"
|
|
11855
|
+
},
|
|
11841
11856
|
{
|
|
11842
11857
|
"fileName": "search-demo.component.html",
|
|
11843
11858
|
"filePath": "/projects/lookup/documentation/code-examples/search/basic/search-demo.component.html",
|
|
@@ -11846,7 +11861,7 @@
|
|
|
11846
11861
|
{
|
|
11847
11862
|
"fileName": "search-demo.component.ts",
|
|
11848
11863
|
"filePath": "/projects/lookup/documentation/code-examples/search/basic/search-demo.component.ts",
|
|
11849
|
-
"rawContents": "import { Component } from '@angular/core';\n\n@Component({\n selector: 'app-search-demo',\n templateUrl: './search-demo.component.html',\n})\nexport class SearchDemoComponent {\n public displayedItems:
|
|
11864
|
+
"rawContents": "import { Component } from '@angular/core';\n\nimport { LookupDemoItem } from './lookup-demo-item';\n\n@Component({\n selector: 'app-search-demo',\n templateUrl: './search-demo.component.html',\n})\nexport class SearchDemoComponent {\n public displayedItems: LookupDemoItem[];\n\n private items: LookupDemoItem[] = [\n {\n title: 'Call Robert Hernandez',\n note: 'Robert recently gave a very generous gift. We should call to thank him.',\n },\n {\n title: 'Send invitation to ball',\n note: \"The Spring Ball is coming up soon. Let's get those invitations out!\",\n },\n {\n title: 'Clean up desk',\n note: 'File and organize papers.',\n },\n {\n title: 'Investigate leads',\n note: 'Check out leads for important charity event funding.',\n },\n {\n title: 'Send thank you note',\n note: 'Send a thank you note to Timothy for his donation.',\n },\n ];\n\n public searchText = '';\n\n constructor() {\n this.displayedItems = this.items;\n }\n\n public searchApplied(searchText: string): void {\n let filteredItems = this.items;\n this.searchText = searchText;\n\n if (searchText) {\n filteredItems = this.items.filter(function (item: LookupDemoItem) {\n let property: keyof typeof item;\n\n for (property in item) {\n if (\n Object.prototype.hasOwnProperty.call(item, property) &&\n (property === 'title' || property === 'note')\n ) {\n if (item[property].indexOf(searchText) > -1) {\n return true;\n }\n }\n }\n\n return false;\n });\n }\n this.displayedItems = filteredItems;\n }\n}\n"
|
|
11850
11865
|
},
|
|
11851
11866
|
{
|
|
11852
11867
|
"fileName": "search-demo.module.ts",
|