Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
set store(store: Store) {
const setupStore = (
schema: JsonSchema,
uischema: UISchemaElement,
d: any
) => {
store.dispatch(Actions.init(d, schema, uischema));
return store;
};
const data = getData(store.getState()) || {};
RefParser.dereference(
getSchema(store.getState()) || (Generate.jsonSchema(data) as any),
getRefParserOptions(store.getState())
).then(resolvedSchema => {
this._store = setupStore(
resolvedSchema as any,
getUiSchema(store.getState()),
data
);
this.render();
});
}
private render(): void {
if (!this.connected || this._store === undefined) {
return;
}
if (this.editor === undefined || this.editor === null) {
this.editor = document.createElement('json-forms') as JsonFormsElement;
this.appendChild(this.editor);
}
JsonRefs.resolveRefs(getSchema(this._store.getState()))
.then(
resolvedSchema => {
this.editor.setInnerComponent(
TreeRenderer,
{
uischema: getUiSchema(this._store.getState()),
schema: resolvedSchema.resolved,
filterPredicate: this._filterPredicate,
labelProvider: this._labelProvider,
imageProvider: this._imageProvider
});
this.editor.store = this._store;
const exportButton = document.getElementById('export-data-button') as HTMLButtonElement;
if (exportButton !== null) {
const exportDialog = createExportDataDialog();
get schema() {
return getSchema(this._store.getState());
}
const mapStateToProps = (state: JsonFormsState) => {
return {
schema: getSchema(state),
rootData: getData(state)
};
};
const resetServices = () => {
const jsonforms = document.getElementsByTagName('json-forms')[0] as JsonFormsElement;
const currentState = jsonforms.store.getState();
jsonforms.store.dispatch({
type: Actions.INIT,
data,
schema: getSchema(currentState),
uischema: getUiSchema(currentState),
styles: currentState.styles
});
};
const tester = () => 5;
const mapStateToProps = (state: JsonFormsState, ownProps: any) => {
const index = indexFromPath(ownProps.path);
const containerProperties: Property[] = findContainerProperties(
ownProps.schema,
getSchema(state) as JsonSchema7,
false
);
return {
index: index,
rootData: getData(state),
rootSchema: getSchema(state),
containerProperties
};
};
const mapStateToProps = (state: JsonFormsState, ownProps: any) => {
const containerProperties = findContainerProperties(ownProps.schema, getSchema(state) as JsonSchema7, false);
return {
rootData: getData(state),
defaultData: getDefaultData(state),
containerProperties,
rootSchema: getSchema(state),
path: ownProps.path,
schema: ownProps.schema,
closeDialog: ownProps.closeDialog,
dialogProps: ownProps.dialogProps,
setSelection: ownProps.setSelection,
labelProvider: ownProps.labelProvider
};
};
const mapStateToProps = (state, ownProps) => {
const containerProps = getContainerProperties(state);
let containerProperties;
if (_.has(containerProps, ownProps.schema.id)) {
containerProperties = containerProps[ownProps.schema.id];
} else {
containerProperties = retrieveContainerProperties(ownProps.schema, ownProps.schema);
}
return {
rootData: getData(state),
containerProperties,
rootSchema: getSchema(state),
};
};
const App = ({
store,
filterPredicate,
labelProviders,
imageProvider
}: AppParameter) => (
);
const mapStateToProps = (state: JsonFormsState, ownProps: any) => {
const index = indexFromPath(ownProps.path);
const containerProperties: Property[] = findContainerProperties(
ownProps.schema,
getSchema(state) as JsonSchema7,
false
);
return {
index: index,
rootData: getData(state),
rootSchema: getSchema(state),
containerProperties
};
};