[DE mobile] Change calendar

This commit is contained in:
SergeyEzhin 2021-09-23 16:32:01 +03:00
parent 4c685403d4
commit f37b4ef8e0

View file

@ -542,6 +542,7 @@ class MainController extends Component {
// if (storeAppOptions.isEdit) { // if (storeAppOptions.isEdit) {
this.api.asc_registerCallback('asc_onShowContentControlsActions', (obj, x, y) => { this.api.asc_registerCallback('asc_onShowContentControlsActions', (obj, x, y) => {
console.log(obj, x, y);
switch (obj.type) { switch (obj.type) {
case Asc.c_oAscContentControlSpecificType.DateTime: case Asc.c_oAscContentControlSpecificType.DateTime:
this.onShowDateActions(obj, x, y); this.onShowDateActions(obj, x, y);
@ -565,13 +566,18 @@ class MainController extends Component {
}); });
this.api.asc_registerCallback('asc_onHideContentControlsActions', () => { this.api.asc_registerCallback('asc_onHideContentControlsActions', () => {
if (this.cmpCalendar) { console.log(true);
this.controlsContainer.remove(); // console.log(this.cmpCalendar);
this.cmpCalendar.destroy(); // if (this.cmpCalendar) {
} // console.log(1);
// // this.controlsContainer.remove();
// $$('#calendar-target-element').remove();
// this.cmpCalendar.destroy();
// console.log(this.cmpCalendar);
// }
}); });
this.api.asc_SetHighlightRequiredFields(true); // this.api.asc_SetHighlightRequiredFields(true);
// } // }
// text settings // text settings
@ -688,9 +694,10 @@ class MainController extends Component {
onShowDateActions(obj, x, y) { onShowDateActions(obj, x, y) {
let props = obj.pr, let props = obj.pr,
specProps = props.get_DateTimePr(); specProps = props.get_DateTimePr(),
isPhone = Device.isPhone;
this.controlsContainer = this.boxSdk.find('#calendar-control-container'); this.controlsContainer = this.boxSdk.find('#calendar-target-element');
this._dateObj = props; this._dateObj = props;
if (this.controlsContainer.length < 1) { if (this.controlsContainer.length < 1) {
@ -699,30 +706,32 @@ class MainController extends Component {
this.boxSdk.append(this.controlsContainer); this.boxSdk.append(this.controlsContainer);
} }
if(!Device.isPhone) { this.cmpCalendar = f7.calendar.create({
this.cmpCalendar = f7.calendar.create({ inputEl: '#calendar-target-element',
inputEl: '#calendar-target-element', firstDay: 0,
firstday: 0, // backdrop: false,
value: [new Date(specProps ? specProps.get_FullDate() : undefined)], // closeByBackdropClick: false,
openIn: 'popover', // closeByOutsideClick: true,
footer: true, value: [new Date(specProps ? specProps.get_FullDate() : undefined)],
on: { openIn: 'sheet',
change: (calendar, value) => { footer: true,
if(value[0]) { on: {
let specProps = this._dateObj.get_DateTimePr(); change: (calendar, value) => {
// console.log(new Date(value[0])); if(calendar.initialized && value[0]) {
specProps.put_FullDate(new Date(value[0])); let specProps = this._dateObj.get_DateTimePr();
this.api.asc_SetContentControlDatePickerDate(specProps); console.log(value[0]);
this.api.asc_UncheckContentControlButtons(); specProps.put_FullDate(new Date(value[0]));
} this.api.asc_SetContentControlDatePickerDate(specProps);
this.api.asc_UncheckContentControlButtons();
} }
} }
}); }
});
this.cmpCalendar.open(); this.cmpCalendar.open();
}
} }
onShowListActions(obj, x, y) { onShowListActions(obj, x, y) {
let type = obj.type, let type = obj.type,
props = obj.pr, props = obj.pr,