@blueking/ai-ui-sdk 0.1.19-beta.8 → 0.1.19

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 (130) hide show
  1. package/dist/common/util.d.ts +24 -0
  2. package/dist/common/util.ts.js +41 -0
  3. package/dist/components/render-auth/auth-dialog.script.vue.js.js +27 -26
  4. package/dist/components/render-auto-height-textarea/index.vue.css +11 -11
  5. package/dist/components/render-auto-height-textarea/index.vue.js +1 -1
  6. package/dist/components/render-auto-refresh/index.vue.css +8 -8
  7. package/dist/components/render-auto-refresh/index.vue.js +1 -1
  8. package/dist/components/render-checkbox/index.vue.css +9 -9
  9. package/dist/components/render-checkbox/index.vue.js +1 -1
  10. package/dist/components/render-choose-tag/index.script.vue.js.js +129 -92
  11. package/dist/components/render-choose-tag/index.vue.css +7 -7
  12. package/dist/components/render-choose-tag/index.vue.d.ts +4 -0
  13. package/dist/components/render-choose-tag/index.vue.js +1 -1
  14. package/dist/components/render-collapse/index.vue.css +2 -2
  15. package/dist/components/render-collapse/index.vue.js +1 -1
  16. package/dist/components/render-dataset/components/dataset-data-status/index.script.vue.js.js +6 -8
  17. package/dist/components/render-dataset/components/dataset-data-tool-icons/index.script.vue.js +1 -1
  18. package/dist/components/render-dataset/components/edit-dataset-data/index.vue.css +3 -3
  19. package/dist/components/render-dataset/components/edit-dataset-data/index.vue.js +1 -1
  20. package/dist/components/render-dataset/components/operation-record/index.script.vue.js.js +36 -1
  21. package/dist/components/render-dataset/components/operation-record/index.vue.css +4 -4
  22. package/dist/components/render-dataset/components/operation-record/index.vue.js +1 -1
  23. package/dist/components/render-dataset/components/operation-record/table/index.script.vue.js +174 -0
  24. package/dist/components/render-dataset/components/operation-record/table/index.vue.css +1 -1
  25. package/dist/components/render-dataset/components/operation-record/table/index.vue.d.ts +5 -1
  26. package/dist/components/render-dataset/components/operation-record/table/index.vue.js +2 -2
  27. package/dist/components/render-dataset/components/operation-record/view-op-result/index.vue.css +2 -2
  28. package/dist/components/render-dataset/components/operation-record/view-op-result/index.vue.js +1 -1
  29. package/dist/components/render-dataset/components/plus-dataset/dataset-form.script.vue.js +39 -44
  30. package/dist/components/render-dataset/components/plus-dataset/index.script.vue.js.js +24 -6
  31. package/dist/components/render-dataset/components/plus-dataset/index.vue.css +2 -2
  32. package/dist/components/render-dataset/components/plus-dataset/index.vue.js +1 -1
  33. package/dist/components/render-dataset/components/plus-dataset-data/form/api.script.vue.js.js +21 -29
  34. package/dist/components/render-dataset/components/plus-dataset-data/form/api.vue.css +2 -2
  35. package/dist/components/render-dataset/components/plus-dataset-data/form/api.vue.js +1 -1
  36. package/dist/components/render-dataset/components/plus-dataset-data/form/dataset.script.vue.js.js +4 -1
  37. package/dist/components/render-dataset/components/plus-dataset-data/form/footer.vue.css +1 -1
  38. package/dist/components/render-dataset/components/plus-dataset-data/form/footer.vue.js +1 -1
  39. package/dist/components/render-dataset/components/plus-dataset-data/form/index.vue.css +2 -2
  40. package/dist/components/render-dataset/components/plus-dataset-data/form/index.vue.js +1 -1
  41. package/dist/components/render-dataset/components/plus-dataset-data/index.script.vue.js.js +6 -1
  42. package/dist/components/render-dataset/components/plus-dataset-data/index.vue.d.ts +1 -0
  43. package/dist/components/render-dataset/components/review-dataset-data/index.vue.css +10 -10
  44. package/dist/components/render-dataset/components/review-dataset-data/index.vue.js +1 -1
  45. package/dist/components/render-dataset/components/search-dataset/index.script.vue.js.js +21 -31
  46. package/dist/components/render-dataset/components/search-dataset/index.vue.d.ts +1 -0
  47. package/dist/components/render-dataset-detail/components/header.script.vue.js.js +1 -1
  48. package/dist/components/render-dataset-detail-origin-data/components/table/index.script.vue.js +245 -388
  49. package/dist/components/render-dataset-detail-origin-data/components/table/index.vue.d.ts +3 -1
  50. package/dist/components/render-dataset-detail-origin-data/index.script.vue.js.js +7 -6
  51. package/dist/components/render-dataset-detail-origin-data/index.vue.css +3 -3
  52. package/dist/components/render-dataset-detail-origin-data/index.vue.js +1 -1
  53. package/dist/components/render-dataset-list/components/header.script.vue.js.js +2 -2
  54. package/dist/components/render-dataset-list/components/main.script.vue.js.js +11 -7
  55. package/dist/components/render-dataset-list/components/main.vue.css +4 -4
  56. package/dist/components/render-dataset-list/components/main.vue.d.ts +1 -0
  57. package/dist/components/render-dataset-list/components/main.vue.js +1 -1
  58. package/dist/components/render-dataset-list/components/table.script.vue.js +408 -0
  59. package/dist/components/render-dataset-list/components/table.vue.d.ts +2 -0
  60. package/dist/components/render-dataset-list/components/table.vue.js +1 -1
  61. package/dist/components/render-dataset-list/index.script.vue.js.js +7 -2
  62. package/dist/components/render-dataset-list/index.vue.css +4 -1
  63. package/dist/components/render-dataset-list/index.vue.d.ts +1 -0
  64. package/dist/components/render-dataset-list/index.vue.js +1 -1
  65. package/dist/components/render-file-card/index.script.vue.js.js +5 -15
  66. package/dist/components/render-file-card/index.vue.css +11 -11
  67. package/dist/components/render-file-card/index.vue.js +1 -1
  68. package/dist/components/render-file-type-icon/index.vue.css +5 -5
  69. package/dist/components/render-file-type-icon/index.vue.js +1 -1
  70. package/dist/components/render-header/index.script.vue.js.js +10 -2
  71. package/dist/components/render-header/index.vue.css +3 -3
  72. package/dist/components/render-header/index.vue.d.ts +1 -1
  73. package/dist/components/render-header/index.vue.js +1 -1
  74. package/dist/components/render-like/index.script.vue.js.js +3 -3
  75. package/dist/components/render-like/index.vue.css +14 -13
  76. package/dist/components/render-like/index.vue.js +1 -1
  77. package/dist/components/render-router-tab/index.vue.css +4 -4
  78. package/dist/components/render-router-tab/index.vue.js +1 -1
  79. package/dist/components/render-search-empty/index.script.vue.js.js +61 -0
  80. package/dist/components/render-search-empty/index.vue.d.ts +20 -0
  81. package/dist/components/render-search-empty/index.vue.js +3 -0
  82. package/dist/components/render-t-table/index.script.vue.js +317 -0
  83. package/dist/components/render-t-table/index.vue.css +196 -0
  84. package/dist/components/render-t-table/index.vue.d.ts +58 -0
  85. package/dist/components/render-t-table/index.vue.js +5 -0
  86. package/dist/components/render-tag-tree/index.script.vue.js.js +101 -24
  87. package/dist/components/render-tag-tree/index.vue.css +7 -7
  88. package/dist/components/render-tag-tree/index.vue.d.ts +2 -1
  89. package/dist/components/render-tag-tree/index.vue.js +1 -1
  90. package/dist/components/render-tree/index.script.vue.js +17 -8
  91. package/dist/components/render-tree/index.vue.d.ts +4 -1
  92. package/dist/components.d.ts +3 -1
  93. package/dist/components.ts.js +3 -1
  94. package/dist/css/fonts/iconcool.eot +0 -0
  95. package/dist/css/fonts/iconcool.svg +3 -0
  96. package/dist/css/fonts/iconcool.ttf +0 -0
  97. package/dist/css/fonts/iconcool.woff +0 -0
  98. package/dist/css/iconcool.js +1 -1
  99. package/dist/css/style.css +3 -0
  100. package/dist/css/tailwind.css +88 -10
  101. package/dist/hooks/use-chat.d.ts +12 -4
  102. package/dist/hooks/use-common-http.d.ts +5 -2
  103. package/dist/hooks/use-common-http.ts.js +7 -5
  104. package/dist/hooks/use-dataset-http.d.ts +4 -3
  105. package/dist/hooks/use-dataset-http.ts.js +9 -5
  106. package/dist/hooks/use-ellipsis-tooltip.d.ts +4 -0
  107. package/dist/hooks/use-ellipsis-tooltip.ts.js +87 -0
  108. package/dist/hooks/use-member-http.d.ts +8 -0
  109. package/dist/hooks/use-member-http.ts.js +30 -0
  110. package/dist/hooks/use-meta-http.d.ts +3 -3
  111. package/dist/hooks/use-meta-http.ts.js +9 -5
  112. package/dist/hooks/use-t-table.d.ts +39 -0
  113. package/dist/hooks/use-t-table.ts.js +82 -0
  114. package/dist/hooks.d.ts +3 -0
  115. package/dist/hooks.ts.js +3 -0
  116. package/dist/http/fetch/index.ts.js +3 -2
  117. package/dist/http/helper/common.ts.js +4 -4
  118. package/dist/http/helper/dataset.ts.js +4 -2
  119. package/dist/http/helper/knowledge.ts.js +9 -3
  120. package/dist/http/helper/tool.ts.js +5 -4
  121. package/dist/images/market.png +0 -0
  122. package/dist/types/common.d.ts +23 -0
  123. package/dist/types/dataset.d.ts +2 -0
  124. package/dist/types/knowledge.d.ts +6 -0
  125. package/dist/types/tool.d.ts +3 -3
  126. package/dist/util.d.ts +1 -0
  127. package/dist/util.ts.js +1 -0
  128. package/package.json +11 -2
  129. package/dist/components/render-dataset/components/operation-record/table/index.script.vue.js.js +0 -226
  130. package/dist/components/render-dataset-list/components/table.script.vue.js.js +0 -592
