diff --git a/package/component/src/component/splitPanel/index.less b/package/component/src/component/splitPanel/index.less index 4b7869ab..3d9d5d59 100644 --- a/package/component/src/component/splitPanel/index.less +++ b/package/component/src/component/splitPanel/index.less @@ -4,7 +4,6 @@ position: relative; .lay-split-panel-item { height: 100%; - flex-grow: 1; border: 1px #eeeeee solid; } .lay-split-panel-item-move { diff --git a/package/component/src/component/splitPanel/index.vue b/package/component/src/component/splitPanel/index.vue index c9e0c82c..5cc37d5d 100644 --- a/package/component/src/component/splitPanel/index.vue +++ b/package/component/src/component/splitPanel/index.vue @@ -1,14 +1,15 @@ diff --git a/package/component/src/component/splitPanelItem/index.vue b/package/component/src/component/splitPanelItem/index.vue index fd5cb42a..b7f855bc 100644 --- a/package/component/src/component/splitPanelItem/index.vue +++ b/package/component/src/component/splitPanelItem/index.vue @@ -14,12 +14,11 @@ import { onBeforeUnmount, reactive, withDefaults, - watch, } from "vue"; import type { ComputedRef } from "vue"; -export interface LayStepItemProps { +interface LayStepItemProps { space?: number; } @@ -34,11 +33,6 @@ const setIndex = (val: number) => { index.value = val; }; -const mousedown = (event: any) => { - moveStatus.value = true; - parents.moveChange(event, true); -}; - const mouseup = (event: any) => { moveStatus.value = false; }; @@ -47,6 +41,34 @@ const stepsCount = computed(() => { return parents.steps.value.length; }); +const initSpace = (parentSpace: any, key: string) => { + const childList = Array.from(parentElement.value.children); + childList.forEach((item: any, index: number) => { + if (index === 0 || index % 2 === 0) { + item.style.flexBasis = (item[key] / parentSpace) * 100 + "%"; + item.style.flexGrow = 0; + } + }); +}; + +const mousedown = (event: any) => { + let parentSpace = 0; + if (!isVertical.value) { + parentSpace = parentElement.value.offsetWidth; + initSpace(parentSpace, "offsetWidth"); + } else { + parentSpace = parentElement.value.offsetHeight; + initSpace(parentSpace, "offsetHeight"); + } + + moveStatus.value = true; + parents.moveChange(event, true, isVertical.value); +}; + +const parentElement = computed(() => { + return parents.target.value; +}); + const isVertical = computed(() => { return parents.props.vertical; }); @@ -63,9 +85,8 @@ const isStart: ComputedRef = computed(() => { const stepItemState = reactive({ itemId: computed(() => currentInstance?.uid), setIndex, - width: [], + space: props.space, }); - parents.steps.value = [...parents.steps.value, stepItemState]; onMounted(() => {}); @@ -85,16 +106,17 @@ onBeforeUnmount(() => { v-on="{ mousedown: mousedown, mouseup: mouseup }" > diff --git a/package/component/src/component/table/TableRow.vue b/package/component/src/component/table/TableRow.vue index 7a215e1c..c03ce9c1 100644 --- a/package/component/src/component/table/TableRow.vue +++ b/package/component/src/component/table/TableRow.vue @@ -128,7 +128,7 @@ const renderFixedStyle = (column: any, columnIndex: number) => { if (column.fixed == "left") { var left = 0; for (var i = 0; i < columnIndex; i++) { - if(props.columns[i].fixed && props.columns[i].fixed == "left") { + if (props.columns[i].fixed && props.columns[i].fixed == "left") { left = left + props.columns[i]?.width.replace("px", ""); } } @@ -136,7 +136,7 @@ const renderFixedStyle = (column: any, columnIndex: number) => { } else { var right = 0; for (var i = columnIndex + 1; i < props.columns.length; i++) { - if(props.columns[i].fixed && props.columns[i].fixed == "right") { + if (props.columns[i].fixed && props.columns[i].fixed == "right") { right = right + props.columns[i]?.width.replace("px", ""); } } @@ -150,7 +150,7 @@ const renderFixedClassName = (column: any, columnIndex: number) => { if (column.fixed == "left") { var left = true; for (var i = columnIndex + 1; i < props.columns.length; i++) { - if(props.columns[i].fixed && props.columns[i].fixed == "left") { + if (props.columns[i].fixed && props.columns[i].fixed == "left") { left = false; } } @@ -158,14 +158,14 @@ const renderFixedClassName = (column: any, columnIndex: number) => { } else { var right = true; for (var i = 0; i < columnIndex; i++) { - if(props.columns[i].fixed && props.columns[i].fixed == "right") { + if (props.columns[i].fixed && props.columns[i].fixed == "right") { right = false; } } return `layui-table-fixed-right-first`; } } -} +}; @@ -258,7 +258,7 @@ const renderFixedClassName = (column: any, columnIndex: number) => { renderCellStyle(data, column, index, columnIndex), ]" :class="[ - renderFixedClassName(column, columnIndex), + renderFixedClassName(column, columnIndex), renderCellClassName(data, column, index, columnIndex), column.fixed ? `layui-table-fixed-${column.fixed}` : '', ]" diff --git a/package/component/src/component/table/index.vue b/package/component/src/component/table/index.vue index 2072dc20..58422f9b 100644 --- a/package/component/src/component/table/index.vue +++ b/package/component/src/component/table/index.vue @@ -255,7 +255,7 @@ const renderFixedStyle = (column: any, columnIndex: number) => { if (column.fixed == "left") { var left = 0; for (var i = 0; i < columnIndex; i++) { - if(props.columns[i].fixed && props.columns[i].fixed == "left") { + if (props.columns[i].fixed && props.columns[i].fixed == "left") { left = left + props.columns[i]?.width.replace("px", ""); } } @@ -263,7 +263,7 @@ const renderFixedStyle = (column: any, columnIndex: number) => { } else { var right = 0; for (var i = columnIndex + 1; i < props.columns.length; i++) { - if(props.columns[i].fixed && props.columns[i].fixed == "right") { + if (props.columns[i].fixed && props.columns[i].fixed == "right") { right = right + props.columns[i]?.width.replace("px", ""); } } @@ -277,22 +277,22 @@ const renderFixedClassName = (column: any, columnIndex: number) => { if (column.fixed == "left") { var left = true; for (var i = columnIndex + 1; i < props.columns.length; i++) { - if(props.columns[i].fixed && props.columns[i].fixed == "left") { + if (props.columns[i].fixed && props.columns[i].fixed == "left") { left = false; } } - return left ? `layui-table-fixed-left-last` : ''; + return left ? `layui-table-fixed-left-last` : ""; } else { var right = true; for (var i = 0; i < columnIndex; i++) { - if(props.columns[i].fixed && props.columns[i].fixed == "right") { + if (props.columns[i].fixed && props.columns[i].fixed == "right") { right = false; } } - return right ? `layui-table-fixed-right-first` : ''; + return right ? `layui-table-fixed-right-first` : ""; } } -} +}; @@ -379,7 +379,7 @@ const renderFixedClassName = (column: any, columnIndex: number) => { class="layui-table-cell" :class="[ column.fixed ? `layui-table-fixed-${column.fixed}` : '', - renderFixedClassName(column, columnIndex) + renderFixedClassName(column, columnIndex), ]" :style="[ { diff --git a/package/component/src/component/transition/index.vue b/package/component/src/component/transition/index.vue index 0cc75c58..264a319b 100644 --- a/package/component/src/component/transition/index.vue +++ b/package/component/src/component/transition/index.vue @@ -1,6 +1,8 @@ - + @@ -22,14 +24,14 @@ import LayFadeTransition from "./transitions/fadeTransition.vue"; export interface LayTransitionProps { type?: string; enable?: boolean; - time?:string|number; + time?: string | number; } const props = withDefaults(defineProps(), { type: "collapse", enable: true, - time:0.3 + time: 0.3, }); -provide('time',props.time) +provide("time", props.time); diff --git a/package/component/src/component/transition/transitions/collapseTransition.vue b/package/component/src/component/transition/transitions/collapseTransition.vue index 74413b38..ab5b5135 100644 --- a/package/component/src/component/transition/transitions/collapseTransition.vue +++ b/package/component/src/component/transition/transitions/collapseTransition.vue @@ -18,9 +18,9 @@ export default { + ::: ::: title 自定义比例 @@ -36,9 +46,9 @@ - 1 - 2 - 3 + 1 + 2 + 3 @@ -78,13 +88,14 @@ - + - 1 - 2 + 1 + 2 - 2 + 2 + 2 @@ -112,7 +123,7 @@ | 属性 | 描述 | 类型 |可选值 | 默认值| | ----- | ---- | ------ | ---| ---| -| space | 默认每个站多大比例(`%`), 设置一个, 其他的都需要设置,合计为(`100` ) | number | - | 按照个数平分 | +| space | 默认每个占 `px` , 其他的自动平分 | number | - | 按照个数平分 | ::: ::: contributor splitPanel