yaml-admin-front 0.0.95 → 0.0.96

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/index.cjs.js CHANGED
@@ -1535,4 +1535,4 @@ rect.legend-mouseover-inactive,
1535
1535
 
1536
1536
  .apexcharts-disable-transitions * {
1537
1537
  transition: none !important;
1538
- }`;var d=((c=e.opts.chart)===null||c===void 0?void 0:c.nonce)||e.w.config.chart.nonce;d&&u.setAttribute("nonce",d),i?o.prepend(u):e.w.config.chart.injectStyleSheet!==!1&&l.head.appendChild(u)}var f=e.create(e.w.config.series,{});if(!f)return r(e);e.mount(f).then((function(){typeof e.w.config.chart.events.mounted=="function"&&e.w.config.chart.events.mounted(e,e.w),e.events.fireEvent("mounted",[e,e.w]),r(f)})).catch((function(h){n(h)}))}else n(new Error("Element not found"))}))}},{key:"create",value:function(e,r){var n=this,a=this.w;new MB(this).initModules();var o=this.w.globals;if(o.noData=!1,o.animationEnded=!1,!ie.elementExists(this.el)||(this.responsive.checkResponsiveConfig(r),a.config.xaxis.convertedCatToNumeric&&new _p(a.config).convertCatToNumericXaxis(a.config,this.ctx),this.core.setupElements(),a.config.chart.type==="treemap"&&(a.config.grid.show=!1,a.config.yaxis[0].show=!1),o.svgWidth===0))return o.animationEnded=!0,null;var i=e;e.forEach((function(h,g){h.hidden&&(i=n.legend.legendHelpers.getSeriesAfterCollapsing({realIndex:g}))}));var l=Vr.checkComboSeries(i,a.config.chart.type);o.comboCharts=l.comboCharts,o.comboBarCount=l.comboBarCount;var u=i.every((function(h){return h.data&&h.data.length===0}));(i.length===0||u&&o.collapsedSeries.length<1)&&this.series.handleNoData(),this.events.setupEventHandlers(),this.data.parseData(i),this.theme.init(),new bd(this).setGlobalMarkerSize(),this.formatters.setLabelFormatters(),this.titleSubtitle.draw(),o.noData&&o.collapsedSeries.length!==o.series.length&&!a.config.legend.showForSingleSeries||this.legend.init(),this.series.hasAllSeriesEqualX(),o.axisCharts&&(this.core.coreCalculations(),a.config.xaxis.type!=="category"&&this.formatters.setLabelFormatters(),this.ctx.toolbar.minX=a.globals.minX,this.ctx.toolbar.maxX=a.globals.maxX),this.formatters.heatmapLabelFormatters(),new Vr(this).getLargestMarkerSize(),this.dimensions.plotCoords();var c=this.core.xySettings();this.grid.createGridMask();var d=this.core.plotChartType(i,c),f=new Fu(this);return f.bringForward(),a.config.dataLabels.background.enabled&&f.dataLabelsBackground(),this.core.shiftGraphPosition(),a.globals.dataPoints>50&&a.globals.dom.elWrap.classList.add("apexcharts-disable-transitions"),{elGraph:d,xyRatios:c,dimensions:{plot:{left:a.globals.translateX,top:a.globals.translateY,width:a.globals.gridWidth,height:a.globals.gridHeight}}}}},{key:"mount",value:function(){var e=this,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,n=this,a=n.w;return new Promise((function(o,i){if(n.el===null)return i(new Error("Not enough data to display or target element not found"));(r===null||a.globals.allSeriesCollapsed)&&n.series.handleNoData(),n.grid=new SX(n);var l,u,c=n.grid.drawGrid();if(n.annotations=new LRe(n),n.annotations.drawImageAnnos(),n.annotations.drawTextAnnos(),a.config.grid.position==="back"&&(c&&a.globals.dom.elGraphical.add(c.el),c!=null&&(l=c.elGridBorders)!==null&&l!==void 0&&l.node&&a.globals.dom.elGraphical.add(c.elGridBorders)),Array.isArray(r.elGraph))for(var d=0;d<r.elGraph.length;d++)a.globals.dom.elGraphical.add(r.elGraph[d]);else a.globals.dom.elGraphical.add(r.elGraph);a.config.grid.position==="front"&&(c&&a.globals.dom.elGraphical.add(c.el),c!=null&&(u=c.elGridBorders)!==null&&u!==void 0&&u.node&&a.globals.dom.elGraphical.add(c.elGridBorders)),a.config.xaxis.crosshairs.position==="front"&&n.crosshairs.drawXCrosshairs(),a.config.yaxis[0].crosshairs.position==="front"&&n.crosshairs.drawYCrosshairs(),a.config.chart.type!=="treemap"&&n.axes.drawAxis(a.config.chart.type,c);var f=new Tp(e.ctx,c),h=new XI(e.ctx,c);if(c!==null&&(f.xAxisLabelCorrections(c.xAxisTickWidth),h.setYAxisTextAlignments(),a.config.yaxis.map((function(v,m){a.globals.ignoreYAxisIndexes.indexOf(m)===-1&&h.yAxisTitleRotate(m,v.opposite)}))),n.annotations.drawAxesAnnotations(),!a.globals.noData){if(a.config.tooltip.enabled&&!a.globals.noData&&n.w.globals.tooltip.drawTooltip(r.xyRatios),a.globals.axisCharts&&(a.globals.isXNumeric||a.config.xaxis.convertedCatToNumeric||a.globals.isRangeBar))(a.config.chart.zoom.enabled||a.config.chart.selection&&a.config.chart.selection.enabled||a.config.chart.pan&&a.config.chart.pan.enabled)&&n.zoomPanSelection.init({xyRatios:r.xyRatios});else{var g=a.config.chart.toolbar.tools;["zoom","zoomin","zoomout","selection","pan","reset"].forEach((function(v){g[v]=!1}))}a.config.chart.toolbar.show&&!a.globals.allSeriesCollapsed&&n.toolbar.createToolbar()}a.globals.memory.methodsToExec.length>0&&a.globals.memory.methodsToExec.forEach((function(v){v.method(v.params,!1,v.context)})),a.globals.axisCharts||a.globals.noData||n.core.resizeNonAxisCharts(),o(n)}))}},{key:"destroy",value:function(){window.removeEventListener("resize",this.windowResizeHandler),(function(r,n){var a=jO.get(n);a&&(a.disconnect(),jO.delete(n))})(this.el.parentNode,this.parentResizeHandler);var e=this.w.config.chart.id;e&&Apex._chartInstances.forEach((function(r,n){r.id===ie.escapeString(e)&&Apex._chartInstances.splice(n,1)})),new LB(this.ctx).clear({isUpdating:!1})}},{key:"updateOptions",value:function(e){var r=this,n=arguments.length>1&&arguments[1]!==void 0&&arguments[1],a=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2],o=!(arguments.length>3&&arguments[3]!==void 0)||arguments[3],i=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4],l=this.w;return l.globals.selection=void 0,this.lastUpdateOptions&&JSON.stringify(this.lastUpdateOptions)===JSON.stringify(e)?this:(e.series&&(this.data.resetParsingFlags(),this.series.resetSeries(!1,!0,!1),e.series.length&&e.series[0].data&&(e.series=e.series.map((function(u,c){return r.updateHelpers._extendSeries(u,c)}))),this.updateHelpers.revertDefaultAxisMinMax()),e.xaxis&&(e=this.updateHelpers.forceXAxisUpdate(e)),e.yaxis&&(e=this.updateHelpers.forceYAxisUpdate(e)),l.globals.collapsedSeriesIndices.length>0&&this.series.clearPreviousPaths(),e.theme&&(e=this.theme.updateThemeOptions(e)),this.updateHelpers._updateOptions(e,n,a,o,i))}},{key:"updateSeries",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],n=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];return this.data.resetParsingFlags(),this.series.resetSeries(!1),this.updateHelpers.revertDefaultAxisMinMax(),this.updateHelpers._updateSeries(e,r,n)}},{key:"appendSeries",value:function(e){var r=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],n=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];this.data.resetParsingFlags();var a=this.w.config.series.slice();return a.push(e),this.series.resetSeries(!1),this.updateHelpers.revertDefaultAxisMinMax(),this.updateHelpers._updateSeries(a,r,n)}},{key:"appendData",value:function(e){var r=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],n=this;n.data.resetParsingFlags(),n.w.globals.dataChanged=!0,n.series.getPreviousPaths();for(var a=n.w.config.series.slice(),o=0;o<a.length;o++)if(e[o]!==null&&e[o]!==void 0)for(var i=0;i<e[o].data.length;i++)a[o].data.push(e[o].data[i]);return n.w.config.series=a,r&&(n.w.globals.initialSeries=ie.clone(n.w.config.series)),this.update()}},{key:"update",value:function(e){var r=this;return new Promise((function(n,a){if(r.lastUpdateOptions&&JSON.stringify(r.lastUpdateOptions)===JSON.stringify(e))return n(r);r.lastUpdateOptions=ie.clone(e),new LB(r.ctx).clear({isUpdating:!0});var o=r.create(r.w.config.series,e);if(!o)return n(r);r.mount(o).then((function(){typeof r.w.config.chart.events.updated=="function"&&r.w.config.chart.events.updated(r,r.w),r.events.fireEvent("updated",[r,r.w]),r.w.globals.isDirty=!0,n(r)})).catch((function(i){a(i)}))}))}},{key:"getSyncedCharts",value:function(){var e=this.getGroupedCharts(),r=[this];return e.length&&(r=[],e.forEach((function(n){r.push(n)}))),r}},{key:"getGroupedCharts",value:function(){var e=this;return Apex._chartInstances.filter((function(r){if(r.group)return!0})).map((function(r){return e.w.config.chart.group===r.group?r.chart:e}))}},{key:"toggleSeries",value:function(e){return this.series.toggleSeries(e)}},{key:"highlightSeriesOnLegendHover",value:function(e,r){return this.series.toggleSeriesOnHover(e,r)}},{key:"showSeries",value:function(e){this.series.showSeries(e)}},{key:"hideSeries",value:function(e){this.series.hideSeries(e)}},{key:"highlightSeries",value:function(e){this.series.highlightSeries(e)}},{key:"isSeriesHidden",value:function(e){this.series.isSeriesHidden(e)}},{key:"resetSeries",value:function(){var e=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0],r=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this.series.resetSeries(e,r)}},{key:"addEventListener",value:function(e,r){this.events.addEventListener(e,r)}},{key:"removeEventListener",value:function(e,r){this.events.removeEventListener(e,r)}},{key:"addXaxisAnnotation",value:function(e){var r=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,a=this;n&&(a=n),a.annotations.addXaxisAnnotationExternal(e,r,a)}},{key:"addYaxisAnnotation",value:function(e){var r=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,a=this;n&&(a=n),a.annotations.addYaxisAnnotationExternal(e,r,a)}},{key:"addPointAnnotation",value:function(e){var r=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,a=this;n&&(a=n),a.annotations.addPointAnnotationExternal(e,r,a)}},{key:"clearAnnotations",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,r=this;e&&(r=e),r.annotations.clearAnnotations(r)}},{key:"removeAnnotation",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,n=this;r&&(n=r),n.annotations.removeAnnotation(n,e)}},{key:"getChartArea",value:function(){return this.w.globals.dom.baseEl.querySelector(".apexcharts-inner")}},{key:"getSeriesTotalXRange",value:function(e,r){return this.coreUtils.getSeriesTotalsXRange(e,r)}},{key:"getHighestValueInSeries",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return new Q_(this.ctx).getMinYMaxY(e).highestY}},{key:"getLowestValueInSeries",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return new Q_(this.ctx).getMinYMaxY(e).lowestY}},{key:"getSeriesTotal",value:function(){return this.w.globals.seriesTotals}},{key:"toggleDataPointSelection",value:function(e,r){return this.updateHelpers.toggleDataPointSelection(e,r)}},{key:"zoomX",value:function(e,r){this.ctx.toolbar.zoomUpdateOptions(e,r)}},{key:"setLocale",value:function(e){this.localization.setCurrentLocaleValues(e)}},{key:"dataURI",value:function(e){return new Vf(this.ctx).dataURI(e)}},{key:"getSvgString",value:function(e){return new Vf(this.ctx).getSvgString(e)}},{key:"exportToCSV",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new Vf(this.ctx).exportToCSV(e)}},{key:"paper",value:function(){return this.w.globals.dom.Paper}},{key:"_parentResizeCallback",value:function(){this.w.globals.animationEnded&&this.w.config.chart.redrawOnParentResize&&this._windowResize()}},{key:"_windowResize",value:function(){var e=this;clearTimeout(this.w.globals.resizeTimer),this.w.globals.resizeTimer=window.setTimeout((function(){e.w.globals.resized=!0,e.w.globals.dataChanged=!1,e.ctx.update()}),150)}},{key:"_windowResizeHandler",value:function(){var e=this.w.config.chart.redrawOnWindowResize;typeof e=="function"&&(e=e()),e&&this._windowResize()}}],[{key:"getChartByID",value:function(e){var r=ie.escapeString(e);if(Apex._chartInstances){var n=Apex._chartInstances.filter((function(a){return a.id===r}))[0];return n&&n.chart}}},{key:"initOnLoad",value:function(){for(var e=document.querySelectorAll("[data-apexcharts]"),r=0;r<e.length;r++)new t(e[r],JSON.parse(e[r].getAttribute("data-options"))).render()}},{key:"exec",value:function(e,r){var n=this.getChartByID(e);if(n){n.w.globals.isExecCalled=!0;var a=null;if(n.publicMethods.indexOf(r)!==-1){for(var o=arguments.length,i=new Array(o>2?o-2:0),l=2;l<o;l++)i[l-2]=arguments[l];a=n[r].apply(n,i)}return a}}},{key:"merge",value:function(e,r){return ie.extend(e,r)}},{key:"getThemePalettes",value:function(){return{palette1:["#008FFB","#00E396","#FEB019","#FF4560","#775DD0"],palette2:["#3F51B5","#03A9F4","#4CAF50","#F9CE1D","#FF9800"],palette3:["#33B2DF","#546E7A","#D4526E","#13D8AA","#A5978B"],palette4:["#4ECDC4","#C7F464","#81D4FA","#FD6A6A","#546E7A"],palette5:["#2B908F","#F9A3A4","#90EE7E","#FA4443","#69D2E7"],palette6:["#449DD1","#F86624","#EA3546","#662E9B","#C5D86D"],palette7:["#D7263D","#1B998B","#2E294E","#F46036","#E2C044"],palette8:["#662E9B","#F86624","#F9C80E","#EA3546","#43BCCD"],palette9:["#5C4742","#A5978B","#8D5B4C","#5A2A27","#C4BBAF"],palette10:["#A300D6","#7D02EB","#5653FE","#2983FF","#00B1F2"]}}}]),t})();const gMe=Object.freeze(Object.defineProperty({__proto__:null,default:hMe},Symbol.toStringTag,{value:"Module"})),mMe=jX(gMe);var jB;function vMe(){return jB||(jB=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=w;var e=l(R),r=o(mMe),n=o(WH()),a=["type","width","height","series","options"];function o(C){return C&&C.__esModule?C:{default:C}}function i(C){var S,E;return typeof WeakMap!="function"?null:(S=new WeakMap,E=new WeakMap,(i=function(k){return k?E:S})(C))}function l(C,S){if(!S&&C&&C.__esModule)return C;if(C===null||f(C)!="object"&&typeof C!="function")return{default:C};if(S=i(S),S&&S.has(C))return S.get(C);var E,k,_={__proto__:null},P=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(E in C)E!=="default"&&{}.hasOwnProperty.call(C,E)&&((k=P?Object.getOwnPropertyDescriptor(C,E):null)&&(k.get||k.set)?Object.defineProperty(_,E,k):_[E]=C[E]);return _.default=C,S&&S.set(C,_),_}function u(){return(u=Object.assign?Object.assign.bind():function(C){for(var S=1;S<arguments.length;S++){var E,k=arguments[S];for(E in k)!{}.hasOwnProperty.call(k,E)||(C[E]=k[E])}return C}).apply(null,arguments)}function c(C,S){if(C==null)return{};var E,k=d(C,S);if(Object.getOwnPropertySymbols)for(var _=Object.getOwnPropertySymbols(C),P=0;P<_.length;P++)E=_[P],S.includes(E)||{}.propertyIsEnumerable.call(C,E)&&(k[E]=C[E]);return k}function d(C,S){if(C==null)return{};var E,k={};for(E in C)if({}.hasOwnProperty.call(C,E)){if(S.includes(E))continue;k[E]=C[E]}return k}function f(C){return(f=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(S){return typeof S}:function(S){return S&&typeof Symbol=="function"&&S.constructor===Symbol&&S!==Symbol.prototype?"symbol":typeof S})(C)}function h(C,S){var E,k=Object.keys(C);return Object.getOwnPropertySymbols&&(E=Object.getOwnPropertySymbols(C),S&&(E=E.filter(function(_){return Object.getOwnPropertyDescriptor(C,_).enumerable})),k.push.apply(k,E)),k}function g(C){for(var S=1;S<arguments.length;S++){var E=arguments[S]!=null?arguments[S]:{};S%2?h(Object(E),!0).forEach(function(k){v(C,k,E[k])}):Object.getOwnPropertyDescriptors?Object.defineProperties(C,Object.getOwnPropertyDescriptors(E)):h(Object(E)).forEach(function(k){Object.defineProperty(C,k,Object.getOwnPropertyDescriptor(E,k))})}return C}function v(C,S,E){return(S=m(S))in C?Object.defineProperty(C,S,{value:E,enumerable:!0,configurable:!0,writable:!0}):C[S]=E,C}function m(C){return C=y(C,"string"),f(C)=="symbol"?C:C+""}function y(C,S){if(f(C)!="object"||!C)return C;var E=C[Symbol.toPrimitive];if(E===void 0)return(S==="string"?String:Number)(C);if(E=E.call(C,S),f(E)!="object")return E;throw new TypeError("@@toPrimitive must return a primitive value.")}function b(C,S){var E=g({},C);return S.forEach(function(k){delete E[k]}),E}function x(C,S){var E=2<arguments.length&&arguments[2]!==void 0?arguments[2]:new WeakSet;if(C!==S){if(f(C)!=="object"||C===null||f(S)!=="object"||S===null)return!1;if(!E.has(C)&&!E.has(S)){E.add(C),E.add(S);var k=Object.keys(C),_=Object.keys(S);if(k.length!==_.length)return!1;for(var P=0,I=k;P<I.length;P++){var A=I[P];if(!_.includes(A)||!x(C[A],S[A],E))return!1}}}return!0}function w(z){function S(B){return B&&f(B)==="object"&&!Array.isArray(B)}var A=z.type,E=A===void 0?"line":A,A=z.width,k=A===void 0?"100%":A,A=z.height,_=A===void 0?"auto":A,P=z.series,I=z.options,A=c(z,a),T=(0,e.useRef)(null),M=(0,e.useRef)(null),L=(0,e.useRef)(),D=((0,e.useEffect)(function(){L.current=I;var B=T.current;return M.current=new r.default(B,D()),M.current.render(),function(){M.current&&typeof M.current.destroy=="function"&&M.current.destroy()}},[]),(0,e.useEffect)(function(){var B=!x(M.current.w.config.series,P),V=!x(L.current,I)||_!==M.current.opts.chart.height||k!==M.current.opts.chart.width;(B||V)&&(!B||V?M.current.updateOptions(D()):M.current.updateSeries(P)),L.current=I},[I,P,_,k]),function(){return F(I,{chart:{type:E,height:_,width:k},series:P})}),F=function(B,V){var $=g({},B);return S(B)&&S(V)&&Object.keys(V).forEach(function(H){S(V[H])&&H in B?$[H]=F(B[H],V[H]):Object.assign($,v({},H,V[H]))}),$},z=b(A,Object.keys(w.propTypes));return e.default.createElement("div",u({ref:T},z))}w.propTypes={type:n.default.string.isRequired,series:n.default.array.isRequired,options:n.default.object.isRequired,width:n.default.oneOfType([n.default.string,n.default.number]),height:n.default.oneOfType([n.default.string,n.default.number])}})(vO)),vO}var yMe=vMe();const NO=un(yMe),bMe=typeof NO=="object"?NO.default:NO,xMe=(t,e)=>({...t,chart:{...t?.chart,toolbar:{show:!0,tools:{download:!0,selection:!1,zoom:!1,zoomin:!1,zoomout:!1,pan:!1,reset:!1}},fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',animations:{enabled:!0,easing:"easeinout",speed:800,animateGradually:{enabled:!0,delay:150},dynamicAnimation:{enabled:!0,speed:350}},dropShadow:{enabled:!1}},grid:{...t?.grid,borderColor:"#f0f0f0",strokeDashArray:4,padding:{left:10,right:10}},stroke:{...t?.stroke,curve:e==="line"?"smooth":"straight",width:e==="line"?3:0},fill:{...t?.fill,type:e==="line"?"gradient":"solid",gradient:e==="line"?{shadeIntensity:.3,opacityFrom:.5,opacityTo:.1,stops:[0,90,100]}:void 0},dataLabels:{...t?.dataLabels,enabled:e==="bar",style:{fontSize:"11px",fontWeight:600,colors:["#fff"]},dropShadow:{enabled:!1}},plotOptions:{...t?.plotOptions,bar:{...t?.plotOptions?.bar,borderRadius:6,columnWidth:"60%",dataLabels:{position:"top"}}},xaxis:{...t?.xaxis,axisBorder:{show:!1},axisTicks:{show:!1},labels:{...t?.xaxis?.labels,style:{colors:"#64748b",fontSize:"12px",fontWeight:500}}},yaxis:{...t?.yaxis,labels:{...t?.yaxis?.labels,style:{colors:"#64748b",fontSize:"12px",fontWeight:500}}},legend:{...t?.legend,position:"bottom",horizontalAlign:"center",fontSize:"13px",fontWeight:500,markers:{width:10,height:10,radius:10},itemMargin:{horizontal:12,vertical:8}},tooltip:{...t?.tooltip,theme:"light",style:{fontSize:"13px"},y:{formatter:n=>n?.toLocaleString()}}}),wMe=({component:t,custom:e,...r})=>{Xi(),Cn();const[n,a]=R.useState(null),[o,i]=R.useState(!0);R.useEffect(()=>{i(!0);let u="";t.filter?.forEach(c=>{if(typeof c.value=="string"&&(c.value.includes("$lte ")||c.value.includes("$gte ")||c.value.includes("$lt ")||c.value.includes("$gt "))){const[d,f]=c.value.split(" ");u+=`${s.name}=${encodeURIComponent(d+" "+f)}&`}else if(c.value?.startsWith("$")){let d=localStorage.getItem(c.value.substring(1));d&&(u+=`${c.name}=${encodeURIComponent(d)}&`)}else u+=`${c.name}=null&`}),Ds(`/api/chart/${t.id}?${u}`).then(c=>{a(c),i(!1)}).catch(()=>{i(!1)})},[t.id]);const l=R.useMemo(()=>n?.options?xMe(n.options,t?.type):null,[n?.options,t?.type]);return o?N.jsx(Gr,{sx:{width:"100%",height:t.height||300},children:N.jsx(nA,{variant:"rectangular",width:"100%",height:"100%",sx:{borderRadius:2,bgcolor:"rgba(0,0,0,0.04)"}})}):N.jsx(Gr,{sx:{width:"100%","& .apexcharts-canvas":{margin:"0 auto"}},children:n&&t&&l&&N.jsx(bMe,{height:t.height||300,options:l,series:n.series,type:t?.type})})},SMe=({component:t,custom:e,...r})=>{const{yml:n}=Cn(),[a,o]=R.useState({});R.useEffect(()=>{const h={};t.filter&&t.filter.forEach(g=>{let v=g.value;if(v!=null)if(typeof g.value=="string"&&(g.value.includes("$lte ")||g.value.includes("$gte ")||g.value.includes("$lt ")||g.value.includes("$gt "))){const[m,y]=g.value.split(" ");h[g.name]=m+" "+y}else typeof g.value=="string"&&v.startsWith("$")&&(v=localStorage.getItem(v.substring(1))),h[g.name]=v}),o(h)},[t.filter]);const{data:i,total:l,isLoading:u,error:c}=VP(t.entity,{pagination:{page:1,perPage:t.limit||10},sort:{field:"id",order:"DESC"},filter:a},{enabled:Object.keys(a).length>0||!t.filter}),d=R.useMemo(()=>({data:i,isLoading:u,total:l,page:1,perPage:t.limit||10,sort:{field:"id",order:"DESC"},filterValues:a,setSort:()=>{},setPage:()=>{},setPerPage:()=>{},setFilters:()=>{},resource:t.entity,selectedIds:[],onSelect:()=>{},onToggleItem:()=>{},onUnselectItems:()=>{}}),[i,u,l,a,t.entity,t.limit]);if(u)return N.jsx(Gr,{sx:{width:"100%",height:t.height||300},children:N.jsx(nA,{variant:"rectangular",width:"100%",height:"100%",sx:{borderRadius:2,bgcolor:"rgba(0,0,0,0.04)"}})});if(c)return N.jsx(yt,{color:"error",children:"Error loading data"});if(!i||!n?.entity?.[t.entity])return null;const f=n.entity[t.entity];return N.jsx(hs,{value:t.entity,children:N.jsx(ZP,{value:d,children:N.jsx(Gr,{sx:{width:"100%",overflow:"auto"},children:N.jsx(Cb,{bulkActionButtons:!1,rowClick:!1,empty:N.jsx(Gr,{sx:{p:2},children:"No data"}),children:t.fields.map((h,g)=>{const v=typeof h=="string"?h:h.name,m=f.fields.find(y=>y.name===v);return m?Nu({field:m,isList:!0,crud_field:typeof h=="object"?h:{name:v}}):null})})})})})},DO=["linear-gradient(135deg, #667eea 0%, #764ba2 100%)","linear-gradient(135deg, #f093fb 0%, #f5576c 100%)","linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)","linear-gradient(135deg, #43e97b 0%, #38f9d7 100%)","linear-gradient(135deg, #fa709a 0%, #fee140 100%)","linear-gradient(135deg, #a8edea 0%, #fed6e3 100%)"],CMe=({components:t,custom:e,...r})=>{Xi(),Cn();const n=Gn();return Kn(n.breakpoints.up("md")),N.jsx(Gr,{sx:{minHeight:"100vh",padding:{xs:2,md:4}},children:N.jsx(Hm,{container:!0,spacing:3,children:t?.map((a,o)=>{console.log(`Dashboard Component [${o}] ${a.label}:`,a);const i=o%DO.length;return N.jsx(Hm,{item:!0,size:{xs:12,md:a.size||4},children:N.jsxs(ha,{elevation:0,sx:{borderRadius:4,overflow:"hidden",transition:"all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1)",background:"#ffffff",border:"1px solid",borderColor:Un(n.palette.divider,.1),position:"relative","&:hover":{transform:"translateY(-8px)",boxShadow:"0 20px 40px -12px rgba(0,0,0,0.15)",borderColor:"transparent",zIndex:1}},children:[N.jsxs(Gr,{sx:{px:3,py:2.5,display:"flex",alignItems:"center",gap:2,position:"relative",overflow:"hidden",borderBottom:`1px solid ${Un(n.palette.divider,.05)}`,"&::before":{content:'""',position:"absolute",top:0,left:0,width:"4px",height:"100%",background:DO[i]}},children:[a.icon&&N.jsx(Gr,{sx:{width:42,height:42,borderRadius:"14px",display:"flex",alignItems:"center",justifyContent:"center",background:DO[i],boxShadow:"0 8px 16px -4px rgba(0,0,0,0.2)",color:"#fff",transition:"transform 0.3s ease",".MuiPaper-root:hover &":{transform:"scale(1.1) rotate(5deg)"}},children:N.jsx(Al,{icon:a.icon,width:22,height:22,style:{color:"#fff"}})}),N.jsx(yt,{variant:"subtitle1",sx:{fontWeight:700,color:"#2c3e50",letterSpacing:"0.5px"},children:a.label})]}),N.jsxs(Zu,{sx:{p:3},children:[a.component==="table"&&N.jsx(SMe,{component:a}),a.component==="chart"&&N.jsx(wMe,{component:a})]})]})},o)})})})},OMe=({custom:t,...e})=>{Xi();const r=Cn();return N.jsx(CMe,{components:r?.front?.dashboard})},FO=async(t,e={})=>{e.headers||(e.headers=new Headers({Accept:"application/json"}));const r=localStorage.getItem("token");e.headers.set("x-access-token",r);try{return await hV(t,e)}catch(n){throw n.body&&n.body.message?(console.log("error.body.message",n.body.message),new BP(n.body.message,n.status,n.body)):n}},EMe=()=>{const{yml:t}=Cn();return N.jsx(TA,{backgroundImage:t?.front?.appearance?.login?.background})},kMe=({adminYaml:t,adminJson:e,i18nProvider:r,custom:n,theme:a,layout:o})=>{const[i,l]=R.useState(null),[u,c]=R.useState(null),d=R.useMemo(()=>({...dB,login:f=>dB.login(f).then(h=>(n?.loginSuccess&&n.loginSuccess(h.member),h))}),[n]);return R.useEffect(()=>{(async()=>{try{const h=t&&yCe.parse(t)||e;l(h);const g=h["api-host"].uri,v={};Object.entries(h.entity).map(([m,y])=>{y.fields.map(b=>{b.private&&(v[m]={...v[m],[b.name]:b.private})})}),console.log("api_host",g),h.upload?.local?(console.log("upload.local",h.upload.local.base_url),c(fB(XC(g,FO),!0,v))):h.upload?.s3?(console.log("upload.s3",h.upload.s3.base_url),c(fB(XC(g,FO),!1,v))):(console.log("upload.none"),c(XC(g,FO))),EU(g)}catch(h){console.error("YAML file load error",h)}})()},[]),N.jsx(N.Fragment,{children:u&&N.jsx($Y,{initialYml:i,custom:n,width:"1250px",children:N.jsxs(cSe,{loginPage:n?.layout?.Login||EMe,theme:{...z5,...a},dashboard:i?.front?.dashboard?OMe:void 0,layout:o||nke,authProvider:d,i18nProvider:r,dataProvider:u,children:[i?.entity&&Object.keys(i.entity).map(f=>{const h=i.entity[f];return h.custom?N.jsx(Em,{name:f,options:{label:h.label},icon:IconComponent},f):N.jsx(Em,{name:f,options:{label:h.label},icon:N.jsx(Al,{icon:h?.icon,width:"1.25rem",height:"1.25rem"}),list:(g=>N.jsx(VIe,{...g,custom:n})),create:(g=>N.jsx(qIe,{...g,custom:n})),edit:(g=>N.jsx(XIe,{...g,custom:n})),show:(g=>N.jsx(QIe,{...g,custom:n}))},f)}),N.jsx(xH,{children:n?.customRoutes?.map(f=>(console.log("customRoutes",f.path),N.jsx(mn,{path:f.path,element:f.element},f.path)))})]})})})};exports.AdminContext=GA;exports.AdminProvider=$Y;exports.AppBar=fA;exports.EntityTreeView=B6;exports.Layout=mA;exports.Login=TA;exports.LoginForm=E3;exports.Logout=uA;exports.Menu=rd;exports.UserMenu=yb;exports.YMLAdmin=kMe;exports.defaultTheme=z5;exports.fetcher=Ds;exports.postFetcher=Xv;exports.uploadFile=kU;exports.uploadFileSecure=_U;exports.useAdminContext=Cn;exports.useRedirect=Hs;exports.useSidebarState=rl;exports.useTranslate=Xe;
1538
+ }`;var d=((c=e.opts.chart)===null||c===void 0?void 0:c.nonce)||e.w.config.chart.nonce;d&&u.setAttribute("nonce",d),i?o.prepend(u):e.w.config.chart.injectStyleSheet!==!1&&l.head.appendChild(u)}var f=e.create(e.w.config.series,{});if(!f)return r(e);e.mount(f).then((function(){typeof e.w.config.chart.events.mounted=="function"&&e.w.config.chart.events.mounted(e,e.w),e.events.fireEvent("mounted",[e,e.w]),r(f)})).catch((function(h){n(h)}))}else n(new Error("Element not found"))}))}},{key:"create",value:function(e,r){var n=this,a=this.w;new MB(this).initModules();var o=this.w.globals;if(o.noData=!1,o.animationEnded=!1,!ie.elementExists(this.el)||(this.responsive.checkResponsiveConfig(r),a.config.xaxis.convertedCatToNumeric&&new _p(a.config).convertCatToNumericXaxis(a.config,this.ctx),this.core.setupElements(),a.config.chart.type==="treemap"&&(a.config.grid.show=!1,a.config.yaxis[0].show=!1),o.svgWidth===0))return o.animationEnded=!0,null;var i=e;e.forEach((function(h,g){h.hidden&&(i=n.legend.legendHelpers.getSeriesAfterCollapsing({realIndex:g}))}));var l=Vr.checkComboSeries(i,a.config.chart.type);o.comboCharts=l.comboCharts,o.comboBarCount=l.comboBarCount;var u=i.every((function(h){return h.data&&h.data.length===0}));(i.length===0||u&&o.collapsedSeries.length<1)&&this.series.handleNoData(),this.events.setupEventHandlers(),this.data.parseData(i),this.theme.init(),new bd(this).setGlobalMarkerSize(),this.formatters.setLabelFormatters(),this.titleSubtitle.draw(),o.noData&&o.collapsedSeries.length!==o.series.length&&!a.config.legend.showForSingleSeries||this.legend.init(),this.series.hasAllSeriesEqualX(),o.axisCharts&&(this.core.coreCalculations(),a.config.xaxis.type!=="category"&&this.formatters.setLabelFormatters(),this.ctx.toolbar.minX=a.globals.minX,this.ctx.toolbar.maxX=a.globals.maxX),this.formatters.heatmapLabelFormatters(),new Vr(this).getLargestMarkerSize(),this.dimensions.plotCoords();var c=this.core.xySettings();this.grid.createGridMask();var d=this.core.plotChartType(i,c),f=new Fu(this);return f.bringForward(),a.config.dataLabels.background.enabled&&f.dataLabelsBackground(),this.core.shiftGraphPosition(),a.globals.dataPoints>50&&a.globals.dom.elWrap.classList.add("apexcharts-disable-transitions"),{elGraph:d,xyRatios:c,dimensions:{plot:{left:a.globals.translateX,top:a.globals.translateY,width:a.globals.gridWidth,height:a.globals.gridHeight}}}}},{key:"mount",value:function(){var e=this,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,n=this,a=n.w;return new Promise((function(o,i){if(n.el===null)return i(new Error("Not enough data to display or target element not found"));(r===null||a.globals.allSeriesCollapsed)&&n.series.handleNoData(),n.grid=new SX(n);var l,u,c=n.grid.drawGrid();if(n.annotations=new LRe(n),n.annotations.drawImageAnnos(),n.annotations.drawTextAnnos(),a.config.grid.position==="back"&&(c&&a.globals.dom.elGraphical.add(c.el),c!=null&&(l=c.elGridBorders)!==null&&l!==void 0&&l.node&&a.globals.dom.elGraphical.add(c.elGridBorders)),Array.isArray(r.elGraph))for(var d=0;d<r.elGraph.length;d++)a.globals.dom.elGraphical.add(r.elGraph[d]);else a.globals.dom.elGraphical.add(r.elGraph);a.config.grid.position==="front"&&(c&&a.globals.dom.elGraphical.add(c.el),c!=null&&(u=c.elGridBorders)!==null&&u!==void 0&&u.node&&a.globals.dom.elGraphical.add(c.elGridBorders)),a.config.xaxis.crosshairs.position==="front"&&n.crosshairs.drawXCrosshairs(),a.config.yaxis[0].crosshairs.position==="front"&&n.crosshairs.drawYCrosshairs(),a.config.chart.type!=="treemap"&&n.axes.drawAxis(a.config.chart.type,c);var f=new Tp(e.ctx,c),h=new XI(e.ctx,c);if(c!==null&&(f.xAxisLabelCorrections(c.xAxisTickWidth),h.setYAxisTextAlignments(),a.config.yaxis.map((function(v,m){a.globals.ignoreYAxisIndexes.indexOf(m)===-1&&h.yAxisTitleRotate(m,v.opposite)}))),n.annotations.drawAxesAnnotations(),!a.globals.noData){if(a.config.tooltip.enabled&&!a.globals.noData&&n.w.globals.tooltip.drawTooltip(r.xyRatios),a.globals.axisCharts&&(a.globals.isXNumeric||a.config.xaxis.convertedCatToNumeric||a.globals.isRangeBar))(a.config.chart.zoom.enabled||a.config.chart.selection&&a.config.chart.selection.enabled||a.config.chart.pan&&a.config.chart.pan.enabled)&&n.zoomPanSelection.init({xyRatios:r.xyRatios});else{var g=a.config.chart.toolbar.tools;["zoom","zoomin","zoomout","selection","pan","reset"].forEach((function(v){g[v]=!1}))}a.config.chart.toolbar.show&&!a.globals.allSeriesCollapsed&&n.toolbar.createToolbar()}a.globals.memory.methodsToExec.length>0&&a.globals.memory.methodsToExec.forEach((function(v){v.method(v.params,!1,v.context)})),a.globals.axisCharts||a.globals.noData||n.core.resizeNonAxisCharts(),o(n)}))}},{key:"destroy",value:function(){window.removeEventListener("resize",this.windowResizeHandler),(function(r,n){var a=jO.get(n);a&&(a.disconnect(),jO.delete(n))})(this.el.parentNode,this.parentResizeHandler);var e=this.w.config.chart.id;e&&Apex._chartInstances.forEach((function(r,n){r.id===ie.escapeString(e)&&Apex._chartInstances.splice(n,1)})),new LB(this.ctx).clear({isUpdating:!1})}},{key:"updateOptions",value:function(e){var r=this,n=arguments.length>1&&arguments[1]!==void 0&&arguments[1],a=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2],o=!(arguments.length>3&&arguments[3]!==void 0)||arguments[3],i=!(arguments.length>4&&arguments[4]!==void 0)||arguments[4],l=this.w;return l.globals.selection=void 0,this.lastUpdateOptions&&JSON.stringify(this.lastUpdateOptions)===JSON.stringify(e)?this:(e.series&&(this.data.resetParsingFlags(),this.series.resetSeries(!1,!0,!1),e.series.length&&e.series[0].data&&(e.series=e.series.map((function(u,c){return r.updateHelpers._extendSeries(u,c)}))),this.updateHelpers.revertDefaultAxisMinMax()),e.xaxis&&(e=this.updateHelpers.forceXAxisUpdate(e)),e.yaxis&&(e=this.updateHelpers.forceYAxisUpdate(e)),l.globals.collapsedSeriesIndices.length>0&&this.series.clearPreviousPaths(),e.theme&&(e=this.theme.updateThemeOptions(e)),this.updateHelpers._updateOptions(e,n,a,o,i))}},{key:"updateSeries",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],n=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];return this.data.resetParsingFlags(),this.series.resetSeries(!1),this.updateHelpers.revertDefaultAxisMinMax(),this.updateHelpers._updateSeries(e,r,n)}},{key:"appendSeries",value:function(e){var r=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],n=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];this.data.resetParsingFlags();var a=this.w.config.series.slice();return a.push(e),this.series.resetSeries(!1),this.updateHelpers.revertDefaultAxisMinMax(),this.updateHelpers._updateSeries(a,r,n)}},{key:"appendData",value:function(e){var r=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],n=this;n.data.resetParsingFlags(),n.w.globals.dataChanged=!0,n.series.getPreviousPaths();for(var a=n.w.config.series.slice(),o=0;o<a.length;o++)if(e[o]!==null&&e[o]!==void 0)for(var i=0;i<e[o].data.length;i++)a[o].data.push(e[o].data[i]);return n.w.config.series=a,r&&(n.w.globals.initialSeries=ie.clone(n.w.config.series)),this.update()}},{key:"update",value:function(e){var r=this;return new Promise((function(n,a){if(r.lastUpdateOptions&&JSON.stringify(r.lastUpdateOptions)===JSON.stringify(e))return n(r);r.lastUpdateOptions=ie.clone(e),new LB(r.ctx).clear({isUpdating:!0});var o=r.create(r.w.config.series,e);if(!o)return n(r);r.mount(o).then((function(){typeof r.w.config.chart.events.updated=="function"&&r.w.config.chart.events.updated(r,r.w),r.events.fireEvent("updated",[r,r.w]),r.w.globals.isDirty=!0,n(r)})).catch((function(i){a(i)}))}))}},{key:"getSyncedCharts",value:function(){var e=this.getGroupedCharts(),r=[this];return e.length&&(r=[],e.forEach((function(n){r.push(n)}))),r}},{key:"getGroupedCharts",value:function(){var e=this;return Apex._chartInstances.filter((function(r){if(r.group)return!0})).map((function(r){return e.w.config.chart.group===r.group?r.chart:e}))}},{key:"toggleSeries",value:function(e){return this.series.toggleSeries(e)}},{key:"highlightSeriesOnLegendHover",value:function(e,r){return this.series.toggleSeriesOnHover(e,r)}},{key:"showSeries",value:function(e){this.series.showSeries(e)}},{key:"hideSeries",value:function(e){this.series.hideSeries(e)}},{key:"highlightSeries",value:function(e){this.series.highlightSeries(e)}},{key:"isSeriesHidden",value:function(e){this.series.isSeriesHidden(e)}},{key:"resetSeries",value:function(){var e=!(arguments.length>0&&arguments[0]!==void 0)||arguments[0],r=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this.series.resetSeries(e,r)}},{key:"addEventListener",value:function(e,r){this.events.addEventListener(e,r)}},{key:"removeEventListener",value:function(e,r){this.events.removeEventListener(e,r)}},{key:"addXaxisAnnotation",value:function(e){var r=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,a=this;n&&(a=n),a.annotations.addXaxisAnnotationExternal(e,r,a)}},{key:"addYaxisAnnotation",value:function(e){var r=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,a=this;n&&(a=n),a.annotations.addYaxisAnnotationExternal(e,r,a)}},{key:"addPointAnnotation",value:function(e){var r=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,a=this;n&&(a=n),a.annotations.addPointAnnotationExternal(e,r,a)}},{key:"clearAnnotations",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,r=this;e&&(r=e),r.annotations.clearAnnotations(r)}},{key:"removeAnnotation",value:function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,n=this;r&&(n=r),n.annotations.removeAnnotation(n,e)}},{key:"getChartArea",value:function(){return this.w.globals.dom.baseEl.querySelector(".apexcharts-inner")}},{key:"getSeriesTotalXRange",value:function(e,r){return this.coreUtils.getSeriesTotalsXRange(e,r)}},{key:"getHighestValueInSeries",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return new Q_(this.ctx).getMinYMaxY(e).highestY}},{key:"getLowestValueInSeries",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return new Q_(this.ctx).getMinYMaxY(e).lowestY}},{key:"getSeriesTotal",value:function(){return this.w.globals.seriesTotals}},{key:"toggleDataPointSelection",value:function(e,r){return this.updateHelpers.toggleDataPointSelection(e,r)}},{key:"zoomX",value:function(e,r){this.ctx.toolbar.zoomUpdateOptions(e,r)}},{key:"setLocale",value:function(e){this.localization.setCurrentLocaleValues(e)}},{key:"dataURI",value:function(e){return new Vf(this.ctx).dataURI(e)}},{key:"getSvgString",value:function(e){return new Vf(this.ctx).getSvgString(e)}},{key:"exportToCSV",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new Vf(this.ctx).exportToCSV(e)}},{key:"paper",value:function(){return this.w.globals.dom.Paper}},{key:"_parentResizeCallback",value:function(){this.w.globals.animationEnded&&this.w.config.chart.redrawOnParentResize&&this._windowResize()}},{key:"_windowResize",value:function(){var e=this;clearTimeout(this.w.globals.resizeTimer),this.w.globals.resizeTimer=window.setTimeout((function(){e.w.globals.resized=!0,e.w.globals.dataChanged=!1,e.ctx.update()}),150)}},{key:"_windowResizeHandler",value:function(){var e=this.w.config.chart.redrawOnWindowResize;typeof e=="function"&&(e=e()),e&&this._windowResize()}}],[{key:"getChartByID",value:function(e){var r=ie.escapeString(e);if(Apex._chartInstances){var n=Apex._chartInstances.filter((function(a){return a.id===r}))[0];return n&&n.chart}}},{key:"initOnLoad",value:function(){for(var e=document.querySelectorAll("[data-apexcharts]"),r=0;r<e.length;r++)new t(e[r],JSON.parse(e[r].getAttribute("data-options"))).render()}},{key:"exec",value:function(e,r){var n=this.getChartByID(e);if(n){n.w.globals.isExecCalled=!0;var a=null;if(n.publicMethods.indexOf(r)!==-1){for(var o=arguments.length,i=new Array(o>2?o-2:0),l=2;l<o;l++)i[l-2]=arguments[l];a=n[r].apply(n,i)}return a}}},{key:"merge",value:function(e,r){return ie.extend(e,r)}},{key:"getThemePalettes",value:function(){return{palette1:["#008FFB","#00E396","#FEB019","#FF4560","#775DD0"],palette2:["#3F51B5","#03A9F4","#4CAF50","#F9CE1D","#FF9800"],palette3:["#33B2DF","#546E7A","#D4526E","#13D8AA","#A5978B"],palette4:["#4ECDC4","#C7F464","#81D4FA","#FD6A6A","#546E7A"],palette5:["#2B908F","#F9A3A4","#90EE7E","#FA4443","#69D2E7"],palette6:["#449DD1","#F86624","#EA3546","#662E9B","#C5D86D"],palette7:["#D7263D","#1B998B","#2E294E","#F46036","#E2C044"],palette8:["#662E9B","#F86624","#F9C80E","#EA3546","#43BCCD"],palette9:["#5C4742","#A5978B","#8D5B4C","#5A2A27","#C4BBAF"],palette10:["#A300D6","#7D02EB","#5653FE","#2983FF","#00B1F2"]}}}]),t})();const gMe=Object.freeze(Object.defineProperty({__proto__:null,default:hMe},Symbol.toStringTag,{value:"Module"})),mMe=jX(gMe);var jB;function vMe(){return jB||(jB=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=w;var e=l(R),r=o(mMe),n=o(WH()),a=["type","width","height","series","options"];function o(C){return C&&C.__esModule?C:{default:C}}function i(C){var S,E;return typeof WeakMap!="function"?null:(S=new WeakMap,E=new WeakMap,(i=function(k){return k?E:S})(C))}function l(C,S){if(!S&&C&&C.__esModule)return C;if(C===null||f(C)!="object"&&typeof C!="function")return{default:C};if(S=i(S),S&&S.has(C))return S.get(C);var E,k,_={__proto__:null},P=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(E in C)E!=="default"&&{}.hasOwnProperty.call(C,E)&&((k=P?Object.getOwnPropertyDescriptor(C,E):null)&&(k.get||k.set)?Object.defineProperty(_,E,k):_[E]=C[E]);return _.default=C,S&&S.set(C,_),_}function u(){return(u=Object.assign?Object.assign.bind():function(C){for(var S=1;S<arguments.length;S++){var E,k=arguments[S];for(E in k)!{}.hasOwnProperty.call(k,E)||(C[E]=k[E])}return C}).apply(null,arguments)}function c(C,S){if(C==null)return{};var E,k=d(C,S);if(Object.getOwnPropertySymbols)for(var _=Object.getOwnPropertySymbols(C),P=0;P<_.length;P++)E=_[P],S.includes(E)||{}.propertyIsEnumerable.call(C,E)&&(k[E]=C[E]);return k}function d(C,S){if(C==null)return{};var E,k={};for(E in C)if({}.hasOwnProperty.call(C,E)){if(S.includes(E))continue;k[E]=C[E]}return k}function f(C){return(f=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(S){return typeof S}:function(S){return S&&typeof Symbol=="function"&&S.constructor===Symbol&&S!==Symbol.prototype?"symbol":typeof S})(C)}function h(C,S){var E,k=Object.keys(C);return Object.getOwnPropertySymbols&&(E=Object.getOwnPropertySymbols(C),S&&(E=E.filter(function(_){return Object.getOwnPropertyDescriptor(C,_).enumerable})),k.push.apply(k,E)),k}function g(C){for(var S=1;S<arguments.length;S++){var E=arguments[S]!=null?arguments[S]:{};S%2?h(Object(E),!0).forEach(function(k){v(C,k,E[k])}):Object.getOwnPropertyDescriptors?Object.defineProperties(C,Object.getOwnPropertyDescriptors(E)):h(Object(E)).forEach(function(k){Object.defineProperty(C,k,Object.getOwnPropertyDescriptor(E,k))})}return C}function v(C,S,E){return(S=m(S))in C?Object.defineProperty(C,S,{value:E,enumerable:!0,configurable:!0,writable:!0}):C[S]=E,C}function m(C){return C=y(C,"string"),f(C)=="symbol"?C:C+""}function y(C,S){if(f(C)!="object"||!C)return C;var E=C[Symbol.toPrimitive];if(E===void 0)return(S==="string"?String:Number)(C);if(E=E.call(C,S),f(E)!="object")return E;throw new TypeError("@@toPrimitive must return a primitive value.")}function b(C,S){var E=g({},C);return S.forEach(function(k){delete E[k]}),E}function x(C,S){var E=2<arguments.length&&arguments[2]!==void 0?arguments[2]:new WeakSet;if(C!==S){if(f(C)!=="object"||C===null||f(S)!=="object"||S===null)return!1;if(!E.has(C)&&!E.has(S)){E.add(C),E.add(S);var k=Object.keys(C),_=Object.keys(S);if(k.length!==_.length)return!1;for(var P=0,I=k;P<I.length;P++){var A=I[P];if(!_.includes(A)||!x(C[A],S[A],E))return!1}}}return!0}function w(z){function S(B){return B&&f(B)==="object"&&!Array.isArray(B)}var A=z.type,E=A===void 0?"line":A,A=z.width,k=A===void 0?"100%":A,A=z.height,_=A===void 0?"auto":A,P=z.series,I=z.options,A=c(z,a),T=(0,e.useRef)(null),M=(0,e.useRef)(null),L=(0,e.useRef)(),D=((0,e.useEffect)(function(){L.current=I;var B=T.current;return M.current=new r.default(B,D()),M.current.render(),function(){M.current&&typeof M.current.destroy=="function"&&M.current.destroy()}},[]),(0,e.useEffect)(function(){var B=!x(M.current.w.config.series,P),V=!x(L.current,I)||_!==M.current.opts.chart.height||k!==M.current.opts.chart.width;(B||V)&&(!B||V?M.current.updateOptions(D()):M.current.updateSeries(P)),L.current=I},[I,P,_,k]),function(){return F(I,{chart:{type:E,height:_,width:k},series:P})}),F=function(B,V){var $=g({},B);return S(B)&&S(V)&&Object.keys(V).forEach(function(H){S(V[H])&&H in B?$[H]=F(B[H],V[H]):Object.assign($,v({},H,V[H]))}),$},z=b(A,Object.keys(w.propTypes));return e.default.createElement("div",u({ref:T},z))}w.propTypes={type:n.default.string.isRequired,series:n.default.array.isRequired,options:n.default.object.isRequired,width:n.default.oneOfType([n.default.string,n.default.number]),height:n.default.oneOfType([n.default.string,n.default.number])}})(vO)),vO}var yMe=vMe();const NO=un(yMe),bMe=typeof NO=="object"?NO.default:NO,xMe=(t,e,r)=>({...t,chart:{...t?.chart,toolbar:{show:!0,tools:{download:!0,selection:!1,zoom:!1,zoomin:!1,zoomout:!1,pan:!1,reset:!1}},fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',animations:{enabled:!0,easing:"easeinout",speed:800,animateGradually:{enabled:!0,delay:150},dynamicAnimation:{enabled:!0,speed:350}},dropShadow:{enabled:!1}},grid:{...t?.grid,borderColor:"#f0f0f0",strokeDashArray:4,padding:{left:10,right:10}},stroke:{...t?.stroke,curve:e==="line"?"smooth":"straight",width:e==="line"?3:0},fill:{...t?.fill,type:e==="line"?"gradient":"solid",gradient:e==="line"?{shadeIntensity:.3,opacityFrom:.5,opacityTo:.5,stops:[0,90,100]}:void 0},dataLabels:{...t?.dataLabels,enabled:e==="bar",style:{fontSize:"11px",fontWeight:600,colors:["#fff"]},dropShadow:{enabled:!1}},plotOptions:{...t?.plotOptions,bar:{...t?.plotOptions?.bar,borderRadius:6,columnWidth:"60%",dataLabels:{position:"top"}}},xaxis:{...t?.xaxis,axisBorder:{show:!1},axisTicks:{show:!1},labels:{...t?.xaxis?.labels,style:{colors:"#64748b",fontSize:"12px",fontWeight:500}}},yaxis:{...t?.yaxis,max:r?.max,forceNiceScale:r?.type==="integer",decimalsInFloat:r?.type==="integer"?0:void 0,labels:{...t?.yaxis?.labels,formatter:a=>{if(r?.value_text)for(const o of r.value_text)try{if(new Function("value",`return ${o.if}`)(a))return o.text}catch(i){console.warn("Failed to evaluate value_text condition:",o.if,i)}return r?.type==="integer"?Math.floor(a).toString():a},style:{colors:"#64748b",fontSize:"12px",fontWeight:500}}},legend:{...t?.legend,position:"bottom",horizontalAlign:"center",fontSize:"13px",fontWeight:500,markers:{width:10,height:10,radius:10},itemMargin:{horizontal:12,vertical:8}},tooltip:{...t?.tooltip,theme:"light",style:{fontSize:"13px"},y:{formatter:a=>a?.toLocaleString()}}}),wMe=({component:t,custom:e,...r})=>{Xi(),Cn();const[n,a]=R.useState(null),[o,i]=R.useState(!0);R.useEffect(()=>{i(!0);let u="";t.filter?.forEach(d=>{if(typeof d.value=="string"&&(d.value.includes("$lte ")||d.value.includes("$gte ")||d.value.includes("$lt ")||d.value.includes("$gt "))){const[f,h]=d.value.split(" ");u+=`${s.name}=${encodeURIComponent(f+" "+h)}&`}else if(d.value?.startsWith("$")){let f=localStorage.getItem(d.value.substring(1));f&&(u+=`${d.name}=${encodeURIComponent(f)}&`)}else u+=`${d.name}=null&`});const c=t.api||`/api/chart/${t.id}`;Ds(`${c}?${u}`).then(d=>{a(d),i(!1)}).catch(()=>{i(!1)})},[t.id]);const l=R.useMemo(()=>n?.options?xMe(n.options,t?.type,t?.y):null,[n?.options,t?.type,t?.y]);return o?N.jsx(Gr,{sx:{width:"100%",height:t.height||300},children:N.jsx(nA,{variant:"rectangular",width:"100%",height:"100%",sx:{borderRadius:2,bgcolor:"rgba(0,0,0,0.04)"}})}):N.jsx(Gr,{sx:{width:"100%","& .apexcharts-canvas":{margin:"0 auto"}},children:n&&t&&l&&N.jsx(bMe,{height:t.height||300,options:l,series:n.series,type:t?.type})})},SMe=({component:t,custom:e,...r})=>{const{yml:n}=Cn(),[a,o]=R.useState({});R.useEffect(()=>{const h={};t.filter&&t.filter.forEach(g=>{let v=g.value;if(v!=null)if(typeof g.value=="string"&&(g.value.includes("$lte ")||g.value.includes("$gte ")||g.value.includes("$lt ")||g.value.includes("$gt "))){const[m,y]=g.value.split(" ");h[g.name]=m+" "+y}else typeof g.value=="string"&&v.startsWith("$")&&(v=localStorage.getItem(v.substring(1))),h[g.name]=v}),o(h)},[t.filter]);const{data:i,total:l,isLoading:u,error:c}=VP(t.entity,{pagination:{page:1,perPage:t.limit||10},sort:{field:"id",order:"DESC"},filter:a},{enabled:Object.keys(a).length>0||!t.filter}),d=R.useMemo(()=>({data:i,isLoading:u,total:l,page:1,perPage:t.limit||10,sort:{field:"id",order:"DESC"},filterValues:a,setSort:()=>{},setPage:()=>{},setPerPage:()=>{},setFilters:()=>{},resource:t.entity,selectedIds:[],onSelect:()=>{},onToggleItem:()=>{},onUnselectItems:()=>{}}),[i,u,l,a,t.entity,t.limit]);if(u)return N.jsx(Gr,{sx:{width:"100%",height:t.height||300},children:N.jsx(nA,{variant:"rectangular",width:"100%",height:"100%",sx:{borderRadius:2,bgcolor:"rgba(0,0,0,0.04)"}})});if(c)return N.jsx(yt,{color:"error",children:"Error loading data"});if(!i||!n?.entity?.[t.entity])return null;const f=n.entity[t.entity];return N.jsx(hs,{value:t.entity,children:N.jsx(ZP,{value:d,children:N.jsx(Gr,{sx:{width:"100%",overflow:"auto"},children:N.jsx(Cb,{bulkActionButtons:!1,rowClick:!1,empty:N.jsx(Gr,{sx:{p:2},children:"No data"}),children:t.fields.map((h,g)=>{const v=typeof h=="string"?h:h.name,m=f.fields.find(y=>y.name===v);return m?Nu({field:m,isList:!0,crud_field:typeof h=="object"?h:{name:v}}):null})})})})})},DO=["linear-gradient(135deg, #667eea 0%, #764ba2 100%)","linear-gradient(135deg, #f093fb 0%, #f5576c 100%)","linear-gradient(135deg, #4facfe 0%, #00f2fe 100%)","linear-gradient(135deg, #43e97b 0%, #38f9d7 100%)","linear-gradient(135deg, #fa709a 0%, #fee140 100%)","linear-gradient(135deg, #a8edea 0%, #fed6e3 100%)"],CMe=({components:t,custom:e,...r})=>{Xi(),Cn();const n=Gn();return Kn(n.breakpoints.up("md")),N.jsx(Gr,{sx:{minHeight:"100vh",padding:{xs:2,md:4}},children:N.jsx(Hm,{container:!0,spacing:3,children:t?.map((a,o)=>{console.log(`Dashboard Component [${o}] ${a.label}:`,a);const i=o%DO.length;return N.jsx(Hm,{item:!0,size:{xs:12,md:a.size||4},children:N.jsxs(ha,{elevation:0,sx:{borderRadius:4,overflow:"hidden",transition:"all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1)",background:"#ffffff",border:"1px solid",borderColor:Un(n.palette.divider,.1),position:"relative","&:hover":{transform:"translateY(-8px)",boxShadow:"0 20px 40px -12px rgba(0,0,0,0.15)",borderColor:"transparent",zIndex:1}},children:[N.jsxs(Gr,{sx:{px:3,py:2.5,display:"flex",alignItems:"center",gap:2,position:"relative",overflow:"hidden",borderBottom:`1px solid ${Un(n.palette.divider,.05)}`,"&::before":{content:'""',position:"absolute",top:0,left:0,width:"4px",height:"100%",background:DO[i]}},children:[a.icon&&N.jsx(Gr,{sx:{width:42,height:42,borderRadius:"14px",display:"flex",alignItems:"center",justifyContent:"center",background:DO[i],boxShadow:"0 8px 16px -4px rgba(0,0,0,0.2)",color:"#fff",transition:"transform 0.3s ease",".MuiPaper-root:hover &":{transform:"scale(1.1) rotate(5deg)"}},children:N.jsx(Al,{icon:a.icon,width:22,height:22,style:{color:"#fff"}})}),N.jsx(yt,{variant:"subtitle1",sx:{fontWeight:700,color:"#2c3e50",letterSpacing:"0.5px"},children:a.label})]}),N.jsxs(Zu,{sx:{p:3},children:[a.component==="table"&&N.jsx(SMe,{component:a}),a.component==="chart"&&N.jsx(wMe,{component:a})]})]})},o)})})})},OMe=({custom:t,...e})=>{Xi();const r=Cn();return N.jsx(CMe,{components:r?.front?.dashboard})},FO=async(t,e={})=>{e.headers||(e.headers=new Headers({Accept:"application/json"}));const r=localStorage.getItem("token");e.headers.set("x-access-token",r);try{return await hV(t,e)}catch(n){throw n.body&&n.body.message?(console.log("error.body.message",n.body.message),new BP(n.body.message,n.status,n.body)):n}},EMe=()=>{const{yml:t}=Cn();return N.jsx(TA,{backgroundImage:t?.front?.appearance?.login?.background})},kMe=({adminYaml:t,adminJson:e,i18nProvider:r,custom:n,theme:a,layout:o})=>{const[i,l]=R.useState(null),[u,c]=R.useState(null),d=R.useMemo(()=>({...dB,login:f=>dB.login(f).then(h=>(n?.loginSuccess&&n.loginSuccess(h.member),h))}),[n]);return R.useEffect(()=>{(async()=>{try{const h=t&&yCe.parse(t)||e;l(h);const g=h["api-host"].uri,v={};Object.entries(h.entity).map(([m,y])=>{y.fields.map(b=>{b.private&&(v[m]={...v[m],[b.name]:b.private})})}),console.log("api_host",g),h.upload?.local?(console.log("upload.local",h.upload.local.base_url),c(fB(XC(g,FO),!0,v))):h.upload?.s3?(console.log("upload.s3",h.upload.s3.base_url),c(fB(XC(g,FO),!1,v))):(console.log("upload.none"),c(XC(g,FO))),EU(g)}catch(h){console.error("YAML file load error",h)}})()},[]),N.jsx(N.Fragment,{children:u&&N.jsx($Y,{initialYml:i,custom:n,width:"1250px",children:N.jsxs(cSe,{loginPage:n?.layout?.Login||EMe,theme:{...z5,...a},dashboard:i?.front?.dashboard?OMe:void 0,layout:o||nke,authProvider:d,i18nProvider:r,dataProvider:u,children:[i?.entity&&Object.keys(i.entity).map(f=>{const h=i.entity[f];return h.custom?N.jsx(Em,{name:f,options:{label:h.label},icon:IconComponent},f):N.jsx(Em,{name:f,options:{label:h.label},icon:N.jsx(Al,{icon:h?.icon,width:"1.25rem",height:"1.25rem"}),list:(g=>N.jsx(VIe,{...g,custom:n})),create:(g=>N.jsx(qIe,{...g,custom:n})),edit:(g=>N.jsx(XIe,{...g,custom:n})),show:(g=>N.jsx(QIe,{...g,custom:n}))},f)}),N.jsx(xH,{children:n?.customRoutes?.map(f=>(console.log("customRoutes",f.path),N.jsx(mn,{path:f.path,element:f.element},f.path)))})]})})})};exports.AdminContext=GA;exports.AdminProvider=$Y;exports.AppBar=fA;exports.EntityTreeView=B6;exports.Layout=mA;exports.Login=TA;exports.LoginForm=E3;exports.Logout=uA;exports.Menu=rd;exports.UserMenu=yb;exports.YMLAdmin=kMe;exports.defaultTheme=z5;exports.fetcher=Ds;exports.postFetcher=Xv;exports.uploadFile=kU;exports.uploadFileSecure=_U;exports.useAdminContext=Cn;exports.useRedirect=Hs;exports.useSidebarState=rl;exports.useTranslate=Xe;
package/dist/index.es.js CHANGED
@@ -86575,7 +86575,7 @@ function DMe() {
86575
86575
  })(TC)), TC;
86576
86576
  }
