@esydoc/resolver-demo
Advanced tools
Comparing version 1.0.13 to 1.0.14
{ | ||
"name": "@esydoc/resolver-demo", | ||
"version": "1.0.13", | ||
"version": "1.0.14", | ||
"description": "> TODO: description", | ||
@@ -22,4 +22,4 @@ "author": "Alex <857276958@qq.com>", | ||
"dependencies": { | ||
"@esydoc/path-filter": "^1.0.13", | ||
"@esydoc/share": "^1.0.13", | ||
"@esydoc/path-filter": "^1.0.14", | ||
"@esydoc/share": "^1.0.14", | ||
"chalk": "^4.1.0", | ||
@@ -31,3 +31,3 @@ "fs-extra": "^9.0.1", | ||
"devDependencies": { | ||
"@esydoc/plugin-codegen": "^1.0.13" | ||
"@esydoc/plugin-codegen": "^1.0.14" | ||
}, | ||
@@ -37,3 +37,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "81ec75a6f2dc92397e7f8bc0950812e098e6fde0" | ||
"gitHead": "19324a5db25940ea683ba2d65ac741b72427237d" | ||
} |
@@ -111,3 +111,3 @@ import React, { useState, useCallback, useRef, useMemo } from 'react' | ||
function applyApi(path, args) { | ||
function applyApi(path, args, host) { | ||
const pathFragment = path.split('.') | ||
@@ -120,3 +120,3 @@ let apiRef | ||
return keep | ||
}, global.hyExt) | ||
}, host || global.hyExt) | ||
if (typeof apiRef !== 'function') | ||
@@ -136,6 +136,6 @@ throw new Error(`The ${path} api was not found.`) | ||
function applyApiWithLogs(path, args) { | ||
function applyApiWithLogs(path, args, host) { | ||
updateLogs(path, 'pending', args) | ||
applyApi(path, args) | ||
applyApi(path, args, host) | ||
.then(res => updateLogs(path, 'success', res)) | ||
@@ -243,6 +243,6 @@ .catch(e => updateLogs(path, 'fail', e)) | ||
function createSimpleDemo(path) { | ||
function createSimpleDemo(path, host) { | ||
const SimpleDemo = function () { | ||
const callApi = useCallback(() => { | ||
applyApiWithLogs(path, []) | ||
applyApiWithLogs(path, [], host) | ||
}, [path]) | ||
@@ -258,3 +258,3 @@ | ||
function createFormDemo(config) { | ||
const { args, path, validate, interceptors } = config | ||
const { args, path, validate, interceptors, host } = config | ||
@@ -360,3 +360,3 @@ const descriptionList = resolveArgs(args) | ||
applyApiWithLogs(path, args) | ||
applyApiWithLogs(path, args, host) | ||
}, [state, formRef]) | ||
@@ -405,6 +405,6 @@ | ||
export function createDemoComponent(config) { | ||
const { args, path } = config | ||
const { args, path, host } = config | ||
if (!args.length) { | ||
return createSimpleDemo(path) | ||
return createSimpleDemo(path, host) | ||
} | ||
@@ -411,0 +411,0 @@ |
857466
Updated@esydoc/path-filter@^1.0.14
Updated@esydoc/share@^1.0.14