@lanaco/lnc-react-ui 4.0.19 → 4.0.21

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,4 +1,4 @@
1
- "use strict";const o=require("react/jsx-runtime"),$=require("react"),e=require("./index-BIlhCoy2.cjs"),B=require("./emotion-styled.browser.esm-Cbp_XsK4.cjs"),V=require("./DropdownMenu.cjs"),i=require("./DropdownItem.cjs"),Y=require("./Separator.cjs"),y=require("./Button.cjs"),b=require("./utils-DTAPpJXU.cjs"),M=require("./ThemeProvider.cjs"),Z=B.newStyled.div`
1
+ "use strict";const o=require("react/jsx-runtime"),B=require("react"),e=require("./index-BIlhCoy2.cjs"),V=require("./emotion-styled.browser.esm-Cbp_XsK4.cjs"),Y=require("./DropdownMenu.cjs"),i=require("./DropdownItem.cjs"),M=require("./Separator.cjs"),y=require("./Button.cjs"),b=require("./utils-DTAPpJXU.cjs"),Z=require("./ThemeProvider.cjs"),F=V.newStyled.div`
2
2
  display: flex;
3
3
  align-items: center;
4
4
  border-radius: 8px;
@@ -16,4 +16,4 @@
16
16
  gap: 0.5rem;
17
17
  }
18
18
  }
19
- `,c=$.forwardRef((t,T)=>{const{__TYPE__:F="ACTIONS_TOOLBAR",showCreate:u=!0,enableCreate:x=!0,createText:d="Create new item",showEdit:m=!0,enableEditOnSelection:g=!0,editText:P="Edit",showDelete:w=!0,enableDeleteOnSelection:h=!0,deleteText:C="Delete",showCopy:f=!0,enableCopyOnSelection:O=!0,copyText:j="Copy",actionsText:S="Actions",customActions:a,selectedRowsLength:n=0,readOnly:s=!1,actionDropdownProps:D,actionsDropdownZIndex:_,actionsDropdownPlacement:q,onCreate:E=()=>{},onEdit:R=()=>{},onDelete:k=()=>{},onCopy:v=()=>{},className:A="",style:I={},color:l="primary",size:p="small",...N}=t,{theme:z}=M.useTheme();return o.jsxs(Z,{ref:T,theme:z,color:l,className:`lnc-table-view-actions-toolbar ${A}`,style:I,...N,children:[o.jsx("div",{children:u&&s==!1&&o.jsx(y,{leadingIcon:"plus",btnType:"outline",type:"button",color:l,size:p,title:d,disabled:!x,onClick:E,text:d})}),o.jsx("div",{children:o.jsxs(V,{className:"lnc-table-view-actions-toolbar-dropdown",color:l,size:p,zIndex:_,placement:q,...D,control:o.jsx(y,{text:S,btnType:"outline",trailingIcon:"angle-down",color:l,size:p,type:"button"}),children:[f&&s==!1&&o.jsx(i,{icon:"copy",disabled:!(O&&n>0),onClick:v,children:j}),m&&s==!1&&o.jsx(i,{icon:"pen",disabled:!(g&&n>0),onClick:R,children:P}),w&&s==!1&&o.jsx(i,{icon:"trash",disabled:!(h&&n>0),onClick:k,children:C}),o.jsx(Y,{}),a==null?void 0:a.map((r,L)=>{if((r==null?void 0:r.show)!=!1)return o.jsx(i,{icon:r.icon,disabled:!(r.enableOnSelection==!0&&n>0||r.enable==!0&&r.enableOnSelection==!1),onClick:r.onAction,children:r.name},L)})]})})]})});c.propTypes={__TYPE__:e.PropTypes.string,showCreate:e.PropTypes.bool,enableCreate:e.PropTypes.bool,createText:e.PropTypes.string,showEdit:e.PropTypes.bool,enableEditOnSelection:e.PropTypes.bool,editText:e.PropTypes.string,showDelete:e.PropTypes.bool,enableDeleteOnSelection:e.PropTypes.bool,deleteText:e.PropTypes.string,showCopy:e.PropTypes.bool,enableCopyOnSelection:e.PropTypes.bool,copyText:e.PropTypes.string,actionsText:e.PropTypes.string,customActions:e.PropTypes.array,selectedRowsLength:e.PropTypes.number,readOnly:e.PropTypes.bool,onCreate:e.PropTypes.func,onEdit:e.PropTypes.func,onDelete:e.PropTypes.func,onCopy:e.PropTypes.func,className:e.PropTypes.string,style:e.PropTypes.object,size:e.PropTypes.oneOf(["small","medium","large"]),color:e.PropTypes.oneOf(["primary","secondary","success","danger","warning","information","neutral","gray"])};c.displayName="ACTIONS_TOOLBAR";module.exports=c;
19
+ `,c=B.forwardRef((t,T)=>{const{__TYPE__:G="ACTIONS_TOOLBAR",showCreate:u=!0,enableCreate:x=!0,createText:d="Create new item",showEdit:m=!0,enableEditOnSelection:g=!0,editText:P="Edit",showDelete:w=!0,enableDeleteOnSelection:h=!0,deleteText:C="Delete",showCopy:f=!0,enableCopyOnSelection:O=!0,copyText:j="Copy",actionsText:S="Actions",customActions:a,selectedRowsLength:n=0,readOnly:s=!1,actionDropdownProps:D,actionsDropdownZIndex:_,actionsDropdownPlacement:q,onCreate:R=()=>{},onEdit:E=()=>{},onDelete:k=()=>{},onCopy:v=()=>{},className:A="",style:I={},color:l="primary",size:p="small",selectedRows:N,...z}=t,{theme:L}=Z.useTheme();return o.jsxs(F,{ref:T,theme:L,color:l,className:`lnc-table-view-actions-toolbar ${A}`,style:I,...z,children:[o.jsx("div",{children:u&&s==!1&&o.jsx(y,{leadingIcon:"plus",btnType:"outline",type:"button",color:l,size:p,title:d,disabled:!x,onClick:R,text:d})}),o.jsx("div",{children:o.jsxs(Y,{className:"lnc-table-view-actions-toolbar-dropdown",color:l,size:p,zIndex:_,placement:q,...D,control:o.jsx(y,{text:S,btnType:"outline",trailingIcon:"angle-down",color:l,size:p,type:"button"}),children:[f&&s==!1&&o.jsx(i,{icon:"copy",disabled:!(O&&n>0),onClick:v,children:j}),m&&s==!1&&o.jsx(i,{icon:"pen",disabled:!(g&&n>0),onClick:E,children:P}),w&&s==!1&&o.jsx(i,{icon:"trash",disabled:!(h&&n>0),onClick:k,children:C}),o.jsx(M,{}),a==null?void 0:a.map((r,$)=>{if((r==null?void 0:r.show)!=!1)return o.jsx(i,{icon:r.icon,disabled:!(r.enableOnSelection==!0&&n>0||r.enable==!0&&r.enableOnSelection==!1),onClick:()=>{r.onAction(N)},children:r.name},$)})]})})]})});c.propTypes={__TYPE__:e.PropTypes.string,showCreate:e.PropTypes.bool,enableCreate:e.PropTypes.bool,createText:e.PropTypes.string,showEdit:e.PropTypes.bool,enableEditOnSelection:e.PropTypes.bool,editText:e.PropTypes.string,showDelete:e.PropTypes.bool,enableDeleteOnSelection:e.PropTypes.bool,deleteText:e.PropTypes.string,showCopy:e.PropTypes.bool,enableCopyOnSelection:e.PropTypes.bool,copyText:e.PropTypes.string,actionsText:e.PropTypes.string,customActions:e.PropTypes.array,selectedRowsLength:e.PropTypes.number,readOnly:e.PropTypes.bool,onCreate:e.PropTypes.func,onEdit:e.PropTypes.func,onDelete:e.PropTypes.func,onCopy:e.PropTypes.func,className:e.PropTypes.string,style:e.PropTypes.object,size:e.PropTypes.oneOf(["small","medium","large"]),color:e.PropTypes.oneOf(["primary","secondary","success","danger","warning","information","neutral","gray"])};c.displayName="ACTIONS_TOOLBAR";module.exports=c;
@@ -1,14 +1,14 @@
1
1
  import { jsxs as p, jsx as t } from "react/jsx-runtime";
