@discoveryjs/discovery
Advanced tools
Comparing version 1.0.0-beta.51 to 1.0.0-beta.52
@@ -0,1 +1,7 @@ | ||
## 1.0.0-beta.52 (19-11-2020) | ||
- Added experimental `proxy` option for `context` view | ||
- Changed `page-header` view to pass `onInit` and `onChange` through to children | ||
- Various style fixes | ||
## 1.0.0-beta.51 (14-11-2020) | ||
@@ -2,0 +8,0 @@ |
{ | ||
"name": "@discoveryjs/discovery", | ||
"version": "1.0.0-beta.51", | ||
"version": "1.0.0-beta.52", | ||
"description": "Hackable JSON discovery tool", | ||
@@ -5,0 +5,0 @@ "author": "Roman Dvornov <rdvornov@gmail.com> (https://github.com/lahmatiy)", |
@@ -34,3 +34,3 @@ import { createElement } from '../core/utils/dom.js'; | ||
content: [ | ||
'h1:#.name', | ||
'page-header{ content: "h1:#.name" }', | ||
{ view: 'struct', expanded: 1 } | ||
@@ -37,0 +37,0 @@ ] |
@@ -35,2 +35,8 @@ /* eslint-env browser */ | ||
renderContent(); | ||
if (proxy && typeof onChange === 'function') { | ||
onChange(value, name); | ||
} | ||
} else if (typeof onInit === 'function') { | ||
onInit(value, name); | ||
} | ||
@@ -45,4 +51,4 @@ } | ||
let inited = false; | ||
let { modifiers = [] } = config; | ||
const { content = [] } = config; | ||
let { modifiers = [], content = [] } = config; | ||
const { proxy, onInit, onChange } = config; | ||
@@ -61,2 +67,6 @@ if (!Array.isArray(modifiers)) { | ||
if (proxy && (onInit || onChange)) { | ||
content = this.composeConfig(content, { onInit, onChange }); | ||
} | ||
return renderModifiers.then(() => { | ||
@@ -63,0 +73,0 @@ inited = true; |
@@ -7,11 +7,18 @@ /* eslint-env browser */ | ||
discovery.view.define('page-header', function render(el, config, data, context) { | ||
const { prelude, content } = config; | ||
const { prelude, content, onInit, onChange } = config; | ||
const preludeEl = el.appendChild(createElement('div', 'view-page-header__prelude')); | ||
const contentEl = el.appendChild(createElement('div', 'view-page-header__content')); | ||
const mixinHandlers = (config) => | ||
typeof onInit !== 'function' && typeof onChange !== 'function' | ||
? config // left as is since nothing to mix in | ||
: this.composeConfig(config, { | ||
onInit, | ||
onChange | ||
}); | ||
return Promise.all([ | ||
discovery.view.render(preludeEl, prelude || [], data, context), | ||
discovery.view.render(contentEl, content || 'text', data, context) | ||
discovery.view.render(preludeEl, mixinHandlers(prelude || []), data, context), | ||
discovery.view.render(contentEl, mixinHandlers(content || 'text'), data, context) | ||
]); | ||
}, { usage }); | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
Sorry, the diff of this file is not supported yet
1932866
16372