From 7504378d7397f45e3d2c271296486c819fb707fa Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 1 Dec 2022 20:26:08 +0300 Subject: [PATCH] [DE] Add zip code and credit card forms --- .../main/app/controller/FormsTab.js | 3 +- apps/documenteditor/main/app/view/FormsTab.js | 40 ++++++++++++++++++- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/apps/documenteditor/main/app/controller/FormsTab.js b/apps/documenteditor/main/app/controller/FormsTab.js index 2cfc2aa77..8e7d98bcf 100644 --- a/apps/documenteditor/main/app/controller/FormsTab.js +++ b/apps/documenteditor/main/app/controller/FormsTab.js @@ -152,7 +152,8 @@ define([ (lock_type===undefined) && (lock_type = Asc.c_oAscSdtLockType.Unlocked); var content_locked = lock_type==Asc.c_oAscSdtLockType.SdtContentLocked || lock_type==Asc.c_oAscSdtLockType.ContentLocked; var arr = [ this.view.btnTextField, this.view.btnComboBox, this.view.btnDropDown, this.view.btnCheckBox, - this.view.btnRadioBox, this.view.btnImageField, this.view.btnEmailField, this.view.btnPhoneField, this.view.btnComplexField ]; + this.view.btnRadioBox, this.view.btnImageField, this.view.btnEmailField, this.view.btnPhoneField, this.view.btnComplexField, + this.view.btnCreditCard, this.view.btnZipCode]; Common.Utils.lockControls(Common.enumLock.paragraphLock, paragraph_locked, {array: arr}); Common.Utils.lockControls(Common.enumLock.headerLock, header_locked, {array: arr}); Common.Utils.lockControls(Common.enumLock.controlPlain, control_plain, {array: arr}); diff --git a/apps/documenteditor/main/app/view/FormsTab.js b/apps/documenteditor/main/app/view/FormsTab.js index 49c31f943..4d5e6da35 100644 --- a/apps/documenteditor/main/app/view/FormsTab.js +++ b/apps/documenteditor/main/app/view/FormsTab.js @@ -61,6 +61,8 @@ define([ '' + '' + @@ -122,6 +124,12 @@ define([ this.btnPhoneField && this.btnPhoneField.on('click', function (b, e) { me.fireEvent('forms:insert', ['text', {mask: "(999)999-9999", placeholder: '(999)999-9999'}]); }); + this.btnCreditCard && this.btnCreditCard.on('click', function (b, e) { + me.fireEvent('forms:insert', ['text', {mask: "9999-9999-9999-9999", placeholder: '9999-9999-9999-9999'}]); + }); + this.btnZipCode && this.btnZipCode.on('click', function (b, e) { + me.fireEvent('forms:insert', ['text', {mask: "99999-9999", placeholder: '99999-9999'}]); + }); this.btnViewFormRoles && this.btnViewFormRoles.on('click', function (b, e) { var item = b.menu.getChecked(); me.fireEvent('forms:mode', [b.pressed, item ? item.caption : undefined]); @@ -285,6 +293,28 @@ define([ }); this.paragraphControls.push(this.btnPhoneField); + this.btnZipCode = new Common.UI.Button({ + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-zip-code', + lock: [_set.paragraphLock, _set.headerLock, _set.controlPlain, _set.contentLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart, _set.docLockView, _set.docLockForms, _set.docLockComments], + caption: this.capZipCode, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + this.paragraphControls.push(this.btnZipCode); + + this.btnCreditCard = new Common.UI.Button({ + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-zip-credit', + lock: [_set.paragraphLock, _set.headerLock, _set.controlPlain, _set.contentLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart, _set.docLockView, _set.docLockForms, _set.docLockComments], + caption: this.capCreditCard, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + this.paragraphControls.push(this.btnCreditCard); + this.btnComplexField = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', iconCls: 'toolbar__icon complex-field', @@ -468,6 +498,8 @@ define([ me.btnEmailField.updateHint(me.tipEmailField); me.btnPhoneField.updateHint(me.tipPhoneField); me.btnComplexField.updateHint(me.tipComplexField); + me.btnZipCode.updateHint(me.tipZipCode); + me.btnCreditCard.updateHint(me.tipCreditCard); } me.btnClear.updateHint(me.textClearFields); me.btnPrevForm.updateHint(me.tipPrevForm); @@ -500,6 +532,8 @@ define([ this.btnEmailField.render($host.find('#slot-btn-form-email')); this.btnPhoneField.render($host.find('#slot-btn-form-phone')); this.btnComplexField.render($host.find('#slot-btn-form-complex')); + this.btnZipCode.render($host.find('#slot-btn-form-zipcode')); + this.btnCreditCard.render($host.find('#slot-btn-form-credit')); $host.find('.forms-buttons').show(); } @@ -624,7 +658,11 @@ define([ txtFixedText: 'Fixed', txtFixedDesc: 'Insert fixed text field', tipInlineText: 'Insert inline text field', - tipFixedText: 'Insert fixed text field' + tipFixedText: 'Insert fixed text field', + capZipCode: 'Zip Code', + capCreditCard: 'Credit Card', + tipZipCode: 'Insert zip code', + tipCreditCard: 'Insert credit card number' } }()), DE.Views.FormsTab || {})); }); \ No newline at end of file