diff --git a/.codesandbox/mekko/package.json b/.codesandbox/mekko/package.json index 6807e88cc..6d3caba1d 100755 --- a/.codesandbox/mekko/package.json +++ b/.codesandbox/mekko/package.json @@ -16,4 +16,4 @@ "@babel/core": "7.24.0", "parcel": "^2.12.0" } -} +} \ No newline at end of file diff --git a/.codesandbox/mekko/src/init.js b/.codesandbox/mekko/src/init.js index a743282e2..cf72f3afb 100755 --- a/.codesandbox/mekko/src/init.js +++ b/.codesandbox/mekko/src/init.js @@ -1,5 +1,5 @@ import enigma from 'enigma.js'; -import qixSchema from 'enigma.js/schemas/12.1657.0.json'; +import qixSchema from 'enigma.js/schemas/12.2015.0.json'; import { embed } from '@nebula.js/stardust'; import mekko from '@nebula.js/sn-mekko-chart'; diff --git a/apis/nucleus/src/components/listbox/components/ListBoxHeader/icon-utils.js b/apis/nucleus/src/components/listbox/components/ListBoxHeader/icon-utils.js index 9adec3344..1ca2592e3 100644 --- a/apis/nucleus/src/components/listbox/components/ListBoxHeader/icon-utils.js +++ b/apis/nucleus/src/components/listbox/components/ListBoxHeader/icon-utils.js @@ -1,5 +1,6 @@ +import CyclicIcon from '@nebula.js/ui/icons/cyclic'; import DrillDownIcon from '@nebula.js/ui/icons/drill-down'; -import CyclicIcon from '@nebula.js/ui/icons/reload'; +import ReloadIcon from '@nebula.js/ui/icons/reload'; const dimensionTypes = { single: 'N', @@ -17,16 +18,23 @@ const createDimensionIconData = (dimInfo, app) => { }; case dimensionTypes.cyclic: return { - icon: CyclicIcon, + icon: app ? ReloadIcon : CyclicIcon, tooltip: 'Listbox.Cyclic', - onClick: () => { - app - .getDimension(dimInfo.qLibraryId) - .then((dimensionModel) => { - dimensionModel.stepCycle(1); - }) - .catch(() => null); - }, + onClick: app + ? () => { + app + .getDimension(dimInfo.qLibraryId) + .then((dimensionModel) => { + if (!dimensionModel.stepCycle) { + // eslint-disable-next-line no-console + console.log("engine api spec version doesn't have support for function stepCycle"); + return; + } + dimensionModel.stepCycle(1); + }) + .catch(() => null); + } + : undefined, }; default: return undefined; diff --git a/apis/nucleus/src/components/listbox/components/__tests__/icon-utils.test.js b/apis/nucleus/src/components/listbox/components/__tests__/icon-utils.test.js index 83e1d5acf..897739d6d 100644 --- a/apis/nucleus/src/components/listbox/components/__tests__/icon-utils.test.js +++ b/apis/nucleus/src/components/listbox/components/__tests__/icon-utils.test.js @@ -1,5 +1,6 @@ import DrillDownIcon from '@nebula.js/ui/icons/drill-down'; -import CyclicIcon from '@nebula.js/ui/icons/reload'; +import ReloadIcon from '@nebula.js/ui/icons/reload'; +import CyclicIcon from '@nebula.js/ui/icons/cyclic'; import utils from '../ListBoxHeader/icon-utils'; describe('icon-utils', () => { @@ -19,14 +20,25 @@ describe('icon-utils', () => { }); }); - it('should return no icon data for cyclic dimension', () => { + it('should return icon data for cyclic dimension', () => { const dimInfo = { qGrouping: 'C' }; const app = {}; const result = utils.createDimensionIconData(dimInfo, app); expect(result).toMatchObject({ - icon: CyclicIcon, + icon: ReloadIcon, tooltip: 'Listbox.Cyclic', onClick: expect.any(Function), }); }); + + it('should return non interactive icon data for cyclic dimension when there is no app', () => { + const dimInfo = { qGrouping: 'C' }; + const app = undefined; + const result = utils.createDimensionIconData(dimInfo, app); + expect(result).toMatchObject({ + icon: CyclicIcon, + tooltip: 'Listbox.Cyclic', + onClick: undefined, + }); + }); }); diff --git a/commands/create/templates/mashup/src/Authenticator.js b/commands/create/templates/mashup/src/Authenticator.js index 8fcfb93d0..160ee6e56 100644 --- a/commands/create/templates/mashup/src/Authenticator.js +++ b/commands/create/templates/mashup/src/Authenticator.js @@ -1,5 +1,5 @@ import enigma from 'enigma.js'; -import schema from 'enigma.js/schemas/12.1657.0.json'; +import schema from 'enigma.js/schemas/12.2015.0.json'; import { Auth, AuthType } from '@qlik/sdk'; export default class Authenticator { diff --git a/commands/serve/package.json b/commands/serve/package.json index f94016a74..caad49379 100644 --- a/commands/serve/package.json +++ b/commands/serve/package.json @@ -73,4 +73,4 @@ "react-dom": "18.2.0", "react-router-dom": "6.22.3" } -} +} \ No newline at end of file diff --git a/commands/serve/web/__tests__/connect.test.js b/commands/serve/web/__tests__/connect.test.js index a1635c29b..98f67b852 100644 --- a/commands/serve/web/__tests__/connect.test.js +++ b/commands/serve/web/__tests__/connect.test.js @@ -1,6 +1,6 @@ import * as SDK from '@qlik/sdk'; import * as ENIGMA from 'enigma.js'; -import qixSchema from 'enigma.js/schemas/12.1657.0.json'; +import qixSchema from 'enigma.js/schemas/12.2015.0.json'; import * as SenseUtilities from 'enigma.js/sense-utilities'; import { connect, openApp, getConnectionInfo, getParams, parseEngineURL } from '../connect'; diff --git a/commands/serve/web/connect.js b/commands/serve/web/connect.js index c9a51e19b..39368c4d2 100644 --- a/commands/serve/web/connect.js +++ b/commands/serve/web/connect.js @@ -1,5 +1,5 @@ import enigma from 'enigma.js'; -import qixSchema from 'enigma.js/schemas/12.1657.0.json'; +import qixSchema from 'enigma.js/schemas/12.2015.0.json'; import SenseUtilities from 'enigma.js/sense-utilities'; import { Auth, AuthType } from '@qlik/sdk'; diff --git a/commands/serve/web/hooks/__tests__/useOpenApp.test.js b/commands/serve/web/hooks/__tests__/useOpenApp.test.js index 26728c729..965a5955a 100644 --- a/commands/serve/web/hooks/__tests__/useOpenApp.test.js +++ b/commands/serve/web/hooks/__tests__/useOpenApp.test.js @@ -1,7 +1,7 @@ import { renderHook, act } from '@testing-library/react'; import * as ENIGMA from 'enigma.js'; import * as SenseUtilities from 'enigma.js/sense-utilities'; -import qixSchema from 'enigma.js/schemas/12.1657.0.json'; +import qixSchema from 'enigma.js/schemas/12.2015.0.json'; import { useOpenApp } from '../useOpenApp'; import * as getAuthInstanceModule from '../../connect'; diff --git a/commands/serve/web/hooks/useOpenApp.js b/commands/serve/web/hooks/useOpenApp.js index 2aca331ef..bc16beed9 100644 --- a/commands/serve/web/hooks/useOpenApp.js +++ b/commands/serve/web/hooks/useOpenApp.js @@ -1,6 +1,6 @@ import { useState, useEffect } from 'react'; import enigma from 'enigma.js'; -import qixSchema from 'enigma.js/schemas/12.1657.0.json'; +import qixSchema from 'enigma.js/schemas/12.2015.0.json'; import SenseUtilities from 'enigma.js/sense-utilities'; import { getAuthInstance } from '../connect'; diff --git a/examples/chart-conversion/connect.js b/examples/chart-conversion/connect.js index ac25bf1c9..2f60d2048 100644 --- a/examples/chart-conversion/connect.js +++ b/examples/chart-conversion/connect.js @@ -2,7 +2,7 @@ import enigma from 'enigma.js'; export default function connect() { const loadSchema = () => - fetch('https://unpkg.com/enigma.js/schemas/12.1657.0.json').then((response) => response.json()); + fetch('https://unpkg.com/enigma.js/schemas/12.2015.0.json').then((response) => response.json()); const createConnection = () => loadSchema().then((schema) => diff --git a/examples/dev-mashup/README.md b/examples/dev-mashup/README.md index b3143f8bb..533f846de 100644 --- a/examples/dev-mashup/README.md +++ b/examples/dev-mashup/README.md @@ -42,7 +42,7 @@ import enigma from 'enigma.js'; export default function connect() { const loadSchema = () => - fetch('https://unpkg.com/enigma.js/schemas/12.1657.0.json').then((response) => response.json()); + fetch('https://unpkg.com/enigma.js/schemas/12.2015.0.json').then((response) => response.json()); const localApp = '/apps/Ctrl-00.qvf'; const createConnection = () => diff --git a/examples/dev-mashup/connect.js b/examples/dev-mashup/connect.js index ac25bf1c9..2f60d2048 100644 --- a/examples/dev-mashup/connect.js +++ b/examples/dev-mashup/connect.js @@ -2,7 +2,7 @@ import enigma from 'enigma.js'; export default function connect() { const loadSchema = () => - fetch('https://unpkg.com/enigma.js/schemas/12.1657.0.json').then((response) => response.json()); + fetch('https://unpkg.com/enigma.js/schemas/12.2015.0.json').then((response) => response.json()); const createConnection = () => loadSchema().then((schema) => diff --git a/examples/mashup/connect.js b/examples/mashup/connect.js index fb506f35a..f2d937918 100644 --- a/examples/mashup/connect.js +++ b/examples/mashup/connect.js @@ -1,6 +1,6 @@ window.connect = function connect() { const loadSchema = () => - fetch('https://unpkg.com/enigma.js/schemas/12.1657.0.json').then((response) => response.json()); + fetch('https://unpkg.com/enigma.js/schemas/12.2015.0.json').then((response) => response.json()); const createConnection = () => loadSchema().then((schema) => diff --git a/package.json b/package.json index 2a165d7a3..a403faff4 100644 --- a/package.json +++ b/package.json @@ -107,4 +107,4 @@ "apis/*", "test/component/*" ] -} +} \ No newline at end of file diff --git a/packages/ui/icons/cyclic.js b/packages/ui/icons/cyclic.js new file mode 100644 index 000000000..67b61b514 --- /dev/null +++ b/packages/ui/icons/cyclic.js @@ -0,0 +1,15 @@ +import SvgIcon from './SvgIcon'; + +const cyclic = (props) => ({ + ...props, + shapes: [ + { + type: 'path', + attrs: { + d: 'M 6 2 h 10 V 1 H 6 Z m 5 5 h 5 V 6 h -5 Z m 5 5 h -5 v -1 h 5 Z M 5 10 h 1 v 2.663 a 3.5 3.5 0 1 0 -2.922 0.036 l -0.406 0.914 A 4.501 4.501 0 1 1 7.329 13 H 9 v 1 H 5 Z', + }, + }, + ], +}); +export default (props) => SvgIcon(cyclic(props)); +export { cyclic };