@skyux/inline-form 5.0.1 → 5.5.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -4
- package/bundles/skyux-inline-form.umd.js +14 -14
- package/documentation.json +42 -11
- package/esm2015/index.js +10 -0
- package/esm2015/index.js.map +1 -0
- package/esm2015/lib/modules/inline-form/animations/slide-dissolve.js +26 -0
- package/esm2015/lib/modules/inline-form/animations/slide-dissolve.js.map +1 -0
- package/esm2015/lib/modules/inline-form/inline-form-adapter.service.js +62 -0
- package/esm2015/lib/modules/inline-form/inline-form-adapter.service.js.map +1 -0
- package/esm2015/lib/modules/inline-form/inline-form.component.js +227 -0
- package/esm2015/lib/modules/inline-form/inline-form.component.js.map +1 -0
- package/esm2015/lib/modules/inline-form/inline-form.module.js +19 -0
- package/esm2015/lib/modules/inline-form/inline-form.module.js.map +1 -0
- package/esm2015/lib/modules/inline-form/types/inline-form-button-action.js +2 -0
- package/esm2015/lib/modules/inline-form/types/inline-form-button-action.js.map +1 -0
- package/esm2015/lib/modules/inline-form/types/inline-form-button-config.js +2 -0
- package/esm2015/lib/modules/inline-form/types/inline-form-button-config.js.map +1 -0
- package/esm2015/lib/modules/inline-form/types/inline-form-button-layout.js +9 -0
- package/esm2015/lib/modules/inline-form/types/inline-form-button-layout.js.map +1 -0
- package/esm2015/lib/modules/inline-form/types/inline-form-close-args.js +2 -0
- package/esm2015/lib/modules/inline-form/types/inline-form-close-args.js.map +1 -0
- package/esm2015/lib/modules/inline-form/types/inline-form-config.js +2 -0
- package/esm2015/lib/modules/inline-form/types/inline-form-config.js.map +1 -0
- package/esm2015/lib/modules/shared/sky-inline-form-resources.module.js +50 -0
- package/esm2015/lib/modules/shared/sky-inline-form-resources.module.js.map +1 -0
- package/esm2015/skyux-inline-form.js +2 -2
- package/esm2015/skyux-inline-form.js.map +1 -0
- package/fesm2015/skyux-inline-form.js +17 -17
- package/fesm2015/skyux-inline-form.js.map +1 -1
- package/index.d.ts +7 -0
- package/{modules → lib/modules}/inline-form/animations/slide-dissolve.d.ts +0 -0
- package/{modules → lib/modules}/inline-form/inline-form-adapter.service.d.ts +0 -0
- package/{modules → lib/modules}/inline-form/inline-form.component.d.ts +0 -0
- package/{modules → lib/modules}/inline-form/inline-form.module.d.ts +0 -0
- package/{modules → lib/modules}/inline-form/types/inline-form-button-action.d.ts +0 -0
- package/{modules → lib/modules}/inline-form/types/inline-form-button-config.d.ts +0 -0
- package/{modules → lib/modules}/inline-form/types/inline-form-button-layout.d.ts +0 -0
- package/{modules → lib/modules}/inline-form/types/inline-form-close-args.d.ts +0 -0
- package/{modules → lib/modules}/inline-form/types/inline-form-config.d.ts +0 -0
- package/{modules → lib/modules}/shared/sky-inline-form-resources.module.d.ts +0 -0
- package/package.json +6 -6
- package/skyux-inline-form.d.ts +1 -1
- package/bundles/skyux-inline-form.umd.js.map +0 -1
- package/esm2015/modules/inline-form/animations/slide-dissolve.js +0 -26
- package/esm2015/modules/inline-form/inline-form-adapter.service.js +0 -62
- package/esm2015/modules/inline-form/inline-form.component.js +0 -225
- package/esm2015/modules/inline-form/inline-form.module.js +0 -19
- package/esm2015/modules/inline-form/types/inline-form-button-action.js +0 -2
- package/esm2015/modules/inline-form/types/inline-form-button-config.js +0 -2
- package/esm2015/modules/inline-form/types/inline-form-button-layout.js +0 -9
- package/esm2015/modules/inline-form/types/inline-form-close-args.js +0 -2
- package/esm2015/modules/inline-form/types/inline-form-config.js +0 -2
- package/esm2015/modules/shared/sky-inline-form-resources.module.js +0 -50
- package/esm2015/public-api.js +0 -10
- package/public-api.d.ts +0 -7
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
#
|
|
1
|
+
# inline-form
|
|
2
2
|
|
|
3
|
-
[
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
This library was generated with [Nx](https://nx.dev).
|
|
4
|
+
|
|
5
|
+
## Running unit tests
|
|
6
|
+
|
|
7
|
+
Run `nx test inline-form` to execute the unit tests.
|
|
@@ -119,9 +119,9 @@
|
|
|
119
119
|
};
|
|
120
120
|
return SkyInlineFormAdapterService;
|
|
121
121
|
}());
|
|
122
|
-
SkyInlineFormAdapterService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
|
123
|
-
SkyInlineFormAdapterService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.
|
|
124
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
|
122
|
+
SkyInlineFormAdapterService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyInlineFormAdapterService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
123
|
+
SkyInlineFormAdapterService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyInlineFormAdapterService });
|
|
124
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyInlineFormAdapterService, decorators: [{
|
|
125
125
|
type: i0.Injectable
|
|
126
126
|
}] });
|
|
127
127
|
|
|
@@ -328,9 +328,9 @@
|
|
|
328
328
|
};
|
|
329
329
|
return SkyInlineFormComponent;
|
|
330
330
|
}());
|
|
331
|
-
SkyInlineFormComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
|
332
|
-
SkyInlineFormComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.
|
|
333
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
|
331
|
+
SkyInlineFormComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyInlineFormComponent, deps: [{ token: SkyInlineFormAdapterService }, { token: i0__namespace.ElementRef }, { token: i2__namespace.SkyLibResourcesService }, { token: i3__namespace.SkyAppWindowRef }, { token: i0__namespace.ChangeDetectorRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
332
|
+
SkyInlineFormComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyInlineFormComponent, selector: "sky-inline-form", inputs: { config: "config", template: "template", showForm: "showForm" }, outputs: { close: "close" }, providers: [SkyInlineFormAdapterService], ngImport: i0__namespace, template: "<div [@skySlideDissolve]=\"showForm\">\n <div *ngIf=\"!showForm\" class=\"sky-slide-dissolve-first\">\n <ng-content></ng-content>\n </div>\n\n <div *ngIf=\"template && showForm\" class=\"sky-slide-dissolve-last\">\n <div class=\"sky-inline-form sky-shadow sky-box sky-elevation-3\">\n <div class=\"sky-inline-form-content\">\n <ng-container [ngTemplateOutlet]=\"template\"> </ng-container>\n </div>\n <div class=\"sky-inline-form-footer\">\n <button\n *ngFor=\"let button of buttons\"\n class=\"sky-btn {{ 'sky-btn-' + button.styleType }}\"\n type=\"button\"\n [disabled]=\"button.disabled ? true : null\"\n [ngClass]=\"{ 'sky-btn-disabled': button.disabled }\"\n (click)=\"closeInlineForm(button)\"\n >\n {{ button.text }}\n </button>\n </div>\n </div>\n </div>\n</div>\n", styles: [".sky-inline-form{background:#eeeeef;border:1px solid #cdcfd2;padding:10px;width:100%}.sky-inline-form .sky-inline-form-footer{margin-top:20px}.sky-inline-form .sky-inline-form-footer button{margin:0 5px 0 0}:host-context(.sky-theme-modern) .sky-inline-form{background-color:#fff;border:none;padding:15px}:host-context(.sky-theme-modern) .sky-inline-form .sky-inline-form-footer{margin-top:30px}:host-context(.sky-theme-modern) .sky-inline-form .sky-inline-form-footer button{margin-right:10px}.sky-theme-modern .sky-inline-form{background-color:#fff;border:none;padding:15px}.sky-theme-modern .sky-inline-form .sky-inline-form-footer{margin-top:30px}.sky-theme-modern .sky-inline-form .sky-inline-form-footer button{margin-right:10px}:host-context(.sky-theme-modern.sky-theme-mode-dark) .sky-inline-form{background-color:#232427}.sky-theme-modern.sky-theme-mode-dark .sky-inline-form{background-color:#232427}\n"], directives: [{ type: i4__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4__namespace.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i4__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i4__namespace.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], animations: [skySlideDissolve], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
|
|
333
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyInlineFormComponent, decorators: [{
|
|
334
334
|
type: i0.Component,
|
|
335
335
|
args: [{
|
|
336
336
|
selector: 'sky-inline-form',
|
|
@@ -380,16 +380,16 @@
|
|
|
380
380
|
}
|
|
381
381
|
return SkyInlineFormResourcesModule;
|
|
382
382
|
}());
|
|
383
|
-
SkyInlineFormResourcesModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
|
384
|
-
SkyInlineFormResourcesModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.
|
|
385
|
-
SkyInlineFormResourcesModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.
|
|
383
|
+
SkyInlineFormResourcesModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyInlineFormResourcesModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
384
|
+
SkyInlineFormResourcesModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyInlineFormResourcesModule, exports: [i2.SkyI18nModule] });
|
|
385
|
+
SkyInlineFormResourcesModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyInlineFormResourcesModule, providers: [
|
|
386
386
|
{
|
|
387
387
|
provide: i2.SKY_LIB_RESOURCES_PROVIDERS,
|
|
388
388
|
useClass: SkyInlineFormResourcesProvider,
|
|
389
389
|
multi: true,
|
|
390
390
|
},
|
|
391
391
|
], imports: [i2.SkyI18nModule] });
|
|
392
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
|
392
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyInlineFormResourcesModule, decorators: [{
|
|
393
393
|
type: i0.NgModule,
|
|
394
394
|
args: [{
|
|
395
395
|
exports: [i2.SkyI18nModule],
|
|
@@ -408,10 +408,10 @@
|
|
|
408
408
|
}
|
|
409
409
|
return SkyInlineFormModule;
|
|
410
410
|
}());
|
|
411
|
-
SkyInlineFormModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.
|
|
412
|
-
SkyInlineFormModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.
|
|
413
|
-
SkyInlineFormModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.
|
|
414
|
-
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.
|
|
411
|
+
SkyInlineFormModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyInlineFormModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
412
|
+
SkyInlineFormModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyInlineFormModule, declarations: [SkyInlineFormComponent], imports: [i4.CommonModule, SkyInlineFormResourcesModule], exports: [SkyInlineFormComponent] });
|
|
413
|
+
SkyInlineFormModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyInlineFormModule, imports: [[i4.CommonModule, SkyInlineFormResourcesModule]] });
|
|
414
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0__namespace, type: SkyInlineFormModule, decorators: [{
|
|
415
415
|
type: i0.NgModule,
|
|
416
416
|
args: [{
|
|
417
417
|
declarations: [SkyInlineFormComponent],
|
package/documentation.json
CHANGED
|
@@ -130,6 +130,8 @@
|
|
|
130
130
|
"name": "NgModule",
|
|
131
131
|
"type": {
|
|
132
132
|
"type": "reference",
|
|
133
|
+
"qualifiedName": "NgModuleDecorator",
|
|
134
|
+
"package": "@angular/core",
|
|
133
135
|
"name": "NgModule"
|
|
134
136
|
},
|
|
135
137
|
"arguments": {
|
|
@@ -191,6 +193,8 @@
|
|
|
191
193
|
"name": "Component",
|
|
192
194
|
"type": {
|
|
193
195
|
"type": "reference",
|
|
196
|
+
"qualifiedName": "ComponentDecorator",
|
|
197
|
+
"package": "@angular/core",
|
|
194
198
|
"name": "Component"
|
|
195
199
|
},
|
|
196
200
|
"arguments": {
|
|
@@ -245,6 +249,8 @@
|
|
|
245
249
|
"name": "any"
|
|
246
250
|
}
|
|
247
251
|
],
|
|
252
|
+
"qualifiedName": "ElementRef",
|
|
253
|
+
"package": "@angular/core",
|
|
248
254
|
"name": "ElementRef"
|
|
249
255
|
}
|
|
250
256
|
},
|
|
@@ -278,6 +284,8 @@
|
|
|
278
284
|
"flags": {},
|
|
279
285
|
"type": {
|
|
280
286
|
"type": "reference",
|
|
287
|
+
"qualifiedName": "ChangeDetectorRef",
|
|
288
|
+
"package": "@angular/core",
|
|
281
289
|
"name": "ChangeDetectorRef"
|
|
282
290
|
}
|
|
283
291
|
}
|
|
@@ -330,6 +338,8 @@
|
|
|
330
338
|
"name": "Output",
|
|
331
339
|
"type": {
|
|
332
340
|
"type": "reference",
|
|
341
|
+
"qualifiedName": "OutputDecorator",
|
|
342
|
+
"package": "@angular/core",
|
|
333
343
|
"name": "Output"
|
|
334
344
|
},
|
|
335
345
|
"arguments": {}
|
|
@@ -351,6 +361,8 @@
|
|
|
351
361
|
"name": "SkyInlineFormCloseArgs"
|
|
352
362
|
}
|
|
353
363
|
],
|
|
364
|
+
"qualifiedName": "EventEmitter",
|
|
365
|
+
"package": "@angular/core",
|
|
354
366
|
"name": "EventEmitter"
|
|
355
367
|
},
|
|
356
368
|
"defaultValue": "..."
|
|
@@ -377,6 +389,8 @@
|
|
|
377
389
|
"name": "Input",
|
|
378
390
|
"type": {
|
|
379
391
|
"type": "reference",
|
|
392
|
+
"qualifiedName": "InputDecorator",
|
|
393
|
+
"package": "@angular/core",
|
|
380
394
|
"name": "Input"
|
|
381
395
|
},
|
|
382
396
|
"arguments": {}
|
|
@@ -397,6 +411,8 @@
|
|
|
397
411
|
"name": "any"
|
|
398
412
|
}
|
|
399
413
|
],
|
|
414
|
+
"qualifiedName": "TemplateRef",
|
|
415
|
+
"package": "@angular/core",
|
|
400
416
|
"name": "TemplateRef"
|
|
401
417
|
}
|
|
402
418
|
},
|
|
@@ -413,6 +429,8 @@
|
|
|
413
429
|
"name": "Input",
|
|
414
430
|
"type": {
|
|
415
431
|
"type": "reference",
|
|
432
|
+
"qualifiedName": "InputDecorator",
|
|
433
|
+
"package": "@angular/core",
|
|
416
434
|
"name": "Input"
|
|
417
435
|
},
|
|
418
436
|
"arguments": {}
|
|
@@ -433,7 +451,13 @@
|
|
|
433
451
|
"kindString": "Get signature",
|
|
434
452
|
"flags": {},
|
|
435
453
|
"comment": {
|
|
436
|
-
"shortText": "Specifies configuration options for the buttons to display with the inline form."
|
|
454
|
+
"shortText": "Specifies configuration options for the buttons to display with the inline form.",
|
|
455
|
+
"tags": [
|
|
456
|
+
{
|
|
457
|
+
"tag": "required",
|
|
458
|
+
"text": "\n"
|
|
459
|
+
}
|
|
460
|
+
]
|
|
437
461
|
},
|
|
438
462
|
"type": {
|
|
439
463
|
"type": "reference",
|
|
@@ -492,6 +516,8 @@
|
|
|
492
516
|
"name": "Input",
|
|
493
517
|
"type": {
|
|
494
518
|
"type": "reference",
|
|
519
|
+
"qualifiedName": "InputDecorator",
|
|
520
|
+
"package": "@angular/core",
|
|
495
521
|
"name": "Input"
|
|
496
522
|
},
|
|
497
523
|
"arguments": {}
|
|
@@ -512,7 +538,13 @@
|
|
|
512
538
|
"kindString": "Get signature",
|
|
513
539
|
"flags": {},
|
|
514
540
|
"comment": {
|
|
515
|
-
"shortText": "Indicates whether to display the inline form. Users can toggle between displaying\nand hiding the inline form."
|
|
541
|
+
"shortText": "Indicates whether to display the inline form. Users can toggle between displaying\nand hiding the inline form.",
|
|
542
|
+
"tags": [
|
|
543
|
+
{
|
|
544
|
+
"tag": "default",
|
|
545
|
+
"text": "false\n"
|
|
546
|
+
}
|
|
547
|
+
]
|
|
516
548
|
},
|
|
517
549
|
"type": {
|
|
518
550
|
"type": "intrinsic",
|
|
@@ -719,10 +751,14 @@
|
|
|
719
751
|
"implementedTypes": [
|
|
720
752
|
{
|
|
721
753
|
"type": "reference",
|
|
754
|
+
"qualifiedName": "OnInit",
|
|
755
|
+
"package": "@angular/core",
|
|
722
756
|
"name": "OnInit"
|
|
723
757
|
},
|
|
724
758
|
{
|
|
725
759
|
"type": "reference",
|
|
760
|
+
"qualifiedName": "OnDestroy",
|
|
761
|
+
"package": "@angular/core",
|
|
726
762
|
"name": "OnDestroy"
|
|
727
763
|
}
|
|
728
764
|
]
|
|
@@ -1023,18 +1059,13 @@
|
|
|
1023
1059
|
],
|
|
1024
1060
|
"sources": [
|
|
1025
1061
|
{
|
|
1026
|
-
"fileName": "
|
|
1062
|
+
"fileName": "index.ts",
|
|
1027
1063
|
"line": 1,
|
|
1028
1064
|
"character": 0
|
|
1029
1065
|
}
|
|
1030
1066
|
]
|
|
1031
1067
|
},
|
|
1032
1068
|
"codeExamples": [
|
|
1033
|
-
{
|
|
1034
|
-
"fileName": ".eslintrc.json",
|
|
1035
|
-
"filePath": "/projects/inline-form/documentation/code-examples/.eslintrc.json",
|
|
1036
|
-
"rawContents": "{\n \"extends\": [\"../../.eslintrc.json\"],\n \"overrides\": [\n {\n \"files\": [\"*.ts\"],\n \"rules\": {\n \"@angular-eslint/directive-selector\": [\n \"error\",\n {\n \"type\": \"attribute\",\n \"prefix\": \"app\",\n \"style\": \"camelCase\"\n }\n ],\n \"@angular-eslint/component-selector\": [\n \"error\",\n {\n \"type\": \"element\",\n \"prefix\": \"app\",\n \"style\": \"kebab-case\"\n }\n ]\n }\n }\n ]\n}\n"
|
|
1037
|
-
},
|
|
1038
1069
|
{
|
|
1039
1070
|
"fileName": "inline-form-demo.component.html",
|
|
1040
1071
|
"filePath": "/projects/inline-form/documentation/code-examples/inline-form/basic/inline-form-demo.component.html",
|
|
@@ -1043,7 +1074,7 @@
|
|
|
1043
1074
|
{
|
|
1044
1075
|
"fileName": "inline-form-demo.component.ts",
|
|
1045
1076
|
"filePath": "/projects/inline-form/documentation/code-examples/inline-form/basic/inline-form-demo.component.ts",
|
|
1046
|
-
"rawContents": "import { Component, OnInit } from '@angular/core';\n\nimport { FormBuilder, FormControl, FormGroup } from '@angular/forms';\n\nimport {\n SkyInlineFormButtonLayout,\n SkyInlineFormCloseArgs,\n SkyInlineFormConfig,\n} from '@skyux/inline-form';\n\n@Component({\n selector: 'app-inline-form-demo',\n templateUrl: './inline-form-demo.component.html',\n})\nexport class InlineFormDemoComponent implements OnInit {\n public firstName
|
|
1077
|
+
"rawContents": "import { Component, OnInit } from '@angular/core';\n\nimport { FormBuilder, FormControl, FormGroup } from '@angular/forms';\n\nimport {\n SkyInlineFormButtonLayout,\n SkyInlineFormCloseArgs,\n SkyInlineFormConfig,\n} from '@skyux/inline-form';\n\n@Component({\n selector: 'app-inline-form-demo',\n templateUrl: './inline-form-demo.component.html',\n})\nexport class InlineFormDemoComponent implements OnInit {\n public firstName = 'Jane';\n\n public myForm: FormGroup;\n\n public inlineFormConfig: SkyInlineFormConfig = {\n buttonLayout: SkyInlineFormButtonLayout.SaveCancel,\n };\n\n public showForm = false;\n\n constructor(private formBuilder: FormBuilder) {}\n\n public ngOnInit(): void {\n this.myForm = this.formBuilder.group({\n myFirstName: new FormControl(),\n });\n }\n\n public onInlineFormClose(args: SkyInlineFormCloseArgs): void {\n if (args.reason === 'save') {\n this.firstName = this.myForm.get('myFirstName').value;\n }\n\n this.showForm = false;\n this.myForm.patchValue({\n myFirstName: undefined,\n });\n }\n\n public onInlineFormOpen(): void {\n this.showForm = true;\n this.myForm.patchValue({\n myFirstName: this.firstName,\n });\n }\n}\n"
|
|
1047
1078
|
},
|
|
1048
1079
|
{
|
|
1049
1080
|
"fileName": "inline-form-demo.module.ts",
|
|
@@ -1058,7 +1089,7 @@
|
|
|
1058
1089
|
{
|
|
1059
1090
|
"fileName": "inline-form-demo.component.ts",
|
|
1060
1091
|
"filePath": "/projects/inline-form/documentation/code-examples/inline-form/custom-buttons/inline-form-demo.component.ts",
|
|
1061
|
-
"rawContents": "import { Component, OnInit } from '@angular/core';\n\nimport { FormBuilder, FormControl, FormGroup } from '@angular/forms';\n\nimport {\n SkyInlineFormButtonLayout,\n SkyInlineFormCloseArgs,\n SkyInlineFormConfig,\n} from '@skyux/inline-form';\n\n@Component({\n selector: 'app-inline-form-demo',\n templateUrl: './inline-form-demo.component.html',\n})\nexport class InlineFormDemoComponent implements OnInit {\n public firstName
|
|
1092
|
+
"rawContents": "import { Component, OnInit } from '@angular/core';\n\nimport { FormBuilder, FormControl, FormGroup } from '@angular/forms';\n\nimport {\n SkyInlineFormButtonLayout,\n SkyInlineFormCloseArgs,\n SkyInlineFormConfig,\n} from '@skyux/inline-form';\n\n@Component({\n selector: 'app-inline-form-demo',\n templateUrl: './inline-form-demo.component.html',\n})\nexport class InlineFormDemoComponent implements OnInit {\n public firstName = 'Jane';\n\n public myForm: FormGroup;\n\n public inlineFormConfig: SkyInlineFormConfig = {\n buttonLayout: SkyInlineFormButtonLayout.Custom,\n buttons: [\n {\n action: 'save',\n text: 'Save',\n styleType: 'primary',\n },\n {\n action: 'delete',\n text: 'Delete',\n styleType: 'default',\n },\n {\n action: 'reset',\n text: 'Reset',\n styleType: 'default',\n },\n {\n action: 'cancel',\n text: 'Cancel',\n styleType: 'link',\n },\n ],\n };\n\n public showForm = false;\n\n constructor(private formBuilder: FormBuilder) {}\n\n public ngOnInit(): void {\n this.myForm = this.formBuilder.group({\n myFirstName: new FormControl(),\n });\n\n this.myForm.valueChanges.subscribe(() => {\n if (this.inlineFormConfig.buttons[0].disabled !== this.myForm.invalid) {\n this.inlineFormConfig.buttons[0].disabled = this.myForm.invalid;\n this.inlineFormConfig = { ...{}, ...this.inlineFormConfig };\n }\n });\n }\n\n public onInlineFormClose(args: SkyInlineFormCloseArgs): void {\n if (args.reason === 'save') {\n this.firstName = this.myForm.get('myFirstName').value;\n }\n\n this.showForm = false;\n this.myForm.patchValue({\n myFirstName: undefined,\n });\n }\n\n public onInlineFormOpen(): void {\n this.showForm = true;\n this.myForm.patchValue({\n myFirstName: this.firstName,\n });\n }\n}\n"
|
|
1062
1093
|
},
|
|
1063
1094
|
{
|
|
1064
1095
|
"fileName": "inline-form-demo.module.ts",
|
|
@@ -1086,4 +1117,4 @@
|
|
|
1086
1117
|
"rawContents": "import { CommonModule } from '@angular/common';\n\nimport { NgModule } from '@angular/core';\n\nimport { ReactiveFormsModule } from '@angular/forms';\n\nimport { SkyIdModule } from '@skyux/core';\n\nimport { SkyInputBoxModule } from '@skyux/forms';\n\nimport { SkyIconModule } from '@skyux/indicators';\n\nimport { SkyInlineFormModule } from '@skyux/inline-form';\n\nimport { SkyRepeaterModule } from '@skyux/lists';\n\nimport { InlineFormDemoComponent } from './inline-form-demo.component';\n\n@NgModule({\n imports: [\n CommonModule,\n ReactiveFormsModule,\n SkyIconModule,\n SkyIdModule,\n SkyInlineFormModule,\n SkyInputBoxModule,\n SkyRepeaterModule,\n ],\n exports: [InlineFormDemoComponent],\n declarations: [InlineFormDemoComponent],\n})\nexport class InlineFormDemoModule {}\n"
|
|
1087
1118
|
}
|
|
1088
1119
|
]
|
|
1089
|
-
}
|
|
1120
|
+
}
|
package/esm2015/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './lib/modules/inline-form/inline-form.module';
|
|
2
|
+
export * from './lib/modules/inline-form/types/inline-form-button-action';
|
|
3
|
+
export * from './lib/modules/inline-form/types/inline-form-button-config';
|
|
4
|
+
export * from './lib/modules/inline-form/types/inline-form-close-args';
|
|
5
|
+
export * from './lib/modules/inline-form/types/inline-form-config';
|
|
6
|
+
export * from './lib/modules/inline-form/types/inline-form-button-layout';
|
|
7
|
+
// Components and directives must be exported to support Angular’s “partial” Ivy compiler.
|
|
8
|
+
// Obscure names are used to indicate types are not part of the public API.
|
|
9
|
+
export { SkyInlineFormComponent as λ1 } from './lib/modules/inline-form/inline-form.component';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/components/inline-form/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,8CAA8C,CAAC;AAC7D,cAAc,2DAA2D,CAAC;AAC1E,cAAc,2DAA2D,CAAC;AAC1E,cAAc,wDAAwD,CAAC;AACvE,cAAc,oDAAoD,CAAC;AACnE,cAAc,2DAA2D,CAAC;AAE1E,0FAA0F;AAC1F,2EAA2E;AAC3E,OAAO,EAAE,sBAAsB,IAAI,EAAE,EAAE,MAAM,iDAAiD,CAAC","sourcesContent":["export * from './lib/modules/inline-form/inline-form.module';\nexport * from './lib/modules/inline-form/types/inline-form-button-action';\nexport * from './lib/modules/inline-form/types/inline-form-button-config';\nexport * from './lib/modules/inline-form/types/inline-form-close-args';\nexport * from './lib/modules/inline-form/types/inline-form-config';\nexport * from './lib/modules/inline-form/types/inline-form-button-layout';\n\n// Components and directives must be exported to support Angular’s “partial” Ivy compiler.\n// Obscure names are used to indicate types are not part of the public API.\nexport { SkyInlineFormComponent as λ1 } from './lib/modules/inline-form/inline-form.component';\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { animate, group, query, style, transition, trigger, } from '@angular/animations';
|
|
2
|
+
export const skySlideDissolve = trigger('skySlideDissolve', [
|
|
3
|
+
transition('* <=> *', [
|
|
4
|
+
// Expand animations
|
|
5
|
+
query('.sky-slide-dissolve-last:enter', [
|
|
6
|
+
style({ height: 0, opacity: 0 }),
|
|
7
|
+
animate('200ms ease-in', style({ height: '*', opacity: 0 })),
|
|
8
|
+
], { optional: true }),
|
|
9
|
+
query('.sky-slide-dissolve-last:enter', [
|
|
10
|
+
style({ opacity: 0 }),
|
|
11
|
+
animate('200ms ease-in', style({ opacity: 1 })),
|
|
12
|
+
], { optional: true }),
|
|
13
|
+
// Collapse animations
|
|
14
|
+
// The expanded content should fade out immediately to prevent
|
|
15
|
+
// any overlap with the read-only content that's returning to the screen.
|
|
16
|
+
query('.sky-slide-dissolve-last:leave', [animate('0ms', style({ opacity: 0 }))], { optional: true }),
|
|
17
|
+
group([
|
|
18
|
+
query('.sky-slide-dissolve-first:enter', [
|
|
19
|
+
style({ opacity: 0, height: 0 }),
|
|
20
|
+
animate('100ms ease-in', style({ opacity: 1, height: '*' })),
|
|
21
|
+
], { optional: true }),
|
|
22
|
+
query('.sky-slide-dissolve-last:leave', [animate('200ms ease-in', style({ height: 0 }))], { optional: true }),
|
|
23
|
+
]),
|
|
24
|
+
]),
|
|
25
|
+
]);
|
|
26
|
+
//# sourceMappingURL=slide-dissolve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slide-dissolve.js","sourceRoot":"","sources":["../../../../../../../../../libs/components/inline-form/src/lib/modules/inline-form/animations/slide-dissolve.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAEP,KAAK,EACL,KAAK,EACL,KAAK,EACL,UAAU,EACV,OAAO,GACR,MAAM,qBAAqB,CAAC;AAE7B,MAAM,CAAC,MAAM,gBAAgB,GAA6B,OAAO,CAC/D,kBAAkB,EAClB;IACE,UAAU,CAAC,SAAS,EAAE;QACpB,oBAAoB;QACpB,KAAK,CACH,gCAAgC,EAChC;YACE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;YAChC,OAAO,CAAC,eAAe,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;SAC7D,EACD,EAAE,QAAQ,EAAE,IAAI,EAAE,CACnB;QACD,KAAK,CACH,gCAAgC,EAChC;YACE,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;YACrB,OAAO,CAAC,eAAe,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;SAChD,EACD,EAAE,QAAQ,EAAE,IAAI,EAAE,CACnB;QAED,sBAAsB;QACtB,8DAA8D;QAC9D,yEAAyE;QACzE,KAAK,CACH,gCAAgC,EAChC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EACvC,EAAE,QAAQ,EAAE,IAAI,EAAE,CACnB;QAED,KAAK,CAAC;YACJ,KAAK,CACH,iCAAiC,EACjC;gBACE,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;gBAChC,OAAO,CAAC,eAAe,EAAE,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;aAC7D,EACD,EAAE,QAAQ,EAAE,IAAI,EAAE,CACnB;YACD,KAAK,CACH,gCAAgC,EAChC,CAAC,OAAO,CAAC,eAAe,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAChD,EAAE,QAAQ,EAAE,IAAI,EAAE,CACnB;SACF,CAAC;KACH,CAAC;CACH,CACF,CAAC","sourcesContent":["import {\n animate,\n AnimationTriggerMetadata,\n group,\n query,\n style,\n transition,\n trigger,\n} from '@angular/animations';\n\nexport const skySlideDissolve: AnimationTriggerMetadata = trigger(\n 'skySlideDissolve',\n [\n transition('* <=> *', [\n // Expand animations\n query(\n '.sky-slide-dissolve-last:enter',\n [\n style({ height: 0, opacity: 0 }),\n animate('200ms ease-in', style({ height: '*', opacity: 0 })),\n ],\n { optional: true }\n ),\n query(\n '.sky-slide-dissolve-last:enter',\n [\n style({ opacity: 0 }),\n animate('200ms ease-in', style({ opacity: 1 })),\n ],\n { optional: true }\n ),\n\n // Collapse animations\n // The expanded content should fade out immediately to prevent\n // any overlap with the read-only content that's returning to the screen.\n query(\n '.sky-slide-dissolve-last:leave',\n [animate('0ms', style({ opacity: 0 }))],\n { optional: true }\n ),\n\n group([\n query(\n '.sky-slide-dissolve-first:enter',\n [\n style({ opacity: 0, height: 0 }),\n animate('100ms ease-in', style({ opacity: 1, height: '*' })),\n ],\n { optional: true }\n ),\n query(\n '.sky-slide-dissolve-last:leave',\n [animate('200ms ease-in', style({ height: 0 }))],\n { optional: true }\n ),\n ]),\n ]),\n ]\n);\n"]}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
const SKY_TABBABLE_SELECTOR = [
|
|
5
|
+
'a[href]',
|
|
6
|
+
'area[href]',
|
|
7
|
+
"input:not([disabled]):not([tabindex='-1'])",
|
|
8
|
+
"button:not([disabled]):not([tabindex='-1'])",
|
|
9
|
+
"select:not([disabled]):not([tabindex='-1'])",
|
|
10
|
+
"textarea:not([disabled]):not([tabindex='-1'])",
|
|
11
|
+
'iframe',
|
|
12
|
+
'object',
|
|
13
|
+
'embed',
|
|
14
|
+
"*[tabindex]:not([tabindex='-1'])",
|
|
15
|
+
'*[contenteditable=true]',
|
|
16
|
+
].join(', ');
|
|
17
|
+
/* tslint:enable */
|
|
18
|
+
/**
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export class SkyInlineFormAdapterService {
|
|
22
|
+
applyAutofocus(inlineFormElementRef) {
|
|
23
|
+
const inputWithAutofocus = inlineFormElementRef.nativeElement.querySelector('[autofocus]');
|
|
24
|
+
if (inputWithAutofocus) {
|
|
25
|
+
inputWithAutofocus.focus();
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
let focusEl = inlineFormElementRef.nativeElement.querySelector('.sky-inline-form-content');
|
|
29
|
+
let focusableChildren = this.loadFocusableChildren(focusEl);
|
|
30
|
+
this.focusFirstElement(focusableChildren);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
loadFocusableChildren(elem) {
|
|
34
|
+
const elements = Array.prototype.slice.call(elem.querySelectorAll(SKY_TABBABLE_SELECTOR));
|
|
35
|
+
return elements.filter((element) => {
|
|
36
|
+
return this.isVisible(element);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
isVisible(element) {
|
|
40
|
+
const style = window.getComputedStyle(element);
|
|
41
|
+
const isHidden = style.display === 'none' || style.visibility === 'hidden';
|
|
42
|
+
if (isHidden) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
/* istanbul ignore next */
|
|
46
|
+
const hasBounds = !!(element.offsetWidth ||
|
|
47
|
+
element.offsetHeight ||
|
|
48
|
+
element.getClientRects().length);
|
|
49
|
+
return hasBounds;
|
|
50
|
+
}
|
|
51
|
+
focusFirstElement(list) {
|
|
52
|
+
if (list.length > 0) {
|
|
53
|
+
list[0].focus();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
SkyInlineFormAdapterService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyInlineFormAdapterService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
58
|
+
SkyInlineFormAdapterService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyInlineFormAdapterService });
|
|
59
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyInlineFormAdapterService, decorators: [{
|
|
60
|
+
type: Injectable
|
|
61
|
+
}] });
|
|
62
|
+
//# sourceMappingURL=inline-form-adapter.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inline-form-adapter.service.js","sourceRoot":"","sources":["../../../../../../../../libs/components/inline-form/src/lib/modules/inline-form/inline-form-adapter.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,UAAU,EAAE,MAAM,eAAe,CAAC;;AAEvD,oBAAoB;AACpB,MAAM,qBAAqB,GAAG;IAC5B,SAAS;IACT,YAAY;IACZ,4CAA4C;IAC5C,6CAA6C;IAC7C,6CAA6C;IAC7C,+CAA+C;IAC/C,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,kCAAkC;IAClC,yBAAyB;CAC1B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACb,mBAAmB;AAEnB;;GAEG;AAEH,MAAM,OAAO,2BAA2B;IAC/B,cAAc,CAAC,oBAAgC;QACpD,MAAM,kBAAkB,GACtB,oBAAoB,CAAC,aAAa,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;QAElE,IAAI,kBAAkB,EAAE;YACtB,kBAAkB,CAAC,KAAK,EAAE,CAAC;SAC5B;aAAM;YACL,IAAI,OAAO,GACT,oBAAoB,CAAC,aAAa,CAAC,aAAa,CAC9C,0BAA0B,CAC3B,CAAC;YACJ,IAAI,iBAAiB,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC;YAE5D,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;SAC3C;IACH,CAAC;IAEO,qBAAqB,CAAC,IAAiB;QAC7C,MAAM,QAAQ,GAAuB,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAC7D,IAAI,CAAC,gBAAgB,CAAC,qBAAqB,CAAC,CAC7C,CAAC;QAEF,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE;YACjC,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,SAAS,CAAC,OAAoB;QACpC,MAAM,KAAK,GAAG,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAC/C,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,KAAK,MAAM,IAAI,KAAK,CAAC,UAAU,KAAK,QAAQ,CAAC;QAC3E,IAAI,QAAQ,EAAE;YACZ,OAAO,KAAK,CAAC;SACd;QAED,0BAA0B;QAC1B,MAAM,SAAS,GAAG,CAAC,CAAC,CAClB,OAAO,CAAC,WAAW;YACnB,OAAO,CAAC,YAAY;YACpB,OAAO,CAAC,cAAc,EAAE,CAAC,MAAM,CAChC,CAAC;QACF,OAAO,SAAS,CAAC;IACnB,CAAC;IAEO,iBAAiB,CAAC,IAAwB;QAChD,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE;YACnB,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC;SACjB;IACH,CAAC;;yHAhDU,2BAA2B;6HAA3B,2BAA2B;4FAA3B,2BAA2B;kBADvC,UAAU","sourcesContent":["import { ElementRef, Injectable } from '@angular/core';\n\n/* tslint:disable */\nconst SKY_TABBABLE_SELECTOR = [\n 'a[href]',\n 'area[href]',\n \"input:not([disabled]):not([tabindex='-1'])\",\n \"button:not([disabled]):not([tabindex='-1'])\",\n \"select:not([disabled]):not([tabindex='-1'])\",\n \"textarea:not([disabled]):not([tabindex='-1'])\",\n 'iframe',\n 'object',\n 'embed',\n \"*[tabindex]:not([tabindex='-1'])\",\n '*[contenteditable=true]',\n].join(', ');\n/* tslint:enable */\n\n/**\n * @internal\n */\n@Injectable()\nexport class SkyInlineFormAdapterService {\n public applyAutofocus(inlineFormElementRef: ElementRef): void {\n const inputWithAutofocus =\n inlineFormElementRef.nativeElement.querySelector('[autofocus]');\n\n if (inputWithAutofocus) {\n inputWithAutofocus.focus();\n } else {\n let focusEl: HTMLElement =\n inlineFormElementRef.nativeElement.querySelector(\n '.sky-inline-form-content'\n );\n let focusableChildren = this.loadFocusableChildren(focusEl);\n\n this.focusFirstElement(focusableChildren);\n }\n }\n\n private loadFocusableChildren(elem: HTMLElement): HTMLElement[] {\n const elements: Array<HTMLElement> = Array.prototype.slice.call(\n elem.querySelectorAll(SKY_TABBABLE_SELECTOR)\n );\n\n return elements.filter((element) => {\n return this.isVisible(element);\n });\n }\n\n private isVisible(element: HTMLElement): boolean {\n const style = window.getComputedStyle(element);\n const isHidden = style.display === 'none' || style.visibility === 'hidden';\n if (isHidden) {\n return false;\n }\n\n /* istanbul ignore next */\n const hasBounds = !!(\n element.offsetWidth ||\n element.offsetHeight ||\n element.getClientRects().length\n );\n return hasBounds;\n }\n\n private focusFirstElement(list: Array<HTMLElement>): void {\n if (list.length > 0) {\n list[0].focus();\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { ChangeDetectorRef, ChangeDetectionStrategy, Component, ElementRef, EventEmitter, Input, Output, TemplateRef, } from '@angular/core';
|
|
2
|
+
import { SkyAppWindowRef } from '@skyux/core';
|
|
3
|
+
import { SkyLibResourcesService } from '@skyux/i18n';
|
|
4
|
+
import { zip as observableZip } from 'rxjs';
|
|
5
|
+
import { take } from 'rxjs/operators';
|
|
6
|
+
import { skySlideDissolve } from './animations/slide-dissolve';
|
|
7
|
+
import { SkyInlineFormButtonLayout } from './types/inline-form-button-layout';
|
|
8
|
+
import { SkyInlineFormAdapterService } from './inline-form-adapter.service';
|
|
9
|
+
import * as i0 from "@angular/core";
|
|
10
|
+
import * as i1 from "./inline-form-adapter.service";
|
|
11
|
+
import * as i2 from "@skyux/i18n";
|
|
12
|
+
import * as i3 from "@skyux/core";
|
|
13
|
+
import * as i4 from "@angular/common";
|
|
14
|
+
/**
|
|
15
|
+
* Renders form content in the current view instead of a separate modal.
|
|
16
|
+
*/
|
|
17
|
+
export class SkyInlineFormComponent {
|
|
18
|
+
constructor(adapter, elementRef, resourcesService, skyAppWindowRef, changeDetectorRef) {
|
|
19
|
+
this.adapter = adapter;
|
|
20
|
+
this.elementRef = elementRef;
|
|
21
|
+
this.resourcesService = resourcesService;
|
|
22
|
+
this.skyAppWindowRef = skyAppWindowRef;
|
|
23
|
+
this.changeDetectorRef = changeDetectorRef;
|
|
24
|
+
/**
|
|
25
|
+
* Fires when users close the inline form.
|
|
26
|
+
*/
|
|
27
|
+
this.close = new EventEmitter();
|
|
28
|
+
this._showForm = false;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Specifies configuration options for the buttons to display with the inline form.
|
|
32
|
+
* @required
|
|
33
|
+
*/
|
|
34
|
+
set config(value) {
|
|
35
|
+
if (value !== this._config) {
|
|
36
|
+
this._config = value;
|
|
37
|
+
this.setupButtons();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
get config() {
|
|
41
|
+
return this._config;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Indicates whether to display the inline form. Users can toggle between displaying
|
|
45
|
+
* and hiding the inline form.
|
|
46
|
+
* @default false
|
|
47
|
+
*/
|
|
48
|
+
set showForm(value) {
|
|
49
|
+
this._showForm = value;
|
|
50
|
+
/* istanbul ignore else */
|
|
51
|
+
if (value) {
|
|
52
|
+
// setTimeout() prevents applyAutofocus() from firing
|
|
53
|
+
// until after *ngIf has added the form element to the DOM.
|
|
54
|
+
this.skyAppWindowRef.nativeWindow.setTimeout(() => {
|
|
55
|
+
this.adapter.applyAutofocus(this.elementRef);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
get showForm() {
|
|
60
|
+
return this._showForm;
|
|
61
|
+
}
|
|
62
|
+
ngOnInit() {
|
|
63
|
+
this.setupButtons();
|
|
64
|
+
}
|
|
65
|
+
ngOnDestroy() {
|
|
66
|
+
this.close.complete();
|
|
67
|
+
}
|
|
68
|
+
closeInlineForm(event) {
|
|
69
|
+
const args = {
|
|
70
|
+
reason: event.action,
|
|
71
|
+
};
|
|
72
|
+
this.close.emit(args);
|
|
73
|
+
}
|
|
74
|
+
setupButtons() {
|
|
75
|
+
if (this.isValidCustomConfig(this.config)) {
|
|
76
|
+
this.buttons = this.getCustomButtons(this.config.buttons);
|
|
77
|
+
this.changeDetectorRef.markForCheck();
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
this.getPresetButtons().then((buttons) => {
|
|
81
|
+
this.buttons = buttons;
|
|
82
|
+
this.changeDetectorRef.markForCheck();
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
getPresetButtons() {
|
|
86
|
+
let buttonType = this.config
|
|
87
|
+
? this.config.buttonLayout
|
|
88
|
+
: SkyInlineFormButtonLayout.DoneCancel;
|
|
89
|
+
let promise;
|
|
90
|
+
switch (buttonType) {
|
|
91
|
+
/* istanbul ignore next */
|
|
92
|
+
default:
|
|
93
|
+
case SkyInlineFormButtonLayout.DoneCancel:
|
|
94
|
+
observableZip(this.resourcesService.getString('skyux_inline_form_button_done'), this.resourcesService.getString('skyux_inline_form_button_cancel'))
|
|
95
|
+
.pipe(take(1))
|
|
96
|
+
.subscribe((values) => {
|
|
97
|
+
promise = new Promise((resolve) => {
|
|
98
|
+
resolve([
|
|
99
|
+
{
|
|
100
|
+
text: values[0],
|
|
101
|
+
styleType: 'primary',
|
|
102
|
+
action: 'done',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
text: values[1],
|
|
106
|
+
styleType: 'link',
|
|
107
|
+
action: 'cancel',
|
|
108
|
+
},
|
|
109
|
+
]);
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
break;
|
|
113
|
+
case SkyInlineFormButtonLayout.SaveCancel:
|
|
114
|
+
observableZip(this.resourcesService.getString('skyux_inline_form_button_save'), this.resourcesService.getString('skyux_inline_form_button_cancel'))
|
|
115
|
+
.pipe(take(1))
|
|
116
|
+
.subscribe((values) => {
|
|
117
|
+
promise = new Promise((resolve) => {
|
|
118
|
+
resolve([
|
|
119
|
+
{
|
|
120
|
+
text: values[0],
|
|
121
|
+
styleType: 'primary',
|
|
122
|
+
action: 'save',
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
text: values[1],
|
|
126
|
+
styleType: 'link',
|
|
127
|
+
action: 'cancel',
|
|
128
|
+
},
|
|
129
|
+
]);
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
break;
|
|
133
|
+
case SkyInlineFormButtonLayout.DoneDeleteCancel:
|
|
134
|
+
observableZip(this.resourcesService.getString('skyux_inline_form_button_done'), this.resourcesService.getString('skyux_inline_form_button_delete'), this.resourcesService.getString('skyux_inline_form_button_cancel'))
|
|
135
|
+
.pipe(take(1))
|
|
136
|
+
.subscribe((values) => {
|
|
137
|
+
promise = new Promise((resolve) => {
|
|
138
|
+
resolve([
|
|
139
|
+
{
|
|
140
|
+
text: values[0],
|
|
141
|
+
styleType: 'primary',
|
|
142
|
+
action: 'done',
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
text: values[1],
|
|
146
|
+
styleType: 'default',
|
|
147
|
+
action: 'delete',
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
text: values[2],
|
|
151
|
+
styleType: 'link',
|
|
152
|
+
action: 'cancel',
|
|
153
|
+
},
|
|
154
|
+
]);
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
break;
|
|
158
|
+
case SkyInlineFormButtonLayout.SaveDeleteCancel:
|
|
159
|
+
observableZip(this.resourcesService.getString('skyux_inline_form_button_save'), this.resourcesService.getString('skyux_inline_form_button_delete'), this.resourcesService.getString('skyux_inline_form_button_cancel'))
|
|
160
|
+
.pipe(take(1))
|
|
161
|
+
.subscribe((values) => {
|
|
162
|
+
promise = new Promise((resolve) => {
|
|
163
|
+
resolve([
|
|
164
|
+
{
|
|
165
|
+
text: values[0],
|
|
166
|
+
styleType: 'primary',
|
|
167
|
+
action: 'save',
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
text: values[1],
|
|
171
|
+
styleType: 'default',
|
|
172
|
+
action: 'delete',
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
text: values[2],
|
|
176
|
+
styleType: 'link',
|
|
177
|
+
action: 'cancel',
|
|
178
|
+
},
|
|
179
|
+
]);
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
184
|
+
return promise;
|
|
185
|
+
}
|
|
186
|
+
getCustomButtons(buttonConfigs) {
|
|
187
|
+
const buttons = [];
|
|
188
|
+
buttonConfigs.forEach((config) => {
|
|
189
|
+
/* istanbul ignore next */
|
|
190
|
+
const styleType = config.styleType || 'default';
|
|
191
|
+
buttons.push({
|
|
192
|
+
action: config.action,
|
|
193
|
+
disabled: config.disabled,
|
|
194
|
+
styleType: styleType,
|
|
195
|
+
text: config.text,
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
return buttons;
|
|
199
|
+
}
|
|
200
|
+
isValidCustomConfig(config) {
|
|
201
|
+
return (config &&
|
|
202
|
+
config.buttonLayout === SkyInlineFormButtonLayout.Custom &&
|
|
203
|
+
config.buttons.length > 0);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
SkyInlineFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyInlineFormComponent, deps: [{ token: i1.SkyInlineFormAdapterService }, { token: i0.ElementRef }, { token: i2.SkyLibResourcesService }, { token: i3.SkyAppWindowRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
207
|
+
SkyInlineFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.16", type: SkyInlineFormComponent, selector: "sky-inline-form", inputs: { config: "config", template: "template", showForm: "showForm" }, outputs: { close: "close" }, providers: [SkyInlineFormAdapterService], ngImport: i0, template: "<div [@skySlideDissolve]=\"showForm\">\n <div *ngIf=\"!showForm\" class=\"sky-slide-dissolve-first\">\n <ng-content></ng-content>\n </div>\n\n <div *ngIf=\"template && showForm\" class=\"sky-slide-dissolve-last\">\n <div class=\"sky-inline-form sky-shadow sky-box sky-elevation-3\">\n <div class=\"sky-inline-form-content\">\n <ng-container [ngTemplateOutlet]=\"template\"> </ng-container>\n </div>\n <div class=\"sky-inline-form-footer\">\n <button\n *ngFor=\"let button of buttons\"\n class=\"sky-btn {{ 'sky-btn-' + button.styleType }}\"\n type=\"button\"\n [disabled]=\"button.disabled ? true : null\"\n [ngClass]=\"{ 'sky-btn-disabled': button.disabled }\"\n (click)=\"closeInlineForm(button)\"\n >\n {{ button.text }}\n </button>\n </div>\n </div>\n </div>\n</div>\n", styles: [".sky-inline-form{background:#eeeeef;border:1px solid #cdcfd2;padding:10px;width:100%}.sky-inline-form .sky-inline-form-footer{margin-top:20px}.sky-inline-form .sky-inline-form-footer button{margin:0 5px 0 0}:host-context(.sky-theme-modern) .sky-inline-form{background-color:#fff;border:none;padding:15px}:host-context(.sky-theme-modern) .sky-inline-form .sky-inline-form-footer{margin-top:30px}:host-context(.sky-theme-modern) .sky-inline-form .sky-inline-form-footer button{margin-right:10px}.sky-theme-modern .sky-inline-form{background-color:#fff;border:none;padding:15px}.sky-theme-modern .sky-inline-form .sky-inline-form-footer{margin-top:30px}.sky-theme-modern .sky-inline-form .sky-inline-form-footer button{margin-right:10px}:host-context(.sky-theme-modern.sky-theme-mode-dark) .sky-inline-form{background-color:#232427}.sky-theme-modern.sky-theme-mode-dark .sky-inline-form{background-color:#232427}\n"], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet"] }, { type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], animations: [skySlideDissolve], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
208
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.16", ngImport: i0, type: SkyInlineFormComponent, decorators: [{
|
|
209
|
+
type: Component,
|
|
210
|
+
args: [{
|
|
211
|
+
selector: 'sky-inline-form',
|
|
212
|
+
templateUrl: './inline-form.component.html',
|
|
213
|
+
styleUrls: ['./inline-form.component.scss'],
|
|
214
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
215
|
+
providers: [SkyInlineFormAdapterService],
|
|
216
|
+
animations: [skySlideDissolve],
|
|
217
|
+
}]
|
|
218
|
+
}], ctorParameters: function () { return [{ type: i1.SkyInlineFormAdapterService }, { type: i0.ElementRef }, { type: i2.SkyLibResourcesService }, { type: i3.SkyAppWindowRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { config: [{
|
|
219
|
+
type: Input
|
|
220
|
+
}], template: [{
|
|
221
|
+
type: Input
|
|
222
|
+
}], showForm: [{
|
|
223
|
+
type: Input
|
|
224
|
+
}], close: [{
|
|
225
|
+
type: Output
|
|
226
|
+
}] } });
|
|
227
|
+
//# sourceMappingURL=inline-form.component.js.map
|