-
Notifications
You must be signed in to change notification settings - Fork 376
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve label handling in MasterListComponent
The MasterListComponent did only show labels for object lists. Furthermore the options property in the uischema was mandatory. Also the property to use as label for objects had to be provided. The fix now handles primitives, a missing options property and in the case of a missing `labelRef` the first primitive property is used. If no primitive property is available the first property in the schema is used. Fix #1779
- Loading branch information
Showing
4 changed files
with
199 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* | ||
The MIT License | ||
Copyright (c) 2017-2021 EclipseSource Munich | ||
https://github.com/eclipsesource/jsonforms | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
*/ | ||
import { registerExamples } from './register'; | ||
|
||
const data = { | ||
'an-array-of-strings': ['foo', 'bar', 'foobar'] | ||
}; | ||
const schema = { | ||
type: 'object', | ||
properties: { | ||
'an-array-of-strings': { | ||
type: 'array', | ||
items: { | ||
type: 'string' | ||
} | ||
} | ||
} | ||
}; | ||
const uischema = { | ||
"type": "ListWithDetail", | ||
"scope": "#/properties/an-array-of-strings" | ||
}; | ||
|
||
registerExamples([ | ||
{ | ||
name: '1779', | ||
label: 'List With Detail primitive (string)', | ||
data, | ||
schema, | ||
uischema | ||
} | ||
]); | ||
|
||
const data_number = { | ||
'an-array-of-numbers': [1, 2, 3] | ||
}; | ||
const schema_number = { | ||
type: 'object', | ||
properties: { | ||
'an-array-of-numbers': { | ||
type: 'array', | ||
items: { | ||
type: 'number' | ||
} | ||
} | ||
} | ||
}; | ||
const uischema_number = { | ||
"type": "ListWithDetail", | ||
"scope": "#/properties/an-array-of-numbers" | ||
}; | ||
|
||
registerExamples([ | ||
{ | ||
name: '1779', | ||
label: 'List With Detail primitive (string)', | ||
data: data_number, | ||
schema: schema_number, | ||
uischema: uischema_number | ||
} | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters