| Current Path : /var/www/homesaver/www/bitrix/js/landing/ui/field/textfield/dist/ |
| Current File : /var/www/homesaver/www/bitrix/js/landing/ui/field/textfield/dist/textfield.bundle.min.js |
this.BX=this.BX||{};this.BX.Landing=this.BX.Landing||{};this.BX.Landing.UI=this.BX.Landing.UI||{};(function(e,n,t,i,o){"use strict";var a;function s(e,n){l(e,n);n.add(e)}function l(e,n){if(n.has(e)){throw new TypeError("Cannot initialize the same private elements twice on an object")}}function u(e,n,t){if(!n.has(e)){throw new TypeError("attempted to get private field on non-instance")}return t}var d=new WeakSet;var r=function(e){babelHelpers.inherits(n,e);function n(e){var i;var a;babelHelpers.classCallCheck(this,n);a=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(n).call(this,e));s(babelHelpers.assertThisInitialized(a),d);a.setEventNamespace("BX.Landing.UI.Field.TextField");a.subscribeFromOptions(o.fetchEventsFromOptions(e));a.bind=a.options.bind;a.changeTagButton=a.options.changeTagButton;a.onInputHandler=t.Type.isFunction(a.options.onInput)?a.options.onInput:function(){};a.onValueChangeHandler=t.Type.isFunction(a.options.onValueChange)?a.options.onValueChange:function(){};a.textOnly=t.Type.isBoolean(a.options.textOnly)?a.options.textOnly:false;a.content=a.textOnly?t.Text.encode(a.content):a.content;a.input.innerHTML=a.content;u(babelHelpers.assertThisInitialized(a),d,c).call(babelHelpers.assertThisInitialized(a));a.setFooterText((i=a.options.footerText)!==null&&i!==void 0?i:"");a.onInputClick=a.onInputClick.bind(babelHelpers.assertThisInitialized(a));a.onInputMousedown=a.onInputMousedown.bind(babelHelpers.assertThisInitialized(a));a.onDocumentMouseup=a.onDocumentMouseup.bind(babelHelpers.assertThisInitialized(a));a.onInputInput=a.onInputInput.bind(babelHelpers.assertThisInitialized(a));a.onDocumentClick=a.onDocumentClick.bind(babelHelpers.assertThisInitialized(a));a.onDocumentKeydown=a.onDocumentKeydown.bind(babelHelpers.assertThisInitialized(a));a.onInputKeydown=a.onInputKeydown.bind(babelHelpers.assertThisInitialized(a));t.Event.bind(a.input,"click",a.onInputClick);t.Event.bind(a.input,"mousedown",a.onInputMousedown);t.Event.bind(a.input,"input",a.onInputInput);t.Event.bind(a.input,"keydown",a.onInputKeydown);t.Event.bind(document,"click",a.onDocumentClick);t.Event.bind(document,"keydown",a.onDocumentKeydown);t.Event.bind(document,"mouseup",a.onDocumentMouseup);return a}babelHelpers.createClass(n,[{key:"onInputInput",value:function e(){this.onInputHandler(this.input.innerText);this.onValueChangeHandler(this);var n=new i.BaseEvent({data:{value:this.getValue()},compatData:[this.getValue()]});this.emit("onChange",n)}},{key:"onDocumentKeydown",value:function e(n){if(n.keyCode===27){if(this.isEditable()){if(this===BX.Landing.UI.Field.BaseField.currentField){BX.Landing.UI.Panel.EditorPanel.getInstance().hide()}this.disableEdit()}}}},{key:"onInputKeydown",value:function e(n){if(n.keyCode===13){if(this.isTextOnly()){n.preventDefault()}}}},{key:"enableTextOnly",value:function e(){this.textOnly=true;this.input.innerHTML="".concat(this.input.innerText).trim()}},{key:"disableTextOnly",value:function e(){this.textOnly=false}},{key:"isTextOnly",value:function e(){return this.textOnly}},{key:"isContentEditable",value:function e(){return this.contentEditable!==false}},{key:"onDocumentClick",value:function e(){if(this.isEditable()&&!this.fromInput){if(this===BX.Landing.UI.Field.BaseField.currentField){BX.Landing.UI.Panel.EditorPanel.getInstance().hide()}this.disableEdit()}this.fromInput=false}},{key:"onDocumentMouseup",value:function e(){var n=this;setTimeout((function(){n.fromInput=false}),10)}},{key:"onInputClick",value:function e(n){n.preventDefault();n.stopPropagation();this.fromInput=false}},{key:"onInputMousedown",value:function e(n){this.enableEdit();BX.Landing.UI.Tool.ColorPicker.hideAll();requestAnimationFrame((function(){if(n.target.nodeName==="A"){var e=document.createRange();e.selectNode(n.target);window.getSelection().removeAllRanges();window.getSelection().addRange(e)}}));this.fromInput=true;n.stopPropagation()}},{key:"enableEdit",value:function e(){if(!this.isEditable()){if(this!==BX.Landing.UI.Field.BaseField.currentField&&BX.Landing.UI.Field.BaseField.currentField!==null){BX.Landing.UI.Field.BaseField.currentField.disableEdit()}BX.Landing.UI.Field.BaseField.currentField=this;if(!this.isTextOnly()){if(this.changeTagButton){this.changeTagButton.onChangeHandler=this.onChangeTag.bind(this)}BX.Landing.UI.Panel.EditorPanel.getInstance().show(this.layout,null,this.changeTagButton?[this.changeTagButton]:null);this.input.contentEditable=true}else{BX.Landing.UI.Panel.EditorPanel.getInstance().hide();this.input.contentEditable=true}if(!this.isContentEditable()){this.input.contentEditable=false}}}},{key:"onChangeTag",value:function e(n){this.tag=n}},{key:"disableEdit",value:function e(){this.input.contentEditable=false}},{key:"isEditable",value:function e(){return this.input.isContentEditable}},{key:"reset",value:function e(){this.setValue("")}},{key:"adjustTags",value:function e(n){if(n.lastChild&&n.lastChild.nodeName==="BR"){t.Dom.remove(n.lastChild);this.adjustTags(n)}return n}},{key:"getValue",value:function e(){if(this.textOnly){return this.input.innerText}return this.adjustTags(t.Runtime.clone(this.input)).innerHTML.replace(/ /g,"")}},{key:"setFooterText",value:function e(n){this.footer.innerText=n}},{key:"showFooter",value:function e(){t.Dom.show(this.footer)}},{key:"hideFooter",value:function e(){t.Dom.hide(this.footer)}},{key:"setWarningStatus",value:function e(){t.Dom.addClass(this.getLayout(),"landing-ui-field-warning")}},{key:"unsetWarningStatus",value:function e(){t.Dom.removeClass(this.layout,"landing-ui-field-warning")}}]);return n}(n.BaseField);function c(){this.footer=t.Tag.render(a||(a=babelHelpers.taggedTemplateLiteral(['<div class="landing-ui-field-bottom ui-ctl-bottom" hidden></div>'])));t.Dom.append(this.footer,this.getLayout())}e.TextField=r;e.Text=r})(this.BX.Landing.UI.Field=this.BX.Landing.UI.Field||{},BX.Landing.UI.Field,BX,BX.Event,BX.Landing.UI.Component);
//# sourceMappingURL=textfield.bundle.map.js