From ed653cc98cd97951ff3f1b4266125c05582d7577 Mon Sep 17 00:00:00 2001 From: Christian Kaisermann Date: Fri, 4 Jan 2019 16:59:59 -0200 Subject: [PATCH 1/3] Make rollup resolve image files --- tools/rollup/config.component.watch.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tools/rollup/config.component.watch.js b/tools/rollup/config.component.watch.js index b92bd391..12c2a379 100644 --- a/tools/rollup/config.component.watch.js +++ b/tools/rollup/config.component.watch.js @@ -60,11 +60,7 @@ export default { image({ limit: 10 * 1024, // inline files < 10k, copy files > 10k emitFiles: true, // defaults to true - include: [ - fromWorkspace('**/*.{png,jpg,svg,bmp}'), - fromProject('node_modules', '**', '*.{png,jpg,svg,bmp}'), - fromProject('**', 'node_modules', '**', '*.{png,jpg,svg,bmp}'), - ], + include: [fromProject('**/*.{png,jpg,svg,bmp}')], }), replace({ __NODE_ENV__: JSON.stringify(process.env.NODE_ENV), From 0ae29d96aaf0bd4021a56e19432419fab2066174 Mon Sep 17 00:00:00 2001 From: Christian Kaisermann Date: Fri, 4 Jan 2019 17:00:42 -0200 Subject: [PATCH 2/3] Separate simulator visual wrapper to its own file --- packages/pos/drivers/printer/simulation.js | 2 +- packages/pos/simulator/view/manager.js | 21 +-- .../{hardware/CreditCard.html => Card.html} | 12 +- packages/pos/simulator/view/pos/POS.html | 124 ++---------------- packages/pos/simulator/view/pos/Wrapper.html | 117 +++++++++++++++++ .../view/pos/{ => apps}/Launcher.html | 8 +- 6 files changed, 147 insertions(+), 137 deletions(-) rename packages/pos/simulator/view/pos/{hardware/CreditCard.html => Card.html} (83%) create mode 100644 packages/pos/simulator/view/pos/Wrapper.html rename packages/pos/simulator/view/pos/{ => apps}/Launcher.html (96%) diff --git a/packages/pos/drivers/printer/simulation.js b/packages/pos/drivers/printer/simulation.js index 66646768..482c7fb0 100644 --- a/packages/pos/drivers/printer/simulation.js +++ b/packages/pos/drivers/printer/simulation.js @@ -43,7 +43,7 @@ export function setup(Printer) { }); /** Fire endPrinting if no Virtual POS found */ - if (!View.getPOS() || window.innerWidth <= 480) { + if (!View.getInstance() || window.innerWidth <= 480) { setTimeout(() => HardwareManager.fire('endPrinting'), 1000); } return; diff --git a/packages/pos/simulator/view/manager.js b/packages/pos/simulator/view/manager.js index 9c09cf20..ff0864b6 100644 --- a/packages/pos/simulator/view/manager.js +++ b/packages/pos/simulator/view/manager.js @@ -1,4 +1,4 @@ -import POSConstructor from './pos/POS.html'; +import ViewWrapper from './pos/Wrapper.html'; import EventTarget from '../libs/EventTarget.js'; import extend from '../../extend.js'; @@ -9,7 +9,7 @@ import * as $Printer from '../../drivers/printer/simulation.js'; const View = extend({}, EventTarget()); -let POS; +let instance; let panels = {}; View.addPanel = (driver, panel) => { @@ -20,21 +20,22 @@ View.addPanel = (driver, panel) => { [namespace]: { namespace, panel }, }; - if (POS) { - POS.refs.controlPanel.set({ panels }); + if (instance) { + instance.refs.controlPanel.set({ panels }); } }; + View.addPanel($Printer, PrinterPanel); View.addPanel($Http, HttpPanel); -View.showPOS = () => { - if (!POS) { - POS = new POSConstructor({ target: document.body }); - POS.refs.controlPanel.set({ panels }); +View.show = () => { + if (!instance) { + instance = new ViewWrapper({ target: document.body }); + instance.refs.controlPanel.set({ panels }); } - return POS; + return instance; }; -View.getPOS = () => POS; +View.getInstance = () => instance; export default View; diff --git a/packages/pos/simulator/view/pos/hardware/CreditCard.html b/packages/pos/simulator/view/pos/Card.html similarity index 83% rename from packages/pos/simulator/view/pos/hardware/CreditCard.html rename to packages/pos/simulator/view/pos/Card.html index 66f98000..fefc48a5 100644 --- a/packages/pos/simulator/view/pos/hardware/CreditCard.html +++ b/packages/pos/simulator/view/pos/Card.html @@ -7,19 +7,13 @@ > diff --git a/packages/pos/simulator/view/pos/Wrapper.html b/packages/pos/simulator/view/pos/Wrapper.html new file mode 100644 index 00000000..bd4cc4f4 --- /dev/null +++ b/packages/pos/simulator/view/pos/Wrapper.html @@ -0,0 +1,117 @@ +{#if ENGINE === 'webkit'} +
+
+ + + + +
+
+{:else} +
+ Para um rápido desenvolvimento mais fiel ao ambiente do POS, é recomendado o uso do Chrome como navegador. +
+
+{/if} + + + + + + diff --git a/packages/pos/simulator/view/pos/Launcher.html b/packages/pos/simulator/view/pos/apps/Launcher.html similarity index 96% rename from packages/pos/simulator/view/pos/Launcher.html rename to packages/pos/simulator/view/pos/apps/Launcher.html index 84b0d272..c0bbec3e 100644 --- a/packages/pos/simulator/view/pos/Launcher.html +++ b/packages/pos/simulator/view/pos/apps/Launcher.html @@ -44,10 +44,10 @@ {/if}