@mapless/react 0.0.2 → 0.0.4

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.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- import react, { forwardRef, memo, useCallback, useContext, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
2
+ import react, { forwardRef, memo, useCallback, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
3
3
  import "mapbox-gl/dist/mapbox-gl.css";
4
4
  import { Draw, Lang, LngLat, Mapless, Marker, PaintBoard, Popup, PositionMarker, PositionMouse, QuickTrans, Singleton, attachBoundary, attachCluster, attachCurve, attachHeatmap, attachImageData, attachLine, attachMarker, attachMovable, attachNewStation as core_attachNewStation, attachNode, attachOldStation as core_attachOldStation, attachPolygon, attachRoutes, attachShape, attachStep, attachTrack, calculateObjectsInPolygon, darkSource, defaultSource, detachBoundary, detachCluster, detachCurve, detachHeatmap, detachImageData, detachLine, detachMarker, detachMovable, detachNewStation, detachNode, detachOldStation, detachPolygon, detachRoutes, detachShape, detachStep, detachTrack, ellipse, genPrefixId, getBoundary, getCluster, getCoordDisplayName, getCurve, getHeatmap, getImageData, getLine, getMarker, getMovable, getNewStation, getNode, getOldStation, getPaintCenter, getPaintCenterNRadius, getPolygon, getRoutes, getShape, getStep, getTrack, lightSource, maplessPreset, propwmsTransformRequest, sourcesMap, test2Point, throttle, transformCoordinate } from "@mapless/core";
5
5
  import { Button, Flex, FloatButton, Input, InputNumber, Popover, Select, Space, Tooltip, Typography, message } from "antd";
@@ -2047,8 +2047,25 @@ const Float_index_module = {
2047
2047
  title: "title-Ikuh0j",
2048
2048
  close: "close-og7mQm"
2049
2049
  };
2050
+ const floatState = {
2051
+ activeFloatId: null,
2052
+ setActiveFloatId (id) {
2053
+ if (this.activeFloatId) {
2054
+ const { style } = document.getElementById(this.activeFloatId) || {};
2055
+ style?.setProperty('z-index', '1000');
2056
+ }
2057
+ this.activeFloatId = id;
2058
+ if (id) {
2059
+ const { style } = document.getElementById(id) || {};
2060
+ style?.setProperty('z-index', '1001');
2061
+ }
2062
+ }
2063
+ };
2064
+ const useFloatStore = ()=>floatState;
2050
2065
  const Float = (props)=>{
2051
2066
  const { title, open, children, onCancel } = props;
2067
+ const id = useId();
2068
+ const floatStore = useFloatStore();
2052
2069
  const [position, setPosition] = useState({
2053
2070
  top: '10px',
2054
2071
  right: '400px'
@@ -2063,6 +2080,7 @@ const Float = (props)=>{
2063
2080
  const handleMouseDown = (e)=>{
2064
2081
  e.preventDefault();
2065
2082
  setHasMoved(false);
2083
+ floatStore.setActiveFloatId(id);
2066
2084
  if (containerRef.current) {
2067
2085
  const rect = containerRef.current.getBoundingClientRect();
2068
2086
  setOffset({
@@ -2094,6 +2112,12 @@ const Float = (props)=>{
2094
2112
  const handleMouseUp = useCallback(()=>{
2095
2113
  setIsDragging(false);
2096
2114
  }, []);
2115
+ const handleContainerClick = useCallback(()=>{
2116
+ floatStore.setActiveFloatId(id);
2117
+ }, [
2118
+ id,
2119
+ floatStore
2120
+ ]);
2097
2121
  useEffect(()=>{
2098
2122
  if (isDragging) {
2099
2123
  document.addEventListener('mousemove', handleMouseMove);
@@ -2108,7 +2132,15 @@ const Float = (props)=>{
2108
2132
  handleMouseMove,
2109
2133
  handleMouseUp
2110
2134
  ]);
2135
+ useEffect(()=>{
2136
+ if (open) floatStore.setActiveFloatId(id);
2137
+ }, [
2138
+ open,
2139
+ id,
2140
+ floatStore
2141
+ ]);
2111
2142
  return /*#__PURE__*/ createPortal(/*#__PURE__*/ jsxs("div", {
2143
+ id: id,
2112
2144
  ref: containerRef,
2113
2145
  className: `${Float_index_module.root} ${isDragging ? Float_index_module.dragging : ''}`,
2114
2146
  style: {
@@ -2116,6 +2148,7 @@ const Float = (props)=>{
2116
2148
  right: position.right,
2117
2149
  display: open ? 'flex' : 'none'
2118
2150
  },
2151
+ onClick: handleContainerClick,
2119
2152
  children: [
2120
2153
  /*#__PURE__*/ jsxs(Flex, {
2121
2154
  className: Float_index_module.title,
@@ -1,3 +1,4 @@
1
+ import { parseCoordinate } from './CoordinateInput/parseMethods';
1
2
  import FormatChange from './FormatChange';
2
3
  declare const _default: {
3
4
  DDD: (props: {
@@ -33,5 +34,5 @@ declare const _default: {
33
34
  }) => import("react/jsx-runtime").JSX.Element;
34
35
  };
35
36
  export default _default;
36
- export { FormatChange };
37
+ export { FormatChange, parseCoordinate };
37
38
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/CoordinateTrans/components/index.ts"],"names":[],"mappings":"AAGA,OAAO,YAAY,MAAM,gBAAgB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG1C,wBAAsC;AACtC,OAAO,EAAE,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/CoordinateTrans/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAIjE,OAAO,YAAY,MAAM,gBAAgB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG1C,wBAAsC;AACtC,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import CoordinateTrans from './CoordinateTrans';
2
- import { FormatChange } from './components';
2
+ import { FormatChange, parseCoordinate } from './components';
3
3
  import { CoordinateInput } from './components/CoordinateInput';
4
4
  export default CoordinateTrans;
5
- export { CoordinateTrans, CoordinateInput, FormatChange };
5
+ export { CoordinateTrans, CoordinateInput, FormatChange, parseCoordinate };
6
6
  export * from './weapon';
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/CoordinateTrans/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,eAAe,eAAe,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,YAAY,EAAE,CAAC;AAE1D,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/CoordinateTrans/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE/D,eAAe,eAAe,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,YAAY,EAAE,eAAe,EAAE,CAAC;AAE3E,cAAc,UAAU,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Float/index.tsx"],"names":[],"mappings":"AAMA,KAAK,UAAU,GAAG;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,QAAA,MAAM,KAAK,GAAI,OAAO,UAAU,gCAiG/B,CAAC;AAEF,eAAe,KAAK,CAAC;AACrB,OAAO,EAAE,KAAK,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Float/index.tsx"],"names":[],"mappings":"AAOA,KAAK,UAAU,GAAG;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,QAAA,MAAM,KAAK,GAAI,OAAO,UAAU,gCAiH/B,CAAC;AAEF,eAAe,KAAK,CAAC;AACrB,OAAO,EAAE,KAAK,EAAE,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const useFloatStore: () => {
2
+ activeFloatId: string | null;
3
+ setActiveFloatId(id: string | null): void;
4
+ };
5
+ //# sourceMappingURL=store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../../src/components/Float/store.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,aAAa;mBAdD,MAAM,GAAG,IAAI;yBACf,MAAM,GAAG,IAAI;CAaS,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mapless/react",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "type": "module",
5
5
  "description": "React components for mapless library",
6
6
  "main": "dist/index.js",