@dgshahr/ui-kit 0.0.90 → 0.0.92

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.
@@ -0,0 +1,14 @@
1
+ export type RangeValueType = number | number[];
2
+ export interface RangeInputProps<T extends RangeValueType> {
3
+ value: T;
4
+ onChange: (value: T) => void;
5
+ min: number;
6
+ max: number;
7
+ step?: number;
8
+ disabled?: boolean;
9
+ showTooltip?: boolean;
10
+ startTitle?: string;
11
+ endTitle?: string;
12
+ wrapperClassName?: string;
13
+ }
14
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Form/RangeInput/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC;AAE/C,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,cAAc;IACvD,KAAK,EAAE,CAAC,CAAC;IACT,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B"}
@@ -0,0 +1,13 @@
1
+ import { FC, ReactNode } from 'react';
2
+ import { ColumnsType } from './types';
3
+ interface TabelCellProps {
4
+ children: ReactNode;
5
+ className?: string;
6
+ type: 'td' | 'th';
7
+ sticky?: ColumnsType['sticky'];
8
+ addBorderToSticky?: boolean;
9
+ stuckToTop?: boolean;
10
+ }
11
+ declare const TabelCell: FC<TabelCellProps>;
12
+ export default TabelCell;
13
+ //# sourceMappingURL=Cell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Cell.d.ts","sourceRoot":"","sources":["../../src/components/Table/Cell.tsx"],"names":[],"mappings":"AACA,OAAO,EAAqB,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAG3C,UAAU,cAAc;IACtB,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,MAAM,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC/B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,QAAA,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,CAgCjC,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../src/components/Table/Header.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAIhD,QAAA,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAqC1D,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../src/components/Table/Header.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAGhD,QAAA,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CA8B1D,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -1,11 +1,7 @@
1
- import { ColumnsType, TableProps, UnknownRecord } from './types';
2
- interface TBodyProps<T extends UnknownRecord> {
3
- columns: ColumnsType<T>[];
4
- data: T[];
5
- rowSelection: TableProps<T>['rowSelection'];
6
- rowKey: TableProps<T>['rowKey'];
1
+ import { FC } from 'react';
2
+ interface TBodyProps {
7
3
  havePagination: boolean;
8
4
  }
9
- declare function TBody<T extends UnknownRecord>(props: Readonly<TBodyProps<T>>): import("react/jsx-runtime").JSX.Element;
5
+ declare const TBody: FC<TBodyProps>;
10
6
  export default TBody;
11
7
  //# sourceMappingURL=TBody.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TBody.d.ts","sourceRoot":"","sources":["../../src/components/Table/TBody.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAUtE,UAAU,UAAU,CAAC,CAAC,SAAS,aAAa;IAC1C,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1B,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;IAC5C,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IAChC,cAAc,EAAE,OAAO,CAAC;CACzB;AA8CD,iBAAS,KAAK,CAAC,CAAC,SAAS,aAAa,EAAE,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,2CAuDrE;AAED,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"TBody.d.ts","sourceRoot":"","sources":["../../src/components/Table/TBody.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAYhC,UAAU,UAAU;IAClB,cAAc,EAAE,OAAO,CAAC;CACzB;AA8CD,QAAA,MAAM,KAAK,EAAE,EAAE,CAAC,UAAU,CA4DzB,CAAC;AAEF,eAAe,KAAK,CAAC"}
@@ -1,11 +1,7 @@
1
- import { ColumnsType, TableProps, UnknownRecord } from './types';
2
- interface THeadProps<T extends UnknownRecord> {
3
- columns: ColumnsType<T>[];
1
+ import { FC } from 'react';
2
+ interface THeadProps {
4
3
  haveHeader: boolean;
5
- data: T[];
6
- rowSelection: TableProps<T>['rowSelection'];
7
- rowKey: TableProps<T>['rowKey'];
8
4
  }
9
- declare function THead<T extends UnknownRecord>(props: Readonly<THeadProps<T>>): import("react/jsx-runtime").JSX.Element;
5
+ declare const THead: FC<THeadProps>;
10
6
  export default THead;
11
7
  //# sourceMappingURL=THead.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"THead.d.ts","sourceRoot":"","sources":["../../src/components/Table/THead.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAWtE,UAAU,UAAU,CAAC,CAAC,SAAS,aAAa;IAC1C,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC;IACpB,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;IAC5C,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;CACjC;AA6BD,iBAAS,KAAK,CAAC,CAAC,SAAS,aAAa,EAAE,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,2CAuFrE;AAED,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"THead.d.ts","sourceRoot":"","sources":["../../src/components/Table/THead.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAiBhC,UAAU,UAAU;IAClB,UAAU,EAAE,OAAO,CAAC;CACrB;AA6CD,QAAA,MAAM,KAAK,EAAE,EAAE,CAAC,UAAU,CAkFzB,CAAC;AAEF,eAAe,KAAK,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { ReactNode } from 'react';
2
+ import { TableProps, UnknownRecord } from './types';
3
+ interface ContextType<T extends UnknownRecord> extends TableProps<T> {
4
+ observer: IntersectionObserver | null;
5
+ }
6
+ export declare const tableContext: import('react').Context<ContextType<UnknownRecord>>;
7
+ interface ProviderProps<T extends UnknownRecord> extends TableProps<T> {
8
+ children: ReactNode;
9
+ }
10
+ export declare function TableContextProvider<T extends UnknownRecord>(props: Readonly<ProviderProps<T>>): import("react/jsx-runtime").JSX.Element;
11
+ export declare const useTableContext: () => ContextType<UnknownRecord>;
12
+ export {};
13
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/components/Table/context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACvF,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEzD,UAAU,WAAW,CAAC,CAAC,SAAS,aAAa,CAAE,SAAQ,UAAU,CAAC,CAAC,CAAC;IAClE,QAAQ,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACvC;AAED,eAAO,MAAM,YAAY,qDAKvB,CAAC;AAEH,UAAU,aAAa,CAAC,CAAC,SAAS,aAAa,CAAE,SAAQ,UAAU,CAAC,CAAC,CAAC;IACpE,QAAQ,EAAE,SAAS,CAAC;CACrB;AAYD,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,aAAa,EAAE,KAAK,EAAE,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,2CA4C9F;AAED,eAAO,MAAM,eAAe,kCAAiC,CAAC"}
@@ -1 +1 @@
1
- "use strict";require('../assets/styles.css');const t=require("react/jsx-runtime"),a=require("../clsx-C11secjj.cjs"),S=require("../Badge/index.cjs"),A=require("../Button/index.cjs"),q=require("../Form/Checkbox/index.cjs"),w=require("../Tooltip/index.cjs"),T=require("../IconArrowDown2-C1dLVveG.cjs"),R=require("../IconInfoCircleOutline-0ef3qbeI.cjs"),f=require("../Divider/index.cjs"),B=require("../Pagination/index.cjs");;/* empty css */const I=e=>{const{title:i,actionButton:r,showTotal:n,total:l,className:u}=e;return t.jsxs("div",{className:a.clsx("dgs-ui-kit-p-4 dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-space-x-1 dgs-ui-kit-space-x-reverse dgs-ui-kit-border-b dgs-ui-kit-border-solid dgs-ui-kit-border-gray-200",u),children:[t.jsx("div",{className:"dgs-ui-kit-font-h4-bold dgs-ui-kit-text-gray-700 dgs-ui-kit-w-full",children:i}),n&&t.jsxs("div",{className:"dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-shrink-0",children:[t.jsx("span",{className:"dgs-ui-kit-font-p2-regular dgs-ui-kit-text-gray-700 dgs-ui-kit-ml-1",children:"تعداد نتایج:"}),t.jsx(S,{value:l??0,valueType:"number",size:"large",color:"primary",type:"twoTone"})]}),r&&t.jsx(A,{className:a.clsx("dgs-ui-kit-shrink-0",r.className),...r,children:r.children??null})]})};function k(e){switch(e){case"center":return"dgs-ui-kit-justify-center";case"start":return"dgs-ui-kit-justify-start";case"end":return"dgs-ui-kit-justify-end";default:return}}function N(e,i){return e||(Array.isArray(i)?i[i.length-1]:i)}function v(e){return!!(e&&e.selectedRowKeys.length>1||typeof e?.onSelectRow=="function")}function C(e,i){return t.jsx("div",{className:a.clsx("dgs-ui-kit-w-full dgs-ui-kit-flex dgs-ui-kit-items-center",k(e??"center")),children:t.jsx(q,{...i})})}function g(e,i){if(e)return a.clsx("dgs-ui-kit-sticky dgs-ui-kit-translate-y-[1px] dgs-ui-kit-z-10",{"dgs-ui-kit-right-0":e==="right","dgs-ui-kit-left-0":e==="left",'after:dgs-ui-kit-content-[""] after:dgs-ui-kit-absolute after:dgs-ui-kit-bottom-0 after:dgs-ui-kit-right-0 after:dgs-ui-kit-w-full after:dgs-ui-kit-border-b after:dgs-ui-kit-border-solid after:dgs-ui-kit-border-gray-200':i})}const j="dgs-ui-kit-p-4 dgs-ui-kit-pl-0 dgs-ui-kit-bg-white dgs-ui-kit-border-b dgs-ui-kit-border-solid dgs-ui-kit-border-gray-200";function K(e,i){return e?Array.isArray(e)?e.reduce((r,n)=>r?.[n]??null,i):i[e]:null}function D(e,i,r){if(typeof e.render=="function")return e.render(i,r);const n=K(e.dataIndex,i);if(e.ellipsis){const l=t.jsx("div",{className:"!dgs-ui-kit-truncate",children:n});return typeof e.ellipsis!="boolean"&&e.ellipsis.hideTooltip?l:t.jsx(w,{wrapperClassName:"dgs-ui-kit-w-full",content:n,children:l})}return n}function L(e){const{data:i,columns:r,rowKey:n,rowSelection:l,havePagination:u}=e;return t.jsx("tbody",{children:i.map((s,c)=>t.jsxs("tr",{children:[v(l)&&t.jsx("td",{className:a.clsx(j,l?.className,{"dgs-ui-kit-border-b-0 dgs-ui-kit-rounded-br-2xl":!u&&c===i.length-1},g(l?.sticky),l?.className),children:C(l?.align,{onChange:d=>l?.onSelectRow(d,s[n]),checked:!!l?.selectedRowKeys.find(d=>d===s[n])})}),r.map(d=>t.jsx("td",{className:a.clsx(j,{"dgs-ui-kit-border-b-0 first:dgs-ui-kit-rounded-br-2xl last:dgs-ui-kit-rounded-bl-2xl":!u&&c===i.length-1},g(d?.sticky),d.className),children:t.jsx("div",{className:a.clsx("dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-ml-2",k(d.align)),children:D(d,s,c)})},`${s[n]}-${N(d.key,d.dataIndex)}`))]},s[n]))})}const E=e=>t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 24 24",...e,children:t.jsx("path",{fill:"currentColor",d:"M19.53 16.03a.75.75 0 0 1-.976.073l-.084-.073L12 9.561l-6.47 6.47a.75.75 0 0 1-.976.072l-.084-.073a.75.75 0 0 1-.073-.976l.073-.084 7-7a.75.75 0 0 1 .976-.073l.084.073 7 7a.75.75 0 0 1 0 1.06"})});function H(e,i){if(e.length!==i.length)return!1;e.sort(),i.sort();for(let r=0;r<e.length;r++)if(e[r]!==i[r])return!1;return!0}const o=16,p="dgs-ui-kit-p-4 dgs-ui-kit-pl-0 dgs-ui-kit-text-gray-500 dgs-ui-kit-bg-gray-50 dgs-ui-kit-border-b dgs-ui-kit-border-solid dgs-ui-kit-border-gray-200",y="!dgs-ui-kit-h-8 dgs-ui-kit-shrink-0";function b(e,i){return t.jsxs("div",{className:"dgs-ui-kit-font-p1-medium dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-space-x-1 dgs-ui-kit-space-x-reverse",children:[t.jsx("span",{children:e}),i&&(i.anchorIcon??t.jsx(R.IconInfoCircleOutline,{width:o,height:o}))]})}function m(e,i){return e.map(r=>r[i])}function _(e){const{columns:i,haveHeader:r,rowSelection:n,rowKey:l,data:u}=e;return t.jsx("thead",{children:t.jsxs("tr",{children:[v(n)&&t.jsx("th",{className:a.clsx(p,{"dgs-ui-kit-rounded-tr-2xl":!r},g(n?.sticky,!0),n?.className),children:t.jsxs("div",{className:"dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-justify-between",children:[C(n?.align,{checked:n.selectedRowKeys.length>0,isIndeterminate:!H(m(u,l),n.selectedRowKeys),onChange:s=>n?.onSelectRow(s,s.target.checked?m(u,l):[])}),t.jsx(f,{type:"vertical",className:y})]})}),i.map((s,c)=>t.jsx("th",{className:a.clsx(p,{"first:dgs-ui-kit-rounded-tr-2xl last:dgs-ui-kit-rounded-tl-2xl":!r},g(s?.sticky,!0),s.className),children:t.jsxs("div",{className:"dgs-ui-kit-flex dgs-ui-kit-justify-between dgs-ui-kit-items-center",children:[t.jsxs("div",{className:a.clsx("dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-space-x-2 dgs-ui-kit-space-x-reverse dgs-ui-kit-w-full dgs-ui-kit-ml-2",k(s.align)),children:[s.tooltip?.content?t.jsx(w,{...s.tooltip,children:b(s.title,s.tooltip)}):b(s.title),typeof s.onSort=="function"&&t.jsxs("div",{className:"dgs-ui-kit-flex dgs-ui-kit-flex-col",children:[t.jsx("button",{onClick:()=>s.onSort("ascend"),children:t.jsx(E,{width:o,height:o})}),t.jsx("button",{onClick:()=>s.onSort("descend"),children:t.jsx(T.IconArrowDown2,{width:o,height:o})})]})]}),c!==i.length-1&&t.jsx(f,{type:"vertical",className:y})]})},N(s.key,s.dataIndex)))]})})}function O(e){const{header:i,wrapperClassName:r,className:n,columns:l,rowSelection:u,data:s,rowKey:c,pagination:d}=e,h=(i&&Object.values(i).length>0)??!1,x=!!(d?.totalCount&&d?.pageSize);return t.jsxs("div",{className:a.clsx("dgs-ui-kit-relative dgs-ui-kit-bg-white dgs-ui-kit-border dgs-ui-kit-border-gray-200 dgs-ui-kit-border-solid dgs-ui-kit-rounded-2xl",r),children:[h&&t.jsx(I,{...i,total:d?.totalCount??s.length}),t.jsxs("table",{className:n,children:[t.jsx(_,{columns:l,haveHeader:h,rowKey:c,rowSelection:u,data:s}),t.jsx(L,{columns:l,data:s,rowKey:c,rowSelection:u,havePagination:x})]}),x&&t.jsx(B,{className:a.clsx("dgs-ui-kit-py-4 !dgs-ui-kit-px-0",d?.className),...d})]})}module.exports=O;
1
+ "use client";"use strict";require('../assets/styles.css');const i=require("react/jsx-runtime"),c=require("../clsx-C11secjj.cjs"),g=require("react"),_=require("../Badge/index.cjs"),B=require("../Form/Checkbox/index.cjs"),S=require("../Tooltip/index.cjs"),I=require("../IconArrowDown2-C1dLVveG.cjs"),K=require("../IconInfoCircleOutline-0ef3qbeI.cjs"),y=require("../Divider/index.cjs"),L=require("../Pagination/index.cjs");;/* empty css */const T=g.createContext({observer:null,columns:[],data:[],rowKey:""}),A="after:!dgs-ui-kit-shadow-[rgba(0,0,0,0.06)]";function p(e){e.classList.add(A)}function H(e){e.classList.remove(A)}function D(e){const{children:t,...n}=e,{columns:l,rowSelection:r}=n,[d,u]=g.useState(null);return g.useEffect(()=>{let s=l.some(a=>!!a.sticky);return s||(s=!!r?.sticky),s&&u(new IntersectionObserver(a=>{let o=!1;for(const k of a)if(k.boundingClientRect.right>k.intersectionRect.right){document.querySelectorAll("#sticky-cell-right").forEach(p),o=!0;break}else if(k.boundingClientRect.left<k.intersectionRect.left){document.querySelectorAll("#sticky-cell-left").forEach(p),o=!0;break}o||document.querySelectorAll('[id^="sticky-cell-"]').forEach(H)},{threshold:1,rootMargin:"0% 100% 0% 100%"})),()=>{d&&d.disconnect()}},[]),i.jsx(T.Provider,{value:{observer:d,...n},children:t})}const h=()=>g.useContext(T),O=e=>{const{title:t,extraElement:n,showTotal:l,total:r,className:d}=e;return i.jsxs("div",{className:c.clsx("dgs-ui-kit-p-4 dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-space-x-1 dgs-ui-kit-space-x-reverse dgs-ui-kit-border-b dgs-ui-kit-border-solid dgs-ui-kit-border-gray-200",d),children:[i.jsx("div",{className:"dgs-ui-kit-font-h4-bold dgs-ui-kit-text-gray-700 dgs-ui-kit-w-full",children:t}),l&&i.jsxs("div",{className:"dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-shrink-0",children:[i.jsx("span",{className:"dgs-ui-kit-font-p2-regular dgs-ui-kit-text-gray-700 dgs-ui-kit-ml-1",children:"تعداد نتایج:"}),i.jsx(_,{value:r??0,valueType:"number",size:"large",color:"primary",type:"twoTone"})]}),n]})};function b(e){switch(e){case"center":return"dgs-ui-kit-justify-center";case"start":return"dgs-ui-kit-justify-start";case"end":return"dgs-ui-kit-justify-end";default:return}}function R(e,t){return e||(Array.isArray(t)?t[t.length-1]:t)}function E(e){return!!(e&&e.selectedRowKeys.length>1||typeof e?.onSelectRow=="function")}function q(e,t){return i.jsx("div",{className:c.clsx("dgs-ui-kit-w-full dgs-ui-kit-flex dgs-ui-kit-items-centerd",b(e??"center")),children:i.jsx(B,{...t})})}function P(e,t){if(e)return c.clsx("dgs-ui-kit-sticky dgs-ui-kit-z-10",'after:dgs-ui-kit-content[""] after:dgs-ui-kit-absolute after:dgs-ui-kit-top-0 after:dgs-ui-kit-h-full after:dgs-ui-kit-w-[30px] after:dgs-ui-kit-transition-shadow',{" dgs-ui-kit-right-[-1px] dgs-ui-kit-pr-[calc(1em+1px)] after:dgs-ui-kit-left-0 after:-dgs-ui-kit-translate-x-full after:dgs-ui-kit-shadow-[inset_-10px_0_8px_-8px] after:dgs-ui-kit-shadow-transparent":e==="right"," dgs-ui-kit-left-[-1px] dgs-ui-kit-pl-[calc(1em+1px)] after:dgs-ui-kit-right-0 after:dgs-ui-kit-translate-x-full after:dgs-ui-kit-shadow-[inset_10px_0_8px_-8px] after:dgs-ui-kit-shadow-transparent":e==="left",'before:dgs-ui-kit-content-[""] before:dgs-ui-kit-absolute before:dgs-ui-kit-top-0 before:dgs-ui-kit-right-0 before:dgs-ui-kit-w-full before:dgs-ui-kit-border-t before:md:dgs-ui-kit-border-t-0 before:dgs-ui-kit-border-solid before:dgs-ui-kit-border-gray-200':t})}const f=e=>{const{children:t,className:n,type:l,sticky:r,addBorderToSticky:d,stuckToTop:u}=e,s=g.useRef(null),a=l,{observer:o}=h();return g.useEffect(()=>{if(!(!s.current||!o))return r&&o.observe(s.current),()=>{!s.current||!o||r&&o.unobserve(s.current)}},[s,o]),i.jsx(a,{ref:s,className:c.clsx(n,P(r,d),{'dgs-ui-kit-border-b-0 before:dgs-ui-kit-content[""] before:dgs-ui-kit-absolute before:dgs-ui-kit-bottom-0 before:dgs-ui-kit-left-0 before:dgs-ui-kit-w-full before:dgs-ui-kit-border-b before:dgs-ui-kit-border-solid before:dgs-ui-kit-border-gray-200':u,"dgs-ui-kit-top-0 dgs-ui-kit-z-20":u&&r,"dgs-ui-kit-sticky dgs-ui-kit-top-0 dgs-ui-kit-z-10":u&&!r}),id:r&&`sticky-cell-${r}`,children:t})},m="dgs-ui-kit-p-4 dgs-ui-kit-pl-0 dgs-ui-kit-bg-white dgs-ui-kit-border-b dgs-ui-kit-border-solid dgs-ui-kit-border-gray-200";function z(e,t){return e?Array.isArray(e)?e.reduce((n,l)=>n?.[l]??null,t):t[e]:null}function $(e,t,n){if(typeof e.render=="function")return e.render(t,n);const l=z(e.dataIndex,t);if(e.ellipsis){const r=i.jsx("div",{className:"!dgs-ui-kit-truncate",children:l});return typeof e.ellipsis!="boolean"&&e.ellipsis.hideTooltip?r:i.jsx(S,{wrapperClassName:"dgs-ui-kit-w-full",content:l,children:r})}return l}const F=e=>{const{havePagination:t}=e,{columns:n,data:l,rowKey:r,rowSelection:d,stickyTableHeader:u}=h();return i.jsx("tbody",{children:l.map((s,a)=>i.jsxs("tr",{children:[E(d)&&i.jsx(f,{type:"td",className:c.clsx(m,d?.className,{"dgs-ui-kit-border-b-0 dgs-ui-kit-rounded-br-2xl":!t&&a===l.length-1},d?.className),sticky:d?.sticky,addBorderToSticky:u?a!==0:!0,children:q(d?.align,{onChange:o=>d?.onSelectRow(o,s[r]),checked:!!d?.selectedRowKeys.find(o=>o===s[r])})}),n.map(o=>i.jsx(f,{type:"td",className:c.clsx(m,{"dgs-ui-kit-border-b-0 first:dgs-ui-kit-rounded-br-2xl last:dgs-ui-kit-rounded-bl-2xl":!t&&a===l.length-1},o.className),sticky:o.sticky,addBorderToSticky:u?a!==0:!0,children:i.jsx("div",{className:c.clsx("dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-ml-2",b(o.align)),children:$(o,s,a)})},`${s[r]}-${R(o.key,o.dataIndex)}`))]},s[r]))})},M=e=>i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 24 24",...e,children:i.jsx("path",{fill:"currentColor",d:"M19.53 16.03a.75.75 0 0 1-.976.073l-.084-.073L12 9.561l-6.47 6.47a.75.75 0 0 1-.976.072l-.084-.073a.75.75 0 0 1-.073-.976l.073-.084 7-7a.75.75 0 0 1 .976-.073l.084.073 7 7a.75.75 0 0 1 0 1.06"})});function U(e,t){if(e.length!==t.length)return!1;e.sort(),t.sort();for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}const x=16,j="dgs-ui-kit-p-4 dgs-ui-kit-pl-0 dgs-ui-kit-text-gray-500 dgs-ui-kit-bg-gray-50 dgs-ui-kit-border-b dgs-ui-kit-border-solid dgs-ui-kit-border-gray-200",v="!dgs-ui-kit-h-8 dgs-ui-kit-shrink-0";function w(e,t){const n=e==="ascend"?M:I.IconArrowDown2;return i.jsx("button",{onClick:()=>t.onSort(e),children:i.jsx(n,{width:x,height:x,className:t.active===e?"dgs-ui-kit-text-primary-500":"dgs-ui-kit-text-gray-500"})})}function C(e,t){return i.jsxs("div",{className:"dgs-ui-kit-font-p1-medium dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-space-x-1 dgs-ui-kit-space-x-reverse",children:[i.jsx("span",{children:e}),t&&(t.anchorIcon??i.jsx(K.IconInfoCircleOutline,{width:x,height:x}))]})}function N(e,t){return e.map(n=>n[t])}const W=e=>{const{haveHeader:t}=e,{columns:n,rowKey:l,rowSelection:r,data:d,stickyTableHeader:u}=h();return i.jsx("thead",{children:i.jsxs("tr",{children:[E(r)&&i.jsx(f,{type:"th",className:c.clsx(j,{"dgs-ui-kit-rounded-tr-2xl":!t},r?.className),sticky:r?.sticky,stuckToTop:u,children:i.jsxs("div",{className:"dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-justify-between",children:[q(r?.align,{checked:r.selectedRowKeys.length>0,isIndeterminate:!U(N(d,l),r.selectedRowKeys),onChange:s=>r?.onSelectRow(s,s.target.checked?N(d,l):[])}),i.jsx(y,{type:"vertical",className:v})]})}),n.map((s,a)=>i.jsx(f,{type:"th",sticky:s.sticky,className:c.clsx(j,{"first:dgs-ui-kit-rounded-tr-2xl last:dgs-ui-kit-rounded-tl-2xl":!t},s.className),stuckToTop:u,children:i.jsxs("div",{className:"dgs-ui-kit-flex dgs-ui-kit-justify-between dgs-ui-kit-items-center",children:[i.jsxs("div",{className:c.clsx("dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-space-x-2 dgs-ui-kit-space-x-reverse dgs-ui-kit-w-full dgs-ui-kit-ml-2",b(s.align)),children:[s.tooltip?.content?i.jsx(S,{...s.tooltip,children:C(s.title,s.tooltip)}):C(s.title),typeof s.sort?.onSort=="function"&&i.jsxs("div",{className:"dgs-ui-kit-flex dgs-ui-kit-flex-col",children:[w("ascend",s.sort),w("descend",s.sort)]})]}),a!==n.length-1&&i.jsx(y,{type:"vertical",className:v})]})},R(s.key,s.dataIndex)))]})})};function Z(e){const{header:t,wrapperClassName:n,className:l,data:r,pagination:d}=e,u=(t&&Object.values(t).length>0)??!1,s=!!(d?.totalCount&&d?.pageSize);return i.jsxs("div",{className:c.clsx("dgs-ui-kit-relative dgs-ui-kit-bg-white dgs-ui-kit-border dgs-ui-kit-border-gray-200 dgs-ui-kit-border-solid dgs-ui-kit-rounded-2xl ",n),children:[u&&i.jsx(O,{...t,total:d?.totalCount??r.length}),i.jsx("table",{className:l,children:i.jsxs(D,{...e,children:[i.jsx(W,{haveHeader:u}),i.jsx(F,{havePagination:s})]})}),s&&i.jsx(L,{className:c.clsx("dgs-ui-kit-py-4 !dgs-ui-kit-px-0",d?.className),...d})]})}module.exports=Z;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/Table/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGzD,OAAO,kBAAkB,CAAC;AAE1B,iBAAS,KAAK,CAAC,CAAC,SAAS,aAAa,EAAE,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,2CA4CrE;AAED,eAAe,KAAK,CAAC;AACrB,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/Table/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGzD,OAAO,kBAAkB,CAAC;AAE1B,iBAAS,KAAK,CAAC,CAAC,SAAS,aAAa,EAAE,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,2CAiCrE;AAED,eAAe,KAAK,CAAC;AACrB,cAAc,SAAS,CAAC"}