@dilicorp/ui 0.2.36 → 0.2.37

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.
@@ -5,8 +5,9 @@ declare type ColumnOrderProps = {
5
5
  order: 'asc' | 'desc';
6
6
  active: boolean;
7
7
  onChange: (id: string, type: string) => void;
8
+ onOrderClick?: () => void;
8
9
  disabled: boolean;
9
10
  };
10
- export declare const ColumnOrder: ({ id, label, order, active, onChange, disabled }: ColumnOrderProps) => JSX.Element;
11
+ export declare const ColumnOrder: ({ id, label, order, active, onChange, disabled, onOrderClick }: ColumnOrderProps) => JSX.Element;
11
12
  export {};
12
13
  //# sourceMappingURL=column-order.d.ts.map
@@ -1,10 +1,11 @@
1
1
  import React from 'react';
2
2
  import { Icon } from '../../atoms/icon';
3
- export const ColumnOrder = ({ id, label, order, active, onChange, disabled }) => {
3
+ export const ColumnOrder = ({ id, label, order, active, onChange, disabled, onOrderClick }) => {
4
4
  return (React.createElement("button", { onClick: () => {
5
- if (!disabled) {
6
- onChange(id, order === 'asc' ? 'desc' : 'asc');
7
- }
5
+ if (disabled)
6
+ return;
7
+ onChange(id, order === 'asc' ? 'desc' : 'asc');
8
+ onOrderClick && onOrderClick();
8
9
  }, type: "button", className: `table-column-order ${active ? ' active' : ''}` },
9
10
  label,
10
11
  order === 'asc' ? React.createElement(Icon, { icon: "fa-sort-amount-up", className: "ms-2" }) : React.createElement(Icon, { icon: "fa-sort-amount-down", className: "ms-2" })));
@@ -17,6 +17,7 @@ declare type HeaderArgs = {
17
17
  id: string;
18
18
  title: string;
19
19
  allowOrder?: boolean;
20
+ onOrderClick?: () => void;
20
21
  attributes?: {
21
22
  th?: ThAttributes;
22
23
  };
@@ -37,6 +38,7 @@ export interface TableBasicProps {
37
38
  id: string;
38
39
  title: string;
39
40
  allowOrder?: boolean;
41
+ onOrderClick?: () => void;
40
42
  }[];
41
43
  headerArgs?: HeaderArgs;
42
44
  body?: {
@@ -57,6 +59,7 @@ export interface TableColumnManagementProps extends Omit<TableBasicProps, 'heade
57
59
  id: string;
58
60
  title: string;
59
61
  allowOrder?: boolean;
62
+ onOrderClick?: () => void;
60
63
  }[];
61
64
  columnManagement: {
62
65
  columnsOrder: string[];
@@ -1,9 +1,9 @@
1
1
  import React, { useCallback } from 'react';
2
2
  import classNames from 'classnames';
3
+ import uriHelper from '../utils/uri-helper';
3
4
  import { TableColumnManagement } from './table-column-management';
4
5
  import { useLocation, useNavigate } from 'react-router-dom';
5
6
  import { ColumnOrder } from './column-order/column-order';
6
- import uriHelper from '../utils/uri-helper';
7
7
  export const Table = (props) => {
8
8
  var _a;
9
9
  const { nowrap, attributes, header = [], headerArgs = [], body, children, className, columnManagement, disabled } = props;
@@ -45,7 +45,7 @@ export const Table = (props) => {
45
45
  React.createElement("tr", null, headers.map((head, index) => {
46
46
  var _a, _b, _c, _d;
47
47
  return (React.createElement("th", { key: `th-${index}`, scope: "col", ...{ ...(_a = attributes === null || attributes === void 0 ? void 0 : attributes.thead) === null || _a === void 0 ? void 0 : _a.th, ...(_b = head.attributes) === null || _b === void 0 ? void 0 : _b.th }, className: handleClass((_c = attributes === null || attributes === void 0 ? void 0 : attributes.thead) === null || _c === void 0 ? void 0 : _c.th, (_d = head.attributes) === null || _d === void 0 ? void 0 : _d.th) }, head.allowOrder
48
- ? React.createElement(ColumnOrder, { id: head.id, label: head.title, active: orderId === head.id, order: orderId === head.id ? orderType : 'desc', onChange: callbackChangeOrder, disabled: disabled || false })
48
+ ? React.createElement(ColumnOrder, { id: head.id, label: head.title, active: orderId === head.id, order: orderId === head.id ? orderType : 'desc', onChange: callbackChangeOrder, disabled: disabled || false, onOrderClick: head.onOrderClick })
49
49
  : head.title));
50
50
  })))),
51
51
  !!body && !children && (React.createElement("tbody", null, body.map(({ attributes: attrs = null, ...item }, index) => (React.createElement("tr", { key: `tr-${index}` }, Object.keys(item).map((key, idx) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dilicorp/ui",
3
- "version": "0.2.36",
3
+ "version": "0.2.37",
4
4
  "description": "A simple UI design for Dilicorp",
5
5
  "repository": {
6
6
  "type": "git",