@peng_kai/kit 0.2.9 → 0.2.10

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.
@@ -11,6 +11,7 @@ import {
11
11
  QRCode as AQrcode,
12
12
  } from 'ant-design-vue';
13
13
  import { useAntdForm } from '../../../../antd/hooks/useAntdForm';
14
+ import { vFocus } from './helpers';
14
15
 
15
16
  export { setDeps };
16
17
 
@@ -116,7 +117,7 @@ async function onSubmit() {
116
117
 
117
118
  <AForm v-bind="form.props" class="ml4 flex-1" layout="vertical" @submit="onSubmit()">
118
119
  <AFormItem v-bind="form.itemProps.password" label="账户密码">
119
- <AInputPassword v-model:value="form.state.password" size="large">
120
+ <AInputPassword v-model:value="form.state.password" v-focus size="large">
120
121
  <template #prefix>
121
122
  <i class="i-ant-design:lock-outlined" />
122
123
  </template>
@@ -10,6 +10,7 @@ import {
10
10
  } from 'ant-design-vue';
11
11
  import { hasToken } from '../../../../utils';
12
12
  import { useAntdForm } from '../../../../antd/hooks/useAntdForm';
13
+ import { vFocus } from './helpers';
13
14
 
14
15
  export { setDeps };
15
16
 
@@ -70,14 +71,14 @@ async function onSubmit() {
70
71
  <div>
71
72
  <AForm v-bind="form.props" @submit="onSubmit()">
72
73
  <AFormItem v-if="props.requirePassword" v-bind="form.itemProps.password">
73
- <AInputPassword v-model:value="form.state.password" size="large" placeholder="请输入账户密码">
74
+ <AInputPassword v-model:value="form.state.password" v-focus size="large" placeholder="请输入账户密码">
74
75
  <template #prefix>
75
76
  <i class="i-ant-design:lock-outlined" />
76
77
  </template>
77
78
  </AInputPassword>
78
79
  </AFormItem>
79
80
  <AFormItem v-bind="form.itemProps.security_code">
80
- <AInput v-model:value="form.state.security_code" size="large" placeholder="请输入安全码">
81
+ <AInput v-model:value="form.state.security_code" v-focus size="large" placeholder="请输入安全码">
81
82
  <template #prefix>
82
83
  <i class="i-ant-design:safety-outlined" />
83
84
  </template>
@@ -0,0 +1,8 @@
1
+ import type { Directive } from 'vue';
2
+
3
+ export const vFocus: Directive = {
4
+ mounted(el) {
5
+ const $input: HTMLInputElement = el.nodeName === 'INPUT' ? el : el.getElementsByTagName('input')?.[0];
6
+ $input?.focus();
7
+ },
8
+ };
@@ -8,11 +8,11 @@
8
8
  .ant-form-show-help {
9
9
  position: relative;
10
10
 
11
- + div {
11
+ +div {
12
12
  display: none;
13
13
  }
14
14
 
15
- > div {
15
+ >div {
16
16
  position: absolute;
17
17
  z-index: 2;
18
18
  top: 7px;
@@ -56,6 +56,46 @@
56
56
  align-content: flex-start;
57
57
  }
58
58
 
59
+ // 查询器表单基本样式
60
+ .ant-form.ant-form__filter {
61
+ display: flex;
62
+ flex-wrap: wrap;
63
+ --uno: 'gap-4 mb-4';
64
+
65
+ .ant-form-item-label {
66
+ line-height: 1.2em;
67
+ width: 4.8em;
68
+ text-align: start;
69
+ overflow: unset;
70
+ white-space: unset;
71
+
72
+ >label::after {
73
+ // display: none;
74
+ content: "";
75
+ }
76
+ }
77
+
78
+ .ant-form-item {
79
+ margin-bottom: 0;
80
+ min-width: 250px;
81
+ width: 300px;
82
+ max-width: 380px;
83
+ flex: 1 1 auto;
84
+ }
85
+ }
86
+
87
+ // 使 Table 组件中的 Pagination 底部粘性
88
+ .ant-table-wrapper.antd-cover__table-sticky-pagination .ant-table-pagination {
89
+ --pagination-bg-color: var(--antd-colorBgContainer);
90
+
91
+ position: sticky;
92
+ bottom: 16px;
93
+ z-index: 2;
94
+ margin-bottom: -9px;
95
+ background-color: var(--pagination-bg-color);
96
+ box-shadow: 0 0 0 16px var(--pagination-bg-color);
97
+ }
98
+
59
99
  // 弹窗的基本款样式
60
100
  .ant-modal-wrap.antd-cover__basic-modal {
61
101
  --padding-size: 22px;
@@ -111,11 +151,11 @@
111
151
  // 抽屉的基本款样式
112
152
  .ant-drawer.antd-cover__basic-drawer {
113
153
  --padding-size: 22px;
114
-
154
+
115
155
  // --min-body-height: ;
116
156
  // --max-body-height: ;
117
157
  // --body-height: ;
118
-
158
+
119
159
  @media bp-lt-mobilel {
120
160
  --padding-size: 16px;
121
161
  }
@@ -167,7 +207,7 @@
167
207
  margin: 0;
168
208
  border-top: 1px solid var(--antd-colorBorderSecondary);
169
209
 
170
- & > *:not(:first-of-type) {
210
+ &>*:not(:first-of-type) {
171
211
  margin-left: 8px;
172
212
  }
173
213
  }
@@ -178,11 +218,11 @@
178
218
  .ant-card-actions {
179
219
  justify-content: flex-end !important;
180
220
  padding: 0 24px;
181
-
182
- > li {
221
+
222
+ >li {
183
223
  width: auto !important;
184
224
  border-inline-end: none !important;
185
-
225
+
186
226
  &:not(:last-child) {
187
227
  margin-right: 8px;
188
228
  }
@@ -190,33 +230,6 @@
190
230
  }
191
231
  }
192
232
 
193
- // 查询器表单基本样式
194
- .ant-form.ant-form__filter {
195
- display: flex;
196
- flex-wrap: wrap;
197
- --uno: 'gap-4 mb-4';
198
-
199
- .ant-form-item-label {
200
- line-height: 1.2em;
201
- width: 4.8em;
202
- text-align: start;
203
- overflow: unset;
204
- white-space: unset;
205
-
206
- > label::after {
207
- // display: none;
208
- content: "";
209
- }
210
- }
211
-
212
- .ant-form-item {
213
- margin-bottom: 0;
214
- min-width: 250px;
215
- width: 300px;
216
- max-width: 380px;
217
- flex: 1 1 auto;
218
- }
219
- }
220
233
 
221
234
  // Modal 组件中的 Card 组件样式(为了和原 Modal 组件一样)
222
235
  .ant-card.antd-cover__card-in-modal {
@@ -312,7 +325,7 @@
312
325
  padding: 0 var(--padding-size);
313
326
  background-color: var(--antd-colorBgElevated);
314
327
 
315
- > li {
328
+ >li {
316
329
  width: auto !important;
317
330
  margin: 0;
318
331
  border-inline-end: none !important;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@peng_kai/kit",
3
3
  "type": "module",
4
- "version": "0.2.9",
4
+ "version": "0.2.10",
5
5
  "description": "",
6
6
  "author": "",
7
7
  "license": "ISC",
@@ -36,7 +36,7 @@
36
36
  "axios": "^1.6.7",
37
37
  "bignumber.js": "^9.1.2",
38
38
  "chokidar": "^3.6.0",
39
- "crypto-js": "^4.2.0",
39
+ "crypto-es": "^2.1.0",
40
40
  "dayjs": "^1.11.10",
41
41
  "echarts": "^5.4.3",
42
42
  "execa": "^8.0.1",
package/tsconfig.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "target": "ES2020",
3
+ "target": "ESNext",
4
4
  "jsx": "preserve",
5
5
  "jsxFactory": "h",
6
6
  "jsxFragmentFactory": "Fragment",
7
+ "jsxImportSource": "vue",
7
8
  "lib": [
8
9
  "ESNext",
9
10
  "DOM",
@@ -11,22 +12,19 @@
11
12
  ],
12
13
  "useDefineForClassFields": true,
13
14
  "module": "ESNext",
14
-
15
- /* Bundler mode */
16
15
  "moduleResolution": "bundler",
17
16
  "resolveJsonModule": true,
18
17
  "allowImportingTsExtensions": true,
19
-
20
- /* Linting */
21
18
  "strict": true,
22
19
  "noFallthroughCasesInSwitch": true,
23
- "noImplicitAny": false,
20
+ "noImplicitThis": true,
24
21
  "noUnusedLocals": true,
25
22
  "noUnusedParameters": true,
26
23
  "noEmit": true,
27
- "allowSyntheticDefaultImports": true,
28
24
  "esModuleInterop": true,
25
+ "forceConsistentCasingInFileNames": true,
29
26
  "isolatedModules": true,
27
+ "verbatimModuleSyntax": true,
30
28
  "skipLibCheck": true
31
29
  },
32
30
  "include": [
package/utils/index.ts CHANGED
@@ -1,4 +1,7 @@
1
- import CryptoJS from 'crypto-js';
1
+ import { Utf8 as cryptUtf8 } from 'crypto-es/lib/core';
2
+ import { AES as cryptoAES } from 'crypto-es/lib/aes';
3
+ import { ECB as cryptoModeECB } from 'crypto-es/lib/mode-ecb';
4
+ import { Pkcs7 as cryptoPkcs7 } from 'crypto-es/lib/cipher-core';
2
5
  import { at as objAt } from 'lodash-es';
3
6
 
4
7
  export { desensitize, randomString } from './string';
@@ -79,11 +82,11 @@ export function createSelfKeyProxy<T extends object>() {
79
82
  */
80
83
  export function encryptPassword(a: string, b: string[]) {
81
84
  const c = objAt(window, b).map((i: any) => i()).join('');
82
- const key = CryptoJS.enc.Utf8.parse(c);
83
- const srcs = CryptoJS.enc.Utf8.parse(a);
84
- const encrypted = CryptoJS.AES.encrypt(srcs, key, {
85
- mode: CryptoJS.mode.ECB,
86
- padding: CryptoJS.pad.Pkcs7,
85
+ const key = cryptUtf8.parse(c);
86
+ const srcs = cryptUtf8.parse(a);
87
+ const encrypted = cryptoAES.encrypt(srcs, key, {
88
+ mode: cryptoModeECB,
89
+ padding: cryptoPkcs7,
87
90
  });
88
91
 
89
92
  return encrypted.toString();