@blueking/ai-ui-sdk 0.6.0-beta.13 → 0.6.0-beta.15
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 +2 -1
- package/dist/components/render-agent/agent-type.vue.css +4 -4
- package/dist/components/render-agent/agent-type.vue.js +1 -1
- package/dist/components/render-auto-height-textarea/index.vue.css +11 -11
- package/dist/components/render-auto-height-textarea/index.vue.js +1 -1
- package/dist/components/render-auto-refresh/index.script.vue.js.js +35 -14
- package/dist/components/render-auto-refresh/index.vue.js +0 -2
- package/dist/components/render-card/agent/prefix-info-tool.vue.css +5 -5
- package/dist/components/render-card/agent/prefix-info-tool.vue.js +1 -1
- package/dist/components/render-card/agent/upgrade.vue.css +2 -2
- package/dist/components/render-card/agent/upgrade.vue.js +1 -1
- package/dist/components/render-card/base/approval-strategy-popover.script.vue.js.js +2 -2
- package/dist/components/render-card/base.vue.css +13 -13
- package/dist/components/render-card/base.vue.js +1 -1
- package/dist/components/render-card/llm/corner-badge.vue.css +3 -3
- package/dist/components/render-card/llm/corner-badge.vue.js +1 -1
- package/dist/components/render-card/llm/icons.vue.css +2 -2
- package/dist/components/render-card/llm/icons.vue.js +1 -1
- package/dist/components/render-card/llm/info.vue.css +1 -1
- package/dist/components/render-card/llm/info.vue.js +1 -1
- package/dist/components/render-card/llm/tag-prefix.vue.css +2 -2
- package/dist/components/render-card/llm/tag-prefix.vue.js +1 -1
- package/dist/components/render-card/mcp/name-suffix.vue.css +2 -2
- package/dist/components/render-card/mcp/name-suffix.vue.js +1 -1
- package/dist/components/render-card/prompt/icons.vue.css +1 -1
- package/dist/components/render-card/prompt/icons.vue.js +1 -1
- package/dist/components/render-card/skill/scanner.vue.css +3 -3
- package/dist/components/render-card/skill/scanner.vue.js +1 -1
- package/dist/components/render-checkbox/index.vue.css +4 -4
- package/dist/components/render-checkbox/index.vue.js +1 -1
- package/dist/components/render-choose-tag/index.vue.css +7 -7
- package/dist/components/render-choose-tag/index.vue.js +1 -1
- package/dist/components/render-collapse/index.vue.css +2 -2
- package/dist/components/render-collapse/index.vue.js +1 -1
- package/dist/components/render-collection/content/index.vue.css +4 -4
- package/dist/components/render-collection/content/index.vue.js +1 -1
- package/dist/components/render-dataset/components/batch-delete-dataset-data/index.vue.css +3 -3
- package/dist/components/render-dataset/components/batch-delete-dataset-data/index.vue.js +1 -1
- package/dist/components/render-dataset/components/edit-dataset-data/index.vue.css +3 -3
- package/dist/components/render-dataset/components/edit-dataset-data/index.vue.js +1 -1
- package/dist/components/render-dataset/components/operation-record/index.vue.css +4 -4
- package/dist/components/render-dataset/components/operation-record/index.vue.js +1 -1
- package/dist/components/render-dataset/components/operation-record/table/index.vue.css +1 -1
- package/dist/components/render-dataset/components/operation-record/table/index.vue.js +1 -1
- package/dist/components/render-dataset/components/operation-record/view-op-result/index.vue.css +2 -2
- package/dist/components/render-dataset/components/operation-record/view-op-result/index.vue.js +1 -1
- package/dist/components/render-dataset/components/plus-dataset/index.vue.css +1 -1
- package/dist/components/render-dataset/components/plus-dataset/index.vue.js +1 -1
- package/dist/components/render-dataset/components/plus-dataset-data/form/api.vue.css +2 -2
- package/dist/components/render-dataset/components/plus-dataset-data/form/api.vue.js +1 -1
- package/dist/components/render-dataset/components/plus-dataset-data/form/footer.vue.css +1 -1
- package/dist/components/render-dataset/components/plus-dataset-data/form/footer.vue.js +1 -1
- package/dist/components/render-dataset/components/plus-dataset-data/form/index.vue.css +1 -1
- package/dist/components/render-dataset/components/plus-dataset-data/form/index.vue.js +1 -1
- package/dist/components/render-dataset/components/review-dataset-data/index.vue.css +10 -10
- package/dist/components/render-dataset/components/review-dataset-data/index.vue.js +1 -1
- package/dist/components/render-dataset-detail-origin-data/index.vue.css +3 -3
- package/dist/components/render-dataset-detail-origin-data/index.vue.js +1 -1
- package/dist/components/render-dataset-list/components/main.vue.css +3 -3
- package/dist/components/render-dataset-list/components/main.vue.js +1 -1
- package/dist/components/render-dataset-list/index.vue.css +2 -2
- package/dist/components/render-dataset-list/index.vue.js +1 -1
- package/dist/components/render-dialog/choose-resource.vue.css +3 -3
- package/dist/components/render-dialog/choose-resource.vue.js +1 -1
- package/dist/components/render-dialog/choose-result.vue.css +14 -14
- package/dist/components/render-dialog/choose-result.vue.js +1 -1
- package/dist/components/render-dialog/choose-space.vue.css +9 -9
- package/dist/components/render-dialog/choose-space.vue.js +1 -1
- package/dist/components/render-dialog/index.vue.css +6 -6
- package/dist/components/render-dialog/index.vue.js +1 -1
- package/dist/components/render-exception/index.vue.css +9 -9
- package/dist/components/render-exception/index.vue.js +1 -1
- package/dist/components/render-file-card/index.vue.css +11 -11
- package/dist/components/render-file-card/index.vue.js +1 -1
- package/dist/components/render-file-type-icon/index.vue.css +6 -6
- package/dist/components/render-file-type-icon/index.vue.js +1 -1
- package/dist/components/render-generate-tag/index.vue.css +7 -7
- package/dist/components/render-generate-tag/index.vue.js +1 -1
- package/dist/components/render-knowledge/icon/index.vue.css +1 -1
- package/dist/components/render-knowledge/icon/index.vue.js +1 -1
- package/dist/components/render-prompt/content/index.vue.css +1 -1
- package/dist/components/render-prompt/content/index.vue.js +1 -1
- package/dist/components/render-reference/index.vue.css +2 -2
- package/dist/components/render-reference/index.vue.js +1 -1
- package/dist/components/render-resource-version/index.vue.css +2 -2
- package/dist/components/render-resource-version/index.vue.js +1 -1
- package/dist/components/render-router-tab/index.vue.css +3 -3
- package/dist/components/render-router-tab/index.vue.js +1 -1
- package/dist/components/render-select-plus-extension/index.vue.css +3 -3
- package/dist/components/render-select-plus-extension/index.vue.js +1 -1
- package/dist/components/render-t-table/index.vue.css +30 -30
- package/dist/components/render-t-table/index.vue.js +1 -1
- package/dist/components/render-tag-tree/index.vue.css +7 -7
- package/dist/components/render-tag-tree/index.vue.js +1 -1
- package/dist/components/render-tags/index.vue.css +6 -6
- package/dist/components/render-tags/index.vue.js +1 -1
- package/dist/css/g-utilities.css +57 -0
- package/dist/css/g-utilities.manifest.json +14 -0
- package/dist/css/variable/token.d.ts +3 -0
- package/dist/css/variable/token.ts.js +4 -0
- package/dist/hooks/use-form-rule.d.ts +31 -2
- package/dist/hooks/use-form-rule.ts.js +65 -26
- package/dist/hooks/use-meta-http.d.ts +6 -2
- package/dist/hooks/use-meta-http.ts.js +19 -5
- package/dist/hooks.d.ts +1 -0
- package/dist/hooks.ts.js +1 -0
- package/dist/i18n/en-US.d.ts +3 -0
- package/dist/i18n/en-US.ts.js +3 -0
- package/dist/i18n/zh-CN.d.ts +3 -0
- package/dist/i18n/zh-CN.ts.js +3 -0
- package/package.json +1 -1
- package/dist/components/render-auto-refresh/index.vue.css +0 -46
package/dist/css/g-utilities.css
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
.\!g-bg-\[var\(--aidev-assist-content-background\)\] {
|
|
2
|
+
background-color: var(--aidev-assist-content-background) !important;
|
|
3
|
+
}
|
|
4
|
+
|
|
1
5
|
.\!g-bg-\[var\(--aidev-checkbox-checked-color\)\] {
|
|
2
6
|
background-color: var(--aidev-checkbox-checked-color) !important;
|
|
3
7
|
}
|
|
@@ -263,10 +267,18 @@
|
|
|
263
267
|
border: 1px solid var(--aidev-checkbox-border-color);
|
|
264
268
|
}
|
|
265
269
|
|
|
270
|
+
.g-border-\[var\(--aidev-form-border-color\)\] {
|
|
271
|
+
border: 1px solid var(--aidev-form-border-color);
|
|
272
|
+
}
|
|
273
|
+
|
|
266
274
|
.g-border-b-\[var\(--aidev-line-strong-color\)\] {
|
|
267
275
|
border-bottom: 1px solid var(--aidev-line-strong-color);
|
|
268
276
|
}
|
|
269
277
|
|
|
278
|
+
.g-border-l-\[var\(--aidev-form-border-color\)\] {
|
|
279
|
+
border-left: 1px solid var(--aidev-form-border-color);
|
|
280
|
+
}
|
|
281
|
+
|
|
270
282
|
.g-border-radio-100 {
|
|
271
283
|
border-radius: 100%;
|
|
272
284
|
}
|
|
@@ -279,6 +291,10 @@
|
|
|
279
291
|
border-top: 1px solid #F0F1F5;
|
|
280
292
|
}
|
|
281
293
|
|
|
294
|
+
.g-box-border {
|
|
295
|
+
box-sizing: border-box;
|
|
296
|
+
}
|
|
297
|
+
|
|
282
298
|
.g-confirm {
|
|
283
299
|
.bk-pop-confirm-title {
|
|
284
300
|
padding-bottom: 6px;
|
|
@@ -440,6 +456,10 @@
|
|
|
440
456
|
gap: 4px;
|
|
441
457
|
}
|
|
442
458
|
|
|
459
|
+
.g-gap-6 {
|
|
460
|
+
gap: 6px;
|
|
461
|
+
}
|
|
462
|
+
|
|
443
463
|
.g-gap-8 {
|
|
444
464
|
gap: 8px;
|
|
445
465
|
}
|
|
@@ -472,6 +492,10 @@
|
|
|
472
492
|
height: 24px;
|
|
473
493
|
}
|
|
474
494
|
|
|
495
|
+
.g-h-32 {
|
|
496
|
+
height: 32px;
|
|
497
|
+
}
|
|
498
|
+
|
|
475
499
|
.g-h-42 {
|
|
476
500
|
height: 42px;
|
|
477
501
|
}
|
|
@@ -512,6 +536,10 @@
|
|
|
512
536
|
display: inline-block;
|
|
513
537
|
}
|
|
514
538
|
|
|
539
|
+
.g-inline-flex {
|
|
540
|
+
display: inline-flex;
|
|
541
|
+
}
|
|
542
|
+
|
|
515
543
|
.g-inline-flex-row {
|
|
516
544
|
display: inline-flex;
|
|
517
545
|
flex-direction: row;
|
|
@@ -598,6 +626,10 @@
|
|
|
598
626
|
max-height: 260px;
|
|
599
627
|
}
|
|
600
628
|
|
|
629
|
+
.g-max-h-300 {
|
|
630
|
+
max-height: 300px;
|
|
631
|
+
}
|
|
632
|
+
|
|
601
633
|
.g-max-h-400 {
|
|
602
634
|
max-height: 400px;
|
|
603
635
|
}
|
|
@@ -842,6 +874,10 @@
|
|
|
842
874
|
overflow-x: auto;
|
|
843
875
|
}
|
|
844
876
|
|
|
877
|
+
.g-overflow-y-auto {
|
|
878
|
+
overflow-y: auto;
|
|
879
|
+
}
|
|
880
|
+
|
|
845
881
|
.g-p-0 {
|
|
846
882
|
padding: 0px;
|
|
847
883
|
}
|
|
@@ -976,6 +1012,11 @@ padding: 0px !important;
|
|
|
976
1012
|
padding-bottom: 2px;
|
|
977
1013
|
}
|
|
978
1014
|
|
|
1015
|
+
.g-py-4 {
|
|
1016
|
+
padding-top: 4px;
|
|
1017
|
+
padding-bottom: 4px;
|
|
1018
|
+
}
|
|
1019
|
+
|
|
979
1020
|
.g-radio-group {
|
|
980
1021
|
width: 100%;
|
|
981
1022
|
|
|
@@ -1278,6 +1319,10 @@ padding: 0px !important;
|
|
|
1278
1319
|
width: 200px;
|
|
1279
1320
|
}
|
|
1280
1321
|
|
|
1322
|
+
.g-w-32 {
|
|
1323
|
+
width: 32px;
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1281
1326
|
.g-w-48 {
|
|
1282
1327
|
width: 48px;
|
|
1283
1328
|
}
|
|
@@ -1302,6 +1347,10 @@ padding: 0px !important;
|
|
|
1302
1347
|
white-space: pre-line;
|
|
1303
1348
|
}
|
|
1304
1349
|
|
|
1350
|
+
.g-z-2 {
|
|
1351
|
+
z-index: 2;
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1305
1354
|
.hover\:\!g-bg-\[var\(--aidev-icon-light-hover-background\)\]:hover {
|
|
1306
1355
|
background-color: var(--aidev-icon-light-hover-background) !important;
|
|
1307
1356
|
}
|
|
@@ -1330,6 +1379,10 @@ padding: 0px !important;
|
|
|
1330
1379
|
background-color: var(--aidev-inner-background);
|
|
1331
1380
|
}
|
|
1332
1381
|
|
|
1382
|
+
.hover\:g-bg-\[var\(--aidev-item-hover-background\)\]:hover {
|
|
1383
|
+
background-color: var(--aidev-item-hover-background);
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1333
1386
|
.hover\:g-border-\[var\(--aidev-checkbox-hover-border-color\)\]:hover {
|
|
1334
1387
|
border: 1px solid var(--aidev-checkbox-hover-border-color);
|
|
1335
1388
|
}
|
|
@@ -1342,6 +1395,10 @@ padding: 0px !important;
|
|
|
1342
1395
|
border-radius: 9999px;
|
|
1343
1396
|
}
|
|
1344
1397
|
|
|
1398
|
+
.hover\:g-text-\[var\(--aidev-clickable-color\)\]:hover {
|
|
1399
|
+
color: var(--aidev-clickable-color);
|
|
1400
|
+
}
|
|
1401
|
+
|
|
1345
1402
|
.hover\:g-text-\[var\(--aidev-clickable-hover-color\)\]:hover {
|
|
1346
1403
|
color: var(--aidev-clickable-hover-color);
|
|
1347
1404
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
[
|
|
2
|
+
"!g-bg-[var(--aidev-assist-content-background)]",
|
|
2
3
|
"!g-bg-[var(--aidev-checkbox-checked-color)]",
|
|
3
4
|
"!g-bg-[var(--aidev-checkbox-checked-disabled-color)]",
|
|
4
5
|
"!g-bg-[var(--aidev-checkbox-disabled-background)]",
|
|
@@ -58,10 +59,13 @@
|
|
|
58
59
|
"g-bg-[var(--aidev-inner-background)]",
|
|
59
60
|
"g-bg-[var(--aidev-main-background)]",
|
|
60
61
|
"g-border-[var(--aidev-checkbox-border-color)]",
|
|
62
|
+
"g-border-[var(--aidev-form-border-color)]",
|
|
61
63
|
"g-border-b-[var(--aidev-line-strong-color)]",
|
|
64
|
+
"g-border-l-[var(--aidev-form-border-color)]",
|
|
62
65
|
"g-border-radio-100",
|
|
63
66
|
"g-border-t-1",
|
|
64
67
|
"g-border-t-F0F1F5",
|
|
68
|
+
"g-box-border",
|
|
65
69
|
"g-confirm",
|
|
66
70
|
"g-confirm-delete",
|
|
67
71
|
"g-cursor-grab",
|
|
@@ -83,6 +87,7 @@
|
|
|
83
87
|
"g-font-normal",
|
|
84
88
|
"g-gap",
|
|
85
89
|
"g-gap-4",
|
|
90
|
+
"g-gap-6",
|
|
86
91
|
"g-gap-8",
|
|
87
92
|
"g-gap-y-4",
|
|
88
93
|
"g-group-hover/collection-icon:g-text-e38b02",
|
|
@@ -93,6 +98,7 @@
|
|
|
93
98
|
"g-h-16",
|
|
94
99
|
"g-h-22",
|
|
95
100
|
"g-h-24",
|
|
101
|
+
"g-h-32",
|
|
96
102
|
"g-h-42",
|
|
97
103
|
"g-h-48",
|
|
98
104
|
"g-h-56",
|
|
@@ -103,6 +109,7 @@
|
|
|
103
109
|
"g-hidden",
|
|
104
110
|
"g-inline",
|
|
105
111
|
"g-inline-block",
|
|
112
|
+
"g-inline-flex",
|
|
106
113
|
"g-inline-flex-row",
|
|
107
114
|
"g-items-center",
|
|
108
115
|
"g-items-start",
|
|
@@ -119,6 +126,7 @@
|
|
|
119
126
|
"g-m-0",
|
|
120
127
|
"g-main-button",
|
|
121
128
|
"g-max-h-260",
|
|
129
|
+
"g-max-h-300",
|
|
122
130
|
"g-max-h-400",
|
|
123
131
|
"g-max-h-80vh",
|
|
124
132
|
"g-max-truncate",
|
|
@@ -170,6 +178,7 @@
|
|
|
170
178
|
"g-number-font",
|
|
171
179
|
"g-overflow-hidden",
|
|
172
180
|
"g-overflow-x-auto",
|
|
181
|
+
"g-overflow-y-auto",
|
|
173
182
|
"g-p-0",
|
|
174
183
|
"g-p-12",
|
|
175
184
|
"g-p-2",
|
|
@@ -196,6 +205,7 @@
|
|
|
196
205
|
"g-px-8",
|
|
197
206
|
"g-py-12",
|
|
198
207
|
"g-py-2",
|
|
208
|
+
"g-py-4",
|
|
199
209
|
"g-radio-group",
|
|
200
210
|
"g-relative",
|
|
201
211
|
"g-resource-description",
|
|
@@ -243,12 +253,14 @@
|
|
|
243
253
|
"g-truncate",
|
|
244
254
|
"g-w-16",
|
|
245
255
|
"g-w-200",
|
|
256
|
+
"g-w-32",
|
|
246
257
|
"g-w-48",
|
|
247
258
|
"g-w-64",
|
|
248
259
|
"g-w-88",
|
|
249
260
|
"g-w-full",
|
|
250
261
|
"g-whitespace-nowrap",
|
|
251
262
|
"g-whitespace-pre-line",
|
|
263
|
+
"g-z-2",
|
|
252
264
|
"hover:!g-bg-[var(--aidev-icon-light-hover-background)]",
|
|
253
265
|
"hover:!g-bg-[var(--aidev-item-hover-background)]",
|
|
254
266
|
"hover:!g-border-[var(--aidev-clickable-color)]",
|
|
@@ -256,9 +268,11 @@
|
|
|
256
268
|
"hover:!g-text-[var(--aidev-clickable-color)]",
|
|
257
269
|
"hover:g-bg-[var(--aidev-capsule-hover-background)]",
|
|
258
270
|
"hover:g-bg-[var(--aidev-inner-background)]",
|
|
271
|
+
"hover:g-bg-[var(--aidev-item-hover-background)]",
|
|
259
272
|
"hover:g-border-[var(--aidev-checkbox-hover-border-color)]",
|
|
260
273
|
"hover:g-cursor-pointer",
|
|
261
274
|
"hover:g-rounded-full",
|
|
275
|
+
"hover:g-text-[var(--aidev-clickable-color)]",
|
|
262
276
|
"hover:g-text-[var(--aidev-clickable-hover-color)]",
|
|
263
277
|
"hover:g-text-[var(--aidev-main-color)]",
|
|
264
278
|
"hover:g-text-e38b02"
|
|
@@ -80,6 +80,7 @@ declare const _default: {
|
|
|
80
80
|
'--aidev-icon-hover-background': string;
|
|
81
81
|
'--aidev-icon-light-hover-background': string;
|
|
82
82
|
'--aidev-item-hover-background': string;
|
|
83
|
+
'--aidev-item-hover-border-color': string;
|
|
83
84
|
'--aidev-generate-global-color': string;
|
|
84
85
|
'--aidev-generate-global-background': string;
|
|
85
86
|
'--aidev-generate-global-hover-color': string;
|
|
@@ -113,6 +114,8 @@ declare const _default: {
|
|
|
113
114
|
'--aidev-tag-filled-color': string;
|
|
114
115
|
'--aidev-tag-filled-background': string;
|
|
115
116
|
'--aidev-tag-filled-hover-background': string;
|
|
117
|
+
'--aidev-tag-info-color': string;
|
|
118
|
+
'--aidev-tag-info-background': string;
|
|
116
119
|
'--aidev-exception-illustration-shadow-color': string;
|
|
117
120
|
'--default-color': string;
|
|
118
121
|
'--primary-color': string;
|
|
@@ -111,6 +111,7 @@ export default {
|
|
|
111
111
|
'--aidev-icon-light-hover-background': 'brand7',
|
|
112
112
|
// 列表项 / 卡片 hover / 选中高亮背景
|
|
113
113
|
'--aidev-item-hover-background': 'brand6',
|
|
114
|
+
'--aidev-item-hover-border-color': 'brand3',
|
|
114
115
|
// 资源使用范围相关颜色
|
|
115
116
|
'--aidev-generate-global-color': 'brand2',
|
|
116
117
|
'--aidev-generate-global-background': 'brand6',
|
|
@@ -150,6 +151,9 @@ export default {
|
|
|
150
151
|
'--aidev-tag-filled-color': 'neutral10',
|
|
151
152
|
'--aidev-tag-filled-background': 'neutral3',
|
|
152
153
|
'--aidev-tag-filled-hover-background': 'neutral4',
|
|
154
|
+
// 蓝色 Tag(如数量标签)
|
|
155
|
+
'--aidev-tag-info-color': 'brand1',
|
|
156
|
+
'--aidev-tag-info-background': 'brand6',
|
|
153
157
|
// 空态 / 异常插图投影。SVG 里靠 fill-opacity 压到 3%~10%,不是实色块
|
|
154
158
|
'--aidev-exception-illustration-shadow-color': 'neutral1',
|
|
155
159
|
// bkui 字体颜色
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { type Ref } from 'vue';
|
|
2
2
|
import { Module } from '@/types/enum';
|
|
3
|
+
export interface IRemoteRuleOptions {
|
|
4
|
+
getData?: () => Record<string, unknown>;
|
|
5
|
+
key?: number | string;
|
|
6
|
+
}
|
|
3
7
|
export declare const useFormRule: (apiPrefix: string, spaceId?: Ref<string>) => {
|
|
4
8
|
codeRule: {
|
|
5
9
|
validator: (value: string) => boolean;
|
|
@@ -11,12 +15,22 @@ export declare const useFormRule: (apiPrefix: string, spaceId?: Ref<string>) =>
|
|
|
11
15
|
message: string;
|
|
12
16
|
trigger: string;
|
|
13
17
|
};
|
|
14
|
-
getNameRule: (type: Module) => {
|
|
18
|
+
getNameRule: (type: Module, options?: IRemoteRuleOptions) => {
|
|
15
19
|
validator: (value: string) => Promise<boolean>;
|
|
16
20
|
message: () => string;
|
|
17
21
|
trigger: string;
|
|
18
22
|
};
|
|
19
|
-
getCodeRule: (type: Module, getIsEdit?: () => boolean,
|
|
23
|
+
getCodeRule: (type: Module, getIsEdit?: () => boolean, options?: IRemoteRuleOptions) => {
|
|
24
|
+
validator: (value: string) => Promise<boolean>;
|
|
25
|
+
message: () => string;
|
|
26
|
+
trigger: string;
|
|
27
|
+
};
|
|
28
|
+
getUrlRule: (type: Module, options?: IRemoteRuleOptions) => {
|
|
29
|
+
validator: (value: string) => Promise<boolean>;
|
|
30
|
+
message: () => string;
|
|
31
|
+
trigger: string;
|
|
32
|
+
};
|
|
33
|
+
getAsyncRule: (api: (value: string) => Promise<unknown>) => {
|
|
20
34
|
validator: (value: string) => Promise<boolean>;
|
|
21
35
|
message: () => string;
|
|
22
36
|
trigger: string;
|
|
@@ -26,4 +40,19 @@ export declare const useFormRule: (apiPrefix: string, spaceId?: Ref<string>) =>
|
|
|
26
40
|
message: string;
|
|
27
41
|
trigger: string;
|
|
28
42
|
};
|
|
43
|
+
getNumberRule: () => {
|
|
44
|
+
validator: (value: string) => boolean;
|
|
45
|
+
message: string;
|
|
46
|
+
trigger: string;
|
|
47
|
+
};
|
|
48
|
+
getPositiveNumberRule: () => {
|
|
49
|
+
validator: (value: string) => boolean;
|
|
50
|
+
message: string;
|
|
51
|
+
trigger: string;
|
|
52
|
+
};
|
|
53
|
+
getNonNegativeNumberRule: () => {
|
|
54
|
+
validator: (value: string) => boolean;
|
|
55
|
+
message: string;
|
|
56
|
+
trigger: string;
|
|
57
|
+
};
|
|
29
58
|
};
|
|
@@ -30,23 +30,39 @@ function _async_to_generator(fn) {
|
|
|
30
30
|
import { useMetaHttp } from './use-meta-http.ts.js';
|
|
31
31
|
import { t } from '../i18n/index.ts.js';
|
|
32
32
|
export const useFormRule = (apiPrefix, spaceId)=>{
|
|
33
|
-
const { nameValidator, codeValidator } = useMetaHttp(apiPrefix, spaceId);
|
|
34
|
-
let
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
const { nameValidator, codeValidator, urlValidator } = useMetaHttp(apiPrefix, spaceId);
|
|
34
|
+
let asyncErrorMessage = '';
|
|
35
|
+
const remoteRuleStates = new Map();
|
|
36
|
+
const getRemoteRuleState = (stateKey)=>{
|
|
37
|
+
if (!remoteRuleStates.has(stateKey)) {
|
|
38
|
+
remoteRuleStates.set(stateKey, {
|
|
39
|
+
controller: null,
|
|
40
|
+
errorMessage: ''
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return remoteRuleStates.get(stateKey);
|
|
40
44
|
};
|
|
41
|
-
const
|
|
45
|
+
const createRemoteRule = (kind, validator, type, { getData, key = 'default' } = {}, getIsSkip)=>{
|
|
46
|
+
const state = getRemoteRuleState(`${kind}:${type}:${key}`);
|
|
47
|
+
return {
|
|
42
48
|
validator: function() {
|
|
43
49
|
var _ref = _async_to_generator(function*(value) {
|
|
50
|
+
var _state_controller;
|
|
51
|
+
if (getIsSkip === null || getIsSkip === void 0 ? void 0 : getIsSkip()) {
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
(_state_controller = state.controller) === null || _state_controller === void 0 ? void 0 : _state_controller.abort();
|
|
55
|
+
const current = new AbortController();
|
|
56
|
+
state.controller = current;
|
|
44
57
|
try {
|
|
45
|
-
|
|
46
|
-
const res = yield
|
|
58
|
+
state.errorMessage = '';
|
|
59
|
+
const res = yield validator(value, type, getData === null || getData === void 0 ? void 0 : getData(), current.signal)();
|
|
47
60
|
return res.data;
|
|
48
61
|
} catch (error) {
|
|
49
|
-
|
|
62
|
+
if (state.controller !== current) {
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
state.errorMessage = error.message;
|
|
50
66
|
return false;
|
|
51
67
|
}
|
|
52
68
|
});
|
|
@@ -54,24 +70,27 @@ export const useFormRule = (apiPrefix, spaceId)=>{
|
|
|
54
70
|
return _ref.apply(this, arguments);
|
|
55
71
|
};
|
|
56
72
|
}(),
|
|
57
|
-
message: ()=>
|
|
73
|
+
message: ()=>state.errorMessage,
|
|
58
74
|
trigger: 'change'
|
|
59
|
-
}
|
|
60
|
-
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
const codeRule = {
|
|
78
|
+
validator: (value)=>/^[a-zA-Z0-9-]+$/.test(value),
|
|
79
|
+
message: t('需要是英文字符、数字、中划线'),
|
|
80
|
+
trigger: 'change'
|
|
81
|
+
};
|
|
82
|
+
const getNameRule = (type, options)=>createRemoteRule('name', nameValidator, type, options);
|
|
83
|
+
// 编辑态不校验code
|
|
84
|
+
const getCodeRule = (type, getIsEdit, options)=>createRemoteRule('code', codeValidator, type, options, getIsEdit);
|
|
85
|
+
const getUrlRule = (type, options)=>createRemoteRule('url', urlValidator, type, options);
|
|
86
|
+
const getAsyncRule = (api)=>({
|
|
61
87
|
validator: function() {
|
|
62
88
|
var _ref = _async_to_generator(function*(value) {
|
|
63
89
|
try {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const isEdit = getIsEdit === null || getIsEdit === void 0 ? void 0 : getIsEdit();
|
|
67
|
-
if (isEdit) {
|
|
68
|
-
return true;
|
|
69
|
-
}
|
|
70
|
-
// 新建态校验code
|
|
71
|
-
const res = yield codeValidator(value, type, getData === null || getData === void 0 ? void 0 : getData())();
|
|
72
|
-
return res.data;
|
|
90
|
+
asyncErrorMessage = '';
|
|
91
|
+
yield api(value);
|
|
73
92
|
} catch (error) {
|
|
74
|
-
|
|
93
|
+
asyncErrorMessage = error.message;
|
|
75
94
|
return false;
|
|
76
95
|
}
|
|
77
96
|
});
|
|
@@ -79,7 +98,7 @@ export const useFormRule = (apiPrefix, spaceId)=>{
|
|
|
79
98
|
return _ref.apply(this, arguments);
|
|
80
99
|
};
|
|
81
100
|
}(),
|
|
82
|
-
message: ()=>
|
|
101
|
+
message: ()=>asyncErrorMessage,
|
|
83
102
|
trigger: 'change'
|
|
84
103
|
});
|
|
85
104
|
const getLengthRule = (label, num)=>({
|
|
@@ -95,11 +114,31 @@ export const useFormRule = (apiPrefix, spaceId)=>{
|
|
|
95
114
|
message: t('需要是http://或者https://开头的字符串'),
|
|
96
115
|
trigger: 'change'
|
|
97
116
|
});
|
|
117
|
+
const getNumberRule = ()=>({
|
|
118
|
+
validator: (value)=>!isNaN(+value),
|
|
119
|
+
message: t('需要是数字'),
|
|
120
|
+
trigger: 'change'
|
|
121
|
+
});
|
|
122
|
+
const getPositiveNumberRule = ()=>({
|
|
123
|
+
validator: (value)=>!isNaN(+value) && +value > 0,
|
|
124
|
+
message: t('需要是正数'),
|
|
125
|
+
trigger: 'change'
|
|
126
|
+
});
|
|
127
|
+
const getNonNegativeNumberRule = ()=>({
|
|
128
|
+
validator: (value)=>!isNaN(+value) && +value >= 0,
|
|
129
|
+
message: t('不能是负数'),
|
|
130
|
+
trigger: 'change'
|
|
131
|
+
});
|
|
98
132
|
return {
|
|
99
133
|
codeRule,
|
|
100
134
|
getApiUrlRule,
|
|
101
135
|
getNameRule,
|
|
102
136
|
getCodeRule,
|
|
103
|
-
|
|
137
|
+
getUrlRule,
|
|
138
|
+
getAsyncRule,
|
|
139
|
+
getLengthRule,
|
|
140
|
+
getNumberRule,
|
|
141
|
+
getPositiveNumberRule,
|
|
142
|
+
getNonNegativeNumberRule
|
|
104
143
|
};
|
|
105
144
|
};
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { type Ref } from 'vue';
|
|
2
2
|
import { Module } from '@/types/enum';
|
|
3
3
|
export declare const useMetaHttp: (apiPrefix: string, spaceId?: Ref<string>) => {
|
|
4
|
-
nameValidator: (name: string, type: Module) => () => Promise<{
|
|
4
|
+
nameValidator: (name: string, type: Module, data?: Record<string, unknown>, signal?: AbortSignal) => () => Promise<{
|
|
5
5
|
data: boolean;
|
|
6
6
|
message: string;
|
|
7
7
|
}>;
|
|
8
|
-
codeValidator: (code: string, type: Module, data?: Record<string, unknown
|
|
8
|
+
codeValidator: (code: string, type: Module, data?: Record<string, unknown>, signal?: AbortSignal) => () => Promise<{
|
|
9
|
+
data: boolean;
|
|
10
|
+
message: string;
|
|
11
|
+
}>;
|
|
12
|
+
urlValidator: (url: string, type: Module, data?: Record<string, unknown>, signal?: AbortSignal) => () => Promise<{
|
|
9
13
|
data: boolean;
|
|
10
14
|
message: string;
|
|
11
15
|
}>;
|
|
@@ -31,24 +31,37 @@ import { transferTagApi2Tag } from '../http/helper/meta.ts.js';
|
|
|
31
31
|
const metaPerfix = 'meta/v1';
|
|
32
32
|
export const useMetaHttp = (apiPrefix, spaceId)=>{
|
|
33
33
|
// 名称校验
|
|
34
|
-
const nameValidator = (name, type)=>()=>fetch.get(`${apiPrefix}/${metaPerfix}/name_valid/`, {
|
|
34
|
+
const nameValidator = (name, type, data, signal)=>()=>fetch.get(`${apiPrefix}/${metaPerfix}/name_valid/`, _object_spread({
|
|
35
35
|
name,
|
|
36
36
|
type
|
|
37
|
-
}, {
|
|
37
|
+
}, data), {
|
|
38
38
|
globalError: false,
|
|
39
39
|
headers: {
|
|
40
40
|
'x-space-id': spaceId === null || spaceId === void 0 ? void 0 : spaceId.value
|
|
41
|
-
}
|
|
41
|
+
},
|
|
42
|
+
signal
|
|
42
43
|
});
|
|
43
44
|
// code校验
|
|
44
|
-
const codeValidator = (code, type, data)=>()=>fetch.get(`${apiPrefix}/${metaPerfix}/code_valid/`, _object_spread({
|
|
45
|
+
const codeValidator = (code, type, data, signal)=>()=>fetch.get(`${apiPrefix}/${metaPerfix}/code_valid/`, _object_spread({
|
|
45
46
|
code,
|
|
46
47
|
type
|
|
47
48
|
}, data), {
|
|
48
49
|
globalError: false,
|
|
49
50
|
headers: {
|
|
50
51
|
'x-space-id': spaceId === null || spaceId === void 0 ? void 0 : spaceId.value
|
|
51
|
-
}
|
|
52
|
+
},
|
|
53
|
+
signal
|
|
54
|
+
});
|
|
55
|
+
// url校验
|
|
56
|
+
const urlValidator = (url, type, data, signal)=>()=>fetch.post(`${apiPrefix}/${metaPerfix}/url_valid/`, _object_spread({
|
|
57
|
+
url,
|
|
58
|
+
type
|
|
59
|
+
}, data), {
|
|
60
|
+
globalError: false,
|
|
61
|
+
headers: {
|
|
62
|
+
'x-space-id': spaceId === null || spaceId === void 0 ? void 0 : spaceId.value
|
|
63
|
+
},
|
|
64
|
+
signal
|
|
52
65
|
});
|
|
53
66
|
// 获取tag列表
|
|
54
67
|
const getTags = (module)=>fetch.get(`${apiPrefix}/${metaPerfix}/tag/`, {
|
|
@@ -81,6 +94,7 @@ export const useMetaHttp = (apiPrefix, spaceId)=>{
|
|
|
81
94
|
return {
|
|
82
95
|
nameValidator,
|
|
83
96
|
codeValidator,
|
|
97
|
+
urlValidator,
|
|
84
98
|
getTags,
|
|
85
99
|
plusTag,
|
|
86
100
|
checkTag
|
package/dist/hooks.d.ts
CHANGED
package/dist/hooks.ts.js
CHANGED
package/dist/i18n/en-US.d.ts
CHANGED
|
@@ -365,6 +365,9 @@ declare const _default: {
|
|
|
365
365
|
'\u9700\u8981\u662F\u82F1\u6587\u5B57\u7B26\u3001\u6570\u5B57\u3001\u4E2D\u5212\u7EBF': string;
|
|
366
366
|
'{label}\u957F\u5EA6\u4E0D\u80FD\u8D85\u8FC7{num}': string;
|
|
367
367
|
'\u9700\u8981\u662Fhttp://\u6216\u8005https://\u5F00\u5934\u7684\u5B57\u7B26\u4E32': string;
|
|
368
|
+
需要是数字: string;
|
|
369
|
+
需要是正数: string;
|
|
370
|
+
不能是负数: string;
|
|
368
371
|
系统错误: string;
|
|
369
372
|
};
|
|
370
373
|
export default _default;
|
package/dist/i18n/en-US.ts.js
CHANGED
|
@@ -365,5 +365,8 @@ export default {
|
|
|
365
365
|
'需要是英文字符、数字、中划线': 'Must contain only English letters, digits, and hyphens',
|
|
366
366
|
'{label}长度不能超过{num}': '{label} cannot exceed {num} characters',
|
|
367
367
|
'需要是http://或者https://开头的字符串': 'Must start with http:// or https://',
|
|
368
|
+
需要是数字: 'Must be a number',
|
|
369
|
+
需要是正数: 'Must be a positive number',
|
|
370
|
+
不能是负数: 'Cannot be negative',
|
|
368
371
|
系统错误: 'System Error'
|
|
369
372
|
};
|
package/dist/i18n/zh-CN.d.ts
CHANGED
|
@@ -365,6 +365,9 @@ declare const _default: {
|
|
|
365
365
|
'\u9700\u8981\u662F\u82F1\u6587\u5B57\u7B26\u3001\u6570\u5B57\u3001\u4E2D\u5212\u7EBF': string;
|
|
366
366
|
'{label}\u957F\u5EA6\u4E0D\u80FD\u8D85\u8FC7{num}': string;
|
|
367
367
|
'\u9700\u8981\u662Fhttp://\u6216\u8005https://\u5F00\u5934\u7684\u5B57\u7B26\u4E32': string;
|
|
368
|
+
需要是数字: string;
|
|
369
|
+
需要是正数: string;
|
|
370
|
+
不能是负数: string;
|
|
368
371
|
系统错误: string;
|
|
369
372
|
};
|
|
370
373
|
export default _default;
|
package/dist/i18n/zh-CN.ts.js
CHANGED
package/package.json
CHANGED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
.auto-refresh[data-v-tszutcyn] {
|
|
3
|
-
position: relative;
|
|
4
|
-
cursor: pointer;
|
|
5
|
-
line-height: 26px;
|
|
6
|
-
padding: 0 4px;
|
|
7
|
-
white-space: nowrap;
|
|
8
|
-
}
|
|
9
|
-
.auto-refresh[data-v-tszutcyn]:after {
|
|
10
|
-
content: '';
|
|
11
|
-
position: absolute;
|
|
12
|
-
top: 5px;
|
|
13
|
-
right: -5px;
|
|
14
|
-
width: 1px;
|
|
15
|
-
height: 16px;
|
|
16
|
-
background-color: #dcdee5;
|
|
17
|
-
z-index: 1;
|
|
18
|
-
}
|
|
19
|
-
.auto-refresh[data-v-tszutcyn]:hover {
|
|
20
|
-
color: var(--aidev-clickable-color);
|
|
21
|
-
background-color: #E1ECFF;
|
|
22
|
-
}
|
|
23
|
-
.refresh[data-v-tszutcyn] {
|
|
24
|
-
cursor: pointer;
|
|
25
|
-
line-height: 26px;
|
|
26
|
-
padding: 0 4px;
|
|
27
|
-
}
|
|
28
|
-
.refresh[data-v-tszutcyn]:hover {
|
|
29
|
-
color: var(--aidev-clickable-color);
|
|
30
|
-
background-color: #E1ECFF;
|
|
31
|
-
}
|
|
32
|
-
.textarea-list[data-v-tszutcyn] {
|
|
33
|
-
padding: 4px 0;
|
|
34
|
-
line-height: 32px;
|
|
35
|
-
max-height: 300px;
|
|
36
|
-
position: relative;
|
|
37
|
-
z-index: 2;
|
|
38
|
-
}
|
|
39
|
-
.textarea-list .textarea-item[data-v-tszutcyn] {
|
|
40
|
-
padding: 0 12px;
|
|
41
|
-
cursor: pointer;
|
|
42
|
-
}
|
|
43
|
-
.textarea-list .textarea-item[data-v-tszutcyn]:hover {
|
|
44
|
-
background: #E1ECFF;
|
|
45
|
-
color: var(--aidev-clickable-color);
|
|
46
|
-
}
|