Browse Source

fix label taskOpenFilter

merge-requests/52/head
JetUp iMac 3 3 years ago
parent
commit
f87689adf8
  1. 18
      src/components/TableGrid/Table.tsx
  2. 17
      src/components/TableGrid/components/action-bottom-bar.component.tsx
  3. 30
      src/components/TableGrid/components/columns-view.component.tsx
  4. 4
      src/components/TableGrid/style.scss
  5. 1
      src/containers/Ips/components/Data/index.tsx
  6. 2
      src/containers/Tasks/configs/tasks-columns.config.tsx
  7. 3
      src/scss/main.scss

18
src/components/TableGrid/Table.tsx

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
import React, { useEffect, useState } from "react";
import React, { useEffect, useState } from "react";
import ReactDataGrid from "react-data-grid";
import "./style.scss";
import "react-data-grid/dist/react-data-grid.css";
@ -7,7 +7,6 @@ import { Input, Spin, Pagination, Select } from "antd"; @@ -7,7 +7,6 @@ import { Input, Spin, Pagination, Select } from "antd";
import { EUserStatus, IColumn, IIps, IPListType } from "@/shared";
import { ActionBottomBar } from "./components";
import { voidColumn, VOID_COLUMN_KEY } from "./configs";
import _ from "lodash";
interface IProps {
tableName: string;
@ -76,6 +75,8 @@ export const Table = ({ @@ -76,6 +75,8 @@ export const Table = ({
}
};
const onRowsEmpty = () => {
if (!paginationList.items.length) {
const preparedRows: any = []
@ -97,6 +98,11 @@ export const Table = ({ @@ -97,6 +98,11 @@ export const Table = ({
setRows(paginationList.items)
}
useEffect(() => {
initTableSettings();
}, []);
@ -116,11 +122,12 @@ export const Table = ({ @@ -116,11 +122,12 @@ export const Table = ({
})
);
};
const columnsRender = () => {
const preparedColumns = columnsSort
.map((key) => {
const index = columns.findIndex((it) => it.key === key);
const index = columns.findIndex((it) => it.key === key)
return {
...columns[index],
width:
@ -273,7 +280,7 @@ export const Table = ({ @@ -273,7 +280,7 @@ export const Table = ({
return preparedColumns.length ? preparedColumns : [voidColumn];
};
console.log("rows", rows);
console.log('tablename', props.tableName)
return (
<div className="table-grid_custom" id="table-el">
{paginationList.isLoading && (
@ -336,6 +343,7 @@ export const Table = ({ @@ -336,6 +343,7 @@ export const Table = ({
activeColumns={activeColumns}
onChangeColumns={setActiveColumns}
onSaveColumnsSort={setColumnsSort}
tableName={props.tableName}
/>
</div> : <div />
}

17
src/components/TableGrid/components/action-bottom-bar.component.tsx

@ -1,6 +1,7 @@ @@ -1,6 +1,7 @@
/* eslint-disable array-callback-return */
import React from "react";
import { IColumn} from "@/shared";
import { Button, Select } from "antd";
import { IColumn } from "@/shared";
import { Button, Select } from "antd";
import { pageLimitConfig } from "../configs";
import { IPaginationParams } from "../interfaces";
import { ColumnsView } from "./columns-view.component";
@ -19,6 +20,7 @@ interface IProps { @@ -19,6 +20,7 @@ interface IProps {
activeColumns: string[];
onChangeColumns: (val: any) => void;
onSaveColumnsSort: (val: any) => void;
tableName: string;
}
export const ActionBottomBar = (props: IProps) => {
@ -28,16 +30,10 @@ export const ActionBottomBar = (props: IProps) => { @@ -28,16 +30,10 @@ export const ActionBottomBar = (props: IProps) => {
value={props.paginationParams.limit}
onChange={(limit) => {
if (limit === 99999) {
props.onSetPaginationParams({
limit: 99999,
page: 1,
});
props.onSetPaginationParams({ limit: 99999, page: 1 });
props.onSetLoadParams({ page: 1, limit });
}
props.onSetPaginationParams({
limit,
page: 1,
});
props.onSetPaginationParams({ limit, page: 1 });
props.onSetLoadParams({ page: 1, limit });
}}
>
@ -53,6 +49,7 @@ export const ActionBottomBar = (props: IProps) => { @@ -53,6 +49,7 @@ export const ActionBottomBar = (props: IProps) => {
columns={props.columns}
columnsSort={props.columnsSort}
onSaveColumnsSort={props.onSaveColumnsSort}
tableName={props.tableName}
/>
<Button
title="Зберегти налаштування вигляду"

30
src/components/TableGrid/components/columns-view.component.tsx

@ -13,6 +13,7 @@ interface IProps { @@ -13,6 +13,7 @@ interface IProps {
activeColumns: string[];
onChangeColumns: (val: any) => void;
onSaveColumnsSort: (val: any) => void;
tableName: string
}
export const ColumnsView = (props: IProps) => {
@ -58,11 +59,9 @@ export const ColumnsView = (props: IProps) => { @@ -58,11 +59,9 @@ export const ColumnsView = (props: IProps) => {
const index = props.columns.findIndex((it) => it.key === key);
return props.columns[index];
});
columns = columns.filter(
(it) => !["select-row", VOID_COLUMN_KEY].includes(it?.key)
);
return (
<Dropdown
placement="topLeft"
@ -71,15 +70,30 @@ export const ColumnsView = (props: IProps) => { @@ -71,15 +70,30 @@ export const ColumnsView = (props: IProps) => {
overlay={() => (
<Menu style={{ borderRadius: 20, padding: 15 }}>
{columns.map((item, index) => {
return (
<Menu.Item key={index} onClick={() => { }}>
<div className="collums-row-sort">
<InputCheckbox
value={props.activeColumns.indexOf(item?.key) > -1}
onChange={(isChecked) => onChange(isChecked, item?.key)}
>
{item?.name}
</InputCheckbox>
{
item?.name === '№' && props.tableName === 'tasks' ?
<InputCheckbox
value={props.activeColumns.indexOf(item?.key) > -1}
onChange={(isChecked) => onChange(isChecked, item?.key)}
>
{`${item?.name} задачі`}
</InputCheckbox> : <InputCheckbox
value={props.activeColumns.indexOf(item?.key) > -1}
onChange={(isChecked) => onChange(isChecked, item?.key)}
>
{item?.name}
</InputCheckbox>
}
<div className="sort-icons">
{index > 0 ? (

4
src/components/TableGrid/style.scss

@ -240,6 +240,7 @@ @@ -240,6 +240,7 @@
}
.rdg-checkbox-input {
}
.rdg-checkbox {
@ -274,7 +275,7 @@ @@ -274,7 +275,7 @@
}
.collums-row-sort {
max-width: 160px;
max-width: 185px;
display: flex;
justify-content: space-between;
@ -288,6 +289,7 @@ @@ -288,6 +289,7 @@
display: flex;
justify-content: space-between;
min-width: 41px;
margin-left: 10px;
.btn-icon + .btn-icon {
margin-left: 5px;
}

1
src/containers/Ips/components/Data/index.tsx

@ -88,7 +88,6 @@ deleteIP() @@ -88,7 +88,6 @@ deleteIP()
userId: 0,
listType: undefined,
});
console.log("rows", rows);
useEffect(()=>{
const headerTable = document.querySelector('.rdg-header-sort-name')
headerTable.classList.add('rgb-resetAlign')

2
src/containers/Tasks/configs/tasks-columns.config.tsx

@ -41,7 +41,7 @@ export const tasksColumnsConfig: any = [ @@ -41,7 +41,7 @@ export const tasksColumnsConfig: any = [
sortable: false,
resizable: true,
formatter: ({ row }) => {
console.log({row})
// console.log({row})
return row?.endDate ? moment(row.endDate).format('DD-MM-YY') : ''}
},
{

3
src/scss/main.scss

@ -344,6 +344,9 @@ span { @@ -344,6 +344,9 @@ span {
width: 280px !important;
}
.ant-dropdown-menu-item {
font-size: 12px;
}
.ant-dropdown-menu-item:hover,
.ant-dropdown-menu-submenu-title:hover {
background-color: transparent;

Loading…
Cancel
Save