@themarioga/grid-editor 9.1.0 → 9.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/grideditor.bundle.min.js +2 -2
- package/dist/grideditor.esm.js +91 -45
- package/dist/grideditor.js +91 -45
- package/dist/grideditor.min.js +1 -1
- package/dist/grideditor.min.js.map +3 -3
- package/dist/plugins/grideditor.inline-style.esm.js +28 -15
- package/dist/plugins/grideditor.inline-style.js +28 -15
- package/dist/plugins/grideditor.inline-style.min.js +4 -4
- package/dist/plugins/grideditor.inline-style.min.js.map +3 -3
- package/package.json +1 -1
- package/src/js/grideditor.js +102 -49
- package/src/js/inline-style/drawerflow.js +35 -14
package/dist/grideditor.esm.js
CHANGED
|
@@ -1167,7 +1167,23 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
1167
1167
|
createMainControls();
|
|
1168
1168
|
watchDrawers();
|
|
1169
1169
|
var signal = { signal: lifetime.signal };
|
|
1170
|
-
|
|
1170
|
+
var scrollFrame = null;
|
|
1171
|
+
window.addEventListener("scroll", function() {
|
|
1172
|
+
if (scrollFrame !== null) {
|
|
1173
|
+
return;
|
|
1174
|
+
}
|
|
1175
|
+
scrollFrame = window.requestAnimationFrame(function() {
|
|
1176
|
+
scrollFrame = null;
|
|
1177
|
+
if (!destroyed && mainControls) {
|
|
1178
|
+
onScroll();
|
|
1179
|
+
}
|
|
1180
|
+
});
|
|
1181
|
+
}, signal);
|
|
1182
|
+
lifetime.signal.addEventListener("abort", function() {
|
|
1183
|
+
if (scrollFrame !== null) {
|
|
1184
|
+
window.cancelAnimationFrame(scrollFrame);
|
|
1185
|
+
}
|
|
1186
|
+
});
|
|
1171
1187
|
delegate(canvas, "click", ".ge-content", onContentClick, signal);
|
|
1172
1188
|
if (settings.active_target) {
|
|
1173
1189
|
var pressed = null;
|
|
@@ -2230,19 +2246,27 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
2230
2246
|
return names;
|
|
2231
2247
|
}
|
|
2232
2248
|
function copyCanvas() {
|
|
2233
|
-
var copy = canvas.cloneNode(true);
|
|
2234
2249
|
var toLive = /* @__PURE__ */ new Map();
|
|
2235
2250
|
var toCopy = /* @__PURE__ */ new Map();
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
toLive.set(
|
|
2242
|
-
toCopy.set(
|
|
2243
|
-
|
|
2244
|
-
|
|
2251
|
+
function copyNode(live) {
|
|
2252
|
+
var copied = live.cloneNode(live.nodeName === "TEMPLATE");
|
|
2253
|
+
if (live.nodeType !== 1) {
|
|
2254
|
+
return copied;
|
|
2255
|
+
}
|
|
2256
|
+
toLive.set(copied, live);
|
|
2257
|
+
toCopy.set(live, copied);
|
|
2258
|
+
if (live.nodeName === "TEMPLATE") {
|
|
2259
|
+
return copied;
|
|
2260
|
+
}
|
|
2261
|
+
for (var child2 = live.firstChild; child2; child2 = child2.nextSibling) {
|
|
2262
|
+
if (child2.nodeType === 1 && hasClass(child2, "ge-tools-drawer")) {
|
|
2263
|
+
continue;
|
|
2264
|
+
}
|
|
2265
|
+
copied.appendChild(copyNode(child2));
|
|
2266
|
+
}
|
|
2267
|
+
return copied;
|
|
2245
2268
|
}
|
|
2269
|
+
var copy = copyNode(canvas);
|
|
2246
2270
|
return {
|
|
2247
2271
|
root: copy,
|
|
2248
2272
|
liveOf: function(node) {
|
|
@@ -3475,15 +3499,15 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
3475
3499
|
}
|
|
3476
3500
|
function flush() {
|
|
3477
3501
|
frame = null;
|
|
3478
|
-
var drawers = Array.from(due)
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
if (!drawer.isConnected) {
|
|
3482
|
-
drawerResizes.unobserve(drawer);
|
|
3483
|
-
return;
|
|
3502
|
+
var drawers = Array.from(due).filter(function(drawer) {
|
|
3503
|
+
if (drawer.isConnected) {
|
|
3504
|
+
return true;
|
|
3484
3505
|
}
|
|
3485
|
-
|
|
3506
|
+
drawerResizes.unobserve(drawer);
|
|
3507
|
+
return false;
|
|
3486
3508
|
});
|
|
3509
|
+
due.clear();
|
|
3510
|
+
fitDrawers(drawers);
|
|
3487
3511
|
}
|
|
3488
3512
|
var drawerResizes = new window.ResizeObserver(function(entries) {
|
|
3489
3513
|
entries.forEach(function(entry) {
|
|
@@ -3525,36 +3549,58 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
3525
3549
|
}
|
|
3526
3550
|
});
|
|
3527
3551
|
}
|
|
3528
|
-
function
|
|
3529
|
-
var
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3552
|
+
function fitDrawers(drawers) {
|
|
3553
|
+
var fits = drawers.map(function(drawer) {
|
|
3554
|
+
var fit = {
|
|
3555
|
+
drawer,
|
|
3556
|
+
tools: children(drawer, "a").filter(function(tool) {
|
|
3557
|
+
return !hasClass(tool, "ge-drawer-more");
|
|
3558
|
+
}),
|
|
3559
|
+
expanded: hasClass(drawer, "ge-drawer-expanded")
|
|
3560
|
+
};
|
|
3561
|
+
removeClass(drawer, "ge-drawer-overflow ge-drawer-expanded");
|
|
3562
|
+
fit.tools.forEach(function(tool) {
|
|
3563
|
+
removeClass(tool, "ge-tool-overflow");
|
|
3564
|
+
});
|
|
3565
|
+
return fit;
|
|
3536
3566
|
});
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
if (!child(drawer, ".ge-drawer-more")) {
|
|
3542
|
-
createTool(drawer, t("tool.more"), "ge-drawer-more", "bi bi-three-dots", function() {
|
|
3543
|
-
toggleClass(drawer, "ge-drawer-expanded");
|
|
3567
|
+
var over = fits.filter(function(fit) {
|
|
3568
|
+
fit.rights = fit.tools.map(function(tool) {
|
|
3569
|
+
var rects = tool.getClientRects();
|
|
3570
|
+
return rects.length ? rects[0].right : null;
|
|
3544
3571
|
});
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3572
|
+
return overflows(fit, roomOf(fit.drawer));
|
|
3573
|
+
});
|
|
3574
|
+
over.forEach(function(fit) {
|
|
3575
|
+
addClass(fit.drawer, "ge-drawer-overflow");
|
|
3576
|
+
});
|
|
3577
|
+
over.forEach(function(fit) {
|
|
3578
|
+
fit.room = roomOf(fit.drawer);
|
|
3579
|
+
});
|
|
3580
|
+
over.forEach(function(fit) {
|
|
3581
|
+
for (var i = fit.tools.length - 1; i >= 0 && overflows(fit, fit.room, i); i--) {
|
|
3582
|
+
addClass(fit.tools[i], "ge-tool-overflow");
|
|
3583
|
+
}
|
|
3584
|
+
if (!child(fit.drawer, ".ge-drawer-more")) {
|
|
3585
|
+
createTool(fit.drawer, t("tool.more"), "ge-drawer-more", "bi bi-three-dots", function() {
|
|
3586
|
+
toggleClass(fit.drawer, "ge-drawer-expanded");
|
|
3587
|
+
});
|
|
3588
|
+
}
|
|
3589
|
+
toggleClass(fit.drawer, "ge-drawer-expanded", fit.expanded);
|
|
3590
|
+
});
|
|
3550
3591
|
}
|
|
3551
|
-
function
|
|
3592
|
+
function roomOf(drawer) {
|
|
3552
3593
|
var style = window.getComputedStyle(drawer);
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3594
|
+
return drawer.getBoundingClientRect().right - parseFloat(style.borderRightWidth) - parseFloat(style.paddingRight);
|
|
3595
|
+
}
|
|
3596
|
+
function overflows(fit, room, last) {
|
|
3597
|
+
last = last === void 0 ? fit.rights.length - 1 : last;
|
|
3598
|
+
for (var i = 0; i <= last; i++) {
|
|
3599
|
+
if (fit.rights[i] !== null && fit.rights[i] > room + 0.5) {
|
|
3600
|
+
return true;
|
|
3601
|
+
}
|
|
3602
|
+
}
|
|
3603
|
+
return false;
|
|
3558
3604
|
}
|
|
3559
3605
|
function createTool(drawer, title, className, iconClass, eventHandlers) {
|
|
3560
3606
|
var tool = element("a", { title, "class": className });
|
|
@@ -5338,7 +5384,7 @@ GridEditor.t = translate;
|
|
|
5338
5384
|
GridEditor._plainHtml = plainHtml;
|
|
5339
5385
|
GridEditor.Sortable = null;
|
|
5340
5386
|
GridEditor.bootstrap = null;
|
|
5341
|
-
GridEditor.version = false ? "dev" : "9.1.
|
|
5387
|
+
GridEditor.version = false ? "dev" : "9.1.1";
|
|
5342
5388
|
GridEditor.locales = {
|
|
5343
5389
|
en: {
|
|
5344
5390
|
"tool.move": "Move",
|
package/dist/grideditor.js
CHANGED
|
@@ -1168,7 +1168,23 @@
|
|
|
1168
1168
|
createMainControls();
|
|
1169
1169
|
watchDrawers();
|
|
1170
1170
|
var signal = { signal: lifetime.signal };
|
|
1171
|
-
|
|
1171
|
+
var scrollFrame = null;
|
|
1172
|
+
window.addEventListener("scroll", function() {
|
|
1173
|
+
if (scrollFrame !== null) {
|
|
1174
|
+
return;
|
|
1175
|
+
}
|
|
1176
|
+
scrollFrame = window.requestAnimationFrame(function() {
|
|
1177
|
+
scrollFrame = null;
|
|
1178
|
+
if (!destroyed && mainControls) {
|
|
1179
|
+
onScroll();
|
|
1180
|
+
}
|
|
1181
|
+
});
|
|
1182
|
+
}, signal);
|
|
1183
|
+
lifetime.signal.addEventListener("abort", function() {
|
|
1184
|
+
if (scrollFrame !== null) {
|
|
1185
|
+
window.cancelAnimationFrame(scrollFrame);
|
|
1186
|
+
}
|
|
1187
|
+
});
|
|
1172
1188
|
delegate(canvas, "click", ".ge-content", onContentClick, signal);
|
|
1173
1189
|
if (settings.active_target) {
|
|
1174
1190
|
var pressed = null;
|
|
@@ -2231,19 +2247,27 @@
|
|
|
2231
2247
|
return names;
|
|
2232
2248
|
}
|
|
2233
2249
|
function copyCanvas() {
|
|
2234
|
-
var copy = canvas.cloneNode(true);
|
|
2235
2250
|
var toLive = /* @__PURE__ */ new Map();
|
|
2236
2251
|
var toCopy = /* @__PURE__ */ new Map();
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
toLive.set(
|
|
2243
|
-
toCopy.set(
|
|
2244
|
-
|
|
2245
|
-
|
|
2252
|
+
function copyNode(live) {
|
|
2253
|
+
var copied = live.cloneNode(live.nodeName === "TEMPLATE");
|
|
2254
|
+
if (live.nodeType !== 1) {
|
|
2255
|
+
return copied;
|
|
2256
|
+
}
|
|
2257
|
+
toLive.set(copied, live);
|
|
2258
|
+
toCopy.set(live, copied);
|
|
2259
|
+
if (live.nodeName === "TEMPLATE") {
|
|
2260
|
+
return copied;
|
|
2261
|
+
}
|
|
2262
|
+
for (var child2 = live.firstChild; child2; child2 = child2.nextSibling) {
|
|
2263
|
+
if (child2.nodeType === 1 && hasClass(child2, "ge-tools-drawer")) {
|
|
2264
|
+
continue;
|
|
2265
|
+
}
|
|
2266
|
+
copied.appendChild(copyNode(child2));
|
|
2267
|
+
}
|
|
2268
|
+
return copied;
|
|
2246
2269
|
}
|
|
2270
|
+
var copy = copyNode(canvas);
|
|
2247
2271
|
return {
|
|
2248
2272
|
root: copy,
|
|
2249
2273
|
liveOf: function(node) {
|
|
@@ -3476,15 +3500,15 @@
|
|
|
3476
3500
|
}
|
|
3477
3501
|
function flush() {
|
|
3478
3502
|
frame = null;
|
|
3479
|
-
var drawers = Array.from(due)
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
if (!drawer.isConnected) {
|
|
3483
|
-
drawerResizes.unobserve(drawer);
|
|
3484
|
-
return;
|
|
3503
|
+
var drawers = Array.from(due).filter(function(drawer) {
|
|
3504
|
+
if (drawer.isConnected) {
|
|
3505
|
+
return true;
|
|
3485
3506
|
}
|
|
3486
|
-
|
|
3507
|
+
drawerResizes.unobserve(drawer);
|
|
3508
|
+
return false;
|
|
3487
3509
|
});
|
|
3510
|
+
due.clear();
|
|
3511
|
+
fitDrawers(drawers);
|
|
3488
3512
|
}
|
|
3489
3513
|
var drawerResizes = new window.ResizeObserver(function(entries) {
|
|
3490
3514
|
entries.forEach(function(entry) {
|
|
@@ -3526,36 +3550,58 @@
|
|
|
3526
3550
|
}
|
|
3527
3551
|
});
|
|
3528
3552
|
}
|
|
3529
|
-
function
|
|
3530
|
-
var
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
|
|
3553
|
+
function fitDrawers(drawers) {
|
|
3554
|
+
var fits = drawers.map(function(drawer) {
|
|
3555
|
+
var fit = {
|
|
3556
|
+
drawer,
|
|
3557
|
+
tools: children(drawer, "a").filter(function(tool) {
|
|
3558
|
+
return !hasClass(tool, "ge-drawer-more");
|
|
3559
|
+
}),
|
|
3560
|
+
expanded: hasClass(drawer, "ge-drawer-expanded")
|
|
3561
|
+
};
|
|
3562
|
+
removeClass(drawer, "ge-drawer-overflow ge-drawer-expanded");
|
|
3563
|
+
fit.tools.forEach(function(tool) {
|
|
3564
|
+
removeClass(tool, "ge-tool-overflow");
|
|
3565
|
+
});
|
|
3566
|
+
return fit;
|
|
3537
3567
|
});
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
if (!child(drawer, ".ge-drawer-more")) {
|
|
3543
|
-
createTool(drawer, t("tool.more"), "ge-drawer-more", "bi bi-three-dots", function() {
|
|
3544
|
-
toggleClass(drawer, "ge-drawer-expanded");
|
|
3568
|
+
var over = fits.filter(function(fit) {
|
|
3569
|
+
fit.rights = fit.tools.map(function(tool) {
|
|
3570
|
+
var rects = tool.getClientRects();
|
|
3571
|
+
return rects.length ? rects[0].right : null;
|
|
3545
3572
|
});
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3573
|
+
return overflows(fit, roomOf(fit.drawer));
|
|
3574
|
+
});
|
|
3575
|
+
over.forEach(function(fit) {
|
|
3576
|
+
addClass(fit.drawer, "ge-drawer-overflow");
|
|
3577
|
+
});
|
|
3578
|
+
over.forEach(function(fit) {
|
|
3579
|
+
fit.room = roomOf(fit.drawer);
|
|
3580
|
+
});
|
|
3581
|
+
over.forEach(function(fit) {
|
|
3582
|
+
for (var i = fit.tools.length - 1; i >= 0 && overflows(fit, fit.room, i); i--) {
|
|
3583
|
+
addClass(fit.tools[i], "ge-tool-overflow");
|
|
3584
|
+
}
|
|
3585
|
+
if (!child(fit.drawer, ".ge-drawer-more")) {
|
|
3586
|
+
createTool(fit.drawer, t("tool.more"), "ge-drawer-more", "bi bi-three-dots", function() {
|
|
3587
|
+
toggleClass(fit.drawer, "ge-drawer-expanded");
|
|
3588
|
+
});
|
|
3589
|
+
}
|
|
3590
|
+
toggleClass(fit.drawer, "ge-drawer-expanded", fit.expanded);
|
|
3591
|
+
});
|
|
3551
3592
|
}
|
|
3552
|
-
function
|
|
3593
|
+
function roomOf(drawer) {
|
|
3553
3594
|
var style = window.getComputedStyle(drawer);
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3595
|
+
return drawer.getBoundingClientRect().right - parseFloat(style.borderRightWidth) - parseFloat(style.paddingRight);
|
|
3596
|
+
}
|
|
3597
|
+
function overflows(fit, room, last) {
|
|
3598
|
+
last = last === void 0 ? fit.rights.length - 1 : last;
|
|
3599
|
+
for (var i = 0; i <= last; i++) {
|
|
3600
|
+
if (fit.rights[i] !== null && fit.rights[i] > room + 0.5) {
|
|
3601
|
+
return true;
|
|
3602
|
+
}
|
|
3603
|
+
}
|
|
3604
|
+
return false;
|
|
3559
3605
|
}
|
|
3560
3606
|
function createTool(drawer, title, className, iconClass, eventHandlers) {
|
|
3561
3607
|
var tool = element("a", { title, "class": className });
|
|
@@ -5339,7 +5385,7 @@
|
|
|
5339
5385
|
GridEditor._plainHtml = plainHtml;
|
|
5340
5386
|
GridEditor.Sortable = null;
|
|
5341
5387
|
GridEditor.bootstrap = null;
|
|
5342
|
-
GridEditor.version = false ? "dev" : "9.1.
|
|
5388
|
+
GridEditor.version = false ? "dev" : "9.1.1";
|
|
5343
5389
|
GridEditor.locales = {
|
|
5344
5390
|
en: {
|
|
5345
5391
|
"tool.move": "Move",
|