How to use the react-jsonschema-form/lib/utils.toIdSchema function in react-jsonschema-form

To help you get started, we’ve selected a few react-jsonschema-form examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cloudwan / gohan_webui / src / Form / formComponents / fields / ArrayField / ArrayField.js View on Github external
items && items.map((value, index) => {
              const itemErrorSchema = errorSchema ? errorSchema[index] : undefined;
              const itemIdPrefix = idSchema.$id + '_' + index;
              const itemIdSchema = toIdSchema(itemsSchema, itemIdPrefix, definitions);

              return (
                
                  <div>
                    <button>
                      
                    </button>
                  </div>
                  <div>
                    {
                      this.renderArrayFieldItem({
                        index,
                        canMoveUp: index &gt; 0,
                        canMoveDown: index &lt; items.length - 1,</div>
github Talend / ui / packages / forms / src / deprecated / widgets / TabsWidget.js View on Github external
{Object.keys(schema.properties).map((tabKey, index) =&gt; {
					const tabSchema = schema.properties[tabKey];
					const itemIdSchema = toIdSchema(tabSchema, tabKey, definitions);
					const saveToFormData = state =&gt; {
						const formDataCopy = Object.assign({}, formData);
						formDataCopy[tabKey] = state;
						onChange(formDataCopy);
					};
					return (
						
							 saveToFormData(newState)}
								registry={registry}
								schema={Object.assign({}, tabSchema, { title: '' })}
								uiSchema={uiSchema[tabKey]}
							/&gt;
github cloudwan / gohan_webui / src / Form / formComponents / fields / ArrayField / ArrayField.js View on Github external
items &amp;&amp; items.map((item, index) =&gt; {
            const additional = index &gt;= itemSchemas.length;
            const itemSchema = additional ?
              additionalSchema : itemSchemas[index];
            const itemIdPrefix = idSchema.$id + '_' + index;
            const itemIdSchema = toIdSchema(itemSchema, itemIdPrefix, definitions);
            const itemUiSchema = additional ?
              uiSchema.additionalItems || {} :
              Array.isArray(uiSchema.items) ?
                uiSchema.items[index] : uiSchema.items || {};
            const itemErrorSchema = errorSchema ? errorSchema[index] : undefined;

            return this.renderArrayFieldItem({
              index,
              removable: additional,
              canMoveUp: index &gt;= itemSchemas.length + 1,
              canMoveDown: additional &amp;&amp; index &lt; items.length - 1,
              itemSchema,
              itemData: item,
              itemUiSchema,
              itemIdSchema,
              itemErrorSchema,
github Talend / ui / packages / forms / src / deprecated / fields / ArrayField.js View on Github external
items: formData.map((item, index) =&gt; {
				const itemErrorSchema = errorSchema ? errorSchema[index] : undefined;
				const itemIdPrefix = `${idSchema.$id}_${index}`;
				const itemIdSchema = toIdSchema(itemsSchema, itemIdPrefix, definitions);
				return this.renderArrayFieldItem({
					index,
					canMoveUp: index &gt; 0,
					canMoveDown: index &lt; formData.length - 1,
					itemSchema: itemsSchema,
					itemIdSchema,
					itemErrorSchema,
					itemData: item,
					itemUiSchema: uiSchema.items,
					autofocus: autofocus &amp;&amp; index === 0,
					onBlur,
					onFocus,
				});
			}),
			className: `field field-array field-array-of-${itemsSchema.type}`,
github Talend / ui / packages / forms / src / deprecated / fields / ArrayField.js View on Github external
items: items.map((item, index) =&gt; {
				const additional = index &gt;= itemSchemas.length;
				const itemSchema = additional ? additionalSchema : itemSchemas[index];
				const itemIdPrefix = `${idSchema.$id}_${index}`;
				const itemIdSchema = toIdSchema(itemSchema, itemIdPrefix, definitions);

				const itemErrorSchema = errorSchema ? errorSchema[index] : undefined;
				let itemUiSchema = null;
				if (additional) {
					itemUiSchema = uiSchema.additionalItems || {};
				} else if (Array.isArray(uiSchema.items)) {
					itemUiSchema = uiSchema.items[index];
				} else {
					itemUiSchema = uiSchema.items || {};
				}

				return this.renderArrayFieldItem({
					index,
					canRemove: additional,
					canMoveUp: index &gt;= itemSchemas.length + 1,
					canMoveDown: additional &amp;&amp; index &lt; items.length - 1,