@@ -22,15 +22,19 @@
22
22
  .g-flex-column {
23
23
  display: flex;
24
24
  flex-direction: column;
25
- align-items: center;
25
+ align-items: initial !important;
26
+ }
27
+
28
+ .g-align-center {
29
+ align-items: center !important;
26
30
  }
27
31
 
28
32
  .g-align-start {
29
- align-items: flex-start;
33
+ align-items: flex-start !important;
30
34
  }
31
35
 
32
36
  .g-align-self-center {
33
- align-self: center;
37
+ align-self: center !important;
34
38
  }
35
39
 
36
40
  .g-justify-between {
@@ -45,6 +49,10 @@
45
49
  justify-content: end;
46
50
  }
47
51
 
52
+ .g-justify-start {
53
+ justify-content: start;
54
+ }
55
+
48
56
  .g-overflow-hidden {
49
57
  overflow: hidden;
50
58
  }
@@ -74,6 +82,10 @@
74
82
  padding: 4px;
75
83
  }
76
84
 
85
+ .g-p-12 {
86
+ padding: 12px;
87
+ }
88
+
77
89
  .g-p-24 {
78
90
  padding: 24px;
79
91
  }
@@ -134,10 +146,6 @@
134
146
  margin-top: 25px;
135
147
  }
136
148
 
