publ-echo-test 0.0.113 → 0.0.114

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.
@@ -57,8 +57,8 @@ var ReactGridLayout = function (_a) {
57
57
  var _6 = useState(), droppingDOMNode = _6[0], setDroppingDOMNode = _6[1];
58
58
  var _7 = useState(), droppingPosition = _7[0], setDroppingPosition = _7[1];
59
59
  var _8 = useState(false), isMounted = _8[0], setIsMounted = _8[1];
60
- var editableItems = blockStructure ? findChildrenComponentIds(blockStructure.children, editingGroupBlock) : [];
61
- var editingGroupAllChildren = (blockStructure && editingGroupBlock) ? findAllChildrenComponentIds(blockStructure.children, editingGroupBlock).map(function (i) { return i.toString(); }) : [];
60
+ var editableItems = blockStructure ? findChildrenComponentIds(blockStructure, editingGroupBlock) : [];
61
+ var editingGroupAllChildren = (blockStructure && editingGroupBlock) ? findAllChildrenComponentIds(blockStructure, editingGroupBlock).map(function (i) { return i.toString(); }) : [];
62
62
  var _9 = useState([]), oldGroupChildren = _9[0], setOldGroupChildren = _9[1];
63
63
  var _10 = useState(function () {
64
64
  return synchronizeLayoutWithChildren(props.layout || [], children, cols, compactType, allowOverlap);
@@ -147,7 +147,7 @@ var ReactGridLayout = function (_a) {
147
147
  if (!blockStructure) {
148
148
  return;
149
149
  }
150
- var childrenIds = findAllChildrenComponentIds(blockStructure.children, i).map(function (i) { return i.toString(); });
150
+ var childrenIds = findAllChildrenComponentIds(blockStructure, i).map(function (i) { return i.toString(); });
151
151
  var children_1 = childrenIds.map(function (id) {
152
152
  var item = getLayoutItem(layout, id);
153
153
  return cloneLayoutItem(item);
@@ -174,7 +174,7 @@ var ReactGridLayout = function (_a) {
174
174
  if (!blockStructure) {
175
175
  return;
176
176
  }
177
- var children_2 = findChildrenComponentIds(blockStructure.children, i).map(function (id) {
177
+ var children_2 = findChildrenComponentIds(blockStructure, i).map(function (id) {
178
178
  var item = getLayoutItem(layout, id);
179
179
  return cloneLayoutItem(item);
180
180
  });
@@ -515,7 +515,7 @@ var ReactGridLayout = function (_a) {
515
515
  var originalKey = String(child.key).split(".$");
516
516
  return originalKey[1] === l.i;
517
517
  });
518
- var isInBulk = blockStructure && (bulkIds === null || bulkIds === void 0 ? void 0 : bulkIds.includes(getBlockIdByComponentId(blockStructure.children, Number(activeDrag.i))));
518
+ var isInBulk = blockStructure && (bulkIds === null || bulkIds === void 0 ? void 0 : bulkIds.includes(getBlockIdByComponentId(blockStructure, Number(activeDrag.i))));
519
519
  if (!item) {
520
520
  return null;
521
521
  }
@@ -544,7 +544,7 @@ var ReactGridLayout = function (_a) {
544
544
  var bounded = draggable && isBounded && l.isBounded !== false;
545
545
  var editable = editableItems.includes(l.i);
546
546
  var z = l.z || 0;
547
- var isInBulk = blockStructure && (bulkIds === null || bulkIds === void 0 ? void 0 : bulkIds.includes(getBlockIdByComponentId(blockStructure.children, Number(l.i))));
547
+ var isInBulk = blockStructure && (bulkIds === null || bulkIds === void 0 ? void 0 : bulkIds.includes(getBlockIdByComponentId(blockStructure, Number(l.i))));
548
548
  var isRoot = editingGroupBlock === 'ROOT';
549
549
  var baseZ = function () {
550
550
  if (isInBulk) {
@@ -639,7 +639,7 @@ var ReactGridLayout = function (_a) {
639
639
  if (!blockStructure) {
640
640
  return;
641
641
  }
642
- var childrenIds = findAllChildrenComponentIds(blockStructure.children, block.blockId).map(function (i) { return i.toString(); });
642
+ var childrenIds = findAllChildrenComponentIds(blockStructure, block.blockId).map(function (i) { return i.toString(); });
643
643
  var groupItem = getBoundingArea(layout, childrenIds);
644
644
  // const draggable =
645
645
  // typeof l.isDraggable === "boolean"
@@ -698,7 +698,7 @@ var ReactGridLayout = function (_a) {
698
698
  // resizeHandle={resizeHandle}
699
699
  isHiddenVisibility: isHiddenVisibility, customColWidth: colWidth, autoResize: false, onContextGroup: handleClickContextGroup, children: _jsx("div", { onClick: handleClick, onDoubleClick: handleDoubleClick }) }, block.blockId) }));
700
700
  };
701
- var currentGroupBlocks = blockStructure ? findGroupBlocks(blockStructure.children, editingGroupBlock) : [];
701
+ var currentGroupBlocks = blockStructure ? findGroupBlocks(blockStructure, editingGroupBlock) : [];
702
702
  return (_jsxs("div", { ref: innerRef, className: mergedClassName, style: mergedStyle, onDrop: isDroppable ? onDropHandler : noop, onDragLeave: isDroppable ? onDragLeaveHandler : noop, onDragEnter: isDroppable ? onDragEnterHandler : noop, onDragOver: isDroppable ? onDragOverHandler : noop, children: [currentGroupBlocks.map(function (each) { return processGroup(each); }), React.Children.map(children, function (child) { return processGridItem(child); }), placeholder(), activeDrag && _jsx("div", { className: "grid-guide-line-center" }), activeDrag && (_jsx("div", { className: "grid-placeholder", style: {
703
703
  marginTop: margin[1] + "px",
704
704
  marginBottom: margin[1] + "px",
@@ -46,13 +46,13 @@ export declare const findAllChildrenIds: (blockStructure: Block[], targetId: str
46
46
  export declare const findAllChildrenComponentIds: (blockStructure: Block[], targetId: string) => number[];
47
47
  export declare const findAllParentGroups: (blockStructure: Block[], targetId: string) => GroupBlock[];
48
48
  export declare const findGroupBlocks: (blockStructure: Block[], targetId: string) => GroupBlock[];
49
- export declare const findAllChildrenCbIds: (blockStructure: Block[]) => number[];
49
+ export declare const findAllComponentBlockIds: (blockStructure: Block[]) => number[];
50
50
  export declare const findParentGroupByGroupId: (blockStructure: Block[], targetId: string) => string | null;
51
51
  export declare const addBlockToRoot: (blockStructure: Block[], newBlock: Block) => Block[];
52
- export declare const addBulkToTarget: (blockStructure: RootBlock, targetId: string, bulkIds: string[]) => RootBlock;
52
+ export declare const addBulkToTarget: (blockStructure: Block[], targetId: string, bulkIds: string[]) => Block[];
53
53
  export declare const getBlockWorkDirPath: (blockStructure: Block[], blockId: string) => string | null;
54
54
  export declare const getBlockIdByComponentId: (blockStructure: Block[], componentId: number) => string | null;
55
- export declare const blockStructure: RootBlock;
55
+ export declare const blockStructure: Block[];
56
56
  export declare const mapComponentBlockIdsToBlockIds: (blockStructure: Block[]) => {
57
57
  CB_ID: Record<number, string>;
58
58
  BLOCK_ID: Record<string, number>;
@@ -159,7 +159,7 @@ export var findGroupBlocks = function (blockStructure, targetId) {
159
159
  }
160
160
  return groupBlocks;
161
161
  };
162
- export var findAllChildrenCbIds = function (blockStructure) {
162
+ export var findAllComponentBlockIds = function (blockStructure) {
163
163
  var collectComponentBlockIds = function (blocks) {
164
164
  var ids = [];
165
165
  for (var _i = 0, blocks_3 = blocks; _i < blocks_3.length; _i++) {
@@ -205,7 +205,7 @@ export var addBlockToRoot = function (blockStructure, newBlock) {
205
205
  export var addBulkToTarget = function (blockStructure, targetId, bulkIds // componentBlockId
206
206
  ) {
207
207
  var structure = deepClone(blockStructure);
208
- var targetBlock = findBlockByBlockId(structure.children, targetId);
208
+ var targetBlock = findBlockByBlockId(structure, targetId);
209
209
  if (!targetBlock || targetBlock.type !== 'GROUP_BLOCK' || !targetBlock.children) {
210
210
  return blockStructure;
211
211
  }
@@ -220,6 +220,8 @@ export var addBulkToTarget = function (blockStructure, targetId, bulkIds // comp
220
220
  });
221
221
  if (bulkBlocks.length !== bulkIds.length) {
222
222
  window.alert('Some bulkIds do not exist as children of the target block.');
223
+ console.log('bulkBLocks: ', bulkBlocks);
224
+ console.log('bulkIds: ', bulkIds);
223
225
  return blockStructure;
224
226
  }
225
227
  if (bulkBlocks.length === 0) {
@@ -277,153 +279,155 @@ export var getBlockIdByComponentId = function (blockStructure, componentId) {
277
279
  };
278
280
  return findBlock(blockStructure);
279
281
  };
280
- export var blockStructure = {
281
- blockId: 'ROOT',
282
- type: 'GROUP_BLOCK',
283
- zOrderDesktopInternal: null,
284
- zOrderMobileInternal: null,
285
- children: [
286
- {
287
- blockId: 'GB_2',
288
- type: 'GROUP_BLOCK',
289
- zOrderDesktopInternal: null,
290
- zOrderMobileInternal: null,
291
- children: [
292
- {
293
- blockId: 'GB_3',
294
- type: 'GROUP_BLOCK',
295
- zOrderDesktopInternal: null,
296
- zOrderMobileInternal: null,
297
- children: [
298
- {
299
- blockId: 'CB_4',
300
- type: 'COMPONENT_BLOCK',
301
- zOrderDesktopInternal: null,
302
- zOrderMobileInternal: null,
303
- componentBlockId: 4
304
- },
305
- {
306
- blockId: 'CB_5',
307
- type: 'COMPONENT_BLOCK',
308
- zOrderDesktopInternal: null,
309
- zOrderMobileInternal: null,
310
- componentBlockId: 5
311
- },
312
- {
313
- blockId: 'GB_6',
314
- type: 'GROUP_BLOCK',
315
- zOrderDesktopInternal: null,
316
- zOrderMobileInternal: null,
317
- children: [
318
- {
319
- blockId: 'CB_7',
320
- type: 'COMPONENT_BLOCK',
321
- zOrderDesktopInternal: null,
322
- zOrderMobileInternal: null,
323
- componentBlockId: 7
324
- },
325
- {
326
- blockId: 'CB_8',
327
- type: 'COMPONENT_BLOCK',
328
- zOrderDesktopInternal: null,
329
- zOrderMobileInternal: null,
330
- componentBlockId: 8
331
- },
332
- {
333
- blockId: 'GB_9',
334
- type: 'GROUP_BLOCK',
335
- zOrderDesktopInternal: null,
336
- zOrderMobileInternal: null,
337
- children: [
338
- {
339
- blockId: 'CB_10',
340
- type: 'COMPONENT_BLOCK',
341
- zOrderDesktopInternal: null,
342
- zOrderMobileInternal: null,
343
- componentBlockId: 10
344
- },
345
- {
346
- blockId: 'CB_11',
347
- type: 'COMPONENT_BLOCK',
348
- zOrderDesktopInternal: null,
349
- zOrderMobileInternal: null,
350
- componentBlockId: 11
351
- }
352
- ]
353
- }
354
- ]
355
- }
356
- ]
357
- },
358
- {
359
- blockId: 'GB_12',
360
- type: 'GROUP_BLOCK',
361
- zOrderDesktopInternal: null,
362
- zOrderMobileInternal: null,
363
- children: [
364
- {
365
- blockId: 'CB_13',
366
- type: 'COMPONENT_BLOCK',
367
- zOrderDesktopInternal: null,
368
- zOrderMobileInternal: null,
369
- componentBlockId: 13
370
- },
371
- {
372
- blockId: 'CB_14',
373
- type: 'COMPONENT_BLOCK',
374
- zOrderDesktopInternal: null,
375
- zOrderMobileInternal: null,
376
- componentBlockId: 14
377
- }
378
- ]
379
- },
380
- {
381
- blockId: 'CB_15',
382
- type: 'COMPONENT_BLOCK',
383
- zOrderDesktopInternal: null,
384
- zOrderMobileInternal: null,
385
- componentBlockId: 15
386
- },
387
- {
388
- blockId: 'CB_16',
389
- type: 'COMPONENT_BLOCK',
390
- zOrderDesktopInternal: null,
391
- zOrderMobileInternal: null,
392
- componentBlockId: 16
393
- }
394
- ]
395
- },
396
- {
397
- blockId: 'GB_17',
398
- type: 'GROUP_BLOCK',
399
- zOrderDesktopInternal: null,
400
- zOrderMobileInternal: null,
401
- children: [
402
- {
403
- blockId: 'CB_18',
404
- type: 'COMPONENT_BLOCK',
405
- zOrderDesktopInternal: null,
406
- zOrderMobileInternal: null,
407
- componentBlockId: 18
408
- }
409
- ]
410
- },
411
- {
412
- blockId: 'CB_19',
413
- type: 'COMPONENT_BLOCK',
414
- zOrderDesktopInternal: null,
415
- zOrderMobileInternal: null,
416
- componentBlockId: 19
417
- },
418
- {
419
- blockId: 'CB_20',
420
- type: 'COMPONENT_BLOCK',
421
- zOrderDesktopInternal: null,
422
- zOrderMobileInternal: null,
423
- componentBlockId: 20
424
- }
425
- ]
426
- };
282
+ export var blockStructure = [
283
+ {
284
+ blockId: 'ROOT',
285
+ type: 'GROUP_BLOCK',
286
+ zOrderDesktopInternal: null,
287
+ zOrderMobileInternal: null,
288
+ children: [
289
+ {
290
+ blockId: 'GB_2',
291
+ type: 'GROUP_BLOCK',
292
+ zOrderDesktopInternal: null,
293
+ zOrderMobileInternal: null,
294
+ children: [
295
+ {
296
+ blockId: 'GB_3',
297
+ type: 'GROUP_BLOCK',
298
+ zOrderDesktopInternal: null,
299
+ zOrderMobileInternal: null,
300
+ children: [
301
+ {
302
+ blockId: 'CB_4',
303
+ type: 'COMPONENT_BLOCK',
304
+ zOrderDesktopInternal: null,
305
+ zOrderMobileInternal: null,
306
+ componentBlockId: 4
307
+ },
308
+ {
309
+ blockId: 'CB_5',
310
+ type: 'COMPONENT_BLOCK',
311
+ zOrderDesktopInternal: null,
312
+ zOrderMobileInternal: null,
313
+ componentBlockId: 5
314
+ },
315
+ {
316
+ blockId: 'GB_6',
317
+ type: 'GROUP_BLOCK',
318
+ zOrderDesktopInternal: null,
319
+ zOrderMobileInternal: null,
320
+ children: [
321
+ {
322
+ blockId: 'CB_7',
323
+ type: 'COMPONENT_BLOCK',
324
+ zOrderDesktopInternal: null,
325
+ zOrderMobileInternal: null,
326
+ componentBlockId: 7
327
+ },
328
+ {
329
+ blockId: 'CB_8',
330
+ type: 'COMPONENT_BLOCK',
331
+ zOrderDesktopInternal: null,
332
+ zOrderMobileInternal: null,
333
+ componentBlockId: 8
334
+ },
335
+ {
336
+ blockId: 'GB_9',
337
+ type: 'GROUP_BLOCK',
338
+ zOrderDesktopInternal: null,
339
+ zOrderMobileInternal: null,
340
+ children: [
341
+ {
342
+ blockId: 'CB_10',
343
+ type: 'COMPONENT_BLOCK',
344
+ zOrderDesktopInternal: null,
345
+ zOrderMobileInternal: null,
346
+ componentBlockId: 10
347
+ },
348
+ {
349
+ blockId: 'CB_11',
350
+ type: 'COMPONENT_BLOCK',
351
+ zOrderDesktopInternal: null,
352
+ zOrderMobileInternal: null,
353
+ componentBlockId: 11
354
+ }
355
+ ]
356
+ }
357
+ ]
358
+ }
359
+ ]
360
+ },
361
+ {
362
+ blockId: 'GB_12',
363
+ type: 'GROUP_BLOCK',
364
+ zOrderDesktopInternal: null,
365
+ zOrderMobileInternal: null,
366
+ children: [
367
+ {
368
+ blockId: 'CB_13',
369
+ type: 'COMPONENT_BLOCK',
370
+ zOrderDesktopInternal: null,
371
+ zOrderMobileInternal: null,
372
+ componentBlockId: 13
373
+ },
374
+ {
375
+ blockId: 'CB_14',
376
+ type: 'COMPONENT_BLOCK',
377
+ zOrderDesktopInternal: null,
378
+ zOrderMobileInternal: null,
379
+ componentBlockId: 14
380
+ }
381
+ ]
382
+ },
383
+ {
384
+ blockId: 'CB_15',
385
+ type: 'COMPONENT_BLOCK',
386
+ zOrderDesktopInternal: null,
387
+ zOrderMobileInternal: null,
388
+ componentBlockId: 15
389
+ },
390
+ {
391
+ blockId: 'CB_16',
392
+ type: 'COMPONENT_BLOCK',
393
+ zOrderDesktopInternal: null,
394
+ zOrderMobileInternal: null,
395
+ componentBlockId: 16
396
+ }
397
+ ]
398
+ },
399
+ {
400
+ blockId: 'GB_17',
401
+ type: 'GROUP_BLOCK',
402
+ zOrderDesktopInternal: null,
403
+ zOrderMobileInternal: null,
404
+ children: [
405
+ {
406
+ blockId: 'CB_18',
407
+ type: 'COMPONENT_BLOCK',
408
+ zOrderDesktopInternal: null,
409
+ zOrderMobileInternal: null,
410
+ componentBlockId: 18
411
+ }
412
+ ]
413
+ },
414
+ {
415
+ blockId: 'CB_19',
416
+ type: 'COMPONENT_BLOCK',
417
+ zOrderDesktopInternal: null,
418
+ zOrderMobileInternal: null,
419
+ componentBlockId: 19
420
+ },
421
+ {
422
+ blockId: 'CB_20',
423
+ type: 'COMPONENT_BLOCK',
424
+ zOrderDesktopInternal: null,
425
+ zOrderMobileInternal: null,
426
+ componentBlockId: 20
427
+ }
428
+ ]
429
+ }
430
+ ];
427
431
  export var mapComponentBlockIdsToBlockIds = function (blockStructure) {
428
432
  var cbToBlockMap = {};
429
433
  var blockToCbMap = {};
@@ -1,7 +1,7 @@
1
1
  import { DragEvent, ReactElement, RefObject } from "react";
2
2
  import { ResizeHandleAxis, ResizeHandleType } from "../Resizable/types";
3
3
  import { ResizeEventType } from "../GridItem/types";
4
- import { RootBlock } from "./group";
4
+ import { Block } from "./group";
5
5
  export type CompactType = "vertical" | "horizontal";
6
6
  export type LayoutItem = {
7
7
  w: number;
@@ -79,7 +79,7 @@ export type ReactGridLayoutProps = {
79
79
  minNbRow?: number;
80
80
  customColWidth?: number;
81
81
  onFitToContent?: OnFitContentCallBack;
82
- blockStructure?: RootBlock;
82
+ blockStructure?: Block[];
83
83
  onDoubleClickGroup?: (e: React.MouseEvent, id: string, type: string) => void;
84
84
  selectedGroupBlock?: 'ROOT' | string;
85
85
  editingGroupBlock?: 'ROOT' | string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "publ-echo-test",
3
- "version": "0.0.113",
3
+ "version": "0.0.114",
4
4
  "private": false,
5
5
  "main": "dist/lib/index.js",
6
6
  "types": "dist/lib/index.d.js",