(window["webpackJsonp_name_"] = window["webpackJsonp_name_"] || []).push([[62,60,61,77],{ /***/ 169: /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = getIcon; /** * * @param setting * @param key - file, date, select, range, number * @param direction - only for type number ['dec', 'inc'] */ function getIcon(setting, key) { var direction = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; var iconType = direction ? direction + '_icon_type' : 'icon_type'; var iconClass = direction ? direction + '_icon_' : 'icon_'; // icon_type: "", icon_font-awesome: "", icon_ios: "", icon_small: "" var span = document.createElement('SPAN'); span.classList.add('project-input__icon'); var template = ''; switch (setting[iconType]) { case 'custom': span.classList.add('has-svg'); template = '\n \n \n \n '; break; case 'ios': case 'font-awesome': case 'small': span.classList.add('has-font'); span.classList.add('' + setting[iconType]); template = ''; break; default: span.classList.add('font-awesome'); template = ''; } span.innerHTML = template; return span; } var ICONS = { 'select': 'ib-289', 'file': 'ib-218', 'date': 'ib-136', 'number': { 'inc': 'ib-289', 'dec': 'ib-288' }, 'radio': 'ib-300', 'range': 'ib-300', 'accordion': { 'open': 'ib-289', 'close': 'ib-288' } }; /***/ }), /***/ 170: /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function getBackground() { var bg = document.createElement('SPAN'); bg.classList.add('background'); bg.innerHTML = '\n \n
\n \n
\n \n
\n \n
\n \n
\n '; return function (el) { return el ? el.appendChild(bg.cloneNode(true)) : bg.cloneNode(true); }; } exports.default = getBackground(); /***/ }), /***/ 182: /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _getBackground = __webpack_require__(170); var _getBackground2 = _interopRequireDefault(_getBackground); var _getIcon = __webpack_require__(169); var _getIcon2 = _interopRequireDefault(_getIcon); __webpack_require__(418); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var Select = function () { function Select(argv) { _classCallCheck(this, Select); this.selected = []; this.target = null; this.isOpened = false; this._argv = argv; this.wrapper = document.createElement('DIV'); this.title = document.createElement('SPAN'); this.options = document.createElement('DIV'); this.list = document.createElement('DIV'); this.arrow = (0, _getIcon2.default)(this.setting, 'select'); this.list.classList.add('cs-options__list'); this._createSelect(); this._onClick(); this.close = this.close.bind(this); } _createClass(Select, [{ key: '_createSelect', value: function _createSelect() { if (this.field.classList.contains('cs-select_inited')) { return false; } this.customChangeEvent = new CustomEvent('change', { bubbles: true, cancelable: false }); // project-input_initialized this.field.classList.add('cs-select_inited'); this.field.classList.add('project-input_initialized'); this.wrapper.className = 'cs-select ' + this.field.className; this.title.classList.add('cs-placeholder'); this.title.classList.add('project-input'); this.title.classList.add('project-input_select'); this.options.classList.add('cs-options'); (0, _getBackground2.default)(this.options); var template = ''; for (var i = 0; i < this.field.options.length; i++) { if (this.field.options[i].value) { var className = ''; if (this.field.options[i].selected && this.field.options[i].textContent) { this.selected.push(this.field.options[i].textContent); className = 'cs-selected'; } template += '
' + this.field.options[i].textContent + (0, _getBackground2.default)().outerHTML + '
'; } } this.arrow.classList.add('cs-placeholder-before'); var settings = this.setting; this.setTitle(); this.list.innerHTML = template; this.wrapper.appendChild(this.title); this.wrapper.appendChild(this.options); this.options.appendChild(this.list); this.field.parentNode && this.field.parentNode.insertBefore(this.wrapper, this.field); if (this.field && this.field.parentNode && this.field.parentNode.parentNode && this.field.parentNode.parentNode.classList.contains('widget')) { this.field.style.display = 'none'; } else { this.wrapper.appendChild(this.field); } } }, { key: '_onClick', value: function _onClick() { var _this = this; if (!this.wrapper) { return false; } this.wrapper.addEventListener('click', function (event) { event.stopPropagation(); var target = event.target; _this.target = target; if (target.tagName === "DIV" && target.classList.contains('cs-options__list-item')) { _this._setActive(target); _this.field.dispatchEvent(_this.customChangeEvent); } if (target.tagName === "SPAN" && target.classList.contains('cs-placeholder')) { _this._setOpen(target); } }); } }, { key: '_setActive', value: function _setActive(target) { var index = target.getAttribute('data-index'); if (this.field.options[index].selected) { if (this.field.multiple) { var i = this.selected.indexOf(this.field.options[index].textContent); i !== -1 ? this.selected.splice(i, 1) : []; } else { this.selected = []; } target.classList.remove('cs-selected'); this.field.options[index].selected = false; } else { if (this.field.multiple) { this.selected.push(this.field.options[index].textContent); } else { Array.from(this.wrapper.querySelectorAll('.cs-selected')).forEach(function (item) { item.classList.remove('cs-selected'); }); this.selected = [this.field.options[index].textContent]; } target.classList.add('cs-selected'); this.field.options[index].selected = true; } this.setTitle(); } }, { key: 'setTitle', value: function setTitle() { this.title.innerHTML = '\n \n ' + (this.selected.length ? this.selected.join(', ') : 'Select') + '\n \n '; this.title.appendChild(this.arrow); (0, _getBackground2.default)(this.title); } }, { key: '_setOpen', value: function _setOpen(target) { if (Select.activeSelect instanceof Select && Select.activeSelect !== this) { Select.activeSelect.close(); } if (target.parentNode.classList.contains('cs-active')) { target.classList.remove('project-input_focused'); target.parentNode.classList.remove('cs-active'); this.isOpened = false; Select.activeSelect = null; //document.removeEventListener('click', this.close.bind(this)); } else { target.classList.add('project-input_focused'); target.parentNode.classList.add('cs-active'); this.isOpened = true; Select.activeSelect = this; document.addEventListener('click', this.close); //document.addEventListener('click', this.close.bind(this)); } } }, { key: 'close', value: function close(e) { document.removeEventListener('click', this.close); if (!this.wrapper || !this.title) { return false; } this.title.classList.remove('project-input_focused'); this.wrapper.classList.remove('cs-active'); this.isOpened = false; } }, { key: 'setting', get: function get() { return this._argv.setting; } }, { key: 'field', get: function get() { return this._argv.field; } }]); return Select; }(); exports.default = Select; /***/ }), /***/ 418: /***/ (function(module, exports, __webpack_require__) { var content = __webpack_require__(437); if(typeof content === 'string') content = [[module.i, content, '']]; var transform; var insertInto; var options = {"hmr":true} options.transform = transform options.insertInto = undefined; var update = __webpack_require__(167)(content, options); if(content.locals) module.exports = content.locals; if(false) {} /***/ }), /***/ 437: /***/ (function(module, exports, __webpack_require__) { exports = module.exports = __webpack_require__(168)(false); // imports // module exports.push([module.i, ".select-wrapper{height:45px;position:relative;z-index:1;margin-bottom:19px}.cs-select{outline:none;position:relative}.cs-select>.cs-placeholder-before.project-input__icon,.cs-select>.project-input__animate-box{display:none}.cs-select_has-border .cs-options,.cs-select_has-border .cs-placeholder{border-width:2px;border-style:solid}.cs-select_has-border .cs-options{margin-top:-2px}.cs-select_has-bg.cs-active .cs-placeholder{z-index:9999}.cs-select select{display:none}.cs-select.cs-active .cs-options{display:block;padding-bottom:0}.cs-placeholder{position:relative;-user-select:none;-moz-user-select:none;-webkit-user-select:none;cursor:pointer;display:block;vertical-align:top;line-height:1.5;white-space:nowrap;text-overflow:ellipsis;transition:box-shadow .2s ease,color .2s ease,background-color .2s ease,border .2s ease}.cs-placeholder:after{content:\"\";position:absolute;top:0;left:0;z-index:6;width:100%;height:100%;background-color:rgba(0, 0, 0, .0001)}.cs-placeholder.project-input{display:flex;justify-content:space-between;align-items:center}.cs-placeholder-text{flex-grow:1;overflow:hidden;text-overflow:ellipsis}.cs-placeholder-before{position:static;display:flex;align-items:center;justify-content:center}.cs-placeholder-before.font-awesome,.cs-placeholder-before.ios,.cs-placeholder-before.small{display:flex}.cs-placeholder-before>i{transform-origin:center center;display:block;line-height:1!important;top:2px;max-height:100%;padding:0!important}.cs-options{position:absolute;top:100%;left:0;display:none;width:100%;z-index:999}.cs-options .cs-options__list,.cs-options .cs-options__list:not(.social-links-list){list-style-type:none;margin:0;padding:0;max-height:50vh;overflow-y:auto}.cs-options .cs-options__list .cs-options__list-item,.cs-options .cs-options__list:not(.social-links-list) .cs-options__list-item{position:relative;display:block;padding:18px 24px;margin:0;cursor:pointer;transition:background-color .2s ease,color .2s ease,opacity .2s ease,border .2s ease;line-height:normal}.cs-options .cs-options__list .cs-options__list-item:before,.cs-options .cs-options__list:not(.social-links-list) .cs-options__list-item:before{content:\"\";position:absolute;top:0;left:0;width:100%;height:100%;background-size:cover;background-position:50%;background-repeat:no-repeat}.cs-options .cs-options__list .cs-options__list-item.cs-selected,.cs-options .cs-options__list .cs-options__list-item:hover,.cs-options .cs-options__list:not(.social-links-list) .cs-options__list-item.cs-selected,.cs-options .cs-options__list:not(.social-links-list) .cs-options__list-item:hover{transition:.2s cubic-bezier(.4,0,.2,1)}", ""]); // exports /***/ }) }]);