Skip to content

Commit

Permalink
docs: update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
T-Wizard committed Mar 29, 2021
1 parent b3038f7 commit cbd1d5c
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 4 deletions.
37 changes: 34 additions & 3 deletions docs/scriptappy.json
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,36 @@
}
}
},
"CustomLayoutFunction": {
"kind": "function",
"params": [
{
"name": "rect",
"type": "#/definitions/Rect"
},
{
"name": "components",
"kind": "array",
"items": {
"entries": {
"key": {
"type": "string"
},
"dockConfig": {
"type": "object"
},
"resize": {
"type": "function"
},
"preferredSize": {
"type": "function"
}
},
"kind": "object"
}
}
]
},
"ComponentSettings": {
"kind": "object",
"entries": {
Expand Down Expand Up @@ -868,8 +898,9 @@
"optional": true,
"type": "string"
},
"@experimental": {
"description": "[components] Optional list of child components",
"components": {
"description": "Optional list of child components",
"optional": true,
"kind": "array",
"items": {
"type": "#/definitions/ComponentSettings"
Expand All @@ -884,7 +915,7 @@
"type": "#/definitions/DockLayoutSettings"
},
{
"type": "function"
"type": "#/definitions/CustomLayoutFunction"
}
],
"type": "any"
Expand Down
12 changes: 11 additions & 1 deletion packages/picasso.js/src/core/chart/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ import { testRectPoint } from '../math/narrow-phase-collision';
import themeFn from '../theme';
import componentCollectionFn from './component-collection';

/**
* @callback CustomLayoutFunction
* @param {Rect} rect
* @param {object[]} components
* @param {string} components[].key
* @param {object} components[].dockConfig
* @param {function} components[].resize
* @param {function} components[].preferredSize
*/

/**
* @typedef {object} ComponentSettings
* @property {string} type - Component type (ex: axis, point, ...)
Expand All @@ -36,7 +46,7 @@ import componentCollectionFn from './component-collection';
* @property {string} [scale] Named scale. Will be provided to the component if it ask for it.
* @property {string} [formatter] Named formatter. Fallback to create formatter from scale. Will be provided to the component if it ask for it.
* @property {ComponentSettings[]} [components] Optional list of child components
* @property {DockLayoutSettings|function} [strategy] Layout strategy used for child components.
* @property {DockLayoutSettings|CustomLayoutFunction} [strategy] Layout strategy used for child components.
*/

function addComponentDelta(shape, containerBounds, componentBounds) {
Expand Down

0 comments on commit cbd1d5c

Please sign in to comment.