knt-shared 1.4.3 → 1.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -3820,6 +3820,9 @@ function useTableEdit(props, dataSource, getRowKey) {
3820
3820
  if (editValueMap[recordKey] && columnKey in editValueMap[recordKey]) {
3821
3821
  return editValueMap[recordKey][columnKey];
3822
3822
  }
3823
+ if (column.editDefaultValue) {
3824
+ return column.editDefaultValue;
3825
+ }
3823
3826
  if (column.editValueGetter) {
3824
3827
  return column.editValueGetter(record);
3825
3828
  }
@@ -3993,7 +3996,7 @@ function useTableEdit(props, dataSource, getRowKey) {
3993
3996
  delete validationErrorMap[recordKey];
3994
3997
  Message.success("删除成功");
3995
3998
  };
3996
- const addRow = async () => {
3999
+ const addRow = async (position = "bottom") => {
3997
4000
  let newRecord = {};
3998
4001
  if (editConfig.value.onAdd) {
3999
4002
  try {
@@ -4008,7 +4011,11 @@ function useTableEdit(props, dataSource, getRowKey) {
4008
4011
  if (typeof rowKey === "string" && !newRecord[rowKey]) {
4009
4012
  newRecord[rowKey] = `temp_${Date.now()}_${Math.random()}`;
4010
4013
  }
4011
- dataSource.value.unshift(newRecord);
4014
+ if (position === "top") {
4015
+ dataSource.value.unshift(newRecord);
4016
+ } else {
4017
+ dataSource.value.push(newRecord);
4018
+ }
4012
4019
  startEdit(newRecord);
4013
4020
  };
4014
4021
  const getEditingRows = () => {