@baishuyun/ui-mobile 0.4.0 → 0.6.0

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.
Files changed (86) hide show
  1. package/README.md +2 -11
  2. package/dist/AMap/AMap-BWZ2lhXr.js +683 -0
  3. package/dist/AMap/index.js +5 -0
  4. package/dist/ActionSheet/ActionSheet-DbrKxa_y.js +133 -0
  5. package/dist/ActionSheet/index.js +5 -0
  6. package/dist/Calendar/Calendar-Bd6CS8y7.js +1580 -0
  7. package/dist/Calendar/index.js +4 -3
  8. package/dist/Calendar/timeUtils-t4A3-Hr6.js +27 -0
  9. package/dist/ConfigProvider/ConfigProvider-DnlakyRE.js +208 -0
  10. package/dist/ConfigProvider/index.js +4 -4
  11. package/dist/ConfigProvider/useLocale-CP8NRZoj.js +115 -0
  12. package/dist/Gantt/Gantt-CR7eRNVP.js +1094 -0
  13. package/dist/Gantt/index.js +7 -3
  14. package/dist/Icon/Icon-CFvcrGGg.js +23 -0
  15. package/dist/Icon/index.js +3 -0
  16. package/dist/components/AMap/AMap.d.ts +3 -0
  17. package/dist/components/AMap/Controls/Controls.d.ts +3 -0
  18. package/dist/components/AMap/Controls/index.d.ts +1 -0
  19. package/dist/components/AMap/Locate/Locate.d.ts +3 -0
  20. package/dist/components/AMap/Locate/index.d.ts +1 -0
  21. package/dist/components/AMap/Markers/Markers.d.ts +3 -0
  22. package/dist/components/AMap/Markers/index.d.ts +1 -0
  23. package/dist/components/AMap/PoiSearch/PoiSearch.d.ts +3 -0
  24. package/dist/components/AMap/PoiSearch/index.d.ts +1 -0
  25. package/dist/components/AMap/context.d.ts +7 -0
  26. package/dist/components/AMap/ensureAMap.d.ts +7 -0
  27. package/dist/components/AMap/index.d.ts +15 -0
  28. package/dist/components/AMap/interface.d.ts +66 -0
  29. package/dist/components/AMap/utils/cx.d.ts +1 -0
  30. package/dist/components/AMap/utils/geometry.d.ts +21 -0
  31. package/dist/components/AMap/utils/markerHtml.d.ts +21 -0
  32. package/dist/components/AMap/utils/searchPois.d.ts +6 -0
  33. package/dist/components/ActionSheet/ActionSheet.d.ts +3 -0
  34. package/dist/components/ActionSheet/index.d.ts +2 -0
  35. package/dist/components/ActionSheet/interface.d.ts +75 -0
  36. package/dist/components/Calendar/index.d.ts +1 -1
  37. package/dist/components/Calendar/interface.d.ts +59 -1
  38. package/dist/components/ConfigProvider/ConfigContext.d.ts +11 -0
  39. package/dist/components/ConfigProvider/ConfigProvider.d.ts +1 -1
  40. package/dist/components/ConfigProvider/context.d.ts +18 -0
  41. package/dist/components/ConfigProvider/index.d.ts +2 -1
  42. package/dist/components/Gantt/Gantt.d.ts +1 -1
  43. package/dist/components/Gantt/GanttBar.d.ts +12 -0
  44. package/dist/components/Gantt/GanttHeader.d.ts +2 -0
  45. package/dist/components/Gantt/GanttTimeLine.d.ts +9 -0
  46. package/dist/components/Gantt/HeaderToolbar.d.ts +6 -0
  47. package/dist/components/Gantt/OffscreenIndicatorArrow.d.ts +8 -0
  48. package/dist/components/Gantt/OffscreenIndicatorOverlay.d.ts +14 -0
  49. package/dist/components/Gantt/StickyLabel.d.ts +10 -0
  50. package/dist/components/Gantt/TodayIndicator.d.ts +14 -0
  51. package/dist/components/Gantt/context.d.ts +27 -0
  52. package/dist/components/Gantt/hooks/useGanttScroll.d.ts +23 -0
  53. package/dist/components/Gantt/hooks/useGanttViewport.d.ts +20 -0
  54. package/dist/components/Gantt/hooks/useTodayTracker.d.ts +7 -0
  55. package/dist/components/Gantt/index.d.ts +2 -1
  56. package/dist/components/Gantt/interface.d.ts +27 -2
  57. package/dist/components/Gantt/utils/calcTodayLeft.d.ts +8 -0
  58. package/dist/components/Gantt/utils/color.d.ts +2 -0
  59. package/dist/components/Gantt/utils/cx.d.ts +1 -0
  60. package/dist/components/Gantt/utils/dateRangeNormalizer.d.ts +25 -0
  61. package/dist/components/Gantt/utils/dayScale.d.ts +30 -0
  62. package/dist/components/Gantt/utils/headerTimeUtils.d.ts +43 -0
  63. package/dist/components/Gantt/utils/layoutBars.d.ts +26 -0
  64. package/dist/components/Gantt/utils/msUntilNextDay.d.ts +2 -0
  65. package/dist/components/Gantt/utils/time.d.ts +4 -0
  66. package/dist/components/Gantt/utils/viewportDateUtils.d.ts +11 -0
  67. package/dist/components/Gantt/utils/zoomReanchor.d.ts +18 -0
  68. package/dist/components/Icon/Icon.d.ts +6 -0
  69. package/dist/components/Icon/index.d.ts +2 -0
  70. package/dist/components/Icon/interface.d.ts +19 -0
  71. package/dist/components/Icon/loadIconfont.d.ts +1 -0
  72. package/dist/components/index.d.ts +10 -3
  73. package/dist/index.js +10 -6
  74. package/dist/locale/index.d.ts +3 -0
  75. package/dist/locale/lang/en-US.json.d.ts +52 -0
  76. package/dist/locale/lang/zh-CN.json.d.ts +52 -0
  77. package/dist/locale/lang/zh-TW.json.d.ts +52 -0
  78. package/dist/style.css +1 -1
  79. package/dist/vendors/{version-v6TU1ff1.js → version-qi3OapTz.js} +1 -1
  80. package/dist/vite-env.d.ts +1 -0
  81. package/package.json +7 -1
  82. package/dist/Calendar/Calendar-C63wg0aw.js +0 -1601
  83. package/dist/ConfigProvider/ConfigProvider-E792q6ny.js +0 -99
  84. package/dist/Gantt/Gantt-DLmqZPAQ.js +0 -8
  85. package/dist/locale/context/LocaleContext.d.ts +0 -7
  86. package/dist/vendors/useLocale-BbUDQCzl.js +0 -57
