microboard-temp 0.4.63 → 0.4.64
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/dist/cjs/browser.js +69 -31
- package/dist/cjs/index.js +69 -31
- package/dist/cjs/node.js +69 -31
- package/dist/esm/browser.js +69 -31
- package/dist/esm/index.js +69 -31
- package/dist/esm/node.js +69 -31
- package/dist/types/SpatialIndex/SpacialIndex.d.ts +1 -0
- package/package.json +1 -1
package/dist/cjs/browser.js
CHANGED
|
@@ -18828,24 +18828,6 @@ class FrameCommand {
|
|
|
18828
18828
|
...this.operation
|
|
18829
18829
|
};
|
|
18830
18830
|
});
|
|
18831
|
-
default:
|
|
18832
|
-
return mapItemsByOperation(frame, (item) => {
|
|
18833
|
-
const op = this.operation;
|
|
18834
|
-
let newData = {};
|
|
18835
|
-
if (op.prevData) {
|
|
18836
|
-
newData = { ...op.prevData };
|
|
18837
|
-
} else {
|
|
18838
|
-
Object.keys(op.newData).forEach((key) => {
|
|
18839
|
-
if (item[key]) {
|
|
18840
|
-
newData[key] = item[key];
|
|
18841
|
-
}
|
|
18842
|
-
});
|
|
18843
|
-
}
|
|
18844
|
-
return {
|
|
18845
|
-
...op,
|
|
18846
|
-
newData
|
|
18847
|
-
};
|
|
18848
|
-
});
|
|
18849
18831
|
}
|
|
18850
18832
|
}
|
|
18851
18833
|
}
|
|
@@ -20825,6 +20807,11 @@ class SpatialIndex {
|
|
|
20825
20807
|
return this.getById(item.parent);
|
|
20826
20808
|
}
|
|
20827
20809
|
moveToZIndex(item, zIndex) {
|
|
20810
|
+
if (item.parent !== "Board") {
|
|
20811
|
+
this.getById(item.parent)?.index?.moveToZIndex(item, zIndex);
|
|
20812
|
+
this.subject.publish(this.items);
|
|
20813
|
+
return;
|
|
20814
|
+
}
|
|
20828
20815
|
const index2 = this.itemsArray.indexOf(item);
|
|
20829
20816
|
this.itemsArray.splice(index2, 1);
|
|
20830
20817
|
this.itemsArray.splice(zIndex, 0, item);
|
|
@@ -20841,6 +20828,13 @@ class SpatialIndex {
|
|
|
20841
20828
|
this.itemsArray.forEach(this.change.bind(this));
|
|
20842
20829
|
}
|
|
20843
20830
|
sendToBack(item, shouldPublish = true) {
|
|
20831
|
+
if (item.parent !== "Board") {
|
|
20832
|
+
this.getById(item.parent)?.index?.sendToBack(item);
|
|
20833
|
+
if (shouldPublish) {
|
|
20834
|
+
this.subject.publish(this.items);
|
|
20835
|
+
}
|
|
20836
|
+
return;
|
|
20837
|
+
}
|
|
20844
20838
|
const index2 = this.itemsArray.indexOf(item);
|
|
20845
20839
|
this.itemsArray.splice(index2, 1);
|
|
20846
20840
|
this.itemsArray.unshift(item);
|
|
@@ -20850,16 +20844,31 @@ class SpatialIndex {
|
|
|
20850
20844
|
}
|
|
20851
20845
|
}
|
|
20852
20846
|
sendManyToBack(items) {
|
|
20853
|
-
const
|
|
20854
|
-
|
|
20855
|
-
if (
|
|
20856
|
-
|
|
20847
|
+
const groups = this.splitItemsToGroups(items);
|
|
20848
|
+
Object.entries(groups).forEach(([key, value]) => {
|
|
20849
|
+
if (key !== "Board") {
|
|
20850
|
+
this.getById(key)?.index?.sendManyToBack(value);
|
|
20857
20851
|
}
|
|
20858
20852
|
});
|
|
20859
|
-
|
|
20860
|
-
|
|
20853
|
+
if (groups["Board"]) {
|
|
20854
|
+
const newItems = [...groups["Board"]];
|
|
20855
|
+
this.itemsArray.forEach((item) => {
|
|
20856
|
+
if (!groups["Board"].includes(item)) {
|
|
20857
|
+
newItems.push(item);
|
|
20858
|
+
}
|
|
20859
|
+
});
|
|
20860
|
+
this.itemsArray = newItems;
|
|
20861
|
+
this.itemsArray.forEach(this.change.bind(this));
|
|
20862
|
+
}
|
|
20861
20863
|
}
|
|
20862
20864
|
bringToFront(item, shouldPublish = true) {
|
|
20865
|
+
if (item.parent !== "Board") {
|
|
20866
|
+
this.getById(item.parent)?.index?.bringToFront(item);
|
|
20867
|
+
if (shouldPublish) {
|
|
20868
|
+
this.subject.publish(this.items);
|
|
20869
|
+
}
|
|
20870
|
+
return;
|
|
20871
|
+
}
|
|
20863
20872
|
const index2 = this.itemsArray.indexOf(item);
|
|
20864
20873
|
this.itemsArray.splice(index2, 1);
|
|
20865
20874
|
this.itemsArray.push(item);
|
|
@@ -20869,17 +20878,41 @@ class SpatialIndex {
|
|
|
20869
20878
|
}
|
|
20870
20879
|
}
|
|
20871
20880
|
bringManyToFront(items) {
|
|
20872
|
-
const
|
|
20873
|
-
|
|
20874
|
-
if (
|
|
20875
|
-
|
|
20881
|
+
const groups = this.splitItemsToGroups(items);
|
|
20882
|
+
Object.entries(groups).forEach(([key, value]) => {
|
|
20883
|
+
if (key !== "Board") {
|
|
20884
|
+
this.getById(key)?.index?.bringManyToFront(value);
|
|
20876
20885
|
}
|
|
20877
20886
|
});
|
|
20878
|
-
|
|
20879
|
-
|
|
20880
|
-
|
|
20887
|
+
if (groups["Board"]) {
|
|
20888
|
+
const newItems = [];
|
|
20889
|
+
this.itemsArray.forEach((item) => {
|
|
20890
|
+
if (!groups["Board"].includes(item)) {
|
|
20891
|
+
newItems.push(item);
|
|
20892
|
+
}
|
|
20893
|
+
});
|
|
20894
|
+
newItems.push(...groups["Board"]);
|
|
20895
|
+
this.itemsArray = newItems;
|
|
20896
|
+
this.itemsArray.forEach(this.change.bind(this));
|
|
20897
|
+
}
|
|
20898
|
+
}
|
|
20899
|
+
splitItemsToGroups(items) {
|
|
20900
|
+
const groups = {};
|
|
20901
|
+
for (const item of items) {
|
|
20902
|
+
if (!groups[item.parent]) {
|
|
20903
|
+
groups[item.parent] = [item];
|
|
20904
|
+
} else {
|
|
20905
|
+
groups[item.parent].push(item);
|
|
20906
|
+
}
|
|
20907
|
+
}
|
|
20908
|
+
return groups;
|
|
20881
20909
|
}
|
|
20882
20910
|
moveSecondAfterFirst(first, second) {
|
|
20911
|
+
if (first.parent !== "Board" && second.parent === first.parent) {
|
|
20912
|
+
this.getById(first.parent)?.index?.moveSecondAfterFirst(first, second);
|
|
20913
|
+
this.subject.publish(this.items);
|
|
20914
|
+
return;
|
|
20915
|
+
}
|
|
20883
20916
|
const secondIndex = this.itemsArray.indexOf(second);
|
|
20884
20917
|
this.itemsArray.splice(secondIndex, 1);
|
|
20885
20918
|
const firstIndex = this.itemsArray.indexOf(first);
|
|
@@ -20889,6 +20922,11 @@ class SpatialIndex {
|
|
|
20889
20922
|
this.subject.publish(this.items);
|
|
20890
20923
|
}
|
|
20891
20924
|
moveSecondBeforeFirst(first, second) {
|
|
20925
|
+
if (first.parent !== "Board" && second.parent === first.parent) {
|
|
20926
|
+
this.getById(first.parent)?.index?.moveSecondBeforeFirst(first, second);
|
|
20927
|
+
this.subject.publish(this.items);
|
|
20928
|
+
return;
|
|
20929
|
+
}
|
|
20892
20930
|
const secondIndex = this.itemsArray.indexOf(second);
|
|
20893
20931
|
this.itemsArray.splice(secondIndex, 1);
|
|
20894
20932
|
const firstIndex = this.itemsArray.indexOf(first);
|
package/dist/cjs/index.js
CHANGED
|
@@ -18828,24 +18828,6 @@ class FrameCommand {
|
|
|
18828
18828
|
...this.operation
|
|
18829
18829
|
};
|
|
18830
18830
|
});
|
|
18831
|
-
default:
|
|
18832
|
-
return mapItemsByOperation(frame, (item) => {
|
|
18833
|
-
const op = this.operation;
|
|
18834
|
-
let newData = {};
|
|
18835
|
-
if (op.prevData) {
|
|
18836
|
-
newData = { ...op.prevData };
|
|
18837
|
-
} else {
|
|
18838
|
-
Object.keys(op.newData).forEach((key) => {
|
|
18839
|
-
if (item[key]) {
|
|
18840
|
-
newData[key] = item[key];
|
|
18841
|
-
}
|
|
18842
|
-
});
|
|
18843
|
-
}
|
|
18844
|
-
return {
|
|
18845
|
-
...op,
|
|
18846
|
-
newData
|
|
18847
|
-
};
|
|
18848
|
-
});
|
|
18849
18831
|
}
|
|
18850
18832
|
}
|
|
18851
18833
|
}
|
|
@@ -20825,6 +20807,11 @@ class SpatialIndex {
|
|
|
20825
20807
|
return this.getById(item.parent);
|
|
20826
20808
|
}
|
|
20827
20809
|
moveToZIndex(item, zIndex) {
|
|
20810
|
+
if (item.parent !== "Board") {
|
|
20811
|
+
this.getById(item.parent)?.index?.moveToZIndex(item, zIndex);
|
|
20812
|
+
this.subject.publish(this.items);
|
|
20813
|
+
return;
|
|
20814
|
+
}
|
|
20828
20815
|
const index2 = this.itemsArray.indexOf(item);
|
|
20829
20816
|
this.itemsArray.splice(index2, 1);
|
|
20830
20817
|
this.itemsArray.splice(zIndex, 0, item);
|
|
@@ -20841,6 +20828,13 @@ class SpatialIndex {
|
|
|
20841
20828
|
this.itemsArray.forEach(this.change.bind(this));
|
|
20842
20829
|
}
|
|
20843
20830
|
sendToBack(item, shouldPublish = true) {
|
|
20831
|
+
if (item.parent !== "Board") {
|
|
20832
|
+
this.getById(item.parent)?.index?.sendToBack(item);
|
|
20833
|
+
if (shouldPublish) {
|
|
20834
|
+
this.subject.publish(this.items);
|
|
20835
|
+
}
|
|
20836
|
+
return;
|
|
20837
|
+
}
|
|
20844
20838
|
const index2 = this.itemsArray.indexOf(item);
|
|
20845
20839
|
this.itemsArray.splice(index2, 1);
|
|
20846
20840
|
this.itemsArray.unshift(item);
|
|
@@ -20850,16 +20844,31 @@ class SpatialIndex {
|
|
|
20850
20844
|
}
|
|
20851
20845
|
}
|
|
20852
20846
|
sendManyToBack(items) {
|
|
20853
|
-
const
|
|
20854
|
-
|
|
20855
|
-
if (
|
|
20856
|
-
|
|
20847
|
+
const groups = this.splitItemsToGroups(items);
|
|
20848
|
+
Object.entries(groups).forEach(([key, value]) => {
|
|
20849
|
+
if (key !== "Board") {
|
|
20850
|
+
this.getById(key)?.index?.sendManyToBack(value);
|
|
20857
20851
|
}
|
|
20858
20852
|
});
|
|
20859
|
-
|
|
20860
|
-
|
|
20853
|
+
if (groups["Board"]) {
|
|
20854
|
+
const newItems = [...groups["Board"]];
|
|
20855
|
+
this.itemsArray.forEach((item) => {
|
|
20856
|
+
if (!groups["Board"].includes(item)) {
|
|
20857
|
+
newItems.push(item);
|
|
20858
|
+
}
|
|
20859
|
+
});
|
|
20860
|
+
this.itemsArray = newItems;
|
|
20861
|
+
this.itemsArray.forEach(this.change.bind(this));
|
|
20862
|
+
}
|
|
20861
20863
|
}
|
|
20862
20864
|
bringToFront(item, shouldPublish = true) {
|
|
20865
|
+
if (item.parent !== "Board") {
|
|
20866
|
+
this.getById(item.parent)?.index?.bringToFront(item);
|
|
20867
|
+
if (shouldPublish) {
|
|
20868
|
+
this.subject.publish(this.items);
|
|
20869
|
+
}
|
|
20870
|
+
return;
|
|
20871
|
+
}
|
|
20863
20872
|
const index2 = this.itemsArray.indexOf(item);
|
|
20864
20873
|
this.itemsArray.splice(index2, 1);
|
|
20865
20874
|
this.itemsArray.push(item);
|
|
@@ -20869,17 +20878,41 @@ class SpatialIndex {
|
|
|
20869
20878
|
}
|
|
20870
20879
|
}
|
|
20871
20880
|
bringManyToFront(items) {
|
|
20872
|
-
const
|
|
20873
|
-
|
|
20874
|
-
if (
|
|
20875
|
-
|
|
20881
|
+
const groups = this.splitItemsToGroups(items);
|
|
20882
|
+
Object.entries(groups).forEach(([key, value]) => {
|
|
20883
|
+
if (key !== "Board") {
|
|
20884
|
+
this.getById(key)?.index?.bringManyToFront(value);
|
|
20876
20885
|
}
|
|
20877
20886
|
});
|
|
20878
|
-
|
|
20879
|
-
|
|
20880
|
-
|
|
20887
|
+
if (groups["Board"]) {
|
|
20888
|
+
const newItems = [];
|
|
20889
|
+
this.itemsArray.forEach((item) => {
|
|
20890
|
+
if (!groups["Board"].includes(item)) {
|
|
20891
|
+
newItems.push(item);
|
|
20892
|
+
}
|
|
20893
|
+
});
|
|
20894
|
+
newItems.push(...groups["Board"]);
|
|
20895
|
+
this.itemsArray = newItems;
|
|
20896
|
+
this.itemsArray.forEach(this.change.bind(this));
|
|
20897
|
+
}
|
|
20898
|
+
}
|
|
20899
|
+
splitItemsToGroups(items) {
|
|
20900
|
+
const groups = {};
|
|
20901
|
+
for (const item of items) {
|
|
20902
|
+
if (!groups[item.parent]) {
|
|
20903
|
+
groups[item.parent] = [item];
|
|
20904
|
+
} else {
|
|
20905
|
+
groups[item.parent].push(item);
|
|
20906
|
+
}
|
|
20907
|
+
}
|
|
20908
|
+
return groups;
|
|
20881
20909
|
}
|
|
20882
20910
|
moveSecondAfterFirst(first, second) {
|
|
20911
|
+
if (first.parent !== "Board" && second.parent === first.parent) {
|
|
20912
|
+
this.getById(first.parent)?.index?.moveSecondAfterFirst(first, second);
|
|
20913
|
+
this.subject.publish(this.items);
|
|
20914
|
+
return;
|
|
20915
|
+
}
|
|
20883
20916
|
const secondIndex = this.itemsArray.indexOf(second);
|
|
20884
20917
|
this.itemsArray.splice(secondIndex, 1);
|
|
20885
20918
|
const firstIndex = this.itemsArray.indexOf(first);
|
|
@@ -20889,6 +20922,11 @@ class SpatialIndex {
|
|
|
20889
20922
|
this.subject.publish(this.items);
|
|
20890
20923
|
}
|
|
20891
20924
|
moveSecondBeforeFirst(first, second) {
|
|
20925
|
+
if (first.parent !== "Board" && second.parent === first.parent) {
|
|
20926
|
+
this.getById(first.parent)?.index?.moveSecondBeforeFirst(first, second);
|
|
20927
|
+
this.subject.publish(this.items);
|
|
20928
|
+
return;
|
|
20929
|
+
}
|
|
20892
20930
|
const secondIndex = this.itemsArray.indexOf(second);
|
|
20893
20931
|
this.itemsArray.splice(secondIndex, 1);
|
|
20894
20932
|
const firstIndex = this.itemsArray.indexOf(first);
|
package/dist/cjs/node.js
CHANGED
|
@@ -21368,24 +21368,6 @@ class FrameCommand {
|
|
|
21368
21368
|
...this.operation
|
|
21369
21369
|
};
|
|
21370
21370
|
});
|
|
21371
|
-
default:
|
|
21372
|
-
return mapItemsByOperation(frame, (item) => {
|
|
21373
|
-
const op = this.operation;
|
|
21374
|
-
let newData = {};
|
|
21375
|
-
if (op.prevData) {
|
|
21376
|
-
newData = { ...op.prevData };
|
|
21377
|
-
} else {
|
|
21378
|
-
Object.keys(op.newData).forEach((key) => {
|
|
21379
|
-
if (item[key]) {
|
|
21380
|
-
newData[key] = item[key];
|
|
21381
|
-
}
|
|
21382
|
-
});
|
|
21383
|
-
}
|
|
21384
|
-
return {
|
|
21385
|
-
...op,
|
|
21386
|
-
newData
|
|
21387
|
-
};
|
|
21388
|
-
});
|
|
21389
21371
|
}
|
|
21390
21372
|
}
|
|
21391
21373
|
}
|
|
@@ -23297,6 +23279,11 @@ class SpatialIndex {
|
|
|
23297
23279
|
return this.getById(item.parent);
|
|
23298
23280
|
}
|
|
23299
23281
|
moveToZIndex(item, zIndex) {
|
|
23282
|
+
if (item.parent !== "Board") {
|
|
23283
|
+
this.getById(item.parent)?.index?.moveToZIndex(item, zIndex);
|
|
23284
|
+
this.subject.publish(this.items);
|
|
23285
|
+
return;
|
|
23286
|
+
}
|
|
23300
23287
|
const index2 = this.itemsArray.indexOf(item);
|
|
23301
23288
|
this.itemsArray.splice(index2, 1);
|
|
23302
23289
|
this.itemsArray.splice(zIndex, 0, item);
|
|
@@ -23313,6 +23300,13 @@ class SpatialIndex {
|
|
|
23313
23300
|
this.itemsArray.forEach(this.change.bind(this));
|
|
23314
23301
|
}
|
|
23315
23302
|
sendToBack(item, shouldPublish = true) {
|
|
23303
|
+
if (item.parent !== "Board") {
|
|
23304
|
+
this.getById(item.parent)?.index?.sendToBack(item);
|
|
23305
|
+
if (shouldPublish) {
|
|
23306
|
+
this.subject.publish(this.items);
|
|
23307
|
+
}
|
|
23308
|
+
return;
|
|
23309
|
+
}
|
|
23316
23310
|
const index2 = this.itemsArray.indexOf(item);
|
|
23317
23311
|
this.itemsArray.splice(index2, 1);
|
|
23318
23312
|
this.itemsArray.unshift(item);
|
|
@@ -23322,16 +23316,31 @@ class SpatialIndex {
|
|
|
23322
23316
|
}
|
|
23323
23317
|
}
|
|
23324
23318
|
sendManyToBack(items) {
|
|
23325
|
-
const
|
|
23326
|
-
|
|
23327
|
-
if (
|
|
23328
|
-
|
|
23319
|
+
const groups = this.splitItemsToGroups(items);
|
|
23320
|
+
Object.entries(groups).forEach(([key, value]) => {
|
|
23321
|
+
if (key !== "Board") {
|
|
23322
|
+
this.getById(key)?.index?.sendManyToBack(value);
|
|
23329
23323
|
}
|
|
23330
23324
|
});
|
|
23331
|
-
|
|
23332
|
-
|
|
23325
|
+
if (groups["Board"]) {
|
|
23326
|
+
const newItems = [...groups["Board"]];
|
|
23327
|
+
this.itemsArray.forEach((item) => {
|
|
23328
|
+
if (!groups["Board"].includes(item)) {
|
|
23329
|
+
newItems.push(item);
|
|
23330
|
+
}
|
|
23331
|
+
});
|
|
23332
|
+
this.itemsArray = newItems;
|
|
23333
|
+
this.itemsArray.forEach(this.change.bind(this));
|
|
23334
|
+
}
|
|
23333
23335
|
}
|
|
23334
23336
|
bringToFront(item, shouldPublish = true) {
|
|
23337
|
+
if (item.parent !== "Board") {
|
|
23338
|
+
this.getById(item.parent)?.index?.bringToFront(item);
|
|
23339
|
+
if (shouldPublish) {
|
|
23340
|
+
this.subject.publish(this.items);
|
|
23341
|
+
}
|
|
23342
|
+
return;
|
|
23343
|
+
}
|
|
23335
23344
|
const index2 = this.itemsArray.indexOf(item);
|
|
23336
23345
|
this.itemsArray.splice(index2, 1);
|
|
23337
23346
|
this.itemsArray.push(item);
|
|
@@ -23341,17 +23350,41 @@ class SpatialIndex {
|
|
|
23341
23350
|
}
|
|
23342
23351
|
}
|
|
23343
23352
|
bringManyToFront(items) {
|
|
23344
|
-
const
|
|
23345
|
-
|
|
23346
|
-
if (
|
|
23347
|
-
|
|
23353
|
+
const groups = this.splitItemsToGroups(items);
|
|
23354
|
+
Object.entries(groups).forEach(([key, value]) => {
|
|
23355
|
+
if (key !== "Board") {
|
|
23356
|
+
this.getById(key)?.index?.bringManyToFront(value);
|
|
23348
23357
|
}
|
|
23349
23358
|
});
|
|
23350
|
-
|
|
23351
|
-
|
|
23352
|
-
|
|
23359
|
+
if (groups["Board"]) {
|
|
23360
|
+
const newItems = [];
|
|
23361
|
+
this.itemsArray.forEach((item) => {
|
|
23362
|
+
if (!groups["Board"].includes(item)) {
|
|
23363
|
+
newItems.push(item);
|
|
23364
|
+
}
|
|
23365
|
+
});
|
|
23366
|
+
newItems.push(...groups["Board"]);
|
|
23367
|
+
this.itemsArray = newItems;
|
|
23368
|
+
this.itemsArray.forEach(this.change.bind(this));
|
|
23369
|
+
}
|
|
23370
|
+
}
|
|
23371
|
+
splitItemsToGroups(items) {
|
|
23372
|
+
const groups = {};
|
|
23373
|
+
for (const item of items) {
|
|
23374
|
+
if (!groups[item.parent]) {
|
|
23375
|
+
groups[item.parent] = [item];
|
|
23376
|
+
} else {
|
|
23377
|
+
groups[item.parent].push(item);
|
|
23378
|
+
}
|
|
23379
|
+
}
|
|
23380
|
+
return groups;
|
|
23353
23381
|
}
|
|
23354
23382
|
moveSecondAfterFirst(first, second) {
|
|
23383
|
+
if (first.parent !== "Board" && second.parent === first.parent) {
|
|
23384
|
+
this.getById(first.parent)?.index?.moveSecondAfterFirst(first, second);
|
|
23385
|
+
this.subject.publish(this.items);
|
|
23386
|
+
return;
|
|
23387
|
+
}
|
|
23355
23388
|
const secondIndex = this.itemsArray.indexOf(second);
|
|
23356
23389
|
this.itemsArray.splice(secondIndex, 1);
|
|
23357
23390
|
const firstIndex = this.itemsArray.indexOf(first);
|
|
@@ -23361,6 +23394,11 @@ class SpatialIndex {
|
|
|
23361
23394
|
this.subject.publish(this.items);
|
|
23362
23395
|
}
|
|
23363
23396
|
moveSecondBeforeFirst(first, second) {
|
|
23397
|
+
if (first.parent !== "Board" && second.parent === first.parent) {
|
|
23398
|
+
this.getById(first.parent)?.index?.moveSecondBeforeFirst(first, second);
|
|
23399
|
+
this.subject.publish(this.items);
|
|
23400
|
+
return;
|
|
23401
|
+
}
|
|
23364
23402
|
const secondIndex = this.itemsArray.indexOf(second);
|
|
23365
23403
|
this.itemsArray.splice(secondIndex, 1);
|
|
23366
23404
|
const firstIndex = this.itemsArray.indexOf(first);
|
package/dist/esm/browser.js
CHANGED
|
@@ -18678,24 +18678,6 @@ class FrameCommand {
|
|
|
18678
18678
|
...this.operation
|
|
18679
18679
|
};
|
|
18680
18680
|
});
|
|
18681
|
-
default:
|
|
18682
|
-
return mapItemsByOperation(frame, (item) => {
|
|
18683
|
-
const op = this.operation;
|
|
18684
|
-
let newData = {};
|
|
18685
|
-
if (op.prevData) {
|
|
18686
|
-
newData = { ...op.prevData };
|
|
18687
|
-
} else {
|
|
18688
|
-
Object.keys(op.newData).forEach((key) => {
|
|
18689
|
-
if (item[key]) {
|
|
18690
|
-
newData[key] = item[key];
|
|
18691
|
-
}
|
|
18692
|
-
});
|
|
18693
|
-
}
|
|
18694
|
-
return {
|
|
18695
|
-
...op,
|
|
18696
|
-
newData
|
|
18697
|
-
};
|
|
18698
|
-
});
|
|
18699
18681
|
}
|
|
18700
18682
|
}
|
|
18701
18683
|
}
|
|
@@ -20675,6 +20657,11 @@ class SpatialIndex {
|
|
|
20675
20657
|
return this.getById(item.parent);
|
|
20676
20658
|
}
|
|
20677
20659
|
moveToZIndex(item, zIndex) {
|
|
20660
|
+
if (item.parent !== "Board") {
|
|
20661
|
+
this.getById(item.parent)?.index?.moveToZIndex(item, zIndex);
|
|
20662
|
+
this.subject.publish(this.items);
|
|
20663
|
+
return;
|
|
20664
|
+
}
|
|
20678
20665
|
const index2 = this.itemsArray.indexOf(item);
|
|
20679
20666
|
this.itemsArray.splice(index2, 1);
|
|
20680
20667
|
this.itemsArray.splice(zIndex, 0, item);
|
|
@@ -20691,6 +20678,13 @@ class SpatialIndex {
|
|
|
20691
20678
|
this.itemsArray.forEach(this.change.bind(this));
|
|
20692
20679
|
}
|
|
20693
20680
|
sendToBack(item, shouldPublish = true) {
|
|
20681
|
+
if (item.parent !== "Board") {
|
|
20682
|
+
this.getById(item.parent)?.index?.sendToBack(item);
|
|
20683
|
+
if (shouldPublish) {
|
|
20684
|
+
this.subject.publish(this.items);
|
|
20685
|
+
}
|
|
20686
|
+
return;
|
|
20687
|
+
}
|
|
20694
20688
|
const index2 = this.itemsArray.indexOf(item);
|
|
20695
20689
|
this.itemsArray.splice(index2, 1);
|
|
20696
20690
|
this.itemsArray.unshift(item);
|
|
@@ -20700,16 +20694,31 @@ class SpatialIndex {
|
|
|
20700
20694
|
}
|
|
20701
20695
|
}
|
|
20702
20696
|
sendManyToBack(items) {
|
|
20703
|
-
const
|
|
20704
|
-
|
|
20705
|
-
if (
|
|
20706
|
-
|
|
20697
|
+
const groups = this.splitItemsToGroups(items);
|
|
20698
|
+
Object.entries(groups).forEach(([key, value]) => {
|
|
20699
|
+
if (key !== "Board") {
|
|
20700
|
+
this.getById(key)?.index?.sendManyToBack(value);
|
|
20707
20701
|
}
|
|
20708
20702
|
});
|
|
20709
|
-
|
|
20710
|
-
|
|
20703
|
+
if (groups["Board"]) {
|
|
20704
|
+
const newItems = [...groups["Board"]];
|
|
20705
|
+
this.itemsArray.forEach((item) => {
|
|
20706
|
+
if (!groups["Board"].includes(item)) {
|
|
20707
|
+
newItems.push(item);
|
|
20708
|
+
}
|
|
20709
|
+
});
|
|
20710
|
+
this.itemsArray = newItems;
|
|
20711
|
+
this.itemsArray.forEach(this.change.bind(this));
|
|
20712
|
+
}
|
|
20711
20713
|
}
|
|
20712
20714
|
bringToFront(item, shouldPublish = true) {
|
|
20715
|
+
if (item.parent !== "Board") {
|
|
20716
|
+
this.getById(item.parent)?.index?.bringToFront(item);
|
|
20717
|
+
if (shouldPublish) {
|
|
20718
|
+
this.subject.publish(this.items);
|
|
20719
|
+
}
|
|
20720
|
+
return;
|
|
20721
|
+
}
|
|
20713
20722
|
const index2 = this.itemsArray.indexOf(item);
|
|
20714
20723
|
this.itemsArray.splice(index2, 1);
|
|
20715
20724
|
this.itemsArray.push(item);
|
|
@@ -20719,17 +20728,41 @@ class SpatialIndex {
|
|
|
20719
20728
|
}
|
|
20720
20729
|
}
|
|
20721
20730
|
bringManyToFront(items) {
|
|
20722
|
-
const
|
|
20723
|
-
|
|
20724
|
-
if (
|
|
20725
|
-
|
|
20731
|
+
const groups = this.splitItemsToGroups(items);
|
|
20732
|
+
Object.entries(groups).forEach(([key, value]) => {
|
|
20733
|
+
if (key !== "Board") {
|
|
20734
|
+
this.getById(key)?.index?.bringManyToFront(value);
|
|
20726
20735
|
}
|
|
20727
20736
|
});
|
|
20728
|
-
|
|
20729
|
-
|
|
20730
|
-
|
|
20737
|
+
if (groups["Board"]) {
|
|
20738
|
+
const newItems = [];
|
|
20739
|
+
this.itemsArray.forEach((item) => {
|
|
20740
|
+
if (!groups["Board"].includes(item)) {
|
|
20741
|
+
newItems.push(item);
|
|
20742
|
+
}
|
|
20743
|
+
});
|
|
20744
|
+
newItems.push(...groups["Board"]);
|
|
20745
|
+
this.itemsArray = newItems;
|
|
20746
|
+
this.itemsArray.forEach(this.change.bind(this));
|
|
20747
|
+
}
|
|
20748
|
+
}
|
|
20749
|
+
splitItemsToGroups(items) {
|
|
20750
|
+
const groups = {};
|
|
20751
|
+
for (const item of items) {
|
|
20752
|
+
if (!groups[item.parent]) {
|
|
20753
|
+
groups[item.parent] = [item];
|
|
20754
|
+
} else {
|
|
20755
|
+
groups[item.parent].push(item);
|
|
20756
|
+
}
|
|
20757
|
+
}
|
|
20758
|
+
return groups;
|
|
20731
20759
|
}
|
|
20732
20760
|
moveSecondAfterFirst(first, second) {
|
|
20761
|
+
if (first.parent !== "Board" && second.parent === first.parent) {
|
|
20762
|
+
this.getById(first.parent)?.index?.moveSecondAfterFirst(first, second);
|
|
20763
|
+
this.subject.publish(this.items);
|
|
20764
|
+
return;
|
|
20765
|
+
}
|
|
20733
20766
|
const secondIndex = this.itemsArray.indexOf(second);
|
|
20734
20767
|
this.itemsArray.splice(secondIndex, 1);
|
|
20735
20768
|
const firstIndex = this.itemsArray.indexOf(first);
|
|
@@ -20739,6 +20772,11 @@ class SpatialIndex {
|
|
|
20739
20772
|
this.subject.publish(this.items);
|
|
20740
20773
|
}
|
|
20741
20774
|
moveSecondBeforeFirst(first, second) {
|
|
20775
|
+
if (first.parent !== "Board" && second.parent === first.parent) {
|
|
20776
|
+
this.getById(first.parent)?.index?.moveSecondBeforeFirst(first, second);
|
|
20777
|
+
this.subject.publish(this.items);
|
|
20778
|
+
return;
|
|
20779
|
+
}
|
|
20742
20780
|
const secondIndex = this.itemsArray.indexOf(second);
|
|
20743
20781
|
this.itemsArray.splice(secondIndex, 1);
|
|
20744
20782
|
const firstIndex = this.itemsArray.indexOf(first);
|
package/dist/esm/index.js
CHANGED
|
@@ -18671,24 +18671,6 @@ class FrameCommand {
|
|
|
18671
18671
|
...this.operation
|
|
18672
18672
|
};
|
|
18673
18673
|
});
|
|
18674
|
-
default:
|
|
18675
|
-
return mapItemsByOperation(frame, (item) => {
|
|
18676
|
-
const op = this.operation;
|
|
18677
|
-
let newData = {};
|
|
18678
|
-
if (op.prevData) {
|
|
18679
|
-
newData = { ...op.prevData };
|
|
18680
|
-
} else {
|
|
18681
|
-
Object.keys(op.newData).forEach((key) => {
|
|
18682
|
-
if (item[key]) {
|
|
18683
|
-
newData[key] = item[key];
|
|
18684
|
-
}
|
|
18685
|
-
});
|
|
18686
|
-
}
|
|
18687
|
-
return {
|
|
18688
|
-
...op,
|
|
18689
|
-
newData
|
|
18690
|
-
};
|
|
18691
|
-
});
|
|
18692
18674
|
}
|
|
18693
18675
|
}
|
|
18694
18676
|
}
|
|
@@ -20668,6 +20650,11 @@ class SpatialIndex {
|
|
|
20668
20650
|
return this.getById(item.parent);
|
|
20669
20651
|
}
|
|
20670
20652
|
moveToZIndex(item, zIndex) {
|
|
20653
|
+
if (item.parent !== "Board") {
|
|
20654
|
+
this.getById(item.parent)?.index?.moveToZIndex(item, zIndex);
|
|
20655
|
+
this.subject.publish(this.items);
|
|
20656
|
+
return;
|
|
20657
|
+
}
|
|
20671
20658
|
const index2 = this.itemsArray.indexOf(item);
|
|
20672
20659
|
this.itemsArray.splice(index2, 1);
|
|
20673
20660
|
this.itemsArray.splice(zIndex, 0, item);
|
|
@@ -20684,6 +20671,13 @@ class SpatialIndex {
|
|
|
20684
20671
|
this.itemsArray.forEach(this.change.bind(this));
|
|
20685
20672
|
}
|
|
20686
20673
|
sendToBack(item, shouldPublish = true) {
|
|
20674
|
+
if (item.parent !== "Board") {
|
|
20675
|
+
this.getById(item.parent)?.index?.sendToBack(item);
|
|
20676
|
+
if (shouldPublish) {
|
|
20677
|
+
this.subject.publish(this.items);
|
|
20678
|
+
}
|
|
20679
|
+
return;
|
|
20680
|
+
}
|
|
20687
20681
|
const index2 = this.itemsArray.indexOf(item);
|
|
20688
20682
|
this.itemsArray.splice(index2, 1);
|
|
20689
20683
|
this.itemsArray.unshift(item);
|
|
@@ -20693,16 +20687,31 @@ class SpatialIndex {
|
|
|
20693
20687
|
}
|
|
20694
20688
|
}
|
|
20695
20689
|
sendManyToBack(items) {
|
|
20696
|
-
const
|
|
20697
|
-
|
|
20698
|
-
if (
|
|
20699
|
-
|
|
20690
|
+
const groups = this.splitItemsToGroups(items);
|
|
20691
|
+
Object.entries(groups).forEach(([key, value]) => {
|
|
20692
|
+
if (key !== "Board") {
|
|
20693
|
+
this.getById(key)?.index?.sendManyToBack(value);
|
|
20700
20694
|
}
|
|
20701
20695
|
});
|
|
20702
|
-
|
|
20703
|
-
|
|
20696
|
+
if (groups["Board"]) {
|
|
20697
|
+
const newItems = [...groups["Board"]];
|
|
20698
|
+
this.itemsArray.forEach((item) => {
|
|
20699
|
+
if (!groups["Board"].includes(item)) {
|
|
20700
|
+
newItems.push(item);
|
|
20701
|
+
}
|
|
20702
|
+
});
|
|
20703
|
+
this.itemsArray = newItems;
|
|
20704
|
+
this.itemsArray.forEach(this.change.bind(this));
|
|
20705
|
+
}
|
|
20704
20706
|
}
|
|
20705
20707
|
bringToFront(item, shouldPublish = true) {
|
|
20708
|
+
if (item.parent !== "Board") {
|
|
20709
|
+
this.getById(item.parent)?.index?.bringToFront(item);
|
|
20710
|
+
if (shouldPublish) {
|
|
20711
|
+
this.subject.publish(this.items);
|
|
20712
|
+
}
|
|
20713
|
+
return;
|
|
20714
|
+
}
|
|
20706
20715
|
const index2 = this.itemsArray.indexOf(item);
|
|
20707
20716
|
this.itemsArray.splice(index2, 1);
|
|
20708
20717
|
this.itemsArray.push(item);
|
|
@@ -20712,17 +20721,41 @@ class SpatialIndex {
|
|
|
20712
20721
|
}
|
|
20713
20722
|
}
|
|
20714
20723
|
bringManyToFront(items) {
|
|
20715
|
-
const
|
|
20716
|
-
|
|
20717
|
-
if (
|
|
20718
|
-
|
|
20724
|
+
const groups = this.splitItemsToGroups(items);
|
|
20725
|
+
Object.entries(groups).forEach(([key, value]) => {
|
|
20726
|
+
if (key !== "Board") {
|
|
20727
|
+
this.getById(key)?.index?.bringManyToFront(value);
|
|
20719
20728
|
}
|
|
20720
20729
|
});
|
|
20721
|
-
|
|
20722
|
-
|
|
20723
|
-
|
|
20730
|
+
if (groups["Board"]) {
|
|
20731
|
+
const newItems = [];
|
|
20732
|
+
this.itemsArray.forEach((item) => {
|
|
20733
|
+
if (!groups["Board"].includes(item)) {
|
|
20734
|
+
newItems.push(item);
|
|
20735
|
+
}
|
|
20736
|
+
});
|
|
20737
|
+
newItems.push(...groups["Board"]);
|
|
20738
|
+
this.itemsArray = newItems;
|
|
20739
|
+
this.itemsArray.forEach(this.change.bind(this));
|
|
20740
|
+
}
|
|
20741
|
+
}
|
|
20742
|
+
splitItemsToGroups(items) {
|
|
20743
|
+
const groups = {};
|
|
20744
|
+
for (const item of items) {
|
|
20745
|
+
if (!groups[item.parent]) {
|
|
20746
|
+
groups[item.parent] = [item];
|
|
20747
|
+
} else {
|
|
20748
|
+
groups[item.parent].push(item);
|
|
20749
|
+
}
|
|
20750
|
+
}
|
|
20751
|
+
return groups;
|
|
20724
20752
|
}
|
|
20725
20753
|
moveSecondAfterFirst(first, second) {
|
|
20754
|
+
if (first.parent !== "Board" && second.parent === first.parent) {
|
|
20755
|
+
this.getById(first.parent)?.index?.moveSecondAfterFirst(first, second);
|
|
20756
|
+
this.subject.publish(this.items);
|
|
20757
|
+
return;
|
|
20758
|
+
}
|
|
20726
20759
|
const secondIndex = this.itemsArray.indexOf(second);
|
|
20727
20760
|
this.itemsArray.splice(secondIndex, 1);
|
|
20728
20761
|
const firstIndex = this.itemsArray.indexOf(first);
|
|
@@ -20732,6 +20765,11 @@ class SpatialIndex {
|
|
|
20732
20765
|
this.subject.publish(this.items);
|
|
20733
20766
|
}
|
|
20734
20767
|
moveSecondBeforeFirst(first, second) {
|
|
20768
|
+
if (first.parent !== "Board" && second.parent === first.parent) {
|
|
20769
|
+
this.getById(first.parent)?.index?.moveSecondBeforeFirst(first, second);
|
|
20770
|
+
this.subject.publish(this.items);
|
|
20771
|
+
return;
|
|
20772
|
+
}
|
|
20735
20773
|
const secondIndex = this.itemsArray.indexOf(second);
|
|
20736
20774
|
this.itemsArray.splice(secondIndex, 1);
|
|
20737
20775
|
const firstIndex = this.itemsArray.indexOf(first);
|
package/dist/esm/node.js
CHANGED
|
@@ -21206,24 +21206,6 @@ class FrameCommand {
|
|
|
21206
21206
|
...this.operation
|
|
21207
21207
|
};
|
|
21208
21208
|
});
|
|
21209
|
-
default:
|
|
21210
|
-
return mapItemsByOperation(frame, (item) => {
|
|
21211
|
-
const op = this.operation;
|
|
21212
|
-
let newData = {};
|
|
21213
|
-
if (op.prevData) {
|
|
21214
|
-
newData = { ...op.prevData };
|
|
21215
|
-
} else {
|
|
21216
|
-
Object.keys(op.newData).forEach((key) => {
|
|
21217
|
-
if (item[key]) {
|
|
21218
|
-
newData[key] = item[key];
|
|
21219
|
-
}
|
|
21220
|
-
});
|
|
21221
|
-
}
|
|
21222
|
-
return {
|
|
21223
|
-
...op,
|
|
21224
|
-
newData
|
|
21225
|
-
};
|
|
21226
|
-
});
|
|
21227
21209
|
}
|
|
21228
21210
|
}
|
|
21229
21211
|
}
|
|
@@ -23135,6 +23117,11 @@ class SpatialIndex {
|
|
|
23135
23117
|
return this.getById(item.parent);
|
|
23136
23118
|
}
|
|
23137
23119
|
moveToZIndex(item, zIndex) {
|
|
23120
|
+
if (item.parent !== "Board") {
|
|
23121
|
+
this.getById(item.parent)?.index?.moveToZIndex(item, zIndex);
|
|
23122
|
+
this.subject.publish(this.items);
|
|
23123
|
+
return;
|
|
23124
|
+
}
|
|
23138
23125
|
const index2 = this.itemsArray.indexOf(item);
|
|
23139
23126
|
this.itemsArray.splice(index2, 1);
|
|
23140
23127
|
this.itemsArray.splice(zIndex, 0, item);
|
|
@@ -23151,6 +23138,13 @@ class SpatialIndex {
|
|
|
23151
23138
|
this.itemsArray.forEach(this.change.bind(this));
|
|
23152
23139
|
}
|
|
23153
23140
|
sendToBack(item, shouldPublish = true) {
|
|
23141
|
+
if (item.parent !== "Board") {
|
|
23142
|
+
this.getById(item.parent)?.index?.sendToBack(item);
|
|
23143
|
+
if (shouldPublish) {
|
|
23144
|
+
this.subject.publish(this.items);
|
|
23145
|
+
}
|
|
23146
|
+
return;
|
|
23147
|
+
}
|
|
23154
23148
|
const index2 = this.itemsArray.indexOf(item);
|
|
23155
23149
|
this.itemsArray.splice(index2, 1);
|
|
23156
23150
|
this.itemsArray.unshift(item);
|
|
@@ -23160,16 +23154,31 @@ class SpatialIndex {
|
|
|
23160
23154
|
}
|
|
23161
23155
|
}
|
|
23162
23156
|
sendManyToBack(items) {
|
|
23163
|
-
const
|
|
23164
|
-
|
|
23165
|
-
if (
|
|
23166
|
-
|
|
23157
|
+
const groups = this.splitItemsToGroups(items);
|
|
23158
|
+
Object.entries(groups).forEach(([key, value]) => {
|
|
23159
|
+
if (key !== "Board") {
|
|
23160
|
+
this.getById(key)?.index?.sendManyToBack(value);
|
|
23167
23161
|
}
|
|
23168
23162
|
});
|
|
23169
|
-
|
|
23170
|
-
|
|
23163
|
+
if (groups["Board"]) {
|
|
23164
|
+
const newItems = [...groups["Board"]];
|
|
23165
|
+
this.itemsArray.forEach((item) => {
|
|
23166
|
+
if (!groups["Board"].includes(item)) {
|
|
23167
|
+
newItems.push(item);
|
|
23168
|
+
}
|
|
23169
|
+
});
|
|
23170
|
+
this.itemsArray = newItems;
|
|
23171
|
+
this.itemsArray.forEach(this.change.bind(this));
|
|
23172
|
+
}
|
|
23171
23173
|
}
|
|
23172
23174
|
bringToFront(item, shouldPublish = true) {
|
|
23175
|
+
if (item.parent !== "Board") {
|
|
23176
|
+
this.getById(item.parent)?.index?.bringToFront(item);
|
|
23177
|
+
if (shouldPublish) {
|
|
23178
|
+
this.subject.publish(this.items);
|
|
23179
|
+
}
|
|
23180
|
+
return;
|
|
23181
|
+
}
|
|
23173
23182
|
const index2 = this.itemsArray.indexOf(item);
|
|
23174
23183
|
this.itemsArray.splice(index2, 1);
|
|
23175
23184
|
this.itemsArray.push(item);
|
|
@@ -23179,17 +23188,41 @@ class SpatialIndex {
|
|
|
23179
23188
|
}
|
|
23180
23189
|
}
|
|
23181
23190
|
bringManyToFront(items) {
|
|
23182
|
-
const
|
|
23183
|
-
|
|
23184
|
-
if (
|
|
23185
|
-
|
|
23191
|
+
const groups = this.splitItemsToGroups(items);
|
|
23192
|
+
Object.entries(groups).forEach(([key, value]) => {
|
|
23193
|
+
if (key !== "Board") {
|
|
23194
|
+
this.getById(key)?.index?.bringManyToFront(value);
|
|
23186
23195
|
}
|
|
23187
23196
|
});
|
|
23188
|
-
|
|
23189
|
-
|
|
23190
|
-
|
|
23197
|
+
if (groups["Board"]) {
|
|
23198
|
+
const newItems = [];
|
|
23199
|
+
this.itemsArray.forEach((item) => {
|
|
23200
|
+
if (!groups["Board"].includes(item)) {
|
|
23201
|
+
newItems.push(item);
|
|
23202
|
+
}
|
|
23203
|
+
});
|
|
23204
|
+
newItems.push(...groups["Board"]);
|
|
23205
|
+
this.itemsArray = newItems;
|
|
23206
|
+
this.itemsArray.forEach(this.change.bind(this));
|
|
23207
|
+
}
|
|
23208
|
+
}
|
|
23209
|
+
splitItemsToGroups(items) {
|
|
23210
|
+
const groups = {};
|
|
23211
|
+
for (const item of items) {
|
|
23212
|
+
if (!groups[item.parent]) {
|
|
23213
|
+
groups[item.parent] = [item];
|
|
23214
|
+
} else {
|
|
23215
|
+
groups[item.parent].push(item);
|
|
23216
|
+
}
|
|
23217
|
+
}
|
|
23218
|
+
return groups;
|
|
23191
23219
|
}
|
|
23192
23220
|
moveSecondAfterFirst(first, second) {
|
|
23221
|
+
if (first.parent !== "Board" && second.parent === first.parent) {
|
|
23222
|
+
this.getById(first.parent)?.index?.moveSecondAfterFirst(first, second);
|
|
23223
|
+
this.subject.publish(this.items);
|
|
23224
|
+
return;
|
|
23225
|
+
}
|
|
23193
23226
|
const secondIndex = this.itemsArray.indexOf(second);
|
|
23194
23227
|
this.itemsArray.splice(secondIndex, 1);
|
|
23195
23228
|
const firstIndex = this.itemsArray.indexOf(first);
|
|
@@ -23199,6 +23232,11 @@ class SpatialIndex {
|
|
|
23199
23232
|
this.subject.publish(this.items);
|
|
23200
23233
|
}
|
|
23201
23234
|
moveSecondBeforeFirst(first, second) {
|
|
23235
|
+
if (first.parent !== "Board" && second.parent === first.parent) {
|
|
23236
|
+
this.getById(first.parent)?.index?.moveSecondBeforeFirst(first, second);
|
|
23237
|
+
this.subject.publish(this.items);
|
|
23238
|
+
return;
|
|
23239
|
+
}
|
|
23202
23240
|
const secondIndex = this.itemsArray.indexOf(second);
|
|
23203
23241
|
this.itemsArray.splice(secondIndex, 1);
|
|
23204
23242
|
const firstIndex = this.itemsArray.indexOf(first);
|
|
@@ -28,6 +28,7 @@ export declare class SpatialIndex {
|
|
|
28
28
|
sendManyToBack(items: Item[]): void;
|
|
29
29
|
bringToFront(item: Item, shouldPublish?: boolean): void;
|
|
30
30
|
bringManyToFront(items: Item[]): void;
|
|
31
|
+
private splitItemsToGroups;
|
|
31
32
|
moveSecondAfterFirst(first: Item, second: Item): void;
|
|
32
33
|
moveSecondBeforeFirst(first: Item, second: Item): void;
|
|
33
34
|
getById(id: string): BaseItem | undefined;
|