sbis3-node-ws
Version:
Модуль позволяет использовать ядро интерфейсного фреймворка sbis3-ws(`core.js`) и модуль работы с данными (`Source.js`) в приложении на nodejs.
997 lines (946 loc) • 728 kB
JavaScript
/**
* WI.SBIS 3.0.15
*/
/* jshint ignore:start */
var toS = Object.prototype.toString;
if(typeof(window) == 'undefined') {
window = undefined;
}
if(typeof(document) == 'undefined') {
document = undefined;
}
if(typeof(navigator) == 'undefined') {
navigator = undefined;
}
var isPlainArray = (function () {
var arrayTag = '[object Array]';
return function (arr) {
return !!(arr && typeof(arr) === 'object' && toS.call(arr) === arrayTag &&
Object.getPrototypeOf(arr) === Array.prototype);
};
})();
var nop = function(dummy){}, retTrue = function() { return true }, skip = function(p){ return p; };
/**
* Если инструмент для сбора статистики отсутствует, заменяем его на пустышку
*/
if (typeof(window) == 'undefined' || window.BOOMR === undefined){
var
dummyBlock= {closeSyncBlock: nop, openSyncBlock: nop, close: nop, stop: nop},
dummySpan = { stop: nop };
BOOMR = {
page_ready : nop,
plugins : {
WS : {
prepareEnvironment: nop,
startSpan : function(dummy) { return dummySpan; },
reportError : nop,
reportMessage : nop,
reportEvent: nop,
logUserActivity: nop,
startBlock: function(n){ return dummyBlock; }
}
},
version : false
};
}
/* jshint ignore:end *//* jshint ignore:end */
/*
* Инициализация объекта для компонентов ядра
*/
(function(){
var global = (function(){ return this || (0,eval)('this'); }());
global.SBIS3 = {};
global.SBIS3.CORE = {};
}());
$ws = (function(){
var cssTransformProperty = document && (function() {
var element = document.createElement('div');
return element.style.transform !== undefined && 'transform' || //new browsers
element.style.msTransform !== undefined && 'msTransform' || //ie
element.style.oTransform !== undefined && 'oTransform' || //Opera
element.style.MozTransform !== undefined && 'MozTransform' || //Firefox
element.style.webkitTransform !== undefined && 'webkitTransform'; //Chrome
})();
function IEVersion() {
var ua = (navigator && navigator.userAgent.toString().toLowerCase()) || '',
match = /(msie)\s+([\w.]+)/.exec(ua) ||
/(trident)(?:.*rv:([\w.]+))?/.exec(ua) ||
/(edge)\/([\w]+)/.exec(ua),
rv = match && parseInt(match[2], 10);
return rv;
}
function IOSVersion() {
var match = navigator && navigator.userAgent.match(/\bCPU\s+(i?)OS\s+(\d+)/);
return match && parseInt(match[2], 10);
}
var now = +new Date(), timeShift2014 = +new Date(2014, 9, 26),
userAgent = (navigator && navigator.userAgent) || '',
isIOSMobilePlatform = !!(/(iPod|iPhone|iPad)/.test(userAgent)),
/**
* На таблетках нет Mobile в UA
* @link https://developer.chrome.com/multidevice/user-agent
*/
isAndroidMobilePlatform = !!(/Android/.test(userAgent) && /AppleWebKit/.test(userAgent)),
isMacOSPlatform = !!(/\bMac\s+OS\s+X\b/.test(userAgent)),
isChromeIOS = !!(isIOSMobilePlatform && userAgent.match(/\bCriOS\b/)),
isChromeDesktop = !!(window && window['chrome']) || isChromeIOS,
isMobilePlatform = isIOSMobilePlatform || isAndroidMobilePlatform,
ieVersion = IEVersion();
return {
/**
* Неймспейс для всех констант
* @namespace
*/
_const: {
JSONRPC_PROOTOCOL_VERSION: 4,
fasttemplate: true,
nostyle: false,
moscowTimeOffset: now >= timeShift2014 ? 3*60 : 4*60, // UTC+04:00 ... 26/10/2014 UTC+03:00
javaStartTimeout: 15000,
styleLoadTimeout: 4000, // Поднял до 4 секунд, так как на медленном соединении не успевало отработать
IDENTITY_SPLITTER: ',',
userConfigSupport: false,
globalConfigSupport: true,
theme: '',
appRoot: '/',
resourceRoot: '/resources/',
wsRoot: '/ws/',
defaultServiceUrl: '/service/sbis-rpc-service300.dll',
debug: window && window.location.hash.indexOf('dbg') > 0,
saveLastState: true,
checkSessionCookie: true,
i18n:false,
/***
* Флаг показывает, что код исполняется на клиентской стороне, на браузере
*/
isBrowserPlatform: typeof window !== 'undefined',
/***
* Флаг показывает, что код исполняется на серверной стороне, на nodejs
*/
isNodePlatform: typeof process !== 'undefined',
/**
* Константы с поддержкой тех или иных фич
* @namespace
*/
compatibility: {
dateBug: (new Date(2014, 0, 1, 0, 0, 0, 0).getHours() !== 0),
/**
* Поддержка placeholder'а на элементах input
*/
placeholder: document && !!('placeholder' in document.createElement('input')),
/**
* Поддержка загрузки файлов с использованием стандартного инпута (её может не быть, если, к примеру, у пользователя iPad)
*/
fileupload: document && (function() { var i = document.createElement('input'); i.setAttribute('type', 'file'); return !i.disabled }()),
/**
* У старых версий оперы немного другая обработка клавиатурных нажатий. В ней эта константа будет равна false
*/
correctKeyEvents: window && (!window.opera || parseFloat(window.opera.version()) >= 12.1),
/**
* Поддержка css3-анимаций
*/
cssAnimations: document && (function(){
var style = document.createElement('div').style;
return style.transition !== undefined || //Opera, IE 10+, Firefox 16+, Chrome 26+, Safari ?
style.mozTransition !== undefined || //Firefox 4-15 (?)
style.webkitTransition !== undefined; //Chrome ?-25, Safari ? - ?
})(),
/**
* Поддержка <b>requestFullscreen</b> и подобных на элементе (позволяет показывать в полноэкранном режиме только некоторые элементы)
*/
fullScreen: document && (function(){
var element = document.createElement('div');
return element.requestFullscreen !== undefined || //Opera
element.mozRequestFullScreen !== undefined || //Firefox
element.webkitRequestFullscreen !== undefined; //Chrome
})(),
/**
* Поддержка события прокрутки колеса мыши. Есть 3 основных варианта:
* 1) 'wheel'. DOM3 событие, поддержка есть пока только в ие 9+ и файерфоксе (17+)
* 2) 'mousewheel'. Старое, популярное событие. Имеет большие проблемы из-за разных значений в различных браузерах и даже ос. Аналог в файерфоксе - MozMousePixelScroll или DOMMouseWheel.
* 3) 'DOMMouseWheel'. Для файерфокса версии 0.9.7+
*/
wheel: document && (function(){
var element = document.createElement('div');
return (element.onwheel !== undefined || document.documentMode >= 9) ? 'wheel' : // Firefox 17+, IE 9+
element.onmousewheel !== undefined ? 'mousewheel' : // Chrome, Opera, IE 8-
'DOMMouseScroll'; // older Firefox
})(),
cssTransformProperty: cssTransformProperty,
/**
* Поддержка css-трансформаций. Появились в Chrome (изначально), Firefox (3.5), Internet Explorer (9), Opera (10.5), Safari (3.1)
*/
cssTransform: !!cssTransformProperty,
/**
* Есть ли поддержка прикосновений (touch) у браузера
*/
touch: document && (navigator.msMaxTouchPoints || 'ontouchstart' in document.documentElement),
/**
* Определение поддержки стандартной работы со стилями
*/
standartStylesheetProperty: document && (function(){
var style = document.createElement('style');
style.setAttribute('type', 'text/css');
return !style.styleSheet;
})()
},
/**
* Константы, которые можно использовать для проверки браузера
* @namespace
*/
browser: {
/**
* Мобильный сафари - iPhone, iPod, iPad
*/
isMobileSafari: isIOSMobilePlatform && !isChromeIOS &&
/AppleWebKit/.test(userAgent) && /Mobile\//.test(userAgent),
/**
* Мобильные версии браузеров на андроиде
*/
isMobileAndroid: isAndroidMobilePlatform,
/**
* Мобильные версии браузеров на IOS
*/
isMobileIOS: isIOSMobilePlatform,
/**
* Мобильные версии браузеров
*/
isMobilePlatform: isMobilePlatform,
/**
* internet explorer
*/
isIE: !!ieVersion,
/**
* internet explorer 7
*/
isIE7: ieVersion === 7,
/**
* internet explorer 8
*/
isIE8: ieVersion === 8,
/**
* internet explorer 9
*/
isIE9: ieVersion === 9,
/**
* internet explorer 10
*/
isIE10: ieVersion === 10,
/**
* internet explorer 11
*/
isIE11: ieVersion === 11,
/**
* internet explorer 12 (EDGE)
*/
isIE12: ieVersion === 12,
IEVersion: IEVersion(),
IOSVersion: IOSVersion(),
/**
* internet explorer 9+
*/
isModernIE: ieVersion > 8,
/**
* Firefox
*/
firefox: userAgent.indexOf('Firefox') > -1,
/**
* Chrome
*/
chrome: isChromeDesktop || isChromeIOS,
/**
* Mac OS
*/
isMacOSDesktop: isMacOSPlatform && !isIOSMobilePlatform,
/**
* Mac OS
*/
isMacOSMobile: isMacOSPlatform && isIOSMobilePlatform,
opera: /(opera)/i.test(userAgent),
operaChrome: /OPR/.test(userAgent),
webkit: /(webkit)/i.test(userAgent)
},
buildnumber:"", // jshint ignore:line
resizeDelay: 40,
/**
* Пакеты XML-файлов
* Формат:
* ИмяШаблона: ФайлПакета, ...
*/
xmlPackages: {},
/**
* Пакеты JS-файлов
* Формат:
* ОригинальноеИмяФайла: ИмяФайлаПакета, ...
*/
jsPackages:{},
/**
* Оглавление. Сопоставление коротких имен полным путям
* Формат:
* ИмяШаблона: ФайлШаблона, ...
*/
xmlContents: {},
/**
* Альтернативные имена входного файла
*/
htmlNames : {},
/**
* Декларативная привязка обработчиков на ресурс
* Формат:
* ИмяШаблона: [ ФайлОбработчиков, ФайлОбработчиков, ... ], ...
*/
hdlBindings: {},
/**
* Хосты, с которых запрашиваются файлы
* Формат:
* Хост1, Хост2, Хост3, ...
*/
hosts : [],
services: {},
modules: {},
jsCoreModules: {
'SBIS3.CORE.AttributeCfgParser' : 'lib/Control/AttributeCfgParser/AttributeCfgParser.module.js',
'SBIS3.CORE.bignumWrapper' : 'ext/bignumWrapper.js',
'SBIS3.CORE.Marker' : 'lib/Marker/Marker.module.js',
'SBIS3.CORE.NavigationController' : 'lib/NavigationController/NavigationController.module.js',
'SBIS3.CORE.Control' : 'lib/Control/Control.module.js',
'SBIS3.CORE.SelectMergeRecordDialog': 'res/wsmodules/SelectMergeRecordDialog/SelectMergeRecordDialog.module.js',
'SBIS3.CORE.ConfirmRecordActionsDialog': 'res/wsmodules/ConfirmRecordActionsDialog/ConfirmRecordActionsDialog.module.js',
'SBIS3.CORE.ReplaceRecordDialog': 'res/wsmodules/ReplaceRecordDialog/ReplaceRecordDialog.module.js',
'SBIS3.CORE.SuggestShowAllDialog': 'res/wsmodules/SuggestShowAllDialog/SuggestShowAllDialog.module.js',
'SBIS3.CORE.SumDialog': 'res/wsmodules/SumDialog/SumDialog.module.js',
'SBIS3.CORE.ErrorsReportDialog': 'res/wsmodules/ErrorsReportDialog/ErrorsReportDialog.module.js',
'SBIS3.CORE.ValidateCountDialog': 'res/wsmodules/ValidateCountDialog/ValidateCountDialog.module.js',
'SBIS3.CORE.ColorizeDialog': 'res/wsmodules/ColorizeDialog/ColorizeDialog.module.js',
'SBIS3.CORE.SelectColumnsDialog': 'res/wsmodules/SelectColumnsDialog/SelectColumnsDialog.module.js',
'SBIS3.CORE.FileButton': 'lib/Control/FileButton/FileButton.module.js',
'SBIS3.CORE.FileBrowse': 'lib/Control/FileBrowse/FileBrowse.module.js',
'SBIS3.CORE.FileScaner': 'lib/Control/FileScaner/FileScaner.module.js',
'SBIS3.CORE.FileScanLoader': 'lib/Control/FileScanLoader/FileScanLoader.module.js',
'SBIS3.CORE.PrintDialog': 'lib/Control/PrintDialog/PrintDialog.module.js',
"SBIS3.CORE.SelectScannerDialog": "lib/Control/FileScanLoader/resources/SelectScannerDialog/SelectScannerDialog.module.js",
'SBIS3.CORE.FileLoader': 'lib/Control/FileLoader/FileLoader.module.js',
'SBIS3.CORE.FileStorageLoader': 'lib/Control/FileStorageLoader/FileStorageLoader.module.js',
'SBIS3.CORE.FileLoaderAbstract': 'lib/Control/FileLoaderAbstract/FileLoaderAbstract.module.js',
'SBIS3.CORE.FileCam': 'lib/Control/FileCam/FileCam.module.js',
'SBIS3.CORE.FileCamLoader': 'lib/Control/FileCamLoader/FileCamLoader.module.js',
'SBIS3.CORE.CameraWindow': 'lib/Control/FileCamLoader/resources/CameraWindow/CameraWindow.module.js',
'SBIS3.CORE.FileClipboard': 'lib/Control/FileClipboard/FileClipboard.module.js',
'SBIS3.CORE.FileClipboardLoader': 'lib/Control/FileClipboardLoader/FileClipboardLoader.module.js',
'SBIS3.CORE.Button': 'lib/Control/Button/Button.module.js',
'SBIS3.CORE.Infobox': 'lib/Control/Infobox/Infobox.module.js',
'SBIS3.CORE.InfoboxTrigger': 'lib/Control/InfoboxTrigger/InfoboxTrigger.module.js',
'SBIS3.CORE.LoadingIndicator': 'lib/Control/LoadingIndicator/LoadingIndicator.module.js',
'SBIS3.CORE.Paging': 'lib/Control/Paging/Paging.module.js',
'SBIS3.CORE.PathSelector': 'lib/Control/PathSelector/PathSelector.module.js',
'SBIS3.CORE.PathFilter': 'lib/Control/PathFilter/PathFilter.module.js',
'SBIS3.CORE.HierarchyView': 'lib/Control/HierarchyView/HierarchyView.module.js',
'SBIS3.CORE.HierarchyCustomView': 'lib/Control/HierarchyCustomView/HierarchyCustomView.module.js',
'SBIS3.CORE.TreeView': 'lib/Control/TreeView/TreeView.module.js',
'SBIS3.CORE.HierarchyViewAbstract': 'lib/Control/HierarchyViewAbstract/HierarchyViewAbstract.module.js',
'SBIS3.CORE.CustomView': 'lib/Control/CustomView/CustomView.module.js',
'SBIS3.CORE.TableView': 'lib/Control/TableView/TableView.module.js',
'SBIS3.CORE.DataViewAbstract': 'lib/Control/DataViewAbstract/DataViewAbstract.module.js',
'SBIS3.CORE.Suggest': 'lib/Control/Suggest/Suggest.module.js',
'SBIS3.CORE.SwitcherAbstract': 'lib/Control/SwitcherAbstract/SwitcherAbstract.module.js',
'SBIS3.CORE.Switcher': 'lib/Control/Switcher/Switcher.module.js',
'SBIS3.CORE.SwitcherDouble': 'lib/Control/SwitcherDouble/SwitcherDouble.module.js',
'SBIS3.CORE.FieldDropdown': 'lib/Control/FieldDropdown/FieldDropdown.module.js',
'SBIS3.CORE.FieldLabel': 'lib/Control/FieldLabel/FieldLabel.module.js',
'SBIS3.CORE.FieldFormatAbstract': 'lib/Control/FieldFormatAbstract/FieldFormatAbstract.module.js',
'SBIS3.CORE.FieldMask': 'lib/Control/FieldMask/FieldMask.module.js',
'SBIS3.CORE.FieldMonth': 'lib/Control/FieldMonth/FieldMonth.module.js',
'SBIS3.CORE.FieldAbstract': 'lib/Control/FieldAbstract/FieldAbstract.module.js',
'SBIS3.CORE.FieldString': 'lib/Control/FieldString/FieldString.module.js',
'SBIS3.CORE.FieldEditAtPlace': 'lib/Control/FieldEditAtPlace/FieldEditAtPlace.module.js',
'SBIS3.CORE.SearchString': 'lib/Control/SearchString/SearchString.module.js',
'SBIS3.CORE.PageFilter': 'lib/Control/PageFilter/PageFilter.module.js',
'SBIS3.CORE.FieldText': 'lib/Control/FieldText/FieldText.module.js',
'SBIS3.CORE.FieldRichEditor': 'lib/Control/FieldRichEditor/FieldRichEditor.module.js',
'SBIS3.CORE.FieldTinyEditor': 'lib/Control/FieldTinyEditor/FieldTinyEditor.module.js',
'SBIS3.CORE.FieldRichEditor.ImagePropertiesDialog': 'lib/Control/FieldRichEditor/resources/ImagePropertiesDialog/ImagePropertiesDialog.module.js',
'SBIS3.CORE.FieldRichEditor.FieldRichEditorMenuButton': 'lib/Control/FieldRichEditor/resources/FieldRichEditorMenuButton/FieldRichEditorMenuButton.module.js',
'SBIS3.CORE.FieldRichEditor.FieldRichEditorDropdown': 'lib/Control/FieldRichEditor/resources/FieldRichEditorDropdown/FieldRichEditorDropdown.module.js',
'SBIS3.CORE.Menu': 'lib/Control/Menu/Menu.module.js',
'SBIS3.CORE.FieldDate': 'lib/Control/FieldDate/FieldDate.module.js',
'SBIS3.CORE.FieldDatePicker': 'lib/Control/FieldDatePicker/FieldDatePicker.module.js',
'SBIS3.CORE.FilterController': 'lib/Control/FilterController/FilterController.module.js',
'SBIS3.CORE.FiltersArea': 'lib/Control/FiltersArea/FiltersArea.module.js',
'SBIS3.CORE.FiltersDialog': 'lib/Control/FiltersDialog/FiltersDialog.module.js',
'SBIS3.CORE.FiltersWindow': 'lib/Control/FiltersWindow/FiltersWindow.module.js',
'SBIS3.CORE.FilterView': 'lib/Control/FilterView/FilterView.module.js',
'SBIS3.CORE.FloatArea': 'lib/Control/FloatArea/FloatArea.module.js',
'SBIS3.CORE.RecordFloatArea': 'lib/Control/RecordFloatArea/RecordFloatArea.module.js',
'SBIS3.CORE.FilterFloatArea': 'lib/Control/FilterFloatArea/FilterFloatArea.module.js',
'SBIS3.CORE.FilterButtonArea' : 'lib/Control/FilterButton/FilterButtonArea/FilterButtonArea.module.js',
'SBIS3.CORE.FilterButtonHistory' : 'lib/Control/FilterButton/FilterButtonHistory/FilterButtonHistory.module.js',
'SBIS3.CORE.FilterButton' : 'lib/Control/FilterButton/FilterButton.module.js',
'SBIS3.CORE.Master' : 'lib/Control/Master/Master.module.js',
/*'SBIS3.CORE.SchemeEditor' : 'lib/Control/SchemeEditor/SchemeEditor.module.js',*/
'SBIS3.CORE.TabTemplatedArea' : 'lib/Control/TabTemplatedArea/TabTemplatedArea.module.js',
'SBIS3.CORE.Tabs' : 'lib/Control/Tabs/Tabs.module.js',
'SBIS3.CORE.Grid' : 'lib/Control/Grid/Grid.module.js',
'SBIS3.CORE.RelativeGrid' : 'lib/Control/RelativeGrid/RelativeGrid.module.js',
'SBIS3.CORE.GridLayout' : 'lib/Control/GridLayout/GridLayout.module.js',
'SBIS3.CORE.StackPanel' : 'lib/Control/StackPanel/StackPanel.module.js',
'SBIS3.CORE.Table' : 'lib/Control/Table/Table.module.js',
'SBIS3.CORE.Accordion' : 'lib/Control/Accordion/Accordion.module.js',
'SBIS3.CORE.NavigationPanel' : 'lib/Control/NavigationPanel/NavigationPanel.module.js',
'SBIS3.CORE.ToolBar' : 'lib/Control/ToolBar/ToolBar.module.js',
'SBIS3.CORE.FieldImage' : 'lib/Control/FieldImage/FieldImage.module.js',
'SBIS3.CORE.ImageGallery' : 'lib/Control/ImageGallery/ImageGallery.module.js',
'SBIS3.CORE.FieldLink' : 'lib/Control/FieldLink/FieldLink.module.js',
'SBIS3.CORE.FieldNumeric' : 'lib/Control/FieldNumeric/FieldNumeric.module.js',
'SBIS3.CORE.FieldInteger' : 'lib/Control/FieldInteger/FieldInteger.module.js',
'SBIS3.CORE.FieldMoney' : 'lib/Control/FieldMoney/FieldMoney.module.js',
'SBIS3.CORE.FieldRadio' : 'lib/Control/FieldRadio/FieldRadio.module.js',
'SBIS3.CORE.ProgressBar' : 'lib/Control/ProgressBar/ProgressBar.module.js',
'SBIS3.CORE.HTMLChunk' : 'lib/Control/HTMLChunk/HTMLChunk.module.js',
'SBIS3.CORE.MasterProgress' : 'lib/Control/MasterProgress/MasterProgress.module.js',
'SBIS3.CORE.GroupCheckBox' : 'lib/Control/GroupCheckBox/GroupCheckBox.module.js',
'SBIS3.CORE.OperationsPanel' : 'lib/Control/OperationsPanel/OperationsPanel.module.js',
'SBIS3.CORE.OperationsPanelND' : 'lib/Control/OperationsPanelND/OperationsPanelND.module.js',
'SBIS3.CORE.HTMLView' : 'lib/Control/HTMLView/HTMLView.module.js',
'SBIS3.CORE.DateRange' : 'lib/Control/DateRange/DateRange.module.js',
'SBIS3.CORE.DateRangeChoose' : 'lib/Control/DateRangeChoose/DateRangeChoose.module.js',
'SBIS3.CORE.FieldCheckbox' : 'lib/Control/FieldCheckbox/FieldCheckbox.module.js',
'SBIS3.CORE.RecordArea' : 'lib/Control/RecordArea/RecordArea.module.js',
'SBIS3.CORE.GridAbstract' : 'lib/Control/GridAbstract/GridAbstract.module.js',
'SBIS3.CORE.Dialog' : 'lib/Control/Dialog/Dialog.module.js',
'SBIS3.CORE.DialogAlert' : 'lib/Control/DialogAlert/DialogAlert.module.js',
'SBIS3.CORE.DialogConfirm' : 'lib/Control/DialogConfirm/DialogConfirm.module.js',
'SBIS3.CORE.DialogRecord' : 'lib/Control/DialogRecord/DialogRecord.module.js',
'SBIS3.CORE.Selector' : 'lib/Control/DialogSelector/Selector.module.js',
'SBIS3.CORE.DialogSelector' : 'lib/Control/DialogSelector/DialogSelector.module.js',
'SBIS3.CORE.FloatAreaSelector' : 'lib/Control/DialogSelector/FloatAreaSelector.module.js',
'SBIS3.CORE.SimpleDialogAbstract' : 'lib/Control/SimpleDialogAbstract/SimpleDialogAbstract.module.js',
'SBIS3.CORE.Window' : 'lib/Control/Window/Window.module.js',
'SBIS3.CORE.ModalOverlay' : 'lib/Control/ModalOverlay/ModalOverlay.module.js',
'SBIS3.CORE.TemplatedArea' : 'lib/Control/TemplatedArea/TemplatedArea.module.js',
'SBIS3.CORE.TemplatedAreaAbstract' : 'lib/Control/TemplatedAreaAbstract/TemplatedAreaAbstract.module.js',
'SBIS3.CORE.AreaAbstract' : 'lib/Control/AreaAbstract/AreaAbstract.module.js',
'SBIS3.CORE.RaphaelMultiGraph' : 'lib/Control/RaphaelMultiGraph/RaphaelMultiGraph.module.js',
'SBIS3.CORE.RaphaelPieGraph' : 'lib/Control/RaphaelPieGraph/RaphaelPieGraph.module.js',
'SBIS3.CORE.RaphaelChartGraph' : 'lib/Control/RaphaelChartGraph/RaphaelChartGraph.module.js',
'SBIS3.CORE.RaphaelDrawerInternal' : 'lib/Control/RaphaelDrawerInternal/RaphaelDrawerInternal.module.js',
'SBIS3.CORE.DragAndDropPlugin' : 'lib/Control/DragAndDropPlugin/DragAndDropPlugin.module.js',
'SBIS3.CORE.CompoundControl' : 'lib/Control/CompoundControl/CompoundControl.module.js',
'SBIS3.CORE.TabButtons' : 'lib/Control/TabButtons/TabButtons.module.js',
'SBIS3.CORE.CollapsingNavigation' : 'lib/CollapsingNavigation/CollapsingNavigation.module.js',
'SBIS3.CORE.CopyPlugin' : 'lib/Control/DataViewAbstract/plugins/Copy-plugin.js',
'SBIS3.CORE.MarkedRowOptionsPlugin': 'lib/Control/DataViewAbstract/plugins/MarkedRowOptions-plugin.js',
'SBIS3.CORE.MergePlugin' : 'lib/Control/DataViewAbstract/plugins/Merge-plugin.js',
'SBIS3.CORE.PrintPlugin' : 'lib/Control/DataViewAbstract/plugins/Print-plugin.js',
'SBIS3.CORE.ToolbarPlugin' : 'lib/Control/DataViewAbstract/plugins/Toolbar-plugin.js',
'SBIS3.CORE.MovePlugin' : 'lib/Control/DataViewAbstract/plugins/Move-plugin.js',
'SBIS3.CORE.AtPlaceEditPlugin' : 'lib/Control/TableView/plugins/AtPlaceEdit-plugin.js',
'SBIS3.CORE.LadderPlugin' : 'lib/Control/TableView/plugins/Ladder-plugin.js',
'SBIS3.CORE.ResultsPlugin' : 'lib/Control/TableView/plugins/Results-plugin.js',
'SBIS3.CORE.ColorMarkPlugin' : 'lib/Control/TableView/plugins/ColorMark-plugin.js',
'SBIS3.CORE.PartScrollPlugin' : 'lib/Control/TableView/plugins/PartScroll-plugin/PartScroll-plugin.js',
'SBIS3.CORE.ScrollPaging' : 'lib/Control/TableView/plugins/ScrollPaging-plugin.js',
'SBIS3.CORE.RightAccordionPlugin' : 'lib/Control/TableView/plugins/RightAccordion-plugin/RightAccordion-plugin.js',
'SBIS3.CORE.CropPlugin' : 'lib/Control/FieldImage/plugins/FieldImageCrop-plugin.js',
'SBIS3.CORE.ZoomPlugin' : 'lib/Control/FieldImage/plugins/FieldImageZoom-plugin.js',
'SBIS3.CORE.AccordionCollapsePlugin':'lib/Control/Accordion/plugins/Collapse-plugin.js',
'SBIS3.CORE.NavigationPanelCollapsePlugin':'lib/Control/NavigationPanel/plugins/Collapse-plugin.js',
'SBIS3.CORE.RequestHistoryPlugin' : 'lib/Control/FilterButton/plugins/RequestHistory-plugin.js',
'SBIS3.CORE.Label' : 'lib/Control/Label/Label.module.js',
'SBIS3.CORE.ButtonAbstract' : 'lib/Control/ButtonAbstract/ButtonAbstract.module.js',
'SBIS3.CORE.LinkButton' : 'lib/Control/LinkButton/LinkButton.module.js',
'SBIS3.CORE.OutlineButton' : 'lib/Control/OutlineButton/OutlineButton.module.js',
'SBIS3.CORE.PushButton' : 'lib/Control/PushButton/PushButton.module.js',
'SBIS3.CORE.TabControl' : 'lib/Control/TabControl/TabControl.module.js',
'SBIS3.CORE.SwitchableArea' : 'lib/Control/SwitchableArea/SwitchableArea.module.js',
'SBIS3.CORE.FloatAreaManager' : 'lib/FloatAreaManager/FloatAreaManager.module.js',
"SBIS3.CORE.CustomType" : "lib/Type/CustomType.module.js",
"SBIS3.CORE.TDataSource" : "lib/Type/TDataSource/TDataSource.module.js",
"SBIS3.CORE.TReaderParams" : "lib/Type/TReaderParams/TReaderParams.module.js",
"SBIS3.CORE.PluginManager" : "lib/PluginManager/PluginManager.module.js",
"SBIS3.CORE.PluginSetupDialog" : "lib/PluginManager/resources/PluginSetupDialog/PluginSetupDialog.module.js",
'SBIS3.CORE.DataBoundMixin' : 'lib/Mixins/DataBoundMixin.module.js',
'SBIS3.CORE.CompoundActiveFixMixin': 'lib/Mixins/CompoundActiveFixMixin.module.js',
'SBIS3.CORE.ServerEventBus' : 'lib/ServerEventBus/ServerEventBus.module.js',
'SBIS3.CORE.CloseButton' : 'lib/Control/CloseButton/CloseButton.module.js',
'SBIS3.CORE.Cache' : 'lib/Cache/Cache.module.js',
'SBIS3.CORE.CoreValidators' : 'lib/CoreValidators/CoreValidators.module.js',
'SBIS3.CORE.KbLayoutRevert' : 'lib/KbLayoutRevert/KbLayoutRevert.module.js',
'SBIS3.CORE.MarkupTransformer' : 'lib/MarkupTransformer/MarkupTransformer.module.js',
'SBIS3.CORE.TileView' : 'lib/Control/TileView/TileView.module.js',
'SBIS3.CORE.XSLT' : 'lib/xslt.js',
'SBIS3.CORE.ServiceUpdateNotifier' : 'lib/ServiceUpdateNotifier/ServiceUpdateNotifier.module.js'
},
jsModules:{},
/**
* Информация о словарях, чтобы знать какие есть и какие грузить
* Временная мера (все временное постоянно :( )
*/
dictionary:{
'SBIS3.CORE.DialogConfirm.uk-UA.json' : 'ws/lib/Control/DialogConfirm/resources/lang/uk-UA/uk-UA.json',
'SBIS3.CORE.LoadingIndicator.uk-UA.json' : 'ws/lib/Control/LoadingIndicator/resources/lang/uk-UA/uk-UA.json',
'SBIS3.CORE.PathSelector.uk-UA.json' : 'ws/lib/Control/PathSelector/resources/lang/uk-UA/uk-UA.json',
'SBIS3.CORE.Control.uk-UA.json' : 'ws/lib/Control/resources/lang/uk-UA/uk-UA.json',
'SBIS3.CORE.SearchString.uk-UA.json' : 'ws/lib/Control/SearchString/resources/lang/uk-UA/uk-UA.json'
},
classLoaderMappings: {},
/**
* Расстояние, утянув объект на которое, начинается drag&drop
*/
startDragDistance: 4,
availableLanguage: {},
/**
* Классы контролов-окон, которые могут быть родителями других окон и всплывающих панелей.
*/
WINDOW_CLASSES: ['SBIS3.CORE.FloatArea', 'SBIS3.CORE.Window', 'SBIS3.CORE.FieldEditAtPlace']
},
/**
* Хранилище загруженных обработчиков
*/
_handlers: {},
core: {},
helpers: {},
/**
* Хранилище прототипов классов
*/
proto : {},
/**
* Хранилище синглтонов
*/
single : {},
/**
* Хранилище миксинов
*/
mixins : {},
/**
* Рендеры.
* См. {@link $ws.render.defaultColumn}.
* @namespace
*/
render : {
/**
* @namespace
*/
defaultColumn: {
/**
* Отображает число с добавлением нулей слева от него.
* Используется для приведения к виду с заданным количеством знаков.
* @param {Number} val Число.
* @param {Number} l Количество знаков, которое должно получиться.
* @returns {String} Отформатированное число
* @example
* <pre>
* $ws.render.defaultColumn.leadZero(2, 5); // выведет 00002
* </pre>
*/
leadZero : function(val, l){
var s ='' + Math.floor(val);
if (s.length < l) {
s = '00000000000000000000000000000000'.substr(0, l - s.length) + s;
}
return s;
},
/**
* Отображает форматированное целое число.
* Производит отделение разрядов пробелами.
* format: -N NNN, ..., -1, 0, 1, ... N NNN.
* Например, 123456 = 123 456.
* @param {Number} val Целое число.
* @param {Boolean} [noDelimiters = false] Не нужны ли разделители:
* true - не будет производить форматирование по разрядам.
* false или null - разделит разряды пробелами.
* @returns {string} Возвращает отформатированное число.
* @example
* <pre>
* $ws.render.defaultColumn.integer(1111111) // выведет 1 111 111
* </pre>
* <pre>
* $ws.render.defaultColumn.integer(1111111, true) // выведет 1111111
* </pre>
*/
integer : function(val, noDelimiters){
try {
val = String.trim('' + val);
} catch (e) {
val = '';
}
//пример регулярки "-000233.222px"
var numRe = /^-?([0]*)(\d+)\.?\d*\D*$/, f;
if(!val.match(numRe))
return '0';
f = val.replace(numRe, '$2');
return (val.substr(0, 1) == '-' ? '-' : '') + (noDelimiters ? f : String.trim(f.replace(/(?=(\d{3})+$)/g, ' ')));
},
/**
* Спан для boolean, формирует вёрстку: если true - чекбокс с галочкой, иначе пустой.
* @param {Boolean} val Исходное значение.
* @param {Boolean} [returnStr = false] Нужно ли вернуть как строку или же как jQuery(на случай использования в прикладном коде).
* По умолчанию возвращает jQuery-объект.
* @returns {String|jQuery} Cтрока или jQuery-объект.
* @example
* <pre>
* $ws.render.defaultColumn.logic(true,true); // вернёт "<span class="ws-browser-checkbox-logic true"></span>"
* </pre>
*/
logic: function(val, returnStr){
var className;
if (val) {
className = 'ws-browser-checkbox-logic-true';
} else {
className = 'ws-browser-checkbox-logic-false';
}
var str = '<span class="ws-browser-checkbox-logic ' + (className) + '"></span>';
return returnStr ? str : $(str);
},
/**
* Отображает число в формате денежной единицы
* Округляет с точностью до двух знаков после запятой, целую часть разделяет на разряды пробелами.
* Дробная часть округляется математически.
* format: -N NNN.NN, ..., -1.00, -, 1.00, ... N NNN.NN
* @param {Number} val Вещественное число.
* @returns {String} {val} Форматированное вещественное число.
* @example
* <pre>
* $ws.render.defaultColumn.money(12345.678); // выведет "12 345.68"
* </pre>
*/
money : function(val){
return $ws.render.defaultColumn.real(val, 2, true);
},
/**
* Отображает значение в виде отформатированного числа
* @param val Вещественное число.
* @param {Number} integers Количество знаков до запятой.
* @param {Boolean} delimiters Отделить ли разряды пробелами.
* @param {Number} decimals Количество знаков после запятой. Если их нет, то допишет нули.
* @param {Boolean} notNegative Показывать только неотрицательное значения или произвольные
* @param {Number} maxLength Задание максимальной длины текста в поле
* @returns {String} val Отформатированное число.
*/
numeric: function(val, integers, delimiters, decimals, notNegative, maxLength) {
var
// позиция точки
dotPos,
// позиция второй точки
dotSec,
// позиция 0 до точки справа
lastZeroPos,
// присутствует ли минус в значении
hasMinus;
if ((val+'').indexOf('e') !== -1 && !isNaN(parseFloat(val+''))) {
val = val.toFixed(20);
lastZeroPos = val.length;
while (val.charAt(lastZeroPos-1) === '0') {
--lastZeroPos;
}
val = val.substr(0, lastZeroPos);
}
val = ('' + val).replace(notNegative ? /[^0-9\.]/g : /[^0-9\.\-]/g,'');
dotPos = val.indexOf('.');
dotSec = val.indexOf('.',dotPos+1);
hasMinus = /\-/.test(val) ? 1 : 0;
if (dotSec !== -1) {
val = val.substring(0,dotSec);
}
if (dotPos === val.length-1) {
val = val.substr(0,val.length-1);
dotPos = -1;
}
if(!/^\-?[0-9]*(\.[0-9]*)?$/.test(val)) {
val = '';
}
if (val === '' || val === null) { // все нумерик поля кроме денег могут иметь значение null
val = null;
} else {
if (integers >= 0) {
if (dotPos === -1) {
dotPos = val.length;
}
if (integers + hasMinus < dotPos) {
val = val.substring(0, integers + hasMinus) + val.substr(dotPos);
}
dotPos = val.indexOf('.');
}
if (decimals < 0) {
val = dotPos === -1
? $ws.render.defaultColumn.integer(val, !delimiters)
: [
$ws.render.defaultColumn.integer(val.substring(0, dotPos), !delimiters),
val.substr(dotPos)
].join('');
} else {
val = val.substr(0, maxLength && !delimiters ? maxLength : val.length);
val = $ws.render.defaultColumn.real(val, decimals, delimiters);
}
}
return val;
},
/**
* Отображает значение в виде отформатированного вещественного числа
* @param val Вещественное число.
* @param {Number} decimals Количество знаков после запятой. Если их нет, то допишет нули.
* @param {Boolean} delimiters Отделить ли разряды пробелами.
* @returns {String} val Отформатированное вещественное число.
* @example
* <pre>
* $ws.render.defaultColumn.real(2564, 2, true); // выведет "2 564.00"
* </pre>
*/
real : function(val, decimals, delimiters){
decimals = decimals === undefined ? 0 : decimals;
var dotPos = (val = (val + "")).indexOf(".");
var firstPart = val;
if (dotPos != -1)
firstPart = val.substring(0, dotPos);
// Получаем математическое округление дробной части
var
parsedVal = dotPos != -1 ? val.substr(dotPos) : 0,
isNegative = firstPart.indexOf('-') !== -1,
weNeedDecimals;
if(parsedVal == '.')
parsedVal = '.0';
weNeedDecimals = parseFloat(parsedVal).toFixed(decimals);
if (weNeedDecimals == 1) {
firstPart = parseInt(firstPart, 10);
firstPart = isNegative ? firstPart - 1 : firstPart + 1;
}
weNeedDecimals = weNeedDecimals.replace(/.+\./, "");
// Если передано значение без точки или нам нужна только целая часть
if (decimals === 0) {
return $ws.render.defaultColumn.integer(firstPart, !delimiters);
}
var buffer = [];
buffer.push($ws.render.defaultColumn.integer(firstPart, !delimiters));
buffer.push('.');
buffer.push(weNeedDecimals);
return buffer.join('');
},
/**
* Отображает любое число в виде вещественного с 3 знаками после запятой
* Может использоваться для перевода из миллисекунд в секунды и других целей.
* В результате перевода всегда будут 3 знака после запятой - допишутся нули,
* если их окажется меньше, например 20000 = 20,000.
* При делении округляет в меньшую сторону, например, 2,65 = 0,002.
* @param {number} val Вещественное число.
* @returns {String} Возвращает строку.
* @example
* <pre>
* $ws.render.defaultColumn.timer(123456); // выведет 123.456
* </pre>
*/
timer : function(val){
return Math.floor(val / 1000) + "." + $ws.render.defaultColumn.leadZero(val % 1000, 3);
},
/**
* Отображает объект Date строкой вида 'DD.MM.YY HH:MM:SS'
* Например, new Date(2010,8,6,17,44,15) преобразуется в '06.09.10 17:44:15'.
* Месяцы нумеруются с 0 по 11. 0 - январь, 11 - декабрь.
* @param {} date объект
* @param {String} [type] Возможны три вида: "Дата", "Время", "Дата и время".
* @param {Boolean} [prec] Отвечает за точность:
* 1. true - время с секундами и миллисекундами
* 2. {precision: sec} - только с секундами
* 3. {precision: msec} - с секундами и миллисекундами
* 4. {precision: min} - только с минутами
* 5. что-то другое - только с секундами
* @returns {String} Возвращает строку.
* @example
* <pre>
* $ws.render.defaultColumn.timestamp(new Date(2013,10,7,9,27,0,1), "Дата и время", true); // выведет "07.11.13 09:27:00.001"
* </pre>
*/
timestamp : function(date, type, prec){
var retval = "",
year, month, day, hours, minutes, seconds, millisec,
precision = (typeof prec == 'object' && 'precision' in prec ? prec.precision : prec);
if(date instanceof Date){
year = date.getFullYear()%100;
month = date.getMonth() + 1;
day = date.getDate();
hours = date.getHours();
minutes = date.getMinutes();
seconds = date.getSeconds();
millisec = date.getMilliseconds();
if(type !== "time" && type !== "Время")
retval = ((day < 10 ? "0" : "") + day) + "." + ((month < 10 ? "0" : "") + month) + "." + ((year < 10 ? "0" : "") + year);
if(type in {"timestamp": 0, "Дата и время": 0, "time": 0, "Время": 0}){
retval += type in {"time": 0, "Время": 0} ? "" : " ";
retval += ((hours < 10 ? "0" : "") + hours) + ":" + ((minutes < 10 ? "0" : "") + minutes);
if(precision === true || precision == 'sec' || precision == 'msec' || precision !== 'min') {
retval += ":" + (seconds < 10 ? "0" : "") + seconds;
}
if(precision === true || precision == 'msec') {
if(millisec > 0) {
if(millisec < 10)
retval += ".00" + millisec;
else {
if(millisec < 100)
retval += ".0" + millisec;
else
retval += "." + millisec;
}
}
else
retval += ".000";
}
}
}
else {
retval = "−";
}
return retval;
},
/**
* Отображение по умолчанию для колонок типа "перечисляемое"
* Отображает текущее значение.
* @param {$ws.proto.Enum} iEnum Набор доступных значений.
* @returns {String} Возвращает строковое значение, соответствующее переданному экземпляру.
* @example
* <pre>
* var myEnum = new $ws.proto.Enum({
* availableValues: {
* "0" : "синий",
* "1" : "красный",
* "2" : "белый"
* }
* });
* myEnum.set("1");
* $ws.render.defaultColumn.enumType(myEnum); // выведет "красный"
* </pre>
*/
enumType: function(iEnum) {
if(iEnum instanceof $ws.proto.Enum){
var value = iEnum.getCurrentValue();
if(value === null){
return '';
}
return iEnum.getValues()[iEnum.getCurrentValue()];
}
return '';
},
/**
* Отображение по умолчанию для колонок типа "флаги"
* @param {$ws.proto.Record} record Запись, флаги передаются именно в таком виде.
* @returns {string} Возвращает строку заголовков активных флагов через запятую.
* <pre>
* var record = new $ws.proto.Record({
* colDef: [{
* "n": "Первое",
* "t": "Логическое"
* },{
* "n": "Второе",
* "t": "Логическое"
* },{
* "n": "Третье",
* "t": "Логическое"
* }],
* row: [true, false, true]
* });
* $ws.render.defaultColumn.flags(record); // выведет "Первое, Третье"
* </pre>
*/
flags: function(record){
var res = [];
record.each(function(title, value){
if(value){
res.push(title);
}
});
if(res.length){
return res.join(', ');
}
return "−";
},
/**
* Проверяет принадлежность типа к строковому
* @param {String} type Тип данных.
* @returns {Boolean} true, если передано строковое значение, иначе false.
* @example
* <pre>
* $ws.render.defaultColumn.isText("xid"); // выведет "false"
* </pre>
*/
isText: function(type){
return type.indexOf('char') !== -1 || type == 'text';
}
}
}
};
})();
/**
* @class
* @name Date
* @public
*/
/**
* приводит объект Date() к виду, необходимому для передачи в SQL
* @param {Boolean|Object} [mode] необходимость выводить время.
* undefined - Сериализуется как Дата.
* true - Сериализуется как Дата и время.
* false - Сериализуется как Время.
* null - выбрать тип автоматически (см. setSQLSerializationMode).
* @returns {String}
*/
Date.prototype.toSQL = function (mode) {
if (mode === Date.SQL_SERIALIZE_MODE_AUTO)
mode = this._serializeMode;
var
year = this.getFullYear(),
month = this.getMonth() + 1,
day = this.getDate(),
hours = this.getHours(),
minutes = this.getMinutes(),
seconds = this.getSeconds(),
milliseconds = this.getMilliseconds(),
offsetNum = this.getTimezoneOffset(),
//offset = ['+', 0, ':', 0],
offset = ['+', 0],
someDig = function (num, dig) { // функция для форматирования чисел с нужным количеством цифр/ведущих нулей
if (dig === undefined || dig < 2) {
dig = 2;
}
var
dec = num % 10;
num -= dec;
num /= 10;
return (dig == 2 ? '' + num : someDig(num, dig - 1)) + dec;
},
data = '';
if (mode !== Date.SQL_SERIALIZE_MODE_TIME)
data = year + '-' + someDig(month) + '-' + someDig(day);
if (mode !== Date.SQL_SERIALIZE_MODE_DATE) {
if (mode === Date.SQL_SERIALIZE_MODE_DATETIME)
data += ' ';
data += someDig(hours) + ':' + someDig(minutes) + ':' + someDig(seconds);
if (milliseconds) // выводим милисекунды, если они заданы
data += '.' + someDig(milliseconds, 3);
if (offsetNum > 0) // добавляем указание часового пояса локали
offset[0] = '-';
else
offsetNum = -offsetNum;
//offset[3] = offsetNum % 60;
offsetNum -= offsetNum % 60;
offset[1] = offsetNum / 60;
offset[1] = someDig(offset[1]);
//offset[3] = someDig(offset[3]);
data += offset.join('');
}
return data;
};
/**
* Метод сравнения дат. Если даты равны, вернёт true, иначе - false
* @param {Date} d Другая дата.
* @return {Boolean}
*/
Date.prototype.equals = function (d) {
var res = false;
if (d instanceof Date)
res = this.getTime() == d.getTime();
return res;
};
Date.SQL_SERIALIZE_MODE_DATE = undefined;
Date.SQL_SERIALIZE_MODE_DATETIME = true;
Date.SQL_SERIALIZE_MODE_TIME = false;
Date.SQL_SERIALIZE_MODE_AUTO = null;
/**
* @param {boolean} mode режим сериализации текущего инстанса даты в SQL-формат по умолчанию
* undefine