1 | "use strict";
|
---|
2 |
|
---|
3 | function _defaults(obj, defaults) { var keys = Object.getOwnPropertyNames(defaults); for (var i = 0; i < keys.length; i++) { var key = keys[i]; var value = Object.getOwnPropertyDescriptor(defaults, key); if (value && value.configurable && obj[key] === undefined) { Object.defineProperty(obj, key, value); } } return obj; }
|
---|
4 |
|
---|
5 | function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _defaults(subClass, superClass); }
|
---|
6 |
|
---|
7 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
---|
8 |
|
---|
9 | var Declaration = require('../declaration');
|
---|
10 |
|
---|
11 | var utils = require('./grid-utils');
|
---|
12 |
|
---|
13 | var GridRowColumn = /*#__PURE__*/function (_Declaration) {
|
---|
14 | _inheritsLoose(GridRowColumn, _Declaration);
|
---|
15 |
|
---|
16 | function GridRowColumn() {
|
---|
17 | return _Declaration.apply(this, arguments) || this;
|
---|
18 | }
|
---|
19 |
|
---|
20 | var _proto = GridRowColumn.prototype;
|
---|
21 |
|
---|
22 | /**
|
---|
23 | * Translate grid-row / grid-column to separate -ms- prefixed properties
|
---|
24 | */
|
---|
25 | _proto.insert = function insert(decl, prefix, prefixes) {
|
---|
26 | if (prefix !== '-ms-') return _Declaration.prototype.insert.call(this, decl, prefix, prefixes);
|
---|
27 | var values = utils.parse(decl);
|
---|
28 |
|
---|
29 | var _utils$translate = utils.translate(values, 0, 1),
|
---|
30 | start = _utils$translate[0],
|
---|
31 | span = _utils$translate[1];
|
---|
32 |
|
---|
33 | var hasStartValueSpan = values[0] && values[0].includes('span');
|
---|
34 |
|
---|
35 | if (hasStartValueSpan) {
|
---|
36 | span = values[0].join('').replace(/\D/g, '');
|
---|
37 | }
|
---|
38 |
|
---|
39 | [[decl.prop, start], [decl.prop + "-span", span]].forEach(function (_ref) {
|
---|
40 | var prop = _ref[0],
|
---|
41 | value = _ref[1];
|
---|
42 | utils.insertDecl(decl, prop, value);
|
---|
43 | });
|
---|
44 | return undefined;
|
---|
45 | };
|
---|
46 |
|
---|
47 | return GridRowColumn;
|
---|
48 | }(Declaration);
|
---|
49 |
|
---|
50 | _defineProperty(GridRowColumn, "names", ['grid-row', 'grid-column']);
|
---|
51 |
|
---|
52 | module.exports = GridRowColumn; |
---|