From 015e62ebd008a5774e26c5fcbcdddc762786610b Mon Sep 17 00:00:00 2001 From: Evren Ozkan Date: Mon, 8 Jan 2018 16:35:18 -0500 Subject: [PATCH] HP Improvements - Add scroll bar into the tab content in protocolEditor - Prevent "Wt." and "Req." fields to go out of screen when constraint value is long - Add "starts with" and "ends with" comparators - Fix the issue with empty input value in ruleEntryDialog --- .../ohif-hanging-protocols/both/lib/comparators.js | 12 ++++++++++++ .../components/protocolEditor/protocolEditor.styl | 4 ++++ .../components/ruleEntryDialog/ruleEntryDialog.js | 4 ++++ .../client/components/ruleTable/ruleTable.styl | 8 ++++++++ Packages/validatejs/load.js | 12 ++++++++++++ 5 files changed, 40 insertions(+) diff --git a/Packages/ohif-hanging-protocols/both/lib/comparators.js b/Packages/ohif-hanging-protocols/both/lib/comparators.js index 4a6e2da66..82c2ba1fe 100644 --- a/Packages/ohif-hanging-protocols/both/lib/comparators.js +++ b/Packages/ohif-hanging-protocols/both/lib/comparators.js @@ -22,6 +22,18 @@ const comparators = [{ validator: 'doesNotContain', validatorOption: 'value', description: 'The attribute must not contain this value.' +}, { + id: 'startsWith', + name: 'Starts with', + validator: 'startsWith', + validatorOption: 'value', + description: 'The attribute must start with this value.' +}, { + id: 'endsWith', + name: 'Ends with', + validator: 'endsWith', + validatorOption: 'value', + description: 'The attribute must end with this value.' }, { id: 'onlyInteger', name: 'Only Integers', diff --git a/Packages/ohif-hanging-protocols/client/components/protocolEditor/protocolEditor.styl b/Packages/ohif-hanging-protocols/client/components/protocolEditor/protocolEditor.styl index bbb0033df..35ba0d28d 100644 --- a/Packages/ohif-hanging-protocols/client/components/protocolEditor/protocolEditor.styl +++ b/Packages/ohif-hanging-protocols/client/components/protocolEditor/protocolEditor.styl @@ -79,6 +79,10 @@ $height = 20px background: #ffffff color: #3e3e3e + .tab-content + height: calc(100% - 60px) + overflow: auto; + .protocolEditorSection padding: 10px margin: 10px 0 diff --git a/Packages/ohif-hanging-protocols/client/components/ruleEntryDialog/ruleEntryDialog.js b/Packages/ohif-hanging-protocols/client/components/ruleEntryDialog/ruleEntryDialog.js index 3b532385a..4a29bcc25 100644 --- a/Packages/ohif-hanging-protocols/client/components/ruleEntryDialog/ruleEntryDialog.js +++ b/Packages/ohif-hanging-protocols/client/components/ruleEntryDialog/ruleEntryDialog.js @@ -378,6 +378,10 @@ Template.ruleEntryDialog.events({ // Update the ReactiveVar with the user-specified value template.currentValue.set(value); + + // Enforce to update the input value (Otherwise, ReactiveVar does not update input value with the same values) + const currentValueInput = $('.ruleEntryDialog').find('input.currentValue'); + currentValueInput.val(value); }, /** * Update the currentValue ReactiveVar if the user changes the attribute value diff --git a/Packages/ohif-hanging-protocols/client/components/ruleTable/ruleTable.styl b/Packages/ohif-hanging-protocols/client/components/ruleTable/ruleTable.styl index f2a2b938a..4b1381e67 100644 --- a/Packages/ohif-hanging-protocols/client/components/ruleTable/ruleTable.styl +++ b/Packages/ohif-hanging-protocols/client/components/ruleTable/ruleTable.styl @@ -33,6 +33,14 @@ table.ruleTable td:first-child text-align: left + overflow-wrap: break-word + word-wrap: break-word + -ms-word-break: break-word + word-break: break-word + -ms-hyphens: auto + -moz-hyphens: auto + -webkit-hyphens: auto + hyphens: auto .addRuleContainer margin: 10px 0 diff --git a/Packages/validatejs/load.js b/Packages/validatejs/load.js index 3462fffba..0f76e71d2 100755 --- a/Packages/validatejs/load.js +++ b/Packages/validatejs/load.js @@ -24,4 +24,16 @@ v.validators.doesNotContain = function(value, options, key) { } }; +v.validators.startsWith = function(value, options, key) { + if (options && value.startsWith && !value.startsWith(options.value)) { + return key + 'must start with ' + options.value; + } +}; + +v.validators.endsWith = function(value, options, key) { + if (options && value.endsWith && !value.endsWith(options.value)) { + return key + 'must end with ' + options.value; + } +}; + validate = v; \ No newline at end of file