ehscan-react-table 0.0.14 → 0.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,12 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { calcDateDiff, formatToDDMMYYYY } from '../tools/dateFunction';
3
- import styles from '../style/table.module.css';
3
+ import styles from '../elements/table.module.css';
4
4
  export const TableCellDueDate = ({ content, id, col, clickRow }) => {
5
5
  const DateContent = ({ value }) => {
6
6
  const valDate = value;
7
7
  return valDate === '-' || !valDate
8
8
  ? '-'
9
- : _jsx("span", { className: `${styles.dateTag} ${calcDateDiff(valDate)}`, children: formatToDDMMYYYY(valDate) });
9
+ : _jsx("span", { className: `${styles.dateTag} ${styles[calcDateDiff(valDate)]}`, children: formatToDDMMYYYY(valDate) });
10
10
  };
11
11
  return (_jsx("div", { onClick: () => clickRow({ id, col, type: 'default' }), children: _jsx(DateContent, { value: content }) }));
12
12
  };
@@ -1,7 +1,7 @@
1
1
  import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useState, useEffect } from "react";
3
3
  import PaginationButton from "./PaginationButton";
4
- import styles from '../style/table.module.css';
4
+ import styles from './table.module.css';
5
5
  export const Pagination = ({ totalItems, currentEntries, limit, skip, currentPage, onPageChange }) => {
6
6
  const [totalPages, setTotalPages] = useState(0);
7
7
  const handlePrevious = () => {
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useRef } from 'react';
3
3
  import PaginationRipple from './PaginationRipple';
4
- import styles from '../style/table.module.css';
4
+ import styles from './table.module.css';
5
5
  const PaginationButton = ({ index, txt, disabled, isActive, action, display }) => {
6
6
  const buttonRef = useRef(null);
7
7
  const handleRipple = PaginationRipple();
@@ -1,5 +1,5 @@
1
1
  import { useCallback } from 'react';
2
- import styles from '../style/table.module.css';
2
+ import styles from './table.module.css';
3
3
  const PaginationRipple = () => {
4
4
  const handleRipple = useCallback((event, buttonRef) => {
5
5
  const button = buttonRef.current;
@@ -11,7 +11,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
11
11
  import { useEffect, useState, useRef } from "react";
12
12
  import TableCellSelectHeadCol from "./TableCellSelectHeadCol";
13
13
  import { debounce } from "./Debounce";
14
- import styles from '../style/table.module.css';
14
+ import styles from './table.module.css';
15
15
  export const Table = ({ columns, rows, sortOrder, setSortOrder, cellComponents, setSelectedIds, searchTermArraySetter, setSearchTermArraySetter, fallback }) => {
16
16
  const [wrapperBottom, setWrapperBottom] = useState(undefined);
17
17
  const headerRef = useRef(null);
@@ -99,16 +99,16 @@ export const Table = ({ columns, rows, sortOrder, setSortOrder, cellComponents,
99
99
  return (_jsx(_Fragment, { children: _jsxs("div", { className: "sort-col", onClick: () => setSortOrder({ tag, dir: sortOrder.dir === 'desc' ? 'asc' : 'desc' }), children: [sortOrder.tag === tag && _jsx(SortButton, {}), openCol === tag && sortOrder.tag !== tag && _jsx(EmptySort, {})] }) }));
100
100
  };
101
101
  const HeadColMain = ({ col }) => {
102
- const { tag, search, title } = col;
102
+ const { tag, search, title, width } = col;
103
103
  const colTitle = title !== undefined ? title : tag;
104
- return (_jsx("th", { children: _jsxs("div", { className: styles.headcolcell, children: [_jsx(HeadColSort, { tag: tag }), _jsx("div", { className: styles.headcolcellmain, children: search ? _jsx(HeadSearchBar, { content: colTitle, tag: tag }) : _jsx("div", { children: colTitle }) })] }) }));
104
+ const thWidth = width !== undefined ? `${width}px` : "32px";
105
+ return (_jsx("th", { style: { "--custom-width": thWidth }, children: _jsxs("div", { className: styles.headcolcell, children: [_jsx(HeadColSort, { tag: tag }), _jsx("div", { className: styles.headcolcellmain, children: search ? _jsx(HeadSearchBar, { content: colTitle, tag: tag }) : _jsx("div", { children: colTitle }) })] }) }));
105
106
  };
106
107
  const HeadCols = () => {
107
108
  return (_jsxs(_Fragment, { children: [columns.map((col, i) => {
108
- const { tag, type, width } = col;
109
- const thWidth = width !== undefined ? `${width}px` : "32px";
109
+ const { tag, type } = col;
110
110
  if (type === "checkbox") {
111
- return (_jsx("th", { className: styles.thcheckhead, style: { "--custom-width": thWidth }, children: _jsx(TableCellSelectHeadCol, { checkHead: checkHead, checkAll: checkAll }) }, `checkbox-${tag !== null && tag !== void 0 ? tag : i}`));
111
+ return (_jsx("th", { className: styles.thcheckhead, style: { "--custom-width": "32px" }, children: _jsx(TableCellSelectHeadCol, { checkHead: checkHead, checkAll: checkAll }) }, `checkbox-${tag !== null && tag !== void 0 ? tag : i}`));
112
112
  }
113
113
  return _jsx(HeadColMain, { col: col }, tag !== null && tag !== void 0 ? tag : i);
114
114
  }), _jsx(EndHeadCol, {})] }));
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
11
11
  import { useRef } from 'react';
12
12
  import PaginationRipple from './PaginationRipple';
13
- import styles from '../style/table.module.css';
13
+ import styles from './table.module.css';
14
14
  const TableChecklistItem = ({ checked }) => {
15
15
  const buttonRef = useRef(null);
16
16
  const handleRipple = PaginationRipple();
@@ -496,14 +496,14 @@ RIPPLE
496
496
  position: relative;
497
497
  color: var(--ext-table-date-tag-clr, black);
498
498
  padding: 3px 6px;
499
- border-radius: 12px;
499
+ border-radius: 4px;
500
500
  font-size: 0.65rem;
501
501
  font-weight: 600;
502
502
  display: inline-block;
503
503
  text-align: center;
504
504
  text-overflow: ellipsis;
505
505
  white-space: nowrap;
506
- width: -webkit-fill-available;
506
+ width: fit-content;
507
507
  z-index: 0;
508
508
  }
509
509
  .dateTag::before {
@@ -513,7 +513,7 @@ RIPPLE
513
513
  background-color: var(--ext-table-date-tag-bck-clr, darkgrey);
514
514
  opacity: 0.7;
515
515
  /* dim background */
516
- border-radius: 12px;
516
+ border-radius: 4px;
517
517
  z-index: -1;
518
518
  }
519
519
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ehscan-react-table",
3
- "version": "0.0.14",
3
+ "version": "0.0.17",
4
4
  "description": "components",
5
5
  "main": "dist/Components.js",
6
6
  "types": "dist/Components.d.ts",