diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 88925ff34c..f6117f941a 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -6,6 +6,7 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ # Define env vars ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium +ENV NODE_OPTIONS=--max-old-space-size=8192 # [Optional] Uncomment if you want to install an additional version of node using nvm ARG EXTRA_NODE_VERSION="lts/hydrogen" diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b7866aa4c3..8219955e2f 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -38,6 +38,7 @@ "esbenp.prettier-vscode", "dbaeumer.vscode-eslint", "firsttris.vscode-jest-runner", + "elltg.elltg-npm-script-run", "octref.vetur" ], "settings": { diff --git a/.devcontainer/scripts/git/pre-push b/.devcontainer/scripts/git/pre-push new file mode 100644 index 0000000000..415ef0262a --- /dev/null +++ b/.devcontainer/scripts/git/pre-push @@ -0,0 +1,4 @@ +#!/bin/sh + +yarn run k:build +yarn run k:test:all \ No newline at end of file diff --git a/.devcontainer/scripts/postCreateCommand.sh b/.devcontainer/scripts/postCreateCommand.sh index 313f26169d..08ff58d37a 100644 --- a/.devcontainer/scripts/postCreateCommand.sh +++ b/.devcontainer/scripts/postCreateCommand.sh @@ -3,5 +3,10 @@ echo "Set permissions" sudo chown -R node:node node_modules +echo "Set Git hooks" +echo "Set pre-push hook" +cp .devcontainer/scripts/git/pre-push .git/hooks +chmod +x .git/hooks/pre-push + echo "Installing Deps" yarn install \ No newline at end of file diff --git a/packages/ketchup-react/package.json b/packages/ketchup-react/package.json index abf4ddeedb..a4c6134e45 100644 --- a/packages/ketchup-react/package.json +++ b/packages/ketchup-react/package.json @@ -1,6 +1,6 @@ { "name": "@sme.up/ketchup-react", - "version": "9.6.4", + "version": "9.6.5", "module": "dist/index.js", "typings": "dist/index.d.ts", "keywords": [ @@ -20,7 +20,7 @@ "description": "Ketchup React Components library by smeup", "license": "Apache-2.0", "dependencies": { - "@sme.up/ketchup": "^9.6.4", + "@sme.up/ketchup": "^9.6.5", "react": "^18.2.0", "react-dom": "^18.2.0" }, diff --git a/packages/ketchup-showcase/package.json b/packages/ketchup-showcase/package.json index 869b1aadd6..f0c9657656 100644 --- a/packages/ketchup-showcase/package.json +++ b/packages/ketchup-showcase/package.json @@ -19,7 +19,7 @@ "lint": "vue-cli-service lint" }, "dependencies": { - "@sme.up/ketchup": "^9.6.4", + "@sme.up/ketchup": "^9.6.5", "core-js": "^3.30.2", "vue": "^2.6.14", "vue-router": "^3.5.1" diff --git a/packages/ketchup-showcase/src/App.vue b/packages/ketchup-showcase/src/App.vue index 713f3ab6ef..bc094ccb1c 100644 --- a/packages/ketchup-showcase/src/App.vue +++ b/packages/ketchup-showcase/src/App.vue @@ -55,8 +55,8 @@ @kup-tree-nodeselected="treeClick" >
diff --git a/packages/ketchup-showcase/src/views/components/advanced/planner/examples/PlannerDemo.vue b/packages/ketchup-showcase/src/views/components/advanced/planner/examples/PlannerDemo.vue index 2ce2c42438..2d67ffae0d 100644 --- a/packages/ketchup-showcase/src/views/components/advanced/planner/examples/PlannerDemo.vue +++ b/packages/ketchup-showcase/src/views/components/advanced/planner/examples/PlannerDemo.vue @@ -121,6 +121,15 @@ export default { default: 'undefined', try: 'field', }, + { + prop: 'detailHours', + description: + 'Columns containing detail duration, from (firstHour) to (secondHour)', + type: 'string', + default: 'undefined', + isArray: true, + try: 'field', + }, { prop: 'detailIdCol', description: 'Column containing unique detail identifier', @@ -135,6 +144,15 @@ export default { default: 'undefined', try: 'field', }, + { + prop: 'detailPrevHours', + description: + 'Columns containing fForecast detail duration, from (firstHour) to (secondHour)', + type: 'string', + default: 'undefined', + isArray: true, + try: 'field', + }, { prop: 'detailPrevDates', description: @@ -198,6 +216,15 @@ export default { try: 'field', isArray: true, }, + { + prop: 'phaseHours', + description: + 'Columns containing phase duration, from (firstHour) to (secondHour)', + type: 'string', + default: 'undefined', + try: 'field', + isArray: true, + }, { prop: 'phaseIdCol', description: 'Column containing unique phase identifier', @@ -212,6 +239,15 @@ export default { default: 'undefined', try: 'field', }, + { + prop: 'phasePrevHours', + description: + 'Columns containing forecast phase duration, from (firstHour) to (secondHour)', + type: 'string', + default: 'undefined', + try: 'json', + isArray: true, + }, { prop: 'phasePrevDates', description: @@ -228,6 +264,13 @@ export default { default: 'false', try: 'switch', }, + { + prop: 'scrollableTaskList', + description: 'Enable/disable scrollbar for task list', + type: 'boolean', + default: 'false', + try: 'switch', + }, { prop: 'showSecondaryDates', description: 'Enable/disable display of secondary dates', @@ -260,6 +303,15 @@ export default { default: 'undefined', try: 'field', }, + { + prop: 'taskHours', + description: + 'Columns containing task duration, from (firstHour) to (secondHour)', + type: 'string', + default: 'undefined', + try: 'json', + isArray: true, + }, { prop: 'taskIdCol', description: 'Column containing unique task identifier', @@ -288,6 +340,15 @@ export default { default: 'undefined', try: 'field', }, + { + prop: 'taskPrevHours', + description: + 'Columns containing forecast task duration, from (firstHour) to (secondHour)', + type: 'string', + default: 'undefined', + try: 'json', + isArray: true, + }, { prop: 'taskPrevDates', description: diff --git a/packages/ketchup-showcase/src/views/components/basic/pdf/examples/PdfDemo.vue b/packages/ketchup-showcase/src/views/components/basic/pdf/examples/PdfDemo.vue index f4721f63af..0c0b3ad83a 100644 --- a/packages/ketchup-showcase/src/views/components/basic/pdf/examples/PdfDemo.vue +++ b/packages/ketchup-showcase/src/views/components/basic/pdf/examples/PdfDemo.vue @@ -58,7 +58,7 @@ export default { function createComp() { const comp = document.createElement('kup-pdf'); comp.id = 'demo-component'; - comp.pdfPath = '/assets/kup-pdf-sample.pdf'; + comp.pdfPath = 'assets/kup-pdf-sample.pdf'; return comp; } diff --git a/packages/ketchup/package.json b/packages/ketchup/package.json index 68bb1436ec..84bf91fa00 100644 --- a/packages/ketchup/package.json +++ b/packages/ketchup/package.json @@ -1,6 +1,6 @@ { "name": "@sme.up/ketchup", - "version": "9.6.4", + "version": "9.6.5", "keywords": [ "smeup", "KetchUP", diff --git a/packages/ketchup/src/assets/image-list.js b/packages/ketchup/src/assets/image-list.js index ec338e0819..be092f981a 100644 --- a/packages/ketchup/src/assets/image-list.js +++ b/packages/ketchup/src/assets/image-list.js @@ -591,7 +591,7 @@ const data = [ }, ], expandable: true, - icon: 'web', + icon: 'https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Square_-_black_simple.svg/768px-Square_-_black_simple.svg.png', isExpanded: false, value: 'Framework', visible: true, @@ -610,7 +610,337 @@ const data = [ }, ], expandable: true, - icon: 'library_books', + icon: 'https://dfstudio-d420.kxcdn.com/wordpress/wp-content/uploads/2019/06/digital_camera_photo-1080x675.jpg', + isExpanded: false, + value: 'Guides', + visible: true, + }, + { + children: [ + { + cells: { + ROUTE: { + value: 'customization', + }, + }, + icon: 'style', + value: 'Style customization', + visible: true, + }, + ], + expandable: true, + icon: 'https://dfstudio-d420.kxcdn.com/wordpress/wp-content/uploads/2019/06/digital_camera_photo-1080x675.jpg', + isExpanded: false, + value: 'Guides', + visible: true, + }, + { + children: [ + { + cells: { + ROUTE: { + value: 'customization', + }, + }, + icon: 'style', + value: 'Style customization', + visible: true, + }, + ], + expandable: true, + icon: 'https://dfstudio-d420.kxcdn.com/wordpress/wp-content/uploads/2019/06/digital_camera_photo-1080x675.jpg', + isExpanded: false, + value: 'Guides', + visible: true, + }, + { + children: [ + { + cells: { + ROUTE: { + value: 'customization', + }, + }, + icon: 'style', + value: 'Style customization', + visible: true, + }, + ], + expandable: true, + icon: 'https://dfstudio-d420.kxcdn.com/wordpress/wp-content/uploads/2019/06/digital_camera_photo-1080x675.jpg', + isExpanded: false, + value: 'Guides', + visible: true, + }, + { + children: [ + { + cells: { + ROUTE: { + value: 'customization', + }, + }, + icon: 'style', + value: 'Style customization', + visible: true, + }, + ], + expandable: true, + icon: 'https://dfstudio-d420.kxcdn.com/wordpress/wp-content/uploads/2019/06/digital_camera_photo-1080x675.jpg', + isExpanded: false, + value: 'Guides', + visible: true, + badgeData: [ + { + imageData: { + resource: + 'https://ketchup.smeup.com/ketchup-showcase/header_logo_dark.svg', + sizeX: '1.75rem', + sizeY: 'auto', + color: 'var(--kup-text-on-primary-color)', + }, + position: 'BL', + }, + ], + }, + { + children: [ + { + cells: { + ROUTE: { + value: 'customization', + }, + }, + icon: 'style', + value: 'Style customization', + visible: true, + }, + ], + expandable: true, + icon: 'https://dfstudio-d420.kxcdn.com/wordpress/wp-content/uploads/2019/06/digital_camera_photo-1080x675.jpg', + isExpanded: false, + value: 'Guides', + visible: true, + }, + { + children: [ + { + cells: { + ROUTE: { + value: 'customization', + }, + }, + icon: 'style', + value: 'Style customization', + visible: true, + }, + ], + expandable: true, + icon: 'https://dfstudio-d420.kxcdn.com/wordpress/wp-content/uploads/2019/06/digital_camera_photo-1080x675.jpg', + isExpanded: false, + value: 'Guides', + visible: true, + badgeData: [ + { + imageData: { + resource: + 'https://ketchup.smeup.com/ketchup-showcase/header_logo_dark.svg', + sizeX: '1.75rem', + sizeY: 'auto', + color: 'var(--kup-text-on-primary-color)', + }, + position: 'BL', + }, + ], + }, + { + children: [ + { + cells: { + ROUTE: { + value: 'customization', + }, + }, + icon: 'style', + value: 'Style customization', + visible: true, + }, + ], + expandable: true, + icon: 'https://dfstudio-d420.kxcdn.com/wordpress/wp-content/uploads/2019/06/digital_camera_photo-1080x675.jpg', + isExpanded: false, + value: 'Guides', + visible: true, + }, + { + children: [ + { + cells: { + ROUTE: { + value: 'customization', + }, + }, + icon: 'style', + value: 'Style customization', + visible: true, + }, + ], + expandable: true, + icon: 'https://dfstudio-d420.kxcdn.com/wordpress/wp-content/uploads/2019/06/digital_camera_photo-1080x675.jpg', + isExpanded: false, + value: 'Guides', + visible: true, + }, + { + children: [ + { + cells: { + ROUTE: { + value: 'customization', + }, + }, + icon: 'style', + value: 'Style customization', + visible: true, + }, + ], + expandable: true, + icon: 'https://c8.alamy.com/compit/f4j1rh/verticale-di-tronchi-di-alberi-di-boschi-guardando-verso-l-alto-da-terra-con-il-sole-che-splende-attraverso-foglie-f4j1rh.jpg', + isExpanded: false, + value: 'Guides', + visible: true, + }, + { + cells: { + ROUTE: { + value: 'accordion', + }, + }, + icon: 'view-sequential', + value: 'Accordion', + visible: true, + }, + { + cells: { + ROUTE: { + value: 'accordion', + }, + }, + icon: 'view-sequential', + value: 'Accordion', + visible: true, + }, + { + cells: { + ROUTE: { + value: 'accordion', + }, + }, + icon: 'view-sequential', + value: 'Accordion', + visible: true, + }, + { + cells: { + ROUTE: { + value: 'accordion', + }, + }, + icon: 'view-sequential', + value: 'Accordion', + visible: true, + }, + { + children: [ + { + cells: { + ROUTE: { + value: 'customization', + }, + }, + icon: 'style', + value: 'Style customization', + visible: true, + }, + ], + expandable: true, + icon: 'https://c8.alamy.com/compit/f4j1rh/verticale-di-tronchi-di-alberi-di-boschi-guardando-verso-l-alto-da-terra-con-il-sole-che-splende-attraverso-foglie-f4j1rh.jpg', + isExpanded: false, + value: 'Guides', + visible: true, + }, + { + children: [ + { + cells: { + ROUTE: { + value: 'customization', + }, + }, + icon: 'style', + value: 'Style customization', + visible: true, + }, + ], + expandable: true, + icon: 'https://c8.alamy.com/compit/f4j1rh/verticale-di-tronchi-di-alberi-di-boschi-guardando-verso-l-alto-da-terra-con-il-sole-che-splende-attraverso-foglie-f4j1rh.jpg', + isExpanded: false, + value: 'Guides', + visible: true, + }, + { + children: [ + { + cells: { + ROUTE: { + value: 'customization', + }, + }, + icon: 'style', + value: 'Style customization', + visible: true, + }, + ], + expandable: true, + icon: 'https://c8.alamy.com/compit/f4j1rh/verticale-di-tronchi-di-alberi-di-boschi-guardando-verso-l-alto-da-terra-con-il-sole-che-splende-attraverso-foglie-f4j1rh.jpg', + isExpanded: false, + value: 'Guides', + visible: true, + }, + { + children: [ + { + cells: { + ROUTE: { + value: 'customization', + }, + }, + icon: 'style', + value: 'Style customization', + visible: true, + }, + ], + expandable: true, + icon: 'https://c8.alamy.com/compit/f4j1rh/verticale-di-tronchi-di-alberi-di-boschi-guardando-verso-l-alto-da-terra-con-il-sole-che-splende-attraverso-foglie-f4j1rh.jpg', + isExpanded: false, + value: 'Guides', + visible: true, + }, + { + children: [ + { + cells: { + ROUTE: { + value: 'customization', + }, + }, + icon: 'style', + value: 'Style customization', + visible: true, + }, + ], + expandable: true, + icon: 'https://c8.alamy.com/compit/f4j1rh/verticale-di-tronchi-di-alberi-di-boschi-guardando-verso-l-alto-da-terra-con-il-sole-che-splende-attraverso-foglie-f4j1rh.jpg', isExpanded: false, value: 'Guides', visible: true, diff --git a/packages/ketchup/src/assets/input-panel.js b/packages/ketchup/src/assets/input-panel.js index b2574f9e2b..650db95bb5 100644 --- a/packages/ketchup/src/assets/input-panel.js +++ b/packages/ketchup/src/assets/input-panel.js @@ -17,7 +17,12 @@ let data = { }, { name: 'CIT', - title: 'City', + title: 'Tree Options', + visible: true, + }, + { + name: 'LIS', + title: 'Table Options', visible: true, }, { @@ -102,80 +107,221 @@ let data = { }, editable: true, mandatory: true, - options: [ - { - id: 'ROM', - label: 'Rome', - }, - { - id: 'FLO', - label: 'Florence', - }, - { - id: 'VEN', - label: 'Venice', - }, - { - id: 'MAD', - label: 'Madrid', - }, - { - id: 'BAR', - label: 'Barcelona', - }, - { - id: 'SEV', - label: 'Seville', - }, - { - id: 'BER', - label: 'Berlin', - }, - { - id: 'MUN', - label: 'Munich', - }, - { - id: 'HAM', - label: 'Hamburg', - }, - { - id: 'PAR', - label: 'Paris', - }, - { - id: 'MAR', - label: 'Marseille', - }, - { - id: 'LYO', - label: 'Lyon', - }, - { - id: 'LIS', - label: 'Lisbon', - }, - { - id: 'POR', - label: 'Porto', - }, - { - id: 'FAR', - label: 'Faro', - }, - { - id: 'LON', - label: 'London', - }, - { - id: 'MAN', - label: 'Manchester', - }, - { - id: 'LIV', - label: 'Liverpool', - }, - ], + options: { + type: 'SmeupTree', + messages: [], + children: [ + { + content: { + codice: 'ROM', + testo: 'Rome', + }, + children: [ + { + content: { + codice: 'ROS', + testo: 'Rome Sud', + }, + children: [], + }, + { + content: { + codice: 'RON', + testo: 'Rome Nord', + }, + children: [], + }, + ], + }, + { + content: { + codice: 'FLO', + testo: 'Florence', + }, + children: [], + }, + { + content: { + codice: 'VEN', + testo: 'Venice', + }, + }, + { + content: { + codice: 'MAD', + testo: 'Madrid', + }, + }, + { + content: { + codice: 'BAR', + testo: 'Barcelona', + }, + }, + { + content: { + codice: 'SEV', + testo: 'Seville', + }, + }, + { + content: { + codice: 'BER', + testo: 'Berlin', + }, + }, + { + content: { + codice: 'MUN', + testo: 'Munich', + }, + }, + { + content: { + codice: 'HAM', + testo: 'Hamburg', + }, + }, + { + content: { + codice: 'PAR', + testo: 'Paris', + }, + }, + { + content: { + codice: 'MAR', + testo: 'Marseille', + }, + }, + { + content: { + codice: 'LYO', + testo: 'Lyon', + }, + }, + { + content: { + codice: 'LIS', + testo: 'Lisbon', + }, + }, + { + content: { + codice: 'POR', + testo: 'Porto', + }, + }, + { + content: { + codice: 'FAR', + testo: 'Faro', + }, + }, + { + content: { + codice: 'LON', + testo: 'London', + }, + }, + { + content: { + codice: 'MAN', + testo: 'Manchester', + }, + }, + { + content: { + codice: 'LIV', + testo: 'Liverpool', + }, + }, + ], + }, + fun: 'FUN ', + shape: 'ACP', + }, + LIS: { + value: '', + obj: { + t: '', + p: '', + k: '', + }, + editable: true, + mandatory: true, + options: { + type: 'SmeupTable', + messages: [], + rows: [ + { + fields: { + E1: { + smeupObject: { + codice: 'E1', + testo: 'Element 1', + }, + }, + E2: { + smeupObject: { + codice: 'E2', + testo: 'Element 2', + }, + }, + E3: { + smeupObject: { + codice: 'E3', + testo: 'Element 3', + }, + }, + }, + }, + { + fields: { + E4: { + smeupObject: { + codice: 'E4', + testo: 'Element 4', + }, + }, + E5: { + smeupObject: { + codice: 'E5', + testo: 'Element 5', + }, + }, + E6: { + smeupObject: { + codice: 'E6', + testo: 'Element 6', + }, + }, + }, + }, + { + fields: { + E14: { + smeupObject: { + codice: 'E14', + testo: 'Element 14', + }, + }, + E15: { + smeupObject: { + codice: 'E15', + testo: 'Element 15', + }, + }, + E16: { + smeupObject: { + codice: 'E16', + testo: 'Element 16', + }, + }, + }, + }, + ], + }, shape: 'ACP', }, CHK: { @@ -209,7 +355,67 @@ let data = { shape: 'RAD', }, }, - layout: {}, + layout: { + sections: [ + { + content: [ + { + id: 'NAM', + colStart: 1, + colEnd: 1, + rowStart: 1, + rowEnd: 1, + }, + { + id: 'SUR', + colStart: 2, + colEnd: 2, + rowStart: 1, + rowEnd: 1, + }, + { + id: 'NAT', + colStart: 1, + colEnd: 1, + rowStart: 2, + rowEnd: 2, + }, + { + id: 'CIT', + colStart: 2, + colEnd: 2, + rowStart: 2, + rowEnd: 2, + }, + { + id: 'CHK', + colStart: 1, + colEnd: 1, + rowStart: 3, + rowEnd: 3, + }, + { + id: 'RAD', + colSpan: 2, + rowStart: 3, + rowEnd: 3, + }, + { + id: 'LIS', + colStart: 3, + colEnd: 3, + rowStart: 2, + rowEnd: 2, + }, + ], + dim: '50%', + gridCols: 3, + gridRows: 3, + gap: 2, + }, + ], + horizontal: true, + }, }, ], }; @@ -246,4 +452,29 @@ const inputPanelCallback = [ }, ]; +const optionsHandlerCallback = () => { + return Promise.resolve({ + type: 'SmeupTree', + messages: [], + children: [ + { + content: { + codice: 'ROM', + testo: 'Rome', + }, + children: [], + }, + { + content: { + codice: 'TAR', + testo: 'Taranto', + }, + children: [], + }, + ], + }); +}; + inputPanel.valueChangeCb = inputPanelCallback; +inputPanel.optionsHandler = optionsHandlerCallback; +inputPanel.submitCb = (e) => console.log(e); diff --git a/packages/ketchup/src/assets/planner-example-5.js b/packages/ketchup/src/assets/planner-example-5.js index 7e17d8c6a5..8e93fb252c 100644 --- a/packages/ketchup/src/assets/planner-example-5.js +++ b/packages/ketchup/src/assets/planner-example-5.js @@ -9,6 +9,14 @@ document.addEventListener('kup-button-click', () => { comp.remove(); }); +document.addEventListener('kup-planner-datechange', (e) => { + console.log(e) +}); + +document.addEventListener('kup-planner-phasedrop', (e) => { + console.log(e) +}); + const props = { customStyle: '', data: { @@ -1482,11 +1490,11 @@ const props = { }, isEditable: false, obj: { - k: '20991231', + k: '20241231', p: '*YYMD', t: 'D8', }, - value: '2099-12-31', + value: '2024-12-31', }, DATORD: { @@ -1498,11 +1506,11 @@ const props = { }, isEditable: false, obj: { - k: '20991231', + k: '20241231', p: '*YYMD', t: 'D8', }, - value: '2099-12-31', + value: '2024-12-31', }, DATINZ: { @@ -1514,11 +1522,11 @@ const props = { }, isEditable: false, obj: { - k: '20991231', + k: '20241231', p: '*YYMD', t: 'D8', }, - value: '2099-12-31', + value: '2024-12-31', }, 'R§COMM': { @@ -1602,7 +1610,7 @@ const props = { phaseNameCol: 'DESFAS', phasePrevDates: ['DATINZ', 'DATFPO'], readOnly: false, - showSecondaryDates: true, + showSecondaryDates: false, taskColumns: ['R§COMM', 'R§CDCL', 'DATINZ', 'DATPRE'], taskDates: ['DATINZ', 'DATPRE'], taskHeight: 400, @@ -1610,6 +1618,10 @@ const props = { taskNameCol: 'R§COMM', taskPrevDates: ['INZORD', 'DATORD'], titleMess: '', + detailHours: ['INITHHMM', 'ENDHHMM'], + phaseHours: ['INITHHMMSS', 'ENDHHMMSS'], + taskHours: ['INITHHMM', 'ENDHHMM'], + scrollableTaskList: true }; if (props) { diff --git a/packages/ketchup/src/assets/planner-example-6.js b/packages/ketchup/src/assets/planner-example-6.js index c770344ccf..4807b96cfd 100644 --- a/packages/ketchup/src/assets/planner-example-6.js +++ b/packages/ketchup/src/assets/planner-example-6.js @@ -396,6 +396,9 @@ const props = { detailHours: ['INITHHMM', 'ENDHHMM'], phaseHours: ['INITHHMMSS', 'ENDHHMMSS'], taskHours: ['INITHHMM', 'ENDHHMM'], + detailPrevHours: ['INPRHHMM', 'ENPRHHMM'], + phasePrevHours: ['INPRHHMMSS', 'ENPRHHMMSS'], + taskPrevHours: ['INPRHHMM', 'ENPRHHMM'], scrollableTaskList: true, }; diff --git a/packages/ketchup/src/assets/planner.js b/packages/ketchup/src/assets/planner.js index 0290dc26d2..9c6e187d66 100644 --- a/packages/ketchup/src/assets/planner.js +++ b/packages/ketchup/src/assets/planner.js @@ -529,12 +529,12 @@ const props = { }, isEditable: false, obj: { - k: 'MAC.FMRSI-31-150-CNC', + k: 'MAC.FMRSI-31-150-CNCMAC.FMRSI-31-150-CNCMAC.FMRSI-31-150-CNC', p: '', t: '', }, - value: 'MAC.FMRSI-31-150-CNC', - displayedValue: 'MAC.FMRSI-31-150-CNC', + value: 'MAC.FMRSI-31-150-CNCMAC.FMRSI-31-150-CNCMAC.FMRSI-31-150-CNC', + displayedValue: 'MAC.FMRSI-31-150-CNCMAC.FMRSI-31-150-CNCMAC.FMRSI-31-150-CNC', }, 'R£CDCL': { data: { @@ -2780,6 +2780,7 @@ const props = { taskNameCol: 'R£COMM', taskPrevDates: [], titleMess: '', + scrollableTaskList: true }; if (props) { diff --git a/packages/ketchup/src/components.d.ts b/packages/ketchup/src/components.d.ts index e8a71d8de5..1d3501a0f2 100644 --- a/packages/ketchup/src/components.d.ts +++ b/packages/ketchup/src/components.d.ts @@ -43,7 +43,7 @@ import { FImageData } from "./f-components/f-image/f-image-declarations"; import { KupImageClickEventPayload } from "./components/kup-image/kup-image-declarations"; import { KupImageListDataNode, KupImageListEventPayload } from "./components/kup-image-list/kup-image-list-declarations"; import { KupTreeColumnMenuEventPayload, KupTreeColumnRemoveEventPayload, KupTreeContextMenuEventPayload, KupTreeDynamicMassExpansionEventPayload, KupTreeExpansionMode, KupTreeNode, KupTreeNodeButtonClickEventPayload, KupTreeNodeCollapseEventPayload, KupTreeNodeExpandEventPayload, KupTreeNodeSelectedEventPayload, TreeNodePath } from "./components/kup-tree/kup-tree-declarations"; -import { InputPanelEventsCallback, KupInputPanelData } from "./components/kup-input-panel/kup-input-panel-declarations"; +import { InputPanelOptionsHandler, KupInputPanelData, KupInputPanelSubmit } from "./components/kup-input-panel/kup-input-panel-declarations"; import { KupLazyRender } from "./components/kup-lazy/kup-lazy-declarations"; import { KupNavBarStyling } from "./components/kup-nav-bar/kup-nav-bar-declarations"; import { KupNumericPickerEventPayload } from "./components/kup-numeric-picker/kup-numeric-picker-declarations"; @@ -93,7 +93,7 @@ export { FImageData } from "./f-components/f-image/f-image-declarations"; export { KupImageClickEventPayload } from "./components/kup-image/kup-image-declarations"; export { KupImageListDataNode, KupImageListEventPayload } from "./components/kup-image-list/kup-image-list-declarations"; export { KupTreeColumnMenuEventPayload, KupTreeColumnRemoveEventPayload, KupTreeContextMenuEventPayload, KupTreeDynamicMassExpansionEventPayload, KupTreeExpansionMode, KupTreeNode, KupTreeNodeButtonClickEventPayload, KupTreeNodeCollapseEventPayload, KupTreeNodeExpandEventPayload, KupTreeNodeSelectedEventPayload, TreeNodePath } from "./components/kup-tree/kup-tree-declarations"; -export { InputPanelEventsCallback, KupInputPanelData } from "./components/kup-input-panel/kup-input-panel-declarations"; +export { InputPanelOptionsHandler, KupInputPanelData, KupInputPanelSubmit } from "./components/kup-input-panel/kup-input-panel-declarations"; export { KupLazyRender } from "./components/kup-lazy/kup-lazy-declarations"; export { KupNavBarStyling } from "./components/kup-nav-bar/kup-nav-bar-declarations"; export { KupNumericPickerEventPayload } from "./components/kup-numeric-picker/kup-numeric-picker-declarations"; @@ -1167,9 +1167,12 @@ export namespace Components { "onclickTaskList": (id: string) => void; "oncontextmenuTaskList": (event: MouseEvent, id: string) => void; "ondblclickTaskList": (id: string) => void; + "ontaskListScrollWidth": (width: number) => void; "rowHeight": number; "rowWidth": string; + "scrollableTaskList": boolean; "setSelectedTask": (taskId: string) => void; + "taskListScrollX": number; "tasks": KupPlannerTask[]; } interface KupDashboard { @@ -2098,6 +2101,7 @@ export namespace Components { "label": string; "listCellWidth": KupPlannerGanttProps['listCellWidth']; "locale": KupPlannerGanttProps['locale']; + "phaseDrop": KupPlannerGanttProps['phaseDrop']; "preStepsCount": KupPlannerGanttProps['preStepsCount']; "progressChange": KupPlannerGanttProps['progressChange']; "projectBackgroundColor": KupPlannerGanttProps['projectBackgroundColor']; @@ -2115,6 +2119,7 @@ export namespace Components { "rtl": KupPlannerGanttProps['rtl']; "scrollXChange": KupPlannerGanttProps['scrollXChange']; "scrollYChange": KupPlannerGanttProps['scrollYChange']; + "scrollableTaskList"?: boolean; "select": KupPlannerGanttProps['select']; "setDoubleView"?: (checked: boolean) => void; "showSecondaryDates": KupPlannerGanttProps['showSecondaryDates']; @@ -2290,6 +2295,8 @@ export namespace Components { "ganttEvent": KupPlannerTaskGanttContentProps['ganttEvent']; "gridProps": KupPlannerTaskGanttProps['gridProps']; "hideLabel"?: KupPlannerTaskGanttContentProps['hideLabel']; + "phaseDragScroll": (scrollY: number) => void; + "phaseDrop": KupPlannerEventOption['phaseDrop']; "progressChange": KupPlannerEventOption['progressChange']; "projection"?: KupPlannerTaskGanttContentProps['projection']; "readOnly": KupPlannerTaskGanttContentProps['readOnly']; @@ -2306,9 +2313,14 @@ export namespace Components { } interface KupHorizontalScroll { "horizontalScroll": (event: UIEvent) => void; + "horizontalTaskListScroll": (event: UIEvent) => void; + "listCellWidth": string; "rtl": boolean; "scrollNumber": number; + "scrollableTaskList": boolean; "svgWidth": number; + "taskListScrollNumber": number; + "taskListScrollWidth": number; "taskListTrueRef": HTMLKupTaskListElement; "taskListWidth": number; } @@ -2407,7 +2419,7 @@ export namespace Components { interface KupImageList { /** * Number of columns to display in the grid layout. - * @default 4 + * @default null */ "columns": number; /** @@ -2471,16 +2483,16 @@ export namespace Components { * @returns List of props as object, each key will be a prop. */ "getProps": (descriptions?: boolean) => Promise(
p: P,
start: Date,
- end: Date
+ end: Date,
+ startHour: string,
+ endHour: string
): P => {
const kupDates: KupDates = new KupDates();
const startDate = kupDates.formatToIsoDate(start);
const endDate = kupDates.formatToIsoDate(end);
- const extra = { startDate, endDate };
+ const extra = { startDate, endDate, startHour, endHour };
return { ...p, ...extra };
};
@@ -340,6 +354,10 @@ export const ganttDateRangeFromGanttTask = (
end: Date;
secondaryStart?: Date;
secondaryEnd?: Date;
+ startHour?: string,
+ endHour?: string,
+ secondaryStartHour?: string,
+ secondaryEndHour?: string
}[] = [];
const kupDates: KupDates = new KupDates();
tasks.forEach((item) => {
@@ -348,6 +366,10 @@ export const ganttDateRangeFromGanttTask = (
end: kupDates.parseToDayEnd(item.endDate),
secondaryStart: kupDates.parseToDayStart(item.secondaryStartDate),
secondaryEnd: kupDates.parseToDayEnd(item.secondaryEndDate),
+ startHour: item.startHour,
+ endHour: item.endHour,
+ secondaryStartHour: item.secondaryStartHour,
+ secondaryEndHour: item.secondaryEndHour
});
item.phases?.forEach((phase) => {
dates.push({
@@ -357,6 +379,10 @@ export const ganttDateRangeFromGanttTask = (
phase.secondaryStartDate
),
secondaryEnd: kupDates.parseToDayEnd(phase.secondaryEndDate),
+ startHour: item.startHour,
+ endHour: item.endHour,
+ secondaryStartHour: item.secondaryStartHour,
+ secondaryEndHour: item.secondaryEndHour
});
});
});
@@ -375,6 +401,10 @@ export const ganttDateRangeGeneric = (
end: Date;
secondaryStart?: Date;
secondaryEnd?: Date;
+ startHour?: string,
+ endHour?: string,
+ secondaryStartHour?: string,
+ secondaryEndHour?: string
}[],
viewMode: KupPlannerViewMode,
preStepsCount: number,
@@ -431,6 +461,32 @@ export const ganttDateRangeGeneric = (
newEndDate = startOfDate(newEndDate, 'day');
newEndDate = addToDate(newEndDate, 19, 'day');
break;
+ case 'hour':
+ newStartDate = startOfDate(newStartDate, "hour");
+ newStartDate = addToDate(newStartDate, -1 * preStepsCount, "hour");
+ newEndDate = startOfDate(newEndDate, "day");
+ newEndDate = addToDate(newEndDate, 1, "day");
+ break;
+ /*
+ case ViewMode.QuarterDay:
+ newStartDate = startOfDate(newStartDate, "day");
+ newStartDate = addToDate(newStartDate, -1 * preStepsCount, "day");
+ newEndDate = startOfDate(newEndDate, "day");
+ newEndDate = addToDate(newEndDate, 66, "hour"); // 24(1 day)*3 - 6
+ break;
+ case ViewMode.HalfDay:
+ newStartDate = startOfDate(newStartDate, "day");
+ newStartDate = addToDate(newStartDate, -1 * preStepsCount, "day");
+ newEndDate = startOfDate(newEndDate, "day");
+ newEndDate = addToDate(newEndDate, 108, "hour"); // 24(1 day)*5 - 12
+ break;
+ case ViewMode.Hour:
+ newStartDate = startOfDate(newStartDate, "hour");
+ newStartDate = addToDate(newStartDate, -1 * preStepsCount, "hour");
+ newEndDate = startOfDate(newEndDate, "day");
+ newEndDate = addToDate(newEndDate, 1, "day");
+ break;
+ */
}
return [newStartDate, newEndDate];
};
@@ -446,6 +502,10 @@ export const ganttDateRangeFromDetail = (
end: Date;
secondaryStart?: Date;
secondaryEnd?: Date;
+ startHour?: string,
+ endHour?: string,
+ secondaryStartHour?: string,
+ secondaryEndHour?: string
}[] = [];
const kupDates: KupDates = new KupDates();
details.forEach((item) => {
@@ -537,6 +597,10 @@ export const ganttDateRangeFromTask = (
end: Date;
secondaryStart?: Date;
secondaryEnd?: Date;
+ startHour?: string,
+ endHour?: string,
+ secondaryStartHour?: string,
+ secondaryEndHour?: string
}[] = [];
tasks.forEach((item) => {
@@ -545,6 +609,10 @@ export const ganttDateRangeFromTask = (
end: item.end,
secondaryStart: item.secondaryStart,
secondaryEnd: item.secondaryEnd,
+ startHour:item.startHour,
+ endHour: item.endHour,
+ secondaryStartHour: item.secondaryStartHour,
+ secondaryEndHour: item.secondaryEndHour
});
});
if (mainGanttStartDate && mainGanttEndDate) {
@@ -584,6 +652,9 @@ export const seedDates = (
case 'day':
currentDate = addToDate(currentDate, 1, 'day');
break;
+ case 'hour':
+ currentDate = addToDate(currentDate, 1, "hour");
+ break;
/*
case ViewMode.HalfDay:
currentDate = addToDate(currentDate, 12, "hour");
diff --git a/packages/ketchup/src/components/kup-planner/utils/kup-planner-renderer.tsx b/packages/ketchup/src/components/kup-planner/utils/kup-planner-renderer.tsx
index fc6dcc6dca..68e68d544e 100644
--- a/packages/ketchup/src/components/kup-planner/utils/kup-planner-renderer.tsx
+++ b/packages/ketchup/src/components/kup-planner/utils/kup-planner-renderer.tsx
@@ -166,7 +166,7 @@ export class KupPlannerRenderer {
this.timeUnit = this.props?.viewMode;
this.currentTasks = this.props?.mainGantt.items || [];
this.currentDetails = this.props?.secondaryGantt?.items;
- this.scrollX = this.props?.mainGantt?.initialScrollX || -1;
+ this.scrollX = this.props?.mainGantt?.initialScrollX ?? -1;
this.mainGanttDoubleView =
this.props?.mainGantt?.showSecondaryDates ?? false;
this.displayedDates = calculateDisplayedDateRange(
@@ -330,6 +330,50 @@ export class KupPlannerRenderer {
setTimeout(this.getScrollX, 500);
}
+ // Handle phase drop
+ handlePhaseDrop(
+ originalPhaseData: KupPlannerGanttTaskN,
+ // originalTaskData: KupPlannerGanttTaskN | KupPlannerItemDetail,
+ finalPhaseData: KupPlannerTask,
+ destinationData: KupPlannerGanttTaskN | KupPlannerItemDetail,
+ onPhaseDrop: any
+ ) {
+ // Invoke callback
+
+ let row = undefined;
+
+ const currentProjects = this.currentTasks as KupPlannerGanttTask[];
+
+ const parentOfClickedPhase: KupPlannerGanttTaskN | undefined = (
+ currentProjects as KupPlannerGanttTaskN[]
+ ).find((p) => p.phases?.some((ph) => ph?.id === finalPhaseData.id));
+ if (parentOfClickedPhase) {
+ const phases = mergeTaskIntoPhases(
+ parentOfClickedPhase.phases,
+ finalPhaseData
+ );
+ const updatedProjects = (
+ currentProjects as KupPlannerGanttTaskN[]
+ ).map((p) =>
+ p.id === parentOfClickedPhase.id ? { ...p, phases } : p
+ );
+ row = getPhaseById(finalPhaseData.id, updatedProjects);
+ }
+
+ delete row?.['taskRow'];
+ onPhaseDrop?.({
+ originalPhaseData,
+ // originalTaskData,
+ finalPhaseData: row,
+ destinationData,
+ });
+
+ // to move the phase back to its original position
+ this.currentTasks = JSON.parse(JSON.stringify(this.currentTasks));
+ // Use setTimeout to ensure DOM updates
+ setTimeout(this.getScrollX, 500);
+ }
+
// Get scrollX
getScrollX() {
if (this.rootElement) {
@@ -475,6 +519,37 @@ export class KupPlannerRenderer {
label={this.props.mainGantt.title}
doubleView={this.mainGanttDoubleView ?? false}
setDoubleView={this.handleSetDoubleView.bind(this)}
+ scrollableTaskList={this.props.scrollableTaskList}
+ phaseDrop={(
+ originalPhaseData,
+ originalTaskData,
+ finalPhaseData,
+ destinationData
+ ) => {
+ const originalPhase = getPhaseById(
+ originalPhaseData.id,
+ this.currentTasks
+ );
+ const originalTask = getProjectById(
+ originalTaskData.id,
+ this.currentTasks
+ );
+ const finalPhase = getPhaseById(
+ finalPhaseData.id,
+ this.currentTasks
+ );
+ const destinationTask = getProjectById(
+ destinationData.id,
+ this.currentTasks
+ );
+ this.handlePhaseDrop(
+ originalPhase,
+ // originalTask,
+ finalPhaseData,
+ destinationTask,
+ this.props.mainGantt.onPhaseDrop
+ );
+ }}
/>
{this.props.secondaryGantt && (