@tft/crispr-forms 12.2.20 → 13.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -69
- package/esm2020/index.mjs +2 -0
- package/esm2020/lib/abstracts/autocomplete-field.abstract.mjs +30 -0
- package/esm2020/lib/abstracts/crispr-control.mixin.mjs +27 -0
- package/esm2020/lib/abstracts/crispr-field.abstract.mjs +17 -0
- package/esm2020/lib/abstracts/index.mjs +4 -0
- package/esm2020/lib/crispr-forms.module.mjs +66 -0
- package/esm2020/lib/field-component-map.const.mjs +25 -0
- package/esm2020/lib/field-container/field-container.component.mjs +85 -0
- package/esm2020/lib/field-container/index.mjs +2 -0
- package/esm2020/lib/field.directive.mjs +77 -0
- package/esm2020/lib/form/form.component.mjs +54 -0
- package/esm2020/lib/form-group-list/form-group-list.component.mjs +51 -0
- package/esm2020/lib/form-group-list/form-group-list.module.mjs +54 -0
- package/esm2020/lib/form-group-list/index.mjs +3 -0
- package/esm2020/lib/form.helpers.mjs +185 -0
- package/esm2020/lib/form.operators.mjs +24 -0
- package/esm2020/lib/material/autocomplete-chiplist-field/autocomplete-chiplist-field.component.mjs +111 -0
- package/esm2020/lib/material/autocomplete-field/autocomplete-field.component.mjs +70 -0
- package/esm2020/lib/material/button/button.component.mjs +35 -0
- package/esm2020/lib/material/checkbox-field/checkbox-field.component.mjs +31 -0
- package/esm2020/lib/material/datepicker-field/datepicker-field.component.mjs +45 -0
- package/esm2020/lib/material/divider/divider.component.mjs +22 -0
- package/esm2020/lib/material/file-upload/file-dropzone.directive.mjs +39 -0
- package/esm2020/lib/material/file-upload/file-upload.component.mjs +145 -0
- package/esm2020/lib/material/file-upload/index.mjs +3 -0
- package/esm2020/lib/material/heading/heading.component.mjs +54 -0
- package/esm2020/lib/material/image-upload-field/image-compression.helpers.mjs +4 -0
- package/esm2020/lib/material/image-upload-field/image-upload-field.component.mjs +213 -0
- package/esm2020/lib/material/image-upload-field/index.mjs +2 -0
- package/esm2020/lib/material/index.mjs +18 -0
- package/esm2020/lib/material/info/info.component.mjs +46 -0
- package/esm2020/lib/material/input-field/input-field.component.mjs +27 -0
- package/esm2020/lib/material/material.module.mjs +200 -0
- package/esm2020/lib/material/option/index.mjs +2 -0
- package/esm2020/lib/material/option/option.component.mjs +14 -0
- package/esm2020/lib/material/radio-field/radio-field.component.mjs +29 -0
- package/esm2020/lib/material/select-field/select-field.component.mjs +58 -0
- package/esm2020/lib/material/selected-file/selected-file.component.mjs +47 -0
- package/esm2020/lib/material/slider-field/slider-field.component.mjs +30 -0
- package/esm2020/lib/material/textarea-field/textarea-field.component.mjs +28 -0
- package/esm2020/lib/material/unit-conversion-field/unit-conversion-field.component.mjs +69 -0
- package/esm2020/lib/models/autocomplete-chiplist-field.config.mjs +2 -0
- package/esm2020/lib/models/autocomplete-field.config.mjs +2 -0
- package/esm2020/lib/models/button.config.mjs +2 -0
- package/esm2020/lib/models/checkbox-field.config.mjs +2 -0
- package/esm2020/lib/models/crispr-field.config.mjs +23 -0
- package/esm2020/lib/models/datepicker-field.config.mjs +2 -0
- package/esm2020/lib/models/divider.config.mjs +2 -0
- package/esm2020/lib/models/file-upload-field.config.mjs +2 -0
- package/esm2020/lib/models/form-group-list.config.mjs +2 -0
- package/esm2020/lib/models/heading.config.mjs +3 -0
- package/esm2020/lib/models/image-upload-field.config.mjs +2 -0
- package/esm2020/lib/models/index.mjs +18 -0
- package/esm2020/lib/models/input-field.config.mjs +2 -0
- package/esm2020/lib/models/radio-field.config.mjs +2 -0
- package/esm2020/lib/models/select-field.config.mjs +2 -0
- package/esm2020/lib/models/slider-field.config.mjs +2 -0
- package/esm2020/lib/models/textarea-field.config.mjs +2 -0
- package/esm2020/lib/models/unit-conversion-field.config.mjs +2 -0
- package/esm2020/lib/pipes/crispr-pipes.module.mjs +26 -0
- package/esm2020/lib/pipes/initial-control-value.pipe.mjs +20 -0
- package/esm2020/lib/public_api.mjs +10 -0
- package/esm2020/lib/sub-group/index.mjs +3 -0
- package/esm2020/lib/sub-group/sub-group.component.mjs +20 -0
- package/esm2020/lib/sub-group/sub-group.module.mjs +45 -0
- package/esm2020/tft-crispr-forms.mjs +5 -0
- package/fesm2015/tft-crispr-forms.mjs +1883 -0
- package/fesm2015/tft-crispr-forms.mjs.map +1 -0
- package/fesm2020/tft-crispr-forms.mjs +1875 -0
- package/fesm2020/tft-crispr-forms.mjs.map +1 -0
- package/lib/abstracts/autocomplete-field.abstract.d.ts +4 -1
- package/lib/abstracts/crispr-control.mixin.d.ts +1 -1
- package/lib/abstracts/crispr-field.abstract.d.ts +4 -1
- package/lib/crispr-forms.module.d.ts +14 -0
- package/lib/field-component-map.const.d.ts +21 -20
- package/lib/field-container/field-container.component.d.ts +11 -1
- package/lib/field-container/index.d.ts +1 -0
- package/lib/field.directive.d.ts +14 -5
- package/lib/form/form.component.d.ts +6 -1
- package/lib/form-group-list/form-group-list.component.d.ts +4 -1
- package/lib/form-group-list/form-group-list.module.d.ts +15 -0
- package/lib/form-group-list/index.d.ts +2 -0
- package/lib/form.helpers.d.ts +1 -1
- package/lib/material/autocomplete-chiplist-field/autocomplete-chiplist-field.component.d.ts +3 -0
- package/lib/material/autocomplete-field/autocomplete-field.component.d.ts +4 -1
- package/lib/material/button/button.component.d.ts +3 -0
- package/lib/material/checkbox-field/checkbox-field.component.d.ts +3 -0
- package/lib/material/datepicker-field/datepicker-field.component.d.ts +3 -0
- package/lib/material/divider/divider.component.d.ts +3 -0
- package/lib/material/file-upload/file-dropzone.directive.d.ts +3 -0
- package/lib/material/file-upload/file-upload.component.d.ts +20 -2
- package/lib/material/file-upload/index.d.ts +2 -0
- package/lib/material/heading/heading.component.d.ts +12 -1
- package/lib/material/image-upload-field/image-compression.helpers.d.ts +1 -0
- package/lib/material/image-upload-field/image-upload-field.component.d.ts +63 -0
- package/lib/material/image-upload-field/index.d.ts +1 -0
- package/lib/material/index.d.ts +4 -1
- package/lib/material/info/info.component.d.ts +12 -1
- package/lib/material/input-field/input-field.component.d.ts +3 -0
- package/lib/material/material.module.d.ts +42 -0
- package/lib/material/option/index.d.ts +1 -0
- package/lib/material/option/option.component.d.ts +3 -0
- package/lib/material/radio-field/radio-field.component.d.ts +3 -0
- package/lib/material/select-field/select-field.component.d.ts +3 -0
- package/lib/material/selected-file/selected-file.component.d.ts +10 -0
- package/lib/material/slider-field/slider-field.component.d.ts +3 -0
- package/lib/material/textarea-field/textarea-field.component.d.ts +3 -0
- package/lib/material/unit-conversion-field/unit-conversion-field.component.d.ts +3 -0
- package/lib/models/autocomplete-field.config.d.ts +2 -1
- package/lib/models/button.config.d.ts +3 -2
- package/lib/models/crispr-field.config.d.ts +8 -7
- package/lib/models/file-upload-field.config.d.ts +3 -2
- package/lib/models/image-upload-field.config.d.ts +47 -0
- package/lib/models/index.d.ts +2 -0
- package/lib/models/input-field.config.d.ts +1 -1
- package/lib/models/radio-field.config.d.ts +1 -1
- package/lib/models/unit-conversion-field.config.d.ts +0 -1
- package/lib/pipes/crispr-pipes.module.d.ts +8 -0
- package/lib/pipes/initial-control-value.pipe.d.ts +3 -0
- package/lib/public_api.d.ts +1 -0
- package/lib/sub-group/index.d.ts +2 -0
- package/lib/sub-group/sub-group.component.d.ts +3 -0
- package/lib/sub-group/sub-group.module.d.ts +12 -0
- package/package.json +30 -15
- package/tft-crispr-forms-13.0.1.tgz +0 -0
- package/tft-crispr-forms.d.ts +1 -25
- package/bundles/tft-crispr-forms.umd.js +0 -1719
- package/bundles/tft-crispr-forms.umd.js.map +0 -1
- package/esm2015/index.js +0 -2
- package/esm2015/index.js.map +0 -1
- package/esm2015/index.metadata.json +0 -1
- package/esm2015/lib/abstracts/autocomplete-field.abstract.js +0 -27
- package/esm2015/lib/abstracts/autocomplete-field.abstract.js.map +0 -1
- package/esm2015/lib/abstracts/autocomplete-field.abstract.metadata.json +0 -1
- package/esm2015/lib/abstracts/crispr-control.mixin.js +0 -27
- package/esm2015/lib/abstracts/crispr-control.mixin.js.map +0 -1
- package/esm2015/lib/abstracts/crispr-control.mixin.metadata.json +0 -1
- package/esm2015/lib/abstracts/crispr-field.abstract.js +0 -14
- package/esm2015/lib/abstracts/crispr-field.abstract.js.map +0 -1
- package/esm2015/lib/abstracts/crispr-field.abstract.metadata.json +0 -1
- package/esm2015/lib/abstracts/index.js +0 -4
- package/esm2015/lib/abstracts/index.js.map +0 -1
- package/esm2015/lib/abstracts/index.metadata.json +0 -1
- package/esm2015/lib/crispr-forms.module.js +0 -41
- package/esm2015/lib/crispr-forms.module.js.map +0 -1
- package/esm2015/lib/crispr-forms.module.metadata.json +0 -1
- package/esm2015/lib/crispr-forms.module.ngfactory.js.map +0 -1
- package/esm2015/lib/field-component-map.const.js +0 -28
- package/esm2015/lib/field-component-map.const.js.map +0 -1
- package/esm2015/lib/field-component-map.const.metadata.json +0 -1
- package/esm2015/lib/field-container/field-container.component.js +0 -57
- package/esm2015/lib/field-container/field-container.component.js.map +0 -1
- package/esm2015/lib/field-container/field-container.component.metadata.json +0 -1
- package/esm2015/lib/field-container/field-container.component.ngfactory.js.map +0 -1
- package/esm2015/lib/field-container/field-container.component.scss.shim.ngstyle.js.map +0 -1
- package/esm2015/lib/field.directive.js +0 -55
- package/esm2015/lib/field.directive.js.map +0 -1
- package/esm2015/lib/field.directive.metadata.json +0 -1
- package/esm2015/lib/field.directive.ngfactory.js.map +0 -1
- package/esm2015/lib/form/form.component.js +0 -40
- package/esm2015/lib/form/form.component.js.map +0 -1
- package/esm2015/lib/form/form.component.metadata.json +0 -1
- package/esm2015/lib/form/form.component.ngfactory.js.map +0 -1
- package/esm2015/lib/form/form.component.scss.shim.ngstyle.js.map +0 -1
- package/esm2015/lib/form-group-list/form-group-list.component.js +0 -44
- package/esm2015/lib/form-group-list/form-group-list.component.js.map +0 -1
- package/esm2015/lib/form-group-list/form-group-list.component.metadata.json +0 -1
- package/esm2015/lib/form-group-list/form-group-list.component.ngfactory.js.map +0 -1
- package/esm2015/lib/form-group-list/form-group-list.component.scss.shim.ngstyle.js.map +0 -1
- package/esm2015/lib/form.helpers.js +0 -186
- package/esm2015/lib/form.helpers.js.map +0 -1
- package/esm2015/lib/form.helpers.metadata.json +0 -1
- package/esm2015/lib/form.operators.js +0 -24
- package/esm2015/lib/form.operators.js.map +0 -1
- package/esm2015/lib/form.operators.metadata.json +0 -1
- package/esm2015/lib/material/autocomplete-chiplist-field/autocomplete-chiplist-field.component.js +0 -101
- package/esm2015/lib/material/autocomplete-chiplist-field/autocomplete-chiplist-field.component.js.map +0 -1
- package/esm2015/lib/material/autocomplete-chiplist-field/autocomplete-chiplist-field.component.metadata.json +0 -1
- package/esm2015/lib/material/autocomplete-chiplist-field/autocomplete-chiplist-field.component.ngfactory.js.map +0 -1
- package/esm2015/lib/material/autocomplete-chiplist-field/autocomplete-chiplist-field.component.scss.shim.ngstyle.js.map +0 -1
- package/esm2015/lib/material/autocomplete-field/autocomplete-field.component.js +0 -57
- package/esm2015/lib/material/autocomplete-field/autocomplete-field.component.js.map +0 -1
- package/esm2015/lib/material/autocomplete-field/autocomplete-field.component.metadata.json +0 -1
- package/esm2015/lib/material/autocomplete-field/autocomplete-field.component.ngfactory.js.map +0 -1
- package/esm2015/lib/material/autocomplete-field/autocomplete-field.component.scss.shim.ngstyle.js.map +0 -1
- package/esm2015/lib/material/button/button.component.js +0 -30
- package/esm2015/lib/material/button/button.component.js.map +0 -1
- package/esm2015/lib/material/button/button.component.metadata.json +0 -1
- package/esm2015/lib/material/button/button.component.ngfactory.js.map +0 -1
- package/esm2015/lib/material/button/button.component.scss.shim.ngstyle.js.map +0 -1
- package/esm2015/lib/material/checkbox-field/checkbox-field.component.js +0 -25
- package/esm2015/lib/material/checkbox-field/checkbox-field.component.js.map +0 -1
- package/esm2015/lib/material/checkbox-field/checkbox-field.component.metadata.json +0 -1
- package/esm2015/lib/material/checkbox-field/checkbox-field.component.ngfactory.js.map +0 -1
- package/esm2015/lib/material/checkbox-field/checkbox-field.component.scss.shim.ngstyle.js.map +0 -1
- package/esm2015/lib/material/datepicker-field/datepicker-field.component.js +0 -45
- package/esm2015/lib/material/datepicker-field/datepicker-field.component.js.map +0 -1
- package/esm2015/lib/material/datepicker-field/datepicker-field.component.metadata.json +0 -1
- package/esm2015/lib/material/datepicker-field/datepicker-field.component.ngfactory.js.map +0 -1
- package/esm2015/lib/material/datepicker-field/datepicker-field.component.scss.shim.ngstyle.js.map +0 -1
- package/esm2015/lib/material/divider/divider.component.js +0 -20
- package/esm2015/lib/material/divider/divider.component.js.map +0 -1
- package/esm2015/lib/material/divider/divider.component.metadata.json +0 -1
- package/esm2015/lib/material/divider/divider.component.ngfactory.js.map +0 -1
- package/esm2015/lib/material/divider/divider.component.scss.shim.ngstyle.js.map +0 -1
- package/esm2015/lib/material/file-upload/file-dropzone.directive.js +0 -31
- package/esm2015/lib/material/file-upload/file-dropzone.directive.js.map +0 -1
- package/esm2015/lib/material/file-upload/file-dropzone.directive.metadata.json +0 -1
- package/esm2015/lib/material/file-upload/file-dropzone.directive.ngfactory.js.map +0 -1
- package/esm2015/lib/material/file-upload/file-upload.component.js +0 -80
- package/esm2015/lib/material/file-upload/file-upload.component.js.map +0 -1
- package/esm2015/lib/material/file-upload/file-upload.component.metadata.json +0 -1
- package/esm2015/lib/material/file-upload/file-upload.component.ngfactory.js.map +0 -1
- package/esm2015/lib/material/file-upload/file-upload.component.scss.shim.ngstyle.js.map +0 -1
- package/esm2015/lib/material/heading/heading.component.js +0 -23
- package/esm2015/lib/material/heading/heading.component.js.map +0 -1
- package/esm2015/lib/material/heading/heading.component.metadata.json +0 -1
- package/esm2015/lib/material/heading/heading.component.ngfactory.js.map +0 -1
- package/esm2015/lib/material/heading/heading.component.scss.shim.ngstyle.js.map +0 -1
- package/esm2015/lib/material/index.js +0 -15
- package/esm2015/lib/material/index.js.map +0 -1
- package/esm2015/lib/material/index.metadata.json +0 -1
- package/esm2015/lib/material/info/info.component.js +0 -15
- package/esm2015/lib/material/info/info.component.js.map +0 -1
- package/esm2015/lib/material/info/info.component.metadata.json +0 -1
- package/esm2015/lib/material/info/info.component.ngfactory.js.map +0 -1
- package/esm2015/lib/material/info/info.component.scss.shim.ngstyle.js.map +0 -1
- package/esm2015/lib/material/input-field/input-field.component.js +0 -22
- package/esm2015/lib/material/input-field/input-field.component.js.map +0 -1
- package/esm2015/lib/material/input-field/input-field.component.metadata.json +0 -1
- package/esm2015/lib/material/input-field/input-field.component.ngfactory.js.map +0 -1
- package/esm2015/lib/material/input-field/input-field.component.scss.shim.ngstyle.js.map +0 -1
- package/esm2015/lib/material/material.module.js +0 -107
- package/esm2015/lib/material/material.module.js.map +0 -1
- package/esm2015/lib/material/material.module.metadata.json +0 -1
- package/esm2015/lib/material/material.module.ngfactory.js.map +0 -1
- package/esm2015/lib/material/option/option.component.js +0 -15
- package/esm2015/lib/material/option/option.component.js.map +0 -1
- package/esm2015/lib/material/option/option.component.metadata.json +0 -1
- package/esm2015/lib/material/option/option.component.ngfactory.js.map +0 -1
- package/esm2015/lib/material/option/option.component.scss.shim.ngstyle.js.map +0 -1
- package/esm2015/lib/material/radio-field/radio-field.component.js +0 -25
- package/esm2015/lib/material/radio-field/radio-field.component.js.map +0 -1
- package/esm2015/lib/material/radio-field/radio-field.component.metadata.json +0 -1
- package/esm2015/lib/material/radio-field/radio-field.component.ngfactory.js.map +0 -1
- package/esm2015/lib/material/radio-field/radio-field.component.scss.shim.ngstyle.js.map +0 -1
- package/esm2015/lib/material/select-field/select-field.component.js +0 -50
- package/esm2015/lib/material/select-field/select-field.component.js.map +0 -1
- package/esm2015/lib/material/select-field/select-field.component.metadata.json +0 -1
- package/esm2015/lib/material/select-field/select-field.component.ngfactory.js.map +0 -1
- package/esm2015/lib/material/select-field/select-field.component.scss.shim.ngstyle.js.map +0 -1
- package/esm2015/lib/material/selected-file/selected-file.component.js +0 -17
- package/esm2015/lib/material/selected-file/selected-file.component.js.map +0 -1
- package/esm2015/lib/material/selected-file/selected-file.component.metadata.json +0 -1
- package/esm2015/lib/material/selected-file/selected-file.component.ngfactory.js.map +0 -1
- package/esm2015/lib/material/selected-file/selected-file.component.scss.shim.ngstyle.js.map +0 -1
- package/esm2015/lib/material/slider-field/slider-field.component.js +0 -26
- package/esm2015/lib/material/slider-field/slider-field.component.js.map +0 -1
- package/esm2015/lib/material/slider-field/slider-field.component.metadata.json +0 -1
- package/esm2015/lib/material/slider-field/slider-field.component.ngfactory.js.map +0 -1
- package/esm2015/lib/material/slider-field/slider-field.component.scss.shim.ngstyle.js.map +0 -1
- package/esm2015/lib/material/textarea-field/textarea-field.component.js +0 -22
- package/esm2015/lib/material/textarea-field/textarea-field.component.js.map +0 -1
- package/esm2015/lib/material/textarea-field/textarea-field.component.metadata.json +0 -1
- package/esm2015/lib/material/textarea-field/textarea-field.component.ngfactory.js.map +0 -1
- package/esm2015/lib/material/textarea-field/textarea-field.component.scss.shim.ngstyle.js.map +0 -1
- package/esm2015/lib/material/unit-conversion-field/unit-conversion-field.component.js +0 -63
- package/esm2015/lib/material/unit-conversion-field/unit-conversion-field.component.js.map +0 -1
- package/esm2015/lib/material/unit-conversion-field/unit-conversion-field.component.metadata.json +0 -1
- package/esm2015/lib/material/unit-conversion-field/unit-conversion-field.component.ngfactory.js.map +0 -1
- package/esm2015/lib/material/unit-conversion-field/unit-conversion-field.component.scss.shim.ngstyle.js.map +0 -1
- package/esm2015/lib/models/autocomplete-chiplist-field.config.js +0 -2
- package/esm2015/lib/models/autocomplete-chiplist-field.config.js.map +0 -1
- package/esm2015/lib/models/autocomplete-chiplist-field.config.metadata.json +0 -1
- package/esm2015/lib/models/autocomplete-field.config.js +0 -2
- package/esm2015/lib/models/autocomplete-field.config.js.map +0 -1
- package/esm2015/lib/models/autocomplete-field.config.metadata.json +0 -1
- package/esm2015/lib/models/button.config.js +0 -2
- package/esm2015/lib/models/button.config.js.map +0 -1
- package/esm2015/lib/models/button.config.metadata.json +0 -1
- package/esm2015/lib/models/checkbox-field.config.js +0 -2
- package/esm2015/lib/models/checkbox-field.config.js.map +0 -1
- package/esm2015/lib/models/checkbox-field.config.metadata.json +0 -1
- package/esm2015/lib/models/crispr-field.config.js +0 -22
- package/esm2015/lib/models/crispr-field.config.js.map +0 -1
- package/esm2015/lib/models/crispr-field.config.metadata.json +0 -1
- package/esm2015/lib/models/datepicker-field.config.js +0 -2
- package/esm2015/lib/models/datepicker-field.config.js.map +0 -1
- package/esm2015/lib/models/datepicker-field.config.metadata.json +0 -1
- package/esm2015/lib/models/divider.config.js +0 -2
- package/esm2015/lib/models/divider.config.js.map +0 -1
- package/esm2015/lib/models/divider.config.metadata.json +0 -1
- package/esm2015/lib/models/file-upload-field.config.js +0 -2
- package/esm2015/lib/models/file-upload-field.config.js.map +0 -1
- package/esm2015/lib/models/file-upload-field.config.metadata.json +0 -1
- package/esm2015/lib/models/form-group-list.config.js +0 -2
- package/esm2015/lib/models/form-group-list.config.js.map +0 -1
- package/esm2015/lib/models/form-group-list.config.metadata.json +0 -1
- package/esm2015/lib/models/heading.config.js +0 -3
- package/esm2015/lib/models/heading.config.js.map +0 -1
- package/esm2015/lib/models/heading.config.metadata.json +0 -1
- package/esm2015/lib/models/index.js +0 -16
- package/esm2015/lib/models/index.js.map +0 -1
- package/esm2015/lib/models/index.metadata.json +0 -1
- package/esm2015/lib/models/input-field.config.js +0 -2
- package/esm2015/lib/models/input-field.config.js.map +0 -1
- package/esm2015/lib/models/input-field.config.metadata.json +0 -1
- package/esm2015/lib/models/radio-field.config.js +0 -2
- package/esm2015/lib/models/radio-field.config.js.map +0 -1
- package/esm2015/lib/models/radio-field.config.metadata.json +0 -1
- package/esm2015/lib/models/select-field.config.js +0 -2
- package/esm2015/lib/models/select-field.config.js.map +0 -1
- package/esm2015/lib/models/select-field.config.metadata.json +0 -1
- package/esm2015/lib/models/slider-field.config.js +0 -2
- package/esm2015/lib/models/slider-field.config.js.map +0 -1
- package/esm2015/lib/models/slider-field.config.metadata.json +0 -1
- package/esm2015/lib/models/textarea-field.config.js +0 -2
- package/esm2015/lib/models/textarea-field.config.js.map +0 -1
- package/esm2015/lib/models/textarea-field.config.metadata.json +0 -1
- package/esm2015/lib/models/unit-conversion-field.config.js +0 -2
- package/esm2015/lib/models/unit-conversion-field.config.js.map +0 -1
- package/esm2015/lib/models/unit-conversion-field.config.metadata.json +0 -1
- package/esm2015/lib/pipes/initial-control-value.pipe.js +0 -16
- package/esm2015/lib/pipes/initial-control-value.pipe.js.map +0 -1
- package/esm2015/lib/pipes/initial-control-value.pipe.metadata.json +0 -1
- package/esm2015/lib/pipes/initial-control-value.pipe.ngfactory.js.map +0 -1
- package/esm2015/lib/public_api.js +0 -9
- package/esm2015/lib/public_api.js.map +0 -1
- package/esm2015/lib/public_api.metadata.json +0 -1
- package/esm2015/lib/sub-group/sub-group.component.js +0 -17
- package/esm2015/lib/sub-group/sub-group.component.js.map +0 -1
- package/esm2015/lib/sub-group/sub-group.component.metadata.json +0 -1
- package/esm2015/lib/sub-group/sub-group.component.ngfactory.js.map +0 -1
- package/esm2015/lib/sub-group/sub-group.component.scss.shim.ngstyle.js.map +0 -1
- package/esm2015/tft-crispr-forms.js +0 -30
- package/esm2015/tft-crispr-forms.js.map +0 -1
- package/esm2015/tft-crispr-forms.metadata.json +0 -1
- package/fesm2015/tft-crispr-forms.js +0 -1263
- package/fesm2015/tft-crispr-forms.js.map +0 -1
- package/tft-crispr-forms-12.2.20.tgz +0 -0
- package/tft-crispr-forms.metadata.json +0 -1
|
@@ -1,1263 +0,0 @@
|
|
|
1
|
-
import { of, combineLatest, from, isObservable, BehaviorSubject } from 'rxjs';
|
|
2
|
-
import { FormGroup, FormArray, FormControl, NgControl, ReactiveFormsModule } from '@angular/forms';
|
|
3
|
-
import { map, startWith, debounceTime, distinctUntilChanged, switchMap, tap } from 'rxjs/operators';
|
|
4
|
-
import { Directive, Component, ChangeDetectionStrategy, ViewChild, Optional, Self, Input, EventEmitter, Output, HostListener, NgModule, ComponentFactoryResolver, ViewContainerRef, Renderer2, Pipe } from '@angular/core';
|
|
5
|
-
import { MatSelectModule } from '@angular/material/select';
|
|
6
|
-
import { MatAutocompleteTrigger, MatAutocompleteModule } from '@angular/material/autocomplete';
|
|
7
|
-
import { ENTER } from '@angular/cdk/keycodes';
|
|
8
|
-
import { ComponentPortal, PortalModule } from '@angular/cdk/portal';
|
|
9
|
-
import { CommonModule } from '@angular/common';
|
|
10
|
-
import { MatButtonModule } from '@angular/material/button';
|
|
11
|
-
import { MatButtonToggleModule } from '@angular/material/button-toggle';
|
|
12
|
-
import { MatCheckboxModule } from '@angular/material/checkbox';
|
|
13
|
-
import { MatChipsModule } from '@angular/material/chips';
|
|
14
|
-
import { MatDatepickerModule } from '@angular/material/datepicker';
|
|
15
|
-
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
16
|
-
import { MatIconModule } from '@angular/material/icon';
|
|
17
|
-
import { MatInputModule } from '@angular/material/input';
|
|
18
|
-
import { MatRadioModule } from '@angular/material/radio';
|
|
19
|
-
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
|
20
|
-
import { MatSliderModule } from '@angular/material/slider';
|
|
21
|
-
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
22
|
-
import { MatDividerModule } from '@angular/material/divider';
|
|
23
|
-
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
|
24
|
-
import { FormValidationHandlerModule } from '@tft/form-validation-handler';
|
|
25
|
-
import { MatMomentDateModule } from '@angular/material-moment-adapter';
|
|
26
|
-
|
|
27
|
-
const DEFAULT_EMPTY_OPTIONS_MESSAGE = 'No Items';
|
|
28
|
-
|
|
29
|
-
// export type ControlType = keyof typeof FIELD_COMPONENTS;
|
|
30
|
-
var ControlType;
|
|
31
|
-
(function (ControlType) {
|
|
32
|
-
ControlType["AUTOCOMPLETE"] = "autocomplete";
|
|
33
|
-
ControlType["AUTOCOMPLETE_CHIPLIST"] = "autocompleteChiplist";
|
|
34
|
-
ControlType["BUTTON"] = "button";
|
|
35
|
-
ControlType["CHECKBOX"] = "checkbox";
|
|
36
|
-
ControlType["CUSTOM"] = "custom";
|
|
37
|
-
ControlType["DATEPICKER"] = "datepicker";
|
|
38
|
-
ControlType["DIVIDER"] = "divider";
|
|
39
|
-
ControlType["FILE_UPLOAD"] = "fileUpload";
|
|
40
|
-
ControlType["HEADING"] = "heading";
|
|
41
|
-
ControlType["INPUT"] = "input";
|
|
42
|
-
ControlType["GROUP_LIST"] = "groupList";
|
|
43
|
-
ControlType["RADIO"] = "radio";
|
|
44
|
-
ControlType["SELECT"] = "select";
|
|
45
|
-
ControlType["SLIDER"] = "slider";
|
|
46
|
-
ControlType["SUB_GROUP"] = "subGroup";
|
|
47
|
-
ControlType["TEXTAREA"] = "textarea";
|
|
48
|
-
ControlType["UNIT_CONVERSION"] = "unitConversion";
|
|
49
|
-
})(ControlType || (ControlType = {}));
|
|
50
|
-
|
|
51
|
-
;
|
|
52
|
-
|
|
53
|
-
function valueIn(values) {
|
|
54
|
-
return map((value) => {
|
|
55
|
-
if (value) {
|
|
56
|
-
return values.some(v => {
|
|
57
|
-
if (isRegex(v)) {
|
|
58
|
-
const trimmedStringForRegex = v.substr(1, v.length - 2);
|
|
59
|
-
const regex = new RegExp(trimmedStringForRegex);
|
|
60
|
-
return regex.test(value);
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
return v === value;
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
return false;
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
function isRegex(string) {
|
|
73
|
-
return string.startsWith('/') && string.endsWith('/');
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Watches a single control for a list of values, returns true when field value matches any value in list
|
|
78
|
-
* unless an evaluate method is found on config, in which case that method is run on the returned boolean value
|
|
79
|
-
* @param group the direct parent of the field we want to watch
|
|
80
|
-
* @param config
|
|
81
|
-
*/
|
|
82
|
-
function checkControlForValues(group, config) {
|
|
83
|
-
// check that all the pieces we need are available
|
|
84
|
-
if (config && config.controlName && Array.isArray(config.values)) {
|
|
85
|
-
return getValueChanges(group, config.controlName).pipe(
|
|
86
|
-
// return a boolean, true if value is in the values being watch for, otherwise false
|
|
87
|
-
valueIn(config.values), map((isValueInValues) => {
|
|
88
|
-
// since we can only check if the value is in the list of watched values, the evaluate function gives us
|
|
89
|
-
// a chance to make other decisions based on if the boolean returned, e.g. return true if value not in watched values
|
|
90
|
-
if (config.evaluate && config.evaluate instanceof Function) {
|
|
91
|
-
return config.evaluate(isValueInValues);
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
return isValueInValues;
|
|
95
|
-
}
|
|
96
|
-
}));
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
//
|
|
100
|
-
return of(true);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Watches a list of fields for individual lists of values returning true when any field contains one
|
|
105
|
-
* of the values being watched for, or optionally running a function on the array of resolved booleans
|
|
106
|
-
* from the listed fields and returning a boolean
|
|
107
|
-
* @param group the form group that has the fields to watch as direct descendants
|
|
108
|
-
* @param config the configuration to use when calling the function
|
|
109
|
-
*/
|
|
110
|
-
function checkControlsForValues(group, config) {
|
|
111
|
-
// if no config is passed we just want to show the field, so we return an observable of true
|
|
112
|
-
if (!config || !config.watchConfigs) {
|
|
113
|
-
return of(true);
|
|
114
|
-
}
|
|
115
|
-
// we run checkControlForValues on every control in the list of WatchConfigs creating
|
|
116
|
-
// an array of Observable watching fields for values
|
|
117
|
-
const fieldTriggers = config.watchConfigs.map(watchConfig => {
|
|
118
|
-
// resolves a boolean, true when field value matches a watched value, otherwise false
|
|
119
|
-
return checkControlForValues(group, watchConfig);
|
|
120
|
-
});
|
|
121
|
-
return combineLatest(fieldTriggers).pipe(startWith([true]), map((booleans) => {
|
|
122
|
-
// if the user passed an evaluate function use it
|
|
123
|
-
if (config.evaluate && config.evaluate instanceof Function) {
|
|
124
|
-
return config.evaluate(booleans);
|
|
125
|
-
}
|
|
126
|
-
else { // otherwise we return true if any of the watched fields resolve to true
|
|
127
|
-
return booleans.some(bool => bool);
|
|
128
|
-
}
|
|
129
|
-
}));
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Watches values on an array of fields, computing their values as they change
|
|
133
|
-
* @param group the group to get the fields from, for now it can only be the parent of the computed field
|
|
134
|
-
* @param computeFieldsConfig the configuration that drives the computation, holds the names to watch and the
|
|
135
|
-
* computation function that get called against the array of values
|
|
136
|
-
*/
|
|
137
|
-
function computeValueFromFields(group, computeFieldsConfig) {
|
|
138
|
-
// TODO: better checking
|
|
139
|
-
const { controlNamesToWatch } = computeFieldsConfig;
|
|
140
|
-
//creates an observable listener for each control in the controlNamesToWatch array
|
|
141
|
-
return combineLatest(controlNamesToWatch.map(controlNameToWatch => getValueChanges(group, controlNameToWatch))).pipe(
|
|
142
|
-
// each time a watched field values changes a new array of the latest field values is pipe through to the
|
|
143
|
-
// compute callback. Which runs the users logic on the values to compute this fields value
|
|
144
|
-
map(valuesArray => computeFieldsConfig.computeCallback(valuesArray)));
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* A simple wrapper for doing error checking around getting the valueChanges observable from a control on a form group
|
|
148
|
-
* @param group the form group we want to pull the observable from
|
|
149
|
-
* @param controlName the name of the control who's value we want to subscribe to
|
|
150
|
-
*/
|
|
151
|
-
function getValueChanges(group, controlName) {
|
|
152
|
-
const control = group.get(controlName);
|
|
153
|
-
if (!control) {
|
|
154
|
-
throw new Error(`No control with controlName ${controlName}`);
|
|
155
|
-
}
|
|
156
|
-
return control.valueChanges;
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* TODO: move to utils library after library is built
|
|
160
|
-
* Allows developer to pass an array of operators into the pipe of an Observable.
|
|
161
|
-
* Useful for creating function with a variable amount of operators to be run
|
|
162
|
-
* @param observable the observable to pass the operators to
|
|
163
|
-
* @param operators array of operators to pipe
|
|
164
|
-
*/
|
|
165
|
-
function pipeOperatorsIntoObservable(observable, operators) {
|
|
166
|
-
try {
|
|
167
|
-
return operators.reduce((obs, op) => {
|
|
168
|
-
return obs.pipe(op);
|
|
169
|
-
}, observable);
|
|
170
|
-
}
|
|
171
|
-
catch (_a) {
|
|
172
|
-
console.error('Unable to pipe operators into observable');
|
|
173
|
-
return of(null);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
function callOptionsIfFunction(options, parentGroup, searchString) {
|
|
177
|
-
return options instanceof Function ? options(parentGroup, searchString) : options;
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* The user can give us select options as an array, a function that resolves to a promise,
|
|
181
|
-
* or an observable. This functions consumes any of those and returns an observable that
|
|
182
|
-
* resolves an array of options
|
|
183
|
-
*
|
|
184
|
-
* @param options the options passed in from the config
|
|
185
|
-
* @param emptyMessageOption the message to display when the array is empty
|
|
186
|
-
*/
|
|
187
|
-
function observablifyOptions(options, parentGroup, searchString) {
|
|
188
|
-
const calledOptions = callOptionsIfFunction(options, parentGroup, searchString);
|
|
189
|
-
// if options are a promise
|
|
190
|
-
return calledOptions instanceof Promise
|
|
191
|
-
// convert to observable
|
|
192
|
-
? from(calledOptions)
|
|
193
|
-
// if array that isn't empty
|
|
194
|
-
: Array.isArray(calledOptions) && calledOptions.length
|
|
195
|
-
// convert to observable
|
|
196
|
-
? of(calledOptions)
|
|
197
|
-
// if observable
|
|
198
|
-
: isObservable(calledOptions)
|
|
199
|
-
// return it
|
|
200
|
-
? calledOptions
|
|
201
|
-
// else an empty array
|
|
202
|
-
: of([]);
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Determines if the field config is for a form control (not a divider, heading or other non-control field)
|
|
206
|
-
* */
|
|
207
|
-
function isControlConfig(fieldConfig) {
|
|
208
|
-
return 'controlName' in fieldConfig;
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* builds out form group based on config
|
|
212
|
-
* @param config a configuration for a form group
|
|
213
|
-
* @param value an object of initial values to pass in
|
|
214
|
-
* @param group the form group to modify and build out
|
|
215
|
-
*/
|
|
216
|
-
function buildFormGroupFromConfig(config, value = null, group = new FormGroup({})) {
|
|
217
|
-
config.fields.forEach((controlConfig) => {
|
|
218
|
-
var _a;
|
|
219
|
-
if (isControlConfig(controlConfig)) {
|
|
220
|
-
// then add a control to the group using the controlName from configuration
|
|
221
|
-
const { controlName } = controlConfig;
|
|
222
|
-
// if there's a value object and it has a non-null/undefined value for this field use it.
|
|
223
|
-
// Otherwise, default to null
|
|
224
|
-
const controlValue = (_a = (value && value[controlName])) !== null && _a !== void 0 ? _a : null;
|
|
225
|
-
group.addControl(controlName, createControlForType(controlConfig, controlValue));
|
|
226
|
-
}
|
|
227
|
-
});
|
|
228
|
-
group.setValidators(config.validators);
|
|
229
|
-
return group;
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* Analyze the config and build a form control to spec. Notice we don't use FormBuilder here
|
|
233
|
-
* as we want to keep this function pure.
|
|
234
|
-
* @param controlConfig the configuration object for the control to build
|
|
235
|
-
* @param value an initial value to use if passed in
|
|
236
|
-
*/
|
|
237
|
-
function createControlForType(controlConfig, value = null) {
|
|
238
|
-
// build form control out based on the control type
|
|
239
|
-
const control = controlConfig.controlType === ControlType.SUB_GROUP
|
|
240
|
-
? buildFormGroupFromConfig(controlConfig, value)
|
|
241
|
-
: controlConfig.controlType === ControlType.GROUP_LIST
|
|
242
|
-
? new FormArray([], controlConfig.validators)
|
|
243
|
-
: new FormControl(value || null, controlConfig.validators);
|
|
244
|
-
return control;
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* A basic filter function that filters the search string against the label of the options object
|
|
248
|
-
* @param options the array of options to filter
|
|
249
|
-
* @param searchString the string from the input
|
|
250
|
-
*/
|
|
251
|
-
function filterOptionsByLabel(options, searchString) {
|
|
252
|
-
return options.filter(option => {
|
|
253
|
-
return option.label && option.label.toLowerCase().includes(searchString.toLowerCase());
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
function crisprControlMixin(BaseClass) {
|
|
258
|
-
return class extends BaseClass {
|
|
259
|
-
set value(value) {
|
|
260
|
-
this.setControlValue(value);
|
|
261
|
-
this._value = value;
|
|
262
|
-
}
|
|
263
|
-
get value() {
|
|
264
|
-
return this._value;
|
|
265
|
-
}
|
|
266
|
-
ngOnInit() {
|
|
267
|
-
super.ngOnInit();
|
|
268
|
-
this.control = this.group.get(this.config.controlName);
|
|
269
|
-
this.setControlValue(this.value);
|
|
270
|
-
// setTimeouts are ugly but this seems to be the only way to get the computed field to compute initial values
|
|
271
|
-
setTimeout(() => {
|
|
272
|
-
this.control.updateValueAndValidity();
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
setControlValue(value) {
|
|
276
|
-
if (value && this.control && this.config.controlType !== ControlType.SUB_GROUP) {
|
|
277
|
-
this.control.setValue(value);
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
};
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
// eslint-disable-next-line @angular-eslint/directive-class-suffix
|
|
284
|
-
class CrisprFieldComponent {
|
|
285
|
-
ngOnInit() {
|
|
286
|
-
this.applyDefaultConfig();
|
|
287
|
-
}
|
|
288
|
-
applyDefaultConfig() {
|
|
289
|
-
this.config = this.defaultConfig ? Object.assign(Object.assign({}, this.defaultConfig), this.config) : this.config;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
CrisprFieldComponent.decorators = [
|
|
293
|
-
{ type: Directive }
|
|
294
|
-
];
|
|
295
|
-
|
|
296
|
-
const AbstractAutocompleteFieldMixin = crisprControlMixin(CrisprFieldComponent);
|
|
297
|
-
// eslint-disable-next-line @angular-eslint/directive-class-suffix
|
|
298
|
-
class AbstractAutocompleteComponent extends AbstractAutocompleteFieldMixin {
|
|
299
|
-
constructor() {
|
|
300
|
-
super(...arguments);
|
|
301
|
-
// we need a separate control for the UI because of the way the material autocomplete chiplist works
|
|
302
|
-
this.autocompleteInputControl = new FormControl('');
|
|
303
|
-
}
|
|
304
|
-
ngOnInit() {
|
|
305
|
-
super.ngOnInit();
|
|
306
|
-
this.group.addControl(this.config.controlName, new FormControl());
|
|
307
|
-
// filter options by the search string using either the default filter function or one passed in through config
|
|
308
|
-
this.options$ = this.autocompleteInputControl.valueChanges.pipe(
|
|
309
|
-
// this is needed to have the options panel to open on focus
|
|
310
|
-
startWith(''), debounceTime(this.config.typeDebounceTime), distinctUntilChanged(), map(searchText => searchText || ''), switchMap((searchText) => observablifyOptions(this.config.options, this.group, searchText)));
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
AbstractAutocompleteComponent.decorators = [
|
|
314
|
-
{ type: Directive }
|
|
315
|
-
];
|
|
316
|
-
|
|
317
|
-
const InputFieldMixin = crisprControlMixin(CrisprFieldComponent);
|
|
318
|
-
class InputFieldComponent extends InputFieldMixin {
|
|
319
|
-
constructor() {
|
|
320
|
-
super();
|
|
321
|
-
this.defaultConfig = { inputType: 'text' };
|
|
322
|
-
}
|
|
323
|
-
ngOnInit() {
|
|
324
|
-
super.ngOnInit();
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
InputFieldComponent.decorators = [
|
|
328
|
-
{ type: Component, args: [{
|
|
329
|
-
selector: 'crispr-input-field',
|
|
330
|
-
template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n <mat-form-field\n [color]=\"config.color\"\n [appearance]=\"config.appearance\"\n [formGroup]=\"group\">\n <mat-label *ngIf=\"config.label\">\n {{config.label}}\n </mat-label>\n <input\n [type]=\"config.inputType\"\n matInput\n [placeholder]=\"config.placeholder\"\n [formControlName]=\"config.controlName\"\n [min]=\"config.min\"\n [max]=\"config.max\"\n [maxlength]=\"config.maxLength\"\n [step]=\"config.step\"\n [autofocus]=\"config.autofocus\"\n [pattern]=\"config.pattern\"\n [spellcheck]=\"config.spellcheck\"\n [autocomplete]=\"config.autoComplete\"\n [autocapitalize]=\"config.autoCapitalize\">\n <span *ngIf=\"config.fieldSuffix\" matSuffix>{{config.fieldSuffix}}</span>\n <crispr-info\n matSuffix\n *ngIf=\"config.info\"\n [info]=\"config.info\">\n </crispr-info>\n\n </mat-form-field>\n\n\n</crispr-field-container>\n",
|
|
331
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
332
|
-
styles: [""]
|
|
333
|
-
},] }
|
|
334
|
-
];
|
|
335
|
-
InputFieldComponent.ctorParameters = () => [];
|
|
336
|
-
|
|
337
|
-
const SelectFieldMixin = crisprControlMixin(CrisprFieldComponent);
|
|
338
|
-
class SelectFieldComponent extends SelectFieldMixin {
|
|
339
|
-
constructor() {
|
|
340
|
-
super(...arguments);
|
|
341
|
-
this.defaultConfig = {
|
|
342
|
-
enableToggleAll: false,
|
|
343
|
-
color: 'primary'
|
|
344
|
-
};
|
|
345
|
-
this.allSelected = false;
|
|
346
|
-
}
|
|
347
|
-
ngOnInit() {
|
|
348
|
-
super.ngOnInit();
|
|
349
|
-
// options$ can be passed as an array, promise that resolves array, or observable that resolves array
|
|
350
|
-
// this functions accounts for all possibilities and converts to observable that resolves array
|
|
351
|
-
this.options$ = observablifyOptions(this.config.options, this.group);
|
|
352
|
-
}
|
|
353
|
-
ngAfterViewInit() {
|
|
354
|
-
var _a, _b;
|
|
355
|
-
if (this.config.multiple
|
|
356
|
-
&& this.config.enableToggleAll
|
|
357
|
-
&& ((_a = this.selectField.options) === null || _a === void 0 ? void 0 : _a.length) === ((_b = this.value) === null || _b === void 0 ? void 0 : _b.length)) {
|
|
358
|
-
this.allSelected = true;
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
toggleAll(isSelected) {
|
|
362
|
-
if (isSelected) {
|
|
363
|
-
this.selectField.options.forEach(option => option.deselect());
|
|
364
|
-
}
|
|
365
|
-
else {
|
|
366
|
-
this.selectField.options.forEach(option => option.select());
|
|
367
|
-
}
|
|
368
|
-
this.allSelected = !this.allSelected;
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
SelectFieldComponent.decorators = [
|
|
372
|
-
{ type: Component, args: [{
|
|
373
|
-
selector: 'crispr-select-field',
|
|
374
|
-
template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n\n <mat-form-field\n [color]=\"config.color\"\n [appearance]=\"config.appearance\"\n [formGroup]=\"group\">\n <mat-label *ngIf=\"config.label\">\n {{config.label}}\n </mat-label>\n <mat-select\n #selectField\n [formControlName]=\"config.controlName\"\n [placeholder]=\"config.placeholder\"\n [multiple]=\"config.multiple\">\n\n <mat-checkbox\n [color]=\"config.color\"\n [checked]=\"allSelected\"\n *ngIf=\"config?.multiple && config.enableToggleAll\"\n (click)=\"toggleAll(allSelected)\">\n Select All\n </mat-checkbox>\n <mat-option\n *ngFor=\"let option of options$ | async\"\n [value]=\"option.value\">\n <crispr-option [option]=\"option\">\n </crispr-option>\n </mat-option>\n\n </mat-select>\n\n <span *ngIf=\"config.fieldSuffix\" matSuffix>{{config.fieldSuffix}}</span>\n <crispr-info\n *ngIf=\"config.info\"\n matSuffix\n [info]=\"config.info\">\n </crispr-info>\n </mat-form-field>\n\n</crispr-field-container>\n",
|
|
375
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
376
|
-
styles: ["mat-checkbox{display:block;padding:16px}"]
|
|
377
|
-
},] }
|
|
378
|
-
];
|
|
379
|
-
SelectFieldComponent.propDecorators = {
|
|
380
|
-
selectField: [{ type: ViewChild, args: ['selectField',] }]
|
|
381
|
-
};
|
|
382
|
-
|
|
383
|
-
const defaultConfig$8 = {
|
|
384
|
-
autoActiveFirstOption: true,
|
|
385
|
-
typeDebounceTime: 500,
|
|
386
|
-
emptyOptionsMessage: DEFAULT_EMPTY_OPTIONS_MESSAGE
|
|
387
|
-
};
|
|
388
|
-
class AutocompleteFieldComponent extends AbstractAutocompleteComponent {
|
|
389
|
-
constructor() {
|
|
390
|
-
super(...arguments);
|
|
391
|
-
this.defaultConfig = defaultConfig$8;
|
|
392
|
-
}
|
|
393
|
-
ngOnInit() {
|
|
394
|
-
super.ngOnInit();
|
|
395
|
-
}
|
|
396
|
-
setControlValue(value) {
|
|
397
|
-
if (this.control && value) {
|
|
398
|
-
// sets the initial value on the control if one is passed
|
|
399
|
-
this.control.setValue(value.value || '');
|
|
400
|
-
this.autocompleteInputControl.setValue(value.label || '');
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
/**
|
|
404
|
-
* The material autocomplete defaults to displaying the options value instead of its label.
|
|
405
|
-
* We only have the value from the selected option to work with, so we have to pass the options
|
|
406
|
-
* through a function called in the template and return the function that the material displayWith
|
|
407
|
-
* input is expecting.
|
|
408
|
-
* @param options the array of options to search for option with corresponding value
|
|
409
|
-
*/
|
|
410
|
-
displayLabel(options) {
|
|
411
|
-
return (value) => {
|
|
412
|
-
var _a;
|
|
413
|
-
return !!options && Array.isArray(options)
|
|
414
|
-
? (_a = options.find(option => option.value === value)) === null || _a === void 0 ? void 0 : _a.label
|
|
415
|
-
: value;
|
|
416
|
-
};
|
|
417
|
-
}
|
|
418
|
-
handleSelect(event) {
|
|
419
|
-
this.control.setValue(event.option.value);
|
|
420
|
-
this.autoInputRef.nativeElement.blur();
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
AutocompleteFieldComponent.decorators = [
|
|
424
|
-
{ type: Component, args: [{
|
|
425
|
-
selector: 'crispr-autocomplete-field',
|
|
426
|
-
template: "\n<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n\n <mat-form-field\n [color]=\"config.color\"\n [appearance]=\"config.appearance\">\n <mat-label *ngIf=\"config.label\">\n {{config.label}}\n </mat-label>\n <input\n matInput\n [formControl]=\"autocompleteInputControl\"\n [placeholder]=\"config.placeholder\"\n [matAutocomplete]=\"auto\"\n role=\"textbox\"\n type=\"textbox\"\n autocapitalize=\"off\"\n autocorrect=\"off\"\n spellcheck=\"false\"\n #autoInput>\n\n <span *ngIf=\"config.fieldSuffix\" matSuffix>{{config.fieldSuffix}}</span>\n <crispr-info\n *ngIf=\"config.info\"\n matSuffix\n [info]=\"config.info \">\n </crispr-info>\n\n <mat-autocomplete\n #auto=\"matAutocomplete\"\n [autoActiveFirstOption]=\"config.autoActiveFirstOption\"\n (optionSelected)=\"handleSelect($event)\"\n [displayWith]=\"displayLabel(options$ | async)\">\n\n <ng-container *ngIf=\"options$ | async as options; else emptyOption\">\n <ng-container *ngIf=\"options.length > 0; else emptyOption\">\n <mat-option\n *ngFor=\"let option of options$ | async\"\n [value]=\"option.value\">\n <crispr-option [option]=\"option\"></crispr-option>\n </mat-option>\n </ng-container>\n\n </ng-container>\n <ng-template #emptyOption>\n <mat-option disabled=\"true\">\n {{config.emptyOptionsMessage}}\n </mat-option>\n </ng-template>\n\n </mat-autocomplete>\n </mat-form-field>\n</crispr-field-container>\n",
|
|
427
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
428
|
-
styles: [""]
|
|
429
|
-
},] }
|
|
430
|
-
];
|
|
431
|
-
AutocompleteFieldComponent.propDecorators = {
|
|
432
|
-
autoInput: [{ type: ViewChild, args: ['autoInput', { read: MatAutocompleteTrigger },] }],
|
|
433
|
-
autoInputRef: [{ type: ViewChild, args: ['autoInput',] }]
|
|
434
|
-
};
|
|
435
|
-
|
|
436
|
-
const ɵ0 = (chip, option) => chip.value === option.value;
|
|
437
|
-
const defaultConfig$7 = {
|
|
438
|
-
chipsSelectable: true,
|
|
439
|
-
areChipsRemovable: true,
|
|
440
|
-
tabToSelect: true,
|
|
441
|
-
autoActiveFirstOption: true,
|
|
442
|
-
imageUrlParam: 'image',
|
|
443
|
-
typeDebounceTime: 500,
|
|
444
|
-
allowDuplicates: false,
|
|
445
|
-
duplicateCompareFunction: ɵ0,
|
|
446
|
-
separatorKeyCodes: [ENTER],
|
|
447
|
-
emptyOptionsMessage: DEFAULT_EMPTY_OPTIONS_MESSAGE,
|
|
448
|
-
};
|
|
449
|
-
class AutocompleteChiplistFieldComponent extends AbstractAutocompleteComponent {
|
|
450
|
-
constructor() {
|
|
451
|
-
super(...arguments);
|
|
452
|
-
this.defaultConfig = defaultConfig$7;
|
|
453
|
-
this.chips$ = new BehaviorSubject([]);
|
|
454
|
-
this.controlValue$ = this.chips$.pipe(tap(chips => {
|
|
455
|
-
this.control.setValue(chips.map(chip => chip.value));
|
|
456
|
-
}));
|
|
457
|
-
}
|
|
458
|
-
ngOnInit() {
|
|
459
|
-
super.ngOnInit();
|
|
460
|
-
this.remainingOptions$ = combineLatest([
|
|
461
|
-
this.chips$,
|
|
462
|
-
this.options$
|
|
463
|
-
]).pipe(map(([chips, options]) => {
|
|
464
|
-
return this.config.allowDuplicates
|
|
465
|
-
? options
|
|
466
|
-
: options === null || options === void 0 ? void 0 : options.filter(option => {
|
|
467
|
-
return !chips.some(chip => this.config.duplicateCompareFunction(chip, option));
|
|
468
|
-
});
|
|
469
|
-
}));
|
|
470
|
-
}
|
|
471
|
-
setControlValue(value) {
|
|
472
|
-
if (value) {
|
|
473
|
-
this.chips$.next(value);
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
// handles mat selecting
|
|
477
|
-
handleSelect(event) {
|
|
478
|
-
const selectedOption = event.option.value;
|
|
479
|
-
this.chips$.next([...this.chips$.value, selectedOption]);
|
|
480
|
-
this.chipInputRef.nativeElement.value = '';
|
|
481
|
-
this.autocompleteInputControl.setValue('');
|
|
482
|
-
// setTimeout needed because the panel thinks it's still open at this point
|
|
483
|
-
setTimeout(() => this.chipInput.openPanel());
|
|
484
|
-
}
|
|
485
|
-
/**
|
|
486
|
-
* To follow ARIA standards we want to select the active option on blur.
|
|
487
|
-
* matChipInputAddOnBlur should do this but it causes buggy behaviour
|
|
488
|
-
* @param event blur event that triggers the handle blur
|
|
489
|
-
*/
|
|
490
|
-
handleTab(_event) {
|
|
491
|
-
if (this.chipInput.activeOption && (this.config.tabToSelect || this.config.addChipOnBlur)) {
|
|
492
|
-
const chip = this.chipInput.activeOption.value;
|
|
493
|
-
this.chips$.next([...this.chips$.value, chip]);
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
/**
|
|
497
|
-
* Handles selection via key tokens passed through separatorKeyCodes propert
|
|
498
|
-
* NOTE: If TAB is used focus does not move on to next component
|
|
499
|
-
* @param event
|
|
500
|
-
*/
|
|
501
|
-
handleTokenEnd(event) {
|
|
502
|
-
var _a;
|
|
503
|
-
if (this.chipInput.activeOption) {
|
|
504
|
-
this.chipInput.activeOption.select();
|
|
505
|
-
}
|
|
506
|
-
(_a = event.chipInput) === null || _a === void 0 ? void 0 : _a.clear();
|
|
507
|
-
}
|
|
508
|
-
mapToLabel(option) {
|
|
509
|
-
return option ? option.label : '';
|
|
510
|
-
}
|
|
511
|
-
removeChip(removedChip) {
|
|
512
|
-
const remainingChips = this.chips$.value.filter(chip => chip !== removedChip);
|
|
513
|
-
this.chips$.next(remainingChips);
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
AutocompleteChiplistFieldComponent.decorators = [
|
|
517
|
-
{ type: Component, args: [{
|
|
518
|
-
selector: 'crispr-autocomplete-chiplist-field',
|
|
519
|
-
template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n\n <mat-form-field\n [color]=\"config.color\"\n [appearance]=\"config.appearance\">\n <mat-label *ngIf=\"config.label\">\n {{config.label}}\n </mat-label>\n\n <mat-chip-list\n #chipList>\n <mat-chip\n class=\"refinement-chip\"\n *ngFor=\"let chip of controlValue$ | async\"\n [selectable]=\"config.chipsSelectable\"\n [removable]=\"config.areChipsRemovable\"\n (removed)=\"removeChip(chip)\">\n <span *ngIf=\"chip.imageUrl as imageUrl\" class=\"image-container\">\n <img [src]=\"imageUrl\" alt=\"image of {{chip.label}}\">\n </span>\n {{chip.label}}\n <mat-icon\n matChipRemove\n *ngIf=\"config.areChipsRemovable\">\n cancel\n </mat-icon>\n </mat-chip>\n\n <input\n matInput\n [formControl]=\"autocompleteInputControl\"\n [placeholder]=\"config.placeholder\"\n [matChipInputFor]=\"chipList\"\n [matAutocomplete]=\"auto\"\n (keydown.tab)=\"handleTab($event)\"\n [matChipInputSeparatorKeyCodes]=\"config.separatorKeyCodes\"\n (matChipInputTokenEnd)=\"handleTokenEnd($event)\"\n role=\"searchbox\"\n type=\"text\"\n autocapitalize=\"off\"\n autocorrect=\"off\"\n spellcheck=\"false\"\n #autoInput/>\n <span *ngIf=\"config.fieldSuffix\" matSuffix>{{config.fieldSuffix}}</span>\n <crispr-info\n *ngIf=\"config.info\"\n matSuffix\n [info]=\"config.info \">\n </crispr-info>\n\n </mat-chip-list>\n <mat-autocomplete\n #auto=\"matAutocomplete\"\n [autoActiveFirstOption]=\"this.config.autoActiveFirstOption\"\n (optionSelected)=\"handleSelect($event)\"\n [displayWith]=\"mapToLabel\">\n <ng-container *ngIf=\"remainingOptions$ | async as remainingOptions; else emptyOption\">\n <ng-container *ngIf=\"remainingOptions.length > 0; else emptyOption\">\n <mat-option\n *ngFor=\"let option of remainingOptions$ | async\"\n [value]=\"option\">\n <crispr-option [option]=\"option\"></crispr-option>\n </mat-option>\n </ng-container>\n\n </ng-container>\n <ng-template #emptyOption>\n <mat-option disabled=\"true\">\n {{config.emptyOptionsMessage}}\n </mat-option>\n </ng-template>\n </mat-autocomplete>\n\n\n </mat-form-field>\n</crispr-field-container>\n",
|
|
520
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
521
|
-
styles: [".refinement-chip .image-container{width:26px;height:26px;border-radius:50%;overflow:hidden;margin:-2px 4px -2px -8px}.refinement-chip .image-container img{width:100%;height:100%;-o-object-fit:cover;object-fit:cover}"]
|
|
522
|
-
},] }
|
|
523
|
-
];
|
|
524
|
-
AutocompleteChiplistFieldComponent.propDecorators = {
|
|
525
|
-
chipInput: [{ type: ViewChild, args: ['autoInput', { read: MatAutocompleteTrigger },] }],
|
|
526
|
-
chipInputRef: [{ type: ViewChild, args: ['autoInput',] }]
|
|
527
|
-
};
|
|
528
|
-
|
|
529
|
-
const defaultConfig$6 = {
|
|
530
|
-
labelPosition: 'after',
|
|
531
|
-
inline: false
|
|
532
|
-
};
|
|
533
|
-
const CheckboxFieldMixin = crisprControlMixin(CrisprFieldComponent);
|
|
534
|
-
class CheckboxFieldComponent extends CheckboxFieldMixin {
|
|
535
|
-
constructor() {
|
|
536
|
-
super(...arguments);
|
|
537
|
-
this.defaultConfig = defaultConfig$6;
|
|
538
|
-
}
|
|
539
|
-
ngOnInit() {
|
|
540
|
-
super.ngOnInit();
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
CheckboxFieldComponent.decorators = [
|
|
544
|
-
{ type: Component, args: [{
|
|
545
|
-
selector: 'crispr-checkbox-field',
|
|
546
|
-
template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\"\n [inlineField]=\"config.inline\">\n <div\n [formGroup]=\"group\">\n <mat-checkbox\n [color]=\"config.color\"\n [labelPosition]=\"config.labelPosition\"\n [formControlName]=\"config.controlName\">\n {{config.label}}\n <crispr-info\n matSuffix *ngIf=\"config.info\"\n [info]=\"config.info\">\n </crispr-info>\n </mat-checkbox>\n </div>\n</crispr-field-container>\n",
|
|
547
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
548
|
-
styles: [""]
|
|
549
|
-
},] }
|
|
550
|
-
];
|
|
551
|
-
|
|
552
|
-
const defaultConfig$5 = { rows: 5 };
|
|
553
|
-
const TextareaFieldMixin = crisprControlMixin(CrisprFieldComponent);
|
|
554
|
-
class TextareaFieldComponent extends TextareaFieldMixin {
|
|
555
|
-
constructor() {
|
|
556
|
-
super(...arguments);
|
|
557
|
-
this.defaultConfig = defaultConfig$5;
|
|
558
|
-
}
|
|
559
|
-
ngOnInit() {
|
|
560
|
-
super.ngOnInit();
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
TextareaFieldComponent.decorators = [
|
|
564
|
-
{ type: Component, args: [{
|
|
565
|
-
selector: 'crispr-textarea-field',
|
|
566
|
-
template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n <mat-form-field\n [color]=\"config.color\"\n [appearance]=\"config.appearance\"\n [formGroup]=\"group\">\n <mat-label *ngIf=\"config.label\">\n {{config.label}}\n </mat-label>\n <textarea\n [rows]=\"config.rows\"\n matInput\n [placeholder]=\"config.placeholder\"\n [formControlName]=\"config.controlName\">\n </textarea>\n <span *ngIf=\"config.fieldSuffix\" matSuffix>{{config.fieldSuffix}}</span>\n <crispr-info\n *ngIf=\"config.info\"\n matSuffix\n [info]=\"config.info\">\n </crispr-info>\n </mat-form-field>\n\n</crispr-field-container>\n",
|
|
567
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
568
|
-
styles: [""]
|
|
569
|
-
},] }
|
|
570
|
-
];
|
|
571
|
-
|
|
572
|
-
const defaultConfig$4 = { displayLimits: true };
|
|
573
|
-
const SliderFieldMixin = crisprControlMixin(CrisprFieldComponent);
|
|
574
|
-
class SliderFieldComponent extends SliderFieldMixin {
|
|
575
|
-
constructor() {
|
|
576
|
-
super();
|
|
577
|
-
this.defaultConfig = defaultConfig$4;
|
|
578
|
-
}
|
|
579
|
-
get flexDirection() {
|
|
580
|
-
return this.config.vertical ? 'column' : 'row';
|
|
581
|
-
}
|
|
582
|
-
ngOnInit() {
|
|
583
|
-
super.ngOnInit();
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
SliderFieldComponent.decorators = [
|
|
587
|
-
{ type: Component, args: [{
|
|
588
|
-
selector: 'crispr-slider-field',
|
|
589
|
-
template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n <div\n [formGroup]=\"group\">\n <label *ngIf=\"config.label\">\n {{config.label}}\n <crispr-info\n *ngIf=\"config.info\"\n [info]=\"config.info\">\n </crispr-info>\n </label>\n <div class=\"slider-container\"\n [ngStyle]=\"{'flex-direction': flexDirection}\">\n <span *ngIf=\"config.displayLimits\">\n {{config.min}}\n </span>\n <mat-slider\n class=\"example-margin\"\n [formControlName]=\"config.controlName\"\n [invert]=\"config.invert\"\n [max]=\"config.max\"\n [min]=\"config.min\"\n [step]=\"config.step\"\n [thumbLabel]=\"config.thumbLabel\"\n [tickInterval]=\"config.tickInterval\"\n [vertical]=\"config.vertical\">\n </mat-slider>\n <span *ngIf=\"config.displayLimits\">\n {{config.max}}\n </span>\n </div>\n\n </div>\n</crispr-field-container>\n\n",
|
|
590
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
591
|
-
styles: [".slider-container{display:flex;align-items:center}.slider-container .mat-slider-horizontal{width:100%}"]
|
|
592
|
-
},] }
|
|
593
|
-
];
|
|
594
|
-
SliderFieldComponent.ctorParameters = () => [];
|
|
595
|
-
|
|
596
|
-
class ButtonComponent extends CrisprFieldComponent {
|
|
597
|
-
constructor() {
|
|
598
|
-
super(...arguments);
|
|
599
|
-
this.defaultConfig = { buttonType: 'raised', type: 'submit' };
|
|
600
|
-
}
|
|
601
|
-
get matButtonClass() {
|
|
602
|
-
return this.config.buttonType ? `mat-${this.config.buttonType}-button` : '';
|
|
603
|
-
}
|
|
604
|
-
ngOnInit() {
|
|
605
|
-
super.ngOnInit();
|
|
606
|
-
this.formValid$ = this.group.statusChanges.pipe(map(status => status === 'VALID'), startWith(this.group.valid));
|
|
607
|
-
}
|
|
608
|
-
handleClick(group, event) {
|
|
609
|
-
if (this.config.callback) {
|
|
610
|
-
this.config.callback(group, event);
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
ButtonComponent.decorators = [
|
|
615
|
-
{ type: Component, args: [{
|
|
616
|
-
selector: 'crispr-button',
|
|
617
|
-
template: "<button\n [formGroup]=\"group\"\n mat-button\n [ngClass]=\"matButtonClass\"\n [color]=\"config.color\"\n [disabled]=\"config.disabledOnInvalidForm && !(formValid$ | async)\"\n [type]=\"config.type\"\n (click)=\"handleClick(group, $event)\"\n [matTooltip]=\"config.info?.content\"\n [matTooltipPosition]=\"config.info?.tooltipPosition || 'below'\">\n {{ config.label }}\n <mat-icon *ngIf=\"config.icon\">\n {{ config.icon}}\n </mat-icon>\n</button>\n\n",
|
|
618
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
619
|
-
styles: [""]
|
|
620
|
-
},] }
|
|
621
|
-
];
|
|
622
|
-
|
|
623
|
-
const defaultConfig$3 = {
|
|
624
|
-
startView: 'month',
|
|
625
|
-
};
|
|
626
|
-
const DatepickerFieldMixin = crisprControlMixin(CrisprFieldComponent);
|
|
627
|
-
class DatepickerFieldComponent extends DatepickerFieldMixin {
|
|
628
|
-
constructor() {
|
|
629
|
-
super(...arguments);
|
|
630
|
-
this.defaultConfig = defaultConfig$3;
|
|
631
|
-
// handleSelectedChange(event, picker: MatDatepicker<unknown>) {
|
|
632
|
-
// console.log({event, picker})
|
|
633
|
-
// if(this.config.selectedChange) {
|
|
634
|
-
// this.config.selectedChange(event, picker);
|
|
635
|
-
// }
|
|
636
|
-
// }
|
|
637
|
-
}
|
|
638
|
-
ngOnInit() {
|
|
639
|
-
var _a, _b;
|
|
640
|
-
super.ngOnInit();
|
|
641
|
-
this.startAt$ = this.config.startAt instanceof Date
|
|
642
|
-
? of(this.config.startAt)
|
|
643
|
-
: this.config.startAt instanceof Function
|
|
644
|
-
? this.config.startAt(this.group)
|
|
645
|
-
: of(null);
|
|
646
|
-
this.dateClass = ((_a = this.config) === null || _a === void 0 ? void 0 : _a.cellClassFunction) || null;
|
|
647
|
-
this.dateClass$ = this.config.dateClass ? (_b = this.config) === null || _b === void 0 ? void 0 : _b.dateClass(this.group) : of(() => '');
|
|
648
|
-
}
|
|
649
|
-
ngAfterContentInit() {
|
|
650
|
-
if (this.config.datepickerActions) {
|
|
651
|
-
this.calendarFooterPortal = new ComponentPortal(this.config.datepickerActions);
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
DatepickerFieldComponent.decorators = [
|
|
656
|
-
{ type: Component, args: [{
|
|
657
|
-
selector: 'crispr-datepicker-field',
|
|
658
|
-
template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n <mat-form-field\n [color]=\"config.color\"\n [appearance]=\"config.appearance\"\n [formGroup]=\"group\">\n <mat-label *ngIf=\"config.label\">\n {{config.label}}\n </mat-label>\n <input\n matInput\n [formControlName]=\"config.controlName\"\n [min]=\"config.min\"\n [max]=\"config.max\"\n [matDatepicker]=\"picker\"\n [matDatepickerFilter]=\"config.datepickerFilter\">\n <mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-datepicker\n [touchUi]=\"config.touchUi\"\n [startView]=\"config.startView\"\n [startAt]=\"startAt$ | async\"\n [dateClass]=\"dateClass || (dateClass$ | async)\"\n #picker>\n <mat-datepicker-actions *ngIf=\"calendarFooterPortal\">\n <ng-template [cdkPortalOutlet]=\"calendarFooterPortal\"></ng-template>\n </mat-datepicker-actions>\n </mat-datepicker>\n\n </mat-form-field>\n</crispr-field-container>\n\n",
|
|
659
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
660
|
-
styles: [""]
|
|
661
|
-
},] }
|
|
662
|
-
];
|
|
663
|
-
|
|
664
|
-
const FileUploadFieldMixin = crisprControlMixin(CrisprFieldComponent);
|
|
665
|
-
class FileUploadComponent extends FileUploadFieldMixin {
|
|
666
|
-
// ngControl: NgControl = null;
|
|
667
|
-
constructor(ngControl) {
|
|
668
|
-
super();
|
|
669
|
-
this.ngControl = ngControl;
|
|
670
|
-
this.defaultConfig = {
|
|
671
|
-
allowMultipleFiles: false,
|
|
672
|
-
acceptedTypes: '*.*',
|
|
673
|
-
dropZoneText: 'DROP FILE HERE',
|
|
674
|
-
selectFilesButtonType: 'button',
|
|
675
|
-
selectButtonText: 'SELECT',
|
|
676
|
-
showClearFilesButton: true,
|
|
677
|
-
clearFilesButtonText: 'CLEAR',
|
|
678
|
-
uploadButtonText: 'UPLOAD',
|
|
679
|
-
uploadButtonType: 'button',
|
|
680
|
-
showUploadProgress: false,
|
|
681
|
-
disableOnUpload: true
|
|
682
|
-
};
|
|
683
|
-
this.isUploaded = false;
|
|
684
|
-
this.fileProgress = [];
|
|
685
|
-
if (this.ngControl != null) {
|
|
686
|
-
// Setting the value accessor directly (instead of using
|
|
687
|
-
// the providers) to avoid running into a circular import.
|
|
688
|
-
ngControl.valueAccessor = this;
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
ngOnInit() {
|
|
692
|
-
super.ngOnInit();
|
|
693
|
-
this.disabled$ = this.config.disabledCallback
|
|
694
|
-
? this.config.disabledCallback(this.group, this.config)
|
|
695
|
-
: of(false);
|
|
696
|
-
}
|
|
697
|
-
filesChanged(files) {
|
|
698
|
-
if (files && files.length > 0) {
|
|
699
|
-
this.selectedFiles = files;
|
|
700
|
-
this.control.patchValue(files);
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
uploadFiles() {
|
|
704
|
-
if (this.selectedFiles && this.config.uploadFiles) {
|
|
705
|
-
this.isUploaded = true;
|
|
706
|
-
this.config.uploadFiles(this.group, this.selectedFiles, this);
|
|
707
|
-
}
|
|
708
|
-
}
|
|
709
|
-
resetFileInput() {
|
|
710
|
-
this.fileInputRef.nativeElement.value = '';
|
|
711
|
-
this.control.patchValue(null);
|
|
712
|
-
this.isUploaded = false;
|
|
713
|
-
}
|
|
714
|
-
writeValue(value) {
|
|
715
|
-
// clear file input
|
|
716
|
-
// this.host.nativeElement.value = '';
|
|
717
|
-
// this.file = null;
|
|
718
|
-
}
|
|
719
|
-
registerOnChange(fn) {
|
|
720
|
-
this.onChange = fn;
|
|
721
|
-
}
|
|
722
|
-
registerOnTouched(fn) {
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
FileUploadComponent.decorators = [
|
|
726
|
-
{ type: Component, args: [{
|
|
727
|
-
selector: 'crispr-file-upload',
|
|
728
|
-
template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n <mat-form-field floatLabel=\"always\"\n [color]=\"config.color\"\n appearance=\"outline\"\n [crisprFileDropzone]=\"!(disabled$ | async) && !(config.disableOnUpload && isUploaded)\"\n [formGroup]=\"group\"\n (fileDrop)=\"filesChanged($event)\">\n\n <input [formControlName]=\"config.controlName\" matInput type=\"text\"/>\n\n <input\n #fileInput\n type=\"file\"\n style=\"display: none\"\n [accept]=\"config.acceptedTypes\"\n [multiple]=\"config.allowMultipleFiles\"\n (change)=\"filesChanged($event.target.files)\"/>\n <mat-label>{{config.label}}</mat-label>\n\n <div *ngIf=\"!(selectedFiles?.length > 0); else selectedFileList\" class=\"drop-info\">\n <mat-icon class=\"drop-icon\" inline=\"true\">cloud_upload</mat-icon>\n <h2 class=\"mat-h2\">{{config.dropZoneText}}</h2>\n or\n <button\n mat-raised-button\n type=\"button\"\n color=\"primary\"\n [disabled]=\"(disabled$ | async) || config.disableOnUpload && isUploaded\"\n (click)=\"fileInput.click()\"\n [attr.aria-label]=\"config.controlName\">\n {{config.selectButtonText}}\n </button>\n </div>\n <ng-template #selectedFileList>\n <div class=\"selected-files-container\">\n <div class=\"selected-files-list\">\n <crispr-selected-file\n *ngFor=\"let file of selectedFiles; let i = index;\"\n [color]=\"config.color === 'primary' ? 'accent' : 'primary'\"\n [fileName]=\"file.name\"\n [showProgress]=\"config.showUploadProgress\"\n [progress]=\"fileProgress && (fileProgress[i] | async)\">\n </crispr-selected-file>\n </div>\n\n </div>\n </ng-template>\n\n </mat-form-field>\n <div class=\"button-container\" *ngIf=\"selectedFiles?.length > 0\">\n\n <button\n mat-button\n (click)=\"resetFileInput()\"\n type=\"button\"\n [disabled]=\"(disabled$ | async) || (config.disableOnUpload && isUploaded)\"\n aria-label=\"Remove Selected File(s)\">\n {{config.clearFilesButtonText}}\n <mat-icon>delete</mat-icon>\n </button>\n\n <button\n *ngIf=\"!!config.uploadFiles\"\n mat-raised-button\n type=\"button\"\n color=\"accent\"\n class=\"file-input-button\"\n [disabled]=\"(disabled$ | async) || (config.disableOnUpload && isUploaded)\"\n (click)=\"uploadFiles()\"\n [attr.aria-label]=\"config.uploadButtonText\">\n {{ config.uploadButtonText }}\n </button>\n\n </div>\n</crispr-field-container>\n",
|
|
729
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
730
|
-
styles: [":host ::ng-deep .mat-form-field .mat-form-field-infix{padding-top:0;display:flex;justify-content:center}:host .drop-info{display:flex;flex-direction:column;align-items:center}:host .drop-info .drop-icon{font-size:36px}:host .drop-info .mat-h2{margin:0}:host .button-container{display:flex;justify-content:flex-end;margin-top:-16px}:host .button-container button{margin-left:8px}:host .selected-files-container{width:100%}:host [matInput]{position:absolute;max-height:0;visibility:hidden}"]
|
|
731
|
-
},] }
|
|
732
|
-
];
|
|
733
|
-
FileUploadComponent.ctorParameters = () => [
|
|
734
|
-
{ type: NgControl, decorators: [{ type: Optional }, { type: Self }] }
|
|
735
|
-
];
|
|
736
|
-
FileUploadComponent.propDecorators = {
|
|
737
|
-
fileInputRef: [{ type: ViewChild, args: ['fileInput',] }]
|
|
738
|
-
};
|
|
739
|
-
|
|
740
|
-
const defaultConfig$2 = {
|
|
741
|
-
typographyClass: 'mat-h3'
|
|
742
|
-
};
|
|
743
|
-
class HeadingComponent extends CrisprFieldComponent {
|
|
744
|
-
constructor() {
|
|
745
|
-
super(...arguments);
|
|
746
|
-
this.defaultConfig = defaultConfig$2;
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
HeadingComponent.decorators = [
|
|
750
|
-
{ type: Component, args: [{
|
|
751
|
-
selector: 'crispr-heading',
|
|
752
|
-
template: " <label\n *ngIf=\"!!config?.label\"\n [ngClass]=\"config.typographyClass\">\n {{ config.label }}\n <crispr-info\n *ngIf=\"config.info\"\n matSuffix\n [info]=\"config.info\">\n </crispr-info>\n </label>\n",
|
|
753
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
754
|
-
styles: [":host{display:block}"]
|
|
755
|
-
},] }
|
|
756
|
-
];
|
|
757
|
-
HeadingComponent.propDecorators = {
|
|
758
|
-
config: [{ type: Input }]
|
|
759
|
-
};
|
|
760
|
-
|
|
761
|
-
class DividerComponent extends CrisprFieldComponent {
|
|
762
|
-
constructor() {
|
|
763
|
-
super(...arguments);
|
|
764
|
-
// TODO: pull in type after configs are better organized
|
|
765
|
-
this.defaultConfig = {};
|
|
766
|
-
}
|
|
767
|
-
ngOnInit() {
|
|
768
|
-
super.ngOnInit();
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
DividerComponent.decorators = [
|
|
772
|
-
{ type: Component, args: [{
|
|
773
|
-
selector: 'crispr-divider',
|
|
774
|
-
template: "<mat-divider [ngClass]=\"config.classes\"></mat-divider>",
|
|
775
|
-
styles: [":host{display:block;padding:1em 0}::ng-deep.mat-divider.mat-divider-horizontal{position:relative}"]
|
|
776
|
-
},] }
|
|
777
|
-
];
|
|
778
|
-
|
|
779
|
-
const RadioFieldMixin = crisprControlMixin(CrisprFieldComponent);
|
|
780
|
-
class RadioFieldComponent extends RadioFieldMixin {
|
|
781
|
-
constructor() {
|
|
782
|
-
super(...arguments);
|
|
783
|
-
this.defaultConfig = {};
|
|
784
|
-
}
|
|
785
|
-
ngOnInit() {
|
|
786
|
-
super.ngOnInit();
|
|
787
|
-
// options$ can be passed as an array, promise that resolves array, or observable that resolves array
|
|
788
|
-
// this functions accounts for all possibilities and converts to observable that resolves array
|
|
789
|
-
this.options$ = observablifyOptions(this.config.options, this.group);
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
RadioFieldComponent.decorators = [
|
|
793
|
-
{ type: Component, args: [{
|
|
794
|
-
selector: 'crispr-radio-field',
|
|
795
|
-
template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n\n <mat-radio-group\n [formControl]=\"control\"\n [color]=\"config.color\">\n <mat-radio-button class=\"example-radio-button\" *ngFor=\"let option of options$ | async\" [value]=\"option.value\">\n {{option.label}}\n </mat-radio-button>\n </mat-radio-group>\n</crispr-field-container>\n",
|
|
796
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
797
|
-
styles: ["mat-radio-button{padding:12px}"]
|
|
798
|
-
},] }
|
|
799
|
-
];
|
|
800
|
-
|
|
801
|
-
const defaultConfig$1 = {};
|
|
802
|
-
const UnitConversionFieldMixin = crisprControlMixin(CrisprFieldComponent);
|
|
803
|
-
class UnitConversionFieldComponent extends UnitConversionFieldMixin {
|
|
804
|
-
constructor() {
|
|
805
|
-
super(...arguments);
|
|
806
|
-
this.defaultConfig = defaultConfig$1;
|
|
807
|
-
this.displayValueControl = new FormControl();
|
|
808
|
-
this.unitSelectControl = new FormControl();
|
|
809
|
-
}
|
|
810
|
-
ngOnInit() {
|
|
811
|
-
var _a, _b;
|
|
812
|
-
super.ngOnInit();
|
|
813
|
-
// TODO: Validators need work. validation is tricky because the input needs to be validated against but the validator will compare against the controls value
|
|
814
|
-
// this.displayValueControl.setValidators(this.config.validators);
|
|
815
|
-
const controlValuePipeline = [
|
|
816
|
-
this.displayValueControl.valueChanges.pipe(startWith(this.displayValueControl.value))
|
|
817
|
-
];
|
|
818
|
-
// setup all required pieces when showing a field for selecting units
|
|
819
|
-
if (this.config.showUnitSelect) {
|
|
820
|
-
this.unitOptions$ = observablifyOptions(this.config.selectableUnits, this.group);
|
|
821
|
-
controlValuePipeline.push(this.unitSelectControl.valueChanges.pipe(startWith(((_a = this.config) === null || _a === void 0 ? void 0 : _a.initialDisplayUnit) || null)));
|
|
822
|
-
this.unitSelectControl.setValue(((_b = this.config) === null || _b === void 0 ? void 0 : _b.initialDisplayUnit) || null);
|
|
823
|
-
}
|
|
824
|
-
this.transformationSubscription = combineLatest(controlValuePipeline).subscribe(([displayValue, unitValue]) => {
|
|
825
|
-
const computedValue = this.config.storedValueConversion(displayValue, unitValue);
|
|
826
|
-
this.control.setValue(computedValue);
|
|
827
|
-
});
|
|
828
|
-
}
|
|
829
|
-
ngOnDestroy() {
|
|
830
|
-
this.transformationSubscription.unsubscribe();
|
|
831
|
-
}
|
|
832
|
-
setInitialDisplayValue(storedValue, unit) {
|
|
833
|
-
const initialDisplayValue = this.config.initialDisplayValueConversion(storedValue || null, unit);
|
|
834
|
-
this.displayValueControl.setValue(initialDisplayValue);
|
|
835
|
-
}
|
|
836
|
-
/**
|
|
837
|
-
* We override the 'setControlValue' we inherited from crisprControlMixin and add our custom logic,
|
|
838
|
-
* This function gets called onInit because were object oriented. it's so great, so great that I'm
|
|
839
|
-
* typing a paragraph to explain what the hell is going on...
|
|
840
|
-
* @param value the initial value for the control passed down from the form components input
|
|
841
|
-
*/
|
|
842
|
-
setControlValue(value) {
|
|
843
|
-
var _a;
|
|
844
|
-
const initialUnitValue = this.config.showUnitSelect ? (_a = this.config) === null || _a === void 0 ? void 0 : _a.initialDisplayUnit : null;
|
|
845
|
-
this.setInitialDisplayValue(value, initialUnitValue);
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
UnitConversionFieldComponent.decorators = [
|
|
849
|
-
{ type: Component, args: [{
|
|
850
|
-
// eslint-disable-next-line @angular-eslint/component-selector
|
|
851
|
-
selector: 'crispr-unit-conversion-field',
|
|
852
|
-
template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n <mat-form-field\n [style.width.%]=\"config.showUnitSelect ? 60 : 100\"\n class=\"number-field\"\n [color]=\"config.color\"\n [appearance]=\"config.appearance\">\n <mat-label *ngIf=\"config.label\">\n {{config.label}}\n </mat-label>\n <input\n type=\"number\"\n matInput\n [formControl]=\"displayValueControl\"\n [placeholder]=\"config.placeholder\"\n [min]=\"config.min\"\n [max]=\"config.max\"\n [step]=\"config.step\"\n [autofocus]=\"config.autofocus\"\n [autocomplete]=\"config.autoComplete\">\n <span *ngIf=\"config.fieldSuffix\" matSuffix>{{config.fieldSuffix}}</span>\n <crispr-info\n matSuffix\n *ngIf=\"config.info\"\n [info]=\"config.info\">\n </crispr-info>\n </mat-form-field>\n\n <mat-form-field\n *ngIf=\"config.showUnitSelect\"\n [color]=\"config.color\"\n [appearance]=\"config.appearance\"\n [formGroup]=\"group\"\n class=\"unit-field\">\n <mat-label *ngIf=\"config.label\">\n {{config.label}}\n </mat-label>\n <mat-select\n #selectField\n [formControl]=\"unitSelectControl\">\n\n <mat-option\n *ngFor=\"let option of unitOptions$ | async\"\n [value]=\"option.value\">\n <crispr-option [option]=\"option\">\n </crispr-option>\n </mat-option>\n\n </mat-select>\n\n <!-- <span *ngIf=\"config.fieldSuffix\" matSuffix>{{config.fieldSuffix}}</span> -->\n <!-- <crispr-info\n *ngIf=\"config.info\"\n matSuffix\n [info]=\"config.info\">\n </crispr-info> -->\n </mat-form-field>\n\n\n</crispr-field-container>\n",
|
|
853
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
854
|
-
styles: [".unit-field{width:40%;margin-left:16px}:host ::ng-deep .field-container{display:flex}"]
|
|
855
|
-
},] }
|
|
856
|
-
];
|
|
857
|
-
|
|
858
|
-
class FieldContainerComponent {
|
|
859
|
-
constructor() {
|
|
860
|
-
// boolean whether field-container is inline
|
|
861
|
-
this.inlineField = false;
|
|
862
|
-
this.subs = [];
|
|
863
|
-
}
|
|
864
|
-
ngOnInit() {
|
|
865
|
-
this.disabled$ = this.connectDisabledCallback(this.group, this.config);
|
|
866
|
-
// we tried moving this into afterViewChecked and afterContentChecked lifecycle hooks without any luck
|
|
867
|
-
if (this.config.computeValue) {
|
|
868
|
-
this.subs.push(this.config.computeValue(this.group).pipe(distinctUntilChanged(), tap(computedValue => this.group.get(this.config.controlName).setValue(computedValue))).subscribe());
|
|
869
|
-
}
|
|
870
|
-
else if (this.config.computeFieldConfig) {
|
|
871
|
-
console.warn(`computeFieldConfig property is deprecated, please use computeValue. Example here: https://stackblitz.com/github/nayfin/tft-documentation?file=src%2Fapp%2Fcrispr-forms-demo%2Ffeatures%2Fcomputed-field%2Fcomputed-field.component.ts`);
|
|
872
|
-
this.subs.push(computeValueFromFields(this.group, this.config.computeFieldConfig).pipe(distinctUntilChanged(), tap(computedValue => this.group.get(this.config.controlName).setValue(computedValue))).subscribe());
|
|
873
|
-
}
|
|
874
|
-
}
|
|
875
|
-
ngOnDestroy() {
|
|
876
|
-
this.subs.forEach(sub => sub.unsubscribe);
|
|
877
|
-
}
|
|
878
|
-
/**
|
|
879
|
-
* Connects user defined disabledCallback function to the the view, so that the control is enabled/disabled
|
|
880
|
-
* appropriately. It also keeps the form will hide disabled fields in the UI unless `hideDisabled` is set to
|
|
881
|
-
* false in the controls config
|
|
882
|
-
* @param group used to get valueChanges from control
|
|
883
|
-
* @param config configuration object used to
|
|
884
|
-
*/
|
|
885
|
-
connectDisabledCallback(group, config = null) {
|
|
886
|
-
const control = group.get(config.controlName);
|
|
887
|
-
// If the disabled$ function exists on the field config then call it with the disabledCallbackConfig
|
|
888
|
-
// as a parameter otherwise return an observable of true.
|
|
889
|
-
return (config === null || config === void 0 ? void 0 : config.disabledCallback) && config.disabledCallback instanceof Function
|
|
890
|
-
? config.disabledCallback(group, config.disabledCallbackConfig || null).pipe(
|
|
891
|
-
// This enables/disables when callback conditions are met
|
|
892
|
-
tap((shouldDisable) => shouldDisable ? control.disable() : control.enable()))
|
|
893
|
-
: of(false);
|
|
894
|
-
}
|
|
895
|
-
}
|
|
896
|
-
FieldContainerComponent.decorators = [
|
|
897
|
-
{ type: Component, args: [{
|
|
898
|
-
selector: 'crispr-field-container',
|
|
899
|
-
template: "<div\n *ngIf=\"(disabled$ | async) ? !config.hideDisabled : true\"\n [ngClass]=\"config.classes\"\n [class.inline-field]=\"inlineField\"\n class=\"field-container\">\n\n <crispr-heading\n *ngIf=\"config.heading\"\n [config]=\"config.heading\">\n </crispr-heading>\n\n <ng-content>\n </ng-content>\n\n</div>\n",
|
|
900
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
901
|
-
styles: ["::ng-deep mat-form-field.mat-form-field{display:block}.inline-field{display:inline-block}"]
|
|
902
|
-
},] }
|
|
903
|
-
];
|
|
904
|
-
FieldContainerComponent.propDecorators = {
|
|
905
|
-
config: [{ type: Input }],
|
|
906
|
-
group: [{ type: Input }],
|
|
907
|
-
inlineField: [{ type: Input }]
|
|
908
|
-
};
|
|
909
|
-
|
|
910
|
-
class InfoComponent {
|
|
911
|
-
}
|
|
912
|
-
InfoComponent.decorators = [
|
|
913
|
-
{ type: Component, args: [{
|
|
914
|
-
selector: 'crispr-info',
|
|
915
|
-
template: "<mat-icon\n *ngIf=\"info\"\n [matTooltip]=\"info.content\"\n [matTooltipPosition]=\"info.tooltipPosition || 'below'\"\n matSuffix>\n info\n</mat-icon>\n",
|
|
916
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
917
|
-
styles: ["mat-icon{font-size:1.2em;width:1em;height:1em;opacity:.8}"]
|
|
918
|
-
},] }
|
|
919
|
-
];
|
|
920
|
-
InfoComponent.propDecorators = {
|
|
921
|
-
info: [{ type: Input }]
|
|
922
|
-
};
|
|
923
|
-
|
|
924
|
-
class OptionComponent {
|
|
925
|
-
}
|
|
926
|
-
OptionComponent.decorators = [
|
|
927
|
-
{ type: Component, args: [{
|
|
928
|
-
selector: 'crispr-option',
|
|
929
|
-
template: "<img\n *ngIf=\"option.imageUrl\"\n [src]=\"option.imageUrl\"\n alt=\"image of {{option.label}}\"\n style=\"vertical-align:middle;\"\n aria-hidden\n height=\"25\"/>\n{{ option.label }}\n",
|
|
930
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
931
|
-
styles: [""]
|
|
932
|
-
},] }
|
|
933
|
-
];
|
|
934
|
-
OptionComponent.propDecorators = {
|
|
935
|
-
option: [{ type: Input }]
|
|
936
|
-
};
|
|
937
|
-
|
|
938
|
-
class SelectedFileComponent {
|
|
939
|
-
}
|
|
940
|
-
SelectedFileComponent.decorators = [
|
|
941
|
-
{ type: Component, args: [{
|
|
942
|
-
selector: 'crispr-selected-file',
|
|
943
|
-
template: "<h3 class=\"mat-h3\">{{ fileName }}</h3>\n<mat-progress-bar\n *ngIf=\"showProgress\"\n mode=\"determinate\"\n [color]=\"color\"\n [value]=\"progress\">\n</mat-progress-bar>\n",
|
|
944
|
-
styles: ["mat-progress-bar{margin-bottom:8px}"]
|
|
945
|
-
},] }
|
|
946
|
-
];
|
|
947
|
-
SelectedFileComponent.propDecorators = {
|
|
948
|
-
fileName: [{ type: Input }],
|
|
949
|
-
progress: [{ type: Input }],
|
|
950
|
-
showProgress: [{ type: Input }],
|
|
951
|
-
color: [{ type: Input }]
|
|
952
|
-
};
|
|
953
|
-
|
|
954
|
-
class FileDropzoneDirective {
|
|
955
|
-
constructor() {
|
|
956
|
-
this.fileDrop = new EventEmitter();
|
|
957
|
-
this.crisprFileDropzone = true;
|
|
958
|
-
}
|
|
959
|
-
onDrop($event) {
|
|
960
|
-
if (this.crisprFileDropzone) {
|
|
961
|
-
$event.preventDefault();
|
|
962
|
-
this.fileDrop.emit($event.dataTransfer.files);
|
|
963
|
-
}
|
|
964
|
-
}
|
|
965
|
-
// Prevents DOM from trying to open file in browser
|
|
966
|
-
onDragOver($event) {
|
|
967
|
-
if (this.crisprFileDropzone) {
|
|
968
|
-
$event.preventDefault();
|
|
969
|
-
}
|
|
970
|
-
}
|
|
971
|
-
}
|
|
972
|
-
FileDropzoneDirective.decorators = [
|
|
973
|
-
{ type: Directive, args: [{
|
|
974
|
-
selector: '[crisprFileDropzone]'
|
|
975
|
-
},] }
|
|
976
|
-
];
|
|
977
|
-
FileDropzoneDirective.propDecorators = {
|
|
978
|
-
fileDrop: [{ type: Output }],
|
|
979
|
-
crisprFileDropzone: [{ type: Input }],
|
|
980
|
-
onDrop: [{ type: HostListener, args: ['drop', ['$event'],] }],
|
|
981
|
-
onDragOver: [{ type: HostListener, args: ['dragover', ['$event'],] }]
|
|
982
|
-
};
|
|
983
|
-
|
|
984
|
-
// TODO: Should we import UI library?
|
|
985
|
-
// Will the tree shaker shake the unused modules?
|
|
986
|
-
const MAT_DESIGN_MODULES = [
|
|
987
|
-
MatIconModule,
|
|
988
|
-
MatAutocompleteModule,
|
|
989
|
-
MatDatepickerModule,
|
|
990
|
-
MatInputModule,
|
|
991
|
-
MatRadioModule,
|
|
992
|
-
MatSelectModule,
|
|
993
|
-
MatCheckboxModule,
|
|
994
|
-
MatChipsModule,
|
|
995
|
-
MatSliderModule,
|
|
996
|
-
MatSlideToggleModule,
|
|
997
|
-
MatButtonModule,
|
|
998
|
-
MatButtonToggleModule,
|
|
999
|
-
MatChipsModule,
|
|
1000
|
-
MatTooltipModule,
|
|
1001
|
-
MatFormFieldModule,
|
|
1002
|
-
MatMomentDateModule,
|
|
1003
|
-
MatDividerModule,
|
|
1004
|
-
MatProgressBarModule,
|
|
1005
|
-
PortalModule
|
|
1006
|
-
];
|
|
1007
|
-
const CRISPR_FIELDS = [
|
|
1008
|
-
FieldContainerComponent,
|
|
1009
|
-
InputFieldComponent,
|
|
1010
|
-
SelectFieldComponent,
|
|
1011
|
-
RadioFieldComponent,
|
|
1012
|
-
AutocompleteFieldComponent,
|
|
1013
|
-
AutocompleteChiplistFieldComponent,
|
|
1014
|
-
CheckboxFieldComponent,
|
|
1015
|
-
TextareaFieldComponent,
|
|
1016
|
-
DatepickerFieldComponent,
|
|
1017
|
-
SliderFieldComponent,
|
|
1018
|
-
ButtonComponent,
|
|
1019
|
-
HeadingComponent,
|
|
1020
|
-
DividerComponent,
|
|
1021
|
-
FileUploadComponent,
|
|
1022
|
-
UnitConversionFieldComponent
|
|
1023
|
-
];
|
|
1024
|
-
class MaterialModule {
|
|
1025
|
-
}
|
|
1026
|
-
MaterialModule.decorators = [
|
|
1027
|
-
{ type: NgModule, args: [{
|
|
1028
|
-
imports: [
|
|
1029
|
-
CommonModule,
|
|
1030
|
-
ReactiveFormsModule,
|
|
1031
|
-
FormValidationHandlerModule,
|
|
1032
|
-
...MAT_DESIGN_MODULES,
|
|
1033
|
-
],
|
|
1034
|
-
exports: [
|
|
1035
|
-
...MAT_DESIGN_MODULES,
|
|
1036
|
-
...CRISPR_FIELDS
|
|
1037
|
-
],
|
|
1038
|
-
declarations: [
|
|
1039
|
-
...CRISPR_FIELDS,
|
|
1040
|
-
InfoComponent,
|
|
1041
|
-
OptionComponent,
|
|
1042
|
-
SelectedFileComponent,
|
|
1043
|
-
FileDropzoneDirective,
|
|
1044
|
-
],
|
|
1045
|
-
entryComponents: CRISPR_FIELDS
|
|
1046
|
-
},] }
|
|
1047
|
-
];
|
|
1048
|
-
|
|
1049
|
-
class CrisprFormComponent {
|
|
1050
|
-
constructor() {
|
|
1051
|
-
this.form = new FormGroup({});
|
|
1052
|
-
this.value = null;
|
|
1053
|
-
this.submitted = new EventEmitter();
|
|
1054
|
-
// proxy value and status change events through to consuming component
|
|
1055
|
-
this.valueChanges = this.form.valueChanges;
|
|
1056
|
-
this.statusChanges = this.form.statusChanges;
|
|
1057
|
-
this.subs = [];
|
|
1058
|
-
}
|
|
1059
|
-
ngOnInit() {
|
|
1060
|
-
// build out the form, note that we pass in the form as the third argument and the function modifies it
|
|
1061
|
-
buildFormGroupFromConfig(this.config, this.value, this.form);
|
|
1062
|
-
}
|
|
1063
|
-
handleSubmit() {
|
|
1064
|
-
this.form.markAllAsTouched();
|
|
1065
|
-
this.submitted.emit(this.form);
|
|
1066
|
-
}
|
|
1067
|
-
}
|
|
1068
|
-
CrisprFormComponent.decorators = [
|
|
1069
|
-
{ type: Component, args: [{
|
|
1070
|
-
selector: 'crispr-form',
|
|
1071
|
-
template: "<form\n class=\"crispr-form\"\n [ngClass]=\"config.classes\"\n [formGroup]=\"form\"\n (ngSubmit)=\"handleSubmit()\"\n [autocomplete]=\"config.autocomplete || 'off'\"\n [errorDictionary]=\"config.errorDictionary\">\n\n <ng-container\n *ngFor=\"let field of config.fields;\"\n crisprField\n [value]=\"value | initialControlValue : field\"\n [config]=\"field\"\n [group]=\"form\">\n </ng-container>\n\n</form>\n",
|
|
1072
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1073
|
-
styles: [""]
|
|
1074
|
-
},] }
|
|
1075
|
-
];
|
|
1076
|
-
CrisprFormComponent.propDecorators = {
|
|
1077
|
-
config: [{ type: Input }],
|
|
1078
|
-
form: [{ type: Input }],
|
|
1079
|
-
value: [{ type: Input }],
|
|
1080
|
-
submitted: [{ type: Output }],
|
|
1081
|
-
valueChanges: [{ type: Output }],
|
|
1082
|
-
statusChanges: [{ type: Output }]
|
|
1083
|
-
};
|
|
1084
|
-
|
|
1085
|
-
const defaultConfig = {
|
|
1086
|
-
addButtonLabel: 'ADD ITEM',
|
|
1087
|
-
minListLength: 1,
|
|
1088
|
-
};
|
|
1089
|
-
const FormGroupListMixin = crisprControlMixin(CrisprFieldComponent);
|
|
1090
|
-
class FormGroupListComponent extends FormGroupListMixin {
|
|
1091
|
-
constructor() {
|
|
1092
|
-
super(...arguments);
|
|
1093
|
-
this.defaultConfig = defaultConfig;
|
|
1094
|
-
}
|
|
1095
|
-
ngOnInit() {
|
|
1096
|
-
super.ngOnInit();
|
|
1097
|
-
// TODO: this is required to ngFor of controls in template, must be a better way
|
|
1098
|
-
this.formArray = this.control;
|
|
1099
|
-
}
|
|
1100
|
-
setControlValue(values) {
|
|
1101
|
-
if (this.control) {
|
|
1102
|
-
if ((values === null || values === void 0 ? void 0 : values.length) > 0) {
|
|
1103
|
-
values.forEach(value => this.addGroup(value));
|
|
1104
|
-
}
|
|
1105
|
-
else if (this.config.displayInitialItem) {
|
|
1106
|
-
this.addGroup();
|
|
1107
|
-
}
|
|
1108
|
-
}
|
|
1109
|
-
}
|
|
1110
|
-
addGroup(value = null) {
|
|
1111
|
-
this.control.push(createControlForType(this.config.itemConfig, value));
|
|
1112
|
-
}
|
|
1113
|
-
deleteGroup(index) {
|
|
1114
|
-
this.control.removeAt(index);
|
|
1115
|
-
}
|
|
1116
|
-
}
|
|
1117
|
-
FormGroupListComponent.decorators = [
|
|
1118
|
-
{ type: Component, args: [{
|
|
1119
|
-
selector: 'crispr-form-group-list',
|
|
1120
|
-
template: "\n<crispr-field-container\n [config]=\"config\"\n [group]=\"group\"\n [formGroup]=\"group\">\n\n <div [formArrayName]=\"config.controlName\">\n <!-- TODO: add sortBy function -->\n <div *ngFor=\"let control of formArray?.controls; let i = index;\">\n <!-- TODO: use content projection to allow custom item label component -->\n <div class=\"item-header\">\n <span class=\"mat-h2\" *ngIf=\"config.itemLabelBuilder\"> {{ config.itemLabelBuilder(i) }} </span>\n <button\n mat-icon-button\n *ngIf=\"i + 1 > config.minListLength\">\n <mat-icon (click)=\"deleteGroup(i)\">delete</mat-icon>\n </button>\n </div>\n <div\n [formGroupName]=\"i\">\n <ng-container\n *ngFor=\"let field of config.itemConfig.fields;\"\n crisprField\n [config]=\"field\"\n [value]=\"value && value[i] | initialControlValue : field\"\n [group]=\"control\">\n </ng-container>\n </div>\n </div>\n </div>\n <div class=\"group-footer\">\n <button\n type=\"button\"\n class=\"add\"\n mat-raised-button\n [color]=\"config.addButtonColor\"\n (click)=\"addGroup()\">\n {{config.addItemLabel || config.addButtonLabel}}\n </button>\n </div>\n\n</crispr-field-container>\n",
|
|
1121
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1122
|
-
styles: [".item-header{display:flex;justify-content:space-between}.group-footer{display:flex;justify-content:flex-end}.group-footer button.add{margin-bottom:16px}"]
|
|
1123
|
-
},] }
|
|
1124
|
-
];
|
|
1125
|
-
|
|
1126
|
-
const FormGroupMixin = crisprControlMixin(CrisprFieldComponent);
|
|
1127
|
-
class SubGroupComponent extends FormGroupMixin {
|
|
1128
|
-
ngOnInit() {
|
|
1129
|
-
super.ngOnInit();
|
|
1130
|
-
}
|
|
1131
|
-
}
|
|
1132
|
-
SubGroupComponent.decorators = [
|
|
1133
|
-
{ type: Component, args: [{
|
|
1134
|
-
selector: 'crispr-sub-group',
|
|
1135
|
-
template: "<crispr-field-container\n [config]=\"config\"\n [group]=\"group\">\n <ng-container\n *ngFor=\"let fieldConfig of config.fields;\"\n crisprField\n [value]=\"value | initialControlValue : fieldConfig\"\n [config]=\"fieldConfig\"\n [group]=\"control\">\n </ng-container>\n</crispr-field-container>\n\n",
|
|
1136
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1137
|
-
styles: [""]
|
|
1138
|
-
},] }
|
|
1139
|
-
];
|
|
1140
|
-
|
|
1141
|
-
// tslint:disable-next-line: max-line-length
|
|
1142
|
-
const FIELD_COMPONENTS = {
|
|
1143
|
-
button: ButtonComponent,
|
|
1144
|
-
input: InputFieldComponent,
|
|
1145
|
-
select: SelectFieldComponent,
|
|
1146
|
-
radio: RadioFieldComponent,
|
|
1147
|
-
subGroup: SubGroupComponent,
|
|
1148
|
-
groupList: FormGroupListComponent,
|
|
1149
|
-
autocomplete: AutocompleteFieldComponent,
|
|
1150
|
-
autocompleteChiplist: AutocompleteChiplistFieldComponent,
|
|
1151
|
-
textarea: TextareaFieldComponent,
|
|
1152
|
-
checkbox: CheckboxFieldComponent,
|
|
1153
|
-
slider: SliderFieldComponent,
|
|
1154
|
-
datepicker: DatepickerFieldComponent,
|
|
1155
|
-
fileUpload: FileUploadComponent,
|
|
1156
|
-
heading: HeadingComponent,
|
|
1157
|
-
divider: DividerComponent,
|
|
1158
|
-
unitConversion: UnitConversionFieldComponent
|
|
1159
|
-
};
|
|
1160
|
-
function isControlComponent(component) {
|
|
1161
|
-
return isControlConfig(component.config) || component.config.controlType === ControlType.BUTTON;
|
|
1162
|
-
}
|
|
1163
|
-
|
|
1164
|
-
class CrisprFieldDirective {
|
|
1165
|
-
constructor(resolver, container, renderer) {
|
|
1166
|
-
this.resolver = resolver;
|
|
1167
|
-
this.container = container;
|
|
1168
|
-
this.renderer = renderer;
|
|
1169
|
-
}
|
|
1170
|
-
ngOnInit() {
|
|
1171
|
-
/**
|
|
1172
|
-
* create component and set values from config on its instance
|
|
1173
|
-
*/
|
|
1174
|
-
const component = this.config.component || FIELD_COMPONENTS[this.config.controlType];
|
|
1175
|
-
const factory = this.resolver.resolveComponentFactory(component);
|
|
1176
|
-
const componentRef = this.container.createComponent(factory);
|
|
1177
|
-
this.component = componentRef.instance;
|
|
1178
|
-
this.component.config = this.config;
|
|
1179
|
-
if (isControlComponent(this.component)) {
|
|
1180
|
-
this.component.group = this.group;
|
|
1181
|
-
if ('value' in this.component) {
|
|
1182
|
-
this.component.value = this.value;
|
|
1183
|
-
}
|
|
1184
|
-
}
|
|
1185
|
-
// adds any config classes to the dynamically generated component
|
|
1186
|
-
// doing this here keeps us from having to extend a base component into each field component individually
|
|
1187
|
-
if (!this.config.classes)
|
|
1188
|
-
return;
|
|
1189
|
-
this.config.classes.forEach((klass) => {
|
|
1190
|
-
// check for passing multiple classes in one array element
|
|
1191
|
-
if (klass.includes(' ')) {
|
|
1192
|
-
throw Error(`Improperly formatted class. '${klass}' cannot contain spaces.`);
|
|
1193
|
-
}
|
|
1194
|
-
else {
|
|
1195
|
-
this.renderer.addClass(componentRef.location.nativeElement, klass);
|
|
1196
|
-
}
|
|
1197
|
-
});
|
|
1198
|
-
}
|
|
1199
|
-
}
|
|
1200
|
-
CrisprFieldDirective.decorators = [
|
|
1201
|
-
{ type: Directive, args: [{
|
|
1202
|
-
selector: '[crisprField]'
|
|
1203
|
-
},] }
|
|
1204
|
-
];
|
|
1205
|
-
CrisprFieldDirective.ctorParameters = () => [
|
|
1206
|
-
{ type: ComponentFactoryResolver },
|
|
1207
|
-
{ type: ViewContainerRef },
|
|
1208
|
-
{ type: Renderer2 }
|
|
1209
|
-
];
|
|
1210
|
-
CrisprFieldDirective.propDecorators = {
|
|
1211
|
-
config: [{ type: Input }],
|
|
1212
|
-
group: [{ type: Input }],
|
|
1213
|
-
value: [{ type: Input }]
|
|
1214
|
-
};
|
|
1215
|
-
|
|
1216
|
-
class InitialControlValuePipe {
|
|
1217
|
-
// TODO: does changing any to unknown break anything?
|
|
1218
|
-
transform(initialFormValue, fieldConfig) {
|
|
1219
|
-
return (initialFormValue && isControlConfig(fieldConfig))
|
|
1220
|
-
? initialFormValue[fieldConfig.controlName] || null
|
|
1221
|
-
: null;
|
|
1222
|
-
}
|
|
1223
|
-
}
|
|
1224
|
-
InitialControlValuePipe.decorators = [
|
|
1225
|
-
{ type: Pipe, args: [{
|
|
1226
|
-
name: 'initialControlValue'
|
|
1227
|
-
},] }
|
|
1228
|
-
];
|
|
1229
|
-
|
|
1230
|
-
class CrisprFormsModule {
|
|
1231
|
-
}
|
|
1232
|
-
CrisprFormsModule.decorators = [
|
|
1233
|
-
{ type: NgModule, args: [{
|
|
1234
|
-
imports: [
|
|
1235
|
-
CommonModule,
|
|
1236
|
-
ReactiveFormsModule,
|
|
1237
|
-
FormValidationHandlerModule,
|
|
1238
|
-
MaterialModule
|
|
1239
|
-
],
|
|
1240
|
-
declarations: [
|
|
1241
|
-
CrisprFieldDirective,
|
|
1242
|
-
CrisprFormComponent,
|
|
1243
|
-
FormGroupListComponent,
|
|
1244
|
-
InitialControlValuePipe,
|
|
1245
|
-
SubGroupComponent,
|
|
1246
|
-
],
|
|
1247
|
-
exports: [
|
|
1248
|
-
CrisprFormComponent,
|
|
1249
|
-
MaterialModule
|
|
1250
|
-
],
|
|
1251
|
-
entryComponents: [
|
|
1252
|
-
FormGroupListComponent,
|
|
1253
|
-
SubGroupComponent
|
|
1254
|
-
],
|
|
1255
|
-
},] }
|
|
1256
|
-
];
|
|
1257
|
-
|
|
1258
|
-
/**
|
|
1259
|
-
* Generated bundle index. Do not edit.
|
|
1260
|
-
*/
|
|
1261
|
-
|
|
1262
|
-
export { AbstractAutocompleteComponent, AutocompleteChiplistFieldComponent, AutocompleteFieldComponent, ButtonComponent, CheckboxFieldComponent, ControlType, CrisprFieldComponent, CrisprFormComponent, CrisprFormsModule, DEFAULT_EMPTY_OPTIONS_MESSAGE, DatepickerFieldComponent, DividerComponent, FileUploadComponent, HeadingComponent, InputFieldComponent, RadioFieldComponent, SelectFieldComponent, SliderFieldComponent, TextareaFieldComponent, UnitConversionFieldComponent, buildFormGroupFromConfig, callOptionsIfFunction, checkControlForValues, checkControlsForValues, computeValueFromFields, createControlForType, crisprControlMixin, filterOptionsByLabel, isControlConfig, observablifyOptions, ɵ0, MaterialModule as ɵa, FieldContainerComponent as ɵb, InputFieldComponent as ɵc, SelectFieldComponent as ɵd, RadioFieldComponent as ɵe, AutocompleteFieldComponent as ɵf, AbstractAutocompleteComponent as ɵg, AutocompleteChiplistFieldComponent as ɵh, CheckboxFieldComponent as ɵi, TextareaFieldComponent as ɵj, DatepickerFieldComponent as ɵk, SliderFieldComponent as ɵl, ButtonComponent as ɵm, CrisprFieldComponent as ɵn, HeadingComponent as ɵo, DividerComponent as ɵp, FileUploadComponent as ɵq, UnitConversionFieldComponent as ɵr, InfoComponent as ɵs, OptionComponent as ɵt, SelectedFileComponent as ɵu, FileDropzoneDirective as ɵv, CrisprFieldDirective as ɵw, FormGroupListComponent as ɵx, InitialControlValuePipe as ɵy, SubGroupComponent as ɵz };
|
|
1263
|
-
//# sourceMappingURL=tft-crispr-forms.js.map
|