137
- .g-mt-30 {
138
- margin-top: 30px;
139
- }
140
-
141
149
  .g-mt-100 {
142
150
  margin-top: 100px;
143
151
  }
@@ -362,6 +370,14 @@
362
370
  padding-right: 5px !important;
363
371
  }
364
372
 
373
+ .g-pr-8 {
374
+ padding-right: 8px;
375
+ }
376
+
377
+ .g-pr-14 {
378
+ padding-right: 14px;
379
+ }
380
+
365
381
  .g-pr-16 {
366
382
  padding-right: 16px !important;
367
383
  }
@@ -374,10 +390,18 @@
374
390
  padding-top: 4px;
375
391
  }
376
392
 
393
+ .g-pt-8 {
394
+ padding-top: 8px;
395
+ }
396
+
377
397
  .g-pt-12 {
378
398
  padding-top: 12px;
379
399
  }
380
400
 
401
+ .g-pt-14 {
402
+ padding-top: 14px;
403
+ }
404
+
381
405
  .g-pt-16 {
382
406
  padding-top: 16px;
383
407
  }
@@ -402,10 +426,22 @@
402
426
  padding-bottom: 4px;
403
427
  }
404
428
 
429
+ .g-pb-8 {
430
+ padding-bottom: 8px;
431
+ }
432
+
433
+ .g-pb-10 {
434
+ padding-bottom: 10px;
435
+ }
436
+
405
437
  .g-pb-12 {
406
438
  padding-bottom: 12px;
407
439
  }
408
440
 
441
+ .g-pb-14 {
442
+ padding-bottom: 14px;
443
+ }
444
+
409
445
  .g-pb-16 {
410
446
  padding-bottom: 16px;
411
447
  }
@@ -426,6 +462,14 @@
426
462
  padding: 0 3px;
427
463
  }
428
464
 
465
+ .g-w-auto {
466
+ width: auto !important;
467
+ }
468
+
469
+ .g-w-0 {
470
+ width: 0 !important;
471
+ }
472
+
429
473
  .g-w-8 {
430
474
  width: 8px;
431
475
  }
@@ -614,8 +658,8 @@
614
658
  width: 108px;
615
659
  }
616
660
 
