Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
najiu-admin-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
najiu-frontend
najiu-admin-template
Commits
a2c89d2e
Commit
a2c89d2e
authored
Jan 04, 2021
by
vben
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(table): fix table setting error #162
parent
a7a8b894
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
8 deletions
+35
-8
BasicTable.vue
src/components/Table/src/BasicTable.vue
+9
-1
ColumnSetting.vue
...omponents/Table/src/components/settings/ColumnSetting.vue
+4
-5
usePagination.tsx
src/components/Table/src/hooks/usePagination.tsx
+14
-2
useTable.ts
src/components/Table/src/hooks/useTable.ts
+6
-0
table.ts
src/components/Table/src/types/table.ts
+2
-0
No files found.
src/components/Table/src/BasicTable.vue
View file @
a2c89d2e
...
...
@@ -102,7 +102,13 @@
});
const
{
getLoading
,
setLoading
}
=
useLoading
(
getProps
);
const
{
getPaginationInfo
,
getPagination
,
setPagination
}
=
usePagination
(
getProps
);
const
{
getPaginationInfo
,
getPagination
,
setPagination
,
setShowPagination
,
getShowPagination
,
}
=
usePagination
(
getProps
);
const
{
getRowSelection
,
...
...
@@ -229,6 +235,8 @@
getCacheColumns
,
emit
,
updateTableData
,
setShowPagination
,
getShowPagination
,
getSize
:
()
=>
{
return
unref
(
getBindValues
).
size
as
SizeType
;
},
...
...
src/components/Table/src/components/settings/ColumnSetting.vue
View file @
a2c89d2e
...
...
@@ -211,18 +211,17 @@
cachePlainOptions
.
value
=
columns
;
state
.
defaultCheckList
=
checkList
;
}
else
{
const
fixedColumns
=
columns
.
filter
((
item
)
=>
Reflect
.
has
(
item
,
'
fixed
'
)
)
as
BasicColumn
[];
//
const fixedColumns = columns.filter((item) =>
//
Reflect.has(item, 'fixed')
//
) as BasicColumn[];
unref
(
plainOptions
).
forEach
((
item
:
BasicColumn
)
=>
{
const
findItem
=
fixedColumns
.
find
((
fCol
)
=>
fC
ol
.
dataIndex
===
item
.
dataIndex
);
const
findItem
=
columns
.
find
((
col
:
BasicColumn
)
=>
c
ol
.
dataIndex
===
item
.
dataIndex
);
if
(
findItem
)
{
item
.
fixed
=
findItem
.
fixed
;
}
});
}
state
.
checkedList
=
checkList
;
}
...
...
src/components/Table/src/hooks/usePagination.tsx
View file @
a2c89d2e
...
...
@@ -27,13 +27,16 @@ function itemRender({ page, type, originalElement }: ItemRender) {
export
function
usePagination
(
refProps
:
ComputedRef
<
BasicTableProps
>
)
{
const
configRef
=
ref
<
PaginationProps
>
({});
const
show
=
ref
(
true
);
const
{
t
}
=
useI18n
();
const
getPaginationInfo
=
computed
(():
PaginationProps
|
boolean
=>
{
const
{
pagination
}
=
unref
(
refProps
);
if
(
isBoolean
(
pagination
)
&&
!
pagination
)
{
if
(
!
unref
(
show
)
||
(
isBoolean
(
pagination
)
&&
!
pagination
)
)
{
return
false
;
}
return
{
current
:
1
,
pageSize
:
PAGE_SIZE
,
...
...
@@ -60,5 +63,14 @@ export function usePagination(refProps: ComputedRef<BasicTableProps>) {
function
getPagination
()
{
return
unref
(
getPaginationInfo
);
}
return
{
getPagination
,
getPaginationInfo
,
setPagination
};
function
getShowPagination
()
{
return
unref
(
show
);
}
async
function
setShowPagination
(
flag
:
boolean
)
{
show
.
value
=
flag
;
}
return
{
getPagination
,
getPaginationInfo
,
setShowPagination
,
getShowPagination
,
setPagination
};
}
src/components/Table/src/hooks/useTable.ts
View file @
a2c89d2e
...
...
@@ -121,6 +121,12 @@ export function useTable(
getForm
:
()
=>
{
return
unref
(
formRef
)
as
FormActionType
;
},
setShowPagination
:
async
(
show
:
boolean
)
=>
{
getTableInstance
().
setShowPagination
(
show
);
},
getShowPagination
:
()
=>
{
return
getTableInstance
().
getShowPagination
();
},
};
return
[
register
,
methods
];
...
...
src/components/Table/src/types/table.ts
View file @
a2c89d2e
...
...
@@ -102,6 +102,8 @@ export interface TableActionType {
getCacheColumns
:
()
=>
BasicColumn
[];
emit
?:
EmitType
;
updateTableData
:
(
index
:
number
,
key
:
string
,
value
:
any
)
=>
Recordable
;
setShowPagination
:
(
show
:
boolean
)
=>
Promise
<
void
>
;
getShowPagination
:
()
=>
boolean
;
}
export
interface
FetchSetting
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment