agilebuilder-ui 1.1.44 → 1.1.45-ai2

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 (32) hide show
  1. package/lib/{401-1bde8dc9.js → 401-beb8c7d3.js} +1 -1
  2. package/lib/{404-48d76996.js → 404-453588b3.js} +1 -1
  3. package/lib/{iframe-page-77e184a0.js → iframe-page-11560b58.js} +1 -1
  4. package/lib/index-bc79f11f.js +93084 -0
  5. package/lib/super-ui.css +1 -1
  6. package/lib/super-ui.js +33 -32
  7. package/lib/super-ui.umd.cjs +168 -136
  8. package/lib/{tab-content-iframe-index-39745d49.js → tab-content-iframe-index-2cadaa46.js} +1 -1
  9. package/lib/{tab-content-index-65696e56.js → tab-content-index-3455e8d6.js} +1 -1
  10. package/lib/{tache-subprocess-history-ef943f95.js → tache-subprocess-history-cfb4e2eb.js} +1 -1
  11. package/package.json +7 -2
  12. package/packages/chat-embed/index.ts +6 -0
  13. package/packages/chat-embed/src/chat-embed-message.ts +79 -0
  14. package/packages/chat-embed/src/chat-embed.css +117 -0
  15. package/packages/chat-embed/src/chat-sender.vue +240 -0
  16. package/packages/chat-embed/src/header.vue +50 -0
  17. package/packages/chat-embed/src/index.vue +420 -0
  18. package/packages/chat-embed/src/recommendation-message.vue +37 -0
  19. package/packages/chat-embed/src/util.ts +33 -0
  20. package/packages/index.js +16 -13
  21. package/packages/json-view/index.ts +3 -0
  22. package/packages/json-view/json-view-dialog.vue +53 -0
  23. package/packages/json-view/json-view.vue +126 -0
  24. package/packages/super-grid/src/super-grid.vue +14 -1
  25. package/src/assets/chat-embed/avatar.png +0 -0
  26. package/src/i18n/langs/cn.js +14 -2
  27. package/src/i18n/langs/en.js +13 -1
  28. package/src/store/modules/chat-ai-store.ts +78 -0
  29. package/src/store/modules/tab-content.js +9 -3
  30. package/src/utils/chat-ai-util.ts +31 -0
  31. package/src/utils/common-util.js +50 -25
  32. package/lib/index-465b0d69.js +0 -73558