617
- .g-width-6rem {
618
- width: 6rem !important;
661
+ .g-width-5rem {
662
+ width: 5rem !important;
619
663
  }
620
664
 
621
665
  .g-height-max-600 {
@@ -654,6 +698,22 @@
654
698
  height: 42px;
655
699
  }
656
700
 
701
+ .g-height-56 {
702
+ height: 56px;
703
+ }
704
+
705
+ .g-height-60 {
706
+ height: 60px;
707
+ }
708
+
709
+ .g-height-70 {
710
+ height: 70px;
711
+ }
712
+
713
+ .g-height-78 {
714
+ height: 78px;
715
+ }
716
+
657
717
  .g-height-60 {
658
718
  height: 60px;
659
719
  }
@@ -700,7 +760,7 @@
700
760
 
701
761
  .g-hover-text-blue {
702
762
  &:hover {
703
- color: #3a84ff;
763
+ color: #3a84ff !important;
704
764
  }
705
765
  }
706
766
 
@@ -722,6 +782,12 @@
722
782
  }
723
783
  }
724
784
 
785
+ .g-hover-text-normal {
786
+ &:hover {
787
+ color: #4d4f56;
788
+ }
789
+ }
790
+
725
791
  .g-hover-border-blue {
726
792
  &:hover {
727
793
  border: 1px solid #3a84ff !important;
@@ -850,6 +916,10 @@
850
916
  column-gap: 16px;
851
917
  }
852
918
 
919
+ .g-gap-x-20 {
920
+ column-gap: 20px;
921
+ }
922
+
853
923
  .g-gap-x-21 {
854
924
  column-gap: 21px;
855
925
  }
@@ -931,3 +1001,11 @@
931
1001
  .g-rounded-2 {
932
1002
  border-radius: 2px;
933
1003
  }
1004
+
1005
+ .g-z-index-9999 {
1006
+ z-index: 9999;
1007
+ }
1008
+
1009
+ .g-fill-current-color {
1010
+ fill: currentColor;
1011
+ }
@@ -92,11 +92,11 @@ export declare const useChat: ({ handleStart, handleText, handleReferenceDoc, ha
92
92
  }[];
93
93
  creator: string;
94
94
  createTime: string;
95
- updateTime: string;
95
+ updatedBy?: string;
96
+ updatedAt?: string;
96
97
  toolCode: string;
97
98
  toolName: string;
98
99
  tagNames: string[][];
99
- icon: string;
100
100
  description: string;
101
101
  method: string;
102
102
  url: string;
@@ -303,6 +303,8 @@ export declare const useChat: ({ handleStart, handleText, handleReferenceDoc, ha
303
303
  };
304
304
  }[];
305
305
  };
306
+ approvers?: string[];
307
+ ticketUrl?: string;
306
308
  }[];
