Specialization, Textbox

This commit is contained in:
Sebastian Seedorf
2017-06-06 15:45:08 +02:00
parent 006f618c36
commit fc2c3f029a
8 changed files with 335 additions and 220 deletions

442
.idea/workspace.xml generated
View File

@@ -1,23 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="77c12afa-55f1-462c-96eb-1733ba14cab9" name="Default" comment="">
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/app/modules/dyn-form/inputs/textarea-input.component.ts" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/app/modules/dyn-form/services/value.service.ts" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/app/modules/dyn-form/types/keys.pipe.ts" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/typescript-compiler.xml" afterPath="$PROJECT_DIR$/.idea/typescript-compiler.xml" />
<list default="true" id="77c12afa-55f1-462c-96eb-1733ba14cab9" name="Default" comment="added validation, error messages, help tooptips, async question loading and textarea input">
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/app/modules/dyn-form/inputs/textbox-input.component.ts" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/app/app.component.ts" afterPath="$PROJECT_DIR$/src/app/app.component.ts" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/app/modules/dyn-form/dyn-form.component.ts" afterPath="$PROJECT_DIR$/src/app/modules/dyn-form/dyn-form.component.ts" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/app/modules/dyn-form/dyn-form.module.ts" afterPath="$PROJECT_DIR$/src/app/modules/dyn-form/dyn-form.module.ts" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/app/modules/dyn-form/dyn-question.component.ts" afterPath="$PROJECT_DIR$/src/app/modules/dyn-form/dyn-question.component.ts" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/app/modules/dyn-form/inputs/counter-input.component.ts" afterPath="$PROJECT_DIR$/src/app/modules/dyn-form/inputs/counter-input.component.ts" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/app/modules/dyn-form/inputs/custom-input.component.ts" afterPath="$PROJECT_DIR$/src/app/modules/dyn-form/inputs/custom-input.component.ts" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/app/modules/dyn-form/inputs/dropdown-input.component.ts" afterPath="$PROJECT_DIR$/src/app/modules/dyn-form/inputs/dropdown-input.component.ts" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/app/modules/dyn-form/inputs/tag-input.component.ts" afterPath="$PROJECT_DIR$/src/app/modules/dyn-form/inputs/tag-input.component.ts" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/app/modules/dyn-form/services/question.service.ts" afterPath="$PROJECT_DIR$/src/app/modules/dyn-form/services/question.service.ts" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/app/services/http-cached.service.ts" afterPath="$PROJECT_DIR$/src/app/services/http-cached.service.ts" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/tsconfig.json" afterPath="$PROJECT_DIR$/src/tsconfig.json" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/app/modules/dyn-form/inputs/textarea-input.component.ts" afterPath="$PROJECT_DIR$/src/app/modules/dyn-form/inputs/textarea-input.component.ts" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/app/modules/dyn-form/types/question.interface.ts" afterPath="$PROJECT_DIR$/src/app/modules/dyn-form/types/question.interface.ts" />
</list>
<ignored path="$PROJECT_DIR$/.tmp/" />
<ignored path="$PROJECT_DIR$/temp/" />
@@ -35,22 +27,23 @@
<file leaf-file-name="dyn-form.component.ts" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/app/modules/dyn-form/dyn-form.component.ts">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="51">
<caret line="6" column="13" lean-forward="true" selection-start-line="6" selection-start-column="13" selection-end-line="6" selection-end-column="13" />
<state relative-caret-position="357">
<caret line="30" column="53" lean-forward="false" selection-start-line="30" selection-start-column="53" selection-end-line="30" selection-end-column="53" />
<folding>
<element signature="e#0#95#0" expanded="true" />
<marker date="1496417492032" expanded="true" signature="315:695" ph="..." />
<marker date="1496417492032" expanded="true" signature="600:683" ph="..." />
<marker date="1496751936688" expanded="true" signature="315:850" ph="..." />
<marker date="1496751936688" expanded="true" signature="371:726" ph="..." />
<marker date="1496751936688" expanded="true" signature="755:838" ph="..." />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="app.component.ts" pinned="false" current-in-tab="false">
<file leaf-file-name="app.component.ts" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/app/app.component.ts">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="270">
<caret line="21" column="8" lean-forward="false" selection-start-line="21" selection-start-column="8" selection-end-line="21" selection-end-column="8" />
<state relative-caret-position="425">
<caret line="25" column="18" lean-forward="true" selection-start-line="25" selection-start-column="18" selection-end-line="25" selection-end-column="18" />
<folding>
<element signature="e#0#40#0" expanded="true" />
</folding>
@@ -61,7 +54,7 @@
<file leaf-file-name="tag-input.component.ts" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/app/modules/dyn-form/inputs/tag-input.component.ts">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="158">
<state relative-caret-position="17">
<caret line="29" column="10" lean-forward="false" selection-start-line="29" selection-start-column="10" selection-end-line="29" selection-end-column="10" />
<folding>
<element signature="e#0#59#0" expanded="true" />
@@ -71,11 +64,33 @@
</provider>
</entry>
</file>
<file leaf-file-name="textarea-input.component.ts" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/app/modules/dyn-form/inputs/textarea-input.component.ts">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="306">
<caret line="38" column="18" lean-forward="false" selection-start-line="38" selection-start-column="18" selection-end-line="38" selection-end-column="18" />
<folding>
<marker date="1496738970411" expanded="true" signature="343:363" ph="..." />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="textbox-input.component.ts" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/app/modules/dyn-form/inputs/textbox-input.component.ts">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="187">
<caret line="14" column="5" lean-forward="true" selection-start-line="14" selection-start-column="5" selection-end-line="14" selection-end-column="5" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="value.service.ts" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/app/modules/dyn-form/services/value.service.ts">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="17">
<caret line="1" column="72" lean-forward="false" selection-start-line="1" selection-start-column="72" selection-end-line="1" selection-end-column="72" />
<state relative-caret-position="187">
<caret line="11" column="1" lean-forward="false" selection-start-line="11" selection-start-column="1" selection-end-line="11" selection-end-column="1" />
<folding>
<element signature="e#0#43#0" expanded="true" />
</folding>
@@ -83,24 +98,55 @@
</provider>
</entry>
</file>
<file leaf-file-name="dyn-question.component.ts" pinned="false" current-in-tab="true">
<file leaf-file-name="dyn-question.component.ts" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/app/modules/dyn-form/dyn-question.component.ts">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="158">
<caret line="43" column="2" lean-forward="true" selection-start-line="43" selection-start-column="2" selection-end-line="43" selection-end-column="2" />
<state relative-caret-position="17">
<caret line="7" column="10" lean-forward="false" selection-start-line="7" selection-start-column="10" selection-end-line="7" selection-end-column="10" />
<folding>
<element signature="e#0#69#0" expanded="true" />
<marker date="1496417101926" expanded="true" signature="304:2231" ph="..." />
<marker date="1496417101926" expanded="true" signature="766:1071" ph="..." />
<marker date="1496417101926" expanded="true" signature="1121:1379" ph="..." />
<marker date="1496417101926" expanded="true" signature="1433:1763" ph="..." />
<marker date="1496417101926" expanded="true" signature="1816:2082" ph="..." />
<marker date="1496417101926" expanded="true" signature="2137:2218" ph="..." />
<marker date="1496755779452" expanded="true" signature="330:2741" ph="..." />
<marker date="1496755779452" expanded="true" signature="792:1097" ph="..." />
<marker date="1496755779452" expanded="true" signature="1147:1405" ph="..." />
<marker date="1496755779452" expanded="true" signature="1459:1789" ph="..." />
<marker date="1496755779452" expanded="true" signature="1843:2109" ph="..." />
<marker date="1496755779452" expanded="true" signature="2161:2592" ph="..." />
<marker date="1496755779452" expanded="true" signature="2647:2728" ph="..." />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="app.component.html" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/app/app.component.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="15" lean-forward="false" selection-start-line="0" selection-start-column="15" selection-end-line="0" selection-end-column="15" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="index.html" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/index.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="255">
<caret line="15" column="46" lean-forward="false" selection-start-line="15" selection-start-column="46" selection-end-line="15" selection-end-column="46" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="main.ts" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main.ts">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FileTemplateManagerImpl">
@@ -122,18 +168,20 @@
<option value="$PROJECT_DIR$/src/app/app.module.ts" />
<option value="$PROJECT_DIR$/src/app/app.component.html" />
<option value="$PROJECT_DIR$/src/app/modules/dyn-form/inputs/custom-input.component.ts" />
<option value="$PROJECT_DIR$/src/app/modules/dyn-form/inputs/textarea-input.component.ts" />
<option value="$PROJECT_DIR$/src/app/modules/dyn-form/inputs/counter-input.component.ts" />
<option value="$PROJECT_DIR$/src/app/modules/dyn-form/types/keys.pipe.ts" />
<option value="$PROJECT_DIR$/src/app/modules/dyn-form/inputs/dropdown-input.component.ts" />
<option value="$PROJECT_DIR$/src/app/modules/dyn-form/inputs/tag-input.component.ts" />
<option value="$PROJECT_DIR$/src/app/modules/dyn-form/services/question.service.ts" />
<option value="$PROJECT_DIR$/src/app/modules/dyn-form/dyn-form.module.ts" />
<option value="$PROJECT_DIR$/src/app/modules/dyn-form/dyn-question.component.ts" />
<option value="$PROJECT_DIR$/src/app/services/http-cached.service.ts" />
<option value="$PROJECT_DIR$/src/app/modules/dyn-form/dyn-form.component.ts" />
<option value="$PROJECT_DIR$/src/app/app.component.ts" />
<option value="$PROJECT_DIR$/src/app/modules/dyn-form/services/value.service.ts" />
<option value="$PROJECT_DIR$/src/app/modules/dyn-form/inputs/textarea-input.component.ts" />
<option value="$PROJECT_DIR$/src/app/modules/dyn-form/types/question.interface.ts" />
<option value="$PROJECT_DIR$/src/app/modules/dyn-form/inputs/textbox-input.component.ts" />
<option value="$PROJECT_DIR$/src/app/modules/dyn-form/dyn-form.module.ts" />
<option value="$PROJECT_DIR$/src/app/modules/dyn-form/dyn-form.component.ts" />
<option value="$PROJECT_DIR$/src/app/modules/dyn-form/dyn-question.component.ts" />
<option value="$PROJECT_DIR$/src/app/app.component.ts" />
</list>
</option>
</component>
@@ -184,7 +232,6 @@
</navigator>
<panes>
<pane id="Scope" />
<pane id="Scratches" />
<pane id="ProjectPane">
<subPane>
<PATH>
@@ -277,40 +324,6 @@
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="AngularDynFormModule" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="AngularDynFormModule" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="src" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="app" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="modules" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="dyn-form" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="types" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="question.interface.ts" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.NestingTreeNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="AngularDynFormModule" />
@@ -403,6 +416,7 @@
</PATH>
</subPane>
</pane>
<pane id="Scratches" />
</panes>
</component>
<component name="PropertiesComponent">
@@ -527,7 +541,8 @@
<workItem from="1496212456684" duration="4548000" />
<workItem from="1496298794463" duration="23800000" />
<workItem from="1496385401533" duration="17758000" />
<workItem from="1496408793177" duration="8927000" />
<workItem from="1496408793177" duration="9778000" />
<workItem from="1496731076030" duration="17567000" />
</task>
<task id="LOCAL-00001" summary="Merging">
<created>1496129612668</created>
@@ -543,34 +558,50 @@
<option name="project" value="LOCAL" />
<updated>1496129996798</updated>
</task>
<option name="localTasksCounter" value="3" />
<task id="LOCAL-00003" summary="added validation, error messages, help tooptips, async question loading and textarea input">
<created>1496417795407</created>
<option name="number" value="00003" />
<option name="presentableId" value="LOCAL-00003" />
<option name="project" value="LOCAL" />
<updated>1496417795407</updated>
</task>
<option name="localTasksCounter" value="4" />
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="71302000" />
<option name="totallyTimeSpent" value="89720000" />
</component>
<component name="TodoView">
<todo-panel id="selected-file">
<is-autoscroll-to-source value="true" />
</todo-panel>
<todo-panel id="all">
<are-packages-shown value="true" />
<is-autoscroll-to-source value="true" />
</todo-panel>
</component>
<component name="ToolWindowManager">
<frame x="-8" y="-8" width="1456" height="876" extended-state="6" />
<editor active="true" />
<layout>
<window_info id="TypeScript" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3293011" sideWeight="0.49717912" order="11" side_tool="false" content_ui="tabs" />
<window_info id="TypeScript" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3293011" sideWeight="0.49435824" order="11" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.25599435" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.3293011" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3293011" sideWeight="0.50282085" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3293011" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3293011" sideWeight="0.49717912" order="2" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3293011" sideWeight="0.49717912" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3293011" sideWeight="0.5070522" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3293011" sideWeight="0.49153736" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.3293011" sideWeight="0.49717912" order="2" side_tool="false" content_ui="tabs" />
<window_info id="npm" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3293011" sideWeight="0.49294782" order="9" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="true" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.3293011" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
</layout>
</component>
@@ -618,6 +649,8 @@
<option value="$PROJECT_DIR$/src/app/modules/dyn-form/services/value.service.js" />
<option value="$PROJECT_DIR$/src/app/modules/dyn-form/types/keys.pipe.js.map" />
<option value="$PROJECT_DIR$/src/app/modules/dyn-form/types/keys.pipe.js" />
<option value="$PROJECT_DIR$/src/app/modules/dyn-form/inputs/textbox-input.component.js" />
<option value="$PROJECT_DIR$/src/app/modules/dyn-form/inputs/textbox-input.component.js.map" />
</list>
</option>
</component>
@@ -637,13 +670,6 @@
<watches-manager />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/src/app/modules/dyn-form/types/question.interface.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/app/modules/dyn-form/types/question.interface.ts">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="85">
@@ -658,8 +684,9 @@
<caret line="24" column="46" lean-forward="false" selection-start-line="24" selection-start-column="46" selection-end-line="24" selection-end-column="46" />
<folding>
<element signature="e#0#95#0" expanded="true" />
<marker date="1496417492032" expanded="true" signature="315:695" ph="..." />
<marker date="1496417492032" expanded="true" signature="600:683" ph="..." />
<marker date="1496751936688" expanded="true" signature="315:850" ph="..." />
<marker date="1496751936688" expanded="true" signature="371:726" ph="..." />
<marker date="1496751936688" expanded="true" signature="755:838" ph="..." />
</folding>
</state>
</provider>
@@ -678,12 +705,13 @@
<caret line="21" column="27" lean-forward="false" selection-start-line="21" selection-start-column="27" selection-end-line="21" selection-end-column="27" />
<folding>
<element signature="e#0#69#0" expanded="true" />
<marker date="1496417101926" expanded="true" signature="304:2231" ph="..." />
<marker date="1496417101926" expanded="true" signature="766:1071" ph="..." />
<marker date="1496417101926" expanded="true" signature="1121:1379" ph="..." />
<marker date="1496417101926" expanded="true" signature="1433:1763" ph="..." />
<marker date="1496417101926" expanded="true" signature="1816:2082" ph="..." />
<marker date="1496417101926" expanded="true" signature="2137:2218" ph="..." />
<marker date="1496755779452" expanded="true" signature="330:2741" ph="..." />
<marker date="1496755779452" expanded="true" signature="792:1097" ph="..." />
<marker date="1496755779452" expanded="true" signature="1147:1405" ph="..." />
<marker date="1496755779452" expanded="true" signature="1459:1789" ph="..." />
<marker date="1496755779452" expanded="true" signature="1843:2109" ph="..." />
<marker date="1496755779452" expanded="true" signature="2161:2592" ph="..." />
<marker date="1496755779452" expanded="true" signature="2647:2728" ph="..." />
</folding>
</state>
</provider>
@@ -693,7 +721,7 @@
<state relative-caret-position="85">
<caret line="14" column="17" lean-forward="false" selection-start-line="14" selection-start-column="17" selection-end-line="14" selection-end-column="17" />
<folding>
<element signature="e#0#53#0" expanded="true" />
<element signature="e#0#53#0" expanded="false" />
</folding>
</state>
</provider>
@@ -713,7 +741,7 @@
<state relative-caret-position="629">
<caret line="37" column="21" lean-forward="true" selection-start-line="37" selection-start-column="21" selection-end-line="37" selection-end-column="21" />
<folding>
<marker date="1496416164940" expanded="true" signature="343:363" ph="..." />
<marker date="1496738970411" expanded="true" signature="343:363" ph="..." />
</folding>
</state>
</provider>
@@ -747,8 +775,9 @@
<caret line="24" column="46" lean-forward="true" selection-start-line="24" selection-start-column="46" selection-end-line="24" selection-end-column="46" />
<folding>
<element signature="e#0#95#0" expanded="true" />
<marker date="1496417492032" expanded="true" signature="315:695" ph="..." />
<marker date="1496417492032" expanded="true" signature="600:683" ph="..." />
<marker date="1496751936688" expanded="true" signature="315:850" ph="..." />
<marker date="1496751936688" expanded="true" signature="371:726" ph="..." />
<marker date="1496751936688" expanded="true" signature="755:838" ph="..." />
</folding>
</state>
</provider>
@@ -767,12 +796,13 @@
<caret line="21" column="27" lean-forward="true" selection-start-line="21" selection-start-column="27" selection-end-line="21" selection-end-column="27" />
<folding>
<element signature="e#0#69#0" expanded="true" />
<marker date="1496417101926" expanded="true" signature="304:2231" ph="..." />
<marker date="1496417101926" expanded="true" signature="766:1071" ph="..." />
<marker date="1496417101926" expanded="true" signature="1121:1379" ph="..." />
<marker date="1496417101926" expanded="true" signature="1433:1763" ph="..." />
<marker date="1496417101926" expanded="true" signature="1816:2082" ph="..." />
<marker date="1496417101926" expanded="true" signature="2137:2218" ph="..." />
<marker date="1496755779452" expanded="true" signature="330:2741" ph="..." />
<marker date="1496755779452" expanded="true" signature="792:1097" ph="..." />
<marker date="1496755779452" expanded="true" signature="1147:1405" ph="..." />
<marker date="1496755779452" expanded="true" signature="1459:1789" ph="..." />
<marker date="1496755779452" expanded="true" signature="1843:2109" ph="..." />
<marker date="1496755779452" expanded="true" signature="2161:2592" ph="..." />
<marker date="1496755779452" expanded="true" signature="2647:2728" ph="..." />
</folding>
</state>
</provider>
@@ -782,7 +812,7 @@
<state relative-caret-position="238">
<caret line="14" column="17" lean-forward="true" selection-start-line="14" selection-start-column="17" selection-end-line="14" selection-end-column="17" />
<folding>
<element signature="e#0#53#0" expanded="true" />
<element signature="e#0#53#0" expanded="false" />
</folding>
</state>
</provider>
@@ -791,7 +821,9 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="272">
<caret line="16" column="7" lean-forward="true" selection-start-line="16" selection-start-column="7" selection-end-line="16" selection-end-column="7" />
<folding />
<folding>
<element signature="e#0#40#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
@@ -837,14 +869,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/app/modules/dyn-form/types/question.interface.ts">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="459">
<caret line="27" column="23" lean-forward="false" selection-start-line="27" selection-start-column="23" selection-end-line="27" selection-end-column="23" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/tslint.json">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="136">
@@ -860,14 +884,7 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/app/sizer.component.ts">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="136">
<caret line="8" column="9" lean-forward="true" selection-start-line="8" selection-start-column="9" selection-end-line="8" selection-end-column="9" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/app/sizer.component.ts" />
<entry file="file://$PROJECT_DIR$/node_modules/@angular/forms/src/directives/validators.d.ts">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="17">
@@ -912,16 +929,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/app/modules/dyn-form/inputs/textarea-input.component.ts">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="117">
<caret line="38" column="18" lean-forward="false" selection-start-line="38" selection-start-column="18" selection-end-line="38" selection-end-column="18" />
<folding>
<marker date="1496416164940" expanded="true" signature="343:363" ph="..." />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/app/modules/dyn-form/services/question.service.ts">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="136">
@@ -934,17 +941,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="17">
<caret line="1" column="0" lean-forward="false" selection-start-line="1" selection-start-column="0" selection-end-line="1" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/app/modules/dyn-form/dyn-form.module.ts">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="527">
<caret line="31" column="10" lean-forward="false" selection-start-line="31" selection-start-column="10" selection-end-line="31" selection-end-column="10" />
<folding>
<element signature="e#0#53#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
@@ -953,7 +949,7 @@
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding>
<element signature="e#0#39#0" expanded="true" />
<element signature="e#0#39#0" expanded="false" />
</folding>
</state>
</provider>
@@ -962,7 +958,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
@@ -971,40 +966,15 @@
<state relative-caret-position="-1649">
<caret line="20" column="7" lean-forward="false" selection-start-line="20" selection-start-column="4" selection-end-line="20" selection-end-column="7" />
<folding>
<element signature="e#0#76#0" expanded="true" />
<element signature="e#0#76#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/app/app.component.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="115" lean-forward="false" selection-start-line="0" selection-start-column="115" selection-end-line="0" selection-end-column="115" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/index.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="255">
<caret line="15" column="46" lean-forward="false" selection-start-line="15" selection-start-column="46" selection-end-line="15" selection-end-column="46" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main.ts">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/styles.css">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
@@ -1012,9 +982,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding>
<element signature="n#!!doc" expanded="true" />
</folding>
</state>
</provider>
</entry>
@@ -1030,7 +997,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
@@ -1050,41 +1016,35 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/app/modules/dyn-form/dyn-form.component.ts">
<entry file="file://$PROJECT_DIR$/src/app/modules/dyn-form/dyn-form.module.ts">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="51">
<caret line="6" column="13" lean-forward="true" selection-start-line="6" selection-start-column="13" selection-end-line="6" selection-end-column="13" />
<folding>
<element signature="e#0#95#0" expanded="true" />
<marker date="1496417492032" expanded="true" signature="315:695" ph="..." />
<marker date="1496417492032" expanded="true" signature="600:683" ph="..." />
</folding>
<state relative-caret-position="255">
<caret line="28" column="22" lean-forward="false" selection-start-line="28" selection-start-column="22" selection-end-line="28" selection-end-column="22" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/app/app.component.ts">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="270">
<caret line="21" column="8" lean-forward="false" selection-start-line="21" selection-start-column="8" selection-end-line="21" selection-end-column="8" />
<folding>
<element signature="e#0#40#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/app/modules/dyn-form/services/value.service.ts">
<entry file="file://$PROJECT_DIR$/src/app/modules/dyn-form/types/question.interface.ts">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="17">
<caret line="1" column="72" lean-forward="false" selection-start-line="1" selection-start-column="72" selection-end-line="1" selection-end-column="72" />
<caret line="1" column="34" lean-forward="false" selection-start-line="1" selection-start-column="26" selection-end-line="1" selection-end-column="34" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/app/modules/dyn-form/inputs/textarea-input.component.ts">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="306">
<caret line="38" column="18" lean-forward="false" selection-start-line="38" selection-start-column="18" selection-end-line="38" selection-end-column="18" />
<folding>
<element signature="e#0#43#0" expanded="true" />
<marker date="1496738970411" expanded="true" signature="343:363" ph="..." />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/app/modules/dyn-form/inputs/tag-input.component.ts">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="158">
<state relative-caret-position="17">
<caret line="29" column="10" lean-forward="false" selection-start-line="29" selection-start-column="10" selection-end-line="29" selection-end-column="10" />
<folding>
<element signature="e#0#59#0" expanded="true" />
@@ -1093,18 +1053,84 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/app/modules/dyn-form/dyn-form.component.ts">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="357">
<caret line="30" column="53" lean-forward="false" selection-start-line="30" selection-start-column="53" selection-end-line="30" selection-end-column="53" />
<folding>
<element signature="e#0#95#0" expanded="true" />
<marker date="1496751936688" expanded="true" signature="315:850" ph="..." />
<marker date="1496751936688" expanded="true" signature="371:726" ph="..." />
<marker date="1496751936688" expanded="true" signature="755:838" ph="..." />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/app/modules/dyn-form/services/value.service.ts">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="187">
<caret line="11" column="1" lean-forward="false" selection-start-line="11" selection-start-column="1" selection-end-line="11" selection-end-column="1" />
<folding>
<element signature="e#0#43#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/app/modules/dyn-form/inputs/textbox-input.component.ts">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="187">
<caret line="14" column="5" lean-forward="true" selection-start-line="14" selection-start-column="5" selection-end-line="14" selection-end-column="5" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/app/modules/dyn-form/dyn-question.component.ts">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="158">
<caret line="43" column="2" lean-forward="true" selection-start-line="43" selection-start-column="2" selection-end-line="43" selection-end-column="2" />
<state relative-caret-position="17">
<caret line="7" column="10" lean-forward="false" selection-start-line="7" selection-start-column="10" selection-end-line="7" selection-end-column="10" />
<folding>
<element signature="e#0#69#0" expanded="true" />
<marker date="1496417101926" expanded="true" signature="304:2231" ph="..." />
<marker date="1496417101926" expanded="true" signature="766:1071" ph="..." />
<marker date="1496417101926" expanded="true" signature="1121:1379" ph="..." />
<marker date="1496417101926" expanded="true" signature="1433:1763" ph="..." />
<marker date="1496417101926" expanded="true" signature="1816:2082" ph="..." />
<marker date="1496417101926" expanded="true" signature="2137:2218" ph="..." />
<marker date="1496755779452" expanded="true" signature="330:2741" ph="..." />
<marker date="1496755779452" expanded="true" signature="792:1097" ph="..." />
<marker date="1496755779452" expanded="true" signature="1147:1405" ph="..." />
<marker date="1496755779452" expanded="true" signature="1459:1789" ph="..." />
<marker date="1496755779452" expanded="true" signature="1843:2109" ph="..." />
<marker date="1496755779452" expanded="true" signature="2161:2592" ph="..." />
<marker date="1496755779452" expanded="true" signature="2647:2728" ph="..." />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main.ts">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/index.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="255">
<caret line="15" column="46" lean-forward="false" selection-start-line="15" selection-start-column="46" selection-end-line="15" selection-end-column="46" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/app/app.component.html">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="15" lean-forward="false" selection-start-line="0" selection-start-column="15" selection-end-line="0" selection-end-column="15" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/app/app.component.ts">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="425">
<caret line="25" column="18" lean-forward="true" selection-start-line="25" selection-start-column="18" selection-end-line="25" selection-end-column="18" />
<folding>
<element signature="e#0#40#0" expanded="true" />
</folding>
</state>
</provider>

