@cubejs-client/playground 0.29.24 → 0.29.33

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.
Files changed (27) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/build/asset-manifest.json +11 -10
  3. package/build/index.html +1 -1
  4. package/build/static/js/{2.2048bb82.chunk.js → 2.423113bb.chunk.js} +2 -2
  5. package/build/static/js/{2.2048bb82.chunk.js.LICENSE.txt → 2.423113bb.chunk.js.LICENSE.txt} +0 -0
  6. package/build/static/js/{3.c5c09f3d.chunk.js → 3.d6210325.chunk.js} +2 -2
  7. package/build/static/js/{3.c5c09f3d.chunk.js.LICENSE.txt → 3.d6210325.chunk.js.LICENSE.txt} +0 -0
  8. package/build/static/js/{4.c0ac086b.chunk.js → 4.f79e41d1.chunk.js} +1 -1
  9. package/build/static/js/main.1433e4ba.chunk.js +1 -0
  10. package/build/static/js/runtime-main.01351ffe.js +1 -0
  11. package/build/static/media/questdb.c7cab014.svg +53 -0
  12. package/lib/.tsbuildinfo +1 -1
  13. package/lib/{GraphiQLSandbox-8b3b8bbf.js → GraphiQLSandbox-d41ecaaf.js} +3 -3
  14. package/lib/{GraphiQLSandbox-8b3b8bbf.js.map → GraphiQLSandbox-d41ecaaf.js.map} +1 -1
  15. package/lib/antd.min.css +1 -1
  16. package/lib/components/RollupDesigner/Context.d.ts +4 -3
  17. package/lib/components/RollupDesigner/RollupDesigner.d.ts +2 -1
  18. package/lib/components/RollupDesigner/components/RollupDesignerModal.d.ts +1 -0
  19. package/lib/hooks/index.d.ts +11 -8
  20. package/lib/hooks/window-size.d.ts +6 -0
  21. package/lib/{index-fd53d684.js → index-a331125b.js} +179 -95
  22. package/lib/index-a331125b.js.map +1 -0
  23. package/lib/index.js +2 -2
  24. package/package.json +4 -4
  25. package/build/static/js/main.fbf2b3fb.chunk.js +0 -1
  26. package/build/static/js/runtime-main.fa2c5803.js +0 -1
  27. package/lib/index-fd53d684.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  import { CubejsApi, Query, TransformedQuery } from '@cubejs-client/core';
2
2
  import { AvailableMembers } from '@cubejs-client/react';
3
3
  import { ReactNode } from 'react';