307
309
  knowledgebases?: {
308
310
  id?: number;
@@ -330,6 +332,7 @@ export declare const useChat: ({ handleStart, handleText, handleReferenceDoc, ha
330
332
  folderNumber?: number;
331
333
  url?: string;
332
334
  updatedBy?: string;
335
+ updatedAt?: string;
333
336
  indexConfig?: {
334
337
  vector_indexes: {
335
338
  index_name: string;
@@ -426,6 +429,7 @@ export declare const useChat: ({ handleStart, handleText, handleReferenceDoc, ha
426
429
  folderNumber?: number;
427
430
  url?: string;
428
431
  updatedBy?: string;
432
+ updatedAt?: string;
429
433
  indexConfig?: {
430
434
  vector_indexes: {
431
435
  index_name: string;
@@ -583,11 +587,11 @@ export declare const useChat: ({ handleStart, handleText, handleReferenceDoc, ha
583
587
  }[];
584
588
  creator: string;
585
589
  createTime: string;
586
- updateTime: string;
590
+ updatedBy?: string;
591
+ updatedAt?: string;
587
592
  toolCode: string;
588
593
  toolName: string;
589
594
  tagNames: string[][];
590
- icon: string;
591
595
  description: string;
592
596
  method: string;
593
597
  url: string;
@@ -794,6 +798,8 @@ export declare const useChat: ({ handleStart, handleText, handleReferenceDoc, ha
794
798
  };
795
799
  }[];
796
800
  };
801
+ approvers?: string[];
802
+ ticketUrl?: string;
797
803
  }[];
798
804
  knowledgebases?: {
799
805
  id?: number;
@@ -821,6 +827,7 @@ export declare const useChat: ({ handleStart, handleText, handleReferenceDoc, ha
821
827
  folderNumber?: number;
822
828
  url?: string;
823
829
  updatedBy?: string;
830
+ updatedAt?: string;
824
831
  indexConfig?: {
825
832
  vector_indexes: {
826
833
  index_name: string;
@@ -917,6 +924,7 @@ export declare const useChat: ({ handleStart, handleText, handleReferenceDoc, ha
917
924
  folderNumber?: number;
918
925
  url?: string;
919
926
  updatedBy?: string;
927
+ updatedAt?: string;
920
928
  indexConfig?: {
921
929
  vector_indexes: {
922
930
  index_name: string;
@@ -1,5 +1,8 @@
1
1
  import { type Ref } from 'vue';
2
- import { GroupType, Module } from '@/types/enum';
2
+ import { EnumCharacter, GroupType, Module } from '@/types/enum';
3
3
  export declare const useCommonHttp: (apiPrefix: string, spaceId?: Ref<string>) => {
4
- getTagTree: (module: Module, subModule: Module, tagName: string, groupType?: GroupType) => Promise<import("@/types/common").ITagTree>;
4
+ getTagTree: {
5
+ (module: Module, subModule: Module, tagName: string, groupType?: GroupType, generateType?: EnumCharacter): Promise<import("@/types/common").ITagTree>;
6
+ abort(): void;
7
+ };
5
8
  };
@@ -1,15 +1,17 @@
1
- import fetch from '../http/fetch/index.ts.js';
1
+ import fetch, { withAbort } from '../http/fetch/index.ts.js';
2
2
  import { transferTagTreeApiToTagTree } from '../http/helper/common.ts.js';
3
3
  export const useCommonHttp = (apiPrefix, spaceId)=>{
4
4
  // 获取标签树
5
- const getTagTree = (module, subModule, tagName, groupType)=>fetch.get(`${apiPrefix}/${module}/v1/${subModule}/tag_tree/`, {
5
+ const getTagTree = withAbort((signal, module, subModule, tagName, groupType, generateType)=>fetch.get(`${apiPrefix}/${module}/v1/${subModule}/tag_tree/`, {
6
6
  tag_name: tagName,
7
- group_type: groupType
7
+ group_type: groupType,
8
+ generate_type: generateType
8
9
  }, {
9
10
  headers: {
10
11
  'x-space-id': spaceId === null || spaceId === void 0 ? void 0 : spaceId.value
11
- }
12
- }).then((data)=>transferTagTreeApiToTagTree(data));
12
+ },
13
+ signal
14
+ }).then((data)=>transferTagTreeApiToTagTree(data)));
13
15
  return {
14
16
  getTagTree
15
17
  };
@@ -1,5 +1,6 @@
1
1
  import { type Ref } from 'vue';
2
2
  import type { IBatchRetryReviewDatasetData, IBatchReviewDatasetData, IComponent, IDatasetApi, IDatasetDataApi, IDatasetDataForm, IDatasetDataParam, IDatasetForm, IDatasetInfo, IDatasetListParam, IDatasetStatusInfo, IOperatRecordParam, ISchema, IUserInfoForm } from '@/types/dataset';
3
+ import { Module } from '@/types/enum';
3
4
  import type { ITagApi } from '@/types/meta';
4
5
  export declare const useDatasetHttp: (apiPrefix?: string, spaceId?: Ref<string>) => {
5
6
  getCompanyList: () => Promise<import("@/types/dataset").ICompany[]>;
@@ -45,7 +46,7 @@ export declare const useDatasetHttp: (apiPrefix?: string, spaceId?: Ref<string>)
45
46
  }>;
46
47
  batchReviewDatasetData: (data: IBatchReviewDatasetData) => Promise<unknown>;
47
48
  batchRetryReviewDatasetData: (data: IBatchRetryReviewDatasetData) => Promise<unknown>;
48
- getTags: () => Promise<import("@/types/meta").ITag[]>;
49
- plusTag: (tagNames: string[][]) => Promise<ITagApi>;
50
- checkTag: (tagNames: string[][]) => Promise<boolean>;
49
+ getTags: (module: Module) => Promise<import("@/types/meta").ITag[]>;
50
+ plusTag: (tagNames: string[][], module: Module) => Promise<ITagApi>;
51
+ checkTag: (tagNames: string[][], module: Module) => Promise<boolean>;
51
52
  };
@@ -202,14 +202,17 @@ export const useDatasetHttp = (apiPrefix, spaceId)=>{
202
202
  }
203
203
  });
204
204
  // 获取tag列表
205
- const getTags = ()=>fetch.get(`${apiPrefix}/${datasetPerfix}/tag/`, undefined, {
205
+ const getTags = (module)=>fetch.get(`${apiPrefix}/${datasetPerfix}/tag/`, {
206
+ scope_name: module
207
+ }, {
206
208
  headers: {
207
209
  'x-space-id': spaceId === null || spaceId === void 0 ? void 0 : spaceId.value
208
210
  }
209
211
  }).then((result)=>result.map(transferTagApi2Tag));
210
212
  // 新增 tag
211
- const plusTag = (tagNames)=>fetch.post(`${apiPrefix}/${datasetPerfix}/tag/`, {
212
- tag_names: tagNames
213
+ const plusTag = (tagNames, module)=>fetch.post(`${apiPrefix}/${datasetPerfix}/tag/`, {
214
+ tag_names: tagNames,
215
+ scope_name: module
213
216
  }, {
214
217
  globalError: false,
215
218
  headers: {
@@ -217,8 +220,9 @@ export const useDatasetHttp = (apiPrefix, spaceId)=>{
217
220
  }
218
221
  });
219
222
  // check tag
220
- const checkTag = (tagNames)=>fetch.post(`${apiPrefix}/${datasetPerfix}/tag/check/`, {
221
- tag_names: tagNames
223
+ const checkTag = (tagNames, module)=>fetch.post(`${apiPrefix}/${datasetPerfix}/tag/check/`, {
224
+ tag_names: tagNames,
225
+ scope_name: module
222
226
  }, {
223
227
  globalError: false,
224
228
  headers: {
@@ -0,0 +1,4 @@
1
+ import 'tippy.js/dist/tippy.css';
2
+ export declare const useEllipsisTooltip: () => {
3
+ handleInitEllipsisTooltip: () => void;
4
+ };
@@ -0,0 +1,87 @@
1
+ import tippy from 'tippy.js';
2
+ import 'tippy.js/dist/tippy.css';
3
+ // 全局事件代理,如果文本溢出,则显示 tooltip
4
+ export const useEllipsisTooltip = ()=>{
5
+ let tippyInstance = null;
6
+ const handleInitEllipsisTooltip = ()=>{
7
+ handleInitEvent();
8
+ handleInitStyle();
9
+ };
10
+ const handleInitEvent = ()=>{
11
+ document.addEventListener('mouseenter', handleMouseEnter, true);
12
+ };
13
+ const handleInitStyle = ()=>{
14
+ const style = document.createElement('style');
15
+ style.textContent = `
16
+ .tippy-box[data-theme~='ellipsis-tooltip'] .tippy-content {
17
+ font-size: 12px !important;
18
+ padding: 7px 14px !important;
19
+ white-space: pre-wrap !important;
20
+ max-height: 400px;
21
+ overflow-y: auto;
22
+ }
23
+ .tippy-box[data-theme~='ellipsis-tooltip'] .tippy-content::-webkit-scrollbar {
24
+ width: 6px;
25
+ height: 6px;
26
+ }
27
+ .tippy-box[data-theme~='ellipsis-tooltip'] .tippy-content::-webkit-scrollbar-thumb {
28
+ width: 6px;
29
+ height: 6px;
30
+ border-radius: 3px;
31
+ background-color: #dcdee5;
32
+
33
+ &:hover {
34
+ background-color: #979ba5;
35
+ }
36
+ }
37
+ .tippy-box[data-theme~='ellipsis-tooltip'][data-placement^=top]>.tippy-arrow:before {
38
+ bottom: -5px !important;
39
+ }
40
+ .tippy-box[data-theme~='ellipsis-tooltip'][data-placement^=bottom]>.tippy-arrow:before {
41
+ top: -5px !important;
42
+ }
43
+ `;
44
+ document.head.appendChild(style);
45
+ };
46
+ const handleMouseEnter = (event)=>{
47
+ var _target_hasAttribute;
48
+ const target = event.target;
49
+ // 没有标识,什么都不做
50
+ if (!(target === null || target === void 0 ? void 0 : (_target_hasAttribute = target.hasAttribute) === null || _target_hasAttribute === void 0 ? void 0 : _target_hasAttribute.call(target, 'data-ellipsis-tooltip'))) return;
51
+ const isOverflow = target.scrollWidth > target.clientWidth || target.scrollHeight > target.clientHeight;
52
+ // 没有溢出,什么都不做
53
+ if (!isOverflow) return;
54
+ const computedStyle = window.getComputedStyle(target);
55
+ const hasScrollbar = computedStyle.overflowX === 'scroll' || computedStyle.overflowX === 'auto' || computedStyle.overflowY === 'scroll' || computedStyle.overflowY === 'auto' || computedStyle.overflow === 'scroll' || computedStyle.overflow === 'auto';
56
+ // 如果有滚动条,不显示 tooltip
57
+ if (hasScrollbar) return;
58
+ // 如果有旧实例,先销毁
59
+ if (tippyInstance) {
60
+ tippyInstance.destroy();
61
+ tippyInstance = null;
62
+ }
63
+ tippyInstance = tippy(target, {
64
+ content: target.getAttribute('data-ellipsis-tooltip') || target.textContent,
65
+ interactive: true,
66
+ arrow: true,
67
+ appendTo: ()=>document.body,
68
+ hideOnClick: false,
69
+ offset: [
70
+ 0,
71
+ 2
72
+ ],
73
+ theme: 'ellipsis-tooltip',
74
+ onHidden: (instance)=>{
75
+ // tooltip 隐藏后销毁实例
76
+ instance.destroy();
77
+ if (tippyInstance === instance) {
78
+ tippyInstance = null;
79
+ }
80
+ }
81
+ });
82
+ tippyInstance.show();
83
+ };
84
+ return {
85
+ handleInitEllipsisTooltip
86
+ };
87
+ };
@@ -0,0 +1,8 @@
1
+ interface IMember {
2
+ id: string;
3
+ name: string;
4
+ }
5
+ export declare const useMemberHttp: () => {
6
+ getMemberList: (memberUrl: string, search: string) => Promise<IMember[]>;
7
+ };
8
+ export {};
@@ -0,0 +1,30 @@
1
+ import { Message } from 'bkui-vue';
2
+ export const useMemberHttp = ()=>{
3
+ const getMemberList = (memberUrl, search)=>{
4
+ return new Promise((resolve, reject)=>{
5
+ const callback = `jsonp_init_bk_member_${Math.ceil(Math.random() * 1000)}`;
6
+ const script = document.createElement('script');
7
+ script.src = `${memberUrl}?callback=${callback}&app_code=bk-magicbox&fuzzy_lookups=${search}`;
8
+ script.onerror = reject;
9
+ document.body.appendChild(script);
10
+ // @ts-ignore
11
+ window[callback] = (res)=>{
12
+ if (!res.code) {
13
+ resolve(res.data.results.map((item)=>({
14
+ id: item.username,
15
+ name: `${item.username}(${item.display_name})`
16
+ })));
17
+ } else {
18
+ reject(res.message);
19
+ Message({
20
+ theme: 'error',
21
+ message: res.message
22
+ });
23
+ }
24
+ };
25
+ });
26
+ };
27
+ return {
28
+ getMemberList
29
+ };
30
+ };
@@ -10,7 +10,7 @@ export declare const useMetaHttp: (apiPrefix: string, spaceId?: Ref<string>) =>
10
10
  data: boolean;
11
11
  message: string;
12
12
  }>;
13
- getTags: () => Promise<import("@/types/meta").ITag[]>;
14
- plusTag: (tagNames: string[][]) => Promise<ITagApi>;
15
- checkTag: (tagNames: string[][]) => Promise<boolean>;
13
+ getTags: (module: Module) => Promise<import("@/types/meta").ITag[]>;
14
+ plusTag: (tagNames: string[][], module: Module) => Promise<ITagApi>;
15
+ checkTag: (tagNames: string[][], module: Module) => Promise<boolean>;
16
16
  };
@@ -51,14 +51,17 @@ export const useMetaHttp = (apiPrefix, spaceId)=>{
51
51
  }
52
52
  });
53
53
  // 获取tag列表
54
- const getTags = ()=>fetch.get(`${apiPrefix}/${metaPerfix}/tag/`, undefined, {
54
+ const getTags = (module)=>fetch.get(`${apiPrefix}/${metaPerfix}/tag/`, {
55
+ scope_name: module
56
+ }, {
55
57
  headers: {
56
58
  'x-space-id': spaceId === null || spaceId === void 0 ? void 0 : spaceId.value
57
59
  }
58
60
  }).then((result)=>result.map(transferTagApi2Tag));
59
61
  // 新增 tag
60
- const plusTag = (tagNames)=>fetch.post(`${apiPrefix}/${metaPerfix}/tag/`, {
61
- tag_names: tagNames
62
+ const plusTag = (tagNames, module)=>fetch.post(`${apiPrefix}/${metaPerfix}/tag/`, {
63
+ tag_names: tagNames,
64
+ scope_name: module
62
65
  }, {
63
66
  globalError: false,
64
67
  headers: {
@@ -66,8 +69,9 @@ export const useMetaHttp = (apiPrefix, spaceId)=>{
66
69
  }
67
70
  });
68
71
  // check tag
69
- const checkTag = (tagNames)=>fetch.post(`${apiPrefix}/${metaPerfix}/tag/check/`, {
70
- tag_names: tagNames
72
+ const checkTag = (tagNames, module)=>fetch.post(`${apiPrefix}/${metaPerfix}/tag/check/`, {
73
+ tag_names: tagNames,
74
+ scope_name: module
71
75
  }, {
72
76
  globalError: false,
73
77
  headers: {
@@ -0,0 +1,39 @@
1
+ import type { IPagination, IPaginationParam, ISortParam, ITTableSort } from '@/types/common';
2
+ import { OrderMethod } from '@/types/enum';
3
+ interface IPaginatedApiResult<T> {
4
+ results?: T;
5
+ count?: number;
6
+ }
7
+ export declare const useTTable: <T>() => {
8
+ isLoading: import("vue").Ref<boolean, boolean>;
9
+ initHook: (callBackFn: (search: IPaginationParam & ISortParam) => Promise<IPaginatedApiResult<T> | T>, isShowPagination: boolean) => void;
10
+ sort: import("vue").Ref<{
11
+ descending?: OrderMethod;
12
+ sortKey?: string;
13
+ }, ITTableSort | {
14
+ descending?: OrderMethod;
15
+ sortKey?: string;
16
+ }>;
17
+ handleSortChange: (config: {
18
+ descending: boolean;
19
+ }, { col }: {
20
+ col: {
21
+ sortKey: string;
22
+ };
23
+ }) => Promise<void>;
24
+ triggerApi: () => Promise<void>;
25
+ pagination: import("vue").Ref<{
26
+ current: number;
27
+ limit: number;
28
+ count: number;
29
+ }, IPagination | {
30
+ current: number;
31
+ limit: number;
32
+ count: number;
33
+ }>;
34
+ resetPagination: () => void;
35
+ tableData: [[] | T] extends [import("vue").Ref<any, any>] ? import("@vue/shared").IfAny<import("vue").Ref<any, any> & ([] | T), import("vue").Ref<import("vue").Ref<any, any> & ([] | T), import("vue").Ref<any, any> & ([] | T)>, import("vue").Ref<any, any> & ([] | T)> : import("vue").Ref<[] | import("vue").UnwrapRef<T>, [] | T | import("vue").UnwrapRef<T>>;
36
+ handlePageChange: (current: number) => void;
37
+ handlePageSizeChange: (pageSize: number) => void;
38
+ };
39
+ export {};
@@ -0,0 +1,82 @@
1
+ import { ref } from 'vue';
2
+ import { OrderMethod } from '../types/enum.ts.js';
3
+ export const useTTable = ()=>{
4
+ const isLoading = ref(false);
5
+ const isPagination = ref(false);
6
+ let callBack;
7
+ const sort = ref({});
8
+ const tableData = ref([]);
9
+ const pagination = ref({
10
+ current: 1,
11
+ limit: 20,
12
+ count: 0
13
+ });
14
+ // 更新数据
15
+ const triggerApi = ()=>{
16
+ isLoading.value = true;
17
+ return callBack({
18
+ page: pagination.value.current,
19
+ pageSize: pagination.value.limit,
20
+ orderBy: sort.value.sortKey,
21
+ orderMethod: sort.value.descending
22
+ }).then((apiResult)=>{
23
+ if (isPagination.value) {
24
+ tableData.value = apiResult.results;
25
+ pagination.value.count = apiResult.count;
26
+ } else {
27
+ tableData.value = apiResult;
28
+ }
29
+ }).finally(()=>{
30
+ isLoading.value = false;
31
+ });
32
+ };
33
+ const initHook = (callBackFn, isShowPagination)=>{
34
+ callBack = callBackFn;
35
+ isPagination.value = isShowPagination;
36
+ };
37
+ // sortKey 为必传
38
+ const handleSortChange = (config, { col })=>{
39
+ if (!config) {
40
+ sort.value = {};
41
+ return triggerApi();
42
+ }
43
+ const { descending } = config;
44
+ sort.value = {
45
+ sortKey: col.sortKey,
46
+ descending: descending ? OrderMethod.Desc : OrderMethod.Asc
47
+ };
48
+ triggerApi();
49
+ };
50
+ // 分页器 当前页变化处理
51
+ const handlePageChange = (current)=>{
52
+ if (pagination.value.current === current) return;
53
+ pagination.value.current = current;
54
+ triggerApi();
55
+ };
56
+ // 分页器 页码大小变化处理
57
+ const handlePageSizeChange = (pageSize)=>{
58
+ if (pagination.value.limit === pageSize) return;
59
+ pagination.value.limit = pageSize;
60
+ pagination.value.current = 1;
61
+ triggerApi();
62
+ };
63
+ const resetPagination = ()=>{
64
+ pagination.value = {
65
+ current: 1,
66
+ limit: 20,
67
+ count: 0
68
+ };
69
+ };
70
+ return {
71
+ isLoading,
72
+ initHook,
73
+ sort,
74
+ handleSortChange,
75
+ triggerApi,
76
+ pagination,
77
+ resetPagination,
78
+ tableData,
79
+ handlePageChange,
80
+ handlePageSizeChange
81
+ };
82
+ };
package/dist/hooks.d.ts CHANGED
@@ -7,3 +7,6 @@ export * from './hooks/use-table';
7
7
  export * from './hooks/use-permission';
8
8
  export * from './hooks/use-think';
9
9
  export * from './hooks/use-reference-doc';
10
+ export * from './hooks/use-member-http';
11
+ export * from './hooks/use-t-table';
12
+ export * from './hooks/use-ellipsis-tooltip';
package/dist/hooks.ts.js CHANGED
@@ -7,3 +7,6 @@ export * from './hooks/use-table.ts.js';
7
7
  export * from './hooks/use-permission.ts.js';
8
8
  export * from './hooks/use-think.ts.js';
9
9
  export * from './hooks/use-reference-doc.ts.js';
10
+ export * from './hooks/use-member-http.ts.js';
11
+ export * from './hooks/use-t-table.ts.js';
12
+ export * from './hooks/use-ellipsis-tooltip.ts.js';