@aintela/bi 0.2.1 → 0.2.2
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/{GridLayout-BgPzzPiP.js → GridLayout-1gWuIKeZ.js} +3 -4
- package/dist/GridLayout-1gWuIKeZ.js.map +1 -0
- package/dist/{ScriptDashboardViewerVertical-DKaHcL1o.js → ScriptDashboardViewerVertical-CuwnxisJ.js} +3 -3
- package/dist/{ScriptDashboardViewerVertical-DKaHcL1o.js.map → ScriptDashboardViewerVertical-CuwnxisJ.js.map} +1 -1
- package/dist/{biModuleSurface-dtnpBMtT.js → biModuleSurface--gLAiZ9Z.js} +4 -4
- package/dist/{biModuleSurface-dtnpBMtT.js.map → biModuleSurface--gLAiZ9Z.js.map} +1 -1
- package/dist/composer.js +1 -1
- package/dist/grid.js +16 -17
- package/dist/grid.js.map +1 -1
- package/dist/{index-Dz2ulBiy.js → index-BzUugG0A.js} +4 -5
- package/dist/{index-Dz2ulBiy.js.map → index-BzUugG0A.js.map} +1 -1
- package/dist/{index-7p-ogAPK.js → index-DULVx84u.js} +5 -6
- package/dist/{index-7p-ogAPK.js.map → index-DULVx84u.js.map} +1 -1
- package/dist/{index-CPHaT2or.js → index-K50t61iI.js} +2 -2
- package/dist/index-K50t61iI.js.map +1 -0
- package/dist/index.js +239 -240
- package/dist/index.js.map +1 -1
- package/dist/runtime/version.d.ts +1 -1
- package/dist/runtime.js +3 -3
- package/dist/style.css +1 -1
- package/dist/{version-BgIpi4UM.js → version-BpSiNdYv.js} +4 -4
- package/dist/{version-BgIpi4UM.js.map → version-BpSiNdYv.js.map} +1 -1
- package/dist/viewer.js +1 -1
- package/package.json +1 -1
- package/dist/GridLayout-BgPzzPiP.js.map +0 -1
- package/dist/index-CPHaT2or.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-Dz2ulBiy.js","sources":["../src/grid/useGridConfigTranslator.ts"],"sourcesContent":["import { useMemo } from \"react\";\nimport type { Layout, LayoutItem } from \"react-grid-layout\";\nimport type {\n GridConfig,\n RowConfig,\n ResponsiveGridConfig,\n ResponsiveLayouts,\n BreakpointName,\n} from \"./types\";\nimport { DEFAULT_COLS } from \"./types\";\n\n/**\n * Translates a GridConfig (row/cell tree) into a flat Layout array\n * that react-grid-layout understands.\n *\n * @param config - The grid configuration\n * @param cols - Number of columns (default: 12)\n * @returns Flat layout array for react-grid-layout\n */\nexport function translateGridConfig(\n config: GridConfig,\n cols: number = 12\n): Layout {\n const items: LayoutItem[] = [];\n\n function processRows(\n rows: RowConfig[],\n offsetX: number,\n offsetY: number,\n parentCols: number\n ): number {\n let y = offsetY;\n\n for (const row of rows) {\n const rowHeight = row.height ?? 1;\n let x = offsetX;\n\n for (const cell of row.cells) {\n // Scale width relative to parent columns\n const scaledW = Math.round((cell.width / 12) * parentCols);\n let cellHeight = cell.height ?? rowHeight;\n\n cellHeight = cellHeight == 1 ? 1 : cellHeight;\n\n if (cell.rows && cell.rows.length > 0) {\n // Nested rows - recurse\n processRows(cell.rows, x, y, scaledW);\n } else if (cell.key) {\n // Leaf cell - add to layout\n const item: LayoutItem = {\n i: cell.key,\n x,\n y,\n w: scaledW,\n h: (cellHeight * (config.rowMultipler ?? 1)) + 1,\n };\n\n // Add optional constraints\n if (cell.minW !== undefined) item.minW = cell.minW;\n if (cell.maxW !== undefined) item.maxW = cell.maxW;\n if (cell.minH !== undefined) item.minH = cell.minH;\n if (cell.maxH !== undefined) item.maxH = cell.maxH;\n if (cell.static !== undefined) item.static = cell.static;\n if (cell.isDraggable !== undefined) item.isDraggable = cell.isDraggable;\n if (cell.isResizable !== undefined) item.isResizable = cell.isResizable;\n\n items.push(item);\n }\n\n x += scaledW;\n }\n\n y += rowHeight;\n }\n\n return y;\n }\n\n processRows(config.rows, 0, 0, cols);\n\n return items;\n}\n\n/**\n * Translates a ResponsiveGridConfig into ResponsiveLayouts\n * If a breakpoint is not defined, it falls back to larger breakpoints\n *\n * @param config - The responsive grid configuration\n * @param colsPerBreakpoint - Columns per breakpoint (default: DEFAULT_COLS)\n * @returns Responsive layouts object for react-grid-layout\n */\nexport function translateResponsiveGridConfig(\n config: ResponsiveGridConfig,\n colsPerBreakpoint: Record<BreakpointName, number> = DEFAULT_COLS\n): ResponsiveLayouts {\n const breakpointOrder: BreakpointName[] = [\"lg\", \"md\", \"sm\", \"xs\", \"xxs\"];\n const layouts: ResponsiveLayouts = {};\n\n // Find the first defined config to use as fallback\n let fallbackConfig: GridConfig | undefined;\n\n for (const bp of breakpointOrder) {\n const bpConfig = config[bp];\n\n if (bpConfig) {\n fallbackConfig = bpConfig;\n layouts[bp] = translateGridConfig(bpConfig, colsPerBreakpoint[bp]);\n } else if (fallbackConfig) {\n // Use fallback from larger breakpoint, but translate with this breakpoint's cols\n layouts[bp] = translateGridConfig(\n fallbackConfig,\n colsPerBreakpoint[bp]\n );\n }\n }\n\n return layouts;\n}\n\n/**\n * Auto-responsive translation strategy.\n * Determines how items should be arranged when columns decrease.\n */\nexport type AutoResponsiveStrategy = \"scale\" | \"stack\" | \"hybrid\";\n\n/**\n * Translates a single GridConfig into responsive layouts automatically.\n * \n * This function intelligently adapts the layout for different screen sizes:\n * - For breakpoints with same column count as base: preserves layout\n * - For breakpoints with fewer columns: applies the chosen strategy\n * \n * Strategies:\n * - \"scale\": Proportionally scale widths (items may become very narrow)\n * - \"stack\": Stack items vertically (each item becomes full width)\n * - \"hybrid\": Scale for moderate reductions, stack for small screens (default)\n *\n * @param config - The grid configuration (designed for lg/12 columns)\n * @param colsPerBreakpoint - Columns per breakpoint (default: DEFAULT_COLS)\n * @param strategy - How to handle smaller breakpoints (default: \"hybrid\")\n * @returns Responsive layouts object for react-grid-layout\n */\nexport function translateGridConfigAutoResponsive(\n config: GridConfig,\n colsPerBreakpoint: Record<BreakpointName, number> = DEFAULT_COLS,\n strategy: AutoResponsiveStrategy = \"stack\"\n): ResponsiveLayouts {\n const breakpointOrder: BreakpointName[] = [\"lg\", \"md\", \"sm\", \"xs\", \"xxs\"];\n const layouts: ResponsiveLayouts = {};\n\n // Base layout (lg - 12 columns typically)\n const baseCols = colsPerBreakpoint.lg;\n const baseLayout = translateGridConfig(config, baseCols);\n\n for (const bp of breakpointOrder) {\n const targetCols = colsPerBreakpoint[bp];\n\n if (targetCols === baseCols) {\n // Same column count - use base layout directly\n layouts[bp] = baseLayout;\n } else {\n // Different column count - apply strategy\n const shouldStack =\n strategy === \"stack\" ||\n (strategy === \"hybrid\" && targetCols <= 4);\n\n if (shouldStack) {\n // Stack: arrange items vertically, full width\n layouts[bp] = createStackedLayout(baseLayout, targetCols);\n } else {\n // Scale: proportionally adjust widths\n layouts[bp] = createScaledLayout(baseLayout, baseCols, targetCols, config.rowMultipler ?? 1);\n }\n }\n }\n\n return layouts;\n}\n\n/**\n * Creates a stacked layout where each item takes full width\n * and items are arranged vertically.\n */\nfunction createStackedLayout(baseLayout: Layout, cols: number): Layout {\n let currentY = 0;\n\n // Sort by original position (top to bottom, left to right)\n const sorted = [...baseLayout].sort((a, b) => {\n if (a.y !== b.y) return a.y - b.y;\n return a.x - b.x;\n });\n\n return sorted.map((item) => {\n const newItem: LayoutItem = {\n ...item,\n x: 0,\n y: currentY,\n w: cols, // Full width\n // Keep height, but ensure minimum of 2 for readability on small screens\n h: Math.max(item.h, 2)\n };\n currentY += newItem.h;\n return newItem;\n });\n}\n\n/**\n * Creates a scaled layout by proportionally adjusting widths.\n * Items maintain their relative positions but widths are scaled.\n */\nfunction createScaledLayout(baseLayout: Layout, baseCols: number, targetCols: number, rowMultipler: number): Layout {\n const scale = targetCols / baseCols;\n\n return baseLayout.map((item) => {\n // Scale x and width, ensure minimum width of 1\n const scaledW = Math.max(1, Math.round(item.w * scale));\n const scaledX = Math.round(item.x * scale);\n\n // Ensure item doesn't overflow\n const adjustedX = Math.min(scaledX, targetCols - scaledW);\n\n return {\n ...item,\n x: Math.max(0, adjustedX) * rowMultipler,\n w: scaledW,\n\n };\n });\n}\n\n/**\n * Options for the useGridConfigTranslator hook\n */\nexport interface UseGridConfigTranslatorOptions {\n /** Grid configuration (single or responsive) */\n config: GridConfig | ResponsiveGridConfig;\n /** Whether the config is responsive (has per-breakpoint configs) */\n responsive?: boolean;\n /** Columns per breakpoint (only used if responsive) */\n cols?: Record<BreakpointName, number>;\n}\n\n/**\n * Result of the useGridConfigTranslator hook\n */\nexport interface UseGridConfigTranslatorResult {\n /** Single layout (only if not responsive) */\n layout: Layout | undefined;\n /** Responsive layouts (only if responsive) */\n layouts: ResponsiveLayouts | undefined;\n}\n\n/**\n * Hook to translate GridConfig to react-grid-layout format\n * Memoizes the result to avoid unnecessary recalculations\n *\n * @param options - Translation options\n * @returns Translated layout(s)\n */\nexport function useGridConfigTranslator(\n options: UseGridConfigTranslatorOptions\n): UseGridConfigTranslatorResult {\n const { config, responsive = false, cols = DEFAULT_COLS } = options;\n\n const result = useMemo(() => {\n if (responsive) {\n // Responsive mode - config should be ResponsiveGridConfig\n const responsiveConfig = config as ResponsiveGridConfig;\n\n // If it looks like a simple GridConfig (has rows), wrap it\n if (\"rows\" in responsiveConfig) {\n const simpleConfig = responsiveConfig as unknown as GridConfig;\n return {\n layout: undefined,\n layouts: translateResponsiveGridConfig(\n { lg: simpleConfig },\n cols\n ),\n };\n }\n\n const translatedResponsive = translateResponsiveGridConfig(responsiveConfig, cols);\n\n return {\n layout: undefined,\n layouts: translatedResponsive\n };\n } else {\n // Single layout mode\n const simpleConfig = config as GridConfig;\n const translated = translateGridConfig(simpleConfig, cols.lg ?? 12);\n\n return {\n layout: translated,\n layouts: undefined,\n };\n }\n }, [config, responsive, cols]);\n\n return result;\n}\n\nexport default useGridConfigTranslator;\n"],"names":["translateGridConfig","config","cols","items","processRows","rows","offsetX","offsetY","parentCols","y","row","rowHeight","x","cell","scaledW","cellHeight","item","__name","translateResponsiveGridConfig","colsPerBreakpoint","DEFAULT_COLS","breakpointOrder","layouts","fallbackConfig","bp","bpConfig","translateGridConfigAutoResponsive","strategy","baseCols","baseLayout","targetCols","createStackedLayout","createScaledLayout","currentY","a","b","newItem","rowMultipler","scale","scaledX","adjustedX","useGridConfigTranslator","options","responsive","useMemo","responsiveConfig"],"mappings":";;;;;;;AAmBO,SAASA,EACZC,GACAC,IAAe,IACT;AACN,QAAMC,IAAsB,CAAA;AAE5B,WAASC,EACLC,GACAC,GACAC,GACAC,GACM;AACN,QAAIC,IAAIF;AAER,eAAWG,KAAOL,GAAM;AACpB,YAAMM,IAAYD,EAAI,UAAU;AAChC,UAAIE,IAAIN;AAER,iBAAWO,KAAQH,EAAI,OAAO;AAE1B,cAAMI,IAAU,KAAK,MAAOD,EAAK,QAAQ,KAAML,CAAU;AACzD,YAAIO,IAAaF,EAAK,UAAUF;AAIhC,YAFAI,IAAaA,KAAc,IAAI,IAAIA,GAE/BF,EAAK,QAAQA,EAAK,KAAK,SAAS;AAEhC,UAAAT,EAAYS,EAAK,MAAMD,GAAGH,GAAGK,CAAO;AAAA,iBAC7BD,EAAK,KAAK;AAEjB,gBAAMG,IAAmB;AAAA,YACrB,GAAGH,EAAK;AAAA,YACR,GAAAD;AAAA,YACA,GAAAH;AAAA,YACA,GAAGK;AAAA,YACH,GAAIC,KAAcd,EAAO,gBAAgB,KAAM;AAAA,UAAA;AAInD,UAAIY,EAAK,SAAS,WAAWG,EAAK,OAAOH,EAAK,OAC1CA,EAAK,SAAS,WAAWG,EAAK,OAAOH,EAAK,OAC1CA,EAAK,SAAS,WAAWG,EAAK,OAAOH,EAAK,OAC1CA,EAAK,SAAS,WAAWG,EAAK,OAAOH,EAAK,OAC1CA,EAAK,WAAW,WAAWG,EAAK,SAASH,EAAK,SAC9CA,EAAK,gBAAgB,WAAWG,EAAK,cAAcH,EAAK,cACxDA,EAAK,gBAAgB,WAAWG,EAAK,cAAcH,EAAK,cAE5DV,EAAM,KAAKa,CAAI;AAAA,QACnB;AAEA,QAAAJ,KAAKE;AAAA,MACT;AAEA,MAAAL,KAAKE;AAAA,IACT;AAEA,WAAOF;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AHeF,EADEC,GACgCC,EAAK,MAAM,EAAE;AAAA,QAI9D,SAAS;AAAA,MAAA;AAAA,EAGrB,GAAG,CAACD,GAAQ0C,GAAYzC,CAAI,CAAC;AAGjC;AAzCgBe,EAAAwB,GAAA;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index-BzUugG0A.js","sources":["../src/grid/useGridConfigTranslator.ts"],"sourcesContent":["import { useMemo } from \"react\";\nimport type { Layout, LayoutItem } from \"react-grid-layout\";\nimport type {\n GridConfig,\n RowConfig,\n ResponsiveGridConfig,\n ResponsiveLayouts,\n BreakpointName,\n} from \"./types\";\nimport { DEFAULT_COLS } from \"./types\";\n\n/**\n * Translates a GridConfig (row/cell tree) into a flat Layout array\n * that react-grid-layout understands.\n *\n * @param config - The grid configuration\n * @param cols - Number of columns (default: 12)\n * @returns Flat layout array for react-grid-layout\n */\nexport function translateGridConfig(\n config: GridConfig,\n cols: number = 12\n): Layout {\n const items: LayoutItem[] = [];\n\n function processRows(\n rows: RowConfig[],\n offsetX: number,\n offsetY: number,\n parentCols: number\n ): number {\n let y = offsetY;\n\n for (const row of rows) {\n const rowHeight = row.height ?? 1;\n let x = offsetX;\n\n for (const cell of row.cells) {\n // Scale width relative to parent columns\n const scaledW = Math.round((cell.width / 12) * parentCols);\n let cellHeight = cell.height ?? rowHeight;\n\n cellHeight = cellHeight == 1 ? 1 : cellHeight;\n\n if (cell.rows && cell.rows.length > 0) {\n // Nested rows - recurse\n processRows(cell.rows, x, y, scaledW);\n } else if (cell.key) {\n // Leaf cell - add to layout\n const item: LayoutItem = {\n i: cell.key,\n x,\n y,\n w: scaledW,\n h: (cellHeight * (config.rowMultipler ?? 1)) + 1,\n };\n\n // Add optional constraints\n if (cell.minW !== undefined) item.minW = cell.minW;\n if (cell.maxW !== undefined) item.maxW = cell.maxW;\n if (cell.minH !== undefined) item.minH = cell.minH;\n if (cell.maxH !== undefined) item.maxH = cell.maxH;\n if (cell.static !== undefined) item.static = cell.static;\n if (cell.isDraggable !== undefined) item.isDraggable = cell.isDraggable;\n if (cell.isResizable !== undefined) item.isResizable = cell.isResizable;\n\n items.push(item);\n }\n\n x += scaledW;\n }\n\n y += rowHeight;\n }\n\n return y;\n }\n\n processRows(config.rows, 0, 0, cols);\n\n return items;\n}\n\n/**\n * Translates a ResponsiveGridConfig into ResponsiveLayouts\n * If a breakpoint is not defined, it falls back to larger breakpoints\n *\n * @param config - The responsive grid configuration\n * @param colsPerBreakpoint - Columns per breakpoint (default: DEFAULT_COLS)\n * @returns Responsive layouts object for react-grid-layout\n */\nexport function translateResponsiveGridConfig(\n config: ResponsiveGridConfig,\n colsPerBreakpoint: Record<BreakpointName, number> = DEFAULT_COLS\n): ResponsiveLayouts {\n const breakpointOrder: BreakpointName[] = [\"lg\", \"md\", \"sm\", \"xs\", \"xxs\"];\n const layouts: ResponsiveLayouts = {};\n\n // Find the first defined config to use as fallback\n let fallbackConfig: GridConfig | undefined;\n\n for (const bp of breakpointOrder) {\n const bpConfig = config[bp];\n\n if (bpConfig) {\n fallbackConfig = bpConfig;\n layouts[bp] = translateGridConfig(bpConfig, colsPerBreakpoint[bp]);\n } else if (fallbackConfig) {\n // Use fallback from larger breakpoint, but translate with this breakpoint's cols\n layouts[bp] = translateGridConfig(\n fallbackConfig,\n colsPerBreakpoint[bp]\n );\n }\n }\n\n return layouts;\n}\n\n/**\n * Auto-responsive translation strategy.\n * Determines how items should be arranged when columns decrease.\n */\nexport type AutoResponsiveStrategy = \"scale\" | \"stack\" | \"hybrid\";\n\n/**\n * Translates a single GridConfig into responsive layouts automatically.\n * \n * This function intelligently adapts the layout for different screen sizes:\n * - For breakpoints with same column count as base: preserves layout\n * - For breakpoints with fewer columns: applies the chosen strategy\n * \n * Strategies:\n * - \"scale\": Proportionally scale widths (items may become very narrow)\n * - \"stack\": Stack items vertically (each item becomes full width)\n * - \"hybrid\": Scale for moderate reductions, stack for small screens (default)\n *\n * @param config - The grid configuration (designed for lg/12 columns)\n * @param colsPerBreakpoint - Columns per breakpoint (default: DEFAULT_COLS)\n * @param strategy - How to handle smaller breakpoints (default: \"hybrid\")\n * @returns Responsive layouts object for react-grid-layout\n */\nexport function translateGridConfigAutoResponsive(\n config: GridConfig,\n colsPerBreakpoint: Record<BreakpointName, number> = DEFAULT_COLS,\n strategy: AutoResponsiveStrategy = \"stack\"\n): ResponsiveLayouts {\n const breakpointOrder: BreakpointName[] = [\"lg\", \"md\", \"sm\", \"xs\", \"xxs\"];\n const layouts: ResponsiveLayouts = {};\n\n // Base layout (lg - 12 columns typically)\n const baseCols = colsPerBreakpoint.lg;\n const baseLayout = translateGridConfig(config, baseCols);\n\n for (const bp of breakpointOrder) {\n const targetCols = colsPerBreakpoint[bp];\n\n if (targetCols === baseCols) {\n // Same column count - use base layout directly\n layouts[bp] = baseLayout;\n } else {\n // Different column count - apply strategy\n const shouldStack =\n strategy === \"stack\" ||\n (strategy === \"hybrid\" && targetCols <= 4);\n\n if (shouldStack) {\n // Stack: arrange items vertically, full width\n layouts[bp] = createStackedLayout(baseLayout, targetCols);\n } else {\n // Scale: proportionally adjust widths\n layouts[bp] = createScaledLayout(baseLayout, baseCols, targetCols, config.rowMultipler ?? 1);\n }\n }\n }\n\n return layouts;\n}\n\n/**\n * Creates a stacked layout where each item takes full width\n * and items are arranged vertically.\n */\nfunction createStackedLayout(baseLayout: Layout, cols: number): Layout {\n let currentY = 0;\n\n // Sort by original position (top to bottom, left to right)\n const sorted = [...baseLayout].sort((a, b) => {\n if (a.y !== b.y) return a.y - b.y;\n return a.x - b.x;\n });\n\n return sorted.map((item) => {\n const newItem: LayoutItem = {\n ...item,\n x: 0,\n y: currentY,\n w: cols, // Full width\n // Keep height, but ensure minimum of 2 for readability on small screens\n h: Math.max(item.h, 2)\n };\n currentY += newItem.h;\n return newItem;\n });\n}\n\n/**\n * Creates a scaled layout by proportionally adjusting widths.\n * Items maintain their relative positions but widths are scaled.\n */\nfunction createScaledLayout(baseLayout: Layout, baseCols: number, targetCols: number, rowMultipler: number): Layout {\n const scale = targetCols / baseCols;\n\n return baseLayout.map((item) => {\n // Scale x and width, ensure minimum width of 1\n const scaledW = Math.max(1, Math.round(item.w * scale));\n const scaledX = Math.round(item.x * scale);\n\n // Ensure item doesn't overflow\n const adjustedX = Math.min(scaledX, targetCols - scaledW);\n\n return {\n ...item,\n x: Math.max(0, adjustedX) * rowMultipler,\n w: scaledW,\n\n };\n });\n}\n\n/**\n * Options for the useGridConfigTranslator hook\n */\nexport interface UseGridConfigTranslatorOptions {\n /** Grid configuration (single or responsive) */\n config: GridConfig | ResponsiveGridConfig;\n /** Whether the config is responsive (has per-breakpoint configs) */\n responsive?: boolean;\n /** Columns per breakpoint (only used if responsive) */\n cols?: Record<BreakpointName, number>;\n}\n\n/**\n * Result of the useGridConfigTranslator hook\n */\nexport interface UseGridConfigTranslatorResult {\n /** Single layout (only if not responsive) */\n layout: Layout | undefined;\n /** Responsive layouts (only if responsive) */\n layouts: ResponsiveLayouts | undefined;\n}\n\n/**\n * Hook to translate GridConfig to react-grid-layout format\n * Memoizes the result to avoid unnecessary recalculations\n *\n * @param options - Translation options\n * @returns Translated layout(s)\n */\nexport function useGridConfigTranslator(\n options: UseGridConfigTranslatorOptions\n): UseGridConfigTranslatorResult {\n const { config, responsive = false, cols = DEFAULT_COLS } = options;\n\n const result = useMemo(() => {\n if (responsive) {\n // Responsive mode - config should be ResponsiveGridConfig\n const responsiveConfig = config as ResponsiveGridConfig;\n\n // If it looks like a simple GridConfig (has rows), wrap it\n if (\"rows\" in responsiveConfig) {\n const simpleConfig = responsiveConfig as unknown as GridConfig;\n return {\n layout: undefined,\n layouts: translateResponsiveGridConfig(\n { lg: simpleConfig },\n cols\n ),\n };\n }\n\n const translatedResponsive = translateResponsiveGridConfig(responsiveConfig, cols);\n\n return {\n layout: undefined,\n layouts: translatedResponsive\n };\n } else {\n // Single layout mode\n const simpleConfig = config as GridConfig;\n const translated = translateGridConfig(simpleConfig, cols.lg ?? 12);\n\n return {\n layout: translated,\n layouts: undefined,\n };\n }\n }, [config, responsive, cols]);\n\n return result;\n}\n\nexport default useGridConfigTranslator;\n"],"names":["translateGridConfig","config","cols","items","processRows","rows","offsetX","offsetY","parentCols","y","row","rowHeight","x","cell","scaledW","cellHeight","item","__name","translateResponsiveGridConfig","colsPerBreakpoint","DEFAULT_COLS","breakpointOrder","layouts","fallbackConfig","bp","bpConfig","translateGridConfigAutoResponsive","strategy","baseCols","baseLayout","targetCols","createStackedLayout","createScaledLayout","currentY","a","b","newItem","rowMultipler","scale","scaledX","adjustedX","useGridConfigTranslator","options","responsive","useMemo","responsiveConfig"],"mappings":";;;;;;AAmBO,SAASA,EACZC,GACAC,IAAe,IACT;AACN,QAAMC,IAAsB,CAAA;AAE5B,WAASC,EACLC,GACAC,GACAC,GACAC,GACM;AACN,QAAIC,IAAIF;AAER,eAAWG,KAAOL,GAAM;AACpB,YAAMM,IAAYD,EAAI,UAAU;AAChC,UAAIE,IAAIN;AAER,iBAAWO,KAAQH,EAAI,OAAO;AAE1B,cAAMI,IAAU,KAAK,MAAOD,EAAK,QAAQ,KAAML,CAAU;AACzD,YAAIO,IAAaF,EAAK,UAAUF;AAIhC,YAFAI,IAAaA,KAAc,IAAI,IAAIA,GAE/BF,EAAK,QAAQA,EAAK,KAAK,SAAS;AAEhC,UAAAT,EAAYS,EAAK,MAAMD,GAAGH,GAAGK,CAAO;AAAA,iBAC7BD,EAAK,KAAK;AAEjB,gBAAMG,IAAmB;AAAA,YACrB,GAAGH,EAAK;AAAA,YACR,GAAAD;AAAA,YACA,GAAAH;AAAA,YACA,GAAGK;AAAA,YACH,GAAIC,KAAcd,EAAO,gBAAgB,KAAM;AAAA,UAAA;AAInD,UAAIY,EAAK,SAAS,WAAWG,EAAK,OAAOH,EAAK,OAC1CA,EAAK,SAAS,WAAWG,EAAK,OAAOH,EAAK,OAC1CA,EAAK,SAAS,WAAWG,EAAK,OAAOH,EAAK,OAC1CA,EAAK,SAAS,WAAWG,EAAK,OAAOH,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ME,IAAmB5C;AAGzB,aAAI,UAAU4C,IAEH;AAAA,QACH,QAAQ;AAAA,QACR,SAAS3B;AAAA,UACL,EAAE,IAJW2B,EAIP;AAAA,UACN3C;AAAA,QAAA;AAAA,MACJ,IAMD;AAAA,QACH,QAAQ;AAAA,QACR,SAJyBgB,EAA8B2B,GAAkB3C,CAAI;AAAA,MAIpE;AAAA,IAEjB;AAKI,aAAO;AAAA,QACH,QAHeF,EADEC,GACgCC,EAAK,MAAM,EAAE;AAAA,QAI9D,SAAS;AAAA,MAAA;AAAA,EAGrB,GAAG,CAACD,GAAQ0C,GAAYzC,CAAI,CAAC;AAGjC;AAzCgBe,EAAAwB,GAAA;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -6,13 +6,12 @@ import { useStore as Xt } from "zustand";
|
|
|
6
6
|
import { useShallow as ii } from "zustand/react/shallow";
|
|
7
7
|
import { a as et } from "./BiClientProvider-CWJochvi.js";
|
|
8
8
|
import { createStore as ai } from "zustand/vanilla";
|
|
9
|
-
import { C as Oe, S as _e, a as oi } from "./ScriptDashboardViewerVertical-
|
|
9
|
+
import { C as Oe, S as _e, a as oi } from "./ScriptDashboardViewerVertical-CuwnxisJ.js";
|
|
10
10
|
import v from "@mui/material/Box";
|
|
11
11
|
import { SpeedOutlined as Zt, GridViewOutlined as Qt, MapOutlined as ri, BarChartOutlined as ut, TableChartOutlined as en, TagOutlined as tn, DashboardOutlined as wt, ManageSearchOutlined as li, CalendarTodayOutlined as si, DateRangeOutlined as di, TimelineOutlined as ci, BubbleChartOutlined as hi, DonutLargeOutlined as pi, ScatterPlotOutlined as ui, PieChartOutlined as mi, MultilineChartOutlined as fi, StackedBarChartOutlined as gi, StackedLineChartOutlined as xi, AreaChartOutlined as yi, AlignHorizontalLeftOutlined as bi, ShowChartOutlined as Si, TableRowsOutlined as vi, HeatPumpOutlined as Ci, ViewColumnOutlined as wi, DeleteOutline as nn, CheckCircle as Ti, Pending as Di, ViewQuiltOutlined as ki, BorderClearOutlined as Ii, DragIndicatorOutlined as zi, AddOutlined as Oi, ArrowDropDownOutlined as mt, FilterListOutlined as Pi, PreviewRounded as Ei, FolderOpenOutlined as $i, ArrowBack as Ai, NoteAddOutlined as Mi, SaveOutlined as _i, RefreshOutlined as an, StartRounded as Ri, Close as Fi, Add as Ni, InsertDriveFileOutlined as Bi, Fullscreen as Li } from "@mui/icons-material";
|
|
12
12
|
import { Box as W, Stack as ce, IconButton as Pe, CircularProgress as ft, Typography as ae, Popper as We, Grow as Ve, Paper as Re, ClickAwayListener as je, MenuList as gt, Divider as Ue, MenuItem as Ee, ListItemIcon as Ke, ListItemText as Ye, TextField as Fe, Tooltip as ke, Switch as xt, ToggleButtonGroup as on, ToggleButton as qe, Button as _t, Menu as Gi, Select as Rt, Grid as Je } from "@mui/material";
|
|
13
13
|
import { alpha as Ce, useTheme as he } from "@mui/material/styles";
|
|
14
|
-
import "
|
|
15
|
-
import { e as Hi } from "./GridLayout-BgPzzPiP.js";
|
|
14
|
+
import { e as Hi } from "./GridLayout-1gWuIKeZ.js";
|
|
16
15
|
import { G as Wi } from "./GridCardPlaceHolder-DVVT3pqn.js";
|
|
17
16
|
import { useEnvironment as rn, DashboardIcon as De, PanelIcon as Le, CloseIcon as Tt, PromptV2 as Vi, PlusIcon as yt, SearchIcon as ji, useAiChatSessionStore as Ui, useAiChatServices as Ki, ChevronIcon as Yi, EnvironmentProvider as qi, InertEnvironmentProvider as Ji, useEnvironmentOptional as Xi } from "@aintela/chat/components";
|
|
18
17
|
import Ft from "@mui/material/Stack";
|
|
@@ -3438,7 +3437,7 @@ const eo = /* @__PURE__ */ a(() => {
|
|
|
3438
3437
|
] });
|
|
3439
3438
|
}, "DashboardPinInner");
|
|
3440
3439
|
ei.displayName = "DashboardPin";
|
|
3441
|
-
const no = Be.memo(ei),
|
|
3440
|
+
const no = Be.memo(ei), _o = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3442
3441
|
__proto__: null,
|
|
3443
3442
|
CARD_TYPE_CATALOG: ve,
|
|
3444
3443
|
CATEGORY_ICONS: Dn,
|
|
@@ -3575,7 +3574,7 @@ export {
|
|
|
3575
3574
|
Ne as a7,
|
|
3576
3575
|
it as a8,
|
|
3577
3576
|
xn as a9,
|
|
3578
|
-
|
|
3577
|
+
_o as aA,
|
|
3579
3578
|
It as aa,
|
|
3580
3579
|
dn as ab,
|
|
3581
3580
|
Dt as ac,
|
|
@@ -3628,4 +3627,4 @@ export {
|
|
|
3628
3627
|
Cn as y,
|
|
3629
3628
|
mn as z
|
|
3630
3629
|
};
|
|
3631
|
-
//# sourceMappingURL=index-
|
|
3630
|
+
//# sourceMappingURL=index-DULVx84u.js.map
|