Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

ons-list-title.js 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. import _Object$getPrototypeOf from 'babel-runtime/core-js/object/get-prototype-of';
  2. import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
  3. import _createClass from 'babel-runtime/helpers/createClass';
  4. import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
  5. import _inherits from 'babel-runtime/helpers/inherits';
  6. /*
  7. Copyright 2013-2015 ASIAL CORPORATION
  8. Licensed under the Apache License, Version 2.0 (the "License");
  9. you may not use this file except in compliance with the License.
  10. You may obtain a copy of the License at
  11. http://www.apache.org/licenses/LICENSE-2.0
  12. Unless required by applicable law or agreed to in writing, software
  13. distributed under the License is distributed on an "AS IS" BASIS,
  14. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. See the License for the specific language governing permissions and
  16. limitations under the License.
  17. */
  18. import onsElements from '../ons/elements';
  19. import BaseElement from './base/base-element';
  20. import autoStyle from '../ons/autostyle';
  21. import ModifierUtil from '../ons/internal/modifier-util';
  22. import util from '../ons/util';
  23. var defaultClassName = 'list-title';
  24. var scheme = { '': 'list-title--*' };
  25. /**
  26. * @element ons-list-title
  27. * @category list
  28. * @description
  29. * [en]Represents a list title.[/en]
  30. * [ja]リストのタイトルを表現します。[/ja]
  31. * @example
  32. * <ons-list-title>List Title</ons-list-title>
  33. * <ons-list>
  34. * <ons-list-item>Item</ons-list-item>
  35. * </ons-list>
  36. * @modifier material
  37. * [en]Display a Material Design list title.[/en]
  38. * [ja][/ja]
  39. */
  40. var ListTitleElement = function (_BaseElement) {
  41. _inherits(ListTitleElement, _BaseElement);
  42. function ListTitleElement() {
  43. _classCallCheck(this, ListTitleElement);
  44. var _this = _possibleConstructorReturn(this, (ListTitleElement.__proto__ || _Object$getPrototypeOf(ListTitleElement)).call(this));
  45. _this._compile();
  46. return _this;
  47. }
  48. _createClass(ListTitleElement, [{
  49. key: '_compile',
  50. value: function _compile() {
  51. autoStyle.prepare(this);
  52. this.classList.add(defaultClassName);
  53. ModifierUtil.initModifier(this, scheme);
  54. }
  55. }, {
  56. key: 'attributeChangedCallback',
  57. value: function attributeChangedCallback(name, last, current) {
  58. switch (name) {
  59. case 'class':
  60. util.restoreClass(this, defaultClassName, scheme);
  61. break;
  62. case 'modifier':
  63. ModifierUtil.onModifierChanged(last, current, this, scheme);
  64. break;
  65. }
  66. }
  67. }], [{
  68. key: 'observedAttributes',
  69. get: function get() {
  70. return ['modifier', 'class'];
  71. }
  72. }]);
  73. return ListTitleElement;
  74. }(BaseElement);
  75. export default ListTitleElement;
  76. onsElements.ListTitle = ListTitleElement;
  77. customElements.define('ons-list-title', ListTitleElement);