ice-web-components 1.0.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.md +487 -0
- package/dist/index.cjs +1 -0
- package/dist/index.mjs +1 -0
- package/dist/index.umd.js +1 -0
- package/dist/types/components/ICEAlert.d.ts +28 -0
- package/dist/types/components/ICEAnchor.d.ts +69 -0
- package/dist/types/components/ICEAutoComplete.d.ts +71 -0
- package/dist/types/components/ICEAvatar.d.ts +11 -0
- package/dist/types/components/ICEAvatarGroup.d.ts +40 -0
- package/dist/types/components/ICEBackTop.d.ts +39 -0
- package/dist/types/components/ICEBadge.d.ts +17 -0
- package/dist/types/components/ICEBreadcrumb.d.ts +82 -0
- package/dist/types/components/ICEButton.d.ts +25 -0
- package/dist/types/components/ICECalendar.d.ts +84 -0
- package/dist/types/components/ICECard.d.ts +22 -0
- package/dist/types/components/ICECarousel.d.ts +86 -0
- package/dist/types/components/ICECascader.d.ts +84 -0
- package/dist/types/components/ICECheckBox.d.ts +21 -0
- package/dist/types/components/ICECheckboxGroup.d.ts +75 -0
- package/dist/types/components/ICECollapse.d.ts +49 -0
- package/dist/types/components/ICEColorPicker.d.ts +52 -0
- package/dist/types/components/ICEComment.d.ts +36 -0
- package/dist/types/components/ICEDatePicker.d.ts +90 -0
- package/dist/types/components/ICEDescriptions.d.ts +40 -0
- package/dist/types/components/ICEDrawer.d.ts +59 -0
- package/dist/types/components/ICEDropdown.d.ts +63 -0
- package/dist/types/components/ICEEmpty.d.ts +28 -0
- package/dist/types/components/ICEFloatButton.d.ts +63 -0
- package/dist/types/components/ICEForm.d.ts +48 -0
- package/dist/types/components/ICEFormItem.d.ts +65 -0
- package/dist/types/components/ICEGrid.d.ts +59 -0
- package/dist/types/components/ICEIcon.d.ts +9 -0
- package/dist/types/components/ICEIconTile.d.ts +53 -0
- package/dist/types/components/ICEImagePreview.d.ts +91 -0
- package/dist/types/components/ICEImageView.d.ts +62 -0
- package/dist/types/components/ICEInputNumber.d.ts +54 -0
- package/dist/types/components/ICEKanban.d.ts +85 -0
- package/dist/types/components/ICELabel.d.ts +28 -0
- package/dist/types/components/ICEList.d.ts +59 -0
- package/dist/types/components/ICEMenu.d.ts +48 -0
- package/dist/types/components/ICEModal.d.ts +73 -0
- package/dist/types/components/ICEPagination.d.ts +62 -0
- package/dist/types/components/ICEPanel.d.ts +7 -0
- package/dist/types/components/ICEPasswordField.d.ts +18 -0
- package/dist/types/components/ICEPopconfirm.d.ts +21 -0
- package/dist/types/components/ICEPopover.d.ts +48 -0
- package/dist/types/components/ICEProgressBar.d.ts +37 -0
- package/dist/types/components/ICERadioButton.d.ts +21 -0
- package/dist/types/components/ICERadioGroup.d.ts +71 -0
- package/dist/types/components/ICERate.d.ts +43 -0
- package/dist/types/components/ICEResult.d.ts +30 -0
- package/dist/types/components/ICEScrollPane.d.ts +72 -0
- package/dist/types/components/ICESegmented.d.ts +34 -0
- package/dist/types/components/ICESelect.d.ts +85 -0
- package/dist/types/components/ICESeparator.d.ts +7 -0
- package/dist/types/components/ICESkeleton.d.ts +29 -0
- package/dist/types/components/ICESlider.d.ts +63 -0
- package/dist/types/components/ICESpace.d.ts +51 -0
- package/dist/types/components/ICESpin.d.ts +33 -0
- package/dist/types/components/ICESplitter.d.ts +85 -0
- package/dist/types/components/ICEStatCard.d.ts +14 -0
- package/dist/types/components/ICEStatistic.d.ts +78 -0
- package/dist/types/components/ICESteps.d.ts +31 -0
- package/dist/types/components/ICESvgIcon.d.ts +9 -0
- package/dist/types/components/ICESwitch.d.ts +23 -0
- package/dist/types/components/ICETable.d.ts +250 -0
- package/dist/types/components/ICETabs.d.ts +17 -0
- package/dist/types/components/ICETag.d.ts +15 -0
- package/dist/types/components/ICETextArea.d.ts +8 -0
- package/dist/types/components/ICETextField.d.ts +80 -0
- package/dist/types/components/ICETileMap.d.ts +152 -0
- package/dist/types/components/ICETimePicker.d.ts +81 -0
- package/dist/types/components/ICETimeline.d.ts +33 -0
- package/dist/types/components/ICETooltip.d.ts +55 -0
- package/dist/types/components/ICETour.d.ts +97 -0
- package/dist/types/components/ICETransfer.d.ts +68 -0
- package/dist/types/components/ICETree.d.ts +107 -0
- package/dist/types/components/ICETreeSelect.d.ts +64 -0
- package/dist/types/components/ICETypography.d.ts +67 -0
- package/dist/types/components/ICEUpload.d.ts +75 -0
- package/dist/types/components/ICEVirtualList.d.ts +100 -0
- package/dist/types/components/ICEWatermark.d.ts +49 -0
- package/dist/types/components/ICEWindow.d.ts +159 -0
- package/dist/types/core/ICEContainer.d.ts +10 -0
- package/dist/types/core/ICEFocusManager.d.ts +70 -0
- package/dist/types/core/ICEHoverManager.d.ts +26 -0
- package/dist/types/core/ICEManager.d.ts +24 -0
- package/dist/types/core/ICEMessageManager.d.ts +80 -0
- package/dist/types/core/ICEOverlayManager.d.ts +92 -0
- package/dist/types/core/ICEPainter.d.ts +12 -0
- package/dist/types/core/ICEWidget.d.ts +86 -0
- package/dist/types/i18n/ICEI18n.d.ts +35 -0
- package/dist/types/index.d.ts +111 -0
- package/dist/types/model/ICE2048Model.d.ts +90 -0
- package/dist/types/model/ICEBoundedRangeModel.d.ts +20 -0
- package/dist/types/model/ICEButtonModel.d.ts +16 -0
- package/dist/types/model/ICEFormModel.d.ts +105 -0
- package/dist/types/model/ICEHighScoreModel.d.ts +60 -0
- package/dist/types/model/ICEMinesweeperModel.d.ts +102 -0
- package/dist/types/model/ICESelectionModel.d.ts +31 -0
- package/dist/types/model/ICESnakeModel.d.ts +90 -0
- package/dist/types/model/ICETetrisModel.d.ts +118 -0
- package/dist/types/model/ICEToggleModel.d.ts +14 -0
- package/dist/types/theme/ICEArcadeTheme.d.ts +22 -0
- package/dist/types/theme/ICETheme.d.ts +120 -0
- package/dist/types/util/ICEAccessibilityMirror.d.ts +55 -0
- package/dist/types/util/ICEAnimation.d.ts +71 -0
- package/dist/types/util/ICEDragReorder.d.ts +102 -0
- package/dist/types/util/ICENativeInput.d.ts +65 -0
- package/dist/types/util/ICEOverlayPosition.d.ts +52 -0
- package/dist/types/util/ICEStyle.d.ts +60 -0
- package/dist/types/util/ICEWorldBox.d.ts +14 -0
- package/package.json +56 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { ICEWidget } from '../core/ICEWidget';
|
|
2
|
+
import { ICELabel } from './ICELabel';
|
|
3
|
+
import type { ICEFormRule } from '../model/ICEFormModel';
|
|
4
|
+
/**
|
|
5
|
+
* 表单项:标签 + 控件 + 错误文案。
|
|
6
|
+
*
|
|
7
|
+
* 只负责「摆位置 + 显示错误」;值的读写与校验规则由 ICEForm / ICEFormModel 管。
|
|
8
|
+
* 控件必须实现取值约定(`getFormValue` / `setFormValue`)。
|
|
9
|
+
*
|
|
10
|
+
* 布局:
|
|
11
|
+
* - `vertical`(默认):标签在上一行,控件居中,错误文案在最下(高度预留,避免校验时抖动);
|
|
12
|
+
* - `horizontal`:标签占左侧 labelWidth,控件与错误文案在右侧。
|
|
13
|
+
*/
|
|
14
|
+
export interface ICEFormItemOptions {
|
|
15
|
+
/** 组件 id(引擎会用它做唯一标识,e2e/调试时可按 id 定位) */
|
|
16
|
+
id?: string;
|
|
17
|
+
name: string;
|
|
18
|
+
label?: string;
|
|
19
|
+
control: any;
|
|
20
|
+
/** 校验规则(透传给 ICEFormModel) */
|
|
21
|
+
rules?: ICEFormRule[];
|
|
22
|
+
/**
|
|
23
|
+
* 依赖的字段名:这些字段变化时本项自动重算(跨字段校验,如「确认密码」)。
|
|
24
|
+
* 透传给 ICEFormModel。
|
|
25
|
+
*/
|
|
26
|
+
dependencies?: string[];
|
|
27
|
+
layout?: 'vertical' | 'horizontal';
|
|
28
|
+
labelWidth?: number;
|
|
29
|
+
width?: number;
|
|
30
|
+
/** 标签行高 / 错误行高 / 间距 */
|
|
31
|
+
labelHeight?: number;
|
|
32
|
+
errorHeight?: number;
|
|
33
|
+
gap?: number;
|
|
34
|
+
}
|
|
35
|
+
export declare class ICEFormItem extends ICEWidget {
|
|
36
|
+
private name;
|
|
37
|
+
private labelText;
|
|
38
|
+
private control;
|
|
39
|
+
private rules;
|
|
40
|
+
private dependencies;
|
|
41
|
+
private validating;
|
|
42
|
+
private itemLayout;
|
|
43
|
+
private labelWidth;
|
|
44
|
+
private labelHeight;
|
|
45
|
+
private errorHeight;
|
|
46
|
+
private itemGap;
|
|
47
|
+
private labelNode;
|
|
48
|
+
private errorNode;
|
|
49
|
+
constructor(props: ICEFormItemOptions);
|
|
50
|
+
getName(): string;
|
|
51
|
+
getLabel(): string;
|
|
52
|
+
getRules(): ICEFormRule[];
|
|
53
|
+
/** 依赖的字段名(跨字段重校验用)。 */
|
|
54
|
+
getDependencies(): string[];
|
|
55
|
+
getControl(): any;
|
|
56
|
+
getLabelNode(): ICELabel;
|
|
57
|
+
getErrorNode(): ICELabel;
|
|
58
|
+
getErrorText(): string;
|
|
59
|
+
isValidating(): boolean;
|
|
60
|
+
/** 异步校验中:错误行显示「校验中…」(错误文案让位,校验完再由 setError 接管)。 */
|
|
61
|
+
setValidating(pending: boolean): this;
|
|
62
|
+
/** 设置错误文案(null / '' 表示通过);同时把控件切到 error / default 状态。 */
|
|
63
|
+
setError(message: string | null): this;
|
|
64
|
+
private __layoutChildren;
|
|
65
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ICEContainer } from '../core/ICEContainer';
|
|
2
|
+
/**
|
|
3
|
+
* 24 栅格列(Ant `Col`):`span` 占多少格、`offset` 左边空多少格,`content` 是列内容。
|
|
4
|
+
*
|
|
5
|
+
* 一般配合 `ICEGrid`(行)使用,由行统一算宽度与位置,不需要手动设 width。
|
|
6
|
+
*/
|
|
7
|
+
export interface ICEGridColOptions {
|
|
8
|
+
/** 组件 id(引擎会用它做唯一标识,e2e/调试时可按 id 定位) */
|
|
9
|
+
id?: string;
|
|
10
|
+
/** 占多少格(1..24),默认 24 */
|
|
11
|
+
span?: number;
|
|
12
|
+
/** 左侧空出多少格,默认 0 */
|
|
13
|
+
offset?: number;
|
|
14
|
+
/** 列内容 */
|
|
15
|
+
content?: any;
|
|
16
|
+
height?: number;
|
|
17
|
+
}
|
|
18
|
+
export declare class ICEGridCol extends ICEContainer {
|
|
19
|
+
readonly span: number;
|
|
20
|
+
readonly offset: number;
|
|
21
|
+
private content;
|
|
22
|
+
constructor(props?: ICEGridColOptions);
|
|
23
|
+
getContent(): any;
|
|
24
|
+
/** 由 `ICEGrid` 调用:设置列宽并把内容撑满列宽。 */
|
|
25
|
+
applyLayout(left: number, top: number, width: number): void;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* 24 栅格行(Ant `Row`):把若干 `ICEGridCol` 排成一行,放不下自动换行。
|
|
29
|
+
*
|
|
30
|
+
* 规则:先按 `span + offset` 把列分行(每行不超过 24 格),再按
|
|
31
|
+
* `unit = (width - gutter × (列数 - 1)) / 24` 算每格宽度;
|
|
32
|
+
* 行高取该行最高列,行间距离是 `gutterY`。
|
|
33
|
+
*/
|
|
34
|
+
export interface ICEGridOptions {
|
|
35
|
+
/** 组件 id(引擎会用它做唯一标识,e2e/调试时可按 id 定位) */
|
|
36
|
+
id?: string;
|
|
37
|
+
/** 列间距,默认 16 */
|
|
38
|
+
gutter?: number;
|
|
39
|
+
/** 行间距,默认 16 */
|
|
40
|
+
gutterY?: number;
|
|
41
|
+
left?: number;
|
|
42
|
+
top?: number;
|
|
43
|
+
width?: number;
|
|
44
|
+
height?: number;
|
|
45
|
+
}
|
|
46
|
+
export declare class ICEGrid extends ICEContainer {
|
|
47
|
+
private cols;
|
|
48
|
+
private gutter;
|
|
49
|
+
private gutterY;
|
|
50
|
+
private autoHeight;
|
|
51
|
+
constructor(props?: ICEGridOptions);
|
|
52
|
+
getCols(): ICEGridCol[];
|
|
53
|
+
addCol(col: ICEGridCol): this;
|
|
54
|
+
setGutter(gutter: number, gutterY?: number): this;
|
|
55
|
+
private __rows;
|
|
56
|
+
private __layout;
|
|
57
|
+
private __contentHeight;
|
|
58
|
+
revalidate(): this;
|
|
59
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ICEWidget } from '../core/ICEWidget';
|
|
2
|
+
/**
|
|
3
|
+
* 图标磁贴(桌面图标 / 应用宫格):大图标字形 + 下方文字标签。
|
|
4
|
+
*
|
|
5
|
+
* - 单击选中(标签变蓝底白字,XP 桌面的选择样式),再点一下取消;
|
|
6
|
+
* - **双击打开**(`dblclick` → `open` 事件 + `onOpen`),Enter/Space 等价(键盘可达);
|
|
7
|
+
* - `selected` 为受控初始值,`setSelected()` 是程序式接口(取消全选时用)。
|
|
8
|
+
*/
|
|
9
|
+
export interface ICEIconTileOptions {
|
|
10
|
+
/** 组件 id(引擎会用它做唯一标识,e2e/调试时可按 id 定位) */
|
|
11
|
+
id?: string;
|
|
12
|
+
/** 图标字形(emoji 或单个符号) */
|
|
13
|
+
icon: string;
|
|
14
|
+
/**
|
|
15
|
+
* 自绘图标节点(给了它就代替 `icon` 字形)。
|
|
16
|
+
*
|
|
17
|
+
* 需要「画」出来的图标(拟物、彩色、多图层)时用:传一个组件,磁贴会把它在图标区居中。
|
|
18
|
+
*/
|
|
19
|
+
iconNode?: any;
|
|
20
|
+
label: string;
|
|
21
|
+
left?: number;
|
|
22
|
+
top?: number;
|
|
23
|
+
width?: number;
|
|
24
|
+
height?: number;
|
|
25
|
+
iconSize?: number;
|
|
26
|
+
fontSize?: number;
|
|
27
|
+
selected?: boolean;
|
|
28
|
+
onSelect?: (selected: boolean) => void;
|
|
29
|
+
onOpen?: (label: string) => void;
|
|
30
|
+
}
|
|
31
|
+
export declare class ICEIconTile extends ICEWidget {
|
|
32
|
+
private iconNode;
|
|
33
|
+
private labelNode;
|
|
34
|
+
private labelBackground;
|
|
35
|
+
private selected;
|
|
36
|
+
private onSelect;
|
|
37
|
+
private onOpen;
|
|
38
|
+
private readonly labelText;
|
|
39
|
+
constructor(props: ICEIconTileOptions);
|
|
40
|
+
getLabel(): string;
|
|
41
|
+
isSelected(): boolean;
|
|
42
|
+
setSelected(selected: boolean): this;
|
|
43
|
+
/** 单击切换选中(桌面图标的标准行为)。 */
|
|
44
|
+
toggle(): this;
|
|
45
|
+
/** 打开(双击 / Enter / Space)。 */
|
|
46
|
+
open(): this;
|
|
47
|
+
/** 键盘激活 = 打开(与双击同义)。 */
|
|
48
|
+
activate(): void;
|
|
49
|
+
getLabelColor(): string;
|
|
50
|
+
getLabelBackground(): string;
|
|
51
|
+
protected __applyHoverState(): void;
|
|
52
|
+
private __sync;
|
|
53
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { ICEButton } from './ICEButton';
|
|
2
|
+
import { ICEImageView } from './ICEImageView';
|
|
3
|
+
import { ICEPanel } from './ICEPanel';
|
|
4
|
+
import { ICEWidget } from '../core/ICEWidget';
|
|
5
|
+
import { ICEOverlayManager } from '../core/ICEOverlayManager';
|
|
6
|
+
import { ICEFocusManager } from '../core/ICEFocusManager';
|
|
7
|
+
/**
|
|
8
|
+
* 图片预览(Ant `Image.PreviewGroup`):全屏遮罩 + 居中图片 + 底部工具栏。
|
|
9
|
+
*
|
|
10
|
+
* - 上一张 / 下一张循环切换(`change` 事件 + `onIndexChange`);
|
|
11
|
+
* - 缩放(步进 + 上下限)与 90° 旋转,`reset()` 复位;
|
|
12
|
+
* - 关闭途径:工具栏关闭按钮、遮罩点击、Esc;打开期间接管 ←/→/+/− 快捷键;
|
|
13
|
+
* - 浮层挂在引擎工具层(复用 `ICEOverlayManager`),关闭后自动移除。
|
|
14
|
+
*/
|
|
15
|
+
export declare type ICEImagePreviewCloseReason = 'close' | 'mask' | 'esc' | 'api';
|
|
16
|
+
export interface ICEImagePreviewOptions {
|
|
17
|
+
images: string[];
|
|
18
|
+
/** 初始索引,默认 0 */
|
|
19
|
+
index?: number;
|
|
20
|
+
/** 每次缩放的步进,默认 0.25 */
|
|
21
|
+
zoomStep?: number;
|
|
22
|
+
/** 缩放下限,默认 0.25 */
|
|
23
|
+
minZoom?: number;
|
|
24
|
+
/** 缩放上限,默认 3 */
|
|
25
|
+
maxZoom?: number;
|
|
26
|
+
maskClosable?: boolean;
|
|
27
|
+
closeOnEsc?: boolean;
|
|
28
|
+
onIndexChange?: (index: number) => void;
|
|
29
|
+
onClose?: (reason: ICEImagePreviewCloseReason) => void;
|
|
30
|
+
manager?: ICEOverlayManager;
|
|
31
|
+
focusManager?: ICEFocusManager;
|
|
32
|
+
}
|
|
33
|
+
declare type ICEPreviewToolbarButton = 'zoomOut' | 'zoomIn' | 'rotateLeft' | 'rotateRight' | 'prev' | 'next' | 'close';
|
|
34
|
+
export declare class ICEImagePreview {
|
|
35
|
+
private ice;
|
|
36
|
+
private options;
|
|
37
|
+
private manager;
|
|
38
|
+
private focus;
|
|
39
|
+
private handle;
|
|
40
|
+
private mask;
|
|
41
|
+
private frame;
|
|
42
|
+
private image;
|
|
43
|
+
private buttons;
|
|
44
|
+
private index;
|
|
45
|
+
private zoom;
|
|
46
|
+
private rotation;
|
|
47
|
+
private bound;
|
|
48
|
+
private pendingReason;
|
|
49
|
+
constructor(ice: any, options: ICEImagePreviewOptions);
|
|
50
|
+
isOpen(): boolean;
|
|
51
|
+
getIndex(): number;
|
|
52
|
+
getZoom(): number;
|
|
53
|
+
getRotation(): number;
|
|
54
|
+
getMask(): ICEPanel | null;
|
|
55
|
+
getFrame(): ICEWidget | null;
|
|
56
|
+
getImageNode(): ICEImageView | null;
|
|
57
|
+
getToolbarButton(name: ICEPreviewToolbarButton): ICEButton | null;
|
|
58
|
+
getImages(): string[];
|
|
59
|
+
open(index?: number): this;
|
|
60
|
+
close(reason?: ICEImagePreviewCloseReason): this;
|
|
61
|
+
setIndex(index: number): this;
|
|
62
|
+
next(): this;
|
|
63
|
+
prev(): this;
|
|
64
|
+
zoomIn(): this;
|
|
65
|
+
zoomOut(): this;
|
|
66
|
+
rotateLeft(): this;
|
|
67
|
+
rotateRight(): this;
|
|
68
|
+
/** 缩放与旋转同时复位。 */
|
|
69
|
+
reset(): this;
|
|
70
|
+
/** 事件总线(组件自身不是画布节点,所以直接转发给实例上的 emitter)。 */
|
|
71
|
+
private listeners;
|
|
72
|
+
on(name: string, handler: (evt: any) => void): this;
|
|
73
|
+
off(name: string, handler: (evt: any) => void): this;
|
|
74
|
+
trigger(name: string, evt: any, param?: any): this;
|
|
75
|
+
private __clampIndex;
|
|
76
|
+
private __currentSrc;
|
|
77
|
+
private __zoomStep;
|
|
78
|
+
private __setZoom;
|
|
79
|
+
private __setRotation;
|
|
80
|
+
/** 图片按缩放铺在 frame 内(超出部分被 frame 裁掉),旋转走引擎 transform。 */
|
|
81
|
+
private __syncImage;
|
|
82
|
+
private __createToolbar;
|
|
83
|
+
private __bindKeyboard;
|
|
84
|
+
private __unbindKeyboard;
|
|
85
|
+
private __onKeyDown;
|
|
86
|
+
private __handleClosed;
|
|
87
|
+
private __visibleRect;
|
|
88
|
+
}
|
|
89
|
+
/** 便捷入口:`openImagePreview(ice, { images: [...], index: 0 })`。 */
|
|
90
|
+
export declare function openImagePreview(ice: any, options: ICEImagePreviewOptions): ICEImagePreview;
|
|
91
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { ICEImage as EngineImage } from 'ice-render';
|
|
2
|
+
import { ICEWidget } from '../core/ICEWidget';
|
|
3
|
+
/**
|
|
4
|
+
* 图片视图(基于引擎原语 `ICEImage`)。
|
|
5
|
+
*
|
|
6
|
+
* 名字带 `View` 后缀是为了避开引擎自己的 `ICEImage`(图片原语)——两个包同名不同物,
|
|
7
|
+
* 同时 import 会撞名,所以本库的控件一律叫 `ICEImageView`。
|
|
8
|
+
*
|
|
9
|
+
* - 适配模式 `fill`(拉伸)/ `contain`(留白)/ `cover`(裁剪填满,居中);
|
|
10
|
+
* - 原始尺寸未知时先按容器盒铺满,图片载入后由引擎的 ImageCache 回调重排;
|
|
11
|
+
* - 视口开 `clipChildren`,cover 溢出的部分被裁掉;
|
|
12
|
+
* - 载入失败标记错误态(保留占位底)。
|
|
13
|
+
*/
|
|
14
|
+
export declare type ICEImageFit = 'fill' | 'contain' | 'cover';
|
|
15
|
+
export interface ICEImageOptions {
|
|
16
|
+
/** 组件 id(引擎会用它做唯一标识,e2e/调试时可按 id 定位) */
|
|
17
|
+
id?: string;
|
|
18
|
+
src?: string;
|
|
19
|
+
width?: number;
|
|
20
|
+
height?: number;
|
|
21
|
+
fit?: ICEImageFit;
|
|
22
|
+
/** 底衬颜色(未加载 / 加载失败时可见) */
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
left?: number;
|
|
25
|
+
top?: number;
|
|
26
|
+
}
|
|
27
|
+
export interface ICEImageContentBox {
|
|
28
|
+
left: number;
|
|
29
|
+
top: number;
|
|
30
|
+
width: number;
|
|
31
|
+
height: number;
|
|
32
|
+
}
|
|
33
|
+
export declare class ICEImageView extends ICEWidget {
|
|
34
|
+
private src;
|
|
35
|
+
private fit;
|
|
36
|
+
private natural;
|
|
37
|
+
private errored;
|
|
38
|
+
private viewport;
|
|
39
|
+
private imageNode;
|
|
40
|
+
private hookedSrc;
|
|
41
|
+
constructor(props?: ICEImageOptions);
|
|
42
|
+
protected afterAddHandler(): void;
|
|
43
|
+
/** 按 fill/contain/cover 计算内容矩形(原始尺寸未知时铺满容器盒)。 */
|
|
44
|
+
static computeFit(naturalWidth: number, naturalHeight: number, boxWidth: number, boxHeight: number, fit: ICEImageFit): ICEImageContentBox;
|
|
45
|
+
getSrc(): string;
|
|
46
|
+
setSrc(src: string): this;
|
|
47
|
+
getFit(): ICEImageFit;
|
|
48
|
+
setFit(fit: ICEImageFit): this;
|
|
49
|
+
isLoaded(): boolean;
|
|
50
|
+
isErrored(): boolean;
|
|
51
|
+
markError(): this;
|
|
52
|
+
/** 已知原始尺寸时直接设定(图片 onload 回调 / 单测使用)。 */
|
|
53
|
+
setNaturalSize(width: number, height: number): this;
|
|
54
|
+
getContentBox(): ICEImageContentBox;
|
|
55
|
+
getViewportNode(): ICEWidget | null;
|
|
56
|
+
getImageNode(): EngineImage | null;
|
|
57
|
+
private __render;
|
|
58
|
+
private __layout;
|
|
59
|
+
private __computeContentBox;
|
|
60
|
+
/** 图片就绪后按原始尺寸重排(引擎 ImageCache 负责真实加载)。 */
|
|
61
|
+
private __syncFromCache;
|
|
62
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ICEWidget } from '../core/ICEWidget';
|
|
2
|
+
import { ICEButton } from './ICEButton';
|
|
3
|
+
/**
|
|
4
|
+
* 数字输入框(Ant InputNumber / Swing JSpinner 的最小版)。
|
|
5
|
+
*
|
|
6
|
+
* - 左右步进按钮 + 键盘 ↑/↓ 步进,按 min/max 夹取,结果按 precision 取整;
|
|
7
|
+
* - 支持直接输入数字(数字键 / 小数点 / 负号 / Backspace);
|
|
8
|
+
* - 表单集成:`getFormValue` / `setFormValue`,错误态边框标红。
|
|
9
|
+
*/
|
|
10
|
+
export interface ICEInputNumberOptions {
|
|
11
|
+
/** 组件 id(引擎会用它做唯一标识,e2e/调试时可按 id 定位) */
|
|
12
|
+
id?: string;
|
|
13
|
+
value?: number;
|
|
14
|
+
min?: number;
|
|
15
|
+
max?: number;
|
|
16
|
+
step?: number;
|
|
17
|
+
precision?: number;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
left?: number;
|
|
20
|
+
top?: number;
|
|
21
|
+
width?: number;
|
|
22
|
+
height?: number;
|
|
23
|
+
onChange?: (value: number) => void;
|
|
24
|
+
}
|
|
25
|
+
export declare class ICEInputNumber extends ICEWidget {
|
|
26
|
+
private currentValue;
|
|
27
|
+
private min;
|
|
28
|
+
private max;
|
|
29
|
+
private step;
|
|
30
|
+
private precision;
|
|
31
|
+
private disabled;
|
|
32
|
+
private onChange;
|
|
33
|
+
private textLabel;
|
|
34
|
+
private decreaseButton;
|
|
35
|
+
private increaseButton;
|
|
36
|
+
private buffer;
|
|
37
|
+
private running;
|
|
38
|
+
constructor(props?: ICEInputNumberOptions);
|
|
39
|
+
protected afterAddHandler(): void;
|
|
40
|
+
getValue(): number;
|
|
41
|
+
setValue(value: number): this;
|
|
42
|
+
getFormValue(): any;
|
|
43
|
+
setFormValue(value: any): void;
|
|
44
|
+
getText(): string;
|
|
45
|
+
getIncreaseButton(): ICEButton | null;
|
|
46
|
+
getDecreaseButton(): ICEButton | null;
|
|
47
|
+
setEnabled(enabled: boolean): this;
|
|
48
|
+
private __applyValue;
|
|
49
|
+
private __stepBy;
|
|
50
|
+
private __onKeyDown;
|
|
51
|
+
private __clamp;
|
|
52
|
+
private __format;
|
|
53
|
+
private __render;
|
|
54
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { ICEWidget } from '../core/ICEWidget';
|
|
2
|
+
/**
|
|
3
|
+
* 看板:列 + 卡片,卡片可以**跨列拖拽**(CRM / 项目管理最常见的那块界面)。
|
|
4
|
+
*
|
|
5
|
+
* 结构很直白:
|
|
6
|
+
* ```
|
|
7
|
+
* ICEKanban
|
|
8
|
+
* ├── column[todo] ← 列标题 + 卡片(等距竖排)
|
|
9
|
+
* ├── column[doing]
|
|
10
|
+
* └── column[done]
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* 拖拽的「落点」复用列表那套:列由指针的 **x** 决定,列内插入位置由 **y** 决定
|
|
14
|
+
* (`computeDropTarget` 的上下半格语义),真正的数据搬运交给纯函数 `moveKanbanCard`。
|
|
15
|
+
*/
|
|
16
|
+
export interface ICEKanbanCard {
|
|
17
|
+
key: string;
|
|
18
|
+
title: string;
|
|
19
|
+
[field: string]: any;
|
|
20
|
+
}
|
|
21
|
+
export interface ICEKanbanColumn {
|
|
22
|
+
key: string;
|
|
23
|
+
title: string;
|
|
24
|
+
cards: ICEKanbanCard[];
|
|
25
|
+
[field: string]: any;
|
|
26
|
+
}
|
|
27
|
+
export interface ICEKanbanDropTarget {
|
|
28
|
+
columnKey: string;
|
|
29
|
+
index: number;
|
|
30
|
+
position: 'before' | 'after';
|
|
31
|
+
}
|
|
32
|
+
export interface ICEKanbanOptions {
|
|
33
|
+
id?: string;
|
|
34
|
+
left?: number;
|
|
35
|
+
top?: number;
|
|
36
|
+
width?: number;
|
|
37
|
+
height?: number;
|
|
38
|
+
columns: ICEKanbanColumn[];
|
|
39
|
+
columnWidth?: number;
|
|
40
|
+
cardHeight?: number;
|
|
41
|
+
gap?: number;
|
|
42
|
+
draggable?: boolean;
|
|
43
|
+
onCardMove?: (info: {
|
|
44
|
+
cardKey: string;
|
|
45
|
+
columnKey: string;
|
|
46
|
+
index: number;
|
|
47
|
+
columns: ICEKanbanColumn[];
|
|
48
|
+
}) => void;
|
|
49
|
+
[key: string]: any;
|
|
50
|
+
}
|
|
51
|
+
export declare class ICEKanban extends ICEWidget {
|
|
52
|
+
private columns;
|
|
53
|
+
private columnWidth;
|
|
54
|
+
private cardHeight;
|
|
55
|
+
private gap;
|
|
56
|
+
private draggable;
|
|
57
|
+
private onCardMove;
|
|
58
|
+
private cardNodes;
|
|
59
|
+
private columnNodes;
|
|
60
|
+
private dragState;
|
|
61
|
+
private __bound;
|
|
62
|
+
private running;
|
|
63
|
+
constructor(props: ICEKanbanOptions);
|
|
64
|
+
protected afterAddHandler(): void;
|
|
65
|
+
getColumns(): ICEKanbanColumn[];
|
|
66
|
+
getCardNode(key: string): ICEWidget | null;
|
|
67
|
+
getColumnNode(key: string): ICEWidget | null;
|
|
68
|
+
isDraggable(): boolean;
|
|
69
|
+
isDragging(): boolean;
|
|
70
|
+
getDropTarget(): ICEKanbanDropTarget | null;
|
|
71
|
+
/** 把卡片移到目标列的指定位置;真的动了才返回 true(判定见纯函数 `moveKanbanCard`)。 */
|
|
72
|
+
moveCard(cardKey: string, columnKey: string, index: number): boolean;
|
|
73
|
+
private __columnX;
|
|
74
|
+
private __cardY;
|
|
75
|
+
private __render;
|
|
76
|
+
private __localPoint;
|
|
77
|
+
private __columnIndexAt;
|
|
78
|
+
/** 指针 → 落点:x 定列,y 定列内插入位置(上下半格沿用列表那套)。 */
|
|
79
|
+
private __targetAt;
|
|
80
|
+
private __onMouseDown;
|
|
81
|
+
private __onMouseMove;
|
|
82
|
+
private __onMouseUp;
|
|
83
|
+
private __hideIndicators;
|
|
84
|
+
private __updateDrag;
|
|
85
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ICEWidget } from '../core/ICEWidget';
|
|
2
|
+
/**
|
|
3
|
+
* 文本标签:包装引擎 `ICEText`,支持水平(`align`)与垂直(`verticalAlign`)对齐;
|
|
4
|
+
* 未显式给尺寸时采用文字的实测尺寸,便于参与流式/盒式布局。
|
|
5
|
+
*/
|
|
6
|
+
export declare class ICELabel extends ICEWidget {
|
|
7
|
+
private textNode;
|
|
8
|
+
constructor(props?: any);
|
|
9
|
+
setText(text: string): this;
|
|
10
|
+
getText(): string;
|
|
11
|
+
/**
|
|
12
|
+
* 让标签自身占据文字的实测尺寸。
|
|
13
|
+
*
|
|
14
|
+
* ICEText 会把自身宽高自动调成实测值,而 ICELabel 只是它的一层包装容器:调用方不显式给尺寸时,
|
|
15
|
+
* ICELabel 会停在 ICERect 的默认 10×10 —— 布局管理器(ICEFlowLayout / ICEBoxLayout 读的都是
|
|
16
|
+
* 子项的 `state.width/height`)于是不为文字留空间,表现为「标题和后面的按钮叠在一起」
|
|
17
|
+
* (流式布局里「标题压住后面的按钮」就是这么来的)。
|
|
18
|
+
*
|
|
19
|
+
* 调用方显式传了 width/height 时不覆盖,沿用引擎里「默认值 10 视为未设置」的约定。
|
|
20
|
+
*/
|
|
21
|
+
private __adoptTextSize;
|
|
22
|
+
/**
|
|
23
|
+
* @overwrite
|
|
24
|
+
* 标签的首选尺寸就是文字的实测尺寸。不覆盖的话会落到 `ICEGroup.getPreferredSize()` 的
|
|
25
|
+
* `[0, 0]`(没有 layoutManager 时),按首选尺寸排布的调用方同样拿不到正确宽度。
|
|
26
|
+
*/
|
|
27
|
+
getPreferredSize(): [number, number];
|
|
28
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ICEWidget } from '../core/ICEWidget';
|
|
2
|
+
import { ICEScrollPane } from './ICEScrollPane';
|
|
3
|
+
import { ICESelectionModel, ICESelectionMode } from '../model/ICESelectionModel';
|
|
4
|
+
/**
|
|
5
|
+
* 列表(Swing JList / Ant List 的最小版)。
|
|
6
|
+
*
|
|
7
|
+
* - 选择逻辑在 `ICESelectionModel` 里(single 替换 / multiple 切换),组件只负责渲染与交互;
|
|
8
|
+
* - 内容高于可视高度时自动套一层 `ICEScrollPane`(复用 A2 的滚动底座与子树裁剪);
|
|
9
|
+
* - 交互:点击行选中(disabled 行忽略);焦点在列表上时 ↑/↓ 移动激活行(跳过 disabled)、
|
|
10
|
+
* Enter/Space 选中激活行。
|
|
11
|
+
*/
|
|
12
|
+
export interface ICEListItem {
|
|
13
|
+
key: string;
|
|
14
|
+
label: string;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface ICEListOptions {
|
|
18
|
+
/** 组件 id(引擎会用它做唯一标识,e2e/调试时可按 id 定位) */
|
|
19
|
+
id?: string;
|
|
20
|
+
items: ICEListItem[];
|
|
21
|
+
mode?: ICESelectionMode;
|
|
22
|
+
value?: string[];
|
|
23
|
+
left?: number;
|
|
24
|
+
top?: number;
|
|
25
|
+
width?: number;
|
|
26
|
+
height?: number;
|
|
27
|
+
itemHeight?: number;
|
|
28
|
+
onChange?: (keys: string[], item?: ICEListItem) => void;
|
|
29
|
+
}
|
|
30
|
+
export declare class ICEList extends ICEWidget {
|
|
31
|
+
private items;
|
|
32
|
+
private model;
|
|
33
|
+
private itemHeight;
|
|
34
|
+
private onChange;
|
|
35
|
+
private pane;
|
|
36
|
+
private content;
|
|
37
|
+
private rowNodes;
|
|
38
|
+
private activeIndex;
|
|
39
|
+
private running;
|
|
40
|
+
constructor(props: ICEListOptions);
|
|
41
|
+
protected afterAddHandler(): void;
|
|
42
|
+
getSelectedKeys(): string[];
|
|
43
|
+
setSelectedKeys(keys: string[]): this;
|
|
44
|
+
getSelectionModel(): ICESelectionModel;
|
|
45
|
+
getActiveIndex(): number;
|
|
46
|
+
getRowNode(key: string): ICEWidget | null;
|
|
47
|
+
getScrollPane(): ICEScrollPane | null;
|
|
48
|
+
getItems(): ICEListItem[];
|
|
49
|
+
setItems(items: ICEListItem[]): this;
|
|
50
|
+
/** 宽度变化时重排行宽(引擎只回调 __afterStateMerge,不调 revalidate)。 */
|
|
51
|
+
protected __afterStateMerge(sizeChanged: boolean): void;
|
|
52
|
+
/** 焦点在列表上时才处理方向键/Enter(避免抢走页面按键)。 */
|
|
53
|
+
private __onKeyDown;
|
|
54
|
+
private __moveActive;
|
|
55
|
+
private __pick;
|
|
56
|
+
private __render;
|
|
57
|
+
/** 重建行(选中态 / 激活态 / 禁用态)。 */
|
|
58
|
+
private __syncRows;
|
|
59
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ICEContainer } from '../core/ICEContainer';
|
|
2
|
+
export declare type ICEMenuItem = {
|
|
3
|
+
key: string;
|
|
4
|
+
label: string;
|
|
5
|
+
icon?: string;
|
|
6
|
+
iconPath?: string;
|
|
7
|
+
/** 子菜单:带非空 children 的项是父节点(内联展开,点它不触发 onSelect) */
|
|
8
|
+
children?: ICEMenuItem[];
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* 菜单:菜单项 +(可选)子菜单内联展开;选中态与悬停态分离,父项在子项选中时只做“当前分组”提示。
|
|
12
|
+
*/
|
|
13
|
+
export declare class ICEMenu extends ICEContainer {
|
|
14
|
+
private items;
|
|
15
|
+
/** 扁平化后的可见行(展开的父节点后紧跟其子项) */
|
|
16
|
+
private rows;
|
|
17
|
+
/** 鼠标悬停的项(仅视觉反馈,不影响选中) */
|
|
18
|
+
private hoverKey;
|
|
19
|
+
private expanded;
|
|
20
|
+
private itemPanels;
|
|
21
|
+
private itemNodes;
|
|
22
|
+
private itemIcons;
|
|
23
|
+
private selectedKey;
|
|
24
|
+
private itemHeight;
|
|
25
|
+
private onSelect;
|
|
26
|
+
private __bound;
|
|
27
|
+
constructor(props?: any);
|
|
28
|
+
setSelectedKey(key: string | null): this;
|
|
29
|
+
getSelectedKey(): string | null;
|
|
30
|
+
/** 可见行(展开状态下的扁平列表)。 */
|
|
31
|
+
getVisibleItems(): ICEMenuItem[];
|
|
32
|
+
getItemNode(key: string): any;
|
|
33
|
+
isExpanded(key: string): boolean;
|
|
34
|
+
toggleExpand(key: string): this;
|
|
35
|
+
setExpandedKeys(keys: string[]): this;
|
|
36
|
+
/** 激活某个可见项:父节点展开/收起,叶子项选中并回调。 */
|
|
37
|
+
activateItem(key: string): this;
|
|
38
|
+
private __hasChildren;
|
|
39
|
+
/** 按展开状态把树拍平。 */
|
|
40
|
+
private __flatten;
|
|
41
|
+
protected afterAddHandler(): void;
|
|
42
|
+
private __bindGlobalEvents;
|
|
43
|
+
private __onGlobalMouseDown;
|
|
44
|
+
private __render;
|
|
45
|
+
private __syncSelection;
|
|
46
|
+
/** 从根走到目标项,返回途中经过的父节点 key(不含自身)。 */
|
|
47
|
+
private __ancestorKeys;
|
|
48
|
+
}
|