@opentiny/vue-docs 3.24.6 → 3.26.0
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/.stylelintrc.js +2 -2
- package/demos/apis/button.js +15 -0
- package/demos/apis/calendar-view.js +3 -2
- package/demos/apis/chart-demo.js +1 -1
- package/demos/apis/chart-docs.js +1 -1
- package/demos/apis/chart-events.js +1 -1
- package/demos/apis/chart-question.js +1 -1
- package/demos/apis/chart.js +1 -1
- package/demos/apis/form.js +3 -0
- package/demos/apis/grid.js +76 -16
- package/demos/apis/modal.js +1 -1
- package/demos/apis/numeric.js +3 -3
- package/demos/apis/search.js +28 -0
- package/demos/apis/slider-button.js +22 -0
- package/demos/apis/split.js +11 -0
- package/demos/apis/steps.js +3 -3
- package/demos/apis/tabs.js +12 -0
- package/demos/apis/time-line.js +20 -0
- package/demos/mobile-first/app/button/type.vue +1 -1
- package/demos/mobile-first/app/button/webdoc/button.js +2 -2
- package/demos/mobile-first/app/slider-button/basic-usage.vue +5 -5
- package/demos/mobile-first/app/slider-button/webdoc/slider-button.js +1 -1
- package/demos/mobile-first/app/steps/advanced-steps.vue +8 -1
- package/demos/mobile-first/menus.js +16 -9
- package/demos/pc/app/action-menu/basic-usage-composition-api.vue +1 -1
- package/demos/pc/app/action-menu/basic-usage.vue +1 -1
- package/demos/pc/app/action-menu/card-mode-composition-api.vue +1 -1
- package/demos/pc/app/action-menu/card-mode.vue +1 -1
- package/demos/pc/app/action-menu/disabled-composition-api.vue +2 -2
- package/demos/pc/app/action-menu/disabled.vue +2 -2
- package/demos/pc/app/action-menu/events-composition-api.vue +1 -1
- package/demos/pc/app/action-menu/events.vue +1 -1
- package/demos/pc/app/action-menu/icon-composition-api.vue +2 -2
- package/demos/pc/app/action-menu/icon.vue +2 -2
- package/demos/pc/app/action-menu/max-show-num-composition-api.vue +1 -1
- package/demos/pc/app/action-menu/max-show-num.vue +1 -1
- package/demos/pc/app/action-menu/more-text-composition-api.vue +1 -1
- package/demos/pc/app/action-menu/more-text.vue +1 -1
- package/demos/pc/app/action-menu/popper-class-composition-api.vue +1 -1
- package/demos/pc/app/action-menu/popper-class.vue +1 -1
- package/demos/pc/app/action-menu/slot-item-composition-api.vue +1 -1
- package/demos/pc/app/action-menu/slot-item.vue +1 -1
- package/demos/pc/app/action-menu/spacing-composition-api.vue +1 -1
- package/demos/pc/app/action-menu/spacing.vue +1 -1
- package/demos/pc/app/action-menu/text-field-composition-api.vue +1 -1
- package/demos/pc/app/action-menu/text-field.spec.ts +1 -1
- package/demos/pc/app/action-menu/text-field.vue +1 -1
- package/demos/pc/app/amount/custom-service.spec.js +4 -4
- package/demos/pc/app/base-select/slot-reference.spec.ts +1 -1
- package/demos/pc/app/button/icon-composition-api.vue +3 -1
- package/demos/pc/app/button/icon.vue +3 -1
- package/demos/pc/app/button/webdoc/button.js +3 -2
- package/demos/pc/app/calendar-view/calendar-mode-composition-api.vue +7 -1
- package/demos/pc/app/calendar-view/calendar-mode.spec.ts +3 -0
- package/demos/pc/app/calendar-view/calendar-mode.vue +7 -1
- package/demos/pc/app/carousel/webdoc/carousel.js +0 -18
- package/demos/pc/app/color-picker/alpha-composition-api.vue +1 -1
- package/demos/pc/app/color-picker/alpha.spec.ts +2 -2
- package/demos/pc/app/color-picker/alpha.vue +1 -1
- package/demos/pc/app/color-picker/base.spec.ts +2 -2
- package/demos/pc/app/color-picker/default-visible.spec.ts +1 -1
- package/demos/pc/app/color-picker/event-composition-api.vue +2 -2
- package/demos/pc/app/color-picker/event.spec.ts +4 -4
- package/demos/pc/app/color-picker/event.vue +1 -1
- package/demos/pc/app/color-picker/format.spec.ts +6 -6
- package/demos/pc/app/color-picker/history.spec.ts +1 -7
- package/demos/pc/app/color-picker/predefine.spec.ts +3 -10
- package/demos/pc/app/color-picker/size.spec.ts +4 -4
- package/demos/pc/app/color-select-panel/format.spec.ts +2 -8
- package/demos/pc/app/color-select-panel/history.spec.ts +0 -2
- package/demos/pc/app/color-select-panel/predefine.spec.ts +0 -3
- package/demos/pc/app/container/basic-usage-composition-api.vue +10 -10
- package/demos/pc/app/container/basic-usage.vue +10 -10
- package/demos/pc/app/container/custom-with-height-composition-api.vue +8 -8
- package/demos/pc/app/container/custom-with-height.vue +10 -10
- package/demos/pc/app/date-panel/custom-week.spec.ts +2 -2
- package/demos/pc/app/dialog-select/nest-grid-single.spec.ts +40 -0
- package/demos/pc/app/dialog-select/nest-tree-multi.spec.ts +53 -0
- package/demos/pc/app/dialog-select/nest-tree-single.spec.ts +25 -0
- package/demos/pc/app/dialog-select/set-selection.spec.ts +20 -0
- package/demos/pc/app/file-upload/before-upload-limit-composition-api.vue +1 -1
- package/demos/pc/app/file-upload/before-upload-limit.spec.ts +1 -1
- package/demos/pc/app/file-upload/before-upload-limit.vue +1 -1
- package/demos/pc/app/file-upload/custom-trigger-composition-api.vue +1 -1
- package/demos/pc/app/file-upload/custom-trigger.spec.ts +1 -1
- package/demos/pc/app/file-upload/custom-trigger.vue +1 -1
- package/demos/pc/app/file-upload/custom-upload-tip-composition-api.vue +1 -1
- package/demos/pc/app/file-upload/custom-upload-tip.vue +1 -1
- package/demos/pc/app/file-upload/form-validation-composition-api.vue +1 -1
- package/demos/pc/app/file-upload/form-validation.vue +1 -1
- package/demos/pc/app/file-upload/image-size-composition-api.vue +1 -1
- package/demos/pc/app/file-upload/image-size.spec.ts +1 -1
- package/demos/pc/app/file-upload/image-size.vue +1 -1
- package/demos/pc/app/file-upload/multiple-file-composition-api.vue +1 -1
- package/demos/pc/app/file-upload/multiple-file.spec.ts +1 -1
- package/demos/pc/app/file-upload/multiple-file.vue +1 -1
- package/demos/pc/app/file-upload/prevent-delete-file-composition-api.vue +1 -1
- package/demos/pc/app/file-upload/prevent-delete-file.vue +1 -1
- package/demos/pc/app/file-upload/upload-request-composition-api.vue +1 -1
- package/demos/pc/app/file-upload/upload-request.spec.ts +2 -2
- package/demos/pc/app/file-upload/upload-request.vue +1 -1
- package/demos/pc/app/grid/base/basic-usage-composition-api.vue +1 -17
- package/demos/pc/app/grid/custom/column-fixed.spec.js +2 -1
- package/demos/pc/app/grid/custom/page-size.spec.js +1 -1
- package/demos/pc/app/grid/data-source/auto-load.spec.js +0 -1
- package/demos/pc/app/grid/data-source/request-service.spec.js +1 -1
- package/demos/pc/app/grid/data-source/static-data.spec.js +1 -1
- package/demos/pc/app/grid/dynamically-columns/dynamically-columns.spec.js +2 -1
- package/demos/pc/app/grid/edit/scrollbar-not-blur-composition-api.vue +119 -0
- package/demos/pc/app/grid/edit/scrollbar-not-blur.spec.ts +28 -0
- package/demos/pc/app/grid/edit/scrollbar-not-blur.vue +129 -0
- package/demos/pc/app/grid/editor/custom-edit.spec.js +7 -2
- package/demos/pc/app/grid/empty/empty-data-iscenter.spec.js +1 -1
- package/demos/pc/app/grid/event/toolbar-button-click-event.spec.js +1 -1
- package/demos/pc/app/grid/expand/expand-trigger-slot-composition-api.vue +85 -0
- package/demos/pc/app/grid/expand/expand-trigger-slot.spec.ts +11 -0
- package/demos/pc/app/grid/expand/expand-trigger-slot.vue +95 -0
- package/demos/pc/app/grid/expand/set-row-expansion.spec.js +4 -0
- package/demos/pc/app/grid/filter/custom-filter.spec.js +3 -3
- package/demos/pc/app/grid/filter/default-filter-composition-api.vue +6 -0
- package/demos/pc/app/grid/filter/default-filter.vue +6 -0
- package/demos/pc/app/grid/filter/default-relation.spec.js +1 -1
- package/demos/pc/app/grid/filter/server-filter.spec.js +1 -1
- package/demos/pc/app/grid/filter/simple-filter.spec.ts +5 -4
- package/demos/pc/app/grid/fixed/right-fixed-composition-api.vue +4 -4
- package/demos/pc/app/grid/fixed/right-fixed.vue +4 -4
- package/demos/pc/app/grid/footer/footer-summation-empty.spec.js +0 -1
- package/demos/pc/app/grid/large-data/full-data-loading.spec.js +10 -3
- package/demos/pc/app/grid/large-data/virtual-rolling.spec.js +9 -2
- package/demos/pc/app/grid/mouse-keyboard/keyboard-navigation.spec.js +4 -1
- package/demos/pc/app/grid/renderer/inner-renderer-date-composition-api.vue +4 -3
- package/demos/pc/app/grid/renderer/inner-renderer-date.spec.js +2 -2
- package/demos/pc/app/grid/renderer/inner-renderer-date.vue +3 -3
- package/demos/pc/app/grid/renderer/inner-renderer.spec.js +4 -0
- package/demos/pc/app/grid/size/max-min-grid-height.spec.js +2 -2
- package/demos/pc/app/grid/slot/slot-conf-composition-api.vue +141 -0
- package/demos/pc/app/grid/slot/slot-conf.spec.js +12 -0
- package/demos/pc/app/grid/slot/slot-conf.vue +151 -0
- package/demos/pc/app/grid/sort/combinations-sort.spec.js +2 -2
- package/demos/pc/app/grid/webdoc/grid-edit.js +12 -0
- package/demos/pc/app/grid/webdoc/grid-empty.js +1 -1
- package/demos/pc/app/grid/webdoc/grid-expand.js +11 -0
- package/demos/pc/app/grid/webdoc/grid-slot.js +9 -0
- package/demos/pc/app/icon/iconGroups.js +8 -2
- package/demos/pc/app/input/basic-usage.spec.ts +1 -1
- package/demos/pc/app/loading/background.spec.ts +3 -1
- package/demos/pc/app/loading/custom-class.spec.ts +4 -2
- package/demos/pc/app/loading/fullscreen.spec.ts +6 -4
- package/demos/pc/app/loading/loading-tip-text.spec.ts +3 -1
- package/demos/pc/app/loading/size.spec.ts +5 -3
- package/demos/pc/app/locales/custom-service-composition-api.vue +3 -3
- package/demos/pc/app/locales/custom-service.spec.ts +1 -1
- package/demos/pc/app/locales/custom-service.vue +3 -3
- package/demos/pc/app/modal/basic-usage.spec.ts +2 -1
- package/demos/pc/app/modal/message-close.spec.ts +2 -2
- package/demos/pc/app/modal/message-id.spec.ts +2 -2
- package/demos/pc/app/modal/modal-fn-slots.spec.ts +5 -7
- package/demos/pc/app/modal/modal-header.spec.ts +2 -1
- package/demos/pc/app/numeric/input-event-composition-api.vue +26 -0
- package/demos/pc/app/numeric/input-event.spec.ts +15 -0
- package/demos/pc/app/numeric/input-event.vue +34 -0
- package/demos/pc/app/numeric/webdoc/numeric.js +12 -0
- package/demos/pc/app/pager/align-composition-api.vue +10 -13
- package/demos/pc/app/pager/align.spec.ts +8 -3
- package/demos/pc/app/pager/align.vue +11 -5
- package/demos/pc/app/pager/page-size-composition-api.vue +2 -2
- package/demos/pc/app/pager/page-size.spec.ts +1 -1
- package/demos/pc/app/pager/page-size.vue +2 -2
- package/demos/pc/app/pager/pager-in-grid-composition-api.vue +0 -1
- package/demos/pc/app/pager/pager-in-grid.vue +0 -1
- package/demos/pc/app/pager/popper-append-to-body-composition-api.vue +1 -7
- package/demos/pc/app/pager/popper-append-to-body.vue +1 -7
- package/demos/pc/app/pager/popper-class-composition-api.vue +1 -7
- package/demos/pc/app/pager/popper-class.vue +1 -7
- package/demos/pc/app/popeditor/conditions.spec.ts +1 -1
- package/demos/pc/app/popeditor/suggest.spec.ts +1 -1
- package/demos/pc/app/qr-code/icon-composition-api.vue +17 -3
- package/demos/pc/app/qr-code/icon.spec.ts +19 -0
- package/demos/pc/app/qr-code/icon.vue +25 -4
- package/demos/pc/app/qr-code/style-composition-api.vue +2 -9
- package/demos/pc/app/qr-code/style.spec.ts +18 -1
- package/demos/pc/app/qr-code/style.vue +11 -8
- package/demos/pc/app/query-builder/webdoc/query-builder.js +5 -3
- package/demos/pc/app/search/events.spec.ts +1 -1
- package/demos/pc/app/search/events.vue +9 -0
- package/demos/pc/app/search/slot-prefix-suffix.spec.ts +1 -1
- package/demos/pc/app/search/webdoc/search.js +12 -4
- package/demos/pc/app/select/nest-grid-remote.spec.ts +3 -3
- package/demos/pc/app/select/nest-grid.spec.ts +1 -1
- package/demos/pc/app/select/nest-radio-grid-much-data.spec.ts +5 -7
- package/demos/pc/app/tabs/basic-usage.spec.ts +2 -2
- package/demos/pc/app/tabs/header-only.vue +56 -0
- package/demos/pc/app/tabs/size.spec.ts +2 -2
- package/demos/pc/app/tabs/webdoc/tabs.js +12 -0
- package/demos/pc/app/time-line/slot-default-composition-api.vue +81 -0
- package/demos/pc/app/time-line/slot-default.spec.ts +13 -0
- package/demos/pc/app/time-line/slot-default.vue +95 -0
- package/demos/pc/app/time-line/webdoc/time-line.js +12 -0
- package/demos/pc/menus.js +20 -10
- package/demos/pc/webdoc/changelog-en.md +224 -197
- package/demos/pc/webdoc/changelog.md +167 -387
- package/demos/pc/webdoc/faq.md +14 -0
- package/demos/saas/menus.js +2 -14
- package/env/.env +3 -0
- package/package.json +25 -24
- package/playground/App.vue +2 -2
- package/postcss.config.cjs +1 -0
- package/src/App.vue +26 -59
- package/src/components/anchor.vue +5 -1
- package/src/components/demo.vue +18 -7
- package/src/components/design-token.vue +90 -0
- package/src/components/float-settings.vue +4 -23
- package/src/components/mcp-docs.vue +4 -26
- package/src/components/version-tip.vue +1 -1
- package/src/composable/useTinyRemoter.ts +176 -0
- package/src/composable/utils.ts +2 -166
- package/src/const.ts +6 -1
- package/src/i18n/en.json +2 -0
- package/src/i18n/es.json +47 -0
- package/src/i18n/index.js +24 -5
- package/src/i18n/pt.json +47 -0
- package/src/i18n/zh.json +2 -0
- package/src/main.js +17 -13
- package/src/{menus.jsx → menus.js} +0 -1
- package/src/router.js +3 -18
- package/src/tools/appData.js +6 -16
- package/src/tools/storage.js +5 -3
- package/src/tools/useApiMode.js +11 -3
- package/src/tools/useBulletin.jsx +9 -8
- package/src/tools/useStyleSettings.js +8 -0
- package/src/tools/useTemplateMode.js +5 -1
- package/src/tools/utils.js +32 -1
- package/src/views/components-doc/cmp-config.js +13 -1
- package/src/views/components-doc/common.vue +42 -15
- package/src/views/layout/layout.vue +5 -8
- package/src/views/overview.vue +1 -1
- package/tsconfig.node.json +2 -4
- package/src/components/MessageCard.vue +0 -117
- package/src/components/tiny-robot-chat.vue +0 -128
- package/src/composable/DifyModelProvider.ts +0 -65
- package/src/composable/useTinyRobot.ts +0 -167
- package/src/tools/useAllTaskFinish.ts +0 -0
- package/src/views/comprehensive/Demo.vue +0 -212
- package/src/views/comprehensive/index.vue +0 -380
- package/src/views/comprehensive/products.json +0 -98
- package/src/views/comprehensive/types/index.ts +0 -37
- package/src/views/remoter/index.vue +0 -63
- package/src/views/remoter/sound.vue +0 -349
- /package/demos/pc/app/grid/expand/{expand-config.spec.js → expand-config.spec.ts} +0 -0
package/src/tools/appData.js
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import { reactive, computed
|
|
1
|
+
import { reactive, computed } from 'vue'
|
|
2
2
|
import { useAutoStore } from './storage'
|
|
3
3
|
import { useMediaQuery } from './useMediaQuery'
|
|
4
|
-
import { ZH_CN_LANG,
|
|
4
|
+
import { ZH_CN_LANG, LANG_KEY, LANG_PATH_MAP } from '../const'
|
|
5
5
|
|
|
6
|
-
const zhPath = LANG_PATH_MAP[ZH_CN_LANG]
|
|
7
|
-
const enPath = LANG_PATH_MAP[EN_US_LANG]
|
|
8
6
|
const appData = reactive({
|
|
9
7
|
lang: useAutoStore('local', LANG_KEY, ZH_CN_LANG),
|
|
10
8
|
theme: useAutoStore('local', '_theme', 'light'),
|
|
11
|
-
bpState: useMediaQuery([640, 1024, 1280]).matches
|
|
12
|
-
showTinyRobot: false,
|
|
13
|
-
hasFloatRobot: false
|
|
9
|
+
bpState: useMediaQuery([640, 1024, 1280]).matches // 3点4区间, bp0,bp1,bp2,bp3
|
|
14
10
|
})
|
|
15
11
|
const isZhCn = computed(() => appData.lang === ZH_CN_LANG)
|
|
16
12
|
const appFn = {
|
|
@@ -18,9 +14,10 @@ const appFn = {
|
|
|
18
14
|
if (name !== appData.lang) {
|
|
19
15
|
let url = location.href
|
|
20
16
|
url = location.href.replace(LANG_PATH_MAP[appData.lang], LANG_PATH_MAP[name])
|
|
21
|
-
// appData.lang = name
|
|
17
|
+
// appData.lang = name // 官网先屏蔽切换语言,默认中文
|
|
22
18
|
appData.lang = ZH_CN_LANG
|
|
23
|
-
|
|
19
|
+
history.replaceState({}, '', url)
|
|
20
|
+
location.reload()
|
|
24
21
|
}
|
|
25
22
|
},
|
|
26
23
|
toggleTheme() {
|
|
@@ -30,11 +27,4 @@ const appFn = {
|
|
|
30
27
|
// 为了和tiny-vue共享同一个响应变量
|
|
31
28
|
window.appData = appData
|
|
32
29
|
|
|
33
|
-
watch(
|
|
34
|
-
() => appData.showTinyRobot,
|
|
35
|
-
(value) => {
|
|
36
|
-
document.body.classList.toggle('docs-on-robot-show', value)
|
|
37
|
-
}
|
|
38
|
-
)
|
|
39
|
-
|
|
40
30
|
export { appData, appFn, isZhCn }
|
package/src/tools/storage.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ref, watch } from 'vue'
|
|
2
|
+
import { getLocaleMode } from './utils'
|
|
2
3
|
|
|
3
4
|
function parse(str) {
|
|
4
5
|
if (str === null) return undefined
|
|
@@ -58,13 +59,14 @@ const typeMatcher = { session: $session, local: $local, api: null }
|
|
|
58
59
|
* @returns 响应式ref
|
|
59
60
|
*/
|
|
60
61
|
const useAutoStore = (type, key, defaultValue) => {
|
|
61
|
-
let refVar = ref(
|
|
62
|
+
let refVar = ref(getLocaleMode())
|
|
63
|
+
typeMatcher[type][key] = refVar.value
|
|
64
|
+
|
|
62
65
|
watch(refVar, (curr, prev) => {
|
|
63
66
|
typeMatcher[type][key] = curr
|
|
64
67
|
})
|
|
65
|
-
|
|
66
68
|
refVar.value = refVar.value ?? defaultValue
|
|
67
|
-
|
|
69
|
+
|
|
68
70
|
return refVar
|
|
69
71
|
}
|
|
70
72
|
|
package/src/tools/useApiMode.js
CHANGED
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
import { reactive } from 'vue'
|
|
2
2
|
import { $local } from './storage'
|
|
3
|
-
import { appFn } from './appData'
|
|
3
|
+
import { appFn, appData } from './appData'
|
|
4
|
+
import { useTemplateMode } from './useTemplateMode'
|
|
4
5
|
|
|
5
6
|
const _modeKey = 'tiny-vue-api-mode'
|
|
6
7
|
const _demoModeKey = 'tiny-vue-demo-mode'
|
|
8
|
+
|
|
7
9
|
const apiModeState = reactive({
|
|
8
|
-
localeMode:
|
|
10
|
+
localeMode: appData.lang,
|
|
9
11
|
apiMode: $local[_modeKey] || 'Composition', // 示例风格: Options: 组合式; Composition: 选项式
|
|
10
12
|
demoMode: $local[_demoModeKey] || 'default' // 示例展示: default:多示例, single:单示例
|
|
11
13
|
})
|
|
12
14
|
|
|
15
|
+
const { templateModeState } = useTemplateMode()
|
|
16
|
+
|
|
13
17
|
const apiModeFn = {
|
|
14
18
|
getDemoName: (name) => {
|
|
15
|
-
|
|
19
|
+
const isMobileFirst = templateModeState.mode === 'mobile-first'
|
|
20
|
+
const isOptions = apiModeState.apiMode === 'Options'
|
|
21
|
+
const resultName = isMobileFirst ? `mobile-first/${name}` : name
|
|
22
|
+
// mobile-first模板暂时没有composition-api 格式的文件,需要特殊处理下
|
|
23
|
+
return resultName.replace(/\.vue$/, `${isOptions || isMobileFirst ? '' : '-composition-api'}.vue`)
|
|
16
24
|
},
|
|
17
25
|
changeLocaleMode: (name) => {
|
|
18
26
|
appFn.toggleLang(name)
|
|
@@ -22,15 +22,16 @@ export function useBulletin() {
|
|
|
22
22
|
onMounted(() => {
|
|
23
23
|
Modal.confirm({
|
|
24
24
|
title: '公告',
|
|
25
|
-
message: (
|
|
26
|
-
<div
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
message: (
|
|
26
|
+
<div style="font-size:16px;line-height:1.5;">
|
|
27
|
+
<div>尊敬的 TinyVue 用户:</div>
|
|
28
|
+
<p style="text-indent: 2em;" v-html={lastBulletin.content}></p>
|
|
29
|
+
<div style="text-align:right;margin-top:20px">TinyVue 团队</div>
|
|
30
|
+
<div style="text-align:right;">{lastBulletin.time}</div>
|
|
31
|
+
</div>
|
|
32
|
+
),
|
|
32
33
|
status: null,
|
|
33
|
-
width:'760',
|
|
34
|
+
width: '760',
|
|
34
35
|
confirmContent: '我知道了',
|
|
35
36
|
cancelContent: '关闭'
|
|
36
37
|
}).then((res) => {
|
|
@@ -15,6 +15,14 @@ const getStyleSettings = (i18nByKey) => {
|
|
|
15
15
|
// {
|
|
16
16
|
// value: 'enUS',
|
|
17
17
|
// text: i18nByKey('en-us')
|
|
18
|
+
// },
|
|
19
|
+
// {
|
|
20
|
+
// value: 'esLA',
|
|
21
|
+
// text: i18nByKey('es-la')
|
|
22
|
+
// },
|
|
23
|
+
// {
|
|
24
|
+
// value: 'ptBR',
|
|
25
|
+
// text: i18nByKey('pt-br')
|
|
18
26
|
// }
|
|
19
27
|
// ]
|
|
20
28
|
// },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { reactive, computed, watch } from 'vue'
|
|
2
2
|
import { router } from '@/router.js'
|
|
3
|
-
import { getAllComponents } from '@/menus
|
|
3
|
+
import { getAllComponents } from '@/menus'
|
|
4
4
|
import demoConfig from '@demos/config.js'
|
|
5
5
|
import { staticDemoPath } from '../views/components-doc/cmp-config'
|
|
6
6
|
|
|
@@ -38,6 +38,10 @@ const optionsList = computed(() =>
|
|
|
38
38
|
if (item === 'mobile-first') {
|
|
39
39
|
return { value: item, text: '多端' }
|
|
40
40
|
}
|
|
41
|
+
|
|
42
|
+
if (item === 'pc') {
|
|
43
|
+
return { value: item, text: 'PC' }
|
|
44
|
+
}
|
|
41
45
|
return { value: item, text: item }
|
|
42
46
|
})
|
|
43
47
|
)
|
package/src/tools/utils.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Contributors from '@/data/contributors'
|
|
2
2
|
import ContributorMap from '@/data/contributorMap'
|
|
3
|
+
import { ZH_CN_LANG, EN_US_LANG, ES_LA_LANG, PT_BR_LANG, LANG_PATH_MAP } from '../const'
|
|
3
4
|
|
|
4
5
|
const baseUrl = import.meta.env.BASE_URL
|
|
5
6
|
|
|
@@ -103,4 +104,34 @@ const getCmpContributors = (cmpId) => {
|
|
|
103
104
|
return contributorInfo
|
|
104
105
|
}
|
|
105
106
|
|
|
106
|
-
|
|
107
|
+
const getLocaleMode = () => {
|
|
108
|
+
const { href, pathname } = location
|
|
109
|
+
const DEFAULT_LANG = ZH_CN_LANG // 默认语言
|
|
110
|
+
|
|
111
|
+
const langCheckMap = new Map([
|
|
112
|
+
[
|
|
113
|
+
EN_US_LANG,
|
|
114
|
+
() => href.includes(`/${LANG_PATH_MAP[EN_US_LANG]}`) || pathname.includes(`/${LANG_PATH_MAP[EN_US_LANG]}/`)
|
|
115
|
+
],
|
|
116
|
+
[
|
|
117
|
+
ZH_CN_LANG,
|
|
118
|
+
() => href.includes(`/${LANG_PATH_MAP[ZH_CN_LANG]}`) || pathname.includes(`/${LANG_PATH_MAP[ZH_CN_LANG]}/`)
|
|
119
|
+
],
|
|
120
|
+
[
|
|
121
|
+
ES_LA_LANG,
|
|
122
|
+
() => href.includes(`/${LANG_PATH_MAP[ES_LA_LANG]}`) || pathname.includes(`/${LANG_PATH_MAP[ES_LA_LANG]}/`)
|
|
123
|
+
],
|
|
124
|
+
[
|
|
125
|
+
PT_BR_LANG,
|
|
126
|
+
() => href.includes(`/${LANG_PATH_MAP[PT_BR_LANG]}`) || pathname.includes(`/${LANG_PATH_MAP[PT_BR_LANG]}/`)
|
|
127
|
+
]
|
|
128
|
+
])
|
|
129
|
+
|
|
130
|
+
for (const [lang, checkFn] of langCheckMap) {
|
|
131
|
+
if (checkFn()) return lang
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return DEFAULT_LANG // 无匹配时返回默认
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export { $clone, $split, $delay, $idle, pubUrl, fetchDemosFile, getCmpContributors, getLocaleMode }
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// 批量导入vue组件示例文件, 进行vue组件示例的渲染
|
|
2
2
|
const vueFiles = import.meta.glob(`@demos/app/**/*.vue`)
|
|
3
|
-
|
|
3
|
+
const isSaas = import.meta.env.VITE_TINY_THEME === 'saas'
|
|
4
|
+
const mobileFirstVueFiles = isSaas ? import.meta.glob(`../../../demos/mobile-first/app/**/*.vue`) : null
|
|
4
5
|
// 所有demo组件实例
|
|
5
6
|
const vueComponents = Object.create(null)
|
|
6
7
|
for (const path in vueFiles) {
|
|
@@ -12,6 +13,17 @@ for (const path in vueFiles) {
|
|
|
12
13
|
}
|
|
13
14
|
}
|
|
14
15
|
|
|
16
|
+
if (mobileFirstVueFiles) {
|
|
17
|
+
for (const path in mobileFirstVueFiles) {
|
|
18
|
+
if (Object.prototype.hasOwnProperty.call(mobileFirstVueFiles, path)) {
|
|
19
|
+
const pathArr = path.split('/')
|
|
20
|
+
const cmpId = pathArr[6]
|
|
21
|
+
const key = pathArr.slice(7).join('/')
|
|
22
|
+
vueComponents[`mobile-first/${cmpId}/${key}`] = mobileFirstVueFiles[path]
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
15
27
|
const languageMap = {
|
|
16
28
|
js: 'javascript',
|
|
17
29
|
ts: 'javascript',
|
|
@@ -62,8 +62,12 @@
|
|
|
62
62
|
@jump-to-demo="jumpToDemo"
|
|
63
63
|
></api-docs>
|
|
64
64
|
</tiny-tab-item>
|
|
65
|
-
<tiny-tab-item v-if="
|
|
66
|
-
|
|
65
|
+
<tiny-tab-item v-if="state.tokenList?.length" title="Token" name="token">
|
|
66
|
+
<!-- 主题变量 -->
|
|
67
|
+
<design-token :name="state.cmpId" :tokenList="state.tokenList" />
|
|
68
|
+
</tiny-tab-item>
|
|
69
|
+
<tiny-tab-item v-if="mcpInfo.length > 0" title="MCP" name="MCP">
|
|
70
|
+
<McpDocs :data="mcpInfo" :name="capName" />
|
|
67
71
|
</tiny-tab-item>
|
|
68
72
|
</tiny-tabs>
|
|
69
73
|
|
|
@@ -72,6 +76,7 @@
|
|
|
72
76
|
|
|
73
77
|
<!-- demo与api目录锚点 -->
|
|
74
78
|
<aside-anchor
|
|
79
|
+
v-if="state.activeTab === 'demos' || state.activeTab === 'api'"
|
|
75
80
|
:active-tab="state.activeTab"
|
|
76
81
|
:current-json="state.currJson"
|
|
77
82
|
:anchor-affix="state.anchorAffix"
|
|
@@ -88,11 +93,10 @@
|
|
|
88
93
|
</div>
|
|
89
94
|
<div id="footer"></div>
|
|
90
95
|
</div>
|
|
91
|
-
<robotChat v-if="appData.showTinyRobot && appData.hasFloatRobot"></robotChat>
|
|
92
96
|
</template>
|
|
93
97
|
|
|
94
98
|
<script setup lang="ts">
|
|
95
|
-
import { reactive, computed, watch, onMounted, nextTick, ref } from 'vue'
|
|
99
|
+
import { reactive, computed, watch, onMounted, nextTick, ref, onUnmounted } from 'vue'
|
|
96
100
|
import { useRoute } from 'vue-router'
|
|
97
101
|
import { TinyTabs, TinyTabItem } from '@opentiny/vue'
|
|
98
102
|
import { debounce } from '@opentiny/utils'
|
|
@@ -104,11 +108,13 @@ import AsideAnchor from '../../components/anchor.vue'
|
|
|
104
108
|
import ComponentHeader from '../../components/header.vue'
|
|
105
109
|
import ComponentContributor from '../../components/contributor.vue'
|
|
106
110
|
import ApiDocs from '../../components/api-docs.vue'
|
|
111
|
+
import DesignToken from '../../components/design-token.vue'
|
|
107
112
|
import McpDocs from '../../components/mcp-docs.vue'
|
|
108
113
|
import useTasksFinish from '../../composable/useTasksFinish'
|
|
109
|
-
import
|
|
110
|
-
|
|
111
|
-
import
|
|
114
|
+
import list from '@opentiny/vue-theme/token'
|
|
115
|
+
import { cmpAnchorDataCallback } from '../../composable/useTinyRemoter'
|
|
116
|
+
import { getTinyVueMcpConfig } from '@opentiny/tiny-vue-mcp'
|
|
117
|
+
import { camelize, capitalize } from '@vue/shared'
|
|
112
118
|
|
|
113
119
|
const props = defineProps({ loadData: {}, appMode: {}, demoKey: {} })
|
|
114
120
|
|
|
@@ -124,9 +130,10 @@ const isRunningTest = localStorage.getItem('tiny-e2e-test') === 'true'
|
|
|
124
130
|
const anchorRefreshKey = ref(0)
|
|
125
131
|
const route = useRoute()
|
|
126
132
|
const state = reactive({
|
|
127
|
-
langKey: getWord('zh-CN', 'en-US'),
|
|
133
|
+
langKey: getWord('zh-CN', 'en-US', 'es-LA', 'pt-BR'),
|
|
128
134
|
cmpId: '',
|
|
129
135
|
observer: null,
|
|
136
|
+
tokenList: [],
|
|
130
137
|
currJson: { column: 1, demos: [], apis: [], types: {} },
|
|
131
138
|
mdString: '',
|
|
132
139
|
currDemoId: '',
|
|
@@ -192,7 +199,6 @@ const parseApiData = () => {
|
|
|
192
199
|
if (!state.currJson.apis?.length) {
|
|
193
200
|
return {}
|
|
194
201
|
}
|
|
195
|
-
|
|
196
202
|
const tableData = {}
|
|
197
203
|
const apis = state.currJson.apis || []
|
|
198
204
|
for (const apiGroup of apis) {
|
|
@@ -285,7 +291,7 @@ const demoMounted = () => {
|
|
|
285
291
|
}
|
|
286
292
|
|
|
287
293
|
const loadPage = () => {
|
|
288
|
-
const lang = getWord('cn', 'en')
|
|
294
|
+
const lang = getWord('cn', 'en', 'es', 'pt')
|
|
289
295
|
state.cmpId = router.currentRoute.value.params.cmpId
|
|
290
296
|
|
|
291
297
|
state.chartCode = getWebdocPath(state.cmpId) === 'chart'
|
|
@@ -296,7 +302,6 @@ const loadPage = () => {
|
|
|
296
302
|
state.mdString = mdString
|
|
297
303
|
// plus隐藏头部集合
|
|
298
304
|
const hideTabHeader = ['interfaces', 'types', 'classes'].includes(state.cmpId)
|
|
299
|
-
|
|
300
305
|
if (demosJson && !hideTabHeader) {
|
|
301
306
|
// 默认设置每个实例demo都不和视图相交
|
|
302
307
|
demosJson.demos?.forEach((item) => {
|
|
@@ -314,7 +319,7 @@ const loadPage = () => {
|
|
|
314
319
|
document.querySelector('.tiny-tabs__header').style.display = 'none'
|
|
315
320
|
}
|
|
316
321
|
}
|
|
317
|
-
|
|
322
|
+
state.tokenList = list[state.cmpId] || []
|
|
318
323
|
const { finishTask, waitTasks: allDemoMounted } = useTasksFinish(state.currJson.demos.length)
|
|
319
324
|
finishMountTask = finishTask
|
|
320
325
|
|
|
@@ -445,13 +450,35 @@ const handleAnchorClick = (e, data) => {
|
|
|
445
450
|
}
|
|
446
451
|
}
|
|
447
452
|
|
|
453
|
+
// 页面加载时,创建一个返回 anchor data的函数。 这样工具调用时,可以拿到最新 anchor 信息
|
|
454
|
+
cmpAnchorDataCallback.value = () => state.currJson.demos
|
|
455
|
+
onUnmounted(() => {
|
|
456
|
+
cmpAnchorDataCallback.value = null
|
|
457
|
+
})
|
|
458
|
+
|
|
459
|
+
// MCP tab页签的数据
|
|
460
|
+
const mcpTools = getTinyVueMcpConfig({ t: null })
|
|
461
|
+
const capName = computed(() => capitalize(camelize(state.cmpId || '')))
|
|
462
|
+
|
|
463
|
+
const mcpInfo = computed(() => {
|
|
464
|
+
const schema = mcpTools.components[capName.value]?.paramsSchema
|
|
465
|
+
if (schema) {
|
|
466
|
+
return Object.keys(schema).map((name) => {
|
|
467
|
+
const item = schema[name]
|
|
468
|
+
return {
|
|
469
|
+
name,
|
|
470
|
+
param: item._def?.innerType?._def?.typeName || '',
|
|
471
|
+
desc: item._def?.description || ''
|
|
472
|
+
}
|
|
473
|
+
})
|
|
474
|
+
}
|
|
475
|
+
return []
|
|
476
|
+
})
|
|
477
|
+
|
|
448
478
|
defineExpose({ loadPage })
|
|
449
479
|
</script>
|
|
450
480
|
|
|
451
481
|
<style lang="less" scoped>
|
|
452
|
-
:global(.docs-on-robot-show .docs-content) {
|
|
453
|
-
margin-right: 480px;
|
|
454
|
-
}
|
|
455
482
|
.docs-content {
|
|
456
483
|
flex: 1;
|
|
457
484
|
overflow: hidden auto;
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
</div>
|
|
52
52
|
</div>
|
|
53
53
|
|
|
54
|
-
<float-settings
|
|
54
|
+
<float-settings></float-settings>
|
|
55
55
|
</div>
|
|
56
56
|
</template>
|
|
57
57
|
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
import { useRoute } from 'vue-router'
|
|
60
60
|
import { defineComponent, reactive, computed, toRefs, watch, onMounted, onUnmounted } from 'vue'
|
|
61
61
|
import { TreeMenu, Dropdown, DropdownMenu, Tooltip, Tag, Radio, RadioGroup, Button } from '@opentiny/vue'
|
|
62
|
-
import { genMenus, getMenuIcons } from '@/menus
|
|
62
|
+
import { genMenus, getMenuIcons } from '@/menus'
|
|
63
63
|
import { router } from '@/router.js'
|
|
64
64
|
import { getWord, i18nByKey, appData, appFn, useApiMode, useTemplateMode } from '@/tools'
|
|
65
65
|
import useTheme from '@/tools/useTheme'
|
|
@@ -96,14 +96,12 @@ export default defineComponent({
|
|
|
96
96
|
expandKeys: []
|
|
97
97
|
})
|
|
98
98
|
|
|
99
|
-
const lang = getWord('zh-CN', 'en-US')
|
|
99
|
+
const lang = getWord('zh-CN', 'en-US', 'es-LA', 'pt-BR')
|
|
100
100
|
const route = useRoute()
|
|
101
101
|
const { all: allPathParam, theme = defaultTheme } = useRoute().params
|
|
102
102
|
const allPath = allPathParam ? allPathParam + '/' : ''
|
|
103
103
|
const getTo = (route, key) => `${import.meta.env.VITE_CONTEXT}${allPath}${lang}/${theme}/${route}${key}`
|
|
104
104
|
|
|
105
|
-
const isThemeSaas = import.meta.env.VITE_TINY_THEME === 'saas'
|
|
106
|
-
|
|
107
105
|
const changeLanguage = () => {
|
|
108
106
|
appFn.toggleLang()
|
|
109
107
|
}
|
|
@@ -190,7 +188,6 @@ export default defineComponent({
|
|
|
190
188
|
clickMenuLink,
|
|
191
189
|
getWord,
|
|
192
190
|
i18nByKey,
|
|
193
|
-
isThemeSaas,
|
|
194
191
|
isShowFilter
|
|
195
192
|
}
|
|
196
193
|
}
|
|
@@ -332,11 +329,11 @@ export default defineComponent({
|
|
|
332
329
|
text-overflow: ellipsis;
|
|
333
330
|
}
|
|
334
331
|
|
|
335
|
-
.menu-type-icon {
|
|
332
|
+
svg.menu-type-icon {
|
|
336
333
|
width: 12px;
|
|
337
334
|
height: 12px;
|
|
338
335
|
display: inline-block;
|
|
339
|
-
fill: var(--tv-color-icon-control);
|
|
336
|
+
fill: var(--tv-color-icon-control, #5f6774);
|
|
340
337
|
}
|
|
341
338
|
}
|
|
342
339
|
}
|
package/src/views/overview.vue
CHANGED
|
@@ -121,7 +121,7 @@ export default defineComponent({
|
|
|
121
121
|
.filter((item) => item.children.length > 0)
|
|
122
122
|
state.searchMenus = searchMenus
|
|
123
123
|
}
|
|
124
|
-
const lang = getWord('zh-CN', 'en-US')
|
|
124
|
+
const lang = getWord('zh-CN', 'en-US', 'es-LA', 'pt-BR')
|
|
125
125
|
const { defaultTheme } = useTheme()
|
|
126
126
|
const { all: allPathParam, theme = defaultTheme } = useRoute().params
|
|
127
127
|
const allPath = allPathParam ? allPathParam + '/' : ''
|
package/tsconfig.node.json
CHANGED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="message-card" :class="role">
|
|
3
|
-
<div class="avatar">
|
|
4
|
-
<component :is="avatarIcon" class="avatar-icon" />
|
|
5
|
-
</div>
|
|
6
|
-
<div class="content">
|
|
7
|
-
<div class="role-name">{{ roleName }}</div>
|
|
8
|
-
<div class="message">{{ message }}</div>
|
|
9
|
-
<div class="time">{{ formatTime }}</div>
|
|
10
|
-
</div>
|
|
11
|
-
</div>
|
|
12
|
-
</template>
|
|
13
|
-
|
|
14
|
-
<script setup lang="ts">
|
|
15
|
-
import { computed } from 'vue'
|
|
16
|
-
import { IconAi, IconUser } from '@opentiny/tiny-robot-svgs'
|
|
17
|
-
|
|
18
|
-
interface Props {
|
|
19
|
-
role: 'user' | 'assistant'
|
|
20
|
-
message: string
|
|
21
|
-
timestamp: number
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const props = defineProps<Props>()
|
|
25
|
-
|
|
26
|
-
const roleName = computed(() => (props.role === 'assistant' ? '智能助手' : '我'))
|
|
27
|
-
|
|
28
|
-
const avatarIcon = computed(() => (props.role === 'assistant' ? IconAi : IconUser))
|
|
29
|
-
|
|
30
|
-
const formatTime = computed(() => {
|
|
31
|
-
const date = new Date(props.timestamp)
|
|
32
|
-
return date.toLocaleTimeString('zh-CN', {
|
|
33
|
-
hour: '2-digit',
|
|
34
|
-
minute: '2-digit',
|
|
35
|
-
hour12: false
|
|
36
|
-
})
|
|
37
|
-
})
|
|
38
|
-
</script>
|
|
39
|
-
|
|
40
|
-
<style scoped lang="less">
|
|
41
|
-
.message-card {
|
|
42
|
-
display: flex;
|
|
43
|
-
margin: 16px;
|
|
44
|
-
gap: 12px;
|
|
45
|
-
max-width: 80%;
|
|
46
|
-
|
|
47
|
-
&.assistant {
|
|
48
|
-
margin-right: auto;
|
|
49
|
-
|
|
50
|
-
.content {
|
|
51
|
-
background-color: #f0f2f5;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.avatar-icon {
|
|
55
|
-
color: #2080f0;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
&.user {
|
|
60
|
-
margin-left: auto;
|
|
61
|
-
flex-direction: row-reverse;
|
|
62
|
-
|
|
63
|
-
.content {
|
|
64
|
-
background-color: #e8f5e9;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.avatar-icon {
|
|
68
|
-
color: #18a058;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.avatar {
|
|
73
|
-
width: 40px;
|
|
74
|
-
height: 40px;
|
|
75
|
-
border-radius: 50%;
|
|
76
|
-
overflow: hidden;
|
|
77
|
-
flex-shrink: 0;
|
|
78
|
-
display: flex;
|
|
79
|
-
align-items: center;
|
|
80
|
-
justify-content: center;
|
|
81
|
-
background-color: #f5f7fa;
|
|
82
|
-
|
|
83
|
-
.avatar-icon {
|
|
84
|
-
width: 24px;
|
|
85
|
-
height: 24px;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.content {
|
|
90
|
-
padding: 12px;
|
|
91
|
-
border-radius: 12px;
|
|
92
|
-
position: relative;
|
|
93
|
-
min-width: 120px;
|
|
94
|
-
max-width: calc(100% - 60px);
|
|
95
|
-
|
|
96
|
-
.role-name {
|
|
97
|
-
font-size: 14px;
|
|
98
|
-
color: #666;
|
|
99
|
-
margin-bottom: 4px;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.message {
|
|
103
|
-
font-size: 16px;
|
|
104
|
-
line-height: 1.5;
|
|
105
|
-
word-break: break-word;
|
|
106
|
-
white-space: pre-wrap;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
.time {
|
|
110
|
-
font-size: 12px;
|
|
111
|
-
color: #999;
|
|
112
|
-
margin-top: 4px;
|
|
113
|
-
text-align: right;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
</style>
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<!-- mcp-robot弹窗 -->
|
|
3
|
-
<tr-container v-model:show="appData.showTinyRobot" v-model:fullscreen="fullscreen">
|
|
4
|
-
<div v-if="messages.length === 0">
|
|
5
|
-
<tr-welcome title="智能助手" description="您好,我是OpenTiny AI智能助手" :icon="welcomeIcon">
|
|
6
|
-
<template #footer>
|
|
7
|
-
<div class="welcome-footer"></div>
|
|
8
|
-
</template>
|
|
9
|
-
</tr-welcome>
|
|
10
|
-
<tr-prompts
|
|
11
|
-
:items="customPromptItems"
|
|
12
|
-
:wrap="true"
|
|
13
|
-
item-class="prompt-item"
|
|
14
|
-
class="tiny-prompts"
|
|
15
|
-
@item-click="handlePromptItemClick"
|
|
16
|
-
></tr-prompts>
|
|
17
|
-
</div>
|
|
18
|
-
<tr-bubble-list v-else :items="messages" :roles="roles" auto-scroll></tr-bubble-list>
|
|
19
|
-
<template #footer>
|
|
20
|
-
<div class="chat-input">
|
|
21
|
-
<TrSuggestionPills :items="customSuggestionPillItems" @item-click="handleSuggestionPillItemClick" /><br />
|
|
22
|
-
<tr-sender
|
|
23
|
-
ref="senderRef"
|
|
24
|
-
mode="single"
|
|
25
|
-
v-model="inputMessage"
|
|
26
|
-
:placeholder="GeneratingStatus.includes(messageState.status) ? '正在思考中...' : '请输入您的问题'"
|
|
27
|
-
:clearable="true"
|
|
28
|
-
:loading="GeneratingStatus.includes(messageState.status)"
|
|
29
|
-
:showWordLimit="true"
|
|
30
|
-
:maxLength="1000"
|
|
31
|
-
:template="currentTemplate"
|
|
32
|
-
@submit="handleSendMessage"
|
|
33
|
-
@cancel="abortRequest"
|
|
34
|
-
@keydown="handleMessageKeydown($event, onTrigger, onKeyDown)"
|
|
35
|
-
@reset-template="clearTemplate"
|
|
36
|
-
></tr-sender>
|
|
37
|
-
</div>
|
|
38
|
-
</template>
|
|
39
|
-
</tr-container>
|
|
40
|
-
</template>
|
|
41
|
-
|
|
42
|
-
<script setup lang="ts">
|
|
43
|
-
import { TrBubbleList, TrContainer, TrPrompts, TrSender, TrWelcome, TrSuggestionPills } from '@opentiny/tiny-robot'
|
|
44
|
-
import { GeneratingStatus } from '@opentiny/tiny-robot-kit'
|
|
45
|
-
import { useTinyRobot } from '../composable/useTinyRobot'
|
|
46
|
-
import { appData } from '../tools/appData'
|
|
47
|
-
|
|
48
|
-
const props = defineProps<{
|
|
49
|
-
promptItems: any[]
|
|
50
|
-
suggestionPillItems: any[]
|
|
51
|
-
}>()
|
|
52
|
-
|
|
53
|
-
const {
|
|
54
|
-
fullscreen,
|
|
55
|
-
welcomeIcon,
|
|
56
|
-
promptItems: defaultPromptItems,
|
|
57
|
-
messages,
|
|
58
|
-
messageState,
|
|
59
|
-
inputMessage,
|
|
60
|
-
abortRequest,
|
|
61
|
-
roles,
|
|
62
|
-
handlePromptItemClick,
|
|
63
|
-
senderRef,
|
|
64
|
-
currentTemplate,
|
|
65
|
-
clearTemplate,
|
|
66
|
-
handleSendMessage,
|
|
67
|
-
handleMessageKeydown,
|
|
68
|
-
suggestionPillItems: defaultSuggestionPillItems,
|
|
69
|
-
handleSuggestionPillItemClick
|
|
70
|
-
} = useTinyRobot()
|
|
71
|
-
|
|
72
|
-
const customPromptItems = props.promptItems || defaultPromptItems
|
|
73
|
-
const customSuggestionPillItems = props.suggestionPillItems || defaultSuggestionPillItems
|
|
74
|
-
</script>
|
|
75
|
-
|
|
76
|
-
<style scoped lang="less">
|
|
77
|
-
.chat-input {
|
|
78
|
-
margin-top: 8px;
|
|
79
|
-
padding: 10px 15px;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.tr-container {
|
|
83
|
-
top: 64px !important;
|
|
84
|
-
|
|
85
|
-
container-type: inline-size;
|
|
86
|
-
|
|
87
|
-
:deep(.tr-welcome__title-wrapper) {
|
|
88
|
-
display: flex;
|
|
89
|
-
align-items: center;
|
|
90
|
-
justify-content: center;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.welcome-footer {
|
|
95
|
-
margin-top: 12px;
|
|
96
|
-
color: rgb(128, 128, 128);
|
|
97
|
-
font-size: 12px;
|
|
98
|
-
line-height: 20px;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.tiny-prompts {
|
|
102
|
-
padding: 16px 24px;
|
|
103
|
-
|
|
104
|
-
:deep(.prompt-item) {
|
|
105
|
-
width: 100%;
|
|
106
|
-
box-sizing: border-box;
|
|
107
|
-
|
|
108
|
-
@container (width >=64rem) {
|
|
109
|
-
width: calc(50% - 8px);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.tr-prompt__content-label {
|
|
113
|
-
font-size: 14px;
|
|
114
|
-
line-height: 24px;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
.tr-history-demo {
|
|
120
|
-
position: absolute;
|
|
121
|
-
right: 100%;
|
|
122
|
-
top: 100%;
|
|
123
|
-
z-index: 100;
|
|
124
|
-
width: 300px;
|
|
125
|
-
height: 600px;
|
|
126
|
-
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
|
|
127
|
-
}
|
|
128
|
-
</style>
|