86577
86577
  var FMe = DMe();
86578
- const XC = /* @__PURE__ */ yn(FMe), $Me = typeof XC == "object" ? XC.default : XC, zMe = (t, e) => ({
86578
+ const XC = /* @__PURE__ */ yn(FMe), $Me = typeof XC == "object" ? XC.default : XC, zMe = (t, e, r) => ({
86579
86579
  ...t,
86580
86580
  chart: {
86581
86581
  ...t?.chart,
@@ -86629,7 +86629,7 @@ const XC = /* @__PURE__ */ yn(FMe), $Me = typeof XC == "object" ? XC.default : X
86629
86629
  gradient: e === "line" ? {
86630
86630
  shadeIntensity: 0.3,
86631
86631
  opacityFrom: 0.5,
86632
- opacityTo: 0.1,
86632
+ opacityTo: 0.5,
86633
86633
  stops: [0, 90, 100]
86634
86634
  } : void 0
86635
86635
  },
@@ -86675,8 +86675,21 @@ const XC = /* @__PURE__ */ yn(FMe), $Me = typeof XC == "object" ? XC.default : X
86675
86675
  },
86676
86676
  yaxis: {
86677
86677
  ...t?.yaxis,
86678
+ max: r?.max,
86679
+ forceNiceScale: r?.type === "integer",
86680
+ decimalsInFloat: r?.type === "integer" ? 0 : void 0,
86678
86681
  labels: {
86679
86682
  ...t?.yaxis?.labels,
86683
+ formatter: (a) => {
86684
+ if (r?.value_text)
86685
+ for (const i of r.value_text)
86686
+ try {
86687
+ if (new Function("value", `return ${i.if}`)(a)) return i.text;
86688
+ } catch (o) {
86689
+ console.warn("Failed to evaluate value_text condition:", i.if, o);
86690
+ }
86691
+ return r?.type === "integer" ? Math.floor(a).toString() : a;
86692
+ },
86680
86693
  style: {
86681
86694
  colors: "#64748b",
86682
86695
  fontSize: "12px",
@@ -86707,7 +86720,7 @@ const XC = /* @__PURE__ */ yn(FMe), $Me = typeof XC == "object" ? XC.default : X
86707
86720
  fontSize: "13px"
86708
86721
  },
86709
86722
  y: {
86710
- formatter: (n) => n?.toLocaleString()
86723
+ formatter: (a) => a?.toLocaleString()
86711
86724
  }
86712
86725
  }
86713
86726
  }), BMe = ({ component: t, custom: e, ...r }) => {
@@ -86716,22 +86729,24 @@ const XC = /* @__PURE__ */ yn(FMe), $Me = typeof XC == "object" ? XC.default : X
86716
86729
  Te(() => {
86717
86730
  o(!0);
86718
86731
  let u = "";
86719
- t.filter?.forEach((c) => {
86720
- if (typeof c.value == "string" && (c.value.includes("$lte ") || c.value.includes("$gte ") || c.value.includes("$lt ") || c.value.includes("$gt "))) {
86721
- const [d, f] = c.value.split(" ");
86722
- u += `${s.name}=${encodeURIComponent(d + " " + f)}&`;
86723
- } else if (c.value?.startsWith("$")) {
86724
- let d = localStorage.getItem(c.value.substring(1));
86725
- d && (u += `${c.name}=${encodeURIComponent(d)}&`);
86732
+ t.filter?.forEach((d) => {
86733
+ if (typeof d.value == "string" && (d.value.includes("$lte ") || d.value.includes("$gte ") || d.value.includes("$lt ") || d.value.includes("$gt "))) {
86734
+ const [f, h] = d.value.split(" ");
86735
+ u += `${s.name}=${encodeURIComponent(f + " " + h)}&`;
86736
+ } else if (d.value?.startsWith("$")) {
86737
+ let f = localStorage.getItem(d.value.substring(1));
86738
+ f && (u += `${d.name}=${encodeURIComponent(f)}&`);
86726
86739
  } else
86727
- u += `${c.name}=null&`;
86728
- }), ic(`/api/chart/${t.id}?${u}`).then((c) => {
86729
- a(c), o(!1);
86740
+ u += `${d.name}=null&`;
86741
+ });
86742
+ const c = t.api || `/api/chart/${t.id}`;
86743
+ ic(`${c}?${u}`).then((d) => {
86744
+ a(d), o(!1);
86730
86745
  }).catch(() => {
86731
86746
  o(!1);
86732
86747
  });
86733
86748
  }, [t.id]);
86734
- const l = $e(() => n?.options ? zMe(n.options, t?.type) : null, [n?.options, t?.type]);
86749
+ const l = $e(() => n?.options ? zMe(n.options, t?.type, t?.y) : null, [n?.options, t?.type, t?.y]);
86735
86750
  return i ? /* @__PURE__ */ L.jsx(nn, { sx: { width: "100%", height: t.height || 300 }, children: /* @__PURE__ */ L.jsx(
86736
86751
  vA,
86737
86752
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yaml-admin-front",
3
- "version": "0.0.95",
3
+ "version": "0.0.96",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs.js",