@mint-ui/map 1.2.2 → 1.2.4-test1

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.
@@ -0,0 +1,15 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(npx tsc:*)",
5
+ "Bash(./node_modules/.bin/tsc --noEmit --pretty)",
6
+ "Bash(python3 -c \"import json,sys; d=json.load\\(sys.stdin\\); print\\(json.dumps\\(d.get\\('scripts',{}\\), indent=2\\)\\)\")",
7
+ "Bash(npm run:*)",
8
+ "Bash(npm install:*)",
9
+ "Bash(npx start-storybook:*)",
10
+ "Bash(ls:*)",
11
+ "Bash(git add:*)",
12
+ "Bash(git commit -m ':*)"
13
+ ]
14
+ }
15
+ }
@@ -31,6 +31,8 @@ var CanvasPolygonLayer = function (props) {
31
31
  _b = props.cullingMargin,
32
32
  cullingMargin = _b === void 0 ? performance.DEFAULT_CULLING_MARGIN : _b,
33
33
  onClick = props.onClick,
34
+ onMouseOver = props.onMouseOver,
35
+ onMouseOut = props.onMouseOut,
34
36
  onOptimizationDataUpdate = props.onOptimizationDataUpdate,
35
37
  externalSelectedItems = props.selectedItems,
36
38
  externalSelectedItem = props.selectedItem,
@@ -38,7 +40,7 @@ var CanvasPolygonLayer = function (props) {
38
40
  disableInteraction = _c === void 0 ? false : _c,
39
41
  _d = props.spatialGridCellSize,
40
42
  spatialGridCellSize = _d === void 0 ? performance.SPATIAL_GRID_CELL_SIZE : _d,
41
- options = tslib.__rest(props, ["data", "enableMultiSelect", "cullingMargin", "onClick", "onOptimizationDataUpdate", "selectedItems", "selectedItem", "disableInteraction", "spatialGridCellSize"]); // customStyle은 다른 방식과 함께 사용 가능
43
+ options = tslib.__rest(props, ["data", "enableMultiSelect", "cullingMargin", "onClick", "onMouseOver", "onMouseOut", "onOptimizationDataUpdate", "selectedItems", "selectedItem", "disableInteraction", "spatialGridCellSize"]); // customStyle은 다른 방식과 함께 사용 가능
42
44
 
43
45
 
44
46
  var hasCustomStyle = 'customStyle' in props && props.customStyle !== undefined;
@@ -72,7 +74,12 @@ var CanvasPolygonLayer = function (props) {
72
74
  var hoveredItemRef = React.useRef(null);
73
75
  var selectedItemRef = React.useRef(externalSelectedItem);
74
76
  var selectedIdsRef = React.useRef(new Set());
75
- var selectedItemsMapRef = React.useRef(new Map()); // 드래그 상태 Refs
77
+ var selectedItemsMapRef = React.useRef(new Map()); // 콜백 Refs (useEffect 클로저에서 최신 콜백 참조용)
78
+
79
+ var onMouseOverRef = React.useRef(onMouseOver);
80
+ var onMouseOutRef = React.useRef(onMouseOut);
81
+ onMouseOverRef.current = onMouseOver;
82
+ onMouseOutRef.current = onMouseOut; // 드래그 상태 Refs
76
83
 
77
84
  var draggingRef = React.useRef(false);
78
85
  var prevCenterOffsetRef = React.useRef(null);
@@ -352,12 +359,24 @@ var CanvasPolygonLayer = function (props) {
352
359
 
353
360
 
354
361
  var setHovered = function (hoveredData) {
355
- // 드래그 중에는 hover 상태 변경을 무시하고 드래그 시작 시점의 상태 유지
362
+ var _a, _b; // 드래그 중에는 hover 상태 변경을 무시하고 드래그 시작 시점의 상태 유지
363
+
364
+
356
365
  if (draggingRef.current) {
357
366
  return;
358
367
  }
359
368
 
360
- hoveredItemRef.current = hoveredData;
369
+ var prevHovered = hoveredItemRef.current;
370
+ hoveredItemRef.current = hoveredData; // onMouseOut: 이전 hover 항목에서 벗어남
371
+
372
+ if (prevHovered && prevHovered !== hoveredData) {
373
+ (_a = onMouseOutRef.current) === null || _a === void 0 ? void 0 : _a.call(onMouseOutRef, prevHovered);
374
+ } // onMouseOver: 새로운 항목에 hover
375
+
376
+
377
+ if (hoveredData && hoveredData !== prevHovered) {
378
+ (_b = onMouseOverRef.current) === null || _b === void 0 ? void 0 : _b.call(onMouseOverRef, hoveredData);
379
+ }
361
380
 
362
381
  if (draggingRef.current) {
363
382
  controller.setMapCursor('grabbing');
@@ -427,10 +446,13 @@ var CanvasPolygonLayer = function (props) {
427
446
 
428
447
 
429
448
  var handleMouseLeave = function () {
449
+ var _a;
450
+
430
451
  if (disableInteractionRef.current) return;
431
452
  var prevHovered = hoveredItemRef.current;
432
453
  if (!prevHovered) return;
433
454
  hoveredItemRef.current = null;
455
+ (_a = onMouseOutRef.current) === null || _a === void 0 ? void 0 : _a.call(onMouseOutRef, prevHovered);
434
456
  controller.setMapCursor('grab');
435
457
  doRenderEvent();
436
458
  }; // DOM 초기화
@@ -535,6 +557,16 @@ var CanvasPolygonLayer = function (props) {
535
557
  return disableInteractionRef.current;
536
558
  },
537
559
  onClick: onClick,
560
+ onMouseOver: function (data) {
561
+ var _a;
562
+
563
+ (_a = onMouseOverRef.current) === null || _a === void 0 ? void 0 : _a.call(onMouseOverRef, data);
564
+ },
565
+ onMouseOut: function (data) {
566
+ var _a;
567
+
568
+ (_a = onMouseOutRef.current) === null || _a === void 0 ? void 0 : _a.call(onMouseOutRef, data);
569
+ },
538
570
  setHovered: setHovered,
539
571
  zIndex: currentZIndex
540
572
  };
@@ -111,6 +111,10 @@ export interface CanvasPolygonLayerBaseProps<T> extends Pick<MarkerOptions, 'zIn
111
111
  data: CanvasData<T>[];
112
112
  /** 폴리곤 클릭 시 호출되는 콜백 함수 */
113
113
  onClick?: (payload: CanvasData<T>, selectedIds: Set<string>) => void;
114
+ /** 폴리곤에 마우스가 올라갔을 때 호출되는 콜백 함수 */
115
+ onMouseOver?: (payload: CanvasData<T>) => void;
116
+ /** 폴리곤에서 마우스가 벗어났을 때 호출되는 콜백 함수 */
117
+ onMouseOut?: (payload: CanvasData<T>) => void;
114
118
  /** 다중 선택 활성화 여부 (기본값: false) */
115
119
  enableMultiSelect?: boolean;
116
120
  /** 뷰포트 컬링 여유 공간 (픽셀 단위, 기본값: 100) */
package/dist/index.es.js CHANGED
@@ -5996,6 +5996,8 @@ var CanvasPolygonLayer = function (props) {
5996
5996
  _b = props.cullingMargin,
5997
5997
  cullingMargin = _b === void 0 ? DEFAULT_CULLING_MARGIN : _b,
5998
5998
  onClick = props.onClick,
5999
+ onMouseOver = props.onMouseOver,
6000
+ onMouseOut = props.onMouseOut,
5999
6001
  onOptimizationDataUpdate = props.onOptimizationDataUpdate,
6000
6002
  externalSelectedItems = props.selectedItems,
6001
6003
  externalSelectedItem = props.selectedItem,
@@ -6003,7 +6005,7 @@ var CanvasPolygonLayer = function (props) {
6003
6005
  disableInteraction = _c === void 0 ? false : _c,
6004
6006
  _d = props.spatialGridCellSize,
6005
6007
  spatialGridCellSize = _d === void 0 ? SPATIAL_GRID_CELL_SIZE : _d,
6006
- options = __rest(props, ["data", "enableMultiSelect", "cullingMargin", "onClick", "onOptimizationDataUpdate", "selectedItems", "selectedItem", "disableInteraction", "spatialGridCellSize"]); // customStyle은 다른 방식과 함께 사용 가능
6008
+ options = __rest(props, ["data", "enableMultiSelect", "cullingMargin", "onClick", "onMouseOver", "onMouseOut", "onOptimizationDataUpdate", "selectedItems", "selectedItem", "disableInteraction", "spatialGridCellSize"]); // customStyle은 다른 방식과 함께 사용 가능
6007
6009
 
6008
6010
 
6009
6011
  var hasCustomStyle = 'customStyle' in props && props.customStyle !== undefined;
@@ -6037,7 +6039,12 @@ var CanvasPolygonLayer = function (props) {
6037
6039
  var hoveredItemRef = useRef(null);
6038
6040
  var selectedItemRef = useRef(externalSelectedItem);
6039
6041
  var selectedIdsRef = useRef(new Set());
6040
- var selectedItemsMapRef = useRef(new Map()); // 드래그 상태 Refs
6042
+ var selectedItemsMapRef = useRef(new Map()); // 콜백 Refs (useEffect 클로저에서 최신 콜백 참조용)
6043
+
6044
+ var onMouseOverRef = useRef(onMouseOver);
6045
+ var onMouseOutRef = useRef(onMouseOut);
6046
+ onMouseOverRef.current = onMouseOver;
6047
+ onMouseOutRef.current = onMouseOut; // 드래그 상태 Refs
6041
6048
 
6042
6049
  var draggingRef = useRef(false);
6043
6050
  var prevCenterOffsetRef = useRef(null);
@@ -6317,12 +6324,24 @@ var CanvasPolygonLayer = function (props) {
6317
6324
 
6318
6325
 
6319
6326
  var setHovered = function (hoveredData) {
6320
- // 드래그 중에는 hover 상태 변경을 무시하고 드래그 시작 시점의 상태 유지
6327
+ var _a, _b; // 드래그 중에는 hover 상태 변경을 무시하고 드래그 시작 시점의 상태 유지
6328
+
6329
+
6321
6330
  if (draggingRef.current) {
6322
6331
  return;
6323
6332
  }
6324
6333
 
6325
- hoveredItemRef.current = hoveredData;
6334
+ var prevHovered = hoveredItemRef.current;
6335
+ hoveredItemRef.current = hoveredData; // onMouseOut: 이전 hover 항목에서 벗어남
6336
+
6337
+ if (prevHovered && prevHovered !== hoveredData) {
6338
+ (_a = onMouseOutRef.current) === null || _a === void 0 ? void 0 : _a.call(onMouseOutRef, prevHovered);
6339
+ } // onMouseOver: 새로운 항목에 hover
6340
+
6341
+
6342
+ if (hoveredData && hoveredData !== prevHovered) {
6343
+ (_b = onMouseOverRef.current) === null || _b === void 0 ? void 0 : _b.call(onMouseOverRef, hoveredData);
6344
+ }
6326
6345
 
6327
6346
  if (draggingRef.current) {
6328
6347
  controller.setMapCursor('grabbing');
@@ -6392,10 +6411,13 @@ var CanvasPolygonLayer = function (props) {
6392
6411
 
6393
6412
 
6394
6413
  var handleMouseLeave = function () {
6414
+ var _a;
6415
+
6395
6416
  if (disableInteractionRef.current) return;
6396
6417
  var prevHovered = hoveredItemRef.current;
6397
6418
  if (!prevHovered) return;
6398
6419
  hoveredItemRef.current = null;
6420
+ (_a = onMouseOutRef.current) === null || _a === void 0 ? void 0 : _a.call(onMouseOutRef, prevHovered);
6399
6421
  controller.setMapCursor('grab');
6400
6422
  doRenderEvent();
6401
6423
  }; // DOM 초기화
@@ -6500,6 +6522,16 @@ var CanvasPolygonLayer = function (props) {
6500
6522
  return disableInteractionRef.current;
6501
6523
  },
6502
6524
  onClick: onClick,
6525
+ onMouseOver: function (data) {
6526
+ var _a;
6527
+
6528
+ (_a = onMouseOverRef.current) === null || _a === void 0 ? void 0 : _a.call(onMouseOverRef, data);
6529
+ },
6530
+ onMouseOut: function (data) {
6531
+ var _a;
6532
+
6533
+ (_a = onMouseOutRef.current) === null || _a === void 0 ? void 0 : _a.call(onMouseOutRef, data);
6534
+ },
6503
6535
  setHovered: setHovered,
6504
6536
  zIndex: currentZIndex
6505
6537
  };
package/dist/index.umd.js CHANGED
@@ -6000,6 +6000,8 @@
6000
6000
  _b = props.cullingMargin,
6001
6001
  cullingMargin = _b === void 0 ? DEFAULT_CULLING_MARGIN : _b,
6002
6002
  onClick = props.onClick,
6003
+ onMouseOver = props.onMouseOver,
6004
+ onMouseOut = props.onMouseOut,
6003
6005
  onOptimizationDataUpdate = props.onOptimizationDataUpdate,
6004
6006
  externalSelectedItems = props.selectedItems,
6005
6007
  externalSelectedItem = props.selectedItem,
@@ -6007,7 +6009,7 @@
6007
6009
  disableInteraction = _c === void 0 ? false : _c,
6008
6010
  _d = props.spatialGridCellSize,
6009
6011
  spatialGridCellSize = _d === void 0 ? SPATIAL_GRID_CELL_SIZE : _d,
6010
- options = tslib.__rest(props, ["data", "enableMultiSelect", "cullingMargin", "onClick", "onOptimizationDataUpdate", "selectedItems", "selectedItem", "disableInteraction", "spatialGridCellSize"]); // customStyle은 다른 방식과 함께 사용 가능
6012
+ options = tslib.__rest(props, ["data", "enableMultiSelect", "cullingMargin", "onClick", "onMouseOver", "onMouseOut", "onOptimizationDataUpdate", "selectedItems", "selectedItem", "disableInteraction", "spatialGridCellSize"]); // customStyle은 다른 방식과 함께 사용 가능
6011
6013
 
6012
6014
 
6013
6015
  var hasCustomStyle = 'customStyle' in props && props.customStyle !== undefined;
@@ -6041,7 +6043,12 @@
6041
6043
  var hoveredItemRef = React.useRef(null);
6042
6044
  var selectedItemRef = React.useRef(externalSelectedItem);
6043
6045
  var selectedIdsRef = React.useRef(new Set());
6044
- var selectedItemsMapRef = React.useRef(new Map()); // 드래그 상태 Refs
6046
+ var selectedItemsMapRef = React.useRef(new Map()); // 콜백 Refs (useEffect 클로저에서 최신 콜백 참조용)
6047
+
6048
+ var onMouseOverRef = React.useRef(onMouseOver);
6049
+ var onMouseOutRef = React.useRef(onMouseOut);
6050
+ onMouseOverRef.current = onMouseOver;
6051
+ onMouseOutRef.current = onMouseOut; // 드래그 상태 Refs
6045
6052
 
6046
6053
  var draggingRef = React.useRef(false);
6047
6054
  var prevCenterOffsetRef = React.useRef(null);
@@ -6321,12 +6328,24 @@
6321
6328
 
6322
6329
 
6323
6330
  var setHovered = function (hoveredData) {
6324
- // 드래그 중에는 hover 상태 변경을 무시하고 드래그 시작 시점의 상태 유지
6331
+ var _a, _b; // 드래그 중에는 hover 상태 변경을 무시하고 드래그 시작 시점의 상태 유지
6332
+
6333
+
6325
6334
  if (draggingRef.current) {
6326
6335
  return;
6327
6336
  }
6328
6337
 
6329
- hoveredItemRef.current = hoveredData;
6338
+ var prevHovered = hoveredItemRef.current;
6339
+ hoveredItemRef.current = hoveredData; // onMouseOut: 이전 hover 항목에서 벗어남
6340
+
6341
+ if (prevHovered && prevHovered !== hoveredData) {
6342
+ (_a = onMouseOutRef.current) === null || _a === void 0 ? void 0 : _a.call(onMouseOutRef, prevHovered);
6343
+ } // onMouseOver: 새로운 항목에 hover
6344
+
6345
+
6346
+ if (hoveredData && hoveredData !== prevHovered) {
6347
+ (_b = onMouseOverRef.current) === null || _b === void 0 ? void 0 : _b.call(onMouseOverRef, hoveredData);
6348
+ }
6330
6349
 
6331
6350
  if (draggingRef.current) {
6332
6351
  controller.setMapCursor('grabbing');
@@ -6396,10 +6415,13 @@
6396
6415
 
6397
6416
 
6398
6417
  var handleMouseLeave = function () {
6418
+ var _a;
6419
+
6399
6420
  if (disableInteractionRef.current) return;
6400
6421
  var prevHovered = hoveredItemRef.current;
6401
6422
  if (!prevHovered) return;
6402
6423
  hoveredItemRef.current = null;
6424
+ (_a = onMouseOutRef.current) === null || _a === void 0 ? void 0 : _a.call(onMouseOutRef, prevHovered);
6403
6425
  controller.setMapCursor('grab');
6404
6426
  doRenderEvent();
6405
6427
  }; // DOM 초기화
@@ -6504,6 +6526,16 @@
6504
6526
  return disableInteractionRef.current;
6505
6527
  },
6506
6528
  onClick: onClick,
6529
+ onMouseOver: function (data) {
6530
+ var _a;
6531
+
6532
+ (_a = onMouseOverRef.current) === null || _a === void 0 ? void 0 : _a.call(onMouseOverRef, data);
6533
+ },
6534
+ onMouseOut: function (data) {
6535
+ var _a;
6536
+
6537
+ (_a = onMouseOutRef.current) === null || _a === void 0 ? void 0 : _a.call(onMouseOutRef, data);
6538
+ },
6507
6539
  setHovered: setHovered,
6508
6540
  zIndex: currentZIndex
6509
6541
  };
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mint-ui/map",
3
- "version": "1.2.2",
3
+ "version": "1.2.4-test1",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.es.js",
6
6
  "browser": "./dist/index.umd.js",