wok-ui-ext 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/LICENSE +21 -0
- package/README.en.md +75 -0
- package/README.md +75 -0
- package/dist/alert/index.d.ts +10 -0
- package/dist/alert/index.js +48 -0
- package/dist/alert/style.css +116 -0
- package/dist/avatar/index.d.ts +9 -0
- package/dist/avatar/index.js +30 -0
- package/dist/avatar/style.css +32 -0
- package/dist/badge/index.d.ts +32 -0
- package/dist/badge/index.js +61 -0
- package/dist/badge/style.css +68 -0
- package/dist/breadcrumb/index.d.ts +25 -0
- package/dist/breadcrumb/index.js +47 -0
- package/dist/breadcrumb/style.css +35 -0
- package/dist/button/index.d.ts +34 -0
- package/dist/button/index.js +57 -0
- package/dist/button/style.css +133 -0
- package/dist/card/index.d.ts +25 -0
- package/dist/card/index.js +29 -0
- package/dist/card/style.css +23 -0
- package/dist/collapse/index.d.ts +89 -0
- package/dist/collapse/index.js +213 -0
- package/dist/collapse/style.css +76 -0
- package/dist/context-menu/context-menu.d.ts +113 -0
- package/dist/context-menu/context-menu.js +150 -0
- package/dist/context-menu/index.d.ts +30 -0
- package/dist/context-menu/index.js +42 -0
- package/dist/context-menu/style.css +46 -0
- package/dist/date-picker/calendar-panel.d.ts +44 -0
- package/dist/date-picker/calendar-panel.js +180 -0
- package/dist/date-picker/date-picker.d.ts +29 -0
- package/dist/date-picker/date-picker.js +81 -0
- package/dist/date-picker/date-utils.d.ts +63 -0
- package/dist/date-picker/date-utils.js +130 -0
- package/dist/date-picker/index.d.ts +7 -0
- package/dist/date-picker/index.js +5 -0
- package/dist/date-picker/layer.d.ts +19 -0
- package/dist/date-picker/layer.js +36 -0
- package/dist/date-picker/range-picker.d.ts +30 -0
- package/dist/date-picker/range-picker.js +117 -0
- package/dist/date-picker/style.css +161 -0
- package/dist/description-list/index.d.ts +37 -0
- package/dist/description-list/index.js +145 -0
- package/dist/description-list/style.css +63 -0
- package/dist/divider/index.d.ts +29 -0
- package/dist/divider/index.js +29 -0
- package/dist/divider/style.css +50 -0
- package/dist/drawer/index.d.ts +51 -0
- package/dist/drawer/index.js +183 -0
- package/dist/drawer/style.css +100 -0
- package/dist/dropdown/index.d.ts +38 -0
- package/dist/dropdown/index.js +97 -0
- package/dist/dropdown/style.css +39 -0
- package/dist/empty/index.d.ts +11 -0
- package/dist/empty/index.js +20 -0
- package/dist/empty/style.css +19 -0
- package/dist/floating-layer/index.d.ts +109 -0
- package/dist/floating-layer/index.js +337 -0
- package/dist/floating-layer/style.css +5 -0
- package/dist/form/form-item/index.d.ts +26 -0
- package/dist/form/form-item/index.js +21 -0
- package/dist/form/form-item/style.css +33 -0
- package/dist/form/form-modal/index.d.ts +18 -0
- package/dist/form/form-modal/index.js +38 -0
- package/dist/form/form.d.ts +21 -0
- package/dist/form/form.js +28 -0
- package/dist/form/index.d.ts +4 -0
- package/dist/form/index.js +4 -0
- package/dist/form/select/index.d.ts +48 -0
- package/dist/form/select/index.js +94 -0
- package/dist/form/select/style.css +29 -0
- package/dist/global.css +71 -0
- package/dist/i18n/de-DE.d.ts +2 -0
- package/dist/i18n/de-DE.js +36 -0
- package/dist/i18n/en-US.d.ts +2 -0
- package/dist/i18n/en-US.js +36 -0
- package/dist/i18n/es-ES.d.ts +2 -0
- package/dist/i18n/es-ES.js +36 -0
- package/dist/i18n/fr-FR.d.ts +2 -0
- package/dist/i18n/fr-FR.js +36 -0
- package/dist/i18n/index.d.ts +12 -0
- package/dist/i18n/index.js +39 -0
- package/dist/i18n/ja-JP.d.ts +2 -0
- package/dist/i18n/ja-JP.js +36 -0
- package/dist/i18n/ko-KR.d.ts +2 -0
- package/dist/i18n/ko-KR.js +36 -0
- package/dist/i18n/messages.d.ts +40 -0
- package/dist/i18n/messages.js +1 -0
- package/dist/i18n/wok-ui/de-DE.d.ts +2 -0
- package/dist/i18n/wok-ui/de-DE.js +20 -0
- package/dist/i18n/wok-ui/es-ES.d.ts +2 -0
- package/dist/i18n/wok-ui/es-ES.js +20 -0
- package/dist/i18n/wok-ui/fr-FR.d.ts +2 -0
- package/dist/i18n/wok-ui/fr-FR.js +20 -0
- package/dist/i18n/wok-ui/ja-JP.d.ts +2 -0
- package/dist/i18n/wok-ui/ja-JP.js +20 -0
- package/dist/i18n/wok-ui/ko-KR.d.ts +2 -0
- package/dist/i18n/wok-ui/ko-KR.js +20 -0
- package/dist/i18n/wok-ui/zh-TW.d.ts +2 -0
- package/dist/i18n/wok-ui/zh-TW.js +20 -0
- package/dist/i18n/zh-CN.d.ts +2 -0
- package/dist/i18n/zh-CN.js +36 -0
- package/dist/i18n/zh-TW.d.ts +2 -0
- package/dist/i18n/zh-TW.js +36 -0
- package/dist/icons.d.ts +88 -0
- package/dist/icons.js +176 -0
- package/dist/image/index.d.ts +38 -0
- package/dist/image/index.js +97 -0
- package/dist/image/style.css +72 -0
- package/dist/image-preview/index.d.ts +26 -0
- package/dist/image-preview/index.js +134 -0
- package/dist/image-preview/style.css +96 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.js +45 -0
- package/dist/list/index.d.ts +32 -0
- package/dist/list/index.js +42 -0
- package/dist/list/list-item.d.ts +27 -0
- package/dist/list/list-item.js +51 -0
- package/dist/list/style.css +20 -0
- package/dist/loading/index.d.ts +10 -0
- package/dist/loading/index.js +46 -0
- package/dist/loading/style.css +48 -0
- package/dist/menu/index.d.ts +38 -0
- package/dist/menu/index.js +62 -0
- package/dist/menu/leaf-item.d.ts +12 -0
- package/dist/menu/leaf-item.js +41 -0
- package/dist/menu/style.css +117 -0
- package/dist/menu/sub-menu.d.ts +21 -0
- package/dist/menu/sub-menu.js +85 -0
- package/dist/menu/types.d.ts +36 -0
- package/dist/menu/types.js +1 -0
- package/dist/menu/utils.d.ts +11 -0
- package/dist/menu/utils.js +24 -0
- package/dist/modal/index.d.ts +23 -0
- package/dist/modal/index.js +79 -0
- package/dist/modal/modal.d.ts +76 -0
- package/dist/modal/modal.js +188 -0
- package/dist/modal/style.css +90 -0
- package/dist/pagination/index.d.ts +31 -0
- package/dist/pagination/index.js +215 -0
- package/dist/pagination/style.css +50 -0
- package/dist/popconfirm/api.d.ts +43 -0
- package/dist/popconfirm/api.js +77 -0
- package/dist/popconfirm/component.d.ts +47 -0
- package/dist/popconfirm/component.js +48 -0
- package/dist/popconfirm/index.d.ts +3 -0
- package/dist/popconfirm/index.js +3 -0
- package/dist/popconfirm/style.css +22 -0
- package/dist/popover/api.d.ts +36 -0
- package/dist/popover/api.js +61 -0
- package/dist/popover/component.d.ts +38 -0
- package/dist/popover/component.js +51 -0
- package/dist/popover/index.d.ts +3 -0
- package/dist/popover/index.js +3 -0
- package/dist/popover/style.css +102 -0
- package/dist/progress/index.d.ts +34 -0
- package/dist/progress/index.js +70 -0
- package/dist/progress/style.css +37 -0
- package/dist/quick-input/index.d.ts +2 -0
- package/dist/quick-input/index.js +2 -0
- package/dist/quick-input/number.d.ts +35 -0
- package/dist/quick-input/number.js +68 -0
- package/dist/quick-input/text.d.ts +20 -0
- package/dist/quick-input/text.js +61 -0
- package/dist/result/index.d.ts +39 -0
- package/dist/result/index.js +71 -0
- package/dist/result/style.css +41 -0
- package/dist/search-box/index.d.ts +26 -0
- package/dist/search-box/index.js +60 -0
- package/dist/search-box/style.css +22 -0
- package/dist/segmented/index.d.ts +42 -0
- package/dist/segmented/index.js +61 -0
- package/dist/segmented/style.css +28 -0
- package/dist/skeleton/index.d.ts +22 -0
- package/dist/skeleton/index.js +68 -0
- package/dist/skeleton/style.css +31 -0
- package/dist/steps/index.d.ts +46 -0
- package/dist/steps/index.js +95 -0
- package/dist/steps/style.css +181 -0
- package/dist/switch/index.d.ts +32 -0
- package/dist/switch/index.js +74 -0
- package/dist/switch/style.css +52 -0
- package/dist/table/body.d.ts +21 -0
- package/dist/table/body.js +35 -0
- package/dist/table/column.d.ts +78 -0
- package/dist/table/column.js +113 -0
- package/dist/table/header.d.ts +13 -0
- package/dist/table/header.js +15 -0
- package/dist/table/index.d.ts +41 -0
- package/dist/table/index.js +84 -0
- package/dist/table/row.d.ts +25 -0
- package/dist/table/row.js +74 -0
- package/dist/table/style.css +98 -0
- package/dist/tabs/index.d.ts +49 -0
- package/dist/tabs/index.js +76 -0
- package/dist/tabs/style.css +41 -0
- package/dist/tag/index.d.ts +53 -0
- package/dist/tag/index.js +100 -0
- package/dist/tag/style.css +134 -0
- package/dist/text/index.d.ts +104 -0
- package/dist/text/index.js +143 -0
- package/dist/text/style.css +113 -0
- package/dist/theme/index.d.ts +14 -0
- package/dist/theme/index.js +94 -0
- package/dist/theme/themes.d.ts +3 -0
- package/dist/theme/themes.js +323 -0
- package/dist/theme/types.d.ts +58 -0
- package/dist/theme/types.js +1 -0
- package/dist/timeline/index.d.ts +28 -0
- package/dist/timeline/index.js +35 -0
- package/dist/timeline/style.css +53 -0
- package/dist/toast/index.d.ts +53 -0
- package/dist/toast/index.js +131 -0
- package/dist/toast/style.css +76 -0
- package/dist/tooltip/api.d.ts +44 -0
- package/dist/tooltip/api.js +103 -0
- package/dist/tooltip/component.d.ts +28 -0
- package/dist/tooltip/component.js +35 -0
- package/dist/tooltip/index.d.ts +3 -0
- package/dist/tooltip/index.js +3 -0
- package/dist/tooltip/style.css +46 -0
- package/dist/tree/dragging-img.d.ts +13 -0
- package/dist/tree/dragging-img.js +23 -0
- package/dist/tree/index.d.ts +180 -0
- package/dist/tree/index.js +385 -0
- package/dist/tree/node-info.d.ts +63 -0
- package/dist/tree/node-info.js +128 -0
- package/dist/tree/node.d.ts +132 -0
- package/dist/tree/node.js +264 -0
- package/dist/tree/style.css +99 -0
- package/dist/upload/index.d.ts +48 -0
- package/dist/upload/index.js +141 -0
- package/dist/upload/style.css +41 -0
- package/package.json +51 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
.wok-ui-ext-breadcrumb {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
flex-wrap: wrap;
|
|
5
|
+
gap: 8px;
|
|
6
|
+
font-size: var(--font-size-small);
|
|
7
|
+
line-height: 1.5;
|
|
8
|
+
}
|
|
9
|
+
.wok-ui-ext-breadcrumb .wok-ui-ext-breadcrumb-item {
|
|
10
|
+
display: inline-flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
gap: 4px;
|
|
13
|
+
color: var(--text-tertiary);
|
|
14
|
+
text-decoration: none;
|
|
15
|
+
transition: color var(--transition-speed);
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
}
|
|
18
|
+
.wok-ui-ext-breadcrumb .wok-ui-ext-breadcrumb-item:hover {
|
|
19
|
+
color: var(--color-primary);
|
|
20
|
+
}
|
|
21
|
+
.wok-ui-ext-breadcrumb .wok-ui-ext-breadcrumb-item .wok-ui-svg-icon {
|
|
22
|
+
font-size: var(--font-size-body);
|
|
23
|
+
}
|
|
24
|
+
.wok-ui-ext-breadcrumb .wok-ui-ext-breadcrumb-item-current {
|
|
25
|
+
color: var(--text-primary);
|
|
26
|
+
font-weight: var(--font-weight-medium);
|
|
27
|
+
cursor: default;
|
|
28
|
+
}
|
|
29
|
+
.wok-ui-ext-breadcrumb .wok-ui-ext-breadcrumb-item-current:hover {
|
|
30
|
+
color: var(--text-primary);
|
|
31
|
+
}
|
|
32
|
+
.wok-ui-ext-breadcrumb .wok-ui-ext-breadcrumb-separator {
|
|
33
|
+
color: var(--text-muted);
|
|
34
|
+
user-select: none;
|
|
35
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Module } from 'wok-ui';
|
|
2
|
+
import { IconInput } from '../icons';
|
|
3
|
+
import './style.less';
|
|
4
|
+
/**
|
|
5
|
+
* 按钮
|
|
6
|
+
*/
|
|
7
|
+
export declare class Button extends Module {
|
|
8
|
+
/**
|
|
9
|
+
* 按钮组件
|
|
10
|
+
* @param opts
|
|
11
|
+
* @param opts.size 按钮大小
|
|
12
|
+
* @param opts.type 按钮类型:
|
|
13
|
+
* primary 主要按钮,作用是触发主要操作;
|
|
14
|
+
* success 成功按钮,作用是表示成功操作;
|
|
15
|
+
* warning 警告按钮,作用是表示警告操作;
|
|
16
|
+
* danger 危险按钮,作用是表示危险操作;
|
|
17
|
+
* default 默认按钮,作用是表示普通操作;
|
|
18
|
+
* secondary 次要按钮,作用是表示次要操作。
|
|
19
|
+
* @param opts.disabled 是否禁用
|
|
20
|
+
* @param opts.formType 表单类型
|
|
21
|
+
* @param opts.icon 按钮图标
|
|
22
|
+
* @param opts.text 按钮文本
|
|
23
|
+
*/
|
|
24
|
+
constructor(opts: {
|
|
25
|
+
size?: 'small' | 'default' | 'large';
|
|
26
|
+
type?: 'primary' | 'success' | 'warning' | 'danger' | 'default' | 'secondary' | 'dashed' | 'ghost';
|
|
27
|
+
icon?: IconInput;
|
|
28
|
+
text: string;
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
formType?: 'submit' | 'reset';
|
|
31
|
+
onClick?: (evt: MouseEvent) => void;
|
|
32
|
+
block?: boolean;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Module } from 'wok-ui';
|
|
2
|
+
import { resolveIcon } from '../icons';
|
|
3
|
+
import './style.css';
|
|
4
|
+
/**
|
|
5
|
+
* 按钮
|
|
6
|
+
*/
|
|
7
|
+
export class Button extends Module {
|
|
8
|
+
/**
|
|
9
|
+
* 按钮组件
|
|
10
|
+
* @param opts
|
|
11
|
+
* @param opts.size 按钮大小
|
|
12
|
+
* @param opts.type 按钮类型:
|
|
13
|
+
* primary 主要按钮,作用是触发主要操作;
|
|
14
|
+
* success 成功按钮,作用是表示成功操作;
|
|
15
|
+
* warning 警告按钮,作用是表示警告操作;
|
|
16
|
+
* danger 危险按钮,作用是表示危险操作;
|
|
17
|
+
* default 默认按钮,作用是表示普通操作;
|
|
18
|
+
* secondary 次要按钮,作用是表示次要操作。
|
|
19
|
+
* @param opts.disabled 是否禁用
|
|
20
|
+
* @param opts.formType 表单类型
|
|
21
|
+
* @param opts.icon 按钮图标
|
|
22
|
+
* @param opts.text 按钮文本
|
|
23
|
+
*/
|
|
24
|
+
constructor(opts) {
|
|
25
|
+
const el = document.createElement('button');
|
|
26
|
+
super(el);
|
|
27
|
+
this.el.classList.add('wok-ui-ext-btn');
|
|
28
|
+
if (opts.block) {
|
|
29
|
+
this.el.classList.add('wok-ui-ext-block');
|
|
30
|
+
}
|
|
31
|
+
if (opts.size) {
|
|
32
|
+
this.el.classList.add(`wok-ui-ext-${opts.size}`);
|
|
33
|
+
}
|
|
34
|
+
if (opts.type) {
|
|
35
|
+
this.el.classList.add(`wok-ui-ext-${opts.type}`);
|
|
36
|
+
}
|
|
37
|
+
if (opts.icon) {
|
|
38
|
+
this.addChild(resolveIcon(opts.icon));
|
|
39
|
+
}
|
|
40
|
+
this.addChild(opts.text);
|
|
41
|
+
if (opts.onClick) {
|
|
42
|
+
this.el.addEventListener('click', opts.onClick);
|
|
43
|
+
}
|
|
44
|
+
if (opts.formType === 'submit') {
|
|
45
|
+
el.type = 'submit';
|
|
46
|
+
}
|
|
47
|
+
else if (opts.formType === 'reset') {
|
|
48
|
+
el.type = 'reset';
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
el.type = 'button';
|
|
52
|
+
}
|
|
53
|
+
if (opts.disabled) {
|
|
54
|
+
el.disabled = true;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/* 科技蓝按钮 */
|
|
2
|
+
.wok-ui-ext-btn {
|
|
3
|
+
background: var(--bg-card);
|
|
4
|
+
border: 1px solid var(--border-medium);
|
|
5
|
+
color: var(--text-secondary);
|
|
6
|
+
font-weight: 500;
|
|
7
|
+
padding: 11px 22px;
|
|
8
|
+
border-radius: var(--radius-full);
|
|
9
|
+
font-size: 14px;
|
|
10
|
+
display: inline-flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
gap: 8px;
|
|
13
|
+
box-shadow: var(--shadow-sm);
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
transition: all var(--transition-speed);
|
|
16
|
+
justify-content: center;
|
|
17
|
+
}
|
|
18
|
+
.wok-ui-ext-btn i {
|
|
19
|
+
color: var(--color-primary);
|
|
20
|
+
font-size: 15px;
|
|
21
|
+
}
|
|
22
|
+
.wok-ui-ext-btn:hover {
|
|
23
|
+
background: var(--bg-hover);
|
|
24
|
+
border-color: var(--color-primary);
|
|
25
|
+
transform: translateY(-2px);
|
|
26
|
+
box-shadow: var(--shadow-primary);
|
|
27
|
+
}
|
|
28
|
+
.wok-ui-ext-btn.wok-ui-ext-primary {
|
|
29
|
+
background: linear-gradient(145deg, var(--color-primary), var(--color-primary-dark));
|
|
30
|
+
border-color: var(--color-primary);
|
|
31
|
+
color: white;
|
|
32
|
+
}
|
|
33
|
+
.wok-ui-ext-btn.wok-ui-ext-primary i {
|
|
34
|
+
color: white;
|
|
35
|
+
}
|
|
36
|
+
.wok-ui-ext-btn.wok-ui-ext-secondary {
|
|
37
|
+
background: var(--bg-hover);
|
|
38
|
+
border-color: var(--border-medium);
|
|
39
|
+
color: var(--text-secondary);
|
|
40
|
+
}
|
|
41
|
+
.wok-ui-ext-btn.wok-ui-ext-secondary i {
|
|
42
|
+
color: var(--text-secondary);
|
|
43
|
+
}
|
|
44
|
+
.wok-ui-ext-btn.wok-ui-ext-success {
|
|
45
|
+
background: var(--color-success-light);
|
|
46
|
+
border-color: var(--color-success);
|
|
47
|
+
color: var(--color-success);
|
|
48
|
+
}
|
|
49
|
+
.wok-ui-ext-btn.wok-ui-ext-success i {
|
|
50
|
+
color: var(--color-success);
|
|
51
|
+
}
|
|
52
|
+
.wok-ui-ext-btn.wok-ui-ext-warning {
|
|
53
|
+
background: var(--color-warning-light);
|
|
54
|
+
border-color: var(--color-warning);
|
|
55
|
+
color: var(--color-warning);
|
|
56
|
+
}
|
|
57
|
+
.wok-ui-ext-btn.wok-ui-ext-warning i {
|
|
58
|
+
color: var(--color-warning);
|
|
59
|
+
}
|
|
60
|
+
.wok-ui-ext-btn.wok-ui-ext-danger {
|
|
61
|
+
background: var(--color-danger-light);
|
|
62
|
+
border-color: var(--color-danger);
|
|
63
|
+
color: var(--color-danger);
|
|
64
|
+
}
|
|
65
|
+
.wok-ui-ext-btn.wok-ui-ext-danger i {
|
|
66
|
+
color: var(--color-danger);
|
|
67
|
+
}
|
|
68
|
+
.wok-ui-ext-btn.wok-ui-ext-danger:hover {
|
|
69
|
+
background: var(--color-danger-light);
|
|
70
|
+
border-color: var(--color-danger);
|
|
71
|
+
color: var(--color-danger);
|
|
72
|
+
box-shadow: var(--shadow-danger);
|
|
73
|
+
opacity: 0.9;
|
|
74
|
+
}
|
|
75
|
+
.wok-ui-ext-btn.wok-ui-ext-dashed {
|
|
76
|
+
background: transparent;
|
|
77
|
+
border-style: dashed;
|
|
78
|
+
border-color: var(--border-dark);
|
|
79
|
+
color: var(--color-primary);
|
|
80
|
+
box-shadow: none;
|
|
81
|
+
}
|
|
82
|
+
.wok-ui-ext-btn.wok-ui-ext-dashed i {
|
|
83
|
+
color: var(--color-primary);
|
|
84
|
+
}
|
|
85
|
+
.wok-ui-ext-btn.wok-ui-ext-dashed:hover {
|
|
86
|
+
background: var(--color-primary-light);
|
|
87
|
+
border-color: var(--color-primary);
|
|
88
|
+
color: var(--color-primary-dark);
|
|
89
|
+
transform: none;
|
|
90
|
+
box-shadow: none;
|
|
91
|
+
}
|
|
92
|
+
.wok-ui-ext-btn.wok-ui-ext-dashed:hover i {
|
|
93
|
+
color: var(--color-primary-dark);
|
|
94
|
+
}
|
|
95
|
+
.wok-ui-ext-btn.wok-ui-ext-ghost {
|
|
96
|
+
background: transparent;
|
|
97
|
+
border-color: transparent;
|
|
98
|
+
color: var(--text-primary);
|
|
99
|
+
box-shadow: none;
|
|
100
|
+
}
|
|
101
|
+
.wok-ui-ext-btn.wok-ui-ext-ghost i {
|
|
102
|
+
color: var(--text-primary);
|
|
103
|
+
}
|
|
104
|
+
.wok-ui-ext-btn.wok-ui-ext-ghost:hover {
|
|
105
|
+
background: var(--bg-hover);
|
|
106
|
+
border-color: var(--color-primary);
|
|
107
|
+
color: var(--color-primary);
|
|
108
|
+
transform: none;
|
|
109
|
+
box-shadow: none;
|
|
110
|
+
}
|
|
111
|
+
.wok-ui-ext-btn.wok-ui-ext-ghost:hover i {
|
|
112
|
+
color: var(--color-primary);
|
|
113
|
+
}
|
|
114
|
+
.wok-ui-ext-btn.wok-ui-ext-small {
|
|
115
|
+
padding: 6px 16px;
|
|
116
|
+
font-size: 12px;
|
|
117
|
+
}
|
|
118
|
+
.wok-ui-ext-btn.wok-ui-ext-large {
|
|
119
|
+
padding: 14px 30px;
|
|
120
|
+
font-size: 16px;
|
|
121
|
+
}
|
|
122
|
+
.wok-ui-ext-btn:disabled {
|
|
123
|
+
opacity: 0.5;
|
|
124
|
+
cursor: not-allowed;
|
|
125
|
+
}
|
|
126
|
+
.wok-ui-ext-btn:disabled:hover {
|
|
127
|
+
transform: none;
|
|
128
|
+
box-shadow: none;
|
|
129
|
+
}
|
|
130
|
+
.wok-ui-ext-btn.wok-ui-ext-block {
|
|
131
|
+
display: flex;
|
|
132
|
+
width: 100%;
|
|
133
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DivModule, SubModulesOpt } from 'wok-ui';
|
|
2
|
+
import './style.less';
|
|
3
|
+
/**
|
|
4
|
+
* 通用卡片组件
|
|
5
|
+
*/
|
|
6
|
+
export declare class Card extends DivModule {
|
|
7
|
+
constructor(opts: {
|
|
8
|
+
/**
|
|
9
|
+
* 卡片头部内容
|
|
10
|
+
*/
|
|
11
|
+
header?: SubModulesOpt;
|
|
12
|
+
/**
|
|
13
|
+
* 卡片主体内容
|
|
14
|
+
*/
|
|
15
|
+
content: SubModulesOpt;
|
|
16
|
+
/**
|
|
17
|
+
* 卡片脚部内容
|
|
18
|
+
*/
|
|
19
|
+
footer?: SubModulesOpt;
|
|
20
|
+
/**
|
|
21
|
+
* 额外的 CSS 类名
|
|
22
|
+
*/
|
|
23
|
+
classNames?: string[];
|
|
24
|
+
});
|
|
25
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { DivModule } from 'wok-ui';
|
|
2
|
+
import './style.css';
|
|
3
|
+
/**
|
|
4
|
+
* 通用卡片组件
|
|
5
|
+
*/
|
|
6
|
+
export class Card extends DivModule {
|
|
7
|
+
constructor(opts) {
|
|
8
|
+
super('wok-ui-ext-card');
|
|
9
|
+
if (opts.classNames) {
|
|
10
|
+
this.el.classList.add(...opts.classNames);
|
|
11
|
+
}
|
|
12
|
+
if (opts.header) {
|
|
13
|
+
this.addChild({
|
|
14
|
+
classNames: 'wok-ui-ext-card-header',
|
|
15
|
+
children: opts.header
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
this.addChild({
|
|
19
|
+
classNames: 'wok-ui-ext-card-content',
|
|
20
|
+
children: opts.content
|
|
21
|
+
});
|
|
22
|
+
if (opts.footer) {
|
|
23
|
+
this.addChild({
|
|
24
|
+
classNames: 'wok-ui-ext-card-footer',
|
|
25
|
+
children: opts.footer
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
.wok-ui-ext-card {
|
|
2
|
+
background: var(--bg-card);
|
|
3
|
+
border: 1px solid var(--border-light);
|
|
4
|
+
border-radius: var(--radius-xl);
|
|
5
|
+
box-shadow: var(--shadow-md);
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
}
|
|
9
|
+
.wok-ui-ext-card:hover {
|
|
10
|
+
box-shadow: var(--shadow-lg);
|
|
11
|
+
}
|
|
12
|
+
.wok-ui-ext-card .wok-ui-ext-card-header {
|
|
13
|
+
padding: 16px 16px 12px;
|
|
14
|
+
border-bottom: 1px solid var(--border-light);
|
|
15
|
+
}
|
|
16
|
+
.wok-ui-ext-card .wok-ui-ext-card-content {
|
|
17
|
+
flex: 1;
|
|
18
|
+
padding: 16px;
|
|
19
|
+
}
|
|
20
|
+
.wok-ui-ext-card .wok-ui-ext-card-footer {
|
|
21
|
+
padding: 12px 16px 16px;
|
|
22
|
+
border-top: 1px solid var(--border-light);
|
|
23
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { DivModule, SubModulesOpt } from 'wok-ui';
|
|
2
|
+
import './style.less';
|
|
3
|
+
export interface PanelOptions {
|
|
4
|
+
/** 面板标题(字符串或自定义内容) */
|
|
5
|
+
title: string | SubModulesOpt;
|
|
6
|
+
/** 面板内容 */
|
|
7
|
+
content: SubModulesOpt;
|
|
8
|
+
/** 默认展开 */
|
|
9
|
+
defaultOpen?: boolean;
|
|
10
|
+
/** 禁用 */
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface CollapseOptions {
|
|
14
|
+
/** 面板列表 */
|
|
15
|
+
items: PanelOptions[];
|
|
16
|
+
/** 手风琴模式(只展开一个) */
|
|
17
|
+
accordion?: boolean;
|
|
18
|
+
/** 允许全部折叠(手风琴模式时,点击已展开的可关闭它) */
|
|
19
|
+
collapsible?: boolean;
|
|
20
|
+
/** 无边框模式 */
|
|
21
|
+
ghost?: boolean;
|
|
22
|
+
/** 展开/折叠回调(参数为当前展开的面板列表) */
|
|
23
|
+
onChange?: (activePanels: Panel[]) => void;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 面板(可单独使用,也可作为 Collapse 的子项)
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* // 单独使用
|
|
31
|
+
* new Panel({ title: '基本信息', content: '内容...', defaultOpen: true })
|
|
32
|
+
*
|
|
33
|
+
* // 在 Collapse 中使用
|
|
34
|
+
* new Collapse({
|
|
35
|
+
* items: [
|
|
36
|
+
* { title: '面板1', content: '内容1' },
|
|
37
|
+
* { title: '面板2', content: '内容2', defaultOpen: true }
|
|
38
|
+
* ],
|
|
39
|
+
* accordion: true
|
|
40
|
+
* })
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare class Panel extends DivModule {
|
|
44
|
+
private opts;
|
|
45
|
+
private _isOpen;
|
|
46
|
+
private bodyWrapperEl;
|
|
47
|
+
onToggle?: (panel: Panel, nextOpen: boolean) => void;
|
|
48
|
+
constructor(opts: PanelOptions);
|
|
49
|
+
private render;
|
|
50
|
+
/** 展开 */
|
|
51
|
+
open(): void;
|
|
52
|
+
/** 折叠 */
|
|
53
|
+
close(): void;
|
|
54
|
+
/** 切换(由点击触发) */
|
|
55
|
+
toggle(): void;
|
|
56
|
+
/** 当前是否展开 */
|
|
57
|
+
isOpen(): boolean;
|
|
58
|
+
/** 由 Collapse 直接设置状态(不触发回调) */
|
|
59
|
+
setOpen(open: boolean): void;
|
|
60
|
+
private syncBodyHeight;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* 折叠面板组
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* // 普通多开模式
|
|
68
|
+
* new Collapse({
|
|
69
|
+
* items: [
|
|
70
|
+
* { title: '基本信息', content: new Form(...), defaultOpen: true },
|
|
71
|
+
* { title: '高级设置', content: '...' }
|
|
72
|
+
* ]
|
|
73
|
+
* })
|
|
74
|
+
*
|
|
75
|
+
* // 手风琴模式
|
|
76
|
+
* new Collapse({
|
|
77
|
+
* items: [...],
|
|
78
|
+
* accordion: true,
|
|
79
|
+
* collapsible: true // 允许全部折叠
|
|
80
|
+
* })
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
export declare class Collapse extends DivModule {
|
|
84
|
+
private opts;
|
|
85
|
+
readonly panels: Panel[];
|
|
86
|
+
private activePanels;
|
|
87
|
+
constructor(opts: CollapseOptions);
|
|
88
|
+
private handleToggle;
|
|
89
|
+
}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { DivModule } from 'wok-ui';
|
|
2
|
+
import { IconChevronDown } from '../icons';
|
|
3
|
+
import './style.css';
|
|
4
|
+
/**
|
|
5
|
+
* 面板(可单独使用,也可作为 Collapse 的子项)
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* // 单独使用
|
|
10
|
+
* new Panel({ title: '基本信息', content: '内容...', defaultOpen: true })
|
|
11
|
+
*
|
|
12
|
+
* // 在 Collapse 中使用
|
|
13
|
+
* new Collapse({
|
|
14
|
+
* items: [
|
|
15
|
+
* { title: '面板1', content: '内容1' },
|
|
16
|
+
* { title: '面板2', content: '内容2', defaultOpen: true }
|
|
17
|
+
* ],
|
|
18
|
+
* accordion: true
|
|
19
|
+
* })
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export class Panel extends DivModule {
|
|
23
|
+
constructor(opts) {
|
|
24
|
+
super('wok-ui-ext-panel');
|
|
25
|
+
this.opts = opts;
|
|
26
|
+
this._isOpen = opts.defaultOpen ?? false;
|
|
27
|
+
this.render();
|
|
28
|
+
}
|
|
29
|
+
render() {
|
|
30
|
+
// 头部
|
|
31
|
+
this.addChild({
|
|
32
|
+
classNames: ['wok-ui-ext-panel-header'],
|
|
33
|
+
...(this.opts.disabled ? {} : {}),
|
|
34
|
+
preHandle: el => {
|
|
35
|
+
el.addEventListener('click', () => this.toggle());
|
|
36
|
+
if (this.opts.disabled) {
|
|
37
|
+
el.classList.add('disabled');
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
children: add => {
|
|
41
|
+
// 标题
|
|
42
|
+
if (typeof this.opts.title === 'string') {
|
|
43
|
+
add({
|
|
44
|
+
tag: 'div',
|
|
45
|
+
classNames: 'wok-ui-ext-panel-header-title',
|
|
46
|
+
innerText: this.opts.title
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
add({
|
|
51
|
+
tag: 'div',
|
|
52
|
+
classNames: 'panel-header-title',
|
|
53
|
+
children: this.opts.title
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
// 箭头
|
|
57
|
+
add({
|
|
58
|
+
tag: 'div',
|
|
59
|
+
classNames: 'wok-ui-ext-panel-header-arrow',
|
|
60
|
+
children: new IconChevronDown()
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
// body 容器(用于 max-height 动画)
|
|
65
|
+
this.addChild({
|
|
66
|
+
classNames: 'wok-ui-ext-panel-body-wrapper',
|
|
67
|
+
preHandle: el => {
|
|
68
|
+
this.bodyWrapperEl = el;
|
|
69
|
+
},
|
|
70
|
+
children: {
|
|
71
|
+
classNames: 'wok-ui-ext-panel-body',
|
|
72
|
+
children: this.opts.content
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
// 初始状态
|
|
76
|
+
if (this._isOpen) {
|
|
77
|
+
this.el.classList.add('open');
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/** 展开 */
|
|
81
|
+
open() {
|
|
82
|
+
if (this.opts.disabled || this._isOpen)
|
|
83
|
+
return;
|
|
84
|
+
this._isOpen = true;
|
|
85
|
+
this.el.classList.add('open');
|
|
86
|
+
this.syncBodyHeight();
|
|
87
|
+
}
|
|
88
|
+
/** 折叠 */
|
|
89
|
+
close() {
|
|
90
|
+
if (!this._isOpen)
|
|
91
|
+
return;
|
|
92
|
+
this._isOpen = false;
|
|
93
|
+
this.el.classList.remove('open');
|
|
94
|
+
this.bodyWrapperEl.style.maxHeight = '0';
|
|
95
|
+
}
|
|
96
|
+
/** 切换(由点击触发) */
|
|
97
|
+
toggle() {
|
|
98
|
+
if (this.opts.disabled)
|
|
99
|
+
return;
|
|
100
|
+
const nextOpen = !this._isOpen;
|
|
101
|
+
if (this.onToggle) {
|
|
102
|
+
// 由 Collapse 处理
|
|
103
|
+
this.onToggle(this, nextOpen);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
// 独立使用时直接切换
|
|
107
|
+
if (nextOpen)
|
|
108
|
+
this.open();
|
|
109
|
+
else
|
|
110
|
+
this.close();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
/** 当前是否展开 */
|
|
114
|
+
isOpen() {
|
|
115
|
+
return this._isOpen;
|
|
116
|
+
}
|
|
117
|
+
/** 由 Collapse 直接设置状态(不触发回调) */
|
|
118
|
+
setOpen(open) {
|
|
119
|
+
if (this.opts.disabled)
|
|
120
|
+
return;
|
|
121
|
+
this._isOpen = open;
|
|
122
|
+
if (open) {
|
|
123
|
+
this.el.classList.add('open');
|
|
124
|
+
this.syncBodyHeight();
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
this.el.classList.remove('open');
|
|
128
|
+
this.bodyWrapperEl.style.maxHeight = '0';
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
syncBodyHeight() {
|
|
132
|
+
const body = this.bodyWrapperEl.querySelector('.wok-ui-ext-panel-body');
|
|
133
|
+
if (body) {
|
|
134
|
+
this.bodyWrapperEl.style.maxHeight = `${body.scrollHeight}px`;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* 折叠面板组
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```ts
|
|
143
|
+
* // 普通多开模式
|
|
144
|
+
* new Collapse({
|
|
145
|
+
* items: [
|
|
146
|
+
* { title: '基本信息', content: new Form(...), defaultOpen: true },
|
|
147
|
+
* { title: '高级设置', content: '...' }
|
|
148
|
+
* ]
|
|
149
|
+
* })
|
|
150
|
+
*
|
|
151
|
+
* // 手风琴模式
|
|
152
|
+
* new Collapse({
|
|
153
|
+
* items: [...],
|
|
154
|
+
* accordion: true,
|
|
155
|
+
* collapsible: true // 允许全部折叠
|
|
156
|
+
* })
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
export class Collapse extends DivModule {
|
|
160
|
+
constructor(opts) {
|
|
161
|
+
super('wok-ui-ext-collapse');
|
|
162
|
+
this.opts = opts;
|
|
163
|
+
if (opts.ghost) {
|
|
164
|
+
this.el.classList.add('ghost');
|
|
165
|
+
}
|
|
166
|
+
this.activePanels = new Set();
|
|
167
|
+
this.panels = [];
|
|
168
|
+
opts.items.forEach(item => {
|
|
169
|
+
const panel = new Panel(item);
|
|
170
|
+
this.panels.push(panel);
|
|
171
|
+
this.addChild(panel);
|
|
172
|
+
// 记录初始展开项
|
|
173
|
+
if (item.defaultOpen) {
|
|
174
|
+
this.activePanels.add(panel);
|
|
175
|
+
}
|
|
176
|
+
// 注册切换回调
|
|
177
|
+
panel.onToggle = (p, nextOpen) => this.handleToggle(p, nextOpen);
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
handleToggle(panel, nextOpen) {
|
|
181
|
+
if (this.opts.accordion) {
|
|
182
|
+
if (nextOpen) {
|
|
183
|
+
// 关闭其他全部
|
|
184
|
+
this.panels.forEach(p => {
|
|
185
|
+
if (p !== panel)
|
|
186
|
+
p.setOpen(false);
|
|
187
|
+
});
|
|
188
|
+
this.activePanels.clear();
|
|
189
|
+
this.activePanels.add(panel);
|
|
190
|
+
panel.setOpen(true);
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
// 关闭当前(仅允许全部折叠时才可关闭)
|
|
194
|
+
if (this.opts.collapsible) {
|
|
195
|
+
this.activePanels.delete(panel);
|
|
196
|
+
panel.setOpen(false);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
// 普通模式,自由切换
|
|
202
|
+
if (nextOpen) {
|
|
203
|
+
panel.open();
|
|
204
|
+
this.activePanels.add(panel);
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
panel.close();
|
|
208
|
+
this.activePanels.delete(panel);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
this.opts.onChange?.(Array.from(this.activePanels));
|
|
212
|
+
}
|
|
213
|
+
}
|