@yqg/simple 1.0.1-beta.1.0 → 1.0.1-beta.1.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.
- package/README.md +36 -13
- package/dist/constant/fields.d.ts +1 -1
- package/dist/index-66c4e9f4.js.map +1 -1
- package/dist/index-87a0d73b.js.map +1 -1
- package/package.json +11 -2
- package/src/constant/fields.ts +2 -2
- package/src/types/mixin/index.d.ts +60 -0
package/README.md
CHANGED
|
@@ -63,8 +63,35 @@ Vue.component('yqg-simple-form', YqgSimpleForm)
|
|
|
63
63
|
|
|
64
64
|
## 混入 (Mixins)
|
|
65
65
|
|
|
66
|
+
### 引入方式
|
|
67
|
+
|
|
68
|
+
```javascript
|
|
69
|
+
import { table, modal, watermark } from '@yqg/simple/mixin'
|
|
70
|
+
|
|
71
|
+
export default {
|
|
72
|
+
mixins: [table, modal, watermark],
|
|
73
|
+
// ...
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### 可用的混入
|
|
78
|
+
|
|
79
|
+
- `table` - 表格混入,提供表格相关的通用方法
|
|
80
|
+
- `tableSelection` - 表格选择混入
|
|
81
|
+
- `modal` - 模态框混入,提供模态框相关的通用方法
|
|
82
|
+
- `watermark` - 水印混入,提供水印功能
|
|
83
|
+
- `commonTable` - 通用表格混入
|
|
84
|
+
- `clientTable` - 客户端表格混入
|
|
85
|
+
- `enumType` - 枚举类型混入
|
|
86
|
+
- `cardList` - 卡片列表混入
|
|
87
|
+
|
|
88
|
+
### 按需引入
|
|
89
|
+
|
|
66
90
|
```javascript
|
|
67
|
-
|
|
91
|
+
// 引入单个混入
|
|
92
|
+
import table from '@yqg/simple/src/mixin/table'
|
|
93
|
+
import modal from '@yqg/simple/src/mixin/modal'
|
|
94
|
+
import watermark from '@yqg/simple/src/mixin/watermark'
|
|
68
95
|
|
|
69
96
|
export default {
|
|
70
97
|
mixins: [table, modal, watermark],
|
|
@@ -92,9 +119,8 @@ export default {
|
|
|
92
119
|
```javascript
|
|
93
120
|
import { util, formatMap, object, constant } from '@yqg/simple'
|
|
94
121
|
|
|
95
|
-
//
|
|
96
|
-
const
|
|
97
|
-
const decrypted = util.aesDecrypt(encrypted)
|
|
122
|
+
// 使用字符串工具
|
|
123
|
+
const snakeCase = util.camelCaseToUnderscore('userName') // 'user_name'
|
|
98
124
|
|
|
99
125
|
// 使用对象工具
|
|
100
126
|
const value = object.pickValue(data, 'user.name')
|
|
@@ -109,10 +135,9 @@ const formatted = formatMap.formatValue(value, options)
|
|
|
109
135
|
支持通过子路径按需引入工具函数,减少打包体积:
|
|
110
136
|
|
|
111
137
|
```javascript
|
|
112
|
-
//
|
|
113
|
-
import {
|
|
138
|
+
// 字符串工具
|
|
139
|
+
import { camelCaseToUnderscore } from '@yqg/simple/util/tool'
|
|
114
140
|
|
|
115
|
-
const encrypted = aesEncrypt('secret message')
|
|
116
141
|
const snakeCase = camelCaseToUnderscore('userName') // 'user_name'
|
|
117
142
|
|
|
118
143
|
// 对象操作工具
|
|
@@ -166,10 +191,10 @@ const data = myStorage.get()
|
|
|
166
191
|
所有工具函数都提供完整的 TypeScript 类型声明,开发时会有智能提示:
|
|
167
192
|
|
|
168
193
|
```typescript
|
|
169
|
-
import {
|
|
194
|
+
import { camelCaseToUnderscore, pickValue, merge } from '@yqg/simple/util'
|
|
170
195
|
|
|
171
|
-
// ✅ 编辑器自动提示:
|
|
172
|
-
const
|
|
196
|
+
// ✅ 编辑器自动提示:camelCaseToUnderscore(camelStr: string): string
|
|
197
|
+
const snakeCase = camelCaseToUnderscore('userName')
|
|
173
198
|
|
|
174
199
|
// ✅ 编辑器自动提示:pickValue<T = any>(obj: any, keyString: string): T | undefined
|
|
175
200
|
const value = pickValue<number>({ a: { b: 1 } }, 'a.b')
|
|
@@ -180,10 +205,8 @@ const merged = merge({ a: 1 }, { b: 2 })
|
|
|
180
205
|
|
|
181
206
|
### 工具函数 API
|
|
182
207
|
|
|
183
|
-
####
|
|
208
|
+
#### 字符串工具 (`util/tool`)
|
|
184
209
|
|
|
185
|
-
- `aesEncrypt(message: string, key?: string): string` - AES 加密
|
|
186
|
-
- `aesDecrypt(ciphertext: string, key?: string): string` - AES 解密
|
|
187
210
|
- `camelCaseToUnderscore(camelStr: string): string` - 驼峰转下划线
|
|
188
211
|
|
|
189
212
|
#### 对象工具 (`util/object`)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Def } from '@yqg/type';
|
|
2
2
|
import type { CommonObject } from './common-fields.ts';
|
|
3
|
-
export * from './common-fields
|
|
3
|
+
export * from './common-fields';
|
|
4
4
|
export declare const extendsDefValue: (options: CommonObject) => CommonObject;
|
|
5
5
|
export declare const dateTimeDayStartDef: Def;
|
|
6
6
|
export declare const dateTimeDayEndDef: Def;
|