Commit aa596af608a313a5494db8e3ddbf0ef84c7f0c55
1 parent
0419a070
fix(table): table columns setting will uncheck all render columns #154
Showing
3 changed files
with
6 additions
and
5 deletions
src/components/Table/src/components/editable/EditableCell.vue
... | ... | @@ -250,7 +250,7 @@ |
250 | 250 | if (props.record) { |
251 | 251 | /* eslint-disable */ |
252 | 252 | isArray(props.record[cbs]) |
253 | - ? props.record[cbs].push(handle) | |
253 | + ? props.record[cbs]?.push(handle) | |
254 | 254 | : (props.record[cbs] = [handle]); |
255 | 255 | } |
256 | 256 | } |
... | ... | @@ -267,9 +267,9 @@ |
267 | 267 | /* eslint-disable */ |
268 | 268 | props.record.onSubmitEdit = async () => { |
269 | 269 | if (isArray(props.record?.submitCbs)) { |
270 | - const validFns = props.record?.validCbs || []; | |
270 | + const validFns = (props.record?.validCbs || []).map((fn) => fn()); | |
271 | 271 | |
272 | - const res = await Promise.all(validFns.map((fn) => fn())); | |
272 | + const res = await Promise.all(validFns); | |
273 | 273 | const pass = res.every((item) => !!item); |
274 | 274 | |
275 | 275 | if (!pass) return; | ... | ... |
src/components/Table/src/hooks/useColumns.ts
... | ... | @@ -185,13 +185,14 @@ export function useColumns( |
185 | 185 | const columnKeys = columns as string[]; |
186 | 186 | const newColumns: BasicColumn[] = []; |
187 | 187 | cacheColumns.forEach((item) => { |
188 | - if (columnKeys.includes(`${item.key}`! || item.dataIndex!)) { | |
188 | + if (columnKeys.includes(item.dataIndex! || (item.key as string))) { | |
189 | 189 | newColumns.push({ |
190 | 190 | ...item, |
191 | 191 | defaultHidden: false, |
192 | 192 | }); |
193 | 193 | } |
194 | 194 | }); |
195 | + | |
195 | 196 | // Sort according to another array |
196 | 197 | if (!isEqual(cacheKeys, columns)) { |
197 | 198 | newColumns.sort((prev, next) => { | ... | ... |
src/settings/projectSetting.ts