@grafloria/element 0.4.31 → 0.4.32

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.
@@ -61,7 +61,7 @@ onDrag) {
61
61
  var _a;
62
62
  if ((_a = e.target) === null || _a === void 0 ? void 0 : _a.closest('.axdb-tab'))
63
63
  return;
64
- onSelectContainer === null || onSelectContainer === void 0 ? void 0 : onSelectContainer();
64
+ onSelectContainer === null || onSelectContainer === void 0 ? void 0 : onSelectContainer(e);
65
65
  };
66
66
  for (const p of pages) {
67
67
  const b = doc.createElement('button');
package/src/lib/load.js CHANGED
@@ -151,7 +151,15 @@ export function fromDocument(document, options = {}) {
151
151
  // the group's slab `gridItem`, its children in its own membership.
152
152
  const meta = ((_b = childGroup.getMetadata('containerWidget')) !== null && _b !== void 0 ? _b : {});
153
153
  const cell = cellFromGridItem(childGroup.getMetadata('gridItem'));
154
- const ws = Object.assign(Object.assign(Object.assign({ id: childGroup.id }, meta), (cell ? { x: cell.x, y: cell.y, span: cell.w, rows: cell.h } : {})), { widgets: rebuildBoard(childGroup, viewId) });
154
+ const inner = rebuildBoard(childGroup, viewId);
155
+ // A tab container's pages keep the order they were REORDERED into
156
+ // (`order` on the container), not the order they joined the group.
157
+ const order = meta.order;
158
+ if (Array.isArray(order)) {
159
+ const rank = (id) => (order.indexOf(id) < 0 ? Number.MAX_SAFE_INTEGER : order.indexOf(id));
160
+ inner.sort((p, q) => rank(p.id) - rank(q.id));
161
+ }
162
+ const ws = Object.assign(Object.assign(Object.assign({ id: childGroup.id }, meta), (cell ? { x: cell.x, y: cell.y, span: cell.w, rows: cell.h } : {})), { widgets: inner });
155
163
  specById.set(ws.id, ws);
156
164
  viewOfWidget.set(ws.id, g.id);
157
165
  boardWidgets.set(ws.id, ws.widgets);