UNPKG

api-console-assets

Version:

This repo only exists to publish api console components to npm

123 lines (110 loc) 4.49 kB
<!-- @license Copyright 2016 The Advanced REST client authors 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. --> <link rel="import" href="../polymer/polymer.html"> <link rel="import" href="docs-parameters-behavior.html"> <link rel="import" href="docs-parameters-table-shared-styles.html"> <link rel="import" href="docs-parameters-table-row.html"> <!-- `<docs-headers-table>` A headers list documentation table for the RAML documentation view. ### Example ``` <docs-headers-table headers="[[headers]]"></docs-headers-table> ``` ### Object properties An object in headers object can contain any property that header can contain according to the RAML spec. Currently following properties are supported: - name (required) - name of the property, in case of UIR parameter it should be the parameter itself - type - the type of the parameter, any RAML allowed value will be accepted - description - description of the parameter - required - mark that the property is a required property - pattern - validation pattern to be applied to the parameter value - example - example value of the parameter - min - minimum value of the parametre when the type is numeric - max - maximum value of the parametre when the type is numeric ### Styling `<docs-headers-table>` provides the following custom properties and mixins for styling: Custom property | Description | Default ----------------|-------------|---------- `--docs-parameters-table` | Mixin applied to all parameter table elements | `{}` `--docs-parameters-url-table` | Mixin applied to this elements | `{}` `--params-table-header-background-color` | Background color of table header | `#00A1DF` `--params-table-header-color` | Font color of table header | `rgba(255, 255, 255, 0.87)` `--params-table-subheader-background-color` | Background color of table subheader | `rgba(0, 161, 223, 0.24)` `--params-table-subheader-color` | Font color of table subheader | `rgba(0, 0, 0, 0.87)` `--params-table-row-border-color` | Border color of table's each row | `#00A1DF` `--params-table-row-background-color` | Background color of table's each row | `#fff` `--params-table-row-color` | Font color of table's each row | `#fff` `--docs-parameters-table-cell` | Mixin applied to each cell | `{}` `--docs-parameters-table-meta` | Mixin applied to property's metadata (example, pattern, etc) | `{}` @group RAML Elements @element docs-parameters-table @demo demo/docs-headers-table.html --> <dom-module id="docs-headers-table"> <template> <style include="docs-parameters-table-shared-styles"></style> <div class="params-table"> <div class="thead params-table-header"> <section class="tr"> <span class="th">Parameter</span> <span class="th">Type</span> <span class="th">Description</span> </section> </div> <h5 class="narrow-title">Properties</h5> <div class="tbody"> <template is="dom-if" if="[[hasHeaders]]"> <template is="dom-repeat" items="[[headers]]"> <docs-parameters-table-row class="tr" item="[[item]]"></docs-parameters-table-row> </template> </template> </div> </div> </template> <script> Polymer({ is: 'docs-headers-table', behaviors: [RamlBehaviors.DocsParametersBehavior], properties: { /** * The RAML's headers description object. * See overview for object details. */ headers: Array, // True when `headers` are present hasHeaders: { type: Boolean, computed: '_computeHasHeaders(headers.*)', value: false, notify: true } }, observers: [ '_autoHide(autoHide, hasHeaders)' ], _computeHasHeaders: function() { return !!(this.headers && Object.keys(this.headers).length); }, _autoHide: function(autoHide, hasHeaders) { if (!autoHide) { return; } var state = !hasHeaders; this.toggleAttribute('hidden', state); } }); </script> </dom-module>