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

ons-splitter-mask.js 2.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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 util from '../ons/util';
  21. import contentReady from '../ons/content-ready';
  22. var SplitterMaskElement = function (_BaseElement) {
  23. _inherits(SplitterMaskElement, _BaseElement);
  24. function SplitterMaskElement() {
  25. _classCallCheck(this, SplitterMaskElement);
  26. var _this = _possibleConstructorReturn(this, (SplitterMaskElement.__proto__ || _Object$getPrototypeOf(SplitterMaskElement)).call(this));
  27. _this._boundOnClick = _this._onClick.bind(_this);
  28. contentReady(_this, function () {
  29. if (_this.parentNode._sides.every(function (side) {
  30. return side.mode === 'split';
  31. })) {
  32. _this.setAttribute('style', 'display: none !important');
  33. }
  34. });
  35. return _this;
  36. }
  37. _createClass(SplitterMaskElement, [{
  38. key: '_onClick',
  39. value: function _onClick(event) {
  40. if (this.onClick instanceof Function) {
  41. this.onClick();
  42. } else if (util.match(this.parentNode, 'ons-splitter')) {
  43. this.parentNode._sides.forEach(function (side) {
  44. return side.close('left').catch(function () {});
  45. });
  46. }
  47. event.stopPropagation();
  48. }
  49. }, {
  50. key: 'attributeChangedCallback',
  51. value: function attributeChangedCallback(name, last, current) {}
  52. }, {
  53. key: 'connectedCallback',
  54. value: function connectedCallback() {
  55. this.addEventListener('click', this._boundOnClick);
  56. util.iosMaskScrollFix(this, true);
  57. }
  58. }, {
  59. key: 'disconnectedCallback',
  60. value: function disconnectedCallback() {
  61. this.removeEventListener('click', this._boundOnClick);
  62. util.iosMaskScrollFix(this, false);
  63. }
  64. }], [{
  65. key: 'observedAttributes',
  66. get: function get() {
  67. return [];
  68. }
  69. }]);
  70. return SplitterMaskElement;
  71. }(BaseElement);
  72. export default SplitterMaskElement;
  73. onsElements.SplitterMask = SplitterMaskElement;
  74. customElements.define('ons-splitter-mask', SplitterMaskElement);