@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.
Files changed (103) hide show
  1. package/CONTRACT.md +592 -0
  2. package/README.md +27 -0
  3. package/dist/atoms/app-button.d.ts +90 -0
  4. package/dist/atoms/app-button.js +74 -0
  5. package/dist/atoms/app-checkbox.d.ts +86 -0
  6. package/dist/atoms/app-checkbox.js +78 -0
  7. package/dist/atoms/app-icon-button.d.ts +79 -0
  8. package/dist/atoms/app-icon-button.js +54 -0
  9. package/dist/atoms/app-input.d.ts +118 -0
  10. package/dist/atoms/app-input.js +83 -0
  11. package/dist/atoms/app-layout.d.ts +348 -0
  12. package/dist/atoms/app-layout.js +102 -0
  13. package/dist/atoms/app-notice.d.ts +90 -0
  14. package/dist/atoms/app-notice.js +59 -0
  15. package/dist/atoms/app-query-state.d.ts +191 -0
  16. package/dist/atoms/app-query-state.js +161 -0
  17. package/dist/atoms/app-radio-card.d.ts +80 -0
  18. package/dist/atoms/app-radio-card.js +72 -0
  19. package/dist/atoms/app-search-box.d.ts +80 -0
  20. package/dist/atoms/app-search-box.js +64 -0
  21. package/dist/atoms/app-select.d.ts +106 -0
  22. package/dist/atoms/app-select.js +74 -0
  23. package/dist/atoms/app-switch.d.ts +72 -0
  24. package/dist/atoms/app-switch.js +66 -0
  25. package/dist/atoms/app-textarea.d.ts +89 -0
  26. package/dist/atoms/app-textarea.js +61 -0
  27. package/dist/atoms/app-tooltip.d.ts +70 -0
  28. package/dist/atoms/app-tooltip.js +48 -0
  29. package/dist/atoms/atoms.css +679 -0
  30. package/dist/atoms/state-illustration.d.ts +21 -0
  31. package/dist/atoms/state-illustration.js +101 -0
  32. package/dist/components/app-badge.d.ts +72 -0
  33. package/dist/components/app-badge.js +40 -0
  34. package/dist/components/app-dialog.d.ts +164 -0
  35. package/dist/components/app-dialog.js +121 -0
  36. package/dist/components/app-filter.d.ts +173 -0
  37. package/dist/components/app-filter.js +200 -0
  38. package/dist/components/app-form.d.ts +446 -0
  39. package/dist/components/app-form.js +159 -0
  40. package/dist/components/app-pagination.d.ts +78 -0
  41. package/dist/components/app-pagination.js +57 -0
  42. package/dist/components/app-panel.d.ts +399 -0
  43. package/dist/components/app-panel.js +213 -0
  44. package/dist/components/app-section.d.ts +68 -0
  45. package/dist/components/app-section.js +28 -0
  46. package/dist/components/app-steps.d.ts +115 -0
  47. package/dist/components/app-steps.js +108 -0
  48. package/dist/components/app-table.d.ts +415 -0
  49. package/dist/components/app-table.js +479 -0
  50. package/dist/components/app-tabs.d.ts +58 -0
  51. package/dist/components/app-tabs.js +54 -0
  52. package/dist/components/app-tree.d.ts +273 -0
  53. package/dist/components/app-tree.js +222 -0
  54. package/dist/components/components.css +597 -0
  55. package/dist/composables/use-client-pagination.d.ts +39 -0
  56. package/dist/composables/use-client-pagination.js +29 -0
  57. package/dist/entry/create-query-client.d.ts +8 -0
  58. package/dist/entry/create-query-client.js +14 -0
  59. package/dist/entry/create-sub-app.d.ts +45 -0
  60. package/dist/entry/create-sub-app.js +110 -0
  61. package/dist/entry/index.d.ts +4 -0
  62. package/dist/entry/index.js +12 -0
  63. package/dist/entry/initial-guard.d.ts +12 -0
  64. package/dist/entry/initial-guard.js +23 -0
  65. package/dist/index.d.ts +37 -0
  66. package/dist/index.js +67 -0
  67. package/dist/providers/setup-i18n.d.ts +19 -0
  68. package/dist/providers/setup-i18n.js +24 -0
  69. package/dist/services/app-container.d.ts +15 -0
  70. package/dist/services/app-container.js +7 -0
  71. package/dist/services/app-context.d.ts +4 -0
  72. package/dist/services/app-context.js +17 -0
  73. package/dist/services/index.d.ts +5 -0
  74. package/dist/services/loading.d.ts +16 -0
  75. package/dist/services/loading.js +27 -0
  76. package/dist/services/message-box.d.ts +84 -0
  77. package/dist/services/message-box.js +65 -0
  78. package/dist/services/modal.d.ts +51 -0
  79. package/dist/services/modal.js +51 -0
  80. package/dist/services/notify.d.ts +24 -0
  81. package/dist/services/notify.js +22 -0
  82. package/dist/shell/AppShell.d.ts +139 -0
  83. package/dist/shell/AppShell.js +171 -0
  84. package/dist/shell/shell.css +153 -0
  85. package/dist/styles/farris-bridge.css +129 -0
  86. package/dist/styles/index.css +16 -0
  87. package/dist/styles/markdown.css +85 -0
  88. package/dist/styles/reset.css +74 -0
  89. package/dist/styles/tokens.css +111 -0
  90. package/lint/__tests__/fixtures/clean-src/styles.css +14 -0
  91. package/lint/__tests__/fixtures/clean-src/views/good-page.tsx +15 -0
  92. package/lint/__tests__/fixtures/violations-src/styles.css +18 -0
  93. package/lint/__tests__/fixtures/violations-src/views/bad-page.tsx +38 -0
  94. package/lint/__tests__/fixtures/violations-src/views/no-shell-page.tsx +4 -0
  95. package/lint/__tests__/guardrails.spec.mjs +144 -0
  96. package/lint/component-audit.mjs +131 -0
  97. package/lint/guardrails.config.schema.json +74 -0
  98. package/lint/pre-commit.sample +26 -0
  99. package/lint/run-all.mjs +59 -0
  100. package/lint/shared.mjs +347 -0
  101. package/lint/structure-audit.mjs +254 -0
  102. package/lint/style-audit.mjs +200 -0
  103. package/package.json +78 -0
