zs_library 0.9.0 → 0.9.2
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/README.md +25 -0
- package/dist/components/desktop/context-menu/index.d.ts +2 -1
- package/dist/components/desktop-next/context.d.ts +4 -2
- package/dist/components/desktop-next/index.d.ts +2 -1
- package/dist/components/desktop-next/types.d.ts +2 -1
- package/dist/index.css +1 -1
- package/dist/index.js +5147 -5060
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -5,6 +5,31 @@
|
|
|
5
5
|
|
|
6
6
|
个人业务组件库 React
|
|
7
7
|
|
|
8
|
+
## 组件列表
|
|
9
|
+
|
|
10
|
+
### 布局
|
|
11
|
+
|
|
12
|
+
| 组件 | 说明 |
|
|
13
|
+
| --- | --- |
|
|
14
|
+
| `DesktopNext` | 基于 motion 实现的轻量级桌面组件,类似 iPadOS 桌面效果。支持拖拽排序、拖拽合并文件夹、多页分页、右键菜单、组件注册表、主题定制、布局持久化。**推荐使用** |
|
|
15
|
+
| `Desktop` | 基于 react-sortablejs 封装实现的桌面组件,支持排序、文件夹、分页、本地存储、主题定制、右键菜单和 Dock 栏。**已废弃,请使用 DesktopNext** |
|
|
16
|
+
| `Dock` | macOS / iOS 风格的 Dock 栏组件,支持桌面端(放大悬浮动效)和移动端两种模式 |
|
|
17
|
+
|
|
18
|
+
### 数据录入
|
|
19
|
+
|
|
20
|
+
| 组件 | 说明 |
|
|
21
|
+
| --- | --- |
|
|
22
|
+
| `SimpleEditor` | 基于 Tiptap 的富文本编辑器,支持常见文本格式、图片上传、AI 辅助写作、多种输出格式(HTML / JSON / Markdown)、受控模式 |
|
|
23
|
+
| `MdEditor` | Markdown 编辑器,支持实时预览、图片上传、主题切换。**已废弃,请使用 SimpleEditor** |
|
|
24
|
+
|
|
25
|
+
### 数据展示
|
|
26
|
+
|
|
27
|
+
| 组件 | 说明 |
|
|
28
|
+
| --- | --- |
|
|
29
|
+
| `GeoMap` | 基于 react-map-gl 和 maplibre-gl 的中国地理地图组件,支持按缩放级别自动加载/卸载行政区划数据、自定义数据源 |
|
|
30
|
+
| `Markdown` | Markdown 渲染组件,支持 GFM、代码高亮、图片预览、emoji |
|
|
31
|
+
| `PhotoWatermark` | 基于 Canvas 的照片水印生成组件,支持多品牌相机风格、自动提取 EXIF 信息、Canvas/HTML 双渲染模式 |
|
|
32
|
+
|
|
8
33
|
## 编码规范
|
|
9
34
|
|
|
10
35
|
参考 [Angular coding style guide](https://angular.dev/style-guide#file-structure-conventions)
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { SortItem } from '../types';
|
|
1
|
+
import { SortItem, MenuItemConfig } from '../types';
|
|
2
2
|
export interface ContextMenuProps<D, C> {
|
|
3
3
|
showShareButton?: boolean;
|
|
4
4
|
showInfoButton?: boolean;
|
|
5
5
|
showRemoveButton?: boolean;
|
|
6
6
|
showSizeButton?: boolean;
|
|
7
|
+
menuItems?: MenuItemConfig[];
|
|
7
8
|
onShareClick?: (item: SortItem<D, C>) => void;
|
|
8
9
|
onInfoClick?: (item: SortItem<D, C>) => void;
|
|
9
10
|
onRemoveClick?: (item: SortItem<D, C>, remove: (id: string) => void) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import { ComponentRegistry, ContextMenuActionPayload, ContextMenuData, DesktopDndContextMenuProps, DndSortItem, DndPageItem, DragState, FolderModalState, SortItemUserConfig, TypeConfigMap, DataTypeMenuConfigMap } from './types';
|
|
2
|
+
import { ComponentRegistry, ContextMenuActionPayload, ContextMenuData, DesktopDndContextMenuProps, DndSortItem, DndPageItem, DragState, FolderModalState, SortItemUserConfig, TypeConfigMap, DataTypeMenuConfigMap, PageTransition } from './types';
|
|
3
3
|
import { Theme } from './themes';
|
|
4
4
|
interface DesktopDndContextValue {
|
|
5
5
|
pages: DndPageItem[];
|
|
@@ -34,6 +34,7 @@ interface DesktopDndContextValue {
|
|
|
34
34
|
itemIconBuilderAllowNull?: boolean;
|
|
35
35
|
pagingDotBuilder?: (index: number, isActive: boolean) => React.ReactNode;
|
|
36
36
|
pagingDotsBuilder?: (dots: React.ReactNode[]) => React.ReactNode;
|
|
37
|
+
pageTransition?: PageTransition;
|
|
37
38
|
extraItems?: DndSortItem[];
|
|
38
39
|
componentRegistry?: ComponentRegistry;
|
|
39
40
|
removeItem: (itemId: string | number) => void;
|
|
@@ -75,10 +76,11 @@ interface DesktopDndProviderProps {
|
|
|
75
76
|
itemIconBuilderAllowNull?: boolean;
|
|
76
77
|
pagingDotBuilder?: (index: number, isActive: boolean) => React.ReactNode;
|
|
77
78
|
pagingDotsBuilder?: (dots: React.ReactNode[]) => React.ReactNode;
|
|
79
|
+
pageTransition?: PageTransition;
|
|
78
80
|
extraItems?: DndSortItem[];
|
|
79
81
|
storageKey?: string;
|
|
80
82
|
componentRegistry?: ComponentRegistry;
|
|
81
83
|
children: React.ReactNode;
|
|
82
84
|
}
|
|
83
|
-
export declare const DesktopDndProvider: ({ pages: externalPages, onChange, iconSize, maxPages, mergeDwellTime, containerRef, typeConfigMap, dataTypeMenuConfigMap, onRemoveClick, onContextMenuItemClick, contextMenuProps, theme: themeProp, noLetters, itemBuilder, itemBuilderAllowNull, itemIconBuilder, itemIconBuilderAllowNull, pagingDotBuilder, pagingDotsBuilder, extraItems, storageKey, componentRegistry, children, }: DesktopDndProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
85
|
+
export declare const DesktopDndProvider: ({ pages: externalPages, onChange, iconSize, maxPages, mergeDwellTime, containerRef, typeConfigMap, dataTypeMenuConfigMap, onRemoveClick, onContextMenuItemClick, contextMenuProps, theme: themeProp, noLetters, itemBuilder, itemBuilderAllowNull, itemIconBuilder, itemIconBuilderAllowNull, pagingDotBuilder, pagingDotsBuilder, pageTransition, extraItems, storageKey, componentRegistry, children, }: DesktopDndProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
84
86
|
export {};
|
|
@@ -12,6 +12,7 @@ export interface DesktopDndExtendedProps<D = unknown> extends DesktopDndProps<D>
|
|
|
12
12
|
theme?: Theme | "light" | "dark";
|
|
13
13
|
noLetters?: boolean;
|
|
14
14
|
storageKey?: string;
|
|
15
|
+
pageTransition?: import('./types').PageTransition;
|
|
15
16
|
itemBuilder?: (item: DndSortItem, index: number) => React.ReactNode | null;
|
|
16
17
|
itemBuilderAllowNull?: boolean;
|
|
17
18
|
itemIconBuilderAllowNull?: boolean;
|
|
@@ -24,7 +25,7 @@ declare const DesktopDnd: <D = unknown>(props: DesktopDndExtendedProps<D> & {
|
|
|
24
25
|
ref?: React.ForwardedRef<DesktopHandle>;
|
|
25
26
|
}) => JSX.Element;
|
|
26
27
|
export default DesktopDnd;
|
|
27
|
-
export type { DesktopDndProps, DndSortItem, DndPageItem, DndItemBaseData, SizeConfig, SortItemUserConfig, MenuItemConfig, DataTypeMenuConfigMap, SortItemDefaultConfig, TypeConfigMap, ContextMenuData, DesktopDndContextMenuProps, ContextMenuActionPayload, ContextMenuActionType, ListItem, SortItemBaseData, SortItemBaseConfig, ComponentRegistryEntry, ComponentRegistry, } from './types';
|
|
28
|
+
export type { DesktopDndProps, DndSortItem, DndPageItem, DndItemBaseData, SizeConfig, SortItemUserConfig, MenuItemConfig, DataTypeMenuConfigMap, SortItemDefaultConfig, TypeConfigMap, ContextMenuData, DesktopDndContextMenuProps, ContextMenuActionPayload, ContextMenuActionType, ListItem, SortItemBaseData, SortItemBaseConfig, ComponentRegistryEntry, ComponentRegistry, PageTransition, } from './types';
|
|
28
29
|
export { loadRemoteComponent, RemoteComponentErrorBoundary } from './component-registry/remote-loader';
|
|
29
30
|
export { appDefaultConfig, groupDefaultConfig, builtinConfigMap, getDefaultConfig, commonSizeConfigs, commonSizeConfigsArray, getSizeConfig, getItemSize, getDataTypeMenuConfig, } from './config';
|
|
30
31
|
export type { Theme, ThemeType } from './themes';
|
|
@@ -9,7 +9,7 @@ export interface DndItemBaseData {
|
|
|
9
9
|
export interface DndSortItem<D = any> {
|
|
10
10
|
id: string | number;
|
|
11
11
|
/** 项目类型: app 或 group(文件夹) */
|
|
12
|
-
type: "app" | "group";
|
|
12
|
+
type: "app" | "group" | string;
|
|
13
13
|
dataType?: string;
|
|
14
14
|
config?: SortItemUserConfig;
|
|
15
15
|
data?: D & DndItemBaseData;
|
|
@@ -46,6 +46,7 @@ export interface FolderModalState {
|
|
|
46
46
|
y: number;
|
|
47
47
|
} | null;
|
|
48
48
|
}
|
|
49
|
+
export type PageTransition = "slide" | "cube" | "fade" | "zoom";
|
|
49
50
|
/** 组件 Props */
|
|
50
51
|
export interface DesktopDndProps<D = any> {
|
|
51
52
|
pages: DndPageItem<D>[];
|