|
@@ -65,6 +65,19 @@
|
|
return ['Checkbox', 'Switch'].includes(component);
|
|
return ['Checkbox', 'Switch'].includes(component);
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ const getDisable = computed(() => {
|
|
|
|
+ const { editDynamicDisabled } = props.column;
|
|
|
|
+ let disabled = false;
|
|
|
|
+ if (isBoolean(editDynamicDisabled)) {
|
|
|
|
+ disabled = editDynamicDisabled;
|
|
|
|
+ }
|
|
|
|
+ if (isFunction(editDynamicDisabled)) {
|
|
|
|
+ const { record } = props;
|
|
|
|
+ disabled = editDynamicDisabled({ record, currentValue: currentValueRef.value });
|
|
|
|
+ }
|
|
|
|
+ return disabled;
|
|
|
|
+ });
|
|
|
|
+
|
|
const getComponentProps = computed(() => {
|
|
const getComponentProps = computed(() => {
|
|
const isCheckValue = unref(getIsCheckComp);
|
|
const isCheckValue = unref(getIsCheckComp);
|
|
let compProps = props.column?.editComponentProps ?? ({} as any);
|
|
let compProps = props.column?.editComponentProps ?? ({} as any);
|
|
@@ -117,18 +130,7 @@
|
|
const dataKey = (dataIndex || key) as string;
|
|
const dataKey = (dataIndex || key) as string;
|
|
set(record, dataKey, value);
|
|
set(record, dataKey, value);
|
|
}
|
|
}
|
|
- const getDisable = computed(() => {
|
|
|
|
- const { editDynamicDisabled } = props.column;
|
|
|
|
- let disabled = false;
|
|
|
|
- if (isBoolean(editDynamicDisabled)) {
|
|
|
|
- disabled = editDynamicDisabled;
|
|
|
|
- }
|
|
|
|
- if (isFunction(editDynamicDisabled)) {
|
|
|
|
- const { record } = props;
|
|
|
|
- disabled = editDynamicDisabled({ record, currentValue: currentValueRef.value });
|
|
|
|
- }
|
|
|
|
- return disabled;
|
|
|
|
- });
|
|
|
|
|
|
+
|
|
const getValues = computed(() => {
|
|
const getValues = computed(() => {
|
|
const { editValueMap } = props.column;
|
|
const { editValueMap } = props.column;
|
|
|
|
|
|
@@ -149,6 +151,11 @@
|
|
return option?.label ?? value;
|
|
return option?.label ?? value;
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ const getRowEditable = computed(() => {
|
|
|
|
+ const { editable } = props.record || {};
|
|
|
|
+ return !!editable;
|
|
|
|
+ });
|
|
|
|
+
|
|
const getWrapperStyle = computed((): CSSProperties => {
|
|
const getWrapperStyle = computed((): CSSProperties => {
|
|
if (unref(getIsCheckComp) || unref(getRowEditable)) {
|
|
if (unref(getIsCheckComp) || unref(getRowEditable)) {
|
|
return {};
|
|
return {};
|
|
@@ -163,11 +170,6 @@
|
|
return `edit-cell-align-${align}`;
|
|
return `edit-cell-align-${align}`;
|
|
});
|
|
});
|
|
|
|
|
|
- const getRowEditable = computed(() => {
|
|
|
|
- const { editable } = props.record || {};
|
|
|
|
- return !!editable;
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
watchEffect(() => {
|
|
watchEffect(() => {
|
|
// defaultValueRef.value = props.value;
|
|
// defaultValueRef.value = props.value;
|
|
currentValueRef.value = props.value;
|
|
currentValueRef.value = props.value;
|
|
@@ -191,7 +193,7 @@
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
- async function handleChange(e: any) {
|
|
|
|
|
|
+ async function handleChange(e: any, ...rest: any[]) {
|
|
const component = unref(getComponent);
|
|
const component = unref(getComponent);
|
|
if (!e) {
|
|
if (!e) {
|
|
currentValueRef.value = e;
|
|
currentValueRef.value = e;
|
|
@@ -205,7 +207,7 @@
|
|
currentValueRef.value = e;
|
|
currentValueRef.value = e;
|
|
}
|
|
}
|
|
const onChange = unref(getComponentProps)?.onChangeTemp;
|
|
const onChange = unref(getComponentProps)?.onChangeTemp;
|
|
- if (onChange && isFunction(onChange)) onChange(...arguments);
|
|
|
|
|
|
+ if (onChange && isFunction(onChange)) onChange(e, ...rest);
|
|
|
|
|
|
table.emit?.('edit-change', {
|
|
table.emit?.('edit-change', {
|
|
column: props.column,
|
|
column: props.column,
|