How to use the @jsonforms/core.Actions.init function in @jsonforms/core

To help you get started, we’ve selected a few @jsonforms/core 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 eclipsesource / jsonforms / packages / example / src / index.tsx View on Github external
// Add schema to validation
  const ajv = createAjv();
  ajv.addSchema(geoschema, 'geographical-location.schema.json');
  // Allow json-schema-ref-resolver to resolve same schema
  const geoResolver = {
    order: 1,
    canRead: (file: any) => {
      return file.url.indexOf('geographical-location.schema.json') !== -1;
    },
    read: () => {
      return JSON.stringify(geoschema);
    }
  };
  // Add configuration to JSONForms
  store.dispatch(
    Actions.init(
      exampleData[0].data,
      exampleData[0].schema,
      exampleData[0].uischema,
      {
        ajv: ajv,
        refParserOptions: {
          resolve: {
            geo: geoResolver
          } as any
        }
      }
    )
  );
  return store;
};
export const renderExample = (
github eclipsesource / jsonforms-react-seed / src / index.tsx View on Github external
recurrence: 'Daily',
  rating: 3
};

const initState: JsonFormsState = {
  jsonforms: {
    cells: materialCells,
    renderers: materialRenderers
  }
};

const rootReducer: Reducer = combineReducers({
  jsonforms: jsonformsReducer()
});
const store = createStore(rootReducer, initState, devToolsEnhancer({}));
store.dispatch(Actions.init(data, schema, uischema));

// Register custom renderer for the Redux tab
store.dispatch(Actions.registerRenderer(ratingControlTester, RatingControl));

ReactDOM.render(, document.getElementById('root'));
registerServiceWorker();
github eclipsesource / jsonforms / packages / angular-material / example / app / app.module.ts View on Github external
constructor(ngRedux: NgRedux, devTools: DevToolsExtension) {
    let enhancers: any[] = [];
    // ... add whatever other enhancers you want.

    // You probably only want to expose this tool in devMode.
    if (isDevMode() && devTools.isEnabled()) {
      enhancers = [...enhancers, devTools.enhancer()];
    }

    ngRedux.configureStore(rootReducer, initialState, [logger], enhancers);
    const example = initialState.examples.data[0];
    ngRedux.dispatch(
      Actions.init(example.data, example.schema, example.uischema)
    );

    const uiSchema = {
      type: 'HorizontalLayout',
      elements: [
        {
          type: 'Control',
          scope: '#/properties/buyer/properties/email'
        },
        {
          type: 'Control',
          scope: '#/properties/status'
        }
      ]
    };
    const itemTester: UISchemaTester = (_schema, schemaPath, _path) => {
github eclipsesource / jsonforms / packages / editor / src / helpers / util.ts View on Github external
{
        jsonforms: {
          renderers,
          fields,
          editor: {
            imageMapping,
            labelMapping,
            modelMapping,
            uiSchemata,
            containerProperties
          }
        }
      }
  );

  store.dispatch(Actions.init(data, schema, uischema));

  return store;
};
github eclipsesource / jsonforms / packages / webcomponent / src / JsonFormsElement.tsx View on Github external
const setupStore = (
      schema: JsonSchema,
      uischema: UISchemaElement,
      d: any
    ) => {
      store.dispatch(Actions.init(d, schema, uischema));

      return store;
    };
github eclipsesource / jsonforms / packages / example / src / util.tsx View on Github external
onClick={() =>
                  dispatch(Actions.init(e.data, e.schema, e.uischema))
                }
github eclipsesource / coffee-editor / web / jsonforms-tree / src / browser / editor / json-forms-widget.tsx View on Github external
setSelection(selectedNode: JsonFormsTree.Node) {
    this.selectedNode = selectedNode;

    this.store.dispatch(
      Actions.init(
        this.selectedNode.jsonforms.data,
        this.modelService.getSchemaForNode(this.selectedNode),
        this.modelService.getUiSchemaForNode(this.selectedNode),
        {
          refParserOptions: {
            dereference: { circular: 'ignore' }
          }
        }
      )
    );
    this.renderForms();
  }
github eclipsesource / jsonforms / packages / example / src / util.tsx View on Github external
onClick={() => {
                  dispatch(Actions.init(e.data, e.schema, e.config.withSort));
                }}
              >
github eclipsesource / jsonforms / packages / angular-material / example / app / app.component.ts View on Github external
onChange = (ev: any) => {
    const selectedExample = this.ngRedux
      .getState()
      .examples.data.find(e => e.name === ev.target.value);
    this.ngRedux.dispatch(
      Actions.init(
        selectedExample.data,
        selectedExample.schema,
        selectedExample.uischema
      )
    );
    this.ngRedux.dispatch(setLocale(this.currentLocale));
  };