@@ -1,3 +1,7 @@
1
- import "../vendors/version-v6TU1ff1.js";
2
- import { t as e } from "./Gantt-DLmqZPAQ.js";
3
- export { e as default };
1
+ import "../vendors/version-qi3OapTz.js";
2
+ import "../ActionSheet/ActionSheet-DbrKxa_y.js";
3
+ import { n as e, t } from "./Gantt-CR7eRNVP.js";
4
+ import "../Icon/Icon-CFvcrGGg.js";
5
+ import "../ConfigProvider/useLocale-CP8NRZoj.js";
6
+ import "../Calendar/timeUtils-t4A3-Hr6.js";
7
+ export { e as ALL_ZOOM_LEVELS, t as default };
@@ -0,0 +1,23 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ //#region src/components/Icon/Icon.module.scss
3
+ var t = { "bsy-icon": "_bsy-icon_gwzb9_1" }, n = /* @__PURE__ */ new Set();
4
+ //#endregion
5
+ //#region src/components/Icon/Icon.tsx
6
+ ((e) => {
7
+ if (!e || n.has(e) || (n.add(e), [...document.scripts].some((t) => t.getAttribute("src") === e))) return;
8
+ let t = document.createElement("script");
9
+ t.setAttribute("src", e), document.body.appendChild(t);
10
+ })("https://at.alicdn.com/t/c/font_4786625_7yye49rghck.js");
11
+ var r = ({ name: n, size: r = 16, color: i, className: a }) => /* @__PURE__ */ e("svg", {
12
+ className: [t["bsy-icon"], a].filter(Boolean).join(" "),
13
+ style: {
14
+ color: i,
15
+ fontSize: `${r}px`
16
+ },
17
+ "aria-hidden": !0,
18
+ focusable: "false",
19
+ children: /* @__PURE__ */ e("use", { href: `#icon-${n}` })
20
+ });
21
+ r.displayName = "BsyIcon";
22
+ //#endregion
23
+ export { r as t };
@@ -0,0 +1,3 @@
1
+ import "../vendors/version-qi3OapTz.js";
2
+ import { t as e } from "./Icon-CFvcrGGg.js";
3
+ export { e as default };
@@ -0,0 +1,3 @@
1
+ import { AMapRootProps } from './interface';
2
+ declare const AMapRoot: ({ mapKey, securityJsCode, zoom, center, className, children, onReady, onError, }: AMapRootProps) => import("react").JSX.Element;
3
+ export default AMapRoot;
@@ -0,0 +1,3 @@
1
+ import { AMapControlsProps } from '../interface';
2
+ declare const AMapControls: ({ children, className }: AMapControlsProps) => import("react").JSX.Element;
3
+ export default AMapControls;
@@ -0,0 +1 @@
1
+ export { default } from './Controls';
@@ -0,0 +1,3 @@
1
+ import { AMapLocateProps } from '../interface';
2
+ declare const AMapLocate: ({ onLocate, onError }: AMapLocateProps) => import("react").JSX.Element;
3
+ export default AMapLocate;
@@ -0,0 +1 @@
1
+ export { default } from './Locate';
@@ -0,0 +1,3 @@
1
+ import { AMapMarkersProps } from '../interface';
2
+ declare const AMapMarkers: ({ items, cluster, icon, size, labelColor, highlightId, fitView, onClick, onDisplayChange, }: AMapMarkersProps) => null;
3
+ export default AMapMarkers;
@@ -0,0 +1 @@
1
+ export { default } from './Markers';
@@ -0,0 +1,3 @@
1
+ import { AMapPoiSearchProps } from '../interface';
2
+ declare const AMapPoiSearch: ({ onSelect }: AMapPoiSearchProps) => import("react").JSX.Element;
3
+ export default AMapPoiSearch;
@@ -0,0 +1 @@
1
+ export { default } from './PoiSearch';
@@ -0,0 +1,7 @@
1
+ import { AMapContextValue } from './interface';
2
+ export declare const AMapContext: import('react').Context<AMapContextValue | null>;
3
+ export declare const useAMap: () => {
4
+ map: any;
5
+ ready: boolean;
6
+ };
7
+ export declare const useAMapInternal: () => AMapContextValue | null;
@@ -0,0 +1,7 @@
1
+ export type EnsureAMapOptions = {
2
+ key?: string;
3
+ securityJsCode?: string;
4
+ };
5
+ export declare const ensureAMap: (options?: EnsureAMapOptions) => Promise<any>;
6
+ export declare const loadAMapPlugin: (pluginNames: string[]) => Promise<void>;
7
+ export declare const resetEnsureAMapForTests: () => void;
@@ -0,0 +1,15 @@
1
+ import { default as AMapRoot } from './AMap';
2
+ import { default as AMapControls } from './Controls';
3
+ import { default as AMapLocate } from './Locate';
4
+ import { default as AMapMarkers } from './Markers';
5
+ import { default as AMapPoiSearch } from './PoiSearch';
6
+ type AMapComponent = typeof AMapRoot & {
7
+ Markers: typeof AMapMarkers;
8
+ PoiSearch: typeof AMapPoiSearch;
9
+ Controls: typeof AMapControls;
10
+ Locate: typeof AMapLocate;
11
+ };
12
+ declare const AMap: AMapComponent;
13
+ export default AMap;
14
+ export { useAMap } from './context';
15
+ export type { AMapControlsProps, AMapLabelColor, AMapLocateProps, AMapMarker, AMapMarkerDisplayChange, AMapMarkerSize, AMapMarkersProps, AMapPoiItem, AMapPoiSearchProps, AMapRootProps, Location, } from './interface';
@@ -0,0 +1,66 @@
1
+ import { ReactNode } from 'react';
2
+ import { Location } from './utils/geometry';
3
+ export type { Location };
4
+ export type AMapMarkerSize = 'small' | 'middle' | 'large';
5
+ export type AMapLabelColor = 'dark' | 'light';
6
+ export interface AMapMarker {
7
+ id: string;
8
+ lng: number;
9
+ lat: number;
10
+ label?: string | null;
11
+ color?: string;
12
+ }
13
+ export type AMapMarkerDisplayChange = {
14
+ type: 'standalone';
15
+ id: string;
16
+ } | {
17
+ type: 'clustered';
18
+ ids: string[];
19
+ };
20
+ export interface AMapPoiItem {
21
+ id: string;
22
+ title: string;
23
+ address: string;
24
+ lng: number;
25
+ lat: number;
26
+ }
27
+ export interface AMapRootProps {
28
+ /**
29
+ * 实例级高德 key。不能命名为 `key`,那是 React 保留属性。
30
+ */
31
+ mapKey?: string;
32
+ securityJsCode?: string;
33
+ zoom?: number;
34
+ center?: Location;
35
+ className?: string;
36
+ children?: ReactNode;
37
+ onReady?: (map: any) => void;
38
+ onError?: (error: Error) => void;
39
+ }
40
+ export interface AMapMarkersProps {
41
+ items?: AMapMarker[];
42
+ cluster?: boolean;
43
+ icon?: string;
44
+ size?: AMapMarkerSize;
45
+ labelColor?: AMapLabelColor;
46
+ highlightId?: string | null;
47
+ fitView?: boolean;
48
+ onClick?: (marker: AMapMarker) => void;
49
+ onDisplayChange?: (event: AMapMarkerDisplayChange) => void;
50
+ }
51
+ export interface AMapPoiSearchProps {
52
+ onSelect?: (poi: AMapPoiItem) => void;
53
+ }
54
+ export interface AMapControlsProps {
55
+ children?: ReactNode;
56
+ className?: string;
57
+ }
58
+ export interface AMapLocateProps {
59
+ onLocate?: (location: Location) => void;
60
+ onError?: (error: Error) => void;
61
+ }
62
+ export interface AMapContextValue {
63
+ map: any | null;
64
+ ready: boolean;
65
+ AMapNS: any | null;
66
+ }
@@ -0,0 +1 @@
1
+ export declare const cx: (...parts: Array<string | false | null | undefined>) => string;
@@ -0,0 +1,21 @@
1
+ export type Location = [lng: number, lat: number];
2
+ export declare const isValidLocation: (location: Location | null | undefined) => location is Location;
3
+ export declare const distanceMeters: (from: Location, target: {
4
+ lng: number;
5
+ lat: number;
6
+ }) => number;
7
+ export declare const sortByDistance: <T extends {
8
+ lng: number;
9
+ lat: number;
10
+ }>(items: T[], currentLocation: Location | null) => T[];
11
+ export declare const setViewportByPoints: ({ AMap, map, points, singleMarkerZoom, maxZoom, avoid, }: {
12
+ AMap: any;
13
+ map: any;
14
+ points: Array<{
15
+ lng: number;
16
+ lat: number;
17
+ }>;
18
+ singleMarkerZoom?: number;
19
+ maxZoom?: number;
20
+ avoid?: [number, number, number, number];
21
+ }) => boolean;
@@ -0,0 +1,21 @@
1
+ import { AMapLabelColor, AMapMarkerSize } from '../interface';
2
+ export declare const MARKER_SIZE_MAP: Record<AMapMarkerSize, number>;
3
+ export declare const DEFAULT_MARKER_ICON = "Address";
4
+ export declare const DEFAULT_MARKER_COLOR = "#0265ff";
5
+ export declare const DEFAULT_MAP_ZOOM = 17;
6
+ export declare const resolveMarkerOffset: (AMap: any, markerSize: AMapMarkerSize) => any;
7
+ export declare const calculateClusterMarkerWidth: (count: number) => number;
8
+ export declare const hasIconSymbol: (iconType: string) => boolean;
9
+ export declare const escapeHtml: (text: string) => string;
10
+ export declare const renderSingleMarkerHtml: ({ color, labelText, iconType, iconSize, iconAvailable, highlightActive, highlightNonce, labelColor, }: {
11
+ color: string;
12
+ labelText: string | null;
13
+ iconType: string;
14
+ iconSize: number;
15
+ iconAvailable: boolean;
16
+ highlightActive: boolean;
17
+ highlightNonce: number;
18
+ labelColor: AMapLabelColor;
19
+ }) => string;
20
+ export declare const renderClusterMarkerHtml: (count: number) => string;
21
+ export declare const renderCurrentLocationMarkerHtml: () => string;
@@ -0,0 +1,6 @@
1
+ import { AMapPoiItem } from '../interface';
2
+ export declare const searchPois: ({ AMap, keyword, pageSize, }: {
3
+ AMap: any;
4
+ keyword: string;
5
+ pageSize: number;
6
+ }) => Promise<AMapPoiItem[]>;
@@ -0,0 +1,3 @@
1
+ import { ActionSheetProps } from './interface';
2
+ declare const ActionSheet: ({ open, onClose, mode, title, actions, onAction, children, zIndex, getPopupContainer, className, }: ActionSheetProps) => import('react').ReactPortal | null;
3
+ export default ActionSheet;
@@ -0,0 +1,2 @@
1
+ export { default } from './ActionSheet';
2
+ export type { ActionSheetProps, ActionSheetAction, ActionSheetMode } from './interface';
@@ -0,0 +1,75 @@
1
+ import { ReactNode } from 'react';
2
+ /**
3
+ * @description 内置列表形态:`select` 勾选当前值,`menu` 居中菜单
4
+ */
5
+ export type ActionSheetMode = 'select' | 'menu';
6
+ export interface ActionSheetAction {
7
+ /**
8
+ * @description 项标识
9
+ */
10
+ key: string;
11
+ /**
12
+ * @description 文案
13
+ */
14
+ text: ReactNode;
15
+ /**
16
+ * @description 为 `true` 时禁用:变灰、不触发 `onAction`、不关闭
17
+ */
18
+ disabled?: boolean;
19
+ /**
20
+ * @description 仅 `select`:为 `true` 时高亮并显示勾选
21
+ */
22
+ selected?: boolean;
23
+ /**
24
+ * @description 仅 `menu`:左侧图标,建议 16×16
25
+ */
26
+ icon?: ReactNode;
27
+ /**
28
+ * @description 仅 `menu`:同时作用在图标和文字,如 `#ff5631`
29
+ */
30
+ color?: string;
31
+ }
32
+ export interface ActionSheetProps {
33
+ /**
34
+ * @description 是否打开
35
+ */
36
+ open: boolean;
37
+ /**
38
+ * @description 点蒙层、关闭按钮,或点未禁用的内置动作项
39
+ */
40
+ onClose: () => void;
41
+ /**
42
+ * @description 内置列表形态
43
+ * @default 'select'
44
+ */
45
+ mode?: ActionSheetMode;
46
+ /**
47
+ * @description 标题
48
+ */
49
+ title?: ReactNode;
50
+ /**
51
+ * @description 动作列表;传入 `children` 时忽略
52
+ */
53
+ actions?: ActionSheetAction[];
54
+ /**
55
+ * @description 点击未禁用项;内置列表随后会关闭
56
+ */
57
+ onAction?: (action: ActionSheetAction) => void;
58
+ /**
59
+ * @description 自定义 body,整块替换 `actions`,且不会因点项自动关闭
60
+ */
61
+ children?: ReactNode;
62
+ /**
63
+ * @description 根节点层级
64
+ * @default 1000
65
+ */
66
+ zIndex?: number;
67
+ /**
68
+ * @description 挂载节点;未传或返回空则用 `document.body`
69
+ */
70
+ getPopupContainer?: () => HTMLElement;
71
+ /**
72
+ * @description 根节点 class
73
+ */
74
+ className?: string;
75
+ }
@@ -1,2 +1,2 @@
1
1
  export { default } from './Calendar';
