[DE mobile] Added calendar for tablet version
This commit is contained in:
parent
79c022cc5d
commit
4c685403d4
|
@ -17,6 +17,7 @@ import ErrorController from "./Error";
|
||||||
import LongActionsController from "./LongActions";
|
import LongActionsController from "./LongActions";
|
||||||
import PluginsController from '../../../../common/mobile/lib/controller/Plugins.jsx';
|
import PluginsController from '../../../../common/mobile/lib/controller/Plugins.jsx';
|
||||||
import EncodingController from "./Encoding";
|
import EncodingController from "./Encoding";
|
||||||
|
import { Device } from '../../../../common/mobile/utils/device';
|
||||||
@inject(
|
@inject(
|
||||||
"users",
|
"users",
|
||||||
"storeAppOptions",
|
"storeAppOptions",
|
||||||
|
@ -539,38 +540,41 @@ class MainController extends Component {
|
||||||
|
|
||||||
const storeAppOptions = this.props.storeAppOptions;
|
const storeAppOptions = this.props.storeAppOptions;
|
||||||
|
|
||||||
// if(storeAppOptions.canFillForms) {
|
// if (storeAppOptions.isEdit) {
|
||||||
this.api.asc_registerCallback('asc_onShowContentControlsActions', (obj, x, y) => {
|
this.api.asc_registerCallback('asc_onShowContentControlsActions', (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);
|
||||||
break;
|
break;
|
||||||
case Asc.c_oAscContentControlSpecificType.Picture:
|
case Asc.c_oAscContentControlSpecificType.Picture:
|
||||||
if (obj.pr && obj.pr.get_Lock) {
|
if (obj.pr && obj.pr.get_Lock) {
|
||||||
let lock = obj.pr.get_Lock();
|
let lock = obj.pr.get_Lock();
|
||||||
if (lock == Asc.c_oAscSdtLockType.SdtContentLocked || lock == Asc.c_oAscSdtLockType.ContentLocked)
|
if (lock == Asc.c_oAscSdtLockType.SdtContentLocked || lock == Asc.c_oAscSdtLockType.ContentLocked)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.api.asc_addImage(obj);
|
this.api.asc_addImage(obj);
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.api.asc_UncheckContentControlButtons();
|
this.api.asc_UncheckContentControlButtons();
|
||||||
}, 500);
|
}, 500);
|
||||||
break;
|
break;
|
||||||
case Asc.c_oAscContentControlSpecificType.DropDownList:
|
case Asc.c_oAscContentControlSpecificType.DropDownList:
|
||||||
case Asc.c_oAscContentControlSpecificType.ComboBox:
|
case Asc.c_oAscContentControlSpecificType.ComboBox:
|
||||||
this.onShowListActions(obj, x, y);
|
this.onShowListActions(obj, x, y);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.api.asc_registerCallback('asc_onHideContentControlsActions', () => {
|
|
||||||
if (this.cmpCalendar) {
|
this.api.asc_registerCallback('asc_onHideContentControlsActions', () => {
|
||||||
this.cmpCalendar.close();
|
if (this.cmpCalendar) {
|
||||||
}
|
this.controlsContainer.remove();
|
||||||
});
|
this.cmpCalendar.destroy();
|
||||||
this.api.asc_SetHighlightRequiredFields(true);
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.api.asc_SetHighlightRequiredFields(true);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
//text settings
|
// text settings
|
||||||
const storeTextSettings = this.props.storeTextSettings;
|
const storeTextSettings = this.props.storeTextSettings;
|
||||||
storeTextSettings.resetFontsRecent(LocalStorage.getItem('dde-settings-recent-fonts'));
|
storeTextSettings.resetFontsRecent(LocalStorage.getItem('dde-settings-recent-fonts'));
|
||||||
|
|
||||||
|
@ -683,75 +687,42 @@ class MainController extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
onShowDateActions(obj, x, y) {
|
onShowDateActions(obj, x, y) {
|
||||||
console.log(obj, x, y);
|
|
||||||
let props = obj.pr,
|
let props = obj.pr,
|
||||||
specProps = props.get_DateTimePr();
|
specProps = props.get_DateTimePr();
|
||||||
// controlsContainer = this.boxSdk.find('#calendar-control-container');
|
|
||||||
|
|
||||||
|
this.controlsContainer = this.boxSdk.find('#calendar-control-container');
|
||||||
this._dateObj = props;
|
this._dateObj = props;
|
||||||
|
|
||||||
// if (controlsContainer.length < 1) {
|
if (this.controlsContainer.length < 1) {
|
||||||
// controlsContainer = $$('<div id="calendar-control-container" style="position: absolute;z-index: 1000;"><div id="id-document-calendar-control" style="position: fixed; left: -1000px; top: -1000px;"></div></div>');
|
this.controlsContainer = $$('<div id="calendar-target-element" style="position: absolute;"></div>');
|
||||||
// this.boxSdk.append(controlsContainer);
|
this.controlsContainer.css({left: `${x}px`, top: `${y}px`});
|
||||||
// }
|
this.boxSdk.append(this.controlsContainer);
|
||||||
|
}
|
||||||
// Common.UI.Menu.Manager.hideAll();
|
|
||||||
|
if(!Device.isPhone) {
|
||||||
// controlsContainer.css({left: x, top : y});
|
|
||||||
// controlsContainer.show();
|
|
||||||
|
|
||||||
if (!this.cmpCalendar) {
|
|
||||||
this.cmpCalendar = f7.calendar.create({
|
this.cmpCalendar = f7.calendar.create({
|
||||||
inputEl: this.boxSdk.find('#id-document-calendar-control'),
|
inputEl: '#calendar-target-element',
|
||||||
backgrop: false,
|
firstday: 0,
|
||||||
closeByBackdropClick: false,
|
value: [new Date(specProps ? specProps.get_FullDate() : undefined)],
|
||||||
firstday: 1,
|
openIn: 'popover',
|
||||||
value: new Date(specProps ? specProps.get_FullDate() : undefined),
|
|
||||||
// openIn: 'sheet',
|
|
||||||
header: true,
|
|
||||||
footer: true,
|
footer: true,
|
||||||
}).open();
|
on: {
|
||||||
|
change: (calendar, value) => {
|
||||||
// this.cmpCalendar = this.boxSdk.find('#id-document-calendar-control');
|
if(value[0]) {
|
||||||
|
let specProps = this._dateObj.get_DateTimePr();
|
||||||
this.cmpCalendar.on('change', (calendar, value) => {
|
// console.log(new Date(value[0]));
|
||||||
let specProps = this._dateObj.get_DateTimePr();
|
specProps.put_FullDate(new Date(value[0]));
|
||||||
specProps.put_FullDate(new Date(value));
|
this.api.asc_SetContentControlDatePickerDate(specProps);
|
||||||
this.api.asc_SetContentControlDatePickerDate(specProps);
|
this.api.asc_UncheckContentControlButtons();
|
||||||
controlsContainer.hide();
|
}
|
||||||
this.api.asc_UncheckContentControlButtons();
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.cmpCalendar.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
// this.cmpCalendar.setValue([new Date(specProps ? specProps.get_FullDate() : undefined)]);
|
|
||||||
|
|
||||||
// Align
|
|
||||||
|
|
||||||
// let offset = controlsContainer.offset(),
|
|
||||||
// docW = Common.Utils.innerWidth(),
|
|
||||||
// docH = Common.Utils.innerHeight() - 10,
|
|
||||||
// menuW = this.cmpCalendar.outerWidth(),
|
|
||||||
// menuH = this.cmpCalendar.outerHeight(),
|
|
||||||
// buttonOffset = 22,
|
|
||||||
// left = offset.left - menuW,
|
|
||||||
// top = offset.top;
|
|
||||||
|
|
||||||
// if (top + menuH > docH) {
|
|
||||||
// top = docH - menuH;
|
|
||||||
// left -= buttonOffset;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (top < 0)
|
|
||||||
// top = 0;
|
|
||||||
|
|
||||||
// if (left + menuW > docW)
|
|
||||||
// left = docW - menuW;
|
|
||||||
|
|
||||||
// this.cmpCalendar.css({left: left, top : top});
|
|
||||||
// this._preventClick = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onShowListActions(obj, x, y) {
|
onShowListActions(obj, x, y) {
|
||||||
let type = obj.type,
|
let type = obj.type,
|
||||||
props = obj.pr,
|
props = obj.pr,
|
||||||
|
@ -763,7 +734,6 @@ class MainController extends Component {
|
||||||
this._listObj = props;
|
this._listObj = props;
|
||||||
|
|
||||||
this._fromShowContentControls = true;
|
this._fromShowContentControls = true;
|
||||||
// Common.UI.Menu.Manager.hideAll();
|
|
||||||
|
|
||||||
if (!menu) {
|
if (!menu) {
|
||||||
this.listControlMenu = menu = new Common.UI.Menu({
|
this.listControlMenu = menu = new Common.UI.Menu({
|
||||||
|
|
Loading…
Reference in a new issue