aio-class 2.2.0 → 2.2.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/index.d.ts +74 -81
- package/index.js +106 -112
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="emscripten" />
|
|
2
1
|
/// <reference types="jquery" />
|
|
3
2
|
/// <reference types="jquery" />
|
|
4
3
|
import { AIOGeo } from 'aio-geo';
|
|
@@ -79,7 +78,7 @@ export declare const ArrayToObject: <T>(keys: T[], fn: (key: T) => any) => any;
|
|
|
79
78
|
export declare const TextFilter: (p: {
|
|
80
79
|
value: string | number;
|
|
81
80
|
chars?: {
|
|
82
|
-
[key: string]: boolean;
|
|
81
|
+
[key: string]: boolean | undefined;
|
|
83
82
|
};
|
|
84
83
|
number?: boolean;
|
|
85
84
|
symbol?: boolean;
|
|
@@ -218,86 +217,80 @@ export declare class EntityClass<T> {
|
|
|
218
217
|
private getRowDetailByRowAndParents;
|
|
219
218
|
private removeChildOfParent;
|
|
220
219
|
private getRowByAddChild;
|
|
221
|
-
private
|
|
222
|
-
private
|
|
223
|
-
private
|
|
224
|
-
private
|
|
225
|
-
private
|
|
226
|
-
private
|
|
227
|
-
private
|
|
228
|
-
private
|
|
229
|
-
private
|
|
230
|
-
private
|
|
231
|
-
private
|
|
232
|
-
private
|
|
233
|
-
private
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
index?: number;
|
|
255
|
-
rows?: T[];
|
|
256
|
-
}) => {
|
|
257
|
-
rows: T[];
|
|
258
|
-
row: T;
|
|
259
|
-
};
|
|
260
|
-
editRow: (p: {
|
|
261
|
-
row: T;
|
|
262
|
-
rows?: T[];
|
|
263
|
-
}) => T[];
|
|
264
|
-
editById: (p: {
|
|
265
|
-
rowId: I_id;
|
|
266
|
-
change: Partial<T>;
|
|
267
|
-
rows?: T[];
|
|
268
|
-
}) => T[];
|
|
269
|
-
removeRow: (p: {
|
|
270
|
-
rowId: I_id;
|
|
271
|
-
rows?: T[];
|
|
272
|
-
}) => T[];
|
|
273
|
-
removeByRowIds: (p: {
|
|
274
|
-
rowIds: I_id[];
|
|
275
|
-
rows?: T[];
|
|
276
|
-
}) => T[];
|
|
277
|
-
reOrder: (p: {
|
|
278
|
-
fromId: I_id;
|
|
279
|
-
toId: I_id;
|
|
280
|
-
rows?: T[];
|
|
281
|
-
}) => T[];
|
|
282
|
-
reOrderByDir: (p: {
|
|
283
|
-
rowId: I_id;
|
|
284
|
-
dir: 1 | -1;
|
|
285
|
-
rows?: T[];
|
|
286
|
-
}) => T[];
|
|
287
|
-
moveTo: (p: {
|
|
288
|
-
fromIds: I_id[];
|
|
289
|
-
toId: I_id;
|
|
290
|
-
rows?: T[];
|
|
291
|
-
}) => T[];
|
|
292
|
-
editByTraverse: (p: {
|
|
293
|
-
callback: (row: T) => T | false;
|
|
294
|
-
rows?: T[];
|
|
295
|
-
}) => T[];
|
|
296
|
-
traverse: (p: {
|
|
297
|
-
callback: (row: T, detail: I_EntityRowDetail<T>) => false | undefined;
|
|
298
|
-
rows?: T[];
|
|
299
|
-
}) => void;
|
|
220
|
+
private _getRowDetailById;
|
|
221
|
+
private _getFilteredTree;
|
|
222
|
+
private _getSortedTree;
|
|
223
|
+
private _addRow;
|
|
224
|
+
private _editRow;
|
|
225
|
+
private _editById;
|
|
226
|
+
private _removeRow;
|
|
227
|
+
private _removeByRowIds;
|
|
228
|
+
private _reOrder;
|
|
229
|
+
private _reOrderByDir;
|
|
230
|
+
private _moveTo;
|
|
231
|
+
private _editByTraverse;
|
|
232
|
+
private _traverse;
|
|
233
|
+
getRowDetailById: (p: {
|
|
234
|
+
rowId: I_id;
|
|
235
|
+
rows?: T[];
|
|
236
|
+
}) => false | I_EntityRowDetail<T>;
|
|
237
|
+
getFilteredTree: (p: {
|
|
238
|
+
filter: (row: T, detail: I_EntityRowDetail<T>) => boolean | undefined;
|
|
239
|
+
rows?: T[];
|
|
240
|
+
}) => T[];
|
|
241
|
+
getSortedTree: (p: {
|
|
242
|
+
sorts: I_sort<T>[];
|
|
243
|
+
rows?: T[];
|
|
244
|
+
}) => T[];
|
|
245
|
+
addRow: (p: {
|
|
246
|
+
row: T;
|
|
247
|
+
parentId?: I_id;
|
|
248
|
+
index?: number;
|
|
249
|
+
rows?: T[];
|
|
250
|
+
}) => {
|
|
251
|
+
rows: T[];
|
|
252
|
+
row: T;
|
|
300
253
|
};
|
|
254
|
+
editRow: (p: {
|
|
255
|
+
row: T;
|
|
256
|
+
rows?: T[];
|
|
257
|
+
}) => T[];
|
|
258
|
+
editById: (p: {
|
|
259
|
+
rowId: I_id;
|
|
260
|
+
change: Partial<T>;
|
|
261
|
+
rows?: T[];
|
|
262
|
+
}) => T[];
|
|
263
|
+
removeRow: (p: {
|
|
264
|
+
rowId: I_id;
|
|
265
|
+
rows?: T[];
|
|
266
|
+
}) => T[];
|
|
267
|
+
removeByRowIds: (p: {
|
|
268
|
+
rowIds: I_id[];
|
|
269
|
+
rows?: T[];
|
|
270
|
+
}) => T[];
|
|
271
|
+
reOrder: (p: {
|
|
272
|
+
fromId: I_id;
|
|
273
|
+
toId: I_id;
|
|
274
|
+
rows?: T[];
|
|
275
|
+
}) => T[];
|
|
276
|
+
reOrderByDir: (p: {
|
|
277
|
+
rowId: I_id;
|
|
278
|
+
dir: 1 | -1;
|
|
279
|
+
rows?: T[];
|
|
280
|
+
}) => T[];
|
|
281
|
+
moveTo: (p: {
|
|
282
|
+
fromIds: I_id[];
|
|
283
|
+
toId: I_id;
|
|
284
|
+
rows?: T[];
|
|
285
|
+
}) => T[];
|
|
286
|
+
editByTraverse: (p: {
|
|
287
|
+
callback: (row: T) => T | false;
|
|
288
|
+
rows?: T[];
|
|
289
|
+
}) => T[];
|
|
290
|
+
traverse: (p: {
|
|
291
|
+
callback: (row: T, detail: I_EntityRowDetail<T>) => false | undefined;
|
|
292
|
+
rows?: T[];
|
|
293
|
+
}) => void;
|
|
301
294
|
}
|
|
302
295
|
type I_color = any;
|
|
303
296
|
type I_color_type = 'rgb' | 'hex' | 'array';
|
package/index.js
CHANGED
|
@@ -242,7 +242,7 @@ export const EventHandler = (selector, event, action, type = 'bind') => {
|
|
|
242
242
|
element.addEventListener(fixedEvent, action);
|
|
243
243
|
}
|
|
244
244
|
};
|
|
245
|
-
export const Stall = (
|
|
245
|
+
export const Stall = (...args_1) => __awaiter(void 0, [...args_1], void 0, function* (stallTime = 3000) { return yield new Promise(resolve => setTimeout(resolve, stallTime)); });
|
|
246
246
|
export const DetectOS = () => {
|
|
247
247
|
const userAgent = window.navigator.userAgent;
|
|
248
248
|
const platform = window.navigator.platform;
|
|
@@ -1572,7 +1572,7 @@ export class EntityClass {
|
|
|
1572
1572
|
newChilds.splice(index === undefined ? newChilds.length : index, 0, row);
|
|
1573
1573
|
return this.setChilds(parentRow, newChilds);
|
|
1574
1574
|
};
|
|
1575
|
-
this.
|
|
1575
|
+
this._getRowDetailById = (data, rowId) => {
|
|
1576
1576
|
const fn = (data, rowId, parents, level, temp) => {
|
|
1577
1577
|
if (temp.res) {
|
|
1578
1578
|
return;
|
|
@@ -1597,10 +1597,10 @@ export class EntityClass {
|
|
|
1597
1597
|
fn(data, rowId, [], 0, temp);
|
|
1598
1598
|
return temp.res ? temp.res : false;
|
|
1599
1599
|
};
|
|
1600
|
-
this.
|
|
1600
|
+
this._getFilteredTree = (data, filter) => {
|
|
1601
1601
|
const getNodesDic = (data, filter) => {
|
|
1602
1602
|
const detailDic = {};
|
|
1603
|
-
this.
|
|
1603
|
+
this._traverse(data, (row, detail) => {
|
|
1604
1604
|
const res = filter(row, detail);
|
|
1605
1605
|
if (res === false) {
|
|
1606
1606
|
return false;
|
|
@@ -1636,27 +1636,27 @@ export class EntityClass {
|
|
|
1636
1636
|
const nodesDic = getNodesDic(data, filter);
|
|
1637
1637
|
return fn(data, [], 0);
|
|
1638
1638
|
};
|
|
1639
|
-
this.
|
|
1639
|
+
this._getSortedTree = (rows, sorts) => {
|
|
1640
1640
|
let sortedRows = SortArray(rows, sorts);
|
|
1641
1641
|
return sortedRows.map((o) => {
|
|
1642
1642
|
const childs = this.getChilds(o);
|
|
1643
1643
|
if (!childs || !childs.length) {
|
|
1644
1644
|
return o;
|
|
1645
1645
|
}
|
|
1646
|
-
const newChilds = this.
|
|
1646
|
+
const newChilds = this._getSortedTree(childs, sorts);
|
|
1647
1647
|
return this.setChilds(Object.assign({}, o), newChilds);
|
|
1648
1648
|
});
|
|
1649
1649
|
};
|
|
1650
|
-
this.
|
|
1650
|
+
this._addRow = (data, row, p) => {
|
|
1651
1651
|
const { parentId, index } = p;
|
|
1652
1652
|
const newRow = this.setId(row);
|
|
1653
1653
|
if (parentId !== undefined) {
|
|
1654
|
-
const detail = this.
|
|
1654
|
+
const detail = this._getRowDetailById(data, parentId);
|
|
1655
1655
|
if (!detail) {
|
|
1656
1656
|
return { rows: data, row };
|
|
1657
1657
|
}
|
|
1658
1658
|
const parent = this.getRowByAddChild(detail.row, newRow);
|
|
1659
|
-
const newData = this.
|
|
1659
|
+
const newData = this._editRow(data, parent);
|
|
1660
1660
|
return { rows: newData, row: newRow };
|
|
1661
1661
|
}
|
|
1662
1662
|
else {
|
|
@@ -1665,50 +1665,50 @@ export class EntityClass {
|
|
|
1665
1665
|
return { rows: newData, row: newRow };
|
|
1666
1666
|
}
|
|
1667
1667
|
};
|
|
1668
|
-
this.
|
|
1668
|
+
this._editRow = (data, newRow) => {
|
|
1669
1669
|
const rowId = this.getId(newRow);
|
|
1670
|
-
const detail = this.
|
|
1670
|
+
const detail = this._getRowDetailById(data, rowId);
|
|
1671
1671
|
const parentRow = detail.parentRow;
|
|
1672
1672
|
if (parentRow) {
|
|
1673
1673
|
const childs = this.getChilds(parentRow);
|
|
1674
1674
|
const newChilds = childs.map((o) => this.getId(o).toString() === rowId.toString() ? newRow : o);
|
|
1675
1675
|
const newParentRow = this.setChilds(parentRow, newChilds);
|
|
1676
|
-
return this.
|
|
1676
|
+
return this._editRow(data, newParentRow);
|
|
1677
1677
|
}
|
|
1678
1678
|
else {
|
|
1679
1679
|
return data.map((o) => this.getId(o).toString() === this.getId(newRow).toString() ? newRow : o);
|
|
1680
1680
|
}
|
|
1681
1681
|
};
|
|
1682
|
-
this.
|
|
1683
|
-
const detail = this.
|
|
1682
|
+
this._editById = (data, rowId, change) => {
|
|
1683
|
+
const detail = this._getRowDetailById(data, rowId);
|
|
1684
1684
|
if (!detail) {
|
|
1685
1685
|
return data;
|
|
1686
1686
|
}
|
|
1687
1687
|
const newRow = Object.assign(Object.assign({}, detail.row), change);
|
|
1688
|
-
return this.
|
|
1688
|
+
return this._editRow(data, newRow);
|
|
1689
1689
|
};
|
|
1690
|
-
this.
|
|
1691
|
-
let detail = this.
|
|
1690
|
+
this._removeRow = (data, rowId) => {
|
|
1691
|
+
let detail = this._getRowDetailById(data, rowId);
|
|
1692
1692
|
if (!detail) {
|
|
1693
1693
|
return data;
|
|
1694
1694
|
}
|
|
1695
1695
|
let parentRow = detail.parentRow;
|
|
1696
1696
|
if (parentRow) {
|
|
1697
1697
|
parentRow = this.removeChildOfParent(parentRow, rowId);
|
|
1698
|
-
return this.
|
|
1698
|
+
return this._editRow(data, parentRow);
|
|
1699
1699
|
}
|
|
1700
1700
|
else {
|
|
1701
1701
|
return data.filter((o) => this.getId(o).toString() !== rowId.toString());
|
|
1702
1702
|
}
|
|
1703
1703
|
};
|
|
1704
|
-
this.
|
|
1704
|
+
this._removeByRowIds = (data, rowIds) => {
|
|
1705
1705
|
let tempRows = [...data];
|
|
1706
1706
|
for (let i = 0; i < rowIds.length; i++) {
|
|
1707
|
-
tempRows = this.
|
|
1707
|
+
tempRows = this._removeRow(tempRows, rowIds[i]);
|
|
1708
1708
|
}
|
|
1709
1709
|
return tempRows;
|
|
1710
1710
|
};
|
|
1711
|
-
this.
|
|
1711
|
+
this._reOrder = (data, fromId, toId, pos) => {
|
|
1712
1712
|
if (fromId.toString() === toId.toString()) {
|
|
1713
1713
|
return data;
|
|
1714
1714
|
}
|
|
@@ -1739,20 +1739,20 @@ export class EntityClass {
|
|
|
1739
1739
|
//مبدا رو با آی دی جدید به پرنت مقصد در ایندکس ردیف مقصد اضافه کن
|
|
1740
1740
|
const newToParent = this.getRowByAddChild(toParent, fromRow, toIndex);
|
|
1741
1741
|
//دیتا رو با این ردیف جدید ویرایش کن
|
|
1742
|
-
let newData = this.
|
|
1742
|
+
let newData = this._editRow(data, newToParent);
|
|
1743
1743
|
//مبدا رو از دیتای جدید حذف کن
|
|
1744
|
-
return this.
|
|
1744
|
+
return this._removeRow(newData, fromDetail.rowId);
|
|
1745
1745
|
}
|
|
1746
1746
|
//اگر پرنت نداشت
|
|
1747
1747
|
else {
|
|
1748
1748
|
//مبدا رو با آی دی جدید به پرنت مقصد در ایندکس ردیف مقصد اضافه کن
|
|
1749
|
-
let newData = this.
|
|
1749
|
+
let newData = this._addRow(data, fromRow, { index: toIndex });
|
|
1750
1750
|
//مبدا رو از دیتای جدید حذف کن
|
|
1751
|
-
return this.
|
|
1751
|
+
return this._removeRow(newData.rows, fromDetail.rowId);
|
|
1752
1752
|
}
|
|
1753
1753
|
};
|
|
1754
|
-
this.
|
|
1755
|
-
const from = this.
|
|
1754
|
+
this._reOrderByDir = (data, rowId, dir) => {
|
|
1755
|
+
const from = this._getRowDetailById(data, rowId);
|
|
1756
1756
|
if (!from) {
|
|
1757
1757
|
return data;
|
|
1758
1758
|
}
|
|
@@ -1762,9 +1762,9 @@ export class EntityClass {
|
|
|
1762
1762
|
}
|
|
1763
1763
|
const fromId = rowId;
|
|
1764
1764
|
const toId = this.getId(sibling);
|
|
1765
|
-
return this.
|
|
1765
|
+
return this._reOrder(data, fromId, toId, dir === 1 ? 'after' : 'before') || data;
|
|
1766
1766
|
};
|
|
1767
|
-
this.
|
|
1767
|
+
this._moveTo = (data, fromIds, toId) => {
|
|
1768
1768
|
const fn = (data, fromId, toId) => {
|
|
1769
1769
|
const details = this.getRowDetailsByIds(data, [fromId, toId]);
|
|
1770
1770
|
let toDetail = details[toId];
|
|
@@ -1779,14 +1779,14 @@ export class EntityClass {
|
|
|
1779
1779
|
if (isToChildOfFrom) {
|
|
1780
1780
|
return data;
|
|
1781
1781
|
}
|
|
1782
|
-
const newData = this.
|
|
1782
|
+
const newData = this._removeRow(data, fromId);
|
|
1783
1783
|
//اگر بروز نشه مشکل بوجود میاد
|
|
1784
|
-
toDetail = this.
|
|
1784
|
+
toDetail = this._getRowDetailById(newData, toId);
|
|
1785
1785
|
if (!toDetail) {
|
|
1786
1786
|
return data;
|
|
1787
1787
|
}
|
|
1788
1788
|
const newToRow = this.getRowByAddChild(toDetail.row, fromDetail.row);
|
|
1789
|
-
return this.
|
|
1789
|
+
return this._editRow(newData, newToRow);
|
|
1790
1790
|
};
|
|
1791
1791
|
let rows = data;
|
|
1792
1792
|
for (let i = 0; i < fromIds.length; i++) {
|
|
@@ -1794,7 +1794,7 @@ export class EntityClass {
|
|
|
1794
1794
|
}
|
|
1795
1795
|
return rows;
|
|
1796
1796
|
};
|
|
1797
|
-
this.
|
|
1797
|
+
this._editByTraverse = (rows, callback) => {
|
|
1798
1798
|
const fn = (data, parentRow) => {
|
|
1799
1799
|
for (let i = 0; i < data.length; i++) {
|
|
1800
1800
|
let row = data[i];
|
|
@@ -1820,7 +1820,7 @@ export class EntityClass {
|
|
|
1820
1820
|
fn(rows);
|
|
1821
1821
|
return rows;
|
|
1822
1822
|
};
|
|
1823
|
-
this.
|
|
1823
|
+
this._traverse = (rows, callback) => {
|
|
1824
1824
|
const fn = (data, parentRows, level) => {
|
|
1825
1825
|
for (let i = 0; i < data.length; i++) {
|
|
1826
1826
|
let row = data[i];
|
|
@@ -1837,83 +1837,77 @@ export class EntityClass {
|
|
|
1837
1837
|
};
|
|
1838
1838
|
fn(rows, [], 0);
|
|
1839
1839
|
};
|
|
1840
|
-
this.
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
return res;
|
|
1912
|
-
},
|
|
1913
|
-
traverse: (p) => {
|
|
1914
|
-
const rows = p.rows || this.getData();
|
|
1915
|
-
this.traverse(rows, p.callback);
|
|
1916
|
-
}
|
|
1840
|
+
this.getRowDetailById = (p) => {
|
|
1841
|
+
const rows = p.rows || this.getData();
|
|
1842
|
+
return this._getRowDetailById(rows, p.rowId);
|
|
1843
|
+
};
|
|
1844
|
+
this.getFilteredTree = (p) => {
|
|
1845
|
+
const rows = p.rows || this.getData();
|
|
1846
|
+
return this._getFilteredTree(rows, p.filter);
|
|
1847
|
+
};
|
|
1848
|
+
this.getSortedTree = (p) => {
|
|
1849
|
+
const rows = p.rows || this.getData();
|
|
1850
|
+
const res = this._getSortedTree(rows, p.sorts);
|
|
1851
|
+
this.setData(res);
|
|
1852
|
+
return res;
|
|
1853
|
+
};
|
|
1854
|
+
this.addRow = (p) => {
|
|
1855
|
+
const rows = p.rows || this.getData();
|
|
1856
|
+
const res = this._addRow(rows, p.row, p);
|
|
1857
|
+
this.setData(res.rows);
|
|
1858
|
+
return res;
|
|
1859
|
+
};
|
|
1860
|
+
this.editRow = (p) => {
|
|
1861
|
+
const rows = p.rows || this.getData();
|
|
1862
|
+
const res = this._editRow(rows, p.row);
|
|
1863
|
+
this.setData(res);
|
|
1864
|
+
return res;
|
|
1865
|
+
};
|
|
1866
|
+
this.editById = (p) => {
|
|
1867
|
+
const rows = p.rows || this.getData();
|
|
1868
|
+
const res = this._editById(rows, p.rowId, p.change);
|
|
1869
|
+
this.setData(res);
|
|
1870
|
+
return res;
|
|
1871
|
+
};
|
|
1872
|
+
this.removeRow = (p) => {
|
|
1873
|
+
const rows = p.rows || this.getData();
|
|
1874
|
+
const res = this._removeRow(rows, p.rowId);
|
|
1875
|
+
this.setData(res);
|
|
1876
|
+
return res;
|
|
1877
|
+
};
|
|
1878
|
+
this.removeByRowIds = (p) => {
|
|
1879
|
+
const rows = p.rows || this.getData();
|
|
1880
|
+
const res = this._removeByRowIds(rows, p.rowIds);
|
|
1881
|
+
this.setData(res);
|
|
1882
|
+
return res;
|
|
1883
|
+
};
|
|
1884
|
+
this.reOrder = (p) => {
|
|
1885
|
+
const rows = p.rows || this.getData();
|
|
1886
|
+
const res = this._reOrder(rows, p.fromId, p.toId);
|
|
1887
|
+
this.setData(res);
|
|
1888
|
+
return res;
|
|
1889
|
+
};
|
|
1890
|
+
this.reOrderByDir = (p) => {
|
|
1891
|
+
const rows = p.rows || this.getData();
|
|
1892
|
+
const res = this._reOrderByDir(rows, p.rowId, p.dir);
|
|
1893
|
+
this.setData(res);
|
|
1894
|
+
return res;
|
|
1895
|
+
};
|
|
1896
|
+
this.moveTo = (p) => {
|
|
1897
|
+
const rows = p.rows || this.getData();
|
|
1898
|
+
const res = this._moveTo(rows, p.fromIds, p.toId);
|
|
1899
|
+
this.setData(res);
|
|
1900
|
+
return res;
|
|
1901
|
+
};
|
|
1902
|
+
this.editByTraverse = (p) => {
|
|
1903
|
+
const rows = p.rows || this.getData();
|
|
1904
|
+
const res = this._editByTraverse(rows, p.callback);
|
|
1905
|
+
this.setData(res);
|
|
1906
|
+
return res;
|
|
1907
|
+
};
|
|
1908
|
+
this.traverse = (p) => {
|
|
1909
|
+
const rows = p.rows || this.getData();
|
|
1910
|
+
this._traverse(rows, p.callback);
|
|
1917
1911
|
};
|
|
1918
1912
|
this.map = p.map;
|
|
1919
1913
|
if (p.getData) {
|
|
@@ -1923,7 +1917,7 @@ export class EntityClass {
|
|
|
1923
1917
|
if (p.setData) {
|
|
1924
1918
|
let newData = v;
|
|
1925
1919
|
if (p.sorts && p.sorts.length) {
|
|
1926
|
-
newData = this.
|
|
1920
|
+
newData = this._getSortedTree(newData, p.sorts);
|
|
1927
1921
|
}
|
|
1928
1922
|
p.setData(newData);
|
|
1929
1923
|
}
|