Skip to content

Commit

Permalink
feat(components): [dynamic-table] cell support defaultEditable
Browse files Browse the repository at this point in the history
  • Loading branch information
buqiyuan committed Aug 30, 2022
1 parent 0eccb9a commit 03e7806
Show file tree
Hide file tree
Showing 5 changed files with 210 additions and 132 deletions.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,20 +48,20 @@
"qs": "~6.11.0",
"socket.io-client": "~4.5.1",
"sortablejs": "~1.15.0",
"vue": "3.2.37",
"vue": "3.2.38",
"vue-i18n": "9.2.2",
"vue-router": "~4.0.16",
"vue-types": "~4.2.1",
"xlsx": "~0.18.5"
},
"devDependencies": {
"@commitlint/cli": "~17.1.1",
"@commitlint/cli": "~17.1.2",
"@commitlint/config-conventional": "~17.1.0",
"@types/lodash-es": "~4.17.6",
"@types/node": "~18.7.13",
"@types/node": "~18.7.14",
"@types/webpack-env": "~1.18.0",
"@typescript-eslint/eslint-plugin": "~5.35.1",
"@typescript-eslint/parser": "~5.35.1",
"@typescript-eslint/eslint-plugin": "~5.36.0",
"@typescript-eslint/parser": "~5.36.0",
"@vue/cli-plugin-babel": "~5.0.8",
"@vue/cli-plugin-eslint": "~5.0.8",
"@vue/cli-plugin-router": "~5.0.8",
Expand Down Expand Up @@ -103,7 +103,7 @@
"unplugin-vue-define-options": "~0.7.3",
"vue-cli-plugin-windicss": "~1.1.6",
"vue-eslint-parser": "~9.0.3",
"vue-tsc": "^0.40.2"
"vue-tsc": "^0.40.4"
},
"__npminstall_done": false,
"repository": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@
cancelCellEditable(props.rowKey!, dataIndex.value);
};
// 默认开启编辑的单元格
if (isCellEdit.value && props.editableType === 'cell') {
startEditCell();
}
return {
saving,
isCellEdit,
Expand Down
5 changes: 2 additions & 3 deletions src/components/core/dynamic-table/src/dynamic-table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
<slot :name="name" v-bind="data || {}"></slot>
</template>
</ToolBar>
<component
:is="editableType === 'cell' || Object.keys(editFormModel).length ? SchemaForm : 'div'"
<SchemaForm
ref="editTableFormRef"
layout="inline"
no-style
Expand All @@ -50,7 +49,7 @@
<slot name="bodyCell" v-bind="slotData"></slot>
</template>
</Table>
</component>
</SchemaForm>
</div>
</div>
</template>
Expand Down
2 changes: 2 additions & 0 deletions src/views/demos/tables/edit-row-table/columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export const columns: TableColumn<ListItemType>[] = [
align: 'center',
dataIndex: 'name',
sorter: true,
/** 默认开启编辑, 仅`editableType`为`cell`时有效 */
defaultEditable: true,
editable: ({ index }) => {
// 第一行不允许被编辑
return index > 0;
Expand Down
Loading

1 comment on commit 03e7806

@vercel
Copy link

@vercel vercel bot commented on 03e7806 Aug 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

vue3-antd-admin – ./

vue3-antd-admin.vercel.app
vue3-antd-admin-buqiyuan.vercel.app
vue3-antd-admin-git-main-buqiyuan.vercel.app

Please sign in to comment.