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/components/Table/BasicTable.vue.d.ts +1 -1
- package/dist/components/Table/hooks/useTableEdit.d.ts +1 -1
- package/dist/components/Table/hooks/useTableEdit.d.ts.map +1 -1
- package/dist/index.cjs.js +9 -2
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +9 -2
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -93,7 +93,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
|
|
|
93
93
|
saveEdit: (record: TableData) => Promise<boolean>;
|
|
94
94
|
cancelEdit: (record: TableData) => void;
|
|
95
95
|
deleteRow: (record: TableData) => Promise<void>;
|
|
96
|
-
addRow: () => Promise<void>;
|
|
96
|
+
addRow: (position?: "top" | "bottom") => Promise<void>;
|
|
97
97
|
getEditingRows: () => TableData[];
|
|
98
98
|
saveAllEdits: () => Promise<boolean>;
|
|
99
99
|
cancelAllEdits: () => void;
|
|
@@ -18,7 +18,7 @@ export declare function useTableEdit(props: ComputedRef<BasicTableProps>, dataSo
|
|
|
18
18
|
saveEdit: (record: TableData) => Promise<boolean>;
|
|
19
19
|
cancelEdit: (record: TableData) => void;
|
|
20
20
|
deleteRow: (record: TableData) => Promise<void>;
|
|
21
|
-
addRow: () => Promise<void>;
|
|
21
|
+
addRow: (position?: "top" | "bottom") => Promise<void>;
|
|
22
22
|
getEditingRows: () => TableData[];
|
|
23
23
|
saveAllEdits: () => Promise<boolean>;
|
|
24
24
|
cancelAllEdits: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTableEdit.d.ts","sourceRoot":"","sources":["../../../../src/components/Table/hooks/useTableEdit.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,KAAK,EAAE,S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,KAAc,OAAO,CAAC,IAAI,CAAC;0BAmChD,SAAS,EAAE;wBAWP,OAAO,CAAC,OAAO,CAAC;0BAqBpB,IAAI;+BA1PG,SAAS,KAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;EAoRlE"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -3822,6 +3822,9 @@ function useTableEdit(props, dataSource, getRowKey) {
|
|
|
3822
3822
|
if (editValueMap[recordKey] && columnKey in editValueMap[recordKey]) {
|
|
3823
3823
|
return editValueMap[recordKey][columnKey];
|
|
3824
3824
|
}
|
|
3825
|
+
if (column.editDefaultValue) {
|
|
3826
|
+
return column.editDefaultValue;
|
|
3827
|
+
}
|
|
3825
3828
|
if (column.editValueGetter) {
|
|
3826
3829
|
return column.editValueGetter(record);
|
|
3827
3830
|
}
|
|
@@ -3995,7 +3998,7 @@ function useTableEdit(props, dataSource, getRowKey) {
|
|
|
3995
3998
|
delete validationErrorMap[recordKey];
|
|
3996
3999
|
webVue.Message.success("删除成功");
|
|
3997
4000
|
};
|
|
3998
|
-
const addRow = async () => {
|
|
4001
|
+
const addRow = async (position = "bottom") => {
|
|
3999
4002
|
let newRecord = {};
|
|
4000
4003
|
if (editConfig.value.onAdd) {
|
|
4001
4004
|
try {
|
|
@@ -4010,7 +4013,11 @@ function useTableEdit(props, dataSource, getRowKey) {
|
|
|
4010
4013
|
if (typeof rowKey === "string" && !newRecord[rowKey]) {
|
|
4011
4014
|
newRecord[rowKey] = `temp_${Date.now()}_${Math.random()}`;
|
|
4012
4015
|
}
|
|
4013
|
-
|
|
4016
|
+
if (position === "top") {
|
|
4017
|
+
dataSource.value.unshift(newRecord);
|
|
4018
|
+
} else {
|
|
4019
|
+
dataSource.value.push(newRecord);
|
|
4020
|
+
}
|
|
4014
4021
|
startEdit(newRecord);
|
|
4015
4022
|
};
|
|
4016
4023
|
const getEditingRows = () => {
|