@ccn-ui-kit/button 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -0
- package/dist/index.js +52 -0
- package/dist/packages/components/__tests__/loading.spec.d.ts +1 -0
- package/dist/packages/components/badge/index.d.ts +10 -0
- package/dist/packages/components/badge/src/badge.d.ts +25 -0
- package/dist/packages/components/breadcrumb/index.d.ts +12 -0
- package/dist/packages/components/breadcrumb/src/breadcrumb-item.d.ts +13 -0
- package/dist/packages/components/breadcrumb/src/breadcrumb.d.ts +10 -0
- package/dist/packages/components/button/index.d.ts +10 -0
- package/dist/packages/components/button/src/button.d.ts +25 -0
- package/dist/packages/components/button/src/button.vue.d.ts +57 -0
- package/dist/packages/components/date-picker/index.d.ts +10 -0
- package/dist/packages/components/date-picker/src/date-picker.d.ts +20 -0
- package/dist/packages/components/descriptions/index.d.ts +12 -0
- package/dist/packages/components/descriptions/src/descriptions-item.d.ts +13 -0
- package/dist/packages/components/descriptions/src/descriptions.d.ts +17 -0
- package/dist/packages/components/divider/index.d.ts +10 -0
- package/dist/packages/components/divider/src/divider.d.ts +20 -0
- package/dist/packages/components/dropdown/index.d.ts +12 -0
- package/dist/packages/components/dropdown/src/dropdown-item.d.ts +20 -0
- package/dist/packages/components/dropdown/src/dropdown.d.ts +46 -0
- package/dist/packages/components/form/index.d.ts +12 -0
- package/dist/packages/components/form/src/form-item.d.ts +45 -0
- package/dist/packages/components/form/src/form.d.ts +96 -0
- package/dist/packages/components/icon/index.d.ts +11 -0
- package/dist/packages/components/icon/src/icon.d.ts +18 -0
- package/dist/packages/components/icon/src/icons.d.ts +50 -0
- package/dist/packages/components/input/index.d.ts +10 -0
- package/dist/packages/components/input/src/input.d.ts +25 -0
- package/dist/packages/components/link/index.d.ts +10 -0
- package/dist/packages/components/link/src/link.d.ts +25 -0
- package/dist/packages/components/loading/index.d.ts +10 -0
- package/dist/packages/components/loading/src/loading.d.ts +15 -0
- package/dist/packages/components/menu/index.d.ts +14 -0
- package/dist/packages/components/menu/src/menu-item.d.ts +12 -0
- package/dist/packages/components/menu/src/menu.d.ts +40 -0
- package/dist/packages/components/menu/src/sub-menu.d.ts +12 -0
- package/dist/packages/components/message/index.d.ts +12 -0
- package/dist/packages/components/message/src/manager.d.ts +14 -0
- package/dist/packages/components/message/src/message.d.ts +28 -0
- package/dist/packages/components/modal/index.d.ts +10 -0
- package/dist/packages/components/modal/src/modal.d.ts +46 -0
- package/dist/packages/components/notification/index.d.ts +12 -0
- package/dist/packages/components/notification/src/manager.d.ts +14 -0
- package/dist/packages/components/notification/src/notification.d.ts +44 -0
- package/dist/packages/components/pagination/index.d.ts +10 -0
- package/dist/packages/components/pagination/src/pagination.d.ts +30 -0
- package/dist/packages/components/popconfirm/index.d.ts +10 -0
- package/dist/packages/components/popconfirm/src/popconfirm.d.ts +56 -0
- package/dist/packages/components/rich-editor/index.d.ts +10 -0
- package/dist/packages/components/rich-editor/src/rich-editor.d.ts +36 -0
- package/dist/packages/components/select/index.d.ts +10 -0
- package/dist/packages/components/select/src/select.d.ts +45 -0
- package/dist/packages/components/space/index.d.ts +10 -0
- package/dist/packages/components/space/src/space.d.ts +33 -0
- package/dist/packages/components/steps/index.d.ts +12 -0
- package/dist/packages/components/steps/src/step.d.ts +28 -0
- package/dist/packages/components/steps/src/steps.d.ts +46 -0
- package/dist/packages/components/table/index.d.ts +10 -0
- package/dist/packages/components/table/src/table.d.ts +56 -0
- package/dist/packages/components/tabs/index.d.ts +12 -0
- package/dist/packages/components/tabs/src/tab-pane.d.ts +22 -0
- package/dist/packages/components/tabs/src/tabs.d.ts +43 -0
- package/dist/packages/components/tree/index.d.ts +10 -0
- package/dist/packages/components/tree/src/tree.d.ts +134 -0
- package/dist/packages/components/upload/index.d.ts +10 -0
- package/dist/packages/components/upload/src/upload.d.ts +103 -0
- package/dist/packages/directives/index.d.ts +2 -0
- package/dist/packages/directives/loading/index.d.ts +11 -0
- package/dist/packages/directives/permission/index.d.ts +3 -0
- package/dist/packages/ui-kit/index.d.ts +34 -0
- package/dist/packages/utils/dom.d.ts +5 -0
- package/dist/packages/utils/index.d.ts +3 -0
- package/dist/packages/utils/types.d.ts +7 -0
- package/dist/packages/utils/vue-helper.d.ts +9 -0
- package/dist/play/main.d.ts +1 -0
- package/dist/play/vite.config.d.ts +2 -0
- package/package.json +27 -0
- package/style/index.scss +21 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ExtractPropTypes, PropType, VNode } from 'vue';
|
|
2
|
+
|
|
3
|
+
export type SpaceDirection = 'horizontal' | 'vertical';
|
|
4
|
+
export type SpaceAlign = 'start' | 'center' | 'end' | 'baseline' | 'stretch';
|
|
5
|
+
/** 数字为 px;字符串可为 'small' | 'default' | 'large' 或带单位值(如 '12px');数组为 [横向, 纵向] */
|
|
6
|
+
export type SpaceSize = number | string | [number | string, number | string];
|
|
7
|
+
export declare const spaceProps: {
|
|
8
|
+
/** 间距,见 SpaceSize */
|
|
9
|
+
readonly size: {
|
|
10
|
+
readonly type: PropType<SpaceSize>;
|
|
11
|
+
readonly default: 8;
|
|
12
|
+
};
|
|
13
|
+
/** 排列方向 */
|
|
14
|
+
readonly direction: {
|
|
15
|
+
readonly type: PropType<SpaceDirection>;
|
|
16
|
+
readonly default: "horizontal";
|
|
17
|
+
};
|
|
18
|
+
/** 交叉轴对齐方式 */
|
|
19
|
+
readonly align: {
|
|
20
|
+
readonly type: PropType<SpaceAlign>;
|
|
21
|
+
readonly default: "start";
|
|
22
|
+
};
|
|
23
|
+
/** 横向时是否允许换行 */
|
|
24
|
+
readonly wrap: BooleanConstructor;
|
|
25
|
+
/** 是否占满容器宽度并使子项均分 */
|
|
26
|
+
readonly fill: BooleanConstructor;
|
|
27
|
+
/** 子项之间的分隔元素,可为 '|' 等字符串或 VNode(如 <UiDivider direction="vertical" />) */
|
|
28
|
+
readonly spacer: {
|
|
29
|
+
readonly type: PropType<string | VNode>;
|
|
30
|
+
readonly default: undefined;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export type SpaceProps = ExtractPropTypes<typeof spaceProps>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { App } from 'vue';
|
|
2
|
+
import { default as Steps } from './src/steps.vue';
|
|
3
|
+
import { default as Step } from './src/step.vue';
|
|
4
|
+
|
|
5
|
+
export declare const StepsPlugin: {
|
|
6
|
+
name: string;
|
|
7
|
+
install(app: App): void;
|
|
8
|
+
};
|
|
9
|
+
export { Steps, Step };
|
|
10
|
+
export default Steps;
|
|
11
|
+
export * from './src/steps';
|
|
12
|
+
export * from './src/step';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
import { StepStatus } from './steps';
|
|
3
|
+
|
|
4
|
+
export declare const stepProps: {
|
|
5
|
+
/** 步骤标题 */
|
|
6
|
+
readonly title: {
|
|
7
|
+
readonly type: StringConstructor;
|
|
8
|
+
readonly default: "";
|
|
9
|
+
};
|
|
10
|
+
/** 步骤描述 */
|
|
11
|
+
readonly description: {
|
|
12
|
+
readonly type: StringConstructor;
|
|
13
|
+
readonly default: "";
|
|
14
|
+
};
|
|
15
|
+
/** 自定义图标名(复用 Icon 组件) */
|
|
16
|
+
readonly icon: {
|
|
17
|
+
readonly type: StringConstructor;
|
|
18
|
+
readonly default: "";
|
|
19
|
+
};
|
|
20
|
+
/** 覆盖由父级 active 推断出的状态 */
|
|
21
|
+
readonly status: {
|
|
22
|
+
readonly type: PropType<StepStatus>;
|
|
23
|
+
readonly default: undefined;
|
|
24
|
+
};
|
|
25
|
+
/** 是否禁用 */
|
|
26
|
+
readonly disabled: BooleanConstructor;
|
|
27
|
+
};
|
|
28
|
+
export type StepProps = ExtractPropTypes<typeof stepProps>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ExtractPropTypes, InjectionKey, PropType, Ref } from 'vue';
|
|
2
|
+
|
|
3
|
+
export type StepStatus = 'wait' | 'process' | 'finish' | 'error' | 'success';
|
|
4
|
+
export type StepsDirection = 'horizontal' | 'vertical';
|
|
5
|
+
export declare const stepsProps: {
|
|
6
|
+
/** 当前激活步骤下标(0 起,-1 表示全部处于等待) */
|
|
7
|
+
readonly active: {
|
|
8
|
+
readonly type: NumberConstructor;
|
|
9
|
+
readonly default: 0;
|
|
10
|
+
};
|
|
11
|
+
/** 排列方向 */
|
|
12
|
+
readonly direction: {
|
|
13
|
+
readonly type: PropType<StepsDirection>;
|
|
14
|
+
readonly default: "horizontal";
|
|
15
|
+
};
|
|
16
|
+
/** 当前激活步骤的状态 */
|
|
17
|
+
readonly processStatus: {
|
|
18
|
+
readonly type: PropType<StepStatus>;
|
|
19
|
+
readonly default: "process";
|
|
20
|
+
};
|
|
21
|
+
/** 已走过步骤的状态 */
|
|
22
|
+
readonly finishStatus: {
|
|
23
|
+
readonly type: PropType<StepStatus>;
|
|
24
|
+
readonly default: "finish";
|
|
25
|
+
};
|
|
26
|
+
/** 垂直方向时标题与描述是否居中 */
|
|
27
|
+
readonly alignCenter: BooleanConstructor;
|
|
28
|
+
};
|
|
29
|
+
export type StepsProps = ExtractPropTypes<typeof stepsProps>;
|
|
30
|
+
/** Step 自注册到 Steps 的状态(父级据以计算下标与总数) */
|
|
31
|
+
export interface StepState {
|
|
32
|
+
status?: StepStatus;
|
|
33
|
+
disabled: boolean;
|
|
34
|
+
}
|
|
35
|
+
/** 提供给 Step 的上下文 */
|
|
36
|
+
export interface StepsContext {
|
|
37
|
+
steps: Ref<StepState[]>;
|
|
38
|
+
active: Ref<number>;
|
|
39
|
+
direction: Ref<StepsDirection>;
|
|
40
|
+
processStatus: Ref<StepStatus>;
|
|
41
|
+
finishStatus: Ref<StepStatus>;
|
|
42
|
+
alignCenter: Ref<boolean>;
|
|
43
|
+
registerStep: (step: StepState) => void;
|
|
44
|
+
unregisterStep: (step: StepState) => void;
|
|
45
|
+
}
|
|
46
|
+
export declare const stepsContextKey: InjectionKey<StepsContext>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
|
|
3
|
+
/** 表格列配置 */
|
|
4
|
+
export interface UiTableColumn {
|
|
5
|
+
/** 列标题 */
|
|
6
|
+
label: string;
|
|
7
|
+
/** 对应数据字段 key(通过 data 行的该字段取值) */
|
|
8
|
+
prop?: string;
|
|
9
|
+
/** 列宽:数字按 px,字符串作为 CSS 长度(如 '20%') */
|
|
10
|
+
width?: string | number;
|
|
11
|
+
/** 单元格对齐方式 */
|
|
12
|
+
align?: 'left' | 'center' | 'right';
|
|
13
|
+
/** 自定义单元格内容插槽名(优先级最高,覆盖 formatter 与默认取值) */
|
|
14
|
+
slot?: string;
|
|
15
|
+
/** 自定义表头插槽名 */
|
|
16
|
+
headerSlot?: string;
|
|
17
|
+
/** 单元格格式化函数,返回 HTML 字符串 */
|
|
18
|
+
formatter?: (row: Record<string, unknown>, column: UiTableColumn, cellValue: unknown, index: number) => string;
|
|
19
|
+
/** 是否可排序:点击表头升序 → 降序 → 取消 */
|
|
20
|
+
sortable?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare const tableProps: {
|
|
23
|
+
/** 表格数据 */
|
|
24
|
+
readonly data: {
|
|
25
|
+
readonly type: PropType<Record<string, unknown>[]>;
|
|
26
|
+
readonly default: () => never[];
|
|
27
|
+
};
|
|
28
|
+
/** 列配置 */
|
|
29
|
+
readonly columns: {
|
|
30
|
+
readonly type: PropType<UiTableColumn[]>;
|
|
31
|
+
readonly default: () => never[];
|
|
32
|
+
};
|
|
33
|
+
/** 斑马纹行 */
|
|
34
|
+
readonly stripe: BooleanConstructor;
|
|
35
|
+
/** 纵向边框线 */
|
|
36
|
+
readonly border: BooleanConstructor;
|
|
37
|
+
/** 尺寸:large / medium / small */
|
|
38
|
+
readonly size: {
|
|
39
|
+
readonly type: StringConstructor;
|
|
40
|
+
readonly default: "medium";
|
|
41
|
+
};
|
|
42
|
+
/** 空数据文案 */
|
|
43
|
+
readonly emptyText: {
|
|
44
|
+
readonly type: StringConstructor;
|
|
45
|
+
readonly default: "暂无数据";
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
export declare const tableEmits: {
|
|
49
|
+
/** 排序状态变化:order 为 ascending / descending / null(取消排序) */
|
|
50
|
+
readonly 'sort-change': (payload: {
|
|
51
|
+
column: UiTableColumn;
|
|
52
|
+
prop: string;
|
|
53
|
+
order: "ascending" | "descending" | null;
|
|
54
|
+
}) => boolean;
|
|
55
|
+
};
|
|
56
|
+
export type TableProps = ExtractPropTypes<typeof tableProps>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { App } from 'vue';
|
|
2
|
+
import { default as Tabs } from './src/tabs.vue';
|
|
3
|
+
import { default as TabPane } from './src/tab-pane.vue';
|
|
4
|
+
|
|
5
|
+
export declare const TabsPlugin: {
|
|
6
|
+
name: string;
|
|
7
|
+
install(app: App): void;
|
|
8
|
+
};
|
|
9
|
+
export { Tabs, TabPane };
|
|
10
|
+
export default Tabs;
|
|
11
|
+
export * from './src/tabs';
|
|
12
|
+
export * from './src/tab-pane';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ExtractPropTypes } from 'vue';
|
|
2
|
+
|
|
3
|
+
export declare const tabPaneProps: {
|
|
4
|
+
/** 唯一标识,与 Tabs 的 v-model 对应 */
|
|
5
|
+
readonly name: {
|
|
6
|
+
readonly type: [StringConstructor, NumberConstructor];
|
|
7
|
+
readonly required: true;
|
|
8
|
+
};
|
|
9
|
+
/** 页签标题(可用 #label 插槽完全自定义) */
|
|
10
|
+
readonly label: {
|
|
11
|
+
readonly type: StringConstructor;
|
|
12
|
+
readonly default: "";
|
|
13
|
+
};
|
|
14
|
+
/** 是否禁用 */
|
|
15
|
+
readonly disabled: BooleanConstructor;
|
|
16
|
+
/** 是否显示关闭按钮:缺省继承 Tabs 的 closable */
|
|
17
|
+
readonly closable: {
|
|
18
|
+
readonly type: BooleanConstructor;
|
|
19
|
+
readonly default: undefined;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export type TabPaneProps = ExtractPropTypes<typeof tabPaneProps>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Component, ExtractPropTypes, InjectionKey, Ref } from 'vue';
|
|
2
|
+
|
|
3
|
+
export declare const tabsProps: {
|
|
4
|
+
/** 当前激活页签名(v-model) */
|
|
5
|
+
readonly modelValue: {
|
|
6
|
+
readonly type: [StringConstructor, NumberConstructor];
|
|
7
|
+
readonly default: "";
|
|
8
|
+
};
|
|
9
|
+
/** 页签类型:''(下划线) | card | border-card */
|
|
10
|
+
readonly type: {
|
|
11
|
+
readonly type: StringConstructor;
|
|
12
|
+
readonly default: "";
|
|
13
|
+
};
|
|
14
|
+
/** 全局默认是否可关闭(TabPane 可用 closable 单独覆盖) */
|
|
15
|
+
readonly closable: BooleanConstructor;
|
|
16
|
+
};
|
|
17
|
+
export declare const tabsEmits: {
|
|
18
|
+
'update:modelValue': (name: string | number) => boolean;
|
|
19
|
+
/** 点击页签时触发,参数为页签名 */
|
|
20
|
+
'tab-click': (name: string | number) => boolean;
|
|
21
|
+
/** 点击关闭按钮时触发,由外部负责移除对应数据 */
|
|
22
|
+
'tab-remove': (name: string | number) => boolean;
|
|
23
|
+
};
|
|
24
|
+
export type TabsProps = ExtractPropTypes<typeof tabsProps>;
|
|
25
|
+
/** TabPane 注册到 Tabs 时的页签状态 */
|
|
26
|
+
export interface PaneState {
|
|
27
|
+
name: string | number;
|
|
28
|
+
label: string;
|
|
29
|
+
disabled: boolean;
|
|
30
|
+
/** 是否可关闭:缺省继承 Tabs 的 closable */
|
|
31
|
+
closable?: boolean;
|
|
32
|
+
/** 自定义页签头渲染(TabPane 的 #label 插槽) */
|
|
33
|
+
labelSlot?: Component;
|
|
34
|
+
}
|
|
35
|
+
/** 提供给 TabPane 的上下文 */
|
|
36
|
+
export interface TabsContext {
|
|
37
|
+
activeName: Ref<string | number>;
|
|
38
|
+
type: string;
|
|
39
|
+
closable: boolean;
|
|
40
|
+
registerPane: (pane: PaneState) => void;
|
|
41
|
+
unregisterPane: (name: string | number) => void;
|
|
42
|
+
}
|
|
43
|
+
export declare const tabsContextKey: InjectionKey<TabsContext>;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { ComputedRef, ExtractPropTypes, InjectionKey, PropType, Ref } from 'vue';
|
|
2
|
+
|
|
3
|
+
/** 树节点原始数据(字段名可用 props 配置) */
|
|
4
|
+
export interface TreeData {
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
children?: TreeData[];
|
|
7
|
+
}
|
|
8
|
+
/** 节点字段映射配置 */
|
|
9
|
+
export interface TreePropsConfig {
|
|
10
|
+
/** 节点显示文案字段 */
|
|
11
|
+
label?: string;
|
|
12
|
+
/** 子节点数组字段 */
|
|
13
|
+
children?: string;
|
|
14
|
+
/** 禁用字段 */
|
|
15
|
+
disabled?: string;
|
|
16
|
+
/** 叶子标记字段(配合 lazy 使用) */
|
|
17
|
+
isLeaf?: string;
|
|
18
|
+
/** 节点唯一键字段 */
|
|
19
|
+
key?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare const defaultTreePropsConfig: TreePropsConfig;
|
|
22
|
+
/** 节点唯一键(统一为 string | number) */
|
|
23
|
+
export type KeyType = string | number;
|
|
24
|
+
/** 组件内部使用的树节点模型(由 data 构建,含父/子引用与层级) */
|
|
25
|
+
export interface TreeNode {
|
|
26
|
+
key: KeyType;
|
|
27
|
+
data: TreeData;
|
|
28
|
+
parent: TreeNode | null;
|
|
29
|
+
children: TreeNode[];
|
|
30
|
+
level: number;
|
|
31
|
+
isLeaf: boolean;
|
|
32
|
+
isLazy: boolean;
|
|
33
|
+
path: string;
|
|
34
|
+
}
|
|
35
|
+
/** 懒加载参数:根节点 load 时 node 为 null */
|
|
36
|
+
export interface TreeNodeLoadArg {
|
|
37
|
+
key: KeyType;
|
|
38
|
+
level: number;
|
|
39
|
+
data: TreeData;
|
|
40
|
+
}
|
|
41
|
+
export type TreeNodeLoader = (node: TreeNodeLoadArg | null, resolve: (children: TreeData[]) => void) => void;
|
|
42
|
+
export declare const treeProps: {
|
|
43
|
+
/** 树数据 */
|
|
44
|
+
readonly data: {
|
|
45
|
+
readonly type: PropType<TreeData[]>;
|
|
46
|
+
readonly default: () => never[];
|
|
47
|
+
};
|
|
48
|
+
/** 字段映射:{ label, children, disabled, isLeaf, key },缺省用默认字段名 */
|
|
49
|
+
readonly props: {
|
|
50
|
+
readonly type: PropType<TreePropsConfig>;
|
|
51
|
+
readonly default: () => {};
|
|
52
|
+
};
|
|
53
|
+
/** 节点唯一键字段,缺省取 props.key */
|
|
54
|
+
readonly nodeKey: {
|
|
55
|
+
readonly type: StringConstructor;
|
|
56
|
+
readonly default: "";
|
|
57
|
+
};
|
|
58
|
+
/** 是否展示复选框 */
|
|
59
|
+
readonly showCheckbox: BooleanConstructor;
|
|
60
|
+
/** 勾选是否严格(父子不联动,仅影响复选框) */
|
|
61
|
+
readonly checkStrictly: BooleanConstructor;
|
|
62
|
+
/** 默认展开所有节点 */
|
|
63
|
+
readonly defaultExpandAll: BooleanConstructor;
|
|
64
|
+
/** 默认展开的节点 key 列表 */
|
|
65
|
+
readonly defaultExpandedKeys: {
|
|
66
|
+
readonly type: PropType<KeyType[]>;
|
|
67
|
+
readonly default: () => never[];
|
|
68
|
+
};
|
|
69
|
+
/** 初始勾选的节点 key 列表(可在外部用 ref.setCheckedKeys 再控制) */
|
|
70
|
+
readonly defaultCheckedKeys: {
|
|
71
|
+
readonly type: PropType<KeyType[]>;
|
|
72
|
+
readonly default: () => never[];
|
|
73
|
+
};
|
|
74
|
+
/** 点击节点是否展开/收起(默认 true) */
|
|
75
|
+
readonly expandOnClickNode: {
|
|
76
|
+
readonly type: BooleanConstructor;
|
|
77
|
+
readonly default: true;
|
|
78
|
+
};
|
|
79
|
+
/** 当前选中节点 key(v-model:current-node-key) */
|
|
80
|
+
readonly currentNodeKey: {
|
|
81
|
+
readonly type: [StringConstructor, NumberConstructor];
|
|
82
|
+
readonly default: null;
|
|
83
|
+
};
|
|
84
|
+
/** 懒加载(需配合 load 使用) */
|
|
85
|
+
readonly lazy: BooleanConstructor;
|
|
86
|
+
/** 懒加载函数:(node, resolve) => void */
|
|
87
|
+
readonly load: {
|
|
88
|
+
readonly type: PropType<TreeNodeLoader>;
|
|
89
|
+
readonly default: undefined;
|
|
90
|
+
};
|
|
91
|
+
/** 空数据提示文案 */
|
|
92
|
+
readonly emptyText: {
|
|
93
|
+
readonly type: StringConstructor;
|
|
94
|
+
readonly default: "暂无数据";
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
export declare const treeEmits: {
|
|
98
|
+
'update:current-node-key': null;
|
|
99
|
+
'update:checked-keys': null;
|
|
100
|
+
/** 点击节点:node / data / 原生事件 */
|
|
101
|
+
'node-click': (node: TreeNode, data: TreeData, e: MouseEvent) => boolean;
|
|
102
|
+
/** 节点展开 */
|
|
103
|
+
'node-expand': () => boolean;
|
|
104
|
+
/** 节点收起 */
|
|
105
|
+
'node-collapse': () => boolean;
|
|
106
|
+
/** 复选框勾选状态改变 */
|
|
107
|
+
check: (node: TreeNode, data: TreeData) => boolean;
|
|
108
|
+
/** 节点勾选状态变化(含级联影响的节点) */
|
|
109
|
+
'check-change': (node: TreeNode, data: TreeData, checked: boolean) => boolean;
|
|
110
|
+
/** 右键节点 */
|
|
111
|
+
'node-contextmenu': (e: MouseEvent, data: TreeData, node: TreeNode) => boolean;
|
|
112
|
+
};
|
|
113
|
+
export type TreeProps = ExtractPropTypes<typeof treeProps>;
|
|
114
|
+
/** 提供给内部 UiTreeNode 的共享上下文 */
|
|
115
|
+
export interface TreeContext {
|
|
116
|
+
config: ComputedRef<Required<TreePropsConfig>>;
|
|
117
|
+
nodeKeyField: ComputedRef<string>;
|
|
118
|
+
expandedKeys: Ref<Set<KeyType>>;
|
|
119
|
+
checkedKeys: Ref<Set<KeyType>>;
|
|
120
|
+
halfCheckedKeys: Ref<Set<KeyType>>;
|
|
121
|
+
selectedKey: Ref<KeyType | null>;
|
|
122
|
+
loadingKeys: Ref<Set<KeyType>>;
|
|
123
|
+
showCheckbox: ComputedRef<boolean>;
|
|
124
|
+
checkStrictly: ComputedRef<boolean>;
|
|
125
|
+
expandOnClickNode: ComputedRef<boolean>;
|
|
126
|
+
lazy: ComputedRef<boolean>;
|
|
127
|
+
isDisabledNode: (node: TreeNode) => boolean;
|
|
128
|
+
toggleExpand: (node: TreeNode) => void;
|
|
129
|
+
handleNodeClick: (node: TreeNode, data: TreeData, e: MouseEvent) => void;
|
|
130
|
+
handleNodeContextMenu: (node: TreeNode, data: TreeData, e: MouseEvent) => void;
|
|
131
|
+
toggleCheck: (node: TreeNode, data: TreeData) => void;
|
|
132
|
+
loadNodeData: (node: TreeNode) => void;
|
|
133
|
+
}
|
|
134
|
+
export declare const treeContextKey: InjectionKey<TreeContext>;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
|
|
3
|
+
/** 文件上传状态 */
|
|
4
|
+
export type UploadStatus = 'ready' | 'uploading' | 'success' | 'fail';
|
|
5
|
+
/** 文件列表展示类型 */
|
|
6
|
+
export type UploadListType = 'text' | 'picture' | 'picture-card';
|
|
7
|
+
/** 列表中的单个文件 */
|
|
8
|
+
export interface UploadFile {
|
|
9
|
+
/** 组件内唯一标识(新增时自增生成) */
|
|
10
|
+
uid: number;
|
|
11
|
+
/** 文件名 */
|
|
12
|
+
name: string;
|
|
13
|
+
/** 文件大小(字节) */
|
|
14
|
+
size: number;
|
|
15
|
+
/** MIME 类型 */
|
|
16
|
+
type: string;
|
|
17
|
+
/** 当前上传状态 */
|
|
18
|
+
status: UploadStatus;
|
|
19
|
+
/** 上传进度 0-100 */
|
|
20
|
+
percentage: number;
|
|
21
|
+
/** 原始 File 对象 */
|
|
22
|
+
raw: File;
|
|
23
|
+
/** 本地预览地址(仅图片,blob: URL) */
|
|
24
|
+
url?: string;
|
|
25
|
+
/** 上传成功/失败后的响应 */
|
|
26
|
+
response?: unknown;
|
|
27
|
+
}
|
|
28
|
+
export declare const uploadProps: {
|
|
29
|
+
/** 上传请求的 URL;留空时不发起请求,文件直接标记为成功(便于无后端演示) */
|
|
30
|
+
readonly action: {
|
|
31
|
+
readonly type: StringConstructor;
|
|
32
|
+
readonly default: "";
|
|
33
|
+
};
|
|
34
|
+
/** FormData 中文件字段的 key */
|
|
35
|
+
readonly name: {
|
|
36
|
+
readonly type: StringConstructor;
|
|
37
|
+
readonly default: "file";
|
|
38
|
+
};
|
|
39
|
+
/** 是否允许多选 */
|
|
40
|
+
readonly multiple: BooleanConstructor;
|
|
41
|
+
/** 原生 input 的 accept,如 'image/*'、'.zip,.rar' */
|
|
42
|
+
readonly accept: {
|
|
43
|
+
readonly type: StringConstructor;
|
|
44
|
+
readonly default: "";
|
|
45
|
+
};
|
|
46
|
+
/** 禁用上传 */
|
|
47
|
+
readonly disabled: BooleanConstructor;
|
|
48
|
+
/** 最大文件数,0 表示不限制 */
|
|
49
|
+
readonly limit: {
|
|
50
|
+
readonly type: NumberConstructor;
|
|
51
|
+
readonly default: 0;
|
|
52
|
+
};
|
|
53
|
+
/** 自定义请求头 */
|
|
54
|
+
readonly headers: {
|
|
55
|
+
readonly type: PropType<Record<string, string>>;
|
|
56
|
+
readonly default: () => {};
|
|
57
|
+
};
|
|
58
|
+
/** 附加的 FormData 字段 */
|
|
59
|
+
readonly data: {
|
|
60
|
+
readonly type: PropType<Record<string, unknown>>;
|
|
61
|
+
readonly default: () => {};
|
|
62
|
+
};
|
|
63
|
+
/** 跨域时是否携带 cookie */
|
|
64
|
+
readonly withCredentials: BooleanConstructor;
|
|
65
|
+
/** 是否支持拖拽上传(将触发器区域变成拖拽区) */
|
|
66
|
+
readonly drag: BooleanConstructor;
|
|
67
|
+
/** 选择文件后是否立即上传;false 时仅加入列表,等待手动触发 */
|
|
68
|
+
readonly autoUpload: {
|
|
69
|
+
readonly type: BooleanConstructor;
|
|
70
|
+
readonly default: true;
|
|
71
|
+
};
|
|
72
|
+
/** 是否展示文件列表 */
|
|
73
|
+
readonly showFileList: {
|
|
74
|
+
readonly type: BooleanConstructor;
|
|
75
|
+
readonly default: true;
|
|
76
|
+
};
|
|
77
|
+
/** 列表展示类型 */
|
|
78
|
+
readonly listType: {
|
|
79
|
+
readonly type: PropType<UploadListType>;
|
|
80
|
+
readonly default: "text";
|
|
81
|
+
};
|
|
82
|
+
/** 受控文件列表(配合 v-model:file-list 使用) */
|
|
83
|
+
readonly fileList: {
|
|
84
|
+
readonly type: PropType<UploadFile[]>;
|
|
85
|
+
readonly default: () => never[];
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
export declare const uploadEmits: {
|
|
89
|
+
readonly 'update:file-list': (files: UploadFile[]) => boolean;
|
|
90
|
+
/** 文件列表变化(新增 / 移除) */
|
|
91
|
+
readonly change: (files: UploadFile[]) => boolean;
|
|
92
|
+
/** 上传成功 */
|
|
93
|
+
readonly success: (file: UploadFile, response?: unknown) => boolean;
|
|
94
|
+
/** 上传失败 */
|
|
95
|
+
readonly error: (file: UploadFile, error: unknown) => boolean;
|
|
96
|
+
/** 上传进度 */
|
|
97
|
+
readonly progress: (file: UploadFile, percent: number) => boolean;
|
|
98
|
+
/** 移除文件 */
|
|
99
|
+
readonly remove: (file: UploadFile) => boolean;
|
|
100
|
+
/** 超出 limit 限制 */
|
|
101
|
+
readonly exceed: (files: File[], limit: number) => boolean;
|
|
102
|
+
};
|
|
103
|
+
export type UploadProps = ExtractPropTypes<typeof uploadProps>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { App } from 'vue';
|
|
2
|
+
|
|
3
|
+
export declare function install(app: App): void;
|
|
4
|
+
declare const _default: {
|
|
5
|
+
install: typeof install;
|
|
6
|
+
};
|
|
7
|
+
export default _default;
|
|
8
|
+
export * from '../components/button';
|
|
9
|
+
export * from '../components/input';
|
|
10
|
+
export * from '../components/badge';
|
|
11
|
+
export * from '../components/breadcrumb';
|
|
12
|
+
export * from '../components/date-picker';
|
|
13
|
+
export * from '../components/descriptions';
|
|
14
|
+
export * from '../components/divider';
|
|
15
|
+
export * from '../components/dropdown';
|
|
16
|
+
export * from '../components/icon';
|
|
17
|
+
export * from '../components/link';
|
|
18
|
+
export * from '../components/loading';
|
|
19
|
+
export * from '../components/menu';
|
|
20
|
+
export * from '../components/message';
|
|
21
|
+
export * from '../components/modal';
|
|
22
|
+
export * from '../components/notification';
|
|
23
|
+
export * from '../components/pagination';
|
|
24
|
+
export * from '../components/popconfirm';
|
|
25
|
+
export * from '../components/form';
|
|
26
|
+
export * from '../components/table';
|
|
27
|
+
export * from '../components/tree';
|
|
28
|
+
export * from '../components/tabs';
|
|
29
|
+
export * from '../components/rich-editor';
|
|
30
|
+
export * from '../components/select';
|
|
31
|
+
export * from '../components/space';
|
|
32
|
+
export * from '../components/steps';
|
|
33
|
+
export * from '../components/upload';
|
|
34
|
+
export * from '../directives';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function addClass(el: HTMLElement, cls: string): void;
|
|
2
|
+
export declare function removeClass(el: HTMLElement, cls: string): void;
|
|
3
|
+
export declare function hasClass(el: HTMLElement, cls: string): boolean;
|
|
4
|
+
export declare function getScrollTop(el?: Element | Window): number;
|
|
5
|
+
export declare function isServer(): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ccn-ui-kit/button",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/index.cjs",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"types": "dist/packages/components/button/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"style"
|
|
11
|
+
],
|
|
12
|
+
"sideEffects": [
|
|
13
|
+
"**/*.scss"
|
|
14
|
+
],
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./dist/packages/components/button/index.d.ts",
|
|
18
|
+
"import": "./dist/index.js",
|
|
19
|
+
"require": "./dist/index.cjs"
|
|
20
|
+
},
|
|
21
|
+
"./style": "./style/index.scss",
|
|
22
|
+
"./package.json": "./package.json"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"vue": "^3.4.0"
|
|
26
|
+
}
|
|
27
|
+
}
|