How to use the @jsonforms/core.jsonformsReducer 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-react-seed / src / index.tsx View on Github external
name: 'Send email to Adrian',
  description: 'Confirm if you have passed the subject\nHereby ...',
  done: true,
  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 / example / src / index.tsx View on Github external
}

      return acc;
    },
    {} as any
  );
  const additionalInitState = additionalStoreParams.reduce(
    (acc: any, x: any) => {
      acc[x.name] = x.state;

      return acc;
    },
    {} as any
  );
  const reducer = combineReducers({
    jsonforms: jsonformsReducer({ ...additionalReducers }),
    examples: exampleReducer
  });
  const store = createStore(reducer, {
    jsonforms: {
      cells: cells,
      renderers: renderers,
      ...additionalInitState
    },
    examples: {
      data: exampleData
    }
  });

  // Resolve example configuration
  // Add schema to validation
  const ajv = createAjv();
github eclipsesource / coffee-editor / web / coffee-editor-extension / src / browser / coffee-editor.ts View on Github external
const uischema = {
    'type': 'MasterDetailLayout',
    'scope': '#'
  };
  const renderers = materialRenderers;
  const cells = materialCells;
  const jsonforms: JsonFormsState = {
    jsonforms: {
      renderers,
      cells
    }
  };

  const store: JsonFormsStore = createStore(
    combineReducers({
        jsonforms: jsonformsReducer(
        )
      }
    ),
    {
      ...jsonforms
    }
  );

  store.dispatch(Actions.init({}, coffeeSchema, uischema));
  store.dispatch(Actions.registerUISchema((schema => schema['$id']==='#controlunit'?100:-1),controlUnitView));
  store.dispatch(Actions.registerUISchema((schema => schema['$id']==='#machine'?100:-1),machineView));

  return store;
};
github eclipsesource / jsonforms / packages / editor / src / helpers / util.ts View on Github external
export const createEditorStore = (
  data = {},
  schema,
  uischema,
  fields,
  renderers,
  imageMapping?,
  labelMapping?,
  modelMapping?,
  uiSchemata = {},
  containerProperties = {}): Store => {
  const store = createStore(
    combineReducers({ jsonforms: jsonformsReducer({ editor: editorReducer }) }),
    {
        jsonforms: {
          renderers,
          fields,
          editor: {
            imageMapping,
            labelMapping,
            modelMapping,
            uiSchemata,
            containerProperties
          }
        }
      }
  );

  store.dispatch(Actions.init(data, schema, uischema));
github eclipsesource / jsonforms / packages / material-tree-renderer / example / index.ts View on Github external
return `User ${data.name || ''}`;
  }

  return 'Unknown';
};

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

const store: Store = createStore(
  combineReducers({
    jsonforms: jsonformsReducer()
  }),
  { ...initState }
);

store.dispatch(Actions.init({}, taskSchema, uischema));
store.dispatch(
  Actions.registerDefaultData('properties.users.items', { name: 'Test user' })
);

detailSchemata.forEach(({ tester, uischema: detailedUiSchema }) =>
  store.dispatch(Actions.registerUISchema(tester, detailedUiSchema))
);

ReactDOM.render(
  React.createElement(
    App,
github eclipsesource / jsonforms / packages / angular-material / example / app / store.ts View on Github external
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 { combineReducers, Reducer } from 'redux';
import { jsonformsReducer, JsonFormsState } from '@jsonforms/core';
import { angularMaterialRenderers } from '../../src/index';
import { ExampleDescription, getExamples } from '@jsonforms/examples';

export const rootReducer: Reducer = combineReducers({
  jsonforms: jsonformsReducer(),
  examples: (state: ExampleDescription[] = []) => state
});

export const initialState = {
  jsonforms: {
    renderers: angularMaterialRenderers
  },
  examples: {
    data: getExamples()
  }
};
github eclipsesource / coffee-editor / web / jsonforms-tree / src / browser / editor / json-forms-widget.tsx View on Github external
private initStore() {
    const initState: JsonFormsState = {
      jsonforms: {
        cells: materialCells,
        renderers: materialRenderers
      }
    };
    return createStore(
      combineReducers({ jsonforms: jsonformsReducer() }),
      initState
    );
  }