This commit is contained in:
Theluyuan 2023-02-16 13:55:34 +08:00
parent dda349419d
commit d3b3161574
4 changed files with 109 additions and 57 deletions

View File

@ -1,5 +1,5 @@
import { w as withInstall } from "../badge/index2.js";
import { defineComponent, useSlots, ref, computed, resolveComponent, openBlock, createElementBlock, Fragment, createElementVNode, normalizeStyle, normalizeClass, withModifiers, renderList, createCommentVNode, unref, createBlock, createVNode, mergeProps, isRef, createTextVNode, toDisplayString, withCtx, renderSlot, createSlots, watch, nextTick, onMounted, onBeforeUnmount } from "vue";
import { defineComponent, useSlots, ref, computed, resolveComponent, resolveDirective, openBlock, createElementBlock, Fragment, createElementVNode, normalizeStyle, normalizeClass, withModifiers, renderList, createCommentVNode, unref, createBlock, createVNode, mergeProps, isRef, createTextVNode, toDisplayString, withCtx, renderSlot, withKeys, withDirectives, createSlots, watch, nextTick, onMounted, onBeforeUnmount } from "vue";
import { _ as _sfc_main$2E, a as _sfc_main$4 } from "../checkbox/index2.js";
import { _ as _sfc_main$7 } from "../dropdown/index2.js";
import { _ as _sfc_main$8 } from "../empty/index2.js";
@ -41,7 +41,7 @@ const _hoisted_10$1 = {
key: 1,
class: "layui-table-cell-expand-icon-spaced"
};
const _hoisted_11$1 = { key: 4 };
const _hoisted_11$1 = ["onClick"];
const _hoisted_12$1 = {
key: 0,
class: "layui-table-cell-expand"
@ -88,6 +88,7 @@ const _sfc_main$2 = defineComponent({
const props = __props;
const slot = useSlots();
const tableExpandAll = ref(props.defaultExpandAll);
const editIndex = ref({});
const tableExpandKeys = computed({
get() {
return [...props.expandKeys];
@ -245,7 +246,9 @@ const _sfc_main$2 = defineComponent({
const checkboxProps = props.getCheckboxProps(props.data, props.index);
const radioProps = props.getRadioProps(props.data, props.index);
return (_ctx, _cache) => {
const _component_lay_input = resolveComponent("lay-input");
const _component_table_row = resolveComponent("table-row", true);
const _directive_esle = resolveDirective("esle");
return openBlock(), createElementBlock(Fragment, null, [
createElementVNode("tr", {
style: normalizeStyle([renderRowStyle(__props.data, __props.index)]),
@ -472,7 +475,25 @@ const _sfc_main$2 = defineComponent({
createTextVNode(toDisplayString(__props.data[column.key]), 1)
]),
_: 2
}, 1032, ["content"])) : (openBlock(), createElementBlock("span", _hoisted_11$1, toDisplayString(__props.data[column.key]), 1))
}, 1032, ["content"])) : (openBlock(), createElementBlock(Fragment, { key: 4 }, [
column.edit ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
editIndex.value[columnIndex] == false ? (openBlock(), createElementBlock("span", {
key: 0,
onClick: ($event) => editIndex.value[columnIndex] = true
}, toDisplayString(__props.data[column.key]), 9, _hoisted_11$1)) : (openBlock(), createBlock(_component_lay_input, {
key: 1,
modelValue: __props.data[column.key],
"onUpdate:modelValue": ($event) => __props.data[column.key] = $event,
onKeyup: withKeys(($event) => editIndex.value[columnIndex] = false, ["enter"]),
onBlur: ($event) => editIndex.value[columnIndex] = false
}, null, 8, ["modelValue", "onUpdate:modelValue", "onKeyup", "onBlur"]))
], 64)) : createCommentVNode("", true),
withDirectives((openBlock(), createElementBlock("template", null, [
createElementVNode("span", null, toDisplayString(__props.data[column.key]), 1)
])), [
[_directive_esle]
])
], 64))
], 4)
], 14, _hoisted_9$1)) : createCommentVNode("", true)
], 64))

File diff suppressed because one or more lines are too long

View File

@ -57,6 +57,8 @@ const props = withDefaults(defineProps<TableRowProps>(), {
const tableExpandAll = ref(props.defaultExpandAll);
const editIndex:any = ref({})
const tableExpandKeys: WritableComputedRef<Recordable[]> = computed({
get() {
return [...props.expandKeys];
@ -603,8 +605,16 @@ const radioProps = props.getRadioProps(props.data, props.index);
>
{{ data[column.key] }}
</lay-tooltip>
<template v-else>
<template v-if="column.edit">
<span v-if="editIndex[columnIndex] == false" @click="editIndex[columnIndex] = true"> {{ data[column.key] }} </span>
<lay-input v-model="data[column.key]" v-else @keyup.enter = "editIndex[columnIndex] = false" @blur="editIndex[columnIndex] = false"></lay-input>
</template>
<template v-esle>
<span> {{ data[column.key] }} </span>
</template>
<span v-else> {{ data[column.key] }} </span>
</template>
</div>
</td>
</template>

File diff suppressed because one or more lines are too long