@manohub/app-kit 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/CONTRACT.md +592 -0
- package/README.md +27 -0
- package/dist/atoms/app-button.d.ts +90 -0
- package/dist/atoms/app-button.js +74 -0
- package/dist/atoms/app-checkbox.d.ts +86 -0
- package/dist/atoms/app-checkbox.js +78 -0
- package/dist/atoms/app-icon-button.d.ts +79 -0
- package/dist/atoms/app-icon-button.js +54 -0
- package/dist/atoms/app-input.d.ts +118 -0
- package/dist/atoms/app-input.js +83 -0
- package/dist/atoms/app-layout.d.ts +348 -0
- package/dist/atoms/app-layout.js +102 -0
- package/dist/atoms/app-notice.d.ts +90 -0
- package/dist/atoms/app-notice.js +59 -0
- package/dist/atoms/app-query-state.d.ts +191 -0
- package/dist/atoms/app-query-state.js +161 -0
- package/dist/atoms/app-radio-card.d.ts +80 -0
- package/dist/atoms/app-radio-card.js +72 -0
- package/dist/atoms/app-search-box.d.ts +80 -0
- package/dist/atoms/app-search-box.js +64 -0
- package/dist/atoms/app-select.d.ts +106 -0
- package/dist/atoms/app-select.js +74 -0
- package/dist/atoms/app-switch.d.ts +72 -0
- package/dist/atoms/app-switch.js +66 -0
- package/dist/atoms/app-textarea.d.ts +89 -0
- package/dist/atoms/app-textarea.js +61 -0
- package/dist/atoms/app-tooltip.d.ts +70 -0
- package/dist/atoms/app-tooltip.js +48 -0
- package/dist/atoms/atoms.css +679 -0
- package/dist/atoms/state-illustration.d.ts +21 -0
- package/dist/atoms/state-illustration.js +101 -0
- package/dist/components/app-badge.d.ts +72 -0
- package/dist/components/app-badge.js +40 -0
- package/dist/components/app-dialog.d.ts +164 -0
- package/dist/components/app-dialog.js +121 -0
- package/dist/components/app-filter.d.ts +173 -0
- package/dist/components/app-filter.js +200 -0
- package/dist/components/app-form.d.ts +446 -0
- package/dist/components/app-form.js +159 -0
- package/dist/components/app-pagination.d.ts +78 -0
- package/dist/components/app-pagination.js +57 -0
- package/dist/components/app-panel.d.ts +399 -0
- package/dist/components/app-panel.js +213 -0
- package/dist/components/app-section.d.ts +68 -0
- package/dist/components/app-section.js +28 -0
- package/dist/components/app-steps.d.ts +115 -0
- package/dist/components/app-steps.js +108 -0
- package/dist/components/app-table.d.ts +415 -0
- package/dist/components/app-table.js +479 -0
- package/dist/components/app-tabs.d.ts +58 -0
- package/dist/components/app-tabs.js +54 -0
- package/dist/components/app-tree.d.ts +273 -0
- package/dist/components/app-tree.js +222 -0
- package/dist/components/components.css +597 -0
- package/dist/composables/use-client-pagination.d.ts +39 -0
- package/dist/composables/use-client-pagination.js +29 -0
- package/dist/entry/create-query-client.d.ts +8 -0
- package/dist/entry/create-query-client.js +14 -0
- package/dist/entry/create-sub-app.d.ts +45 -0
- package/dist/entry/create-sub-app.js +110 -0
- package/dist/entry/index.d.ts +4 -0
- package/dist/entry/index.js +12 -0
- package/dist/entry/initial-guard.d.ts +12 -0
- package/dist/entry/initial-guard.js +23 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.js +67 -0
- package/dist/providers/setup-i18n.d.ts +19 -0
- package/dist/providers/setup-i18n.js +24 -0
- package/dist/services/app-container.d.ts +15 -0
- package/dist/services/app-container.js +7 -0
- package/dist/services/app-context.d.ts +4 -0
- package/dist/services/app-context.js +17 -0
- package/dist/services/index.d.ts +5 -0
- package/dist/services/loading.d.ts +16 -0
- package/dist/services/loading.js +27 -0
- package/dist/services/message-box.d.ts +84 -0
- package/dist/services/message-box.js +65 -0
- package/dist/services/modal.d.ts +51 -0
- package/dist/services/modal.js +51 -0
- package/dist/services/notify.d.ts +24 -0
- package/dist/services/notify.js +22 -0
- package/dist/shell/AppShell.d.ts +139 -0
- package/dist/shell/AppShell.js +171 -0
- package/dist/shell/shell.css +153 -0
- package/dist/styles/farris-bridge.css +129 -0
- package/dist/styles/index.css +16 -0
- package/dist/styles/markdown.css +85 -0
- package/dist/styles/reset.css +74 -0
- package/dist/styles/tokens.css +111 -0
- package/lint/__tests__/fixtures/clean-src/styles.css +14 -0
- package/lint/__tests__/fixtures/clean-src/views/good-page.tsx +15 -0
- package/lint/__tests__/fixtures/violations-src/styles.css +18 -0
- package/lint/__tests__/fixtures/violations-src/views/bad-page.tsx +38 -0
- package/lint/__tests__/fixtures/violations-src/views/no-shell-page.tsx +4 -0
- package/lint/__tests__/guardrails.spec.mjs +144 -0
- package/lint/component-audit.mjs +131 -0
- package/lint/guardrails.config.schema.json +74 -0
- package/lint/pre-commit.sample +26 -0
- package/lint/run-all.mjs +59 -0
- package/lint/shared.mjs +347 -0
- package/lint/structure-audit.mjs +254 -0
- package/lint/style-audit.mjs +200 -0
- package/package.json +78 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { type PropType, type SlotsType, type VNodeChild } from 'vue';
|
|
2
|
+
export type AppButtonTone = 'default' | 'primary' | 'secondary' | 'info' | 'success' | 'warning' | 'error';
|
|
3
|
+
export type AppButtonShape = 'solid' | 'soft' | 'outline' | 'ghost' | 'link';
|
|
4
|
+
export type AppControlSize = 'sm' | 'md' | 'lg';
|
|
5
|
+
/**
|
|
6
|
+
* 按钮(封装 farris FButton)。
|
|
7
|
+
*
|
|
8
|
+
* 对外只有 tone/shape/size/disabled/loading;farris 的 type/customClass/iconClass
|
|
9
|
+
* 全部在内部翻译,应用侧写不出 farris 形态(inheritAttrs:false,未白名单属性直接丢弃)。
|
|
10
|
+
*
|
|
11
|
+
* `shape="ghost"` 是**图标按钮的标准形态**(无底、无边框、hover 变色;`tone="error"` 时 hover 转危险色),
|
|
12
|
+
* 由本包 `atoms.css` 定义,应用侧不再自绘图标按钮外观。
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* <AppButton tone="primary" onClick={handleAdd}>新增</AppButton>
|
|
16
|
+
* <AppButton shape="link">查看详情</AppButton>
|
|
17
|
+
* <AppButton shape="ghost" size="sm" title="编辑"><Pencil size={14} /></AppButton>
|
|
18
|
+
* <AppButton shape="ghost" size="sm" tone="error" title="删除"><Trash2 size={14} /></AppButton>
|
|
19
|
+
*/
|
|
20
|
+
export declare const AppButton: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
21
|
+
tone: {
|
|
22
|
+
type: PropType<AppButtonTone>;
|
|
23
|
+
default: string;
|
|
24
|
+
};
|
|
25
|
+
shape: {
|
|
26
|
+
type: PropType<AppButtonShape>;
|
|
27
|
+
default: string;
|
|
28
|
+
};
|
|
29
|
+
size: {
|
|
30
|
+
type: PropType<AppControlSize>;
|
|
31
|
+
default: string;
|
|
32
|
+
};
|
|
33
|
+
disabled: {
|
|
34
|
+
type: BooleanConstructor;
|
|
35
|
+
default: boolean;
|
|
36
|
+
};
|
|
37
|
+
loading: {
|
|
38
|
+
type: BooleanConstructor;
|
|
39
|
+
default: boolean;
|
|
40
|
+
};
|
|
41
|
+
/** 原生 title 透传(图标按钮的无障碍提示),非 farris 特有属性 */
|
|
42
|
+
title: {
|
|
43
|
+
type: StringConstructor;
|
|
44
|
+
default: undefined;
|
|
45
|
+
};
|
|
46
|
+
onClick: {
|
|
47
|
+
type: PropType<(e: MouseEvent) => void>;
|
|
48
|
+
default: undefined;
|
|
49
|
+
};
|
|
50
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
51
|
+
tone: {
|
|
52
|
+
type: PropType<AppButtonTone>;
|
|
53
|
+
default: string;
|
|
54
|
+
};
|
|
55
|
+
shape: {
|
|
56
|
+
type: PropType<AppButtonShape>;
|
|
57
|
+
default: string;
|
|
58
|
+
};
|
|
59
|
+
size: {
|
|
60
|
+
type: PropType<AppControlSize>;
|
|
61
|
+
default: string;
|
|
62
|
+
};
|
|
63
|
+
disabled: {
|
|
64
|
+
type: BooleanConstructor;
|
|
65
|
+
default: boolean;
|
|
66
|
+
};
|
|
67
|
+
loading: {
|
|
68
|
+
type: BooleanConstructor;
|
|
69
|
+
default: boolean;
|
|
70
|
+
};
|
|
71
|
+
/** 原生 title 透传(图标按钮的无障碍提示),非 farris 特有属性 */
|
|
72
|
+
title: {
|
|
73
|
+
type: StringConstructor;
|
|
74
|
+
default: undefined;
|
|
75
|
+
};
|
|
76
|
+
onClick: {
|
|
77
|
+
type: PropType<(e: MouseEvent) => void>;
|
|
78
|
+
default: undefined;
|
|
79
|
+
};
|
|
80
|
+
}>> & Readonly<{}>, {
|
|
81
|
+
title: string;
|
|
82
|
+
onClick: (e: MouseEvent) => void;
|
|
83
|
+
size: AppControlSize;
|
|
84
|
+
loading: boolean;
|
|
85
|
+
tone: AppButtonTone;
|
|
86
|
+
shape: AppButtonShape;
|
|
87
|
+
disabled: boolean;
|
|
88
|
+
}, SlotsType<{
|
|
89
|
+
default?: () => VNodeChild;
|
|
90
|
+
}>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { defineComponent, createVNode, mergeProps } from "vue";
|
|
2
|
+
import { FButton } from "@farris/ui-vue";
|
|
3
|
+
const TONE_TO_FARRIS_TYPE = {
|
|
4
|
+
primary: "primary",
|
|
5
|
+
secondary: "secondary",
|
|
6
|
+
info: "primary",
|
|
7
|
+
success: "success",
|
|
8
|
+
warning: "warning",
|
|
9
|
+
error: "danger"
|
|
10
|
+
};
|
|
11
|
+
const AppButton = /* @__PURE__ */ defineComponent({
|
|
12
|
+
name: "AppButton",
|
|
13
|
+
inheritAttrs: false,
|
|
14
|
+
props: {
|
|
15
|
+
tone: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: "default"
|
|
18
|
+
},
|
|
19
|
+
shape: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: "solid"
|
|
22
|
+
},
|
|
23
|
+
size: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: "md"
|
|
26
|
+
},
|
|
27
|
+
disabled: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: false
|
|
30
|
+
},
|
|
31
|
+
loading: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: false
|
|
34
|
+
},
|
|
35
|
+
/** 原生 title 透传(图标按钮的无障碍提示),非 farris 特有属性 */
|
|
36
|
+
title: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: void 0
|
|
39
|
+
},
|
|
40
|
+
onClick: {
|
|
41
|
+
type: Function,
|
|
42
|
+
default: void 0
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
slots: Object,
|
|
46
|
+
setup(props, {
|
|
47
|
+
slots,
|
|
48
|
+
attrs
|
|
49
|
+
}) {
|
|
50
|
+
return () => {
|
|
51
|
+
const farrisType = props.shape === "link" ? "link" : props.tone === "default" ? (
|
|
52
|
+
/* farris 无中性默认按钮(type 默认即 primary):
|
|
53
|
+
solid+default 维持现状外观(primary);ghost/soft/outline 走 secondary */
|
|
54
|
+
props.shape === "solid" ? "primary" : "secondary"
|
|
55
|
+
) : TONE_TO_FARRIS_TYPE[props.tone];
|
|
56
|
+
const farrisSize = props.size === "sm" ? "small" : props.size === "lg" ? "large" : "middle";
|
|
57
|
+
return createVNode(FButton, mergeProps({
|
|
58
|
+
"type": farrisType,
|
|
59
|
+
"size": farrisSize,
|
|
60
|
+
"disabled": props.disabled || props.loading,
|
|
61
|
+
"customClass": [attrs.class, "ak-btn", `ak-btn--${props.shape}`, `ak-btn--${props.tone}`, props.loading ? "ak-btn-loading" : ""].filter(Boolean).join(" "),
|
|
62
|
+
"customStyle": attrs.style
|
|
63
|
+
}, {
|
|
64
|
+
title: props.title,
|
|
65
|
+
onClick: props.onClick
|
|
66
|
+
}), {
|
|
67
|
+
default: () => [slots.default?.()]
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
export {
|
|
73
|
+
AppButton
|
|
74
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { type PropType, type SlotsType, type VNodeChild } from 'vue';
|
|
2
|
+
import type { AppControlSize } from './app-button';
|
|
3
|
+
/**
|
|
4
|
+
* 复选框(**自建**,不封装 farris)。
|
|
5
|
+
*
|
|
6
|
+
* 自建理由:farris 无对应件的场景按本仓「缺件处置流程」自建,形态与 `AppSwitch` 对齐
|
|
7
|
+
* (统一词表 `modelValue` / `onChange` / `disabled` / `size`,无 farris 风格 prop)。
|
|
8
|
+
*
|
|
9
|
+
* 实现要点:
|
|
10
|
+
* - 真实 `<input type="checkbox">` 负责可访问性与键盘(Tab / Space),视觉由旁边的方块自绘;
|
|
11
|
+
* - 方块用 `data-state`(`checked` / `indeterminate` / `unchecked`)承载状态,样式全部走 `--ui-*` 令牌;
|
|
12
|
+
* 与 `AppTable` 自绘选择列同一套状态协议,便于后续统一收敛;
|
|
13
|
+
* - **选中 / 半选填主色**(没有色彩角色维度):与 `AppSwitch` 的选中轨道、`AppTable` 自选列
|
|
14
|
+
* (`accent-color`)以及 `@aihub/theme` 的「已选择背景取主色」三处同一口径 ——
|
|
15
|
+
* 全库"选中"只有主色一种表达,别在这里另开一档深色;
|
|
16
|
+
* - 半选(`indeterminate`)是**旁路态**:点击后由消费方自行决定落到 `checked` 还是 `unchecked`,
|
|
17
|
+
* 组件只负责视觉与原生属性同步。
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* <AppCheckbox modelValue={row.enabled} onChange={(v) => (row.enabled = v)}>是否生效</AppCheckbox>
|
|
21
|
+
*
|
|
22
|
+
* @example 全选 / 半选
|
|
23
|
+
* <AppCheckbox indeterminate={someChecked && !allChecked}
|
|
24
|
+
* modelValue={allChecked} onChange={(v) => toggleAll(v)}>全选</AppCheckbox>
|
|
25
|
+
*/
|
|
26
|
+
export declare const AppCheckbox: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
27
|
+
/** 受控勾选值 */
|
|
28
|
+
modelValue: {
|
|
29
|
+
type: BooleanConstructor;
|
|
30
|
+
default: boolean;
|
|
31
|
+
};
|
|
32
|
+
/** 半选态(视觉与 `input.indeterminate` 同步;不改变 `modelValue`) */
|
|
33
|
+
indeterminate: {
|
|
34
|
+
type: BooleanConstructor;
|
|
35
|
+
default: boolean;
|
|
36
|
+
};
|
|
37
|
+
disabled: {
|
|
38
|
+
type: BooleanConstructor;
|
|
39
|
+
default: boolean;
|
|
40
|
+
};
|
|
41
|
+
size: {
|
|
42
|
+
type: PropType<AppControlSize>;
|
|
43
|
+
default: string;
|
|
44
|
+
};
|
|
45
|
+
/** 值变更回调;参数为新勾选值 */
|
|
46
|
+
onChange: {
|
|
47
|
+
type: PropType<(v: boolean) => void>;
|
|
48
|
+
default: undefined;
|
|
49
|
+
};
|
|
50
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
51
|
+
'update:modelValue': (v: boolean) => true;
|
|
52
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
53
|
+
/** 受控勾选值 */
|
|
54
|
+
modelValue: {
|
|
55
|
+
type: BooleanConstructor;
|
|
56
|
+
default: boolean;
|
|
57
|
+
};
|
|
58
|
+
/** 半选态(视觉与 `input.indeterminate` 同步;不改变 `modelValue`) */
|
|
59
|
+
indeterminate: {
|
|
60
|
+
type: BooleanConstructor;
|
|
61
|
+
default: boolean;
|
|
62
|
+
};
|
|
63
|
+
disabled: {
|
|
64
|
+
type: BooleanConstructor;
|
|
65
|
+
default: boolean;
|
|
66
|
+
};
|
|
67
|
+
size: {
|
|
68
|
+
type: PropType<AppControlSize>;
|
|
69
|
+
default: string;
|
|
70
|
+
};
|
|
71
|
+
/** 值变更回调;参数为新勾选值 */
|
|
72
|
+
onChange: {
|
|
73
|
+
type: PropType<(v: boolean) => void>;
|
|
74
|
+
default: undefined;
|
|
75
|
+
};
|
|
76
|
+
}>> & Readonly<{
|
|
77
|
+
"onUpdate:modelValue"?: ((v: boolean) => any) | undefined;
|
|
78
|
+
}>, {
|
|
79
|
+
onChange: (v: boolean) => void;
|
|
80
|
+
size: AppControlSize;
|
|
81
|
+
disabled: boolean;
|
|
82
|
+
modelValue: boolean;
|
|
83
|
+
indeterminate: boolean;
|
|
84
|
+
}, SlotsType<{
|
|
85
|
+
default?: () => VNodeChild;
|
|
86
|
+
}>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { defineComponent, ref, watchEffect, createVNode } from "vue";
|
|
2
|
+
import { Icon } from "@manohub/icon";
|
|
3
|
+
const AppCheckbox = /* @__PURE__ */ defineComponent({
|
|
4
|
+
name: "AppCheckbox",
|
|
5
|
+
inheritAttrs: false,
|
|
6
|
+
props: {
|
|
7
|
+
/** 受控勾选值 */
|
|
8
|
+
modelValue: {
|
|
9
|
+
type: Boolean,
|
|
10
|
+
default: false
|
|
11
|
+
},
|
|
12
|
+
/** 半选态(视觉与 `input.indeterminate` 同步;不改变 `modelValue`) */
|
|
13
|
+
indeterminate: {
|
|
14
|
+
type: Boolean,
|
|
15
|
+
default: false
|
|
16
|
+
},
|
|
17
|
+
disabled: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: false
|
|
20
|
+
},
|
|
21
|
+
size: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: "md"
|
|
24
|
+
},
|
|
25
|
+
/** 值变更回调;参数为新勾选值 */
|
|
26
|
+
onChange: {
|
|
27
|
+
type: Function,
|
|
28
|
+
default: void 0
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
emits: {
|
|
32
|
+
"update:modelValue": (v) => true
|
|
33
|
+
},
|
|
34
|
+
slots: Object,
|
|
35
|
+
setup(props, {
|
|
36
|
+
emit,
|
|
37
|
+
slots,
|
|
38
|
+
attrs
|
|
39
|
+
}) {
|
|
40
|
+
const inputRef = ref(null);
|
|
41
|
+
watchEffect(() => {
|
|
42
|
+
if (inputRef.value) inputRef.value.indeterminate = props.indeterminate;
|
|
43
|
+
});
|
|
44
|
+
const handleChange = (event) => {
|
|
45
|
+
const next = event.target.checked;
|
|
46
|
+
emit("update:modelValue", next);
|
|
47
|
+
props.onChange?.(next);
|
|
48
|
+
};
|
|
49
|
+
return () => {
|
|
50
|
+
const state = props.indeterminate ? "indeterminate" : props.modelValue ? "checked" : "unchecked";
|
|
51
|
+
const iconSize = props.size === "sm" ? 10 : props.size === "lg" ? 14 : 12;
|
|
52
|
+
return createVNode("label", {
|
|
53
|
+
"class": ["ak-checkbox", `ak-checkbox--${props.size}`, props.disabled ? "is-disabled" : "", attrs.class].filter(Boolean).join(" ")
|
|
54
|
+
}, [createVNode("input", {
|
|
55
|
+
"ref": inputRef,
|
|
56
|
+
"class": "ak-checkbox__input",
|
|
57
|
+
"type": "checkbox",
|
|
58
|
+
"checked": props.modelValue,
|
|
59
|
+
"disabled": props.disabled,
|
|
60
|
+
"onChange": handleChange
|
|
61
|
+
}, null), createVNode("span", {
|
|
62
|
+
"class": "ak-checkbox__box",
|
|
63
|
+
"data-state": state
|
|
64
|
+
}, [props.indeterminate ? createVNode("span", {
|
|
65
|
+
"class": "ak-checkbox__dash"
|
|
66
|
+
}, null) : createVNode(Icon, {
|
|
67
|
+
"name": "check",
|
|
68
|
+
"size": iconSize,
|
|
69
|
+
"class": "ak-checkbox__icon"
|
|
70
|
+
}, null)]), slots.default ? createVNode("span", {
|
|
71
|
+
"class": "ak-checkbox__label"
|
|
72
|
+
}, [slots.default()]) : null]);
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
export {
|
|
77
|
+
AppCheckbox
|
|
78
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { type PropType, type SlotsType, type VNodeChild } from 'vue';
|
|
2
|
+
import { type AppButtonTone, type AppControlSize } from './app-button';
|
|
3
|
+
/**
|
|
4
|
+
* 图标按钮(纯图标、无文案):`AppButton shape="ghost"` + 方形点击区。
|
|
5
|
+
*
|
|
6
|
+
* 吃掉的分身:批次 5 前 3 个应用各自手搓「透明底 + 无边框 + hover 变色」的图标按钮
|
|
7
|
+
* (`topic-action-btn`、`upstream-actions .f-icon-refresh`、`skill-list-page__refresh`),
|
|
8
|
+
* 有的还带 `!important`。形态与尺寸由本包 `.ak-icon-btn` 统一,应用侧只给图标节点。
|
|
9
|
+
*
|
|
10
|
+
* 语义:`title` 必传(图标按钮的无障碍名称);`loading` 时禁用并保持尺寸不跳。
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* <AppIconButton size="sm" title="编辑" onClick={() => handleEdit(row)}><Pencil size={14} /></AppIconButton>
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* <AppIconButton size="sm" tone="error" title="删除" onClick={() => handleRemove(row)}><Trash2 size={14} /></AppIconButton>
|
|
17
|
+
*/
|
|
18
|
+
export declare const AppIconButton: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
19
|
+
tone: {
|
|
20
|
+
type: PropType<AppButtonTone>;
|
|
21
|
+
default: string;
|
|
22
|
+
};
|
|
23
|
+
size: {
|
|
24
|
+
type: PropType<AppControlSize>;
|
|
25
|
+
default: string;
|
|
26
|
+
};
|
|
27
|
+
disabled: {
|
|
28
|
+
type: BooleanConstructor;
|
|
29
|
+
default: boolean;
|
|
30
|
+
};
|
|
31
|
+
loading: {
|
|
32
|
+
type: BooleanConstructor;
|
|
33
|
+
default: boolean;
|
|
34
|
+
};
|
|
35
|
+
/** 无障碍名称(图标按钮必备) */
|
|
36
|
+
title: {
|
|
37
|
+
type: StringConstructor;
|
|
38
|
+
default: undefined;
|
|
39
|
+
};
|
|
40
|
+
onClick: {
|
|
41
|
+
type: PropType<(e: MouseEvent) => void>;
|
|
42
|
+
default: undefined;
|
|
43
|
+
};
|
|
44
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
45
|
+
tone: {
|
|
46
|
+
type: PropType<AppButtonTone>;
|
|
47
|
+
default: string;
|
|
48
|
+
};
|
|
49
|
+
size: {
|
|
50
|
+
type: PropType<AppControlSize>;
|
|
51
|
+
default: string;
|
|
52
|
+
};
|
|
53
|
+
disabled: {
|
|
54
|
+
type: BooleanConstructor;
|
|
55
|
+
default: boolean;
|
|
56
|
+
};
|
|
57
|
+
loading: {
|
|
58
|
+
type: BooleanConstructor;
|
|
59
|
+
default: boolean;
|
|
60
|
+
};
|
|
61
|
+
/** 无障碍名称(图标按钮必备) */
|
|
62
|
+
title: {
|
|
63
|
+
type: StringConstructor;
|
|
64
|
+
default: undefined;
|
|
65
|
+
};
|
|
66
|
+
onClick: {
|
|
67
|
+
type: PropType<(e: MouseEvent) => void>;
|
|
68
|
+
default: undefined;
|
|
69
|
+
};
|
|
70
|
+
}>> & Readonly<{}>, {
|
|
71
|
+
title: string;
|
|
72
|
+
onClick: (e: MouseEvent) => void;
|
|
73
|
+
size: AppControlSize;
|
|
74
|
+
loading: boolean;
|
|
75
|
+
tone: AppButtonTone;
|
|
76
|
+
disabled: boolean;
|
|
77
|
+
}, SlotsType<{
|
|
78
|
+
default?: () => VNodeChild;
|
|
79
|
+
}>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { defineComponent, createVNode } from "vue";
|
|
2
|
+
import { AppButton } from "./app-button.js";
|
|
3
|
+
const AppIconButton = /* @__PURE__ */ defineComponent({
|
|
4
|
+
name: "AppIconButton",
|
|
5
|
+
inheritAttrs: false,
|
|
6
|
+
props: {
|
|
7
|
+
tone: {
|
|
8
|
+
type: String,
|
|
9
|
+
default: "default"
|
|
10
|
+
},
|
|
11
|
+
size: {
|
|
12
|
+
type: String,
|
|
13
|
+
default: "sm"
|
|
14
|
+
},
|
|
15
|
+
disabled: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: false
|
|
18
|
+
},
|
|
19
|
+
loading: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: false
|
|
22
|
+
},
|
|
23
|
+
/** 无障碍名称(图标按钮必备) */
|
|
24
|
+
title: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: void 0
|
|
27
|
+
},
|
|
28
|
+
onClick: {
|
|
29
|
+
type: Function,
|
|
30
|
+
default: void 0
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
slots: Object,
|
|
34
|
+
setup(props, {
|
|
35
|
+
slots,
|
|
36
|
+
attrs
|
|
37
|
+
}) {
|
|
38
|
+
return () => createVNode(AppButton, {
|
|
39
|
+
"shape": "ghost",
|
|
40
|
+
"tone": props.tone,
|
|
41
|
+
"size": props.size,
|
|
42
|
+
"disabled": props.disabled,
|
|
43
|
+
"loading": props.loading,
|
|
44
|
+
"title": props.title,
|
|
45
|
+
"onClick": props.onClick,
|
|
46
|
+
"class": ["ak-icon-btn", `ak-icon-btn--${props.size}`, attrs.class].filter(Boolean).join(" ")
|
|
47
|
+
}, {
|
|
48
|
+
default: () => [slots.default?.()]
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
export {
|
|
53
|
+
AppIconButton
|
|
54
|
+
};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { type PropType, type SlotsType, type VNodeChild } from 'vue';
|
|
2
|
+
import type { AppControlSize } from './app-button';
|
|
3
|
+
/**
|
|
4
|
+
* 单行文本输入框(封装 farris FInputGroup)。
|
|
5
|
+
*
|
|
6
|
+
* farris 侧的坑全部在内部消化:
|
|
7
|
+
* - FInputGroup 默认 updateOn="blur"(输入不实时上抛)——内部固定 updateOn="change",
|
|
8
|
+
* 应用侧永远拿到实时值,不需要知道这个 prop 的存在。
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* <AppInput v-model={keyword} placeholder="搜索名称" clearable />
|
|
12
|
+
*/
|
|
13
|
+
export declare const AppInput: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
14
|
+
modelValue: {
|
|
15
|
+
type: StringConstructor;
|
|
16
|
+
default: string;
|
|
17
|
+
};
|
|
18
|
+
placeholder: {
|
|
19
|
+
type: StringConstructor;
|
|
20
|
+
default: string;
|
|
21
|
+
};
|
|
22
|
+
disabled: {
|
|
23
|
+
type: BooleanConstructor;
|
|
24
|
+
default: boolean;
|
|
25
|
+
};
|
|
26
|
+
readonly: {
|
|
27
|
+
type: BooleanConstructor;
|
|
28
|
+
default: boolean;
|
|
29
|
+
};
|
|
30
|
+
clearable: {
|
|
31
|
+
type: BooleanConstructor;
|
|
32
|
+
default: boolean;
|
|
33
|
+
};
|
|
34
|
+
/** 原生 input type;farris 侧映射为 groupText 前缀的场景由 AppInputGroup(后续批次)承接 */
|
|
35
|
+
type: {
|
|
36
|
+
type: PropType<"text" | "password">;
|
|
37
|
+
default: string;
|
|
38
|
+
};
|
|
39
|
+
/** 原生 autocomplete 透传(表单弹窗须 "off" 防浏览器回填),非 farris 特有属性 */
|
|
40
|
+
autocomplete: {
|
|
41
|
+
type: StringConstructor;
|
|
42
|
+
default: undefined;
|
|
43
|
+
};
|
|
44
|
+
size: {
|
|
45
|
+
type: PropType<AppControlSize>;
|
|
46
|
+
default: string;
|
|
47
|
+
};
|
|
48
|
+
/** 点击输入框(配合 readonly 可做「点击打开选择器」的伪输入框) */
|
|
49
|
+
onClick: {
|
|
50
|
+
type: PropType<(e: MouseEvent) => void>;
|
|
51
|
+
default: undefined;
|
|
52
|
+
};
|
|
53
|
+
onChange: {
|
|
54
|
+
type: PropType<(v: string) => void>;
|
|
55
|
+
default: undefined;
|
|
56
|
+
};
|
|
57
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
58
|
+
'update:modelValue': (v: string) => true;
|
|
59
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
60
|
+
modelValue: {
|
|
61
|
+
type: StringConstructor;
|
|
62
|
+
default: string;
|
|
63
|
+
};
|
|
64
|
+
placeholder: {
|
|
65
|
+
type: StringConstructor;
|
|
66
|
+
default: string;
|
|
67
|
+
};
|
|
68
|
+
disabled: {
|
|
69
|
+
type: BooleanConstructor;
|
|
70
|
+
default: boolean;
|
|
71
|
+
};
|
|
72
|
+
readonly: {
|
|
73
|
+
type: BooleanConstructor;
|
|
74
|
+
default: boolean;
|
|
75
|
+
};
|
|
76
|
+
clearable: {
|
|
77
|
+
type: BooleanConstructor;
|
|
78
|
+
default: boolean;
|
|
79
|
+
};
|
|
80
|
+
/** 原生 input type;farris 侧映射为 groupText 前缀的场景由 AppInputGroup(后续批次)承接 */
|
|
81
|
+
type: {
|
|
82
|
+
type: PropType<"text" | "password">;
|
|
83
|
+
default: string;
|
|
84
|
+
};
|
|
85
|
+
/** 原生 autocomplete 透传(表单弹窗须 "off" 防浏览器回填),非 farris 特有属性 */
|
|
86
|
+
autocomplete: {
|
|
87
|
+
type: StringConstructor;
|
|
88
|
+
default: undefined;
|
|
89
|
+
};
|
|
90
|
+
size: {
|
|
91
|
+
type: PropType<AppControlSize>;
|
|
92
|
+
default: string;
|
|
93
|
+
};
|
|
94
|
+
/** 点击输入框(配合 readonly 可做「点击打开选择器」的伪输入框) */
|
|
95
|
+
onClick: {
|
|
96
|
+
type: PropType<(e: MouseEvent) => void>;
|
|
97
|
+
default: undefined;
|
|
98
|
+
};
|
|
99
|
+
onChange: {
|
|
100
|
+
type: PropType<(v: string) => void>;
|
|
101
|
+
default: undefined;
|
|
102
|
+
};
|
|
103
|
+
}>> & Readonly<{
|
|
104
|
+
"onUpdate:modelValue"?: ((v: string) => any) | undefined;
|
|
105
|
+
}>, {
|
|
106
|
+
type: "text" | "password";
|
|
107
|
+
onChange: (v: string) => void;
|
|
108
|
+
onClick: (e: MouseEvent) => void;
|
|
109
|
+
size: AppControlSize;
|
|
110
|
+
disabled: boolean;
|
|
111
|
+
modelValue: string;
|
|
112
|
+
placeholder: string;
|
|
113
|
+
readonly: boolean;
|
|
114
|
+
clearable: boolean;
|
|
115
|
+
autocomplete: string;
|
|
116
|
+
}, SlotsType<{
|
|
117
|
+
default?: () => VNodeChild;
|
|
118
|
+
}>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { defineComponent, createVNode } from "vue";
|
|
2
|
+
import { FInputGroup } from "@farris/ui-vue";
|
|
3
|
+
const AppInput = /* @__PURE__ */ defineComponent({
|
|
4
|
+
name: "AppInput",
|
|
5
|
+
inheritAttrs: false,
|
|
6
|
+
props: {
|
|
7
|
+
modelValue: {
|
|
8
|
+
type: String,
|
|
9
|
+
default: ""
|
|
10
|
+
},
|
|
11
|
+
placeholder: {
|
|
12
|
+
type: String,
|
|
13
|
+
default: ""
|
|
14
|
+
},
|
|
15
|
+
disabled: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: false
|
|
18
|
+
},
|
|
19
|
+
readonly: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: false
|
|
22
|
+
},
|
|
23
|
+
clearable: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: false
|
|
26
|
+
},
|
|
27
|
+
/** 原生 input type;farris 侧映射为 groupText 前缀的场景由 AppInputGroup(后续批次)承接 */
|
|
28
|
+
type: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: "text"
|
|
31
|
+
},
|
|
32
|
+
/** 原生 autocomplete 透传(表单弹窗须 "off" 防浏览器回填),非 farris 特有属性 */
|
|
33
|
+
autocomplete: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: void 0
|
|
36
|
+
},
|
|
37
|
+
size: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: "md"
|
|
40
|
+
},
|
|
41
|
+
/** 点击输入框(配合 readonly 可做「点击打开选择器」的伪输入框) */
|
|
42
|
+
onClick: {
|
|
43
|
+
type: Function,
|
|
44
|
+
default: void 0
|
|
45
|
+
},
|
|
46
|
+
onChange: {
|
|
47
|
+
type: Function,
|
|
48
|
+
default: void 0
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
emits: {
|
|
52
|
+
"update:modelValue": (v) => true
|
|
53
|
+
},
|
|
54
|
+
slots: Object,
|
|
55
|
+
setup(props, {
|
|
56
|
+
emit,
|
|
57
|
+
attrs,
|
|
58
|
+
slots
|
|
59
|
+
}) {
|
|
60
|
+
return () => createVNode(FInputGroup, {
|
|
61
|
+
"modelValue": props.modelValue,
|
|
62
|
+
"onUpdate:modelValue": (v) => {
|
|
63
|
+
emit("update:modelValue", v);
|
|
64
|
+
props.onChange?.(v);
|
|
65
|
+
},
|
|
66
|
+
"updateOn": "change",
|
|
67
|
+
"placeholder": props.placeholder,
|
|
68
|
+
"disabled": props.disabled,
|
|
69
|
+
"readonly": props.readonly,
|
|
70
|
+
"enableClear": props.clearable,
|
|
71
|
+
"type": props.type,
|
|
72
|
+
"autocomplete": props.autocomplete,
|
|
73
|
+
"customClass": attrs.class,
|
|
74
|
+
"customStyle": attrs.style,
|
|
75
|
+
"onClick": props.onClick
|
|
76
|
+
}, slots.default ? {
|
|
77
|
+
groupTextTemplate: () => slots.default?.()
|
|
78
|
+
} : void 0);
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
export {
|
|
82
|
+
AppInput
|
|
83
|
+
};
|