UNPKG

@ohu-mobile/core

Version:
44 lines (43 loc) 2.98 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _variables = require("../_config/variables"); var _defineComponent = require("../_utils/defineComponent"); function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); } function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } var rowCls = "".concat(_variables.$prefix, "row"); var colCls = "".concat(_variables.$prefix, "col"); var unitsGap = "".concat(_variables.$prefix, "units-gap"); var _default = exports.default = (0, _defineComponent.defineComponent)('grid').create({ props: { row: (0, _defineComponent.props)(Boolean).default(true), column: (0, _defineComponent.props)(Boolean).default(false), x: _defineComponent.props.ofStringLiterals('left', 'right', 'center', 'between', 'around', 'baseline', 'stretch', 'evenly').optional, y: _defineComponent.props.ofStringLiterals('top', 'bottom', 'center', 'baseline', 'stretch', 'between', 'around', 'evenly').optional, m: _defineComponent.props.ofStringLiterals('left', 'right', 'top', 'bottom', 'center', 'between', 'around', 'stretch', 'evenly').optional, gap: (0, _defineComponent.props)(Number).validator(function (v) { return v >= 0 && v <= _variables.$gridGapLevel; }).optional, wrap: (0, _defineComponent.props)(Boolean).default(false), reverse: (0, _defineComponent.props)(Boolean).default(false) }, render: function render() { var h = arguments[0]; var $slots = this.$slots, x = this.x, y = this.y, m = this.m, gap = this.gap, column = this.column, wrap = this.wrap, reverse = this.reverse; var cls = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, column ? colCls : rowCls, true), "x-".concat(x), x !== undefined), "y-".concat(y), y !== undefined), "m-".concat(m), m !== undefined), "".concat(unitsGap, "-").concat(gap), gap !== undefined && gap > 0), 'is-multi', wrap), 'is-reverse', reverse); return h("div", { "class": cls }, [$slots.default]); } });