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
|
61
|
-
var editingGroupAllChildren = (blockStructure && editingGroupBlock) ? findAllChildrenComponentIds(blockStructure
|
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
|
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
|
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
|
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
|
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
|
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
|
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
|
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:
|
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:
|
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
|
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
|
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
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
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 {
|
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?:
|
82
|
+
blockStructure?: Block[];
|
83
83
|
onDoubleClickGroup?: (e: React.MouseEvent, id: string, type: string) => void;
|
84
84
|
selectedGroupBlock?: 'ROOT' | string;
|
85
85
|
editingGroupBlock?: 'ROOT' | string;
|