2
- import { forwardRef as Y } from "react";
2
+ import { forwardRef as M } from "react";
3
3
  import { P as e } from "./index-BYnWp42a.js";
4
- import { n as M } from "./emotion-styled.browser.esm-BiK8DcgW.js";
5
- import V from "./DropdownMenu.js";
4
+ import { n as V } from "./emotion-styled.browser.esm-BiK8DcgW.js";
5
+ import Z from "./DropdownMenu.js";
6
6
  import i from "./DropdownItem.js";
7
- import Z from "./Separator.js";
7
+ import q from "./Separator.js";
8
8
  import b from "./Button.js";
9
9
  import { a as m } from "./utils-C52T57HO.js";
10
- import { useTheme as q } from "./ThemeProvider.js";
11
- const F = M.div`
10
+ import { useTheme as F } from "./ThemeProvider.js";
11
+ const G = V.div`
12
12
  display: flex;
13
13
  align-items: center;
14
14
  border-radius: 8px;
@@ -40,9 +40,9 @@ const F = M.div`
40
40
  gap: 0.5rem;
41
41
  }
42
42
  }
43
- `, u = Y((n, f) => {
43
+ `, u = M((n, f) => {
44
44
  const {
45
- __TYPE__: G = "ACTIONS_TOOLBAR",
45
+ __TYPE__: H = "ACTIONS_TOOLBAR",
46
46
  showCreate: y = !0,
47
47
  enableCreate: g = !0,
48
48
  createText: c = "Create new item",
@@ -65,27 +65,28 @@ const F = M.div`
65
65
  //----------------
66
66
  onCreate: N = () => {
67
67
  },
68
- onEdit: v = () => {
68
+ onEdit: R = () => {
69
69
  },
70
- onDelete: P = () => {
70
+ onDelete: v = () => {
71
71
  },
72
- onCopy: R = () => {
72
+ onCopy: P = () => {
73
73
  },
74
74
  className: j = "",
75
75
  style: z = {},
76
76
  color: a = "primary",
77
77
  size: d = "small",
78
- ...L
79
- } = n, { theme: $ } = q();
78
+ selectedRows: L,
79
+ ...$
80
+ } = n, { theme: B } = F();
80
81
  return /* @__PURE__ */ p(
81
- F,
82
+ G,
82
83
  {
83
84
  ref: f,
84
- theme: $,
85
+ theme: B,
85
86
  color: a,
86
87
  className: `lnc-table-view-actions-toolbar ${j}`,
87
88
  style: z,
88
- ...L,
89
+ ...$,
89
90
  children: [
90
91
  /* @__PURE__ */ t("div", { children: y && l == !1 && /* @__PURE__ */ t(
91
92
  b,
@@ -102,7 +103,7 @@ const F = M.div`
102
103
  }
103
104
  ) }),
104
105
  /* @__PURE__ */ t("div", { children: /* @__PURE__ */ p(
105
- V,
106
+ Z,
106
107
  {
107
108
  className: "lnc-table-view-actions-toolbar-dropdown",
108
109
  color: a,
@@ -127,7 +128,7 @@ const F = M.div`
127
128
  {
128
129
  icon: "copy",
129
130
  disabled: !(D && r > 0),
130
- onClick: R,
131
+ onClick: P,
131
132
  children: _
132
133
  }
133
134
  ),
@@ -136,7 +137,7 @@ const F = M.div`
136
137
  {
137
138
  icon: "pen",
138
139
  disabled: !(h && r > 0),
139
- onClick: v,
140
+ onClick: R,
140
141
  children: T
141
142
  }
142
143
  ),
@@ -145,22 +146,24 @@ const F = M.div`
145
146
  {
146
147
  icon: "trash",
147
148
  disabled: !(C && r > 0),
148
- onClick: P,
149
+ onClick: v,
149
150
  children: O
150
151
  }
151
152
  ),
152
- /* @__PURE__ */ t(Z, {}),
153
- s == null ? void 0 : s.map((o, B) => {
153
+ /* @__PURE__ */ t(q, {}),
154
+ s == null ? void 0 : s.map((o, Y) => {
154
155
  if ((o == null ? void 0 : o.show) != !1)
155
156
  return /* @__PURE__ */ t(
156
157
  i,
157
158
  {
158
159
  icon: o.icon,
159
160
  disabled: !(o.enableOnSelection == !0 && r > 0 || o.enable == !0 && o.enableOnSelection == !1),
160
- onClick: o.onAction,
161
+ onClick: () => {
162
+ o.onAction(L);
163
+ },
161
164
  children: o.name
162
165
  },
163
- B
166
+ Y
164
167
  );
165
168
  })
166
169
  ]
@@ -27,4 +27,4 @@
27
27
  left: 50%;
28
28
  transform: translate(-50%, -50%);
29
29
  color: ${e=>o.getColorRgbaValue(e.theme,"Progress",e.color,"enabled","text")};
30
- `,d=i.forwardRef((e,T)=>{const{id:$="",showLabel:c=!1,progressPercentage:n=0,className:m="",style:u={},onChange:C=()=>{},size:g="small",color:b="primary",progressBarEndComponent:s,...h}=e,t=P.useTheme(),y=()=>{var p;if(i.isValidElement(s))return console.log("is valid"),i.cloneElement(s,{className:`progress-icon ${(p=s==null?void 0:s.props)==null?void 0:p.className}`})};return a.jsxs(f,{style:u,className:"lnc-ui-progress "+m,theme:t,size:g,showLabel:c,progressPercentage:n,...h,children:[a.jsx(x,{progressPercentage:n,theme:t,color:b,children:s!==null&&y()}),c&&a.jsxs(w,{theme:t,size:g,children:[n,"%"]})]})});d.propTypes={id:r.PropTypes.string,showLabel:r.PropTypes.bool,progressPercentage:r.PropTypes.number,onChange:r.PropTypes.func,className:r.PropTypes.string,style:r.PropTypes.object,size:r.PropTypes.oneOf(["small","medium","large"]),color:r.PropTypes.oneOf(["primary","secondary","success","danger","warning","disabled","information","neutral","gray"]),progressBarEndComponent:r.PropTypes.any};module.exports=d;
30
+ `,d=i.forwardRef((e,T)=>{const{id:$="",showLabel:c=!1,progressPercentage:t=0,className:m="",style:u={},onChange:C=()=>{},size:g="small",color:b="primary",progressBarEndComponent:s,...h}=e,n=P.useTheme(),y=()=>{var p;if(i.isValidElement(s))return i.cloneElement(s,{className:`progress-icon ${(p=s==null?void 0:s.props)==null?void 0:p.className}`})};return a.jsxs(f,{style:u,className:"lnc-ui-progress "+m,theme:n,size:g,showLabel:c,progressPercentage:t,...h,children:[a.jsx(x,{progressPercentage:t,theme:n,color:b,children:s!==null&&y()}),c&&a.jsxs(w,{theme:n,size:g,children:[t,"%"]})]})});d.propTypes={id:r.PropTypes.string,showLabel:r.PropTypes.bool,progressPercentage:r.PropTypes.number,onChange:r.PropTypes.func,className:r.PropTypes.string,style:r.PropTypes.object,size:r.PropTypes.oneOf(["small","medium","large"]),color:r.PropTypes.oneOf(["primary","secondary","success","danger","warning","disabled","information","neutral","gray"]),progressBarEndComponent:r.PropTypes.any};module.exports=d;
@@ -1,13 +1,13 @@
1
1
  import { jsxs as g, jsx as h } from "react/jsx-runtime";
2
2
  import { forwardRef as f, isValidElement as P, cloneElement as y } from "react";
3
3
  import { P as r } from "./index-BYnWp42a.js";
4
- import { n } from "./emotion-styled.browser.esm-BiK8DcgW.js";
5
- import { a as t, g as x } from "./utils-C52T57HO.js";
4
+ import { n as t } from "./emotion-styled.browser.esm-BiK8DcgW.js";
5
+ import { a as n, g as x } from "./utils-C52T57HO.js";
6
6
  import { u as w } from "./emotion-element-5486c51c.browser.esm-Bb4VkP8U.js";
7
- const $ = n.div`
7
+ const $ = t.div`
8
8
  width: 100%;
9
9
  position: relative;
10
- background-color: ${(e) => t(
10
+ background-color: ${(e) => n(
11
11
  e.theme,
12
12
  "Progress",
13
13
  e.color,
@@ -17,11 +17,11 @@ const $ = n.div`
17
17
  height: ${(e) => e.theme.components.Progress.default.enabled.sizes[e.size]};
18
18
  border-radius: 5px;
19
19
  animation: progres 4s infinite linear;
20
- `, z = n.div`
20
+ `, z = t.div`
21
21
  position: relative;
22
22
  height: 100%;
23
23
  width: ${(e) => e.progressPercentage + "%"};
24
- background-color: ${(e) => t(
24
+ background-color: ${(e) => n(
25
25
  e.theme,
26
26
  "Progress",
27
27
  e.color,
@@ -38,14 +38,14 @@ const $ = n.div`
38
38
  top: 50%;
39
39
  transform: translate(50%, -50%);
40
40
  }
41
- `, v = n.label`
41
+ `, C = t.label`
42
42
  ${(e) => x(e.theme, "Progress", e.size, "enabled")};
43
43
  position: absolute;
44
44
  top: 50%;
45
45
  left: 50%;
46
46
  transform: translate(-50%, -50%);
47
- color: ${(e) => t(e.theme, "Progress", e.color, "enabled", "text")};
48
- `, C = f((e, N) => {
47
+ color: ${(e) => n(e.theme, "Progress", e.color, "enabled", "text")};
48
+ `, N = f((e, v) => {
49
49
  const {
50
50
  id: T = "",
51
51
  showLabel: i = !1,
@@ -56,13 +56,12 @@ const $ = n.div`
56
56
  },
57
57
  size: l = "small",
58
58
  color: p = "primary",
59
- // progressBarEndComponent = null,
60
59
  progressBarEndComponent: o,
61
60
  ...b
62
61
  } = e, a = w(), u = () => {
63
62
  var c;
64
63
  if (P(o))
65
- return console.log("is valid"), y(o, {
64
+ return y(o, {
66
65
  className: `progress-icon ${(c = o == null ? void 0 : o.props) == null ? void 0 : c.className}`
67
66
  });
68
67
  };
@@ -86,7 +85,7 @@ const $ = n.div`
86
85
  children: o !== null && u()
87
86
  }
88
87
  ),
89
- i && /* @__PURE__ */ g(v, { theme: a, size: l, children: [
88
+ i && /* @__PURE__ */ g(C, { theme: a, size: l, children: [
90
89
  s,
91
90
  "%"
92
91
  ] })
@@ -94,7 +93,7 @@ const $ = n.div`
94
93
  }
95
94
  );
96
95
  });
97
- C.propTypes = {
96
+ N.propTypes = {
98
97
  id: r.string,
99
98
  showLabel: r.bool,
100
99
  progressPercentage: r.number,
@@ -118,5 +117,5 @@ C.propTypes = {
118
117
  progressBarEndComponent: r.any
119
118
  };
120
119
  export {
121
- C as default
120
+ N as default
122
121
  };
@@ -1,8 +1,8 @@
1
- "use strict";const T=require("react/jsx-runtime"),g=require("react"),e=require("./index-BIlhCoy2.cjs"),ee=require("./emotion-styled.browser.esm-Cbp_XsK4.cjs"),oe=require("./ActionsToolbar.cjs"),ne=require("./Pagination.cjs"),d=require("./utils-DTAPpJXU.cjs"),le=require("./Table.cjs"),se=ee.newStyled.div`
1
+ "use strict";const b=require("react/jsx-runtime"),g=require("react"),e=require("./index-BIlhCoy2.cjs"),ne=require("./emotion-styled.browser.esm-Cbp_XsK4.cjs"),re=require("./ActionsToolbar.cjs"),te=require("./Pagination.cjs"),T=require("./utils-DTAPpJXU.cjs"),le=require("./Table.cjs"),se=ne.newStyled.div`
2
2
  & .table-view-pagination-lnc {
3
3
  padding: 0 0.625rem;
4
4
  }
5
5
  & .table-view-toolbar-lnc {
6
6
  margin: 0 0.625rem;
7
7
  }
8
- `,w=g.forwardRef((h,S)=>{const{__TYPE__:te="TABLE_VIEW",goToPreviousView:re,tableProps:o={},paginationProps:n={},actionsToolbarProps:f={},rowsSingleSelect:C=!0,rowsMultiSelect:m=!1,loading:ce=!1,showCreate:z=!0,enableCreate:E=!0,enableDetails:ae=!0,showEdit:D,enableEditOnSelection:N,showDelete:P=!0,enableDeleteOnSelection:R=!0,showCopy:O=!0,enableCopyOnSelection:_=!0,customActions:x,pagination:A=!0,readOnly:b=!1,actionsDropdownZIndex:j=null,actionsDropdownPlacement:v=null,actionDropdownProps:q,onCreate:k=()=>{},onEdit:I=()=>{},onDelete:L=()=>{},onDetails:V=()=>{},onCopy:B=()=>{},onFilter:ie=()=>{},onSort:ye=()=>{},onPageChange:F=()=>{},onEmptyRowsSelection:pe=()=>{},className:de="",style:ue={},color:c="primary",size:a="small",children:i,...M}=h,l={...f,showCreate:z,enableCreate:E,showCopy:O,enableCopyOnSelection:_,showEdit:D,enableEditOnSelection:N,showDelete:P,enableDeleteOnSelection:R,customActions:x,readOnly:b},[r,y]=g.useState([]),W=(s,t)=>{t?m?y([...r,s]):C&&y([s]):y(m?p=>p.filter(u=>u!=s):[])},Y=(s,t)=>{var p,u;((p=s.target)==null?void 0:p.type)!=="checkbox"&&((u=s.target)==null?void 0:u.className)!=="checkmark"&&(o!=null&&o.onRowClick&&o.onRowClick(s,t),Z(t,s))},Z=(s,t)=>{V(s,t)},G=s=>{k(s)},H=s=>{B(r,s)},J=s=>{I(r,s),y([])},K=s=>{L(r,s),y([])},Q=s=>{F(s)},U=()=>d.renderCustomElement(d.getCustomRender("ACTIONS_TOOLBAR",i),{...l,size:l!=null&&l.size?l.size:a,color:l!=null&&l.color?l.color:c,className:"table-view-toolbar-lnc "+(l==null?void 0:l.className)},i)||T.jsx(oe,{...l,className:"table-view-toolbar-lnc "+(l==null?void 0:l.className),size:l!=null&&l.size?l.size:a,color:l!=null&&l.color?l.color:c,selectedRowsLength:r!=null&&r.length?r.length:0,onCreate:G,onCopy:H,onEdit:J,onDelete:K,actionsDropdownZIndex:j,actionDropdownProps:q,actionsDropdownPlacement:v}),X=()=>d.renderCustomElement(d.getCustomRender("TABLE",i),{...o,size:o!=null&&o.size?o.size:a,color:o!=null&&o.color?o.color:c,className:"table-view-pagination-lnc "+(o==null?void 0:o.className)},i)||T.jsx(le.default,{size:o!=null&&o.size?o.size:a,color:o!=null&&o.color?o.color:c,EnableSelection:(C||m)&&b==!1,onSelectRow:(s,t,p)=>W(t,!p),SelectedData:r,onRowClick:(s,t)=>Y(s,t),...o}),$=()=>d.renderCustomElement(d.getCustomRender("PAGINATION",i),{...n,size:n!=null&&n.size?n.size:a,color:n!=null&&n.color?n.color:c,className:"table-view-pagination-lnc "+(n==null?void 0:n.className)},i)||T.jsx(ne,{...n,size:n!=null&&n.size?n.size:a,color:n!=null&&n.color?n.color:c,className:"table-view-pagination-lnc "+(n==null?void 0:n.className),onPageChange:Q});return T.jsxs(se,{ref:S,...M,children:[U(),X(),A==!0&&$()]})});w.propTypes={__TYPE__:e.PropTypes.string,tableProps:e.PropTypes.object,actionsToolbarProps:e.PropTypes.object,paginationProps:e.PropTypes.object,rowsSingleSelect:e.PropTypes.bool,rowsMultiSelect:e.PropTypes.bool,loading:e.PropTypes.bool,showCreate:e.PropTypes.bool,actionsDropdownZIndex:e.PropTypes.any,actionsDropdownPlacement:e.PropTypes.any,enableCreate:e.PropTypes.bool,enableDetails:e.PropTypes.bool,showEdit:e.PropTypes.bool,enableEditOnSelection:e.PropTypes.bool,showDelete:e.PropTypes.bool,enableDeleteOnSelection:e.PropTypes.bool,showCopy:e.PropTypes.bool,enableCopyOnSelection:e.PropTypes.bool,customActions:e.PropTypes.array,pagination:e.PropTypes.bool,readOnly:e.PropTypes.bool,onCreate:e.PropTypes.func,onEdit:e.PropTypes.func,onDelete:e.PropTypes.func,onDetails:e.PropTypes.func,onCopy:e.PropTypes.func,onFilter:e.PropTypes.func,onSort:e.PropTypes.func,onPageChange:e.PropTypes.func,className:e.PropTypes.string,style:e.PropTypes.object,size:e.PropTypes.oneOf(["small","medium","large"]),color:e.PropTypes.oneOf(["primary","secondary","success","danger","warning","information","neutral","gray"])};w.displayName="TABLE_VIEW";module.exports=w;
8
+ `,h=g.forwardRef((z,E)=>{const{__TYPE__:ce="TABLE_VIEW",goToPreviousView:ie,tableProps:o={},paginationProps:n={},actionsToolbarProps:D={},rowsSingleSelect:w=!0,rowsMultiSelect:d=!1,loading:ae=!1,showCreate:N=!0,enableCreate:P=!0,enableDetails:ue=!0,showEdit:O,enableEditOnSelection:f,showDelete:_=!0,enableDeleteOnSelection:x=!0,showCopy:A=!0,enableCopyOnSelection:j=!0,customActions:v,pagination:q=!0,readOnly:S=!1,actionsDropdownZIndex:k=null,actionsDropdownPlacement:I=null,actionDropdownProps:L,onCreate:V=()=>{},onEdit:B=()=>{},onDelete:F=()=>{},onDetails:M=()=>{},onCopy:W=()=>{},onFilter:ye=()=>{},onSort:pe=()=>{},onPageChange:Y=()=>{},onEmptyRowsSelection:Te=()=>{},className:de="",style:me={},color:a="primary",size:u="small",children:y,onChangeRowsSelection:p=()=>{},...Z}=z,r={...D,showCreate:N,enableCreate:P,showCopy:A,enableCopyOnSelection:j,showEdit:O,enableEditOnSelection:f,showDelete:_,enableDeleteOnSelection:x,customActions:v,readOnly:S},[c,m]=g.useState([]),t=g.useRef([]),G=(l,s)=>{var i;s?(d||w)&&(t.current=d?[...t.current,l]:[l],p(t==null?void 0:t.current),m(t==null?void 0:t.current)):(t.current=d?(i=t==null?void 0:t.current)==null?void 0:i.filter(C=>C!=l):[],p==null||p(t==null?void 0:t.current),m(t==null?void 0:t.current))},H=(l,s)=>{var i,C;((i=l.target)==null?void 0:i.type)!=="checkbox"&&((C=l.target)==null?void 0:C.className)!=="checkmark"&&(o!=null&&o.onRowClick&&o.onRowClick(l,s),J(s,l))},J=(l,s)=>{M(l,s)},K=l=>{V(l)},Q=l=>{W(c,l)},U=l=>{B(c,l),t.current=[],m([]),p([])},X=l=>{F(c,l),t.current=[],m([]),p([])},$=l=>{Y(l)},R=()=>T.renderCustomElement(T.getCustomRender("ACTIONS_TOOLBAR",y),{...r,size:r!=null&&r.size?r.size:u,color:r!=null&&r.color?r.color:a,className:"table-view-toolbar-lnc "+(r==null?void 0:r.className)},y)||b.jsx(re,{...r,className:"table-view-toolbar-lnc "+(r==null?void 0:r.className),size:r!=null&&r.size?r.size:u,color:r!=null&&r.color?r.color:a,selectedRowsLength:c!=null&&c.length?c.length:0,onCreate:K,onCopy:Q,onEdit:U,onDelete:X,actionsDropdownZIndex:k,actionDropdownProps:L,actionsDropdownPlacement:I,selectedRows:t==null?void 0:t.current}),ee=()=>T.renderCustomElement(T.getCustomRender("TABLE",y),{...o,size:o!=null&&o.size?o.size:u,color:o!=null&&o.color?o.color:a,className:"table-view-pagination-lnc "+(o==null?void 0:o.className)},y)||b.jsx(le.default,{size:o!=null&&o.size?o.size:u,color:o!=null&&o.color?o.color:a,EnableSelection:(w||d)&&S==!1,onSelectRow:(l,s,i)=>G(s,!i),SelectedData:c,onRowClick:(l,s)=>H(l,s),...o}),oe=()=>T.renderCustomElement(T.getCustomRender("PAGINATION",y),{...n,size:n!=null&&n.size?n.size:u,color:n!=null&&n.color?n.color:a,className:"table-view-pagination-lnc "+(n==null?void 0:n.className)},y)||b.jsx(te,{...n,size:n!=null&&n.size?n.size:u,color:n!=null&&n.color?n.color:a,className:"table-view-pagination-lnc "+(n==null?void 0:n.className),onPageChange:$});return b.jsxs(se,{ref:E,...Z,children:[R(),ee(),q==!0&&oe()]})});h.propTypes={__TYPE__:e.PropTypes.string,tableProps:e.PropTypes.object,actionsToolbarProps:e.PropTypes.object,paginationProps:e.PropTypes.object,rowsSingleSelect:e.PropTypes.bool,rowsMultiSelect:e.PropTypes.bool,loading:e.PropTypes.bool,showCreate:e.PropTypes.bool,actionsDropdownZIndex:e.PropTypes.any,actionsDropdownPlacement:e.PropTypes.any,enableCreate:e.PropTypes.bool,enableDetails:e.PropTypes.bool,showEdit:e.PropTypes.bool,enableEditOnSelection:e.PropTypes.bool,showDelete:e.PropTypes.bool,enableDeleteOnSelection:e.PropTypes.bool,showCopy:e.PropTypes.bool,enableCopyOnSelection:e.PropTypes.bool,customActions:e.PropTypes.array,pagination:e.PropTypes.bool,readOnly:e.PropTypes.bool,onCreate:e.PropTypes.func,onEdit:e.PropTypes.func,onDelete:e.PropTypes.func,onDetails:e.PropTypes.func,onCopy:e.PropTypes.func,onFilter:e.PropTypes.func,onSort:e.PropTypes.func,onPageChange:e.PropTypes.func,className:e.PropTypes.string,style:e.PropTypes.object,size:e.PropTypes.oneOf(["small","medium","large"]),color:e.PropTypes.oneOf(["primary","secondary","success","danger","warning","information","neutral","gray"])};h.displayName="TABLE_VIEW";module.exports=h;
package/dist/TableView.js CHANGED
@@ -1,169 +1,173 @@
1
- import { jsxs as ee, jsx as f } from "react/jsx-runtime";
2
- import { forwardRef as oe, useState as ne } from "react";
1
+ import { jsxs as oe, jsx as C } from "react/jsx-runtime";
2
+ import { forwardRef as le, useState as te, useRef as ce } from "react";
3
3
  import { P as e } from "./index-BYnWp42a.js";
4
- import { n as le } from "./emotion-styled.browser.esm-BiK8DcgW.js";
5
- import te from "./ActionsToolbar.js";
6
- import ce from "./Pagination.js";
7
- import { r as h, i as C } from "./utils-C52T57HO.js";
8
- import ae from "./Table.js";
9
- const ie = le.div`
4
+ import { n as re } from "./emotion-styled.browser.esm-BiK8DcgW.js";
5
+ import ae from "./ActionsToolbar.js";
6
+ import ie from "./Pagination.js";
7
+ import { r as g, i as w } from "./utils-C52T57HO.js";
8
+ import se from "./Table.js";
9
+ const me = re.div`
10
10
  & .table-view-pagination-lnc {
11
11
  padding: 0 0.625rem;
12
12
  }
13
13
  & .table-view-toolbar-lnc {
14
14
  margin: 0 0.625rem;
15
15
  }
16
- `, g = oe((S, z) => {
16
+ `, z = le((D, E) => {
17
17
  const {
18
- __TYPE__: se = "TABLE_VIEW",
19
- goToPreviousView: re,
20
- tableProps: o = {},
21
- paginationProps: n = {},
22
- actionsToolbarProps: D = {},
23
- rowsSingleSelect: b = !0,
24
- rowsMultiSelect: w = !1,
25
- loading: me = !1,
26
- showCreate: E = !0,
27
- enableCreate: T = !0,
28
- enableDetails: de = !0,
29
- showEdit: N,
30
- enableEditOnSelection: O,
31
- showDelete: R = !0,
32
- enableDeleteOnSelection: _ = !0,
33
- showCopy: A = !0,
34
- enableCopyOnSelection: v = !0,
35
- customActions: k,
36
- pagination: I = !0,
37
- readOnly: y = !1,
38
- actionsDropdownZIndex: j = null,
39
- actionsDropdownPlacement: x = null,
40
- actionDropdownProps: L,
18
+ __TYPE__: ue = "TABLE_VIEW",
19
+ goToPreviousView: de,
20
+ tableProps: n = {},
21
+ paginationProps: o = {},
22
+ actionsToolbarProps: T = {},
23
+ rowsSingleSelect: S = !0,
24
+ rowsMultiSelect: b = !1,
25
+ loading: be = !1,
26
+ showCreate: N = !0,
27
+ enableCreate: O = !0,
28
+ enableDetails: he = !0,
29
+ showEdit: _,
30
+ enableEditOnSelection: A,
31
+ showDelete: v = !0,
32
+ enableDeleteOnSelection: k = !0,
33
+ showCopy: I = !0,
34
+ enableCopyOnSelection: j = !0,
35
+ customActions: x,
36
+ pagination: L = !0,
37
+ readOnly: f = !1,
38
+ actionsDropdownZIndex: V = null,
39
+ actionsDropdownPlacement: B = null,
40
+ actionDropdownProps: F,
41
41
  //----------------
42
- onCreate: V = () => {
42
+ onCreate: M = () => {
43
43
  },
44
- onEdit: B = () => {
44
+ onEdit: W = () => {
45
45
  },
46
- onDelete: F = () => {
46
+ onDelete: Y = () => {
47
47
  },
48
- onDetails: M = () => {
48
+ onDetails: Z = () => {
49
49
  },
50
- onCopy: W = () => {
50
+ onCopy: p = () => {
51
51
  },
52
- onFilter: ue = () => {
52
+ onFilter: ye = () => {
53
53
  },
54
- onSort: we = () => {
54
+ onSort: Ce = () => {
55
55
  },
56
- onPageChange: Y = () => {
56
+ onPageChange: G = () => {
57
57
  },
58
- onEmptyRowsSelection: fe = () => {
58
+ onEmptyRowsSelection: ge = () => {
59
59
  },
60
60
  //------------------
61
- className: he = "",
62
- style: Ce = {},
63
- color: i = "primary",
64
- size: s = "small",
65
- children: r,
66
- ...Z
67
- } = S, l = {
68
- ...D,
69
- showCreate: E,
70
- enableCreate: T,
71
- showCopy: A,
72
- enableCopyOnSelection: v,
73
- showEdit: N,
74
- enableEditOnSelection: O,
75
- showDelete: R,
76
- enableDeleteOnSelection: _,
77
- customActions: k,
78
- readOnly: y
79
- }, [a, m] = ne([]), p = (t, c) => {
80
- c ? w ? m([...a, t]) : b && m([t]) : m(w ? (d) => d.filter((u) => u != t) : []);
81
- }, G = (t, c) => {
82
- var d, u;
83
- ((d = t.target) == null ? void 0 : d.type) !== "checkbox" && ((u = t.target) == null ? void 0 : u.className) !== "checkmark" && (o != null && o.onRowClick && o.onRowClick(t, c), q(c, t));
84
- }, q = (t, c) => {
85
- M(t, c);
86
- }, H = (t) => {
87
- V(t);
88
- }, J = (t) => {
89
- W(a, t);
90
- }, K = (t) => {
91
- B(a, t), m([]);
92
- }, Q = (t) => {
93
- F(a, t), m([]);
94
- }, U = (t) => {
95
- Y(t);
96
- }, X = () => h(
97
- C("ACTIONS_TOOLBAR", r),
61
+ className: we = "",
62
+ style: Se = {},
63
+ color: s = "primary",
64
+ size: m = "small",
65
+ children: u,
66
+ onChangeRowsSelection: d = () => {
67
+ },
68
+ ...q
69
+ } = D, l = {
70
+ ...T,
71
+ showCreate: N,
72
+ enableCreate: O,
73
+ showCopy: I,
74
+ enableCopyOnSelection: j,
75
+ showEdit: _,
76
+ enableEditOnSelection: A,
77
+ showDelete: v,
78
+ enableDeleteOnSelection: k,
79
+ customActions: x,
80
+ readOnly: f
81
+ }, [a, h] = te([]), t = ce([]), H = (c, r) => {
82
+ var i;
83
+ r ? (b || S) && (t.current = b ? [...t.current, c] : [c], d(t == null ? void 0 : t.current), h(t == null ? void 0 : t.current)) : (t.current = b ? (i = t == null ? void 0 : t.current) == null ? void 0 : i.filter((y) => y != c) : [], d == null || d(t == null ? void 0 : t.current), h(t == null ? void 0 : t.current));
84
+ }, J = (c, r) => {
85
+ var i, y;
86
+ ((i = c.target) == null ? void 0 : i.type) !== "checkbox" && ((y = c.target) == null ? void 0 : y.className) !== "checkmark" && (n != null && n.onRowClick && n.onRowClick(c, r), K(r, c));
87
+ }, K = (c, r) => {
88
+ Z(c, r);
89
+ }, Q = (c) => {
90
+ M(c);
91
+ }, U = (c) => {
92
+ p(a, c);
93
+ }, X = (c) => {
94
+ W(a, c), t.current = [], h([]), d([]);
95
+ }, $ = (c) => {
96
+ Y(a, c), t.current = [], h([]), d([]);
97
+ }, R = (c) => {
98
+ G(c);
99
+ }, P = () => g(
100
+ w("ACTIONS_TOOLBAR", u),
98
101
  {
99
102
  ...l,
100
- size: l != null && l.size ? l.size : s,
101
- color: l != null && l.color ? l.color : i,
103
+ size: l != null && l.size ? l.size : m,
104
+ color: l != null && l.color ? l.color : s,
102
105
  className: "table-view-toolbar-lnc " + (l == null ? void 0 : l.className)
103
106
  },
104
- r
105
- ) || /* @__PURE__ */ f(
106
- te,
107
+ u
108
+ ) || /* @__PURE__ */ C(
109
+ ae,
107
110
  {
108
111
  ...l,
109
112
  className: "table-view-toolbar-lnc " + (l == null ? void 0 : l.className),
110
- size: l != null && l.size ? l.size : s,
111
- color: l != null && l.color ? l.color : i,
113
+ size: l != null && l.size ? l.size : m,
114
+ color: l != null && l.color ? l.color : s,
112
115
  selectedRowsLength: a != null && a.length ? a.length : 0,
113
- onCreate: H,
114
- onCopy: J,
115
- onEdit: K,
116
- onDelete: Q,
117
- actionsDropdownZIndex: j,
118
- actionDropdownProps: L,
119
- actionsDropdownPlacement: x
116
+ onCreate: Q,
117
+ onCopy: U,
118
+ onEdit: X,
119
+ onDelete: $,
120
+ actionsDropdownZIndex: V,
121
+ actionDropdownProps: F,
122
+ actionsDropdownPlacement: B,
123
+ selectedRows: t == null ? void 0 : t.current
120
124
  }
121
- ), $ = () => h(
122
- C("TABLE", r),
125
+ ), ee = () => g(
126
+ w("TABLE", u),
123
127
  {
124
- ...o,
125
- size: o != null && o.size ? o.size : s,
126
- color: o != null && o.color ? o.color : i,
127
- className: "table-view-pagination-lnc " + (o == null ? void 0 : o.className)
128
+ ...n,
129
+ size: n != null && n.size ? n.size : m,
130
+ color: n != null && n.color ? n.color : s,
131
+ className: "table-view-pagination-lnc " + (n == null ? void 0 : n.className)
128
132
  },
129
- r
130
- ) || /* @__PURE__ */ f(
131
- ae,
133
+ u
134
+ ) || /* @__PURE__ */ C(
135
+ se,
132
136
  {
133
- size: o != null && o.size ? o.size : s,
134
- color: o != null && o.color ? o.color : i,
135
- EnableSelection: (b || w) && y == !1,
136
- onSelectRow: (t, c, d) => p(c, !d),
137
+ size: n != null && n.size ? n.size : m,
138
+ color: n != null && n.color ? n.color : s,
139
+ EnableSelection: (S || b) && f == !1,
140
+ onSelectRow: (c, r, i) => H(r, !i),
137
141
  SelectedData: a,
138
- onRowClick: (t, c) => G(t, c),
139
- ...o
142
+ onRowClick: (c, r) => J(c, r),
143
+ ...n
140
144
  }
141
- ), P = () => h(
142
- C("PAGINATION", r),
145
+ ), ne = () => g(
146
+ w("PAGINATION", u),
143
147
  {
144
- ...n,
145
- size: n != null && n.size ? n.size : s,
146
- color: n != null && n.color ? n.color : i,
147
- className: "table-view-pagination-lnc " + (n == null ? void 0 : n.className)
148
+ ...o,
149
+ size: o != null && o.size ? o.size : m,
150
+ color: o != null && o.color ? o.color : s,
151
+ className: "table-view-pagination-lnc " + (o == null ? void 0 : o.className)
148
152
  },
149
- r
150
- ) || /* @__PURE__ */ f(
151
- ce,
153
+ u
154
+ ) || /* @__PURE__ */ C(
155
+ ie,
152
156
  {
153
- ...n,
154
- size: n != null && n.size ? n.size : s,
155
- color: n != null && n.color ? n.color : i,
156
- className: "table-view-pagination-lnc " + (n == null ? void 0 : n.className),
157
- onPageChange: U
157
+ ...o,
158
+ size: o != null && o.size ? o.size : m,
159
+ color: o != null && o.color ? o.color : s,
160
+ className: "table-view-pagination-lnc " + (o == null ? void 0 : o.className),
161
+ onPageChange: R
158
162
  }
159
163
  );
160
- return /* @__PURE__ */ ee(ie, { ref: z, ...Z, children: [
161
- X(),
162
- $(),
163
- I == !0 && P()
164
+ return /* @__PURE__ */ oe(me, { ref: E, ...q, children: [
165
+ P(),
166
+ ee(),
167
+ L == !0 && ne()
164
168
  ] });
165
169
  });
166
- g.propTypes = {
170
+ z.propTypes = {
167
171
  __TYPE__: e.string,
168
172
  tableProps: e.object,
169
173
  actionsToolbarProps: e.object,
@@ -234,7 +238,7 @@ g.propTypes = {
234
238
  "gray"
235
239
  ])
236
240
  };
237
- g.displayName = "TABLE_VIEW";
241
+ z.displayName = "TABLE_VIEW";
238
242
  export {
239
- g as default
243
+ z as default
240
244
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lanaco/lnc-react-ui",
3
- "version": "4.0.19",
3
+ "version": "4.0.21",
4
4
  "description": "React component library",
5
5
  "type": "module",
6
6
  "keywords": [