@@ -0,0 +1,106 @@
1
+ import { type PropType } from 'vue';
2
+ export interface AppSelectOption {
3
+ label: string;
4
+ value: string | number;
5
+ disabled?: boolean;
6
+ }
7
+ export type AppSelectValue = string | number | null;
8
+ /**
9
+ * 下拉选择框(封装 farris FComboList)。
10
+ *
11
+ * farris 侧需要 `data` + `valueField` + `textField` + `enumValueType` 四件套,
12
+ * 且**漏设 `valueField` / `enumValueType` 会导致选中值被整体静默丢弃**(本仓已多次踩到:
13
+ * skill-admission 筛选栏、skill-auth 规则行、mcp 分类与所属服务选择)。
14
+ * 本组件对外只暴露 `options` + `modelValue`,内部完成全部翻译,并固定 `editable: false`
15
+ * (farris 默认可输入态会与外部受控值不同步)。
16
+ *
17
+ * @example
18
+ * <AppSelect modelValue={topic} options={topics.map(t => ({ label: t.name, value: t.code }))}
19
+ * placeholder="请选择" clearable onChange={(v) => (topic = v)} />
20
+ */
21
+ export declare const AppSelect: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
22
+ modelValue: {
23
+ type: PropType<AppSelectValue>;
24
+ default: null;
25
+ };
26
+ /** 业务选项;内部翻译为 farris 的 data + valueField/textField */
27
+ options: {
28
+ type: PropType<AppSelectOption[]>;
29
+ default: () => never[];
30
+ };
31
+ placeholder: {
32
+ type: StringConstructor;
33
+ default: string;
34
+ };
35
+ disabled: {
36
+ type: BooleanConstructor;
37
+ default: boolean;
38
+ };
39
+ readonly: {
40
+ type: BooleanConstructor;
41
+ default: boolean;
42
+ };
43
+ clearable: {
44
+ type: BooleanConstructor;
45
+ default: boolean;
46
+ };
47
+ /**
48
+ * 浮层宿主元素:抽屉 / 滚动容器内必须指定,否则浮层会被容器的 overflow 裁切
49
+ * (mcp 配置抽屉已踩)。传普通 DOM 元素,非 farris 专属概念。
50
+ */
51
+ popupHost: {
52
+ type: () => HTMLElement | undefined;
53
+ default: undefined;
54
+ };
55
+ onChange: {
56
+ type: PropType<(value: AppSelectValue) => void>;
57
+ default: undefined;
58
+ };
59
+ }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
60
+ modelValue: {
61
+ type: PropType<AppSelectValue>;
62
+ default: null;
63
+ };
64
+ /** 业务选项;内部翻译为 farris 的 data + valueField/textField */
65
+ options: {
66
+ type: PropType<AppSelectOption[]>;
67
+ default: () => never[];
68
+ };
69
+ placeholder: {
70
+ type: StringConstructor;
71
+ default: string;
72
+ };
73
+ disabled: {
74
+ type: BooleanConstructor;
75
+ default: boolean;
76
+ };
77
+ readonly: {
78
+ type: BooleanConstructor;
79
+ default: boolean;
80
+ };
81
+ clearable: {
82
+ type: BooleanConstructor;
83
+ default: boolean;
84
+ };
85
+ /**
86
+ * 浮层宿主元素:抽屉 / 滚动容器内必须指定,否则浮层会被容器的 overflow 裁切
87
+ * (mcp 配置抽屉已踩)。传普通 DOM 元素,非 farris 专属概念。
88
+ */
89
+ popupHost: {
90
+ type: () => HTMLElement | undefined;
91
+ default: undefined;
92
+ };
93
+ onChange: {
94
+ type: PropType<(value: AppSelectValue) => void>;
95
+ default: undefined;
96
+ };
97
+ }>> & Readonly<{}>, {
98
+ onChange: (value: AppSelectValue) => void;
99
+ disabled: boolean;
100
+ modelValue: AppSelectValue;
101
+ placeholder: string;
102
+ readonly: boolean;
103
+ clearable: boolean;
104
+ options: AppSelectOption[];
105
+ popupHost: HTMLElement | undefined;
106
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1,74 @@
1
+ import { defineComponent, createVNode, mergeProps } from "vue";
2
+ import { FComboList } from "@farris/ui-vue";
3
+ const AppSelect = /* @__PURE__ */ defineComponent({
4
+ name: "AppSelect",
5
+ inheritAttrs: false,
6
+ props: {
7
+ modelValue: {
8
+ type: [String, Number],
9
+ default: null
10
+ },
11
+ /** 业务选项;内部翻译为 farris 的 data + valueField/textField */
12
+ options: {
13
+ type: Array,
14
+ default: () => []
15
+ },
16
+ placeholder: {
17
+ type: String,
18
+ default: ""
19
+ },
20
+ disabled: {
21
+ type: Boolean,
22
+ default: false
23
+ },
24
+ readonly: {
25
+ type: Boolean,
26
+ default: false
27
+ },
28
+ clearable: {
29
+ type: Boolean,
30
+ default: false
31
+ },
32
+ /**
33
+ * 浮层宿主元素:抽屉 / 滚动容器内必须指定,否则浮层会被容器的 overflow 裁切
34
+ * (mcp 配置抽屉已踩)。传普通 DOM 元素,非 farris 专属概念。
35
+ */
36
+ popupHost: {
37
+ type: Object,
38
+ default: void 0
39
+ },
40
+ onChange: {
41
+ type: Function,
42
+ default: void 0
43
+ }
44
+ },
45
+ setup(props, {
46
+ attrs
47
+ }) {
48
+ return () => createVNode(FComboList, mergeProps(attrs.class ? {
49
+ customClass: attrs.class
50
+ } : {}, {
51
+ "data": props.options.map((o) => ({
52
+ value: o.value,
53
+ name: o.label,
54
+ disabled: o.disabled
55
+ })),
56
+ "valueField": "value",
57
+ "textField": "name",
58
+ "enumValueType": "string",
59
+ "editable": false,
60
+ "enableClear": props.clearable,
61
+ "disabled": props.disabled,
62
+ "readonly": props.readonly,
63
+ "placeholder": props.placeholder,
64
+ "fitEditor": true,
65
+ "minPanelWidth": 0,
66
+ "modelValue": props.modelValue,
67
+ "popupHost": props.popupHost,
68
+ "onUpdate:modelValue": (value) => props.onChange?.(value ?? null)
69
+ }), null);
70
+ }
71
+ });
72
+ export {
73
+ AppSelect
74
+ };
@@ -0,0 +1,72 @@
1
+ import { type PropType } from 'vue';
2
+ import type { AppControlSize } from './app-button';
3
+ /**
4
+ * 开关(封装 farris FSwitch)。
5
+ *
6
+ * farris 的坑在内部消化:FSwitch 点击后即切换内部视觉态;父级阻断(不接收新值)时
7
+ * 视觉无法回退,现状靠外部递增 key 强制重建。本组件把该 workaround 收进来 ——
8
+ * onChange 返回 false / Promise<false> / Promise reject 时,内部自动回退视觉。
9
+ *
10
+ * @example
11
+ * // 异步提交:失败自动回退视觉
12
+ * <AppSwitch modelValue={item.enabled}
13
+ * onChange={(v) => updateMutation.mutateAsync({ id: item.id, request: { enabled: v } })} />
14
+ * // 同步阻断:返回 false
15
+ * <AppSwitch modelValue={enabled.value} onChange={(v) => canToggle() ? (enabled.value = v) : false} />
16
+ */
17
+ export declare const AppSwitch: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
18
+ modelValue: {
19
+ type: BooleanConstructor;
20
+ default: boolean;
21
+ };
22
+ disabled: {
23
+ type: BooleanConstructor;
24
+ default: boolean;
25
+ };
26
+ size: {
27
+ type: PropType<AppControlSize>;
28
+ default: string;
29
+ };
30
+ /**
31
+ * 值变更回调。返回值决定视觉是否保留:
32
+ * - 返回 false:同步阻断,视觉立即回退
33
+ * - 返回 Promise:resolve false 或 reject 时视觉回退(异步提交失败场景)
34
+ * - 返回 true / undefined / void:视觉保留
35
+ */
36
+ onChange: {
37
+ type: PropType<(v: boolean) => boolean | void | Promise<boolean | void>>;
38
+ default: undefined;
39
+ };
40
+ }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
41
+ 'update:modelValue': (v: boolean) => true;
42
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
43
+ modelValue: {
44
+ type: BooleanConstructor;
45
+ default: boolean;
46
+ };
47
+ disabled: {
48
+ type: BooleanConstructor;
49
+ default: boolean;
50
+ };
51
+ size: {
52
+ type: PropType<AppControlSize>;
53
+ default: string;
54
+ };
55
+ /**
56
+ * 值变更回调。返回值决定视觉是否保留:
57
+ * - 返回 false:同步阻断,视觉立即回退
58
+ * - 返回 Promise:resolve false 或 reject 时视觉回退(异步提交失败场景)
59
+ * - 返回 true / undefined / void:视觉保留
60
+ */
61
+ onChange: {
62
+ type: PropType<(v: boolean) => boolean | void | Promise<boolean | void>>;
63
+ default: undefined;
64
+ };
65
+ }>> & Readonly<{
66
+ "onUpdate:modelValue"?: ((v: boolean) => any) | undefined;
67
+ }>, {
68
+ onChange: (v: boolean) => boolean | void | Promise<boolean | void>;
69
+ size: AppControlSize;
70
+ disabled: boolean;
71
+ modelValue: boolean;
72
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1,66 @@
1
+ import { defineComponent, ref, createVNode } from "vue";
2
+ import { FSwitch } from "@farris/ui-vue";
3
+ const AppSwitch = /* @__PURE__ */ defineComponent({
4
+ name: "AppSwitch",
5
+ inheritAttrs: false,
6
+ props: {
7
+ modelValue: {
8
+ type: Boolean,
9
+ default: false
10
+ },
11
+ disabled: {
12
+ type: Boolean,
13
+ default: false
14
+ },
15
+ size: {
16
+ type: String,
17
+ default: "sm"
18
+ },
19
+ /**
20
+ * 值变更回调。返回值决定视觉是否保留:
21
+ * - 返回 false:同步阻断,视觉立即回退
22
+ * - 返回 Promise:resolve false 或 reject 时视觉回退(异步提交失败场景)
23
+ * - 返回 true / undefined / void:视觉保留
24
+ */
25
+ onChange: {
26
+ type: Function,
27
+ default: void 0
28
+ }
29
+ },
30
+ emits: {
31
+ "update:modelValue": (v) => true
32
+ },
33
+ setup(props, {
34
+ emit,
35
+ attrs
36
+ }) {
37
+ const remountKey = ref(0);
38
+ const handleChange = (v) => {
39
+ emit("update:modelValue", v);
40
+ const result = props.onChange?.(v);
41
+ if (result === false) {
42
+ remountKey.value++;
43
+ return;
44
+ }
45
+ if (result && typeof result.then === "function") {
46
+ result.then((ok) => {
47
+ if (ok === false) remountKey.value++;
48
+ }).catch(() => {
49
+ remountKey.value++;
50
+ });
51
+ }
52
+ };
53
+ return () => createVNode(FSwitch, {
54
+ "key": `${remountKey.value}:${props.modelValue}`,
55
+ "modelValue": props.modelValue,
56
+ "size": props.size === "sm" ? "small" : props.size === "lg" ? "large" : "medium",
57
+ "disabled": props.disabled,
58
+ "onUpdate:modelValue": handleChange,
59
+ "customClass": attrs.class,
60
+ "customStyle": attrs.style
61
+ }, null);
62
+ }
63
+ });
64
+ export {
65
+ AppSwitch
66
+ };
@@ -0,0 +1,89 @@
1
+ import { type PropType } from 'vue';
2
+ /**
3
+ * 多行文本(封装 farris FTextarea)。
4
+ *
5
+ * 内部固定 `updateOn="change"`:farris `useTextBox` 只认 `blur | change`,
6
+ * 缺省 `blur` 会让受控值在输入过程中不同步(本仓已在 topic-dialog、拒绝原因等处的注释中记录)。
7
+ *
8
+ * @example
9
+ * <AppTextarea modelValue={reason} rows={4} maxLength={500} showCount
10
+ * placeholder="请填写拒绝原因" onChange={(v) => (reason = v)} />
11
+ */
12
+ export declare const AppTextarea: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
13
+ modelValue: {
14
+ type: StringConstructor;
15
+ default: string;
16
+ };
17
+ rows: {
18
+ type: NumberConstructor;
19
+ default: number;
20
+ };
21
+ maxLength: {
22
+ type: NumberConstructor;
23
+ default: undefined;
24
+ };
25
+ /** 右下角字数统计(超出 maxLength 时可配合 showCount 提示) */
26
+ showCount: {
27
+ type: BooleanConstructor;
28
+ default: boolean;
29
+ };
30
+ placeholder: {
31
+ type: StringConstructor;
32
+ default: string;
33
+ };
34
+ disabled: {
35
+ type: BooleanConstructor;
36
+ default: boolean;
37
+ };
38
+ readonly: {
39
+ type: BooleanConstructor;
40
+ default: boolean;
41
+ };
42
+ onChange: {
43
+ type: PropType<(value: string) => void>;
44
+ default: undefined;
45
+ };
46
+ }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
47
+ modelValue: {
48
+ type: StringConstructor;
49
+ default: string;
50
+ };
51
+ rows: {
52
+ type: NumberConstructor;
53
+ default: number;
54
+ };
55
+ maxLength: {
56
+ type: NumberConstructor;
57
+ default: undefined;
58
+ };
59
+ /** 右下角字数统计(超出 maxLength 时可配合 showCount 提示) */
60
+ showCount: {
61
+ type: BooleanConstructor;
62
+ default: boolean;
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
+ onChange: {
77
+ type: PropType<(value: string) => void>;
78
+ default: undefined;
79
+ };
80
+ }>> & Readonly<{}>, {
81
+ onChange: (value: string) => void;
82
+ disabled: boolean;
83
+ modelValue: string;
84
+ placeholder: string;
85
+ readonly: boolean;
86
+ rows: number;
87
+ maxLength: number;
88
+ showCount: boolean;
89
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1,61 @@
1
+ import { defineComponent, createVNode, mergeProps } from "vue";
2
+ import { FTextarea } from "@farris/ui-vue";
3
+ const AppTextarea = /* @__PURE__ */ defineComponent({
4
+ name: "AppTextarea",
5
+ inheritAttrs: false,
6
+ props: {
7
+ modelValue: {
8
+ type: String,
9
+ default: ""
10
+ },
11
+ rows: {
12
+ type: Number,
13
+ default: 4
14
+ },
15
+ maxLength: {
16
+ type: Number,
17
+ default: void 0
18
+ },
19
+ /** 右下角字数统计(超出 maxLength 时可配合 showCount 提示) */
20
+ showCount: {
21
+ type: Boolean,
22
+ default: false
23
+ },
24
+ placeholder: {
25
+ type: String,
26
+ default: ""
27
+ },
28
+ disabled: {
29
+ type: Boolean,
30
+ default: false
31
+ },
32
+ readonly: {
33
+ type: Boolean,
34
+ default: false
35
+ },
36
+ onChange: {
37
+ type: Function,
38
+ default: void 0
39
+ }
40
+ },
41
+ setup(props, {
42
+ attrs
43
+ }) {
44
+ return () => createVNode(FTextarea, mergeProps(attrs.class ? {
45
+ customClass: attrs.class
46
+ } : {}, {
47
+ "modelValue": props.modelValue,
48
+ "rows": props.rows,
49
+ "maxLength": props.maxLength,
50
+ "showCount": props.showCount,
51
+ "placeholder": props.placeholder,
52
+ "disabled": props.disabled,
53
+ "readonly": props.readonly,
54
+ "updateOn": "change",
55
+ "onUpdate:modelValue": (value) => props.onChange?.(value ?? "")
56
+ }), null);
57
+ }
58
+ });
59
+ export {
60
+ AppTextarea
61
+ };
@@ -0,0 +1,70 @@
1
+ import { type PropType, type SlotsType, type VNodeChild } from 'vue';
2
+ export type AppTooltipPlacement = 'top' | 'bottom' | 'left' | 'right';
3
+ export type AppTooltipTrigger = 'hover' | 'click';
4
+ /**
5
+ * 文字提示(封装 farris FTooltip)。
6
+ *
7
+ * 吃掉两个 farris 坑:
8
+ * 1. `content` 的类型声明是 `ObjectConstructor`,实际支持字符串 —— 类型面必须断言,
9
+ * 调用方不必再写 `content={text as any}`(本仓 overflow-tooltip 与批量向导各处都写过)。
10
+ * 2. 浮层定位属性会被 farris 自身规则覆盖导致微前端下偏移,修复规则收敛在
11
+ * app-kit 的 `farris-bridge.css`(`.app-container .fv-tooltip`),应用侧不再各写补丁。
12
+ *
13
+ * 默认挂 `ak-tooltip` 外观类;`class` 载荷可叠加自定义主题类。
14
+ *
15
+ * @example
16
+ * <AppTooltip content={fileName} placement="top"><span class="truncate">{fileName}</span></AppTooltip>
17
+ */
18
+ export declare const AppTooltip: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
19
+ content: {
20
+ type: StringConstructor;
21
+ default: string;
22
+ };
23
+ placement: {
24
+ type: PropType<AppTooltipPlacement>;
25
+ default: string;
26
+ };
27
+ trigger: {
28
+ type: PropType<AppTooltipTrigger>;
29
+ default: string;
30
+ };
31
+ /** 固定宽度,如 '200px'(设置后解除最大宽度限制) */
32
+ width: {
33
+ type: StringConstructor;
34
+ default: undefined;
35
+ };
36
+ disabled: {
37
+ type: BooleanConstructor;
38
+ default: boolean;
39
+ };
40
+ }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
41
+ content: {
42
+ type: StringConstructor;
43
+ default: string;
44
+ };
45
+ placement: {
46
+ type: PropType<AppTooltipPlacement>;
47
+ default: string;
48
+ };
49
+ trigger: {
50
+ type: PropType<AppTooltipTrigger>;
51
+ default: string;
52
+ };
53
+ /** 固定宽度,如 '200px'(设置后解除最大宽度限制) */
54
+ width: {
55
+ type: StringConstructor;
56
+ default: undefined;
57
+ };
58
+ disabled: {
59
+ type: BooleanConstructor;
60
+ default: boolean;
61
+ };
62
+ }>> & Readonly<{}>, {
63
+ width: string;
64
+ disabled: boolean;
65
+ content: string;
66
+ placement: AppTooltipPlacement;
67
+ trigger: AppTooltipTrigger;
68
+ }, SlotsType<{
69
+ default?: () => VNodeChild;
70
+ }>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
@@ -0,0 +1,48 @@
1
+ import { defineComponent, createVNode } from "vue";
2
+ import { FTooltip } from "@farris/ui-vue";
3
+ const AppTooltip = /* @__PURE__ */ defineComponent({
4
+ name: "AppTooltip",
5
+ inheritAttrs: false,
6
+ props: {
7
+ content: {
8
+ type: String,
9
+ default: ""
10
+ },
11
+ placement: {
12
+ type: String,
13
+ default: "top"
14
+ },
15
+ trigger: {
16
+ type: String,
17
+ default: "hover"
18
+ },
19
+ /** 固定宽度,如 '200px'(设置后解除最大宽度限制) */
20
+ width: {
21
+ type: String,
22
+ default: void 0
23
+ },
24
+ disabled: {
25
+ type: Boolean,
26
+ default: false
27
+ }
28
+ },
29
+ slots: Object,
30
+ setup(props, {
31
+ slots,
32
+ attrs
33
+ }) {
34
+ return () => createVNode(FTooltip, {
35
+ "content": props.content,
36
+ "placement": props.placement,
37
+ "trigger": props.trigger,
38
+ "width": props.width,
39
+ "enable": !props.disabled,
40
+ "customClass": ["ak-tooltip", attrs.class].filter(Boolean).join(" ")
41
+ }, {
42
+ default: () => [slots.default?.()]
43
+ });
44
+ }
45
+ });
46
+ export {
47
+ AppTooltip
48
+ };