@talend/react-forms
Version:
React forms library based on json schema form.
53 lines (52 loc) • 1.39 kB
TypeScript
/**
* Adapt array element items with the element index
* Example:
* Array schema
* {
* items: [
* { key: ['my', 'array', '', name], widget: 'text' },
* { key: ['my', 'array', '', path], widget: 'text' },
* ]
* }
*
* Result
* [
* { key: ['my', 'array', index, 'name'], widget: 'text' }, // insert nested index
* { key: ['my', 'array', index, 'path'], widget: 'text' }, // insert nested index
* ],
*
* @param arraySchema
* @param elementIndex
*/
export function getArrayElementItems(arraySchema: any, elementIndex: any): any;
/**
* Build schema for an array element, based on array schema
* Example:
* Array schema
* {
* key: ['my', 'array'],
* items: [
* { key: ['my', 'array', '', name], widget: 'text' },
* { key: ['my', 'array', '', path], widget: 'text' },
* ]
* }
* Result
* {
* key: ['my', 'array', index], // insert index
* items: [
* { key: ['my', 'array', index, 'name'], widget: 'text' }, // insert nested index
* { key: ['my', 'array', index, 'path'], widget: 'text' }, // insert nested index
* ],
* widget: 'fieldset', // insert item widget
* }
*
* @param arraySchema The array schema
* @param elementIndex The index of the element in the array
*/
export function getArrayElementSchema(arraySchema: any, elementIndex: any): {
key: any;
items: any;
widget: any;
title: any;
managed: any;
};