@a2simcode/ui 0.0.35 → 0.0.37

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/LICENSE CHANGED
@@ -1,53 +1,53 @@
1
- 专有软件许可协议
2
-
3
- 版权所有 © 2024 苏州极简搭信息技术有限公司。保留所有权利。
4
-
5
- 本软件及其相关文档("软件")为专有软件,受版权法和国际条约保护。
6
-
7
- 许可限制:
8
-
9
- 1. 本软件仅授权给获得明确书面许可的用户使用。
10
-
11
- 2. 未经版权所有者事先书面同意,您不得:
12
- - 复制、修改、改编或翻译本软件
13
- - 对本软件进行反向工程、反编译或反汇编
14
- - 出租、出借、分发、转让或再许可本软件
15
- - 删除或修改本软件中的任何版权声明或其他所有权标记
16
-
17
- 3. 本软件按"现状"提供,不提供任何明示或暗示的保证,包括但不限于适销性、特定用途适用性和非侵权性的保证。
18
-
19
- 4. 在任何情况下,版权所有者均不对因使用或无法使用本软件而产生的任何索赔、损害或其他责任负责。
20
-
21
- 5. 本许可协议受中华人民共和国法律管辖。
22
-
23
- 如需获得使用许可,请联系版权所有者。
24
-
25
- ---
26
-
27
- PROPRIETARY SOFTWARE LICENSE
28
-
29
- Copyright © 2024 Suzhou Jijian-da Information Technology Co., Ltd. All rights reserved.
30
-
31
- This software and associated documentation files (the "Software") is proprietary
32
- software protected by copyright laws and international treaties.
33
-
34
- License Restrictions:
35
-
36
- 1. This Software is licensed only to users who have obtained explicit written permission.
37
-
38
- 2. Without prior written consent from the copyright holder, you may not:
39
- - Copy, modify, adapt, or translate the Software
40
- - Reverse engineer, decompile, or disassemble the Software
41
- - Rent, lease, distribute, transfer, or sublicense the Software
42
- - Remove or modify any copyright notices or other proprietary markings in the Software
43
-
44
- 3. The Software is provided "as is" without warranty of any kind, express or implied,
45
- including but not limited to warranties of merchantability, fitness for a particular
46
- purpose, and non-infringement.
47
-
48
- 4. In no event shall the copyright holder be liable for any claims, damages, or other
49
- liability arising from the use or inability to use the Software.
50
-
51
- 5. This license agreement is governed by the laws of the People's Republic of China.
52
-
53
- For licensing inquiries, please contact the copyright holder.
1
+ 专有软件许可协议
2
+
3
+ 版权所有 © 2024 苏州极简搭信息技术有限公司。保留所有权利。
4
+
5
+ 本软件及其相关文档("软件")为专有软件,受版权法和国际条约保护。
6
+
7
+ 许可限制:
8
+
9
+ 1. 本软件仅授权给获得明确书面许可的用户使用。
10
+
11
+ 2. 未经版权所有者事先书面同意,您不得:
12
+ - 复制、修改、改编或翻译本软件
13
+ - 对本软件进行反向工程、反编译或反汇编
14
+ - 出租、出借、分发、转让或再许可本软件
15
+ - 删除或修改本软件中的任何版权声明或其他所有权标记
16
+
17
+ 3. 本软件按"现状"提供,不提供任何明示或暗示的保证,包括但不限于适销性、特定用途适用性和非侵权性的保证。
18
+
19
+ 4. 在任何情况下,版权所有者均不对因使用或无法使用本软件而产生的任何索赔、损害或其他责任负责。
20
+
21
+ 5. 本许可协议受中华人民共和国法律管辖。
22
+
23
+ 如需获得使用许可,请联系版权所有者。
24
+
25
+ ---
26
+
27
+ PROPRIETARY SOFTWARE LICENSE
28
+
29
+ Copyright © 2024 Suzhou Jijian-da Information Technology Co., Ltd. All rights reserved.
30
+
31
+ This software and associated documentation files (the "Software") is proprietary
32
+ software protected by copyright laws and international treaties.
33
+
34
+ License Restrictions:
35
+
36
+ 1. This Software is licensed only to users who have obtained explicit written permission.
37
+
38
+ 2. Without prior written consent from the copyright holder, you may not:
39
+ - Copy, modify, adapt, or translate the Software
40
+ - Reverse engineer, decompile, or disassemble the Software
41
+ - Rent, lease, distribute, transfer, or sublicense the Software
42
+ - Remove or modify any copyright notices or other proprietary markings in the Software
43
+
44
+ 3. The Software is provided "as is" without warranty of any kind, express or implied,
45
+ including but not limited to warranties of merchantability, fitness for a particular
46
+ purpose, and non-infringement.
47
+
48
+ 4. In no event shall the copyright holder be liable for any claims, damages, or other
49
+ liability arising from the use or inability to use the Software.
50
+
51
+ 5. This license agreement is governed by the laws of the People's Republic of China.
52
+
53
+ For licensing inquiries, please contact the copyright holder.
package/README.md CHANGED
@@ -1,130 +1,130 @@
1
- # SimCode UI
2
-
3
- <div align="center">
4
- <h1>SimCode UI</h1>
5
- <p>基于 Vue 3 + TypeScript 的现代化 UI 组件库</p>
6
- </div>
7
-
8
- ## ✨ 特性
9
-
10
- - 🚀 **现代化技术栈**: 基于 Vue 3 + TypeScript + Vite
11
- - 📦 **开箱即用**: 提供完善的类型定义和文档
12
- - 🎨 **精美设计**: 现代化的设计风格
13
- - 🔧 **易于定制**: 支持主题定制
14
- - ⚡️ **按需加载**: 支持 Tree Shaking
15
- - 🧪 **完善测试**: 单元测试覆盖
16
-
17
- ## 📦 安装
18
-
19
- 使用 pnpm:
20
-
21
- ```bash
22
- pnpm add @a2simcode/ui
23
- ```
24
-
25
- 使用 npm:
26
-
27
- ```bash
28
- npm install @a2simcode/ui
29
- ```
30
-
31
- 使用 yarn:
32
-
33
- ```bash
34
- yarn add @a2simcode/ui
35
- ```
36
-
37
- ## 🔨 快速开始
38
-
39
- ### 完整引入
40
-
41
- ```typescript
42
- import { createApp } from 'vue'
43
- import App from './App.vue'
44
- import SimCodeUI from '@a2simcode/ui'
45
- import '@a2simcode/ui/dist/style.css'
46
-
47
- const app = createApp(App)
48
- app.use(SimCodeUI)
49
- app.mount('#app')
50
- ```
51
-
52
- ### 按需引入
53
-
54
- ```vue
55
- <template>
56
- <j-button type="primary">按钮</j-button>
57
- </template>
58
-
59
- <script setup lang="ts">
60
- import { JButton } from '@a2simcode/ui'
61
- import '@a2simcode/ui/dist/style.css'
62
- </script>
63
- ```
64
-
65
- ## 🎯 组件列表
66
-
67
- - ✅ Button 按钮
68
- - ✅ Input 输入框
69
- - ✅ Radio 单选框
70
- - 🚧 更多组件开发中...
71
-
72
- ## 💻 本地开发
73
-
74
- ```bash
75
- # 进入项目目录
76
- cd simcode-ui
77
-
78
- # 安装依赖
79
- pnpm install
80
-
81
- # 启动开发服务器
82
- pnpm dev
83
-
84
- # 构建组件库
85
- pnpm build
86
-
87
- # 运行测试
88
- pnpm test
89
-
90
- # 启动文档站点
91
- pnpm docs:dev
92
- ```
93
-
94
- ## 📁 项目结构
95
-
96
- ```
97
- simcode-ui/
98
- ├── packages/ # 组件源码
99
- │ ├── components/ # 组件
100
- │ │ ├── button/ # 按钮组件
101
- │ │ ├── input/ # 输入框组件
102
- │ │ └── index.ts # 组件入口
103
- │ └── theme/ # 主题样式
104
- │ └── src/ # 样式源码 (Less)
105
- ├── examples/ # 组件预览
106
- │ ├── App.vue # 预览应用
107
- │ └── main.ts # 入口文件
108
- ├── docs/ # 文档
109
- │ ├── .vitepress/ # VitePress 配置
110
- │ ├── guide/ # 指南
111
- │ └── components/ # 组件文档
112
- ├── __tests__/ # 测试文件
113
- ├── vite.config.ts # Vite 配置
114
- ├── vitest.config.ts # Vitest 配置
115
- └── package.json # 项目配置
116
- ```
117
-
118
- ## 🤝 贡献
119
-
120
- 欢迎提交 Issue 和 Pull Request!
121
-
122
- ## 📄 版权声明
123
-
124
- Copyright © 2024 苏州极简搭信息技术有限公司. All rights reserved.
125
-
126
- 本软件及其相关文档为专有软件,受版权法保护。未经版权所有者明确书面许可,不得以任何形式或方式(电子、机械、复印、录制或其他方式)复制、分发、传播或使用本软件的任何部分。
127
-
128
- ## 🙏 致谢
129
-
130
- 感谢所有为这个项目做出贡献的开发者!
1
+ # SimCode UI
2
+
3
+ <div align="center">
4
+ <h1>SimCode UI</h1>
5
+ <p>基于 Vue 3 + TypeScript 的现代化 UI 组件库</p>
6
+ </div>
7
+
8
+ ## ✨ 特性
9
+
10
+ - 🚀 **现代化技术栈**: 基于 Vue 3 + TypeScript + Vite
11
+ - 📦 **开箱即用**: 提供完善的类型定义和文档
12
+ - 🎨 **精美设计**: 现代化的设计风格
13
+ - 🔧 **易于定制**: 支持主题定制
14
+ - ⚡️ **按需加载**: 支持 Tree Shaking
15
+ - 🧪 **完善测试**: 单元测试覆盖
16
+
17
+ ## 📦 安装
18
+
19
+ 使用 pnpm:
20
+
21
+ ```bash
22
+ pnpm add @a2simcode/ui
23
+ ```
24
+
25
+ 使用 npm:
26
+
27
+ ```bash
28
+ npm install @a2simcode/ui
29
+ ```
30
+
31
+ 使用 yarn:
32
+
33
+ ```bash
34
+ yarn add @a2simcode/ui
35
+ ```
36
+
37
+ ## 🔨 快速开始
38
+
39
+ ### 完整引入
40
+
41
+ ```typescript
42
+ import { createApp } from 'vue'
43
+ import App from './App.vue'
44
+ import SimCodeUI from '@a2simcode/ui'
45
+ import '@a2simcode/ui/dist/style.css'
46
+
47
+ const app = createApp(App)
48
+ app.use(SimCodeUI)
49
+ app.mount('#app')
50
+ ```
51
+
52
+ ### 按需引入
53
+
54
+ ```vue
55
+ <template>
56
+ <j-button type="primary">按钮</j-button>
57
+ </template>
58
+
59
+ <script setup lang="ts">
60
+ import { JButton } from '@a2simcode/ui'
61
+ import '@a2simcode/ui/dist/style.css'
62
+ </script>
63
+ ```
64
+
65
+ ## 🎯 组件列表
66
+
67
+ - ✅ Button 按钮
68
+ - ✅ Input 输入框
69
+ - ✅ Radio 单选框
70
+ - 🚧 更多组件开发中...
71
+
72
+ ## 💻 本地开发
73
+
74
+ ```bash
75
+ # 进入项目目录
76
+ cd simcode-ui
77
+
78
+ # 安装依赖
79
+ pnpm install
80
+
81
+ # 启动开发服务器
82
+ pnpm dev
83
+
84
+ # 构建组件库
85
+ pnpm build
86
+
87
+ # 运行测试
88
+ pnpm test
89
+
90
+ # 启动文档站点
91
+ pnpm docs:dev
92
+ ```
93
+
94
+ ## 📁 项目结构
95
+
96
+ ```
97
+ simcode-ui/
98
+ ├── packages/ # 组件源码
99
+ │ ├── components/ # 组件
100
+ │ │ ├── button/ # 按钮组件
101
+ │ │ ├── input/ # 输入框组件
102
+ │ │ └── index.ts # 组件入口
103
+ │ └── theme/ # 主题样式
104
+ │ └── src/ # 样式源码 (Less)
105
+ ├── examples/ # 组件预览
106
+ │ ├── App.vue # 预览应用
107
+ │ └── main.ts # 入口文件
108
+ ├── docs/ # 文档
109
+ │ ├── .vitepress/ # VitePress 配置
110
+ │ ├── guide/ # 指南
111
+ │ └── components/ # 组件文档
112
+ ├── __tests__/ # 测试文件
113
+ ├── vite.config.ts # Vite 配置
114
+ ├── vitest.config.ts # Vitest 配置
115
+ └── package.json # 项目配置
116
+ ```
117
+
118
+ ## 🤝 贡献
119
+
120
+ 欢迎提交 Issue 和 Pull Request!
121
+
122
+ ## 📄 版权声明
123
+
124
+ Copyright © 2024 苏州极简搭信息技术有限公司. All rights reserved.
125
+
126
+ 本软件及其相关文档为专有软件,受版权法保护。未经版权所有者明确书面许可,不得以任何形式或方式(电子、机械、复印、录制或其他方式)复制、分发、传播或使用本软件的任何部分。
127
+
128
+ ## 🙏 致谢
129
+
130
+ 感谢所有为这个项目做出贡献的开发者!
@@ -9,6 +9,8 @@ export declare const INJECT_KEYS: {
9
9
  readonly FORM_PROVIDE: "jcode_form_provide";
10
10
  /** 表格相关注入 */
11
11
  readonly TABLE_PROVIDE: "jcode_table_provide";
12
+ /** 动态组件相关注入 */
13
+ readonly COMP_PROVIDE: "jcode_comp_provide";
12
14
  /** 菜单相关注入 */
13
15
  readonly MENU_PROVIDE: "jcode_menu_provide";
14
16
  /** 水平菜单相关注入 */
@@ -68,6 +70,15 @@ export interface TableProvideType {
68
70
  /** 表格行变更事件 */
69
71
  rowChange: (data: any) => void;
70
72
  }
73
+ /**
74
+ * 动态组件提供者类型
75
+ */
76
+ export interface CompProvideType {
77
+ /**
78
+ * 当前组件配置上下问类型
79
+ */
80
+ contextType: 'form' | 'page';
81
+ }
71
82
  /**
72
83
  * 菜单提供者类型
73
84
  */
@@ -136,6 +147,14 @@ export declare function useTableInject(): TableProvideType;
136
147
  * 表单相关提供
137
148
  */
138
149
  export declare function useTableProvide(value: TableProvideType): void;
150
+ /**
151
+ * 动态组件相关注入
152
+ */
153
+ export declare function useCompInject(): CompProvideType;
154
+ /**
155
+ * 动态组件相关提供
156
+ */
157
+ export declare function useCompProvide(value: CompProvideType): void;
139
158
  /**
140
159
  * 菜单相关注入
141
160
  */
@@ -0,0 +1 @@
1
+ export * from './utils';
@@ -0,0 +1,21 @@
1
+ export interface Encryption {
2
+ encrypt(plainText: string): string;
3
+ decrypt(cipherText: string): string;
4
+ }
5
+ export interface Hashing {
6
+ hash(data: string): string;
7
+ }
8
+ export interface EncryptionParams {
9
+ key: string;
10
+ iv?: string;
11
+ }
12
+ export declare class EncryptionFactory {
13
+ static createAesEncryption(params: EncryptionParams): Encryption;
14
+ static createBase64Encryption(): Encryption;
15
+ }
16
+ export declare class HashingFactory {
17
+ static createMD5Hashing(): Hashing;
18
+ static createSHA256Hashing(): Hashing;
19
+ static createSHA512Hashing(): Hashing;
20
+ }
21
+ export declare const myAesDecrypt: (cipherText: string, key: string) => string;
@@ -0,0 +1,72 @@
1
+ /**
2
+ * 清空对象
3
+ * @param data 清空对象
4
+ */
5
+ export declare function clearJson(data: Record<string, any>): void;
6
+ /**
7
+ * 获取对象类型
8
+ */
9
+ export declare function getObjType(obj: any): any;
10
+ /**
11
+ * 对象深拷贝
12
+ */
13
+ export declare function deepClone(data: any): any;
14
+ /**
15
+ * 对象拷贝
16
+ */
17
+ export declare function clone(res: Record<string, any>, data: Record<string, any>, notKeys?: string[]): void;
18
+ export declare const buildUUID: () => string;
19
+ export declare function buildShortUUID(prefix?: string): string;
20
+ /**
21
+ * 将字符串转换为函数
22
+ * @param {string} fun - 函数字符串
23
+ * @returns {object} - 返回包含结果状态和函数的对象
24
+ */
25
+ export declare const getFunction: (fun: string) => {
26
+ res: boolean;
27
+ msg: string;
28
+ fn: any;
29
+ } | {
30
+ res: boolean;
31
+ msg: unknown;
32
+ fn?: undefined;
33
+ };
34
+ /**
35
+ * 通过路径设置对象属性值
36
+ * @param obj 目标对象
37
+ * @param path 属性路径,支持 'a.b.c' 或 'a[0].b' 或 ['a', 'b', 'c'] 格式
38
+ * @param value 要设置的值
39
+ * @returns 返回对象本身
40
+ */
41
+ export declare function set(obj: any, path: string | string[], value: any): any;
42
+ export declare const toDecimal: (x: any) => number;
43
+ /**
44
+ * 分页方法
45
+ * @param pageNo
46
+ * @param pageSize
47
+ * @param array
48
+ * @returns
49
+ */
50
+ export declare const pagination: (pageNo: number, pageSize: number, array: any[]) => any[];
51
+ export declare const paginationEx: (params: Record<string, any>, array: any[]) => {
52
+ rows: any[];
53
+ total: number;
54
+ page: any;
55
+ records: number;
56
+ };
57
+ export declare const uniqueArray: (arr: any[]) => any[];
58
+ export declare const numberToChinese: (num: string) => string;
59
+ export declare const numberToThousandSeparator: (num: string) => string;
60
+ /**
61
+ * 用来获取文字宽度
62
+ * @param text
63
+ * @returns
64
+ */
65
+ export declare const getTextWidth: (text: string) => number | undefined;
66
+ export declare function upFirst(str: string): string;
67
+ export declare function lowerFirst(str: string, isFlag?: boolean): string;
68
+ /**
69
+ * Object.assign polyfill/wrapper
70
+ * Merges properties from source objects into target object
71
+ */
72
+ export declare function assign(target: object | null, ...sources: any[]): any;
@@ -0,0 +1,27 @@
1
+ export declare const getIsInputComp: (type: string) => boolean;
2
+ export declare const getIsTableInputComp: (type: string) => boolean;
3
+ export declare const getCompConfig: (data: {
4
+ config?: Record<string, any>;
5
+ getCompConfig?: any;
6
+ formData: Record<string, any>;
7
+ getTableData?: () => Record<string, any>[];
8
+ row?: Record<string, any>;
9
+ pRowData?: Record<string, any>;
10
+ }) => any;
11
+ export declare const getCompType: (data: {
12
+ type: string;
13
+ getCompType?: any;
14
+ config?: Record<string, any>;
15
+ formData: Record<string, any>;
16
+ getTableData?: () => Record<string, any>[];
17
+ row?: Record<string, any>;
18
+ }) => any;
19
+ export declare const getLabel: (value: any, getLabelFromApp: any, data: {
20
+ type: string;
21
+ getCompType?: any;
22
+ getCompConfig?: any;
23
+ config?: Record<string, any>;
24
+ formData: Record<string, any>;
25
+ getTableData?: () => Record<string, any>[];
26
+ row?: Record<string, any>;
27
+ }) => any;
@@ -0,0 +1,3 @@
1
+ import { default as dayjs } from 'dayjs';
2
+ export declare function formatToDateTime(date?: dayjs.ConfigType, format?: string): string;
3
+ export declare function formatToDate(date?: dayjs.ConfigType, format?: string): string;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * 优化后的全屏加载调用
3
+ */
4
+ export declare function fullScreenLoading(visible: boolean): void;
@@ -0,0 +1,39 @@
1
+ /**
2
+ * 简单的事件总线实现
3
+ * 用于组件间通信
4
+ */
5
+ type EventHandler = (...args: any[]) => any;
6
+ declare class EventBus {
7
+ private events;
8
+ /**
9
+ * 监听事件
10
+ * @param event 事件名称
11
+ * @param handler 事件处理函数
12
+ */
13
+ on(event: string, handler: EventHandler): void;
14
+ /**
15
+ * 监听一次性事件
16
+ * @param event 事件名称
17
+ * @param handler 事件处理函数
18
+ */
19
+ once(event: string, handler: EventHandler): void;
20
+ /**
21
+ * 触发事件
22
+ * @param event 事件名称
23
+ * @param args 事件参数
24
+ * @returns 事件处理函数的返回结果
25
+ */
26
+ emit(event: string, ...args: any[]): any;
27
+ /**
28
+ * 移除事件监听
29
+ * @param event 事件名称
30
+ * @param handler 事件处理函数(可选,不传则移除该事件所有监听)
31
+ */
32
+ off(event: string, handler?: EventHandler): void;
33
+ /**
34
+ * 清除所有事件监听
35
+ */
36
+ clear(): void;
37
+ }
38
+ export declare const eventBus: EventBus;
39
+ export { EventBus };
@@ -0,0 +1,10 @@
1
+ export * from './is';
2
+ export * from './common';
3
+ export * from './comp';
4
+ export * from './date';
5
+ export * from './dom';
6
+ export * from './cipher';
7
+ export * from './tree';
8
+ export * from './useSortable';
9
+ export * from './map';
10
+ export * from './eventBus';
@@ -0,0 +1,4 @@
1
+ export declare function isArray(val: any): val is Array<any>;
2
+ export declare function is(val: unknown, type: string): boolean;
3
+ export declare function isObject(val: any): val is Record<any, any>;
4
+ export declare const isNullOrEmpty: (val: unknown) => boolean;
@@ -0,0 +1 @@
1
+ export declare const loadBMap: (ak: string) => Promise<unknown>;
@@ -0,0 +1,11 @@
1
+ /**
2
+ *将数组数据转化成树形数据
3
+ */
4
+ export declare function setGroupMap(data: any[], idKey: string, pidKey: string): {
5
+ group: Record<string, any>;
6
+ map: Record<string, any>;
7
+ };
8
+ export declare function toTree(data: any[], _idKey?: string, pidKey?: string, valueKey?: string, labelKey?: string, filterIds?: any): any[];
9
+ export declare const toArray: (data: any[], filterIds?: string[]) => any[];
10
+ export declare const toSimpleTree: (data: any[], valueKey?: string, labelKey?: string) => any[];
11
+ export declare const toLeafArray: (data: any[], getLabel: (item: any) => string, filterIds?: string[]) => any[];
@@ -0,0 +1,5 @@
1
+ import { Ref } from 'vue';
2
+ import { Options } from 'sortablejs';
3
+ export declare function useSortable(el?: HTMLElement | Ref<HTMLElement | undefined>, options?: Options): {
4
+ initSortable: () => void;
5
+ };