@@ -0,0 +1,126 @@
1
+ <template>
2
+ <div
3
+ :style="{
4
+ width: '100%'
5
+ }"
6
+ ref="cfCodemirrorJsonViewRef"
7
+ id="cf-codemirror-view-json"
8
+ ></div>
9
+ </template>
10
+ <script lang="ts" setup>
11
+ import { ref, defineProps, defineOptions, watch, nextTick, onMounted } from 'vue'
12
+ defineOptions({
13
+ name: 'JsonView',
14
+ inheritAttrs: false
15
+ })
16
+ import { basicSetup, EditorView } from 'codemirror'
17
+ import { jsonLanguage } from '@codemirror/lang-json'
18
+ import { EditorState, Facet } from '@codemirror/state'
19
+
20
+ const props = defineProps({
21
+ jsonObject: {
22
+ type: Object,
23
+ default: () => {}
24
+ },
25
+ height: {
26
+ type: Number,
27
+ default: 0
28
+ },
29
+ theme: {
30
+ type: String,
31
+ default: null
32
+ }
33
+ })
34
+ const editor = ref<any>(null)
35
+ const cfCodemirrorJsonViewRef = ref()
36
+ const codemirrorHeight = ref('400px')
37
+ watch(
38
+ () => props.jsonObject,
39
+ (newVal) => {
40
+ if (editor.value) {
41
+ // 更新 CodeMirror 中的值
42
+ loadEditor()
43
+ }
44
+ },
45
+ { deep: true }
46
+ )
47
+ onMounted(() => {
48
+ nextTick(() => {
49
+ loadEditor()
50
+ })
51
+ })
52
+
53
+ function loadEditor() {
54
+ if (editor.value) {
55
+ editor.value.destroy()
56
+ }
57
+ const jsonStr = props.jsonObject ? JSON.stringify(props.jsonObject, null, 2) : ''
58
+ if (props.height) {
59
+ codemirrorHeight.value = props.height + 'px'
60
+ } else {
61
+ if (cfCodemirrorJsonViewRef.value) {
62
+ const rect = cfCodemirrorJsonViewRef.value.getBoundingClientRect()
63
+ if (rect.y || rect.y === 0) {
64
+ console.log('window.innerHeight - rect.y', window.innerHeight, rect.y)
65
+ codemirrorHeight.value = window.innerHeight - rect.y - 100 + 'px'
66
+ }
67
+ }
68
+ }
69
+ const state = getEditorState(jsonStr)
70
+ let element: Element | null = document.getElementById('cf-codemirror-view-json')
71
+ if (element) {
72
+ editor.value = new EditorView({
73
+ state,
74
+ parent: element
75
+ })
76
+ }
77
+ }
78
+ // 获取编辑器状态
79
+ function getEditorState(jsonStr: string) {
80
+ // 获取主题
81
+ const mytheme = getTheme()
82
+ // 基本主题样式,主要设置字体大小和高度
83
+ const baseTheme = EditorView.theme({
84
+ '.cm-content, .cm-gutter': { minHeight: codemirrorHeight.value },
85
+ '&': {
86
+ height: codemirrorHeight.value,
87
+ maxHeight: codemirrorHeight.value,
88
+ fontSize: '12px'
89
+ }
90
+ })
91
+ return EditorState.create({
92
+ doc: jsonStr,
93
+ extensions: [
94
+ EditorState.tabSize.of(16),
95
+ basicSetup,
96
+ jsonLanguage,
97
+ mytheme,
98
+ baseTheme,
99
+ readOnlyFacet.of(true),
100
+ preventChanges
101
+ ]
102
+ })
103
+ }
104
+
105
+ // 创建一个新的 Facet
106
+ const readOnlyFacet = Facet.define<boolean, boolean>({ combine: (values) => values.some((a) => a) })
107
+
108
+ // 创建一个新的 StateField 来监听更改
109
+ const preventChanges = EditorState.transactionFilter.of((tr: any) => {
110
+ if (tr.isUserEvent && tr.docChanged && tr.state.facet(readOnlyFacet)) {
111
+ return {
112
+ changes: {
113
+ from: tr.changes.from,
114
+ to: tr.changes.to,
115
+ insert: tr.startState.doc.sliceString(tr.changes.from, tr.changes.to)
116
+ }
117
+ }
118
+ }
119
+ return tr
120
+ })
121
+
122
+ function getTheme() {
123
+ return EditorView.theme({})
124
+ }
125
+ </script>
126
+ <style scoped></style>
@@ -226,7 +226,7 @@ import { checkPermission } from '../../../src/utils/permission'
226
226
  import { getGuId } from '../../../src/utils/guid.js'
227
227
  // import resizeMixin from '../../../src/mixins/resizeMixin.js';
228
228
  import storeVuex from '../../../src/store'
229
-
229
+ import { setPageDataToChatAiStore, setPageInfoToChatStore } from '../../../src/utils/chat-ai-util.ts'
230
230
  export default {
231
231
  components: {
232
232
  IndexColumn,
@@ -924,6 +924,16 @@ export default {
924
924
  deep: true
925
925
  }
926
926
  )
927
+ if (!this.isFormSubTable) {
928
+ setPageInfoToChatStore(this.pageContext.menuCode, {
929
+ listRefs: [
930
+ {
931
+ ref: this
932
+ }
933
+ ],
934
+ pageType: 'list'
935
+ })
936
+ }
927
937
  })
928
938
  },
929
939
  beforeDestroy() {
@@ -3222,6 +3232,9 @@ export default {
3222
3232
  // this.$refs.superGrid?.toggleRowSelection(newSelection[newSelection.length - 1], false)
3223
3233
  // }
3224
3234
  }
3235
+ if (!this.isFormSubTable) {
3236
+ setPageDataToChatAiStore(newSelection)
3237
+ }
3225
3238
  this.selectionChange(newSelection)
3226
3239
  },
3227
3240
  // 显示移动端查询区域
