@e-llm-studio/federated-dashboard-components 2.0.1 → 2.1.1
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/ExecutiveDashboard/components/DashboardDateFilter/DashboardDateFilter.js +1 -1
- package/dist/ExecutiveDashboard/components/DashboardDateFilter/SubscriptionFeature/CreateSubscriptionModal.js +2 -0
- package/dist/ExecutiveDashboard/components/DashboardDateFilter/SubscriptionFeature/CreateSubscriptionModal.js.map +1 -0
- package/dist/ExecutiveDashboard/components/DashboardDateFilter/SubscriptionFeature/ReportSidebar.js +2 -0
- package/dist/ExecutiveDashboard/components/DashboardDateFilter/SubscriptionFeature/ReportSidebar.js.map +1 -0
- package/dist/ExecutiveDashboard/components/TablePage/TablePage.js +2 -0
- package/dist/ExecutiveDashboard/components/TablePage/TablePage.js.map +1 -0
- package/dist/ExecutiveDashboard/components/common/ConfirmationModal.js +2 -0
- package/dist/ExecutiveDashboard/components/common/ConfirmationModal.js.map +1 -0
- package/dist/HumanIntelligence/components/CognitiveDecisioning/CognitiveDecisioning.js +1 -1
- package/dist/HumanIntelligence/components/HumanChangesSummary/HumanChangesSummary.js +1 -1
- package/dist/HumanIntelligence/components/HumanChangesSummary/HumanChangesSummary.module.css.js +1 -1
- package/dist/HumanIntelligence/hooks/useHighlightNavigation.js +1 -1
- package/dist/HumanIntelligence/utils/citationRecord.js +2 -0
- package/dist/HumanIntelligence/utils/citationRecord.js.map +1 -0
- package/dist/HumanIntelligence/utils/inlineMarkup.js +2 -0
- package/dist/HumanIntelligence/utils/inlineMarkup.js.map +1 -0
- package/dist/RecordDashboard/RecordComponents/RecordDashboard.js +1 -1
- package/dist/RecordDashboard/RecordComponents/Table/RecordTableCard.js +1 -1
- package/dist/RecordDashboard/RecordDashboardWrapper.js +1 -1
- package/dist/RecordDashboard/RecordUtils/RecordTableColumns.js +1 -1
- package/dist/cjs/ExecutiveDashboard/components/DashboardDateFilter/DashboardDateFilter.js +1 -1
- package/dist/cjs/ExecutiveDashboard/components/DashboardDateFilter/SubscriptionFeature/CreateSubscriptionModal.js +2 -0
- package/dist/cjs/ExecutiveDashboard/components/DashboardDateFilter/SubscriptionFeature/CreateSubscriptionModal.js.map +1 -0
- package/dist/cjs/ExecutiveDashboard/components/DashboardDateFilter/SubscriptionFeature/ReportSidebar.js +2 -0
- package/dist/cjs/ExecutiveDashboard/components/DashboardDateFilter/SubscriptionFeature/ReportSidebar.js.map +1 -0
- package/dist/cjs/ExecutiveDashboard/components/TablePage/TablePage.js +2 -0
- package/dist/cjs/ExecutiveDashboard/components/TablePage/TablePage.js.map +1 -0
- package/dist/cjs/ExecutiveDashboard/components/common/ConfirmationModal.js +2 -0
- package/dist/cjs/ExecutiveDashboard/components/common/ConfirmationModal.js.map +1 -0
- package/dist/cjs/HumanIntelligence/components/CognitiveDecisioning/CognitiveDecisioning.js +1 -1
- package/dist/cjs/HumanIntelligence/components/HumanChangesSummary/HumanChangesSummary.js +1 -1
- package/dist/cjs/HumanIntelligence/components/HumanChangesSummary/HumanChangesSummary.module.css.js +1 -1
- package/dist/cjs/HumanIntelligence/hooks/useHighlightNavigation.js +1 -1
- package/dist/cjs/HumanIntelligence/utils/citationRecord.js +2 -0
- package/dist/cjs/HumanIntelligence/utils/citationRecord.js.map +1 -0
- package/dist/cjs/HumanIntelligence/utils/inlineMarkup.js +2 -0
- package/dist/cjs/HumanIntelligence/utils/inlineMarkup.js.map +1 -0
- package/dist/cjs/RecordDashboard/RecordComponents/RecordDashboard.js +1 -1
- package/dist/cjs/RecordDashboard/RecordComponents/Table/RecordTableCard.js +1 -1
- package/dist/cjs/RecordDashboard/RecordDashboardWrapper.js +1 -1
- package/dist/cjs/RecordDashboard/RecordUtils/RecordTableColumns.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/styles.css +1 -1
- package/dist/index.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/ExecutiveDashboard/TestExecutiveDashboard.d.ts.map +1 -1
- package/dist/types/ExecutiveDashboard/components/DashboardDateFilter/DashboardDateFilter.d.ts +3 -1
- package/dist/types/ExecutiveDashboard/components/DashboardDateFilter/DashboardDateFilter.d.ts.map +1 -1
- package/dist/types/ExecutiveDashboard/components/DashboardDateFilter/SubscriptionFeature/CreateSubscriptionModal.d.ts +33 -0
- package/dist/types/ExecutiveDashboard/components/DashboardDateFilter/SubscriptionFeature/CreateSubscriptionModal.d.ts.map +1 -0
- package/dist/types/ExecutiveDashboard/components/DashboardDateFilter/SubscriptionFeature/ReportSidebar.d.ts +11 -0
- package/dist/types/ExecutiveDashboard/components/DashboardDateFilter/SubscriptionFeature/ReportSidebar.d.ts.map +1 -0
- package/dist/types/ExecutiveDashboard/components/MetricCard/MetricCard.d.ts +1 -1
- package/dist/types/ExecutiveDashboard/components/MetricCard/MetricCard.d.ts.map +1 -1
- package/dist/types/ExecutiveDashboard/components/TablePage/TablePage.d.ts +42 -0
- package/dist/types/ExecutiveDashboard/components/TablePage/TablePage.d.ts.map +1 -0
- package/dist/types/ExecutiveDashboard/components/common/ConfirmationModal.d.ts +17 -0
- package/dist/types/ExecutiveDashboard/components/common/ConfirmationModal.d.ts.map +1 -0
- package/dist/types/ExecutiveDashboard/types/index.d.ts +67 -0
- package/dist/types/ExecutiveDashboard/types/index.d.ts.map +1 -1
- package/dist/types/HumanIntelligence/TestHumanIntelligence.d.ts.map +1 -1
- package/dist/types/HumanIntelligence/components/CognitiveDecisioning/CognitiveDecisioning.d.ts.map +1 -1
- package/dist/types/HumanIntelligence/components/HumanChangesSummary/HumanChangesSummary.d.ts +4 -0
- package/dist/types/HumanIntelligence/components/HumanChangesSummary/HumanChangesSummary.d.ts.map +1 -1
- package/dist/types/HumanIntelligence/hooks/useHighlightNavigation.d.ts.map +1 -1
- package/dist/types/HumanIntelligence/index.d.ts +2 -0
- package/dist/types/HumanIntelligence/index.d.ts.map +1 -1
- package/dist/types/HumanIntelligence/utils/citationRecord.d.ts +26 -0
- package/dist/types/HumanIntelligence/utils/citationRecord.d.ts.map +1 -0
- package/dist/types/HumanIntelligence/utils/inlineMarkup.d.ts +11 -0
- package/dist/types/HumanIntelligence/utils/inlineMarkup.d.ts.map +1 -0
- package/dist/types/RecordDashboard/RecordComponents/RecordDashboard.d.ts.map +1 -1
- package/dist/types/RecordDashboard/RecordComponents/Table/RecordTableCard.d.ts.map +1 -1
- package/dist/types/RecordDashboard/RecordDashboardWrapper.d.ts.map +1 -1
- package/dist/types/RecordDashboard/RecordTypes/index.d.ts +1 -0
- package/dist/types/RecordDashboard/RecordTypes/index.d.ts.map +1 -1
- package/dist/types/RecordDashboard/RecordUtils/RecordTableColumns.d.ts.map +1 -1
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"../../../_virtual/_tslib.js";import{jsxs as t,jsx as i,Fragment as l}from"react/jsx-runtime";import{useState as
|
|
1
|
+
import{__assign as e}from"../../../_virtual/_tslib.js";import{jsxs as t,jsx as i,Fragment as l}from"react/jsx-runtime";import{useState as n,useEffect as a}from"react";import{Button as o}from"primereact/button";import{RefreshCw as r,CalendarClock as s,ListFilter as d}from"lucide-react";import c from"../DatePickers/DateSelector.js";import{DEFAULT_DATE_PRESETS as u}from"./datePreset.js";var v=function(v){var m,p,f,h,D=v.presets,b=void 0===D?u:D,g=v.filterCount,x=void 0===g?0:g,C=v.liveDuration,q=void 0===C?3e4:C,N=v.onDateChange,k=v.onRefresh,w=v.isRefreshLoading,y=v.onFilterClick,P=v.onSubscriptionsClick,R=v.showFilterButton,B=void 0===R||R,F=v.showSubscriptionButton,S=void 0!==F&&F,j=v.showLiveButton,E=void 0===j||j,z=v.showFilterCount,L=void 0!==z&&z,T=v.datePickerProps,I=v.initialStartDate,W=v.initialEndDate;v.defaultPresets;var _=v.pollingEnabled,A=void 0!==_&&_,H=v.selectedPreset,G=void 0===H?"today":H,J=v.handlePresetChange,K=n(!0),M=K[0],O=K[1],Q=n(I||null),U=Q[0],V=Q[1],X=n(W||null),Y=X[0],Z=X[1];a(function(){V(I||null),Z(W||null)},[I,W]);var $=n(!1),ee=$[0],te=$[1];a(function(){var e=setTimeout(function(){O(!1)},q);return function(){return clearTimeout(e)}},[G,q]),a(function(){if("custom"!==G){var e=b.find(function(e){return e.value===G});if(e&&e.getRange){var t=e.getRange();null==N||N({preset:G,startDate:t.startDate,endDate:t.endDate})}}},[G,b,N]);var ie=b;return t("div",e({className:"q-date-filter"},{children:[t("div",e({className:"q-date-filter-toolbar"},{children:[t("div",e({style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"}},{children:[i("div",e({className:"q-preset-container"},{children:null==ie?void 0:ie.map(function(t){return i("button",e({className:"q-preset-btn ".concat(G===(null==t?void 0:t.value)?"active":""),onClick:function(){return null==J?void 0:J(null==t?void 0:t.value)}},{children:null==t?void 0:t.label}),null==t?void 0:t.value)})})),E&&t(l,M&&!A?{children:[i("div",{style:{width:"1px",height:"31px",backgroundColor:"#CBD5E1"}}),t("div",e({className:"q-live-chip"},{children:[i("span",{className:"q-live-dot"}),"Live Data"]}))]}:{children:[i("div",{className:"q-date-separator",style:{width:"1px",height:"31px",backgroundColor:"#CBD5E1"}}),t(o,e({className:"q-refresh-btn",onClick:k},{children:[i(r,{size:16,strokeWidth:2.5,className:w?"q-spin":""}),i("span",{children:w?"Refreshing...":"Refresh"})]}))]})]})),t("div",e({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[S&&t("button",e({className:"q-filter-btn",onClick:P},{children:[i(s,{size:12.5}),"Subscriptions"]})),B&&t("button",e({className:"q-filter-btn",onClick:y},{children:[i(d,{size:12.5}),"Filters",L&&x>0&&i("span",e({className:"q-filter-badge"},{children:x}))]}))]}))]})),"custom"===G&&t("div",e({className:"q-custom-container"},{children:[i(c,{label:"From",value:U,minDate:null===(m=null==T?void 0:T.from)||void 0===m?void 0:m.minDate,maxDate:null!=Y?Y:null===(p=null==T?void 0:T.from)||void 0===p?void 0:p.maxDate,onChange:function(e){V(e),te(!1)},styles:{root:{width:"250px"}}}),i(c,{label:"To",value:Y,minDate:null!=U?U:null===(f=null==T?void 0:T.to)||void 0===f?void 0:f.minDate,maxDate:null===(h=null==T?void 0:T.to)||void 0===h?void 0:h.maxDate,onChange:function(e){Z(e),te(!1)},styles:{root:{width:"250px"}}}),i(o,{className:"q-apply-btn",label:"Apply Range",disabled:!U||!Y||ee,onClick:function(){if(U&&Y){var e=new Date(U);e.setHours(0,0,0,0);var t=new Date;null==N||N({preset:"custom",startDate:e,endDate:t}),te(!0)}}})]}))]}))};export{v as default};
|
|
2
2
|
//# sourceMappingURL=DashboardDateFilter.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__spreadArray as e,__assign as r,__awaiter as s,__generator as i}from"../../../../_virtual/_tslib.js";import{jsx as a,jsxs as l}from"react/jsx-runtime";import{useState as n,useEffect as t,useMemo as o}from"react";import{X as c,Check as u,Info as d}from"lucide-react";import b from"../../DropDowns/CustomSingleSelect.js";import v from"../../DropDowns/CustomMultiSelect.js";var m=function(m){var p=m.isOpen,f=m.onClose,h=m.scopeFields,y=void 0===h?[]:h,g=m.subscriptionTypes,N=void 0===g?[{label:"Periodic",value:"Periodic",triggers:[{label:"Daily",value:"daily",info:"Email is sent at 8:00 AM on the next day after the selected period."},{label:"Weekly",value:"weekly",info:"Email is sent at 8:00 AM on the Monday after the selected period."},{label:"Monthly",value:"monthly",info:"Email is sent at 8:00 AM on the Monday after the selected period."}]},{label:"Event-based",value:"Event-based"}]:g,q=m.onSearchSubscribers,C=m.onSave,S=m.editData,w=n(1),L=w[0],k=w[1],x=n(""),A=x[0],M=x[1],E=n({}),T=E[0],j=E[1],z=n("Periodic"),D=z[0],O=z[1],P=n("daily"),_=P[0],B=P[1],W=n([]),U=W[0],F=W[1],R=n(""),H=R[0],G=R[1],I=n(!1),J=I[0],K=I[1],Q=n([]),V=Q[0],X=Q[1],Y=n(!1),Z=Y[0],$=Y[1];t(function(){if(p&&S){M(S.name||"");var e={},r=(null==S?void 0:S.reportScope)||{};Object.keys(r).forEach(function(s){var i=r[s],a=y.find(function(e){return e.id.toLowerCase()===s.toLowerCase()||e.label.toLowerCase()===s.toLowerCase()});"string"==typeof i&&"multiSelect"===(null==a?void 0:a.scopeType)&&i.includes(",")&&(i=i.split(",").map(function(e){return e.trim()}));var l=i;if(a&&a.options){var n=function(e){var r=String(e).trim().toLowerCase(),s=a.options.find(function(e){return String(e.value).toLowerCase()===r||String(e.label).toLowerCase()===r});return s?s.value:e};Array.isArray(i)?l=i.map(n):i&&(l=n(i))}var t=a?a.id:s;"multiSelect"===(null==a?void 0:a.scopeType)?e[t]=Array.isArray(l)?l:l?[l]:[]:"singleSelect"===(null==a?void 0:a.scopeType)?e[t]=Array.isArray(l)?l.length>0?l[0]:"":l:e[t]=l}),k(1),j(e),O(S.type||(N.length>0?N[0].value:"Periodic")),B(S.trigger||"daily");var s=Array.isArray(S.subscribers)?S.subscribers.map(function(e){var r="string"==typeof e?e:e.email||e.value||e.name||e;return{label:"string"==typeof e?e:e.name||e.label||e.email||r,value:r}}):S.subscribers?[{label:"string"==typeof S.subscribers?S.subscribers:S.subscribers.name||S.subscribers.email||S.subscribers,value:"string"==typeof S.subscribers?S.subscribers:S.subscribers.email||S.subscribers.value||S.subscribers}]:[];F(s)}else p&&!S&&(k(1),M(""),j({}),O(N.length>0?N[0].value:"Periodic"),B("daily"),F([]),G(""),X([]))},[p,S,N]);var ee=o(function(){var r=e([],y,!0);return(null==S?void 0:S.reportScope)&&Object.keys(S.reportScope).forEach(function(e){var s=r.find(function(r){var s,i;return(null===(s=r.id)||void 0===s?void 0:s.toLowerCase())===e.toLowerCase()||(null===(i=r.label)||void 0===i?void 0:i.toLowerCase())===e.toLowerCase()});if(!s){var i=S.reportScope[e],a=Array.isArray(i);r.push({id:e,label:e.charAt(0).toUpperCase()+e.slice(1),options:a?i.map(function(e){return{label:e,value:e}}):[{label:i,value:i}],scopeType:a?"multiSelect":"singleSelect"})}}),r},[y,S]);if(!p)return null;var re=function(e,r){if(!e)return r?[]:"";var s=Object.keys(T).find(function(r){return r.toLowerCase()===e.toLowerCase()});if(s&&void 0!==T[s]){var i=T[s];return r?Array.isArray(i)?i:i?[i]:[]:Array.isArray(i)?i.length>0?i[0]:"":i}return r?[]:""};return a("div",r({className:"q-subs-modal-overlay"},{children:l("div",r({className:"q-subs-modal"},{children:[l("div",r({className:"q-subs-modal-header"},{children:[a("div",r({className:"q-subs-modal-title"},{children:S?"Edit Subscription":"Create Subscription"})),a("button",r({className:"q-subs-modal-close",onClick:f},{children:a(c,{size:14})}))]})),l("div",r({className:"q-subs-stepper"},{children:[l("div",r({className:"q-subs-step ".concat(L>=1?L>1?"completed":"active":"")},{children:[a("div",r({className:"q-subs-step-num"},{children:L>1?a(u,{size:14}):"1"})),"Name & scope"]})),a("div",{className:"q-subs-step-line ".concat(L>1?"completed":"")}),l("div",r({className:"q-subs-step ".concat(L>=2?L>2?"completed":"active":"")},{children:[a("div",r({className:"q-subs-step-num"},{children:L>2?a(u,{size:14}):"2"})),"Type"]})),a("div",{className:"q-subs-step-line ".concat(L>2?"completed":"")}),l("div",r({className:"q-subs-step ".concat(L>=3?"active":"")},{children:[a("div",r({className:"q-subs-step-num"},{children:"3"})),"Subscribers"]}))]})),l("div",r({className:"q-subs-modal-body"},{children:[1===L&&l("div",{children:[l("div",r({className:"q-subs-form-group"},{children:[l("label",r({className:"q-subs-form-label"},{children:["Subscription name ",a("span",r({className:"req"},{children:"*"}))]})),a("input",{type:"text",className:"q-subs-input",placeholder:"e.g. Midwest Music Weekly Report",value:A,onChange:function(e){return M(e.target.value)}})]})),a("div",{style:{height:"1px",background:"#E2E8F0",margin:"0 0 24px 0"}}),a("label",r({className:"q-subs-form-label"},{children:"Report scope"})),a("div",r({className:"q-subs-grid-2"},{children:ee.map(function(e){var s,i,n,t;return l("div",{children:[a("label",r({className:"q-subs-form-desc",style:{display:"block",marginBottom:"4px",color:"#475569"}},{children:e.label})),"multiSelect"===e.scopeType?a(v,{options:(null===(s=e.options)||void 0===s?void 0:s.map(function(e){var r="string"==typeof e?e:e.value||e.id||e;return{label:"string"==typeof e?e:e.label||e.name||r,value:r}}))||[],value:re(e.id,!0)||[],onChange:function(s){var i,a=Object.keys(T).find(function(r){return r.toLowerCase()===(e.id||"").toLowerCase()});j(r(r({},T),((i={})[a||e.id]=s,i)))},placeholder:"Select ".concat((null===(i=e.label)||void 0===i?void 0:i.toLowerCase())||"")}):a(b,{options:(null===(n=e.options)||void 0===n?void 0:n.map(function(e){var r="string"==typeof e?e:e.value||e.id||e;return{label:"string"==typeof e?e:e.label||e.name||r,value:r}}))||[],value:re(e.id,!1)||"",onChange:function(s){var i,a=Object.keys(T).find(function(r){return r.toLowerCase()===(e.id||"").toLowerCase()});j(r(r({},T),((i={})[a||e.id]=s,i)))},placeholder:"Select ".concat((null===(t=e.label)||void 0===t?void 0:t.toLowerCase())||"")})]},e.id)})}))]}),2===L&&l("div",{children:[l("div",r({className:"q-subs-form-group"},{children:[a("label",r({className:"q-subs-form-label",style:{marginBottom:"4px"}},{children:"Subscription Type"})),a("div",r({className:"q-subs-form-desc"},{children:"Choose when you want to receive this report."})),a("div",r({className:"q-subs-radio-group"},{children:N.map(function(e){return l("label",r({className:"q-subs-radio-label"},{children:[a("input",{type:"radio",className:"q-subs-radio",checked:D===e.value,onChange:function(){return O(e.value)}})," ",e.label]}),e.value)})}))]})),function(){var e=N.find(function(e){return e.value===D}),s=null==e?void 0:e.triggers;if(s&&s.length>0){var i=s.find(function(e){return e.value===_});return l("div",r({className:"q-subs-form-group"},{children:[a("label",r({className:"q-subs-form-label",style:{marginBottom:"4px"}},{children:"Trigger"})),a("div",r({className:"q-subs-form-desc"},{children:"How often should this report be sent?"})),a("div",r({style:{width:"60%"}},{children:a(b,{options:s.map(function(e){return{label:e.label,value:e.value}}),value:_,onChange:function(e){return B(e)},placeholder:"Select trigger"})})),i&&i.info&&l("div",r({className:"q-subs-info"},{children:[a(d,{size:12,strokeWidth:3}),i.info]}))]}))}return null}()]}),3===L&&a("div",{children:l("div",r({className:"q-subs-form-group"},{children:[a("label",r({className:"q-subs-form-label",style:{marginBottom:"4px"}},{children:"Subscribers"})),a("div",r({className:"q-subs-form-desc"},{children:"Who should receive this report?"})),l("div",r({className:"q-subs-search-box"},{children:[a("input",{type:"text",className:"q-subs-input",placeholder:"Type name or email...",value:H,onChange:function(e){return s(void 0,void 0,void 0,function(){var r,s;return i(this,function(i){switch(i.label){case 0:if(r=e.target.value,G(r),!r)return X([]),[2];if(!q)return[3,5];$(!0),i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,q(r)];case 2:return s=i.sent(),X(s||[]),[3,5];case 3:return i.sent(),X([]),[3,5];case 4:return $(!1),[7];case 5:return[2]}})})}}),Z&&a("div",r({style:{position:"absolute",right:"12px",top:"10px",fontSize:"12px",color:"#94a3b8"}},{children:"Loading..."})),V.length>0&&H&&a("div",r({className:"q-subs-search-results"},{children:V.map(function(s){return a("div",r({className:"q-subs-search-item",onClick:function(){return function(r){U.find(function(e){return e.value===r.value})||F(e(e([],U,!0),[r],!1)),G(""),X([])}(s)}},{children:s.label}),s.value)})}))]})),U.length>0&&a("div",r({className:"q-subs-chips"},{children:U.map(function(e){return l("div",r({className:"q-subs-chip"},{children:[e.label,a("div",r({className:"q-subs-chip-remove",onClick:function(){return r=e.value,void F(U.filter(function(e){return e.value!==r}));var r}},{children:a(c,{size:12,strokeWidth:3})}))]}),e.value)})}))]}))})]})),l("div",r({className:"q-subs-modal-footer"},{children:[a("button",1===L?r({className:"q-subs-btn-cancel",onClick:f},{children:"Cancel"}):r({className:"q-subs-btn-cancel",onClick:function(){return k(function(e){return Math.max(e-1,1)})}},{children:"Back"})),L<3?l("button",r({className:"q-subs-btn-primary",onClick:function(){return k(function(e){return Math.min(e+1,3)})},disabled:1===L&&!A.trim()},{children:["Next ",a("span",r({style:{marginLeft:"4px"}},{children:"→"}))]})):a("button",r({className:"q-subs-btn-primary",onClick:function(){return s(void 0,void 0,void 0,function(){var e,r,s,a,l;return i(this,function(i){switch(i.label){case 0:return K(!0),e={name:A,scope:T,subscription_type:D.toLowerCase(),trigger_frequency:(null===(l=null===(a=N.find(function(e){return e.value===D}))||void 0===a?void 0:a.triggers)||void 0===l?void 0:l.length)?_:"",trigger_event:D,subscriber_emails:U.map(function(e){return e.value})},r=!1,C?[4,C(e,!!(null==S?void 0:S.id))]:[3,2];case 1:return s=i.sent(),r=!1!==s,[3,3];case 2:r=!0,i.label=3;case 3:return K(!1),r&&(f(),k(1),M(""),j({}),O("Periodic"),B("daily"),F([]),G("")),[2]}})})},disabled:J||0===U.length},{children:J?S?"Updating...":"Creating...":S?"Update Subscription":"Create Subscription"}))]}))]}))}))};export{m as default};
|
|
2
|
+
//# sourceMappingURL=CreateSubscriptionModal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreateSubscriptionModal.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/ExecutiveDashboard/components/DashboardDateFilter/SubscriptionFeature/ReportSidebar.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__assign as e}from"../../../../_virtual/_tslib.js";import{jsxs as a,jsx as l,Fragment as r}from"react/jsx-runtime";import{X as i}from"lucide-react";import n from"../../MetricCard/MetricCard.js";function s(s){var d,c=s.visible,t=s.onHide,m=s.reportData,o=s.loading;if(!c)return null;var p=null==m?void 0:m.banner;return a("div",e({className:"q-rep-panel"},{children:[a("div",e({className:"q-rep-panel-header"},{children:[a("div",{children:[l("div",e({className:"q-rep-title"},{children:o?"Loading…":(null==m?void 0:m.title)||"Report"})),(null==m?void 0:m.subtitle)&&l("div",e({className:"q-rep-subtitle"},{children:m.subtitle}))]}),l("button",e({className:"q-rep-close-btn",onClick:t,"aria-label":"Close report"},{children:l(i,{size:16})}))]})),l("div",e({className:"q-rep-panel-content"},{children:o||!m?l("div",e({style:{padding:"40px",textAlign:"center",color:"#64748b"}},{children:"Loading report…"})):a(r,{children:[a("div",e({className:"q-rep-banner",style:{backgroundColor:null!==(d=null==p?void 0:p.backgroundColor)&&void 0!==d?d:"#0f172a"}},{children:[a("div",e({className:"q-rep-banner-left"},{children:[a("div",e({className:"q-rep-banner-top-row"},{children:[(null==p?void 0:p.icon)&&l("div",e({className:"q-rep-banner-icon"},{children:p.icon})),l("span",e({className:"q-rep-brand-name",style:null==p?void 0:p.brandNameStyle},{children:null==p?void 0:p.brandName}))]})),(null==p?void 0:p.appName)&&l("span",e({className:"q-rep-app-name",style:null==p?void 0:p.appNameStyle},{children:p.appName}))]})),a("div",e({className:"q-rep-generated"},{children:[l("span",e({className:"q-rep-generated-label",style:null==p?void 0:p.generatedOnLabelStyle},{children:"Generated On"})),l("span",e({className:"q-rep-generated-value",style:null==p?void 0:p.generatedOnValueStyle},{children:null==p?void 0:p.generatedOn}))]}))]})),a("div",e({className:"q-rep-summary-card"},{children:[a("div",e({className:"q-rep-summary-header"},{children:[l("div",{className:"q-rep-summary-accent"}),a("div",{children:[l("div",e({className:"q-rep-summary-title"},{children:m.summary.title})),l("div",e({className:"q-rep-summary-desc"},{children:m.summary.description}))]})]})),l("div",e({className:"q-rep-scope-grid"},{children:m.scope.map(function(r,i){return a("div",e({className:"q-rep-scope-item"},{children:[l("div",e({className:"q-rep-scope-item-label"},{children:r.label})),l("div",e({className:"q-rep-scope-item-value"},{children:r.value}))]}),i)})})),l("div",e({className:"q-rep-metrics-grid"},{children:m.metrics.map(function(a,r){var i;return l(n,e({},a,{classNames:e(e({},a.classNames),{root:"q-rep-metric-card ".concat((null===(i=a.classNames)||void 0===i?void 0:i.root)||"")})}),r)})}))]}))]})}))]}))}export{s as default};
|
|
2
|
+
//# sourceMappingURL=ReportSidebar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReportSidebar.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__assign as e}from"../../../_virtual/_tslib.js";import{jsxs as l,jsx as r}from"react/jsx-runtime";import{useMemo as t}from"react";import{Search as a,ListFilter as i,Plus as n}from"lucide-react";import s from"../Table/FTable.js";function o(o){var c,u=o.subtitle,d=o.search,m=o.filter,p=o.addAction,h=o.table,v=o.styles,b=o.children,f=t(function(){if(!(null==d?void 0:d.value)||!(null==d?void 0:d.searchKey)||!h.rows)return h.rows;var e=d.value.toLowerCase(),l=Array.isArray(d.searchKey)?d.searchKey:[d.searchKey];return h.rows.filter(function(r){return l.some(function(l){var t=r[l];return t&&String(t).toLowerCase().includes(e)})})},[h.rows,null==d?void 0:d.value,null==d?void 0:d.searchKey]);return l("div",e({className:"tp-main",style:null==v?void 0:v.root},{children:[l("div",e({className:"tp-toolbar",style:null==v?void 0:v.toolbar},{children:[r("div",e({className:"tp-subtitle"},{children:u})),l("div",e({className:"tp-actions"},{children:[d&&l("div",e({className:"tp-search"},{children:[r(a,{size:16,className:"tp-search-icon"}),r("input",{type:"text",placeholder:d.placeholder||"Search...",className:"tp-search-input",value:d.value,onChange:function(e){return d.onChange(e.target.value)}})]})),m&&l("button",e({className:"tp-filter-btn",onClick:m.onClick},{children:[r(i,{size:16}),"Filter",(null!==(c=m.count)&&void 0!==c?c:0)>0&&r("span",e({className:"tp-filter-badge"},{children:m.count}))]})),p&&l("button",e({className:"tp-add-btn",onClick:p.onClick},{children:[p.icon||r(n,{size:16}),p.label]}))]}))]})),r("div",e({className:"tp-table-wrapper",style:null==v?void 0:v.tableWrapper},{children:r(s,e({},h,{rows:f,columns:h.columns||h.extraColumns}))})),b]}))}export{o as default};
|
|
2
|
+
//# sourceMappingURL=TablePage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TablePage.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__assign as i}from"../../../_virtual/_tslib.js";import{jsx as e,jsxs as n}from"react/jsx-runtime";import{useEffect as o}from"react";import{X as c,Info as r}from"lucide-react";function l(l){var s=l.isOpen,t=l.onClose,a=l.onConfirm,d=l.title,m=l.message,f=l.warningText,u=l.confirmText,v=void 0===u?"Confirm":u,h=l.cancelText,b=void 0===h?"Cancel":h,q=l.confirmButtonColor,N=void 0===q?"#EF4444":q,C=l.isLoading,g=void 0!==C&&C;return o(function(){return document.body.style.overflow=s?"hidden":"unset",function(){document.body.style.overflow="unset"}},[s]),s?e("div",i({className:"q-confirm-overlay"},{children:n("div",i({className:"q-confirm-modal"},{children:[n("div",i({className:"q-confirm-header"},{children:[e("div",i({className:"q-confirm-title"},{children:d})),e("button",i({className:"q-confirm-close",onClick:t,disabled:g},{children:e(c,{size:18,strokeWidth:2})}))]})),n("div",i({className:"q-confirm-content"},{children:[e("div",i({className:"q-confirm-message"},{children:m})),f&&n("div",i({className:"q-confirm-warning"},{children:[e(r,{size:14,strokeWidth:2}),e("span",{children:f})]}))]})),n("div",i({className:"q-confirm-actions"},{children:[e("button",i({className:"q-confirm-cancel-btn",onClick:t,disabled:g},{children:b})),e("button",i({className:"q-confirm-submit-btn",onClick:a,style:{backgroundColor:N},disabled:g},{children:g?"Loading...":v}))]}))]}))})):null}export{l as default};
|
|
2
|
+
//# sourceMappingURL=ConfirmationModal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfirmationModal.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__rest as e,__assign as n}from"../../../_virtual/_tslib.js";import{jsxs as i,jsx as t,Fragment as o}from"react/jsx-runtime";import r,{useState as a,useId as l}from"react";import{Wand2 as c,ChevronUp as d,ChevronDown as s}from"lucide-react";import{CitationRenderer as g}from"@e-llm-studio/citation";import{CitationContent as u}from"../CitationContent/CitationContent.js";import m from"./CognitiveDecisioning.module.css.js";import{useCitationChangelogs as h,useCitationSegments as p,useBusinessContextData as f}from"../../hooks/useHumanChangesData.js";var v={pillButton:{background:"transparent",padding:0,margin:0,fontSize:"12px",fontWeight:600,color:"#3B82F6",cursor:"pointer",border:"none",display:"inline-flex",alignItems:"center",gap:"4px"},citationContent:{backgroundColor:"#FFFFFF",border:"1px solid #E2E8F0",borderRadius:"8px",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",width:"100%",maxWidth:"100%",marginTop:"8px",height:"400px",maxHeight:"400px",minHeight:"400px",padding:"16px",boxSizing:"border-box",overflow:"hidden"}},x=/\[([^\]]+)\]\(([^)\s]+)\)|<citation sequence_ids='(.*?)' changelog_ids='(.*?)'>(.*?)<\/citation>/g;function b(e){return e.replace(/[_-]+/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\b\w/g,function(e){return e.toUpperCase()}).trim()}var C=function(e){var o=e.metric,r=e.isExpanded,a=e.onToggle,l=Object.entries(o).filter(function(e){e[0];var n=e[1];return"object"!=typeof n||null===n});if(0===l.length)return t("span",{children:"-"});var c=l.length>4,d=r?l:l.slice(0,4);return i("div",n({style:{display:"flex",flexDirection:"column",gap:"8px"}},{children:[t("div",n({style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"8px 16px"}},{children:d.map(function(e){var o=e[0],r=e[1];return i("div",n({style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:"8px"}},{children:[t("span",n({style:{color:"#64748b",fontSize:"12px"}},{children:b(o)})),t("span",n({style:{fontWeight:600,fontSize:"12px",color:"#334155",whiteSpace:"nowrap",flexShrink:0}},{children:String(r)}))]}),o)})})),c&&t("button",n({onClick:a,style:{alignSelf:"flex-start",background:"none",border:"none",color:"#2563eb",fontSize:"12px",fontWeight:500,cursor:"pointer",padding:"2px 0",marginTop:"4px"}},{children:r?"Show less":"+ ".concat(l.length-4," more")}))]}))},y=function(e){var i=e.citation,o=e.initialRows,a=e.fromConsumer,l=e.tableTitle,c=e.columns,d=e.rulebookTitle,s=e.rulebookPaginationText,g=e.rulebookComponent,m=e.humanIntelligentConfigId,v=e.changeLogConfigId,x=e.baseUrl,y=e.agentConfig,k="changelog"===(null==i?void 0:i.source),T=(null==i?void 0:i.changelog_ids)||[],_=r.useState({}),I=_[0],w=_[1],W=h({baseUrl:x,configId:v,changeLogIds:T,skip:a||!k||0===T.length}),S=W.data,N=W.loading,L=W.error,P=W.fetchNextPage,U=W.hasNextPage,F=W.isFetchingNextPage,R=W.fetchNextPageError,j=W.refetch,z=(null==i?void 0:i.segment_ids)||(k?[]:null==i?void 0:i.changelog_ids)||[],D=p({baseUrl:x,humanIntelligentConfigId:m,segmentIds:z,skip:a||k||0===z.length}),E=D.data,M=D.loading,H=D.error,O=D.refetch,B=f({baseUrl:x,humanIntelligentConfigId:m,agentConfig:y,skip:!y}),q=B.data,A=B.loading,$=B.error,G=B.refetch,Z=k?N:M,J=k?L:H,K=a?o||[]:(k?S:E)||[],Q=(null==c?void 0:c.length)?c:void 0;return!Q&&K&&K.length>0?Q=k?[{key:"change",title:b("change"),minWidth:150,maxWidth:250},{key:"changeTitle",title:b("changeTitle"),minWidth:150,maxWidth:250},{key:"modifiedbyemail",title:b("modifiedbyemail"),minWidth:150,maxWidth:250},{key:"modifiedbyname",title:b("modifiedbyname"),minWidth:150,maxWidth:250},{key:"created_at",title:b("created_at"),minWidth:200,maxWidth:300,render:function(e){var n=e.created_at;if(!n)return"-";try{return new Date(n).toLocaleString()}catch(e){return String(n)}}},{key:"change_log_impact",title:b("change_log_impact"),minWidth:150,maxWidth:250},{key:"change_log_impact_percentage",title:b("change_log_impact_percentage"),minWidth:150,maxWidth:250}]:[{key:"segmentSummary",title:b("segmentSummary"),minWidth:250,maxWidth:400},{key:"frequency",title:b("frequency"),minWidth:100,maxWidth:150},{key:"segmentMetric",title:b("segmentMetric"),minWidth:400,maxWidth:550,render:function(e,i){var o=e.segmentMetric;if(!o)return"-";var r=e.id?String(e.id):"row-".concat(i),a=!!I[r];return t(C,{metric:o,isExpanded:a,onToggle:function(){w(function(e){var i;return n(n({},e),((i={})[r]=!e[r],i))})}})}}]:Q||(Q=[]),t("div",n({style:{position:"relative",width:"100%"}},{children:t(u,{citationType:"record"===(null==i?void 0:i.type)?"record":"tabular",tableTitle:(null==i?void 0:i.source)?"".concat(i.source.charAt(0).toUpperCase()+i.source.slice(1)," ").concat("record"===(null==i?void 0:i.type)?"Record":"Table"):l,tableData:K,columns:Q,rulebookTitle:d,rulebookPaginationText:s,rulebookComponent:g,rulebookMarkdown:q,rulebookLoading:A,rulebookError:$,onRulebookRetry:G,highlights:null==i?void 0:i.business_context_highlight,loading:Z&&"record"!==(null==i?void 0:i.type),error:J,onRetry:k?j:O,onEndReached:k?P:void 0,hasNextPage:k?U:void 0,isFetchingNextPage:k?F:void 0,fetchNextPageError:k?R:void 0,recordMarkdown:function(){var e;if("record"===(null==i?void 0:i.type)){if("segment"===i.source&&(null===(e=i.segment)||void 0===e?void 0:e.summary))return i.segment.summary;if("changelog"===i.source&&i.changelog)return Object.entries(i.changelog).map(function(e){var n=e[0],i=e[1];return"**".concat(b(n),"**: ").concat(i)}).join("\n\n")}return""}()})}))},k=function(e,i,r,a){var l,c,u,h=i.citations,p=void 0===h?{}:h,f=i.changeLogs,b=void 0===f?[]:f,C=i.columns,k=void 0===C?[]:C,T=i.rulebookComponent,_=void 0===T?null:T,I=i.tableTitle,w=void 0===I?"Table data":I,W=i.rulebookTitle,S=void 0===W?"Rulebook":W,N=i.rulebookPaginationText,L=void 0===N?"":N,P=i.humanIntelligentConfigId,U=void 0===P?"":P,F=i.changeLogConfigId,R=void 0===F?"":F,j=i.baseUrl,z=void 0===j?"":j,D=i.agentConfig,E=void 0===D?"":D,M=[],H=0;x.lastIndex=0;for(var O=function(){u.index>H&&M.push(e.slice(H,u.index));var i,o,h=void 0!==u[1],f=h?u[1]:u[5],C=void 0;if(h){var T=(i=null!==(l=u[2])&&void 0!==l?l:"",(o=i.split("?")[1])?o.split("&").reduce(function(e,n){var i=n.split("="),t=i[0],o=i[1],r=void 0===o?"":o;return t&&(e[decodeURIComponent(t)]=decodeURIComponent(r)),e},{}):{}),I=T.citationNumber;if(!I)return M.push(f),H=x.lastIndex,"continue";C=p["citation_".concat(I)]}else{var W=(null!==(c=u[4])&&void 0!==c?c:"").replace(/[[\]"']/g,"").split(",").map(function(e){return e.trim()}).filter(Boolean);C=W.length?{type:"tabular",source:"changelog",changelog_ids:W}:void 0}var N=function(e,n){var i,t,o;if(!e)return{rows:n,fromConsumer:!0};if("record"===e.type){var r=null!==(i=e.changelog)&&void 0!==i?i:e.segment;return r?{rows:[r],fromConsumer:!1}:{rows:n,fromConsumer:!0}}var a=null!==(o=null!==(t=e.changelog_ids)&&void 0!==t?t:e.segment_ids)&&void 0!==o?o:[];if(!a.length)return{rows:n,fromConsumer:!0};var l=n.filter(function(e){return a.includes(function(e){var n,i,t;return null!==(t=null!==(i=null!==(n=null==e?void 0:e.change_log_id)&&void 0!==n?n:null==e?void 0:e.changeLogId)&&void 0!==i?i:null==e?void 0:e.changelog_id)&&void 0!==t?t:null==e?void 0:e.id}(e))});return l.length?{rows:l,fromConsumer:!0}:{rows:a.map(function(e){return{change_log_id:e}}),fromConsumer:!1}}(C,b),P=N.rows,F=N.fromConsumer,j="".concat(u.index,"-").concat(f),D=r.has(j);M.push(t("span",n({className:m.inlineCitationWrapper},{children:t(g,{inLineCitation:!0,citationTitle:f,isOpen:D,onToggle:function(){return a(j)},citationComponent:t("div",{style:{display:"none"}}),chevronDownComponent:t(s,{size:14,"aria-hidden":"true"}),chevronUpComponent:t(d,{size:14,"aria-hidden":"true"}),styles:n(n({},v),{citationWrapper:{display:"none"}})})}),j)),D&&M.push(t("div",n({style:{marginTop:"12px",marginBottom:"16px",display:"block",width:"100%"}},{children:t(y,{citation:C,initialRows:P,fromConsumer:F,tableTitle:w,columns:k,rulebookTitle:S,rulebookPaginationText:L,rulebookComponent:_,humanIntelligentConfigId:U,changeLogConfigId:R,baseUrl:z,agentConfig:E})}),"".concat(j,"-content"))),H=x.lastIndex};null!==(u=x.exec(e));)O();return H<e.length&&M.push(e.slice(H)),M.length>0?t(o,{children:M}):e},T=function(e){var i=e.text,o=e.options,l=a(new Set),c=l[0],d=l[1],s=r.useCallback(function(e){d(function(n){var i=new Set(n);return i.has(e)?i.delete(e):i.add(e),i})},[]),g=r.useMemo(function(){return k(i,o,c,s)},[i,o,c,s]);return t("li",{children:t("div",n({style:{display:"inline",lineHeight:"24px"}},{children:g}))})},_=function(r){var g,u,h,p=r.data,f=r.changeLogs,v=void 0===f?[]:f,x=r.defaultOpen,b=void 0!==x&&x,C=r.className,y=e(r,["data","changeLogs","defaultOpen","className"]),k=a(b),_=k[0],I=k[1],w=l(),W={citations:p.citation,changeLogs:v,columns:p.tableColumns,rulebookComponent:p.rulebookComponent,tableTitle:p.tableTitle,rulebookTitle:p.rulebookTitle,rulebookPaginationText:p.rulebookPaginationText,humanIntelligentConfigId:p.humanIntelligentConfigId,changeLogConfigId:p.changeLogConfigId,baseUrl:p.baseUrl,agentConfig:p.agentConfig},S=null!==(g=p.reason)&&void 0!==g?g:[],N=null!==(u=p.gap)&&void 0!==u?u:[],L=Math.round(100*(null!==(h=p.confidence_score)&&void 0!==h?h:0));return i("div",n({className:"".concat(m.accordionContainer," ").concat(C||"").trim()},y,{children:[i("button",n({type:"button",className:m.accordionHeader,onClick:function(){return I(function(e){return!e})},"aria-expanded":_,"aria-controls":w},{children:[t("h3",n({className:m.accordionTitle},{children:"Why these patterns were identified?"})),i("div",n({className:m.accordionPill},{children:[t(c,{size:14,"aria-hidden":"true"}),i("span",{children:[L,"%"]}),t(_?d:s,{size:14,"aria-hidden":"true"})]}))]})),_&&i("div",n({id:w,className:m.accordionContent,style:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[S.length>0&&i("div",n({className:m.cognitiveSection},{children:[t("div",n({className:m.cognitiveSectionTitle},{children:"Decision Making Factors"})),t("ol",n({className:m.cognitiveList},{children:S.map(function(e,n){return t(T,{text:e,options:W},n)})}))]})),N.length>0&&i(o,{children:[S.length>0&&t("div",{className:m.cognitiveSeparator}),i("div",n({className:m.cognitiveSection},{children:[t("div",n({className:m.cognitiveSectionTitle},{children:"Gaps in Decision"})),t("ol",n({className:m.cognitiveList},{children:N.map(function(e,n){return t(T,{text:e,options:W},n)})}))]}))]})]}))]}))};export{_ as CognitiveDecisioning};
|
|
1
|
+
import{__rest as e,__assign as n}from"../../../_virtual/_tslib.js";import{jsxs as i,jsx as t,Fragment as o}from"react/jsx-runtime";import r,{useState as a,useId as l}from"react";import{Wand2 as c,ChevronUp as d,ChevronDown as s}from"lucide-react";import{CitationRenderer as g}from"@e-llm-studio/citation";import{CitationContent as u}from"../CitationContent/CitationContent.js";import h from"./CognitiveDecisioning.module.css.js";import{useCitationChangelogs as m,useCitationSegments as p,useBusinessContextData as f}from"../../hooks/useHumanChangesData.js";import{formatColumnTitle as v,buildRecordMarkdown as x}from"../../utils/citationRecord.js";var b={pillButton:{background:"transparent",padding:0,margin:0,fontSize:"12px",fontWeight:600,color:"#3B82F6",cursor:"pointer",border:"none",display:"inline-flex",alignItems:"center",gap:"4px"},citationContent:{backgroundColor:"#FFFFFF",border:"1px solid #E2E8F0",borderRadius:"8px",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",width:"100%",maxWidth:"100%",marginTop:"8px",height:"400px",maxHeight:"400px",minHeight:"400px",padding:"16px",boxSizing:"border-box",overflow:"hidden"}},C=/\[([^\]]+)\]\(([^)\s]+)\)|<citation sequence_ids='(.*?)' changelog_ids='(.*?)'>(.*?)<\/citation>/g,y=function(e){var o=e.metric,r=e.isExpanded,a=e.onToggle,l=Object.entries(o).filter(function(e){e[0];var n=e[1];return"object"!=typeof n||null===n});if(0===l.length)return t("span",{children:"-"});var c=l.length>4,d=r?l:l.slice(0,4);return i("div",n({style:{display:"flex",flexDirection:"column",gap:"8px"}},{children:[t("div",n({style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"8px 16px"}},{children:d.map(function(e){var o=e[0],r=e[1];return i("div",n({style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:"8px"}},{children:[t("span",n({style:{color:"#64748b",fontSize:"12px"}},{children:v(o)})),t("span",n({style:{fontWeight:600,fontSize:"12px",color:"#334155",whiteSpace:"nowrap",flexShrink:0}},{children:String(r)}))]}),o)})})),c&&t("button",n({onClick:a,style:{alignSelf:"flex-start",background:"none",border:"none",color:"#2563eb",fontSize:"12px",fontWeight:500,cursor:"pointer",padding:"2px 0",marginTop:"4px"}},{children:r?"Show less":"+ ".concat(l.length-4," more")}))]}))},k=function(e){var i=e.citation,o=e.initialRows,a=e.fromConsumer,l=e.tableTitle,c=e.columns,d=e.rulebookTitle,s=e.rulebookPaginationText,g=e.rulebookComponent,h=e.humanIntelligentConfigId,b=e.changeLogConfigId,C=e.baseUrl,k=e.agentConfig,T="changelog"===(null==i?void 0:i.source),_=(null==i?void 0:i.changelog_ids)||[],I=r.useState({}),W=I[0],w=I[1],S=m({baseUrl:C,configId:b,changeLogIds:_,skip:a||!T||0===_.length}),N=S.data,L=S.loading,P=S.error,R=S.fetchNextPage,U=S.hasNextPage,F=S.isFetchingNextPage,j=S.fetchNextPageError,z=S.refetch,D=(null==i?void 0:i.segment_ids)||(T?[]:null==i?void 0:i.changelog_ids)||[],E=p({baseUrl:C,humanIntelligentConfigId:h,segmentIds:D,skip:a||T||0===D.length}),M=E.data,H=E.loading,B=E.error,O=E.refetch,q=f({baseUrl:C,humanIntelligentConfigId:h,agentConfig:k,skip:!k}),A=q.data,G=q.loading,J=q.error,K=q.refetch,Q=T?L:H,V=T?P:B,X=a?o||[]:(T?N:M)||[],Y=(null==c?void 0:c.length)?c:void 0;return!Y&&X&&X.length>0?Y=T?[{key:"change",title:v("change"),minWidth:150,maxWidth:250},{key:"changeTitle",title:v("changeTitle"),minWidth:150,maxWidth:250},{key:"modifiedbyemail",title:v("modifiedbyemail"),minWidth:150,maxWidth:250},{key:"modifiedbyname",title:v("modifiedbyname"),minWidth:150,maxWidth:250},{key:"created_at",title:v("created_at"),minWidth:200,maxWidth:300,render:function(e){var n=e.created_at;if(!n)return"-";try{return new Date(n).toLocaleString()}catch(e){return String(n)}}},{key:"change_log_impact",title:v("change_log_impact"),minWidth:150,maxWidth:250},{key:"change_log_impact_percentage",title:v("change_log_impact_percentage"),minWidth:150,maxWidth:250}]:[{key:"segmentSummary",title:v("segmentSummary"),minWidth:250,maxWidth:400},{key:"frequency",title:v("frequency"),minWidth:100,maxWidth:150},{key:"segmentMetric",title:v("segmentMetric"),minWidth:400,maxWidth:550,render:function(e,i){var o=e.segmentMetric;if(!o)return"-";var r=e.id?String(e.id):"row-".concat(i),a=!!W[r];return t(y,{metric:o,isExpanded:a,onToggle:function(){w(function(e){var i;return n(n({},e),((i={})[r]=!e[r],i))})}})}}]:Y||(Y=[]),t("div",n({style:{position:"relative",width:"100%"}},{children:t(u,{citationType:"record"===(null==i?void 0:i.type)?"record":"tabular",tableTitle:(null==i?void 0:i.source)?"".concat(i.source.charAt(0).toUpperCase()+i.source.slice(1)," ").concat("record"===(null==i?void 0:i.type)?"Record":"Table"):l,tableData:X,columns:Y,rulebookTitle:d,rulebookPaginationText:s,rulebookComponent:g,rulebookMarkdown:A,rulebookLoading:G,rulebookError:J,onRulebookRetry:K,highlights:null==i?void 0:i.business_context_highlight,loading:Q&&"record"!==(null==i?void 0:i.type),error:V,onRetry:T?z:O,onEndReached:T?R:void 0,hasNextPage:T?U:void 0,isFetchingNextPage:T?F:void 0,fetchNextPageError:T?j:void 0,recordMarkdown:"record"===(null==i?void 0:i.type)?x(i):""})}))},T=function(e,i,r,a){var l,c,u,m=i.citations,p=void 0===m?{}:m,f=i.changeLogs,v=void 0===f?[]:f,x=i.columns,y=void 0===x?[]:x,T=i.rulebookComponent,_=void 0===T?null:T,I=i.tableTitle,W=void 0===I?"Table data":I,w=i.rulebookTitle,S=void 0===w?"Rulebook":w,N=i.rulebookPaginationText,L=void 0===N?"":N,P=i.humanIntelligentConfigId,R=void 0===P?"":P,U=i.changeLogConfigId,F=void 0===U?"":U,j=i.baseUrl,z=void 0===j?"":j,D=i.agentConfig,E=void 0===D?"":D,M=[],H=0;C.lastIndex=0;for(var B=function(){u.index>H&&M.push(e.slice(H,u.index));var i,o,m=void 0!==u[1],f=m?u[1]:u[5],x=void 0;if(m){var T=(i=null!==(l=u[2])&&void 0!==l?l:"",(o=i.split("?")[1])?o.split("&").reduce(function(e,n){var i=n.split("="),t=i[0],o=i[1],r=void 0===o?"":o;return t&&(e[decodeURIComponent(t)]=decodeURIComponent(r)),e},{}):{}),I=T.citationNumber;if(!I)return M.push(f),H=C.lastIndex,"continue";x=p["citation_".concat(I)]}else{var w=(null!==(c=u[4])&&void 0!==c?c:"").replace(/[[\]"']/g,"").split(",").map(function(e){return e.trim()}).filter(Boolean);x=w.length?{type:"tabular",source:"changelog",changelog_ids:w}:void 0}var N=function(e,n){var i,t,o;if(!e)return{rows:n,fromConsumer:!0};if("record"===e.type){var r=null!==(i=e.changelog)&&void 0!==i?i:e.segment;return r?{rows:[r],fromConsumer:!1}:{rows:n,fromConsumer:!0}}var a=null!==(o=null!==(t=e.changelog_ids)&&void 0!==t?t:e.segment_ids)&&void 0!==o?o:[];if(!a.length)return{rows:n,fromConsumer:!0};var l=n.filter(function(e){return a.includes(function(e){var n,i,t;return null!==(t=null!==(i=null!==(n=null==e?void 0:e.change_log_id)&&void 0!==n?n:null==e?void 0:e.changeLogId)&&void 0!==i?i:null==e?void 0:e.changelog_id)&&void 0!==t?t:null==e?void 0:e.id}(e))});return l.length?{rows:l,fromConsumer:!0}:{rows:a.map(function(e){return{change_log_id:e}}),fromConsumer:!1}}(x,v),P=N.rows,U=N.fromConsumer,j="".concat(u.index,"-").concat(f),D=r.has(j);M.push(t("span",n({className:h.inlineCitationWrapper},{children:t(g,{inLineCitation:!0,citationTitle:f,isOpen:D,onToggle:function(){return a(j)},citationComponent:t("div",{style:{display:"none"}}),chevronDownComponent:t(s,{size:14,"aria-hidden":"true"}),chevronUpComponent:t(d,{size:14,"aria-hidden":"true"}),styles:n(n({},b),{citationWrapper:{display:"none"}})})}),j)),D&&M.push(t("div",n({style:{marginTop:"12px",marginBottom:"16px",display:"block",width:"100%"}},{children:t(k,{citation:x,initialRows:P,fromConsumer:U,tableTitle:W,columns:y,rulebookTitle:S,rulebookPaginationText:L,rulebookComponent:_,humanIntelligentConfigId:R,changeLogConfigId:F,baseUrl:z,agentConfig:E})}),"".concat(j,"-content"))),H=C.lastIndex};null!==(u=C.exec(e));)B();return H<e.length&&M.push(e.slice(H)),M.length>0?t(o,{children:M}):e},_=function(e){var i=e.text,o=e.options,l=a(new Set),c=l[0],d=l[1],s=r.useCallback(function(e){d(function(n){var i=new Set(n);return i.has(e)?i.delete(e):i.add(e),i})},[]),g=r.useMemo(function(){return T(i,o,c,s)},[i,o,c,s]);return t("li",{children:t("div",n({style:{display:"inline",lineHeight:"24px"}},{children:g}))})},I=function(r){var g,u,m,p=r.data,f=r.changeLogs,v=void 0===f?[]:f,x=r.defaultOpen,b=void 0!==x&&x,C=r.className,y=e(r,["data","changeLogs","defaultOpen","className"]),k=a(b),T=k[0],I=k[1],W=l(),w={citations:p.citation,changeLogs:v,columns:p.tableColumns,rulebookComponent:p.rulebookComponent,tableTitle:p.tableTitle,rulebookTitle:p.rulebookTitle,rulebookPaginationText:p.rulebookPaginationText,humanIntelligentConfigId:p.humanIntelligentConfigId,changeLogConfigId:p.changeLogConfigId,baseUrl:p.baseUrl,agentConfig:p.agentConfig},S=null!==(g=p.reason)&&void 0!==g?g:[],N=null!==(u=p.gap)&&void 0!==u?u:[],L=Math.round(100*(null!==(m=p.confidence_score)&&void 0!==m?m:0));return i("div",n({className:"".concat(h.accordionContainer," ").concat(C||"").trim()},y,{children:[i("button",n({type:"button",className:h.accordionHeader,onClick:function(){return I(function(e){return!e})},"aria-expanded":T,"aria-controls":W},{children:[t("h3",n({className:h.accordionTitle},{children:"Why these patterns were identified?"})),i("div",n({className:h.accordionPill},{children:[t(c,{size:14,"aria-hidden":"true"}),i("span",{children:[L,"%"]}),t(T?d:s,{size:14,"aria-hidden":"true"})]}))]})),T&&i("div",n({id:W,className:h.accordionContent,style:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[S.length>0&&i("div",n({className:h.cognitiveSection},{children:[t("div",n({className:h.cognitiveSectionTitle},{children:"Decision Making Factors"})),t("ol",n({className:h.cognitiveList},{children:S.map(function(e,n){return t(_,{text:e,options:w},n)})}))]})),N.length>0&&i(o,{children:[S.length>0&&t("div",{className:h.cognitiveSeparator}),i("div",n({className:h.cognitiveSection},{children:[t("div",n({className:h.cognitiveSectionTitle},{children:"Gaps in Decision"})),t("ol",n({className:h.cognitiveList},{children:N.map(function(e,n){return t(_,{text:e,options:w},n)})}))]}))]})]}))]}))};export{I as CognitiveDecisioning};
|
|
2
2
|
//# sourceMappingURL=CognitiveDecisioning.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__rest as a,__assign as r}from"../../../_virtual/_tslib.js";import{jsxs as
|
|
1
|
+
import{__rest as a,__assign as r}from"../../../_virtual/_tslib.js";import{jsxs as m,jsx as s}from"react/jsx-runtime";import e from"./HumanChangesSummary.module.css.js";import{renderInlineMarkup as i}from"../../utils/inlineMarkup.js";var l=function(l){var c=l.label,t=void 0===c?"HUMAN CHANGES SUMMARY":c,n=l.children,o=l.className,u=a(l,["label","children","className"]);return m("div",r({className:"".concat(e.summaryContainer," ").concat(o||"").trim()},u,{children:[s("h3",r({className:e.label},{children:t})),s("div",r({className:e.summaryText},{children:i(n,{classNames:{mark:e.highlight}})}))]}))};export{l as HumanChangesSummary};
|
|
2
2
|
//# sourceMappingURL=HumanChangesSummary.js.map
|
package/dist/HumanIntelligence/components/HumanChangesSummary/HumanChangesSummary.module.css.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var a={summaryContainer:"HumanChangesSummary-module_summaryContainer__XnrMx",summaryText:"HumanChangesSummary-module_summaryText__SqW1Z",separator:"HumanChangesSummary-module_separator__KwXl-",label:"HumanChangesSummary-module_label__IgCx5"};export{a as default};
|
|
1
|
+
var a={summaryContainer:"HumanChangesSummary-module_summaryContainer__XnrMx",summaryText:"HumanChangesSummary-module_summaryText__SqW1Z",separator:"HumanChangesSummary-module_separator__KwXl-",label:"HumanChangesSummary-module_label__IgCx5",highlight:"HumanChangesSummary-module_highlight__k52aO"};export{a as default};
|
|
2
2
|
//# sourceMappingURL=HumanChangesSummary.module.css.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__spreadArray as t}from"../../_virtual/_tslib.js";import{useState as r,useMemo as
|
|
1
|
+
import{__spreadArray as t,__assign as n}from"../../_virtual/_tslib.js";import{useState as e,useCallback as r,useMemo as o,useEffect as i}from"react";function c(t,n){for(var e=t;e&&e!==document.body;){var r=window.getComputedStyle(e),o="x"===n?r.overflowX:r.overflowY;if(("x"===n?e.scrollWidth>e.clientWidth:e.scrollHeight>e.clientHeight)&&("auto"===o||"scroll"===o))return e;e=e.parentElement}return null}function l(l){var a=l.markdown,u=l.highlights,h=l.citationType,f=l.activeHighlightClass,s=l.highlightClass,g=e(1),d=g[0],m=g[1],p=e(null),v=p[0],k=p[1],w=r(function(t){k(t)},[]),C=o(function(){var n=a||"",e=0;if("record"===h){if(u&&u.length>0){var r=t([],u,!0).sort(function(t,n){return n.length-t.length}).map(function(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}).join("|"),o=new RegExp("(".concat(r,")"),"gi");n=n.replace(o,function(t){return"<mark>".concat(t,"</mark>")})}n=n.replace(/<mark(?:[^>]*)>([\s\S]*?)<\/mark>/gi,function(t,n){return e++,'<mark id="record-highlight-'.concat(e,'" class="').concat(s,'">').concat(n,"</mark>")})}return{processedMarkdown:n,matchCount:e}},[a,u,h,s]),M=C.processedMarkdown,x=C.matchCount;i(function(){m(x>0?1:0)},[x]),i(function(){if(0!==x&&v){var t=setTimeout(function(){if(v){v.querySelectorAll('mark[id^="record-highlight-"]').forEach(function(t){return t.classList.remove(f)});var t=v.querySelector("#record-highlight-".concat(d));if(t){t.classList.add(f);var e=c(t,"y")||v,r=c(t,"x"),o=new Map;if(e){var i=t.getBoundingClientRect(),l=e.getBoundingClientRect(),a=i.top-l.top+e.scrollTop;o.set(e,{top:a-e.clientHeight/2+i.height/2})}if(r){i=t.getBoundingClientRect(),l=r.getBoundingClientRect(),a=i.left-l.left+r.scrollLeft;o.set(r,n(n({},o.get(r)),{left:a-r.clientWidth/2+i.width/2}))}o.forEach(function(t,e){e.scrollTo(n(n({},t),{behavior:"smooth"}))})}}},100);return function(){return clearTimeout(t)}}},[d,x,M,f,v]);return{processedMarkdown:M,matchCount:x,currentMatch:d,handleNextMatch:function(){return m(function(t){return t>=x?1:t+1})},handlePrevMatch:function(){return m(function(t){return t<=1?x:t-1})},scrollContainerRef:w}}export{l as useHighlightNavigation};
|
|
2
2
|
//# sourceMappingURL=useHighlightNavigation.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__spreadArray as r}from"../../_virtual/_tslib.js";var t=new Set(["type","source","changelog_ids","segment_ids","business_context_highlight","citationNumber","highlights","label","title"]),n=["record","segment","changelog","row","data"],e=function(r){return!!r&&"object"==typeof r&&!Array.isArray(r)};function i(r){return"string"!=typeof r?"":r.replace(/[_-]+/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\b\w/g,function(r){return r.toUpperCase()}).trim()}function o(r){return null==r?"":"string"==typeof r?r:"number"==typeof r||"boolean"==typeof r?String(r):r instanceof Date?r.toISOString():Array.isArray(r)?r.map(function(r){return a(o(r))}).filter(Boolean).join(", "):e(r)?Object.entries(r).map(function(r){var t=r[0],n=r[1];return"".concat(i(t),": ").concat(a(o(n)))}).filter(Boolean).join("; "):function(r){try{var t=JSON.stringify(r);return t?t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t:""}catch(r){return""}}(r)}function a(r){var t=r.replace(/<[^>]*>/g,"").trim();return t&&!/\s/.test(t)&&/^[A-Za-z][A-Za-z0-9_]*$/.test(t)?r.split(/(<[^>]*>)/).map(function(r){return r.startsWith("<")?r:i(r)}).join(""):r}function u(r){return(r||"").replace(/\|/g,"\\|").replace(/\r?\n/g,"<br/>").trim()||"-"}function c(i){if(!e(i))return[];var o=function(i){for(var o=0,a=r(["string"==typeof i.source?i.source:""],n,!0);o<a.length;o++){var u=(l=a[o])?i[l]:void 0;if(e(u))return u;if(Array.isArray(u)&&u.some(e))return u}for(var c=0,f=Object.entries(i);c<f.length;c++){var s=f[c],l=s[0];if(u=s[1],!t.has(l)){if(e(u))return u;if(Array.isArray(u)&&u.some(e))return u}}return null}(i);return o?(Array.isArray(o)?o:[o]).filter(e):[]}function f(t){try{var f=c(t);if(!f.length)return e(t)?function(t){for(var e=0,i=r(r(["string"==typeof t.source?t.source:""],n,!0),["summary","text","markdown"],!1);e<i.length;e++){var o=i[e],a=o?t[o]:void 0;if("string"==typeof a&&a.trim())return a}return""}(t):"";var s=[];if(f.forEach(function(r){Object.keys(r).forEach(function(r){s.includes(r)||s.push(r)})}),!s.length)return"";var l=f.map(function(r){var t={};return s.forEach(function(n){t[n]=a(o(r[n]))}),t}),g=1===f.length?s.filter(function(r){return l[0][r].length>120}):[],p=s.filter(function(r){return!g.includes(r)}),h=[];return p.length&&h.push(r(["| ".concat(p.map(function(r){return u(i(r))}).join(" | ")," |"),"| ".concat(p.map(function(){return"---"}).join(" | ")," |")],l.map(function(r){return"| ".concat(p.map(function(t){return u(r[t])}).join(" | ")," |")}),!0).join("\n")),g.forEach(function(r){h.push("**".concat(i(r),"**\n\n").concat(l[0][r]))}),h.join("\n\n")}catch(r){return""}}export{f as buildRecordMarkdown,i as formatColumnTitle,c as getCitationRecords};
|
|
2
|
+
//# sourceMappingURL=citationRecord.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"citationRecord.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{__spreadArray as e,__assign as n}from"../../_virtual/_tslib.js";import t from"react";var r=new Set(["b","strong","i","em","u","s","del","ins","mark","code","small","sub","sup","span","br","p","ul","ol","li"]),i=new Set(["br"]),a={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" "};var o=/<(\/?)([a-zA-Z][a-zA-Z0-9]*)([^>]*)>/g;function l(l,c){if(void 0===c&&(c={}),"string"!=typeof l)return l;if(!/[<&]/.test(l))return l;var s,u=c.classNames,f=void 0===u?{}:u,p={tag:null,children:[]},h=[p],d=function(){return h[h.length-1]},g=0,m=0,v=function(e){e&&d().children.push(e.replace(/&(#x?[0-9a-fA-F]+|[a-zA-Z]+);/g,function(e,n){if("#"===n[0]){var t="x"===n[1]||"X"===n[1]?parseInt(n.slice(2),16):parseInt(n.slice(1),10);return Number.isFinite(t)&&t>0?String.fromCodePoint(t):e}var r=a[n.toLowerCase()];return void 0===r?e:r}))},x=function(){var r=h.pop(),i=r.tag,a=f[i];d().children.push(t.createElement.apply(t,e([i,n({key:"".concat(i,"-").concat(m++)},a?{className:a}:{})],r.children,!1)))};o.lastIndex=0;for(var b=function(){var e=s[0],n=s[1],a=s[2].toLowerCase();if(!r.has(a))return"continue";if(v(l.slice(g,s.index)),g=s.index+e.length,i.has(a))return d().children.push(t.createElement(a,{key:"".concat(a,"-").concat(m++)})),"continue";if(n){var o=h.findIndex(function(e){return e.tag===a});if(o>0)for(;h.length>o;)x();return"continue"}h.push({tag:a,children:[]})};s=o.exec(l);)b();for(v(l.slice(g));h.length>1;)x();var y=p.children;return y.length?1===y.length&&"string"==typeof y[0]?y[0]:t.createElement.apply(t,e([t.Fragment,null],y,!1)):""}export{l as renderInlineMarkup};
|
|
2
|
+
//# sourceMappingURL=inlineMarkup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inlineMarkup.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as l,__spreadArray as e}from"../../_virtual/_tslib.js";import{jsx as o,Fragment as i,jsxs as t}from"react/jsx-runtime";import n,{useMemo as d}from"react";import{ChartLine as a}from"lucide-react";import r from"./DashboardDateFilter/RecordDashboardDateFilter.js";import u from"./MetricCard/RecordMetricCard.js";import v from"./FiltersSidebar/RecordFiltersSidebar.js";import s from"./Graph/RecordGraph.js";import c from"./Graph/RecordGraphEmptyState.js";import{RECO_DATE_PRESET_MAP as p}from"./DashboardDateFilter/RecordDatePreset.js";import{RECOBuildColumns as g,RECOWithRowIds as h}from"../RecordUtils/RecordTableColumns.js";import{RECOResolveSectionOrder as m,RECOIsSectionHidden as b}from"../RecordUtils/RecordSectionOrder.js";import{RECOGetActiveFilterCount as f,RECOIsKpiValueObject as y,RECOGetKpiValueColor as P,RECOGetKpiDelta as C,RECOFormatKpiValue as w}from"../RecordUtils/index.js";import{RECOGetKpiIcon as B}from"../RecordUtils/RecordKpiIcon.js";import F from"./AnalyticsChart/AnalyticsChart.js";import S from"./TableHeader/TableHeader.js";import R from"./Table/TableGrid/RecordTableGrid.js";import D from"./Table/RecordTableCard.js";import x from"./StatsCard/RecordDashboardStats.js";var k=["#7c3aed","#FFC130","#F43F5E","#10b981","#3b82f6"];function T(T){var H,L,j,A,O,_,M,E,V,z,G,I,W,U,K,N,q,Z,J,Q,X,Y,$,ll,el,ol,il,tl,nl,dl,al,rl,ul,vl,sl,cl,pl,gl,hl,ml,bl,fl,yl,Pl,Cl,wl,Bl,Fl,Sl,Rl,Dl,xl,kl,Tl,Hl,Ll,jl,Al=T.uiConfig,Ol=T.data,_l=T.dataLoading,Ml=T.startDate,El=T.endDate,Vl=T.onDateChange,zl=T.onRefresh,Gl=T.selectedKpis,Il=T.onKpiChange,Wl=T.sidebarVisible,Ul=T.onSidebarShow,Kl=T.onSidebarHide,Nl=T.filterValues,ql=T.onFilterChange,Zl=T.onFilterReset,Jl=T.onFilterApply,Ql=T.appliedFilters,Xl=T.graphEmptyState,Yl=T.tables,$l=T.tableLayout,le=T.statsConfig,ee=T.sectionOrder,oe=T.hiddenSections,ie=T.tablePages,te=T.onTableExpand,ne=T.onTableLoadMore,de=T.TableHeaderProps,ae=T.ChartProps,re=T.searchTerm,ue=T.setSearchTerm,ve=T.selectedSort,se=T.setSelectedSort,ce=T.tablePaginationState,pe=T.tablePaginationResponseState,ge=T.onTablePageChange,he=T.chartPerRow,me=T.chartLayoutStyle,be=null!==(j=null===(L=null===(H=null==Al?void 0:Al.data)||void 0===H?void 0:H.dateFilters)||void 0===L?void 0:L.datepresets)&&void 0!==j?j:[];console.log("tablePaginationState",ce);var fe=d(function(){return be.map(function(l){return p[l]}).filter(Boolean)},[JSON.stringify(be)]),ye=d(function(){return f(Ql)},[Ql]),Pe=d(function(){var l,e,o=null==$l?void 0:$l.spans;if(o)return(null!==(e=null===(l=null==Al?void 0:Al.data)||void 0===l?void 0:l.tableBuilder)&&void 0!==e?e:[]).map(function(l,e){return Array.isArray(o)?o[e]:o[l.key]})},[null==$l?void 0:$l.spans,null===(A=null==Al?void 0:Al.data)||void 0===A?void 0:A.tableBuilder]),Ce=o("div",l({style:{padding:"4px"}},{children:o(x,{uiConfig:null===(O=null==Al?void 0:Al.data)||void 0===O?void 0:O.statsBuilder,data:null==Ol?void 0:Ol.stats,statsConfig:le})})),we=o("div",l({style:{padding:"4px"}},{children:o(s,{loading:_l,emptyState:null!=Xl?Xl:o(c,{}),title:null===(M=null===(_=null==Al?void 0:Al.data)||void 0===_?void 0:_.graphBuilder)||void 0===M?void 0:M.title,description:null===(V=null===(E=null==Al?void 0:Al.data)||void 0===E?void 0:E.graphBuilder)||void 0===V?void 0:V.subtitle,icon:o(a,{size:18}),xAxis:{label:(null===(I=null===(G=null===(z=null==Al?void 0:Al.data)||void 0===z?void 0:z.graphBuilder)||void 0===G?void 0:G.axis)||void 0===I?void 0:I.xAxisLabel)||"Date"},style:{chartHeight:220},panes:null===(U=null===(W=null==Al?void 0:Al.data)||void 0===W?void 0:W.graphBuilder)||void 0===U?void 0:U.tiers.map(function(l,e){var i,t,n,d,r,u,v,s,c,p,g,h=Gl[l.key]||(null===(i=l.plotOptions[0])||void 0===i?void 0:i.key),m=Ol.graph.tier.find(function(e){return e.key===l.key}),b=(null===(t=null==m?void 0:m.plotbyoptions)||void 0===t?void 0:t[h])||{},f=(null==l?void 0:l.series)||[],y=Object.keys(b),P=l.plotOptions.find(function(l){return l.value===h});return{key:l.key,selector:{label:"Plot By",value:h,onChange:function(e){Il(l.key,e)},options:l.plotOptions.map(function(l){return{label:l.label,value:l.value}}),triggerIcon:o(a,{size:16,color:0===e?"green":"purple"})},yAxis:{label:null==P?void 0:P.yAxisLabel,beginAtZero:"false"!==(null==h?void 0:h.yAxisBeginAtZero)},tooltip:{formatHeading:function(l){return"".concat(l)}},legend:{position:(null===(r=null===(d=null===(n=null==Al?void 0:Al.data)||void 0===n?void 0:n.graphBuilder)||void 0===d?void 0:d.legend)||void 0===r?void 0:r.position)||"bottom",toggle:"yes"===(null===(s=null===(v=null===(u=null==Al?void 0:Al.data)||void 0===u?void 0:u.graphBuilder)||void 0===v?void 0:v.legend)||void 0===s?void 0:s.allowToggle),align:(null===(g=null===(p=null===(c=null==Al?void 0:Al.data)||void 0===c?void 0:c.graphBuilder)||void 0===p?void 0:p.legend)||void 0===g?void 0:g.alignment)||"center"},height:0===e?300:250,series:y.map(function(l,e){var o,i,t,n,d,a=(null===(i=null===(o=null==m?void 0:m.plotbyoptions)||void 0===o?void 0:o[h])||void 0===i?void 0:i[l])||[],r=k[e%k.length],u=f.find(function(e){return e.key===l});return{key:l,label:(null==u?void 0:u.name)||l,data:a,area:"yes"===(null==u?void 0:u.areaFill),curve:(null==u?void 0:u.curveType)||"linear",color:"#".concat(null==u?void 0:u.color)||r,dashed:"dashed"===(null==u?void 0:u.style),strokeWidth:parseInt(null==u?void 0:u.strokeWidth)||2,showPoints:"yes"===(null==u?void 0:u.showPoints),pointRadius:parseInt(null==u?void 0:u.pointRadius)||3,showInLegend:"yes"===(null===(d=null===(n=null===(t=null==Al?void 0:Al.data)||void 0===t?void 0:t.graphBuilder)||void 0===n?void 0:n.legend)||void 0===d?void 0:d.showLegends),valueFormatter:function(l){return"".concat(l)}}})}})})})),Be=o("div",l({style:{padding:"4px",display:"flex",gap:"10px",flexWrap:"wrap"}},{children:e([],null!==(N=null===(K=null==Al?void 0:Al.data)||void 0===K?void 0:K.kpiCards)&&void 0!==N?N:[],!0).sort(function(l,e){var o,i;return(null!==(o=l.displayOrder)&&void 0!==o?o:0)-(null!==(i=e.displayOrder)&&void 0!==i?i:0)}).map(function(l){var e,i=null===(e=null==Ol?void 0:Ol.kpiCards)||void 0===e?void 0:e[l.title],t=y(i)?P(i.currentValue,i.baselineValue,l.indicatorLogic):void 0,n=y(i)?C(i.currentValue,i.baselineValue,l.indicatorLogic):void 0;return o(u,{title:l.title,subtitle:l.subtitle,value:w(i,l.valueFormat),valueColor:t,delta:n&&{label:n.label,direction:n.direction,color:t},icon:B(l.icon),loading:_l},l.title)})}));console.log("RecordDashboard",ce);var Fe=(null===(q=null==Al?void 0:Al.data)||void 0===q?void 0:q.tableHeaderBuilder)?o(S,l({filterCount:ye,sortoptions:null!==(Q=null===(J=null===(Z=null==Al?void 0:Al.data)||void 0===Z?void 0:Z.tableHeaderBuilder)||void 0===J?void 0:J.sortOptions)&&void 0!==Q?Q:[],searchPlaceholder:"Search by Document Type",selectedSort:ve,setSelectedSort:se,onFilterClick:Ul,onRefresh:zl,searchTerm:re,setSearchTerm:ue,showFilterCount:!0,hideSearchBar:!(null===(Y=null===(X=null==Al?void 0:Al.data)||void 0===X?void 0:X.tableHeaderBuilder)||void 0===Y?void 0:Y.showSearchBar),hideFilterButton:!(null===(ll=null===($=null==Al?void 0:Al.data)||void 0===$?void 0:$.tableHeaderBuilder)||void 0===ll?void 0:ll.showFilterButton),hideSortButton:!(null===(ol=null===(el=null==Al?void 0:Al.data)||void 0===el?void 0:el.tableHeaderBuilder)||void 0===ol?void 0:ol.showSortButton),hideRefreshButton:!(null===(tl=null===(il=null==Al?void 0:Al.data)||void 0===il?void 0:il.tableHeaderBuilder)||void 0===tl?void 0:tl.showRefreshButton),refreshDuration:null===(dl=null===(nl=null==Al?void 0:Al.data)||void 0===nl?void 0:nl.tableHeaderBuilder)||void 0===dl?void 0:dl.refreshDuration},de)):null,Se=(null!==(ul=null===(rl=null===(al=null==Al?void 0:Al.data)||void 0===al?void 0:al.tableBuilder)||void 0===rl?void 0:rl.length)&&void 0!==ul?ul:0)>0?o("div",l({style:{padding:"4px"}},{children:o(R,l({itemSpans:Pe,totalColumns:null!==(vl=null==$l?void 0:$l.totalColumns)&&void 0!==vl?vl:12,defaultSpan:null==$l?void 0:$l.defaultSpan,options:null!==(sl=null==$l?void 0:$l.options)&&void 0!==sl?sl:[1,2,3],defaultColumns:null==$l?void 0:$l.defaultColumns,columns:null==$l?void 0:$l.columns,onColumnsChange:null==$l?void 0:$l.onColumnsChange,showToggle:(null===(cl=null==$l?void 0:$l.showToggle)||void 0===cl||cl)&&(null!==(hl=null===(gl=null===(pl=null==Al?void 0:Al.data)||void 0===pl?void 0:pl.tableBuilder)||void 0===gl?void 0:gl.length)&&void 0!==hl?hl:0)>1,toggleLabel:null==$l?void 0:$l.toggleLabel,minColumnWidth:null!==(ml=null==$l?void 0:$l.minColumnWidth)&&void 0!==ml?ml:380,gap:null!==(bl=null==$l?void 0:$l.gap)&&void 0!==bl?bl:12,equalHeights:null===(fl=null==$l?void 0:$l.equalHeights)||void 0===fl||fl},{children:Al.data.tableBuilder.map(function(e){var i,t,d,a,r,u,v,s=null!==(t=null===(i=null==Ol?void 0:Ol.table)||void 0===i?void 0:i[e.key])&&void 0!==t?t:[],c=null==ie?void 0:ie[e.key],p=(null==ce?void 0:ce[e.key])||{currentPage:1,rowsPerPage:20},m=(null==c?void 0:c.loading)||!1,b=(p.currentPage-1)*p.rowsPerPage,f=b+p.rowsPerPage,y=s.slice(b,f),P=!!(null==c?void 0:c.loaded),C=P?c.rows:y,w=!P&&e.rowLimit&&e.rowLimit>0?s.slice(0,e.rowLimit):C,F=null==Yl?void 0:Yl[e.key],S=g(e,F),R=null==F?void 0:F.card,x=null==R?void 0:R.icon,k=B(e.icon),T=k&&n.isValidElement(k)?n.cloneElement(k,l(l({},null!=(null==x?void 0:x.size)?{size:x.size}:{}),(null==x?void 0:x.color)?{color:x.color}:{})):k,H=x?l(l(l({width:"auto",height:"auto"},x.color?{color:x.color}:{}),x.background?{background:x.background,padding:6,borderRadius:8}:{}),x.style):void 0,L=function(l,o){null==ge||ge(e.key,l,o)},j=null===(a=null===(d=null==F?void 0:F.TablePaginationProps)||void 0===d?void 0:d.enabled)||void 0===a||a,A=null===(r=null==pe?void 0:pe[e.key])||void 0===r?void 0:r.totalRecords;return o(D,{tableRenderConfig:F,tableHeader:Fe,title:e.title,icon:T,styles:{root:null==R?void 0:R.root,header:null==R?void 0:R.header,title:null==R?void 0:R.title,icon:H},onExpand:function(l){return null==te?void 0:te(e.key,l)},pagination:j?l({enabled:!0,currentPage:p.currentPage,rowsPerPage:p.rowsPerPage,totalRecords:A,itemLabel:(null===(u=e.title)||void 0===u?void 0:u.toLowerCase())||"items",pageSizeOptions:[10,20,50,100],onPageChange:L,onPrevious:function(){return L(p.currentPage-1,p.rowsPerPage)},onNext:function(){return L(p.currentPage+1,p.rowsPerPage)},onRowsPerPageChange:function(l){return L(1,l)}},null==F?void 0:F.TablePaginationProps):{enabled:!1},table:{rows:h(w,j?{currentPage:p.currentPage,rowsPerPage:p.rowsPerPage}:void 0),columns:S,loading:m||_l,loadingMore:null==c?void 0:c.loading,hasMore:null==c?void 0:c.hasMore,onLoadMore:function(){return null==ne?void 0:ne(e.key)},tableProps:null==F?void 0:F.tableProps,rowDetail:null==F?void 0:F.rowDetail,paginationMode:j,totalRecords:A,currentPage:p.currentPage,rowsPerPage:p.rowsPerPage,onPageChange:L,scrollHeight:null===(v=null==F?void 0:F.tableProps)||void 0===v?void 0:v.scrollHeight},columnHeaderTextAlign:null==F?void 0:F.columnHeaderTextAlign,columnCellTextAlign:null==F?void 0:F.columnCellTextAlign,showExpandButton:!1},e.key)})}))})):null,Re=(null===(Pl=null===(yl=null==Al?void 0:Al.data)||void 0===yl?void 0:yl.chartBuilder)||void 0===Pl?void 0:Pl.length)?Al.data.chartBuilder.map(function(e,i){var t,n,d,a,r,u,v,s,c;return o(F,l({chartType:(null==e?void 0:e.chart_type)||"doughnut",title:(null==e?void 0:e.chart_title)||"Chart ".concat(i+1),labels:(null===(t=null==e?void 0:e.chart_data)||void 0===t?void 0:t.labels)||(null===(a=null===(d=null===(n=null==Ol?void 0:Ol.charts)||void 0===n?void 0:n[e.chart_id])||void 0===d?void 0:d.chart_data)||void 0===a?void 0:a.labels)||[],values:(null===(s=null===(v=null===(u=null===(r=null==Ol?void 0:Ol.charts)||void 0===r?void 0:r[e.chart_id])||void 0===u?void 0:u.chart_data)||void 0===v?void 0:v.datasets)||void 0===s?void 0:s.length)?Ol.charts[e.chart_id].chart_data.datasets:[],colors:(null===(c=null==e?void 0:e.colors)||void 0===c?void 0:c.length)?e.colors:["#3B82F6","#6DDB36","#FBBF24"]},ae),e.chart_id||i)}):null,De={statsCards:Ce,graphBuilder:we,kpiCards:Be,charts:Re,tableBuilder:Se},xe=m(ee,oe,null===(Cl=null==Al?void 0:Al.data)||void 0===Cl?void 0:Cl.sectionOrder,Object.keys(De)),ke=b(oe,"dateFilters"),Te=b(oe,"sidebarFilters"),He=b(oe,"chart");return o(i,{children:t("div",l({style:{display:"flex",flexDirection:"column",gap:12}},{children:[!ke&&o("div",l({style:{padding:"4px"}},{children:o(r,{filterCount:ye,initialStartDate:Ml,initialEndDate:El,onDateChange:Vl,onRefresh:zl,onFilterClick:Ul,presets:fe,datePickerProps:{from:{minDate:new Date(2025,0,1),maxDate:new Date},to:{minDate:Ml,maxDate:new Date}},defaultPresets:null===(wl=null==Al?void 0:Al.data)||void 0===wl?void 0:wl.dateFilters.defaultPreset,showLiveButton:"yes"===(null===(Fl=null===(Bl=null==Al?void 0:Al.data)||void 0===Bl?void 0:Bl.dateFilters)||void 0===Fl?void 0:Fl.showLiveButton),showFilterButton:!Te&&"yes"===(null===(Rl=null===(Sl=null==Al?void 0:Al.data)||void 0===Sl?void 0:Sl.dateFilters)||void 0===Rl?void 0:Rl.showFilterButton),showFilterCount:!Te&&"yes"===(null===(xl=null===(Dl=null==Al?void 0:Al.data)||void 0===Dl?void 0:Dl.dateFilters)||void 0===xl?void 0:xl.showFilterCount),liveDuration:null===(Tl=null===(kl=null==Al?void 0:Al.data)||void 0===kl?void 0:kl.dateFilters)||void 0===Tl?void 0:Tl.liveDurationMs})})),xe.map(function(e){return console.log(e,"key"),"charts"===e?He?null:o("div",l({style:l({display:"grid",gridTemplateColumns:"repeat(".concat(he||2,", 1fr)"),gap:"12px",padding:"4px",width:"100%"},me)},{children:De[e]}),e):o(n.Fragment,{children:De[e]},e)}),!Te&&o(v,{visible:Wl,onHide:Kl,onReset:Zl,onApply:Jl,fields:null!==(jl=null===(Ll=null===(Hl=null==Al?void 0:Al.data)||void 0===Hl?void 0:Hl.sidebarFilters)||void 0===Ll?void 0:Ll.map(function(l){var e,o,i,t,n=l.schemaFilterName,d="Single select"===l.type?"singleSelect":"Multi select"===l.type?"multiSelect":"Date Range"===l.type?"dateRange":"Date"===l.type?"date":"text",a=null!==(o=null===(e=l.options)||void 0===e?void 0:e.map(function(l){return{label:l,value:l}}))&&void 0!==o?o:[];return{id:n,label:l.label,hint:l.description,type:d,placeholder:l.placeholder,options:a,value:"multiSelect"===d?null!==(i=Nl[n])&&void 0!==i?i:[]:null!==(t=Nl[n])&&void 0!==t?t:"",onChange:function(l){return ql(n,l)}}}))&&void 0!==jl?jl:[]})]}))})}export{T as RecordDashboard,T as default};
|
|
1
|
+
import{__assign as l,__spreadArray as e}from"../../_virtual/_tslib.js";import{jsx as o,Fragment as i,jsxs as t}from"react/jsx-runtime";import d,{useMemo as n}from"react";import{ChartLine as a}from"lucide-react";import r from"./DashboardDateFilter/RecordDashboardDateFilter.js";import u from"./MetricCard/RecordMetricCard.js";import v from"./FiltersSidebar/RecordFiltersSidebar.js";import s from"./Graph/RecordGraph.js";import c from"./Graph/RecordGraphEmptyState.js";import{RECO_DATE_PRESET_MAP as p}from"./DashboardDateFilter/RecordDatePreset.js";import{RECOBuildColumns as h,RECOWithRowIds as g}from"../RecordUtils/RecordTableColumns.js";import{RECOResolveSectionOrder as m,RECOIsSectionHidden as b}from"../RecordUtils/RecordSectionOrder.js";import{RECOGetActiveFilterCount as f,RECOIsKpiValueObject as y,RECOGetKpiValueColor as P,RECOGetKpiDelta as C,RECOFormatKpiValue as w}from"../RecordUtils/index.js";import{RECOGetKpiIcon as B}from"../RecordUtils/RecordKpiIcon.js";import F from"./AnalyticsChart/AnalyticsChart.js";import S from"./TableHeader/TableHeader.js";import R from"./Table/TableGrid/RecordTableGrid.js";import x from"./Table/RecordTableCard.js";import D from"./StatsCard/RecordDashboardStats.js";var k=["#7c3aed","#FFC130","#F43F5E","#10b981","#3b82f6"];function T(T){var H,L,j,A,O,_,M,E,V,z,G,I,W,U,K,N,q,Z,J,Q,X,Y,$,ll,el,ol,il,tl,dl,nl,al,rl,ul,vl,sl,cl,pl,hl,gl,ml,bl,fl,yl,Pl,Cl,wl,Bl,Fl,Sl,Rl,xl,Dl,kl,Tl,Hl,Ll,jl,Al,Ol,_l,Ml=T.uiConfig,El=T.data,Vl=T.dataLoading,zl=T.startDate,Gl=T.endDate,Il=T.onDateChange,Wl=T.onRefresh,Ul=T.selectedKpis,Kl=T.onKpiChange,Nl=T.sidebarVisible,ql=T.onSidebarShow,Zl=T.onSidebarHide,Jl=T.filterValues,Ql=T.onFilterChange,Xl=T.onFilterReset,Yl=T.onFilterApply,$l=T.appliedFilters,le=T.graphEmptyState,ee=T.tables,oe=T.tableLayout,ie=T.statsConfig,te=T.sectionOrder,de=T.hiddenSections,ne=T.tablePages,ae=T.onTableExpand,re=T.onTableLoadMore,ue=T.TableHeaderProps,ve=T.ChartProps,se=T.searchTerm,ce=T.setSearchTerm,pe=T.selectedSort,he=T.setSelectedSort,ge=T.tablePaginationState,me=T.tablePaginationResponseState,be=T.onTablePageChange,fe=T.chartPerRow,ye=T.chartLayoutStyle,Pe=null!==(j=null===(L=null===(H=null==Ml?void 0:Ml.data)||void 0===H?void 0:H.dateFilters)||void 0===L?void 0:L.datepresets)&&void 0!==j?j:[];console.log("tablePaginationState",ge);var Ce=n(function(){return Pe.map(function(l){return p[l]}).filter(Boolean)},[JSON.stringify(Pe)]),we=n(function(){return f($l)},[$l]),Be=n(function(){var l,e,o=null==oe?void 0:oe.spans;if(o)return(null!==(e=null===(l=null==Ml?void 0:Ml.data)||void 0===l?void 0:l.tableBuilder)&&void 0!==e?e:[]).map(function(l,e){return Array.isArray(o)?o[e]:o[l.key]})},[null==oe?void 0:oe.spans,null===(A=null==Ml?void 0:Ml.data)||void 0===A?void 0:A.tableBuilder]),Fe=o("div",l({style:{padding:"4px"}},{children:o(D,{uiConfig:null===(O=null==Ml?void 0:Ml.data)||void 0===O?void 0:O.statsBuilder,data:null==El?void 0:El.stats,statsConfig:ie})})),Se=o("div",l({style:{padding:"4px"}},{children:o(s,{loading:Vl,emptyState:null!=le?le:o(c,{}),title:null===(M=null===(_=null==Ml?void 0:Ml.data)||void 0===_?void 0:_.graphBuilder)||void 0===M?void 0:M.title,description:null===(V=null===(E=null==Ml?void 0:Ml.data)||void 0===E?void 0:E.graphBuilder)||void 0===V?void 0:V.subtitle,icon:o(a,{size:18}),xAxis:{label:(null===(I=null===(G=null===(z=null==Ml?void 0:Ml.data)||void 0===z?void 0:z.graphBuilder)||void 0===G?void 0:G.axis)||void 0===I?void 0:I.xAxisLabel)||"Date"},style:{chartHeight:220},panes:null===(U=null===(W=null==Ml?void 0:Ml.data)||void 0===W?void 0:W.graphBuilder)||void 0===U?void 0:U.tiers.map(function(l,e){var i,t,d,n,r,u,v,s,c,p,h,g=Ul[l.key]||(null===(i=l.plotOptions[0])||void 0===i?void 0:i.key),m=El.graph.tier.find(function(e){return e.key===l.key}),b=(null===(t=null==m?void 0:m.plotbyoptions)||void 0===t?void 0:t[g])||{},f=(null==l?void 0:l.series)||[],y=Object.keys(b),P=l.plotOptions.find(function(l){return l.value===g});return{key:l.key,selector:{label:"Plot By",value:g,onChange:function(e){Kl(l.key,e)},options:l.plotOptions.map(function(l){return{label:l.label,value:l.value}}),triggerIcon:o(a,{size:16,color:0===e?"green":"purple"})},yAxis:{label:null==P?void 0:P.yAxisLabel,beginAtZero:"false"!==(null==g?void 0:g.yAxisBeginAtZero)},tooltip:{formatHeading:function(l){return"".concat(l)}},legend:{position:(null===(r=null===(n=null===(d=null==Ml?void 0:Ml.data)||void 0===d?void 0:d.graphBuilder)||void 0===n?void 0:n.legend)||void 0===r?void 0:r.position)||"bottom",toggle:"yes"===(null===(s=null===(v=null===(u=null==Ml?void 0:Ml.data)||void 0===u?void 0:u.graphBuilder)||void 0===v?void 0:v.legend)||void 0===s?void 0:s.allowToggle),align:(null===(h=null===(p=null===(c=null==Ml?void 0:Ml.data)||void 0===c?void 0:c.graphBuilder)||void 0===p?void 0:p.legend)||void 0===h?void 0:h.alignment)||"center"},height:0===e?300:250,series:y.map(function(l,e){var o,i,t,d,n,a=(null===(i=null===(o=null==m?void 0:m.plotbyoptions)||void 0===o?void 0:o[g])||void 0===i?void 0:i[l])||[],r=k[e%k.length],u=f.find(function(e){return e.key===l});return{key:l,label:(null==u?void 0:u.name)||l,data:a,area:"yes"===(null==u?void 0:u.areaFill),curve:(null==u?void 0:u.curveType)||"linear",color:"#".concat(null==u?void 0:u.color)||r,dashed:"dashed"===(null==u?void 0:u.style),strokeWidth:parseInt(null==u?void 0:u.strokeWidth)||2,showPoints:"yes"===(null==u?void 0:u.showPoints),pointRadius:parseInt(null==u?void 0:u.pointRadius)||3,showInLegend:"yes"===(null===(n=null===(d=null===(t=null==Ml?void 0:Ml.data)||void 0===t?void 0:t.graphBuilder)||void 0===d?void 0:d.legend)||void 0===n?void 0:n.showLegends),valueFormatter:function(l){return"".concat(l)}}})}})})})),Re=o("div",l({style:{padding:"4px",display:"flex",gap:"10px",flexWrap:"wrap"}},{children:e([],null!==(N=null===(K=null==Ml?void 0:Ml.data)||void 0===K?void 0:K.kpiCards)&&void 0!==N?N:[],!0).sort(function(l,e){var o,i;return(null!==(o=l.displayOrder)&&void 0!==o?o:0)-(null!==(i=e.displayOrder)&&void 0!==i?i:0)}).map(function(l){var e,i=null===(e=null==El?void 0:El.kpiCards)||void 0===e?void 0:e[l.title],t=y(i)?P(i.currentValue,i.baselineValue,l.indicatorLogic):void 0,d=y(i)?C(i.currentValue,i.baselineValue,l.indicatorLogic):void 0;return o(u,{title:l.title,subtitle:l.subtitle,value:w(i,l.valueFormat),valueColor:t,delta:d&&{label:d.label,direction:d.direction,color:t},icon:B(l.icon),loading:Vl},l.title)})}));console.log("RecordDashboard",ge);var xe=(null===(q=null==Ml?void 0:Ml.data)||void 0===q?void 0:q.tableHeaderBuilder)?o(S,l({filterCount:we,sortoptions:null!==(Q=null===(J=null===(Z=null==Ml?void 0:Ml.data)||void 0===Z?void 0:Z.tableHeaderBuilder)||void 0===J?void 0:J.sortOptions)&&void 0!==Q?Q:[],selectedSort:pe,setSelectedSort:he,onFilterClick:ql,onRefresh:Wl,searchTerm:se,setSearchTerm:ce,showFilterCount:!0,hideSearchBar:!(null===(Y=null===(X=null==Ml?void 0:Ml.data)||void 0===X?void 0:X.tableHeaderBuilder)||void 0===Y?void 0:Y.showSearchBar),hideFilterButton:!(null===(ll=null===($=null==Ml?void 0:Ml.data)||void 0===$?void 0:$.tableHeaderBuilder)||void 0===ll?void 0:ll.showFilterButton),hideSortButton:!(null===(ol=null===(el=null==Ml?void 0:Ml.data)||void 0===el?void 0:el.tableHeaderBuilder)||void 0===ol?void 0:ol.showSortButton),hideRefreshButton:!(null===(tl=null===(il=null==Ml?void 0:Ml.data)||void 0===il?void 0:il.tableHeaderBuilder)||void 0===tl?void 0:tl.showRefreshButton),refreshDuration:null===(nl=null===(dl=null==Ml?void 0:Ml.data)||void 0===dl?void 0:dl.tableHeaderBuilder)||void 0===nl?void 0:nl.refreshDuration},ue,{searchPlaceholder:null!==(al=null==ue?void 0:ue.searchPlaceholder)&&void 0!==al?al:null===(ul=null===(rl=null==Ml?void 0:Ml.data)||void 0===rl?void 0:rl.tableHeaderBuilder)||void 0===ul?void 0:ul.searchPlaceholder})):null,De=(null!==(cl=null===(sl=null===(vl=null==Ml?void 0:Ml.data)||void 0===vl?void 0:vl.tableBuilder)||void 0===sl?void 0:sl.length)&&void 0!==cl?cl:0)>0?o("div",l({style:{padding:"4px"}},{children:o(R,l({itemSpans:Be,totalColumns:null!==(pl=null==oe?void 0:oe.totalColumns)&&void 0!==pl?pl:12,defaultSpan:null==oe?void 0:oe.defaultSpan,options:null!==(hl=null==oe?void 0:oe.options)&&void 0!==hl?hl:[1,2,3],defaultColumns:null==oe?void 0:oe.defaultColumns,columns:null==oe?void 0:oe.columns,onColumnsChange:null==oe?void 0:oe.onColumnsChange,showToggle:(null===(gl=null==oe?void 0:oe.showToggle)||void 0===gl||gl)&&(null!==(fl=null===(bl=null===(ml=null==Ml?void 0:Ml.data)||void 0===ml?void 0:ml.tableBuilder)||void 0===bl?void 0:bl.length)&&void 0!==fl?fl:0)>1,toggleLabel:null==oe?void 0:oe.toggleLabel,minColumnWidth:null!==(yl=null==oe?void 0:oe.minColumnWidth)&&void 0!==yl?yl:380,gap:null!==(Pl=null==oe?void 0:oe.gap)&&void 0!==Pl?Pl:12,equalHeights:null===(Cl=null==oe?void 0:oe.equalHeights)||void 0===Cl||Cl},{children:Ml.data.tableBuilder.map(function(e){var i,t,n,a,r,u,v,s=null!==(t=null===(i=null==El?void 0:El.table)||void 0===i?void 0:i[e.key])&&void 0!==t?t:[],c=null==ne?void 0:ne[e.key],p=(null==ge?void 0:ge[e.key])||{currentPage:1,rowsPerPage:20},m=(null==c?void 0:c.loading)||!1,b=(p.currentPage-1)*p.rowsPerPage,f=b+p.rowsPerPage,y=s.slice(b,f),P=!!(null==c?void 0:c.loaded),C=P?c.rows:y,w=!P&&e.rowLimit&&e.rowLimit>0?s.slice(0,e.rowLimit):C,F=null==ee?void 0:ee[e.key],S=h(e,F),R=null==F?void 0:F.card,D=null==R?void 0:R.icon,k=B(e.icon),T=k&&d.isValidElement(k)?d.cloneElement(k,l(l({},null!=(null==D?void 0:D.size)?{size:D.size}:{}),(null==D?void 0:D.color)?{color:D.color}:{})):k,H=D?l(l(l({width:"auto",height:"auto"},D.color?{color:D.color}:{}),D.background?{background:D.background,padding:6,borderRadius:8}:{}),D.style):void 0,L=function(l,o){null==be||be(e.key,l,o)},j=null===(a=null===(n=null==F?void 0:F.TablePaginationProps)||void 0===n?void 0:n.enabled)||void 0===a||a,A=null===(r=null==me?void 0:me[e.key])||void 0===r?void 0:r.totalRecords;return o(x,{tableRenderConfig:F,tableHeader:xe,title:e.title,icon:T,styles:{root:null==R?void 0:R.root,header:null==R?void 0:R.header,title:null==R?void 0:R.title,icon:H},onExpand:function(l){return null==ae?void 0:ae(e.key,l)},pagination:j?l({enabled:!0,currentPage:p.currentPage,rowsPerPage:p.rowsPerPage,totalRecords:A,itemLabel:(null===(u=e.title)||void 0===u?void 0:u.toLowerCase())||"items",pageSizeOptions:[10,20,50,100],onPageChange:L,onPrevious:function(){return L(p.currentPage-1,p.rowsPerPage)},onNext:function(){return L(p.currentPage+1,p.rowsPerPage)},onRowsPerPageChange:function(l){return L(1,l)}},null==F?void 0:F.TablePaginationProps):{enabled:!1},table:{rows:g(w,j?{currentPage:p.currentPage,rowsPerPage:p.rowsPerPage}:void 0),columns:S,loading:m||Vl,loadingMore:null==c?void 0:c.loading,hasMore:null==c?void 0:c.hasMore,onLoadMore:function(){return null==re?void 0:re(e.key)},tableProps:null==F?void 0:F.tableProps,rowDetail:null==F?void 0:F.rowDetail,paginationMode:j,totalRecords:A,currentPage:p.currentPage,rowsPerPage:p.rowsPerPage,onPageChange:L,scrollHeight:null===(v=null==F?void 0:F.tableProps)||void 0===v?void 0:v.scrollHeight},columnHeaderTextAlign:null==F?void 0:F.columnHeaderTextAlign,columnCellTextAlign:null==F?void 0:F.columnCellTextAlign,showExpandButton:!1},e.key)})}))})):null,ke=(null===(Bl=null===(wl=null==Ml?void 0:Ml.data)||void 0===wl?void 0:wl.chartBuilder)||void 0===Bl?void 0:Bl.length)?Ml.data.chartBuilder.map(function(e,i){var t,d,n,a,r,u,v,s,c;return o(F,l({chartType:(null==e?void 0:e.chart_type)||"doughnut",title:(null==e?void 0:e.chart_title)||"Chart ".concat(i+1),labels:(null===(t=null==e?void 0:e.chart_data)||void 0===t?void 0:t.labels)||(null===(a=null===(n=null===(d=null==El?void 0:El.charts)||void 0===d?void 0:d[e.chart_id])||void 0===n?void 0:n.chart_data)||void 0===a?void 0:a.labels)||[],values:(null===(s=null===(v=null===(u=null===(r=null==El?void 0:El.charts)||void 0===r?void 0:r[e.chart_id])||void 0===u?void 0:u.chart_data)||void 0===v?void 0:v.datasets)||void 0===s?void 0:s.length)?El.charts[e.chart_id].chart_data.datasets:[],colors:(null===(c=null==e?void 0:e.colors)||void 0===c?void 0:c.length)?e.colors:["#3B82F6","#6DDB36","#FBBF24"]},ve),e.chart_id||i)}):null,Te={statsCards:Fe,graphBuilder:Se,kpiCards:Re,charts:ke,tableBuilder:De},He=m(te,de,null===(Fl=null==Ml?void 0:Ml.data)||void 0===Fl?void 0:Fl.sectionOrder,Object.keys(Te)),Le=b(de,"dateFilters"),je=b(de,"sidebarFilters"),Ae=b(de,"chart");return o(i,{children:t("div",l({style:{display:"flex",flexDirection:"column",gap:12}},{children:[!Le&&o("div",l({style:{padding:"4px"}},{children:o(r,{filterCount:we,initialStartDate:zl,initialEndDate:Gl,onDateChange:Il,onRefresh:Wl,onFilterClick:ql,presets:Ce,datePickerProps:{from:{minDate:new Date(2025,0,1),maxDate:new Date},to:{minDate:zl,maxDate:new Date}},defaultPresets:null===(Sl=null==Ml?void 0:Ml.data)||void 0===Sl?void 0:Sl.dateFilters.defaultPreset,showLiveButton:"yes"===(null===(xl=null===(Rl=null==Ml?void 0:Ml.data)||void 0===Rl?void 0:Rl.dateFilters)||void 0===xl?void 0:xl.showLiveButton),showFilterButton:!je&&"yes"===(null===(kl=null===(Dl=null==Ml?void 0:Ml.data)||void 0===Dl?void 0:Dl.dateFilters)||void 0===kl?void 0:kl.showFilterButton),showFilterCount:!je&&"yes"===(null===(Hl=null===(Tl=null==Ml?void 0:Ml.data)||void 0===Tl?void 0:Tl.dateFilters)||void 0===Hl?void 0:Hl.showFilterCount),liveDuration:null===(jl=null===(Ll=null==Ml?void 0:Ml.data)||void 0===Ll?void 0:Ll.dateFilters)||void 0===jl?void 0:jl.liveDurationMs})})),He.map(function(e){return console.log(e,"key"),"charts"===e?Ae?null:o("div",l({style:l({display:"grid",gridTemplateColumns:"repeat(".concat(fe||2,", 1fr)"),gap:"12px",padding:"4px",width:"100%"},ye)},{children:Te[e]}),e):o(d.Fragment,{children:Te[e]},e)}),!je&&o(v,{visible:Nl,onHide:Zl,onReset:Xl,onApply:Yl,fields:null!==(_l=null===(Ol=null===(Al=null==Ml?void 0:Ml.data)||void 0===Al?void 0:Al.sidebarFilters)||void 0===Ol?void 0:Ol.map(function(l){var e,o,i,t,d=l.schemaFilterName,n="Single select"===l.type?"singleSelect":"Multi select"===l.type?"multiSelect":"Date Range"===l.type?"dateRange":"Date"===l.type?"date":"text",a=null!==(o=null===(e=l.options)||void 0===e?void 0:e.map(function(l){return{label:l,value:l}}))&&void 0!==o?o:[];return{id:d,label:l.label,hint:l.description,type:n,placeholder:l.placeholder,options:a,value:"multiSelect"===n?null!==(i=Jl[d])&&void 0!==i?i:[]:null!==(t=Jl[d])&&void 0!==t?t:"",onChange:function(l){return Ql(d,l)}}}))&&void 0!==_l?_l:[]})]}))})}export{T as RecordDashboard,T as default};
|
|
2
2
|
//# sourceMappingURL=RecordDashboard.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"../../../_virtual/_tslib.js";import{jsxs as l,Fragment as t,jsx as n}from"react/jsx-runtime";import{useState as o,useEffect as a}from"react";import{Minimize as r,Maximize as i}from"lucide-react";import c from"../FiltersSidebar/RecordCustomTextInput.js";import d from"./RecordSortDropdown.js";import u from"./Pagination/TablePagination.js";import s from"./RecordFTable.js";function v(v){var g=v.title,h=v.icon,
|
|
1
|
+
import{__assign as e}from"../../../_virtual/_tslib.js";import{jsxs as l,Fragment as t,jsx as n}from"react/jsx-runtime";import{useState as o,useEffect as a}from"react";import{Minimize as r,Maximize as i}from"lucide-react";import c from"../FiltersSidebar/RecordCustomTextInput.js";import d from"./RecordSortDropdown.js";import u from"./Pagination/TablePagination.js";import s from"./RecordFTable.js";function v(v){var g=v.title,h=v.icon,m=v.showExpandButton,p=void 0===m||m,y=v.className,P=v.styles,b=v.table,S=v.searchBar,f=v.sort,w=v.onExpand,x=v.pagination,C=v.tableHeader,N=v.tableRenderConfig,T=v.columnHeaderTextAlign,R=v.columnCellTextAlign,H=o(!1),j=H[0],A=H[1];a(function(){if(!(null==x?void 0:x.enabled)){var e=window.setTimeout(function(){A(!0),null==w||w(!0)},10);return function(){return window.clearTimeout(e)}}},[]);var B=function(e,l){var t,n;(null==x?void 0:x.onPageChange)?x.onPageChange(e,l):e<((null==x?void 0:x.currentPage)||1)?null===(t=null==x?void 0:x.onPrevious)||void 0===t||t.call(x):e>((null==x?void 0:x.currentPage)||1)&&(null===(n=null==x?void 0:x.onNext)||void 0===n||n.call(x))};return l(t,{children:["outside-table"===(null==N?void 0:N.tableHeaderPosition)&&C,l("div",e({className:"\n tc-root\n ".concat(j?"tc-root--fullscreen":"","\n ").concat(null!=y?y:"","\n "),style:null==P?void 0:P.root},{children:[l("div",e({className:"tc-header",style:null==P?void 0:P.header},{children:[l("div",e({className:"tc-header-left"},{children:[h&&n("div",e({className:"tc-title-icon",style:e({width:"20px",height:"20px"},null==P?void 0:P.icon)},{children:h})),(null==N?void 0:N.showTableTitle)&&n("div",e({className:"tc-title",style:null==P?void 0:P.title},{children:g}))]})),l("div",e({className:"tc-header-right"},{children:[S&&n(c,{value:null==S?void 0:S.value,placeholder:null==S?void 0:S.placeholder,onChange:null==S?void 0:S.onChange,searchIcon:!0,className:"tc-search"}),f&&n(d,{value:f.value,orderBy:f.orderBy,options:f.options,placeholder:null==f?void 0:f.placeholder,onChange:f.onChange}),p&&n("button",e({className:"tc-expand-btn",onClick:function(){var e=!j;A(e),null==w||w(e)}},{children:n(j?r:i,{size:20})}))]}))]})),"inside-table"===(null==N?void 0:N.tableHeaderPosition)&&C,n("div",e({className:"tc-table"},{children:n(s,e({},b,{emptyState:null==b?void 0:b.emptyState,scrollHeight:null==b?void 0:b.scrollHeight,paginationMode:(null==x?void 0:x.enabled)||!1,totalRecords:(null==x?void 0:x.totalRecords)||0,currentPage:(null==x?void 0:x.currentPage)||1,rowsPerPage:(null==x?void 0:x.rowsPerPage)||10,onPageChange:B,columnHeaderTextAlign:T,columnCellTextAlign:R,tableWrapperStyle:null==N?void 0:N.tableWrapperStyle}))}))]})),(null==x?void 0:x.enabled)&&n(u,{enabled:x.enabled,currentPage:x.currentPage,rowsPerPage:x.rowsPerPage,totalRecords:x.totalRecords,showMany:x.showMany,itemLabel:x.itemLabel,pageSizeOptions:x.pageSizeOptions,onPrevious:function(){return B((x.currentPage||1)-1,x.rowsPerPage||10)},onNext:function(){return B((x.currentPage||1)+1,x.rowsPerPage||10)},onRowsPerPageChange:function(e){var l;(null==x?void 0:x.onPageChange)?x.onPageChange(1,e):null===(l=null==x?void 0:x.onRowsPerPageChange)||void 0===l||l.call(x,e)},style:x.style,leftStyle:x.leftStyle,rightStyle:x.rightStyle,countStyle:x.countStyle,navStyle:x.navStyle,buttonStyle:x.buttonStyle,buttonDisabledStyle:x.buttonDisabledStyle,selectWrapperStyle:x.selectWrapperStyle,selectStyle:x.selectStyle,chevronStyle:x.chevronStyle,textStyle:x.textStyle})]})}export{v as default};
|
|
2
2
|
//# sourceMappingURL=RecordTableCard.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__awaiter as n,__generator as r,__rest as t,__spreadArray as o}from"../_virtual/_tslib.js";import{jsx as a,Fragment as i,jsxs as l}from"react/jsx-runtime";import u,{useState as d,useRef as s,useEffect as c,useCallback as v}from"react";import{RECO_DATE_PRESETS as f}from"./RecordComponents/DashboardDateFilter/RecordDatePreset.js";import{RecordDashboardSkeleton as g}from"./RecordComponents/DashboardSkeleton/RecordDashboardSkeleton.js";import{RecordFetchUIConfig as b,RecordFetchDashboardData as h,RecordFetchTableData as p}from"./RecordApi/RecordDashboardApi.js";import{RecordDashboard as m}from"./RecordComponents/RecordDashboard.js";function y(y){var P=this,C=y.baseUrl,D=void 0===C?"https://dev.appmod.ai":C,S=y.configId,T=y.accessToken,x=y.uiConfigId,k=y.applicationType,w=y.graphEmptyState,R=y.tables,E=y.tableLayout,j=y.statsConfig,A=y.sectionOrder,O=y.hiddenSections,F=y.fetchUIConfig,I=y.fetchDashboardData,M=y.fetchTableData,L=y.initialStartDate,B=y.initialEndDate,H=y.onDateChange,z=y.onFiltersApplied,U=y.renderLoading,K=y.renderError,W=y.chartPerRow,N=y.chartLayoutStyle,V=y.TableHeaderProps,_=null!=F?F:b,q=null!=I?I:h,G=null!=M?M:p,J=d(null),Q=J[0],X=J[1],Y=d(null),Z=Y[0],$=Y[1],ee=d(!0),ne=ee[0],re=ee[1],te=d(!0),oe=te[0],ae=te[1],ie=d(null),le=ie[0],ue=ie[1],de=d(""),se=de[0],ce=de[1],ve=d(null),fe=ve[0],ge=ve[1],be=d(!1),he=be[0],pe=be[1],me=d({}),ye=me[0],Pe=me[1],Ce=d({}),De=Ce[0],Se=Ce[1],Te=d({}),xe=Te[0],ke=Te[1],we=d(null),Re=we[0],Ee=we[1],je=d({}),Ae=je[0],Oe=je[1],Fe=d([]),Ie=Fe[0],Me=Fe[1],Le=d({}),Be=Le[0],He=Le[1],ze=d({}),Ue=ze[0],Ke=ze[1],We=u.useRef(null),Ne=u.useRef(!1),Ve=s(null),_e=s(null),qe=s({}),Ge=s(new Set),Je=d({}),Qe=Je[0],Xe=Je[1];c(function(){var e;if(null===(e=null==Q?void 0:Q.data)||void 0===e?void 0:e.tableBuilder){var n={};Q.data.tableBuilder.forEach(function(e){var r,t,o,a=null==R?void 0:R[e.key];!1!==(null===(r=null==a?void 0:a.TablePaginationProps)||void 0===r?void 0:r.enabled)&&(n[e.key]={currentPage:1,rowsPerPage:(null===(o=null===(t=null==a?void 0:a.TablePaginationProps)||void 0===t?void 0:t.pageSizeOptions)||void 0===o?void 0:o[0])||20}),console.log("Initial Pagination State:",n)}),He(n)}},[Q,R]),c(function(){var e;Z&&Q&&((null===(e=Q.data)||void 0===e?void 0:e.tableBuilder)||[]).forEach(function(e){var n,r=e.key,t=null==R?void 0:R[r];if(null===(n=null==t?void 0:t.TablePaginationProps)||void 0===n?void 0:n.enabled){var o=Be[r];if(o){var a=o.currentPage,i=o.rowsPerPage;console.log("Fetching table data for page:",o),rn(r,a,i)}}})},[Z,Q]),c(function(){if(Object.keys(Be).length>0){var n={};Object.keys(Be).forEach(function(r){n[r]=e(e({},Be[r]),{currentPage:1})}),He(n)}},[xe,Re]),c(function(){var n;if(Object.keys(Be).length>0){var r={};Object.keys(Be).forEach(function(n){r[n]=e(e({},Be[n]),{currentPage:1})}),He(r)}((null===(n=null==Q?void 0:Q.data)||void 0===n?void 0:n.tableBuilder)||[]).forEach(function(e){var n,r,t=e.key,o=null==R?void 0:R[t];!(null===(n=null==o?void 0:o.TablePaginationProps)||void 0===n?void 0:n.enabled)&&Ge.current.has(t)?(qe.current[t]&&(qe.current[t].abort(),delete qe.current[t]),$e(t,void 0,!0)):rn(t,1,(null===(r=Be[t])||void 0===r?void 0:r.rowsPerPage)||20)})},[se,fe,Ie,Ae,xe]);var Ye=v(function(){return n(P,void 0,void 0,function(){var e,n,t,o,a,i,l,u,d,s,c,v,g,b;return r(this,function(r){switch(r.label){case 0:re(!0),ue(null),null===(d=Ve.current)||void 0===d||d.abort(),e=new AbortController,Ve.current=e,r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,_({configId:S,baseUrl:D,accessToken:T,uiConfigId:x,applicationType:k},e.signal)];case 2:return n=r.sent(),t=Object.keys((null==n?void 0:n.data)||{})[0],o=null===(s=null==n?void 0:n.data)||void 0===s?void 0:s[t],X(n),a={},null===(v=null===(c=null==o?void 0:o.graphBuilder)||void 0===c?void 0:c.tiers)||void 0===v||v.forEach(function(e){e.plotOptions.length>0&&(a[e.key]=e.plotOptions[0].value)}),Pe(a),i={},null===(g=null==o?void 0:o.sidebarFilters)||void 0===g||g.forEach(function(e){i[e.schemaFilterName]="Multi select"===e.type?[]:""}),Se(i),ke(i),Oe({}),Ne.current||(l=L&&B?{startDate:L,endDate:B}:(h=null===(b=null==o?void 0:o.dateFilters)||void 0===b?void 0:b.defaultPreset,(p=Object.values(f).find(function(e){return e.value===h}))&&"getRange"in p?p.getRange():null))&&(Ne.current=!0,We.current={start:l.startDate.getTime(),end:l.endDate.getTime()},Ee({start:l.startDate,end:l.endDate})),[3,5];case 3:return"AbortError"===(null==(u=r.sent())?void 0:u.name)?[2]:(ue(u),[3,5]);case 4:return Ve.current===e&&re(!1),[7];case 5:return[2]}var h,p})})},[S,D,_,L,B,T]);c(function(){return Ye(),function(){var e;return null===(e=Ve.current)||void 0===e?void 0:e.abort()}},[Ye]);var Ze=v(function(){return n(P,void 0,void 0,function(){var n,t,o,a,i,l;return r(this,function(r){switch(r.label){case 0:null===(i=_e.current)||void 0===i||i.abort(),n=new AbortController,_e.current=n,ae(!0),ue(null),r.label=1;case 1:return r.trys.push([1,3,4,5]),t={startDate:null==Re?void 0:Re.start,endDate:null==Re?void 0:Re.end,filters:xe,statsFilters:Ae,selectedStatCards:Ie},[4,q({configId:S,baseUrl:D,accessToken:T,uiConfigId:x,applicationType:k},t,n.signal)];case 2:return(o=r.sent()).table&&((null===(l=null==Q?void 0:Q.data)||void 0===l?void 0:l.tableBuilder)||[]).forEach(function(e){var n,r=e.key,t=null==R?void 0:R[r];(null===(n=null==t?void 0:t.TablePaginationProps)||void 0===n?void 0:n.enabled)&&(null==o||delete o.table[r])}),$(o),He(function(n){var r=e({},n);return Object.keys(r).forEach(function(n){r[n]=e(e({},r[n]),{currentPage:1})}),r}),[3,5];case 3:return"AbortError"===(null==(a=r.sent())?void 0:a.name)?[2]:(ue(a),[3,5]);case 4:return _e.current===n&&ae(!1),[7];case 5:return[2]}})})},[S,D,Re,xe,Ae,Ie,q,Q,R,T]);c(function(){return Ze(),function(){var e;return null===(e=_e.current)||void 0===e?void 0:e.abort()}},[Ze]);var $e=v(function(t,a,i){return void 0===i&&(i=!1),n(P,void 0,void 0,function(){var n,l,u,d,s,c,v,f,g;return r(this,function(r){switch(r.label){case 0:if(!Ge.current.has(t)||qe.current[t])return[2];n=new AbortController,qe.current[t]=n,l=function(){return!Ge.current.has(t)||n.signal.aborted||qe.current[t]!==n},Xe(function(n){var r,o,a,l,u,d,s,c;return e(e({},n),((r={})[t]={rows:i?[]:null!==(a=null===(o=n[t])||void 0===o?void 0:o.rows)&&void 0!==a?a:[],cursor:i||null===(l=n[t])||void 0===l?void 0:l.cursor,hasMore:!i&&(null!==(d=null===(u=n[t])||void 0===u?void 0:u.hasMore)&&void 0!==d&&d),loading:!0,loaded:!i&&(null!==(c=null===(s=n[t])||void 0===s?void 0:s.loaded)&&void 0!==c&&c)},r))}),r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,G({configId:S,baseUrl:D,accessToken:T,uiConfigId:x,applicationType:k},e({startDate:null==Re?void 0:Re.start,endDate:null==Re?void 0:Re.end,filters:xe,statsFilters:Ae,selectedStatCards:Ie,tableHeader:{searchTerm:se,searchColumn:null===(v=null===(c=null==Q?void 0:Q.data)||void 0===c?void 0:c.tableHeaderBuilder)||void 0===v?void 0:v.searchColumns,sort:null!=fe?fe:{}},tableKey:t,pageSize:20},a&&!i?{cursor:a}:{}),n.signal)];case 2:return u=r.sent(),d=null!==(g=null===(f=u.table)||void 0===f?void 0:f[t])&&void 0!==g?g:[],l()?[2]:(Xe(function(n){var r,a,l=n[t];return l?e(e({},n),((r={})[t]={rows:i?d:o(o([],l.rows,!0),d,!0),cursor:null!==(a=u.nextCursor)&&void 0!==a?a:void 0,hasMore:u.hasNext,loading:!1,loaded:!0},r)):n}),[3,5]);case 3:return"AbortError"===(null==(s=r.sent())?void 0:s.name)||l()?[2]:(Xe(function(n){var r;return n[t]?e(e({},n),((r={})[t]=e(e({},n[t]),{loading:!1,hasMore:!1}),r)):n}),[3,5]);case 4:return qe.current[t]===n&&delete qe.current[t],[7];case 5:return[2]}})})},[S,D,Re,xe,Ae,G,se,fe,Q]),en=v(function(e,n){var r;if(!n)return Ge.current.delete(e),null===(r=qe.current[e])||void 0===r||r.abort(),delete qe.current[e],void Xe(function(n){var r=n,o=e;return r[o],t(r,["symbol"==typeof o?o:o+""])});Ge.current.add(e),$e(e)},[$e]),nn=v(function(e){var n=Qe[e];(null==n?void 0:n.hasMore)&&!n.loading&&n.cursor&&$e(e,n.cursor)},[$e,Qe]),rn=v(function(t,o,a){return n(P,void 0,void 0,function(){var n,i,l,u,d,s,c,v,f,g,b,h,p,m;return r(this,function(r){switch(r.label){case 0:qe.current[t]&&(qe.current[t].abort(),delete qe.current[t]),n=new AbortController,qe.current[t]=n,Xe(function(n){var r,o;return e(e({},n),((r={})[t]={rows:(null===(o=n[t])||void 0===o?void 0:o.rows)||[],cursor:void 0,hasMore:!1,loading:!0,loaded:!1},r))}),r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,G({configId:S,baseUrl:D,accessToken:T,uiConfigId:x,applicationType:k},{startDate:null==Re?void 0:Re.start,endDate:null==Re?void 0:Re.end,filters:xe,selectedStatCards:Ie,tableHeader:{searchTerm:se,searchColumn:null===(v=null===(c=null==Q?void 0:Q.data)||void 0===c?void 0:c.tableHeaderBuilder)||void 0===v?void 0:v.searchColumns,sort:null!=fe?fe:{}},tableKey:t,page:o,pageSize:a},n.signal)];case 2:return i=r.sent(),l=null!==(g=null===(f=i.table)||void 0===f?void 0:f[t])&&void 0!==g?g:[],u=null!==(h=null===(b=i.pagination)||void 0===b?void 0:b.totalRecords)&&void 0!==h?h:0,d=null!==(m=null===(p=i.pagination)||void 0===p?void 0:p.totalPages)&&void 0!==m?m:0,n.signal.aborted?[2]:(Ke(function(n){var r;return e(e({},n),((r={})[t]=e(e({},n[t]),{totalRecords:u,totalPages:d}),r))}),Xe(function(n){var r,o,a;return e(e({},n),((r={})[t]={rows:l,cursor:null!==(o=i.nextCursor)&&void 0!==o?o:void 0,hasMore:null!==(a=i.hasNext)&&void 0!==a&&a,loading:!1,loaded:!0},r))}),[3,5]);case 3:return"AbortError"===(null==(s=r.sent())?void 0:s.name)||n.signal.aborted?[2]:(Xe(function(n){var r;return e(e({},n),((r={})[t]=e(e({},n[t]),{loading:!1,hasMore:!1}),r))}),[3,5]);case 4:return qe.current[t]===n&&delete qe.current[t],[7];case 5:return[2]}})})},[S,D,Re,xe,Ie,G,se,fe,Q]);c(function(){return function(){Ge.current.clear(),Object.values(qe.current).forEach(function(e){return e.abort()})}},[]);var tn=v(function(e){if((null==e?void 0:e.startDate)&&(null==e?void 0:e.endDate)){var n=e.startDate.getTime(),r=e.endDate.getTime();We.current&&We.current.start===n&&We.current.end===r||(We.current={start:n,end:r},Ee({start:e.startDate,end:e.endDate}))}null==H||H(e)},[H]),on=v(function(e,n,r,t){var o=r.map(function(e){return String(e.card.id)});Me(o);var a={};Object.entries(t).forEach(function(e){var n=e[0],r=e[1];Array.isArray(r)&&r.length>0?a[n]=r:"string"==typeof r&&""!==r.trim()&&(a[n]=[r])}),Oe(a)},[]),an=ne||oe&&!Z;return le?K?a(i,{children:K(le,Ye)}):l("div",e({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",minHeight:"350px",padding:"32px",backgroundColor:"#fffcfc",border:"1px dashed #fca5a5",borderRadius:"12px",margin:"24px",fontFamily:"system-ui, -apple-system, sans-serif"}},{children:[a("div",e({style:{backgroundColor:"#fee2e2",padding:"16px",borderRadius:"50%",marginBottom:"20px"}},{children:a("svg",e({width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"#ef4444",strokeWidth:"2"},{children:a("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}))})),a("h3",e({style:{margin:"0 0 12px",color:"#111827",fontSize:"20px",fontWeight:"600"}},{children:"Unable to load dashboard"})),a("p",e({style:{margin:"0 0 28px",color:"#4b5563",fontSize:"15px",textAlign:"center",maxWidth:"450px",lineHeight:"1.5"}},{children:le.message})),a("button",e({onClick:Ye,style:{padding:"10px 24px",backgroundColor:"#1f2937",color:"#ffffff",border:"none",borderRadius:"8px",fontSize:"15px",fontWeight:"500",cursor:"pointer",transition:"opacity 0.2s",boxShadow:"0 1px 2px 0 rgba(0, 0, 0, 0.05)"},onMouseOver:function(e){return e.currentTarget.style.opacity="0.85"},onMouseOut:function(e){return e.currentTarget.style.opacity="1"}},{children:"Try Again"}))]})):!an&&Q&&Z?a(m,{uiConfig:Q,data:Z,dataLoading:oe,startDate:null==Re?void 0:Re.start,endDate:null==Re?void 0:Re.end,onDateChange:tn,onRefresh:function(){Ze()},selectedKpis:ye,onKpiChange:function(n,r){Pe(function(t){var o;return e(e({},t),((o={})[n]=r,o))})},sidebarVisible:he,onSidebarShow:function(){return pe(!0)},onSidebarHide:function(){return pe(!1)},filterValues:De,onFilterChange:function(n,r){Se(function(t){var o;return e(e({},t),((o={})[n]=r,o))})},onFilterReset:function(){if(Q){var e={};Q.data.sidebarFilters.forEach(function(n){e[n.id]="multiSelect"===n.type?[]:""}),Se(e)}},onFilterApply:function(){ke(De),pe(!1),null==z||z(De)},appliedFilters:xe,graphEmptyState:w,tables:R,tableLayout:E,statsConfig:e(e({},j),{onSelectionChange:function(e,n,r,t){var o;on(e,n,r,t),null===(o=null==j?void 0:j.onSelectionChange)||void 0===o||o.call(j,e,n,r,t)}}),sectionOrder:A,hiddenSections:O,tablePages:Qe,onTableExpand:en,onTableLoadMore:nn,tablePaginationState:Be,tablePaginationResponseState:Ue,onTablePageChange:function(n,r,t){var o;He(function(o){var a;return e(e({},o),((a={})[n]={currentPage:r,rowsPerPage:t},a))});var a=null==R?void 0:R[n];(null===(o=null==a?void 0:a.TablePaginationProps)||void 0===o?void 0:o.enabled)&&rn(n,r,t)},searchTerm:se,setSearchTerm:ce,selectedSort:fe,setSelectedSort:ge,chartPerRow:W,chartLayoutStyle:N,ChartProps:{style:{width:"460px"}},TableHeaderProps:V}):U?a(i,{children:U()}):a(g,{})}export{y as RecordDashboardWrapper,y as default};
|
|
1
|
+
import{__awaiter as e,__generator as r,__rest as n,__assign as t,__spreadArray as o}from"../_virtual/_tslib.js";import{jsx as a,Fragment as i,jsxs as l}from"react/jsx-runtime";import u,{useState as d,useRef as s,useEffect as c,useCallback as v}from"react";import{RECO_DATE_PRESETS as f}from"./RecordComponents/DashboardDateFilter/RecordDatePreset.js";import{RecordDashboardSkeleton as p}from"./RecordComponents/DashboardSkeleton/RecordDashboardSkeleton.js";import{RecordFetchUIConfig as g,RecordFetchDashboardData as h,RecordFetchTableData as b}from"./RecordApi/RecordDashboardApi.js";import{RecordDashboard as m}from"./RecordComponents/RecordDashboard.js";function y(y){var C=this,D=y.baseUrl,P=void 0===D?"https://dev.appmod.ai":D,S=y.configId,x=y.accessToken,T=y.uiConfigId,w=y.applicationType,k=y.graphEmptyState,R=y.tables,E=y.tableLayout,A=y.statsConfig,F=y.sectionOrder,j=y.hiddenSections,I=y.fetchUIConfig,M=y.fetchDashboardData,O=y.fetchTableData,L=y.initialStartDate,B=y.initialEndDate,H=y.onDateChange,z=y.onFiltersApplied,U=y.renderLoading,K=y.renderError,W=y.chartPerRow,N=y.chartLayoutStyle,V=y.TableHeaderProps,_=null!=I?I:g,q=null!=M?M:h,G=null!=O?O:b,J=d(null),Q=J[0],X=J[1],Y=d(null),Z=Y[0],$=Y[1],ee=d(!0),re=ee[0],ne=ee[1],te=d(!0),oe=te[0],ae=te[1],ie=d(!1),le=ie[0],ue=ie[1],de=d(null),se=de[0],ce=de[1],ve=d(""),fe=ve[0],pe=ve[1],ge=d(null),he=ge[0],be=ge[1],me=d(!1),ye=me[0],Ce=me[1],De=d({}),Pe=De[0],Se=De[1],xe=d({}),Te=xe[0],we=xe[1],ke=d({}),Re=ke[0],Ee=ke[1],Ae=d(null),Fe=Ae[0],je=Ae[1],Ie=d({}),Me=Ie[0],Oe=Ie[1],Le=d([]),Be=Le[0],He=Le[1],ze=d({}),Ue=ze[0],Ke=ze[1],We=d(!1),Ne=We[0],Ve=We[1],_e=d({}),qe=_e[0],Ge=_e[1],Je=u.useRef(null),Qe=u.useRef(!1),Xe=s(null),Ye=s(null),Ze=s({}),$e=s(new Set),er=d({}),rr=er[0],nr=er[1];c(function(){var e;if(null===(e=null==Q?void 0:Q.data)||void 0===e?void 0:e.tableBuilder){var r={};Q.data.tableBuilder.forEach(function(e){var n,t,o,a=null==R?void 0:R[e.key];!1!==(null===(n=null==a?void 0:a.TablePaginationProps)||void 0===n?void 0:n.enabled)&&(r[e.key]={currentPage:1,rowsPerPage:(null===(o=null===(t=null==a?void 0:a.TablePaginationProps)||void 0===t?void 0:t.pageSizeOptions)||void 0===o?void 0:o[0])||20}),console.log("Initial Pagination State:",r)}),Ke(r),Ve(!0)}else Ve(!1)},[Q,R]);var tr=v(function(){return e(C,void 0,void 0,function(){var e,n,t,o,a,i,l,u,d,s,c,v,p,g;return r(this,function(r){switch(r.label){case 0:ne(!0),ue(!1),ce(null),null===(d=Xe.current)||void 0===d||d.abort(),e=new AbortController,Xe.current=e,r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,_({configId:S,baseUrl:P,accessToken:x,uiConfigId:T,applicationType:w},e.signal)];case 2:return n=r.sent(),t=Object.keys((null==n?void 0:n.data)||{})[0],o=null===(s=null==n?void 0:n.data)||void 0===s?void 0:s[t],X(n),a={},null===(v=null===(c=null==o?void 0:o.graphBuilder)||void 0===c?void 0:c.tiers)||void 0===v||v.forEach(function(e){e.plotOptions.length>0&&(a[e.key]=e.plotOptions[0].value)}),Se(a),i={},null===(p=null==o?void 0:o.sidebarFilters)||void 0===p||p.forEach(function(e){i[e.schemaFilterName]="Multi select"===e.type?[]:""}),we(i),Ee(i),Oe({}),Qe.current||(l=L&&B?{startDate:L,endDate:B}:(h=null===(g=null==o?void 0:o.dateFilters)||void 0===g?void 0:g.defaultPreset,(b=Object.values(f).find(function(e){return e.value===h}))&&"getRange"in b?b.getRange():null))&&(Qe.current=!0,Je.current={start:l.startDate.getTime(),end:l.endDate.getTime()},je({start:l.startDate,end:l.endDate})),ue(!0),[3,5];case 3:return"AbortError"===(null==(u=r.sent())?void 0:u.name)?[2]:(ce(u),[3,5]);case 4:return Xe.current===e&&ne(!1),[7];case 5:return[2]}var h,b})})},[S,P,_,L,B,x,T,w]);c(function(){return tr(),function(){var e;return null===(e=Xe.current)||void 0===e?void 0:e.abort()}},[tr]);var or=v(function(){return e(C,void 0,void 0,function(){var e,n,t,o,a,i;return r(this,function(r){switch(r.label){case 0:if(!le||!Q)return[2];null===(a=Ye.current)||void 0===a||a.abort(),e=new AbortController,Ye.current=e,ae(!0),ce(null),r.label=1;case 1:return r.trys.push([1,3,4,5]),n={startDate:null==Fe?void 0:Fe.start,endDate:null==Fe?void 0:Fe.end,filters:Re,statsFilters:Me,selectedStatCards:Be},[4,q({configId:S,baseUrl:P,accessToken:x,uiConfigId:T,applicationType:w},n,e.signal)];case 2:return(t=r.sent()).table&&((null===(i=null==Q?void 0:Q.data)||void 0===i?void 0:i.tableBuilder)||[]).forEach(function(e){var r,n=e.key,o=null==R?void 0:R[n];!1!==(null===(r=null==o?void 0:o.TablePaginationProps)||void 0===r?void 0:r.enabled)&&(null==t||delete t.table[n])}),$(t),[3,5];case 3:return"AbortError"===(null==(o=r.sent())?void 0:o.name)?[2]:(ce(o),[3,5]);case 4:return Ye.current===e&&ae(!1),[7];case 5:return[2]}})})},[S,P,Fe,Re,Me,Be,q,le,Q,R,x,T,w]);c(function(){return or(),function(){var e;return null===(e=Ye.current)||void 0===e?void 0:e.abort()}},[or]);var ar=v(function(n,a,i){return void 0===i&&(i=!1),e(C,void 0,void 0,function(){var e,l,u,d,s,c,v,f,p;return r(this,function(r){switch(r.label){case 0:if(!$e.current.has(n)||Ze.current[n])return[2];e=new AbortController,Ze.current[n]=e,l=function(){return!$e.current.has(n)||e.signal.aborted||Ze.current[n]!==e},nr(function(e){var r,o,a,l,u,d,s,c;return t(t({},e),((r={})[n]={rows:i?[]:null!==(a=null===(o=e[n])||void 0===o?void 0:o.rows)&&void 0!==a?a:[],cursor:i||null===(l=e[n])||void 0===l?void 0:l.cursor,hasMore:!i&&(null!==(d=null===(u=e[n])||void 0===u?void 0:u.hasMore)&&void 0!==d&&d),loading:!0,loaded:!i&&(null!==(c=null===(s=e[n])||void 0===s?void 0:s.loaded)&&void 0!==c&&c)},r))}),r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,G({configId:S,baseUrl:P,accessToken:x,uiConfigId:T,applicationType:w},t({startDate:null==Fe?void 0:Fe.start,endDate:null==Fe?void 0:Fe.end,filters:Re,statsFilters:Me,selectedStatCards:Be,tableHeader:{searchTerm:fe,searchColumn:null===(v=null===(c=null==Q?void 0:Q.data)||void 0===c?void 0:c.tableHeaderBuilder)||void 0===v?void 0:v.searchColumns,sort:null!=he?he:{}},tableKey:n,pageSize:20},a&&!i?{cursor:a}:{}),e.signal)];case 2:return u=r.sent(),d=null!==(p=null===(f=u.table)||void 0===f?void 0:f[n])&&void 0!==p?p:[],l()?[2]:(nr(function(e){var r,a,l=e[n];return l?t(t({},e),((r={})[n]={rows:i?d:o(o([],l.rows,!0),d,!0),cursor:null!==(a=u.nextCursor)&&void 0!==a?a:void 0,hasMore:u.hasNext,loading:!1,loaded:!0},r)):e}),[3,5]);case 3:return"AbortError"===(null==(s=r.sent())?void 0:s.name)||l()?[2]:(nr(function(e){var r;return e[n]?t(t({},e),((r={})[n]=t(t({},e[n]),{loading:!1,hasMore:!1}),r)):e}),[3,5]);case 4:return Ze.current[n]===e&&delete Ze.current[n],[7];case 5:return[2]}})})},[S,P,Fe,Re,Me,Be,G,fe,he,Q,x,T,w]),ir=v(function(e,r){var t;if(!r)return $e.current.delete(e),null===(t=Ze.current[e])||void 0===t||t.abort(),delete Ze.current[e],void nr(function(r){var t=r,o=e;return t[o],n(t,["symbol"==typeof o?o:o+""])});$e.current.add(e),ar(e)},[ar]),lr=v(function(e){var r=rr[e];(null==r?void 0:r.hasMore)&&!r.loading&&r.cursor&&ar(e,r.cursor)},[ar,rr]),ur=v(function(n,o,a){return e(C,void 0,void 0,function(){var e,i,l,u,d,s,c,v,f,p,g,h,b,m;return r(this,function(r){switch(r.label){case 0:Ze.current[n]&&(Ze.current[n].abort(),delete Ze.current[n]),e=new AbortController,Ze.current[n]=e,nr(function(e){var r,o;return t(t({},e),((r={})[n]={rows:(null===(o=e[n])||void 0===o?void 0:o.rows)||[],cursor:void 0,hasMore:!1,loading:!0,loaded:!1},r))}),r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,G({configId:S,baseUrl:P,accessToken:x,uiConfigId:T,applicationType:w},{startDate:null==Fe?void 0:Fe.start,endDate:null==Fe?void 0:Fe.end,filters:Re,statsFilters:Me,selectedStatCards:Be,tableHeader:{searchTerm:fe,searchColumn:null===(v=null===(c=null==Q?void 0:Q.data)||void 0===c?void 0:c.tableHeaderBuilder)||void 0===v?void 0:v.searchColumns,sort:null!=he?he:{}},tableKey:n,page:o,pageSize:a},e.signal)];case 2:return i=r.sent(),l=null!==(p=null===(f=i.table)||void 0===f?void 0:f[n])&&void 0!==p?p:[],u=null!==(h=null===(g=i.pagination)||void 0===g?void 0:g.totalRecords)&&void 0!==h?h:0,d=null!==(m=null===(b=i.pagination)||void 0===b?void 0:b.totalPages)&&void 0!==m?m:0,e.signal.aborted?[2]:(Ge(function(e){var r;return t(t({},e),((r={})[n]=t(t({},e[n]),{totalRecords:u,totalPages:d}),r))}),nr(function(e){var r,o,a;return t(t({},e),((r={})[n]={rows:l,cursor:null!==(o=i.nextCursor)&&void 0!==o?o:void 0,hasMore:null!==(a=i.hasNext)&&void 0!==a&&a,loading:!1,loaded:!0},r))}),[3,5]);case 3:return"AbortError"===(null==(s=r.sent())?void 0:s.name)||e.signal.aborted?[2]:(nr(function(e){var r;return t(t({},e),((r={})[n]=t(t({},e[n]),{loading:!1,hasMore:!1}),r))}),[3,5]);case 4:return Ze.current[n]===e&&delete Ze.current[n],[7];case 5:return[2]}})})},[S,P,Fe,Re,Me,Be,G,fe,he,Q,x,T,w]);c(function(){var e;if(le&&Ne&&Q){var r=(null===(e=Q.data)||void 0===e?void 0:e.tableBuilder)||[];Ke(function(e){var r=!1,n=t({},e);return Object.keys(e).forEach(function(o){1!==e[o].currentPage&&(r=!0,n[o]=t(t({},e[o]),{currentPage:1}))}),r?n:e}),r.forEach(function(e){var r,n,t,o,a=e.key;!1!==(null===(n=null===(r=null==R?void 0:R[a])||void 0===r?void 0:r.TablePaginationProps)||void 0===n?void 0:n.enabled)?ur(a,1,(null===(t=Ue[a])||void 0===t?void 0:t.rowsPerPage)||20):$e.current.has(a)&&(null===(o=Ze.current[a])||void 0===o||o.abort(),delete Ze.current[a],ar(a,void 0,!0))})}},[le,Ne,Q,R,Fe,Re,Me,Be,fe,he,ar,ur]),c(function(){return function(){$e.current.clear(),Object.values(Ze.current).forEach(function(e){return e.abort()})}},[]);var dr=v(function(e){if((null==e?void 0:e.startDate)&&(null==e?void 0:e.endDate)){var r=e.startDate.getTime(),n=e.endDate.getTime();Je.current&&Je.current.start===r&&Je.current.end===n||(Je.current={start:r,end:n},je({start:e.startDate,end:e.endDate}))}null==H||H(e)},[H]),sr=v(function(e,r,n,t){var o=n.map(function(e){return String(e.card.id)});He(o);var a={};Object.entries(t).forEach(function(e){var r=e[0],n=e[1];Array.isArray(n)&&n.length>0?a[r]=n:"string"==typeof n&&""!==n.trim()&&(a[r]=[n])}),Oe(a)},[]),cr=re||oe&&!Z;return se?K?a(i,{children:K(se,tr)}):l("div",t({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",minHeight:"350px",padding:"32px",backgroundColor:"#fffcfc",border:"1px dashed #fca5a5",borderRadius:"12px",margin:"24px",fontFamily:"system-ui, -apple-system, sans-serif"}},{children:[a("div",t({style:{backgroundColor:"#fee2e2",padding:"16px",borderRadius:"50%",marginBottom:"20px"}},{children:a("svg",t({width:"32",height:"32",viewBox:"0 0 24 24",fill:"none",stroke:"#ef4444",strokeWidth:"2"},{children:a("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}))})),a("h3",t({style:{margin:"0 0 12px",color:"#111827",fontSize:"20px",fontWeight:"600"}},{children:"Unable to load dashboard"})),a("p",t({style:{margin:"0 0 28px",color:"#4b5563",fontSize:"15px",textAlign:"center",maxWidth:"450px",lineHeight:"1.5"}},{children:se.message})),a("button",t({onClick:tr,style:{padding:"10px 24px",backgroundColor:"#1f2937",color:"#ffffff",border:"none",borderRadius:"8px",fontSize:"15px",fontWeight:"500",cursor:"pointer",transition:"opacity 0.2s",boxShadow:"0 1px 2px 0 rgba(0, 0, 0, 0.05)"},onMouseOver:function(e){return e.currentTarget.style.opacity="0.85"},onMouseOut:function(e){return e.currentTarget.style.opacity="1"}},{children:"Try Again"}))]})):!cr&&Q&&Z?a(m,{uiConfig:Q,data:Z,dataLoading:oe,startDate:null==Fe?void 0:Fe.start,endDate:null==Fe?void 0:Fe.end,onDateChange:dr,onRefresh:function(){or()},selectedKpis:Pe,onKpiChange:function(e,r){Se(function(n){var o;return t(t({},n),((o={})[e]=r,o))})},sidebarVisible:ye,onSidebarShow:function(){return Ce(!0)},onSidebarHide:function(){return Ce(!1)},filterValues:Te,onFilterChange:function(e,r){we(function(n){var o;return t(t({},n),((o={})[e]=r,o))})},onFilterReset:function(){if(Q){var e={};Q.data.sidebarFilters.forEach(function(r){e[r.id]="multiSelect"===r.type?[]:""}),we(e)}},onFilterApply:function(){Ee(Te),Ce(!1),null==z||z(Te)},appliedFilters:Re,graphEmptyState:k,tables:R,tableLayout:E,statsConfig:t(t({},A),{onSelectionChange:function(e,r,n,t){var o;sr(e,r,n,t),null===(o=null==A?void 0:A.onSelectionChange)||void 0===o||o.call(A,e,r,n,t)}}),sectionOrder:F,hiddenSections:j,tablePages:rr,onTableExpand:ir,onTableLoadMore:lr,tablePaginationState:Ue,tablePaginationResponseState:qe,onTablePageChange:function(e,r,n){var o;Ke(function(o){var a;return t(t({},o),((a={})[e]={currentPage:r,rowsPerPage:n},a))});var a=null==R?void 0:R[e];!1!==(null===(o=null==a?void 0:a.TablePaginationProps)||void 0===o?void 0:o.enabled)&&ur(e,r,n)},searchTerm:fe,setSearchTerm:pe,selectedSort:he,setSelectedSort:be,chartPerRow:W,chartLayoutStyle:N,ChartProps:{style:{width:"460px"}},TableHeaderProps:V}):U?a(i,{children:U()}):a(p,{})}export{y as RecordDashboardWrapper,y as default};
|
|
2
2
|
//# sourceMappingURL=RecordDashboardWrapper.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__spreadArray as n}from"../../_virtual/_tslib.js";import{jsx as o,jsxs as i,Fragment as t}from"react/jsx-runtime";import{useState as l,useRef as r,useEffect as a}from"react";import{createPortal as c}from"react-dom";import{RECOCompactNumber as d}from"./index.js";var s=function(n){var i=n.textToCopy,t=l(!1),r=t[0],a=t[1];return o("button",e({onClick:function(e){e.stopPropagation(),navigator.clipboard.writeText(i),a(!0),setTimeout(function(){return a(!1)},2e3)},style:{background:"transparent",border:"none",cursor:"pointer",opacity:.8,display:"inline-flex",alignItems:"center"},title:r?"Copied!":"Copy"},{children:o("i",{className:r?"pi pi-check":"pi pi-copy",style:{fontSize:"0.8rem",color:r?"#10b981":"inherit",transition:"color 0.2s ease"}})}))},u=function(n){var t,l,r,a=n.config,c=n.row,d=n.value,u=n.children,p=a.align||"left",f="";return(null===(t=a.copyable)||void 0===t?void 0:t.enabled)&&(f=a.copyable.formatter?a.copyable.formatter(c):a.copyable.copyKey?String(c[a.copyable.copyKey]||""):String(d||"")),i("div",e({style:e({textAlign:p,width:"100%",display:"flex",justifyContent:"right"===p?"flex-end":"center"===p?"center":"flex-start",alignItems:"center",gap:"6px"},null===(l=a.styles)||void 0===l?void 0:l.root)},{children:[u,(null===(r=a.copyable)||void 0===r?void 0:r.enabled)&&o(s,{textToCopy:f})]}))},p=function(n,i,t){return void 0===n?o("i",{className:i,style:t}):"string"==typeof n?o("i",{className:n,style:t}):o("span",e({style:e({display:"inline-flex",alignItems:"center"},t)},{children:n}))},f=function(n){var l,r,a,c,d=n.config,s=n.row,p=n.columnNames,f=s[d.primaryKey||(null==p?void 0:p[0])||""]||d.fallbackText||"-",v=s[d.secondaryKey||(null==p?void 0:p[1])||""],g=Number(v);return o(u,e({config:d,row:s,value:f},{children:i("div",e({style:{display:"flex",flexDirection:"column"}},{children:[o("span",e({style:e({fontWeight:500,color:"#111827"},null===(l=d.styles)||void 0===l?void 0:l.primaryText)},{children:f})),null!=v&&o("span",e({style:e({fontSize:"12px",color:"trend_chip"===d.secondaryFormat?g<0?"#dc2626":"#059669":"#6b7280"},null===(r=d.styles)||void 0===r?void 0:r.secondaryText)},{children:"trend_chip"===d.secondaryFormat?i(t,{children:[g>0?(null===(a=d.customIcons)||void 0===a?void 0:a.trendUp)||"↑ ":g<0?(null===(c=d.customIcons)||void 0===c?void 0:c.trendDown)||"↓ ":"",Math.abs(g),"%"]}):v}))]}))}))},v=function(n){var t,l,r,a,c=n.config,d=n.row,s=n.columnNames,f=d[c.nameKey||(null==s?void 0:s[0])||""]||c.fallbackText||"-",v=d[c.emailKey||(null==s?void 0:s[1])||""],g=d[c.avatarUrlKey||(null==s?void 0:s[2])||""];return o(u,e({config:c,row:d,value:f},{children:i("div",e({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[g?o("img",{src:g,alt:f,style:e({width:32,height:32,borderRadius:"50%",objectFit:"cover"},null===(t=c.styles)||void 0===t?void 0:t.avatar)}):o("div",e({style:e({width:32,height:32,borderRadius:"50%",background:"#e2e8f0",display:"flex",alignItems:"center",justifyContent:"center",color:"#64748b"},null===(l=c.styles)||void 0===l?void 0:l.avatar)},{children:p(c.fallbackIcon,"pi pi-user",{fontSize:"1rem"})})),i("div",e({style:{display:"flex",flexDirection:"column"}},{children:[o("span",e({style:e({fontWeight:500,color:"#111827"},null===(r=c.styles)||void 0===r?void 0:r.name)},{children:f})),v&&o("span",e({style:e({fontSize:"12px",color:"#6b7280"},null===(a=c.styles)||void 0===a?void 0:a.email)},{children:v}))]}))]}))}))},g=function(n){var t,l,r,a,c=n.config,d=n.row,s=n.defaultKey,f=n.columnNames,v=c.dataKey||(null==f?void 0:f[0])||s,g=String(d[v]||""),y=(null===(t=c.colorMap)||void 0===t?void 0:t[g])||{bg:"#f3f4f6",text:"#4b5563"};return o(u,e({config:c,row:d,value:g},{children:i("span",e({style:e({background:y.bg,color:y.text,padding:"2px 10px",borderRadius:999,fontSize:12,fontWeight:500,textTransform:"capitalize",display:"inline-flex",alignItems:"center",gap:"4px"},null===(l=c.styles)||void 0===l?void 0:l.badge)},{children:[y.icon&&("string"!=typeof y.icon||y.icon.includes(" ")?p(y.icon,"",e({fontSize:"0.75rem"},null===(a=c.styles)||void 0===a?void 0:a.icon)):o("i",{className:"pi pi-".concat(y.icon),style:e({fontSize:"0.75rem"},null===(r=c.styles)||void 0===r?void 0:r.icon)})),g.replace(/_/g," ")]}))}))},y=function(n){var i,t,l,r=n.config,a=n.row,c=n.defaultKey,s=n.columnNames,p=a[r.dataKey||(null==s?void 0:s[0])||c];if(null==p)return o("span",{children:r.fallbackText||"-"});var f=Number(p),v="EUR"===r.currencyCode?"€":"GBP"===r.currencyCode?"£":"$",g=r.compact&&Number.isFinite(f)?"".concat(v).concat(d(f)):"".concat(v).concat(f.toLocaleString(void 0,{minimumFractionDigits:null!==(i=r.decimals)&&void 0!==i?i:2,maximumFractionDigits:null!==(t=r.decimals)&&void 0!==t?t:2}));return o(u,e({config:r,row:a,value:p},{children:o("span",e({style:null===(l=r.styles)||void 0===l?void 0:l.text},{children:g}))}))},m=function(n){var i,t=n.config,l=n.row,r=n.defaultKey,a=n.columnNames,c=l[t.dataKey||(null==a?void 0:a[0])||r];if(null==c)return o("span",{children:t.fallbackText||"-"});var d=Number(c),s="".concat(t.prefix||"").concat(d.toFixed(t.precision||0)).concat(t.suffix||"");return o(u,e({config:t,row:l,value:c},{children:o("span",e({style:null===(i=t.styles)||void 0===i?void 0:i.text},{children:s}))}))},h=function(n){var t,l,r,a=n.config,c=n.row,d=n.defaultKey,s=n.columnNames,p=a.dataKey||(null==s?void 0:s[0])||d,f=Number(c[p])||0,v=Math.min(100,Math.max(0,f)),g="function"==typeof a.fillColor?a.fillColor(v):a.fillColor||"#3b82f6";return o(u,e({config:a,row:c,value:v},{children:i("div",e({style:{display:"flex",alignItems:"center",gap:"8px",width:a.width||"100px"}},{children:[o("div",e({style:e({flex:1,background:a.barColor||"#e2e8f0",borderRadius:"999px",height:"8px",overflow:"hidden"},null===(t=a.styles)||void 0===t?void 0:t.track)},{children:o("div",{style:e({width:"".concat(v,"%"),background:g,height:"100%"},null===(l=a.styles)||void 0===l?void 0:l.fill)})})),a.showLabel&&i("span",e({style:e({fontSize:"12px",color:"#475569"},null===(r=a.styles)||void 0===r?void 0:r.label)},{children:[v,"%"]}))]}))}))},x=function(n){var t,l=n.config,r=n.row,a=n.columnNames,c=r[l.numeratorKey||(null==a?void 0:a[0])||""]||0,d=r[l.denominatorKey||(null==a?void 0:a[1])||""]||0;return o(u,e({config:l,row:r,value:"".concat(c,"/").concat(d)},{children:i("span",e({style:null===(t=l.styles)||void 0===t?void 0:t.text},{children:[c," / ",d]}))}))},b=function(n){var t,l,r,a=n.config,c=n.row,d=n.defaultKey,s=n.columnNames,p=a.dataKey||(null==s?void 0:s[0])||d,f=Number(c[p]);if(isNaN(f))return o("span",{children:a.fallbackText||"-"});var v=f>0,g=f<0;return o(u,e({config:a,row:c,value:f},{children:i("span",e({style:e({color:v?"#059669":g?"#dc2626":"#6b7280",fontWeight:500,display:"inline-flex",alignItems:"center",gap:"2px"},null===(t=a.styles)||void 0===t?void 0:t.text)},{children:[v?(null===(l=a.customIcons)||void 0===l?void 0:l.trendUp)||"↑ ":g?(null===(r=a.customIcons)||void 0===r?void 0:r.trendDown)||"↓ ":"",Math.abs(f),"%"]}))}))},w=function(n){var r,a,c,d,s,f,v,g=n.config,y=n.row,m=n.defaultKey,h=n.columnNames,x=l(!1),b=x[0],w=x[1],k=y[g.urlKey||(null==h?void 0:h[1])||""],C=y[g.nameKey||(null==h?void 0:h[0])||m]||k||"View Document";if(!k)return o(u,e({config:g,row:y,value:C},{children:o("span",{children:g.fallbackText||"-"})}));var N="modal"===g.previewMode||"popup"===g.previewMode;return i(u,e({config:g,row:y,value:C},{children:[i("a",e({href:N?"#":k,onClick:N?function(e){e.stopPropagation(),e.preventDefault(),w(!0)}:function(e){return e.stopPropagation()},target:N?void 0:"_blank",rel:N?void 0:"noopener noreferrer",style:e({color:"#7c3aed",textDecoration:"underline",display:"inline-flex",alignItems:"center",gap:"6px"},null===(r=g.styles)||void 0===r?void 0:r.link)},{children:[g.customIcon?p(g.customIcon,"",e({fontSize:"1rem"},null===(a=g.styles)||void 0===a?void 0:a.icon)):i(t,{children:["pdf"===g.docType&&o("i",{className:"pi pi-file-pdf",style:e({fontSize:"1rem"},null===(c=g.styles)||void 0===c?void 0:c.icon)}),"docx"===g.docType&&o("i",{className:"pi pi-file-word",style:e({fontSize:"1rem"},null===(d=g.styles)||void 0===d?void 0:d.icon)}),"image"===g.docType&&o("i",{className:"pi pi-image",style:e({fontSize:"1rem"},null===(s=g.styles)||void 0===s?void 0:s.icon)}),!g.docType&&g.iconType&&o("i",{className:"pi pi-".concat(g.iconType),style:e({fontSize:"1rem"},null===(f=g.styles)||void 0===f?void 0:f.icon)})]}),o("span",e({style:null===(v=g.styles)||void 0===v?void 0:v.text},{children:C}))]})),b&&o("div",e({style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",background:"rgba(0,0,0,0.5)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center"},onClick:function(e){e.stopPropagation(),w(!1)}},{children:i("div",e({style:{background:"white",padding:24,borderRadius:8,width:600,maxWidth:"90%",boxShadow:"0 20px 25px -5px rgba(0, 0, 0, 0.1)"},onClick:function(e){return e.stopPropagation()}},{children:[i("div",e({style:{display:"flex",justifyContent:"space-between",alignItems:"center",borderBottom:"1px solid #e2e8f0",paddingBottom:"12px",marginBottom:"16px"}},{children:[i("h3",e({style:{margin:0,color:"#1e293b",display:"flex",alignItems:"center",gap:"8px"}},{children:[g.customIcon?p(g.customIcon,"",{fontSize:"1.2rem",color:"#64748b"}):i(t,{children:["pdf"===g.docType&&o("i",{className:"pi pi-file-pdf",style:{color:"#ef4444"}}),"docx"===g.docType&&o("i",{className:"pi pi-file-word",style:{color:"#3b82f6"}}),"image"===g.docType&&o("i",{className:"pi pi-image",style:{color:"#10b981"}})]}),"Document Preview: ",C]})),o("button",e({onClick:function(){return w(!1)},style:{background:"#f1f5f9",border:"none",padding:"6px 12px",borderRadius:"4px",cursor:"pointer",fontWeight:500}},{children:"Close"}))]})),i("div",e({style:{height:300,background:"#f8fafc",border:"2px dashed #cbd5e1",borderRadius:8,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#64748b"}},{children:[o("i",{className:"pi pi-eye",style:{fontSize:"3rem",marginBottom:"12px",opacity:.5}}),o("p",e({style:{margin:0,fontWeight:500}},{children:"Secure Viewer Overlay Mockup"})),i("p",e({style:{fontSize:"12px",marginTop:"8px",maxWidth:"80%",textAlign:"center",wordBreak:"break-all"}},{children:["Loading source: ",k]}))]}))]}))}))]}))},k=function(n){var t,l=n.config,r=n.row,a=n.defaultKey,c=n.columnNames,d=r[l.dataKey||(null==c?void 0:c[0])||a];if(!Array.isArray(d)||0===d.length)return o("span",{children:l.fallbackText||"-"});var s=l.maxVisible||d.length,p=d.slice(0,s),f=d.slice(s),v=f.length;return o(u,e({config:l,row:r,value:d.join(", ")},{children:i("div",e({style:{display:"flex",gap:"4px",flexWrap:"wrap",justifyContent:"flex-start"}},{children:[p.map(function(n,i){var t,r,a=(null===(t=l.colorMapping)||void 0===t?void 0:t[n])||"#3b82f6";return o("span",e({style:e({padding:"2px 8px",borderRadius:"4px",fontSize:"12px",border:"1px solid ".concat(a),color:a},null===(r=l.styles)||void 0===r?void 0:r.tag)},{children:n}),i)}),v>0&&i("span",e({title:"Hidden tags: ".concat(f.join(", ")),style:e({cursor:"help",padding:"2px 8px",borderRadius:"4px",fontSize:"12px",background:"#f1f5f9",color:"#64748b"},null===(t=l.styles)||void 0===t?void 0:t.moreTag)},{children:["+",v," more"]}))]}))}))},C=function(n){var t,d,s,p,f,v,g,y,m,h,x,b,w,k=n.config,C=n.row,N=n.defaultKey,S=n.columnNames,K=l(!1),I=K[0],T=K[1],z=l(!1),R=z[0],A=z[1],D=l(null),j=D[0],L=D[1],M=l({opacity:0,visibility:"hidden"}),P=M[0],W=M[1],_=r(null),B=r(null),E=k.dataKey||(null==S?void 0:S[0])||N,O=String(C[E]||k.fallbackText||"-"),F=k.maxLength||50,H=k.tooltipTrigger||"click",V=null===(t=k.tooltipCloseOutside)||void 0===t||t,U=k.expandBehavior||"multiline",G=k.tooltipPosition||"auto";a(function(){if(R&&V){var e=function(e){B.current&&!B.current.contains(e.target)&&_.current&&!_.current.contains(e.target)&&A(!1)};return document.addEventListener("mousedown",e),window.addEventListener("scroll",function(){return A(!1)},!0),function(){document.removeEventListener("mousedown",e),window.removeEventListener("scroll",function(){return A(!1)},!0)}}},[R,V]),a(function(){if(R&&B.current&&j){var e=B.current.getBoundingClientRect(),n=window.innerWidth,o=window.innerHeight,i=o-j.bottom,t=j.top,l=n-j.right,r=j.left,a=G;"auto"===a&&(a=i>=e.height+8?"bottom":t>=e.height+8?"top":l>=e.width+8?"right":r>=e.width+8?"left":"bottom");var c=0,d=0;switch(a){case"top":c=j.top-e.height-8,d=j.left;break;case"bottom":default:c=j.bottom+8,d=j.left;break;case"left":c=j.top,d=j.left-e.width-8;break;case"right":c=j.top,d=j.right+8}"top"===a||"bottom"===a?(d+e.width>n-8&&(d=n-e.width-8),d<8&&(d=8)):(c+e.height>o-8&&(c=o-e.height-8),c<8&&(c=8)),W({top:c,left:d,opacity:1,visibility:"visible",transition:"opacity 0.15s ease-in-out"})}},[R,j,G]);var $=function(e){_.current&&(L(_.current.getBoundingClientRect()),W({opacity:0,visibility:"hidden"}),A(!0))};if(O.length<=F)return o(u,e({config:k,row:C,value:O},{children:o("span",e({style:e({fontSize:"inherit"},null===(d=k.styles)||void 0===d?void 0:d.text)},{children:O}))}));if("tooltip"===k.overflowBehavior)return i(u,e({config:k,row:C,value:O},{children:[o("span",e({ref:_,onClick:function(e){e.stopPropagation(),"click"===H&&$()},onMouseEnter:function(e){"hover"===H&&$()},style:e({display:"inline-block",maxWidth:k.width||"150px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",verticalAlign:"bottom",cursor:"click"===H?"pointer":"help",fontSize:"inherit"},null===(s=k.styles)||void 0===s?void 0:s.text)},{children:O})),R&&c(o("div",e({ref:B,style:e(e({position:"fixed",background:"#ffffff",border:"1px solid #e2e8f0",borderRadius:"8px",padding:"12px",boxShadow:"0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1)",zIndex:99999,maxWidth:"320px",color:"#334155",fontSize:"13px"},null===(p=k.styles)||void 0===p?void 0:p.tooltipContainer),P),onClick:function(e){return e.stopPropagation()},onMouseLeave:function(){"hover"===H&&V&&A(!1)}},{children:i("div",e({style:e({display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"12px"},null===(f=k.styles)||void 0===f?void 0:f.tooltipHeader)},{children:[o("div",e({style:e({flex:1,whiteSpace:"normal",wordBreak:"break-word",lineHeight:"1.5"},null===(v=k.styles)||void 0===v?void 0:v.tooltipContent)},{children:O})),o("button",e({onClick:function(){return A(!1)},style:e({background:"transparent",border:"none",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"4px",transition:"background 0.2s"},null===(g=k.styles)||void 0===g?void 0:g.tooltipCloseButton),onMouseEnter:function(e){return e.currentTarget.style.backgroundColor="#f1f5f9"},onMouseLeave:function(e){return e.currentTarget.style.backgroundColor="transparent"}},{children:o("i",{className:"pi pi-times",style:e({color:"#94a3b8",fontSize:"0.85rem"},null===(y=k.styles)||void 0===y?void 0:y.tooltipCloseIcon)})}))]}))})),document.body)]}));var q=I?O:"".concat(O.substring(0,F),"...");return o(u,e({config:k,row:C,value:O},{children:i("div",e({style:e({whiteSpace:I&&"multiline"===U?"normal":"nowrap",wordBreak:I&&"multiline"===U?"break-word":"normal",width:"100%",fontSize:"inherit",lineHeight:"inherit"},null===(m=k.styles)||void 0===m?void 0:m.expandedContainer)},{children:[o("span",e({style:e({fontSize:"inherit"},null===(h=k.styles)||void 0===h?void 0:h.text)},{children:q})),o("button",e({onClick:function(e){e.stopPropagation(),T(!I)},style:e({background:"none",border:"none",color:"#3b82f6",cursor:"pointer",fontSize:"12px",padding:0,fontWeight:500,marginLeft:I&&"multiline"===U?"0px":"6px",marginTop:I&&"multiline"===U?"4px":"0",display:I&&"multiline"===U?"block":"inline-block"},null===(x=k.styles)||void 0===x?void 0:x.button)},{children:I?null!==(b=k.collapseLabel)&&void 0!==b?b:"Show Less":null!==(w=k.expandLabel)&&void 0!==w?w:"Read More"}))]}))}))},N=function(n){var i,t=n.config,l=n.row,r=n.defaultKey,a=n.columnNames,c=l[t.dataKey||(null==a?void 0:a[0])||r];if(!c)return o("span",{children:t.fallbackText||"-"});var d=new Date(c);if(isNaN(d.getTime()))return o("span",{children:c});var s=d.toLocaleDateString();return"long"===t.format&&(s=d.toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"})),"datetime"===t.format&&(s=d.toLocaleString()),o(u,e({config:t,row:l,value:c},{children:o("span",e({style:null===(i=t.styles)||void 0===i?void 0:i.text},{children:s}))}))},S=function(n){var t,l,r,a=n.config,c=n.row,d=n.defaultKey,s=n.columnNames,f=c[a.urlKey||(null==s?void 0:s[1])||""],v=c[a.labelKey||(null==s?void 0:s[0])||d]||f;return o(u,f?e({config:a,row:c,value:f},{children:i("a",e({href:f,target:a.target||"_self",rel:"_blank"===a.target?"noopener noreferrer":void 0,style:e({color:"#3b82f6",textDecoration:"underline",display:"inline-flex",alignItems:"center",gap:"4px"},null===(t=a.styles)||void 0===t?void 0:t.link)},{children:[o("span",e({style:null===(l=a.styles)||void 0===l?void 0:l.text},{children:v})),a.showExternalIcon&&p(a.customIcon,"pi pi-external-link",e({fontSize:"0.75rem"},null===(r=a.styles)||void 0===r?void 0:r.icon))]}))}):e({config:a,row:c,value:v},{children:o("span",{children:a.fallbackText||"-"})}))},K=function(n){var i,t,l,r,a,c,d=n.config,s=n.row,f=n.defaultKey,v=n.columnNames,g=d.dataKey||(null==v?void 0:v[0])||f,y=Boolean(s[g]),m=function(e){d.onChange&&(e.stopPropagation(),d.onChange(s,!y))};return"switch"===d.displayStyle?o(u,e({config:d,row:s,value:y},{children:o("div",e({onClick:m,style:e({width:"36px",height:"20px",background:y?"#10b981":"#e2e8f0",borderRadius:"999px",position:"relative",cursor:d.onChange?"pointer":"default"},null===(i=d.styles)||void 0===i?void 0:i.switchTrack)},{children:o("div",{style:e({width:"16px",height:"16px",background:"white",borderRadius:"50%",position:"absolute",top:"2px",left:y?"18px":"2px",transition:"left 0.2s"},null===(t=d.styles)||void 0===t?void 0:t.switchThumb)})}))})):o(u,e({config:d,row:s,value:y},{children:o("div",e({onClick:m,style:{cursor:d.onChange?"pointer":"default"}},{children:y?p(null===(l=d.customIcons)||void 0===l?void 0:l.trueIcon,"pi pi-check",e({color:"#10b981"},null===(r=d.styles)||void 0===r?void 0:r.icon)):p(null===(a=d.customIcons)||void 0===a?void 0:a.falseIcon,"pi pi-times",e({color:"#ef4444"},null===(c=d.styles)||void 0===c?void 0:c.icon))}))}))},I=function(n){var i,t=n.config,l=n.row,r=n.defaultKey,a=n.columnNames,c=l[t.dataKey||(null==a?void 0:a[0])||r];if(!Array.isArray(c)||0===c.length)return o("span",{children:t.fallbackText||"-"});var d=Math.max.apply(Math,c);return o(u,e({config:t,row:l,value:c.join(",")},{children:o("div",e({style:e({display:"flex",alignItems:"flex-end",gap:"2px",height:"24px"},null===(i=t.styles)||void 0===i?void 0:i.container)},{children:c.map(function(n,i){var l;return o("div",{style:e({width:"6px",background:t.color||"#3b82f6",height:"".concat(n/d*100,"%"),borderRadius:"1px"},null===(l=t.styles)||void 0===l?void 0:l.bar),title:String(n)},i)})}))}))},T=function(n){var t,r=n.config,c=n.row,d=n.defaultKey,s=n.columnNames,p=l(null),f=p[0],v=p[1],g=r.dropdownOptions||[],y=r.dataKey||(null==s?void 0:s[0])||d,m=c[y];a(function(){null!=m&&v(String(m))},[m]);return o(u,e({config:r,row:c,value:f},{children:i("select",e({value:f||"",onChange:function(e){var n=e.target.value;v(n),console.log("%c[Dropdown Value Changed]","color: #f59e0b; font-weight: bold;","Selected Value: ".concat(n),"Row Data:",c),r.onDropdownChange&&r.onDropdownChange(n,c)},style:e({padding:"6px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",background:"white",color:"#334155",fontSize:"13px",cursor:"pointer",fontWeight:500,minWidth:"120px"},null===(t=r.styles)||void 0===t?void 0:t.select)},{children:[!f&&o("option",e({value:""},{children:"Select option"})),g.map(function(n){var i="string"==typeof n?n:n.value,t="string"==typeof n?n:n.label||n.value;return o("option",e({value:i},{children:t}),i)})]}))}))},z=function(n){var t,d,s,f,v,g,y,m=n.config,h=n.row,x=l(!1),b=x[0],w=x[1],k=l({}),C=k[0],N=k[1],S=r(null),K=r(null);a(function(){var e=function(e){S.current&&!S.current.contains(e.target)&&K.current&&!K.current.contains(e.target)&&w(!1)},n=function(){return w(!1)};return b&&(document.addEventListener("mousedown",e),window.addEventListener("scroll",n,!0)),function(){document.removeEventListener("mousedown",e),window.removeEventListener("scroll",n,!0)}},[b]);var I=h.__isExpanded;return o(u,e({config:m,row:h,value:""},{children:i("div",e({style:{display:"flex",alignItems:"center",gap:"6px",position:"relative"}},{children:[m.primaryAction&&i("button",e({onClick:function(e){return function(e,n){e.stopPropagation(),w(!1),console.log("%c[Primary Action Triggered]","color: #3b82f6; font-weight: bold;","ActionID: ".concat(n),"Row Data:",h),m.onPrimaryActionClick&&m.onPrimaryActionClick(n,h)}(e,m.primaryAction.actionId)},style:e({background:"#ffffff",color:"#0f172a",border:"1px solid #cbd5e1",padding:"4px 10px",borderRadius:"6px",cursor:"pointer",fontSize:"13px",fontWeight:500,display:"flex",alignItems:"center",gap:"6px",transition:"all 0.2s",boxShadow:"0 1px 2px rgba(0,0,0,0.05)"},null===(t=m.styles)||void 0===t?void 0:t.primaryButton)},{children:[m.primaryAction.icon&&p(m.primaryAction.icon,"",{fontSize:"0.8rem",color:"#64748b",marginRight:"2px"}),m.primaryAction.label]})),m.hasOverflowMenu&&m.menuOptions&&m.menuOptions.length>0&&o("button",e({ref:K,onClick:function(e){if(e.stopPropagation(),b)w(!1);else{if(K.current){var n=K.current.getBoundingClientRect();N({position:"fixed",top:n.bottom+4,right:window.innerWidth-n.right})}w(!0)}},style:e({background:b?"#f1f5f9":"transparent",border:"1px solid transparent",cursor:"pointer",color:"#64748b",padding:"4px",borderRadius:"4px",display:"flex",alignItems:"center",justifyContent:"center",transition:"background 0.2s"},null===(d=m.styles)||void 0===d?void 0:d.overflowButton)},{children:p(null===(s=m.customIcons)||void 0===s?void 0:s.overflowIcon,"pi pi-ellipsis-v",{fontSize:"0.9rem"})})),b&&m.menuOptions&&m.menuOptions.length>0&&c(o("div",e({ref:S,style:e(e(e({},C),{background:"white",border:"1px solid #e2e8f0",borderRadius:"8px",boxShadow:"0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1)",zIndex:9999,minWidth:"140px",display:"flex",flexDirection:"column",padding:"6px"}),null===(f=m.styles)||void 0===f?void 0:f.menuContainer)},{children:m.menuOptions.map(function(n){var o;return i("div",e({onClick:function(e){return function(e,n){e.stopPropagation(),w(!1),console.log("%c[Menu Option Triggered]","color: #10b981; font-weight: bold;","ActionID: ".concat(n),"Row Data:",h),m.onMenuOptionClick&&m.onMenuOptionClick(n,h)}(e,n.actionId)},style:e({padding:"8px 12px",cursor:"pointer",fontSize:"13px",color:"#334155",borderRadius:"6px",display:"flex",alignItems:"center",gap:"8px",transition:"background-color 0.2s ease"},null===(o=m.styles)||void 0===o?void 0:o.menuItem),onMouseEnter:function(e){return e.currentTarget.style.backgroundColor="#f8fafc"},onMouseLeave:function(e){return e.currentTarget.style.backgroundColor="transparent"}},{children:[n.icon&&p(n.icon,"",{fontSize:"0.85rem",color:"#64748b"}),n.label]}),n.actionId)})})),document.body),m.showExpander&&o("button",e({onClick:function(e){e.stopPropagation(),h.__toggleRow&&h.__toggleRow()},style:e({background:"transparent",border:"none",borderRadius:"4px",width:"28px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",color:I?"#7c3aed":"#64748b",transition:"all 0.2s"},null===(v=m.styles)||void 0===v?void 0:v.expanderButton)},{children:I?(null===(g=m.expanderIcons)||void 0===g?void 0:g.collapse)||o("i",{className:"pi pi-chevron-down",style:{fontSize:"1.1rem"}}):(null===(y=m.expanderIcons)||void 0===y?void 0:y.expand)||o("i",{className:"pi pi-chevron-up",style:{fontSize:"1.1rem"}})}))]}))}))};function R(n,i,t,l){var r;switch(n.renderType){case"composite":return o(f,{config:n,row:i,columnNames:l});case"userAvatar":return o(v,{config:n,row:i,columnNames:l});case"statusBadge":return o(g,{config:n,row:i,defaultKey:t,columnNames:l});case"currency":return o(y,{config:n,row:i,defaultKey:t,columnNames:l});case"number":return o(m,{config:n,row:i,defaultKey:t,columnNames:l});case"progress":return o(h,{config:n,row:i,defaultKey:t,columnNames:l});case"ratio":return o(x,{config:n,row:i,columnNames:l});case"percentage":return o(b,{config:n,row:i,defaultKey:t,columnNames:l});case"document":return o(w,{config:n,row:i,defaultKey:t,columnNames:l});case"tags":return o(k,{config:n,row:i,defaultKey:t,columnNames:l});case"longText":return o(C,{config:n,row:i,defaultKey:t,columnNames:l});case"date":return o(N,{config:n,row:i,defaultKey:t,columnNames:l});case"link":return o(S,{config:n,row:i,defaultKey:t,columnNames:l});case"boolean":return o(K,{config:n,row:i,defaultKey:t,columnNames:l});case"sparkline":return o(I,{config:n,row:i,defaultKey:t,columnNames:l});case"dropdown":return o(T,{config:n,row:i,defaultKey:t,columnNames:l});case"action":return o(z,{config:n,row:i});default:var a=i[n.dataKey||(null==l?void 0:l[0])||t];return o(u,e({config:n,row:i,value:a},{children:o("span",e({style:null===(r=n.styles)||void 0===r?void 0:r.text},{children:a||n.fallbackText||"-"}))}))}}function A(n,o){var i,t;void 0===n&&(n=[]);var l=((null!==(i=null==o?void 0:o.currentPage)&&void 0!==i?i:1)-1)*(null!==(t=null==o?void 0:o.rowsPerPage)&&void 0!==t?t:n.length)+1;return n.map(function(n,o){var i;return e({__rank:l+o,id:null!==(i=null==n?void 0:n.id)&&void 0!==i?i:String(o)},n)})}function D(){return{key:"__rank",header:o("div",e({style:{width:"100%",display:"flex",justifyContent:"flex-start",textAlign:"left"}},{children:"No"})),style:{width:56,textAlign:"left",backgroundColor:"#f8fafc",minWidth:"56px"},headerStyle:{padding:"8px 12px",textAlign:"left",backgroundColor:"#f8fafc",minWidth:"56px"},bodyStyle:{padding:"8px 12px",height:44,backgroundColor:"#ffffff"},frozen:!0,alignFrozen:"left",body:function(n){var i;return o("div",e({style:{textAlign:"left"}},{children:null!==(i=n.__rank)&&void 0!==i?i:0}))}}}function j(i,t){var l;if((null==t?void 0:t.columns)&&t.columns.length>0)return i.showRankColumn?n([D()],t.columns,!0):t.columns;var r=(null!==(l=i.columns)&&void 0!==l?l:[]).filter(function(e){var n,o=null===(n=null==t?void 0:t.cellOverrides)||void 0===n?void 0:n[e.key],i=o&&"object"==typeof o;return(!i||!o.hidden)&&!(e.hidden&&(!i||!1!==o.hidden))}).map(function(n){var i,l,r,a,c,d,s=null!==(l=null===(i=n.columnName)||void 0===i?void 0:i[0])&&void 0!==l?l:n.key,u=null===(r=null==t?void 0:t.cellOverrides)||void 0===r?void 0:r[n.key],p=u&&"object"==typeof u,f=p?u:null,v=(null==f?void 0:f.sortKey)||(null==f?void 0:f.dataKey)||n.sortKey||s,g=null!==(c=null!==(a=null==f?void 0:f.sortable)&&void 0!==a?a:n.sortingNeeded)&&void 0!==c&&c,y=(null==f?void 0:f.align)||"left",m=(null==f?void 0:f.headerAlign)||"left",h="right"===m?"flex-end":"center"===m?"center":"flex-start",x=(null==f?void 0:f.width)||"150px";return{key:n.key,header:o("div",e({style:{width:"100%",display:"flex",justifyContent:h,textAlign:m}},{children:null!==(d=n.label)&&void 0!==d?d:s})),style:{textAlign:y,minWidth:x},headerStyle:{padding:"8px 12px",textAlign:m,minWidth:x},bodyStyle:{padding:"8px 12px",height:44},frozen:null==f?void 0:f.frozen,alignFrozen:null==f?void 0:f.alignFrozen,sortable:g,field:v,body:function(i){var t;return"function"==typeof u?u(i):p?R(u,i,s,n.columnName):o("div",e({style:{textAlign:y}},{children:null!==(t=null==i?void 0:i[s])&&void 0!==t?t:""}))}}});if(null==t?void 0:t.extraColumns){var a=t.extraColumns.filter(function(e){return"start"===e.position}).map(function(e){return e.column}),c=t.extraColumns.filter(function(e){return"end"===e.position}).map(function(e){return e.column}),d=n(n(n([],a,!0),r,!0),c,!0);t.extraColumns.filter(function(e){return"object"==typeof e.position&&null!==e.position&&"afterKey"in e.position}).forEach(function(e){var n=e.position.afterKey,o=d.findIndex(function(e){return e.key===n});-1!==o?d.splice(o+1,0,e.column):d.push(e.column)}),r=d}return i.showRankColumn&&(r=n([D()],r,!0)),(null==t?void 0:t.columnTransformer)&&(r=t.columnTransformer(r)),r}export{j as RECOBuildColumns,R as RECORenderDynamicCell,A as RECOWithRowIds};
|
|
1
|
+
import{__assign as e,__spreadArray as n}from"../../_virtual/_tslib.js";import{jsx as o,jsxs as i,Fragment as t}from"react/jsx-runtime";import{useState as l,useRef as r,useEffect as a}from"react";import{createPortal as c}from"react-dom";import{RECOCompactNumber as d}from"./index.js";var u="reco-long-text-tooltip-open",s=function(n){var i=n.textToCopy,t=l(!1),r=t[0],a=t[1];return o("button",e({onClick:function(e){e.stopPropagation(),navigator.clipboard.writeText(i),a(!0),setTimeout(function(){return a(!1)},2e3)},style:{background:"transparent",border:"none",cursor:"pointer",opacity:.8,display:"inline-flex",alignItems:"center"},title:r?"Copied!":"Copy"},{children:o("i",{className:r?"pi pi-check":"pi pi-copy",style:{fontSize:"0.8rem",color:r?"#10b981":"inherit",transition:"color 0.2s ease"}})}))},p=function(n){var t,l,r,a=n.config,c=n.row,d=n.value,u=n.children,p=a.align||"left",f="";return(null===(t=a.copyable)||void 0===t?void 0:t.enabled)&&(f=a.copyable.formatter?a.copyable.formatter(c):a.copyable.copyKey?String(c[a.copyable.copyKey]||""):String(d||"")),i("div",e({style:e({textAlign:p,width:"100%",display:"flex",justifyContent:"right"===p?"flex-end":"center"===p?"center":"flex-start",alignItems:"center",gap:"6px"},null===(l=a.styles)||void 0===l?void 0:l.root)},{children:[u,(null===(r=a.copyable)||void 0===r?void 0:r.enabled)&&o(s,{textToCopy:f})]}))},f=function(n,i,t){return void 0===n?o("i",{className:i,style:t}):"string"==typeof n?o("i",{className:n,style:t}):o("span",e({style:e({display:"inline-flex",alignItems:"center"},t)},{children:n}))},v=function(n){var l,r,a,c,d=n.config,u=n.row,s=n.columnNames,f=u[d.primaryKey||(null==s?void 0:s[0])||""]||d.fallbackText||"-",v=u[d.secondaryKey||(null==s?void 0:s[1])||""],g=Number(v);return o(p,e({config:d,row:u,value:f},{children:i("div",e({style:{display:"flex",flexDirection:"column"}},{children:[o("span",e({style:e({fontWeight:500,color:"#111827"},null===(l=d.styles)||void 0===l?void 0:l.primaryText)},{children:f})),null!=v&&o("span",e({style:e({fontSize:"12px",color:"trend_chip"===d.secondaryFormat?g<0?"#dc2626":"#059669":"#6b7280"},null===(r=d.styles)||void 0===r?void 0:r.secondaryText)},{children:"trend_chip"===d.secondaryFormat?i(t,{children:[g>0?(null===(a=d.customIcons)||void 0===a?void 0:a.trendUp)||"↑ ":g<0?(null===(c=d.customIcons)||void 0===c?void 0:c.trendDown)||"↓ ":"",Math.abs(g),"%"]}):v}))]}))}))},g=function(n){var t,l,r,a,c=n.config,d=n.row,u=n.columnNames,s=d[c.nameKey||(null==u?void 0:u[0])||""]||c.fallbackText||"-",v=d[c.emailKey||(null==u?void 0:u[1])||""],g=d[c.avatarUrlKey||(null==u?void 0:u[2])||""];return o(p,e({config:c,row:d,value:s},{children:i("div",e({style:{display:"flex",alignItems:"center",gap:"8px"}},{children:[g?o("img",{src:g,alt:s,style:e({width:32,height:32,borderRadius:"50%",objectFit:"cover"},null===(t=c.styles)||void 0===t?void 0:t.avatar)}):o("div",e({style:e({width:32,height:32,borderRadius:"50%",background:"#e2e8f0",display:"flex",alignItems:"center",justifyContent:"center",color:"#64748b"},null===(l=c.styles)||void 0===l?void 0:l.avatar)},{children:f(c.fallbackIcon,"pi pi-user",{fontSize:"1rem"})})),i("div",e({style:{display:"flex",flexDirection:"column"}},{children:[o("span",e({style:e({fontWeight:500,color:"#111827"},null===(r=c.styles)||void 0===r?void 0:r.name)},{children:s})),v&&o("span",e({style:e({fontSize:"12px",color:"#6b7280"},null===(a=c.styles)||void 0===a?void 0:a.email)},{children:v}))]}))]}))}))},y=function(n){var t,l,r,a,c=n.config,d=n.row,u=n.defaultKey,s=n.columnNames,v=c.dataKey||(null==s?void 0:s[0])||u,g=String(d[v]||""),y=(null===(t=c.colorMap)||void 0===t?void 0:t[g])||{bg:"#f3f4f6",text:"#4b5563"};return o(p,e({config:c,row:d,value:g},{children:i("span",e({style:e({background:y.bg,color:y.text,padding:"2px 10px",borderRadius:999,fontSize:12,fontWeight:500,textTransform:"capitalize",display:"inline-flex",alignItems:"center",gap:"4px"},null===(l=c.styles)||void 0===l?void 0:l.badge)},{children:[y.icon&&("string"!=typeof y.icon||y.icon.includes(" ")?f(y.icon,"",e({fontSize:"0.75rem"},null===(a=c.styles)||void 0===a?void 0:a.icon)):o("i",{className:"pi pi-".concat(y.icon),style:e({fontSize:"0.75rem"},null===(r=c.styles)||void 0===r?void 0:r.icon)})),g.replace(/_/g," ")]}))}))},m=function(n){var i,t,l,r=n.config,a=n.row,c=n.defaultKey,u=n.columnNames,s=a[r.dataKey||(null==u?void 0:u[0])||c];if(null==s)return o("span",{children:r.fallbackText||"-"});var f=Number(s),v="EUR"===r.currencyCode?"€":"GBP"===r.currencyCode?"£":"$",g=r.compact&&Number.isFinite(f)?"".concat(v).concat(d(f)):"".concat(v).concat(f.toLocaleString(void 0,{minimumFractionDigits:null!==(i=r.decimals)&&void 0!==i?i:2,maximumFractionDigits:null!==(t=r.decimals)&&void 0!==t?t:2}));return o(p,e({config:r,row:a,value:s},{children:o("span",e({style:null===(l=r.styles)||void 0===l?void 0:l.text},{children:g}))}))},h=function(n){var i,t=n.config,l=n.row,r=n.defaultKey,a=n.columnNames,c=l[t.dataKey||(null==a?void 0:a[0])||r];if(null==c)return o("span",{children:t.fallbackText||"-"});var d=Number(c),u="".concat(t.prefix||"").concat(d.toFixed(t.precision||0)).concat(t.suffix||"");return o(p,e({config:t,row:l,value:c},{children:o("span",e({style:null===(i=t.styles)||void 0===i?void 0:i.text},{children:u}))}))},x=function(n){var t,l,r,a=n.config,c=n.row,d=n.defaultKey,u=n.columnNames,s=a.dataKey||(null==u?void 0:u[0])||d,f=Number(c[s])||0,v=Math.min(100,Math.max(0,f)),g="function"==typeof a.fillColor?a.fillColor(v):a.fillColor||"#3b82f6";return o(p,e({config:a,row:c,value:v},{children:i("div",e({style:{display:"flex",alignItems:"center",gap:"8px",width:a.width||"100px"}},{children:[o("div",e({style:e({flex:1,background:a.barColor||"#e2e8f0",borderRadius:"999px",height:"8px",overflow:"hidden"},null===(t=a.styles)||void 0===t?void 0:t.track)},{children:o("div",{style:e({width:"".concat(v,"%"),background:g,height:"100%"},null===(l=a.styles)||void 0===l?void 0:l.fill)})})),a.showLabel&&i("span",e({style:e({fontSize:"12px",color:"#475569"},null===(r=a.styles)||void 0===r?void 0:r.label)},{children:[v,"%"]}))]}))}))},b=function(n){var t,l=n.config,r=n.row,a=n.columnNames,c=r[l.numeratorKey||(null==a?void 0:a[0])||""]||0,d=r[l.denominatorKey||(null==a?void 0:a[1])||""]||0;return o(p,e({config:l,row:r,value:"".concat(c,"/").concat(d)},{children:i("span",e({style:null===(t=l.styles)||void 0===t?void 0:t.text},{children:[c," / ",d]}))}))},w=function(n){var t,l,r,a=n.config,c=n.row,d=n.defaultKey,u=n.columnNames,s=a.dataKey||(null==u?void 0:u[0])||d,f=Number(c[s]);if(isNaN(f))return o("span",{children:a.fallbackText||"-"});var v=f>0,g=f<0;return o(p,e({config:a,row:c,value:f},{children:i("span",e({style:e({color:v?"#059669":g?"#dc2626":"#6b7280",fontWeight:500,display:"inline-flex",alignItems:"center",gap:"2px"},null===(t=a.styles)||void 0===t?void 0:t.text)},{children:[v?(null===(l=a.customIcons)||void 0===l?void 0:l.trendUp)||"↑ ":g?(null===(r=a.customIcons)||void 0===r?void 0:r.trendDown)||"↓ ":"",Math.abs(f),"%"]}))}))},k=function(n){var r,a,c,d,u,s,v,g=n.config,y=n.row,m=n.defaultKey,h=n.columnNames,x=l(!1),b=x[0],w=x[1],k=y[g.urlKey||(null==h?void 0:h[1])||""],C=y[g.nameKey||(null==h?void 0:h[0])||m]||k||"View Document";if(!k)return o(p,e({config:g,row:y,value:C},{children:o("span",{children:g.fallbackText||"-"})}));var N="modal"===g.previewMode||"popup"===g.previewMode;return i(p,e({config:g,row:y,value:C},{children:[i("a",e({href:N?"#":k,onClick:N?function(e){e.stopPropagation(),e.preventDefault(),w(!0)}:function(e){return e.stopPropagation()},target:N?void 0:"_blank",rel:N?void 0:"noopener noreferrer",style:e({color:"#7c3aed",textDecoration:"underline",display:"inline-flex",alignItems:"center",gap:"6px"},null===(r=g.styles)||void 0===r?void 0:r.link)},{children:[g.customIcon?f(g.customIcon,"",e({fontSize:"1rem"},null===(a=g.styles)||void 0===a?void 0:a.icon)):i(t,{children:["pdf"===g.docType&&o("i",{className:"pi pi-file-pdf",style:e({fontSize:"1rem"},null===(c=g.styles)||void 0===c?void 0:c.icon)}),"docx"===g.docType&&o("i",{className:"pi pi-file-word",style:e({fontSize:"1rem"},null===(d=g.styles)||void 0===d?void 0:d.icon)}),"image"===g.docType&&o("i",{className:"pi pi-image",style:e({fontSize:"1rem"},null===(u=g.styles)||void 0===u?void 0:u.icon)}),!g.docType&&g.iconType&&o("i",{className:"pi pi-".concat(g.iconType),style:e({fontSize:"1rem"},null===(s=g.styles)||void 0===s?void 0:s.icon)})]}),o("span",e({style:null===(v=g.styles)||void 0===v?void 0:v.text},{children:C}))]})),b&&o("div",e({style:{position:"fixed",top:0,left:0,width:"100vw",height:"100vh",background:"rgba(0,0,0,0.5)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center"},onClick:function(e){e.stopPropagation(),w(!1)}},{children:i("div",e({style:{background:"white",padding:24,borderRadius:8,width:600,maxWidth:"90%",boxShadow:"0 20px 25px -5px rgba(0, 0, 0, 0.1)"},onClick:function(e){return e.stopPropagation()}},{children:[i("div",e({style:{display:"flex",justifyContent:"space-between",alignItems:"center",borderBottom:"1px solid #e2e8f0",paddingBottom:"12px",marginBottom:"16px"}},{children:[i("h3",e({style:{margin:0,color:"#1e293b",display:"flex",alignItems:"center",gap:"8px"}},{children:[g.customIcon?f(g.customIcon,"",{fontSize:"1.2rem",color:"#64748b"}):i(t,{children:["pdf"===g.docType&&o("i",{className:"pi pi-file-pdf",style:{color:"#ef4444"}}),"docx"===g.docType&&o("i",{className:"pi pi-file-word",style:{color:"#3b82f6"}}),"image"===g.docType&&o("i",{className:"pi pi-image",style:{color:"#10b981"}})]}),"Document Preview: ",C]})),o("button",e({onClick:function(){return w(!1)},style:{background:"#f1f5f9",border:"none",padding:"6px 12px",borderRadius:"4px",cursor:"pointer",fontWeight:500}},{children:"Close"}))]})),i("div",e({style:{height:300,background:"#f8fafc",border:"2px dashed #cbd5e1",borderRadius:8,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",color:"#64748b"}},{children:[o("i",{className:"pi pi-eye",style:{fontSize:"3rem",marginBottom:"12px",opacity:.5}}),o("p",e({style:{margin:0,fontWeight:500}},{children:"Secure Viewer Overlay Mockup"})),i("p",e({style:{fontSize:"12px",marginTop:"8px",maxWidth:"80%",textAlign:"center",wordBreak:"break-all"}},{children:["Loading source: ",k]}))]}))]}))}))]}))},C=function(n){var t,l=n.config,r=n.row,a=n.defaultKey,c=n.columnNames,d=r[l.dataKey||(null==c?void 0:c[0])||a];if(!Array.isArray(d)||0===d.length)return o("span",{children:l.fallbackText||"-"});var u=l.maxVisible||d.length,s=d.slice(0,u),f=d.slice(u),v=f.length;return o(p,e({config:l,row:r,value:d.join(", ")},{children:i("div",e({style:{display:"flex",gap:"4px",flexWrap:"wrap",justifyContent:"flex-start"}},{children:[s.map(function(n,i){var t,r,a=(null===(t=l.colorMapping)||void 0===t?void 0:t[n])||"#3b82f6";return o("span",e({style:e({padding:"2px 8px",borderRadius:"4px",fontSize:"12px",border:"1px solid ".concat(a),color:a},null===(r=l.styles)||void 0===r?void 0:r.tag)},{children:n}),i)}),v>0&&i("span",e({title:"Hidden tags: ".concat(f.join(", ")),style:e({cursor:"help",padding:"2px 8px",borderRadius:"4px",fontSize:"12px",background:"#f1f5f9",color:"#64748b"},null===(t=l.styles)||void 0===t?void 0:t.moreTag)},{children:["+",v," more"]}))]}))}))},N=function(n){var t,d,s,f,v,g,y,m,h,x,b,w,k,C=n.config,N=n.row,S=n.defaultKey,K=n.columnNames,I=l(!1),T=I[0],z=I[1],R=l(!1),A=R[0],L=R[1],D=l(null),M=D[0],j=D[1],P=l({opacity:0,visibility:"hidden"}),W=P[0],_=P[1],E=r(null),B=r(null),O=r({}),F=r(null),H=C.dataKey||(null==K?void 0:K[0])||S,V=String(N[H]||C.fallbackText||"-"),U=C.maxLength||50,G=C.tooltipTrigger||"click",$=null===(t=C.tooltipCloseOutside)||void 0===t||t,q=C.expandBehavior||"multiline",J=C.tooltipPosition||"auto",Q=function(){F.current&&(clearTimeout(F.current),F.current=null)},X=function(){Q(),L(!1)};a(function(){if(A&&$){var e=function(e){B.current&&!B.current.contains(e.target)&&E.current&&!E.current.contains(e.target)&&X()},n=function(){return X()},o=function(e){e.detail!==O.current&&X()};return document.addEventListener("mousedown",e),window.addEventListener("scroll",n,!0),window.addEventListener(u,o),function(){document.removeEventListener("mousedown",e),window.removeEventListener("scroll",n,!0),window.removeEventListener(u,o)}}},[A,$]),a(function(){return function(){return Q()}},[]),a(function(){if(A&&B.current&&M){var e=B.current.getBoundingClientRect(),n=window.innerWidth,o=window.innerHeight,i=o-M.bottom,t=M.top,l=n-M.right,r=M.left,a=J;"auto"===a&&(a=i>=e.height+8?"bottom":t>=e.height+8?"top":l>=e.width+8?"right":r>=e.width+8?"left":"bottom");var c=0,d=0;switch(a){case"top":c=M.top-e.height-8,d=M.left;break;case"bottom":default:c=M.bottom+8,d=M.left;break;case"left":c=M.top,d=M.left-e.width-8;break;case"right":c=M.top,d=M.right+8}"top"===a||"bottom"===a?(d+e.width>n-8&&(d=n-e.width-8),d<8&&(d=8)):(c+e.height>o-8&&(c=o-e.height-8),c<8&&(c=8)),_({top:c,left:d,opacity:1,visibility:"visible",transition:"opacity 0.15s ease-in-out"})}},[A,M,J]);var Y=function(){E.current&&(Q(),window.dispatchEvent(new CustomEvent(u,{detail:O.current})),j(E.current.getBoundingClientRect()),_({opacity:0,visibility:"hidden"}),L(!0))};if(V.length<=U)return o(p,e({config:C,row:N,value:V},{children:o("span",e({style:e({fontSize:"inherit"},null===(d=C.styles)||void 0===d?void 0:d.text)},{children:V}))}));if("tooltip"===C.overflowBehavior)return i(p,e({config:C,row:N,value:V},{children:[o("span",e({ref:E,onClick:function(e){e.stopPropagation(),"click"===G&&Y()},onMouseEnter:function(){"hover"===G&&Y()},onMouseLeave:function(){"hover"===G&&$&&(Q(),F.current=setTimeout(function(){L(!1),F.current=null},100))},style:e({display:"inline-block",maxWidth:C.width||"150px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",verticalAlign:"bottom",cursor:"click"===G?"pointer":"help",fontSize:"inherit"},null===(s=C.styles)||void 0===s?void 0:s.text)},{children:V})),A&&c(o("div",e({ref:B,style:e(e({position:"fixed",background:"#ffffff",border:"1px solid #e2e8f0",borderRadius:"8px",padding:"12px",boxShadow:"0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1)",zIndex:99999,maxWidth:"320px",color:"#334155",fontSize:"13px"},null===(f=C.styles)||void 0===f?void 0:f.tooltipContainer),W),onClick:function(e){return e.stopPropagation()},onMouseEnter:Q,onMouseLeave:function(){"hover"===G&&$&&X()}},{children:i("div",e({style:e({display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:"12px"},null===(v=C.styles)||void 0===v?void 0:v.tooltipHeader)},{children:[o("div",e({style:e({flex:1,whiteSpace:"normal",wordBreak:"break-word",lineHeight:"1.5"},null===(g=C.styles)||void 0===g?void 0:g.tooltipContent)},{children:V})),o("button",e({onClick:X,style:e({background:"transparent",border:"none",cursor:"pointer",padding:"4px",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:"4px",transition:"background 0.2s"},null===(y=C.styles)||void 0===y?void 0:y.tooltipCloseButton),onMouseEnter:function(e){return e.currentTarget.style.backgroundColor="#f1f5f9"},onMouseLeave:function(e){return e.currentTarget.style.backgroundColor="transparent"}},{children:o("i",{className:"pi pi-times",style:e({color:"#94a3b8",fontSize:"0.85rem"},null===(m=C.styles)||void 0===m?void 0:m.tooltipCloseIcon)})}))]}))})),document.body)]}));var Z=T?V:"".concat(V.substring(0,U),"...");return o(p,e({config:C,row:N,value:V},{children:i("div",e({style:e({whiteSpace:T&&"multiline"===q?"normal":"nowrap",wordBreak:T&&"multiline"===q?"break-word":"normal",width:"100%",fontSize:"inherit",lineHeight:"inherit"},null===(h=C.styles)||void 0===h?void 0:h.expandedContainer)},{children:[o("span",e({style:e({fontSize:"inherit"},null===(x=C.styles)||void 0===x?void 0:x.text)},{children:Z})),o("button",e({onClick:function(e){e.stopPropagation(),z(!T)},style:e({background:"none",border:"none",color:"#3b82f6",cursor:"pointer",fontSize:"12px",padding:0,fontWeight:500,marginLeft:T&&"multiline"===q?"0px":"6px",marginTop:T&&"multiline"===q?"4px":"0",display:T&&"multiline"===q?"block":"inline-block"},null===(b=C.styles)||void 0===b?void 0:b.button)},{children:T?null!==(w=C.collapseLabel)&&void 0!==w?w:"Show Less":null!==(k=C.expandLabel)&&void 0!==k?k:"Read More"}))]}))}))},S=function(n){var i,t=n.config,l=n.row,r=n.defaultKey,a=n.columnNames,c=l[t.dataKey||(null==a?void 0:a[0])||r];if(!c)return o("span",{children:t.fallbackText||"-"});var d=new Date(c);if(isNaN(d.getTime()))return o("span",{children:c});var u=d.toLocaleDateString();return"long"===t.format&&(u=d.toLocaleDateString(void 0,{year:"numeric",month:"long",day:"numeric"})),"datetime"===t.format&&(u=d.toLocaleString()),o(p,e({config:t,row:l,value:c},{children:o("span",e({style:null===(i=t.styles)||void 0===i?void 0:i.text},{children:u}))}))},K=function(n){var t,l,r,a=n.config,c=n.row,d=n.defaultKey,u=n.columnNames,s=c[a.urlKey||(null==u?void 0:u[1])||""],v=c[a.labelKey||(null==u?void 0:u[0])||d]||s;return o(p,s?e({config:a,row:c,value:s},{children:i("a",e({href:s,target:a.target||"_self",rel:"_blank"===a.target?"noopener noreferrer":void 0,style:e({color:"#3b82f6",textDecoration:"underline",display:"inline-flex",alignItems:"center",gap:"4px"},null===(t=a.styles)||void 0===t?void 0:t.link)},{children:[o("span",e({style:null===(l=a.styles)||void 0===l?void 0:l.text},{children:v})),a.showExternalIcon&&f(a.customIcon,"pi pi-external-link",e({fontSize:"0.75rem"},null===(r=a.styles)||void 0===r?void 0:r.icon))]}))}):e({config:a,row:c,value:v},{children:o("span",{children:a.fallbackText||"-"})}))},I=function(n){var i,t,l,r,a,c,d=n.config,u=n.row,s=n.defaultKey,v=n.columnNames,g=d.dataKey||(null==v?void 0:v[0])||s,y=Boolean(u[g]),m=function(e){d.onChange&&(e.stopPropagation(),d.onChange(u,!y))};return"switch"===d.displayStyle?o(p,e({config:d,row:u,value:y},{children:o("div",e({onClick:m,style:e({width:"36px",height:"20px",background:y?"#10b981":"#e2e8f0",borderRadius:"999px",position:"relative",cursor:d.onChange?"pointer":"default"},null===(i=d.styles)||void 0===i?void 0:i.switchTrack)},{children:o("div",{style:e({width:"16px",height:"16px",background:"white",borderRadius:"50%",position:"absolute",top:"2px",left:y?"18px":"2px",transition:"left 0.2s"},null===(t=d.styles)||void 0===t?void 0:t.switchThumb)})}))})):o(p,e({config:d,row:u,value:y},{children:o("div",e({onClick:m,style:{cursor:d.onChange?"pointer":"default"}},{children:y?f(null===(l=d.customIcons)||void 0===l?void 0:l.trueIcon,"pi pi-check",e({color:"#10b981"},null===(r=d.styles)||void 0===r?void 0:r.icon)):f(null===(a=d.customIcons)||void 0===a?void 0:a.falseIcon,"pi pi-times",e({color:"#ef4444"},null===(c=d.styles)||void 0===c?void 0:c.icon))}))}))},T=function(n){var i,t=n.config,l=n.row,r=n.defaultKey,a=n.columnNames,c=l[t.dataKey||(null==a?void 0:a[0])||r];if(!Array.isArray(c)||0===c.length)return o("span",{children:t.fallbackText||"-"});var d=Math.max.apply(Math,c);return o(p,e({config:t,row:l,value:c.join(",")},{children:o("div",e({style:e({display:"flex",alignItems:"flex-end",gap:"2px",height:"24px"},null===(i=t.styles)||void 0===i?void 0:i.container)},{children:c.map(function(n,i){var l;return o("div",{style:e({width:"6px",background:t.color||"#3b82f6",height:"".concat(n/d*100,"%"),borderRadius:"1px"},null===(l=t.styles)||void 0===l?void 0:l.bar),title:String(n)},i)})}))}))},z=function(n){var t,r=n.config,c=n.row,d=n.defaultKey,u=n.columnNames,s=l(null),f=s[0],v=s[1],g=r.dropdownOptions||[],y=r.dataKey||(null==u?void 0:u[0])||d,m=c[y];a(function(){null!=m&&v(String(m))},[m]);return o(p,e({config:r,row:c,value:f},{children:i("select",e({value:f||"",onChange:function(e){var n=e.target.value;v(n),console.log("%c[Dropdown Value Changed]","color: #f59e0b; font-weight: bold;","Selected Value: ".concat(n),"Row Data:",c),r.onDropdownChange&&r.onDropdownChange(n,c)},style:e({padding:"6px 8px",borderRadius:"4px",border:"1px solid #cbd5e1",background:"white",color:"#334155",fontSize:"13px",cursor:"pointer",fontWeight:500,minWidth:"120px"},null===(t=r.styles)||void 0===t?void 0:t.select)},{children:[!f&&o("option",e({value:""},{children:"Select option"})),g.map(function(n){var i="string"==typeof n?n:n.value,t="string"==typeof n?n:n.label||n.value;return o("option",e({value:i},{children:t}),i)})]}))}))},R=function(n){var t,d,u,s,v,g,y,m=n.config,h=n.row,x=l(!1),b=x[0],w=x[1],k=l({}),C=k[0],N=k[1],S=r(null),K=r(null);a(function(){var e=function(e){S.current&&!S.current.contains(e.target)&&K.current&&!K.current.contains(e.target)&&w(!1)},n=function(){return w(!1)};return b&&(document.addEventListener("mousedown",e),window.addEventListener("scroll",n,!0)),function(){document.removeEventListener("mousedown",e),window.removeEventListener("scroll",n,!0)}},[b]);var I=h.__isExpanded;return o(p,e({config:m,row:h,value:""},{children:i("div",e({style:{display:"flex",alignItems:"center",gap:"6px",position:"relative"}},{children:[m.primaryAction&&i("button",e({onClick:function(e){return function(e,n){e.stopPropagation(),w(!1),console.log("%c[Primary Action Triggered]","color: #3b82f6; font-weight: bold;","ActionID: ".concat(n),"Row Data:",h),m.onPrimaryActionClick&&m.onPrimaryActionClick(n,h)}(e,m.primaryAction.actionId)},style:e({background:"#ffffff",color:"#0f172a",border:"1px solid #cbd5e1",padding:"4px 10px",borderRadius:"6px",cursor:"pointer",fontSize:"13px",fontWeight:500,display:"flex",alignItems:"center",gap:"6px",transition:"all 0.2s",boxShadow:"0 1px 2px rgba(0,0,0,0.05)"},null===(t=m.styles)||void 0===t?void 0:t.primaryButton)},{children:[m.primaryAction.icon&&f(m.primaryAction.icon,"",{fontSize:"0.8rem",color:"#64748b",marginRight:"2px"}),m.primaryAction.label]})),m.hasOverflowMenu&&m.menuOptions&&m.menuOptions.length>0&&o("button",e({ref:K,onClick:function(e){if(e.stopPropagation(),b)w(!1);else{if(K.current){var n=K.current.getBoundingClientRect();N({position:"fixed",top:n.bottom+4,right:window.innerWidth-n.right})}w(!0)}},style:e({background:b?"#f1f5f9":"transparent",border:"1px solid transparent",cursor:"pointer",color:"#64748b",padding:"4px",borderRadius:"4px",display:"flex",alignItems:"center",justifyContent:"center",transition:"background 0.2s"},null===(d=m.styles)||void 0===d?void 0:d.overflowButton)},{children:f(null===(u=m.customIcons)||void 0===u?void 0:u.overflowIcon,"pi pi-ellipsis-v",{fontSize:"0.9rem"})})),b&&m.menuOptions&&m.menuOptions.length>0&&c(o("div",e({ref:S,style:e(e(e({},C),{background:"white",border:"1px solid #e2e8f0",borderRadius:"8px",boxShadow:"0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1)",zIndex:9999,minWidth:"140px",display:"flex",flexDirection:"column",padding:"6px"}),null===(s=m.styles)||void 0===s?void 0:s.menuContainer)},{children:m.menuOptions.map(function(n){var o;return i("div",e({onClick:function(e){return function(e,n){e.stopPropagation(),w(!1),console.log("%c[Menu Option Triggered]","color: #10b981; font-weight: bold;","ActionID: ".concat(n),"Row Data:",h),m.onMenuOptionClick&&m.onMenuOptionClick(n,h)}(e,n.actionId)},style:e({padding:"8px 12px",cursor:"pointer",fontSize:"13px",color:"#334155",borderRadius:"6px",display:"flex",alignItems:"center",gap:"8px",transition:"background-color 0.2s ease"},null===(o=m.styles)||void 0===o?void 0:o.menuItem),onMouseEnter:function(e){return e.currentTarget.style.backgroundColor="#f8fafc"},onMouseLeave:function(e){return e.currentTarget.style.backgroundColor="transparent"}},{children:[n.icon&&f(n.icon,"",{fontSize:"0.85rem",color:"#64748b"}),n.label]}),n.actionId)})})),document.body),m.showExpander&&o("button",e({onClick:function(e){e.stopPropagation(),h.__toggleRow&&h.__toggleRow()},style:e({background:"transparent",border:"none",borderRadius:"4px",width:"28px",height:"28px",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",color:I?"#7c3aed":"#64748b",transition:"all 0.2s"},null===(v=m.styles)||void 0===v?void 0:v.expanderButton)},{children:I?(null===(g=m.expanderIcons)||void 0===g?void 0:g.collapse)||o("i",{className:"pi pi-chevron-down",style:{fontSize:"1.1rem"}}):(null===(y=m.expanderIcons)||void 0===y?void 0:y.expand)||o("i",{className:"pi pi-chevron-up",style:{fontSize:"1.1rem"}})}))]}))}))};function A(n,i,t,l){var r;switch(n.renderType){case"composite":return o(v,{config:n,row:i,columnNames:l});case"userAvatar":return o(g,{config:n,row:i,columnNames:l});case"statusBadge":return o(y,{config:n,row:i,defaultKey:t,columnNames:l});case"currency":return o(m,{config:n,row:i,defaultKey:t,columnNames:l});case"number":return o(h,{config:n,row:i,defaultKey:t,columnNames:l});case"progress":return o(x,{config:n,row:i,defaultKey:t,columnNames:l});case"ratio":return o(b,{config:n,row:i,columnNames:l});case"percentage":return o(w,{config:n,row:i,defaultKey:t,columnNames:l});case"document":return o(k,{config:n,row:i,defaultKey:t,columnNames:l});case"tags":return o(C,{config:n,row:i,defaultKey:t,columnNames:l});case"longText":return o(N,{config:n,row:i,defaultKey:t,columnNames:l});case"date":return o(S,{config:n,row:i,defaultKey:t,columnNames:l});case"link":return o(K,{config:n,row:i,defaultKey:t,columnNames:l});case"boolean":return o(I,{config:n,row:i,defaultKey:t,columnNames:l});case"sparkline":return o(T,{config:n,row:i,defaultKey:t,columnNames:l});case"dropdown":return o(z,{config:n,row:i,defaultKey:t,columnNames:l});case"action":return o(R,{config:n,row:i});default:var a=i[n.dataKey||(null==l?void 0:l[0])||t];return o(p,e({config:n,row:i,value:a},{children:o("span",e({style:null===(r=n.styles)||void 0===r?void 0:r.text},{children:a||n.fallbackText||"-"}))}))}}function L(n,o){var i,t;void 0===n&&(n=[]);var l=((null!==(i=null==o?void 0:o.currentPage)&&void 0!==i?i:1)-1)*(null!==(t=null==o?void 0:o.rowsPerPage)&&void 0!==t?t:n.length)+1;return n.map(function(n,o){var i;return e({__rank:l+o,id:null!==(i=null==n?void 0:n.id)&&void 0!==i?i:String(o)},n)})}function D(n){var i,t,l=null===(i=null==n?void 0:n.frozen)||void 0===i||i,r=null!==(t=null==n?void 0:n.alignFrozen)&&void 0!==t?t:"left";return{key:"__rank",header:o("div",e({style:{width:"100%",display:"flex",justifyContent:"flex-start",textAlign:"left"}},{children:"No"})),style:{width:56,textAlign:"left",minWidth:"56px"},headerStyle:{padding:"8px 12px",textAlign:"left",backgroundColor:"#f8fafc",minWidth:"56px"},bodyStyle:{padding:"8px 12px",height:44},frozen:l,alignFrozen:r,body:function(n){var i;return o("div",e({style:{textAlign:"left"}},{children:null!==(i=n.__rank)&&void 0!==i?i:0}))}}}function M(i,t){var l,r,a=null===(l=null==t?void 0:t.cellOverrides)||void 0===l?void 0:l.__rank;if((null==t?void 0:t.columns)&&t.columns.length>0)return i.showRankColumn?n([D(a)],t.columns,!0):t.columns;var c=(null!==(r=i.columns)&&void 0!==r?r:[]).filter(function(e){var n,o=null===(n=null==t?void 0:t.cellOverrides)||void 0===n?void 0:n[e.key],i=o&&"object"==typeof o;return(!i||!o.hidden)&&!(e.hidden&&(!i||!1!==o.hidden))}).map(function(n){var i,l,r,a,c,d,u=null!==(l=null===(i=n.columnName)||void 0===i?void 0:i[0])&&void 0!==l?l:n.key,s=null===(r=null==t?void 0:t.cellOverrides)||void 0===r?void 0:r[n.key],p=s&&"object"==typeof s,f=p?s:null,v=(null==f?void 0:f.sortKey)||(null==f?void 0:f.dataKey)||n.sortKey||u,g=null!==(c=null!==(a=null==f?void 0:f.sortable)&&void 0!==a?a:n.sortingNeeded)&&void 0!==c&&c,y=(null==f?void 0:f.align)||"left",m=(null==f?void 0:f.headerAlign)||"left",h="right"===m?"flex-end":"center"===m?"center":"flex-start",x=(null==f?void 0:f.width)||"150px";return{key:n.key,header:o("div",e({style:{width:"100%",display:"flex",justifyContent:h,textAlign:m}},{children:null!==(d=n.label)&&void 0!==d?d:u})),style:{textAlign:y,minWidth:x},headerStyle:{padding:"8px 12px",textAlign:m,minWidth:x},bodyStyle:{padding:"8px 12px",height:44},frozen:null==f?void 0:f.frozen,alignFrozen:null==f?void 0:f.alignFrozen,sortable:g,field:v,body:function(i){var t;return"function"==typeof s?s(i):p?A(s,i,u,n.columnName):o("div",e({style:{textAlign:y}},{children:null!==(t=null==i?void 0:i[u])&&void 0!==t?t:""}))}}});if(null==t?void 0:t.extraColumns){var d=t.extraColumns.filter(function(e){return"start"===e.position}).map(function(e){return e.column}),u=t.extraColumns.filter(function(e){return"end"===e.position}).map(function(e){return e.column}),s=n(n(n([],d,!0),c,!0),u,!0);t.extraColumns.filter(function(e){return"object"==typeof e.position&&null!==e.position&&"afterKey"in e.position}).forEach(function(e){var n=e.position.afterKey,o=s.findIndex(function(e){return e.key===n});-1!==o?s.splice(o+1,0,e.column):s.push(e.column)}),c=s}return i.showRankColumn&&(c=n([D(a)],c,!0)),(null==t?void 0:t.columnTransformer)&&(c=t.columnTransformer(c)),c}export{M as RECOBuildColumns,A as RECORenderDynamicCell,L as RECOWithRowIds};
|
|
2
2
|
//# sourceMappingURL=RecordTableColumns.js.map
|