4
- declare type RollupDesignerContextProps = {
4
+ declare type RollupDesignerContextValue = {
5
5
  error: Error | null;
6
6
  isLoading: boolean;
7
7
  isModalOpen: boolean;
@@ -12,12 +12,13 @@ declare type RollupDesignerContextProps = {
12
12
  transformedQuery: TransformedQuery | null;
13
13
  setTransformedQuery: (transformedQuery: TransformedQuery | null) => void;
14
14
  };
15
- export declare const Context: import("react").Context<RollupDesignerContextProps>;
15
+ export declare const Context: import("react").Context<RollupDesignerContextValue>;
16
16
  declare type ContextProps = {
17
17
  apiUrl: string;
18
18
  children: ReactNode;
19
19
  cubejsApi?: CubejsApi;
20
+ token?: string;
20
21
  };
21
22
  export declare function RollupDesignerContext({ cubejsApi, children, ...props }: ContextProps): JSX.Element;
22
- export declare function useRollupDesignerContext(): RollupDesignerContextProps;
23
+ export declare function useRollupDesignerContext(): RollupDesignerContextValue;
23
24
  export {};
@@ -2,6 +2,7 @@ import { AvailableMembers } from '@cubejs-client/react';
2
2
  declare type RollupDesignerProps = {
3
3
  apiUrl: string;
4
4
  memberTypeCubeMap: AvailableMembers;
5
+ token?: string;
5
6
  };
6
- export declare function RollupDesigner({ apiUrl, memberTypeCubeMap, }: RollupDesignerProps): JSX.Element;
7
+ export declare function RollupDesigner({ apiUrl, memberTypeCubeMap, token: designerToken, }: RollupDesignerProps): JSX.Element;
7
8
  export {};
@@ -1,5 +1,6 @@
1
1
  declare type RollupDesignerModalProps = {
2
2
  apiUrl: string;
3
+ token?: string;
3
4
  onAfterClose: () => void;
4
5
  };
5
6
  export declare function RollupDesignerModal({ onAfterClose, ...props }: RollupDesignerModalProps): JSX.Element;
@@ -1,12 +1,15 @@
1
- export * from './deep-compare-memoize';
2
- export * from './security-context';
1
+ export * from './app-context';
3
2
  export * from './cubejs-api';
4
- export * from './live-preview-context';
5
- export * from './local-storage';
6
- export * from './identifier';
7
- export * from './is-mounted';
3
+ export * from './deep-compare-memoize';
4
+ export * from './deep-dependencies';
8
5
  export * from './deep-effect';
9
6
  export * from './deep-memo';
10
- export * from './toggle';
7
+ export * from './identifier';
8
+ export * from './is-mounted';
9
+ export * from './live-preview-context';
10
+ export * from './local-storage';
11
+ export * from './security-context';
11
12
  export * from './server-core-version';
12
- export * from './app-context';
13
+ export * from './setter';
14
+ export * from './toggle';
15
+ export * from './window-size';
@@ -0,0 +1,6 @@
1
+ declare type WindowSize = {
2
+ width?: number;
3
+ height?: number;
4
+ };
5
+ export declare function useWindowSize(): WindowSize;
6
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
- import React, { createContext, useState, useContext, useRef, useMemo, useCallback, useEffect, Component, useLayoutEffect, lazy, Suspense, Fragment as Fragment$1, memo } from 'react';
2
+ import React, { createContext, useState, useContext, useCallback, useMemo, useRef, useEffect, Component, useLayoutEffect, lazy, Suspense, Fragment as Fragment$1, memo } from 'react';
3
3
  import equals from 'fast-deep-equal';
4
4
  import { BrowserRouter, Redirect, withRouter } from 'react-router-dom';
5
5
  import styled, { createGlobalStyle, ThemeProvider, css } from 'styled-components';
@@ -205,7 +205,10 @@ var VARIABLES = {
205
205
  'border-radius-base': '4px',
206
206
  'padding-lg': '16px',
207
207
  };
208
- Object.keys(colors).forEach(function (name) { return (VARIABLES["".concat(name, "-color")] = color$1(name)); });
208
+ Object.keys(colors).forEach(function (name) {
209
+ VARIABLES["".concat(name, "-color")] = color$1(name);
210
+ VARIABLES["".concat(name, "-color-rgb")] = colors[name];
211
+ });
209
212
  var LESS_VARIABLES = {};
210
213
  var CSS_PROPERTIES = {};
211
214
  Object.keys(VARIABLES).forEach(function (key) {
@@ -215,7 +218,7 @@ Object.keys(VARIABLES).forEach(function (key) {
215
218
  CSS_PROPERTIES["--".concat(key)] = VARIABLES[key];
216
219
  });
217
220
 
218
- var GlobalStyles = createGlobalStyle(templateObject_1$w || (templateObject_1$w = __makeTemplateObject(["\n body {\n ", "\n }\n\n body {\n margin: 0;\n padding: 0;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n background: var(--layout-body-background);\n overflow-x: hidden;\n }\n\n .inline-code {\n margin: 0 1px;\n padding: 0.2em 0.4em;\n font-size: 0.9em;\n background: #f2f4f5;\n border: 1px solid #eee;\n border-radius: 3px;\n }\n \n .ant-dropdown-menu::-webkit-scrollbar-track {\n background: var(--light-color);\n }\n \n .ant-dropdown-menu::-webkit-scrollbar-thumb {\n border-radius: 4px;\n background: var(--dark-03-color);\n }\n \n .ant-dropdown-menu::-webkit-scrollbar {\n width: 8px;\n height: 8px;\n } \n \n .schema-sidebar .ant-tabs-top-bar {\n padding: 0 16px;\n }\n \n .schema-sidebar .ant-menu {\n border: 0;\n }\n \n .ant-layout {\n height: 100%;\n background: var(--layout-body-background);\n }\n \n .ant-layout-header .ant-menu {\n height: 100%;\n }\n \n .ant-menu-horizontal .ant-menu-item {\n top: 0;\n height: 100%;\n }\n \n .ant-select-item.ant-select-item-option-selected:not(.ant-select-item-option-disabled) {\n color: white;\n }\n \n .ant-popover .ant-popover-inner-content {\n padding: 0;\n }\n \n \n code[class*=\"language-\"],\n pre[class*=\"language-\"] {\n color: var(--dark-01-color);\n background: none;\n /*text-shadow: 0 1px white;*/\n font-family: \"Roboto Mono\", Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;\n text-align: left;\n font-weight: normal;\n font-size: 14px;\n line-height: 20px;\n white-space: pre;\n word-spacing: normal;\n word-break: normal;\n word-wrap: normal;\n border-radius: 4px;\n border: none;\n \n -moz-tab-size: 4;\n -o-tab-size: 4;\n tab-size: 4;\n \n -webkit-hyphens: none;\n -moz-hyphens: none;\n -ms-hyphens: none;\n hyphens: none;\n }\n\n code {\n font-family: source-code-pro, Menlo, Monaco, Consolas, \"Courier New\",\n monospace;\n }\n\n .schema-sidebar,\n .schema-sidebar .ant-tabs,\n .schema-sidebar .ant-tabs-content {\n height: 100%;\n }\n\n .schema-sidebar {\n background: #fff;\n border-right: 1px solid #eee;\n padding: 0;\n }\n\n .schema-sidebar .ant-tabs-tabpane {\n /* TODO: replace with flexbox */\n height: 85%;\n overflow: auto;\n }\n\n .ant-popover-disabled-compatible-wrapper {\n pointer-events: none;\n }\n \n pre[class*=\"language-\"]::-moz-selection, pre[class*=\"language-\"] ::-moz-selection,\n code[class*=\"language-\"]::-moz-selection, code[class*=\"language-\"] ::-moz-selection {\n text-shadow: none;\n /*background: #b3d4fc;*/\n }\n \n pre[class*=\"language-\"]::selection, pre[class*=\"language-\"] ::selection,\n code[class*=\"language-\"]::selection, code[class*=\"language-\"] ::selection {\n text-shadow: none;\n /*background: #b3d4fc;*/\n }\n \n @media print {\n code[class*=\"language-\"],\n pre[class*=\"language-\"] {\n text-shadow: none;\n }\n }\n \n /* Code blocks */\n pre[class*=\"language-\"] {\n padding: 1em;\n overflow: auto;\n }\n \n :not(pre) > code[class*=\"language-\"],\n pre[class*=\"language-\"] {\n background: transparent;\n }\n \n /* Inline code */\n :not(pre) > code[class*=\"language-\"] {\n padding: .1em;\n border-radius: .3em;\n white-space: normal;\n }\n \n .token.comment,\n .token.prolog,\n .token.doctype,\n .token.cdata {\n color: var(--dark-04-color);\n }\n \n .token.punctuation {\n color: var(--dark-04-color);\n }\n \n .namespace {\n opacity: .7;\n }\n \n .token.property,\n .token.tag,\n .token.boolean,\n .token.number,\n .token.constant,\n .token.symbol,\n .token.deleted {\n color: var(--pink-color);\n }\n \n .token.selector,\n .token.attr-name,\n .token.string,\n .token.char,\n .token.builtin,\n .token.inserted {\n color: var(--purple-color);\n }\n \n .token.operator,\n .token.entity,\n .token.url,\n .language-css .token.string,\n .style .token.string {\n color: var(--dark-01-color);\n }\n \n .token.atrule,\n .token.attr-value,\n .token.keyword {\n color: var(--dark-01-color);\n }\n \n .token.atrule,\n .token.keyword {\n font-weight: 500;\n }\n \n .token.function,\n .token.class-name {\n color: var(--pink-color);\n }\n \n .token.regex,\n .token.important,\n .token.variable {\n color: var(--pink-color);\n }\n \n .token.important,\n .token.bold {\n font-weight: bold;\n }\n \n .token.italic {\n font-style: italic;\n }\n \n .token.entity {\n cursor: help;\n }\n \n .missing-member-tooltip {\n max-width: none;\n }\n \n .ant-btn-link > span {\n text-decoration: underline;\n }\n \n a.ant-typography {\n text-decoration: underline;\n }\n \n .ant-notification {\n z-index: 9999;\n }\n \n .ant-modal-header {\n padding: 16px 24px;\n }\n \n .ant-modal-body {\n padding: 24px;\n }\n"], ["\n body {\n ", "\n }\n\n body {\n margin: 0;\n padding: 0;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n background: var(--layout-body-background);\n overflow-x: hidden;\n }\n\n .inline-code {\n margin: 0 1px;\n padding: 0.2em 0.4em;\n font-size: 0.9em;\n background: #f2f4f5;\n border: 1px solid #eee;\n border-radius: 3px;\n }\n \n .ant-dropdown-menu::-webkit-scrollbar-track {\n background: var(--light-color);\n }\n \n .ant-dropdown-menu::-webkit-scrollbar-thumb {\n border-radius: 4px;\n background: var(--dark-03-color);\n }\n \n .ant-dropdown-menu::-webkit-scrollbar {\n width: 8px;\n height: 8px;\n } \n \n .schema-sidebar .ant-tabs-top-bar {\n padding: 0 16px;\n }\n \n .schema-sidebar .ant-menu {\n border: 0;\n }\n \n .ant-layout {\n height: 100%;\n background: var(--layout-body-background);\n }\n \n .ant-layout-header .ant-menu {\n height: 100%;\n }\n \n .ant-menu-horizontal .ant-menu-item {\n top: 0;\n height: 100%;\n }\n \n .ant-select-item.ant-select-item-option-selected:not(.ant-select-item-option-disabled) {\n color: white;\n }\n \n .ant-popover .ant-popover-inner-content {\n padding: 0;\n }\n \n \n code[class*=\"language-\"],\n pre[class*=\"language-\"] {\n color: var(--dark-01-color);\n background: none;\n /*text-shadow: 0 1px white;*/\n font-family: \"Roboto Mono\", Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;\n text-align: left;\n font-weight: normal;\n font-size: 14px;\n line-height: 20px;\n white-space: pre;\n word-spacing: normal;\n word-break: normal;\n word-wrap: normal;\n border-radius: 4px;\n border: none;\n \n -moz-tab-size: 4;\n -o-tab-size: 4;\n tab-size: 4;\n \n -webkit-hyphens: none;\n -moz-hyphens: none;\n -ms-hyphens: none;\n hyphens: none;\n }\n\n code {\n font-family: source-code-pro, Menlo, Monaco, Consolas, \"Courier New\",\n monospace;\n }\n\n .schema-sidebar,\n .schema-sidebar .ant-tabs,\n .schema-sidebar .ant-tabs-content {\n height: 100%;\n }\n\n .schema-sidebar {\n background: #fff;\n border-right: 1px solid #eee;\n padding: 0;\n }\n\n .schema-sidebar .ant-tabs-tabpane {\n /* TODO: replace with flexbox */\n height: 85%;\n overflow: auto;\n }\n\n .ant-popover-disabled-compatible-wrapper {\n pointer-events: none;\n }\n \n pre[class*=\"language-\"]::-moz-selection, pre[class*=\"language-\"] ::-moz-selection,\n code[class*=\"language-\"]::-moz-selection, code[class*=\"language-\"] ::-moz-selection {\n text-shadow: none;\n /*background: #b3d4fc;*/\n }\n \n pre[class*=\"language-\"]::selection, pre[class*=\"language-\"] ::selection,\n code[class*=\"language-\"]::selection, code[class*=\"language-\"] ::selection {\n text-shadow: none;\n /*background: #b3d4fc;*/\n }\n \n @media print {\n code[class*=\"language-\"],\n pre[class*=\"language-\"] {\n text-shadow: none;\n }\n }\n \n /* Code blocks */\n pre[class*=\"language-\"] {\n padding: 1em;\n overflow: auto;\n }\n \n :not(pre) > code[class*=\"language-\"],\n pre[class*=\"language-\"] {\n background: transparent;\n }\n \n /* Inline code */\n :not(pre) > code[class*=\"language-\"] {\n padding: .1em;\n border-radius: .3em;\n white-space: normal;\n }\n \n .token.comment,\n .token.prolog,\n .token.doctype,\n .token.cdata {\n color: var(--dark-04-color);\n }\n \n .token.punctuation {\n color: var(--dark-04-color);\n }\n \n .namespace {\n opacity: .7;\n }\n \n .token.property,\n .token.tag,\n .token.boolean,\n .token.number,\n .token.constant,\n .token.symbol,\n .token.deleted {\n color: var(--pink-color);\n }\n \n .token.selector,\n .token.attr-name,\n .token.string,\n .token.char,\n .token.builtin,\n .token.inserted {\n color: var(--purple-color);\n }\n \n .token.operator,\n .token.entity,\n .token.url,\n .language-css .token.string,\n .style .token.string {\n color: var(--dark-01-color);\n }\n \n .token.atrule,\n .token.attr-value,\n .token.keyword {\n color: var(--dark-01-color);\n }\n \n .token.atrule,\n .token.keyword {\n font-weight: 500;\n }\n \n .token.function,\n .token.class-name {\n color: var(--pink-color);\n }\n \n .token.regex,\n .token.important,\n .token.variable {\n color: var(--pink-color);\n }\n \n .token.important,\n .token.bold {\n font-weight: bold;\n }\n \n .token.italic {\n font-style: italic;\n }\n \n .token.entity {\n cursor: help;\n }\n \n .missing-member-tooltip {\n max-width: none;\n }\n \n .ant-btn-link > span {\n text-decoration: underline;\n }\n \n a.ant-typography {\n text-decoration: underline;\n }\n \n .ant-notification {\n z-index: 9999;\n }\n \n .ant-modal-header {\n padding: 16px 24px;\n }\n \n .ant-modal-body {\n padding: 24px;\n }\n"])), Object.entries(CSS_PROPERTIES)
221
+ var GlobalStyles = createGlobalStyle(templateObject_1$w || (templateObject_1$w = __makeTemplateObject(["\n body {\n ", "\n }\n\n body {\n margin: 0;\n padding: 0;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n background: var(--layout-body-background);\n overflow-x: hidden;\n }\n\n .inline-code {\n margin: 0 1px;\n padding: 0.2em 0.4em;\n font-size: 0.9em;\n background: #f2f4f5;\n border: 1px solid #eee;\n border-radius: 3px;\n }\n \n .ant-dropdown-menu::-webkit-scrollbar-track {\n background: var(--light-color);\n }\n \n .ant-dropdown-menu::-webkit-scrollbar-thumb {\n border-radius: 4px;\n background: var(--dark-03-color);\n }\n \n .ant-dropdown-menu::-webkit-scrollbar {\n width: 8px;\n height: 8px;\n } \n \n .schema-sidebar .ant-tabs-top-bar {\n padding: 0 16px;\n }\n \n .schema-sidebar .ant-menu {\n border: 0;\n }\n \n .ant-layout {\n height: 100%;\n background: var(--layout-body-background);\n }\n \n .ant-layout-header .ant-menu {\n height: 100%;\n }\n \n .ant-menu-horizontal .ant-menu-item {\n top: 0;\n height: 100%;\n }\n \n .ant-select-item.ant-select-item-option-selected:not(.ant-select-item-option-disabled) {\n color: white;\n }\n \n .ant-popover .ant-popover-inner-content {\n padding: 0;\n }\n \n \n code[class*=\"language-\"],\n pre[class*=\"language-\"] {\n color: var(--dark-01-color);\n background: none;\n /*text-shadow: 0 1px white;*/\n font-family: \"Roboto Mono\", Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;\n text-align: left;\n font-weight: normal;\n font-size: 14px;\n line-height: 20px;\n white-space: pre;\n word-spacing: normal;\n word-break: normal;\n word-wrap: normal;\n border-radius: 4px;\n border: none;\n \n -moz-tab-size: 4;\n -o-tab-size: 4;\n tab-size: 4;\n \n -webkit-hyphens: none;\n -moz-hyphens: none;\n -ms-hyphens: none;\n hyphens: none;\n }\n\n code {\n font-family: source-code-pro, Menlo, Monaco, Consolas, \"Courier New\",\n monospace;\n }\n\n .schema-sidebar,\n .schema-sidebar .ant-tabs,\n .schema-sidebar .ant-tabs-content {\n height: 100%;\n }\n\n .schema-sidebar {\n background: #fff;\n border-right: 1px solid #eee;\n padding: 0;\n }\n\n .schema-sidebar .ant-tabs-tabpane {\n /* TODO: replace with flexbox */\n height: 85%;\n overflow: auto;\n }\n\n .ant-popover-disabled-compatible-wrapper {\n pointer-events: none;\n }\n \n pre[class*=\"language-\"]::-moz-selection, pre[class*=\"language-\"] ::-moz-selection,\n code[class*=\"language-\"]::-moz-selection, code[class*=\"language-\"] ::-moz-selection {\n text-shadow: none;\n /*background: #b3d4fc;*/\n }\n \n pre[class*=\"language-\"]::selection, pre[class*=\"language-\"] ::selection,\n code[class*=\"language-\"]::selection, code[class*=\"language-\"] ::selection {\n text-shadow: none;\n /*background: #b3d4fc;*/\n }\n \n @media print {\n code[class*=\"language-\"],\n pre[class*=\"language-\"] {\n text-shadow: none;\n }\n }\n \n /* Code blocks */\n pre[class*=\"language-\"] {\n padding: 1em;\n overflow: auto;\n }\n \n :not(pre) > code[class*=\"language-\"],\n pre[class*=\"language-\"] {\n background: transparent;\n }\n \n /* Inline code */\n :not(pre) > code[class*=\"language-\"] {\n padding: .1em;\n border-radius: .3em;\n white-space: normal;\n }\n \n .token.comment,\n .token.prolog,\n .token.doctype,\n .token.cdata {\n color: var(--dark-04-color);\n }\n \n .token.punctuation {\n color: var(--dark-04-color);\n }\n \n .namespace {\n opacity: .7;\n }\n \n .token.property,\n .token.tag,\n .token.boolean,\n .token.number,\n .token.constant,\n .token.symbol,\n .token.deleted {\n color: var(--pink-color);\n }\n \n .token.selector,\n .token.attr-name,\n .token.string,\n .token.char,\n .token.builtin,\n .token.inserted {\n color: var(--purple-color);\n }\n \n .token.operator,\n .token.entity,\n .token.url,\n .language-css .token.string,\n .style .token.string {\n color: var(--dark-01-color);\n }\n \n .token.atrule,\n .token.attr-value,\n .token.keyword {\n color: var(--dark-01-color);\n }\n \n .token.atrule,\n .token.keyword {\n font-weight: 500;\n }\n \n .token.function,\n .token.class-name {\n color: var(--pink-color);\n }\n \n .token.regex,\n .token.important,\n .token.variable {\n color: var(--pink-color);\n }\n \n .token.important,\n .token.bold {\n font-weight: bold;\n }\n \n .token.italic {\n font-style: italic;\n }\n \n .token.entity {\n cursor: help;\n }\n \n .missing-member-tooltip {\n max-width: none;\n }\n \n .ant-btn-link > span {\n text-decoration: underline;\n }\n \n a.ant-typography {\n text-decoration: underline;\n }\n \n .ant-notification {\n z-index: 9999;\n }\n \n .ant-modal-header {\n padding: 16px 24px;\n }\n \n .ant-modal-body {\n padding: 24px;\n }\n\n // Fix close tab button styles\n .ant-tabs-dropdown {\n & .ant-tabs-dropdown-menu-item {\n display: flex;\n place-content: center space-between;\n }\n \n & button.ant-tabs-dropdown-menu-item-remove {\n -webkit-appearance: none;\n padding: 0;\n border: none;\n border-radius: var(--border-radius-base);\n background: transparent;\n color: var(--dark-color);\n cursor: pointer;\n transition: color .125s linear;\n }\n \n & button.ant-tabs-dropdown-menu-item-remove:hover {\n color: var(--purple-color);\n }\n }\n"], ["\n body {\n ", "\n }\n\n body {\n margin: 0;\n padding: 0;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n background: var(--layout-body-background);\n overflow-x: hidden;\n }\n\n .inline-code {\n margin: 0 1px;\n padding: 0.2em 0.4em;\n font-size: 0.9em;\n background: #f2f4f5;\n border: 1px solid #eee;\n border-radius: 3px;\n }\n \n .ant-dropdown-menu::-webkit-scrollbar-track {\n background: var(--light-color);\n }\n \n .ant-dropdown-menu::-webkit-scrollbar-thumb {\n border-radius: 4px;\n background: var(--dark-03-color);\n }\n \n .ant-dropdown-menu::-webkit-scrollbar {\n width: 8px;\n height: 8px;\n } \n \n .schema-sidebar .ant-tabs-top-bar {\n padding: 0 16px;\n }\n \n .schema-sidebar .ant-menu {\n border: 0;\n }\n \n .ant-layout {\n height: 100%;\n background: var(--layout-body-background);\n }\n \n .ant-layout-header .ant-menu {\n height: 100%;\n }\n \n .ant-menu-horizontal .ant-menu-item {\n top: 0;\n height: 100%;\n }\n \n .ant-select-item.ant-select-item-option-selected:not(.ant-select-item-option-disabled) {\n color: white;\n }\n \n .ant-popover .ant-popover-inner-content {\n padding: 0;\n }\n \n \n code[class*=\"language-\"],\n pre[class*=\"language-\"] {\n color: var(--dark-01-color);\n background: none;\n /*text-shadow: 0 1px white;*/\n font-family: \"Roboto Mono\", Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;\n text-align: left;\n font-weight: normal;\n font-size: 14px;\n line-height: 20px;\n white-space: pre;\n word-spacing: normal;\n word-break: normal;\n word-wrap: normal;\n border-radius: 4px;\n border: none;\n \n -moz-tab-size: 4;\n -o-tab-size: 4;\n tab-size: 4;\n \n -webkit-hyphens: none;\n -moz-hyphens: none;\n -ms-hyphens: none;\n hyphens: none;\n }\n\n code {\n font-family: source-code-pro, Menlo, Monaco, Consolas, \"Courier New\",\n monospace;\n }\n\n .schema-sidebar,\n .schema-sidebar .ant-tabs,\n .schema-sidebar .ant-tabs-content {\n height: 100%;\n }\n\n .schema-sidebar {\n background: #fff;\n border-right: 1px solid #eee;\n padding: 0;\n }\n\n .schema-sidebar .ant-tabs-tabpane {\n /* TODO: replace with flexbox */\n height: 85%;\n overflow: auto;\n }\n\n .ant-popover-disabled-compatible-wrapper {\n pointer-events: none;\n }\n \n pre[class*=\"language-\"]::-moz-selection, pre[class*=\"language-\"] ::-moz-selection,\n code[class*=\"language-\"]::-moz-selection, code[class*=\"language-\"] ::-moz-selection {\n text-shadow: none;\n /*background: #b3d4fc;*/\n }\n \n pre[class*=\"language-\"]::selection, pre[class*=\"language-\"] ::selection,\n code[class*=\"language-\"]::selection, code[class*=\"language-\"] ::selection {\n text-shadow: none;\n /*background: #b3d4fc;*/\n }\n \n @media print {\n code[class*=\"language-\"],\n pre[class*=\"language-\"] {\n text-shadow: none;\n }\n }\n \n /* Code blocks */\n pre[class*=\"language-\"] {\n padding: 1em;\n overflow: auto;\n }\n \n :not(pre) > code[class*=\"language-\"],\n pre[class*=\"language-\"] {\n background: transparent;\n }\n \n /* Inline code */\n :not(pre) > code[class*=\"language-\"] {\n padding: .1em;\n border-radius: .3em;\n white-space: normal;\n }\n \n .token.comment,\n .token.prolog,\n .token.doctype,\n .token.cdata {\n color: var(--dark-04-color);\n }\n \n .token.punctuation {\n color: var(--dark-04-color);\n }\n \n .namespace {\n opacity: .7;\n }\n \n .token.property,\n .token.tag,\n .token.boolean,\n .token.number,\n .token.constant,\n .token.symbol,\n .token.deleted {\n color: var(--pink-color);\n }\n \n .token.selector,\n .token.attr-name,\n .token.string,\n .token.char,\n .token.builtin,\n .token.inserted {\n color: var(--purple-color);\n }\n \n .token.operator,\n .token.entity,\n .token.url,\n .language-css .token.string,\n .style .token.string {\n color: var(--dark-01-color);\n }\n \n .token.atrule,\n .token.attr-value,\n .token.keyword {\n color: var(--dark-01-color);\n }\n \n .token.atrule,\n .token.keyword {\n font-weight: 500;\n }\n \n .token.function,\n .token.class-name {\n color: var(--pink-color);\n }\n \n .token.regex,\n .token.important,\n .token.variable {\n color: var(--pink-color);\n }\n \n .token.important,\n .token.bold {\n font-weight: bold;\n }\n \n .token.italic {\n font-style: italic;\n }\n \n .token.entity {\n cursor: help;\n }\n \n .missing-member-tooltip {\n max-width: none;\n }\n \n .ant-btn-link > span {\n text-decoration: underline;\n }\n \n a.ant-typography {\n text-decoration: underline;\n }\n \n .ant-notification {\n z-index: 9999;\n }\n \n .ant-modal-header {\n padding: 16px 24px;\n }\n \n .ant-modal-body {\n padding: 24px;\n }\n\n // Fix close tab button styles\n .ant-tabs-dropdown {\n & .ant-tabs-dropdown-menu-item {\n display: flex;\n place-content: center space-between;\n }\n \n & button.ant-tabs-dropdown-menu-item-remove {\n -webkit-appearance: none;\n padding: 0;\n border: none;\n border-radius: var(--border-radius-base);\n background: transparent;\n color: var(--dark-color);\n cursor: pointer;\n transition: color .125s linear;\n }\n \n & button.ant-tabs-dropdown-menu-item-remove:hover {\n color: var(--purple-color);\n }\n }\n"])), Object.entries(CSS_PROPERTIES)
219
222
  .map(function (_a) {
220
223
  var key = _a[0], value = _a[1];
221
224
  return "".concat(key, ": ").concat(value, ";");
@@ -223,16 +226,30 @@ var GlobalStyles = createGlobalStyle(templateObject_1$w || (templateObject_1$w =
223
226
  .join('\n '));
224
227
  var templateObject_1$w;
225
228
 
226
- function useDeepCompareMemoize(value) {
227
- var ref = useRef([]);
228
- if (!equals(value, ref.current)) {
229
- ref.current = value;
230
- }
231
- return ref.current;
229
+ var AppContext = createContext({});
230
+ function AppContextProvider(_a) {
231
+ var children = _a.children, contextProps = __rest(_a, ["children"]);
232
+ var _b = useState(contextProps || null), context = _b[0], setContextState = _b[1];
233
+ var setContext = useCallback(function (context) {
234
+ setContextState(function (currentContext) { return (__assign(__assign(__assign({}, currentContext), context), { playgroundContext: __assign(__assign({}, currentContext === null || currentContext === void 0 ? void 0 : currentContext.playgroundContext), context === null || context === void 0 ? void 0 : context.playgroundContext) })); });
235
+ }, []);
236
+ return (jsx(AppContext.Provider, __assign({ value: __assign(__assign({ apiUrl: null, schemaVersion: 0, ready: false }, context), { token: (context === null || context === void 0 ? void 0 : context.token) || null, playgroundContext: (context === null || context === void 0 ? void 0 : context.playgroundContext) || {}, setContext: setContext }) }, { children: children }), void 0));
232
237
  }
233
238
 
234
- function useSecurityContext() {
235
- return useContext(SecurityContextContext);
239
+ function useAppContext() {
240
+ return useContext(AppContext);
241
+ }
242
+ function usePlaygroundContext() {
243
+ var playgroundContext = useAppContext().playgroundContext;
244
+ return playgroundContext;
245
+ }
246
+ function useIsCloud() {
247
+ var playgroundContext = useAppContext().playgroundContext;
248
+ return (playgroundContext === null || playgroundContext === void 0 ? void 0 : playgroundContext.isCloud) || false;
249
+ }
250
+ function useToken() {
251
+ var token = useAppContext().token;
252
+ return token;
236
253
  }
237
254
 
238
255
  function useCubejsApi(apiUrl, token) {
@@ -246,6 +263,48 @@ function useCubejsApi(apiUrl, token) {
246
263
  }, [apiUrl, token]);
247
264
  }
248
265
 
266
+ function useDeepCompareMemoize(value) {
267
+ var ref = useRef([]);
268
+ if (!equals(value, ref.current)) {
269
+ ref.current = value;
270
+ }
271
+ return ref.current;
272
+ }
273
+
274
+ function useDeepDependencies(dependencies) {
275
+ var memo = useRef();
276
+ if (!equals(memo.current, dependencies)) {
277
+ memo.current = dependencies;
278
+ }
279
+ return memo.current;
280
+ }
281
+
282
+ function useDeepEffect(callback, dependencies) {
283
+ var memoizedDependencies = useDeepDependencies(dependencies);
284
+ return useEffect(callback, memoizedDependencies);
285
+ }
286
+
287
+ function useDeepMemo(callback, dependencies) {
288
+ var memoizedDependencies = useDeepDependencies(dependencies);
289
+ return useMemo(callback, memoizedDependencies);
290
+ }
291
+
292
+ function useIdentifier() {
293
+ var identifier = useAppContext().identifier;
294
+ return identifier || '';
295
+ }
296
+
297
+ function useIsMounted() {
298
+ var isMountedRef = useRef(true);
299
+ var isMounted = useCallback(function () { return isMountedRef.current; }, []);
300
+ useEffect(function () {
301
+ return function () {
302
+ isMountedRef.current = false;
303
+ };
304
+ }, []);
305
+ return isMounted;
306
+ }
307
+
249
308
  function getNameMemberPairs(members) {
250
309
  var items = [];
251
310
  members.forEach(function (cube) {
@@ -312,37 +371,6 @@ function useLivePreviewContext() {
312
371
  return useContext(LivePreviewContextContext);
313
372
  }
314
373
 
315
- var AppContext = createContext({});
316
- function AppContextProvider(_a) {
317
- var children = _a.children, contextProps = __rest(_a, ["children"]);
318
- var _b = useState(contextProps || null), context = _b[0], setContextState = _b[1];
319
- var setContext = useCallback(function (context) {
320
- setContextState(function (currentContext) { return (__assign(__assign(__assign({}, currentContext), context), { playgroundContext: __assign(__assign({}, currentContext === null || currentContext === void 0 ? void 0 : currentContext.playgroundContext), context === null || context === void 0 ? void 0 : context.playgroundContext) })); });
321
- }, []);
322
- return (jsx(AppContext.Provider, __assign({ value: __assign(__assign({ apiUrl: null, schemaVersion: 0, ready: false }, context), { token: (context === null || context === void 0 ? void 0 : context.token) || null, playgroundContext: (context === null || context === void 0 ? void 0 : context.playgroundContext) || {}, setContext: setContext }) }, { children: children }), void 0));
323
- }
324
-
325
- function useAppContext() {
326
- return useContext(AppContext);
327
- }
328
- function usePlaygroundContext() {
329
- var playgroundContext = useAppContext().playgroundContext;
330
- return playgroundContext;
331
- }
332
- function useIsCloud() {
333
- var playgroundContext = useAppContext().playgroundContext;
334
- return (playgroundContext === null || playgroundContext === void 0 ? void 0 : playgroundContext.isCloud) || false;
335
- }
336
- function useToken() {
337
- var token = useAppContext().token;
338
- return token;
339
- }
340
-
341
- function useIdentifier() {
342
- var identifier = useAppContext().identifier;
343
- return identifier || '';
344
- }
345
-
346
374
  var storage = new (/** @class */ (function () {
347
375
  function Storage() {
348
376
  var _this = this;
@@ -426,39 +454,8 @@ function useLocalStorage(itemKey, defaultValue) {
426
454
  }, [key, value]);
427
455
  }
428
456
 
429
- function useIsMounted() {
430
- var isMountedRef = useRef(true);
431
- var isMounted = useCallback(function () { return isMountedRef.current; }, []);
432
- useEffect(function () {
433
- return function () {
434
- isMountedRef.current = false;
435
- };
436
- }, []);
437
- return isMounted;
438
- }
439
-
440
- function useDeepDependencies(dependencies) {
441
- var memo = useRef();
442
- if (!equals(memo.current, dependencies)) {
443
- memo.current = dependencies;
444
- }
445
- return memo.current;
446
- }
447
-
448
- function useDeepEffect(callback, dependencies) {
449
- var memoizedDependencies = useDeepDependencies(dependencies);
450
- return useEffect(callback, memoizedDependencies);
451
- }
452
-
453
- function useDeepMemo(callback, dependencies) {
454
- var memoizedDependencies = useDeepDependencies(dependencies);
455
- return useMemo(callback, memoizedDependencies);
456
- }
457
-
458
- function useToggle(defaultValue) {
459
- if (defaultValue === void 0) { defaultValue = false; }
460
- var _a = useState(defaultValue), isOn = _a[0], toggle = _a[1];
461
- return [isOn, function () { return toggle(function (value) { return !value; }); }];
457
+ function useSecurityContext() {
458
+ return useContext(SecurityContextContext);
462
459
  }
463
460
 
464
461
  function useServerCoreVersionGte(version) {
@@ -477,6 +474,48 @@ function useServerCoreVersionGte(version) {
477
474
  return gt;
478
475
  }
479
476
 
477
+ function useSetter(setter, initialValue) {
478
+ var _a = useState(setter(initialValue)), state = _a[0], setValue = _a[1];
479
+ return [
480
+ state,
481
+ function (value) {
482
+ setValue(setter(state, value));
483
+ },
484
+ ];
485
+ }
486
+
487
+ function useToggle(defaultValue) {
488
+ if (defaultValue === void 0) { defaultValue = false; }
489
+ var _a = useState(defaultValue), isOn = _a[0], toggle = _a[1];
490
+ return [isOn, function () { return toggle(function (value) { return !value; }); }];
491
+ }
492
+
493
+ function useWindowSize() {
494
+ // Initialize state with undefined width/height so server and client renders match
495
+ // Learn more here: https://joshwcomeau.com/react/the-perils-of-rehydration/
496
+ var _a = useState({
497
+ width: undefined,
498
+ height: undefined,
499
+ }), windowSize = _a[0], setWindowSize = _a[1];
500
+ useEffect(function () {
501
+ // Handler to call on window resize
502
+ function handleResize() {
503
+ // Set window width/height to state
504
+ setWindowSize({
505
+ width: window.innerWidth,
506
+ height: window.innerHeight,
507
+ });
508
+ }
509
+ // Add event listener
510
+ window.addEventListener('resize', handleResize);
511
+ // Call handler right away so state gets updated with initial window size
512
+ handleResize();
513
+ // Remove event listener on cleanup
514
+ return function () { return window.removeEventListener('resize', handleResize); };
515
+ }, []); // Empty array ensures that effect is only run on mount
516
+ return windowSize;
517
+ }
518
+
480
519
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
481
520
 
482
521
  var pretty = function(jsObject, indentLength, outputTo, fullFunction) {
@@ -4308,7 +4347,7 @@ var Link = Typography.Link;
4308
4347
  function RollupDesignerModal(_a) {
4309
4348
  var onAfterClose = _a.onAfterClose, props = __rest(_a, ["onAfterClose"]);
4310
4349
  var _b = useRollupDesignerContext(), isModalOpen = _b.isModalOpen, toggleModal = _b.toggleModal, memberTypeCubeMap = _b.memberTypeCubeMap;
4311
- return (jsx(Modal, __assign({ title: "Rollup Designer", visible: isModalOpen, bodyStyle: { padding: 0 }, destroyOnClose: true, wrapClassName: "rollup-designer", footer: jsx(Link, __assign({ href: "https://cube.dev/docs/caching/pre-aggregations/getting-started", target: "_blank" }, { children: jsxs(Flex, __assign({ justifyContent: "center", gap: 1 }, { children: [jsx(Box, { children: jsx(InfoCircleOutlined, {}, void 0) }, void 0), jsx(Box, { children: "Further reading about pre-aggregations for reference." }, void 0), jsx(Box, { children: jsx(ArrowRightOutlined, {}, void 0) }, void 0)] }), void 0) }), void 0), width: 1190, afterClose: onAfterClose, onCancel: function () { return toggleModal(); } }, { children: jsx("div", __assign({ "data-testid": "rd-modal" }, { children: jsx(RollupDesigner, { apiUrl: props.apiUrl, memberTypeCubeMap: memberTypeCubeMap }, void 0) }), void 0) }), void 0));
4350
+ return (jsx(Modal, __assign({ title: "Rollup Designer", visible: isModalOpen, bodyStyle: { padding: 0 }, destroyOnClose: true, wrapClassName: "rollup-designer", footer: jsx(Link, __assign({ href: "https://cube.dev/docs/caching/pre-aggregations/getting-started", target: "_blank" }, { children: jsxs(Flex, __assign({ justifyContent: "center", gap: 1 }, { children: [jsx(Box, { children: jsx(InfoCircleOutlined, {}, void 0) }, void 0), jsx(Box, { children: "Further reading about pre-aggregations for reference." }, void 0), jsx(Box, { children: jsx(ArrowRightOutlined, {}, void 0) }, void 0)] }), void 0) }), void 0), width: 1190, afterClose: onAfterClose, onCancel: function () { return toggleModal(); } }, { children: jsx("div", __assign({ "data-testid": "rd-modal" }, { children: jsx(RollupDesigner, { apiUrl: props.apiUrl, token: props.token, memberTypeCubeMap: memberTypeCubeMap }, void 0) }), void 0) }), void 0));
4312
4351
  }
4313
4352
 
4314
4353
  var Context = createContext({});
@@ -4368,13 +4407,13 @@ function RollupDesignerContext(_a) {
4368
4407
  setTransformedQuery: setTransformedQuery,
4369
4408
  memberTypeCubeMap: memberTypeCubeMap,
4370
4409
  error: error,
4371
- } }, { children: [children, jsx(RollupDesignerModal, { apiUrl: props.apiUrl, onAfterClose: reset }, void 0)] }), void 0));
4410
+ } }, { children: [children, jsx(RollupDesignerModal, { apiUrl: props.apiUrl, token: props.token, onAfterClose: reset }, void 0)] }), void 0));
4372
4411
  }
4373
4412
  function useRollupDesignerContext() {
4374
4413
  return useContext(Context);
4375
4414
  }
4376
4415
 
4377
- var Paragraph = Typography.Paragraph; Typography.Link; var Text$1 = Typography.Text;
4416
+ var Paragraph = Typography.Paragraph, Text$1 = Typography.Text;
4378
4417
  var TabPane = Tabs.TabPane;
4379
4418
  var Wrapper$2 = styled.div(templateObject_1$f || (templateObject_1$f = __makeTemplateObject(["\n display: grid;\n grid-template-columns: 1fr 400px;\n gap: 16px;\n"], ["\n display: grid;\n grid-template-columns: 1fr 400px;\n gap: 16px;\n"])));
4380
4419
  var MainBox = styled(Box)(templateObject_2$5 || (templateObject_2$5 = __makeTemplateObject(["\n & .ant-tabs-nav {\n padding-left: 24px;\n margin: 0;\n }\n"], ["\n & .ant-tabs-nav {\n padding-left: 24px;\n margin: 0;\n }\n"])));
@@ -4397,25 +4436,27 @@ function getSelectedKeys(references) {
4397
4436
  }
4398
4437
  function RollupDesigner(_a) {
4399
4438
  var _b, _c;
4400
- var apiUrl = _a.apiUrl, memberTypeCubeMap = _a.memberTypeCubeMap;
4439
+ var apiUrl = _a.apiUrl, memberTypeCubeMap = _a.memberTypeCubeMap, designerToken = _a.token;
4401
4440
  var isMounted = useIsMounted();
4402
- var token = useToken();
4441
+ var appToken = useToken();
4442
+ var token = appToken || designerToken;
4403
4443
  var _d = useCloud(), isCloud = _d.isCloud, cloud = __rest(_d, ["isCloud"]);
4404
4444
  var _e = useRollupDesignerContext(), query = _e.query, transformedQuery = _e.transformedQuery, isLoading = _e.isLoading, error = _e.error;
4405
4445
  var _f = useState(true), isCronValid = _f[0], setCronValidity = _f[1];
4406
4446
  var _g = useState({}), settings = _g[0], setSettings = _g[1];
4407
4447
  var _h = useState([]), openKeys = _h[0], setOpenKeys = _h[1];
4408
4448
  var _j = useState(null), firstOpenCubeName = _j[0], setFirstOpenCubeName = _j[1];
4409
- Boolean(transformedQuery === null || transformedQuery === void 0 ? void 0 : transformedQuery.leafMeasureAdditive);
4410
4449
  var _k = useState(true), matching = _k[0], setMatching = _k[1];
4411
4450
  var _l = useState(false), saving = _l[0], setSaving = _l[1];
4412
4451
  var _m = useState('main'), preAggName = _m[0], setPreAggName = _m[1];
4413
- var _o = query || {}; _o.order; _o.limit; _o.filters; var matchedQuery = __rest(_o, ["order", "limit", "filters"]);
4452
+ var _o = useState(null), nonAdditiveMeasure = _o[0], setNonAdditiveMeasure = _o[1];
4453
+ var _p = query || {}; _p.order; _p.limit; _p.filters; var matchedQuery = __rest(_p, ["order", "limit", "filters"]);
4414
4454
  var timeDimension = (matchedQuery.timeDimensions || [])[0];
4415
4455
  // There's nothing we can do to for a rollup to match such query
4416
- var hideMatchRollupButton = (timeDimension === null || timeDimension === void 0 ? void 0 : timeDimension.dimension) &&
4456
+ var hideMatchRollupButton = ((timeDimension === null || timeDimension === void 0 ? void 0 : timeDimension.dimension) &&
4417
4457
  !(timeDimension === null || timeDimension === void 0 ? void 0 : timeDimension.dateRange) &&
4418
- !(timeDimension === null || timeDimension === void 0 ? void 0 : timeDimension.granularity);
4458
+ !(timeDimension === null || timeDimension === void 0 ? void 0 : timeDimension.granularity)) ||
4459
+ (transformedQuery && !transformedQuery.leafMeasureAdditive);
4419
4460
  var segments = new Set();
4420
4461
  memberTypeCubeMap.segments.forEach(function (_a) {
4421
4462
  var members = _a.members;
@@ -4424,13 +4465,22 @@ function RollupDesigner(_a) {
4424
4465
  return segments.add(name);
4425
4466
  });
4426
4467
  });
4427
- var _p = useState(getPreAggregationReferences(transformedQuery, segments)), references = _p[0], setReferences = _p[1];
4468
+ var _q = useState(getPreAggregationReferences(transformedQuery, segments)), references = _q[0], setReferences = _q[1];
4428
4469
  useDeepEffect(function () {
4429
4470
  var references = getPreAggregationReferences(transformedQuery, segments);
4430
4471
  setReferences(references);
4431
4472
  var openKeys = getSelectedKeys(references).map(function (key) { return key.split('.')[0]; });
4432
4473
  setOpenKeys(openKeys);
4433
4474
  setFirstOpenCubeName(openKeys[0] || null);
4475
+ if ((transformedQuery === null || transformedQuery === void 0 ? void 0 : transformedQuery.measureToLeafMeasures) != null) {
4476
+ for (var _i = 0, _a = Object.entries(transformedQuery.measureToLeafMeasures); _i < _a.length; _i++) {
4477
+ var _b = _a[_i], measure = _b[0], leafMeasures = _b[1];
4478
+ if (leafMeasures.length > 1) {
4479
+ setNonAdditiveMeasure(measure);
4480
+ break;
4481
+ }
4482
+ }
4483
+ }
4434
4484
  }, [transformedQuery, segments]);
4435
4485
  var selectedKeys = useDeepMemo(function () {
4436
4486
  var selectedKeys = getSelectedKeys(references);
@@ -4483,6 +4533,28 @@ function RollupDesigner(_a) {
4483
4533
  }
4484
4534
  return cubeName;
4485
4535
  }, [transformedQuery, references]);
4536
+ var _r = useDeepMemo(function () {
4537
+ var _a = (transformedQuery || {}).measureToLeafMeasures, measureToLeafMeasures = _a === void 0 ? {} : _a;
4538
+ var showDecomposedMeasureAlert = false;
4539
+ var showNonAdditiveMeasureAlert = false;
4540
+ if (nonAdditiveMeasure && measureToLeafMeasures[nonAdditiveMeasure]) {
4541
+ showDecomposedMeasureAlert = measureToLeafMeasures[nonAdditiveMeasure].every(function (_a) {
4542
+ var additive = _a.additive;
4543
+ return additive;
4544
+ });
4545
+ }
4546
+ if (transformedQuery && !(transformedQuery === null || transformedQuery === void 0 ? void 0 : transformedQuery.leafMeasureAdditive)) {
4547
+ var allLeafMeasures_1 = Object.values(measureToLeafMeasures).reduce(function (memo, leafMeasures) { return __spreadArray(__spreadArray([], memo, true), leafMeasures, true); }, []);
4548
+ showNonAdditiveMeasureAlert = references.measures.some(function (measure) {
4549
+ var leafMeasure = allLeafMeasures_1.find(function (leafMeasure) { return leafMeasure.measure === measure; });
4550
+ if (!leafMeasure) {
4551
+ return false;
4552
+ }
4553
+ return !leafMeasure.additive;
4554
+ });
4555
+ }
4556
+ return [showDecomposedMeasureAlert, showNonAdditiveMeasureAlert];
4557
+ }, [references, transformedQuery, nonAdditiveMeasure]), showDecomposedMeasureAlert = _r[0], showNonAdditiveMeasureAlert = _r[1];
4486
4558
  var indexedMembers = Object.fromEntries(getNameMemberPairs(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], memberTypeCubeMap.measures, true), memberTypeCubeMap.dimensions, true), memberTypeCubeMap.timeDimensions, true), memberTypeCubeMap.segments, true)));
4487
4559
  function handleAddToSchemaClick() {
4488
4560
  return __awaiter(this, void 0, void 0, function () {
@@ -4554,7 +4626,10 @@ function RollupDesigner(_a) {
4554
4626
  .code, copyMessage: "Rollup definition is copied", theme: "light" }, void 0), cubeName ? (jsx(Button, __assign({ "data-testid": "rd-add-btn", type: "primary", loading: saving, disabled: !isCronValid, style: { width: '100%' }, onClick: handleAddToSchemaClick }, { children: "Add to the Data Schema" }), void 0)) : null] }, void 0));
4555
4627
  }
