diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
index 3fef81a215..88925ff34c 100644
--- a/.devcontainer/Dockerfile
+++ b/.devcontainer/Dockerfile
@@ -1,5 +1,12 @@
FROM mcr.microsoft.com/devcontainers/javascript-node:1-18-bullseye
+# Install deps
+RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
+ && apt-get -y install --no-install-recommends chromium
+
+# Define env vars
+ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
+
# [Optional] Uncomment if you want to install an additional version of node using nvm
ARG EXTRA_NODE_VERSION="lts/hydrogen"
RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"
\ No newline at end of file
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index b42e2b899a..b7866aa4c3 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -1,80 +1,81 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/javascript-node
{
- "name": "@sme.up/ketchup-root",
- // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
- "build": {
- "dockerfile": "Dockerfile",
- "args": {
+ "name": "@sme.up/ketchup-root",
+ // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
+ "build": {
+ "dockerfile": "Dockerfile",
+ "args": {
"VARIANT": "18-bullseye",
"EXTRA_NODE_VERSION": "18.16"
}
- },
- // Features to add to the dev container. More info: https://containers.dev/features.
- "features": {
- // "ghcr.io/devcontainers/features/node:1": {
- // "nodeGypDependencies": true,
- // "version": "lts",
- // "nvmVersion": "latest"
- // },
- "ghcr.io/devcontainers-contrib/features/lerna-npm:1": {
- "version": "latest"
- },
- "ghcr.io/devcontainers-contrib/features/nx-npm:1": {
- "version": "latest"
- }
- },
+ },
+ // Features to add to the dev container. More info: https://containers.dev/features.
+ "features": {
+ // "ghcr.io/devcontainers/features/node:1": {
+ // "nodeGypDependencies": true,
+ // "version": "lts",
+ // "nvmVersion": "latest"
+ // },
+ "ghcr.io/devcontainers-contrib/features/lerna-npm:1": {
+ "version": "latest"
+ },
+ "ghcr.io/devcontainers-contrib/features/nx-npm:1": {
+ "version": "latest"
+ }
+ },
- // Use 'forwardPorts' to make a list of ports inside the container available locally.
- // "forwardPorts": [],
+ // Use 'forwardPorts' to make a list of ports inside the container available locally.
+ // "forwardPorts": [],
- // Use 'postCreateCommand' to run commands after the container is created.
- "postCreateCommand": "sh .devcontainer/scripts/postCreateCommand.sh",
+ // Use 'postCreateCommand' to run commands after the container is created.
+ "postCreateCommand": "sh .devcontainer/scripts/postCreateCommand.sh",
- // Configure tool-specific properties.
- "customizations": {
- "vscode": {
- "extensions": [
- "esbenp.prettier-vscode",
- "dbaeumer.vscode-eslint",
- "octref.vetur"
- ],
- "settings": {
- "editor.formatOnSave": true,
- "editor.codeActionsOnSave": {
- "source.fixAll.eslint": "explicit"
- },
- "eslint.validate": ["vue", "html", "javascript", "typescript"],
- "eslint.run": "onSave",
- "[typescriptreact]": {
- "editor.defaultFormatter": "esbenp.prettier-vscode"
- },
- "[typescript]": {
- "editor.defaultFormatter": "esbenp.prettier-vscode"
- },
- "[vue]": {
- "editor.defaultFormatter": "octref.vetur"
- },
- "[html]": {
- "editor.defaultFormatter": "esbenp.prettier-vscode"
- },
- "[javascript]": {
- "editor.defaultFormatter": "esbenp.prettier-vscode"
- },
- "[json]": {
- "editor.defaultFormatter": "esbenp.prettier-vscode"
- },
- "[jsonc]": {
- "editor.defaultFormatter": "esbenp.prettier-vscode"
- }
- }
- }
- },
+ // Configure tool-specific properties.
+ "customizations": {
+ "vscode": {
+ "extensions": [
+ "esbenp.prettier-vscode",
+ "dbaeumer.vscode-eslint",
+ "firsttris.vscode-jest-runner",
+ "octref.vetur"
+ ],
+ "settings": {
+ "editor.formatOnSave": true,
+ "editor.codeActionsOnSave": {
+ "source.fixAll.eslint": "explicit"
+ },
+ "eslint.validate": ["vue", "html", "javascript", "typescript"],
+ "eslint.run": "onSave",
+ "[typescriptreact]": {
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
+ },
+ "[typescript]": {
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
+ },
+ "[vue]": {
+ "editor.defaultFormatter": "octref.vetur"
+ },
+ "[html]": {
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
+ },
+ "[javascript]": {
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
+ },
+ "[json]": {
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
+ },
+ "[jsonc]": {
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
+ }
+ }
+ }
+ },
"mounts": [
- "source=ketchup-node_modules,target=${containerWorkspaceFolder}/node_modules,type=volume", // deps volume
- "source=ketchup-vscode-extensions,target=/root/.vscode-server/extensions,type=volume" // vscode extensions volume
+ "source=ketchup-node_modules,target=${containerWorkspaceFolder}/node_modules,type=volume", // deps volume
+ "source=ketchup-vscode-extensions,target=/root/.vscode-server/extensions,type=volume" // vscode extensions volume
]
- // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
- // "remoteUser": "root"
+ // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
+ // "remoteUser": "root"
}
diff --git a/package.json b/package.json
index 8d0e7a1485..154b684b24 100644
--- a/package.json
+++ b/package.json
@@ -30,6 +30,8 @@
"lerna": "lerna",
"k:build": "lerna run build --scope @sme.up/ketchup --stream && lerna run build --scope @sme.up/ketchup-react --stream",
"k:start": "lerna run start --scope @sme.up/ketchup --stream",
+ "k:test:all": "lerna run test --scope @sme.up/ketchup --stream",
+ "k:test:e2e": "lerna run test:e2e --scope @sme.up/ketchup --stream",
"k:test:unit": "lerna run test:spec --scope @sme.up/ketchup --stream",
"k:test:unitcov": "lerna run test:speccov --scope @sme.up/ketchup --stream",
"ksc:serve": "lerna run serve --scope @sme.up/ketchup-showcase --stream",
diff --git a/packages/ketchup-showcase/src/views/components/advanced/inputpanel/examples/InputPanelDemo.vue b/packages/ketchup-showcase/src/views/components/advanced/inputpanel/examples/InputPanelDemo.vue
index 9c22535e31..d56f41ab2e 100644
--- a/packages/ketchup-showcase/src/views/components/advanced/inputpanel/examples/InputPanelDemo.vue
+++ b/packages/ketchup-showcase/src/views/components/advanced/inputpanel/examples/InputPanelDemo.vue
@@ -78,11 +78,6 @@ function createComp() {
title: 'Surname',
visible: true,
},
- {
- name: 'COL',
- title: 'Color Shirt',
- visible: true,
- },
{
name: 'NAT',
title: 'Nation',
@@ -93,22 +88,12 @@ function createComp() {
title: 'City',
visible: true,
},
- {
- name: 'CAM',
- title: 'Campionato vinto',
- visible: true,
- },
- {
- name: 'CHI',
- title: 'Chip',
- visible: true,
- },
],
rows: [
{
cells: {
NAM: {
- value: 'Francesco',
+ value: '',
obj: {
t: '',
p: '',
@@ -119,7 +104,7 @@ function createComp() {
shape: 'ITX',
},
SUR: {
- value: 'Totti',
+ value: '',
obj: {
t: '',
p: '',
@@ -127,24 +112,17 @@ function createComp() {
},
editable: true,
mandatory: true,
- shape: 'INF',
- },
- COL: {
- value: '#8E1F2F',
- obj: {
- t: 'J1',
- p: 'COL',
- k: '',
- },
- editable: true,
- mandatory: true,
- // shape: 'CLP',
+ shape: 'ITX',
},
NAT: {
- value: 'It',
+ value: '',
options: [
- { id: 'It', label: 'Italy' },
- { id: 'Sp', label: 'Spain' },
+ 'Italy',
+ 'Spain',
+ 'Germany',
+ 'France',
+ 'Portugal',
+ 'England',
],
obj: {
t: '',
@@ -156,7 +134,7 @@ function createComp() {
shape: 'CMB',
},
CIT: {
- value: 'Rom',
+ value: '',
obj: {
t: '',
p: '',
@@ -165,31 +143,29 @@ function createComp() {
editable: true,
mandatory: true,
options: [
- { id: 'Rom', label: 'Roma' },
- { id: 'Flam', label: 'Flaminio' },
- { id: 'PorMet', label: 'Porta Metronia' },
- { id: 'Garbat', label: 'Garbatella' },
+ 'Rome',
+ 'Florence',
+ 'Venice',
+ 'Madrid',
+ 'Barcelona',
+ 'Seville',
+ 'Berlin',
+ 'Munich',
+ 'Hamburg',
+ 'Paris',
+ 'Marseille',
+ 'Lyon',
+ 'Lisbon',
+ 'Porto',
+ 'Faro',
+ 'London',
+ 'Manchester',
+ 'Liverpool',
],
shape: 'ACP',
},
- CAM: {
- value: 'on',
- obj: {
- t: 'V2',
- p: 'SI/NO',
- k: '',
- },
- editable: true,
- mandatory: true,
- // shape: 'CHK',
- },
- CHI: {
- shape: 'CHI',
- value: 'Chi',
- editable: true,
- options: [{ id: 'Chi', label: 'Chip' }],
- },
},
+ layout: {},
},
],
};
diff --git a/packages/ketchup/src/assets/input-panel.js b/packages/ketchup/src/assets/input-panel.js
index eff89f53ff..bfdc90753a 100644
--- a/packages/ketchup/src/assets/input-panel.js
+++ b/packages/ketchup/src/assets/input-panel.js
@@ -10,11 +10,6 @@ const data = {
title: 'Surname',
visible: true,
},
- {
- name: 'COL',
- title: 'Color Shirt',
- visible: true,
- },
{
name: 'NAT',
title: 'Nation',
@@ -26,23 +21,13 @@ const data = {
visible: true,
},
{
- name: 'CAM',
- title: 'Campionato vinto',
- visible: true,
- },
- {
- name: 'CHA',
- title: 'Chart',
- visible: false,
- },
- {
- name: 'CHI',
- title: 'Chip',
+ name: 'CHK',
+ title: 'Checkbox',
visible: true,
},
{
- name: 'BUT',
- title: 'Buttons list',
+ name: 'RAD',
+ title: 'Radio Buttons',
visible: true,
},
],
@@ -50,7 +35,7 @@ const data = {
{
cells: {
NAM: {
- value: 'Francesco',
+ value: '',
obj: {
t: '',
p: '',
@@ -61,7 +46,7 @@ const data = {
shape: 'ITX',
},
SUR: {
- value: 'Totti',
+ value: '',
obj: {
t: '',
p: '',
@@ -69,24 +54,17 @@ const data = {
},
editable: true,
mandatory: true,
- shape: 'INF',
- },
- COL: {
- value: '#8E1F2F',
- obj: {
- t: 'J1',
- p: 'COL',
- k: '',
- },
- editable: true,
- mandatory: true,
- // shape: 'CLP',
+ shape: 'ITX',
},
NAT: {
- value: 'It',
+ value: '',
options: [
- { id: 'It', label: 'Italy' },
- { id: 'Sp', label: 'Spain' },
+ 'Italy',
+ 'Spain',
+ 'Germany',
+ 'France',
+ 'Portugal',
+ 'England',
],
obj: {
t: '',
@@ -98,7 +76,7 @@ const data = {
shape: 'CMB',
},
CIT: {
- value: 'Rom',
+ value: '',
obj: {
t: '',
p: '',
@@ -107,14 +85,28 @@ const data = {
editable: true,
mandatory: true,
options: [
- { id: 'Rom', label: 'Roma' },
- { id: 'Flam', label: 'Flaminio' },
- { id: 'PorMet', label: 'Porta Metronia' },
- { id: 'Garbat', label: 'Garbatella' },
+ 'Rome',
+ 'Florence',
+ 'Venice',
+ 'Madrid',
+ 'Barcelona',
+ 'Seville',
+ 'Berlin',
+ 'Munich',
+ 'Hamburg',
+ 'Paris',
+ 'Marseille',
+ 'Lyon',
+ 'Lisbon',
+ 'Porto',
+ 'Faro',
+ 'London',
+ 'Manchester',
+ 'Liverpool',
],
shape: 'ACP',
},
- CAM: {
+ CHK: {
value: 'on',
obj: {
t: 'V2',
@@ -123,91 +115,16 @@ const data = {
},
editable: true,
mandatory: true,
- // shape: 'CHK',
- },
- CHA: {
- data: {
- sizeX: '50px',
- offlineMode: {
- value: '8;4;5',
- },
- id: 'i1012_GREF_0',
- cellId: 'i1012_GREF_0',
- sizeY: '50px',
- },
- obj: {
- k: '8;4;5',
- p: 'GRA_PIE',
- t: 'J4',
- },
- shape: 'Gra',
- value: '8;4;5',
},
- CHI: {
- shape: 'CHI',
- value: 'Chi',
+ RAD: {
+ value: '1',
+ options: ['1', '2', '3', '4'],
editable: true,
- options: [{ id: 'Chi', label: 'Chip' }],
- },
- BUT: {
- cssClass: 'strong-text',
- data: {
- data: [
- {
- children: [
- {
- children: [],
- disabled: false,
- expandable: false,
- icon: 'lightbulb-outline',
- isExpanded: false,
- obj: {
- k: '000050',
- p: 'COD_VER',
- t: 'VO',
- },
- options: false,
- value: 'Collaboratore',
- },
- {
- children: [],
- disabled: false,
- expandable: false,
- icon: 'briefcase',
- isExpanded: false,
- obj: {
- k: '000050',
- p: 'COD_VER',
- t: 'VO',
- },
- options: false,
- value: 'Azienda',
- },
- ],
- data: {
- dropdownOnly: true,
- },
- disabled: false,
- expandable: false,
- isExpanded: false,
- options: false,
- },
- ],
- customStyle:
- ' #kup-component button { padding: 0; font-size: 0.65em; } ',
- icon: 'settings',
- className: 'kup-slim',
- },
- editable: true,
- obj: {
- k: '000050',
- p: 'COD_VER',
- t: 'VO',
- },
- shape: 'BTN',
- value: '',
+ mandatory: true,
+ shape: 'RAD',
},
},
+ layout: {},
},
],
};
diff --git a/packages/ketchup/src/components/kup-input-panel/kup-input-panel-declarations.ts b/packages/ketchup/src/components/kup-input-panel/kup-input-panel-declarations.ts
index 84885ab258..118070316e 100644
--- a/packages/ketchup/src/components/kup-input-panel/kup-input-panel-declarations.ts
+++ b/packages/ketchup/src/components/kup-input-panel/kup-input-panel-declarations.ts
@@ -25,7 +25,7 @@ export interface KupInputPanelRowCells {
export interface KupInputPanelCell extends KupDataCell {
// TODO tipizzare dopo validazione da SMEUP
- options?: { id: string; label: string }[];
+ options?: string[];
editable?: boolean;
mandatory?: boolean;
fun?: string;
@@ -58,10 +58,7 @@ export interface KupInputPanelLayoutField {
}
export type DataAdapterFn = (
- options: {
- id: string;
- label: string;
- }[],
+ options: string[],
fieldLabel: string,
currentValue: string
) => Object;
diff --git a/packages/ketchup/src/components/kup-input-panel/kup-input-panel.e2e.ts b/packages/ketchup/src/components/kup-input-panel/kup-input-panel.e2e.ts
new file mode 100644
index 0000000000..e19e51b695
--- /dev/null
+++ b/packages/ketchup/src/components/kup-input-panel/kup-input-panel.e2e.ts
@@ -0,0 +1,85 @@
+import { newE2EPage } from '@stencil/core/testing';
+
+describe('kup-input-panel', () => {
+ it('renders', async () => {
+ const page = await newE2EPage();
+
+ await page.setContent('