bj-web-components 0.2.18 → 0.2.19
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 +205 -205
- package/dist/index.d.ts +2 -3
- package/dist/style.css +1 -1
- package/dist/web/Dropdown/BDropdown.js +1 -1
- package/dist/web/Dropdown/BDropdown.mjs +38 -38
- package/dist/web/Table/BTable.js +1 -1
- package/dist/web/Table/BTable.mjs +14 -13
- package/dist/web.d.ts +2 -3
- package/package.json +92 -92
package/README.md
CHANGED
|
@@ -1,205 +1,205 @@
|
|
|
1
|
-
# bu-max-ui
|
|
2
|
-
|
|
3
|
-
企业级 UI 组件库,支持 Web、移动端、小程序三端,基于 React + TypeScript 构建。
|
|
4
|
-
|
|
5
|
-
## 安装
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install bu-max-ui
|
|
9
|
-
# 或
|
|
10
|
-
pnpm add bu-max-ui
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## 快速上手
|
|
14
|
-
|
|
15
|
-
引入组件时需同步引入样式文件:
|
|
16
|
-
|
|
17
|
-
```tsx
|
|
18
|
-
import { SkuInputCard } from 'bu-max-ui';
|
|
19
|
-
import 'bu-max-ui/style';
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## Iconfont 图标
|
|
23
|
-
|
|
24
|
-
Web 组件中的图标使用 `BuIcon`(与下方 `Iconfont` 实现等价)。宿主应用或文档站需要先加载项目 iconfont symbol:
|
|
25
|
-
|
|
26
|
-
```html
|
|
27
|
-
<script src="//at.alicdn.com/t/c/font_5123795_8zzfaepwkju.js"></script>
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
随后通过 `type` 传入 symbol id(不包含 `#`):
|
|
31
|
-
|
|
32
|
-
```tsx
|
|
33
|
-
import { BuIcon } from 'bu-max-ui/web';
|
|
34
|
-
|
|
35
|
-
<BuIcon type="icon-a-dagouxi" style={{ width: 14, height: 14, color: '#333' }} />
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
`BuIcon` 的实现如下:
|
|
39
|
-
|
|
40
|
-
```tsx
|
|
41
|
-
import React from 'react';
|
|
42
|
-
|
|
43
|
-
function Iconfont({ type, style, onClick, className, ...rest }) {
|
|
44
|
-
return (
|
|
45
|
-
<svg
|
|
46
|
-
style={style}
|
|
47
|
-
className={className ? `icon ${className}` : 'icon'}
|
|
48
|
-
aria-hidden="true"
|
|
49
|
-
onClick={onClick}
|
|
50
|
-
{...rest}
|
|
51
|
-
>
|
|
52
|
-
<use xlinkHref={`#${type}`} />
|
|
53
|
-
</svg>
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export default Iconfont;
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
### 基础用法
|
|
61
|
-
|
|
62
|
-
```tsx
|
|
63
|
-
import { useState } from 'react';
|
|
64
|
-
import { SkuInputCard } from 'bu-max-ui';
|
|
65
|
-
import 'bu-max-ui/style';
|
|
66
|
-
|
|
67
|
-
function App() {
|
|
68
|
-
const [name, setName] = useState('');
|
|
69
|
-
const [lang, setLang] = useState<'zh' | 'en'>('zh');
|
|
70
|
-
|
|
71
|
-
return (
|
|
72
|
-
<SkuInputCard
|
|
73
|
-
mode="bilingual"
|
|
74
|
-
name={name}
|
|
75
|
-
onNameChange={setName}
|
|
76
|
-
activeLang={lang}
|
|
77
|
-
onLangChange={setLang}
|
|
78
|
-
onDelete={() => setName('')}
|
|
79
|
-
/>
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
## 按需引入
|
|
85
|
-
|
|
86
|
-
支持按平台路径单独引入,减少构建体积:
|
|
87
|
-
|
|
88
|
-
```tsx
|
|
89
|
-
// Web 组件
|
|
90
|
-
import { SkuInputCard } from 'bu-max-ui/web';
|
|
91
|
-
|
|
92
|
-
// 移动端组件
|
|
93
|
-
import { ... } from 'bu-max-ui/mobile';
|
|
94
|
-
|
|
95
|
-
// 小程序组件
|
|
96
|
-
import { ... } from 'bu-max-ui/miniapp';
|
|
97
|
-
|
|
98
|
-
// 通用组件
|
|
99
|
-
import { ... } from 'bu-max-ui/shared';
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
## 组件列表
|
|
103
|
-
|
|
104
|
-
### Web
|
|
105
|
-
|
|
106
|
-
| 组件 | 说明 |
|
|
107
|
-
|------|------|
|
|
108
|
-
| `SkuInputCard` | 商品规格名称输入卡片,支持单语 / 双语模式、拖拽排序、图片上传 |
|
|
109
|
-
| `Button` | 按钮 |
|
|
110
|
-
| `Input` | 输入框 |
|
|
111
|
-
| `Card` | 卡片 |
|
|
112
|
-
| `Select` | 选择器 |
|
|
113
|
-
| `Tooltip` | 气泡提示 |
|
|
114
|
-
|
|
115
|
-
### Mobile
|
|
116
|
-
|
|
117
|
-
| 组件 | 说明 |
|
|
118
|
-
|------|------|
|
|
119
|
-
| `Button` | 移动端按钮 |
|
|
120
|
-
| `Input` | 移动端输入框 |
|
|
121
|
-
| `Card` | 移动端卡片 |
|
|
122
|
-
| `TabBar` | 底部导航栏 |
|
|
123
|
-
| `Navbar` | 顶部导航栏 |
|
|
124
|
-
| `ActionSheet` | 动作面板 |
|
|
125
|
-
| `Toast` | 轻提示 |
|
|
126
|
-
|
|
127
|
-
### 小程序
|
|
128
|
-
|
|
129
|
-
| 组件 | 说明 |
|
|
130
|
-
|------|------|
|
|
131
|
-
| `Button` | 小程序按钮 |
|
|
132
|
-
| `Input` | 小程序输入框 |
|
|
133
|
-
| `Card` | 小程序卡片 |
|
|
134
|
-
| `TabBar` | 底部导航栏 |
|
|
135
|
-
| `Navbar` | 顶部导航栏 |
|
|
136
|
-
| `ActionSheet` | 动作面板 |
|
|
137
|
-
| `Modal` | 弹窗 |
|
|
138
|
-
| `Loading` | 加载态 |
|
|
139
|
-
| `Toast` | 轻提示 |
|
|
140
|
-
| `Cell` | 单元格列表 |
|
|
141
|
-
|
|
142
|
-
## SkuInputCard Props
|
|
143
|
-
|
|
144
|
-
| 参数 | 类型 | 默认值 | 说明 |
|
|
145
|
-
|------|------|--------|------|
|
|
146
|
-
| `name` | `string` | `''` | 产品名称输入值 |
|
|
147
|
-
| `onNameChange` | `(value: string) => void` | — | 名称变更回调 |
|
|
148
|
-
| `mode` | `'single' \| 'bilingual'` | `'single'` | 单语或双语模式 |
|
|
149
|
-
| `activeLang` | `'zh' \| 'en'` | `'zh'` | 双语模式下当前语言 |
|
|
150
|
-
| `onLangChange` | `(lang: 'zh' \| 'en') => void` | — | 语言切换回调 |
|
|
151
|
-
| `showBody` | `boolean` | `true` | 是否显示内容区域 |
|
|
152
|
-
| `error` | `boolean` | `false` | 错误状态 |
|
|
153
|
-
| `onDelete` | `() => void` | — | 点击删除按钮回调 |
|
|
154
|
-
| `onUpload` | `(file: File) => string \| Promise<string>` | — | 自定义上传方法,返回图片 URL |
|
|
155
|
-
| `images` | `string[]` | — | 外部托管的图片列表 |
|
|
156
|
-
| `id` | `string` | — | 拖拽把手 id,供 DnD 库使用 |
|
|
157
|
-
| `className` | `string` | — | 自定义类名 |
|
|
158
|
-
| `style` | `CSSProperties` | — | 自定义样式 |
|
|
159
|
-
|
|
160
|
-
## 本地开发
|
|
161
|
-
|
|
162
|
-
```bash
|
|
163
|
-
# 克隆仓库
|
|
164
|
-
git clone <repo-url>
|
|
165
|
-
cd bu-max-ui
|
|
166
|
-
|
|
167
|
-
# 安装依赖
|
|
168
|
-
pnpm install
|
|
169
|
-
|
|
170
|
-
# 启动文档站(端口 3000)
|
|
171
|
-
pnpm dev
|
|
172
|
-
|
|
173
|
-
# 构建组件库
|
|
174
|
-
pnpm build:lib
|
|
175
|
-
|
|
176
|
-
# 监听模式(开发库时使用)
|
|
177
|
-
pnpm build:lib:watch
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
### 项目结构
|
|
181
|
-
|
|
182
|
-
```
|
|
183
|
-
├── lib/ # 组件库源码(npm 包)
|
|
184
|
-
│ ├── index.ts
|
|
185
|
-
│ ├── web/ # Web 平台组件
|
|
186
|
-
│ ├── mobile/ # 移动端组件
|
|
187
|
-
│ ├── miniapp/ # 小程序组件
|
|
188
|
-
│ ├── react/ # React 通用组件
|
|
189
|
-
│ └── shared/ # 共享工具 / 组件
|
|
190
|
-
├── src/ # 文档站源码
|
|
191
|
-
│ ├── pages/ # 各组件演示页面
|
|
192
|
-
│ └── components/ # 文档站内部组件
|
|
193
|
-
└── dist/ # 构建产物(发布到 npm)
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
## 技术栈
|
|
197
|
-
|
|
198
|
-
- **框架**: React 19 + TypeScript
|
|
199
|
-
- **构建**: Vite 6(双模式:文档站 / 组件库)
|
|
200
|
-
- **样式**: Less(BEM 命名规范)
|
|
201
|
-
- **文档站**: React Router DOM 6 + Tailwind CSS v4
|
|
202
|
-
|
|
203
|
-
## 许可证
|
|
204
|
-
|
|
205
|
-
MIT
|
|
1
|
+
# bu-max-ui
|
|
2
|
+
|
|
3
|
+
企业级 UI 组件库,支持 Web、移动端、小程序三端,基于 React + TypeScript 构建。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install bu-max-ui
|
|
9
|
+
# 或
|
|
10
|
+
pnpm add bu-max-ui
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## 快速上手
|
|
14
|
+
|
|
15
|
+
引入组件时需同步引入样式文件:
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { SkuInputCard } from 'bu-max-ui';
|
|
19
|
+
import 'bu-max-ui/style';
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Iconfont 图标
|
|
23
|
+
|
|
24
|
+
Web 组件中的图标使用 `BuIcon`(与下方 `Iconfont` 实现等价)。宿主应用或文档站需要先加载项目 iconfont symbol:
|
|
25
|
+
|
|
26
|
+
```html
|
|
27
|
+
<script src="//at.alicdn.com/t/c/font_5123795_8zzfaepwkju.js"></script>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
随后通过 `type` 传入 symbol id(不包含 `#`):
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import { BuIcon } from 'bu-max-ui/web';
|
|
34
|
+
|
|
35
|
+
<BuIcon type="icon-a-dagouxi" style={{ width: 14, height: 14, color: '#333' }} />
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
`BuIcon` 的实现如下:
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
import React from 'react';
|
|
42
|
+
|
|
43
|
+
function Iconfont({ type, style, onClick, className, ...rest }) {
|
|
44
|
+
return (
|
|
45
|
+
<svg
|
|
46
|
+
style={style}
|
|
47
|
+
className={className ? `icon ${className}` : 'icon'}
|
|
48
|
+
aria-hidden="true"
|
|
49
|
+
onClick={onClick}
|
|
50
|
+
{...rest}
|
|
51
|
+
>
|
|
52
|
+
<use xlinkHref={`#${type}`} />
|
|
53
|
+
</svg>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export default Iconfont;
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### 基础用法
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
import { useState } from 'react';
|
|
64
|
+
import { SkuInputCard } from 'bu-max-ui';
|
|
65
|
+
import 'bu-max-ui/style';
|
|
66
|
+
|
|
67
|
+
function App() {
|
|
68
|
+
const [name, setName] = useState('');
|
|
69
|
+
const [lang, setLang] = useState<'zh' | 'en'>('zh');
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<SkuInputCard
|
|
73
|
+
mode="bilingual"
|
|
74
|
+
name={name}
|
|
75
|
+
onNameChange={setName}
|
|
76
|
+
activeLang={lang}
|
|
77
|
+
onLangChange={setLang}
|
|
78
|
+
onDelete={() => setName('')}
|
|
79
|
+
/>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## 按需引入
|
|
85
|
+
|
|
86
|
+
支持按平台路径单独引入,减少构建体积:
|
|
87
|
+
|
|
88
|
+
```tsx
|
|
89
|
+
// Web 组件
|
|
90
|
+
import { SkuInputCard } from 'bu-max-ui/web';
|
|
91
|
+
|
|
92
|
+
// 移动端组件
|
|
93
|
+
import { ... } from 'bu-max-ui/mobile';
|
|
94
|
+
|
|
95
|
+
// 小程序组件
|
|
96
|
+
import { ... } from 'bu-max-ui/miniapp';
|
|
97
|
+
|
|
98
|
+
// 通用组件
|
|
99
|
+
import { ... } from 'bu-max-ui/shared';
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## 组件列表
|
|
103
|
+
|
|
104
|
+
### Web
|
|
105
|
+
|
|
106
|
+
| 组件 | 说明 |
|
|
107
|
+
|------|------|
|
|
108
|
+
| `SkuInputCard` | 商品规格名称输入卡片,支持单语 / 双语模式、拖拽排序、图片上传 |
|
|
109
|
+
| `Button` | 按钮 |
|
|
110
|
+
| `Input` | 输入框 |
|
|
111
|
+
| `Card` | 卡片 |
|
|
112
|
+
| `Select` | 选择器 |
|
|
113
|
+
| `Tooltip` | 气泡提示 |
|
|
114
|
+
|
|
115
|
+
### Mobile
|
|
116
|
+
|
|
117
|
+
| 组件 | 说明 |
|
|
118
|
+
|------|------|
|
|
119
|
+
| `Button` | 移动端按钮 |
|
|
120
|
+
| `Input` | 移动端输入框 |
|
|
121
|
+
| `Card` | 移动端卡片 |
|
|
122
|
+
| `TabBar` | 底部导航栏 |
|
|
123
|
+
| `Navbar` | 顶部导航栏 |
|
|
124
|
+
| `ActionSheet` | 动作面板 |
|
|
125
|
+
| `Toast` | 轻提示 |
|
|
126
|
+
|
|
127
|
+
### 小程序
|
|
128
|
+
|
|
129
|
+
| 组件 | 说明 |
|
|
130
|
+
|------|------|
|
|
131
|
+
| `Button` | 小程序按钮 |
|
|
132
|
+
| `Input` | 小程序输入框 |
|
|
133
|
+
| `Card` | 小程序卡片 |
|
|
134
|
+
| `TabBar` | 底部导航栏 |
|
|
135
|
+
| `Navbar` | 顶部导航栏 |
|
|
136
|
+
| `ActionSheet` | 动作面板 |
|
|
137
|
+
| `Modal` | 弹窗 |
|
|
138
|
+
| `Loading` | 加载态 |
|
|
139
|
+
| `Toast` | 轻提示 |
|
|
140
|
+
| `Cell` | 单元格列表 |
|
|
141
|
+
|
|
142
|
+
## SkuInputCard Props
|
|
143
|
+
|
|
144
|
+
| 参数 | 类型 | 默认值 | 说明 |
|
|
145
|
+
|------|------|--------|------|
|
|
146
|
+
| `name` | `string` | `''` | 产品名称输入值 |
|
|
147
|
+
| `onNameChange` | `(value: string) => void` | — | 名称变更回调 |
|
|
148
|
+
| `mode` | `'single' \| 'bilingual'` | `'single'` | 单语或双语模式 |
|
|
149
|
+
| `activeLang` | `'zh' \| 'en'` | `'zh'` | 双语模式下当前语言 |
|
|
150
|
+
| `onLangChange` | `(lang: 'zh' \| 'en') => void` | — | 语言切换回调 |
|
|
151
|
+
| `showBody` | `boolean` | `true` | 是否显示内容区域 |
|
|
152
|
+
| `error` | `boolean` | `false` | 错误状态 |
|
|
153
|
+
| `onDelete` | `() => void` | — | 点击删除按钮回调 |
|
|
154
|
+
| `onUpload` | `(file: File) => string \| Promise<string>` | — | 自定义上传方法,返回图片 URL |
|
|
155
|
+
| `images` | `string[]` | — | 外部托管的图片列表 |
|
|
156
|
+
| `id` | `string` | — | 拖拽把手 id,供 DnD 库使用 |
|
|
157
|
+
| `className` | `string` | — | 自定义类名 |
|
|
158
|
+
| `style` | `CSSProperties` | — | 自定义样式 |
|
|
159
|
+
|
|
160
|
+
## 本地开发
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
# 克隆仓库
|
|
164
|
+
git clone <repo-url>
|
|
165
|
+
cd bu-max-ui
|
|
166
|
+
|
|
167
|
+
# 安装依赖
|
|
168
|
+
pnpm install
|
|
169
|
+
|
|
170
|
+
# 启动文档站(端口 3000)
|
|
171
|
+
pnpm dev
|
|
172
|
+
|
|
173
|
+
# 构建组件库
|
|
174
|
+
pnpm build:lib
|
|
175
|
+
|
|
176
|
+
# 监听模式(开发库时使用)
|
|
177
|
+
pnpm build:lib:watch
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### 项目结构
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
├── lib/ # 组件库源码(npm 包)
|
|
184
|
+
│ ├── index.ts
|
|
185
|
+
│ ├── web/ # Web 平台组件
|
|
186
|
+
│ ├── mobile/ # 移动端组件
|
|
187
|
+
│ ├── miniapp/ # 小程序组件
|
|
188
|
+
│ ├── react/ # React 通用组件
|
|
189
|
+
│ └── shared/ # 共享工具 / 组件
|
|
190
|
+
├── src/ # 文档站源码
|
|
191
|
+
│ ├── pages/ # 各组件演示页面
|
|
192
|
+
│ └── components/ # 文档站内部组件
|
|
193
|
+
└── dist/ # 构建产物(发布到 npm)
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## 技术栈
|
|
197
|
+
|
|
198
|
+
- **框架**: React 19 + TypeScript
|
|
199
|
+
- **构建**: Vite 6(双模式:文档站 / 组件库)
|
|
200
|
+
- **样式**: Less(BEM 命名规范)
|
|
201
|
+
- **文档站**: React Router DOM 6 + Tailwind CSS v4
|
|
202
|
+
|
|
203
|
+
## 许可证
|
|
204
|
+
|
|
205
|
+
MIT
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
|
-
import { default as default_2 } from 'react';
|
|
3
2
|
import { FocusEvent as FocusEvent_2 } from 'react';
|
|
4
3
|
import { FocusEventHandler } from 'react';
|
|
5
4
|
import { ForwardRefExoticComponent } from 'react';
|
|
6
5
|
import { HTMLAttributes } from 'react';
|
|
7
6
|
import { InputHTMLAttributes } from 'react';
|
|
8
|
-
import { JSX } from 'react';
|
|
7
|
+
import { JSX } from 'react/jsx-runtime';
|
|
9
8
|
import { Key } from 'react';
|
|
10
9
|
import { KeyboardEvent as KeyboardEvent_2 } from 'react';
|
|
11
10
|
import { KeyboardEventHandler } from 'react';
|
|
@@ -868,7 +867,7 @@ export declare interface ProductFieldOption {
|
|
|
868
867
|
searchText?: string;
|
|
869
868
|
}
|
|
870
869
|
|
|
871
|
-
export declare function ProgressTooltip({ placement, title, progress, className, style, }: ProgressTooltipProps):
|
|
870
|
+
export declare function ProgressTooltip({ placement, title, progress, className, style, }: ProgressTooltipProps): JSX.Element;
|
|
872
871
|
|
|
873
872
|
export declare interface ProgressTooltipProps extends BaseTooltipProps {
|
|
874
873
|
title?: string;
|