2
- export type { CalendarProps, CalendarEvent, CalendarViewMode, NormalizedCalendarEvent, } from './interface';
2
+ export type { CalendarProps, CalendarEvent, CalendarViewMode } from './interface';
@@ -1,27 +1,85 @@
1
1
  import { Dayjs } from 'dayjs';
2
+ /**
3
+ * @description 日历视图:日 / 三日 / 月
4
+ */
2
5
  export type CalendarViewMode = 'day' | 'threeDay' | 'month';
3
6
  export interface CalendarEvent {
7
+ /**
8
+ * @description 唯一标识
9
+ */
4
10
  id: string;
11
+ /**
12
+ * @description 标题
13
+ */
5
14
  label: string;
15
+ /**
16
+ * @description 开始时间
17
+ */
6
18
  startTime: number | string | Date | Dayjs;
19
+ /**
20
+ * @description 结束时间
21
+ */
7
22
  endTime: number | string | Date | Dayjs;
23
+ /**
24
+ * @description 允许附带业务字段,点击时原样回传
25
+ */
8
26
  [key: string]: unknown;
9
27
  }
10
28
  export interface CalendarProps {
29
+ /**
30
+ * @description 日程数据
31
+ * @default []
32
+ */
11
33
  events?: CalendarEvent[];
34
+ /**
35
+ * @description 主题色
36
+ */
12
37
  scheduleColor: string;
38
+ /**
39
+ * @description IANA 时区;未传则用浏览器本地时区
40
+ */
13
41
  timeZone?: string;
42
+ /**
43
+ * @description 受控当前视图
44
+ */
14
45
  mode?: CalendarViewMode;
46
+ /**
47
+ * @description 非受控初始视图
48
+ * @default 'month'
49
+ */
15
50
  defaultMode?: CalendarViewMode;
51
+ /**
52
+ * @description 受控当前日期
53
+ */
16
54
  value?: Date;
55
+ /**
56
+ * @description 非受控初始日期;未传则为当前时区「今天」
57
+ */
17
58
  defaultValue?: Date;
59
+ /**
60
+ * @description 根节点 class
61
+ */
18
62
  className?: string;
63
+ /**
64
+ * @description 点击日程条
65
+ */
19
66
  onEventClick?: (event: CalendarEvent) => void;
67
+ /**
68
+ * @description 月视图点击日期格,并带上该日日程
69
+ */
20
70
  onDayClick?: (date: Date, dayEvents: CalendarEvent[]) => void;
71
+ /**
72
+ * @description 视图变更
73
+ */
21
74
  onModeChange?: (mode: CalendarViewMode) => void;
75
+ /**
76
+ * @description 锚定日期变更(含手势翻页、「今天」)
77
+ */
22
78
  onChange?: (date: Date) => void;
23
79
  }