4556
4628
  if (isLoading) {
4557
- return (jsxs(Flex, __assign({ gap: 4, style: { margin: 24 } }, { children: [jsx(Box, __assign({ style: { minWidth: 256 } }, { children: jsx(Skeleton, {}, void 0) }), void 0), jsxs(Box, __assign({ grow: 1 }, { children: [jsx(Skeleton, {}, void 0), jsx(Skeleton, {}, void 0)] }), void 0), jsx(Box, __assign({ style: { width: 420, minWidth: 420 } }, { children: jsx(Skeleton, {}, void 0) }), void 0)] }), void 0));
4629
+ return (jsxs(Flex, __assign({ gap: 4, style: { margin: 24 } }, { children: [jsx(Box, __assign({ style: { minWidth: 256 } }, { children: jsx(Skeleton, {}, void 0) }), void 0), jsxs(Box, __assign({ grow: 1 }, { children: [jsx(Skeleton, {}, void 0), jsx(Skeleton, {}, void 0)] }), void 0), jsx(Box, __assign({ style: {
4630
+ width: 420,
4631
+ minWidth: 420,
4632
+ } }, { children: jsx(Skeleton, {}, void 0) }), void 0)] }), void 0));
4558
4633
  }
4559
4634
  if (error) {
4560
4635
  return (jsx("div", __assign({ style: { margin: '32px 24px' } }, { children: jsx(FatalError, { error: error }, void 0) }), void 0));
@@ -4573,8 +4648,8 @@ function RollupDesigner(_a) {
4573
4648
  ] }));
