Compare commits

..

3 commits

Author SHA1 Message Date
Julia Svinareva a94086468e [DE] Bug 36794 (Insert Page Number) 2019-09-25 16:52:15 +03:00
Julia Svinareva f92ad5f015 [DE] Bug 36794 (Insert number of pages) 2019-09-25 10:56:07 +03:00
Julia Svinareva e5ec005568 [DE] Bug 36794 (Insert Page Number) 2019-09-23 15:17:57 +03:00
16987 changed files with 410599 additions and 830461 deletions

View file

@ -1,18 +0,0 @@
name: check
on: [push]
jobs:
project-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 12
uses: actions/setup-node@v1
with:
node-version: 12
- name: Build using grunt
run: |
npm install --prefix build
cd ..
git clone --branch=develop --depth=1 https://github.com/ONLYOFFICE/sdkjs.git
cd web-apps
grunt --level=ADVANCED --base build --gruntfile build/Gruntfile.js

9
.gitignore vendored
View file

@ -3,21 +3,12 @@ Thumbs.db
.DS_Store .DS_Store
/deploy /deploy
build/node_modules build/node_modules
build/plugins/**/node_modules/
build/sprites/node_modules/
vendor/framework7-react/
apps/documenteditor/embed/resources/less/node_modules apps/documenteditor/embed/resources/less/node_modules
apps/presentationeditor/embed/resources/less/node_modules apps/presentationeditor/embed/resources/less/node_modules
apps/spreadsheeteditor/embed/resources/less/node_modules apps/spreadsheeteditor/embed/resources/less/node_modules
apps/documenteditor/mobile/resources/sass/.sass-cache apps/documenteditor/mobile/resources/sass/.sass-cache
apps/spreadsheeteditor/mobile/resources/sass/.sass-cache apps/spreadsheeteditor/mobile/resources/sass/.sass-cache
apps/presentationeditor/mobile/resources/sass/.sass-cache apps/presentationeditor/mobile/resources/sass/.sass-cache
apps/**/main/resources/**/iconssmall*.png
apps/**/main/resources/**/iconssmall*.less
apps/**/main/resources/**/iconsbig*.png
apps/**/main/resources/**/iconsbig*.less
apps/**/main/resources/**/iconshuge*.png
apps/**/main/resources/**/iconshuge*.less
# test documents # test documents

10
.travis.yml Normal file
View file

@ -0,0 +1,10 @@
dist: trusty
language: node_js
node_js:
- '6'
before_install: npm install -g grunt-cli
before_script:
- cd build
script:
- npm install
- grunt --level=ADVANCED

10
.vscode/settings.json vendored
View file

@ -1,10 +0,0 @@
{
"filewatcher.commands": [
{
"match": "app-(ios|material)\\.less",
"isAsync": true,
"cmd": "lessc --js --no-color '${file}' '${fileDirname}/../css/${fileBasenameNoExt}.css'",
"event": "onFileChange"
}
]
}

View file

@ -2,23 +2,21 @@
## web-apps ## web-apps
The frontend for [ONLYOFFICE Document Server][2] and [ONLYOFFICE Desktop Editors](https://github.com/ONLYOFFICE/DesktopEditors). Builds the program interface and allows the user create, edit, save and export text documents, spreadsheets, and presentations. The frontend for [ONLYOFFICE Document Server][2]. Builds the program interface and allows the user create, edit, save and export text, spreadsheet and presentation documents using the common interface of a document editor.
## Previous versions ## Project Information
Until 2019-10-23 the repository was called web-apps-pro. Official website: [http://www.onlyoffice.org](http://onlyoffice.org "http://www.onlyoffice.org")
## Project information
Official website: [https://www.onlyoffice.com/](https://www.onlyoffice.com "https://www.onlyoffice.com")
Code repository: [https://github.com/ONLYOFFICE/web-apps](https://github.com/ONLYOFFICE/web-apps "https://github.com/ONLYOFFICE/web-apps") Code repository: [https://github.com/ONLYOFFICE/web-apps](https://github.com/ONLYOFFICE/web-apps "https://github.com/ONLYOFFICE/web-apps")
## User feedback and support SaaS version: [http://www.onlyoffice.com](http://www.onlyoffice.com "http://www.onlyoffice.com")
If you have any problems with or questions about [ONLYOFFICE Document Server][2], please visit our official forum: [forum.onlyoffice.com][1] or you can ask and answer ONLYOFFICE development questions on [Stack Overflow][3]. ## User Feedback and Support
[1]: https://forum.onlyoffice.com If you have any problems with or questions about [ONLYOFFICE Document Server][2], please visit our official forum to find answers to your questions: [dev.onlyoffice.org][1] or you can ask and answer ONLYOFFICE development questions on [Stack Overflow][3].
[1]: http://dev.onlyoffice.org
[2]: https://github.com/ONLYOFFICE/DocumentServer [2]: https://github.com/ONLYOFFICE/DocumentServer
[3]: http://stackoverflow.com/questions/tagged/onlyoffice [3]: http://stackoverflow.com/questions/tagged/onlyoffice

View file

@ -11,11 +11,10 @@
# Full # # Full #
config = { config = {
type: 'desktop or mobile or embedded', type: 'desktop or mobile',
width: '100% by default', width: '100% by default',
height: '100% by default', height: '100% by default',
documentType: 'word' | 'cell' | 'slide',// deprecate 'text' | 'spreadsheet' | 'presentation', documentType: 'text' | 'spreadsheet' | 'presentation',
token: <string> encrypted signature
document: { document: {
title: 'document title', title: 'document title',
url: 'document url' url: 'document url'
@ -24,8 +23,10 @@
key: 'key', key: 'key',
vkey: 'vkey', vkey: 'vkey',
info: { info: {
author: 'author name', // must be deprecated, use owner instead
owner: 'owner name', owner: 'owner name',
folder: 'path to document', folder: 'path to document',
created: '<creation date>', // must be deprecated, use uploaded instead
uploaded: '<uploaded date>', uploaded: '<uploaded date>',
sharingSettings: [ sharingSettings: [
{ {
@ -34,8 +35,7 @@
isLink: false isLink: false
}, },
... ...
], ]
favorite: '<file is favorite>' // true/false/undefined (undefined - don't show fav. button)
}, },
permissions: { permissions: {
edit: <can edit>, // default = true edit: <can edit>, // default = true
@ -43,30 +43,15 @@
reader: <can view in readable mode>, reader: <can view in readable mode>,
review: <can review>, // default = edit review: <can review>, // default = edit
print: <can print>, // default = true print: <can print>, // default = true
rename: <can rename>, // default = false
changeHistory: <can change history>, // default = false
comment: <can comment in view mode> // default = edit, comment: <can comment in view mode> // default = edit,
modifyFilter: <can add, remove and save filter in the spreadsheet> // default = true modifyFilter: <can add, remove and save filter in the spreadsheet> // default = true
modifyContentControl: <can modify content controls in documenteditor> // default = true modifyContentControl: <can modify content controls in documenteditor> // default = true
fillForms: <can edit forms in view mode> // default = edit || review, fillForms: <can edit forms in view mode> // default = edit || review
copy: <can copy data> // default = true,
editCommentAuthorOnly: <can edit your own comments only> // default = false
deleteCommentAuthorOnly: <can delete your own comments only> // default = false,
reviewGroups: ["Group1", ""] // current user can accept/reject review changes made by users from Group1 and users without a group. [] - use groups, but can't change any group's changes
commentGroups: { // {} - use groups, but can't view/edit/delete any group's comments
view: ["Group1", ""] // current user can view comments made by users from Group1 and users without a group.
edit: ["Group1", ""] // current user can edit comments made by users from Group1 and users without a group.
remove: ["Group1", ""] // current user can remove comments made by users from Group1 and users without a group.
},
userInfoGroups: ["Group1", ""], // show tooltips/cursors/info in header only for users in userInfoGroups groups. [""] - means users without group, [] - don't show any users, null/undefined/"" - show all users
protect: <can protect document> // default = true. show/hide protect tab or protect buttons
} }
}, },
editorConfig: { editorConfig: {
actionLink: { // open file and scroll to data, used with onMakeActionLink or the onRequestSendNotify event
action: {
type: "bookmark", // or type="comment"
data: <bookmark name> // or comment id
}
},
mode: 'view or edit', mode: 'view or edit',
lang: <language code>, lang: <language code>,
location: <location>, location: <location>,
@ -84,21 +69,20 @@
user: { user: {
id: 'user id', id: 'user id',
name: 'user name', name: 'user name'
group: 'group name' // for customization.reviewPermissions or permissions.reviewGroups or permissions.commentGroups. Can be multiple groups separated by commas (,) : 'Group1' or 'Group1,Group2'
}, },
recent: [ recent: [
{ {
title: 'document title', title: 'document title',
url: 'document url', url: 'document url',
folder: 'path to document', folder: 'path to document'
}, },
... ...
], ],
templates: [ templates: [
{ {
title: 'template name', // name - is deprecated name: 'template name',
image: 'template icon url', icon: 'template icon url',
url: 'http://...' url: 'http://...'
}, },
... ...
@ -106,8 +90,7 @@
customization: { customization: {
logo: { logo: {
image: url, image: url,
imageDark: url, // logo for dark theme imageEmbedded: url,
imageEmbedded: url, // deprecated, use image instead
url: http://... url: http://...
}, },
customer: { customer: {
@ -115,10 +98,8 @@
address: 'New-York, 125f-25', address: 'New-York, 125f-25',
mail: 'support@gmail.com', mail: 'support@gmail.com',
www: 'www.superpuper.com', www: 'www.superpuper.com',
phone: '1234567890',
info: 'Some info', info: 'Some info',
logo: '', logo: ''
logoDark: '', // logo for dark theme
}, },
about: true, about: true,
feedback: { feedback: {
@ -128,102 +109,27 @@
goback: { goback: {
url: 'http://...', url: 'http://...',
text: 'Go to London', text: 'Go to London',
blank: true, blank: true
requestClose: false // if true - goback send onRequestClose event instead opening url
},
reviewPermissions: {
"Group1": ["Group2"], // users from Group1 can accept/reject review changes made by users from Group2
"Group2": ["Group1", "Group2"] // users from Group2 can accept/reject review changes made by users from Group1 and Group2
"Group3": [""] // users from Group3 can accept/reject review changes made by users without a group
},
anonymous: { // set name for anonymous user
request: bool (default: true), // enable set name
label: string (default: "Guest") // postfix for user name
},
review: {
hideReviewDisplay: false, // hide button Review mode
hoverMode: false, // true - show review balloons on mouse move, not on click on text
showReviewChanges: false,
reviewDisplay: 'original', // original for viewer, markup for editor
trackChanges: undefined // true/false - open editor with track changes mode on/off,
},
layout: { // hide elements, but don't disable feature
toolbar: {
file: { // menu file
close: false / true, // close menu button
settings: false / true, // advanced settings
info: false / true // document info
save: false/true // save button
} / false / true,
home: {
mailmerge: false/true // mail merge button
},
layout: false / true, // layout tab
references: false / true, // de references tab
collaboration: false / true // collaboration tab
protect: false / true, // protect tab
plugins: false / true // plugins tab
view: {
navigation: false/true // navigation button in de
} / false / true, // view tab
save: false/true // save button on toolbar in
} / false / true, // use instead of customization.toolbar,
header: {
users: false/true // users list button
save: false/true // save button
},
leftMenu: {
navigation: false/true,
spellcheck: false/true // spellcheck button in sse
} / false / true, // use instead of customization.leftMenu
rightMenu: false/true, // use instead of customization.rightMenu
statusBar: {
textLang: false/true // text language button in de/pe
docLang: false/true // document language button in de/pe
actionStatus: false/true // status of operation
} / false / true, // use instead of customization.statusBar
},
features: { // disable feature
spellcheck: {
mode: false/true // init value in de/pe
change: false/true // hide/show feature in de/pe/sse
} / false / true // if false/true - use as init value in de/pe. use instead of customization.spellcheck parameter
}, },
chat: true, chat: true,
comments: true, comments: true,
zoom: 100, zoom: 100,
compactToolbar: false, compactToolbar: false,
leftMenu: true, // must be deprecated. use layout.leftMenu instead leftMenu: true,
rightMenu: true, // must be deprecated. use layout.rightMenu instead rightMenu: true,
hideRightMenu: false, // hide or show right panel on first loading hideRightMenu: false, // hide or show right panel on first loading
toolbar: true, // must be deprecated. use layout.toolbar instead toolbar: true,
statusBar: true, // must be deprecated. use layout.statusBar instead statusBar: true,
autosave: true, autosave: true,
forcesave: false, forcesave: false,
commentAuthorOnly: false, // must be deprecated. use permissions.editCommentAuthorOnly and permissions.deleteCommentAuthorOnly instead commentAuthorOnly: false,
showReviewChanges: false, // must be deprecated. use customization.review.showReviewChanges instead showReviewChanges: false,
help: true, help: true,
compactHeader: false, compactHeader: false,
toolbarNoTabs: false, toolbarNoTabs: false,
toolbarHideFileName: false, toolbarHideFileName: false,
reviewDisplay: 'original', // must be deprecated. use customization.review.reviewDisplay instead reviewDisplay: 'original',
spellcheck: true, // must be deprecated. use customization.features.spellcheck instead spellcheck: true
compatibleFeatures: false,
unit: 'cm' // cm, pt, inch,
mentionShare : true // customize tooltip for mention,
macros: true // can run macros in document
plugins: true // can run plugins in document
macrosMode: 'warn' // warn about automatic macros, 'enable', 'disable', 'warn',
trackChanges: undefined // true/false - open editor with track changes mode on/off, // must be deprecated. use customization.review.trackChanges instead
hideRulers: false // hide or show rulers on first loading (presentation or document editor)
hideNotes: false // hide or show notes panel on first loading (presentation editor)
uiTheme: 'theme-dark' // set interface theme: id or default-dark/default-light
integrationMode: "embed" // turn off scroll to frame
},
coEditing: {
mode: 'fast', // <coauthoring mode>, 'fast' or 'strict'. if 'fast' and 'customization.autosave'=false -> set 'customization.autosave'=true. 'fast' - default for editor
// for viewer: 'strict' is default, offline viewer; 'fast' - live viewer, show changes from other users
change: true, // can change co-authoring mode. true - default for editor, false - default for viewer
}, },
plugins: { plugins: {
autostart: ['asc.{FFE1F462-1EA2-4391-990D-4CC84940B754}'], autostart: ['asc.{FFE1F462-1EA2-4391-990D-4CC84940B754}'],
@ -233,37 +139,13 @@
"speech/config.json", "speech/config.json",
"clipart/config.json", "clipart/config.json",
] ]
},
wopi: { // only for wopi
FileNameMaxLength: 250 // max filename length for rename, 250 by default
} }
}, },
events: { events: {
'onAppReady': <application ready callback>, 'onAppReady': <application ready callback>,
'onBack': <back to folder callback>,
'onDocumentStateChange': <document state changed callback> 'onDocumentStateChange': <document state changed callback>
'onDocumentReady': <document ready callback> 'onDocumentReady': <document ready callback>
'onRequestEditRights': <request rights for switching from view to edit>,
'onRequestHistory': <request version history>,// must call refreshHistory method
'onRequestHistoryData': <request version data>,// must call setHistoryData method
'onRequestRestore': <try to restore selected version>,
'onRequestHistoryClose': <request closing history>,
'onError': <error callback>,
'onWarning': <warning callback>,
'onInfo': <document open callback>,// send view or edit mode
'onOutdatedVersion': <outdated version callback>,// send when previous version is opened
'onDownloadAs': <download as callback>,// send url of downloaded file as a response for downloadAs method
'onRequestSaveAs': <try to save copy of the document>,
'onCollaborativeChanges': <co-editing changes callback>,// send when other user co-edit document
'onRequestRename': <try to rename document>,
'onMetaChange': // send when meta information changed
'onRequestClose': <request close editor>,
'onMakeActionLink': <request link to document with bookmark, comment...>,// must call setActionLink method
'onRequestUsers': <request users list for mentions>,// must call setUsers method
'onRequestSendNotify': //send when user is mentioned in a comment,
'onRequestInsertImage': <try to insert image>,// must call insertImage method
'onRequestCompareFile': <request file to compare>,// must call setRevisedFile method
'onRequestSharingSettings': <request sharing settings>,// must call setSharingSettings method
'onRequestCreateNew': <try to create document>,
} }
} }
@ -273,7 +155,7 @@
type: 'embedded', type: 'embedded',
width: '100% by default', width: '100% by default',
height: '100% by default', height: '100% by default',
documentType: 'word' | 'cell' | 'slide',// deprecate 'text' | 'spreadsheet' | 'presentation', documentType: 'text' | 'spreadsheet' | 'presentation',
document: { document: {
title: 'document title', title: 'document title',
url: 'document url', url: 'document url',
@ -324,11 +206,7 @@
_config.editorConfig.canRequestSaveAs = _config.events && !!_config.events.onRequestSaveAs; _config.editorConfig.canRequestSaveAs = _config.events && !!_config.events.onRequestSaveAs;
_config.editorConfig.canRequestInsertImage = _config.events && !!_config.events.onRequestInsertImage; _config.editorConfig.canRequestInsertImage = _config.events && !!_config.events.onRequestInsertImage;
_config.editorConfig.canRequestMailMergeRecipients = _config.events && !!_config.events.onRequestMailMergeRecipients; _config.editorConfig.canRequestMailMergeRecipients = _config.events && !!_config.events.onRequestMailMergeRecipients;
_config.editorConfig.canRequestCompareFile = _config.events && !!_config.events.onRequestCompareFile;
_config.editorConfig.canRequestSharingSettings = _config.events && !!_config.events.onRequestSharingSettings;
_config.editorConfig.canRequestCreateNew = _config.events && !!_config.events.onRequestCreateNew;
_config.frameEditorId = placeholderId; _config.frameEditorId = placeholderId;
_config.parentOrigin = window.location.origin;
var onMouseUp = function (evt) { var onMouseUp = function (evt) {
_processMouse(evt); _processMouse(evt);
@ -375,12 +253,40 @@
} }
}; };
var _callLocalStorage = function(data) {
if (data.cmd == 'get') {
if (data.keys && data.keys.length) {
var af = data.keys.split(','), re = af[0];
for (i = 0; ++i < af.length;)
re += '|' + af[i];
re = new RegExp(re); k = {};
for (i in localStorage)
if (re.test(i)) k[i] = localStorage[i];
} else {
k = localStorage;
}
_sendCommand({
command: 'internalCommand',
data: {
type: 'localstorage',
keys: k
}
});
} else
if (data.cmd == 'set') {
var k = data.keys, i;
for (i in k) {
localStorage.setItem(i, k[i]);
}
}
};
var _onMessage = function(msg) { var _onMessage = function(msg) {
if ( msg ) { if ( msg ) {
if ( msg.type === "onExternalPluginMessage" ) { if ( msg.type === "onExternalPluginMessage" ) {
_sendCommand(msg); _sendCommand(msg);
} else if (msg.type === "onExternalPluginMessageCallback") {
postMessage(window.parent, msg);
} else } else
if ( msg.frameEditorId == placeholderId ) { if ( msg.frameEditorId == placeholderId ) {
var events = _config.events || {}, var events = _config.events || {},
@ -389,6 +295,8 @@
if (msg.event === 'onRequestEditRights' && !handler) { if (msg.event === 'onRequestEditRights' && !handler) {
_applyEditRights(false, 'handler isn\'t defined'); _applyEditRights(false, 'handler isn\'t defined');
} else if (msg.event === 'onInternalMessage' && msg.data && msg.data.type == 'localstorage') {
_callLocalStorage(msg.data.data);
} else { } else {
if (msg.event === 'onAppReady') { if (msg.event === 'onAppReady') {
_onAppReady(); _onAppReady();
@ -414,15 +322,9 @@
'text': 'docx', 'text': 'docx',
'text-pdf': 'pdf', 'text-pdf': 'pdf',
'spreadsheet': 'xlsx', 'spreadsheet': 'xlsx',
'presentation': 'pptx', 'presentation': 'pptx'
'word': 'docx',
'cell': 'xlsx',
'slide': 'pptx'
}, app; }, app;
if (_config.documentType=='text' || _config.documentType=='spreadsheet' ||_config.documentType=='presentation')
console.warn("The \"documentType\" parameter for the config object must take one of the values word/cell/slide.");
if (typeof _config.documentType === 'string' && _config.documentType != '') { if (typeof _config.documentType === 'string' && _config.documentType != '') {
app = appMap[_config.documentType.toLowerCase()]; app = appMap[_config.documentType.toLowerCase()];
if (!app) { if (!app) {
@ -434,20 +336,19 @@
} }
if (typeof _config.document.fileType === 'string' && _config.document.fileType != '') { if (typeof _config.document.fileType === 'string' && _config.document.fileType != '') {
_config.document.fileType = _config.document.fileType.toLowerCase(); var type = /^(?:(xls|xlsx|ods|csv|xlst|xlsy|gsheet|xlsm|xlt|xltm|xltx|fods|ots)|(pps|ppsx|ppt|pptx|odp|pptt|ppty|gslides|pot|potm|potx|ppsm|pptm|fodp|otp)|(doc|docx|doct|odt|gdoc|txt|rtf|pdf|mht|htm|html|epub|djvu|xps|docm|dot|dotm|dotx|fodt|ott))$/
var type = /^(?:(xls|xlsx|ods|csv|xlst|xlsy|gsheet|xlsm|xlt|xltm|xltx|fods|ots|xlsb)|(pps|ppsx|ppt|pptx|odp|pptt|ppty|gslides|pot|potm|potx|ppsm|pptm|fodp|otp)|(doc|docx|doct|odt|gdoc|txt|rtf|pdf|mht|htm|html|epub|djvu|xps|oxps|docm|dot|dotm|dotx|fodt|ott|fb2|xml|oform|docxf))$/
.exec(_config.document.fileType); .exec(_config.document.fileType);
if (!type) { if (!type) {
window.alert("The \"document.fileType\" parameter for the config object is invalid. Please correct it."); window.alert("The \"document.fileType\" parameter for the config object is invalid. Please correct it.");
return false; return false;
} else if (typeof _config.documentType !== 'string' || _config.documentType == ''){ } else if (typeof _config.documentType !== 'string' || _config.documentType == ''){
if (typeof type[1] === 'string') _config.documentType = 'cell'; else if (typeof type[1] === 'string') _config.documentType = 'spreadsheet'; else
if (typeof type[2] === 'string') _config.documentType = 'slide'; else if (typeof type[2] === 'string') _config.documentType = 'presentation'; else
if (typeof type[3] === 'string') _config.documentType = 'word'; if (typeof type[3] === 'string') _config.documentType = 'text';
} }
} }
var type = /^(?:(pdf|djvu|xps|oxps))$/.exec(_config.document.fileType); var type = /^(?:(pdf|djvu|xps))$/.exec(_config.document.fileType);
if (type && typeof type[1] === 'string') { if (type && typeof type[1] === 'string') {
_config.editorConfig.canUseHistory = false; _config.editorConfig.canUseHistory = false;
} }
@ -462,11 +363,6 @@
return false; return false;
} }
if (_config.editorConfig.user && _config.editorConfig.user.id && (typeof _config.editorConfig.user.id == 'number')) {
_config.editorConfig.user.id = _config.editorConfig.user.id.toString();
console.warn("The \"id\" parameter for the editorConfig.user object must be a string.");
}
_config.document.token = _config.token; _config.document.token = _config.token;
} }
@ -482,6 +378,8 @@
if (!_config.editorConfig.customization) _config.editorConfig.customization = {}; if (!_config.editorConfig.customization) _config.editorConfig.customization = {};
_config.editorConfig.customization.about = false; _config.editorConfig.customization.about = false;
_config.editorConfig.customization.compactHeader = false; _config.editorConfig.customization.compactHeader = false;
if ( window.AscDesktopEditor ) window.AscDesktopEditor.execCommand('webapps:events', 'loading');
} }
} }
})(); })();
@ -491,13 +389,6 @@
if (target && _checkConfigParams()) { if (target && _checkConfigParams()) {
iframe = createIframe(_config); iframe = createIframe(_config);
if (_config.editorConfig.customization && _config.editorConfig.customization.integrationMode==='embed')
window.AscEmbed && window.AscEmbed.initWorker(iframe);
if (iframe.src) {
var pathArray = iframe.src.split('/');
this.frameOrigin = pathArray[0] + '//' + pathArray[2];
}
target.parentNode && target.parentNode.replaceChild(iframe, target); target.parentNode && target.parentNode.replaceChild(iframe, target);
var _msgDispatcher = new MessageDispatcher(_onMessage, this); var _msgDispatcher = new MessageDispatcher(_onMessage, this);
} }
@ -684,27 +575,6 @@
}); });
}; };
var _setRevisedFile = function(data) {
_sendCommand({
command: 'setRevisedFile',
data: data
});
};
var _setFavorite = function(data) {
_sendCommand({
command: 'setFavorite',
data: data
});
};
var _requestClose = function(data) {
_sendCommand({
command: 'requestClose',
data: data
});
};
var _processMouse = function(evt) { var _processMouse = function(evt) {
var r = iframe.getBoundingClientRect(); var r = iframe.getBoundingClientRect();
var data = { var data = {
@ -720,22 +590,6 @@
}); });
}; };
var _grabFocus = function(data) {
setTimeout(function(){
_sendCommand({
command: 'grabFocus',
data: data
});
}, 10);
};
var _blurFocus = function(data) {
_sendCommand({
command: 'blurFocus',
data: data
});
};
var _serviceCommand = function(command, data) { var _serviceCommand = function(command, data) {
_sendCommand({ _sendCommand({
command: 'internalCommand', command: 'internalCommand',
@ -765,12 +619,7 @@
showSharingSettings : _showSharingSettings, showSharingSettings : _showSharingSettings,
setSharingSettings : _setSharingSettings, setSharingSettings : _setSharingSettings,
insertImage : _insertImage, insertImage : _insertImage,
setMailMergeRecipients: _setMailMergeRecipients, setMailMergeRecipients: _setMailMergeRecipients
setRevisedFile : _setRevisedFile,
setFavorite : _setFavorite,
requestClose : _requestClose,
grabFocus : _grabFocus,
blurFocus : _blurFocus
} }
}; };
@ -820,7 +669,7 @@
var _onMessage = function(msg) { var _onMessage = function(msg) {
// TODO: check message origin // TODO: check message origin
if (msg && window.JSON && _scope.frameOrigin==msg.origin ) { if (msg && window.JSON) {
try { try {
var msg = window.JSON.parse(msg.data); var msg = window.JSON.parse(msg.data);
@ -858,70 +707,42 @@
return extensionParams["url"] + "apps/"; return extensionParams["url"] + "apps/";
} }
function getTestPath() {
var scripts = document.getElementsByTagName('script'),
match;
for (var i = scripts.length - 1; i >= 0; i--) {
match = scripts[i].src.match(/(.*)apps\/api\/documents\/api.js/i);
if (match) {
return match[1] + "test/";
}
}
return "";
}
function getAppPath(config) { function getAppPath(config) {
var extensionPath = getExtensionPath(), var extensionPath = getExtensionPath(),
path = extensionPath ? extensionPath : (config.type=="test" ? getTestPath() : getBasePath()), path = extensionPath ? extensionPath : getBasePath(),
appMap = { appMap = {
'text': 'documenteditor', 'text': 'documenteditor',
'text-pdf': 'documenteditor', 'text-pdf': 'documenteditor',
'spreadsheet': 'spreadsheeteditor', 'spreadsheet': 'spreadsheeteditor',
'presentation': 'presentationeditor', 'presentation': 'presentationeditor'
'word': 'documenteditor',
'cell': 'spreadsheeteditor',
'slide': 'presentationeditor'
}, },
app = appMap['word']; app = appMap['text'];
if (typeof config.documentType === 'string') { if (typeof config.documentType === 'string') {
app = appMap[config.documentType.toLowerCase()]; app = appMap[config.documentType.toLowerCase()];
} else } else
if (!!config.document && typeof config.document.fileType === 'string') { if (!!config.document && typeof config.document.fileType === 'string') {
var type = /^(?:(xls|xlsx|ods|csv|xlst|xlsy|gsheet|xlsm|xlt|xltm|xltx|fods|ots|xlsb)|(pps|ppsx|ppt|pptx|odp|pptt|ppty|gslides|pot|potm|potx|ppsm|pptm|fodp|otp))$/ var type = /^(?:(xls|xlsx|ods|csv|xlst|xlsy|gsheet|xlsm|xlt|xltm|xltx|fods|ots)|(pps|ppsx|ppt|pptx|odp|pptt|ppty|gslides|pot|potm|potx|ppsm|pptm|fodp|otp))$/
.exec(config.document.fileType); .exec(config.document.fileType);
if (type) { if (type) {
if (typeof type[1] === 'string') app = appMap['cell']; else if (typeof type[1] === 'string') app = appMap['spreadsheet']; else
if (typeof type[2] === 'string') app = appMap['slide']; if (typeof type[2] === 'string') app = appMap['presentation'];
} }
} }
var userAgent = navigator.userAgent.toLowerCase(),
check = function(regex){ return regex.test(userAgent); },
isIE = !check(/opera/) && (check(/msie/) || check(/trident/) || check(/edge/)),
isChrome = !isIE && check(/\bchrome\b/),
isSafari_mobile = !isIE && !isChrome && check(/safari/) && (navigator.maxTouchPoints>0),
path_type;
path += app + "/"; path += app + "/";
path_type = (config.type === "mobile" || isSafari_mobile) path += config.type === "mobile"
? "mobile" : (config.type === "embedded") ? "mobile"
? "embed" : (config.document && typeof config.document.fileType === 'string' && config.document.fileType.toLowerCase() === 'oform') : config.type === "embedded"
? "forms" : "main"; ? "embed"
: "main";
path += path_type;
var index = "/index.html"; var index = "/index.html";
if (config.editorConfig && path_type!=="forms") { if (config.editorConfig && config.editorConfig.targetApp!=='desktop') {
var customization = config.editorConfig.customization; var customization = config.editorConfig.customization;
if ( typeof(customization) == 'object' && ( customization.toolbarNoTabs || if ( typeof(customization) == 'object' && (customization.loaderName || customization.loaderLogo)) {
(config.editorConfig.targetApp!=='desktop') && (customization.loaderName || customization.loaderLogo))) {
index = "/index_loader.html"; index = "/index_loader.html";
} else if (config.editorConfig.mode === 'editdiagram' || config.editorConfig.mode === 'editmerge' || config.editorConfig.mode === 'editole') }
index = "/index_internal.html";
} }
path += index; path += index;
return path; return path;
@ -935,46 +756,22 @@
if (config.editorConfig && config.editorConfig.targetApp!=='desktop') { if (config.editorConfig && config.editorConfig.targetApp!=='desktop') {
if ( (typeof(config.editorConfig.customization) == 'object') && config.editorConfig.customization.loaderName) { if ( (typeof(config.editorConfig.customization) == 'object') && config.editorConfig.customization.loaderName) {
if (config.editorConfig.customization.loaderName !== 'none') params += "&customer=" + encodeURIComponent(config.editorConfig.customization.loaderName); if (config.editorConfig.customization.loaderName !== 'none') params += "&customer=" + config.editorConfig.customization.loaderName;
} else } else
params += "&customer={{APP_CUSTOMER_NAME}}"; params += "&customer=ONLYOFFICE";
if (typeof(config.editorConfig.customization) == 'object') { if ( (typeof(config.editorConfig.customization) == 'object') && config.editorConfig.customization.loaderLogo) {
if ( config.editorConfig.customization.loaderLogo && config.editorConfig.customization.loaderLogo !== '') { if (config.editorConfig.customization.loaderLogo !== '') params += "&logo=" + config.editorConfig.customization.loaderLogo;
params += "&logo=" + encodeURIComponent(config.editorConfig.customization.loaderLogo); } else if ( (typeof(config.editorConfig.customization) == 'object') && config.editorConfig.customization.logo) {
} if (config.type=='embedded' && config.editorConfig.customization.logo.imageEmbedded)
if ( config.editorConfig.customization.logo ) { params += "&headerlogo=" + config.editorConfig.customization.logo.imageEmbedded;
if (config.type=='embedded' && (config.editorConfig.customization.logo.image || config.editorConfig.customization.logo.imageEmbedded)) else if (config.type!='embedded' && config.editorConfig.customization.logo.image)
params += "&headerlogo=" + encodeURIComponent(config.editorConfig.customization.logo.image || config.editorConfig.customization.logo.imageEmbedded); params += "&headerlogo=" + config.editorConfig.customization.logo.image;
else if (config.type!='embedded' && (config.editorConfig.customization.logo.image || config.editorConfig.customization.logo.imageDark)) {
config.editorConfig.customization.logo.image && (params += "&headerlogo=" + encodeURIComponent(config.editorConfig.customization.logo.image));
config.editorConfig.customization.logo.imageDark && (params += "&headerlogodark=" + encodeURIComponent(config.editorConfig.customization.logo.imageDark));
} }
} }
}
}
if (config.editorConfig && (config.editorConfig.mode == 'editdiagram' || config.editorConfig.mode == 'editmerge' || config.editorConfig.mode == 'editole'))
params += "&internal=true";
if (config.frameEditorId) if (config.frameEditorId)
params += "&frameEditorId=" + config.frameEditorId; params += "&frameEditorId=" + config.frameEditorId;
if (config.editorConfig && config.editorConfig.mode == 'view' ||
config.document && config.document.permissions && (config.document.permissions.edit === false && !config.document.permissions.review ))
params += "&mode=view";
if (config.editorConfig && config.editorConfig.customization && !!config.editorConfig.customization.compactHeader)
params += "&compact=true";
if (config.editorConfig && config.editorConfig.customization && (config.editorConfig.customization.toolbar===false))
params += "&toolbar=false";
if (config.parentOrigin)
params += "&parentOrigin=" + config.parentOrigin;
if (config.editorConfig && config.editorConfig.customization && config.editorConfig.customization.uiTheme )
params += "&uitheme=" + config.editorConfig.customization.uiTheme;
return params; return params;
} }
@ -987,11 +784,9 @@
iframe.align = "top"; iframe.align = "top";
iframe.frameBorder = 0; iframe.frameBorder = 0;
iframe.name = "frameEditor"; iframe.name = "frameEditor";
config.title && (typeof config.title === 'string') && (iframe.title = config.title);
iframe.allowFullscreen = true; iframe.allowFullscreen = true;
iframe.setAttribute("allowfullscreen",""); // for IE11 iframe.setAttribute("allowfullscreen",""); // for IE11
iframe.setAttribute("onmousewheel",""); // for Safari on Mac iframe.setAttribute("onmousewheel",""); // for Safari on Mac
iframe.setAttribute("allow", "autoplay; camera; microphone; display-capture; clipboard-write;");
if (config.type == "mobile") if (config.type == "mobile")
{ {

View file

@ -21,7 +21,7 @@
var editor = new Asc.asc_docs_api({ var editor = new Asc.asc_docs_api({
'id-view' : 'editor_sdk' 'id-view' : 'editor_sdk'
}); });
editor.asc_loadFontsFromServer(); editor.LoadFontsFromServer();
</script> </script>
</body> </body>
</html> </html>

View file

@ -53,7 +53,7 @@
type: urlParams['type'], type: urlParams['type'],
width: '100%', width: '100%',
height: '100%', height: '100%',
documentType: urlParams['doctype'] || 'word', documentType: urlParams['doctype'] || 'text',
document: doc, document: doc,
editorConfig: cfg, editorConfig: cfg,
events: { events: {
@ -80,7 +80,7 @@
} }
function getDocumentData(urlParams) { function getDocumentData(urlParams) {
let docparams = { return {
key: urlParams["key"], key: urlParams["key"],
url: urlParams["url"] || '_offline_', url: urlParams["url"] || '_offline_',
title: urlParams["title"], title: urlParams["title"],
@ -91,25 +91,15 @@
download: true download: true
} }
}; };
if (urlParams['mode'] == 'review')
docparams.permissions.edit = !(docparams.permissions.review = true);
return docparams;
} }
function getEditorConfig(urlParams) { function getEditorConfig(urlParams) {
return { return {
customization : { customization : {
goback: { url: "onlyoffice.com" } goback: { url: "onlyoffice.com" }
, feedback: {
url: "https://helpdesk.onlyoffice.com/?desktop=true"
}
, uiTheme: urlParams["uitheme"]
}, },
mode : urlParams["mode"] || 'edit', mode : urlParams["mode"] || 'edit',
lang : urlParams["lang"] || 'en', lang : urlParams["lang"] || 'en',
createUrl : 'desktop://create.new',
user: { user: {
id: urlParams["userid"] || urlParams["username"] || 'uid-901', name: urlParams["username"] || 'Chuk.Gek' id: urlParams["userid"] || urlParams["username"] || 'uid-901', name: urlParams["username"] || 'Chuk.Gek'
} }

View file

@ -1,369 +0,0 @@
<!DOCTYPE html>
<html>
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="mobile-web-app-capable" content="yes" />
<!--
*
* (c) Copyright Ascensio System SIA 2021
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
-->
<title>ONLYOFFICE</title>
<style type="text/css">
html {
height: 100%;
width: 100%;
}
body {
background: #fff;
color: #333;
font-family: Arial, Tahoma,sans-serif;
font-size: 12px;
font-weight: normal;
height: 100%;
margin: 0;
overflow-y: hidden;
padding: 0;
text-decoration: none;
}
.form {
height: 100%;
}
div {
margin: 0;
padding: 0;
}
.app-error-panel {
position: absolute;
width: 100%;
height: 100%;
top: 0;
background-color: #f4f4f4;
z-index: 10;
}
.message-block {
display: inline-block;
vertical-align: middle;
width: 100%;
}
.message-inner {
width: 550px;
margin: auto;
padding: 30px;
background-color: #e3e3e3;
text-align: center;
}
.title {
font-size: 24px;
margin: 0 0 14px;
}
.text {
font-size: 16px;
}
</style>
</head>
<body>
<div class="form">
<div id="iframeEditor">
</div>
</div>
<script type="text/javascript" src="../../../web-apps/apps/api/documents/api.js"></script>
<script type="text/javascript" language="javascript">
var docEditor;
var postMessageOrigin;
var lang = "en-US";
var startTime;
var documentChanged;
var sendNotificationTimer;
var sessionId;
var fileInfo;
var insertImageType;
var innerAlert = function (message) {
if (console && console.log)
console.log(message);
};
var commandMap = {
'Blur_Focus': function (data) {
innerAlert('Blur_Focus');
docEditor.blurFocus();
},
'Grab_Focus': function (data) {
innerAlert('Grab_Focus');
docEditor.grabFocus();
},
'Action_InsertGraphic': function (data) {
data && data.Values && docEditor.insertImage({
"c": insertImageType,
"images": [{ "url": data.Values.url }]
});
},
'Host_PostmessageReady': function (data) {
innerAlert('Host_PostmessageReady');
}
};
var _postMessage = function(msgId, msgData) {
if (window.parent && window.JSON) {
msgData = msgData || {};
msgData["ui-language"] = lang;
msgData["wdUserSession"] = sessionId;
var msg = {
"MessageId": msgId,
"SendTime": Date.now(),
"Values": msgData
};
window.parent.postMessage(window.JSON.stringify(msg), postMessageOrigin);
}
};
var _onMessage = function(msg) {
if (msg.origin !== postMessageOrigin) return;
var data = msg.data;
if (Object.prototype.toString.apply(data) !== '[object String]' || !window.JSON) {
return;
}
var cmd, handler;
try {
cmd = window.JSON.parse(data)
} catch(e) {
cmd = '';
}
if (cmd) {
handler = commandMap[cmd.MessageId];
if (handler) {
handler.call(this, cmd);
}
}
};
var fn = function(e) { _onMessage(e); };
if (window.attachEvent) {
window.attachEvent('onmessage', fn);
} else {
window.addEventListener('message', fn, false);
}
var onAppReady = function () {
_postMessage('App_LoadingStatus', {
"DocumentLoadedTime": Date.now() - startTime
});
innerAlert("App ready");
};
var sendEditNotification = function () {
documentChanged && _postMessage('Edit_Notification', {});
documentChanged = false;
};
var onDocumentStateChange = function (event) {
if (event.data) {
documentChanged = true;
if (sendNotificationTimer===undefined) {
sendNotificationTimer = setInterval(sendEditNotification, 30000);
sendEditNotification();
}
}
};
var onRequestRename = function (event) {
if (event.data) {
_postMessage('File_Rename', {
"NewName": event.data
});
}
};
var onRequestClose = function () {
if (fileInfo.ClosePostMessage)
_postMessage('UI_Close', {});
else if (fileInfo.CloseUrl)
window.parent.location.href = fileInfo.CloseUrl;
};
var onRequestEditRights = function () {
if (fileInfo.EditModePostMessage)
_postMessage('UI_Edit', {});
else if (fileInfo.HostEditUrl)
window.open(fileInfo.HostEditUrl, "_blank");
};
var onRequestSharingSettings = function (event) {
if (fileInfo.FileSharingPostMessage)
_postMessage('UI_Sharing', {});
else if (fileInfo.FileSharingUrl)
window.open(fileInfo.FileSharingUrl, "_blank");
};
var onRequestHistory = function (event) {
if (fileInfo.FileVersionPostMessage)
_postMessage('UI_FileVersions', {});
else if (fileInfo.FileVersionUrl)
window.open(fileInfo.FileVersionUrl, "_blank");
};
var onRequestInsertImage = function (event) {
insertImageType = event.data.c;
_postMessage('UI_InsertGraphic', {});
};
var onError = function (event) {
if (event)
innerAlert(event.data);
};
var connectEditor = function () {
fileInfo = <%- JSON.stringify(fileInfo) %>;
var key = "<%- key %>";
var documentType = "<%- documentType %>";
var userAuth = <%- JSON.stringify(userAuth) %>;
var token = "<%- token %>";
var queryParams = <%- JSON.stringify(queryParams) %>;
if (!fileInfo.BaseFileName) {
showError();
return;
}
var fileType = fileInfo.BaseFileName ? fileInfo.BaseFileName.substr(fileInfo.BaseFileName.lastIndexOf('.') + 1) : "";
var config = {
"width": "100%",
"height": "100%",
"type": queryParams.embed==="1" ? "embedded" : "desktop",
"documentType": documentType,
"token": token,
"document": {
"title": fileInfo.BreadcrumbDocName || fileInfo.BaseFileName,
"url": userAuth.wopiSrc,
"fileType": fileInfo.FileExtension ? fileInfo.FileExtension.substr(1) : fileType,
"key": key,
"info": {
"folder": fileInfo.BreadcrumbFolderName
},
"permissions": {
"edit": !fileInfo.ReadOnly && fileInfo.UserCanWrite,
"review": (fileInfo.SupportsReviewing===false) ? false : (fileInfo.UserCanReview===false ? false : fileInfo.UserCanReview),
"copy": fileInfo.CopyPasteRestrictions!=="CurrentDocumentOnly" && fileInfo.CopyPasteRestrictions!=="BlockAll",
"print": !fileInfo.DisablePrint && !fileInfo.HidePrintOption
}
},
"editorConfig": {
"mode": userAuth.mode,
"lang": queryParams.lang || queryParams.ui || "en-US",
"region": queryParams.rs,
"callbackUrl": JSON.stringify(userAuth),
"user": {
"id": fileInfo.UserId,
"name": fileInfo.IsAnonymousUser ? "" : fileInfo.UserFriendlyName
},
"customization": {
"about": true,
"goback": {
"url": fileInfo.BreadcrumbFolderUrl
},
"customer": {
"name": fileInfo.BreadcrumbBrandName,
"www": fileInfo.BreadcrumbBrandUrl
},
"chat": queryParams.dchat!=="1",
"uiTheme": queryParams.thm==="1" ? "default-light" : (queryParams.thm==="2" ? "default-dark" : undefined)
},
"coEditing": {
"mode": userAuth.mode !== "view" ? "fast" : "strict",
"change": false
},
"wopi": {
"FileNameMaxLength": fileInfo.FileNameMaxLength && fileInfo.FileNameMaxLength>0 ? fileInfo.FileNameMaxLength : 250
}
},
"events": {
"onAppReady": onAppReady,
"onDocumentStateChange": fileInfo.EditNotificationPostMessage ? onDocumentStateChange : undefined,
'onRequestEditRights': fileInfo.EditModePostMessage || fileInfo.HostEditUrl ? onRequestEditRights : undefined,
"onError": onError,
"onRequestClose": fileInfo.ClosePostMessage || fileInfo.CloseUrl ? onRequestClose : undefined,
"onRequestRename": fileInfo.SupportsRename && fileInfo.UserCanRename ? onRequestRename : undefined,
"onRequestSharingSettings": fileInfo.FileSharingPostMessage || fileInfo.FileSharingUrl ? onRequestSharingSettings : undefined,
"onRequestHistory": fileInfo.FileVersionUrl || fileInfo.FileVersionPostMessage ? onRequestHistory : undefined,
"onRequestInsertImage": fileInfo.EnableInsertRemoteImage ? onRequestInsertImage : undefined
}
};
postMessageOrigin = fileInfo.PostMessageOrigin || "*";
if (postMessageOrigin && (typeof postMessageOrigin === 'string') && postMessageOrigin.charAt(postMessageOrigin.length-1)=='/')
postMessageOrigin = postMessageOrigin.substring(0, postMessageOrigin.length - 1);
lang = config.editorConfig.lang;
sessionId = userAuth.userSessionId;
startTime = Date.now();
docEditor = new DocsAPI.DocEditor("iframeEditor", config);
fixSize();
};
var fixSize = function () {
var wrapEl = document.getElementsByClassName("form");
if (wrapEl.length) {
wrapEl[0].style.height = screen.availHeight + "px";
window.scrollTo(0, -1);
wrapEl[0].style.height = window.innerHeight + "px";
}
};
var showError = function(msg, title) {
msg = msg || 'Sorry, editor could not be loaded. Please contact your administrator.';
var newDiv = document.createElement("div");
newDiv.className = "app-error-panel";
newDiv.innerHTML = '<div class="message-block">' +
'<div class="message-inner">' +
(title ? '<div class="title">' + title + '</div>' : '') +
'<div class="text">' + msg + '</div>' +
'</div>' +
'</div>';
document.body.appendChild(newDiv);
};
if (window.addEventListener) {
window.addEventListener("load", connectEditor);
window.addEventListener("resize", fixSize);
} else if (window.attachEvent) {
window.attachEvent("onload", connectEditor);
window.attachEvent("onresize", fixSize);
}
</script>
</body>
</html>

View file

@ -30,8 +30,8 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
* *
*/ */
if (window.Common === undefined) if (Common === undefined)
window.Common = {}; var Common = {};
Common.component = Common.component || {}; Common.component = Common.component || {};

View file

@ -31,8 +31,8 @@
* *
*/ */
if (window.Common === undefined) { if (Common === undefined) {
window.Common = {}; var Common = {};
} }
Common.Gateway = new(function() { Common.Gateway = new(function() {
@ -118,26 +118,6 @@ if (window.Common === undefined) {
'setMailMergeRecipients': function(data) { 'setMailMergeRecipients': function(data) {
$me.trigger('setmailmergerecipients', data); $me.trigger('setmailmergerecipients', data);
},
'setRevisedFile': function(data) {
$me.trigger('setrevisedfile', data);
},
'setFavorite': function(data) {
$me.trigger('setfavorite', data);
},
'requestClose': function(data) {
$me.trigger('requestclose', data);
},
'blurFocus': function(data) {
$me.trigger('blurfocus', data);
},
'grabFocus': function(data) {
$me.trigger('grabfocus', data);
} }
}; };
@ -151,8 +131,6 @@ if (window.Common === undefined) {
var _onMessage = function(msg) { var _onMessage = function(msg) {
// TODO: check message origin // TODO: check message origin
if (msg.origin !== window.parentOrigin && msg.origin !== window.location.origin && !(msg.origin==="null" && (window.parentOrigin==="file://" || window.location.origin==="file://"))) return;
var data = msg.data; var data = msg.data;
if (Object.prototype.toString.apply(data) !== '[object String]' || !window.JSON) { if (Object.prototype.toString.apply(data) !== '[object String]' || !window.JSON) {
return; return;
@ -203,13 +181,12 @@ if (window.Common === undefined) {
}); });
}, },
requestRestore: function(version, url, fileType) { requestRestore: function(version, url) {
_postMessage({ _postMessage({
event: 'onRequestRestore', event: 'onRequestRestore',
data: { data: {
version: version, version: version,
url: url, url: url
fileType: fileType
} }
}); });
}, },
@ -274,23 +251,19 @@ if (window.Common === undefined) {
_postMessage({ event: 'onOutdatedVersion' }); _postMessage({ event: 'onOutdatedVersion' });
}, },
downloadAs: function(url, fileType) { downloadAs: function(url) {
_postMessage({ _postMessage({
event: 'onDownloadAs', event: 'onDownloadAs',
data: { data: url
url: url,
fileType: fileType
}
}); });
}, },
requestSaveAs: function(url, title, fileType) { requestSaveAs: function(url, title) {
_postMessage({ _postMessage({
event: 'onRequestSaveAs', event: 'onRequestSaveAs',
data: { data: {
url: url, url: url,
title: title, title: title
fileType: fileType
} }
}); });
}, },
@ -316,39 +289,23 @@ if (window.Common === undefined) {
}, },
requestMakeActionLink: function (config) { requestMakeActionLink: function (config) {
_postMessage({event:'onMakeActionLink', data: config}); _postMessage({event:'onMakeActionLink', data: config})
}, },
requestUsers: function () { requestUsers: function () {
_postMessage({event:'onRequestUsers'}); _postMessage({event:'onRequestUsers'})
}, },
requestSendNotify: function (emails) { requestSendNotify: function (emails) {
_postMessage({event:'onRequestSendNotify', data: emails}); _postMessage({event:'onRequestSendNotify', data: emails})
}, },
requestInsertImage: function (command) { requestInsertImage: function () {
_postMessage({event:'onRequestInsertImage', data: {c: command}}); _postMessage({event:'onRequestInsertImage'})
}, },
requestMailMergeRecipients: function () { requestMailMergeRecipients: function () {
_postMessage({event:'onRequestMailMergeRecipients'}); _postMessage({event:'onRequestMailMergeRecipients'})
},
requestCompareFile: function () {
_postMessage({event:'onRequestCompareFile'});
},
requestSharingSettings: function () {
_postMessage({event:'onRequestSharingSettings'});
},
requestCreateNew: function () {
_postMessage({event:'onRequestCreateNew'});
},
pluginsReady: function() {
_postMessage({ event: 'onPluginsReady' });
}, },
on: function(event, handler){ on: function(event, handler){

View file

@ -69,7 +69,7 @@ Common.IrregularStack = function(config) {
} }
var _get = function(obj) { var _get = function(obj) {
var index = (typeof obj === 'object')? _indexOf(obj, _weakCompare) : obj; var index = _indexOf(obj, _weakCompare);
if (index != -1) if (index != -1)
return _stack[index]; return _stack[index];
return undefined; return undefined;
@ -79,15 +79,10 @@ Common.IrregularStack = function(config) {
return !(_indexOf(obj, _strongCompare) < 0); return !(_indexOf(obj, _strongCompare) < 0);
} }
var _length = function() {
return _stack.length;
}
return { return {
push: _push, push: _push,
pop: _pop, pop: _pop,
get: _get, get: _get,
exist: _exist, exist: _exist
length: _length
} }
}; };

View file

@ -57,16 +57,6 @@
$dlgShare.find('#btn-copyshort').on('click', copytext.bind(this, $dlgShare.find('#id-short-url'))); $dlgShare.find('#btn-copyshort').on('click', copytext.bind(this, $dlgShare.find('#id-short-url')));
$dlgShare.find('.share-buttons > span').on('click', function(e){ $dlgShare.find('.share-buttons > span').on('click', function(e){
if ( window.config ) {
const key = $(e.target).attr('data-name');
const btn = config.btnsShare[key];
if ( btn && btn.getUrl ) {
window.open(btn.getUrl(appConfig.shareUrl, appConfig.docTitle), btn.target || '',
btn.features || 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=300,width=600');
return;
}
}
var _url; var _url;
switch ($(e.target).attr('data-name')) { switch ($(e.target).attr('data-name')) {
case 'facebook': case 'facebook':
@ -78,6 +68,10 @@
!!appConfig.docTitle && (_url += encodeURIComponent('&text=' + appConfig.docTitle)); !!appConfig.docTitle && (_url += encodeURIComponent('&text=' + appConfig.docTitle));
window.open(_url, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=300,width=600'); window.open(_url, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=300,width=600');
break; break;
case 'gplus':
_url = 'https://plus.google.com/share?url=' + appConfig.shareUrl;
window.open(_url, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes');
break;
case 'email': case 'email':
window.open(_mailto, '_self'); window.open(_mailto, '_self');
break; break;

View file

@ -1,137 +0,0 @@
/*
*
* (c) Copyright Ascensio System SIA 2010-2021
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
!window.common && (window.common = {});
common.localStorage = new (function() {
var _storeName, _filter;
var _store = {};
var ongetstore = function(data) {
if (data.type == 'localstorage') {
_store = data.keys;
}
};
Common.Gateway.on('internalcommand', ongetstore);
var _refresh = function() {
if (!_lsAllowed)
Common.Gateway.internalMessage('localstorage', {cmd:'get', keys:_filter});
};
var _save = function() {
if (!_lsAllowed)
Common.Gateway.internalMessage('localstorage', {cmd:'set', keys:_store});
};
var _setItem = function(name, value, just) {
if (_lsAllowed) {
try
{
localStorage.setItem(name, value);
}
catch (error){}
} else {
_store[name] = value;
if (just===true) {
Common.Gateway.internalMessage('localstorage', {
cmd:'set',
keys: {
name: value
}
});
}
}
};
var _setItemAsBool = function(name, value, just) {
_setItem(name, value ? 1 : 0, just);
};
var _getItem = function(name) {
if (_lsAllowed)
return localStorage.getItem(name);
else
return _store[name]===undefined ? null : _store[name];
};
var _getItemAsBool = function (name, defValue) {
var value = _getItem(name);
defValue = defValue || false;
return (value!==null) ? (parseInt(value) != 0) : defValue;
};
var _getItemExists = function (name) {
var value = _getItem(name);
return value !== null;
};
var _removeItem = function(name) {
if (_lsAllowed)
localStorage.removeItem(name);
else
delete _store[name];
};
try {
var _lsAllowed = !!window.localStorage;
} catch (e) {
_lsAllowed = false;
}
return {
getId: function() {
return _storeName;
},
setId: function(name) {
_storeName = name;
},
getItem: _getItem,
getBool: _getItemAsBool,
setBool: _setItemAsBool,
setItem: _setItem,
removeItem: _removeItem,
setKeysFilter: function(value) {
_filter = value;
},
getKeysFilter: function() {
return _filter;
},
itemExists: _getItemExists,
sync: _refresh,
save: _save
};
})();

View file

@ -36,11 +36,6 @@
!common.utils && (common.utils = {}); !common.utils && (common.utils = {});
common.utils = new(function(){ common.utils = new(function(){
var userAgent = navigator.userAgent.toLowerCase(),
check = function(regex){
return regex.test(userAgent);
},
isMac = check(/macintosh|mac os x/);
return { return {
openLink: function(url) { openLink: function(url) {
if (url) { if (url) {
@ -79,35 +74,7 @@
}, },
htmlEncode: function(value) { htmlEncode: function(value) {
return $('<div/>').text(value).html(); return $('<div/>').text(value).html();
},
fillUserInfo: function(info, lang, defname, defid) {
var _user = info || {};
_user.anonymous = !_user.id;
!_user.id && (_user.id = defid);
_user.fullname = !_user.name ? defname : _user.name;
_user.group && (_user.fullname = (_user.group).toString() + AscCommon.UserInfoParser.getSeparator() + _user.fullname);
_user.guest = !_user.name;
return _user;
},
fixedDigits: function(num, digits, fill) {
(fill===undefined) && (fill = '0');
var strfill = "",
str = num.toString();
for (var i=str.length; i<digits; i++) strfill += fill;
return strfill + str;
},
getKeyByValue: function(obj, value) {
for(var prop in obj) {
if(obj.hasOwnProperty(prop)) {
if(obj[prop] === value)
return prop;
} }
}
},
isMac : isMac
}; };
})(); })();
}(); }();

View file

@ -1,101 +0,0 @@
/*
*
* (c) Copyright Ascensio System SIA 2010-2021
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
/**
* LoadMask.js
*
* Displays loading mask over selected element(s) or component. Accepts both single and multiple selectors.
*
* Created by Julia Radzhabova 24.06.2021
* Copyright (c) 2021 Ascensio System SIA. All rights reserved.
*
*/
!window.common && (window.common = {});
!common.view && (common.view = {});
common.view.LoadMask = function(owner) {
var tpl = '<div class="asc-loadmask-body" role="presentation" tabindex="-1">' +
'<i id="loadmask-spinner" class="asc-loadmask-image"></i>' +
'<div class="asc-loadmask-title"></div>' +
'</div>';
var ownerEl = owner || $(document.body),
loaderEl,
maskedEl,
title = '',
timerId = 0,
rendered = false;
return {
show: function(){
if (!loaderEl || !maskedEl) {
loaderEl = $(tpl);
maskedEl = $('<div class="asc-loadmask"></div>');
}
$('.asc-loadmask-title', loaderEl).html(title);
// show mask after 500 ms if it wont be hided
if (!rendered) {
rendered = true;
timerId = setTimeout(function () {
ownerEl.append(maskedEl);
ownerEl.append(loaderEl);
loaderEl.css('min-width', $('.asc-loadmask-title', loaderEl).width() + 105);
},500);
}
},
hide: function() {
if (timerId) {
clearTimeout(timerId);
timerId = 0;
}
maskedEl && maskedEl.remove();
loaderEl && loaderEl.remove();
maskedEl = loaderEl = null;
rendered = false;
},
setTitle: function(text) {
title = text;
if (ownerEl && loaderEl){
var el = $('.asc-loadmask-title', loaderEl);
el.html(title);
loaderEl.css('min-width', el.width() + 105);
}
}
}
};

View file

@ -1,77 +0,0 @@
/*
*
* (c) Copyright Ascensio System SIA 2010-2020
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
/**
* SearchBar.js
*
* Created by Julia Svinareva on 27.04.2022
* Copyright (c) 2022 Ascensio System SIA. All rights reserved.
*
*/
!window.common && (window.common = {});
!common.view && (common.view = {});
common.view.SearchBar = new(function() {
var tpl = '<div class="asc-window search-window" style="display: none;">' +
'<div class="body">{body}</div>' +
'</div>';
var tplBody = '<input type="text" id="search-bar-text" placeholder="{textFind}" autocomplete="off">' +
'<div class="tools">' +
'<button id="search-bar-back" class="svg-icon search-arrow-up"></button>' +
'<button id="search-bar-next" class="svg-icon search-arrow-down"></button>' +
'<button id="search-bar-close" class="svg-icon search-close"></button>' +
'</div>';
return {
create: function(parent) {
!parent && (parent = 'body');
var _$dlg = $(tpl
.replace(/\{body}/, tplBody)
.replace(/\{textFind}/, this.textFind))
.appendTo(parent)
.attr('id', 'dlg-search');
return _$dlg;
},
disableNavButtons: function (resultNumber, allResults) {
var disable = $('#search-bar-text').val() === '' || !allResults;
$('#search-bar-back').attr({disabled: disable});
$('#search-bar-next').attr({disabled: disable});
},
textFind: 'Find'
};
})();

View file

@ -55,6 +55,7 @@ common.view.modals = new(function() {
'<div class="share-buttons">' + '<div class="share-buttons">' +
'<span class="svg big-facebook" data-name="facebook"></span>' + '<span class="svg big-facebook" data-name="facebook"></span>' +
'<span class="svg big-twitter" data-name="twitter"></span>' + '<span class="svg big-twitter" data-name="twitter"></span>' +
'<span class="svg big-gplus" data-name="gplus"></span>' +
'<span class="svg big-email" data-name="email"></span>' + '<span class="svg big-email" data-name="email"></span>' +
'<div class="autotest" id="email" style="display: none"></div>' + '<div class="autotest" id="email" style="display: none"></div>' +
'</div>'; '</div>';
@ -73,20 +74,6 @@ common.view.modals = new(function() {
var _$dlg; var _$dlg;
if (name == 'share') { if (name == 'share') {
if ( window.config && window.config.btnsShare ) {
let _btns = [];
for (const key of Object.keys(config.btnsShare))
_btns.push(`<span class="svg big-${key}" data-name="${key}"></span>`);
if ( _btns ) {
let $sharebox = $(_tplbody_share);
$sharebox.find('.autotest').prevAll().remove();
$sharebox.eq(1).prepend(_btns.join(''));
_tplbody_share = $("<div>").append($sharebox).html();
}
}
_$dlg = $(tplDialog _$dlg = $(tplDialog
.replace(/\{title}/, this.txtShare) .replace(/\{title}/, this.txtShare)
.replace(/\{body}/, _tplbody_share) .replace(/\{body}/, _tplbody_share)

View file

@ -1,220 +1 @@
<svg width="580" height="40" viewBox="0 0 580 40" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="88 -11 242 44"><style>.st0{fill:#fff;} .st2{fill-rule:evenodd;clip-rule:evenodd;}</style><g id="XMLID_7_"><path id="XMLID_9_" d="M128 6h-14c-.6 0-1 .4-1 1s.4 1 1 1h14c.6 0 1-.4 1-1s-.4-1-1-1z"/><path id="XMLID_8_" d="M120.1 3.6c.1.1.2.2.4.2.1.1.3.1.5.1s.3-.1.5-.1c.1 0 .3-.1.4-.2l3.5-3.5c.4-.4.4-1 0-1.4s-1-.4-1.4 0l-2 2V-7c0-.6-.4-1-1-1s-1 .4-1 1V.7l-2-2c-.4-.4-1-.4-1.4 0s-.4 1 0 1.4l3.5 3.5z"/></g><path id="XMLID_14_" d="M147.3 3c-.8 0-1.5.3-2.1.8l-4.7-2.7c.1-.3.2-.7.2-1.1s-.1-.8-.2-1.1l4.7-2.7c.6.5 1.3.8 2.1.8 1.7 0 3.1-1.4 3.1-3.1s-1.4-3.1-3.1-3.1-3.1 1.4-3.1 3.1c0 .3 0 .5.1.8l-4.9 2.8c-.5-.4-1.1-.6-1.8-.6-1.7 0-3.1 1.4-3.1 3.1s1.4 3.1 3.1 3.1c.7 0 1.3-.2 1.8-.6l4.8 2.8c-.1.3-.1.5-.1.8 0 1.7 1.4 3.1 3.1 3.1 1.7 0 3.1-1.4 3.1-3.1.1-1.7-1.3-3.1-3-3.1z"/><path d="M159.3 0l4-4c.5-.5.5-1.2 0-1.7s-1.2-.5-1.7 0l-4.4 4.4c-.2 0-.4.1-.6.3-.3.3-.4.7-.3 1 0 .3.1.7.3 1 .2.2.4.3.6.3l4.4 4.4c.5.5 1.2.5 1.7 0s.5-1.2 0-1.7l-4-4zm14.1-1c-.2-.2-.4-.3-.6-.3l-4.4-4.4c-.5-.5-1.2-.5-1.7 0s-.5 1.2 0 1.7l4 4-4 4c-.5.5-.5 1.2 0 1.7s1.2.5 1.7 0l4.4-4.4c.2 0 .4-.1.6-.3.3-.3.4-.7.3-1 .1-.3 0-.7-.3-1z"/><g id="XMLID_4_"><path id="XMLID_21_" d="M194.9-7.3c0-.1-.1-.2-.2-.3-.1-.1-.2-.2-.3-.2-.2-.2-.3-.2-.4-.2h-4.2c-.5 0-.8.4-.8.8 0 .5 1 1.2 1 1.2l.8.8-2.6 2.6c-.4.4-.4 1 0 1.4s1 .4 1.4 0l2.6-2.6 1.3 1.4c.1.2.4.4.7.4.5 0 .8-.4.8-.8V-7c0-.1 0-.2-.1-.3z"/><path id="XMLID_22_" d="M184.4 1.2l-2.6 2.6-1.3-1.4c-.1-.2-.4-.4-.7-.4-.5 0-.8.4-.8.8V7c0 .1 0 .3.1.4 0 .1.1.2.2.3.1.1.2.2.3.2.2.1.3.1.4.1h4.2c.5 0 .8-.4.8-.8S184 6 184 6l-.8-.8 2.6-2.6c.4-.4.4-1 0-1.4-.4-.4-1-.4-1.4 0z"/></g><path id="imgtools" d="M90-6v2h18v-2H90zm0 7h18v-2H90v2zm0 5h18V4H90v2z"/><path id="imgplus" d="M210-8h-2v7h-7v2h7v7h2V1h7v-2h-7v-7z"/><path id="imgminus" d="M223-1h16v2h-16z"/><path id="play" d="M305 0l-16-7V6.9L305 0z"/><path id="rmove" class="st2" d="M279.9-.2L272.1-8 270-5.9l5.8 5.8-5.8 5.9 2.1 2.1 7.8-7.8.1-.2z"/><path id="lmove" class="st2" d="M258-5.8l-2.1-2.1-7.8 7.8-.1.2.1.1 7.8 7.8 2.1-2.1-5.8-5.8z"/><path d="M313-7h4V7h-4zm8 0h4V7h-4z" id="pause"/><use xlink:href="#imgtools" class="st0" y="22"/><use xlink:href="#imgplus" class="st0" y="22"/><use xlink:href="#imgminus" class="st0" y="22"/><use xlink:href="#play" class="st0" y="22" x="2"/><use xlink:href="#pause" class="st0" y="22"/><use xlink:href="#rmove" class="st0" x="1" y="22"/><use xlink:href="#lmove" class="st0" x="-1" y="22"/></svg>
<g id="icon-menu-sprite Embedded Viewer">
<g id="view-settings">
<path id="Vector" d="M17 26H3V27H17V26Z" fill="white"/>
<path id="Vector_2" d="M17 30H3V31H17V30Z" fill="white"/>
<path id="Vector_3" d="M17 34H3V35H17V34Z" fill="white"/>
</g>
<g id="download">
<path id="Union" fill-rule="evenodd" clip-rule="evenodd" d="M31 22H30V33.2929L25.3536 28.6464L24.6465 29.3536L30.1465 34.8536L30.5 35.2071L30.8536 34.8536L36.3536 29.3536L35.6465 28.6464L31 33.2929V22Z" fill="white"/>
<rect id="Rectangle 88" x="24" y="36" width="13" height="1" fill="white"/>
</g>
<g id="share">
<path id="share_2" d="M56 25C56 26.1046 55.1046 27 54 27C53.4663 27 52.9815 26.791 52.6229 26.4503L47.9076 29.3974C47.9676 29.5875 48 29.79 48 30C48 30.21 47.9676 30.4125 47.9076 30.6026L52.6229 33.5497C52.9815 33.209 53.4663 33 54 33C55.1046 33 56 33.8954 56 35C56 36.1046 55.1046 37 54 37C52.8954 37 52 36.1046 52 35C52 34.79 52.0324 34.5875 52.0924 34.3974L47.3771 31.4503C47.0185 31.791 46.5337 32 46 32C44.8954 32 44 31.1046 44 30C44 28.8954 44.8954 28 46 28C46.5337 28 47.0185 28.209 47.3771 28.5497L52.0924 25.6026C52.0324 25.4125 52 25.21 52 25C52 23.8954 52.8954 23 54 23C55.1046 23 56 23.8954 56 25Z" fill="white"/>
</g>
<g id="embed ">
<g id="embed _2">
<path d="M67.8536 25.3536L67.1465 24.6465L62.293 29.5L67.1465 34.3536L67.8536 33.6465L63.7072 29.5L67.8536 25.3536Z" fill="white"/>
<path d="M72.1465 25.3536L72.8536 24.6465L77.7072 29.5L72.8536 34.3536L72.1465 33.6465L76.293 29.5L72.1465 25.3536Z" fill="white"/>
</g>
</g>
<g id="full-screen">
<path id="Rectangle 81 (Stroke)" fill-rule="evenodd" clip-rule="evenodd" d="M93 27H87V33H93V27ZM86 26V34H94V26H86Z" fill="white"/>
<path id="Subtract" fill-rule="evenodd" clip-rule="evenodd" d="M86 23H83V26H84V24H86V23Z" fill="white"/>
<path id="Subtract_2" fill-rule="evenodd" clip-rule="evenodd" d="M97 26L97 23L94 23L94 24L96 24L96 26L97 26Z" fill="white"/>
<path id="Subtract_3" fill-rule="evenodd" clip-rule="evenodd" d="M94 37L97 37L97 34L96 34L96 36L94 36L94 37Z" fill="white"/>
<path id="Subtract_4" fill-rule="evenodd" clip-rule="evenodd" d="M83 34L83 37L86 37L86 36L84 36L84 34L83 34Z" fill="white"/>
</g>
<g id="zoom-in">
<path id="Union_2" fill-rule="evenodd" clip-rule="evenodd" d="M111 25H110V30H105V31H110V36H111V31H116V30H111V25Z" fill="white"/>
</g>
<g id="zoom-out">
<rect id="Rectangle 44.8" x="135" y="30" width="1" height="10" transform="rotate(90 135 30)" fill="white"/>
</g>
<g id="scroll-to-first-sheet">
<path id="Vector 13 (Stroke)" fill-rule="evenodd" clip-rule="evenodd" d="M155 25L147 30L155 35V25Z" fill="white"/>
<path id="Rectangle 225" d="M145 25H146V35H145V25Z" fill="white"/>
</g>
<g id="scroll-to-last-sheet">
<path id="Vector 13 (Stroke)_2" fill-rule="evenodd" clip-rule="evenodd" d="M165 35L173 30L165 25V35Z" fill="white"/>
<path id="Rectangle 225 (Stroke)" fill-rule="evenodd" clip-rule="evenodd" d="M174 35H175V25H174V35Z" fill="white"/>
</g>
<g id="play">
<path id="Vector 8 (Stroke)" fill-rule="evenodd" clip-rule="evenodd" d="M185 23L198 30L185 37V23Z" fill="white"/>
</g>
<g id="pause">
<path id="Rectangle 81 (Stroke)_2" fill-rule="evenodd" clip-rule="evenodd" d="M205 25V35H209V25H205Z" fill="white"/>
<path id="Rectangle 81.1 (Stroke)" fill-rule="evenodd" clip-rule="evenodd" d="M211 25V35H215V25H211Z" fill="white"/>
</g>
<g id=" print">
<path id="Union_3" fill-rule="evenodd" clip-rule="evenodd" d="M226 24H234V26H226V24ZM225 26V24C225 23.4477 225.448 23 226 23H234C234.552 23 235 23.4477 235 24V26H237C237.552 26 238 26.4477 238 27V33C238 33.5523 237.552 34 237 34H235V36C235 36.5523 234.552 37 234 37H226C225.448 37 225 36.5523 225 36V34H223C222.448 34 222 33.5523 222 33V27C222 26.4477 222.448 26 223 26H225ZM225 33V31C225 30.4477 225.448 30 226 30H234C234.552 30 235 30.4477 235 31V33H237V27H234H226H223V33H225ZM225 28H224V29H225V28ZM234 31H226V36H234V31ZM227 32H233V33H227V32ZM233 34H227V35H233V34Z" fill="white"/>
</g>
<g id="clear-style">
<path id="Union_4" fill-rule="evenodd" clip-rule="evenodd" d="M253.268 24.5608C252.291 23.5845 250.708 23.5845 249.732 24.5608L243.561 30.7324C242.584 31.7087 242.584 33.2916 243.561 34.268L245.146 35.8537L245.293 36.0002L245.5 36.0002H249.5L249.707 36.0002L255 36.0002V35.0002H250.707L255.439 30.268C256.416 29.2916 256.416 27.7087 255.439 26.7324L253.268 24.5608ZM249.293 35.0002L252.793 31.5002L248.5 27.2073L244.268 31.4395C243.682 32.0253 243.682 32.9751 244.268 33.5609L245.707 35.0002L249.293 35.0002ZM249.207 26.5002L253.5 30.7931L254.732 29.5608C255.318 28.9751 255.318 28.0253 254.732 27.4395L252.561 25.268C251.975 24.6822 251.025 24.6822 250.439 25.268L249.207 26.5002Z" fill="white"/>
</g>
<g id="view-settings_2">
<path id="Vector_4" d="M17 6H3V7H17V6Z" fill="black"/>
<path id="Vector_5" d="M17 10H3V11H17V10Z" fill="black"/>
<path id="Vector_6" d="M17 14H3V15H17V14Z" fill="black"/>
</g>
<g id="download_2">
<path id="Union_5" fill-rule="evenodd" clip-rule="evenodd" d="M31 2H30V13.2929L25.3536 8.64645L24.6465 9.35355L30.1465 14.8536L30.5 15.2071L30.8536 14.8536L36.3536 9.35355L35.6465 8.64645L31 13.2929V2Z" fill="black"/>
<rect id="Rectangle 88_2" x="24" y="16" width="13" height="1" fill="black"/>
</g>
<g id="share_3">
<path id="share_4" d="M56 5C56 6.10457 55.1046 7 54 7C53.4663 7 52.9815 6.79098 52.6229 6.45034L47.9076 9.39737C47.9676 9.58754 48 9.78999 48 10C48 10.21 47.9676 10.4125 47.9076 10.6026L52.6229 13.5497C52.9815 13.209 53.4663 13 54 13C55.1046 13 56 13.8954 56 15C56 16.1046 55.1046 17 54 17C52.8954 17 52 16.1046 52 15C52 14.79 52.0324 14.5875 52.0924 14.3974L47.3771 11.4503C47.0185 11.791 46.5337 12 46 12C44.8954 12 44 11.1046 44 10C44 8.89543 44.8954 8 46 8C46.5337 8 47.0185 8.20902 47.3771 8.54966L52.0924 5.60264C52.0324 5.41246 52 5.21001 52 5C52 3.89543 52.8954 3 54 3C55.1046 3 56 3.89543 56 5Z" fill="black"/>
</g>
<g id="embed _3">
<g id="embed _4">
<path d="M67.8536 5.35359L67.1465 4.64648L62.293 9.50004L67.1465 14.3536L67.8536 13.6465L63.7072 9.50004L67.8536 5.35359Z" fill="black"/>
<path d="M72.1465 5.35359L72.8536 4.64648L77.7072 9.50004L72.8536 14.3536L72.1465 13.6465L76.293 9.50004L72.1465 5.35359Z" fill="black"/>
</g>
</g>
<g id="full-screen_2">
<path id="Rectangle 81 (Stroke)_3" fill-rule="evenodd" clip-rule="evenodd" d="M93 7H87V13H93V7ZM86 6V14H94V6H86Z" fill="black"/>
<path id="Subtract_5" fill-rule="evenodd" clip-rule="evenodd" d="M86 3H83V6H84V4H86V3Z" fill="black"/>
<path id="Subtract_6" fill-rule="evenodd" clip-rule="evenodd" d="M97 6L97 3L94 3L94 4L96 4L96 6L97 6Z" fill="black"/>
<path id="Subtract_7" fill-rule="evenodd" clip-rule="evenodd" d="M94 17L97 17L97 14L96 14L96 16L94 16L94 17Z" fill="black"/>
<path id="Subtract_8" fill-rule="evenodd" clip-rule="evenodd" d="M83 14L83 17L86 17L86 16L84 16L84 14L83 14Z" fill="black"/>
</g>
<g id="zoom-in_2">
<path id="Union_6" fill-rule="evenodd" clip-rule="evenodd" d="M111 5H110V10H105V11H110V16H111V11H116V10H111V5Z" fill="black"/>
</g>
<g id="zoom-out_2">
<rect id="Rectangle 44.8_2" x="135" y="10" width="1" height="10" transform="rotate(90 135 10)" fill="black"/>
</g>
<g id="scroll-to-first-sheet_2">
<path id="Vector 13 (Stroke)_3" fill-rule="evenodd" clip-rule="evenodd" d="M155 5L147 10L155 15V5Z" fill="black"/>
<path id="Rectangle 225_2" d="M145 5H146V15H145V5Z" fill="black"/>
</g>
<g id="scroll-to-last-sheet_2">
<path id="Vector 13 (Stroke)_4" fill-rule="evenodd" clip-rule="evenodd" d="M165 15L173 10L165 5V15Z" fill="black"/>
<path id="Rectangle 225 (Stroke)_2" fill-rule="evenodd" clip-rule="evenodd" d="M174 15H175V5H174V15Z" fill="black"/>
</g>
<g id="play_2">
<path id="Vector 8 (Stroke)_2" fill-rule="evenodd" clip-rule="evenodd" d="M185 3L198 10L185 17V3Z" fill="black"/>
</g>
<g id="pause_2">
<path id="Rectangle 81 (Stroke)_4" fill-rule="evenodd" clip-rule="evenodd" d="M205 5V15H209V5H205Z" fill="black"/>
<path id="Rectangle 81.1 (Stroke)_2" fill-rule="evenodd" clip-rule="evenodd" d="M211 5V15H215V5H211Z" fill="black"/>
</g>
<g id=" print_2">
<path id="Union_7" fill-rule="evenodd" clip-rule="evenodd" d="M226 4H234V6H226V4ZM225 6V4C225 3.44772 225.448 3 226 3H234C234.552 3 235 3.44772 235 4V6H237C237.552 6 238 6.44772 238 7V13C238 13.5523 237.552 14 237 14H235V16C235 16.5523 234.552 17 234 17H226C225.448 17 225 16.5523 225 16V14H223C222.448 14 222 13.5523 222 13V7C222 6.44772 222.448 6 223 6H225ZM225 13V11C225 10.4477 225.448 10 226 10H234C234.552 10 235 10.4477 235 11V13H237V7H234H226H223V13H225ZM225 8H224V9H225V8ZM234 11H226V16H234V11ZM227 12H233V13H227V12ZM233 14H227V15H233V14Z" fill="black"/>
</g>
<g id="clear-style_2">
<path id="Union_8" fill-rule="evenodd" clip-rule="evenodd" d="M253.268 4.56085C252.291 3.58454 250.708 3.58453 249.732 4.56085L243.561 10.7324C242.584 11.7087 242.584 13.2916 243.561 14.268L245.146 15.8537L245.293 16.0002L245.5 16.0002H249.5L249.707 16.0002L255 16.0002V15.0002H250.707L255.439 10.268C256.416 9.29164 256.416 7.70873 255.439 6.73242L253.268 4.56085ZM249.293 15.0002L252.793 11.5002L248.5 7.20729L244.268 11.4395C243.682 12.0253 243.682 12.9751 244.268 13.5609L245.707 15.0002L249.293 15.0002ZM249.207 6.50019L253.5 10.7931L254.732 9.56085C255.318 8.97506 255.318 8.02531 254.732 7.43953L252.561 5.26795C251.975 4.68217 251.025 4.68217 250.439 5.26795L249.207 6.50019Z" fill="black"/>
</g>
<g id="edit">
<path id="Vector_7" d="M263 34V37H266L274 29L271 26L263 34Z" fill="white"/>
<path id="Vector 2" d="M275 28L272 25L274 23H275L277 25V26L275 28Z" fill="white"/>
</g>
<g id="more-vertical">
<circle id="Ellipse" cx="290" cy="26" r="1" transform="rotate(90 290 26)" fill="white"/>
<circle id="Ellipse_2" cx="290" cy="30" r="1" transform="rotate(90 290 30)" fill="white"/>
<circle id="Ellipse_3" cx="290" cy="34" r="1" transform="rotate(90 290 34)" fill="white"/>
</g>
<g id="go-to-location">
<path id="Vector_8" d="M317 26H311V25C311 24.45 310.55 24 310 24H303C302.45 24 302 24.45 302 25V36C302 36.55 302.45 37 303 37H317C317.55 37 318 36.55 318 36V27C318 26.45 317.55 26 317 26ZM317 36H303V25H310V27H317V36Z" fill="white"/>
<path id="Union_9" fill-rule="evenodd" clip-rule="evenodd" d="M309.646 33.6465L310.354 34.3536L313.207 31.5L310.354 28.6465L309.646 29.3536L311.268 30.9747H306V31.9747H311.318L309.646 33.6465Z" fill="white"/>
</g>
<g id="arrow-down">
<path id="Union_10" fill-rule="evenodd" clip-rule="evenodd" d="M331 23H330V34.2929L325.354 29.6464L324.646 30.3536L330.146 35.8536L330.5 36.2071L330.854 35.8536L336.354 30.3536L335.646 29.6464L331 34.2929V23Z" fill="white"/>
</g>
<g id="edit_2">
<path id="Vector_9" d="M263 14V17H266L274 9L271 6L263 14Z" fill="black"/>
<path id="Vector 2_2" d="M275 8L272 5L274 3H275L277 5V6L275 8Z" fill="black"/>
</g>
<g id="more-vertical_2">
<circle id="Ellipse_4" cx="290" cy="6" r="1" transform="rotate(90 290 6)" fill="black"/>
<circle id="Ellipse_5" cx="290" cy="10" r="1" transform="rotate(90 290 10)" fill="black"/>
<circle id="Ellipse_6" cx="290" cy="14" r="1" transform="rotate(90 290 14)" fill="black"/>
</g>
<g id="go-to-location_2">
<path id="Vector_10" d="M317 6H311V5C311 4.45 310.55 4 310 4H303C302.45 4 302 4.45 302 5V16C302 16.55 302.45 17 303 17H317C317.55 17 318 16.55 318 16V7C318 6.45 317.55 6 317 6ZM317 16H303V5H310V7H317V16Z" fill="black"/>
<path id="Union_11" fill-rule="evenodd" clip-rule="evenodd" d="M309.646 13.6465L310.354 14.3536L313.207 11.5L310.354 8.64648L309.646 9.35359L311.268 10.9747H306V11.9747H311.318L309.646 13.6465Z" fill="black"/>
</g>
<g id="arrow-down_2">
<path id="Union_12" fill-rule="evenodd" clip-rule="evenodd" d="M331 3H330V14.2929L325.354 9.64645L324.646 10.3536L330.146 15.8536L330.5 16.2071L330.854 15.8536L336.354 10.3536L335.646 9.64645L331 14.2929V3Z" fill="black"/>
</g>
<g id="arrow-up">
<path id="Union_13" fill-rule="evenodd" clip-rule="evenodd" d="M350 36.207L351 36.207L351 24.9141L355.646 29.5606L356.354 28.8535L350.854 23.3535L350.5 22.9999L350.146 23.3535L344.646 28.8535L345.354 29.5606L350 24.9141L350 36.207Z" fill="white"/>
</g>
<g id="arrow-up_2">
<path id="Union_14" fill-rule="evenodd" clip-rule="evenodd" d="M350 16.207L351 16.207L351 4.91414L355.646 9.56059L356.354 8.85348L350.854 3.35348L350.5 2.99993L350.146 3.35348L344.646 8.85348L345.354 9.56059L350 4.91414L350 16.207Z" fill="black"/>
</g>
<g id="close">
<path id="Vector 73" d="M366 25L375 34M375 25L366 34" stroke="white" stroke-width="1.5"/>
</g>
<g id="close_2">
<path id="Vector 73_2" d="M366 5L375 14M375 5L366 14" stroke="black" stroke-width="1.5"/>
</g>
<g id="сut">
<circle id="Ellipse 103" cx="385.5" cy="13.5" r="2" stroke="black"/>
<circle id="Ellipse 104" cx="385.5" cy="6.5" r="2" stroke="black"/>
<path id="Rectangle 1552" d="M387.188 7.56689L398.446 14.0669V14.0669C398.17 14.5452 397.559 14.7091 397.08 14.4329L386.688 8.43292L387.188 7.56689Z" fill="black"/>
<path id="Rectangle 1553" d="M386.688 11.5669L397.08 5.56689C397.558 5.29075 398.17 5.45463 398.446 5.93292V5.93292L387.188 12.4329L386.688 11.5669Z" fill="black"/>
</g>
<g id="сut_2">
<circle id="Ellipse 103_2" cx="385.5" cy="33.5" r="2" stroke="white"/>
<circle id="Ellipse 104_2" cx="385.5" cy="26.5" r="2" stroke="white"/>
<path id="Rectangle 1552_2" d="M387.188 27.5669L398.446 34.0669V34.0669C398.17 34.5452 397.559 34.7091 397.08 34.4329L386.688 28.4329L387.188 27.5669Z" fill="white"/>
<path id="Rectangle 1553_2" d="M386.688 31.5669L397.08 25.5669C397.558 25.2908 398.17 25.4546 398.446 25.9329V25.9329L387.188 32.4329L386.688 31.5669Z" fill="white"/>
</g>
<g id="copy">
<path id="Union_27" fill-rule="evenodd" clip-rule="evenodd" d="M404 5H412V7H413V5C413 4.44772 412.552 4 412 4H404C403.448 4 403 4.44772 403 5V12C403 12.5523 403.448 13 404 13H406V12H404V5ZM411 6H405V7H411V6ZM408 9V16H416V9H408ZM408 8C407.448 8 407 8.44772 407 9V16C407 16.5523 407.448 17 408 17H416C416.552 17 417 16.5523 417 16V9C417 8.44772 416.552 8 416 8H408ZM406 8H405V9H406V8ZM405 10H406V11H405V10ZM415 11V10H409V11H415ZM415 12V13H409V12H415ZM415 15V14H409V15H415Z" fill="black"/>
</g>
<g id="copy_2">
<path id="Union_28" fill-rule="evenodd" clip-rule="evenodd" d="M404 25H412V27H413V25C413 24.4477 412.552 24 412 24H404C403.448 24 403 24.4477 403 25V32C403 32.5523 403.448 33 404 33H406V32H404V25ZM411 26H405V27H411V26ZM408 29V36H416V29H408ZM408 28C407.448 28 407 28.4477 407 29V36C407 36.5523 407.448 37 408 37H416C416.552 37 417 36.5523 417 36V29C417 28.4477 416.552 28 416 28H408ZM406 28H405V29H406V28ZM405 30H406V31H405V30ZM415 31V30H409V31H415ZM415 32V33H409V32H415ZM415 35V34H409V35H415Z" fill="white"/>
</g>
<g id="paste">
<path id="Union_29" fill-rule="evenodd" clip-rule="evenodd" d="M426 3H432V4H434C434.552 4 435 4.44772 435 5V7H434V5H432V6H426V5H424V12H426V13H424C423.448 13 423 12.5523 423 12V5C423 4.44772 423.448 4 424 4H426V3ZM436 16V9H428V16H436ZM428 8C427.448 8 427 8.44772 427 9V16C427 16.5523 427.448 17 428 17H436C436.552 17 437 16.5523 437 16V9C437 8.44772 436.552 8 436 8H428ZM429 11V10H435V11H429ZM435 12H429V13H435V12ZM429 15V14H435V15H429Z" fill="black"/>
</g>
<g id="paste_2">
<path id="Union_30" fill-rule="evenodd" clip-rule="evenodd" d="M426 23H432V24H434C434.552 24 435 24.4477 435 25V27H434V25H432V26H426V25H424V32H426V33H424C423.448 33 423 32.5523 423 32V25C423 24.4477 423.448 24 424 24H426V23ZM436 36V29H428V36H436ZM428 28C427.448 28 427 28.4477 427 29V36C427 36.5523 427.448 37 428 37H436C436.552 37 437 36.5523 437 36V29C437 28.4477 436.552 28 436 28H428ZM429 31V30H435V31H429ZM435 32H429V33H435V32ZM429 35V34H435V35H429Z" fill="white"/>
</g>
<g id="redo">
<path id="Vector" d="M469.1 7C471.1 7 473.2 8.3 474.5 9.5L477 7V14H470L472.5 11.5C471.7 10.2 469.9 9.1 468.2 9.1C465.7 9.1 462.8 10.8 462.5 13.2C462.9 9.7 465.5 7 469.1 7Z" fill="black"/>
</g>
<g id="redo_2">
<path id="Vector_2" d="M469.1 27C471.1 27 473.2 28.3 474.5 29.5L477 27V34H470L472.5 31.5C471.7 30.2 469.9 29.1 468.2 29.1C465.7 29.1 462.8 30.8 462.5 33.2C462.9 29.7 465.5 27 469.1 27Z" fill="white"/>
</g>
<g id="undo">
<path id="Vector_3" d="M450.9 7C448.9 7 446.8 8.3 445.5 9.5L443 7V14H450L447.5 11.5C448.3 10.2 450.1 9.1 451.8 9.1C454.3 9.1 457.2 10.8 457.5 13.2C457.1 9.7 454.5 7 450.9 7Z" fill="black"/>
</g>
<g id="undo_2">
<path id="Vector_4" d="M450.9 27C448.9 27 446.8 28.3 445.5 29.5L443 27V34H450L447.5 31.5C448.3 30.2 450.1 29.1 451.8 29.1C454.3 29.1 457.2 30.8 457.5 33.2C457.1 29.7 454.5 27 450.9 27Z" fill="white"/>
</g>
<g id="search">
<path id="Union_31" fill-rule="evenodd" clip-rule="evenodd" d="M493 8.5C493 10.9853 490.985 13 488.5 13C486.015 13 484 10.9853 484 8.5C484 6.01472 486.015 4 488.5 4C490.985 4 493 6.01472 493 8.5ZM492.02 12.7266C491.066 13.5217 489.839 14 488.5 14C485.462 14 483 11.5376 483 8.5C483 5.46243 485.462 3 488.5 3C491.538 3 494 5.46243 494 8.5C494 9.83875 493.522 11.0658 492.727 12.0195L496.854 16.1465L496.146 16.8536L492.02 12.7266Z" fill="black"/>
</g>
<g id="search_2">
<path id="Union_32" fill-rule="evenodd" clip-rule="evenodd" d="M493 28.5C493 30.9853 490.985 33 488.5 33C486.015 33 484 30.9853 484 28.5C484 26.0147 486.015 24 488.5 24C490.985 24 493 26.0147 493 28.5ZM492.02 32.7266C491.066 33.5217 489.839 34 488.5 34C485.462 34 483 31.5376 483 28.5C483 25.4624 485.462 23 488.5 23C491.538 23 494 25.4624 494 28.5C494 29.8387 493.522 31.0658 492.727 32.0195L496.854 36.1465L496.146 36.8536L492.02 32.7266Z" fill="white"/>
</g>
<g id="btn-sheet-view">
<path id="Union_33" fill-rule="evenodd" clip-rule="evenodd" d="M509.93 13C507.552 13 505.45 11.8151 504.184 10C505.45 8.18485 507.552 7 509.93 7C512.307 7 514.409 8.18486 515.675 10C514.409 11.8151 512.307 13 509.93 13ZM509.93 6C512.891 6 515.476 7.6088 516.859 10C515.476 12.3912 512.891 14 509.93 14C506.969 14 504.383 12.3912 503 10C504.383 7.60879 506.969 6 509.93 6ZM509.93 12C511.034 12 511.93 11.1046 511.93 10C511.93 8.89543 511.034 8 509.93 8C508.825 8 507.93 8.89543 507.93 10C507.93 11.1046 508.825 12 509.93 12Z" fill="black"/>
</g>
<g id="btn-sheet-view_2">
<path id="Union_34" fill-rule="evenodd" clip-rule="evenodd" d="M509.93 33C507.552 33 505.45 31.8151 504.184 30C505.45 28.1849 507.552 27 509.93 27C512.307 27 514.409 28.1849 515.675 30C514.409 31.8151 512.307 33 509.93 33ZM509.93 26C512.891 26 515.476 27.6088 516.859 30C515.476 32.3912 512.891 34 509.93 34C506.969 34 504.383 32.3912 503 30C504.383 27.6088 506.969 26 509.93 26ZM509.93 32C511.034 32 511.93 31.1046 511.93 30C511.93 28.8954 511.034 28 509.93 28C508.825 28 507.93 28.8954 507.93 30C507.93 31.1046 508.825 32 509.93 32Z" fill="white"/>
</g>
<g id="hide-password">
<path id="Subtract" fill-rule="evenodd" clip-rule="evenodd" d="M530.948 6.05196C530.638 6.01766 530.321 6 530 6C526.91 6 524.243 7.63505 523 10C523.439 10.8356 524.056 11.5801 524.807 12.1935L525.518 11.4821C524.979 11.055 524.519 10.5539 524.158 10C525.311 8.23092 527.473 7 530 7C530 7 530 7 530 7L530.948 6.05196ZM530 13C532.527 12.9999 534.689 11.769 535.842 10C535.481 9.44626 535.021 8.94525 534.482 8.51821L535.194 7.80682C535.944 8.42019 536.561 9.16455 537 10C535.757 12.3649 533.09 14 530 14C529.679 14 529.363 13.9824 529.052 13.9481L530 13Z" fill="black"/>
<path id="Vector 169" d="M525 15L535 5" stroke="black"/>
</g>
<g id="hide-password_2">
<path id="Subtract_2" fill-rule="evenodd" clip-rule="evenodd" d="M530.948 26.052C530.638 26.0177 530.321 26 530 26C526.91 26 524.243 27.6351 523 30C523.439 30.8356 524.056 31.5801 524.807 32.1935L525.518 31.4821C524.979 31.055 524.519 30.5539 524.158 30C525.311 28.2309 527.473 27 530 27C530 27 530 27 530 27L530.948 26.052ZM530 33C532.527 32.9999 534.689 31.769 535.842 30C535.481 29.4463 535.021 28.9453 534.482 28.5182L535.194 27.8068C535.944 28.4202 536.561 29.1646 537 30C535.757 32.3649 533.09 34 530 34C529.679 34 529.363 33.9824 529.052 33.9481L530 33Z" fill="white"/>
<path id="Vector 169_2" d="M525 35L535 25" stroke="white"/>
</g>
<g id="arrow-up">
<path id="Union_4" fill-rule="evenodd" clip-rule="evenodd" d="M550 6.29297L550.354 6.64652L555.854 12.1465L555.146 12.8536L550 7.70718L544.854 12.8536L544.146 12.1465L549.646 6.64652L550 6.29297Z" fill="black"/>
</g>
<g id="arrow-up_2">
<path id="Union_3" fill-rule="evenodd" clip-rule="evenodd" d="M550 26.293L550.354 26.6465L555.854 32.1465L555.146 32.8536L550 27.7072L544.854 32.8536L544.146 32.1465L549.646 26.6465L550 26.293Z" fill="white"/>
</g>
<g id="arrow-down">
<path id="Union_2" fill-rule="evenodd" clip-rule="evenodd" d="M570 13.7071L570.354 13.3536L575.854 7.85359L575.146 7.14648L570 12.2929L564.854 7.14648L564.146 7.85359L569.646 13.3536L570 13.7071Z" fill="black"/>
</g>
<g id="arrow-down_2">
<path id="Union" fill-rule="evenodd" clip-rule="evenodd" d="M570 33.7071L570.354 33.3536L575.854 27.8536L575.146 27.1465L570 32.2929L564.854 27.1465L564.146 27.8536L569.646 33.3536L570 33.7071Z" fill="white"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

@ -1,4 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="85" height="20" fill="none"> <svg id="Layer_2" xmlns="http://www.w3.org/2000/svg" viewBox="-4 23 100 24"><style>.st0{fill:#5B5B5B;} .st1{fill:#3A3A3A;} .st2{opacity:0.42;fill:#8C8C8C;enable-background:new ;} .st3{opacity:0.72;fill:#9B9B9B;enable-background:new ;} .st4{fill:#9B9B9B;}</style><path class="st0" d="M21.3 35.5c0-1.5.4-2.7 1.3-3.5.9-.8 1.9-1.2 3.1-1.2 1.2 0 2.2.4 3.1 1.2.9.8 1.3 1.9 1.3 3.5 0 1.5-.4 2.7-1.3 3.5-.9.8-1.9 1.2-3.1 1.2-1.2 0-2.2-.4-3.1-1.2-.8-.8-1.3-2-1.3-3.5zm1.9 0c0 1.1.2 1.8.6 2.3.4.5.8.8 1.3.9.1 0 .2 0 .3.1h.6c.1 0 .2 0 .3-.1.5-.1.9-.4 1.3-.9s.6-1.3.6-2.3c0-1-.2-1.8-.6-2.3-.4-.5-.8-.8-1.3-.9-.1 0-.2-.1-.3-.1h-.6c-.1 0-.2 0-.3.1-.5.1-.9.4-1.3.9s-.6 1.2-.6 2.3zm7.8-4.4h2.4l3.1 5.6.5 1.2v-6.8h1.8V40h-2.3l-3.2-5.9-.4-1h-.1l.1 1.6V40H31zm9.3 0h1.9v7.4h3.6V40h-5.5zm4.4 0h2.1l1.8 3 .2.7h.1l.3-.7 1.8-3h2l-3.3 5.2V40H48v-3.7z"/><path class="st1" d="M53.1 35.5c0-1.5.4-2.7 1.3-3.5.9-.8 1.9-1.2 3.1-1.2s2.2.4 3.1 1.2c.9.8 1.3 1.9 1.3 3.5 0 1.5-.4 2.7-1.3 3.5-.9.8-1.9 1.2-3.1 1.2-1.2 0-2.2-.4-3.1-1.2-.9-.8-1.3-2-1.3-3.5zm1.9 0c0 1.1.2 1.8.6 2.3.4.5.8.8 1.3.9.1 0 .2 0 .3.1h.6c.1 0 .2 0 .3-.1.5-.1.9-.4 1.3-.9s.6-1.3.6-2.3c0-1-.2-1.8-.6-2.3s-.8-.8-1.3-.9c-.1 0-.2-.1-.3-.1h-.6s-.2 0-.3.1c-.5.1-.9.4-1.3.9s-.6 1.2-.6 2.3zm7.8-4.4h5v1.5h-3.2v2.1h3.1v1.5h-3.1V40h-1.8zm6.1 0h5v1.5h-3.2v2.1h3v1.5h-3V40h-1.8zm6 8.9v-8.9h1.9V40zM85 31.3v1.6c-.3-.1-.6-.2-1-.3s-.7-.1-1.1-.1c-1 0-1.7.3-2.2.9-.5.6-.8 1.3-.8 2.2s.2 1.6.7 2.2c.5.6 1.2.9 2.1.9.3 0 .7 0 1-.1.4 0 .8-.2 1.2-.3l.1 1.5c-.1 0-.1.1-.2.1s-.2.1-.4.1h-.8c-.3 0-.7.1-1.1.1h-.4c-1-.1-2-.5-2.9-1.2-.9-.7-1.3-1.8-1.3-3.4 0-1.5.4-2.6 1.3-3.5.9-.8 2-1.2 3.4-1.2h1c.3 0 .6.1.9.2.1 0 .1 0 .2.1s.2.1.3.2zm1.1-.2h5.5v1.4H88v2.1h3.2V36H88v2.6h3.6V40h-5.5z"/><path class="st2" d="M7.4 43.1l-7.7-3.7c-.7-.3-.7-.8 0-1.1L2.3 37l5.1 2.4c.7.3 1.7.3 2.4 0l5.1-2.4 2.7 1.3c.7.3.7.8 0 1.1l-7.7 3.7c-.7.3-1.8.3-2.5 0z"/><path class="st3" d="M7.4 38.7L-.3 35c-.7-.3-.7-.8 0-1.1l2.7-1.3L7.5 35c.7.3 1.7.3 2.4 0l5.2-2.4 2.7 1.2c.7.3.7.8 0 1.1L10 38.6c-.8.4-1.9.4-2.6.1z"/><path class="st4" d="M7.4 34.3l-7.7-3.7c-.7-.3-.7-.8 0-1.1l7.7-3.7c.7-.3 1.7-.3 2.4 0l7.7 3.7c.7.3.7.8 0 1.1l-7.7 3.7c-.6.3-1.7.3-2.4 0z"/></svg>
<g fill-rule="evenodd" fill="#444"><path d="M20.211 7.003C19.395 7.655 19 8.658 19 9.987s.395 2.332 1.21 3.009S21.947 14 23.026 14c1.053 0 2-.326 2.79-1.003.79-.652 1.184-1.655 1.184-2.984 0-1.354-.395-2.332-1.184-3.009S24.105 6 23.026 6 21 6.326 20.211 7.003zm1.053 4.991c-.342-.426-.526-1.078-.526-2.006 0-.903.184-1.555.526-1.956.368-.426.763-.702 1.184-.803h0c.105-.025.211-.05.289-.05.079-.025.158-.025.263-.025h0a1.03 1.03 0 0 1 .145.013l.145.013c.079 0 .184.025.289.05.421.1.816.376 1.158.803s.526 1.103.526 1.981-.184 1.555-.526 1.981-.737.702-1.158.803l-.052.013c-.081.02-.15.037-.237.037-.105.025-.184.025-.29.025-.04 0-.085-.006-.132-.013h0l-.132-.013c-.087 0-.156-.017-.237-.037h0 0l-.052-.013c-.421-.1-.816-.376-1.184-.803zM30.134 6H28v8h1.639V9.282l-.026-1.41h.026l.416.897L32.866 14H35V6h-1.639v4.718l.026 1.41h-.026l-.416-1.077L30.134 6zm6.186 0H38v6.641h3.5V14h-5.18V6zm5.687 0H40l3.161 4.744V14h1.732v-3.256L48 6h-1.842l-1.787 2.821-.275.538h-.055l-.275-.538L42.007 6zM48 9.987c0-1.329.395-2.332 1.211-2.984C50 6.326 50.947 6 52.026 6s2 .326 2.79 1.003S56 8.658 56 10.013c0 1.329-.395 2.332-1.184 2.984-.79.677-1.737 1.003-2.79 1.003-1.079 0-2-.326-2.816-1.003C48.421 12.32 48 11.317 48 9.987zm1.737 0c0 .928.184 1.58.526 2.006.368.426.737.702 1.184.803.105.025.21.05.289.05.039 0 .086.006.132.013l.132.013c.105 0 .184 0 .289-.025.087 0 .156-.017.237-.037l.038-.009.014-.003c.421-.1.816-.376 1.158-.803s.526-1.103.526-1.981-.184-1.555-.526-1.981-.737-.702-1.158-.803c-.105-.025-.21-.05-.289-.05-.053 0-.099-.006-.145-.013L52 7.154c-.105 0-.184 0-.263.025-.079 0-.184.025-.289.05-.421.1-.816.376-1.184.803-.342.401-.526 1.053-.526 1.956zM62 6h-4.63v8H59v-3.359h2.871V9.282H59V7.359h3V6zm1.37 0H68v1.359h-3v1.923h2.871v1.359H65V14h-1.63V6zm6.13 0v8h1.638V6H69.5zm9 .202v1.363c-.273-.101-.546-.177-.843-.227a5.79 5.79 0 0 0-.967-.076c-.818 0-1.438.252-1.884.782-.446.505-.669 1.161-.669 1.943 0 .757.198 1.388.62 1.893s1.016.782 1.785.782c.236 0 .471-.019.739-.04h0l.129-.01c.322-.05.645-.126.992-.278l.099 1.338c-.05.025-.124.05-.198.076l-.322.076a4.65 4.65 0 0 1-.446.08h0l-.297.046-.917.05h-.248c-.893-.05-1.711-.404-2.455-1.009-.744-.631-1.116-1.615-1.116-2.927 0-1.287.372-2.297 1.091-3.003S75.302 6 76.517 6l.868.025c.236.022.454.063.684.106l.109.02c.025.013.056.019.087.025a.35.35 0 0 1 .087.025c.015-.016.04-.012.074-.007.021.003.046.007.074.007zM85 6h-5v8h5v-1.256h-3.336v-2.231h2.885V9.256h-2.885v-2H85V6z"/><path opacity=".5" d="M1.605 12.508l4.958 2.318c.503.229 1.348.229 1.874 0l4.936-2.307 1.188.557c.525.252.525.641 0 .87l-6.169 2.883c-.48.229-1.325.229-1.828 0L.394 13.945c-.526-.252-.526-.641 0-.87l1.21-.568z"/><path opacity=".75" d="M1.555 8.985l5.008 2.341c.503.229 1.348.229 1.874 0l5.008-2.341 1.161.544c.526.252.526.641 0 .87l-6.169 2.883c-.526.252-1.371.252-1.874 0L.394 10.398c-.526-.252-.526-.641 0-.87l1.161-.543z"/><path d="M6.563 9.825L.394 6.942c-.526-.252-.526-.641 0-.87l6.169-2.883c.525-.252 1.371-.252 1.874 0l6.169 2.883c.525.252.525.641 0 .87L8.437 9.825c-.526.229-1.371.229-1.874 0z"/>
</g><defs />
</svg>

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 323 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 323 B

View file

@ -53,24 +53,16 @@
@import "../../../../../vendor/bootstrap/less/responsive-utilities.less"; @import "../../../../../vendor/bootstrap/less/responsive-utilities.less";
@import "loadmask.less";
@toolbarBorderColor: #dbdbdb; @toolbarBorderColor: #dbdbdb;
@toolbarBorderShadowColor: #FAFAFA; @toolbarBorderShadowColor: #FAFAFA;
@toolbarTopColor: #F7F7F7; @toolbarTopColor: #EBEBEB;
@toolbarBottomColor: #CCCCCC; @toolbarBottomColor: #CCCCCC;
@toolbarHoverColor: #7698DE; @toolbarHoverColor: #7698DE;
@toolbarFontSize: 12px; @toolbarFontSize: 12px;
@buttonFontSize: 11px;
@controlBtnHoverTopColor: #6180C4; @controlBtnHoverTopColor: #6180C4;
@controlBtnHoverBottomColor: #8AACF1; @controlBtnHoverBottomColor: #8AACF1;
@btnColor: #d8dadc; @btnColor: #d8dadc;
@btnActiveColor: #7d858c; @btnActiveColor: #7d858c;
@btnColored: #446995;
@btnActiveColored: #293F59;
@btnHoverColored: #375478;
@notificationColor: #fcfed7;
@iconSpriteCommonPath: "../../../../common/embed/resources/img/glyphicons.png"; @iconSpriteCommonPath: "../../../../common/embed/resources/img/glyphicons.png";
@icon-socnet-size: 40px; @icon-socnet-size: 40px;
@ -99,13 +91,13 @@
right: 0; right: 0;
&.top { &.top {
top: 28px; top: 32px;
bottom: 0; bottom: 0;
} }
&.bottom { &.bottom {
top: 0; top: 0;
bottom: 28px; bottom: 30px;
} }
} }
@ -118,15 +110,11 @@
z-index: 100; z-index: 100;
background-color: @toolbarTopColor; background-color: @toolbarTopColor;
display: flex;
align-items: center;
white-space: nowrap;
&.top { &.top {
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
height: 28px; height: 32px;
-webkit-box-shadow: inset 0 -1px 0 @toolbarBorderColor, inset 0 1px 0 @toolbarBorderShadowColor; -webkit-box-shadow: inset 0 -1px 0 @toolbarBorderColor, inset 0 1px 0 @toolbarBorderShadowColor;
//-moz-box-shadow: inset 0 -1px 0 @toolbarBorderColor, inset 0 1px 0 @toolbarBorderShadowColor; //-moz-box-shadow: inset 0 -1px 0 @toolbarBorderColor, inset 0 1px 0 @toolbarBorderShadowColor;
@ -137,7 +125,7 @@
bottom: 0; bottom: 0;
left: 0; left: 0;
width: 100%; width: 100%;
height: 28px; height: 30px;
-webkit-box-shadow: inset 0 1px 0 @toolbarBorderColor, inset 0 2px 0 @toolbarBorderShadowColor; -webkit-box-shadow: inset 0 1px 0 @toolbarBorderColor, inset 0 2px 0 @toolbarBorderShadowColor;
//-moz-box-shadow: inset 0 1px 0 @toolbarBorderColor, inset 0 2px 0 @toolbarBorderShadowColor; //-moz-box-shadow: inset 0 1px 0 @toolbarBorderColor, inset 0 2px 0 @toolbarBorderShadowColor;
@ -145,6 +133,11 @@
} }
.group { .group {
position: absolute;
top: 50%;
transform: translateY(-50%);
list-style-type: none;
margin: 0; margin: 0;
padding: 0; padding: 0;
@ -168,11 +161,6 @@
.item { .item {
float: left; float: left;
} }
& > div {
display: inline-block;
vertical-align: middle;
}
} }
&.right { &.right {
@ -180,21 +168,13 @@
padding-right: 10px; padding-right: 10px;
.item { .item {
display: inline-block; float: left;
} }
} }
&.center { &.center {
display: flex; left: 50%;
justify-content: center; transform: translate(-50%, -50%);
flex-grow: 1;
overflow: hidden;
padding: 0 20px;
#title-doc-name {
overflow: hidden;
text-overflow: ellipsis;
}
} }
.separator { .separator {
@ -219,18 +199,6 @@
} }
} }
.margin-right-small {
margin-right: 8px;
}
.margin-right-large {
margin-right: 12px;
}
.margin-left-small {
margin-left: 8px;
}
.margin-left-large {
margin-left: 12px;
}
} }
// Logo // Logo
@ -238,8 +206,8 @@
.brand-logo { .brand-logo {
display: block; display: block;
width: 100px; width: 100px;
height: 20px; height: 24px;
background: url(../../../../common/embed/resources/img/logo.svg) no-repeat; background: data-uri('../../../../common/embed/resources/img/logo.svg') no-repeat;
} }
// Control buttons // Control buttons
@ -251,49 +219,17 @@
background-color: transparent; background-color: transparent;
border: 1px solid transparent; border: 1px solid transparent;
border-radius: 2px; border-radius: 2px;
//margin: 0;
width: 22px; &.no-caption {
height: 22px; padding: 1px 2px;
background-origin: content-box;
padding: 0 1px;
font-size: @buttonFontSize;
&.has-caption {
width: auto;
padding-right: 5px;
}
&.colored {
padding: 0 16px;
height: 28px;
background-color: @btnColored;
border-radius: 3px;
color: #ffffff;
font-weight: 700;
} }
// Hover state // Hover state
&:hover:not(:disabled) { &:hover {
color: @toolbarHoverColor;
text-decoration: none; text-decoration: none;
background-color: @btnColor; text-shadow: 0 1px 0 @toolbarBorderShadowColor;
&.colored {
background-color: @btnHoverColored;
}
}
&:active:not(:disabled) {
&, .btn-icon {
background-position-y: -@icon-height !important;
}
&.has-caption {
color: #ffffff
}
&.colored {
background-color: @btnActiveColored;
}
} }
// Focus state for keyboard and accessibility // Focus state for keyboard and accessibility
@ -303,16 +239,12 @@
} }
// Active state // Active state
&.active:not(:disabled), &.active,
&:active:not(:disabled) { &:active {
outline: none; outline: none;
border: 1px solid @btnActiveColor; border: 1px solid @btnActiveColor;
background-color: @btnActiveColor; background-color: @btnActiveColor;
} }
&[disabled] {
opacity: 0.4;
}
} }
// Overlay control // Overlay control
@ -353,9 +285,6 @@
outline: none; outline: none;
opacity: 0.3; opacity: 0.3;
background-origin: content-box;
padding: 1px 0 0 1px;
-webkit-box-shadow: 0 0 0 2px rgba(255,255,255,0.3); -webkit-box-shadow: 0 0 0 2px rgba(255,255,255,0.3);
-moz-box-shadow: 0 0 0 2px rgba(255,255,255,0.3); -moz-box-shadow: 0 0 0 2px rgba(255,255,255,0.3);
box-shadow: 0 0 0 2px rgba(255,255,255,0.3); box-shadow: 0 0 0 2px rgba(255,255,255,0.3);
@ -499,89 +428,50 @@
&.big-email { .socnet-btn(3); } &.big-email { .socnet-btn(3); }
} }
@icon-width: 20px;
@icon-height: 20px;
.svg-icon { .svg-icon {
background: data-uri('../../../../common/embed/resources/img/icon-menu-sprite.svg') no-repeat; background: data-uri('../../../../common/embed/resources/img/icon-menu-sprite.svg') no-repeat;
background-size: @icon-width*29 @icon-height*2; background-size: 22px*11 22px*2;
&.download { &.download {
background-position: -@icon-width 0; background-position: -22px 0;
} }
&.share { &.share {
background-position: -@icon-width*2 0; background-position: -22px*2 0;
} }
&.embed { &.embed {
background-position: -@icon-width*3 0; background-position: -22px*3 0;
} }
&.fullscr { &.fullscr {
background-position: -@icon-width*4 0; background-position: -22px*4 0;
} }
&.zoom-up { &.zoom-up {
background-position: -@icon-width*5 -@icon-height; background-position: -22px*5 -22px;
} }
&.zoom-down { &.zoom-down {
background-position: -@icon-width*6 -@icon-height; background-position: -22px*6 -22px;
} }
&.slide-prev { &.slide-prev {
background-position: -@icon-width*7 -@icon-height; background-position: -22px*7 -22px;
} }
&.slide-next { &.slide-next {
background-position: -@icon-width*8 -@icon-height; background-position: -22px*8 -22px;
} }
&.play { &.play {
background-position: -@icon-width*9 -@icon-height; background-position: -22px*9 -22px;
} }
&.pause { &.pause {
background-position: -@icon-width*10 -@icon-height; background-position: -22px*10 -22px;
}
&.print {
background-position: -@icon-width*11 0;
}
&.arrow-up {
background-position: -@icon-width*17 0;
}
&.arrow-down {
background-position: -@icon-width*16 0;
}
&.clear-style {
background-position: -@icon-width*12 0;
}
&.go-to-location {
background-position: -@icon-width*15 0;
}
&.more-vertical {
background-position: -@icon-width*14 0;
}
&.search-close {
background-position: -@icon-width*18 0;
}
&.search {
background-position: -@icon-width*24 0;
}
&.search-arrow-up {
background-position: -@icon-width*27 0;
}
&.search-arrow-down {
background-position: -@icon-width*28 0;
} }
} }
.mi-icon { .mi-icon {
width: @icon-width;
height: @icon-height;
float: left;
margin: -3px 4px 0 -24px;
}
.btn-icon {
width: 22px; width: 22px;
height: 22px; height: 22px;
display: inline-block; //display: inline-block;
vertical-align: middle; float: left;
margin: -1px 15px 0 -15px;
} }
.btn, button { .btn, button {
@ -648,30 +538,33 @@
.dropdown-menu { .dropdown-menu {
> li > a { > li > a {
padding: 8px 20px 8px 28px; padding: 8px 20px 8px 31px;
&:hover, &:focus { &:hover, &:focus {
background-color: @btnColor; background-color: @btnColor;
outline: 0 none; outline: 0 none;
} }
font-size: @buttonFontSize;
}
.divider {
margin: 4px 0;
} }
} }
.dropdown { .dropdown {
&.open { &.open {
> button { > button {
background-color: @btnActiveColor !important; background-color: @btnActiveColor;
background-position: -@icon-width*14 -@icon-height; background-position: 0 -22px;
} }
} }
} }
#box-tools { #box-tools {
display: inline-block; button {
width: 24px;
height: 22px;
&:active {
background-position: 0 -22px;
}
}
a { a {
cursor: pointer; cursor: pointer;
} }
@ -703,14 +596,9 @@
border: 1px solid rgba(0,0,0,0.15); border: 1px solid rgba(0,0,0,0.15);
color: #333; color: #333;
font-weight: bold; font-weight: bold;
line-height: 26px;
font-size: 11px; font-size: 11px;
box-shadow: 0 6px 12px rgba(0,0,0,0.175); box-shadow: 0 6px 12px rgba(0,0,0,0.175);
max-width: 350px;
padding: 5px 12px;
white-space: pre-wrap;
text-align: left;
word-wrap: break-word;
} }
.tooltip-arrow { .tooltip-arrow {
@ -724,146 +612,3 @@
box-shadow: none; box-shadow: none;
} }
} }
.submit-tooltip {
position: absolute;
z-index: 1000;
top: 58px;
right: 15px;
padding: 7px 15px;
border-radius: 5px;
background-color: @notificationColor;
-webkit-box-shadow: 0 4px 15px -2px rgba(0, 0, 0, 0.5);
box-shadow: 0 4px 15px -2px rgba(0, 0, 0, 0.5);
font-size: 11px;
}
.required-tooltip {
position: absolute;
z-index: 1000;
padding: 15px;
border-radius: 5px;
background-color: @btnColored;
color: #fff;
-webkit-box-shadow: 0 4px 15px -2px rgba(0, 0, 0, 0.5);
box-shadow: 0 4px 15px -2px rgba(0, 0, 0, 0.5);
font-size: 11px;
&.bottom-left {
border-top-right-radius: 0;
margin: 15px 0 0 0;
.tip-arrow {
position: absolute;
overflow: hidden;
right: 0;
top: -15px;
width: 15px;
height: 15px;
.box-shadow(8px 5px 8px -5px rgba(0, 0, 0, 0.2));
&:after {
content: '';
position: absolute;
top: 8px;
left: 8px;
background-color: @btnColored;
width: 15px;
height: 15px;
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-webkit-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
.box-shadow(0 0 8px -1px rgba(0, 0, 0, 0.2));
}
}
}
.close-div {
display: inline-block;
border: 1px solid #fff;
border-radius: 2px;
padding: 3px 12px;
margin-top: 10px;
}
}
.tooltip {
.tooltip-inner {
.toolbar & {
font-weight: normal;
}
}
}
#id-search {
button.active {
background-color: @btnActiveColor !important;
background-position: -@icon-width*19 -@icon-height;
}
}
.search-window {
width: 301px;
height: 54px;
z-index: 50;
position: fixed;
box-shadow: 0 5px 15px rgba(0,0,0,0.2);
border-radius: 5px;
border: solid 1px #CBCBCB;
.body {
width: 100%;
height: 100%;
border-radius: 5px;
background-color: #FFFFFF;
display: flex;
padding: 16px;
input {
width: 192px;
height: 22px;
border-radius: 2px;
box-shadow: none;
border: solid 1px #CFCFCF;
padding: 1px 3px;
color: #444444;
font-size: 11px;
&::placeholder {
color: #CFCFCF;
}
&:focus {
border-color: #848484;
outline: 0;
}
}
.tools {
display: flex;
button {
border: none;
margin-left: 7px;
cursor: pointer;
width: 20px;
height: 20px;
opacity: 0.8;
&:hover:not(:disabled) {
background-color: #d8dadc;
}
&:disabled {
opacity: 0.4;
cursor: default;
}
}
}
}
}

View file

@ -1,74 +0,0 @@
@loadmask-zindex: 10000;
@loadmask-image-height: 28px;
@loadmask-image-width: 28px;
@loadmask-small-image-height: 20px;
@loadmask-small-image-width: 20px;
@background-loader-ie: fade(#000, 65%);
@background-loader: fade(#181818, 90%);
@text-contrast-background-ie: #fff;
@text-contrast-background: #fff;
.asc-loadmask {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
zoom: 1;
background-color: transparent;
z-index: @loadmask-zindex;
}
.asc-loadmask-body {
position: absolute;
z-index: @loadmask-zindex + 1;
padding: 24px;
line-height: @loadmask-image-height;
border: none;
background-image: none;
background-color: @background-loader-ie;
background-color: @background-loader;
color: @text-contrast-background-ie;
color: @text-contrast-background;
border-radius: 6px;
left: 50%;
top: 50%;
transform: translate(-50%);
& > div {
display: inline-block;
vertical-align: middle;
}
.asc-loadmask-image {
background-image: ~"url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyOCAyOCI+PGNpcmNsZSBjeD0iMTQiIGN5PSIxNCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjZmZmIiBzdHJva2Utd2lkdGg9IjEuNSIgcj0iMTAuMjUiIHN0cm9rZS1kYXNoYXJyYXk9IjE2MCUsIDQwJSIgLz48L3N2Zz4=)";
height: 28px;
width: 28px;
float: left;
margin-left: 8px;
}
.asc-loadmask-title {
font-size: 13px;
margin: 0 8px 0 12px;
white-space: pre-wrap;
}
}
@keyframes rotation {
from {
transform: rotate(0);
}
to {
transform: rotate(360deg);
}
}
#loadmask-spinner {
animation-duration: .8s;
animation-name: rotation;
animation-iteration-count: infinite;
animation-timing-function: linear;
}

View file

@ -1,225 +0,0 @@
!window.Common && (window.Common = {});
!Common.Views && (Common.Views = {});
define([
'common/main/lib/component/Window',
'common/main/lib/component/MetricSpinner',
'common/main/lib/component/TextareaField'
], function () { 'use strict';
Common.Views.EmbedDialog = Common.UI.Window.extend(_.extend({
options: {
width: 300,
header: true,
style: 'min-width: 300px;',
cls: 'modal-dlg',
buttons: null
},
initialize : function(options) {
_.extend(this.options, {
title: this.textTitle
}, options || {});
this.template = [
'<div class="box" style="height: 110px;">',
'<table cols="2" style="width: 100%;">',
'<tr>',
'<td style="padding-right: 10px;">',
'<label class="input-label">' + this.textWidth + ':</label>',
'<div id="embed-size-spin-width" style="display: inline-block;margin-left: 5px;"></div>',
'</td>',
'<td style="float:right;">',
'<label class="input-label">' + this.textHeight + ':</label>',
'<div id="embed-size-spin-height" style="display: inline-block;margin-left: 5px;"></div>',
'</td>',
'</tr>',
'<tr>',
'<td colspan="2">',
'<div id="embed-textarea" style="margin-top: 15px;"></div>',
'</td>',
'</tr>',
'</table>',
'</div>',
'<div class="separator horizontal"></div>',
'<div class="footer center">',
'<button class="btn normal primary dlg-btn" style="min-width: 86px;width: auto;">' + this.txtCopy + '</button>',
'</div>'
].join('');
this.options.tpl = _.template(this.template)(this.options);
this.embedConfig = this.options.embedConfig;
this.embedCode = '<iframe allowtransparency="true" frameborder="0" scrolling="no" src="{0}" width="{1}" height="{2}"></iframe>';
Common.UI.Window.prototype.initialize.call(this, this.options);
},
render: function() {
Common.UI.Window.prototype.render.call(this);
this.spnWidth = new Common.UI.MetricSpinner({
el: $('#embed-size-spin-width'),
step: 1,
width: 70,
defaultUnit : "px",
value: '400 px',
minValue: 400,
maxValue: 10000
});
this.spnWidth.on('change', _.bind(function(field, newValue, oldValue, eOpts){
this.updateEmbedCode();
}, this));
this.spnHeight = new Common.UI.MetricSpinner({
el: $('#embed-size-spin-height'),
step: 1,
width: 70,
defaultUnit : "px",
value: '600 px',
minValue: 600,
maxValue: 10000
});
this.spnHeight.on('change', _.bind(function(field, newValue, oldValue, eOpts){
this.updateEmbedCode();
}, this));
this.textareaInput = new Common.UI.TextareaField({
el : $('#embed-textarea'),
style : 'width: 100%; height: 65px;',
value : ''
});
this.textareaInput._input.attr('readonly', true);
this.updateEmbedCode();
this.getChild().find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
},
getFocusedComponents: function() {
return [this.spnWidth, this.spnHeight, this.textareaInput];
},
getDefaultFocusableComponent: function () {
return this.textareaInput;
},
onBtnClick: function(event) {
this.textareaInput._input.select();
if ( !document.execCommand('copy') ) {
Common.UI.warning({
msg: this.warnCopy,
buttons: ['ok']
});
}
},
updateEmbedCode: function() {
this.textareaInput.setValue(Common.Utils.String.format(this.embedCode, this.embedConfig.embedUrl, this.spnWidth.getNumberValue(), this.spnHeight.getNumberValue()));
},
textTitle: 'Embed',
textWidth: 'Width',
textHeight: 'Height',
txtCopy: 'Copy to clipboard',
warnCopy: 'Browser\'s error! Use keyboard shortcut [Ctrl] + [C]'
}, Common.Views.EmbedDialog || {}));
Common.Views.ShareDialog = Common.UI.Window.extend(_.extend({
options: {
width: 300,
header: true,
style: 'min-width: 300px;',
cls: 'modal-dlg',
buttons: null
},
initialize : function(options) {
_.extend(this.options, {
title: this.textTitle
}, options || {});
this.template = [
'<div class="box" style="height: 100px;">',
'<table cols="1" style="width: 100%;">',
'<tr>',
'<td>',
'<div id="share-link-txt"></div>',
'</td>',
'</tr>',
'<tr>',
'<td>',
'<div class="share-buttons" style="margin-top: 15px;">',
'<span class="svg big-facebook" data-name="facebook"></span>',
'<span class="svg big-twitter" data-name="twitter"></span>',
'<span class="svg big-email" data-name="email"></span>',
'<div class="autotest" id="email" style="display: none"></div>',
'</div>',
'</td>',
'</tr>',
'</table>',
'</div>',
'<div class="separator horizontal"></div>',
'<div class="footer center">',
'<button class="btn normal primary dlg-btn" style="min-width: 86px;width: auto;">' + this.txtCopy + '</button>',
'</div>'
].join('');
this.options.tpl = _.template(this.template)(this.options);
this.embedConfig = this.options.embedConfig;
Common.UI.Window.prototype.initialize.call(this, this.options);
},
render: function() {
Common.UI.Window.prototype.render.call(this);
this.textUrl = new Common.UI.InputField({
el : $('#share-link-txt'),
editable : false,
value: this.embedConfig.shareUrl || ''
});
this.updateShareCode();
this.getChild().find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
},
onBtnClick: function(event) {
this.textUrl._input.select();
if ( !document.execCommand('copy') ) {
Common.UI.warning({
msg: this.warnCopy,
buttons: ['ok']
});
}
},
updateShareCode: function() {
var me = this,
_encoded = encodeURIComponent(this.embedConfig.shareUrl),
docTitle = this.embedConfig.docTitle || '',
_mailto = 'mailto:?subject=I have shared a document with you: ' + docTitle + '&body=I have shared a document with you: ' + _encoded;
this.getChild().find('.share-buttons > span').on('click', function(e){
var _url;
switch ($(e.target).attr('data-name')) {
case 'facebook':
_url = 'https://www.facebook.com/sharer/sharer.php?u=' + me.embedConfig.shareUrl + '&t=' + encodeURI(docTitle);
window.open(_url, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=300,width=600');
break;
case 'twitter':
_url = 'https://twitter.com/share?url='+ _encoded;
!!docTitle && (_url += encodeURIComponent('&text=' + docTitle));
window.open(_url, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=300,width=600');
break;
case 'email':
window.open(_mailto, '_self');
break;
}
});
},
textTitle: 'Share Link',
txtCopy: 'Copy to clipboard',
warnCopy: 'Browser\'s error! Use keyboard shortcut [Ctrl] + [C]'
}, Common.Views.ShareDialog || {}))
});

View file

@ -1,220 +0,0 @@
<svg width="580" height="40" viewBox="0 0 580 40" fill="none" xmlns="http://www.w3.org/2000/svg">
<g id="icon-menu-sprite Embedded Viewer">
<g id="view-settings">
<path id="Vector" d="M17 26H3V27H17V26Z" fill="white"/>
<path id="Vector_2" d="M17 30H3V31H17V30Z" fill="white"/>
<path id="Vector_3" d="M17 34H3V35H17V34Z" fill="white"/>
</g>
<g id="download">
<path id="Union" fill-rule="evenodd" clip-rule="evenodd" d="M31 22H30V33.2929L25.3536 28.6464L24.6465 29.3536L30.1465 34.8536L30.5 35.2071L30.8536 34.8536L36.3536 29.3536L35.6465 28.6464L31 33.2929V22Z" fill="white"/>
<rect id="Rectangle 88" x="24" y="36" width="13" height="1" fill="white"/>
</g>
<g id="share">
<path id="share_2" d="M56 25C56 26.1046 55.1046 27 54 27C53.4663 27 52.9815 26.791 52.6229 26.4503L47.9076 29.3974C47.9676 29.5875 48 29.79 48 30C48 30.21 47.9676 30.4125 47.9076 30.6026L52.6229 33.5497C52.9815 33.209 53.4663 33 54 33C55.1046 33 56 33.8954 56 35C56 36.1046 55.1046 37 54 37C52.8954 37 52 36.1046 52 35C52 34.79 52.0324 34.5875 52.0924 34.3974L47.3771 31.4503C47.0185 31.791 46.5337 32 46 32C44.8954 32 44 31.1046 44 30C44 28.8954 44.8954 28 46 28C46.5337 28 47.0185 28.209 47.3771 28.5497L52.0924 25.6026C52.0324 25.4125 52 25.21 52 25C52 23.8954 52.8954 23 54 23C55.1046 23 56 23.8954 56 25Z" fill="white"/>
</g>
<g id="embed ">
<g id="embed _2">
<path d="M67.8536 25.3536L67.1465 24.6465L62.293 29.5L67.1465 34.3536L67.8536 33.6465L63.7072 29.5L67.8536 25.3536Z" fill="white"/>
<path d="M72.1465 25.3536L72.8536 24.6465L77.7072 29.5L72.8536 34.3536L72.1465 33.6465L76.293 29.5L72.1465 25.3536Z" fill="white"/>
</g>
</g>
<g id="full-screen">
<path id="Rectangle 81 (Stroke)" fill-rule="evenodd" clip-rule="evenodd" d="M93 27H87V33H93V27ZM86 26V34H94V26H86Z" fill="white"/>
<path id="Subtract" fill-rule="evenodd" clip-rule="evenodd" d="M86 23H83V26H84V24H86V23Z" fill="white"/>
<path id="Subtract_2" fill-rule="evenodd" clip-rule="evenodd" d="M97 26L97 23L94 23L94 24L96 24L96 26L97 26Z" fill="white"/>
<path id="Subtract_3" fill-rule="evenodd" clip-rule="evenodd" d="M94 37L97 37L97 34L96 34L96 36L94 36L94 37Z" fill="white"/>
<path id="Subtract_4" fill-rule="evenodd" clip-rule="evenodd" d="M83 34L83 37L86 37L86 36L84 36L84 34L83 34Z" fill="white"/>
</g>
<g id="zoom-in">
<path id="Union_2" fill-rule="evenodd" clip-rule="evenodd" d="M111 25H110V30H105V31H110V36H111V31H116V30H111V25Z" fill="white"/>
</g>
<g id="zoom-out">
<rect id="Rectangle 44.8" x="135" y="30" width="1" height="10" transform="rotate(90 135 30)" fill="white"/>
</g>
<g id="scroll-to-first-sheet">
<path id="Vector 13 (Stroke)" fill-rule="evenodd" clip-rule="evenodd" d="M155 25L147 30L155 35V25Z" fill="white"/>
<path id="Rectangle 225" d="M145 25H146V35H145V25Z" fill="white"/>
</g>
<g id="scroll-to-last-sheet">
<path id="Vector 13 (Stroke)_2" fill-rule="evenodd" clip-rule="evenodd" d="M165 35L173 30L165 25V35Z" fill="white"/>
<path id="Rectangle 225 (Stroke)" fill-rule="evenodd" clip-rule="evenodd" d="M174 35H175V25H174V35Z" fill="white"/>
</g>
<g id="play">
<path id="Vector 8 (Stroke)" fill-rule="evenodd" clip-rule="evenodd" d="M185 23L198 30L185 37V23Z" fill="white"/>
</g>
<g id="pause">
<path id="Rectangle 81 (Stroke)_2" fill-rule="evenodd" clip-rule="evenodd" d="M205 25V35H209V25H205Z" fill="white"/>
<path id="Rectangle 81.1 (Stroke)" fill-rule="evenodd" clip-rule="evenodd" d="M211 25V35H215V25H211Z" fill="white"/>
</g>
<g id=" print">
<path id="Union_3" fill-rule="evenodd" clip-rule="evenodd" d="M226 24H234V26H226V24ZM225 26V24C225 23.4477 225.448 23 226 23H234C234.552 23 235 23.4477 235 24V26H237C237.552 26 238 26.4477 238 27V33C238 33.5523 237.552 34 237 34H235V36C235 36.5523 234.552 37 234 37H226C225.448 37 225 36.5523 225 36V34H223C222.448 34 222 33.5523 222 33V27C222 26.4477 222.448 26 223 26H225ZM225 33V31C225 30.4477 225.448 30 226 30H234C234.552 30 235 30.4477 235 31V33H237V27H234H226H223V33H225ZM225 28H224V29H225V28ZM234 31H226V36H234V31ZM227 32H233V33H227V32ZM233 34H227V35H233V34Z" fill="white"/>
</g>
<g id="clear-style">
<path id="Union_4" fill-rule="evenodd" clip-rule="evenodd" d="M253.268 24.5608C252.291 23.5845 250.708 23.5845 249.732 24.5608L243.561 30.7324C242.584 31.7087 242.584 33.2916 243.561 34.268L245.146 35.8537L245.293 36.0002L245.5 36.0002H249.5L249.707 36.0002L255 36.0002V35.0002H250.707L255.439 30.268C256.416 29.2916 256.416 27.7087 255.439 26.7324L253.268 24.5608ZM249.293 35.0002L252.793 31.5002L248.5 27.2073L244.268 31.4395C243.682 32.0253 243.682 32.9751 244.268 33.5609L245.707 35.0002L249.293 35.0002ZM249.207 26.5002L253.5 30.7931L254.732 29.5608C255.318 28.9751 255.318 28.0253 254.732 27.4395L252.561 25.268C251.975 24.6822 251.025 24.6822 250.439 25.268L249.207 26.5002Z" fill="white"/>
</g>
<g id="view-settings_2">
<path id="Vector_4" d="M17 6H3V7H17V6Z" fill="black"/>
<path id="Vector_5" d="M17 10H3V11H17V10Z" fill="black"/>
<path id="Vector_6" d="M17 14H3V15H17V14Z" fill="black"/>
</g>
<g id="download_2">
<path id="Union_5" fill-rule="evenodd" clip-rule="evenodd" d="M31 2H30V13.2929L25.3536 8.64645L24.6465 9.35355L30.1465 14.8536L30.5 15.2071L30.8536 14.8536L36.3536 9.35355L35.6465 8.64645L31 13.2929V2Z" fill="black"/>
<rect id="Rectangle 88_2" x="24" y="16" width="13" height="1" fill="black"/>
</g>
<g id="share_3">
<path id="share_4" d="M56 5C56 6.10457 55.1046 7 54 7C53.4663 7 52.9815 6.79098 52.6229 6.45034L47.9076 9.39737C47.9676 9.58754 48 9.78999 48 10C48 10.21 47.9676 10.4125 47.9076 10.6026L52.6229 13.5497C52.9815 13.209 53.4663 13 54 13C55.1046 13 56 13.8954 56 15C56 16.1046 55.1046 17 54 17C52.8954 17 52 16.1046 52 15C52 14.79 52.0324 14.5875 52.0924 14.3974L47.3771 11.4503C47.0185 11.791 46.5337 12 46 12C44.8954 12 44 11.1046 44 10C44 8.89543 44.8954 8 46 8C46.5337 8 47.0185 8.20902 47.3771 8.54966L52.0924 5.60264C52.0324 5.41246 52 5.21001 52 5C52 3.89543 52.8954 3 54 3C55.1046 3 56 3.89543 56 5Z" fill="black"/>
</g>
<g id="embed _3">
<g id="embed _4">
<path d="M67.8536 5.35359L67.1465 4.64648L62.293 9.50004L67.1465 14.3536L67.8536 13.6465L63.7072 9.50004L67.8536 5.35359Z" fill="black"/>
<path d="M72.1465 5.35359L72.8536 4.64648L77.7072 9.50004L72.8536 14.3536L72.1465 13.6465L76.293 9.50004L72.1465 5.35359Z" fill="black"/>
</g>
</g>
<g id="full-screen_2">
<path id="Rectangle 81 (Stroke)_3" fill-rule="evenodd" clip-rule="evenodd" d="M93 7H87V13H93V7ZM86 6V14H94V6H86Z" fill="black"/>
<path id="Subtract_5" fill-rule="evenodd" clip-rule="evenodd" d="M86 3H83V6H84V4H86V3Z" fill="black"/>
<path id="Subtract_6" fill-rule="evenodd" clip-rule="evenodd" d="M97 6L97 3L94 3L94 4L96 4L96 6L97 6Z" fill="black"/>
<path id="Subtract_7" fill-rule="evenodd" clip-rule="evenodd" d="M94 17L97 17L97 14L96 14L96 16L94 16L94 17Z" fill="black"/>
<path id="Subtract_8" fill-rule="evenodd" clip-rule="evenodd" d="M83 14L83 17L86 17L86 16L84 16L84 14L83 14Z" fill="black"/>
</g>
<g id="zoom-in_2">
<path id="Union_6" fill-rule="evenodd" clip-rule="evenodd" d="M111 5H110V10H105V11H110V16H111V11H116V10H111V5Z" fill="black"/>
</g>
<g id="zoom-out_2">
<rect id="Rectangle 44.8_2" x="135" y="10" width="1" height="10" transform="rotate(90 135 10)" fill="black"/>
</g>
<g id="scroll-to-first-sheet_2">
<path id="Vector 13 (Stroke)_3" fill-rule="evenodd" clip-rule="evenodd" d="M155 5L147 10L155 15V5Z" fill="black"/>
<path id="Rectangle 225_2" d="M145 5H146V15H145V5Z" fill="black"/>
</g>
<g id="scroll-to-last-sheet_2">
<path id="Vector 13 (Stroke)_4" fill-rule="evenodd" clip-rule="evenodd" d="M165 15L173 10L165 5V15Z" fill="black"/>
<path id="Rectangle 225 (Stroke)_2" fill-rule="evenodd" clip-rule="evenodd" d="M174 15H175V5H174V15Z" fill="black"/>
</g>
<g id="play_2">
<path id="Vector 8 (Stroke)_2" fill-rule="evenodd" clip-rule="evenodd" d="M185 3L198 10L185 17V3Z" fill="black"/>
</g>
<g id="pause_2">
<path id="Rectangle 81 (Stroke)_4" fill-rule="evenodd" clip-rule="evenodd" d="M205 5V15H209V5H205Z" fill="black"/>
<path id="Rectangle 81.1 (Stroke)_2" fill-rule="evenodd" clip-rule="evenodd" d="M211 5V15H215V5H211Z" fill="black"/>
</g>
<g id=" print_2">
<path id="Union_7" fill-rule="evenodd" clip-rule="evenodd" d="M226 4H234V6H226V4ZM225 6V4C225 3.44772 225.448 3 226 3H234C234.552 3 235 3.44772 235 4V6H237C237.552 6 238 6.44772 238 7V13C238 13.5523 237.552 14 237 14H235V16C235 16.5523 234.552 17 234 17H226C225.448 17 225 16.5523 225 16V14H223C222.448 14 222 13.5523 222 13V7C222 6.44772 222.448 6 223 6H225ZM225 13V11C225 10.4477 225.448 10 226 10H234C234.552 10 235 10.4477 235 11V13H237V7H234H226H223V13H225ZM225 8H224V9H225V8ZM234 11H226V16H234V11ZM227 12H233V13H227V12ZM233 14H227V15H233V14Z" fill="black"/>
</g>
<g id="clear-style_2">
<path id="Union_8" fill-rule="evenodd" clip-rule="evenodd" d="M253.268 4.56085C252.291 3.58454 250.708 3.58453 249.732 4.56085L243.561 10.7324C242.584 11.7087 242.584 13.2916 243.561 14.268L245.146 15.8537L245.293 16.0002L245.5 16.0002H249.5L249.707 16.0002L255 16.0002V15.0002H250.707L255.439 10.268C256.416 9.29164 256.416 7.70873 255.439 6.73242L253.268 4.56085ZM249.293 15.0002L252.793 11.5002L248.5 7.20729L244.268 11.4395C243.682 12.0253 243.682 12.9751 244.268 13.5609L245.707 15.0002L249.293 15.0002ZM249.207 6.50019L253.5 10.7931L254.732 9.56085C255.318 8.97506 255.318 8.02531 254.732 7.43953L252.561 5.26795C251.975 4.68217 251.025 4.68217 250.439 5.26795L249.207 6.50019Z" fill="black"/>
</g>
<g id="edit">
<path id="Vector_7" d="M263 34V37H266L274 29L271 26L263 34Z" fill="white"/>
<path id="Vector 2" d="M275 28L272 25L274 23H275L277 25V26L275 28Z" fill="white"/>
</g>
<g id="more-vertical">
<circle id="Ellipse" cx="290" cy="26" r="1" transform="rotate(90 290 26)" fill="white"/>
<circle id="Ellipse_2" cx="290" cy="30" r="1" transform="rotate(90 290 30)" fill="white"/>
<circle id="Ellipse_3" cx="290" cy="34" r="1" transform="rotate(90 290 34)" fill="white"/>
</g>
<g id="go-to-location">
<path id="Vector_8" d="M317 26H311V25C311 24.45 310.55 24 310 24H303C302.45 24 302 24.45 302 25V36C302 36.55 302.45 37 303 37H317C317.55 37 318 36.55 318 36V27C318 26.45 317.55 26 317 26ZM317 36H303V25H310V27H317V36Z" fill="white"/>
<path id="Union_9" fill-rule="evenodd" clip-rule="evenodd" d="M309.646 33.6465L310.354 34.3536L313.207 31.5L310.354 28.6465L309.646 29.3536L311.268 30.9747H306V31.9747H311.318L309.646 33.6465Z" fill="white"/>
</g>
<g id="arrow-down">
<path id="Union_10" fill-rule="evenodd" clip-rule="evenodd" d="M331 23H330V34.2929L325.354 29.6464L324.646 30.3536L330.146 35.8536L330.5 36.2071L330.854 35.8536L336.354 30.3536L335.646 29.6464L331 34.2929V23Z" fill="white"/>
</g>
<g id="edit_2">
<path id="Vector_9" d="M263 14V17H266L274 9L271 6L263 14Z" fill="black"/>
<path id="Vector 2_2" d="M275 8L272 5L274 3H275L277 5V6L275 8Z" fill="black"/>
</g>
<g id="more-vertical_2">
<circle id="Ellipse_4" cx="290" cy="6" r="1" transform="rotate(90 290 6)" fill="black"/>
<circle id="Ellipse_5" cx="290" cy="10" r="1" transform="rotate(90 290 10)" fill="black"/>
<circle id="Ellipse_6" cx="290" cy="14" r="1" transform="rotate(90 290 14)" fill="black"/>
</g>
<g id="go-to-location_2">
<path id="Vector_10" d="M317 6H311V5C311 4.45 310.55 4 310 4H303C302.45 4 302 4.45 302 5V16C302 16.55 302.45 17 303 17H317C317.55 17 318 16.55 318 16V7C318 6.45 317.55 6 317 6ZM317 16H303V5H310V7H317V16Z" fill="black"/>
<path id="Union_11" fill-rule="evenodd" clip-rule="evenodd" d="M309.646 13.6465L310.354 14.3536L313.207 11.5L310.354 8.64648L309.646 9.35359L311.268 10.9747H306V11.9747H311.318L309.646 13.6465Z" fill="black"/>
</g>
<g id="arrow-down_2">
<path id="Union_12" fill-rule="evenodd" clip-rule="evenodd" d="M331 3H330V14.2929L325.354 9.64645L324.646 10.3536L330.146 15.8536L330.5 16.2071L330.854 15.8536L336.354 10.3536L335.646 9.64645L331 14.2929V3Z" fill="black"/>
</g>
<g id="arrow-up">
<path id="Union_13" fill-rule="evenodd" clip-rule="evenodd" d="M350 36.207L351 36.207L351 24.9141L355.646 29.5606L356.354 28.8535L350.854 23.3535L350.5 22.9999L350.146 23.3535L344.646 28.8535L345.354 29.5606L350 24.9141L350 36.207Z" fill="white"/>
</g>
<g id="arrow-up_2">
<path id="Union_14" fill-rule="evenodd" clip-rule="evenodd" d="M350 16.207L351 16.207L351 4.91414L355.646 9.56059L356.354 8.85348L350.854 3.35348L350.5 2.99993L350.146 3.35348L344.646 8.85348L345.354 9.56059L350 4.91414L350 16.207Z" fill="black"/>
</g>
<g id="close">
<path id="Vector 73" d="M366 25L375 34M375 25L366 34" stroke="white" stroke-width="1.5"/>
</g>
<g id="close_2">
<path id="Vector 73_2" d="M366 5L375 14M375 5L366 14" stroke="black" stroke-width="1.5"/>
</g>
<g id="сut">
<circle id="Ellipse 103" cx="385.5" cy="13.5" r="2" stroke="black"/>
<circle id="Ellipse 104" cx="385.5" cy="6.5" r="2" stroke="black"/>
<path id="Rectangle 1552" d="M387.188 7.56689L398.446 14.0669V14.0669C398.17 14.5452 397.559 14.7091 397.08 14.4329L386.688 8.43292L387.188 7.56689Z" fill="black"/>
<path id="Rectangle 1553" d="M386.688 11.5669L397.08 5.56689C397.558 5.29075 398.17 5.45463 398.446 5.93292V5.93292L387.188 12.4329L386.688 11.5669Z" fill="black"/>
</g>
<g id="сut_2">
<circle id="Ellipse 103_2" cx="385.5" cy="33.5" r="2" stroke="white"/>
<circle id="Ellipse 104_2" cx="385.5" cy="26.5" r="2" stroke="white"/>
<path id="Rectangle 1552_2" d="M387.188 27.5669L398.446 34.0669V34.0669C398.17 34.5452 397.559 34.7091 397.08 34.4329L386.688 28.4329L387.188 27.5669Z" fill="white"/>
<path id="Rectangle 1553_2" d="M386.688 31.5669L397.08 25.5669C397.558 25.2908 398.17 25.4546 398.446 25.9329V25.9329L387.188 32.4329L386.688 31.5669Z" fill="white"/>
</g>
<g id="copy">
<path id="Union_27" fill-rule="evenodd" clip-rule="evenodd" d="M404 5H412V7H413V5C413 4.44772 412.552 4 412 4H404C403.448 4 403 4.44772 403 5V12C403 12.5523 403.448 13 404 13H406V12H404V5ZM411 6H405V7H411V6ZM408 9V16H416V9H408ZM408 8C407.448 8 407 8.44772 407 9V16C407 16.5523 407.448 17 408 17H416C416.552 17 417 16.5523 417 16V9C417 8.44772 416.552 8 416 8H408ZM406 8H405V9H406V8ZM405 10H406V11H405V10ZM415 11V10H409V11H415ZM415 12V13H409V12H415ZM415 15V14H409V15H415Z" fill="black"/>
</g>
<g id="copy_2">
<path id="Union_28" fill-rule="evenodd" clip-rule="evenodd" d="M404 25H412V27H413V25C413 24.4477 412.552 24 412 24H404C403.448 24 403 24.4477 403 25V32C403 32.5523 403.448 33 404 33H406V32H404V25ZM411 26H405V27H411V26ZM408 29V36H416V29H408ZM408 28C407.448 28 407 28.4477 407 29V36C407 36.5523 407.448 37 408 37H416C416.552 37 417 36.5523 417 36V29C417 28.4477 416.552 28 416 28H408ZM406 28H405V29H406V28ZM405 30H406V31H405V30ZM415 31V30H409V31H415ZM415 32V33H409V32H415ZM415 35V34H409V35H415Z" fill="white"/>
</g>
<g id="paste">
<path id="Union_29" fill-rule="evenodd" clip-rule="evenodd" d="M426 3H432V4H434C434.552 4 435 4.44772 435 5V7H434V5H432V6H426V5H424V12H426V13H424C423.448 13 423 12.5523 423 12V5C423 4.44772 423.448 4 424 4H426V3ZM436 16V9H428V16H436ZM428 8C427.448 8 427 8.44772 427 9V16C427 16.5523 427.448 17 428 17H436C436.552 17 437 16.5523 437 16V9C437 8.44772 436.552 8 436 8H428ZM429 11V10H435V11H429ZM435 12H429V13H435V12ZM429 15V14H435V15H429Z" fill="black"/>
</g>
<g id="paste_2">
<path id="Union_30" fill-rule="evenodd" clip-rule="evenodd" d="M426 23H432V24H434C434.552 24 435 24.4477 435 25V27H434V25H432V26H426V25H424V32H426V33H424C423.448 33 423 32.5523 423 32V25C423 24.4477 423.448 24 424 24H426V23ZM436 36V29H428V36H436ZM428 28C427.448 28 427 28.4477 427 29V36C427 36.5523 427.448 37 428 37H436C436.552 37 437 36.5523 437 36V29C437 28.4477 436.552 28 436 28H428ZM429 31V30H435V31H429ZM435 32H429V33H435V32ZM429 35V34H435V35H429Z" fill="white"/>
</g>
<g id="redo">
<path id="Vector" d="M469.1 7C471.1 7 473.2 8.3 474.5 9.5L477 7V14H470L472.5 11.5C471.7 10.2 469.9 9.1 468.2 9.1C465.7 9.1 462.8 10.8 462.5 13.2C462.9 9.7 465.5 7 469.1 7Z" fill="black"/>
</g>
<g id="redo_2">
<path id="Vector_2" d="M469.1 27C471.1 27 473.2 28.3 474.5 29.5L477 27V34H470L472.5 31.5C471.7 30.2 469.9 29.1 468.2 29.1C465.7 29.1 462.8 30.8 462.5 33.2C462.9 29.7 465.5 27 469.1 27Z" fill="white"/>
</g>
<g id="undo">
<path id="Vector_3" d="M450.9 7C448.9 7 446.8 8.3 445.5 9.5L443 7V14H450L447.5 11.5C448.3 10.2 450.1 9.1 451.8 9.1C454.3 9.1 457.2 10.8 457.5 13.2C457.1 9.7 454.5 7 450.9 7Z" fill="black"/>
</g>
<g id="undo_2">
<path id="Vector_4" d="M450.9 27C448.9 27 446.8 28.3 445.5 29.5L443 27V34H450L447.5 31.5C448.3 30.2 450.1 29.1 451.8 29.1C454.3 29.1 457.2 30.8 457.5 33.2C457.1 29.7 454.5 27 450.9 27Z" fill="white"/>
</g>
<g id="search">
<path id="Union_31" fill-rule="evenodd" clip-rule="evenodd" d="M493 8.5C493 10.9853 490.985 13 488.5 13C486.015 13 484 10.9853 484 8.5C484 6.01472 486.015 4 488.5 4C490.985 4 493 6.01472 493 8.5ZM492.02 12.7266C491.066 13.5217 489.839 14 488.5 14C485.462 14 483 11.5376 483 8.5C483 5.46243 485.462 3 488.5 3C491.538 3 494 5.46243 494 8.5C494 9.83875 493.522 11.0658 492.727 12.0195L496.854 16.1465L496.146 16.8536L492.02 12.7266Z" fill="black"/>
</g>
<g id="search_2">
<path id="Union_32" fill-rule="evenodd" clip-rule="evenodd" d="M493 28.5C493 30.9853 490.985 33 488.5 33C486.015 33 484 30.9853 484 28.5C484 26.0147 486.015 24 488.5 24C490.985 24 493 26.0147 493 28.5ZM492.02 32.7266C491.066 33.5217 489.839 34 488.5 34C485.462 34 483 31.5376 483 28.5C483 25.4624 485.462 23 488.5 23C491.538 23 494 25.4624 494 28.5C494 29.8387 493.522 31.0658 492.727 32.0195L496.854 36.1465L496.146 36.8536L492.02 32.7266Z" fill="white"/>
</g>
<g id="btn-sheet-view">
<path id="Union_33" fill-rule="evenodd" clip-rule="evenodd" d="M509.93 13C507.552 13 505.45 11.8151 504.184 10C505.45 8.18485 507.552 7 509.93 7C512.307 7 514.409 8.18486 515.675 10C514.409 11.8151 512.307 13 509.93 13ZM509.93 6C512.891 6 515.476 7.6088 516.859 10C515.476 12.3912 512.891 14 509.93 14C506.969 14 504.383 12.3912 503 10C504.383 7.60879 506.969 6 509.93 6ZM509.93 12C511.034 12 511.93 11.1046 511.93 10C511.93 8.89543 511.034 8 509.93 8C508.825 8 507.93 8.89543 507.93 10C507.93 11.1046 508.825 12 509.93 12Z" fill="black"/>
</g>
<g id="btn-sheet-view_2">
<path id="Union_34" fill-rule="evenodd" clip-rule="evenodd" d="M509.93 33C507.552 33 505.45 31.8151 504.184 30C505.45 28.1849 507.552 27 509.93 27C512.307 27 514.409 28.1849 515.675 30C514.409 31.8151 512.307 33 509.93 33ZM509.93 26C512.891 26 515.476 27.6088 516.859 30C515.476 32.3912 512.891 34 509.93 34C506.969 34 504.383 32.3912 503 30C504.383 27.6088 506.969 26 509.93 26ZM509.93 32C511.034 32 511.93 31.1046 511.93 30C511.93 28.8954 511.034 28 509.93 28C508.825 28 507.93 28.8954 507.93 30C507.93 31.1046 508.825 32 509.93 32Z" fill="white"/>
</g>
<g id="hide-password">
<path id="Subtract" fill-rule="evenodd" clip-rule="evenodd" d="M530.948 6.05196C530.638 6.01766 530.321 6 530 6C526.91 6 524.243 7.63505 523 10C523.439 10.8356 524.056 11.5801 524.807 12.1935L525.518 11.4821C524.979 11.055 524.519 10.5539 524.158 10C525.311 8.23092 527.473 7 530 7C530 7 530 7 530 7L530.948 6.05196ZM530 13C532.527 12.9999 534.689 11.769 535.842 10C535.481 9.44626 535.021 8.94525 534.482 8.51821L535.194 7.80682C535.944 8.42019 536.561 9.16455 537 10C535.757 12.3649 533.09 14 530 14C529.679 14 529.363 13.9824 529.052 13.9481L530 13Z" fill="black"/>
<path id="Vector 169" d="M525 15L535 5" stroke="black"/>
</g>
<g id="hide-password_2">
<path id="Subtract_2" fill-rule="evenodd" clip-rule="evenodd" d="M530.948 26.052C530.638 26.0177 530.321 26 530 26C526.91 26 524.243 27.6351 523 30C523.439 30.8356 524.056 31.5801 524.807 32.1935L525.518 31.4821C524.979 31.055 524.519 30.5539 524.158 30C525.311 28.2309 527.473 27 530 27C530 27 530 27 530 27L530.948 26.052ZM530 33C532.527 32.9999 534.689 31.769 535.842 30C535.481 29.4463 535.021 28.9453 534.482 28.5182L535.194 27.8068C535.944 28.4202 536.561 29.1646 537 30C535.757 32.3649 533.09 34 530 34C529.679 34 529.363 33.9824 529.052 33.9481L530 33Z" fill="white"/>
<path id="Vector 169_2" d="M525 35L535 25" stroke="white"/>
</g>
<g id="arrow-up">
<path id="Union_4" fill-rule="evenodd" clip-rule="evenodd" d="M550 6.29297L550.354 6.64652L555.854 12.1465L555.146 12.8536L550 7.70718L544.854 12.8536L544.146 12.1465L549.646 6.64652L550 6.29297Z" fill="black"/>
</g>
<g id="arrow-up_2">
<path id="Union_3" fill-rule="evenodd" clip-rule="evenodd" d="M550 26.293L550.354 26.6465L555.854 32.1465L555.146 32.8536L550 27.7072L544.854 32.8536L544.146 32.1465L549.646 26.6465L550 26.293Z" fill="white"/>
</g>
<g id="arrow-down">
<path id="Union_2" fill-rule="evenodd" clip-rule="evenodd" d="M570 13.7071L570.354 13.3536L575.854 7.85359L575.146 7.14648L570 12.2929L564.854 7.14648L564.146 7.85359L569.646 13.3536L570 13.7071Z" fill="black"/>
</g>
<g id="arrow-down_2">
<path id="Union" fill-rule="evenodd" clip-rule="evenodd" d="M570 33.7071L570.354 33.3536L575.854 27.8536L575.146 27.1465L570 32.2929L564.854 27.1465L564.146 27.8536L569.646 33.3536L570 33.7071Z" fill="white"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 20 KiB

View file

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 152 76"><defs><path id="a" d="M144.9 0h-23.8c-3.9 0-7.1 3.2-7.1 7.1v23.7c0 3.9 3.2 7.1 7.1 7.1h23.8c3.9 0 7.1-3.2 7.1-7.1V7.1c0-3.9-3.2-7.1-7.1-7.1zm1.8 28.3c0 1.3-1.1 2.4-2.4 2.4h-22.4c-1.3 0-2.4-1.1-2.4-2.4V9.7c0-1.3 1.1-2.4 2.4-2.4h22.4c1.3 0 2.4 1.1 2.4 2.4v18.6zM68.9 0H45.1C41.2 0 38 3.2 38 7.1v23.7c0 3.9 3.2 7.1 7.1 7.1h23.7c3.9 0 7.1-3.2 7.1-7.1V7.1c.1-3.9-3.1-7.1-7-7.1zm-1.8 14.6v.7c0 6.9-5.2 14.8-14.8 14.8-2.9 0-5.7-.9-8-2.3.4 0 .8.1 1.2.1 2.4 0 4.7-.8 6.5-2.2-2.3 0-4.2-1.6-4.8-3.6.3 0 .6.1 1 .1.5 0 .8-.1 1.3-.2-2.4-.5-4.3-2.6-4.3-5.1.8.4 1.6.6 2.5.6-1.4-.9-2.3-2.5-2.3-4.3 0-.9.3-1.9.7-2.6 2.6 3.2 6.4 5.2 10.7 5.4-.1-.4-.1-.8-.1-1.2 0-2.9 2.3-5.2 5.2-5.2 1.5 0 2.8.6 3.8 1.6 1.2-.2 2.3-.7 3.3-1.3-.4 1.2-1.2 2.3-2.3 2.9 1.1-.1 2.1-.4 3-.8-.7 1-1.6 1.9-2.6 2.6zM30.9 0H7.1C3.2 0 0 3.2 0 7.1v23.7c0 4 3.2 7.2 7.1 7.2h11.7V26.8h-5.3v-5.7h5.3V17c0-4.8 3.2-7.5 7.9-7.5 2.2 0 4.2.1 4.7.2v5.1h-3.2c-2.6 0-3.1 1.1-3.1 2.7v3.6h6.1l-.8 5.7h-5.3V38h5.7c3.9 0 7.1-3.2 7.1-7.1V7.1c.1-3.9-3.1-7.1-7-7.1zm105.9 20.6c-1.1.9-2.4 2-3.8 2-1.5 0-2.8-1.1-3.8-2l-6-4.8c-.4-.3-.7-.6-1-.9v12.6c0 .2.2.5.4.5h20.7c.2 0 .4-.2.4-.5V14.9c-.3.3-.6.6-1 .9-1.9 1.6-3.9 3.2-5.9 4.8zM106.9 0H83.1C79.2 0 76 3.2 76 7.1v23.7c0 3.9 3.2 7.1 7.1 7.1h23.8c3.9 0 7.1-3.2 7.1-7.1V7.1c0-3.9-3.2-7.1-7.1-7.1zM89.6 28.5c-5.3 0-9.5-4.3-9.5-9.5s4.2-9.5 9.5-9.5c2.5 0 4.7.9 6.4 2.5l-2.6 2.5c-.7-.7-2-1.5-3.8-1.5-3.3 0-5.9 2.7-5.9 6s2.6 6 5.9 6c3.8 0 5.2-2.7 5.4-4.1h-5.4v-3.3h9c.1.5.1 1 .1 1.6 0 5.4-3.7 9.3-9.1 9.3zm20.3-8.1h-2.7v2.7h-2.7v-2.7h-2.7v-2.7h2.7V15h2.7v2.7h2.7v2.7zM143.3 10h-20.7c-.2 0-.4.2-.4.5 0 1.6.8 3 2.1 4 1.9 1.5 3.8 3 5.6 4.5.7.6 2.1 1.9 3.1 1.9s2.3-1.3 3.1-1.9c1.9-1.5 3.7-3 5.6-4.5.9-.7 2.1-2.3 2.1-3.5 0-.4.1-1-.5-1z"/></defs><use xlink:href="#a" fill="#999"/><use xlink:href="#a" fill="#666" y="38"/></svg>

Before

Width:  |  Height:  |  Size: 1.9 KiB

View file

@ -1 +0,0 @@
<svg id="Layer_2" xmlns="http://www.w3.org/2000/svg" viewBox="-4 23 100 24"><style>.st0{fill:#5B5B5B;} .st1{fill:#3A3A3A;} .st2{opacity:0.42;fill:#8C8C8C;enable-background:new ;} .st3{opacity:0.72;fill:#9B9B9B;enable-background:new ;} .st4{fill:#9B9B9B;}</style><path class="st0" d="M21.3 35.5c0-1.5.4-2.7 1.3-3.5.9-.8 1.9-1.2 3.1-1.2 1.2 0 2.2.4 3.1 1.2.9.8 1.3 1.9 1.3 3.5 0 1.5-.4 2.7-1.3 3.5-.9.8-1.9 1.2-3.1 1.2-1.2 0-2.2-.4-3.1-1.2-.8-.8-1.3-2-1.3-3.5zm1.9 0c0 1.1.2 1.8.6 2.3.4.5.8.8 1.3.9.1 0 .2 0 .3.1h.6c.1 0 .2 0 .3-.1.5-.1.9-.4 1.3-.9s.6-1.3.6-2.3c0-1-.2-1.8-.6-2.3-.4-.5-.8-.8-1.3-.9-.1 0-.2-.1-.3-.1h-.6c-.1 0-.2 0-.3.1-.5.1-.9.4-1.3.9s-.6 1.2-.6 2.3zm7.8-4.4h2.4l3.1 5.6.5 1.2v-6.8h1.8V40h-2.3l-3.2-5.9-.4-1h-.1l.1 1.6V40H31zm9.3 0h1.9v7.4h3.6V40h-5.5zm4.4 0h2.1l1.8 3 .2.7h.1l.3-.7 1.8-3h2l-3.3 5.2V40H48v-3.7z"/><path class="st1" d="M53.1 35.5c0-1.5.4-2.7 1.3-3.5.9-.8 1.9-1.2 3.1-1.2s2.2.4 3.1 1.2c.9.8 1.3 1.9 1.3 3.5 0 1.5-.4 2.7-1.3 3.5-.9.8-1.9 1.2-3.1 1.2-1.2 0-2.2-.4-3.1-1.2-.9-.8-1.3-2-1.3-3.5zm1.9 0c0 1.1.2 1.8.6 2.3.4.5.8.8 1.3.9.1 0 .2 0 .3.1h.6c.1 0 .2 0 .3-.1.5-.1.9-.4 1.3-.9s.6-1.3.6-2.3c0-1-.2-1.8-.6-2.3s-.8-.8-1.3-.9c-.1 0-.2-.1-.3-.1h-.6s-.2 0-.3.1c-.5.1-.9.4-1.3.9s-.6 1.2-.6 2.3zm7.8-4.4h5v1.5h-3.2v2.1h3.1v1.5h-3.1V40h-1.8zm6.1 0h5v1.5h-3.2v2.1h3v1.5h-3V40h-1.8zm6 8.9v-8.9h1.9V40zM85 31.3v1.6c-.3-.1-.6-.2-1-.3s-.7-.1-1.1-.1c-1 0-1.7.3-2.2.9-.5.6-.8 1.3-.8 2.2s.2 1.6.7 2.2c.5.6 1.2.9 2.1.9.3 0 .7 0 1-.1.4 0 .8-.2 1.2-.3l.1 1.5c-.1 0-.1.1-.2.1s-.2.1-.4.1h-.8c-.3 0-.7.1-1.1.1h-.4c-1-.1-2-.5-2.9-1.2-.9-.7-1.3-1.8-1.3-3.4 0-1.5.4-2.6 1.3-3.5.9-.8 2-1.2 3.4-1.2h1c.3 0 .6.1.9.2.1 0 .1 0 .2.1s.2.1.3.2zm1.1-.2h5.5v1.4H88v2.1h3.2V36H88v2.6h3.6V40h-5.5z"/><path class="st2" d="M7.4 43.1l-7.7-3.7c-.7-.3-.7-.8 0-1.1L2.3 37l5.1 2.4c.7.3 1.7.3 2.4 0l5.1-2.4 2.7 1.3c.7.3.7.8 0 1.1l-7.7 3.7c-.7.3-1.8.3-2.5 0z"/><path class="st3" d="M7.4 38.7L-.3 35c-.7-.3-.7-.8 0-1.1l2.7-1.3L7.5 35c.7.3 1.7.3 2.4 0l5.2-2.4 2.7 1.2c.7.3.7.8 0 1.1L10 38.6c-.8.4-1.9.4-2.6.1z"/><path class="st4" d="M7.4 34.3l-7.7-3.7c-.7-.3-.7-.8 0-1.1l7.7-3.7c.7-.3 1.7-.3 2.4 0l7.7 3.7c.7.3.7.8 0 1.1l-7.7 3.7c-.6.3-1.7.3-2.4 0z"/></svg>

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 323 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 323 B

View file

@ -1,702 +0,0 @@
@import "../../../../common/main/resources/less/asc-mixins.less";
// Bootstrap overwrite
@import "../../../../common/main/resources/less/variables.less";
@import "../../../../common/main/resources/less/colors-table.less";
@import "../../../../common/main/resources/less/colors-table-classic.less";
@import "../../../../common/main/resources/less/colors-table-dark.less";
@import "../../../../common/main/resources/less/colors-table-dark-contrast.less";
// Core variables and mixins
//@import "../../../../../vendor/bootstrap/less/variables.less";
@icon-font-path: "../../../../../vendor/bootstrap/dist/fonts/";
@import "../../../../../vendor/bootstrap/less/mixins.less";
// Reset
@import "../../../../../vendor/bootstrap/less/normalize.less";
//@import "../../../../../vendor/bootstrap/less/print.less";
// Core CSS
@import "../../../../../vendor/bootstrap/less/scaffolding.less";
@import "../../../../../vendor/bootstrap/less/type.less";
//@import "code.less";
//@import "grid.less";
//@import "tables.less";
@import "../../../../../vendor/bootstrap/less/forms.less";
@import "../../../../../vendor/bootstrap/less/buttons.less";
// Components
@import "../../../../../vendor/bootstrap/less/component-animations.less";
//@import "../../../../../vendor/bootstrap/less/glyphicons.less";
//@import "dropdowns.less";
//@import "button-groups.less";
//@import "input-groups.less";
//@import "navs.less";
//@import "navbar.less";
//@import "breadcrumbs.less";
//@import "pagination.less";
//@import "pager.less";
//@import "../../../../../vendor/bootstrap/less/labels.less";
//@import "badges.less";
//@import "jumbotron.less";
//@import "thumbnails.less";
//@import "../../../../../vendor/bootstrap/less/alerts.less";
//@import "progress-bars.less";
//@import "media.less";
//@import "list-group.less";
//@import "panels.less";
//@import "wells.less";
//@import "../../../../../vendor/bootstrap/less/close.less";
// Components w/ JavaScript
//@import "../../../../../vendor/bootstrap/less/modals.less";
@import "../../../../../vendor/bootstrap/less/tooltip.less";
//@import "../../../../../vendor/bootstrap/less/popovers.less";
@import "../../../../../vendor/bootstrap/less/dropdowns.less";
@import "../../../../../vendor/bootstrap/less/button-groups.less";
@import "../../../../../vendor/bootstrap/less/input-groups.less";
//@import "carousel.less";
// Utility classes
@import "../../../../../vendor/bootstrap/less/utilities.less";
@import "../../../../../vendor/bootstrap/less/responsive-utilities.less";
@import "../../../../common/main/resources/less/buttons.less";
@import "../../../../common/main/resources/less/dropdown-menu.less";
@import "../../../../common/main/resources/less/dropdown-submenu.less";
@import "../../../../common/main/resources/less/separator.less";
@import "../../../../common/main/resources/less/input.less";
@import "../../../../common/main/resources/less/combobox.less";
@import "../../../../common/main/resources/less/window.less";
@import "../../../../common/main/resources/less/loadmask.less";
@import "../../../../common/main/resources/less/dataview.less";
@import "../../../../common/main/resources/less/tooltip.less";
@import "../../../../common/main/resources/less/scroller.less";
@import "../../../../common/main/resources/less/synchronize-tip.less";
@import "../../../../common/main/resources/less/common.less";
@import "../../../../common/main/resources/less/winxp_fix.less";
@import "../../../../common/main/resources/less/calendar.less";
@import "../../../../common/main/resources/less/spinner.less";
@import "../../../../common/main/resources/less/checkbox.less";
@import "../../../../common/main/resources/less/opendialog.less";
@import "../../../../common/main/resources/less/advanced-settings-window.less";
@import "../../../../common/main/resources/less/searchdialog.less";
@toolbarBorderColor: @border-toolbar-ie;
@toolbarBorderColor: @border-toolbar;
@toolbarTopColor: @background-toolbar-ie;
@toolbarTopColor: @background-toolbar;
@toolbarFontSize: 12px;
@iconSpriteCommonPath: "../../../../common/forms/resources/img/glyphicons.png";
@icon-socnet-size: 40px;
@loadmask-zindex: 10000;
.embed-body {
-moz-user-select: -moz-none;
-khtml-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
font-size: @toolbarFontSize;
overflow: hidden;
color: @text-normal-ie;
color: @text-normal;
}
// Document Viewer
// -------------------------
.viewer {
position: absolute;
margin: 0;
padding: 0;
left: 0;
right: 0;
&.top {
top: 40px;
bottom: 0;
}
&.bottom {
top: 0;
bottom: 46px;
}
}
// Toolbar
// -------------------------
.toolbar {
position: fixed;
font-size: @toolbarFontSize;
min-width: 340px;
z-index: 100;
background-color: @toolbarTopColor;
display: flex;
align-items: center;
white-space: nowrap;
&.top {
top: 0;
left: 0;
width: 100%;
height: 40px;
.box-inner-shadow(0 -1px 0 @toolbarBorderColor);
}
.group {
margin: 0;
padding: 0;
.item {
input {
font-size: inherit;
padding: 0;
text-align: right;
}
.text {
cursor: default;
}
}
&.left {
left: 0;
padding-left: 10px;
.item {
float: left;
}
& > div {
display: inline-block;
vertical-align: middle;
}
}
&.right {
right: 0;
padding-right: 10px;
.item {
display: inline-block;
}
}
&.center {
display: flex;
justify-content: center;
flex-grow: 1;
overflow: hidden;
padding: 0 20px;
#title-doc-name {
overflow: hidden;
text-overflow: ellipsis;
}
}
}
.margin-right-small {
margin-right: 8px;
}
.margin-right-large {
margin-right: 12px;
}
.margin-left-small {
margin-left: 8px;
}
.margin-left-large {
margin-left: 12px;
}
}
// Logo
// -------------------------
.brand-logo {
display: block;
width: 100px;
height: 20px;
background: data-uri('../../../../common/main/resources/img/header/dark-logo_s.svg') no-repeat;
}
.theme-type-dark {
.brand-logo {
background: data-uri('../../../../common/main/resources/img/header/header-logo_s.svg') no-repeat;
}
}
.btn-text-default {
width: auto;
&.colored {
padding: 0 16px;
height: 28px;
background-color: @background-accent-button-ie;
background-color: @background-accent-button;
border: 1px solid transparent;
border-radius: 3px;
color: @text-contrast-background-ie !important;
color: @text-contrast-background !important;
font-weight: 700;
&:hover:not(.disabled),
.over:not(.disabled) {
background-color: @highlight-accent-button-hover-ie !important;
background-color: @highlight-accent-button-hover !important;
}
&:active:not(.disabled),
&.active:not(.disabled) {
background-color: @highlight-accent-button-pressed-ie !important;
background-color: @highlight-accent-button-pressed !important;
}
}
}
// Overlay control
// -------------------------
.overlay-controls {
position: absolute;
bottom: 55px;
z-index: 10;
left: 50%;
ul {
padding: 0;
list-style-type: none;
margin: 0 auto;
li {
display: inline-block;
&:first-child {
margin-right: 5px;
}
&:last-child {
margin-left: 5px;
}
}
}
.overlay {
width: 32px;
height: 32px;
display: inline-block;
cursor: pointer;
background-color: black;
border: 5px solid black;
border-radius: 50%;
outline: none;
opacity: 0.3;
background-origin: content-box;
padding: 1px 0 0 1px;
.box-shadow(0 0 0 2px rgba(255,255,255,0.3));
&:hover {
opacity: .6;
}
&.active, &:active {
opacity: .8;
}
}
}
// Error mask
// -------------------------
.errormask {
position: absolute;
left: 0;
top: 0;
height: 100%;
width: 100%;
overflow: hidden;
border: none;
background-color: #f4f4f4;
z-index: 30002;
.error-body {
position: relative;
top: 40%;
width: 400px;
margin: 0 auto;
padding: 20px;
background-color: #FFFFFF;
border: 1px solid #C0C0C0;
.title {
font-weight: bold;
font-size: 1.6em;
padding-bottom: 10px;
}
}
}
// Modals
// -------------------------
.share-buttons {
ul {
width: 244px;
//height: 25px;
list-style-type: none;
margin: 5px 0 0;
overflow: hidden;
li {
display: inline-block;
float: left;
margin: 1px 5px 0 0;
vertical-align: middle;
&.share-mail {
float: right;
padding-right: 1px;
margin: 0;
a {
min-width: 64px;
}
.glyphicon {
margin-right: 4px;
}
}
&.share-twitter {
max-width: 93px;
}
}
}
}
.size-manual {
margin-bottom: 10px;
.right {
float: right;
}
.caption {
margin-top: 2px;
margin-right: 8px;
}
input {
display: inline-block;
font-size: 1em;
padding: 0 4px;
//border-radius: 0;
margin: 0;
margin-top: -1px;
&.input-xs {
width: 50px;
}
}
}
.socnet-btn(@index) {
background-position: -@icon-socnet-size*@index 0;
&:hover {
background-position: -@icon-socnet-size*@index -@icon-socnet-size;
}
}
.svg {
background: data-uri('../../../../common/forms/resources/img/icon-social-sprite.svg');
width: 40px;
height: 40px;
background-size: @icon-socnet-size*4 @icon-socnet-size*2;
&.big-facebook:hover {
background-position: 0 -@icon-socnet-size;
}
&.big-twitter { .socnet-btn(1); }
&.big-gplus { .socnet-btn(2); }
&.big-email { .socnet-btn(3); }
}
@icon-width: 20px;
@icon-height: 20px;
.theme-type-dark {
@neg-value: -@icon-height;
--icon-normal-top: @neg-value;
}
@icon-normal-top: var(--icon-normal-top, 0);
.svg-icon {
background: data-uri('../../../../common/forms/resources/img/icon-menu-sprite.svg') no-repeat;
background-size: @icon-width*29 @icon-height*2;
&.download {
background-position: -@icon-width 0;
background-position: -@icon-width @icon-normal-top;
}
&.share {
background-position: -@icon-width*2 0;
background-position: -@icon-width*2 @icon-normal-top;
}
&.embed {
background-position: -@icon-width*3 0;
background-position: -@icon-width*3 @icon-normal-top;
}
&.fullscr {
background-position: -@icon-width*4 0;
background-position: -@icon-width*4 @icon-normal-top;
}
&.zoom-in {
background-position: -@icon-width*5 0;
background-position: -@icon-width*5 @icon-normal-top;
}
&.zoom-out {
background-position: -@icon-width*6 0;
background-position: -@icon-width*6 @icon-normal-top;
}
&.zoom-up {
background-position: -@icon-width*5 -@icon-height;
}
&.zoom-down {
background-position: -@icon-width*6 -@icon-height;
}
&.slide-prev {
background-position: -@icon-width*7 -@icon-height;
}
&.slide-next {
background-position: -@icon-width*8 -@icon-height;
}
&.play {
background-position: -@icon-width*9 -@icon-height;
}
&.pause {
background-position: -@icon-width*10 -@icon-height;
}
&.print {
background-position: -@icon-width*11 0;
background-position: -@icon-width*11 @icon-normal-top;
}
&.arrow-up {
background-position: -@icon-width*17 0;
background-position: -@icon-width*17 @icon-normal-top;
}
&.arrow-down {
background-position: -@icon-width*16 0;
background-position: -@icon-width*16 @icon-normal-top;
}
&.clear-style {
background-position: -@icon-width*12 0;
background-position: -@icon-width*12 @icon-normal-top;
}
&.go-to-location {
background-position: -@icon-width*15 0;
background-position: -@icon-width*15 @icon-normal-top;
}
&.more-vertical {
background-position: -@icon-width*14 0;
background-position: -@icon-width*14 @icon-normal-top;
}
&.cut {
background-position: -@icon-width*19 0;
background-position: -@icon-width*19 @icon-normal-top;
}
&.copy {
background-position: -@icon-width*20 0;
background-position: -@icon-width*20 @icon-normal-top;
}
&.paste {
background-position: -@icon-width*21 0;
background-position: -@icon-width*21 @icon-normal-top;
}
&.undo {
background-position: -@icon-width*22 0;
background-position: -@icon-width*22 @icon-normal-top;
}
&.redo {
background-position: -@icon-width*23 0;
background-position: -@icon-width*23 @icon-normal-top;
}
&.search {
background-position: -@icon-width*24 0;
background-position: -@icon-width*24 @icon-normal-top;
}
&.btn-sheet-view {
background-position: -@icon-width*25 0;
background-position: -@icon-width*25 @icon-normal-top;
}
&.hide-password {
background-position: -@icon-width*26 0;
background-position: -@icon-width*26 @icon-normal-top;
}
&.search-close {
background-position: -@icon-width*18 0;
background-position: -@icon-width*18 @icon-normal-top;
}
&.search-arrow-up {
background-position: -@icon-width*27 0;
background-position: -@icon-width*27 @icon-normal-top;
}
&.search-arrow-down {
background-position: -@icon-width*28 0;
background-position: -@icon-width*28 @icon-normal-top;
}
}
.btn {
&.active, &:active {
&:not(:disabled):not(.disabled) {
.icon {
@btn-active-icon-offset: -20px;
background-position-y: @btn-active-icon-offset;
background-position-y: var(--button-small-active-icon-offset-x, 0);
}
}
}
}
.mi-icon {
width: @icon-width;
height: @icon-height;
float: left;
margin: -3px 4px 0 -24px;
}
.modal-dlg {
textarea {
.user-select(text);
width: 100%;
resize: none;
margin-bottom: 5px;
border: @scaled-one-px-value-ie solid @border-regular-control-ie;
border: @scaled-one-px-value solid @border-regular-control;
height: 100%;
&.disabled {
opacity: @component-disabled-opacity;
cursor: default !important;
}
}
label {
.font-size-normal();
font-weight: normal;
&.input-label{
margin-bottom: 0;
vertical-align: middle;
}
&.header {
font-weight: bold;
}
}
.form-control[readonly] {
cursor: auto;
}
.share-buttons {
height: 40px;
text-align: center;
span {
display: inline-block;
margin: 0 7px;
cursor: pointer;
}
}
}
.masked {
background-color: transparent;
border-color: transparent;
.box-shadow(none);
}
#pages {
cursor: pointer;
display: inline-block;
line-height: 22px;
padding: 0 0 0 3px;
vertical-align: middle;
}
#page-number {
.masked {
cursor: pointer;
line-height: 22px;
}
}
.submit-tooltip {
position: absolute;
z-index: 1000;
top: 58px;
right: 15px;
padding: 7px 15px;
border-radius: 5px;
background-color: @background-notification-popover-ie;
background-color: @background-notification-popover;
.box-shadow(0 4px 15px -2px rgba(0, 0, 0, 0.5));
font-size: 11px;
}
.menu-zoom {
line-height: @line-height-base;
.title {
padding: 5px 5px 5px 28px;
float: left;
font-weight: normal;
font-size: 11px;
margin: 0px;
text-overflow: ellipsis;
}
.zoom {
padding: 5px 3px;
float: right;
min-width: 40px;
text-align: center;
font-weight: normal;
font-size: 11px;
padding-bottom: 0px;
}
.mi-icon {
margin: 0;
}
}
.font-size-small {
.fontsize(@font-size-small);
}
.font-size-normal {
.fontsize(@font-size-base);
}
.font-size-large {
.fontsize(@font-size-large);
}
.search-bar {
z-index: 50;
}

View file

@ -38,10 +38,7 @@ Common.Locale = new(function() {
"use strict"; "use strict";
var l10n = null; var l10n = null;
var loadcallback, var loadcallback,
apply = false, apply = false;
defLang = '{{DEFAULT_LANG}}',
currentLang = defLang,
_4letterLangs = ['pt-pt', 'zh-tw'];
var _applyLocalization = function(callback) { var _applyLocalization = function(callback) {
try { try {
@ -76,26 +73,11 @@ Common.Locale = new(function() {
var res = ''; var res = '';
if (l10n && scope && scope.name) { if (l10n && scope && scope.name) {
res = l10n[scope.name + '.' + prop]; res = l10n[scope.name + '.' + prop];
if ( !res && scope.default )
res = scope.default;
} }
return res || (scope ? eval(scope.name).prototype[prop] : ''); return res || (scope ? eval(scope.name).prototype[prop] : '');
}; };
var _getCurrentLanguage = function() {
return currentLang;
};
var _getDefaultLanguage = function() {
return defLang;
};
var _getLoadedLanguage = function() {
return loadedLang;
};
var _getUrlParameterByName = function(name) { var _getUrlParameterByName = function(name) {
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
@ -103,33 +85,22 @@ Common.Locale = new(function() {
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}; };
var _requireLang = function (l) { var _requireLang = function () {
typeof l != 'string' && (l = null); var lang = (_getUrlParameterByName('lang') || 'en').split(/[\-_]/)[0];
var lang = (l || _getUrlParameterByName('lang') || defLang);
var idx4Letters = _4letterLangs.indexOf(lang.replace('_', '-').toLowerCase()); // try to load 4 letters language
lang = (idx4Letters<0) ? lang.split(/[\-_]/)[0] : _4letterLangs[idx4Letters];
currentLang = lang;
fetch('locale/' + lang + '.json') fetch('locale/' + lang + '.json')
.then(function(response) { .then(function(response) {
if (!response.ok) { if (!response.ok) {
if (idx4Letters>=0) { // try to load 2-letters language if (lang != 'en')
throw new Error('4letters error');
}
currentLang = defLang;
if (lang != defLang)
/* load default lang if fetch failed */ /* load default lang if fetch failed */
return fetch('locale/' + defLang + '.json'); return fetch('locale/en.json');
throw new Error('server error'); throw new Error('server error');
} }
return response.json(); return response.json();
}).then(function(response) { }).then(function(response) {
if ( response.json ) { if ( response.then )
if (!response.ok)
throw new Error('server error');
return response.json(); return response.json();
} else { else {
l10n = response; l10n = response;
/* to break promises chain */ /* to break promises chain */
throw new Error('loaded'); throw new Error('loaded');
@ -138,25 +109,11 @@ Common.Locale = new(function() {
l10n = json || {}; l10n = json || {};
apply && _applyLocalization(); apply && _applyLocalization();
}).catch(function(e) { }).catch(function(e) {
if ( /4letters/.test(e) ) {
return setTimeout(function(){
_requireLang(lang.split(/[\-_]/)[0]);
}, 0);
}
if ( !/loaded/.test(e) && currentLang != defLang && defLang && defLang.length < 3 ) {
return setTimeout(function(){
_requireLang(defLang)
}, 0);
}
l10n = l10n || {}; l10n = l10n || {};
apply && _applyLocalization(); apply && _applyLocalization();
if ( e.message == 'loaded' ) { if ( e.message == 'loaded' ) {
} else { } else
currentLang = null;
console.log('fetch error: ' + e); console.log('fetch error: ' + e);
}
}); });
}; };
@ -164,7 +121,7 @@ Common.Locale = new(function() {
/* use fetch polifill if native method isn't supported */ /* use fetch polifill if native method isn't supported */
var polyfills = ['../vendor/fetch/fetch.umd']; var polyfills = ['../vendor/fetch/fetch.umd'];
if ( !window.Promise ) { if ( !window.Promise ) {
require(['../vendor/es6-promise/es6-promise.auto.min'], require(['../vendor/es6-promise/es6-promise.auto.min.js'],
function () { function () {
require(polyfills, _requireLang); require(polyfills, _requireLang);
}); });
@ -173,9 +130,7 @@ Common.Locale = new(function() {
return { return {
apply: _applyLocalization, apply: _applyLocalization,
get: _get, get: _get
getCurrentLanguage: _getCurrentLanguage,
getDefaultLanguage: _getDefaultLanguage
}; };
})(); })();

View file

@ -48,6 +48,12 @@ define([
'common/main/lib/model/Font' 'common/main/lib/model/Font'
], function(Backbone){ 'use strict'; ], function(Backbone){ 'use strict';
Common.Collections.Fonts = Backbone.Collection.extend({ Common.Collections.Fonts = Backbone.Collection.extend({
model: Common.Models.Font model: Common.Models.Font,
comparator: function(item1, item2) {
var n1 = item1.get('name').toLowerCase(),
n2 = item2.get('name').toLowerCase();
if (n1==n2) return 0;
return (n1<n2) ? -1 : 1;
}
}); });
}); });

View file

@ -64,18 +64,10 @@ define([
return this.filter(function(item){return item.get('online') && !item.get('view')}).length; return this.filter(function(item){return item.get('online') && !item.get('view')}).length;
}, },
getVisibleEditingCount: function() {
return this.filter(function(item){return item.get('online') && !item.get('view') && !item.get('hidden')}).length;
},
getEditingOriginalCount: function() { getEditingOriginalCount: function() {
return this.chain().filter(function(item){return item.get('online') && !item.get('view')}).groupBy(function(item) {return item.get('idOriginal');}).size().value(); return this.chain().filter(function(item){return item.get('online') && !item.get('view')}).groupBy(function(item) {return item.get('idOriginal');}).size().value();
}, },
getVisibleEditingOriginalCount: function() {
return this.chain().filter(function(item){return item.get('online') && !item.get('view') && !item.get('hidden')}).groupBy(function(item) {return item.get('idOriginal');}).size().value();
},
findUser: function(id) { findUser: function(id) {
return this.find( return this.find(
function(model){ function(model){

View file

@ -187,14 +187,13 @@ define([
'<img src="<%= iconImg %>">' + '<img src="<%= iconImg %>">' +
'<% } else { %>' + '<% } else { %>' +
'<% if (/svgicon/.test(iconCls)) {' + '<% if (/svgicon/.test(iconCls)) {' +
'print(\'<svg class=\"icon\"><use class=\"zoom-int\" xlink:href=\"#\' + /svgicon\\s(\\S+)/.exec(iconCls)[1] + \'\"></use>' + 'print(\'<svg width="26" height="26" class=\"icon\"><use href=\"#\' + /svgicon\\s(\\S+)/.exec(iconCls)[1] + \'\"></use></svg>\');' +
'<use class=\"zoom-grit\" xlink:href=\"#\' + /svgicon\\s(\\S+)/.exec(iconCls)[1] + \'-150\"></use></svg>\');' +
'} else ' + '} else ' +
'print(\'<i class=\"icon \' + iconCls + \'\">&nbsp;</i>\'); %>' + 'print(\'<i class=\"icon \' + iconCls + \'\">&nbsp;</i>\'); %>' +
'<% } %>'; '<% } %>';
var templateHugeCaption = var templateHugeCaption =
'<button type="button" class="btn <%= cls %>" id="<%= id %>" data-hint="<%= dataHint %>" data-hint-direction="<%= dataHintDirection %>" data-hint-offset="<%= dataHintOffset %>" <% if (dataHintTitle) { %> data-hint-title="<%= dataHintTitle %>" <% } %>> ' + '<button type="button" class="btn <%= cls %>" id="<%= id %>" > ' +
'<div class="inner-box-icon">' + '<div class="inner-box-icon">' +
templateBtnIcon + templateBtnIcon +
'</div>' + '</div>' +
@ -205,15 +204,13 @@ define([
var templateHugeMenuCaption = var templateHugeMenuCaption =
'<div class="btn-group icon-top" id="<%= id %>" style="<%= style %>">' + '<div class="btn-group icon-top" id="<%= id %>" style="<%= style %>">' +
'<button type="button" class="btn dropdown-toggle <%= cls %>" data-toggle="dropdown" data-hint="<%= dataHint %>" data-hint-direction="<%= dataHintDirection %>" data-hint-offset="<%= dataHintOffset %>" <% if (dataHintTitle) { %> data-hint-title="<%= dataHintTitle %>" <% } %>>' + '<button type="button" class="btn dropdown-toggle <%= cls %>" data-toggle="dropdown">' +
'<div class="inner-box-icon">' + '<div class="inner-box-icon">' +
templateBtnIcon + templateBtnIcon +
'</div>' + '</div>' +
'<div class="inner-box-caption">' + '<div class="inner-box-caption">' +
'<span class="caption"><%= caption %>' + '<span class="caption"><%= caption %></span>' +
'<i class="caret"></i>' + '<i class="caret img-commonctrl"></i>' +
'</span>' +
'<i class="caret compact-caret"></i>' +
'</div>' + '</div>' +
'</button>' + '</button>' +
'</div>'; '</div>';
@ -225,40 +222,14 @@ define([
templateBtnIcon + templateBtnIcon +
'</span>' + '</span>' +
'</button>' + '</button>' +
'<button type="button" class="btn <%= cls %> inner-box-caption dropdown-toggle" data-toggle="dropdown" data-hint="<%= dataHint %>" data-hint-direction="<%= dataHintDirection %>" data-hint-offset="<%= dataHintOffset %>" <% if (dataHintTitle) { %> data-hint-title="<%= dataHintTitle %>" <% } %>>' + '<button type="button" class="btn <%= cls %> inner-box-caption dropdown-toggle" data-toggle="dropdown">' +
'<span class="btn-fixflex-vcenter">' + '<span class="btn-fixflex-vcenter">' +
'<span class="caption"><%= caption %>' + '<span class="caption"><%= caption %></span>' +
'<i class="caret"></i>' + '<i class="caret img-commonctrl"></i>' +
'</span>' +
'<i class="caret compact-caret"></i>' +
'</span>' + '</span>' +
'</button>' + '</button>' +
'</div>'; '</div>';
var getWidthOfCaption = function (txt) {
var el = document.createElement('span');
el.style.fontSize = '11px';
el.style.fontFamily = 'Arial, Helvetica, "Helvetica Neue", sans-serif';
el.style.position = "absolute";
el.style.top = '-1000px';
el.style.left = '-1000px';
el.innerHTML = txt;
document.body.appendChild(el);
var result = el.offsetWidth;
document.body.removeChild(el);
return result;
};
var getShortText = function (txt, max) {
var lastIndex = txt.length - 1,
word = txt;
while (getWidthOfCaption(word) > max) {
word = txt.slice(0, lastIndex).trim() + '...';
lastIndex--;
}
return word;
};
Common.UI.Button = Common.UI.BaseView.extend({ Common.UI.Button = Common.UI.BaseView.extend({
options : { options : {
id : null, id : null,
@ -273,10 +244,7 @@ define([
disabled : false, disabled : false,
pressed : false, pressed : false,
split : false, split : false,
visible : true, visible : true
dataHint : '',
dataHintDirection: '',
dataHintOffset: '0, 0'
}, },
template: _.template([ template: _.template([
@ -285,24 +253,23 @@ define([
// '<% if (iconCls != "") { print(\'<i class=\"icon \' + iconCls + \'\">&nbsp;</i>\'); }} %>', // '<% if (iconCls != "") { print(\'<i class=\"icon \' + iconCls + \'\">&nbsp;</i>\'); }} %>',
'<% if (iconCls != "") { ' + '<% if (iconCls != "") { ' +
' if (/svgicon/.test(iconCls)) {' + ' if (/svgicon/.test(iconCls)) {' +
'print(\'<svg class=\"icon\"><use class=\"zoom-int\" xlink:href=\"#\' + /svgicon\\s(\\S+)/.exec(iconCls)[1] + \'\"></use>' + 'print(\'<svg class=\"icon\"><use xlink:href=\"#\' + /svgicon\\s(\\S+)/.exec(iconCls)[1] + \'\"></use></svg>\');' +
'<use class=\"zoom-grit\" xlink:href=\"#\' + /svgicon\\s(\\S+)/.exec(iconCls)[1] + \'-150\"></use></svg>\');' +
'} else ' + '} else ' +
'print(\'<i class=\"icon \' + iconCls + \'\">&nbsp;</i>\'); ' + 'print(\'<i class=\"icon \' + iconCls + \'\">&nbsp;</i>\'); ' +
'}} %>', '}} %>',
'<% } %>', '<% } %>',
'<% if ( !menu ) { %>', '<% if ( !menu ) { %>',
'<button type="button" class="btn <%= cls %>" id="<%= id %>" style="<%= style %>" data-hint="<%= dataHint %>" data-hint-direction="<%= dataHintDirection %>" data-hint-offset="<%= dataHintOffset %>" <% if (dataHintTitle) { %> data-hint-title="<%= dataHintTitle %>" <% } %>>', '<button type="button" class="btn <%= cls %>" id="<%= id %>" style="<%= style %>">',
'<% applyicon() %>', '<% applyicon() %>',
'<span class="caption"><%= caption %></span>', '<span class="caption"><%= caption %></span>',
'</button>', '</button>',
'<% } else if (split == false) {%>', '<% } else if (split == false) {%>',
'<div class="btn-group" id="<%= id %>" style="<%= style %>">', '<div class="btn-group" id="<%= id %>" style="<%= style %>">',
'<button type="button" class="btn dropdown-toggle <%= cls %>" data-toggle="dropdown" data-hint="<%= dataHint %>" data-hint-direction="<%= dataHintDirection %>" data-hint-offset="<%= dataHintOffset %>" <% if (dataHintTitle) { %> data-hint-title="<%= dataHintTitle %>" <% } %>>', '<button type="button" class="btn dropdown-toggle <%= cls %>" data-toggle="dropdown">',
'<% applyicon() %>', '<% applyicon() %>',
'<span class="caption"><%= caption %></span>', '<span class="caption"><%= caption %></span>',
'<span class="inner-box-caret">' + '<span class="inner-box-caret">' +
'<i class="caret"></i>' + '<i class="caret img-commonctrl"></i>' +
'</span>', '</span>',
'</button>', '</button>',
'</div>', '</div>',
@ -312,8 +279,8 @@ define([
'<% applyicon() %>', '<% applyicon() %>',
'<span class="caption"><%= caption %></span>', '<span class="caption"><%= caption %></span>',
'</button>', '</button>',
'<button type="button" class="btn <%= cls %> dropdown-toggle" data-toggle="dropdown" data-hint="<%= dataHint %>" data-hint-direction="<%= dataHintDirection %>" data-hint-offset="<%= dataHintOffset %>" <% if (dataHintTitle) { %> data-hint-title="<%= dataHintTitle %>" <% } %>>', '<button type="button" class="btn <%= cls %> dropdown-toggle" data-toggle="dropdown">',
'<i class="caret"></i>', '<i class="caret img-commonctrl"></i>',
'<span class="sr-only"></span>', '<span class="sr-only"></span>',
'</button>', '</button>',
'</div>', '</div>',
@ -344,39 +311,7 @@ define([
if (me.options.el) { if (me.options.el) {
me.render(); me.render();
} else if (me.options.parentEl)
me.render(me.options.parentEl);
},
getCaptionWithBreaks: function (caption) {
var words = caption.split(' '),
newCaption = null,
maxWidth = 85 - 4;
if (words.length > 1) {
maxWidth = !!this.menu || this.split === true ? maxWidth - 10 : maxWidth;
if (words.length < 3) {
words[1] = getShortText(words[1], maxWidth);
newCaption = words[0] + '<br>' + words[1];
} else {
if (getWidthOfCaption(words[0] + ' ' + words[1]) < maxWidth) { // first and second words in first line
words[2] = getShortText(words[2], maxWidth);
newCaption = words[0] + ' ' + words[1] + '<br>' + words[2];
} else if (getWidthOfCaption(words[1] + ' ' + words[2]) < maxWidth) { // second and third words in second line
words[2] = getShortText(words[2], maxWidth);
newCaption = words[0] + '<br>' + words[1] + ' ' + words[2];
} else {
words[1] = getShortText(words[1] + ' ' + words[2], maxWidth);
newCaption = words[0] + '<br>' + words[1];
} }
}
} else {
var width = getWidthOfCaption(caption);
newCaption = width < maxWidth ? caption : getShortText(caption, maxWidth);
if (!!this.menu || this.split === true) {
newCaption += '<br>';
}
}
return newCaption;
}, },
render: function(parentEl) { render: function(parentEl) {
@ -400,10 +335,6 @@ define([
} else { } else {
this.template = _.template(templateHugeCaption); this.template = _.template(templateHugeCaption);
} }
var newCaption = this.getCaptionWithBreaks(this.caption);
if (newCaption) {
me.caption = newCaption;
}
} }
me.cmpEl = $(this.template({ me.cmpEl = $(this.template({
@ -416,11 +347,7 @@ define([
disabled : me.disabled, disabled : me.disabled,
pressed : me.pressed, pressed : me.pressed,
caption : me.caption, caption : me.caption,
style : me.style, style : me.style
dataHint : me.options.dataHint,
dataHintDirection: me.options.dataHintDirection,
dataHintOffset: me.options.dataHintOffset,
dataHintTitle: me.options.dataHintTitle
})); }));
if (me.menu && _.isObject(me.menu) && _.isFunction(me.menu.render)) if (me.menu && _.isObject(me.menu) && _.isFunction(me.menu.render))
@ -646,13 +573,6 @@ define([
this.trigger('toggle', this, state); this.trigger('toggle', this, state);
}, },
click: function(opts) {
if ( !this.disabled ) {
this.doToggle();
this.trigger('click', this, opts);
}
},
isActive: function() { isActive: function() {
if (this.enableToggle) if (this.enableToggle)
return this.pressed; return this.pressed;
@ -717,32 +637,8 @@ define([
oldCls = this.iconCls; oldCls = this.iconCls;
this.iconCls = cls; this.iconCls = cls;
if (/svgicon/.test(this.iconCls)) {
var icon = /svgicon\s(\S+)/.exec(this.iconCls);
btnIconEl.find('use.zoom-int').attr('xlink:href', icon && icon.length>1 ? '#' + icon[1]: '');
btnIconEl.find('use.zoom-grit').attr('xlink:href', icon && icon.length>1 ? '#' + icon[1] + '-150' : '');
} else {
btnIconEl.removeClass(oldCls); btnIconEl.removeClass(oldCls);
btnIconEl.addClass(cls || ''); btnIconEl.addClass(cls || '');
}
},
changeIcon: function(opts) {
var me = this;
if ( opts && (opts.curr || opts.next) && me.$icon) {
!!opts.curr && (me.$icon.removeClass(opts.curr));
!!opts.next && !me.$icon.hasClass(opts.next) && (me.$icon.addClass(opts.next));
if ( !!me.options.signals ) {
if ( !(me.options.signals.indexOf('icon:changed') < 0) ) {
me.trigger('icon:changed', me, opts);
}
}
}
},
hasIcon: function(iconcls) {
return this.$icon.hasClass(iconcls);
}, },
setVisible: function(visible) { setVisible: function(visible) {
@ -811,19 +707,15 @@ define([
setCaption: function(caption) { setCaption: function(caption) {
if (this.caption != caption) { if (this.caption != caption) {
if ( /icon-top/.test(this.cls) && !!this.caption && /huge/.test(this.cls) ) {
var newCaption = this.getCaptionWithBreaks(caption);
this.caption = newCaption || caption;
} else
this.caption = caption; this.caption = caption;
if (this.rendered) { if (this.rendered) {
var captionNode = this.cmpEl.find('.caption'); var captionNode = this.cmpEl.find('button:first > .caption').addBack().filter('button > .caption');
if (captionNode.length > 0) { if (captionNode.length > 0) {
captionNode.html(this.caption); captionNode.text(caption);
} else { } else {
this.cmpEl.find('button:first').addBack().filter('button').html(this.caption); this.cmpEl.find('button:first').addBack().filter('button').text(caption);
} }
} }
} }

View file

@ -1,500 +0,0 @@
/*
*
* (c) Copyright Ascensio System SIA 2010-2019
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
if (Common === undefined)
var Common = {};
define([
'common/main/lib/component/BaseView',
'common/main/lib/util/utils'
], function () {
'use strict';
Common.UI.Calendar = Common.UI.BaseView.extend(_.extend({
template :
_.template([
'<div id="calendar" class="calendar-box">',
'<div class="calendar-header">',
'<div class="top-row">',
'<div id="prev-arrow"><button type="button"><i class="arrow-prev img-commonctrl"></i></button></div>',
'<div class="title"></div>',
'<div id="next-arrow"><button type="button"><i class="arrow-next img-commonctrl" /></button></div>',
'</div>',
'<div class="bottom-row"></div>',
'</div>',
'<div class="calendar-content"></div>',
'</div>'
].join('')),
options: {
date: undefined,
firstday: 0 // 0 - sunday, 1 - monday
},
initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this;
this.monthNames = [this.textJanuary, this.textFebruary, this.textMarch, this.textApril, this.textMay, this.textJune, this.textJuly, this.textAugust, this.textSeptember, this.textOctober, this.textNovember, this.textDecember];
this.dayNamesShort = [this.textShortSunday, this.textShortMonday, this.textShortTuesday, this.textShortWednesday, this.textShortThursday, this.textShortFriday, this.textShortSaturday];
this.monthShortNames = [this.textShortJanuary, this.textShortFebruary, this.textShortMarch, this.textShortApril, this.textShortMay, this.textShortJune, this.textShortJuly, this.textShortAugust, this.textShortSeptember, this.textShortOctober, this.textShortNovember, this.textShortDecember];
me.options.date = options.date;
if (!_.isUndefined(options.firstday) && (options.firstday === 0 || options.firstday === 1)) {
me.options.firstday = options.firstday;
}
me.enableKeyEvents= me.options.enableKeyEvents;
me._state = undefined; // 0 - month, 1 - months, 2 - years
me.render();
},
render: function () {
var me = this;
me.cmpEl = me.$el || $(this.el);
me.cmpEl.html(this.template());
me.currentDate = me.options.date || new Date();
me.btnPrev = new Common.UI.Button({
parentEl: me.cmpEl.find('#prev-arrow'),
cls: '',
iconCls: 'arrow-prev img-commonctrl'
});
me.btnPrev.on('click', _.bind(me.onClickPrev, me));
me.btnNext = new Common.UI.Button({
parentEl: me.cmpEl.find('#next-arrow'),
cls: '',
iconCls: 'arrow-next img-commonctrl'
});
me.btnNext.on('click', _.bind(me.onClickNext, me));
me.cmpEl.on('keydown', function(e) {
me.trigger('calendar:keydown', me, e);
});
me.renderMonth(me.currentDate);
this.trigger('render:after', this);
return this;
},
onClickPrev: function () {
var me = this;
if (me._state === 0) {
var d = new Date(me.currentDate);
d.setMonth(d.getMonth() - 1);
if (d.getFullYear() > 0) {
me.renderMonth(d);
}
} else if (me._state === 1) {
var d = new Date(me.currentDate);
d.setFullYear(d.getFullYear() - 1);
if (d.getFullYear() > 0) {
me.renderMonths(d);
}
} else if (me._state === 2) {
var year = me.currentDate.getFullYear(),
newYear;
if (year % 10 !== 0) {
newYear = String(year);
newYear = Number(newYear.slice(0, -1) + '0') - 1;
} else {
newYear = year - 1;
}
if (newYear > 0) {
me.currentDate.setFullYear(newYear);
me.renderYears(newYear);
}
}
},
onClickNext: function () {
var me = this;
if (me._state === 0) {
var d = new Date(me.currentDate);
d.setMonth(d.getMonth() + 1);
if (d.getFullYear() > 0) {
me.renderMonth(d);
}
} else if (me._state === 1) {
var d = new Date(me.currentDate);
d.setFullYear(d.getFullYear() + 1);
if (d.getFullYear() > 0) {
me.renderMonths(d);
}
} else if (me._state === 2) {
var year = me.currentDate.getFullYear(),
newYear;
if (year % 10 !== 9) {
newYear = String(year);
newYear = Number(newYear.slice(0, -1) + '9') + 1;
} else {
newYear = year + 1;
}
if (newYear > 0) {
me.currentDate.setFullYear(newYear);
me.renderYears(newYear);
}
}
},
renderYears: function (year) {
var me = this,
year = _.isNumber(year) ? year : (me.currentDate ? me.currentDate.getFullYear() : new Date().getFullYear());
me._state = 2;
me.$el.removeClass('view-days view-months').addClass('view-years');
var firstYear = year,
lastYear = year;
if ((firstYear % 10) !== 0) {
var strYear = String(year);
firstYear = Number(strYear.slice(0, -1) + '0');
}
if ((lastYear % 10) !== 9) {
var strYear = String(year);
lastYear = Number(strYear.slice(0, -1) + '9');
}
me.topTitle = _.template([
'<label>' + firstYear + '-' + lastYear + '</label>'
].join(''));
me.cmpEl.find('.calendar-header .title').html(me.topTitle);
me.bottomTitle = _.template([
'<label>' + me.textYears + '</label>'
].join(''));
me.cmpEl.find('.calendar-header .bottom-row').html(me.bottomTitle);
var arrYears = [];
var tmpYear = firstYear - 3;
for (var i = 0; i < 16; i++) {
arrYears.push({
year: (tmpYear > 0) ? tmpYear : '',
isCurrentDecade: ((tmpYear >= firstYear) && (tmpYear <= lastYear)) ? true : false,
disabled: (tmpYear > 0) ? false : true,
selected: (_.isDate(me.selectedDate)) ?
(tmpYear === me.selectedDate.getFullYear()) :
(tmpYear === new Date().getFullYear())
});
tmpYear++;
}
if (!me.yearPicker) {
me.yearPicker = new Common.UI.DataView({
el: me.cmpEl.find('.calendar-content'),
store: new Common.UI.DataViewStore(arrYears),
itemTemplate: _.template('<div class="name-year <% if (!isCurrentDecade) { %> no-current-decade <% } %>" data-year="<%= year %>"><%= year %></div>')
});
me.yearPicker.on('item:click', function (picker, item, record, e) {
var year = record.get('year'),
date = new Date();
date.setFullYear(year);
me.renderMonths(date);
});
me.enableKeyEvents && this.yearPicker.on('item:keydown', function(view, record, e) {
if (e.keyCode==Common.UI.Keys.ESC) {
Common.NotificationCenter.trigger('dataview:blur');
}
});
} else
me.yearPicker.store.reset(arrYears);
me.enableKeyEvents && _.delay(function() {
me.monthPicker.focus();
}, 10);
},
renderMonths: function (date) {
var me = this,
curDate = (_.isDate(date)) ? date : (me.currentDate ? me.currentDate : new Date()),
year = curDate.getFullYear();
me._state = 1;
me.currentDate = curDate;
me.$el.removeClass('view-years view-days').addClass('view-months');
// Number of year
me.topTitle = _.template([
'<div class="button"><label>' + year + '</label></div>'
].join(''));
me.cmpEl.find('.calendar-header .title').html(me.topTitle);
me.cmpEl.find('.calendar-header .title').off();
me.cmpEl.find('.calendar-header .title').on('click', _.bind(me.renderYears, me));
me.bottomTitle = _.template([
'<label>' + me.textMonths + '</label>'
].join(''));
me.cmpEl.find('.calendar-header .bottom-row').html(me.bottomTitle);
var arrMonths = [];
var today = new Date();
for (var ind = 0; ind < 12; ind++) {
arrMonths.push({
indexMonth: ind,
nameMonth: me.monthShortNames[ind],
year: year,
curYear: true,
isCurrentMonth: (ind === curDate.getMonth()),
selected: (_.isDate(me.selectedDate)) ?
(ind === me.selectedDate.getMonth() && year === me.selectedDate.getFullYear()) :
(ind === today.getMonth() && year === today.getFullYear())
});
}
year = year + 1;
for (var ind = 0; ind < 4; ind++) {
arrMonths.push({
indexMonth: ind,
nameMonth: me.monthShortNames[ind],
year: year,
curYear: false,
selected: (_.isDate(me.selectedDate)) ?
(ind === me.selectedDate.getMonth() && year === me.selectedDate.getFullYear()) :
(ind === today.getMonth() && year === today.getFullYear())
});
}
if (!me.monthsPicker) {
me.monthsPicker = new Common.UI.DataView({
el: me.cmpEl.find('.calendar-content'),
store: new Common.UI.DataViewStore(arrMonths),
itemTemplate: _.template('<div class="name-month <% if (!curYear) { %> no-cur-year <% } %>" data-month="<%= indexMonth %>" data-year="<%= year %>"><%= nameMonth %></div>')
});
me.monthsPicker.on('item:click', function (picker, item, record, e) {
var month = record.get('indexMonth'),
year = record.get('year'),
date = new Date();
date.setFullYear(year, month);
me.renderMonth(date);
});
me.enableKeyEvents && this.monthsPicker.on('item:keydown', function(view, record, e) {
if (e.keyCode==Common.UI.Keys.ESC) {
Common.NotificationCenter.trigger('dataview:blur');
}
});
} else
me.monthsPicker.store.reset(arrMonths);
me.enableKeyEvents && _.delay(function() {
me.monthPicker.focus();
}, 10);
},
renderMonth: function (date) {
var me = this;
me._state = 0;
var firstDay = me.options.firstday;
// Current date
var curDate = date || new Date(),
curMonth = curDate.getMonth(),
curIndexDayInWeek = curDate.getDay(),
curNumberDayInMonth = curDate.getDate(),
curYear = curDate.getFullYear();
me.currentDate = curDate;
me.$el.removeClass('view-years view-months').addClass('view-days');
// Name month
me.topTitle = _.template([
'<div class="button">',
'<label>' + me.monthNames[curMonth] + ' ' + curYear + '</label>',
'</div>'
].join(''));
me.cmpEl.find('.calendar-header .title').html(me.topTitle);
me.cmpEl.find('.calendar-header .title').off();
me.cmpEl.find('.calendar-header .title').on('click', _.bind(me.renderMonths, me));
// Name days of week
var dayNamesTemplate = '';
for (var i = firstDay; i < 7; i++) {
dayNamesTemplate += '<label>' + me.dayNamesShort[i] + '</label>';
}
if (firstDay > 0) {
dayNamesTemplate += '<label>' + me.dayNamesShort[0] + '</label>';
}
me.cmpEl.find('.calendar-header .bottom-row').html(_.template(dayNamesTemplate));
// Month
var rows = 6,
cols = 7;
var arrDays = [];
var d = new Date(curDate);
d.setDate(1);
var firstDayOfMonthIndex = d.getDay();
var daysInPrevMonth = me.daysInMonth(d.getTime() - (10 * 24 * 60 * 60 * 1000)),
numberDay,
month,
year;
if (firstDay === 0) {
numberDay = (firstDayOfMonthIndex > 0) ? (daysInPrevMonth - (firstDayOfMonthIndex - 1)) : 1;
} else {
if (firstDayOfMonthIndex === 0) {
numberDay = daysInPrevMonth - 5;
} else {
numberDay = daysInPrevMonth - (firstDayOfMonthIndex - 2);
}
}
if ((firstDayOfMonthIndex > 0 && firstDay === 0) || firstDay === 1) {
if (curMonth - 1 >= 0) {
month = curMonth - 1;
year = curYear;
} else {
month = 11;
year = curYear - 1;
}
} else {
month = curMonth;
year = curYear;
}
var tmp = new Date();
tmp.setFullYear(year, month, numberDay);
var today = new Date();
for(var r = 0; r < rows; r++) {
for(var c = 0; c < cols; c++) {
var tmpDay = tmp.getDay(),
tmpNumber = tmp.getDate(),
tmpMonth = tmp.getMonth(),
tmpYear = tmp.getFullYear();
arrDays.push({
indexInWeek: tmpDay,
dayNumber: tmpNumber,
month: tmpMonth,
year: tmpYear,
isCurrentMonth: tmpMonth === curMonth,
selected: (_.isDate(me.selectedDate)) ?
(tmpNumber === me.selectedDate.getDate() && tmpMonth === me.selectedDate.getMonth() && tmpYear === me.selectedDate.getFullYear()) :
(tmpNumber === today.getDate() && tmpMonth === today.getMonth() && tmpYear === today.getFullYear())
});
tmp.setDate(tmpNumber + 1);
}
}
if (!me.monthPicker) {
me.monthPicker = new Common.UI.DataView({
el: me.cmpEl.find('.calendar-content'),
store: new Common.UI.DataViewStore(arrDays),
itemTemplate: _.template('<div class="number-day<% if (indexInWeek === 6 || indexInWeek === 0) { %> weekend<% } %><% if (!isCurrentMonth) { %> no-current-month<% } %>" data-number="<%= dayNumber %>" data-month="<%= month %>" data-year="<%= year %>"><%= dayNumber %></div>')
});
me.monthPicker.on('item:click', function(picker, item, record, e) {
var day = record.get('dayNumber'),
month = record.get('month'),
year = record.get('year');
if (_.isUndefined(me.selectedDate)) {
me.selectedDate = new Date();
}
me.selectedDate.setFullYear(year, month, day);
me.trigger('date:click', me, me.selectedDate);
});
me.enableKeyEvents && this.monthPicker.on('item:keydown', function(view, record, e) {
if (e.keyCode==Common.UI.Keys.ESC) {
Common.NotificationCenter.trigger('dataview:blur');
}
});
} else
me.monthPicker.store.reset(arrDays);
me.enableKeyEvents && _.delay(function() {
me.monthPicker.focus();
}, 10);
},
daysInMonth: function (date) {
var d;
d = date ? new Date(date) : new Date();
var result = new Date();
result.setFullYear(d.getFullYear(), d.getMonth() + 1, 0);
return result.getDate();
},
setDate: function (date) {
if (_.isDate(date)) {
this.selectedDate = new Date(date);
this.renderMonth(this.selectedDate);
}
},
focus: function () {
var me = this;
me.enableKeyEvents && me.monthPicker && _.delay(function() {
me.monthPicker.focus();
}, 10);
},
textJanuary: 'January',
textFebruary: 'February',
textMarch: 'March',
textApril: 'April',
textMay: 'May',
textJune: 'June',
textJuly: 'July',
textAugust: 'August',
textSeptember: 'September',
textOctober: 'October',
textNovember: 'November',
textDecember: 'December',
textShortJanuary: 'Jan',
textShortFebruary: 'Feb',
textShortMarch: 'Mar',
textShortApril: 'Apr',
textShortMay: 'May',
textShortJune: 'Jun',
textShortJuly: 'Jul',
textShortAugust: 'Aug',
textShortSeptember: 'Sep',
textShortOctober: 'Oct',
textShortNovember: 'Nov',
textShortDecember: 'Dec',
textShortSunday: 'Su',
textShortMonday: 'Mo',
textShortTuesday: 'Tu',
textShortWednesday: 'We',
textShortThursday: 'Th',
textShortFriday: 'Fr',
textShortSaturday: 'Sa',
textMonths: 'Months',
textYears: 'Years'
}, Common.UI.Calendar || {}));
});

View file

@ -94,8 +94,7 @@ define([
checked : false, checked : false,
value : 'unchecked', value : 'unchecked',
template : _.template('<label class="checkbox-indeterminate"><input id="<%= id %>" type="checkbox" class="checkbox__native">' + template : _.template('<label class="checkbox-indeterminate"><input type="button" class="img-commonctrl"><span><%= labelText %></span></label>'),
'<label for="<%= id %>" class="checkbox__shape" data-hint="<%= dataHint %>" data-hint-direction="<%= dataHintDirection %>" data-hint-offset="<%= dataHintOffset %>"></label><span></span></label>'),
initialize : function(options) { initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options); Common.UI.BaseView.prototype.initialize.call(this, options);
@ -107,24 +106,20 @@ define([
render: function (parentEl) { render: function (parentEl) {
var me = this; var me = this;
if (!me.rendered) { if (!me.rendered) {
var elem = this.template({
id: Common.UI.getId('chb-'),
dataHint: me.options.dataHint,
dataHintDirection: me.options.dataHintDirection,
dataHintOffset: me.options.dataHintOffset
});
if (parentEl) { if (parentEl) {
this.setElement(parentEl, false); this.setElement(parentEl, false);
parentEl.html(elem); parentEl.html(this.template({
labelText: this.options.labelText
}));
} else { } else {
me.$el.html(elem); me.$el.html(this.template({
labelText: this.options.labelText
}));
} }
this.$chk = me.$el.find('input[type=checkbox]'); this.$chk = me.$el.find('input[type=button]');
this.$label = me.$el.find('label.checkbox-indeterminate'); this.$label = me.$el.find('label');
this.$span = me.$label.find('span');
this.$chk.on('click', this.onItemCheck.bind(this)); this.$chk.on('click', this.onItemCheck.bind(this));
this.$label.on('keydown', this.onKeyDown.bind(this));
this.rendered = true; this.rendered = true;
} }
@ -135,8 +130,6 @@ define([
if (this.options.value!==undefined) if (this.options.value!==undefined)
this.setValue(this.options.value, true); this.setValue(this.options.value, true);
this.setCaption(this.options.labelText);
// handle events // handle events
return this; return this;
}, },
@ -149,10 +142,6 @@ define([
if (disabled !== this.disabled) { if (disabled !== this.disabled) {
this.$label.toggleClass('disabled', disabled); this.$label.toggleClass('disabled', disabled);
(disabled) ? this.$chk.attr({disabled: disabled}) : this.$chk.removeAttr('disabled'); (disabled) ? this.$chk.attr({disabled: disabled}) : this.$chk.removeAttr('disabled');
if (this.tabindex!==undefined) {
disabled && (this.tabindex = this.$label.attr('tabindex'));
this.$label.attr('tabindex', disabled ? "-1" : this.tabindex);
}
} }
this.disabled = disabled; this.disabled = disabled;
@ -177,18 +166,18 @@ define([
this.checked = (value === true || value === 'true' || value === '1' || value === 1 || value === 'checked'); this.checked = (value === true || value === 'true' || value === '1' || value === 1 || value === 'checked');
this.indeterminate = (value === 'indeterminate'); this.indeterminate = (value === 'indeterminate');
this.$chk.toggleClass('checked', this.checked);
this.$chk.toggleClass('indeterminate', this.indeterminate);
this.value = this.indeterminate ? 'indeterminate' : (this.checked ? 'checked' : 'unchecked'); this.value = this.indeterminate ? 'indeterminate' : (this.checked ? 'checked' : 'unchecked');
this.$chk.prop({indeterminate: this.indeterminate, checked: this.checked});
}, },
setValue: function(value, suspendchange) { setValue: function(value, suspendchange) {
if (this.rendered) { if (this.rendered) {
if ( value != this.value ) {
this.lastValue = this.value; this.lastValue = this.value;
this.setRawValue(value); this.setRawValue(value);
if (suspendchange !== true) if (suspendchange !== true && this.lastValue !== value)
this.trigger('change', this, this.value, this.lastValue); this.trigger('change', this, this.value, this.lastValue);
}
} else { } else {
this.options.value = value; this.options.value = value;
} }
@ -203,28 +192,7 @@ define([
}, },
setCaption: function(text) { setCaption: function(text) {
this.$span.text(text); this.$label.find('span').text(text);
this.$span.css('visibility', text ? 'visible' : 'hidden');
},
onKeyDown: function(e) {
if (e.isDefaultPrevented())
return;
if (e.keyCode === Common.UI.Keys.SPACE)
this.onItemCheck(e);
},
focus: function() {
this.$label && this.$label.focus();
},
setTabIndex: function(tabindex) {
if (!this.rendered)
return;
this.tabindex = tabindex.toString();
!this.disabled && this.$label.attr('tabindex', this.tabindex);
} }
}); });
}); });

View file

@ -34,234 +34,40 @@ if (Common === undefined)
var Common = {}; var Common = {};
define([ define([
'common/main/lib/component/Button', 'common/main/lib/component/Button'
'common/main/lib/component/ThemeColorPalette'
], function () { ], function () {
'use strict'; 'use strict';
Common.UI.ButtonColored = Common.UI.Button.extend(_.extend({ Common.UI.ColorButton = Common.UI.Button.extend({
render: function(parentEl) {
Common.UI.Button.prototype.render.call(this, parentEl);
$('button:first-child', this.cmpEl).append( $('<div class="btn-color-value-line"></div>'));
this.colorEl = this.cmpEl.find('.btn-color-value-line');
if (this.options.auto)
this.autocolor = (typeof this.options.auto == 'object') ? this.options.auto.color || '000000' : '000000';
if (this.options.color!==undefined)
this.setColor(this.options.color);
},
getPicker: function(color, colors) {
if (!this.colorPicker) {
var config = {
el: this.cmpEl.find('#' + this.menu.id + '-color-menu'),
value: color,
colors: colors
};
(this.options.transparent!==undefined) && (config['transparent'] = this.options.transparent);
(this.options.hideEmptyColors!==undefined) && (config['hideEmptyColors'] = this.options.hideEmptyColors);
this.colorPicker = new Common.UI.ThemeColorPalette(config);
this.colorPicker.on('select', _.bind(this.onColorSelect, this));
this.cmpEl.find('#' + this.menu.id + '-color-new').on('click', _.bind(this.addNewColor, this));
if (this.options.auto) {
this.cmpEl.find('#' + this.menu.id + '-color-auto').on('click', _.bind(this.onAutoColorSelect, this));
this.colorAuto = this.cmpEl.find('#' + this.menu.id + '-color-auto > a');
(color == 'auto') && this.setAutoColor(true);
}
this.initInnerMenu();
}
return this.colorPicker;
},
setPicker: function(picker) {
this.colorPicker = picker;
},
getMenu: function(options) {
if (typeof this.menu !== 'object') {
options = options || this.options;
var height = options.paletteHeight ? options.paletteHeight + 'px' : 'auto',
id = Common.UI.getId(),
auto = [];
if (options.auto) {
this.autocolor = (typeof options.auto == 'object') ? options.auto.color || '000000' : '000000';
auto.push({
id: id + '-color-auto',
caption: (typeof options.auto == 'object') ? options.auto.caption || this.textAutoColor : this.textAutoColor,
template: _.template('<a tabindex="-1" type="menuitem"><span class="menu-item-icon color-auto" style="background-image: none; width: 12px; height: 12px; margin: 1px 7px 0 1px; background-color: #' + this.autocolor + ';"></span><%= caption %></a>')
});
auto.push({caption: '--'});
}
var menu = new Common.UI.Menu({
id: id,
cls: 'shifted-left',
additionalAlign: options.additionalAlign,
items: (options.additionalItems ? options.additionalItems : []).concat(auto).concat([
{ template: _.template('<div id="' + id + '-color-menu" style="width: 164px; height:' + height + '; display: inline-block;"></div>') },
{caption: '--'},
{
id: id + '-color-new',
template: _.template('<a tabindex="-1" type="menuitem" style="">' + this.textNewColor + '</a>')
}
])
});
this.initInnerMenu();
var me = this;
menu.on('keydown:before', _.bind(this.onBeforeKeyDown, this));
menu.on('show:after', function(menu) {
me.colorPicker && _.delay(function() {
me.colorPicker.showLastSelected();
!(options.additionalItems || options.auto) && me.colorPicker.focus();
}, 10);
}).on('hide:after', function() {
if (me.options.takeFocusOnClose) {
setTimeout(function(){me.focus();}, 1);
}
});
return menu;
}
return this.menu;
},
initInnerMenu: function() {
if (!this.colorPicker || typeof this.menu !== 'object') return;
var index = (this.options.additionalItems || []).length + (this.options.auto ? 2 : 0);
this.colorPicker.outerMenu = {menu: this.menu, index: index};
this.menu.setInnerMenu([{menu: this.colorPicker, index: index}]);
},
setMenu: function (m) {
m = m || this.getMenu();
Common.UI.Button.prototype.setMenu.call(this, m);
this.getPicker(this.options.color, this.options.colors);
},
onColorSelect: function(picker, color) {
this.setColor(color);
this.setAutoColor(false);
this.trigger('color:select', this, color);
},
setColor: function(color) {
if (color == 'auto' && this.options.auto)
color = this.autocolor;
this.color = color;
if (this.colorEl) {
this.colorEl.css({'background-color': (color=='transparent') ? color : ((typeof(color) == 'object') ? '#'+color.color : '#'+color)});
this.colorEl.toggleClass('bordered', color=='transparent');
}
},
setAutoColor: function(selected) {
if (!this.colorAuto) return;
if (selected && !this.colorAuto.hasClass('selected'))
this.colorAuto.addClass('selected');
else if (!selected && this.colorAuto.hasClass('selected'))
this.colorAuto.removeClass('selected');
},
isAutoColor: function() {
return this.colorAuto && this.colorAuto.hasClass('selected');
},
onAutoColorSelect: function() {
this.setColor('auto');
this.setAutoColor(true);
this.colorPicker && this.colorPicker.clearSelection();
this.trigger('auto:select', this, this.autocolor);
},
addNewColor: function() {
this.colorPicker && this.colorPicker.addNewColor((typeof(this.color) == 'object') ? this.color.color : this.color);
},
onBeforeKeyDown: function(menu, e) {
if ((e.keyCode == Common.UI.Keys.DOWN || e.keyCode == Common.UI.Keys.SPACE) && !this.isMenuOpen()) {
$('button', this.cmpEl).click();
return false;
}
},
isMenuOpen: function() {
return this.cmpEl.hasClass('open');
},
textNewColor: 'Add New Custom Color',
textAutoColor: 'Automatic'
}, Common.UI.ButtonColored || {}));
Common.UI.ColorButton = Common.UI.ButtonColored.extend(_.extend({
options : { options : {
id : null,
hint: false, hint: false,
enableToggle: false, enableToggle: false,
allowDepress : false,
toggleGroup : null,
cls : '',
iconCls : '',
caption : '',
menu : null,
disabled : false,
pressed : false,
split : false,
visible: true visible: true
}, },
template: _.template([ template: _.template([
'<div class="btn-group" id="<%= id %>">', '<div class="btn-group" id="<%= id %>">',
'<button type="button" class="btn btn-color dropdown-toggle <%= cls %>" data-toggle="dropdown" style="<%= style %>" data-hint="<%= dataHint %>" data-hint-direction="<%= dataHintDirection %>" data-hint-offset="<%= dataHintOffset %>">', '<button type="button" class="btn btn-color dropdown-toggle <%= cls %>" data-toggle="dropdown" style="<%= style %>">',
'<span>&nbsp;</span>', '<span>&nbsp;</span>',
'<span class="inner-box-caret">',
'<i class="caret"></i>',
'</span>',
'</button>', '</button>',
'</div>' '</div>'
].join('')), ].join('')),
initialize : function(options) {
if (!options.menu && options.menu !== false) {// menu==null or undefined
// set default menu
var me = this;
options.menu = me.getMenu(options);
me.on('render:after', function(btn) {
me.getPicker(options.color, options.colors);
});
}
Common.UI.Button.prototype.initialize.call(this, options);
},
render: function(parentEl) {
Common.UI.Button.prototype.render.call(this, parentEl);
if (this.options.auto)
this.autocolor = (typeof this.options.auto == 'object') ? this.options.auto.color || '000000' : '000000';
if (this.options.color!==undefined)
this.setColor(this.options.color);
},
setColor: function(color) { setColor: function(color) {
if (color == 'auto' && this.options.auto) var border_color, clr,
color = this.autocolor; span = $(this.cmpEl).find('button span');
var span = $(this.cmpEl).find('button span:nth-child(1)');
this.color = color; this.color = color;
span.toggleClass('color-transparent', color=='transparent'); if ( color== 'transparent' ) {
span.css({'background-color': (color=='transparent') ? color : ((typeof(color) == 'object') ? '#'+color.color : '#'+color)}); border_color = '#BEBEBE';
}, clr = color;
span.addClass('color-transparent');
focus: function() { } else {
$('button', this.cmpEl).focus(); border_color = 'transparent';
clr = (typeof(color) == 'object') ? '#'+color.color : '#'+color;
span.removeClass('color-transparent');
}
span.css({'background-color': clr, 'border-color': border_color});
} }
});
}, Common.UI.ColorButton || {}));
}); });

View file

@ -77,14 +77,9 @@ define([
Common.UI.ComboBorderSize = Common.UI.ComboBox.extend(_.extend({ Common.UI.ComboBorderSize = Common.UI.ComboBox.extend(_.extend({
template: _.template([ template: _.template([
'<div class="input-group combobox combo-border-size input-group-nr <%= cls %>" id="<%= id %>" style="<%= style %>">', '<div class="input-group combobox combo-border-size input-group-nr <%= cls %>" id="<%= id %>" style="<%= style %>">',
'<div class="form-control" style="<%= style %>" data-hint="<%= dataHint %>" data-hint-direction="<%= dataHintDirection %>" data-hint-offset="<%= dataHintOffset %>">', '<div class="form-control" style="padding-top:2px; <%= style %>"></div>',
'<i class="image"></i>',
'<span class="text"></span>',
'</div>',
'<div style="display: table-cell;"></div>', '<div style="display: table-cell;"></div>',
'<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">', '<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret img-commonctrl"></span></button>',
'<span class="caret"></span>',
'</button>',
'<ul class="dropdown-menu <%= menuCls %>" style="<%= menuStyle %>" role="menu">', '<ul class="dropdown-menu <%= menuCls %>" style="<%= menuStyle %>" role="menu">',
'<% _.each(items, function(item) { %>', '<% _.each(items, function(item) { %>',
'<li id="<%= item.id %>" data-value="<%= item.value %>"><a tabindex="-1" type="menuitem">', '<li id="<%= item.id %>" data-value="<%= item.value %>"><a tabindex="-1" type="menuitem">',
@ -122,7 +117,6 @@ define([
render : function(parentEl) { render : function(parentEl) {
Common.UI.ComboBox.prototype.render.call(this, parentEl); Common.UI.ComboBox.prototype.render.call(this, parentEl);
this._formControl = this.cmpEl.find('.form-control');
return this; return this;
}, },
@ -144,15 +138,14 @@ define([
updateFormControl: function(record) { updateFormControl: function(record) {
var formcontrol = $(this.el).find('.form-control'); var formcontrol = $(this.el).find('.form-control');
var image = formcontrol.find('> .image');
var text = formcontrol.find('> .text');
if (record.get('value')>0) { if (record.get('value')>0) {
image.css('background-position', '10px -' + record.get('offsety') + 'px').show(); formcontrol[0].innerHTML = '';
text.hide(); formcontrol.removeClass('text').addClass('image');
formcontrol.css('background-position', '0 -' + record.get('offsety') + 'px');
} else { } else {
image.hide(); formcontrol[0].innerHTML = this.txtNoBorders;
text.text(this.txtNoBorders).show(); formcontrol.removeClass('image').addClass('text');
} }
}, },
@ -169,24 +162,20 @@ define([
this.updateFormControl(this._selectedItem); this.updateFormControl(this._selectedItem);
$('#' + this._selectedItem.get('id'), $(this.el)).addClass('selected'); $('#' + this._selectedItem.get('id'), $(this.el)).addClass('selected');
} else { } else {
$(this.el).find('.form-control > .text').text("").show(); var formcontrol = $(this.el).find('.form-control');
formcontrol[0].innerHTML = '';
formcontrol.removeClass('image').addClass('text');
} }
}, },
focus: function() {
this._formControl && this._formControl.focus();
},
txtNoBorders: 'No Borders' txtNoBorders: 'No Borders'
}, Common.UI.ComboBorderSize || {})); }, Common.UI.ComboBorderSize || {}));
Common.UI.ComboBorderSizeEditable = Common.UI.ComboBox.extend(_.extend({ Common.UI.ComboBorderSizeEditable = Common.UI.ComboBox.extend(_.extend({
template: _.template([ template: _.template([
'<span class="input-group combobox combo-border-size input-group-nr <%= cls %>" id="<%= id %>" style="<%= style %>">', '<span class="input-group combobox combo-border-size input-group-nr <%= cls %>" id="<%= id %>" style="<%= style %>">',
'<input type="text" class="form-control text" data-hint="<%= dataHint %>" data-hint-direction="<%= dataHintDirection %>" data-hint-offset="<%= dataHintOffset %>">', '<input type="text" class="form-control text">',
'<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">', '<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret img-commonctrl"></span></button>',
'<span class="caret"></span>',
'</button>',
'<ul class="dropdown-menu <%= menuCls %>" style="<%= menuStyle %>" role="menu">', '<ul class="dropdown-menu <%= menuCls %>" style="<%= menuStyle %>" role="menu">',
'<% _.each(items, function(item) { %>', '<% _.each(items, function(item) { %>',
'<li id="<%= item.id %>" data-value="<%= item.value %>"><a tabindex="-1" type="menuitem">', '<li id="<%= item.id %>" data-value="<%= item.value %>"><a tabindex="-1" type="menuitem">',
@ -235,16 +224,12 @@ define([
Common.UI.ComboBorderType = Common.UI.ComboBorderSize.extend(_.extend({ Common.UI.ComboBorderType = Common.UI.ComboBorderSize.extend(_.extend({
template: _.template([ template: _.template([
'<div class="input-group combobox combo-border-size input-group-nr <%= cls %>" id="<%= id %>" style="<%= style %>">', '<div class="input-group combobox combo-border-size input-group-nr <%= cls %>" id="<%= id %>" style="<%= style %>">',
'<div class="form-control" style="<%= style %>" data-hint="<%= dataHint %>" data-hint-direction="<%= dataHintDirection %>" data-hint-offset="<%= dataHintOffset %>">', '<div class="form-control" style="<%= style %>"></div>',
'<i class="image"></i>',
'</div>',
'<div style="display: table-cell;"></div>', '<div style="display: table-cell;"></div>',
'<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">', '<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret img-commonctrl"></span></button>',
'<span class="caret"></span>',
'</button>',
'<ul class="dropdown-menu <%= menuCls %>" style="<%= menuStyle %>" role="menu">', '<ul class="dropdown-menu <%= menuCls %>" style="<%= menuStyle %>" role="menu">',
'<% _.each(items, function(item) { %>', '<% _.each(items, function(item) { %>',
'<li id="<%= item.id %>" data-value="<%= item.value %>"><a tabindex="-1" type="menuitem" style="padding: 2px 0 2px 10px;">', '<li id="<%= item.id %>" data-value="<%= item.value %>"><a tabindex="-1" type="menuitem" style="padding: 2px 0;">',
'<span style="margin-top: 0;"></span>', '<span style="margin-top: 0;"></span>',
'<% if (item.offsety!==undefined) { %>', '<% if (item.offsety!==undefined) { %>',
'<img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" align="left" style="background-position: 0 -<%= item.offsety %>px;">', '<img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" align="left" style="background-position: 0 -<%= item.offsety %>px;">',
@ -277,248 +262,10 @@ define([
}, },
updateFormControl: function(record) { updateFormControl: function(record) {
if (record) var formcontrol = $(this.el).find('.form-control');
$(this.el).find('.form-control > .image') formcontrol[0].innerHTML = '';
.css('background-position', '10px -' + record.get('offsety') + 'px').show(); formcontrol.removeClass('text').addClass('image');
else formcontrol.css('background-position', '0 -' + record.get('offsety') + 'px');
$(this.el).find('.form-control > .image').hide();
},
setValue: function(value) {
this._selectedItem = (value===null || value===undefined) ? undefined : _.find(this.store.models, function(item) {
if ( value<item.attributes.value+0.01 && value>item.attributes.value-0.01) {
return true;
}
});
$('.selected', $(this.el)).removeClass('selected');
this.updateFormControl(this._selectedItem);
this._selectedItem && $('#' + this._selectedItem.get('id'), $(this.el)).addClass('selected');
} }
}, Common.UI.ComboBorderType || {})); }, Common.UI.ComboBorderType || {}));
Common.UI.ComboBoxColor = Common.UI.ComboBox.extend(_.extend({
template: _.template([
'<div class="input-group combobox combo-color input-group-nr <%= cls %>" id="<%= id %>" style="<%= style %>">',
'<div class="form-control" style="padding:2px 14px 2px 3px; <%= style %> display: block;">',
'<div style="display: inline-block;overflow: hidden;width: 100%;height: 100%;"></div>',
'</div>',
'<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">',
'<span class="caret"></span>',
'</button>',
'<ul class="dropdown-menu <%= menuCls %>" style="<%= menuStyle %>" role="menu">',
'<% _.each(items, function(item) { %>',
'<% if (item.value==-1) { %>',
'<li id="<%= item.id %>" data-value="<%= item.value %>"><a tabindex="-1" type="menuitem"><%= scope.getDisplayValue(item) %></a></li>',
'<% } else { %>',
'<li id="<%= item.id %>" data-value="<%= item.value %>">',
'<a tabindex="-1" type="menuitem" style="padding: 5px;"><div style="height: 15px;<%= item.styleStr %>"><%= scope.getDisplayValue(item) %></div></a>',
'</li>',
'<% } %>',
'<% }); %>',
'</ul>',
'</div>'
].join('')),
itemClicked: function (e) {
var el = $(e.currentTarget).parent();
this._selectedItem = this.store.findWhere({
id: el.attr('id')
});
if (this._selectedItem) {
$('.selected', $(this.el)).removeClass('selected');
el.addClass('selected');
this.updateFormControl(this._selectedItem);
this.trigger('selected', this, _.extend({}, this._selectedItem.toJSON()), e);
e.preventDefault();
}
},
updateFormControl: function(record) {
var formcontrol = $(this.el).find('.form-control > div');
formcontrol[0].innerHTML = record.get('displayValue');
if (record.get('value')!=-1) {
formcontrol.css({'margin-top': '0'});
formcontrol.css(record.get('styleObj'));
} else {
formcontrol.css({'margin-top': '1px'});
formcontrol.css(record.get('styleObj'));
}
},
setValue: function(value) {
var obj;
this._selectedItem = this.store.findWhere((obj={}, obj[this.valueField]=value, obj));
$('.selected', $(this.el)).removeClass('selected');
if (this._selectedItem) {
this.updateFormControl(this._selectedItem);
$('#' + this._selectedItem.get('id'), $(this.el)).addClass('selected');
} else {
var formcontrol = $(this.el).find('.form-control > div');
formcontrol[0].innerHTML = value;
formcontrol.css('margin-top', '1px');
formcontrol.css({'color': '', 'text-align': '', 'background': '', 'border': ''});
}
},
onResetItems: function() {
if (this.itemsTemplate) {
$(this.el).find('ul').html( $(this.itemsTemplate({
items: this.store.toJSON(),
scope: this
})));
} else {
$(this.el).find('ul').html(_.template([
'<% _.each(items, function(item) { %>',
'<% if (item.value==-1) { %>',
'<li id="<%= item.id %>" data-value="<%= item.value %>"><a tabindex="-1" type="menuitem"><%= scope.getDisplayValue(item) %></a></li>',
'<% } else { %>',
'<li id="<%= item.id %>" data-value="<%= item.value %>">',
'<a tabindex="-1" type="menuitem" style="padding: 5px;"><div style="height: 15px;<%= item.styleStr %>"><%= scope.getDisplayValue(item) %></div></a>',
'</li>',
'<% } %>',
'<% }); %>'
].join(''))({
items: this.store.toJSON(),
scope: this
}));
}
if (!_.isUndefined(this.scroller)) {
this.scroller.destroy();
delete this.scroller;
}
this.scroller = new Common.UI.Scroller(_.extend({
el: $('.dropdown-menu', this.cmpEl),
minScrollbarLength : 40,
includePadding : true,
wheelSpeed: 10,
alwaysVisibleY: this.scrollAlwaysVisible
}, this.options.scroller));
}
}, Common.UI.ComboBoxColor || {}));
Common.UI.ComboBoxIcons= Common.UI.ComboBox.extend(_.extend({
template: _.template([
'<div class="input-group combobox combo-color input-group-nr <%= cls %>" id="<%= id %>" style="<%= style %>">',
'<div class="form-control" style="padding:2px 0 2px 3px; <%= style %> display: block;">',
'<div style="display: inline-block;overflow: hidden;width: 100%;height: 100%;"></div>',
'</div>',
'<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">',
'<span class="caret"></span>',
'</button>',
'<ul class="dropdown-menu <%= menuCls %>" style="<%= menuStyle %>" role="menu">',
'<% _.each(items, function(item) { %>',
'<% if (item.value==-1) { %>',
'<li id="<%= item.id %>" data-value="<%= item.value %>"><a tabindex="-1" type="menuitem"><%= scope.getDisplayValue(item) %></a></li>',
'<% } else { %>',
'<li id="<%= item.id %>" data-value="<%= item.value %>">',
'<a tabindex="-1" type="menuitem" style="padding: 5px;">',
'<% _.each(item.data.iconSet, function(icon) { %>',
'<img src="<%= item.data.icons.at(icon-1).get(\'icon\') %>" style="width:16px;height:16px;margin-right: 5px;">',
'<% }) %>',
'</a>',
'</li>',
'<% } %>',
'<% }); %>',
'</ul>',
'</div>'
].join('')),
itemClicked: function (e) {
var el = $(e.currentTarget).parent();
this._selectedItem = this.store.findWhere({
id: el.attr('id')
});
if (this._selectedItem) {
$('.selected', $(this.el)).removeClass('selected');
el.addClass('selected');
this.updateFormControl(this._selectedItem);
this.trigger('selected', this, _.extend({}, this._selectedItem.toJSON()), e);
e.preventDefault();
}
},
updateFormControl: function(record) {
var formcontrol = $(this.el).find('.form-control > div');
if (record.get('value')!=-1) {
var str = '';
_.each(record.get('data').iconSet, function(icon) {
str += '<img src="' + record.get('data').icons.at(icon-1).get("icon") + '" style="width:16px;height:16px;margin-right: 5px;">';
});
formcontrol[0].innerHTML = str;
formcontrol.css({'margin-top': '0'});
} else {
formcontrol[0].innerHTML = record.get('displayValue');
formcontrol.css({'margin-top': '1px'});
}
},
setValue: function(value) {
var obj;
this._selectedItem = this.store.findWhere((obj={}, obj[this.valueField]=value, obj));
$('.selected', $(this.el)).removeClass('selected');
if (this._selectedItem) {
this.updateFormControl(this._selectedItem);
$('#' + this._selectedItem.get('id'), $(this.el)).addClass('selected');
} else {
var formcontrol = $(this.el).find('.form-control > div');
formcontrol[0].innerHTML = value;
formcontrol.css({'margin-top': '1px'});
}
},
onResetItems: function() {
if (this.itemsTemplate) {
$(this.el).find('ul').html( $(this.itemsTemplate({
items: this.store.toJSON(),
scope: this
})));
} else {
$(this.el).find('ul').html(_.template([
'<% _.each(items, function(item) { %>',
'<% if (item.value==-1) { %>',
'<li id="<%= item.id %>" data-value="<%= item.value %>"><a tabindex="-1" type="menuitem"><%= scope.getDisplayValue(item) %></a></li>',
'<% } else { %>',
'<li id="<%= item.id %>" data-value="<%= item.value %>">',
'<a tabindex="-1" type="menuitem" style="padding: 5px;">',
'<% _.each(item.data.iconSet, function(icon) { %>',
'<img src="<%= item.data.icons.at(icon-1).get(\'icon\') %>" style="width:16px;height:16px;margin-right: 5px;">',
'<% }) %>',
'</a>',
'</li>',
'<% } %>',
'<% }); %>'
].join(''))({
items: this.store.toJSON(),
scope: this
}));
}
if (!_.isUndefined(this.scroller)) {
this.scroller.destroy();
delete this.scroller;
}
this.scroller = new Common.UI.Scroller(_.extend({
el: $('.dropdown-menu', this.cmpEl),
minScrollbarLength : 40,
includePadding : true,
wheelSpeed: 10,
alwaysVisibleY: this.scrollAlwaysVisible
}, this.options.scroller));
}
}, Common.UI.ComboBoxIcons || {}));
}); });

View file

@ -86,19 +86,13 @@ define([
displayField: 'displayValue', displayField: 'displayValue',
valueField : 'value', valueField : 'value',
search : false, search : false,
scrollAlwaysVisible: false, scrollAlwaysVisible: false
takeFocusOnClose: false,
dataHint: '',
dataHintDirection: '',
dataHintOffset: ''
}, },
template: _.template([ template: _.template([
'<span class="input-group combobox <%= cls %>" id="<%= id %>" style="<%= style %>">', '<span class="input-group combobox <%= cls %>" id="<%= id %>" style="<%= style %>">',
'<input type="text" class="form-control" spellcheck="false" data-hint="<%= dataHint %>" data-hint-direction="<%= dataHintDirection %>" data-hint-offset="<%= dataHintOffset %>">', '<input type="text" class="form-control" spellcheck="false">',
'<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">', '<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret img-commonctrl"></span></button>',
'<span class="caret"></span>',
'</button>',
'<ul class="dropdown-menu <%= menuCls %>" style="<%= menuStyle %>" role="menu">', '<ul class="dropdown-menu <%= menuCls %>" style="<%= menuStyle %>" role="menu">',
'<% _.each(items, function(item) { %>', '<% _.each(items, function(item) { %>',
'<li id="<%= item.id %>" data-value="<%= item.value %>"><a tabindex="-1" type="menuitem"><%= scope.getDisplayValue(item) %></a></li>', '<li id="<%= item.id %>" data-value="<%= item.value %>"><a tabindex="-1" type="menuitem"><%= scope.getDisplayValue(item) %></a></li>',
@ -150,10 +144,7 @@ define([
menuCls : this.menuCls, menuCls : this.menuCls,
menuStyle : this.menuStyle, menuStyle : this.menuStyle,
items : items, items : items,
scope : me, scope : me
dataHint : this.options.dataHint,
dataHintDirection: this.options.dataHintDirection,
dataHintOffset: this.options.dataHintOffset
})); }));
if (this.itemsTemplate) if (this.itemsTemplate)
this.cmpEl.find('ul').html( this.cmpEl.find('ul').html(
@ -190,7 +181,6 @@ define([
el.on('click', '.form-control', _.bind(this.onInputClick, this)); el.on('click', '.form-control', _.bind(this.onInputClick, this));
this._input.attr('readonly', 'readonly'); this._input.attr('readonly', 'readonly');
this._input.attr('data-can-copy', false); this._input.attr('data-can-copy', false);
this._input.on('mousedown',function (e){e.preventDefault();})
} }
if (me.options.hint) { if (me.options.hint) {
@ -227,11 +217,6 @@ define([
}); });
} }
var $list = el.find('.dropdown-menu');
if ($list.hasClass('menu-absolute')) {
$list.css('min-width', el.outerWidth());
}
el.on('show.bs.dropdown', _.bind(me.onBeforeShowMenu, me)); el.on('show.bs.dropdown', _.bind(me.onBeforeShowMenu, me));
el.on('shown.bs.dropdown', _.bind(me.onAfterShowMenu, me)); el.on('shown.bs.dropdown', _.bind(me.onAfterShowMenu, me));
el.on('hide.bs.dropdown', _.bind(me.onBeforeHideMenu, me)); el.on('hide.bs.dropdown', _.bind(me.onBeforeHideMenu, me));
@ -267,6 +252,7 @@ define([
this.scroller = new Common.UI.Scroller(_.extend({ this.scroller = new Common.UI.Scroller(_.extend({
el: $('.dropdown-menu', this.cmpEl), el: $('.dropdown-menu', this.cmpEl),
minScrollbarLength: 40, minScrollbarLength: 40,
scrollYMarginOffset: 30,
includePadding: true, includePadding: true,
wheelSpeed: 10, wheelSpeed: 10,
alwaysVisibleY: this.scrollAlwaysVisible alwaysVisibleY: this.scrollAlwaysVisible
@ -291,6 +277,7 @@ define([
this.scroller = new Common.UI.Scroller(_.extend({ this.scroller = new Common.UI.Scroller(_.extend({
el: $('.dropdown-menu', this.cmpEl), el: $('.dropdown-menu', this.cmpEl),
minScrollbarLength: 40, minScrollbarLength: 40,
scrollYMarginOffset: 30,
includePadding: true, includePadding: true,
wheelSpeed: 10, wheelSpeed: 10,
alwaysVisibleY: this.scrollAlwaysVisible alwaysVisibleY: this.scrollAlwaysVisible
@ -307,15 +294,6 @@ define([
tip.hide(); tip.hide();
} }
} }
var $list = this.cmpEl.find('ul');
if ($list.hasClass('menu-absolute')) {
var offset = this.cmpEl.offset();
$list.css({left: offset.left, top: offset.top + this.cmpEl.outerHeight() + 2});
} else if ($list.hasClass('menu-aligned')) {
var offset = this.cmpEl.offset();
$list.toggleClass('show-top', offset.top + this.cmpEl.outerHeight() + $list.outerHeight() > Common.Utils.innerHeight());
}
}, },
onAfterShowMenu: function(e) { onAfterShowMenu: function(e) {
@ -324,18 +302,13 @@ define([
if ($selected.length) { if ($selected.length) {
var itemTop = $selected.position().top, var itemTop = $selected.position().top,
itemHeight = $selected.outerHeight(), itemHeight = $selected.height(),
listHeight = $list.outerHeight(); listHeight = $list.height();
if (itemTop < 0 || itemTop + itemHeight > listHeight) { if (itemTop < 0 || itemTop + itemHeight > listHeight) {
var height = $list.scrollTop() + itemTop + (itemHeight - listHeight)/2; $list.scrollTop($list.scrollTop() + itemTop + itemHeight - (listHeight/2));
height = (Math.floor(height/itemHeight) * itemHeight);
$list.scrollTop(height);
} }
setTimeout(function(){$selected.find('a').focus();}, 1); setTimeout(function(){$selected.find('a').focus();}, 1);
} else {
var me = this;
setTimeout(function(){me.cmpEl.find('ul li:first a').focus();}, 1);
} }
if (this.scroller) if (this.scroller)
@ -356,40 +329,25 @@ define([
this.cmpEl.find('.dropdown-toggle').blur(); this.cmpEl.find('.dropdown-toggle').blur();
this.trigger('hide:after', this, e, isFromInputControl); this.trigger('hide:after', this, e, isFromInputControl);
Common.NotificationCenter.trigger('menu:hide', this, isFromInputControl); Common.NotificationCenter.trigger('menu:hide', this, isFromInputControl);
if (this.options.takeFocusOnClose) {
var me = this;
(me._input && me._input.length>0 && !me.editable) && (me._input[0].selectionStart===me._input[0].selectionEnd) && setTimeout(function() {
me._input[0].selectionStart = me._input[0].selectionEnd = 0;
},1);
setTimeout(function(){me.focus();}, 1);
}
}, },
onAfterKeydownMenu: function(e) { onAfterKeydownMenu: function(e) {
if (e.keyCode == Common.UI.Keys.DOWN && !this.editable && !this.isMenuOpen()) { if (e.keyCode == Common.UI.Keys.RETURN) {
this.openMenu();
this.onAfterShowMenu();
return false;
}
else if (e.keyCode == Common.UI.Keys.RETURN && (this.editable || this.isMenuOpen())) {
var isopen = this.isMenuOpen();
$(e.target).click(); $(e.target).click();
var me = this;
if (this.rendered) { if (this.rendered) {
if (Common.Utils.isIE) if (Common.Utils.isIE)
this._input.trigger('change', { onkeydown: true }); this._input.trigger('change', { onkeydown: true });
else else
this._input.blur(); this._input.blur();
} }
return !isopen; return false;
} }
else if (e.keyCode == Common.UI.Keys.ESC && this.isMenuOpen()) { else if (e.keyCode == Common.UI.Keys.ESC && this.isMenuOpen()) {
this._input.val(this.lastValue);
this.closeMenu(); this.closeMenu();
this.onAfterHideMenu(e); this.onAfterHideMenu(e);
return false; return false;
} else if (this.search && e.keyCode > 64 && e.keyCode < 91 && e.key){ } else if (this.search && e.keyCode > 64 && e.keyCode < 91 && e.key){
if (typeof this._search !== 'object') return;
var me = this; var me = this;
clearTimeout(this._search.timer); clearTimeout(this._search.timer);
this._search.timer = setTimeout(function () { me._search = {}; }, 1000); this._search.timer = setTimeout(function () { me._search = {}; }, 1000);
@ -433,12 +391,10 @@ define([
this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible}); this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible});
var $list = $(this.el).find('ul'); var $list = $(this.el).find('ul');
var itemTop = item.position().top, var itemTop = item.position().top,
itemHeight = item.outerHeight(), itemHeight = item.height(),
listHeight = $list.outerHeight(); listHeight = $list.height();
if (itemTop < 0 || itemTop + itemHeight > listHeight) { if (itemTop < 0 || itemTop + itemHeight > listHeight) {
var height = $list.scrollTop() + itemTop; $list.scrollTop($list.scrollTop() + itemTop + itemHeight - (listHeight/2));
height = (Math.floor(height/itemHeight) * itemHeight);
$list.scrollTop(height);
} }
} }
item.focus(); item.focus();
@ -449,7 +405,6 @@ define([
var me = this; var me = this;
if (e.keyCode == Common.UI.Keys.ESC){ if (e.keyCode == Common.UI.Keys.ESC){
this._input.val(this.lastValue);
this.closeMenu(); this.closeMenu();
this.onAfterHideMenu(e); this.onAfterHideMenu(e);
} else if (e.keyCode == Common.UI.Keys.UP || e.keyCode == Common.UI.Keys.DOWN) { } else if (e.keyCode == Common.UI.Keys.UP || e.keyCode == Common.UI.Keys.DOWN) {
@ -548,7 +503,6 @@ define([
}, },
setDisabled: function(disabled) { setDisabled: function(disabled) {
disabled = !!disabled;
this.disabled = disabled; this.disabled = disabled;
if (!this.rendered) if (!this.rendered)
@ -673,7 +627,7 @@ define([
} else { } else {
$(this.el).find('ul').html(_.template([ $(this.el).find('ul').html(_.template([
'<% _.each(items, function(item) { %>', '<% _.each(items, function(item) { %>',
'<li id="<%= item.id %>" data-value="<%- item.value %>"><a tabindex="-1" type="menuitem"><%= scope.getDisplayValue(item) %></a></li>', '<li id="<%= item.id %>" data-value="<%= item.value %>"><a tabindex="-1" type="menuitem"><%= scope.getDisplayValue(item) %></a></li>',
'<% }); %>' '<% }); %>'
].join(''))({ ].join(''))({
items: this.store.toJSON(), items: this.store.toJSON(),
@ -688,39 +642,12 @@ define([
this.scroller = new Common.UI.Scroller(_.extend({ this.scroller = new Common.UI.Scroller(_.extend({
el: $('.dropdown-menu', this.cmpEl), el: $('.dropdown-menu', this.cmpEl),
minScrollbarLength : 40, minScrollbarLength : 40,
scrollYMarginOffset: 30,
includePadding : true, includePadding : true,
wheelSpeed: 10, wheelSpeed: 10,
alwaysVisibleY: this.scrollAlwaysVisible alwaysVisibleY: this.scrollAlwaysVisible
}, this.options.scroller)); }, this.options.scroller));
},
focus: function() {
this._input && this._input.focus();
} }
} }
})()); })());
Common.UI.ComboBoxCustom = Common.UI.ComboBox.extend(_.extend({
itemClicked: function (e) {
Common.UI.ComboBox.prototype.itemClicked.call(this, e);
if (this.options.updateFormControl)
this.options.updateFormControl.call(this, this._selectedItem);
},
setValue: function(value) {
Common.UI.ComboBox.prototype.setValue.call(this, value);
if (this.options.updateFormControl)
this.options.updateFormControl.call(this, this._selectedItem);
},
selectRecord: function(record) {
Common.UI.ComboBox.prototype.selectRecord.call(this, record);
if (this.options.updateFormControl)
this.options.updateFormControl.call(this, this._selectedItem);
},
focus: function() {
this.cmpEl && this.cmpEl.find('.form-control').focus();
}
}, Common.UI.ComboBoxCustom || {}));
}); });

View file

@ -49,251 +49,34 @@ define([
'use strict'; 'use strict';
Common.UI.ComboBoxFonts = Common.UI.ComboBox.extend((function() { Common.UI.ComboBoxFonts = Common.UI.ComboBox.extend((function() {
var iconWidth = 300, var iconWidth = 302,
iconHeight = Asc.FONT_THUMBNAIL_HEIGHT || 28, iconHeight = Asc.FONT_THUMBNAIL_HEIGHT || 26,
isRetina = window.devicePixelRatio > 1,
thumbCanvas = document.createElement('canvas'), thumbCanvas = document.createElement('canvas'),
thumbContext = thumbCanvas.getContext('2d'), thumbContext = thumbCanvas.getContext('2d'),
postfix = (/^(zh|ja|ko)$/i.test(Common.Locale.getCurrentLanguage())) ? '_ea' : '', thumbPath = '../../../../sdkjs/common/Images/fonts_thumbnail.png',
thumbs = [ thumbPath2x = '../../../../sdkjs/common/Images/fonts_thumbnail@2x.png',
{ratio: 1, path: '../../../../sdkjs/common/Images/fonts_thumbnail' + postfix + '.png', width: iconWidth, height: iconHeight}, listItemHeight = 26;
{ratio: 1.25, path: '../../../../sdkjs/common/Images/fonts_thumbnail' + postfix + '@1.25x.png', width: iconWidth * 1.25, height: iconHeight * 1.25},
{ratio: 1.5, path: '../../../../sdkjs/common/Images/fonts_thumbnail' + postfix + '@1.5x.png', width: iconWidth * 1.5, height: iconHeight * 1.5},
{ratio: 1.75, path: '../../../../sdkjs/common/Images/fonts_thumbnail' + postfix + '@1.75x.png', width: iconWidth * 1.75, height: iconHeight * 1.75},
{ratio: 2, path: '../../../../sdkjs/common/Images/fonts_thumbnail' + postfix + '@2x.png', width: iconWidth * 2, height: iconHeight * 2}
],
thumbIdx = 0,
listItemHeight = 28,
spriteCols = 1,
applicationPixelRatio = Common.Utils.applicationPixelRatio();
if ( Common.Controllers.Desktop.isActive() ) { if (typeof window['AscDesktopEditor'] === 'object') {
thumbs[0].path = Common.Controllers.Desktop.call('getFontsSprite'); thumbPath = window['AscDesktopEditor'].getFontsSprite();
thumbs[1].path = Common.Controllers.Desktop.call('getFontsSprite', '@1.25x'); thumbPath2x = window['AscDesktopEditor'].getFontsSprite(true);
thumbs[2].path = Common.Controllers.Desktop.call('getFontsSprite', '@1.5x');
thumbs[3].path = Common.Controllers.Desktop.call('getFontsSprite', '@1.75x');
thumbs[4].path = Common.Controllers.Desktop.call('getFontsSprite', '@2x');
} }
var bestDistance = Math.abs(applicationPixelRatio-thumbs[0].ratio); thumbCanvas.height = isRetina ? iconHeight * 2 : iconHeight;
var currentDistance = 0; thumbCanvas.width = isRetina ? iconWidth * 2 : iconWidth;
for (var i=1; i<thumbs.length; i++) {
currentDistance = Math.abs(applicationPixelRatio-thumbs[i].ratio);
if (currentDistance < (bestDistance - 0.0001))
{
bestDistance = currentDistance;
thumbIdx = i;
}
}
thumbCanvas.height = thumbs[thumbIdx].height;
thumbCanvas.width = thumbs[thumbIdx].width;
function CThumbnailLoader() {
this.supportBinaryFormat = !(Common.Controllers.Desktop.isActive() && !Common.Controllers.Desktop.isFeatureAvailable('isSupportBinaryFontsSprite'));
// наш формат - альфамаска с сжатием типа rle для полностью прозрачных пикселов
this.image = null;
this.binaryFormat = null;
this.data = null;
this.width = 0;
this.height = 0;
this.heightOne = 0;
this.count = 0;
this.offsets = null;
this.load = function(url, callback) {
if (!callback)
return;
if (!this.supportBinaryFormat) {
this.width = thumbs[thumbIdx].width;
this.heightOne = thumbs[thumbIdx].height;
this.image = new Image();
this.image.onload = callback;
this.image.src = thumbs[thumbIdx].path;
} else {
var me = this;
var xhr = new XMLHttpRequest();
xhr.open('GET', url + ".bin", true);
xhr.responseType = 'arraybuffer';
if (xhr.overrideMimeType)
xhr.overrideMimeType('text/plain; charset=x-user-defined');
else
xhr.setRequestHeader('Accept-Charset', 'x-user-defined');
xhr.onload = function() {
// TODO: check errors
me.binaryFormat = new Uint8Array(this.response);
callback();
};
xhr.send(null);
}
};
this.openBinary = function(arrayBuffer) {
//var t1 = performance.now();
var binaryAlpha = this.binaryFormat;
this.width = (binaryAlpha[0] << 24) | (binaryAlpha[1] << 16) | (binaryAlpha[2] << 8) | (binaryAlpha[3] << 0);
this.heightOne = (binaryAlpha[4] << 24) | (binaryAlpha[5] << 16) | (binaryAlpha[6] << 8) | (binaryAlpha[7] << 0);
this.count = (binaryAlpha[8] << 24) | (binaryAlpha[9] << 16) | (binaryAlpha[10] << 8) | (binaryAlpha[11] << 0);
this.height = this.count * this.heightOne;
var MAX_MEMORY_SIZE = 50000000;
var memorySize = 4 * this.width * this.height;
var isOffsets = (memorySize > MAX_MEMORY_SIZE) ? true : false;
if (!isOffsets)
this.data = new Uint8ClampedArray(memorySize);
else
this.offsets = new Array(this.count);
var binaryIndex = 12;
var binaryLen = binaryAlpha.length;
var index = 0;
var len0 = 0;
var tmpValue = 0;
if (!isOffsets) {
var imagePixels = this.data;
while (binaryIndex < binaryLen) {
tmpValue = binaryAlpha[binaryIndex++];
if (0 == tmpValue) {
len0 = binaryAlpha[binaryIndex++];
while (len0 > 0) {
len0--;
imagePixels[index] = imagePixels[index + 1] = imagePixels[index + 2] = 255;
imagePixels[index + 3] = 0; // this value is already 0.
index += 4;
}
} else {
imagePixels[index] = imagePixels[index + 1] = imagePixels[index + 2] = 255 - tmpValue;
imagePixels[index + 3] = tmpValue;
index += 4;
}
}
} else {
var module = this.width * this.heightOne;
var moduleCur = module - 1;
while (binaryIndex < binaryLen) {
tmpValue = binaryAlpha[binaryIndex++];
if (0 == tmpValue) {
len0 = binaryAlpha[binaryIndex++];
while (len0 > 0) {
len0--;
moduleCur++;
if (moduleCur === module) {
this.offsets[index++] = { pos : binaryIndex, len : len0 + 1 };
moduleCur = 0;
}
}
} else {
moduleCur++;
if (moduleCur === module) {
this.offsets[index++] = { pos : binaryIndex - 1, len : -1 };
moduleCur = 0;
}
}
}
}
if (!this.offsets)
delete this.binaryFormat;
//var t2 = performance.now();
//console.log(t2 - t1);
};
this.getImage = function(index, canvas, ctx) {
//var t1 = performance.now();
if (!canvas)
{
canvas = document.createElement("canvas");
canvas.width = this.width;
canvas.height = this.heightOne;
canvas.style.width = iconWidth + "px";
canvas.style.height = iconHeight + "px";
ctx = canvas.getContext("2d");
}
if (this.supportBinaryFormat) {
if (!this.data && !this.offsets) {
this.openBinary(this.binaryFormat);
}
var dataTmp = ctx.createImageData(this.width, this.heightOne);
var sizeImage = 4 * this.width * this.heightOne;
if (!this.offsets) {
dataTmp.data.set(new Uint8ClampedArray(this.data.buffer, index * sizeImage, sizeImage));
} else {
var binaryAlpha = this.binaryFormat;
var binaryIndex = this.offsets[index].pos;
var alphaChannel = 0;
var pixelsCount = this.width * this.heightOne;
var tmpValue = 0, len0 = 0;
var imagePixels = dataTmp.data;
if (-1 != this.offsets[index].len) {
/*
// this values is already 0.
for (var i = 0; i < this.offsets[index].len; i++) {
pixels[alphaChannel] = 0;
alphaChannel += 4;
}
*/
alphaChannel += 4 * this.offsets[index].len;
}
while (pixelsCount > 0) {
tmpValue = binaryAlpha[binaryIndex++];
if (0 == tmpValue) {
len0 = binaryAlpha[binaryIndex++];
if (len0 > pixelsCount)
len0 = pixelsCount;
while (len0 > 0) {
len0--;
imagePixels[alphaChannel] = imagePixels[alphaChannel + 1] = imagePixels[alphaChannel + 2] = 255;
imagePixels[alphaChannel + 3] = 0; // this value is already 0.
alphaChannel += 4;
pixelsCount--;
}
} else {
imagePixels[alphaChannel] = imagePixels[alphaChannel + 1] = imagePixels[alphaChannel + 2] = 255 - tmpValue;
imagePixels[alphaChannel + 3] = tmpValue;
alphaChannel += 4;
pixelsCount--;
}
}
}
ctx.putImageData(dataTmp, 0, 0);
} else {
ctx.clearRect(0, 0, this.width, this.heightOne);
ctx.drawImage(this.image, 0, -this.heightOne * index);
}
//var t2 = performance.now();
//console.log(t2 - t1);
return canvas;
};
}
return { return {
template: _.template([ template: _.template([
'<div class="input-group combobox fonts <%= cls %>" id="<%= id %>" style="<%= style %>">', '<div class="input-group combobox fonts <%= cls %>" id="<%= id %>" style="<%= style %>">',
'<input type="text" class="form-control" spellcheck="false" data-hint="<%= dataHint %>" data-hint-direction="<%= dataHintDirection %>"> ', '<input type="text" class="form-control" spellcheck="false"> ',
'<div style="display: table-cell;"></div>', '<div style="display: table-cell;"></div>',
'<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button>', '<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret img-commonctrl"></span></button>',
'<ul class="dropdown-menu <%= menuCls %>" style="<%= menuStyle %>" role="menu">', '<ul class="dropdown-menu <%= menuCls %>" style="<%= menuStyle %>" role="menu">',
'<li class="divider">', '<li class="divider">',
'<% _.each(items, function(item) { %>', '<% _.each(items, function(item) { %>',
'<li id="<%= item.id %>">', '<li id="<%= item.id %>">',
'<a class="font-item" tabindex="-1" type="menuitem" style="height:<%=scope.getListItemHeight()%>px;"></a>', '<a class="font-item" tabindex="-1" type="menuitem" style="height:<%=scope.getListItemHeight()%>px;"/>',
'</li>', '</li>',
'<% }); %>', '<% }); %>',
'</ul>', '</ul>',
@ -321,17 +104,14 @@ define([
render : function(parentEl) { render : function(parentEl) {
var oldRawValue = null; var oldRawValue = null;
var oldTabindex = '';
if (!_.isUndefined(this._input)) { if (!_.isUndefined(this._input)) {
oldRawValue = this._input.val(); oldRawValue = this._input.val();
oldTabindex = this._input.attr('tabindex');
} }
Common.UI.ComboBox.prototype.render.call(this, parentEl); Common.UI.ComboBox.prototype.render.call(this, parentEl);
this.setRawValue(oldRawValue); this.setRawValue(oldRawValue);
this._input.attr('tabindex', oldTabindex);
this._input.on('keyup', _.bind(this.onInputKeyUp, this)); this._input.on('keyup', _.bind(this.onInputKeyUp, this));
this._input.on('keydown', _.bind(this.onInputKeyDown, this)); this._input.on('keydown', _.bind(this.onInputKeyDown, this));
@ -347,8 +127,6 @@ define([
if ($(e.target).closest('input').length) { // enter in input field if ($(e.target).closest('input').length) { // enter in input field
if (this.lastValue !== this._input.val()) if (this.lastValue !== this._input.val())
this._input.trigger('change'); this._input.trigger('change');
else
return true;
} else { // enter in dropdown list } else { // enter in dropdown list
$(e.target).click(); $(e.target).click();
if (this.rendered) { if (this.rendered) {
@ -377,7 +155,6 @@ define([
}, },
onInputKeyUp: function(e) { onInputKeyUp: function(e) {
if (!this._isKeyDown) return;
if (e.keyCode != Common.UI.Keys.RETURN && e.keyCode !== Common.UI.Keys.SHIFT && if (e.keyCode != Common.UI.Keys.RETURN && e.keyCode !== Common.UI.Keys.SHIFT &&
e.keyCode !== Common.UI.Keys.CTRL && e.keyCode !== Common.UI.Keys.ALT && e.keyCode !== Common.UI.Keys.CTRL && e.keyCode !== Common.UI.Keys.ALT &&
e.keyCode !== Common.UI.Keys.LEFT && e.keyCode !== Common.UI.Keys.RIGHT && e.keyCode !== Common.UI.Keys.LEFT && e.keyCode !== Common.UI.Keys.RIGHT &&
@ -409,11 +186,9 @@ define([
}, 10); }, 10);
} }
} }
this._isKeyDown = false;
}, },
onInputKeyDown: function(e) { onInputKeyDown: function(e) {
this._isKeyDown = true;
this._inInputKeyDown = (new Date()); this._inInputKeyDown = (new Date());
var me = this; var me = this;
@ -423,11 +198,9 @@ define([
me.closeMenu(); me.closeMenu();
me.onAfterHideMenu(e); me.onAfterHideMenu(e);
}, 10); }, 10);
} else if (e.keyCode != Common.UI.Keys.RETURN && e.keyCode != Common.UI.Keys.CTRL && e.keyCode != Common.UI.Keys.SHIFT && e.keyCode != Common.UI.Keys.ALT && e.keyCode != Common.UI.Keys.TAB){ } else if (e.keyCode != Common.UI.Keys.RETURN && e.keyCode != Common.UI.Keys.CTRL && e.keyCode != Common.UI.Keys.SHIFT && e.keyCode != Common.UI.Keys.ALT){
if (!this.isMenuOpen() && !e.ctrlKey) { if (!this.isMenuOpen() && !e.ctrlKey)
this.openMenu(); this.openMenu();
(this.recent > 0) && this.flushVisibleFontsTiles();
}
if (e.keyCode == Common.UI.Keys.UP || e.keyCode == Common.UI.Keys.DOWN) { if (e.keyCode == Common.UI.Keys.UP || e.keyCode == Common.UI.Keys.DOWN) {
_.delay(function() { _.delay(function() {
@ -500,8 +273,15 @@ define([
return img != null ? img[0].src : undefined; return img != null ? img[0].src : undefined;
} }
var index = Math.floor(opts.imgidx/spriteCols); if (isRetina) {
return this.spriteThumbs.getImage(index, thumbCanvas, thumbContext).toDataURL(); thumbContext.clearRect(0, 0, iconWidth * 2, iconHeight * 2);
thumbContext.drawImage(this.spriteThumbs, 0, -Asc.FONT_THUMBNAIL_HEIGHT * 2 * opts.imgidx);
} else {
thumbContext.clearRect(0, 0, iconWidth, iconHeight);
thumbContext.drawImage(this.spriteThumbs, 0, -Asc.FONT_THUMBNAIL_HEIGHT * opts.imgidx);
}
return thumbCanvas.toDataURL();
}, },
getImageWidth: function() { getImageWidth: function() {
@ -517,15 +297,17 @@ define([
}, },
loadSprite: function(callback) { loadSprite: function(callback) {
this.spriteThumbs = new CThumbnailLoader(); if (callback) {
this.spriteThumbs.load(thumbs[thumbIdx].path, callback); this.spriteThumbs = new Image();
this.spriteThumbs.onload = callback;
this.spriteThumbs.src = (window.devicePixelRatio > 1) ? thumbPath2x : thumbPath;
}
}, },
fillFonts: function(store, select) { fillFonts: function(store, select) {
var me = this; var me = this;
this.loadSprite(function() { this.loadSprite(function() {
spriteCols = Math.floor(me.spriteThumbs.width / (thumbs[thumbIdx].width)) || 1;
me.store.set(store.toJSON()); me.store.set(store.toJSON());
me.rendered = false; me.rendered = false;
@ -554,22 +336,16 @@ define([
onApiChangeFont: function(font) { onApiChangeFont: function(font) {
var me = this; var me = this;
var name = (_.isFunction(font.get_Name) ? font.get_Name() : font.asc_getFontName()); setTimeout(function () {
if (this.__name !== name) { me.onApiChangeFontInternal(font);
this.__name = name;
if (!this.__nameId) {
this.__nameId = setTimeout(function () {
me.onApiChangeFontInternal(me.__name);
me.__nameId = null;
}, 100); }, 100);
}
}
}, },
onApiChangeFontInternal: function(name) { onApiChangeFontInternal: function(font) {
if (this.inFormControl) return; if (this.inFormControl) return;
var name = (_.isFunction(font.get_Name) ? font.get_Name() : font.asc_getName());
if (this.getRawValue() !== name) { if (this.getRawValue() !== name) {
var record = this.store.findWhere({ var record = this.store.findWhere({
name: name name: name
@ -594,12 +370,6 @@ define([
}, },
itemClicked: function (e) { itemClicked: function (e) {
this.__name = undefined;
if (this.__nameId) {
clearTimeout(this.__nameId);
this.__nameId = undefined;
}
Common.UI.ComboBox.prototype.itemClicked.apply(this, arguments); Common.UI.ComboBox.prototype.itemClicked.apply(this, arguments);
var el = $(e.target).closest('li'); var el = $(e.target).closest('li');
@ -610,7 +380,7 @@ define([
onInsertItem: function(item) { onInsertItem: function(item) {
$(this.el).find('ul').prepend(_.template([ $(this.el).find('ul').prepend(_.template([
'<li id="<%= item.id %>">', '<li id="<%= item.id %>">',
'<a class="font-item" tabindex="-1" type="menuitem" style="height:<%=scope.getListItemHeight()%>px;"></a>', '<a class="font-item" tabindex="-1" type="menuitem" style="height:<%=scope.getListItemHeight()%>px;"/>',
'</li>' '</li>'
].join(''))({ ].join(''))({
item: item.attributes, item: item.attributes,
@ -647,7 +417,6 @@ define([
this.trigger('show:after', this, e); this.trigger('show:after', this, e);
this.flushVisibleFontsTiles(); this.flushVisibleFontsTiles();
this.updateVisibleFontsTiles(null, 0); this.updateVisibleFontsTiles(null, 0);
Common.Utils.isGecko && this.scroller && this.scroller.update();
} else { } else {
Common.UI.ComboBox.prototype.onAfterShowMenu.apply(this, arguments); Common.UI.ComboBox.prototype.onAfterShowMenu.apply(this, arguments);
} }
@ -661,7 +430,7 @@ define([
}, },
addItemToRecent: function(record, silent) { addItemToRecent: function(record, silent) {
if (!record || this.recent<1) return; if (this.recent<1) return;
var font = this.store.findWhere({name: record.get('name'),type:FONT_TYPE_RECENT}); var font = this.store.findWhere({name: record.get('name'),type:FONT_TYPE_RECENT});
font && this.store.remove(font); font && this.store.remove(font);
@ -744,8 +513,24 @@ define([
for (j = 0; j < storeCount; ++j) { for (j = 0; j < storeCount; ++j) {
if (from <= j && j < to) { if (from <= j && j < to) {
if (null === me.tiles[j]) { if (null === me.tiles[j]) {
index = Math.floor(me.store.at(j).get('imgidx')/spriteCols); var fontImage = document.createElement('canvas');
var fontImage = me.spriteThumbs.getImage(index); var context = fontImage.getContext('2d');
fontImage.height = isRetina ? iconHeight * 2 : iconHeight;
fontImage.width = isRetina ? iconWidth * 2 : iconWidth;
fontImage.style.width = iconWidth + 'px';
fontImage.style.height = iconHeight + 'px';
index = me.store.at(j).get('imgidx');
if (isRetina) {
context.clearRect(0, 0, iconWidth * 2, iconHeight * 2);
context.drawImage(me.spriteThumbs, 0, -Asc.FONT_THUMBNAIL_HEIGHT * 2 * index);
} else {
context.clearRect(0, 0, iconWidth, iconHeight);
context.drawImage(me.spriteThumbs, 0, -Asc.FONT_THUMBNAIL_HEIGHT * index);
}
me.tiles[j] = fontImage; me.tiles[j] = fontImage;
$(listItems[j]).get(0).appendChild(fontImage); $(listItems[j]).get(0).appendChild(fontImage);

View file

@ -60,10 +60,7 @@ define([
beforeOpenHandler : null, beforeOpenHandler : null,
additionalMenuItems : null, additionalMenuItems : null,
showLast: true, showLast: true,
minWidth: -1, minWidth: -1
dataHint: '',
dataHintDirection: '',
dataHintOffset: ''
}, },
template: _.template([ template: _.template([
@ -81,7 +78,6 @@ define([
this.style = this.options.style; this.style = this.options.style;
this.hint = this.options.hint; this.hint = this.options.hint;
this.store = this.options.store || new Common.UI.DataViewStore(); this.store = this.options.store || new Common.UI.DataViewStore();
this.groups = this.options.groups;
this.itemWidth = this.options.itemWidth; this.itemWidth = this.options.itemWidth;
this.itemHeight = this.options.itemHeight; this.itemHeight = this.options.itemHeight;
this.menuMaxHeight = this.options.menuMaxHeight; this.menuMaxHeight = this.options.menuMaxHeight;
@ -92,21 +88,18 @@ define([
this.rendered = false; this.rendered = false;
this.needFillComboView = false; this.needFillComboView = false;
this.minWidth = this.options.minWidth; this.minWidth = this.options.minWidth;
this.delayRenderTips = this.options.delayRenderTips || false;
this.itemTemplate = this.options.itemTemplate || _.template([
'<div class="style" id="<%= id %>">',
'<img src="<%= imageUrl %>" width="' + this.itemWidth + '" height="' + this.itemHeight + '" + <% if(typeof imageUrl === "undefined" || imageUrl===null || imageUrl==="") { %> style="visibility: hidden;" <% } %>/>',
'<% if (typeof title !== "undefined") {%>',
'<span class="title"><%= title %></span>',
'<% } %>',
'</div>'
].join(''));
this.fieldPicker = new Common.UI.DataView({ this.fieldPicker = new Common.UI.DataView({
cls: 'field-picker', cls: 'field-picker',
allowScrollbar: false, allowScrollbar: false,
itemTemplate : this.itemTemplate, itemTemplate : _.template([
delayRenderTips: this.delayRenderTips '<div class="style" id="<%= id %>">',
'<img src="<%= imageUrl %>" width="' + this.itemWidth + '" height="' + this.itemHeight + '"/>',
'<% if (typeof title !== "undefined") {%>',
'<span class="title"><%= title %></span>',
'<% } %>',
'</div>'
].join(''))
}); });
this.openButton = new Common.UI.Button({ this.openButton = new Common.UI.Button({
@ -116,30 +109,31 @@ define([
offset: [0, 3], offset: [0, 3],
items: [ items: [
{template: _.template('<div class="menu-picker-container"></div>')} {template: _.template('<div class="menu-picker-container"></div>')}
].concat(this.options.additionalMenuItems != null ? this.options.additionalMenuItems : []) ]
}), })
dataHint: this.options.dataHint,
dataHintDirection: this.options.dataHintDirection,
dataHintOffset: this.options.dataHintOffset
}); });
if (this.options.additionalMenuItems != null) {
this.openButton.menu.items = this.openButton.menu.items.concat(this.options.additionalMenuItems)
}
this.menuPicker = new Common.UI.DataView({ this.menuPicker = new Common.UI.DataView({
cls: 'menu-picker', cls: 'menu-picker',
parentMenu: this.openButton.menu, parentMenu: this.openButton.menu,
outerMenu: this.options.additionalMenuItems ? {menu: this.openButton.menu, index: 0} : undefined,
restoreHeight: this.menuMaxHeight, restoreHeight: this.menuMaxHeight,
style: 'max-height: '+this.menuMaxHeight+'px;', style: 'max-height: '+this.menuMaxHeight+'px;',
enableKeyEvents: this.options.enableKeyEvents, enableKeyEvents: this.options.enableKeyEvents,
groups: this.groups,
store: this.store, store: this.store,
itemTemplate : this.itemTemplate, itemTemplate : _.template([
delayRenderTips: this.delayRenderTips '<div class="style" id="<%= id %>">',
'<img src="<%= imageUrl %>" width="' + this.itemWidth + '" height="' + this.itemHeight + '"/>',
'<% if (typeof title !== "undefined") {%>',
'<span class="title"><%= title %></span>',
'<% } %>',
'</div>'
].join(''))
}); });
if (this.options.additionalMenuItems != null) {
this.openButton.menu.setInnerMenu([{menu: this.menuPicker, index: 0}]);
}
// Handle resize // Handle resize
setInterval(_.bind(this.checkSize, this), 500); setInterval(_.bind(this.checkSize, this), 500);
@ -214,9 +208,6 @@ define([
me.trigger('render:after', me); me.trigger('render:after', me);
} }
if (this.disabled) {
this.setDisabled(!!this.disabled);
}
return this; return this;
}, },
@ -244,10 +235,9 @@ define([
onResize: function() { onResize: function() {
if (this.openButton) { if (this.openButton) {
var button = $('button', this.openButton.cmpEl); var button = $('button', this.openButton.cmpEl);
var cntButton = $('.button', this.cmpEl); button && button.css({
button && cntButton.width() > 0 && button.css({ width : $('.button', this.cmpEl).width(),
width : cntButton.width(), height: $('.button', this.cmpEl).height()
height: cntButton.height()
}); });
this.openButton.menu.hide(); this.openButton.menu.hide();
@ -255,7 +245,6 @@ define([
var picker = this.menuPicker; var picker = this.menuPicker;
if (picker) { if (picker) {
var record = picker.getSelectedRec(); var record = picker.getSelectedRec();
this.itemMarginLeft = undefined;
this.fillComboView(record || picker.store.at(0), !!record, true); this.fillComboView(record || picker.store.at(0), !!record, true);
picker.onResize(); picker.onResize();
@ -381,7 +370,6 @@ define([
}, },
setDisabled: function(disabled) { setDisabled: function(disabled) {
disabled = !!disabled;
this.disabled = disabled; this.disabled = disabled;
if (!this.rendered) if (!this.rendered)
@ -416,9 +404,6 @@ define([
if (forceFill || !me.fieldPicker.store.findWhere({'id': record.get('id')})){ if (forceFill || !me.fieldPicker.store.findWhere({'id': record.get('id')})){
if (me.itemMarginLeft===undefined) { if (me.itemMarginLeft===undefined) {
var div = $($(this.menuPicker.el).find('.inner > div:not(.grouped-data):not(.ps-scrollbar-x-rail):not(.ps-scrollbar-y-rail)')[0]); var div = $($(this.menuPicker.el).find('.inner > div:not(.grouped-data):not(.ps-scrollbar-x-rail):not(.ps-scrollbar-y-rail)')[0]);
if (!div || div.length<1) { // try to find items in groups
div = $($(this.menuPicker.el).find('.inner .group-items-container > div:not(.grouped-data):not(.ps-scrollbar-x-rail):not(.ps-scrollbar-y-rail)')[0]);
}
if (div.length > 0) { if (div.length > 0) {
me.itemMarginLeft = parseInt(div.css('margin-left')); me.itemMarginLeft = parseInt(div.css('margin-left'));
me.itemMarginRight = parseInt(div.css('margin-right')); me.itemMarginRight = parseInt(div.css('margin-right'));
@ -459,7 +444,6 @@ define([
me.resumeEvents(); me.resumeEvents();
} }
} }
return me.fieldPicker.store.models; // return list of visible items
} }
} }
}, },
@ -475,21 +459,14 @@ define([
this.menuPicker.selectByIndex(index); this.menuPicker.selectByIndex(index);
}, },
selectRecord: function(record) {
if (!record)
this.fieldPicker.deselectAll();
this.menuPicker.selectRecord(record);
},
setItemWidth: function(width) { setItemWidth: function(width) {
if (this.itemWidth != width) if (this.itemWidth != width)
this.itemWidth = Common.Utils.applicationPixelRatio() > 1 ? width / 2 : width; this.itemWidth = window.devicePixelRatio > 1 ? width / 2 : width;
}, },
setItemHeight: function(height) { setItemHeight: function(height) {
if (this.itemHeight != height) if (this.itemHeight != height)
this.itemHeight = Common.Utils.applicationPixelRatio() > 1 ? height / 2 : height; this.itemHeight = window.devicePixelRatio > 1 ? height / 2 : height;
}, },
removeTips: function() { removeTips: function() {

View file

@ -1,490 +0,0 @@
/*
*
* (c) Copyright Ascensio System SIA 2010-2019
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
/**
* ComboDataView.js
*
* Created by Julia Svinareva on 6/10/21
* Copyright (c) 2021 Ascensio System SIA. All rights reserved.
*
*/
if (Common === undefined)
var Common = {};
define([
'common/main/lib/component/BaseView',
'common/main/lib/component/DataView'
], function () {
'use strict';
Common.UI.ComboDataViewShape = Common.UI.BaseView.extend({
options : {
id : null,
cls : '',
style : '',
hint : false,
itemWidth : 80,
itemHeight : 40,
menuMaxHeight : 300,
enableKeyEvents : false,
additionalMenuItems : null,
minWidth: -1,
dataHint: '',
dataHintDirection: '',
dataHintOffset: ''
},
template: _.template([
'<div id="<%= id %>" class="combo-dataview <%= cls %>" style="<%= style %>">',
'<div class="view"></div> ',
'<div class="button"></div> ',
'</div>'
].join('')),
initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
var filter = Common.localStorage.getKeysFilter();
this.appPrefix = (filter && filter.length) ? filter.split(',')[0] : '';
this.id = this.options.id || Common.UI.getId();
this.cls = this.options.cls;
this.style = this.options.style;
this.hint = this.options.hint;
this.store = this.options.store || new Common.UI.DataViewStore();
this.itemWidth = this.options.itemWidth;
this.itemHeight = this.options.itemHeight;
this.menuMaxHeight = this.options.menuMaxHeight;
this.menuWidth = this.options.menuWidth;
this.rootWidth = 0;
this.rootHeight = 0;
this.rendered = false;
this.needFillComboView = false;
this.minWidth = this.options.minWidth;
this.delayRenderTips = this.options.delayRenderTips || false;
this.fieldPicker = new Common.UI.DataView({
cls: 'field-picker',
allowScrollbar: false,
itemTemplate: _.template('<div class="item-shape" id="<%= id %>" data-shape="<%= data.shapeType %>"><svg width="20" height="20" class=\"icon\"><use xlink:href=\"#svg-icon-<%= data.shapeType %>\"></use></svg></div>'),
delayRenderTips: this.delayRenderTips
});
this.openButton = new Common.UI.Button({
cls: 'open-menu',
menu: new Common.UI.Menu({
cls: 'menu-insert-shape',
menuAlign: 'tl-tl',
offset: [0, 3],
items: [
{template: _.template('<div class="menu-picker-container"></div>')}
]
}),
dataHint: this.options.dataHint,
dataHintDirection: this.options.dataHintDirection,
dataHintOffset: this.options.dataHintOffset
});
// Handle resize
setInterval(_.bind(this.checkSize, this), 500);
if (this.options.el) {
this.render();
}
},
fillComboView: function (collection) {
var groups = collection.toJSON(),
recents = Common.localStorage.getItem(this.appPrefix + 'recent-shapes');
recents = recents ? JSON.parse(recents) : [];
// check lang
if (recents.length > 0) {
var isTranslated = _.findWhere(groups, {groupName: recents[0].groupName});
if (!isTranslated) {
for (var r = 0; r < recents.length; r++) {
var type = recents[r].data.shapeType,
record;
for (var g = 0; g < groups.length; g++) {
var store = groups[g].groupStore,
groupName = groups[g].groupName;
for (var i = 0; i < store.length; i++) {
if (store.at(i).get('data').shapeType === type) {
record = store.at(i).toJSON();
recents[r] = {
data: record.data,
tip: record.tip,
allowSelected: record.allowSelected,
selected: false,
groupName: groupName
};
break;
}
}
if (record) {
record = undefined;
break;
}
}
}
Common.localStorage.setItem(this.appPrefix + 'recent-shapes', JSON.stringify(recents));
}
}
if (recents.length < 12) {
var count = 12 - recents.length;
var addItem = function (rec) {
var item = rec.toJSON(),
model = {
data: item.data,
tip: item.tip,
allowSelected: item.allowSelected,
selected: false
};
recents.push(model);
};
for (var j = 0; j < groups.length && count > 0; j++) {
var groupStore = groups[j].groupStore;
if (j === 0) {
addItem(groupStore.at(1));
count--;
if (count > 0) {
addItem(groupStore.at(2));
count--;
}
} else if (j !== 3 && j !== 6 && j !== 7) {
addItem(groupStore.at(0));
count--;
if (count > 0) {
addItem(groupStore.at(1));
count--;
}
}
}
}
this.fieldPicker.store.reset(recents);
this.fieldPicker.on('item:select', _.bind(this.onFieldPickerSelect, this));
this.fieldPicker.on('item:click', _.bind(this.onFieldPickerClick, this));
this.fieldPicker.on('item:contextmenu', _.bind(this.onPickerItemContextMenu, this));
this.fieldPicker.el.addEventListener('contextmenu', _.bind(this.onPickerComboContextMenu, this), false);
},
setMenuPicker: function (collection, recent, text) {
this.menuPicker = new Common.UI.DataViewShape({
el: this.cmpEl.find('.menu-picker-container'),
cls: 'menu-picker',
parentMenu: this.openButton.menu,
restoreHeight: this.menuMaxHeight,
style: 'max-height: '+this.menuMaxHeight+'px;',
itemTemplate : _.template('<div class="item-shape" id="<%= id %>"><svg width="20" height="20" class=\"icon\"><use xlink:href=\"#svg-icon-<%= data.shapeType %>\"></use></svg></div>'),
groups: collection,
textRecentlyUsed: text,
recentShapes: recent
});
this.menuPicker.on('item:select', _.bind(this.onMenuPickerSelect, this));
this.menuPicker.on('item:click', _.bind(this.onMenuPickerClick, this));
this.menuPicker.on('item:contextmenu', _.bind(this.onPickerItemContextMenu, this));
this.menuPicker.el.addEventListener('contextmenu', _.bind(this.onPickerComboContextMenu, this), false);
this.onResize();
},
render: function(parentEl) {
if (!this.rendered) {
var me = this;
me.trigger('render:before', me);
me.cmpEl = me.$el || $(me.el);
var templateEl = me.template({
id : me.id,
cls : me.cls,
style : me.style
});
if (parentEl) {
me.setElement(parentEl, false);
me.cmpEl = $(templateEl);
parentEl.html(me.cmpEl);
} else {
me.cmpEl.html(templateEl);
}
me.rootWidth = me.cmpEl.width();
me.rootHeight = me.cmpEl.height();
me.fieldPicker.render($('.view', me.cmpEl));
me.openButton.render($('.button', me.cmpEl));
//me.menuPicker.render($('.menu-picker-container', me.cmpEl));
if (me.openButton.menu.cmpEl) {
if (me.openButton.menu.cmpEl) {
me.openButton.menu.menuAlignEl = me.cmpEl;
me.openButton.menu.cmpEl.css('min-width', me.itemWidth);
me.openButton.menu.on('show:before', _.bind(me.onBeforeShowMenu, me));
me.openButton.menu.on('show:after', _.bind(me.onAfterShowMenu, me));
me.openButton.cmpEl.on('hide.bs.dropdown', _.bind(me.onBeforeHideMenu, me));
me.openButton.cmpEl.on('hidden.bs.dropdown', _.bind(me.onAfterHideMenu, me));
}
}
if (me.options.hint) {
me.cmpEl.attr('data-toggle', 'tooltip');
me.cmpEl.tooltip({
title : me.options.hint,
placement : me.options.hintAnchor || 'cursor'
});
}
//me.onResize();
me.rendered = true;
me.trigger('render:after', me);
}
if (this.disabled) {
this.setDisabled(!!this.disabled);
}
return this;
},
updateComboView: function (record) {
var store = this.fieldPicker.store,
type = record.get('data').shapeType,
model = null;
for (var i = 0; i < store.length; i++) {
if (store.at(i).get('data').shapeType === type) {
model = store.at(i);
break;
}
}
if (!model) {
store.pop();
store.unshift([record]);
}
},
activateRecord: function (record) {
var type = record.get('data').shapeType;
if (this.isRecordActive)
this.deactivateRecords();
$(this.cmpEl.find("[data-shape='" + type + "']")).parent().addClass('active');
this.isRecordActive = true;
},
deactivateRecords: function () {
$(this.cmpEl.find('.field-picker .item')).removeClass('active');
},
isComboViewRecActive: function () {
return this.isRecordActive;
},
checkSize: function() {
if (this.cmpEl && this.cmpEl.is(':visible')) {
var me = this,
width = this.cmpEl.width(),
height = this.cmpEl.height();
if (width < this.minWidth) return;
if (this.rootWidth != width || this.rootHeight != height) {
this.rootWidth = width;
this.rootHeight = height;
setTimeout(function() {
me.openButton.menu.cmpEl.outerWidth();
me.rootWidth = me.cmpEl.width();
}, 10);
this.onResize();
}
}
},
onResize: function() {
if (this.openButton) {
var button = $('button', this.openButton.cmpEl);
var cntButton = $('.button', this.cmpEl);
button && cntButton.width() > 0 && button.css({
width : cntButton.width(),
height: cntButton.height()
});
this.openButton.menu.hide();
/*var picker = this.menuPicker;
if (picker) {
var record = picker.getSelectedRec();
this.fillComboView(record || picker.store.at(0), !!record, true);
picker.onResize();
}*/
}
if (!this.isSuspendEvents)
this.trigger('resize', this);
},
onBeforeShowMenu: function(e) {
var menu = this.openButton.menu;
if (menu.cmpEl) {
menu.menuAlignEl = this.cmpEl;
var offset = this.cmpEl.width() - this.openButton.$el.width() - this.menuWidth + 1;
menu.setOffset(Math.min(offset, 0));
}
if (this.options.hint) {
var tip = this.cmpEl.data('bs.tooltip');
if (tip) {
if (tip.dontShow===undefined)
tip.dontShow = true;
tip.hide();
}
}
},
onBeforeHideMenu: function(e) {
this.trigger('hide:before', this, e);
if (Common.UI.Scroller.isMouseCapture())
e.preventDefault();
if (this.isStylesNotClosable)
return false;
},
onAfterShowMenu: function(e) {
var me = this;
if (me.menuPicker.scroller) {
me.menuPicker.scroller.update({
includePadding: true,
suppressScrollX: true,
alwaysVisibleY: true
});
}
},
onAfterHideMenu: function(e, isFromInputControl) {
this.menuPicker.selectedBeforeHideRec = this.menuPicker.getSelectedRec(); // for DataView - onKeyDown - Return key
this.menuPicker.deselectAll();
this.trigger('hide:after', this, e, isFromInputControl);
},
onFieldPickerSelect: function(picker, item, record) {
//
},
onMenuPickerSelect: function(picker, item, record, fromKeyDown) {
this.needFillComboView = this.disabled;
if (this.disabled || fromKeyDown===true) return;
/*this.fillComboView(record, false);
if (record && !this.isSuspendEvents)
this.trigger('select', this, record);*/
},
onFieldPickerClick: function(dataView, item, record) {
if (this.disabled) return;
var isActive = item.$el.hasClass('active');
if (!this.isSuspendEvents)
this.trigger('click', this, record, isActive);
if (this.options.hint) {
var tip = this.cmpEl.data('bs.tooltip');
if (tip) {
if (tip.dontShow===undefined)
tip.dontShow = true;
tip.hide();
}
}
if (!isActive) {
this.activateRecord(record);
}
},
onMenuPickerClick: function(dataView, itemView, record) {
if (this.disabled) return;
if (!this.isSuspendEvents)
this.trigger('click', this, record);
this.activateRecord(record);
},
onPickerItemContextMenu: function(dataView, itemView, record, e) {
if (this.disabled) return;
if (!this.isSuspendEvents) {
this.trigger('contextmenu', this, record, e);
}
e.preventDefault();
e.stopPropagation();
return false;
},
onPickerComboContextMenu: function(mouseEvent) {
if (this.disabled) return;
if (!this.isSuspendEvents) {
this.trigger('contextmenu', this, undefined, mouseEvent);
}
},
setDisabled: function(disabled) {
disabled = !!disabled;
this.disabled = disabled;
if (!this.rendered)
return;
this.cmpEl.toggleClass('disabled', disabled);
$('button', this.openButton.cmpEl).toggleClass('disabled', disabled);
this.fieldPicker.setDisabled(disabled);
},
isDisabled: function() {
return this.disabled;
}
})
});

View file

@ -125,11 +125,8 @@ define([
var me = this; var me = this;
me.template = me.options.template || me.template; me.template = me.options.template || me.template;
me.dataHint = me.options.dataHint || '';
me.dataHintDirection = me.options.dataHintDirection || '';
me.dataHintOffset = me.options.dataHintOffset || '';
me.listenTo(me.model, 'change', this.model.get('skipRenderOnChange') ? me.onChange : me.render); me.listenTo(me.model, 'change', me.render);
me.listenTo(me.model, 'change:selected', me.onSelectChange); me.listenTo(me.model, 'change:selected', me.onSelectChange);
me.listenTo(me.model, 'remove', me.remove); me.listenTo(me.model, 'remove', me.remove);
}, },
@ -143,15 +140,6 @@ define([
el.html(this.template(this.model.toJSON())); el.html(this.template(this.model.toJSON()));
el.addClass('item'); el.addClass('item');
el.toggleClass('selected', this.model.get('selected') && this.model.get('allowSelected')); el.toggleClass('selected', this.model.get('selected') && this.model.get('allowSelected'));
if (this.dataHint !== '') {
el.attr('data-hint', this.dataHint);
el.attr('data-hint-direction', this.dataHintDirection);
el.attr('data-hint-offset', this.dataHintOffset);
}
if (!_.isUndefined(this.model.get('contentTarget')))
el.attr('content-target', this.model.get('contentTarget'));
el.off('click dblclick contextmenu'); el.off('click dblclick contextmenu');
el.on({ 'click': _.bind(this.onClick, this), el.on({ 'click': _.bind(this.onClick, this),
'dblclick': _.bind(this.onDblClick, this), 'dblclick': _.bind(this.onDblClick, this),
@ -197,18 +185,6 @@ define([
onSelectChange: function(model, selected) { onSelectChange: function(model, selected) {
this.trigger('select', this, model, selected); this.trigger('select', this, model, selected);
},
onChange: function () {
if (_.isUndefined(this.model.id))
return this;
var el = this.$el || $(this.el);
el.toggleClass('selected', this.model.get('selected') && this.model.get('allowSelected'));
el.toggleClass('disabled', !!this.model.get('disabled'));
this.trigger('change', this, this.model);
return this;
} }
}); });
@ -223,14 +199,12 @@ define([
listenStoreEvents: true, listenStoreEvents: true,
allowScrollbar: true, allowScrollbar: true,
scrollAlwaysVisible: false, scrollAlwaysVisible: false,
minScrollbarLength: 40,
showLast: true, showLast: true,
useBSKeydown: false, useBSKeydown: false
cls: ''
}, },
template: _.template([ template: _.template([
'<div class="dataview inner <%= cls %>" style="<%= style %>">', '<div class="dataview inner" style="<%= style %>">',
'<% _.each(groups, function(group) { %>', '<% _.each(groups, function(group) { %>',
'<% if (group.headername !== undefined) { %>', '<% if (group.headername !== undefined) { %>',
'<div class="header-name"><%= group.headername %></div>', '<div class="header-name"><%= group.headername %></div>',
@ -257,28 +231,19 @@ define([
me.store = me.options.store || new Common.UI.DataViewStore(); me.store = me.options.store || new Common.UI.DataViewStore();
me.groups = me.options.groups || null; me.groups = me.options.groups || null;
me.itemTemplate = me.options.itemTemplate || null; me.itemTemplate = me.options.itemTemplate || null;
me.itemDataHint = me.options.itemDataHint || '';
me.itemDataHintDirection = me.options.itemDataHintDirection || '';
me.itemDataHintOffset = me.options.itemDataHintOffset || '';
me.multiSelect = me.options.multiSelect; me.multiSelect = me.options.multiSelect;
me.handleSelect = me.options.handleSelect; me.handleSelect = me.options.handleSelect;
me.parentMenu = me.options.parentMenu; me.parentMenu = me.options.parentMenu;
me.outerMenu = me.options.outerMenu;
me.enableKeyEvents= me.options.enableKeyEvents; me.enableKeyEvents= me.options.enableKeyEvents;
me.useBSKeydown = me.options.useBSKeydown; // only with enableKeyEvents && parentMenu me.useBSKeydown = me.options.useBSKeydown; // only with enableKeyEvents && parentMenu
me.showLast = me.options.showLast; me.showLast = me.options.showLast;
me.style = me.options.style || ''; me.style = me.options.style || '';
me.cls = me.options.cls || '';
me.emptyText = me.options.emptyText || ''; me.emptyText = me.options.emptyText || '';
me.listenStoreEvents= (me.options.listenStoreEvents!==undefined) ? me.options.listenStoreEvents : true; me.listenStoreEvents= (me.options.listenStoreEvents!==undefined) ? me.options.listenStoreEvents : true;
me.allowScrollbar = (me.options.allowScrollbar!==undefined) ? me.options.allowScrollbar : true; me.allowScrollbar = (me.options.allowScrollbar!==undefined) ? me.options.allowScrollbar : true;
me.scrollAlwaysVisible = me.options.scrollAlwaysVisible || false; me.scrollAlwaysVisible = me.options.scrollAlwaysVisible || false;
me.minScrollbarLength = me.options.minScrollbarLength || 40;
me.tabindex = me.options.tabindex || 0;
me.delayRenderTips = me.options.delayRenderTips || false;
if (me.parentMenu) if (me.parentMenu)
me.parentMenu.options.restoreHeight = (me.options.restoreHeight>0); me.parentMenu.options.restoreHeight = (me.options.restoreHeight>0);
me.delaySelect = me.options.delaySelect || false;
me.rendered = false; me.rendered = false;
me.dataViewItems = []; me.dataViewItems = [];
if (me.options.keyMoveDirection=='vertical') if (me.options.keyMoveDirection=='vertical')
@ -301,9 +266,7 @@ define([
this.setElement(parentEl, false); this.setElement(parentEl, false);
this.cmpEl = $(this.template({ this.cmpEl = $(this.template({
groups: me.groups ? me.groups.toJSON() : null, groups: me.groups ? me.groups.toJSON() : null,
style: me.style, style: me.style
cls: me.cls,
options: me.options
})); }));
parentEl.html(this.cmpEl); parentEl.html(this.cmpEl);
@ -311,9 +274,7 @@ define([
this.cmpEl = me.$el || $(this.el); this.cmpEl = me.$el || $(this.el);
this.cmpEl.html(this.template({ this.cmpEl.html(this.template({
groups: me.groups ? me.groups.toJSON() : null, groups: me.groups ? me.groups.toJSON() : null,
style: me.style, style: me.style
cls: me.cls,
options: me.options
})); }));
} }
@ -340,8 +301,7 @@ define([
if (this.enableKeyEvents && this.parentMenu && this.handleSelect) { if (this.enableKeyEvents && this.parentMenu && this.handleSelect) {
if (!me.showLast) if (!me.showLast)
this.parentMenu.on('show:before', function(menu) { me.deselectAll(); }); this.parentMenu.on('show:before', function(menu) { me.deselectAll(); });
this.parentMenu.on('show:after', function(menu, e) { this.parentMenu.on('show:after', function(menu) {
if (e && (menu.el !== e.target)) return;
if (me.showLast) me.showLastSelected(); if (me.showLast) me.showLastSelected();
Common.NotificationCenter.trigger('dataview:focus'); Common.NotificationCenter.trigger('dataview:focus');
_.delay(function() { _.delay(function() {
@ -357,7 +317,7 @@ define([
this.scroller = new Common.UI.Scroller({ this.scroller = new Common.UI.Scroller({
el: $(this.el).find('.inner').addBack().filter('.inner'), el: $(this.el).find('.inner').addBack().filter('.inner'),
useKeyboard: this.enableKeyEvents && !this.handleSelect, useKeyboard: this.enableKeyEvents && !this.handleSelect,
minScrollbarLength : this.minScrollbarLength, minScrollbarLength : 40,
wheelSpeed: 10, wheelSpeed: 10,
alwaysVisibleY: this.scrollAlwaysVisible alwaysVisibleY: this.scrollAlwaysVisible
}); });
@ -398,9 +358,8 @@ define([
rec.set({selected: false}); rec.set({selected: false});
}); });
if (record) { if (record)
record.set({selected: true}); record.set({selected: true});
}
} else { } else {
if (record) if (record)
record.set({selected: !record.get('selected')}); record.set({selected: !record.get('selected')});
@ -436,10 +395,7 @@ define([
onAddItem: function(record, store, opts) { onAddItem: function(record, store, opts) {
var view = new Common.UI.DataViewItem({ var view = new Common.UI.DataViewItem({
template: this.itemTemplate, template: this.itemTemplate,
model: record, model: record
dataHint: this.itemDataHint,
dataHintDirection: this.itemDataHintDirection,
dataHintOffset: this.itemDataHintOffset
}); });
if (view) { if (view) {
@ -453,48 +409,23 @@ define([
} }
} }
var idx = _.indexOf(this.store.models, record);
if (innerEl) { if (innerEl) {
if (opts && (typeof opts.at==='number') && opts.at >= 0) { if (opts && opts.at == 0)
if (opts.at == 0) { innerEl.prepend(view.render().el); else
innerEl.prepend(view.render().el);
} else if (!(this.groups && this.groups.length > 0)) { // for dataview without groups
var innerDivs = innerEl.find('> div');
if (idx > 0)
$(innerDivs.get(idx - 1)).after(view.render().el);
else {
(innerDivs.length > 0) ? $(innerDivs[idx]).before(view.render().el) : innerEl.append(view.render().el);
}
} else
innerEl.append(view.render().el);
} else
innerEl.append(view.render().el); innerEl.append(view.render().el);
(this.dataViewItems.length<1) && innerEl.find('.empty-text').remove(); (this.dataViewItems.length<1) && innerEl.find('.empty-text').remove();
var idx = _.indexOf(this.store.models, record);
this.dataViewItems = this.dataViewItems.slice(0, idx).concat(view).concat(this.dataViewItems.slice(idx)); this.dataViewItems = this.dataViewItems.slice(0, idx).concat(view).concat(this.dataViewItems.slice(idx));
var me = this, if (record.get('tip')) {
view_el = $(view.el), var view_el = $(view.el);
tip = record.get('tip');
if (tip!==undefined && tip!==null) {
if (this.delayRenderTips)
view_el.one('mouseenter', function(){ // hide tooltip when mouse is over menu
view_el.attr('data-toggle', 'tooltip'); view_el.attr('data-toggle', 'tooltip');
view_el.tooltip({ view_el.tooltip({
title : record.get('tip'), // use actual tip, because it can be changed title : record.get('tip'),
placement : 'cursor', placement : 'cursor',
zIndex : me.tipZIndex zIndex : this.tipZIndex
}); });
view_el.mouseenter();
});
else {
view_el.attr('data-toggle', 'tooltip');
view_el.tooltip({
title : record.get('tip'), // use actual tip, because it can be changed
placement : 'cursor',
zIndex : me.tipZIndex
});
}
} }
this.listenTo(view, 'change', this.onChangeItem); this.listenTo(view, 'change', this.onChangeItem);
@ -522,9 +453,7 @@ define([
$(this.el).html(this.template({ $(this.el).html(this.template({
groups: this.groups ? this.groups.toJSON() : null, groups: this.groups ? this.groups.toJSON() : null,
style: this.style, style: this.style
cls: this.cls,
options: this.options
})); }));
if (!_.isUndefined(this.scroller)) { if (!_.isUndefined(this.scroller)) {
@ -541,16 +470,13 @@ define([
}, this); }, this);
this.dataViewItems = []; this.dataViewItems = [];
var me = this; this.store.each(this.onAddItem, this);
this.store.each(function(item){
me.onAddItem(item, me.store);
}, this);
if (this.allowScrollbar) { if (this.allowScrollbar) {
this.scroller = new Common.UI.Scroller({ this.scroller = new Common.UI.Scroller({
el: $(this.el).find('.inner').addBack().filter('.inner'), el: $(this.el).find('.inner').addBack().filter('.inner'),
useKeyboard: this.enableKeyEvents && !this.handleSelect, useKeyboard: this.enableKeyEvents && !this.handleSelect,
minScrollbarLength : this.minScrollbarLength, minScrollbarLength : 40,
wheelSpeed: 10, wheelSpeed: 10,
alwaysVisibleY: this.scrollAlwaysVisible alwaysVisibleY: this.scrollAlwaysVisible
}); });
@ -603,31 +529,15 @@ define([
window._event = e; // for FireFox only window._event = e; // for FireFox only
if (this.showLast) { if (this.showLast) this.selectRecord(record);
if (!this.delaySelect) {
this.selectRecord(record);
} else {
_.each(this.store.where({selected: true}), function(rec){
rec.set({selected: false});
});
if (record) {
setTimeout(_.bind(function () {
record.set({selected: true});
this.trigger('item:click', this, view, record, e);
}, this), 300);
}
}
}
this.lastSelectedRec = null; this.lastSelectedRec = null;
var tip = view.$el.data('bs.tooltip'); var tip = view.$el.data('bs.tooltip');
if (tip) (tip.tip()).remove(); if (tip) (tip.tip()).remove();
if (!this.isSuspendEvents) { if (!this.isSuspendEvents) {
if (!this.delaySelect) {
this.trigger('item:click', this, view, record, e); this.trigger('item:click', this, view, record, e);
} }
}
}, },
onDblClickItem: function(view, record, e) { onDblClickItem: function(view, record, e) {
@ -655,7 +565,7 @@ define([
} }
}, },
scrollToRecord: function (record, force) { scrollToRecord: function (record) {
if (!record) return; if (!record) return;
var innerEl = $(this.el).find('.inner'), var innerEl = $(this.el).find('.inner'),
inner_top = innerEl.offset().top, inner_top = innerEl.offset().top,
@ -665,8 +575,8 @@ define([
var div_top = div.offset().top, var div_top = div.offset().top,
div_first = $(this.dataViewItems[0].el), div_first = $(this.dataViewItems[0].el),
div_first_top = (div_first.length>0) ? div_first[0].clientTop : 0; div_first_top = (div_first.length>0) ? div_first[0].offsetTop : 0;
if (force || div_top < inner_top + div_first_top || div_top+div.outerHeight()*0.9 > inner_top + div_first_top + innerEl.height()) { if (div_top < inner_top + div_first_top || div_top+div.outerHeight() > inner_top + innerEl.height()) {
if (this.scroller && this.allowScrollbar) { if (this.scroller && this.allowScrollbar) {
this.scroller.scrollTop(innerEl.scrollTop() + div_top - inner_top - div_first_top, 0); this.scroller.scrollTop(innerEl.scrollTop() + div_top - inner_top - div_first_top, 0);
} else { } else {
@ -733,22 +643,12 @@ define([
idx = this._layoutParams.itemsIndexes[topIdx][leftIdx]; idx = this._layoutParams.itemsIndexes[topIdx][leftIdx];
} }
} else if (data.keyCode==Common.UI.Keys.UP) { } else if (data.keyCode==Common.UI.Keys.UP) {
if (topIdx==0 && this.outerMenu && this.outerMenu.menu) {
this.deselectAll(true);
this.outerMenu.menu.focusOuter && this.outerMenu.menu.focusOuter(data, this.outerMenu.index);
return;
} else
while (idx===undefined) { while (idx===undefined) {
topIdx--; topIdx--;
if (topIdx<0) topIdx = this._layoutParams.rows-1; if (topIdx<0) topIdx = this._layoutParams.rows-1;
idx = this._layoutParams.itemsIndexes[topIdx][leftIdx]; idx = this._layoutParams.itemsIndexes[topIdx][leftIdx];
} }
} else { } else {
if (topIdx==this._layoutParams.rows-1 && this.outerMenu && this.outerMenu.menu) {
this.deselectAll(true);
this.outerMenu.menu.focusOuter && this.outerMenu.menu.focusOuter(data, this.outerMenu.index);
return;
} else
while (idx===undefined) { while (idx===undefined) {
topIdx++; topIdx++;
if (topIdx>this._layoutParams.rows-1) topIdx = 0; if (topIdx>this._layoutParams.rows-1) topIdx = 0;
@ -765,8 +665,8 @@ define([
if (rec) { if (rec) {
this._fromKeyDown = true; this._fromKeyDown = true;
this.selectRecord(rec); this.selectRecord(rec);
this.scrollToRecord(rec);
this._fromKeyDown = false; this._fromKeyDown = false;
this.scrollToRecord(rec);
} }
} }
} else { } else {
@ -778,7 +678,7 @@ define([
if (this.enableKeyEvents && this.handleSelect) { if (this.enableKeyEvents && this.handleSelect) {
var el = $(this.el).find('.inner').addBack().filter('.inner'); var el = $(this.el).find('.inner').addBack().filter('.inner');
el.addClass('canfocused'); el.addClass('canfocused');
el.attr('tabindex', this.tabindex.toString()); el.attr('tabindex', '0');
el.on((this.parentMenu && this.useBSKeydown) ? 'dataview:keydown' : 'keydown', _.bind(this.onKeyDown, this)); el.on((this.parentMenu && this.useBSKeydown) ? 'dataview:keydown' : 'keydown', _.bind(this.onKeyDown, this));
} }
}, },
@ -794,7 +694,6 @@ define([
}, },
setDisabled: function(disabled) { setDisabled: function(disabled) {
disabled = !!disabled;
this.disabled = disabled; this.disabled = disabled;
$(this.el).find('.inner').addBack().filter('.inner').toggleClass('disabled', disabled); $(this.el).find('.inner').addBack().filter('.inner').toggleClass('disabled', disabled);
}, },
@ -805,12 +704,6 @@ define([
setEmptyText: function(emptyText) { setEmptyText: function(emptyText) {
this.emptyText = emptyText; this.emptyText = emptyText;
if (this.store.length < 1) {
var el = $(this.el).find('.inner').addBack().filter('.inner').find('.empty-text td');
if ( el.length>0 )
el.text(this.emptyText);
}
}, },
alignPosition: function() { alignPosition: function() {
@ -824,7 +717,7 @@ define([
paddings = parseInt(menuRoot.css('padding-top')) + parseInt(menuRoot.css('padding-bottom')), paddings = parseInt(menuRoot.css('padding-top')) + parseInt(menuRoot.css('padding-bottom')),
menuH = menuRoot.outerHeight(), menuH = menuRoot.outerHeight(),
top = parseInt(menuRoot.css('top')), top = parseInt(menuRoot.css('top')),
props = {minScrollbarLength : this.minScrollbarLength}; props = {minScrollbarLength : 40};
this.scrollAlwaysVisible && (props.alwaysVisibleY = this.scrollAlwaysVisible); this.scrollAlwaysVisible && (props.alwaysVisibleY = this.scrollAlwaysVisible);
if (top + menuH > docH ) { if (top + menuH > docH ) {
@ -846,14 +739,14 @@ define([
}; };
var el = $(this.dataViewItems[0].el), var el = $(this.dataViewItems[0].el),
itemW = el.outerWidth() + parseFloat(el.css('margin-left')) + parseFloat(el.css('margin-right')), itemW = el.outerWidth() + parseInt(el.css('margin-left')) + parseInt(el.css('margin-right')),
offsetLeft = this.$el.offset().left, offsetLeft = this.$el.offset().left,
offsetTop = el.offset().top, offsetTop = el.offset().top,
prevtop = -1, topIdx = 0, leftIdx = 0; prevtop = -1, topIdx = 0, leftIdx = 0;
for (var i=0; i<this.dataViewItems.length; i++) { for (var i=0; i<this.dataViewItems.length; i++) {
var top = $(this.dataViewItems[i].el).offset().top - offsetTop; var top = $(this.dataViewItems[i].el).offset().top - offsetTop;
leftIdx = Math.floor(($(this.dataViewItems[i].el).offset().left - offsetLeft)/itemW + 0.01); leftIdx = Math.floor(($(this.dataViewItems[i].el).offset().left - offsetLeft)/itemW);
if (top>prevtop) { if (top>prevtop) {
prevtop = top; prevtop = top;
this._layoutParams.itemsIndexes.push([]); this._layoutParams.itemsIndexes.push([]);
@ -870,26 +763,6 @@ define([
onResize: function() { onResize: function() {
this._layoutParams = undefined; this._layoutParams = undefined;
},
focus: function(index) {
$(this.el).find('.inner').addBack().filter('.inner').focus();
var rec;
if (typeof index == 'string') {
if (index == 'first') {
rec = this.selectByIndex(0, true);
} else if (index == 'last') {
if (this._layoutParams === undefined)
this.fillIndexesArray();
rec = this.selectByIndex(this._layoutParams.itemsIndexes[this._layoutParams.rows-1][0], true);
}
} else if (index !== undefined)
rec = this.selectByIndex(index, true);
this.scrollToRecord(rec);
},
focusInner: function(e) {
this.focus(e.keyCode == Common.UI.Keys.DOWN ? 'first' : 'last');
} }
}); });
@ -907,7 +780,7 @@ define([
'<div class="dataview inner" style="<%= style %>">', '<div class="dataview inner" style="<%= style %>">',
'<% _.each(items, function(item) { %>', '<% _.each(items, function(item) { %>',
'<% if (!item.id) item.id = Common.UI.getId(); %>', '<% if (!item.id) item.id = Common.UI.getId(); %>',
'<div class="item" <% if(!!item.tip) { %> data-toggle="tooltip" <% } %> data-hint="<%= item.dataHint %>" data-hint-direction="<%= item.dataHintDirection %>" data-hint-offset="<%= item.dataHintOffset %>"><%= itemTemplate(item) %></div>', '<div class="item" <% if(!!item.tip) { %> data-toggle="tooltip" <% } %> ><%= itemTemplate(item) %></div>',
'<% }) %>', '<% }) %>',
'</div>' '</div>'
].join('')), ].join('')),
@ -925,8 +798,6 @@ define([
me.useBSKeydown = me.options.useBSKeydown; // only with enableKeyEvents && parentMenu me.useBSKeydown = me.options.useBSKeydown; // only with enableKeyEvents && parentMenu
me.style = me.options.style || ''; me.style = me.options.style || '';
me.scrollAlwaysVisible = me.options.scrollAlwaysVisible || false; me.scrollAlwaysVisible = me.options.scrollAlwaysVisible || false;
me.tabindex = me.options.tabindex || 0;
if (me.parentMenu) if (me.parentMenu)
me.parentMenu.options.restoreHeight = (me.options.restoreHeight>0); me.parentMenu.options.restoreHeight = (me.options.restoreHeight>0);
me.rendered = false; me.rendered = false;
@ -957,8 +828,7 @@ define([
this.cmpEl.html(this.template({ this.cmpEl.html(this.template({
items: me.store.toJSON(), items: me.store.toJSON(),
itemTemplate: me.itemTemplate, itemTemplate: me.itemTemplate,
style: me.style, style: me.style
options: me.options
})); }));
} }
var modalParents = this.cmpEl.closest('.asc-window'); var modalParents = this.cmpEl.closest('.asc-window');
@ -995,7 +865,7 @@ define([
this.scroller = new Common.UI.Scroller({ this.scroller = new Common.UI.Scroller({
el: $(this.el).find('.inner').addBack().filter('.inner'), el: $(this.el).find('.inner').addBack().filter('.inner'),
useKeyboard: this.enableKeyEvents && !this.handleSelect, useKeyboard: this.enableKeyEvents && !this.handleSelect,
minScrollbarLength : this.minScrollbarLength, minScrollbarLength : 40,
wheelSpeed: 10, wheelSpeed: 10,
alwaysVisibleY: this.scrollAlwaysVisible alwaysVisibleY: this.scrollAlwaysVisible
}); });
@ -1070,7 +940,7 @@ define([
var template = _.template([ var template = _.template([
'<% _.each(items, function(item) { %>', '<% _.each(items, function(item) { %>',
'<% if (!item.id) item.id = Common.UI.getId(); %>', '<% if (!item.id) item.id = Common.UI.getId(); %>',
'<div class="item" <% if(!!item.tip) { %> data-toggle="tooltip" <% } %> data-hint="<%= item.dataHint %>" data-hint-direction="<%= item.dataHintDirection %>" data-hint-offset="<%= item.dataHintOffset %>"><%= itemTemplate(item) %></div>', '<div class="item" <% if(!!item.tip) { %> data-toggle="tooltip" <% } %> ><%= itemTemplate(item) %></div>',
'<% }) %>' '<% }) %>'
].join('')); ].join(''));
this.cmpEl && this.cmpEl.find('.inner').html(template({ this.cmpEl && this.cmpEl.find('.inner').html(template({
@ -1087,7 +957,7 @@ define([
this.scroller = new Common.UI.Scroller({ this.scroller = new Common.UI.Scroller({
el: $(this.el).find('.inner').addBack().filter('.inner'), el: $(this.el).find('.inner').addBack().filter('.inner'),
useKeyboard: this.enableKeyEvents && !this.handleSelect, useKeyboard: this.enableKeyEvents && !this.handleSelect,
minScrollbarLength : this.minScrollbarLength, minScrollbarLength : 40,
wheelSpeed: 10, wheelSpeed: 10,
alwaysVisibleY: this.scrollAlwaysVisible alwaysVisibleY: this.scrollAlwaysVisible
}); });
@ -1172,30 +1042,21 @@ define([
if (data.keyCode==Common.UI.Keys.RETURN) { if (data.keyCode==Common.UI.Keys.RETURN) {
if (this.selectedBeforeHideRec) // only for ComboDataView menuPicker if (this.selectedBeforeHideRec) // only for ComboDataView menuPicker
rec = this.selectedBeforeHideRec; rec = this.selectedBeforeHideRec;
if (this.canAddRecents) // only for DaraViewShape
this.addRecentItem(rec);
this.trigger('item:click', this, this, rec, e); this.trigger('item:click', this, this, rec, e);
if (this.parentMenu) if (this.parentMenu)
this.parentMenu.hide(); this.parentMenu.hide();
} else { } else {
var idx = _.indexOf(this.store.models, rec); var idx = _.indexOf(this.store.models, rec);
if (idx<0) { if (idx<0) {
function getFirstItemIndex() {
var first = 0;
while(!this.dataViewItems[first].el.is(':visible')) {
first++;
}
return first;
}
if (data.keyCode==Common.UI.Keys.LEFT) { if (data.keyCode==Common.UI.Keys.LEFT) {
var target = $(e.target).closest('.dropdown-submenu.over'); var target = $(e.target).closest('.dropdown-submenu.over');
if (target.length>0) { if (target.length>0) {
target.removeClass('over'); target.removeClass('over');
target.find('> a').focus(); target.find('> a').focus();
} else } else
idx = getFirstItemIndex.call(this); idx = 0;
} else } else
idx = getFirstItemIndex.call(this); idx = 0;
} else if (this.options.keyMoveDirection == 'both') { } else if (this.options.keyMoveDirection == 'both') {
if (this._layoutParams === undefined) if (this._layoutParams === undefined)
this.fillIndexesArray(); this.fillIndexesArray();
@ -1224,22 +1085,12 @@ define([
idx = this._layoutParams.itemsIndexes[topIdx][leftIdx]; idx = this._layoutParams.itemsIndexes[topIdx][leftIdx];
} }
} else if (data.keyCode==Common.UI.Keys.UP) { } else if (data.keyCode==Common.UI.Keys.UP) {
if (topIdx==0 && this.outerMenu && this.outerMenu.menu) {
this.deselectAll(true);
this.outerMenu.menu.focusOuter && this.outerMenu.menu.focusOuter(data, this.outerMenu.index);
return;
} else
while (idx===undefined) { while (idx===undefined) {
topIdx--; topIdx--;
if (topIdx<0) topIdx = this._layoutParams.rows-1; if (topIdx<0) topIdx = this._layoutParams.rows-1;
idx = this._layoutParams.itemsIndexes[topIdx][leftIdx]; idx = this._layoutParams.itemsIndexes[topIdx][leftIdx];
} }
} else { } else {
if (topIdx==this._layoutParams.rows-1 && this.outerMenu && this.outerMenu.menu) {
this.deselectAll(true);
this.outerMenu.menu.focusOuter && this.outerMenu.menu.focusOuter(data, this.outerMenu.index);
return;
} else
while (idx===undefined) { while (idx===undefined) {
topIdx++; topIdx++;
if (topIdx>this._layoutParams.rows-1) topIdx = 0; if (topIdx>this._layoutParams.rows-1) topIdx = 0;
@ -1256,8 +1107,8 @@ define([
if (rec) { if (rec) {
this._fromKeyDown = true; this._fromKeyDown = true;
this.selectRecord(rec); this.selectRecord(rec);
this.scrollToRecord(rec);
this._fromKeyDown = false; this._fromKeyDown = false;
this.scrollToRecord(rec);
} }
} }
} else { } else {
@ -1269,13 +1120,12 @@ define([
if (this.enableKeyEvents && this.handleSelect) { if (this.enableKeyEvents && this.handleSelect) {
var el = $(this.el).find('.inner').addBack().filter('.inner'); var el = $(this.el).find('.inner').addBack().filter('.inner');
el.addClass('canfocused'); el.addClass('canfocused');
el.attr('tabindex', this.tabindex.toString()); el.attr('tabindex', '0');
el.on((this.parentMenu && this.useBSKeydown) ? 'dataview:keydown' : 'keydown', _.bind(this.onKeyDown, this)); el.on((this.parentMenu && this.useBSKeydown) ? 'dataview:keydown' : 'keydown', _.bind(this.onKeyDown, this));
} }
}, },
setDisabled: function(disabled) { setDisabled: function(disabled) {
disabled = !!disabled;
this.disabled = disabled; this.disabled = disabled;
$(this.el).find('.inner').addBack().filter('.inner').toggleClass('disabled', disabled); $(this.el).find('.inner').addBack().filter('.inner').toggleClass('disabled', disabled);
}, },
@ -1295,7 +1145,7 @@ define([
paddings = parseInt(menuRoot.css('padding-top')) + parseInt(menuRoot.css('padding-bottom')), paddings = parseInt(menuRoot.css('padding-top')) + parseInt(menuRoot.css('padding-bottom')),
menuH = menuRoot.outerHeight(), menuH = menuRoot.outerHeight(),
top = parseInt(menuRoot.css('top')), top = parseInt(menuRoot.css('top')),
props = {minScrollbarLength : this.minScrollbarLength}; props = {minScrollbarLength : 40};
this.scrollAlwaysVisible && (props.alwaysVisibleY = this.scrollAlwaysVisible); this.scrollAlwaysVisible && (props.alwaysVisibleY = this.scrollAlwaysVisible);
if (top + menuH > docH ) { if (top + menuH > docH ) {
@ -1317,7 +1167,7 @@ define([
}; };
var el = this.dataViewItems[0].el, var el = this.dataViewItems[0].el,
itemW = el.outerWidth() + parseFloat(el.css('margin-left')) + parseFloat(el.css('margin-right')), itemW = el.outerWidth() + parseInt(el.css('margin-left')) + parseInt(el.css('margin-right')),
offsetLeft = this.$el.offset().left, offsetLeft = this.$el.offset().left,
offsetTop = el.offset().top, offsetTop = el.offset().top,
prevtop = -1, topIdx = 0, leftIdx = 0; prevtop = -1, topIdx = 0, leftIdx = 0;
@ -1342,10 +1192,6 @@ define([
onResize: function() { onResize: function() {
this._layoutParams = undefined; this._layoutParams = undefined;
},
focus: function() {
this.cmpEl && this.cmpEl.find('.dataview').focus();
} }
}); });
@ -1361,397 +1207,4 @@ define([
} }
}, 100); }, 100);
}); });
Common.UI.DataViewShape = Common.UI.DataViewSimple.extend(_.extend({
template: _.template([
'<div class="dataview inner" style="<%= style %>">',
'<% _.each(options.groupsWithRecent, function(group, index) { %>',
'<div class="grouped-data <% if (index === 0) { %> recent-group <% } %> " id="<%= group.id %>" >',
'<% if (!_.isEmpty(group.groupName)) { %>',
'<div class="group-description">',
'<span><%= group.groupName %></span>',
'</div>',
'<% } %>',
'<div class="group-items-container <% if (index === 0) { %> recent-items <% } %>">',
'<% _.each(group.groupStore.toJSON(), function(item, index) { %>',
'<% if (!item.id) item.id = Common.UI.getId(); %>',
'<div class="item" data-index="<%= index %>"<% if(!!item.tip) { %> data-toggle="tooltip" <% } %> ><%= itemTemplate(item) %></div>',
'<% }); %>',
'</div>',
'</div>',
'<% }); %>',
'</div>'
].join('')),
initialize : function(options) {
var me = this;
this.canAddRecents = true;
this._state = {
hideTextRect: options.hideTextRect,
hideLines: options.hideLines
}
var filter = Common.localStorage.getKeysFilter();
this.appPrefix = (filter && filter.length) ? filter.split(',')[0] : '';
me.groups = options.groups.toJSON();
// add recent shapes to store
var recentStore = new Common.UI.DataViewGroupStore,
recentArr = options.recentShapes || [],
cols = (recentArr.length) > 18 ? 7 : 6,
height = Math.ceil(recentArr.length/cols) * 35 + 3,
width = 30 * cols;
me.recentShapes = recentArr;
// check lang
if (me.recentShapes.length > 0) {
var isTranslated = _.findWhere(me.groups, {groupName: me.recentShapes[0].groupName});
if (!isTranslated) {
for (var r = 0; r < me.recentShapes.length; r++) {
var type = me.recentShapes[r].data.shapeType,
record;
for (var g = 0; g < me.groups.length; g++) {
var store = me.groups[g].groupStore,
groupName = me.groups[g].groupName;
for (var i = 0; i < store.length; i++) {
if (store.at(i).get('data').shapeType === type) {
record = store.at(i).toJSON();
me.recentShapes[r] = {
data: record.data,
tip: record.tip,
allowSelected: record.allowSelected,
selected: false,
groupName: groupName
};
break;
}
}
if (record) {
record = undefined;
break;
}
}
}
Common.localStorage.setItem(this.appPrefix + 'recent-shapes', JSON.stringify(me.recentShapes));
}
}
// Add default recent
if (me.recentShapes.length < 12) {
var count = 12 - me.recentShapes.length,
defaultArr = [];
var addItem = function (rec, groupName) {
var item = rec.toJSON(),
model = {
data: item.data,
tip: item.tip,
allowSelected: item.allowSelected,
selected: false,
groupName: groupName
};
defaultArr.push(model);
};
for (var i = 0; i < me.groups.length && count > 0; i++) {
var groupStore = me.groups[i].groupStore,
groupName = me.groups[i].groupName;
if (i === 0) {
addItem(groupStore.at(1), groupName);
count--;
if (count > 0) {
addItem(groupStore.at(2), groupName);
count--;
}
} else if (i !== 3 && i !== 6 && i !== 7) {
addItem(groupStore.at(0), groupName);
count--;
if (count > 0) {
addItem(groupStore.at(1), groupName);
count--;
}
}
}
me.recentShapes = me.recentShapes.concat(defaultArr);
}
recentStore.add(me.recentShapes);
me.groups.unshift({
groupName : options.textRecentlyUsed,
groupStore : recentStore,
groupWidth : width,
groupHeight : height
});
me.options.groupsWithRecent = me.groups;
var store = new Common.UI.DataViewStore();
_.each(me.groups, function (group, index) {
var models = group.groupStore.models;
if (index > 0) {
for (var i = 0; i < models.length; i++) {
models[i].set({groupName: group.groupName});
}
}
store.add(models);
});
options.store = store;
Common.UI.DataViewSimple.prototype.initialize.call(this, options);
me.parentMenu.on('show:before', function() { me.updateRecents(); });
if (me._state.hideLines) {
me.hideLinesGroup();
}
},
onAfterShowMenu: function(e) {
var me = this,
updateHideRect = false;
if (!me.dataViewItems) {
me.dataViewItems = [];
_.each(me.cmpEl.find('div.grouped-data'), function (group, indexGroup) {
_.each($(group).find('div.item'), function (item, index) {
var $item = $(item),
rec = me.groups[indexGroup].groupStore.at(index);
me.dataViewItems.push({el: $item, groupIndex: indexGroup, index: index});
var tip = rec.get('tip');
if (tip) {
$item.one('mouseenter', function(){ // hide tooltip when mouse is over menu
$item.attr('data-toggle', 'tooltip');
$item.tooltip({
title : tip,
placement : 'cursor',
zIndex : me.tipZIndex
});
$item.mouseenter();
});
}
});
});
updateHideRect = true;
}
if (me.updateDataViewItems && me.cmpEl.is(':visible')) {
// add recent item in dataViewItems
var recent = _.where(me.dataViewItems, {groupIndex: 0});
var len = recent ? recent.length : 0;
for (var i = 0; i < len; i++) {
var tip = me.dataViewItems[i].el.data('bs.tooltip');
if (tip) {
if (tip.dontShow===undefined)
tip.dontShow = true;
(tip.tip()).remove();
}
}
me.dataViewItems = me.dataViewItems.slice(len);
var recentViewItems = [];
_.each(me.cmpEl.find('.recent-group div.item'), function (item, index) {
var $item = $(item),
rec = me.recentShapes[index];
recentViewItems.push({el: $item, groupIndex: 0, index: index});
var tip = rec.tip;
if (tip) {
$item.one('mouseenter', function(){ // hide tooltip when mouse is over menu
$item.attr('data-toggle', 'tooltip');
$item.tooltip({
title: tip,
placement: 'cursor',
zIndex : me.tipZIndex
});
$item.mouseenter();
});
}
});
me.dataViewItems = recentViewItems.concat(me.dataViewItems);
if (me.recentShapes.length === 1) {
$('.recent-group').show();
}
me.updateDataViewItems = false;
updateHideRect = true;
}
if (this._state.hideLines) {
me.hideLines();
}
if (updateHideRect) {
me.hideTextRect(me._state.hideTextRect);
}
me.fillIndexesArray();
},
onClickItem: function(e) {
if ( this.disabled ) return;
window._event = e; // for FireFox only
var groupIndex = $(e.currentTarget).closest('div.grouped-data').index(),
itemIndex = $(e.currentTarget).closest('div.item').data('index');
var index = _.findIndex(this.dataViewItems, function (item) {
return (item.groupIndex === groupIndex && item.index === itemIndex);
});
var record = (index>=0) ? this.store.at(index) : null,
view = (index>=0) ? this.dataViewItems[index] : null;
if (!record || !view) return;
record.set({selected: true});
var tip = view.el.data('bs.tooltip');
if (tip) (tip.tip()).remove();
if (!this.isSuspendEvents) {
this.trigger('item:click', this, view.el, record, e);
}
this.addRecentItem(record);
},
addRecentItem: function (rec) {
var me = this,
exist = false,
type = rec.get('data').shapeType,
groupName = rec.get('groupName');
for (var i = 0; i < me.recentShapes.length; i++) {
if (me.recentShapes[i].data.shapeType === type) {
exist = true;
break;
}
}
if (exist) return;
var item = rec.toJSON(),
model = {
data: item.data,
tip: item.tip,
allowSelected: item.allowSelected,
selected: false,
groupName: groupName
};
var arr = [model].concat(me.recentShapes.slice(0, 11));
Common.localStorage.setItem(this.appPrefix + 'recent-shapes', JSON.stringify(arr));
me.recentShapes = undefined;
},
updateRecents: function () {
var me = this,
recents = Common.localStorage.getItem(this.appPrefix + 'recent-shapes');
recents = recents ? JSON.parse(recents) : [];
var diff = false;
if (me.recentShapes) {
for (var i = 0; i < recents.length; i++) {
if (!me.recentShapes[i] || (me.recentShapes[i] && recents[i].tip !== me.recentShapes[i].tip)) {
diff = true;
}
}
} else {
diff = true;
}
if (recents.length > 0 && diff) {
me.recentShapes = recents;
var resentsStore = new Common.UI.DataViewStore();
_.each(me.recentShapes, function (recent) {
var model = {
data: {shapeType: recent.data.shapeType},
tip: recent.tip,
allowSelected: recent.allowSelected,
selected: recent.selected,
groupName: recent.groupName
};
resentsStore.push(model);
});
me.groups[0].groupStore = resentsStore;
var store = new Common.UI.DataViewStore();
_.each(me.groups, function (group) {
store.add(group.groupStore.models);
});
me.store = store;
var template = _.template([
'<% _.each(items, function(item, index) { %>',
'<% if (!item.id) item.id = Common.UI.getId(); %>',
'<div class="item" data-index="<%= index %>"<% if(!!item.tip) { %> data-toggle="tooltip" <% } %> ><%= itemTemplate(item) %></div>',
'<% }) %>'
].join(''));
me.cmpEl && me.cmpEl.find('.recent-items').html(template({
items: me.recentShapes,
itemTemplate: this.itemTemplate,
style : this.style
}));
me.updateDataViewItems = true;
}
},
fillIndexesArray: function() {
if (this.dataViewItems.length<=0) return;
this._layoutParams = {
itemsIndexes: [],
columns: 0,
rows: 0
};
var el = this.dataViewItems[0].el,
first = 0;
while (!this.dataViewItems[first].el.is(":visible")) { // if first elem is hidden
first++;
el = this.dataViewItems[first].el;
}
var itemW = el.outerWidth() + parseInt(el.css('margin-left')) + parseInt(el.css('margin-right')),
offsetLeft = this.$el.offset().left,
offsetTop = el.offset().top,
prevtop = -1, topIdx = 0, leftIdx = first;
for (var i=0; i<this.dataViewItems.length; i++) {
var item = this.dataViewItems[i];
if (item.el.is(":visible")) {
var top = item.el.offset().top - offsetTop;
leftIdx = Math.floor((item.el.offset().left - offsetLeft) / itemW);
if (top > prevtop) {
prevtop = top;
this._layoutParams.itemsIndexes.push([]);
topIdx = this._layoutParams.itemsIndexes.length - 1;
}
this._layoutParams.itemsIndexes[topIdx][leftIdx] = i;
item.topIdx = topIdx;
item.leftIdx = leftIdx;
if (this._layoutParams.columns < leftIdx) this._layoutParams.columns = leftIdx;
} else {
item.topIdx = -1;
item.leftIdx = -1;
}
}
this._layoutParams.rows = this._layoutParams.itemsIndexes.length;
this._layoutParams.columns++;
},
hideTextRect: function (hide) {
var me = this;
this.store.each(function(item, index){
if (item.get('data').shapeType === 'textRect') {
me.dataViewItems[index].el[hide ? 'addClass' : 'removeClass']('hidden');
}
}, this);
this._state.hideTextRect = hide;
},
hideLinesGroup: function () {
$(this.cmpEl.find('div.grouped-data')[9]).hide();
},
hideLines: function () {
var me = this;
this.store.each(function(item, index){
if (item.get('groupName') === 'Lines') {
var el = me.dataViewItems[index].el;
if (el.is(':visible')) {
el.addClass('hidden');
}
}
}, this);
}
}));
}); });

View file

@ -47,9 +47,34 @@ define([
'use strict'; 'use strict';
Common.UI.DimensionPicker = Common.UI.BaseView.extend((function(){ Common.UI.DimensionPicker = Common.UI.BaseView.extend((function(){
var me,
rootEl,
areaMouseCatcher,
areaUnHighLighted,
areaHighLighted,
areaStatus,
curColumns = 0,
curRows = 0;
var onMouseMove = function(event){
me.setTableSize(
Math.ceil((event.offsetX === undefined ? event.originalEvent.layerX : event.offsetX*Common.Utils.zoom()) / me.itemSize),
Math.ceil((event.offsetY === undefined ? event.originalEvent.layerY : event.offsetY*Common.Utils.zoom()) / me.itemSize),
event
);
};
var onMouseLeave = function(event){
me.setTableSize(0, 0, event);
};
var onHighLightedMouseClick = function(e){
me.trigger('select', me, curColumns, curRows, e);
};
return { return {
options: { options: {
itemSize : 20, itemSize : 18,
minRows : 5, minRows : 5,
minColumns : 5, minColumns : 5,
maxRows : 20, maxRows : 20,
@ -70,13 +95,9 @@ define([
initialize : function(options) { initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options); Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this; me = this;
this.render(); rootEl = me.$el || $(this.el);
this.cmpEl = me.$el || $(this.el);
var rootEl = this.cmpEl;
me.itemSize = me.options.itemSize; me.itemSize = me.options.itemSize;
me.minRows = me.options.minRows; me.minRows = me.options.minRows;
@ -84,48 +105,31 @@ define([
me.maxRows = me.options.maxRows; me.maxRows = me.options.maxRows;
me.maxColumns = me.options.maxColumns; me.maxColumns = me.options.maxColumns;
me.curColumns = 0; this.render();
me.curRows = 0;
var onMouseMove = function(event){
me.setTableSize(
Math.ceil((event.offsetX === undefined ? event.originalEvent.layerX : event.offsetX*Common.Utils.zoom()) / me.itemSize),
Math.ceil((event.offsetY === undefined ? event.originalEvent.layerY : event.offsetY*Common.Utils.zoom()) / me.itemSize),
event
);
};
var onMouseLeave = function(event){
me.setTableSize(0, 0, event);
};
var onHighLightedMouseClick = function(e){
me.trigger('select', me, me.curColumns, me.curRows, e);
};
if (rootEl){ if (rootEl){
var areaMouseCatcher = rootEl.find('.dimension-picker-mousecatcher'); areaMouseCatcher = rootEl.find('.dimension-picker-mousecatcher');
me.areaUnHighLighted = rootEl.find('.dimension-picker-unhighlighted'); areaUnHighLighted = rootEl.find('.dimension-picker-unhighlighted');
me.areaHighLighted = rootEl.find('.dimension-picker-highlighted'); areaHighLighted = rootEl.find('.dimension-picker-highlighted');
me.areaStatus = rootEl.find('.dimension-picker-status'); areaStatus = rootEl.find('.dimension-picker-status');
rootEl.css({width: me.minColumns + 'em'}); rootEl.css({width: me.minColumns + 'em'});
areaMouseCatcher.css('z-index', 1); areaMouseCatcher.css('z-index', 1);
areaMouseCatcher.width(me.maxColumns + 'em').height(me.maxRows + 'em'); areaMouseCatcher.width(me.maxColumns + 'em').height(me.maxRows + 'em');
me.areaUnHighLighted.width(me.minColumns + 'em').height(me.minRows + 'em'); areaUnHighLighted.width(me.minColumns + 'em').height(me.minRows + 'em');
me.areaStatus.html(me.curColumns + ' x ' + me.curRows); areaStatus.html(curColumns + ' x ' + curRows);
me.areaStatus.width(me.areaUnHighLighted.width()); areaStatus.width(areaUnHighLighted.width());
}
areaMouseCatcher.on('mousemove', onMouseMove); areaMouseCatcher.on('mousemove', onMouseMove);
me.areaHighLighted.on('mousemove', onMouseMove); areaHighLighted.on('mousemove', onMouseMove);
me.areaUnHighLighted.on('mousemove', onMouseMove); areaUnHighLighted.on('mousemove', onMouseMove);
areaMouseCatcher.on('mouseleave', onMouseLeave); areaMouseCatcher.on('mouseleave', onMouseLeave);
me.areaHighLighted.on('mouseleave', onMouseLeave); areaHighLighted.on('mouseleave', onMouseLeave);
me.areaUnHighLighted.on('mouseleave', onMouseLeave); areaUnHighLighted.on('mouseleave', onMouseLeave);
areaMouseCatcher.on('click', onHighLightedMouseClick); areaMouseCatcher.on('click', onHighLightedMouseClick);
me.areaHighLighted.on('click', onHighLightedMouseClick); areaHighLighted.on('click', onHighLightedMouseClick);
me.areaUnHighLighted.on('click', onHighLightedMouseClick); areaUnHighLighted.on('click', onHighLightedMouseClick);
}
}, },
render: function() { render: function() {
@ -138,38 +142,38 @@ define([
if (columns > this.maxColumns) columns = this.maxColumns; if (columns > this.maxColumns) columns = this.maxColumns;
if (rows > this.maxRows) rows = this.maxRows; if (rows > this.maxRows) rows = this.maxRows;
if (this.curColumns != columns || this.curRows != rows){ if (curColumns != columns || curRows != rows){
this.curColumns = columns; curColumns = columns;
this.curRows = rows; curRows = rows;
this.areaHighLighted.width(this.curColumns + 'em').height(this.curRows + 'em'); areaHighLighted.width(curColumns + 'em').height(curRows + 'em');
this.areaUnHighLighted.width( areaUnHighLighted.width(
((this.curColumns < this.minColumns) ((curColumns < me.minColumns)
? this.minColumns ? me.minColumns
: ((this.curColumns + 1 > this.maxColumns) : ((curColumns + 1 > me.maxColumns)
? this.maxColumns ? me.maxColumns
: this.curColumns + 1)) + 'em' : curColumns + 1)) + 'em'
).height(((this.curRows < this.minRows) ).height(((curRows < me.minRows)
? this.minRows ? me.minRows
: ((this.curRows + 1 > this.maxRows) : ((curRows + 1 > me.maxRows)
? this.maxRows ? me.maxRows
: this.curRows + 1)) + 'em' : curRows + 1)) + 'em'
); );
this.cmpEl.width(this.areaUnHighLighted.width()); rootEl.width(areaUnHighLighted.width());
this.areaStatus.html(this.curColumns + ' x ' + this.curRows); areaStatus.html(curColumns + ' x ' + curRows);
this.areaStatus.width(this.areaUnHighLighted.width()); areaStatus.width(areaUnHighLighted.width());
this.trigger('change', this, this.curColumns, this.curRows, event); me.trigger('change', me, curColumns, curRows, event);
} }
}, },
getColumnsCount: function() { getColumnsCount: function() {
return this.curColumns; return curColumns;
}, },
getRowsCount: function() { getRowsCount: function() {
return this.curRows; return curRows;
} }
} }
})()) })())

View file

@ -55,7 +55,7 @@ define([
'<% } %>'+ '<% } %>'+
'<div>'+ '<div>'+
'<div class="cnt-hb img-colorpicker">'+ '<div class="cnt-hb img-colorpicker">'+
'<div class="cnt-hb-arrow"></div>'+ '<div class="cnt-hb-arrow img-colorpicker"></div>'+
'</div>'+ '</div>'+
'<% if (this.changeSaturation) { %>'+ '<% if (this.changeSaturation) { %>'+
'<div class="cnt-root">'+ '<div class="cnt-root">'+
@ -106,7 +106,6 @@ define([
refreshUI(); refreshUI();
me.trigger('changecolor', me, me.color); me.trigger('changecolor', me, me.color);
}; };
var refreshUI = function(){ var refreshUI = function(){
@ -126,7 +125,8 @@ define([
previewColorText[0].innerHTML = (me.color == 'transparent') ? me.textNoColor : me.color.toUpperCase(); previewColorText[0].innerHTML = (me.color == 'transparent') ? me.textNoColor : me.color.toUpperCase();
if (arrowSatBrightness.length>0 && arrowHue.length>0) { if (arrowSatBrightness.length>0 && arrowHue.length>0) {
arrowSatBrightness.css({'left': saturationVal + '%', 'top': 100 - brightnessVal + '%', 'background-color' : me.color}); arrowSatBrightness.css('left', saturationVal + '%');
arrowSatBrightness.css('top', 100 - brightnessVal + '%');
arrowHue.css('top', parseInt(hueVal * 100 / 360.0) + '%'); arrowHue.css('top', parseInt(hueVal * 100 / 360.0) + '%');
} }
}; };

View file

@ -53,8 +53,7 @@ if (Common === undefined)
define([ define([
'common/main/lib/component/BaseView', 'common/main/lib/component/BaseView',
'common/main/lib/component/Tooltip', 'common/main/lib/component/Tooltip'
'common/main/lib/component/Button'
], function () { 'use strict'; ], function () { 'use strict';
Common.UI.InputField = Common.UI.BaseView.extend((function() { Common.UI.InputField = Common.UI.BaseView.extend((function() {
@ -86,11 +85,9 @@ define([
'spellcheck="<%= spellcheck %>" ', 'spellcheck="<%= spellcheck %>" ',
'class="form-control <%= cls %>" ', 'class="form-control <%= cls %>" ',
'placeholder="<%= placeHolder %>" ', 'placeholder="<%= placeHolder %>" ',
'data-hint="<%= dataHint %>"', 'value="<%= value %>"',
'data-hint-direction="<%= dataHintDirection %>"',
'data-hint-offset="<%= dataHintOffset %>"',
'>', '>',
'<span class="input-error"></span>', '<span class="input-error"/>',
'</div>' '</div>'
].join('')), ].join('')),
@ -137,9 +134,6 @@ define([
name : this.name, name : this.name,
placeHolder : this.placeHolder, placeHolder : this.placeHolder,
spellcheck : this.spellcheck, spellcheck : this.spellcheck,
dataHint : this.options.dataHint,
dataHintDirection: this.options.dataHintDirection,
dataHintOffset: this.options.dataHintOffset,
scope : me scope : me
})); }));
@ -182,9 +176,6 @@ define([
me.rendered = true; me.rendered = true;
if (me.value)
me.setValue(me.value);
return this; return this;
}, },
@ -254,10 +245,6 @@ define([
if (e.keyCode === Common.UI.Keys.RETURN) if (e.keyCode === Common.UI.Keys.RETURN)
this._doChange(e); this._doChange(e);
if (e.keyCode == Common.UI.Keys.ESC)
this.setValue(this.value);
if (e.keyCode==Common.UI.Keys.RETURN || e.keyCode==Common.UI.Keys.ESC)
this.trigger('inputleave', this);
}, },
onKeyUp: function(e) { onKeyUp: function(e) {
@ -288,7 +275,6 @@ define([
}, },
setDisabled: function(disabled) { setDisabled: function(disabled) {
disabled = !!disabled;
this.disabled = disabled; this.disabled = disabled;
$(this.el).toggleClass('disabled', disabled); $(this.el).toggleClass('disabled', disabled);
disabled disabled
@ -313,7 +299,7 @@ define([
}, },
focus: function() { focus: function() {
this._input && this._input.focus(); this._input.focus();
}, },
checkValidate: function() { checkValidate: function() {
@ -367,10 +353,10 @@ define([
return true; return true;
}, },
showError: function(errors, isWarning) { showError: function(errors) {
var me = this; var me = this;
if (!_.isEmpty(errors)) { if (!_.isEmpty(errors)) {
me.cmpEl.addClass(isWarning ? 'warning' : 'error'); me.cmpEl.addClass('error');
var errorBadge = me.cmpEl.find('.input-error'), var errorBadge = me.cmpEl.find('.input-error'),
modalParents = errorBadge.closest('.asc-window'), modalParents = errorBadge.closest('.asc-window'),
@ -389,336 +375,7 @@ define([
} }
} else { } else {
me.cmpEl.removeClass('error'); me.cmpEl.removeClass('error');
me.cmpEl.removeClass('warning');
} }
},
showWarning: function(errors) {
this.showError(errors, true);
}
}
})());
Common.UI.InputFieldBtn = Common.UI.InputField.extend((function() {
return {
options : {
id : null,
cls : '',
style : '',
value : '',
type : 'text',
name : '',
validation : null,
allowBlank : true,
placeHolder : '',
blankError : null,
spellcheck : false,
maskExp : '',
validateOnChange: false,
validateOnBlur: true,
disabled: false,
editable: true,
iconCls: 'toolbar__icon btn-select-range',
btnHint: ''
},
template: _.template([
'<div class="input-field input-field-btn" style="<%= style %>">',
'<input ',
'type=<%= type %> ',
'name="<%= name %>" ',
'spellcheck="<%= spellcheck %>" ',
'class="form-control <%= cls %>" ',
'placeholder="<%= placeHolder %>" ',
'value="<%= value %>"',
'data-hint="<%= dataHint %>"',
'data-hint-offset="<%= dataHintOffset %>"',
'data-hint-direction="<%= dataHintDirection %>"',
'>',
'<span class="input-error"></span>',
'<div class="select-button">' +
'</div>',
'</div>'
].join('')),
render : function(parentEl) {
var me = this;
if (!me.rendered) {
this.cmpEl = $(this.template({
id : this.id,
cls : this.cls,
style : this.style,
value : this.value,
type : this.type,
name : this.name,
placeHolder : this.placeHolder,
spellcheck : this.spellcheck,
scope : me,
dataHint : this.options.dataHint,
dataHintOffset: this.options.dataHintOffset,
dataHintDirection: this.options.dataHintDirection
}));
if (parentEl) {
this.setElement(parentEl, false);
parentEl.html(this.cmpEl);
} else {
this.$el.html(this.cmpEl);
}
} else {
this.cmpEl = this.$el;
}
if (!me.rendered) {
var el = this.cmpEl;
this._button = new Common.UI.Button({
cls: 'btn-toolbar',
iconCls: this.options.iconCls,
hint: this.options.btnHint || '',
menu: this.options.menu
});
this._button.render(this.cmpEl.find('.select-button'));
this._button.on('click', _.bind(this.onButtonClick, this));
this._input = this.cmpEl.find('input').addBack().filter('input');
if (this.editable) {
this._input.on('blur', _.bind(this.onInputChanged, this));
this._input.on('keypress', _.bind(this.onKeyPress, this));
this._input.on('keydown', _.bind(this.onKeyDown, this));
this._input.on('keyup', _.bind(this.onKeyUp, this));
if (this.validateOnChange) this._input.on('input', _.bind(this.onInputChanging, this));
if (this.maxLength) this._input.attr('maxlength', this.maxLength);
}
this.setEditable(this.editable);
if (this.disabled)
this.setDisabled(this.disabled);
if (this._input.closest('.asc-window').length>0)
var onModalClose = function() {
var errorTip = el.find('.input-error').data('bs.tooltip');
if (errorTip) errorTip.tip().remove();
Common.NotificationCenter.off({'modal:close': onModalClose});
};
Common.NotificationCenter.on({'modal:close': onModalClose});
}
me.rendered = true;
if (me.value)
me.setValue(me.value);
return this;
},
onButtonClick: function(btn, e) {
this.trigger('button:click', this, e);
},
setDisabled: function(disabled) {
disabled = !!disabled;
this.disabled = disabled;
$(this.el).toggleClass('disabled', disabled);
disabled
? this._input.attr('disabled', true)
: this._input.removeAttr('disabled');
this._button.setDisabled(disabled);
},
setBtnDisabled: function(disabled) {
this._button.setDisabled(disabled);
},
updateBtnHint: function(hint) {
this.options.hint = hint;
if (!this.rendered) return;
this._button.updateHint(this.options.hint);
}
}
})());
Common.UI.InputFieldBtnPassword = Common.UI.InputFieldBtn.extend(_.extend((function() {
return {
options: {
id: null,
cls: '',
style: '',
value: '',
name: '',
type: 'password',
validation: null,
allowBlank: true,
placeHolder: '',
blankError: null,
spellcheck: false,
maskExp: '',
validateOnChange: false,
validateOnBlur: true,
disabled: false,
editable: true,
showCls: 'toolbar__icon btn-sheet-view',
hideCls: 'toolbar__icon hide-password',
btnHint: '',
repeatInput: null,
showPwdOnClick: true
},
initialize : function(options) {
options = options || {};
options.btnHint = options.btnHint || this.textHintShowPwd;
options.iconCls = options.showCls || this.options.showCls;
Common.UI.InputFieldBtn.prototype.initialize.call(this, options);
this.hidePwd = true;
this.repeatInput= this.options.repeatInput;
},
render: function (parentEl) {
Common.UI.InputFieldBtn.prototype.render.call(this, parentEl);
this._btnElm = this._button.$el;
if(this.options.showPwdOnClick)
this._button.on('click', _.bind(this.passwordClick, this));
else
this._btnElm.on('mousedown', _.bind(this.passwordShow, this));
return this;
},
passwordClick: function (e)
{
if(this.hidePwd) {
this.passwordShow(e);
this.hidePwd = false;
}
else {
this.passwordHide(e);
this.hidePwd = true;
}
var me = this;
var prevstart = me._input[0].selectionStart,
prevend = me._input[0].selectionEnd;
setTimeout(function () {
me.focus();
me._input[0].selectionStart = prevstart;
me._input[0].selectionEnd = prevend;
}, 1);
},
passwordShow: function (e) {
if (this.disabled) return;
this._button.setIconCls(this.options.hideCls);
this.type = 'text';
this._input.attr('type', this.type);
if(this.repeatInput) {
this.repeatInput.type = this.type;
this.repeatInput._input.attr('type', this.type);
}
if(this.options.showPwdOnClick) {
this._button.updateHint(this.textHintHidePwd);
}
else {
this._btnElm.on('mouseup', _.bind(this.passwordHide, this));
this._btnElm.on('mouseout', _.bind(this.passwordHide, this));
}
},
passwordHide: function (e) {
this._button.setIconCls(this.options.showCls);
this.type = 'password';
this._input.attr('type', this.type);
if(this.repeatInput) {
this.repeatInput.type = this.type;
this.repeatInput._input.attr('type', this.type);
}
if(this.options.showPwdOnClick) {
this._button.updateHint(this.textHintShowPwd);
}
else {
this._btnElm.off('mouseup', this.passwordHide);
this._btnElm.off('mouseout', this.passwordHide);
var me = this;
var prevstart = me._input[0].selectionStart,
prevend = me._input[0].selectionEnd;
setTimeout(function () {
me.focus();
me._input[0].selectionStart = prevstart;
me._input[0].selectionEnd = prevend;
}, 1);
}
},
textHintShowPwd: 'Show password',
textHintHidePwd: 'Hide password'
}
})(), Common.UI.InputFieldBtnPassword || {}));
Common.UI.InputFieldBtnCalendar = Common.UI.InputFieldBtn.extend((function (){
return {
options: {
id: null,
cls: '',
style: '',
value: '',
type: 'date',
name: '',
validation: null,
allowBlank: true,
placeHolder: '',
blankError: null,
spellcheck: false,
maskExp: '',
validateOnChange: false,
validateOnBlur: true,
disabled: false,
editable: true,
iconCls: 'toolbar__icon btn-datetime',
btnHint: '',
menu: true
},
render: function (parentEl) {
var me = this;
Common.UI.InputFieldBtn.prototype.render.call(this, parentEl);
var id = 'id-' + Common.UI.getId() + 'input-field-datetime',
menu = new Common.UI.Menu({
menuAlign: 'tr-br',
style: 'border: none; padding: 0;',
items: [
{template: _.template('<div id="' + id + '" style=""></div>'), stopPropagation: true}
]
});
$('button', this._button.cmpEl).addClass('no-caret');
this._button.setMenu(menu);
this._button.menu.on('show:after', function(menu) {
if (!me.cmpCalendar) {
me.cmpCalendar = new Common.UI.Calendar({
el: me.cmpEl.find('#' + id),
enableKeyEvents: true,
firstday: 1
});
me.cmpCalendar.on('date:click', function (cmp, date) {
me.trigger('date:click', me, date);
menu.hide();
});
menu.alignPosition();
}
me.cmpCalendar.focus();
})
},
setDate: function(date) {
if (this.cmpCalendar && date && date instanceof Date && !isNaN(date))
this.cmpCalendar && this.cmpCalendar.setDate(date);
} }
} }
})()); })());

View file

@ -1,127 +0,0 @@
/*
*
* (c) Copyright Ascensio System SIA 2010-2022
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
/**
* Label.js
*
* Created by Julia Radzhabova on 1/20/22
* Copyright (c) 2022 Ascensio System SIA. All rights reserved.
*
*/
if (Common === undefined)
var Common = {};
define([
'common/main/lib/component/BaseView',
'underscore'
], function (base, _) {
'use strict';
Common.UI.Label = Common.UI.BaseView.extend({
options : {
id : null,
disabled : false,
cls : '',
iconCls : '',
style : '',
caption : ''
},
template : _.template('<label class="label-cmp <%= cls %>" style="<%= style %>">' +
'<% if ( iconCls ) { %>' +
'<i class="icon <%= iconCls %>"></i>' +
'<% } %>' +
'<span class="caption"><%= caption %></span>' +
'</label>'),
initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
this.id = this.options.id || Common.UI.getId();
this.cls = this.options.cls;
this.iconCls = this.options.iconCls;
this.style = this.options.style;
this.disabled = this.options.disabled;
this.caption = this.options.caption;
this.template = this.options.template || this.template;
this.rendered = false;
if (this.options.el)
this.render();
},
render: function (parentEl) {
var me = this;
if (!me.rendered) {
var elem = this.template({
id : me.id,
cls : me.cls,
iconCls : me.iconCls,
style : me.style,
caption : me.caption
});
if (parentEl) {
this.setElement(parentEl, false);
parentEl.html(elem);
} else {
me.$el.html(elem);
}
this.$label = me.$el.find('.label-cmp');
this.rendered = true;
}
if (this.disabled)
this.setDisabled(this.disabled);
return this;
},
setDisabled: function(disabled) {
if (!this.rendered)
return;
disabled = (disabled===true);
if (disabled !== this.disabled) {
this.$label.toggleClass('disabled', disabled);
}
this.disabled = disabled;
},
isDisabled: function() {
return this.disabled;
}
});
});

View file

@ -167,8 +167,7 @@ define([
fmax : panel.resize.fmax, fmax : panel.resize.fmax,
behaviour : panel.behaviour, behaviour : panel.behaviour,
index : this.splitters.length, index : this.splitters.length,
offset : panel.resize.offset || 0, offset : panel.resize.offset || 0
multiply : panel.resize.multiply
}; };
if (!stretch) { if (!stretch) {
@ -265,7 +264,6 @@ define([
this.resize.fmin = panel.fmin; this.resize.fmin = panel.fmin;
this.resize.fmax = panel.fmax; this.resize.fmax = panel.fmax;
this.resize.behaviour = panel.behaviour; this.resize.behaviour = panel.behaviour;
this.resize.multiply = panel.multiply;
this.resize.$el.addClass('move'); this.resize.$el.addClass('move');
@ -276,11 +274,9 @@ define([
} else } else
if (e.data.type == 'horizontal') { if (e.data.type == 'horizontal') {
this.resize.width = parseInt(this.resize.$el.css('width')); this.resize.width = parseInt(this.resize.$el.css('width'));
this.resize.max = (panel.maxpos > 0 ? panel.maxpos : this.resize.$el.parent().width() + panel.maxpos) - this.resize.width; this.resize.max = (panel.maxpos > 0 ? panel.maxpos : this.resize.$el.parent().height() + panel.maxpos) - this.resize.width;
this.resize.initx = e.pageX*Common.Utils.zoom() - parseInt(e.currentTarget.style.left); this.resize.initx = e.pageX*Common.Utils.zoom() - parseInt(e.currentTarget.style.left);
} }
if (this.resize.multiply && this.resize.multiply.koeff)
this.resize.max = Math.floor(this.resize.max/this.resize.multiply.koeff) * this.resize.multiply.koeff + (this.resize.multiply.offset || 0);
Common.NotificationCenter.trigger('layout:resizestart'); Common.NotificationCenter.trigger('layout:resizestart');
}, },
@ -294,13 +290,7 @@ define([
prop = 'left'; prop = 'left';
value = e.pageX*zoom - this.resize.initx; value = e.pageX*zoom - this.resize.initx;
} }
if (this.resize.multiply && this.resize.multiply.koeff) {
var m = this.resize.multiply.koeff,
val = value/m,
vfloor = Math.floor(val) * m + (this.resize.multiply.offset || 0),
vceil = Math.ceil(val) * m + (this.resize.multiply.offset || 0);
value = (value>vfloor+m/2) ? vceil : vfloor;
}
if (this.resize.fmin && this.resize.fmax) { if (this.resize.fmin && this.resize.fmax) {
if (!(value < this.resize.fmin()) && !(value > this.resize.fmax())) { if (!(value < this.resize.fmin()) && !(value > this.resize.fmax())) {
this.resize.$el[0].style[prop] = value + 'px'; this.resize.$el[0].style[prop] = value + 'px';
@ -342,13 +332,7 @@ define([
prop = 'width'; prop = 'width';
value = e.pageX*zoom - this.resize.initx; value = e.pageX*zoom - this.resize.initx;
} }
if (this.resize.multiply && this.resize.multiply.koeff) {
var m = this.resize.multiply.koeff,
val = value/m,
vfloor = Math.floor(val) * m + (this.resize.multiply.offset || 0),
vceil = Math.ceil(val) * m + (this.resize.multiply.offset || 0);
value = (value>vfloor+m/2) ? vceil : vfloor;
}
if (this.resize.fmin && this.resize.fmax) { if (this.resize.fmin && this.resize.fmax) {
value < this.resize.fmin() && (value = this.resize.fmin()); value < this.resize.fmin() && (value = this.resize.fmin());
value > this.resize.fmax() && (value = this.resize.fmax()); value > this.resize.fmax() && (value = this.resize.fmax());

View file

@ -54,12 +54,11 @@ define([
showLast: true, showLast: true,
simpleAddMode: false, simpleAddMode: false,
keyMoveDirection: 'vertical', keyMoveDirection: 'vertical',
itemTemplate: _.template('<div id="<%= id %>" class="list-item" style=""><%= value %></div>'), itemTemplate: _.template('<div id="<%= id %>" class="list-item" style=""><%= value %></div>')
cls: ''
}, },
template: _.template([ template: _.template([
'<div class="listview inner <%= cls %>" <% if (options.dataHint) { %> data-hint="<%= options.dataHint %>" <% } if (options.dataHintDirection) { %> data-hint-direction="<%= options.dataHintDirection %>" <% } if (options.dataHintOffset) { %> data-hint-offset="<%= options.dataHintOffset %>" <% } %>></div>' '<div class="listview inner"></div>'
].join('')), ].join('')),
onResetItems : function() { onResetItems : function() {
@ -68,15 +67,11 @@ define([
this.trigger('items:reset', this); this.trigger('items:reset', this);
}, },
createNewItem: function(record) { onAddItem: function(record, store, opts) {
return new Common.UI.DataViewItem({ var view = new Common.UI.DataViewItem({
template: this.itemTemplate, template: this.itemTemplate,
model: record model: record
}); });
},
onAddItem: function(record, store, opts) {
var view = this.createNewItem(record);
if (!this.innerEl) if (!this.innerEl)
this.innerEl = $(this.el).find('.inner'); this.innerEl = $(this.el).find('.inner');
@ -116,41 +111,6 @@ define([
if (!this.isSuspendEvents) if (!this.isSuspendEvents)
this.trigger('item:add', this, view, record); this.trigger('item:add', this, view, record);
} }
},
focus: function() {
this.cmpEl && this.cmpEl.find('.listview').focus();
},
scrollToRecord: function (record, force) {
if (!this._fromKeyDown) {
Common.UI.DataView.prototype.scrollToRecord.call(this, record, force);
return;
}
if (!record) return;
var innerEl = $(this.el).find('.inner'),
innerHeight = innerEl.innerHeight(),
idx = _.indexOf(this.store.models, record),
div = (idx>=0 && this.dataViewItems.length>idx) ? $(this.dataViewItems[idx].el) : innerEl.find('#' + record.get('id'));
if (div.length<=0) return;
var div_top = div.position().top,
div_height = div.outerHeight(),
newpos;
if (force || div_top<0)
newpos = innerEl.scrollTop() + div_top;
else if (div_top+div_height>innerHeight)
newpos = innerEl.scrollTop() + div_top + div_height - innerHeight;
if (newpos!==undefined) {
if (this.scroller && this.allowScrollbar) {
this.scroller.scrollTop(newpos, 0);
} else {
innerEl.scrollTop(newpos);
}
}
} }
} }
})()); })());

View file

@ -68,6 +68,10 @@ define([
'use strict'; 'use strict';
Common.UI.LoadMask = Common.UI.BaseView.extend((function() { Common.UI.LoadMask = Common.UI.BaseView.extend((function() {
var ownerEl,
maskeEl,
loaderEl;
return { return {
options : { options : {
cls : '', cls : '',
@ -78,7 +82,7 @@ define([
template: _.template([ template: _.template([
'<div id="<%= id %>" class="asc-loadmask-body <%= cls %>" role="presentation" tabindex="-1">', '<div id="<%= id %>" class="asc-loadmask-body <%= cls %>" role="presentation" tabindex="-1">',
'<i id="loadmask-spinner" class="asc-loadmask-image"></i>', '<div class="asc-loadmask-image"></div>',
'<div class="asc-loadmask-title"><%= title %></div>', '<div class="asc-loadmask-title"><%= title %></div>',
'</div>' '</div>'
].join('')), ].join('')),
@ -87,102 +91,77 @@ define([
Common.UI.BaseView.prototype.initialize.call(this, options); Common.UI.BaseView.prototype.initialize.call(this, options);
this.template = this.options.template || this.template; this.template = this.options.template || this.template;
this.cls = this.options.cls;
this.style = this.options.style;
this.title = this.options.title; this.title = this.options.title;
this.owner = this.options.owner;
this.ownerEl = (this.options.owner instanceof Common.UI.BaseView) ? $(this.options.owner.el) : $(this.options.owner);
this.loaderEl = $(this.template({
id : this.id,
cls : this.options.cls,
style : this.options.style,
title : this.title
}));
this.maskeEl = $('<div class="asc-loadmask"></div>');
this.timerId = 0;
}, },
render: function() { render: function() {
return this; return this;
}, },
internalShowLoader: function() { show: function(){
this.ownerEl.append(this.loaderEl); if (maskeEl || loaderEl)
this.loaderEl.css('min-width', $('.asc-loadmask-title', this.loaderEl).width() + 105); return;
if (this.ownerEl && this.ownerEl.closest('.asc-window.modal').length==0) ownerEl = (this.owner instanceof Common.UI.BaseView) ? $(this.owner.el) : $(this.owner);
Common.util.Shortcuts.suspendEvents();
},
internalShowMask: function() {
if (!!this.ownerEl.ismasked) return;
this.ownerEl.ismasked = true;
this.ownerEl.append(this.maskeEl);
},
show: function(immediately){
this.internalShowMask();
// The owner is already masked // The owner is already masked
if (!!this.ownerEl.hasloader) if (ownerEl.hasClass('masked'))
return this; return this;
this.ownerEl.hasloader = true;
var me = this; var me = this;
if (me.title != me.options.title) {
me.options.title = me.title;
$('.asc-loadmask-title', this.loaderEl).html(me.title);
}
if (immediately) { maskeEl = $('<div class="asc-loadmask"></div>');
me.internalShowLoader(); loaderEl = $(this.template({
} else if (!me.timerId) { id : me.id,
// show mask after 500 ms if it wont be hided cls : me.cls,
me.timerId = setTimeout(function () { style : me.style,
me.internalShowLoader(); title : me.title
},500); }));
}
ownerEl.addClass('masked');
ownerEl.append(maskeEl);
ownerEl.append(loaderEl);
loaderEl.css({
top : Math.round(ownerEl.height() / 2 - (loaderEl.height() + parseInt(loaderEl.css('padding-top')) + parseInt(loaderEl.css('padding-bottom'))) / 2) + 'px',
left: Math.round(ownerEl.width() / 2 - (loaderEl.width() + parseInt(loaderEl.css('padding-left')) + parseInt(loaderEl.css('padding-right'))) / 2) + 'px'
});
if (ownerEl.height()<1 || ownerEl.width()<1)
loaderEl.css({visibility: 'hidden'});
Common.util.Shortcuts.suspendEvents();
return this; return this;
}, },
hide: function() { hide: function() {
var ownerEl = this.ownerEl; ownerEl && ownerEl.removeClass('masked');
if (this.timerId) { maskeEl && maskeEl.remove();
clearTimeout(this.timerId); loaderEl && loaderEl.remove();
this.timerId = 0; maskeEl = null;
} loaderEl = null;
ownerEl && ownerEl.ismasked && this.maskeEl && this.maskeEl.remove();
delete ownerEl.ismasked;
if (ownerEl && ownerEl.hasloader) {
if (ownerEl.closest('.asc-window.modal').length==0 && !Common.Utils.ModalWindow.isVisible())
Common.util.Shortcuts.resumeEvents(); Common.util.Shortcuts.resumeEvents();
this.loaderEl && this.loaderEl.remove();
}
delete ownerEl.hasloader;
}, },
setTitle: function(title) { setTitle: function(title) {
this.title = title; this.title = title;
if (this.ownerEl && this.ownerEl.hasloader && this.loaderEl){ if (ownerEl && ownerEl.hasClass('masked') && loaderEl){
var el = $('.asc-loadmask-title', this.loaderEl); $('.asc-loadmask-title', loaderEl).html(title);
el.html(title);
this.loaderEl.css('min-width', el.width() + 105);
} }
}, },
isVisible: function() { isVisible: function() {
return !!this.ownerEl.ismasked; return !_.isEmpty(loaderEl);
}, },
updatePosition: function() { updatePosition: function() {
var ownerEl = this.ownerEl, if (ownerEl && ownerEl.hasClass('masked') && loaderEl){
loaderEl = this.loaderEl;
if (ownerEl && ownerEl.hasloader && loaderEl){
loaderEl.css({ loaderEl.css({
top : Math.round(ownerEl.height() / 2 - (loaderEl.height() + parseInt(loaderEl.css('padding-top')) + parseInt(loaderEl.css('padding-bottom'))) / 2) + 'px', top : Math.round(ownerEl.height() / 2 - (loaderEl.height() + parseInt(loaderEl.css('padding-top')) + parseInt(loaderEl.css('padding-bottom'))) / 2) + 'px',
left: Math.round(ownerEl.width() / 2 - (loaderEl.width() + parseInt(loaderEl.css('padding-left')) + parseInt(loaderEl.css('padding-right'))) / 2) + 'px' left: Math.round(ownerEl.width() / 2 - (loaderEl.width() + parseInt(loaderEl.css('padding-left')) + parseInt(loaderEl.css('padding-right'))) / 2) + 'px'

View file

@ -171,7 +171,6 @@ define([
this.menuAlignEl = this.options.menuAlignEl; this.menuAlignEl = this.options.menuAlignEl;
this.scrollAlwaysVisible = this.options.scrollAlwaysVisible; this.scrollAlwaysVisible = this.options.scrollAlwaysVisible;
this.search = this.options.search; this.search = this.options.search;
this.outerMenu = this.options.outerMenu;
if (this.options.restoreHeight) { if (this.options.restoreHeight) {
this.options.restoreHeight = (typeof (this.options.restoreHeight) == "number") ? this.options.restoreHeight : (this.options.maxHeight ? this.options.maxHeight : 100000); this.options.restoreHeight = (typeof (this.options.restoreHeight) == "number") ? this.options.restoreHeight : (this.options.maxHeight ? this.options.maxHeight : 100000);
@ -268,8 +267,6 @@ define([
this.parentEl.on('hide.bs.dropdown', _.bind(me.onBeforeHideMenu, me)); this.parentEl.on('hide.bs.dropdown', _.bind(me.onBeforeHideMenu, me));
this.parentEl.on('hidden.bs.dropdown', _.bind(me.onAfterHideMenu, me)); this.parentEl.on('hidden.bs.dropdown', _.bind(me.onAfterHideMenu, me));
this.parentEl.on('keydown.after.bs.dropdown', _.bind(me.onAfterKeydownMenu, me)); this.parentEl.on('keydown.after.bs.dropdown', _.bind(me.onAfterKeydownMenu, me));
this.parentEl.on('keydown.before.bs.dropdown', _.bind(me.onBeforeKeydownMenu, me));
this.options.innerMenus && this.on('keydown:before', _.bind(me.onBeforeKeyDown, me));
menuRoot.hover( menuRoot.hover(
function(e) { me.isOver = true;}, function(e) { me.isOver = true;},
@ -377,29 +374,21 @@ define([
onBeforeShowMenu: function(e) { onBeforeShowMenu: function(e) {
Common.NotificationCenter.trigger('menu:show'); Common.NotificationCenter.trigger('menu:show');
this.trigger('show:before', this, e); this.trigger('show:before', this, e);
(e && e.target===e.currentTarget) && this.alignPosition(); this.alignPosition();
}, },
onAfterShowMenu: function(e) { onAfterShowMenu: function(e) {
this.trigger('show:after', this, e); this.trigger('show:after', this, e);
if (this.scroller && e && e.target===e.currentTarget) { if (this.scroller) {
var menuRoot = this.menuRoot; this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible});
if (this.wheelSpeed===undefined) { var menuRoot = this.menuRoot,
var item = menuRoot.find('> li:first'), $selected = menuRoot.find('> li .checked');
itemHeight = (item.length) ? item.outerHeight() : 1;
this.wheelSpeed = Math.min((Math.floor(menuRoot.height()/itemHeight) * itemHeight)/10, 20);
}
this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible, wheelSpeed: this.wheelSpeed});
var $selected = menuRoot.find('> li .checked');
if ($selected.length) { if ($selected.length) {
var itemTop = $selected.position().top, var itemTop = $selected.position().top,
itemHeight = $selected.outerHeight(), itemHeight = $selected.height(),
listHeight = menuRoot.outerHeight(); listHeight = menuRoot.height();
if (itemTop < 0 || itemTop + itemHeight > listHeight) { if (itemTop < 0 || itemTop + itemHeight > listHeight) {
var height = menuRoot.scrollTop() + itemTop + (itemHeight - listHeight)/2; menuRoot.scrollTop(menuRoot.scrollTop() + itemTop + itemHeight - (listHeight/2));
height = (Math.floor(height/itemHeight) * itemHeight);
menuRoot.scrollTop(height);
} }
setTimeout(function(){$selected.focus();}, 1); setTimeout(function(){$selected.focus();}, 1);
} }
@ -456,21 +445,6 @@ define([
} }
}, },
onBeforeKeydownMenu: function(e) {
if (e.isDefaultPrevented() || !(this.outerMenu && this.outerMenu.menu))
return;
if (e.keyCode == Common.UI.Keys.UP || e.keyCode == Common.UI.Keys.DOWN) {
var $items = this.menuRoot.find('> li').find('> a'),
index = $items.index($items.filter(':focus'));
if (e.keyCode==Common.UI.Keys.UP && index==0 || e.keyCode == Common.UI.Keys.DOWN && index==$items.length-1) {
this.outerMenu.menu.focusOuter(e, this.outerMenu.index);
e.preventDefault();
e.stopPropagation();
}
}
},
selectCandidate: function() { selectCandidate: function() {
var index = this._search.index || 0, var index = this._search.index || 0,
re = new RegExp('^' + ((this._search.full) ? this._search.text : this._search.char), 'i'), re = new RegExp('^' + ((this._search.full) ? this._search.text : this._search.char), 'i'),
@ -495,99 +469,18 @@ define([
this._search.index = idxCandidate; this._search.index = idxCandidate;
var item = itemCandidate.cmpEl.find('a'); var item = itemCandidate.cmpEl.find('a');
if (this.scroller) { if (this.scroller) {
this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible, wheelSpeed: this.wheelSpeed}); this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible});
var itemTop = item.position().top, var itemTop = item.position().top,
itemHeight = item.outerHeight(), itemHeight = item.height(),
listHeight = this.menuRoot.outerHeight(); listHeight = this.menuRoot.height();
if (itemTop < 0 || itemTop + itemHeight > listHeight) { if (itemTop < 0 || itemTop + itemHeight > listHeight) {
var height = this.menuRoot.scrollTop() + itemTop; this.menuRoot.scrollTop(this.menuRoot.scrollTop() + itemTop + itemHeight - (listHeight/2));
height = (Math.floor(height/itemHeight) * itemHeight);
this.menuRoot.scrollTop(height);
} }
} }
item.focus(); item.focus();
} }
}, },
onBeforeKeyDown: function(menu, e) {
if (e.keyCode == Common.UI.Keys.RETURN) {
var li = $(e.target).closest('li');
if (li.length>0) {
e.preventDefault();
e.stopPropagation();
li.click();
}
Common.UI.Menu.Manager.hideAll();
} else if (e.namespace!=="after.bs.dropdown" && (e.keyCode == Common.UI.Keys.DOWN || e.keyCode == Common.UI.Keys.UP)) {
if ( this.menuRoot.length<1 || $(e.target).closest('ul[role=menu]').get(0) !== this.menuRoot.get(0)) return;
var innerMenu = this.findInnerMenu(e.keyCode);
if (innerMenu && innerMenu.focusInner) {
e.preventDefault();
e.stopPropagation();
_.delay(function() {
innerMenu.focusInner(e);
}, 10);
}
}
},
setInnerMenu: function(menus) {
if (this.options.innerMenus || !menus) return;
this.options.innerMenus = menus;
this.rendered && this.on('keydown:before', _.bind(this.onBeforeKeyDown, this));
},
findInnerMenu: function(direction, index, findOuter) {
if (!this.options.innerMenus) return;
var $allItems = $('> li', this.menuRoot),
$liItems = $('> li:not(.divider):not(.disabled):visible', this.menuRoot),
length = $liItems.length;
if (!length) return;
var step = 0;
while (step<length) {
var focusedIndex = (index!==undefined) ? $liItems.index($allItems.eq(index)) : $liItems.index($liItems.find('> a').filter(':focus').parent());
var checkedIndex = (direction == Common.UI.Keys.DOWN) ? (focusedIndex<length-1 ? focusedIndex+1 : 0) : (focusedIndex>0 ? focusedIndex-1 : length-1),
checkedItem = $liItems.eq(checkedIndex);
index = $allItems.index(checkedItem);
for (var i=0; i<this.options.innerMenus.length; i++) {
var item = this.options.innerMenus[i];
if (item && item.menu && item.index==index) {
return item.menu;
}
}
if (checkedItem.find('> a').length>0)
return findOuter ? checkedItem : undefined;
step++;
}
},
focusInner: function(e) {
if (e.keyCode == Common.UI.Keys.UP)
this.items[this.items.length-1].cmpEl.find('> a').focus();
else
this.items[0].cmpEl.find('> a').focus();
},
focusOuter: function(e, index) {
var innerMenu = this.findInnerMenu(e.keyCode, index, true);
if (innerMenu && innerMenu.focusInner) {
_.delay(function() {
innerMenu.focusInner(e);
}, 10);
} else if (innerMenu) {
innerMenu.find('> a').focus();
} else {
var $items = $('> li:not(.divider):not(.disabled):visible', this.menuRoot).find('> a'),
length = $items.length;
length && $items.eq(e.keyCode == Common.UI.Keys.UP ? (index<0 ? length-1 : index) : (index>=length-1 ? 0 : index+1)).focus();
}
},
onItemClick: function(item, e) { onItemClick: function(item, e) {
if (!item.menu) this.isOver = false; if (!item.menu) this.isOver = false;
if (item.options.stopPropagation) { if (item.options.stopPropagation) {
@ -620,7 +513,7 @@ define([
menuParent = this.menuAlignEl || menuRoot.parent(), menuParent = this.menuAlignEl || menuRoot.parent(),
m = this.menuAlign.match(/^([a-z]+)-([a-z]+)/), m = this.menuAlign.match(/^([a-z]+)-([a-z]+)/),
offset = menuParent.offset(), offset = menuParent.offset(),
docW = Common.Utils.innerWidth() - 10, docW = Common.Utils.innerWidth(),
docH = Common.Utils.innerHeight() - 10, // Yep, it's magic number docH = Common.Utils.innerHeight() - 10, // Yep, it's magic number
menuW = menuRoot.outerWidth(), menuW = menuRoot.outerWidth(),
menuH = menuRoot.outerHeight(), menuH = menuRoot.outerHeight(),
@ -648,31 +541,8 @@ define([
} else { } else {
left = docW - menuW; left = docW - menuW;
} }
if (left < 0)
left = 0;
if (this.options.restoreHeightAndTop) { // can change top position, if top<0 - then change menu height if (this.options.restoreHeight) {
var cg = Common.Utils.croppedGeometry();
docH = cg.height - 10;
menuRoot.css('max-height', 'none');
menuH = menuRoot.outerHeight();
if (top + menuH > docH + cg.top) {
top = docH - menuH;
}
if (top < cg.top)
top = cg.top;
if (top + menuH > docH + cg.top) {
menuRoot.css('max-height', (docH - top) + 'px');
(!this.scroller) && (this.scroller = new Common.UI.Scroller({
el: this.$el.find('> .dropdown-menu '),
minScrollbarLength: 30,
suppressScrollX: true,
alwaysVisibleY: this.scrollAlwaysVisible
}));
this.wheelSpeed = undefined;
}
this.scroller && this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible});
} else if (this.options.restoreHeight) {
if (typeof (this.options.restoreHeight) == "number") { if (typeof (this.options.restoreHeight) == "number") {
if (top + menuH > docH) { if (top + menuH > docH) {
menuRoot.css('max-height', (docH - top) + 'px'); menuRoot.css('max-height', (docH - top) + 'px');
@ -682,16 +552,12 @@ define([
suppressScrollX: true, suppressScrollX: true,
alwaysVisibleY: this.scrollAlwaysVisible alwaysVisibleY: this.scrollAlwaysVisible
})); }));
this.wheelSpeed = undefined;
} else if ( top + menuH < docH && menuRoot.height() < this.options.restoreHeight) { } else if ( top + menuH < docH && menuRoot.height() < this.options.restoreHeight) {
menuRoot.css('max-height', (Math.min(docH - top, this.options.restoreHeight)) + 'px'); menuRoot.css('max-height', (Math.min(docH - top, this.options.restoreHeight)) + 'px');
this.wheelSpeed = undefined;
} }
} }
} else { } else {
var cg = Common.Utils.croppedGeometry(); if (top + menuH > docH) {
docH = cg.height - 10;
if (top + menuH > docH + cg.top) {
if (fixedAlign && typeof fixedAlign == 'string') { // how to align if menu height > window height if (fixedAlign && typeof fixedAlign == 'string') { // how to align if menu height > window height
m = fixedAlign.match(/^([a-z]+)-([a-z]+)/); m = fixedAlign.match(/^([a-z]+)-([a-z]+)/);
top = offset.top - posMenu[m[1]][1] + posParent[m[2]][1] + this.offset[1] + (fixedOffset || 0); top = offset.top - posMenu[m[1]][1] + posParent[m[2]][1] + this.offset[1] + (fixedOffset || 0);
@ -699,18 +565,14 @@ define([
top = docH - menuH; top = docH - menuH;
} }
if (top < 0)
if (top < cg.top) top = 0;
top = cg.top;
} }
if (this.options.additionalAlign) if (this.options.additionalAlign)
this.options.additionalAlign.call(this, menuRoot, left, top); this.options.additionalAlign.call(this, menuRoot, left, top);
else { else
var _css = {left: left, top: top}; menuRoot.css({left: Math.ceil(left), top: Math.ceil(top)});
if (!(menuH < docH)) _css['margin-top'] = 0;
menuRoot.css(_css);
}
}, },
clearAll: function() { clearAll: function() {
@ -975,23 +837,21 @@ define([
onBeforeShowMenu: function(e) { onBeforeShowMenu: function(e) {
Common.NotificationCenter.trigger('menu:show'); Common.NotificationCenter.trigger('menu:show');
this.trigger('show:before', this, e); this.trigger('show:before', this, e);
(e && e.target===e.currentTarget) && this.alignPosition(); this.alignPosition();
}, },
onAfterShowMenu: function(e) { onAfterShowMenu: function(e) {
this.trigger('show:after', this, e); this.trigger('show:after', this, e);
if (this.scroller && e && e.target===e.currentTarget) { if (this.scroller) {
this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible}); this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible});
var menuRoot = this.menuRoot, var menuRoot = this.menuRoot,
$selected = menuRoot.find('> li .checked'); $selected = menuRoot.find('> li .checked');
if ($selected.length) { if ($selected.length) {
var itemTop = $selected.position().top, var itemTop = $selected.position().top,
itemHeight = $selected.outerHeight(), itemHeight = $selected.height(),
listHeight = menuRoot.outerHeight(); listHeight = menuRoot.height();
if (itemTop < 0 || itemTop + itemHeight > listHeight) { if (itemTop < 0 || itemTop + itemHeight > listHeight) {
var height = menuRoot.scrollTop() + itemTop + (itemHeight - listHeight)/2; menuRoot.scrollTop(menuRoot.scrollTop() + itemTop + itemHeight - (listHeight/2));
height = (Math.floor(height/itemHeight) * itemHeight);
menuRoot.scrollTop(height);
} }
setTimeout(function(){$selected.focus();}, 1); setTimeout(function(){$selected.focus();}, 1);
} }
@ -1076,12 +936,10 @@ define([
if (this.scroller) { if (this.scroller) {
this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible}); this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible});
var itemTop = item.position().top, var itemTop = item.position().top,
itemHeight = item.outerHeight(), itemHeight = item.height(),
listHeight = this.menuRoot.outerHeight(); listHeight = this.menuRoot.height();
if (itemTop < 0 || itemTop + itemHeight > listHeight) { if (itemTop < 0 || itemTop + itemHeight > listHeight) {
var height = this.menuRoot.scrollTop() + itemTop; this.menuRoot.scrollTop(this.menuRoot.scrollTop() + itemTop + itemHeight - (listHeight/2));
height = (Math.floor(height/itemHeight) * itemHeight);
this.menuRoot.scrollTop(height);
} }
} }
item.focus(); item.focus();

View file

@ -98,22 +98,17 @@ define([
checked : false, checked : false,
allowDepress: false, allowDepress: false,
disabled : false, disabled : false,
visible : true,
value : null, value : null,
toggleGroup : null, toggleGroup : null,
iconCls : '', iconCls : '',
menu : null, menu : null,
canFocused : true, canFocused : true
dataHint : '',
dataHintDirection: '',
dataHintOffset: '',
dataHintTitle: ''
}, },
tagName : 'li', tagName : 'li',
template: _.template([ template: _.template([
'<a id="<%= id %>" style="<%= style %>" <% if(options.canFocused) { %> tabindex="-1" type="menuitem" <% }; if(!_.isUndefined(options.stopPropagation)) { %> data-stopPropagation="true" <% }; if(!_.isUndefined(options.dataHint)) { %> data-hint="<%= options.dataHint %>" <% }; if(!_.isUndefined(options.dataHintDirection)) { %> data-hint-direction="<%= options.dataHintDirection %>" <% }; if(!_.isUndefined(options.dataHintOffset)) { %> data-hint-offset="<%= options.dataHintOffset %>" <% }; if(options.dataHintTitle) { %> data-hint-title="<%= options.dataHintTitle %>" <% }; %> >', '<a id="<%= id %>" style="<%= style %>" <% if(options.canFocused) { %> tabindex="-1" type="menuitem" <% }; if(!_.isUndefined(options.stopPropagation)) { %> data-stopPropagation="true" <% }; %> >',
'<% if (!_.isEmpty(iconCls)) { %>', '<% if (!_.isEmpty(iconCls)) { %>',
'<span class="menu-item-icon <%= iconCls %>"></span>', '<span class="menu-item-icon <%= iconCls %>"></span>',
'<% } %>', '<% } %>',
@ -135,7 +130,6 @@ define([
this.checked = me.options.checked; this.checked = me.options.checked;
me.allowDepress = me.options.allowDepress; me.allowDepress = me.options.allowDepress;
this.disabled = me.options.disabled; this.disabled = me.options.disabled;
this.visible = me.options.visible;
this.value = me.options.value; this.value = me.options.value;
this.toggleGroup = me.options.toggleGroup; this.toggleGroup = me.options.toggleGroup;
this.template = me.options.template || this.template; this.template = me.options.template || this.template;
@ -189,7 +183,6 @@ define([
if (this.checkable && firstChild) { if (this.checkable && firstChild) {
firstChild.toggleClass('checkable', this.checkable); firstChild.toggleClass('checkable', this.checkable);
firstChild.toggleClass('no-checkmark', this.options.checkmark===false);
firstChild.toggleClass('checked', this.checked); firstChild.toggleClass('checked', this.checked);
if (!_.isEmpty(this.iconCls)) { if (!_.isEmpty(this.iconCls)) {
firstChild.css('background-image', 'none'); firstChild.css('background-image', 'none');
@ -219,9 +212,6 @@ define([
}); });
} }
if (this.cls)
el.addClass(this.cls);
if (this.disabled) if (this.disabled)
el.toggleClass('disabled', this.disabled); el.toggleClass('disabled', this.disabled);
@ -231,8 +221,6 @@ define([
Common.UI.ToggleManager.register(me); Common.UI.ToggleManager.register(me);
} }
} }
if (!this.visible)
this.setVisible(this.visible);
me.cmpEl = el; me.cmpEl = el;
me.rendered = true; me.rendered = true;
@ -249,16 +237,6 @@ define([
this.cmpEl.find('a').contents().last()[0].textContent = (noencoding) ? caption : Common.Utils.String.htmlEncode(caption); this.cmpEl.find('a').contents().last()[0].textContent = (noencoding) ? caption : Common.Utils.String.htmlEncode(caption);
}, },
setIconCls: function(iconCls) {
if (this.rendered && !_.isEmpty(this.iconCls)) {
var firstChild = this.cmpEl.children(':first');
if (firstChild) {
firstChild.find('.menu-item-icon').removeClass(this.iconCls).addClass(iconCls);
}
}
this.iconCls = iconCls;
},
setChecked: function(check, suppressEvent) { setChecked: function(check, suppressEvent) {
this.toggle(check, suppressEvent); this.toggle(check, suppressEvent);
}, },
@ -301,7 +279,6 @@ define([
}, },
onItemMouseDown: function(e) { onItemMouseDown: function(e) {
Common.UI.HintManager && Common.UI.HintManager.clearHints();
if (e.which != 1) { if (e.which != 1) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();

View file

@ -110,10 +110,7 @@ define([
hold : true, hold : true,
speed : 'medium', speed : 'medium',
width : 90, width : 90,
allowDecimal: true, allowDecimal: true
dataHint : '',
dataHintDirection: '',
dataHintOffset: ''
}, },
disabled : false, disabled : false,
@ -121,10 +118,10 @@ define([
rendered : false, rendered : false,
template : template :
'<input type="text" class="form-control" spellcheck="false" data-hint="<%= dataHint %>" data-hint-direction="<%= dataHintDirection %>" data-hint-offset="<%= dataHintOffset %>">' + '<input type="text" class="form-control" spellcheck="false">' +
'<div class="spinner-buttons">' + '<div class="spinner-buttons">' +
'<button type="button" class="spinner-up"><i class="arrow"></i></button>' + '<button type="button" class="spinner-up"><i class="img-commonctrl"></i></button>' +
'<button type="button" class="spinner-down"><i class="arrow"></i></button>' + '<button type="button" class="spinner-down"><i class="img-commonctrl"></i></button>' +
'</div>', '</div>',
initialize : function(options) { initialize : function(options) {
@ -147,19 +144,6 @@ define([
el.on('input', '.form-control', _.bind(this.onInput, this)); el.on('input', '.form-control', _.bind(this.onInput, this));
if (!this.options.allowDecimal) if (!this.options.allowDecimal)
el.on('keypress', '.form-control', _.bind(this.onKeyPress, this)); el.on('keypress', '.form-control', _.bind(this.onKeyPress, this));
el.on('focus', 'input.form-control', function(e) {
setTimeout(function(){
if (me.$input) {
me.$input[0].selectionStart = 0;
me.$input[0].selectionEnd = me.$input.val().length;
}
}, 1);
});
Common.Utils.isGecko && el.on('blur', 'input.form-control', function() {
setTimeout(function(){
me.$input && (me.$input[0].selectionStart = me.$input[0].selectionEnd = 0);
}, 1);
});
this.switches = { this.switches = {
count: 1, count: 1,
@ -193,13 +177,7 @@ define([
render: function () { render: function () {
var el = this.$el || $(this.el); var el = this.$el || $(this.el);
el.html(this.template);
var template = _.template(this.template);
el.html($(template({
dataHint : this.options.dataHint,
dataHintDirection: this.options.dataHintDirection,
dataHintOffset : this.options.dataHintOffset
})));
this.$input = el.find('.form-control'); this.$input = el.find('.form-control');
this.rendered = true; this.rendered = true;
@ -211,7 +189,6 @@ define([
}, },
setDisabled: function(disabled) { setDisabled: function(disabled) {
disabled = !!disabled;
var el = this.$el || $(this.el); var el = this.$el || $(this.el);
if (disabled !== this.disabled) { if (disabled !== this.disabled) {
el.find('button').toggleClass('disabled', disabled); el.find('button').toggleClass('disabled', disabled);
@ -248,16 +225,11 @@ define([
this.options.step = step; this.options.step = step;
}, },
getMinValue: function(){
return this.options.minValue;
},
getMaxValue: function(){
return this.options.maxValue;
},
getNumberValue: function(){ getNumberValue: function(){
return this.checkAutoText(this.value) ? -1 : parseFloat(this.value); if (this.options.allowAuto && this.value==this.options.autoText)
return -1;
else
return parseFloat(this.value);
}, },
getUnitValue: function(){ getUnitValue: function(){
@ -282,10 +254,10 @@ define([
this.lastValue = this.value; this.lastValue = this.value;
if ( typeof value === 'undefined' || value === ''){ if ( typeof value === 'undefined' || value === ''){
this.value = ''; this.value = '';
} else if (this.options.allowAuto && (Math.abs(Common.Utils.String.parseFloat(value)+1.)<0.0001 || this.checkAutoText(value))) { } else if (this.options.allowAuto && (Math.abs(parseFloat(value)+1.)<0.0001 || value==this.options.autoText)) {
this.value = this.options.autoText; this.value = this.options.autoText;
} else { } else {
var number = this._add(Common.Utils.String.parseFloat(value), 0, (this.options.allowDecimal) ? 3 : 0); var number = this._add(parseFloat(value), 0, (this.options.allowDecimal) ? 3 : 0);
if ( typeof value === 'undefined' || isNaN(number)) { if ( typeof value === 'undefined' || isNaN(number)) {
number = this.oldValue; number = this.oldValue;
showError = true; showError = true;
@ -375,7 +347,6 @@ define([
var value = this.getRawValue(); var value = this.getRawValue();
if (this.value != value) { if (this.value != value) {
this.onEnterValue(); this.onEnterValue();
this.trigger('inputleave', this);
return (this.value == value); return (this.value == value);
} }
} else { } else {
@ -384,11 +355,6 @@ define([
} else { } else {
this._fromKeyDown = true; this._fromKeyDown = true;
} }
if (e.keyCode == Common.UI.Keys.ESC)
this.setRawValue(this.value);
if (e.keyCode==Common.UI.Keys.RETURN || e.keyCode==Common.UI.Keys.ESC)
this.trigger('inputleave', this);
}, },
onKeyUp: function (e) { onKeyUp: function (e) {
@ -468,12 +434,12 @@ define([
var val = me.options.step; var val = me.options.step;
if (me._fromKeyDown) { if (me._fromKeyDown) {
val = this.getRawValue(); val = this.getRawValue();
val = _.isEmpty(val) ? me.oldValue : Common.Utils.String.parseFloat(val); val = _.isEmpty(val) ? me.oldValue : parseFloat(val);
} else if(me.getValue() !== '') { } else if(me.getValue() !== '') {
if (me.checkAutoText(me.getValue())) { if (me.options.allowAuto && me.getValue()==me.options.autoText) {
val = me.options.defaultValue-me.options.step; val = me.options.minValue-me.options.step;
} else } else
val = Common.Utils.String.parseFloat(me.getValue()); val = parseFloat(me.getValue());
if (isNaN(val)) if (isNaN(val))
val = this.oldValue; val = this.oldValue;
} else { } else {
@ -489,12 +455,12 @@ define([
var val = me.options.step; var val = me.options.step;
if (me._fromKeyDown) { if (me._fromKeyDown) {
val = this.getRawValue(); val = this.getRawValue();
val = _.isEmpty(val) ? me.oldValue : Common.Utils.String.parseFloat(val); val = _.isEmpty(val) ? me.oldValue : parseFloat(val);
} else if(me.getValue() !== '') { } else if(me.getValue() !== '') {
if (me.checkAutoText(me.getValue())) { if (me.options.allowAuto && me.getValue()==me.options.autoText) {
val = me.options.minValue; val = me.options.minValue;
} else } else
val = Common.Utils.String.parseFloat(me.getValue()); val = parseFloat(me.getValue());
if (isNaN(val)) if (isNaN(val))
val = this.oldValue; val = this.oldValue;
@ -511,8 +477,6 @@ define([
_step: function (type, suspend) { _step: function (type, suspend) {
(type) ? this._increase(suspend) : this._decrease(suspend); (type) ? this._increase(suspend) : this._decrease(suspend);
if (this.options.hold && this.switches.fromKeyDown)
this.$input && this.$input.select();
}, },
_add: function (a, b, precision) { _add: function (a, b, precision) {
@ -557,22 +521,6 @@ define([
v_out = parseFloat((v_out * 6.0 / 25.4).toFixed(6)); v_out = parseFloat((v_out * 6.0 / 25.4).toFixed(6));
return v_out; return v_out;
},
focus: function() {
if (this.$input) this.$input.focus();
},
setDefaultValue: function(value) {
this.options.defaultValue = value;
},
checkAutoText: function(value) {
if (this.options.allowAuto && typeof value == 'string') {
var val = value.toLowerCase();
return (val==this.options.autoText.toLowerCase() || val=='auto');
}
return false;
} }
}); });

View file

@ -52,7 +52,6 @@ define([
var $scrollL; var $scrollL;
var optsFold = {timeout: 2000}; var optsFold = {timeout: 2000};
var config = {}; var config = {};
var btnsMore = [];
var onScrollTabs = function(opts, e) { var onScrollTabs = function(opts, e) {
var sv = $boxTabs.scrollLeft(); var sv = $boxTabs.scrollLeft();
@ -62,11 +61,7 @@ define([
}; };
function onTabDblclick(e) { function onTabDblclick(e) {
var tab = $(e.currentTarget).find('> a[data-tab]').data('tab'); this.fireEvent('change:compact', [$(e.target).data('tab')]);
if ( this.dblclick_el == tab ) {
this.fireEvent('change:compact', [tab]);
this.dblclick_el = undefined;
}
} }
function onShowFullviewPanel(state) { function onShowFullviewPanel(state) {
@ -79,7 +74,7 @@ define([
if ( this.isFolded ) { if ( this.isFolded ) {
if ( $(e.target).parents('.toolbar, #file-menu-panel').length ){ if ( $(e.target).parents('.toolbar, #file-menu-panel').length ){
} else { } else {
optsFold.$bar && optsFold.$bar.hasClass('expanded') && this.collapse(); this.collapse();
} }
} }
} }
@ -94,20 +89,17 @@ define([
var _template_tabs = var _template_tabs =
'<section class="tabs">' + '<section class="tabs">' +
'<a class="scroll left" data-hint="0" data-hint-direction="bottom" data-hint-offset="-7, 0" data-hint-title="V"></a>' + '<a class="scroll left"></a>' +
'<ul>' + '<ul>' +
'<% for(var i in items) { %>' + '<% for(var i in items) { %>' +
'<% if (typeof items[i] == "object") { %>' +
'<li class="ribtab' + '<li class="ribtab' +
'<% if (items[i].haspanel===false) print(" x-lone") %>' + '<% if (items[i].haspanel===false) print(" x-lone") %>' +
'<% if (items[i].extcls) print(\' \' + items[i].extcls) %>"' + '<% if (items[i].extcls) print(\' \' + items[i].extcls) %>">' +
'<% if (typeof items[i].layoutname == "string") print(" data-layout-name=" + \' \' + items[i].layoutname) + \' \' %>>' + '<a data-tab="<%= items[i].action %>" data-title="<%= items[i].caption %>"><%= items[i].caption %></a>' +
'<a data-tab="<%= items[i].action %>" data-title="<%= items[i].caption %>" data-hint="0" data-hint-direction="bottom" data-hint-offset="small" <% if (typeof items[i].dataHintTitle !== "undefined") { %> data-hint-title="<%= items[i].dataHintTitle %>" <% } %>><%= items[i].caption %></a>' +
'</li>' + '</li>' +
'<% } %>' + '<% } %>' +
'<% } %>' +
'</ul>' + '</ul>' +
'<a class="scroll right" data-hint="0" data-hint-direction="bottom" data-hint-offset="-7, 0" data-hint-title="R"></a>' + '<a class="scroll right"></a>' +
'</section>'; '</section>';
this.$layout = $(options.template({ this.$layout = $(options.template({
@ -120,7 +112,6 @@ define([
Common.NotificationCenter.on('tab:visible', _.bind(function(action, visible){ Common.NotificationCenter.on('tab:visible', _.bind(function(action, visible){
this.setVisible(action, visible); this.setVisible(action, visible);
}, this)); }, this));
Common.NotificationCenter.on('tab:resize', _.bind(this.onResizeTabs, this));
}, },
afterRender: function() { afterRender: function() {
@ -128,9 +119,7 @@ define([
$boxTabs = me.$('.tabs > ul'); $boxTabs = me.$('.tabs > ul');
me.$tabs = $boxTabs.find('> li'); me.$tabs = $boxTabs.find('> li');
me.$boxpanels = me.$('.box-panels'); me.$panels = me.$('.box-panels > .panel');
me.$panels = me.$boxpanels.find('> .panel');
optsFold.$bar = me.$('.toolbar'); optsFold.$bar = me.$('.toolbar');
var $scrollR = me.$('.tabs .scroll.right'); var $scrollR = me.$('.tabs .scroll.right');
$scrollL = me.$('.tabs .scroll.left'); $scrollL = me.$('.tabs .scroll.left');
@ -230,7 +219,7 @@ define([
// optsFold.timer = setTimeout(this.collapse, optsFold.timeout); // optsFold.timer = setTimeout(this.collapse, optsFold.timeout);
}, },
onResizeTabs: function(e) { onResize: function(e) {
if ( this.hasTabInvisible() ) { if ( this.hasTabInvisible() ) {
if ( !$boxTabs.parent().hasClass('short') ) if ( !$boxTabs.parent().hasClass('short') )
$boxTabs.parent().addClass('short'); $boxTabs.parent().addClass('short');
@ -238,46 +227,31 @@ define([
if ( $boxTabs.parent().hasClass('short') ) { if ( $boxTabs.parent().hasClass('short') ) {
$boxTabs.parent().removeClass('short'); $boxTabs.parent().removeClass('short');
} }
},
onResize: function(e) {
this.onResizeTabs();
this.hideMoreBtns();
this.processPanelVisible(); this.processPanelVisible();
}, },
onTabClick: function (e) { onTabClick: function (e) {
var me = this; var me = this;
var $target = $(e.currentTarget); var $target = $(e.currentTarget);
var tab = $target.find('> a[data-tab]').data('tab'); var tab = $target.find('> a[data-tab]').data('tab');
if ($target.hasClass('x-lone')) { var islone = $target.hasClass('x-lone');
me.isFolded && me.collapse();
} else {
if ( $target.hasClass('active') ) {
if (!me._timerSetTab) {
me.dblclick_el = tab;
if ( me.isFolded ) { if ( me.isFolded ) {
if ( $target.hasClass('x-lone') ) {
me.collapse(); me.collapse();
setTimeout(function(){ // me.fireEvent('')
me.dblclick_el = undefined; } else
}, 500); if ( $target.hasClass('active') ) {
} me.collapse();
} else {
me.setTab(tab);
me.processPanelVisible(null, true);
} }
} else { } else {
me._timerSetTab = true; if ( !$target.hasClass('active') && !islone ) {
setTimeout(function(){
me._timerSetTab = false;
}, 500);
me.setTab(tab); me.setTab(tab);
// me.processPanelVisible(null, true); me.processPanelVisible(null, true);
if ( !me.isFolded ) {
if ( me.dblclick_timer ) clearTimeout(me.dblclick_timer);
me.dblclick_timer = setTimeout(function () {
me.dblclick_el = tab;
delete me.dblclick_timer;
},500);
} else
me.dblclick_el = tab;
} }
} }
}, },
@ -294,14 +268,11 @@ define([
if ( tab ) { if ( tab ) {
me.$tabs.removeClass('active'); me.$tabs.removeClass('active');
me.$panels.removeClass('active'); me.$panels.removeClass('active');
me.hideMoreBtns();
var panel = this.$panels.filter('[data-tab=' + tab + ']'); var panel = this.$panels.filter('[data-tab=' + tab + ']');
if ( panel.length ) { if ( panel.length ) {
this.lastPanel = tab; this.lastPanel = tab;
panel.addClass('active'); panel.addClass('active');
me.setMoreButton(tab, panel);
me.processPanelVisible(null, true, true);
} }
if ( panel.length ) { if ( panel.length ) {
@ -315,7 +286,6 @@ define([
if ( $tp.length ) { if ( $tp.length ) {
$tp.addClass('active'); $tp.addClass('active');
} }
this.fireEvent('tab:active', [tab]); this.fireEvent('tab:active', [tab]);
} }
}, },
@ -328,7 +298,7 @@ define([
return config.tabs[index].action; return config.tabs[index].action;
} }
var _tabTemplate = _.template('<li class="ribtab" style="display: none;" <% if (typeof layoutname == "string") print(" data-layout-name=" + \' \' + layoutname) + \' \' %>><a data-tab="<%= action %>" data-title="<%= caption %>" data-hint="0" data-hint-direction="bottom" data-hint-offset="small" <% if (typeof dataHintTitle !== "undefined") { %> data-hint-title="<%= dataHintTitle %>" <% } %> ><%= caption %></a></li>'); var _tabTemplate = _.template('<li class="ribtab" style="display: none;"><a data-tab="<%= action %>" data-title="<%= caption %>"><%= caption %></a></li>');
config.tabs[after + 1] = tab; config.tabs[after + 1] = tab;
var _after_action = _get_tab_action(after); var _after_action = _get_tab_action(after);
@ -386,7 +356,7 @@ define([
* hide button's caption to decrease panel width * hide button's caption to decrease panel width
* ##adopt-panel-width * ##adopt-panel-width
**/ **/
processPanelVisible: function(panel, now, force) { processPanelVisible: function(panel, now) {
var me = this; var me = this;
if ( me._timer_id ) clearTimeout(me._timer_id); if ( me._timer_id ) clearTimeout(me._timer_id);
@ -395,78 +365,20 @@ define([
if ( $active && $active.length ) { if ( $active && $active.length ) {
var _maxright = $active.parents('.box-controls').width(); var _maxright = $active.parents('.box-controls').width();
var data = $active.data(), var data = $active.data(),
_rightedge = data.rightedge, _rightedge = data.rightedge;
_btns = data.buttons,
_flex = data.flex;
var more_section = $active.find('.more-box');
if ( !_rightedge ) { if ( !_rightedge ) {
_rightedge = $active.get(0).getBoundingClientRect().right; _rightedge = $active.get(0).getBoundingClientRect().right;
} }
if ( !_btns ) {
_btns = [];
_.each($active.find('.btn-slot .x-huge'), function(item) {
_btns.push($(item).closest('.btn-slot'));
});
data.buttons = _btns;
}
if (!_flex) {
_flex = [];
_.each($active.find('.group.flex'), function(item) {
var el = $(item);
_flex.push({el: el, width: el.attr('data-group-width') || el.attr('max-width')}); //save flex element and it's initial width
});
data.flex = _flex;
}
if ( (_rightedge > _maxright)) {
if (!more_section.is(':visible') ) {
if (_flex.length>0) {
for (var i=0; i<_flex.length; i++) {
var item = _flex[i].el;
_rightedge = $active.get(0).getBoundingClientRect().right;
if (item.outerWidth() > parseInt(item.css('min-width'))) {
data.rightedge = _rightedge;
return;
} else
item.css('width', item.css('min-width'));
}
}
for (var i=_btns.length-1; i>=0; i--) {
var btn = _btns[i];
if ( !btn.hasClass('compactwidth') && !btn.hasClass('slot-btn-more')) {
btn.addClass('compactwidth');
_rightedge = $active.get(0).getBoundingClientRect().right;
if (_rightedge <= _maxright)
break;
}
}
data.rightedge = _rightedge;
}
me.resizeToolbar(force);
} else {
more_section.is(':visible') && me.resizeToolbar(force);
if (!more_section.is(':visible')) {
for (var i=0; i<_btns.length; i++) {
var btn = _btns[i];
if ( btn.hasClass('compactwidth') ) {
btn.removeClass('compactwidth');
_rightedge = $active.get(0).getBoundingClientRect().right;
if ( _rightedge > _maxright ) { if ( _rightedge > _maxright ) {
btn.addClass('compactwidth'); if ( !$active.hasClass('compactwidth') ) {
_rightedge = $active.get(0).getBoundingClientRect().right; $active.addClass('compactwidth');
break;
}
}
}
data.rightedge = _rightedge; data.rightedge = _rightedge;
if (_flex.length>0 && $active.find('.btn-slot.compactwidth').length<1) {
for (var i=0; i<_flex.length; i++) {
var item = _flex[i];
item.el.css('width', item.width);
data.rightedge = $active.get(0).getBoundingClientRect().right;
}
} }
} else {
if ($active.hasClass('compactwidth')) {
$active.removeClass('compactwidth');
} }
} }
} }
@ -494,307 +406,8 @@ define([
}, },
setVisible: function (tab, visible) { setVisible: function (tab, visible) {
if ( tab && this.$tabs ) { if ( tab && this.$tabs )
this.$tabs.find('> a[data-tab=' + tab + ']').parent().css('display', visible ? '' : 'none'); this.$tabs.find('> a[data-tab=' + tab + ']').parent().css('display', visible ? '' : 'none');
this.onResize();
}
},
setMoreButton: function(tab, panel) {
var me = this;
if (!btnsMore[tab]) {
var top = panel.position().top;
var box = $('<div class="more-box" style="position: absolute;right: 0; top:'+ top +'px; padding-left: 12px;padding-right: 6px;display: none;">' +
'<div class="separator long" style="position: relative;display: table-cell;"></div>' +
'<div class="group" style=""><span class="btn-slot text x-huge slot-btn-more"></span></div>' +
'</div>');
panel.append(box);
btnsMore[tab] = new Common.UI.Button({
cls: 'btn-toolbar x-huge icon-top dropdown-manual',
caption: Common.Locale.get("textMoreButton",{name:"Common.Translation", default: "More"}),
iconCls: 'toolbar__icon btn-more',
enableToggle: true
});
btnsMore[tab].render(box.find('.slot-btn-more'));
btnsMore[tab].on('toggle', function(btn, state, e) {
(state) ? me.onMoreShow(btn, e) : me.onMoreHide(btn, e);
Common.NotificationCenter.trigger('more:toggle', btn, state);
});
var moreContainer = $('<div class="dropdown-menu more-container" data-tab="' + tab + '"><div style="display: inline;"></div></div>');
optsFold.$bar.append(moreContainer);
btnsMore[tab].panel = moreContainer.find('div');
}
this.$moreBar = btnsMore[tab].panel;
},
resizeToolbar: function(reset) {
var $active = this.$panels.filter('.active'),
more_section = $active.find('.more-box'),
more_section_width = parseInt(more_section.css('width')) || 0,
box_controls_width = $active.parents('.box-controls').width(),
_maxright = box_controls_width,
_rightedge = $active.get(0).getBoundingClientRect().right,
delta = (this._prevBoxWidth) ? (_maxright - this._prevBoxWidth) : -1,
hideAllMenus = false;
this._prevBoxWidth = _maxright;
more_section.is(':visible') && (_maxright -= more_section_width);
if (this.$moreBar && this.$moreBar.parent().is(':visible')) {
this.$moreBar.parent().css('max-width', Common.Utils.innerWidth());
}
if ( (reset || delta<0) && (_rightedge > _maxright)) { // from toolbar to more section
if (!more_section.is(':visible') ) {
more_section.css('display', "");
_maxright -= parseInt(more_section.css('width'));
}
var last_separator = null,
last_group = null,
prevchild = this.$moreBar.children().filter("[data-hidden-tb-item!=true]");
if (prevchild.length>0) {
prevchild = $(prevchild[0]);
if (prevchild.hasClass('separator'))
last_separator = prevchild;
if (prevchild.hasClass('group') && prevchild.attr('group-state') == 'open')
last_group = prevchild;
}
var items = $active.find('> div:not(.more-box)');
var need_break = false;
for (var i=items.length-1; i>=0; i--) {
var item = $(items[i]);
if (!item.is(':visible') && !item.attr('hidden-on-resize')) { // move invisible items as is and set special attr
item.attr('data-hidden-tb-item', true);
this.$moreBar.prepend(item);
hideAllMenus = true;
} else if (item.hasClass('group')) {
_rightedge = $active.get(0).getBoundingClientRect().right;
if (_rightedge <= _maxright) // stop moving items
break;
var offset = item.offset(),
item_width = item.outerWidth(),
children = item.children();
if (!item.attr('inner-width') && item.attr('group-state') !== 'open') {
item.attr('inner-width', item_width);
for (var j=children.length-1; j>=0; j--) {
var child = $(children[j]);
child.attr('inner-width', child.outerWidth());
}
}
if ((offset.left > _maxright || children.length==1) && item.attr('group-state') != 'open') {
// move group
this.$moreBar.prepend(item);
if (last_separator) {
last_separator.css('display', '');
last_separator.removeAttr('hidden-on-resize');
}
hideAllMenus = true;
} else if ( offset.left+item_width > _maxright ) {
// move buttons from group
for (var j=children.length-1; j>=0; j--) {
var child = $(children[j]);
if (child.hasClass('elset')) {
this.$moreBar.prepend(item);
if (last_separator) {
last_separator.css('display', '');
last_separator.removeAttr('hidden-on-resize');
}
hideAllMenus = true;
break;
} else {
var child_offset = child.offset(),
child_width = child.outerWidth();
if (child_offset.left+child_width>_maxright) {
if (!last_group) {
last_group = $('<div></div>');
last_group.addClass(items[i].className);
var attrs = items[i].attributes;
for (var k = 0; k < attrs.length; k++) {
last_group.attr(attrs[k].name, attrs[k].value);
}
this.$moreBar.prepend(last_group);
if (last_separator) {
last_separator.css('display', '');
last_separator.removeAttr('hidden-on-resize');
}
}
last_group.prepend(child);
hideAllMenus = true;
} else {
need_break = true;
break;
}
}
}
if (item.children().length<1) { // all buttons are moved
item.remove();
last_group && last_group.removeAttr('group-state').attr('inner-width', item.attr('inner-width'));
last_group = null;
} else {
last_group && last_group.attr('group-state', 'open') && item.attr('group-state', 'open');
}
if (need_break)
break;
} else {
break;
}
last_separator = null;
} else if (item.hasClass('separator')) {
this.$moreBar.prepend(item);
item.css('display', 'none');
item.attr('hidden-on-resize', true);
last_separator = item;
hideAllMenus = true;
}
}
} else if ((reset || delta>0) && more_section.is(':visible')) {
var last_separator = null,
last_group = null,
prevchild = $active.find('> div:not(.more-box)');
var last_width = 0;
if (prevchild.length>0) {
prevchild = $(prevchild[prevchild.length-1]);
if (prevchild.hasClass('separator')) {
last_separator = prevchild;
last_width = parseInt(last_separator.css('margin-left')) + parseInt(last_separator.css('margin-right')) + 1;
}
if (prevchild.hasClass('group') && prevchild.attr('group-state') == 'open')
last_group = prevchild;
}
var items = this.$moreBar.children();
if (items.length>0) {
// from more panel to toolbar
for (var i=0; i<items.length; i++) {
var item = $(items[i]);
_rightedge = $active.get(0).getBoundingClientRect().right;
if (!item.is(':visible') && item.attr('data-hidden-tb-item')) { // move invisible items as is
item.removeAttr('data-hidden-tb-item');
more_section.before(item);
if (this.$moreBar.children().filter('.group').length == 0) {
this.hideMoreBtns();
more_section.css('display', "none");
}
} else if (item.hasClass('group')) {
var islast = false;
if (this.$moreBar.children().filter('.group').length == 1) {
_maxright = box_controls_width; // try to move last group
islast = true;
}
var item_width = parseInt(item.attr('inner-width') || 0);
if (_rightedge + last_width + item_width < _maxright && item.attr('group-state') != 'open') {
// move group
more_section.before(item);
if (last_separator) {
last_separator.css('display', '');
last_separator.removeAttr('hidden-on-resize');
}
if (this.$moreBar.children().filter('.group').length == 0) {
this.hideMoreBtns();
more_section.css('display', "none");
}
hideAllMenus = true;
} else if ( _rightedge + last_width < _maxright) {
// move buttons from group
var children = item.children();
_maxright = box_controls_width - more_section_width;
for (var j=0; j<children.length; j++) {
if (islast && j==children.length-1)
_maxright = box_controls_width; // try to move last item from last group
_rightedge = $active.get(0).getBoundingClientRect().right;
var child = $(children[j]);
if (child.hasClass('elset')) { // don't add group - no enough space
need_break = true;
break;
} else {
var child_width = parseInt(child.attr('inner-width') || 0) + (!last_group ? parseInt(item.css('padding-left')) : 0); // if new group is started add left-padding
if (_rightedge+last_width+child_width < _maxright) {
if (!last_group) {
last_group = $('<div></div>');
last_group.addClass(items[i].className);
var attrs = items[i].attributes;
for (var k = 0; k < attrs.length; k++) {
last_group.attr(attrs[k].name, attrs[k].value);
}
if (last_group.hasClass('flex')) { // need to update flex groups list
$active.data().flex = null;
}
more_section.before(last_group);
if (last_separator) {
last_separator.css('display', '');
last_separator.removeAttr('hidden-on-resize');
}
}
last_group.append(child);
hideAllMenus = true;
} else {
need_break = true;
break;
}
}
}
if (item.children().length<1) { // all buttons are moved
item.remove();
last_group && last_group.removeAttr('group-state').attr('inner-width', item.attr('inner-width'));
last_group = null;
if (this.$moreBar.children().filter('.group').length == 0) {
this.hideMoreBtns();
more_section.css('display', "none");
}
} else {
last_group && last_group.attr('group-state', 'open') && item.attr('group-state', 'open');
}
if (need_break)
break;
} else {
break;
}
last_separator = null; last_width = 0;
} else if (item.hasClass('separator')) {
more_section.before(item);
item.css('display', 'none');
item.attr('hidden-on-resize', true);
last_separator = item;
last_width = parseInt(last_separator.css('margin-left')) + parseInt(last_separator.css('margin-right')) + 1;
hideAllMenus = true;
}
}
} else {
this.hideMoreBtns();
more_section.css('display', "none");
}
}
hideAllMenus && Common.UI.Menu.Manager.hideAll();
},
onMoreHide: function(btn, e) {
var moreContainer = btn.panel.parent();
if (btn.pressed) {
btn.toggle(false, true);
}
if (moreContainer.is(':visible')) {
moreContainer.hide();
Common.NotificationCenter.trigger('edit:complete', this.toolbar, btn);
}
},
onMoreShow: function(btn, e) {
var moreContainer = btn.panel.parent(),
parentxy = moreContainer.parent().offset(),
target = btn.$el,
showxy = target.offset(),
right = Common.Utils.innerWidth() - (showxy.left - parentxy.left + target.width()),
top = showxy.top - parentxy.top + target.height() + 10;
moreContainer.css({right: right, left: 'auto', top : top, 'max-width': Common.Utils.innerWidth() + 'px'});
moreContainer.show();
},
hideMoreBtns: function() {
for (var btn in btnsMore) {
btnsMore[btn] && btnsMore[btn].toggle(false);
}
} }
}; };
}())); }()));

View file

@ -55,11 +55,9 @@ define([
values: [0, 100], values: [0, 100],
colorValues: ['#000000', '#ffffff'], colorValues: ['#000000', '#ffffff'],
currentThumb: 0, currentThumb: 0,
includeSnap: true, thumbTemplate: '<div class="thumb img-commonctrl" style="">' +
intervalSnap: 5, '<div class="thumb-top"></div>' +
thumbTemplate: '<div class="thumb" style="">' + '<div class="thumb-bottom"></div>' +
'<div class="thumb-top"><div class="thumb-top-inner"></div></div>' +
'<div class="thumb-bottom"><div class="thumb-bottom-inner"></div></div>' +
'</div>' '</div>'
}, },
@ -148,43 +146,6 @@ define([
return recalc_indexes; return recalc_indexes;
}, },
findLeftThumb: function(pos) {
var me = this,
leftThumb = 100,
index = 0,
len = this.thumbs.length,
dist;
for (var i=0; i<len; i++) {
dist = pos - me.thumbs[i].position;
if (dist > 0 && dist <= leftThumb) {
var above = me.thumbs[i + 1];
var below = me.thumbs[i - 1];
if (below !== undefined && pos < below.position) {
continue;
}
if (above !== undefined && pos > above.position) {
continue;
}
index = i;
leftThumb = dist;
}
}
return index;
},
calculationNewColor: function(color1, color2, ratio) {
var w1 = ratio ? ratio/100 : 0.5;
var w2 = 1 - w1;
var rgbColor1 = Common.Utils.ThemeColor.getRgbColor(color1),
rgbColor2 = Common.Utils.ThemeColor.getRgbColor(color2);
var rgb = [Math.round(rgbColor1.get_r() * w2 + rgbColor2.get_r() * w1),
Math.round(rgbColor1.get_g() * w2 + rgbColor2.get_g() * w1),
Math.round(rgbColor1.get_b() * w2 + rgbColor2.get_b() * w1)];
return Common.Utils.ThemeColor.getHexColor(rgb[0], rgb[1], rgb[2]);
},
addThumb: function() { addThumb: function() {
Common.UI.MultiSlider.prototype.addThumb.call(this); Common.UI.MultiSlider.prototype.addThumb.call(this);
@ -198,37 +159,11 @@ define([
me.changeSliderStyle(); me.changeSliderStyle();
}, },
addNewThumb: function(index, pos, curIndex) {
var me = this,
indexLeftThumb = this.findLeftThumb(pos),
index = index,
color;
if (!_.isUndefined(curIndex)) {
this.addThumb();
index = this.thumbs.length - 1;
color = this.calculationNewColor(this.thumbs[indexLeftThumb].colorValue, this.thumbs[indexLeftThumb === index - 1 ? indexLeftThumb : indexLeftThumb + 1].colorValue);
this.setThumbPosition(index, pos);
var value = pos/this.delta + this.minValue;
this.thumbs[index].value = value;
} else {
var ratio = (pos - this.thumbs[indexLeftThumb].value) * 100 / (this.thumbs[indexLeftThumb + 1].value - this.thumbs[indexLeftThumb].value);
color = ratio < 0 ? this.thumbs[indexLeftThumb].colorValue : this.calculationNewColor(this.thumbs[indexLeftThumb].colorValue, this.thumbs[indexLeftThumb === index - 1 ? indexLeftThumb : indexLeftThumb + 1].colorValue, ratio);
}
me.thumbs[index].thumbcolor = me.thumbs[index].thumb.find('> div');
(index>0) && this.setColorValue('#' + color, index);
me.sortThumbs();
me.changeSliderStyle();
me.changeGradientStyle();
return color;
},
removeThumb: function(index) { removeThumb: function(index) {
if (index===undefined) index = this.thumbs.length-1; if (index===undefined) index = this.thumbs.length-1;
if (this.thumbs.length > 2) { if (index>0) {
this.thumbs[index].thumb.remove(); this.thumbs[index].thumb.remove();
this.thumbs.splice(index, 1); this.thumbs.splice(index, 1);
this.sortThumbs();
this.changeSliderStyle(); this.changeSliderStyle();
} }
}, },

View file

@ -71,21 +71,11 @@ define([
disabled : false, disabled : false,
rendered : false, rendered : false,
template : _.template('<div class="radiobox" data-hint="<%= dataHint %>" data-hint-direction="<%= dataHintDirection %>" data-hint-offset="<%= dataHintOffset %>">' + template : _.template('<label class="radiobox"><input type="button" name="<%= name %>" class="img-commonctrl"><span><%= labelText %></span></label>'),
'<input type="radio" name="<%= name %>" id="<%= id %>" class="button__radiobox">' +
'<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">' +
'<circle class="rb-circle" cx="8" cy="8" r="6.5" />' +
'<circle class="rb-check-mark" cx="8" cy="8" r="4" />' +
'</svg>' +
'<span></span></div>'),
initialize : function(options) { initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options); Common.UI.BaseView.prototype.initialize.call(this, options);
this.dataHint = options.dataHint;
this.dataHintDirection = options.dataHintDirection;
this.dataHintOffset = options.dataHintOffset;
var me = this; var me = this;
this.name = this.options.name || Common.UI.getId(); this.name = this.options.name || Common.UI.getId();
@ -98,32 +88,19 @@ define([
if (this.options.checked!==undefined) if (this.options.checked!==undefined)
this.setValue(this.options.checked, true); this.setValue(this.options.checked, true);
this.setCaption(this.options.labelText);
// handle events // handle events
this.$radio.on('click', _.bind(this.onItemCheck, this));
}, },
render: function () { render: function () {
var el = this.$el || $(this.el); var el = this.$el || $(this.el);
el.html(this.template({ el.html(this.template({
labelText: this.options.labelText, labelText: this.options.labelText,
name: this.name, name: this.name
id: Common.UI.getId('rdb-'),
dataHint: this.dataHint,
dataHintDirection: this.dataHintDirection,
dataHintOffset: this.dataHintOffset
})); }));
this.$radio = el.find('input[type=radio]'); this.$radio = el.find('input[type=button]');
this.$label = el.find('div.radiobox'); this.$label = el.find('label');
this.$span = this.$label.find('span');
this.$label.on({
'keydown': this.onKeyDown.bind(this),
'click': function(e){
if ( !this.disabled )
this.setValue(true);
}.bind(this),});
this.rendered = true; this.rendered = true;
return this; return this;
@ -133,15 +110,9 @@ define([
if (!this.rendered) if (!this.rendered)
return; return;
disabled = !!disabled;
if (disabled !== this.disabled) { if (disabled !== this.disabled) {
this.$label.toggleClass('disabled', disabled);
this.$radio.toggleClass('disabled', disabled); this.$radio.toggleClass('disabled', disabled);
(disabled) ? this.$radio.attr({disabled: disabled}) : this.$radio.removeAttr('disabled'); (disabled) ? this.$radio.attr({disabled: disabled}) : this.$radio.removeAttr('disabled');
if (this.tabindex!==undefined) {
disabled && (this.tabindex = this.$label.attr('tabindex'));
this.$label.attr('tabindex', disabled ? "-1" : this.tabindex);
}
} }
this.disabled = disabled; this.disabled = disabled;
@ -157,9 +128,8 @@ define([
setRawValue: function(value) { setRawValue: function(value) {
var value = (value === true || value === 'true' || value === '1' || value === 1 ); var value = (value === true || value === 'true' || value === '1' || value === 1 );
value && $('input[type=radio][name=' + this.name + ']').removeClass('checked'); $('input[type=button][name=' + this.name + ']').removeClass('checked');
this.$radio.toggleClass('checked', value); this.$radio.toggleClass('checked', value);
this.$radio.prop('checked', value);
}, },
setValue: function(value, suspendchange) { setValue: function(value, suspendchange) {
@ -167,39 +137,18 @@ define([
var lastValue = this.$radio.hasClass('checked'); var lastValue = this.$radio.hasClass('checked');
this.setRawValue(value); this.setRawValue(value);
if (suspendchange !== true && lastValue !== value) if (suspendchange !== true && lastValue !== value)
this.trigger('change', this, this.$radio.is(':checked')); this.trigger('change', this, this.$radio.hasClass('checked'));
} else { } else {
this.options.checked = value; this.options.checked = value;
} }
}, },
getValue: function() { getValue: function() {
return this.$radio.is(':checked'); return this.$radio.hasClass('checked');
}, },
setCaption: function(text) { setCaption: function(text) {
this.$span.text(text); this.$label.find('span').text(text);
this.$span.css('visibility', text ? 'visible' : 'hidden');
},
onKeyDown: function(e) {
if (e.isDefaultPrevented())
return;
if (e.keyCode === Common.UI.Keys.SPACE)
this.onItemCheck(e);
},
focus: function() {
this.$label && this.$label.focus();
},
setTabIndex: function(tabindex) {
if (!this.rendered)
return;
this.tabindex = tabindex.toString();
!this.disabled && this.$label.attr('tabindex', this.tabindex);
} }
}); });
}); });

View file

@ -82,16 +82,19 @@ define([
maxValue: 100, maxValue: 100,
step: 1, step: 1,
value: 100, value: 100,
enableKeyEvents: false, enableKeyEvents: false
direction: 'horizontal' // 'vertical'
}, },
disabled: false, disabled: false,
template : _.template([ template : _.template([
'<div class="slider single-slider <% if (this.options.direction === \'vertical\') { %>vertical<% } %>" style="">', '<div class="slider single-slider" style="">',
'<div class="track"></div>', '<div class="track">',
'<div class="thumb" style=""></div>', '<div class="track-left img-commonctrl"></div>',
'<div class="track-center img-commonctrl"></div>',
'<div class="track-right img-commonctrl" style=""></div>',
'</div>',
'<div class="thumb img-commonctrl" style=""></div>',
'<% if (this.options.enableKeyEvents) { %>', '<% if (this.options.enableKeyEvents) { %>',
'<input type="text" style="position: absolute; top:-10px; width: 1px; height: 1px;">', '<input type="text" style="position: absolute; top:-10px; width: 1px; height: 1px;">',
'<% } %>', '<% } %>',
@ -108,7 +111,6 @@ define([
me.maxValue = me.options.maxValue; me.maxValue = me.options.maxValue;
me.delta = 100/(me.maxValue - me.minValue); me.delta = 100/(me.maxValue - me.minValue);
me.step = me.options.step; me.step = me.options.step;
me.direction = me.options.direction;
if (me.options.el) { if (me.options.el) {
me.render(); me.render();
@ -135,7 +137,7 @@ define([
} }
this.cmpEl.find('.track-center').width(me.options.width - 14); this.cmpEl.find('.track-center').width(me.options.width - 14);
this.cmpEl[me.direction === 'vertical' ? 'height' : 'width'](me.options.width); this.cmpEl.width(me.options.width);
this.thumb = this.cmpEl.find('.thumb'); this.thumb = this.cmpEl.find('.thumb');
@ -143,9 +145,7 @@ define([
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
var pos = Math.max(0, Math.min(100, (Math.round(( var pos = Math.max(0, Math.min(100, (Math.round((e.pageX*Common.Utils.zoom() - me.cmpEl.offset().left - me._dragstart) / me.width * 100))));
me.direction === 'vertical' ? (e.pageY*Common.Utils.zoom() - me.cmpEl.offset().top) : (e.pageX*Common.Utils.zoom() - me.cmpEl.offset().left) - me._dragstart
) / me.width * 100))));
me.setThumbPosition(pos); me.setThumbPosition(pos);
me.lastValue = me.value; me.lastValue = me.value;
@ -166,9 +166,7 @@ define([
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
var pos = Math.max(0, Math.min(100, (Math.round(( var pos = Math.max(0, Math.min(100, (Math.round((e.pageX*Common.Utils.zoom() - me.cmpEl.offset().left - me._dragstart) / me.width * 100))));
me.direction === 'vertical' ? (e.pageY*Common.Utils.zoom() - me.cmpEl.offset().top) : (e.pageX*Common.Utils.zoom() - me.cmpEl.offset().left) - me._dragstart
) / me.width * 100))));
me.setThumbPosition(pos); me.setThumbPosition(pos);
me.lastValue = me.value; me.lastValue = me.value;
@ -180,7 +178,7 @@ define([
var onMouseDown = function (e) { var onMouseDown = function (e) {
if ( me.disabled ) return; if ( me.disabled ) return;
me._dragstart = me.direction === 'vertical' ? (e.pageY*Common.Utils.zoom() - me.thumb.offset().top) : (e.pageX*Common.Utils.zoom() - me.thumb.offset().left) - 7; me._dragstart = e.pageX*Common.Utils.zoom() - me.thumb.offset().left - 7;
me.thumb.addClass('active'); me.thumb.addClass('active');
$(document).on('mouseup', onMouseUp); $(document).on('mouseup', onMouseUp);
@ -193,9 +191,7 @@ define([
var onTrackMouseDown = function (e) { var onTrackMouseDown = function (e) {
if ( me.disabled ) return; if ( me.disabled ) return;
var pos = Math.max(0, Math.min(100, (Math.round(( var pos = Math.max(0, Math.min(100, (Math.round((e.pageX*Common.Utils.zoom() - me.cmpEl.offset().left) / me.width * 100))));
me.direction === 'vertical' ? (e.pageY*Common.Utils.zoom() - me.cmpEl.offset().top) : (e.pageX*Common.Utils.zoom() - me.cmpEl.offset().left)
) / me.width * 100))));
me.setThumbPosition(pos); me.setThumbPosition(pos);
me.lastValue = me.value; me.lastValue = me.value;
@ -253,12 +249,8 @@ define([
return this; return this;
}, },
setThumbPosition: function(pos) { setThumbPosition: function(x) {
if (this.direction === 'vertical') { this.thumb.css({left: x + '%'});
this.thumb.css({top: pos + '%'});
} else {
this.thumb.css({left: pos + '%'});
}
}, },
setValue: function(value) { setValue: function(value) {
@ -272,7 +264,6 @@ define([
}, },
setDisabled: function(disabled) { setDisabled: function(disabled) {
disabled = !!disabled;
if (disabled !== this.disabled) if (disabled !== this.disabled)
this.cmpEl.toggleClass('disabled', disabled); this.cmpEl.toggleClass('disabled', disabled);
this.disabled = disabled; this.disabled = disabled;
@ -286,8 +277,6 @@ define([
minValue: 0, minValue: 0,
maxValue: 100, maxValue: 100,
values: [0, 100], values: [0, 100],
includeSnap: false,
intervalSnap: undefined,
thumbTemplate: '<div class="thumb" style=""></div>' thumbTemplate: '<div class="thumb" style=""></div>'
}, },
@ -315,9 +304,8 @@ define([
me.minValue = me.options.minValue; me.minValue = me.options.minValue;
me.maxValue = me.options.maxValue; me.maxValue = me.options.maxValue;
me.delta = 100/(me.maxValue - me.minValue); me.delta = 100/(me.maxValue - me.minValue);
me.includeSnap = me.options.includeSnap;
me.intervalSnap = me.options.intervalSnap;
me.thumbs = []; me.thumbs = [];
if (me.options.el) { if (me.options.el) {
me.render(); me.render();
} }
@ -346,38 +334,9 @@ define([
el.find('.track-center').width(me.options.width - 14); el.find('.track-center').width(me.options.width - 14);
el.width(me.options.width); el.width(me.options.width);
var setCenters = function (index) {
if(!me.includeSnap) return;
var n = me.minValue;
var getX = function (position) {
return (0.01 * me.width * position + me.cmpEl.offset().left + me._dragstart)/Common.Utils.zoom();
};
me.centers = [];
_.each(me.thumbs, function (thumb, indexT) {
if ((indexT != index) && (n != thumb.position)) {
me.centers.push(getX((thumb.position - n) / 2 + n));
n = thumb.position;
}
});
if(n != me.maxValue) me.centers.push(getX((me.maxValue - n) / 2 + n));
};
var resetPageX = function (e) {
if(!me.includeSnap) return;
_.each(me.centers, function (x) {
if((e.pageX <= x + me.intervalSnap) && (e.pageX >= x - me.intervalSnap)) {
e.pageX = x;
return;
}
});
};
var onMouseUp = function (e) { var onMouseUp = function (e) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
resetPageX(e);
var index = e.data.index, var index = e.data.index,
lastValue = me.thumbs[index].value, lastValue = me.thumbs[index].value,
@ -388,26 +347,17 @@ define([
pos = Math.max(0, Math.min(100, position)), pos = Math.max(0, Math.min(100, position)),
value = pos/me.delta + me.minValue; value = pos/me.delta + me.minValue;
if (me.thumbs.length < 3)
me.isRemoveThumb = false;
if (me.isRemoveThumb) {
me.trigger('removethumb', me, _.findIndex(me.thumbs, {index: index}));
me.trigger('change', me, value, lastValue);
me.trigger('changecomplete', me, value, lastValue);
} else {
me.setThumbPosition(index, pos); me.setThumbPosition(index, pos);
me.thumbs[index].value = value; me.thumbs[index].value = value;
if (need_sort) if (need_sort)
me.sortThumbs(); me.sortThumbs();
}
$(document).off('mouseup', me.binding.onMouseUp); $(document).off('mouseup', me.binding.onMouseUp);
$(document).off('mousemove', me.binding.onMouseMove); $(document).off('mousemove', me.binding.onMouseMove);
me._dragstart = undefined; me._dragstart = undefined;
!me.isRemoveThumb && me.trigger('changecomplete', me, value, lastValue); me.trigger('changecomplete', me, value, lastValue);
me.isRemoveThumb = undefined;
}; };
var onMouseMove = function (e) { var onMouseMove = function (e) {
@ -416,7 +366,6 @@ define([
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
resetPageX(e);
var index = e.data.index, var index = e.data.index,
lastValue = me.thumbs[index].value, lastValue = me.thumbs[index].value,
@ -433,10 +382,6 @@ define([
if (need_sort) if (need_sort)
me.sortThumbs(); me.sortThumbs();
var positionY = e.pageY*Common.Utils.zoom() - me.cmpEl.offset().top;
me.isRemoveThumb = positionY > me.cmpEl.height() || positionY < 0;
me.setRemoveThumb(index, me.isRemoveThumb);
if (Math.abs(value-lastValue)>0.001) if (Math.abs(value-lastValue)>0.001)
me.trigger('change', me, value, lastValue); me.trigger('change', me, value, lastValue);
}; };
@ -448,7 +393,6 @@ define([
thumb = me.thumbs[index].thumb; thumb = me.thumbs[index].thumb;
me._dragstart = e.pageX*Common.Utils.zoom() - thumb.offset().left - thumb.width()/2; me._dragstart = e.pageX*Common.Utils.zoom() - thumb.offset().left - thumb.width()/2;
setCenters(index);
me.setActiveThumb(index); me.setActiveThumb(index);
_.each(me.thumbs, function (item, idx) { _.each(me.thumbs, function (item, idx) {
@ -459,26 +403,7 @@ define([
$(document).on('mousemove', null, e.data, me.binding.onMouseMove); $(document).on('mousemove', null, e.data, me.binding.onMouseMove);
}; };
var onTrackMouseDown = function (e) {
var onTrackMouseUp = function (e) {
if ( me.disabled || !_.isUndefined(me._dragstart) || me.thumbs.length > 9) return;
var pos = Math.max(0, Math.min(100, (Math.round((e.pageX*Common.Utils.zoom() - me.cmpEl.offset().left) / me.width * 100)))),
nearIndex = findThumb(pos),
thumbColor = me.thumbs[nearIndex].colorValue,
thumbValue = me.thumbs[nearIndex].value,
value = pos/me.delta + me.minValue;
me.addThumb();
var index = me.thumbs.length - 1;
me.setThumbPosition(index, pos);
me.thumbs[index].value = value;
me.trigger('addthumb', me, index, pos);
me.trigger('change', me);
me.trigger('changecomplete', me);
};
/*var onTrackMouseDown = function (e) {
if ( me.disabled ) return; if ( me.disabled ) return;
var pos = Math.max(0, Math.min(100, (Math.round((e.pageX*Common.Utils.zoom() - me.cmpEl.offset().left) / me.width * 100)))), var pos = Math.max(0, Math.min(100, (Math.round((e.pageX*Common.Utils.zoom() - me.cmpEl.offset().left) / me.width * 100)))),
@ -491,7 +416,7 @@ define([
me.trigger('change', me, value, lastValue); me.trigger('change', me, value, lastValue);
me.trigger('changecomplete', me, value, lastValue); me.trigger('changecomplete', me, value, lastValue);
};*/ };
var findThumb = function(pos) { var findThumb = function(pos) {
var nearest = 100, var nearest = 100,
@ -537,8 +462,7 @@ define([
me.setActiveThumb(0, true); me.setActiveThumb(0, true);
if (!me.rendered) { if (!me.rendered) {
/*el.on('mousedown', '.track', onTrackMouseDown);*/ el.on('mousedown', '.track', onTrackMouseDown);
el.on('mouseup', '.track', onTrackMouseUp);
} }
me.rendered = true; me.rendered = true;
@ -548,23 +472,11 @@ define([
setActiveThumb: function(index, suspend) { setActiveThumb: function(index, suspend) {
this.currentThumb = index; this.currentThumb = index;
this.$thumbs = this.cmpEl.find('.thumb');
this.$thumbs.removeClass('active'); this.$thumbs.removeClass('active');
this.thumbs[index].thumb.addClass('active'); this.thumbs[index].thumb.addClass('active');
if (suspend!==true) this.trigger('thumbclick', this, index); if (suspend!==true) this.trigger('thumbclick', this, index);
}, },
setRemoveThumb: function(index, remove) {
var ind = _.findIndex(this.thumbs, {index: index});
if (ind !== -1) {
if (remove && this.thumbs.length > 2) {
this.$el.find('.active').addClass('remove');
} else {
this.$el.find('.remove').removeClass('remove');
}
}
},
setThumbPosition: function(index, x) { setThumbPosition: function(index, x) {
this.thumbs[index].position = x; this.thumbs[index].position = x;
this.thumbs[index].thumb.css({left: x + '%'}); this.thumbs[index].thumb.css({left: x + '%'});
@ -589,7 +501,6 @@ define([
}, },
setDisabled: function(disabled) { setDisabled: function(disabled) {
disabled = !!disabled;
if (disabled !== this.disabled) if (disabled !== this.disabled)
this.cmpEl.toggleClass('disabled', disabled); this.cmpEl.toggleClass('disabled', disabled);
this.disabled = disabled; this.disabled = disabled;

View file

@ -43,28 +43,21 @@ define([
options : { options : {
target : $(document.body), target : $(document.body),
text : '', text : '',
placement: 'right-bottom', placement: 'right',
showLink: true, showLink: true
showButton: false,
closable: true
}, },
template: _.template([ template: _.template([
'<div class="synch-tip-root <% if (!!scope.options.extCls) {print(scope.options.extCls + \" \");} %><%= scope.placement %>" style="<%= scope.style %>">', '<div class="synch-tip-root <% if (!!scope.options.extCls) {print(scope.options.extCls + \" \");} %><%= scope.placement %>">',
'<div class="asc-synchronizetip">', '<div class="asc-synchronizetip">',
'<div class="tip-arrow <%= scope.placement %>"></div>', '<div class="tip-arrow <%= scope.placement %>"></div>',
'<div>', '<div>',
'<div class="tip-text"><%= scope.text %></div>', '<div class="tip-text" style="width: 260px;"><%= scope.text %></div>',
'<% if ( scope.closable ) { %>', '<div class="close img-commonctrl"></div>',
'<div class="close"></div>',
'<% } %>',
'</div>', '</div>',
'<% if ( scope.showLink ) { %>', '<% if ( scope.showLink ) { %>',
'<div class="show-link"><label><%= scope.textLink %></label></div>', '<div class="show-link"><label><%= scope.textLink %></label></div>',
'<% } %>', '<% } %>',
'<% if ( scope.showButton ) { %>',
'<div class="btn-div"><%= scope.textButton %></div>',
'<% } %>',
'</div>', '</div>',
'</div>' '</div>'
].join('')), ].join('')),
@ -76,13 +69,8 @@ define([
this.target = this.options.target; this.target = this.options.target;
this.text = !_.isEmpty(this.options.text) ? this.options.text : this.textSynchronize; this.text = !_.isEmpty(this.options.text) ? this.options.text : this.textSynchronize;
this.textLink = !_.isEmpty(this.options.textLink) ? this.options.textLink : this.textDontShow; this.textLink = !_.isEmpty(this.options.textLink) ? this.options.textLink : this.textDontShow;
this.placement = this.options.placement; // if placement='target' and position is undefined show in top,left position of target, also use for arrow position this.placement = this.options.placement;
this.showLink = this.options.showLink; this.showLink = this.options.showLink;
this.showButton = this.options.showButton;
this.closable = this.options.closable;
this.textButton = this.options.textButton || '';
this.position = this.options.position; // show in the position relative to target
this.style = this.options.style || '';
}, },
render: function() { render: function() {
@ -91,9 +79,6 @@ define([
$(document.body).append(this.cmpEl); $(document.body).append(this.cmpEl);
this.cmpEl.find('.close').on('click', _.bind(function() { this.trigger('closeclick');}, this)); this.cmpEl.find('.close').on('click', _.bind(function() { this.trigger('closeclick');}, this));
this.cmpEl.find('.show-link label').on('click', _.bind(function() { this.trigger('dontshowclick');}, this)); this.cmpEl.find('.show-link label').on('click', _.bind(function() { this.trigger('dontshowclick');}, this));
this.cmpEl.find('.btn-div').on('click', _.bind(function() { this.trigger('buttonclick');}, this));
this.closable && this.cmpEl.addClass('closable');
} }
this.applyPlacement(); this.applyPlacement();
@ -111,7 +96,6 @@ define([
hide: function() { hide: function() {
if (this.cmpEl) this.cmpEl.hide(); if (this.cmpEl) this.cmpEl.hide();
this.trigger('hide');
}, },
close: function() { close: function() {
@ -119,70 +103,19 @@ define([
}, },
applyPlacement: function () { applyPlacement: function () {
var target = this.target && this.target.length>0 ? this.target : $(document.body); var showxy = this.target.offset(),
var showxy = target.offset(); innerHeight = Common.Utils.innerHeight();
if (this.placement=='target' && !this.position) { if (this.placement == 'top')
this.cmpEl.css({top : showxy.top + 5 + 'px', left: showxy.left + 5 + 'px'}); this.cmpEl.css({bottom : innerHeight - showxy.top + 'px', right: Common.Utils.innerWidth() - showxy.left - this.target.width()/2 + 'px'});
return; else {// left or right
} var top = showxy.top + this.target.height()/2,
height = this.cmpEl.height();
if (this.position && typeof this.position == 'object') { if (top+height>innerHeight)
var top = this.position.top, left = this.position.left, bottom = this.position.bottom, right = this.position.right; top = innerHeight - height;
if (bottom!==undefined || top!==undefined) if (this.placement == 'left')
left = showxy.left + (target.width() - this.cmpEl.width())/2; this.cmpEl.css({top : top + 'px', right: Common.Utils.innerWidth() - showxy.left - 5 + 'px'});
else else
top = showxy.top + (target.height() - this.cmpEl.height())/2; this.cmpEl.css({top : top + 'px', left: showxy.left + this.target.width() + 'px'});
top = (top!==undefined) ? (top + 'px') : 'auto';
bottom = (bottom!==undefined) ? (bottom + 'px') : 'auto';
right = (right!==undefined) ? (right + 'px') : 'auto';
left = (left!==undefined) ? (left + 'px') : 'auto';
this.cmpEl.css({top : top, left: left, right: right, bottom: bottom});
return;
}
var placement = this.placement.split('-');
if (placement.length>0) {
var top, left, bottom, right;
var pos = placement[0];
if (pos=='top') {
bottom = Common.Utils.innerHeight() - showxy.top;
} else if (pos == 'bottom') {
top = showxy.top + target.height();
} else if (pos == 'left') {
right = Common.Utils.innerWidth() - showxy.left;
} else if (pos == 'right') {
left = showxy.left + target.width();
}
pos = placement[1];
if (pos=='top') {
bottom = Common.Utils.innerHeight() - showxy.top - target.height()/2;
} else if (pos == 'bottom') {
top = showxy.top + target.height()/2;
var height = this.cmpEl.height();
if (top+height>Common.Utils.innerHeight())
top = Common.Utils.innerHeight() - height - 10;
} else if (pos == 'left') {
right = Common.Utils.innerWidth() - showxy.left - target.width()/2;
} else if (pos == 'right') {
left = showxy.left + target.width()/2;
} else {
if (bottom!==undefined || top!==undefined)
left = showxy.left + (target.width() - this.cmpEl.width())/2;
else
top = showxy.top + (target.height() - this.cmpEl.height())/2;
}
top = (top!==undefined) ? (top + 'px') : 'auto';
bottom = (bottom!==undefined) ? (bottom + 'px') : 'auto';
right = (right!==undefined) ? (right + 'px') : 'auto';
if (left!==undefined) {
var width = this.cmpEl.width();
if (left+width>Common.Utils.innerWidth())
left = Common.Utils.innerWidth() - width - 10;
left = (left + 'px');
} else
left = 'auto';
this.cmpEl.css({top : top, left: left, right: right, bottom: bottom});
} }
}, },
@ -191,7 +124,7 @@ define([
}, },
textDontShow : 'Don\'t show this message again', textDontShow : 'Don\'t show this message again',
textSynchronize : 'The document has been changed by another user.<br>Please click to save your changes and reload the updates.' textSynchronize : 'The document has been changed by another user.<br/>Please click to save your changes and reload the updates.'
} }
})(), Common.UI.SynchronizeTip || {})); })(), Common.UI.SynchronizeTip || {}));
}); });

View file

@ -51,15 +51,8 @@ define([
this.active = false; this.active = false;
this.label = 'Tab'; this.label = 'Tab';
this.cls = ''; this.cls = '';
this.iconCls = ''; this.template = _.template(['<li class="<% if(active){ %>active<% } %> <% if(cls.length){%><%= cls %><%}%>" data-label="<%= label %>">',
this.iconVisible = false; '<a><%- label %></a>',
this.iconTitle = '';
this.index = -1;
this.template = _.template(['<li class="list-item <% if(active){ %>active selected<% } %> <% if(cls.length){%><%= cls %><%}%><% if(iconVisible){%> icon-visible <%}%>" data-label="<%- label %>">',
'<span title="<%- label %>" draggable="true" oo_editor_input="true" tabindex="-1" data-index="<%= index %>">',
'<div class="toolbar__icon <% if(iconCls.length){%><%= iconCls %><%}%>" title="<% if(iconTitle.length){%><%=iconTitle%><%}%>"></div>',
'<%- label %>',
'</span>',
'</li>'].join('')); '</li>'].join(''));
this.initialize.call(this, opts); this.initialize.call(this, opts);
@ -89,10 +82,6 @@ define([
this.$el.addClass('active'); this.$el.addClass('active');
}, },
isSelected: function() {
return this.$el.hasClass('selected');
},
deactivate: function(){ deactivate: function(){
this.$el.removeClass('active'); this.$el.removeClass('active');
}, },
@ -121,27 +110,12 @@ define([
this.$el.removeClass(cls); this.$el.removeClass(cls);
}, },
toggleClass: function(cls) {
if (cls.length)
this.$el.toggleClass(cls);
},
hasClass: function(cls) { hasClass: function(cls) {
return this.$el.hasClass(cls); return this.$el.hasClass(cls);
}, },
setCaption: function(text) { setCaption: function(text) {
this.$el.find('> span').text(text); this.$el.find('> a').text(text);
},
changeIconState: function(visible, title) {
if (this.iconCls.length) {
this.iconVisible = visible;
this.iconTitle = title || '';
this[visible ? 'addClass' : 'removeClass']('icon-visible');
if (title)
this.$el.find('.' + this.iconCls).attr('title', title);
}
} }
}); });

View file

@ -69,28 +69,12 @@ define([
}; };
StateManager.prototype.attach = function (tab) { StateManager.prototype.attach = function (tab) {
tab.changeState = $.proxy(function (select) { tab.changeState = $.proxy(function () {
if (select) {
tab.toggleClass('selected');
var selectTab = _.find(this.bar.selectTabs, function (item) {return item.sheetindex === tab.sheetindex;});
if (selectTab) {
this.bar.selectTabs = _.without(this.bar.selectTabs, selectTab);
} else {
this.bar.selectTabs.push(tab);
}
} else {
if (!tab.isSelected()) {
this.bar.$el.find('ul > li.selected').removeClass('selected');
tab.addClass('selected');
this.bar.selectTabs.length = 0;
this.bar.selectTabs.push(tab);
}
this.trigger('tab:change', tab); this.trigger('tab:change', tab);
this.bar.$el.find('ul > li.active').removeClass('active'); this.bar.$el.find('ul > li.active').removeClass('active');
tab.activate(); tab.activate();
this.bar.trigger('tab:changed', this.bar, this.bar.tabs.indexOf(tab), tab); this.bar.trigger('tab:changed', this.bar, this.bar.tabs.indexOf(tab), tab);
}
}, this); }, this);
var dragHelper = new (function() { var dragHelper = new (function() {
@ -103,8 +87,6 @@ define([
var me = this, var me = this,
length = me.bar.tabs.length, length = me.bar.tabs.length,
barBounds = me.bar.$bar.get(0).getBoundingClientRect(); barBounds = me.bar.$bar.get(0).getBoundingClientRect();
me.leftBorder = barBounds.left;
me.rightBorder = barBounds.right;
if (barBounds) { if (barBounds) {
me.bounds = []; me.bounds = [];
@ -115,155 +97,214 @@ define([
this.bounds.push(me.bar.tabs[i].$el.get(0).getBoundingClientRect()); this.bounds.push(me.bar.tabs[i].$el.get(0).getBoundingClientRect());
} }
me.lastTabRight = me.bounds[length - 1].right;
me.tabBarLeft = me.bounds[0].left; me.tabBarLeft = me.bounds[0].left;
me.tabBarRight = me.bounds[length - 1].right; me.tabBarRight = me.bounds[length - 1].right;
me.tabBarRight = Math.min(me.tabBarRight, barBounds.right - 1); me.tabBarRight = Math.min(me.tabBarRight, barBounds.right - 1);
} }
},
setAbsTabs: function () {
var me = this, tab = null, length = this.bounds.length;
for (var i = 0; i < length; ++i) {
tab = me.bar.tabs[i].$el;
tab.css('position', 'absolute');
tab.css('left', (me.bounds[i].left - me.tabBarLeft - this.scrollLeft) + 'px');
if (tab.hasClass('active')) {
tab.css('top', '1px');
} else {
tab.css('top', '0px');
}
}
},
updatePositions: function () {
this.drag.place = undefined;
var i, tabBound, center, place = -1, next = -this.scrollLeft,
tabsCount = this.bounds.length,
dragBound = this.drag.tab.$el.get(0).getBoundingClientRect();
if (this.drag.moveX - this.drag.mouseX > 0) {
for (i = tabsCount - 1; i >= 0; --i) {
tabBound = this.bounds[i];
center = (tabBound.right + tabBound.left) * 0.5;
if (dragBound.left < center && center < dragBound.right) {
place = i;
break;
}
}
if (-1 === place) {
for (i = tabsCount - 1; i >= 0; --i) {
tabBound = dragBound;
center = (tabBound.right + tabBound.left) * 0.5;
if (this.bounds[i].left < center && center < this.bounds[i].right) {
place = i;
break;
}
}
}
} else {
for (i = 0; i < tabsCount; ++i) {
tabBound = this.bounds[i];
center = (tabBound.right + tabBound.left) * 0.5;
if (dragBound.left < center && center < dragBound.right) {
place = i;
break;
}
}
if (-1 === place) {
for (i = 0; i < tabsCount; ++i) {
tabBound = dragBound;
center = (tabBound.right + tabBound.left) * 0.5;
if (this.bounds[i].left < center && center < this.bounds[i].right) {
place = i;
break;
}
}
}
}
if (-1 !== place) {
this.drag.place = place;
for (i = 0; i < tabsCount; ++i) {
if (i === place) {
if (place < this.drag.index) {
next += this.drag.tabWidth;
}
}
if (place > this.drag.index) {
if (i === place + 1) {
next += this.drag.tabWidth;
}
}
if (i !== this.drag.index) {
this.bar.tabs[i].$el.css('left', next + 'px');
} else {
if (this.drag.index === place) {
next += this.drag.tabWidth;
}
continue;
}
next += this.bounds[i].width;
}
}
},
setHook: function(e, bar, tab) {
var me = this;
function dragComplete() {
if (!_.isUndefined(me.drag)) {
me.drag.tab.removeClass('dragged');
me.drag.tab.$el.css('z-index', '');
me.bar.dragging = false;
var tab = null;
for (var i = me.bar.tabs.length - 1; i >= 0; --i) {
tab = me.bar.tabs[i].$el;
if (tab) {
tab.css('top', '');
tab.css('position', '');
tab.css('left', '');
}
}
if (!_.isUndefined(me.drag.place)) {
me.bar.trigger('tab:move', me.drag.index, me.drag.place);
me.bar.$bar.scrollLeft(me.scrollLeft);
me.bar.scrollX = undefined;
} else {
me.bar.trigger('tab:move', me.drag.index);
me.bar.$bar.scrollLeft(me.scrollLeft);
me.bar.scrollX = undefined;
}
me.drag = undefined;
}
}
function dragMove (e) {
if (!_.isUndefined(me.drag)) {
me.drag.moveX = e.clientX*Common.Utils.zoom();
var leftPos = Math.max(me.drag.moveX - me.drag.anchorX - me.tabBarLeft - me.scrollLeft, 0);
leftPos = Math.min(leftPos, me.tabBarRight - me.tabBarLeft - me.drag.tabWidth - me.scrollLeft);
me.drag.tab.$el.css('left', leftPos + 'px');
me.drag.tab.$el.css('z-index','100');
me.updatePositions();
}
}
function dragDropText (e) { // disable firefox drag&drop
e.preventDefault();
}
if (!_.isUndefined(bar) && !_.isUndefined(tab) && bar.tabs.length > 1) {
tab.addClass('dragged');
var index = bar.tabs.indexOf(tab),
_clientX = e.clientX*Common.Utils.zoom();
me.bar = bar;
me.drag = {tab: tab, index: index};
bar.dragging = true;
this.calculateBounds();
this.setAbsTabs();
me.drag.moveX = _clientX;
me.drag.mouseX = _clientX;
me.drag.anchorX = _clientX - this.bounds[index].left;
me.drag.tabWidth = this.bounds[index].width;
document.addEventListener('dragstart',dragDropText);
$(document).on('mousemove.tabbar', dragMove);
$(document).on('mouseup.tabbar', function (e) {
dragComplete(e);
$(document).off('mouseup.tabbar');
$(document).off('mousemove.tabbar');
document.removeEventListener('dragstart',dragDropText);
});
}
} }
} }
}); });
tab.$el.on({ tab.$el.on({
click: $.proxy(function (event) { click: $.proxy(function () {
if (!tab.disabled) { if (!tab.disabled && !tab.$el.hasClass('active')) {
if (event.ctrlKey || event.metaKey) {
if (!tab.isActive()) {
tab.changeState(true);
}
} else if (event.shiftKey) {
this.bar.$el.find('ul > li.selected').removeClass('selected');
this.bar.selectTabs.length = 0;
var $active = this.bar.$el.find('ul > li.active'),
indexAct = $active.index(),
indexCur = this.bar.tabs.indexOf(tab);
var startIndex = (indexCur > indexAct) ? indexAct : indexCur,
endIndex = (indexCur > indexAct) ? indexCur : indexAct;
for (var i = startIndex; i <= endIndex; i++) {
this.bar.tabs[i].changeState(true);
}
} else if (!tab.$el.hasClass('active')) {
if (this.bar.tabs.length === this.bar.selectTabs.length) {
this.bar.$el.find('ul > li.selected').removeClass('selected');
this.bar.selectTabs.length = 0;
}
if (tab.control == 'manual') { if (tab.control == 'manual') {
this.bar.trigger('tab:manual', this.bar, this.bar.tabs.indexOf(tab), tab); this.bar.trigger('tab:manual', this.bar, this.bar.tabs.indexOf(tab), tab);
} else { } else {
tab.changeState(); tab.changeState();
if (this.bar.isEditFormula)
setTimeout(function(){
$('#ce-cell-content').focus();
var $cellContent = $('#ce-cell-content')[0];
$cellContent.selectionStart = $cellContent.selectionEnd = $cellContent.value.length;
}, 500);
} }
} }
} !tab.disabled && Common.NotificationCenter.trigger('edit:complete', this.bar);
!tab.disabled && Common.NotificationCenter.trigger('edit:complete', 'tab');
}, this), }, this),
dblclick: $.proxy(function() { dblclick: $.proxy(function() {
this.trigger('tab:dblclick', this, this.tabs.indexOf(tab), tab); this.trigger('tab:dblclick', this, this.tabs.indexOf(tab), tab);
}, this.bar), }, this.bar),
contextmenu: $.proxy(function () { contextmenu: $.proxy(function () {
this.trigger('tab:contextmenu', this, this.tabs.indexOf(tab), tab, this.selectTabs); this.trigger('tab:contextmenu', this, this.tabs.indexOf(tab), tab);
}, this.bar), }, this.bar),
mousedown: $.proxy(function (e) { mousedown: $.proxy(function (e) {
if ((3 !== e.which) && !e.shiftKey) { if (this.bar.options.draggable && !_.isUndefined(dragHelper) && (3 !== e.which)) {
var lockDrag = tab.isLockTheDrag; if (!tab.isLockTheDrag) {
this.bar.selectTabs.forEach(function (item) { dragHelper.setHook(e, this.bar, tab);
if (item.isLockTheDrag) {
lockDrag = true;
} }
});
if (((this.bar.selectTabs.length === this.bar.tabs.length || this.bar.tabs.length === 1) && !(e.ctrlKey || (Common.Utils.isMac && e.altKey))) || this.bar.isEditFormula) {
lockDrag = true;
} }
// move last selected sheet if all sheets are selected
if (this.bar.selectTabs.length === this.bar.tabs.length && this.bar.tabs.length > 1 && !e.ctrlKey && !(Common.Utils.isMac && e.altKey)) {
lockDrag = false;
this.bar.$el.find('ul > li.selected').removeClass('selected');
}
this.bar.$el.find('ul > li > span').attr('draggable', !lockDrag);
if (!lockDrag && !e.ctrlKey && !e.metaKey) {
tab.changeState();
}
} else {
this.bar.$el.find('ul > li > span').attr('draggable', 'false');
}
if ($('#ce-cell-content').is(':focus'))
if (!this.bar.isEditFormula) {
$('#ce-cell-content').blur();
} else {
setTimeout(function () {
$('#ce-cell-content').focus();
}, 500)
}
}, this)
});
tab.$el.children().on(
{dragstart: $.proxy(function (e) {
var event = e.originalEvent;
if (!Common.Utils.isIE && !Common.Utils.isSafari) {
var img = document.createElement('div');
event.dataTransfer.setDragImage(img, 0, 0);
} else if (Common.Utils.isIE) {
this.bar.selectTabs.forEach(function (tab) {
tab.$el.find('span').prop('title', '');
});
}
event.dataTransfer.effectAllowed = 'copyMove';
this.bar.trigger('tab:dragstart', event.dataTransfer, this.bar.selectTabs);
}, this),
dragenter: $.proxy(function (e) {
var event = e.originalEvent;
if (!this.bar.isEditFormula) {
this.bar.$el.find('.mousemove').removeClass('mousemove right');
$(e.currentTarget).parent().addClass('mousemove');
event.dataTransfer.dropEffect = (event.ctrlKey || Common.Utils.isMac && event.altKey) ? 'copy' : 'move';
} else {
event.dataTransfer.dropEffect = 'none';
}
}, this),
dragover: $.proxy(function (e) {
var event = e.originalEvent;
if (event.preventDefault) {
event.preventDefault(); // Necessary. Allows us to drop.
}
if (!this.bar.isEditFormula) {
this.bar.$el.find('.mousemove').removeClass('mousemove right');
$(e.currentTarget).parent().addClass('mousemove');
event.dataTransfer.dropEffect = (event.ctrlKey || Common.Utils.isMac && event.altKey) ? 'copy' : 'move';
} else {
event.dataTransfer.dropEffect = 'none';
}
return false;
}, this),
dragleave: $.proxy(function (e) {
$(e.currentTarget).parent().removeClass('mousemove right');
}, this),
dragend: $.proxy(function (e) {
if (Common.Utils.isMac && e.altKey) { // don't show alt hints after copy by drag and drop
this.bar.isDragDrop = true;
}
var event = e.originalEvent;
if (event.dataTransfer.dropEffect === 'move' && !event.dataTransfer.mozUserCancelled) {
this.bar.trigger('tab:dragend', true);
} else {
this.bar.trigger('tab:dragend', false);
}
this.bar.$el.find('.mousemove').removeClass('mousemove right');
}, this),
drop: $.proxy(function (e) {
if (Common.Utils.isMac && e.altKey) { // don't show alt hints after copy by drag and drop
this.bar.isDragDrop = true;
}
var event = e.originalEvent,
index = $(event.currentTarget).data('index');
this.bar.$el.find('.mousemove').removeClass('mousemove right');
this.bar.trigger('tab:drop', event.dataTransfer, index, (event.ctrlKey || Common.Utils.isMac && event.altKey));
this.bar.isDrop = true;
}, this) }, this)
}); });
}; };
@ -280,8 +321,7 @@ define([
}, },
tabs: [], tabs: [],
template: _.template('<ul id="statusbar_bottom" class="nav nav-tabs <%= placement %>"></ul>'), template: _.template('<ul class="nav nav-tabs <%= placement %>" />'),
selectTabs: [],
initialize : function (options) { initialize : function (options) {
_.extend(this.config, options); _.extend(this.config, options);
@ -300,39 +340,6 @@ define([
var eventname=(/Firefox/i.test(navigator.userAgent))? 'DOMMouseScroll' : 'mousewheel'; var eventname=(/Firefox/i.test(navigator.userAgent))? 'DOMMouseScroll' : 'mousewheel';
addEvent(this.$bar[0], eventname, _.bind(this._onMouseWheel,this)); addEvent(this.$bar[0], eventname, _.bind(this._onMouseWheel,this));
addEvent(this.$bar[0], 'dragstart', _.bind(function (event) {
event.dataTransfer.effectAllowed = 'copyMove';
}, this));
addEvent(this.$bar[0], 'dragenter', _.bind(function (event) {
if (!this.isEditFormula) {
event.dataTransfer.dropEffect = (event.ctrlKey || Common.Utils.isMac && event.altKey) ? 'copy' : 'move';
} else {
event.dataTransfer.dropEffect = 'none';
}
}, this));
addEvent(this.$bar[0], 'dragover', _.bind(function (event) {
if (event.preventDefault) {
event.preventDefault(); // Necessary. Allows us to drop.
}
event.dataTransfer.dropEffect = !this.isEditFormula ? ((event.ctrlKey || Common.Utils.isMac && event.altKey) ? 'copy' : 'move') : 'none';
!this.isEditFormula && this.tabs[this.tabs.length - 1].$el.addClass('mousemove right');
return false;
}, this));
addEvent(this.$bar[0], 'dragleave', _.bind(function (event) {
event.dataTransfer.dropEffect = 'none';
this.tabs[this.tabs.length - 1].$el.removeClass('mousemove right');
}, this));
addEvent(this.$bar[0], 'drop', _.bind(function (event) {
this.$el.find('.mousemove').removeClass('mousemove right');
if (this.isDrop === undefined) {
if (Common.Utils.isMac && event.altKey) { // don't show alt hints after copy by drag and drop
this.isDragDrop = true;
}
this.trigger('tab:drop', event.dataTransfer, 'last', (event.ctrlKey || Common.Utils.isMac && event.altKey));
} else {
this.isDrop = undefined;
}
}, this));
this.manager = new StateManager({bar: this}); this.manager = new StateManager({bar: this});
@ -348,7 +355,7 @@ define([
_onMouseWheel: function(e) { _onMouseWheel: function(e) {
var hidden = this.checkInvisible(true), var hidden = this.checkInvisible(true),
forward = ((e.detail && -e.detail) || e.wheelDelta) < 0; forward = ((e.detail && -e.detail) || e.wheelDelta) > 0;
if (forward) { if (forward) {
if (hidden.last) { if (hidden.last) {
@ -359,7 +366,6 @@ define([
this.setTabVisible('backward'); this.setTabVisible('backward');
} }
} }
Common.NotificationCenter.trigger('hints:clear');
}, },
onProcessMouse: function(data) { onProcessMouse: function(data) {
@ -391,10 +397,6 @@ define([
me.$bar.append(tab.render().$el); me.$bar.append(tab.render().$el);
me.tabs.push(tab); me.tabs.push(tab);
me.manager.attach(tab); me.manager.attach(tab);
if (tab.isActive()) {
me.selectTabs.length = 0;
me.selectTabs.push(tab);
}
} }
} else { } else {
for (i = tabs.length; i-- > 0 ; ) { for (i = tabs.length; i-- > 0 ; ) {
@ -408,11 +410,6 @@ define([
me.tabs.splice(index, 0, tab); me.tabs.splice(index, 0, tab);
} }
if (tab.isActive()) {
me.selectTabs.length = 0;
me.selectTabs.push(tab);
}
me.manager.attach(tab); me.manager.attach(tab);
} }
} }
@ -465,27 +462,6 @@ define([
this.checkInvisible(); this.checkInvisible();
}, },
setSelectAll: function(isSelect) {
var me = this;
me.selectTabs.length = 0;
if (isSelect) {
me.tabs.forEach(function(tab){
if (!tab.isSelected()) {
tab.addClass('selected');
}
me.selectTabs.push(tab);
});
} else {
me.tabs.forEach(function(tab){
if (tab.isActive()) {
me.selectTabs.push(tab);
} else if (tab.isSelected()) {
tab.removeClass('selected');
}
});
}
},
getActive: function(iselem) { getActive: function(iselem) {
return iselem ? this.$bar.find('> li.active') : this.$bar.find('> li.active').index(); return iselem ? this.$bar.find('> li.active') : this.$bar.find('> li.active').index();
}, },
@ -513,29 +489,24 @@ define([
}, },
setTabVisible: function(index, suppress) { setTabVisible: function(index, suppress) {
if (index <= 0) { if (index <= 0 || index == 'first') {
this.$bar.scrollLeft(0); this.$bar.scrollLeft(0);
this.checkInvisible(suppress); this.checkInvisible(suppress);
} else if ( index >= (this.tabs.length - 1)) { } else if ( index >= (this.tabs.length - 1) || index == 'last') {
var tab = this.tabs[this.tabs.length-1].$el; var tab = this.tabs[this.tabs.length-1].$el;
if (this.$bar.find('.separator-item').length === 0) { this.$bar.scrollLeft(this.$bar.scrollLeft() + (tab.position().left + parseInt(tab.css('width')) - this.$bar.width()) + 1);
this.$bar.append('<li class="separator-item"><span></span></li>');
}
this.$bar.scrollLeft(this.$bar.scrollLeft() + (tab.position().left + parseInt(tab.css('width')) - this.$bar.width()) + (this.$bar.width() > 400 ? 20 : 5));
this.checkInvisible(suppress); this.checkInvisible(suppress);
} else { } else {
if (!this.isTabVisible(this.tabs.length - 1) && this.$bar.find('.separator-item').length === 0) {
this.$bar.append('<li class="separator-item"><span></span></li>');
}
var rightbound = this.$bar.width(), var rightbound = this.$bar.width(),
tab, right, left; tab, right, left;
if (index == 'forward') { if (index == 'forward') {
for (var i = 0; i < this.tabs.length; i++) { for (var i = 0; i < this.tabs.length; i++) {
tab = this.tabs[i].$el; tab = this.tabs[i].$el;
right = tab.position().left + parseInt(tab.css('width')); right = tab.position().left + parseInt(tab.css('width'));
if (right > rightbound) { if (right > rightbound) {
this.$bar.scrollLeft(this.$bar.scrollLeft() + (right - rightbound) + (this.$bar.width() > 400 ? 20 : 5)); this.$bar.scrollLeft(this.$bar.scrollLeft() + (right - rightbound) + 20);
this.checkInvisible(suppress); this.checkInvisible(suppress);
break; break;
} }
@ -604,33 +575,10 @@ define([
//left = tab.position().left; //left = tab.position().left;
//right = left + tab.width(); //right = left + tab.width();
return !(left < leftbound) && !(right - rightbound > 0.5); return !(left < leftbound) && !(right > rightbound);
} }
return false; return false;
},
addDataHint: function (index, dataHint) { //Hint Manager
var oldHintTab = this.$bar.find('[data-hint]');
if (oldHintTab.length > 0) {
oldHintTab.removeAttr('data-hint');
oldHintTab.removeAttr('data-hint-direction');
oldHintTab.removeAttr('data-hint-offset');
oldHintTab.removeAttr('data-hint-title');
} }
var newHintTab = this.tabs[index].$el;
newHintTab.attr('data-hint', dataHint || '0');
newHintTab.attr('data-hint-direction', 'top');
newHintTab.attr('data-hint-offset', 'medium');
newHintTab.attr('data-hint-title', 'M');
},
getWidth: function() {
var width = 21;
this.tabs.forEach(function(tab){
width += tab.$el.width();
});
return width;
},
}); });
}); });

View file

@ -370,8 +370,8 @@ define([
template: _.template([ template: _.template([
'<div id="<%=scope.id%>" class="table-styler" style="position: relative; width: <%=scope.width%>px; height:<%=scope.height%>px;">', '<div id="<%=scope.id%>" class="table-styler" style="position: relative; width: <%=scope.width%>px; height:<%=scope.height%>px;">',
'<div class="ts-preview-box ts-preview-box--lt" style="left: 0; top: 0; width: <%=scope.tablePadding%>px; height: <%=scope.tablePadding%>px;"></div>', '<div style="position: absolute; left: 0; top: 0; width: <%=scope.tablePadding%>px; height: <%=scope.tablePadding%>px; border-bottom: 1px dotted gray; border-right: 1px dotted gray;"></div>',
'<div class="ts-preview-box ts-preview-box--mt" style="left: <%=scope.tablePadding%>px; top: 0; right: <%=scope.tablePadding%>px; height: <%=scope.tablePadding%>px;">', '<div style="position: absolute; left: <%=scope.tablePadding%>px; top: 0; right: <%=scope.tablePadding%>px; height: <%=scope.tablePadding%>px;">',
'<div id="<%=scope.id%>-table-top-border-selector" style="position: absolute; z-index: 1; height: <%=scope.tablePadding%>px; left: 0; right: 0; top: <%=scope.tablePadding * .5%>px;">', '<div id="<%=scope.id%>-table-top-border-selector" style="position: absolute; z-index: 1; height: <%=scope.tablePadding%>px; left: 0; right: 0; top: <%=scope.tablePadding * .5%>px;">',
'<table width="100%" height="100%">', '<table width="100%" height="100%">',
'<tr>', '<tr>',
@ -383,9 +383,9 @@ define([
'</table>', '</table>',
'</div>', '</div>',
'</div>', '</div>',
'<div class="ts-preview-box ts-preview-box--rt" style="top: 0; right: 0; width: <%=scope.tablePadding%>px; height: <%=scope.tablePadding%>px;"></div>', '<div style="position: absolute; top: 0; right: 0; width: <%=scope.tablePadding%>px; height: <%=scope.tablePadding%>px; border-bottom: 1px dotted gray; border-left: 1px dotted gray;"></div>',
'<div class="ts-preview-box ts-preview-box--lm" style="left: 0; top: <%=scope.tablePadding%>px; width: <%=scope.tablePadding%>px; height: <%=scope.height - 2 * scope.tablePadding%>px;">', '<div style="position: absolute; left: 0; top: <%=scope.tablePadding%>px; width: <%=scope.tablePadding%>px; height: <%=scope.height - 2 * scope.tablePadding%>px;">',
'<div id="<%=scope.id%>-table-left-border-selector" style="position: absolute; z-index: 1; left: <%=scope.tablePadding * .5%>px; top: 0; bottom: 0; width: <%=scope.tablePadding%>px;">', '<div id="<%=scope.id%>-table-left-border-selector" style="position: absolute; z-index: 1; left: <%=scope.tablePadding * .5%>px; top: 0; bottom: 0; width: <%=scope.tablePadding%>px;">',
'<table width="100%" height="100%">', '<table width="100%" height="100%">',
'<tr>', '<tr>',
@ -395,7 +395,7 @@ define([
'</table>', '</table>',
'</div>', '</div>',
'</div>', '</div>',
'<div class="ts-preview-box ts-preview-box--mm" style="left: <%=scope.tablePadding%>px; top: <%=scope.tablePadding%>px; right: <%=scope.tablePadding%>px; bottom: <%=scope.tablePadding%>px;">', '<div style="position: absolute; left: <%=scope.tablePadding%>px; top: <%=scope.tablePadding%>px; right: <%=scope.tablePadding%>px; bottom: <%=scope.tablePadding%>px;">',
'<table id="<%=scope.id%>-table-content" cols="<%=scope.columns%>" width="100%" height="100%" style="border-collapse: inherit; border-spacing: <%= scope.spacingMode ? scope.cellPadding : 0 %>px;">', '<table id="<%=scope.id%>-table-content" cols="<%=scope.columns%>" width="100%" height="100%" style="border-collapse: inherit; border-spacing: <%= scope.spacingMode ? scope.cellPadding : 0 %>px;">',
'<% for (var row = 0; row < scope.rows; row++) { %>', '<% for (var row = 0; row < scope.rows; row++) { %>',
'<tr>', '<tr>',
@ -406,7 +406,7 @@ define([
'<% } %>', '<% } %>',
'</table>', '</table>',
'</div>', '</div>',
'<div class="ts-preview-box ts-preview-box--rm" style="right: 0; top: <%=scope.tablePadding%>px; width: <%=scope.tablePadding%>px; height: <%=scope.height - 2 * scope.tablePadding%>px;">', '<div style="position: absolute; right: 0; top: <%=scope.tablePadding%>px; width: <%=scope.tablePadding%>px; height: <%=scope.height - 2 * scope.tablePadding%>px;">',
'<div id="<%=scope.id%>-table-right-border-selector" style="position: absolute; z-index: 1; right: <%=scope.tablePadding * .5%>px; top: 0; bottom: 0; width: <%=scope.tablePadding%>px;">', '<div id="<%=scope.id%>-table-right-border-selector" style="position: absolute; z-index: 1; right: <%=scope.tablePadding * .5%>px; top: 0; bottom: 0; width: <%=scope.tablePadding%>px;">',
'<table width="100%" height="100%">', '<table width="100%" height="100%">',
'<tr>', '<tr>',
@ -417,8 +417,8 @@ define([
'</div>', '</div>',
'</div>', '</div>',
'<div class="ts-preview-box ts-preview-box--lb" style="left: 0; bottom: 0; width: <%=scope.tablePadding%>px; height: <%=scope.tablePadding%>px;"></div>', '<div style="position: absolute; left: 0; bottom: 0; width: <%=scope.tablePadding%>px; height: <%=scope.tablePadding%>px; border-top: 1pt dotted gray; border-right: 1pt dotted gray;"></div>',
'<div class="ts-preview-box ts-preview-box--mb" style="left: <%=scope.tablePadding%>px; bottom: 0; right: <%=scope.tablePadding%>px; height: <%=scope.tablePadding%>px;">', '<div style="position: absolute; left: <%=scope.tablePadding%>px; bottom: 0; right: <%=scope.tablePadding%>px; height: <%=scope.tablePadding%>px;">',
'<div id="<%=scope.id%>-table-bottom-border-selector" style="position: absolute; z-index: 1; height: <%=scope.tablePadding%>px; left: 0; right: 0; bottom: <%=scope.tablePadding * .5%>px;">', '<div id="<%=scope.id%>-table-bottom-border-selector" style="position: absolute; z-index: 1; height: <%=scope.tablePadding%>px; left: 0; right: 0; bottom: <%=scope.tablePadding * .5%>px;">',
'<table width="100%" height="100%">', '<table width="100%" height="100%">',
'<tr>', '<tr>',
@ -430,7 +430,7 @@ define([
'</table>', '</table>',
'</div>', '</div>',
'</div>', '</div>',
'<div class="ts-preview-box ts-preview-box--rb" style="bottom: 0; right: 0; width: <%=scope.tablePadding%>px; height: <%=scope.tablePadding%>px;"></div>', '<div style="position: absolute; bottom: 0; right: 0; width: <%=scope.tablePadding%>px; height: <%=scope.tablePadding%>px; border-top: 1pt dotted gray; border-left: 1pt dotted gray;"></div>',
'</div>' '</div>'
].join('')), ].join('')),
@ -677,12 +677,10 @@ define([
}; };
me.setTableColor = function(color) { me.setTableColor = function(color) {
table_content.toggleClass('transparent', color == 'transparent');
table_content.css('background-color', (color == 'transparent' ) ? color : ('#'+color)); table_content.css('background-color', (color == 'transparent' ) ? color : ('#'+color));
}; };
me.setCellsColor = function(color) { me.setCellsColor = function(color) {
!me.spacingMode && table_content.toggleClass('transparent', color == 'transparent');
cells_content.css('background-color', (color == 'transparent' ) ? color : ('#'+color)); cells_content.css('background-color', (color == 'transparent' ) ? color : ('#'+color));
}; };

View file

@ -1,215 +0,0 @@
/*
*
* (c) Copyright Ascensio System SIA 2010-2020
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
/**
* TextareaField.js
*
* Created by Julia Radzhabova on 29/09/20
* Copyright (c) 2020 Ascensio System SIA. All rights reserved.
*
*/
if (Common === undefined)
var Common = {};
define([
'common/main/lib/component/BaseView',
'common/main/lib/component/Tooltip'
], function () { 'use strict';
Common.UI.TextareaField = Common.UI.BaseView.extend((function() {
return {
options : {
id : null,
cls : '',
style : '',
value : '',
maxlength : undefined,
placeHolder : '',
spellcheck : false,
disabled: false
},
template: _.template([
'<div class="textarea-field" style="<%= style %>">',
'<textarea ',
'spellcheck="<%= spellcheck %>" ',
'class="form-control <%= cls %>" ',
'placeholder="<%= placeHolder %>" ',
'<% if (dataHint) {%>',
'data-hint="<%= dataHint %>" ',
'<% } %>',
'<% if (dataHintDirection) {%>',
'data-hint-direction="<%= dataHintDirection %>" ',
'<% } %>',
'<% if (dataHintOffset) {%>',
'data-hint-offset="<%= dataHintOffset %>" ',
'<% } %>',
'></textarea>',
'</div>'
].join('')),
initialize : function(options) {
Common.UI.BaseView.prototype.initialize.call(this, options);
var me = this;
this.id = me.options.id || Common.UI.getId();
this.cls = me.options.cls;
this.style = me.options.style;
this.value = me.options.value;
this.placeHolder = me.options.placeHolder;
this.template = me.options.template || me.template;
this.disabled = me.options.disabled;
this.spellcheck = me.options.spellcheck;
this.maxLength = me.options.maxLength;
me.rendered = me.options.rendered || false;
if (me.options.el) {
me.render();
}
},
render : function(parentEl) {
var me = this;
if (!me.rendered) {
this.cmpEl = $(this.template({
id : this.id,
cls : this.cls,
style : this.style,
placeHolder : this.placeHolder,
spellcheck : this.spellcheck,
dataHint : this.options.dataHint,
dataHintDirection: this.options.dataHintDirection,
dataHintOffset: this.options.dataHintOffset,
scope : me
}));
if (parentEl) {
this.setElement(parentEl, false);
parentEl.html(this.cmpEl);
} else {
this.$el.html(this.cmpEl);
}
} else {
this.cmpEl = this.$el;
}
if (!me.rendered) {
var el = this.cmpEl;
this._input = this.cmpEl.find('textarea').addBack().filter('textarea');
this._input.on('blur', _.bind(this.onInputChanged, this));
this._input.on('keydown', _.bind(this.onKeyDown, this));
if (this.maxLength) this._input.attr('maxlength', this.maxLength);
if (this.disabled)
this.setDisabled(this.disabled);
}
me.rendered = true;
return this;
},
_doChange: function(e, extra) {
// skip processing for internally-generated synthetic event
// to avoid double processing
if (extra && extra.synthetic)
return;
var newValue = $(e.target).val(),
oldValue = this.value;
this.trigger('changed:before', this, newValue, oldValue, e);
if (e.isDefaultPrevented())
return;
this.value = newValue;
// trigger changed event
this.trigger('changed:after', this, newValue, oldValue, e);
},
onInputChanged: function(e, extra) {
this._doChange(e, extra);
},
onKeyDown: function(e) {
this.trigger('keydown:before', this, e);
if (e.isDefaultPrevented())
return;
if (e.keyCode === Common.UI.Keys.RETURN) {
e.stopPropagation();
}
if (e.keyCode == Common.UI.Keys.ESC)
this.setValue(this.value);
if (e.keyCode==Common.UI.Keys.ESC)
this.trigger('inputleave', this);
},
setDisabled: function(disabled) {
disabled = !!disabled;
this.disabled = disabled;
$(this.el).toggleClass('disabled', disabled);
disabled
? this._input.attr('disabled', true)
: this._input.removeAttr('disabled');
},
isDisabled: function() {
return this.disabled;
},
setValue: function(value) {
this.value = value;
if (this.rendered){
this._input.val(value);
}
},
getValue: function() {
return this.value;
},
focus: function() {
this._input.focus();
}
}
})());
});

View file

@ -52,36 +52,29 @@ define([
dynamiccolors: 10, dynamiccolors: 10,
standardcolors: 10, standardcolors: 10,
themecolors: 10, themecolors: 10,
columns: 10,
effects: 5, effects: 5,
hideEmptyColors: true,
allowReselect: true, allowReselect: true,
transparent: false, transparent: false,
value: '000000', value: '000000'
enableKeyEvents: true,
keyMoveDirection: 'both' // 'vertical', 'horizontal'
}, },
template : template :
_.template( _.template(
'<div style="padding: 4px 0 0 12px;">' + '<div style="padding: 12px;">' +
'<% var me = this; var idx = 0; %>' + '<% var me = this; %>' +
'<% $(colors).each(function(num, item) { %>' + '<% $(colors).each(function(num, item) { %>' +
'<% if (me.isBlankSeparator(item)) { %> <div class="palette-color-spacer" style="width:100%;height:8px;float:left;"></div>' + '<% if (me.isBlankSeparator(item)) { %> <div class="palette-color-spacer" style="width:100%;height:8px;float:left;"></div>' +
'<% } else if (me.isSeparator(item)) { %> </div><div class="divider" style="width:100%;float:left;"></div><div style="padding: 12px;">' + '<% } else if (me.isSeparator(item)) { %> </div><div class="palette-color-separator" style="width:100%;height:1px;float:left;border-bottom: 1px solid #E0E0E0"></div><div style="padding: 12px;">' +
'<% } else if (me.isColor(item)) { %> ' + '<% } else if (me.isColor(item)) { %> ' +
'<a class="palette-color color-<%=item%>" style="background:#<%=item%>" idx="<%=idx++%>">' + '<a class="palette-color color-<%=item%>" style="background:#<%=item%>" hidefocus="on">' +
'<em><span style="background:#<%=item%>;" unselectable="on">&#160;</span></em>' + '<em><span style="background:#<%=item%>;" unselectable="on">&#160;</span></em>' +
'</a>' + '</a>' +
'<% } else if (me.isTransparent(item)) { %>' + '<% } else if (me.isTransparent(item)) { %>' +
'<a class="color-<%=item%>" idx="<%=idx++%>">' + '<a class="color-<%=item%>" hidefocus="on">' +
'<em><span unselectable="on">&#160;</span></em>' + '<em><span unselectable="on">&#160;</span></em>' +
'</a>' + '</a>' +
'<% } else if (me.isEffect(item)) { %>' + '<% } else if (me.isEffect(item)) { %>' +
'<% if (idx>0 && me.columns>0 && idx%me.columns===0) { %> ' + '<a effectid="<%=item.effectId%>" effectvalue="<%=item.effectValue%>" class="palette-color-effect color-<%=item.color%>" style="background:#<%=item.color%>" hidefocus="on">' +
'<div style="width:100%;height:0;float:left;"></div>' +
'<% } %>' +
'<a effectid="<%=item.effectId%>" effectvalue="<%=item.effectValue%>" class="palette-color-effect color-<%=item.color%>" style="background:#<%=item.color%>" idx="<%=idx++%>">' +
'<em><span style="background:#<%=item.color%>;" unselectable="on">&#160;</span></em>' + '<em><span style="background:#<%=item.color%>;" unselectable="on">&#160;</span></em>' +
'</a>' + '</a>' +
'<% } else if (me.isCaption(item)) { %>' + '<% } else if (me.isCaption(item)) { %>' +
@ -90,11 +83,9 @@ define([
'<% }); %>' + '<% }); %>' +
'</div>' + '</div>' +
'<% if (me.options.dynamiccolors!==undefined) { %>' + '<% if (me.options.dynamiccolors!==undefined) { %>' +
'<div class="palette-color-dynamiccolors" style="padding: 4px 0 0 12px">' + '<div class="palette-color-spacer" style="width:100%;height:8px;float:left;"></div><div style="padding: 12px;">' +
'<div class="palette-color-spacer" style="width:100%;height:8px;float:left;"></div>' +
'<div class="palette-color-caption" style="width:100%;float:left;font-size: 11px;"><%=me.textRecentColors%></div>' +
'<% for (var i=0; i<me.options.dynamiccolors; i++) { %>' + '<% for (var i=0; i<me.options.dynamiccolors; i++) { %>' +
'<a class="color-dynamic-<%=i%> dynamic-empty-color <%= me.emptyColorsClass %>" color="" idx="<%=idx++%>">' + '<a class="color-dynamic-<%=i%> dynamic-empty-color" style="background:#ffffff" color="" hidefocus="on">' +
'<em><span unselectable="on">&#160;</span></em></a>' + '<em><span unselectable="on">&#160;</span></em></a>' +
'<% } %>' + '<% } %>' +
'<% } %>' + '<% } %>' +
@ -110,20 +101,6 @@ define([
el = me.$el || $(this.el); el = me.$el || $(this.el);
this.colors = me.options.colors || this.generateColorData(me.options.themecolors, me.options.effects, me.options.standardcolors, me.options.transparent); this.colors = me.options.colors || this.generateColorData(me.options.themecolors, me.options.effects, me.options.standardcolors, me.options.transparent);
this.columns = me.options.columns || 0;
this.enableKeyEvents= me.options.enableKeyEvents;
this.tabindex = me.options.tabindex || 0;
this.outerMenu = me.options.outerMenu;
this.lastSelectedIdx = -1;
this.emptyColorsClass = me.options.hideEmptyColors ? 'hidden' : '';
me.colorItems = [];
if (me.options.keyMoveDirection=='vertical')
me.moveKeys = [Common.UI.Keys.UP, Common.UI.Keys.DOWN];
else if (me.options.keyMoveDirection=='horizontal')
me.moveKeys = [Common.UI.Keys.LEFT, Common.UI.Keys.RIGHT];
else
me.moveKeys = [Common.UI.Keys.UP, Common.UI.Keys.DOWN, Common.UI.Keys.LEFT, Common.UI.Keys.RIGHT];
el.addClass('theme-colorpalette'); el.addClass('theme-colorpalette');
this.render(); this.render();
@ -132,15 +109,6 @@ define([
this.updateColors(this.options.updateColorsArr[0], this.options.updateColorsArr[1]); this.updateColors(this.options.updateColorsArr[0], this.options.updateColorsArr[1]);
if (this.options.value) if (this.options.value)
this.select(this.options.value, true); this.select(this.options.value, true);
if (this.options.outerMenu && this.options.outerMenu.focusOnShow && this.options.outerMenu.menu) {
el.addClass('focused');
this.options.outerMenu.menu.on('show:after', function(menu) {
_.delay(function() {
me.showLastSelected();
me.focus();
}, 10);
});
}
this.updateCustomColors(); this.updateCustomColors();
el.closest('.btn-group').on('show.bs.dropdown', _.bind(this.updateCustomColors, this)); el.closest('.btn-group').on('show.bs.dropdown', _.bind(this.updateCustomColors, this));
el.closest('.dropdown-submenu').on('show.bs.dropdown', _.bind(this.updateCustomColors, this)); el.closest('.dropdown-submenu').on('show.bs.dropdown', _.bind(this.updateCustomColors, this));
@ -149,12 +117,6 @@ define([
render: function () { render: function () {
this.$el.html(this.template({colors: this.colors})); this.$el.html(this.template({colors: this.colors}));
var me = this;
this.moveKeys && this.$el.find('a').each(function(num, item) {
me.colorItems.push({el: item, index: num});
});
this.attachKeyEvents();
return this; return this;
}, },
@ -184,43 +146,28 @@ define([
updateCustomColors: function() { updateCustomColors: function() {
var el = this.$el || $(this.el); var el = this.$el || $(this.el);
if (el) { if (el) {
var selected = (this.lastSelectedIdx>=0) ? $(this.colorItems[this.lastSelectedIdx].el) : el.find('a.' + this.selectedCls), var selected = el.find('a.' + this.selectedCls),
color = (selected.length>0 && /color-dynamic/.test(selected[0].className)) ? selected.attr('color') : undefined; color = (selected.length>0 && /color-dynamic/.test(selected[0].className)) ? selected.attr('color') : undefined;
if (color) { // custom color was selected if (color) { // custom color was selected
color = color.toUpperCase(); color = color.toUpperCase();
selected.removeClass(this.selectedCls); selected.removeClass(this.selectedCls);
this.lastSelectedIdx = -1;
} }
var colors = Common.localStorage.getItem('asc.'+Common.localStorage.getId()+'.colors.custom'); var colors = Common.localStorage.getItem('asc.'+Common.localStorage.getId()+'.colors.custom');
colors = colors ? colors.split(',') : []; colors = colors ? colors.split(',') : [];
var i = -1, colorEl, c = colors.length < this.options.dynamiccolors ? colors.length : this.options.dynamiccolors; var i = -1, colorEl, c = colors.length < this.options.dynamiccolors ? colors.length : this.options.dynamiccolors;
if (this.options.hideEmptyColors && this._layoutParams && el.find('.dynamic-empty-color').length !== (this.options.dynamiccolors - c)) {// recalc indexed if change custom colors
this._layoutParams = undefined;
}
while (++i < c) { while (++i < c) {
colorEl = el.find('.color-dynamic-'+ i); colorEl = el.find('.color-dynamic-'+ i);
colorEl.removeClass('dynamic-empty-color').removeClass(this.emptyColorsClass).attr('color', colors[i]); colorEl.removeClass('dynamic-empty-color').attr('color', colors[i]);
colorEl.find('span').css({ colorEl.find('span').css({
'background-color': '#'+colors[i] 'background-color': '#'+colors[i]
}); });
if (colors[i] == color) { if (colors[i] == color) {
colorEl.addClass(this.selectedCls); colorEl.addClass(this.selectedCls);
this.lastSelectedIdx = parseInt(colorEl.attr('idx'));
color = undefined; //select only first found color color = undefined; //select only first found color
} }
} }
while (i < this.options.dynamiccolors) {
colorEl = el.find('.color-dynamic-'+ i);
colorEl.removeAttr('color');
colorEl.addClass('dynamic-empty-color').addClass(this.emptyColorsClass);
colorEl.find('span').css({
'background-color': 'transparent'
});
i++;
}
el.find('.palette-color-dynamiccolors').toggleClass(this.emptyColorsClass, c===0);
} }
}, },
@ -229,31 +176,22 @@ define([
var target = $(e.target).closest('a'); var target = $(e.target).closest('a');
var color, cmp; var color, cmp;
if (target.length==0) return false; if (target.length==0) return;
if (target.hasClass('color-transparent') ) { if (target.hasClass('color-transparent') ) {
me.clearSelection(true); $(me.el).find('a.' + me.selectedCls).removeClass(me.selectedCls);
target.addClass(me.selectedCls); target.addClass(me.selectedCls);
if (!e.suppressEvent) {
me.lastSelectedIdx = parseInt(target.attr('idx'));
me.value = 'transparent'; me.value = 'transparent';
me.trigger('select', me, 'transparent'); me.trigger('select', me, 'transparent');
}
} else if ( !(target[0].className.search('color-dynamic')<0) ) { } else if ( !(target[0].className.search('color-dynamic')<0) ) {
if (!/dynamic-empty-color/.test(target[0].className)) { if (!/dynamic-empty-color/.test(target[0].className)) {
me.clearSelection(true); $(me.el).find('a.' + me.selectedCls).removeClass(me.selectedCls);
target.addClass(me.selectedCls); target.addClass(me.selectedCls);
if (!e.suppressEvent) {
me.lastSelectedIdx = parseInt(target.attr('idx'));
color = target.attr('color'); color = target.attr('color');
me.trigger('select', me, color); if (color) me.trigger('select', me, color);
me.value = color.toUpperCase(); me.value = color.toUpperCase();
}
} else { } else {
if (e.suppressEvent) {
me.clearSelection(true);
target.addClass(me.selectedCls);
} else
setTimeout(function(){ setTimeout(function(){
me.addNewColor(); me.addNewColor();
}, 10); }, 10);
@ -262,25 +200,21 @@ define([
if (!/^[a-fA-F0-9]{6}$/.test(me.value) || _.indexOf(me.colors, me.value)<0 ) if (!/^[a-fA-F0-9]{6}$/.test(me.value) || _.indexOf(me.colors, me.value)<0 )
me.value = false; me.value = false;
me.clearSelection(true); $(me.el).find('a.' + me.selectedCls).removeClass(me.selectedCls);
target.addClass(me.selectedCls); target.addClass(me.selectedCls);
color = target[0].className.match(me.colorRe)[1]; color = target[0].className.match(me.colorRe)[1];
if ( target.hasClass('palette-color-effect') ) { if ( target.hasClass('palette-color-effect') ) {
var effectId = parseInt(target.attr('effectid')); var effectId = parseInt(target.attr('effectid'));
if (color && !e.suppressEvent) { if (color) {
me.value = color.toUpperCase(); me.value = color.toUpperCase();
me.trigger('select', me, {color: color, effectId: effectId}); me.trigger('select', me, {color: color, effectId: effectId});
me.lastSelectedIdx = parseInt(target.attr('idx'));
} }
} else { } else {
if (/#?[a-fA-F0-9]{6}/.test(color)) { if (/#?[a-fA-F0-9]{6}/.test(color)) {
color = /#?([a-fA-F0-9]{6})/.exec(color)[1].toUpperCase(); color = /#?([a-fA-F0-9]{6})/.exec(color)[1].toUpperCase();
if (color && !e.suppressEvent) {
me.value = color; me.value = color;
me.trigger('select', me, color); me.trigger('select', me, color);
me.lastSelectedIdx = parseInt(target.attr('idx'));
}
} }
} }
} }
@ -291,22 +225,19 @@ define([
color = /#?([a-fA-F0-9]{6})/.exec(color); color = /#?([a-fA-F0-9]{6})/.exec(color);
if (color) { if (color) {
this.saveCustomColor(color[1]); this.saveCustomColor(color[1]);
this.clearSelection(true);
el.find('a.' + this.selectedCls).removeClass(this.selectedCls);
var child = el.find('.dynamic-empty-color'); var child = el.find('.dynamic-empty-color');
if (child.length==0) { if (child.length==0) {
this.updateCustomColors(); this.updateCustomColors();
child = el.find('.color-dynamic-' + (this.options.dynamiccolors - 1)); child = el.find('.color-dynamic-' + (this.options.dynamiccolors - 1));
} else {
if (this.options.hideEmptyColors && this._layoutParams) // recalc indexed
this._layoutParams = undefined;
} }
child.first().removeClass('dynamic-empty-color').removeClass(this.emptyColorsClass).addClass(this.selectedCls).attr('color', color[1]); child.first().removeClass('dynamic-empty-color').addClass(this.selectedCls).attr('color', color[1]);
child.first().find('span').css({ child.first().find('span').css({
'background-color': '#'+color[1] 'background-color': '#'+color[1]
}); });
el.find('.palette-color-dynamiccolors').removeClass(this.emptyColorsClass);
this.select(color[1], true); this.select(color[1], true);
} }
}, },
@ -342,7 +273,7 @@ define([
select: function(color, suppressEvent) { select: function(color, suppressEvent) {
var el = this.$el || $(this.el); var el = this.$el || $(this.el);
this.clearSelection(); el.find('a.' + this.selectedCls).removeClass(this.selectedCls);
if (typeof(color) == 'object' ) { if (typeof(color) == 'object' ) {
var effectEl; var effectEl;
@ -350,7 +281,6 @@ define([
effectEl = el.find('a[effectid="'+color.effectId+'"]').first(); effectEl = el.find('a[effectid="'+color.effectId+'"]').first();
if (effectEl.length>0) { if (effectEl.length>0) {
effectEl.addClass(this.selectedCls); effectEl.addClass(this.selectedCls);
this.lastSelectedIdx = parseInt(effectEl.attr('idx'));
this.value = effectEl[0].className.match(this.colorRe)[1].toUpperCase(); this.value = effectEl[0].className.match(this.colorRe)[1].toUpperCase();
} else } else
this.value = false; this.value = false;
@ -358,7 +288,6 @@ define([
effectEl = el.find('a[effectvalue="'+color.effectValue+'"].color-' + color.color.toUpperCase()).first(); effectEl = el.find('a[effectvalue="'+color.effectValue+'"].color-' + color.color.toUpperCase()).first();
if (effectEl.length>0) { if (effectEl.length>0) {
effectEl.addClass(this.selectedCls); effectEl.addClass(this.selectedCls);
this.lastSelectedIdx = parseInt(effectEl.attr('idx'));
this.value = effectEl[0].className.match(this.colorRe)[1].toUpperCase(); this.value = effectEl[0].className.match(this.colorRe)[1].toUpperCase();
} else } else
this.value = false; this.value = false;
@ -373,9 +302,8 @@ define([
if (_.indexOf(this.colors, this.value)<0) this.value = false; if (_.indexOf(this.colors, this.value)<0) this.value = false;
if (color != this.value || this.options.allowReselect) { if (color != this.value || this.options.allowReselect) {
var co = (color == 'transparent') ? el.find('a.color-transparent').addClass(this.selectedCls) : el.find('a.palette-color.color-' + color).first().addClass(this.selectedCls); (color == 'transparent') ? el.find('a.color-transparent').addClass(this.selectedCls) : el.find('a.palette-color.color-' + color).first().addClass(this.selectedCls);
this.value = color; this.value = color;
this.lastSelectedIdx = parseInt(co.attr('idx'));
if (suppressEvent !== true) { if (suppressEvent !== true) {
this.fireEvent('select', this, color); this.fireEvent('select', this, color);
} }
@ -386,7 +314,6 @@ define([
co = el.find('a[color="'+color+'"]').first(); co = el.find('a[color="'+color+'"]').first();
if (co.length>0) { if (co.length>0) {
co.addClass(this.selectedCls); co.addClass(this.selectedCls);
this.lastSelectedIdx = parseInt(co.attr('idx'));
this.value = color.toUpperCase(); this.value = color.toUpperCase();
} }
} }
@ -395,7 +322,7 @@ define([
selectByRGB: function(rgb, suppressEvent) { selectByRGB: function(rgb, suppressEvent) {
var el = this.$el || $(this.el); var el = this.$el || $(this.el);
this.clearSelection(true); el.find('a.' + this.selectedCls).removeClass(this.selectedCls);
var color = (typeof(rgb) == 'object') ? rgb.color : rgb; var color = (typeof(rgb) == 'object') ? rgb.color : rgb;
if (/#?[a-fA-F0-9]{6}/.test(color)) { if (/#?[a-fA-F0-9]{6}/.test(color)) {
@ -411,7 +338,6 @@ define([
co = el.find('a[color="'+color+'"]').first(); co = el.find('a[color="'+color+'"]').first();
if (co.length>0) { if (co.length>0) {
co.addClass(this.selectedCls); co.addClass(this.selectedCls);
this.lastSelectedIdx = parseInt(co.attr('idx'));
this.value = color; this.value = color;
} }
if (suppressEvent !== true) { if (suppressEvent !== true) {
@ -491,35 +417,14 @@ define([
clearSelection: function(suppressEvent) { clearSelection: function(suppressEvent) {
this.$el.find('a.' + this.selectedCls).removeClass(this.selectedCls); this.$el.find('a.' + this.selectedCls).removeClass(this.selectedCls);
if (!suppressEvent) {
this.value = undefined; this.value = undefined;
this.lastSelectedIdx = -1;
}
},
showLastSelected: function() {
this.selectByIndex(this.lastSelectedIdx, true);
},
getSelectedColor: function() {
var el = this.$el || $(this.el);
var idx = el.find('a.' + this.selectedCls).attr('idx');
return (idx!==undefined) ? this.colorItems[parseInt(idx)] : null;
},
selectByIndex: function(index, suppressEvent) {
this.clearSelection(true);
if (index>=0 && index<this.colorItems.length) {
this.handleClick({target: this.colorItems[index].el, suppressEvent: suppressEvent});
}
}, },
generateColorData: function(themecolors, effects, standardcolors, transparent) { generateColorData: function(themecolors, effects, standardcolors, transparent) {
var arr = [], var arr = [],
len = (themecolors>0 && effects>0) ? themecolors * effects : 0; len = (themecolors>0 && effects>0) ? themecolors * effects : 0;
if (themecolors>0) { if (themecolors>0) {
arr = [this.textThemeColors]; arr = [this.textThemeColors, '-'];
for (var i=0; i<themecolors; i++) for (var i=0; i<themecolors; i++)
arr.push({color: 'FFFFFF', effectId: 1}); arr.push({color: 'FFFFFF', effectId: 1});
@ -528,10 +433,10 @@ define([
arr.push({color: 'FFFFFF', effectId: 1}); arr.push({color: 'FFFFFF', effectId: 1});
if (standardcolors) if (standardcolors)
arr.push('-'); arr.push('-', '--', '-');
} }
if (standardcolors) { if (standardcolors) {
arr.push(this.textStandartColors); arr.push(this.textStandartColors, '-');
if (transparent) { if (transparent) {
arr.push('transparent'); arr.push('transparent');
standardcolors--; standardcolors--;
@ -539,142 +444,12 @@ define([
for (var i=0; i<standardcolors; i++) for (var i=0; i<standardcolors; i++)
arr.push('FFFFFF'); arr.push('FFFFFF');
} }
if (this.options.dynamiccolors && (themecolors || standardcolors))
arr.push('-', '--');
return arr; return arr;
}, },
onKeyDown: function (e, data) {
if (data===undefined) data = e;
if (_.indexOf(this.moveKeys, data.keyCode)>-1 || data.keyCode==Common.UI.Keys.RETURN) {
data.preventDefault();
data.stopPropagation();
var rec = this.getSelectedColor();
if (data.keyCode==Common.UI.Keys.RETURN) {
rec && this.selectByIndex(rec.index);
if (this.outerMenu && this.outerMenu.menu)
this.outerMenu.menu.hide();
} else {
var idx = rec ? rec.index : -1;
if (idx<0) {
idx = 0;
} else if (this.options.keyMoveDirection == 'both') {
if (this._layoutParams === undefined)
this.fillIndexesArray();
var topIdx = this.colorItems[idx].topIdx,
leftIdx = this.colorItems[idx].leftIdx;
idx = undefined;
if (data.keyCode==Common.UI.Keys.LEFT) {
while (idx===undefined) {
leftIdx--;
if (leftIdx<0) {
leftIdx = this._layoutParams.columns-1;
}
idx = this._layoutParams.itemsIndexes[topIdx][leftIdx];
}
} else if (data.keyCode==Common.UI.Keys.RIGHT) {
while (idx===undefined) {
leftIdx++;
if (leftIdx>this._layoutParams.columns-1) leftIdx = 0;
idx = this._layoutParams.itemsIndexes[topIdx][leftIdx];
}
} else if (data.keyCode==Common.UI.Keys.UP) {
if (topIdx==0 && this.outerMenu && this.outerMenu.menu) {
this.clearSelection(true);
this.outerMenu.menu.focusOuter(data, this.outerMenu.index);
} else
while (idx===undefined) {
topIdx--;
if (topIdx<0) topIdx = this._layoutParams.rows-1;
idx = this._layoutParams.itemsIndexes[topIdx][leftIdx];
}
} else {
if (topIdx==this._layoutParams.rows-1 && this.outerMenu && this.outerMenu.menu) {
this.clearSelection(true);
this.outerMenu.menu.focusOuter(data, this.outerMenu.index);
} else
while (idx===undefined) {
topIdx++;
if (topIdx>this._layoutParams.rows-1) topIdx = 0;
idx = this._layoutParams.itemsIndexes[topIdx][leftIdx];
}
}
} else {
idx = (data.keyCode==Common.UI.Keys.UP || data.keyCode==Common.UI.Keys.LEFT)
? Math.max(0, idx-1)
: Math.min(this.colorItems.length - 1, idx + 1) ;
}
if (idx !== undefined && idx>=0) {
this._fromKeyDown = true;
this.selectByIndex(idx, true);
this._fromKeyDown = false;
}
}
}
},
fillIndexesArray: function() {
if (this.colorItems.length<=0) return;
this._layoutParams = {
itemsIndexes: [],
columns: 0,
rows: 0
};
var el = $(this.colorItems[0].el),
itemW = el.outerWidth() + parseInt(el.css('margin-left')) + parseInt(el.css('margin-right')),
offsetLeft = this.$el.offset().left,
offsetTop = el.offset().top,
prevtop = -1, topIdx = 0, leftIdx = 0;
for (var i=0; i<this.colorItems.length; i++) {
var top = $(this.colorItems[i].el).offset().top - offsetTop;
leftIdx = Math.floor(($(this.colorItems[i].el).offset().left - offsetLeft)/itemW);
if (top>prevtop) {
prevtop = top;
this._layoutParams.itemsIndexes.push([]);
topIdx = this._layoutParams.itemsIndexes.length-1;
}
this._layoutParams.itemsIndexes[topIdx][leftIdx] = i;
this.colorItems[i].topIdx = topIdx;
this.colorItems[i].leftIdx = leftIdx;
if (this._layoutParams.columns<leftIdx) this._layoutParams.columns = leftIdx;
}
this._layoutParams.rows = this._layoutParams.itemsIndexes.length;
this._layoutParams.columns++;
},
attachKeyEvents: function() {
if (this.enableKeyEvents) {
var el = this.$el || $(this.el);
el.addClass('canfocused');
el.attr('tabindex', this.tabindex.toString());
el.on('keydown', _.bind(this.onKeyDown, this));
}
},
focus: function(index) {
var el = this.$el || $(this.el);
el && el.focus();
if (typeof index == 'string') {
if (index == 'first') {
this.selectByIndex(0, true);
} else if (index == 'last') {
if (this._layoutParams === undefined)
this.fillIndexesArray();
this.selectByIndex(this._layoutParams.itemsIndexes[this._layoutParams.rows-1][0], true);
}
} else if (index !== undefined)
this.selectByIndex(index, true);
},
focusInner: function(e) {
this.focus(e.keyCode == Common.UI.Keys.DOWN ? 'first' : 'last');
},
textThemeColors : 'Theme Colors', textThemeColors : 'Theme Colors',
textStandartColors : 'Standard Colors', textStandartColors : 'Standart Colors'
textRecentColors : 'Recent Colors'
}, Common.UI.ThemeColorPalette || {})); }, Common.UI.ThemeColorPalette || {}));
}); });

View file

@ -104,17 +104,12 @@
offset : opts.offset, offset : opts.offset,
cls : opts.cls, cls : opts.cls,
html : opts.html, html : opts.html,
hideonclick : opts.hideonclick, hideonclick : opts.hideonclick
keepvisible: opts.keepvisible
}); });
if (opts.hideonclick) { if (opts.hideonclick) {
var me = this;
var tip = this.$element.data('bs.tooltip'); var tip = this.$element.data('bs.tooltip');
if (tip) tip.tip().on('click', function() { if (tip) tip.tip().on('click', function() {tip.hide();});
tip.hide();
me.trigger('tooltip:hideonclick', this);
});
} }
this.$element.on('shown.bs.tooltip', _.bind(this.onTipShown, this)); this.$element.on('shown.bs.tooltip', _.bind(this.onTipShown, this));

View file

@ -159,12 +159,11 @@ define([
showLast: true, showLast: true,
allowScrollbar: true, allowScrollbar: true,
scrollAlwaysVisible: true, scrollAlwaysVisible: true,
emptyItemText: '', emptyItemText: ''
keyMoveDirection: 'both'
}, },
template: _.template([ template: _.template([
'<div class="treeview inner" style="<%= style %>"></div>' '<div class="treeview inner"></div>'
].join('')), ].join('')),
initialize : function(options) { initialize : function(options) {
@ -176,11 +175,11 @@ define([
'<div class="tree-caret img-commonctrl ' + '<% if (!isExpanded) { %>' + 'up' + '<% } %>' + '" style="margin-left: <%= level*16 %>px;"></div>', '<div class="tree-caret img-commonctrl ' + '<% if (!isExpanded) { %>' + 'up' + '<% } %>' + '" style="margin-left: <%= level*16 %>px;"></div>',
'<% } %>', '<% } %>',
'<% if (isNotHeader) { %>', '<% if (isNotHeader) { %>',
'<div class="name not-header"><%= Common.Utils.String.htmlEncode(name) %></div>', '<div class="name not-header"><%= name %></div>',
'<% } else if (isEmptyItem) { %>', '<% } else if (isEmptyItem) { %>',
'<div class="name empty">' + options.emptyItemText + '</div>', '<div class="name empty">' + options.emptyItemText + '</div>',
'<% } else { %>', '<% } else { %>',
'<div class="name"><%= Common.Utils.String.htmlEncode(name) %></div>', '<div class="name"><%= name %></div>',
'<% } %>', '<% } %>',
'</div>' '</div>'
].join('')); ].join(''));
@ -198,7 +197,7 @@ define([
if (innerEl) { if (innerEl) {
(this.dataViewItems.length<1) && innerEl.find('.empty-text').remove(); (this.dataViewItems.length<1) && innerEl.find('.empty-text').remove();
if (opts && (typeof opts.at==='number')) { if (opts && opts.at!==undefined) {
var idx = opts.at; var idx = opts.at;
var innerDivs = innerEl.find('> div'); var innerDivs = innerEl.find('> div');
if (idx > 0) if (idx > 0)
@ -212,7 +211,19 @@ define([
this.dataViewItems.push(view); this.dataViewItems.push(view);
} }
this.updateTip(view); var name = record.get('name');
if (name.length > 37 - record.get('level')*2)
record.set('tip', name);
if (record.get('tip')) {
var view_el = $(view.el);
view_el.attr('data-toggle', 'tooltip');
view_el.tooltip({
title : record.get('tip'),
placement : 'cursor',
zIndex : this.tipZIndex
});
}
this.listenTo(view, 'change', this.onChangeItem); this.listenTo(view, 'change', this.onChangeItem);
this.listenTo(view, 'remove', this.onRemoveItem); this.listenTo(view, 'remove', this.onRemoveItem);
this.listenTo(view, 'click', this.onClickItem); this.listenTo(view, 'click', this.onClickItem);
@ -235,165 +246,24 @@ define([
var isExpanded = !record.get('isExpanded'); var isExpanded = !record.get('isExpanded');
record.set('isExpanded', isExpanded); record.set('isExpanded', isExpanded);
this.store[(isExpanded) ? 'expandSubItems' : 'collapseSubItems'](record); this.store[(isExpanded) ? 'expandSubItems' : 'collapseSubItems'](record);
this.scroller.update({minScrollbarLength: this.minScrollbarLength, alwaysVisibleY: this.scrollAlwaysVisible}); this.scroller.update({minScrollbarLength: 40, alwaysVisibleY: this.scrollAlwaysVisible});
} else } else
Common.UI.DataView.prototype.onClickItem.call(this, view, record, e); Common.UI.DataView.prototype.onClickItem.call(this, view, record, e);
}, },
expandAll: function() { expandAll: function() {
this.store.expandAll(); this.store.expandAll();
this.scroller.update({minScrollbarLength: this.minScrollbarLength, alwaysVisibleY: this.scrollAlwaysVisible}); this.scroller.update({minScrollbarLength: 40, alwaysVisibleY: this.scrollAlwaysVisible});
}, },
collapseAll: function() { collapseAll: function() {
this.store.collapseAll(); this.store.collapseAll();
this.scroller.update({minScrollbarLength: this.minScrollbarLength, alwaysVisibleY: this.scrollAlwaysVisible}); this.scroller.update({minScrollbarLength: 40, alwaysVisibleY: this.scrollAlwaysVisible});
}, },
expandToLevel: function(expandLevel) { expandToLevel: function(expandLevel) {
this.store.expandToLevel(expandLevel); this.store.expandToLevel(expandLevel);
this.scroller.update({minScrollbarLength: this.minScrollbarLength, alwaysVisibleY: this.scrollAlwaysVisible}); this.scroller.update({minScrollbarLength: 40, alwaysVisibleY: this.scrollAlwaysVisible});
},
expandRecord: function(record) {
if (record) {
record.set('isExpanded', true);
this.store.expandSubItems(record);
this.scroller.update({minScrollbarLength: this.minScrollbarLength, alwaysVisibleY: this.scrollAlwaysVisible});
}
},
collapseRecord: function(record) {
if (record) {
record.set('isExpanded', false);
this.store.collapseSubItems(record);
this.scroller.update({minScrollbarLength: this.minScrollbarLength, alwaysVisibleY: this.scrollAlwaysVisible});
}
},
onKeyDown: function (e, data) {
if ( this.disabled ) return;
if (data===undefined) data = e;
if (_.indexOf(this.moveKeys, data.keyCode)>-1 || data.keyCode==Common.UI.Keys.RETURN) {
data.preventDefault();
data.stopPropagation();
var rec = this.getSelectedRec();
if (this.lastSelectedRec===null)
this.lastSelectedRec = rec;
if (data.keyCode==Common.UI.Keys.RETURN) {
this.lastSelectedRec = null;
if (this.selectedBeforeHideRec) // only for ComboDataView menuPicker
rec = this.selectedBeforeHideRec;
this.trigger('item:click', this, this, rec, e);
this.trigger('item:select', this, this, rec, e);
this.trigger('entervalue', this, rec, e);
if (this.parentMenu)
this.parentMenu.hide();
} else {
var idx = _.indexOf(this.store.models, rec);
if (idx<0) {
if (data.keyCode==Common.UI.Keys.LEFT) {
var target = $(e.target).closest('.dropdown-submenu.over');
if (target.length>0) {
target.removeClass('over');
target.find('> a').focus();
} else
idx = 0;
} else
idx = 0;
} else if (this.options.keyMoveDirection == 'both') {
var hasSubItems = rec.get('hasSubItems');
var hasParent = rec.get('hasParent');
var isExpanded = rec.get('isExpanded');
if (data.keyCode==Common.UI.Keys.LEFT) {
if (hasSubItems && isExpanded)
this.collapseRecord(rec);
} else if (data.keyCode==Common.UI.Keys.RIGHT) {
if (hasSubItems && !isExpanded)
this.expandRecord(rec);
} else {
if (data.keyCode==Common.UI.Keys.DOWN) {
for (var i=idx+1; i<this.store.length; i++) {
if (this.store.at(i).get('isVisible')) {
idx=i;
break;
}
}
} else if (data.keyCode==Common.UI.Keys.UP) {
for (var i=idx-1; i>=0; i--) {
if (this.store.at(i).get('isVisible')) {
idx=i;
break;
}
}
}
}
} else {
idx = (data.keyCode==Common.UI.Keys.UP || data.keyCode==Common.UI.Keys.LEFT)
? Math.max(0, idx-1)
: Math.min(this.store.length - 1, idx + 1) ;
}
if (idx !== undefined && idx>=0) rec = this.store.at(idx);
if (rec) {
this._fromKeyDown = true;
this.selectRecord(rec);
this._fromKeyDown = false;
this.scrollToRecord(rec);
}
}
} else {
this.trigger('item:keydown', this, rec, e);
}
},
focus: function() {
this.cmpEl && this.cmpEl.find('.treeview').focus();
},
updateTip: function(item) {
var record = item.model,
name = record.get('name'),
me = this;
if (name.length > 37 - record.get('level')*2)
record.set('tip', name);
else
record.set('tip', '');
var el = item.$el || $(item.el);
var tip = el.data('bs.tooltip');
if (tip) {
if (tip.dontShow===undefined)
tip.dontShow = true;
el.removeData('bs.tooltip');
}
if (record.get('tip')) {
el.attr('data-toggle', 'tooltip');
el.tooltip({
title : record.get('tip'),
placement : 'cursor',
zIndex : this.tipZIndex
});
if (this.delayRenderTips)
el.one('mouseenter', function(){
el.attr('data-toggle', 'tooltip');
el.tooltip({
title : record.get('tip'),
placement : 'cursor',
zIndex : me.tipZIndex
});
el.mouseenter();
});
else {
el.attr('data-toggle', 'tooltip');
el.tooltip({
title : record.get('tip'),
placement : 'cursor',
zIndex : me.tipZIndex
});
}
}
} }
} }
})()); })());

View file

@ -136,9 +136,7 @@
var Common = {}; var Common = {};
define([ define([
'common/main/lib/component/BaseView', 'common/main/lib/component/BaseView'
'common/main/lib/component/CheckBox',
'common/main/lib/controller/FocusManager'
], function () { ], function () {
'use strict'; 'use strict';
@ -153,7 +151,6 @@ define([
alias: 'Window', alias: 'Window',
cls: '', cls: '',
toolclose: 'close', toolclose: 'close',
help: false,
maxwidth: undefined, maxwidth: undefined,
maxheight: undefined, maxheight: undefined,
minwidth: 0, minwidth: 0,
@ -164,14 +161,9 @@ define([
var template = '<div class="asc-window<%= modal?" modal":"" %><%= cls?" "+cls:"" %>" id="<%= id %>" style="width:<%= width %>px;">' + var template = '<div class="asc-window<%= modal?" modal":"" %><%= cls?" "+cls:"" %>" id="<%= id %>" style="width:<%= width %>px;">' +
'<% if (header==true) { %>' + '<% if (header==true) { %>' +
'<div class="header">' + '<div class="header">' +
'<div class="tools">' +
'<% if (closable!==false) %>' + '<% if (closable!==false) %>' +
'<div class="tool close"></div>' + '<div class="tool close img-commonctrl"></div>' +
'<% %>' + '<% %>' +
'<% if (help===true) %>' +
'<div class="tool help">?</div>' +
'<% %>' +
'</div>' +
'<div class="title"><%= title %></div> ' + '<div class="title"><%= title %></div> ' +
'</div>' + '</div>' +
'<% } %>' + '<% } %>' +
@ -227,42 +219,24 @@ define([
} }
} }
function _readDocumetGeometry() {
if (window.innerHeight == undefined) {
var width = document.documentElement.offsetWidth,
height = document.documentElement.offsetHeight;
} else {
width = Common.Utils.innerWidth();
height = Common.Utils.innerHeight();
}
height -= Common.Utils.InternalSettings.get('window-inactive-area-top');
return {width: width, height: height, top: Common.Utils.InternalSettings.get('window-inactive-area-top')};
}
function _autoSize() {
if (this.initConfig.height == 'auto') {
var height = Math.ceil(parseFloat(this.$window.find('> .body').css('height')));
this.initConfig.header && (height += parseInt(this.$window.find('> .header').css('height')));
this.$window.height(height);
}
}
function _centre() { function _centre() {
var main_geometry = _readDocumetGeometry(), if (window.innerHeight == undefined) {
main_width = main_geometry.width, var main_width = document.documentElement.offsetWidth;
main_height = main_geometry.height; var main_height = document.documentElement.offsetHeight;
} else {
main_width = Common.Utils.innerWidth();
main_height = Common.Utils.innerHeight();
}
if (this.initConfig.height == 'auto') { if (this.initConfig.height == 'auto') {
var win_height = parseInt(this.$window.find('.body').css('height')); var win_height = parseInt(this.$window.find('.body').css('height'));
this.initConfig.header && (win_height += parseInt(this.$window.find('.header').css('height'))); this.initConfig.header && (win_height += parseInt(this.$window.find('.header').css('height')));
} else { } else
win_height = this.initConfig.height; win_height = this.initConfig.height;
win_height > main_height && (win_height = main_height);
}
var win_width = (this.initConfig.width=='auto') ? parseInt(this.$window.find('.body').css('width')) : this.initConfig.width; var win_width = (this.initConfig.width=='auto') ? parseInt(this.$window.find('.body').css('width')) : this.initConfig.width;
var top = main_geometry.top + Math.floor((parseInt(main_height) - parseInt(win_height)) / 2); var top = Math.floor((parseInt(main_height) - parseInt(win_height)) / 2);
var left = Math.floor((parseInt(main_width) - parseInt(win_width)) / 2); var left = Math.floor((parseInt(main_width) - parseInt(win_width)) / 2);
this.$window.css('left',left); this.$window.css('left',left);
@ -270,21 +244,18 @@ define([
} }
function _setVisible() { function _setVisible() {
var main_geometry = _readDocumetGeometry(), if (window.innerHeight == undefined) {
main_width = main_geometry.width, var main_width = document.documentElement.offsetWidth;
main_height = main_geometry.height; var main_height = document.documentElement.offsetHeight;
} else {
main_width = Common.Utils.innerWidth();
main_height = Common.Utils.innerHeight();
}
if (this.getLeft() + this.getWidth() > main_width) if (this.getLeft() + this.getWidth() > main_width)
this.$window.css('left', main_width - this.getWidth()); this.$window.css('left', main_width - this.getWidth());
if (this.getTop() + this.getHeight() > main_height)
if (this.getTop() < main_geometry.top ) this.$window.css('top', main_height - this.getHeight());
this.$window.css('top', main_geometry.top);
else
if (this.getTop() + this.getHeight() > main_height) {
if (main_height - this.getHeight() < 0)
this.$window.css('top', main_geometry.top);
else this.$window.css('top', main_geometry.top + main_height - this.getHeight());
}
} }
function _getTransformation(end) { function _getTransformation(end) {
@ -299,22 +270,23 @@ define([
/* window drag's functions */ /* window drag's functions */
function _dragstart(event) { function _dragstart(event) {
if ( $(event.target).hasClass('close') || $(event.target).hasClass('help') ) return; if ( $(event.target).hasClass('close') ) return;
Common.UI.Menu.Manager.hideAll(); Common.UI.Menu.Manager.hideAll();
var zoom = (event instanceof jQuery.Event) ? Common.Utils.zoom() : 1; var zoom = (event instanceof jQuery.Event) ? Common.Utils.zoom() : 1;
this.dragging.enabled = true; this.dragging.enabled = true;
this.dragging.initx = event.pageX*zoom - this.getLeft(); this.dragging.initx = event.pageX*zoom - this.getLeft();
this.dragging.inity = event.pageY*zoom - this.getTop(); this.dragging.inity = event.pageY*zoom - this.getTop();
var main_geometry = _readDocumetGeometry(), if (window.innerHeight == undefined) {
main_width = main_geometry.width, var main_width = document.documentElement.offsetWidth;
main_height = main_geometry.height; var main_height = document.documentElement.offsetHeight;
} else {
main_width = Common.Utils.innerWidth();
main_height = Common.Utils.innerHeight();
}
this.dragging.maxx = main_width - this.getWidth(); this.dragging.maxx = main_width - this.getWidth();
this.dragging.maxy = main_height - this.getHeight(); this.dragging.maxy = main_height - this.getHeight();
if (this.dragging.maxy < 0)
this.dragging.maxy = 0;
this.dragging.maxy += main_geometry.top;
$(document).on('mousemove', this.binding.drag); $(document).on('mousemove', this.binding.drag);
$(document).on('mouseup', this.binding.dragStop); $(document).on('mouseup', this.binding.dragStop);
@ -339,11 +311,10 @@ define([
if (this.dragging.enabled) { if (this.dragging.enabled) {
var zoom = (event instanceof jQuery.Event) ? Common.Utils.zoom() : 1, var zoom = (event instanceof jQuery.Event) ? Common.Utils.zoom() : 1,
left = event.pageX*zoom - this.dragging.initx, left = event.pageX*zoom - this.dragging.initx,
top = event.pageY*zoom - this.dragging.inity, top = event.pageY*zoom - this.dragging.inity;
topedge = Common.Utils.InternalSettings.get('window-inactive-area-top');
left < 0 ? (left = 0) : left > this.dragging.maxx && (left = this.dragging.maxx); left < 0 ? (left = 0) : left > this.dragging.maxx && (left = this.dragging.maxx);
top < topedge ? (top = topedge) : top > this.dragging.maxy && (top = this.dragging.maxy); top < 0 ? (top = 0) : top > this.dragging.maxy && (top = this.dragging.maxy);
this.$window.css({left: left, top: top}); this.$window.css({left: left, top: top});
} }
@ -372,17 +343,25 @@ define([
this.resizing.inith = this.getHeight(); this.resizing.inith = this.getHeight();
this.resizing.type = [el.hasClass('left') ? -1 : (el.hasClass('right') ? 1 : 0), el.hasClass('top') ? -1 : (el.hasClass('bottom') ? 1 : 0)]; this.resizing.type = [el.hasClass('left') ? -1 : (el.hasClass('right') ? 1 : 0), el.hasClass('top') ? -1 : (el.hasClass('bottom') ? 1 : 0)];
var main_geometry = _readDocumetGeometry(), var main_width = (window.innerHeight == undefined) ? document.documentElement.offsetWidth : Common.Utils.innerWidth(),
main_width = main_geometry.width, main_height = (window.innerHeight == undefined) ? document.documentElement.offsetHeight : Common.Utils.innerHeight(),
main_height = main_geometry.height; maxwidth = (this.initConfig.maxwidth) ? this.initConfig.maxwidth : main_width,
var maxwidth = (this.initConfig.maxwidth) ? this.initConfig.maxwidth : main_width,
maxheight = (this.initConfig.maxheight) ? this.initConfig.maxheight : main_height; maxheight = (this.initConfig.maxheight) ? this.initConfig.maxheight : main_height;
this.resizing.minw = this.initConfig.minwidth; if (this.resizing.type[0]>0) {
this.resizing.maxw = (this.resizing.type[0]>0) ? Math.min(main_width-left, maxwidth) : Math.min(left+this.resizing.initw, maxwidth); this.resizing.maxx = Math.min(main_width, left+maxwidth);
this.resizing.minx = left+this.initConfig.minwidth;
this.resizing.minh = this.initConfig.minheight; } else if (this.resizing.type[0]<0) {
this.resizing.maxh = (this.resizing.type[1]>0) ? Math.min(main_height-top, maxheight) : Math.min(top+this.resizing.inith, maxheight); this.resizing.maxx = left+this.resizing.initw-this.initConfig.minwidth;
this.resizing.minx = Math.max(0, left+this.resizing.initw-maxwidth);
}
if (this.resizing.type[1]>0) {
this.resizing.maxy = Math.min(main_height, top+maxheight);
this.resizing.miny = top+this.initConfig.minheight;
} else if (this.resizing.type[1]<0) {
this.resizing.maxy = top+this.resizing.inith-this.initConfig.minheight;
this.resizing.miny = Math.max(0, top+this.resizing.inith-maxheight);
}
$(document.body).css('cursor', el.css('cursor')); $(document.body).css('cursor', el.css('cursor'));
this.$window.find('.resize-border').addClass('resizing'); this.$window.find('.resize-border').addClass('resizing');
@ -399,34 +378,16 @@ define([
zoom = (event instanceof jQuery.Event) ? Common.Utils.zoom() : 1, zoom = (event instanceof jQuery.Event) ? Common.Utils.zoom() : 1,
pageX = event.pageX*zoom, pageX = event.pageX*zoom,
pageY = event.pageY*zoom; pageY = event.pageY*zoom;
if (this.resizing.type[0]) { if (this.resizing.type[0] && pageX<this.resizing.maxx && pageX>this.resizing.minx) {
var new_width = this.resizing.initw + (pageX - this.resizing.initpage_x) * this.resizing.type[0];
if (new_width>this.resizing.maxw) {
pageX = pageX - (new_width-this.resizing.maxw) * this.resizing.type[0];
new_width = this.resizing.maxw;
} else if (new_width<this.resizing.minw) {
pageX = pageX - (new_width-this.resizing.minw) * this.resizing.type[0];
new_width = this.resizing.minw;
}
if (this.resizing.type[0]<0) if (this.resizing.type[0]<0)
this.$window.css({left: pageX - this.resizing.initx}); this.$window.css({left: pageX - this.resizing.initx});
this.setWidth(new_width); this.setWidth(this.resizing.initw + (pageX - this.resizing.initpage_x) * this.resizing.type[0]);
resized = true; resized = true;
} }
if (this.resizing.type[1]) { if (this.resizing.type[1] && pageY<this.resizing.maxy && pageY>this.resizing.miny) {
var new_height = this.resizing.inith + (pageY - this.resizing.initpage_y) * this.resizing.type[1];
if (new_height>this.resizing.maxh) {
pageY = pageY - (new_height-this.resizing.maxh) * this.resizing.type[1];
new_height = this.resizing.maxh;
} else if (new_height<this.resizing.minh) {
pageY = pageY - (new_height-this.resizing.minh) * this.resizing.type[1];
new_height = this.resizing.minh;
}
if (this.resizing.type[1]<0) if (this.resizing.type[1]<0)
this.$window.css({top: pageY - this.resizing.inity}); this.$window.css({top: pageY - this.resizing.inity});
this.setHeight(new_height); this.setHeight(this.resizing.inith + (pageY - this.resizing.initpage_y) * this.resizing.type[1]);
resized = true; resized = true;
} }
if (resized) this.fireEvent('resizing'); if (resized) this.fireEvent('resizing');
@ -455,12 +416,12 @@ define([
if (!options.width) options.width = 'auto'; if (!options.width) options.width = 'auto';
var template = '<div class="info-box">' + var template = '<div class="info-box">' +
'<% if (typeof iconCls !== "undefined") { %><div class="icon <%= iconCls %>"></div><% } %>' + '<% if (typeof iconCls !== "undefined") { %><div class="icon img-commonctrl <%= iconCls %>" /><% } %>' +
'<div class="text" <% if (typeof iconCls == "undefined") { %> style="padding-left:10px;" <% } %>><span><%= msg %></span>' + '<div class="text" <% if (typeof iconCls == "undefined") { %> style="padding-left:10px;" <% } %>><span><%= msg %></span>' +
'<% if (dontshow) { %><div class="dont-show-checkbox"></div><% } %>' + '<% if (dontshow) { %><div class="dont-show-checkbox"></div><% } %>' +
'</div>' + '</div>' +
'</div>' + '</div>' +
'<% if (dontshow) { %><div class="separator horizontal" style="width: 100%;"></div><% } %>'; '<% if (dontshow) { %><div class="separator horizontal" style="width: 100%;"/><% } %>';
_.extend(options, { _.extend(options, {
cls: 'alert', cls: 'alert',
@ -473,7 +434,7 @@ define([
function autoSize(window) { function autoSize(window) {
var text_cnt = window.getChild('.info-box'); var text_cnt = window.getChild('.info-box');
var text = window.getChild('.info-box .text > span'); var text = window.getChild('.info-box span');
var footer = window.getChild('.footer'); var footer = window.getChild('.footer');
var header = window.getChild('.header'); var header = window.getChild('.header');
var body = window.getChild('.body'); var body = window.getChild('.body');
@ -488,15 +449,14 @@ define([
options.width = options.maxwidth; options.width = options.maxwidth;
} }
if (options.width=='auto') { if (options.width=='auto') {
text_cnt.height(Math.max(text.height(), icon_height) + ((check.length>0) ? (check.height() + parseInt(check.css('margin-top'))) : 0)); text_cnt.height(Math.max(text.height() + ((check.length>0) ? (check.height() + parseInt(check.css('margin-top'))) : 0), icon_height));
body.height(parseInt(text_cnt.css('height')) + parseInt(footer.css('height'))); body.height(parseInt(text_cnt.css('height')) + parseInt(footer.css('height')));
var span_el = check.find('span'); window.setSize(text.position().left + text.width() + parseInt(text_cnt.css('padding-right')),
window.setSize(Math.max(text.width(), span_el.length>0 ? span_el.position().left + span_el.width() : 0) + text.position().left + parseInt(text_cnt.css('padding-right')),
parseInt(body.css('height')) + parseInt(header.css('height'))); parseInt(body.css('height')) + parseInt(header.css('height')));
} else { } else {
text.css('white-space', 'normal'); text.css('white-space', 'normal');
window.setWidth(options.width); window.setWidth(options.width);
text_cnt.height(Math.max(text.height(), icon_height) + ((check.length>0) ? (check.height() + parseInt(check.css('margin-top'))) : 0)); text_cnt.height(Math.max(text.height() + ((check.length>0) ? (check.height() + parseInt(check.css('margin-top'))) : 0), icon_height));
body.height(parseInt(text_cnt.css('height')) + parseInt(footer.css('height'))); body.height(parseInt(text_cnt.css('height')) + parseInt(footer.css('height')));
window.setHeight(parseInt(body.css('height')) + parseInt(header.css('height'))); window.setHeight(parseInt(body.css('height')) + parseInt(header.css('height')));
} }
@ -524,7 +484,7 @@ define([
footer.find('.dlg-btn').on('click', onBtnClick); footer.find('.dlg-btn').on('click', onBtnClick);
chDontShow = new Common.UI.CheckBox({ chDontShow = new Common.UI.CheckBox({
el: win.$window.find('.dont-show-checkbox'), el: win.$window.find('.dont-show-checkbox'),
labelText: options.textDontShow || win.textDontShow labelText: win.textDontShow
}); });
autoSize(obj); autoSize(obj);
}, },
@ -537,14 +497,13 @@ define([
}); });
win.show(); win.show();
return win;
}; };
Common.UI.error = function(options) { Common.UI.error = function(options) {
options = options || {}; options = options || {};
!options.title && (options.title = this.Window.prototype.textError); !options.title && (options.title = this.Window.prototype.textError);
return Common.UI.alert( Common.UI.alert(
_.extend(options, { _.extend(options, {
iconCls: 'error' iconCls: 'error'
}) })
@ -555,7 +514,7 @@ define([
options = options || {}; options = options || {};
!options.title && (options.title = this.Window.prototype.textConfirmation); !options.title && (options.title = this.Window.prototype.textConfirmation);
return Common.UI.alert( Common.UI.alert(
_.extend(options, { _.extend(options, {
iconCls: 'confirm' iconCls: 'confirm'
}) })
@ -566,7 +525,7 @@ define([
options = options || {}; options = options || {};
!options.title && (options.title = this.Window.prototype.textInformation); !options.title && (options.title = this.Window.prototype.textInformation);
return Common.UI.alert( Common.UI.alert(
_.extend(options, { _.extend(options, {
iconCls: 'info' iconCls: 'info'
}) })
@ -577,7 +536,7 @@ define([
options = options || {}; options = options || {};
!options.title && (options.title = this.Window.prototype.textWarning); !options.title && (options.title = this.Window.prototype.textWarning);
return Common.UI.alert( Common.UI.alert(
_.extend(options, { _.extend(options, {
iconCls: 'warn' iconCls: 'warn'
}) })
@ -607,7 +566,7 @@ define([
if (b.value !== undefined) if (b.value !== undefined)
newBtns[b.value] = {text: b.caption, cls: 'custom' + ((b.primary || options.primary==b.value) ? ' primary' : '')}; newBtns[b.value] = {text: b.caption, cls: 'custom' + ((b.primary || options.primary==b.value) ? ' primary' : '')};
} else { } else {
newBtns[b] = {text: (b=='custom') ? options.customButtonText : arrBtns[b], cls: (options.primary==b || _.indexOf(options.primary, b)>-1) ? 'primary' : ''}; newBtns[b] = {text: (b=='custom') ? options.customButtonText : arrBtns[b], cls: (options.primary==b) ? 'primary' : ''};
if (b=='custom') if (b=='custom')
newBtns[b].cls += ' custom'; newBtns[b].cls += ' custom';
} }
@ -633,9 +592,6 @@ define([
this.$window = $('#' + this.initConfig.id); this.$window = $('#' + this.initConfig.id);
if (Common.Locale.getCurrentLanguage() && Common.Locale.getCurrentLanguage() !== 'en')
this.$window.attr('applang', Common.Locale.getCurrentLanguage());
this.binding.keydown = _.bind(_keydown,this); this.binding.keydown = _.bind(_keydown,this);
// $(document).on('keydown', this.binding.keydown); // $(document).on('keydown', this.binding.keydown);
@ -651,13 +607,8 @@ define([
else else
(this.initConfig.toolclose=='hide') ? this.hide() : this.close(); (this.initConfig.toolclose=='hide') ? this.hide() : this.close();
}; };
var dohelp = function() {
if ( this.$window.find('.tool.help').hasClass('disabled') ) return;
this.fireEvent('help',this);
};
this.$window.find('.header').on('mousedown', this.binding.dragStart); this.$window.find('.header').on('mousedown', this.binding.dragStart);
this.$window.find('.tool.close').on('click', _.bind(doclose, this)); this.$window.find('.tool.close').on('click', _.bind(doclose, this));
this.$window.find('.tool.help').on('click', _.bind(dohelp, this));
if (!this.initConfig.modal) if (!this.initConfig.modal)
Common.Gateway.on('processmouse', _.bind(_onProcessMouse, this)); Common.Gateway.on('processmouse', _.bind(_onProcessMouse, this));
@ -668,7 +619,11 @@ define([
}); });
} }
if (this.initConfig.height !== 'auto') { if (this.initConfig.height == 'auto') {
var height = parseInt(this.$window.find('> .body').css('height'));
this.initConfig.header && (height += parseInt(this.$window.find('> .header').css('height')));
this.$window.height(height);
} else {
this.$window.css('height',this.initConfig.height); this.$window.css('height',this.initConfig.height);
} }
@ -683,22 +638,6 @@ define([
this.initConfig.footerCls && this.$window.find('.footer').addClass(this.initConfig.footerCls); this.initConfig.footerCls && this.$window.find('.footer').addClass(this.initConfig.footerCls);
this.menuAddAlign = function(menuRoot, left, top) {
var self = this;
if (!me.$window.hasClass('notransform')) {
me.$window.addClass('notransform');
menuRoot.addClass('hidden');
setTimeout(function() {
menuRoot.removeClass('hidden');
menuRoot.css({left: left, top: top});
self.options.additionalAlign = null;
}, 300);
} else {
menuRoot.css({left: left, top: top});
self.options.additionalAlign = null;
}
};
this.fireEvent('render:after',this); this.fireEvent('render:after',this);
return this; return this;
}, },
@ -710,14 +649,13 @@ define([
mask.attr('counter', parseInt(mask.attr('counter'))+1); mask.attr('counter', parseInt(mask.attr('counter'))+1);
mask.show(); mask.show();
} else { } else {
var maskOpacity = $(':root').css('--modal-window-mask-opacity'); var opacity = mask.css('opacity');
mask.css('opacity', 0); mask.css('opacity', 0);
mask.attr('counter', parseInt(mask.attr('counter'))+1); mask.attr('counter', parseInt(mask.attr('counter'))+1);
mask.show(); mask.show();
setTimeout(function () { setTimeout(function () {
mask.css(_getTransformation(maskOpacity)); mask.css(_getTransformation(opacity));
}, 1); }, 1);
} }
@ -727,7 +665,6 @@ define([
if (!this.$window) { if (!this.$window) {
this.render(); this.render();
_autoSize.call(this);
if (_.isNumber(x) && _.isNumber(y)) { if (_.isNumber(x) && _.isNumber(y)) {
this.$window.css('left',Math.floor(x)); this.$window.css('left',Math.floor(x));
@ -770,9 +707,6 @@ define([
'-o-transform': 'scale(1)', '-o-transform': 'scale(1)',
'opacity': '1' 'opacity': '1'
}); });
setTimeout(function () {
me.fireEvent('animate:after', me);
}, 210);
}, 1); }, 1);
setTimeout(function () { setTimeout(function () {
@ -783,12 +717,9 @@ define([
this.$window.css({opacity: 1}); this.$window.css({opacity: 1});
this.$window.addClass('notransform'); this.$window.addClass('notransform');
this.fireEvent('show', this); this.fireEvent('show', this);
setTimeout(function () {
me.fireEvent('animate:after', me);
}, 10);
} }
Common.NotificationCenter.trigger('window:show', this); Common.NotificationCenter.trigger('window:show');
}, },
close: function(suppressevent) { close: function(suppressevent) {
@ -810,12 +741,12 @@ define([
if ( hide_mask ) { if ( hide_mask ) {
if (this.options.animate !== false) { if (this.options.animate !== false) {
var maskOpacity = $(':root').css('--modal-window-mask-opacity'); var opacity = mask.css('opacity');
mask.css(_getTransformation(0)); mask.css(_getTransformation(0));
setTimeout(function () { setTimeout(function () {
mask.css('opacity', opacity);
if (parseInt(mask.attr('counter'))<1) { if (parseInt(mask.attr('counter'))<1) {
mask.css('opacity', maskOpacity);
mask.hide(); mask.hide();
mask.attr('counter', 0); mask.attr('counter', 0);
} }
@ -828,7 +759,7 @@ define([
} }
} }
Common.NotificationCenter.trigger('modal:close', this, hide_mask && (parseInt(mask.attr('counter'))<1)); Common.NotificationCenter.trigger('modal:close', this);
} }
this.$window.remove(); this.$window.remove();
@ -851,12 +782,12 @@ define([
if ( hide_mask ) { if ( hide_mask ) {
if (this.options.animate !== false) { if (this.options.animate !== false) {
var maskOpacity = $(':root').css('--modal-window-mask-opacity'); var opacity = mask.css('opacity');
mask.css(_getTransformation(0)); mask.css(_getTransformation(0));
setTimeout(function () { setTimeout(function () {
mask.css('opacity', opacity);
if (parseInt(mask.attr('counter'))<1) { if (parseInt(mask.attr('counter'))<1) {
mask.css('opacity', maskOpacity);
mask.hide(); mask.hide();
mask.attr('counter', 0); mask.attr('counter', 0);
} }
@ -868,7 +799,7 @@ define([
} }
} }
} }
Common.NotificationCenter.trigger('modal:hide', this, hide_mask && (parseInt(mask.attr('counter'))<1)); Common.NotificationCenter.trigger('modal:hide', this);
} }
this.$window.hide(); this.$window.hide();
this.$window.removeClass('notransform'); this.$window.removeClass('notransform');
@ -976,13 +907,6 @@ define([
this.$window.find('.resize-border').remove(); this.$window.find('.resize-border').remove();
} }
this.resizable = resizable; this.resizable = resizable;
} else {
if (resizable) {
(minSize && minSize.length>1) && (this.initConfig.minwidth = minSize[0]);
(minSize && minSize.length>1) && (this.initConfig.minheight = minSize[1]);
(maxSize && maxSize.length>1) && (this.initConfig.maxwidth = maxSize[0]);
(maxSize && maxSize.length>1) && (this.initConfig.maxheight = maxSize[1]);
}
} }
}, },
@ -996,13 +920,6 @@ define([
onPrimary: function() {}, onPrimary: function() {},
getFocusedComponents: function() {
return [];
},
getDefaultFocusableComponent: function() {
},
cancelButtonText: 'Cancel', cancelButtonText: 'Cancel',
okButtonText: 'OK', okButtonText: 'OK',
yesButtonText: 'Yes', yesButtonText: 'Yes',

View file

@ -85,25 +85,16 @@ define([
storeUsers: this.getApplication().getCollection('Common.Collections.Users'), storeUsers: this.getApplication().getCollection('Common.Collections.Users'),
storeMessages: this.getApplication().getCollection('Common.Collections.ChatMessages') storeMessages: this.getApplication().getCollection('Common.Collections.ChatMessages')
}); });
this.panelChat.on('render:after', _.bind(this.onAfterRender, this));
},
onAfterRender: function(panel) {
var viewport = this.getApplication().getController('Viewport').getView('Viewport');
viewport.hlayout.on('layout:resizedrag', _.bind(function () {
panel && panel.updateScrolls();
}, this));
}, },
setMode: function(mode) { setMode: function(mode) {
this.mode = mode; this.mode = mode;
this.currentUserId = mode.user.id;
if (this.api) { if (this.api) {
if (this.mode.canCoAuthoring && this.mode.canChat) if (this.mode.canCoAuthoring && this.mode.canChat)
this.api.asc_registerCallback('asc_onCoAuthoringChatReceiveMessage', _.bind(this.onReceiveMessage, this)); this.api.asc_registerCallback('asc_onCoAuthoringChatReceiveMessage', _.bind(this.onReceiveMessage, this));
if ( !this.mode.isEditDiagram && !this.mode.isEditMailMerge && !this.mode.isEditOle ) { if ( !this.mode.isEditDiagram && !this.mode.isEditMailMerge ) {
this.api.asc_registerCallback('asc_onAuthParticipantsChanged', _.bind(this.onUsersChanged, this)); this.api.asc_registerCallback('asc_onAuthParticipantsChanged', _.bind(this.onUsersChanged, this));
this.api.asc_registerCallback('asc_onConnectionStateChanged', _.bind(this.onUserConnection, this)); this.api.asc_registerCallback('asc_onConnectionStateChanged', _.bind(this.onUserConnection, this));
this.api.asc_coAuthoringGetUsers(); this.api.asc_coAuthoringGetUsers();
@ -151,8 +142,7 @@ define([
username : user.asc_getUserName(), username : user.asc_getUserName(),
online : true, online : true,
color : user.asc_getColor(), color : user.asc_getColor(),
view : user.asc_getView(), view : user.asc_getView()
hidden : !(user.asc_getIdOriginal()===this.currentUserId || AscCommon.UserInfoParser.isUserVisible(user.asc_getUserName()))
}); });
arrUsers[(user.asc_getId() == currentUserId ) ? 'unshift' : 'push'](usermodel); arrUsers[(user.asc_getId() == currentUserId ) ? 'unshift' : 'push'](usermodel);
} }
@ -175,12 +165,10 @@ define([
username : change.asc_getUserName(), username : change.asc_getUserName(),
online : change.asc_getState(), online : change.asc_getState(),
color : change.asc_getColor(), color : change.asc_getColor(),
view : change.asc_getView(), view : change.asc_getView()
hidden : !(change.asc_getIdOriginal()===this.currentUserId || AscCommon.UserInfoParser.isUserVisible(change.asc_getUserName()))
})); }));
} else { } else {
user.set({online: change.asc_getState()}); user.set({online: change.asc_getState()});
user.set({username: change.asc_getUserName()});
} }
} }
}, },

View file

@ -102,9 +102,7 @@ define([
// work handlers // work handlers
'comment:closeEditing': _.bind(this.closeEditing, this), 'comment:closeEditing': _.bind(this.closeEditing, this)
'comment:sort': _.bind(this.setComparator, this),
'comment:filtergroups': _.bind(this.setFilterGroups, this)
}, },
'Common.Views.ReviewPopover': { 'Common.Views.ReviewPopover': {
@ -128,10 +126,6 @@ define([
'comment:closeEditing': _.bind(this.closeEditing, this), 'comment:closeEditing': _.bind(this.closeEditing, this),
'comment:disableHint': _.bind(this.disableHint, this), 'comment:disableHint': _.bind(this.disableHint, this),
'comment:addDummyComment': _.bind(this.onAddDummyComment, this) 'comment:addDummyComment': _.bind(this.onAddDummyComment, this)
},
'Common.Views.ReviewChanges': {
'comment:removeComments': _.bind(this.onRemoveComments, this),
'comment:resolveComments': _.bind(this.onResolveComments, this)
} }
}); });
@ -146,11 +140,10 @@ define([
}.bind(this)); }.bind(this));
}, },
onLaunch: function () { onLaunch: function () {
var filter = Common.localStorage.getKeysFilter();
this.appPrefix = (filter && filter.length) ? filter.split(',')[0] : '';
this.collection = this.getApplication().getCollection('Common.Collections.Comments'); this.collection = this.getApplication().getCollection('Common.Collections.Comments');
this.setComparator(); if (this.collection) {
this.collection.comparator = function (collection) { return -collection.get('time'); };
}
this.popoverComments = new Common.Collections.Comments(); this.popoverComments = new Common.Collections.Comments();
if (this.popoverComments) { if (this.popoverComments) {
@ -158,7 +151,6 @@ define([
} }
this.groupCollection = []; this.groupCollection = [];
this.userGroups = []; // for filtering comments
this.view = this.createView('Common.Views.Comments', { store: this.collection }); this.view = this.createView('Common.Views.Comments', { store: this.collection });
this.view.render(); this.view.render();
@ -174,6 +166,7 @@ define([
if (data) { if (data) {
this.currentUserId = data.config.user.id; this.currentUserId = data.config.user.id;
this.currentUserName = data.config.user.fullname;
this.sdkViewName = data['sdkviewname'] || this.sdkViewName; this.sdkViewName = data['sdkviewname'] || this.sdkViewName;
this.hintmode = data['hintmode'] || false; this.hintmode = data['hintmode'] || false;
this.viewmode = data['viewmode'] || false; this.viewmode = data['viewmode'] || false;
@ -187,7 +180,7 @@ define([
this.api.asc_registerCallback('asc_onAddComments', _.bind(this.onApiAddComments, this)); this.api.asc_registerCallback('asc_onAddComments', _.bind(this.onApiAddComments, this));
this.api.asc_registerCallback('asc_onRemoveComment', _.bind(this.onApiRemoveComment, this)); this.api.asc_registerCallback('asc_onRemoveComment', _.bind(this.onApiRemoveComment, this));
this.api.asc_registerCallback('asc_onChangeComments', _.bind(this.onChangeComments, this)); this.api.asc_registerCallback('asc_onChangeComments', _.bind(this.onChangeComments, this));
this.api.asc_registerCallback('asc_onRemoveComments', _.bind(this.onApiRemoveComments, this)); this.api.asc_registerCallback('asc_onRemoveComments', _.bind(this.onRemoveComments, this));
this.api.asc_registerCallback('asc_onChangeCommentData', _.bind(this.onApiChangeCommentData, this)); this.api.asc_registerCallback('asc_onChangeCommentData', _.bind(this.onApiChangeCommentData, this));
this.api.asc_registerCallback('asc_onLockComment', _.bind(this.onApiLockComment, this)); this.api.asc_registerCallback('asc_onLockComment', _.bind(this.onApiLockComment, this));
this.api.asc_registerCallback('asc_onUnLockComment', _.bind(this.onApiUnLockComment, this)); this.api.asc_registerCallback('asc_onUnLockComment', _.bind(this.onApiUnLockComment, this));
@ -195,8 +188,6 @@ define([
this.api.asc_registerCallback('asc_onHideComment', _.bind(this.onApiHideComment, this)); this.api.asc_registerCallback('asc_onHideComment', _.bind(this.onApiHideComment, this));
this.api.asc_registerCallback('asc_onUpdateCommentPosition', _.bind(this.onApiUpdateCommentPosition, this)); this.api.asc_registerCallback('asc_onUpdateCommentPosition', _.bind(this.onApiUpdateCommentPosition, this));
this.api.asc_registerCallback('asc_onDocumentPlaceChanged', _.bind(this.onDocumentPlaceChanged, this)); this.api.asc_registerCallback('asc_onDocumentPlaceChanged', _.bind(this.onDocumentPlaceChanged, this));
this.api.asc_registerCallback('asc_onDeleteComment', _.bind(this.onDeleteComment, this)); // only for PE, when del or ctrl+x pressed
this.api.asc_registerCallback('asc_onChangeCommentLogicalPosition', _.bind(this.onApiChangeCommentLogicalPosition, this)); // change comments position in document
} }
}, },
@ -209,42 +200,6 @@ define([
}, },
// //
setComparator: function(type) {
if (this.collection) {
var sort = (type !== undefined);
if (type === undefined) {
type = Common.localStorage.getItem(this.appPrefix + "comments-sort") || 'date-desc';
}
Common.localStorage.setItem(this.appPrefix + "comments-sort", type);
Common.Utils.InternalSettings.set(this.appPrefix + "comments-sort", type);
if (type=='position-asc' || type=='position-desc') {
var direction = (type=='position-asc') ? 1 : -1;
this.collection.comparator = function (collection) {
return direction * collection.get('position');
};
} else if (type=='author-asc' || type=='author-desc') {
var direction = (type=='author-asc') ? 1 : -1;
this.collection.comparator = function(item1, item2) {
var n1 = item1.get('parsedName').toLowerCase(),
n2 = item2.get('parsedName').toLowerCase();
if (n1==n2) return 0;
return (n1<n2) ? -direction : direction;
};
} else { // date
var direction = (type=='date-asc') ? 1 : -1;
this.collection.comparator = function (collection) {
return direction * collection.get('time');
};
}
sort && this.updateComments(true);
}
},
getComparator: function() {
return Common.Utils.InternalSettings.get(this.appPrefix + "comments-sort") || 'date';
},
onCreateComment: function (panel, commentVal, editMode, hidereply, documentFlag) { onCreateComment: function (panel, commentVal, editMode, hidereply, documentFlag) {
if (this.api && commentVal && commentVal.length > 0) { if (this.api && commentVal && commentVal.length > 0) {
var comment = buildCommentData(); // new asc_CCommentData(null); var comment = buildCommentData(); // new asc_CCommentData(null);
@ -259,7 +214,7 @@ define([
comment.asc_putTime(this.utcDateToString(new Date())); comment.asc_putTime(this.utcDateToString(new Date()));
comment.asc_putOnlyOfficeTime(this.ooDateToString(new Date())); comment.asc_putOnlyOfficeTime(this.ooDateToString(new Date()));
comment.asc_putUserId(this.currentUserId); comment.asc_putUserId(this.currentUserId);
comment.asc_putUserName(AscCommon.UserInfoParser.getCurrentName()); comment.asc_putUserName(this.currentUserName);
comment.asc_putSolved(false); comment.asc_putSolved(false);
if (!_.isUndefined(comment.asc_putDocumentFlag)) { if (!_.isUndefined(comment.asc_putDocumentFlag)) {
@ -278,18 +233,6 @@ define([
this.api.asc_removeComment(id); this.api.asc_removeComment(id);
} }
}, },
onRemoveComments: function (type) {
if (this.api) {
this.api.asc_RemoveAllComments(type=='my' || !this.mode.canDeleteComments, type=='current');// 1 param = true if remove only my comments, 2 param - remove current comments
}
},
onResolveComments: function (type) {
if (this.api) {
this.api.asc_ResolveAllComments(type=='my' || !this.mode.canEditComments, type=='current');// 1 param = true if resolve only my comments, 2 param - resolve current comments
}
},
onResolveComment: function (uid) { onResolveComment: function (uid) {
var t = this, var t = this,
reply = null, reply = null,
@ -310,7 +253,6 @@ define([
ascComment.asc_putUserName(comment.get('username')); ascComment.asc_putUserName(comment.get('username'));
ascComment.asc_putSolved(!comment.get('resolved')); ascComment.asc_putSolved(!comment.get('resolved'));
ascComment.asc_putGuid(comment.get('guid')); ascComment.asc_putGuid(comment.get('guid'));
ascComment.asc_putUserData(comment.get('userdata'));
if (!_.isUndefined(ascComment.asc_putDocumentFlag)) { if (!_.isUndefined(ascComment.asc_putDocumentFlag)) {
ascComment.asc_putDocumentFlag(comment.get('unattached')); ascComment.asc_putDocumentFlag(comment.get('unattached'));
@ -326,7 +268,6 @@ define([
addReply.asc_putOnlyOfficeTime(t.ooDateToString(new Date(reply.get('time')))); addReply.asc_putOnlyOfficeTime(t.ooDateToString(new Date(reply.get('time'))));
addReply.asc_putUserId(reply.get('userid')); addReply.asc_putUserId(reply.get('userid'));
addReply.asc_putUserName(reply.get('username')); addReply.asc_putUserName(reply.get('username'));
addReply.asc_putUserData(reply.get('userdata'));
ascComment.asc_addReply(addReply); ascComment.asc_addReply(addReply);
} }
@ -340,7 +281,7 @@ define([
return false; return false;
}, },
onShowComment: function (id, selected, fromLeftPanelSelection) { onShowComment: function (id, selected) {
var comment = this.findComment(id); var comment = this.findComment(id);
if (comment) { if (comment) {
if (null !== comment.get('quote')) { if (null !== comment.get('quote')) {
@ -368,12 +309,10 @@ define([
this.isSelectedComment = selected; this.isSelectedComment = selected;
} }
if (!fromLeftPanelSelection || !((0 === _.difference(this.uids, [id]).length) && (0 === _.difference([id], this.uids).length))) {
this.api.asc_selectComment(id); this.api.asc_selectComment(id);
this._dontScrollToComment = true; this._dontScrollToComment = true;
this.api.asc_showComment(id,false); this.api.asc_showComment(id,false);
} }
}
} else { } else {
if (this.hintmode) { if (this.hintmode) {
@ -404,10 +343,9 @@ define([
ascComment.asc_putTime(t.utcDateToString(new Date(comment.get('time')))); ascComment.asc_putTime(t.utcDateToString(new Date(comment.get('time'))));
ascComment.asc_putOnlyOfficeTime(t.ooDateToString(new Date(comment.get('time')))); ascComment.asc_putOnlyOfficeTime(t.ooDateToString(new Date(comment.get('time'))));
ascComment.asc_putUserId(t.currentUserId); ascComment.asc_putUserId(t.currentUserId);
ascComment.asc_putUserName(AscCommon.UserInfoParser.getCurrentName()); ascComment.asc_putUserName(t.currentUserName);
ascComment.asc_putSolved(comment.get('resolved')); ascComment.asc_putSolved(comment.get('resolved'));
ascComment.asc_putGuid(comment.get('guid')); ascComment.asc_putGuid(comment.get('guid'));
ascComment.asc_putUserData(comment.get('userdata'));
if (!_.isUndefined(ascComment.asc_putDocumentFlag)) { if (!_.isUndefined(ascComment.asc_putDocumentFlag)) {
ascComment.asc_putDocumentFlag(comment.get('unattached')); ascComment.asc_putDocumentFlag(comment.get('unattached'));
@ -434,7 +372,6 @@ define([
addReply.asc_putOnlyOfficeTime(t.ooDateToString(new Date(reply.get('time')))); addReply.asc_putOnlyOfficeTime(t.ooDateToString(new Date(reply.get('time'))));
addReply.asc_putUserId(reply.get('userid')); addReply.asc_putUserId(reply.get('userid'));
addReply.asc_putUserName(reply.get('username')); addReply.asc_putUserName(reply.get('username'));
addReply.asc_putUserData(reply.get('userdata'));
ascComment.asc_addReply(addReply); ascComment.asc_addReply(addReply);
} }
@ -466,7 +403,6 @@ define([
ascComment.asc_putUserName(comment.get('username')); ascComment.asc_putUserName(comment.get('username'));
ascComment.asc_putSolved(comment.get('resolved')); ascComment.asc_putSolved(comment.get('resolved'));
ascComment.asc_putGuid(comment.get('guid')); ascComment.asc_putGuid(comment.get('guid'));
ascComment.asc_putUserData(comment.get('userdata'));
if (!_.isUndefined(ascComment.asc_putDocumentFlag)) { if (!_.isUndefined(ascComment.asc_putDocumentFlag)) {
ascComment.asc_putDocumentFlag(comment.get('unattached')); ascComment.asc_putDocumentFlag(comment.get('unattached'));
@ -481,7 +417,7 @@ define([
if (reply.get('id') === replyId && !_.isUndefined(replyVal)) { if (reply.get('id') === replyId && !_.isUndefined(replyVal)) {
addReply.asc_putText(replyVal); addReply.asc_putText(replyVal);
addReply.asc_putUserId(me.currentUserId); addReply.asc_putUserId(me.currentUserId);
addReply.asc_putUserName(AscCommon.UserInfoParser.getCurrentName()); addReply.asc_putUserName(me.currentUserName);
} else { } else {
addReply.asc_putText(reply.get('reply')); addReply.asc_putText(reply.get('reply'));
addReply.asc_putUserId(reply.get('userid')); addReply.asc_putUserId(reply.get('userid'));
@ -490,7 +426,6 @@ define([
addReply.asc_putTime(me.utcDateToString(new Date(reply.get('time')))); addReply.asc_putTime(me.utcDateToString(new Date(reply.get('time'))));
addReply.asc_putOnlyOfficeTime(me.ooDateToString(new Date(reply.get('time')))); addReply.asc_putOnlyOfficeTime(me.ooDateToString(new Date(reply.get('time'))));
addReply.asc_putUserData(reply.get('userdata'));
ascComment.asc_addReply(addReply); ascComment.asc_addReply(addReply);
} }
@ -531,7 +466,6 @@ define([
ascComment.asc_putUserName(comment.get('username')); ascComment.asc_putUserName(comment.get('username'));
ascComment.asc_putSolved(comment.get('resolved')); ascComment.asc_putSolved(comment.get('resolved'));
ascComment.asc_putGuid(comment.get('guid')); ascComment.asc_putGuid(comment.get('guid'));
ascComment.asc_putUserData(comment.get('userdata'));
if (!_.isUndefined(ascComment.asc_putDocumentFlag)) { if (!_.isUndefined(ascComment.asc_putDocumentFlag)) {
ascComment.asc_putDocumentFlag(comment.get('unattached')); ascComment.asc_putDocumentFlag(comment.get('unattached'));
@ -548,7 +482,6 @@ define([
addReply.asc_putOnlyOfficeTime(me.ooDateToString(new Date(reply.get('time')))); addReply.asc_putOnlyOfficeTime(me.ooDateToString(new Date(reply.get('time'))));
addReply.asc_putUserId(reply.get('userid')); addReply.asc_putUserId(reply.get('userid'));
addReply.asc_putUserName(reply.get('username')); addReply.asc_putUserName(reply.get('username'));
addReply.asc_putUserData(reply.get('userdata'));
ascComment.asc_addReply(addReply); ascComment.asc_addReply(addReply);
} }
@ -561,12 +494,12 @@ define([
addReply.asc_putTime(me.utcDateToString(new Date())); addReply.asc_putTime(me.utcDateToString(new Date()));
addReply.asc_putOnlyOfficeTime(me.ooDateToString(new Date())); addReply.asc_putOnlyOfficeTime(me.ooDateToString(new Date()));
addReply.asc_putUserId(me.currentUserId); addReply.asc_putUserId(me.currentUserId);
addReply.asc_putUserName(AscCommon.UserInfoParser.getCurrentName()); addReply.asc_putUserName(me.currentUserName);
ascComment.asc_addReply(addReply); ascComment.asc_addReply(addReply);
me.api.asc_changeComment(id, ascComment); me.api.asc_changeComment(id, ascComment);
me.mode && me.mode.canRequestSendNotify && me.view.pickEMail(ascComment.asc_getGuid(), replyVal); me.mode && me.mode.canRequestUsers && me.view.pickEMail(ascComment.asc_getGuid(), replyVal);
return true; return true;
} }
@ -592,7 +525,6 @@ define([
ascComment.asc_putUserName(comment.get('username')); ascComment.asc_putUserName(comment.get('username'));
ascComment.asc_putSolved(comment.get('resolved')); ascComment.asc_putSolved(comment.get('resolved'));
ascComment.asc_putGuid(comment.get('guid')); ascComment.asc_putGuid(comment.get('guid'));
ascComment.asc_putUserData(comment.get('userdata'));
if (!_.isUndefined(ascComment.asc_putDocumentFlag)) { if (!_.isUndefined(ascComment.asc_putDocumentFlag)) {
ascComment.asc_putDocumentFlag(comment.get('unattached')); ascComment.asc_putDocumentFlag(comment.get('unattached'));
@ -609,7 +541,6 @@ define([
addReply.asc_putOnlyOfficeTime(me.ooDateToString(new Date(reply.get('time')))); addReply.asc_putOnlyOfficeTime(me.ooDateToString(new Date(reply.get('time'))));
addReply.asc_putUserId(reply.get('userid')); addReply.asc_putUserId(reply.get('userid'));
addReply.asc_putUserName(reply.get('username')); addReply.asc_putUserName(reply.get('username'));
addReply.asc_putUserData(reply.get('userdata'));
ascComment.asc_addReply(addReply); ascComment.asc_addReply(addReply);
} }
@ -697,15 +628,14 @@ define([
var end = true; var end = true;
for (var i = this.collection.length - 1; i >= 0; --i) { for (var i = this.collection.length - 1; i >= 0; --i) {
var item = this.collection.at(i); if (end) {
if (end && !item.get('hide') && !item.get('filtered')) { this.collection.at(i).set('last', true, {silent: true});
item.set('last', true, {silent: true});
end = false;
} else { } else {
if (item.get('last')) { if (this.collection.at(i).get('last')) {
item.set('last', false, {silent: true}); this.collection.at(i).set('last', false, {silent: true});
} }
} }
end = false;
} }
this.view.render(); this.view.render();
this.view.update(); this.view.update();
@ -735,7 +665,7 @@ define([
} else } else
this.collection.push(comment); this.collection.push(comment);
this.updateComments(true, this.getComparator() === 'position-asc' || this.getComparator() === 'position-desc'); // don't sort by position this.updateComments(true);
if (this.showPopover) { if (this.showPopover) {
if (null !== data.asc_getQuoteText()) { if (null !== data.asc_getQuoteText()) {
@ -755,7 +685,7 @@ define([
comment.get('groupName') ? this.addCommentToGroupCollection(comment) : this.collection.push(comment); comment.get('groupName') ? this.addCommentToGroupCollection(comment) : this.collection.push(comment);
} }
this.updateComments(true, this.getComparator() === 'position-asc' || this.getComparator() === 'position-desc'); this.updateComments(true);
}, },
onApiRemoveComment: function (id, silentUpdate) { onApiRemoveComment: function (id, silentUpdate) {
for (var name in this.groupCollection) { for (var name in this.groupCollection) {
@ -795,7 +725,7 @@ define([
this.updateComments(true); this.updateComments(true);
}, },
onApiRemoveComments: function (data) { onRemoveComments: function (data) {
for (var i = 0; i < data.length; ++i) { for (var i = 0; i < data.length; ++i) {
this.onApiRemoveComment(data[i], true); this.onApiRemoveComment(data[i], true);
} }
@ -818,29 +748,14 @@ define([
((data.asc_getTime() == '') ? new Date() : new Date(this.stringUtcToLocalDate(data.asc_getTime()))); ((data.asc_getTime() == '') ? new Date() : new Date(this.stringUtcToLocalDate(data.asc_getTime())));
var user = this.userCollection.findOriginalUser(data.asc_getUserId()); var user = this.userCollection.findOriginalUser(data.asc_getUserId());
var needSort = (this.getComparator() == 'author-asc' || this.getComparator() == 'author-desc') && (data.asc_getUserName() !== comment.get('username'));
comment.set('comment', data.asc_getText()); comment.set('comment', data.asc_getText());
comment.set('userid', data.asc_getUserId()); comment.set('userid', data.asc_getUserId());
comment.set('username', data.asc_getUserName()); comment.set('username', data.asc_getUserName());
comment.set('parsedName', AscCommon.UserInfoParser.getParsedName(data.asc_getUserName()));
comment.set('parsedGroups', AscCommon.UserInfoParser.getParsedGroups(data.asc_getUserName()));
comment.set('usercolor', (user) ? user.get('color') : null); comment.set('usercolor', (user) ? user.get('color') : null);
comment.set('resolved', data.asc_getSolved()); comment.set('resolved', data.asc_getSolved());
comment.set('quote', data.asc_getQuoteText()); comment.set('quote', data.asc_getQuoteText());
comment.set('userdata', data.asc_getUserData());
comment.set('time', date.getTime()); comment.set('time', date.getTime());
comment.set('date', t.dateToLocaleTimeString(date)); comment.set('date', t.dateToLocaleTimeString(date));
comment.set('editable', (t.mode.canEditComments || (data.asc_getUserId() == t.currentUserId)) && AscCommon.UserInfoParser.canEditComment(data.asc_getUserName()));
comment.set('removable', (t.mode.canDeleteComments || (data.asc_getUserId() == t.currentUserId)) && AscCommon.UserInfoParser.canDeleteComment(data.asc_getUserName()));
comment.set('hide', !AscCommon.UserInfoParser.canViewComment(data.asc_getUserName()));
if (!comment.get('hide')) {
var usergroups = comment.get('parsedGroups');
t.fillUserGroups(usergroups);
var group = Common.Utils.InternalSettings.get(t.appPrefix + "comments-filtergroups");
var filter = !!group && (group!==-1) && (!usergroups || usergroups.length<1 || usergroups.indexOf(group)<0);
comment.set('filtered', filter);
}
replies = _.clone(comment.get('replys')); replies = _.clone(comment.get('replys'));
@ -857,29 +772,22 @@ define([
id : Common.UI.getId(), id : Common.UI.getId(),
userid : data.asc_getReply(i).asc_getUserId(), userid : data.asc_getReply(i).asc_getUserId(),
username : data.asc_getReply(i).asc_getUserName(), username : data.asc_getReply(i).asc_getUserName(),
parsedName : AscCommon.UserInfoParser.getParsedName(data.asc_getReply(i).asc_getUserName()),
usercolor : (user) ? user.get('color') : null, usercolor : (user) ? user.get('color') : null,
date : t.dateToLocaleTimeString(dateReply), date : t.dateToLocaleTimeString(dateReply),
reply : data.asc_getReply(i).asc_getText(), reply : data.asc_getReply(i).asc_getText(),
userdata : data.asc_getReply(i).asc_getUserData(),
time : dateReply.getTime(), time : dateReply.getTime(),
editText : false, editText : false,
editTextInPopover : false, editTextInPopover : false,
showReplyInPopover : false, showReplyInPopover : false,
scope : t.view, scope : t.view,
editable : (t.mode.canEditComments || (data.asc_getReply(i).asc_getUserId() == t.currentUserId)) && AscCommon.UserInfoParser.canEditComment(data.asc_getReply(i).asc_getUserName()), editable : t.mode.canEditComments || (data.asc_getReply(i).asc_getUserId() == t.currentUserId)
removable : (t.mode.canDeleteComments || (data.asc_getReply(i).asc_getUserId() == t.currentUserId)) && AscCommon.UserInfoParser.canDeleteComment(data.asc_getReply(i).asc_getUserName())
})); }));
} }
comment.set('replys', replies); comment.set('replys', replies);
if (!this.popoverComments.findWhere({hide: false})) {
this.getPopover() && this.getPopover().hideComments();
}
if (!silentUpdate) { if (!silentUpdate) {
this.updateComments(needSort, !needSort); this.updateComments(false, true);
// if (this.getPopover() && this.getPopover().isVisible()) { // if (this.getPopover() && this.getPopover().isVisible()) {
// this._dontScrollToComment = true; // this._dontScrollToComment = true;
@ -913,13 +821,14 @@ define([
} }
}, },
onApiShowComment: function (uids, posX, posY, leftX, opts, hint) { onApiShowComment: function (uids, posX, posY, leftX, opts, hint) {
var apihint = hint;
var same_uids = (0 === _.difference(this.uids, uids).length) && (0 === _.difference(uids, this.uids).length); var same_uids = (0 === _.difference(this.uids, uids).length) && (0 === _.difference(uids, this.uids).length);
if (hint && this.isSelectedComment && same_uids && !this.isModeChanged) { if (hint && this.isSelectedComment && same_uids && !this.isModeChanged) {
// хотим показать тот же коментарий что был и выбран // хотим показать тот же коментарий что был и выбран
return; return;
} }
if (this.mode && !this.mode.canComments)
hint = true;
var popover = this.getPopover(); var popover = this.getPopover();
if (popover) { if (popover) {
@ -977,7 +886,7 @@ define([
this.animate = false; this.animate = false;
} }
this.isSelectedComment = !apihint || !this.hintmode; this.isSelectedComment = !hint || !this.hintmode;
this.uids = _.clone(uids); this.uids = _.clone(uids);
comments.push(comment); comments.push(comment);
@ -990,15 +899,12 @@ define([
}); });
this.popoverComments.reset(comments); this.popoverComments.reset(comments);
if (this.popoverComments.findWhere({hide: false})) {
if (popover.isVisible()) { if (popover.isVisible()) {
popover.hide(); popover.hide();
} }
popover.setLeftTop(posX, posY, leftX); popover.setLeftTop(posX, posY, leftX);
popover.showComments(animate, false, true, text); popover.showComments(animate, false, true, text);
} else
popover.hideComments();
} }
this.isModeChanged = false; this.isModeChanged = false;
}, },
@ -1076,12 +982,9 @@ define([
}); });
this.popoverComments.reset(comments); this.popoverComments.reset(comments);
if (this.popoverComments.findWhere({hide: false})) {
useAnimation = true; useAnimation = true;
this.getPopover().showComments(useAnimation, undefined, undefined, text); this.getPopover().showComments(useAnimation, undefined, undefined, text);
} else } else if (!this.getPopover().isVisible()) {
this.getPopover().hideComments();
} else if (!this.getPopover().isVisible() && this.popoverComments.findWhere({hide: false})) {
this.getPopover().showComments(false, undefined, undefined, text); this.getPopover().showComments(false, undefined, undefined, text);
} }
@ -1111,34 +1014,17 @@ define([
} }
}, },
onDeleteComment: function (id, comment) {
if (this.api) {
this.api.asc_RemoveAllComments(!this.mode.canDeleteComments, true);// 1 param = true if remove only my comments, 2 param - remove current comments
}
},
onApiChangeCommentLogicalPosition: function (comments) {
for (var uid in comments) {
if (comments.hasOwnProperty(uid)) {
var comment = this.findComment(uid) || this.findCommentInGroup(uid);
comment && comment.set('position', comments[uid]);
}
}
(this.getComparator() === 'position-asc' || this.getComparator() === 'position-desc') && this.updateComments(true);
},
// internal // internal
updateComments: function (needRender, disableSort, loadText) { updateComments: function (needRender, disableSort, loadText) {
var me = this; var me = this;
me.updateCommentsTime = new Date(); me.updateCommentsTime = new Date();
me.disableSort = !!disableSort;
if (me.timerUpdateComments===undefined) if (me.timerUpdateComments===undefined)
me.timerUpdateComments = setInterval(function(){ me.timerUpdateComments = setInterval(function(){
if ((new Date()) - me.updateCommentsTime>100) { if ((new Date()) - me.updateCommentsTime>100) {
clearInterval(me.timerUpdateComments); clearInterval(me.timerUpdateComments);
me.timerUpdateComments = undefined; me.timerUpdateComments = undefined;
me.updateCommentsView(needRender, me.disableSort, loadText); me.updateCommentsView(needRender, disableSort, loadText);
} }
}, 25); }, 25);
}, },
@ -1152,7 +1038,7 @@ define([
var i, end = true; var i, end = true;
if (!disableSort) { if (_.isUndefined(disableSort)) {
this.collection.sort(); this.collection.sort();
} }
@ -1160,15 +1046,14 @@ define([
this.onUpdateFilter(this.filter, true); this.onUpdateFilter(this.filter, true);
for (i = this.collection.length - 1; i >= 0; --i) { for (i = this.collection.length - 1; i >= 0; --i) {
var item = this.collection.at(i); if (end) {
if (end && !item.get('hide') && !item.get('filtered')) { this.collection.at(i).set('last', true, {silent: true});
item.set('last', true, {silent: true});
end = false;
} else { } else {
if (item.get('last')) { if (this.collection.at(i).get('last')) {
item.set('last', false, {silent: true}); this.collection.at(i).set('last', false, {silent: true});
} }
} }
end = false;
} }
this.view.render(); this.view.render();
@ -1248,9 +1133,7 @@ define([
commentsStore : this.popoverComments, commentsStore : this.popoverComments,
renderTo : this.sdkViewName, renderTo : this.sdkViewName,
canRequestUsers: (this.mode) ? this.mode.canRequestUsers : undefined, canRequestUsers: (this.mode) ? this.mode.canRequestUsers : undefined,
canRequestSendNotify: (this.mode) ? this.mode.canRequestSendNotify : undefined, canRequestSendNotify: (this.mode) ? this.mode.canRequestSendNotify : undefined
mentionShare: (this.mode) ? this.mode.mentionShare : true,
api: this.api
}); });
this.popover.setCommentsStore(this.popoverComments); this.popover.setCommentsStore(this.popoverComments);
} }
@ -1318,15 +1201,12 @@ define([
guid : data.asc_getGuid(), guid : data.asc_getGuid(),
userid : data.asc_getUserId(), userid : data.asc_getUserId(),
username : data.asc_getUserName(), username : data.asc_getUserName(),
parsedName : AscCommon.UserInfoParser.getParsedName(data.asc_getUserName()),
parsedGroups : AscCommon.UserInfoParser.getParsedGroups(data.asc_getUserName()),
usercolor : (user) ? user.get('color') : null, usercolor : (user) ? user.get('color') : null,
date : this.dateToLocaleTimeString(date), date : this.dateToLocaleTimeString(date),
quote : data.asc_getQuoteText(), quote : data.asc_getQuoteText(),
comment : data.asc_getText(), comment : data.asc_getText(),
resolved : data.asc_getSolved(), resolved : data.asc_getSolved(),
unattached : !_.isUndefined(data.asc_getDocumentFlag) ? data.asc_getDocumentFlag() : false, unattached : !_.isUndefined(data.asc_getDocumentFlag) ? data.asc_getDocumentFlag() : false,
userdata : data.asc_getUserData(),
id : Common.UI.getId(), id : Common.UI.getId(),
time : date.getTime(), time : date.getTime(),
showReply : false, showReply : false,
@ -1336,20 +1216,11 @@ define([
showReplyInPopover : false, showReplyInPopover : false,
hideAddReply : !_.isUndefined(this.hidereply) ? this.hidereply : (this.showPopover ? true : false), hideAddReply : !_.isUndefined(this.hidereply) ? this.hidereply : (this.showPopover ? true : false),
scope : this.view, scope : this.view,
editable : (this.mode.canEditComments || (data.asc_getUserId() == this.currentUserId)) && AscCommon.UserInfoParser.canEditComment(data.asc_getUserName()), editable : this.mode.canEditComments || (data.asc_getUserId() == this.currentUserId),
removable : (this.mode.canDeleteComments || (data.asc_getUserId() == this.currentUserId)) && AscCommon.UserInfoParser.canDeleteComment(data.asc_getUserName()),
hide : !AscCommon.UserInfoParser.canViewComment(data.asc_getUserName()),
hint : !this.mode.canComments, hint : !this.mode.canComments,
groupName : (groupname && groupname.length>1) ? groupname[1] : null groupName : (groupname && groupname.length>1) ? groupname[1] : null
}); });
if (comment) { if (comment) {
if (!comment.get('hide')) {
var usergroups = comment.get('parsedGroups');
this.fillUserGroups(usergroups);
var group = Common.Utils.InternalSettings.get(this.appPrefix + "comments-filtergroups");
var filter = !!group && (group!==-1) && (!usergroups || usergroups.length<1 || usergroups.indexOf(group)<0);
comment.set('filtered', filter);
}
var replies = this.readSDKReplies(data); var replies = this.readSDKReplies(data);
if (replies.length) { if (replies.length) {
comment.set('replys', replies); comment.set('replys', replies);
@ -1373,18 +1244,15 @@ define([
id : Common.UI.getId(), id : Common.UI.getId(),
userid : data.asc_getReply(i).asc_getUserId(), userid : data.asc_getReply(i).asc_getUserId(),
username : data.asc_getReply(i).asc_getUserName(), username : data.asc_getReply(i).asc_getUserName(),
parsedName : AscCommon.UserInfoParser.getParsedName(data.asc_getReply(i).asc_getUserName()),
usercolor : (user) ? user.get('color') : null, usercolor : (user) ? user.get('color') : null,
date : this.dateToLocaleTimeString(date), date : this.dateToLocaleTimeString(date),
reply : data.asc_getReply(i).asc_getText(), reply : data.asc_getReply(i).asc_getText(),
userdata : data.asc_getReply(i).asc_getUserData(),
time : date.getTime(), time : date.getTime(),
editText : false, editText : false,
editTextInPopover : false, editTextInPopover : false,
showReplyInPopover : false, showReplyInPopover : false,
scope : this.view, scope : this.view,
editable : (this.mode.canEditComments || (data.asc_getReply(i).asc_getUserId() == this.currentUserId)) && AscCommon.UserInfoParser.canEditComment(data.asc_getReply(i).asc_getUserName()), editable : this.mode.canEditComments || (data.asc_getReply(i).asc_getUserId() == this.currentUserId)
removable : (this.mode.canDeleteComments || (data.asc_getReply(i).asc_getUserId() == this.currentUserId)) && AscCommon.UserInfoParser.canDeleteComment(data.asc_getReply(i).asc_getUserName())
})); }));
} }
} }
@ -1414,8 +1282,7 @@ define([
time: date.getTime(), time: date.getTime(),
date: this.dateToLocaleTimeString(date), date: this.dateToLocaleTimeString(date),
userid: this.currentUserId, userid: this.currentUserId,
username: AscCommon.UserInfoParser.getCurrentName(), username: this.currentUserName,
parsedName: AscCommon.UserInfoParser.getParsedName(AscCommon.UserInfoParser.getCurrentName()),
usercolor: (user) ? user.get('color') : null, usercolor: (user) ? user.get('color') : null,
editTextInPopover: true, editTextInPopover: true,
showReplyInPopover: false, showReplyInPopover: false,
@ -1479,7 +1346,7 @@ define([
comment.asc_putTime(this.utcDateToString(new Date())); comment.asc_putTime(this.utcDateToString(new Date()));
comment.asc_putOnlyOfficeTime(this.ooDateToString(new Date())); comment.asc_putOnlyOfficeTime(this.ooDateToString(new Date()));
comment.asc_putUserId(this.currentUserId); comment.asc_putUserId(this.currentUserId);
comment.asc_putUserName(AscCommon.UserInfoParser.getCurrentName()); comment.asc_putUserName(this.currentUserName);
comment.asc_putSolved(false); comment.asc_putSolved(false);
if (!_.isUndefined(comment.asc_putDocumentFlag)) if (!_.isUndefined(comment.asc_putDocumentFlag))
@ -1487,7 +1354,7 @@ define([
this.api.asc_addComment(comment); this.api.asc_addComment(comment);
this.view.showEditContainer(false); this.view.showEditContainer(false);
this.mode && this.mode.canRequestSendNotify && this.view.pickEMail(comment.asc_getGuid(), commentVal); this.mode && this.mode.canRequestUsers && this.view.pickEMail(comment.asc_getGuid(), commentVal);
if (!_.isUndefined(this.api.asc_SetDocumentPlaceChangedEnabled)) { if (!_.isUndefined(this.api.asc_SetDocumentPlaceChangedEnabled)) {
this.api.asc_SetDocumentPlaceChangedEnabled(false); this.api.asc_SetDocumentPlaceChangedEnabled(false);
} }
@ -1546,13 +1413,13 @@ define([
for (i = 0; i < comments.length; ++i) { for (i = 0; i < comments.length; ++i) {
comment = this.findComment(comments[i].asc_getId()); comment = this.findComment(comments[i].asc_getId());
if (comment) { if (comment) {
comment.set('editTextInPopover', t.mode.canEditComments && AscCommon.UserInfoParser.canEditComment(comment.username));// dont't edit comment when customization->commentAuthorOnly is true or when permissions.editCommentAuthorOnly is true comment.set('editTextInPopover', t.mode.canEditComments);// dont't edit comment when customization->commentAuthorOnly is true
comment.set('hint', false); comment.set('hint', false);
this.popoverComments.push(comment); this.popoverComments.push(comment);
} }
} }
if (this.getPopover() && this.popoverComments.length>0 && this.popoverComments.findWhere({hide: false})) { if (this.getPopover() && this.popoverComments.length>0) {
if (this.getPopover().isVisible()) { if (this.getPopover().isVisible()) {
this.getPopover().hide(); this.getPopover().hide();
} }
@ -1660,64 +1527,6 @@ define([
clearCollections: function() { clearCollections: function() {
this.collection.reset(); this.collection.reset();
this.groupCollection = []; this.groupCollection = [];
},
fillUserGroups: function(usergroups) {
if (!this.mode.canUseCommentPermissions) return;
var viewgroups = AscCommon.UserInfoParser.getCommentPermissions('view');
if (usergroups && usergroups.length>0) {
if (viewgroups)
usergroups = _.intersection(usergroups, viewgroups);
usergroups = _.uniq(this.userGroups.concat(usergroups));
}
if (this.view && this.view.buttonSort && _.difference(usergroups, this.userGroups).length>0) {
this.userGroups = usergroups;
var menu = this.view.buttonSort.menu;
menu.items[menu.items.length-1].setVisible(this.userGroups.length>0);
menu.items[menu.items.length-2].setVisible(this.userGroups.length>0);
menu = menu.items[menu.items.length-1].menu;
menu.removeAll();
var last = Common.Utils.InternalSettings.get(this.appPrefix + "comments-filtergroups");
menu.addItem(new Common.UI.MenuItem({
checkable: true,
checked: last===-1 || last===undefined,
toggleGroup: 'filtercomments',
caption: this.view.textAll,
value: -1
}));
this.userGroups.forEach(function(item){
menu.addItem(new Common.UI.MenuItem({
checkable: true,
checked: last === item,
toggleGroup: 'filtercomments',
caption: Common.Utils.String.htmlEncode(item),
value: item
}));
});
}
},
setFilterGroups: function (group) {
Common.Utils.InternalSettings.set(this.appPrefix + "comments-filtergroups", group);
var i, end = true;
for (i = this.collection.length - 1; i >= 0; --i) {
var item = this.collection.at(i);
if (!item.get('hide')) {
var usergroups = item.get('parsedGroups');
item.set('filtered', !!group && (group!==-1) && (!usergroups || usergroups.length<1 || usergroups.indexOf(group)<0), {silent: true});
}
if (end && !item.get('hide') && !item.get('filtered')) {
item.set('last', true, {silent: true});
end = false;
} else {
if (item.get('last')) {
item.set('last', false, {silent: true});
}
}
}
this.updateComments(true);
} }
}, Common.Controllers.Comments || {})); }, Common.Controllers.Comments || {}));

View file

@ -41,32 +41,11 @@ define([
], function () { ], function () {
'use strict'; 'use strict';
var features = {
version: '{{PRODUCT_VERSION}}',
eventloading: true,
titlebuttons: true,
uithemes: true,
quickprint: true,
};
var native = window.desktop || window.AscDesktopEditor;
!!native && native.execCommand('webapps:features', JSON.stringify(features));
var Desktop = function () { var Desktop = function () {
var config = {version:'{{PRODUCT_VERSION}}'}; var config = {};
var webapp = window.DE || window.PE || window.SSE; var app = window.AscDesktopEditor;
var titlebuttons;
var btnsave_icons = {
'btn-save': 'save',
'btn-save-coauth': 'coauth',
'btn-synch': 'synch' };
var nativevars;
if ( !!native ) {
native.features = native.features || {};
nativevars = window.RendererProcessVariable;
if ( !!app ) {
window.on_native_message = function (cmd, param) { window.on_native_message = function (cmd, param) {
if (/^style:change/.test(cmd)) { if (/^style:change/.test(cmd)) {
var obj = JSON.parse(param); var obj = JSON.parse(param);
@ -86,155 +65,31 @@ define([
} else } else
if (/window:features/.test(cmd)) { if (/window:features/.test(cmd)) {
var obj = JSON.parse(param); var obj = JSON.parse(param);
if (_.isNumber(obj.skiptoparea)) {
if ( $('.asc-window.modal').length && $('.asc-window.modal').position().top < obj.skiptoparea )
$('.asc-window.modal').css('top', obj.skiptoparea);
Common.Utils.InternalSettings.set('window-inactive-area-top', obj.skiptoparea); if ( obj.canUndock == 'true' ) {
} else if ( !config.canUndock ) {
if ( obj.lockthemes != undefined ) { config.canUndock = true;
// TODO: remove after 7.0.2. depricated. used is_win_xp variable instead
// Common.UI.Themes.setAvailable(!obj.lockthemes); if ( !_.isEmpty(config) )
Common.NotificationCenter.trigger('app:config', {canUndock:true});
} }
if ( obj.singlewindow !== undefined ) { }
$('#box-document-title .hedset')[obj.singlewindow ? 'hide' : 'show'](); } else
native.features.singlewindow = obj.singlewindow; if (/window:status/.test(cmd)) {
var obj = JSON.parse(param);
if ( obj.action == 'undocking' ) {
Common.NotificationCenter.trigger('undock:status', {status:obj.status=='undocked'?'undocked':'docked'});
} }
} else } else
if (/editor:config/.test(cmd)) { if (/editor:config/.test(cmd)) {
if ( param == 'request' ) { if ( param == 'request' )
if ( !!titlebuttons ) { app.execCommand('editor:config', JSON.stringify({user: config.user, 'extraleft': $('#box-document-title #slot-btn-dt-save').parent().width()}));
var opts = {
user: config.user,
title: { buttons: [] }
};
var header = webapp.getController('Viewport').getView('Common.Views.Header');
if ( header ) {
for (var i in titlebuttons) {
opts.title.buttons.push(_serializeHeaderButton(i, titlebuttons[i]));
}
}
native.execCommand('editor:config', JSON.stringify(opts));
} else
if ( !config.callback_editorconfig ) {
config.callback_editorconfig = function() {
setTimeout(function(){window.on_native_message(cmd, param);},0);
}
}
}
} else
if (/button:click/.test(cmd)) {
var obj = JSON.parse(param);
if ( !!obj.action && !!titlebuttons[obj.action] ) {
titlebuttons[obj.action].btn.click();
}
} else
if (/theme:changed/.test(cmd)) {
Common.UI.Themes.setTheme(param);
} else
if (/element:show/.test(cmd)) {
var _mr = /title:(?:(true|show)|(false|hide))/.exec(param);
if ( _mr ) {
if (!!_mr[1]) $('#app-title').show();
else if (!!_mr[2]) $('#app-title').hide();
}
} else
if (/althints:show/.test(cmd)) {
if ( /false|hide/.test(param) )
Common.NotificationCenter.trigger('hints:clear');
} }
}; };
window.on_native_message('editor:config', 'request'); app.execCommand('webapps:events', 'loading');
if ( !!window.native_message_cmd ) { app.execCommand('window:features', 'request');
for ( var c in window.native_message_cmd ) {
window.on_native_message(c, window.native_message_cmd[c]);
}
}
native.execCommand('webapps:features', JSON.stringify(features));
// hide mask for modal window
var style = document.createElement('style');
style.appendChild(document.createTextNode('.modals-mask{opacity:0 !important;}'));
document.getElementsByTagName('head')[0].appendChild(style);
}
var _serializeHeaderButton = function(action, config) {
return {
action: action,
icon: config.icon || undefined,
hint: config.btn.options.hint,
disabled: config.btn.isDisabled(),
visible: config.visible,
};
};
var _onTitleButtonDisabled = function (action, e, status) {
var _buttons = {};
_buttons[action] = status;
native.execCommand('title:button', JSON.stringify({disabled: _buttons}));
};
var _onSaveIconChanged = function (e, opts) {
native.execCommand('title:button', JSON.stringify({'icon:changed': {'save': btnsave_icons[opts.next]}}));
};
var _onModalDialog = function (status) {
if ( status == 'open' ) {
native.execCommand('title:button', JSON.stringify({disabled: {'all':true}}));
} else {
var _buttons = {};
for (var i in titlebuttons) {
_buttons[i] = titlebuttons[i].btn.isDisabled();
}
native.execCommand('title:button', JSON.stringify({'disabled': _buttons}));
}
};
var _onHintsShow = function (visible, level) {
let info = {
visible: visible && !(level > 0),
};
if ( !!titlebuttons ) {
info.hints = {};
!!titlebuttons['print'] && (info.hints['print'] = titlebuttons['print'].btn.btnEl.attr('data-hint-title'));
!!titlebuttons['quickprint'] && (info.hints['quickprint'] = titlebuttons['quickprint'].btn.btnEl.attr('data-hint-title'));
!!titlebuttons['undo'] && (info.hints['undo'] = titlebuttons['undo'].btn.btnEl.attr('data-hint-title'));
!!titlebuttons['redo'] && (info.hints['redo'] = titlebuttons['redo'].btn.btnEl.attr('data-hint-title'));
!!titlebuttons['save'] && (info.hints['save'] = titlebuttons['save'].btn.btnEl.attr('data-hint-title'));
}
native.execCommand('althints:show', JSON.stringify(info));
}
var _onKeyDown = function (e) {
if ( Common.UI.HintManager.isHintVisible() ) {
native.execCommand('althints:keydown', JSON.stringify({code:e.keyCode}));
console.log('hint keydown', e.keyCode);
}
}
const _onApplySettings = function (menu) {
if ( !!titlebuttons.quickprint ) {
const var_name = window.SSE ? 'sse-settings-quick-print-button' :
window.PE ? 'pe-settings-quick-print-button' : 'de-settings-quick-print-button';
const is_btn_visible = Common.localStorage.getBool(var_name, false);
if ( titlebuttons.quickprint.visible != is_btn_visible ) {
titlebuttons.quickprint.visible = is_btn_visible;
const obj = {
visible: {
quickprint: is_btn_visible,
}
};
native.execCommand('title:button', JSON.stringify(obj));
}
}
} }
return { return {
@ -242,162 +97,38 @@ define([
_.extend(config, opts); _.extend(config, opts);
if ( config.isDesktopApp ) { if ( config.isDesktopApp ) {
let is_win_xp = nativevars && nativevars.os === 'winxp';
Common.UI.Themes.setAvailable(!is_win_xp);
Common.NotificationCenter.on('app:ready', function (opts) { Common.NotificationCenter.on('app:ready', function (opts) {
_.extend(config, opts); _.extend(config, opts);
!!native && native.execCommand('doc:onready', ''); !!app && app.execCommand('doc:onready', '');
$('.toolbar').addClass('editor-native-color'); $('.toolbar').addClass('editor-native-color');
}); });
Common.NotificationCenter.on('document:ready', function () { Common.NotificationCenter.on('action:undocking', function (opts) {
if ( config.isEdit ) { app.execCommand('editor:event', JSON.stringify({action:'undocking', state: opts == 'dock' ? 'dock' : 'undock'}));
function get_locked_message (t) {
switch (t) {
// case Asc.c_oAscLocalRestrictionType.Nosafe:
case Asc.c_oAscLocalRestrictionType.ReadOnly:
return Common.Locale.get("tipFileReadOnly",{name:"Common.Translation", default: "Document is read only. You can make changes and save its local copy later."});
default: return Common.Locale.get("tipFileLocked",{name:"Common.Translation", default: "Document is locked for editing. You can make changes and save its local copy later."});
}
}
const header = webapp.getController('Viewport').getView('Common.Views.Header');
const api = webapp.getController('Main').api;
const locktype = api.asc_getLocalRestrictions ? api.asc_getLocalRestrictions() : Asc.c_oAscLocalRestrictionType.None;
if ( Asc.c_oAscLocalRestrictionType.None !== locktype ) {
features.readonly = true;
header.setDocumentReadOnly(true);
api.asc_setLocalRestrictions(Asc.c_oAscLocalRestrictionType.None);
(new Common.UI.SynchronizeTip({
extCls: 'no-arrow',
placement: 'bottom',
target: $('.toolbar'),
text: get_locked_message(locktype),
showLink: false,
})).on('closeclick', function () {
this.close();
}).show();
native.execCommand('webapps:features', JSON.stringify(features));
api.asc_registerCallback('asc_onDocumentName', function () {
if ( features.readonly ) {
if ( api.asc_getLocalRestrictions() == Asc.c_oAscLocalRestrictionType.None ) {
features.readonly = false;
header.setDocumentReadOnly(false);
native.execCommand('webapps:features', JSON.stringify(features));
}
}
});
}
}
}); });
Common.NotificationCenter.on('app:face', function (mode) { Common.NotificationCenter.on('app:face', function (mode) {
features.viewmode = !mode.isEdit; if ( config.canUndock ) {
features.crypted = mode.isCrypted; Common.NotificationCenter.trigger('app:config', {canUndock: true});
native.execCommand('webapps:features', JSON.stringify(features));
titlebuttons = {};
if ( mode.isEdit ) {
const header = webapp.getController('Viewport').getView('Common.Views.Header');
if (!!header.btnSave) {
titlebuttons['save'] = {btn: header.btnSave};
var iconname = /\s?([^\s]+)$/.exec(titlebuttons.save.btn.$icon.attr('class'));
!!iconname && iconname.length && (titlebuttons.save.icon = btnsave_icons[iconname]);
}
if (!!header.btnPrint)
titlebuttons['print'] = {btn: header.btnPrint};
if (!!header.btnPrintQuick) {
titlebuttons['quickprint'] = {
btn: header.btnPrintQuick,
visible: header.btnPrintQuick.isVisible(),
};
}
if (!!header.btnUndo)
titlebuttons['undo'] = {btn: header.btnUndo};
if (!!header.btnRedo)
titlebuttons['redo'] = {btn: header.btnRedo};
for (var i in titlebuttons) {
titlebuttons[i].btn.options.signals = ['disabled'];
titlebuttons[i].btn.on('disabled', _onTitleButtonDisabled.bind(this, i));
}
if (!!titlebuttons.save) {
titlebuttons.save.btn.options.signals.push('icon:changed');
titlebuttons.save.btn.on('icon:changed', _onSaveIconChanged.bind(this));
}
}
if ( !!config.callback_editorconfig ) {
config.callback_editorconfig();
delete config.callback_editorconfig;
}
if ( native.features.singlewindow !== undefined ) {
$('#box-document-title .hedset')[native.features.singlewindow ? 'hide' : 'show']();
} }
}); });
Common.NotificationCenter.on({
'modal:show': _onModalDialog.bind(this, 'open'),
'modal:close': _onModalDialog.bind(this, 'close'),
'modal:hide': _onModalDialog.bind(this, 'hide'),
'uitheme:changed' : function (name) {
if (Common.localStorage.getBool('ui-theme-use-system', false)) {
native.execCommand("uitheme:changed", JSON.stringify({name:'theme-system'}));
} else {
var theme = Common.UI.Themes.get(name);
if ( theme )
native.execCommand("uitheme:changed", JSON.stringify({name:name, type:theme.type}));
}
},
'hints:show': _onHintsShow.bind(this),
});
webapp.addListeners({
'FileMenu': {
'item:click': function (menu, action, isopts) {
if ( action == 'file:exit' ) {
native.execCommand('editor:event', JSON.stringify({action: 'file:close'}));
menu.hide();
} else
if ( action == 'file:open' ) {
native.execCommand('editor:event', JSON.stringify({action: 'file:open'}));
menu.hide();
}
},
'settings:apply': _onApplySettings.bind(this),
},
}, {id: 'desktop'});
$(document).on('keydown', _onKeyDown.bind(this));
} }
}, },
process: function (opts) { process: function (opts) {
if ( config.isDesktopApp && !!native ) { if ( config.isDesktopApp && !!app ) {
if ( opts == 'goback' ) { if ( opts == 'goback' ) {
native.execCommand('go:folder', app.execCommand('go:folder',
config.isOffline ? 'offline' : config.customization.goback.url); config.isOffline ? 'offline' : config.customization.goback.url);
return true; return true;
} else } else
if ( opts == 'preloader:hide' ) { if ( opts == 'preloader:hide' ) {
native.execCommand('editor:onready', ''); app.execCommand('editor:onready', '');
return true; return true;
} else } else
if ( opts == 'create:new' ) { if ( opts == 'create:new' ) {
if (config.createUrl == 'desktop://create.new') { if (config.createUrl == 'desktop://create.new') {
native.execCommand("create:new", !!window.SSE ? 'cell' : !!window.PE ? 'slide' : 'word'); app.LocalFileCreate(!!window.SSE ? 2 : !!window.PE ? 1 : 0);
return true; return true;
} }
} }
@ -406,39 +137,10 @@ define([
return false; return false;
}, },
requestClose: function () { requestClose: function () {
if ( config.isDesktopApp && !!native ) { if ( config.isDesktopApp && !!app ) {
native.execCommand('editor:event', JSON.stringify({action:'file:close', url: config.customization.goback.url})); app.execCommand('editor:event', JSON.stringify({action:'close', url: config.customization.goback.url}));
} }
},
isActive: function () {
return !!native;
},
isOffline: function () {
// return webapp.getController('Main').api.asc_isOffline();
return webapp.getController('Main').appOptions.isOffline;
},
isFeatureAvailable: function (feature) {
return !!native && !!native[feature];
},
call: function (name) {
if ( native[name] ) {
let args = [].slice.call(arguments, 1);
// return native[name](...args);
return native[name].apply(this, args);
} }
},
helpUrl: function () {
if ( !!nativevars && nativevars.helpUrl ) {
var webapp = window.SSE ? 'spreadsheeteditor' :
window.PE ? 'presentationeditor' : 'documenteditor';
return nativevars.helpUrl + '/' + webapp + '/main/resources/help';
}
return undefined;
},
getDefaultPrinterName: function () {
return nativevars ? nativevars.defaultPrinterName : '';
},
}; };
}; };

View file

@ -48,7 +48,7 @@ define([
'common/main/lib/view/ExternalDiagramEditor' 'common/main/lib/view/ExternalDiagramEditor'
], function () { 'use strict'; ], function () { 'use strict';
Common.Controllers.ExternalDiagramEditor = Backbone.Controller.extend(_.extend((function() { Common.Controllers.ExternalDiagramEditor = Backbone.Controller.extend(_.extend((function() {
var appLang = '{{DEFAULT_LANG}}', var appLang = 'en',
customization = undefined, customization = undefined,
targetApp = '', targetApp = '',
externalEditor = null, externalEditor = null,
@ -56,11 +56,10 @@ define([
var createExternalEditor = function() { var createExternalEditor = function() {
!!customization && (customization.uiTheme = Common.localStorage.getItem("ui-theme-id", "theme-light"));
externalEditor = new DocsAPI.DocEditor('id-diagram-editor-placeholder', { externalEditor = new DocsAPI.DocEditor('id-diagram-editor-placeholder', {
width : '100%', width : '100%',
height : '100%', height : '100%',
documentType: 'cell', documentType: 'spreadsheet',
document : { document : {
url : '_chart_', url : '_chart_',
permissions : { permissions : {
@ -100,7 +99,7 @@ define([
},this), },this),
'show': _.bind(function(cmp){ 'show': _.bind(function(cmp){
var h = this.diagramEditorView.getHeight(), var h = this.diagramEditorView.getHeight(),
innerHeight = Common.Utils.innerHeight() - Common.Utils.InternalSettings.get('window-inactive-area-top'); innerHeight = Common.Utils.innerHeight();
if (innerHeight>h && h<700 || innerHeight<h) { if (innerHeight>h && h<700 || innerHeight<h) {
h = Math.min(innerHeight, 700); h = Math.min(innerHeight, 700);
this.diagramEditorView.setHeight(h); this.diagramEditorView.setHeight(h);
@ -142,7 +141,6 @@ define([
setApi: function(api) { setApi: function(api) {
this.api = api; this.api = api;
this.api.asc_registerCallback('asc_onCloseChartEditor', _.bind(this.onDiagrammEditingDisabled, this)); this.api.asc_registerCallback('asc_onCloseChartEditor', _.bind(this.onDiagrammEditingDisabled, this));
this.api.asc_registerCallback('asc_sendFromGeneralToFrameEditor', _.bind(this.onSendFromGeneralToFrameEditor, this));
return this; return this;
}, },
@ -186,7 +184,7 @@ define([
iconCls: 'warn', iconCls: 'warn',
buttons: ['ok'], buttons: ['ok'],
callback: _.bind(function(btn){ callback: _.bind(function(btn){
this.diagramEditorView.setControlsDisabled(false); this.setControlsDisabled(false);
this.diagramEditorView.hide(); this.diagramEditorView.hide();
}, this) }, this)
}); });
@ -233,9 +231,6 @@ define([
y = parseInt(this.diagramEditorView.$window.css('top')) + eventData.data.pagey + 34; y = parseInt(this.diagramEditorView.$window.css('top')) + eventData.data.pagey + 34;
this.diagramEditorView.binding.drag({pageX:x, pageY:y}); this.diagramEditorView.binding.drag({pageX:x, pageY:y});
} }
} else
if (eventData.type == "frameToGeneralData") {
this.api && this.api.asc_getInformationBetweenFrameAndGeneralEditor(eventData.data);
} else } else
this.diagramEditorView.fireEvent('internalmessage', this.diagramEditorView, eventData); this.diagramEditorView.fireEvent('internalmessage', this.diagramEditorView, eventData);
} }
@ -247,10 +242,6 @@ define([
} }
}, },
onSendFromGeneralToFrameEditor: function(data) {
externalEditor && externalEditor.serviceCommand('generalToFrameData', data);
},
warningTitle: 'Warning', warningTitle: 'Warning',
warningText: 'The object is disabled because of editing by another user.', warningText: 'The object is disabled because of editing by another user.',
textClose: 'Close', textClose: 'Close',

View file

@ -48,7 +48,7 @@ define([
'common/main/lib/view/ExternalMergeEditor' 'common/main/lib/view/ExternalMergeEditor'
], function () { 'use strict'; ], function () { 'use strict';
Common.Controllers.ExternalMergeEditor = Backbone.Controller.extend(_.extend((function() { Common.Controllers.ExternalMergeEditor = Backbone.Controller.extend(_.extend((function() {
var appLang = '{{DEFAULT_LANG}}', var appLang = 'en',
customization = undefined, customization = undefined,
targetApp = '', targetApp = '',
externalEditor = null; externalEditor = null;
@ -58,7 +58,7 @@ define([
externalEditor = new DocsAPI.DocEditor('id-merge-editor-placeholder', { externalEditor = new DocsAPI.DocEditor('id-merge-editor-placeholder', {
width : '100%', width : '100%',
height : '100%', height : '100%',
documentType: 'cell', documentType: 'spreadsheet',
document : { document : {
url : '_chart_', url : '_chart_',
permissions : { permissions : {
@ -134,7 +134,6 @@ define([
setApi: function(api) { setApi: function(api) {
this.api = api; this.api = api;
this.api.asc_registerCallback('asc_onCloseMergeEditor', _.bind(this.onMergeEditingDisabled, this)); this.api.asc_registerCallback('asc_onCloseMergeEditor', _.bind(this.onMergeEditingDisabled, this));
this.api.asc_registerCallback('asc_sendFromGeneralToFrameEditor', _.bind(this.onSendFromGeneralToFrameEditor, this));
return this; return this;
}, },
@ -171,7 +170,7 @@ define([
iconCls: 'warn', iconCls: 'warn',
buttons: ['ok'], buttons: ['ok'],
callback: _.bind(function(btn){ callback: _.bind(function(btn){
this.mergeEditorView.setControlsDisabled(false); this.setControlsDisabled(false);
this.mergeEditorView.hide(); this.mergeEditorView.hide();
}, this) }, this)
}); });
@ -217,9 +216,6 @@ define([
y = parseInt(this.mergeEditorView.$window.css('top')) + eventData.data.pagey + 34; y = parseInt(this.mergeEditorView.$window.css('top')) + eventData.data.pagey + 34;
this.mergeEditorView.binding.drag({pageX:x, pageY:y}); this.mergeEditorView.binding.drag({pageX:x, pageY:y});
} }
} else
if (eventData.type == "frameToGeneralData") {
this.api && this.api.asc_getInformationBetweenFrameAndGeneralEditor(eventData.data);
} else } else
this.mergeEditorView.fireEvent('internalmessage', this.mergeEditorView, eventData); this.mergeEditorView.fireEvent('internalmessage', this.mergeEditorView, eventData);
} }
@ -231,10 +227,6 @@ define([
} }
}, },
onSendFromGeneralToFrameEditor: function(data) {
externalEditor && externalEditor.serviceCommand('generalToFrameData', data);
},
warningTitle: 'Warning', warningTitle: 'Warning',
warningText: 'The object is disabled because of editing by another user.', warningText: 'The object is disabled because of editing by another user.',
textClose: 'Close', textClose: 'Close',

View file

@ -1,261 +0,0 @@
/*
*
* (c) Copyright Ascensio System SIA 2010-2022
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
/**
* ExternalOleEditor.js
*
* Created by Julia Radzhabova on 3/10/22
* Copyright (c) 2022 Ascensio System SIA. All rights reserved.
*
*/
if (Common === undefined)
var Common = {};
Common.Controllers = Common.Controllers || {};
define([
'core',
'common/main/lib/view/ExternalOleEditor'
], function () { 'use strict';
Common.Controllers.ExternalOleEditor = Backbone.Controller.extend(_.extend((function() {
var appLang = '{{DEFAULT_LANG}}',
customization = undefined,
targetApp = '',
externalEditor = null,
isAppFirstOpened = true;
var createExternalEditor = function() {
!!customization && (customization.uiTheme = Common.localStorage.getItem("ui-theme-id", "theme-light"));
externalEditor = new DocsAPI.DocEditor('id-ole-editor-placeholder', {
width : '100%',
height : '100%',
documentType: 'cell',
document : {
url : '_chart_',
permissions : {
edit : true,
download: false
}
},
editorConfig: {
mode : 'editole',
targetApp : targetApp,
lang : appLang,
canCoAuthoring : false,
canBackToFolder : false,
canCreateNew : false,
customization : customization,
user : {id: ('uid-'+Date.now())}
},
events: {
'onAppReady' : function() {},
'onDocumentStateChange' : function() {},
'onError' : function() {},
'onInternalMessage' : _.bind(this.onInternalMessage, this)
}
});
Common.Gateway.on('processmouse', _.bind(this.onProcessMouse, this));
};
return {
views: ['Common.Views.ExternalOleEditor'],
initialize: function() {
this.addListeners({
'Common.Views.ExternalOleEditor': {
'setoledata': _.bind(this.setOleData, this),
'drag': _.bind(function(o, state){
externalEditor && externalEditor.serviceCommand('window:drag', state == 'start');
},this),
'show': _.bind(function(cmp){
var h = this.oleEditorView.getHeight(),
innerHeight = Common.Utils.innerHeight() - Common.Utils.InternalSettings.get('window-inactive-area-top');
if (innerHeight>h && h<700 || innerHeight<h) {
h = Math.min(innerHeight, 700);
this.oleEditorView.setHeight(h);
}
if (externalEditor) {
externalEditor.serviceCommand('setAppDisabled',false);
if (isAppFirstOpened && this.oleEditorView._isExternalDocReady) {
isAppFirstOpened = false;
this.oleEditorView._oleData && this.setOleData();
}
if (this.needDisableEditing && this.oleEditorView._isExternalDocReady) {
this.onOleEditingDisabled();
}
externalEditor.attachMouseEvents();
} else {
createExternalEditor.apply(this);
}
this.isExternalEditorVisible = true;
this.isHandlerCalled = false;
}, this),
'hide': _.bind(function(cmp){
if (externalEditor) {
externalEditor.detachMouseEvents();
this.isExternalEditorVisible = false;
}
}, this)
}
});
},
onLaunch: function() {
this.oleEditorView = this.createView('Common.Views.ExternalOleEditor', {handler: _.bind(this.handler, this)});
},
setApi: function(api) {
this.api = api;
this.api.asc_registerCallback('asc_onCloseOleEditor', _.bind(this.onOleEditingDisabled, this));
this.api.asc_registerCallback('asc_sendFromGeneralToFrameEditor', _.bind(this.onSendFromGeneralToFrameEditor, this));
return this;
},
handler: function(result, value) {
if (this.isHandlerCalled) return;
this.isHandlerCalled = true;
if (this.oleEditorView._isExternalDocReady)
externalEditor && externalEditor.serviceCommand('queryClose',{mr:result});
else {
this.oleEditorView.hide();
this.isHandlerCalled = false;
}
},
setOleData: function() {
if (!isAppFirstOpened) {
externalEditor && externalEditor.serviceCommand('setOleData', this.oleEditorView._oleData);
this.oleEditorView._oleData = null;
}
},
loadConfig: function(data) {
if (data && data.config) {
if (data.config.lang) appLang = data.config.lang;
if (data.config.customization) customization = data.config.customization;
if (data.config.targetApp) targetApp = data.config.targetApp;
}
},
onOleEditingDisabled: function() {
if ( !this.oleEditorView.isVisible() || !this.oleEditorView._isExternalDocReady ) {
this.needDisableEditing = true;
return;
}
this.oleEditorView.setControlsDisabled(true);
Common.UI.alert({
title: this.warningTitle,
msg : this.warningText,
iconCls: 'warn',
buttons: ['ok'],
callback: _.bind(function(btn){
this.oleEditorView.setControlsDisabled(false);
this.oleEditorView.hide();
}, this)
});
this.needDisableEditing = false;
},
onInternalMessage: function(data) {
var eventData = data.data;
if (this.oleEditorView) {
if (eventData.type == 'documentReady') {
this.oleEditorView._isExternalDocReady = true;
this.isExternalEditorVisible && (isAppFirstOpened = false);
this.oleEditorView._oleData && this.setOleData();
if (this.needDisableEditing) {
this.onOleEditingDisabled();
}
} else
if (eventData.type == 'oleEditorReady') {
if (this.needDisableEditing===undefined)
this.oleEditorView.setControlsDisabled(false);
} else
if (eventData.type == "shortcut") {
if (eventData.data.key == 'escape')
this.oleEditorView.hide();
} else
if (eventData.type == "canClose") {
if (eventData.data.answer === true) {
if (externalEditor) {
externalEditor.serviceCommand('setAppDisabled',true);
if (eventData.data.mr == 'ok')
externalEditor.serviceCommand('getOleData');
}
this.oleEditorView.hide();
}
this.isHandlerCalled = false;
} else
if (eventData.type == "processMouse") {
if (eventData.data.event == 'mouse:up') {
this.oleEditorView.binding.dragStop();
} else
if (eventData.data.event == 'mouse:move') {
var x = parseInt(this.oleEditorView.$window.css('left')) + eventData.data.pagex,
y = parseInt(this.oleEditorView.$window.css('top')) + eventData.data.pagey + 34;
this.oleEditorView.binding.drag({pageX:x, pageY:y});
}
} else
if (eventData.type == "frameToGeneralData") {
this.api && this.api.asc_getInformationBetweenFrameAndGeneralEditor(eventData.data);
} else
this.oleEditorView.fireEvent('internalmessage', this.oleEditorView, eventData);
}
} ,
onProcessMouse: function(data) {
if (data.type == 'mouseup' && this.isExternalEditorVisible) {
externalEditor && externalEditor.serviceCommand('processmouse', data);
}
},
onSendFromGeneralToFrameEditor: function(data) {
externalEditor && externalEditor.serviceCommand('generalToFrameData', data);
},
warningTitle: 'Warning',
warningText: 'The object is disabled because of editing by another user.',
textClose: 'Close',
textAnonymous: 'Anonymous'
}
})(), Common.Controllers.ExternalOleEditor || {}));
});

View file

@ -1,193 +0,0 @@
/*
*
* (c) Copyright Ascensio System SIA 2010-2020
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
/**
* FocusManager.js
*
* Created by Julia Radzhabova on 24.09.2020
* Copyright (c) 2020 Ascensio System SIA. All rights reserved.
*
*/
if (Common === undefined)
var Common = {};
if (Common.UI === undefined) {
Common.UI = {};
}
Common.UI.FocusManager = new(function() {
var _tabindex = 1,
_windows = [],
_count = 0;
var register = function(fields) {
var arr = [];
if (!fields.forEach) {
fields = [fields];
}
fields.forEach(function(field) {
if (field) {
var item = {};
if (field.cmp && typeof field.selector == 'string')
item = field;
else {
item.cmp = field;
if (field instanceof Common.UI.ListView)
item.selector = '.listview';
else if (field instanceof Common.UI.CheckBox)
item.selector = '.checkbox-indeterminate';
else if (field instanceof Common.UI.RadioBox)
item.selector = '.radiobox';
else if (field instanceof Common.UI.TreeView)
item.selector = '.treeview';
else if (field instanceof Common.UI.Button)
item.selector = 'button';
else
item.selector = '.form-control';
}
item.el = (item.cmp.$el || $(item.cmp.el || item.cmp)).find(item.selector).addBack().filter(item.selector);
item.el && item.el.attr && (item.cmp.setTabIndex ? item.cmp.setTabIndex(_tabindex) : item.el.attr('tabindex', _tabindex.toString()));
arr.push(item);
}
});
return arr;
};
var addTraps = function(current) {
if (!current || current.traps || !current.fields || current.fields.length<1) return;
var trapFirst = $('<span aria-hidden="true" tabindex="' + _tabindex + '"></span>');
trapFirst.on('focus', function() {
if (current.hidden) return;
var fields = current.fields;
for (var i=fields.length-1; i>=0; i--) {
var field = fields[i];
if ((field.cmp.isVisible ? field.cmp.isVisible() : field.cmp.is(':visible')) && !(field.cmp.isDisabled && field.cmp.isDisabled())) {
var el = (field.selector) ? (field.cmp.$el || $(field.cmp.el || field.cmp)).find(field.selector).addBack().filter(field.selector) : field.el;
el && setTimeout(function(){ el.focus(); }, 10);
break;
}
}
});
current.parent.$window.prepend(trapFirst);
var trapLast = $('<span aria-hidden="true" tabindex="' + (_tabindex+1) + '"></span>');
trapLast.on('focus', function() {
if (current.hidden) return;
var fields = current.fields;
for (var i=0; i<fields.length; i++) {
var field = fields[i];
if ((field.cmp.isVisible ? field.cmp.isVisible() : field.cmp.is(':visible')) && !(field.cmp.isDisabled && field.cmp.isDisabled())) {
var el = (field.selector) ? (field.cmp.$el || $(field.cmp.el || field.cmp)).find(field.selector).addBack().filter(field.selector) : field.el;
el && setTimeout(function(){ el.focus(); }, 10);
break;
}
}
});
current.parent.$window.append(trapLast);
current.traps = [trapFirst, trapLast];
};
var updateTabIndexes = function(increment) {
var step = increment ? 1 : -1;
for (var cid in _windows) {
if (_windows.hasOwnProperty(cid)) {
var item = _windows[cid];
if (item && item.index < _count-1 && item.traps)
item.traps[1].attr('tabindex', (parseInt(item.traps[1].attr('tabindex')) + step).toString());
}
}
};
var _add = function(e, fields) {
if (e && e.cid) {
if (_windows[e.cid]) {
_windows[e.cid].fields = (_windows[e.cid].fields || []).concat(register(fields));
} else {
_windows[e.cid] = {
parent: e,
fields: register(fields),
hidden: false,
index: _count++
};
}
addTraps(_windows[e.cid]);
}
};
var _init = function() {
Common.NotificationCenter.on({
'modal:show': function(e){
if (e && e.cid) {
if (_windows[e.cid]) {
_windows[e.cid].hidden = false;
} else {
_windows[e.cid] = {
parent: e,
hidden: false,
index: _count++
};
updateTabIndexes(true);
}
}
},
'window:show': function(e){
if (e && e.cid && _windows[e.cid] && !_windows[e.cid].fields) {
_windows[e.cid].fields = register(e.getFocusedComponents());
addTraps(_windows[e.cid]);
}
var el = e ? e.getDefaultFocusableComponent() : null;
el && setTimeout(function(){ el.focus(); }, 100);
},
'modal:close': function(e, last) {
if (e && e.cid && _windows[e.cid]) {
updateTabIndexes(false);
delete _windows[e.cid];
_count--;
}
},
'modal:hide': function(e, last) {
if (e && e.cid && _windows[e.cid]) {
_windows[e.cid].hidden = true;
}
}
});
};
return {
init: _init,
add: _add
}
})();

View file

@ -120,7 +120,11 @@ define([
}); });
var store = this.getCollection('Common.Collections.Fonts'); var store = this.getCollection('Common.Collections.Fonts');
store && store.add(fontsArray);
if (store) {
store.add(fontsArray);
store.sort();
}
Common.NotificationCenter.trigger('fonts:load', store, select); Common.NotificationCenter.trigger('fonts:load', store, select);
} }

View file

@ -1,704 +0,0 @@
/*
*
* (c) Copyright Ascensio System SIA 2010-2021
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
/**
* HintManager.js
*
* Created by Julia Radzhabova on 21.04.2021
* Copyright (c) 2021 Ascensio System SIA. All rights reserved.
*
*/
/**
* Example usage with simple items:
*
* <button ... data-hint="1" data-hint-direction="right" data-hint-offset="big" data-hint-title="B">...</button>
* <label ... data-hint="1" data-hint-direction="bottom" data-hint-offset="medium" data-hint-title="L">...</label>
*
*
* Example usage with components:
*
* new Common.UI.Button({
* ...
* dataHint: '1', // '0' - tabs in toolbar, left and right menu, statusbar;
* // '1' - file menu, contents of toolbar tabs, contents of right and left panels
* dataHintDirection: 'bottom', // top, bottom, right, left, left-top
* dataHintOffset: 'small', // big - 6px, medium - 4px, small - 2px
* dataHintTitle : 'S'
* });
*
* new Common.UI.CheckBox({
* ...
* dataHint: '1',
* dataHintDirection: 'left',
* dataHintOffset: 'small'
* });
*
* new Common.UI.ComboBox({
* ...
* dataHint: '1',
* dataHintDirection: 'bottom',
* dataHintOffset: 'big'
* });
*
* new Common.UI.InputField({
* ...
* dataHint: '1',
* dataHintDirection: 'left',
* dataHintOffset: 'small'
* });
*
* new Common.UI.MetricSpinner({
* ...
* dataHint: '1',
* dataHintDirection: 'bottom',
* dataHintOffset: 'big'
* });
*
* new Common.UI.RadioBox({
* ...
* dataHint: '1',
* dataHintDirection: 'left',
* dataHintOffset: 'small'
* });
*/
if (Common === undefined)
var Common = {};
if (Common.UI === undefined) {
Common.UI = {};
}
Common.UI.HintManager = new(function() {
var _lang = 'en',
_arrAlphabet = [],
_arrEnAlphabet = [],
_arrQwerty = [],
_arrEnQwerty = [],
_needShow = false,
_hintVisible = false,
_currentLevel = 0,
_currentSection = document,
_currentControls = [],
_currentHints = [],
_inputLetters = '',
_isComplete = false,
_isLockedKeyEvents = false,
_inputTimer,
_isDocReady = false,
_isEditDiagram = false,
_usedTitles = [],
_appPrefix,
_staticHints = { // for desktop buttons
"btnhome": 'K'
};
var _api;
var _setCurrentSection = function (btn, section) {
if (section) {
_currentSection = section;
return;
}
if (btn === 'esc') {
if (_currentLevel === 0) {
_currentSection = document;
}
return;
}
if (_isEditDiagram) {
_currentSection = [$(window.parent.document).find('.advanced-settings-dlg:visible')[0], window.document];
} else if ($('#file-menu-panel').is(':visible')) {
_currentSection = $('#file-menu-panel');
} else {
_currentSection = (btn && btn.closest('.hint-section')) || document;
}
};
var _lockedKeyEvents = function (isLocked) {
if (_api) {
_isLockedKeyEvents = isLocked;
_api.asc_enableKeyEvents(!isLocked);
}
};
var _showHints = function () {
_inputLetters = '';
if (_currentLevel === 0) {
Common.NotificationCenter.trigger('toolbar:collapse');
}
if (_currentHints.length === 0 || ($('#file-menu-panel').is(':visible' || _isEditDiagram) && _currentLevel === 1)) {
_getHints();
}
if (_currentHints.length > 0) {
!_isLockedKeyEvents && _lockedKeyEvents(true);
_hintVisible = true;
_currentHints.forEach(function(item) {
item.show();
});
_inputTimer = setInterval(function () {
if (_inputLetters.length > 0) {
_inputLetters = '';
}
}, 5000);
} else {
_hintVisible = false;
}
Common.NotificationCenter.trigger('hints:show', _hintVisible, _currentLevel);
};
var _hideHints = function() {
_hintVisible = false;
_currentHints && _currentHints.forEach(function(item) {
item.remove()
});
clearInterval(_inputTimer);
Common.NotificationCenter.trigger('hints:show', false);
};
var _nextLevel = function(level) {
_removeHints();
_currentHints.length = 0;
_currentControls.length = 0;
if (level !== undefined) {
_currentLevel = level;
} else {
_currentLevel++;
}
};
var _prevLevel = function() {
_removeHints();
_currentHints.length = 0;
_currentControls.length = 0;
_currentLevel--;
};
var _getLetters = function(countButtons) {
var arr = _arrAlphabet.slice(),
firstFreeLetter,
ind;
for (var i = 0; i < _arrAlphabet.length, !firstFreeLetter; i++) {
if (_usedTitles.indexOf(_arrAlphabet[i]) === -1) {
firstFreeLetter = _arrAlphabet[i];
ind = i;
}
}
arr[ind] = firstFreeLetter + _arrAlphabet[0];
for (var i = 0; arr.length < countButtons; i++) {
var addTip = firstFreeLetter + _arrAlphabet[i];
if (addTip !== arr[ind]) {
arr.push(firstFreeLetter + _arrAlphabet[i]);
}
}
return arr;
};
var _getLetterInUILanguage = function (letter) {
var l = letter;
if (_arrAlphabet.indexOf(l) === -1) {
var ind = _arrEnAlphabet.indexOf(l);
l = _arrAlphabet[ind];
}
return l;
};
var _isItemDisabled = function (item) {
return (item.hasClass('disabled') || item.parent().hasClass('disabled') || item.attr('disabled'));
};
var _getControls = function() {
_currentControls = [];
_usedTitles = [];
var arr = [],
arrItemsWithTitle = [];
if (_.isArray(_currentSection)) {
_currentSection.forEach(function (section) {
arr = arr.concat($(section).find('[data-hint=' + (_currentLevel) + ']').toArray());
arrItemsWithTitle = arrItemsWithTitle.concat($(section).find('[data-hint-title][data-hint=' + (_currentLevel) + ']').toArray());
});
} else {
arr = $(_currentSection).find('[data-hint=' + (_currentLevel) + ']').toArray();
arrItemsWithTitle = $(_currentSection).find('[data-hint-title][data-hint=' + (_currentLevel) + ']').toArray();
}
var visibleItems = arr.filter(function (item) {
return $(item).is(':visible');
});
var visibleItemsWithTitle = arrItemsWithTitle.filter(function (item) {
return $(item).is(':visible');
});
if (visibleItems.length === visibleItemsWithTitle.length) { // all buttons have data-hint-title
visibleItems.forEach(function (item) {
var el = $(item);
if (_lang !== 'en') {
var title = el.attr('data-hint-title').toLowerCase(),
firstLetter = title.substr(0, 1);
if (_arrAlphabet.indexOf(firstLetter) === -1) { // tip is in English
var newTip = '';
for (var i = 0; i < title.length; i++) {
var letter = title.substr(i, 1),
ind = _arrEnAlphabet.indexOf(letter);
newTip = newTip + _arrAlphabet[ind].toUpperCase();
}
el.attr('data-hint-title', newTip);
}
}
_currentControls.push(el);
});
return;
}
var _arrLetters = [],
_usedLetters = [];
if (_currentLevel === 0) {
for (var key in _staticHints) {
var t = _staticHints[key].toLowerCase();
_usedTitles.push(t);
_usedLetters.push(_arrAlphabet.indexOf(t));
}
}
if (visibleItems.length > _arrAlphabet.length) {
visibleItemsWithTitle.forEach(function (item) {
var t = $(item).data('hint-title').toLowerCase();
t = _getLetterInUILanguage(t);
_usedTitles.push(t);
});
_arrLetters = _getLetters(visibleItems.length + (_currentLevel === 0 ? _.size(_staticHints) : 0));
} else {
_arrLetters = _arrAlphabet.slice();
}
if (arrItemsWithTitle.length > 0) {
visibleItems.forEach(function (item) {
var el = $(item);
var title = el.attr('data-hint-title');
if (title) {
var ind = _arrEnAlphabet.indexOf(title.toLowerCase());
if (ind === -1) { // we have already changed
_usedLetters.push(_arrAlphabet.indexOf(title.toLowerCase()));
} else {
_usedLetters.push(ind);
if (_lang !== 'en') {
el.attr('data-hint-title', _arrLetters[ind].toUpperCase());
}
}
}
});
}
var index = 0;
visibleItems.forEach(function (item) {
var el = $(item);
while (_usedLetters.indexOf(index) !== -1) {
index++;
}
var title = el.attr('data-hint-title');
if (!title) {
el.attr('data-hint-title', _arrLetters[index].toUpperCase());
index++;
}
_currentControls.push(el);
});
};
var _getHints = function() {
var docH = _isEditDiagram ? (window.parent.innerHeight * Common.Utils.zoom()) : (Common.Utils.innerHeight() - 20),
docW = _isEditDiagram ? (window.parent.innerWidth * Common.Utils.zoom()) : (Common.Utils.innerWidth()),
section = _isEditDiagram ? _currentSection[0] : _currentSection,
topSection = _currentLevel !== 0 && $(section).length > 0 && !_isEditDiagram ? $(section).offset().top : 0,
bottomSection = _currentLevel !== 0 && $(section).length > 0 && !_isEditDiagram ? topSection + $(section).height() : docH;
if ($(section).prop('id') === 'toolbar' && $(section).outerHeight() < $(section).find('.box-controls').outerHeight()) {
bottomSection += $(section).find('.box-controls').outerHeight();
}
if (_currentControls.length === 0)
_getControls();
_currentControls.forEach(function(item, index) {
if (!_isItemDisabled(item)) {
var leftBorder = 0,
rightBorder = docW;
if (!_isEditDiagram && $(_currentSection).prop('id') === 'toolbar' && ($(_currentSection).find('.toolbar-mask').length > 0)
|| ($('#about-menu-panel').is(':visible') && item.closest('.hint-section').prop('id') === 'right-menu')) { // don't show right menu hints when about is visible
return;
}
if (window.SSE && item.parent().prop('id') === 'statusbar_bottom') {
var $statusbar = item.parent();
if (item.offset().left > $statusbar.offset().left + $statusbar.width()) {
return;
}
}
if (_currentLevel === 0 && item.closest('.tabs.short').length > 0) {
var blockTabs = item.closest('.tabs.short');
leftBorder = blockTabs.offset().left;
rightBorder = leftBorder + blockTabs.width();
if (!item.hasClass('scroll')) {
leftBorder += 20;
rightBorder -= 20;
}
}
var hint = $('<div style="" class="hint-div">' + item.attr('data-hint-title') + '</div>');
var direction = item.attr('data-hint-direction');
// exceptions
if (window.SSE && !_isEditDiagram && _currentSection.nodeType !== 9 &&
_currentSection.prop('id') === 'toolbar' && item.closest('.panel').attr('data-tab') === 'data') {
if (item.parent().hasClass('slot-sortdesc') || item.parent().hasClass('slot-btn-setfilter')) {
direction = 'top';
item.attr('data-hint-direction', 'top');
} else if (item.parent().hasClass('slot-btn-clear-filter') || item.parent().hasClass('slot-sortasc')) {
direction = 'bottom';
item.attr('data-hint-direction', 'bottom');
}
}
var maxHeight = docH;
if ($('#file-menu-panel').is(':visible') && _currentLevel > 1 &&
($('.fms-flex-apply').is(':visible') || $('#fms-flex-apply').is(':visible')) &&
item.closest('.fms-flex-apply').length < 1 && item.closest('#fms-flex-apply').length < 1) {
maxHeight = docH - $('.fms-flex-apply').height();
}
var offsets = item.attr('data-hint-offset');
var applyOffset = offsets === 'big' ? 6 : (offsets === 'medium' ? 4 : (offsets === 'small' ? 2 : 0));
if (applyOffset) {
switch (direction) {
case 'bottom':
offsets = [-applyOffset, 0];
break;
case 'top':
offsets = [applyOffset, 0];
break;
case 'right':
offsets = [0, -applyOffset];
break;
case 'left':
offsets = [0, applyOffset];
break;
}
} else {
offsets = offsets ? item.attr('data-hint-offset').split(',').map(function (item) { return parseInt(item); }) : [0, 0];
}
var offset = item.offset();
var top, left;
if (direction === 'left-top') {
top = offset.top - 10 + offsets[0];
left = offset.left - 10 + offsets[1];
} else if (direction === 'top') {
top = offset.top - 18 + offsets[0];
left = offset.left + (item.outerWidth() - 18) / 2 + offsets[1];
} else if (direction === 'right') {
top = offset.top + (item.outerHeight() - 18) / 2 + offsets[0];
left = offset.left + item.outerWidth() + offsets[1];
} else if (direction === 'left') {
top = offset.top + (item.outerHeight() - 18) / 2 + offsets[0];
left = offset.left - 18 + offsets[1];
} else {
top = offset.top + item.outerHeight() + offsets[0];
left = offset.left + (item.outerWidth() - 18) / 2 + offsets[1];
}
if (top < maxHeight && left < docW && top > topSection && top < bottomSection && left > leftBorder && left + 18 < rightBorder) {
hint.css({
top: top,
left: left
});
if (_isEditDiagram && index < 2) {
hint.css('z-index', '1060');
$(window.parent.document.body).append(hint);
} else {
$(document.body).append(hint);
}
}
_currentHints.push(hint);
}
});
};
var _removeHints = function() {
_currentHints && _currentHints.forEach(function(item) {
item.remove()
});
};
var _resetToDefault = function() {
_currentLevel = ($('#file-menu-panel').is(':visible') || _isEditDiagram) ? 1 : 0;
_setCurrentSection();
_currentHints.length = 0;
_currentControls.length = 0;
};
var _init = function(api) {
_api = api;
var filter = Common.localStorage.getKeysFilter();
_appPrefix = (filter && filter.length) ? filter.split(',')[0] : '';
Common.NotificationCenter.on({
'app:ready': function (mode) {
var lang = mode.lang ? mode.lang.toLowerCase() : 'en';
_getAlphabetLetters(lang);
_isDocReady = true;
},
'hints:clear': _clearHints,
'window:resize': _clearHints
});
$('#editor_sdk').on('click', function () {
_clearHints();
});
$(document).on('mousedown', function () {
_clearHints();
});
$(document).on('keyup', function(e) {
if (e.keyCode == Common.UI.Keys.ALT && _needShow && !(window.SSE && window.SSE.getController('Statusbar').getIsDragDrop())) {
e.preventDefault();
if (!_hintVisible) {
$('input:focus').blur(); // to change value in inputField
_currentLevel = ($('#file-menu-panel').is(':visible') || _isEditDiagram) ? 1 : 0;
_setCurrentSection();
_showHints();
} else {
_hideHints();
_resetToDefault();
if (_isLockedKeyEvents) {
_isLockedKeyEvents = false;
_api.asc_enableKeyEvents(true);
}
}
} else if (_hintVisible) {
e.preventDefault();
}
_needShow = false;
});
$(document).on('keydown', function(e) {
if (_hintVisible) {
e.preventDefault();
if (e.keyCode == Common.UI.Keys.ESC ) {
setTimeout(function () {
if (_currentLevel === 0) {
_hideHints();
_resetToDefault();
_lockedKeyEvents(false);
} else {
_prevLevel();
_setCurrentSection('esc');
_showHints();
}
}, 10);
} else {
var curLetter = null,
match = false;
var keyCode = e.keyCode;
if (keyCode !== 16 && keyCode !== 17 && keyCode !== 18 && keyCode !== 91) {
curLetter = _lang === 'en' ?
((keyCode > 47 && keyCode < 58 || keyCode > 64 && keyCode < 91) ? String.fromCharCode(e.keyCode) : null) :
(/[.*+?^${}()|[\]\\]/g.test(e.key) ? null : e.key);
}
if (curLetter) {
var curr;
if (_lang !== 'en' && _arrAlphabet.indexOf(curLetter.toLowerCase()) === -1) {
var ind = _arrEnQwerty.indexOf(curLetter.toLowerCase());
if (ind !== -1) {
curLetter = _arrQwerty[ind];
}
}
_inputLetters = _inputLetters + curLetter.toUpperCase();
for (var i = 0; i < _currentControls.length; i++) {
var item = _currentControls[i];
if (!_isItemDisabled(item)) {
var title = item.attr('data-hint-title'),
regExp = new RegExp('^' + _inputLetters + '');
if (regExp.test(title)) {
match = true;
}
if (title === _inputLetters) {
curr = item;
break;
}
}
}
if (curr) {
var tag = curr.prop("tagName").toLowerCase();
if (window.SSE && curr.parent().prop('id') === 'statusbar_bottom') {
_hideHints();
curr.contextmenu();
_resetToDefault();
} else if (tag === 'input' || tag === 'textarea') {
_hideHints();
curr.trigger(jQuery.Event('click', {which: 1}));
curr.focus();
_resetToDefault();
} else if (curr.hasClass('listview')) {
_hideHints();
curr.focus();
_resetToDefault();
} else {
_isComplete = false;
_hideHints();
if (!_isEditDiagram && $(_currentSection).prop('id') === 'toolbar' && ($(_currentSection).find('.toolbar-mask').length > 0)) {
_resetToDefault();
return;
}
var needOpenPanel = (curr.attr('content-target') && !$('#' + curr.attr('content-target')).is(':visible') ||
(curr.parent().prop('id') === 'slot-btn-chat' && !$('#left-panel-chat').is(':visible')) ||
(curr.parent().hasClass('ribtab') && !$('#toolbar').children('.toolbar').hasClass('expanded')));
if ((!curr.attr('content-target') && curr.parent().prop('id') !== 'slot-btn-chat') || needOpenPanel) { // need to open panel
if (!($('#file-menu-panel').is(':visible') && (curr.parent().prop('id') === 'fm-btn-info' && $('#panel-info').is(':visible') ||
curr.parent().prop('id') === 'fm-btn-settings' && $('#panel-settings').is(':visible')))) {
if (curr.attr('for')) { // to trigger event in checkbox
$('#' + curr.attr('for')).trigger(jQuery.Event('click', {which: 1}));
} else {
curr.trigger(jQuery.Event('click', {which: 1}));
if (needOpenPanel)
_isComplete = false; // to show next level of hints
}
}
}
if (curr.prop('id') === 'btn-goback' || curr.closest('.btn-slot').prop('id') === 'slot-btn-options' ||
curr.closest('.btn-slot').prop('id') === 'slot-btn-mode' || curr.prop('id') === 'btn-favorite' || curr.parent().prop('id') === 'tlb-box-users' ||
curr.prop('id') === 'left-btn-thumbs' || curr.hasClass('scroll') || curr.prop('id') === 'left-btn-about' ||
curr.prop('id') === 'left-btn-support' || curr.closest('.btn-slot').prop('id') === 'slot-btn-search') {
_resetToDefault();
return;
}
if (curr.prop('id') === 'add-comment-doc') {
_removeHints();
_currentHints.length = 0;
_currentControls.length = 0;
_showHints();
return;
}
if (!_isComplete) {
if (curr.parent().prop('id') === 'slot-btn-chat') {
_nextLevel(1);
_setCurrentSection(undefined, $('#left-menu.hint-section'));
} else if (curr.prop('id') === 'id-right-menu-signature') {
_nextLevel(2);
_setCurrentSection(curr);
} else {
_nextLevel();
_setCurrentSection(curr);
}
_showHints();
if (_currentHints.length < 1) {
_resetToDefault();
}
}
}
} else if (!match) {
_inputLetters = '';
}
}
}
}
_needShow = (Common.Utils.InternalSettings.get(_appPrefix + "settings-show-alt-hints") && !e.shiftKey && e.keyCode == Common.UI.Keys.ALT &&
!Common.Utils.ModalWindow.isVisible() && _isDocReady && _arrAlphabet.length > 0 &&
!(window.PE && $('#pe-preview').is(':visible')));
if (Common.Utils.InternalSettings.get(_appPrefix + "settings-show-alt-hints") && e.altKey && e.keyCode !== 115) {
e.preventDefault();
}
});
};
var _getAlphabetLetters = function (lng) {
Common.Utils.loadConfig('../../common/main/resources/alphabetletters/alphabetletters.json', function (langsJson) {
_arrEnAlphabet = langsJson['en'];
var _setAlphabet = function (lang) {
_lang = lang;
_arrAlphabet = langsJson[lang];
return _arrAlphabet;
};
var loaded = !_setAlphabet(lng) ? (!_setAlphabet(lng.split(/[\-_]/)[0]) ? _setAlphabet('en') : true) : true;
if (loaded && _lang !== 'en') {
for (var key in _staticHints) {
var hint = _getLetterInUILanguage(_staticHints[key].toLowerCase());
if (hint) {
_staticHints[key] = hint.toUpperCase();
}
}
}
return loaded;
});
Common.Utils.loadConfig('../../common/main/resources/alphabetletters/qwertyletters.json', function (langsJson) {
_arrQwerty = langsJson[_lang];
if (_lang !== 'en') {
_arrEnQwerty = langsJson['en'];
}
});
};
var _needCloseFileMenu = function () {
return !(_hintVisible && _currentLevel > 1);
};
var _clearHints = function (isComplete) {
_hintVisible && _hideHints();
if (_currentHints.length > 0) {
_resetToDefault();
}
_isLockedKeyEvents && _lockedKeyEvents(false);
if (isComplete) {
_isComplete = true;
}
if ($('.hint-div').length > 0) {
$('.hint-div').remove();
}
if ($('iframe').length > 0) {
try {
$('iframe').contents().find('.hint-div').remove();
} catch (e) {}
}
};
var _isHintVisible = function () {
return _hintVisible;
};
var _setMode = function (mode) {
_isEditDiagram = mode.isEditDiagram || mode.isEditMailMerge || mode.isEditOle;
};
var _getStaticHint = function (key) {
return _staticHints[key];
};
return {
init: _init,
setMode: _setMode,
clearHints: _clearHints,
needCloseFileMenu: _needCloseFileMenu,
isHintVisible: _isHintVisible,
getStaticHint: _getStaticHint
}
})();

View file

@ -81,7 +81,6 @@ define([
}, },
setMode: function(mode) { setMode: function(mode) {
this.mode = mode;
if (!mode.canHistoryClose) { if (!mode.canHistoryClose) {
this.panelHistory.$el.find('#history-header').hide(); this.panelHistory.$el.find('#history-header').hide();
this.panelHistory.$el.find('#history-list').css('padding-top', 0); this.panelHistory.$el.find('#history-list').css('padding-top', 0);
@ -100,10 +99,9 @@ define([
this.panelHistory.$el.find('#history-list').css('padding-bottom', hasChanges ? '45px' : 0); this.panelHistory.$el.find('#history-list').css('padding-bottom', hasChanges ? '45px' : 0);
}, },
onDownloadUrl: function(url, fileType) { onDownloadUrl: function(url) {
if (this.isFromSelectRevision !== undefined) { if (this.isFromSelectRevision !== undefined)
Common.Gateway.requestRestore(this.isFromSelectRevision, url, fileType); Common.Gateway.requestRestore(this.isFromSelectRevision, url);
}
this.isFromSelectRevision = undefined; this.isFromSelectRevision = undefined;
}, },
@ -112,11 +110,10 @@ define([
var btn = $(e.target); var btn = $(e.target);
if (btn && btn.hasClass('revision-restore')) { if (btn && btn.hasClass('revision-restore')) {
if (record.get('isRevision')) if (record.get('isRevision'))
Common.Gateway.requestRestore(record.get('revision'), undefined, record.get('fileType')); Common.Gateway.requestRestore(record.get('revision'));
else { else {
this.isFromSelectRevision = record.get('revision'); this.isFromSelectRevision = record.get('revision');
var fileType = Asc.c_oAscFileType[(record.get('fileType') || '').toUpperCase()] || Asc.c_oAscFileType.DOCX; this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.DOCX, true));
this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(fileType, true));
} }
return; return;
} }
@ -137,22 +134,10 @@ define([
this.currentServerVersion = record.get('serverVersion'); this.currentServerVersion = record.get('serverVersion');
if ( _.isEmpty(url) || (urlGetTime - record.get('urlGetTime') > 5 * 60000)) { if ( _.isEmpty(url) || (urlGetTime - record.get('urlGetTime') > 5 * 60000)) {
var me = this;
if (!me.timerId) {
me.timerId = setTimeout(function () {
me.timerId = 0;
},30000);
_.delay(function() { _.delay(function() {
Common.Gateway.requestHistoryData(rev); // получаем url-ы для ревизий Common.Gateway.requestHistoryData(rev); // получаем url-ы для ревизий
}, 10); }, 10);
}
} else { } else {
var commentsController = this.getApplication().getController('Common.Controllers.Comments');
if (commentsController) {
commentsController.onApiHideComment();
commentsController.clearCollections();
}
var urlDiff = record.get('urlDiff'), var urlDiff = record.get('urlDiff'),
token = record.get('token'), token = record.get('token'),
hist = new Asc.asc_CVersionHistory(); hist = new Asc.asc_CVersionHistory();
@ -166,6 +151,11 @@ define([
hist.asc_setServerVersion(this.currentServerVersion); hist.asc_setServerVersion(this.currentServerVersion);
this.api.asc_showRevision(hist); this.api.asc_showRevision(hist);
var commentsController = this.getApplication().getController('Common.Controllers.Comments');
if (commentsController) {
commentsController.onApiHideComment();
commentsController.clearCollections();
}
var reviewController = this.getApplication().getController('Common.Controllers.ReviewChanges'); var reviewController = this.getApplication().getController('Common.Controllers.ReviewChanges');
if (reviewController) if (reviewController)
reviewController.onApiShowChange(); reviewController.onApiShowChange();
@ -173,13 +163,6 @@ define([
}, },
onSetHistoryData: function(opts) { onSetHistoryData: function(opts) {
if (!this.mode.canUseHistory) return;
if (this.timerId) {
clearTimeout(this.timerId);
this.timerId = 0;
}
if (opts.data.error) { if (opts.data.error) {
var config = { var config = {
title: this.notcriticalErrorTitle, title: this.notcriticalErrorTitle,
@ -189,20 +172,13 @@ define([
}; };
Common.UI.alert(config); Common.UI.alert(config);
} else { } else {
var commentsController = this.getApplication().getController('Common.Controllers.Comments');
if (commentsController) {
commentsController.onApiHideComment();
commentsController.clearCollections();
}
var data = opts.data; var data = opts.data;
var historyStore = this.getApplication().getCollection('Common.Collections.HistoryVersions'); var historyStore = this.getApplication().getCollection('Common.Collections.HistoryVersions');
if (historyStore && data!==null) { if (historyStore && data!==null) {
var rev, revisions = historyStore.findRevisions(data.version), var rev, revisions = historyStore.findRevisions(data.version),
urlGetTime = new Date(); urlGetTime = new Date();
var diff = (!opts.data.previous || this.currentChangeId===undefined) ? null : opts.data.changesUrl, // if revision has changes, but serverVersion !== app.buildVersion -> hide revision changes var diff = (this.currentChangeId===undefined) ? null : opts.data.changesUrl, // if revision has changes, but serverVersion !== app.buildVersion -> hide revision changes
url = (!_.isEmpty(diff) && opts.data.previous) ? opts.data.previous.url : opts.data.url, url = (!_.isEmpty(diff) && opts.data.previous) ? opts.data.previous.url : opts.data.url,
fileType = (!_.isEmpty(diff) && opts.data.previous) ? opts.data.previous.fileType : opts.data.fileType,
docId = opts.data.key ? opts.data.key : this.currentDocId, docId = opts.data.key ? opts.data.key : this.currentDocId,
docIdPrev = opts.data.previous && opts.data.previous.key ? opts.data.previous.key : this.currentDocIdPrev, docIdPrev = opts.data.previous && opts.data.previous.key ? opts.data.previous.key : this.currentDocIdPrev,
token = opts.data.token; token = opts.data.token;
@ -218,7 +194,6 @@ define([
rev.set('docIdPrev', docIdPrev, {silent: true}); rev.set('docIdPrev', docIdPrev, {silent: true});
} }
rev.set('token', token, {silent: true}); rev.set('token', token, {silent: true});
fileType && rev.set('fileType', fileType, {silent: true});
} }
} }
var hist = new Asc.asc_CVersionHistory(); var hist = new Asc.asc_CVersionHistory();
@ -231,8 +206,12 @@ define([
hist.asc_setIsRequested(true); hist.asc_setIsRequested(true);
hist.asc_setServerVersion(this.currentServerVersion); hist.asc_setServerVersion(this.currentServerVersion);
this.api.asc_showRevision(hist); this.api.asc_showRevision(hist);
this.currentRev = data.version;
var commentsController = this.getApplication().getController('Common.Controllers.Comments');
if (commentsController) {
commentsController.onApiHideComment();
commentsController.clearCollections();
}
var reviewController = this.getApplication().getController('Common.Controllers.ReviewChanges'); var reviewController = this.getApplication().getController('Common.Controllers.ReviewChanges');
if (reviewController) if (reviewController)
reviewController.onApiShowChange(); reviewController.onApiShowChange();
@ -262,7 +241,7 @@ define([
store.where({isRevision: false}).forEach(function(item){ store.where({isRevision: false}).forEach(function(item){
item.set('isVisible', needExpand); item.set('isVisible', needExpand);
}); });
this.panelHistory.viewHistoryList.scroller.update({minScrollbarLength: this.panelHistory.viewHistoryList.minScrollbarLength}); this.panelHistory.viewHistoryList.scroller.update({minScrollbarLength: 40});
this.panelHistory.btnExpand.cmpEl.text(needExpand ? this.panelHistory.textHideAll : this.panelHistory.textShowAll); this.panelHistory.btnExpand.cmpEl.text(needExpand ? this.panelHistory.textHideAll : this.panelHistory.textShowAll);
}, },

View file

@ -1,146 +0,0 @@
/*
*
* (c) Copyright Ascensio System SIA 2010-2021
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
/**
* LayoutManager.js
*
* Created by Julia Radzhabova on 06.10.2021
* Copyright (c) 2021 Ascensio System SIA. All rights reserved.
*
*/
if (Common === undefined)
var Common = {};
if (Common.UI === undefined) {
Common.UI = {};
}
Common.UI.LayoutManager = new(function() {
var _config;
var _init = function(config) {
_config = config;
};
var _applyCustomization = function(config, el, prefix) {
!config && (config = _config);
if (!config) return;
for (var name in config) {
if(config.hasOwnProperty(name)) {
if(typeof config[name] === 'object')
_applyCustomization(config[name], el, (prefix || '') + name + '-');
else if (config[name] === false) {
var selector = '[data-layout-name=' + (prefix || '') + name + ']',
cmp = el ? el.find(selector) : $(selector);
cmp && cmp.hide && cmp.hide();
}
}
}
};
var _isElementVisible = function(value, config, prefix) {
!config && (config = _config);
if (!config) return true;
var res = true;
for (var name in config) {
if(config.hasOwnProperty(name)) {
if(typeof config[name] === 'object')
res = _isElementVisible(value, config[name], (prefix || '') + name + '-');
else {
if (value === (prefix || '') + name) { // checked value is in config
res = config[name];
}
}
if (res===false) return res;
}
}
return res;
};
return {
init: _init,
applyCustomization: _applyCustomization,
isElementVisible: _isElementVisible
}
})();
/**
* features: {
* feature: { //can be object or init value
* mode: <init value> // value1 / value2 ...
* change: false/true // hide/show feature
* } / value1 / value2 ...
* }
*/
Common.UI.FeaturesManager = new(function() {
var _config,
_licensed;
var _init = function(config, licensed) {
_config = config;
_licensed = licensed;
};
var _canChange = function(name, force) {
return !((_licensed || force) && _config && typeof _config[name] === 'object' && _config[name] && _config[name].change===false);
};
var _getInitValue2 = function(name, defValue, force) {
if ((_licensed || force) && _config && _config[name] !== undefined ) {
if (typeof _config[name] === 'object' && _config[name]) { // object and not null
if (_config[name].mode!==undefined)
return _config[name].mode;
} else
return _config[name];
}
return defValue;
};
var _getInitValue = function(name, force) {
if ((_licensed || force) && _config && _config[name] !== undefined ) {
if (typeof _config[name] === 'object' && _config[name]) { // object and not null
if (_config[name].mode!==undefined)
return _config[name].mode;
} else
return _config[name];
}
};
return {
init: _init,
canChange: _canChange,
getInitValue: _getInitValue
}
})();

View file

@ -39,8 +39,7 @@
define([ define([
'core', 'core',
'common/main/lib/collection/Plugins', 'common/main/lib/collection/Plugins',
'common/main/lib/view/Plugins', 'common/main/lib/view/Plugins'
'common/main/lib/view/PluginDlg'
], function () { ], function () {
'use strict'; 'use strict';
@ -63,8 +62,8 @@ define([
'render:before' : function (toolbar) { 'render:before' : function (toolbar) {
var appOptions = me.getApplication().getController('Main').appOptions; var appOptions = me.getApplication().getController('Main').appOptions;
if ( !appOptions.isEditMailMerge && !appOptions.isEditDiagram && !appOptions.isEditOle ) { if ( !appOptions.isEditMailMerge && !appOptions.isEditDiagram ) {
var tab = {action: 'plugins', caption: me.panelPlugins.groupCaption, dataHintTitle: 'E', layoutname: 'toolbar-plugins'}; var tab = {action: 'plugins', caption: me.panelPlugins.groupCaption};
me.$toolbarPanelPlugins = me.panelPlugins.getPanel(); me.$toolbarPanelPlugins = me.panelPlugins.getPanel();
toolbar.addTab(tab, me.$toolbarPanelPlugins, 10); // TODO: clear plugins list in left panel toolbar.addTab(tab, me.$toolbarPanelPlugins, 10); // TODO: clear plugins list in left panel
@ -103,8 +102,6 @@ define([
Common.Gateway.on('init', this.loadConfig.bind(this)); Common.Gateway.on('init', this.loadConfig.bind(this));
Common.NotificationCenter.on('app:face', this.onAppShowed.bind(this)); Common.NotificationCenter.on('app:face', this.onAppShowed.bind(this));
Common.NotificationCenter.on('uitheme:changed', this.updatePluginsButtons.bind(this));
Common.NotificationCenter.on('window:resize', this.updatePluginsButtons.bind(this));
}, },
loadConfig: function(data) { loadConfig: function(data) {
@ -154,7 +151,6 @@ define([
setApi: function(api) { setApi: function(api) {
this.api = api; this.api = api;
if (!this.appOptions.customization || (this.appOptions.customization.plugins!==false)) {
this.api.asc_registerCallback("asc_onPluginShow", _.bind(this.onPluginShow, this)); this.api.asc_registerCallback("asc_onPluginShow", _.bind(this.onPluginShow, this));
this.api.asc_registerCallback("asc_onPluginClose", _.bind(this.onPluginClose, this)); this.api.asc_registerCallback("asc_onPluginClose", _.bind(this.onPluginClose, this));
this.api.asc_registerCallback("asc_onPluginResize", _.bind(this.onPluginResize, this)); this.api.asc_registerCallback("asc_onPluginResize", _.bind(this.onPluginResize, this));
@ -162,17 +158,13 @@ define([
this.api.asc_registerCallback("asc_onPluginMouseMove", _.bind(this.onPluginMouseMove, this)); this.api.asc_registerCallback("asc_onPluginMouseMove", _.bind(this.onPluginMouseMove, this));
this.api.asc_registerCallback('asc_onPluginsReset', _.bind(this.resetPluginsList, this)); this.api.asc_registerCallback('asc_onPluginsReset', _.bind(this.resetPluginsList, this));
this.api.asc_registerCallback('asc_onPluginsInit', _.bind(this.onPluginsInit, this)); this.api.asc_registerCallback('asc_onPluginsInit', _.bind(this.onPluginsInit, this));
this.api.asc_registerCallback('asc_onPluginShowButton', _.bind(this.onPluginShowButton, this));
this.api.asc_registerCallback('asc_onPluginHideButton', _.bind(this.onPluginHideButton, this));
this.loadPlugins(); this.loadPlugins();
}
return this; return this;
}, },
setMode: function(mode, api) { setMode: function(mode) {
this.appOptions = mode; this.appOptions = mode;
this.api = api;
this.customPluginsComplete = !this.appOptions.canBrandingExt; this.customPluginsComplete = !this.appOptions.canBrandingExt;
if (this.appOptions.canBrandingExt) if (this.appOptions.canBrandingExt)
this.getAppCustomPlugins(this.configPlugins); this.getAppCustomPlugins(this.configPlugins);
@ -206,14 +198,42 @@ define([
arr = []; arr = [];
storePlugins.each(function(item){ storePlugins.each(function(item){
var plugin = new Asc.CPlugin(); var plugin = new Asc.CPlugin();
plugin.deserialize(item.get('original')); plugin.set_Name(item.get('name'));
plugin.set_Guid(item.get('guid'));
plugin.set_BaseUrl(item.get('baseUrl'));
var variations = item.get('variations'),
variationsArr = [];
variations.forEach(function(itemVar){
var variation = new Asc.CPluginVariation();
variation.set_Description(itemVar.get('description'));
variation.set_Url(itemVar.get('url'));
variation.set_Icons(itemVar.get('icons'));
variation.set_Visual(itemVar.get('isVisual'));
variation.set_CustomWindow(itemVar.get('isCustomWindow'));
variation.set_System(itemVar.get('isSystem'));
variation.set_Viewer(itemVar.get('isViewer'));
variation.set_EditorsSupport(itemVar.get('EditorsSupport'));
variation.set_Modal(itemVar.get('isModal'));
variation.set_InsideMode(itemVar.get('isInsideMode'));
variation.set_InitDataType(itemVar.get('initDataType'));
variation.set_InitData(itemVar.get('initData'));
variation.set_UpdateOleOnResize(itemVar.get('isUpdateOleOnResize'));
variation.set_Buttons(itemVar.get('buttons'));
variation.set_Size(itemVar.get('size'));
variation.set_InitOnSelectionChanged(itemVar.get('initOnSelectionChanged'));
variation.set_Events(itemVar.get('events'));
variationsArr.push(variation);
});
plugin.set_Variations(variationsArr);
item.set('pluginObj', plugin); item.set('pluginObj', plugin);
arr.push(plugin); arr.push(plugin);
}); });
this.api.asc_pluginsRegister('', arr); this.api.asc_pluginsRegister('', arr);
if (storePlugins.hasVisible()) if (storePlugins.hasVisible())
Common.NotificationCenter.trigger('tab:visible', 'plugins', Common.UI.LayoutManager.isElementVisible('toolbar-plugins')); Common.NotificationCenter.trigger('tab:visible', 'plugins', true);
Common.Gateway.pluginsReady();
}, },
onAddPlugin: function (model) { onAddPlugin: function (model) {
@ -223,7 +243,7 @@ define([
if (!btn) return; if (!btn) return;
var _group = $('> .group', me.$toolbarPanelPlugins); var _group = $('> .group', me.$toolbarPanelPlugins);
var $slot = $('<span class="btn-slot text x-huge"></span>').appendTo(_group); var $slot = $('<span class="slot"></span>').appendTo(_group);
btn.render($slot); btn.render($slot);
} }
}, },
@ -244,15 +264,11 @@ define([
$('<div class="separator long"></div>').appendTo(me.$toolbarPanelPlugins); $('<div class="separator long"></div>').appendTo(me.$toolbarPanelPlugins);
_group = $('<div class="group"></div>'); _group = $('<div class="group"></div>');
rank_plugins = 0; rank_plugins = 0;
} else {
_group.appendTo(me.$toolbarPanelPlugins);
$('<div class="separator long invisible"></div>').appendTo(me.$toolbarPanelPlugins);
_group = $('<div class="group" style="padding-left: 0;"></div>');
} }
var btn = me.panelPlugins.createPluginButton(model); var btn = me.panelPlugins.createPluginButton(model);
if (btn) { if (btn) {
var $slot = $('<span class="btn-slot text x-huge"></span>').appendTo(_group); var $slot = $('<span class="slot"></span>').appendTo(_group);
btn.render($slot); btn.render($slot);
rank_plugins++; rank_plugins++;
} }
@ -264,14 +280,6 @@ define([
} }
}, },
updatePluginsButtons: function() {
var storePlugins = this.getApplication().getCollection('Common.Collections.Plugins'),
me = this;
storePlugins.each(function(item){
me.panelPlugins.updatePluginIcons(item);
});
},
onSelectPlugin: function(picker, item, record, e){ onSelectPlugin: function(picker, item, record, e){
var btn = $(e.target); var btn = $(e.target);
if (btn && btn.hasClass('plugin-caret')) { if (btn && btn.hasClass('plugin-caret')) {
@ -359,19 +367,17 @@ define([
var me = this, var me = this,
isCustomWindow = variation.get_CustomWindow(), isCustomWindow = variation.get_CustomWindow(),
arrBtns = variation.get_Buttons(), arrBtns = variation.get_Buttons(),
newBtns = [], newBtns = {},
size = variation.get_Size(), size = variation.get_Size();
isModal = variation.get_Modal();
if (!size || size.length<2) size = [800, 600]; if (!size || size.length<2) size = [800, 600];
if (_.isArray(arrBtns)) { if (_.isArray(arrBtns)) {
_.each(arrBtns, function(b, index){ _.each(arrBtns, function(b, index){
if (b.visible) if (b.visible)
newBtns[index] = {caption: b.text, value: index, primary: b.primary}; newBtns[index] = {text: b.text, cls: 'custom' + ((b.primary) ? ' primary' : '')};
}); });
} }
var help = variation.get_Help();
me.pluginDlg = new Common.Views.PluginDlg({ me.pluginDlg = new Common.Views.PluginDlg({
cls: isCustomWindow ? 'plain' : '', cls: isCustomWindow ? 'plain' : '',
header: !isCustomWindow, header: !isCustomWindow,
@ -381,10 +387,7 @@ define([
url: url, url: url,
frameId : frameId, frameId : frameId,
buttons: isCustomWindow ? undefined : newBtns, buttons: isCustomWindow ? undefined : newBtns,
toolcallback: _.bind(this.onToolClose, this), toolcallback: _.bind(this.onToolClose, this)
help: !!help,
loader: plugin.get_Loader(),
modal: isModal!==undefined ? isModal : true
}); });
me.pluginDlg.on({ me.pluginDlg.on({
'render:after': function(obj){ 'render:after': function(obj){
@ -399,12 +402,6 @@ define([
}, },
'resize': function(args){ 'resize': function(args){
me.api.asc_pluginEnableMouseEvents(args[1]=='start'); me.api.asc_pluginEnableMouseEvents(args[1]=='start');
},
'help': function(){
help && window.open(help, '_blank');
},
'header:click': function(type){
me.api.asc_pluginButtonClick(type);
} }
}); });
@ -464,14 +461,6 @@ define([
this.parsePlugins(pluginsdata) this.parsePlugins(pluginsdata)
}, },
onPluginShowButton: function(id) {
this.pluginDlg && this.pluginDlg.showButton(id);
},
onPluginHideButton: function(id) {
this.pluginDlg && this.pluginDlg.hideButton(id);
},
runAutoStartPlugins: function() { runAutoStartPlugins: function() {
if (this.autostart && this.autostart.length > 0) { if (this.autostart && this.autostart.length > 0) {
this.api.asc_pluginRun(this.autostart.shift(), 0, ''); this.api.asc_pluginRun(this.autostart.shift(), 0, '');
@ -503,8 +492,7 @@ define([
var me = this; var me = this;
var pluginStore = this.getApplication().getCollection('Common.Collections.Plugins'), var pluginStore = this.getApplication().getCollection('Common.Collections.Plugins'),
isEdit = me.appOptions.isEdit, isEdit = me.appOptions.isEdit,
editor = me.editor, editor = me.editor;
apiVersion = me.api ? me.api.GetVersion() : undefined;
if ( pluginsdata instanceof Array ) { if ( pluginsdata instanceof Array ) {
var arr = [], arrUI = [], var arr = [], arrUI = [],
lang = me.appOptions.lang.split(/[\-_]/)[0]; lang = me.appOptions.lang.split(/[\-_]/)[0];
@ -543,10 +531,9 @@ define([
description: description, description: description,
index: variationsArr.length, index: variationsArr.length,
url: itemVar.url, url: itemVar.url,
icons: itemVar.icons2 || itemVar.icons, icons: itemVar.icons,
buttons: itemVar.buttons, buttons: itemVar.buttons,
visible: visible, visible: visible
help: itemVar.help
}); });
variationsArr.push(model); variationsArr.push(model);
@ -558,9 +545,6 @@ define([
if (typeof item.nameLocale == 'object') if (typeof item.nameLocale == 'object')
name = item.nameLocale[lang] || item.nameLocale['en'] || name || ''; name = item.nameLocale[lang] || item.nameLocale['en'] || name || '';
if (pluginVisible)
pluginVisible = me.checkPluginVersion(apiVersion, item.minVersion);
arr.push(new Common.Models.Plugin({ arr.push(new Common.Models.Plugin({
name : name, name : name,
guid: item.guid, guid: item.guid,
@ -569,9 +553,7 @@ define([
currentVariation: 0, currentVariation: 0,
visible: pluginVisible, visible: pluginVisible,
groupName: (item.group) ? item.group.name : '', groupName: (item.group) ? item.group.name : '',
groupRank: (item.group) ? item.group.rank : 0, groupRank: (item.group) ? item.group.rank : 0
minVersion: item.minVersion,
original: item
})); }));
} }
}); });
@ -608,25 +590,6 @@ define([
} }
}, },
checkPluginVersion: function(apiVersion, pluginVersion) {
if (apiVersion && apiVersion!=='develop' && pluginVersion && typeof pluginVersion == 'string') {
var res = pluginVersion.match(/^([0-9]+)(?:.([0-9]+))?(?:.([0-9]+))?$/),
apires = apiVersion.match(/^([0-9]+)(?:.([0-9]+))?(?:.([0-9]+))?$/);
if (res && res.length>1 && apires && apires.length>1) {
for (var i=0; i<3; i++) {
var pluginVer = res[i+1] ? parseInt(res[i+1]) : 0,
apiVer = apires[i+1] ? parseInt(apires[i+1]) : 0;
if (pluginVer>apiVer)
return false;
if (pluginVer<apiVer)
return true;
}
}
}
return true;
},
getPlugins: function(pluginsData, fetchFunction) { getPlugins: function(pluginsData, fetchFunction) {
if (!pluginsData || pluginsData.length<1) if (!pluginsData || pluginsData.length<1)
return Promise.resolve([]); return Promise.resolve([]);
@ -672,27 +635,23 @@ define([
arr = [], arr = [],
plugins = this.configPlugins, plugins = this.configPlugins,
warn = false; warn = false;
if (plugins.plugins && plugins.plugins.length>0) if (plugins.plugins && plugins.plugins.length>0) {
arr = plugins.plugins; arr = plugins.plugins;
if (plugins && plugins.config) {
var val = plugins.config.autostart || plugins.config.autoStartGuid; var val = plugins.config.autostart || plugins.config.autoStartGuid;
if (typeof (val) == 'string') if (typeof (val) == 'string')
val = [val]; val = [val];
warn = !!plugins.config.autoStartGuid; warn = !!plugins.config.autoStartGuid;
autostart = val || []; autostart = val || [];
} }
plugins = this.serverPlugins; plugins = this.serverPlugins;
if (plugins.plugins && plugins.plugins.length>0) if (plugins.plugins && plugins.plugins.length>0) {
arr = arr.concat(plugins.plugins); arr = arr.concat(plugins.plugins);
if (plugins && plugins.config) { var val = plugins.config.autostart || plugins.config.autoStartGuid;
val = plugins.config.autostart || plugins.config.autoStartGuid;
if (typeof (val) == 'string') if (typeof (val) == 'string')
val = [val]; val = [val];
(warn || plugins.config.autoStartGuid) && console.warn("Obsolete: The autoStartGuid parameter is deprecated. Please check the documentation for new plugin connection configuration."); (warn || plugins.config.autoStartGuid) && console.warn("Obsolete: The autoStartGuid parameter is deprecated. Please check the documentation for new plugin connection configuration.");
autostart = autostart.concat(val || []); autostart = autostart.concat(val || []);
} }
this.autostart = autostart; this.autostart = autostart;
this.parsePlugins(arr, false); this.parsePlugins(arr, false);
} }

View file

@ -153,6 +153,7 @@ define([
var me = this, var me = this,
win = new Common.Views.PasswordDialog({ win = new Common.Views.PasswordDialog({
api: me.api, api: me.api,
signType: 'invisible',
handler: function(result, props) { handler: function(result, props) {
if (result == 'ok') { if (result == 'ok') {
me.api.asc_setCurrentPassword(props); me.api.asc_setCurrentPassword(props);

View file

@ -48,8 +48,7 @@ define([
'common/main/lib/collection/ReviewChanges', 'common/main/lib/collection/ReviewChanges',
'common/main/lib/view/ReviewChanges', 'common/main/lib/view/ReviewChanges',
'common/main/lib/view/ReviewPopover', 'common/main/lib/view/ReviewPopover',
'common/main/lib/view/LanguageDialog', 'common/main/lib/view/LanguageDialog'
'common/main/lib/view/OptionsDialog'
], function () { ], function () {
'use strict'; 'use strict';
@ -70,17 +69,12 @@ define([
'FileMenu': { 'FileMenu': {
'settings:apply': this.applySettings.bind(this) 'settings:apply': this.applySettings.bind(this)
}, },
'LeftMenu': {
'comments:show': _.bind(this.commentsShowHide, this, 'show'),
'comments:hide': _.bind(this.commentsShowHide, this, 'hide')
},
'Common.Views.ReviewChanges': { 'Common.Views.ReviewChanges': {
'reviewchange:accept': _.bind(this.onAcceptClick, this), 'reviewchange:accept': _.bind(this.onAcceptClick, this),
'reviewchange:reject': _.bind(this.onRejectClick, this), 'reviewchange:reject': _.bind(this.onRejectClick, this),
'reviewchange:delete': _.bind(this.onDeleteClick, this), 'reviewchange:delete': _.bind(this.onDeleteClick, this),
'reviewchange:preview': _.bind(this.onBtnPreviewClick, this), 'reviewchange:preview': _.bind(this.onBtnPreviewClick, this),
'reviewchange:view': _.bind(this.onReviewViewClick, this), 'reviewchanges:view': _.bind(this.onReviewViewClick, this),
'reviewchange:compare': _.bind(this.onCompareClick, this),
'lang:document': _.bind(this.onDocLanguage, this), 'lang:document': _.bind(this.onDocLanguage, this),
'collaboration:coauthmode': _.bind(this.onCoAuthMode, this) 'collaboration:coauthmode': _.bind(this.onCoAuthMode, this)
}, },
@ -100,17 +94,13 @@ define([
onLaunch: function () { onLaunch: function () {
this.collection = this.getApplication().getCollection('Common.Collections.ReviewChanges'); this.collection = this.getApplication().getCollection('Common.Collections.ReviewChanges');
this.userCollection = this.getApplication().getCollection('Common.Collections.Users'); this.userCollection = this.getApplication().getCollection('Common.Collections.Users');
this.viewmode = false;
this._state = {posx: -1000, posy: -1000, popoverVisible: false, previewMode: false, compareSettings: null, wsLock: false, wsProps: []}; this._state = {posx: -1000, posy: -1000, popoverVisible: false, previewMode: false};
Common.NotificationCenter.on('reviewchanges:turn', this.onTurnPreview.bind(this)); Common.NotificationCenter.on('reviewchanges:turn', this.onTurnPreview.bind(this));
Common.NotificationCenter.on('spelling:turn', this.onTurnSpelling.bind(this)); Common.NotificationCenter.on('spelling:turn', this.onTurnSpelling.bind(this));
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this)); Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this)); Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this));
Common.NotificationCenter.on('collaboration:sharing', this.changeAccessRights.bind(this));
Common.NotificationCenter.on('collaboration:sharingdeny', this.onLostEditRights.bind(this));
Common.NotificationCenter.on('protect:wslock', _.bind(this.onChangeProtectSheet, this));
this.userCollection.on('reset', _.bind(this.onUpdateUsers, this)); this.userCollection.on('reset', _.bind(this.onUpdateUsers, this));
this.userCollection.on('add', _.bind(this.onUpdateUsers, this)); this.userCollection.on('add', _.bind(this.onUpdateUsers, this));
@ -122,7 +112,6 @@ define([
this.currentUserId = data.config.user.id; this.currentUserId = data.config.user.id;
this.sdkViewName = data['sdkviewname'] || this.sdkViewName; this.sdkViewName = data['sdkviewname'] || this.sdkViewName;
} }
return this;
}, },
setApi: function (api) { setApi: function (api) {
if (api) { if (api) {
@ -131,16 +120,8 @@ define([
if (this.appConfig.canReview || this.appConfig.canViewReview) { if (this.appConfig.canReview || this.appConfig.canViewReview) {
this.api.asc_registerCallback('asc_onShowRevisionsChange', _.bind(this.onApiShowChange, this)); this.api.asc_registerCallback('asc_onShowRevisionsChange', _.bind(this.onApiShowChange, this));
this.api.asc_registerCallback('asc_onUpdateRevisionsChangesPosition', _.bind(this.onApiUpdateChangePosition, this)); this.api.asc_registerCallback('asc_onUpdateRevisionsChangesPosition', _.bind(this.onApiUpdateChangePosition, this));
this.api.asc_registerCallback('asc_onAuthParticipantsChanged', _.bind(this.onAuthParticipantsChanged, this));
this.api.asc_registerCallback('asc_onParticipantsChanged', _.bind(this.onAuthParticipantsChanged, this));
this.api.asc_registerCallback('asc_onChangeDisplayModeInReview', _.bind(this.onChangeDisplayModeInReview, this));
} }
if (this.appConfig.canReview)
this.api.asc_registerCallback('asc_onOnTrackRevisionsChange', _.bind(this.onApiTrackRevisionsChange, this));
this.api.asc_registerCallback('asc_onAcceptChangesBeforeCompare',_.bind(this.onAcceptChangesBeforeCompare, this));
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onCoAuthoringDisconnect, this)); this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onCoAuthoringDisconnect, this));
Common.Gateway.on('setrevisedfile', _.bind(this.setRevisedFile, this));
} }
}, },
@ -149,35 +130,16 @@ define([
this.popoverChanges = new Common.Collections.ReviewChanges(); this.popoverChanges = new Common.Collections.ReviewChanges();
this.view = this.createView('Common.Views.ReviewChanges', { mode: mode }); this.view = this.createView('Common.Views.ReviewChanges', { mode: mode });
if (!!this.appConfig.sharingSettingsUrl && this.appConfig.sharingSettingsUrl.length || this.appConfig.canRequestSharingSettings) {
Common.Gateway.on('showsharingsettings', _.bind(this.changeAccessRights, this));
Common.Gateway.on('setsharingsettings', _.bind(this.setSharingSettings, this));
}
return this; return this;
}, },
loadDocument: function(data) { SetDisabled: function(state) {
this.document = data.doc;
},
SetDisabled: function(state, reviewMode, fillFormMode) {
if (this.dlgChanges) if (this.dlgChanges)
this.dlgChanges.close(); this.dlgChanges.close();
if (reviewMode) this.view && this.view.SetDisabled(state, this.langs);
this.lockToolbar(Common.enumLock.previewReviewMode, state);
else if (fillFormMode)
this.lockToolbar(Common.enumLock.viewFormMode, state);
else
this.lockToolbar(Common.enumLock.viewMode, state);
this.setPreviewMode(state); this.setPreviewMode(state);
}, },
lockToolbar: function (causes, lock, opts) {
Common.Utils.lockControls(causes, lock, opts, this.view.getButtons());
},
setPreviewMode: function(mode) { //disable accept/reject in popover setPreviewMode: function(mode) { //disable accept/reject in popover
if (this.viewmode === mode) return; if (this.viewmode === mode) return;
this.viewmode = mode; this.viewmode = mode;
@ -190,42 +152,11 @@ define([
}); });
}, },
isSelectedChangesLocked: function(changes, isShow) { onApiShowChange: function (sdkchange) {
if (!changes || changes.length<1) return true;
if (isShow)
return changes[0].get('lock') || !changes[0].get('editable');
for (var i=0; i<changes.length; i++) {
var change = changes[i];
if (change.get('lock') || !change.get('editable'))
return true; // lock button if at least one change is locked
}
return false;
},
onApiShowChange: function (sdkchange, isShow) {
var btnlock = true,
changes;
if (this.appConfig.canReview && !this.appConfig.isReviewOnly) {
if (sdkchange && sdkchange.length>0) {
changes = this.readSDKChange(sdkchange);
btnlock = this.isSelectedChangesLocked(changes, isShow);
}
if (this._state.lock !== btnlock) {
Common.Utils.lockControls(Common.enumLock.reviewChangelock, btnlock, {array: [this.view.btnAccept, this.view.btnReject]});
if (this.dlgChanges) {
this.dlgChanges.btnAccept.setDisabled(btnlock);
this.dlgChanges.btnReject.setDisabled(btnlock);
}
this._state.lock = btnlock;
Common.Utils.InternalSettings.set(this.view.appPrefix + "accept-reject-lock", btnlock);
}
}
if (this.getPopover()) { if (this.getPopover()) {
if (!this.appConfig.reviewHoverMode && sdkchange && sdkchange.length>0 && isShow) { // show changes balloon only for current position, not selection if (sdkchange && sdkchange.length>0) {
var i = 0, var i = 0,
changes = this.readSDKChange(sdkchange),
posX = sdkchange[0].get_X(), posX = sdkchange[0].get_X(),
posY = sdkchange[0].get_Y(), posY = sdkchange[0].get_Y(),
animate = ( Math.abs(this._state.posx-posX)>0.001 || Math.abs(this._state.posy-posY)>0.001) || (sdkchange.length !== this._state.changes_length), animate = ( Math.abs(this._state.posx-posX)>0.001 || Math.abs(this._state.posy-posY)>0.001) || (sdkchange.length !== this._state.changes_length),
@ -233,7 +164,7 @@ define([
lockUser = this.getUserName(sdkchange[0].get_LockUserId()); lockUser = this.getUserName(sdkchange[0].get_LockUserId());
this.getPopover().hideTips(); this.getPopover().hideTips();
this.popoverChanges.reset(changes || this.readSDKChange(sdkchange)); this.popoverChanges.reset(changes);
if (animate) { if (animate) {
if ( this.getPopover().isVisible() ) this.getPopover().hide(); if ( this.getPopover().isVisible() ) this.getPopover().hide();
@ -241,6 +172,16 @@ define([
} }
this.getPopover().showReview(animate, lock, lockUser); this.getPopover().showReview(animate, lock, lockUser);
if (this.appConfig.canReview && !this.appConfig.isReviewOnly && this._state.lock !== lock) {
this.view.btnAccept.setDisabled(lock==true);
this.view.btnReject.setDisabled(lock==true);
if (this.dlgChanges) {
this.dlgChanges.btnAccept.setDisabled(lock==true);
this.dlgChanges.btnReject.setDisabled(lock==true);
}
this._state.lock = lock;
}
this._state.posx = posX; this._state.posx = posX;
this._state.posy = posY; this._state.posy = posY;
this._state.changes_length = sdkchange.length; this._state.changes_length = sdkchange.length;
@ -286,11 +227,7 @@ define([
if ((this.appConfig.canReview || this.appConfig.canViewReview) && _.isUndefined(this.popover)) { if ((this.appConfig.canReview || this.appConfig.canViewReview) && _.isUndefined(this.popover)) {
this.popover = Common.Views.ReviewPopover.prototype.getPopover({ this.popover = Common.Views.ReviewPopover.prototype.getPopover({
reviewStore : this.popoverChanges, reviewStore : this.popoverChanges,
renderTo : this.sdkViewName, renderTo : this.sdkViewName
canRequestUsers: (this.appConfig) ? this.appConfig.canRequestUsers : undefined,
canRequestSendNotify: (this.appConfig) ? this.appConfig.canRequestSendNotify : undefined,
mentionShare: (this.appConfig) ? this.appConfig.mentionShare : true,
api: this.api
}); });
this.popover.setReviewStore(this.popoverChanges); this.popover.setReviewStore(this.popoverChanges);
} }
@ -458,9 +395,9 @@ define([
if (value.Get_WidowControl()) if (value.Get_WidowControl())
proptext += ((value.Get_WidowControl() ? me.textWidow : me.textNoWidow) + ', '); proptext += ((value.Get_WidowControl() ? me.textWidow : me.textNoWidow) + ', ');
if (value.Get_Tabs() !== undefined) if (value.Get_Tabs() !== undefined)
proptext += (me.textTabs + ', '); proptext += proptext += (me.textTabs + ', ');
if (value.Get_NumPr() !== undefined) if (value.Get_NumPr() !== undefined)
proptext += (me.textNum + ', '); proptext += proptext += (me.textNum + ', ');
if (value.Get_PStyle() !== undefined) { if (value.Get_PStyle() !== undefined) {
var style = me.api.asc_GetStyleNameById(value.Get_PStyle()); var style = me.api.asc_GetStyleNameById(value.Get_PStyle());
if (!_.isEmpty(style)) proptext += (style + ', '); if (!_.isEmpty(style)) proptext += (style + ', ');
@ -500,7 +437,7 @@ define([
scope : me.view, scope : me.view,
hint : !me.appConfig.canReview, hint : !me.appConfig.canReview,
goto : (item.get_MoveType() == Asc.c_oAscRevisionsMove.MoveTo || item.get_MoveType() == Asc.c_oAscRevisionsMove.MoveFrom), goto : (item.get_MoveType() == Asc.c_oAscRevisionsMove.MoveTo || item.get_MoveType() == Asc.c_oAscRevisionsMove.MoveFrom),
editable : me.appConfig.isReviewOnly && (item.get_UserId() == me.currentUserId) || !me.appConfig.isReviewOnly && (!me.appConfig.canUseReviewPermissions || AscCommon.UserInfoParser.canEditReview(item.get_UserName())) editable : (item.get_UserId() == me.currentUserId)
}); });
arr.push(change); arr.push(change);
@ -511,7 +448,7 @@ define([
getUserName: function(id){ getUserName: function(id){
if (this.userCollection && id!==null){ if (this.userCollection && id!==null){
var rec = this.userCollection.findUser(id); var rec = this.userCollection.findUser(id);
if (rec) return AscCommon.UserInfoParser.getParsedName(rec.get('username')); if (rec) return rec.get('username');
} }
return ''; return '';
}, },
@ -550,7 +487,7 @@ define([
if (item.value === 'all') { if (item.value === 'all') {
this.api.asc_AcceptAllChanges(); this.api.asc_AcceptAllChanges();
} else { } else {
this.api.asc_AcceptChangesBySelection(true); // accept and move to the next change this.api.asc_AcceptChanges();
} }
} else { } else {
this.api.asc_AcceptChanges(menu); this.api.asc_AcceptChanges(menu);
@ -565,7 +502,7 @@ define([
if (item.value === 'all') { if (item.value === 'all') {
this.api.asc_RejectAllChanges(); this.api.asc_RejectAllChanges();
} else { } else {
this.api.asc_RejectChangesBySelection(true); // reject and move to the next change this.api.asc_RejectChanges();
} }
} else { } else {
this.api.asc_RejectChanges(menu); this.api.asc_RejectChanges(menu);
@ -588,179 +525,48 @@ define([
Common.NotificationCenter.trigger('edit:complete', this.view); Common.NotificationCenter.trigger('edit:complete', this.view);
}, },
onTurnPreview: function(state, global, fromApi) { onTurnPreview: function(state) {
if ( this.appConfig.isReviewOnly ) { if ( this.appConfig.isReviewOnly ) {
this.view.turnChanges(true); this.view.turnChanges(true);
} else } else
if ( this.appConfig.canReview ) { if ( this.appConfig.canReview ) {
state = (state=='off') ? false : state; // support of prev. version (on/off)
if (!!global) {
this.api.asc_SetLocalTrackRevisions(null);
this.api.asc_SetGlobalTrackRevisions(!!state);
} else
this.api.asc_SetLocalTrackRevisions(!!state);
}
},
onApiTrackRevisionsChange: function(localFlag, globalFlag, userId) {
if ( this.appConfig.isReviewOnly ) {
this.view.turnChanges(true);
} else
if ( this.appConfig.canReview ) {
var global = (localFlag===null),
state = global ? globalFlag : localFlag;
Common.Utils.InternalSettings.set(this.view.appPrefix + "track-changes", (state ? 0 : 1) + (global ? 2 : 0));
this.view.turnChanges(state, global);
if (userId && this.userCollection) {
var rec = this.userCollection.findOriginalUser(userId);
rec && Common.NotificationCenter.trigger('showmessage', {msg: Common.Utils.String.format(globalFlag ? this.textOnGlobal : this.textOffGlobal, AscCommon.UserInfoParser.getParsedName(rec.get('username')))},
{timeout: 5000, hideCloseTip: true});
}
}
},
onTurnSpelling: function (state, suspend) {
state = (state == 'on'); state = (state == 'on');
this.view && this.view.turnSpelling(state);
if (Common.UI.FeaturesManager.canChange('spellcheck') && !suspend) { this.api.asc_SetTrackRevisions(state);
Common.localStorage.setItem(this.view.appPrefix + "track-changes-" + (this.appConfig.fileKey || ''), state ? 1 : 0);
this.view.turnChanges(state);
}
},
onTurnSpelling: function (state) {
state = (state == 'on');
this.view.turnSpelling(state);
Common.localStorage.setItem(this.view.appPrefix + "settings-spellcheck", state ? 1 : 0); Common.localStorage.setItem(this.view.appPrefix + "settings-spellcheck", state ? 1 : 0);
this.api.asc_setSpellCheck(state); this.api.asc_setSpellCheck(state);
Common.Utils.InternalSettings.set(this.view.appPrefix + "settings-spellcheck", state); Common.Utils.InternalSettings.set(this.view.appPrefix + "settings-spellcheck", state);
}
}, },
onReviewViewClick: function(menu, item, e) { onReviewViewClick: function(menu, item, e) {
this.turnDisplayMode(item.value); this.turnDisplayMode(item.value);
if (!this.appConfig.isEdit && !this.appConfig.isRestrictedEdit) !this.appConfig.canReview && Common.localStorage.setItem(this.view.appPrefix + "review-mode", item.value);
Common.localStorage.setItem(this.view.appPrefix + "review-mode", item.value); // for viewer
else if (item.value=='markup' || item.value=='simple')
Common.localStorage.setItem(this.view.appPrefix + "review-mode-editor", item.value); // for editor save only markup modes
Common.NotificationCenter.trigger('edit:complete', this.view); Common.NotificationCenter.trigger('edit:complete', this.view);
}, },
onCompareClick: function(item) {
if (this.api) {
var me = this;
if (!this._state.compareSettings) {
this._state.compareSettings = new AscCommonWord.ComparisonOptions();
this._state.compareSettings.putWords(!Common.localStorage.getBool("de-compare-char"));
}
if (item === 'file') {
if (this.api)
this.api.asc_CompareDocumentFile(this._state.compareSettings);
Common.NotificationCenter.trigger('edit:complete', this.view);
} else if (item === 'url') {
(new Common.Views.ImageFromUrlDialog({
title: me.textUrl,
handler: function(result, value) {
if (result == 'ok') {
if (me.api) {
var checkUrl = value.replace(/ /g, '');
if (!_.isEmpty(checkUrl)) {
me.api.asc_CompareDocumentUrl(checkUrl, me._state.compareSettings);
}
}
Common.NotificationCenter.trigger('edit:complete', me.view);
}
}
})).show();
} else if (item === 'storage') {
if (this.appConfig.canRequestCompareFile) {
Common.Gateway.requestCompareFile();
} else {
(new Common.Views.SelectFileDlg({
fileChoiceUrl: this.appConfig.fileChoiceUrl.replace("{fileExt}", "").replace("{documentType}", "DocumentsOnly")
})).on('selectfile', function(obj, file){
me.setRevisedFile(file, me._state.compareSettings);
}).show();
}
} else if (item === 'settings') {
var value = me._state.compareSettings ? me._state.compareSettings.getWords() : true;
(new Common.Views.OptionsDialog({
title: me.textTitleComparison,
items: [
{caption: me.textChar, value: false, checked: (value===false)},
{caption: me.textWord, value: true, checked: (value!==false)}
],
label: me.textShow,
handler: function (dlg, result) {
if (result=='ok') {
me._state.compareSettings = new AscCommonWord.ComparisonOptions();
me._state.compareSettings.putWords(dlg.getSettings());
}
Common.NotificationCenter.trigger('edit:complete', me.toolbar);
}
})).show();
}
}
Common.NotificationCenter.trigger('edit:complete', this.view);
},
setRevisedFile: function(data) {
if (!this._state.compareSettings) {
this._state.compareSettings = new AscCommonWord.ComparisonOptions();
this._state.compareSettings.putWords(!Common.localStorage.getBool("de-compare-char"));
}
if (data && data.url) {
this.api.asc_CompareDocumentUrl(data.url, this._state.compareSettings, data.token);// for loading from storage
}
},
onAcceptChangesBeforeCompare: function(callback) {
var me = this;
Common.UI.warning({
width: 550,
msg: this.textAcceptBeforeCompare,
buttons: ['yes', 'no'],
primary: 'yes',
callback: function(result) {
_.defer(function() {
if (callback) callback(result=='yes');
});
Common.NotificationCenter.trigger('edit:complete', this.view);
}
});
},
turnDisplayMode: function(mode) { turnDisplayMode: function(mode) {
if (this.api) { if (this.api) {
var type = Asc.c_oAscDisplayModeInReview.Edit; if (mode === 'final')
switch (mode) { this.api.asc_BeginViewModeInReview(true);
case 'final': else if (mode === 'original')
type = Asc.c_oAscDisplayModeInReview.Final; this.api.asc_BeginViewModeInReview(false);
break; else
case 'original': this.api.asc_EndViewModeInReview();
type = Asc.c_oAscDisplayModeInReview.Original;
break;
case 'simple':
type = Asc.c_oAscDisplayModeInReview.Simple;
break;
}
this.api.asc_SetDisplayModeInReview(type);
} }
this.disableEditing(mode == 'final' || mode == 'original'); this.disableEditing(mode == 'final' || mode == 'original');
this._state.previewMode = (mode == 'final' || mode == 'original'); this._state.previewMode = (mode == 'final' || mode == 'original');
}, },
onChangeDisplayModeInReview: function(type) {
this.disableEditing(type===Asc.c_oAscDisplayModeInReview.Final || type===Asc.c_oAscDisplayModeInReview.Original);
var mode = 'markup';
switch (type) {
case Asc.c_oAscDisplayModeInReview.Final:
mode = 'final';
break;
case Asc.c_oAscDisplayModeInReview.Original:
mode = 'original';
break;
case Asc.c_oAscDisplayModeInReview.Simple:
mode = 'simple';
break;
}
this.view && this.view.turnDisplayMode(mode);
this._state.previewMode = (type===Asc.c_oAscDisplayModeInReview.Final || type===Asc.c_oAscDisplayModeInReview.Original);
},
isPreviewChangesMode: function() { isPreviewChangesMode: function() {
return this._state.previewMode; return this._state.previewMode;
}, },
@ -795,27 +601,35 @@ define([
}, },
disableEditing: function(disable) { disableEditing: function(disable) {
Common.NotificationCenter.trigger('editing:disable', disable, { var app = this.getApplication();
viewMode: false, app.getController('Toolbar').DisableToolbar(disable, false, true);
reviewMode: true, app.getController('DocumentHolder').getView().SetDisabled(disable);
fillFormMode: false,
allowMerge: false, if (this.appConfig.canReview) {
allowSignature: false, app.getController('RightMenu').getView('RightMenu').clearSelection();
allowProtect: false, app.getController('RightMenu').SetDisabled(disable, false);
rightMenu: {clear: disable, disable: true}, app.getController('Statusbar').getView('Statusbar').SetDisabled(disable);
statusBar: true, app.getController('Navigation') && app.getController('Navigation').SetDisabled(disable);
leftMenu: {disable: false, previewMode: true}, app.getController('Common.Controllers.Plugins').getView('Common.Views.Plugins').disableControls(disable);
fileMenu: {protect: true}, }
navigation: {disable: false, previewMode: true},
comments: {disable: false, previewMode: true}, var comments = app.getController('Common.Controllers.Comments');
chat: false, if (comments)
review: true, comments.setPreviewMode(disable);
viewport: false,
documentHolder: true, var leftMenu = app.getController('LeftMenu');
toolbar: true, leftMenu.leftMenu.getMenu('file').getButton('protect').setDisabled(disable);
plugins: true, leftMenu.setPreviewMode(disable);
protect: true
}, 'review'); if (this.view) {
this.view.$el.find('.no-group-mask').css('opacity', 1);
this.view.btnsDocLang && this.view.btnsDocLang.forEach(function(button) {
if ( button ) {
button.setDisabled(disable || !this.langs || this.langs.length<1);
}
}, this);
}
}, },
createToolbarPanel: function() { createToolbarPanel: function() {
@ -829,37 +643,23 @@ define([
onAppReady: function (config) { onAppReady: function (config) {
var me = this; var me = this;
if ( me.view && Common.localStorage.getBool(me.view.appPrefix + "settings-spellcheck", !(config.customization && config.customization.spellcheck===false)))
me.view.turnSpelling(true);
if ( config.canReview ) { if ( config.canReview ) {
(new Promise(function (resolve) { (new Promise(function (resolve) {
resolve(); resolve();
})).then(function () { })).then(function () {
// function _setReviewStatus(state, global) { function _setReviewStatus(state) {
// me.view.turnChanges(state, global); me.view.turnChanges(state);
// !global && me.api.asc_SetLocalTrackRevisions(state); me.api.asc_SetTrackRevisions(state);
// Common.Utils.InternalSettings.set(me.view.appPrefix + "track-changes", (state ? 0 : 1) + (global ? 2 : 0)); };
// };
var trackChanges = me.appConfig.customization && me.appConfig.customization.review ? me.appConfig.customization.review.trackChanges : undefined; var state = config.isReviewOnly || Common.localStorage.getBool(me.view.appPrefix + "track-changes-" + (config.fileKey || ''));
(trackChanges===undefined) && (trackChanges = me.appConfig.customization ? me.appConfig.customization.trackChanges : undefined);
if (config.isReviewOnly || trackChanges!==undefined)
me.api.asc_SetLocalTrackRevisions(config.isReviewOnly || trackChanges===true);
else
me.onApiTrackRevisionsChange(me.api.asc_GetLocalTrackRevisions(), me.api.asc_GetGlobalTrackRevisions());
me.api.asc_HaveRevisionsChanges() && me.view.markChanges(true); me.api.asc_HaveRevisionsChanges() && me.view.markChanges(true);
_setReviewStatus(state);
var val = Common.localStorage.getItem(me.view.appPrefix + "review-mode-editor"); if ( typeof (me.appConfig.customization) == 'object' && (me.appConfig.customization.showReviewChanges==true) ) {
if (val===null) {
val = me.appConfig.customization && me.appConfig.customization.review ? me.appConfig.customization.review.reviewDisplay : undefined;
!val && (val = me.appConfig.customization ? me.appConfig.customization.reviewDisplay : undefined);
val = /^(original|final|markup|simple)$/i.test(val) ? val.toLocaleLowerCase() : 'markup';
}
me.turnDisplayMode(val); // load display mode for all modes (viewer or editor)
me.view.turnDisplayMode(val);
if ( typeof (me.appConfig.customization) == 'object' && (me.appConfig.customization.review && me.appConfig.customization.review.showReviewChanges==true ||
(!me.appConfig.customization.review || me.appConfig.customization.review.showReviewChanges===undefined) && me.appConfig.customization.showReviewChanges==true) ) {
me.dlgChanges = (new Common.Views.ReviewChangesDialog({ me.dlgChanges = (new Common.Views.ReviewChangesDialog({
popoverChanges : me.popoverChanges, popoverChanges : me.popoverChanges,
mode : me.appConfig mode : me.appConfig
@ -872,14 +672,11 @@ define([
} else if (config.canViewReview) { } else if (config.canViewReview) {
config.canViewReview = (config.isEdit || me.api.asc_HaveRevisionsChanges(true)); // check revisions from all users config.canViewReview = (config.isEdit || me.api.asc_HaveRevisionsChanges(true)); // check revisions from all users
if (config.canViewReview) { if (config.canViewReview) {
var val = Common.localStorage.getItem(me.view.appPrefix + (config.isEdit || config.isRestrictedEdit ? "review-mode-editor" : "review-mode")); var val = Common.localStorage.getItem(me.view.appPrefix + "review-mode");
if (val===null) { if (val===null)
val = me.appConfig.customization && me.appConfig.customization.review ? me.appConfig.customization.review.reviewDisplay : undefined; val = me.appConfig.customization && /^(original|final|markup)$/i.test(me.appConfig.customization.reviewDisplay) ? me.appConfig.customization.reviewDisplay.toLocaleLowerCase() : 'original';
!val && (val = me.appConfig.customization ? me.appConfig.customization.reviewDisplay : undefined); me.turnDisplayMode((config.isEdit || config.isRestrictedEdit) ? 'markup' : val); // load display mode only in viewer
val = /^(original|final|markup|simple)$/i.test(val) ? val.toLocaleLowerCase() : (config.isEdit || config.isRestrictedEdit ? 'markup' : 'original'); me.view.turnDisplayMode((config.isEdit || config.isRestrictedEdit) ? 'markup' : val);
}
me.turnDisplayMode(val);
me.view.turnDisplayMode(val);
} }
} }
@ -888,27 +685,13 @@ define([
if (state !== me.view.btnChat.pressed) if (state !== me.view.btnChat.pressed)
me.view.turnChat(state); me.view.turnChat(state);
}); });
}
me.onChangeProtectSheet();
if (me.view) {
me.lockToolbar(Common.enumLock.hideComments, !Common.localStorage.getBool(me.view.appPrefix + "settings-livecomment", true), {array: [me.view.btnCommentRemove, me.view.btnCommentResolve]});
me.lockToolbar(Common.enumLock['Objects'], !!this._state.wsProps['Objects'], {array: [me.view.btnCommentRemove, me.view.btnCommentResolve]});
}
var val = Common.localStorage.getItem(me.view.appPrefix + "settings-review-hover-mode"); }
if (val === null) {
val = me.appConfig.customization && me.appConfig.customization.review ? !!me.appConfig.customization.review.hoverMode : false;
} else
val = !!parseInt(val);
Common.Utils.InternalSettings.set(me.view.appPrefix + "settings-review-hover-mode", val);
me.appConfig.reviewHoverMode = val;
}, },
applySettings: function(menu) { applySettings: function(menu) {
this.view && this.view.turnSpelling( Common.localStorage.getBool(this.view.appPrefix + "settings-spellcheck", true) ); this.view && this.view.turnSpelling( Common.localStorage.getBool(this.view.appPrefix + "settings-spellcheck", true) );
this.view && this.view.turnCoAuthMode( Common.localStorage.getBool(this.view.appPrefix + "settings-coauthmode", true) ); this.view && this.view.turnCoAuthMode( Common.localStorage.getBool(this.view.appPrefix + "settings-coauthmode", true) );
if ((this.appConfig.canReview || this.appConfig.canViewReview) && this.appConfig.reviewHoverMode)
this.onApiShowChange();
}, },
synchronizeChanges: function() { synchronizeChanges: function() {
@ -919,7 +702,11 @@ define([
setLanguages: function (array) { setLanguages: function (array) {
this.langs = array; this.langs = array;
this.lockToolbar(Common.enumLock.noSpellcheckLangs, this.langs.length<1, {array: this.view.btnsDocLang}); this.view && this.view.btnsDocLang && this.view.btnsDocLang.forEach(function(button) {
if ( button ) {
button.setDisabled(this.langs.length<1);
}
}, this);
}, },
onDocLanguage: function() { onDocLanguage: function() {
@ -937,41 +724,11 @@ define([
}, },
onLostEditRights: function() { onLostEditRights: function() {
this._readonlyRights = true;
this.view && this.view.onLostEditRights(); this.view && this.view.onLostEditRights();
this.view && this.lockToolbar(Common.enumLock.cantShare, true, {array: [this.view.btnSharing]});
},
changeAccessRights: function(btn,event,opts) {
if (this._docAccessDlg || this._readonlyRights) return;
if (this.appConfig.canRequestSharingSettings) {
Common.Gateway.requestSharingSettings();
} else {
var me = this;
me._docAccessDlg = new Common.Views.DocumentAccessDialog({
settingsurl: this.appConfig.sharingSettingsUrl
});
me._docAccessDlg.on('accessrights', function(obj, rights){
me.setSharingSettings({sharingSettings: rights});
}).on('close', function(obj){
me._docAccessDlg = undefined;
});
me._docAccessDlg.show();
}
},
setSharingSettings: function(data) {
if (data) {
this.document.info.sharingSettings = data.sharingSettings;
Common.NotificationCenter.trigger('collaboration:sharingupdate', data.sharingSettings);
Common.NotificationCenter.trigger('mentions:clearusers', this);
}
}, },
onCoAuthoringDisconnect: function() { onCoAuthoringDisconnect: function() {
this.lockToolbar(Common.enumLock.lostConnect, true) this.SetDisabled(true);
}, },
onUpdateUsers: function() { onUpdateUsers: function() {
@ -982,35 +739,6 @@ define([
}); });
}, },
onAuthParticipantsChanged: function(users) {
if (this.view && this.view.btnCompare) {
var length = 0;
_.each(users, function(item){
if (!item.asc_getView())
length++;
});
Common.Utils.lockControls(Common.enumLock.hasCoeditingUsers, length>1, {array: [this.view.btnCompare]});
}
},
commentsShowHide: function(mode) {
if (!this.view) return;
var value = Common.Utils.InternalSettings.get(this.view.appPrefix + "settings-livecomment");
(value!==undefined) && this.lockToolbar(Common.enumLock.hideComments, mode != 'show' && !value, {array: [this.view.btnCommentRemove, this.view.btnCommentResolve]});
},
onChangeProtectSheet: function(props) {
if (!props) {
var wbprotect = this.getApplication().getController('WBProtection');
props = wbprotect ? wbprotect.getWSProps() : null;
}
this._state.wsProps = props ? props.wsProps : [];
this._state.wsLock = props ? props.wsLock : false;
if (!this.view) return;
this.lockToolbar(Common.enumLock['Objects'], !!this._state.wsProps['Objects'], {array: [this.view.btnCommentRemove, this.view.btnCommentResolve]});
},
textInserted: '<b>Inserted:</b>', textInserted: '<b>Inserted:</b>',
textDeleted: '<b>Deleted:</b>', textDeleted: '<b>Deleted:</b>',
textParaInserted: '<b>Paragraph Inserted</b> ', textParaInserted: '<b>Paragraph Inserted</b> ',
@ -1065,21 +793,10 @@ define([
textChart: 'Chart', textChart: 'Chart',
textShape: 'Shape', textShape: 'Shape',
textTableChanged: '<b>Table Settings Changed</b>', textTableChanged: '<b>Table Settings Changed</b>',
textTableRowsAdd: '<b>Table Rows Added</b>', textTableRowsAdd: '<b>Table Rows Added<b/>',
textTableRowsDel: '<b>Table Rows Deleted</b>', textTableRowsDel: '<b>Table Rows Deleted<b/>',
textParaMoveTo: '<b>Moved:</b>', textParaMoveTo: '<b>Moved:</b>',
textParaMoveFromUp: '<b>Moved Up:</b>', textParaMoveFromUp: '<b>Moved Up:</b>',
textParaMoveFromDown: '<b>Moved Down:</b>', textParaMoveFromDown: '<b>Moved Down:</b>'
textUrl: 'Paste a document URL',
textAcceptBeforeCompare: 'In order to compare documents all the tracked changes in them will be considered to have been accepted. Do you want to continue?',
textTitleComparison: 'Comparison Settings',
textShow: 'Show changes at',
textChar: 'Character level',
textWord: 'Word level',
textOnGlobal: '{0} enabled Track Changes for everyone.',
textOffGlobal: '{0} disabled Track Changes for everyone.',
textOn: '{0} is now using Track Changes.',
textOff: '{0} is no longer using Track Changes.'
}, Common.Controllers.ReviewChanges || {})); }, Common.Controllers.ReviewChanges || {}));
}); });

View file

@ -1,502 +0,0 @@
/**
* Created by Maxim.Kadushkin on 2/5/2021.
*/
define([
'core'
], function () {
'use strict';
!Common.UI && (Common.UI = {});
Common.UI.Themes = new (function(locale) {
!locale && (locale = {});
const THEME_TYPE_LIGHT = 'light';
const THEME_TYPE_DARK = 'dark';
const THEME_TYPE_SYSTEM = 'system';
var themes_map = {
'theme-system': {
text: locale.txtThemeSystem || 'Same as system',
type: THEME_TYPE_SYSTEM,
source: 'static',
},
'theme-light': {
text: locale.txtThemeLight || 'Light',
type: 'light',
source: 'static',
},
'theme-classic-light': {
text: locale.txtThemeClassicLight || 'Classic Light',
type: 'light',
source: 'static',
},
'theme-dark': {
text: locale.txtThemeDark || 'Dark',
type: 'dark',
source: 'static',
},
'theme-contrast-dark': {
text: locale.txtThemeContrastDark || 'Dark Contrast',
type: 'dark',
source: 'static',
},
}
if ( !!window.currentLoaderTheme ) {
if ( !themes_map[currentLoaderTheme.id] )
themes_map[currentLoaderTheme.id] = currentLoaderTheme;
window.currentLoaderTheme = undefined;
}
var is_dark_mode_allowed = true;
var id_default_light_theme = 'theme-classic-light',
id_default_dark_theme = 'theme-dark';
var name_colors = [
"toolbar-header-document",
"toolbar-header-spreadsheet",
"toolbar-header-presentation",
"text-toolbar-header-on-background-document",
"text-toolbar-header-on-background-spreadsheet",
"text-toolbar-header-on-background-presentation",
"background-normal",
"background-toolbar",
"background-toolbar-additional",
"background-primary-dialog-button",
"background-tab-underline",
"background-notification-popover",
"background-notification-badge",
"background-scrim",
"background-loader",
"background-accent-button",
"background-contrast-popover",
"shadow-contrast-popover",
"highlight-button-hover",
"highlight-button-pressed",
"highlight-button-pressed-hover",
"highlight-primary-dialog-button-hover",
"highlight-header-button-hover",
"highlight-header-button-pressed",
"highlight-toolbar-tab-underline",
"highlight-text-select",
"highlight-accent-button-hover",
"highlight-accent-button-pressed",
"border-toolbar",
"border-divider",
"border-regular-control",
"border-toolbar-button-hover",
"border-preview-hover",
"border-preview-select",
"border-control-focus",
"border-color-shading",
"border-error",
"border-contrast-popover",
"text-normal",
"text-normal-pressed",
"text-secondary",
"text-tertiary",
"text-link",
"text-link-hover",
"text-link-active",
"text-link-visited",
"text-inverse",
"text-toolbar-header",
"text-contrast-background",
"text-alt-key-hint",
"icon-normal",
"icon-normal-pressed",
"icon-inverse",
"icon-toolbar-header",
"icon-notification-badge",
"icon-contrast-popover",
"icon-success",
"canvas-background",
"canvas-content-background",
"canvas-page-border",
"canvas-ruler-background",
"canvas-ruler-border",
"canvas-ruler-margins-background",
"canvas-ruler-mark",
"canvas-ruler-handle-border",
"canvas-ruler-handle-border-disabled",
"canvas-high-contrast",
"canvas-high-contrast-disabled",
"canvas-cell-border",
"canvas-cell-title-border",
"canvas-cell-title-border-hover",
"canvas-cell-title-border-selected",
"canvas-cell-title-hover",
"canvas-cell-title-selected",
"canvas-dark-cell-title",
"canvas-dark-cell-title-hover",
"canvas-dark-cell-title-selected",
"canvas-dark-cell-title-border",
"canvas-dark-cell-title-border-hover",
"canvas-dark-cell-title-border-selected",
"canvas-dark-content-background",
"canvas-dark-page-border",
"canvas-scroll-thumb",
"canvas-scroll-thumb-hover",
"canvas-scroll-thumb-pressed",
"canvas-scroll-thumb-border",
"canvas-scroll-thumb-border-hover",
"canvas-scroll-thumb-border-pressed",
"canvas-scroll-arrow",
"canvas-scroll-arrow-hover",
"canvas-scroll-arrow-pressed",
"canvas-scroll-thumb-target",
"canvas-scroll-thumb-target-hover",
"canvas-scroll-thumb-target-pressed"
];
var get_current_theme_colors = function (colors) {
var out_object = {};
if ( !(Common.Utils.isIE10 || Common.Utils.isIE11) ) {
var style = getComputedStyle(document.body);
colors.forEach(function (item, index) {
out_object[item] = style.getPropertyValue('--' + item).trim()
})
}
return out_object;
}
var create_colors_css = function (id, colors) {
if ( !!colors && !!id ) {
var _css_array = [':root .', id, '{'];
for (var c in colors) {
_css_array.push('--', c, ':', colors[c], ';');
}
_css_array.push('}');
return _css_array.join('');
}
}
var write_theme_css = function (css) {
if ( !!css ) {
var style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = css;
document.getElementsByTagName('head')[0].appendChild(style);
}
}
var parse_themes_object = function (obj) {
var curr_lang = Common.Locale.getCurrentLanguage(),
theme_label;
if ( !!obj.themes && obj.themes instanceof Array ) {
obj.themes.forEach(function (item) {
if ( !!item.id ) {
theme_label = !item.l10n || !item.l10n[curr_lang] ? item.name : item.l10n[curr_lang];
themes_map[item.id] = {text: theme_label, type: item.type};
write_theme_css(create_colors_css(item.id, item.colors));
} else
if ( typeof item == 'string' ) {
get_themes_config(item)
}
});
} else
if ( obj.id ) {
theme_label = !obj.l10n || !obj.l10n[curr_lang] ? obj.name : obj.l10n[curr_lang];
themes_map[obj.id] = {text: theme_label, type: obj.type};
write_theme_css( create_colors_css(obj.id, obj.colors) );
}
Common.NotificationCenter.trigger('uitheme:countchanged');
}
var get_themes_config = function (url) {
Common.Utils.loadConfig(url,
function ( obj ) {
if ( obj != 'error' ) {
parse_themes_object(obj);
} else {
console.warn('failed to load/parse themes.json');
}
}
);
// fetch(url, {
// method: 'get',
// headers: {
// 'Accept': 'application/json',
// },
// }).then(function(response) {
// if (!response.ok) {
// throw new Error('server error');
// }
// return response.json();
// }).then(function(response) {
// if ( response.then ) {
// // return response.json();
// } else {
// parse_themes_object(response);
//
// /* to break promises chain */
// throw new Error('loaded');
// }
// }).catch(function(e) {
// if ( e.message == 'loaded' ) {
// } else console.log('fetch error: ' + e);
// });
}
var on_document_ready = function (el) {
// get_themes_config('../../common/main/resources/themes/themes.json');
if ( !Common.Controllers.Desktop.isActive() || !Common.Controllers.Desktop.isOffline() )
get_themes_config('../../../../themes.json');
}
var get_ui_theme_name = function (objtheme) {
if ( typeof(objtheme) == 'string' &&
objtheme.startsWith("{") && objtheme.endsWith("}") )
{
objtheme = JSON.parse(objtheme);
}
if ( objtheme && typeof(objtheme) == 'object' )
return objtheme.id;
return objtheme;
}
var on_document_open = function (data) {
if ( !!this.api.asc_setContentDarkMode && this.isDarkTheme() ) {
this.api.asc_setContentDarkMode(this.isContentThemeDark());
}
};
const is_theme_type_system = function (id) { return themes_map[id].type == THEME_TYPE_SYSTEM; }
const get_system_theme_type = function () { return window.matchMedia('(prefers-color-scheme: dark)').matches ? THEME_TYPE_DARK : THEME_TYPE_LIGHT; }
const get_system_default_theme = function () {
const id = get_system_theme_type() == THEME_TYPE_DARK ?
id_default_dark_theme : id_default_light_theme;
return {id: id, info: themes_map[id]};
};
const on_system_theme_dark = function (mql) {
if (Common.localStorage.getBool('ui-theme-use-system', false)) {
this.setTheme('theme-system');
}
};
return {
init: function (api) {
var me = this;
Common.Gateway.on('opendocument', on_document_open.bind(this));
$(window).on('storage', function (e) {
if ( e.key == 'ui-theme' || e.key == 'ui-theme-id' ) {
if ( !!e.originalEvent.newValue ) {
if (Common.localStorage.getBool('ui-theme-use-system', false)) {
me.setTheme('theme-system');
} else me.setTheme(e.originalEvent.newValue, true);
}
} else
if ( e.key == 'content-theme' ) {
me.setContentTheme(e.originalEvent.newValue, true);
console.log('changed content', e.originalEvent.newValue);
}
})
this.api = api;
var theme_name = get_ui_theme_name(Common.localStorage.getItem('ui-theme'));
if ( !theme_name ) {
if ( !(Common.Utils.isIE10 || Common.Utils.isIE11) )
document.body.classList.forEach(function (classname, i, o) {
if ( !theme_name && classname.startsWith('theme-') &&
!classname.startsWith('theme-type-') && themes_map[classname] )
{
theme_name = classname;
var theme_obj = {
id: theme_name,
type: themes_map[theme_name].type
};
Common.localStorage.setItem('ui-theme', JSON.stringify(theme_obj));
}
});
}
if ( !themes_map[theme_name] )
theme_name = id_default_light_theme;
if ( !$('body').hasClass(theme_name) ) {
$('body').addClass(theme_name);
}
if ( !document.body.className.match(/theme-type-/) ) {
document.body.classList.add('theme-type-' + themes_map[theme_name].type);
}
var obj = get_current_theme_colors(name_colors);
obj.type = themes_map[theme_name].type;
obj.name = theme_name;
api.asc_setSkin(obj);
if ( !(Common.Utils.isIE10 || Common.Utils.isIE11) )
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', on_system_theme_dark.bind(this));
Common.NotificationCenter.on('document:ready', on_document_ready.bind(this));
},
available: function () {
return !Common.Utils.isIE && !this.locked;
},
setAvailable: function (value) {
this.locked = !value;
},
map: function () {
return themes_map
},
get: function (id) {
return themes_map[id]
},
currentThemeId: function () {
if ( Common.localStorage.getBool('ui-theme-use-system', false) )
return 'theme-system';
var t = Common.localStorage.getItem('ui-theme') || Common.localStorage.getItem('ui-theme-id');
var id = get_ui_theme_name(t);
return !!themes_map[id] ? id : id_default_light_theme;
},
defaultThemeId: function (type) {
return type == 'dark' ? id_default_dark_theme : id_default_light_theme;
},
defaultTheme: function (type) {
return themes_map[this.defaultThemeId(type)]
},
isDarkTheme: function (id) {
!id && (id = this.currentThemeId());
return (is_theme_type_system(id) ? get_system_default_theme().info.type : themes_map[id].type) == THEME_TYPE_DARK;
},
isContentThemeDark: function () {
return Common.localStorage.getItem("content-theme") == 'dark';
},
setContentTheme: function (mode, force) {
var set_dark = mode == 'dark';
if ( set_dark && !this.isDarkTheme() )
return;
if ( set_dark != this.isContentThemeDark() || force ) {
if ( this.api.asc_setContentDarkMode )
this.api.asc_setContentDarkMode(set_dark);
if ( Common.localStorage.getItem('content-theme') != mode )
Common.localStorage.setItem('content-theme', mode);
Common.NotificationCenter.trigger('contenttheme:dark', set_dark);
}
},
toggleContentTheme: function () {
var is_current_dark = this.isContentThemeDark();
is_current_dark ? Common.localStorage.setItem('content-theme', 'light') : Common.localStorage.setItem('content-theme', 'dark');
if ( this.api.asc_setContentDarkMode )
this.api.asc_setContentDarkMode(!is_current_dark);
Common.NotificationCenter.trigger('contenttheme:dark', !is_current_dark);
},
setTheme: function (obj) {
if ( !obj ) return;
var id = get_ui_theme_name(obj),
refresh_only = arguments[1];
if ( !refresh_only && is_theme_type_system(this.currentThemeId()) ) {
// TODO: need refactoring. for bug 58801
if ( get_system_default_theme().id == id ) {
Common.localStorage.setBool('ui-theme-use-system', false);
Common.localStorage.setItem('ui-theme-id', '');
Common.localStorage.setItem('ui-theme-id', id);
Common.NotificationCenter.trigger('uitheme:changed', id);
return;
}
}
if ( is_theme_type_system(id) ) {
if ( get_system_default_theme().id == this.currentThemeId() ) {
Common.localStorage.setBool('ui-theme-use-system', true);
Common.localStorage.setItem('ui-theme-id', '');
Common.localStorage.setItem('ui-theme-id', id);
Common.NotificationCenter.trigger('uitheme:changed', id);
return;
}
Common.localStorage.setBool('ui-theme-use-system', true);
id = get_system_default_theme().id;
} else {
Common.localStorage.setBool('ui-theme-use-system', false);
}
if ( (this.currentThemeId() != id || refresh_only) && !!themes_map[id] ) {
document.body.className = document.body.className.replace(/theme-[\w-]+\s?/gi, '').trim();
document.body.classList.add(id, 'theme-type-' + themes_map[id].type);
if ( this.api ) {
if ( this.api.asc_setContentDarkMode && is_dark_mode_allowed )
if ( themes_map[id].type == 'light' ) {
this.api.asc_setContentDarkMode(false);
} else {
this.api.asc_setContentDarkMode(this.isContentThemeDark());
Common.NotificationCenter.trigger('contenttheme:dark', this.isContentThemeDark());
}
var obj = get_current_theme_colors(name_colors);
obj.type = themes_map[id].type;
obj.name = id;
this.api.asc_setSkin(obj);
}
if ( !(Common.Utils.isIE10 || Common.Utils.isIE11) ) {
var theme_obj = {
id: id,
type: obj.type,
text: themes_map[id].text,
};
if ( themes_map[id].source != 'static' ) {
theme_obj.colors = obj;
}
if ( !refresh_only )
Common.localStorage.setItem('ui-theme', JSON.stringify(theme_obj));
}
if ( !refresh_only )
Common.localStorage.setItem('ui-theme-id', id);
Common.NotificationCenter.trigger('uitheme:changed', id);
}
},
toggleTheme: function () {
this.setTheme( this.isDarkTheme() ? id_default_light_theme : id_default_dark_theme );
}
}
})(Common.UI.Themes);
});

View file

@ -29,15 +29,13 @@
',': 188, '.': 190, '/': 191, ',': 188, '.': 190, '/': 191,
'`': 192, '-': 189, '=': 187, '`': 192, '-': 189, '=': 187,
';': 186, '\'': 222, ';': 186, '\'': 222,
'[': 219, ']': 221, '\\': 220, '[': 219, ']': 221, '\\': 220
'ff-': 173, 'ff=': 61
}, },
code = function(x){ code = function(x){
return _MAP[x] || x.toUpperCase().charCodeAt(0); return _MAP[x] || x.toUpperCase().charCodeAt(0);
}, },
_downKeys = []; _downKeys = [];
var locked, var locked;
propagate;
for(k=1;k<20;k++) _MAP['f'+k] = 111+k; for(k=1;k<20;k++) _MAP['f'+k] = 111+k;
@ -72,14 +70,6 @@
var key, handler, k, i, modifiersMatch, scope; var key, handler, k, i, modifiersMatch, scope;
key = event.keyCode; key = event.keyCode;
if (Common.UI.HintManager && Common.UI.HintManager.isHintVisible()) {
if (key === 112) {
Common.UI.HintManager.clearHints();
} else if (key !== 27) {
return;
}
}
if (index(_downKeys, key) == -1) { if (index(_downKeys, key) == -1) {
_downKeys.push(key); _downKeys.push(key);
} }
@ -117,8 +107,6 @@
// call the handler and stop the event if neccessary // call the handler and stop the event if neccessary
if((handler.mods.length == 0 && !_mods[16] && !_mods[18] && !_mods[17] && !_mods[91]) || modifiersMatch){ if((handler.mods.length == 0 && !_mods[16] && !_mods[18] && !_mods[17] && !_mods[91]) || modifiersMatch){
if(locked===true || handler.locked || handler.method(event, handler)===false){ if(locked===true || handler.locked || handler.method(event, handler)===false){
if (locked===true && propagate || handler.locked && handler.propagate)
continue;
if(event.preventDefault) event.preventDefault(); if(event.preventDefault) event.preventDefault();
else event.returnValue = false; else event.returnValue = false;
if(event.stopPropagation) event.stopPropagation(); if(event.stopPropagation) event.stopPropagation();
@ -191,8 +179,8 @@
if (keys.length > 1) { if (keys.length > 1) {
mods = getMods(keys); mods = getMods(keys);
key = keys[keys.length - 1];
} }
(keys.length > 0) && (key = keys[keys.length - 1]);
key = code(key); key = code(key);
@ -304,8 +292,8 @@
if (keys.length > 1) { if (keys.length > 1) {
mods = getMods(keys); mods = getMods(keys);
key = keys[keys.length - 1];
} }
(keys.length > 0) && (key = keys[keys.length - 1]);
key = code(key); key = code(key);
@ -323,23 +311,12 @@
} }
} }
function suspend(key, scope, pass) { function suspend(key, scope) {
if (key) { key ? setKeyOptions(key, scope, 'locked', true) : (locked = true);
setKeyOptions(key, scope, 'locked', true)
pass && setKeyOptions(key, scope, 'propagate', true)
} else {
locked = true;
pass && (propagate = true);
}
} }
function resume(key, scope) { function resume(key, scope) {
if (key) { key ? setKeyOptions(key, scope, 'locked', false) : (locked = false);
setKeyOptions(key, scope, 'locked', false)
setKeyOptions(key, scope, 'propagate', false)
} else {
locked = propagate = false;
}
} }
// set window.key and window.key.set/get/deleteScope, and the default filter // set window.key and window.key.set/get/deleteScope, and the default filter

View file

@ -56,12 +56,6 @@ function onDropDownKeyDown(e) {
e.stopPropagation(); e.stopPropagation();
} }
} }
} else if ($this.hasClass('move-focus')) {
if (!((/^(13|9|32)/.test(e.keyCode) || e.keyCode===27 && !$parent.hasClass('open')) && !e.ctrlKey && !e.altKey)) {
patchDropDownKeyDown.call(this, e);
e.preventDefault();
e.stopPropagation();
}
} else { } else {
patchDropDownKeyDown.call(this, e); patchDropDownKeyDown.call(this, e);
e.preventDefault(); e.preventDefault();
@ -71,17 +65,6 @@ function onDropDownKeyDown(e) {
$parent.trigger(afterEvent); $parent.trigger(afterEvent);
} }
function checkFocusedItem(cmp, item) {
var innerHeight = cmp.innerHeight(),
padding = (innerHeight - cmp.height())/2,
pos = item.position().top,
itemHeight = item.outerHeight();
if (pos<0)
cmp.scrollTop(cmp.scrollTop() + pos - padding);
else if (pos+itemHeight>innerHeight)
cmp.scrollTop(cmp.scrollTop() + pos + itemHeight - innerHeight + padding);
}
function patchDropDownKeyDown(e) { function patchDropDownKeyDown(e) {
if (!/(38|40|27|37|39)/.test(e.keyCode)) return; if (!/(38|40|27|37|39)/.test(e.keyCode)) return;
@ -128,9 +111,8 @@ function patchDropDownKeyDown(e) {
var mnu = $('> [role=menu]', li), var mnu = $('> [role=menu]', li),
$subitems = mnu.find('> li:not(.divider):not(.disabled):visible > a'), $subitems = mnu.find('> li:not(.divider):not(.disabled):visible > a'),
$dataviews = mnu.find('> li:not(.divider):not(.disabled):visible .dataview'), $dataviews = mnu.find('> li:not(.divider):not(.disabled):visible .dataview'),
$palette = mnu.find('> li:not(.divider):not(.disabled):visible .theme-colorpalette.focused'),
$internal_menu = mnu.find('> li:not(.divider):not(.disabled):visible ul.internal-menu'); $internal_menu = mnu.find('> li:not(.divider):not(.disabled):visible ul.internal-menu');
if ($subitems.length>0 && $dataviews.length<1 && $internal_menu.length<1 && $palette.length<1) if ($subitems.length>0 && $dataviews.length<1 && $internal_menu.length<1)
($subitems.index($subitems.filter(':focus'))<0) && $subitems.eq(0).focus(); ($subitems.index($subitems.filter(':focus'))<0) && $subitems.eq(0).focus();
}, 250); }, 250);
} }
@ -146,8 +128,6 @@ function patchDropDownKeyDown(e) {
if ($parent.hasClass('dropdown-submenu') && $parent.hasClass('over')) if ($parent.hasClass('dropdown-submenu') && $parent.hasClass('over'))
$parent.addClass('focused-submenu'); // for Safari. When focus go from parent menuItem to it's submenu don't hide this submenu $parent.addClass('focused-submenu'); // for Safari. When focus go from parent menuItem to it's submenu don't hide this submenu
checkFocusedItem($this, $items.eq(index));
$items.eq(index).focus(); $items.eq(index).focus();
} }
} }
@ -225,15 +205,10 @@ function clearMenus(isFromInputControl) {
}) })
} }
function toggle() {
$('.dropdown-backdrop').remove();
}
$(document) $(document)
.off('keydown.bs.dropdown.data-api') .off('keydown.bs.dropdown.data-api')
.on('keydown.bs.dropdown.data-api', '[data-toggle=dropdown], [role=menu]' , onDropDownKeyDown); .on('keydown.bs.dropdown.data-api', '[data-toggle=dropdown], [role=menu]' , onDropDownKeyDown);
('ontouchstart' in document.documentElement) && $(document).on('click.bs.dropdown.data-api', '[data-toggle=dropdown]', toggle);
/* /*
* workaround closing menu by right click * workaround closing menu by right click
* */ * */

View file

@ -56,8 +56,6 @@ define([
guid : '', guid : '',
userid : 0, userid : 0,
username : 'Guest', username : 'Guest',
parsedName : 'Guest',
parsedGroups : undefined,
usercolor : null, usercolor : null,
date : undefined, date : undefined,
quote : '', quote : '',
@ -66,8 +64,6 @@ define([
lock : false, lock : false,
lockuserid : '', lockuserid : '',
unattached : false, unattached : false,
userdata : '',
position : -1,
id : Common.UI.getId(), // internal id : Common.UI.getId(), // internal
time : 0, time : 0,
@ -80,11 +76,9 @@ define([
hideAddReply : false, hideAddReply : false,
scope : null, scope : null,
hide : false, hide : false,
filtered : false,
hint : false, hint : false,
dummy : undefined, dummy : undefined,
editable : true, editable : true
removable : true
} }
}); });
Common.Models.Reply = Backbone.Model.extend({ Common.Models.Reply = Backbone.Model.extend({
@ -92,19 +86,15 @@ define([
time : 0, // acs time : 0, // acs
userid : 0, userid : 0,
username : 'Guest', username : 'Guest',
parsedName : 'Guest',
usercolor : null, usercolor : null,
reply : '', reply : '',
date : undefined, date : undefined,
userdata : '',
id : Common.UI.getId(), // internal id : Common.UI.getId(), // internal
editText : false, editText : false,
editTextInPopover : false, editTextInPopover : false,
scope : null, scope : null,
editable : true, editable : true
removable : true,
hide : false
} }
}); });
}); });

View file

@ -74,8 +74,7 @@ define([
isVisible: true, isVisible: true,
allowSelected: true, allowSelected: true,
selected: false, selected: false,
serverVersion: 0, serverVersion: 0
fileType: 'docx'
} }
} }
}); });

View file

@ -61,7 +61,7 @@ define([
EditorsSupport: ["word", "cell", "slide"], EditorsSupport: ["word", "cell", "slide"],
isVisual: false, isVisual: false,
isCustomWindow: false, isCustomWindow: false,
isModal: true, isModal: false,
isInsideMode: false, isInsideMode: false,
initDataType: 0, initDataType: 0,
initData: "", initData: "",

View file

@ -62,8 +62,7 @@ define([
color : '#fff', color : '#fff',
colorval : null, colorval : null,
online : false, online : false,
view : false, view : false
hidden : false
} }
} }
}); });

View file

@ -155,8 +155,8 @@
else else
$scrollbarYRail.css({top: $this.scrollTop(), right: scrollbarYRight - $this.scrollLeft(), height: scrollbarYRailHeight, display: scrollbarYActive ? "inherit": "none"}); $scrollbarYRail.css({top: $this.scrollTop(), right: scrollbarYRight - $this.scrollLeft(), height: scrollbarYRailHeight, display: scrollbarYActive ? "inherit": "none"});
$scrollbarX && $scrollbarX.css({left: scrollbarXLeft, width: scrollbarXWidth}); $scrollbarX.css({left: scrollbarXLeft, width: scrollbarXWidth});
$scrollbarY && $scrollbarY.css({top: scrollbarYTop, height: scrollbarYHeight}); $scrollbarY.css({top: scrollbarYTop, height: scrollbarYHeight});
}; };
var updateBarSizeAndPosition = function () { var updateBarSizeAndPosition = function () {
@ -210,7 +210,6 @@
currentPageX; currentPageX;
$scrollbarX.bind('mousedown' + eventClassName, function (e) { $scrollbarX.bind('mousedown' + eventClassName, function (e) {
Common.NotificationCenter.trigger('hints:clear');
currentPageX = e.pageX; currentPageX = e.pageX;
currentLeft = $scrollbarX.position().left; currentLeft = $scrollbarX.position().left;
$scrollbarXRail.addClass('in-scrolling'); $scrollbarXRail.addClass('in-scrolling');
@ -241,7 +240,6 @@
currentPageY; currentPageY;
$scrollbarY.bind('mousedown' + eventClassName, function (e) { $scrollbarY.bind('mousedown' + eventClassName, function (e) {
Common.NotificationCenter.trigger('hints:clear');
currentPageY = e.pageY; currentPageY = e.pageY;
currentTop = $scrollbarY.position().top; currentTop = $scrollbarY.position().top;
$scrollbarYRail.addClass('in-scrolling'); $scrollbarYRail.addClass('in-scrolling');
@ -318,7 +316,6 @@
var shouldPrevent = false; var shouldPrevent = false;
$this.bind('mousewheel' + eventClassName, function (e, deprecatedDelta, deprecatedDeltaX, deprecatedDeltaY) { $this.bind('mousewheel' + eventClassName, function (e, deprecatedDelta, deprecatedDeltaX, deprecatedDeltaY) {
Common.NotificationCenter.trigger('hints:clear');
var deltaX = e.deltaX * e.deltaFactor || deprecatedDeltaX, var deltaX = e.deltaX * e.deltaFactor || deprecatedDeltaX,
deltaY = e.deltaY * e.deltaFactor || deprecatedDeltaY; deltaY = e.deltaY * e.deltaFactor || deprecatedDeltaY;

View file

@ -1,109 +0,0 @@
<div id="id-autocorrect-dialog-settings-math" class="settings-panel active">
<div class="inner-content">
<table cols="1" style="width: 100%;">
<tr>
<td style="padding-bottom: 8px;">
<div id="auto-correct-chb-replace-type"></div>
</td>
</tr>
<tr>
<td>
<label style="width: 117px;"><%= scope.textReplace %>:</label>
<label><%= scope.textBy %>:</label>
</td>
</tr>
<tr>
<td>
<div id="auto-correct-replace" style="height:22px;width: 115px;margin-right: 2px;display: inline-block;"></div>
<div id="auto-correct-by" style="height:22px;width: 234px;display: inline-block;"></div>
</td>
</tr>
<tr>
<td style="padding-bottom: 8px;">
<div id="auto-correct-math-list" class="" style="width:100%; height: 208px;"></div>
</td>
</tr>
<tr>
<td style="padding-bottom: 8px;">
<button type="button" class="btn btn-text-default auto" id="auto-correct-btn-reset" style="min-width: 80px;"><%= scope.textResetAll %></button>
<button type="button" class="btn btn-text-default auto" id="auto-correct-btn-delete" style="min-width: 80px;float: right;"><%= scope.textDelete %></button>
<button type="button" class="btn btn-text-default auto" id="auto-correct-btn-edit" style="min-width: 80px;float: right;margin-right:5px;"><%= scope.textAdd %></button>
</td>
</tr>
</table>
</div>
</div>
<div id="id-autocorrect-dialog-settings-recognized" class="settings-panel">
<div class="inner-content">
<table cols="1" style="width: 100%;">
<tr>
<td style="padding-bottom: 8px;">
<label><%= scope.textRecognizedDesc %></label>
</td>
</tr>
<tr>
<td>
<div id="auto-correct-rec-find" style="height:22px;width: 100%;margin-bottom: 4px;"></div>
</td>
</tr>
<tr>
<td style="padding-bottom: 8px;">
<div id="auto-correct-recognized-list" class="" style="width:100%; height: 208px;"></div>
</td>
</tr>
<tr>
<td style="padding-bottom: 8px;">
<button type="button" class="btn btn-text-default auto" id="auto-correct-btn-rec-reset" style="min-width: 86px;"><%= scope.textResetAll %></button>
<button type="button" class="btn btn-text-default auto" id="auto-correct-btn-rec-delete" style="min-width: 86px;float: right;"><%= scope.textDelete %></button>
<button type="button" class="btn btn-text-default auto" id="auto-correct-btn-rec-edit" style="min-width: 86px;float: right;margin-right:5px;"><%= scope.textAdd %></button>
</td>
</tr>
</table>
</div>
</div>
<div id="id-autocorrect-dialog-settings-de-autoformat" class="settings-panel">
<div class="inner-content" style="width: 100%;">
<div class="padding-small">
<label class="header"><%= scope.textReplaceText %></label>
</div>
<div class="padding-small">
<div class="padding-small" id="id-autocorrect-dialog-chk-quotes"></div>
<div class="padding-small" id="id-autocorrect-dialog-chk-hyphens"></div>
<div class="padding-small" id="id-autocorrect-dialog-chk-hyperlink"></div>
<div class="padding-small" id="id-autocorrect-dialog-chk-double-space"></div>
</div>
<div class="padding-small">
<label class="header"><%= scope.textApplyText %></label>
</div>
<div class="padding-small">
<div class="padding-small" id="id-autocorrect-dialog-chk-bulleted"></div>
<div class="padding-small" id="id-autocorrect-dialog-chk-numbered"></div>
</div>
</div>
</div>
<div id="id-autocorrect-dialog-settings-sse-autoformat" class="settings-panel">
<div class="inner-content" style="width: 100%;">
<div class="padding-small">
<label class="header"><%= scope.textReplaceText %></label>
</div>
<div class="padding-small">
<div class="padding-small" id="id-autocorrect-dialog-chk-hyperlink"></div>
</div>
<div class="padding-small">
<label class="header"><%= scope.textApplyAsWork %></label>
</div>
<div class="padding-small">
<div class="padding-small" id="id-autocorrect-dialog-chk-new-rows"></div>
</div>
</div>
</div>
<div id="id-autocorrect-dialog-settings-autocorrect" class="settings-panel">
<div class="inner-content" style="width: 100%;">
<div class="padding-small">
<div id="id-autocorrect-dialog-chk-fl-sentence"></div>
</div>
<div class="padding-small">
<div id="id-autocorrect-dialog-chk-fl-cells"></div>
</div>
</div>
</div>

View file

@ -7,8 +7,8 @@
</div> </div>
<div id="chat-options" class="layout-item"> <div id="chat-options" class="layout-item">
<div id="chat-options-ct"> <div id="chat-options-ct">
<textarea id="chat-msg-text" class="user-select textarea-control" maxlength="<%=maxMsgLength%>" data-hint="1" data-hint-direction="left-top"></textarea> <textarea id="chat-msg-text" class="user-select" maxlength="<%=maxMsgLength%>"></textarea>
<button id="chat-msg-btn-add" class="btn normal dlg-btn primary" data-hint="1" data-hint-direction="bottom" data-hint-offset="big"><%=scope.textSend%></button> <button id="chat-msg-btn-add" class="btn normal dlg-btn primary"><%=scope.textSend%></button>
</div> </div>
</div> </div>
</div> </div>

View file

@ -1,20 +1,20 @@
<% if (!hide && !filtered) { %> <% if (!hide) { %>
<div id="<%= id %>" class="user-comment-item"> <div id="<%= id %>" class="user-comment-item">
<!-- comment block --> <!-- comment block -->
<div class="user-name"> <div class="user-name">
<div class="color" style="display: inline-block; background-color: <% if (usercolor!==null) { %><%=usercolor%><% } else { %> #cfcfcf <% } %>; " ></div><%= scope.getEncodedName(parsedName) %> <div class="color" style="display: inline-block; background-color: <% if (usercolor!==null) { %><%=usercolor%><% } else { %> #cfcfcf <% } %>; " ></div><%= scope.getUserName(username) %>
</div> </div>
<div class="user-date"><%=date%></div> <div class="user-date"><%=date%></div>
<% if (quote!==null && quote!=='') { %> <% if (quote!==null && quote!=='') { %>
<div class="user-quote"><%=scope.getFixedQuote(quote)%></div> <div class="user-quote"><%=scope.getFixedQuote(quote)%></div>
<% } %> <% } %>
<% if (!editText || scope.viewmode) { %> <% if (!editText || scope.viewmode) { %>
<div oo_editor_input="true" tabindex="-1" class="user-message user-select"><%=scope.pickLink(comment)%></div> <div class="user-message" data-can-copy="true"><%=scope.pickLink(comment)%></div>
<% } else { %> <% } else { %>
<div class="inner-edit-ct"> <div class="inner-edit-ct">
<textarea class="msg-reply user-select textarea-control" maxlength="maxCommLength"><%=comment%></textarea> <textarea class="msg-reply user-select" maxlength="maxCommLength"><%=comment%></textarea>
<button class="btn normal dlg-btn primary btn-inner-edit" id="id-comments-change">textEdit</button> <button class="btn normal dlg-btn primary btn-inner-edit" id="id-comments-change">textEdit</button>
<button class="btn normal dlg-btn btn-inner-close">textCancel</button> <button class="btn normal dlg-btn btn-inner-close">textCancel</button>
</div> </div>
@ -22,46 +22,39 @@
<!-- replys elements --> <!-- replys elements -->
<% var add_arrow = true; %>
<% if (replys.length) { %> <% if (replys.length) { %>
<% _.each(replys, function (item, index) { %>
<% if (!item.get("hide")) { %>
<% if (add_arrow) { add_arrow = false; %>
<div class="reply-arrow img-commonctrl"></div> <div class="reply-arrow img-commonctrl"></div>
<% } %> <% _.each(replys, function (item, index) { %>
<div class="reply-item-ct" <% if (scope.viewmode && index==replys.length-1) { %>style="padding-bottom: 0;" <% } %>;> <div class="reply-item-ct" <% if (scope.viewmode && index==replys.length-1) { %>style="padding-bottom: 0;" <% } %>;>
<div class="user-name"> <div class="user-name">
<div class="color" style="display: inline-block; background-color: <% if (item.get("usercolor")!==null) { %><%=item.get("usercolor")%><% } else { %> #cfcfcf <% } %>; " ></div><%= scope.getEncodedName(item.get("parsedName")) %> <div class="color" style="display: inline-block; background-color: <% if (item.get("usercolor")!==null) { %><%=item.get("usercolor")%><% } else { %> #cfcfcf <% } %>; " ></div><%= scope.getUserName(item.get("username")) %>
</div> </div>
<div class="user-date"><%=item.get("date")%></div> <div class="user-date"><%=item.get("date")%></div>
<% if (!item.get("editText")) { %> <% if (!item.get("editText")) { %>
<div oo_editor_input="true" tabindex="-1" class="user-message user-select"><%=scope.pickLink(item.get("reply"))%></div> <div class="user-message" data-can-copy="true"><%=scope.pickLink(item.get("reply"))%></div>
<% if (!scope.viewmode) { %> <% if (!scope.viewmode) { %>
<div class="btns-reply-ct"> <div class="btns-reply-ct">
<% if (item.get("editable")) { %> <% if (item.get("editable")) { %>
<div class="btn-edit img-commonctrl" data-value="<%=item.get("id")%>"></div> <div class="btn-edit img-commonctrl" data-value="<%=item.get("id")%>"></div>
<% } %>
<% if (item.get("removable")) { %>
<div class="btn-delete img-commonctrl" data-value="<%=item.get("id")%>"></div> <div class="btn-delete img-commonctrl" data-value="<%=item.get("id")%>"></div>
<% } %> <% } %>
</div> </div>
<%}%> <%}%>
<% } else { %> <% } else { %>
<div class="inner-edit-ct"> <div class="inner-edit-ct">
<textarea class="msg-reply textarea-fix user-select textarea-control" maxlength="maxCommLength"><%=item.get("reply")%></textarea> <textarea class="msg-reply textarea-fix user-select" maxlength="maxCommLength"><%=item.get("reply")%></textarea>
<button class="btn normal dlg-btn primary btn-inner-edit btn-fix" id="id-comments-change">textEdit</button> <button class="btn normal dlg-btn primary btn-inner-edit btn-fix" id="id-comments-change">textEdit</button>
<button class="btn normal dlg-btn btn-inner-close">textClose</button> <button class="btn normal dlg-btn btn-inner-close">textClose</button>
</div> </div>
<% } %> <% } %>
</div> </div>
<% } %>
<% }); %> <% }); %>
<% } %> <% } %>
<!-- add reply button --> <!-- add reply button -->
<% if (!showReply && !scope.viewmode) { %> <% if (!showReply && !scope.viewmode) { %>
<% if (replys.length && !add_arrow) { %> <% if (replys.length) { %>
<label class="user-reply" style="margin-left: 20px; margin-top: 5px;" role="presentation" tabindex="-1">textAddReply</label> <label class="user-reply" style="margin-left: 20px; margin-top: 5px;" role="presentation" tabindex="-1">textAddReply</label>
<% } else { %> <% } else { %>
<label class="user-reply" role="presentation" tabindex="-1">textAddReply</label> <label class="user-reply" role="presentation" tabindex="-1">textAddReply</label>
@ -70,20 +63,16 @@
<!-- edit buttons --> <!-- edit buttons -->
<% if (!editText && !lock) { %> <% if (!editText && !lock && !scope.viewmode) { %>
<div class="edit-ct"> <div class="edit-ct">
<% if (!scope.viewmode) { %>
<% if (editable) { %> <% if (editable) { %>
<div class="btn-edit img-commonctrl"></div> <div class="btn-edit img-commonctrl"></div>
<% } %>
<% if (removable) { %>
<div class="btn-delete img-commonctrl"></div> <div class="btn-delete img-commonctrl"></div>
<% } %> <% } %>
<% } %> <% if (resolved) { %>
<% if (editable && !scope.viewmode) { %> <div class="btn-resolve-check img-commonctrl" data-toggle="tooltip"></div>
<div class="btn-resolve <% if (resolved) print('comment-resolved') %>" data-toggle="tooltip"></div> <% } else { %>
<% } else if ((!editable || scope.viewmode) && resolved) { %> <div class="btn-resolve img-commonctrl" data-toggle="tooltip"></div>
<div class="icon-resolve i-comment-resolved" data-toggle="tooltip"></div>
<% } %> <% } %>
</div> </div>
<% } %> <% } %>
@ -92,7 +81,7 @@
<% if (showReply) { %> <% if (showReply) { %>
<div class="reply-ct"> <div class="reply-ct">
<textarea class="msg-reply user-select textarea-control" placeholder="textAddReply" maxlength="maxCommLength"></textarea> <textarea class="msg-reply user-select" placeholder="textAddReply" maxlength="maxCommLength"></textarea>
<button class="btn normal dlg-btn primary btn-reply" id="id-comments-change">textReply</button> <button class="btn normal dlg-btn primary btn-reply" id="id-comments-change">textReply</button>
<button class="btn normal dlg-btn btn-close">textClose</button> <button class="btn normal dlg-btn btn-close">textClose</button>
</div> </div>

View file

@ -1,18 +1,13 @@
<div id="comments-box" class="layout-ct vbox"> <div id="comments-box" class="layout-ct vbox">
<div class="layout-item messages-ct"></div> <div class="layout-item messages-ct"/>
<div class="layout-item add-link-ct"> <div class="layout-item add-link-ct">
<label id="add-comment-doc" class="btn new" data-hint="1" data-hint-direction="bottom" data-hint-offset="medium"><%=textAddCommentToDoc%></label> <label class="btn new"><%=textAddCommentToDoc%></label>
</div> </div>
<div style="display: none;" class="layout-item new-comment-ct"> <div style="display: none;" class="layout-item new-comment-ct">
<div class="inner-ct"> <div class="inner-ct">
<textarea id="comment-msg-new" class="user-select textarea-control" placeholder="<%=textEnterCommentHint%>" maxlength="<%=maxCommLength%>" data-hint="1" data-hint-direction="left-top"></textarea> <textarea id="comment-msg-new" class="user-select" placeholder="<%=textEnterCommentHint%>" maxlength="<%=maxCommLength%>"/>
</div> </div>
<button class="btn add normal dlg-btn primary" data-hint="1" data-hint-direction="bottom" data-hint-offset="big" style="width: auto;min-width: 86px;"><%=textAddComment%></button> <button class="btn add normal dlg-btn primary"><%=textAddComment%></button>
<button class="btn cancel normal dlg-btn" data-hint="1" data-hint-direction="bottom" data-hint-offset="big" style="width: auto;min-width: 86px;"><%=textCancel%></button> <button class="btn cancel normal dlg-btn"><%=textCancel%></button>
</div>
<div id="comments-header" class="">
<label><%=textComments%></label>
<div id="comments-btn-close" style="float:right;margin-left: 4px;"></div>
<div id="comments-btn-sort" style="float:right;"></div>
</div> </div>
</div> </div>

View file

@ -1,13 +1,12 @@
<% if (!hide) { %>
<div id="<%=id%>" class="user-comment-item"> <div id="<%=id%>" class="user-comment-item">
<!-- comment block --> <!-- comment block -->
<div class="user-name"> <div class="user-name">
<div class="color" style="display: inline-block; background-color: <% if (usercolor!==null) { %><%=usercolor%><% } else { %> #cfcfcf <% } %>; " ></div><%= scope.getEncodedName(parsedName) %> <div class="color" style="display: inline-block; background-color: <% if (usercolor!==null) { %><%=usercolor%><% } else { %> #cfcfcf <% } %>; " ></div><%= scope.getUserName(username) %>
</div> </div>
<div class="user-date"><%=date%></div> <div class="user-date"><%=date%></div>
<% if (!editTextInPopover || hint || scope.viewmode) { %> <% if (!editTextInPopover || hint) { %>
<div oo_editor_input="true" tabindex="-1" class="user-message user-select"><%=scope.pickLink(comment)%></div> <div oo_editor_input="true" tabindex="-1" class="user-message user-select"><%=scope.pickLink(comment)%></div>
<% } else { %> <% } else { %>
<div class="inner-edit-ct"> <div class="inner-edit-ct">
@ -23,26 +22,20 @@
<!-- replys elements --> <!-- replys elements -->
<% var add_arrow = true; %>
<% if (replys.length) { %> <% if (replys.length) { %>
<% _.each(replys, function (item) { %>
<% if (!item.get("hide")) { %>
<% if (add_arrow) { add_arrow = false; %>
<div class="reply-arrow img-commonctrl"></div> <div class="reply-arrow img-commonctrl"></div>
<% } %> <% _.each(replys, function (item) { %>
<div class="reply-item-ct"> <div class="reply-item-ct">
<div class="user-name"> <div class="user-name">
<div class="color" style="display: inline-block; background-color: <% if (item.get("usercolor")!==null) { %><%=item.get("usercolor")%><% } else { %> #cfcfcf <% } %>; " ></div><%= scope.getEncodedName(item.get("parsedName")) %> <div class="color" style="display: inline-block; background-color: <% if (item.get("usercolor")!==null) { %><%=item.get("usercolor")%><% } else { %> #cfcfcf <% } %>; " ></div><%= scope.getUserName(item.get("username")) %>
</div> </div>
<div class="user-date"><%=item.get("date")%></div> <div class="user-date"><%=item.get("date")%></div>
<% if (!item.get("editTextInPopover")) { %> <% if (!item.get("editTextInPopover")) { %>
<div oo_editor_input="true" tabindex="-1" class="user-message user-select"><%=scope.pickLink(item.get("reply"))%></div> <div oo_editor_input="true" tabindex="-1" class="user-message user-select"><%=scope.pickLink(item.get("reply"))%></div>
<% if (!hint && !scope.viewmode) { %> <% if (!hint) { %>
<div class="btns-reply-ct"> <div class="btns-reply-ct">
<% if (item.get("editable")) { %> <% if (item.get("editable")) { %>
<div class="btn-edit img-commonctrl" data-value="<%=item.get("id")%>"></div> <div class="btn-edit img-commonctrl" data-value="<%=item.get("id")%>"></div>
<%}%>
<% if (item.get("removable")) { %>
<div class="btn-delete img-commonctrl" data-value="<%=item.get("id")%>"></div> <div class="btn-delete img-commonctrl" data-value="<%=item.get("id")%>"></div>
<%}%> <%}%>
</div> </div>
@ -55,14 +48,14 @@
</div> </div>
<% } %> <% } %>
</div> </div>
<% } %>
<% }); %> <% }); %>
<% } %> <% } %>
<!-- add reply button --> <!-- add reply button -->
<% if (!showReplyInPopover && !hideAddReply && !hint && !scope.viewmode) { %> <% if (!showReplyInPopover && !hideAddReply && !hint) { %>
<% if (replys.length && !add_arrow) { %> <% if (replys.length) { %>
<label class="user-reply" style="margin-left: 20px; margin-top: 5px;" role="presentation" tabindex="-1">textAddReply</label> <label class="user-reply" style="margin-left: 20px; margin-top: 5px;" role="presentation" tabindex="-1">textAddReply</label>
<% } else { %> <% } else { %>
<label class="user-reply" role="presentation" tabindex="-1">textAddReply</label> <label class="user-reply" role="presentation" tabindex="-1">textAddReply</label>
@ -71,20 +64,16 @@
<!-- edit buttons --> <!-- edit buttons -->
<% if (!editTextInPopover && !lock) { %> <% if (!editTextInPopover && !lock && !hint) { %>
<div class="edit-ct"> <div class="edit-ct">
<% if (!hint && !scope.viewmode) { %>
<% if (editable) { %> <% if (editable) { %>
<div class="btn-edit img-commonctrl"></div> <div class="btn-edit img-commonctrl"></div>
<% } %>
<% if (removable) { %>
<div class="btn-delete img-commonctrl"></div> <div class="btn-delete img-commonctrl"></div>
<% } %> <% } %>
<% } %> <% if (resolved) { %>
<% if (editable && !hint && !scope.viewmode) { %> <div class="btn-resolve-check img-commonctrl" data-toggle="tooltip"></div>
<div class="btn-resolve <% if (resolved) print('comment-resolved') %>" data-toggle="tooltip"></div> <% } else { %>
<% } else if (!hint && (!editable || scope.viewmode) && resolved) { %> <div class="btn-resolve img-commonctrl" data-toggle="tooltip"></div>
<div class="icon-resolve i-comment-resolved" data-toggle="tooltip"></div>
<% } %> <% } %>
</div> </div>
<% } %> <% } %>
@ -107,4 +96,3 @@
<% } %> <% } %>
</div> </div>
<% } %>

View file

@ -13,9 +13,9 @@
<% if (editable) { %> <% if (editable) { %>
<div class="btn-delete img-commonctrl"></div> <div class="btn-delete img-commonctrl"></div>
<% } %> <% } %>
<% } else if (editable) { %> <% } else { %>
<div class="btn-accept"></div> <div class="btn-accept img-commonctrl"></div>
<div class="btn-reject tool "></div> <div class="btn-reject img-commonctrl"></div>
<% } %> <% } %>
<% } %> <% } %>
</div> </div>

View file

@ -1,63 +0,0 @@
<div id="search-box" class="layout-ct vbox search-panel">
<div id="search-header">
<label id="search-adv-title"></label>
<div id="search-btn-close"></div>
</div>
<div id="search-adv-settings">
<table cols="1">
<tbody>
<tr>
<td class="padding-small"><div id="search-adv-text"></div></td>
</tr>
<tr class="edit-setting">
<td class="padding-large"><div id="search-adv-replace-text"></div></td>
</tr>
<tr>
<td class="padding-large">
<label id="search-adv-results-number" style="display: inline-block;">
<%= scope.textSearchResults %>
</label>
<div class="search-nav-btns">
<div id="search-adv-back"></div>
<div id="search-adv-next"></div>
</div>
</td>
</tr>
<tr class="edit-setting">
<td class="padding-large">
<button type="button" class="btn btn-text-default" id="search-adv-replace" data-hint="1" data-hint-direction="bottom" data-hint-offset="big"><%= scope.textReplace %></button>
<button type="button" class="btn btn-text-default" id="search-adv-replace-all" data-hint="1" data-hint-direction="bottom" data-hint-offset="big"><%= scope.textReplaceAll %></button>
</td>
</tr>
<tr class="search-options-block">
<td class="padding-large">
<div id="open-search-options" data-hint="1" data-hint-direction="left" data-hint-offset="0, -15">
<div class="search-options-caret img-commonctrl"></div>
<div class="search-options-txt"><%= scope.textSearchOptions %></div>
</div>
<div id="search-options">
<label class="input-label"><%= scope.textWithin %></label>
<div id="search-adv-cmb-within"></div>
<div id="search-adv-select-range"></div>
<label class="input-label"><%= scope.textSearch %></label>
<div id="search-adv-cmb-search"></div>
<label class="input-label"><%= scope.textLookIn %></label>
<div id="search-adv-cmb-look-in"></div>
</div>
</td>
</tr>
<tr>
<td class="padding-small"><div id="search-adv-case-sensitive"></div></td>
</tr>
<!---<tr>
<td class="padding-small"><div id="search-adv-use-regexp"></div></td>
</tr>-->
<tr>
<td class="padding-large"><div id="search-adv-match-word"></div></td>
</tr>
</tbody>
</table>
</div>
<div id="search-results" class="ps-container oo">
</div>
</div>

View file

@ -38,11 +38,10 @@
* *
*/ */
if ( window.Common === undefined ) { if (Common === undefined) {
window.Common = {}; var Common = {};
} }
// TODO: move to Common.Utils
Common.util = Common.util||{}; Common.util = Common.util||{};
Common.util.LanguageInfo = new(function() { Common.util.LanguageInfo = new(function() {
@ -364,8 +363,6 @@ Common.util.LanguageInfo = new(function() {
0x380A : ["es-UY", "Español (Uruguay)", "Spanish (Uruguay)"], 0x380A : ["es-UY", "Español (Uruguay)", "Spanish (Uruguay)"],
0x200A : ["es-VE", "Español (Republica Bolivariana de Venezuela)", "Spanish (Venezuela)"], 0x200A : ["es-VE", "Español (Republica Bolivariana de Venezuela)", "Spanish (Venezuela)"],
0x040a : ["es-ES_tradnl", "Spanish"], 0x040a : ["es-ES_tradnl", "Spanish"],
0x580a : ["es-419", "Español (América Latina y el Caribe)", "Spanish (Latin America and the Caribbean)"],
0x5C0a : ["es-CU", "Español (Cuba)", "Spanish (Cuba)"],
0x001D : ["sv", "Svenska"], 0x001D : ["sv", "Svenska"],
0x081D : ["sv-FI", "Svenska (Finland)", "Swedish (Finland)"], 0x081D : ["sv-FI", "Svenska (Finland)", "Swedish (Finland)"],
0x041D : ["sv-SE", "Svenska (Sverige)", "Swedish (Sweden)"], 0x041D : ["sv-SE", "Svenska (Sverige)", "Swedish (Sweden)"],

View file

@ -52,13 +52,13 @@ define(['gateway'], function () {
Common.Gateway.on('internalcommand', ongetstore); Common.Gateway.on('internalcommand', ongetstore);
var _refresh = function() { var _refresh = function() {
// if (!_lsAllowed) if (!_lsAllowed)
// Common.Gateway.internalMessage('localstorage', {cmd:'get', keys:_filter}); Common.Gateway.internalMessage('localstorage', {cmd:'get', keys:_filter});
}; };
var _save = function() { var _save = function() {
// if (!_lsAllowed) if (!_lsAllowed)
// Common.Gateway.internalMessage('localstorage', {cmd:'set', keys:_store}); Common.Gateway.internalMessage('localstorage', {cmd:'set', keys:_store});
}; };
var _setItem = function(name, value, just) { var _setItem = function(name, value, just) {
@ -72,15 +72,14 @@ define(['gateway'], function () {
} else { } else {
_store[name] = value; _store[name] = value;
// if (just===true) { if (just===true) {
// TDDO: remove after ver 7.2. using external local storage is depricated Common.Gateway.internalMessage('localstorage', {
// Common.Gateway.internalMessage('localstorage', { cmd:'set',
// cmd:'set', keys: {
// keys: { name: value
// name: value }
// } });
// }); }
// }
} }
}; };
@ -99,19 +98,12 @@ define(['gateway'], function () {
var value = _getItem(name); var value = _getItem(name);
defValue = defValue || false; defValue = defValue || false;
return (value!==null) ? (parseInt(value) != 0) : defValue; return (value!==null) ? (parseInt(value) != 0) : defValue;
}; }
var _getItemExists = function (name) { var _getItemExists = function (name) {
var value = _getItem(name); var value = _getItem(name);
return value !== null; return value !== null;
}; }
var _removeItem = function(name) {
if (_lsAllowed)
localStorage.removeItem(name);
else
delete _store[name];
};
try { try {
var _lsAllowed = !!window.localStorage; var _lsAllowed = !!window.localStorage;
@ -130,7 +122,6 @@ define(['gateway'], function () {
getBool: _getItemAsBool, getBool: _getItemAsBool,
setBool: _setItemAsBool, setBool: _setItemAsBool,
setItem: _setItem, setItem: _setItem,
removeItem: _removeItem,
setKeysFilter: function(value) { setKeysFilter: function(value) {
_filter = value; _filter = value;
}, },

View file

@ -99,11 +99,11 @@ Common.util = Common.util||{};
'modal:show': function(e){ 'modal:show': function(e){
window.key.suspend(); window.key.suspend();
}, },
'modal:close': function(e, last) { 'modal:close': function(e) {
last && window.key.resume(); window.key.resume();
}, },
'modal:hide': function(e, last) { 'modal:hide': function(e) {
last && window.key.resume(); window.key.resume();
} }
}); });
}, },
@ -148,8 +148,8 @@ Common.util = Common.util||{};
} }
}, },
suspendEvents: function(key,scope,propagate) { suspendEvents: function(key,scope) {
window.key.suspend(key,scope,propagate); window.key.suspend(key,scope);
}, },
resumeEvents: function(key,scope) { resumeEvents: function(key,scope) {

View file

@ -109,16 +109,13 @@
var me = this; var me = this;
Common.NotificationCenter.on({'layout:changed': function(e){ Common.NotificationCenter.on({'layout:changed': function(e){
if (!me.options.keepvisible && !me.options.hideonclick && me.tip().is(':visible')) if (!me.options.hideonclick && me.tip().is(':visible'))
me.hide(); me.hide();
}}); }});
this.isDesktopApp = Common.Controllers.Desktop.isActive();
}, },
mousemove: function (e) { mousemove: function (e) {
var x = e.clientX*Common.Utils.zoom(), this.targetXY = [e.clientX*Common.Utils.zoom(), e.clientY*Common.Utils.zoom()];
y = e.clientY*Common.Utils.zoom();
this.targetXY = [x, this.isDesktopApp ? Math.max(y, 14) : y];
}, },
leave: function(obj) { leave: function(obj) {

Some files were not shown because too many files have changed in this diff Show more