Binary file
@@ -84,7 +84,7 @@ const cn = {
84
84
  uploadFileTip: '上传的文件不超过{fileSize}M',
85
85
  asyncExportJumpMsg: '或点击我跳转到下载页面',
86
86
  mustFill: '{label} 必须填写',
87
- filePathNotFound: '文件UUID未找到,请检查配置',
87
+ filePathNotFound: '文件UUID未找到,请检查配置'
88
88
  },
89
89
  // 列表组件
90
90
  superGrid: {
@@ -136,7 +136,7 @@ const cn = {
136
136
  prevRow: '上一行',
137
137
  nextRow: '下一行',
138
138
  detail: '详情',
139
- searchEmpty:'查询空值'
139
+ searchEmpty: '查询空值'
140
140
  },
141
141
  // 部门树组件
142
142
  departmentTree: {},
@@ -299,6 +299,18 @@ const cn = {
299
299
  },
300
300
  imatrixUIPromptMessage: {
301
301
  NoContent: '暂无内容'
302
+ },
303
+ chatEmbed: {
304
+ name: '小助手',
305
+ history: '历史记录',
306
+ minimize: '缩小',
307
+ fullscreen: '全屏',
308
+ close: '关闭',
309
+ regenerate: '重新生成',
310
+ copy: '复制',
311
+ newChat: '新建会话',
312
+ copySuccess: '复制成功',
313
+ requestFailed: '请求会话失败!'
302
314
  }
303
315
  }
304
316
  export default cn
@@ -136,7 +136,7 @@ const en = {
136
136
  prevRow: 'Prev Row',
137
137
  nextRow: 'Next Row',
138
138
  detail: 'Detail',
139
- searchEmpty:'Search Empty'
139
+ searchEmpty: 'Search Empty'
140
140
  },
141
141
  departmentTree: {},
142
142
  departmentTreeInline: {
@@ -298,6 +298,18 @@ const en = {
298
298
  },
299
299
  imatrixUIPromptMessage: {
300
300
  NoContent: 'No content'
301
+ },
302
+ chatEmbed: {
303
+ name: 'Assistant',
304
+ history: 'History',
305
+ minimize: 'Minimize',
306
+ fullscreen: 'Full Screen',
307
+ close: 'Close',
308
+ regenerate: 'Regenerate',
309
+ copy: 'Copy',
310
+ newChat: 'New Chat',
311
+ copySuccess: 'Copy successful',
312
+ requestFailed: 'Request failed!'
301
313
  }
302
314
  }
303
315
  export default en
@@ -0,0 +1,78 @@
1
+ import { ref, computed, reactive } from 'vue'
2
+ import { defineStore } from 'pinia'
3
+
4
+ type Menu = {
5
+ menuCode: string
6
+ menuName: string
7
+ }
8
+
9
+ export default defineStore('ChatAiStore', () => {
10
+ const currentTabName = ref('chat')
11
+ const activeMenu = ref<Menu>({
12
+ menuCode: '',
13
+ menuName: ''
14
+ })
15
+ const pageInfo = ref<any>({})
16
+
17
+ // 最后操作的表格实例
18
+ const pageRef = ref<any>(null)
19
+ const pageData = ref<any[]>([])
20
+
21
+ function setCurrentTabName(name: string) {
22
+ currentTabName.value = name
23
+ }
24
+
25
+ function getCurrentTabName() {
26
+ return currentTabName.value
27
+ }
28
+
29
+ function setPageInfoToChatStore(menuCode: string, info: any) {
30
+ pageInfo.value[menuCode] = info
31
+ }
32
+
33
+ function getPageInfo(menuCode: string) {
34
+ return pageInfo.value[menuCode] || null
35
+ }
36
+
37
+ function getActiveMenuPageInfo() {
38
+ return pageInfo.value[activeMenu.value.menuCode] || null
39
+ }
40
+
41
+ function setPageData(newSelection: any[]) {
42
+ pageData.value = JSON.parse(JSON.stringify(newSelection))
43
+ }
44
+
45
+ function getPageData() {
46
+ return pageData.value
47
+ }
48
+
49
+ function clearPageData() {
50
+ pageData.value = []
51
+ }
52
+
53
+ function setActiveMenu(menu: any) {
54
+ activeMenu.value = menu
55
+ }
56
+
57
+ function getActiveMenu() {
58
+ return activeMenu.value
59
+ }
60
+
61
+ function getPageType() {}
62
+
63
+ return {
64
+ setCurrentTabName,
65
+ getCurrentTabName,
66
+ setPageData,
67
+ getPageData,
68
+ clearPageData,
69
+ getActiveMenu,
70
+ setActiveMenu,
71
+ getPageType,
72
+ setPageInfoToChatStore,
73
+ getPageInfo,
74
+ getActiveMenuPageInfo,
75
+ pageData,
76
+ activeMenu
77
+ }
78
+ })
@@ -1,7 +1,8 @@
1
+ import { setActiveMenuToChatAiStore } from '../../utils/chat-ai-util.ts'
1
2
  const tabContent = {
2
3
  state: {
3
4
  openTab: [], // 所有打开的路由
4
- activeIndex: null, // 激活状态
5
+ activeIndex: null // 激活状态
5
6
  },
6
7
  mutations: {
7
8
  // 添加tabs
@@ -21,6 +22,11 @@ const tabContent = {
21
22
  },
22
23
  // 设置当前激活的tab
23
24
  set_active_index(state, index) {
25
+ const activeTab = state.openTab.find((item) => item.code === index)
26
+ setActiveMenuToChatAiStore({
27
+ menuCode: index,
28
+ menuName: activeTab?.name || ''
29
+ })
24
30
  state.activeIndex = index
25
31
  },
26
32
  // 清空tabs
@@ -28,9 +34,9 @@ const tabContent = {
28
34
  if (state.openTab.length > 0) {
29
35
  state.openTab.splice(0, state.openTab.length)
30
36
  }
31
- },
37
+ }
32
38
  },
