json-react-layouts-data-loader
Advanced tools
Comparing version 1.0.2 to 1.1.0
import React from 'react'; | ||
import { ComponentRendererMiddleware, RenderFunctionServices, ComponentRegistration } from 'json-react-layouts'; | ||
import { ComponentRendererMiddleware, ComponentRegistration } from 'json-react-layouts'; | ||
import { DataLoaderResources } from 'react-ssr-data-loader'; | ||
import { DataDefinition, MaybeLoaded } from './DataLoading'; | ||
import { DataLoaderResources } from 'react-ssr-data-loader'; | ||
declare type RenderComponentWithDataProps<TProps extends {}, TData, TConfig extends {}, LoadDataServices> = (props: TProps, dataProps: MaybeLoaded<TData> & { | ||
import { getComponentDataArgs } from './get-data-args'; | ||
declare type RenderComponentWithDataProps<ComponentProps extends {}, TData, TConfig extends {}, Services> = (props: ComponentProps, dataProps: MaybeLoaded<TData> & { | ||
dataDefinitionArgs: TConfig; | ||
}, services: RenderFunctionServices<LoadDataServices>) => React.ReactElement<any> | false | null; | ||
export declare function init<LoadDataServices>(resources: DataLoaderResources<LoadDataServices>): { | ||
createRegisterableComponentWithData: <TType extends string, TProps extends {}, TConfig extends {}, TData>(type: TType, dataDefinition: DataDefinition<TConfig, TData, LoadDataServices>, render: RenderComponentWithDataProps<TProps, TData, TConfig, LoadDataServices>) => ComponentRegistration<TType, TProps & { | ||
dataDefinitionArgs: TConfig; | ||
}, LoadDataServices>; | ||
middleware: ComponentRendererMiddleware<LoadDataServices, {}>; | ||
}, services: Services) => React.ReactElement<any> | false | null; | ||
export declare function init<Services>(resources: DataLoaderResources<Services>): { | ||
createRegisterableComponentWithData: <ComponentType extends string, ComponentProps extends {}, DataLoadArgs extends {}, ComponentData>(type: ComponentType, dataDefinition: DataDefinition<DataLoadArgs, ComponentData, Services>, render: RenderComponentWithDataProps<ComponentProps, ComponentData, DataLoadArgs, Services>) => ComponentRegistration<ComponentType, ComponentProps & { | ||
dataDefinitionArgs: DataLoadArgs; | ||
}, Services>; | ||
middleware: ComponentRendererMiddleware<Services, {}>; | ||
}; | ||
export { DataDefinition, MaybeLoaded }; | ||
export { DataDefinition, MaybeLoaded, getComponentDataArgs }; |
@@ -5,2 +5,4 @@ "use strict"; | ||
var react_1 = tslib_1.__importDefault(require("react")); | ||
var get_data_args_1 = require("./get-data-args"); | ||
exports.getComponentDataArgs = get_data_args_1.getComponentDataArgs; | ||
function init(resources) { | ||
@@ -20,6 +22,3 @@ var ComponentDataLoader = resources.registerResource('component-data-loader', function (params) { | ||
middleware: function (componentProps, middlewareProps, services, next) { | ||
var componentRegistrar = services.layout.compositionRegistrar | ||
.componentRegistrar; | ||
var componentDataDefinition = componentRegistrar.get(componentProps.componentType); | ||
var dataDefinition = componentDataDefinition.dataDefinition; | ||
var dataDefinition = get_data_args_1.getComponentDataArgs(services.layout, componentProps.componentType); | ||
if (dataDefinition) { | ||
@@ -26,0 +25,0 @@ return (react_1.default.createElement(ComponentDataLoader, { layout: services.layout, componentRenderPath: componentProps.componentRenderPath, dataDefinition: dataDefinition, dataDefinitionArgs: componentProps.dataDefinitionArgs, renderData: function (renderProps) { |
import React from 'react'; | ||
import { ComponentRendererMiddleware, RenderFunctionServices, ComponentRegistration } from 'json-react-layouts'; | ||
import { ComponentRendererMiddleware, ComponentRegistration } from 'json-react-layouts'; | ||
import { DataLoaderResources } from 'react-ssr-data-loader'; | ||
import { DataDefinition, MaybeLoaded } from './DataLoading'; | ||
import { DataLoaderResources } from 'react-ssr-data-loader'; | ||
declare type RenderComponentWithDataProps<TProps extends {}, TData, TConfig extends {}, LoadDataServices> = (props: TProps, dataProps: MaybeLoaded<TData> & { | ||
import { getComponentDataArgs } from './get-data-args'; | ||
declare type RenderComponentWithDataProps<ComponentProps extends {}, TData, TConfig extends {}, Services> = (props: ComponentProps, dataProps: MaybeLoaded<TData> & { | ||
dataDefinitionArgs: TConfig; | ||
}, services: RenderFunctionServices<LoadDataServices>) => React.ReactElement<any> | false | null; | ||
export declare function init<LoadDataServices>(resources: DataLoaderResources<LoadDataServices>): { | ||
createRegisterableComponentWithData: <TType extends string, TProps extends {}, TConfig extends {}, TData>(type: TType, dataDefinition: DataDefinition<TConfig, TData, LoadDataServices>, render: RenderComponentWithDataProps<TProps, TData, TConfig, LoadDataServices>) => ComponentRegistration<TType, TProps & { | ||
dataDefinitionArgs: TConfig; | ||
}, LoadDataServices>; | ||
middleware: ComponentRendererMiddleware<LoadDataServices, {}>; | ||
}, services: Services) => React.ReactElement<any> | false | null; | ||
export declare function init<Services>(resources: DataLoaderResources<Services>): { | ||
createRegisterableComponentWithData: <ComponentType extends string, ComponentProps extends {}, DataLoadArgs extends {}, ComponentData>(type: ComponentType, dataDefinition: DataDefinition<DataLoadArgs, ComponentData, Services>, render: RenderComponentWithDataProps<ComponentProps, ComponentData, DataLoadArgs, Services>) => ComponentRegistration<ComponentType, ComponentProps & { | ||
dataDefinitionArgs: DataLoadArgs; | ||
}, Services>; | ||
middleware: ComponentRendererMiddleware<Services, {}>; | ||
}; | ||
export { DataDefinition, MaybeLoaded }; | ||
export { DataDefinition, MaybeLoaded, getComponentDataArgs }; |
import * as tslib_1 from "tslib"; | ||
import React from 'react'; | ||
import { getComponentDataArgs } from './get-data-args'; | ||
export function init(resources) { | ||
@@ -17,6 +18,3 @@ var ComponentDataLoader = resources.registerResource('component-data-loader', function (params) { | ||
middleware: function (componentProps, middlewareProps, services, next) { | ||
var componentRegistrar = services.layout.compositionRegistrar | ||
.componentRegistrar; | ||
var componentDataDefinition = componentRegistrar.get(componentProps.componentType); | ||
var dataDefinition = componentDataDefinition.dataDefinition; | ||
var dataDefinition = getComponentDataArgs(services.layout, componentProps.componentType); | ||
if (dataDefinition) { | ||
@@ -37,2 +35,3 @@ return (React.createElement(ComponentDataLoader, { layout: services.layout, componentRenderPath: componentProps.componentRenderPath, dataDefinition: dataDefinition, dataDefinitionArgs: componentProps.dataDefinitionArgs, renderData: function (renderProps) { | ||
} | ||
export { getComponentDataArgs }; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "json-react-layouts-data-loader", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"main": "dist/cjs/index.js", | ||
@@ -47,3 +47,3 @@ "module": "dist/esm/index.js", | ||
"typescript": "3.5.3", | ||
"json-react-layouts": "^1.0.5" | ||
"json-react-layouts": "^1.1.1" | ||
}, | ||
@@ -54,5 +54,5 @@ "dependencies": { | ||
"peerDependencies": { | ||
"json-react-layouts": "^1.0.5", | ||
"json-react-layouts": "^1.1.1", | ||
"react-ssr-data-loader": "^1.1.0" | ||
} | ||
} |
# JSON React layouts data loader | ||
[![Build Status](https://travis-ci.com/sevenwestmedia-labs/json-react-layouts-data-loader.svg?branch=master)](https://travis-ci.com/sevenwestmedia-labs/json-react-layouts-data-loader) | ||
[![npm](https://img.shields.io/npm/v/json-react-layouts-data-loader)](https://www.npmjs.com/package/json-react-layouts-data-loader) | ||
Component middleware for JSON React layouts which enables data loading via the [React SSR Data Loader](https://www.npmjs.com/package/react-ssr-data-loader) library. | ||
@@ -4,0 +7,0 @@ |
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
45387
42
626
40