This commit is contained in:
2023-03-11 17:30:20 +00:00
commit b6c4e025bc
5124 changed files with 1153349 additions and 0 deletions
@@ -0,0 +1,698 @@
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var Unibase;
(function (Unibase) {
let Apps;
(function (Apps) {
let Collaboration;
(function (Collaboration) {
let Components;
(function (Components) {
let Common;
(function (Common) {
class Download extends Unibase.Platform.Core.BaseComponent {
constructor() {
super(...arguments);
this.requestId = 0;
this.actionsWhileCreatingNewFile = [];
}
downloadDocumentFile(FileId, documentGroup, documnetfilename, savetype, documentContainer) {
if (documentGroup == "Word") {
this.fileCacheHelper.loadJsFile("platform/analytics/components/chartviewer/chartviewer.js", () => __awaiter(this, void 0, void 0, function* () {
Unibase.Apps.Collaboration.DocumentManager.Instance().getDocumentFileInfo(FileId).then((response) => {
var result = response.result;
var fileName = result.FileTitle;
var filetype = result.FileType;
documentContainer.save(fileName, savetype);
});
}));
}
else if (documentGroup == "Excel") {
let instance = document.getElementById('DocumentViewer').ej2_instances[0];
instance.saveAsJson().then((res) => {
this.dataForJson = res;
var JSONData = JSON.stringify(this.dataForJson.jsonObject.Workbook);
var sheetIndex = Unibase.Apps.Collaboration.Components.Sheets.Base.Instance().ssObj.activeSheetIndex;
this.data = {
FileId: FileId,
SaveTypeID: savetype,
SheetIndex: sheetIndex,
};
Unibase.Apps.Collaboration.DocumentManager.Instance().spreadSheetDownload(this.data).then((response) => {
this.fileCacheHelper.loadJsFile("tenants/themes/compact/components/notifications/notification.js", () => __awaiter(this, void 0, void 0, function* () {
var path = encodeURIComponent(response.result);
Unibase.Themes.Compact.Components.Notification.Instance().Downloadfile(path);
}));
});
});
}
}
saveDocumentFile(FileId, documentGroup, documentContainer, args, sheetBaseIns) {
return __awaiter(this, void 0, void 0, function* () {
document.getElementsByClassName('biz-ss-saving')[0].style.display = 'inline-block';
if (document.getElementsByClassName("biz-ss-saveicon")[0].classList.contains("biz-ss-cloudsave")) {
document.getElementsByClassName("biz-ss-saveicon")[0].style.display = 'none';
document.getElementsByClassName("biz-ss-cloudloading")[0].style.display = 'inline-block';
}
if (documentGroup == "Word") {
this.data = {
Content: documentContainer.serialize(),
FileId: FileId
};
yield Unibase.Apps.Collaboration.DocumentManager.Instance().saveWord(this.data).then((response) => {
var result = response;
Unibase.Apps.Collaboration.Components.DocEditor.Base.Instance().editDetails();
});
}
else if (documentGroup == "Excel") {
this.ssAutoSave(args, sheetBaseIns, true);
}
setTimeout(function () {
return __awaiter(this, void 0, void 0, function* () {
if (document.getElementsByClassName("biz-ss-saveicon")[0].classList.contains("biz-ss-cloudsave")) {
document.getElementsByClassName("biz-ss-saveicon")[0].style.display = 'inline-block';
document.getElementsByClassName("biz-ss-cloudloading")[0].style.display = 'none';
document.getElementsByClassName('biz-ss-saving')[0].style.display = 'none';
}
});
}, 1000);
});
}
getCellWithRowAndColByRange(range, sheet) {
let idx = ej.spreadsheet.getIndexesFromAddress(range);
return { SheetIndex: this.baseIns.ssObj.biz.getSheetIndexByname(sheet.name), row: idx[0], cell: idx[1], cellInfo: this.baseIns.ssObj.biz.getCell(idx[0], idx[1], sheet) };
}
ssAutoSave(args, base, saveversion, callback) {
if (base.permissionLevel !== Unibase.Apps.Collaboration.Enums.Share.Viewer) {
this.requestId++;
let refId;
let action = args.action;
let data;
this.baseIns = base;
let indexes = base.ssObj.biz.getIndexes();
let sheet = base.ssObj.biz.getActiveSheet();
let sheetIdx = base.getSheetIndex();
let saveType = "cell";
let isCreateNewFile = false;
let changedValue = [];
let isCut = false;
console.log("Save start " + action + " " + Date());
if (args.action == "resize") {
(args.eventArgs.isCol) ? action = "colResize" : action = "rowResize";
}
;
(args.eventArgs) && (args.eventArgs.modelType) && (args.eventArgs.modelType == "Sheet" && action == "insert") && (action = "insertSheet");
(args.action == "delete") && (args.eventArgs.modelType == "Row") && (action = "deleteRow");
(args.action == "delete") && (args.eventArgs.modelType == "Column") && (action = "deleteCol");
if (args.action == "insertshiftright" || args.action == "deleteshiftleft") {
action = "shiftright&left";
}
if (args.action == "insertshiftdown" || args.action == "deleteshiftup") {
action = "shiftup&down";
}
if (args.action != "import" && args.action != "gotoSheet" && !this.baseIns.isCreatingNewFile) {
!(base.FileId) && (isCreateNewFile = true, this.baseIns.isCreatingNewFile = true, refId = Unibase.Themes.Providers.DetailHelper.recordId);
switch (action) {
case "cellSave":
indexes = this.baseIns.getIndexesFromAddress(args.eventArgs.address.split("!")[1]);
changedValue = [{ Row: indexes[0], Cell: indexes[3], CellInfo: sheet.rows[indexes[0]].cells[indexes[3]] }];
data = {
changedvalues: changedValue,
iscreatenewfile: isCreateNewFile,
FileId: base.FileId,
sheetIndex: sheetIdx,
autosavetype: saveType,
requestId: this.requestId,
};
break;
case "format":
case "validation":
case "shortcuts":
case "autofill":
case "removeDuplicates":
case "trim":
for (var i = indexes[0]; i <= indexes[2]; i++) {
for (var j = indexes[1]; j <= indexes[3]; j++) {
var cellInfo = ej.spreadsheet.getCell(i, j, sheet);
let obj = { Row: i, cell: j, CellInfo: cellInfo };
(obj.CellInfo) && (obj.CellInfo.validation) && (obj.CellInfo.validation.inCellDropDown == null) && (obj.CellInfo.validation.inCellDropDown = false);
changedValue.push(obj);
}
}
data = {
changedvalues: changedValue,
iscreatenewfile: isCreateNewFile,
FileId: base.FileId,
sheetIndex: sheetIdx,
autosavetype: saveType,
modelType: (args.eventArgs) ? args.eventArgs.modelType : null,
requestId: this.requestId,
saveversions: saveversion,
};
break;
case "insertImage":
case "deleteChart":
case "cellDelete":
case "insertChart":
case "multipleCells":
setTimeout(() => {
(action == "deleteChart") && (indexes = base.getIndexesFromAddress(args.eventArgs.range.split("!")[1]));
for (var i = indexes[0]; i <= indexes[2]; i++) {
for (var j = indexes[1]; j <= indexes[3]; j++) {
var cellInfo = ej.spreadsheet.getCell(i, j, sheet);
let obj = { Row: i, cell: j, CellInfo: cellInfo };
(action == "deleteChart") && (cellInfo.chart) && (cellInfo.chart.pop(cellInfo.chart.find(x => x.id = args.eventArgs.id))) && (cellInfo.chart.length == 0) && (cellInfo.chart = null);
(obj.CellInfo) && (obj.CellInfo.validation) && (obj.CellInfo.validation.inCellDropDown == null) && (obj.CellInfo.validation.inCellDropDown = false);
if (action == "insertImage") {
cellInfo.image.forEach(image => {
image.left = parseInt(image.left);
image.height = parseInt(image.height);
image.top = parseInt(image.top);
image.width = parseInt(image.width);
});
}
else if (action == "cellDelete" && cellInfo && cellInfo.image && cellInfo.image[0] && cellInfo.image.findIndex(x => x.id.startsWith("biz_image_in_cell")) !== -1) {
let index = cellInfo.image.findIndex(x => x.id.startsWith("biz_image_in_cell"));
cellInfo.image.splice(index, 1);
}
changedValue.push(obj);
}
}
data = {
changedvalues: changedValue,
iscreatenewfile: isCreateNewFile,
FileId: base.FileId,
sheetIndex: sheetIdx,
saveversions: saveversion,
autosavetype: saveType,
modelType: (args.eventArgs) ? args.eventArgs.modelType : null,
requestId: this.requestId,
};
(isCreateNewFile) && (data["folderId"] = this.baseIns.folderId);
(data) && Unibase.Apps.Collaboration.DocumentManager.Instance().ssAutoSave(data);
}, 10);
break;
case "imageRefresh":
data = {
changedvalues: args.changedValues,
iscreatenewfile: isCreateNewFile,
FileId: base.FileId,
sheetIndex: sheetIdx,
autosavetype: saveType,
requestId: this.requestId,
saveversions: saveversion,
};
break;
case "insert":
saveType = "addRowsAndColumn";
data = {
Indexes: this.baseIns.ssObj.biz.getIndexes(),
iscreatenewfile: isCreateNewFile,
FileId: base.FileId,
sheetIndex: sheet.index,
autosavetype: saveType,
modelType: args.eventArgs.modelType,
saveversions: saveversion,
requestId: this.requestId,
RowIndex: args.eventArgs.index,
InsertType: args.eventArgs.insertType,
};
break;
case "moveSheet":
saveType = "moveSheet";
data = {
FileId: base.FileId,
sheetIndex: sheet.index,
autosavetype: saveType,
saveversions: saveversion,
requestId: this.requestId,
Indexes: [args.sheetIndexes.pop(), args.position],
};
break;
case "deleteRow":
saveType = "deleteRow";
data = {
Indexes: [args.eventArgs.startIndex, args.eventArgs.endIndex - args.eventArgs.startIndex + 1],
iscreatenewfile: isCreateNewFile,
FileId: base.FileId,
saveversions: saveversion,
sheetIndex: sheetIdx,
autosavetype: saveType,
requestId: this.requestId,
};
break;
case "deleteCol":
saveType = "deleteColumn";
var usedrangeindex = [];
var usedrange = this.baseIns.ssObj.getActiveSheet().usedRange;
usedrangeindex.push(usedrange.colIndex);
usedrangeindex.push(usedrange.rowIndex);
data = {
Indexes: [args.eventArgs.startIndex, args.eventArgs.endIndex - args.eventArgs.startIndex + 1],
iscreatenewfile: isCreateNewFile,
FileId: base.FileId,
sheetIndex: sheetIdx,
autosavetype: saveType,
saveversions: saveversion,
requestId: this.requestId,
RowIndex: args.eventArgs.index,
};
break;
case "shiftright&left":
saveType = "shiftright&left";
data = {
Indexes: this.baseIns.ssObj.biz.getIndexes(),
iscreatenewfile: isCreateNewFile,
FileId: base.FileId,
sheetIndex: sheetIdx,
autosavetype: saveType,
saveversions: saveversion,
requestId: this.requestId,
Action: args.action,
UsedRange: usedrangeindex,
};
break;
case "shiftup&down":
setTimeout(() => {
saveType = "shiftup&down";
var usedrangeindex = [];
var usedrange = this.baseIns.ssObj.getActiveSheet().usedRange;
usedrangeindex.push(usedrange.rowIndex);
usedrangeindex.push(usedrange.colIndex);
data = {
Indexes: this.baseIns.ssObj.biz.getIndexes(),
iscreatenewfile: isCreateNewFile,
FileId: base.FileId,
sheetIndex: sheetIdx,
autosavetype: saveType,
saveversions: saveversion,
requestId: this.requestId,
Action: args.action,
UsedRange: usedrangeindex,
};
(isCreateNewFile) && (data["folderId"] = this.baseIns.folderId);
(data) && Unibase.Apps.Collaboration.DocumentManager.Instance().ssAutoSave(data);
}, 0);
break;
case "headers":
saveType = "headers";
data = {
FileId: base.FileId,
iscreatenewfile: isCreateNewFile,
sheetIndex: args.eventArgs.sheetIdx,
showHeader: args.eventArgs.isShow,
autosavetype: saveType,
saveversions: saveversion,
requestId: this.requestId,
};
break;
case "gridLines":
saveType = "gridlines";
data = {
FileId: base.FileId,
iscreatenewfile: isCreateNewFile,
sheetIndex: args.eventArgs.sheetIdx,
showGridlines: args.eventArgs.isShow,
autosavetype: saveType,
saveversions: saveversion,
requestId: this.requestId,
};
break;
case "freezePanes":
saveType = "freezepanes";
data = {
FileId: base.FileId,
iscreatenewfile: isCreateNewFile,
sheetIndex: args.eventArgs.sheetIdx,
freezeRow: args.eventArgs.row,
freezeColumn: args.eventArgs.column,
autosavetype: saveType,
saveversions: saveversion,
requestId: this.requestId,
};
break;
case "insertCell":
saveType = "selectedRows";
data = {
FileId: base.FileId,
iscreatenewfile: isCreateNewFile,
sheetIndex: sheetIdx,
autosavetype: saveType,
rowInfo: sheet.rows[indexes[0]],
indexes: indexes,
saveversions: saveversion,
requestId: this.requestId,
};
break;
case "conditionalFormat":
saveType = "conditionalFormat";
changedValue = [{ Row: indexes[0], Cell: indexes[3], ConditionalFormat: sheet.conditionalFormats }];
data = {
changedvalues: changedValue,
iscreatenewfile: isCreateNewFile,
FileId: base.FileId,
sheetIndex: sheetIdx,
autosavetype: saveType,
saveversions: saveversion,
requestId: this.requestId,
};
break;
case "clipboard":
if (args.eventArgs && args.eventArgs.copiedInfo && args.eventArgs.copiedInfo.isCut == true) {
isCut = true;
var cutSheetIndex = base.ssObj.biz.getSheetIndexByname(args.eventArgs.copiedRange.split("!")[0]);
var cutCellIndexes = base.swapRange(ej.spreadsheet.getIndexesFromAddress(args.eventArgs.copiedRange.split("!")[1]));
}
for (var i = indexes[0]; i <= indexes[2]; i++) {
for (var j = indexes[1]; j <= indexes[3]; j++) {
var cellInfo = ej.spreadsheet.getCell(i, j, sheet);
let obj = { Row: i, cell: j, CellInfo: cellInfo };
changedValue.push(obj);
}
}
data = {
changedvalues: changedValue,
iscreatenewfile: isCreateNewFile,
FileId: base.FileId,
sheetIndex: args.eventArgs.pasteSheetIndex,
autosavetype: saveType,
cutSheetIndex: cutSheetIndex,
cutCellIndexes: cutCellIndexes,
isCut: isCut,
saveversions: saveversion,
requestId: this.requestId,
};
break;
case "cellDrag":
data = {
changedvalues: args.changedValue,
iscreatenewfile: isCreateNewFile,
FileId: base.FileId,
sheetIndex: sheetIdx,
autosavetype: saveType,
cutSheetIndex: sheetIdx,
cutCellIndexes: args.cutCellIdxs,
isCut: true,
saveversions: saveversion,
requestId: this.requestId,
};
break;
case "newspreadsheet":
saveType = "newspreadsheet";
data = {
FileId: 0,
iscreatenewfile: isCreateNewFile,
autosavetype: saveType,
requestId: this.requestId,
saveversions: saveversion,
};
break;
case "replaceAll":
case "replace":
saveType = "replaceAll";
if (action == "replaceAll") {
args.eventArgs.addressCollection.forEach((e) => {
let sheet = this.baseIns.ssObj.biz.getSheetByName(e.split("!")[0]);
changedValue.push(this.getCellWithRowAndColByRange(e.split("!")[1], sheet));
});
}
else {
let sheet = this.baseIns.ssObj.biz.getSheetByName(args.eventArgs.address.split("!")[0]);
changedValue.push(this.getCellWithRowAndColByRange(args.eventArgs.address.split("!")[1], sheet));
}
data = {
changedvalues: changedValue,
FileId: base.FileId,
sheetIndex: args.eventArgs.pasteSheetIndex,
autosavetype: saveType,
saveversions: saveversion,
requestId: this.requestId,
};
break;
case "insertSheet":
let sheetIndex = args.eventArgs.index;
sheet = base.ssObj.sheets[sheetIndex];
saveType = "insertsheet";
data = {
FileId: base.FileId,
iscreatenewfile: isCreateNewFile,
autosavetype: saveType,
sheet: sheet,
sheetIndex: sheetIndex,
saveversions: saveversion,
requestId: this.requestId,
};
break;
case "removeSheet":
saveType = "removeSheet";
data = {
FileId: base.FileId,
autosavetype: saveType,
sheetIndex: args.sheetIndex,
saveversions: saveversion,
requestId: this.requestId,
};
break;
case "applyFilter":
saveType = "applyFilter";
data = {
FileId: base.FileId,
autosavetype: saveType,
filter: args.collection,
requestId: this.requestId,
};
break;
case "removeFilter":
saveType = "removeFilter";
data = {
FileId: base.FileId,
autosavetype: saveType,
sheetIndex: args.sheetIndex,
requestId: this.requestId,
};
break;
case "updateFilter":
saveType = "updateFilter";
data = {
FileId: base.FileId,
autosavetype: saveType,
filter: args.collection,
requestId: this.requestId,
sheetIndex: sheetIdx,
};
break;
case "renameSheet":
saveType = "renameSheet";
data = {
FileId: base.FileId,
autosavetype: saveType,
SheetIndex: sheetIdx,
SheetName: args.eventArgs.value,
requestId: this.requestId,
};
break;
case 'destroy':
var contId = $("._bizgaze_popup_container:visible").attr("id");
$('#' + contId).modal('hide');
$('#' + contId).remove();
window.close();
break;
case "copytonewspreadsheet":
saveType = "newwbsheets";
let currentSheet = base.ssObj.workbookSaveModule.getStringifyObject(base.ssObj.sheets[sheetIdx]);
let sheetName = base.FileName;
data = {
FileId: 0,
iscreatenewfile: isCreateNewFile,
autosavetype: saveType,
sheet: currentSheet,
requestId: this.requestId,
saveversions: saveversion,
sheetName: sheetName,
};
break;
case "colResize":
setTimeout(() => {
saveType = "colResize";
if (args.eventArgs.index && !args.indexes)
args['indexes'] = [0, args.eventArgs.index, 0, args.eventArgs.index];
else if (!(args.indexes && args.eventArgs.index))
args['indexes'] = this.baseIns.ssObj.biz.getIndexes();
data = {
FileId: base.FileId,
iscreatenewfile: isCreateNewFile,
autosavetype: saveType,
sheetIndex: sheetIdx,
requestId: this.requestId,
width: parseInt(args.eventArgs.width),
saveversions: saveversion,
indexes: args.indexes,
};
(isCreateNewFile) && (data["folderId"] = this.baseIns.folderId);
(data) && Unibase.Apps.Collaboration.DocumentManager.Instance().ssAutoSave(data);
}, 100);
break;
case "rowResize":
setTimeout(() => {
saveType = "rowResize";
if (args.eventArgs.index && !args.indexes)
args['indexes'] = [args.eventArgs.index, 0, args.eventArgs.index, 0];
else if (!(args.indexes && args.eventArgs.index))
args['indexes'] = this.baseIns.ssObj.biz.getIndexes();
data = {
FileId: base.FileId,
iscreatenewfile: isCreateNewFile,
autosavetype: saveType,
sheetIndex: sheetIdx,
requestId: this.requestId,
height: parseInt(args.eventArgs.height),
indexes: args.indexes,
saveversions: saveversion,
};
(isCreateNewFile) && (data["folderId"] = this.baseIns.folderId);
(data) && Unibase.Apps.Collaboration.DocumentManager.Instance().ssAutoSave(data);
}, 100);
break;
case "imageincell":
data = {
FileId: base.FileId,
iscreatenewfile: isCreateNewFile,
autosavetype: saveType,
requestId: this.requestId,
sheetIndex: sheetIdx,
saveversions: saveversion,
changedvalues: args.changedValues,
};
break;
case "createNewSpreadsheet":
isCreateNewFile = true;
saveType = "createNewSpreadsheet";
data = {
iscreatenewfile: isCreateNewFile,
autosavetype: saveType,
requestId: this.requestId,
sheetname: document.getElementsByClassName("biz-ss-filename")[0].value
};
break;
case "headerResize":
saveType = "headerResize";
data = {
FileId: base.FileId,
iscreatenewfile: isCreateNewFile,
autosavetype: saveType,
requestId: this.requestId,
sheetIndex: sheetIdx,
saveversions: saveversion,
multipleheaderresize: args.resizedHeaders
};
break;
case "duplicateSheet":
saveType = "duplicateSheet";
data = {
FileId: base.FileId,
autosavetype: saveType,
requestId: this.requestId,
sheetIndex: args.sheetIndex,
saveversions: saveversion,
};
break;
case "deleteImage":
saveType = "deleteImage";
data = {
FileId: base.FileId,
autosavetype: saveType,
requestId: this.requestId,
saveversions: saveversion,
sheetIndex: sheetIdx,
imageId: args.id,
imageSource: args.src,
};
break;
case "resizeToAutoFitColumn":
saveType = "resizeToAutoFitColumn";
data = {
FileId: base.FileId,
autosavetype: saveType,
requestId: this.requestId,
saveversions: saveversion,
sheetIndex: sheetIdx,
indexes: args.eventArgs.selectedRange,
ColumnWidth: args.eventArgs.columns,
};
break;
case "resizeToAutoFitRow":
saveType = "resizeToAutoFitRow";
data = {
FileId: base.FileId,
autosavetype: saveType,
requestId: this.requestId,
saveversions: saveversion,
sheetIndex: sheetIdx,
indexes: args.eventArgs.selectedRange,
RowHeight: args.eventArgs.rows,
};
break;
case "wrap":
saveType = "wrap";
let indxs = ej.spreadsheet.getIndexesFromAddress(args.eventArgs.address.split("!")[1]);
data = {
FileId: base.FileId,
autosavetype: saveType,
requestId: this.requestId,
saveversions: saveversion,
sheetIndex: sheetIdx,
indexes: indxs,
wrap: args.eventArgs.wrap,
};
break;
}
(isCreateNewFile) && (data["folderId"] = this.baseIns.folderId);
(data) && Unibase.Apps.Collaboration.DocumentManager.Instance().ssAutoSave(data).then((response) => {
this.baseIns.editDetails();
console.log("Save end " + action + " " + Date());
if (action === "insertSheet" || action === "removeSheet") {
Unibase.Apps.Collaboration.DocumentManager.Instance().getCustomJsonData(base.FileId).then((res) => {
base.customresult = res.result.tabcolors;
});
}
else if (response.message == "New spreadsheet has been created" && action !== "copytonewspreadsheet") {
this.baseIns.FileId = response.result.FileId;
this.baseIns.fileurl = response.result.FileUrl;
this.baseIns.FileName = response.result.FileTitle;
this.baseIns.isCreatingNewFile = false;
for (var i = 0; i < this.actionsWhileCreatingNewFile.length; i++) {
this.ssAutoSave(this.actionsWhileCreatingNewFile[i], this.baseIns, true);
}
}
else if ((action === "copytonewspreadsheet" && response.message === "New spreadsheet has been created")) {
if (callback != null) {
callback();
}
}
});
}
else {
this.actionsWhileCreatingNewFile.push(args);
}
}
}
static Instance() {
if (this.instance === undefined) {
this.instance = new Download();
}
return this.instance;
}
}
Common.Download = Download;
})(Common = Components.Common || (Components.Common = {}));
})(Components = Collaboration.Components || (Collaboration.Components = {}));
})(Collaboration = Apps.Collaboration || (Apps.Collaboration = {}));
})(Apps = Unibase.Apps || (Unibase.Apps = {}));
})(Unibase || (Unibase = {}));
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
{"version":3,"file":"import.js","sourceRoot":"","sources":["import.ts"],"names":[],"mappings":""}
@@ -0,0 +1,79 @@
var Unibase;
(function (Unibase) {
let Apps;
(function (Apps) {
let Collaboration;
(function (Collaboration) {
let Components;
(function (Components) {
let Common;
(function (Common) {
class Util {
createElement(tagName, attType, attValue) {
let ele = document.createElement(tagName);
ele.setAttribute(attType, attValue);
return ele;
}
appendChildren(parent, classIndex, ...eleArray) {
let parentTag = document.getElementsByClassName(parent)[classIndex];
for (let i = 0; i < eleArray.length; i++) {
parentTag.appendChild(eleArray[i]);
}
}
addAttributes(htmlElement, attrJson) {
for (var attr in attrJson) {
htmlElement.setAttribute(attr, attrJson[attr]);
}
}
getCellValues(cellInfo) {
var val = {};
cellInfo.value && (val["value"] = cellInfo.value.toString().trim());
cellInfo.formula && (val["formula"] = cellInfo.formula);
cellInfo.format ? (val["format"] = cellInfo.format) : (val["format"] = "General");
cellInfo.hyperlink && (val["hyperlink"] = cellInfo.hyperlink);
return val;
}
colorHash(str) {
var sum = 0;
for (var i in str) {
sum += str.charCodeAt(i);
}
let r = ~~(('0.' + Math.sin(sum + 1).toString().substr(6)) * 256);
let g = ~~(('0.' + Math.sin(sum + 2).toString().substr(6)) * 256);
let b = ~~(('0.' + Math.sin(sum + 3).toString().substr(6)) * 256);
let rgb = "rgb(" + r + ", " + g + ", " + b + ")";
let hex = "#";
hex += ("00" + r.toString(16)).substr(-2, 2).toUpperCase();
hex += ("00" + g.toString(16)).substr(-2, 2).toUpperCase();
hex += ("00" + b.toString(16)).substr(-2, 2).toUpperCase();
return {
r: r,
g: g,
b: b,
rgb: rgb,
hex: hex
};
}
makeid(length) {
var result = '';
var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
var charactersLength = characters.length;
for (var i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() *
charactersLength));
}
return result;
}
static Instance() {
if (this.instance === undefined) {
this.instance = new Util();
}
return this.instance;
}
}
Common.Util = Util;
})(Common = Components.Common || (Components.Common = {}));
})(Components = Collaboration.Components || (Collaboration.Components = {}));
})(Collaboration = Apps.Collaboration || (Apps.Collaboration = {}));
})(Apps = Unibase.Apps || (Unibase.Apps = {}));
})(Unibase || (Unibase = {}));
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"util.js","sourceRoot":"","sources":["util.ts"],"names":[],"mappings":"AAAA,IAAU,OAAO,CA0FhB;AA1FD,WAAU,OAAO;IACb,IAAiB,IAAI,CAuFpB;IAvFD,WAAiB,IAAI;QACjB,IAAiB,aAAa,CAqF7B;QArFD,WAAiB,aAAa;YAC1B,IAAiB,UAAU,CAmF1B;YAnFD,WAAiB,UAAU;gBACvB,IAAiB,MAAM,CAiFtB;gBAjFD,WAAiB,MAAM;oBACnB,MAAa,IAAI;wBAEb,aAAa,CAAC,OAAe,EAAE,OAAe,EAAE,QAAgB;4BAC5D,IAAI,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;4BAC1C,GAAG,CAAC,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;4BACpC,OAAO,GAAG,CAAC;wBACf,CAAC;wBAGD,cAAc,CAAC,MAAc,EAAE,UAAkB,EAAE,GAAG,QAAuB;4BACzE,IAAI,SAAS,GAAG,QAAQ,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,CAAA;4BACnE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gCACtC,SAAS,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;6BACtC;wBACL,CAAC;wBAGD,aAAa,CAAC,WAAW,EAAE,QAAQ;4BAC/B,KAAK,IAAI,IAAI,IAAI,QAAQ,EAAE;gCACvB,WAAW,CAAC,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAA;6BACjD;wBACL,CAAC;wBAED,aAAa,CAAC,QAAQ;4BAClB,IAAI,GAAG,GAAG,EAAE,CAAC;4BACb,QAAQ,CAAC,KAAK,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;4BACpE,QAAQ,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;4BACxD,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC,CAAC;4BAClF,QAAQ,CAAC,SAAS,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;4BAC9D,OAAO,GAAG,CAAC;wBACf,CAAC;wBAED,SAAS,CAAC,GAAQ;4BACd,IAAI,GAAG,GAAG,CAAC,CAAC;4BAEZ,KAAK,IAAI,CAAC,IAAI,GAAG,EAAE;gCACf,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;6BAC5B;4BACD,IAAI,CAAC,GAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,CAAC,CAAS,IAAG,GAAG,CAAC,CAAC;4BAC9E,IAAI,CAAC,GAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,CAAC,CAAS,IAAG,GAAG,CAAC,CAAC;4BAC9E,IAAI,CAAC,GAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,CAAC,CAAS,IAAG,GAAG,CAAC,CAAC;4BAE9E,IAAI,GAAG,GAAG,MAAM,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,GAAG,CAAC;4BAEjD,IAAI,GAAG,GAAG,GAAG,CAAC;4BAEd,GAAG,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;4BAC3D,GAAG,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;4BAC3D,GAAG,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;4BAE3D,OAAO;gCACH,CAAC,EAAE,CAAC;gCACF,CAAC,EAAE,CAAC;gCACJ,CAAC,EAAE,CAAC;gCACJ,GAAG,EAAE,GAAG;gCACR,GAAG,EAAE,GAAG;6BACb,CAAC;wBACN,CAAC;wBAGD,MAAM,CAAC,MAAM;4BACT,IAAI,MAAM,GAAG,EAAE,CAAC;4BAChB,IAAI,UAAU,GAAG,gEAAgE,CAAC;4BAClF,IAAI,gBAAgB,GAAG,UAAU,CAAC,MAAM,CAAC;4BACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE;gCAC7B,MAAM,IAAI,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE;oCAChD,gBAAgB,CAAC,CAAC,CAAC;6BAC1B;4BACD,OAAO,MAAM,CAAC;wBAClB,CAAC;wBAGD,MAAM,CAAC,QAAQ;4BACX,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE;gCAC7B,IAAI,CAAC,QAAQ,GAAG,IAAI,IAAI,EAAE,CAAC;6BAC9B;4BACD,OAAO,IAAI,CAAC,QAAQ,CAAC;wBACzB,CAAC;qBAEJ;oBA/EY,WAAI,OA+EhB,CAAA;gBACL,CAAC,EAjFgB,MAAM,GAAN,iBAAM,KAAN,iBAAM,QAiFtB;YACL,CAAC,EAnFgB,UAAU,GAAV,wBAAU,KAAV,wBAAU,QAmF1B;QACL,CAAC,EArFgB,aAAa,GAAb,kBAAa,KAAb,kBAAa,QAqF7B;IACL,CAAC,EAvFgB,IAAI,GAAJ,YAAI,KAAJ,YAAI,QAuFpB;AAEL,CAAC,EA1FS,OAAO,KAAP,OAAO,QA0FhB"}
+1
View File
@@ -0,0 +1 @@
var Unibase;(function(n){let t;(function(n){let t;(function(n){let t;(function(n){let t;(function(n){class t{createElement(n,t,i){let r=document.createElement(n);return r.setAttribute(t,i),r}appendChildren(n,t,...i){let r=document.getElementsByClassName(n)[t];for(let n=0;n<i.length;n++)r.appendChild(i[n])}addAttributes(n,t){for(var i in t)n.setAttribute(i,t[i])}getCellValues(n){var t={};return n.value&&(t.value=n.value.toString().trim()),n.formula&&(t.formula=n.formula),t.format=n.format?n.format:"General",n.hyperlink&&(t.hyperlink=n.hyperlink),t}colorHash(n){var t=0;for(var e in n)t+=n.charCodeAt(e);let r=~~(("0."+Math.sin(t+1).toString().substr(6))*256),u=~~(("0."+Math.sin(t+2).toString().substr(6))*256),f=~~(("0."+Math.sin(t+3).toString().substr(6))*256),o="rgb("+r+", "+u+", "+f+")",i="#";return i+=("00"+r.toString(16)).substr(-2,2).toUpperCase(),i+=("00"+u.toString(16)).substr(-2,2).toUpperCase(),i+=("00"+f.toString(16)).substr(-2,2).toUpperCase(),{r:r,g:u,b:f,rgb:o,hex:i}}makeid(n){for(var t="",i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",u=i.length,r=0;r<n;r++)t+=i.charAt(Math.floor(Math.random()*u));return t}static Instance(){return this.instance===undefined&&(this.instance=new t),this.instance}}n.Util=t})(t=n.Common||(n.Common={}))})(t=n.Components||(n.Components={}))})(t=n.Collaboration||(n.Collaboration={}))})(t=n.Apps||(n.Apps={}))})(Unibase||(Unibase={}));
@@ -0,0 +1,187 @@
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var Unibase;
(function (Unibase) {
let Apps;
(function (Apps) {
let Collaboration;
(function (Collaboration) {
let Components;
(function (Components) {
class DocConnector {
constructor() {
this.methods = {
connectedUsers: function (FileUsers, DocumentGroup) {
console.log('connectedUsers is Connected !');
if (DocumentGroup == 'Excel') {
setTimeout(() => { Unibase.Apps.Collaboration.Components.Sheets.Base.Instance().activeUsers(FileUsers); }, 1000);
}
else if (DocumentGroup == 'Word') {
Unibase.Apps.Collaboration.Components.DocEditor.Base.Instance().activeUsers(FileUsers);
}
},
FileDisconnect: function (user, DocumentGroup) {
if (DocumentGroup == 'Excel') {
Unibase.Apps.Collaboration.Components.Sheets.Base.Instance().activeUsers(user);
}
else if (DocumentGroup == 'Word') {
Unibase.Apps.Collaboration.Components.DocEditor.Base.Instance().activeUsers(user);
}
}
};
DocConnector._isRegistered = false;
}
init(fileid, documentgroup) {
this.connection = Collaboration.Hubs.UniDocHub.Instance(_appsettings.dochub_url());
var fileId = parseInt(fileid);
this.start(fileId, documentgroup);
}
closeDoc() {
Unibase.Apps.Collaboration.Hubs.UniDocHub.Instance(_appsettings.dochub_url()).getConnection().stop();
}
ChangeDoc(username, args) {
Unibase.Apps.Collaboration.Hubs.UniDocHub.Instance(_appsettings.dochub_url()).getConnection().invoke("ChangeDoc", username, JSON.stringify(args));
}
getClientMethods() {
return [
{ MethodName: "connectedUsers", Method: this.methods.connectedUsers },
{ MethodName: "filedisconnect", Method: this.methods.FileDisconnect },
];
}
registerClientMethods() {
let _methods = this.getClientMethods();
if (_methods)
for (var i = 0; i < _methods.length; i++) {
this.connection.register(_methods[i].MethodName, _methods[i].Method);
}
}
connectedUsers(FileUsers) {
let ssObj = Unibase.Apps.Collaboration.Components.Documents.Instance()._openedfile;
let stCls = Unibase.Apps.Collaboration.Components.Sheets;
ssObj.signalrData = FileUsers;
var args = JSON.parse(FileUsers);
}
start(fileId, documentgroup) {
return __awaiter(this, void 0, void 0, function* () {
this.registerClientMethods();
try {
if (!DocConnector._isRegistered) {
DocConnector._isRegistered = true;
this.connection.register("changedocument", function (docData) {
let ssObj = Unibase.Apps.Collaboration.Components.Documents.Instance()._openedfile;
let stCls = Unibase.Apps.Collaboration.Components.Sheets;
ssObj.signalrData = docData;
var args = JSON.parse(docData);
try {
if (args.origin === 'biz') {
Unibase.Apps.Collaboration.Components.Documents.Instance()._openedfile.biz.sheetIndex = args.sheetIndex;
switch (args.action) {
case 'trim':
stCls.Ribbon.Instance().processTrim(args.range);
break;
case 'removeDuplicates':
stCls.Dialogue.Instance().removeDuplicate(args.range, args.header, args.colSelected);
break;
case 'autofill':
stCls.Autofill.Instance().applyAutofill(args.options, args.direction);
break;
case 'formatpaint':
stCls.FormatPainter.Instance().applyFormatPaint(args.srcRange, args.destRange, args.srcSheetIndex);
break;
case 'splittext':
stCls.FormatPainter.Instance().applySplitText(args.range, args.stValues);
break;
case 'shiftrows':
stCls.FormatPainter.Instance().applyShiftRows(args.dropIdx, args.rngIndexes, args.direction, false);
break;
case 'shiftcols':
stCls.FormatPainter.Instance().applyShiftCols(args.dropIdx, args.rngIndexes, args.direction, false);
break;
case 'deleteshiftup':
stCls.FormatPainter.Instance().applyDeleteShiftUp(args.range);
break;
case 'deleteshiftleft':
stCls.FormatPainter.Instance().applyDeleteShiftLeft(args.range);
break;
case 'insertshiftdown':
stCls.FormatPainter.Instance().applyInsertShiftDown(args.range);
break;
case 'insertshiftright':
stCls.FormatPainter.Instance().applyInsertShiftRight(args.range);
break;
case 'shiftcells':
stCls.FormatPainter.Instance().applyShiftCells(args.rowIdx, args.colIdx, args.ranges);
break;
case 'spellcheck':
stCls.SpellChecker.Instance().applySpellValue(args.rowIdx, args.colIdx, args.value);
break;
case 'selection':
stCls.FormatPainter.Instance().applyUserSelection(args.range, args.userName);
break;
case 'undoredo':
stCls.Base.Instance().performBizUndoRedo(args);
break;
case 'insertimage':
stCls.Base.Instance().actionInsertImage(args);
break;
case 'colorchange':
stCls.Base.Instance().sheetColorRender();
break;
case 'resize':
stCls.Base.Instance().adjustRowsAndColumnWidth(args);
break;
case 'importReplace':
location.reload();
break;
}
Unibase.Apps.Collaboration.Components.Sheets.Base.Instance().editDetails();
Unibase.Apps.Collaboration.Components.Documents.Instance()._openedfile.biz.sheetIndex = -1;
}
else {
Unibase.Apps.Collaboration.Components.Documents.Instance()._openedfile.updateAction(JSON.parse(docData));
Unibase.Apps.Collaboration.Components.Sheets.Base.Instance().editDetails();
}
}
catch (e) {
}
});
}
this.connection.connect(function () {
let identity = Unibase.Platform.Membership.Infos.Identity.getCurrentUser();
let UnibaseId = identity.unibaseId;
let FileId = fileId;
let FirstName = identity.name;
let SessionId = identity.sessionId;
let TenantId = identity.tenantId;
console.log("connection started");
Unibase.Apps.Collaboration.Hubs.UniDocHub.Instance(_appsettings.dochub_url()).getConnection().invoke("Connect", FileId, UnibaseId, FirstName, documentgroup, SessionId, TenantId).catch(function (err) {
return console.error(err.toString());
});
});
}
catch (err) {
console.log(err);
setTimeout(this.start, 5000);
}
});
}
;
static Instance() {
if (this.instance === undefined) {
this.instance = new DocConnector();
}
return this.instance;
}
}
Components.DocConnector = DocConnector;
})(Components = Collaboration.Components || (Collaboration.Components = {}));
})(Collaboration = Apps.Collaboration || (Apps.Collaboration = {}));
})(Apps = Unibase.Apps || (Unibase.Apps = {}));
})(Unibase || (Unibase = {}));
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
var __awaiter=this&&this.__awaiter||function(n,t,i,r){function u(n){return n instanceof i?n:new i(function(t){t(n)})}return new(i||(i=Promise))(function(i,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?i(n.value):u(n.value).then(o,s)}e((r=r.apply(n,t||[])).next())})},Unibase;(function(n){let t;(function(t){let i;(function(t){let i;(function(i){class r{constructor(){this.methods={connectedUsers:function(t,i){console.log("connectedUsers is Connected !");i=="Excel"?setTimeout(()=>{n.Apps.Collaboration.Components.Sheets.Base.Instance().activeUsers(t)},1e3):i=="Word"&&n.Apps.Collaboration.Components.DocEditor.Base.Instance().activeUsers(t)},FileDisconnect:function(t,i){i=="Excel"?n.Apps.Collaboration.Components.Sheets.Base.Instance().activeUsers(t):i=="Word"&&n.Apps.Collaboration.Components.DocEditor.Base.Instance().activeUsers(t)}};r._isRegistered=!1}init(n,i){this.connection=t.Hubs.UniDocHub.Instance(_appsettings.dochub_url());var r=parseInt(n);this.start(r,i)}closeDoc(){n.Apps.Collaboration.Hubs.UniDocHub.Instance(_appsettings.dochub_url()).getConnection().stop()}ChangeDoc(t,i){n.Apps.Collaboration.Hubs.UniDocHub.Instance(_appsettings.dochub_url()).getConnection().invoke("ChangeDoc",t,JSON.stringify(i))}getClientMethods(){return[{MethodName:"connectedUsers",Method:this.methods.connectedUsers},{MethodName:"filedisconnect",Method:this.methods.FileDisconnect},]}registerClientMethods(){let n=this.getClientMethods();if(n)for(var t=0;t<n.length;t++)this.connection.register(n[t].MethodName,n[t].Method)}connectedUsers(t){let i=n.Apps.Collaboration.Components.Documents.Instance()._openedfile,r=n.Apps.Collaboration.Components.Sheets;i.signalrData=t;var u=JSON.parse(t)}start(t,i){return __awaiter(this,void 0,void 0,function*(){this.registerClientMethods();try{r._isRegistered||(r._isRegistered=!0,this.connection.register("changedocument",function(t){let u=n.Apps.Collaboration.Components.Documents.Instance()._openedfile,r=n.Apps.Collaboration.Components.Sheets;u.signalrData=t;var i=JSON.parse(t);try{if(i.origin==="biz"){n.Apps.Collaboration.Components.Documents.Instance()._openedfile.biz.sheetIndex=i.sheetIndex;switch(i.action){case"trim":r.Ribbon.Instance().processTrim(i.range);break;case"removeDuplicates":r.Dialogue.Instance().removeDuplicate(i.range,i.header,i.colSelected);break;case"autofill":r.Autofill.Instance().applyAutofill(i.options,i.direction);break;case"formatpaint":r.FormatPainter.Instance().applyFormatPaint(i.srcRange,i.destRange,i.srcSheetIndex);break;case"splittext":r.FormatPainter.Instance().applySplitText(i.range,i.stValues);break;case"shiftrows":r.FormatPainter.Instance().applyShiftRows(i.dropIdx,i.rngIndexes,i.direction,!1);break;case"shiftcols":r.FormatPainter.Instance().applyShiftCols(i.dropIdx,i.rngIndexes,i.direction,!1);break;case"deleteshiftup":r.FormatPainter.Instance().applyDeleteShiftUp(i.range);break;case"deleteshiftleft":r.FormatPainter.Instance().applyDeleteShiftLeft(i.range);break;case"insertshiftdown":r.FormatPainter.Instance().applyInsertShiftDown(i.range);break;case"insertshiftright":r.FormatPainter.Instance().applyInsertShiftRight(i.range);break;case"shiftcells":r.FormatPainter.Instance().applyShiftCells(i.rowIdx,i.colIdx,i.ranges);break;case"spellcheck":r.SpellChecker.Instance().applySpellValue(i.rowIdx,i.colIdx,i.value);break;case"selection":r.FormatPainter.Instance().applyUserSelection(i.range,i.userName);break;case"undoredo":r.Base.Instance().performBizUndoRedo(i);break;case"insertimage":r.Base.Instance().actionInsertImage(i);break;case"colorchange":r.Base.Instance().sheetColorRender();break;case"resize":r.Base.Instance().adjustRowsAndColumnWidth(i);break;case"importReplace":location.reload()}n.Apps.Collaboration.Components.Sheets.Base.Instance().editDetails();n.Apps.Collaboration.Components.Documents.Instance()._openedfile.biz.sheetIndex=-1}else n.Apps.Collaboration.Components.Documents.Instance()._openedfile.updateAction(JSON.parse(t)),n.Apps.Collaboration.Components.Sheets.Base.Instance().editDetails()}catch(f){}}));this.connection.connect(function(){let r=n.Platform.Membership.Infos.Identity.getCurrentUser(),u=r.unibaseId,f=t,e=r.name,o=r.sessionId,s=r.tenantId;console.log("connection started");n.Apps.Collaboration.Hubs.UniDocHub.Instance(_appsettings.dochub_url()).getConnection().invoke("Connect",f,u,e,i,o,s).catch(function(n){return console.error(n.toString())})})}catch(u){console.log(u);setTimeout(this.start,5e3)}})}static Instance(){return this.instance===undefined&&(this.instance=new r),this.instance}}i.DocConnector=r})(i=t.Components||(t.Components={}))})(i=t.Collaboration||(t.Collaboration={}))})(t=n.Apps||(n.Apps={}))})(Unibase||(Unibase={}));
@@ -0,0 +1,529 @@
var Unibase;
(function (Unibase) {
let Apps;
(function (Apps) {
let Collaboration;
(function (Collaboration) {
let Components;
(function (Components) {
let DocEditor;
(function (DocEditor) {
class Base {
init(response, res, callback) {
this.result = response.result;
this.documentGroup = this.result.DocumentGroup;
this.filedata = res.result;
this.FileName = response.result.FileTitle;
this.FileId = response.result.FileId;
this.sourceFileId = response.result.SourceFileId;
this.Priority = response.result.Priority;
this.lastEditedTime = response.result.LastUpdateTime;
this.timePeriod = response.result.TimePeriod;
this.username = response.result.LastUpdateByName;
this.Priority = response.result.Priority;
this.newUpload = response.result.NewUpload;
this.identity = Unibase.Platform.Membership.Infos.Identity.getCurrentUser();
this.unibaseusername = this.identity.name.trim();
this.NewDocument = response.result.NewDocument;
this.render();
if (callback != null) {
callback();
}
}
unwireBootStrapKeyEvent() {
let popup = document.body.getElementsByClassName('_bizgaze_popup_container');
let events = $._data($(popup)[0], "events");
if (events && events.keydown) {
$(popup).off('keydown.dismiss.bs.modal', events.keydown[0].handler);
}
}
render() {
this.renderPopup();
this.updateProps();
this.renderMenuBar();
this.refreshHeight();
this.wordDocumentRender();
this.ribbon.init(this.wordDocumentObj, this.result);
this.priorityRender();
this.initSetInterval();
this.eventListeners();
this.unwireBootStrapKeyEvent();
if (!this.NewDocument) {
this.connectHub(this.FileId, this.documentGroup);
}
}
connectHub(fileId, documentgroup) {
Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFiles(["apps/collaboration/components/docconnector.js", "apps/collaboration/components/unidochub.js"], function () {
Unibase.Apps.Collaboration.Components.DocConnector.Instance().init(fileId, documentgroup);
});
}
priorityRender() {
if (this.Priority) {
$(".biz_doc_star_icon_" + this.FileId).removeClass("fa-star-o");
$(".biz_doc_star_icon_" + this.FileId).addClass("fa-star");
$(".biz_doc_star_icon_" + this.FileId).removeClass("text-light");
$(".biz_doc_star_icon_" + this.FileId).css("color", "orange");
}
}
eventListeners() {
try {
document.body.addEventListener("keydown", this.keyDown.bind(this));
document.body.addEventListener("mousedown", this.mouseDown.bind(this));
document.getElementsByClassName("biz-doc-starred")[0].addEventListener('click', (event) => {
});
document.getElementsByClassName("biz-doc-filename")[0].addEventListener('focusout', (event) => {
this.fileNameChange();
});
(document.getElementsByClassName('e-de-text-target')[0].contentWindow.document).addEventListener("keydown", (ele) => {
if (ele.keyCode == 122) {
event.preventDefault();
this.openFullscreen(this.container);
}
});
(document.getElementsByClassName('e-de-text-target')[0].contentWindow.document).addEventListener("keyup", (ele) => {
this.editorkeyUp(ele);
});
(document.getElementsByClassName('e-de-text-target')[0].contentWindow.document).addEventListener("mousedown", (ele) => {
this.editorMouseDown(ele);
});
this.container.addEventListener("fullscreenchange", () => {
this.fullscreenHandler(this.container);
});
this.wordDocumentObj.documentEditor.contextMenuModule.contextMenuInstance.addEventListener("beforeOpen", this.cmenuBfOpen.bind(this));
this.wordDocumentObj.documentEditor.contextMenuModule.contextMenuInstance.addEventListener("beforeItemRender", this.cmenuBfItemRndr.bind(this));
this.wordDocumentObj.documentEditor.contextMenuModule.contextMenuInstance.addEventListener("select", this.cmenuSelect.bind(this));
}
catch (e) {
}
}
keyDown(ele) {
if (ele.keyCode == 122) {
event.preventDefault();
setTimeout(() => { this.openFullscreen(this.container); }, 0);
}
if (ele.target.classList.contains("biz-doc-fileshare-btn")) {
Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile('apps/collaboration/components/unicloud.js', () => {
Unibase.Apps.Collaboration.Components.UniCloud.Instance().share(this.sourceFileId, "File", 0);
});
}
}
editorkeyUp(e) {
this.updateUndoRedo();
}
updateUndoRedo() {
let undoOverley = document.getElementById("DocumentViewer_toolbar_undo").parentElement.classList.contains("e-overlay");
let redoOverley = document.getElementById("DocumentViewer_toolbar_redo").parentElement.classList.contains("e-overlay");
let undobtn = document.getElementsByClassName("biz-doc-undo")[0];
let redobtn = document.getElementsByClassName("biz-doc-redo")[0];
this.enableOrDisableIcon(undoOverley, undobtn);
this.enableOrDisableIcon(redoOverley, redobtn);
}
editorMouseDown(e) {
let undo = e.target.closest(".biz-doc-undo");
let redo = e.target.closest(".biz-doc-redo");
(undo) && document.getElementById("DocumentViewer_toolbar_undo").click();
(redo) && document.getElementById("DocumentViewer_toolbar_redo").click();
this.updateUndoRedo();
}
mouseDown(e) {
if (e.target.id == "biz_doc_undobtn" || e.target.classList.contains("biz-doc-undo-icon")) {
document.getElementById("DocumentViewer_toolbar_undo").click();
}
else if (e.target.id == "biz_doc_redobtn" || e.target.classList.contains("biz-doc-redo-icon")) {
document.getElementById("DocumentViewer_toolbar_redo").click();
}
this.updateUndoRedo();
}
enableOrDisableIcon(undoOverley, btn) {
if (undoOverley) {
if (!btn.classList.contains("e-disabled"))
btn.classList.add("e-disabled");
}
else {
if (btn.classList.contains("e-disabled"))
btn.classList.remove("e-disabled");
}
}
openFullscreen(elem) {
if (elem.requestFullscreen) {
elem.requestFullscreen();
}
else if (elem.webkitRequestFullscreen) {
elem.webkitRequestFullscreen();
}
else if (elem.msRequestFullscreen) {
elem.msRequestFullscreen();
}
}
fullscreenHandler(container) {
setTimeout(() => {
if (document.fullscreenElement) {
this.fullscreenChange(container);
}
else {
this.fullscreenChange(container);
}
}, 100);
}
fullscreenChange(ele) {
let ribbonHeight = this.ribbonElem.offsetHeight;
let toolbarHeight = document.getElementsByClassName("biz-doc-bottomtoolbar")[0].offsetHeight;
let footerHeight = this.element.parentElement.nextElementSibling.offsetHeight;
var totalHeight = window.innerHeight - ribbonHeight - toolbarHeight - footerHeight;
this.element.parentElement.style.height = totalHeight + 'px';
this.wordDocumentObj.height = totalHeight + 'px';
}
wordDocumentRender() {
var instance = this;
this.wordDocumentObj = new ej.documenteditor.DocumentEditorContainer({
height: "100%",
enableEditor: true,
enableEditorHistory: true,
enableSelection: true,
enableSearch: true,
created: () => {
setTimeout(() => {
let updateTextPositionFn = this.wordDocumentObj.documentEditor.selectionModule.updateTextPosition.bind(this.wordDocumentObj.documentEditor.selectionModule);
this.wordDocumentObj.documentEditor.selectionModule.updateTextPosition = (a1, a2) => {
updateTextPositionFn(a1, a2);
let result = this.wordDocumentObj.documentEditor.selectionModule.updateTextPositionIn(a1, undefined, 0, a2, false);
this.formatInfo = result;
return result;
};
}, 800);
},
});
setInterval(() => {
var instance = this;
if (instance.contentChanged) {
this.onlineStatus = (window.navigator.onLine ? 'on' : 'off') + 'line';
window.addEventListener('online', () => document.getElementsByClassName('biz-ss-cloudsave')[0].style.display = 'inline-block');
window.addEventListener('online', () => document.getElementsByClassName("biz-ss-cloudoff")[0].style.display = "none");
window.addEventListener('offline', () => document.getElementsByClassName('biz-ss-cloudsave')[0].style.display = 'none');
window.addEventListener('offline', () => document.getElementsByClassName("biz-ss-cloudoff")[0].style.display = "inline-block");
if (this.onlineStatus == "online") {
Unibase.Apps.Collaboration.Components.Common.Download.Instance().saveDocumentFile(instance.FileId, instance.documentGroup, instance.documentContainer).then(function () {
});
}
instance.contentChanged = false;
}
}, 3000);
this.wordDocumentObj.appendTo('.DocumentViewer');
(this.filedata) && this.wordDocumentObj.documentEditor.open(this.filedata);
this.wordDocumentObj.documentEditor.enableSfdtExport = true;
this.wordDocumentObj.documentEditor.enableWordExport = true;
this.wordDocumentObj.documentEditor.enableTextExport = true;
this.wordDocumentObj.documentEditor.enableSelection = true;
this.wordDocumentObj.documentEditor.enableEditor = true;
this.wordDocumentObj.documentEditor.isReadOnly = false;
this.wordDocumentObj.documentEditor.enableLocalPaste = false;
var xyz = $("#DocumentViewer_editor")[0];
this.documentContainer = xyz.ej2_instances[0];
}
cmenuBfOpen(args) {
let cmenuModule = this.wordDocumentObj.documentEditor.contextMenuModule;
let items = this.wordDocumentObj.documentEditor.contextMenuModule.contextMenuInstance.items;
if (items.find(x => x.id == this.wordDocumentObj.element.id + "_cmenu_delete") == undefined) {
items.splice(5, 0, {
text: "Delete", iconCss: "e-icons MT_Delete", id: this.wordDocumentObj.element.id + "_cmenu_delete"
});
items.push({ text: "Clear Formatting", iconCss: "e-icons MT_ClearFormat", id: this.wordDocumentObj.element.id + "_cmenu_clear_formatting" });
}
this.wordDocumentObj.documentEditor.contextMenuModule.contextMenuInstance.items = items;
this.wordDocumentObj.documentEditor.contextMenuModule.contextMenuInstance.dataBind();
cmenuModule.showHideElements(cmenuModule.documentHelper.selection);
}
cmenuBfItemRndr(e) {
if (e.item.id == this.wordDocumentObj.element.id + "_cmenu_delete") {
let selectedText = this.wordDocumentObj.documentEditor.editor.selection.text;
if (selectedText.length == 0) {
e.element.classList.add("e-disabled");
}
}
}
cmenuSelect(args) {
if (args.item.id == this.wordDocumentObj.element.id + "_cmenu_delete") {
this.wordDocumentObj.documentEditor.editor.delete();
}
else if (args.item.id == this.wordDocumentObj.element.id + "_cmenu_clear_formatting") {
this.wordDocumentObj.documentEditor.editor.clearFormatting();
}
}
updateProps() {
this.element = document.getElementById('DocumentViewer');
this.fileName = this.result.FileName + "." + this.result.FileType;
this.ribbon = Unibase.Apps.Collaboration.Components.DocEditor.Ribbon.Instance();
this.util = Unibase.Apps.Collaboration.Components.Common.Util.Instance();
}
refreshHeight() {
var toolbarHeight = this.element.parentElement.previousElementSibling.offsetHeight;
var rootHeight = this.element.parentElement.parentElement.offsetHeight;
var rbnHeight = document.body.getElementsByClassName('biz-doc-ribbon')[0].offsetHeight;
this.element.parentElement.style.height = (rootHeight - rbnHeight - toolbarHeight) + 'px';
}
initSetInterval() {
if (this.timePeriod === "Minutes" || this.timePeriod === "Minute") {
this.intr = setInterval(() => {
this.lastEditedTime = this.lastEditedTime + 1;
this.username = this.username;
this.timePeriod = this.timePeriod;
if (this.lastEditedTime != 1) {
if (this.lastEditedTime >= 59 && this.timePeriod === "Minutes") {
Unibase.Apps.Collaboration.DocumentManager.Instance().lastEdit(this.FileId).then((response) => {
this.identity = Unibase.Platform.Membership.Infos.Identity.getCurrentUser();
this.unibaseusername = this.identity.name.trim();
this.lastEditedTime = response.result.Lastedittime;
this.username = response.result.LastUpdatedByName;
this.timePeriod = response.result.TimePeriod;
if (this.unibaseusername === this.username) {
let element = (document.getElementsByClassName('biz-doc-lastedited')[0]);
element.value = "last edit was made " + this.lastEditedTime + " " + this.timePeriod + " ago";
}
else {
let element = (document.getElementsByClassName('biz-doc-lastedited')[0]);
element.value = "last edit was made " + this.lastEditedTime + " " + this.timePeriod + " ago by " + this.username;
}
});
}
else {
this.identity = Unibase.Platform.Membership.Infos.Identity.getCurrentUser();
this.unibaseusername = this.identity.name.trim();
if (this.unibaseusername === this.username) {
let element = (document.getElementsByClassName('biz-doc-lastedited')[0]);
element.value = "last edit was made " + this.lastEditedTime + " " + this.timePeriod + " ago";
}
else {
let element = (document.getElementsByClassName('biz-doc-lastedited')[0]);
element.value = "last edit was made " + this.lastEditedTime + " " + this.timePeriod + " ago by " + this.username;
}
}
}
}, 60000);
}
else if (this.timePeriod === "Hour" || this.timePeriod === "Hours") {
this.intrhour = setInterval(() => {
this.lastEditedTime = this.lastEditedTime + 1;
this.username = this.username;
this.timePeriod = this.timePeriod;
if (this.lastEditedTime >= 23 && this.timePeriod === "Hours") {
Unibase.Apps.Collaboration.DocumentManager.Instance().lastEdit(this.FileId).then((response) => {
this.identity = Unibase.Platform.Membership.Infos.Identity.getCurrentUser();
this.unibaseusername = this.identity.name.trim();
this.lastEditedTime = response.result.Lastedittime;
this.username = response.result.LastUpdatedByName;
this.timePeriod = response.result.TimePeriod;
if (this.unibaseusername === this.username) {
let element = (document.getElementsByClassName('biz-doc-lastedited')[0]);
element.value = "last edit was made " + this.lastEditedTime + " " + this.timePeriod + " ago";
}
else {
let element = (document.getElementsByClassName('biz-doc-lastedited')[0]);
element.value = "last edit was made " + this.lastEditedTime + " " + this.timePeriod + " ago by " + this.username;
}
});
}
else {
this.identity = Unibase.Platform.Membership.Infos.Identity.getCurrentUser();
this.unibaseusername = this.identity.name.trim();
if (this.unibaseusername === this.username) {
let element = (document.getElementsByClassName('biz-doc-lastedited')[0]);
element.value = "last edit was made " + this.lastEditedTime + " " + this.timePeriod + " ago";
}
else {
let element = (document.getElementsByClassName('biz-doc-lastedited')[0]);
element.value = "last edit was made " + this.lastEditedTime + " " + this.timePeriod + " ago by " + this.username;
}
}
}, 3600000);
}
}
fileNameChange() {
var tempfilename = $(".biz-doc-filename").val();
var data = {
FileTitle: tempfilename,
FileId: this.FileId
};
Unibase.Apps.Collaboration.DocumentManager.Instance().renameFileTitle(data);
}
activeUsers(FileUsers) {
var connecteduser = [];
for (var v in FileUsers) {
let identity = Unibase.Platform.Membership.Infos.Identity.getCurrentUser();
let unibaseId = identity.unibaseId;
if (unibaseId != FileUsers[v].unibaseId) {
connecteduser.push(FileUsers[v].firstName);
}
}
this.connecteduserfirstName = connecteduser;
console.log(this.connecteduserfirstName);
this.showActiveUsers(FileUsers);
return this.connecteduserfirstName;
}
showActiveUsers(FileUsers) {
var onlineusername = document.getElementsByClassName("biz-doc-onlineusersintials")[0];
let identity = Unibase.Platform.Membership.Infos.Identity.getCurrentUser();
let unibaseId = identity.unibaseId;
var connectedUsersFirstChar = [];
for (var user in this.connecteduserfirstName) {
connectedUsersFirstChar.push(this.connecteduserfirstName[user].trim().charAt(0));
}
var element = document.getElementById('biz-doc-connected_users_container');
if (typeof (element) != 'undefined' && element != null) {
element.remove();
}
let html = "";
let html1 = `<div id="biz-doc-connected_users_container"></div>`;
$(".biz-doc-onlineusersintials").append(html1);
let usersHtml = '', randomColor;
let colorPalette = ['#6640b2', '#3a55b1', '#0092ee', '#00acf0', '#1ebccd', '#009b84', '#22af47', '#88c241', '#d0d962', '#fde335', '#ffbf36', '#ff9528', '#ff6028', '#7a5449', '#c1993f', '#9e9e9e', '#5e7d8a', '#324148', '#f5f5f6', '#f95851', '#ef3975', '#b642b5', '#7a59bc', '#536bbb', '#21a0f0', '#21b7f2'];
for (let i = 0; i < this.connecteduserfirstName.length; i++) {
randomColor = colorPalette[Math.floor(Math.random() * colorPalette.length)];
html = `<div id="biz-doc-connecteduser-` + unibaseId + `" class="d-flex flex-row border rounded-circle w-35p h-35p biz-doc-users-` + i + `" style="margin-right:-8px; background-color:` + randomColor + `">
<div id="biz-doc-connecteduser_` + unibaseId + `" class="biz-doc-connectedusersfirstletter m-auto" data-toggle="popover" data-placement="top" title = "` + this.connecteduserfirstName[i] + `">` + connectedUsersFirstChar[i] + `</div></div>`;
if (i <= 5) {
$("#biz-doc-connected_users_container").append(html);
}
usersHtml += '<a class="dropdown-item d-flex flex-row align-items-center p-1 my-1" href="javascript:void(0)"><div class="biz-doc-connectedusersfirstletter border mr-2 px-2 rounded-circle text-white" style="background-color:#' + randomColor + '" title = "' + this.connecteduserfirstName[i] + '">' + connectedUsersFirstChar[i] + '</div><span class="font-13 font-weight-500">' + FileUsers[i].firstName + '</span></a>';
if (i > 5) {
$("#biz-doc-connected_users_container").children().last().remove();
$("#biz-doc-connected_users_container").append('<div class="users-dropdown"><a href="javascript:void(0);" class="d-flex flex-row border rounded-circle w-35p h-35p text-dark biz-doc-users-' + i + '" role="button" id="biz-doc-connecteduser-' + unibaseId + '" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style=" background-color:lightgray;margin-right:-8px"><span class="m-auto font-14 font-weight-500"><span class="font-12 text-muted"><i class="la la-plus"></i></span>' + [i - 4] + '</span></a><div class="dropdown-menu z-index-10 position-absolute bg-white h-275p scroll-bar" aria-labelledby="biz-doc-connecteduser-' + unibaseId + '"></div>');
$('.users-dropdown .dropdown-menu').append(usersHtml);
}
}
}
renderPopup() {
Unibase.Apps.Collaboration.Components.Documents.Instance().loadForm(0, this.FileId, 0, null, this.documentGroup);
}
renderMenuBar() {
let containers = document.body.getElementsByClassName('_bizgaze_popup_container');
this.container = containers[containers.length - 1];
this.container.insertBefore(this.util.createElement("div", 'class', 'biz-doc-ribbon'), document.body.getElementsByClassName('_bizgaze_popup_container')[0].firstElementChild);
this.util.appendChildren('biz-doc-ribbon', 0, this.util.createElement("div", 'class', 'biz-doc-docxlogo'), this.util.createElement("div", 'class', 'biz-doc-tooolbar'), this.util.createElement("div", 'class', 'biz-doc-userdetails'));
this.util.appendChildren('biz-doc-docxlogo', 0, this.util.createElement("img", 'class', 'biz-doc-logo'));
this.util.appendChildren('biz-doc-tooolbar', 0, this.util.createElement("div", 'class', 'biz-doc-fileinfo'), this.util.createElement("div", 'class', 'biz-doc-fileshare-wrapper'), this.util.createElement("div", 'class', 'biz-doc-onlineusers'), this.util.createElement("div", 'class', 'biz-doc-toolbarmenu'));
this.util.appendChildren('biz-doc-fileinfo', 0, this.util.createElement("input", 'class', 'biz-doc-filename'), this.util.createElement('div', 'class', 'biz-doc-starred'), this.util.createElement('div', 'class', 'biz-ss-autosave'));
this.util.appendChildren('biz-doc-starred', 0, this.util.createElement("span", 'id', 'biz-doc-star'), this.util.createElement("i", 'class', 'fa fa-star-o text-light font-7 biz_doc_star_icon_' + this.FileId));
this.util.appendChildren('biz-ss-autosave', 0, this.util.createElement("img", 'class', 'biz-ss-saveicon biz-ss-cloudsave'), this.util.createElement("img", 'class', 'biz-ss-saveicon biz-ss-cloudoff'), this.util.createElement("div", 'class', 'biz-ss-cloudloading e-icons'), this.util.createElement('div', 'class', 'biz-ss-saving'));
this.util.appendChildren('biz-doc-fileshare-wrapper', 0, this.util.createElement("div", 'class', 'biz-doc-fileshare'));
this.util.appendChildren('biz-doc-onlineusers', 0, this.util.createElement("div", 'class', 'biz-doc-onlineusersintials d-flex flex-row text-white mx-35 pull-right'));
this.util.appendChildren('biz-doc-fileshare', 0, this.util.createElement("button", 'class', 'biz-doc-fileshare-btn'));
this.util.appendChildren('biz-doc-userdetails', 0, this.util.createElement("div", 'class', 'biz-doc-userinitial'));
this.util.appendChildren('biz-doc-toolbarmenu', 0, this.util.createElement("ul", 'id', 'menu'), this.util.createElement("input", 'class', 'biz-doc-lastedited'));
document.getElementsByClassName("biz-doc-ribbon")[0].after(this.util.createElement("div", 'class', 'biz-doc-bottomtoolbar e-toolbar'));
this.util.appendChildren('biz-doc-bottomtoolbar', 0, this.util.createElement("div", 'class', 'biz-doc-toolbar-wrapper'));
this.util.appendChildren('biz-doc-toolbar-wrapper', 0, this.util.createElement("div", 'class', 'biz-doc-bottomtoolbar-undoredo e-toolbar-items'), this.util.createElement("div", 'class', 'biz-doc-bottomtoolbar-text e-toolbar-items'), this.util.createElement("div", 'class', 'biz-doc-bottomtoolbar-paragraph e-toolbar-items'), this.util.createElement("div", 'class', 'biz-doc-bottomtoolbar-indent e-toolbar-items'));
this.userInitial = document.getElementsByClassName("biz-doc-userinitial")[0];
let identity = Unibase.Platform.Membership.Infos.Identity.getCurrentUser();
if (!identity.photoUrl) {
this.userInitial.textContent += identity.name.trim().slice(0, 1);
this.userInitial.classList.add('biz-doc-initial-text');
}
else {
this.userInitial.classList.add('biz-doc-initial-img');
this.userInitial.style.backgroundImage = "url(" + identity.photoUrl + ")";
}
document.getElementsByClassName("biz-doc-logo")[0].setAttribute('src', 'imgs/BizgazeDocsIcon.svg');
document.getElementsByClassName("biz-ss-cloudsave")[0].setAttribute('src', 'imgs/cloud-computing.svg');
document.getElementsByClassName("biz-ss-cloudoff")[0].setAttribute('src', 'imgs/cloud-off.svg');
document.getElementsByClassName("biz-ss-cloudoff")[0].style.display = "none";
let attributes = {
'value': this.FileName,
'type': 'text'
};
document.getElementsByClassName("biz-doc-fileshare-btn")[0].style.backgroundColor = "#049503";
var shareBtn = new ej.buttons.Button({ cssClass: `e-primary`, content: `Share`, iconCss: 'biz-doc-fileshare-icon icon-doc-lockopen' });
shareBtn.appendTo(".biz-doc-fileshare-btn");
document.getElementsByClassName("biz-doc-userinitial")[0].setAttribute("title", identity.name.trim());
let color = this.util.colorHash(identity.name.trim());
document.getElementsByClassName("biz-doc-userinitial")[0].style.backgroundColor = color.hex;
if (!this.newUpload) {
debugger;
if (this.lastEditedTime != 0) {
if (this.unibaseusername === this.username) {
let htmlelementlastedited = document.getElementsByClassName('biz-doc-lastedited')[0];
this.util.addAttributes(htmlelementlastedited, {
'value': 'last edit was made ' + this.lastEditedTime + ' ' + this.timePeriod + ' ago',
'type': 'span'
});
}
else {
let htmlelementlastedited = document.getElementsByClassName('biz-doc-lastedited')[0];
this.util.addAttributes(htmlelementlastedited, {
'value': 'last edit was made ' + this.lastEditedTime + ' ' + this.timePeriod + ' ago by ' + this.username,
'type': 'span'
});
}
}
else {
if (this.unibaseusername === this.username) {
let htmlelementlastedited = document.getElementsByClassName('biz-doc-lastedited')[0];
this.util.addAttributes(htmlelementlastedited, {
'value': 'last edit was made seconds ago ',
'type': 'span'
});
}
else {
let htmlelementlastedited = document.getElementsByClassName('biz-doc-lastedited')[0];
this.util.addAttributes(htmlelementlastedited, {
'value': 'last edit was made seconds ago by ' + this.username,
'type': 'span'
});
}
}
}
let htmlelement = document.getElementsByClassName('biz-doc-filename')[0];
this.util.addAttributes(htmlelement, attributes);
let attributesforautosave = {
'type': 'text'
};
let htmlelementforautosave = document.getElementsByClassName('biz-ss-saving')[0];
this.util.addAttributes(htmlelementforautosave, attributesforautosave);
document.getElementsByClassName('biz-ss-saving')[0].style.display = 'none';
document.getElementsByClassName('biz-doc-lastedited')[0].setAttribute('disabled', "");
document.getElementsByClassName('biz-ss-saving')[0].innerText = 'Saving...';
this.ribbonElem = document.body.getElementsByClassName('biz-doc-ribbon')[0];
}
editDetails() {
if (this.FileId != 0) {
Unibase.Apps.Collaboration.DocumentManager.Instance().lastEdit(this.FileId).then((response) => {
this.identity = Unibase.Platform.Membership.Infos.Identity.getCurrentUser();
this.unibaseusername = this.identity.name.trim();
this.lastEditedTime = response.result.Lastedittime;
this.username = response.result.LastUpdatedByName;
this.timePeriod = response.result.TimePeriod;
if (this.unibaseusername === this.username && this.lastEditedTime === 0) {
let element = (document.getElementsByClassName('biz-doc-lastedited')[0]);
element.value = "last edit was made seconds ago";
}
else if (this.unibaseusername === this.username && this.lastEditedTime !== 0) {
let element = (document.getElementsByClassName('biz-doc-lastedited')[0]);
element.value = "last edit was made " + this.lastEditedTime + " " + this.timePeriod + " ago";
}
else {
let element = (document.getElementsByClassName('biz-doc-lastedited')[0]);
element.value = "last edit was made seconds ago by " + this.username;
}
});
}
clearInterval(this.intr);
clearInterval(this.intrhour);
this.initSetInterval();
}
convertDocsToPdfDownload(FileId) {
Unibase.Apps.Collaboration.DocumentManager.Instance().ConvertDocstoPdfDownload(FileId).then((response) => {
Unibase.Themes.Compact.Components.Notification.Instance().Downloadfile(response.result);
});
}
static Instance() {
if (this.instance === undefined) {
this.instance = new Base();
}
return this.instance;
}
}
DocEditor.Base = Base;
})(DocEditor = Components.DocEditor || (Components.DocEditor = {}));
})(Components = Collaboration.Components || (Collaboration.Components = {}));
})(Collaboration = Apps.Collaboration || (Apps.Collaboration = {}));
})(Apps = Unibase.Apps || (Unibase.Apps = {}));
})(Unibase || (Unibase = {}));
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,832 @@
var Unibase;
(function (Unibase) {
let Apps;
(function (Apps) {
let Collaboration;
(function (Collaboration) {
let Components;
(function (Components) {
let DocEditor;
(function (DocEditor) {
class Ribbon {
init(docobj, result) {
this.FileName = result.FileName;
this.FileId = result.FileId;
this.documentGroup = result.DocumentGroup;
this.wordDocumentObj = docobj;
this.docBase = Unibase.Apps.Collaboration.Components.DocEditor.Base.Instance();
this.fileDownload = Unibase.Apps.Collaboration.Components.Common.Download.Instance();
this.util = Unibase.Apps.Collaboration.Components.Common.Util.Instance();
this.render();
}
render() {
this.wordDocumentMenubar(this.FileId, this.documentGroup, this.FileName);
this.appendToolbarElements();
this.createResponsiveToolbar();
this.updateProp();
}
updateProp() {
this.fontSize = document.getElementById("DocumentViewer_editor_font_properties_fontSize").ej2_instances[0];
}
setFontSize(size) {
this.wordDocumentObj.textProperties.text.isRetrieving = false;
this.fontSize.value = size;
}
wordDocumentMenubar(FileId, documentGroup, FileName) {
var instance = this;
var menuItems = [
{
text: 'File',
items: [
{ text: 'New', iconCss: 'e-icons add-new' },
{ text: 'Open', iconCss: 'e-icons e-open' },
{ text: 'Make a copy', iconCss: 'e-icons biz_make_a_copy' },
{
text: 'Download', iconCss: 'e-icons e-save',
items: [
{ text: 'Microsoft Word Document (.docx)', iconCss: 'e-icons' },
{ text: 'Portable Document Format (.pdf)', iconCss: 'e-icons Pdf_Export' },
{ text: 'Text Document (.txt)', iconCss: 'e-icons' }
]
},
{ text: 'Close', iconCss: 'e-icons cross-close' },
]
},
{
text: 'Edit',
items: [
{ text: 'Undo', iconCss: 'e-icons biz-doc-undo-icon' },
{ text: 'Redo', iconCss: 'e-icons biz-doc-redo-icon' },
{ separator: true },
{ text: 'Cut', iconCss: 'e-icons biz-doc-cut-icon' },
{ text: 'Copy', iconCss: 'e-icons biz-doc-copy-icon' },
{ text: 'Paste', iconCss: 'e-icons biz-doc-paste-icon' },
{
text: 'Special paste', iconCss: 'e-icons biz-doc-paste-icon', items: [
{ text: "Keep source formatting", iconCss: 'e-icons MT_PasteStyle' },
{ text: "Match destination formatting", iconCss: 'e-icons M_MergeFormatting' },
{ text: "Text only", iconCss: 'e-icons MT_PasteTextonly' },
]
},
{ separator: true },
{ text: 'Delete', iconCss: 'e-icons MT_Delete' },
{ text: 'Select all', iconCss: 'e-icons MT_SelectAll' },
{ text: 'Search', iconCss: 'e-icons MT_Search' },
]
},
{
text: 'View',
items: [
{ text: 'Page Setup', iconCss: 'e-icons M_PageSetup' },
{ text: 'Page Number', iconCss: 'e-icons M_PageNumber' },
{
text: 'Mode', iconCss: 'e-icons MT_Preview',
items: [
{ text: 'Editing', iconCss: 'e-icons biz_edit_icon' },
{ text: 'View only', iconCss: 'e-icons MT_Preview' },
]
},
{
text: 'Break', iconCss: 'e-icons M_Break',
items: [
{ text: 'Page Break', iconCss: 'e-icons M_PageBreak' },
{ text: 'Section Break', iconCss: 'e-icons M_SectionBreak' },
]
},
{ separator: true },
{ text: 'Full screen', iconCss: 'e-icons biz-enterfullscreen' },
]
},
{
text: 'Insert',
items: [
{ text: 'Header', iconCss: 'e-icons M_Header' },
{ text: 'Footer', iconCss: 'e-icons M_Footer' },
{ separator: true },
{ text: 'Image', iconCss: 'e-icons B_Image' },
{ text: 'Table', iconCss: 'e-icons table-02' },
{ text: 'Link', iconCss: 'e-icons e-Hyperlink' },
{ text: 'Bookmark', iconCss: 'e-icons M_Bookmark' },
{ text: 'Table Of Contents', iconCss: 'e-icons M_TableOfContent' },
{ separator: true },
{ text: 'Footnote', iconCss: 'e-icons M_Footnote' },
{ text: 'Endnote', iconCss: 'e-icons M_Endnote' },
]
},
{
text: 'Format',
items: [
{
text: 'Text', iconCss: 'e-icons ',
items: [
{ text: 'Bold', iconCss: 'e-icons ' },
{ text: 'Italic', iconCss: 'e-icons ' },
{ text: 'Underline', iconCss: 'e-icons ' },
{ text: 'Strikethrough', iconCss: 'e-icons ' },
{ text: 'Superscript', iconCss: 'e-icons ' },
{ text: 'Subscript', iconCss: 'e-icons ' },
]
},
{
text: 'Font size', iconCss: 'e-icons ',
items: [
{ text: '8', iconCss: 'e-icons ' },
{ text: '9', iconCss: 'e-icons ' },
{ text: '10', iconCss: 'e-icons ' },
{ text: '11', iconCss: 'e-icons ' },
{ text: '12', iconCss: 'e-icons ' },
{ text: '14', iconCss: 'e-icons ' },
{ text: '16', iconCss: 'e-icons ' },
{ text: '18', iconCss: 'e-icons ' },
{ text: '20', iconCss: 'e-icons ' },
{ text: '22', iconCss: 'e-icons ' },
{ text: '24', iconCss: 'e-icons ' },
{ text: '26', iconCss: 'e-icons ' },
{ text: '28', iconCss: 'e-icons ' },
{ text: '36', iconCss: 'e-icons ' },
{ text: '48', iconCss: 'e-icons ' },
{ text: '72', iconCss: 'e-icons ' },
{ text: '96', iconCss: 'e-icons ' },
]
},
{
text: 'Paragraph styles', iconCss: 'e-icons ',
items: [
{ text: 'Normal', iconCss: 'e-icons ' },
{ text: 'Heading 1', iconCss: 'e-icons ' },
{ text: 'Heading 2', iconCss: 'e-icons ' },
{ text: 'Heading 3', iconCss: 'e-icons ' },
{ text: 'Heading 4', iconCss: 'e-icons ' },
{ text: 'Heading 5', iconCss: 'e-icons ' },
{ text: 'Heading 6', iconCss: 'e-icons ' },
]
},
{
text: 'Align & indent', iconCss: 'e-icons ',
items: [
{ text: 'Left', iconCss: 'e-icons ' },
{ text: 'Center', iconCss: 'e-icons ' },
{ text: 'Right', iconCss: 'e-icons ' },
{ text: 'Justified', iconCss: 'e-icons ' },
{ separator: true },
{ text: 'Increase indent', iconCss: 'e-icons ' },
{ text: 'Decrease indent', iconCss: 'e-icons ' },
]
},
{
text: 'Line spacing', iconCss: 'e-icons ',
items: [
{ text: 'Single' },
{ text: '1.15' },
{ text: '1.5' },
{ text: 'Double' },
]
},
{
text: 'Bulletes & numbering', iconCss: 'e-icons ', items: [
{
text: 'Bullets',
items: [
{ text: 'None' },
{ text: 'Bullet dot' },
{ text: 'Bullet circle' },
{ text: 'Bullet square' },
{ text: 'Bullet flower' },
{ text: 'Bullet arrow' },
{ text: 'Bullet tick' },
]
},
{
text: 'Numbering', items: [
{ text: 'No numbering' },
{ text: 'Numbers' },
{ text: 'Lower case' },
{ text: 'Upper case' },
{ text: 'roman' },
{ text: 'roman two' },
]
},
]
},
{ separator: true },
{ text: 'Clear formatting', iconCss: 'e-icons ' },
]
},
{
text: 'Tools',
items: [
{ text: 'Comments', iconCss: 'e-icons AddComment' },
{ text: 'Track Changes', iconCss: 'e-icons M_TrackChanges' },
{ text: 'Local ClipBoard', iconCss: 'e-icons MT_Paste' },
{ text: 'Restrict Editing', iconCss: 'e-icons M_Lock', items: [{ text: "Read Only" }, { text: "Protections" }] },
]
},
{
text: 'Add-ons',
items: [
{
text: 'Form Fields', iconCss: 'e-icons M_FormField', items: [{ text: "Text Form", iconCss: 'e-icons M_Textform' },
{ text: "Check Box", iconCss: 'e-icons M_CheckBox' }, { text: "Drop-Down", iconCss: 'e-icons M_Dropdown' }]
},
{ text: 'Update Fields', iconCss: 'e-icons M_UpdateField' },
]
}
];
if (!this.wordDocumentMenubarObj) {
let menubaritems = ["File", "Edit", "View", "Insert", "Format", "Tools", "Add-ons"];
this.wordDocumentMenubarObj = new ej.navigations.Menu({
cssClass: 'biz-doc-menu',
showItemOnClick: true,
beforeItemRender: (e) => {
let popupitems = ["Text", "Font size", "Paragraph styles", "Align & indent", "Line spacing",
"Bullets & numbering", "Bold", "Italic", "Underline", "Strikethrough", "Superscript",
"Subscript", "Normal", "Heading 1", "Heading 2", "Heading 3", "Heading 4", "Heading 5",
"Heading 6", "8", "9", "10", "11", "12", "16", "14", "18", "20", "22", "24", "26", "48", "28", "36", "72", "96"];
if (popupitems.includes(e.item.text)) {
if (this.docBase.formatInfo && this.docBase.formatInfo.element && this.docBase.formatInfo.element.characterFormat) {
(this.docBase.formatInfo.element.characterFormat.bold) && (e.item.text == "Bold") && (this.addOrRemoveSelectIcon(e));
(this.docBase.formatInfo.element.characterFormat.italic) && (e.item.text == "Italic") && (this.addOrRemoveSelectIcon(e));
(this.docBase.formatInfo.element.characterFormat.baselineAlignment == e.item.text) && (this.addOrRemoveSelectIcon(e));
(e.item.text == "Underline") && (this.docBase.formatInfo.element.characterFormat.underline == "Single") && (this.addOrRemoveSelectIcon(e));
(e.item.text == "Strikethrough") && (this.docBase.formatInfo.element.characterFormat.strikethrough == "SingleStrike") && (this.addOrRemoveSelectIcon(e));
(e.item.text == "Text") && ((this.docBase.formatInfo.element.characterFormat.bold) || (this.docBase.formatInfo.element.characterFormat.italic) ||
(this.docBase.formatInfo.element.characterFormat.baselineAlignment == e.item.text) ||
(this.docBase.formatInfo.element.characterFormat.underline == "Single") ||
(this.docBase.formatInfo.element.characterFormat.strikethrough == "SingleStrike")) && (this.addOrRemoveSelectIcon(e));
(this.docBase.formatInfo.element.characterFormat.fontSize == e.item.text) && (this.addOrRemoveSelectIcon(e));
if (this.docBase.formatInfo.element.characterFormat.baseCharStyle) {
((this.docBase.formatInfo.element.characterFormat.baseCharStyle.name).slice(0, -5) == e.item.text) && (this.addOrRemoveSelectIcon(e));
}
else {
(e.item.text == "Normal") && (this.addOrRemoveSelectIcon(e));
}
(e.item.text == "Paragraph styles") && (this.addOrRemoveSelectIcon(e));
var fontsizes = ["8", "9", "10", "11", "12", "16", "14", "18", "20", "22", "24", "26", "48", "28", "36", "72", "96"];
(e.item.text == "Font size") && (fontsizes.includes(this.docBase.formatInfo.element.characterFormat.fontSize.toString())) && (this.addOrRemoveSelectIcon(e));
}
}
},
beforeClose: e => {
if (menubaritems.indexOf(e.parentItem.text) > -1) {
this.wordDocumentMenubarObj.showItemOnClick = true;
}
},
beforeOpen: (e) => {
if (menubaritems.indexOf(e.parentItem.text) > -1) {
this.wordDocumentMenubarObj.showItemOnClick = false;
}
let editItems = ["Undo", "Redo", "Paste", "Special paste"];
if (e.items.find(x => x.text == "Undo") != null) {
let undoOverley = document.getElementById("DocumentViewer_toolbar_undo").parentElement.classList.contains("e-overlay");
if (undoOverley) {
this.wordDocumentMenubarObj.enableItems(["Undo"], false);
}
}
if (e.items.find(x => x.text == "Redo") != null) {
let redoOverley = document.getElementById("DocumentViewer_toolbar_redo").parentElement.classList.contains("e-overlay");
if (redoOverley) {
this.wordDocumentMenubarObj.enableItems(["Redo"], false);
}
}
},
select: (e) => {
var lineHeight = document.getElementById("DocumentViewer_editor_font_properties_lineHeight").ej2_instances[0];
var bullets = document.getElementById("DocumentViewer_editor_font_properties_bullet_dropdownbtn").ej2_instances[0];
console.log(e);
switch (e.item.text) {
case "New":
this.processNewWord();
break;
case "Microsoft Word Document (.docx)":
this.fileDownload.downloadDocumentFile(FileId, documentGroup, FileName, 'Docx', instance.docBase.documentContainer);
break;
case "Portable Document Format (.pdf)":
this.docBase.convertDocsToPdfDownload(FileId);
break;
case "Text Document (.txt)":
this.fileDownload.downloadDocumentFile(FileId, documentGroup, FileName, 'Txt', instance.docBase.documentContainer);
break;
case "Open":
this.renderOpenNewDialogue();
break;
case "Close":
this.closePopup();
break;
case "Undo":
document.getElementById("DocumentViewer_toolbar_undo").click();
break;
case "Redo":
document.getElementById("DocumentViewer_toolbar_redo").click();
break;
case "Cut":
this.docBase.wordDocumentObj.documentEditor.editor.cut();
break;
case "Copy":
this.docBase.wordDocumentObj.documentEditor.selection.copy();
break;
case "Paste":
this.docBase.wordDocumentObj.documentEditor.editor.paste();
break;
case "Match destination formatting":
this.closePopup();
break;
case "Text only":
this.closePopup();
break;
case "Keep source formatting":
this.closePopup();
break;
case "Delete":
this.docBase.wordDocumentObj.documentEditor.editor.delete();
break;
case "Select all":
this.docBase.wordDocumentObj.documentEditor.selection.selectAll();
break;
case "Search":
this.docBase.wordDocumentObj.documentEditor.showOptionsPane();
break;
case "View only":
this.docBase.wordDocumentObj.documentEditor.isReadOnly = true;
break;
case "Editing":
this.docBase.wordDocumentObj.documentEditor.isReadOnly = false;
break;
case "Header":
this.wordDocumentObj.toolbarModule.clickHandler({ item: { id: this.wordDocumentObj.element.id + "_toolbar_header" }, name: "clicked", originalEvent: { target: this.wordDocumentObj.element } });
break;
case "Footer":
this.wordDocumentObj.toolbarModule.clickHandler({ item: { id: this.wordDocumentObj.element.id + "_toolbar_footer" }, name: "clicked", originalEvent: { target: this.wordDocumentObj.element } });
break;
case "Page Setup":
this.wordDocumentObj.toolbarModule.clickHandler({ item: { id: this.wordDocumentObj.element.id + "_toolbar_page_setup" }, name: "clicked", originalEvent: { target: this.wordDocumentObj.element } });
break;
case "Page Number":
this.wordDocumentObj.toolbarModule.clickHandler({ item: { id: this.wordDocumentObj.element.id + "_toolbar_page_number" }, name: "clicked", originalEvent: { target: this.wordDocumentObj.element } });
break;
case "Page Break":
this.wordDocumentObj.toolbarModule.container.documentEditor.editorModule.insertPageBreak();
break;
case "Section Break":
this.wordDocumentObj.toolbarModule.container.documentEditor.editorModule.insertSectionBreak();
break;
case "Footnote":
this.wordDocumentObj.toolbarModule.clickHandler({ item: { id: this.wordDocumentObj.element.id + "_toolbar_footnote" }, name: "clicked", originalEvent: { target: this.wordDocumentObj.element } });
break;
case "Endnote":
this.wordDocumentObj.toolbarModule.clickHandler({ item: { id: this.wordDocumentObj.element.id + "_toolbar_endnote" }, name: "clicked", originalEvent: { target: this.wordDocumentObj.element } });
break;
case "Full screen":
Unibase.Apps.Collaboration.Components.Fullscreen.Instance().refreshWordDocumentHeight(this.wordDocumentObj);
break;
case "Image":
this.wordDocumentObj.toolbarModule.imagePicker.value = "";
this.wordDocumentObj.toolbarModule.imagePicker.click();
setTimeout(() => { this.wordDocumentObj.toolbarModule.documentEditor.focusIn(); }, 30);
break;
case "Table":
this.wordDocumentObj.toolbarModule.clickHandler({ item: { id: this.wordDocumentObj.element.id + "_toolbar_table" }, name: "clicked", originalEvent: { target: this.wordDocumentObj.element } });
break;
case "Link":
this.wordDocumentObj.toolbarModule.clickHandler({ item: { id: this.wordDocumentObj.element.id + "_toolbar_link" }, name: "clicked", originalEvent: { target: this.wordDocumentObj.element } });
break;
case "Bookmark":
this.wordDocumentObj.toolbarModule.clickHandler({ item: { id: this.wordDocumentObj.element.id + "_toolbar_bookmark" }, name: "clicked", originalEvent: { target: this.wordDocumentObj.element } });
break;
case "Table Of Contents":
this.wordDocumentObj.documentEditor.showDialog('TableOfContents');
break;
case "Bold":
document.getElementById("DocumentViewer_editor_font_properties_bold").click();
break;
case "Italic":
document.getElementById("DocumentViewer_editor_font_properties_italic").click();
break;
case "Underline":
document.getElementById("DocumentViewer_editor_font_properties_underline").click();
break;
case "Strikethrough":
document.getElementById("DocumentViewer_editor_font_properties_strikethrough").click();
break;
case "Superscript":
document.getElementById("DocumentViewer_editor_font_properties_superscript").click();
break;
case "Subscript":
document.getElementById("DocumentViewer_editor_font_properties_subscript").click();
break;
case "Clear formatting":
document.getElementById("DocumentViewer_editor_font_properties_clearFormat").click();
break;
case "Left":
document.getElementById("DocumentViewer_editor_font_properties_leftIndent").click();
break;
case "Center":
document.getElementById("DocumentViewer_editor_font_properties_centerIndent").click();
break;
case "Right":
document.getElementById("DocumentViewer_editor_font_properties_rightIndent").click();
break;
case "Justified":
document.getElementById("DocumentViewer_editor_font_properties_justify").click();
break;
case "Increase indent":
document.getElementById("DocumentViewer_editor_font_properties_increaseIndent").click();
break;
case "Decrease indent":
document.getElementById("DocumentViewer_editor_font_properties_decreaseIndent").click();
break;
case "Single":
lineHeight.trigger('select', { item: lineHeight.items[0] });
break;
case "1.15":
lineHeight.trigger('select', { item: lineHeight.items[1] });
break;
case "1.5":
lineHeight.trigger('select', { item: lineHeight.items[2] });
break;
case "Double":
lineHeight.trigger('select', { item: lineHeight.items[3] });
break;
case "None":
this.wordDocumentObj.textProperties.paragraph.numberedNoneClick();
break;
case "Bullet dot":
this.wordDocumentObj.textProperties.paragraph.bulletDotClick();
break;
case "Bullet circle":
this.wordDocumentObj.textProperties.paragraph.bulletCircleClick();
break;
case "Bullet square":
this.wordDocumentObj.textProperties.paragraph.bulletSquareClick();
break;
case "Bullet flower":
this.wordDocumentObj.textProperties.paragraph.bulletFlowerClick();
break;
case "Bullet arrow":
this.wordDocumentObj.textProperties.paragraph.bulletArrowClick();
break;
case "Bullet tick":
this.wordDocumentObj.textProperties.paragraph.bulletTickClick();
break;
case "Numbers":
this.wordDocumentObj.textProperties.paragraph.numberedNumberDotClick();
break;
case "Lower case":
this.wordDocumentObj.textProperties.paragraph.numberedLowLetterClick();
break;
case "Upper case":
this.wordDocumentObj.textProperties.paragraph.numberedUpLetterClick();
break;
case "roman":
this.wordDocumentObj.textProperties.paragraph.numberedLowRomanClick();
break;
case "roman two":
this.wordDocumentObj.textProperties.paragraph.numberedUpRomanClick();
break;
case "No numbering":
this.wordDocumentObj.textProperties.paragraph.numberedNoneClick();
break;
case "Normal":
this.wordDocumentObj.documentEditor.editorModule.applyStyle('Normal', true);
break;
case "Heading 1":
this.wordDocumentObj.documentEditor.editorModule.applyStyle('Heading 1', true);
break;
case "Heading 2":
this.wordDocumentObj.documentEditor.editorModule.applyStyle('Heading 2', true);
break;
case "Heading 3":
this.wordDocumentObj.documentEditor.editorModule.applyStyle('Heading 3', true);
break;
case "Heading 4":
this.wordDocumentObj.documentEditor.editorModule.applyStyle('Heading 4', true);
break;
case "Heading 5":
this.wordDocumentObj.documentEditor.editorModule.applyStyle('Heading 5', true);
break;
case "Heading 6":
this.wordDocumentObj.documentEditor.editorModule.applyStyle('Heading 6', true);
break;
case "8":
this.setFontSize('8');
break;
case "9":
this.setFontSize('9');
break;
case "10":
this.setFontSize('10');
break;
case "11":
this.setFontSize('11');
break;
case "12":
this.setFontSize('12');
break;
case "14":
this.setFontSize('14');
break;
case "16":
this.setFontSize('16');
break;
case "18":
this.setFontSize('18');
break;
case "20":
this.setFontSize('20');
break;
case "22":
this.setFontSize('22');
break;
case "24":
this.setFontSize('24');
break;
case "36":
this.setFontSize('36');
break;
case "Find":
this.wordDocumentObj.toolbarModule.clickHandler({ item: { id: this.wordDocumentObj.element.id + "_toolbar_find" }, name: "clicked", originalEvent: { target: this.wordDocumentObj.element } });
break;
case "Comments":
this.wordDocumentObj.toolbarModule.clickHandler({ item: { id: this.wordDocumentObj.element.id + "_toolbar_comment" }, name: "clicked", originalEvent: { target: this.wordDocumentObj.element } });
break;
case "Track Changes":
this.wordDocumentObj.toolbarModule.clickHandler({ item: { id: this.wordDocumentObj.element.id + "_toolbar_track" }, name: "clicked", originalEvent: { target: this.wordDocumentObj.element } });
break;
case "Local ClipBoard":
this.wordDocumentObj.toolbarModule.clickHandler({ item: { id: this.wordDocumentObj.element.id + "_toolbar_use_local_clipboard" }, name: "clicked", originalEvent: { target: this.wordDocumentObj.element } });
break;
case "Read Only":
var ele = $('li[aria-label="Read Only"]').children('span').toggleClass('Selection');
const value = 12;
this.wordDocumentObj.toolbarModule.toggleEditing();
break;
case "Protections":
this.wordDocumentObj.toolbarModule.documentEditor.documentHelper.restrictEditingPane.showHideRestrictPane(true);
break;
case "Text Form":
this.wordDocumentObj.toolbarModule.documentEditor.editor.insertFormField('Text');
break;
case "Check Box":
this.wordDocumentObj.toolbarModule.documentEditor.editor.insertFormField('CheckBox');
break;
case "Drop-Down":
this.wordDocumentObj.toolbarModule.documentEditor.editor.insertFormField('DropDown');
break;
case "Update Fields":
this.wordDocumentObj.toolbarModule.clickHandler({ item: { id: this.wordDocumentObj.element.id + "_toolbar_update_fields" }, name: "clicked", originalEvent: { target: this.wordDocumentObj.element } });
break;
}
},
items: menuItems,
}, '#menu');
}
}
addOrRemoveSelectIcon(ele) {
if (!ele.element.firstElementChild.classList.contains("biz-ss-selecticon")) {
ele.element.firstElementChild.classList.add("biz-ss-selecticon");
}
}
processNewWord() {
Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/collaboration/components/common/util.js", () => {
let urlStr = Unibase.Apps.Collaboration.Components.Common.Util.Instance().makeid(40);
window.open(window.origin + "#/documents/" + urlStr + "/newword/0");
});
}
renderOpenNewDialogue() {
this.OpenSelectButton = new ej.buttons.Button({ cssClass: `e-flat` });
this.OpenCancelButton = new ej.buttons.Button({ cssClass: `e-flat` });
var elem = document.getElementById("opendocfile");
if (elem == null) {
this.docOpenDialougObj = new ej.popups.Dialog({
isModal: true,
header: 'Open File',
content: `<div id='tabobjforopendoc'></div>`,
target: document.getElementById("container"),
width: '470px',
height: '330px',
animationSettings: { effect: 'Zoom' },
cssClass: "biz-doc-importopen-dialog"
});
this.docOpenDialougObj.appendTo('#dialog');
var tabObjForOpen = new ej.navigations.Tab({
items: [{
header: { 'text': 'Upload' },
content: `<div id="opendocfile-wrapper">
<h2 style="color: #ccc">Drag a file...</h2>
<label id='opendocfilelable'>
select file from device
<br>
<input type="file" name="" id="opendocfile" accept=".doc, .docx, .txt , .rtf" placeholder="select a file from your device" >
</label>
<div id="filename"></div>
</div>
</div>
<button id='opendocfile-select-btn' class='e-disabled'>select</button>
<button id='opendocfile-cancel-btn'>cancel</button>`
}]
});
tabObjForOpen.appendTo('#tabobjforopendoc');
}
else {
this.docOpenDialougObj.show();
}
this.importOpenDialogcreated();
}
importOpenDialogcreated() {
document.getElementById('opendocfile-select-btn').setAttribute("disabled", 'true');
document.getElementById('opendocfile-select-btn').addEventListener('click', () => {
this.openWordDocument();
this.docOpenDialougObj.hide();
});
document.getElementById('opendocfile-cancel-btn').addEventListener('click', () => {
this.docOpenDialougObj.hide();
document.getElementById('opendocfile-select-btn').classList.add('e-disabled');
document.getElementById('filename').innerHTML = "";
this.importedFile.value = null;
if (this.docOpenDialougObj) {
this.docOpenDialougObj.destroy();
}
});
this.OpenSelectButton.appendTo('#opendocfile-select-btn');
this.OpenCancelButton.appendTo('#opendocfile-cancel-btn');
document.body.addEventListener('dragover', (e) => {
e.preventDefault();
});
document.getElementsByClassName('biz-doc-importopen-dialog')[0].addEventListener('dragover', (e) => {
e.preventDefault();
});
document.getElementsByClassName('biz-doc-importopen-dialog')[0].addEventListener("drop", (e) => {
e.preventDefault();
document.getElementById('opendocfile').files = e.dataTransfer.files;
var ele = { target: { files: e.dataTransfer.files } };
this.fileSelected(ele);
});
document.getElementById('opendocfile').addEventListener('change', (e) => {
debugger;
this.fileSelected(e);
});
}
fileSelected(e) {
document.getElementById('opendocfile-select-btn').removeAttribute('disabled');
document.getElementById('opendocfile-select-btn').classList.remove('e-disabled');
this.importedFile = document.getElementById('opendocfile');
document.getElementById('filename').innerHTML = this.importedFile.files[0].name;
Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile('platform/core/helpers/file/filehelper.js', () => {
Unibase.Platform.Helpers.FileHelper.Instance().getBase64(e).then((response) => {
if (Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.length != 0) {
var InstalledAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
var refId = Number(Unibase.Themes.Providers.Detail_Settings.Instance().InputParameters.find(x => x.Key == "hf_" + InstalledAppId + "_recordid").Value);
if (refId != 0 && refId != null && refId != undefined) {
}
}
var fileobject = {
filedata: response.FileData,
filename: response.FileName,
filetype: response.FileType,
RefId: refId,
FileId: this.FileId,
};
this.documentOpenFileData = fileobject;
});
});
}
openWordDocument() {
Unibase.Apps.Collaboration.DocumentManager.Instance().importCreateSpreadSheet(this.documentOpenFileData).then((response) => {
var result = response.result;
});
}
closePopup() {
if (!this.docBase.NewDocument) {
Unibase.Apps.Collaboration.Components.DocConnector.Instance().closeDoc();
}
window.close();
}
appendToolbarElements() {
let sideBarElementsText = [];
let sideBarElementsIndent = [];
let sideBarElementsParagraph = [];
var idsText = ['DocumentViewer_editor_font_properties_fontFamilyDiv', 'DocumentViewer_editor_font_properties_fontSizeDiv', 'DocumentViewer_editor_font_properties_leftDiv',
'DocumentViewer_editor_font_properties_rightDiv'];
let idsParagraph = ['DocumentViewer_editor_font_properties_color', 'DocumentViewer_editor_font_properties_styleDiv'];
var idsIndent = ['DocumentViewer_editor_font_properties_leftIndent', 'DocumentViewer_editor_font_properties_centerIndent', 'DocumentViewer_editor_font_properties_rightIndent', 'DocumentViewer_editor_font_properties_justify',
'DocumentViewer_editor_font_properties_decreaseIndent', 'DocumentViewer_editor_font_properties_increaseIndent', 'DocumentViewer_editor_font_properties_lineHeight',
'DocumentViewer_editor_font_properties_listDropDiv'];
idsText.forEach(element => {
sideBarElementsText.push(document.getElementById(element));
});
idsIndent.forEach(element => {
sideBarElementsIndent.push(document.getElementById(element));
});
idsParagraph.forEach(element => {
sideBarElementsParagraph.push(document.getElementById(element));
});
sideBarElementsText.forEach(element => {
this.util.appendChildren('biz-doc-bottomtoolbar-text', 0, element);
});
sideBarElementsIndent.forEach(element => {
this.util.appendChildren('biz-doc-bottomtoolbar-indent', 0, element);
});
sideBarElementsParagraph.forEach(element => {
this.util.appendChildren('biz-doc-bottomtoolbar-paragraph', 0, element);
});
this.docBase.bottomtoolbartext = document.getElementsByClassName('biz-doc-bottomtoolbar-text')[0];
this.util.appendChildren('biz-doc-bottomtoolbar-undoredo', 0, this.util.createElement("button", 'class', 'biz-doc-undo e-disabled e-btn e-lib'));
this.util.appendChildren('biz-doc-undo', 0, this.util.createElement("span", 'class', 'e-icons e-icon-left biz-doc-undo-icon e-btn-icon'));
this.util.appendChildren('biz-doc-bottomtoolbar-undoredo', 0, this.util.createElement("button", 'class', 'biz-doc-redo e-disabled e-btn e-lib'));
this.util.appendChildren('biz-doc-redo', 0, this.util.createElement("span", 'class', 'e-icons e-icon-left biz-doc-redo-icon e-btn-icon'));
document.getElementsByClassName("biz-doc-undo")[0].id = "biz_doc_undobtn";
document.getElementsByClassName("biz-doc-redo")[0].id = "biz_doc_redobtn";
this.docBase.bottomtoolbartext.insertBefore(this.util.createElement('div', 'class', 'biz-doc-toobarspace'), document.getElementsByClassName('biz-doc-bottomtoolbar-text')[0].childNodes[0]);
this.docBase.bottomtoolbartext.insertBefore(this.util.createElement('div', 'class', 'biz-doc-toobarspace'), document.getElementsByClassName('biz-doc-bottomtoolbar-text')[0].childNodes[2]);
document.getElementsByClassName('biz-doc-bottomtoolbar-indent')[0].insertBefore(this.util.createElement('div', 'class', 'biz-doc-toobarspace'), document.getElementsByClassName('biz-doc-bottomtoolbar-indent')[0].childNodes[0]);
document.getElementById('biz_doc_undobtn').insertBefore(this.util.createElement('div', 'class', 'biz-doc-toobarspace'), document.getElementById('biz_doc_undobtn').childNodes[0]);
document.getElementById('DocumentViewer_editor_font_properties_increaseIndent').after(this.util.createElement('div', 'class', 'biz-doc-toobarspace'));
document.getElementById('DocumentViewer_editor_font_properties_clearFormat').after(this.util.createElement('div', 'class', 'biz-doc-toobarspace'));
document.getElementById('DocumentViewer_editor_font_properties_fontSizeDiv').after(this.util.createElement('div', 'class', 'e-toolbar-item e-separator biz-doc-seperator'));
document.getElementById('DocumentViewer_editor_font_properties_rightDiv').after(this.util.createElement('div', 'class', 'e-toolbar-item e-separator biz-doc-seperator'));
document.getElementById('DocumentViewer_editor_font_properties_styleDiv').after(this.util.createElement('div', 'class', 'e-toolbar-item e-separator biz-doc-seperator'));
document.getElementById('DocumentViewer_editor_font_properties_lineHeight').after(this.util.createElement('div', 'class', 'e-toolbar-item e-separator biz-doc-seperator'));
document.getElementById('DocumentViewer_editor_font_properties_color').getElementsByClassName("e-colorpicker-wrapper")[0].after(this.util.createElement('div', 'class', 'e-toolbar-item e-separator biz-doc-seperator'));
this.util.appendChildren('biz-doc-bottomtoolbar-undoredo', 0, this.util.createElement("button", 'class', 'biz-doc-undo e-disabled e-btn e-lib'));
this.util.appendChildren('biz-doc-undo', 0, this.util.createElement("span", 'class', 'e-icons e-icon-left biz-doc-undo-icon e-btn-icon'));
this.util.appendChildren('biz-doc-bottomtoolbar-undoredo', 0, this.util.createElement("button", 'class', 'biz-doc-redo e-disabled e-btn e-lib'));
this.util.appendChildren('biz-doc-redo', 0, this.util.createElement("span", 'class', 'e-icons e-icon-left biz-doc-redo-icon e-btn-icon'));
this.docBase.toolbarWidth = document.querySelector('.biz-doc-bottomtoolbar-undoredo').getBoundingClientRect().width + document.querySelector('.biz-doc-bottomtoolbar-text').getBoundingClientRect().width + document.querySelector('.biz-doc-bottomtoolbar-paragraph').getBoundingClientRect().width + document.querySelector('.biz-doc-bottomtoolbar-indent').getBoundingClientRect().width;
}
createResponsiveToolbar() {
var instance = this;
document.getElementsByClassName('biz-doc-bottomtoolbar')[0].insertBefore(this.util.createElement('div', 'class', 'leftarrow-wrapper'), document.getElementsByClassName('biz-doc-bottomtoolbar')[0].childNodes[0]);
document.getElementsByClassName('biz-doc-bottomtoolbar')[0].appendChild(this.util.createElement('div', 'class', 'rightarrow-wrapper'));
document.getElementsByClassName('leftarrow-wrapper')[0].appendChild(this.util.createElement('button', 'id', 'leftarrow-btn'));
document.getElementsByClassName('rightarrow-wrapper')[0].appendChild(this.util.createElement('button', 'id', 'rightarrow-btn'));
this.docBase.rightArrowBtn = document.getElementById('rightarrow-btn');
this.docBase.leftArrowBtn = document.getElementById('leftarrow-btn');
this.docBase.leftArrowWrapper = document.getElementsByClassName('leftarrow-wrapper')[0];
this.docBase.rightArrowWrapper = document.getElementsByClassName('rightarrow-wrapper')[0];
this.docBase.toolbarWrapper = document.getElementsByClassName('biz-doc-toolbar-wrapper')[0];
this.docBase.rightArrowBtn.classList.add('e-icons');
this.docBase.rightArrowBtn.classList.add('biz_right_arrow');
this.docBase.leftArrowBtn.classList.add('e-icons');
this.docBase.leftArrowBtn.classList.add('biz_left_arrow');
this.docBase.leftArrowBtn.classList.add('e-disabled');
this.docBase.leftArrowWrapper.style.display = 'none';
this.docBase.rightArrowWrapper.style.display = 'none';
this.setToolbarWidth();
this.docBase.rightArrowBtn.addEventListener('click', () => {
this.docBase.toolbarWrapper.scrollBy({
top: 0,
left: 300,
behavior: "smooth"
});
this.docBase.leftArrowBtn.classList.remove('e-disabled');
});
this.docBase.leftArrowBtn.addEventListener('click', () => {
this.docBase.toolbarWrapper.scrollBy({
top: 0,
left: -300,
behavior: "smooth"
});
this.docBase.rightArrowBtn.classList.remove('e-disabled');
});
this.docBase.toolbarWrapper.addEventListener('scroll', () => {
if (this.docBase.toolbarWrapper.scrollWidth - this.docBase.toolbarWrapper.scrollLeft - this.docBase.toolbarWrapper.clientWidth < 1) {
this.docBase.rightArrowBtn.classList.add("e-disabled");
}
else if (this.docBase.toolbarWrapper.scrollLeft == 0) {
this.docBase.leftArrowBtn.classList.add("e-disabled");
}
});
window.addEventListener('resize', () => {
this.setToolbarWidth();
});
}
setDisplay(value) {
this.docBase.leftArrowWrapper.style.display = value;
this.docBase.rightArrowWrapper.style.display = value;
}
getBtnsWidth() {
return document.getElementsByClassName('leftarrow-wrapper')[0].getBoundingClientRect().width + document.getElementsByClassName('rightarrow-wrapper')[0].getBoundingClientRect().width;
}
setToolbarWidth() {
if (window.innerWidth <= this.docBase.toolbarWidth + this.getBtnsWidth()) {
this.setDisplay('');
this.docBase.toolbarWrapper.style.width = 'calc(100% - 72px)';
}
else {
this.setDisplay('none');
this.docBase.toolbarWrapper.style.width = this.docBase.toolbarWidth + 3 + 'px';
}
}
static Instance() {
if (this.instance === undefined) {
this.instance = new Ribbon();
}
return this.instance;
}
}
DocEditor.Ribbon = Ribbon;
})(DocEditor = Components.DocEditor || (Components.DocEditor = {}));
})(Components = Collaboration.Components || (Collaboration.Components = {}));
})(Collaboration = Apps.Collaboration || (Apps.Collaboration = {}));
})(Apps = Unibase.Apps || (Unibase.Apps = {}));
})(Unibase || (Unibase = {}));
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,229 @@
var Unibase;
(function (Unibase) {
let Apps;
(function (Apps) {
let Collaboration;
(function (Collaboration) {
let Components;
(function (Components) {
class Documents extends Unibase.Platform.Core.BaseComponent {
constructor() {
super(...arguments);
this.ej2Source = {
Excel: ['libs/syncfusion/excel/ej2-excel.min.js'],
Pdf: ['libs/syncfusion/pdf/ej2-pdf.min.js'],
Word: ['libs/syncfusion/word/ej2-word.min.js'],
};
}
jsFiles() {
return ["apps/collaboration/managers/documentmanager.js"];
}
cssFiles() {
return [];
}
loadForm(FormId, Pk_Value, AppConfigurationId, Callback, ElementId) {
var instance = this;
instance.navigationHelper.popup(Pk_Value, '', Unibase.Apps.Collaboration.Components.Documents.Instance(), function (container) {
var documentGroup = ElementId;
if (Callback != null) {
Callback();
}
}, Unibase.Platform.Helpers.Size.ExtraLarge);
}
html(id, containerid) {
var html = `<div><div id="DocumentViewer" style="width: 100%;height: 100%" class="DocumentViewer"></div></div>
<div id="dialog-container">
<div id="dialog"></div>
<div id="see-document-status"></div>
<div id="dlgContent" class="dialogContent"></div>
</div><div id="importfile-container"></div>
<div id="copydocument-container"> </div><div id="spreadsheettrim-container">
<div id="removeduplicates"></div><div id="biz-ss-menubar-fullscreendialog"></div><div id="biz-ss-resizetofit-dialog"></div></div>`;
return html;
}
load(formId, containerid, callback) {
var instance = this;
instance._containerid = containerid;
}
convertDocsToPdfDownload(documentFileId) {
Unibase.Apps.Collaboration.DocumentManager.Instance().ConvertDocstoPdfDownload(documentFileId).then(function (response) {
Unibase.Themes.Compact.Components.Notification.Instance().Downloadfile(response.result);
});
}
previewSpreadSheet(fileurl, userid) {
let docManger = Unibase.Apps.Collaboration.DocumentManager.Instance();
docManger.getDocumentFileInfo(fileurl).then((response) => {
docManger.getJsonData(response.result.FileId).then((res) => {
docManger.getCustomJsonData(response.result.FileId).then((customresponse) => {
Unibase.Apps.Collaboration.Components.Documents.Instance()._documentId = response.result.FileId;
Unibase.Apps.Collaboration.Components.DocConnector.Instance().init(response.result.FileId, response.result.DocumentGroup);
this.fileCacheHelper.loadJsFiles(["apps/collaboration/components/sheets/formatpainter.js", "apps/collaboration/components/unicloud.js", "apps/collaboration/components/sheets/spellcheck.js", "apps/collaboration/components/sheets/spellcheck.js", "apps/collaboration/components/sheets/autofill.js", "apps/collaboration/components/sheets/ribbon.js", "apps/collaboration/components/sheets/dialogue.js", "apps/collaboration/components/sheets/base.js", 'apps/collaboration/components/common/download.js', 'apps/collaboration/enums/enum.js'], () => {
let sheets = Unibase.Apps.Collaboration.Components.Sheets.Base.Instance();
console.log(response);
if (res.result != null && res.result != "") {
sheets.init(response, res, customresponse);
Unibase.Platform.Helpers.NavigationHelper.Instance().hideLoading();
}
else {
}
});
});
});
});
}
;
previewWordDocument(Fileurl) {
Unibase.Apps.Collaboration.DocumentManager.Instance().getDocumentFileInfo(Fileurl).then((response) => {
Unibase.Apps.Collaboration.DocumentManager.Instance().getJsonData(response.result.FileId).then((res) => {
this.fileCacheHelper.loadJsFiles(['apps/collaboration/components/doceditor/base.js', 'platform/core/helpers/file/filehelper.js', 'apps/collaboration/components/sheets/base.js', 'apps/collaboration/components/unicloud.js', 'apps/collaboration/components/doceditor/ribbon.js', 'apps/collaboration/components/common/download.js'], () => {
let bizDoc = Unibase.Apps.Collaboration.Components.DocEditor.Base.Instance();
bizDoc.init(response, res);
Unibase.Platform.Helpers.NavigationHelper.Instance().hideLoading();
});
});
});
}
previewPdf(FileId) {
Unibase.Apps.Collaboration.DocumentManager.Instance().getDocumentFileInfo(FileId).then((response) => {
this.fileCacheHelper.loadJsFiles(['apps/collaboration/components/pdfviewer/base.js'], () => {
let bizPfd = Unibase.Apps.Collaboration.Components.PdfViewer.Base.Instance();
bizPfd.init(response);
Unibase.Platform.Helpers.NavigationHelper.Instance().hideLoading();
});
});
}
previewImage(documentFileId) {
Unibase.Apps.Collaboration.DocumentManager.Instance().getDocumentFileInfo(documentFileId).then(function (response) {
var result = response.result;
var fileName = result.DocumentFileName + "." + result.FileType;
var byteCharacters = atob(result.FileData);
var byteNumbers = new Array(byteCharacters.length);
for (var i = 0; i < byteCharacters.length; i++) {
byteNumbers[i] = byteCharacters.charCodeAt(i);
}
var byteArray = new Uint8Array(byteNumbers);
var file = new Blob([byteArray], { type: result.DocumentGroup + '/' + result.FileType + ';base64' });
var fileURL = URL.createObjectURL(file);
window.open(fileURL, fileName, "width=600,height=600,scrollbars=yes");
Unibase.Platform.Helpers.NavigationHelper.Instance().hideLoading();
});
}
previewDocument(documentFileId, documentGroup, userid) {
this.documentfileid = documentFileId;
this.documentGroup = documentGroup;
$(".unibase_modal_backdrop").removeAttr('style');
$(".preloader-it").fadeIn();
this.fileCacheHelper.loadJsFiles(["apps/collaboration/managers/documentmanager.js", "apps/collaboration/managers/filemanager.js", "apps/collaboration/components/sheets/spellcheck.js", "apps/collaboration/components/docconnector.js", "apps/collaboration/components/unidochub.js", "apps/collaboration/components/common/util.js", 'libs/syncfusion/ej2.min.js', 'apps/collaboration/components/fullscreen.js'], () => {
this.fileCacheHelper.loadCssFiles(['libs/syncfusion/material.css', 'libs/syncfusion/custom-css.css', 'libs/syncfusion/docx.css', 'libs/syncfusion/spreadsheet-custom.css', 'libs/syncfusion/pdf.css'], () => {
if (documentGroup == "Image") {
this.previewImage(documentFileId);
}
else if (documentGroup == "Excel") {
this.previewSpreadSheet(documentFileId, userid);
}
else if (documentGroup == "Word") {
this.previewWordDocument(documentFileId);
}
else if (documentGroup == "Pdf") {
this.previewPdf(documentFileId);
}
});
});
}
downloadDocument(FileId, documentGroup) {
if (documentGroup == "Excel") {
Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/collaboration/managers/documentmanager.js", function () {
var data = {
FileId: FileId
};
Unibase.Apps.Collaboration.DocumentManager.Instance().spreadSheetDownload(data).then(function (response) {
var filepath = response.result;
filepath = encodeURIComponent(filepath);
Unibase.Themes.Compact.Components.Notification.Instance().Downloadfile(filepath);
});
});
}
else if (documentGroup == "Word") {
Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/collaboration/managers/documentmanager.js", function () {
Unibase.Apps.Collaboration.DocumentManager.Instance().getDocumentFileInfo(FileId).then(function (response) {
var filepath = response.result.DocumentFilePath;
filepath = encodeURIComponent(filepath);
Unibase.Themes.Compact.Components.Notification.Instance().Downloadfile(filepath);
});
});
}
else {
Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile("apps/collaboration/managers/documentmanager.js", function () {
Unibase.Apps.Collaboration.DocumentManager.Instance().getDocumentFileInfo(FileId).then(function (response) {
var a = document.createElement("a");
a.href = "data:" + response.result.FileType + ";base64," + response.result.FileData;
a.download = response.result.FileTitle + "." + response.result.FileType;
a.click();
});
});
}
}
deleteDocumentFile(DocumentFileId) {
bootbox.confirm("Do you want to Delete this File ?", function (result) {
if (result == true) {
Unibase.Platform.Files.Managers.FileManager.Instance().deleteDocumentFile(DocumentFileId).then(function (response) {
MessageHelper.Instance().showSuccess("Document File Deleted Successfully.", "");
var detailobj = Unibase.Themes.Compact.Components.Details.Instance();
detailobj._recordId = Unibase.Themes.Providers.DetailHelper.recordId;
detailobj._installedAppId = Unibase.Themes.Providers.DetailHelper.installedAppId;
detailobj._containerId = $("._bizgaze_detail_container:visible").attr("id");
var idetailObj = detailobj;
detailobj.loadPortlets(idetailObj);
});
}
});
}
newWordDoc(callback) {
Unibase.Platform.Helpers.NavigationHelper.Instance().showLoading();
this.fileCacheHelper.loadJsFiles(this.ej2Source["Word"].concat(["apps/collaboration/managers/documentmanager.js", "apps/collaboration/components/sheets/spellcheck.js", "apps/collaboration/components/docconnector.js", "apps/collaboration/components/unidochub.js", "apps/collaboration/components/common/util.js", 'apps/collaboration/components/fullscreen.js', 'apps/collaboration/components/sheets/base.js', 'apps/collaboration/components/doceditor/base.js', 'apps/collaboration/components/doceditor/ribbon.js', 'apps/collaboration/components/common/download.js', 'apps/collaboration/enums/enum.js']), () => {
this.fileCacheHelper.loadCssFiles(['libs/syncfusion/material.css', 'libs/syncfusion/custom-css.css', 'libs/syncfusion/docx.css', 'libs/syncfusion/spreadsheet-custom.css', 'libs/syncfusion/pdf.css'], () => {
var response = {
result: { FileTitle: "Untitled Document", NewDocument: true, NewUpload: true }
};
var res = { result: "" };
let bizDoc = Unibase.Apps.Collaboration.Components.DocEditor.Base.Instance();
bizDoc.init(response, res, callback);
Unibase.Platform.Helpers.NavigationHelper.Instance().hideLoading();
});
});
}
newExcel(type, callback) {
Unibase.Platform.Helpers.NavigationHelper.Instance().showLoading();
this.fileCacheHelper.loadJsFiles(["apps/collaboration/components/sheets/formatpainter.js", "apps/collaboration/components/unicloud.js", "apps/collaboration/components/docconnector.js", 'libs/syncfusion/ej2.min.js', "apps/collaboration/components/fullscreen.js", "apps/collaboration/components/sheets/spellcheck.js", "apps/collaboration/components/sheets/autofill.js", "apps/collaboration/components/sheets/ribbon.js", "apps/collaboration/components/sheets/dialogue.js", "apps/collaboration/components/sheets/base.js", 'apps/collaboration/components/common/download.js', 'apps/collaboration/components/common/util.js', 'apps/collaboration/enums/enum.js'], () => {
this.fileCacheHelper.loadCssFiles(['libs/syncfusion/material.css', 'libs/syncfusion/custom-css.css', 'libs/syncfusion/docx.css', 'libs/syncfusion/spreadsheet-custom.css', 'libs/syncfusion/pdf.css'], () => {
var folderId;
var res = { result: "" };
var customres = { result: "" };
var response = { result: { FileTitle: "Untitled Spreadsheet", NewDocument: true, NewUpload: true, folderId: folderId } };
if (type != 0 && type != undefined) {
folderId = parseInt(atob(type));
}
else {
folderId = 0;
}
var sheets = Unibase.Apps.Collaboration.Components.Sheets.Base.Instance();
sheets.init(response, res, customres, callback);
Unibase.Platform.Helpers.NavigationHelper.Instance().hideLoading();
});
});
}
static Instance() {
if (this.instance === undefined) {
this.instance = new Documents();
}
return this.instance;
}
}
Components.Documents = Documents;
class sfdtexport {
}
Components.sfdtexport = sfdtexport;
})(Components = Collaboration.Components || (Collaboration.Components = {}));
})(Collaboration = Apps.Collaboration || (Apps.Collaboration = {}));
})(Apps = Unibase.Apps || (Unibase.Apps = {}));
})(Unibase || (Unibase = {}));
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,89 @@
var Unibase;
(function (Unibase) {
let Apps;
(function (Apps) {
let Collaboration;
(function (Collaboration) {
let Components;
(function (Components) {
class Fullscreen {
constructor() {
this.ssMenuBarFullScreen = false;
this.isDocFullscreen = false;
}
refreshWordDocumentHeight(docObj) {
this.docBase = Unibase.Apps.Collaboration.Components.DocEditor.Base.Instance();
let fullscreenElement = docObj.element;
this.wordDocRibbon = document.getElementsByClassName('biz-doc-ribbon')[0];
this.wordDocToolbar = document.getElementsByClassName('biz-doc-bottomtoolbar')[0];
this.wordDocFooter = fullscreenElement.parentElement.nextElementSibling;
this.wordDocFooter.style.display = "none";
this.wordDocRibbon.style.display = 'none';
this.wordDocToolbar.style.display = 'none';
docObj.height = window.innerHeight + 'px';
document.getElementsByClassName('e-de-text-target')[0].contentWindow.document.addEventListener("keyup", (e) => {
this.refreshDocumentHeightProps(fullscreenElement);
event.preventDefault();
this.exitFullscreenEsc(e, docObj);
if (e.keyCode == 122) {
if (!this.isDocFullscreen) {
this.totalHeight = window.innerHeight - this.ribbonHeight - this.toolbarHeight - this.footerHeight;
docObj.height = this.totalHeight + 'px';
this.isDocFullscreen = true;
}
else {
this.totalHeight = window.innerHeight - this.ribbonHeight - this.toolbarHeight - this.footerHeight;
docObj.height = this.totalHeight + 'px';
this.isDocFullscreen = false;
}
}
});
document.body.addEventListener("keyup", (e) => {
this.exitFullscreenEsc(e, this.docBase.wordDocumentObj);
});
}
refreshDocumentHeightProps(fullscreenElement) {
this.ribbonHeight = document.getElementsByClassName("biz-doc-ribbon")[0].offsetHeight;
this.toolbarHeight = document.getElementsByClassName("biz-doc-bottomtoolbar")[0].offsetHeight;
this.footerHeight = fullscreenElement.parentElement.nextElementSibling.offsetHeight;
}
exitFullscreenEsc(e, docObj) {
if (e.keyCode == 27) {
this.refreshDocumentHeightProps(docObj.element);
this.wordDocRibbon.style.display = '';
this.wordDocToolbar.style.display = '';
this.wordDocFooter.style.display = "";
this.totalHeight = window.innerHeight - this.ribbonHeight - this.toolbarHeight - this.footerHeight;
docObj.height = this.totalHeight + 'px';
}
}
refreshSpreadsheetHeight(ssObj) {
this.sheetBase = Unibase.Apps.Collaboration.Components.Sheets.Base.Instance();
this.dialog = Unibase.Apps.Collaboration.Components.Sheets.Dialogue.Instance();
this.ssMenuBarFullScreen = true;
let fullscreenElement = ssObj.element;
let sheetPannelElement = document.getElementById("DocumentViewer_sheet_panel");
fullscreenElement.parentElement.nextElementSibling.style.display = "none";
fullscreenElement.parentElement.previousElementSibling.style.display = "none";
document.getElementById('DocumentViewer_ribbon').style.display = 'none';
var footerHeight = sheetPannelElement.nextElementSibling.offsetHeight;
var headerHeight = sheetPannelElement.previousElementSibling.offsetHeight;
sheetPannelElement.style.height = window.innerHeight - footerHeight - headerHeight + "px";
this.dialog.renderMenubarFullscreenDialog();
}
inintEvents() {
}
removeEvetns() {
}
static Instance() {
if (this.instance === undefined) {
this.instance = new Fullscreen();
}
return this.instance;
}
}
Components.Fullscreen = Fullscreen;
})(Components = Collaboration.Components || (Collaboration.Components = {}));
})(Collaboration = Apps.Collaboration || (Apps.Collaboration = {}));
})(Apps = Unibase.Apps || (Unibase.Apps = {}));
})(Unibase || (Unibase = {}));
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"fullscreen.js","sourceRoot":"","sources":["fullscreen.ts"],"names":[],"mappings":"AAAA,IAAU,OAAO,CAyIhB;AAzID,WAAU,OAAO;IACb,IAAiB,IAAI,CAuIpB;IAvID,WAAiB,IAAI;QACjB,IAAiB,aAAa,CAqI7B;QArID,WAAiB,aAAa;YAC1B,IAAiB,UAAU,CAmI1B;YAnID,WAAiB,UAAU;gBACvB,MAAa,UAAU;oBAAvB;wBAKI,wBAAmB,GAAY,KAAK,CAAC;wBAMrC,oBAAe,GAAY,KAAK,CAAC;oBAsHrC,CAAC;oBA5GG,yBAAyB,CAAC,MAAM;wBAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;wBAC/E,IAAI,iBAAiB,GAAiB,MAAc,CAAC,OAAO,CAAC;wBAC7D,IAAI,CAAC,aAAa,GAAG,QAAQ,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAgB,CAAC;wBACzF,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAC,sBAAsB,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAgB,CAAC;wBACjG,IAAI,CAAC,aAAa,GAAG,iBAAiB,CAAC,aAAa,CAAC,kBAAiC,CAAA;wBAGtF,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;wBAC1C,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;wBAC1C,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;wBAE3C,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,WAAW,GAAG,IAAI,CAAC;wBAGxC,QAAQ,CAAC,sBAAsB,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAS,CAAC,aAAa,CAAC,QAAwB,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;4BAEpI,IAAI,CAAC,0BAA0B,CAAC,iBAAiB,CAAC,CAAC;4BACnD,KAAK,CAAC,cAAc,EAAE,CAAC;4BACvB,IAAI,CAAC,iBAAiB,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;4BAClC,IAAI,CAAC,CAAC,OAAO,IAAI,GAAG,EAAE;gCAClB,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;oCACvB,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,GAAG,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,YAAY,CAAC;oCACnG,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;oCACxC,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;iCAC/B;qCACI;oCACD,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,GAAG,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,YAAY,CAAC;oCACnG,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;oCACxC,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;iCAEhC;6BACJ;wBAEL,CAAC,CAAC,CAAC;wBAEH,QAAQ,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;4BAE1C,IAAI,CAAC,iBAAiB,CAAC,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;wBAC5D,CAAC,CAAC,CAAA;oBACN,CAAC;oBAED,0BAA0B,CAAC,iBAAiB;wBACxC,IAAI,CAAC,YAAY,GAAI,QAAQ,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAiB,CAAC,YAAY,CAAC;wBACvG,IAAI,CAAC,aAAa,GAAI,QAAQ,CAAC,sBAAsB,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAiB,CAAC,YAAY,CAAC;wBAC/G,IAAI,CAAC,YAAY,GAAI,iBAAiB,CAAC,aAAa,CAAC,kBAAkC,CAAC,YAAY,CAAC;oBACzG,CAAC;oBAED,iBAAiB,CAAC,CAAC,EAAE,MAAM;wBACvB,IAAI,CAAC,CAAC,OAAO,IAAI,EAAE,EAAE;4BACjB,IAAI,CAAC,0BAA0B,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;4BAChD,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC;4BACtC,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC;4BACvC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC;4BAKtC,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,GAAG,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,YAAY,CAAC;4BACnG,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;yBAE3C;oBACL,CAAC;oBAGD,wBAAwB,CAAC,KAAK;wBAE1B,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;wBAC9E,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;wBAC/E,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;wBAEhC,IAAI,iBAAiB,GAAiB,KAAa,CAAC,OAAO,CAAC;wBAC5D,IAAI,kBAAkB,GAAgB,QAAQ,CAAC,cAAc,CAAC,4BAA4B,CAAC,CAAC;wBAG3F,iBAAiB,CAAC,aAAa,CAAC,kBAAkC,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;wBAC1F,iBAAiB,CAAC,aAAa,CAAC,sBAAsC,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;wBAC/F,QAAQ,CAAC,cAAc,CAAC,uBAAuB,CAAC,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC;wBAGxE,IAAI,YAAY,GAAI,kBAAkB,CAAC,kBAAkC,CAAC,YAAY,CAAC;wBACvF,IAAI,YAAY,GAAI,kBAAkB,CAAC,sBAAsC,CAAC,YAAY,CAAC;wBAC3F,kBAAkB,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,WAAW,GAAG,YAAY,GAAG,YAAY,GAAG,IAAI,CAAC;wBAE1F,IAAI,CAAC,MAAM,CAAC,6BAA6B,EAAE,CAAC;oBAChD,CAAC;oBAKD,WAAW;oBAGX,CAAC;oBAED,YAAY;oBAEZ,CAAC;oBAID,MAAM,CAAC,QAAQ;wBACX,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE;4BAC7B,IAAI,CAAC,QAAQ,GAAG,IAAI,UAAU,EAAE,CAAC;yBACpC;wBACD,OAAO,IAAI,CAAC,QAAQ,CAAC;oBACzB,CAAC;iBAEJ;gBAjIY,qBAAU,aAiItB,CAAA;YACL,CAAC,EAnIgB,UAAU,GAAV,wBAAU,KAAV,wBAAU,QAmI1B;QACL,CAAC,EArIgB,aAAa,GAAb,kBAAa,KAAb,kBAAa,QAqI7B;IACL,CAAC,EAvIgB,IAAI,GAAJ,YAAI,KAAJ,YAAI,QAuIpB;AACL,CAAC,EAzIS,OAAO,KAAP,OAAO,QAyIhB"}
+1
View File
@@ -0,0 +1 @@
var Unibase;(function(n){let t;(function(t){let i;(function(t){let i;(function(t){class i{constructor(){this.ssMenuBarFullScreen=!1;this.isDocFullscreen=!1}refreshWordDocumentHeight(t){this.docBase=n.Apps.Collaboration.Components.DocEditor.Base.Instance();let i=t.element;this.wordDocRibbon=document.getElementsByClassName("biz-doc-ribbon")[0];this.wordDocToolbar=document.getElementsByClassName("biz-doc-bottomtoolbar")[0];this.wordDocFooter=i.parentElement.nextElementSibling;this.wordDocFooter.style.display="none";this.wordDocRibbon.style.display="none";this.wordDocToolbar.style.display="none";t.height=window.innerHeight+"px";document.getElementsByClassName("e-de-text-target")[0].contentWindow.document.addEventListener("keyup",n=>{this.refreshDocumentHeightProps(i),event.preventDefault(),this.exitFullscreenEsc(n,t),n.keyCode==122&&(this.isDocFullscreen?(this.totalHeight=window.innerHeight-this.ribbonHeight-this.toolbarHeight-this.footerHeight,t.height=this.totalHeight+"px",this.isDocFullscreen=!1):(this.totalHeight=window.innerHeight-this.ribbonHeight-this.toolbarHeight-this.footerHeight,t.height=this.totalHeight+"px",this.isDocFullscreen=!0))});document.body.addEventListener("keyup",n=>{this.exitFullscreenEsc(n,this.docBase.wordDocumentObj)})}refreshDocumentHeightProps(n){this.ribbonHeight=document.getElementsByClassName("biz-doc-ribbon")[0].offsetHeight;this.toolbarHeight=document.getElementsByClassName("biz-doc-bottomtoolbar")[0].offsetHeight;this.footerHeight=n.parentElement.nextElementSibling.offsetHeight}exitFullscreenEsc(n,t){n.keyCode==27&&(this.refreshDocumentHeightProps(t.element),this.wordDocRibbon.style.display="",this.wordDocToolbar.style.display="",this.wordDocFooter.style.display="",this.totalHeight=window.innerHeight-this.ribbonHeight-this.toolbarHeight-this.footerHeight,t.height=this.totalHeight+"px")}refreshSpreadsheetHeight(t){this.sheetBase=n.Apps.Collaboration.Components.Sheets.Base.Instance();this.dialog=n.Apps.Collaboration.Components.Sheets.Dialogue.Instance();this.ssMenuBarFullScreen=!0;let r=t.element,i=document.getElementById("DocumentViewer_sheet_panel");r.parentElement.nextElementSibling.style.display="none";r.parentElement.previousElementSibling.style.display="none";document.getElementById("DocumentViewer_ribbon").style.display="none";var u=i.nextElementSibling.offsetHeight,f=i.previousElementSibling.offsetHeight;i.style.height=window.innerHeight-u-f+"px";this.dialog.renderMenubarFullscreenDialog()}inintEvents(){}removeEvetns(){}static Instance(){return this.instance===undefined&&(this.instance=new i),this.instance}}t.Fullscreen=i})(i=t.Components||(t.Components={}))})(i=t.Collaboration||(t.Collaboration={}))})(t=n.Apps||(n.Apps={}))})(Unibase||(Unibase={}));
@@ -0,0 +1,157 @@
var Unibase;
(function (Unibase) {
let Apps;
(function (Apps) {
let Collaboration;
(function (Collaboration) {
let Components;
(function (Components) {
let PdfViewer;
(function (PdfViewer) {
class Base {
constructor() {
this.isFullscreen = false;
}
init(response) {
this.result = response.result;
this.documentGroup = this.result.DocumentGroup;
this.documentFileName = this.result.DocumentFileName;
this.documentFileId = this.result.DocumentFileId;
this.filePath = this.result.DocumentFilePath;
this.render();
}
unwireBootStrapKeyEvent() {
let popup = document.body.getElementsByClassName('_bizgaze_popup_container');
let events = $._data($(popup)[0], "events");
if (events && events.keydown) {
$(popup).off('keydown.dismiss.bs.modal', events.keydown[0].handler);
}
}
render() {
this.renderPopup();
this.renderMenuBar();
this.renderPdf();
this.updateProps();
this.refreshHeight();
this.addEventListeners();
this.unwireBootStrapKeyEvent();
}
addEventListeners() {
this.fullscreenBtn.addEventListener('click', () => {
this.openFullscreen();
});
this.popupElement.addEventListener('fullscreenchange', () => {
setTimeout(() => {
this.setHeigthOnFullscreenChange();
}, 0);
if (this.isFullscreen) {
this.fullscreenBtn.classList.remove('biz-enterfullscreen');
this.fullscreenBtn.classList.add('biz-exitfullscreen');
this.isFullscreen = true;
}
else {
this.fullscreenBtn.classList.remove('biz-exitfullscreen');
this.fullscreenBtn.classList.add('biz-enterfullscreen');
this.isFullscreen = false;
}
;
});
document.addEventListener('fullscreenchange', () => {
this.setHeigthOnFullscreenChange();
});
window.addEventListener('keyup', (e) => {
if (e.keyCode == 122) {
e.preventDefault();
this.openFullscreen();
this.setHeigthOnFullscreenChange();
}
});
this.exitPdf.addEventListener('click', () => {
this.closePopup();
});
}
openFullscreen() {
let elem = this.popupElement;
if (!this.isFullscreen) {
if (elem.requestFullscreen) {
elem.requestFullscreen();
}
else if (elem.webkitRequestFullscreen) {
elem.webkitRequestFullscreen();
}
else if (elem.msRequestFullscreen) {
elem.msRequestFullscreen();
}
this.isFullscreen = true;
}
else {
if (document.exitFullscreen) {
document.exitFullscreen();
}
else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
}
else if (document.msExitFullscreen) {
document.msExitFullscreen();
}
this.isFullscreen = false;
}
}
setHeigthOnFullscreenChange() {
var footerHeight = this.element.parentElement.nextElementSibling.offsetHeight;
this.element.parentElement.style.height = window.innerHeight - footerHeight + 'px';
this.pdfViewer.height = '100%';
}
renderPdf() {
this.pdfViewer = new ej.pdfviewer.PdfViewer({
created: this.pdfCreated.bind(this),
documentPath: this.filePath,
serviceUrl: 'http://localhost:3088/pdfviewer'
});
ej.pdfviewer.PdfViewer.Inject(ej.pdfviewer.TextSelection, ej.pdfviewer.TextSearch, ej.pdfviewer.Print, ej.pdfviewer.Navigation);
this.pdfViewer.appendTo('#DocumentViewer');
}
updateProps() {
this.popupElement = document.getElementsByClassName('_bizgaze_popup_container')[0];
this.element = document.getElementById('DocumentViewer');
this.fullscreenBtn = document.getElementsByClassName('biz-pdf-fullscreen-btn')[0];
this.exitPdf = document.getElementsByClassName('biz-pdf-exitpdf-btn')[0];
}
pdfCreated() {
var util = Unibase.Apps.Collaboration.Components.Common.Util.Instance();
document.getElementById("DocumentViewer_zoomDropDownContainer").after(util.createElement('div', 'class', 'biz-pdf-fullscreen'));
util.appendChildren('biz-pdf-fullscreen', 0, util.createElement('button', 'class', 'e-icons biz-pdf-fullscreen-btn biz-enterfullscreen'));
document.getElementById("DocumentViewer_downloadContainer").after(util.createElement('div', 'class', 'biz-pdf-exitpdf'));
util.appendChildren('biz-pdf-exitpdf', 0, util.createElement('button', 'class', 'e-icons biz-pdf-exitpdf-btn'));
}
actionComplete() {
}
closePopup() {
Unibase.Apps.Collaboration.Components.DocConnector.Instance().closeDoc();
var contId = $("._bizgaze_popup_container:visible").attr("id");
$('#' + contId).modal('hide');
$('#' + contId).remove();
}
refreshHeight() {
var footerHeight = this.element.parentElement.nextElementSibling.offsetHeight;
var rootHeight = this.element.parentElement.parentElement.offsetHeight;
this.element.parentElement.style.height = (rootHeight - footerHeight) + 'px';
}
renderPopup() {
Unibase.Apps.Collaboration.Components.Documents.Instance().loadForm(0, this.documentFileId, 0, null, this.documentGroup);
}
renderMenuBar() {
}
static Instance() {
if (this.instance === undefined) {
this.instance = new Base();
}
return this.instance;
}
}
PdfViewer.Base = Base;
})(PdfViewer = Components.PdfViewer || (Components.PdfViewer = {}));
})(Components = Collaboration.Components || (Collaboration.Components = {}));
})(Collaboration = Apps.Collaboration || (Apps.Collaboration = {}));
})(Apps = Unibase.Apps || (Unibase.Apps = {}));
})(Unibase || (Unibase = {}));
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
var Unibase;(function(n){let t;(function(t){let i;(function(t){let i;(function(t){let i;(function(t){class i{constructor(){this.isFullscreen=!1}init(n){this.result=n.result;this.documentGroup=this.result.DocumentGroup;this.documentFileName=this.result.DocumentFileName;this.documentFileId=this.result.DocumentFileId;this.filePath=this.result.DocumentFilePath;this.render()}unwireBootStrapKeyEvent(){let t=document.body.getElementsByClassName("_bizgaze_popup_container"),n=$._data($(t)[0],"events");n&&n.keydown&&$(t).off("keydown.dismiss.bs.modal",n.keydown[0].handler)}render(){this.renderPopup();this.renderMenuBar();this.renderPdf();this.updateProps();this.refreshHeight();this.addEventListeners();this.unwireBootStrapKeyEvent()}addEventListeners(){this.fullscreenBtn.addEventListener("click",()=>{this.openFullscreen()});this.popupElement.addEventListener("fullscreenchange",()=>{setTimeout(()=>{this.setHeigthOnFullscreenChange()},0),this.isFullscreen?(this.fullscreenBtn.classList.remove("biz-enterfullscreen"),this.fullscreenBtn.classList.add("biz-exitfullscreen"),this.isFullscreen=!0):(this.fullscreenBtn.classList.remove("biz-exitfullscreen"),this.fullscreenBtn.classList.add("biz-enterfullscreen"),this.isFullscreen=!1)});document.addEventListener("fullscreenchange",()=>{this.setHeigthOnFullscreenChange()});window.addEventListener("keyup",n=>{n.keyCode==122&&(n.preventDefault(),this.openFullscreen(),this.setHeigthOnFullscreenChange())});this.exitPdf.addEventListener("click",()=>{this.closePopup()})}openFullscreen(){let n=this.popupElement;this.isFullscreen?(document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.msExitFullscreen&&document.msExitFullscreen(),this.isFullscreen=!1):(n.requestFullscreen?n.requestFullscreen():n.webkitRequestFullscreen?n.webkitRequestFullscreen():n.msRequestFullscreen&&n.msRequestFullscreen(),this.isFullscreen=!0)}setHeigthOnFullscreenChange(){var n=this.element.parentElement.nextElementSibling.offsetHeight;this.element.parentElement.style.height=window.innerHeight-n+"px";this.pdfViewer.height="100%"}renderPdf(){this.pdfViewer=new ej.pdfviewer.PdfViewer({created:this.pdfCreated.bind(this),documentPath:this.filePath,serviceUrl:"http://localhost:3088/pdfviewer"});ej.pdfviewer.PdfViewer.Inject(ej.pdfviewer.TextSelection,ej.pdfviewer.TextSearch,ej.pdfviewer.Print,ej.pdfviewer.Navigation);this.pdfViewer.appendTo("#DocumentViewer")}updateProps(){this.popupElement=document.getElementsByClassName("_bizgaze_popup_container")[0];this.element=document.getElementById("DocumentViewer");this.fullscreenBtn=document.getElementsByClassName("biz-pdf-fullscreen-btn")[0];this.exitPdf=document.getElementsByClassName("biz-pdf-exitpdf-btn")[0]}pdfCreated(){var t=n.Apps.Collaboration.Components.Common.Util.Instance();document.getElementById("DocumentViewer_zoomDropDownContainer").after(t.createElement("div","class","biz-pdf-fullscreen"));t.appendChildren("biz-pdf-fullscreen",0,t.createElement("button","class","e-icons biz-pdf-fullscreen-btn biz-enterfullscreen"));document.getElementById("DocumentViewer_downloadContainer").after(t.createElement("div","class","biz-pdf-exitpdf"));t.appendChildren("biz-pdf-exitpdf",0,t.createElement("button","class","e-icons biz-pdf-exitpdf-btn"))}actionComplete(){}closePopup(){n.Apps.Collaboration.Components.DocConnector.Instance().closeDoc();var t=$("._bizgaze_popup_container:visible").attr("id");$("#"+t).modal("hide");$("#"+t).remove()}refreshHeight(){var n=this.element.parentElement.nextElementSibling.offsetHeight,t=this.element.parentElement.parentElement.offsetHeight;this.element.parentElement.style.height=t-n+"px"}renderPopup(){n.Apps.Collaboration.Components.Documents.Instance().loadForm(0,this.documentFileId,0,null,this.documentGroup)}renderMenuBar(){}static Instance(){return this.instance===undefined&&(this.instance=new i),this.instance}}t.Base=i})(i=t.PdfViewer||(t.PdfViewer={}))})(i=t.Components||(t.Components={}))})(i=t.Collaboration||(t.Collaboration={}))})(t=n.Apps||(n.Apps={}))})(Unibase||(Unibase={}));
@@ -0,0 +1,15 @@
var Unibase;
(function (Unibase) {
let Apps;
(function (Apps) {
let Collaboration;
(function (Collaboration) {
let Requests;
(function (Requests) {
class File {
}
Requests.File = File;
})(Requests = Collaboration.Requests || (Collaboration.Requests = {}));
})(Collaboration = Apps.Collaboration || (Apps.Collaboration = {}));
})(Apps = Unibase.Apps || (Unibase.Apps = {}));
})(Unibase || (Unibase = {}));
@@ -0,0 +1 @@
{"version":3,"file":"file.js","sourceRoot":"","sources":["file.ts"],"names":[],"mappings":"AAAA,IAAU,OAAO,CAkBhB;AAlBD,WAAU,OAAO;IACb,IAAiB,IAAI,CAgBpB;IAhBD,WAAiB,IAAI;QACjB,IAAkB,aAAa,CAc9B;QAdD,WAAkB,aAAa;YAC3B,IAAiB,QAAQ,CAYxB;YAZD,WAAiB,QAAQ;gBAGrB,MAAa,IAAI;iBAOhB;gBAPY,aAAI,OAOhB,CAAA;YAEL,CAAC,EAZgB,QAAQ,GAAR,sBAAQ,KAAR,sBAAQ,QAYxB;QACL,CAAC,EAdiB,aAAa,GAAb,kBAAa,KAAb,kBAAa,QAc9B;IACL,CAAC,EAhBgB,IAAI,GAAJ,YAAI,KAAJ,YAAI,QAgBpB;AACL,CAAC,EAlBS,OAAO,KAAP,OAAO,QAkBhB"}
+1
View File
@@ -0,0 +1 @@
var Unibase;(function(n){let t;(function(n){let t;(function(n){let t;(function(n){class t{}n.File=t})(t=n.Requests||(n.Requests={}))})(t=n.Collaboration||(n.Collaboration={}))})(t=n.Apps||(n.Apps={}))})(Unibase||(Unibase={}));
@@ -0,0 +1,538 @@
.biz-share-modal.modal {
overflow-y: auto !important;
}
.biz-share-modal .modal-dialog {
max-width: 640px;
}
.biz-share-modal .modal-content {
max-width: 100%;
max-height: 100%;
}
.biz-share-accordion .share-text-dark {
color: #202124;
}
.biz-share-accordion .card {
border: 0;
border-radius: 10px !important;
}
.biz-share-accordion .card .card-header {
display: flex;
justify-content: center;
padding: 20px 24px 15px 24px;
border: 0;
}
.biz-share-accordion .card .card-header > a {
padding-bottom: 0;
background-color: #fff;
color: #202124;
padding: 0rem 0rem 0.75rem 0rem;
font-weight: 400;
}
.biz-share-accordion .card .card-header > a::before,
.biz-share-accordion .card .card-header > a.collapsed:before {
content: '';
}
.biz-share-accordion .card .card-header .header-icon-wrapper {
display: flex;
align-items: center;
}
.biz-share-accordion .card .card-header .header-icon-wrapper .btn {
border-radius: 50% !important;
margin-right: 10px;
cursor: default;
}
.biz-share-accordion .card .header-icon-wrapper .notifyBackBtn {
cursor: pointer !important;
}
.biz-share-accordion .card .collapse-btn[data-expanded='true'] {
cursor: default;
}
.biz-share-accordion .card .card-header .header-title {
font-size: 22px;
}
.biz-share-accordion .card .card-header .shared-users {
padding: 9px 0 4px;
display: block;
color: #5f6368;
font-size: 14px;
}
.biz-share-accordion .card .card-header.activestate .shared-users {
display: none;
}
.biz-share-accordion .card .card-header > a.collapsed .shared-users {
display: block;
}
.biz-share-accordion .card .card-footer {
display: flex;
justify-content: space-between;
align-items: center;
}
.biz-share-accordion .add-people-wrapper {
padding: 15px 24px 0px 24px;
}
.biz-share-accordion .people-select2-wrapper {
width: 100%;
}
.biz-share-accordion .people-select2-wrapper .select2-selection--multiple {
border: none;
border-bottom: 1px solid #000 !important;
border-radius: 6px 6px 0 0 !important;
background-color: #f8f9fa;
padding: 0 .75em;
min-height: 3em;
display: flex;
align-items: center;
}
.biz-share-accordion .people-select2-wrapper .select2-selection--multiple:hover {
background-color: #f1f3f4;
}
.biz-share-accordion .people-select2-wrapper .select2-selection--multiple .select2-selection__rendered {
padding: 0 .125em 0 .25em;
}
.biz-share-accordion .people-select2-wrapper .select2-selection__rendered .select2-search__field {
margin-top: 0px;
}
.biz-share-accordion .people-select2-wrapper .select2-search__field {
margin-top: 0px;
}
.biz-share-accordion .people-select2-wrapper .select2-container--default.select2-container--focus .select2-selection--multiple {
border: none;
background: #f1f3f4;
border-bottom: 2px solid #1a73e8 !important;
}
#select2-user_select2-results {
padding-top: 4px;
padding-bottom: 4px;
}
#select2-user_select2-results .select2-results__option--highlighted[aria-selected] {
background-color: #f5f5f5 !important;
color: #202124 !important;
}
.biz-share-accordion .people-select2-wrapper .select2-selection__rendered .select2-selection__choice {
font-size: 14px;
background-color: #fff;
color: #5f6368;
border: 1px solid #dadce0;
border-radius: 16px;
padding-left: 10px;
padding-right: 5px;
margin: 4px;
}
.biz-share-accordion .people-select2-wrapper .select2-selection__rendered .select2-selection__choice:hover, .biz-share-accordion .people-select2-wrapper .select2-selection__rendered .select2-selection__choice:hover .select2-selection__choice__remove {
color: #000;
}
.biz-share-accordion .people-select2-wrapper .select2-selection__choice .select2-selection__choice__remove {
color: #5f6368;
font-size: 18px;
font-weight: 600;
margin-left: 6px;
float: right;
opacity: 1;
padding-top: 0px;
height: 0;
position: relative;
top: -4px;
}
.biz-share-accordion .shared-people-list {
max-height: 33vh;
overflow-x: auto;
margin-top: 8px;
padding: 1px 0px 1px 20px;
}
.biz-share-accordion .people-list-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 5px 8px;
border-top-left-radius: 50px;
border-bottom-left-radius: 50px;
}
.biz-share-accordion .people-list-item:hover {
background-color: #f1f3f4;
}
.biz-share-accordion .user-role-wrapper {
padding-right: 20px;
}
.biz-share-accordion .user-detail-wrapper {
display: flex;
align-items: center;
}
.biz-share-accordion .user-role-wrapper .dropdown-toggle {
background-color: transparent;
font-weight: 500;
color: #5f6368;
font-size: 14px;
}
.biz-share-accordion .user-role-wrapper .dropdown-toggle:hover {
background-color: #ecedee;
font-weight: 500;
color: #202124;
}
.biz-share-accordion .user-role-wrapper .dropdown-item {
padding: 8px 40px;
color: #202124;
position: relative;
}
.biz-share-accordion .user-role-wrapper .dropdown-item .dropdown-icon {
position: absolute;
left: 10px;
top: 50%;
transform: translateY(-50%);
color: #1a73e8;
font-size: 20px;
}
.biz-share-accordion .user-role-wrapper .dropdown-item .temp-span {
display: block;
font-size: 14px;
color: rgba(0, 0, 0, 0.54);
}
.biz-share-accordion .user-role-wrapper .owner-span {
padding: 0.25rem 0.7rem;
color: rgba(60, 64, 67, 0.38);
font-style: italic;
font-weight: 500;
font-size: 14px;
}
.biz-share-accordion .user-name-email-wrapper .user-name {
font-weight: 500;
color: #202124;
}
.biz-share-accordion .card-footer {
padding: 8px 24px;
}
.biz-share-accordion .card-footer .btn {
padding: 5px 24px 5px 24px;
}
.biz-share-accordion .card-footer .feedback-link {
font-size: 12px;
text-decoration: underline;
color: #1a73e8;
}
.biz-share-accordion .card-footer .feedback-link:hover {
background-color: #f6fafe;
}
.biz-share-accordion .people-notification-area {
margin: 0 24px;
}
.biz-share-accordion .shared-file-btn {
display: flex;
align-items: center;
cursor: pointer;
margin-bottom: 8px;
padding-left: 10px;
padding-right: 10px;
max-width: 100%;
background-color: #fff;
border: 1px #dadce0 solid;
-webkit-box-sizing: border-box;
box-sizing: border-box;
color: #3c4043;
height: 32px;
border-radius: 16px;
font-size: 14px;
font-weight: 500;
letter-spacing: .25px;
outline: none;
}
.biz-share-accordion .shared-file-btn .file-icon {
height: 20px;
width: 20px;
}
.biz-share-accordion .shared-file-btn .file-text {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
margin-left: 10px;
}
.biz-share-accordion .message-textarea {
height: 96px;
max-height: 30vh;
width: 100%;
position: relative;
margin-bottom: 14px;
background-color: #f1f3f4;
-webkit-box-flex: 1;
-webkit-flex-grow: 1;
flex-grow: 1;
flex-shrink: 1;
font-size: 16px;
font-weight: 400;
letter-spacing: .1px;
line-height: 24px;
border: none;
outline: none;
overflow-y: visible;
overflow-x: hidden;
padding: 16px;
resize: none;
white-space: pre-wrap;
word-wrap: break-word;
z-index: 1;
}
.biz-share-accordion .message-textarea:hover {
background-color: #f1f3f4;
}
.biz-share-accordion .message-textarea:after {
background: none repeat scroll 0 0 transparent;
bottom: 0;
content: "";
display: block;
height: 2px;
left: 50%;
position: absolute;
background-color: #1a73e8;
transition: width 0.3s ease 0s, left 0.3s ease 0s;
width: 0;
}
.biz-share-accordion .message-textarea:focus:after {
width: 100%;
left: 0;
}
.biz-share-accordion .custom-share-checkbox {
display: inline-block;
padding: 10px 0px;
}
.biz-share-accordion .custom-share-checkbox input {
padding: 0;
height: initial;
width: initial;
margin-bottom: 0;
display: none;
cursor: pointer;
}
.biz-share-accordion .custom-share-checkbox label {
display: flex;
align-items: center;
position: relative;
cursor: pointer;
margin-bottom: 0px;
font-size: 14px;
color: rgba(0,0,0,0.87);
}
.biz-share-accordion .custom-share-checkbox label:before {
content: '';
-webkit-appearance: none;
background-color: #1a73e8;
border: 2px solid #1a73e8;
border-radius: 2px;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), inset 0px -15px 10px -12px rgba(0, 0, 0, 0.05);
width: 18px;
height: 18px;
display: inline-block;
position: relative;
vertical-align: middle;
cursor: pointer;
margin-right: 10px;
}
.biz-share-accordion .custom-share-checkbox input:checked + label:after {
content: '';
display: block;
position: absolute;
top: 2px;
left: 6px;
width: 6px;
height: 14px;
border: solid #fff;
border-width: 0 2px 2px 0;
transform: rotate( 45deg);
}
.biz-share-accordion .custom-share-checkbox.unchecked label:before {
background-color: unset;
border-color: #5f6368;
}
.biz-share-accordion .user-owner {
padding-right: 20px;
}
.biz-share-accordion .external-dropdown {
position: relative
}
.biz-share-accordion .external-dropdown .dropdown, .biz-share-accordion .external-dropdown .dropup {
position: static;
}
.biz-share-accordion .external-dropdown .dropdown-menu {
left: 95%;
margin-top: 0;
}
.biz-share-accordion .permissionsMenu {
margin-top: 40px;
}
#select2-user_select2-results .select2-results__option[aria-selected=true] {
display: none;
}
.biz-share-accordion .activestate .btn-icon,
.biz-share-accordion .activestate a.bg-secondary:hover,
.biz-share-accordion .activestate button.bg-secondary:hover {
background-color: rgb(0, 109, 119) !important;
color: rgb(255, 255, 255) !important;
border-color: rgb(0, 109, 119) !important;
}
.biz-share-accordion .card-header .bg-secondary:hover {
background-color: #9e9e9e !important;
}
.biz-share-accordion .external-dropdown .avatar.avatar-sm {
width: 2.25rem;
height: 2.25rem;
}
.collapse-getlink .search-wrapper, #ul_link {
padding: 0 24px 20px 24px;
}
#txt_link {
height: 36px;
}
#txt_link:focus {
outline: none;
}
#collapse_getlink .people-list-item:hover .btn-icon {
background-color: #fff !important;
}
.biz-share-modal {
z-index: 1060;
}
#discardModal {
z-index: 1060;
}
.biz-share-accordion .people-select2-wrapper .select2-search input:active {
background-color: #f1f3f4 !important;
}
#collapseGetLinkBtn .get_link_icon {
transform: scaleX(-1);
}
#get-link-card .copy-link-btn:hover {
background-color: #EAF4FF;
}
.get-link-card-loader {
width: 98%;
margin: 0 auto;
border: 0 solid transparent;
position: relative;
padding: 1px;
border-radius: 10px;
}
.get-link-card-loader:before {
content: '';
background-color: lightgray;
position: absolute;
top: 0;
right: 0;
bottom: -2px;
left: 0;
border-radius: 10px;
}
.get-link-card-loader .get-link-card-loaderBar {
position: absolute;
padding: 2px;
top: 0;
right: 100%;
bottom: 0;
left: 0;
background: #298DFF;
width: 0;
animation: borealisBar 1s linear infinite;
}
@keyframes borealisBar {
0% {
left: 0%;
right: 100%;
width: 0%;
}
10% {
left: 0%;
right: 50%;
width: 50%;
}
90% {
right: 0%;
left: 50%;
width: 50%;
}
100% {
left: 100%;
right: 0%;
width: 0%;
}
}
@@ -0,0 +1,846 @@
var Unibase;
(function (Unibase) {
let Apps;
(function (Apps) {
let Collaboration;
(function (Collaboration) {
let Components;
(function (Components) {
let Sheets;
(function (Sheets) {
class Autofill {
constructor() {
this.hederText = {};
this.colType = { String: "string", Number: "number", Custom: "custom", Formula: "formula", Time: "time", LongDate: "longdate", ShortDate: "shortdate", Scientific: "scientific", Fraction: "fraction", Text: "text", General: "general", Accounting: "accounting", Currency: "currency", Percentage: "percentage", Date: "date", DateTime: "datetime" };
this.customList = [
["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
];
this.UC = {
uniqueOBracket: String.fromCharCode(129),
uniqueCBracket: String.fromCharCode(130),
uniqueCSeparator: String.fromCharCode(131),
uniqueCOperator: String.fromCharCode(132),
uniquePOperator: String.fromCharCode(133),
uniqueSOperator: String.fromCharCode(134),
uniqueMOperator: String.fromCharCode(135),
uniqueDOperator: String.fromCharCode(136),
uniqueModOperator: String.fromCharCode(137),
uniqueConcateOperator: String.fromCharCode(138),
uniqueEqualOperator: String.fromCharCode(139),
uniqueExpOperator: String.fromCharCode(140),
uniqueGTOperator: String.fromCharCode(141),
uniqueLTOperator: String.fromCharCode(142)
};
}
init(base) {
this.base = base;
this.ssObj = base.ssObj;
this.initProp();
}
initProp() {
this.beforeSelectFn = this.beforeSelect.bind(this);
this.base.ssObj.addEventListener("beforeSelect", this.beforeSelectFn);
this.selectFn = this.selected.bind(this);
this.base.ssObj.addEventListener("select", this.selectFn);
this.actionCompleteFn = this.updateAutofill.bind(this);
this.base.ssObj.addEventListener("actionComplete", this.actionCompleteFn);
this.createdFn = this.created.bind(this);
this.base.ssObj.addEventListener("created", this.createdFn);
this.dataBoundFn = this.dataBound.bind(this);
this.base.ssObj.addEventListener("dataBound", this.dataBoundFn);
this.cellEditFn = this.cellEdit.bind(this);
this.base.ssObj.addEventListener("cellEditing", this.cellEditFn);
this.cellSaveFn = this.cellSave.bind(this);
this.base.ssObj.addEventListener("cellSave", this.cellSaveFn);
this.base.ssObj.on("activeSheetChanged", this.updateAutofill, this);
this.base.ssObj.on("mouseDown", this.mouseDown, this);
}
destroy() {
this.base.ssObj.removeEventListener("beforeSelect", this.beforeSelectFn);
this.base.ssObj.removeEventListener("select", this.selectFn);
this.base.ssObj.removeEventListener("actionComplete", this.actionCompleteFn);
this.base.ssObj.removeEventListener("created", this.createdFn);
this.base.ssObj.removeEventListener("dataBound", this.dataBoundFn);
this.base.ssObj.removeEventListener("cellEditing", this.cellEditFn);
this.base.ssObj.removeEventListener("cellSave", this.cellSaveFn);
this.base.ssObj.off("activeSheetChanged", this.updateAutofill);
this.base.ssObj.on("mouseDown", this.mouseDown, this);
ej.base.EventHandler.remove(this.base.ssObj.element, 'mouseup', this.mouseUp);
ej.base.EventHandler.remove(this.base.ssObj.element, 'keydown', this.keypress);
ej.base.EventHandler.remove(this.base.ssObj.element, 'dblclick', this.dblClick);
}
cellEdit() {
this.hideAutofill();
}
cellSave() {
this.updateAutofill();
}
dataBound() {
this.updateAutofill();
}
createBorders() {
if (!this.base.ssObj.element.getElementsByClassName('biz-af-bdr')[0]) {
let content = this.base.ssObj.element.getElementsByClassName('e-sheet-content')[0];
this.bdrAF = content.appendChild(ej.base.createElement('div', { className: 'biz-af-bdr' }));
}
}
hideBorders() {
if (this.bdrAF) {
this.bdrAF.style.display = 'none';
}
}
showBorders() {
if (this.bdrAF) {
this.bdrAF.style.display = '';
}
}
updateBorderDirection(hideDirecton) {
this.bdrAF.style.borderRightWidth = '1px';
this.bdrAF.style.borderLeftWidth = '1px';
this.bdrAF.style.borderTopWidth = '1px';
this.bdrAF.style.borderBottomWidth = '1px';
this.bdrAF.style["border" + hideDirecton + "Width"] = '0px';
}
mouseDown(e) {
if (e.target.classList.contains('biz-autofill')) {
this.isDrag = true;
ej.base.EventHandler.add(this.base.ssObj.element, 'mousemove', this.mouseMoveHandler, this);
this.x = e.clientX;
this.y = e.clientY;
this.indexes = this.base.ssObj.biz.getIndexes();
this.createBorders();
let sel = this.base.ssObj.element.getElementsByClassName('e-selection')[0];
let activecell = this.base.ssObj.element.getElementsByClassName('e-active-cell')[0];
this.selection = sel.classList.contains('e-hide') ? activecell : sel;
this.selOffset = this.selection.getBoundingClientRect();
this.parentOffset = this.selection.offsetParent.getBoundingClientRect();
this.left = parseInt(this.selection.style.left);
this.top = parseInt(this.selection.style.top);
}
}
mouseUp(e) {
this.isDrag = false;
ej.base.EventHandler.remove(this.base.ssObj.element, 'mousemove', this.mouseMoveHandler);
if (this.direction != undefined) {
this.autoFill();
}
this.direction = undefined;
this.hideBorders();
this.isDragged = false;
this.prevTarget = undefined;
}
createAutofill() {
if (!this.base.ssObj.element.getElementsByClassName('biz-autofill')[0]) {
this.element = document.createElement('div');
this.element.classList.add('biz-autofill');
let content = this.base.ssObj.element.getElementsByClassName('e-sheet-content')[0];
content && content.appendChild(this.element);
}
this.element.classList.remove('biz-hide');
}
updateAutofill() {
if (!this.base.ssObj.isEdit) {
this.positionAutofill();
}
else {
this.hideAutofill();
}
}
dblClick() {
setTimeout(() => {
this.hideAutofill();
}, 1);
}
positionAutofill() {
setTimeout(() => {
this.createAutofill();
let selection = this.base.ssObj.element.getElementsByClassName('e-selection')[0];
let activecell = this.base.ssObj.element.getElementsByClassName('e-active-cell')[0];
if (selection && !selection.classList.contains('e-hide')) {
activecell = selection;
}
(this.element && activecell) && (this.element.style.top = parseInt(activecell.style.top) + parseInt(activecell.style.height) - 6 + 'px');
(this.element && activecell) && (this.element.style.left = parseInt(activecell.style.left) + parseInt(activecell.style.width) + -5 + 'px');
}, 10);
}
hideAutofill() {
let ele = this.base.ssObj.element.getElementsByClassName('biz-autofill')[0];
if (ele) {
ele.classList.add('biz-hide');
}
}
mouseMoveHandler(e) {
e.preventDefault();
let x = e.clientX;
let y = e.clientY;
if (e.target === this.prevTarget) {
return;
}
let tr = ej.base.closest(e.target, 'tr');
let td = ej.base.closest(e.target, '.e-cell');
if (!this.isDragged) {
this.showBorders();
}
this.isDragged = true;
if (!tr || !td) {
return;
}
let colIdx = parseInt(td.getAttribute('aria-colindex')) - 1;
let rowIdx = parseInt(tr.getAttribute('aria-rowindex')) - 1;
if (this.indexes[0] <= rowIdx && this.indexes[2] >= rowIdx && this.indexes[1] <= colIdx && this.indexes[3] >= colIdx) {
this.hideBorders();
return;
}
let tdOffset = td.getBoundingClientRect();
let px = 'px';
this.showBorders();
let sheet = this.base.ssObj.biz.getActiveSheet();
let freezeRow = this.base.ssObj.frozenRowCount(sheet);
let freezeCol = this.base.ssObj.frozenColCount(sheet);
let left;
let width;
let top;
let height;
switch (true) {
case this.indexes[3] < colIdx && this.indexes[0] - rowIdx < colIdx - this.indexes[3] && rowIdx - this.indexes[2] < colIdx - this.indexes[3]:
this.direction = "right";
left = this.left + this.selOffset.width;
width = ej.spreadsheet.getCellPosition(sheet, [rowIdx - 1, colIdx + 1], freezeRow, freezeCol).left - (this.left + this.selOffset.width);
this.updateBorderDirection('Left');
this.bdrAF.style.top = this.top + px;
this.bdrAF.style.left = left + px;
this.bdrAF.style.height = this.selOffset.height + px;
this.bdrAF.style.width = width + px;
this.fIndexes = [this.indexes[0], this.indexes[3] + 1, this.indexes[2], colIdx];
this.startCell = { rowIndex: this.indexes[0], colIndex: this.indexes[1] };
this.endCell = { rowIndex: this.indexes[2], colIndex: colIdx };
break;
case this.indexes[1] > colIdx && this.indexes[0] - rowIdx <= this.indexes[1] - colIdx && rowIdx - this.indexes[2] < this.indexes[1] - colIdx:
this.direction = "left";
left = ej.spreadsheet.getCellPosition(sheet, [rowIdx - 1, colIdx], freezeRow, freezeCol).left;
width = this.left - left;
this.updateBorderDirection('Right');
this.bdrAF.style.top = this.top + px;
this.bdrAF.style.left = left + px;
this.bdrAF.style.height = this.selOffset.height + px;
this.bdrAF.style.width = width + px;
this.fIndexes = [this.indexes[0], colIdx, this.indexes[2], this.indexes[3] - 1];
this.startCell = { rowIndex: this.indexes[0], colIndex: colIdx };
this.endCell = { rowIndex: this.indexes[2], colIndex: this.indexes[3] };
break;
case this.indexes[0] > rowIdx:
this.direction = "up";
top = ej.spreadsheet.getCellPosition(sheet, [rowIdx, colIdx - 1], freezeRow, freezeCol).top;
height = this.top - top;
this.updateBorderDirection('Bottom');
this.bdrAF.style.top = top + px;
this.bdrAF.style.left = this.left + px;
this.bdrAF.style.height = height + px;
this.bdrAF.style.width = this.selOffset.width + px;
this.fIndexes = [rowIdx, this.indexes[1], this.indexes[0] - 1, this.indexes[3]];
this.startCell = { rowIndex: rowIdx, colIndex: this.indexes[1] };
this.endCell = { rowIndex: this.indexes[2], colIndex: this.indexes[3] };
break;
case this.indexes[2] < rowIdx:
this.direction = "down";
top = this.top + this.selOffset.height;
height = ej.spreadsheet.getCellPosition(sheet, [rowIdx + 1, colIdx - 1], freezeRow, freezeCol).top - (this.top + this.selOffset.height);
this.updateBorderDirection('Top');
this.bdrAF.style.top = top + px;
this.bdrAF.style.left = this.left + px;
this.bdrAF.style.height = height + px;
this.bdrAF.style.width = this.selOffset.width + px;
this.fIndexes = [this.indexes[2] + 1, this.indexes[1], rowIdx, this.indexes[3]];
this.startCell = { rowIndex: this.indexes[0], colIndex: this.indexes[1] };
this.endCell = { rowIndex: rowIdx, colIndex: this.indexes[3] };
break;
default:
this.direction = undefined;
break;
}
this.prevTarget = e.target;
this.drawAutoFill(e);
}
drawAutoFill(e) {
}
selected(e) {
this.range = e.range;
this.updateAutofill();
}
beforeSelect(e) {
if (this.isDrag) {
e.cancel = true;
}
this.hideAutofill();
}
created() {
ej.base.EventHandler.add(this.base.ssObj.element, 'mouseup', this.mouseUp, this);
ej.base.EventHandler.add(this.base.ssObj.element, 'keydown', this.keypress, this);
ej.base.EventHandler.add(this.base.ssObj.element, 'dblclick', this.dblClick, this);
}
keypress() {
this.updateAutofill();
}
autoFill() {
let options = {};
let sheetIdx = this.base.getSheetIndex();
options.sheetIdx = sheetIdx;
options.dataRange = this.indexes;
options.fillRange = this.fIndexes;
this.base.ssObj.updateUndoRedoCollection({ name: 'bizAction', args: { action: 'autofill', options: options, direction: this.direction, oldCells: this.base.getCellsFromIndexes(options.fillRange) } });
this.applyValues(options);
this.base.ssObj.selectRange(this.base.generateHeaderText(this.startCell.colIndex + 1) + (this.startCell.rowIndex + 1) + ':' + this.base.generateHeaderText(this.endCell.colIndex + 1) + (this.endCell.rowIndex + 1));
let args = { action: "autofill" };
Unibase.Apps.Collaboration.Components.Common.Download.Instance().ssAutoSave(args, this.base, true);
this.updateAutofill();
}
applyAutofill(options, direction) {
this.direction = direction;
this.applyValues(options);
this.direction = undefined;
}
applyValues(options) {
let pos = { Down: 'down', Up: 'up', Left: 'left', Right: 'right' };
let val, plen, patterns, patrn, pRanges, patrnRange, fillRange, cellObjs, data, temp, dlen, j, k, l, tlen, tot, hasRef, format, formats, cells, clen, cellIdx, cellProps, i = 0, dataObj = {};
let drSR = options.dataRange[0];
let drSC = options.dataRange[1];
let drER = options.dataRange[2];
let drEC = options.dataRange[3];
let frSR = options.fillRange[0];
let frSC = options.fillRange[1];
let frER = options.fillRange[2];
let frEC = options.fillRange[3];
let isVFill = [pos.Down, pos.Up].indexOf(this.direction) > -1;
let isRFill = [pos.Up, pos.Left].indexOf(this.direction) > -1;
let sheet = this.base.ssObj.biz.getActiveSheet();
let len = isVFill ? drEC - drSC : drER - drSR;
while (i <= len) {
pRanges = this.updateFillValues(isVFill, drSR, drSC, drER, drEC, frSR, frSC, frER, frEC, i);
patrnRange = pRanges.patrnRange;
fillRange = pRanges.fillRange;
patterns = this.createPattern(patrnRange, { isRFill: isRFill, isVFill: isVFill });
cellObjs = this.getData(patrnRange);
data = this.getRawData(cellObjs);
dlen = data.length;
if (!patterns)
return;
plen = patterns.length;
cells = this.getSelectedRange({ rowIndex: fillRange[0], colIndex: fillRange[1] }, { rowIndex: fillRange[2], colIndex: fillRange[3] });
clen = cells.length;
if (isRFill) {
cells = cells.reverse();
patterns = patterns.reverse();
patterns = this.ensurePattern(patterns);
cellObjs = cellObjs.reverse();
data = data.reverse();
}
j = 0;
while (j < clen) {
dataObj = {};
cellIdx = cells[j];
patrn = patterns[j % plen];
if (this.isNumber(patrn))
patrn = patterns[patrn];
switch (patrn.type) {
case this.colType.Number:
val = this.round(patrn.regVal.a + (patrn.regVal.b * patrn.i), 5);
if (isRFill)
patrn.i--;
else
patrn.i++;
break;
case this.colType.String:
val = patrn.val[patrn.i % patrn.val.length];
patrn.i++;
break;
case this.colType.Formula:
hasRef = false;
val = "=";
k = 0;
tlen = patrn.val.length;
while (k < tlen) {
temp = patrn.val[k];
if (this.isObject(temp)) {
hasRef = true;
tot = this.round(temp.a + (temp.b * patrn.i), 0);
if (tot < 1)
val += "#REF!";
else
val += isVFill ? temp.c + (temp.b ? tot : '$' + tot) : (temp.b ? this.base.generateHeaderText(tot) : '$' + this.base.generateHeaderText(tot)) + temp.c;
}
else
val += temp;
k++;
}
if (hasRef && isRFill)
patrn.i--;
else
patrn.i++;
break;
case this.colType.Custom:
val = this.round(patrn.regVal.a + (patrn.regVal.b * patrn.i), 0);
if (val < 0)
val = (val % patrn.len) + patrn.len;
if (val >= patrn.len)
val = val % patrn.len;
val = patrn.val[val];
if (isRFill)
patrn.i--;
else
patrn.i++;
break;
}
l = j % dlen;
let cell = ej.spreadsheet.getCell(cellIdx.rowIndex, cellIdx.colIndex, sheet);
if (cellObjs[l]) {
cell = this.formObjFromValues(cellObjs[l], ['style', 'format', 'wrap', 'isLocked', 'validation', 'hyperlink',]);
cell['value'] = val;
}
else {
cell = {};
}
this.base.ssObj.biz.setCell(cellIdx.rowIndex, cellIdx.colIndex, sheet, cell);
if (cell.validation && cell.validation.isHighlighted) {
this.base.ssObj.addInvalidHighlight(this.base.generateHeaderText(cellIdx.colIndex + 1) + (cellIdx.rowIndex + 1));
}
j++;
}
i++;
}
let args = { options: options, direction: this.direction, action: 'autofill', origin: 'biz', sheetIndex: this.base.getSheetIndex() };
Unibase.Apps.Collaboration.Components.Sheets.Base.Instance().bizSignalr(args);
}
formObjFromValues(cellObj, props) {
let obj = {};
for (let i = 0; i < props.length; i++) {
if (cellObj[props[i]]) {
obj[props[i]] = cellObj[props[i]];
}
}
return obj;
}
updateFillValues(isVFill, drSR, drSC, drER, drEC, frSR, frSC, frER, frEC, i) {
let pStart, pEnd, fStart, fEnd, patrnRange, fillRange;
if (isVFill) {
pStart = { rowIndex: drSR, colIndex: drSC + i };
pEnd = { rowIndex: drER, colIndex: drSC + i };
fStart = { rowIndex: frSR, colIndex: frSC + i };
fEnd = { rowIndex: frER, colIndex: frSC + i };
}
else {
pStart = { rowIndex: drSR + i, colIndex: drSC };
pEnd = { rowIndex: drSR + i, colIndex: drEC };
fStart = { rowIndex: frSR + i, colIndex: frSC };
fEnd = { rowIndex: frSR + i, colIndex: frEC };
}
patrnRange = [pStart.rowIndex, pStart.colIndex, pEnd.rowIndex, pEnd.colIndex];
fillRange = [fStart.rowIndex, fStart.colIndex, fEnd.rowIndex, fEnd.colIndex];
return { patrnRange: patrnRange, fillRange: fillRange };
}
createPattern(range, options) {
let j, idx, temp, regVal, custColl, lCaseColl, lCaseVal, isLCase, diff, len, i = 0, pattern = [];
let patrns = this.createDataPattern(range);
let plen = patrns.length;
let patrn;
if (patrns) {
while (i < plen) {
patrn = patrns[i];
switch (patrn.type) {
case this.colType.Number:
idx = pattern.length;
len = patrn.val.length;
diff = options.isRFill ? -1 : len;
if (len === 1)
patrn.val.push(patrn.val[0] + 1);
regVal = this.getPredictionValue(patrn.val);
temp = { regVal: regVal, type: patrn.type, i: diff };
pattern.push(temp);
j = 1;
while (j < len) {
pattern.push(idx);
j++;
}
break;
case this.colType.String:
idx = pattern.length;
temp = { val: patrn.val, type: patrn.type, i: 0 };
pattern.push(temp);
j = 1;
len = patrn.val.length;
while (j < len) {
pattern.push(idx);
j++;
}
break;
case this.colType.Formula:
len = patrn.val.length;
patrn = this.createFormulaPattern(patrn.val, options);
diff = options.isRFill ? -1 : len;
if (patrn.isInPattern) {
idx = pattern.length;
temp = { val: patrn.val, type: this.colType.Formula, i: diff };
pattern.push(temp);
j = 1;
while (j < len) {
pattern.push(idx);
j++;
}
}
else {
j = 0;
diff = options.isRFill ? -1 : 1;
while (j < len) {
pattern.push({ val: patrn.val[j], type: this.colType.Formula, i: diff });
j++;
}
}
break;
}
i++;
}
return pattern;
}
}
createDataPattern(range) {
let val, type, i = 0;
let obj = {};
let patrn = [];
let cellObjs;
cellObjs = this.getData(range);
let data = this.getRawData(cellObjs);
let dlen = data.length;
if (dlen) {
while (i < dlen) {
val = data[i];
type = this.getType(val);
if (i === 0)
obj = { val: [val], type: type };
else if (type === obj.type)
obj.val.push(val);
else {
patrn.push(obj);
obj = { val: [val], type: type };
}
i++;
}
patrn.push(obj);
return patrn;
}
}
createFormulaPattern(data, options) {
let patrn, j, temp, isInPatrn, patrns = [], i = 0, len = data.length, cRfrType;
while (i < len) {
patrns.push(this.parseFormula(data[i]));
i++;
}
isInPatrn = this.isInPattern(patrns, options.isVFill);
if (isInPatrn) {
patrn = patrns[0];
i = patrn.length;
while (i--) {
temp = patrn[i];
cRfrType = this.isCellReference(temp);
if (cRfrType && (cRfrType !== "absolute"))
patrn[i] = this.getCellRefPrediction(temp, options, null, cRfrType);
}
return { isInPattern: isInPatrn, val: patrn };
}
else {
i = 0;
while (i < len) {
patrn = patrns[i];
j = patrn.length;
while (j--) {
temp = patrn[j];
cRfrType = this.isCellReference(temp);
if (cRfrType && (cRfrType !== "absolute"))
patrns[i][j] = this.getCellRefPrediction(temp, options, len, cRfrType);
}
i++;
}
return { isInPattern: isInPatrn, val: patrns };
}
}
parseFormula(formula) {
var temp, str, len, i = 0, arr = [];
formula = this.markSpecialChar(formula.replace("=", ""));
formula = formula.split(/\(|\)|=|\^|>|<|,|:|\+|-|\*|\/|%|&/g);
len = formula.length;
while (i < len) {
temp = formula[i];
if (!temp) {
i++;
continue;
}
if (temp.length === 1)
arr.push(this.isUniqueChar(temp) ? this.getUniqueCharVal(temp) : temp);
else {
str = temp[0];
if (temp.indexOf('!') > 0) {
if (this.isUniqueChar(str)) {
arr.push(this.getUniqueCharVal(str));
temp = temp.substr(1);
}
str = temp.indexOf('!') + 1;
arr.push(temp.substr(0, str));
arr.push(temp.substr(str));
}
else if (this.isUniqueChar(str)) {
arr.push(this.getUniqueCharVal(str));
arr.push(temp.substr(1));
}
else
arr.push(temp);
}
i++;
}
return arr;
}
getUniqueCharVal(str) {
switch (str) {
case this.UC.uniqueOBracket:
return "(";
case this.UC.uniqueCBracket:
return ")";
case this.UC.uniqueCSeparator:
return ",";
case this.UC.uniqueCOperator:
return ':';
case this.UC.uniquePOperator:
return "+";
case this.UC.uniqueSOperator:
return "-";
case this.UC.uniqueMOperator:
return "*";
case this.UC.uniqueDOperator:
return "/";
case this.UC.uniqueModOperator:
return "%";
case this.UC.uniqueConcateOperator:
return "&";
case this.UC.uniqueEqualOperator:
return "=";
case this.UC.uniqueExpOperator:
return "^";
case this.UC.uniqueGTOperator:
return ">";
case this.UC.uniqueLTOperator:
return "<";
}
return "";
}
isUniqueChar(str) {
var code = str.charCodeAt(str);
return code >= 129 && code <= 142;
}
markSpecialChar(formula) {
formula = formula.replace(/\(/g, "(" + this.UC.uniqueOBracket).replace(/\)/g, ")" + this.UC.uniqueCBracket);
formula = formula.replace(/,/g, "," + this.UC.uniqueCSeparator).replace(/:/g, ":" + this.UC.uniqueCOperator);
formula = formula.replace(/\+/g, "+" + this.UC.uniquePOperator).replace(/-/g, "-" + this.UC.uniqueSOperator);
formula = formula.replace(/\*/g, "*" + this.UC.uniqueMOperator).replace(/\//g, "/" + this.UC.uniqueDOperator);
formula = formula.replace(/&/g, "&" + this.UC.uniqueConcateOperator);
formula = formula.replace(/=/g, "=" + this.UC.uniqueEqualOperator);
formula = formula.replace(/\^/g, "^" + this.UC.uniqueExpOperator);
formula = formula.replace(/>/g, ">" + this.UC.uniqueGTOperator).replace(/</g, "<" + this.UC.uniqueLTOperator);
return formula.replace(/%/g, "%" + this.UC.uniqueModOperator);
}
isInPattern(patrn, isVFill) {
var oldPatrn, olen, newPatrn, nlen, oldStr, newStr, oldInt, newInt, eStr = "", i = 0, j = 1, plen = patrn.length, nregx = new RegExp("[0-9$]", "g"), aregx = new RegExp("[a-z$]", "gi");
if (plen === 1)
return false;
while (j < plen) {
oldPatrn = patrn[i];
newPatrn = patrn[j];
olen = oldPatrn.length;
nlen = newPatrn.length;
if (olen !== nlen)
return false;
else {
while (olen--) {
oldStr = oldPatrn[olen];
newStr = newPatrn[olen];
if (this.isCellReference(oldStr) === this.isCellReference(newStr)) {
if (isVFill) {
oldInt = Number(oldStr.replace(aregx, eStr));
newInt = Number(newStr.replace(aregx, eStr));
}
else {
oldInt = this.generateColCount(oldStr.replace(nregx, eStr));
newInt = this.generateColCount(newStr.replace(nregx, eStr));
}
if (oldInt !== newInt - 1)
return false;
}
else if (oldStr !== newStr)
return false;
}
}
i++;
j++;
}
return true;
}
generateColCount(text) {
var colCount = 0;
text = text.split('').reverse().join('');
for (var i = text.length - 1; i >= 0; i--) {
colCount += (text[i].charCodeAt(text[i]) - 64) * (Math.pow(26, i));
}
return colCount;
}
getData(range) {
let sheet = this.base.ssObj.biz.getActiveSheet();
let data = [];
let obj;
let newRange = this.base.swapRange(range);
for (let i = newRange[0]; i <= newRange[2]; i++) {
for (let j = newRange[1]; j <= newRange[3]; j++) {
obj = sheet.rows[i] ? sheet.rows[i].cells[j] : undefined;
data.push(obj);
}
}
return data;
}
getRawData(arr) {
let len = arr.length;
let newArr = [];
for (let i = 0; i < len; i++) {
if (!arr[i] || !arr[i].value || arr[i].value.length === 0) {
newArr.push('');
}
else if (arr[i].formula) {
newArr.push(arr[i].formula);
}
else if (arr[i].value) {
newArr.push(arr[i].value);
}
}
return newArr;
}
isCellReference(text) {
return /^[a-z]{1,3}\d{1,7}$/gi.test(text) ? "relative" : (/^\$[a-z]{1,3}\$\d{1,7}$/gi.test(text) ? "absolute" : (/^((\$[a-z]{1,3})\d{1,7}|[a-z]{1,3}(\$\d{1,7}))$/gi.test(text) ? "mixed" : false));
}
getCellRefPrediction(text, options, length, rfrType) {
text = text.toUpperCase();
var eStr = "", aRegx = new RegExp("[a-z$]", "gi"), nRegx = new RegExp("[0-9$]", "g"), str = options.isVFill ? text.replace(nRegx, eStr) : text.replace(aRegx, eStr);
let temp = options.isVFill ? Number(text.replace(aRegx, eStr)) : this.generateColCount(text.replace(nRegx, eStr)), arr = [temp], isColAbslt = text[0] === '$';
if (length && length !== 1)
arr.push(temp + length);
else
arr.push(temp + 1);
temp = this.getPredictionValue(arr);
if (rfrType && (rfrType === "mixed")) {
if (isColAbslt === options.isVFill)
str = '$' + str;
else
temp.b = 0;
}
temp.c = str;
return temp;
}
getType(val) {
let type1;
let type = this.isCustomType(val);
if (type)
type1 = type;
else if (this.isFormula(val))
type1 = this.colType.Formula;
else if (this.isNumber(val))
type1 = this.colType.Number;
return type1 || this.colType.String;
}
isCustomType(val) {
val = val + "";
val = val.toLowerCase();
let i = this.customList.length;
while (i--) {
if (this.toArrayLowerCase(this.customList[i].slice(0)).indexOf(val) > -1)
return this.colType.Custom + i;
}
return false;
}
toArrayLowerCase(args) {
for (let i = 0; i < args.length; i++)
args[i] = args[i].toString().toLowerCase();
return args;
}
isFormula(formula) {
let obrackets, cbrackets;
if (formula) {
if (!formula.toString().indexOf("=") && formula.length > 1) {
obrackets = formula.split("(").length - 1;
cbrackets = formula.split(")").length - 1;
return obrackets === cbrackets;
}
}
return false;
}
isNumber(val) {
return val - parseFloat(val) >= 0;
}
round(val, digits) {
let str = val + 'e' + digits;
let str1 = 'e-' + digits;
return Number(Math.round(str) + str1);
}
getPredictionValue(args) {
let i = 0, sumx = 0, sumy = 0, sumxy = 0, sumxx = 0, n = args.length;
while (i < n) {
sumx = sumx + i;
sumy = sumy + Number(args[i]);
sumxy = sumxy + (i * Number(args[i]));
sumxx = sumxx + (i * i);
i++;
}
let a = this.round(((sumy * sumxx) - (sumx * sumxy)) / ((n * sumxx) - (sumx * sumx)), 5), b = this.round(((n * sumxy) - (sumx * sumy)) / ((n * sumxx) - (sumx * sumx)), 5);
return { a: a, b: b };
}
ensurePattern(patterns) {
let patrn, idx = -1, i = patterns.length;
while (i--) {
patrn = patterns[i];
if (this.isObject(patrn)) {
idx = i;
if (patrn.type === this.colType.String)
patrn.val = patrn.val.reverse();
}
else
patterns[i] = idx;
}
return patterns;
}
isObject(obj) {
if (typeof obj !== "object")
return false;
return Object.prototype.toString.call(obj) === "[object Object]";
}
getSelectedRange(startcell, endcell) {
let i, j, k, l, arr = [], range = this.base.swapRange([startcell.rowIndex, startcell.colIndex, endcell.rowIndex, endcell.colIndex]);
i = range[0], j = range[2];
while (i <= j) {
k = range[1];
l = range[3];
while (k <= l) {
arr.push({ rowIndex: i, colIndex: k });
k++;
}
i++;
}
return arr;
}
static Instance() {
if (this.instance === undefined) {
this.instance = new Autofill();
}
return this.instance;
}
}
Sheets.Autofill = Autofill;
})(Sheets = Components.Sheets || (Components.Sheets = {}));
})(Components = Collaboration.Components || (Collaboration.Components = {}));
})(Collaboration = Apps.Collaboration || (Apps.Collaboration = {}));
})(Apps = Unibase.Apps || (Unibase.Apps = {}));
})(Unibase || (Unibase = {}));
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,489 @@
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var Unibase;
(function (Unibase) {
let Apps;
(function (Apps) {
let Collaboration;
(function (Collaboration) {
let Components;
(function (Components) {
let Sheets;
(function (Sheets) {
class Dialogue {
constructor() {
this.hederText = {};
this.hasHeader = false;
}
init(base) {
this.base = base;
this.base.mouseDownHandlers.push(this.mouseDown.bind(this));
this.util = Unibase.Apps.Collaboration.Components.Common.Util.Instance();
}
mouseDown(e) {
if (this.rdDailouge) {
let cbox = ej.base.closest(e.target, '.e-checkbox-wrapper');
if (cbox) {
let tickicon = cbox.firstElementChild;
tickicon.classList.contains('e-check') ? tickicon.classList.remove('e-check') : tickicon.classList.add('e-check');
if (cbox.classList.contains('rd-selectAll')) {
var cboxes = this.rdDailouge.element.querySelector('#rd-checkboxes-container').querySelectorAll('.e-frame');
if (cbox.firstElementChild.classList.contains('e-check')) {
cbox.firstElementChild.classList.remove('e-stop');
cboxes.forEach((e) => { e.classList.add('e-check'); });
document.getElementsByClassName("rd-btn")[0].classList.remove("e-disabled");
document.getElementsByClassName("rd-btn")[0].removeAttribute("disabled");
}
else {
cbox.firstElementChild.classList.add('e-stop');
cboxes.forEach((e) => { e.classList.remove('e-check'); });
document.getElementsByClassName("rd-btn")[0].classList.add("e-disabled");
document.getElementsByClassName("rd-btn")[0].setAttribute("disabled", "true");
}
}
if (cbox.classList.contains('rd-colCheckbox')) {
var cboxes = this.rdDailouge.element.querySelector('#rd-checkboxes').querySelectorAll('.e-frame');
var eCheckCount = this.rdDailouge.element.querySelector('#rd-checkboxes').querySelectorAll('.e-check').length;
eCheckCount === 0 ? (document.getElementsByClassName("rd-btn")[0].classList.add("e-disabled"),
document.getElementsByClassName("rd-btn")[0].setAttribute("disabled", "true")) :
(document.getElementsByClassName("rd-btn")[0].removeAttribute("disabled"),
document.getElementsByClassName("rd-btn")[0].classList.remove("e-disabled"));
eCheckCount < cboxes.length ?
(document.getElementsByClassName("rd-selectAll")[0].firstElementChild.classList.remove("e-check"),
document.getElementsByClassName("rd-selectAll")[0].firstElementChild.classList.add("e-stop")) :
(document.getElementsByClassName("rd-selectAll")[0].firstElementChild.classList.add("e-check"),
document.getElementsByClassName("rd-selectAll")[0].firstElementChild.classList.remove("e-stop"));
}
}
}
}
removeDuplicate(range, header, colSelected) {
this.obj = {};
let sheet = this.base.ssObj.biz.getActiveSheet();
this.rngIndexes = this.base.getIndexesFromAddress(range);
this.hasHeader = header;
(header) ? this.rowStartCell = this.rngIndexes[0] + 1 : this.rowStartCell = this.rngIndexes[0];
this.columnStartCell = this.rngIndexes[1];
this.rowEndCell = this.rngIndexes[2];
this.columnEndCell = this.rngIndexes[3];
this.selected = colSelected;
for (let i = this.rowStartCell; i <= this.rowEndCell; i++) {
let wholeRow = [];
for (let j = this.columnStartCell; j <= this.columnEndCell; j++) {
if (this.selected[j] == undefined) {
var isColChecked = document.querySelector("#rd-checkboxes").querySelector('div[value="' + j + '"]').firstElementChild.classList.contains('e-check');
this.selected[j] = isColChecked;
}
if (!this.selected[j]) {
continue;
}
let cellInfo = ej.spreadsheet.getCell(i, j, sheet);
if (!cellInfo) {
wholeRow.push(null);
}
else {
wholeRow.push(this.util.getCellValues(cellInfo));
}
if (cellInfo) {
this.base.ssObj.biz.setCell(i, j, sheet, {});
delete sheet.rows[i].cells[j];
}
}
if (wholeRow) {
this.addToObj(JSON.stringify(wholeRow));
}
}
var k = 0;
var cellValue;
var keys = Object.keys(this.obj);
for (let i = this.rowStartCell; i <= this.rowEndCell; i++) {
var row;
(keys[k]) ? row = JSON.parse(keys[k]) : row = undefined;
var l = 0;
for (let j = this.columnStartCell; j <= this.columnEndCell; j++) {
if (!this.selected[j]) {
continue;
}
(row) ? cellValue = row[l] : cellValue = undefined;
if (cellValue) {
if (!(cellValue.value === undefined)) {
this.base.ssObj.biz.setCell(i, j, sheet, cellValue);
}
}
l++;
}
k++;
}
var duplicateCount = this.selectedRow - Object.keys(this.obj).length;
Unibase.Apps.Collaboration.Components.Common.Download.Instance().ssAutoSave({ action: 'removeDuplicates' }, this.base, true);
if (this.base.getSheetIndex() >= 0) {
if (!this.hasHeader) {
this.base.ssObj.selectRange(this.base.generateHeaderText(this.columnStartCell + 1) + (this.rowStartCell + 1) + ":" + this.base.generateHeaderText(this.columnEndCell + 1) + (this.rowEndCell - duplicateCount + 1));
}
else {
this.base.ssObj.selectRange(this.base.generateHeaderText(this.columnStartCell + 1) + (this.rowStartCell) + ":" + this.base.generateHeaderText(this.columnEndCell + 1) + (this.rowEndCell - duplicateCount + 2));
}
}
this.rdDailouge.destroy();
}
RDshowUniqueDailog() {
var keys = Object.keys(this.obj);
var duplicateCount;
this.hasHeader ? duplicateCount = this.selectedRow - keys.length - 1 : duplicateCount = this.selectedRow - keys.length;
if (duplicateCount == 0) {
var duplicateValuesText = "No duplicate rows were found.";
}
else if (duplicateCount == 1) {
var duplicateValuesText = "1 duplicate row were found and removed.";
}
else {
var duplicateValuesText = `${duplicateCount} duplicate rows were found and removed.`;
}
if (keys.length == 1) {
var uniqueValuesText = `1 unique row remains.`;
}
else {
var uniqueValuesText = `${keys.length} unique rows remains.`;
}
this.rdDailouge = new ej.popups.Dialog({
isModal: true,
header: 'Remove Duplicates',
content: `<div id='removedup-container'>
<div id='rd-duplicatevaluetxt'></div>
<br/>
<div id='rd-uniquevaluetxt'></div>
</div>`,
width: '470px',
height: '180px',
buttons: [{
click: this.hideRdDailouge.bind(this),
buttonModel: { content: 'Ok', isPrimary: true }
}]
});
this.rdDailouge.appendTo("#removeduplicates");
document.getElementById("rd-duplicatevaluetxt").append(duplicateValuesText);
document.getElementById("rd-uniquevaluetxt").append(uniqueValuesText);
}
;
addToObj(param) {
if (!this.obj[param]) {
this.obj[param] = 1;
}
}
renderDuplicateDailouge() {
this.range = this.base.ssObj.biz.getRange();
this.rngIndexes = this.base.getIndexesFromAddress(this.range);
this.selectedCol = this.rngIndexes[3] - this.rngIndexes[1] + 1;
this.selectedRow = this.rngIndexes[2] - this.rngIndexes[0] + 1;
this.rowStartCell = this.rngIndexes[0];
this.columnStartCell = this.rngIndexes[1];
this.rowEndCell = this.rngIndexes[2];
this.columnEndCell = this.rngIndexes[3];
if (!(this.rowStartCell - this.rowEndCell == 0 && this.columnStartCell - this.columnEndCell == 0)) {
if (this.selectedCol > 1 && this.selectedRow > 1) {
var selectedcolrowtext = `${this.selectedCol} columns and ${this.selectedRow} rows selected`;
}
else if (this.selectedCol > 1 && this.selectedRow == 1) {
var selectedcolrowtext = `${this.selectedCol} columns and ${this.selectedRow} row selected`;
}
else if (this.selectedCol == 1 && this.selectedRow > 1) {
var selectedcolrowtext = `${this.selectedCol} column and ${this.selectedRow} rows selected`;
}
var checkboxes = [];
if (this.selectedCol > 0) {
for (let i = this.columnStartCell; i <= this.columnEndCell; i++) {
var colName = this.base.generateHeaderText(i + 1);
var cbox = ej.buttons.createCheckBox(this.base.ssObj.createElement, false, { checked: true, label: 'Columns ' + colName, cssClass: 'rd-colCheckbox' });
cbox.setAttribute('value', i);
checkboxes.push(cbox);
}
}
var elem = document.getElementById("removedup-container");
if (!elem) {
var hasHeader = ej.buttons.createCheckBox(this.base.ssObj.createElement, false, { checked: false, cssClass: 'rd-hasHeader' });
var selectAll = ej.buttons.createCheckBox(this.base.ssObj.createElement, false, { checked: true, label: 'Select all', cssClass: 'rd-selectAll' });
this.rdDailouge = new ej.popups.Dialog({
isModal: true,
header: 'Remove Duplicates',
content: `<div id='removedup-container'>
<div id='rd-selectedColumns-container'>
<div id="rd-selectedColumns-title-data"></div>
<div id="rd-hasHeader-checkbox"></div>
<span id="rd-hasHeader-content">Data has header row</span>
</div>
<div id="rd-selectedColumns-info-wrapper">
<div id="rd-selectedColumns-info-analyze">Select Columns to analyze</div>
<div id="rd-checkboxes-container">
<div id="rd-selectAll"> </div>
<div id="rd-checkboxes"></div>
</div></div>
</div>`,
showCloseIcon: false,
created: () => {
document.getElementById("rd-hasHeader-checkbox").appendChild(hasHeader);
document.getElementById("rd-selectAll").appendChild(selectAll);
document.getElementById("rd-selectedColumns-title-data").append(selectedcolrowtext);
checkboxes.forEach(element => {
document.getElementById("rd-checkboxes").appendChild(element);
});
setTimeout(() => {
if (document.getElementById("rd-checkboxes-container").offsetHeight < 250) {
document.getElementById("rd-checkboxes-container").style.overflowY = 'hidden';
}
else {
document.getElementById("rd-checkboxes").style.overflowY = "";
}
}, 0);
},
open: () => {
},
width: '350px',
height: 'auto',
closeOnEscape: false,
buttons: [{
click: this.hideRdDailouge.bind(this),
buttonModel: { content: 'Cancel' }
},
{
click: this.processDup.bind(this),
buttonModel: { content: 'Remove Duplicates', isPrimary: true, cssClass: "rd-btn" }
}],
});
this.rdDailouge.appendTo("#removeduplicates");
}
else {
document.getElementById("rd-selectedColumns-title-data").innerHTML = "";
document.getElementById("rd-selectedColumns-title-data").innerHTML = selectedcolrowtext;
this.rdDailouge.show();
}
}
else {
this.rdDailouge = new ej.popups.Dialog({
isModal: true,
header: 'Remove Duplicates',
content: `<div id='removedup-container'>Please select a range of cells containing values.</div>`,
width: '470px',
height: '130px',
created: () => {
document.getElementById("removeduplicates_dialog-content").style.overflowY = 'hidden';
},
buttons: [{
click: this.hideRdDailouge.bind(this),
buttonModel: { content: 'Ok', isPrimary: true }
}]
});
this.rdDailouge.appendTo("#removeduplicates");
}
}
hideRdDailouge() {
this.rdDailouge.element.removeEventListener("mousedown", (e) => { });
this.rdDailouge.hide();
this.rdDailouge.destroy();
}
processDup() {
let header = false;
if (document.getElementsByClassName("rd-hasHeader")[0].firstElementChild.classList.contains("e-check")) {
header = true;
}
let range = this.base.ssObj.biz.getRange();
let indexes = this.base.ssObj.biz.getIndexes();
let args = { range: range, indexes: indexes, sheetIndex: this.base.getSheetIndex(), header: header, action: 'removeDuplicates', origin: 'biz' };
this.base.ssObj.updateUndoRedoCollection({ name: 'bizAction', args: { action: 'removeDuplicates', options: args, oldCells: this.base.getCellsFromIndexes(indexes) } });
this.removeDuplicate(range, header, {});
this.base.removeCopyIndicator();
args['colSelected'] = this.selected;
this.RDshowUniqueDailog();
Unibase.Apps.Collaboration.Components.Sheets.Base.Instance().bizSignalr(args);
}
renderMenubarFullscreenDialog() {
if (!this.menubarFullscreenDialogObj) {
this.menubarFullscreenDialogObj = new ej.popups.Dialog({
content: `<div id='menubar-fullscreen-container'>
<div id='menubar-fullscreenf11-message'>
Press <span class= "menubar-esc">Esc</span> to exit full screen <span class="biz-ss-menubarfullscreen-dismiss"> Dismiss </span></div>
</div>`,
width: '470px',
height: '45px',
position: { X: 'center', Y: 14 },
animationSettings: { effect: 'None' },
closeOnEscape: true,
cssClass: "biz-ss-menubar-fullscreen",
Close: this.hideSsMenubarFullscreenDialog.bind(this),
});
this.menubarFullscreenDialogObj.appendTo("#biz-ss-menubar-fullscreendialog");
}
else {
this.menubarFullscreenDialogObj.show();
}
}
hideSsMenubarFullscreenDialog() {
this.menubarFullscreenDialogObj.destroy();
if (document.getElementById("menubar-fullscreen-container"))
document.getElementById("menubar-fullscreen-container").parentElement.remove();
setTimeout(() => {
this.menubarFullscreenDialogObj = null;
}, 1000);
}
renderResizeDialog() {
let sheet = this.base.ssObj.biz.getActiveSheet();
let indexes = this.base.ssObj.biz.getIndexes();
let isRowsSelected = this.base.ssObj.biz.isRowsSelected(indexes);
let row = (indexes[2] - indexes[0] + 1);
let col = (indexes[3] - indexes[1] + 1);
let heading = "";
let radio1Text = "";
let inputValue;
if (isRowsSelected) {
if (row == 1)
heading = "Resize row " + (indexes[0] + 1);
else
heading = "Resize rows " + (indexes[0] + 1) + " - " + (indexes[2] + 1);
radio1Text = "Specify row height in pixels: (Default 18)";
inputValue = sheet.rows[indexes[0]] && sheet.rows[indexes[0]].height || 18.5;
}
else {
if (col == 1)
heading = "Resize column " + (this.base.generateHeaderText(indexes[0] + 1));
else
heading = "Resize columns " + this.base.generateHeaderText(indexes[1] + 1) + " - " + this.base.generateHeaderText(indexes[3] + 1);
radio1Text = "Specify column width in pixels: (Default 64)";
inputValue = sheet.columns[indexes[1]] && sheet.columns[indexes[1]].width || 64;
}
if (inputValue == undefined)
inputValue = '';
this.radiobutton = new ej.buttons.RadioButton({ label: radio1Text, name: 'resizetofit', checked: true, value: "resizeroworcol" });
this.resizeDialogObj = new ej.popups.Dialog({
content: `<div id='resize-dialog-container'>
<div id='resize-dialog-content'>
<ul>
<li><input type="radio" id="header-checkbox"></li>
<div class="e-input-group resize-input-div">
<input class="e-input" name='input' type="text" value="${inputValue}" id="resize-input" />
</div>
<li><input type="radio" id="resizetofit-checkbox"></li>
</ul>
</div>
</div>`,
width: '470px',
height: 'auto',
header: heading,
animationSettings: { effect: 'None' },
showCloseIcon: true,
closeOnEscape: true,
target: document.body.querySelectorAll('._bizgaze_popup_container')[document.body.querySelectorAll('._bizgaze_popup_container').length - 1],
created: this.resizeDialogCreated.bind(this),
cssClass: "biz-ss-resizetofit",
buttons: [
{
click: this.hideResizeDialog.bind(this),
buttonModel: { content: 'Cancel' }
},
{
click: this.processResize.bind(this),
buttonModel: { content: 'Ok', isPrimary: true }
}
],
Close: this.hideResizeDialog.bind(this),
});
this.resizeDialogObj.appendTo("#biz-ss-resizetofit-dialog");
}
resizeDialogCreated() {
this.radiobutton.appendTo('#header-checkbox');
this.radiobutton = new ej.buttons.RadioButton({ label: 'Resize to fit', name: 'resizetofit', value: "resizetofit" });
this.radiobutton.appendTo('#resizetofit-checkbox');
document.getElementsByClassName("biz-ss-resizetofit")[0].style.maxHeight = "";
}
hideResizeDialog() {
if (this.resizeDialogObj) {
this.resizeDialogObj.destroy();
setTimeout(() => {
this.resizeDialogObj = null;
});
}
}
processResize() {
return __awaiter(this, void 0, void 0, function* () {
let range = this.base.ssObj.biz.getRange();
let resizedHeaders = [];
let changedValues = [];
let resizeValue = Number(document.getElementById("resize-input").value);
let ranges = range.split(" ");
for (var i = 0; i < ranges.length; i++) {
let currentIndexes = this.base.swapRange(ej.spreadsheet.getIndexesFromAddress(ranges[i]));
yield this.resizeHeaders(currentIndexes, resizeValue, ranges[i]).then((response) => {
changedValues = changedValues.concat(response.changedValues);
resizedHeaders = resizedHeaders.concat(response.resizedHeaders);
});
}
this.hideResizeDialog();
this.base.focusDocumentViewer();
(changedValues.length > 0) && this.base.download.ssAutoSave({ action: "imageincell", changedValues: changedValues }, this.base, true);
(resizedHeaders.length > 0) && this.base.download.ssAutoSave({ action: "headerResize", resizedHeaders: resizedHeaders }, this.base, true);
});
}
resizeHeaders(indexes, resizeValue, range) {
return __awaiter(this, void 0, void 0, function* () {
let resizedHeaders = [];
let changedValues = [];
let sheetIdx = this.base.getSheetIndex();
let isRowsSelected = this.base.ssObj.biz.isRowsSelected(indexes);
let selectedRadio = document.querySelector('input[name="resizetofit"]:checked').value;
if (selectedRadio == "resizeroworcol") {
if (isRowsSelected) {
for (var i = indexes[0]; i <= indexes[2]; i++) {
yield this.setRowHeight(resizeValue, i);
resizedHeaders.push({ rowIndex: i, height: resizeValue, sheetIndex: sheetIdx, resizeType: "row" });
}
changedValues = changedValues.concat(this.base.setRowIncellImageSize(range));
}
else {
for (var i = indexes[1]; i <= indexes[3]; i++) {
yield this.setColWidth(resizeValue, i);
resizedHeaders.push({ colIndex: i, width: resizeValue, sheetIndex: sheetIdx, resizeType: "col" });
}
changedValues = changedValues.concat(this.base.setColumnIncellImageSize(range));
}
}
else {
this.base.ssObj.autoFit(range);
if (isRowsSelected)
changedValues = changedValues.concat(this.base.setRowIncellImageSize(range));
else
changedValues = changedValues.concat(this.base.setColumnIncellImageSize(range));
}
return {
changedValues: changedValues, resizedHeaders: resizedHeaders
};
});
}
setRowHeight(resizeValue, rowIdx) {
return __awaiter(this, void 0, void 0, function* () {
yield this.base.ssObj.setRowHeight(resizeValue + "px", rowIdx);
});
}
setColWidth(resizeValue, colIdx) {
return __awaiter(this, void 0, void 0, function* () {
yield this.base.ssObj.setColWidth(resizeValue + "px", colIdx);
});
}
static Instance() {
if (this.instance === undefined) {
this.instance = new Dialogue();
}
return this.instance;
}
}
Sheets.Dialogue = Dialogue;
})(Sheets = Components.Sheets || (Components.Sheets = {}));
})(Components = Collaboration.Components || (Collaboration.Components = {}));
})(Collaboration = Apps.Collaboration || (Apps.Collaboration = {}));
})(Apps = Unibase.Apps || (Unibase.Apps = {}));
})(Unibase || (Unibase = {}));
File diff suppressed because one or more lines are too long
+31
View File
@@ -0,0 +1,31 @@
var __awaiter=this&&this.__awaiter||function(n,t,i,r){function u(n){return n instanceof i?n:new i(function(t){t(n)})}return new(i||(i=Promise))(function(i,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?i(n.value):u(n.value).then(o,s)}e((r=r.apply(n,t||[])).next())})},Unibase;(function(n){let t;(function(t){let i;(function(t){let i;(function(t){let i;(function(t){class i{constructor(){this.hederText={};this.hasHeader=!1}init(t){this.base=t;this.base.mouseDownHandlers.push(this.mouseDown.bind(this));this.util=n.Apps.Collaboration.Components.Common.Util.Instance()}mouseDown(n){var t,i;if(this.rdDailouge){let r=ej.base.closest(n.target,".e-checkbox-wrapper");if(r){let n=r.firstElementChild;n.classList.contains("e-check")?n.classList.remove("e-check"):n.classList.add("e-check");r.classList.contains("rd-selectAll")&&(t=this.rdDailouge.element.querySelector("#rd-checkboxes-container").querySelectorAll(".e-frame"),r.firstElementChild.classList.contains("e-check")?(r.firstElementChild.classList.remove("e-stop"),t.forEach(n=>{n.classList.add("e-check")}),document.getElementsByClassName("rd-btn")[0].classList.remove("e-disabled"),document.getElementsByClassName("rd-btn")[0].removeAttribute("disabled")):(r.firstElementChild.classList.add("e-stop"),t.forEach(n=>{n.classList.remove("e-check")}),document.getElementsByClassName("rd-btn")[0].classList.add("e-disabled"),document.getElementsByClassName("rd-btn")[0].setAttribute("disabled","true")));r.classList.contains("rd-colCheckbox")&&(t=this.rdDailouge.element.querySelector("#rd-checkboxes").querySelectorAll(".e-frame"),i=this.rdDailouge.element.querySelector("#rd-checkboxes").querySelectorAll(".e-check").length,i===0?(document.getElementsByClassName("rd-btn")[0].classList.add("e-disabled"),document.getElementsByClassName("rd-btn")[0].setAttribute("disabled","true")):(document.getElementsByClassName("rd-btn")[0].removeAttribute("disabled"),document.getElementsByClassName("rd-btn")[0].classList.remove("e-disabled")),i<t.length?(document.getElementsByClassName("rd-selectAll")[0].firstElementChild.classList.remove("e-check"),document.getElementsByClassName("rd-selectAll")[0].firstElementChild.classList.add("e-stop")):(document.getElementsByClassName("rd-selectAll")[0].firstElementChild.classList.add("e-check"),document.getElementsByClassName("rd-selectAll")[0].firstElementChild.classList.remove("e-stop")))}}}removeDuplicate(t,i,r){var l,e,u,s,o,h,c;this.obj={};let f=this.base.ssObj.biz.getActiveSheet();this.rngIndexes=this.base.getIndexesFromAddress(t);this.hasHeader=i;this.rowStartCell=i?this.rngIndexes[0]+1:this.rngIndexes[0];this.columnStartCell=this.rngIndexes[1];this.rowEndCell=this.rngIndexes[2];this.columnEndCell=this.rngIndexes[3];this.selected=r;for(let n=this.rowStartCell;n<=this.rowEndCell;n++){let t=[];for(let i=this.columnStartCell;i<=this.columnEndCell;i++)if(this.selected[i]==undefined&&(l=document.querySelector("#rd-checkboxes").querySelector('div[value="'+i+'"]').firstElementChild.classList.contains("e-check"),this.selected[i]=l),this.selected[i]){let r=ej.spreadsheet.getCell(n,i,f);r?t.push(this.util.getCellValues(r)):t.push(null);r&&(this.base.ssObj.biz.setCell(n,i,f,{}),delete f.rows[n].cells[i])}t&&this.addToObj(JSON.stringify(t))}e=0;s=Object.keys(this.obj);for(let n=this.rowStartCell;n<=this.rowEndCell;n++){o=s[e]?JSON.parse(s[e]):undefined;h=0;for(let t=this.columnStartCell;t<=this.columnEndCell;t++)this.selected[t]&&(u=o?o[h]:undefined,u&&(u.value===undefined||this.base.ssObj.biz.setCell(n,t,f,u)),h++);e++}c=this.selectedRow-Object.keys(this.obj).length;n.Apps.Collaboration.Components.Common.Download.Instance().ssAutoSave({action:"removeDuplicates"},this.base,!0);this.base.getSheetIndex()>=0&&(this.hasHeader?this.base.ssObj.selectRange(this.base.generateHeaderText(this.columnStartCell+1)+this.rowStartCell+":"+this.base.generateHeaderText(this.columnEndCell+1)+(this.rowEndCell-c+2)):this.base.ssObj.selectRange(this.base.generateHeaderText(this.columnStartCell+1)+(this.rowStartCell+1)+":"+this.base.generateHeaderText(this.columnEndCell+1)+(this.rowEndCell-c+1)));this.rdDailouge.destroy()}RDshowUniqueDailog(){var n=Object.keys(this.obj),t,i,r;t=this.hasHeader?this.selectedRow-n.length-1:this.selectedRow-n.length;i=t==0?"No duplicate rows were found.":t==1?"1 duplicate row were found and removed.":`${t} duplicate rows were found and removed.`;r=n.length==1?`1 unique row remains.`:`${n.length} unique rows remains.`;this.rdDailouge=new ej.popups.Dialog({isModal:!0,header:"Remove Duplicates",content:`<div id='removedup-container'>
<div id='rd-duplicatevaluetxt'></div>
<br/>
<div id='rd-uniquevaluetxt'></div>
</div>`,width:"470px",height:"180px",buttons:[{click:this.hideRdDailouge.bind(this),buttonModel:{content:"Ok",isPrimary:!0}}]});this.rdDailouge.appendTo("#removeduplicates");document.getElementById("rd-duplicatevaluetxt").append(i);document.getElementById("rd-uniquevaluetxt").append(r)}addToObj(n){this.obj[n]||(this.obj[n]=1)}renderDuplicateDailouge(){var n,t,r,i,u,f,e;if(this.range=this.base.ssObj.biz.getRange(),this.rngIndexes=this.base.getIndexesFromAddress(this.range),this.selectedCol=this.rngIndexes[3]-this.rngIndexes[1]+1,this.selectedRow=this.rngIndexes[2]-this.rngIndexes[0]+1,this.rowStartCell=this.rngIndexes[0],this.columnStartCell=this.rngIndexes[1],this.rowEndCell=this.rngIndexes[2],this.columnEndCell=this.rngIndexes[3],this.rowStartCell-this.rowEndCell==0&&this.columnStartCell-this.columnEndCell==0)this.rdDailouge=new ej.popups.Dialog({isModal:!0,header:"Remove Duplicates",content:`<div id='removedup-container'>Please select a range of cells containing values.</div>`,width:"470px",height:"130px",created:()=>{document.getElementById("removeduplicates_dialog-content").style.overflowY="hidden"},buttons:[{click:this.hideRdDailouge.bind(this),buttonModel:{content:"Ok",isPrimary:!0}}]}),this.rdDailouge.appendTo("#removeduplicates");else{if(this.selectedCol>1&&this.selectedRow>1?n=`${this.selectedCol} columns and ${this.selectedRow} rows selected`:this.selectedCol>1&&this.selectedRow==1?n=`${this.selectedCol} columns and ${this.selectedRow} row selected`:this.selectedCol==1&&this.selectedRow>1&&(n=`${this.selectedCol} column and ${this.selectedRow} rows selected`),t=[],this.selectedCol>0)for(let n=this.columnStartCell;n<=this.columnEndCell;n++)r=this.base.generateHeaderText(n+1),i=ej.buttons.createCheckBox(this.base.ssObj.createElement,!1,{checked:!0,label:"Columns "+r,cssClass:"rd-colCheckbox"}),i.setAttribute("value",n),t.push(i);u=document.getElementById("removedup-container");u?(document.getElementById("rd-selectedColumns-title-data").innerHTML="",document.getElementById("rd-selectedColumns-title-data").innerHTML=n,this.rdDailouge.show()):(f=ej.buttons.createCheckBox(this.base.ssObj.createElement,!1,{checked:!1,cssClass:"rd-hasHeader"}),e=ej.buttons.createCheckBox(this.base.ssObj.createElement,!1,{checked:!0,label:"Select all",cssClass:"rd-selectAll"}),this.rdDailouge=new ej.popups.Dialog({isModal:!0,header:"Remove Duplicates",content:`<div id='removedup-container'>
<div id='rd-selectedColumns-container'>
<div id="rd-selectedColumns-title-data"></div>
<div id="rd-hasHeader-checkbox"></div>
<span id="rd-hasHeader-content">Data has header row</span>
</div>
<div id="rd-selectedColumns-info-wrapper">
<div id="rd-selectedColumns-info-analyze">Select Columns to analyze</div>
<div id="rd-checkboxes-container">
<div id="rd-selectAll"> </div>
<div id="rd-checkboxes"></div>
</div></div>
</div>`,showCloseIcon:!1,created:()=>{document.getElementById("rd-hasHeader-checkbox").appendChild(f),document.getElementById("rd-selectAll").appendChild(e),document.getElementById("rd-selectedColumns-title-data").append(n),t.forEach(n=>{document.getElementById("rd-checkboxes").appendChild(n)}),setTimeout(()=>{document.getElementById("rd-checkboxes-container").offsetHeight<250?document.getElementById("rd-checkboxes-container").style.overflowY="hidden":document.getElementById("rd-checkboxes").style.overflowY=""},0)},open:()=>{},width:"350px",height:"auto",closeOnEscape:!1,buttons:[{click:this.hideRdDailouge.bind(this),buttonModel:{content:"Cancel"}},{click:this.processDup.bind(this),buttonModel:{content:"Remove Duplicates",isPrimary:!0,cssClass:"rd-btn"}}]}),this.rdDailouge.appendTo("#removeduplicates"))}}hideRdDailouge(){this.rdDailouge.element.removeEventListener("mousedown",()=>{});this.rdDailouge.hide();this.rdDailouge.destroy()}processDup(){let t=!1;document.getElementsByClassName("rd-hasHeader")[0].firstElementChild.classList.contains("e-check")&&(t=!0);let r=this.base.ssObj.biz.getRange(),u=this.base.ssObj.biz.getIndexes(),i={range:r,indexes:u,sheetIndex:this.base.getSheetIndex(),header:t,action:"removeDuplicates",origin:"biz"};this.base.ssObj.updateUndoRedoCollection({name:"bizAction",args:{action:"removeDuplicates",options:i,oldCells:this.base.getCellsFromIndexes(u)}});this.removeDuplicate(r,t,{});this.base.removeCopyIndicator();i.colSelected=this.selected;this.RDshowUniqueDailog();n.Apps.Collaboration.Components.Sheets.Base.Instance().bizSignalr(i)}renderMenubarFullscreenDialog(){this.menubarFullscreenDialogObj?this.menubarFullscreenDialogObj.show():(this.menubarFullscreenDialogObj=new ej.popups.Dialog({content:`<div id='menubar-fullscreen-container'>
<div id='menubar-fullscreenf11-message'>
Press <span class= "menubar-esc">Esc</span> to exit full screen <span class="biz-ss-menubarfullscreen-dismiss"> Dismiss </span></div>
</div>`,width:"470px",height:"45px",position:{X:"center",Y:14},animationSettings:{effect:"None"},closeOnEscape:!0,cssClass:"biz-ss-menubar-fullscreen",Close:this.hideSsMenubarFullscreenDialog.bind(this)}),this.menubarFullscreenDialogObj.appendTo("#biz-ss-menubar-fullscreendialog"))}hideSsMenubarFullscreenDialog(){this.menubarFullscreenDialogObj.destroy();document.getElementById("menubar-fullscreen-container")&&document.getElementById("menubar-fullscreen-container").parentElement.remove();setTimeout(()=>{this.menubarFullscreenDialogObj=null},1e3)}renderResizeDialog(){let i=this.base.ssObj.biz.getActiveSheet(),n=this.base.ssObj.biz.getIndexes(),f=this.base.ssObj.biz.isRowsSelected(n),e=n[2]-n[0]+1,o=n[3]-n[1]+1,r="",u="",t;f?(r=e==1?"Resize row "+(n[0]+1):"Resize rows "+(n[0]+1)+" - "+(n[2]+1),u="Specify row height in pixels: (Default 18)",t=i.rows[n[0]]&&i.rows[n[0]].height||18.5):(r=o==1?"Resize column "+this.base.generateHeaderText(n[0]+1):"Resize columns "+this.base.generateHeaderText(n[1]+1)+" - "+this.base.generateHeaderText(n[3]+1),u="Specify column width in pixels: (Default 64)",t=i.columns[n[1]]&&i.columns[n[1]].width||64);t==undefined&&(t="");this.radiobutton=new ej.buttons.RadioButton({label:u,name:"resizetofit",checked:!0,value:"resizeroworcol"});this.resizeDialogObj=new ej.popups.Dialog({content:`<div id='resize-dialog-container'>
<div id='resize-dialog-content'>
<ul>
<li><input type="radio" id="header-checkbox"></li>
<div class="e-input-group resize-input-div">
<input class="e-input" name='input' type="text" value="${t}" id="resize-input" />
</div>
<li><input type="radio" id="resizetofit-checkbox"></li>
</ul>
</div>
</div>`,width:"470px",height:"auto",header:r,animationSettings:{effect:"None"},showCloseIcon:!0,closeOnEscape:!0,target:document.body.querySelectorAll("._bizgaze_popup_container")[document.body.querySelectorAll("._bizgaze_popup_container").length-1],created:this.resizeDialogCreated.bind(this),cssClass:"biz-ss-resizetofit",buttons:[{click:this.hideResizeDialog.bind(this),buttonModel:{content:"Cancel"}},{click:this.processResize.bind(this),buttonModel:{content:"Ok",isPrimary:!0}}],Close:this.hideResizeDialog.bind(this)});this.resizeDialogObj.appendTo("#biz-ss-resizetofit-dialog")}resizeDialogCreated(){this.radiobutton.appendTo("#header-checkbox");this.radiobutton=new ej.buttons.RadioButton({label:"Resize to fit",name:"resizetofit",value:"resizetofit"});this.radiobutton.appendTo("#resizetofit-checkbox");document.getElementsByClassName("biz-ss-resizetofit")[0].style.maxHeight=""}hideResizeDialog(){this.resizeDialogObj&&(this.resizeDialogObj.destroy(),setTimeout(()=>{this.resizeDialogObj=null}))}processResize(){return __awaiter(this,void 0,void 0,function*(){let u=this.base.ssObj.biz.getRange(),n=[],t=[],f=Number(document.getElementById("resize-input").value),r=u.split(" ");for(var i=0;i<r.length;i++){let u=this.base.swapRange(ej.spreadsheet.getIndexesFromAddress(r[i]));yield this.resizeHeaders(u,f,r[i]).then(i=>{t=t.concat(i.changedValues),n=n.concat(i.resizedHeaders)})}this.hideResizeDialog();this.base.focusDocumentViewer();t.length>0&&this.base.download.ssAutoSave({action:"imageincell",changedValues:t},this.base,!0);n.length>0&&this.base.download.ssAutoSave({action:"headerResize",resizedHeaders:n},this.base,!0)})}resizeHeaders(n,t,i){return __awaiter(this,void 0,void 0,function*(){var r;let f=[],u=[],e=this.base.getSheetIndex(),o=this.base.ssObj.biz.isRowsSelected(n),s=document.querySelector('input[name="resizetofit"]:checked').value;if(s=="resizeroworcol")if(o){for(r=n[0];r<=n[2];r++)yield this.setRowHeight(t,r),f.push({rowIndex:r,height:t,sheetIndex:e,resizeType:"row"});u=u.concat(this.base.setRowIncellImageSize(i))}else{for(r=n[1];r<=n[3];r++)yield this.setColWidth(t,r),f.push({colIndex:r,width:t,sheetIndex:e,resizeType:"col"});u=u.concat(this.base.setColumnIncellImageSize(i))}else this.base.ssObj.autoFit(i),u=o?u.concat(this.base.setRowIncellImageSize(i)):u.concat(this.base.setColumnIncellImageSize(i));return{changedValues:u,resizedHeaders:f}})}setRowHeight(n,t){return __awaiter(this,void 0,void 0,function*(){yield this.base.ssObj.setRowHeight(n+"px",t)})}setColWidth(n,t){return __awaiter(this,void 0,void 0,function*(){yield this.base.ssObj.setColWidth(n+"px",t)})}static Instance(){return this.instance===undefined&&(this.instance=new i),this.instance}}t.Dialogue=i})(i=t.Sheets||(t.Sheets={}))})(i=t.Components||(t.Components={}))})(i=t.Collaboration||(t.Collaboration={}))})(t=n.Apps||(n.Apps={}))})(Unibase||(Unibase={}));
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,210 @@
var Unibase;
(function (Unibase) {
let Apps;
(function (Apps) {
let Collaboration;
(function (Collaboration) {
let Components;
(function (Components) {
let Sheets;
(function (Sheets) {
class SpellChecker {
constructor() {
this.dic = {};
this.hederText = {};
}
init(base) {
this.base = base;
this.ssObj = this.base.ssObj;
}
processWords() {
this.dic = {};
this.words = '';
let sheet = this.ssObj.biz.getActiveSheet();
let rngIndexes = this.base.getIndexesFromAddress(sheet.selectedRange);
for (let i = rngIndexes[0]; i <= rngIndexes[2]; i++) {
if (!this.ssObj.biz.isRowAvailable(i, sheet)) {
continue;
}
for (let j = rngIndexes[1]; j <= rngIndexes[3]; j++) {
let cellObj = ej.spreadsheet.getCell(i, j, sheet);
if (cellObj && cellObj.value && typeof cellObj.value !== 'number') {
let value = cellObj.value.toString();
let temp = value.split(' ');
let values = [];
for (let k = 0; k < temp.length; k++) {
let val = temp[k];
if (!this.dic[val]) {
this.dic[val.trim()] = [{ rowIndex: i, colIndex: j }];
values.push(val.trim());
}
else {
this.dic[val.trim()].push({ rowIndex: i, colIndex: j });
}
}
values.length && (this.words = this.words + ' ' + values.toString().replaceAll(',', ' '));
}
}
}
this.splitWords = this.words.trim().split(' ').reverse();
this.requestServer();
}
requestServer() {
var data = {
LanguageID: 1033,
TexttoCheck: this.words.trim(),
CheckSpelling: true,
CheckSuggestion: true,
AddWord: false,
};
Unibase.Apps.Collaboration.DocumentManager.Instance().spellCheck(data).then((res) => { this.successCallback(res); });
}
successCallback(result) {
this.ssObj.allowEditing = false;
for (var i = 0; i < result.length; i++) {
result[i] = JSON.parse(result[i]);
}
this.result = result.reverse();
ej.popups.hideSpinner(this.dlgObj.element);
this.dlgObj.content = `<div>
<span class="biz-sc-info"></span>
<div style="padding-top: 10px">
<input class="biz-sc-value" type="text"/>
<input type="text" class='biz-sc-sugg'/>
</div>
<div style="padding-top: 10px">
<button type="text" class='biz-sc-change'>Change</button>
<button type="text" class='biz-sc-ignore'>Ignore</button>
</div>
</div>`;
this.dlgObj.dataBind();
this.dlgObj.element.querySelector('.e-footer-content').classList.add('biz-hide');
this.infoElem = this.dlgObj.element.querySelector('.biz-sc-info');
this.textObj = new ej.inputs.TextBox({}, this.dlgObj.element.querySelector('.biz-sc-value'));
this.ddSug = new ej.dropdowns.DropDownList({
dataSource: [], select: (e) => {
this.textObj.value = e.itemData.value;
}
}, this.dlgObj.element.querySelector('.biz-sc-sugg'));
let items = [
{
text: 'Change all',
}
];
this.spanElem = this.dlgObj.element.querySelector('.biz-sc-info');
this.ddChange = new ej.splitbuttons.SplitButton({ items: items, click: (e) => { this.change(); }, select: (e) => { this.changeAll(); } }, this.dlgObj.element.querySelector('.biz-sc-change'));
items = [
{
text: 'Ignore all',
}
];
this.ddIgnore = new ej.splitbuttons.SplitButton({ items: items, click: (e) => { this.ignore(); }, select: (e) => { this.ignoreAll(); } }, this.dlgObj.element.querySelector('.biz-sc-ignore'));
this.moveNext();
}
convertAsItemModel(items) {
for (let i = 0; i < items.length; i++) {
items[i] = { text: items[i] };
}
}
moveNext(skipPop) {
if (!this.splitWords.length) {
this.dlgObj.content = 'No spelling errors';
this.dlgObj.height = '95px';
this.dlgObj.dataBind();
this.dlgObj.element.querySelector('.e-footer-content').classList.remove('biz-hide');
this.ssObj.allowEditing = true;
setTimeout(() => {
this.destroySpellDialog();
}, 3000);
return;
}
if (!skipPop) {
this.value = this.splitWords.pop();
this.spellObj = this.result.pop();
this.spanElem.innerHTML = "Change <b>" + this.value + "</b> to:";
}
let addr = this.dic[this.value];
if (this.spellObj['Suggestions'] && this.spellObj['Suggestions'].length && addr.length) {
this.ssObj.selectRange(this.base.generateHeaderText(addr[0].colIndex + 1) + (addr[0].rowIndex + 1));
this.ddSug.dataSource = this.spellObj['Suggestions'];
this.ddSug.value = this.spellObj['Suggestions'][0];
this.textObj.value = this.spellObj['Suggestions'][0];
}
else {
delete this.dic[this.value];
this.moveNext();
}
}
change() {
let addr = this.dic[this.value];
let sheet = this.ssObj.biz.getActiveSheet();
let cellObj = ej.spreadsheet.getCell(addr[0].rowIndex, addr[0].colIndex, sheet);
let value = cellObj.value === this.value ? this.textObj.value : cellObj.value.replace(this.value, this.textObj.value);
let args = { rowIdx: addr[0].rowIndex, colIdx: addr[0].colIndex, value: value, action: 'spellcheck', origin: 'biz', sheetIndex: this.base.getSheetIndex() };
this.applySpellValue(addr[0].rowIndex, addr[0].colIndex, value);
this.ignore();
Unibase.Apps.Collaboration.Components.Sheets.Base.Instance().bizSignalr(args);
}
applySpellValue(rowIdx, colIdx, value) {
let sheet = this.ssObj.biz.getActiveSheet();
let cellObj = ej.spreadsheet.getCell(rowIdx, colIdx, sheet);
cellObj.value = value;
this.ssObj.biz.setCell(rowIdx, colIdx, sheet, cellObj);
Unibase.Apps.Collaboration.Components.Common.Download.Instance().ssAutoSave({ action: "cellSave", eventArgs: { address: "sheet!" + this.base.ssObj.biz.getRange() } }, this.base, true);
}
changeAll() {
let len = this.dic[this.value].length;
for (let i = 0; i < len; i++) {
this.change();
}
}
ignore() {
this.dic[this.value].shift();
this.moveNext(true);
}
ignoreAll() {
delete this.dic[this.value];
this.moveNext();
}
renderSpellDialog() {
let div = this.ssObj.element.querySelector('.biz-spelldlg') || ej.base.createElement('div', { className: 'biz-spelldlg' });
this.ssObj.element.querySelector('.e-sheet-panel').appendChild(div);
this.dlgObj = new ej.popups.Dialog({
target: this.ssObj.element.querySelector('.e-sheet-panel'),
content: '',
width: '350px',
height: '170px',
position: { X: 'right', Y: 'top' },
animationSettings: { effect: 'None' },
showCloseIcon: false,
buttons: [{
click: this.destroySpellDialog.bind(this),
buttonModel: { content: 'Close' }
}],
open: () => {
ej.popups.createSpinner({ target: this.dlgObj.element });
ej.popups.showSpinner(this.dlgObj.element);
},
});
this.dlgObj.appendTo(div);
this.processWords();
}
destroySpellDialog() {
this.ddSug.destroy();
this.ddChange.destroy();
this.ddIgnore.destroy();
this.dlgObj.destroy();
}
static Instance() {
if (this.instance === undefined) {
this.instance = new SpellChecker();
}
return this.instance;
}
}
Sheets.SpellChecker = SpellChecker;
})(Sheets = Components.Sheets || (Components.Sheets = {}));
})(Components = Collaboration.Components || (Collaboration.Components = {}));
})(Collaboration = Apps.Collaboration || (Apps.Collaboration = {}));
})(Apps = Unibase.Apps || (Unibase.Apps = {}));
})(Unibase || (Unibase = {}));
File diff suppressed because one or more lines are too long
+11
View File
@@ -0,0 +1,11 @@
var Unibase;(function(n){let t;(function(t){let i;(function(t){let i;(function(t){let i;(function(t){class i{constructor(){this.dic={};this.hederText={}}init(n){this.base=n;this.ssObj=this.base.ssObj}processWords(){this.dic={};this.words="";let t=this.ssObj.biz.getActiveSheet(),n=this.base.getIndexesFromAddress(t.selectedRange);for(let i=n[0];i<=n[2];i++)if(this.ssObj.biz.isRowAvailable(i,t))for(let r=n[1];r<=n[3];r++){let n=ej.spreadsheet.getCell(i,r,t);if(n&&n.value&&typeof n.value!="number"){let f=n.value.toString(),u=f.split(" "),t=[];for(let n=0;n<u.length;n++){let f=u[n];this.dic[f]?this.dic[f.trim()].push({rowIndex:i,colIndex:r}):(this.dic[f.trim()]=[{rowIndex:i,colIndex:r}],t.push(f.trim()))}t.length&&(this.words=this.words+" "+t.toString().replaceAll(","," "))}}this.splitWords=this.words.trim().split(" ").reverse();this.requestServer()}requestServer(){var t={LanguageID:1033,TexttoCheck:this.words.trim(),CheckSpelling:!0,CheckSuggestion:!0,AddWord:!1};n.Apps.Collaboration.DocumentManager.Instance().spellCheck(t).then(n=>{this.successCallback(n)})}successCallback(n){this.ssObj.allowEditing=!1;for(var t=0;t<n.length;t++)n[t]=JSON.parse(n[t]);this.result=n.reverse();ej.popups.hideSpinner(this.dlgObj.element);this.dlgObj.content=`<div>
<span class="biz-sc-info"></span>
<div style="padding-top: 10px">
<input class="biz-sc-value" type="text"/>
<input type="text" class='biz-sc-sugg'/>
</div>
<div style="padding-top: 10px">
<button type="text" class='biz-sc-change'>Change</button>
<button type="text" class='biz-sc-ignore'>Ignore</button>
</div>
</div>`;this.dlgObj.dataBind();this.dlgObj.element.querySelector(".e-footer-content").classList.add("biz-hide");this.infoElem=this.dlgObj.element.querySelector(".biz-sc-info");this.textObj=new ej.inputs.TextBox({},this.dlgObj.element.querySelector(".biz-sc-value"));this.ddSug=new ej.dropdowns.DropDownList({dataSource:[],select:n=>{this.textObj.value=n.itemData.value}},this.dlgObj.element.querySelector(".biz-sc-sugg"));let i=[{text:"Change all"}];this.spanElem=this.dlgObj.element.querySelector(".biz-sc-info");this.ddChange=new ej.splitbuttons.SplitButton({items:i,click:()=>{this.change()},select:()=>{this.changeAll()}},this.dlgObj.element.querySelector(".biz-sc-change"));i=[{text:"Ignore all"}];this.ddIgnore=new ej.splitbuttons.SplitButton({items:i,click:()=>{this.ignore()},select:()=>{this.ignoreAll()}},this.dlgObj.element.querySelector(".biz-sc-ignore"));this.moveNext()}convertAsItemModel(n){for(let t=0;t<n.length;t++)n[t]={text:n[t]}}moveNext(n){if(!this.splitWords.length){this.dlgObj.content="No spelling errors";this.dlgObj.height="95px";this.dlgObj.dataBind();this.dlgObj.element.querySelector(".e-footer-content").classList.remove("biz-hide");this.ssObj.allowEditing=!0;setTimeout(()=>{this.destroySpellDialog()},3e3);return}n||(this.value=this.splitWords.pop(),this.spellObj=this.result.pop(),this.spanElem.innerHTML="Change <b>"+this.value+"<\/b> to:");let t=this.dic[this.value];this.spellObj.Suggestions&&this.spellObj.Suggestions.length&&t.length?(this.ssObj.selectRange(this.base.generateHeaderText(t[0].colIndex+1)+(t[0].rowIndex+1)),this.ddSug.dataSource=this.spellObj.Suggestions,this.ddSug.value=this.spellObj.Suggestions[0],this.textObj.value=this.spellObj.Suggestions[0]):(delete this.dic[this.value],this.moveNext())}change(){let t=this.dic[this.value],u=this.ssObj.biz.getActiveSheet(),i=ej.spreadsheet.getCell(t[0].rowIndex,t[0].colIndex,u),r=i.value===this.value?this.textObj.value:i.value.replace(this.value,this.textObj.value),f={rowIdx:t[0].rowIndex,colIdx:t[0].colIndex,value:r,action:"spellcheck",origin:"biz",sheetIndex:this.base.getSheetIndex()};this.applySpellValue(t[0].rowIndex,t[0].colIndex,r);this.ignore();n.Apps.Collaboration.Components.Sheets.Base.Instance().bizSignalr(f)}applySpellValue(t,i,r){let u=this.ssObj.biz.getActiveSheet(),f=ej.spreadsheet.getCell(t,i,u);f.value=r;this.ssObj.biz.setCell(t,i,u,f);n.Apps.Collaboration.Components.Common.Download.Instance().ssAutoSave({action:"cellSave",eventArgs:{address:"sheet!"+this.base.ssObj.biz.getRange()}},this.base,!0)}changeAll(){let n=this.dic[this.value].length;for(let t=0;t<n;t++)this.change()}ignore(){this.dic[this.value].shift();this.moveNext(!0)}ignoreAll(){delete this.dic[this.value];this.moveNext()}renderSpellDialog(){let n=this.ssObj.element.querySelector(".biz-spelldlg")||ej.base.createElement("div",{className:"biz-spelldlg"});this.ssObj.element.querySelector(".e-sheet-panel").appendChild(n);this.dlgObj=new ej.popups.Dialog({target:this.ssObj.element.querySelector(".e-sheet-panel"),content:"",width:"350px",height:"170px",position:{X:"right",Y:"top"},animationSettings:{effect:"None"},showCloseIcon:!1,buttons:[{click:this.destroySpellDialog.bind(this),buttonModel:{content:"Close"}}],open:()=>{ej.popups.createSpinner({target:this.dlgObj.element}),ej.popups.showSpinner(this.dlgObj.element)}});this.dlgObj.appendTo(n);this.processWords()}destroySpellDialog(){this.ddSug.destroy();this.ddChange.destroy();this.ddIgnore.destroy();this.dlgObj.destroy()}static Instance(){return this.instance===undefined&&(this.instance=new i),this.instance}}t.SpellChecker=i})(i=t.Sheets||(t.Sheets={}))})(i=t.Components||(t.Components={}))})(i=t.Collaboration||(t.Collaboration={}))})(t=n.Apps||(n.Apps={}))})(Unibase||(Unibase={}));
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,41 @@
var Unibase;
(function (Unibase) {
let Apps;
(function (Apps) {
let Collaboration;
(function (Collaboration) {
let Hubs;
(function (Hubs) {
class UniDocHub {
constructor(huburl) {
this.huburl = huburl;
this.connection = new window['signalR'].HubConnectionBuilder()
.withUrl(this.huburl).withAutomaticReconnect()
.build();
}
getConnection() {
return this.connection;
}
connect(callback) {
this.getConnection().start().then(function () {
callback();
});
}
register(eventname, actionmethod) {
this.getConnection().on(eventname, actionmethod);
}
invoke(methodname, params) {
this.getConnection().invoke(methodname, params);
}
static Instance(huburl) {
if (this.instance === undefined) {
this.instance = new UniDocHub(huburl);
}
return this.instance;
}
}
Hubs.UniDocHub = UniDocHub;
})(Hubs = Collaboration.Hubs || (Collaboration.Hubs = {}));
})(Collaboration = Apps.Collaboration || (Apps.Collaboration = {}));
})(Apps = Unibase.Apps || (Unibase.Apps = {}));
})(Unibase || (Unibase = {}));
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"unidochub.js","sourceRoot":"","sources":["unidochub.ts"],"names":[],"mappings":"AAAA,IAAU,OAAO,CAkDhB;AAlDD,WAAU,OAAO;IACb,IAAiB,IAAI,CAgDpB;IAhDD,WAAiB,IAAI;QACjB,IAAiB,aAAa,CA8C7B;QA9CD,WAAiB,aAAa;YAC1B,IAAiB,IAAI,CA4CpB;YA5CD,WAAiB,IAAI;gBACjB,MAAa,SAAS;oBAIlB,YAAY,MAAc;wBACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;wBACrB,IAAI,CAAC,UAAU,GAAG,IAAI,MAAM,CAAC,SAAS,CAAC,CAAC,oBAAoB,EAAE;6BACzD,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,sBAAsB,EAAE;6BAC7C,KAAK,EAAE,CAAC;oBACjB,CAAC;oBAED,aAAa;wBAKT,OAAO,IAAI,CAAC,UAAU,CAAC;oBAC3B,CAAC;oBAED,OAAO,CAAC,QAAkB;wBACtB,IAAI,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC;4BAC9B,QAAQ,EAAE,CAAC;wBACf,CAAC,CAAC,CAAC;oBACP,CAAC;oBAED,QAAQ,CAAC,SAAiB,EAAE,YAAsB;wBAE9C,IAAI,CAAC,aAAa,EAAE,CAAC,EAAE,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;oBACrD,CAAC;oBAED,MAAM,CAAC,UAAkB,EAAE,MAAuB;wBAC9C,IAAI,CAAC,aAAa,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAA;oBACnD,CAAC;oBAID,MAAM,CAAC,QAAQ,CAAC,MAAc;wBAC1B,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE;4BAC7B,IAAI,CAAC,QAAQ,GAAG,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC;yBACzC;wBACD,OAAO,IAAI,CAAC,QAAQ,CAAC;oBACzB,CAAC;iBACJ;gBA1CY,cAAS,YA0CrB,CAAA;YACL,CAAC,EA5CgB,IAAI,GAAJ,kBAAI,KAAJ,kBAAI,QA4CpB;QACL,CAAC,EA9CgB,aAAa,GAAb,kBAAa,KAAb,kBAAa,QA8C7B;IACL,CAAC,EAhDgB,IAAI,GAAJ,YAAI,KAAJ,YAAI,QAgDpB;AACL,CAAC,EAlDS,OAAO,KAAP,OAAO,QAkDhB"}
+1
View File
@@ -0,0 +1 @@
var Unibase;(function(n){let t;(function(n){let t;(function(n){let t;(function(n){class t{constructor(n){this.huburl=n;this.connection=(new window.signalR.HubConnectionBuilder).withUrl(this.huburl).withAutomaticReconnect().build()}getConnection(){return this.connection}connect(n){this.getConnection().start().then(function(){n()})}register(n,t){this.getConnection().on(n,t)}invoke(n,t){this.getConnection().invoke(n,t)}static Instance(n){return this.instance===undefined&&(this.instance=new t(n)),this.instance}}n.UniDocHub=t})(t=n.Hubs||(n.Hubs={}))})(t=n.Collaboration||(n.Collaboration={}))})(t=n.Apps||(n.Apps={}))})(Unibase||(Unibase={}));