This commit is contained in:
2022-05-30 17:50:04 +03:00
parent 2a6f01f460
commit a44faad823
26 changed files with 772 additions and 393 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ kit.PluginManager.register('ActionCollection', function(module, exports, require
/** /**
* @class ActionCollection * @class ActionCollection
* @extends {kit.Collection} * @extends {Collection}
* @memberOf kit * @memberOf kit
*/ */
var ActionCollection = function (list = []) { var ActionCollection = function (list = []) {
+4 -4
View File
@@ -294,16 +294,16 @@ kit.PluginManager.register('align',function(module, exports, require) {
return - this.nodeMetricsLine.offset / 2 + this.offset[this.map.axisNumber()]; return - this.nodeMetricsLine.offset / 2 + this.offset[this.map.axisNumber()];
}.bind(this), }.bind(this),
applicability: function () { applicability: function () {
return this.limiterMetricsLine.end - (this.parentMetricsLine.start + this.nodeMetricsLine.length + this.shift); return this.limiterMetricsLine.end - this.limiterMetricsLine.clientEnd - (this.parentMetricsLine.start + this.nodeMetricsLine.length + this.shift);
}.bind(this), }.bind(this),
valid: function () { valid: function () {
return this.limiterMetricsLine.end >= (this.parentMetricsLine.start + this.nodeMetricsLine.length + this.shift); return this.limiterMetricsLine.end - this.limiterMetricsLine.clientEnd >= (this.parentMetricsLine.start + this.nodeMetricsLine.length + this.shift);
}.bind(this), }.bind(this),
shiftExtra: function () { shiftExtra: function () {
var shift = getShiftWhenHidingNodeUnderLimiterStart(this.shift); var shift = getShiftWhenHidingNodeUnderLimiterStart(this.shift);
var applicability = 0; var applicability = 0;
if(!this.valid) { if(!this.valid) {
applicability = this.limiterMetricsLine.end - (this.parentMetricsLine.start + this.nodeMetricsLine.length + shift); applicability = this.limiterMetricsLine.end - this.limiterMetricsLine.clientEnd - (this.parentMetricsLine.start + this.nodeMetricsLine.length + shift);
shift = getShiftWhenHidingNodeUnderLimiterStart(shift + applicability); shift = getShiftWhenHidingNodeUnderLimiterStart(shift + applicability);
} }
return shift; return shift;
@@ -481,7 +481,7 @@ kit.PluginManager.register('align',function(module, exports, require) {
/** /**
* @param node {HTMLElement|String} * @param node {HTMLElement|String}
* @param parentNode {HTMLElement|String} * @param parentNode {HTMLElement|String}
* @param limiterNode {HTMLElement|String} * @param limiterNode {HTMLElement|String|Window}
* @param options {AlignDefault} * @param options {AlignDefault}
* @constructor * @constructor
*/ */
+1 -2
View File
@@ -64,9 +64,8 @@ kit.PluginManager.register('bsToastService', function(module, exports, require,
this.onShow.eachCall(this, toast, toastNode); this.onShow.eachCall(this, toast, toastNode);
}; };
/** /**
* @memberOf kit.service * @namespace kit.service
* @class toast * @class toast
**/ **/
var toast = new Service(); var toast = new Service();
+17 -17
View File
@@ -13,7 +13,7 @@ kit.PluginManager.register('Collection', function(module, exports, require, glob
} }
/** /**
* @param type * @param type
* @return {kit.Collection} * @return {Collection}
*/ */
function getSimilarInstance(type) { function getSimilarInstance(type) {
if(type === 'object') { if(type === 'object') {
@@ -25,7 +25,7 @@ kit.PluginManager.register('Collection', function(module, exports, require, glob
/** /**
* @class Collection * @class Collection
* @property length * @property length
* @memberOf kit * @memberOf {kit}
*/ */
var Collection = function (data = []) { var Collection = function (data = []) {
var self = this; var self = this;
@@ -114,7 +114,7 @@ kit.PluginManager.register('Collection', function(module, exports, require, glob
/** /**
* @param key * @param key
* @param value * @param value
* @return {kit.Collection} * @return {Collection}
*/ */
Collection.prototype.add = Collection.prototype.set = Collection.prototype.put = function (key, value) { Collection.prototype.add = Collection.prototype.set = Collection.prototype.put = function (key, value) {
var index = -1; var index = -1;
@@ -128,7 +128,7 @@ kit.PluginManager.register('Collection', function(module, exports, require, glob
}; };
/** /**
* @param value * @param value
* @return {kit.Collection} * @return {Collection}
*/ */
Collection.prototype.push = function (value) { Collection.prototype.push = function (value) {
this.set(this.__getLastIndex() + 1, value); this.set(this.__getLastIndex() + 1, value);
@@ -151,7 +151,7 @@ kit.PluginManager.register('Collection', function(module, exports, require, glob
* возвращает новый экземпляр коллекции; не изменяет вызываемую коллекцию * возвращает новый экземпляр коллекции; не изменяет вызываемую коллекцию
* *
* @param callback * @param callback
* @return {kit.Collection} * @return {Collection}
*/ */
Collection.prototype.map = function (callback) { Collection.prototype.map = function (callback) {
var res = getSimilarInstance(this.__type); var res = getSimilarInstance(this.__type);
@@ -165,7 +165,7 @@ kit.PluginManager.register('Collection', function(module, exports, require, glob
}; };
/** /**
* @param callback * @param callback
* @return {kit.Collection} * @return {Collection}
*/ */
Collection.prototype.each = function (callback = true) { Collection.prototype.each = function (callback = true) {
var i; var i;
@@ -179,7 +179,7 @@ kit.PluginManager.register('Collection', function(module, exports, require, glob
}; };
/** /**
* @param callback * @param callback
* @return {kit.Collection} * @return {Collection}
*/ */
Collection.prototype.eachReverse = function (callback = true) { Collection.prototype.eachReverse = function (callback = true) {
var i; var i;
@@ -193,7 +193,7 @@ kit.PluginManager.register('Collection', function(module, exports, require, glob
}; };
/** /**
* @param callback * @param callback
* @return {kit.Collection} * @return {Collection}
*/ */
Collection.prototype.filter = function (callback = filter) { Collection.prototype.filter = function (callback = filter) {
var res = getSimilarInstance(this.__type); var res = getSimilarInstance(this.__type);
@@ -208,7 +208,7 @@ kit.PluginManager.register('Collection', function(module, exports, require, glob
/** /**
* Метод возвращает все элементы коллекции, кроме тех у кого ключи соответствуют заданным * Метод возвращает все элементы коллекции, кроме тех у кого ключи соответствуют заданным
* @param keys * @param keys
* @return {kit.Collection} * @return {Collection}
*/ */
Collection.prototype.except = function (keys) { Collection.prototype.except = function (keys) {
var __keys = [], iKey; var __keys = [], iKey;
@@ -227,7 +227,7 @@ kit.PluginManager.register('Collection', function(module, exports, require, glob
/** /**
* Метод возвращает элементы коллекции с заданными ключами * Метод возвращает элементы коллекции с заданными ключами
* @param keys * @param keys
* @return {kit.Collection} * @return {Collection}
*/ */
Collection.prototype.only = function (keys) { Collection.prototype.only = function (keys) {
var __keys = [], iKey; var __keys = [], iKey;
@@ -294,7 +294,7 @@ kit.PluginManager.register('Collection', function(module, exports, require, glob
/** /**
* Method removes/delete an item from the collection by its key * Method removes/delete an item from the collection by its key
* @param key * @param key
* @return {kit.Collection} * @return {Collection}
*/ */
Collection.prototype.forget = function (key) { Collection.prototype.forget = function (key) {
key = valueEx(key); key = valueEx(key);
@@ -311,7 +311,7 @@ kit.PluginManager.register('Collection', function(module, exports, require, glob
* Method removes and returns an item from the collection by its key * Method removes and returns an item from the collection by its key
* @param key * @param key
* @param defValue * @param defValue
* @return {kit.Collection} * @return {Collection}
*/ */
Collection.prototype.pull = function (key, defValue = undefined) { Collection.prototype.pull = function (key, defValue = undefined) {
key = valueEx(key); key = valueEx(key);
@@ -356,20 +356,20 @@ kit.PluginManager.register('Collection', function(module, exports, require, glob
return value; return value;
}; };
/** /**
* @return {kit.Collection} * @return {Collection}
*/ */
Collection.prototype.keys = function () { Collection.prototype.keys = function () {
return new Collection(Object.keys(this.data)); return new Collection(Object.keys(this.data));
}; };
/** /**
* @return {kit.Collection} * @return {Collection}
*/ */
Collection.prototype.dump = function () { Collection.prototype.dump = function () {
console.log('Collection', this.data); console.log('Collection', this.data);
return this; return this;
}; };
/** /**
* @return {kit.Collection} * @return {Collection}
*/ */
Collection.prototype.dd = function () { Collection.prototype.dd = function () {
this.dump(); this.dump();
@@ -377,7 +377,7 @@ kit.PluginManager.register('Collection', function(module, exports, require, glob
return this; return this;
}; };
/** /**
* @return {kit.Collection} * @return {Collection}
*/ */
Collection.prototype.eachCall = function (context, args1, args2) { Collection.prototype.eachCall = function (context, args1, args2) {
var args = [], i; var args = [], i;
@@ -446,7 +446,7 @@ kit.PluginManager.register('Collection', function(module, exports, require, glob
* Значения в коллекци должны быть массиво подобные * Значения в коллекци должны быть массиво подобные
* *
* @param key * @param key
* @return {kit.Collection} * @return {Collection}
*/ */
Collection.prototype.pluck = function (key) { Collection.prototype.pluck = function (key) {
return this.map(function (value) { return this.map(function (value) {
+9 -4
View File
@@ -1,10 +1,15 @@
/** /**
* @type {kitCore} * @namespace kit
* @module kit
*/ */
window.kit = window.kit || {}; var kit;
kit = window.kit = window.kit || {};
/** /**
* @var kit.config * @typedef kit.service
* @type {kitConfig} */
kit.service = kit.service || {};
/**
* @typedef kit.config
*/ */
kit.config = kit.config || {}; kit.config = kit.config || {};
+5 -6
View File
@@ -1,9 +1,8 @@
/**
* @class kitCore var kit;
* @extends kitCorePlugins kit = window.kit = window.kit || {};
*/ kit.service = kit.service || {};
window.kit = window.kit || {}; kit.config = kit.config || {};
window.kit.service = window.kit.service || {};
(function(global){ (function(global){
var stateList = { var stateList = {
undefined: 0, undefined: 0,
+26 -16
View File
@@ -83,12 +83,28 @@ __PluginManager__.registerPlugins({
type: 'loader', type: 'loader',
css: '/tooltip2.css', css: '/tooltip2.css',
onInstall: function(plugin){ onInstall: function(plugin){
var elements = [].slice.call(document.querySelectorAll('[data-kit-tooltip2="autoload"]')); console.log('tt2 install');
elements.map(function (element) { document.addEventListener('mouseover', function(event) {
var tooltip = new __pmGlobal__.Tooltip2(element); // console.log(event);
// console.log(event.target);
if(!(event.target && event.target.dataset.kitTooltip2 === 'autoload')) {
return;
}
// console.log(1);
if(kit.support.getNodeData(event.target, 'tooltip2')){
return;
}
// console.log(2);
var tooltip = new __pmGlobal__.Tooltip2(event.target);
tooltip.run(); tooltip.run();
console.log(tooltip); tooltip.show();
}); });
// var elements = [].slice.call(document.querySelectorAll('[data-kit-tooltip2="autoload"]'));
// elements.map(function (element) {
// var tooltip = new __pmGlobal__.Tooltip2(element);
// tooltip.run();
// console.log(tooltip);
// });
}, },
deps: ['Viewer', 'support', 'ActionCollection', 'Action', 'userAction', 'align', 'Collection', 'animations'], deps: ['Viewer', 'support', 'ActionCollection', 'Action', 'userAction', 'align', 'Collection', 'animations'],
}, },
@@ -227,20 +243,14 @@ __PluginManager__.registerPlugins({
path: __pmConfig__.assetsPath + '/testing', path: __pmConfig__.assetsPath + '/testing',
module: '/testing.js', module: '/testing.js',
type: 'loader', type: 'loader',
deps: ['loggerService'], deps: ['log'],
}, },
Logger: { log: {
path: __pmConfig__.assetsPath + '/logger', path: __pmConfig__.assetsPath + '/log',
module: '/logger.js', module: '/log.js',
css: '/log.css',
type: 'loader', type: 'loader',
deps: ['support', 'Collection'] deps: ['support', 'Collection', 'lib']
},
loggerService: {
path: __pmConfig__.assetsPath + '/loggerService',
module: '/loggerService.js',
css: '/loggerService.css',
type: 'loader',
deps: ['Logger', 'support', 'Collection'],
}, },
fancybox: { fancybox: {
path: __pmConfig__.assetsPath + '/fancybox', path: __pmConfig__.assetsPath + '/fancybox',
-22
View File
@@ -1,22 +0,0 @@
/**
* @typedef kitModuleTypeLoader
* @param module {{exports: Object}}
* @param exports {Object}
* @param require {kitPluginManagerRequire}
* @param global {kitCore}
*/
/**
* @typedef {Object} kitCorePlugins
* @property {PluginManager} pm
* @property {kitPluginManagerRequire} require
* @property {kitToolkit} toolkit
* @property {kitModal} Modal
* @property {kitConfig} config
* @property {kitPopover} Popover
* @property {kitPopper} popper
*/
/**
* @namespace kit
*/
+41 -2
View File
@@ -1,9 +1,46 @@
/** @module dataStructures */ /** @module dataStructures */
__PluginManager__.register('dataStructures', function(module, exports, require, global){ __PluginManager__.register('dataStructures', function(module, exports, require, global){
/** /**
*
* @param context
* @param callback
* @param interval
* @constructor
*/
function Interval(context, callback, interval = 1000){
/** @private */
this.context = context || window;
/** @private */
this.callback = callback;
/** @private */
this.interval = interval;
}
Interval.prototype.start = function () {
/** @private */
this.intervalId = setInterval(function () {
this.callback.apply(this.context, arguments);
}.bind(this), this.interval)
};
Interval.prototype.stop = function () {
if(this.intervalId){
clearInterval(this.intervalId);
}
};
/**
* Stack – LIFO
* Queue – FIFO
* @type dataStructures
* @memberOf kit * @memberOf kit
*/ */
var dataStructures = { const dataStructures = {
StackExecutionLimiter: (function () { StackExecutionLimiter: (function () {
var stack = function (context, callback, timeout = 1000) { var stack = function (context, callback, timeout = 1000) {
this.counter = 0; this.counter = 0;
@@ -59,7 +96,9 @@ __PluginManager__.register('dataStructures', function(module, exports, require,
this.counter = 0; this.counter = 0;
}; };
return stack; return stack;
})() })(),
Interval,
}; };
return module.exports = dataStructures; return module.exports = dataStructures;
+15
View File
@@ -361,6 +361,21 @@ kit.PluginManager.register('date',function(module, exports, require, global) {
date.countTime = countTime; date.countTime = countTime;
date.DATA_ATOM = "Y-m-d\TH:i:sP";
date.DATA_COOKIE = "l, d-M-Y H:i:s T";
date.DATA_ISO8601 = "Y-m-d\TH:i:sO";
date.DATA_RFC822 = "D, d M y H:i:s O";
date.DATA_RFC850 = "l, d-M-y H:i:s T";
date.DATA_RFC1036 = "D, d M y H:i:s O";
date.DATA_RFC1123 = "D, d M Y H:i:s O";
date.DATA_RFC7231 = "D, d M Y H:i:s \G\M\T";
date.DATA_RFC2822 = "D, d M Y H:i:s O";
date.DATA_RFC3339 = "Y-m-d\TH:i:sP";
date.DATA_RFC3339_EXTENDED = "Y-m-d\TH:i:s.vP";
date.DATA_RSS = "D, d M Y H:i:s O";
date.DATA_W3C = "Y-m-d\TH:i:sP";
date.DATA_DB = "Y-m-d H:i:s";
return date; return date;
})); }));
+47 -49
View File
@@ -10,7 +10,6 @@
--gap: 10px; --gap: 10px;
--gap-section: 30px; --gap-section: 30px;
--gap-wrapper: 30px; --gap-wrapper: 30px;
--col-count: 4;
--col-span: 1; --col-span: 1;
--line-clamp: 3; --line-clamp: 3;
--line-clamp-height: 1.3em; --line-clamp-height: 1.3em;
@@ -92,6 +91,8 @@
-webkit-align-items: stretch; -webkit-align-items: stretch;
-ms-flex-align: stretch; -ms-flex-align: stretch;
align-items: stretch; align-items: stretch;
--col-span: 1;
--col-count: 4;
} }
.flex-list:not(.owl-loaded) { .flex-list:not(.owl-loaded) {
margin-left: calc(var(--gap) / -2) !important; margin-left: calc(var(--gap) / -2) !important;
@@ -110,12 +111,13 @@
.flex-list-item { .flex-list-item {
--gap-row: var(--gap); --gap-row: var(--gap);
--col-width: calc(100% / var(--col-count) * var(--col-span)); --col-width: calc(100% / var(--col-count) * var(--col-span));
--line-height: calc(100% / var(--line-count) * var(--line-span, 1));
box-sizing: border-box; box-sizing: border-box;
} }
.flex-list > .flex-list-item { .flex-list > .flex-list-item {
width: var( --col-width) !important; width: var(--col-width) !important;
max-width: var( --col-width) !important; max-width: var(--col-width) !important;
flex-basis: var( --col-width) !important; flex-basis: var(--col-width) !important;
margin-bottom: var(--gap-row) !important; margin-bottom: var(--gap-row) !important;
} }
.flex-list-item:before, .flex-list-item:before,
@@ -149,8 +151,13 @@
-ms-flex-align: center; -ms-flex-align: center;
align-items: center; align-items: center;
} }
.flex-list--static {
--line-count: 1;
}
.flex-list--static .flex-list-item {
height: var(--line-height) !important;
max-height: var(--line-height) !important;
}
script, style { script, style {
display: none !important; display: none !important;
@@ -388,35 +395,12 @@ script, style {
-webkit-flex-basis: auto; -webkit-flex-basis: auto;
flex-basis: auto; flex-basis: auto;
} }
.flex-col.flex-cell,
.flex-col-wrap.flex-cell,
.flex-line.flex-cell,
.flex-line-wrap.flex-cell
{
padding: var(--flex-padding) !important;
}
.flex-direction-column {
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
}
.flex-direction-row {
-webkit-box-orient: horizontal;
-webkit-box-direction: normal;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
}
/* применяем к таблице: ПРОДОЛЬНОЕ выравнивание элементов в строке или колонке */ /* применяем к таблице: ПРОДОЛЬНОЕ выравнивание элементов в строке или колонке */
.flex-align-start { .flex-align-start {
-webkit-justify-content: flex-start !important; -webkit-justify-content: flex-start !important;
@@ -451,6 +435,24 @@ script, style {
align-items: center; align-items: center;
} }
.flex-cells-v-align--start > *{
justify-content: start;
}
.flex-cells-v-align--end > *{
justify-content: end;
}
.flex-cells-v-align--stretch > *{
justify-content: stretch;
}
.flex-cells-g-align--start > *{
align-items: start;
}
.flex-cells-g-align--end > *{
align-items: end;
}
.flex-cells-g-align--stretch > *{
align-items: stretch;
}
/* применяем к ячейкам: поперечное выравнивание */ /* применяем к ячейкам: поперечное выравнивание */
.flex-cell-align--start { .flex-cell-align--start {
@@ -909,7 +911,22 @@ script, style {
/* picture - icon */ /* picture - icon */
.kit-icon picture,
.kit-icon img,
.kit-icon svg,
.kit-picture picture,
.kit-picture img,
.kit-picture svg {
width: 100%;
height: 100%;
max-width: 100%;
max-height: 100%;
display: block;
fill: currentColor;
transition: inherit;
object-fit: contain;
object-position: center;
}
.kit-picture-line, .kit-icon-line { .kit-picture-line, .kit-icon-line {
display: inline-block; display: inline-block;
margin-bottom: calc(-1em * var(--font-ratio-bottom, 0.2)); margin-bottom: calc(-1em * var(--font-ratio-bottom, 0.2));
@@ -934,25 +951,6 @@ script, style {
} }
.kit-icon picture,
.kit-icon img,
.kit-icon svg,
.kit-picture picture,
.kit-picture img,
.kit-picture svg {
width: 100%;
height: 100%;
max-width: 100%;
max-height: 100%;
display: block;
fill: currentColor;
transition: inherit;
object-fit: contain;
object-position: center;
}
/* flex-kit.css end */ /* flex-kit.css end */
@@ -1,8 +1,8 @@
:root { :root {
--logger-color-emergency: hsl(0, 100%, 55%); --logger-color-emergency: hsl(0, 100%, 25%);
--logger-color-alert: hsl(0, 100%, 55%); --logger-color-alert: hsl(0, 100%, 45%);
--logger-color-critical: hsl(0, 100%, 55%); --logger-color-critical: hsl(0, 100%, 40%);
--logger-color-error: #f44336; --logger-color-error: hsl(0, 100%, 35%);
--logger-color-warning: hsl(31, 100%, 55%); --logger-color-warning: hsl(31, 100%, 55%);
--logger-color-notice: #909090; --logger-color-notice: #909090;
--logger-color-info: hsl(205, 100%, 61%); --logger-color-info: hsl(205, 100%, 61%);
@@ -14,7 +14,7 @@
margin: 0; margin: 0;
padding: 5px; padding: 5px;
font-family: monospace; font-family: monospace;
background: hsla(0, 0%, 11%, 1); background: hsl(0, 0%, 15%);
color: #909090; color: #909090;
overflow-y: scroll !important; overflow-y: scroll !important;
word-break: break-all; word-break: break-all;
@@ -69,14 +69,21 @@ logger-item {
word-break: break-all; word-break: break-all;
font-size: 1em !important; font-size: 1em !important;
line-height: calc(1.1em) !important; line-height: calc(1.1em) !important;
color: var(--logger-color-value, #c1c1c1);
background-color: var(--logger-color-content-value, transparent);
}
logger-item__options {
color: #606060;
} }
logger-item__value * { logger-item__value * {
color: inherit; color: inherit;
} }
logger-item__value .logger-toggler { logger-item__value .logger-toggler {
cursor: pointer; cursor: pointer;
color: #2698db !important; color: hsl(0, 0%, 75%) !important;
opacity: 0.6; opacity: 0.6;
font-size: 0.8em !important;
padding-left: 0.5em;
} }
logger-item__msg { logger-item__msg {
@@ -84,7 +91,6 @@ logger-item__msg {
logger-item__key { logger-item__key {
min-width: 2em; min-width: 2em;
padding-right: 5px; padding-right: 5px;
background-color: var(--logger-color-content-key, transparent);
} }
logger-item__key, logger-item__key > * { logger-item__key, logger-item__key > * {
color: var(--logger-color-key, #909090); color: var(--logger-color-key, #909090);
@@ -94,8 +100,6 @@ logger-item__key:empty {
} }
logger-item__value { logger-item__value {
flex: 1 0 0; flex: 1 0 0;
color: var(--logger-color-value, #c1c1c1);
background-color: var(--logger-color-content-value, transparent);
} }
logger-item__value * { logger-item__value * {
font-size: inherit !important; font-size: inherit !important;
+296
View File
@@ -0,0 +1,296 @@
/** @module log */
__PluginManager__.register('log', function(module, exports, require, /** @param {kit}*/global){
var support = require('support');
var Collection = require('Collection');
var lib = require('lib');
var LogLevel = {
EMERGENCY: 'emergency',
ALERT: 'alert',
CRITICAL: 'critical',
ERROR: 'error',
WARNING: 'warning',
NOTICE: 'notice',
INFO: 'info',
DEBUG: 'debug',
SUCCESS: 'success',
};
/**
* @class Logger
*/
class Logger
{
constructor() {
this.collection = new Collection();
this.onLog = new Collection();
}
}
/**
* @param collection {kit.Collection}
*/
Logger.prototype.setCollection = function (collection) {
this.collection = collection;
};
Logger.prototype.emergency = function (message, context) {
this.log(LogLevel.EMERGENCY, message, context);
};
Logger.prototype.alert = function (message, context) {
this.log(LogLevel.ALERT, message, context);
};
Logger.prototype.critical = function (message, context) {
this.log(LogLevel.CRITICAL, message, context);
};
Logger.prototype.error = function (message, context) {
this.log(LogLevel.ERROR, message, context);
};
Logger.prototype.warning = function (message, context) {
this.log(LogLevel.WARNING, message, context);
};
Logger.prototype.notice = function (message, context) {
this.log(LogLevel.NOTICE, message, context);
};
Logger.prototype.info = function (message, context) {
this.log(LogLevel.INFO, message, context);
};
Logger.prototype.debug = function (message, context) {
this.log(LogLevel.DEBUG, message, context);
};
Logger.prototype.success = function (message, context) {
this.log(LogLevel.SUCCESS, message, context);
};
Logger.prototype.log = function (level, message, context = []) {
var data = {
level: level,
message: message,
context: context,
};
this.__logData(data);
};
Logger.prototype.__logData = function (data) {
this.collection.push(data);
this.onLog.eachCall(this, data);
};
const HINT_DATA_KEY_LIST = ['id', 'createdAt', 'userId', 'ip'];
function getTooltipContent(data) {
var contentList = [];
HINT_DATA_KEY_LIST.map(function (item) {
if(data[item]){contentList.push(item+': ' + data[item]);}
});
return contentList.join('<br>');
}
function getOptionsTemplate(data) {
var optionsTemplate = '';
var content = getTooltipContent(data);
if(content) {
optionsTemplate = '<logger-item__options class="kit-picture-line" ' +
'data-kit-tooltip2="autoload" ' +
'data-kit-tooltip2-h-align="left" ' +
'data-kit-tooltip2-h-direction="left" ' +
'data-kit-tooltip2-v-align="top" ' +
'data-kit-tooltip2-v-direction="top" ' +
'data-kit-tooltip2-offset="0" ' +
'data-kit-tooltip2-content="'+content+'">'+
lib.svg.options+
'</logger-item__options>';
}
return optionsTemplate;
}
function getRowNode(key, value, level = '', data = {
id: 0,
createdAt: '',
userId: '',
}){
key = String(key);
value = String(value);
var result = '<logger-item class="kit-logger-row--'+level+'">' +
'<logger-item__key>'+key+'</logger-item__key>' +
'<logger-item__value>'+value+'</logger-item__value>' +
getOptionsTemplate(data) +
'</logger-item>';
return support.makeNode(result);
}
function getLoggerLogNode(id = ''){
var entity = '', css = '', style = '';
return support.makeNode('<logger-log></logger-log>');
}
function getLoggerPairNode(depth = 1){
return support.makeNode('<logger-pair style="--logger-depth:'+support.toNumber(depth, 1)+';"></logger-pair>');
}
function getLoggerAdditionalHtml(html = ''){
return '<logger-additional>'+html+'</logger-additional>';
}
function getLoggerToggerHtml(id, html = ''){
return '<label class="logger-toggler" for="'+id+'">'+html+'</label>';
}
function getContextNode(id = ''){
var entity = '', css = '', style = '';
if(id) {
css = '<style>input#'+id+':checked ~ [data-entity-id="'+id+'"] {display: block !important;}</style>';
entity = ' data-entity-id="'+id+'"';
style = ' style="display: none"'
}
return support.makeNode('<logger-context'+entity+style+'>'+css+'</logger-context>');
}
/**
* @extends Logger
* @class LoggerVisual
* @param nodeOrSelector
* @param maxDepth
* @param openDepth
*/
class LoggerVisual extends Logger
{
constructor(nodeOrSelector = '', maxDepth = 3, openDepth = 1){
super();
/**
* @type {Element}
* @private
*/
this.__htmlCollection = support.getNode(nodeOrSelector);
if(this.__htmlCollection) {
support.data.set(this.__htmlCollection, 'log', this);
}
this.__maxDepth = support.toNumber(maxDepth, 3);
this.__openDepth = support.toNumber(openDepth, 1);
this.onLog.push(this.__logHandler);
this.__htmlCollectionTemplater = '<div class="kit-logger kit-logger--fixed"></div>';
}
}
/**
*
* @return {HTMLElement}
*/
LoggerVisual.prototype.getHtmlCollection = function() {
if (!this.__htmlCollection) {
/**
* @type {HTMLElement}
*/
this.__htmlCollection = document.getElementById('kit-logger') || document.querySelector('.kit-logger') || support.makeNode(this.__htmlCollectionTemplater);
if((this.__htmlCollection instanceof HTMLElement) && !this.__htmlCollection.parentElement) {
document.body.appendChild(this.__htmlCollection)
}
if(this.__htmlCollection) {
support.data.set(this.__htmlCollection, 'log', this);
}
}
return this.__htmlCollection;
};
function getPairNode(depth, key, value, logLevel, maxDepth = 6, openDepth = 1, isRoot = true, data = {}) {
var pairNode = getLoggerPairNode(depth);
var contextNode,
isIterable = support.isIterable(value),
isEmptyValue = support.empty(value),
id = isIterable?support.uniqueId():'',
skipValue = value === window || value === document,
valueType = support.getType(value),
len = isIterable?Object.keys(value).length:0,
lenPrint = isIterable?' [' + Object.keys(value).length + ']':'',
val = value,inp, j;
if(support.isIterable(value)){
if(value === window) {
val = 'window ' + getLoggerAdditionalHtml(valueType);
} else if(value === document) {
val = 'document ' + getLoggerAdditionalHtml(valueType);
} else {
if(isRoot && support.empty(value)){
val = '';
} else
if(len){
if(maxDepth){
val = getLoggerToggerHtml(id, valueType + lenPrint)
} else {
val = getLoggerAdditionalHtml(valueType + lenPrint);
}
} else {
val = getLoggerAdditionalHtml(valueType + ' empty');
}
}
}
if(isIterable&&maxDepth&&!skipValue) {
pairNode.appendChild(inp = support.makeNode('<input id="'+id+'" type="checkbox" style="display: none;">'));
inp.checked = !!openDepth;
}
if(support.isIterable(key)){
pairNode.appendChild(x = getRowNode('', '' + val, logLevel));
x.querySelector('logger-item__key').appendChild(getPairNode(depth, null, key, logLevel, 1, 1, isRoot));
} else {
if(!(isRoot&&support.isUndefined(key))) {
pairNode.appendChild(getRowNode(key, '' + val, logLevel, data));
}
}
if(isIterable&&maxDepth&&!skipValue) {
if(!(isRoot&&support.isUndefined(key))) {
++depth;
}
maxDepth = Math.max(0, maxDepth - 1);
openDepth = Math.max(0, openDepth - 1);
pairNode.appendChild(contextNode = getContextNode(id));
for(j in value) {
if(value.hasOwnProperty(j)) {
contextNode.appendChild(getPairNode(depth, j, value[j], '', maxDepth, openDepth, false));
}
}
}
return pairNode;
}
LoggerVisual.prototype.__logHandler = function(data = {
level: '',
message: '',
context: [],
}){
var logCollectionNode = this.getHtmlCollection();
var loggerLogNode = getLoggerLogNode();
loggerLogNode.appendChild(getPairNode(1, data.message, data.context, data.level, this.__maxDepth, this.__openDepth, true, data));
logCollectionNode.appendChild(loggerLogNode);
logCollectionNode.scrollTop = logCollectionNode.scrollHeight;
};
LoggerVisual.prototype.logList = function (logList) {
var self = this;
logList = new Collection(logList);
logList.map(function (log) {
self.__logData(log);
});
};
/**
* @var logger
* @memberOf {kit.service}
* @type LoggerVisual
*/
global.service.logger = new LoggerVisual();
/**
* @memberOf kit
*/
var log = {
Logger,
LogLevel,
LoggerVisual
};
return module.exports = log;
});
-73
View File
@@ -1,73 +0,0 @@
/** @module Logger */
__PluginManager__.register('Logger', function(module, exports, require, global){
var support = require('support');
var Collection = require('Collection');
var LogLevel = {
EMERGENCY: 'emergency',
ALERT: 'alert',
CRITICAL: 'critical',
ERROR: 'error',
WARNING: 'warning',
NOTICE: 'notice',
INFO: 'info',
DEBUG: 'debug',
SUCCESS: 'success',
};
/**
* @class Logger
* @memberOf kit
*/
var Logger = function() {
this.collection = new Collection();
this.onLog = new Collection();
};
/**
* @param collection {kit.Collection}
*/
Logger.prototype.setCollection = function (collection) {
this.collection = collection;
};
Logger.prototype.emergency = function (message, context) {
this.log(LogLevel.EMERGENCY, message, context);
};
Logger.prototype.alert = function (message, context) {
this.log(LogLevel.ALERT, message, context);
};
Logger.prototype.critical = function (message, context) {
this.log(LogLevel.CRITICAL, message, context);
};
Logger.prototype.error = function (message, context) {
this.log(LogLevel.ERROR, message, context);
};
Logger.prototype.warning = function (message, context) {
this.log(LogLevel.WARNING, message, context);
};
Logger.prototype.notice = function (message, context) {
this.log(LogLevel.NOTICE, message, context);
};
Logger.prototype.info = function (message, context) {
this.log(LogLevel.INFO, message, context);
};
Logger.prototype.debug = function (message, context) {
this.log(LogLevel.DEBUG, message, context);
};
Logger.prototype.success = function (message, context) {
this.log(LogLevel.SUCCESS, message, context);
};
Logger.prototype.log = function (level, message, context = []) {
var data = {
level: level,
message: message,
context: context,
};
this.collection.push(data);
this.onLog.eachCall(this, data);
};
return module.exports = Logger;
});
-165
View File
@@ -1,165 +0,0 @@
/** @module loggerService */
__PluginManager__.register('loggerService', function(module, exports, require, global){
var support = require('support');
var Logger = require('Logger');
var Collection = require('Collection');
function getRowNode(key, value, level = ''){
key = String(key);
value = String(value);
var result = '<logger-item class="kit-logger-row--'+level+'"><logger-item__key>'+key+'</logger-item__key><logger-item__value>'+value+'</logger-item__value></logger-item>';
return support.makeNode(result);
}
function getLoggerLogNode(id = ''){
var entity = '', css = '', style = '';
return support.makeNode('<logger-log></logger-log>');
}
function getLoggerPairNode(depth = 1){
return support.makeNode('<logger-pair style="--logger-depth:'+support.toNumber(depth, 1)+';"></logger-pair>');
}
function getLoggerAdditionalHtml(html = ''){
return '<logger-additional>'+html+'</logger-additional>';
}
function getLoggerToggerHtml(id, html = ''){
return '<label class="logger-toggler" for="'+id+'">'+html+'</label>';
}
function getContextNode(id = ''){
var entity = '', css = '', style = '';
if(id) {
css = '<style>input#'+id+':checked ~ [data-entity-id="'+id+'"] {display: block !important;}</style>';
entity = ' data-entity-id="'+id+'"';
style = ' style="display: none"'
}
return support.makeNode('<logger-context'+entity+style+'>'+css+'</logger-context>');
}
/**
* @extends kit.Logger
* @class LoggerService
* @memberOf kit
*/
var LoggerService = function() {
Logger.prototype.constructor.apply(this, arguments);
this.onLog.push(this.__logHandler);
this.__htmlCollectionTemplater = '<div class="kit-logger kit-logger--fixed"></div>';
};
support.extend(LoggerService.prototype, Logger.prototype);
LoggerService.prototype.getHtmlCollection = function() {
var node;
if (!this.__htmlCollection) {
/**
* @type {HTMLElement}
*/
this.__htmlCollection = node || document.getElementById('kit-logger') || document.querySelector('.kit-logger') || support.makeNode(this.__htmlCollectionTemplater);
if((this.__htmlCollection instanceof HTMLElement) && !this.__htmlCollection.parentElement) {
document.body.appendChild(this.__htmlCollection)
}
}
return this.__htmlCollection;
};
function getPairNode(depth, key, value, logLevel, maxDepth = 3, openDepth = 1, isRoot = true) {
var pairNode = getLoggerPairNode(depth);
var contextNode,
isIterable = support.isIterable(value),
isEmptyValue = support.empty(value),
id = isIterable?support.uniqueId():'',
skipValue = value === window || value === document,
valueType = support.getType(value),
len = isIterable?Object.keys(value).length:0,
lenPrint = isIterable?' [' + Object.keys(value).length + ']':'',
val = value,inp, j;
if(support.isIterable(value)){
if(value === window) {
val = 'window ' + getLoggerAdditionalHtml(valueType);
} else if(value === document) {
val = 'document ' + getLoggerAdditionalHtml(valueType);
} else {
if(isRoot && support.empty(value)){
val = '';
} else
if(len){
if(maxDepth){
val = getLoggerToggerHtml(id, valueType + lenPrint)
} else {
val = getLoggerAdditionalHtml(valueType + lenPrint);
}
} else {
val = getLoggerAdditionalHtml(valueType + ' empty');
}
}
}
if(isIterable&&maxDepth&&!skipValue) {
pairNode.appendChild(inp = support.makeNode('<input id="'+id+'" type="checkbox" style="display: none;">'));
inp.checked = !!openDepth;
}
if(support.isIterable(key)){
pairNode.appendChild(x = getRowNode('', '' + val, logLevel));
x.querySelector('logger-item__key').appendChild(getPairNode(depth, null, key, logLevel, 1, 1, isRoot));
} else {
if(!(isRoot&&support.isUndefined(key))) {
pairNode.appendChild(getRowNode(key, '' + val, logLevel));
}
}
if(isIterable&&maxDepth&&!skipValue) {
if(!(isRoot&&support.isUndefined(key))) {
++depth;
}
maxDepth = Math.max(0, maxDepth - 1);
openDepth = Math.max(0, openDepth - 1);
pairNode.appendChild(contextNode = getContextNode(id));
for(j in value) {
if(value.hasOwnProperty(j)) {
contextNode.appendChild(getPairNode(depth, j, value[j], logLevel, maxDepth, openDepth, false));
}
}
}
return pairNode;
}
LoggerService.prototype.__logHandler = function(data = {
level: '',
message: '',
context: [],
}){
var logCollectionNode = this.getHtmlCollection();
var loggerLogNode = getLoggerLogNode();
loggerLogNode.appendChild(getPairNode(1, data.message, data.context, data.level, 6, 3));
logCollectionNode.appendChild(loggerLogNode);
logCollectionNode.scrollTop = logCollectionNode.scrollHeight;
};
LoggerService.prototype.logList = function (logList) {
var self = this;
logList = new Collection(logList);
logList.map(function (log) {
self.log(log.level, log.message, log.context);
});
};
/**
* @memberOf kit.service
* @class logger
**/
var logger = new LoggerService();
global.service.logger = logger;
module.exports = logger;
});
+1 -2
View File
@@ -95,8 +95,7 @@ __PluginManager__.register('menu',function(module, exports, require, global) {
this.node.classList.add(MENU_CLASS); this.node.classList.add(MENU_CLASS);
this.node.style.display = 'none'; this.node.style.display = 'none';
this.node.setAttribute('data-menu-id', this.id); this.node.setAttribute('data-menu-id', this.id);
this.node.kit = this.node.kit || {}; support.setNodeData(this.node, MENU_PLUGIN_NAME, this);
this.node.kit[MENU_PLUGIN_NAME] = this;
}; };
+72 -10
View File
@@ -3,6 +3,7 @@ __PluginManager__.register('support', function(module, exports, require, global)
window.pre = console.log; window.pre = console.log;
const KIT_DATA_PREFIX = 'kit';
var data = function(){ var data = function(){
function normalizeData(val) { function normalizeData(val) {
@@ -30,6 +31,12 @@ __PluginManager__.register('support', function(module, exports, require, global)
} }
const manipulator = { const manipulator = {
/**
* @param element {HTMLElement}
* @param key
* @param value
* @param prefix
*/
set(element, key, value, prefix = 'kit') { set(element, key, value, prefix = 'kit') {
if(prefix !== '') { if(prefix !== '') {
prefix = '-' + prefix; prefix = '-' + prefix;
@@ -78,10 +85,71 @@ __PluginManager__.register('support', function(module, exports, require, global)
}(); }();
var num = {
round,
ceil,
floor,
};
function round(num, decimals = 0) {
num = toNumber(num);
decimals = toNumber(decimals);
var k = Math.pow(10, decimals);
num = Math.round(k * num) / k;
return num;
}
function ceil(num, decimals = 0) {
num = toNumber(num);
decimals = toNumber(decimals);
var k = Math.pow(10, decimals);
num = Math.ceil(k * num) / k;
return num;
}
function floor(num, decimals = 0) {
num = toNumber(num);
decimals = toNumber(decimals);
var k = Math.pow(10, decimals);
num = Math.floor(k * num) / k;
return num;
}
var node = { var node = {
isRelate: function (node, container = document) { isRelate: function (node, container = document) {
return node === container || container.contains(node); return node === container || container.contains(node);
},
/**
* @param node {HTMLElement}
* @return {[]}
*/
getChainOfParents: function getChainOfParents(node) {
var chain = [];
if(!isNode(node)){
return chain;
} }
node = node.parentNode;
while(node){
chain.push(node);
node = node.parentNode;
}
return chain;
},
/**
* @param node {HTMLElement}
* @return {[]}
*/
getChainOfParentsWithNode: function getChainOfParentsWithNode(node) {
var chain = [];
if(!isNode(node)){
return chain;
}
while(node){
chain.push(node);
node = node.parentNode;
}
return chain;
},
isInPage: function (node) {
return (node === document.body) ? false : document.body.contains(node);
},
}; };
var str = { var str = {
ucFirst: function (str) { ucFirst: function (str) {
@@ -252,9 +320,7 @@ __PluginManager__.register('support', function(module, exports, require, global)
return nodeWrap.childNodes; return nodeWrap.childNodes;
} }
function setNodeData(node, key, value) { function setNodeData(node, key, value) {
if(!isElement(node)) return false; return setObjProp(node, [KIT_DATA_PREFIX, key], value);
node.kit = node.kit || {};
node.kit[key] = value;
} }
function setObjProp(object, branch, value) { function setObjProp(object, branch, value) {
if(!Array.isArray(branch)) { if(!Array.isArray(branch)) {
@@ -279,15 +345,10 @@ __PluginManager__.register('support', function(module, exports, require, global)
return result; return result;
} }
function getNodeData(node, key, def = null) { function getNodeData(node, key, def = null) {
if(!Array.isArray(key)) { return getObjProp(node, [KIT_DATA_PREFIX, key], def);
key = [key];
} }
var branch = ['kit'].concat(key);
return getObjProp(node, branch, def);
}
function getObjProp(object, branch, def = null) { function getObjProp(object, branch, def = null) {
if(!Array.isArray(branch)) { if(!isArray(branch)) {
branch = [branch]; branch = [branch];
} }
if(!isObject(object)) return def; if(!isObject(object)) return def;
@@ -387,6 +448,7 @@ __PluginManager__.register('support', function(module, exports, require, global)
node: node, node: node,
str: str, str: str,
arr: arr, arr: arr,
num: num,
uniqueId, uniqueId,
valueEx, valueEx,
empty, empty,
+2 -2
View File
@@ -1,13 +1,13 @@
/** @module testing */ /** @module testing */
__PluginManager__.register('testing', function(module, exports, require, global){ __PluginManager__.register('testing', function(module, exports, require, global){
var loggerService = require('loggerService'); // var loggerService = require('loggerService');
/** /**
* @constructor * @constructor
*/ */
function Unit() { function Unit() {
this.logger = loggerService; this.logger = kit.service.logger;
} }
/** /**
+31 -1
View File
@@ -59,6 +59,12 @@ kit.PluginManager.register('Tooltip2',function(module, exports, require, global)
if(!support.isElement(this.hintNode)){ if(!support.isElement(this.hintNode)){
console.warn('Tooltip2: masterNode not valid', this.hintNode); console.warn('Tooltip2: masterNode not valid', this.hintNode);
} }
if(!support.getNodeData(this.masterNode, PLUGIN_NAME)){
support.setNodeData(this.masterNode, PLUGIN_NAME, this);
support.data.set(this.masterNode, PLUGIN_NAME, 'loaded');
}
this.hintNode.remove(); this.hintNode.remove();
this.masterNode.appendChild(this.hintNode); this.masterNode.appendChild(this.hintNode);
//support.setNodeData(this.masterNode, PLUGIN_NAME, this); //support.setNodeData(this.masterNode, PLUGIN_NAME, this);
@@ -67,7 +73,25 @@ kit.PluginManager.register('Tooltip2',function(module, exports, require, global)
this.setContent(this.options.content); this.setContent(this.options.content);
} }
this.align = new align.Class(this.hintNode, this.masterNode); var limiter = window;
var chain = support.node.getChainOfParentsWithNode(this.masterNode);
chain.every(function(node, i){
if(node === document.body || node.tagName === 'HTML' || node === document){
limiter = window;
return false;
}
limiter = node;
var style = getComputedStyle(node);
var overflowX = style.overflowX;
var overflowY = style.overflowY;
if(!(overflowX === 'visible' || overflowX === 'auto') || !(overflowY === 'visible' || overflowY === 'auto')){
return false;
}
return true;
});
this.align = new align.Class(this.hintNode, this.masterNode, limiter);
var hint = new userAction.Hint(this.masterNode, this.hintNode); var hint = new userAction.Hint(this.masterNode, this.hintNode);
this.viewer = hint.viewer; this.viewer = hint.viewer;
this.viewer.delayHide = 400; this.viewer.delayHide = 400;
@@ -117,6 +141,12 @@ kit.PluginManager.register('Tooltip2',function(module, exports, require, global)
this.__setOffset(); this.__setOffset();
this.align.set(this.options.hAlign, this.options.vAlign, this.options.hDirection, this.options.vDirection); this.align.set(this.options.hAlign, this.options.vAlign, this.options.hDirection, this.options.vDirection);
} }
};
__proto.show = function(){
this.viewer.show();
};
__proto.hide = function(){
}; };
/** /**
* @param options {Tooltip2Default} * @param options {Tooltip2Default}
+7 -5
View File
@@ -63,13 +63,12 @@ kit.PluginManager.register('userAction', function(module, exports, require, glob
/** /**
* * @class
* @param masterNode * @param masterNode
* @param slaveNode * @param slaveNode
* @return {Hint}
* @constructor * @constructor
*/ */
var Hint = function (masterNode, slaveNode) { function Hint (masterNode, slaveNode) {
this.__setMasterNode(masterNode); this.__setMasterNode(masterNode);
this.__setSlaveNode(slaveNode); this.__setSlaveNode(slaveNode);
this.viewer = new Viewer(this.__slaveNode, this.__masterNode); this.viewer = new Viewer(this.__slaveNode, this.__masterNode);
@@ -156,8 +155,11 @@ kit.PluginManager.register('userAction', function(module, exports, require, glob
* @memberOf kit * @memberOf kit
*/ */
var userAction = { var userAction = {
Popover: Popover, Popover,
Hint: Hint, /**
* @type {Hint}
*/
Hint,
}; };
return module.exports = userAction; return module.exports = userAction;
+72
View File
@@ -0,0 +1,72 @@
<?php
use Wt\Core\Entity\IblockElementPropertyEntity;
use Wt\Core\Templater\Shell;
/**
* @var $this Shell
* @var $elementPropertyEntity IblockElementPropertyEntity
*/
$elementPropertyEntity = $this->getContext();
$blockId = $elementPropertyEntity->getFactory()->getIBlockId();
$code = $elementPropertyEntity->getCode();
$fieldId = 'iblock_' . $blockId . '_prop_' . $code;
/**
* @var array $arParams
*/
use Wt\Core\Templater\Tools as TemplaterTools;
use Wt\Core\Tools;
$arParams['TYPE'] = $arParams['TYPE'] ?: 'hidden';
$isReadonly = Tools::isTrue($arParams['READONLY']);
$isRequired = $elementPropertyEntity->isRequired();
$hidden = Tools::isTrue($arParams['HIDDEN']);
$isHint = $elementPropertyEntity->getHint() !== '';
$dirty = $arParams['PLACEHOLDER'] || mb_strlen($code);
$name = "FORM[iblock][$blockId]{$elementPropertyEntity->getCode()}]";
?>
<div class="kit-field kit-field--text<?= ($hidden ? ' hidden' : '') ?> <?= $arParams['WRAP_CLASS'] ?>">
<input<?
if ($isReadonly) {?> readonly<?}
if ($isRequired) {?> required<?}
?> id="<?= $fieldId ?>"<?
?>
data-dirty="<?= $dirty ? 'true' : 'false' ?>"
type="text"
name="<?=$name?>"
class="kit-field__input <?= $arParams['CLASS'] ?> <?= $arParams['ADD_CLASS'] ?><?
if (strlen($arParams['MESSAGE'])) {
if (Tools::isSuccess($arParams['MESSAGE_TYPE'])) {
?> kit-field--success<?
} else {
?> kit-field--error<?
}
}
?>"
value="<?= TemplaterTools::safeHtmlAttr($elementPropertyEntity->getValue()) ?>"
maxlength="255"
placeholder="<?= TemplaterTools::safeHtmlAttr($arParams['PLACEHOLDER']) . '' ?>"
<?
echo TemplaterTools::getAttrByArray($arParams['ATTR']);
?>
autocomplete="off"><?
if ($isHint) {
app()->service()->templater()->render('kit:field/hint', ['TITLE' => $elementPropertyEntity->getHint()]);
}
?>
<label class="kit-field__label" for="<?=$fieldId?>">
<div class="kit-field__label-content kit-line-clamp"><?= $elementPropertyEntity->getName() ?></div><?
?></label>
<div class="kit-field__message"><?= $arParams['MESSAGE'] ?></div>
<div class="kit-field__hr"></div>
</div>
<?
+16
View File
@@ -0,0 +1,16 @@
<?php
use Wt\Core\Entity\IblockElementPropertyEntity;
use Wt\Core\Templater\Shell;
/**
* @var $this Shell
* @var $elementPropertyEntity IblockElementPropertyEntity
*/
$elementPropertyEntity = $this->getContext();
if(!$elementPropertyEntity->isMultiple()){
echo $elementPropertyEntity->getDisplayValue();
} else {
echo implode(', ', $elementPropertyEntity->getDisplayValue());
}
+1 -1
View File
@@ -28,7 +28,7 @@ $APPLICATION->ShowHead();
x = setInterval(function() { x = setInterval(function() {
for(let i=0; i<nowClock.length; i+=1){ for(let i=0; i<nowClock.length; i+=1){
nowClock[i].innerHTML=kit.date('Y-m-d H:i:s'); nowClock[i].innerHTML=kit.date(kit.date.DATA_DB);
} }
//clearInterval(x); //clearInterval(x);
}, 1000); }, 1000);
+1 -1
View File
@@ -30,7 +30,7 @@
<div class="kit-logger"></div> <div class="kit-logger"></div>
</div> </div>
<script> <script>
kit.ready(['Collection', 'flexKit', 'loggerService', 'support'], function () { kit.ready(['Collection', 'flexKit', 'log', 'support'], function () {
var support = kit.support; var support = kit.support;
window.frameList = new kit.Collection(iframeList); window.frameList = new kit.Collection(iframeList);
+70
View File
@@ -0,0 +1,70 @@
<?
define("STOP_STATISTICS", true);
define('NO_AGENT_CHECK', true);
define("NOT_CHECK_PERMISSIONS",true);
define('BX_NO_ACCELERATOR_RESET', true);
require($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_before.php");
\Bitrix\Main\Loader::includeModule('wt.core');
?>
<script src="../../assets/config/config.js"></script>
<script src="../../assets/core/core.js"></script>
<script src="../../assets/core/core.register.js"></script>
<script src="script.js"></script>
<script type="application/javascript">
</script>
<style>
.kit-logger {
width: 100%;
height: 100%;
flex: 1 1 100% !important;
--flex-padding: 0;
}
.kit-logger__title {
background-color: hsl(0, 0%, 20%);
color: #ccc;
font-family: monospace;
--flex-padding: 5px;
}
.kit-logger-item__created-at {
display: inline-block;
float: right;
color: #9f9f9f !important;
font-size: 0.9em !important;
}
logger-item__options > svg {
pointer-events: none;
}
</style>
<div class="flex-list" style="height: 100%;--col-count: 3; --gap: 0; --flex-col-count: 1">
<div class="flex-list-item" style="height: 100%;">
<div class="flex-col flex-line-count" style="--flex-line-count: 1;height: 100%;">
<div class="kit-logger kit-logger--full"></div>
</div>
</div>
<div class="flex-list-item" style="height: 100%;--col-span: 2;">
<div class="flex-list flex-list--static" style="--col-count: 3;--line-count:3;height: 100%;">
<?
foreach (\Wt\Core\Log\LogLevel::$list as $level){
?>
<script>
kit.ready(['flexKit', 'log', 'dataStructures', 'jQuery', 'date', 'Tooltip2'], function () {
window.loggerList = window.loggerList || {};
window.loggerList.<?=$level?> = new kit.log.LoggerVisual('.kit-logger--<?=$level?>');
window.loggerList.<?=$level?>.<?=$level?>(kit.date(kit.date.DATA_DB));
});
</script>
<div class="flex-list-item flex-col flex-cells-g-align--stretch" style="--flex-padding: 0;">
<div class="kit-logger__title"><?=$level?></div>
<div class="kit-logger kit-logger--<?=$level?>"></div>
</div>
<?
}
?>
</div>
</div>
</div>
+23
View File
@@ -0,0 +1,23 @@
kit.ready(['flexKit', 'log', 'dataStructures', 'jQuery', 'date'], function () {
window.loggerList = window.loggerList || {};
window.loggerList.full = new kit.log.LoggerVisual('.kit-logger--full', 3, 0);
window.loggerList.full.notice(kit.date(kit.date.DATA_DB));
var lastId = 0;
var interval = new kit.dataStructures.Interval(null, function () {
kit.jQuery
.ajax('/ajax/LoggerSystemAjax/filter?>id=' + lastId)
.done(function(response){
var data = response.data || {};
var logs = new kit.Collection(data);
logs.map(function (data) {
console.log(data);
lastId = Math.max(lastId, data['id']);
window.loggerList[data.level].__logData(data);
});
window.loggerList.full.logList(data);
});
}, 5000);
interval.start();
});