4574
4649
  }, onRemove: handleMemberToggle('timeDimensions') }, void 0)) : null] }), void 0)] }), void 0) }), "members"), jsx(TabPane, __assign({ tab: jsx("span", __assign({ "data-testid": "rd-settings-tab" }, { children: "Settings" }), void 0) }, { children: jsx(Settings$1, { hasTimeDimension: references.timeDimensions.length > 0, members: references.measures
4575
4650
  .concat(references.dimensions)
4576
- .concat(references.timeDimensions.map(function (td) { return td.dimension; })), onCronExpressionValidityChange: setCronValidity, onChange: function (values) { return setSettings(buildSettings(values)); } }, void 0) }), "settings")] }), void 0) }), void 0), jsx(RollupQueryBox, { children: jsxs(Tabs, { children: [jsx(TabPane, __assign({ tab: jsx("span", __assign({ "data-testid": "rd-definition-tab" }, { children: "Rollup Definition" }), void 0) }, { children: jsxs(Flex, __assign({ direction: "column", justifyContent: "flex-start" }, { children: [!areReferencesEmpty(references) &&
4577
- !references.timeDimensions.length && (jsx(Box, __assign({ style: { marginBottom: 24 } }, { children: jsx(Alert$1, { type: "warning", message: "This rollup has no time dimension so it cannot be partitioned" }, void 0) }), void 0)), (jsxs(Box, __assign({ style: { marginBottom: 16 } }, { children: [!areReferencesEmpty(references) ? (jsxs(Paragraph, { children: ["Add the following rollup pre-aggregation", jsx("br", {}, void 0), " to the ", jsx("b", { children: cubeName }, void 0), " cube:"] }, void 0)) : (jsx(Alert$1, { type: "warning", message: "Add some references" }, void 0)), jsx(Paragraph, __assign({ style: { margin: '24px 0 4px' } }, { children: "Rollup Name" }), void 0), jsx(Input, { value: preAggName, suffix: jsx(EditOutlined, {}, void 0), onChange: function (event) { return setPreAggName(event.target.value); } }, void 0)] }), void 0)) , jsx(Box, { children: rollupBody() }, void 0)] }), void 0) }), "rollup"), isQueryPresent(query) ? (jsx(TabPane, __assign({ tab: matching ? (jsx("span", __assign({ "data-testid": "rd-query-tab" }, { children: "Query Compatibility" }), void 0)) : (jsxs(Typography.Text, __assign({ "data-testid": "rd-query-tab" }, { children: ["Query Compatibility", jsx(WarningFilled, { style: { color: '#FBBC05' } }, void 0)] }), void 0)) }, { children: jsxs(Flex, __assign({ direction: "column", justifyContent: "flex-start" }, { children: [jsx(Box, __assign({ style: { marginBottom: 32 } }, { children: matching ? (jsx(Text$1, { children: "This rollup will match the following query:" }, void 0)) : (jsxs(Space, __assign({ direction: "vertical" }, { children: [jsx(Alert$1, { "data-testid": "rd-incompatible-query", type: "warning", message: jsxs(Text$1, { children: ["This rollup does ", jsx("b", { children: "NOT" }, void 0), " match the following query:"] }, void 0) }, void 0), !hideMatchRollupButton && (jsx(Button, __assign({ "data-testid": "rd-match-rollup-btn", type: "primary", ghost: true, onClick: function () {
4651
+ .concat(references.timeDimensions.map(function (td) { return td.dimension; })), onCronExpressionValidityChange: setCronValidity, onChange: function (values) { return setSettings(buildSettings(values)); } }, void 0) }), "settings")] }), void 0) }), void 0), jsx(RollupQueryBox, { children: jsxs(Tabs, { children: [jsx(TabPane, __assign({ tab: jsx("span", __assign({ "data-testid": "rd-definition-tab" }, { children: "Rollup Definition" }), void 0) }, { children: jsxs(Flex, __assign({ direction: "column", justifyContent: "flex-start" }, { children: [showNonAdditiveMeasureAlert && (jsx(Box, __assign({ style: { marginBottom: 24 } }, { children: jsx(Alert$1, { type: "info", message: jsx(Text$1, { children: "This rollup contains a non-additive measure" }, void 0) }, void 0) }), void 0)), showDecomposedMeasureAlert && (jsx(Box, __assign({ style: { marginBottom: 24 } }, { children: jsx(Alert$1, { type: "info", message: jsxs(Text$1, { children: ["Because ", jsx("b", { children: nonAdditiveMeasure }, void 0), " is a non-additive measure that is calculated with additive measures, this rollup is configured with the additive measures that calculate this non-additive measure. See more info in", ' ', jsx(Typography.Link, __assign({ href: "https://cube.dev/docs/recipes/non-additivity#data-schema-decomposing-into-a-formula-with-additive-measures", target: "_blank" }, { children: "our docs" }), void 0), "."] }, void 0) }, void 0) }), void 0)), !areReferencesEmpty(references) &&
4652
+ !references.timeDimensions.length && (jsx(Box, __assign({ style: { marginBottom: 24 } }, { children: jsx(Alert$1, { type: "warning", message: "This rollup has no time dimension so it cannot be partitioned" }, void 0) }), void 0)), jsxs(Box, __assign({ style: { marginBottom: 16 } }, { children: [!areReferencesEmpty(references) ? (jsxs(Paragraph, { children: ["Add the following rollup pre-aggregation", jsx("br", {}, void 0), " to the ", jsx("b", { children: cubeName }, void 0), " cube:"] }, void 0)) : (jsx(Alert$1, { type: "warning", message: "Add some references" }, void 0)), jsx(Paragraph, __assign({ style: { margin: '24px 0 4px' } }, { children: "Rollup Name" }), void 0), jsx(Input, { value: preAggName, suffix: jsx(EditOutlined, {}, void 0), onChange: function (event) { return setPreAggName(event.target.value); } }, void 0)] }), void 0), jsx(Box, { children: rollupBody() }, void 0)] }), void 0) }), "rollup"), isQueryPresent(query) ? (jsx(TabPane, __assign({ tab: matching ? (jsx("span", __assign({ "data-testid": "rd-query-tab" }, { children: "Query Compatibility" }), void 0)) : (jsxs(Typography.Text, __assign({ "data-testid": "rd-query-tab" }, { children: ["Query Compatibility", jsx(WarningFilled, { style: { color: '#FBBC05' } }, void 0)] }), void 0)) }, { children: jsxs(Flex, __assign({ direction: "column", justifyContent: "flex-start" }, { children: [jsx(Box, __assign({ style: { marginBottom: 32 } }, { children: matching ? (jsx(Text$1, { children: "This rollup will match the following query:" }, void 0)) : (jsxs(Space, __assign({ direction: "vertical" }, { children: [jsx(Alert$1, { "data-testid": "rd-incompatible-query", type: "warning", message: jsxs(Text$1, { children: ["This rollup does ", jsx("b", { children: "NOT" }, void 0), " match the following query:"] }, void 0) }, void 0), !hideMatchRollupButton && (jsx(Button, __assign({ "data-testid": "rd-match-rollup-btn", type: "primary", ghost: true, onClick: function () {
4578
4653
  setReferences(getPreAggregationReferences(transformedQuery, segments));
4579
4654
  setMatching(true);
4580
4655
  } }, { children: "Match Rollup" }), void 0))] }), void 0)) }), void 0), jsx(CodeSnippet, { style: { minWidth: 200 }, code: prettifyObject(matchedQuery), copyMessage: "Query is copied", theme: "light" }, void 0)] }), void 0) }), "query")) : null] }, void 0) }, void 0)] }, void 0));
@@ -6300,7 +6375,7 @@ var GraphQLIcon = function () {
6300
6375
  return (jsx(Icon, { component: function () { return (jsx("svg", __assign({ version: "1.1", height: "1em", width: "1em", x: "0px", y: "0px", viewBox: "0 0 400 400", "enable-background": "new 0 0 400 400", fill: "currentColor" }, { children: jsxs("g", { children: [jsx("rect", { x: "122", y: "-0.4", transform: "matrix(-0.866 -0.5 0.5 -0.866 163.3196 363.3136)", width: "16.6", height: "320.3" }, void 0), jsx("rect", { x: "39.8", y: "272.2", width: "320.3", height: "16.6" }, void 0), jsx("rect", { x: "37.9", y: "312.2", transform: "matrix(-0.866 -0.5 0.5 -0.866 83.0693 663.3409)", width: "185", height: "16.6" }, void 0), jsx("rect", { x: "177.1", y: "71.1", transform: "matrix(-0.866 -0.5 0.5 -0.866 463.3409 283.0693)", width: "185", height: "16.6" }, void 0), jsx("rect", { x: "122.1", y: "-13", transform: "matrix(-0.5 -0.866 0.866 -0.5 126.7903 232.1221)", width: "16.6", height: "185" }, void 0), jsx("rect", { x: "109.6", y: "151.6", transform: "matrix(-0.5 -0.866 0.866 -0.5 266.0828 473.3766)", width: "320.3", height: "16.6" }, void 0), jsx("rect", { x: "52.5", y: "107.5", width: "16.6", height: "185" }, void 0), jsx("rect", { x: "330.9", y: "107.5", width: "16.6", height: "185" }, void 0), jsx("rect", { x: "262.4", y: "240.1", transform: "matrix(-0.5 -0.866 0.866 -0.5 126.7953 714.2875)", width: "14.5", height: "160.9" }, void 0), jsx("path", { d: "M369.5,297.9c-9.6,16.7-31,22.4-47.7,12.8c-16.7-9.6-22.4-31-12.8-47.7c9.6-16.7,31-22.4,47.7-12.8 C373.5,259.9,379.2,281.2,369.5,297.9" }, void 0), jsx("path", { d: "M90.9,137c-9.6,16.7-31,22.4-47.7,12.8c-16.7-9.6-22.4-31-12.8-47.7c9.6-16.7,31-22.4,47.7-12.8 C94.8,99,100.5,120.3,90.9,137" }, void 0), jsx("path", { d: "M30.5,297.9c-9.6-16.7-3.9-38,12.8-47.7c16.7-9.6,38-3.9,47.7,12.8c9.6,16.7,3.9,38-12.8,47.7 C61.4,320.3,40.1,314.6,30.5,297.9" }, void 0), jsx("path", { d: "M309.1,137c-9.6-16.7-3.9-38,12.8-47.7c16.7-9.6,38-3.9,47.7,12.8c9.6,16.7,3.9,38-12.8,47.7 C340.1,159.4,318.7,153.7,309.1,137" }, void 0), jsx("path", { d: "M200,395.8c-19.3,0-34.9-15.6-34.9-34.9c0-19.3,15.6-34.9,34.9-34.9c19.3,0,34.9,15.6,34.9,34.9 C234.9,380.1,219.3,395.8,200,395.8" }, void 0), jsx("path", { d: "M200,74c-19.3,0-34.9-15.6-34.9-34.9c0-19.3,15.6-34.9,34.9-34.9c19.3,0,34.9,15.6,34.9,34.9 C234.9,58.4,219.3,74,200,74" }, void 0)] }, void 0) }), void 0)); } }, void 0));
6301
6376
  };
6302
6377
 
6303
- var GraphiQLSandbox = lazy(function () { return import('./GraphiQLSandbox-8b3b8bbf.js'); });
6378
+ var GraphiQLSandbox = lazy(function () { return import('./GraphiQLSandbox-d41ecaaf.js'); });
6304
6379
  var frameworkToTemplate = {
6305
6380
  react: 'create-react-app',
6306
6381
  angular: 'angular-cli',
@@ -6605,8 +6680,17 @@ var Wrapper$1 = styled.div(templateObject_5 || (templateObject_5 = __makeTemplat
6605
6680
  function ChartRenderer(_a) {
6606
6681
  var queryId = _a.queryId, areQueriesEqual = _a.areQueriesEqual, isFetchingMeta = _a.isFetchingMeta, iframeRef = _a.iframeRef, framework = _a.framework, queryHasMissingMembers = _a.queryHasMissingMembers, onRunButtonClick = _a.onRunButtonClick;
6607
6682
  var cubejsApi = useContext(CubeContext).cubejsApi;
6608
- var _b = useChartRendererState(queryId), isChartRendererReady = _b.isChartRendererReady, isQueryLoading = _b.isQueryLoading, resultSetExists = _b.resultSetExists, queryError = _b.queryError, isBuildInProgress = _b.isBuildInProgress, slowQuery = _b.slowQuery, slowQueryFromCache = _b.slowQueryFromCache;
6609
- var _c = useChartRendererStateMethods(), setResultSetExists = _c.setResultSetExists, setChartRendererReady = _c.setChartRendererReady, setQueryError = _c.setQueryError;
6683
+ var _b = useState('auto'), containerSize = _b[0], setContainerSize = _b[1];
6684
+ useWindowSize(); // triggers the following useEffect() on window size change
6685
+ useEffect(function () {
6686
+ if (iframeRef === null || iframeRef === void 0 ? void 0 : iframeRef.current) {
6687
+ var container = iframeRef === null || iframeRef === void 0 ? void 0 : iframeRef.current;
6688
+ var height = window.innerHeight - container.getBoundingClientRect().y - 40;
6689
+ setContainerSize("".concat(height, "px"));
6690
+ }
6691
+ }); // no deps, it's better to re-check position on every render
6692
+ var _c = useChartRendererState(queryId), isChartRendererReady = _c.isChartRendererReady, isQueryLoading = _c.isQueryLoading, resultSetExists = _c.resultSetExists, queryError = _c.queryError, isBuildInProgress = _c.isBuildInProgress, slowQuery = _c.slowQuery, slowQueryFromCache = _c.slowQueryFromCache;
6693
+ var _d = useChartRendererStateMethods(), setResultSetExists = _d.setResultSetExists, setChartRendererReady = _d.setChartRendererReady, setQueryError = _d.setQueryError;
6610
6694
  var runButtonRef = useRef(null);
6611
6695
  // for you, ovr :)
6612
6696
  useHotkeys('cmd+enter', function () {
@@ -6655,7 +6739,7 @@ function ChartRenderer(_a) {
6655
6739
  : slowQueryFromCache
6656
6740
  ? "This query takes more than 5 seconds to execute. It was served from the cache because Cube.js wasn't able to renew it in less than 5 seconds. Please consider using pre-aggregations to improve its performance. "
6657
6741
  : '';
6658
- return (jsxs(Fragment, { children: [(slowQuery || slowQueryFromCache) && (jsx(Alert$1, { style: { marginBottom: 24 }, message: slowQueryMsg, type: "warning" }, void 0)), renderExtras(), jsx(ChartContainer, __assign({ invisible: invisible }, { children: cubejsApi ? (jsx("iframe", { id: "iframe-".concat(queryId), "data-testid": "chart-renderer", ref: iframeRef, title: "Chart renderer", src: "/chart-renderers/".concat(framework, "/index.html#queryId=").concat(queryId) }, void 0)) : null }), void 0)] }, void 0));
6742
+ return (jsxs(Fragment, { children: [(slowQuery || slowQueryFromCache) && (jsx(Alert$1, { style: { marginBottom: 24 }, message: slowQueryMsg, type: "warning" }, void 0)), renderExtras(), jsx(ChartContainer, __assign({ invisible: invisible }, { children: cubejsApi ? (jsx("iframe", { id: "iframe-".concat(queryId), "data-testid": "chart-renderer", ref: iframeRef, style: { height: containerSize }, title: "Chart renderer", src: "/chart-renderers/".concat(framework, "/index.html#queryId=").concat(queryId) }, void 0)) : null }), void 0)] }, void 0));
6659
6743
  }
6660
6744
  var templateObject_1$6, templateObject_2$2, templateObject_3, templateObject_4, templateObject_5;
6661
6745
 
@@ -6889,7 +6973,7 @@ var FilterGroup = function (_a) {
6889
6973
  }, onClick: function (updateWith) {
6890
6974
  return updateMethods.update(m, __assign(__assign({}, m), { dimension: updateWith }));
6891
6975
  } }, { children: m.dimension.title }), void 0) }), void 0));
6892
- return (jsxs(Fragment$1, { children: [isMissing ? (jsx(MissingMemberTooltip, { children: buttonGroup }, void 0)) : (buttonGroup), jsx(StyledSelect, __assign({ disabled: disabled, value: m.operator, style: { width: 200 }, onChange: function (operator) { return updateMethods.update(m, __assign(__assign({}, m), { operator: operator })); } }, { children: m.operators.map(function (operator) { return (jsx(StyledSelect.Option, __assign({ value: operator.name }, { children: operator.title }), operator.name)); }) }), void 0), jsx(FilterInput, { disabled: disabled, member: m, updateMethods: updateMethods }, "filterInput")] }, m.index));
6976
+ return (jsxs(Fragment$1, { children: [isMissing ? (jsx(MissingMemberTooltip, { children: buttonGroup }, void 0)) : (buttonGroup), jsx(StyledSelect, __assign({ disabled: disabled, value: m.operator, style: { width: 200 }, onChange: function (operator) { return updateMethods.update(m, __assign(__assign({}, m), { operator: operator })); } }, { children: m.operators.map(function (operator) { return (jsx(StyledSelect.Option, __assign({ value: operator.name }, { children: operator.title }), operator.name)); }) }), void 0), jsx(FilterInput, { disabled: disabled, member: m, updateMethods: updateMethods }, "filterInput")] }, m.member));
6893
6977
  }), jsx(MemberMenu, __assign({ availableCubes: availableMembers, type: "dashed", disabled: disabled, icon: jsx(PlusOutlined, {}, void 0), onClick: function (m) { return updateMethods.add({ member: m }); } }, { children: !members.length ? addMemberName : null }), void 0)] }, void 0));
6894
6978
  };
6895
6979
 
@@ -7263,5 +7347,5 @@ var QueryBuilder = memo(QueryBuilderComponent, function (prevProps, nextProps) {
7263
7347
  return equals(prevProps, nextProps);
7264
7348
  });
7265
7349
 
7266
- export { CloudProvider as C, QueryBuilder as Q, RollupDesignerContext as R, __assign as _, unCapitalize as a, __spreadArray as b, useSecurityContext as c, useToken as d, useDeepMemo as e, __makeTemplateObject as f, fetchPoll as g, setTelemetry as h, useCloud as i, Context as j, useRollupDesignerContext as k, useDeepCompareMemoize as l, metaToTypes as m, useCubejsApi as n, useLivePreviewContext as o, useLocalStorage as p, useIdentifier as q, useIsMounted as r, setTracker as s, useDeepEffect as t, uniqArray as u, useToggle as v, useServerCoreVersionGte as w, useAppContext as x, usePlaygroundContext as y, useIsCloud as z };
7267
- //# sourceMappingURL=index-fd53d684.js.map
7350
+ export { useSetter as A, useToggle as B, CloudProvider as C, useWindowSize as D, QueryBuilder as Q, RollupDesignerContext as R, __assign as _, unCapitalize as a, __spreadArray as b, useSecurityContext as c, useToken as d, useDeepMemo as e, __makeTemplateObject as f, fetchPoll as g, setTelemetry as h, useCloud as i, Context as j, useRollupDesignerContext as k, useAppContext as l, metaToTypes as m, usePlaygroundContext as n, useIsCloud as o, useCubejsApi as p, useDeepCompareMemoize as q, useDeepDependencies as r, setTracker as s, useDeepEffect as t, uniqArray as u, useIdentifier as v, useIsMounted as w, useLivePreviewContext as x, useLocalStorage as y, useServerCoreVersionGte as z };
7351
+ //# sourceMappingURL=index-a331125b.js.map