Nav apraksta

ons-carousel-item.js 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 util from '../ons/util';
  20. import BaseElement from './base/base-element';
  21. import ModifierUtil from '../ons/internal/modifier-util';
  22. var scheme = { '': 'carousel-item--*' };
  23. /**
  24. * @element ons-carousel-item
  25. * @category carousel
  26. * @description
  27. * [en]
  28. * Carousel item component. Used as a child of the `<ons-carousel>` element.
  29. * [/en]
  30. * [ja][/ja]
  31. * @codepen xbbzOQ
  32. * @tutorial vanilla/Reference/carousel
  33. * @seealso ons-carousel
  34. * [en]`<ons-carousel>` components[/en]
  35. * [ja]<ons-carousel>コンポーネント[/ja]
  36. * @example
  37. * <ons-carousel style="width: 100%; height: 200px">
  38. * <ons-carousel-item>
  39. * ...
  40. * </ons-carousel-item>
  41. * <ons-carousel-item>
  42. * ...
  43. * </ons-carousel-item>
  44. * </ons-carousel>
  45. */
  46. var CarouselItemElement = function (_BaseElement) {
  47. _inherits(CarouselItemElement, _BaseElement);
  48. function CarouselItemElement() {
  49. _classCallCheck(this, CarouselItemElement);
  50. var _this = _possibleConstructorReturn(this, (CarouselItemElement.__proto__ || _Object$getPrototypeOf(CarouselItemElement)).call(this));
  51. _this.style.width = '100%';
  52. ModifierUtil.initModifier(_this, scheme);
  53. return _this;
  54. }
  55. _createClass(CarouselItemElement, [{
  56. key: 'attributeChangedCallback',
  57. value: function attributeChangedCallback(name, last, current) {
  58. if (name === 'modifier') {
  59. return ModifierUtil.onModifierChanged(last, current, this, scheme);
  60. }
  61. }
  62. }], [{
  63. key: 'observedAttributes',
  64. get: function get() {
  65. return ['modifier'];
  66. }
  67. }]);
  68. return CarouselItemElement;
  69. }(BaseElement);
  70. export default CarouselItemElement;
  71. onsElements.CarouselItem = CarouselItemElement;
  72. customElements.define('ons-carousel-item', CarouselItemElement);