Browse Source

Add PropertySelect in docs

up-style-manager
Artur Arseniev 5 years ago
parent
commit
27f5e6e545
  1. 1
      docs/.vuepress/config.js
  2. 1
      docs/api.js
  3. 72
      docs/api/property_select.md
  4. 2
      src/style_manager/model/PropertySelect.js

1
docs/.vuepress/config.js

@ -75,6 +75,7 @@ module.exports = {
['/api/sector', `${subDivider}Sector`],
['/api/property', `${subDivider}Property`],
['/api/property_number', `${subDivider}PropertyNumber`],
['/api/property_select', `${subDivider}PropertySelect`],
['/api/storage_manager', 'Storage Manager'],
['/api/device_manager', 'Device Manager'],
['/api/device', `${subDivider}Device`],

1
docs/api.js

@ -24,6 +24,7 @@ async function generateDocs () {
['style_manager/model/Sector.js', 'sector.md'],
['style_manager/model/Property.js', 'property.md'],
['style_manager/model/PropertyNumber.js', 'property_number.md'],
['style_manager/model/PropertySelect.js', 'property_select.md'],
['storage_manager/index.js', 'storage_manager.md'],
['device_manager/index.js', 'device_manager.md'],
['device_manager/model/Device.js', 'device.md'],

72
docs/api/property_select.md

@ -0,0 +1,72 @@
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
## PropertySelect
**Extends Property**
### Properties
* `options` **[Array][1]<[Object][2]>** Array of option definitions, eg `[{ id: '100', label: 'Set 100' }]`
### getOptions
Get available options.
Returns **[Array][1]<[Object][2]>** Array of options
### getOption
Get current selected option or by id.
#### Parameters
* `id` **[String][3]** Option id.
Returns **([Object][2] | null)**
### setOptions
Update options.
#### Parameters
* `value` **[Array][1]<[Object][2]>** New array of options, eg. `[{ id: 'val-1', label: 'Value 1' }]` (optional, default `[]`)
### addOption
Add new option.
#### Parameters
* `value` **[Object][2]** Option object, eg. `{ id: 'val-1', label: 'Value 1' }`
### getOptionId
Get the option id from the option object.
#### Parameters
* `option` **[Object][2]** Option object
Returns **[String][3]** Option id
### getOptionLabel
Get option label.
#### Parameters
* `id` **[String][3]** Option id
* `opts` **[Object][2]** Options (optional, default `{}`)
* `opts.locale` **[Boolean][4]** Use the locale string from i18n module (optional, default `true`)
Returns **[String][3]** Option label
[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean

2
src/style_manager/model/PropertySelect.js

@ -25,7 +25,7 @@ export default class PropertySelect extends Property {
/**
* Get current selected option or by id.
* @param {String} id Option id.
* @param {String} [id] Option id.
* @returns {Object | null}
*/
getOption(id) {

Loading…
Cancel
Save