View File

@@ -23,7 +23,7 @@ export class AppComponent {
});
}
static submit(value: any) {
submit(value: any) {
console.log('send', value);
}
}

View File

@@ -6,7 +6,9 @@ import {FormControl, FormGroup} from '@angular/forms';
selector: 'dyn-form',
template: `
<form (ngSubmit)="submit()" [formGroup]="form">
<dyn-question *ngFor="let question of questions" [hidden]="question.properties.methods && question.properties.methods.indexOf(type)==-1" [question]="question" [form]="form" [type]="type" (onChange)="valueChange.emit(this.form.value)"></dyn-question>
<dyn-question *ngFor="let question of questions"
[hidden]="question.properties.methods && question.properties.methods.indexOf(type)==-1 || question.properties.spezialization && form.value.type!=question.properties.spezialization" [ngSwitch]="question.type"
[question]="question" [form]="form" [type]="type" (onChange)="valueChange.emit(form.value)"></dyn-question>
<div class="form-row">
<button [disabled]="form.invalid" type="submit">Save</button>
</div>

View File

@@ -11,6 +11,7 @@ import {QuestionService} from './services/question.service';
import {TextareaInputComponent} from './inputs/textarea-input.component';
import {ValueService} from './services/value.service';
import {KeysPipe} from './types/keys.pipe';
import {TextboxInputComponent} from './inputs/textbox-input.component';
@NgModule({
@@ -29,6 +30,7 @@ import {KeysPipe} from './types/keys.pipe';
HiddenInputComponent,
DropdownInputComponent,
TextareaInputComponent,
TextboxInputComponent,
KeysPipe
],
providers: [

View File

@@ -5,7 +5,7 @@ import {FormGroup, ValidationErrors} from '@angular/forms';
@Component({
selector: 'dyn-question',
template: `
<div [ngSwitch]="question.type" [formGroup]="form">
<div [ngSwitch]="question.type" [formGroup]="form" [hidden]="type=='delete'">
<label [for]="question.properties.key">{{question.properties.label ? question.properties.label + (question.constraints.optional ? '' : ' *') : ''}}</label>
<i [hidden]="question.description" class="help circle icon" (mouseover)="onHover(true)" (mouseout)="onHover(false)">Help</i>
<a [hidden]="!hoverState" class="ui pointing red basic label">{{question.description}}</a><br>
@@ -24,10 +24,16 @@ import {FormGroup, ValidationErrors} from '@angular/forms';
[nullable]="question.constraints.optional" [readonly]="type=='view'"
[items]="question.properties.options"
(ngModelChange)="change()"></dropdown-input>
<textarea-input *ngSwitchCase="'textbox'"
<textarea-input *ngSwitchCase="'textarea'"
[formControlName]="question.properties.key" [id]="question.properties.key"
[nullable]="question.constraints.optional" [readonly]="type=='view'"
(ngModelChange)="change()"></textarea-input>
<textbox-input *ngSwitchCase="'textbox'"
[formControlName]="question.properties.key" [id]="question.properties.key"
[nullable]="question.constraints.optional" [readonly]="type=='view'"
[type]="question.properties.type" [constraints]="question.constraints"
[placeholder]="question.properties.placeholder"
(ngModelChange)="change()"></textbox-input>
<ul [hidden]="!errorList.length">
<li *ngFor="let error of errorList">{{error}}</li>

