@lax-wp/design-system 0.13.65 → 0.13.67
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/components/data-display/infinite-table/body/cell/RowActionCell.cjs.js +1 -1
- package/dist/components/data-display/infinite-table/body/cell/RowActionCell.cjs.js.map +1 -1
- package/dist/components/data-display/infinite-table/body/cell/RowActionCell.es.js +9 -9
- package/dist/components/data-display/infinite-table/body/cell/RowActionCell.es.js.map +1 -1
- package/dist/components/data-display/infinite-table/body/cell/RowOptionsCell.cjs.js +1 -1
- package/dist/components/data-display/infinite-table/body/cell/RowOptionsCell.cjs.js.map +1 -1
- package/dist/components/data-display/infinite-table/body/cell/RowOptionsCell.es.js +1 -1
- package/dist/components/data-display/infinite-table/body/cell/RowOptionsCell.es.js.map +1 -1
- package/dist/components/data-display/infinite-table/index.cjs.js +1 -1
- package/dist/components/data-display/infinite-table/index.cjs.js.map +1 -1
- package/dist/components/data-display/infinite-table/index.d.ts +1 -1
- package/dist/components/data-display/infinite-table/index.es.js +589 -604
- package/dist/components/data-display/infinite-table/index.es.js.map +1 -1
- package/dist/components/data-display/infinite-table/types.d.ts +1 -4
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react/jsx-runtime"),q=require("../../../../tooltip/Tooltip.cjs.js"),S=require("../../../../../providers/design-system-provider/hooks.cjs.js"),j=require("../../../../../_virtual/index.cjs.js"),x=require("react"),T=({disableOptionsForRowIndex:C,tableActions:g,index:l,is_read:f,showNewItem:k,is_modified:p,is_row_modified:i,is_deleted:c,currentData:e,is_added:o,rowData:d,id:s,rowHovering:t,isDisabled:n,bgColor:b,is_incomplete:m,isInlineEditing:r,rowHasPendingEdits:a})=>{const R=S.useTableConfig()?.t?.("Save or cancel pending changes first")??"Save or cancel pending changes first",h=x.useMemo(()=>r?"bg-primary-50 dark:bg-primary-900":b||(c||e?.is_deleted?"bg-error-100 dark:bg-error-975":m||p||i||e?.is_row_modified?"bg-warning-50 dark:bg-black-500":o||e?.is_added?"bg-success-50 dark:bg-success-900":!f&&k&&!n?"bg-primary-50 dark:bg-black-700":"bg-white dark:bg-black-800"),[m,f,k,p,i,c,e,o,b,r,n]),y=C===l||n||a;return u.jsxs("td",{"aria-disabled":y,className:j("px-2.5 relative h-row",h,y&&"cursor-not-allowed opacity-50"),children:[g(d,l),u.jsx(q,{title:a?R:"",children:u.jsx("div",{className:j("absolute top-0 left-0 flex items-center justify-center w-full z-20",{[h]:t!==s||r},{"bg-warning-100 dark:bg-warning-900":t===s&&!r&&!(c||e?.is_deleted)&&!(o||e?.is_added)},{"bg-error-200 dark:bg-error-900":t===s&&!r&&(c||e?.is_deleted)},{"bg-success-100 dark:bg-success-800":t===s&&!r&&(o||e?.is_added)},a&&"pointer-events-none"),children:g(d,l)})})]})},v=x.memo(T);exports.RowActionCell=v;
|
|
2
2
|
//# sourceMappingURL=RowActionCell.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RowActionCell.cjs.js","sources":["../../../../../../src/components/data-display/infinite-table/body/cell/RowActionCell.tsx"],"sourcesContent":["import Tooltip from '../../../../tooltip/Tooltip';\nimport { useTableConfig } from '../../../../../providers/design-system-provider/hooks';\nimport cn from 'classnames';\nimport React, { useMemo } from 'react';\n\ntype TProps = {\n disableOptionsForRowIndex: number | null;\n tableActions: (rowData: Record<string, unknown>, index: number) => JSX.Element;\n index: number;\n is_read: boolean;\n showNewItem: boolean;\n is_modified: boolean;\n is_row_modified: boolean;\n is_deleted: boolean;\n currentData: Record<string, unknown>;\n is_added: boolean;\n rowData: Record<string, unknown>;\n id: string | number;\n rowHovering: string | number | null;\n isDisabled?: boolean;\n bgColor?: string;\n is_incomplete: boolean;\n isInlineEditing?: boolean;\n rowHasPendingEdits?: boolean;\n};\n\nconst RowActionCellInner: React.FC<TProps> = ({\n disableOptionsForRowIndex,\n tableActions,\n index,\n is_read,\n showNewItem,\n is_modified,\n is_row_modified,\n is_deleted,\n currentData,\n is_added,\n rowData,\n id,\n rowHovering,\n isDisabled,\n bgColor,\n is_incomplete,\n isInlineEditing,\n rowHasPendingEdits,\n}) => {\n const tableConfig = useTableConfig();\n const pendingEditsTooltip = tableConfig?.t?.('Save or cancel pending changes first') ?? 'Save or cancel pending changes first';\n\n const backgroundColorClass = useMemo(() => {\n if (isInlineEditing) return 'bg-primary-50 dark:bg-primary-900';\n if (bgColor) return bgColor;\n if (is_deleted || currentData?.is_deleted) return 'bg-error-100 dark:bg-error-975';\n if (is_incomplete || is_modified || is_row_modified || currentData?.is_row_modified) return 'bg-warning-50 dark:bg-
|
|
1
|
+
{"version":3,"file":"RowActionCell.cjs.js","sources":["../../../../../../src/components/data-display/infinite-table/body/cell/RowActionCell.tsx"],"sourcesContent":["import Tooltip from '../../../../tooltip/Tooltip';\nimport { useTableConfig } from '../../../../../providers/design-system-provider/hooks';\nimport cn from 'classnames';\nimport React, { useMemo } from 'react';\n\ntype TProps = {\n disableOptionsForRowIndex: number | null;\n tableActions: (rowData: Record<string, unknown>, index: number) => JSX.Element;\n index: number;\n is_read: boolean;\n showNewItem: boolean;\n is_modified: boolean;\n is_row_modified: boolean;\n is_deleted: boolean;\n currentData: Record<string, unknown>;\n is_added: boolean;\n rowData: Record<string, unknown>;\n id: string | number;\n rowHovering: string | number | null;\n isDisabled?: boolean;\n bgColor?: string;\n is_incomplete: boolean;\n isInlineEditing?: boolean;\n rowHasPendingEdits?: boolean;\n};\n\nconst RowActionCellInner: React.FC<TProps> = ({\n disableOptionsForRowIndex,\n tableActions,\n index,\n is_read,\n showNewItem,\n is_modified,\n is_row_modified,\n is_deleted,\n currentData,\n is_added,\n rowData,\n id,\n rowHovering,\n isDisabled,\n bgColor,\n is_incomplete,\n isInlineEditing,\n rowHasPendingEdits,\n}) => {\n const tableConfig = useTableConfig();\n const pendingEditsTooltip = tableConfig?.t?.('Save or cancel pending changes first') ?? 'Save or cancel pending changes first';\n\n const backgroundColorClass = useMemo(() => {\n if (isInlineEditing) return 'bg-primary-50 dark:bg-primary-900';\n if (bgColor) return bgColor;\n if (is_deleted || currentData?.is_deleted) return 'bg-error-100 dark:bg-error-975';\n if (is_incomplete || is_modified || is_row_modified || currentData?.is_row_modified) return 'bg-warning-50 dark:bg-black-500';\n if (is_added || currentData?.is_added) return 'bg-success-50 dark:bg-success-900';\n if (!is_read && showNewItem && !isDisabled) return 'bg-primary-50 dark:bg-black-700';\n return 'bg-white dark:bg-black-800';\n }, [is_incomplete, is_read, showNewItem, is_modified, is_row_modified, is_deleted, currentData, is_added, bgColor, isInlineEditing, isDisabled]);\n\n const isRowDisabled = disableOptionsForRowIndex === index || isDisabled || rowHasPendingEdits;\n\n return (\n <td aria-disabled={isRowDisabled} className={cn('px-2.5 relative h-row', backgroundColorClass, isRowDisabled && 'cursor-not-allowed opacity-50')}>\n {tableActions(rowData, index)}\n <Tooltip title={rowHasPendingEdits ? pendingEditsTooltip : ''}>\n <div\n className={cn(\n 'absolute top-0 left-0 flex items-center justify-center w-full z-20',\n { [backgroundColorClass]: rowHovering !== id || isInlineEditing },\n { 'bg-warning-100 dark:bg-warning-900': rowHovering === id && !isInlineEditing && !(is_deleted || currentData?.is_deleted) && !(is_added || currentData?.is_added) },\n { 'bg-error-200 dark:bg-error-900': rowHovering === id && !isInlineEditing && (is_deleted || currentData?.is_deleted) },\n { 'bg-success-100 dark:bg-success-800': rowHovering === id && !isInlineEditing && (is_added || currentData?.is_added) },\n rowHasPendingEdits && 'pointer-events-none',\n )}\n >\n {tableActions(rowData, index)}\n </div>\n </Tooltip>\n </td>\n );\n};\n\nexport const RowActionCell = React.memo(RowActionCellInner);\n"],"names":["RowActionCellInner","disableOptionsForRowIndex","tableActions","index","is_read","showNewItem","is_modified","is_row_modified","is_deleted","currentData","is_added","rowData","id","rowHovering","isDisabled","bgColor","is_incomplete","isInlineEditing","rowHasPendingEdits","pendingEditsTooltip","useTableConfig","backgroundColorClass","useMemo","isRowDisabled","jsxs","cn","jsx","Tooltip","RowActionCell","React"],"mappings":"oTA0BMA,EAAuC,CAAC,CAC5C,0BAAAC,EACA,aAAAC,EAAA,MACAC,EACA,QAAAC,EACA,YAAAC,EACA,YAAAC,EACA,gBAAAC,EACA,WAAAC,EACA,YAAAC,EACA,SAAAC,EACA,QAAAC,EACA,GAAAC,EACA,YAAAC,EACA,WAAAC,EACA,QAAAC,EACA,cAAAC,EACA,gBAAAC,EACA,mBAAAC,CACF,IAAM,CAEJ,MAAMC,EADcC,EAAAA,eAAA,GACqB,IAAI,sCAAsC,GAAK,uCAElFC,EAAuBC,EAAAA,QAAQ,IAC/BL,EAAwB,oCACxBF,IACAP,GAAcC,GAAa,WAAmB,iCAC9CO,GAAiBV,GAAeC,GAAmBE,GAAa,gBAAwB,kCACxFC,GAAYD,GAAa,SAAiB,oCAC1C,CAACL,GAAWC,GAAe,CAACS,EAAmB,kCAC5C,8BACN,CAACE,EAAeZ,EAASC,EAAaC,EAAaC,EAAiBC,EAAYC,EAAaC,EAAUK,EAASE,EAAiBH,CAAU,CAAC,EAEzIS,EAAgBtB,IAA8BE,GAASW,GAAcI,EAE3E,OACEM,EAAAA,KAAC,KAAA,CAAG,gBAAeD,EAAe,UAAWE,EAAG,wBAAyBJ,EAAsBE,GAAiB,+BAA+B,EAC5I,SAAA,CAAArB,EAAaS,EAASR,CAAK,EAC5BuB,EAAAA,IAACC,EAAA,CAAQ,MAAOT,EAAqBC,EAAsB,GACzD,SAAAO,EAAAA,IAAC,MAAA,CACC,UAAWD,EACT,qEACA,CAAE,CAACJ,CAAoB,EAAGR,IAAgBD,GAAMK,CAAA,EAChD,CAAE,qCAAsCJ,IAAgBD,GAAM,CAACK,GAAmB,EAAET,GAAcC,GAAa,aAAe,EAAEC,GAAYD,GAAa,SAAA,EACzJ,CAAE,iCAAkCI,IAAgBD,GAAM,CAACK,IAAoBT,GAAcC,GAAa,WAAA,EAC1G,CAAE,qCAAsCI,IAAgBD,GAAM,CAACK,IAAoBP,GAAYD,GAAa,SAAA,EAC5GS,GAAsB,qBAAA,EAGvB,SAAAhB,EAAaS,EAASR,CAAK,CAAA,CAAA,CAC9B,CACF,CAAA,EACF,CAEJ,EAEayB,EAAgBC,EAAM,KAAK7B,CAAkB"}
|
|
@@ -6,10 +6,10 @@ import w, { useMemo as S } from "react";
|
|
|
6
6
|
const z = ({
|
|
7
7
|
disableOptionsForRowIndex: j,
|
|
8
8
|
tableActions: g,
|
|
9
|
-
index:
|
|
10
|
-
is_read:
|
|
11
|
-
showNewItem:
|
|
12
|
-
is_modified:
|
|
9
|
+
index: l,
|
|
10
|
+
is_read: p,
|
|
11
|
+
showNewItem: m,
|
|
12
|
+
is_modified: n,
|
|
13
13
|
is_row_modified: k,
|
|
14
14
|
is_deleted: o,
|
|
15
15
|
currentData: r,
|
|
@@ -17,15 +17,15 @@ const z = ({
|
|
|
17
17
|
rowData: u,
|
|
18
18
|
id: s,
|
|
19
19
|
rowHovering: b,
|
|
20
|
-
isDisabled:
|
|
21
|
-
bgColor:
|
|
20
|
+
isDisabled: t,
|
|
21
|
+
bgColor: a,
|
|
22
22
|
is_incomplete: h,
|
|
23
23
|
isInlineEditing: e,
|
|
24
24
|
rowHasPendingEdits: f
|
|
25
25
|
}) => {
|
|
26
|
-
const x = v()?.t?.("Save or cancel pending changes first") ?? "Save or cancel pending changes first", y = S(() => e ? "bg-primary-50 dark:bg-primary-900" :
|
|
26
|
+
const x = v()?.t?.("Save or cancel pending changes first") ?? "Save or cancel pending changes first", y = S(() => e ? "bg-primary-50 dark:bg-primary-900" : a || (o || r?.is_deleted ? "bg-error-100 dark:bg-error-975" : h || n || k || r?.is_row_modified ? "bg-warning-50 dark:bg-black-500" : c || r?.is_added ? "bg-success-50 dark:bg-success-900" : !p && m && !t ? "bg-primary-50 dark:bg-black-700" : "bg-white dark:bg-black-800"), [h, p, m, n, k, o, r, c, a, e, t]), C = j === l || t || f;
|
|
27
27
|
return /* @__PURE__ */ T("td", { "aria-disabled": C, className: R("px-2.5 relative h-row", y, C && "cursor-not-allowed opacity-50"), children: [
|
|
28
|
-
g(u,
|
|
28
|
+
g(u, l),
|
|
29
29
|
/* @__PURE__ */ d(i, { title: f ? x : "", children: /* @__PURE__ */ d(
|
|
30
30
|
"div",
|
|
31
31
|
{
|
|
@@ -37,7 +37,7 @@ const z = ({
|
|
|
37
37
|
{ "bg-success-100 dark:bg-success-800": b === s && !e && (c || r?.is_added) },
|
|
38
38
|
f && "pointer-events-none"
|
|
39
39
|
),
|
|
40
|
-
children: g(u,
|
|
40
|
+
children: g(u, l)
|
|
41
41
|
}
|
|
42
42
|
) })
|
|
43
43
|
] });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RowActionCell.es.js","sources":["../../../../../../src/components/data-display/infinite-table/body/cell/RowActionCell.tsx"],"sourcesContent":["import Tooltip from '../../../../tooltip/Tooltip';\nimport { useTableConfig } from '../../../../../providers/design-system-provider/hooks';\nimport cn from 'classnames';\nimport React, { useMemo } from 'react';\n\ntype TProps = {\n disableOptionsForRowIndex: number | null;\n tableActions: (rowData: Record<string, unknown>, index: number) => JSX.Element;\n index: number;\n is_read: boolean;\n showNewItem: boolean;\n is_modified: boolean;\n is_row_modified: boolean;\n is_deleted: boolean;\n currentData: Record<string, unknown>;\n is_added: boolean;\n rowData: Record<string, unknown>;\n id: string | number;\n rowHovering: string | number | null;\n isDisabled?: boolean;\n bgColor?: string;\n is_incomplete: boolean;\n isInlineEditing?: boolean;\n rowHasPendingEdits?: boolean;\n};\n\nconst RowActionCellInner: React.FC<TProps> = ({\n disableOptionsForRowIndex,\n tableActions,\n index,\n is_read,\n showNewItem,\n is_modified,\n is_row_modified,\n is_deleted,\n currentData,\n is_added,\n rowData,\n id,\n rowHovering,\n isDisabled,\n bgColor,\n is_incomplete,\n isInlineEditing,\n rowHasPendingEdits,\n}) => {\n const tableConfig = useTableConfig();\n const pendingEditsTooltip = tableConfig?.t?.('Save or cancel pending changes first') ?? 'Save or cancel pending changes first';\n\n const backgroundColorClass = useMemo(() => {\n if (isInlineEditing) return 'bg-primary-50 dark:bg-primary-900';\n if (bgColor) return bgColor;\n if (is_deleted || currentData?.is_deleted) return 'bg-error-100 dark:bg-error-975';\n if (is_incomplete || is_modified || is_row_modified || currentData?.is_row_modified) return 'bg-warning-50 dark:bg-
|
|
1
|
+
{"version":3,"file":"RowActionCell.es.js","sources":["../../../../../../src/components/data-display/infinite-table/body/cell/RowActionCell.tsx"],"sourcesContent":["import Tooltip from '../../../../tooltip/Tooltip';\nimport { useTableConfig } from '../../../../../providers/design-system-provider/hooks';\nimport cn from 'classnames';\nimport React, { useMemo } from 'react';\n\ntype TProps = {\n disableOptionsForRowIndex: number | null;\n tableActions: (rowData: Record<string, unknown>, index: number) => JSX.Element;\n index: number;\n is_read: boolean;\n showNewItem: boolean;\n is_modified: boolean;\n is_row_modified: boolean;\n is_deleted: boolean;\n currentData: Record<string, unknown>;\n is_added: boolean;\n rowData: Record<string, unknown>;\n id: string | number;\n rowHovering: string | number | null;\n isDisabled?: boolean;\n bgColor?: string;\n is_incomplete: boolean;\n isInlineEditing?: boolean;\n rowHasPendingEdits?: boolean;\n};\n\nconst RowActionCellInner: React.FC<TProps> = ({\n disableOptionsForRowIndex,\n tableActions,\n index,\n is_read,\n showNewItem,\n is_modified,\n is_row_modified,\n is_deleted,\n currentData,\n is_added,\n rowData,\n id,\n rowHovering,\n isDisabled,\n bgColor,\n is_incomplete,\n isInlineEditing,\n rowHasPendingEdits,\n}) => {\n const tableConfig = useTableConfig();\n const pendingEditsTooltip = tableConfig?.t?.('Save or cancel pending changes first') ?? 'Save or cancel pending changes first';\n\n const backgroundColorClass = useMemo(() => {\n if (isInlineEditing) return 'bg-primary-50 dark:bg-primary-900';\n if (bgColor) return bgColor;\n if (is_deleted || currentData?.is_deleted) return 'bg-error-100 dark:bg-error-975';\n if (is_incomplete || is_modified || is_row_modified || currentData?.is_row_modified) return 'bg-warning-50 dark:bg-black-500';\n if (is_added || currentData?.is_added) return 'bg-success-50 dark:bg-success-900';\n if (!is_read && showNewItem && !isDisabled) return 'bg-primary-50 dark:bg-black-700';\n return 'bg-white dark:bg-black-800';\n }, [is_incomplete, is_read, showNewItem, is_modified, is_row_modified, is_deleted, currentData, is_added, bgColor, isInlineEditing, isDisabled]);\n\n const isRowDisabled = disableOptionsForRowIndex === index || isDisabled || rowHasPendingEdits;\n\n return (\n <td aria-disabled={isRowDisabled} className={cn('px-2.5 relative h-row', backgroundColorClass, isRowDisabled && 'cursor-not-allowed opacity-50')}>\n {tableActions(rowData, index)}\n <Tooltip title={rowHasPendingEdits ? pendingEditsTooltip : ''}>\n <div\n className={cn(\n 'absolute top-0 left-0 flex items-center justify-center w-full z-20',\n { [backgroundColorClass]: rowHovering !== id || isInlineEditing },\n { 'bg-warning-100 dark:bg-warning-900': rowHovering === id && !isInlineEditing && !(is_deleted || currentData?.is_deleted) && !(is_added || currentData?.is_added) },\n { 'bg-error-200 dark:bg-error-900': rowHovering === id && !isInlineEditing && (is_deleted || currentData?.is_deleted) },\n { 'bg-success-100 dark:bg-success-800': rowHovering === id && !isInlineEditing && (is_added || currentData?.is_added) },\n rowHasPendingEdits && 'pointer-events-none',\n )}\n >\n {tableActions(rowData, index)}\n </div>\n </Tooltip>\n </td>\n );\n};\n\nexport const RowActionCell = React.memo(RowActionCellInner);\n"],"names":["RowActionCellInner","disableOptionsForRowIndex","tableActions","index","is_read","showNewItem","is_modified","is_row_modified","is_deleted","currentData","is_added","rowData","id","rowHovering","isDisabled","bgColor","is_incomplete","isInlineEditing","rowHasPendingEdits","pendingEditsTooltip","useTableConfig","backgroundColorClass","useMemo","isRowDisabled","jsxs","cn","jsx","Tooltip","RowActionCell","React"],"mappings":";;;;;AA0BA,MAAMA,IAAuC,CAAC;AAAA,EAC5C,2BAAAC;AAAA,EACA,cAAAC;AAAA,EACA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E,sCAAsCI,MAAgBD,KAAM,CAACK,MAAoBP,KAAYD,GAAa,UAAA;AAAA,UAC5GS,KAAsB;AAAA,QAAA;AAAA,QAGvB,UAAAhB,EAAaS,GAASR,CAAK;AAAA,MAAA;AAAA,IAAA,EAC9B,CACF;AAAA,EAAA,GACF;AAEJ,GAEayB,IAAgBC,EAAM,KAAK7B,CAAkB;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),S=require("../../../../button/ButtonThreeDots.cjs.js"),X=require("../../../../tooltip/Tooltip.cjs.js"),Y=require("../../../../../providers/design-system-provider/hooks.cjs.js"),v=require("@mui/icons-material"),Z=require("antd"),$=require("../../../../../_virtual/index.cjs.js"),a=require("react"),E=require("../../context.cjs.js"),H=require("./SpinnerCell.cjs.js"),I=require("../../../skeleton/loaders/SingleLineLoader.cjs.js"),ee=({rowId:s,rowOptions:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),S=require("../../../../button/ButtonThreeDots.cjs.js"),X=require("../../../../tooltip/Tooltip.cjs.js"),Y=require("../../../../../providers/design-system-provider/hooks.cjs.js"),v=require("@mui/icons-material"),Z=require("antd"),$=require("../../../../../_virtual/index.cjs.js"),a=require("react"),E=require("../../context.cjs.js"),H=require("./SpinnerCell.cjs.js"),I=require("../../../skeleton/loaders/SingleLineLoader.cjs.js"),ee=({rowId:s,rowOptions:l,disableOption:g,rowHovering:r,is_read:R,showNewItem:N,is_modified:T,is_row_modified:L,currentData:o,is_deleted:i,is_added:d,isDraggingOver:F,rowAdditionalActions:x,rowData:w,index:n,bgColor:k,setRowHovering:c,is_incomplete:m,isInlineEditing:t,onConfirmEdit:B,onCancelEdit:P,rowHasPendingEdits:M})=>{const f=Y.useTableConfig(),j=$({"bg-primary-50 dark:bg-primary-900":t,"bg-neutral-100 dark:bg-black-600":r===s&&!t&&!(i||o?.is_deleted)&&!(d||o?.is_added),"bg-error-200 dark:bg-error-900":r===s&&!t&&(i||o?.is_deleted),"bg-success-100 dark:bg-success-800":r===s&&!t&&(d||o?.is_added),"bg-primary-50 dark:bg-black-700":!m&&!R&&N&&r!==s&&!t,"bg-warning-50 dark:bg-black-500":(m||T||L||o?.is_row_modified)&&r!==s&&!t,"bg-error-100 dark:bg-error-975":(i||o?.is_deleted)&&r!==s&&!t,"bg-success-50 dark:bg-success-900":(d||o?.is_added)&&r!==s&&!t,"bg-primary-50":F&&!t,...k&&!t&&{[k]:!0}}),_=a.useCallback(()=>c(s),[c,s]),A=a.useCallback(()=>c(null),[c]),{asyncRowOptionsFilter:p,disableOptionsForRowIndex:u=null,fieldOperationLoading:V}=a.useContext(E.TableContext),z=f?.t?.("Save or cancel pending changes first")??"Save or cancel pending changes first",D=f?.getRowOptionsDropdownProps?.(),b=!!V,[G,y]=a.useState(!!p),[J,C]=a.useState(l),K=l?l.filter(h=>h.isVisible!==!1).length:0,Q=async h=>{if(y(!0),h&&p)try{const O=await p(s),W=l?l.filter(q=>Object.keys(O).includes(q.key)?O[q.key]:!0):[];C(W)}catch{C([])}y(!1)},U=e.jsx("div",{className:"min-w-[140px] max-w-[200px] justify-start whitespace-nowrap items-center py-2 px-1 gap-2","aria-disabled":!0,children:e.jsx(I,{repeat:l?.length||1,lineHeight:"15px"})});return e.jsx("td",{className:`sticky left-0 right-0 z-10 ${j||"bg-white dark:bg-black-800"} h-row`,onMouseEnter:_,onMouseLeave:A,children:e.jsxs("div",{className:"h-full gap-2 top-0 font-medium font-inter overflow-hidden whitespace-nowrap text-ellipsis px-1 w-full flex items-center",children:[e.jsx("div",{className:`${u===n?"opacity-50":""}`,"aria-disabled":u===n,children:x?x(w,n,r===s):null}),t?e.jsxs("div",{className:`flex items-center gap-2 ${b?"pointer-events-none opacity-50":""}`,children:[e.jsx("div",{className:"cursor-pointer hover:bg-neutral-100 dark:hover:bg-black-600 rounded p-0.5",onClick:()=>!b&&P?.(),children:e.jsx(v.CloseRounded,{sx:{height:20,width:20,color:"#667085"}})}),e.jsx("div",{className:"cursor-pointer hover:bg-neutral-100 dark:hover:bg-black-600 rounded p-0.5",onClick:()=>!b&&B?.(),children:e.jsx(v.CheckRounded,{sx:{height:20,width:20,color:"var(--color-primary-600)"}})})]}):l?e.jsx(e.Fragment,{children:u===n?e.jsx(H.SpinnerCell,{}):M?e.jsx(X,{title:z,children:e.jsx("span",{children:e.jsx(S.ButtonThreeDots,{disabled:!0})})}):e.jsx(Z.Dropdown,{menu:{items:G?[{label:U,key:"loading"}]:J},trigger:["click"],overlayClassName:"row-option-cell table-row-option-dropdown",onOpenChange:Q,disabled:g||K===0,...D||{},children:e.jsx(S.ButtonThreeDots,{disabled:g})})}):null]})})};exports.RowOptionsCell=ee;
|
|
2
2
|
//# sourceMappingURL=RowOptionsCell.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RowOptionsCell.cjs.js","sources":["../../../../../../src/components/data-display/infinite-table/body/cell/RowOptionsCell.tsx"],"sourcesContent":["import { SingleLineLoader } from '../../../../data-display/skeleton/loaders';\nimport { ButtonThreeDots } from '../../../../button/ButtonThreeDots';\nimport Tooltip from '../../../../tooltip/Tooltip';\nimport { useTableConfig } from '../../../../../providers/design-system-provider/hooks';\nimport { CheckRounded, CloseRounded } from '@mui/icons-material';\nimport { Dropdown } from 'antd';\nimport cn from 'classnames';\nimport { useCallback, useContext, useState } from 'react';\n\nimport { TableContext } from '../../context';\nimport { SpinnerCell } from './SpinnerCell';\n\ntype TProps = {\n rowId: string | number;\n rowOptions: Array<{ key: string; label: React.ReactNode; isVisible?: boolean; [k: string]: unknown }>;\n disableOption: boolean;\n rowHovering: string | number | null;\n is_read: boolean;\n showNewItem: boolean;\n is_modified: boolean;\n is_row_modified: boolean;\n currentData: Record<string, unknown>;\n is_deleted: boolean;\n is_added: boolean;\n isDraggingOver: boolean;\n rowData: Record<string, unknown>;\n index: number;\n rowAdditionalActions: (rowData: Record<string, unknown>, index: number, isHovering: boolean) => React.ReactNode;\n bgColor?: string;\n setRowHovering: (rowId: string | number | null) => void;\n is_incomplete?: boolean;\n isInlineEditing?: boolean;\n onConfirmEdit?: () => void;\n onCancelEdit?: () => void;\n rowHasPendingEdits?: boolean;\n};\n\nexport const RowOptionsCell = ({\n rowId, rowOptions, disableOption, rowHovering, is_read, showNewItem, is_modified, is_row_modified, currentData,\n is_deleted, is_added, isDraggingOver, rowAdditionalActions, rowData, index, bgColor: bgColorProp, setRowHovering,\n is_incomplete, isInlineEditing, onConfirmEdit, onCancelEdit, rowHasPendingEdits,\n}: TProps) => {\n const tableConfig = useTableConfig();\n const bgColor = cn({\n 'bg-primary-50 dark:bg-primary-900': isInlineEditing,\n 'bg-neutral-100 dark:bg-black-600': rowHovering === rowId && !isInlineEditing && !(is_deleted || currentData?.is_deleted) && !(is_added || currentData?.is_added),\n 'bg-error-200 dark:bg-error-900': rowHovering === rowId && !isInlineEditing && (is_deleted || currentData?.is_deleted),\n 'bg-success-100 dark:bg-success-800': rowHovering === rowId && !isInlineEditing && (is_added || currentData?.is_added),\n 'bg-primary-50 dark:bg-black-700': !is_incomplete && !is_read && showNewItem && rowHovering !== rowId && !isInlineEditing,\n 'bg-warning-50 dark:bg-orange-900': (is_incomplete || is_modified || is_row_modified || currentData?.is_row_modified) && rowHovering !== rowId && !isInlineEditing,\n 'bg-error-100 dark:bg-error-975': (is_deleted || currentData?.is_deleted) && rowHovering !== rowId && !isInlineEditing,\n 'bg-success-50 dark:bg-success-900': (is_added || currentData?.is_added) && rowHovering !== rowId && !isInlineEditing,\n 'bg-primary-50': isDraggingOver && !isInlineEditing,\n ...(bgColorProp && !isInlineEditing && { [bgColorProp]: true }),\n });\n\n const onMouseEnter = useCallback(() => setRowHovering(rowId), [setRowHovering, rowId]);\n const onMouseLeave = useCallback(() => setRowHovering(null), [setRowHovering]);\n\n const { asyncRowOptionsFilter, disableOptionsForRowIndex = null, fieldOperationLoading } = useContext(TableContext);\n const pendingEditsTooltip = tableConfig?.t?.('Save or cancel pending changes first') ?? 'Save or cancel pending changes first';\n const rowOptionsDropdownProps = tableConfig?.getRowOptionsDropdownProps?.();\n const isAnyFieldOperationLoading = Boolean(fieldOperationLoading);\n const [isOptionLoading, setIsOptionLoading] = useState(!!asyncRowOptionsFilter);\n const [filteredRowOptions, setFilteredRowOptions] = useState(rowOptions);\n const visibleRowOptions = rowOptions ? rowOptions.filter((option) => option.isVisible !== false).length : 0;\n\n const handleDropdownVisibleChange = async (visible: boolean) => {\n setIsOptionLoading(true);\n if (visible && asyncRowOptionsFilter) {\n try {\n const buttonState = await asyncRowOptionsFilter(rowId);\n const filteredOptions = rowOptions ? rowOptions.filter((option) => { const existOnAPI = Object.keys(buttonState).includes(option.key); return existOnAPI ? buttonState[option.key] : true; }) : [];\n setFilteredRowOptions(filteredOptions);\n } catch { setFilteredRowOptions([]); }\n }\n setIsOptionLoading(false);\n };\n\n const getSkeleton = (\n <div className={`min-w-[140px] max-w-[200px] justify-start whitespace-nowrap items-center py-2 px-1 gap-2`} aria-disabled={true}>\n <SingleLineLoader repeat={rowOptions?.length || 1} lineHeight='15px' />\n </div>\n );\n\n return (\n <td className={`sticky left-0 right-0 z-10 ${bgColor ? bgColor : 'bg-white dark:bg-black-800'} h-row`} onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave}>\n <div className={`h-full gap-2 top-0 font-medium font-inter overflow-hidden whitespace-nowrap text-ellipsis px-1 w-full flex items-center`}>\n <div className={`${disableOptionsForRowIndex === index ? 'opacity-50' : ''}`} aria-disabled={disableOptionsForRowIndex === index}>\n {rowAdditionalActions ? rowAdditionalActions(rowData, index, rowHovering === rowId) : null}\n </div>\n {isInlineEditing ? (\n <div className={`flex items-center gap-2 ${isAnyFieldOperationLoading ? 'pointer-events-none opacity-50' : ''}`}>\n <div className='cursor-pointer hover:bg-neutral-100 dark:hover:bg-black-600 rounded p-0.5' onClick={() => !isAnyFieldOperationLoading && onCancelEdit?.()}>\n <CloseRounded sx={{ height: 20, width: 20, color: '#667085' }} />\n </div>\n <div className='cursor-pointer hover:bg-neutral-100 dark:hover:bg-black-600 rounded p-0.5' onClick={() => !isAnyFieldOperationLoading && onConfirmEdit?.()}>\n <CheckRounded sx={{ height: 20, width: 20, color: 'var(--color-primary-600)' }} />\n </div>\n </div>\n ) : rowOptions ? (\n <>\n {disableOptionsForRowIndex === index ? (\n <SpinnerCell />\n ) : rowHasPendingEdits ? (\n <Tooltip title={pendingEditsTooltip}>\n <span><ButtonThreeDots disabled /></span>\n </Tooltip>\n ) : (\n <Dropdown\n menu={{ items: isOptionLoading ? [{ label: getSkeleton, key: 'loading' }] : filteredRowOptions }}\n trigger={['click']}\n overlayClassName='row-option-cell table-row-option-dropdown'\n onOpenChange={handleDropdownVisibleChange}\n disabled={disableOption || visibleRowOptions === 0}\n {...(rowOptionsDropdownProps || {})}\n >\n <ButtonThreeDots disabled={disableOption} />\n </Dropdown>\n )}\n </>\n ) : null}\n </div>\n </td>\n );\n};\n"],"names":["RowOptionsCell","rowId","rowOptions","disableOption","rowHovering","is_read","showNewItem","is_modified","is_row_modified","currentData","is_deleted","is_added","isDraggingOver","rowAdditionalActions","rowData","index","bgColorProp","setRowHovering","is_incomplete","isInlineEditing","onConfirmEdit","onCancelEdit","rowHasPendingEdits","tableConfig","useTableConfig","bgColor","cn","onMouseEnter","useCallback","onMouseLeave","asyncRowOptionsFilter","disableOptionsForRowIndex","fieldOperationLoading","useContext","TableContext","pendingEditsTooltip","rowOptionsDropdownProps","isAnyFieldOperationLoading","isOptionLoading","setIsOptionLoading","useState","filteredRowOptions","setFilteredRowOptions","visibleRowOptions","option","handleDropdownVisibleChange","visible","buttonState","filteredOptions","getSkeleton","jsx","SingleLineLoader","jsxs","CloseRounded","CheckRounded","Fragment","SpinnerCell","Tooltip","ButtonThreeDots","Dropdown"],"mappings":"iiBAqCaA,GAAiB,CAAC,CAC7B,MAAAC,EAAO,WAAAC,EAAY,cAAA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a,GAAI,CAAE,OAAQ,GAAI,MAAO,GAAI,MAAO,WAAa,EACjE,EACAH,MAAC,OAAI,UAAU,4EAA4E,QAAS,IAAM,CAACb,GAA8BjB,IAAA,EACvI,eAACkC,EAAAA,aAAA,CAAa,GAAI,CAAE,OAAQ,GAAI,MAAO,GAAI,MAAO,0BAAA,CAA2B,CAAG,CAAA,CAClF,CAAA,CAAA,CACF,EACEpD,EACFgD,EAAAA,IAAAK,EAAAA,SAAA,CACG,SAAAxB,IAA8BhB,EAC7BmC,EAAAA,IAACM,EAAAA,YAAA,CAAA,CAAY,EACXlC,EACF4B,EAAAA,IAACO,GAAQ,MAAOtB,EACd,eAAC,OAAA,CAAK,SAAAe,EAAAA,IAACQ,EAAAA,iBAAgB,SAAQ,EAAA,CAAC,CAAA,CAAE,CAAA,CACpC,EAEAR,EAAAA,IAACS,EAAAA,SAAA,CACC,KAAM,CAAE,MAAOrB,EAAkB,CAAC,CAAE,MAAOW,EAAa,IAAK,UAAW,EAAIR,CAAA,EAC5E,QAAS,CAAC,OAAO,EACjB,iBAAiB,4CACjB,aAAcI,EACd,SAAU1C,GAAiBwC,IAAsB,EAChD,GAAIP,GAA2B,CAAA,EAEhC,SAAAc,EAAAA,IAACQ,EAAAA,gBAAA,CAAgB,SAAUvD,CAAA,CAAe,CAAA,CAAA,EAGhD,EACE,IAAA,CAAA,CACN,CAAA,CACF,CAEJ"}
|
|
1
|
+
{"version":3,"file":"RowOptionsCell.cjs.js","sources":["../../../../../../src/components/data-display/infinite-table/body/cell/RowOptionsCell.tsx"],"sourcesContent":["import { SingleLineLoader } from '../../../../data-display/skeleton/loaders';\nimport { ButtonThreeDots } from '../../../../button/ButtonThreeDots';\nimport Tooltip from '../../../../tooltip/Tooltip';\nimport { useTableConfig } from '../../../../../providers/design-system-provider/hooks';\nimport { CheckRounded, CloseRounded } from '@mui/icons-material';\nimport { Dropdown } from 'antd';\nimport cn from 'classnames';\nimport { useCallback, useContext, useState } from 'react';\n\nimport { TableContext } from '../../context';\nimport { SpinnerCell } from './SpinnerCell';\n\ntype TProps = {\n rowId: string | number;\n rowOptions: Array<{ key: string; label: React.ReactNode; isVisible?: boolean; [k: string]: unknown }>;\n disableOption: boolean;\n rowHovering: string | number | null;\n is_read: boolean;\n showNewItem: boolean;\n is_modified: boolean;\n is_row_modified: boolean;\n currentData: Record<string, unknown>;\n is_deleted: boolean;\n is_added: boolean;\n isDraggingOver: boolean;\n rowData: Record<string, unknown>;\n index: number;\n rowAdditionalActions: (rowData: Record<string, unknown>, index: number, isHovering: boolean) => React.ReactNode;\n bgColor?: string;\n setRowHovering: (rowId: string | number | null) => void;\n is_incomplete?: boolean;\n isInlineEditing?: boolean;\n onConfirmEdit?: () => void;\n onCancelEdit?: () => void;\n rowHasPendingEdits?: boolean;\n};\n\nexport const RowOptionsCell = ({\n rowId, rowOptions, disableOption, rowHovering, is_read, showNewItem, is_modified, is_row_modified, currentData,\n is_deleted, is_added, isDraggingOver, rowAdditionalActions, rowData, index, bgColor: bgColorProp, setRowHovering,\n is_incomplete, isInlineEditing, onConfirmEdit, onCancelEdit, rowHasPendingEdits,\n}: TProps) => {\n const tableConfig = useTableConfig();\n const bgColor = cn({\n 'bg-primary-50 dark:bg-primary-900': isInlineEditing,\n 'bg-neutral-100 dark:bg-black-600': rowHovering === rowId && !isInlineEditing && !(is_deleted || currentData?.is_deleted) && !(is_added || currentData?.is_added),\n 'bg-error-200 dark:bg-error-900': rowHovering === rowId && !isInlineEditing && (is_deleted || currentData?.is_deleted),\n 'bg-success-100 dark:bg-success-800': rowHovering === rowId && !isInlineEditing && (is_added || currentData?.is_added),\n 'bg-primary-50 dark:bg-black-700': !is_incomplete && !is_read && showNewItem && rowHovering !== rowId && !isInlineEditing,\n 'bg-warning-50 dark:bg-black-500': (is_incomplete || is_modified || is_row_modified || currentData?.is_row_modified) && rowHovering !== rowId && !isInlineEditing,\n 'bg-error-100 dark:bg-error-975': (is_deleted || currentData?.is_deleted) && rowHovering !== rowId && !isInlineEditing,\n 'bg-success-50 dark:bg-success-900': (is_added || currentData?.is_added) && rowHovering !== rowId && !isInlineEditing,\n 'bg-primary-50': isDraggingOver && !isInlineEditing,\n ...(bgColorProp && !isInlineEditing && { [bgColorProp]: true }),\n });\n\n const onMouseEnter = useCallback(() => setRowHovering(rowId), [setRowHovering, rowId]);\n const onMouseLeave = useCallback(() => setRowHovering(null), [setRowHovering]);\n\n const { asyncRowOptionsFilter, disableOptionsForRowIndex = null, fieldOperationLoading } = useContext(TableContext);\n const pendingEditsTooltip = tableConfig?.t?.('Save or cancel pending changes first') ?? 'Save or cancel pending changes first';\n const rowOptionsDropdownProps = tableConfig?.getRowOptionsDropdownProps?.();\n const isAnyFieldOperationLoading = Boolean(fieldOperationLoading);\n const [isOptionLoading, setIsOptionLoading] = useState(!!asyncRowOptionsFilter);\n const [filteredRowOptions, setFilteredRowOptions] = useState(rowOptions);\n const visibleRowOptions = rowOptions ? rowOptions.filter((option) => option.isVisible !== false).length : 0;\n\n const handleDropdownVisibleChange = async (visible: boolean) => {\n setIsOptionLoading(true);\n if (visible && asyncRowOptionsFilter) {\n try {\n const buttonState = await asyncRowOptionsFilter(rowId);\n const filteredOptions = rowOptions ? rowOptions.filter((option) => { const existOnAPI = Object.keys(buttonState).includes(option.key); return existOnAPI ? buttonState[option.key] : true; }) : [];\n setFilteredRowOptions(filteredOptions);\n } catch { setFilteredRowOptions([]); }\n }\n setIsOptionLoading(false);\n };\n\n const getSkeleton = (\n <div className={`min-w-[140px] max-w-[200px] justify-start whitespace-nowrap items-center py-2 px-1 gap-2`} aria-disabled={true}>\n <SingleLineLoader repeat={rowOptions?.length || 1} lineHeight='15px' />\n </div>\n );\n\n return (\n <td className={`sticky left-0 right-0 z-10 ${bgColor ? bgColor : 'bg-white dark:bg-black-800'} h-row`} onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave}>\n <div className={`h-full gap-2 top-0 font-medium font-inter overflow-hidden whitespace-nowrap text-ellipsis px-1 w-full flex items-center`}>\n <div className={`${disableOptionsForRowIndex === index ? 'opacity-50' : ''}`} aria-disabled={disableOptionsForRowIndex === index}>\n {rowAdditionalActions ? rowAdditionalActions(rowData, index, rowHovering === rowId) : null}\n </div>\n {isInlineEditing ? (\n <div className={`flex items-center gap-2 ${isAnyFieldOperationLoading ? 'pointer-events-none opacity-50' : ''}`}>\n <div className='cursor-pointer hover:bg-neutral-100 dark:hover:bg-black-600 rounded p-0.5' onClick={() => !isAnyFieldOperationLoading && onCancelEdit?.()}>\n <CloseRounded sx={{ height: 20, width: 20, color: '#667085' }} />\n </div>\n <div className='cursor-pointer hover:bg-neutral-100 dark:hover:bg-black-600 rounded p-0.5' onClick={() => !isAnyFieldOperationLoading && onConfirmEdit?.()}>\n <CheckRounded sx={{ height: 20, width: 20, color: 'var(--color-primary-600)' }} />\n </div>\n </div>\n ) : rowOptions ? (\n <>\n {disableOptionsForRowIndex === index ? (\n <SpinnerCell />\n ) : rowHasPendingEdits ? (\n <Tooltip title={pendingEditsTooltip}>\n <span><ButtonThreeDots disabled /></span>\n </Tooltip>\n ) : (\n <Dropdown\n menu={{ items: isOptionLoading ? [{ label: getSkeleton, key: 'loading' }] : filteredRowOptions }}\n trigger={['click']}\n overlayClassName='row-option-cell table-row-option-dropdown'\n onOpenChange={handleDropdownVisibleChange}\n disabled={disableOption || visibleRowOptions === 0}\n {...(rowOptionsDropdownProps || {})}\n >\n <ButtonThreeDots disabled={disableOption} />\n </Dropdown>\n )}\n </>\n ) : null}\n </div>\n </td>\n );\n};\n"],"names":["RowOptionsCell","rowId","rowOptions","disableOption","rowHovering","is_read","showNewItem","is_modified","is_row_modified","currentData","is_deleted","is_added","isDraggingOver","rowAdditionalActions","rowData","index","bgColorProp","setRowHovering","is_incomplete","isInlineEditing","onConfirmEdit","onCancelEdit","rowHasPendingEdits","tableConfig","useTableConfig","bgColor","cn","onMouseEnter","useCallback","onMouseLeave","asyncRowOptionsFilter","disableOptionsForRowIndex","fieldOperationLoading","useContext","TableContext","pendingEditsTooltip","rowOptionsDropdownProps","isAnyFieldOperationLoading","isOptionLoading","setIsOptionLoading","useState","filteredRowOptions","setFilteredRowOptions","visibleRowOptions","option","handleDropdownVisibleChange","visible","buttonState","filteredOptions","getSkeleton","jsx","SingleLineLoader","jsxs","CloseRounded","CheckRounded","Fragment","SpinnerCell","Tooltip","ButtonThreeDots","Dropdown"],"mappings":"iiBAqCaA,GAAiB,CAAC,CAC7B,MAAAC,EAAO,WAAAC,EAAY,cAAAC,EAAe,YAAAC,EAAa,QAAAC,EAAS,YAAAC,EAAa,YAAAC,EAAa,gBAAAC,EAAiB,YAAAC,EACnG,WAAAC,EAAY,SAAAC,EAAU,eAAAC,EAAgB,qBAAAC,EAAsB,QAAAC,EAAA,MAASC,EAAO,QAASC,EAAa,eAAAC,EAClG,cAAAC,EAAe,gBAAAC,EAAiB,cAAAC,EAAe,aAAAC,EAAc,mBAAAC,CAC/D,IAAc,CACZ,MAAMC,EAAcC,EAAAA,eAAA,EACdC,EAAUC,EAAG,CACjB,oCAAqCP,EACrC,mCAAoCf,IAAgBH,GAAS,CAACkB,GAAmB,EAAET,GAAcD,GAAa,aAAe,EAAEE,GAAYF,GAAa,UACxJ,iCAAkCL,IAAgBH,GAAS,CAACkB,IAAoBT,GAAcD,GAAa,YAC3G,qCAAsCL,IAAgBH,GAAS,CAACkB,IAAoBR,GAAYF,GAAa,UAC7G,kCAAmC,CAACS,GAAiB,CAACb,GAAWC,GAAeF,IAAgBH,GAAS,CAACkB,EAC1G,mCAAoCD,GAAiBX,GAAeC,GAAmBC,GAAa,kBAAoBL,IAAgBH,GAAS,CAACkB,EAClJ,kCAAmCT,GAAcD,GAAa,aAAeL,IAAgBH,GAAS,CAACkB,EACvG,qCAAsCR,GAAYF,GAAa,WAAaL,IAAgBH,GAAS,CAACkB,EACtG,gBAAiBP,GAAkB,CAACO,EACpC,GAAIH,GAAe,CAACG,GAAmB,CAAE,CAACH,CAAW,EAAG,EAAA,CAAK,CAC9D,EAEKW,EA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-900": r === o && !t && (n || a?.is_deleted),
|
|
40
40
|
"bg-success-100 dark:bg-success-800": r === o && !t && (i || a?.is_added),
|
|
41
41
|
"bg-primary-50 dark:bg-black-700": !u && !F && T && r !== o && !t,
|
|
42
|
-
"bg-warning-50 dark:bg-
|
|
42
|
+
"bg-warning-50 dark:bg-black-500": (u || j || w || a?.is_row_modified) && r !== o && !t,
|
|
43
43
|
"bg-error-100 dark:bg-error-975": (n || a?.is_deleted) && r !== o && !t,
|
|
44
44
|
"bg-success-50 dark:bg-success-900": (i || a?.is_added) && r !== o && !t,
|
|
45
45
|
"bg-primary-50": P && !t,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RowOptionsCell.es.js","sources":["../../../../../../src/components/data-display/infinite-table/body/cell/RowOptionsCell.tsx"],"sourcesContent":["import { SingleLineLoader } from '../../../../data-display/skeleton/loaders';\nimport { ButtonThreeDots } from '../../../../button/ButtonThreeDots';\nimport Tooltip from '../../../../tooltip/Tooltip';\nimport { useTableConfig } from '../../../../../providers/design-system-provider/hooks';\nimport { CheckRounded, CloseRounded } from '@mui/icons-material';\nimport { Dropdown } from 'antd';\nimport cn from 'classnames';\nimport { useCallback, useContext, useState } from 'react';\n\nimport { TableContext } from '../../context';\nimport { SpinnerCell } from './SpinnerCell';\n\ntype TProps = {\n rowId: string | number;\n rowOptions: Array<{ key: string; label: React.ReactNode; isVisible?: boolean; [k: string]: unknown }>;\n disableOption: boolean;\n rowHovering: string | number | null;\n is_read: boolean;\n showNewItem: boolean;\n is_modified: boolean;\n is_row_modified: boolean;\n currentData: Record<string, unknown>;\n is_deleted: boolean;\n is_added: boolean;\n isDraggingOver: boolean;\n rowData: Record<string, unknown>;\n index: number;\n rowAdditionalActions: (rowData: Record<string, unknown>, index: number, isHovering: boolean) => React.ReactNode;\n bgColor?: string;\n setRowHovering: (rowId: string | number | null) => void;\n is_incomplete?: boolean;\n isInlineEditing?: boolean;\n onConfirmEdit?: () => void;\n onCancelEdit?: () => void;\n rowHasPendingEdits?: boolean;\n};\n\nexport const RowOptionsCell = ({\n rowId, rowOptions, disableOption, rowHovering, is_read, showNewItem, is_modified, is_row_modified, currentData,\n is_deleted, is_added, isDraggingOver, rowAdditionalActions, rowData, index, bgColor: bgColorProp, setRowHovering,\n is_incomplete, isInlineEditing, onConfirmEdit, onCancelEdit, rowHasPendingEdits,\n}: TProps) => {\n const tableConfig = useTableConfig();\n const bgColor = cn({\n 'bg-primary-50 dark:bg-primary-900': isInlineEditing,\n 'bg-neutral-100 dark:bg-black-600': rowHovering === rowId && !isInlineEditing && !(is_deleted || currentData?.is_deleted) && !(is_added || currentData?.is_added),\n 'bg-error-200 dark:bg-error-900': rowHovering === rowId && !isInlineEditing && (is_deleted || currentData?.is_deleted),\n 'bg-success-100 dark:bg-success-800': rowHovering === rowId && !isInlineEditing && (is_added || currentData?.is_added),\n 'bg-primary-50 dark:bg-black-700': !is_incomplete && !is_read && showNewItem && rowHovering !== rowId && !isInlineEditing,\n 'bg-warning-50 dark:bg-orange-900': (is_incomplete || is_modified || is_row_modified || currentData?.is_row_modified) && rowHovering !== rowId && !isInlineEditing,\n 'bg-error-100 dark:bg-error-975': (is_deleted || currentData?.is_deleted) && rowHovering !== rowId && !isInlineEditing,\n 'bg-success-50 dark:bg-success-900': (is_added || currentData?.is_added) && rowHovering !== rowId && !isInlineEditing,\n 'bg-primary-50': isDraggingOver && !isInlineEditing,\n ...(bgColorProp && !isInlineEditing && { [bgColorProp]: true }),\n });\n\n const onMouseEnter = useCallback(() => setRowHovering(rowId), [setRowHovering, rowId]);\n const onMouseLeave = useCallback(() => setRowHovering(null), [setRowHovering]);\n\n const { asyncRowOptionsFilter, disableOptionsForRowIndex = null, fieldOperationLoading } = useContext(TableContext);\n const pendingEditsTooltip = tableConfig?.t?.('Save or cancel pending changes first') ?? 'Save or cancel pending changes first';\n const rowOptionsDropdownProps = tableConfig?.getRowOptionsDropdownProps?.();\n const isAnyFieldOperationLoading = Boolean(fieldOperationLoading);\n const [isOptionLoading, setIsOptionLoading] = useState(!!asyncRowOptionsFilter);\n const [filteredRowOptions, setFilteredRowOptions] = useState(rowOptions);\n const visibleRowOptions = rowOptions ? rowOptions.filter((option) => option.isVisible !== false).length : 0;\n\n const handleDropdownVisibleChange = async (visible: boolean) => {\n setIsOptionLoading(true);\n if (visible && asyncRowOptionsFilter) {\n try {\n const buttonState = await asyncRowOptionsFilter(rowId);\n const filteredOptions = rowOptions ? rowOptions.filter((option) => { const existOnAPI = Object.keys(buttonState).includes(option.key); return existOnAPI ? buttonState[option.key] : true; }) : [];\n setFilteredRowOptions(filteredOptions);\n } catch { setFilteredRowOptions([]); }\n }\n setIsOptionLoading(false);\n };\n\n const getSkeleton = (\n <div className={`min-w-[140px] max-w-[200px] justify-start whitespace-nowrap items-center py-2 px-1 gap-2`} aria-disabled={true}>\n <SingleLineLoader repeat={rowOptions?.length || 1} lineHeight='15px' />\n </div>\n );\n\n return (\n <td className={`sticky left-0 right-0 z-10 ${bgColor ? bgColor : 'bg-white dark:bg-black-800'} h-row`} onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave}>\n <div className={`h-full gap-2 top-0 font-medium font-inter overflow-hidden whitespace-nowrap text-ellipsis px-1 w-full flex items-center`}>\n <div className={`${disableOptionsForRowIndex === index ? 'opacity-50' : ''}`} aria-disabled={disableOptionsForRowIndex === index}>\n {rowAdditionalActions ? rowAdditionalActions(rowData, index, rowHovering === rowId) : null}\n </div>\n {isInlineEditing ? (\n <div className={`flex items-center gap-2 ${isAnyFieldOperationLoading ? 'pointer-events-none opacity-50' : ''}`}>\n <div className='cursor-pointer hover:bg-neutral-100 dark:hover:bg-black-600 rounded p-0.5' onClick={() => !isAnyFieldOperationLoading && onCancelEdit?.()}>\n <CloseRounded sx={{ height: 20, width: 20, color: '#667085' }} />\n </div>\n <div className='cursor-pointer hover:bg-neutral-100 dark:hover:bg-black-600 rounded p-0.5' onClick={() => !isAnyFieldOperationLoading && onConfirmEdit?.()}>\n <CheckRounded sx={{ height: 20, width: 20, color: 'var(--color-primary-600)' }} />\n </div>\n </div>\n ) : rowOptions ? (\n <>\n {disableOptionsForRowIndex === index ? (\n <SpinnerCell />\n ) : rowHasPendingEdits ? (\n <Tooltip title={pendingEditsTooltip}>\n <span><ButtonThreeDots disabled /></span>\n </Tooltip>\n ) : (\n <Dropdown\n menu={{ items: isOptionLoading ? [{ label: getSkeleton, key: 'loading' }] : filteredRowOptions }}\n trigger={['click']}\n overlayClassName='row-option-cell table-row-option-dropdown'\n onOpenChange={handleDropdownVisibleChange}\n disabled={disableOption || visibleRowOptions === 0}\n {...(rowOptionsDropdownProps || {})}\n >\n <ButtonThreeDots disabled={disableOption} />\n </Dropdown>\n )}\n </>\n ) : null}\n </div>\n </td>\n );\n};\n"],"names":["RowOptionsCell","rowId","rowOptions","disableOption","rowHovering","is_read","showNewItem","is_modified","is_row_modified","currentData","is_deleted","is_added","isDraggingOver","rowAdditionalActions","rowData","index","bgColorProp","setRowHovering","is_incomplete","isInlineEditing","onConfirmEdit","onCancelEdit","rowHasPendingEdits","tableConfig","useTableConfig","bgColor","cn","onMouseEnter","useCallback","onMouseLeave","asyncRowOptionsFilter","disableOptionsForRowIndex","fieldOperationLoading","useContext","TableContext","pendingEditsTooltip","rowOptionsDropdownProps","isAnyFieldOperationLoading","isOptionLoading","setIsOptionLoading","useState","filteredRowOptions","setFilteredRowOptions","visibleRowOptions","option","handleDropdownVisibleChange","visible","buttonState","filteredOptions","getSkeleton","jsx","SingleLineLoader","jsxs","CloseRounded","CheckRounded","Fragment","SpinnerCell","Tooltip","ButtonThreeDots","Dropdown"],"mappings":";;;;;;;;;;;AAqCO,MAAMA,KAAiB,CAAC;AAAA,EAC7B,OAAAC;AAAA,EAAO,YAAAC;AAAA,EAAY,eAAAC;AAAA,EAAe,aAAAC;AAAA,EAAa,SAAAC;AAAA,EAAS,aAAAC;AAAA,EAAa,aAAAC;AAAA,EAAa,iBAAAC;AAAA,EAAiB,aAAAC;AAAA,EACnG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AAC,OAAA,EAAI,WAAU,6EAA4E,SAAS,MAAM,CAACb,KAA8BhB,OACvI,UAAA,gBAAA6B,EAACG,KAAa,IAAI,EAAE,QAAQ,IAAI,OAAO,IAAI,OAAO,aAAa,GACjE;AAAA,MACA,gBAAAH,EAAC,SAAI,WAAU,6EAA4E,SAAS,MAAM,CAACb,KAA8BjB,IAAA,GACvI,4BAACkC,GAAA,EAAa,IAAI,EAAE,QAAQ,IAAI,OAAO,IAAI,OAAO,2BAAA,EAA2B,CAAG,EAAA,CAClF;AAAA,IAAA,EAAA,CACF,IACEpD,IACF,gBAAAgD,EAAAK,GAAA,EACG,UAAAxB,MAA8BhB,IAC7B,gBAAAmC,EAACM,IAAA,CAAA,CAAY,IACXlC,IACF,gBAAA4B,EAACO,KAAQ,OAAOtB,GACd,4BAAC,QAAA,EAAK,UAAA,gBAAAe,EAACQ,KAAgB,UAAQ,GAAA,CAAC,EAAA,CAAE,EAAA,CACpC,IAEA,gBAAAR;AAAA,MAACS;AAAA,MAAA;AAAA,QACC,MAAM,EAAE,OAAOrB,IAAkB,CAAC,EAAE,OAAOW,GAAa,KAAK,WAAW,IAAIR,EAAA;AAAA,QAC5E,SAAS,CAAC,OAAO;AAAA,QACjB,kBAAiB;AAAA,QACjB,cAAcI;AAAA,QACd,UAAU1C,KAAiBwC,MAAsB;AAAA,QAChD,GAAIP,KAA2B,CAAA;AAAA,QAEhC,UAAA,gBAAAc,EAACQ,GAAA,EAAgB,UAAUvD,EAAA,CAAe;AAAA,MAAA;AAAA,IAAA,GAGhD,IACE;AAAA,EAAA,EAAA,CACN,EAAA,CACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"RowOptionsCell.es.js","sources":["../../../../../../src/components/data-display/infinite-table/body/cell/RowOptionsCell.tsx"],"sourcesContent":["import { SingleLineLoader } from '../../../../data-display/skeleton/loaders';\nimport { ButtonThreeDots } from '../../../../button/ButtonThreeDots';\nimport Tooltip from '../../../../tooltip/Tooltip';\nimport { useTableConfig } from '../../../../../providers/design-system-provider/hooks';\nimport { CheckRounded, CloseRounded } from '@mui/icons-material';\nimport { Dropdown } from 'antd';\nimport cn from 'classnames';\nimport { useCallback, useContext, useState } from 'react';\n\nimport { TableContext } from '../../context';\nimport { SpinnerCell } from './SpinnerCell';\n\ntype TProps = {\n rowId: string | number;\n rowOptions: Array<{ key: string; label: React.ReactNode; isVisible?: boolean; [k: string]: unknown }>;\n disableOption: boolean;\n rowHovering: string | number | null;\n is_read: boolean;\n showNewItem: boolean;\n is_modified: boolean;\n is_row_modified: boolean;\n currentData: Record<string, unknown>;\n is_deleted: boolean;\n is_added: boolean;\n isDraggingOver: boolean;\n rowData: Record<string, unknown>;\n index: number;\n rowAdditionalActions: (rowData: Record<string, unknown>, index: number, isHovering: boolean) => React.ReactNode;\n bgColor?: string;\n setRowHovering: (rowId: string | number | null) => void;\n is_incomplete?: boolean;\n isInlineEditing?: boolean;\n onConfirmEdit?: () => void;\n onCancelEdit?: () => void;\n rowHasPendingEdits?: boolean;\n};\n\nexport const RowOptionsCell = ({\n rowId, rowOptions, disableOption, rowHovering, is_read, showNewItem, is_modified, is_row_modified, currentData,\n is_deleted, is_added, isDraggingOver, rowAdditionalActions, rowData, index, bgColor: bgColorProp, setRowHovering,\n is_incomplete, isInlineEditing, onConfirmEdit, onCancelEdit, rowHasPendingEdits,\n}: TProps) => {\n const tableConfig = useTableConfig();\n const bgColor = cn({\n 'bg-primary-50 dark:bg-primary-900': isInlineEditing,\n 'bg-neutral-100 dark:bg-black-600': rowHovering === rowId && !isInlineEditing && !(is_deleted || currentData?.is_deleted) && !(is_added || currentData?.is_added),\n 'bg-error-200 dark:bg-error-900': rowHovering === rowId && !isInlineEditing && (is_deleted || currentData?.is_deleted),\n 'bg-success-100 dark:bg-success-800': rowHovering === rowId && !isInlineEditing && (is_added || currentData?.is_added),\n 'bg-primary-50 dark:bg-black-700': !is_incomplete && !is_read && showNewItem && rowHovering !== rowId && !isInlineEditing,\n 'bg-warning-50 dark:bg-black-500': (is_incomplete || is_modified || is_row_modified || currentData?.is_row_modified) && rowHovering !== rowId && !isInlineEditing,\n 'bg-error-100 dark:bg-error-975': (is_deleted || currentData?.is_deleted) && rowHovering !== rowId && !isInlineEditing,\n 'bg-success-50 dark:bg-success-900': (is_added || currentData?.is_added) && rowHovering !== rowId && !isInlineEditing,\n 'bg-primary-50': isDraggingOver && !isInlineEditing,\n ...(bgColorProp && !isInlineEditing && { [bgColorProp]: true }),\n });\n\n const onMouseEnter = useCallback(() => setRowHovering(rowId), [setRowHovering, rowId]);\n const onMouseLeave = useCallback(() => setRowHovering(null), [setRowHovering]);\n\n const { asyncRowOptionsFilter, disableOptionsForRowIndex = null, fieldOperationLoading } = useContext(TableContext);\n const pendingEditsTooltip = tableConfig?.t?.('Save or cancel pending changes first') ?? 'Save or cancel pending changes first';\n const rowOptionsDropdownProps = tableConfig?.getRowOptionsDropdownProps?.();\n const isAnyFieldOperationLoading = Boolean(fieldOperationLoading);\n const [isOptionLoading, setIsOptionLoading] = useState(!!asyncRowOptionsFilter);\n const [filteredRowOptions, setFilteredRowOptions] = useState(rowOptions);\n const visibleRowOptions = rowOptions ? rowOptions.filter((option) => option.isVisible !== false).length : 0;\n\n const handleDropdownVisibleChange = async (visible: boolean) => {\n setIsOptionLoading(true);\n if (visible && asyncRowOptionsFilter) {\n try {\n const buttonState = await asyncRowOptionsFilter(rowId);\n const filteredOptions = rowOptions ? rowOptions.filter((option) => { const existOnAPI = Object.keys(buttonState).includes(option.key); return existOnAPI ? buttonState[option.key] : true; }) : [];\n setFilteredRowOptions(filteredOptions);\n } catch { setFilteredRowOptions([]); }\n }\n setIsOptionLoading(false);\n };\n\n const getSkeleton = (\n <div className={`min-w-[140px] max-w-[200px] justify-start whitespace-nowrap items-center py-2 px-1 gap-2`} aria-disabled={true}>\n <SingleLineLoader repeat={rowOptions?.length || 1} lineHeight='15px' />\n </div>\n );\n\n return (\n <td className={`sticky left-0 right-0 z-10 ${bgColor ? bgColor : 'bg-white dark:bg-black-800'} h-row`} onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave}>\n <div className={`h-full gap-2 top-0 font-medium font-inter overflow-hidden whitespace-nowrap text-ellipsis px-1 w-full flex items-center`}>\n <div className={`${disableOptionsForRowIndex === index ? 'opacity-50' : ''}`} aria-disabled={disableOptionsForRowIndex === index}>\n {rowAdditionalActions ? rowAdditionalActions(rowData, index, rowHovering === rowId) : null}\n </div>\n {isInlineEditing ? (\n <div className={`flex items-center gap-2 ${isAnyFieldOperationLoading ? 'pointer-events-none opacity-50' : ''}`}>\n <div className='cursor-pointer hover:bg-neutral-100 dark:hover:bg-black-600 rounded p-0.5' onClick={() => !isAnyFieldOperationLoading && onCancelEdit?.()}>\n <CloseRounded sx={{ height: 20, width: 20, color: '#667085' }} />\n </div>\n <div className='cursor-pointer hover:bg-neutral-100 dark:hover:bg-black-600 rounded p-0.5' onClick={() => !isAnyFieldOperationLoading && onConfirmEdit?.()}>\n <CheckRounded sx={{ height: 20, width: 20, color: 'var(--color-primary-600)' }} />\n </div>\n </div>\n ) : rowOptions ? (\n <>\n {disableOptionsForRowIndex === index ? (\n <SpinnerCell />\n ) : rowHasPendingEdits ? (\n <Tooltip title={pendingEditsTooltip}>\n <span><ButtonThreeDots disabled /></span>\n </Tooltip>\n ) : (\n <Dropdown\n menu={{ items: isOptionLoading ? [{ label: getSkeleton, key: 'loading' }] : filteredRowOptions }}\n trigger={['click']}\n overlayClassName='row-option-cell table-row-option-dropdown'\n onOpenChange={handleDropdownVisibleChange}\n disabled={disableOption || visibleRowOptions === 0}\n {...(rowOptionsDropdownProps || {})}\n >\n <ButtonThreeDots disabled={disableOption} />\n </Dropdown>\n )}\n </>\n ) : null}\n </div>\n </td>\n );\n};\n"],"names":["RowOptionsCell","rowId","rowOptions","disableOption","rowHovering","is_read","showNewItem","is_modified","is_row_modified","currentData","is_deleted","is_added","isDraggingOver","rowAdditionalActions","rowData","index","bgColorProp","setRowHovering","is_incomplete","isInlineEditing","onConfirmEdit","onCancelEdit","rowHasPendingEdits","tableConfig","useTableConfig","bgColor","cn","onMouseEnter","useCallback","onMouseLeave","asyncRowOptionsFilter","disableOptionsForRowIndex","fieldOperationLoading","useContext","TableContext","pendingEditsTooltip","rowOptionsDropdownProps","isAnyFieldOperationLoading","isOptionLoading","setIsOptionLoading","useState","filteredRowOptions","setFilteredRowOptions","visibleRowOptions","option","handleDropdownVisibleChange","visible","buttonState","filteredOptions","getSkeleton","jsx","SingleLineLoader","jsxs","CloseRounded","CheckRounded","Fragment","SpinnerCell","Tooltip","ButtonThreeDots","Dropdown"],"mappings":";;;;;;;;;;;AAqCO,MAAMA,KAAiB,CAAC;AAAA,EAC7B,OAAAC;AAAA,EAAO,YAAAC;AAAA,EAAY,eAAAC;AAAA,EAAe,aAAAC;AAAA,EAAa,SAAAC;AAAA,EAAS,aAAAC;AAAA,EAAa,aAAAC;AAAA,EAAa,iBAAAC;AAAA,EAAiB,aAAAC;AAAA,EACnG,YAAAC;AAAA,EAAY,UAAAC;AAAA,EAAU,gBAAAC;AAAA,EAAgB,sBAAAC;AAAA,EAAsB,SAAAC;AAAA,EAAS,OAAAC;AAAA,EAAO,SAASC;AAAA,EAAa,gBAAAC;AAAA,EAClG,eAAAC;AAAA,EAAe,iBAAAC;AAAA,EAAiB,eAAAC;AAAA,EAAe,cAAAC;AAAA,EAAc,oBAAAC;AAC/D,MAAc;AACZ,QAAMC,IAAcC,EAAA,GACdC,IAAUC,GAAG;AAAA,IACjB,qCAAqCP;AAAA,IACrC,oCAAoCf,MAAgBH,KAAS,CAACkB,KAAmB,EAAET,KAAcD,GAAa,eAAe,EAAEE,KAAYF,GAAa;AAAA,IACxJ,kCAAkCL,MAAgBH,KAAS,CAACkB,MAAoBT,KAAcD,GAAa;AAAA,IAC3G,sCAAsCL,MAAgBH,KAAS,CAACkB,MAAoBR,KAAYF,GAAa;AAAA,IAC7G,mCAAmC,CAACS,KAAiB,CAACb,KAAWC,KAAeF,MAAgBH,KAAS,CAACkB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A,QACC,MAAM,EAAE,OAAOrB,IAAkB,CAAC,EAAE,OAAOW,GAAa,KAAK,WAAW,IAAIR,EAAA;AAAA,QAC5E,SAAS,CAAC,OAAO;AAAA,QACjB,kBAAiB;AAAA,QACjB,cAAcI;AAAA,QACd,UAAU1C,KAAiBwC,MAAsB;AAAA,QAChD,GAAIP,KAA2B,CAAA;AAAA,QAEhC,UAAA,gBAAAc,EAACQ,GAAA,EAAgB,UAAUvD,EAAA,CAAe;AAAA,MAAA;AAAA,IAAA,GAGhD,IACE;AAAA,EAAA,EAAA,CACN,EAAA,CACF;AAEJ;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),ws=require("../../../hooks/useCheckbox.cjs.js"),ps=require("../../../providers/design-system-provider/hooks.cjs.js"),We=require("../../../utils/table.cjs.js"),At=require("../../button/Button.cjs.js"),Fs=require("../../floating-bar/FloatingBar.cjs.js"),we=require("../typography/Typography.cjs.js"),k=require("@dnd-kit/core"),l=require("react"),Ts=require("react-virtualized-auto-sizer"),Os=require("react-dom"),Dt=require("react-table"),Es=require("./body/index.cjs.js"),_t=require("./validateCell.cjs.js"),ys=require("./body/rows/row.cjs.js"),Rs=require("./context.cjs.js"),js=require("./CurrencyDropdownPortal.cjs.js"),ks=require("./head/index.cjs.js"),Ns=require("./PendingEditsFloatingBar.cjs.js"),h=require("./constants.cjs.js"),Mt=require("./useRowHeight.cjs.js"),As=require("../empty-state/NoDataFoundWidgets.cjs.js"),Ds=require("../empty-state/NoDataFound.cjs.js"),_s=require("../../icon/icons.generated.cjs.js"),Ms=Ts.AutoSizer,Lt="Create Column",Ls=(M,T)=>`button-admin-${M.toLowerCase().trim().replace(/\s+/g,"-").replace(/[^a-z0-9-_]/g,"")||T}`,gs=l.memo(({tableKey:M,searchConfig:T={search:"",handleSearch:()=>null,allowAStarSearch:!1},filterConfig:a={columnFilters:[],onFilter:()=>null,onRemoveFilter:()=>null,onClearFilter:()=>null,onResetFilter:()=>Promise.resolve({}),asyncRowOptionsFilter:()=>Promise.resolve({})},sortConfig:m={onSort:()=>null,columnSort:{field:"",order:""},onRemoveSort:()=>null},headerConfig:i={showExportButton:null,showFilters:!0,showSorts:!0,showSearch:!0,showTableView:!0,showTableViewAsModal:!1,content:null,postContent:null,preContent:null,isLoading:!1,showDivider:!1},hoverConfig:gt=null,columns:E,modelName:G,enableMasterDataEnumSuggestions:X=!1,agreementCategoryId:Y,agreementDomainId:Z,agreementId:Q,modificationId:K,lineItemRowId:ee,enumSuggestionsData:te,data:f=[],onRowClick:It,showHeader:pe,tableActions:He,rowOptions:q,hideRowOptionWidth:$e,checkboxUtilities:L,isLoading:le=!1,onScroll:Vt,onScrolling:Bt,isColumnConfigurable:se,onAddColumnClick:re,emptyMessage:ze,noDataWidget:Ue,buttons:Je,onEditColumnClick:Ge,onDeleteColumnClick:Xe,onRowTooltipClick:Ct,tooltiptext:Pt,cascadingTableConfig:qt,originalsOnly:Wt,disableOptionsForRowIndex:Ht,tableHeightClass:ne="h-[calc(100vh-220px)]",getFullRowDataOnClick:$t,selectedRowId:zt=null,onRowEdit:N,onBulkRowEdit:g,inlineEditColumns:Ut,isResizable:Jt=!0,paginationConfig:ae,dndSortableUtils:ce,multipleContexts:Ye,withSortable:Fe,withDraggable:Gt,enableRootDrag:Xt,pageSize:Yt=h.DEFAULT_PAGE_SIZE,onCascadingRowExpand:Zt,totalItems:Ze,showRecordCount:Te=!1,getInnerRowData:Qt,maxLevel:Kt,expandedRows:el={},setExpandedRows:tl,showNewItem:ll,rawData:Qe,dragConfig:sl,isOverlayLoading:rl,style:nl={},floatingBarConfig:Oe,rowWrapper:al,rowLinkConfig:cl,isCellClickDisabled:ol,setHeaderOnParent:Ee,optimizeTable:il=!1,multiSelectConfig:ul,headerContextOptions:dl,showHeaderContextOptions:hl,setShowHeaderContextOptions:ml,showDataTypeIcon:fl=!1,rowAdditionalActions:oe,rowAdditionalActionsWidth:ye,setVisibleHeaders:Re,cellEditing:xl=null,cellEditingValue:vl=null,allowInlineEdit:Sl=!1,onFieldOperationFlow:bl,fieldOperationLoading:I=null,onTableActionsReady:je,onPendingEditsChange:Ke,onCancelPendingEdits:V})=>{const o=ps.useTableConfig(),wl=Mt.getRowSlotHeight(Mt.useRowHeight()),pl=!!T?.search,et=a?.columnFilters?.length>0,W=pl||et,Fl=!!L,O=o?.getTableView?.(M)??null,[p,H]=l.useState(O||null),A=!We.canEditTableView(p,o?.getUserId?.()),[ke,Ne]=l.useState(!1),[Ae,tt]=l.useState(!1),[Tl,lt]=l.useState(null),[S,De]=l.useState(E),st=(f.length===0||!S.length)&&!le,[rt,ie]=l.useState(null),[Ol,El]=l.useState(!1),[yl,Rl]=l.useState(null),[jl,kl]=l.useState(!1),[Nl,ue]=l.useState(null),[Al,de]=l.useState(null),[Dl,nt]=l.useState({}),[$,_e]=l.useState(null),[_l,at]=l.useState(!1),[y,Ml]=l.useState(0),Me=l.useRef(null),Le=l.useRef(null),[ct,Ll]=l.useState({width:0,height:0}),[gl,B]=l.useState(null),[R,ot]=l.useState(null),[Il,it]=l.useState(null),[ut,dt]=l.useState(null),[ge,z]=l.useState({}),Ie=l.useRef(!1),he=l.useRef(!1),Ve=l.useRef(p);Ve.current=p;const ht=l.useRef(o);ht.current=o;const mt=l.useRef(E);mt.current=E;const me=l.useRef(a);me.current=a;const ft=l.useRef(null),xt=l.useRef(()=>({})),vt=l.useRef(()=>({})),[d,j]=l.useState({}),Be=l.useCallback((e,t,r)=>{j(n=>{const c=n[e]?.[t];let u=r.validationError;if(u===void 0){const b=S.find(x=>x.key===t);if(b){const x=_t.validateCellValue(r.value,b);u=x.isValid?null:x.error||"Invalid"}else u=c?.validationError??null}return{...n,[e]:{...n[e]||{},[t]:{...r,validationError:u??null}}}})},[S]),St=l.useCallback(()=>Object.values(d).some(e=>Object.keys(e).length>0),[d]);l.useEffect(()=>{je&&je({addPendingEdit:Be,hasPendingEdits:St})},[je,Be,St]);const Vl=l.useCallback((e,t)=>{j(r=>{const n={...r};if(n[e]){const{[t]:c,...u}=n[e];Object.keys(u).length===0?delete n[e]:n[e]=u}return n})},[]),Bl=l.useCallback((e,t)=>d[e]?.[t],[d]),Cl=l.useCallback((e,t)=>!!d[e]?.[t],[d]),bt=l.useCallback(()=>{I||(V&&Object.keys(d).length>0&&V(d),j({}),z({}),B(null))},[I,V,d]),C=l.useCallback((e,t,r)=>{setTimeout(()=>{o?.dispatchEvent?.("SCROLL_TO_TABLE_ROW",{rowIndex:r});const n=S.findIndex(c=>c.key===t);setTimeout(()=>{const c=document.querySelector(`[${h.DATA_ROW_ID_ATTR}="${e}"] [${h.DATA_COLUMN_KEY_ATTR}="${t}"]`);if(c)c.scrollIntoView({behavior:"smooth",block:"center",inline:"center"});else if(n>0){const u=document.querySelector(h.OS_VIEWPORT_SELECTOR);if(u){let b=0;for(let x=0;x<n;x++){const F=S[x];F?.sticky||(b+=F?.width||h.SCROLL_TO_CELL_COLUMN_WIDTH_FALLBACK)}b=Math.max(0,b-h.SCROLL_TO_CELL_LEFT_OFFSET),u.scrollTo({left:b,behavior:"smooth"})}}B({rowId:e,columnKey:t})},350)},100)},[S,o]),U=l.useCallback(e=>{let t=!1,r=null;const n={},c=new Set;return Object.entries(e).forEach(([u,b])=>{n[u]={},Object.entries(b).forEach(([x,F])=>{const _=S.find(w=>w.key===x),v=_t.validateCellValue(F.value,_);v.isValid?n[u][x]={...F,validationError:null}:(t=!0,v.error&&c.add(v.error),r||(r={rowId:u,columnKey:x}),n[u][x]={...F,validationError:v.error})})}),{hasErrors:t,updatedEdits:n,firstError:r,errorTypes:c}},[S]),fe=l.useCallback(e=>{const t=e.has("Field required"),r=e.size>(t?1:0);return t&&r?"Missing required field(s) and invalid format detected. Please review highlighted field(s).":t?"Missing required field(s). Please review highlighted field(s).":"Invalid field value(s). Please review highlighted field(s)."},[]),wt=l.useCallback(()=>{const{hasErrors:e,updatedEdits:t,firstError:r,errorTypes:n}=U(d);if(e){if(j(t),o?.showNotification?.("error",fe(n)),r){const u=f.findIndex(b=>b.id===r.rowId);C(r.rowId,r.columnKey,u)}return}const c=[];Object.entries(d).forEach(([u,b])=>{const x=f.find(F=>F.id===u);if(x){const F={...x},_={};Object.entries(b).forEach(([v,w])=>{F[v]=w.value,_[v]={value:w.value,meta:w.meta}}),c.push({...F,__editedFields:_})}}),c.length>0&&(g?g(c):N&&N(null,null,null,null,null,{isBulk:!0,rows:c})),j({}),z({}),B(null)},[d,f,N,g,U,fe,C,o]),Pl=l.useCallback(e=>{if(I)return;const t=d[e];t&&V&&V({[e]:t}),j(r=>{const n={...r};return delete n[e],n}),z(r=>{const n={...r};return Object.keys(n).forEach(c=>{c.startsWith(`${e}-`)&&delete n[c]}),n}),B(null)},[I,V,d]),ql=l.useCallback(e=>{const t=d[e];if(!t||Object.keys(t).length===0)return;const{hasErrors:r,updatedEdits:n,firstError:c,errorTypes:u}=U({[e]:t});if(r){if(j(v=>({...v,[e]:n[e]})),o?.showNotification?.("error",fe(u)),c){const v=f.findIndex(w=>w.id===c.rowId);C(c.rowId,c.columnKey,v)}return}const b=f.find(v=>v.id===e);if(!b)return;const x={...b},F={};Object.entries(t).forEach(([v,w])=>{x[v]=w.value,F[v]={value:w.value,meta:w.meta}});const _={...x,__editedFields:F};g?g([_]):N&&N(null,null,null,null,null,{isBulk:!0,rows:[_]}),j(v=>{const w={...v};return delete w[e],w}),z(v=>{const w={...v};return Object.keys(w).forEach(Nt=>{Nt.startsWith(`${e}-`)&&delete w[Nt]}),w}),B(null)},[d,f,N,g,U,fe,C,o]),P=l.useMemo(()=>Object.values(d).reduce((e,t)=>e+Object.keys(t).length,0),[d]);l.useEffect(()=>{Ke?.(P>0,P)},[P,Ke]);const Wl=l.useMemo(()=>{const e=[];return Object.entries(d).forEach(([t,r])=>{const n=f.findIndex(c=>c.id===t);Object.entries(r).forEach(([c,u])=>{const b=S.find(x=>x.key===c);e.push({rowId:t,columnKey:c,fieldName:b?.Header||b?.display_name||c,value:u.value,originalValue:u.originalValue,meta:u.meta,originalMeta:u.originalMeta,rowIndex:n})})}),e},[d,S,f]),Hl=l.useMemo(()=>{const e=new Map;return Object.entries(d).forEach(([t,r])=>{const n=f.findIndex(c=>c.id===t);e.set(t,{rowId:t,rowIndex:n,editCount:Object.keys(r).length})}),Array.from(e.values()).sort((t,r)=>t.rowIndex-r.rowIndex)},[d,f]),$l=l.useCallback(e=>ot(e),[]),xe=l.useCallback(()=>ot(null),[]),zl=l.useCallback((e,t)=>{it({value:e,reference:t}),R?.onSelected&&R.onSelected(e,t),xe()},[R,xe]),Ul=l.useCallback(()=>it(null),[]),Jl=l.useCallback(e=>dt(e),[]),pt=l.useCallback(()=>dt(null),[]),Gl=l.useCallback((e,t)=>{z(r=>({...r,[e]:t}))},[]),Xl=l.useCallback(e=>ge[e],[ge]),Yl=l.useMemo(()=>{const e=ne.match(/h-\[(\d+px)\]/);if(e)return e[1];const t=ne.match(/h-\[(calc\(.+\))\]/);if(t)return t[1].replace(/([+-])/g," $1 ").replace(/\s+/g," ")},[ne]),Zl={isEmpty:st,isFilters:W,isColumnConfigurable:se,handleOnClick:re,emptyMessage:ze,buttons:Je,noDataWidget:Ue},Ql=o?.t?.(Lt)??Lt,ve=W?"No Results Found":ze||"No Data Found",Kl=typeof ve=="string"?o?.t?.(ve)??ve:ve,Ft={__isLoading:!0},es=new Array(1).fill(Ft),ts=new Array(Yt).fill(Ft),J=l.useMemo(()=>S.filter(e=>!!e?.visible),[S]),ls=Dt.useTable({columns:il?J:S,data:[...f,...le?f?.length?es:ts:[]],defaultColumn:{minWidth:h.DEFAULT_COLUMN_MIN_WIDTH,width:h.DEFAULT_COLUMN_WIDTH,maxWidth:h.DEFAULT_COLUMN_MAX_WIDTH}},Dt.useResizeColumns),{getTableProps:Tt,getTableBodyProps:Ot,headerGroups:Se,prepareRow:Et,rows:D}=ls;ft.current=Se;const ss=JSON.stringify(Se[0]?.headers?.map(e=>e?.Header));l.useEffect(()=>{if(Re){const e=ft.current;Re?.(e?.[0]?.headers?.map(t=>t?.Header)??[])}},[ss,Re]);const{checkboxConfig:yt}=ws.useCheckbox({rows:D,checkedIds:L?.checkedIds,isCheckAllDisabled:L?.isCheckAllDisabled,selectionDisabledRowIds:L?.selectionDisabledRowIds,rawData:Qe,onAllChecked:kl,setCheckedIds:L?.setCheckedIds,checkboxMetadata:L?.checkboxMetadata}),rs=k.useSensors(k.useSensor(k.MouseSensor,{activationConstraint:{distance:h.DND_ACTIVATION_DISTANCE}}),k.useSensor(k.TouchSensor,{activationConstraint:{distance:h.DND_ACTIVATION_DISTANCE}})),ns={easing:h.DROP_ANIMATION_EASING,duration:h.DROP_ANIMATION_DURATION};function as(){return!Ye?.length||!Fe?D:Ye.reduce((e,t)=>(e[t]=D.filter(r=>r.original?.type===t),e),{})}vt.current=as;const cs=e=>{const{active:t}=e;_e(D.find(r=>r.original?.id===t?.id)??null)},os=e=>{const{active:t,over:r}=e;r&&(ce?.checkDndDragEnd&&ce.checkDndDragEnd(t,r,Dl,n=>{nt(n),at(!0),ce.onDragSuccess?.({draggedId:t.id,droppedId:r.id,draggedType:t.data.current?.type,droppedType:r.data.current?.type,updatedList:n,cb:()=>at(!1)})}),_e(null))},is=()=>_e(null),us=e=>{!m?.onSort&&!a?.onFilter||ie(rt===e?null:e)},ds=e=>{Rl(e),El(!Ol),ie(null)},Ce=l.useCallback(()=>{m?.onRemoveSort?m.onRemoveSort():m?.onSort&&m.onSort("","")},[m]),be=l.useCallback((e=null)=>{lt(e),Ne(t=>e?!0:!t)},[]),Pe=l.useCallback(()=>tt(e=>!e),[]),hs=()=>{const e=Se[0]?.headers?.filter(t=>t?.visible!==!1);for(let t=0;t<e.length;t++)if(e[t].sticky)return t-1;return e.length-1},ms=l.useCallback(e=>{let t=0;for(let r=e+1;r<J.length;r++)J[r].visible!==!1&&(t+=J[r].width??0);return oe&&(t+=ye||h.ROW_ADDITIONAL_ACTIONS_DEFAULT_WIDTH),q&&(t+=$e?0:h.ROW_OPTIONS_COLUMN_WIDTH),t},[J,ye,$e,oe,q]),Rt=()=>{const e=o?.getUserId?.();return{...p||{},name:p?.name||"Untitled View",created_by:p?.created_by||e,filters:p?.filters||a?.columnFilters,id:p?.id||"untitled-view",table_key:p?.table_key||M,columns:p?.columns||E?.map((t,r)=>({name:t.Header,width:t.width,visible:t.visible,sticky:t.sticky,order:r+1,display_name:t.Header,sequence:r+1,Header:t.Header}))}};xt.current=Rt;const fs=(e,t)=>{if(A)return;const r=Rt();H({...r,columns:r?.columns?.map(n=>n.name===e?{...n,width:t}:n),unsaved:!0})};l.useEffect(()=>{if(a?.columnFilters?.length>0&&Ne(!0),A)return;const e=Ve.current;if(JSON.stringify(e?.filters||[])!==JSON.stringify(a?.columnFilters||[])){const t=(e?.filters?.length??0)>0,r=a?.columnFilters?.length>0;if(!(t&&!r&&!he.current)){const c=xt.current();H({...c,filters:JSON.parse(JSON.stringify(a?.columnFilters||[])),unsaved:!0})}he.current=!1}},[a?.columnFilters,A]);const xs=l.useCallback(e=>{he.current=!0,a?.onRemoveFilter?.(e)},[a?.onRemoveFilter]),vs=l.useCallback(()=>{he.current=!0,a?.onClearFilter?.()},[a?.onClearFilter]);l.useEffect(()=>{m?.columnSort?.field?(tt(!0),m.columnSort.order==="asc"?(ue(m.columnSort.field),de(null)):m.columnSort.order==="desc"&&(de(m.columnSort.field),ue(null))):(ue(null),de(null))},[m?.columnSort?.field,m?.columnSort?.order]),l.useEffect(()=>{De(We.mergeViewColumnsWithTableColumns(Ve.current?.columns||[],E))},[E]),l.useEffect(()=>{p?.unsaved&&ht.current?.persistTableView?.(p)},[p]),l.useEffect(()=>{nt(vt.current())},[D.length]),l.useEffect(()=>{H(O||null),O?.columns&&De(We.mergeViewColumnsWithTableColumns(O?.columns||[],mt.current)),O?.filters&&O.filters.length>0&&!Ie.current?(requestAnimationFrame(()=>{me.current?.onFilter?.(O.filters)}),Ie.current=!0):O?.filters&&Ie.current&&JSON.stringify(O.filters)!==JSON.stringify(me.current?.columnFilters)&&me.current?.onFilter?.(O.filters)},[O]),l.useEffect(()=>{if(Me.current){const e=new ResizeObserver(t=>Ml(t[0].contentRect.width));return e.observe(Me.current),()=>e.disconnect()}},[]),l.useEffect(()=>{if(!Le.current)return;const e=new ResizeObserver(t=>{const{width:r,height:n}=t[0].contentRect;Ll({width:r,height:n})});return e.observe(Le.current),()=>e.disconnect()},[]);const jt=s.jsx(ks.Head,{isResizable:Jt,headerGroups:Se,isCheckbox:Fl,checkboxConfig:yt,isAllChecked:jl,showHeaderOptions:rt??"",setShowHeaderOptions:ie,isShowSortArrowAsc:Nl,isShowSortArrowDesc:Al,onSort:m?.onSort,onFilter:a?.onFilter,toggleHeaderOption:us,setIsShowSortArrowAsc:ue,setIsShowSortArrowDesc:de,toggleDataFilterModal:be,rowOptions:Array.isArray(q)?q:[],isColumnConfigurable:se??!1,onAddColumnClick:re,onEditColumnClick:Ge,onDeleteColumnClick:Xe,tableActions:He||null,isLoading:le,rowAdditionalActions:oe??null,showPendingEditsColumn:P>0}),kt=s.jsxs(s.Fragment,{children:[_l||rl?s.jsx("div",{className:"absolute left-0 top-0 w-full h-full z-40 flex items-center justify-center bg-neutral-100 dark:bg-black-700"}):null,s.jsx("div",{...Tt(),className:"w-full text-sm text-left text-neutral-500 dark:text-neutral-200 h-full bg-white dark:bg-black-800",children:st?s.jsxs("div",{className:"z-10",children:[jt,s.jsx("div",{className:"absolute w-full",children:o?.renderEmpty?o.renderEmpty(Zl):s.jsxs("div",{className:"flex flex-col items-center justify-center w-full h-[12rem] text-neutral-900 dark:text-neutral-200 mt-8",children:[Ue&&!W?s.jsx(As.NoDataFoundWidgets,{widgetType:"TABLE"}):s.jsx(Ds.NoDataFound,{text:Kl}),se&&!W?s.jsx("div",{className:"my-4",children:s.jsxs(At,{id:"btn-table-shell-create-column",status:"primary",appearance:"ghost",onClick:re,children:[s.jsx(_s.Add2Icon,{className:"text-white dark:text-white"})," ",Ql]})}):null,!W&&Je?.map((e,t)=>s.jsx(At,{status:"secondary",id:Ls(e.label,t),onClick:e.onClick,children:o?.t?.(e.label)??e.label},`${e.label}-${t}`))]})})]}):s.jsx(Ms,{style:{width:"100%",height:"100%"},renderProp:({width:e,height:t})=>{const r=e>0?e:ct.width,n=t>0?t:ct.height;return r>0&&n>0?s.jsx(Es.Body,{getTableBodyProps:Ot,rows:D,prepareRow:Et,isLoading:le,onScroll:Vt,onScrolling:Bt,columns:E,width:r,height:n,withSortable:Fe,allowAstarSearch:T?.allowAStarSearch||!1}):null}})})]}),Ss=l.forwardRef((e,t)=>s.jsxs("div",{className:"h-full w-full",...e,ref:t,children:[jt,s.jsx("div",{className:"relative w-full h-full",children:e?.children})]})),bs=l.forwardRef((e,t)=>s.jsx("div",{className:"h-full w-full",...e,ref:t,children:s.jsx("div",{className:"relative w-full h-full",children:e?.children})})),qe=l.useMemo(()=>o?.renderTableHeader?o.renderTableHeader({tableKey:M,search:T?.search,handleSearch:T?.handleSearch,toggleShowFilters:be,toggleShowSorts:Pe,filterCounts:a?.columnFilters?.length,columns:E,columnFilters:a?.columnFilters,setSelectedTableView:H,selectedTableView:p,enableTableView:i?.showTableView,modelName:G,enableMasterDataEnumSuggestions:X,onRemoveFilter:a?.onRemoveFilter,onClearFilter:a?.onClearFilter,onFilter:a?.onFilter,data:te??f,tableHeaders:S,showTableViewAsModal:i?.showTableViewAsModal,additionalOptions:i?.additionalOptions,inlineActions:i?.inlineActions,showFilters:i?.showFilters,showSorts:i?.showSorts,showSearch:i?.showSearch,isLoading:!!i?.isLoading,setTableHeaders:De,allowAStarSearch:!!T?.allowAStarSearch,withContent:!!i?.content,setShowFilters:Ne,sort:m?.columnSort,onSort:m?.onSort,onRemoveSort:Ce,showExportButton:i?.showExportButton,onExportClick:i?.onExportClick,agreementCategoryId:Y,agreementDomainId:Z,agreementId:Q,modificationId:K,lineItemRowId:ee}):null,[M,T?.search,T?.handleSearch,be,Pe,a?.columnFilters,E,H,p,i,G,a?.onRemoveFilter,a?.onClearFilter,a?.onFilter,f,te,S,m?.columnSort,m?.onSort,Ce,o,T?.allowAStarSearch,X,Y,Z,Q,K,ee]);return l.useEffect(()=>{Ee&&Ee(qe)},[qe,Ee]),s.jsxs(Rs.TableContext.Provider,{value:{tableWrapper:Ss,tableBodyWrapper:bs,lastNonStickyColumnIndex:hs,search:T?.search,columnFilters:a?.columnFilters,onRowClick:It,onSort:m?.onSort,onFilter:a?.onFilter,toggleShowFilters:be,toggleShowSorts:Pe,onRemoveFilter:a?.onRemoveFilter,onClearFilter:a?.onClearFilter,rowOptions:q,checkboxConfig:yt,onResetFilter:a?.onResetFilter,isColumnConfigurable:se,onAddColumnClick:re,onEditColumnClick:Ge,onDeleteColumnClick:Xe,onRowTooltipClick:Ct,tooltiptext:Pt,cascadingTableConfig:qt,activeInlineEdit:gl,setActiveInlineEdit:B,originalsOnly:Wt,disableOptionsForRowIndex:Ht,getFullRowDataOnClick:$t,selectedRowId:zt,getSumOfNextVisibleColumnWidth:ms,onRowEdit:N,inlineEditColumns:Ut,tableActions:He,dndSortableUtils:ce,withSortable:Fe,withDraggable:Gt,onCascadingRowExpand:Zt,getInnerRowData:Qt,tableHeaders:S,maxLevel:Kt,expandedRows:el,setExpandedRows:tl,showNewItem:ll,rawData:Qe,dragConfig:sl,rowWrapper:al,rowLinkConfig:cl,isCellClickDisabled:ol,asyncRowOptionsFilter:a?.asyncRowOptionsFilter,handleUpdateColumnWidth:fs,isTableViewReadOnly:A,multiSelectConfig:ul,headerContextOptions:dl,showHeaderContextOptions:hl,setShowHeaderContextOptions:ml,headerDivWidth:y,showDataTypeIcon:fl,rowAdditionalActions:oe,hoverConfig:gt,rowAdditionalActionsWidth:ye,cellEditing:xl,cellEditingValue:vl,openMasterDataModal:$l,closeMasterDataModal:xe,selectedMasterData:Il,clearSelectedMasterData:Ul,allowInlineEdit:Sl,openCurrencyDropdown:Jl,closeCurrencyDropdown:pt,currencyDropdownConfig:ut,selectedCurrenciesMap:ge,setCurrencyForCell:Gl,getCurrencyForCell:Xl,pendingEdits:d,addPendingEdit:Be,removePendingEdit:Vl,getPendingEdit:Bl,hasPendingEdit:Cl,clearAllPendingEdits:bt,saveAllPendingEdits:wt,clearRowPendingEdits:Pl,saveRowPendingEdits:ql,pendingEditsCount:P,scrollToCell:C,onFieldOperationFlow:bl,fieldOperationLoading:I,validateAllPendingEdits:U},children:[pe?s.jsxs("div",{ref:Me,className:`mb-2 flex w-full min-w-0 gap-2 dark:bg-black-800 ${y<h.TOOLBAR_FIRST_BREAKPOINT?"flex-col items-stretch":"flex-row items-center"}`,children:[s.jsxs("div",{className:`flex items-center gap-x-2 gap-y-1 ${y<h.TOOLBAR_FIRST_BREAKPOINT?"w-full flex-wrap":""} ${i?.content?"min-w-0 flex-1":"shrink-0"}`,children:[i?.content?s.jsx("div",{className:`min-w-0 ${y<h.TOOLBAR_FIRST_BREAKPOINT?"w-full":"flex-1"}`,children:i.content}):null,Te?s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-neutral-500 dark:text-neutral-400 flex-shrink-0","aria-hidden":!0,children:[s.jsx("ellipse",{cx:"12",cy:"5",rx:"9",ry:"3"}),s.jsx("path",{d:"M3 5v4c0 1.66 4.03 3 9 3s9-1.34 9-3V5"}),s.jsx("path",{d:"M3 9v4c0 1.66 4.03 3 9 3s9-1.34 9-3V9"}),s.jsx("path",{d:"M3 13v4c0 1.66 4.03 3 9 3s9-1.34 9-3v-4"})]}),s.jsx(we.Typography,{size:"small",variant:"semibold",appearance:"title",children:(Ze??f.length).toLocaleString()}),s.jsx(we.Typography,{size:"small",variant:"regular",appearance:"subtitle",children:"total records"})]}):i?.preContent?s.jsx("div",{className:"flex min-w-0 shrink-0 justify-start items-center",children:i.preContent}):null]}),s.jsxs("div",{className:`flex min-w-0 items-center justify-end ${y<h.TOOLBAR_FIRST_BREAKPOINT?"w-full":i?.content?"shrink-0":"flex-1"} ${y<h.TOOLBAR_SECOND_BREAKPOINT?"flex-col":"flex-row"} ${i?.postContent?"gap-2":""}`,children:[Te&&i?.preContent?s.jsx("div",{className:"flex w-full justify-start items-center",children:i.preContent}):null,s.jsx("div",{className:`flex justify-end items-center min-w-0 ${y<h.TOOLBAR_SECOND_BREAKPOINT||y<h.TOOLBAR_FIRST_BREAKPOINT?"w-full":""}`,children:qe}),i?.postContent?s.jsx("div",{className:`flex justify-end items-center ${y<h.TOOLBAR_SECOND_BREAKPOINT?"w-full":""}`,children:i.postContent}):null]})]}):null,i?.showDivider?s.jsx("div",{className:"border-b pb-2 w-full dark:bg-black-800"}):null,ke||Ae?s.jsx("div",{className:"flex justify-between items-center pb-4 dark:bg-black-800",children:s.jsxs("div",{className:"flex gap-2 items-center",children:[Ae&&o?.renderSortItem?o.renderSortItem({sort:m?.columnSort,onRemoveSort:Ce,onSort:m?.onSort,tableHeaders:S,data:f,disabled:A}):null,ke&&Ae&&m?.columnSort?.field!==""?s.jsx("div",{className:"h-8 w-[1px] flex-shrink-0 bg-neutral-200"}):null,ke?s.jsxs("div",{className:"flex gap-2 items-center",children:[(et||a?.onResetFilter)&&o?.renderActiveFilters&&o.renderActiveFilters({filters:a?.columnFilters,onRemoveFilter:xs,onClearFilter:vs,onResetFilter:a?.onResetFilter,onFilter:a?.onFilter,tableHeaders:S,columnFilters:a?.columnFilters,modelName:G,enableMasterDataEnumSuggestions:X,noSpacing:!0,notionStyle:a?.notionStyle,context:a?.context,data:te??f,agreementCategoryId:Y,agreementDomainId:Z,agreementId:Q,modificationId:K,lineItemRowId:ee,disabled:A}),o?.renderFilterButtons&&o.renderFilterButtons({onClearFilter:a?.onClearFilter,onClose:ds,modelName:G,enableMasterDataEnumSuggestions:X,defaultFilterColumn:Tl,resetDefaultFilterColumn:()=>lt(null),column:yl,onFilter:a?.onFilter,tableHeaders:S,columnFilters:a?.columnFilters,data:te??f,notionStyle:a?.notionStyle,context:a?.context,agreementCategoryId:Y,agreementDomainId:Z,agreementId:Q,modificationId:K,lineItemRowId:ee,disabled:A})]}):null]})}):null,Oe&&Object.keys(Oe).length?s.jsx(Fs.FloatingBar,{...Oe}):null,!pe&&Te?s.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-neutral-500 dark:text-neutral-400 flex-shrink-0","aria-hidden":!0,children:[s.jsx("ellipse",{cx:"12",cy:"5",rx:"9",ry:"3"}),s.jsx("path",{d:"M3 5v4c0 1.66 4.03 3 9 3s9-1.34 9-3V5"}),s.jsx("path",{d:"M3 9v4c0 1.66 4.03 3 9 3s9-1.34 9-3V9"}),s.jsx("path",{d:"M3 13v4c0 1.66 4.03 3 9 3s9-1.34 9-3v-4"})]}),s.jsx(we.Typography,{size:"small",variant:"semibold",appearance:"title",children:(Ze??f.length).toLocaleString()}),s.jsx(we.Typography,{size:"small",variant:"regular",appearance:"subtitle",children:"total records"})]}):!pe&&i?.preContent?s.jsx("div",{className:"flex items-center mb-2",children:i.preContent}):null,s.jsx("div",{ref:Le,className:`w-full ${ae?"h-auto":ne} rounded-lg relative border overflow-x-hidden`,style:{...ae?{height:f?.length>0?`${(f?.length+1)*wl+4}px`:"350px"}:{height:Yl},...nl},children:Xt?kt:s.jsxs(k.DndContext,{sensors:rs,onDragEnd:os,onDragStart:cs,onDragCancel:is,collisionDetection:k.closestCorners,children:[kt,$?Os.createPortal(s.jsx(k.DragOverlay,{adjustScale:!0,dropAnimation:ns,children:s.jsx("table",{...Tt(),className:"w-full text-sm text-left text-neutral-500 dark:text-neutral-200 bg-white dark:bg-black-700 table-auto border-collapse",children:s.jsxs("tbody",{...Ot(),className:"bg-transparent divide-y divide-neutral-200",children:[void Et($),s.jsx(ys.Row,{row:$,index:D?.findIndex(e=>e.id===$.original.id)},$.original.id)]})})}),document.getElementById("full-screen-container")||document.body):null]})}),ae&&o?.renderPagination?o.renderPagination(ae):null,o?.renderMasterDataModal&&o.renderMasterDataModal({isVisible:!!R,onSelected:zl,onClose:xe,masterDataColumnName:R?.masterDataColumnName,masterDataFormula:R?.masterDataFormula,masterDataFilters:R?.masterDataFilters,masterDataName:R?.masterDataName,masterDataId:R?.masterDataName,showFilters:!0}),s.jsx(js.CurrencyDropdownPortal,{config:ut,onClose:pt}),s.jsx(Ns.PendingEditsFloatingBar,{pendingEditsCount:P,pendingEditsList:Wl,rowsWithPendingEdits:Hl,fieldOperationLoading:I,onClearAll:bt,onSaveAll:wt,onScrollToCell:C})]})});exports.InfiniteTable=gs;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),xs=require("../../../hooks/useCheckbox.cjs.js"),Ss=require("../../../providers/design-system-provider/hooks.cjs.js"),Ce=require("../../../utils/table.cjs.js"),Et=require("../../button/Button.cjs.js"),bs=require("../../floating-bar/FloatingBar.cjs.js"),xe=require("../typography/Typography.cjs.js"),k=require("@dnd-kit/core"),l=require("react"),ws=require("react-virtualized-auto-sizer"),ps=require("react-dom"),kt=require("react-table"),Fs=require("./body/index.cjs.js"),Dt=require("./validateCell.cjs.js"),Ts=require("./body/rows/row.cjs.js"),ys=require("./context.cjs.js"),Rs=require("./CurrencyDropdownPortal.cjs.js"),Os=require("./head/index.cjs.js"),js=require("./PendingEditsFloatingBar.cjs.js"),h=require("./constants.cjs.js"),Nt=require("./useRowHeight.cjs.js"),Es=require("../empty-state/NoDataFoundWidgets.cjs.js"),ks=require("../empty-state/NoDataFound.cjs.js"),Ds=require("../../icon/icons.generated.cjs.js"),Ns=ws.AutoSizer,At="Create Column",As=(I,T)=>`button-admin-${I.toLowerCase().trim().replace(/\s+/g,"-").replace(/[^a-z0-9-_]/g,"")||T}`,_s=l.memo(({tableKey:I,searchConfig:T={search:"",handleSearch:()=>null,allowAStarSearch:!1},filterConfig:a={columnFilters:[],onFilter:()=>null,onRemoveFilter:()=>null,onClearFilter:()=>null,onResetFilter:()=>Promise.resolve({}),asyncRowOptionsFilter:()=>Promise.resolve({})},sortConfig:m={onSort:()=>null,columnSort:{field:"",order:""},onRemoveSort:()=>null},headerConfig:i={showExportButton:null,showFilters:!0,showSorts:!0,showSearch:!0,showTableView:!0,showTableViewAsModal:!1,content:null,postContent:null,preContent:null,isLoading:!1,showDivider:!1},hoverConfig:_t=null,columns:R,modelName:G,enableMasterDataEnumSuggestions:X=!1,agreementId:Y,enumSuggestionsExtraParams:Z,enumSuggestionsData:Q,data:f=[],onRowClick:It,showHeader:Se,tableActions:Pe,rowOptions:q,hideRowOptionWidth:qe,checkboxUtilities:M,isLoading:K=!1,onScroll:Mt,onScrolling:Lt,isColumnConfigurable:ee,onAddColumnClick:te,emptyMessage:We,noDataWidget:He,buttons:$e,onEditColumnClick:ze,onDeleteColumnClick:Ue,onRowTooltipClick:gt,tooltiptext:Vt,cascadingTableConfig:Bt,originalsOnly:Ct,disableOptionsForRowIndex:Pt,tableHeightClass:le="h-[calc(100vh-220px)]",getFullRowDataOnClick:qt,selectedRowId:Wt=null,onRowEdit:D,onBulkRowEdit:L,inlineEditColumns:Ht,isResizable:$t=!0,paginationConfig:se,dndSortableUtils:re,multipleContexts:Je,withSortable:be,withDraggable:zt,enableRootDrag:Ut,pageSize:Jt=h.DEFAULT_PAGE_SIZE,onCascadingRowExpand:Gt,totalItems:Ge,showRecordCount:we=!1,getInnerRowData:Xt,maxLevel:Yt,expandedRows:Zt={},setExpandedRows:Qt,showNewItem:Kt,rawData:Xe,dragConfig:el,isOverlayLoading:tl,style:ll={},floatingBarConfig:pe,rowWrapper:sl,rowLinkConfig:rl,isCellClickDisabled:nl,setHeaderOnParent:Fe,optimizeTable:al=!1,multiSelectConfig:ol,headerContextOptions:cl,showHeaderContextOptions:il,setShowHeaderContextOptions:ul,showDataTypeIcon:dl=!1,rowAdditionalActions:ne,rowAdditionalActionsWidth:Te,setVisibleHeaders:ye,cellEditing:hl=null,cellEditingValue:ml=null,allowInlineEdit:fl=!1,onFieldOperationFlow:vl,fieldOperationLoading:g=null,onTableActionsReady:Re,onPendingEditsChange:Ye,onCancelPendingEdits:V})=>{const c=Ss.useTableConfig(),xl=Nt.getRowSlotHeight(Nt.useRowHeight()),Sl=!!T?.search,Ze=a?.columnFilters?.length>0,W=Sl||Ze,bl=!!M,y=c?.getTableView?.(I)??null,[p,H]=l.useState(y||null),N=!Ce.canEditTableView(p,c?.getUserId?.()),[Oe,je]=l.useState(!1),[Ee,Qe]=l.useState(!1),[wl,Ke]=l.useState(null),[S,ke]=l.useState(R),et=(f.length===0||!S.length)&&!K,[tt,ae]=l.useState(null),[pl,Fl]=l.useState(!1),[Tl,yl]=l.useState(null),[Rl,Ol]=l.useState(!1),[jl,oe]=l.useState(null),[El,ce]=l.useState(null),[kl,lt]=l.useState({}),[$,De]=l.useState(null),[Dl,st]=l.useState(!1),[O,Nl]=l.useState(0),Ne=l.useRef(null),Ae=l.useRef(null),[rt,Al]=l.useState({width:0,height:0}),[_l,B]=l.useState(null),[j,nt]=l.useState(null),[Il,at]=l.useState(null),[ot,ct]=l.useState(null),[_e,z]=l.useState({}),Ie=l.useRef(!1),ie=l.useRef(!1),Me=l.useRef(p);Me.current=p;const it=l.useRef(c);it.current=c;const ut=l.useRef(R);ut.current=R;const ue=l.useRef(a);ue.current=a;const dt=l.useRef(null),ht=l.useRef(()=>({})),mt=l.useRef(()=>({})),[d,E]=l.useState({}),Le=l.useCallback((e,t,r)=>{E(n=>{const o=n[e]?.[t];let u=r.validationError;if(u===void 0){const b=S.find(v=>v.key===t);if(b){const v=Dt.validateCellValue(r.value,b);u=v.isValid?null:v.error||"Invalid"}else u=o?.validationError??null}return{...n,[e]:{...n[e]||{},[t]:{...r,validationError:u??null}}}})},[S]),ft=l.useCallback(()=>Object.values(d).some(e=>Object.keys(e).length>0),[d]);l.useEffect(()=>{Re&&Re({addPendingEdit:Le,hasPendingEdits:ft})},[Re,Le,ft]);const Ml=l.useCallback((e,t)=>{E(r=>{const n={...r};if(n[e]){const{[t]:o,...u}=n[e];Object.keys(u).length===0?delete n[e]:n[e]=u}return n})},[]),Ll=l.useCallback((e,t)=>d[e]?.[t],[d]),gl=l.useCallback((e,t)=>!!d[e]?.[t],[d]),vt=l.useCallback(()=>{g||(V&&Object.keys(d).length>0&&V(d),E({}),z({}),B(null))},[g,V,d]),C=l.useCallback((e,t,r)=>{setTimeout(()=>{c?.dispatchEvent?.("SCROLL_TO_TABLE_ROW",{rowIndex:r});const n=S.findIndex(o=>o.key===t);setTimeout(()=>{const o=document.querySelector(`[${h.DATA_ROW_ID_ATTR}="${e}"] [${h.DATA_COLUMN_KEY_ATTR}="${t}"]`);if(o)o.scrollIntoView({behavior:"smooth",block:"center",inline:"center"});else if(n>0){const u=document.querySelector(h.OS_VIEWPORT_SELECTOR);if(u){let b=0;for(let v=0;v<n;v++){const F=S[v];F?.sticky||(b+=F?.width||h.SCROLL_TO_CELL_COLUMN_WIDTH_FALLBACK)}b=Math.max(0,b-h.SCROLL_TO_CELL_LEFT_OFFSET),u.scrollTo({left:b,behavior:"smooth"})}}B({rowId:e,columnKey:t})},350)},100)},[S,c]),U=l.useCallback(e=>{let t=!1,r=null;const n={},o=new Set;return Object.entries(e).forEach(([u,b])=>{n[u]={},Object.entries(b).forEach(([v,F])=>{const _=S.find(w=>w.key===v),x=Dt.validateCellValue(F.value,_);x.isValid?n[u][v]={...F,validationError:null}:(t=!0,x.error&&o.add(x.error),r||(r={rowId:u,columnKey:v}),n[u][v]={...F,validationError:x.error})})}),{hasErrors:t,updatedEdits:n,firstError:r,errorTypes:o}},[S]),de=l.useCallback(e=>{const t=e.has("Field required"),r=e.size>(t?1:0);return t&&r?"Missing required field(s) and invalid format detected. Please review highlighted field(s).":t?"Missing required field(s). Please review highlighted field(s).":"Invalid field value(s). Please review highlighted field(s)."},[]),xt=l.useCallback(()=>{const{hasErrors:e,updatedEdits:t,firstError:r,errorTypes:n}=U(d);if(e){if(E(t),c?.showNotification?.("error",de(n)),r){const u=f.findIndex(b=>b.id===r.rowId);C(r.rowId,r.columnKey,u)}return}const o=[];Object.entries(d).forEach(([u,b])=>{const v=f.find(F=>F.id===u);if(v){const F={...v},_={};Object.entries(b).forEach(([x,w])=>{F[x]=w.value,_[x]={value:w.value,meta:w.meta}}),o.push({...F,__editedFields:_})}}),o.length>0&&(L?L(o):D&&D(null,null,null,null,null,{isBulk:!0,rows:o})),E({}),z({}),B(null)},[d,f,D,L,U,de,C,c]),Vl=l.useCallback(e=>{if(g)return;const t=d[e];t&&V&&V({[e]:t}),E(r=>{const n={...r};return delete n[e],n}),z(r=>{const n={...r};return Object.keys(n).forEach(o=>{o.startsWith(`${e}-`)&&delete n[o]}),n}),B(null)},[g,V,d]),Bl=l.useCallback(e=>{const t=d[e];if(!t||Object.keys(t).length===0)return;const{hasErrors:r,updatedEdits:n,firstError:o,errorTypes:u}=U({[e]:t});if(r){if(E(x=>({...x,[e]:n[e]})),c?.showNotification?.("error",de(u)),o){const x=f.findIndex(w=>w.id===o.rowId);C(o.rowId,o.columnKey,x)}return}const b=f.find(x=>x.id===e);if(!b)return;const v={...b},F={};Object.entries(t).forEach(([x,w])=>{v[x]=w.value,F[x]={value:w.value,meta:w.meta}});const _={...v,__editedFields:F};L?L([_]):D&&D(null,null,null,null,null,{isBulk:!0,rows:[_]}),E(x=>{const w={...x};return delete w[e],w}),z(x=>{const w={...x};return Object.keys(w).forEach(jt=>{jt.startsWith(`${e}-`)&&delete w[jt]}),w}),B(null)},[d,f,D,L,U,de,C,c]),P=l.useMemo(()=>Object.values(d).reduce((e,t)=>e+Object.keys(t).length,0),[d]);l.useEffect(()=>{Ye?.(P>0,P)},[P,Ye]);const Cl=l.useMemo(()=>{const e=[];return Object.entries(d).forEach(([t,r])=>{const n=f.findIndex(o=>o.id===t);Object.entries(r).forEach(([o,u])=>{const b=S.find(v=>v.key===o);e.push({rowId:t,columnKey:o,fieldName:b?.Header||b?.display_name||o,value:u.value,originalValue:u.originalValue,meta:u.meta,originalMeta:u.originalMeta,rowIndex:n})})}),e},[d,S,f]),Pl=l.useMemo(()=>{const e=new Map;return Object.entries(d).forEach(([t,r])=>{const n=f.findIndex(o=>o.id===t);e.set(t,{rowId:t,rowIndex:n,editCount:Object.keys(r).length})}),Array.from(e.values()).sort((t,r)=>t.rowIndex-r.rowIndex)},[d,f]),ql=l.useCallback(e=>nt(e),[]),he=l.useCallback(()=>nt(null),[]),Wl=l.useCallback((e,t)=>{at({value:e,reference:t}),j?.onSelected&&j.onSelected(e,t),he()},[j,he]),Hl=l.useCallback(()=>at(null),[]),$l=l.useCallback(e=>ct(e),[]),St=l.useCallback(()=>ct(null),[]),zl=l.useCallback((e,t)=>{z(r=>({...r,[e]:t}))},[]),Ul=l.useCallback(e=>_e[e],[_e]),Jl=l.useMemo(()=>{const e=le.match(/h-\[(\d+px)\]/);if(e)return e[1];const t=le.match(/h-\[(calc\(.+\))\]/);if(t)return t[1].replace(/([+-])/g," $1 ").replace(/\s+/g," ")},[le]),Gl={isEmpty:et,isFilters:W,isColumnConfigurable:ee,handleOnClick:te,emptyMessage:We,buttons:$e,noDataWidget:He},Xl=c?.t?.(At)??At,me=W?"No Results Found":We||"No Data Found",Yl=typeof me=="string"?c?.t?.(me)??me:me,bt={__isLoading:!0},Zl=new Array(1).fill(bt),Ql=new Array(Jt).fill(bt),J=l.useMemo(()=>S.filter(e=>!!e?.visible),[S]),Kl=kt.useTable({columns:al?J:S,data:[...f,...K?f?.length?Zl:Ql:[]],defaultColumn:{minWidth:h.DEFAULT_COLUMN_MIN_WIDTH,width:h.DEFAULT_COLUMN_WIDTH,maxWidth:h.DEFAULT_COLUMN_MAX_WIDTH}},kt.useResizeColumns),{getTableProps:wt,getTableBodyProps:pt,headerGroups:fe,prepareRow:Ft,rows:A}=Kl;dt.current=fe;const es=JSON.stringify(fe[0]?.headers?.map(e=>e?.Header));l.useEffect(()=>{if(ye){const e=dt.current;ye?.(e?.[0]?.headers?.map(t=>t?.Header)??[])}},[es,ye]);const{checkboxConfig:Tt}=xs.useCheckbox({rows:A,checkedIds:M?.checkedIds,isCheckAllDisabled:M?.isCheckAllDisabled,selectionDisabledRowIds:M?.selectionDisabledRowIds,rawData:Xe,onAllChecked:Ol,setCheckedIds:M?.setCheckedIds,checkboxMetadata:M?.checkboxMetadata}),ts=k.useSensors(k.useSensor(k.MouseSensor,{activationConstraint:{distance:h.DND_ACTIVATION_DISTANCE}}),k.useSensor(k.TouchSensor,{activationConstraint:{distance:h.DND_ACTIVATION_DISTANCE}})),ls={easing:h.DROP_ANIMATION_EASING,duration:h.DROP_ANIMATION_DURATION};function ss(){return!Je?.length||!be?A:Je.reduce((e,t)=>(e[t]=A.filter(r=>r.original?.type===t),e),{})}mt.current=ss;const rs=e=>{const{active:t}=e;De(A.find(r=>r.original?.id===t?.id)??null)},ns=e=>{const{active:t,over:r}=e;r&&(re?.checkDndDragEnd&&re.checkDndDragEnd(t,r,kl,n=>{lt(n),st(!0),re.onDragSuccess?.({draggedId:t.id,droppedId:r.id,draggedType:t.data.current?.type,droppedType:r.data.current?.type,updatedList:n,cb:()=>st(!1)})}),De(null))},as=()=>De(null),os=e=>{!m?.onSort&&!a?.onFilter||ae(tt===e?null:e)},cs=e=>{yl(e),Fl(!pl),ae(null)},ge=l.useCallback(()=>{m?.onRemoveSort?m.onRemoveSort():m?.onSort&&m.onSort("","")},[m]),ve=l.useCallback((e=null)=>{Ke(e),je(t=>e?!0:!t)},[]),Ve=l.useCallback(()=>Qe(e=>!e),[]),is=()=>{const e=fe[0]?.headers?.filter(t=>t?.visible!==!1);for(let t=0;t<e.length;t++)if(e[t].sticky)return t-1;return e.length-1},us=l.useCallback(e=>{let t=0;for(let r=e+1;r<J.length;r++)J[r].visible!==!1&&(t+=J[r].width??0);return ne&&(t+=Te||h.ROW_ADDITIONAL_ACTIONS_DEFAULT_WIDTH),q&&(t+=qe?0:h.ROW_OPTIONS_COLUMN_WIDTH),t},[J,Te,qe,ne,q]),yt=()=>{const e=c?.getUserId?.();return{...p||{},name:p?.name||"Untitled View",created_by:p?.created_by||e,filters:p?.filters||a?.columnFilters,id:p?.id||"untitled-view",table_key:p?.table_key||I,columns:p?.columns||R?.map((t,r)=>({name:t.Header,width:t.width,visible:t.visible,sticky:t.sticky,order:r+1,display_name:t.Header,sequence:r+1,Header:t.Header}))}};ht.current=yt;const ds=(e,t)=>{if(N)return;const r=yt();H({...r,columns:r?.columns?.map(n=>n.name===e?{...n,width:t}:n),unsaved:!0})};l.useEffect(()=>{if(a?.columnFilters?.length>0&&je(!0),N)return;const e=Me.current;if(JSON.stringify(e?.filters||[])!==JSON.stringify(a?.columnFilters||[])){const t=(e?.filters?.length??0)>0,r=a?.columnFilters?.length>0;if(!(t&&!r&&!ie.current)){const o=ht.current();H({...o,filters:JSON.parse(JSON.stringify(a?.columnFilters||[])),unsaved:!0})}ie.current=!1}},[a?.columnFilters,N]);const hs=l.useCallback(e=>{ie.current=!0,a?.onRemoveFilter?.(e)},[a?.onRemoveFilter]),ms=l.useCallback(()=>{ie.current=!0,a?.onClearFilter?.()},[a?.onClearFilter]);l.useEffect(()=>{m?.columnSort?.field?(Qe(!0),m.columnSort.order==="asc"?(oe(m.columnSort.field),ce(null)):m.columnSort.order==="desc"&&(ce(m.columnSort.field),oe(null))):(oe(null),ce(null))},[m?.columnSort?.field,m?.columnSort?.order]),l.useEffect(()=>{ke(Ce.mergeViewColumnsWithTableColumns(Me.current?.columns||[],R))},[R]),l.useEffect(()=>{p?.unsaved&&it.current?.persistTableView?.(p)},[p]),l.useEffect(()=>{lt(mt.current())},[A.length]),l.useEffect(()=>{H(y||null),y?.columns&&ke(Ce.mergeViewColumnsWithTableColumns(y?.columns||[],ut.current)),y?.filters&&y.filters.length>0&&!Ie.current?(requestAnimationFrame(()=>{ue.current?.onFilter?.(y.filters)}),Ie.current=!0):y?.filters&&Ie.current&&JSON.stringify(y.filters)!==JSON.stringify(ue.current?.columnFilters)&&ue.current?.onFilter?.(y.filters)},[y]),l.useEffect(()=>{if(Ne.current){const e=new ResizeObserver(t=>Nl(t[0].contentRect.width));return e.observe(Ne.current),()=>e.disconnect()}},[]),l.useEffect(()=>{if(!Ae.current)return;const e=new ResizeObserver(t=>{const{width:r,height:n}=t[0].contentRect;Al({width:r,height:n})});return e.observe(Ae.current),()=>e.disconnect()},[]);const Rt=s.jsx(Os.Head,{isResizable:$t,headerGroups:fe,isCheckbox:bl,checkboxConfig:Tt,isAllChecked:Rl,showHeaderOptions:tt??"",setShowHeaderOptions:ae,isShowSortArrowAsc:jl,isShowSortArrowDesc:El,onSort:m?.onSort,onFilter:a?.onFilter,toggleHeaderOption:os,setIsShowSortArrowAsc:oe,setIsShowSortArrowDesc:ce,toggleDataFilterModal:ve,rowOptions:Array.isArray(q)?q:[],isColumnConfigurable:ee??!1,onAddColumnClick:te,onEditColumnClick:ze,onDeleteColumnClick:Ue,tableActions:Pe||null,isLoading:K,rowAdditionalActions:ne??null,showPendingEditsColumn:P>0}),Ot=s.jsxs(s.Fragment,{children:[Dl||tl?s.jsx("div",{className:"absolute left-0 top-0 w-full h-full z-40 flex items-center justify-center bg-neutral-100 dark:bg-black-700"}):null,s.jsx("div",{...wt(),className:"w-full text-sm text-left text-neutral-500 dark:text-neutral-200 h-full bg-white dark:bg-black-800",children:et?s.jsxs("div",{className:"z-10",children:[Rt,s.jsx("div",{className:"absolute w-full",children:c?.renderEmpty?c.renderEmpty(Gl):s.jsxs("div",{className:"flex flex-col items-center justify-center w-full h-[12rem] text-neutral-900 dark:text-neutral-200 mt-8",children:[He&&!W?s.jsx(Es.NoDataFoundWidgets,{widgetType:"TABLE"}):s.jsx(ks.NoDataFound,{text:Yl}),ee&&!W?s.jsx("div",{className:"my-4",children:s.jsxs(Et,{id:"btn-table-shell-create-column",status:"primary",appearance:"ghost",onClick:te,children:[s.jsx(Ds.Add2Icon,{className:"text-white dark:text-white"})," ",Xl]})}):null,!W&&$e?.map((e,t)=>s.jsx(Et,{status:"secondary",id:As(e.label,t),onClick:e.onClick,children:c?.t?.(e.label)??e.label},`${e.label}-${t}`))]})})]}):s.jsx(Ns,{style:{width:"100%",height:"100%"},renderProp:({width:e,height:t})=>{const r=e>0?e:rt.width,n=t>0?t:rt.height;return r>0&&n>0?s.jsx(Fs.Body,{getTableBodyProps:pt,rows:A,prepareRow:Ft,isLoading:K,onScroll:Mt,onScrolling:Lt,columns:R,width:r,height:n,withSortable:be,allowAstarSearch:T?.allowAStarSearch||!1}):null}})})]}),fs=l.forwardRef((e,t)=>s.jsxs("div",{className:"h-full w-full",...e,ref:t,children:[Rt,s.jsx("div",{className:"relative w-full h-full",children:e?.children})]})),vs=l.forwardRef((e,t)=>s.jsx("div",{className:"h-full w-full",...e,ref:t,children:s.jsx("div",{className:"relative w-full h-full",children:e?.children})})),Be=l.useMemo(()=>c?.renderTableHeader?c.renderTableHeader({tableKey:I,search:T?.search,handleSearch:T?.handleSearch,toggleShowFilters:ve,toggleShowSorts:Ve,filterCounts:a?.columnFilters?.length,columns:R,columnFilters:a?.columnFilters,setSelectedTableView:H,selectedTableView:p,enableTableView:i?.showTableView,modelName:G,enableMasterDataEnumSuggestions:X,onRemoveFilter:a?.onRemoveFilter,onClearFilter:a?.onClearFilter,onFilter:a?.onFilter,data:Q??f,tableHeaders:S,showTableViewAsModal:i?.showTableViewAsModal,additionalOptions:i?.additionalOptions,inlineActions:i?.inlineActions,showFilters:i?.showFilters,showSorts:i?.showSorts,showSearch:i?.showSearch,isLoading:!!i?.isLoading,setTableHeaders:ke,allowAStarSearch:!!T?.allowAStarSearch,withContent:!!i?.content,setShowFilters:je,sort:m?.columnSort,onSort:m?.onSort,onRemoveSort:ge,showExportButton:i?.showExportButton,onExportClick:i?.onExportClick,agreementId:Y,enumSuggestionsExtraParams:Z}):null,[I,T?.search,T?.handleSearch,ve,Ve,a?.columnFilters,R,H,p,i,G,a?.onRemoveFilter,a?.onClearFilter,a?.onFilter,f,Q,S,m?.columnSort,m?.onSort,ge,c,T?.allowAStarSearch,X,Y,Z]);return l.useEffect(()=>{Fe&&Fe(Be)},[Be,Fe]),s.jsxs(ys.TableContext.Provider,{value:{tableWrapper:fs,tableBodyWrapper:vs,lastNonStickyColumnIndex:is,search:T?.search,columnFilters:a?.columnFilters,onRowClick:It,onSort:m?.onSort,onFilter:a?.onFilter,toggleShowFilters:ve,toggleShowSorts:Ve,onRemoveFilter:a?.onRemoveFilter,onClearFilter:a?.onClearFilter,rowOptions:q,checkboxConfig:Tt,onResetFilter:a?.onResetFilter,isColumnConfigurable:ee,onAddColumnClick:te,onEditColumnClick:ze,onDeleteColumnClick:Ue,onRowTooltipClick:gt,tooltiptext:Vt,cascadingTableConfig:Bt,activeInlineEdit:_l,setActiveInlineEdit:B,originalsOnly:Ct,disableOptionsForRowIndex:Pt,getFullRowDataOnClick:qt,selectedRowId:Wt,getSumOfNextVisibleColumnWidth:us,onRowEdit:D,inlineEditColumns:Ht,tableActions:Pe,dndSortableUtils:re,withSortable:be,withDraggable:zt,onCascadingRowExpand:Gt,getInnerRowData:Xt,tableHeaders:S,maxLevel:Yt,expandedRows:Zt,setExpandedRows:Qt,showNewItem:Kt,rawData:Xe,dragConfig:el,rowWrapper:sl,rowLinkConfig:rl,isCellClickDisabled:nl,asyncRowOptionsFilter:a?.asyncRowOptionsFilter,handleUpdateColumnWidth:ds,isTableViewReadOnly:N,multiSelectConfig:ol,headerContextOptions:cl,showHeaderContextOptions:il,setShowHeaderContextOptions:ul,headerDivWidth:O,showDataTypeIcon:dl,rowAdditionalActions:ne,hoverConfig:_t,rowAdditionalActionsWidth:Te,cellEditing:hl,cellEditingValue:ml,openMasterDataModal:ql,closeMasterDataModal:he,selectedMasterData:Il,clearSelectedMasterData:Hl,allowInlineEdit:fl,openCurrencyDropdown:$l,closeCurrencyDropdown:St,currencyDropdownConfig:ot,selectedCurrenciesMap:_e,setCurrencyForCell:zl,getCurrencyForCell:Ul,pendingEdits:d,addPendingEdit:Le,removePendingEdit:Ml,getPendingEdit:Ll,hasPendingEdit:gl,clearAllPendingEdits:vt,saveAllPendingEdits:xt,clearRowPendingEdits:Vl,saveRowPendingEdits:Bl,pendingEditsCount:P,scrollToCell:C,onFieldOperationFlow:vl,fieldOperationLoading:g,validateAllPendingEdits:U},children:[Se?s.jsxs("div",{ref:Ne,className:`mb-2 flex w-full min-w-0 gap-2 dark:bg-black-800 ${O<h.TOOLBAR_FIRST_BREAKPOINT?"flex-col items-stretch":"flex-row items-center"}`,children:[s.jsxs("div",{className:`flex items-center gap-x-2 gap-y-1 ${O<h.TOOLBAR_FIRST_BREAKPOINT?"w-full flex-wrap":""} ${i?.content?"min-w-0 flex-1":"shrink-0"}`,children:[i?.content?s.jsx("div",{className:`min-w-0 ${O<h.TOOLBAR_FIRST_BREAKPOINT?"w-full":"flex-1"}`,children:i.content}):null,we?s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-neutral-500 dark:text-neutral-400 flex-shrink-0","aria-hidden":!0,children:[s.jsx("ellipse",{cx:"12",cy:"5",rx:"9",ry:"3"}),s.jsx("path",{d:"M3 5v4c0 1.66 4.03 3 9 3s9-1.34 9-3V5"}),s.jsx("path",{d:"M3 9v4c0 1.66 4.03 3 9 3s9-1.34 9-3V9"}),s.jsx("path",{d:"M3 13v4c0 1.66 4.03 3 9 3s9-1.34 9-3v-4"})]}),s.jsx(xe.Typography,{size:"small",variant:"semibold",appearance:"title",children:(Ge??f.length).toLocaleString()}),s.jsx(xe.Typography,{size:"small",variant:"regular",appearance:"subtitle",children:"total records"})]}):i?.preContent?s.jsx("div",{className:"flex min-w-0 shrink-0 justify-start items-center",children:i.preContent}):null]}),s.jsxs("div",{className:`flex min-w-0 items-center justify-end ${O<h.TOOLBAR_FIRST_BREAKPOINT?"w-full":i?.content?"shrink-0":"flex-1"} ${O<h.TOOLBAR_SECOND_BREAKPOINT?"flex-col":"flex-row"} ${i?.postContent?"gap-2":""}`,children:[we&&i?.preContent?s.jsx("div",{className:"flex w-full justify-start items-center",children:i.preContent}):null,s.jsx("div",{className:`flex justify-end items-center min-w-0 ${O<h.TOOLBAR_SECOND_BREAKPOINT||O<h.TOOLBAR_FIRST_BREAKPOINT?"w-full":""}`,children:Be}),i?.postContent?s.jsx("div",{className:`flex justify-end items-center ${O<h.TOOLBAR_SECOND_BREAKPOINT?"w-full":""}`,children:i.postContent}):null]})]}):null,i?.showDivider?s.jsx("div",{className:"border-b pb-2 w-full dark:bg-black-800"}):null,Oe||Ee?s.jsx("div",{className:"flex justify-between items-center pb-4 dark:bg-black-800",children:s.jsxs("div",{className:"flex gap-2 items-center",children:[Ee&&c?.renderSortItem?c.renderSortItem({sort:m?.columnSort,onRemoveSort:ge,onSort:m?.onSort,tableHeaders:S,data:f,disabled:N}):null,Oe&&Ee&&m?.columnSort?.field!==""?s.jsx("div",{className:"h-8 w-[1px] flex-shrink-0 bg-neutral-200"}):null,Oe?s.jsxs("div",{className:"flex gap-2 items-center",children:[(Ze||a?.onResetFilter)&&c?.renderActiveFilters&&c.renderActiveFilters({filters:a?.columnFilters,onRemoveFilter:hs,onClearFilter:ms,onResetFilter:a?.onResetFilter,onFilter:a?.onFilter,tableHeaders:S,columnFilters:a?.columnFilters,modelName:G,enableMasterDataEnumSuggestions:X,noSpacing:!0,notionStyle:a?.notionStyle,context:a?.context,data:Q??f,agreementId:Y,enumSuggestionsExtraParams:Z,disabled:N}),c?.renderFilterButtons&&c.renderFilterButtons({onClearFilter:a?.onClearFilter,onClose:cs,modelName:G,enableMasterDataEnumSuggestions:X,defaultFilterColumn:wl,resetDefaultFilterColumn:()=>Ke(null),column:Tl,onFilter:a?.onFilter,tableHeaders:S,columnFilters:a?.columnFilters,data:Q??f,notionStyle:a?.notionStyle,context:a?.context,agreementId:Y,enumSuggestionsExtraParams:Z,disabled:N})]}):null]})}):null,pe&&Object.keys(pe).length?s.jsx(bs.FloatingBar,{...pe}):null,!Se&&we?s.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-neutral-500 dark:text-neutral-400 flex-shrink-0","aria-hidden":!0,children:[s.jsx("ellipse",{cx:"12",cy:"5",rx:"9",ry:"3"}),s.jsx("path",{d:"M3 5v4c0 1.66 4.03 3 9 3s9-1.34 9-3V5"}),s.jsx("path",{d:"M3 9v4c0 1.66 4.03 3 9 3s9-1.34 9-3V9"}),s.jsx("path",{d:"M3 13v4c0 1.66 4.03 3 9 3s9-1.34 9-3v-4"})]}),s.jsx(xe.Typography,{size:"small",variant:"semibold",appearance:"title",children:(Ge??f.length).toLocaleString()}),s.jsx(xe.Typography,{size:"small",variant:"regular",appearance:"subtitle",children:"total records"})]}):!Se&&i?.preContent?s.jsx("div",{className:"flex items-center mb-2",children:i.preContent}):null,s.jsx("div",{ref:Ae,className:`w-full ${se?"h-auto":le} rounded-lg relative border overflow-x-hidden`,style:{...se?{height:f?.length>0?`${(f?.length+1)*xl+4}px`:"350px"}:{height:Jl},...ll},children:Ut?Ot:s.jsxs(k.DndContext,{sensors:ts,onDragEnd:ns,onDragStart:rs,onDragCancel:as,collisionDetection:k.closestCorners,children:[Ot,$?ps.createPortal(s.jsx(k.DragOverlay,{adjustScale:!0,dropAnimation:ls,children:s.jsx("table",{...wt(),className:"w-full text-sm text-left text-neutral-500 dark:text-neutral-200 bg-white dark:bg-black-700 table-auto border-collapse",children:s.jsxs("tbody",{...pt(),className:"bg-transparent divide-y divide-neutral-200",children:[void Ft($),s.jsx(Ts.Row,{row:$,index:A?.findIndex(e=>e.id===$.original.id)},$.original.id)]})})}),document.getElementById("full-screen-container")||document.body):null]})}),se&&c?.renderPagination?c.renderPagination(se):null,c?.renderMasterDataModal&&c.renderMasterDataModal({isVisible:!!j,onSelected:Wl,onClose:he,masterDataColumnName:j?.masterDataColumnName,masterDataFormula:j?.masterDataFormula,masterDataFilters:j?.masterDataFilters,masterDataName:j?.masterDataName,masterDataId:j?.masterDataName,showFilters:!0}),s.jsx(Rs.CurrencyDropdownPortal,{config:ot,onClose:St}),s.jsx(js.PendingEditsFloatingBar,{pendingEditsCount:P,pendingEditsList:Cl,rowsWithPendingEdits:Pl,fieldOperationLoading:g,onClearAll:vt,onSaveAll:xt,onScrollToCell:C})]})});exports.InfiniteTable=_s;
|
|
2
2
|
//# sourceMappingURL=index.cjs.js.map
|