@geektech/one 0.0.1 → 0.1.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.
- package/README-zh.md +155 -3
- package/README.md +158 -3
- package/dist/alert/OneAlert.d.ts +21 -0
- package/dist/alert/index.d.ts +2 -0
- package/dist/badge/OneBadge.d.ts +18 -0
- package/dist/badge/index.d.ts +2 -0
- package/dist/breadcrumb/OneBreadcrumb.d.ts +38 -0
- package/dist/breadcrumb/index.d.ts +1 -0
- package/dist/categories.d.ts +7 -3
- package/dist/checkbox/OneCheckboxGroup.d.ts +2 -0
- package/dist/data-display/index.d.ts +2 -0
- package/dist/data-display/types.d.ts +2 -0
- package/dist/dialog/DialogOverlay.d.ts +30 -0
- package/dist/dialog/OneDialog.d.ts +20 -0
- package/dist/dialog/focus-manager.d.ts +10 -0
- package/dist/dialog/index.d.ts +7 -0
- package/dist/dialog/scroll-lock.d.ts +2 -0
- package/dist/dialog/service.d.ts +22 -0
- package/dist/dialog/types.d.ts +14 -0
- package/dist/empty/OneEmpty.d.ts +12 -0
- package/dist/empty/index.d.ts +2 -0
- package/dist/form/OneForm.d.ts +1 -1
- package/dist/form/OneFormItem.d.ts +1 -1
- package/dist/index.d.ts +26 -1
- package/dist/index.js +3663 -78
- package/dist/index.js.map +47 -15
- package/dist/message/MessageOverlay.d.ts +25 -0
- package/dist/message/OneMessage.d.ts +19 -0
- package/dist/message/index.d.ts +6 -0
- package/dist/message/normalize.d.ts +8 -0
- package/dist/message/service.d.ts +17 -0
- package/dist/message/timer.d.ts +21 -0
- package/dist/message/types.d.ts +14 -0
- package/dist/navigation/index.d.ts +2 -0
- package/dist/navigation/normalize.d.ts +3 -0
- package/dist/navigation/types.d.ts +4 -0
- package/dist/overlay/container.d.ts +2 -0
- package/dist/overlay/errors.d.ts +9 -0
- package/dist/overlay/host.d.ts +16 -0
- package/dist/overlay/index.d.ts +7 -0
- package/dist/overlay/mount-controller.d.ts +13 -0
- package/dist/overlay/positioner.d.ts +36 -0
- package/dist/overlay/types.d.ts +32 -0
- package/dist/pagination/OnePagination.d.ts +42 -0
- package/dist/pagination/index.d.ts +2 -0
- package/dist/pagination/tokens.d.ts +2 -0
- package/dist/styles/shared.d.ts +13 -0
- package/dist/tabs/OneTabs.d.ts +34 -0
- package/dist/tabs/index.d.ts +2 -0
- package/dist/tag/OneTag.d.ts +21 -0
- package/dist/tag/index.d.ts +2 -0
- package/dist/theme/OneThemeService.d.ts +14 -0
- package/dist/theme/default-theme.d.ts +2 -0
- package/dist/theme/errors.d.ts +9 -0
- package/dist/theme/index.d.ts +4 -0
- package/dist/theme/normalize.d.ts +6 -0
- package/dist/theme/types.d.ts +57 -0
- package/dist/theme/variables.d.ts +6 -0
- package/dist/tooltip/OneTooltip.d.ts +45 -0
- package/dist/tooltip/TooltipBubble.d.ts +29 -0
- package/dist/tooltip/index.d.ts +4 -0
- package/dist/tooltip/types.d.ts +17 -0
- package/package.json +1 -1
package/README-zh.md
CHANGED
|
@@ -48,6 +48,129 @@ class App extends Component {
|
|
|
48
48
|
createApp({ root: App }).mount();
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
+
## 组件分类
|
|
52
|
+
|
|
53
|
+
- 基础:`OneButton`、`OneInput`
|
|
54
|
+
- 表单:`OneForm`、`OneFormItem`、`OneSelect`、`OneCheckbox`、
|
|
55
|
+
`OneCheckboxGroup`、`OneSwitch`
|
|
56
|
+
- 导航:`OneTabs`、`OneBreadcrumb`、`OnePagination`
|
|
57
|
+
- 数据展示:`OneCard`、`OneTag`、`OneBadge`、`OneEmpty`
|
|
58
|
+
- 反馈与浮层:`OneAlert`、`OneMessage`、`OneDialog`、`OneTooltip`
|
|
59
|
+
|
|
60
|
+
## 导航
|
|
61
|
+
|
|
62
|
+
并列内容使用标签页,层级位置使用面包屑,大量同类记录使用分页。三个组件分别
|
|
63
|
+
提供受控状态;涉及原生链接时也可以通过事件决定是否继续导航。
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
import {
|
|
67
|
+
OneBreadcrumb,
|
|
68
|
+
OnePagination,
|
|
69
|
+
OneTabs,
|
|
70
|
+
type OneBreadcrumbClickEvent,
|
|
71
|
+
type OnePaginationChangeEvent,
|
|
72
|
+
type OneTabsChangeEvent,
|
|
73
|
+
} from '@geektech/one';
|
|
74
|
+
|
|
75
|
+
const tabs = new OneTabs({
|
|
76
|
+
value: 'overview',
|
|
77
|
+
items: [
|
|
78
|
+
{ value: 'overview', label: '概览' },
|
|
79
|
+
{ value: 'security', label: '安全' },
|
|
80
|
+
],
|
|
81
|
+
children: [
|
|
82
|
+
{ tag: 'p', slot: 'overview', children: ['概览内容'] },
|
|
83
|
+
{ tag: 'p', slot: 'security', children: ['安全内容'] },
|
|
84
|
+
],
|
|
85
|
+
});
|
|
86
|
+
tabs.on('change', (payload) => {
|
|
87
|
+
const event = payload as OneTabsChangeEvent;
|
|
88
|
+
tabs.setProps({ value: event.value });
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
const breadcrumb = new OneBreadcrumb({
|
|
92
|
+
maxItems: 3,
|
|
93
|
+
separator: '/',
|
|
94
|
+
items: [
|
|
95
|
+
{ label: '首页', href: '/' },
|
|
96
|
+
{ label: '项目', href: '/projects' },
|
|
97
|
+
{ label: '详情', current: true },
|
|
98
|
+
],
|
|
99
|
+
});
|
|
100
|
+
breadcrumb.on('itemClick', (payload) => {
|
|
101
|
+
const event = payload as OneBreadcrumbClickEvent;
|
|
102
|
+
console.log(event.item, event.index);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
const basicPagination = new OnePagination({ total: 95 });
|
|
106
|
+
const pagination = new OnePagination({
|
|
107
|
+
total: 95,
|
|
108
|
+
page: 1,
|
|
109
|
+
pageSize: 10,
|
|
110
|
+
pageSizeOptions: [10, 20, 50],
|
|
111
|
+
showQuickJumper: true,
|
|
112
|
+
});
|
|
113
|
+
pagination.on('change', (payload) => {
|
|
114
|
+
const event = payload as OnePaginationChangeEvent;
|
|
115
|
+
pagination.setProps({ page: event.page, pageSize: event.pageSize });
|
|
116
|
+
});
|
|
117
|
+
void basicPagination;
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## 数据展示
|
|
121
|
+
|
|
122
|
+
标签适合表达紧凑状态,徽标适合展示数量,无数据时使用空状态。`OneEmpty`
|
|
123
|
+
支持通过 `actions` 插槽提供下一步操作。
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
import { OneBadge, OneButton, OneEmpty, OneTag } from '@geektech/one';
|
|
127
|
+
|
|
128
|
+
new OneTag({ variant: 'success', closable: true });
|
|
129
|
+
new OneBadge({ value: 120, max: 99 });
|
|
130
|
+
const actions = [
|
|
131
|
+
{
|
|
132
|
+
component: OneButton,
|
|
133
|
+
slot: 'actions',
|
|
134
|
+
children: ['创建项目'],
|
|
135
|
+
},
|
|
136
|
+
];
|
|
137
|
+
new OneEmpty({ description: '暂无结果', children: actions });
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## 反馈与浮层
|
|
141
|
+
|
|
142
|
+
持续显示的页面内反馈使用 `OneAlert`,附着到单个触发元素的简短说明使用
|
|
143
|
+
`OneTooltip`:
|
|
144
|
+
|
|
145
|
+
```ts
|
|
146
|
+
import { OneAlert, OneButton, OneTooltip } from '@geektech/one';
|
|
147
|
+
|
|
148
|
+
const alert = new OneAlert({
|
|
149
|
+
title: '保存成功',
|
|
150
|
+
variant: 'success',
|
|
151
|
+
closable: true,
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
const tooltip = new OneTooltip({
|
|
155
|
+
content: '复制链接',
|
|
156
|
+
placement: 'bottom-end',
|
|
157
|
+
children: [{ component: OneButton, children: ['复制'] }],
|
|
158
|
+
});
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
临时消息和确认流程可以使用命令式服务:
|
|
162
|
+
|
|
163
|
+
```ts
|
|
164
|
+
import { oneDialog, oneMessage } from '@geektech/one';
|
|
165
|
+
|
|
166
|
+
oneMessage.success('Saved');
|
|
167
|
+
|
|
168
|
+
const confirmed = await oneDialog.confirm({
|
|
169
|
+
title: 'Delete item?',
|
|
170
|
+
description: 'This action cannot be undone.',
|
|
171
|
+
});
|
|
172
|
+
```
|
|
173
|
+
|
|
51
174
|
## 按钮变体、尺寸、加载状态和事件
|
|
52
175
|
|
|
53
176
|
`OneButton` 提供 `primary`、`secondary`、`danger` 三种变体,以及 `sm`、
|
|
@@ -104,16 +227,45 @@ slot 的子节点进入默认内容区。
|
|
|
104
227
|
|
|
105
228
|
```ts
|
|
106
229
|
import { createComponent } from '@geektech/tsone';
|
|
107
|
-
import { OneCard } from '@geektech/one';
|
|
230
|
+
import { OneButton, OneCard } from '@geektech/one';
|
|
108
231
|
|
|
109
232
|
const card = createComponent(OneCard, {}, [
|
|
110
233
|
{ tag: 'h2', slot: 'header', children: ['账户'] },
|
|
111
234
|
{ tag: 'p', children: ['默认插槽内容'] },
|
|
112
|
-
{
|
|
235
|
+
{ component: OneButton, slot: 'footer', children: ['继续'] },
|
|
113
236
|
]);
|
|
114
237
|
```
|
|
115
238
|
|
|
116
|
-
##
|
|
239
|
+
## 全局主题
|
|
240
|
+
|
|
241
|
+
不可变的内置 `default` 主题始终可用。可以注册任意多套局部配置;未填写的颜色、
|
|
242
|
+
字体、行高、边框和圆角字段都会从 `ONE_DEFAULT_THEME` 继承。
|
|
243
|
+
|
|
244
|
+
```ts
|
|
245
|
+
import { ONE_DEFAULT_THEME, oneTheme } from '@geektech/one';
|
|
246
|
+
|
|
247
|
+
oneTheme.init({
|
|
248
|
+
defaultTheme: 'brand',
|
|
249
|
+
themes: {
|
|
250
|
+
brand: {
|
|
251
|
+
colors: { primary: '#326bff' },
|
|
252
|
+
typography: { fontFamily: 'Inter, sans-serif', lineHeight: '1.6' },
|
|
253
|
+
border: { color: '#cbd5e1', width: '1px', style: 'solid' },
|
|
254
|
+
radius: { sm: '4px', md: '8px', lg: '12px' },
|
|
255
|
+
},
|
|
256
|
+
night: { colors: { surface: '#101510', text: '#f4f8f4' } },
|
|
257
|
+
},
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
oneTheme.switch('default');
|
|
261
|
+
console.log(oneTheme.currentTheme, ONE_DEFAULT_THEME.colors.primary);
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
主题服务只写入 `document.documentElement`,不创建局部主题,也不会自动持久化选中
|
|
265
|
+
名称或跟随系统配色。无效配置会抛出 `OneThemeConfigError`,未知主题名称会抛出
|
|
266
|
+
`OneThemeNotFoundError`。
|
|
267
|
+
|
|
268
|
+
## CSS 变量覆盖
|
|
117
269
|
|
|
118
270
|
One UI 样式限定在 `.one-*` 选择器中。可以在应用容器或 `:root` 上覆盖公开
|
|
119
271
|
CSS 变量:
|
package/README.md
CHANGED
|
@@ -48,6 +48,130 @@ class App extends Component {
|
|
|
48
48
|
createApp({ root: App }).mount();
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
+
## Component categories
|
|
52
|
+
|
|
53
|
+
- Basic: `OneButton`, `OneInput`
|
|
54
|
+
- Form: `OneForm`, `OneFormItem`, `OneSelect`, `OneCheckbox`,
|
|
55
|
+
`OneCheckboxGroup`, `OneSwitch`
|
|
56
|
+
- Navigation: `OneTabs`, `OneBreadcrumb`, `OnePagination`
|
|
57
|
+
- Data display: `OneCard`, `OneTag`, `OneBadge`, `OneEmpty`
|
|
58
|
+
- Feedback and overlays: `OneAlert`, `OneMessage`, `OneDialog`, `OneTooltip`
|
|
59
|
+
|
|
60
|
+
## Navigation
|
|
61
|
+
|
|
62
|
+
Use tabs for parallel views, breadcrumbs for a hierarchy, and pagination for a
|
|
63
|
+
long collection. All three components support controlled state or cancellable
|
|
64
|
+
events where native navigation is involved.
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
import {
|
|
68
|
+
OneBreadcrumb,
|
|
69
|
+
OnePagination,
|
|
70
|
+
OneTabs,
|
|
71
|
+
type OneBreadcrumbClickEvent,
|
|
72
|
+
type OnePaginationChangeEvent,
|
|
73
|
+
type OneTabsChangeEvent,
|
|
74
|
+
} from '@geektech/one';
|
|
75
|
+
|
|
76
|
+
const tabs = new OneTabs({
|
|
77
|
+
value: 'overview',
|
|
78
|
+
items: [
|
|
79
|
+
{ value: 'overview', label: 'Overview' },
|
|
80
|
+
{ value: 'security', label: 'Security' },
|
|
81
|
+
],
|
|
82
|
+
children: [
|
|
83
|
+
{ tag: 'p', slot: 'overview', children: ['Overview content'] },
|
|
84
|
+
{ tag: 'p', slot: 'security', children: ['Security content'] },
|
|
85
|
+
],
|
|
86
|
+
});
|
|
87
|
+
tabs.on('change', (payload) => {
|
|
88
|
+
const event = payload as OneTabsChangeEvent;
|
|
89
|
+
tabs.setProps({ value: event.value });
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
const breadcrumb = new OneBreadcrumb({
|
|
93
|
+
maxItems: 3,
|
|
94
|
+
separator: '/',
|
|
95
|
+
items: [
|
|
96
|
+
{ label: 'Home', href: '/' },
|
|
97
|
+
{ label: 'Projects', href: '/projects' },
|
|
98
|
+
{ label: 'Details', current: true },
|
|
99
|
+
],
|
|
100
|
+
});
|
|
101
|
+
breadcrumb.on('itemClick', (payload) => {
|
|
102
|
+
const event = payload as OneBreadcrumbClickEvent;
|
|
103
|
+
console.log(event.item, event.index);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
const basicPagination = new OnePagination({ total: 95 });
|
|
107
|
+
const pagination = new OnePagination({
|
|
108
|
+
total: 95,
|
|
109
|
+
page: 1,
|
|
110
|
+
pageSize: 10,
|
|
111
|
+
pageSizeOptions: [10, 20, 50],
|
|
112
|
+
showQuickJumper: true,
|
|
113
|
+
});
|
|
114
|
+
pagination.on('change', (payload) => {
|
|
115
|
+
const event = payload as OnePaginationChangeEvent;
|
|
116
|
+
pagination.setProps({ page: event.page, pageSize: event.pageSize });
|
|
117
|
+
});
|
|
118
|
+
void basicPagination;
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Data display
|
|
122
|
+
|
|
123
|
+
Use tags for compact status, badges for counts, and empty states when a view has
|
|
124
|
+
no content. `OneEmpty` accepts an `actions` slot for the next useful action.
|
|
125
|
+
|
|
126
|
+
```ts
|
|
127
|
+
import { OneBadge, OneButton, OneEmpty, OneTag } from '@geektech/one';
|
|
128
|
+
|
|
129
|
+
new OneTag({ variant: 'success', closable: true });
|
|
130
|
+
new OneBadge({ value: 120, max: 99 });
|
|
131
|
+
const actions = [
|
|
132
|
+
{
|
|
133
|
+
component: OneButton,
|
|
134
|
+
slot: 'actions',
|
|
135
|
+
children: ['Create project'],
|
|
136
|
+
},
|
|
137
|
+
];
|
|
138
|
+
new OneEmpty({ description: 'No results', children: actions });
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Feedback and overlays
|
|
142
|
+
|
|
143
|
+
Use `OneAlert` for persistent inline feedback and `OneTooltip` for a short
|
|
144
|
+
description attached to one trigger element:
|
|
145
|
+
|
|
146
|
+
```ts
|
|
147
|
+
import { OneAlert, OneButton, OneTooltip } from '@geektech/one';
|
|
148
|
+
|
|
149
|
+
const alert = new OneAlert({
|
|
150
|
+
title: 'Saved',
|
|
151
|
+
variant: 'success',
|
|
152
|
+
closable: true,
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
const tooltip = new OneTooltip({
|
|
156
|
+
content: 'Copy link',
|
|
157
|
+
placement: 'bottom-end',
|
|
158
|
+
children: [{ component: OneButton, children: ['Copy'] }],
|
|
159
|
+
});
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Use the imperative services for transient messages and confirmation flows:
|
|
163
|
+
|
|
164
|
+
```ts
|
|
165
|
+
import { oneDialog, oneMessage } from '@geektech/one';
|
|
166
|
+
|
|
167
|
+
oneMessage.success('Saved');
|
|
168
|
+
|
|
169
|
+
const confirmed = await oneDialog.confirm({
|
|
170
|
+
title: 'Delete item?',
|
|
171
|
+
description: 'This action cannot be undone.',
|
|
172
|
+
});
|
|
173
|
+
```
|
|
174
|
+
|
|
51
175
|
## Button variants, sizes, loading and events
|
|
52
176
|
|
|
53
177
|
`OneButton` supports `primary`, `secondary`, and `danger` variants and `sm`,
|
|
@@ -104,16 +228,47 @@ children without a slot fill the default body.
|
|
|
104
228
|
|
|
105
229
|
```ts
|
|
106
230
|
import { createComponent } from '@geektech/tsone';
|
|
107
|
-
import { OneCard } from '@geektech/one';
|
|
231
|
+
import { OneButton, OneCard } from '@geektech/one';
|
|
108
232
|
|
|
109
233
|
const card = createComponent(OneCard, {}, [
|
|
110
234
|
{ tag: 'h2', slot: 'header', children: ['Account'] },
|
|
111
235
|
{ tag: 'p', children: ['Default slot content'] },
|
|
112
|
-
{
|
|
236
|
+
{ component: OneButton, slot: 'footer', children: ['Continue'] },
|
|
113
237
|
]);
|
|
114
238
|
```
|
|
115
239
|
|
|
116
|
-
##
|
|
240
|
+
## Global themes
|
|
241
|
+
|
|
242
|
+
The immutable `default` theme is always available. Register any number of
|
|
243
|
+
partial themes; omitted colors, typography, border, and radius values inherit
|
|
244
|
+
from `ONE_DEFAULT_THEME`.
|
|
245
|
+
|
|
246
|
+
```ts
|
|
247
|
+
import { ONE_DEFAULT_THEME, oneTheme } from '@geektech/one';
|
|
248
|
+
|
|
249
|
+
oneTheme.init({
|
|
250
|
+
defaultTheme: 'brand',
|
|
251
|
+
themes: {
|
|
252
|
+
brand: {
|
|
253
|
+
colors: { primary: '#326bff' },
|
|
254
|
+
typography: { fontFamily: 'Inter, sans-serif', lineHeight: '1.6' },
|
|
255
|
+
border: { color: '#cbd5e1', width: '1px', style: 'solid' },
|
|
256
|
+
radius: { sm: '4px', md: '8px', lg: '12px' },
|
|
257
|
+
},
|
|
258
|
+
night: { colors: { surface: '#101510', text: '#f4f8f4' } },
|
|
259
|
+
},
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
oneTheme.switch('default');
|
|
263
|
+
console.log(oneTheme.currentTheme, ONE_DEFAULT_THEME.colors.primary);
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
The service writes to `document.documentElement` only. It does not create local
|
|
267
|
+
themes, persist the selected name, or follow the operating-system scheme.
|
|
268
|
+
Invalid configuration throws `OneThemeConfigError`; unknown theme names throw
|
|
269
|
+
`OneThemeNotFoundError`.
|
|
270
|
+
|
|
271
|
+
## CSS variable overrides
|
|
117
272
|
|
|
118
273
|
One UI styles are scoped to `.one-*` selectors. Override public CSS variables
|
|
119
274
|
on an application container or `:root`:
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Component, type VNode } from '@geektech/tsone';
|
|
2
|
+
import type { OneFeedbackVariant } from '../overlay';
|
|
3
|
+
import { type OneNamedStyle } from '../styles/shared';
|
|
4
|
+
export interface OneAlertProps {
|
|
5
|
+
title?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
variant?: OneFeedbackVariant;
|
|
8
|
+
closable?: boolean;
|
|
9
|
+
children?: Array<VNode | string>;
|
|
10
|
+
}
|
|
11
|
+
interface OneAlertState {
|
|
12
|
+
visible: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare const ONE_ALERT_STYLES: OneNamedStyle[];
|
|
15
|
+
export declare class OneAlert extends Component<OneAlertProps, OneAlertState> {
|
|
16
|
+
protected initState(): OneAlertState;
|
|
17
|
+
protected initStyles(): void;
|
|
18
|
+
protected render(): VNode;
|
|
19
|
+
private close;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Component, type VNode } from '@geektech/tsone';
|
|
2
|
+
import { type OneDataDisplayVariant } from '../data-display';
|
|
3
|
+
import { type OneNamedStyle } from '../styles/shared';
|
|
4
|
+
export interface OneBadgeProps {
|
|
5
|
+
value?: number | string;
|
|
6
|
+
max?: number;
|
|
7
|
+
dot?: boolean;
|
|
8
|
+
showZero?: boolean;
|
|
9
|
+
variant?: OneDataDisplayVariant;
|
|
10
|
+
ariaLabel?: string;
|
|
11
|
+
children?: Array<VNode | string>;
|
|
12
|
+
}
|
|
13
|
+
export declare const ONE_BADGE_STYLES: OneNamedStyle[];
|
|
14
|
+
export declare class OneBadge extends Component<OneBadgeProps> {
|
|
15
|
+
protected initState(): object;
|
|
16
|
+
protected initStyles(): void;
|
|
17
|
+
protected render(): VNode;
|
|
18
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Component, type VNode } from '@geektech/tsone';
|
|
2
|
+
import { type OneNamedStyle } from '../styles/shared';
|
|
3
|
+
export interface OneBreadcrumbItem {
|
|
4
|
+
label: string;
|
|
5
|
+
href?: string;
|
|
6
|
+
current?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface OneBreadcrumbClickEvent {
|
|
9
|
+
item: OneBreadcrumbItem;
|
|
10
|
+
index: number;
|
|
11
|
+
originalEvent: MouseEvent;
|
|
12
|
+
}
|
|
13
|
+
export interface OneBreadcrumbProps {
|
|
14
|
+
items: readonly OneBreadcrumbItem[];
|
|
15
|
+
separator?: string;
|
|
16
|
+
maxItems?: number;
|
|
17
|
+
ariaLabel?: string;
|
|
18
|
+
children?: Array<VNode | string>;
|
|
19
|
+
}
|
|
20
|
+
interface OneBreadcrumbState {
|
|
21
|
+
expanded: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare const ONE_BREADCRUMB_STYLES: OneNamedStyle[];
|
|
24
|
+
export declare class OneBreadcrumb extends Component<OneBreadcrumbProps, OneBreadcrumbState> {
|
|
25
|
+
protected initState(): OneBreadcrumbState;
|
|
26
|
+
protected initStyles(): void;
|
|
27
|
+
protected render(): VNode;
|
|
28
|
+
private normalizedItems;
|
|
29
|
+
private currentIndex;
|
|
30
|
+
private tokens;
|
|
31
|
+
private renderToken;
|
|
32
|
+
private renderItem;
|
|
33
|
+
private renderCollapse;
|
|
34
|
+
private renderSeparator;
|
|
35
|
+
private handleItemClick;
|
|
36
|
+
private hasSlot;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ONE_BREADCRUMB_STYLES, OneBreadcrumb, type OneBreadcrumbClickEvent, type OneBreadcrumbItem, type OneBreadcrumbProps, } from './OneBreadcrumb';
|
package/dist/categories.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type OneComponentCategory = 'basic' | 'form' | 'data-display' | 'feedback';
|
|
1
|
+
export type OneComponentCategory = 'basic' | 'form' | 'navigation' | 'data-display' | 'feedback';
|
|
2
2
|
export declare const ONE_COMPONENT_CATEGORIES: readonly [{
|
|
3
3
|
readonly id: "basic";
|
|
4
4
|
readonly label: "基础";
|
|
@@ -7,12 +7,16 @@ export declare const ONE_COMPONENT_CATEGORIES: readonly [{
|
|
|
7
7
|
readonly id: "form";
|
|
8
8
|
readonly label: "表单";
|
|
9
9
|
readonly components: readonly ["OneForm", "OneFormItem", "OneSelect", "OneCheckbox", "OneCheckboxGroup", "OneSwitch"];
|
|
10
|
+
}, {
|
|
11
|
+
readonly id: "navigation";
|
|
12
|
+
readonly label: "导航";
|
|
13
|
+
readonly components: readonly ["OneTabs", "OneBreadcrumb", "OnePagination"];
|
|
10
14
|
}, {
|
|
11
15
|
readonly id: "data-display";
|
|
12
16
|
readonly label: "数据展示";
|
|
13
|
-
readonly components: readonly ["OneCard"];
|
|
17
|
+
readonly components: readonly ["OneCard", "OneTag", "OneBadge", "OneEmpty"];
|
|
14
18
|
}, {
|
|
15
19
|
readonly id: "feedback";
|
|
16
20
|
readonly label: "反馈与浮层";
|
|
17
|
-
readonly components: readonly [];
|
|
21
|
+
readonly components: readonly ["OneAlert", "OneMessage", "OneDialog", "OneTooltip"];
|
|
18
22
|
}];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Component, type VNode } from '@geektech/tsone';
|
|
2
2
|
import type { OneSelectOption } from '../select';
|
|
3
|
+
import { type OneNamedStyle } from '../styles/shared';
|
|
3
4
|
export interface OneCheckboxGroupProps {
|
|
4
5
|
options: readonly OneSelectOption[];
|
|
5
6
|
value?: string[];
|
|
@@ -13,6 +14,7 @@ interface OneCheckboxGroupState {
|
|
|
13
14
|
internalValue: string[];
|
|
14
15
|
revision: number;
|
|
15
16
|
}
|
|
17
|
+
export declare const ONE_CHECKBOX_GROUP_STYLES: OneNamedStyle[];
|
|
16
18
|
export declare class OneCheckboxGroup extends Component<OneCheckboxGroupProps, OneCheckboxGroupState> {
|
|
17
19
|
private fieldContext;
|
|
18
20
|
private unsubscribe;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Component, type VNode } from '@geektech/tsone';
|
|
2
|
+
import { type OneNamedStyle } from '../styles/shared';
|
|
3
|
+
import type { OneDialogCloseReason, OneDialogProps } from './types';
|
|
4
|
+
export interface DialogOverlayProps extends OneDialogProps {
|
|
5
|
+
id: string;
|
|
6
|
+
lockBody: boolean;
|
|
7
|
+
confirmText?: string;
|
|
8
|
+
cancelText?: string;
|
|
9
|
+
content?: VNode | string;
|
|
10
|
+
isTop(): boolean;
|
|
11
|
+
requestClose(reason: OneDialogCloseReason): void;
|
|
12
|
+
}
|
|
13
|
+
export declare const ONE_DIALOG_STYLES: OneNamedStyle[];
|
|
14
|
+
interface DialogOverlayState {
|
|
15
|
+
}
|
|
16
|
+
export declare class DialogOverlay extends Component<DialogOverlayProps, DialogOverlayState> {
|
|
17
|
+
private readonly focusManager;
|
|
18
|
+
private releaseScrollLock;
|
|
19
|
+
private targetDocument;
|
|
20
|
+
mount(container: HTMLElement): void;
|
|
21
|
+
protected initState(): DialogOverlayState;
|
|
22
|
+
protected initStyles(): void;
|
|
23
|
+
protected onMounted(): void;
|
|
24
|
+
protected onUnmounted(): void;
|
|
25
|
+
protected render(): VNode;
|
|
26
|
+
private readonly handleEscape;
|
|
27
|
+
private requestClose;
|
|
28
|
+
private getPanel;
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Component, type VNode } from '@geektech/tsone';
|
|
2
|
+
import type { OneDialogProps } from './types';
|
|
3
|
+
interface OneDialogState {
|
|
4
|
+
internalOpen: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare class OneDialog extends Component<OneDialogProps, OneDialogState> {
|
|
7
|
+
private controller;
|
|
8
|
+
private lockBody;
|
|
9
|
+
private viewMounted;
|
|
10
|
+
protected initState(): OneDialogState;
|
|
11
|
+
protected initStyles(): void;
|
|
12
|
+
protected onMounted(): void;
|
|
13
|
+
protected beforeUpdate(): void;
|
|
14
|
+
protected beforeUnmount(): void;
|
|
15
|
+
protected render(): VNode;
|
|
16
|
+
private createOverlay;
|
|
17
|
+
private synchronizeOverlay;
|
|
18
|
+
private requestClose;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class OneDialogFocusManager {
|
|
2
|
+
private dialog;
|
|
3
|
+
private previousFocus;
|
|
4
|
+
private isTop;
|
|
5
|
+
private targetDocument;
|
|
6
|
+
activate(dialog: HTMLElement, isTop?: () => boolean): void;
|
|
7
|
+
deactivate(restoreFocus?: boolean): void;
|
|
8
|
+
private readonly handleKeydown;
|
|
9
|
+
private focusableElements;
|
|
10
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { DialogOverlay, ONE_DIALOG_STYLES } from './DialogOverlay';
|
|
2
|
+
export { OneDialog } from './OneDialog';
|
|
3
|
+
export { OneDialogService, createOneDialogService, oneDialog } from './service';
|
|
4
|
+
export { OneDialogFocusManager } from './focus-manager';
|
|
5
|
+
export { lockOneDialogBody, unlockOneDialogBody } from './scroll-lock';
|
|
6
|
+
export type { OneDialogServiceOptions } from './service';
|
|
7
|
+
export type { OneDialogCloseReason, OneDialogProps } from './types';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { VNode } from '@geektech/tsone';
|
|
2
|
+
import { type OneOverlayHandle, type OneOverlayHost } from '../overlay';
|
|
3
|
+
import type { OneDialogProps } from './types';
|
|
4
|
+
export interface OneDialogServiceOptions extends Omit<OneDialogProps, 'open' | 'defaultOpen'> {
|
|
5
|
+
content?: VNode | string;
|
|
6
|
+
confirmText?: string;
|
|
7
|
+
cancelText?: string;
|
|
8
|
+
onConfirm?: () => boolean | void | Promise<boolean | void>;
|
|
9
|
+
onCancel?: () => void;
|
|
10
|
+
onError?: (error: unknown) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare class OneDialogService {
|
|
13
|
+
private readonly suppliedHost?;
|
|
14
|
+
constructor(suppliedHost?: OneOverlayHost | undefined);
|
|
15
|
+
open(options: OneDialogServiceOptions): OneOverlayHandle<OneDialogServiceOptions>;
|
|
16
|
+
confirm(options: OneDialogServiceOptions): Promise<boolean>;
|
|
17
|
+
close(id: string): void;
|
|
18
|
+
closeAll(): void;
|
|
19
|
+
private openInternal;
|
|
20
|
+
}
|
|
21
|
+
export declare function createOneDialogService(host?: OneOverlayHost): OneDialogService;
|
|
22
|
+
export declare const oneDialog: OneDialogService;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { VNode } from '@geektech/tsone';
|
|
2
|
+
import type { OneOverlayContainer } from '../overlay';
|
|
3
|
+
export interface OneDialogProps {
|
|
4
|
+
open?: boolean;
|
|
5
|
+
defaultOpen?: boolean;
|
|
6
|
+
title?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
closeOnOverlay?: boolean;
|
|
9
|
+
closeOnEscape?: boolean;
|
|
10
|
+
confirmLoading?: boolean;
|
|
11
|
+
container?: OneOverlayContainer;
|
|
12
|
+
children?: Array<VNode | string>;
|
|
13
|
+
}
|
|
14
|
+
export type OneDialogCloseReason = 'confirm' | 'cancel' | 'overlay' | 'escape';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Component, type VNode } from '@geektech/tsone';
|
|
2
|
+
import { type OneNamedStyle } from '../styles/shared';
|
|
3
|
+
export interface OneEmptyProps {
|
|
4
|
+
description?: string;
|
|
5
|
+
children?: Array<VNode | string>;
|
|
6
|
+
}
|
|
7
|
+
export declare const ONE_EMPTY_STYLES: OneNamedStyle[];
|
|
8
|
+
export declare class OneEmpty extends Component<OneEmptyProps> {
|
|
9
|
+
protected initState(): object;
|
|
10
|
+
protected initStyles(): void;
|
|
11
|
+
protected render(): VNode;
|
|
12
|
+
}
|
package/dist/form/OneForm.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Component, type VNode } from '@geektech/tsone';
|
|
2
|
-
import type
|
|
2
|
+
import { type OneNamedStyle } from '../styles/shared';
|
|
3
3
|
import type { OneFormInitialValues, OneFormRules, OneFormValidationResult, OneFormValues } from './context';
|
|
4
4
|
import { OneFormModel } from './model';
|
|
5
5
|
export interface OneFormProps {
|