-
Notifications
You must be signed in to change notification settings - Fork 467
feat(toolbars): use toolbar base component in toolbar plugins #798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
hexqi
merged 17 commits into
opentiny:refactor/develop
from
betterdancing:fix/toolbar-collapsed-text
Sep 29, 2024
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
1e2b563
fix(toolbars): 对于工具栏的定制化的改动,图标可替换,且可以替换展示方式(图标或按钮),同事按钮可以传入属性和样式
betterdancing 7995809
fix(toolbars): 对于工具栏的定制化的改动,图标可替换,且可以替换展示方式(图标或按钮),同事按钮可以传入属性和样式
betterdancing 21abd59
Merge branch 'refactor/develop' of https://github.com/betterdancing/t…
betterdancing e626722
fix(toolbars): 对于工具栏的定制化的改动,图标可替换,且可以替换展示方式(图标或按钮),同事按钮可以传入属性和样式
betterdancing 49ffee5
feat: 工具栏定制化改造
betterdancing cc49279
feat(toolbars): 头部工具栏改造,新增公共可引入组件
betterdancing fe89b71
feat(toolbars): 头部工具栏改造,新增公共可引入组件
betterdancing 612adc0
feat(toolbars): package.json添加layout依赖
betterdancing bedd71c
feat(toolbars): 头部工具栏改造,导出toolbar公共组件
betterdancing 0a92bf7
feat(toolbar): 修复review意见,将配置项移动到options中
betterdancing 4329155
feat(toolbar): 删除工具栏组件冗余属性,采用了import原组件并定制的方式扩展其余属性
betterdancing 4e70edb
feat(toolbar): 处理工具栏代码冲突
betterdancing eb54ea5
feat(toolbar): 处理工具栏代码冲突
betterdancing c9d46de
Merge branch 'refactor/develop' of https://github.com/betterdancing/t…
betterdancing acd0934
feat(toolbar): 修改公共toolbar组件名称,并移到common目录下
betterdancing 3a638cc
feat(toolbar): 修改部分review意见
betterdancing 4393877
feat(toolbar): 默认工具栏按钮移除边框
betterdancing File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| <template> | ||
| <span class="toolbar-item-wrap" @click="click"> | ||
| <component :is="getRender()" v-bind="state"> | ||
| <template #default> | ||
| <slot name="button"></slot> | ||
| </template> | ||
| </component> | ||
| <slot></slot> | ||
| <span v-if="state.options?.collapsed">{{ state.content }}</span> | ||
| </span> | ||
| </template> | ||
|
|
||
| <script> | ||
| import { reactive, computed } from 'vue' | ||
| import ToolbarBaseIcon from './toolbar-built-in/ToolbarBaseIcon.vue' | ||
| import ToolbarBaseButton from './toolbar-built-in/ToolbarBaseButton.vue' | ||
|
|
||
| export default { | ||
| components: { | ||
| ToolbarBaseIcon, | ||
| ToolbarBaseButton | ||
| }, | ||
| props: { | ||
| icon: { | ||
| type: String, | ||
| default: '' | ||
| }, | ||
| content: { | ||
| type: String, | ||
| default: '' | ||
| }, | ||
| options: { | ||
| type: Object, | ||
| default: () => {} | ||
| } | ||
| }, | ||
| emits: ['click-api'], | ||
| setup(props, { emit }) { | ||
| const state = reactive({ | ||
| icon: computed(() => props.icon), | ||
| content: computed(() => props.content), | ||
| options: computed(() => props.options) | ||
| }) | ||
|
|
||
| const click = () => { | ||
| emit('click-api') | ||
| } | ||
|
|
||
| const getRender = () => { | ||
| switch (props.options.renderType) { | ||
| case 'button': | ||
| return ToolbarBaseButton | ||
| case 'icon': | ||
| return ToolbarBaseIcon | ||
| default: | ||
| return false | ||
| } | ||
| } | ||
|
|
||
| return { | ||
| state, | ||
| click, | ||
| getRender | ||
| } | ||
| } | ||
| } | ||
| </script> | ||
| <style scoped> | ||
| .split-line { | ||
| color: var(--ti-lowcode-toolbar-border-color); | ||
| margin: 0 4px; | ||
| font-size: 14px; | ||
| } | ||
| .toolbar-item-wrap div { | ||
| display: inline-block; | ||
| } | ||
| </style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
packages/common/component/toolbar-built-in/ToolbarBaseButton.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| <template> | ||
| <tiny-button v-bind="extendAttrs" class="toolbar-button"> | ||
| <span class="svg-wrap"> | ||
| <svg-icon v-if="icon" :name="icon"></svg-icon> | ||
| <span v-if="options?.showDots" class="dots"></span> | ||
| </span> | ||
| <span class="save-title">{{ content }}</span> | ||
| <slot></slot> | ||
| </tiny-button> | ||
| </template> | ||
| <script> | ||
| import { inject } from 'vue' | ||
| import { Button } from '@opentiny/vue' | ||
|
|
||
| export default { | ||
| components: { | ||
| TinyButton: Button | ||
| }, | ||
| props: { | ||
| icon: { | ||
| type: String, | ||
| default: '' | ||
| }, | ||
| content: { | ||
| type: String, | ||
| default: '' | ||
| }, | ||
| options: { | ||
| type: Object, | ||
| default: () => ({}) | ||
| } | ||
| }, | ||
| setup() { | ||
| const extendAttrs = inject('extend-attributes') || {} | ||
| return { | ||
| extendAttrs | ||
| } | ||
| } | ||
| } | ||
| </script> | ||
| <style lang="less" scoped> | ||
| .toolbar-button { | ||
| background-color: var(--ti-lowcode-toolbar-button-bg) !important; | ||
| border: none !important; | ||
| min-width: 70px; | ||
| height: 26px; | ||
| line-height: 24px; | ||
| padding: 0 8px; | ||
| border-radius: 4px; | ||
| margin-right: 4px; | ||
| } | ||
|
|
||
| .svg-wrap { | ||
| position: relative; | ||
| .dots { | ||
| width: 6px; | ||
| height: 6px; | ||
| background: var(--ti-lowcode-toolbar-dot-color); | ||
| border-radius: 50%; | ||
| display: inline-block; | ||
| position: absolute; | ||
| top: -2px; | ||
| right: -2px; | ||
| z-index: 100; | ||
| } | ||
| } | ||
|
|
||
| .save-title { | ||
| margin: 0 6px; | ||
| } | ||
| </style> |
62 changes: 62 additions & 0 deletions
62
packages/common/component/toolbar-built-in/ToolbarBaseIcon.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| <template> | ||
| <tiny-popover | ||
| trigger="hover" | ||
| :open-delay="1000" | ||
| popper-class="toolbar-right-popover" | ||
| append-to-body | ||
| :content="content" | ||
| > | ||
| <template #reference> | ||
| <span class="icon"> | ||
| <span class="icon-hides" v-bind="extendAttrs"> | ||
| <svg-icon :name="icon"></svg-icon> | ||
| <span v-if="options?.showDots" class="dots"></span> | ||
| </span> | ||
| </span> | ||
| </template> | ||
| </tiny-popover> | ||
| </template> | ||
betterdancing marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| <script> | ||
| import { inject } from 'vue' | ||
| import { Popover } from '@opentiny/vue' | ||
|
|
||
| export default { | ||
| components: { | ||
| TinyPopover: Popover | ||
| }, | ||
| props: { | ||
| icon: { | ||
| type: String, | ||
| default: '' | ||
| }, | ||
| content: { | ||
| type: String, | ||
| default: '' | ||
| }, | ||
| options: { | ||
| type: Object, | ||
| default: () => {} | ||
| } | ||
| }, | ||
| setup() { | ||
| const extendAttrs = inject('extend-attributes') || {} | ||
| return { | ||
| extendAttrs | ||
| } | ||
| } | ||
| } | ||
| </script> | ||
|
|
||
| <style lang="less" scoped> | ||
| .dots { | ||
| width: 6px; | ||
| height: 6px; | ||
| background: var(--ti-lowcode-toolbar-dot-color); | ||
| border-radius: 50%; | ||
| display: inline-block; | ||
| position: absolute; | ||
| top: 4px; | ||
| right: 3px; | ||
| z-index: 100; | ||
| } | ||
| </style> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.