sakura-ui-plus 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.
Files changed (55) hide show
  1. package/dist/es/index.js +1852 -0
  2. package/dist/lib/index.js +1852 -0
  3. package/dist/style.css +4573 -0
  4. package/dist/types/components/cell/cell-group.vue.d.ts +21 -0
  5. package/dist/types/components/cell/cell.vue.d.ts +18 -0
  6. package/dist/types/components/cell/constant.d.ts +3 -0
  7. package/dist/types/components/cell/props.d.ts +9 -0
  8. package/dist/types/components/container/container.vue.d.ts +20 -0
  9. package/dist/types/components/container/props.d.ts +3 -0
  10. package/dist/types/components/count-down/count-down.vue.d.ts +10 -0
  11. package/dist/types/components/count-down/props.d.ts +7 -0
  12. package/dist/types/components/dialog/dialog.vue.d.ts +58 -0
  13. package/dist/types/components/dialog/props.d.ts +35 -0
  14. package/dist/types/components/drawer/drawer.vue.d.ts +58 -0
  15. package/dist/types/components/drawer/props.d.ts +34 -0
  16. package/dist/types/components/file/item.vue.d.ts +24 -0
  17. package/dist/types/components/file/list.vue.d.ts +8 -0
  18. package/dist/types/components/file/props.d.ts +17 -0
  19. package/dist/types/components/filter/constant.d.ts +3 -0
  20. package/dist/types/components/filter/filter-group.vue.d.ts +26 -0
  21. package/dist/types/components/filter/filter-item.vue.d.ts +22 -0
  22. package/dist/types/components/filter/props.d.ts +13 -0
  23. package/dist/types/components/index.d.ts +2092 -0
  24. package/dist/types/components/pagination/pagination.vue.d.ts +23 -0
  25. package/dist/types/components/pagination/props.d.ts +16 -0
  26. package/dist/types/components/register-components.d.ts +11 -0
  27. package/dist/types/components/search-input/props.d.ts +10 -0
  28. package/dist/types/components/search-input/search-input.vue.d.ts +19 -0
  29. package/dist/types/components/select/props.d.ts +31 -0
  30. package/dist/types/components/select/select.vue.d.ts +2958 -0
  31. package/dist/types/components/show-modal/install.d.ts +5 -0
  32. package/dist/types/components/show-modal/props.d.ts +19 -0
  33. package/dist/types/components/show-modal/show-modal.vue.d.ts +14 -0
  34. package/dist/types/components/show-modal/utils.d.ts +6 -0
  35. package/dist/types/components/status/props.d.ts +7 -0
  36. package/dist/types/components/status/status.vue.d.ts +20 -0
  37. package/dist/types/components/tabs/props.d.ts +7 -0
  38. package/dist/types/components/tabs/tabs.vue.d.ts +30 -0
  39. package/dist/types/components/tooltip-text/props.d.ts +9 -0
  40. package/dist/types/components/tooltip-text/tooltip-text.vue.d.ts +11 -0
  41. package/dist/types/constants/event.d.ts +61 -0
  42. package/dist/types/constants/index.d.ts +1 -0
  43. package/dist/types/hooks/index.d.ts +7 -0
  44. package/dist/types/hooks/use-callback-trigger/index.d.ts +10 -0
  45. package/dist/types/hooks/use-loading/index.d.ts +10 -0
  46. package/dist/types/hooks/use-message/index.d.ts +4 -0
  47. package/dist/types/hooks/use-message-box/index.d.ts +8 -0
  48. package/dist/types/hooks/use-namespace/index.d.ts +26 -0
  49. package/dist/types/hooks/use-notification/index.d.ts +8 -0
  50. package/dist/types/hooks/use-notification/type.d.ts +65 -0
  51. package/dist/types/hooks/use-show-modal/index.d.ts +2 -0
  52. package/dist/types/index.d.ts +10 -0
  53. package/dist/types/types/index.d.ts +28 -0
  54. package/dist/types/utils/index.d.ts +6 -0
  55. package/package.json +79 -0
