fx-platform-ui 0.0.1

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.
File without changes
package/src/index.ts ADDED
@@ -0,0 +1,17 @@
1
+ import PlatCard from './components/Card/index'
2
+
3
+ const components = [PlatCard]
4
+
5
+ // @ts-ignore
6
+ const install = (app) => {
7
+ components.map((item) => {
8
+ app.component(item.name, item)
9
+ })
10
+ }
11
+ const PlatUI = {
12
+ install
13
+ }
14
+
15
+ // 支持按需导入
16
+ export { PlatCard }
17
+ export default PlatUI
package/src/main.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { createApp } from 'vue'
2
+ import './style.css'
3
+ import App from './App.vue'
4
+
5
+ createApp(App).mount('#app')
package/src/style.css ADDED
@@ -0,0 +1,81 @@
1
+ :root {
2
+ font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
3
+ font-size: 16px;
4
+ line-height: 24px;
5
+ font-weight: 400;
6
+
7
+ color-scheme: light dark;
8
+ color: rgba(255, 255, 255, 0.87);
9
+ background-color: #242424;
10
+
11
+ font-synthesis: none;
12
+ text-rendering: optimizeLegibility;
13
+ -webkit-font-smoothing: antialiased;
14
+ -moz-osx-font-smoothing: grayscale;
15
+ -webkit-text-size-adjust: 100%;
16
+ }
17
+
18
+ a {
19
+ font-weight: 500;
20
+ color: #646cff;
21
+ text-decoration: inherit;
22
+ }
23
+ a:hover {
24
+ color: #535bf2;
25
+ }
26
+
27
+ body {
28
+ margin: 0;
29
+ display: flex;
30
+ place-items: center;
31
+ min-width: 320px;
32
+ min-height: 100vh;
33
+ }
34
+
35
+ h1 {
36
+ font-size: 3.2em;
37
+ line-height: 1.1;
38
+ }
39
+
40
+ button {
41
+ border-radius: 8px;
42
+ border: 1px solid transparent;
43
+ padding: 0.6em 1.2em;
44
+ font-size: 1em;
45
+ font-weight: 500;
46
+ font-family: inherit;
47
+ background-color: #1a1a1a;
48
+ cursor: pointer;
49
+ transition: border-color 0.25s;
50
+ }
51
+ button:hover {
52
+ border-color: #646cff;
53
+ }
54
+ button:focus,
55
+ button:focus-visible {
56
+ outline: 4px auto -webkit-focus-ring-color;
57
+ }
58
+
59
+ .card {
60
+ padding: 2em;
61
+ }
62
+
63
+ #app {
64
+ max-width: 1280px;
65
+ margin: 0 auto;
66
+ padding: 2rem;
67
+ text-align: center;
68
+ }
69
+
70
+ @media (prefers-color-scheme: light) {
71
+ :root {
72
+ color: #213547;
73
+ background-color: #ffffff;
74
+ }
75
+ a:hover {
76
+ color: #747bff;
77
+ }
78
+ button {
79
+ background-color: #f9f9f9;
80
+ }
81
+ }
@@ -0,0 +1,7 @@
1
+ /// <reference types="vite/client" />
2
+
3
+ declare module '*.vue' {
4
+ import type { DefineComponent } from 'vue'
5
+ const component: DefineComponent<{}, {}, any>
6
+ export default component
7
+ }
package/types/env.d.ts ADDED
@@ -0,0 +1,21 @@
1
+ /// <reference types="vite/client" />
2
+
3
+ interface ImportMetaEnv {
4
+ /** 网站标题 */
5
+ readonly VITE_APP_TITLE: string
6
+ /** 网站部署的目录 */
7
+ readonly VITE_BASE_URL: string
8
+ /** API 接口路径 */
9
+ readonly VITE_BASE_API: string
10
+ /** socket 请求路径前缀 */
11
+ readonly VITE_BASE_SOCKET_PATH: string
12
+ /** socket 命名空间 */
13
+ readonly VITE_BASE_SOCKET_NSP: string
14
+ /** mock API 路径 */
15
+ readonly VITE_MOCK_API: string
16
+ // 更多环境变量...
17
+ }
18
+
19
+ interface ImportMeta {
20
+ readonly env: ImportMetaEnv
21
+ }
@@ -0,0 +1,81 @@
1
+ import packageJSON from '../package.json'
2
+ import type {
3
+ ComponentRenderProxy,
4
+ VNode,
5
+ VNodeChild,
6
+ SetupContext,
7
+ EmitsOptions,
8
+ PropType as VuePropType
9
+ } from 'vue'
10
+
11
+ declare global {
12
+ const __APP_INFO__: {
13
+ pkg: typeof packageJSON
14
+ lastBuildTime: string
15
+ }
16
+ // declare interface Window {
17
+ // // Global vue app instance
18
+ // __APP__: App<Element>;
19
+ // }
20
+
21
+ // vue
22
+ declare type PropType<T> = VuePropType<T>
23
+ declare type VueNode = VNodeChild | JSX.Element
24
+
25
+ export type Writable<T> = {
26
+ -readonly [P in keyof T]: T[P]
27
+ }
28
+ type RemoveIndex<T> = {
29
+ [K in keyof T as string extends K ? never : number extends K ? never : K]: T[K]
30
+ }
31
+ declare type Nullable<T> = T | null
32
+ declare type NonNullable<T> = T extends null | undefined ? never : T
33
+ declare type Recordable<T = any> = Record<string, T>
34
+ declare type ReadonlyRecordable<T = any> = {
35
+ readonly [key: string]: T
36
+ }
37
+ declare type Indexable<T = any> = {
38
+ [key: string]: T
39
+ }
40
+ declare type DeepPartial<T> = {
41
+ [P in keyof T]?: DeepPartial<T[P]>
42
+ }
43
+
44
+ declare type TimeoutHandle = ReturnType<typeof setTimeout>
45
+ declare type IntervalHandle = ReturnType<typeof setInterval>
46
+
47
+ declare interface ChangeEvent extends Event {
48
+ target: HTMLInputElement
49
+ }
50
+
51
+ declare interface WheelEvent {
52
+ path?: EventTarget[]
53
+ }
54
+ declare function parseInt(s: string | number, radix?: number): number
55
+
56
+ declare function parseFloat(string: string | number): number
57
+
58
+ declare type EmitFn<E = EmitsOptions> = SetupContext<E>['emit']
59
+
60
+ namespace JSX {
61
+ // tslint:disable no-empty-interface
62
+ type Element = VNode
63
+ // tslint:disable no-empty-interface
64
+ type ElementClass = ComponentRenderProxy
65
+ interface ElementAttributesProperty {
66
+ $props: any
67
+ }
68
+ interface IntrinsicElements {
69
+ [elem: string]: any
70
+ }
71
+ interface IntrinsicAttributes {
72
+ [elem: string]: any
73
+ }
74
+ }
75
+ }
76
+
77
+ declare module 'vue' {
78
+ export type JSXComponent<Props = any> =
79
+ | { new (): ComponentPublicInstance<Props> }
80
+ | FunctionalComponent<Props>
81
+ }
@@ -0,0 +1,27 @@
1
+ declare interface Fn<T = any, R = T> {
2
+ (...arg: T[]): R
3
+ }
4
+
5
+ declare interface PromiseFn<T = any, R = T> {
6
+ (...arg: T[]): Promise<R>
7
+ }
8
+
9
+ declare type RefType<T> = T | null
10
+
11
+ declare type LabelValueOptions = {
12
+ label: string
13
+ value: any
14
+ [key: string]: string | number | boolean
15
+ }[]
16
+
17
+ declare type EmitType = (event: string, ...args: any[]) => void
18
+
19
+ declare type TargetContext = '_self' | '_blank'
20
+
21
+ declare interface ComponentElRef<T extends HTMLElement = HTMLDivElement> {
22
+ $el: T
23
+ }
24
+
25
+ declare type ComponentRef<T extends HTMLElement = HTMLDivElement> = ComponentElRef<T> | null
26
+
27
+ declare type ElRef<T extends HTMLElement = HTMLDivElement> = Nullable<T>
@@ -0,0 +1,21 @@
1
+ declare module '*.vue' {
2
+ import { DefineComponent } from 'vue'
3
+ const Component: DefineComponent<{}, {}, any>
4
+ export default Component
5
+ }
6
+
7
+ declare module 'mitt' {
8
+ import mitt from 'mitt'
9
+ export default mitt
10
+ }
11
+
12
+ declare module 'ant-design-vue/es/locale/*' {
13
+ import { Locale } from 'ant-design-vue/types/locale-provider'
14
+ const locale: Locale & ReadonlyRecordable
15
+ export default locale as Locale & ReadonlyRecordable
16
+ }
17
+
18
+ declare module 'virtual:*' {
19
+ const result: any
20
+ export default result
21
+ }
@@ -0,0 +1,67 @@
1
+ declare module '*.bmp' {
2
+ const src: string
3
+ export default src
4
+ }
5
+
6
+ declare module '*.gif' {
7
+ const src: string
8
+ export default src
9
+ }
10
+
11
+ declare module '*.jpg' {
12
+ const src: string
13
+ export default src
14
+ }
15
+
16
+ declare module '*.jpeg' {
17
+ const src: string
18
+ export default src
19
+ }
20
+
21
+ declare module '*.png' {
22
+ const src: string
23
+ export default src
24
+ }
25
+
26
+ declare module '*.webp' {
27
+ const src: string
28
+ export default src
29
+ }
30
+
31
+ declare module '*.module.css' {
32
+ const classes: { readonly [key: string]: string }
33
+ export default classes
34
+ }
35
+
36
+ declare module '*.module.scss' {
37
+ const classes: { readonly [key: string]: string }
38
+ export default classes
39
+ }
40
+
41
+ declare module '*.module.less' {
42
+ const classes: { readonly [key: string]: string }
43
+ export default classes
44
+ }
45
+
46
+ declare module '*.module.sass' {
47
+ const classes: { readonly [key: string]: string }
48
+ export default classes
49
+ }
50
+
51
+ declare module 'moment/locale/*' {
52
+ const LocaleMessage: { [key: string]: any }
53
+ export default LocaleMessage
54
+ }
55
+
56
+ declare module 'ant-design-vue/es/locale-provider/*' {
57
+ const LocaleMessage: { [key: string]: any }
58
+ export default LocaleMessage
59
+ }
60
+
61
+ // ant-design-vue/es/base
62
+ declare module 'ant-design-vue/es/base' {
63
+ class Base {
64
+ static install(vue: typeof Vue): void
65
+ }
66
+ export default Base
67
+ }
@@ -0,0 +1,18 @@
1
+ import Vue, { VNode } from 'vue'
2
+
3
+ declare module '*.tsx' {
4
+ import Vue from 'compatible-vue'
5
+ export default Vue
6
+ }
7
+
8
+ declare global {
9
+ namespace JSX {
10
+ // tslint:disable no-empty-interface
11
+ type Element = VNode
12
+ // tslint:disable no-empty-interface
13
+ type ElementClass = Vue
14
+ interface IntrinsicElements {
15
+ [elem: string]: any
16
+ }
17
+ }
18
+ }
@@ -0,0 +1,21 @@
1
+ import type { PermissionType } from '@/core/permission/modules/types'
2
+
3
+ // declare module '*.vue' {
4
+ // import * as vue from 'vue';
5
+ // export declare const render: vue.RootRenderFunction<Element | DocumentFragment>
6
+ // }
7
+
8
+ declare module '@vue/runtime-core' {
9
+ export interface ComponentCustomProperties {
10
+ $auth: (perm: PermissionType) => boolean
11
+ Reflect: Reflect
12
+ }
13
+ }
14
+
15
+ declare type Nullable<T> = T | null
16
+
17
+ declare type CustomizedHTMLElement<T> = HTMLElement & T
18
+
19
+ declare type Indexable<T> = {
20
+ [key: string]: T
21
+ }
@@ -0,0 +1,77 @@
1
+ /** 提取Promise返回值 */
2
+ type UnboxPromise<T extends Promise<any>> = T extends Promise<infer U>
3
+ ? U
4
+ : never
5
+
6
+ /** 将联合类型转为交叉类型 */
7
+ declare type UnionToIntersection<U> = (
8
+ U extends any ? (k: U) => void : never
9
+ ) extends (k: infer I) => void
10
+ ? I
11
+ : never
12
+
13
+ /** eg: types result = StringToUnion<'abc'> 结果:'a'|'b'|'c'*/
14
+ type StringToUnion<S extends string> = S extends `${infer S1}${infer S2}`
15
+ ? S1 | StringToUnion<S2>
16
+ : never
17
+
18
+ /** 字符串替换,类似js的字符串replace方法 */
19
+ type Replace<
20
+ Str extends string,
21
+ From extends string,
22
+ To extends string
23
+ > = Str extends `${infer Left}${From}${infer Right}`
24
+ ? `${Left}${To}${Right}`
25
+ : Str
26
+
27
+ /** 字符串替换,类似js的字符串replaceAll方法 */
28
+ type ReplaceAll<
29
+ Str extends string,
30
+ From extends string,
31
+ To extends string
32
+ > = Str extends `${infer Left}${From}${infer Right}`
33
+ ? Replace<Replace<`${Left}${To}${Right}`, From, To>, From, To>
34
+ : Str
35
+
36
+ /** eg: types result = CamelCase<'foo-bar-baz'>, 结果:fooBarBaz */
37
+ type CamelCase<S extends string> = S extends `${infer S1}-${infer S2}`
38
+ ? S2 extends Capitalize<S2>
39
+ ? `${S1}-${CamelCase<S2>}`
40
+ : `${S1}${CamelCase<Capitalize<S2>>}`
41
+ : S
42
+
43
+ /** eg: types result = StringToArray<'abc'>, 结果:['a', 'b', 'c'] */
44
+ type StringToArray<
45
+ S extends string,
46
+ T extends any[] = []
47
+ > = S extends `${infer S1}${infer S2}` ? StringToArray<S2, [...T, S1]> : T
48
+
49
+ /** `RequiredKeys`是用来获取所有必填字段,其中这些必填字段组合成一个联合类型 */
50
+ type RequiredKeys<T> = {
51
+ [P in keyof T]: T extends Record<P, T[P]> ? P : never
52
+ }[keyof T]
53
+
54
+ /** `OptionalKeys`是用来获取所有可选字段,其中这些可选字段组合成一个联合类型 */
55
+ type OptionalKeys<T> = {
56
+ [P in keyof T]: {} extends Pick<T, P> ? P : never
57
+ }[keyof T]
58
+
59
+ /** `GetRequired`是用来获取一个类型中,所有必填键及其类型所组成的一个新类型的 */
60
+ type GetRequired<T> = {
61
+ [P in RequiredKeys<T>]-?: T[P]
62
+ }
63
+
64
+ /** `GetOptional`是用来获取一个类型中,所有可选键及其类型所组成的一个新类型的 */
65
+ type GetOptional<T> = {
66
+ [P in OptionalKeys<T>]?: T[P]
67
+ }
68
+
69
+ /** types result1 = Includes<[1, 2, 3, 4], '4'> 结果: false; types result2 = Includes<[1, 2, 3, 4], 4> 结果: true */
70
+ type Includes<T extends any[], K> = K extends T[number] ? true : false
71
+
72
+ /** eg:types result = MyConcat<[1, 2], [3, 4]> 结果:[1, 2, 3, 4]*/
73
+ type MyConcat<T extends any[], U extends any[]> = [...T, ...U]
74
+ /** eg: types result1 = MyPush<[1, 2, 3], 4> 结果:[1, 2, 3, 4] */
75
+ type MyPush<T extends any[], K> = [...T, K]
76
+ /** eg: types result3 = MyPop<[1, 2, 3]> 结果:[1, 2] */
77
+ type MyPop<T extends any[]> = T extends [...infer L, infer R] ? L : never // eslint-disable-line
@@ -0,0 +1,45 @@
1
+ import { type RouteMeta as VRouteMeta } from 'vue-router'
2
+ import { type PermissionType } from '@/core/permission/modules/types'
3
+ import { type LocaleType } from '@/locales/config'
4
+
5
+ declare global {
6
+ type Title18n = {
7
+ [p in LocaleType]: string
8
+ }
9
+ }
10
+
11
+ declare module 'vue-router' {
12
+ interface RouteMeta extends VRouteMeta {
13
+ /** 标题 */
14
+ title: string | Title18n
15
+ /** 当前菜单类型 0: 目录 | 1: 菜单 | 2: 权限 */
16
+ type?: 0 | 1 | 2
17
+ /** 当前路由权限 */
18
+ perms?: PermissionType[]
19
+ /** 是否需要缓存 */
20
+ keepAlive?: boolean
21
+ /** 当前路由namePath 祖先name集合 */
22
+ namePath?: string[]
23
+ /** 当前路由所在的完整路径 */
24
+ fullPath?: string
25
+ /** 是否固定在标签栏 */
26
+ affix?: boolean
27
+ /** 菜单图标 */
28
+ icon?: string
29
+ /** 当前页面切换动画 */
30
+ transitionName?: string | false
31
+ /** @name 在菜单中隐藏子节点 */
32
+ hideChildrenInMenu?: boolean
33
+ /** 不在菜单中显示 */
34
+ hideInMenu?: boolean
35
+ /** 不在面包屑导航中显示 */
36
+ hideInBreadcrumb?: boolean
37
+ /** 不在tab标签页中显示 */
38
+ hideInTabs?: boolean
39
+ /** 设置当前路由高亮的菜单项,值为route fullPath或route name,一般用于详情页 */
40
+ activeMenu?: string
41
+ /** 菜单排序号 */
42
+ orderNum?: number
43
+ isLink?: boolean
44
+ }
45
+ }