View File

@@ -37,7 +37,6 @@ export class TextareaInputComponent extends CustomInputComponent {
public validate(c: FormControl): ValidationErrors {
if (!this.initComplete)
return null;
console.log("no error?", !!(this.nullable || this.value));
return this.nullable || (this.value) ? null : {notNullable: {
valid: false,
message: "This field is required!"

View File

@@ -0,0 +1,78 @@
import {Component, forwardRef, Input} from '@angular/core';
import { NG_VALUE_ACCESSOR, NG_VALIDATORS, FormControl, ValidationErrors } from '@angular/forms';
import {CustomInputComponent} from "./custom-input.component";
import {QuestionInterface, QuestionInterfaceCnstr} from '../types/question.interface';
@Component({
selector: 'textbox-input',
template:
`
<input *ngIf="!readonly" (keyup)="onChange($event)" [value]="value" [type]="type" [placeholder]="placeholder"/>
<span *ngIf="readonly && value">{{value}}</span>
<span *ngIf="readonly && !value"><em>No value specified!</em></span>
`,
providers: [
{
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => TextboxInputComponent),
multi: true,
},
{
provide: NG_VALIDATORS,
useExisting: forwardRef(() => TextboxInputComponent),
multi: true,
}]
})
export class TextboxInputComponent extends CustomInputComponent {
@Input() readonly: boolean = false;
@Input() nullable: boolean = false;
@Input() constraints: QuestionInterfaceCnstr = null;
@Input() type: string;
@Input() placeholder: string;
// set initial value
public writeValue(obj: any): void {
if (obj) {
this.value = obj + '';
}
}
// validates the form, returns null when valid else the validation object
public validate(c: FormControl): ValidationErrors {
if (!this.initComplete)
return null;
if (!this.nullable && !this.value)
return {notNullable: {
valid: false,
message: "This field is required!"
}};
if (!this.constraints)
return null;
if (this.constraints.maxLength && this.constraints.maxLength <= this.value.length) {
return {tooLong: {
valid: false,
message: "Length is limited to "+this.constraints.maxLength+" characters."
}};
}
if (this.constraints.maxValue) {
let valueInt = parseInt(this.value, 10);
if (isNaN(valueInt))
return {noNumber: {
valid: false,
message: "This value is not a number "+this.constraints.maxValue+"."
}};
if (this.constraints.maxValue <= valueInt) {
return {tooLarge: {
valid: false,
message: "Maximal allowed value is "+this.constraints.maxValue+"."
}};
}
}
}
// on button click
protected onChange($event: KeyboardEvent): void {
this.value = $event.target['value'];
super.change();
}
}

View File

@@ -19,13 +19,15 @@ export interface QuestionInterface {
// dropdown & flag
options?: {key: string, value: string}[],
},
constraints: {
optional: boolean,
// textbox - string
maxLength?: number,
// textbox - number
maxValue?: number
}
constraints: QuestionInterfaceCnstr
}
export interface QuestionInterfaceCnstr {
optional: boolean,
// textbox - string
maxLength?: number,
// textbox - number
maxValue?: number
}