[DE] Add tag for form fields

This commit is contained in:
Julia Radzhabova 2022-05-30 19:11:11 +03:00
parent e9a0798327
commit 8a41cc0904
4 changed files with 44 additions and 1 deletions

View file

@ -28,6 +28,12 @@
<div id="form-txt-pholder"></div>
</td>
</tr>
<tr>
<td class="padding-small">
<label class="input-label"><%= scope.textTag %></label>
<div id="form-txt-tag"></div>
</td>
</tr>
<tr>
<td class="padding-large">
<label class="input-label"><%= scope.textTip %></label>

View file

@ -147,6 +147,24 @@ define([
setTimeout(function(){me.txtPlaceholder._input && me.txtPlaceholder._input.select();}, 1);
});
this.txtTag = new Common.UI.InputField({
el : $markup.findById('#form-txt-tag'),
allowBlank : true,
validateOnChange: false,
validateOnBlur: false,
style : 'width: 100%;',
value : '',
dataHint : '1',
dataHintDirection: 'left',
dataHintOffset: 'small'
});
this.lockedControls.push(this.txtTag);
this.txtTag.on('changed:after', this.onTagChanged.bind(this));
this.txtTag.on('inputleave', function(){ me.fireEvent('editcomplete', me);});
this.txtTag.cmpEl.on('focus', 'input.form-control', function() {
setTimeout(function(){me.txtTag._input && me.txtTag._input.select();}, 1);
});
this.textareaHelp = new Common.UI.TextareaField({
el : $markup.findById('#form-txt-help'),
style : 'width: 100%; height: 60px;',
@ -501,6 +519,16 @@ define([
}
},
onTagChanged: function(input, newValue, oldValue, e) {
if (this.api && !this._noApply && (newValue!==oldValue)) {
var props = this._originalProps || new AscCommon.CContentControlPr();
props.put_Tag(newValue);
this.api.asc_SetContentControlProperties(props, this.internalId);
if (!e.relatedTarget || (e.relatedTarget.localName != 'input' && e.relatedTarget.localName != 'textarea') || !/form-control/.test(e.relatedTarget.className))
this.fireEvent('editcomplete', this);
}
},
onHelpChanged: function(input, newValue, oldValue, e) {
if (this.api && !this._noApply && (newValue!==oldValue)) {
var props = this._originalProps || new AscCommon.CContentControlPr();
@ -830,6 +858,12 @@ define([
this._state.placeholder = val;
}
val = props.get_Tag();
if (this._state.tag !== val) {
this.txtTag.setValue(val ? val : '');
this._state.tag = val;
}
val = props.get_Lock();
(val===undefined) && (val = Asc.c_oAscSdtLockType.Unlocked);
if (this._state.LockDelete !== (val==Asc.c_oAscSdtLockType.SdtContentLocked || val==Asc.c_oAscSdtLockType.SdtLocked)) {
@ -1341,7 +1375,8 @@ define([
textTooBig: 'Image is Too Big',
textTooSmall: 'Image is Too Small',
textScale: 'When to scale',
textBackgroundColor: 'Background Color'
textBackgroundColor: 'Background Color',
textTag: 'Tag'
}, DE.Views.FormSettings || {}));
});

View file

@ -1862,6 +1862,7 @@
"DE.Views.FormSettings.textRequired": "Required",
"DE.Views.FormSettings.textScale": "When to scale",
"DE.Views.FormSettings.textSelectImage": "Select Image",
"DE.Views.FormSettings.textTag": "Tag",
"DE.Views.FormSettings.textTip": "Tip",
"DE.Views.FormSettings.textTipAdd": "Add new value",
"DE.Views.FormSettings.textTipDelete": "Delete value",

View file

@ -1809,6 +1809,7 @@
"DE.Views.FormSettings.textRequired": "Обязательно",
"DE.Views.FormSettings.textScale": "Когда масштабировать",
"DE.Views.FormSettings.textSelectImage": "Выбрать изображение",
"DE.Views.FormSettings.textTag": "Тег",
"DE.Views.FormSettings.textTip": "Подсказка",
"DE.Views.FormSettings.textTipAdd": "Добавить новое значение",
"DE.Views.FormSettings.textTipDelete": "Удалить значение",