handsontable 14.0.0-next-fc6b81e-20231116 → 14.0.0-next-6009c41-20231120
Sign up to get free protection for your applications and to get access to all the features.
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +1049 -1050
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +5 -5
- package/dist/handsontable.js +1051 -1052
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +12 -12
- package/editors/textEditor/textEditor.js +3 -36
- package/editors/textEditor/textEditor.mjs +3 -36
- package/focusManager.js +2 -1
- package/focusManager.mjs +2 -1
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/package.json +1 -1
- package/utils/autoResize.js +204 -0
- package/utils/autoResize.mjs +200 -0
- package/3rdparty/autoResize/autoResize.js +0 -162
- package/3rdparty/autoResize/autoResize.mjs +0 -158
- package/3rdparty/autoResize/index.js +0 -5
- package/3rdparty/autoResize/index.mjs +0 -1
@@ -1,162 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
exports.__esModule = true;
|
4
|
-
exports.autoResize = autoResize;
|
5
|
-
/**
|
6
|
-
* autoResize - resizes a DOM element to the width and height of another DOM element
|
7
|
-
*
|
8
|
-
* Copyright 2014, Marcin Warpechowski
|
9
|
-
* Licensed under the MIT license
|
10
|
-
*/
|
11
|
-
|
12
|
-
function autoResize() {
|
13
|
-
var defaults = {
|
14
|
-
minHeight: 200,
|
15
|
-
maxHeight: 300,
|
16
|
-
minWidth: 100,
|
17
|
-
maxWidth: 300
|
18
|
-
},
|
19
|
-
el,
|
20
|
-
body = document.body,
|
21
|
-
text = document.createTextNode(''),
|
22
|
-
span = document.createElement('SPAN'),
|
23
|
-
observe = function (element, event, handler) {
|
24
|
-
element.addEventListener(event, handler, false);
|
25
|
-
},
|
26
|
-
unObserve = function (element, event, handler) {
|
27
|
-
element.removeEventListener(event, handler, false);
|
28
|
-
},
|
29
|
-
resize = function (newChar) {
|
30
|
-
var width, scrollHeight;
|
31
|
-
if (!newChar) {
|
32
|
-
newChar = "";
|
33
|
-
} else if (!/^[a-zA-Z \.,\\\/\|0-9]$/.test(newChar)) {
|
34
|
-
newChar = ".";
|
35
|
-
}
|
36
|
-
if (text.textContent !== undefined) {
|
37
|
-
text.textContent = el.value + newChar;
|
38
|
-
} else {
|
39
|
-
text.data = el.value + newChar; //IE8
|
40
|
-
}
|
41
|
-
// Won't expand the element size for displaying body as for example, `grid`, `inline-grid` or `flex` with
|
42
|
-
// `flex-direction` set as `column`.
|
43
|
-
span.style.position = 'absolute';
|
44
|
-
span.style.fontSize = getComputedStyle(el).fontSize;
|
45
|
-
span.style.fontFamily = getComputedStyle(el).fontFamily;
|
46
|
-
span.style.whiteSpace = "pre";
|
47
|
-
body.appendChild(span);
|
48
|
-
width = span.clientWidth + 2;
|
49
|
-
body.removeChild(span);
|
50
|
-
el.style.height = defaults.minHeight + 'px';
|
51
|
-
if (defaults.minWidth > width) {
|
52
|
-
el.style.width = defaults.minWidth + 'px';
|
53
|
-
} else if (width > defaults.maxWidth) {
|
54
|
-
el.style.width = defaults.maxWidth + 'px';
|
55
|
-
} else {
|
56
|
-
el.style.width = width + 'px';
|
57
|
-
}
|
58
|
-
scrollHeight = el.scrollHeight ? el.scrollHeight - 1 : 0;
|
59
|
-
if (defaults.minHeight > scrollHeight) {
|
60
|
-
el.style.height = defaults.minHeight + 'px';
|
61
|
-
} else if (defaults.maxHeight < scrollHeight) {
|
62
|
-
el.style.height = defaults.maxHeight + 'px';
|
63
|
-
el.style.overflowY = 'visible';
|
64
|
-
} else {
|
65
|
-
el.style.height = scrollHeight + 'px';
|
66
|
-
}
|
67
|
-
},
|
68
|
-
delayedResize = function () {
|
69
|
-
window.setTimeout(resize, 0);
|
70
|
-
},
|
71
|
-
extendDefaults = function (config) {
|
72
|
-
if (config && config.minHeight) {
|
73
|
-
if (config.minHeight == 'inherit') {
|
74
|
-
defaults.minHeight = el.clientHeight;
|
75
|
-
} else {
|
76
|
-
var minHeight = parseInt(config.minHeight);
|
77
|
-
if (!isNaN(minHeight)) {
|
78
|
-
defaults.minHeight = minHeight;
|
79
|
-
}
|
80
|
-
}
|
81
|
-
}
|
82
|
-
if (config && config.maxHeight) {
|
83
|
-
if (config.maxHeight == 'inherit') {
|
84
|
-
defaults.maxHeight = el.clientHeight;
|
85
|
-
} else {
|
86
|
-
var maxHeight = parseInt(config.maxHeight);
|
87
|
-
if (!isNaN(maxHeight)) {
|
88
|
-
defaults.maxHeight = maxHeight;
|
89
|
-
}
|
90
|
-
}
|
91
|
-
}
|
92
|
-
if (config && config.minWidth) {
|
93
|
-
if (config.minWidth == 'inherit') {
|
94
|
-
defaults.minWidth = el.clientWidth;
|
95
|
-
} else {
|
96
|
-
var minWidth = parseInt(config.minWidth);
|
97
|
-
if (!isNaN(minWidth)) {
|
98
|
-
defaults.minWidth = minWidth;
|
99
|
-
}
|
100
|
-
}
|
101
|
-
}
|
102
|
-
if (config && config.maxWidth) {
|
103
|
-
if (config.maxWidth == 'inherit') {
|
104
|
-
defaults.maxWidth = el.clientWidth;
|
105
|
-
} else {
|
106
|
-
var maxWidth = parseInt(config.maxWidth);
|
107
|
-
if (!isNaN(maxWidth)) {
|
108
|
-
defaults.maxWidth = maxWidth;
|
109
|
-
}
|
110
|
-
}
|
111
|
-
}
|
112
|
-
if (!span.firstChild) {
|
113
|
-
span.className = "autoResize";
|
114
|
-
span.style.display = 'inline-block';
|
115
|
-
span.appendChild(text);
|
116
|
-
}
|
117
|
-
},
|
118
|
-
init = function (el_, config, doObserve) {
|
119
|
-
el = el_;
|
120
|
-
extendDefaults(config);
|
121
|
-
if (el.nodeName == 'TEXTAREA') {
|
122
|
-
el.style.resize = 'none';
|
123
|
-
el.style.overflowY = '';
|
124
|
-
el.style.height = defaults.minHeight + 'px';
|
125
|
-
el.style.minWidth = defaults.minWidth + 'px';
|
126
|
-
el.style.maxWidth = defaults.maxWidth + 'px';
|
127
|
-
el.style.overflowY = 'hidden';
|
128
|
-
}
|
129
|
-
if (doObserve) {
|
130
|
-
observe(el, 'change', resize);
|
131
|
-
observe(el, 'cut', delayedResize);
|
132
|
-
observe(el, 'paste', delayedResize);
|
133
|
-
observe(el, 'drop', delayedResize);
|
134
|
-
observe(el, 'keydown', delayedResize);
|
135
|
-
observe(el, 'focus', resize);
|
136
|
-
observe(el, 'compositionstart', delayedResize);
|
137
|
-
observe(el, 'compositionupdate', delayedResize);
|
138
|
-
observe(el, 'compositionend', delayedResize);
|
139
|
-
}
|
140
|
-
resize();
|
141
|
-
};
|
142
|
-
function getComputedStyle(element) {
|
143
|
-
return element.currentStyle || document.defaultView.getComputedStyle(element);
|
144
|
-
}
|
145
|
-
return {
|
146
|
-
init: function (el_, config, doObserve) {
|
147
|
-
init(el_, config, doObserve);
|
148
|
-
},
|
149
|
-
unObserve: function () {
|
150
|
-
unObserve(el, 'change', resize);
|
151
|
-
unObserve(el, 'cut', delayedResize);
|
152
|
-
unObserve(el, 'paste', delayedResize);
|
153
|
-
unObserve(el, 'drop', delayedResize);
|
154
|
-
unObserve(el, 'keydown', delayedResize);
|
155
|
-
unObserve(el, 'focus', resize);
|
156
|
-
unObserve(el, 'compositionstart', delayedResize);
|
157
|
-
unObserve(el, 'compositionupdate', delayedResize);
|
158
|
-
unObserve(el, 'compositionend', delayedResize);
|
159
|
-
},
|
160
|
-
resize: resize
|
161
|
-
};
|
162
|
-
}
|
@@ -1,158 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* autoResize - resizes a DOM element to the width and height of another DOM element
|
3
|
-
*
|
4
|
-
* Copyright 2014, Marcin Warpechowski
|
5
|
-
* Licensed under the MIT license
|
6
|
-
*/
|
7
|
-
|
8
|
-
export function autoResize() {
|
9
|
-
var defaults = {
|
10
|
-
minHeight: 200,
|
11
|
-
maxHeight: 300,
|
12
|
-
minWidth: 100,
|
13
|
-
maxWidth: 300
|
14
|
-
},
|
15
|
-
el,
|
16
|
-
body = document.body,
|
17
|
-
text = document.createTextNode(''),
|
18
|
-
span = document.createElement('SPAN'),
|
19
|
-
observe = function (element, event, handler) {
|
20
|
-
element.addEventListener(event, handler, false);
|
21
|
-
},
|
22
|
-
unObserve = function (element, event, handler) {
|
23
|
-
element.removeEventListener(event, handler, false);
|
24
|
-
},
|
25
|
-
resize = function (newChar) {
|
26
|
-
var width, scrollHeight;
|
27
|
-
if (!newChar) {
|
28
|
-
newChar = "";
|
29
|
-
} else if (!/^[a-zA-Z \.,\\\/\|0-9]$/.test(newChar)) {
|
30
|
-
newChar = ".";
|
31
|
-
}
|
32
|
-
if (text.textContent !== undefined) {
|
33
|
-
text.textContent = el.value + newChar;
|
34
|
-
} else {
|
35
|
-
text.data = el.value + newChar; //IE8
|
36
|
-
}
|
37
|
-
// Won't expand the element size for displaying body as for example, `grid`, `inline-grid` or `flex` with
|
38
|
-
// `flex-direction` set as `column`.
|
39
|
-
span.style.position = 'absolute';
|
40
|
-
span.style.fontSize = getComputedStyle(el).fontSize;
|
41
|
-
span.style.fontFamily = getComputedStyle(el).fontFamily;
|
42
|
-
span.style.whiteSpace = "pre";
|
43
|
-
body.appendChild(span);
|
44
|
-
width = span.clientWidth + 2;
|
45
|
-
body.removeChild(span);
|
46
|
-
el.style.height = defaults.minHeight + 'px';
|
47
|
-
if (defaults.minWidth > width) {
|
48
|
-
el.style.width = defaults.minWidth + 'px';
|
49
|
-
} else if (width > defaults.maxWidth) {
|
50
|
-
el.style.width = defaults.maxWidth + 'px';
|
51
|
-
} else {
|
52
|
-
el.style.width = width + 'px';
|
53
|
-
}
|
54
|
-
scrollHeight = el.scrollHeight ? el.scrollHeight - 1 : 0;
|
55
|
-
if (defaults.minHeight > scrollHeight) {
|
56
|
-
el.style.height = defaults.minHeight + 'px';
|
57
|
-
} else if (defaults.maxHeight < scrollHeight) {
|
58
|
-
el.style.height = defaults.maxHeight + 'px';
|
59
|
-
el.style.overflowY = 'visible';
|
60
|
-
} else {
|
61
|
-
el.style.height = scrollHeight + 'px';
|
62
|
-
}
|
63
|
-
},
|
64
|
-
delayedResize = function () {
|
65
|
-
window.setTimeout(resize, 0);
|
66
|
-
},
|
67
|
-
extendDefaults = function (config) {
|
68
|
-
if (config && config.minHeight) {
|
69
|
-
if (config.minHeight == 'inherit') {
|
70
|
-
defaults.minHeight = el.clientHeight;
|
71
|
-
} else {
|
72
|
-
var minHeight = parseInt(config.minHeight);
|
73
|
-
if (!isNaN(minHeight)) {
|
74
|
-
defaults.minHeight = minHeight;
|
75
|
-
}
|
76
|
-
}
|
77
|
-
}
|
78
|
-
if (config && config.maxHeight) {
|
79
|
-
if (config.maxHeight == 'inherit') {
|
80
|
-
defaults.maxHeight = el.clientHeight;
|
81
|
-
} else {
|
82
|
-
var maxHeight = parseInt(config.maxHeight);
|
83
|
-
if (!isNaN(maxHeight)) {
|
84
|
-
defaults.maxHeight = maxHeight;
|
85
|
-
}
|
86
|
-
}
|
87
|
-
}
|
88
|
-
if (config && config.minWidth) {
|
89
|
-
if (config.minWidth == 'inherit') {
|
90
|
-
defaults.minWidth = el.clientWidth;
|
91
|
-
} else {
|
92
|
-
var minWidth = parseInt(config.minWidth);
|
93
|
-
if (!isNaN(minWidth)) {
|
94
|
-
defaults.minWidth = minWidth;
|
95
|
-
}
|
96
|
-
}
|
97
|
-
}
|
98
|
-
if (config && config.maxWidth) {
|
99
|
-
if (config.maxWidth == 'inherit') {
|
100
|
-
defaults.maxWidth = el.clientWidth;
|
101
|
-
} else {
|
102
|
-
var maxWidth = parseInt(config.maxWidth);
|
103
|
-
if (!isNaN(maxWidth)) {
|
104
|
-
defaults.maxWidth = maxWidth;
|
105
|
-
}
|
106
|
-
}
|
107
|
-
}
|
108
|
-
if (!span.firstChild) {
|
109
|
-
span.className = "autoResize";
|
110
|
-
span.style.display = 'inline-block';
|
111
|
-
span.appendChild(text);
|
112
|
-
}
|
113
|
-
},
|
114
|
-
init = function (el_, config, doObserve) {
|
115
|
-
el = el_;
|
116
|
-
extendDefaults(config);
|
117
|
-
if (el.nodeName == 'TEXTAREA') {
|
118
|
-
el.style.resize = 'none';
|
119
|
-
el.style.overflowY = '';
|
120
|
-
el.style.height = defaults.minHeight + 'px';
|
121
|
-
el.style.minWidth = defaults.minWidth + 'px';
|
122
|
-
el.style.maxWidth = defaults.maxWidth + 'px';
|
123
|
-
el.style.overflowY = 'hidden';
|
124
|
-
}
|
125
|
-
if (doObserve) {
|
126
|
-
observe(el, 'change', resize);
|
127
|
-
observe(el, 'cut', delayedResize);
|
128
|
-
observe(el, 'paste', delayedResize);
|
129
|
-
observe(el, 'drop', delayedResize);
|
130
|
-
observe(el, 'keydown', delayedResize);
|
131
|
-
observe(el, 'focus', resize);
|
132
|
-
observe(el, 'compositionstart', delayedResize);
|
133
|
-
observe(el, 'compositionupdate', delayedResize);
|
134
|
-
observe(el, 'compositionend', delayedResize);
|
135
|
-
}
|
136
|
-
resize();
|
137
|
-
};
|
138
|
-
function getComputedStyle(element) {
|
139
|
-
return element.currentStyle || document.defaultView.getComputedStyle(element);
|
140
|
-
}
|
141
|
-
return {
|
142
|
-
init: function (el_, config, doObserve) {
|
143
|
-
init(el_, config, doObserve);
|
144
|
-
},
|
145
|
-
unObserve: function () {
|
146
|
-
unObserve(el, 'change', resize);
|
147
|
-
unObserve(el, 'cut', delayedResize);
|
148
|
-
unObserve(el, 'paste', delayedResize);
|
149
|
-
unObserve(el, 'drop', delayedResize);
|
150
|
-
unObserve(el, 'keydown', delayedResize);
|
151
|
-
unObserve(el, 'focus', resize);
|
152
|
-
unObserve(el, 'compositionstart', delayedResize);
|
153
|
-
unObserve(el, 'compositionupdate', delayedResize);
|
154
|
-
unObserve(el, 'compositionend', delayedResize);
|
155
|
-
},
|
156
|
-
resize: resize
|
157
|
-
};
|
158
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
export { autoResize } from "./autoResize.mjs";
|