Skip to content

Commit 03e7806

Browse files
committed
feat(components): [dynamic-table] cell support defaultEditable
1 parent 0eccb9a commit 03e7806

File tree

5 files changed

+210
-132
lines changed

5 files changed

+210
-132
lines changed

package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,20 @@
4848
"qs": "~6.11.0",
4949
"socket.io-client": "~4.5.1",
5050
"sortablejs": "~1.15.0",
51-
"vue": "3.2.37",
51+
"vue": "3.2.38",
5252
"vue-i18n": "9.2.2",
5353
"vue-router": "~4.0.16",
5454
"vue-types": "~4.2.1",
5555
"xlsx": "~0.18.5"
5656
},
5757
"devDependencies": {
58-
"@commitlint/cli": "~17.1.1",
58+
"@commitlint/cli": "~17.1.2",
5959
"@commitlint/config-conventional": "~17.1.0",
6060
"@types/lodash-es": "~4.17.6",
61-
"@types/node": "~18.7.13",
61+
"@types/node": "~18.7.14",
6262
"@types/webpack-env": "~1.18.0",
63-
"@typescript-eslint/eslint-plugin": "~5.35.1",
64-
"@typescript-eslint/parser": "~5.35.1",
63+
"@typescript-eslint/eslint-plugin": "~5.36.0",
64+
"@typescript-eslint/parser": "~5.36.0",
6565
"@vue/cli-plugin-babel": "~5.0.8",
6666
"@vue/cli-plugin-eslint": "~5.0.8",
6767
"@vue/cli-plugin-router": "~5.0.8",
@@ -103,7 +103,7 @@
103103
"unplugin-vue-define-options": "~0.7.3",
104104
"vue-cli-plugin-windicss": "~1.1.6",
105105
"vue-eslint-parser": "~9.0.3",
106-
"vue-tsc": "^0.40.2"
106+
"vue-tsc": "^0.40.4"
107107
},
108108
"__npminstall_done": false,
109109
"repository": {

src/components/core/dynamic-table/src/components/editable-cell/index.vue

+5
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@
137137
cancelCellEditable(props.rowKey!, dataIndex.value);
138138
};
139139
140+
// 默认开启编辑的单元格
141+
if (isCellEdit.value && props.editableType === 'cell') {
142+
startEditCell();
143+
}
144+
140145
return {
141146
saving,
142147
isCellEdit,

src/components/core/dynamic-table/src/dynamic-table.vue

+2-3
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@
2626
<slot :name="name" v-bind="data || {}"></slot>
2727
</template>
2828
</ToolBar>
29-
<component
30-
:is="editableType === 'cell' || Object.keys(editFormModel).length ? SchemaForm : 'div'"
29+
<SchemaForm
3130
ref="editTableFormRef"
3231
layout="inline"
3332
no-style
@@ -50,7 +49,7 @@
5049
<slot name="bodyCell" v-bind="slotData"></slot>
5150
</template>
5251
</Table>
53-
</component>
52+
</SchemaForm>
5453
</div>
5554
</div>
5655
</template>

src/views/demos/tables/edit-row-table/columns.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ export const columns: TableColumn<ListItemType>[] = [
2020
align: 'center',
2121
dataIndex: 'name',
2222
sorter: true,
23+
/** 默认开启编辑, 仅`editableType`为`cell`时有效 */
24+
defaultEditable: true,
2325
editable: ({ index }) => {
2426
// 第一行不允许被编辑
2527
return index > 0;

0 commit comments

Comments
 (0)