feat(docs): Add Alert, Anchor, Avatar and Breadcrumb docs.

This commit is contained in:
Gervwyk 2021-02-01 11:32:10 +02:00
parent bc2fda9701
commit 098360766d
10 changed files with 579 additions and 88 deletions

View File

@ -1,6 +1,11 @@
{
"category": "display",
"loading": false,
"loading": {
"type": "Skeleton",
"properties": {
"height": 40
}
},
"schema": {
"properties": {
"type": "object",
@ -8,10 +13,12 @@
"properties": {
"banner": {
"type": "boolean",
"default": false,
"description": "Style as banner at top of application window."
},
"closable": {
"type": "boolean",
"default": false,
"description": "Allow alert to be closed."
},
"closeText": {
@ -24,7 +31,10 @@
},
"icon": {
"type": ["string", "object"],
"description": "Name of an Ant Design Icon or properties of an Icon block to customize alert icon."
"description": "Name of an Ant Design Icon or properties of an Icon block to customize alert icon.",
"docs": {
"displayType": "icon"
}
},
"message": {
"type": "string",
@ -48,10 +58,12 @@
"additionalProperties": false,
"properties": {
"onClose": {
"type": "array"
"type": "array",
"description": "Called when Alert close button is clicked."
},
"afterClose": {
"type": "array"
"type": "array",
"description": "Called after Alert has been closed."
}
}
}

View File

@ -1,6 +1,11 @@
{
"category": "display",
"loading": false,
"loading": {
"type": "SkeletonParagraph",
"properties": {
"lines": 1
}
},
"schema": {
"properties": {
"type": "object",
@ -8,19 +13,27 @@
"properties": {
"disabled": {
"type": "boolean",
"default": false,
"description": "Disable the anchor if true."
},
"icon": {
"type": ["string", "object"],
"description": "Name of an Ant Design Icon or properties of an Icon block for anchor icon."
"description": "Name of an Ant Design Icon or properties of an Icon block for anchor icon.",
"docs": {
"displayType": "icon"
}
},
"strong": {
"type": "boolean",
"default": false,
"description": "Makes the text bold when true."
},
"style": {
"type": "object",
"description": "Css style object to applied to anchor."
"description": "Css style object to applied to anchor.",
"docs": {
"displayType": "style"
}
},
"title": {
"type": "string",
@ -33,7 +46,8 @@
"additionalProperties": false,
"properties": {
"onClick": {
"type": "array"
"type": "array",
"description": "Called when Anchor is clicked."
}
}
}

View File

@ -1,6 +1,8 @@
{
"category": "display",
"loading": false,
"loading": {
"type": "SkeletonAvatar"
},
"schema": {
"properties": {
"type": "object",
@ -12,7 +14,10 @@
},
"color": {
"type": "string",
"description": "The background color of the avatar if not using a src url. Should be a hex color string. Color is a random color if not specified."
"description": "The background color of the avatar if not using a src url. Should be a hex color string. Color is a random color if not specified.",
"docs": {
"displayType": "color"
}
},
"content": {
"type": "string",
@ -24,7 +29,10 @@
},
"icon": {
"type": ["string", "object"],
"description": "Name of an Ant Design Icon or properties of an Icon block to use an icon in avatar."
"description": "Name of an Ant Design Icon or properties of an Icon block to use an icon in avatar.",
"docs": {
"displayType": "icon"
}
},
"shape": {
"type": "string",
@ -33,8 +41,9 @@
"description": "Shape of the avatar."
},
"size": {
"type": ["string", "number", "object"],
"type": "string",
"default": "default",
"enum": ["default", "small", "large"],
"description": "Size of the avatar."
},
"src": {
@ -43,7 +52,10 @@
},
"style": {
"type": "object",
"description": "Css style object to applied to avatar."
"description": "Css style object to applied to avatar.",
"docs": {
"displayType": "style"
}
}
}
},

View File

@ -1,6 +1,11 @@
{
"category": "display",
"loading": false,
"loading": {
"type": "SkeletonParagraph",
"properties": {
"lines": 1
}
},
"schema": {
"properties": {
"type": "object",
@ -13,7 +18,10 @@
},
"style": {
"type": "object",
"description": "Css style object to applied to breadcrumb."
"description": "Css style object to applied to breadcrumb.",
"docs": {
"displayType": "style"
}
},
"list": {
"type": "array",
@ -42,6 +50,252 @@
"description": "Name of an Ant Design Icon or properties of an Icon block to use an icon in breadcrumb link."
}
}
},
"docs": {
"displayType": "manual",
"getter": {
"_if": {
"test": {
"_eq": [
{
"_state": "__listType"
},
"string"
]
},
"then": {
"_get": {
"key": "0.list",
"from": {
"_mql.aggregate": {
"pipeline": [
{
"$addFields": {
"list": "$list.string"
}
}
],
"on": [
{
"_state": "block.properties"
}
]
}
}
}
},
"else": {
"_state": "block.properties.list"
}
}
},
"block": {
"id": "_card.block.properties.list",
"type": "Card",
"layout": {
"contentGutter": 0
},
"properties": {
"title": "list:",
"size": "small",
"inner": true,
"bodyStyle": {
"padding": 0
}
},
"areas": {
"extra": {
"blocks": [
{
"id": "__listType",
"type": "ButtonSelector",
"properties": {
"label": {
"disabled": true
},
"size": "small",
"options": ["string", "object"]
}
}
]
},
"content": {
"blocks": [
{
"id": "block.properties.list",
"type": "ControlledList",
"properties": {
"size": "small"
},
"blocks": [
{
"id": "block.properties.list.$.string",
"type": "TextInput",
"visible": {
"_if": {
"test": {
"_eq": [
{
"_state": "__listType"
},
"string"
]
},
"then": true,
"else": false
}
},
"properties": {
"size": "small",
"label": {
"disabled": true
}
}
},
{
"id": "block.properties.list.$.icon",
"type": "Selector",
"visible": {
"_if": {
"test": {
"_eq": [
{
"_state": "__listType"
},
"object"
]
},
"then": true,
"else": false
}
},
"properties": {
"size": "small",
"title": "icon",
"label": {
"span": 8,
"align": "right",
"extra": "Name of an Ant Design Icon or properties of an Icon block to use an icon in breadcrumb link."
},
"showSearch": true,
"allowClear": true,
"options": { "_global": "all_icons" }
}
},
{
"id": "block.properties.list.$.label",
"type": "TextInput",
"visible": {
"_if": {
"test": {
"_eq": [
{
"_state": "__listType"
},
"object"
]
},
"then": true,
"else": false
}
},
"properties": {
"size": "small",
"title": "label",
"label": {
"span": 8,
"align": "right",
"extra": "Label of the breadcrumb link."
}
}
},
{
"id": "block.properties.list.$.pageId",
"type": "TextInput",
"visible": {
"_if": {
"test": {
"_eq": [
{
"_state": "__listType"
},
"object"
]
},
"then": true,
"else": false
}
},
"properties": {
"size": "small",
"title": "pageId",
"label": {
"span": 8,
"align": "right",
"extra": "Page id to link to when clicked."
}
}
},
{
"id": "block.properties.list.$.style",
"type": "TextArea",
"visible": {
"_if": {
"test": {
"_eq": [
{
"_state": "__listType"
},
"object"
]
},
"then": true,
"else": false
}
},
"properties": {
"size": "small",
"title": "style",
"label": {
"span": 8,
"align": "right",
"extra": "Css style to apply to link."
}
}
},
{
"id": "block.properties.list.$.url",
"type": "TextInput",
"visible": {
"_if": {
"test": {
"_eq": [
{
"_state": "__listType"
},
"object"
]
},
"then": true,
"else": false
}
},
"properties": {
"size": "small",
"title": "url",
"label": {
"span": 8,
"align": "right",
"extra": "External url link.External url link."
}
}
}
]
}
]
}
}
}
}
}
}

View File

@ -0,0 +1,43 @@
# Copyright 2020-2021 Lowdefy, Inc
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
_ref:
path: templates/blocks/template.yaml.njk
vars:
block_type: Alert
category: display
init_property_values:
message: Alerts help to highlight important information.
description_content: |
Alert is used to render user feedback messages in a Alert styled frame.
default_properties:
_ref:
path: ../blocks/blocksAntd/src/blocks/Alert/Alert.json
transformer: templates/blocks/defaultValueTransformer.js
properties_getter:
_ref:
path: ../blocks/blocksAntd/src/blocks/Alert/Alert.json
transformer: templates/blocks/propertiesGetterTransformer.js
properties_form:
_ref:
path: ../blocks/blocksAntd/src/blocks/Alert/Alert.json
transformer: templates/blocks/propertiesFormTransformer.js
available_actions_description: |
###### onClose
Called when Alert close button is clicked.
###### afterClose
Called after Alert has been closed.
examples:
- title: Basic Alert
properties: '{"message": "Basic Alert"}'

View File

@ -0,0 +1,39 @@
# Copyright 2020-2021 Lowdefy, Inc
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
_ref:
path: templates/blocks/template.yaml.njk
vars:
block_type: Anchor
category: display
description_content: |
Anchor link block. Creates a clickable icon and/ or text.
default_properties:
_ref:
path: ../blocks/blocksAntd/src/blocks/Anchor/Anchor.json
transformer: templates/blocks/defaultValueTransformer.js
properties_getter:
_ref:
path: ../blocks/blocksAntd/src/blocks/Anchor/Anchor.json
transformer: templates/blocks/propertiesGetterTransformer.js
properties_form:
_ref:
path: ../blocks/blocksAntd/src/blocks/Anchor/Anchor.json
transformer: templates/blocks/propertiesFormTransformer.js
available_actions_description: |
###### onClick
Called when Anchor is clicked.
examples:
- title: Basic Anchor
properties: '{"title": "Basic Anchor"}'

View File

@ -0,0 +1,39 @@
# Copyright 2020-2021 Lowdefy, Inc
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
_ref:
path: templates/blocks/template.yaml.njk
vars:
block_type: Avatar
category: display
description_content: |
Avatars can be used to represent people or objects. It supports images, Icons, or letters.
default_properties:
_ref:
path: ../blocks/blocksAntd/src/blocks/Avatar/Avatar.json
transformer: templates/blocks/defaultValueTransformer.js
properties_getter:
_ref:
path: ../blocks/blocksAntd/src/blocks/Avatar/Avatar.json
transformer: templates/blocks/propertiesGetterTransformer.js
properties_form:
_ref:
path: ../blocks/blocksAntd/src/blocks/Avatar/Avatar.json
transformer: templates/blocks/propertiesFormTransformer.js
available_actions_description: |
###### onClick
Called when Avatar is clicked.
examples:
- title: Basic Avatar
properties: '{"color": "#456789"}'

View File

@ -0,0 +1,47 @@
# Copyright 2020-2021 Lowdefy, Inc
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
_ref:
path: templates/blocks/template.yaml.njk
vars:
block_type: Breadcrumb
category: display
init_state_values:
__listType: object
init_property_values:
list:
- label: A List
string: A List
- label: Of Items
string: Of Items
description_content: |
A breadcrumb displays the current location within a hierarchy. It allows going back to states higher up in the hierarchy with provided links.
default_properties:
_ref:
path: ../blocks/blocksAntd/src/blocks/Breadcrumb/Breadcrumb.json
transformer: templates/blocks/defaultValueTransformer.js
properties_getter:
_ref:
path: ../blocks/blocksAntd/src/blocks/Breadcrumb/Breadcrumb.json
transformer: templates/blocks/propertiesGetterTransformer.js
properties_form:
_ref:
path: ../blocks/blocksAntd/src/blocks/Breadcrumb/Breadcrumb.json
transformer: templates/blocks/propertiesFormTransformer.js
available_actions_description: |
###### onClick
Triggered when breadcrumb item is clicked. Provides clicked link and index as args.
examples:
- title: Basic Breadcrumb
properties: '{"list": ["Page One","Page Two"]}'

View File

@ -208,6 +208,18 @@ menus:
title: Display Blocks
icon: PictureOutlined
links:
- id: Alert
type: MenuLink
pageId: Alert
- id: Anchor
type: MenuLink
pageId: Anchor
- id: Avatar
type: MenuLink
pageId: Avatar
- id: Breadcrumb
type: MenuLink
pageId: Breadcrumb
- id: Button
type: MenuLink
pageId: Button
@ -432,6 +444,10 @@ pages:
- _ref: blocks/input/TitleInput.yaml
- _ref: blocks/input/WeekSelector.yaml
- _ref: blocks/display/Alert.yaml
- _ref: blocks/display/Anchor.yaml
- _ref: blocks/display/Avatar.yaml
- _ref: blocks/display/Breadcrumb.yaml
- _ref: blocks/display/Button.yaml
- _ref: connections/AWSS3.yaml

View File

@ -345,88 +345,103 @@ function makeBlockDefinition(propertyName, propertyDescription, requiredProperti
];
return block;
case 'optionsSelector':
block.type = 'Box';
block.blocks = [
{
id: '__optionsType',
type: 'ButtonSelector',
properties: {
title: 'Options type',
options: ['Primitive', 'Label-value pairs'],
size: 'small',
label: { span: 8, align: 'right' },
},
block.type = 'Card';
block.layout = {
contentGutter: 0,
};
block.properties = {
title: 'options:',
size: 'small',
inner: true,
bodyStyle: {
padding: 0,
},
{
id: `block.properties.options`,
type: 'ControlledList',
properties: {
title: 'options:',
size: 'small',
},
};
block.areas = {
extra: {
blocks: [
{
id: `block.properties.options.$.primitive`,
type: 'TextInput',
visible: {
_if: {
test: { _eq: [{ _state: '__optionsType' }, 'Primitive'] },
then: true,
else: false,
},
},
id: '__optionsType',
type: 'ButtonSelector',
properties: {
options: ['Primitive', 'Label-value pairs'],
size: 'small',
label: {
disabled: true,
},
},
},
{
id: `block.properties.options.$.label`,
type: 'TextInput',
visible: {
_if: {
test: {
_eq: [{ _state: '__optionsType' }, 'Label-value pairs'],
},
then: true,
else: false,
},
},
properties: {
size: 'small',
title: 'label',
label: {
span: 8,
align: 'right',
},
},
},
{
id: `block.properties.options.$.value`,
type: 'TextInput',
visible: {
_if: {
test: {
_eq: [{ _state: '__optionsType' }, 'Label-value pairs'],
},
then: true,
else: false,
},
},
properties: {
size: 'small',
title: 'value',
label: {
span: 8,
align: 'right',
},
label: { disabled: true },
},
},
],
},
];
content: {
blocks: [
{
id: `block.properties.options`,
type: 'ControlledList',
properties: { size: 'small' },
blocks: [
{
id: `block.properties.options.$.primitive`,
type: 'TextInput',
visible: {
_if: {
test: { _eq: [{ _state: '__optionsType' }, 'Primitive'] },
then: true,
else: false,
},
},
properties: {
size: 'small',
label: {
disabled: true,
},
},
},
{
id: `block.properties.options.$.label`,
type: 'TextInput',
visible: {
_if: {
test: {
_eq: [{ _state: '__optionsType' }, 'Label-value pairs'],
},
then: true,
else: false,
},
},
properties: {
size: 'small',
title: 'label',
label: {
span: 8,
align: 'right',
},
},
},
{
id: `block.properties.options.$.value`,
type: 'TextInput',
visible: {
_if: {
test: {
_eq: [{ _state: '__optionsType' }, 'Label-value pairs'],
},
then: true,
else: false,
},
},
properties: {
size: 'small',
title: 'value',
label: {
span: 8,
align: 'right',
},
},
},
],
},
],
},
};
return block;
case 'TextInput':
block.type = 'TextInput';