diff --git a/packages/common/component/PluginBlockItemImg.vue b/packages/common/component/PluginBlockItemImg.vue new file mode 100644 index 0000000000..c7c56a864e --- /dev/null +++ b/packages/common/component/PluginBlockItemImg.vue @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + + diff --git a/packages/common/component/PluginBlockList.vue b/packages/common/component/PluginBlockList.vue index b05ff90cb1..69104c86c7 100644 --- a/packages/common/component/PluginBlockList.vue +++ b/packages/common/component/PluginBlockList.vue @@ -1,4 +1,10 @@ + + + 区块名称 + 创建时间 + 创建人 + - - - - + {{ item.name_cn || item.label || item.content?.fileName }} {{ item.description }} + + {{ format(item.created_at, 'yyyy/MM/dd hh:mm:ss') }} + + + {{ users.find((user) => user.id === item.createdBy)?.name || item.id }} + + import { computed, watch, inject, reactive } from 'vue' +import { format } from '@opentiny/vue-renderless/common/date' import { iconPlus } from '@opentiny/vue-icon' import { Progress, Tooltip } from '@opentiny/vue' +import PluginBlockItemImg from './PluginBlockItemImg.vue' import SearchEmpty from './SearchEmpty.vue' import SvgButton from './SvgButton.vue' @@ -132,6 +143,7 @@ export default { TinyProgress: Progress, IconPlus: iconPlus(), TinyTooltip: Tooltip, + PluginBlockItemImg, SvgButton, SearchEmpty }, @@ -191,11 +203,26 @@ export default { externalBlock: { type: Object, default: null + }, + // 是否显示多选框 + showCheckbox: { + type: Boolean, + default: false + }, + // 选中的区块 + checked: { + type: Array, + default: () => [] + }, + gridColumns: { + type: Number, + default: 2 } }, emits: ['click', 'iconClick', 'add', 'deleteBlock', 'openVersionPanel', 'editBlock'], setup(props, { emit }) { const panelState = inject('panelState', {}) + const blockUsers = inject('blockUsers') const state = reactive({ activeIndex: -1, data: computed(() => props.data), @@ -207,6 +234,8 @@ export default { timeoutId: null }) + const users = computed(() => blockUsers?.value || []) + const getParentNode = (el) => { while (el.nodeName !== 'LI') { el = el.parentNode @@ -320,6 +349,7 @@ export default { return { isShortcutPanel: panelState.isShortcutPanel, state, + users, getTitle, blockClick, iconClick, @@ -332,7 +362,8 @@ export default { handleBlockItemLeave, handleSettingMouseOver, handleShowVersionMenu, - editBlock + editBlock, + format } } } @@ -371,20 +402,61 @@ export default { } } +.header { + display: flex; + align-items: center; + height: 24px; + background-color: var(--te-common-bg-container); + color: var(--te-common-text-secondary); + position: sticky; + top: 0; + z-index: 100; + + & > div { + padding: 0 8px; + position: relative; + } + + .col-time::before, + .col-created-by::before { + content: ''; + position: absolute; + left: 0; + top: 50%; + transform: translateY(-50%); + width: 1px; + height: 10px; + background-color: var(--te-common-border-default); + } +} + +.col-checkbox, +.block-item-small-list:deep(.table-selection) { + width: 40px; + text-align: center; +} +.col-checkbox:deep(.tiny-checkbox__label) { + padding: 0; +} +.col-name { + width: 35%; +} +.col-time { + width: 35%; +} +.col-created-by { + flex: 1; +} + .block-list { display: grid; - grid-template-columns: 50% 50%; + grid-template-columns: repeat(v-bind('gridColumns'), 1fr); position: relative; - flex: 1; + gap: 12px; overflow-y: auto; overflow-x: hidden; color: var(--ti-lowcode-common-secondary-text-color); - margin: 12px; - &.is-small-list { - grid-template-columns: 100%; - grid-template-rows: repeat(auto-fill, 30px); - } .block-item { display: flex; flex-direction: column; @@ -393,18 +465,9 @@ export default { height: 110px; text-align: center; user-select: none; - margin-right: 6px; - margin-bottom: 12px; - .block-item-img { - line-height: 86px; - width: 100%; - height: 86px; - border-radius: 4px; - background-color: var(--ti-lowcode-component-block-list-item-active-bg); - } - &.block-item-small-list:nth-child(2) { - border-top: none; - } + gap: 6px; + overflow: hidden; + text-overflow: ellipsis; .publish-flag { position: absolute; @@ -421,20 +484,16 @@ export default { } &.block-item-small-list { - flex-direction: row; - align-items: center; - height: 30px; - padding: 4px 10px; - .item-image { - width: 30px; - height: 30px; - min-width: 30px; + color: var(--te-common-text-primary); + gap: 0; + &:deep(.block-item-img) { + width: 54px; + height: 40px; + flex: unset; + margin-left: 8px; } .item-text { - text-align: left; - margin-top: 0; - margin-left: 4px; - color: var(--ti-lowcode-base-text-color-4); + width: calc(35% - 62px); } .publish-flag { position: static; @@ -522,12 +581,6 @@ export default { } } - .item-image { - width: 100px; - height: 48px; - overflow: hidden; - object-fit: cover; - } .item-default-img { width: 84px; height: 50px; @@ -535,10 +588,10 @@ export default { } .item-text { - color: var(--ti-lowcode-component-block-list-item-color); + color: var(--te-common-text-secondary); text-align: center; - flex: 1; - margin-top: 10px; + font-size: 12px; + line-height: 1.5; overflow: hidden; text-overflow: ellipsis; max-width: 100%; @@ -575,10 +628,6 @@ export default { top: 0; } } - .block-item:nth-child(even) { - margin-right: 0; - margin-left: 6px; - } .deploy { position: absolute; top: 10px; @@ -664,16 +713,10 @@ export default { &.is-small-list { display: block; - grid-template-columns: initial; .block-item { + height: 54px; flex-direction: row; - border-right: none; - } - - .item-image { - padding: 0; - flex-shrink: 0; } .item-text { @@ -690,21 +733,16 @@ export default { font-size: 12px; } } - } - &.is-small-list { - .block-item { - height: 38px; + .cell { + padding: 0 8px; + text-align: start; } - - .item-image { - font-size: 1.5em; - width: 27px; - height: 22px; + .cell-time { + width: 35%; } - - .item-text { - width: calc(100% - 35px); + .cell-created-by { + flex: 1; } } } diff --git a/packages/design-core/assets/text-copy-page.svg b/packages/design-core/assets/text-copy-page.svg index 9a33f371cb..5119c4245b 100644 --- a/packages/design-core/assets/text-copy-page.svg +++ b/packages/design-core/assets/text-copy-page.svg @@ -1,4 +1,5 @@ + + + + diff --git a/packages/plugins/block/src/Main.vue b/packages/plugins/block/src/Main.vue index fd2e9d437e..7000b3f84c 100644 --- a/packages/plugins/block/src/Main.vue +++ b/packages/plugins/block/src/Main.vue @@ -81,17 +81,18 @@ - + + +