Dmitrii Filippov | daf0ec9 | 2020-03-17 11:27:28 +0100 | [diff] [blame] | 1 | /** |
| 2 | * @license |
| 3 | * Copyright (C) 2020 The Android Open Source Project |
| 4 | * |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at |
| 8 | * |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | * |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
| 16 | */ |
| 17 | import {html} from '@polymer/polymer/lib/utils/html-tag.js'; |
Kasper Nilsson | fb5b711 | 2018-11-15 11:46:17 -0800 | [diff] [blame] | 18 | |
Dmitrii Filippov | daf0ec9 | 2020-03-17 11:27:28 +0100 | [diff] [blame] | 19 | export const htmlTemplate = html` |
Tao Zhou | b203c26 | 2020-04-27 12:24:31 +0200 | [diff] [blame] | 20 | <style include="shared-styles"> |
| 21 | /* Workaround for empty style block - see https://github.com/Polymer/tools/issues/408 */ |
| 22 | </style> |
| 23 | <style include="gr-form-styles"> |
| 24 | /* Workaround for empty style block - see https://github.com/Polymer/tools/issues/408 */ |
| 25 | </style> |
| 26 | <style include="gr-subpage-styles"> |
| 27 | .inherited { |
| 28 | color: var(--deemphasized-text-color); |
| 29 | margin-left: var(--spacing-m); |
| 30 | } |
| 31 | section.section:not(.ARRAY) .title { |
| 32 | align-items: center; |
| 33 | display: flex; |
| 34 | } |
| 35 | section.section.ARRAY .title { |
| 36 | padding-top: var(--spacing-m); |
| 37 | } |
| 38 | </style> |
| 39 | <div class="gr-form-styles"> |
| 40 | <fieldset> |
| 41 | <h4>[[pluginData.name]]</h4> |
| 42 | <template is="dom-repeat" items="[[_pluginConfigOptions]]" as="option"> |
| 43 | <section class$="section [[option.info.type]]"> |
| 44 | <span class="title"> |
| 45 | <gr-tooltip-content |
| 46 | has-tooltip="[[option.info.description]]" |
| 47 | show-icon="[[option.info.description]]" |
| 48 | title="[[option.info.description]]" |
| 49 | > |
| 50 | <span>[[option.info.display_name]]</span> |
| 51 | </gr-tooltip-content> |
| 52 | </span> |
| 53 | <span class="value"> |
| 54 | <template is="dom-if" if="[[_isArray(option.info.type)]]"> |
| 55 | <gr-plugin-config-array-editor |
| 56 | on-plugin-config-option-changed="_handleArrayChange" |
| 57 | plugin-option="[[option]]" |
| 58 | ></gr-plugin-config-array-editor> |
| 59 | </template> |
| 60 | <template is="dom-if" if="[[_isBoolean(option.info.type)]]"> |
| 61 | <paper-toggle-button |
| 62 | checked="[[_computeChecked(option.info.value)]]" |
| 63 | on-change="_handleBooleanChange" |
| 64 | data-option-key$="[[option._key]]" |
| 65 | disabled$="[[_computeDisabled(option.info.editable)]]" |
| 66 | ></paper-toggle-button> |
| 67 | </template> |
| 68 | <template is="dom-if" if="[[_isList(option.info.type)]]"> |
| 69 | <gr-select |
| 70 | bind-value$="[[option.info.value]]" |
| 71 | on-change="_handleListChange" |
| 72 | > |
| 73 | <select |
| 74 | data-option-key$="[[option._key]]" |
| 75 | disabled$="[[_computeDisabled(option.info.editable)]]" |
| 76 | > |
| 77 | <template |
| 78 | is="dom-repeat" |
| 79 | items="[[option.info.permitted_values]]" |
| 80 | as="value" |
| 81 | > |
| 82 | <option value$="[[value]]">[[value]]</option> |
| 83 | </template> |
| 84 | </select> |
| 85 | </gr-select> |
| 86 | </template> |
| 87 | <template is="dom-if" if="[[_isString(option.info.type)]]"> |
| 88 | <iron-input |
| 89 | bind-value="[[option.info.value]]" |
| 90 | on-input="_handleStringChange" |
| 91 | data-option-key$="[[option._key]]" |
| 92 | disabled$="[[_computeDisabled(option.info.editable)]]" |
| 93 | > |
| 94 | <input |
| 95 | is="iron-input" |
| 96 | value="[[option.info.value]]" |
| 97 | on-input="_handleStringChange" |
| 98 | data-option-key$="[[option._key]]" |
| 99 | disabled$="[[_computeDisabled(option.info.editable)]]" |
| 100 | /> |
| 101 | </iron-input> |
| 102 | </template> |
| 103 | <template is="dom-if" if="[[option.info.inherited_value]]"> |
| 104 | <span class="inherited"> |
| 105 | (Inherited: [[option.info.inherited_value]]) |
| 106 | </span> |
| 107 | </template> |
| 108 | </span> |
| 109 | </section> |
| 110 | </template> |
| 111 | </fieldset> |
| 112 | </div> |
Dmitrii Filippov | daf0ec9 | 2020-03-17 11:27:28 +0100 | [diff] [blame] | 113 | `; |