1 | import { hOP } from "@pnp/core";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | export function getNextOrder(collection) {
|
8 | return collection.length < 1 ? 1 : (Math.max.apply(null, collection.map(i => i.order)) + 1);
|
9 | }
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | export function reindex(collection) {
|
16 | for (let i = 0; i < collection.length; i++) {
|
17 | collection[i].order = i + 1;
|
18 | if (hOP(collection[i], "columns")) {
|
19 | reindex(collection[i].columns);
|
20 | }
|
21 | else if (hOP(collection[i], "controls")) {
|
22 | reindex(collection[i].controls);
|
23 | }
|
24 | }
|
25 | }
|
26 |
|
\ | No newline at end of file |