@@ -0,0 +1,5 @@
1
+ import { App } from 'vue';
2
+ declare const _default: {
3
+ install(vm: App): void;
4
+ };
5
+ export default _default;
@@ -0,0 +1,19 @@
1
+ import { DialogProps } from '../dialog/props.ts';
2
+ import { VNode } from 'vue';
3
+ export type ShowModalProps = Pick<DialogProps, 'width' | 'showConfirmButton' | 'showCancelButton' | 'cancelButtonText' | 'confirmButtonText' | 'showClose' | 'title'> & {
4
+ content?: string | VNode | Function;
5
+ resolve?: Function;
6
+ };
7
+ /**
8
+ * 模态窗函数类型
9
+ */
10
+ export type ShowModalFn = {
11
+ /**
12
+ * 模态窗
13
+ * @param content 内容
14
+ * @param title 标题
15
+ * @param showCancelButton 是否显示取消按钮
16
+ * @param params
17
+ */
18
+ (content: string | VNode | Function, title?: string, showCancelButton?: boolean, params?: Omit<ShowModalProps, 'title' | 'content' | 'showCancelButton'>): Promise<boolean>;
19
+ };
@@ -0,0 +1,14 @@
1
+ import { ShowModalProps } from './props.ts';
2
+ type __VLS_Props = ShowModalProps;
3
+ declare const visible: import('vue').ModelRef<boolean, string, boolean, boolean>;
4
+ type __VLS_PublicProps = {
5
+ 'modelValue'?: typeof visible['value'];
6
+ } & __VLS_Props;
7
+ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {
8
+ visibleShowModal: import('@vueuse/core').PromisifyFn<(content?: string, title?: string, showCancelButton?: any, params?: ShowModalProps) => Promise<boolean>>;
9
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
10
+ "update:modelValue": (value: boolean) => any;
11
+ }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
12
+ "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
13
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
14
+ export default _default;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 验证标签字符串是否为合法 DOM 结构
3
+ * @param html 完整标签字符串
4
+ * @returns { boolean } 是否合法
5
+ */
6
+ export declare const validateHtmlString: (html: string) => boolean;
@@ -0,0 +1,7 @@
1
+ import { ComponentType } from '../../types';
2
+ export type StatusProps = {
3
+ type?: ComponentType;
4
+ text?: string;
5
+ color?: string;
6
+ plain?: boolean;
7
+ };
@@ -0,0 +1,20 @@
1
+ import { StatusProps } from './props';
2
+ declare function __VLS_template(): {
3
+ attrs: Partial<{}>;
4
+ slots: {
5
+ default?(_: {}): any;
6
+ };
7
+ refs: {};
8
+ rootEl: HTMLSpanElement;
9
+ };
10
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
11
+ declare const __VLS_component: import('vue').DefineComponent<StatusProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<StatusProps> & Readonly<{}>, {
12
+ type: import('../..').ComponentType;
13
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLSpanElement>;
14
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
15
+ export default _default;
16
+ type __VLS_WithTemplateSlots<T, S> = T & {
17
+ new (): {
18
+ $slots: S;
19
+ };
20
+ };
@@ -0,0 +1,7 @@
1
+ import { OptionsItem } from '../../types';
2
+ export type TabsProps = {
3
+ options: OptionsItem[];
4
+ };
5
+ export type TabsEmits = {
6
+ change: [value?: any];
7
+ };
@@ -0,0 +1,30 @@
1
+ import { TabsProps } from './props.ts';
2
+ type __VLS_Props = TabsProps;
3
+ type __VLS_PublicProps = {
4
+ 'modelValue'?: any;
5
+ } & __VLS_Props;
6
+ declare function __VLS_template(): {
7
+ attrs: Partial<{}>;
8
+ slots: {
9
+ default?(_: {
10
+ data: import('../../index.ts').OptionsItem;
11
+ }): any;
12
+ };
13
+ refs: {};
14
+ rootEl: HTMLDivElement;
15
+ };
16
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
17
+ declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
18
+ change: (value?: any) => any;
19
+ "update:modelValue": (value: any) => any;
20
+ }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
21
+ onChange?: ((value?: any) => any) | undefined;
22
+ "onUpdate:modelValue"?: ((value: any) => any) | undefined;
23
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
24
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
25
+ export default _default;
26
+ type __VLS_WithTemplateSlots<T, S> = T & {
27
+ new (): {
28
+ $slots: S;
29
+ };
30
+ };
@@ -0,0 +1,9 @@
1
+ export type TooltipTextProps = {
2
+ truncated?: boolean;
3
+ fontSize?: number;
4
+ content: string;
5
+ fontWeight?: boolean;
6
+ color?: string;
7
+ width?: string | number;
8
+ effect?: 'dark' | 'light';
9
+ };
@@ -0,0 +1,11 @@
1
+ import { TooltipTextProps } from './props.ts';
2
+ declare const _default: import('vue').DefineComponent<TooltipTextProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<TooltipTextProps> & Readonly<{}>, {
3
+ width: string | number;
4
+ effect: "dark" | "light";
5
+ truncated: boolean;
6
+ fontSize: number;
7
+ fontWeight: boolean;
8
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
9
+ tooltipTextRef: HTMLDivElement;
10
+ }, HTMLDivElement>;
11
+ export default _default;
@@ -0,0 +1,61 @@
1
+ /**
2
+ * 事件名称
3
+ */
4
+ export declare enum EVENT_NAME {
5
+ /**
6
+ * 改变
7
+ */
8
+ 改变 = "change",
9
+ /**
10
+ * 发送
11
+ */
12
+ 发送 = "send",
13
+ /**
14
+ * 点击
15
+ */
16
+ 点击 = "tap",
17
+ /**
18
+ * 确认
19
+ */
20
+ 确认 = "confirm",
21
+ /**
22
+ * 搜索
23
+ */
24
+ 搜索 = "search",
25
+ /**
26
+ * 扫码
27
+ */
28
+ 扫码 = "scan",
29
+ /**
30
+ * 保存
31
+ */
32
+ 保存 = "save",
33
+ /**
34
+ * 下载
35
+ */
36
+ 下载 = "download",
37
+ /**
38
+ * 返回
39
+ */
40
+ 返回 = "back",
41
+ /**
42
+ * 预览
43
+ */
44
+ 预览 = "preview",
45
+ /**
46
+ * 删除
47
+ */
48
+ 删除 = "delete",
49
+ /**
50
+ * 重置
51
+ */
52
+ 重置 = "reset",
53
+ /**
54
+ * 关闭
55
+ */
56
+ 关闭 = "close",
57
+ /**
58
+ * 提交
59
+ */
60
+ 提交 = "submit"
61
+ }
@@ -0,0 +1 @@
1
+ export * from './event.ts';
@@ -0,0 +1,7 @@
1
+ export * from './use-namespace';
2
+ export * from './use-callback-trigger';
3
+ export * from './use-show-modal';
4
+ export * from './use-loading';
5
+ export * from './use-message';
6
+ export * from './use-message-box';
7
+ export * from './use-notification';
@@ -0,0 +1,10 @@
1
+ /**
2
+ * 回调触发
3
+ */
4
+ export declare const useCallbackTrigger: <T = any>() => {
5
+ callbackSet: Set<Function>;
6
+ track: (fn?: Function) => void;
7
+ trigger: (...args: T[]) => void;
8
+ clear: () => void;
9
+ delete: (fn: Function) => void;
10
+ };
@@ -0,0 +1,10 @@
1
+ import { LoadingOptionsResolved } from 'element-plus';
2
+ /**
3
+ * 二次封装饿了么loading弹窗
4
+ * @param background 背景颜色
5
+ * @param lock 是否锁定
6
+ */
7
+ export declare const useLoading: (background?: string, lock?: boolean) => {
8
+ show: (text?: string, params?: LoadingOptionsResolved) => void;
9
+ hide: () => void;
10
+ };
@@ -0,0 +1,4 @@
1
+ /**
2
+ * 提示窗
3
+ */
4
+ export declare const useMessage: () => import('element-plus/es/utils/index.mjs').SFCInstallWithContext<import('element-plus').Message>;
@@ -0,0 +1,8 @@
1
+ import { ElMessageBoxOptions } from 'element-plus/es/components/message-box/src/message-box.type';
2
+ import { VNode } from 'vue';
3
+ /**
4
+ * 二次封装消息弹出框
5
+ * @param _closeOnClickModal 是否可通过点击遮罩层关闭 MessageBox 默认true
6
+ * @param _closeOnPressEscape 是否可通过按下 ESC 键关闭 MessageBox 默认true
7
+ */
8
+ export declare const useMessageBox: (_closeOnClickModal?: boolean, _closeOnPressEscape?: boolean) => (message: string | VNode | (() => VNode), title?: string, showCancelButton?: boolean, params?: ElMessageBoxOptions) => Promise<boolean>;
@@ -0,0 +1,26 @@
1
+ import { Ref } from 'vue';
2
+ /**
3
+ * 默认的命名空间前缀
4
+ */
5
+ export declare const defaultNamespace = "sakura";
6
+ /**
7
+ * 创建组件的命名空间
8
+ * @param block 组件名称
9
+ * @param namespaceOverrides 传递了的话就会重写命名空间不传则”s“
10
+ */
11
+ export declare const useNamespace: (block: string, namespaceOverrides?: Ref<string | undefined> | string) => {
12
+ b: (blockSuffix?: string) => string;
13
+ e: (element?: string) => string;
14
+ m: (modifier?: string) => string;
15
+ be: (blockSuffix?: string, element?: string) => string;
16
+ em: (element?: string, modifier?: string) => string;
17
+ bm: (blockSuffix?: string, modifier?: string) => string;
18
+ bem: (blockSuffix?: string, element?: string, modifier?: string) => string;
19
+ is: (name: string, ...args: any[]) => string;
20
+ cssVar: (object: Record<string, any>) => Record<string, any>;
21
+ cssBlockVar: (block: string, object: Record<string, any>) => Record<string, any>;
22
+ cssVarName: (name: string) => string;
23
+ cssBlockVarName: (block: string, name: string) => string;
24
+ cssVarNameValue: (name: string) => string;
25
+ cssBlockVarNameValue: (block: string, name: string) => string;
26
+ };
@@ -0,0 +1,8 @@
1
+ import { Notification, PositionType } from './type.ts';
2
+ /**
3
+ * 通知管理
4
+ * @param duration 显示时间, 单位为毫秒。 值为 0 则不会自动关闭 默认8000
5
+ * @param showClose 是否显示关闭按钮 默认显示
6
+ * @param position 自定义弹出位置 默认 to-right
7
+ */
8
+ export declare const useNotification: (duration?: number, showClose?: boolean, position?: PositionType) => Notification;
@@ -0,0 +1,65 @@
1
+ import { NotificationOptions } from 'element-plus/es/components/notification/src/notification';
2
+ import { VNode } from 'vue';
3
+ /**
4
+ * 通知类型
5
+ * - success 成功 绿色
6
+ * - error 失败 红色
7
+ * - warning 警告 黄色
8
+ * - info 内容 灰色
9
+ * - tips 蓝色
10
+ */
11
+ export type NotificationTypes = 'success' | 'warning' | 'error' | 'info' | 'tips' | '';
12
+ /**
13
+ * 通知函数返回内容
14
+ */
15
+ type NotificationHandler = {
16
+ close: () => void;
17
+ };
18
+ /**
19
+ * 选项
20
+ */
21
+ export type NotificationParams = Partial<NotificationOptions> & {
22
+ type?: NotificationTypes;
23
+ };
24
+ /**
25
+ * 函数类型
26
+ */
27
+ export type NotificationFn = {
28
+ (message: string | VNode, title: string, options?: NotificationParams): NotificationHandler;
29
+ };
30
+ /**
31
+ * 类型函数类型
32
+ */
33
+ export type NotificationTypeFn = {
34
+ (message: string | VNode, title?: string, options?: NotificationParams): NotificationHandler;
35
+ };
36
+ /**
37
+ * 位置类型
38
+ */
39
+ export type PositionType = 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
40
+ /**
41
+ * 通知实例
42
+ */
43
+ export interface Notification extends NotificationFn {
44
+ /**
45
+ * 成功
46
+ */
47
+ success: NotificationTypeFn;
48
+ /**
49
+ * 失败
50
+ */
51
+ error: NotificationTypeFn;
52
+ /**
53
+ * 信息
54
+ */
55
+ info: NotificationTypeFn;
56
+ /**
57
+ * 提示-黄色
58
+ */
59
+ warning: NotificationTypeFn;
60
+ /**
61
+ * 提示-蓝色
62
+ */
63
+ tips: NotificationTypeFn;
64
+ }
65
+ export {};
@@ -0,0 +1,2 @@
1
+ import { ShowModalFn } from '../../components/show-modal/props.ts';
2
+ export declare const useShowModal: () => ShowModalFn;
@@ -0,0 +1,10 @@
1
+ import { default as install } from './components/register-components.ts';
2
+ export * from './hooks';
3
+ export * from './types';
4
+ export * from './utils';
5
+ export * from './constants';
6
+ export * from './components';
7
+ declare const SakuraUiPlus: {
8
+ install: typeof install;
9
+ };
10
+ export default SakuraUiPlus;
@@ -0,0 +1,28 @@
1
+ import { FILE_TYPE } from 'sakura-utils';
2
+ /**
3
+ * 类型
4
+ */
5
+ export type ComponentType = 'primary' | 'success' | 'danger' | 'warning' | 'info' | 'error' | '' | 'default';
6
+ /**
7
+ * 尺寸
8
+ */
9
+ export type ComponentSize = 'small' | 'large' | 'default' | '';
10
+ /**
11
+ * 选项
12
+ */
13
+ export type OptionsItem<T = string, M = object> = {
14
+ label: string;
15
+ value: T;
16
+ disabled?: boolean;
17
+ } & Partial<M>;
18
+ /**
19
+ * 文件信息
20
+ */
21
+ export type FileInfo = {
22
+ fileId: string;
23
+ fileUrl: string;
24
+ fileName: string;
25
+ fileSuffix?: string;
26
+ fileSize?: number;
27
+ fileType: FILE_TYPE;
28
+ };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 检查标签是否存在,如不存在则直接创建并且塞入容器
3
+ * @param id id
4
+ * @param container id / class / tag
5
+ */
6
+ export declare const checkElementIsExist: (id: string, container?: string) => boolean;
package/package.json ADDED
@@ -0,0 +1,79 @@
1
+ {
2
+ "name": "sakura-ui-plus",
3
+ "version": "1.0.0",
4
+ "description": "开发常用组件",
5
+ "type": "module",
6
+ "sideEffects": [
7
+ "*.scss",
8
+ "*.css"
9
+ ],
10
+ "private": false,
11
+ "main": "./dist/lib/index.js",
12
+ "module": "./dist/es/index.js",
13
+ "types": "./dist/types/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/types/index.d.ts",
17
+ "import": "./dist/es/index.js",
18
+ "require": "./dist/lib/index.js"
19
+ },
20
+ "./es": {
21
+ "import": "./dist/es/index.js"
22
+ },
23
+ "./lib": {
24
+ "require": "./dist/lib/index.js"
25
+ },
26
+ "./style": {
27
+ "import": "./dist/style.css",
28
+ "require": "./dist/style.css"
29
+ },
30
+ "./dist/style.css": {
31
+ "import": "./dist/style.css",
32
+ "require": "./dist/style.css"
33
+ },
34
+ "./style.css": {
35
+ "import": "./dist/style.css",
36
+ "require": "./dist/style.css"
37
+ }
38
+ },
39
+ "files": [
40
+ "dist"
41
+ ],
42
+ "scripts": {
43
+ "dev": "vite",
44
+ "build": "vite build",
45
+ "build:types": "npx vue-tsc --declaration --emitDeclarationOnly --outDir dist/types",
46
+ "type-check": "npx vue-tsc --noEmit",
47
+ "test": "vitest",
48
+ "test:ui": "vitest --ui",
49
+ "test:coverage": "vitest run --coverage",
50
+ "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix",
51
+ "prepublishOnly": "npm run build"
52
+ },
53
+ "peerDependencies": {
54
+ "element-plus": "^2.13.0",
55
+ "@vueuse/core": "^12.3.0",
56
+ "sakura-utils": "^1.0.7",
57
+ "vue": "^3.3.0",
58
+ "@ctrl/tinycolor": "^3.6.0",
59
+ "@element-plus/icons-vue": "^2.3.1",
60
+ "dompurify": "^3.2.6"
61
+ },
62
+ "devDependencies": {
63
+ "@types/node": "^20.0.0",
64
+ "@vitejs/plugin-vue": "^4.0.0",
65
+ "@vitest/ui": "^0.34.0",
66
+ "@vue/test-utils": "^2.4.0",
67
+ "@vue/tsconfig": "^0.4.0",
68
+ "happy-dom": "^9.0.0",
69
+ "sass": "^1.97.0",
70
+ "typescript": "^5.0.0",
71
+ "unplugin-auto-import": "^0.19.0",
72
+ "unplugin-vue-components": "^0.28.0",
73
+ "vite": "^4.0.0",
74
+ "vite-plugin-dts": "^4.5.4",
75
+ "vitest": "^0.34.0",
76
+ "vue-tsc": "^3.2.1"
77
+ },
78
+ "dependencies": {}
79
+ }