add item Long Date

This commit is contained in:
OVSharova
2023-01-19 16:14:24 +03:00
parent 08acc2b66e
commit ff233c9043
5 changed files with 47 additions and 10 deletions

View File

@ -4164,8 +4164,11 @@ define([
info.asc_setType(Asc.c_oAscNumFormatType.None);
info.asc_setSymbol(this._state.langId);
var arr = this.api.asc_getFormatCells(info); // all formats
var disp=0
for (var i=0; i<menu.items.length-2; i++) {
menu.items[i].options.format = arr[i];
menu.items[i].options.format = arr[i+disp];
if(i== Asc.c_oAscNumFormatType.Date)
disp = 1;
}
}

View File

@ -1482,8 +1482,10 @@ define([
onNumberFormatSelect: function(combo, record) {
if (record) {
if (this.api)
if (this.api) {
this.api.asc_setCellFormat(record.format);
this.cmbNumberFormatSetValue(record.value);
}
} else {
this.onCustomNumberFormat();
}
@ -1532,10 +1534,18 @@ define([
item.exampleval = me.api.asc_getLocaleExample(item.format);
});
me.toolbar.cmbNumberFormat.setData(me.toolbar.numFormatData);
me.toolbar.cmbNumberFormat.setValue(me._state.numformattype, me.toolbar.txtCustom);
this.cmbNumberFormatSetValue();
}
},
cmbNumberFormatSetValue: function (numformattype){
numformattype = !numformattype ? this._state.numformattype :numformattype
var indexNFD = numformattype + (numformattype > Asc.c_oAscNumFormatType.Date)|0;
this.toolbar.cmbNumberFormat.setRawValue(
(numformattype === Asc.c_oAscNumFormatType.Date) ? this.toolbar.txtDate : this.toolbar.numFormatData[indexNFD].displayValue
);
},
onDecrement: function(btn) {
if (this.api)
this.api.asc_decreaseCellDigitNumbers();
@ -3190,8 +3200,8 @@ define([
this._state.numformatinfo = val;
val = val.asc_getType();
if (this._state.numformattype !== val) {
toolbar.cmbNumberFormat.setValue(val, toolbar.txtCustom);
this._state.numformattype = val;
this.cmbNumberFormatSetValue();
}
}
@ -3348,8 +3358,8 @@ define([
this._state.numformatinfo = val;
val = val.asc_getType();
if (this._state.numformattype !== val) {
me.toolbar.cmbNumberFormat.setValue(val, me.toolbar.txtCustom);
this._state.numformattype = val;
this.cmbNumberFormatSetValue();
}
}
},
@ -3719,8 +3729,8 @@ define([
this._state.numformatinfo = val;
val = val.asc_getType();
if (this._state.numformattype !== val) {
me.toolbar.cmbNumberFormat.setValue(val, me.toolbar.txtCustom);
this._state.numformattype = val;
this.cmbNumberFormatSetValue();
}
}
},

View File

@ -579,7 +579,8 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesEditDlg.template',
{ value: Asc.c_oAscNumFormatType.Scientific,format: this.ascFormatOptions.Scientific, displayValue: this.txtScientific, exampleval: '1,00E+02' },
{ value: Asc.c_oAscNumFormatType.Accounting,format: this.ascFormatOptions.Accounting, displayValue: this.txtAccounting, exampleval: '100,00 $' },
{ value: Asc.c_oAscNumFormatType.Currency, format: this.ascFormatOptions.Currency, displayValue: this.txtCurrency, exampleval: '100,00 $' },
{ value: Asc.c_oAscNumFormatType.Date, format: 'MM-dd-yyyy', displayValue: this.txtDate, exampleval: '04-09-1900' },
{ value: Asc.c_oAscNumFormatType.Date, format: 'MM-dd-yyyy', displayValue: this.txtDateShort, exampleval: '04-09-1900' },
{ value: Asc.c_oAscNumFormatType.Date, format: 'MMMM d yyyy', displayValue: this.txtDateLong, exampleval: 'April-09-1900' },
{ value: Asc.c_oAscNumFormatType.Time, format: 'HH:MM:ss', displayValue: this.txtTime, exampleval: '00:00:00' },
{ value: Asc.c_oAscNumFormatType.Percent, format: this.ascFormatOptions.Percentage, displayValue: this.txtPercentage, exampleval: '100,00%' },
{ value: Asc.c_oAscNumFormatType.Fraction, format: this.ascFormatOptions.Fraction, displayValue: this.txtFraction, exampleval: '100' },
@ -620,8 +621,9 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesEditDlg.template',
data : this.numFormatData,
takeFocusOnClose: true
});
this.cmbNumberFormat.setValue(Asc.c_oAscNumFormatType.General);
this.cmbNumberFormat.setRawValue(this.numFormatData[Asc.c_oAscNumFormatType.General].displayValue);
this.cmbNumberFormat.on('selected', _.bind(this.onNumberFormatSelect, this));
this.cmbNumberFormat.on('show:before', _.bind(this.onNumberFormatShowBefore, this));
Common.UI.FocusManager.add(this, this.cmbNumberFormat);
this.btnClear = new Common.UI.Button({
@ -1313,7 +1315,13 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesEditDlg.template',
color = this.setColor(xfs.asc_getFillColor(), this.btnFillColor, this.mnuFillColorPicker);
var val = xfs.asc_getNumFormatInfo();
val && this.cmbNumberFormat.setValue(val.asc_getType(), this.textCustom);
if (val) {
val = val.asc_getType();
var indexNFD = val + (val > Asc.c_oAscNumFormatType.Date)|0;
this.cmbNumberFormat.setRawValue(
(val === Asc.c_oAscNumFormatType.Date) ? this.txtDate : this.numFormatData[indexNFD].displayValue
);
}
}
},
@ -1738,6 +1746,13 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesEditDlg.template',
!this.xfsFormat && (this.xfsFormat = new Asc.asc_CellXfs());
this.xfsFormat.asc_setNumFormatInfo(record.format);
this.previewFormat();
this.cmbNumberFormat.setRawValue(
(record.value === Asc.c_oAscNumFormatType.Date) ? this.txtDate : record.displayValue);
},
onNumberFormatShowBefore: function (){
var rec = $('.selected', $(this.cmbNumberFormat.el));
rec && rec.removeClass('selected');;
},
previewFormat: function() {
@ -2179,6 +2194,8 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesEditDlg.template',
txtCurrency: 'Currency',
txtAccounting: 'Accounting',
txtDate: 'Date',
txtDateShort: 'Short Date',
txtDateLong: 'Long Date',
txtTime: 'Time',
txtPercentage: 'Percentage',
txtFraction: 'Fraction',

View File

@ -167,7 +167,8 @@ define([
{ value: Asc.c_oAscNumFormatType.Scientific,format: this.ascFormatOptions.Scientific, displayValue: this.txtScientific, exampleval: '1,00E+02' },
{ value: Asc.c_oAscNumFormatType.Accounting,format: this.ascFormatOptions.Accounting, displayValue: this.txtAccounting, exampleval: '100,00 $' },
{ value: Asc.c_oAscNumFormatType.Currency, format: this.ascFormatOptions.Currency, displayValue: this.txtCurrency, exampleval: '100,00 $' },
{ value: Asc.c_oAscNumFormatType.Date, format: 'MM-dd-yyyy', displayValue: this.txtDate, exampleval: '04-09-1900' },
{ value: Asc.c_oAscNumFormatType.Date, format: 'MM-dd-yyyy', displayValue: this.txtDateShort, exampleval: '04-09-1900' },
{ value: Asc.c_oAscNumFormatType.Date, format: 'MMMM d yyyy', displayValue: this.txtDateLong, exampleval: 'April 9 1900' },
{ value: Asc.c_oAscNumFormatType.Time, format: 'HH:MM:ss', displayValue: this.txtTime, exampleval: '00:00:00' },
{ value: Asc.c_oAscNumFormatType.Percent, format: this.ascFormatOptions.Percentage, displayValue: this.txtPercentage, exampleval: '100,00%' },
{ value: Asc.c_oAscNumFormatType.Fraction, format: this.ascFormatOptions.Fraction, displayValue: this.txtFraction, exampleval: '100' },
@ -3247,6 +3248,8 @@ define([
// txtFranc: 'CHF Swiss franc',
txtAccounting: 'Accounting',
txtDate: 'Date',
txtDateShort: 'Short Date',
txtDateLong: 'Long Date',
txtTime: 'Time',
txtDateTime: 'Date & Time',
txtPercentage: 'Percentage',

View File

@ -2576,6 +2576,8 @@
"SSE.Views.FormatRulesEditDlg.txtAccounting": "Accounting",
"SSE.Views.FormatRulesEditDlg.txtCurrency": "Currency",
"SSE.Views.FormatRulesEditDlg.txtDate": "Date",
"SSE.Views.FormatRulesEditDlg.txtDateLong": "Long Date",
"SSE.Views.FormatRulesEditDlg.txtDateShort": "Short Date",
"SSE.Views.FormatRulesEditDlg.txtEmpty": "This field is required",
"SSE.Views.FormatRulesEditDlg.txtFraction": "Fraction",
"SSE.Views.FormatRulesEditDlg.txtGeneral": "General",
@ -3846,6 +3848,8 @@
"SSE.Views.Toolbar.txtCurrency": "Currency",
"SSE.Views.Toolbar.txtCustom": "Custom",
"SSE.Views.Toolbar.txtDate": "Date",
"SSE.Views.Toolbar.txtDateLong": "Long Date",
"SSE.Views.Toolbar.txtDateShort": "Date Short",
"SSE.Views.Toolbar.txtDateTime": "Date & Time",
"SSE.Views.Toolbar.txtDescending": "Descending",
"SSE.Views.Toolbar.txtDollar": "$ Dollar",