123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- import _Object$getPrototypeOf from 'babel-runtime/core-js/object/get-prototype-of';
- import _classCallCheck from 'babel-runtime/helpers/classCallCheck';
- import _createClass from 'babel-runtime/helpers/createClass';
- import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn';
- import _inherits from 'babel-runtime/helpers/inherits';
-
-
- import onsElements from '../ons/elements';
- import styler from '../ons/styler';
- import BaseElement from './base/base-element';
-
-
-
-
-
-
-
- var ColElement = function (_BaseElement) {
- _inherits(ColElement, _BaseElement);
-
- function ColElement() {
- _classCallCheck(this, ColElement);
-
- var _this = _possibleConstructorReturn(this, (ColElement.__proto__ || _Object$getPrototypeOf(ColElement)).call(this));
-
- if (_this.getAttribute('width')) {
- _this._updateWidth();
- }
- return _this;
- }
-
- _createClass(ColElement, [{
- key: 'attributeChangedCallback',
- value: function attributeChangedCallback(name, last, current) {
- if (name === 'width') {
- this._updateWidth();
- }
- }
- }, {
- key: '_updateWidth',
- value: function _updateWidth() {
- var width = this.getAttribute('width');
- if (!width) {
- styler.clear(this, 'flex maxWidth');
- } else {
- width = width.trim().match(/^\d+$/) ? width + '%' : width;
-
- styler(this, {
- flex: '0 0 ' + width,
- maxWidth: width
- });
- }
- }
- }], [{
- key: 'observedAttributes',
- get: function get() {
- return ['width'];
- }
- }]);
-
- return ColElement;
- }(BaseElement);
-
- export default ColElement;
-
-
- onsElements.Col = ColElement;
- customElements.define('ons-col', ColElement);
|