Skip to content

Commit

Permalink
[update] version 8.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Helga committed Dec 3, 2020
1 parent 7191753 commit ec87d6f
Show file tree
Hide file tree
Showing 27 changed files with 357 additions and 179 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Webix UI v.8.0.1
Webix UI v.8.1.0
================

[![npm version](https://badge.fury.io/js/webix.svg)](https://badge.fury.io/js/webix)
Expand All @@ -7,7 +7,7 @@ https://webix.com

If you don't know where to start - check

- https://webix.com/tutorials/intro/1
- https://webix.com/quick-start/#!/1
- https://docs.webix.com/
- https://forum.webix.com

Expand Down Expand Up @@ -46,4 +46,4 @@ you can get help at https://forum.webix.com



(c) XB Software Ltd. 2020
(c) XB Software Ltd. 2020
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "webix",
"productTag": "webix",
"version": "8.0.1",
"version": "8.1.0",
"description": "Javascript UI for Web",
"scripts": {
"lint": "yarn eslint \"sources/**/*.js\"",
Expand Down
48 changes: 35 additions & 13 deletions sources/core/copypaste.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
import UIManager from "../core/uimanager";
import {isUndefined} from "../webix/helpers";
import {isUndefined, delay} from "../webix/helpers";
import template from "../webix/template";

import clipbuffer from "../webix/clipbuffer";
import csv from "../webix/csv";
import env from "../webix/env";

const CopyPaste = {
clipboard_setter: function(value) {
if (env.touch) return value;

if (value === true || value === 1) value = "modify";
this.attachEvent("onAfterSelect", function(id) {
if (!this.getEditor || !this.getEditor()){
var item = this.getItem(id);
var text = this.type.templateCopy(item);
clipbuffer.set(text, this);
clipbuffer.focus();
UIManager.setFocus(this);
}
this.attachEvent("onAfterSelect", this._sel_to_clip);
this.attachEvent("onAfterEditStop", function(v, ed){
const sel = this.getSelectedId(true);
if(sel.length == 1 && ed.id == sel[0])
this._sel_to_clip();
});

this.attachEvent("onPaste", function(text) {
if (!isUndefined(this._paste[this._settings.clipboard]))
this._paste[this._settings.clipboard].call(this, text);
if (!isUndefined(this._paste[this._settings.clipboard])) {
const data = csv.parse(text, this._settings.delimiter);
this._paste[this._settings.clipboard].call(this, data);
}
});
this.attachEvent("onFocus", function() {
clipbuffer.focus();
Expand All @@ -35,16 +36,37 @@ const CopyPaste = {
});
return value;
},
_sel_to_clip: function() {
delay(() => { //wait until editor is closed
if (!this.getEditor || !this.getEditor()){
const sel = this.getSelectedId(true);
const data = [];
for(let i = 0; i < sel.length; i++){
const id = sel[i];
const item = this.getItem(id);
data.push([this.type.templateCopy(item)]);
}

const text = data.length === 1 ? data[0][0] : csv.stringify(data, this._settings.delimiter);

clipbuffer.set(text, this);
clipbuffer.focus();
UIManager.setFocus(this);
}
});
},
_paste: {
// insert new item with pasted value
insert: function(text) {
this.add({ value: text });
text.forEach(value => this.add({ value }));
},
// change value of each selected item
modify: function(text) {
var sel = this.getSelectedId(true);
for (var i = 0; i < sel.length; i++) {
this.getItem(sel[i]).value = text;
if(isUndefined(text[i]))
return;
this.getItem(sel[i]).value = text[i];
this.refresh(sel[i]);
}
},
Expand Down
6 changes: 6 additions & 0 deletions sources/core/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,12 @@ const wDate = {
return d0.getMonth() == d.getMonth() && d0.getYear() == d.getYear();
});
break;
case "quarter":
date.setMonth(date.getMonth() + inc * 3);
this._correctDate(date,d,inc,function(d,d0){
return d0.getMonth() == d.getMonth() && d0.getYear() == d.getYear();
});
break;
case "year":
date.setYear(date.getFullYear()+inc);
this._correctDate(date,d,inc,function(d,d0){
Expand Down
11 changes: 7 additions & 4 deletions sources/core/dragcontrol.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,16 @@ const DragControl ={
const dragCtrl = DragControl;
const master = this._getActiveDragMaster();
// for data items only
if (master && master._getDragItemPos){
if (master && master.$longTouchLimit){
if (!dragCtrl._html && !dragCtrl.createDrag(e)) return;
e.longtouch_drag = true;

const pos = { x:e.x, y:e.y };
const customPos = dragCtrl.$dragPos(pos, e);

const ctx = dragCtrl._drag_context;
dragCtrl._html.style.left= e.x+dragCtrl.left+ (ctx.x_offset||0)+"px";
dragCtrl._html.style.top= e.y+dragCtrl.top+ (ctx.y_offset||0) +"px";
dragCtrl._html.style.top= pos.y+dragCtrl.top+(customPos||!ctx.y_offset?0:ctx.y_offset)+"px";
dragCtrl._html.style.left= pos.x+dragCtrl.left+(customPos||!ctx.x_offset?0:ctx.x_offset)+"px";
}
},
/*
Expand Down Expand Up @@ -128,7 +131,7 @@ const DragControl ={
var master = DragControl._getActiveDragMaster();

// only long-touched elements can be dragged
var longTouchLimit = (master && env.touch && master._getDragItemPos && !Touch._long_touched);
var longTouchLimit = (env.touch && master && master.$longTouchLimit && !Touch._long_touched);
if (longTouchLimit || Math.abs(pos.x-DragControl._start_pos.x)<5 && Math.abs(pos.y-DragControl._start_pos.y)<5)
return;

Expand Down
1 change: 1 addition & 0 deletions sources/core/dragitem.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ const DragItem ={
context.from.move(context.source,context.index,context.to, details);
}
},
$longTouchLimit: true,
_getDragItemPos: function(pos,e){
if (this.getItemNode){
var id = this.locate(e, true);
Expand Down
22 changes: 14 additions & 8 deletions sources/core/tablepaste.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,21 @@ import clipbuffer from "../webix/clipbuffer";
import csv from "../webix/csv";
import env from "../webix/env";

import {isUndefined} from "../webix/helpers";
import {isUndefined, delay} from "../webix/helpers";


const TablePaste = {
clipboard_setter:function(value){
if (env.touch) return value;

if (value === true || value === 1) value = "block";
clipbuffer.init();
this.attachEvent("onSelectChange",this._sel_to_clip);
this.attachEvent("onAfterEditStop", function(v, ed){
const sel = this.getSelectedId(true);
if(sel.length == 1 && ed.row == sel[0].row)
this._sel_to_clip();
});
// solution for clicks on selected items
this.attachEvent("onItemClick",function(){
if(document.activeElement && this.$view.contains(document.activeElement)){
Expand All @@ -28,13 +33,14 @@ const TablePaste = {
},
templateCopy_setter: template,
_sel_to_clip: function() {
if (!this.getEditor || !this.getEditor()){
var data = this._get_sel_text();
clipbuffer.set(data);
UIManager.setFocus(this);
}
delay(() => { //wait until editor is closed
if (!this.getEditor || !this.getEditor()){
var data = this._get_sel_text();
clipbuffer.set(data);
UIManager.setFocus(this);
}
});
},

_get_sel_text: function() {
var data = [];
var filter = this._settings.templateCopy;
Expand Down
4 changes: 2 additions & 2 deletions sources/core/touch.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,13 @@ const Touch = {
Touch._init_scroller(delta); //apply scrolling
} else if (env.isMac) {
const view = $$(Touch._start_context);
if (view && view.$hasYScroll && view.$hasYScroll()){
if (view && view.$hasYScroll && view.$hasYScroll() && e.cancelable){
return preventEvent(e);
}
}
}

if (Touch._scroll_mode)
if (Touch._scroll_mode && e.cancelable)
return preventEvent(e);
},
_set_scroll_pos:function(){
Expand Down
7 changes: 3 additions & 4 deletions sources/core/treedataloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ const TreeDataLoader = {
//redefine methods
this._feed_common = this._feed_commonA;
},
_feed_commonA:function(id, count, callback, url){
_feed_commonA:function(from, count, callback, url, details, defer){
// branch loading
var details = (count === 0?{parent: encodeURIComponent(id)}:null);

return DataLoader.prototype._feed_common.call(this,id, count, callback, url, details);
details = (count === 0) ? {parent: encodeURIComponent(from)} : null;
return DataLoader.prototype._feed_common.call(this, from, count, callback, url, details, defer);
},
//load next set of data rows
loadBranch:function(id, callback, url){
Expand Down
9 changes: 9 additions & 0 deletions sources/css/colorselect.less
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@
user-select: none;
-webkit-user-select: none;
}
.webix_color_circle:focus,
.webix_color_area_active .webix_color_circle{
box-shadow:inset 0 0 4px #fff;
}
.webix_color_line_circle {
position: absolute;
width: 12px;
Expand All @@ -66,6 +70,11 @@
border: 2px solid #FFFFFF;
border-radius:50%;
}
.webix_color_line_circle:focus,
.webix_color_area_active .webix_color_line_circle{
box-shadow:inset 0 0 8px #fff;
}

.webix_color_out_block, .webix_color_out_text{
height:32px;
float:left;
Expand Down
7 changes: 5 additions & 2 deletions sources/css/inputs.less
Original file line number Diff line number Diff line change
Expand Up @@ -381,15 +381,18 @@ body:not(:-moz-handler-blocked) .webix_el_select select{
}

.webix_view.webix_control .webix_disabled_box{
label, .webix_input_icon, button{
label, .webix_input_icon, button, .webix_slider_title{
color: @disabledFontColor;
}
input, select, textarea, .webix_inp_static{
input, select, textarea, .webix_inp_static, .webix_slider_right, .webix_slider_handle{
.inputDisabled();
}
.webix_inp_counter_prev, .webix_inp_counter_next, .webix_segment_0, .webix_segment_1, .webix_segment_N{
.buttonDisabled;
}
.webix_slider_left {
background-color:@disabledFontColor;
}
}
.webix_disabled_top_label{
color: @disabledFontColor;
Expand Down
2 changes: 1 addition & 1 deletion sources/css/skins/compact/config.less
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@

// buttons in bars:

.webix_el_button, .webix_el_label, .webix_inp_label{
.webix_el_button, .webix_el_label, .webix_inp_label, .webix_slider_title{
color: @barFontColor;
}
.webix_el_label .webix_el_box{
Expand Down
7 changes: 7 additions & 0 deletions sources/css/skins/contrast/config.less
Original file line number Diff line number Diff line change
Expand Up @@ -1125,6 +1125,13 @@ div.webix_inp_static,.webix_el_textarea textarea {
.webix_rangeslider .webix_slider_title_box{
height:21px;
}
.webix_view.webix_control .webix_disabled_box{
.webix_slider_handle, .webix_slider_left{
border-color:@disabledFontColor;
}
}


.webix_switch_handle:focus,
.webix_switch_box:active .webix_switch_handle{
box-shadow: 0 0px 2px 2px #fff;
Expand Down
2 changes: 1 addition & 1 deletion sources/css/skins/flat/config.less
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@

// buttons in bars:

.webix_el_button, .webix_el_label, .webix_inp_label{
.webix_el_button, .webix_el_label, .webix_inp_label, .webix_slider_title{
color: @barFontColor;
}
.webix_el_label .webix_el_box{
Expand Down
2 changes: 1 addition & 1 deletion sources/css/skins/material/config.less
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
background: @secondaryBg;
border-color: @secondaryBg;

.webix_el_button, .webix_el_label .webix_el_box, .webix_inp_label, .webix_inp_top_label{
.webix_el_button, .webix_el_label .webix_el_box, .webix_inp_label, .webix_inp_top_label, .webix_slider_title{
color: @darkBarFontColor;
}
.webix_secondary, .webix_transparent{
Expand Down
2 changes: 1 addition & 1 deletion sources/css/skins/mini/config.less
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
background: @secondaryBg;
border-color: @secondaryBg;

.webix_el_button, .webix_el_label .webix_el_box, .webix_inp_label, .webix_inp_top_label{
.webix_el_button, .webix_el_label .webix_el_box, .webix_inp_label, .webix_inp_top_label, .webix_slider_title{
color: @darkBarFontColor;
}
.webix_secondary, .webix_transparent{
Expand Down
24 changes: 21 additions & 3 deletions sources/views/chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import HtmlMap from "../core/htmlmap";
import Canvas from "../core/canvas";
import GroupMethods from "../core/groupmethods";

import {locate, offset as getOffset, pos as getPos, create} from "../webix/html";
import {locate, offset as getOffset, pos as getPos, create, remove} from "../webix/html";
import {protoUI} from "../ui/core";
import {bind, extend, isUndefined} from "../webix/helpers";
import {assert} from "../webix/debug";
Expand Down Expand Up @@ -845,8 +845,20 @@ const api = {
for(i = 0; i < legend.values.length; i++){
legendItems.push(this._drawLegendText(legendContainer,legend.values[i].text,(typeof legend.values[i].id!="undefined"?typeof legend.values[i].id:i),legend.values[i].$hidden));
}
if (legendContainer.offsetWidth === 0)
legendContainer.style.width = "auto";

const rendered = document.body.contains(this._contentobj);
let parentNode, d;

// inside window
if(!rendered){
d = create("DIV",{"style":"visibility:hidden; position:absolute; top:0px; left:0px;"},"");

parentNode = this._contentobj.parentNode;

document.body.appendChild(d);
d.appendChild(this._contentobj);
}

legendWidth = legendContainer.offsetWidth;
legendHeight = legendContainer.offsetHeight;

Expand Down Expand Up @@ -892,6 +904,12 @@ const api = {
this._drawLegendMarker(ctx,item.offsetLeft+x,item.offsetTop+y,itemColor,item.offsetHeight,disabled,i);
}
ctx.restore();

if(!rendered){
parentNode.appendChild(this._contentobj);
remove(d);
}

legendItems = null;
},
/**
Expand Down
Loading

0 comments on commit ec87d6f

Please sign in to comment.