24
- /** 归一化后的内部事件(时间已转为 Dayjs) */
80
+ /**
81
+ * @description 归一化后的内部事件(时间已转为 Dayjs)
82
+ */
25
83
  export interface NormalizedCalendarEvent {
26
84
  id: string;
27
85
  label: string;
@@ -0,0 +1,11 @@
1
+ import { LocaleKeys } from '../../hooks/useLocale';
2
+ import { Locale } from '../../locale';
3
+ import { LocaleParams } from '../../locale/formatLocaleMessage';
4
+ import { AMapConfig } from './context';
5
+ export type ConfigContextValue = {
6
+ locale: Locale;
7
+ t: (path: LocaleKeys, params?: LocaleParams) => string;
8
+ amap?: AMapConfig;
9
+ };
10
+ export declare const ConfigContext: import('react').Context<ConfigContextValue>;
11
+ export declare const useAMapConfig: () => AMapConfig | undefined;
@@ -1,3 +1,3 @@
1
1
  import { ConfigProviderProps } from './context';
2
- export declare const ConfigProvider: ({ locale: localeProp, children }: ConfigProviderProps) => import("react").JSX.Element;
2
+ export declare const ConfigProvider: ({ locale: localeProp, amap, children }: ConfigProviderProps) => import("react").JSX.Element;
3
3
  export default ConfigProvider;
@@ -1,6 +1,24 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { Locale } from '../../locale';
3
+ export type AMapConfig = {
4
+ /**
5
+ * @description 高德 JSAPI key。页面上还没有 maps 脚本时用于加载。
6
+ */
7
+ key: string;
8
+ /**
9
+ * @description 高德安全密钥。仅在尚未设置 window._AMapSecurityConfig 时写入。
10
+ */
11
+ securityJsCode?: string;
12
+ };
3
13
  export type ConfigProviderProps = {
14
+ /**
15
+ * @description 文案语言;未传则沿用上层
16
+ * @default 'zh-CN'
17
+ */
4
18
  locale?: Locale;
19
+ /**
20
+ * @description 高德地图配置。任意 App 接入 AMap 的正式入口。
21
+ */
22
+ amap?: AMapConfig;
5
23
  children?: ReactNode;
6
24
  };
@@ -1,5 +1,6 @@
1
1
  export { ConfigProvider, default } from './ConfigProvider';
2
2
  export { useLocale } from '../../hooks/useLocale';
3
+ export { useAMapConfig } from './ConfigContext';
3
4
  export type { LocaleKeys } from '../../hooks/useLocale';
4
- export type { ConfigProviderProps } from './context';
5
+ export type { ConfigProviderProps, AMapConfig } from './context';
5
6
  export type { Locale } from '../../locale';
@@ -1,3 +1,3 @@
1
1
  import { GanttProps } from './interface';
2
- declare const Gantt: ({ className, children }: GanttProps) => import("react").JSX.Element;
2
+ declare const Gantt: (props: GanttProps) => import("react").JSX.Element;
3
3
  export default Gantt;
@@ -0,0 +1,12 @@
1
+ import { MutableRefObject } from 'react';
2
+ import { GanttTask } from './interface';
3
+ import { LayoutGanttBar } from './utils/layoutBars';
4
+ declare const _default: import('react').MemoExoticComponent<({ bar, top, horizontalScrollRef, verticalScrollRef, overlayHost, onClick, }: {
5
+ bar: LayoutGanttBar;
6
+ top: number;
7
+ horizontalScrollRef: MutableRefObject<HTMLDivElement | null>;
8
+ verticalScrollRef: MutableRefObject<HTMLDivElement | null>;
9
+ overlayHost: HTMLDivElement | null;
10
+ onClick?: (task: GanttTask) => void;
11
+ }) => import("react").JSX.Element>;
12
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const GanttHeader: () => import("react").JSX.Element;
2
+ export default GanttHeader;
@@ -0,0 +1,9 @@
1
+ import { MutableRefObject } from 'react';
2
+ import { LayoutGanttBar } from './utils/layoutBars';
3
+ import { GanttTask } from './interface';
4
+ declare const GanttTimeLine: ({ bars, onTaskClick, overlayHostRef, }: {
5
+ bars: LayoutGanttBar[];
6
+ onTaskClick?: (task: GanttTask) => void;
7
+ overlayHostRef?: MutableRefObject<HTMLDivElement | null>;
8
+ }) => import("react").JSX.Element;
9
+ export default GanttTimeLine;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 右侧工具栏固定在 Header 视口边缘。
3
+ * 它故意不参与时间轴横向滚动,否则缩放和导航入口会跟着内容一起跑掉。
4
+ */
5
+ declare const HeaderToolbar: () => import("react").JSX.Element;
6
+ export default HeaderToolbar;
@@ -0,0 +1,8 @@
1
+ interface OffscreenIndicatorArrowProps {
2
+ direction: 'left' | 'right';
3
+ edge: 'left' | 'right';
4
+ offset: number;
5
+ onClick: () => void;
6
+ }
7
+ declare const _default: import('react').MemoExoticComponent<({ direction, edge, offset, onClick, }: OffscreenIndicatorArrowProps) => import("react").JSX.Element>;
8
+ export default _default;
@@ -0,0 +1,14 @@
1
+ import { MutableRefObject } from 'react';
2
+ import { Dayjs } from 'dayjs';
3
+ import { VirtualItem } from '@tanstack/react-virtual';
4
+ import { LayoutGanttBar } from './utils/layoutBars';
5
+ interface OffscreenIndicatorOverlayProps {
6
+ virtualRows: VirtualItem[];
7
+ bars: LayoutGanttBar[];
8
+ horizontalScrollRef: MutableRefObject<HTMLDivElement | null>;
9
+ viewportWidth: number;
10
+ rowHeight: number;
11
+ onNavigate: (startDate: Dayjs | null) => void;
12
+ }
13
+ declare const _default: import('react').MemoExoticComponent<({ virtualRows, bars, horizontalScrollRef, viewportWidth, rowHeight, onNavigate, }: OffscreenIndicatorOverlayProps) => import("react").JSX.Element>;
14
+ export default _default;
@@ -0,0 +1,10 @@
1
+ import { Row1Cell } from './utils/headerTimeUtils';
2
+ interface StickyLabelProps {
3
+ cell: Row1Cell;
4
+ }
5
+ /**
6
+ * Row1 标签只交给浏览器原生 sticky 处理。
7
+ * 如果再让 JS 逐帧推吸附位置,移动端惯性滚动时会重新走一条更慢的更新链路。
8
+ */
9
+ declare const StickyLabel: ({ cell }: StickyLabelProps) => import("react").JSX.Element;
10
+ export default StickyLabel;
@@ -0,0 +1,14 @@
1
+ import { Dayjs } from 'dayjs';
2
+ import { ZoomLevel } from './interface';
3
+ interface TodayIndicatorProps {
4
+ today: Dayjs;
5
+ startDate: Dayjs;
6
+ pxPerDay: number;
7
+ totalDays: number;
8
+ zoomLevel: ZoomLevel;
9
+ }
10
+ /**
11
+ * 时间轴只负责“今天”竖线,Header 单独负责圆点。
12
+ */
13
+ declare const TodayIndicator: ({ today, startDate, pxPerDay, totalDays, zoomLevel, }: TodayIndicatorProps) => import("react").JSX.Element | null;
14
+ export default TodayIndicator;
@@ -0,0 +1,27 @@
1
+ import { MutableRefObject } from 'react';
2
+ import { Dayjs } from 'dayjs';
3
+ import { ZoomLevel } from './interface';
4
+ export type GanttStateContextType = {
5
+ zoomLevel: ZoomLevel;
6
+ pxPerDay: number;
7
+ timeZone?: string;
8
+ viewportWidth: number;
9
+ anchorDate: Dayjs;
10
+ startDate: Dayjs;
11
+ count: number;
12
+ totalDays: number;
13
+ totalWidth: number;
14
+ };
15
+ export type GanttActionContextType = {
16
+ setZoomLevel: (level: ZoomLevel) => void;
17
+ horizontalScrollRef: MutableRefObject<HTMLDivElement | null>;
18
+ scrollToX: (left: number, behavior?: ScrollBehavior) => void;
19
+ getScrollLeft: () => number;
20
+ handleTodayClick: () => void;
21
+ navigateToBar: (startDate: Dayjs | null) => void;
22
+ };
23
+ declare const GanttStateContext: import('react').Context<GanttStateContextType | null>;
24
+ declare const GanttActionContext: import('react').Context<GanttActionContextType | null>;
25
+ export declare const useGanttState: () => GanttStateContextType;
26
+ export declare const useGanttAction: () => GanttActionContextType;
27
+ export { GanttStateContext, GanttActionContext };
@@ -0,0 +1,23 @@
1
+ import { MutableRefObject } from 'react';
2
+ import { Dayjs } from 'dayjs';
3
+ import { ZoomLevel } from '../interface';
4
+ import { GanttViewportModel } from './useGanttViewport';
5
+ interface GanttScrollController {
6
+ horizontalScrollRef: MutableRefObject<HTMLDivElement | null>;
7
+ scrollToX: (left: number, behavior?: ScrollBehavior) => void;
8
+ getScrollLeft: () => number;
9
+ handleHorizontalScroll: () => void;
10
+ setZoomLevel: (level: ZoomLevel) => void;
11
+ handleTodayClick: () => void;
12
+ navigateToBar: (startDate: Dayjs | null) => void;
13
+ }
14
+ /**
15
+ * 维护甘特图横向滚动坐标系。
16
+ *
17
+ * [核心目标] 用户无论在 resize、zoom、拖拽或“回到今天”之间切换,
18
+ * 当前观察焦点都应保持稳定;否则时间轴会出现“跳屏感”。
19
+ */
20
+ export declare function useGanttScroll(viewport: GanttViewportModel, { onZoomLevelChange }: {
21
+ onZoomLevelChange: (level: ZoomLevel) => void;
22
+ }): GanttScrollController;
23
+ export {};
@@ -0,0 +1,20 @@
1
+ import { MutableRefObject } from 'react';
2
+ import { Dayjs } from 'dayjs';
3
+ import { ZoomLevel } from '../interface';
4
+ export interface GanttViewportModel {
5
+ timeZone?: string;
6
+ zoomLevel: ZoomLevel;
7
+ pxPerDay: number;
8
+ anchorDate: Dayjs;
9
+ containerRef: MutableRefObject<HTMLDivElement | null>;
10
+ viewportWidth: number;
11
+ startDate: Dayjs;
12
+ count: number;
13
+ totalDays: number;
14
+ totalWidth: number;
15
+ setAnchorDate: (date: Dayjs) => void;
16
+ }
17
+ export declare function useGanttViewport({ timeZone, initialZoomLevel, }: {
18
+ timeZone?: string;
19
+ initialZoomLevel?: ZoomLevel;
20
+ }): GanttViewportModel;
@@ -0,0 +1,7 @@
1
+ import { Dayjs } from 'dayjs';
2
+ import { ZoomLevel } from '../interface';
3
+ /**
4
+ * 低成本地追踪“今天 / 当前格”。
5
+ * 日历档只在业务时区跨天时更新;亚日档在当前 bottom 格结束时更新。
6
+ */
7
+ export declare function useTodayTracker(timeZone?: string, zoomLevel?: ZoomLevel): Dayjs;
@@ -1,2 +1,3 @@
1
1
  export { default } from './Gantt';
2
- export type { GanttProps } from './interface';
2
+ export type { GanttProps, GanttTask, ZoomLevel } from './interface';
3
+ export { ALL_ZOOM_LEVELS } from './interface';