33
- actions: {},
39
+ actions: {}
34
40
  }
35
41
 
36
42
  export default tabContent
@@ -0,0 +1,31 @@
1
+ function setPageDataToChatAiStore(ref, newSelection, type = 'list') {
2
+ try {
3
+ if (window.top.ChatAiStore) {
4
+ window.top.ChatAiStore.setPageData(ref, newSelection, type)
5
+ }
6
+ } catch (error) {
7
+ console.error('ChatAiStore not found', error)
8
+ }
9
+ }
10
+
11
+ function setActiveMenuToChatAiStore(activeMenu) {
12
+ try {
13
+ if (window.top.ChatAiStore) {
14
+ window.top.ChatAiStore.setActiveMenu(activeMenu)
15
+ }
16
+ } catch (error) {
17
+ console.error('ChatAiStore not found', error)
18
+ }
19
+ }
20
+
21
+ function setPageInfoToChatStore(menuCode, info) {
22
+ try {
23
+ if (window.top.ChatAiStore) {
24
+ window.top.ChatAiStore.setPageInfoToChatStore(menuCode, info)
25
+ }
26
+ } catch (error) {
27
+ console.error('ChatAiStore not found', error)
28
+ }
29
+ }
30
+
31
+ export { setPageDataToChatAiStore, setActiveMenuToChatAiStore, setPageInfoToChatStore }
@@ -1,6 +1,5 @@
1
1
  import * as Vue from 'vue'
2
- import authApi from './auth-api'
3
- import { getToken, getLanguage, getAllLanguages, setAllLanguages, removeToken } from './auth'
2
+ import { getToken, getLanguage, getAllLanguages, setAllLanguages } from './auth'
4
3
  import { v4 as uuidv4 } from 'uuid'
5
4
  import { getCookieCache } from './auth'
6
5
  import i18nUtil from './i18n-util'
