Merge pull request 'fix(edit): use cellValidation keys and hotDataSchema to fill in defaults on add row' (#205) from fix/204-default-value into demodata
Reviewed-on: #205
This commit was merged in pull request #205.
This commit is contained in:
@@ -1051,9 +1051,11 @@ export class EditorComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
*/
|
||||
private createEmptyRow(): any {
|
||||
const newRow: any = {}
|
||||
this.headerColumns.forEach((col: string) => {
|
||||
const defaultValue = this.dcValidator?.getNotNullDefaultValue(col)
|
||||
newRow[col] = defaultValue !== undefined ? defaultValue : ''
|
||||
this.cellValidation.forEach((rule: any) => {
|
||||
const dataKey = rule.data
|
||||
newRow[dataKey] = this.hotDataSchema.hasOwnProperty(dataKey)
|
||||
? this.hotDataSchema[dataKey]
|
||||
: ''
|
||||
})
|
||||
newRow['noLinkOption'] = true
|
||||
return newRow
|
||||
|
||||
@@ -27,6 +27,7 @@ export function getHotDataSchema(
|
||||
if (!type) return schemaTypeMap.default
|
||||
|
||||
switch (type) {
|
||||
case 'dropdown':
|
||||
case 'autocomplete': {
|
||||
return cellValidation && cellValidation.source
|
||||
? (cellValidation.source as string[] | number[])[0]
|
||||
|
||||
Reference in New Issue
Block a user