@dgshahr/ui-kit 0.0.89 → 0.0.90
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.
- package/dist/FieldBottomInfo-CE1uBAqq.cjs +1 -0
- package/dist/FieldBottomInfo-CJ8_Kr25.js +49 -0
- package/dist/Form/FileUploader/index.cjs +1 -1
- package/dist/Form/FileUploader/index.d.ts.map +1 -1
- package/dist/Form/FileUploader/index.mjs +80 -80
- package/dist/Form/FileUploader/types.d.ts +2 -1
- package/dist/Form/FileUploader/types.d.ts.map +1 -1
- package/dist/Form/Input/index.cjs +1 -1
- package/dist/Form/Input/index.mjs +1 -1
- package/dist/Form/OtpInput/index.cjs +1 -1
- package/dist/Form/OtpInput/index.mjs +2 -2
- package/dist/Form/Select/Options.d.ts.map +1 -1
- package/dist/Form/Select/index.cjs +1 -1
- package/dist/Form/Select/index.mjs +25 -21
- package/dist/Form/Textarea/index.cjs +1 -1
- package/dist/Form/Textarea/index.mjs +1 -1
- package/dist/IconInfoCircleOutline-0ef3qbeI.cjs +1 -0
- package/dist/IconInfoCircleOutline-aO1F3qnG.js +35 -0
- package/dist/Table/Header.d.ts +7 -0
- package/dist/Table/Header.d.ts.map +1 -0
- package/dist/Table/TBody.d.ts +11 -0
- package/dist/Table/TBody.d.ts.map +1 -0
- package/dist/Table/THead.d.ts +11 -0
- package/dist/Table/THead.d.ts.map +1 -0
- package/dist/Table/index.cjs +1 -0
- package/dist/Table/index.d.ts +5 -0
- package/dist/Table/index.d.ts.map +1 -0
- package/dist/Table/index.mjs +329 -0
- package/dist/Table/types.d.ts +54 -0
- package/dist/Table/types.d.ts.map +1 -0
- package/dist/Table/utils.d.ts +8 -0
- package/dist/Table/utils.d.ts.map +1 -0
- package/dist/{TextFieldWrapper-K0g1kAl1.cjs → TextFieldWrapper-CQbBbmlX.cjs} +1 -1
- package/dist/{TextFieldWrapper-44165bs_.js → TextFieldWrapper-CQgQsfMJ.js} +1 -1
- package/dist/Tooltip/index.cjs +1 -1
- package/dist/Tooltip/index.d.ts +1 -0
- package/dist/Tooltip/index.d.ts.map +1 -1
- package/dist/Tooltip/index.mjs +36 -27
- package/dist/assets/styles.css +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +12 -10
- package/package.json +6 -1
- package/dist/FieldBottomInfo-7YeZbp0-.cjs +0 -1
- package/dist/FieldBottomInfo-B1n-gK3T.js +0 -78
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { jsxs as w, jsx as u } from "react/jsx-runtime";
|
|
3
3
|
import { c as h } from "../../clsx-OuTLNxxd.js";
|
|
4
4
|
import { useRef as I, useEffect as F } from "react";
|
|
5
|
-
import { F as T } from "../../FieldBottomInfo-
|
|
6
|
-
import { F as j } from "../../TextFieldWrapper-
|
|
5
|
+
import { F as T } from "../../FieldBottomInfo-CJ8_Kr25.js";
|
|
6
|
+
import { F as j } from "../../TextFieldWrapper-CQgQsfMJ.js";
|
|
7
7
|
import A from "../Input/index.mjs";
|
|
8
8
|
import '../../assets/styles.css';/* empty css */
|
|
9
9
|
const B = (l) => l.replace(/[۰-۹]/g, (i) => String("۰۱۲۳۴۵۶۷۸۹".indexOf(i))), U = (l) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Options.d.ts","sourceRoot":"","sources":["../../../src/components/Form/Select/Options.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAgD,MAAM,SAAS,CAAC;AAOzF,QAAA,MAAM,OAAO,GAAI,CAAC,EAAG,OAAO,WAAW,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"Options.d.ts","sourceRoot":"","sources":["../../../src/components/Form/Select/Options.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAgD,MAAM,SAAS,CAAC;AAOzF,QAAA,MAAM,OAAO,GAAI,CAAC,EAAG,OAAO,WAAW,CAAC,CAAC,CAAC,4CA2LzC,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require('../../assets/styles.css');const r=require("react/jsx-runtime"),d=require("../../clsx-C11secjj.cjs"),o=require("react"),L=require("../../IconSearch-BeVs-gUu.cjs"),W=require("../Checkbox/index.cjs"),R=require("../../Button/index.cjs"),_=require("../Input/index.cjs"),q=require("../../PickerWrapper-BuAOe-BZ.cjs");;/* empty css */function H(i,s=100){if(!i)return;if(window.innerWidth>768){i.focus(),i.click();return}const t=document.createElement("input");t.style.position="absolute",t.style.top=`${i.offsetTop+7}px`,t.style.left=`${i.offsetLeft}px`,t.style.height="0px",t.style.opacity="0px",document.body.appendChild(t),t.focus(),setTimeout(()=>{i.focus(),i.click(),document.body.removeChild(t)},s)}function z({label:i,isMultiple:s,isActive:t,disabled:u}){return s?r.jsx(W,{checked:t,label:i,readOnly:!0,disabled:u}):i}const D=i=>{const{option:s,onClick:t,value:u,mode:n,optionCellClassName:g,optionCell:a}=i;function c(){return Array.isArray(u)?u.includes(s.value):s.value===u}return r.jsx("button",{type:"button",onClick:t,className:d.clsx("dgs-ui-kit-w-full dgs-ui-kit-text-start dgs-ui-kit-px-3 disabled:dgs-ui-kit-cursor-not-allowed dgs-ui-kit-py-3 dgs-ui-kit-font-p1-regular disabled:dgs-ui-kit-bg-gray-50 dgs-ui-kit-transition",c()?"dgs-ui-kit-bg-primary-50 dgs-ui-kit-text-primary-500":"dgs-ui-kit-text-gray-700 disabled:dgs-ui-kit-text-gray-400",g),disabled:s.disabled,children:a?a(s,c()):z({label:s.label,isMultiple:n==="multiple",isActive:c(),disabled:s.disabled??!1})})},T=o.memo(D),K=20,U=i=>{const{options:s,mode:t="single",afterOptions:u,beforOptions:n,onChange:g,searchable:a=!0,separateSelectedOptions:c=!0,optionsTitle:
|
|
1
|
+
"use strict";require('../../assets/styles.css');const r=require("react/jsx-runtime"),d=require("../../clsx-C11secjj.cjs"),o=require("react"),L=require("../../IconSearch-BeVs-gUu.cjs"),W=require("../Checkbox/index.cjs"),R=require("../../Button/index.cjs"),_=require("../Input/index.cjs"),q=require("../../PickerWrapper-BuAOe-BZ.cjs");;/* empty css */function H(i,s=100){if(!i)return;if(window.innerWidth>768){i.focus(),i.click();return}const t=document.createElement("input");t.style.position="absolute",t.style.top=`${i.offsetTop+7}px`,t.style.left=`${i.offsetLeft}px`,t.style.height="0px",t.style.opacity="0px",document.body.appendChild(t),t.focus(),setTimeout(()=>{i.focus(),i.click(),document.body.removeChild(t)},s)}function z({label:i,isMultiple:s,isActive:t,disabled:u}){return s?r.jsx(W,{checked:t,label:i,readOnly:!0,disabled:u}):i}const D=i=>{const{option:s,onClick:t,value:u,mode:n,optionCellClassName:g,optionCell:a}=i;function c(){return Array.isArray(u)?u.includes(s.value):s.value===u}return r.jsx("button",{type:"button",onClick:t,className:d.clsx("dgs-ui-kit-w-full dgs-ui-kit-text-start dgs-ui-kit-px-3 disabled:dgs-ui-kit-cursor-not-allowed dgs-ui-kit-py-3 dgs-ui-kit-font-p1-regular disabled:dgs-ui-kit-bg-gray-50 dgs-ui-kit-transition",c()?"dgs-ui-kit-bg-primary-50 dgs-ui-kit-text-primary-500":"dgs-ui-kit-text-gray-700 disabled:dgs-ui-kit-text-gray-400",g),disabled:s.disabled,children:a?a(s,c()):z({label:s.label,isMultiple:n==="multiple",isActive:c(),disabled:s.disabled??!1})})},T=o.memo(D),K=20,U=i=>{const{options:s,mode:t="single",afterOptions:u,beforOptions:n,onChange:g,searchable:a=!0,separateSelectedOptions:c=!0,optionsTitle:w="عنوانها",value:p,optionCellClassName:A,emptyContent:P="نتیجهای یافت نشد !",showClearButtonOnEmpty:M=!0}=i,[m,N]=o.useState(""),[k,$]=o.useState(0),f=o.useRef(null),{toggleWrapperVisibility:B}=q.usePickerWrapperContext(),O=d.clsx("dgs-ui-kit-border-t dgs-ui-kit-border-solid dgs-ui-kit-border-gray-100",(!a&&!n||t==="multiple"&&c)&&"first-of-type:dgs-ui-kit-border-t-0",!!u&&"last-of-type:dgs-ui-kit-border-b");let h;const y=a;typeof a=="boolean"?h=a:h=Object.keys(a).length>0;const b=o.useMemo(()=>{if(!Array.isArray(s))throw new Error("options should be array");return m?s?.filter(e=>e.label.includes(m)):s},[m,s]),C=o.useMemo(()=>t==="multiple"&&c?s?.filter(e=>p.includes(e.value))??[]:[],[s,p]),I=o.useMemo(()=>{let e=b;t==="multiple"&&c&&(e=e?.filter(j=>!p.includes(j.value)));const l=Math.min(k+K,e?.length??0);return e?.slice(k,l)},[b,k,p]),x=f?.current?.children[0]?.clientHeight??50,F=(b?.length??0)*x,v=o.useCallback(()=>{const e=f?.current?.parentElement;if(!e)return;const l=e.scrollTop,j=f.current.offsetTop,S=Math.floor((l-j)/x);$(S>=0?S:0)},[x]);o.useEffect(()=>{const e=f.current?.parentElement;if(e)return e.addEventListener("scroll",v),()=>e.removeEventListener("scroll",v)},[v]),o.useEffect(()=>{h&&H(document.getElementById("search-input"),400)},[]);const E=o.useCallback(e=>{if(typeof g=="function")if(t==="multiple"){const l=[...p??[]];l.includes(e)?l.splice(l.indexOf(e),1):l.push(e),g(l)}else g(e),B()},[p]);return r.jsxs(r.Fragment,{children:[h&&r.jsx(_,{id:"search-input",wrapperClassName:d.clsx("dgs-ui-kit-sticky dgs-ui-kit-top-0 dgs-ui-kit-pt-3 dgs-ui-kit-right-0 dgs-ui-kit-bg-white dgs-ui-kit-z-10 dgs-ui-kit-px-3",n?"dgs-ui-kit-pb-2":"dgs-ui-kit-pb-3",y?.wrapperClassName),placeholder:y?.placeholder??"جستجوی عنوان",value:m,onChange:e=>N(e.currentTarget.value),rightIcon:y?.rightIcon??r.jsx(L.IconSearch,{width:20,height:20}),...typeof a=="object"?a:{}}),n,t==="multiple"&&c&&C.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"dgs-ui-kit-font-p2-regular dgs-ui-kit-text-gray-400 dgs-ui-kit-px-3 dgs-ui-kit-py-2",children:`${w}ی انتخاب شده`}),C.map(e=>r.jsx(T,{onClick:()=>E(e.value),option:e,optionCellClassName:d.clsx(O,A),...i},e.value))]}),r.jsxs(r.Fragment,{children:[t==="multiple"&&c&&r.jsx("p",{className:"dgs-ui-kit-font-p2-regular dgs-ui-kit-text-gray-400 dgs-ui-kit-px-3 dgs-ui-kit-py-2",children:w}),r.jsx("div",{ref:f,className:"dgs-ui-kit-relative",style:{height:F},children:I?.map((e,l)=>r.jsx("div",{className:d.clsx("dgs-ui-kit-absolute dgs-ui-kit-w-full",O),style:{top:`${(k+l)*x}px`},children:r.jsx(T,{onClick:()=>E(e.value),option:e,...i})},e.value))}),!I?.length&&!C.length&&r.jsxs("div",{className:"dgs-ui-kit-text-center dgs-ui-kit-flex dgs-ui-kit-flex-col dgs-ui-kit-items-center dgs-ui-kit-mt-2",children:[r.jsx("p",{className:"dgs-ui-kit-text-gray-500 dgs-ui-kit-font-p3-medium",children:P}),M&&r.jsx(R,{type:"button",className:"dgs-ui-kit-mt-1",variant:"text",size:"small",onClick:()=>N(""),children:"پاک کردن"})]})]}),u]})};function V(i,s){return Array.isArray(i)?s.filter(t=>i.includes(t.value)).map(t=>t.label).join(", "):s.find(t=>t.value===i)?.label??""}const G=i=>{const{searchable:s=!0,value:t,options:u}=i,n={...i};return n.dropdownType==="popover"&&!s&&(n.popoverClassName=d.clsx("dgs-ui-kit-pt-3",n.popoverClassName)),n.dropdownType==="drawer"&&(n.drawerProps={...n.drawerProps,containerClassName:d.clsx(s?"!dgs-ui-kit-pt-0":"!dgs-ui-kit-pt-3",n.drawerProps?.containerClassName)}),n.customInput||(n.inputProps={...n.inputProps,value:V(t,u)}),r.jsx(q.PickerWrapper,{...n,children:r.jsx(U,{...i})})};module.exports=G;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as n, jsxs as
|
|
1
|
+
import { jsx as n, jsxs as y, Fragment as N } from "react/jsx-runtime";
|
|
2
2
|
import { c as d } from "../../clsx-OuTLNxxd.js";
|
|
3
3
|
import { memo as D, useState as $, useRef as F, useMemo as O, useCallback as j, useEffect as B } from "react";
|
|
4
4
|
import { I as K } from "../../IconSearch-aShj2vmu.js";
|
|
@@ -72,24 +72,28 @@ const Y = (i) => {
|
|
|
72
72
|
optionCellClassName: M,
|
|
73
73
|
emptyContent: W = "نتیجهای یافت نشد !",
|
|
74
74
|
showClearButtonOnEmpty: H = !0
|
|
75
|
-
} = i, [m,
|
|
75
|
+
} = i, [m, E] = $(""), [f, z] = $(0), g = F(null), { toggleWrapperVisibility: R } = G(), T = d(
|
|
76
76
|
"dgs-ui-kit-border-t dgs-ui-kit-border-solid dgs-ui-kit-border-gray-100",
|
|
77
77
|
(!a && !r || e === "multiple" && u) && "first-of-type:dgs-ui-kit-border-t-0",
|
|
78
78
|
!!o && "last-of-type:dgs-ui-kit-border-b"
|
|
79
79
|
);
|
|
80
80
|
let k;
|
|
81
|
-
const
|
|
81
|
+
const b = a;
|
|
82
82
|
typeof a == "boolean" ? k = a : k = Object.keys(a).length > 0;
|
|
83
|
-
const v = O(() =>
|
|
83
|
+
const v = O(() => {
|
|
84
|
+
if (!Array.isArray(s))
|
|
85
|
+
throw new Error("options should be array");
|
|
86
|
+
return m ? s?.filter((t) => t.label.includes(m)) : s;
|
|
87
|
+
}, [m, s]), x = O(() => e === "multiple" && u ? s?.filter((t) => c.includes(t.value)) ?? [] : [], [s, c]), S = O(() => {
|
|
84
88
|
let t = v;
|
|
85
|
-
e === "multiple" && u && (t = t?.filter((
|
|
89
|
+
e === "multiple" && u && (t = t?.filter((w) => !c.includes(w.value)));
|
|
86
90
|
const l = Math.min(f + Z, t?.length ?? 0);
|
|
87
91
|
return t?.slice(f, l);
|
|
88
92
|
}, [v, f, c]), h = g?.current?.children[0]?.clientHeight ?? 50, _ = (v?.length ?? 0) * h, C = j(() => {
|
|
89
93
|
const t = g?.current?.parentElement;
|
|
90
94
|
if (!t) return;
|
|
91
|
-
const l = t.scrollTop,
|
|
92
|
-
z(
|
|
95
|
+
const l = t.scrollTop, w = g.current.offsetTop, P = Math.floor((l - w) / h);
|
|
96
|
+
z(P >= 0 ? P : 0);
|
|
93
97
|
}, [h]);
|
|
94
98
|
B(() => {
|
|
95
99
|
const t = g.current?.parentElement;
|
|
@@ -98,7 +102,7 @@ const Y = (i) => {
|
|
|
98
102
|
}, [C]), B(() => {
|
|
99
103
|
k && Q(document.getElementById("search-input"), 400);
|
|
100
104
|
}, []);
|
|
101
|
-
const
|
|
105
|
+
const A = j(
|
|
102
106
|
(t) => {
|
|
103
107
|
if (typeof p == "function")
|
|
104
108
|
if (e === "multiple") {
|
|
@@ -109,7 +113,7 @@ const Y = (i) => {
|
|
|
109
113
|
},
|
|
110
114
|
[c]
|
|
111
115
|
);
|
|
112
|
-
return /* @__PURE__ */
|
|
116
|
+
return /* @__PURE__ */ y(N, { children: [
|
|
113
117
|
k && /* @__PURE__ */ n(
|
|
114
118
|
q,
|
|
115
119
|
{
|
|
@@ -117,12 +121,12 @@ const Y = (i) => {
|
|
|
117
121
|
wrapperClassName: d(
|
|
118
122
|
"dgs-ui-kit-sticky dgs-ui-kit-top-0 dgs-ui-kit-pt-3 dgs-ui-kit-right-0 dgs-ui-kit-bg-white dgs-ui-kit-z-10 dgs-ui-kit-px-3",
|
|
119
123
|
r ? "dgs-ui-kit-pb-2" : "dgs-ui-kit-pb-3",
|
|
120
|
-
|
|
124
|
+
b?.wrapperClassName
|
|
121
125
|
),
|
|
122
|
-
placeholder:
|
|
126
|
+
placeholder: b?.placeholder ?? "جستجوی عنوان",
|
|
123
127
|
value: m,
|
|
124
|
-
onChange: (t) =>
|
|
125
|
-
rightIcon:
|
|
128
|
+
onChange: (t) => E(t.currentTarget.value),
|
|
129
|
+
rightIcon: b?.rightIcon ?? /* @__PURE__ */ n(
|
|
126
130
|
K,
|
|
127
131
|
{
|
|
128
132
|
width: 20,
|
|
@@ -133,20 +137,20 @@ const Y = (i) => {
|
|
|
133
137
|
}
|
|
134
138
|
),
|
|
135
139
|
r,
|
|
136
|
-
e === "multiple" && u && x.length > 0 && /* @__PURE__ */
|
|
140
|
+
e === "multiple" && u && x.length > 0 && /* @__PURE__ */ y(N, { children: [
|
|
137
141
|
/* @__PURE__ */ n("p", { className: "dgs-ui-kit-font-p2-regular dgs-ui-kit-text-gray-400 dgs-ui-kit-px-3 dgs-ui-kit-py-2", children: `${I}ی انتخاب شده` }),
|
|
138
142
|
x.map((t) => /* @__PURE__ */ n(
|
|
139
143
|
L,
|
|
140
144
|
{
|
|
141
|
-
onClick: () =>
|
|
145
|
+
onClick: () => A(t.value),
|
|
142
146
|
option: t,
|
|
143
|
-
optionCellClassName: d(
|
|
147
|
+
optionCellClassName: d(T, M),
|
|
144
148
|
...i
|
|
145
149
|
},
|
|
146
150
|
t.value
|
|
147
151
|
))
|
|
148
152
|
] }),
|
|
149
|
-
/* @__PURE__ */
|
|
153
|
+
/* @__PURE__ */ y(N, { children: [
|
|
150
154
|
e === "multiple" && u && /* @__PURE__ */ n("p", { className: "dgs-ui-kit-font-p2-regular dgs-ui-kit-text-gray-400 dgs-ui-kit-px-3 dgs-ui-kit-py-2", children: I }),
|
|
151
155
|
/* @__PURE__ */ n(
|
|
152
156
|
"div",
|
|
@@ -157,12 +161,12 @@ const Y = (i) => {
|
|
|
157
161
|
children: S?.map((t, l) => /* @__PURE__ */ n(
|
|
158
162
|
"div",
|
|
159
163
|
{
|
|
160
|
-
className: d("dgs-ui-kit-absolute dgs-ui-kit-w-full",
|
|
164
|
+
className: d("dgs-ui-kit-absolute dgs-ui-kit-w-full", T),
|
|
161
165
|
style: { top: `${(f + l) * h}px` },
|
|
162
166
|
children: /* @__PURE__ */ n(
|
|
163
167
|
L,
|
|
164
168
|
{
|
|
165
|
-
onClick: () =>
|
|
169
|
+
onClick: () => A(t.value),
|
|
166
170
|
option: t,
|
|
167
171
|
...i
|
|
168
172
|
}
|
|
@@ -172,7 +176,7 @@ const Y = (i) => {
|
|
|
172
176
|
))
|
|
173
177
|
}
|
|
174
178
|
),
|
|
175
|
-
!S?.length && !x.length && /* @__PURE__ */
|
|
179
|
+
!S?.length && !x.length && /* @__PURE__ */ y("div", { className: "dgs-ui-kit-text-center dgs-ui-kit-flex dgs-ui-kit-flex-col dgs-ui-kit-items-center dgs-ui-kit-mt-2", children: [
|
|
176
180
|
/* @__PURE__ */ n("p", { className: "dgs-ui-kit-text-gray-500 dgs-ui-kit-font-p3-medium", children: W }),
|
|
177
181
|
H && /* @__PURE__ */ n(
|
|
178
182
|
V,
|
|
@@ -181,7 +185,7 @@ const Y = (i) => {
|
|
|
181
185
|
className: "dgs-ui-kit-mt-1",
|
|
182
186
|
variant: "text",
|
|
183
187
|
size: "small",
|
|
184
|
-
onClick: () =>
|
|
188
|
+
onClick: () => E(""),
|
|
185
189
|
children: "پاک کردن"
|
|
186
190
|
}
|
|
187
191
|
)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const s=require("react/jsx-runtime"),o=require("../../clsx-C11secjj.cjs"),u=require("react"),c=require("../../omitObjects-CtiYo0hv.cjs"),d=require("../../TextFieldWrapper-
|
|
1
|
+
"use strict";const s=require("react/jsx-runtime"),o=require("../../clsx-C11secjj.cjs"),u=require("react"),c=require("../../omitObjects-CtiYo0hv.cjs"),d=require("../../TextFieldWrapper-CQbBbmlX.cjs"),g=u.forwardRef(function(e,i){const{dir:t="rtl",placeholderDir:l=t,className:a,...r}=e,n=c.omitObject(r,["labelAddon","labelContent","link","rightIcon","isError","errorMessage","hintMessage","wrapperClassName","showMaxLength","containerClassName"]);return s.jsx(d.TextFieldWrapper,{...e,children:s.jsx("textarea",{...n,ref:i,className:o.clsx("dgs-ui-kit-bg-transparent dgs-ui-kit-leading-normal dgs-ui-kit-w-full dgs-ui-kit-h-full focus:dgs-ui-kit-outline-none ss02 dgs-ui-kit-flex-1 dgs-ui-kit-resize-none",t==="rtl"?"dgs-ui-kit-text-right":"!dgs-ui-kit-text-left",l==="rtl"?"placeholder:dgs-ui-kit-text-right":"placeholder:dgs-ui-kit-text-left",a),rows:r.rows??5})})});module.exports=g;
|
|
@@ -2,7 +2,7 @@ import { jsx as i } from "react/jsx-runtime";
|
|
|
2
2
|
import { c as n } from "../../clsx-OuTLNxxd.js";
|
|
3
3
|
import { forwardRef as d } from "react";
|
|
4
4
|
import { o as g } from "../../omitObjects-CxFrrlkX.js";
|
|
5
|
-
import { T as u } from "../../TextFieldWrapper-
|
|
5
|
+
import { T as u } from "../../TextFieldWrapper-CQgQsfMJ.js";
|
|
6
6
|
const h = d(function(t, s) {
|
|
7
7
|
const { dir: e = "rtl", placeholderDir: o = e, className: a, ...r } = t, l = g(r, [
|
|
8
8
|
"labelAddon",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("react/jsx-runtime"),n=l=>e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 24 24",...l,children:[e.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M12.25 3.75a8.25 8.25 0 1 0 0 16.5 8.25 8.25 0 0 0 0-16.5M2.5 12a9.75 9.75 0 0 1 9.75-9.75A9.75 9.75 0 0 1 22 12c0 5.384-4.365 9.75-9.75 9.75S2.5 17.384 2.5 12",clipRule:"evenodd"}),e.jsx("path",{fill:"currentColor",fillRule:"evenodd",d:"M12.25 7.541a.75.75 0 0 1 .75.75v.063a.75.75 0 0 1-1.5 0v-.063a.75.75 0 0 1 .75-.75m.006 3.103a.75.75 0 0 1 .75.75v4.3a.75.75 0 0 1-1.5 0v-4.3a.75.75 0 0 1 .75-.75",clipRule:"evenodd"})]});exports.IconInfoCircleOutline=n;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
const n = (l) => /* @__PURE__ */ o(
|
|
3
|
+
"svg",
|
|
4
|
+
{
|
|
5
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
6
|
+
width: "1em",
|
|
7
|
+
height: "1em",
|
|
8
|
+
fill: "none",
|
|
9
|
+
viewBox: "0 0 24 24",
|
|
10
|
+
...l,
|
|
11
|
+
children: [
|
|
12
|
+
/* @__PURE__ */ e(
|
|
13
|
+
"path",
|
|
14
|
+
{
|
|
15
|
+
fill: "currentColor",
|
|
16
|
+
fillRule: "evenodd",
|
|
17
|
+
d: "M12.25 3.75a8.25 8.25 0 1 0 0 16.5 8.25 8.25 0 0 0 0-16.5M2.5 12a9.75 9.75 0 0 1 9.75-9.75A9.75 9.75 0 0 1 22 12c0 5.384-4.365 9.75-9.75 9.75S2.5 17.384 2.5 12",
|
|
18
|
+
clipRule: "evenodd"
|
|
19
|
+
}
|
|
20
|
+
),
|
|
21
|
+
/* @__PURE__ */ e(
|
|
22
|
+
"path",
|
|
23
|
+
{
|
|
24
|
+
fill: "currentColor",
|
|
25
|
+
fillRule: "evenodd",
|
|
26
|
+
d: "M12.25 7.541a.75.75 0 0 1 .75.75v.063a.75.75 0 0 1-1.5 0v-.063a.75.75 0 0 1 .75-.75m.006 3.103a.75.75 0 0 1 .75.75v4.3a.75.75 0 0 1-1.5 0v-4.3a.75.75 0 0 1 .75-.75",
|
|
27
|
+
clipRule: "evenodd"
|
|
28
|
+
}
|
|
29
|
+
)
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
export {
|
|
34
|
+
n as I
|
|
35
|
+
};
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
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'];
|
|
7
|
+
havePagination: boolean;
|
|
8
|
+
}
|
|
9
|
+
declare function TBody<T extends UnknownRecord>(props: Readonly<TBodyProps<T>>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export default TBody;
|
|
11
|
+
//# sourceMappingURL=TBody.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ColumnsType, TableProps, UnknownRecord } from './types';
|
|
2
|
+
interface THeadProps<T extends UnknownRecord> {
|
|
3
|
+
columns: ColumnsType<T>[];
|
|
4
|
+
haveHeader: boolean;
|
|
5
|
+
data: T[];
|
|
6
|
+
rowSelection: TableProps<T>['rowSelection'];
|
|
7
|
+
rowKey: TableProps<T>['rowKey'];
|
|
8
|
+
}
|
|
9
|
+
declare function THead<T extends UnknownRecord>(props: Readonly<THeadProps<T>>): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export default THead;
|
|
11
|
+
//# sourceMappingURL=THead.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +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;
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
import { jsxs as u, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { c as a } from "../clsx-OuTLNxxd.js";
|
|
3
|
+
import T from "../Badge/index.mjs";
|
|
4
|
+
import B from "../Button/index.mjs";
|
|
5
|
+
import K from "../Form/Checkbox/index.mjs";
|
|
6
|
+
import v from "../Tooltip/index.mjs";
|
|
7
|
+
import { I as R } from "../IconArrowDown2-7ddwV5IE.js";
|
|
8
|
+
import { I as j } from "../IconInfoCircleOutline-aO1F3qnG.js";
|
|
9
|
+
import p from "../Divider/index.mjs";
|
|
10
|
+
import I from "../Pagination/index.mjs";
|
|
11
|
+
import '../assets/styles.css';/* empty css */
|
|
12
|
+
const L = (t) => {
|
|
13
|
+
const { title: i, actionButton: r, showTotal: d, total: n, className: o } = t;
|
|
14
|
+
return /* @__PURE__ */ u(
|
|
15
|
+
"div",
|
|
16
|
+
{
|
|
17
|
+
className: a(
|
|
18
|
+
"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",
|
|
19
|
+
o
|
|
20
|
+
),
|
|
21
|
+
children: [
|
|
22
|
+
/* @__PURE__ */ e("div", { className: "dgs-ui-kit-font-h4-bold dgs-ui-kit-text-gray-700 dgs-ui-kit-w-full", children: i }),
|
|
23
|
+
d && /* @__PURE__ */ u("div", { className: "dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-shrink-0", children: [
|
|
24
|
+
/* @__PURE__ */ e("span", { className: "dgs-ui-kit-font-p2-regular dgs-ui-kit-text-gray-700 dgs-ui-kit-ml-1", children: "تعداد نتایج:" }),
|
|
25
|
+
/* @__PURE__ */ e(
|
|
26
|
+
T,
|
|
27
|
+
{
|
|
28
|
+
value: n ?? 0,
|
|
29
|
+
valueType: "number",
|
|
30
|
+
size: "large",
|
|
31
|
+
color: "primary",
|
|
32
|
+
type: "twoTone"
|
|
33
|
+
}
|
|
34
|
+
)
|
|
35
|
+
] }),
|
|
36
|
+
r && /* @__PURE__ */ e(
|
|
37
|
+
B,
|
|
38
|
+
{
|
|
39
|
+
className: a("dgs-ui-kit-shrink-0", r.className),
|
|
40
|
+
...r,
|
|
41
|
+
children: r.children ?? null
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
function h(t) {
|
|
49
|
+
switch (t) {
|
|
50
|
+
case "center":
|
|
51
|
+
return "dgs-ui-kit-justify-center";
|
|
52
|
+
case "start":
|
|
53
|
+
return "dgs-ui-kit-justify-start";
|
|
54
|
+
case "end":
|
|
55
|
+
return "dgs-ui-kit-justify-end";
|
|
56
|
+
default:
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function C(t, i) {
|
|
61
|
+
return t || (Array.isArray(i) ? i[i.length - 1] : i);
|
|
62
|
+
}
|
|
63
|
+
function S(t) {
|
|
64
|
+
return !!(t && t.selectedRowKeys.length > 1 || typeof t?.onSelectRow == "function");
|
|
65
|
+
}
|
|
66
|
+
function A(t, i) {
|
|
67
|
+
return /* @__PURE__ */ e(
|
|
68
|
+
"div",
|
|
69
|
+
{
|
|
70
|
+
className: a(
|
|
71
|
+
"dgs-ui-kit-w-full dgs-ui-kit-flex dgs-ui-kit-items-center",
|
|
72
|
+
h(t ?? "center")
|
|
73
|
+
),
|
|
74
|
+
children: /* @__PURE__ */ e(K, { ...i })
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
function k(t, i) {
|
|
79
|
+
if (t)
|
|
80
|
+
return a("dgs-ui-kit-sticky dgs-ui-kit-translate-y-[1px] dgs-ui-kit-z-10", {
|
|
81
|
+
"dgs-ui-kit-right-0": t === "right",
|
|
82
|
+
"dgs-ui-kit-left-0": t === "left",
|
|
83
|
+
'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
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
const y = "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";
|
|
87
|
+
function D(t, i) {
|
|
88
|
+
return t ? Array.isArray(t) ? t.reduce((r, d) => r?.[d] ?? null, i) : i[t] : null;
|
|
89
|
+
}
|
|
90
|
+
function E(t, i, r) {
|
|
91
|
+
if (typeof t.render == "function") return t.render(i, r);
|
|
92
|
+
const d = D(t.dataIndex, i);
|
|
93
|
+
if (t.ellipsis) {
|
|
94
|
+
const n = /* @__PURE__ */ e("div", { className: "!dgs-ui-kit-truncate", children: d });
|
|
95
|
+
return typeof t.ellipsis != "boolean" && t.ellipsis.hideTooltip ? n : /* @__PURE__ */ e(
|
|
96
|
+
v,
|
|
97
|
+
{
|
|
98
|
+
wrapperClassName: "dgs-ui-kit-w-full",
|
|
99
|
+
content: d,
|
|
100
|
+
children: n
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
return d;
|
|
105
|
+
}
|
|
106
|
+
function H(t) {
|
|
107
|
+
const { data: i, columns: r, rowKey: d, rowSelection: n, havePagination: o } = t;
|
|
108
|
+
return /* @__PURE__ */ e("tbody", { children: i.map((s, g) => /* @__PURE__ */ u("tr", { children: [
|
|
109
|
+
S(n) && /* @__PURE__ */ e(
|
|
110
|
+
"td",
|
|
111
|
+
{
|
|
112
|
+
className: a(
|
|
113
|
+
y,
|
|
114
|
+
n?.className,
|
|
115
|
+
{
|
|
116
|
+
"dgs-ui-kit-border-b-0 dgs-ui-kit-rounded-br-2xl": !o && g === i.length - 1
|
|
117
|
+
},
|
|
118
|
+
k(n?.sticky),
|
|
119
|
+
n?.className
|
|
120
|
+
),
|
|
121
|
+
children: A(n?.align, {
|
|
122
|
+
onChange: (l) => n?.onSelectRow(l, s[d]),
|
|
123
|
+
checked: !!n?.selectedRowKeys.find((l) => l === s[d])
|
|
124
|
+
})
|
|
125
|
+
}
|
|
126
|
+
),
|
|
127
|
+
r.map((l) => /* @__PURE__ */ e(
|
|
128
|
+
"td",
|
|
129
|
+
{
|
|
130
|
+
className: a(
|
|
131
|
+
y,
|
|
132
|
+
{
|
|
133
|
+
"dgs-ui-kit-border-b-0 first:dgs-ui-kit-rounded-br-2xl last:dgs-ui-kit-rounded-bl-2xl": !o && g === i.length - 1
|
|
134
|
+
},
|
|
135
|
+
k(l?.sticky),
|
|
136
|
+
l.className
|
|
137
|
+
),
|
|
138
|
+
children: /* @__PURE__ */ e(
|
|
139
|
+
"div",
|
|
140
|
+
{
|
|
141
|
+
className: a(
|
|
142
|
+
"dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-ml-2",
|
|
143
|
+
h(l.align)
|
|
144
|
+
),
|
|
145
|
+
children: E(l, s, g)
|
|
146
|
+
}
|
|
147
|
+
)
|
|
148
|
+
},
|
|
149
|
+
`${s[d]}-${C(l.key, l.dataIndex)}`
|
|
150
|
+
))
|
|
151
|
+
] }, s[d])) });
|
|
152
|
+
}
|
|
153
|
+
const P = (t) => /* @__PURE__ */ e(
|
|
154
|
+
"svg",
|
|
155
|
+
{
|
|
156
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
157
|
+
width: "1em",
|
|
158
|
+
height: "1em",
|
|
159
|
+
fill: "none",
|
|
160
|
+
viewBox: "0 0 24 24",
|
|
161
|
+
...t,
|
|
162
|
+
children: /* @__PURE__ */ e(
|
|
163
|
+
"path",
|
|
164
|
+
{
|
|
165
|
+
fill: "currentColor",
|
|
166
|
+
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"
|
|
167
|
+
}
|
|
168
|
+
)
|
|
169
|
+
}
|
|
170
|
+
);
|
|
171
|
+
function _(t, i) {
|
|
172
|
+
if (t.length !== i.length) return !1;
|
|
173
|
+
t.sort(), i.sort();
|
|
174
|
+
for (let r = 0; r < t.length; r++) if (t[r] !== i[r]) return !1;
|
|
175
|
+
return !0;
|
|
176
|
+
}
|
|
177
|
+
const c = 16, b = "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", w = "!dgs-ui-kit-h-8 dgs-ui-kit-shrink-0";
|
|
178
|
+
function N(t, i) {
|
|
179
|
+
return /* @__PURE__ */ u("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: [
|
|
180
|
+
/* @__PURE__ */ e("span", { children: t }),
|
|
181
|
+
i && (i.anchorIcon ?? /* @__PURE__ */ e(
|
|
182
|
+
j,
|
|
183
|
+
{
|
|
184
|
+
width: c,
|
|
185
|
+
height: c
|
|
186
|
+
}
|
|
187
|
+
))
|
|
188
|
+
] });
|
|
189
|
+
}
|
|
190
|
+
function x(t, i) {
|
|
191
|
+
return t.map((r) => r[i]);
|
|
192
|
+
}
|
|
193
|
+
function z(t) {
|
|
194
|
+
const { columns: i, haveHeader: r, rowSelection: d, rowKey: n, data: o } = t;
|
|
195
|
+
return /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ u("tr", { children: [
|
|
196
|
+
S(d) && /* @__PURE__ */ e(
|
|
197
|
+
"th",
|
|
198
|
+
{
|
|
199
|
+
className: a(
|
|
200
|
+
b,
|
|
201
|
+
{ "dgs-ui-kit-rounded-tr-2xl": !r },
|
|
202
|
+
k(d?.sticky, !0),
|
|
203
|
+
d?.className
|
|
204
|
+
),
|
|
205
|
+
children: /* @__PURE__ */ u("div", { className: "dgs-ui-kit-flex dgs-ui-kit-items-center dgs-ui-kit-justify-between", children: [
|
|
206
|
+
A(d?.align, {
|
|
207
|
+
checked: d.selectedRowKeys.length > 0,
|
|
208
|
+
isIndeterminate: !_(
|
|
209
|
+
x(o, n),
|
|
210
|
+
d.selectedRowKeys
|
|
211
|
+
),
|
|
212
|
+
onChange: (s) => d?.onSelectRow(s, s.target.checked ? x(o, n) : [])
|
|
213
|
+
}),
|
|
214
|
+
/* @__PURE__ */ e(
|
|
215
|
+
p,
|
|
216
|
+
{
|
|
217
|
+
type: "vertical",
|
|
218
|
+
className: w
|
|
219
|
+
}
|
|
220
|
+
)
|
|
221
|
+
] })
|
|
222
|
+
}
|
|
223
|
+
),
|
|
224
|
+
i.map((s, g) => /* @__PURE__ */ e(
|
|
225
|
+
"th",
|
|
226
|
+
{
|
|
227
|
+
className: a(
|
|
228
|
+
b,
|
|
229
|
+
{
|
|
230
|
+
"first:dgs-ui-kit-rounded-tr-2xl last:dgs-ui-kit-rounded-tl-2xl": !r
|
|
231
|
+
},
|
|
232
|
+
k(s?.sticky, !0),
|
|
233
|
+
s.className
|
|
234
|
+
),
|
|
235
|
+
children: /* @__PURE__ */ u("div", { className: "dgs-ui-kit-flex dgs-ui-kit-justify-between dgs-ui-kit-items-center", children: [
|
|
236
|
+
/* @__PURE__ */ u(
|
|
237
|
+
"div",
|
|
238
|
+
{
|
|
239
|
+
className: a(
|
|
240
|
+
"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",
|
|
241
|
+
h(s.align)
|
|
242
|
+
),
|
|
243
|
+
children: [
|
|
244
|
+
s.tooltip?.content ? /* @__PURE__ */ e(v, { ...s.tooltip, children: N(s.title, s.tooltip) }) : N(s.title),
|
|
245
|
+
typeof s.onSort == "function" && /* @__PURE__ */ u("div", { className: "dgs-ui-kit-flex dgs-ui-kit-flex-col", children: [
|
|
246
|
+
/* @__PURE__ */ e("button", { onClick: () => s.onSort("ascend"), children: /* @__PURE__ */ e(
|
|
247
|
+
P,
|
|
248
|
+
{
|
|
249
|
+
width: c,
|
|
250
|
+
height: c
|
|
251
|
+
}
|
|
252
|
+
) }),
|
|
253
|
+
/* @__PURE__ */ e("button", { onClick: () => s.onSort("descend"), children: /* @__PURE__ */ e(
|
|
254
|
+
R,
|
|
255
|
+
{
|
|
256
|
+
width: c,
|
|
257
|
+
height: c
|
|
258
|
+
}
|
|
259
|
+
) })
|
|
260
|
+
] })
|
|
261
|
+
]
|
|
262
|
+
}
|
|
263
|
+
),
|
|
264
|
+
g !== i.length - 1 && /* @__PURE__ */ e(
|
|
265
|
+
p,
|
|
266
|
+
{
|
|
267
|
+
type: "vertical",
|
|
268
|
+
className: w
|
|
269
|
+
}
|
|
270
|
+
)
|
|
271
|
+
] })
|
|
272
|
+
},
|
|
273
|
+
C(s.key, s.dataIndex)
|
|
274
|
+
))
|
|
275
|
+
] }) });
|
|
276
|
+
}
|
|
277
|
+
function W(t) {
|
|
278
|
+
const { header: i, wrapperClassName: r, className: d, columns: n, rowSelection: o, data: s, rowKey: g, pagination: l } = t, f = (i && Object.values(i).length > 0) ?? !1, m = !!(l?.totalCount && l?.pageSize);
|
|
279
|
+
return /* @__PURE__ */ u(
|
|
280
|
+
"div",
|
|
281
|
+
{
|
|
282
|
+
className: a(
|
|
283
|
+
"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",
|
|
284
|
+
r
|
|
285
|
+
),
|
|
286
|
+
children: [
|
|
287
|
+
f && /* @__PURE__ */ e(
|
|
288
|
+
L,
|
|
289
|
+
{
|
|
290
|
+
...i,
|
|
291
|
+
total: l?.totalCount ?? s.length
|
|
292
|
+
}
|
|
293
|
+
),
|
|
294
|
+
/* @__PURE__ */ u("table", { className: d, children: [
|
|
295
|
+
/* @__PURE__ */ e(
|
|
296
|
+
z,
|
|
297
|
+
{
|
|
298
|
+
columns: n,
|
|
299
|
+
haveHeader: f,
|
|
300
|
+
rowKey: g,
|
|
301
|
+
rowSelection: o,
|
|
302
|
+
data: s
|
|
303
|
+
}
|
|
304
|
+
),
|
|
305
|
+
/* @__PURE__ */ e(
|
|
306
|
+
H,
|
|
307
|
+
{
|
|
308
|
+
columns: n,
|
|
309
|
+
data: s,
|
|
310
|
+
rowKey: g,
|
|
311
|
+
rowSelection: o,
|
|
312
|
+
havePagination: m
|
|
313
|
+
}
|
|
314
|
+
)
|
|
315
|
+
] }),
|
|
316
|
+
m && /* @__PURE__ */ e(
|
|
317
|
+
I,
|
|
318
|
+
{
|
|
319
|
+
className: a("dgs-ui-kit-py-4 !dgs-ui-kit-px-0", l?.className),
|
|
320
|
+
...l
|
|
321
|
+
}
|
|
322
|
+
)
|
|
323
|
+
]
|
|
324
|
+
}
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
export {
|
|
328
|
+
W as default
|
|
329
|
+
};
|