@jsonforms/angular-material 3.2.0-beta.0 → 3.2.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/lib/LICENSE +22 -0
- package/lib/README.md +137 -0
- package/lib/esm2022/jsonforms-angular-material.mjs +5 -0
- package/lib/esm2022/library/controls/autocomplete.renderer.mjs +171 -0
- package/lib/esm2022/library/controls/boolean.renderer.mjs +84 -0
- package/lib/esm2022/library/controls/date.renderer.mjs +93 -0
- package/lib/esm2022/library/controls/index.mjs +33 -0
- package/lib/esm2022/library/controls/number.renderer.mjs +173 -0
- package/lib/esm2022/library/controls/range.renderer.mjs +104 -0
- package/lib/esm2022/library/controls/text.renderer.mjs +98 -0
- package/lib/esm2022/library/controls/textarea.renderer.mjs +80 -0
- package/lib/esm2022/library/controls/toggle.renderer.mjs +86 -0
- package/lib/esm2022/library/index.mjs +69 -0
- package/lib/esm2022/library/layouts/array-layout.renderer.mjs +259 -0
- package/lib/esm2022/library/layouts/categorization-layout.renderer.mjs +105 -0
- package/lib/esm2022/library/layouts/group-layout.renderer.mjs +78 -0
- package/lib/esm2022/library/layouts/horizontal-layout.renderer.mjs +73 -0
- package/lib/esm2022/library/layouts/index.mjs +30 -0
- package/lib/esm2022/library/layouts/layout.renderer.mjs +86 -0
- package/lib/esm2022/library/layouts/vertical-layout.renderer.mjs +67 -0
- package/lib/esm2022/library/module.mjs +239 -0
- package/lib/esm2022/library/other/index.mjs +29 -0
- package/lib/esm2022/library/other/label.renderer.mjs +61 -0
- package/lib/esm2022/library/other/master-detail/detail.mjs +59 -0
- package/lib/esm2022/library/other/master-detail/index.mjs +27 -0
- package/lib/esm2022/library/other/master-detail/master.mjs +250 -0
- package/lib/esm2022/library/other/object.renderer.mjs +84 -0
- package/lib/esm2022/library/other/table.renderer.mjs +314 -0
- package/lib/esm2022/public_api.mjs +2 -0
- package/lib/fesm2022/jsonforms-angular-material.mjs +2564 -0
- package/lib/fesm2022/jsonforms-angular-material.mjs.map +1 -0
- package/lib/index.d.ts +6 -0
- package/lib/jsonforms-angular-material.d.ts.map +1 -0
- package/lib/{cjs → library}/controls/autocomplete.renderer.d.ts +1 -0
- package/lib/library/controls/autocomplete.renderer.d.ts.map +1 -0
- package/lib/{esm → library}/controls/boolean.renderer.d.ts +1 -0
- package/lib/library/controls/boolean.renderer.d.ts.map +1 -0
- package/lib/{cjs → library}/controls/date.renderer.d.ts +1 -0
- package/lib/library/controls/date.renderer.d.ts.map +1 -0
- package/lib/{cjs → library}/controls/index.d.ts +1 -0
- package/lib/library/controls/index.d.ts.map +1 -0
- package/lib/{esm → library}/controls/number.renderer.d.ts +1 -0
- package/lib/library/controls/number.renderer.d.ts.map +1 -0
- package/lib/{esm → library}/controls/range.renderer.d.ts +1 -0
- package/lib/library/controls/range.renderer.d.ts.map +1 -0
- package/lib/{esm → library}/controls/text.renderer.d.ts +1 -0
- package/lib/library/controls/text.renderer.d.ts.map +1 -0
- package/lib/{esm → library}/controls/textarea.renderer.d.ts +1 -0
- package/lib/library/controls/textarea.renderer.d.ts.map +1 -0
- package/lib/{cjs → library}/controls/toggle.renderer.d.ts +1 -0
- package/lib/library/controls/toggle.renderer.d.ts.map +1 -0
- package/lib/{cjs → library}/index.d.ts +1 -0
- package/lib/library/index.d.ts.map +1 -0
- package/lib/{cjs → library}/layouts/array-layout.renderer.d.ts +1 -0
- package/lib/library/layouts/array-layout.renderer.d.ts.map +1 -0
- package/lib/{esm → library}/layouts/categorization-layout.renderer.d.ts +1 -0
- package/lib/library/layouts/categorization-layout.renderer.d.ts.map +1 -0
- package/lib/{cjs → library}/layouts/group-layout.renderer.d.ts +1 -0
- package/lib/library/layouts/group-layout.renderer.d.ts.map +1 -0
- package/lib/{esm → library}/layouts/horizontal-layout.renderer.d.ts +1 -0
- package/lib/library/layouts/horizontal-layout.renderer.d.ts.map +1 -0
- package/lib/{esm → library}/layouts/index.d.ts +1 -0
- package/lib/library/layouts/index.d.ts.map +1 -0
- package/lib/{esm → library}/layouts/layout.renderer.d.ts +1 -0
- package/lib/library/layouts/layout.renderer.d.ts.map +1 -0
- package/lib/{cjs → library}/layouts/vertical-layout.renderer.d.ts +1 -0
- package/lib/library/layouts/vertical-layout.renderer.d.ts.map +1 -0
- package/lib/{esm → library}/module.d.ts +1 -0
- package/lib/library/module.d.ts.map +1 -0
- package/lib/{esm → library}/other/index.d.ts +1 -0
- package/lib/library/other/index.d.ts.map +1 -0
- package/lib/{esm → library}/other/label.renderer.d.ts +1 -0
- package/lib/library/other/label.renderer.d.ts.map +1 -0
- package/lib/{esm → library}/other/master-detail/detail.d.ts +1 -0
- package/lib/library/other/master-detail/detail.d.ts.map +1 -0
- package/lib/{cjs → library}/other/master-detail/index.d.ts +1 -0
- package/lib/library/other/master-detail/index.d.ts.map +1 -0
- package/lib/{esm → library}/other/master-detail/master.d.ts +1 -0
- package/lib/library/other/master-detail/master.d.ts.map +1 -0
- package/lib/{esm → library}/other/object.renderer.d.ts +1 -0
- package/lib/library/other/object.renderer.d.ts.map +1 -0
- package/lib/{cjs → library}/other/table.renderer.d.ts +1 -0
- package/lib/library/other/table.renderer.d.ts.map +1 -0
- package/lib/package.json +75 -0
- package/lib/public_api.d.ts +2 -0
- package/lib/public_api.d.ts.map +1 -0
- package/package.json +12 -20
- package/src/index.ts +1 -121
- package/src/library/index.ts +121 -0
- package/src/public_api.ts +1 -0
- package/lib/cjs/controls/autocomplete.renderer.js +0 -115
- package/lib/cjs/controls/autocomplete.renderer.js.map +0 -1
- package/lib/cjs/controls/boolean.renderer.d.ts +0 -14
- package/lib/cjs/controls/boolean.renderer.js +0 -61
- package/lib/cjs/controls/boolean.renderer.js.map +0 -1
- package/lib/cjs/controls/date.renderer.js +0 -57
- package/lib/cjs/controls/date.renderer.js.map +0 -1
- package/lib/cjs/controls/index.js +0 -36
- package/lib/cjs/controls/index.js.map +0 -1
- package/lib/cjs/controls/number.renderer.d.ts +0 -23
- package/lib/cjs/controls/number.renderer.js +0 -134
- package/lib/cjs/controls/number.renderer.js.map +0 -1
- package/lib/cjs/controls/range.renderer.d.ts +0 -17
- package/lib/cjs/controls/range.renderer.js +0 -64
- package/lib/cjs/controls/range.renderer.js.map +0 -1
- package/lib/cjs/controls/text.renderer.d.ts +0 -12
- package/lib/cjs/controls/text.renderer.js +0 -72
- package/lib/cjs/controls/text.renderer.js.map +0 -1
- package/lib/cjs/controls/textarea.renderer.d.ts +0 -11
- package/lib/cjs/controls/textarea.renderer.js +0 -56
- package/lib/cjs/controls/textarea.renderer.js.map +0 -1
- package/lib/cjs/controls/toggle.renderer.js +0 -63
- package/lib/cjs/controls/toggle.renderer.js.map +0 -1
- package/lib/cjs/index.js +0 -73
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/layouts/array-layout.renderer.js +0 -101
- package/lib/cjs/layouts/array-layout.renderer.js.map +0 -1
- package/lib/cjs/layouts/categorization-layout.renderer.d.ts +0 -17
- package/lib/cjs/layouts/categorization-layout.renderer.js +0 -77
- package/lib/cjs/layouts/categorization-layout.renderer.js.map +0 -1
- package/lib/cjs/layouts/group-layout.renderer.js +0 -53
- package/lib/cjs/layouts/group-layout.renderer.js.map +0 -1
- package/lib/cjs/layouts/horizontal-layout.renderer.d.ts +0 -11
- package/lib/cjs/layouts/horizontal-layout.renderer.js +0 -52
- package/lib/cjs/layouts/horizontal-layout.renderer.js.map +0 -1
- package/lib/cjs/layouts/index.d.ts +0 -5
- package/lib/cjs/layouts/index.js +0 -33
- package/lib/cjs/layouts/index.js.map +0 -1
- package/lib/cjs/layouts/layout.renderer.d.ts +0 -22
- package/lib/cjs/layouts/layout.renderer.js +0 -94
- package/lib/cjs/layouts/layout.renderer.js.map +0 -1
- package/lib/cjs/layouts/vertical-layout.renderer.js +0 -52
- package/lib/cjs/layouts/vertical-layout.renderer.js.map +0 -1
- package/lib/cjs/module.d.ts +0 -47
- package/lib/cjs/module.js +0 -247
- package/lib/cjs/module.js.map +0 -1
- package/lib/cjs/other/index.d.ts +0 -4
- package/lib/cjs/other/index.js +0 -32
- package/lib/cjs/other/index.js.map +0 -1
- package/lib/cjs/other/label.renderer.d.ts +0 -16
- package/lib/cjs/other/label.renderer.js +0 -66
- package/lib/cjs/other/label.renderer.js.map +0 -1
- package/lib/cjs/other/master-detail/detail.d.ts +0 -9
- package/lib/cjs/other/master-detail/detail.js +0 -61
- package/lib/cjs/other/master-detail/detail.js.map +0 -1
- package/lib/cjs/other/master-detail/index.js +0 -30
- package/lib/cjs/other/master-detail/index.js.map +0 -1
- package/lib/cjs/other/master-detail/master.d.ts +0 -27
- package/lib/cjs/other/master-detail/master.js +0 -152
- package/lib/cjs/other/master-detail/master.js.map +0 -1
- package/lib/cjs/other/object.renderer.d.ts +0 -11
- package/lib/cjs/other/object.renderer.js +0 -73
- package/lib/cjs/other/object.renderer.js.map +0 -1
- package/lib/cjs/other/table.renderer.js +0 -147
- package/lib/cjs/other/table.renderer.js.map +0 -1
- package/lib/esm/controls/autocomplete.renderer.d.ts +0 -48
- package/lib/esm/controls/autocomplete.renderer.js +0 -112
- package/lib/esm/controls/autocomplete.renderer.js.map +0 -1
- package/lib/esm/controls/boolean.renderer.js +0 -58
- package/lib/esm/controls/boolean.renderer.js.map +0 -1
- package/lib/esm/controls/date.renderer.d.ts +0 -11
- package/lib/esm/controls/date.renderer.js +0 -54
- package/lib/esm/controls/date.renderer.js.map +0 -1
- package/lib/esm/controls/index.d.ts +0 -8
- package/lib/esm/controls/index.js +0 -33
- package/lib/esm/controls/index.js.map +0 -1
- package/lib/esm/controls/number.renderer.js +0 -131
- package/lib/esm/controls/number.renderer.js.map +0 -1
- package/lib/esm/controls/range.renderer.js +0 -61
- package/lib/esm/controls/range.renderer.js.map +0 -1
- package/lib/esm/controls/text.renderer.js +0 -69
- package/lib/esm/controls/text.renderer.js.map +0 -1
- package/lib/esm/controls/textarea.renderer.js +0 -53
- package/lib/esm/controls/textarea.renderer.js.map +0 -1
- package/lib/esm/controls/toggle.renderer.d.ts +0 -14
- package/lib/esm/controls/toggle.renderer.js +0 -60
- package/lib/esm/controls/toggle.renderer.js.map +0 -1
- package/lib/esm/index.d.ts +0 -10
- package/lib/esm/index.js +0 -69
- package/lib/esm/index.js.map +0 -1
- package/lib/esm/layouts/array-layout.renderer.d.ts +0 -29
- package/lib/esm/layouts/array-layout.renderer.js +0 -98
- package/lib/esm/layouts/array-layout.renderer.js.map +0 -1
- package/lib/esm/layouts/categorization-layout.renderer.js +0 -74
- package/lib/esm/layouts/categorization-layout.renderer.js.map +0 -1
- package/lib/esm/layouts/group-layout.renderer.d.ts +0 -11
- package/lib/esm/layouts/group-layout.renderer.js +0 -50
- package/lib/esm/layouts/group-layout.renderer.js.map +0 -1
- package/lib/esm/layouts/horizontal-layout.renderer.js +0 -49
- package/lib/esm/layouts/horizontal-layout.renderer.js.map +0 -1
- package/lib/esm/layouts/index.js +0 -30
- package/lib/esm/layouts/index.js.map +0 -1
- package/lib/esm/layouts/layout.renderer.js +0 -91
- package/lib/esm/layouts/layout.renderer.js.map +0 -1
- package/lib/esm/layouts/vertical-layout.renderer.d.ts +0 -11
- package/lib/esm/layouts/vertical-layout.renderer.js +0 -49
- package/lib/esm/layouts/vertical-layout.renderer.js.map +0 -1
- package/lib/esm/module.js +0 -243
- package/lib/esm/module.js.map +0 -1
- package/lib/esm/other/index.js +0 -29
- package/lib/esm/other/index.js.map +0 -1
- package/lib/esm/other/label.renderer.js +0 -63
- package/lib/esm/other/label.renderer.js.map +0 -1
- package/lib/esm/other/master-detail/detail.js +0 -57
- package/lib/esm/other/master-detail/detail.js.map +0 -1
- package/lib/esm/other/master-detail/index.d.ts +0 -2
- package/lib/esm/other/master-detail/index.js +0 -27
- package/lib/esm/other/master-detail/index.js.map +0 -1
- package/lib/esm/other/master-detail/master.js +0 -148
- package/lib/esm/other/master-detail/master.js.map +0 -1
- package/lib/esm/other/object.renderer.js +0 -70
- package/lib/esm/other/object.renderer.js.map +0 -1
- package/lib/esm/other/table.renderer.d.ts +0 -36
- package/lib/esm/other/table.renderer.js +0 -143
- package/lib/esm/other/table.renderer.js.map +0 -1
- /package/src/{controls → library/controls}/autocomplete.renderer.ts +0 -0
- /package/src/{controls → library/controls}/boolean.renderer.ts +0 -0
- /package/src/{controls → library/controls}/date.renderer.ts +0 -0
- /package/src/{controls → library/controls}/index.ts +0 -0
- /package/src/{controls → library/controls}/number.renderer.ts +0 -0
- /package/src/{controls → library/controls}/range.renderer.ts +0 -0
- /package/src/{controls → library/controls}/text.renderer.ts +0 -0
- /package/src/{controls → library/controls}/textarea.renderer.ts +0 -0
- /package/src/{controls → library/controls}/toggle.renderer.ts +0 -0
- /package/src/{layouts → library/layouts}/array-layout.renderer.ts +0 -0
- /package/src/{layouts → library/layouts}/categorization-layout.renderer.ts +0 -0
- /package/src/{layouts → library/layouts}/group-layout.renderer.ts +0 -0
- /package/src/{layouts → library/layouts}/horizontal-layout.renderer.ts +0 -0
- /package/src/{layouts → library/layouts}/index.ts +0 -0
- /package/src/{layouts → library/layouts}/layout.renderer.ts +0 -0
- /package/src/{layouts → library/layouts}/vertical-layout.renderer.ts +0 -0
- /package/src/{module.ts → library/module.ts} +0 -0
- /package/src/{other → library/other}/index.ts +0 -0
- /package/src/{other → library/other}/label.renderer.ts +0 -0
- /package/src/{other → library/other}/master-detail/detail.ts +0 -0
- /package/src/{other → library/other}/master-detail/index.ts +0 -0
- /package/src/{other → library/other}/master-detail/master.ts +0 -0
- /package/src/{other → library/other}/object.renderer.ts +0 -0
- /package/src/{other → library/other}/table.renderer.ts +0 -0
- /package/src/{other → library/other}/util.ts +0 -0
|
@@ -0,0 +1,2564 @@
|
|
|
1
|
+
import 'hammerjs';
|
|
2
|
+
import * as i2 from '@angular/common';
|
|
3
|
+
import { CommonModule } from '@angular/common';
|
|
4
|
+
import * as i5 from '@angular/forms';
|
|
5
|
+
import { ReactiveFormsModule } from '@angular/forms';
|
|
6
|
+
import * as i7 from '@angular/material/autocomplete';
|
|
7
|
+
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
8
|
+
import * as i5$2 from '@angular/material/button';
|
|
9
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
10
|
+
import * as i7$1 from '@angular/material/badge';
|
|
11
|
+
import { MatBadgeModule } from '@angular/material/badge';
|
|
12
|
+
import * as i3$2 from '@angular/material/card';
|
|
13
|
+
import { MatCardModule } from '@angular/material/card';
|
|
14
|
+
import * as i4$1 from '@angular/material/checkbox';
|
|
15
|
+
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
16
|
+
import * as i5$1 from '@angular/material/datepicker';
|
|
17
|
+
import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
18
|
+
import * as i3 from '@angular/material/form-field';
|
|
19
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
20
|
+
import * as i6$2 from '@angular/material/tooltip';
|
|
21
|
+
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
22
|
+
import * as i6$1 from '@angular/material/icon';
|
|
23
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
24
|
+
import * as i4 from '@angular/material/input';
|
|
25
|
+
import { MatInputModule } from '@angular/material/input';
|
|
26
|
+
import * as i4$4 from '@angular/material/list';
|
|
27
|
+
import { MatListModule } from '@angular/material/list';
|
|
28
|
+
import * as i6 from '@angular/material/core';
|
|
29
|
+
import { MatNativeDateModule } from '@angular/material/core';
|
|
30
|
+
import { MatSelectModule } from '@angular/material/select';
|
|
31
|
+
import * as i3$1 from '@angular/material/sidenav';
|
|
32
|
+
import { MatSidenavModule } from '@angular/material/sidenav';
|
|
33
|
+
import * as i4$2 from '@angular/material/slider';
|
|
34
|
+
import { MatSliderModule } from '@angular/material/slider';
|
|
35
|
+
import * as i4$3 from '@angular/material/slide-toggle';
|
|
36
|
+
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
|
37
|
+
import * as i5$3 from '@angular/material/table';
|
|
38
|
+
import { MatTableModule } from '@angular/material/table';
|
|
39
|
+
import * as i3$3 from '@angular/material/tabs';
|
|
40
|
+
import { MatTabsModule } from '@angular/material/tabs';
|
|
41
|
+
import { MatToolbarModule } from '@angular/material/toolbar';
|
|
42
|
+
import * as i0 from '@angular/core';
|
|
43
|
+
import { Component, ChangeDetectionStrategy, Input, Pipe, NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
|
44
|
+
import * as i1 from '@jsonforms/angular';
|
|
45
|
+
import { JsonFormsControl, JsonFormsBaseRenderer, JsonFormsArrayControl, JsonFormsControlWithDetail, JsonFormsAbstractControl, JsonFormsModule } from '@jsonforms/angular';
|
|
46
|
+
import { composeWithUi, Actions, rankWith, isEnumControl, isBooleanControl, isDateControl, isNumberControl, or, isIntegerControl, isRangeControl, isMultiLineControl, isStringControl, and, optionIs, mapStateToLabelProps, uiTypeIs, decode, mapDispatchToArrayControlProps, findUISchema, setReadonly, getFirstPrimitiveProp, createDefaultValue, mapStateToArrayControlProps, Generate, isObjectControl, Paths, encode, deriveTypes, isObjectArrayControl, isPrimitiveArrayControl, mapStateToLayoutProps, isVisible, getAjv, deriveLabelForUISchemaElement, defaultJsonFormsI18nState, categorizationHasCategory, mapStateToArrayLayoutProps, unsetReadonly, isObjectArrayWithNesting } from '@jsonforms/core';
|
|
47
|
+
import { startWith, map } from 'rxjs/operators';
|
|
48
|
+
import merge from 'lodash/merge';
|
|
49
|
+
import some from 'lodash/some';
|
|
50
|
+
import get from 'lodash/get';
|
|
51
|
+
import isEmpty from 'lodash/isEmpty';
|
|
52
|
+
import startCase from 'lodash/startCase';
|
|
53
|
+
import { cloneDeep } from 'lodash';
|
|
54
|
+
|
|
55
|
+
/*
|
|
56
|
+
The MIT License
|
|
57
|
+
|
|
58
|
+
Copyright (c) 2017-2019 EclipseSource Munich
|
|
59
|
+
https://github.com/eclipsesource/jsonforms
|
|
60
|
+
|
|
61
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
62
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
63
|
+
in the Software without restriction, including without limitation the rights
|
|
64
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
65
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
66
|
+
furnished to do so, subject to the following conditions:
|
|
67
|
+
|
|
68
|
+
The above copyright notice and this permission notice shall be included in
|
|
69
|
+
all copies or substantial portions of the Software.
|
|
70
|
+
|
|
71
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
72
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
73
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
74
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
75
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
76
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
77
|
+
THE SOFTWARE.
|
|
78
|
+
*/
|
|
79
|
+
/**
|
|
80
|
+
* To use this component you will need to add your own tester:
|
|
81
|
+
* <pre><code>
|
|
82
|
+
* ...
|
|
83
|
+
* export const AutocompleteControlRendererTester: RankedTester = rankWith(2, isEnumControl);
|
|
84
|
+
* ...
|
|
85
|
+
* </code></pre>
|
|
86
|
+
* Add the tester and renderer to JSONForms registry:
|
|
87
|
+
* <pre><code>
|
|
88
|
+
* ...
|
|
89
|
+
* { tester: AutocompleteControlRendererTester, renderer: AutocompleteControlRenderer },
|
|
90
|
+
* ...
|
|
91
|
+
* </code></pre>
|
|
92
|
+
* Furthermore you need to update your module.
|
|
93
|
+
* <pre><code>
|
|
94
|
+
* ...
|
|
95
|
+
* imports: [JsonFormsAngularMaterialModule, MatAutocompleteModule],
|
|
96
|
+
* declarations: [AutocompleteControlRenderer]
|
|
97
|
+
* ...
|
|
98
|
+
* </code></pre>
|
|
99
|
+
*
|
|
100
|
+
*/
|
|
101
|
+
class AutocompleteControlRenderer extends JsonFormsControl {
|
|
102
|
+
options;
|
|
103
|
+
filteredOptions;
|
|
104
|
+
shouldFilter;
|
|
105
|
+
focused = false;
|
|
106
|
+
constructor(jsonformsService) {
|
|
107
|
+
super(jsonformsService);
|
|
108
|
+
}
|
|
109
|
+
getEventValue = (event) => event.target.value;
|
|
110
|
+
ngOnInit() {
|
|
111
|
+
super.ngOnInit();
|
|
112
|
+
this.shouldFilter = false;
|
|
113
|
+
this.filteredOptions = this.form.valueChanges.pipe(startWith(''), map((val) => this.filter(val)));
|
|
114
|
+
}
|
|
115
|
+
updateFilter(event) {
|
|
116
|
+
// ENTER
|
|
117
|
+
if (event.keyCode === 13) {
|
|
118
|
+
this.shouldFilter = false;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
this.shouldFilter = true;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
onSelect(ev) {
|
|
125
|
+
const path = composeWithUi(this.uischema, this.path);
|
|
126
|
+
this.shouldFilter = false;
|
|
127
|
+
this.jsonFormsService.updateCore(Actions.update(path, () => ev.option.value));
|
|
128
|
+
this.triggerValidation();
|
|
129
|
+
}
|
|
130
|
+
filter(val) {
|
|
131
|
+
return (this.options || this.scopedSchema.enum || []).filter((option) => !this.shouldFilter ||
|
|
132
|
+
!val ||
|
|
133
|
+
option.toLowerCase().indexOf(val.toLowerCase()) === 0);
|
|
134
|
+
}
|
|
135
|
+
getOwnProps() {
|
|
136
|
+
return {
|
|
137
|
+
...super.getOwnProps(),
|
|
138
|
+
options: this.options,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AutocompleteControlRenderer, deps: [{ token: i1.JsonFormsAngularService }], target: i0.ɵɵFactoryTarget.Component });
|
|
142
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: AutocompleteControlRenderer, selector: "AutocompleteControlRenderer", inputs: { options: "options" }, usesInheritance: true, ngImport: i0, template: `
|
|
143
|
+
<mat-form-field [ngStyle]="{ display: hidden ? 'none' : '' }">
|
|
144
|
+
<mat-label>{{ label }}</mat-label>
|
|
145
|
+
<input
|
|
146
|
+
matInput
|
|
147
|
+
type="text"
|
|
148
|
+
(change)="onChange($event)"
|
|
149
|
+
[id]="id"
|
|
150
|
+
[formControl]="form"
|
|
151
|
+
[matAutocomplete]="auto"
|
|
152
|
+
(keydown)="updateFilter($event)"
|
|
153
|
+
(focus)="focused = true"
|
|
154
|
+
(focusout)="focused = false"
|
|
155
|
+
/>
|
|
156
|
+
<mat-autocomplete
|
|
157
|
+
autoActiveFirstOption
|
|
158
|
+
#auto="matAutocomplete"
|
|
159
|
+
(optionSelected)="onSelect($event)"
|
|
160
|
+
>
|
|
161
|
+
<mat-option
|
|
162
|
+
*ngFor="let option of filteredOptions | async"
|
|
163
|
+
[value]="option"
|
|
164
|
+
>
|
|
165
|
+
{{ option }}
|
|
166
|
+
</mat-option>
|
|
167
|
+
</mat-autocomplete>
|
|
168
|
+
<mat-hint *ngIf="shouldShowUnfocusedDescription() || focused">{{
|
|
169
|
+
description
|
|
170
|
+
}}</mat-hint>
|
|
171
|
+
<mat-error>{{ error }}</mat-error>
|
|
172
|
+
</mat-form-field>
|
|
173
|
+
`, isInline: true, styles: [":host{display:flex;flex-direction:row}mat-form-field{flex:1 1 auto}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i3.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "directive", type: i5.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i6.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "component", type: i7.MatAutocomplete, selector: "mat-autocomplete", inputs: ["disableRipple", "hideSingleSelectionIndicator"], exportAs: ["matAutocomplete"] }, { kind: "directive", type: i7.MatAutocompleteTrigger, selector: "input[matAutocomplete], textarea[matAutocomplete]", exportAs: ["matAutocompleteTrigger"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
174
|
+
}
|
|
175
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: AutocompleteControlRenderer, decorators: [{
|
|
176
|
+
type: Component,
|
|
177
|
+
args: [{ selector: 'AutocompleteControlRenderer', template: `
|
|
178
|
+
<mat-form-field [ngStyle]="{ display: hidden ? 'none' : '' }">
|
|
179
|
+
<mat-label>{{ label }}</mat-label>
|
|
180
|
+
<input
|
|
181
|
+
matInput
|
|
182
|
+
type="text"
|
|
183
|
+
(change)="onChange($event)"
|
|
184
|
+
[id]="id"
|
|
185
|
+
[formControl]="form"
|
|
186
|
+
[matAutocomplete]="auto"
|
|
187
|
+
(keydown)="updateFilter($event)"
|
|
188
|
+
(focus)="focused = true"
|
|
189
|
+
(focusout)="focused = false"
|
|
190
|
+
/>
|
|
191
|
+
<mat-autocomplete
|
|
192
|
+
autoActiveFirstOption
|
|
193
|
+
#auto="matAutocomplete"
|
|
194
|
+
(optionSelected)="onSelect($event)"
|
|
195
|
+
>
|
|
196
|
+
<mat-option
|
|
197
|
+
*ngFor="let option of filteredOptions | async"
|
|
198
|
+
[value]="option"
|
|
199
|
+
>
|
|
200
|
+
{{ option }}
|
|
201
|
+
</mat-option>
|
|
202
|
+
</mat-autocomplete>
|
|
203
|
+
<mat-hint *ngIf="shouldShowUnfocusedDescription() || focused">{{
|
|
204
|
+
description
|
|
205
|
+
}}</mat-hint>
|
|
206
|
+
<mat-error>{{ error }}</mat-error>
|
|
207
|
+
</mat-form-field>
|
|
208
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:flex;flex-direction:row}mat-form-field{flex:1 1 auto}\n"] }]
|
|
209
|
+
}], ctorParameters: function () { return [{ type: i1.JsonFormsAngularService }]; }, propDecorators: { options: [{
|
|
210
|
+
type: Input
|
|
211
|
+
}] } });
|
|
212
|
+
const enumControlTester = rankWith(2, isEnumControl);
|
|
213
|
+
|
|
214
|
+
/*
|
|
215
|
+
The MIT License
|
|
216
|
+
|
|
217
|
+
Copyright (c) 2017-2019 EclipseSource Munich
|
|
218
|
+
https://github.com/eclipsesource/jsonforms
|
|
219
|
+
|
|
220
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
221
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
222
|
+
in the Software without restriction, including without limitation the rights
|
|
223
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
224
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
225
|
+
furnished to do so, subject to the following conditions:
|
|
226
|
+
|
|
227
|
+
The above copyright notice and this permission notice shall be included in
|
|
228
|
+
all copies or substantial portions of the Software.
|
|
229
|
+
|
|
230
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
231
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
232
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
233
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
234
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
235
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
236
|
+
THE SOFTWARE.
|
|
237
|
+
*/
|
|
238
|
+
class BooleanControlRenderer extends JsonFormsControl {
|
|
239
|
+
changeDetectionRef;
|
|
240
|
+
constructor(jsonformsService, changeDetectionRef) {
|
|
241
|
+
super(jsonformsService);
|
|
242
|
+
this.changeDetectionRef = changeDetectionRef;
|
|
243
|
+
}
|
|
244
|
+
isChecked = () => this.data || false;
|
|
245
|
+
getEventValue = (event) => event.checked;
|
|
246
|
+
mapAdditionalProps() {
|
|
247
|
+
if (!this.changeDetectionRef.destroyed) {
|
|
248
|
+
this.changeDetectionRef.markForCheck();
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BooleanControlRenderer, deps: [{ token: i1.JsonFormsAngularService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
252
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: BooleanControlRenderer, selector: "BooleanControlRenderer", usesInheritance: true, ngImport: i0, template: `
|
|
253
|
+
<div [ngStyle]="{ display: hidden ? 'none' : '' }" class="boolean-control">
|
|
254
|
+
<mat-checkbox
|
|
255
|
+
(change)="onChange($event)"
|
|
256
|
+
[checked]="isChecked()"
|
|
257
|
+
[disabled]="!isEnabled()"
|
|
258
|
+
[id]="id"
|
|
259
|
+
>
|
|
260
|
+
{{ label }}
|
|
261
|
+
</mat-checkbox>
|
|
262
|
+
<mat-hint class="mat-caption" *ngIf="shouldShowUnfocusedDescription()">{{
|
|
263
|
+
description
|
|
264
|
+
}}</mat-hint>
|
|
265
|
+
<mat-error class="mat-caption">{{ error }}</mat-error>
|
|
266
|
+
</div>
|
|
267
|
+
`, isInline: true, styles: [":host{display:flex;flex-direction:row}.boolean-control{flex:1 1 auto;display:flex;flex-direction:column;justify-content:center;height:100%}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i3.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i3.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "component", type: i4$1.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
268
|
+
}
|
|
269
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BooleanControlRenderer, decorators: [{
|
|
270
|
+
type: Component,
|
|
271
|
+
args: [{ selector: 'BooleanControlRenderer', template: `
|
|
272
|
+
<div [ngStyle]="{ display: hidden ? 'none' : '' }" class="boolean-control">
|
|
273
|
+
<mat-checkbox
|
|
274
|
+
(change)="onChange($event)"
|
|
275
|
+
[checked]="isChecked()"
|
|
276
|
+
[disabled]="!isEnabled()"
|
|
277
|
+
[id]="id"
|
|
278
|
+
>
|
|
279
|
+
{{ label }}
|
|
280
|
+
</mat-checkbox>
|
|
281
|
+
<mat-hint class="mat-caption" *ngIf="shouldShowUnfocusedDescription()">{{
|
|
282
|
+
description
|
|
283
|
+
}}</mat-hint>
|
|
284
|
+
<mat-error class="mat-caption">{{ error }}</mat-error>
|
|
285
|
+
</div>
|
|
286
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:flex;flex-direction:row}.boolean-control{flex:1 1 auto;display:flex;flex-direction:column;justify-content:center;height:100%}\n"] }]
|
|
287
|
+
}], ctorParameters: function () { return [{ type: i1.JsonFormsAngularService }, { type: i0.ChangeDetectorRef }]; } });
|
|
288
|
+
const booleanControlTester = rankWith(2, isBooleanControl);
|
|
289
|
+
|
|
290
|
+
/*
|
|
291
|
+
The MIT License
|
|
292
|
+
|
|
293
|
+
Copyright (c) 2017-2019 EclipseSource Munich
|
|
294
|
+
https://github.com/eclipsesource/jsonforms
|
|
295
|
+
|
|
296
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
297
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
298
|
+
in the Software without restriction, including without limitation the rights
|
|
299
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
300
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
301
|
+
furnished to do so, subject to the following conditions:
|
|
302
|
+
|
|
303
|
+
The above copyright notice and this permission notice shall be included in
|
|
304
|
+
all copies or substantial portions of the Software.
|
|
305
|
+
|
|
306
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
307
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
308
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
309
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
310
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
311
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
312
|
+
THE SOFTWARE.
|
|
313
|
+
*/
|
|
314
|
+
class DateControlRenderer extends JsonFormsControl {
|
|
315
|
+
focused = false;
|
|
316
|
+
constructor(jsonformsService) {
|
|
317
|
+
super(jsonformsService);
|
|
318
|
+
}
|
|
319
|
+
getEventValue = (event) => event.value.toISOString().substr(0, 10);
|
|
320
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DateControlRenderer, deps: [{ token: i1.JsonFormsAngularService }], target: i0.ɵɵFactoryTarget.Component });
|
|
321
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: DateControlRenderer, selector: "DateControlRenderer", usesInheritance: true, ngImport: i0, template: `
|
|
322
|
+
<mat-form-field [ngStyle]="{ display: hidden ? 'none' : '' }">
|
|
323
|
+
<mat-label>{{ label }}</mat-label>
|
|
324
|
+
<input
|
|
325
|
+
matInput
|
|
326
|
+
(dateChange)="onChange($event)"
|
|
327
|
+
[id]="id"
|
|
328
|
+
[formControl]="form"
|
|
329
|
+
[matDatepicker]="datepicker"
|
|
330
|
+
(focus)="focused = true"
|
|
331
|
+
(focusout)="focused = false"
|
|
332
|
+
/>
|
|
333
|
+
<mat-datepicker-toggle
|
|
334
|
+
matSuffix
|
|
335
|
+
[for]="datepicker"
|
|
336
|
+
></mat-datepicker-toggle>
|
|
337
|
+
<mat-datepicker #datepicker></mat-datepicker>
|
|
338
|
+
<mat-hint *ngIf="shouldShowUnfocusedDescription() || focused">{{
|
|
339
|
+
description
|
|
340
|
+
}}</mat-hint>
|
|
341
|
+
<mat-error>{{ error }}</mat-error>
|
|
342
|
+
</mat-form-field>
|
|
343
|
+
`, isInline: true, styles: [":host{display:flex;flex-direction:row}mat-form-field{flex:1 1 auto}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i3.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i3.MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "directive", type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i5$1.MatDatepicker, selector: "mat-datepicker", exportAs: ["matDatepicker"] }, { kind: "directive", type: i5$1.MatDatepickerInput, selector: "input[matDatepicker]", inputs: ["matDatepicker", "min", "max", "matDatepickerFilter"], exportAs: ["matDatepickerInput"] }, { kind: "component", type: i5$1.MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "directive", type: i5.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
344
|
+
}
|
|
345
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DateControlRenderer, decorators: [{
|
|
346
|
+
type: Component,
|
|
347
|
+
args: [{ selector: 'DateControlRenderer', template: `
|
|
348
|
+
<mat-form-field [ngStyle]="{ display: hidden ? 'none' : '' }">
|
|
349
|
+
<mat-label>{{ label }}</mat-label>
|
|
350
|
+
<input
|
|
351
|
+
matInput
|
|
352
|
+
(dateChange)="onChange($event)"
|
|
353
|
+
[id]="id"
|
|
354
|
+
[formControl]="form"
|
|
355
|
+
[matDatepicker]="datepicker"
|
|
356
|
+
(focus)="focused = true"
|
|
357
|
+
(focusout)="focused = false"
|
|
358
|
+
/>
|
|
359
|
+
<mat-datepicker-toggle
|
|
360
|
+
matSuffix
|
|
361
|
+
[for]="datepicker"
|
|
362
|
+
></mat-datepicker-toggle>
|
|
363
|
+
<mat-datepicker #datepicker></mat-datepicker>
|
|
364
|
+
<mat-hint *ngIf="shouldShowUnfocusedDescription() || focused">{{
|
|
365
|
+
description
|
|
366
|
+
}}</mat-hint>
|
|
367
|
+
<mat-error>{{ error }}</mat-error>
|
|
368
|
+
</mat-form-field>
|
|
369
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:flex;flex-direction:row}mat-form-field{flex:1 1 auto}\n"] }]
|
|
370
|
+
}], ctorParameters: function () { return [{ type: i1.JsonFormsAngularService }]; } });
|
|
371
|
+
const DateControlRendererTester = rankWith(2, isDateControl);
|
|
372
|
+
|
|
373
|
+
/*
|
|
374
|
+
The MIT License
|
|
375
|
+
|
|
376
|
+
Copyright (c) 2017-2019 EclipseSource Munich
|
|
377
|
+
https://github.com/eclipsesource/jsonforms
|
|
378
|
+
|
|
379
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
380
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
381
|
+
in the Software without restriction, including without limitation the rights
|
|
382
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
383
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
384
|
+
furnished to do so, subject to the following conditions:
|
|
385
|
+
|
|
386
|
+
The above copyright notice and this permission notice shall be included in
|
|
387
|
+
all copies or substantial portions of the Software.
|
|
388
|
+
|
|
389
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
390
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
391
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
392
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
393
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
394
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
395
|
+
THE SOFTWARE.
|
|
396
|
+
*/
|
|
397
|
+
class NumberControlRenderer extends JsonFormsControl {
|
|
398
|
+
MAXIMUM_FRACTIONAL_DIGITS = 20;
|
|
399
|
+
oldValue;
|
|
400
|
+
min;
|
|
401
|
+
max;
|
|
402
|
+
multipleOf;
|
|
403
|
+
locale;
|
|
404
|
+
numberFormat;
|
|
405
|
+
decimalSeparator;
|
|
406
|
+
focused = false;
|
|
407
|
+
constructor(jsonformsService) {
|
|
408
|
+
super(jsonformsService);
|
|
409
|
+
}
|
|
410
|
+
onChange(ev) {
|
|
411
|
+
const data = this.oldValue
|
|
412
|
+
? ev.target.value.replace(this.oldValue, '')
|
|
413
|
+
: ev.target.value;
|
|
414
|
+
// ignore these
|
|
415
|
+
if (data === '.' ||
|
|
416
|
+
data === ',' ||
|
|
417
|
+
data === ' ' ||
|
|
418
|
+
// if the value is 0 and we already have a value then we ignore
|
|
419
|
+
(data === '0' &&
|
|
420
|
+
this.getValue() !== '' &&
|
|
421
|
+
// a 0 in the first place
|
|
422
|
+
((ev.target.selectionStart === 1 && ev.target.selectionEnd === 1) ||
|
|
423
|
+
// or in the last place as this doesn't change the value (when there is a separator)
|
|
424
|
+
(ev.target.selectionStart === ev.target.value.length &&
|
|
425
|
+
ev.target.selectionEnd === ev.target.value.length &&
|
|
426
|
+
ev.target.value.indexOf(this.decimalSeparator) !== -1)))) {
|
|
427
|
+
this.oldValue = ev.target.value;
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
super.onChange(ev);
|
|
431
|
+
this.oldValue = this.getValue();
|
|
432
|
+
}
|
|
433
|
+
getEventValue = (event) => {
|
|
434
|
+
const cleanPattern = new RegExp(`[^-+0-9${this.decimalSeparator}]`, 'g');
|
|
435
|
+
const cleaned = event.target.value.replace(cleanPattern, '');
|
|
436
|
+
const normalized = cleaned.replace(this.decimalSeparator, '.');
|
|
437
|
+
if (normalized === '') {
|
|
438
|
+
return undefined;
|
|
439
|
+
}
|
|
440
|
+
// convert to number
|
|
441
|
+
const number = +normalized;
|
|
442
|
+
// if not a number just return the string
|
|
443
|
+
if (Number.isNaN(number)) {
|
|
444
|
+
return event.target.value;
|
|
445
|
+
}
|
|
446
|
+
return number;
|
|
447
|
+
};
|
|
448
|
+
getValue = () => {
|
|
449
|
+
if (this.data !== undefined && this.data !== null) {
|
|
450
|
+
if (typeof this.data === 'number') {
|
|
451
|
+
return this.numberFormat.format(this.data);
|
|
452
|
+
}
|
|
453
|
+
return this.data;
|
|
454
|
+
}
|
|
455
|
+
return '';
|
|
456
|
+
};
|
|
457
|
+
mapAdditionalProps(props) {
|
|
458
|
+
if (this.scopedSchema) {
|
|
459
|
+
const testerContext = {
|
|
460
|
+
rootSchema: this.rootSchema,
|
|
461
|
+
config: props.config,
|
|
462
|
+
};
|
|
463
|
+
const defaultStep = isNumberControl(this.uischema, this.rootSchema, testerContext)
|
|
464
|
+
? 0.1
|
|
465
|
+
: 1;
|
|
466
|
+
this.min = this.scopedSchema.minimum;
|
|
467
|
+
this.max = this.scopedSchema.maximum;
|
|
468
|
+
this.multipleOf = this.scopedSchema.multipleOf || defaultStep;
|
|
469
|
+
const appliedUiSchemaOptions = merge({}, props.config, this.uischema.options);
|
|
470
|
+
const currentLocale = this.jsonFormsService.getLocale();
|
|
471
|
+
if (this.locale === undefined || this.locale !== currentLocale) {
|
|
472
|
+
this.locale = currentLocale;
|
|
473
|
+
this.numberFormat = new Intl.NumberFormat(this.locale, {
|
|
474
|
+
useGrouping: appliedUiSchemaOptions.useGrouping,
|
|
475
|
+
maximumFractionDigits: this.MAXIMUM_FRACTIONAL_DIGITS,
|
|
476
|
+
});
|
|
477
|
+
this.determineDecimalSeparator();
|
|
478
|
+
this.oldValue = this.getValue();
|
|
479
|
+
}
|
|
480
|
+
this.form.setValue(this.getValue());
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
determineDecimalSeparator() {
|
|
484
|
+
const example = this.numberFormat.format(1.1);
|
|
485
|
+
this.decimalSeparator = example.charAt(1);
|
|
486
|
+
}
|
|
487
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NumberControlRenderer, deps: [{ token: i1.JsonFormsAngularService }], target: i0.ɵɵFactoryTarget.Component });
|
|
488
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: NumberControlRenderer, selector: "NumberControlRenderer", usesInheritance: true, ngImport: i0, template: `
|
|
489
|
+
<mat-form-field [ngStyle]="{ display: hidden ? 'none' : '' }">
|
|
490
|
+
<mat-label>{{ label }}</mat-label>
|
|
491
|
+
<input
|
|
492
|
+
matInput
|
|
493
|
+
(input)="onChange($event)"
|
|
494
|
+
[value]="getValue()"
|
|
495
|
+
[id]="id"
|
|
496
|
+
[formControl]="form"
|
|
497
|
+
[min]="min"
|
|
498
|
+
[max]="max"
|
|
499
|
+
[step]="multipleOf"
|
|
500
|
+
(focus)="focused = true"
|
|
501
|
+
(focusout)="focused = false"
|
|
502
|
+
/>
|
|
503
|
+
<mat-hint *ngIf="shouldShowUnfocusedDescription() || focused">{{
|
|
504
|
+
description
|
|
505
|
+
}}</mat-hint>
|
|
506
|
+
<mat-error>{{ error }}</mat-error>
|
|
507
|
+
</mat-form-field>
|
|
508
|
+
`, isInline: true, styles: [":host{display:flex;flex-direction:row}mat-form-field{flex:1 1 auto}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i3.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "directive", type: i5.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
509
|
+
}
|
|
510
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NumberControlRenderer, decorators: [{
|
|
511
|
+
type: Component,
|
|
512
|
+
args: [{ selector: 'NumberControlRenderer', template: `
|
|
513
|
+
<mat-form-field [ngStyle]="{ display: hidden ? 'none' : '' }">
|
|
514
|
+
<mat-label>{{ label }}</mat-label>
|
|
515
|
+
<input
|
|
516
|
+
matInput
|
|
517
|
+
(input)="onChange($event)"
|
|
518
|
+
[value]="getValue()"
|
|
519
|
+
[id]="id"
|
|
520
|
+
[formControl]="form"
|
|
521
|
+
[min]="min"
|
|
522
|
+
[max]="max"
|
|
523
|
+
[step]="multipleOf"
|
|
524
|
+
(focus)="focused = true"
|
|
525
|
+
(focusout)="focused = false"
|
|
526
|
+
/>
|
|
527
|
+
<mat-hint *ngIf="shouldShowUnfocusedDescription() || focused">{{
|
|
528
|
+
description
|
|
529
|
+
}}</mat-hint>
|
|
530
|
+
<mat-error>{{ error }}</mat-error>
|
|
531
|
+
</mat-form-field>
|
|
532
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:flex;flex-direction:row}mat-form-field{flex:1 1 auto}\n"] }]
|
|
533
|
+
}], ctorParameters: function () { return [{ type: i1.JsonFormsAngularService }]; } });
|
|
534
|
+
const NumberControlRendererTester = rankWith(2, or(isNumberControl, isIntegerControl));
|
|
535
|
+
|
|
536
|
+
/*
|
|
537
|
+
The MIT License
|
|
538
|
+
|
|
539
|
+
Copyright (c) 2017-2019 EclipseSource Munich
|
|
540
|
+
https://github.com/eclipsesource/jsonforms
|
|
541
|
+
|
|
542
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
543
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
544
|
+
in the Software without restriction, including without limitation the rights
|
|
545
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
546
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
547
|
+
furnished to do so, subject to the following conditions:
|
|
548
|
+
|
|
549
|
+
The above copyright notice and this permission notice shall be included in
|
|
550
|
+
all copies or substantial portions of the Software.
|
|
551
|
+
|
|
552
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
553
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
554
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
555
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
556
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
557
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
558
|
+
THE SOFTWARE.
|
|
559
|
+
*/
|
|
560
|
+
class RangeControlRenderer extends JsonFormsControl {
|
|
561
|
+
changeDetectorRef;
|
|
562
|
+
min;
|
|
563
|
+
max;
|
|
564
|
+
multipleOf;
|
|
565
|
+
focused = false;
|
|
566
|
+
constructor(jsonformsService, changeDetectorRef) {
|
|
567
|
+
super(jsonformsService);
|
|
568
|
+
this.changeDetectorRef = changeDetectorRef;
|
|
569
|
+
}
|
|
570
|
+
getEventValue = (event) => Number(event);
|
|
571
|
+
mapAdditionalProps() {
|
|
572
|
+
if (this.scopedSchema) {
|
|
573
|
+
this.min = this.scopedSchema.minimum;
|
|
574
|
+
this.max = this.scopedSchema.maximum;
|
|
575
|
+
this.multipleOf = this.scopedSchema.multipleOf || 1;
|
|
576
|
+
}
|
|
577
|
+
this.changeDetectorRef.markForCheck();
|
|
578
|
+
}
|
|
579
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RangeControlRenderer, deps: [{ token: i1.JsonFormsAngularService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
580
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: RangeControlRenderer, selector: "RangeControlRenderer", usesInheritance: true, ngImport: i0, template: `
|
|
581
|
+
<div [ngStyle]="{ display: hidden ? 'none' : '' }" class="range-control">
|
|
582
|
+
<label class="mat-caption" style="color:rgba(0,0,0,.54)">{{
|
|
583
|
+
label
|
|
584
|
+
}}</label>
|
|
585
|
+
<mat-slider
|
|
586
|
+
[disabled]="!isEnabled()"
|
|
587
|
+
[max]="max"
|
|
588
|
+
[min]="min"
|
|
589
|
+
[step]="multipleOf"
|
|
590
|
+
[discrete]="true"
|
|
591
|
+
[id]="id"
|
|
592
|
+
showTickMarks
|
|
593
|
+
#ngSlider
|
|
594
|
+
>
|
|
595
|
+
<input matSliderThumb (valueChange)="onChange($event)" />
|
|
596
|
+
</mat-slider>
|
|
597
|
+
<mat-hint class="mat-caption" *ngIf="shouldShowUnfocusedDescription()">{{
|
|
598
|
+
description
|
|
599
|
+
}}</mat-hint>
|
|
600
|
+
<mat-error class="mat-caption">{{ error }}</mat-error>
|
|
601
|
+
</div>
|
|
602
|
+
`, isInline: true, styles: [":host{display:flex;flex-direction:row}.range-control{flex:1 1 auto;display:flex;flex-direction:column}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i3.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i3.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "component", type: i4$2.MatSlider, selector: "mat-slider", inputs: ["color", "disableRipple", "disabled", "discrete", "showTickMarks", "min", "max", "step", "displayWith"], exportAs: ["matSlider"] }, { kind: "directive", type: i4$2.MatSliderThumb, selector: "input[matSliderThumb]", inputs: ["value"], outputs: ["valueChange", "dragStart", "dragEnd"], exportAs: ["matSliderThumb"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
603
|
+
}
|
|
604
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RangeControlRenderer, decorators: [{
|
|
605
|
+
type: Component,
|
|
606
|
+
args: [{ selector: 'RangeControlRenderer', template: `
|
|
607
|
+
<div [ngStyle]="{ display: hidden ? 'none' : '' }" class="range-control">
|
|
608
|
+
<label class="mat-caption" style="color:rgba(0,0,0,.54)">{{
|
|
609
|
+
label
|
|
610
|
+
}}</label>
|
|
611
|
+
<mat-slider
|
|
612
|
+
[disabled]="!isEnabled()"
|
|
613
|
+
[max]="max"
|
|
614
|
+
[min]="min"
|
|
615
|
+
[step]="multipleOf"
|
|
616
|
+
[discrete]="true"
|
|
617
|
+
[id]="id"
|
|
618
|
+
showTickMarks
|
|
619
|
+
#ngSlider
|
|
620
|
+
>
|
|
621
|
+
<input matSliderThumb (valueChange)="onChange($event)" />
|
|
622
|
+
</mat-slider>
|
|
623
|
+
<mat-hint class="mat-caption" *ngIf="shouldShowUnfocusedDescription()">{{
|
|
624
|
+
description
|
|
625
|
+
}}</mat-hint>
|
|
626
|
+
<mat-error class="mat-caption">{{ error }}</mat-error>
|
|
627
|
+
</div>
|
|
628
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:flex;flex-direction:row}.range-control{flex:1 1 auto;display:flex;flex-direction:column}\n"] }]
|
|
629
|
+
}], ctorParameters: function () { return [{ type: i1.JsonFormsAngularService }, { type: i0.ChangeDetectorRef }]; } });
|
|
630
|
+
const RangeControlRendererTester = rankWith(4, isRangeControl);
|
|
631
|
+
|
|
632
|
+
/*
|
|
633
|
+
The MIT License
|
|
634
|
+
|
|
635
|
+
Copyright (c) 2017-2019 EclipseSource Munich
|
|
636
|
+
https://github.com/eclipsesource/jsonforms
|
|
637
|
+
|
|
638
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
639
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
640
|
+
in the Software without restriction, including without limitation the rights
|
|
641
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
642
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
643
|
+
furnished to do so, subject to the following conditions:
|
|
644
|
+
|
|
645
|
+
The above copyright notice and this permission notice shall be included in
|
|
646
|
+
all copies or substantial portions of the Software.
|
|
647
|
+
|
|
648
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
649
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
650
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
651
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
652
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
653
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
654
|
+
THE SOFTWARE.
|
|
655
|
+
*/
|
|
656
|
+
class TextAreaRenderer extends JsonFormsControl {
|
|
657
|
+
focused = false;
|
|
658
|
+
constructor(jsonformsService) {
|
|
659
|
+
super(jsonformsService);
|
|
660
|
+
}
|
|
661
|
+
getEventValue = (event) => event.target.value || undefined;
|
|
662
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TextAreaRenderer, deps: [{ token: i1.JsonFormsAngularService }], target: i0.ɵɵFactoryTarget.Component });
|
|
663
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TextAreaRenderer, selector: "TextAreaRenderer", usesInheritance: true, ngImport: i0, template: `
|
|
664
|
+
<mat-form-field [ngStyle]="{ display: hidden ? 'none' : '' }">
|
|
665
|
+
<mat-label>{{ label }}</mat-label>
|
|
666
|
+
<textarea
|
|
667
|
+
matInput
|
|
668
|
+
(input)="onChange($event)"
|
|
669
|
+
[id]="id"
|
|
670
|
+
[formControl]="form"
|
|
671
|
+
(focus)="focused = true"
|
|
672
|
+
(focusout)="focused = false"
|
|
673
|
+
></textarea>
|
|
674
|
+
<mat-hint *ngIf="shouldShowUnfocusedDescription() || focused">{{
|
|
675
|
+
description
|
|
676
|
+
}}</mat-hint>
|
|
677
|
+
<mat-error>{{ error }}</mat-error>
|
|
678
|
+
</mat-form-field>
|
|
679
|
+
`, isInline: true, styles: [":host{display:flex;flex-direction:row}mat-form-field{flex:1 1 auto}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i3.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "directive", type: i5.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
680
|
+
}
|
|
681
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TextAreaRenderer, decorators: [{
|
|
682
|
+
type: Component,
|
|
683
|
+
args: [{ selector: 'TextAreaRenderer', template: `
|
|
684
|
+
<mat-form-field [ngStyle]="{ display: hidden ? 'none' : '' }">
|
|
685
|
+
<mat-label>{{ label }}</mat-label>
|
|
686
|
+
<textarea
|
|
687
|
+
matInput
|
|
688
|
+
(input)="onChange($event)"
|
|
689
|
+
[id]="id"
|
|
690
|
+
[formControl]="form"
|
|
691
|
+
(focus)="focused = true"
|
|
692
|
+
(focusout)="focused = false"
|
|
693
|
+
></textarea>
|
|
694
|
+
<mat-hint *ngIf="shouldShowUnfocusedDescription() || focused">{{
|
|
695
|
+
description
|
|
696
|
+
}}</mat-hint>
|
|
697
|
+
<mat-error>{{ error }}</mat-error>
|
|
698
|
+
</mat-form-field>
|
|
699
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:flex;flex-direction:row}mat-form-field{flex:1 1 auto}\n"] }]
|
|
700
|
+
}], ctorParameters: function () { return [{ type: i1.JsonFormsAngularService }]; } });
|
|
701
|
+
const TextAreaRendererTester = rankWith(2, isMultiLineControl);
|
|
702
|
+
|
|
703
|
+
/*
|
|
704
|
+
The MIT License
|
|
705
|
+
|
|
706
|
+
Copyright (c) 2017-2019 EclipseSource Munich
|
|
707
|
+
https://github.com/eclipsesource/jsonforms
|
|
708
|
+
|
|
709
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
710
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
711
|
+
in the Software without restriction, including without limitation the rights
|
|
712
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
713
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
714
|
+
furnished to do so, subject to the following conditions:
|
|
715
|
+
|
|
716
|
+
The above copyright notice and this permission notice shall be included in
|
|
717
|
+
all copies or substantial portions of the Software.
|
|
718
|
+
|
|
719
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
720
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
721
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
722
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
723
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
724
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
725
|
+
THE SOFTWARE.
|
|
726
|
+
*/
|
|
727
|
+
class TextControlRenderer extends JsonFormsControl {
|
|
728
|
+
focused = false;
|
|
729
|
+
constructor(jsonformsService) {
|
|
730
|
+
super(jsonformsService);
|
|
731
|
+
}
|
|
732
|
+
getEventValue = (event) => event.target.value || undefined;
|
|
733
|
+
getType = () => {
|
|
734
|
+
if (this.uischema.options && this.uischema.options.format) {
|
|
735
|
+
return this.uischema.options.format;
|
|
736
|
+
}
|
|
737
|
+
if (this.scopedSchema && this.scopedSchema.format) {
|
|
738
|
+
switch (this.scopedSchema.format) {
|
|
739
|
+
case 'email':
|
|
740
|
+
return 'email';
|
|
741
|
+
case 'tel':
|
|
742
|
+
return 'tel';
|
|
743
|
+
default:
|
|
744
|
+
return 'text';
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
return 'text';
|
|
748
|
+
};
|
|
749
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TextControlRenderer, deps: [{ token: i1.JsonFormsAngularService }], target: i0.ɵɵFactoryTarget.Component });
|
|
750
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TextControlRenderer, selector: "TextControlRenderer", usesInheritance: true, ngImport: i0, template: `
|
|
751
|
+
<mat-form-field [ngStyle]="{ display: hidden ? 'none' : '' }">
|
|
752
|
+
<mat-label>{{ label }}</mat-label>
|
|
753
|
+
<input
|
|
754
|
+
matInput
|
|
755
|
+
[type]="getType()"
|
|
756
|
+
(input)="onChange($event)"
|
|
757
|
+
[id]="id"
|
|
758
|
+
[formControl]="form"
|
|
759
|
+
(focus)="focused = true"
|
|
760
|
+
(focusout)="focused = false"
|
|
761
|
+
/>
|
|
762
|
+
<mat-hint *ngIf="shouldShowUnfocusedDescription() || focused">{{
|
|
763
|
+
description
|
|
764
|
+
}}</mat-hint>
|
|
765
|
+
<mat-error>{{ error }}</mat-error>
|
|
766
|
+
</mat-form-field>
|
|
767
|
+
`, isInline: true, styles: [":host{display:flex;flex-direction:row}mat-form-field{flex:1 1 auto}\n"], dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i3.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i3.MatLabel, selector: "mat-label" }, { kind: "directive", type: i3.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i3.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i4.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "directive", type: i5.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i5.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
768
|
+
}
|
|
769
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TextControlRenderer, decorators: [{
|
|
770
|
+
type: Component,
|
|
771
|
+
args: [{ selector: 'TextControlRenderer', template: `
|
|
772
|
+
<mat-form-field [ngStyle]="{ display: hidden ? 'none' : '' }">
|
|
773
|
+
<mat-label>{{ label }}</mat-label>
|
|
774
|
+
<input
|
|
775
|
+
matInput
|
|
776
|
+
[type]="getType()"
|
|
777
|
+
(input)="onChange($event)"
|
|
778
|
+
[id]="id"
|
|
779
|
+
[formControl]="form"
|
|
780
|
+
(focus)="focused = true"
|
|
781
|
+
(focusout)="focused = false"
|
|
782
|
+
/>
|
|
783
|
+
<mat-hint *ngIf="shouldShowUnfocusedDescription() || focused">{{
|
|
784
|
+
description
|
|
785
|
+
}}</mat-hint>
|
|
786
|
+
<mat-error>{{ error }}</mat-error>
|
|
787
|
+
</mat-form-field>
|
|
788
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:flex;flex-direction:row}mat-form-field{flex:1 1 auto}\n"] }]
|
|
789
|
+
}], ctorParameters: function () { return [{ type: i1.JsonFormsAngularService }]; } });
|
|
790
|
+
const TextControlRendererTester = rankWith(1, isStringControl);
|
|
791
|
+
|
|
792
|
+
/*
|
|
793
|
+
The MIT License
|
|
794
|
+
|
|
795
|
+
Copyright (c) 2017-2019 EclipseSource Munich
|
|
796
|
+
https://github.com/eclipsesource/jsonforms
|
|
797
|
+
|
|
798
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
799
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
800
|
+
in the Software without restriction, including without limitation the rights
|
|
801
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
802
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
803
|
+
furnished to do so, subject to the following conditions:
|
|
804
|
+
|
|
805
|
+
The above copyright notice and this permission notice shall be included in
|
|
806
|
+
all copies or substantial portions of the Software.
|
|
807
|
+
|
|
808
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
809
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
810
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
811
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
812
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
813
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
814
|
+
THE SOFTWARE.
|
|
815
|
+
*/
|
|
816
|
+
class ToggleControlRenderer extends JsonFormsControl {
|
|
817
|
+
changeDetectorRef;
|
|
818
|
+
constructor(jsonformsService, changeDetectorRef) {
|
|
819
|
+
super(jsonformsService);
|
|
820
|
+
this.changeDetectorRef = changeDetectorRef;
|
|
821
|
+
}
|
|
822
|
+
isChecked = () => this.data || false;
|
|
823
|
+
getEventValue = (event) => event.checked;
|
|
824
|
+
mapAdditionalProps() {
|
|
825
|
+
this.changeDetectorRef.markForCheck();
|
|
826
|
+
}
|
|
827
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ToggleControlRenderer, deps: [{ token: i1.JsonFormsAngularService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
828
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ToggleControlRenderer, selector: "ToggleControlRenderer", usesInheritance: true, ngImport: i0, template: `
|
|
829
|
+
<div [ngStyle]="{ display: hidden ? 'none' : '' }">
|
|
830
|
+
<mat-slide-toggle
|
|
831
|
+
(change)="onChange($event)"
|
|
832
|
+
[checked]="isChecked()"
|
|
833
|
+
[disabled]="!isEnabled()"
|
|
834
|
+
[id]="id"
|
|
835
|
+
>
|
|
836
|
+
{{ label }}
|
|
837
|
+
</mat-slide-toggle>
|
|
838
|
+
<mat-hint class="mat-caption" *ngIf="shouldShowUnfocusedDescription()">{{
|
|
839
|
+
description
|
|
840
|
+
}}</mat-hint>
|
|
841
|
+
<mat-error class="mat-caption">{{ error }}</mat-error>
|
|
842
|
+
</div>
|
|
843
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i3.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i3.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "component", type: i4$3.MatSlideToggle, selector: "mat-slide-toggle", inputs: ["disabled", "disableRipple", "color", "tabIndex"], exportAs: ["matSlideToggle"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
844
|
+
}
|
|
845
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ToggleControlRenderer, decorators: [{
|
|
846
|
+
type: Component,
|
|
847
|
+
args: [{
|
|
848
|
+
selector: 'ToggleControlRenderer',
|
|
849
|
+
template: `
|
|
850
|
+
<div [ngStyle]="{ display: hidden ? 'none' : '' }">
|
|
851
|
+
<mat-slide-toggle
|
|
852
|
+
(change)="onChange($event)"
|
|
853
|
+
[checked]="isChecked()"
|
|
854
|
+
[disabled]="!isEnabled()"
|
|
855
|
+
[id]="id"
|
|
856
|
+
>
|
|
857
|
+
{{ label }}
|
|
858
|
+
</mat-slide-toggle>
|
|
859
|
+
<mat-hint class="mat-caption" *ngIf="shouldShowUnfocusedDescription()">{{
|
|
860
|
+
description
|
|
861
|
+
}}</mat-hint>
|
|
862
|
+
<mat-error class="mat-caption">{{ error }}</mat-error>
|
|
863
|
+
</div>
|
|
864
|
+
`,
|
|
865
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
866
|
+
}]
|
|
867
|
+
}], ctorParameters: function () { return [{ type: i1.JsonFormsAngularService }, { type: i0.ChangeDetectorRef }]; } });
|
|
868
|
+
const ToggleControlRendererTester = rankWith(3, and(isBooleanControl, optionIs('toggle', true)));
|
|
869
|
+
|
|
870
|
+
/*
|
|
871
|
+
The MIT License
|
|
872
|
+
|
|
873
|
+
Copyright (c) 2017-2019 EclipseSource Munich
|
|
874
|
+
https://github.com/eclipsesource/jsonforms
|
|
875
|
+
|
|
876
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
877
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
878
|
+
in the Software without restriction, including without limitation the rights
|
|
879
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
880
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
881
|
+
furnished to do so, subject to the following conditions:
|
|
882
|
+
|
|
883
|
+
The above copyright notice and this permission notice shall be included in
|
|
884
|
+
all copies or substantial portions of the Software.
|
|
885
|
+
|
|
886
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
887
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
888
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
889
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
890
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
891
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
892
|
+
THE SOFTWARE.
|
|
893
|
+
*/
|
|
894
|
+
class LabelRenderer extends JsonFormsBaseRenderer {
|
|
895
|
+
jsonFormsService;
|
|
896
|
+
label;
|
|
897
|
+
visible;
|
|
898
|
+
subscription;
|
|
899
|
+
constructor(jsonFormsService) {
|
|
900
|
+
super();
|
|
901
|
+
this.jsonFormsService = jsonFormsService;
|
|
902
|
+
}
|
|
903
|
+
ngOnInit() {
|
|
904
|
+
this.subscription = this.jsonFormsService.$state.subscribe({
|
|
905
|
+
next: (state) => {
|
|
906
|
+
const props = mapStateToLabelProps(state, this.getOwnProps());
|
|
907
|
+
this.visible = props.visible;
|
|
908
|
+
this.label = props.text;
|
|
909
|
+
},
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
ngOnDestroy() {
|
|
913
|
+
if (this.subscription) {
|
|
914
|
+
this.subscription.unsubscribe();
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LabelRenderer, deps: [{ token: i1.JsonFormsAngularService }], target: i0.ɵɵFactoryTarget.Component });
|
|
918
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: LabelRenderer, selector: "LabelRenderer", usesInheritance: true, ngImport: i0, template: ` <label class="mat-headline-6"> {{ label }} </label> `, isInline: true, styles: [":host{flex:1 1 auto}\n"] });
|
|
919
|
+
}
|
|
920
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LabelRenderer, decorators: [{
|
|
921
|
+
type: Component,
|
|
922
|
+
args: [{ selector: 'LabelRenderer', template: ` <label class="mat-headline-6"> {{ label }} </label> `, styles: [":host{flex:1 1 auto}\n"] }]
|
|
923
|
+
}], ctorParameters: function () { return [{ type: i1.JsonFormsAngularService }]; } });
|
|
924
|
+
const LabelRendererTester = rankWith(4, uiTypeIs('Label'));
|
|
925
|
+
|
|
926
|
+
/*
|
|
927
|
+
The MIT License
|
|
928
|
+
|
|
929
|
+
Copyright (c) 2017-2019 EclipseSource Munich
|
|
930
|
+
https://github.com/eclipsesource/jsonforms
|
|
931
|
+
|
|
932
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
933
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
934
|
+
in the Software without restriction, including without limitation the rights
|
|
935
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
936
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
937
|
+
furnished to do so, subject to the following conditions:
|
|
938
|
+
|
|
939
|
+
The above copyright notice and this permission notice shall be included in
|
|
940
|
+
all copies or substantial portions of the Software.
|
|
941
|
+
|
|
942
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
943
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
944
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
945
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
946
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
947
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
948
|
+
THE SOFTWARE.
|
|
949
|
+
*/
|
|
950
|
+
class JsonFormsDetailComponent {
|
|
951
|
+
_item;
|
|
952
|
+
_schema;
|
|
953
|
+
initialized = false;
|
|
954
|
+
set item(item) {
|
|
955
|
+
if (item) {
|
|
956
|
+
this._item = item;
|
|
957
|
+
this.initialized = true;
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: JsonFormsDetailComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
961
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: JsonFormsDetailComponent, selector: "jsonforms-detail", inputs: { item: "item" }, ngImport: i0, template: `
|
|
962
|
+
<div *ngIf="initialized">
|
|
963
|
+
<jsonforms-outlet [renderProps]="_item"></jsonforms-outlet>
|
|
964
|
+
</div>
|
|
965
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.JsonFormsOutlet, selector: "jsonforms-outlet", inputs: ["renderProps"] }] });
|
|
966
|
+
}
|
|
967
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: JsonFormsDetailComponent, decorators: [{
|
|
968
|
+
type: Component,
|
|
969
|
+
args: [{
|
|
970
|
+
selector: 'jsonforms-detail',
|
|
971
|
+
template: `
|
|
972
|
+
<div *ngIf="initialized">
|
|
973
|
+
<jsonforms-outlet [renderProps]="_item"></jsonforms-outlet>
|
|
974
|
+
</div>
|
|
975
|
+
`,
|
|
976
|
+
}]
|
|
977
|
+
}], propDecorators: { item: [{
|
|
978
|
+
type: Input
|
|
979
|
+
}] } });
|
|
980
|
+
|
|
981
|
+
/*
|
|
982
|
+
The MIT License
|
|
983
|
+
|
|
984
|
+
Copyright (c) 2017-2019 EclipseSource Munich
|
|
985
|
+
https://github.com/eclipsesource/jsonforms
|
|
986
|
+
|
|
987
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
988
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
989
|
+
in the Software without restriction, including without limitation the rights
|
|
990
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
991
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
992
|
+
furnished to do so, subject to the following conditions:
|
|
993
|
+
|
|
994
|
+
The above copyright notice and this permission notice shall be included in
|
|
995
|
+
all copies or substantial portions of the Software.
|
|
996
|
+
|
|
997
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
998
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
999
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1000
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1001
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1002
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
1003
|
+
THE SOFTWARE.
|
|
1004
|
+
*/
|
|
1005
|
+
const keywords = ['#', 'properties', 'items'];
|
|
1006
|
+
const removeSchemaKeywords = (path) => {
|
|
1007
|
+
return decode(path
|
|
1008
|
+
.split('/')
|
|
1009
|
+
.filter((s) => !some(keywords, (key) => key === s))
|
|
1010
|
+
.join('.'));
|
|
1011
|
+
};
|
|
1012
|
+
class MasterListComponent extends JsonFormsArrayControl {
|
|
1013
|
+
changeDetectorRef;
|
|
1014
|
+
masterItems;
|
|
1015
|
+
selectedItem;
|
|
1016
|
+
selectedItemIdx;
|
|
1017
|
+
addItem;
|
|
1018
|
+
removeItems;
|
|
1019
|
+
highlightedIdx;
|
|
1020
|
+
translations;
|
|
1021
|
+
constructor(jsonformsService, changeDetectorRef) {
|
|
1022
|
+
super(jsonformsService);
|
|
1023
|
+
this.changeDetectorRef = changeDetectorRef;
|
|
1024
|
+
}
|
|
1025
|
+
onListItemHover(idx) {
|
|
1026
|
+
this.highlightedIdx = idx;
|
|
1027
|
+
}
|
|
1028
|
+
trackElement(_index, element) {
|
|
1029
|
+
return element ? element.label : null;
|
|
1030
|
+
}
|
|
1031
|
+
ngOnInit() {
|
|
1032
|
+
super.ngOnInit();
|
|
1033
|
+
const dispatch = this.jsonFormsService.updateCore.bind(this.jsonFormsService);
|
|
1034
|
+
const { addItem, removeItems } = mapDispatchToArrayControlProps(dispatch);
|
|
1035
|
+
this.addItem = addItem;
|
|
1036
|
+
this.removeItems = removeItems;
|
|
1037
|
+
}
|
|
1038
|
+
mapAdditionalProps(props) {
|
|
1039
|
+
const { data, path, schema, uischema } = props;
|
|
1040
|
+
const controlElement = uischema;
|
|
1041
|
+
this.propsPath = props.path;
|
|
1042
|
+
const detailUISchema = findUISchema(props.uischemas, schema, `${controlElement.scope}/items`, props.path, 'VerticalLayout', controlElement, props.rootSchema);
|
|
1043
|
+
if (!this.isEnabled()) {
|
|
1044
|
+
setReadonly(detailUISchema);
|
|
1045
|
+
}
|
|
1046
|
+
this.translations = props.translations;
|
|
1047
|
+
const masterItems = (data || []).map((d, index) => {
|
|
1048
|
+
const labelRefInstancePath = controlElement.options?.labelRef &&
|
|
1049
|
+
removeSchemaKeywords(controlElement.options.labelRef);
|
|
1050
|
+
const isPrimitive = d !== undefined && typeof d !== 'object';
|
|
1051
|
+
const masterItem = {
|
|
1052
|
+
label: isPrimitive
|
|
1053
|
+
? d.toString()
|
|
1054
|
+
: get(d, labelRefInstancePath ?? getFirstPrimitiveProp(schema)),
|
|
1055
|
+
data: d,
|
|
1056
|
+
path: `${path}.${index}`,
|
|
1057
|
+
schema,
|
|
1058
|
+
uischema: detailUISchema,
|
|
1059
|
+
};
|
|
1060
|
+
return masterItem;
|
|
1061
|
+
});
|
|
1062
|
+
this.masterItems = masterItems;
|
|
1063
|
+
let newSelectedIdx = -1;
|
|
1064
|
+
let newSelectedItem;
|
|
1065
|
+
if (this.masterItems.length === 0) {
|
|
1066
|
+
// unset select if no elements anymore
|
|
1067
|
+
this.selectedItem = undefined;
|
|
1068
|
+
this.selectedItemIdx = -1;
|
|
1069
|
+
}
|
|
1070
|
+
else if (this.selectedItemIdx >= this.masterItems.length) {
|
|
1071
|
+
// the previous index is to high, reduce it to the maximal possible
|
|
1072
|
+
newSelectedIdx = this.masterItems.length - 1;
|
|
1073
|
+
newSelectedItem = this.masterItems[newSelectedIdx];
|
|
1074
|
+
}
|
|
1075
|
+
else if (this.selectedItemIdx !== -1 &&
|
|
1076
|
+
this.selectedItemIdx < this.masterItems.length) {
|
|
1077
|
+
newSelectedIdx = this.selectedItemIdx;
|
|
1078
|
+
newSelectedItem = this.masterItems[this.selectedItemIdx];
|
|
1079
|
+
}
|
|
1080
|
+
if (newSelectedItem !== undefined &&
|
|
1081
|
+
this.selectedItem !== undefined &&
|
|
1082
|
+
(newSelectedItem.label === this.selectedItem.label ||
|
|
1083
|
+
newSelectedItem.path === this.selectedItem.path)) {
|
|
1084
|
+
// after checking that we are on the same path, set selection
|
|
1085
|
+
this.selectedItem = newSelectedItem;
|
|
1086
|
+
this.selectedItemIdx = newSelectedIdx;
|
|
1087
|
+
}
|
|
1088
|
+
else if (this.masterItems.length > 0) {
|
|
1089
|
+
// pre-select 1st entry if the previous selected element as fallback
|
|
1090
|
+
this.selectedItem = this.masterItems[0];
|
|
1091
|
+
this.selectedItemIdx = 0;
|
|
1092
|
+
}
|
|
1093
|
+
this.changeDetectorRef.markForCheck();
|
|
1094
|
+
}
|
|
1095
|
+
onSelect(item, idx) {
|
|
1096
|
+
this.selectedItem = item;
|
|
1097
|
+
this.selectedItemIdx = idx;
|
|
1098
|
+
}
|
|
1099
|
+
onAddClick() {
|
|
1100
|
+
this.addItem(this.propsPath, createDefaultValue(this.scopedSchema, this.rootSchema))();
|
|
1101
|
+
}
|
|
1102
|
+
onDeleteClick(item) {
|
|
1103
|
+
this.removeItems(this.propsPath, [item])();
|
|
1104
|
+
}
|
|
1105
|
+
mapToProps(state) {
|
|
1106
|
+
const props = mapStateToArrayControlProps(state, this.getOwnProps());
|
|
1107
|
+
return { ...props };
|
|
1108
|
+
}
|
|
1109
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MasterListComponent, deps: [{ token: i1.JsonFormsAngularService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1110
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: MasterListComponent, selector: "jsonforms-list-with-detail-master", usesInheritance: true, ngImport: i0, template: `
|
|
1111
|
+
<mat-sidenav-container
|
|
1112
|
+
[ngStyle]="{ display: hidden ? 'none' : '' }"
|
|
1113
|
+
class="container"
|
|
1114
|
+
>
|
|
1115
|
+
<mat-sidenav mode="side" opened>
|
|
1116
|
+
<mat-nav-list>
|
|
1117
|
+
<mat-list-item *ngIf="masterItems.length === 0">{{
|
|
1118
|
+
translations.noDataMessage
|
|
1119
|
+
}}</mat-list-item>
|
|
1120
|
+
<mat-list-item
|
|
1121
|
+
*ngFor="
|
|
1122
|
+
let item of masterItems;
|
|
1123
|
+
let i = index;
|
|
1124
|
+
trackBy: trackElement
|
|
1125
|
+
"
|
|
1126
|
+
[class.selected]="item === selectedItem"
|
|
1127
|
+
(click)="onSelect(item, i)"
|
|
1128
|
+
(mouseover)="onListItemHover(i)"
|
|
1129
|
+
(mouseout)="onListItemHover(undefined)"
|
|
1130
|
+
>
|
|
1131
|
+
<a matLine>{{ item.label || 'No label set' }}</a>
|
|
1132
|
+
<button
|
|
1133
|
+
mat-icon-button
|
|
1134
|
+
class="button item-button hide"
|
|
1135
|
+
(click)="onDeleteClick(i)"
|
|
1136
|
+
[ngClass]="{ show: highlightedIdx == i }"
|
|
1137
|
+
*ngIf="isEnabled()"
|
|
1138
|
+
>
|
|
1139
|
+
<mat-icon mat-list-icon>delete</mat-icon>
|
|
1140
|
+
</button>
|
|
1141
|
+
</mat-list-item>
|
|
1142
|
+
</mat-nav-list>
|
|
1143
|
+
<button
|
|
1144
|
+
mat-fab
|
|
1145
|
+
color="primary"
|
|
1146
|
+
class="add-button"
|
|
1147
|
+
(click)="onAddClick()"
|
|
1148
|
+
*ngIf="isEnabled()"
|
|
1149
|
+
>
|
|
1150
|
+
<mat-icon [attr.aria-label]="translations.addAriaLabel">add</mat-icon>
|
|
1151
|
+
</button>
|
|
1152
|
+
</mat-sidenav>
|
|
1153
|
+
<mat-sidenav-content class="content">
|
|
1154
|
+
<jsonforms-detail
|
|
1155
|
+
*ngIf="selectedItem"
|
|
1156
|
+
[item]="selectedItem"
|
|
1157
|
+
></jsonforms-detail>
|
|
1158
|
+
</mat-sidenav-content>
|
|
1159
|
+
</mat-sidenav-container>
|
|
1160
|
+
`, isInline: true, styles: ["mat-list-item.selected{background:#0000000a}.container{height:100vh}.content{padding:15px;background-color:#fff}.add-button{float:right;margin-top:.5em;margin-right:.25em}.button{float:right;margin-right:.25em}.item-button{position:absolute;top:0;right:0}.show{display:inline-block}mat-sidenav{width:20%}\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i3$1.MatSidenav, selector: "mat-sidenav", inputs: ["fixedInViewport", "fixedTopGap", "fixedBottomGap"], exportAs: ["matSidenav"] }, { kind: "component", type: i3$1.MatSidenavContainer, selector: "mat-sidenav-container", exportAs: ["matSidenavContainer"] }, { kind: "component", type: i3$1.MatSidenavContent, selector: "mat-sidenav-content" }, { kind: "component", type: i4$4.MatNavList, selector: "mat-nav-list", exportAs: ["matNavList"] }, { kind: "component", type: i4$4.MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["activated"], exportAs: ["matListItem"] }, { kind: "component", type: i5$2.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i5$2.MatFabButton, selector: "button[mat-fab]", inputs: ["disabled", "disableRipple", "color", "tabIndex", "extended"], exportAs: ["matButton"] }, { kind: "component", type: i6$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: JsonFormsDetailComponent, selector: "jsonforms-detail", inputs: ["item"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1161
|
+
}
|
|
1162
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: MasterListComponent, decorators: [{
|
|
1163
|
+
type: Component,
|
|
1164
|
+
args: [{ selector: 'jsonforms-list-with-detail-master', template: `
|
|
1165
|
+
<mat-sidenav-container
|
|
1166
|
+
[ngStyle]="{ display: hidden ? 'none' : '' }"
|
|
1167
|
+
class="container"
|
|
1168
|
+
>
|
|
1169
|
+
<mat-sidenav mode="side" opened>
|
|
1170
|
+
<mat-nav-list>
|
|
1171
|
+
<mat-list-item *ngIf="masterItems.length === 0">{{
|
|
1172
|
+
translations.noDataMessage
|
|
1173
|
+
}}</mat-list-item>
|
|
1174
|
+
<mat-list-item
|
|
1175
|
+
*ngFor="
|
|
1176
|
+
let item of masterItems;
|
|
1177
|
+
let i = index;
|
|
1178
|
+
trackBy: trackElement
|
|
1179
|
+
"
|
|
1180
|
+
[class.selected]="item === selectedItem"
|
|
1181
|
+
(click)="onSelect(item, i)"
|
|
1182
|
+
(mouseover)="onListItemHover(i)"
|
|
1183
|
+
(mouseout)="onListItemHover(undefined)"
|
|
1184
|
+
>
|
|
1185
|
+
<a matLine>{{ item.label || 'No label set' }}</a>
|
|
1186
|
+
<button
|
|
1187
|
+
mat-icon-button
|
|
1188
|
+
class="button item-button hide"
|
|
1189
|
+
(click)="onDeleteClick(i)"
|
|
1190
|
+
[ngClass]="{ show: highlightedIdx == i }"
|
|
1191
|
+
*ngIf="isEnabled()"
|
|
1192
|
+
>
|
|
1193
|
+
<mat-icon mat-list-icon>delete</mat-icon>
|
|
1194
|
+
</button>
|
|
1195
|
+
</mat-list-item>
|
|
1196
|
+
</mat-nav-list>
|
|
1197
|
+
<button
|
|
1198
|
+
mat-fab
|
|
1199
|
+
color="primary"
|
|
1200
|
+
class="add-button"
|
|
1201
|
+
(click)="onAddClick()"
|
|
1202
|
+
*ngIf="isEnabled()"
|
|
1203
|
+
>
|
|
1204
|
+
<mat-icon [attr.aria-label]="translations.addAriaLabel">add</mat-icon>
|
|
1205
|
+
</button>
|
|
1206
|
+
</mat-sidenav>
|
|
1207
|
+
<mat-sidenav-content class="content">
|
|
1208
|
+
<jsonforms-detail
|
|
1209
|
+
*ngIf="selectedItem"
|
|
1210
|
+
[item]="selectedItem"
|
|
1211
|
+
></jsonforms-detail>
|
|
1212
|
+
</mat-sidenav-content>
|
|
1213
|
+
</mat-sidenav-container>
|
|
1214
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: ["mat-list-item.selected{background:#0000000a}.container{height:100vh}.content{padding:15px;background-color:#fff}.add-button{float:right;margin-top:.5em;margin-right:.25em}.button{float:right;margin-right:.25em}.item-button{position:absolute;top:0;right:0}.show{display:inline-block}mat-sidenav{width:20%}\n"] }]
|
|
1215
|
+
}], ctorParameters: function () { return [{ type: i1.JsonFormsAngularService }, { type: i0.ChangeDetectorRef }]; } });
|
|
1216
|
+
const masterDetailTester = rankWith(4, uiTypeIs('ListWithDetail'));
|
|
1217
|
+
|
|
1218
|
+
/*
|
|
1219
|
+
The MIT License
|
|
1220
|
+
|
|
1221
|
+
Copyright (c) 2017-2019 EclipseSource Munich
|
|
1222
|
+
https://github.com/eclipsesource/jsonforms
|
|
1223
|
+
|
|
1224
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1225
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
1226
|
+
in the Software without restriction, including without limitation the rights
|
|
1227
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1228
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
1229
|
+
furnished to do so, subject to the following conditions:
|
|
1230
|
+
|
|
1231
|
+
The above copyright notice and this permission notice shall be included in
|
|
1232
|
+
all copies or substantial portions of the Software.
|
|
1233
|
+
|
|
1234
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1235
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1236
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1237
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1238
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1239
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
1240
|
+
THE SOFTWARE.
|
|
1241
|
+
*/
|
|
1242
|
+
class ObjectControlRenderer extends JsonFormsControlWithDetail {
|
|
1243
|
+
detailUiSchema;
|
|
1244
|
+
constructor(jsonformsService) {
|
|
1245
|
+
super(jsonformsService);
|
|
1246
|
+
}
|
|
1247
|
+
mapAdditionalProps(props) {
|
|
1248
|
+
this.detailUiSchema = findUISchema(props.uischemas, props.schema, props.uischema.scope, props.path, () => {
|
|
1249
|
+
const newSchema = cloneDeep(props.schema);
|
|
1250
|
+
// delete unsupported operators
|
|
1251
|
+
delete newSchema.oneOf;
|
|
1252
|
+
delete newSchema.anyOf;
|
|
1253
|
+
delete newSchema.allOf;
|
|
1254
|
+
return Generate.uiSchema(newSchema, 'Group', undefined, this.rootSchema);
|
|
1255
|
+
}, props.uischema, props.rootSchema);
|
|
1256
|
+
if (isEmpty(props.path)) {
|
|
1257
|
+
this.detailUiSchema.type = 'VerticalLayout';
|
|
1258
|
+
}
|
|
1259
|
+
else {
|
|
1260
|
+
this.detailUiSchema.label = startCase(props.path);
|
|
1261
|
+
}
|
|
1262
|
+
if (!this.isEnabled()) {
|
|
1263
|
+
setReadonly(this.detailUiSchema);
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ObjectControlRenderer, deps: [{ token: i1.JsonFormsAngularService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1267
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ObjectControlRenderer, selector: "ObjectRenderer", usesInheritance: true, ngImport: i0, template: `
|
|
1268
|
+
<mat-card class="object-layout" appearance="outlined">
|
|
1269
|
+
<jsonforms-outlet
|
|
1270
|
+
[uischema]="detailUiSchema"
|
|
1271
|
+
[schema]="scopedSchema"
|
|
1272
|
+
[path]="propsPath"
|
|
1273
|
+
>
|
|
1274
|
+
</jsonforms-outlet>
|
|
1275
|
+
</mat-card>
|
|
1276
|
+
`, isInline: true, styles: [".object-layout{padding:16px}\n"], dependencies: [{ kind: "directive", type: i1.JsonFormsOutlet, selector: "jsonforms-outlet", inputs: ["renderProps"] }, { kind: "component", type: i3$2.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1277
|
+
}
|
|
1278
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ObjectControlRenderer, decorators: [{
|
|
1279
|
+
type: Component,
|
|
1280
|
+
args: [{ selector: 'ObjectRenderer', template: `
|
|
1281
|
+
<mat-card class="object-layout" appearance="outlined">
|
|
1282
|
+
<jsonforms-outlet
|
|
1283
|
+
[uischema]="detailUiSchema"
|
|
1284
|
+
[schema]="scopedSchema"
|
|
1285
|
+
[path]="propsPath"
|
|
1286
|
+
>
|
|
1287
|
+
</jsonforms-outlet>
|
|
1288
|
+
</mat-card>
|
|
1289
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".object-layout{padding:16px}\n"] }]
|
|
1290
|
+
}], ctorParameters: function () { return [{ type: i1.JsonFormsAngularService }]; } });
|
|
1291
|
+
const ObjectControlRendererTester = rankWith(2, isObjectControl);
|
|
1292
|
+
|
|
1293
|
+
/*
|
|
1294
|
+
The MIT License
|
|
1295
|
+
|
|
1296
|
+
Copyright (c) 2017-2019 EclipseSource Munich
|
|
1297
|
+
https://github.com/eclipsesource/jsonforms
|
|
1298
|
+
|
|
1299
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1300
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
1301
|
+
in the Software without restriction, including without limitation the rights
|
|
1302
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1303
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
1304
|
+
furnished to do so, subject to the following conditions:
|
|
1305
|
+
|
|
1306
|
+
The above copyright notice and this permission notice shall be included in
|
|
1307
|
+
all copies or substantial portions of the Software.
|
|
1308
|
+
|
|
1309
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1310
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1311
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1312
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1313
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1314
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
1315
|
+
THE SOFTWARE.
|
|
1316
|
+
*/
|
|
1317
|
+
class TableRenderer extends JsonFormsArrayControl {
|
|
1318
|
+
detailUiSchema;
|
|
1319
|
+
displayedColumns;
|
|
1320
|
+
items;
|
|
1321
|
+
columnsToIgnore = ['array', 'object'];
|
|
1322
|
+
addItem;
|
|
1323
|
+
moveItemUp;
|
|
1324
|
+
moveItemDown;
|
|
1325
|
+
removeItems;
|
|
1326
|
+
translations;
|
|
1327
|
+
constructor(jsonformsService) {
|
|
1328
|
+
super(jsonformsService);
|
|
1329
|
+
}
|
|
1330
|
+
trackElement(index, _element) {
|
|
1331
|
+
return index ? index : null;
|
|
1332
|
+
}
|
|
1333
|
+
mapAdditionalProps(props) {
|
|
1334
|
+
this.items = this.generateCells(props.schema, props.path);
|
|
1335
|
+
this.displayedColumns = this.items.map((item) => item.property);
|
|
1336
|
+
if (this.isEnabled()) {
|
|
1337
|
+
this.displayedColumns.push('action');
|
|
1338
|
+
}
|
|
1339
|
+
this.translations = props.translations;
|
|
1340
|
+
}
|
|
1341
|
+
getProps(index, props) {
|
|
1342
|
+
const rowPath = Paths.compose(props.path, `${index}`);
|
|
1343
|
+
return {
|
|
1344
|
+
schema: props.schema,
|
|
1345
|
+
uischema: props.uischema,
|
|
1346
|
+
path: rowPath,
|
|
1347
|
+
};
|
|
1348
|
+
}
|
|
1349
|
+
remove(index) {
|
|
1350
|
+
this.removeItems(this.propsPath, [index])();
|
|
1351
|
+
}
|
|
1352
|
+
add() {
|
|
1353
|
+
this.addItem(this.propsPath, createDefaultValue(this.scopedSchema, this.rootSchema))();
|
|
1354
|
+
}
|
|
1355
|
+
up(index) {
|
|
1356
|
+
this.moveItemUp(this.propsPath, index)();
|
|
1357
|
+
}
|
|
1358
|
+
down(index) {
|
|
1359
|
+
this.moveItemDown(this.propsPath, index)();
|
|
1360
|
+
}
|
|
1361
|
+
ngOnInit() {
|
|
1362
|
+
super.ngOnInit();
|
|
1363
|
+
const { addItem, removeItems, moveUp, moveDown } = mapDispatchToArrayControlProps(this.jsonFormsService.updateCore.bind(this.jsonFormsService));
|
|
1364
|
+
this.addItem = addItem;
|
|
1365
|
+
this.moveItemUp = moveUp;
|
|
1366
|
+
this.moveItemDown = moveDown;
|
|
1367
|
+
this.removeItems = removeItems;
|
|
1368
|
+
}
|
|
1369
|
+
generateCells = (schema, rowPath) => {
|
|
1370
|
+
if (schema.type === 'object') {
|
|
1371
|
+
return this.getValidColumnProps(schema).map((prop) => {
|
|
1372
|
+
const encProp = encode(prop);
|
|
1373
|
+
const uischema = controlWithoutLabel(`#/properties/${encProp}`);
|
|
1374
|
+
if (!this.isEnabled()) {
|
|
1375
|
+
setReadonly(uischema);
|
|
1376
|
+
}
|
|
1377
|
+
return {
|
|
1378
|
+
property: prop,
|
|
1379
|
+
header: startCase(prop),
|
|
1380
|
+
props: {
|
|
1381
|
+
schema: schema,
|
|
1382
|
+
uischema,
|
|
1383
|
+
path: rowPath,
|
|
1384
|
+
},
|
|
1385
|
+
};
|
|
1386
|
+
});
|
|
1387
|
+
}
|
|
1388
|
+
// needed to correctly render input control for multi attributes
|
|
1389
|
+
return [
|
|
1390
|
+
{
|
|
1391
|
+
property: 'DUMMY',
|
|
1392
|
+
header: this.label,
|
|
1393
|
+
props: {
|
|
1394
|
+
schema: schema,
|
|
1395
|
+
uischema: controlWithoutLabel(`#`),
|
|
1396
|
+
path: rowPath,
|
|
1397
|
+
},
|
|
1398
|
+
},
|
|
1399
|
+
];
|
|
1400
|
+
};
|
|
1401
|
+
getValidColumnProps = (scopedSchema) => {
|
|
1402
|
+
if (scopedSchema.type === 'object') {
|
|
1403
|
+
return Object.keys(scopedSchema.properties).filter((prop) => {
|
|
1404
|
+
const types = deriveTypes(scopedSchema.properties[prop]);
|
|
1405
|
+
if (types.length > 1) {
|
|
1406
|
+
return false;
|
|
1407
|
+
}
|
|
1408
|
+
return this.columnsToIgnore.indexOf(types[0]) === -1;
|
|
1409
|
+
});
|
|
1410
|
+
}
|
|
1411
|
+
// primitives
|
|
1412
|
+
return [''];
|
|
1413
|
+
};
|
|
1414
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TableRenderer, deps: [{ token: i1.JsonFormsAngularService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1415
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TableRenderer, selector: "TableRenderer", usesInheritance: true, ngImport: i0, template: `
|
|
1416
|
+
<table
|
|
1417
|
+
mat-table
|
|
1418
|
+
[dataSource]="data"
|
|
1419
|
+
class="mat-elevation-z8"
|
|
1420
|
+
[trackBy]="trackElement"
|
|
1421
|
+
>
|
|
1422
|
+
<ng-container matColumnDef="action">
|
|
1423
|
+
<tr>
|
|
1424
|
+
<th mat-header-cell *matHeaderCellDef>
|
|
1425
|
+
<button
|
|
1426
|
+
mat-button
|
|
1427
|
+
color="primary"
|
|
1428
|
+
(click)="add()"
|
|
1429
|
+
[disabled]="!isEnabled()"
|
|
1430
|
+
[matTooltip]="translations.addTooltip"
|
|
1431
|
+
>
|
|
1432
|
+
<mat-icon>add</mat-icon>
|
|
1433
|
+
</button>
|
|
1434
|
+
</th>
|
|
1435
|
+
</tr>
|
|
1436
|
+
<tr>
|
|
1437
|
+
<td
|
|
1438
|
+
mat-cell
|
|
1439
|
+
*matCellDef="
|
|
1440
|
+
let row;
|
|
1441
|
+
let i = index;
|
|
1442
|
+
let first = first;
|
|
1443
|
+
let last = last
|
|
1444
|
+
"
|
|
1445
|
+
>
|
|
1446
|
+
<button
|
|
1447
|
+
*ngIf="uischema?.options?.showSortButtons"
|
|
1448
|
+
class="item-up"
|
|
1449
|
+
mat-button
|
|
1450
|
+
[disabled]="first"
|
|
1451
|
+
(click)="up(i)"
|
|
1452
|
+
[matTooltip]="translations.upAriaLabel"
|
|
1453
|
+
matTooltipPosition="right"
|
|
1454
|
+
>
|
|
1455
|
+
<mat-icon>arrow_upward</mat-icon>
|
|
1456
|
+
</button>
|
|
1457
|
+
<button
|
|
1458
|
+
*ngIf="uischema?.options?.showSortButtons"
|
|
1459
|
+
class="item-down"
|
|
1460
|
+
mat-button
|
|
1461
|
+
[disabled]="last"
|
|
1462
|
+
(click)="down(i)"
|
|
1463
|
+
[matTooltip]="translations.downAriaLabel"
|
|
1464
|
+
matTooltipPosition="right"
|
|
1465
|
+
>
|
|
1466
|
+
<mat-icon>arrow_downward</mat-icon>
|
|
1467
|
+
</button>
|
|
1468
|
+
<button
|
|
1469
|
+
mat-button
|
|
1470
|
+
color="warn"
|
|
1471
|
+
(click)="remove(i)"
|
|
1472
|
+
[disabled]="!isEnabled()"
|
|
1473
|
+
matTooltipPosition="right"
|
|
1474
|
+
[matTooltip]="translations.removeTooltip"
|
|
1475
|
+
>
|
|
1476
|
+
<mat-icon>delete</mat-icon>
|
|
1477
|
+
</button>
|
|
1478
|
+
</td>
|
|
1479
|
+
</tr>
|
|
1480
|
+
|
|
1481
|
+
<tr></tr
|
|
1482
|
+
></ng-container>
|
|
1483
|
+
|
|
1484
|
+
<ng-container
|
|
1485
|
+
*ngFor="let item of items"
|
|
1486
|
+
matColumnDef="{{ item.property }}"
|
|
1487
|
+
>
|
|
1488
|
+
<th mat-header-cell *matHeaderCellDef>{{ item.header }}</th>
|
|
1489
|
+
<td mat-cell *matCellDef="let index = index">
|
|
1490
|
+
<jsonforms-outlet
|
|
1491
|
+
[renderProps]="getProps(index, item.props)"
|
|
1492
|
+
></jsonforms-outlet>
|
|
1493
|
+
</td>
|
|
1494
|
+
</ng-container>
|
|
1495
|
+
|
|
1496
|
+
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
|
1497
|
+
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
|
|
1498
|
+
</table>
|
|
1499
|
+
`, isInline: true, styles: ["table{width:100%}\n", ".cdk-column-action{width:15%}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.JsonFormsOutlet, selector: "jsonforms-outlet", inputs: ["renderProps"] }, { kind: "component", type: i5$2.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i6$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i5$3.MatTable, selector: "mat-table, table[mat-table]", exportAs: ["matTable"] }, { kind: "directive", type: i5$3.MatHeaderCellDef, selector: "[matHeaderCellDef]" }, { kind: "directive", type: i5$3.MatHeaderRowDef, selector: "[matHeaderRowDef]", inputs: ["matHeaderRowDef", "matHeaderRowDefSticky"] }, { kind: "directive", type: i5$3.MatColumnDef, selector: "[matColumnDef]", inputs: ["sticky", "matColumnDef"] }, { kind: "directive", type: i5$3.MatCellDef, selector: "[matCellDef]" }, { kind: "directive", type: i5$3.MatRowDef, selector: "[matRowDef]", inputs: ["matRowDefColumns", "matRowDefWhen"] }, { kind: "directive", type: i5$3.MatHeaderCell, selector: "mat-header-cell, th[mat-header-cell]" }, { kind: "directive", type: i5$3.MatCell, selector: "mat-cell, td[mat-cell]" }, { kind: "component", type: i5$3.MatHeaderRow, selector: "mat-header-row, tr[mat-header-row]", exportAs: ["matHeaderRow"] }, { kind: "component", type: i5$3.MatRow, selector: "mat-row, tr[mat-row]", exportAs: ["matRow"] }, { kind: "directive", type: i6$2.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }] });
|
|
1500
|
+
}
|
|
1501
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TableRenderer, decorators: [{
|
|
1502
|
+
type: Component,
|
|
1503
|
+
args: [{ selector: 'TableRenderer', template: `
|
|
1504
|
+
<table
|
|
1505
|
+
mat-table
|
|
1506
|
+
[dataSource]="data"
|
|
1507
|
+
class="mat-elevation-z8"
|
|
1508
|
+
[trackBy]="trackElement"
|
|
1509
|
+
>
|
|
1510
|
+
<ng-container matColumnDef="action">
|
|
1511
|
+
<tr>
|
|
1512
|
+
<th mat-header-cell *matHeaderCellDef>
|
|
1513
|
+
<button
|
|
1514
|
+
mat-button
|
|
1515
|
+
color="primary"
|
|
1516
|
+
(click)="add()"
|
|
1517
|
+
[disabled]="!isEnabled()"
|
|
1518
|
+
[matTooltip]="translations.addTooltip"
|
|
1519
|
+
>
|
|
1520
|
+
<mat-icon>add</mat-icon>
|
|
1521
|
+
</button>
|
|
1522
|
+
</th>
|
|
1523
|
+
</tr>
|
|
1524
|
+
<tr>
|
|
1525
|
+
<td
|
|
1526
|
+
mat-cell
|
|
1527
|
+
*matCellDef="
|
|
1528
|
+
let row;
|
|
1529
|
+
let i = index;
|
|
1530
|
+
let first = first;
|
|
1531
|
+
let last = last
|
|
1532
|
+
"
|
|
1533
|
+
>
|
|
1534
|
+
<button
|
|
1535
|
+
*ngIf="uischema?.options?.showSortButtons"
|
|
1536
|
+
class="item-up"
|
|
1537
|
+
mat-button
|
|
1538
|
+
[disabled]="first"
|
|
1539
|
+
(click)="up(i)"
|
|
1540
|
+
[matTooltip]="translations.upAriaLabel"
|
|
1541
|
+
matTooltipPosition="right"
|
|
1542
|
+
>
|
|
1543
|
+
<mat-icon>arrow_upward</mat-icon>
|
|
1544
|
+
</button>
|
|
1545
|
+
<button
|
|
1546
|
+
*ngIf="uischema?.options?.showSortButtons"
|
|
1547
|
+
class="item-down"
|
|
1548
|
+
mat-button
|
|
1549
|
+
[disabled]="last"
|
|
1550
|
+
(click)="down(i)"
|
|
1551
|
+
[matTooltip]="translations.downAriaLabel"
|
|
1552
|
+
matTooltipPosition="right"
|
|
1553
|
+
>
|
|
1554
|
+
<mat-icon>arrow_downward</mat-icon>
|
|
1555
|
+
</button>
|
|
1556
|
+
<button
|
|
1557
|
+
mat-button
|
|
1558
|
+
color="warn"
|
|
1559
|
+
(click)="remove(i)"
|
|
1560
|
+
[disabled]="!isEnabled()"
|
|
1561
|
+
matTooltipPosition="right"
|
|
1562
|
+
[matTooltip]="translations.removeTooltip"
|
|
1563
|
+
>
|
|
1564
|
+
<mat-icon>delete</mat-icon>
|
|
1565
|
+
</button>
|
|
1566
|
+
</td>
|
|
1567
|
+
</tr>
|
|
1568
|
+
|
|
1569
|
+
<tr></tr
|
|
1570
|
+
></ng-container>
|
|
1571
|
+
|
|
1572
|
+
<ng-container
|
|
1573
|
+
*ngFor="let item of items"
|
|
1574
|
+
matColumnDef="{{ item.property }}"
|
|
1575
|
+
>
|
|
1576
|
+
<th mat-header-cell *matHeaderCellDef>{{ item.header }}</th>
|
|
1577
|
+
<td mat-cell *matCellDef="let index = index">
|
|
1578
|
+
<jsonforms-outlet
|
|
1579
|
+
[renderProps]="getProps(index, item.props)"
|
|
1580
|
+
></jsonforms-outlet>
|
|
1581
|
+
</td>
|
|
1582
|
+
</ng-container>
|
|
1583
|
+
|
|
1584
|
+
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
|
1585
|
+
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr>
|
|
1586
|
+
</table>
|
|
1587
|
+
`, styles: ["table{width:100%}\n", ".cdk-column-action{width:15%}\n"] }]
|
|
1588
|
+
}], ctorParameters: function () { return [{ type: i1.JsonFormsAngularService }]; } });
|
|
1589
|
+
const TableRendererTester = rankWith(3, or(isObjectArrayControl, isPrimitiveArrayControl));
|
|
1590
|
+
const controlWithoutLabel = (scope) => ({
|
|
1591
|
+
type: 'Control',
|
|
1592
|
+
scope: scope,
|
|
1593
|
+
label: false,
|
|
1594
|
+
});
|
|
1595
|
+
|
|
1596
|
+
/*
|
|
1597
|
+
The MIT License
|
|
1598
|
+
|
|
1599
|
+
Copyright (c) 2017-2019 EclipseSource Munich
|
|
1600
|
+
https://github.com/eclipsesource/jsonforms
|
|
1601
|
+
|
|
1602
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1603
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
1604
|
+
in the Software without restriction, including without limitation the rights
|
|
1605
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1606
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
1607
|
+
furnished to do so, subject to the following conditions:
|
|
1608
|
+
|
|
1609
|
+
The above copyright notice and this permission notice shall be included in
|
|
1610
|
+
all copies or substantial portions of the Software.
|
|
1611
|
+
|
|
1612
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1613
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1614
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1615
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1616
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1617
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
1618
|
+
THE SOFTWARE.
|
|
1619
|
+
*/
|
|
1620
|
+
class CategorizationTabLayoutRenderer extends JsonFormsBaseRenderer {
|
|
1621
|
+
jsonFormsService;
|
|
1622
|
+
hidden;
|
|
1623
|
+
visibleCategories;
|
|
1624
|
+
subscription;
|
|
1625
|
+
categoryLabels;
|
|
1626
|
+
constructor(jsonFormsService) {
|
|
1627
|
+
super();
|
|
1628
|
+
this.jsonFormsService = jsonFormsService;
|
|
1629
|
+
}
|
|
1630
|
+
ngOnInit() {
|
|
1631
|
+
this.subscription = this.jsonFormsService.$state.subscribe({
|
|
1632
|
+
next: (state) => {
|
|
1633
|
+
const props = mapStateToLayoutProps(state, this.getOwnProps());
|
|
1634
|
+
this.hidden = !props.visible;
|
|
1635
|
+
this.visibleCategories = this.uischema.elements.filter((category) => isVisible(category, props.data, undefined, getAjv(state)));
|
|
1636
|
+
this.categoryLabels = this.visibleCategories.map((element) => deriveLabelForUISchemaElement(element, state.jsonforms.i18n?.translate ??
|
|
1637
|
+
defaultJsonFormsI18nState.translate));
|
|
1638
|
+
},
|
|
1639
|
+
});
|
|
1640
|
+
}
|
|
1641
|
+
ngOnDestroy() {
|
|
1642
|
+
if (this.subscription) {
|
|
1643
|
+
this.subscription.unsubscribe();
|
|
1644
|
+
}
|
|
1645
|
+
}
|
|
1646
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CategorizationTabLayoutRenderer, deps: [{ token: i1.JsonFormsAngularService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1647
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: CategorizationTabLayoutRenderer, selector: "jsonforms-categorization-layout", usesInheritance: true, ngImport: i0, template: `
|
|
1648
|
+
<mat-tab-group
|
|
1649
|
+
[ngStyle]="{ display: hidden ? 'none' : '' }"
|
|
1650
|
+
dynamicHeight="true"
|
|
1651
|
+
>
|
|
1652
|
+
<mat-tab
|
|
1653
|
+
*ngFor="let category of visibleCategories; let i = index"
|
|
1654
|
+
[label]="categoryLabels[i]"
|
|
1655
|
+
>
|
|
1656
|
+
<div *ngFor="let element of category.elements">
|
|
1657
|
+
<jsonforms-outlet
|
|
1658
|
+
[uischema]="element"
|
|
1659
|
+
[path]="path"
|
|
1660
|
+
[schema]="schema"
|
|
1661
|
+
></jsonforms-outlet>
|
|
1662
|
+
</div>
|
|
1663
|
+
</mat-tab>
|
|
1664
|
+
</mat-tab-group>
|
|
1665
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i1.JsonFormsOutlet, selector: "jsonforms-outlet", inputs: ["renderProps"] }, { kind: "component", type: i3$3.MatTab, selector: "mat-tab", inputs: ["disabled"], exportAs: ["matTab"] }, { kind: "component", type: i3$3.MatTabGroup, selector: "mat-tab-group", inputs: ["color", "disableRipple", "fitInkBarToContent", "mat-stretch-tabs"], exportAs: ["matTabGroup"] }] });
|
|
1666
|
+
}
|
|
1667
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CategorizationTabLayoutRenderer, decorators: [{
|
|
1668
|
+
type: Component,
|
|
1669
|
+
args: [{
|
|
1670
|
+
selector: 'jsonforms-categorization-layout',
|
|
1671
|
+
template: `
|
|
1672
|
+
<mat-tab-group
|
|
1673
|
+
[ngStyle]="{ display: hidden ? 'none' : '' }"
|
|
1674
|
+
dynamicHeight="true"
|
|
1675
|
+
>
|
|
1676
|
+
<mat-tab
|
|
1677
|
+
*ngFor="let category of visibleCategories; let i = index"
|
|
1678
|
+
[label]="categoryLabels[i]"
|
|
1679
|
+
>
|
|
1680
|
+
<div *ngFor="let element of category.elements">
|
|
1681
|
+
<jsonforms-outlet
|
|
1682
|
+
[uischema]="element"
|
|
1683
|
+
[path]="path"
|
|
1684
|
+
[schema]="schema"
|
|
1685
|
+
></jsonforms-outlet>
|
|
1686
|
+
</div>
|
|
1687
|
+
</mat-tab>
|
|
1688
|
+
</mat-tab-group>
|
|
1689
|
+
`,
|
|
1690
|
+
}]
|
|
1691
|
+
}], ctorParameters: function () { return [{ type: i1.JsonFormsAngularService }]; } });
|
|
1692
|
+
const categorizationTester = rankWith(2, and(uiTypeIs('Categorization'), categorizationHasCategory));
|
|
1693
|
+
|
|
1694
|
+
/*
|
|
1695
|
+
The MIT License
|
|
1696
|
+
|
|
1697
|
+
Copyright (c) 2017-2019 EclipseSource Munich
|
|
1698
|
+
https://github.com/eclipsesource/jsonforms
|
|
1699
|
+
|
|
1700
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1701
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
1702
|
+
in the Software without restriction, including without limitation the rights
|
|
1703
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1704
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
1705
|
+
furnished to do so, subject to the following conditions:
|
|
1706
|
+
|
|
1707
|
+
The above copyright notice and this permission notice shall be included in
|
|
1708
|
+
all copies or substantial portions of the Software.
|
|
1709
|
+
|
|
1710
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1711
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1712
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1713
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1714
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1715
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
1716
|
+
THE SOFTWARE.
|
|
1717
|
+
*/
|
|
1718
|
+
class LayoutRenderer extends JsonFormsBaseRenderer {
|
|
1719
|
+
jsonFormsService;
|
|
1720
|
+
changeDetectionRef;
|
|
1721
|
+
hidden;
|
|
1722
|
+
label;
|
|
1723
|
+
subscription;
|
|
1724
|
+
constructor(jsonFormsService, changeDetectionRef) {
|
|
1725
|
+
super();
|
|
1726
|
+
this.jsonFormsService = jsonFormsService;
|
|
1727
|
+
this.changeDetectionRef = changeDetectionRef;
|
|
1728
|
+
}
|
|
1729
|
+
ngOnInit() {
|
|
1730
|
+
this.subscription = this.jsonFormsService.$state.subscribe({
|
|
1731
|
+
next: (state) => {
|
|
1732
|
+
const props = mapStateToLayoutProps(state, this.getOwnProps());
|
|
1733
|
+
this.label = props.label;
|
|
1734
|
+
this.hidden = !props.visible;
|
|
1735
|
+
this.changeDetectionRef.markForCheck();
|
|
1736
|
+
},
|
|
1737
|
+
});
|
|
1738
|
+
}
|
|
1739
|
+
ngOnDestroy() {
|
|
1740
|
+
if (this.subscription) {
|
|
1741
|
+
this.subscription.unsubscribe();
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
trackElement(_index, renderProp) {
|
|
1745
|
+
return renderProp
|
|
1746
|
+
? renderProp.path + JSON.stringify(renderProp.uischema)
|
|
1747
|
+
: null;
|
|
1748
|
+
}
|
|
1749
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LayoutRenderer, deps: [{ token: i1.JsonFormsAngularService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1750
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: LayoutRenderer, selector: "ng-component", usesInheritance: true, ngImport: i0, template: '', isInline: true });
|
|
1751
|
+
}
|
|
1752
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LayoutRenderer, decorators: [{
|
|
1753
|
+
type: Component,
|
|
1754
|
+
args: [{
|
|
1755
|
+
template: '',
|
|
1756
|
+
}]
|
|
1757
|
+
}], ctorParameters: function () { return [{ type: i1.JsonFormsAngularService }, { type: i0.ChangeDetectorRef }]; } });
|
|
1758
|
+
class LayoutChildrenRenderPropsPipe {
|
|
1759
|
+
transform(uischema, schema, path) {
|
|
1760
|
+
const elements = (uischema.elements || []).map((el) => ({
|
|
1761
|
+
uischema: el,
|
|
1762
|
+
schema: schema,
|
|
1763
|
+
path: path,
|
|
1764
|
+
}));
|
|
1765
|
+
return elements;
|
|
1766
|
+
}
|
|
1767
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LayoutChildrenRenderPropsPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
1768
|
+
static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: LayoutChildrenRenderPropsPipe, name: "layoutChildrenRenderProps" });
|
|
1769
|
+
}
|
|
1770
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LayoutChildrenRenderPropsPipe, decorators: [{
|
|
1771
|
+
type: Pipe,
|
|
1772
|
+
args: [{ name: 'layoutChildrenRenderProps' }]
|
|
1773
|
+
}] });
|
|
1774
|
+
|
|
1775
|
+
/*
|
|
1776
|
+
The MIT License
|
|
1777
|
+
|
|
1778
|
+
Copyright (c) 2017-2019 EclipseSource Munich
|
|
1779
|
+
https://github.com/eclipsesource/jsonforms
|
|
1780
|
+
|
|
1781
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1782
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
1783
|
+
in the Software without restriction, including without limitation the rights
|
|
1784
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1785
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
1786
|
+
furnished to do so, subject to the following conditions:
|
|
1787
|
+
|
|
1788
|
+
The above copyright notice and this permission notice shall be included in
|
|
1789
|
+
all copies or substantial portions of the Software.
|
|
1790
|
+
|
|
1791
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1792
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1793
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1794
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1795
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1796
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
1797
|
+
THE SOFTWARE.
|
|
1798
|
+
*/
|
|
1799
|
+
class GroupLayoutRenderer extends LayoutRenderer {
|
|
1800
|
+
constructor(jsonFormsService, changeDetectionRef) {
|
|
1801
|
+
super(jsonFormsService, changeDetectionRef);
|
|
1802
|
+
}
|
|
1803
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GroupLayoutRenderer, deps: [{ token: i1.JsonFormsAngularService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1804
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: GroupLayoutRenderer, selector: "GroupLayoutRenderer", usesInheritance: true, ngImport: i0, template: `
|
|
1805
|
+
<mat-card
|
|
1806
|
+
[ngStyle]="{ display: hidden ? 'none' : '' }"
|
|
1807
|
+
appearance="outlined"
|
|
1808
|
+
class="group-layout"
|
|
1809
|
+
>
|
|
1810
|
+
<mat-card-title class="mat-headline-6">{{ label }}</mat-card-title>
|
|
1811
|
+
<div
|
|
1812
|
+
*ngFor="
|
|
1813
|
+
let props of uischema | layoutChildrenRenderProps : schema : path;
|
|
1814
|
+
trackBy: trackElement
|
|
1815
|
+
"
|
|
1816
|
+
>
|
|
1817
|
+
<jsonforms-outlet [renderProps]="props"></jsonforms-outlet>
|
|
1818
|
+
</div>
|
|
1819
|
+
</mat-card>
|
|
1820
|
+
`, isInline: true, styles: [".group-layout{display:flex;flex-direction:column;gap:16px;padding:16px}.group-layout>div{flex:1 1 auto}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i1.JsonFormsOutlet, selector: "jsonforms-outlet", inputs: ["renderProps"] }, { kind: "component", type: i3$2.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i3$2.MatCardTitle, selector: "mat-card-title, [mat-card-title], [matCardTitle]" }, { kind: "pipe", type: LayoutChildrenRenderPropsPipe, name: "layoutChildrenRenderProps" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1821
|
+
}
|
|
1822
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: GroupLayoutRenderer, decorators: [{
|
|
1823
|
+
type: Component,
|
|
1824
|
+
args: [{ selector: 'GroupLayoutRenderer', template: `
|
|
1825
|
+
<mat-card
|
|
1826
|
+
[ngStyle]="{ display: hidden ? 'none' : '' }"
|
|
1827
|
+
appearance="outlined"
|
|
1828
|
+
class="group-layout"
|
|
1829
|
+
>
|
|
1830
|
+
<mat-card-title class="mat-headline-6">{{ label }}</mat-card-title>
|
|
1831
|
+
<div
|
|
1832
|
+
*ngFor="
|
|
1833
|
+
let props of uischema | layoutChildrenRenderProps : schema : path;
|
|
1834
|
+
trackBy: trackElement
|
|
1835
|
+
"
|
|
1836
|
+
>
|
|
1837
|
+
<jsonforms-outlet [renderProps]="props"></jsonforms-outlet>
|
|
1838
|
+
</div>
|
|
1839
|
+
</mat-card>
|
|
1840
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".group-layout{display:flex;flex-direction:column;gap:16px;padding:16px}.group-layout>div{flex:1 1 auto}\n"] }]
|
|
1841
|
+
}], ctorParameters: function () { return [{ type: i1.JsonFormsAngularService }, { type: i0.ChangeDetectorRef }]; } });
|
|
1842
|
+
const groupLayoutTester = rankWith(1, uiTypeIs('Group'));
|
|
1843
|
+
|
|
1844
|
+
/*
|
|
1845
|
+
The MIT License
|
|
1846
|
+
|
|
1847
|
+
Copyright (c) 2017-2019 EclipseSource Munich
|
|
1848
|
+
https://github.com/eclipsesource/jsonforms
|
|
1849
|
+
|
|
1850
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1851
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
1852
|
+
in the Software without restriction, including without limitation the rights
|
|
1853
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1854
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
1855
|
+
furnished to do so, subject to the following conditions:
|
|
1856
|
+
|
|
1857
|
+
The above copyright notice and this permission notice shall be included in
|
|
1858
|
+
all copies or substantial portions of the Software.
|
|
1859
|
+
|
|
1860
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1861
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1862
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1863
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1864
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1865
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
1866
|
+
THE SOFTWARE.
|
|
1867
|
+
*/
|
|
1868
|
+
class HorizontalLayoutRenderer extends LayoutRenderer {
|
|
1869
|
+
constructor(jsonFormsService, changeDetectionRef) {
|
|
1870
|
+
super(jsonFormsService, changeDetectionRef);
|
|
1871
|
+
}
|
|
1872
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HorizontalLayoutRenderer, deps: [{ token: i1.JsonFormsAngularService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1873
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: HorizontalLayoutRenderer, selector: "HorizontalLayoutRenderer", usesInheritance: true, ngImport: i0, template: `
|
|
1874
|
+
<div
|
|
1875
|
+
[ngStyle]="{ display: hidden ? 'none' : '' }"
|
|
1876
|
+
class="horizontal-layout"
|
|
1877
|
+
>
|
|
1878
|
+
<div
|
|
1879
|
+
*ngFor="
|
|
1880
|
+
let props of uischema | layoutChildrenRenderProps : schema : path;
|
|
1881
|
+
trackBy: trackElement
|
|
1882
|
+
"
|
|
1883
|
+
>
|
|
1884
|
+
<jsonforms-outlet [renderProps]="props"></jsonforms-outlet>
|
|
1885
|
+
</div>
|
|
1886
|
+
</div>
|
|
1887
|
+
`, isInline: true, styles: [".horizontal-layout{display:flex;gap:16px;flex-flow:row wrap;align-items:flex-start;place-content:flex-start center}.horizontal-layout>div{flex:1 1 auto}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i1.JsonFormsOutlet, selector: "jsonforms-outlet", inputs: ["renderProps"] }, { kind: "pipe", type: LayoutChildrenRenderPropsPipe, name: "layoutChildrenRenderProps" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1888
|
+
}
|
|
1889
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HorizontalLayoutRenderer, decorators: [{
|
|
1890
|
+
type: Component,
|
|
1891
|
+
args: [{ selector: 'HorizontalLayoutRenderer', template: `
|
|
1892
|
+
<div
|
|
1893
|
+
[ngStyle]="{ display: hidden ? 'none' : '' }"
|
|
1894
|
+
class="horizontal-layout"
|
|
1895
|
+
>
|
|
1896
|
+
<div
|
|
1897
|
+
*ngFor="
|
|
1898
|
+
let props of uischema | layoutChildrenRenderProps : schema : path;
|
|
1899
|
+
trackBy: trackElement
|
|
1900
|
+
"
|
|
1901
|
+
>
|
|
1902
|
+
<jsonforms-outlet [renderProps]="props"></jsonforms-outlet>
|
|
1903
|
+
</div>
|
|
1904
|
+
</div>
|
|
1905
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".horizontal-layout{display:flex;gap:16px;flex-flow:row wrap;align-items:flex-start;place-content:flex-start center}.horizontal-layout>div{flex:1 1 auto}\n"] }]
|
|
1906
|
+
}], ctorParameters: function () { return [{ type: i1.JsonFormsAngularService }, { type: i0.ChangeDetectorRef }]; } });
|
|
1907
|
+
const horizontalLayoutTester = rankWith(1, uiTypeIs('HorizontalLayout'));
|
|
1908
|
+
|
|
1909
|
+
/*
|
|
1910
|
+
The MIT License
|
|
1911
|
+
|
|
1912
|
+
Copyright (c) 2017-2019 EclipseSource Munich
|
|
1913
|
+
https://github.com/eclipsesource/jsonforms
|
|
1914
|
+
|
|
1915
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1916
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
1917
|
+
in the Software without restriction, including without limitation the rights
|
|
1918
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1919
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
1920
|
+
furnished to do so, subject to the following conditions:
|
|
1921
|
+
|
|
1922
|
+
The above copyright notice and this permission notice shall be included in
|
|
1923
|
+
all copies or substantial portions of the Software.
|
|
1924
|
+
|
|
1925
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1926
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1927
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1928
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1929
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1930
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
1931
|
+
THE SOFTWARE.
|
|
1932
|
+
*/
|
|
1933
|
+
class VerticalLayoutRenderer extends LayoutRenderer {
|
|
1934
|
+
constructor(jsonFormsService, changeDetectionRef) {
|
|
1935
|
+
super(jsonFormsService, changeDetectionRef);
|
|
1936
|
+
}
|
|
1937
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: VerticalLayoutRenderer, deps: [{ token: i1.JsonFormsAngularService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1938
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: VerticalLayoutRenderer, selector: "VerticalLayoutRenderer", usesInheritance: true, ngImport: i0, template: `
|
|
1939
|
+
<div [ngStyle]="{ display: hidden ? 'none' : '' }" class="vertical-layout">
|
|
1940
|
+
<div
|
|
1941
|
+
*ngFor="
|
|
1942
|
+
let props of uischema | layoutChildrenRenderProps : schema : path;
|
|
1943
|
+
trackBy: trackElement
|
|
1944
|
+
"
|
|
1945
|
+
>
|
|
1946
|
+
<jsonforms-outlet [renderProps]="props"></jsonforms-outlet>
|
|
1947
|
+
</div>
|
|
1948
|
+
</div>
|
|
1949
|
+
`, isInline: true, styles: [".vertical-layout{display:flex;flex-direction:column;gap:16px}.vertical-layout>div{flex:1 1 auto}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i1.JsonFormsOutlet, selector: "jsonforms-outlet", inputs: ["renderProps"] }, { kind: "pipe", type: LayoutChildrenRenderPropsPipe, name: "layoutChildrenRenderProps" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1950
|
+
}
|
|
1951
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: VerticalLayoutRenderer, decorators: [{
|
|
1952
|
+
type: Component,
|
|
1953
|
+
args: [{ selector: 'VerticalLayoutRenderer', template: `
|
|
1954
|
+
<div [ngStyle]="{ display: hidden ? 'none' : '' }" class="vertical-layout">
|
|
1955
|
+
<div
|
|
1956
|
+
*ngFor="
|
|
1957
|
+
let props of uischema | layoutChildrenRenderProps : schema : path;
|
|
1958
|
+
trackBy: trackElement
|
|
1959
|
+
"
|
|
1960
|
+
>
|
|
1961
|
+
<jsonforms-outlet [renderProps]="props"></jsonforms-outlet>
|
|
1962
|
+
</div>
|
|
1963
|
+
</div>
|
|
1964
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".vertical-layout{display:flex;flex-direction:column;gap:16px}.vertical-layout>div{flex:1 1 auto}\n"] }]
|
|
1965
|
+
}], ctorParameters: function () { return [{ type: i1.JsonFormsAngularService }, { type: i0.ChangeDetectorRef }]; } });
|
|
1966
|
+
const verticalLayoutTester = rankWith(1, uiTypeIs('VerticalLayout'));
|
|
1967
|
+
|
|
1968
|
+
/*
|
|
1969
|
+
The MIT License
|
|
1970
|
+
|
|
1971
|
+
Copyright (c) 2017-2020 EclipseSource Munich
|
|
1972
|
+
https://github.com/eclipsesource/jsonforms
|
|
1973
|
+
|
|
1974
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1975
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
1976
|
+
in the Software without restriction, including without limitation the rights
|
|
1977
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1978
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
1979
|
+
furnished to do so, subject to the following conditions:
|
|
1980
|
+
|
|
1981
|
+
The above copyright notice and this permission notice shall be included in
|
|
1982
|
+
all copies or substantial portions of the Software.
|
|
1983
|
+
|
|
1984
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1985
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1986
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1987
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1988
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1989
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
1990
|
+
THE SOFTWARE.
|
|
1991
|
+
*/
|
|
1992
|
+
class ArrayLayoutRenderer extends JsonFormsAbstractControl {
|
|
1993
|
+
noData;
|
|
1994
|
+
translations;
|
|
1995
|
+
addItem;
|
|
1996
|
+
moveItemUp;
|
|
1997
|
+
moveItemDown;
|
|
1998
|
+
removeItems;
|
|
1999
|
+
uischemas;
|
|
2000
|
+
constructor(jsonFormsService) {
|
|
2001
|
+
super(jsonFormsService);
|
|
2002
|
+
}
|
|
2003
|
+
mapToProps(state) {
|
|
2004
|
+
const props = mapStateToArrayLayoutProps(state, this.getOwnProps());
|
|
2005
|
+
return { ...props };
|
|
2006
|
+
}
|
|
2007
|
+
remove(index) {
|
|
2008
|
+
this.removeItems(this.propsPath, [index])();
|
|
2009
|
+
}
|
|
2010
|
+
add() {
|
|
2011
|
+
this.addItem(this.propsPath, createDefaultValue(this.scopedSchema, this.rootSchema))();
|
|
2012
|
+
}
|
|
2013
|
+
up(index) {
|
|
2014
|
+
this.moveItemUp(this.propsPath, index)();
|
|
2015
|
+
}
|
|
2016
|
+
down(index) {
|
|
2017
|
+
this.moveItemDown(this.propsPath, index)();
|
|
2018
|
+
}
|
|
2019
|
+
ngOnInit() {
|
|
2020
|
+
super.ngOnInit();
|
|
2021
|
+
const { addItem, removeItems, moveUp, moveDown } = mapDispatchToArrayControlProps(this.jsonFormsService.updateCore.bind(this.jsonFormsService));
|
|
2022
|
+
this.addItem = addItem;
|
|
2023
|
+
this.moveItemUp = moveUp;
|
|
2024
|
+
this.moveItemDown = moveDown;
|
|
2025
|
+
this.removeItems = removeItems;
|
|
2026
|
+
}
|
|
2027
|
+
mapAdditionalProps(props) {
|
|
2028
|
+
this.translations = props.translations;
|
|
2029
|
+
this.noData = !props.data || props.data === 0;
|
|
2030
|
+
this.uischemas = props.uischemas;
|
|
2031
|
+
}
|
|
2032
|
+
getProps(index) {
|
|
2033
|
+
const uischema = findUISchema(this.uischemas, this.scopedSchema, this.uischema.scope, this.propsPath, undefined, this.uischema, this.rootSchema);
|
|
2034
|
+
if (this.isEnabled()) {
|
|
2035
|
+
unsetReadonly(uischema);
|
|
2036
|
+
}
|
|
2037
|
+
else {
|
|
2038
|
+
setReadonly(uischema);
|
|
2039
|
+
}
|
|
2040
|
+
return {
|
|
2041
|
+
schema: this.scopedSchema,
|
|
2042
|
+
path: Paths.compose(this.propsPath, `${index}`),
|
|
2043
|
+
uischema,
|
|
2044
|
+
};
|
|
2045
|
+
}
|
|
2046
|
+
trackByFn(index) {
|
|
2047
|
+
return index;
|
|
2048
|
+
}
|
|
2049
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ArrayLayoutRenderer, deps: [{ token: i1.JsonFormsAngularService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2050
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: ArrayLayoutRenderer, selector: "app-array-layout-renderer", usesInheritance: true, ngImport: i0, template: `
|
|
2051
|
+
<div [ngStyle]="{ display: hidden ? 'none' : '' }" class="array-layout">
|
|
2052
|
+
<div class="array-layout-toolbar">
|
|
2053
|
+
<h2 class="mat-h2 array-layout-title">{{ label }}</h2>
|
|
2054
|
+
<span></span>
|
|
2055
|
+
<mat-icon
|
|
2056
|
+
*ngIf="this.error?.length"
|
|
2057
|
+
color="warn"
|
|
2058
|
+
matBadge="{{ this.error.split('').length }}"
|
|
2059
|
+
matBadgeColor="warn"
|
|
2060
|
+
matTooltip="{{ this.error }}"
|
|
2061
|
+
matTooltipClass="error-message-tooltip"
|
|
2062
|
+
>
|
|
2063
|
+
error_outline
|
|
2064
|
+
</mat-icon>
|
|
2065
|
+
<span></span>
|
|
2066
|
+
<button
|
|
2067
|
+
mat-button
|
|
2068
|
+
matTooltip="{{ translations.addTooltip }}"
|
|
2069
|
+
[disabled]="!isEnabled()"
|
|
2070
|
+
(click)="add()"
|
|
2071
|
+
attr.aria-label="{{ translations.addAriaLabel }}"
|
|
2072
|
+
>
|
|
2073
|
+
<mat-icon>add</mat-icon>
|
|
2074
|
+
</button>
|
|
2075
|
+
</div>
|
|
2076
|
+
<p *ngIf="noData">{{ translations.noDataMessage }}</p>
|
|
2077
|
+
<div
|
|
2078
|
+
*ngFor="
|
|
2079
|
+
let item of [].constructor(data);
|
|
2080
|
+
let idx = index;
|
|
2081
|
+
trackBy: trackByFn;
|
|
2082
|
+
last as last;
|
|
2083
|
+
first as first
|
|
2084
|
+
"
|
|
2085
|
+
>
|
|
2086
|
+
<mat-card class="array-item" appearance="outlined">
|
|
2087
|
+
<mat-card-content>
|
|
2088
|
+
<jsonforms-outlet [renderProps]="getProps(idx)"></jsonforms-outlet>
|
|
2089
|
+
</mat-card-content>
|
|
2090
|
+
<mat-card-actions *ngIf="isEnabled()">
|
|
2091
|
+
<button
|
|
2092
|
+
*ngIf="uischema?.options?.showSortButtons"
|
|
2093
|
+
class="item-up"
|
|
2094
|
+
mat-button
|
|
2095
|
+
[disabled]="first"
|
|
2096
|
+
(click)="up(idx)"
|
|
2097
|
+
attr.aria-label="{{ translations.upAriaLabel }}"
|
|
2098
|
+
matTooltip="{{ translations.up }}"
|
|
2099
|
+
matTooltipPosition="right"
|
|
2100
|
+
>
|
|
2101
|
+
<mat-icon>arrow_upward</mat-icon>
|
|
2102
|
+
</button>
|
|
2103
|
+
<button
|
|
2104
|
+
*ngIf="uischema?.options?.showSortButtons"
|
|
2105
|
+
class="item-down"
|
|
2106
|
+
mat-button
|
|
2107
|
+
[disabled]="last"
|
|
2108
|
+
(click)="down(idx)"
|
|
2109
|
+
attr.aria-label="{{ translations.downAriaLabel }}"
|
|
2110
|
+
matTooltip="{{ translations.down }}"
|
|
2111
|
+
matTooltipPosition="right"
|
|
2112
|
+
>
|
|
2113
|
+
<mat-icon>arrow_downward</mat-icon>
|
|
2114
|
+
</button>
|
|
2115
|
+
<button
|
|
2116
|
+
mat-button
|
|
2117
|
+
color="warn"
|
|
2118
|
+
(click)="remove(idx)"
|
|
2119
|
+
attr.aria-label="{{ translations.removeAriaLabel }}"
|
|
2120
|
+
matTooltip="{{ translations.removeTooltip }}"
|
|
2121
|
+
matTooltipPosition="right"
|
|
2122
|
+
>
|
|
2123
|
+
<mat-icon>delete</mat-icon>
|
|
2124
|
+
</button>
|
|
2125
|
+
</mat-card-actions>
|
|
2126
|
+
</mat-card>
|
|
2127
|
+
</div>
|
|
2128
|
+
</div>
|
|
2129
|
+
`, isInline: true, styles: [".array-layout{display:flex;flex-direction:column;gap:16px}.array-layout>*{flex:1 1 auto}.array-layout-toolbar{display:flex;align-items:center}.array-layout-title{margin:0}.array-layout-toolbar>span{flex:1 1 auto}.array-item{padding:16px}::ng-deep .error-message-tooltip{white-space:pre-line}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i1.JsonFormsOutlet, selector: "jsonforms-outlet", inputs: ["renderProps"] }, { kind: "component", type: i3$2.MatCard, selector: "mat-card", inputs: ["appearance"], exportAs: ["matCard"] }, { kind: "directive", type: i3$2.MatCardActions, selector: "mat-card-actions", inputs: ["align"], exportAs: ["matCardActions"] }, { kind: "directive", type: i3$2.MatCardContent, selector: "mat-card-content" }, { kind: "component", type: i5$2.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i6$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i6$2.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "directive", type: i7$1.MatBadge, selector: "[matBadge]", inputs: ["matBadgeDisabled", "matBadgeColor", "matBadgeOverlap", "matBadgePosition", "matBadge", "matBadgeDescription", "matBadgeSize", "matBadgeHidden"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2130
|
+
}
|
|
2131
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ArrayLayoutRenderer, decorators: [{
|
|
2132
|
+
type: Component,
|
|
2133
|
+
args: [{ selector: 'app-array-layout-renderer', template: `
|
|
2134
|
+
<div [ngStyle]="{ display: hidden ? 'none' : '' }" class="array-layout">
|
|
2135
|
+
<div class="array-layout-toolbar">
|
|
2136
|
+
<h2 class="mat-h2 array-layout-title">{{ label }}</h2>
|
|
2137
|
+
<span></span>
|
|
2138
|
+
<mat-icon
|
|
2139
|
+
*ngIf="this.error?.length"
|
|
2140
|
+
color="warn"
|
|
2141
|
+
matBadge="{{ this.error.split('').length }}"
|
|
2142
|
+
matBadgeColor="warn"
|
|
2143
|
+
matTooltip="{{ this.error }}"
|
|
2144
|
+
matTooltipClass="error-message-tooltip"
|
|
2145
|
+
>
|
|
2146
|
+
error_outline
|
|
2147
|
+
</mat-icon>
|
|
2148
|
+
<span></span>
|
|
2149
|
+
<button
|
|
2150
|
+
mat-button
|
|
2151
|
+
matTooltip="{{ translations.addTooltip }}"
|
|
2152
|
+
[disabled]="!isEnabled()"
|
|
2153
|
+
(click)="add()"
|
|
2154
|
+
attr.aria-label="{{ translations.addAriaLabel }}"
|
|
2155
|
+
>
|
|
2156
|
+
<mat-icon>add</mat-icon>
|
|
2157
|
+
</button>
|
|
2158
|
+
</div>
|
|
2159
|
+
<p *ngIf="noData">{{ translations.noDataMessage }}</p>
|
|
2160
|
+
<div
|
|
2161
|
+
*ngFor="
|
|
2162
|
+
let item of [].constructor(data);
|
|
2163
|
+
let idx = index;
|
|
2164
|
+
trackBy: trackByFn;
|
|
2165
|
+
last as last;
|
|
2166
|
+
first as first
|
|
2167
|
+
"
|
|
2168
|
+
>
|
|
2169
|
+
<mat-card class="array-item" appearance="outlined">
|
|
2170
|
+
<mat-card-content>
|
|
2171
|
+
<jsonforms-outlet [renderProps]="getProps(idx)"></jsonforms-outlet>
|
|
2172
|
+
</mat-card-content>
|
|
2173
|
+
<mat-card-actions *ngIf="isEnabled()">
|
|
2174
|
+
<button
|
|
2175
|
+
*ngIf="uischema?.options?.showSortButtons"
|
|
2176
|
+
class="item-up"
|
|
2177
|
+
mat-button
|
|
2178
|
+
[disabled]="first"
|
|
2179
|
+
(click)="up(idx)"
|
|
2180
|
+
attr.aria-label="{{ translations.upAriaLabel }}"
|
|
2181
|
+
matTooltip="{{ translations.up }}"
|
|
2182
|
+
matTooltipPosition="right"
|
|
2183
|
+
>
|
|
2184
|
+
<mat-icon>arrow_upward</mat-icon>
|
|
2185
|
+
</button>
|
|
2186
|
+
<button
|
|
2187
|
+
*ngIf="uischema?.options?.showSortButtons"
|
|
2188
|
+
class="item-down"
|
|
2189
|
+
mat-button
|
|
2190
|
+
[disabled]="last"
|
|
2191
|
+
(click)="down(idx)"
|
|
2192
|
+
attr.aria-label="{{ translations.downAriaLabel }}"
|
|
2193
|
+
matTooltip="{{ translations.down }}"
|
|
2194
|
+
matTooltipPosition="right"
|
|
2195
|
+
>
|
|
2196
|
+
<mat-icon>arrow_downward</mat-icon>
|
|
2197
|
+
</button>
|
|
2198
|
+
<button
|
|
2199
|
+
mat-button
|
|
2200
|
+
color="warn"
|
|
2201
|
+
(click)="remove(idx)"
|
|
2202
|
+
attr.aria-label="{{ translations.removeAriaLabel }}"
|
|
2203
|
+
matTooltip="{{ translations.removeTooltip }}"
|
|
2204
|
+
matTooltipPosition="right"
|
|
2205
|
+
>
|
|
2206
|
+
<mat-icon>delete</mat-icon>
|
|
2207
|
+
</button>
|
|
2208
|
+
</mat-card-actions>
|
|
2209
|
+
</mat-card>
|
|
2210
|
+
</div>
|
|
2211
|
+
</div>
|
|
2212
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [".array-layout{display:flex;flex-direction:column;gap:16px}.array-layout>*{flex:1 1 auto}.array-layout-toolbar{display:flex;align-items:center}.array-layout-title{margin:0}.array-layout-toolbar>span{flex:1 1 auto}.array-item{padding:16px}::ng-deep .error-message-tooltip{white-space:pre-line}\n"] }]
|
|
2213
|
+
}], ctorParameters: function () { return [{ type: i1.JsonFormsAngularService }]; } });
|
|
2214
|
+
const ArrayLayoutRendererTester = rankWith(4, isObjectArrayWithNesting);
|
|
2215
|
+
|
|
2216
|
+
/*
|
|
2217
|
+
The MIT License
|
|
2218
|
+
|
|
2219
|
+
Copyright (c) 2017-2019 EclipseSource Munich
|
|
2220
|
+
https://github.com/eclipsesource/jsonforms
|
|
2221
|
+
|
|
2222
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
2223
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
2224
|
+
in the Software without restriction, including without limitation the rights
|
|
2225
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
2226
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
2227
|
+
furnished to do so, subject to the following conditions:
|
|
2228
|
+
|
|
2229
|
+
The above copyright notice and this permission notice shall be included in
|
|
2230
|
+
all copies or substantial portions of the Software.
|
|
2231
|
+
|
|
2232
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
2233
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
2234
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
2235
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
2236
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
2237
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
2238
|
+
THE SOFTWARE.
|
|
2239
|
+
*/
|
|
2240
|
+
|
|
2241
|
+
/*
|
|
2242
|
+
The MIT License
|
|
2243
|
+
|
|
2244
|
+
Copyright (c) 2017-2019 EclipseSource Munich
|
|
2245
|
+
https://github.com/eclipsesource/jsonforms
|
|
2246
|
+
|
|
2247
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
2248
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
2249
|
+
in the Software without restriction, including without limitation the rights
|
|
2250
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
2251
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
2252
|
+
furnished to do so, subject to the following conditions:
|
|
2253
|
+
|
|
2254
|
+
The above copyright notice and this permission notice shall be included in
|
|
2255
|
+
all copies or substantial portions of the Software.
|
|
2256
|
+
|
|
2257
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
2258
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
2259
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
2260
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
2261
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
2262
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
2263
|
+
THE SOFTWARE.
|
|
2264
|
+
*/
|
|
2265
|
+
class JsonFormsAngularMaterialModule {
|
|
2266
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: JsonFormsAngularMaterialModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2267
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: JsonFormsAngularMaterialModule, declarations: [BooleanControlRenderer,
|
|
2268
|
+
TextAreaRenderer,
|
|
2269
|
+
TextControlRenderer,
|
|
2270
|
+
NumberControlRenderer,
|
|
2271
|
+
RangeControlRenderer,
|
|
2272
|
+
DateControlRenderer,
|
|
2273
|
+
ToggleControlRenderer,
|
|
2274
|
+
VerticalLayoutRenderer,
|
|
2275
|
+
HorizontalLayoutRenderer,
|
|
2276
|
+
CategorizationTabLayoutRenderer,
|
|
2277
|
+
GroupLayoutRenderer,
|
|
2278
|
+
LabelRenderer,
|
|
2279
|
+
MasterListComponent,
|
|
2280
|
+
JsonFormsDetailComponent,
|
|
2281
|
+
ObjectControlRenderer,
|
|
2282
|
+
AutocompleteControlRenderer,
|
|
2283
|
+
TableRenderer,
|
|
2284
|
+
ArrayLayoutRenderer,
|
|
2285
|
+
LayoutChildrenRenderPropsPipe], imports: [CommonModule,
|
|
2286
|
+
JsonFormsModule,
|
|
2287
|
+
MatFormFieldModule,
|
|
2288
|
+
MatCheckboxModule,
|
|
2289
|
+
MatInputModule,
|
|
2290
|
+
MatSliderModule,
|
|
2291
|
+
MatSlideToggleModule,
|
|
2292
|
+
MatNativeDateModule,
|
|
2293
|
+
MatDatepickerModule,
|
|
2294
|
+
MatTabsModule,
|
|
2295
|
+
MatSidenavModule,
|
|
2296
|
+
MatListModule,
|
|
2297
|
+
ReactiveFormsModule,
|
|
2298
|
+
MatCardModule,
|
|
2299
|
+
MatSelectModule,
|
|
2300
|
+
MatButtonModule,
|
|
2301
|
+
MatIconModule,
|
|
2302
|
+
MatAutocompleteModule,
|
|
2303
|
+
MatTableModule,
|
|
2304
|
+
MatToolbarModule,
|
|
2305
|
+
MatTooltipModule,
|
|
2306
|
+
MatBadgeModule], exports: [CommonModule,
|
|
2307
|
+
JsonFormsModule,
|
|
2308
|
+
MatFormFieldModule,
|
|
2309
|
+
MatCheckboxModule,
|
|
2310
|
+
MatInputModule,
|
|
2311
|
+
MatSliderModule,
|
|
2312
|
+
MatSlideToggleModule,
|
|
2313
|
+
MatNativeDateModule,
|
|
2314
|
+
MatDatepickerModule,
|
|
2315
|
+
MatTabsModule,
|
|
2316
|
+
MatSidenavModule,
|
|
2317
|
+
MatListModule,
|
|
2318
|
+
ReactiveFormsModule,
|
|
2319
|
+
MatCardModule,
|
|
2320
|
+
MatSelectModule,
|
|
2321
|
+
MatButtonModule,
|
|
2322
|
+
MatIconModule,
|
|
2323
|
+
MatAutocompleteModule] });
|
|
2324
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: JsonFormsAngularMaterialModule, imports: [CommonModule,
|
|
2325
|
+
JsonFormsModule,
|
|
2326
|
+
MatFormFieldModule,
|
|
2327
|
+
MatCheckboxModule,
|
|
2328
|
+
MatInputModule,
|
|
2329
|
+
MatSliderModule,
|
|
2330
|
+
MatSlideToggleModule,
|
|
2331
|
+
MatNativeDateModule,
|
|
2332
|
+
MatDatepickerModule,
|
|
2333
|
+
MatTabsModule,
|
|
2334
|
+
MatSidenavModule,
|
|
2335
|
+
MatListModule,
|
|
2336
|
+
ReactiveFormsModule,
|
|
2337
|
+
MatCardModule,
|
|
2338
|
+
MatSelectModule,
|
|
2339
|
+
MatButtonModule,
|
|
2340
|
+
MatIconModule,
|
|
2341
|
+
MatAutocompleteModule,
|
|
2342
|
+
MatTableModule,
|
|
2343
|
+
MatToolbarModule,
|
|
2344
|
+
MatTooltipModule,
|
|
2345
|
+
MatBadgeModule, CommonModule,
|
|
2346
|
+
JsonFormsModule,
|
|
2347
|
+
MatFormFieldModule,
|
|
2348
|
+
MatCheckboxModule,
|
|
2349
|
+
MatInputModule,
|
|
2350
|
+
MatSliderModule,
|
|
2351
|
+
MatSlideToggleModule,
|
|
2352
|
+
MatNativeDateModule,
|
|
2353
|
+
MatDatepickerModule,
|
|
2354
|
+
MatTabsModule,
|
|
2355
|
+
MatSidenavModule,
|
|
2356
|
+
MatListModule,
|
|
2357
|
+
ReactiveFormsModule,
|
|
2358
|
+
MatCardModule,
|
|
2359
|
+
MatSelectModule,
|
|
2360
|
+
MatButtonModule,
|
|
2361
|
+
MatIconModule,
|
|
2362
|
+
MatAutocompleteModule] });
|
|
2363
|
+
}
|
|
2364
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: JsonFormsAngularMaterialModule, decorators: [{
|
|
2365
|
+
type: NgModule,
|
|
2366
|
+
args: [{
|
|
2367
|
+
imports: [
|
|
2368
|
+
CommonModule,
|
|
2369
|
+
JsonFormsModule,
|
|
2370
|
+
MatFormFieldModule,
|
|
2371
|
+
MatCheckboxModule,
|
|
2372
|
+
MatInputModule,
|
|
2373
|
+
MatSliderModule,
|
|
2374
|
+
MatSlideToggleModule,
|
|
2375
|
+
MatNativeDateModule,
|
|
2376
|
+
MatDatepickerModule,
|
|
2377
|
+
MatTabsModule,
|
|
2378
|
+
MatSidenavModule,
|
|
2379
|
+
MatListModule,
|
|
2380
|
+
ReactiveFormsModule,
|
|
2381
|
+
MatCardModule,
|
|
2382
|
+
MatSelectModule,
|
|
2383
|
+
MatButtonModule,
|
|
2384
|
+
MatIconModule,
|
|
2385
|
+
MatAutocompleteModule,
|
|
2386
|
+
MatTableModule,
|
|
2387
|
+
MatToolbarModule,
|
|
2388
|
+
MatTooltipModule,
|
|
2389
|
+
MatBadgeModule,
|
|
2390
|
+
],
|
|
2391
|
+
declarations: [
|
|
2392
|
+
BooleanControlRenderer,
|
|
2393
|
+
TextAreaRenderer,
|
|
2394
|
+
TextControlRenderer,
|
|
2395
|
+
NumberControlRenderer,
|
|
2396
|
+
RangeControlRenderer,
|
|
2397
|
+
DateControlRenderer,
|
|
2398
|
+
ToggleControlRenderer,
|
|
2399
|
+
VerticalLayoutRenderer,
|
|
2400
|
+
HorizontalLayoutRenderer,
|
|
2401
|
+
CategorizationTabLayoutRenderer,
|
|
2402
|
+
GroupLayoutRenderer,
|
|
2403
|
+
LabelRenderer,
|
|
2404
|
+
MasterListComponent,
|
|
2405
|
+
JsonFormsDetailComponent,
|
|
2406
|
+
ObjectControlRenderer,
|
|
2407
|
+
AutocompleteControlRenderer,
|
|
2408
|
+
TableRenderer,
|
|
2409
|
+
ArrayLayoutRenderer,
|
|
2410
|
+
LayoutChildrenRenderPropsPipe,
|
|
2411
|
+
],
|
|
2412
|
+
exports: [
|
|
2413
|
+
CommonModule,
|
|
2414
|
+
JsonFormsModule,
|
|
2415
|
+
MatFormFieldModule,
|
|
2416
|
+
MatCheckboxModule,
|
|
2417
|
+
MatInputModule,
|
|
2418
|
+
MatSliderModule,
|
|
2419
|
+
MatSlideToggleModule,
|
|
2420
|
+
MatNativeDateModule,
|
|
2421
|
+
MatDatepickerModule,
|
|
2422
|
+
MatTabsModule,
|
|
2423
|
+
MatSidenavModule,
|
|
2424
|
+
MatListModule,
|
|
2425
|
+
ReactiveFormsModule,
|
|
2426
|
+
MatCardModule,
|
|
2427
|
+
MatSelectModule,
|
|
2428
|
+
MatButtonModule,
|
|
2429
|
+
MatIconModule,
|
|
2430
|
+
MatAutocompleteModule,
|
|
2431
|
+
],
|
|
2432
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
|
2433
|
+
providers: [],
|
|
2434
|
+
}]
|
|
2435
|
+
}] });
|
|
2436
|
+
|
|
2437
|
+
/*
|
|
2438
|
+
The MIT License
|
|
2439
|
+
|
|
2440
|
+
Copyright (c) 2017-2019 EclipseSource Munich
|
|
2441
|
+
https://github.com/eclipsesource/jsonforms
|
|
2442
|
+
|
|
2443
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
2444
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
2445
|
+
in the Software without restriction, including without limitation the rights
|
|
2446
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
2447
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
2448
|
+
furnished to do so, subject to the following conditions:
|
|
2449
|
+
|
|
2450
|
+
The above copyright notice and this permission notice shall be included in
|
|
2451
|
+
all copies or substantial portions of the Software.
|
|
2452
|
+
|
|
2453
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
2454
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
2455
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
2456
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
2457
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
2458
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
2459
|
+
THE SOFTWARE.
|
|
2460
|
+
*/
|
|
2461
|
+
|
|
2462
|
+
/*
|
|
2463
|
+
The MIT License
|
|
2464
|
+
|
|
2465
|
+
Copyright (c) 2017-2019 EclipseSource Munich
|
|
2466
|
+
https://github.com/eclipsesource/jsonforms
|
|
2467
|
+
|
|
2468
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
2469
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
2470
|
+
in the Software without restriction, including without limitation the rights
|
|
2471
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
2472
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
2473
|
+
furnished to do so, subject to the following conditions:
|
|
2474
|
+
|
|
2475
|
+
The above copyright notice and this permission notice shall be included in
|
|
2476
|
+
all copies or substantial portions of the Software.
|
|
2477
|
+
|
|
2478
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
2479
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
2480
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
2481
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
2482
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
2483
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
2484
|
+
THE SOFTWARE.
|
|
2485
|
+
*/
|
|
2486
|
+
|
|
2487
|
+
/*
|
|
2488
|
+
The MIT License
|
|
2489
|
+
|
|
2490
|
+
Copyright (c) 2017-2019 EclipseSource Munich
|
|
2491
|
+
https://github.com/eclipsesource/jsonforms
|
|
2492
|
+
|
|
2493
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
2494
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
2495
|
+
in the Software without restriction, including without limitation the rights
|
|
2496
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
2497
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
2498
|
+
furnished to do so, subject to the following conditions:
|
|
2499
|
+
|
|
2500
|
+
The above copyright notice and this permission notice shall be included in
|
|
2501
|
+
all copies or substantial portions of the Software.
|
|
2502
|
+
|
|
2503
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
2504
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
2505
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
2506
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
2507
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
2508
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
2509
|
+
THE SOFTWARE.
|
|
2510
|
+
*/
|
|
2511
|
+
|
|
2512
|
+
/*
|
|
2513
|
+
The MIT License
|
|
2514
|
+
|
|
2515
|
+
Copyright (c) 2017-2019 EclipseSource Munich
|
|
2516
|
+
https://github.com/eclipsesource/jsonforms
|
|
2517
|
+
|
|
2518
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
2519
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
2520
|
+
in the Software without restriction, including without limitation the rights
|
|
2521
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
2522
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
2523
|
+
furnished to do so, subject to the following conditions:
|
|
2524
|
+
|
|
2525
|
+
The above copyright notice and this permission notice shall be included in
|
|
2526
|
+
all copies or substantial portions of the Software.
|
|
2527
|
+
|
|
2528
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
2529
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
2530
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
2531
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
2532
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
2533
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
2534
|
+
THE SOFTWARE.
|
|
2535
|
+
*/
|
|
2536
|
+
const angularMaterialRenderers = [
|
|
2537
|
+
// controls
|
|
2538
|
+
{ tester: booleanControlTester, renderer: BooleanControlRenderer },
|
|
2539
|
+
{ tester: TextControlRendererTester, renderer: TextControlRenderer },
|
|
2540
|
+
{ tester: TextAreaRendererTester, renderer: TextAreaRenderer },
|
|
2541
|
+
{ tester: NumberControlRendererTester, renderer: NumberControlRenderer },
|
|
2542
|
+
{ tester: RangeControlRendererTester, renderer: RangeControlRenderer },
|
|
2543
|
+
{ tester: DateControlRendererTester, renderer: DateControlRenderer },
|
|
2544
|
+
{ tester: ToggleControlRendererTester, renderer: ToggleControlRenderer },
|
|
2545
|
+
{ tester: enumControlTester, renderer: AutocompleteControlRenderer },
|
|
2546
|
+
{ tester: ObjectControlRendererTester, renderer: ObjectControlRenderer },
|
|
2547
|
+
// layouts
|
|
2548
|
+
{ tester: verticalLayoutTester, renderer: VerticalLayoutRenderer },
|
|
2549
|
+
{ tester: groupLayoutTester, renderer: GroupLayoutRenderer },
|
|
2550
|
+
{ tester: horizontalLayoutTester, renderer: HorizontalLayoutRenderer },
|
|
2551
|
+
{ tester: categorizationTester, renderer: CategorizationTabLayoutRenderer },
|
|
2552
|
+
{ tester: LabelRendererTester, renderer: LabelRenderer },
|
|
2553
|
+
{ tester: ArrayLayoutRendererTester, renderer: ArrayLayoutRenderer },
|
|
2554
|
+
// other
|
|
2555
|
+
{ tester: masterDetailTester, renderer: MasterListComponent },
|
|
2556
|
+
{ tester: TableRendererTester, renderer: TableRenderer },
|
|
2557
|
+
];
|
|
2558
|
+
|
|
2559
|
+
/**
|
|
2560
|
+
* Generated bundle index. Do not edit.
|
|
2561
|
+
*/
|
|
2562
|
+
|
|
2563
|
+
export { AutocompleteControlRenderer, BooleanControlRenderer, CategorizationTabLayoutRenderer, DateControlRenderer, DateControlRendererTester, GroupLayoutRenderer, HorizontalLayoutRenderer, JsonFormsAngularMaterialModule, JsonFormsDetailComponent, LabelRenderer, LabelRendererTester, LayoutChildrenRenderPropsPipe, LayoutRenderer, MasterListComponent, NumberControlRenderer, NumberControlRendererTester, ObjectControlRenderer, ObjectControlRendererTester, RangeControlRenderer, RangeControlRendererTester, TableRenderer, TableRendererTester, TextAreaRenderer, TextAreaRendererTester, TextControlRenderer, TextControlRendererTester, ToggleControlRenderer, ToggleControlRendererTester, VerticalLayoutRenderer, angularMaterialRenderers, booleanControlTester, categorizationTester, controlWithoutLabel, enumControlTester, groupLayoutTester, horizontalLayoutTester, masterDetailTester, removeSchemaKeywords, verticalLayoutTester };
|
|
2564
|
+
//# sourceMappingURL=jsonforms-angular-material.mjs.map
|