@data-driven-forms/editor-core
Advanced tools
Comparing version 0.0.7 to 0.0.8
import React from 'react'; | ||
import { ProviderProps } from '@data-driven-forms/dnd'; | ||
import { AnyObject } from '../types'; | ||
import { Schema } from '@data-driven-forms/react-form-renderer'; | ||
export interface EditorProps extends AnyObject, Partial<ProviderProps> { | ||
initialSchema?: Schema; | ||
} | ||
declare const Editor: React.FC<EditorProps>; | ||
export default Editor; |
@@ -33,4 +33,4 @@ "use strict"; | ||
var Editor = function (_a) { | ||
var children = _a.children, props = __rest(_a, ["children"]); | ||
var _b = (0, use_editor_1.default)(), state = _b[0], dispatch = _b[1]; | ||
var children = _a.children, initialSchema = _a.initialSchema, props = __rest(_a, ["children", "initialSchema"]); | ||
var _b = (0, use_editor_1.default)({ initialSchema: initialSchema }), state = _b[0], dispatch = _b[1]; | ||
return (react_1.default.createElement(provider_1.default, __assign({ dispatch: dispatch, state: state }, props), children)); | ||
@@ -37,0 +37,0 @@ }; |
import React from 'react'; | ||
import { ProviderProps } from '@data-driven-forms/dnd'; | ||
import { AnyObject } from '../types'; | ||
import { Schema } from '@data-driven-forms/react-form-renderer'; | ||
export interface EditorProps extends AnyObject, Partial<ProviderProps> { | ||
initialSchema?: Schema; | ||
} | ||
declare const Editor: React.FC<EditorProps>; | ||
export default Editor; |
@@ -28,4 +28,4 @@ var __assign = (this && this.__assign) || function () { | ||
var Editor = function (_a) { | ||
var children = _a.children, props = __rest(_a, ["children"]); | ||
var _b = useEditor(), state = _b[0], dispatch = _b[1]; | ||
var children = _a.children, initialSchema = _a.initialSchema, props = __rest(_a, ["children", "initialSchema"]); | ||
var _b = useEditor({ initialSchema: initialSchema }), state = _b[0], dispatch = _b[1]; | ||
return (React.createElement(Provider, __assign({ dispatch: dispatch, state: state }, props), children)); | ||
@@ -32,0 +32,0 @@ }; |
@@ -1,2 +0,6 @@ | ||
declare function useEditor(): [any, any]; | ||
import { Schema } from '@data-driven-forms/react-form-renderer'; | ||
export interface UseEditorProps { | ||
initialSchema?: Schema; | ||
} | ||
declare function useEditor(props?: UseEditorProps): [any, any]; | ||
export default useEditor; |
@@ -15,10 +15,7 @@ var __assign = (this && this.__assign) || function () { | ||
import reducer from '../reducer'; | ||
function useEditor() { | ||
import convertSchema from '../convert-schema'; | ||
function useEditor(props) { | ||
var _a = useReducer(reducer, null, function () { | ||
return __assign(__assign({}, clearDrag), { components: {}, containers: { | ||
root: { | ||
children: [], | ||
ref: null | ||
} | ||
}, selectedComponent: null, showSchema: false, mode: 'build' }); | ||
var _a = convertSchema(props === null || props === void 0 ? void 0 : props.initialSchema), containers = _a.containers, components = _a.components; | ||
return __assign(__assign({}, clearDrag), { components: components, containers: containers, selectedComponent: null, showSchema: false, mode: 'build' }); | ||
}), state = _a[0], dispatch = _a[1]; | ||
@@ -25,0 +22,0 @@ return [state, dispatch]; |
{ | ||
"name": "@data-driven-forms/editor-core", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "---", | ||
@@ -15,3 +15,3 @@ "main": "index.js", | ||
"peerDependencies": { | ||
"@data-driven-forms/dnd": "^0.0.6" | ||
"@data-driven-forms/dnd": "^0.0.7" | ||
}, | ||
@@ -18,0 +18,0 @@ "devDependencies": { |
@@ -1,2 +0,6 @@ | ||
declare function useEditor(): [any, any]; | ||
import { Schema } from '@data-driven-forms/react-form-renderer'; | ||
export interface UseEditorProps { | ||
initialSchema?: Schema; | ||
} | ||
declare function useEditor(props?: UseEditorProps): [any, any]; | ||
export default useEditor; |
@@ -20,10 +20,7 @@ "use strict"; | ||
var reducer_2 = __importDefault(require("../reducer")); | ||
function useEditor() { | ||
var convert_schema_1 = __importDefault(require("../convert-schema")); | ||
function useEditor(props) { | ||
var _a = (0, react_1.useReducer)(reducer_2.default, null, function () { | ||
return __assign(__assign({}, reducer_1.clearDrag), { components: {}, containers: { | ||
root: { | ||
children: [], | ||
ref: null | ||
} | ||
}, selectedComponent: null, showSchema: false, mode: 'build' }); | ||
var _a = (0, convert_schema_1.default)(props === null || props === void 0 ? void 0 : props.initialSchema), containers = _a.containers, components = _a.components; | ||
return __assign(__assign({}, reducer_1.clearDrag), { components: components, containers: containers, selectedComponent: null, showSchema: false, mode: 'build' }); | ||
}), state = _a[0], dispatch = _a[1]; | ||
@@ -30,0 +27,0 @@ return [state, dispatch]; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
92395
151
1398