@@ -231,7 +230,11 @@ export function isPlateSys(systemCode) {
231
230
 
232
231
  export function getServerConfigUtil(http) {
233
232
  return new Promise((resolve, reject) => {
234
- http.get('./server-config.json').then((result) => {
233
+ let timestamp = '1'
234
+ if(__BUILD_TIME__) {
235
+ timestamp = __BUILD_TIME__
236
+ }
237
+ http.get('./server-config.json?t='+timestamp).then((result) => {
235
238
  const config = result
236
239
  for (const key in config) {
237
240
  window.$vueApp.config.globalProperties[key] = config[key]
@@ -245,10 +248,10 @@ export function getServerConfigUtil(http) {
245
248
  localStorage.setItem('_baseAPI_', window.$vueApp.config.globalProperties.baseAPI)
246
249
  localStorage.setItem('_amb_projectModel_', window.$vueApp.config.globalProperties.projectModel)
247
250
  if (config.fontIconAddress && window.insertCssFile) {
248
- window.insertCssFile(`${config.fontIconAddress}/iconfont.css`)
251
+ window.insertCssFile(`${config.fontIconAddress}/iconfont.css?t=${timestamp}`)
249
252
  }
250
253
  if (config.fontIconAddress && window.insertCssFile) {
251
- window.insertCssFile(`${config.fontIconAddress}-color/iconfont.css`)
254
+ window.insertCssFile(`${config.fontIconAddress}-color/iconfont.css?t=${timestamp}`)
252
255
  }
253
256
  resolve()
254
257
  })
@@ -557,27 +560,49 @@ async function handlePlateSysLang(currentLanguage) {
557
560
  }
558
561
  }
559
562
  }
563
+ // 缓存项目设值信息
564
+ export function cacheProjectSetting() {
565
+ return new Promise((resolve,reject)=>{
566
+ const projectSettingCache = localStorage.getItem('PROJECT_SETTINGS')
567
+ let projectSettings = null
568
+ if(projectSettingCache && projectSettingCache === '_EMPTY_VALUE') {
569
+ resolve(projectSettings)
570
+ } else if (projectSettingCache) {
571
+ projectSettings = JSON.parse(projectSettingCache)
572
+ setBrowserFavicon(projectSettings)
573
+ resolve(projectSettings)
574
+ } else {
575
+ window.$vueApp.config.globalProperties.$http.get(window.$vueApp.config.globalProperties.baseAPI + '/cfg/project-settings').then((data) => {
576
+ if(data){
577
+ localStorage.setItem('PROJECT_SETTINGS', JSON.stringify(data))
578
+ projectSettings = data
579
+ setBrowserFavicon(projectSettings)
580
+ } else {
581
+ localStorage.setItem('PROJECT_SETTINGS', '_EMPTY_VALUE')
582
+ }
583
+ resolve(projectSettings)
584
+ }).catch((error)=>{
585
+ reject(error)
586
+ })
587
+ }
588
+ })
589
+ }
560
590
 
561
- // export function setProjectSetting() {
562
- // const projectSettingCache = Cookies.get('PROJECT_SETTINGS')
563
- // let projectSettings = null
564
- // if (projectSettingCache) {
565
- // projectSettings = JSON.parse(projectSettingCache)
566
- // // TODO:工具方法中没有this,这个代码会报错,先注释该方法,没找到调用它的地方
567
- // this.setLogoUrl(projectSettings)
568
- // } else {
569
- // window.$vueApp.config.globalProperties.$http.get(window.$vueApp.config.globalProperties.baseAPI + '/cfg/project-settings').then((data) => {
570
- // Cookies.set('PROJECT_SETTINGS', JSON.stringify(data))
571
- // projectSettings = data
572
- // })
573
- // }
574
- // if (projectSettings.browserImageUuid) {
575
- // const linkElement = document.getElementById('ambBrowserIcon')
576
- // if (linkElement) {
577
- // linkElement.href = window.$vueApp.config.globalProperties.baseAPI + '/cfg/project/icon/browserIcon'
578
- // }
579
- // }
580
- // }
591
+ function setBrowserFavicon(projectSettings){
592
+ const linkElement = document.getElementById('ambBrowserIcon')
593
+ if(!linkElement){
594
+ return
595
+ }
596
+ if (projectSettings) {
597
+ const browserIconUrl = window.$vueApp.config.globalProperties.baseAPI + '/cfg/project/icon/browserIcon?t='+__BUILD_TIME__
598
+ if(projectSettings.browserImageUuid && (!linkElement.href || linkElement.href !== browserIconUrl) ){
599
+ linkElement.href = browserIconUrl
600
+ }
601
+ }
602
+ if(!linkElement.href) {
603
+ linkElement.href = 'favicon.svg?t='+__BUILD_TIME__
604
+ }
605
+ }
581
606
 
582
607
  // 动态加载css
583
608
  export function loadCSS() {