From 589ce428abbb5a317e672051e9f7cb0e034e64ae Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 4 Apr 2023 19:55:23 +0300 Subject: [PATCH 01/12] Fix Bug 61575 --- apps/documenteditor/main/app/controller/Main.js | 1 + apps/presentationeditor/main/app/controller/Main.js | 1 + apps/spreadsheeteditor/main/app/controller/Main.js | 1 + 3 files changed, 3 insertions(+) diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index d3485380be..13885f4650 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -311,6 +311,7 @@ define([ if (event.target ) { var target = $(event.target); if (target.closest('.combobox').length>0 || target.closest('.dropdown-menu').length>0 || + target.closest('.input-field').length>0 || target.closest('.spinner').length>0 || target.closest('.textarea-field').length>0 || target.closest('.ribtab').length>0 || target.closest('.combo-dataview').length>0) { event.preventDefault(); } diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index b732cc881b..933d5868d9 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -274,6 +274,7 @@ define([ if (event.target ) { var target = $(event.target); if (target.closest('.combobox').length>0 || target.closest('.dropdown-menu').length>0 || + target.closest('.input-field').length>0 || target.closest('.spinner').length>0 || target.closest('.textarea-field').length>0 || target.closest('.ribtab').length>0 || target.closest('.combo-dataview').length>0) { event.preventDefault(); } diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index eaeb23d30c..d2a8e3478e 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -310,6 +310,7 @@ define([ if (event.target ) { var target = $(event.target); if (target.closest('.combobox').length>0 || target.closest('.dropdown-menu').length>0 || + target.closest('.input-field').length>0 || target.closest('.spinner').length>0 || target.closest('.textarea-field').length>0 || target.closest('.ribtab').length>0 || target.closest('.combo-dataview').length>0) { event.preventDefault(); } From 878e4b417f75607a3d52b0b9cb6b591bd5c1b873 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 4 Apr 2023 21:25:02 +0300 Subject: [PATCH 02/12] [DE] Add settings for default form value --- .../main/app/template/FormSettings.template | 17 +++ .../main/app/view/FormSettings.js | 107 +++++++++++++++++- 2 files changed, 123 insertions(+), 1 deletion(-) diff --git a/apps/documenteditor/main/app/template/FormSettings.template b/apps/documenteditor/main/app/template/FormSettings.template index 04d88720c2..840677c853 100644 --- a/apps/documenteditor/main/app/template/FormSettings.template +++ b/apps/documenteditor/main/app/template/FormSettings.template @@ -51,6 +51,18 @@
+ + + +
+ + + + + +
+ + @@ -114,6 +126,11 @@ + + + + + + @@ -87,6 +92,11 @@
+
+
diff --git a/apps/documenteditor/main/app/view/FormSettings.js b/apps/documenteditor/main/app/view/FormSettings.js index eefe26b791..bb4cde1bcf 100644 --- a/apps/documenteditor/main/app/view/FormSettings.js +++ b/apps/documenteditor/main/app/view/FormSettings.js @@ -109,6 +109,8 @@ define([ this.FixedSettings = el.find('.form-fixed'); this.NotInComplexSettings = el.find('.form-not-in-complex'); this.DateOnlySettings = el.find('.form-datetime'); + this.DefValueText = el.find('#form-txt-def-value').closest('tr'); + this.DefValueDropDown = el.find('#form-combo-def-value').closest('tr'); }, createDelayedElements: function() { @@ -188,6 +190,43 @@ define([ this.textareaHelp.on('changed:after', this.onHelpChanged.bind(this)); this.textareaHelp.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); + this.textareaDefValue = new Common.UI.TextareaField({ + el : $markup.findById('#form-txt-def-value'), + style : 'width: 100%; height: 36px;', + value : '', + dataHint : '1', + dataHintDirection: 'left', + dataHintOffset: 'small' + }); + this.lockedControls.push(this.textareaDefValue); + this.textareaDefValue.on('changed:after', this.onTextAreaDefChanged.bind(this)); + this.textareaDefValue.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); + + this.cmbDefValue = new Common.UI.ComboBox({ + el: $markup.findById('#form-combo-def-value'), + cls: 'input-group-nr', + menuCls: 'menu-absolute', + menuStyle: 'min-width: 195px; max-height: 190px;', + editable: false, + data: [], + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'big' + }); + this.cmbDefValue.setValue(''); + this.lockedControls.push(this.cmbDefValue); + this.cmbDefValue.on('selected', this.onComboDefChanged.bind(this)); + + this.chDefValue = new Common.UI.CheckBox({ + el: $markup.findById('#form-chb-def-value'), + labelText: this.textCheckDefault, + dataHint: '1', + dataHintDirection: 'left', + dataHintOffset: 'small' + }); + this.chDefValue.on('change', this.onChDefValue.bind(this)); + this.lockedControls.push(this.chDefValue); + // Text props this.chMaxChars = new Common.UI.CheckBox({ el: $markup.findById('#form-chb-max-chars'), @@ -746,6 +785,38 @@ define([ } }, + onTextAreaDefChanged: function(input, newValue, oldValue, e) { + if (this.api && !this._noApply && (newValue!==oldValue)) { + // var props = this._originalProps || new AscCommon.CContentControlPr(); + // var formPr = this._originalFormProps || new AscCommon.CSdtFormPr(); + // formPr.put_DefValueText(newValue); + // props.put_FormPr(formPr); + // this.api.asc_SetContentControlProperties(props, this.internalId); + this.api.asc_SetFormValue(newValue, this.internalId); + if (!e.relatedTarget || (e.relatedTarget.localName != 'input' && e.relatedTarget.localName != 'textarea') || !/form-control/.test(e.relatedTarget.className)) + this.fireEvent('editcomplete', this); + } + }, + + onComboDefChanged: function(combo, record) { + if (this.api && !this._noApply) { + // var props = this._originalProps || new AscCommon.CContentControlPr(); + // var formPr = this._originalFormProps || new AscCommon.CSdtFormPr(); + // formPr.put_DefValueText(record.value); + // props.put_FormPr(formPr); + // this.api.asc_SetContentControlProperties(props, this.internalId); + this.api.asc_SetFormValue(record.value, this.internalId); + this.fireEvent('editcomplete', this); + } + }, + + onChDefValue: function(field, newValue, oldValue, eOpts){ + if (this.api && !this._noApply) { + this.api.asc_SetFormValue(field.getValue()=='checked', this.internalId); + this.fireEvent('editcomplete', this); + } + }, + onChMaxCharsChanged: function(field, newValue, oldValue, eOpts){ var checked = (field.getValue()=='checked'); this.spnMaxChars.setDisabled(!checked || this._state.FormatType===Asc.TextFormFormatType.Mask || this._state.DisabledControls); @@ -1197,6 +1268,22 @@ define([ this.btnListAdd.setDisabled(true); this._state.listValue = this._state.listIndex = undefined; } + + // fill default value combo + if (type == Asc.c_oAscContentControlSpecificType.DropDownList) { + arr.forEach(function(item) { + item.value = item.displayValue = item.name; + }); + this.cmbDefValue.setData(arr); + this.cmbDefValue.setDisabled(arr.length<1); + //this.cmbDefValue.setValue(this.api.asc_GetFormValue(this.internalId)); + } else { + // val = this.api.asc_GetFormValue(this.internalId); + // if ( this._state.DefValue!==val ) { + // this.textareaDefValue.setValue(val || ''); + // this._state.DefValue=val; + // } + } } this.disableListButtons(); } else if (type == Asc.c_oAscContentControlSpecificType.CheckBox) { @@ -1273,6 +1360,13 @@ define([ } this.labelFormName.text(ischeckbox ? this.textCheckbox : this.textRadiobox); + this.chDefValue.setCaption(ischeckbox ? this.textCheckDefault : this.textRadioDefault); + + // val = this.api.asc_GetFormValue(this.internalId); + // if (this._state.ChDefValue!==val) { + // this.chDefValue.setValue(!!val, true); + // this._state.ChDefValue=val; + // } } if (type !== Asc.c_oAscContentControlSpecificType.Picture) { @@ -1466,6 +1560,12 @@ define([ this.spnMaxChars.setValue(val && val>=0 ? val : 10, true); this._state.MaxChars=val; } + + // val = this.api.asc_GetFormValue(this.internalId); + // if ( this._state.DefValue!==val ) { + // this.textareaDefValue.setValue(val || ''); + // this._state.DefValue=val; + // } } else this._originalTextFormProps = null; @@ -1630,6 +1730,8 @@ define([ this.FixedSettings.toggleClass('hidden', imageOnly || isSimpleInsideComplex); this.NotInComplexSettings.toggleClass('hidden', isSimpleInsideComplex); this.DateOnlySettings.toggleClass('hidden', !dateOnly); + this.DefValueText.toggleClass('hidden', !(type == Asc.c_oAscContentControlSpecificType.ComboBox || textOnly)); + this.DefValueDropDown.toggleClass('hidden', type !== Asc.c_oAscContentControlSpecificType.DropDownList); }, onSelectItem: function(listView, itemView, record) { @@ -1844,7 +1946,10 @@ define([ textCreditCard: 'Credit Card Number (e.g 4111-1111-1111-1111)', textDateField: 'Date & Time Field', textDateFormat: 'Display the date like this', - textLang: 'Language' + textLang: 'Language', + textDefValue: 'Default value', + textCheckDefault: 'Checkbox is checked by default', + textRadioDefault: 'Button is checked by default' }, DE.Views.FormSettings || {})); }); \ No newline at end of file From 43a1db32707003fca21b2aaa883b088c02cf4160 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 5 Apr 2023 13:31:53 +0300 Subject: [PATCH 03/12] [DE] Refactoring form settings --- .../main/app/template/FormSettings.template | 37 ++++++++++++++++--- .../main/app/view/FormSettings.js | 24 +++++++----- 2 files changed, 46 insertions(+), 15 deletions(-) diff --git a/apps/documenteditor/main/app/template/FormSettings.template b/apps/documenteditor/main/app/template/FormSettings.template index 840677c853..6055f7e0fc 100644 --- a/apps/documenteditor/main/app/template/FormSettings.template +++ b/apps/documenteditor/main/app/template/FormSettings.template @@ -54,13 +54,18 @@
-
+
-
+
+
+
+ + +
+
+
@@ -112,6 +122,11 @@
+ + +
+
+
@@ -126,6 +141,11 @@
+ + + - -
+
+
@@ -177,13 +197,13 @@
+
+ + + -
-
@@ -218,6 +238,11 @@
+ + + + + +
+
+
diff --git a/apps/documenteditor/main/app/view/FormSettings.js b/apps/documenteditor/main/app/view/FormSettings.js index bb4cde1bcf..ff385cb8dc 100644 --- a/apps/documenteditor/main/app/view/FormSettings.js +++ b/apps/documenteditor/main/app/view/FormSettings.js @@ -190,17 +190,23 @@ define([ this.textareaHelp.on('changed:after', this.onHelpChanged.bind(this)); this.textareaHelp.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); - this.textareaDefValue = new Common.UI.TextareaField({ + this.txtDefValue = new Common.UI.InputField({ el : $markup.findById('#form-txt-def-value'), - style : 'width: 100%; height: 36px;', + allowBlank : true, + validateOnChange: false, + validateOnBlur: false, + style : 'width: 100%;', value : '', dataHint : '1', dataHintDirection: 'left', dataHintOffset: 'small' }); - this.lockedControls.push(this.textareaDefValue); - this.textareaDefValue.on('changed:after', this.onTextAreaDefChanged.bind(this)); - this.textareaDefValue.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); + this.lockedControls.push(this.txtDefValue); + this.txtDefValue.on('changed:after', this.onTxtDefChanged.bind(this)); + this.txtDefValue.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); + this.txtDefValue.cmpEl.on('focus', 'input.form-control', function() { + setTimeout(function(){me.txtDefValue._input && me.txtDefValue._input.select();}, 1); + }); this.cmbDefValue = new Common.UI.ComboBox({ el: $markup.findById('#form-combo-def-value'), @@ -785,7 +791,7 @@ define([ } }, - onTextAreaDefChanged: function(input, newValue, oldValue, e) { + onTxtDefChanged: function(input, newValue, oldValue, e) { if (this.api && !this._noApply && (newValue!==oldValue)) { // var props = this._originalProps || new AscCommon.CContentControlPr(); // var formPr = this._originalFormProps || new AscCommon.CSdtFormPr(); @@ -1280,7 +1286,7 @@ define([ } else { // val = this.api.asc_GetFormValue(this.internalId); // if ( this._state.DefValue!==val ) { - // this.textareaDefValue.setValue(val || ''); + // this.txtDefValue.setValue(val || ''); // this._state.DefValue=val; // } } @@ -1563,7 +1569,7 @@ define([ // val = this.api.asc_GetFormValue(this.internalId); // if ( this._state.DefValue!==val ) { - // this.textareaDefValue.setValue(val || ''); + // this.txtDefValue.setValue(val || ''); // this._state.DefValue=val; // } } else @@ -1730,7 +1736,7 @@ define([ this.FixedSettings.toggleClass('hidden', imageOnly || isSimpleInsideComplex); this.NotInComplexSettings.toggleClass('hidden', isSimpleInsideComplex); this.DateOnlySettings.toggleClass('hidden', !dateOnly); - this.DefValueText.toggleClass('hidden', !(type == Asc.c_oAscContentControlSpecificType.ComboBox || textOnly)); + this.DefValueText.toggleClass('hidden', !(type === Asc.c_oAscContentControlSpecificType.ComboBox || textOnly)); this.DefValueDropDown.toggleClass('hidden', type !== Asc.c_oAscContentControlSpecificType.DropDownList); }, From f1d0915338f5af1d35a2816a058c824edbf270c6 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 5 Apr 2023 18:02:24 +0300 Subject: [PATCH 04/12] [DE] Set default value for datetime form --- apps/common/main/lib/component/InputField.js | 2 +- .../main/app/template/FormSettings.template | 6 +++ .../main/app/view/FormSettings.js | 43 +++++++++++++++++++ 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/apps/common/main/lib/component/InputField.js b/apps/common/main/lib/component/InputField.js index 301be56a3c..882b53cfed 100644 --- a/apps/common/main/lib/component/InputField.js +++ b/apps/common/main/lib/component/InputField.js @@ -667,7 +667,7 @@ define([ cls: '', style: '', value: '', - type: 'date', + type: 'text', name: '', validation: null, allowBlank: true, diff --git a/apps/documenteditor/main/app/template/FormSettings.template b/apps/documenteditor/main/app/template/FormSettings.template index 6055f7e0fc..3ea7801f8c 100644 --- a/apps/documenteditor/main/app/template/FormSettings.template +++ b/apps/documenteditor/main/app/template/FormSettings.template @@ -63,6 +63,12 @@
+ +
+
diff --git a/apps/documenteditor/main/app/view/FormSettings.js b/apps/documenteditor/main/app/view/FormSettings.js index ff385cb8dc..dacf3a9eb4 100644 --- a/apps/documenteditor/main/app/view/FormSettings.js +++ b/apps/documenteditor/main/app/view/FormSettings.js @@ -208,6 +208,25 @@ define([ setTimeout(function(){me.txtDefValue._input && me.txtDefValue._input.select();}, 1); }); + this.txtDateDefValue = new Common.UI.InputFieldBtnCalendar({ + el : $markup.findById('#form-date-def-value'), + allowBlank : true, + validateOnChange: false, + validateOnBlur: false, + style : 'width: 100%;', + value : '', + dataHint : '1', + dataHintDirection: 'left', + dataHintOffset: 'small' + }); + this.lockedControls.push(this.txtDefValue); + this.txtDateDefValue.on('changed:after', this.onTxtDefChanged.bind(this)); + this.txtDateDefValue.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); + this.txtDateDefValue.on('date:click', this.onDateDefClick.bind(this)); + this.txtDateDefValue.cmpEl.on('focus', 'input.form-control', function() { + setTimeout(function(){me.txtDateDefValue._input && me.txtDateDefValue._input.select();}, 1); + }); + this.cmbDefValue = new Common.UI.ComboBox({ el: $markup.findById('#form-combo-def-value'), cls: 'input-group-nr', @@ -804,6 +823,23 @@ define([ } }, + onDateDefClick: function(input, date) { + if (this.api && !this._noApply) { + // var props = this._originalProps || new AscCommon.CContentControlPr(); + // var formPr = this._originalFormProps || new AscCommon.CSdtFormPr(); + // formPr.put_DefValueText(newValue); + // props.put_FormPr(formPr); + // this.api.asc_SetContentControlProperties(props, this.internalId); + var formDatePr = new AscCommon.CSdtDatePickerPr(); + formDatePr.put_DateFormat(this.cmbDateFormat.getValue()); + formDatePr.put_LangId(this.cmbLang.getValue()); + var str = formDatePr.get_String(); + input.setValue(str); + this.api.asc_SetFormValue(str, this.internalId); + this.fireEvent('editcomplete', this); + } + }, + onComboDefChanged: function(combo, record) { if (this.api && !this._noApply) { // var props = this._originalProps || new AscCommon.CContentControlPr(); @@ -1589,6 +1625,13 @@ define([ var format = datePr.get_DateFormat(); this.cmbDateFormat.setValue(format, datePr.get_String()); this._state.DateFormat=format; + + // val = this.api.asc_GetFormValue(this.internalId); + // if ( this._state.DefDateValue!==val ) { + // this.txtDateDefValue.setValue(val || ''); + // this.setDate(new Date(val)); + // this._state.DefDateValue=val; + // } } var isComplex = !!props.get_ComplexFormPr(), // is complex form From b8aabeafedd6639d44864057aa8af86420869ef5 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Wed, 5 Apr 2023 19:19:24 +0300 Subject: [PATCH 05/12] [DE] Show default form value --- .../main/app/view/FormSettings.js | 70 ++++++++----------- 1 file changed, 30 insertions(+), 40 deletions(-) diff --git a/apps/documenteditor/main/app/view/FormSettings.js b/apps/documenteditor/main/app/view/FormSettings.js index dacf3a9eb4..5fd2f88b72 100644 --- a/apps/documenteditor/main/app/view/FormSettings.js +++ b/apps/documenteditor/main/app/view/FormSettings.js @@ -227,7 +227,7 @@ define([ setTimeout(function(){me.txtDateDefValue._input && me.txtDateDefValue._input.select();}, 1); }); - this.cmbDefValue = new Common.UI.ComboBox({ + this.cmbDefValue = new Common.UI.ComboBoxCustom({ el: $markup.findById('#form-combo-def-value'), cls: 'input-group-nr', menuCls: 'menu-absolute', @@ -236,7 +236,10 @@ define([ data: [], dataHint: '1', dataHintDirection: 'bottom', - dataHintOffset: 'big' + dataHintOffset: 'big', + updateFormControl: function(record) { + record && this.setRawValue(record.get('value')); + } }); this.cmbDefValue.setValue(''); this.lockedControls.push(this.cmbDefValue); @@ -812,11 +815,6 @@ define([ onTxtDefChanged: function(input, newValue, oldValue, e) { if (this.api && !this._noApply && (newValue!==oldValue)) { - // var props = this._originalProps || new AscCommon.CContentControlPr(); - // var formPr = this._originalFormProps || new AscCommon.CSdtFormPr(); - // formPr.put_DefValueText(newValue); - // props.put_FormPr(formPr); - // this.api.asc_SetContentControlProperties(props, this.internalId); this.api.asc_SetFormValue(newValue, this.internalId); if (!e.relatedTarget || (e.relatedTarget.localName != 'input' && e.relatedTarget.localName != 'textarea') || !/form-control/.test(e.relatedTarget.className)) this.fireEvent('editcomplete', this); @@ -825,11 +823,6 @@ define([ onDateDefClick: function(input, date) { if (this.api && !this._noApply) { - // var props = this._originalProps || new AscCommon.CContentControlPr(); - // var formPr = this._originalFormProps || new AscCommon.CSdtFormPr(); - // formPr.put_DefValueText(newValue); - // props.put_FormPr(formPr); - // this.api.asc_SetContentControlProperties(props, this.internalId); var formDatePr = new AscCommon.CSdtDatePickerPr(); formDatePr.put_DateFormat(this.cmbDateFormat.getValue()); formDatePr.put_LangId(this.cmbLang.getValue()); @@ -842,11 +835,6 @@ define([ onComboDefChanged: function(combo, record) { if (this.api && !this._noApply) { - // var props = this._originalProps || new AscCommon.CContentControlPr(); - // var formPr = this._originalFormProps || new AscCommon.CSdtFormPr(); - // formPr.put_DefValueText(record.value); - // props.put_FormPr(formPr); - // this.api.asc_SetContentControlProperties(props, this.internalId); this.api.asc_SetFormValue(record.value, this.internalId); this.fireEvent('editcomplete', this); } @@ -1316,15 +1304,16 @@ define([ arr.forEach(function(item) { item.value = item.displayValue = item.name; }); + arr.unshift({value: '', displayValue: (this._state.placeholder.trim()!=='') ? this._state.placeholder : this.txtEmpty}); this.cmbDefValue.setData(arr); this.cmbDefValue.setDisabled(arr.length<1); - //this.cmbDefValue.setValue(this.api.asc_GetFormValue(this.internalId)); + this.cmbDefValue.setValue(this.api.asc_GetFormValue(this.internalId) || ''); } else { - // val = this.api.asc_GetFormValue(this.internalId); - // if ( this._state.DefValue!==val ) { - // this.txtDefValue.setValue(val || ''); - // this._state.DefValue=val; - // } + val = this.api.asc_GetFormValue(this.internalId); + if ( this._state.DefValue!==val ) { + this.txtDefValue.setValue(val || ''); + this._state.DefValue=val; + } } } this.disableListButtons(); @@ -1404,11 +1393,11 @@ define([ this.labelFormName.text(ischeckbox ? this.textCheckbox : this.textRadiobox); this.chDefValue.setCaption(ischeckbox ? this.textCheckDefault : this.textRadioDefault); - // val = this.api.asc_GetFormValue(this.internalId); - // if (this._state.ChDefValue!==val) { - // this.chDefValue.setValue(!!val, true); - // this._state.ChDefValue=val; - // } + val = this.api.asc_GetFormValue(this.internalId); + if (this._state.ChDefValue!==val) { + this.chDefValue.setValue(!!val, true); + this._state.ChDefValue=val; + } } if (type !== Asc.c_oAscContentControlSpecificType.Picture) { @@ -1603,11 +1592,11 @@ define([ this._state.MaxChars=val; } - // val = this.api.asc_GetFormValue(this.internalId); - // if ( this._state.DefValue!==val ) { - // this.txtDefValue.setValue(val || ''); - // this._state.DefValue=val; - // } + val = this.api.asc_GetFormValue(this.internalId); + if ( this._state.DefValue!==val ) { + this.txtDefValue.setValue(val || ''); + this._state.DefValue=val; + } } else this._originalTextFormProps = null; @@ -1626,12 +1615,12 @@ define([ this.cmbDateFormat.setValue(format, datePr.get_String()); this._state.DateFormat=format; - // val = this.api.asc_GetFormValue(this.internalId); - // if ( this._state.DefDateValue!==val ) { - // this.txtDateDefValue.setValue(val || ''); - // this.setDate(new Date(val)); - // this._state.DefDateValue=val; - // } + val = this.api.asc_GetFormValue(this.internalId); + if ( this._state.DefDateValue!==val ) { + this.txtDateDefValue.setValue(val || ''); + this.txtDateDefValue.setDate(new Date(val)); + this._state.DefDateValue=val; + } } var isComplex = !!props.get_ComplexFormPr(), // is complex form @@ -1998,7 +1987,8 @@ define([ textLang: 'Language', textDefValue: 'Default value', textCheckDefault: 'Checkbox is checked by default', - textRadioDefault: 'Button is checked by default' + textRadioDefault: 'Button is checked by default', + txtEmpty: '(Empty)' }, DE.Views.FormSettings || {})); }); \ No newline at end of file From c5a68ea74ebd1064586218fe844c1ecf7f0796b1 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 6 Apr 2023 13:29:35 +0300 Subject: [PATCH 06/12] [DE] Fix default value for dropdown form --- apps/documenteditor/main/app/view/FormSettings.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/documenteditor/main/app/view/FormSettings.js b/apps/documenteditor/main/app/view/FormSettings.js index 5fd2f88b72..112c83fd7e 100644 --- a/apps/documenteditor/main/app/view/FormSettings.js +++ b/apps/documenteditor/main/app/view/FormSettings.js @@ -237,6 +237,11 @@ define([ dataHint: '1', dataHintDirection: 'bottom', dataHintOffset: 'big', + itemsTemplate: _.template([ + '<% _.each(items, function(item) { %>', + '
  • opacity: 0.6 <% } %>"><%= scope.getDisplayValue(item) %>
  • ', + '<% }); %>' + ].join('')), updateFormControl: function(record) { record && this.setRawValue(record.get('value')); } @@ -1304,7 +1309,7 @@ define([ arr.forEach(function(item) { item.value = item.displayValue = item.name; }); - arr.unshift({value: '', displayValue: (this._state.placeholder.trim()!=='') ? this._state.placeholder : this.txtEmpty}); + (arr.length>0) && arr.unshift({value: '', displayValue: this.txtEmpty}); this.cmbDefValue.setData(arr); this.cmbDefValue.setDisabled(arr.length<1); this.cmbDefValue.setValue(this.api.asc_GetFormValue(this.internalId) || ''); From 97c54cf7b58d1207e16f0a0d5bdd966f75d2d8f9 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 6 Apr 2023 14:12:47 +0300 Subject: [PATCH 07/12] Fix InputFieldBtnCalendar component --- apps/common/main/lib/component/InputField.js | 13 +++++++++++-- apps/documenteditor/main/locale/en.json | 5 +++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/apps/common/main/lib/component/InputField.js b/apps/common/main/lib/component/InputField.js index 882b53cfed..14e61569dd 100644 --- a/apps/common/main/lib/component/InputField.js +++ b/apps/common/main/lib/component/InputField.js @@ -679,11 +679,18 @@ define([ validateOnBlur: true, disabled: false, editable: true, - iconCls: 'toolbar__icon btn-datetime', + iconCls: 'toolbar__icon btn-date', btnHint: '', menu: true }, + initialize : function(options) { + options = options || {}; + options.btnHint = options.btnHint || this.textDate; + + Common.UI.InputFieldBtn.prototype.initialize.call(this, options); + }, + render: function (parentEl) { var me = this; Common.UI.InputFieldBtn.prototype.render.call(this, parentEl); @@ -718,7 +725,9 @@ define([ setDate: function(date) { if (this.cmpCalendar && date && date instanceof Date && !isNaN(date)) this.cmpCalendar && this.cmpCalendar.setDate(date); - } + }, + + textDate: 'Select date' } })()); }); \ No newline at end of file diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index c857eae777..cbea8ec515 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -340,6 +340,7 @@ "Common.UI.HSBColorPicker.textNoColor": "No Color", "Common.UI.InputFieldBtnPassword.textHintHidePwd": "Hide password", "Common.UI.InputFieldBtnPassword.textHintShowPwd": "Show password", + "Common.UI.InputFieldBtnCalendar.textDate": "Select date", "Common.UI.SearchBar.textFind": "Find", "Common.UI.SearchBar.tipCloseSearch": "Close search", "Common.UI.SearchBar.tipNextResult": "Next result", @@ -2193,6 +2194,10 @@ "DE.Views.FormSettings.textValue": "Value Options", "DE.Views.FormSettings.textWidth": "Cell width", "DE.Views.FormSettings.textZipCodeUS": "US Zip Code (e.g. 92663 or 92663-1234)", + "DE.Views.FormSettings.textDefValue": "Default value", + "DE.Views.FormSettings.textCheckDefault": "Checkbox is checked by default", + "DE.Views.FormSettings.textRadioDefault": "Button is checked by default", + "DE.Views.FormSettings.txtEmpty": "(Empty)", "DE.Views.FormsTab.capBtnCheckBox": "Checkbox", "DE.Views.FormsTab.capBtnComboBox": "Combo Box", "DE.Views.FormsTab.capBtnComplex": "Complex Field", From 69cce203e205d4876e94c8deff33327af784d151 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 6 Apr 2023 14:34:38 +0300 Subject: [PATCH 08/12] [DE] Fix default value for date form --- apps/documenteditor/main/app/view/FormSettings.js | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/documenteditor/main/app/view/FormSettings.js b/apps/documenteditor/main/app/view/FormSettings.js index 112c83fd7e..1fbf13c062 100644 --- a/apps/documenteditor/main/app/view/FormSettings.js +++ b/apps/documenteditor/main/app/view/FormSettings.js @@ -831,6 +831,7 @@ define([ var formDatePr = new AscCommon.CSdtDatePickerPr(); formDatePr.put_DateFormat(this.cmbDateFormat.getValue()); formDatePr.put_LangId(this.cmbLang.getValue()); + formDatePr.put_FullDate(date); var str = formDatePr.get_String(); input.setValue(str); this.api.asc_SetFormValue(str, this.internalId); From 68bda838e55acabb8303878934145ff86757817a Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 6 Apr 2023 15:06:30 +0300 Subject: [PATCH 09/12] [DE] Apply default value for date form --- apps/documenteditor/main/app/view/FormSettings.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/documenteditor/main/app/view/FormSettings.js b/apps/documenteditor/main/app/view/FormSettings.js index 1fbf13c062..8b87045aea 100644 --- a/apps/documenteditor/main/app/view/FormSettings.js +++ b/apps/documenteditor/main/app/view/FormSettings.js @@ -828,13 +828,13 @@ define([ onDateDefClick: function(input, date) { if (this.api && !this._noApply) { - var formDatePr = new AscCommon.CSdtDatePickerPr(); - formDatePr.put_DateFormat(this.cmbDateFormat.getValue()); - formDatePr.put_LangId(this.cmbLang.getValue()); + var props = this._originalProps || new AscCommon.CContentControlPr(); + var formDatePr = this._originalDateProps || new AscCommon.CSdtDatePickerPr(); formDatePr.put_FullDate(date); - var str = formDatePr.get_String(); - input.setValue(str); - this.api.asc_SetFormValue(str, this.internalId); + props.put_DateTimePr(formDatePr); + props.put_PlaceholderText(formDatePr.get_String()); + this.api.asc_SetContentControlProperties(props, this.internalId); + this.fireEvent('editcomplete', this); } }, From 37b2bfb5bc1dbd0f866f06fb994fbe7629bb5723 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 6 Apr 2023 16:04:04 +0300 Subject: [PATCH 10/12] [DE] Add icons --- .../main/resources/img/toolbar/1.25x/btn-date.png | Bin 0 -> 231 bytes .../main/resources/img/toolbar/1.5x/btn-date.png | Bin 0 -> 228 bytes .../main/resources/img/toolbar/1.75x/btn-date.png | Bin 0 -> 240 bytes .../main/resources/img/toolbar/1x/btn-date.png | Bin 0 -> 222 bytes .../main/resources/img/toolbar/2x/btn-date.png | Bin 0 -> 293 bytes 5 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 apps/common/main/resources/img/toolbar/1.25x/btn-date.png create mode 100644 apps/common/main/resources/img/toolbar/1.5x/btn-date.png create mode 100644 apps/common/main/resources/img/toolbar/1.75x/btn-date.png create mode 100644 apps/common/main/resources/img/toolbar/1x/btn-date.png create mode 100644 apps/common/main/resources/img/toolbar/2x/btn-date.png diff --git a/apps/common/main/resources/img/toolbar/1.25x/btn-date.png b/apps/common/main/resources/img/toolbar/1.25x/btn-date.png new file mode 100644 index 0000000000000000000000000000000000000000..e6a18fb7233220aa492e95935f5dcb5ceae79df0 GIT binary patch literal 231 zcmeAS@N?(olHy`uVBq!ia0vp^MnEjd!VDxEs}jnA6id3JuOkD)#(wTUiL5|AV{wqX z6T`Z5GB1G~&H|6fVg?3oVGw3ym^DWND99h+6XNP#;Pe0ge;^M+zRL-p3gj@C1o;Is z+`s>7*ClTtH^|e)F+}5ha>4@nf`r6`gv0`d%`+u=BqVrd9L!M@*C=2rYUy3*(7?E6 z7OPuRi1YyuHnABC6C@?tYb4nvnr9PHC^>D+I_C~hE25Yew%nYBeiumX*^F9tV Oox#)9&t;ucLK6TNjYZM` literal 0 HcmV?d00001 diff --git a/apps/common/main/resources/img/toolbar/1.5x/btn-date.png b/apps/common/main/resources/img/toolbar/1.5x/btn-date.png new file mode 100644 index 0000000000000000000000000000000000000000..c085d85ad1cdc934ed211a368002c4d4c685374f GIT binary patch literal 228 zcmeAS@N?(olHy`uVBq!ia0vp^Hb5-L!VDyvwk6a6DVB6cUq=Rpjs4tz5?O(K#^NA% zCx&(BWL^R}oCO|{#S9GG!XV7ZFl&wkP>?^sC&bmgz~}$}|3Dsue3uhG706*O3GxeO zxPSlEu1nrPuD_>?V~EE24g~sw=zS76ypj--Yud{56YY`tay0ghKtdhsKmbTSq@o}TNoHN$V)b+infXZjb`w4 L^>bP0l+XkK5#mA{ literal 0 HcmV?d00001 diff --git a/apps/common/main/resources/img/toolbar/1.75x/btn-date.png b/apps/common/main/resources/img/toolbar/1.75x/btn-date.png new file mode 100644 index 0000000000000000000000000000000000000000..15ae976a0a1fd17f0db081235c80d03a097cc132 GIT binary patch literal 240 zcmeAS@N?(olHy`uVBq!ia0vp^Za}Qe!VDyDTPDT?^sC&bmgz~}$}|3Dsue3uhG706*O3GxeO zxPSlEu1nrPZnUS1V~EA+i_@% literal 0 HcmV?d00001 diff --git a/apps/common/main/resources/img/toolbar/1x/btn-date.png b/apps/common/main/resources/img/toolbar/1x/btn-date.png new file mode 100644 index 0000000000000000000000000000000000000000..e2e53e3e3f4b5c3e479a3aa88e8b3065b2ec9b14 GIT binary patch literal 222 zcmeAS@N?(olHy`uVBq!ia0vp^8bB<!lvI6;x#X;^) z4C~IxyaaMM3p^r=85p>QL70(Y)*K0-Ab)^Qh^u>n&;S4bfjkKLE+>2{ki%ROoPfr)e5Q)pl2@6ClHaHkCH!~Wu7#pnE(a>fG= zqFe#&+Fx8kEhJTzwXP~qypklcI^9XfWn-1-O0J8|3^y0^aJ)O9<>I^{!OcxYOXgu- z%7G-)NG|r;R~uc<#soVg1+AEwEf|r=waSTmLWIC7r^2>C2cRcbv#rZM-Tp=Z=mrK) LS3j3^P6 Date: Thu, 6 Apr 2023 16:04:15 +0300 Subject: [PATCH 11/12] Fix lock --- apps/documenteditor/main/app/view/FormSettings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/documenteditor/main/app/view/FormSettings.js b/apps/documenteditor/main/app/view/FormSettings.js index 8b87045aea..b9d14dcbc3 100644 --- a/apps/documenteditor/main/app/view/FormSettings.js +++ b/apps/documenteditor/main/app/view/FormSettings.js @@ -219,7 +219,7 @@ define([ dataHintDirection: 'left', dataHintOffset: 'small' }); - this.lockedControls.push(this.txtDefValue); + this.lockedControls.push(this.txtDateDefValue); this.txtDateDefValue.on('changed:after', this.onTxtDefChanged.bind(this)); this.txtDateDefValue.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); this.txtDateDefValue.on('date:click', this.onDateDefClick.bind(this)); From 0f9eb92ecc3de030b97d357d5a50d1ca8b6a661f Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 11 Apr 2023 14:04:10 +0300 Subject: [PATCH 12/12] [DE] Fix empty value for dropdown form --- .../main/app/view/FormSettings.js | 17 ++++------------- apps/documenteditor/main/locale/en.json | 1 - 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/apps/documenteditor/main/app/view/FormSettings.js b/apps/documenteditor/main/app/view/FormSettings.js index b9d14dcbc3..7b731b6384 100644 --- a/apps/documenteditor/main/app/view/FormSettings.js +++ b/apps/documenteditor/main/app/view/FormSettings.js @@ -227,7 +227,7 @@ define([ setTimeout(function(){me.txtDateDefValue._input && me.txtDateDefValue._input.select();}, 1); }); - this.cmbDefValue = new Common.UI.ComboBoxCustom({ + this.cmbDefValue = new Common.UI.ComboBox({ el: $markup.findById('#form-combo-def-value'), cls: 'input-group-nr', menuCls: 'menu-absolute', @@ -236,15 +236,7 @@ define([ data: [], dataHint: '1', dataHintDirection: 'bottom', - dataHintOffset: 'big', - itemsTemplate: _.template([ - '<% _.each(items, function(item) { %>', - '
  • opacity: 0.6 <% } %>"><%= scope.getDisplayValue(item) %>
  • ', - '<% }); %>' - ].join('')), - updateFormControl: function(record) { - record && this.setRawValue(record.get('value')); - } + dataHintOffset: 'big' }); this.cmbDefValue.setValue(''); this.lockedControls.push(this.cmbDefValue); @@ -1310,7 +1302,7 @@ define([ arr.forEach(function(item) { item.value = item.displayValue = item.name; }); - (arr.length>0) && arr.unshift({value: '', displayValue: this.txtEmpty}); + (arr.length>0) && arr.unshift({value: '', displayValue: this.textNone}); this.cmbDefValue.setData(arr); this.cmbDefValue.setDisabled(arr.length<1); this.cmbDefValue.setValue(this.api.asc_GetFormValue(this.internalId) || ''); @@ -1993,8 +1985,7 @@ define([ textLang: 'Language', textDefValue: 'Default value', textCheckDefault: 'Checkbox is checked by default', - textRadioDefault: 'Button is checked by default', - txtEmpty: '(Empty)' + textRadioDefault: 'Button is checked by default' }, DE.Views.FormSettings || {})); }); \ No newline at end of file diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index cbea8ec515..ff87209c35 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -2197,7 +2197,6 @@ "DE.Views.FormSettings.textDefValue": "Default value", "DE.Views.FormSettings.textCheckDefault": "Checkbox is checked by default", "DE.Views.FormSettings.textRadioDefault": "Button is checked by default", - "DE.Views.FormSettings.txtEmpty": "(Empty)", "DE.Views.FormsTab.capBtnCheckBox": "Checkbox", "DE.Views.FormsTab.capBtnComboBox": "Combo Box", "DE.Views.FormsTab.capBtnComplex": "Complex Field",